]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
authorDavid S. Miller <davem@davemloft.net>
Tue, 24 Feb 2009 11:51:03 +0000 (03:51 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Feb 2009 11:51:03 +0000 (03:51 -0800)
1514 files changed:
.mailmap
CREDITS
Documentation/ABI/testing/sysfs-firmware-memmap
Documentation/DocBook/Makefile
Documentation/DocBook/device-drivers.tmpl [new file with mode: 0644]
Documentation/DocBook/kernel-api.tmpl
Documentation/DocBook/mac80211.tmpl
Documentation/PCI/PCIEBUS-HOWTO.txt
Documentation/cgroups/cgroups.txt
Documentation/cgroups/cpusets.txt
Documentation/cpu-freq/user-guide.txt
Documentation/driver-model/device.txt
Documentation/feature-removal-schedule.txt
Documentation/filesystems/sysfs-pci.txt
Documentation/filesystems/sysfs.txt
Documentation/filesystems/ubifs.txt
Documentation/hwmon/hpfall.c [new file with mode: 0644]
Documentation/hwmon/lis3lv02d
Documentation/kernel-doc-nano-HOWTO.txt
Documentation/kernel-parameters.txt
Documentation/networking/dccp.txt
Documentation/networking/ip-sysctl.txt
Documentation/networking/timestamping.txt [new file with mode: 0644]
Documentation/networking/timestamping/.gitignore [new file with mode: 0644]
Documentation/networking/timestamping/Makefile [new file with mode: 0644]
Documentation/networking/timestamping/timestamping.c [new file with mode: 0644]
Documentation/powerpc/dts-bindings/fsl/tsec.txt
Documentation/tracers/mmiotrace.txt
MAINTAINERS
Makefile
README
arch/alpha/include/asm/bug.h
arch/alpha/include/asm/socket.h
arch/alpha/kernel/process.c
arch/alpha/kernel/smp.c
arch/arm/configs/at91sam9260ek_defconfig
arch/arm/configs/at91sam9261ek_defconfig
arch/arm/configs/at91sam9263ek_defconfig
arch/arm/configs/at91sam9rlek_defconfig
arch/arm/configs/qil-a9260_defconfig
arch/arm/include/asm/socket.h
arch/arm/kernel/elf.c
arch/arm/kernel/entry-armv.S
arch/arm/kernel/entry-common.S
arch/arm/kernel/irq.c
arch/arm/kernel/machine_kexec.c
arch/arm/mach-at91/at91cap9_devices.c
arch/arm/mach-at91/at91sam9260_devices.c
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-at91/at91sam9rl_devices.c
arch/arm/mach-at91/gpio.c
arch/arm/mach-at91/include/mach/board.h
arch/arm/mach-ep93xx/include/mach/gesbc9312.h [deleted file]
arch/arm/mach-ep93xx/include/mach/hardware.h
arch/arm/mach-kirkwood/irq.c
arch/arm/mach-msm/board-halibut.c
arch/arm/mach-mv78xx0/irq.c
arch/arm/mach-omap1/devices.c
arch/arm/mach-omap1/mcbsp.c
arch/arm/mach-omap2/clock.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/id.c
arch/arm/mach-omap2/irq.c
arch/arm/mach-omap2/mcbsp.c
arch/arm/mach-omap2/sleep24xx.S
arch/arm/mach-omap2/timer-gp.c
arch/arm/mach-orion5x/irq.c
arch/arm/mach-pxa/dma.c
arch/arm/mach-pxa/include/mach/regs-ac97.h
arch/arm/mach-pxa/include/mach/regs-ssp.h
arch/arm/mach-pxa/pxa300.c
arch/arm/mach-pxa/pxa320.c
arch/arm/mach-sa1100/generic.c
arch/arm/mm/fault-armv.c
arch/arm/mm/mmu.c
arch/arm/plat-omap/devices.c
arch/arm/plat-omap/dma.c
arch/arm/plat-omap/include/mach/cpu.h
arch/arm/plat-omap/include/mach/mcbsp.h
arch/arm/plat-omap/include/mach/mmc.h
arch/arm/plat-omap/mcbsp.c
arch/arm/plat-orion/gpio.c
arch/arm/plat-orion/include/plat/gpio.h
arch/avr32/include/asm/socket.h
arch/avr32/mach-at32ap/include/mach/board.h
arch/blackfin/Kconfig
arch/blackfin/Makefile
arch/blackfin/configs/BF518F-EZBRD_defconfig
arch/blackfin/configs/BF526-EZBRD_defconfig
arch/blackfin/configs/BF527-EZKIT_defconfig
arch/blackfin/configs/BF533-EZKIT_defconfig
arch/blackfin/configs/BF533-STAMP_defconfig
arch/blackfin/configs/BF537-STAMP_defconfig
arch/blackfin/configs/BF538-EZKIT_defconfig
arch/blackfin/configs/BF548-EZKIT_defconfig
arch/blackfin/configs/BF561-EZKIT_defconfig
arch/blackfin/configs/CM-BF527_defconfig
arch/blackfin/include/asm/checksum.h
arch/blackfin/include/asm/delay.h
arch/blackfin/include/asm/gpio.h
arch/blackfin/include/asm/kgdb.h
arch/blackfin/include/asm/mem_init.h
arch/blackfin/include/asm/pda.h
arch/blackfin/include/asm/reboot.h
arch/blackfin/include/asm/socket.h
arch/blackfin/kernel/Makefile
arch/blackfin/kernel/bfin_dma_5xx.c
arch/blackfin/kernel/bfin_gpio.c
arch/blackfin/kernel/cplb-mpu/cplbinit.c
arch/blackfin/kernel/cplb-nompu/cplbmgr.c
arch/blackfin/kernel/irqchip.c
arch/blackfin/kernel/reboot.c
arch/blackfin/kernel/setup.c
arch/blackfin/kernel/traps.c
arch/blackfin/mach-bf518/boards/ezbrd.c
arch/blackfin/mach-bf518/include/mach/portmux.h
arch/blackfin/mach-bf527/boards/cm_bf527.c
arch/blackfin/mach-bf527/boards/ezbrd.c
arch/blackfin/mach-bf527/boards/ezkit.c
arch/blackfin/mach-bf527/include/mach/portmux.h
arch/blackfin/mach-bf533/boards/blackstamp.c
arch/blackfin/mach-bf533/boards/stamp.c
arch/blackfin/mach-bf533/include/mach/portmux.h
arch/blackfin/mach-bf537/boards/cm_bf537.c
arch/blackfin/mach-bf537/boards/generic_board.c
arch/blackfin/mach-bf537/boards/minotaur.c
arch/blackfin/mach-bf537/boards/pnav10.c
arch/blackfin/mach-bf537/boards/stamp.c
arch/blackfin/mach-bf537/boards/tcm_bf537.c
arch/blackfin/mach-bf537/include/mach/portmux.h
arch/blackfin/mach-bf538/include/mach/portmux.h
arch/blackfin/mach-bf548/boards/ezkit.c
arch/blackfin/mach-bf548/include/mach/anomaly.h
arch/blackfin/mach-bf548/include/mach/bf548.h
arch/blackfin/mach-bf548/include/mach/gpio.h
arch/blackfin/mach-bf548/include/mach/portmux.h
arch/blackfin/mach-bf561/include/mach/defBF561.h
arch/blackfin/mach-bf561/include/mach/portmux.h
arch/blackfin/mach-common/clocks-init.c
arch/blackfin/mach-common/entry.S
arch/blackfin/mach-common/head.S
arch/blackfin/mach-common/interrupt.S
arch/blackfin/mach-common/ints-priority.c
arch/blackfin/mach-common/pm.c
arch/cris/include/asm/socket.h
arch/frv/mm/dma-alloc.c
arch/h8300/include/asm/socket.h
arch/ia64/Kconfig
arch/ia64/configs/xen_domu_defconfig [new file with mode: 0644]
arch/ia64/include/asm/kvm.h
arch/ia64/include/asm/mmzone.h
arch/ia64/include/asm/sn/bte.h
arch/ia64/include/asm/socket.h
arch/ia64/kernel/smpboot.c
arch/ia64/kvm/kvm-ia64.c
arch/ia64/kvm/process.c
arch/ia64/mm/numa.c
arch/ia64/sn/kernel/bte.c
arch/ia64/sn/kernel/io_acpi_init.c
arch/ia64/sn/kernel/io_init.c
arch/ia64/xen/Kconfig
arch/ia64/xen/xen_pv_ops.c
arch/m68k/atari/ataints.c
arch/m68k/atari/atakeyb.c
arch/m68k/atari/config.c
arch/m68k/atari/debug.c
arch/m68k/atari/time.c
arch/m68k/include/asm/atarihw.h
arch/m68k/include/asm/atariints.h
arch/m68k/include/asm/socket.h
arch/mips/include/asm/socket.h
arch/mips/include/asm/spinlock.h
arch/mn10300/Kconfig
arch/mn10300/unit-asb2305/pci.c
arch/parisc/include/asm/socket.h
arch/powerpc/boot/dts/mpc8313erdb.dts
arch/powerpc/configs/83xx/mpc8313_rdb_defconfig
arch/powerpc/include/asm/pgtable-4k.h
arch/powerpc/include/asm/pgtable-64k.h
arch/powerpc/include/asm/pgtable-ppc32.h
arch/powerpc/include/asm/socket.h
arch/powerpc/kernel/align.c
arch/powerpc/kernel/ftrace.c
arch/powerpc/kernel/pci-common.c
arch/powerpc/kvm/powerpc.c
arch/powerpc/lib/sstep.c
arch/powerpc/mm/fsl_booke_mmu.c
arch/powerpc/mm/hash_low_32.S
arch/powerpc/mm/numa.c
arch/powerpc/mm/pgtable_32.c
arch/powerpc/oprofile/cell/spu_profiler.c
arch/powerpc/platforms/82xx/pq2ads-pci-pic.c
arch/powerpc/platforms/ps3/mm.c
arch/powerpc/platforms/pseries/hotplug-memory.c
arch/powerpc/sysdev/cpm2_pic.c
arch/powerpc/sysdev/ipic.c
arch/s390/defconfig
arch/s390/include/asm/cputime.h
arch/s390/include/asm/lowcore.h
arch/s390/include/asm/setup.h
arch/s390/include/asm/socket.h
arch/s390/kernel/irq.c
arch/s390/kernel/setup.c
arch/s390/kvm/kvm-s390.c
arch/sh/boards/board-ap325rxa.c
arch/sh/configs/ap325rxa_defconfig
arch/sh/configs/migor_defconfig
arch/sh/include/asm/mutex-llsc.h
arch/sh/include/asm/socket.h
arch/sh/include/asm/syscall_32.h
arch/sh/include/asm/syscall_64.h
arch/sh/kernel/cpu/sh4/fpu.c
arch/sh/kernel/setup.c
arch/sh/kernel/signal_32.c
arch/sh/kernel/signal_64.c
arch/sh/lib/checksum.S
arch/sparc/include/asm/cpudata_64.h
arch/sparc/include/asm/irq_64.h
arch/sparc/include/asm/kdebug_64.h
arch/sparc/include/asm/nmi.h [new file with mode: 0644]
arch/sparc/include/asm/pcr.h [new file with mode: 0644]
arch/sparc/include/asm/pil.h
arch/sparc/include/asm/socket.h
arch/sparc/kernel/Makefile
arch/sparc/kernel/cpu.c
arch/sparc/kernel/head_64.S
arch/sparc/kernel/irq_64.c
arch/sparc/kernel/kernel.h
arch/sparc/kernel/nmi.c [new file with mode: 0644]
arch/sparc/kernel/pcr.c [new file with mode: 0644]
arch/sparc/kernel/process_64.c
arch/sparc/kernel/setup_64.c
arch/sparc/kernel/ttable.S
arch/sparc/lib/GENbzero.S
arch/sparc/lib/GENcopy_from_user.S
arch/sparc/lib/GENcopy_to_user.S
arch/sparc/lib/NG2copy_from_user.S
arch/sparc/lib/NG2copy_to_user.S
arch/sparc/lib/NGbzero.S
arch/sparc/lib/NGcopy_from_user.S
arch/sparc/lib/NGcopy_to_user.S
arch/sparc/lib/U1copy_from_user.S
arch/sparc/lib/U1copy_to_user.S
arch/sparc/lib/U3copy_from_user.S
arch/sparc/lib/U3copy_to_user.S
arch/sparc/lib/bzero.S
arch/sparc/lib/copy_in_user.S
arch/sparc/mm/fault_64.c
arch/sparc/oprofile/init.c
arch/um/drivers/vde_user.c
arch/x86/Kconfig
arch/x86/Kconfig.cpu
arch/x86/Kconfig.debug
arch/x86/ia32/ia32entry.S
arch/x86/include/asm/a.out-core.h
arch/x86/include/asm/cpufeature.h
arch/x86/include/asm/kvm.h
arch/x86/include/asm/math_emu.h
arch/x86/include/asm/mmzone_32.h
arch/x86/include/asm/mmzone_64.h
arch/x86/include/asm/mpspec.h
arch/x86/include/asm/page.h
arch/x86/include/asm/paravirt.h
arch/x86/include/asm/pgtable.h
arch/x86/include/asm/processor.h
arch/x86/include/asm/socket.h
arch/x86/include/asm/spinlock.h
arch/x86/include/asm/traps.h
arch/x86/include/asm/xen/page.h
arch/x86/kernel/acpi/boot.c
arch/x86/kernel/acpi/sleep.c
arch/x86/kernel/acpi/wakeup_64.S
arch/x86/kernel/apic.c
arch/x86/kernel/apm_32.c
arch/x86/kernel/cpu/cpufreq/Kconfig
arch/x86/kernel/cpu/cpufreq/powernow-k8.c
arch/x86/kernel/cpu/intel.c
arch/x86/kernel/cpu/intel_cacheinfo.c
arch/x86/kernel/cpu/mcheck/mce_64.c
arch/x86/kernel/cpu/mcheck/mce_amd_64.c
arch/x86/kernel/cpu/mcheck/mce_intel_64.c
arch/x86/kernel/entry_64.S
arch/x86/kernel/ftrace.c
arch/x86/kernel/hpet.c
arch/x86/kernel/i8237.c
arch/x86/kernel/io_apic.c
arch/x86/kernel/irqinit_32.c
arch/x86/kernel/olpc.c
arch/x86/kernel/paravirt.c
arch/x86/kernel/process.c
arch/x86/kernel/process_32.c
arch/x86/kernel/process_64.c
arch/x86/kernel/ptrace.c
arch/x86/kernel/setup.c
arch/x86/kernel/time_64.c
arch/x86/kernel/traps.c
arch/x86/kernel/vmi_32.c
arch/x86/kernel/vmiclock_32.c
arch/x86/kvm/i8254.c
arch/x86/kvm/irq.c
arch/x86/kvm/irq.h
arch/x86/kvm/lapic.c
arch/x86/kvm/lapic.h
arch/x86/kvm/mmu.c
arch/x86/kvm/svm.c
arch/x86/kvm/vmx.c
arch/x86/kvm/x86.c
arch/x86/mach-default/setup.c
arch/x86/mach-voyager/setup.c
arch/x86/mach-voyager/voyager_smp.c
arch/x86/math-emu/fpu_entry.c
arch/x86/math-emu/fpu_proto.h
arch/x86/math-emu/fpu_system.h
arch/x86/math-emu/get_address.c
arch/x86/mm/fault.c
arch/x86/mm/ioremap.c
arch/x86/mm/numa_64.c
arch/x86/mm/pageattr.c
arch/x86/mm/pat.c
arch/x86/xen/multicalls.h
arch/xtensa/include/asm/socket.h
block/blk-timeout.c
block/blktrace.c
block/bsg.c
block/genhd.c
crypto/ahash.c
crypto/algapi.c
crypto/api.c
crypto/lrw.c
crypto/scatterwalk.c
crypto/shash.c
drivers/acpi/Kconfig
drivers/acpi/Makefile
drivers/acpi/acpica/tbutils.c
drivers/acpi/acpica/uteval.c
drivers/acpi/battery.c
drivers/acpi/container.c
drivers/acpi/dock.c
drivers/acpi/ec.c
drivers/acpi/event.c
drivers/acpi/glue.c
drivers/acpi/osl.c
drivers/acpi/pci_link.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_perflib.c
drivers/acpi/sleep.c
drivers/acpi/tables.c
drivers/acpi/video.c
drivers/ata/ahci.c
drivers/ata/libata-core.c
drivers/ata/libata-eh.c
drivers/ata/libata-pmp.c
drivers/ata/libata-scsi.c
drivers/ata/libata-sff.c
drivers/ata/libata.h
drivers/ata/pata_qdi.c
drivers/ata/pata_via.c
drivers/ata/sata_mv.c
drivers/ata/sata_nv.c
drivers/ata/sata_sil.c
drivers/atm/firestream.c
drivers/base/base.h
drivers/base/dd.c
drivers/base/power/main.c
drivers/base/sys.c
drivers/block/aoe/aoe.h
drivers/block/aoe/aoenet.c
drivers/block/ataflop.c
drivers/block/cciss.c
drivers/block/floppy.c
drivers/block/nbd.c
drivers/block/paride/pg.c
drivers/char/Kconfig
drivers/char/pcmcia/synclink_cs.c
drivers/char/scc.h
drivers/char/sx.c
drivers/char/synclink.c
drivers/char/synclink_gt.c
drivers/char/synclinkmp.c
drivers/char/tpm/tpm_infineon.c
drivers/connector/cn_queue.c
drivers/connector/connector.c
drivers/cpufreq/cpufreq_ondemand.c
drivers/dma/dmaengine.c
drivers/dma/dw_dmac.c
drivers/dma/dw_dmac_regs.h
drivers/firewire/fw-card.c
drivers/firmware/memmap.c
drivers/gpu/drm/Kconfig
drivers/gpu/drm/drm_crtc.c
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/drm_fops.c
drivers/gpu/drm/drm_gem.c
drivers/gpu/drm/drm_irq.c
drivers/gpu/drm/drm_memory.c
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_gem_tiling.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/i915_reg.h
drivers/gpu/drm/i915/intel_bios.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_fb.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/gpu/drm/i915/intel_sdvo.c
drivers/gpu/drm/i915/intel_sdvo_regs.h
drivers/gpu/drm/i915/intel_tv.c
drivers/gpu/drm/radeon/radeon_cp.c
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hidraw.c
drivers/hwmon/f71882fg.c
drivers/hwmon/hp_accel.c
drivers/hwmon/lis3lv02d.c
drivers/hwmon/lis3lv02d.h
drivers/hwmon/vt1211.c
drivers/hwmon/w83627ehf.c
drivers/ide/qd65xx.c
drivers/ide/qd65xx.h
drivers/ieee1394/dv1394.c
drivers/infiniband/hw/cxgb3/cxio_hal.c
drivers/infiniband/hw/cxgb3/cxio_hal.h
drivers/infiniband/hw/cxgb3/iwch.c
drivers/infiniband/hw/nes/nes_hw.c
drivers/infiniband/hw/nes/nes_nic.c
drivers/infiniband/ulp/ipoib/ipoib_ib.c
drivers/isdn/hardware/mISDN/hfcpci.c
drivers/isdn/hardware/mISDN/hfcsusb.c
drivers/isdn/hardware/mISDN/hfcsusb.h
drivers/isdn/mISDN/clock.c
drivers/md/dm-io.c
drivers/md/dm-kcopyd.c
drivers/md/linear.c
drivers/md/md.c
drivers/md/raid1.c
drivers/media/common/tuners/tuner-simple.c
drivers/media/dvb/dvb-core/dmxdev.c
drivers/media/dvb/dvb-core/dvb_demux.c
drivers/media/radio/radio-si470x.c
drivers/media/video/gspca/gspca.c
drivers/media/video/ivtv/ivtv-ioctl.c
drivers/mfd/htc-egpio.c
drivers/mfd/pcf50633-core.c
drivers/mfd/sm501.c
drivers/mfd/twl4030-core.c
drivers/mfd/wm8350-core.c
drivers/mfd/wm8350-regmap.c
drivers/misc/Kconfig
drivers/misc/atmel-ssc.c
drivers/misc/hpilo.c
drivers/misc/hpilo.h
drivers/misc/sgi-xp/xpc.h
drivers/misc/sgi-xp/xpc_uv.c
drivers/mmc/card/block.c
drivers/mmc/card/mmc_test.c
drivers/mmc/host/atmel-mci.c
drivers/mmc/host/omap_hsmmc.c
drivers/mmc/host/s3cmci.c
drivers/mmc/host/sdhci-pci.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h
drivers/mtd/maps/sa1100-flash.c
drivers/mtd/nand/atmel_nand.c
drivers/net/3c501.c
drivers/net/3c505.c
drivers/net/3c507.c
drivers/net/3c509.c
drivers/net/3c515.c
drivers/net/3c523.c
drivers/net/3c527.c
drivers/net/3c59x.c
drivers/net/8139cp.c
drivers/net/8139too.c
drivers/net/82596.c
drivers/net/Kconfig
drivers/net/Makefile
drivers/net/amd8111e.c
drivers/net/arcnet/arc-rawmode.c
drivers/net/arcnet/arcnet.c
drivers/net/arcnet/capmode.c
drivers/net/arcnet/com20020-isa.c
drivers/net/arcnet/com20020-pci.c
drivers/net/arcnet/com20020.c
drivers/net/arcnet/rfc1051.c
drivers/net/arcnet/rfc1201.c
drivers/net/arm/ep93xx_eth.c
drivers/net/arm/etherh.c
drivers/net/arm/ixp4xx_eth.c
drivers/net/arm/ks8695net.c
drivers/net/at1700.c
drivers/net/atl1e/atl1e.h
drivers/net/atl1e/atl1e_main.c
drivers/net/atl1e/atl1e_param.c
drivers/net/atlx/atl1.c
drivers/net/atlx/atl2.c
drivers/net/au1000_eth.c
drivers/net/b44.c
drivers/net/bfin_mac.c
drivers/net/bmac.c
drivers/net/bnx2.c
drivers/net/bnx2x.h
drivers/net/bnx2x_fw_defs.h
drivers/net/bnx2x_hsi.h
drivers/net/bnx2x_init.h
drivers/net/bnx2x_init_values.h
drivers/net/bnx2x_link.c
drivers/net/bnx2x_link.h
drivers/net/bnx2x_main.c
drivers/net/bnx2x_reg.h
drivers/net/bonding/bond_3ad.h
drivers/net/bonding/bond_alb.c
drivers/net/bonding/bond_main.c
drivers/net/cassini.c
drivers/net/chelsio/sge.c
drivers/net/cpmac.c
drivers/net/cxgb3/adapter.h
drivers/net/cxgb3/ael1002.c
drivers/net/cxgb3/cxgb3_main.c
drivers/net/cxgb3/cxgb3_offload.c
drivers/net/cxgb3/cxgb3_offload.h
drivers/net/cxgb3/sge.c
drivers/net/declance.c
drivers/net/defxx.c
drivers/net/depca.c
drivers/net/e100.c
drivers/net/e1000/e1000.h
drivers/net/e1000/e1000_main.c
drivers/net/e1000e/82571.c
drivers/net/e1000e/defines.h
drivers/net/e1000e/e1000.h
drivers/net/e1000e/ethtool.c
drivers/net/e1000e/hw.h
drivers/net/e1000e/ich8lan.c
drivers/net/e1000e/lib.c
drivers/net/e1000e/netdev.c
drivers/net/e2100.c
drivers/net/ehea/ehea.h
drivers/net/ehea/ehea_main.c
drivers/net/ehea/ehea_qmr.c
drivers/net/enic/enic.h
drivers/net/enic/enic_main.c
drivers/net/enic/vnic_dev.c
drivers/net/enic/vnic_dev.h
drivers/net/enic/vnic_devcmd.h
drivers/net/enic/vnic_intr.h
drivers/net/epic100.c
drivers/net/fec.c
drivers/net/fec.h
drivers/net/forcedeth.c
drivers/net/fs_enet/fs_enet-main.c
drivers/net/fsl_pq_mdio.c [new file with mode: 0644]
drivers/net/fsl_pq_mdio.h [new file with mode: 0644]
drivers/net/gianfar.c
drivers/net/gianfar.h
drivers/net/gianfar_ethtool.c
drivers/net/gianfar_mii.c
drivers/net/gianfar_mii.h [deleted file]
drivers/net/gianfar_sysfs.c
drivers/net/hamachi.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/baycom_epp.c
drivers/net/hamradio/bpqether.c
drivers/net/hamradio/dmascc.c
drivers/net/hamradio/hdlcdrv.c
drivers/net/hamradio/mkiss.c
drivers/net/hamradio/scc.c
drivers/net/hamradio/yam.c
drivers/net/ibmveth.c
drivers/net/igb/Makefile
drivers/net/igb/e1000_82575.c
drivers/net/igb/e1000_82575.h
drivers/net/igb/e1000_defines.h
drivers/net/igb/e1000_hw.h
drivers/net/igb/e1000_mac.c
drivers/net/igb/e1000_mac.h
drivers/net/igb/e1000_mbx.c [new file with mode: 0644]
drivers/net/igb/e1000_mbx.h [new file with mode: 0644]
drivers/net/igb/e1000_nvm.c
drivers/net/igb/e1000_phy.c
drivers/net/igb/e1000_phy.h
drivers/net/igb/e1000_regs.h
drivers/net/igb/igb.h
drivers/net/igb/igb_ethtool.c
drivers/net/igb/igb_main.c
drivers/net/irda/sir_dev.c
drivers/net/ixgb/ixgb_main.c
drivers/net/ixgbe/Makefile
drivers/net/ixgbe/ixgbe.h
drivers/net/ixgbe/ixgbe_82598.c
drivers/net/ixgbe/ixgbe_common.c
drivers/net/ixgbe/ixgbe_common.h
drivers/net/ixgbe/ixgbe_dcb.c
drivers/net/ixgbe/ixgbe_dcb.h
drivers/net/ixgbe/ixgbe_dcb_82598.c
drivers/net/ixgbe/ixgbe_dcb_82598.h
drivers/net/ixgbe/ixgbe_dcb_nl.c
drivers/net/ixgbe/ixgbe_ethtool.c
drivers/net/ixgbe/ixgbe_main.c
drivers/net/ixgbe/ixgbe_phy.c
drivers/net/ixgbe/ixgbe_phy.h
drivers/net/ixgbe/ixgbe_type.h
drivers/net/ixp2000/ixpdev.c
drivers/net/jazzsonic.c
drivers/net/jme.h
drivers/net/korina.c
drivers/net/lance.c
drivers/net/macb.c
drivers/net/macsonic.c
drivers/net/mlx4/en_rx.c
drivers/net/mv643xx_eth.c
drivers/net/myri10ge/myri10ge.c
drivers/net/myri_sbus.c
drivers/net/natsemi.c
drivers/net/netxen/netxen_nic_hw.c
drivers/net/netxen/netxen_nic_hw.h
drivers/net/netxen/netxen_nic_main.c
drivers/net/ni65.c
drivers/net/niu.c
drivers/net/niu.h
drivers/net/ns83820.c
drivers/net/pasemi_mac.c
drivers/net/pcmcia/axnet_cs.c
drivers/net/pcnet32.c
drivers/net/phy/mdio-gpio.c
drivers/net/phy/mdio_bus.c
drivers/net/ppp_generic.c
drivers/net/pppoe.c
drivers/net/pppol2tp.c
drivers/net/pppox.c
drivers/net/ps3_gelic_net.c
drivers/net/ps3_gelic_wireless.c
drivers/net/qla3xxx.c
drivers/net/qlge/qlge_main.c
drivers/net/r6040.c
drivers/net/r8169.c
drivers/net/s2io.c
drivers/net/sb1250-mac.c
drivers/net/sc92031.c
drivers/net/sfc/Kconfig
drivers/net/sfc/bitfield.h
drivers/net/sfc/efx.c
drivers/net/sfc/efx.h
drivers/net/sfc/mtd.c
drivers/net/sfc/net_driver.h
drivers/net/sfc/rx.c
drivers/net/sfc/rx.h
drivers/net/sfc/sfe4001.c
drivers/net/sfc/tenxpress.c
drivers/net/skfp/h/smc.h
drivers/net/skfp/hwmtm.c
drivers/net/skfp/pcmplc.c
drivers/net/skfp/skfddi.c
drivers/net/skfp/smt.c
drivers/net/skge.c
drivers/net/sky2.c
drivers/net/smc911x.c
drivers/net/smc91x.c
drivers/net/smc91x.h
drivers/net/smsc911x.c
drivers/net/smsc9420.c
drivers/net/spider_net.c
drivers/net/starfire.c
drivers/net/sungem.c
drivers/net/tc35815.c
drivers/net/tehuti.c
drivers/net/tg3.c
drivers/net/tokenring/3c359.c
drivers/net/tokenring/abyss.c
drivers/net/tokenring/ibmtr.c
drivers/net/tokenring/lanstreamer.c
drivers/net/tokenring/lanstreamer.h
drivers/net/tokenring/madgemc.c
drivers/net/tokenring/olympic.c
drivers/net/tokenring/olympic.h
drivers/net/tokenring/smctr.c
drivers/net/tokenring/smctr.h
drivers/net/tokenring/tms380tr.c
drivers/net/tokenring/tms380tr.h
drivers/net/tokenring/tmspci.c
drivers/net/tsi108_eth.c
drivers/net/tulip/de4x5.c
drivers/net/tulip/interrupt.c
drivers/net/tulip/media.c
drivers/net/tulip/winbond-840.c
drivers/net/tun.c
drivers/net/typhoon.c
drivers/net/typhoon.h
drivers/net/ucc_geth.c
drivers/net/ucc_geth.h
drivers/net/ucc_geth_ethtool.c
drivers/net/ucc_geth_mii.c [deleted file]
drivers/net/ucc_geth_mii.h [deleted file]
drivers/net/usb/hso.c
drivers/net/usb/rndis_host.c
drivers/net/usb/smsc95xx.c
drivers/net/via-rhine.c
drivers/net/via-velocity.h
drivers/net/virtio_net.c
drivers/net/wan/c101.c
drivers/net/wan/cosa.c
drivers/net/wan/dscc4.c
drivers/net/wan/farsync.c
drivers/net/wan/hd64572.c
drivers/net/wan/hdlc.c
drivers/net/wan/hdlc_cisco.c
drivers/net/wan/hdlc_fr.c
drivers/net/wan/hdlc_ppp.c
drivers/net/wan/hdlc_raw.c
drivers/net/wan/hdlc_raw_eth.c
drivers/net/wan/hdlc_x25.c
drivers/net/wan/hostess_sv11.c
drivers/net/wan/ixp4xx_hss.c
drivers/net/wan/lapbether.c
drivers/net/wan/lmc/lmc_main.c
drivers/net/wan/lmc/lmc_proto.c
drivers/net/wan/n2.c
drivers/net/wan/pc300too.c
drivers/net/wan/pci200syn.c
drivers/net/wan/sbni.c
drivers/net/wan/sealevel.c
drivers/net/wan/wanxl.c
drivers/net/wan/z85230.c
drivers/net/wimax/i2400m/fw.c
drivers/net/wimax/i2400m/i2400m.h
drivers/net/wimax/i2400m/netdev.c
drivers/net/wimax/i2400m/sdio.c
drivers/net/wimax/i2400m/usb.c
drivers/net/wireless/Kconfig
drivers/net/wireless/airo.c
drivers/net/wireless/ath5k/ath5k.h
drivers/net/wireless/ath5k/attach.c
drivers/net/wireless/ath5k/base.c
drivers/net/wireless/ath5k/base.h
drivers/net/wireless/ath5k/caps.c
drivers/net/wireless/ath5k/debug.c
drivers/net/wireless/ath5k/debug.h
drivers/net/wireless/ath5k/eeprom.c
drivers/net/wireless/ath5k/eeprom.h
drivers/net/wireless/ath5k/gpio.c
drivers/net/wireless/ath5k/initvals.c
drivers/net/wireless/ath5k/pcu.c
drivers/net/wireless/ath5k/phy.c
drivers/net/wireless/ath5k/qcu.c
drivers/net/wireless/ath5k/reg.h
drivers/net/wireless/ath5k/reset.c
drivers/net/wireless/ath5k/rfbuffer.h [new file with mode: 0644]
drivers/net/wireless/ath5k/rfgain.h [new file with mode: 0644]
drivers/net/wireless/ath9k/Makefile
drivers/net/wireless/ath9k/ahb.c [new file with mode: 0644]
drivers/net/wireless/ath9k/ani.c
drivers/net/wireless/ath9k/ani.h [new file with mode: 0644]
drivers/net/wireless/ath9k/ath9k.h
drivers/net/wireless/ath9k/beacon.c
drivers/net/wireless/ath9k/calib.c
drivers/net/wireless/ath9k/calib.h [new file with mode: 0644]
drivers/net/wireless/ath9k/core.h [deleted file]
drivers/net/wireless/ath9k/debug.c
drivers/net/wireless/ath9k/debug.h [new file with mode: 0644]
drivers/net/wireless/ath9k/eeprom.c
drivers/net/wireless/ath9k/eeprom.h [new file with mode: 0644]
drivers/net/wireless/ath9k/hw.c
drivers/net/wireless/ath9k/hw.h
drivers/net/wireless/ath9k/initvals.h
drivers/net/wireless/ath9k/mac.c
drivers/net/wireless/ath9k/mac.h [new file with mode: 0644]
drivers/net/wireless/ath9k/main.c
drivers/net/wireless/ath9k/pci.c [new file with mode: 0644]
drivers/net/wireless/ath9k/phy.c
drivers/net/wireless/ath9k/phy.h
drivers/net/wireless/ath9k/rc.c
drivers/net/wireless/ath9k/rc.h
drivers/net/wireless/ath9k/recv.c
drivers/net/wireless/ath9k/reg.h
drivers/net/wireless/ath9k/regd.c
drivers/net/wireless/ath9k/regd.h
drivers/net/wireless/ath9k/regd_common.h
drivers/net/wireless/ath9k/xmit.c
drivers/net/wireless/atmel.c
drivers/net/wireless/b43/Kconfig
drivers/net/wireless/b43/Makefile
drivers/net/wireless/b43/b43.h
drivers/net/wireless/b43/debugfs.c
drivers/net/wireless/b43/debugfs.h
drivers/net/wireless/b43/main.c
drivers/net/wireless/b43/main.h
drivers/net/wireless/b43/phy_g.c
drivers/net/wireless/b43/phy_lp.c
drivers/net/wireless/b43/phy_lp.h
drivers/net/wireless/b43/tables_lpphy.c [new file with mode: 0644]
drivers/net/wireless/b43/tables_lpphy.h [new file with mode: 0644]
drivers/net/wireless/b43legacy/leds.c
drivers/net/wireless/b43legacy/main.c
drivers/net/wireless/hostap/hostap_80211_rx.c
drivers/net/wireless/hostap/hostap_ap.c
drivers/net/wireless/hostap/hostap_ioctl.c
drivers/net/wireless/ipw2x00/Kconfig
drivers/net/wireless/ipw2x00/ipw2100.c
drivers/net/wireless/ipw2x00/ipw2200.c
drivers/net/wireless/iwlwifi/Kconfig
drivers/net/wireless/iwlwifi/Makefile
drivers/net/wireless/iwlwifi/iwl-100.c [new file with mode: 0644]
drivers/net/wireless/iwlwifi/iwl-3945-commands.h [deleted file]
drivers/net/wireless/iwlwifi/iwl-3945-debug.h [deleted file]
drivers/net/wireless/iwlwifi/iwl-3945-fh.h [new file with mode: 0644]
drivers/net/wireless/iwlwifi/iwl-3945-hw.h
drivers/net/wireless/iwlwifi/iwl-3945-io.h [deleted file]
drivers/net/wireless/iwlwifi/iwl-3945-led.c
drivers/net/wireless/iwlwifi/iwl-3945-led.h
drivers/net/wireless/iwlwifi/iwl-3945-rs.c
drivers/net/wireless/iwlwifi/iwl-3945-rs.h [deleted file]
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-3945.h
drivers/net/wireless/iwlwifi/iwl-4965-hw.h
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000-hw.h
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000-hw.h [moved from drivers/net/wireless/iwlwifi/iwl-3945-core.h with 64% similarity]
drivers/net/wireless/iwlwifi/iwl-6000.c [new file with mode: 0644]
drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c [deleted file]
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
drivers/net/wireless/iwlwifi/iwl-agn-rs.h
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-calib.c
drivers/net/wireless/iwlwifi/iwl-calib.h
drivers/net/wireless/iwlwifi/iwl-commands.h
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl-csr.h
drivers/net/wireless/iwlwifi/iwl-debug.h
drivers/net/wireless/iwlwifi/iwl-debugfs.c
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-eeprom.c
drivers/net/wireless/iwlwifi/iwl-eeprom.h
drivers/net/wireless/iwlwifi/iwl-fh.h
drivers/net/wireless/iwlwifi/iwl-hcmd.c
drivers/net/wireless/iwlwifi/iwl-helpers.h
drivers/net/wireless/iwlwifi/iwl-io.h
drivers/net/wireless/iwlwifi/iwl-led.c
drivers/net/wireless/iwlwifi/iwl-led.h
drivers/net/wireless/iwlwifi/iwl-power.c
drivers/net/wireless/iwlwifi/iwl-power.h
drivers/net/wireless/iwlwifi/iwl-prph.h
drivers/net/wireless/iwlwifi/iwl-rfkill.c
drivers/net/wireless/iwlwifi/iwl-rfkill.h
drivers/net/wireless/iwlwifi/iwl-rx.c
drivers/net/wireless/iwlwifi/iwl-scan.c
drivers/net/wireless/iwlwifi/iwl-spectrum.c
drivers/net/wireless/iwlwifi/iwl-spectrum.h
drivers/net/wireless/iwlwifi/iwl-sta.c
drivers/net/wireless/iwlwifi/iwl-sta.h
drivers/net/wireless/iwlwifi/iwl-tx.c
drivers/net/wireless/iwlwifi/iwl3945-base.c
drivers/net/wireless/libertas/Makefile
drivers/net/wireless/libertas/debugfs.c
drivers/net/wireless/libertas/defs.h
drivers/net/wireless/libertas/host.h
drivers/net/wireless/libertas/hostcmd.h
drivers/net/wireless/libertas/if_cs.c
drivers/net/wireless/libertas/if_spi.c [new file with mode: 0644]
drivers/net/wireless/libertas/if_spi.h [new file with mode: 0644]
drivers/net/wireless/libertas/main.c
drivers/net/wireless/libertas/scan.c
drivers/net/wireless/libertas_tf/cmd.c
drivers/net/wireless/libertas_tf/libertas_tf.h
drivers/net/wireless/mac80211_hwsim.c
drivers/net/wireless/orinoco/Kconfig [new file with mode: 0644]
drivers/net/wireless/orinoco/Makefile
drivers/net/wireless/orinoco/airport.c
drivers/net/wireless/orinoco/fw.c [new file with mode: 0644]
drivers/net/wireless/orinoco/fw.h [new file with mode: 0644]
drivers/net/wireless/orinoco/hermes.c
drivers/net/wireless/orinoco/hermes.h
drivers/net/wireless/orinoco/hermes_dld.c
drivers/net/wireless/orinoco/hw.c [new file with mode: 0644]
drivers/net/wireless/orinoco/hw.h [new file with mode: 0644]
drivers/net/wireless/orinoco/main.c [new file with mode: 0644]
drivers/net/wireless/orinoco/main.h [new file with mode: 0644]
drivers/net/wireless/orinoco/mic.c [new file with mode: 0644]
drivers/net/wireless/orinoco/mic.h [new file with mode: 0644]
drivers/net/wireless/orinoco/orinoco.c [deleted file]
drivers/net/wireless/orinoco/orinoco.h
drivers/net/wireless/orinoco/orinoco_cs.c
drivers/net/wireless/orinoco/orinoco_nortel.c
drivers/net/wireless/orinoco/orinoco_pci.c
drivers/net/wireless/orinoco/orinoco_pci.h
drivers/net/wireless/orinoco/orinoco_plx.c
drivers/net/wireless/orinoco/orinoco_tmd.c
drivers/net/wireless/orinoco/scan.c [new file with mode: 0644]
drivers/net/wireless/orinoco/scan.h [new file with mode: 0644]
drivers/net/wireless/orinoco/spectrum_cs.c
drivers/net/wireless/orinoco/wext.c [new file with mode: 0644]
drivers/net/wireless/orinoco/wext.h [new file with mode: 0644]
drivers/net/wireless/p54/Kconfig
drivers/net/wireless/p54/Makefile
drivers/net/wireless/p54/p54.h
drivers/net/wireless/p54/p54common.c
drivers/net/wireless/p54/p54common.h
drivers/net/wireless/p54/p54pci.c
drivers/net/wireless/p54/p54spi.c [new file with mode: 0644]
drivers/net/wireless/p54/p54spi.h [new file with mode: 0644]
drivers/net/wireless/p54/p54spi_eeprom.h [new file with mode: 0644]
drivers/net/wireless/p54/p54usb.c
drivers/net/wireless/p54/p54usb.h
drivers/net/wireless/prism54/isl_ioctl.c
drivers/net/wireless/prism54/islpci_eth.c
drivers/net/wireless/prism54/islpci_mgt.h
drivers/net/wireless/prism54/oid_mgt.c
drivers/net/wireless/rndis_wlan.c
drivers/net/wireless/rt2x00/Kconfig
drivers/net/wireless/rt2x00/Makefile
drivers/net/wireless/rt2x00/rt2400pci.c
drivers/net/wireless/rt2x00/rt2400pci.h
drivers/net/wireless/rt2x00/rt2500pci.c
drivers/net/wireless/rt2x00/rt2500pci.h
drivers/net/wireless/rt2x00/rt2500usb.c
drivers/net/wireless/rt2x00/rt2500usb.h
drivers/net/wireless/rt2x00/rt2x00.h
drivers/net/wireless/rt2x00/rt2x00config.c
drivers/net/wireless/rt2x00/rt2x00crypto.c
drivers/net/wireless/rt2x00/rt2x00debug.c
drivers/net/wireless/rt2x00/rt2x00debug.h
drivers/net/wireless/rt2x00/rt2x00dev.c
drivers/net/wireless/rt2x00/rt2x00dump.h
drivers/net/wireless/rt2x00/rt2x00firmware.c
drivers/net/wireless/rt2x00/rt2x00leds.c
drivers/net/wireless/rt2x00/rt2x00leds.h
drivers/net/wireless/rt2x00/rt2x00lib.h
drivers/net/wireless/rt2x00/rt2x00link.c [new file with mode: 0644]
drivers/net/wireless/rt2x00/rt2x00mac.c
drivers/net/wireless/rt2x00/rt2x00pci.c
drivers/net/wireless/rt2x00/rt2x00pci.h
drivers/net/wireless/rt2x00/rt2x00queue.c
drivers/net/wireless/rt2x00/rt2x00queue.h
drivers/net/wireless/rt2x00/rt2x00reg.h
drivers/net/wireless/rt2x00/rt2x00rfkill.c
drivers/net/wireless/rt2x00/rt2x00usb.c
drivers/net/wireless/rt2x00/rt2x00usb.h
drivers/net/wireless/rt2x00/rt61pci.c
drivers/net/wireless/rt2x00/rt61pci.h
drivers/net/wireless/rt2x00/rt73usb.c
drivers/net/wireless/rt2x00/rt73usb.h
drivers/net/wireless/rtl818x/rtl8187.h
drivers/net/wireless/rtl818x/rtl8187_dev.c
drivers/net/wireless/strip.c
drivers/net/wireless/wavelan.c
drivers/net/wireless/wl3501_cs.c
drivers/net/wireless/zd1201.c
drivers/net/wireless/zd1211rw/zd_def.h
drivers/net/wireless/zd1211rw/zd_mac.c
drivers/net/xen-netfront.c
drivers/net/xtsonic.c
drivers/net/znet.c
drivers/parport/parport_atari.c
drivers/parport/parport_serial.c
drivers/pci/intel-iommu.c
drivers/pci/msi.c
drivers/pci/pci-driver.c
drivers/pci/pci-sysfs.c
drivers/pci/pci.c
drivers/pci/pci.h
drivers/pci/pcie/aspm.c
drivers/pci/pcie/portdrv_pci.c
drivers/pci/rom.c
drivers/platform/x86/Kconfig
drivers/platform/x86/asus-laptop.c
drivers/platform/x86/asus_acpi.c
drivers/platform/x86/eeepc-laptop.c
drivers/platform/x86/fujitsu-laptop.c
drivers/platform/x86/hp-wmi.c
drivers/platform/x86/panasonic-laptop.c
drivers/power/pcf50633-charger.c
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/rtc-au1xxx.c
drivers/rtc/rtc-dm355evm.c [new file with mode: 0644]
drivers/rtc/rtc-ds1390.c
drivers/rtc/rtc-pxa.c
drivers/s390/block/dasd.c
drivers/s390/block/dasd_devmap.c
drivers/s390/char/sclp.c
drivers/s390/char/sclp_cmd.c
drivers/s390/net/claw.c
drivers/s390/net/ctcm_main.c
drivers/s390/net/lcs.c
drivers/s390/net/netiucv.c
drivers/scsi/cxgb3i/cxgb3i_ddp.h
drivers/scsi/ibmvscsi/ibmvfc.c
drivers/scsi/ibmvscsi/ibmvfc.h
drivers/scsi/ibmvscsi/ibmvscsi.c
drivers/scsi/libiscsi.c
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_devtbl.h
drivers/scsi/qla2xxx/qla_fw.h
drivers/scsi/qla2xxx/qla_gbl.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_mbx.c
drivers/scsi/qla2xxx/qla_mid.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qla2xxx/qla_sup.c
drivers/scsi/qla2xxx/qla_version.h
drivers/scsi/scsi_scan.c
drivers/scsi/scsi_transport_fc.c
drivers/scsi/scsi_transport_iscsi.c
drivers/scsi/sg.c
drivers/serial/8250.c
drivers/serial/8250_pci.c
drivers/serial/atmel_serial.c
drivers/serial/jsm/jsm_driver.c
drivers/spi/spi_gpio.c
drivers/ssb/Makefile
drivers/ssb/b43_pci_bridge.c
drivers/ssb/driver_chipcommon.c
drivers/ssb/driver_chipcommon_pmu.c [new file with mode: 0644]
drivers/ssb/pci.c
drivers/staging/android/Kconfig
drivers/staging/android/ram_console.c
drivers/staging/android/timed_gpio.c
drivers/staging/at76_usb/Kconfig
drivers/staging/at76_usb/at76_usb.c
drivers/staging/at76_usb/at76_usb.h
drivers/staging/panel/panel.c
drivers/usb/Makefile
drivers/usb/class/cdc-acm.c
drivers/usb/core/hcd-pci.c
drivers/usb/core/hcd.h
drivers/usb/gadget/fsl_qe_udc.c
drivers/usb/gadget/pxa25x_udc.c
drivers/usb/gadget/rndis.c
drivers/usb/host/ehci-pci.c
drivers/usb/host/ohci-pci.c
drivers/usb/host/uhci-hcd.c
drivers/usb/host/whci/asl.c
drivers/usb/host/whci/pzl.c
drivers/usb/serial/aircable.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.h
drivers/usb/serial/option.c
drivers/usb/serial/ti_usb_3410_5052.c
drivers/usb/serial/ti_usb_3410_5052.h
drivers/usb/storage/scsiglue.c
drivers/usb/storage/transport.c
drivers/usb/storage/unusual_devs.h
drivers/video/Kconfig
drivers/video/atafb.c
drivers/video/aty/aty128fb.c
drivers/video/aty/atyfb_base.c
drivers/video/aty/radeon_base.c
drivers/video/aty/radeon_pm.c
drivers/video/aty/radeonfb.h
drivers/video/backlight/Makefile
drivers/video/backlight/da903x_bl.c [moved from drivers/video/backlight/da903x.c with 100% similarity]
drivers/video/bfin-t350mcqb-fb.c
drivers/video/fbcmap.c
drivers/video/fbmem.c
drivers/video/geode/gx1fb_core.c
drivers/video/geode/gxfb_core.c
drivers/video/geode/lxfb_core.c
drivers/video/uvesafb.c
drivers/w1/slaves/w1_therm.c
drivers/watchdog/Kconfig
drivers/watchdog/at91rm9200_wdt.c
drivers/watchdog/at91sam9_wdt.c
drivers/watchdog/iTCO_vendor_support.c
drivers/watchdog/iTCO_wdt.c
drivers/xen/manage.c
fs/binfmt_elf.c
fs/bio.c
fs/btrfs/Kconfig
fs/btrfs/async-thread.c
fs/btrfs/compression.c
fs/btrfs/ctree.c
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent-tree.c
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h
fs/btrfs/extent_map.c
fs/btrfs/file.c
fs/btrfs/inode-map.c
fs/btrfs/inode.c
fs/btrfs/ioctl.c
fs/btrfs/locking.c
fs/btrfs/locking.h
fs/btrfs/ordered-data.c
fs/btrfs/ref-cache.c
fs/btrfs/ref-cache.h
fs/btrfs/super.c
fs/btrfs/transaction.c
fs/btrfs/tree-defrag.c
fs/btrfs/tree-log.c
fs/btrfs/volumes.c
fs/btrfs/xattr.c
fs/btrfs/xattr.h
fs/buffer.c
fs/cifs/CHANGES
fs/cifs/cifsfs.h
fs/cifs/cifsglob.h
fs/cifs/cifsproto.h
fs/cifs/cifssmb.c
fs/cifs/connect.c
fs/cifs/dir.c
fs/cifs/inode.c
fs/cifs/readdir.c
fs/cifs/sess.c
fs/compat.c
fs/compat_ioctl.c
fs/dquot.c
fs/ecryptfs/crypto.c
fs/exec.c
fs/ext2/super.c
fs/ext3/super.c
fs/ext4/ext4.h
fs/ext4/inode.c
fs/ext4/mballoc.c
fs/ext4/migrate.c
fs/ext4/super.c
fs/hugetlbfs/inode.c
fs/internal.h
fs/jbd/journal.c
fs/jbd2/journal.c
fs/jbd2/transaction.c
fs/lockd/svclock.c
fs/namespace.c
fs/notify/inotify/inotify.c
fs/ocfs2/alloc.c
fs/ocfs2/dcache.c
fs/ocfs2/dcache.h
fs/ocfs2/dlmglue.c
fs/ocfs2/journal.h
fs/ocfs2/ocfs2.h
fs/ocfs2/quota_global.c
fs/ocfs2/super.c
fs/ocfs2/xattr.c
fs/proc/inode.c
fs/seq_file.c
fs/super.c
fs/timerfd.c
fs/ubifs/budget.c
fs/ubifs/debug.c
fs/ubifs/debug.h
fs/ubifs/dir.c
fs/ubifs/file.c
fs/ubifs/gc.c
fs/ubifs/io.c
fs/ubifs/journal.c
fs/ubifs/lprops.c
fs/ubifs/lpt_commit.c
fs/ubifs/master.c
fs/ubifs/orphan.c
fs/ubifs/super.c
fs/ubifs/tnc.c
fs/ubifs/ubifs.h
fs/xfs/linux-2.6/xfs_buf.c
fs/xfs/linux-2.6/xfs_sync.c
fs/xfs/xfs_dfrag.c
fs/xfs/xfs_log_recover.c
include/acpi/pdc_intel.h
include/asm-frv/pgtable.h
include/asm-frv/socket.h
include/asm-m32r/socket.h
include/asm-mn10300/socket.h
include/crypto/hash.h
include/drm/drmP.h
include/drm/drm_crtc.h
include/drm/drm_crtc_helper.h
include/drm/i915_drm.h
include/linux/arcdevice.h
include/linux/async.h
include/linux/ata.h
include/linux/ath9k_platform.h [new file with mode: 0644]
include/linux/bio.h
include/linux/blktrace_api.h
include/linux/cgroup.h
include/linux/clocksource.h
include/linux/com20020.h
include/linux/connector.h
include/linux/crypto.h
include/linux/dccp.h
include/linux/device.h
include/linux/dmaengine.h
include/linux/errqueue.h
include/linux/etherdevice.h
include/linux/ethtool.h
include/linux/fb.h
include/linux/firmware-map.h
include/linux/fs.h
include/linux/hdlc.h
include/linux/hdlcdrv.h
include/linux/hugetlb.h
include/linux/ibmtr.h
include/linux/ieee80211.h
include/linux/if.h
include/linux/if_ether.h
include/linux/if_pppox.h
include/linux/if_tun.h
include/linux/if_tunnel.h
include/linux/inetdevice.h
include/linux/init_task.h
include/linux/jbd2.h
include/linux/kernel.h
include/linux/kvm.h
include/linux/kvm_host.h
include/linux/libata.h
include/linux/mm.h
include/linux/mmzone.h
include/linux/module.h
include/linux/mroute.h
include/linux/ncp_no.h
include/linux/net_tstamp.h [new file with mode: 0644]
include/linux/netdevice.h
include/linux/netfilter_bridge.h
include/linux/netlink.h
include/linux/nl80211.h
include/linux/pci.h
include/linux/pci_ids.h
include/linux/pim.h
include/linux/pm.h
include/linux/ppp_channel.h
include/linux/sched.h
include/linux/sctp.h
include/linux/seq_file.h
include/linux/serial_core.h
include/linux/skbuff.h
include/linux/slab.h
include/linux/smsc911x.h
include/linux/sockios.h
include/linux/soundcard.h
include/linux/spi/libertas_spi.h [new file with mode: 0644]
include/linux/spi/spi_bitbang.h
include/linux/spinlock.h
include/linux/ssb/ssb_driver_chipcommon.h
include/linux/ssb/ssb_regs.h
include/linux/syscalls.h
include/linux/sysctl.h
include/linux/tcp.h
include/linux/timecompare.h [new file with mode: 0644]
include/linux/timerfd.h
include/linux/usb/rndis_host.h
include/linux/virtio_net.h
include/linux/vmalloc.h
include/linux/wait.h
include/linux/wireless.h
include/net/atmclip.h
include/net/cfg80211.h
include/net/inet_ecn.h
include/net/inet_hashtables.h
include/net/ip.h
include/net/ip_vs.h
include/net/ipv6.h
include/net/ipx.h
include/net/mac80211.h
include/net/net_namespace.h
include/net/netns/ipv4.h
include/net/netrom.h
include/net/phonet/phonet.h
include/net/phonet/pn_dev.h
include/net/pkt_sched.h
include/net/sch_generic.h
include/net/sctp/checksum.h
include/net/sctp/sctp.h
include/net/sctp/structs.h
include/net/sock.h
include/net/transp_v6.h
include/net/wireless.h
include/rdma/ib_verbs.h
include/video/aty128.h
include/video/mach64.h
include/video/radeon.h
init/do_mounts.c
init/do_mounts_md.c
ipc/shm.c
kernel/Makefile
kernel/async.c
kernel/cgroup.c
kernel/exit.c
kernel/fork.c
kernel/futex.c
kernel/irq/numa_migrate.c
kernel/itimer.c
kernel/kexec.c
kernel/posix-cpu-timers.c
kernel/power/Makefile
kernel/power/console.c
kernel/power/disk.c
kernel/power/main.c
kernel/power/swap.c
kernel/power/user.c
kernel/printk.c
kernel/profile.c
kernel/sched.c
kernel/sched_fair.c
kernel/sched_stats.h
kernel/signal.c
kernel/sys.c
kernel/sysctl.c
kernel/sysctl_check.c
kernel/time/Makefile
kernel/time/clocksource.c
kernel/time/timecompare.c [new file with mode: 0644]
kernel/trace/Kconfig
kernel/trace/ftrace.c
kernel/trace/trace_mmiotrace.c
kernel/trace/trace_selftest.c
kernel/user.c
kernel/wait.c
lib/Kconfig.debug
lib/kobject_uevent.c
mm/fremap.c
mm/hugetlb.c
mm/memory.c
mm/migrate.c
mm/mlock.c
mm/mmap.c
mm/mprotect.c
mm/page-writeback.c
mm/page_alloc.c
mm/page_cgroup.c
mm/page_io.c
mm/rmap.c
mm/slab.c
mm/slob.c
mm/slub.c
mm/swapfile.c
mm/util.c
mm/vmalloc.c
mm/vmscan.c
net/802/psnap.c
net/8021q/vlan.c
net/8021q/vlan_core.c
net/Kconfig
net/appletalk/ddp.c
net/appletalk/dev.c
net/atm/br2684.c
net/atm/clip.c
net/atm/lec.c
net/atm/lec.h
net/ax25/af_ax25.c
net/ax25/ax25_iface.c
net/bridge/br_netfilter.c
net/can/af_can.c
net/can/raw.c
net/compat.c
net/core/dev.c
net/core/ethtool.c
net/core/net_namespace.c
net/core/skbuff.c
net/core/sock.c
net/dccp/dccp.h
net/dccp/feat.c
net/dccp/feat.h
net/dccp/minisocks.c
net/dccp/options.c
net/dccp/proto.c
net/dccp/sysctl.c
net/decnet/af_decnet.c
net/decnet/dn_route.c
net/dsa/mv88e6123_61_65.c
net/dsa/mv88e6131.c
net/dsa/tag_dsa.c
net/dsa/tag_edsa.c
net/dsa/tag_trailer.c
net/econet/af_econet.c
net/ipv4/Kconfig
net/ipv4/af_inet.c
net/ipv4/arp.c
net/ipv4/cipso_ipv4.c
net/ipv4/devinet.c
net/ipv4/fib_frontend.c
net/ipv4/icmp.c
net/ipv4/inet_connection_sock.c
net/ipv4/inet_hashtables.c
net/ipv4/ip_gre.c
net/ipv4/ip_output.c
net/ipv4/ipconfig.c
net/ipv4/ipip.c
net/ipv4/ipmr.c
net/ipv4/netfilter/nf_nat_snmp_basic.c
net/ipv4/proc.c
net/ipv4/raw.c
net/ipv4/route.c
net/ipv4/tcp.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_output.c
net/ipv4/udp.c
net/ipv4/xfrm4_policy.c
net/ipv6/addrconf.c
net/ipv6/af_inet6.c
net/ipv6/ndisc.c
net/ipv6/route.c
net/ipv6/tcp_ipv6.c
net/ipv6/xfrm6_policy.c
net/ipv6/xfrm6_state.c
net/ipx/af_ipx.c
net/irda/irmod.c
net/llc/af_llc.c
net/llc/llc_core.c
net/mac80211/Makefile
net/mac80211/aes_cmac.c [new file with mode: 0644]
net/mac80211/aes_cmac.h [new file with mode: 0644]
net/mac80211/agg-rx.c [new file with mode: 0644]
net/mac80211/agg-tx.c [new file with mode: 0644]
net/mac80211/cfg.c
net/mac80211/debugfs.c
net/mac80211/debugfs_key.c
net/mac80211/debugfs_key.h
net/mac80211/debugfs_sta.c
net/mac80211/ht.c
net/mac80211/ieee80211_i.h
net/mac80211/iface.c
net/mac80211/key.c
net/mac80211/key.h
net/mac80211/main.c
net/mac80211/mesh.c
net/mac80211/mesh.h
net/mac80211/mesh_hwmp.c
net/mac80211/mesh_plink.c
net/mac80211/mlme.c
net/mac80211/pm.c [new file with mode: 0644]
net/mac80211/rx.c
net/mac80211/scan.c
net/mac80211/spectmgmt.c
net/mac80211/sta_info.c
net/mac80211/sta_info.h
net/mac80211/tx.c
net/mac80211/util.c
net/mac80211/wext.c
net/mac80211/wpa.c
net/mac80211/wpa.h
net/netfilter/ipvs/ip_vs_sync.c
net/netfilter/nf_conntrack_amanda.c
net/netfilter/nf_conntrack_h323_main.c
net/netfilter/nf_conntrack_netbios_ns.c
net/netfilter/nf_conntrack_pptp.c
net/netfilter/nf_tproxy_core.c
net/netlink/af_netlink.c
net/netrom/af_netrom.c
net/netrom/nr_dev.c
net/phonet/af_phonet.c
net/phonet/pn_dev.c
net/phonet/pn_netlink.c
net/rose/af_rose.c
net/rose/rose_dev.c
net/sched/sch_api.c
net/sched/sch_hfsc.c
net/sched/sch_htb.c
net/sched/sch_multiq.c
net/sctp/input.c
net/sctp/ipv6.c
net/sctp/output.c
net/sctp/protocol.c
net/sctp/sm_make_chunk.c
net/sctp/sm_sideeffect.c
net/sctp/socket.c
net/sctp/transport.c
net/socket.c
net/sunrpc/xprtsock.c
net/wimax/op-msg.c
net/wimax/stack.c
net/wireless/Makefile
net/wireless/core.c
net/wireless/core.h
net/wireless/nl80211.c
net/wireless/nl80211.h
net/wireless/reg.c
net/wireless/reg.h
net/wireless/scan.c [new file with mode: 0644]
net/wireless/sysfs.c
net/wireless/util.c
net/x25/af_x25.c
scripts/bootgraph.pl
scripts/kernel-doc
scripts/markup_oops.pl
scripts/mod/file2alias.c
scripts/package/mkspec
scripts/setlocalversion
scripts/tags.sh
security/selinux/netlabel.c
sound/arm/aaci.c
sound/core/jack.c
sound/core/oss/pcm_oss.c
sound/drivers/mtpav.c
sound/oss/dmasound/dmasound_atari.c
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_hwdep.c
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_local.h
sound/pci/hda/hda_proc.c
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_intelhdmi.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/intel8x0.c
sound/pci/oxygen/virtuoso.c
sound/soc/atmel/atmel_ssc_dai.c
sound/soc/atmel/atmel_ssc_dai.h
sound/soc/codecs/tlv320aic3x.c
sound/soc/codecs/wm8350.c
sound/soc/codecs/wm8990.c
sound/soc/omap/omap-pcm.c
sound/soc/omap/sdp3430.c
sound/soc/soc-core.c
sound/usb/usbaudio.c
sound/usb/usbmidi.c
virt/kvm/iommu.c
virt/kvm/kvm_main.c

index 4e83e7b52d15d2baf27f7f671483756c0c71c572..a62e6a84fd1e6fadb21e823a788f41ac00a5d9a0 100644 (file)
--- a/.mailmap
+++ b/.mailmap
@@ -92,6 +92,7 @@ Rudolf Marek <R.Marek@sh.cvut.cz>
 Rui Saraiva <rmps@joel.ist.utl.pt>
 Sachin P Sant <ssant@in.ibm.com>
 Sam Ravnborg <sam@mars.ravnborg.org>
+Sascha Hauer <s.hauer@pengutronix.de>
 S.ÇaÄŸlar Onur <caglar@pardus.org.tr>
 Simon Kelley <simon@thekelleys.org.uk>
 Stéphane Witzmann <stephane.witzmann@ubpmes.univ-bpclermont.fr>
@@ -100,6 +101,7 @@ Tejun Heo <htejun@gmail.com>
 Thomas Graf <tgraf@suug.ch>
 Tony Luck <tony.luck@intel.com>
 Tsuneo Yoshioka <Tsuneo.Yoshioka@f-secure.com>
-Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
 Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de>
+Uwe Kleine-König <ukl@pengutronix.de>
+Uwe Kleine-König <Uwe.Kleine-Koenig@digi.com>
 Valdis Kletnieks <Valdis.Kletnieks@vt.edu>
diff --git a/CREDITS b/CREDITS
index 2b39168c06aabe35bc35c10753cb42438e65eaed..5e0736722afd547659c491ad2ee503e57336435d 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -2166,7 +2166,6 @@ D: Initial implementation of VC's, pty's and select()
 
 N: Pavel Machek
 E: pavel@ucw.cz
-E: pavel@suse.cz
 D: Softcursor for vga, hypertech cdrom support, vcsa bugfix, nbd
 D: sun4/330 port, capabilities for elf, speedup for rm on ext2, USB,
 D: work on suspend-to-ram/disk, killing duplicates from ioctl32
index 0d99ee6ae02ec786aef9ed6373bc91d1f5d1fb19..eca0d65087dc4239352add5f2167a85ae7a179e8 100644 (file)
@@ -1,6 +1,6 @@
 What:          /sys/firmware/memmap/
 Date:          June 2008
-Contact:       Bernhard Walle <bwalle@suse.de>
+Contact:       Bernhard Walle <bernhard.walle@gmx.de>
 Description:
                On all platforms, the firmware provides a memory map which the
                kernel reads. The resources from that memory map are registered
index dc3154e49279b6f95935df1665b6f25ad0d4c1a1..1462ed86d40aec28e0d54e947c93ad43f22333ae 100644 (file)
@@ -6,7 +6,7 @@
 # To add a new book the only step required is to add the book to the
 # list of DOCBOOKS.
 
-DOCBOOKS := z8530book.xml mcabook.xml \
+DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \
            kernel-hacking.xml kernel-locking.xml deviceiobook.xml \
            procfs-guide.xml writing_usb_driver.xml networking.xml \
            kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
diff --git a/Documentation/DocBook/device-drivers.tmpl b/Documentation/DocBook/device-drivers.tmpl
new file mode 100644 (file)
index 0000000..94a20fe
--- /dev/null
@@ -0,0 +1,418 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+       "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
+
+<book id="LinuxDriversAPI">
+ <bookinfo>
+  <title>Linux Device Drivers</title>
+
+  <legalnotice>
+   <para>
+     This documentation is free software; you can redistribute
+     it and/or modify it under the terms of the GNU General Public
+     License as published by the Free Software Foundation; either
+     version 2 of the License, or (at your option) any later
+     version.
+   </para>
+
+   <para>
+     This program is distributed in the hope that it will be
+     useful, but WITHOUT ANY WARRANTY; without even the implied
+     warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+     See the GNU General Public License for more details.
+   </para>
+
+   <para>
+     You should have received a copy of the GNU General Public
+     License along with this program; if not, write to the Free
+     Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+     MA 02111-1307 USA
+   </para>
+
+   <para>
+     For more details see the file COPYING in the source
+     distribution of Linux.
+   </para>
+  </legalnotice>
+ </bookinfo>
+
+<toc></toc>
+
+  <chapter id="Basics">
+     <title>Driver Basics</title>
+     <sect1><title>Driver Entry and Exit points</title>
+!Iinclude/linux/init.h
+     </sect1>
+
+     <sect1><title>Atomic and pointer manipulation</title>
+!Iarch/x86/include/asm/atomic_32.h
+!Iarch/x86/include/asm/unaligned.h
+     </sect1>
+
+     <sect1><title>Delaying, scheduling, and timer routines</title>
+!Iinclude/linux/sched.h
+!Ekernel/sched.c
+!Ekernel/timer.c
+     </sect1>
+     <sect1><title>High-resolution timers</title>
+!Iinclude/linux/ktime.h
+!Iinclude/linux/hrtimer.h
+!Ekernel/hrtimer.c
+     </sect1>
+     <sect1><title>Workqueues and Kevents</title>
+!Ekernel/workqueue.c
+     </sect1>
+     <sect1><title>Internal Functions</title>
+!Ikernel/exit.c
+!Ikernel/signal.c
+!Iinclude/linux/kthread.h
+!Ekernel/kthread.c
+     </sect1>
+
+     <sect1><title>Kernel objects manipulation</title>
+<!--
+X!Iinclude/linux/kobject.h
+-->
+!Elib/kobject.c
+     </sect1>
+
+     <sect1><title>Kernel utility functions</title>
+!Iinclude/linux/kernel.h
+!Ekernel/printk.c
+!Ekernel/panic.c
+!Ekernel/sys.c
+!Ekernel/rcupdate.c
+     </sect1>
+
+     <sect1><title>Device Resource Management</title>
+!Edrivers/base/devres.c
+     </sect1>
+
+  </chapter>
+
+  <chapter id="devdrivers">
+     <title>Device drivers infrastructure</title>
+     <sect1><title>Device Drivers Base</title>
+<!--
+X!Iinclude/linux/device.h
+-->
+!Edrivers/base/driver.c
+!Edrivers/base/core.c
+!Edrivers/base/class.c
+!Edrivers/base/firmware_class.c
+!Edrivers/base/transport_class.c
+<!-- Cannot be included, because
+     attribute_container_add_class_device_adapter
+ and attribute_container_classdev_to_container
+     exceed allowed 44 characters maximum
+X!Edrivers/base/attribute_container.c
+-->
+!Edrivers/base/sys.c
+<!--
+X!Edrivers/base/interface.c
+-->
+!Edrivers/base/platform.c
+!Edrivers/base/bus.c
+     </sect1>
+     <sect1><title>Device Drivers Power Management</title>
+!Edrivers/base/power/main.c
+     </sect1>
+     <sect1><title>Device Drivers ACPI Support</title>
+<!-- Internal functions only
+X!Edrivers/acpi/sleep/main.c
+X!Edrivers/acpi/sleep/wakeup.c
+X!Edrivers/acpi/motherboard.c
+X!Edrivers/acpi/bus.c
+-->
+!Edrivers/acpi/scan.c
+!Idrivers/acpi/scan.c
+<!-- No correct structured comments
+X!Edrivers/acpi/pci_bind.c
+-->
+     </sect1>
+     <sect1><title>Device drivers PnP support</title>
+!Idrivers/pnp/core.c
+<!-- No correct structured comments
+X!Edrivers/pnp/system.c
+ -->
+!Edrivers/pnp/card.c
+!Idrivers/pnp/driver.c
+!Edrivers/pnp/manager.c
+!Edrivers/pnp/support.c
+     </sect1>
+     <sect1><title>Userspace IO devices</title>
+!Edrivers/uio/uio.c
+!Iinclude/linux/uio_driver.h
+     </sect1>
+  </chapter>
+
+  <chapter id="parportdev">
+     <title>Parallel Port Devices</title>
+!Iinclude/linux/parport.h
+!Edrivers/parport/ieee1284.c
+!Edrivers/parport/share.c
+!Idrivers/parport/daisy.c
+  </chapter>
+
+  <chapter id="message_devices">
+       <title>Message-based devices</title>
+     <sect1><title>Fusion message devices</title>
+!Edrivers/message/fusion/mptbase.c
+!Idrivers/message/fusion/mptbase.c
+!Edrivers/message/fusion/mptscsih.c
+!Idrivers/message/fusion/mptscsih.c
+!Idrivers/message/fusion/mptctl.c
+!Idrivers/message/fusion/mptspi.c
+!Idrivers/message/fusion/mptfc.c
+!Idrivers/message/fusion/mptlan.c
+     </sect1>
+     <sect1><title>I2O message devices</title>
+!Iinclude/linux/i2o.h
+!Idrivers/message/i2o/core.h
+!Edrivers/message/i2o/iop.c
+!Idrivers/message/i2o/iop.c
+!Idrivers/message/i2o/config-osm.c
+!Edrivers/message/i2o/exec-osm.c
+!Idrivers/message/i2o/exec-osm.c
+!Idrivers/message/i2o/bus-osm.c
+!Edrivers/message/i2o/device.c
+!Idrivers/message/i2o/device.c
+!Idrivers/message/i2o/driver.c
+!Idrivers/message/i2o/pci.c
+!Idrivers/message/i2o/i2o_block.c
+!Idrivers/message/i2o/i2o_scsi.c
+!Idrivers/message/i2o/i2o_proc.c
+     </sect1>
+  </chapter>
+
+  <chapter id="snddev">
+     <title>Sound Devices</title>
+!Iinclude/sound/core.h
+!Esound/sound_core.c
+!Iinclude/sound/pcm.h
+!Esound/core/pcm.c
+!Esound/core/device.c
+!Esound/core/info.c
+!Esound/core/rawmidi.c
+!Esound/core/sound.c
+!Esound/core/memory.c
+!Esound/core/pcm_memory.c
+!Esound/core/init.c
+!Esound/core/isadma.c
+!Esound/core/control.c
+!Esound/core/pcm_lib.c
+!Esound/core/hwdep.c
+!Esound/core/pcm_native.c
+!Esound/core/memalloc.c
+<!-- FIXME: Removed for now since no structured comments in source
+X!Isound/sound_firmware.c
+-->
+  </chapter>
+
+  <chapter id="uart16x50">
+     <title>16x50 UART Driver</title>
+!Iinclude/linux/serial_core.h
+!Edrivers/serial/serial_core.c
+!Edrivers/serial/8250.c
+  </chapter>
+
+  <chapter id="fbdev">
+     <title>Frame Buffer Library</title>
+
+     <para>
+       The frame buffer drivers depend heavily on four data structures.
+       These structures are declared in include/linux/fb.h.  They are
+       fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs.
+       The last three can be made available to and from userland.
+     </para>
+
+     <para>
+       fb_info defines the current state of a particular video card.
+       Inside fb_info, there exists a fb_ops structure which is a
+       collection of needed functions to make fbdev and fbcon work.
+       fb_info is only visible to the kernel.
+     </para>
+
+     <para>
+       fb_var_screeninfo is used to describe the features of a video card
+       that are user defined.  With fb_var_screeninfo, things such as
+       depth and the resolution may be defined.
+     </para>
+
+     <para>
+       The next structure is fb_fix_screeninfo. This defines the
+       properties of a card that are created when a mode is set and can't
+       be changed otherwise.  A good example of this is the start of the
+       frame buffer memory.  This "locks" the address of the frame buffer
+       memory, so that it cannot be changed or moved.
+     </para>
+
+     <para>
+       The last structure is fb_monospecs. In the old API, there was
+       little importance for fb_monospecs. This allowed for forbidden things
+       such as setting a mode of 800x600 on a fix frequency monitor. With
+       the new API, fb_monospecs prevents such things, and if used
+       correctly, can prevent a monitor from being cooked.  fb_monospecs
+       will not be useful until kernels 2.5.x.
+     </para>
+
+     <sect1><title>Frame Buffer Memory</title>
+!Edrivers/video/fbmem.c
+     </sect1>
+<!--
+     <sect1><title>Frame Buffer Console</title>
+X!Edrivers/video/console/fbcon.c
+     </sect1>
+-->
+     <sect1><title>Frame Buffer Colormap</title>
+!Edrivers/video/fbcmap.c
+     </sect1>
+<!-- FIXME:
+  drivers/video/fbgen.c has no docs, which stuffs up the sgml.  Comment
+  out until somebody adds docs.  KAO
+     <sect1><title>Frame Buffer Generic Functions</title>
+X!Idrivers/video/fbgen.c
+     </sect1>
+KAO -->
+     <sect1><title>Frame Buffer Video Mode Database</title>
+!Idrivers/video/modedb.c
+!Edrivers/video/modedb.c
+     </sect1>
+     <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
+!Edrivers/video/macmodes.c
+     </sect1>
+     <sect1><title>Frame Buffer Fonts</title>
+        <para>
+           Refer to the file drivers/video/console/fonts.c for more information.
+        </para>
+<!-- FIXME: Removed for now since no structured comments in source
+X!Idrivers/video/console/fonts.c
+-->
+     </sect1>
+  </chapter>
+
+  <chapter id="input_subsystem">
+     <title>Input Subsystem</title>
+!Iinclude/linux/input.h
+!Edrivers/input/input.c
+!Edrivers/input/ff-core.c
+!Edrivers/input/ff-memless.c
+  </chapter>
+
+  <chapter id="spi">
+      <title>Serial Peripheral Interface (SPI)</title>
+  <para>
+       SPI is the "Serial Peripheral Interface", widely used with
+       embedded systems because it is a simple and efficient
+       interface:  basically a multiplexed shift register.
+       Its three signal wires hold a clock (SCK, often in the range
+       of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
+       a "Master In, Slave Out" (MISO) data line.
+       SPI is a full duplex protocol; for each bit shifted out the
+       MOSI line (one per clock) another is shifted in on the MISO line.
+       Those bits are assembled into words of various sizes on the
+       way to and from system memory.
+       An additional chipselect line is usually active-low (nCS);
+       four signals are normally used for each peripheral, plus
+       sometimes an interrupt.
+  </para>
+  <para>
+       The SPI bus facilities listed here provide a generalized
+       interface to declare SPI busses and devices, manage them
+       according to the standard Linux driver model, and perform
+       input/output operations.
+       At this time, only "master" side interfaces are supported,
+       where Linux talks to SPI peripherals and does not implement
+       such a peripheral itself.
+       (Interfaces to support implementing SPI slaves would
+       necessarily look different.)
+  </para>
+  <para>
+       The programming interface is structured around two kinds of driver,
+       and two kinds of device.
+       A "Controller Driver" abstracts the controller hardware, which may
+       be as simple as a set of GPIO pins or as complex as a pair of FIFOs
+       connected to dual DMA engines on the other side of the SPI shift
+       register (maximizing throughput).  Such drivers bridge between
+       whatever bus they sit on (often the platform bus) and SPI, and
+       expose the SPI side of their device as a
+       <structname>struct spi_master</structname>.
+       SPI devices are children of that master, represented as a
+       <structname>struct spi_device</structname> and manufactured from
+       <structname>struct spi_board_info</structname> descriptors which
+       are usually provided by board-specific initialization code.
+       A <structname>struct spi_driver</structname> is called a
+       "Protocol Driver", and is bound to a spi_device using normal
+       driver model calls.
+  </para>
+  <para>
+       The I/O model is a set of queued messages.  Protocol drivers
+       submit one or more <structname>struct spi_message</structname>
+       objects, which are processed and completed asynchronously.
+       (There are synchronous wrappers, however.)  Messages are
+       built from one or more <structname>struct spi_transfer</structname>
+       objects, each of which wraps a full duplex SPI transfer.
+       A variety of protocol tweaking options are needed, because
+       different chips adopt very different policies for how they
+       use the bits transferred with SPI.
+  </para>
+!Iinclude/linux/spi/spi.h
+!Fdrivers/spi/spi.c spi_register_board_info
+!Edrivers/spi/spi.c
+  </chapter>
+
+  <chapter id="i2c">
+     <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
+
+     <para>
+       I<superscript>2</superscript>C (or without fancy typography, "I2C")
+       is an acronym for the "Inter-IC" bus, a simple bus protocol which is
+       widely used where low data rate communications suffice.
+       Since it's also a licensed trademark, some vendors use another
+       name (such as "Two-Wire Interface", TWI) for the same bus.
+       I2C only needs two signals (SCL for clock, SDA for data), conserving
+       board real estate and minimizing signal quality issues.
+       Most I2C devices use seven bit addresses, and bus speeds of up
+       to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
+       found wide use.
+       I2C is a multi-master bus; open drain signaling is used to
+       arbitrate between masters, as well as to handshake and to
+       synchronize clocks from slower clients.
+     </para>
+
+     <para>
+       The Linux I2C programming interfaces support only the master
+       side of bus interactions, not the slave side.
+       The programming interface is structured around two kinds of driver,
+       and two kinds of device.
+       An I2C "Adapter Driver" abstracts the controller hardware; it binds
+       to a physical device (perhaps a PCI device or platform_device) and
+       exposes a <structname>struct i2c_adapter</structname> representing
+       each I2C bus segment it manages.
+       On each I2C bus segment will be I2C devices represented by a
+       <structname>struct i2c_client</structname>.  Those devices will
+       be bound to a <structname>struct i2c_driver</structname>,
+       which should follow the standard Linux driver model.
+       (At this writing, a legacy model is more widely used.)
+       There are functions to perform various I2C protocol operations; at
+       this writing all such functions are usable only from task context.
+     </para>
+
+     <para>
+       The System Management Bus (SMBus) is a sibling protocol.  Most SMBus
+       systems are also I2C conformant.  The electrical constraints are
+       tighter for SMBus, and it standardizes particular protocol messages
+       and idioms.  Controllers that support I2C can also support most
+       SMBus operations, but SMBus controllers don't support all the protocol
+       options that an I2C controller will.
+       There are functions to perform various SMBus protocol operations,
+       either using I2C primitives or by issuing SMBus commands to
+       i2c_adapter devices which don't support those I2C operations.
+     </para>
+
+!Iinclude/linux/i2c.h
+!Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info
+!Edrivers/i2c/i2c-core.c
+  </chapter>
+
+</book>
index 5818ff75786abf9a853706794f1f33f6238786cb..bc962cda650485aea9cddcced9823ef39a3252b6 100644 (file)
 
 <toc></toc>
 
-  <chapter id="Basics">
-     <title>Driver Basics</title>
-     <sect1><title>Driver Entry and Exit points</title>
-!Iinclude/linux/init.h
-     </sect1>
-
-     <sect1><title>Atomic and pointer manipulation</title>
-!Iarch/x86/include/asm/atomic_32.h
-!Iarch/x86/include/asm/unaligned.h
-     </sect1>
-
-     <sect1><title>Delaying, scheduling, and timer routines</title>
-!Iinclude/linux/sched.h
-!Ekernel/sched.c
-!Ekernel/timer.c
-     </sect1>
-     <sect1><title>High-resolution timers</title>
-!Iinclude/linux/ktime.h
-!Iinclude/linux/hrtimer.h
-!Ekernel/hrtimer.c
-     </sect1>
-     <sect1><title>Workqueues and Kevents</title>
-!Ekernel/workqueue.c
-     </sect1>
-     <sect1><title>Internal Functions</title>
-!Ikernel/exit.c
-!Ikernel/signal.c
-!Iinclude/linux/kthread.h
-!Ekernel/kthread.c
-     </sect1>
-
-     <sect1><title>Kernel objects manipulation</title>
-<!--
-X!Iinclude/linux/kobject.h
--->
-!Elib/kobject.c
-     </sect1>
-
-     <sect1><title>Kernel utility functions</title>
-!Iinclude/linux/kernel.h
-!Ekernel/printk.c
-!Ekernel/panic.c
-!Ekernel/sys.c
-!Ekernel/rcupdate.c
-     </sect1>
-
-     <sect1><title>Device Resource Management</title>
-!Edrivers/base/devres.c
-     </sect1>
-
-  </chapter>
-
   <chapter id="adt">
      <title>Data Types</title>
      <sect1><title>Doubly Linked Lists</title>
@@ -298,62 +246,6 @@ X!Earch/x86/kernel/mca_32.c
 !Ikernel/acct.c
   </chapter>
 
-  <chapter id="devdrivers">
-     <title>Device drivers infrastructure</title>
-     <sect1><title>Device Drivers Base</title>
-<!--
-X!Iinclude/linux/device.h
--->
-!Edrivers/base/driver.c
-!Edrivers/base/core.c
-!Edrivers/base/class.c
-!Edrivers/base/firmware_class.c
-!Edrivers/base/transport_class.c
-<!-- Cannot be included, because
-     attribute_container_add_class_device_adapter
- and attribute_container_classdev_to_container
-     exceed allowed 44 characters maximum
-X!Edrivers/base/attribute_container.c
--->
-!Edrivers/base/sys.c
-<!--
-X!Edrivers/base/interface.c
--->
-!Edrivers/base/platform.c
-!Edrivers/base/bus.c
-     </sect1>
-     <sect1><title>Device Drivers Power Management</title>
-!Edrivers/base/power/main.c
-     </sect1>
-     <sect1><title>Device Drivers ACPI Support</title>
-<!-- Internal functions only
-X!Edrivers/acpi/sleep/main.c
-X!Edrivers/acpi/sleep/wakeup.c
-X!Edrivers/acpi/motherboard.c
-X!Edrivers/acpi/bus.c
--->
-!Edrivers/acpi/scan.c
-!Idrivers/acpi/scan.c
-<!-- No correct structured comments
-X!Edrivers/acpi/pci_bind.c
--->
-     </sect1>
-     <sect1><title>Device drivers PnP support</title>
-!Idrivers/pnp/core.c
-<!-- No correct structured comments
-X!Edrivers/pnp/system.c
- -->
-!Edrivers/pnp/card.c
-!Idrivers/pnp/driver.c
-!Edrivers/pnp/manager.c
-!Edrivers/pnp/support.c
-     </sect1>
-     <sect1><title>Userspace IO devices</title>
-!Edrivers/uio/uio.c
-!Iinclude/linux/uio_driver.h
-     </sect1>
-  </chapter>
-
   <chapter id="blkdev">
      <title>Block Devices</title>
 !Eblock/blk-core.c
@@ -381,275 +273,6 @@ X!Edrivers/pnp/system.c
 !Edrivers/char/misc.c
   </chapter>
 
-  <chapter id="parportdev">
-     <title>Parallel Port Devices</title>
-!Iinclude/linux/parport.h
-!Edrivers/parport/ieee1284.c
-!Edrivers/parport/share.c
-!Idrivers/parport/daisy.c
-  </chapter>
-
-  <chapter id="message_devices">
-       <title>Message-based devices</title>
-     <sect1><title>Fusion message devices</title>
-!Edrivers/message/fusion/mptbase.c
-!Idrivers/message/fusion/mptbase.c
-!Edrivers/message/fusion/mptscsih.c
-!Idrivers/message/fusion/mptscsih.c
-!Idrivers/message/fusion/mptctl.c
-!Idrivers/message/fusion/mptspi.c
-!Idrivers/message/fusion/mptfc.c
-!Idrivers/message/fusion/mptlan.c
-     </sect1>
-     <sect1><title>I2O message devices</title>
-!Iinclude/linux/i2o.h
-!Idrivers/message/i2o/core.h
-!Edrivers/message/i2o/iop.c
-!Idrivers/message/i2o/iop.c
-!Idrivers/message/i2o/config-osm.c
-!Edrivers/message/i2o/exec-osm.c
-!Idrivers/message/i2o/exec-osm.c
-!Idrivers/message/i2o/bus-osm.c
-!Edrivers/message/i2o/device.c
-!Idrivers/message/i2o/device.c
-!Idrivers/message/i2o/driver.c
-!Idrivers/message/i2o/pci.c
-!Idrivers/message/i2o/i2o_block.c
-!Idrivers/message/i2o/i2o_scsi.c
-!Idrivers/message/i2o/i2o_proc.c
-     </sect1>
-  </chapter>
-
-  <chapter id="snddev">
-     <title>Sound Devices</title>
-!Iinclude/sound/core.h
-!Esound/sound_core.c
-!Iinclude/sound/pcm.h
-!Esound/core/pcm.c
-!Esound/core/device.c
-!Esound/core/info.c
-!Esound/core/rawmidi.c
-!Esound/core/sound.c
-!Esound/core/memory.c
-!Esound/core/pcm_memory.c
-!Esound/core/init.c
-!Esound/core/isadma.c
-!Esound/core/control.c
-!Esound/core/pcm_lib.c
-!Esound/core/hwdep.c
-!Esound/core/pcm_native.c
-!Esound/core/memalloc.c
-<!-- FIXME: Removed for now since no structured comments in source
-X!Isound/sound_firmware.c
--->
-  </chapter>
-
-  <chapter id="uart16x50">
-     <title>16x50 UART Driver</title>
-!Iinclude/linux/serial_core.h
-!Edrivers/serial/serial_core.c
-!Edrivers/serial/8250.c
-  </chapter>
-
-  <chapter id="fbdev">
-     <title>Frame Buffer Library</title>
-
-     <para>
-       The frame buffer drivers depend heavily on four data structures.  
-       These structures are declared in include/linux/fb.h.  They are 
-       fb_info, fb_var_screeninfo, fb_fix_screeninfo and fb_monospecs. 
-       The last three can be made available to and from userland. 
-     </para>
-
-     <para>
-       fb_info defines the current state of a particular video card. 
-       Inside fb_info, there exists a fb_ops structure which is a 
-       collection of needed functions to make fbdev and fbcon work.
-       fb_info is only visible to the kernel.
-     </para>
-
-     <para>
-       fb_var_screeninfo is used to describe the features of a video card 
-       that are user defined.  With fb_var_screeninfo, things such as
-       depth and the resolution may be defined.
-     </para>
-
-     <para>
-       The next structure is fb_fix_screeninfo. This defines the 
-       properties of a card that are created when a mode is set and can't 
-       be changed otherwise.  A good example of this is the start of the 
-       frame buffer memory.  This "locks" the address of the frame buffer
-       memory, so that it cannot be changed or moved.
-     </para>
-
-     <para>
-       The last structure is fb_monospecs. In the old API, there was 
-       little importance for fb_monospecs. This allowed for forbidden things 
-       such as setting a mode of 800x600 on a fix frequency monitor. With 
-       the new API, fb_monospecs prevents such things, and if used 
-       correctly, can prevent a monitor from being cooked.  fb_monospecs
-       will not be useful until kernels 2.5.x.
-     </para>
-
-     <sect1><title>Frame Buffer Memory</title>
-!Edrivers/video/fbmem.c
-     </sect1>
-<!--
-     <sect1><title>Frame Buffer Console</title>
-X!Edrivers/video/console/fbcon.c
-     </sect1>
--->
-     <sect1><title>Frame Buffer Colormap</title>
-!Edrivers/video/fbcmap.c
-     </sect1>
-<!-- FIXME:
-  drivers/video/fbgen.c has no docs, which stuffs up the sgml.  Comment
-  out until somebody adds docs.  KAO
-     <sect1><title>Frame Buffer Generic Functions</title>
-X!Idrivers/video/fbgen.c
-     </sect1>
-KAO -->
-     <sect1><title>Frame Buffer Video Mode Database</title>
-!Idrivers/video/modedb.c
-!Edrivers/video/modedb.c
-     </sect1>
-     <sect1><title>Frame Buffer Macintosh Video Mode Database</title>
-!Edrivers/video/macmodes.c
-     </sect1>
-     <sect1><title>Frame Buffer Fonts</title>
-        <para>
-           Refer to the file drivers/video/console/fonts.c for more information.
-        </para>
-<!-- FIXME: Removed for now since no structured comments in source
-X!Idrivers/video/console/fonts.c
--->
-     </sect1>
-  </chapter>
-
-  <chapter id="input_subsystem">
-     <title>Input Subsystem</title>
-!Iinclude/linux/input.h
-!Edrivers/input/input.c
-!Edrivers/input/ff-core.c
-!Edrivers/input/ff-memless.c
-  </chapter>
-
-  <chapter id="spi">
-      <title>Serial Peripheral Interface (SPI)</title>
-  <para>
-       SPI is the "Serial Peripheral Interface", widely used with
-       embedded systems because it is a simple and efficient
-       interface:  basically a multiplexed shift register.
-       Its three signal wires hold a clock (SCK, often in the range
-       of 1-20 MHz), a "Master Out, Slave In" (MOSI) data line, and
-       a "Master In, Slave Out" (MISO) data line.
-       SPI is a full duplex protocol; for each bit shifted out the
-       MOSI line (one per clock) another is shifted in on the MISO line.
-       Those bits are assembled into words of various sizes on the
-       way to and from system memory.
-       An additional chipselect line is usually active-low (nCS);
-       four signals are normally used for each peripheral, plus
-       sometimes an interrupt.
-  </para>
-  <para>
-       The SPI bus facilities listed here provide a generalized
-       interface to declare SPI busses and devices, manage them
-       according to the standard Linux driver model, and perform
-       input/output operations.
-       At this time, only "master" side interfaces are supported,
-       where Linux talks to SPI peripherals and does not implement
-       such a peripheral itself.
-       (Interfaces to support implementing SPI slaves would
-       necessarily look different.)
-  </para>
-  <para>
-       The programming interface is structured around two kinds of driver,
-       and two kinds of device.
-       A "Controller Driver" abstracts the controller hardware, which may
-       be as simple as a set of GPIO pins or as complex as a pair of FIFOs
-       connected to dual DMA engines on the other side of the SPI shift
-       register (maximizing throughput).  Such drivers bridge between
-       whatever bus they sit on (often the platform bus) and SPI, and
-       expose the SPI side of their device as a
-       <structname>struct spi_master</structname>.
-       SPI devices are children of that master, represented as a
-       <structname>struct spi_device</structname> and manufactured from
-       <structname>struct spi_board_info</structname> descriptors which
-       are usually provided by board-specific initialization code.
-       A <structname>struct spi_driver</structname> is called a
-       "Protocol Driver", and is bound to a spi_device using normal
-       driver model calls.
-  </para>
-  <para>
-       The I/O model is a set of queued messages.  Protocol drivers
-       submit one or more <structname>struct spi_message</structname>
-       objects, which are processed and completed asynchronously.
-       (There are synchronous wrappers, however.)  Messages are
-       built from one or more <structname>struct spi_transfer</structname>
-       objects, each of which wraps a full duplex SPI transfer.
-       A variety of protocol tweaking options are needed, because
-       different chips adopt very different policies for how they
-       use the bits transferred with SPI.
-  </para>
-!Iinclude/linux/spi/spi.h
-!Fdrivers/spi/spi.c spi_register_board_info
-!Edrivers/spi/spi.c
-  </chapter>
-
-  <chapter id="i2c">
-     <title>I<superscript>2</superscript>C and SMBus Subsystem</title>
-
-     <para>
-       I<superscript>2</superscript>C (or without fancy typography, "I2C")
-       is an acronym for the "Inter-IC" bus, a simple bus protocol which is
-       widely used where low data rate communications suffice.
-       Since it's also a licensed trademark, some vendors use another
-       name (such as "Two-Wire Interface", TWI) for the same bus.
-       I2C only needs two signals (SCL for clock, SDA for data), conserving
-       board real estate and minimizing signal quality issues.
-       Most I2C devices use seven bit addresses, and bus speeds of up
-       to 400 kHz; there's a high speed extension (3.4 MHz) that's not yet
-       found wide use.
-       I2C is a multi-master bus; open drain signaling is used to
-       arbitrate between masters, as well as to handshake and to
-       synchronize clocks from slower clients.
-     </para>
-
-     <para>
-       The Linux I2C programming interfaces support only the master
-       side of bus interactions, not the slave side.
-       The programming interface is structured around two kinds of driver,
-       and two kinds of device.
-       An I2C "Adapter Driver" abstracts the controller hardware; it binds
-       to a physical device (perhaps a PCI device or platform_device) and
-       exposes a <structname>struct i2c_adapter</structname> representing
-       each I2C bus segment it manages.
-       On each I2C bus segment will be I2C devices represented by a
-       <structname>struct i2c_client</structname>.  Those devices will
-       be bound to a <structname>struct i2c_driver</structname>,
-       which should follow the standard Linux driver model.
-       (At this writing, a legacy model is more widely used.)
-       There are functions to perform various I2C protocol operations; at
-       this writing all such functions are usable only from task context.
-     </para>
-
-     <para>
-       The System Management Bus (SMBus) is a sibling protocol.  Most SMBus
-       systems are also I2C conformant.  The electrical constraints are
-       tighter for SMBus, and it standardizes particular protocol messages
-       and idioms.  Controllers that support I2C can also support most
-       SMBus operations, but SMBus controllers don't support all the protocol
-       options that an I2C controller will.
-       There are functions to perform various SMBus protocol operations,
-       either using I2C primitives or by issuing SMBus commands to
-       i2c_adapter devices which don't support those I2C operations.
-     </para>
-
-!Iinclude/linux/i2c.h
-!Fdrivers/i2c/i2c-boardinfo.c i2c_register_board_info
-!Edrivers/i2c/i2c-core.c
-  </chapter>
-
   <chapter id="clk">
      <title>Clock Framework</title>
 
index 77c3c202991b4ded85f4795ef33e3e73186dd784..8af6d9626878e0459c02052081c41bbc33c5d20d 100644 (file)
@@ -17,8 +17,7 @@
     </authorgroup>
 
     <copyright>
-      <year>2007</year>
-      <year>2008</year>
+      <year>2007-2009</year>
       <holder>Johannes Berg</holder>
     </copyright>
 
@@ -165,8 +164,8 @@ usage should require reading the full document.
 !Pinclude/net/mac80211.h Frame format
       </sect1>
       <sect1>
-        <title>Alignment issues</title>
-        <para>TBD</para>
+        <title>Packet alignment</title>
+!Pnet/mac80211/rx.c Packet alignment
       </sect1>
       <sect1>
         <title>Calling into mac80211 from interrupts</title>
@@ -223,6 +222,11 @@ usage should require reading the full document.
 !Finclude/net/mac80211.h ieee80211_key_flags
     </chapter>
 
+    <chapter id="powersave">
+      <title>Powersave support</title>
+!Pinclude/net/mac80211.h Powersave support
+    </chapter>
+
     <chapter id="qos">
       <title>Multiple queues and QoS support</title>
       <para>TBD</para>
index 9a07e38631b0a0d1ed7956db151b667402725419..6bd5f372adec010d18bf0b15d6d5f62d185a4f18 100644 (file)
@@ -93,7 +93,7 @@ the PCI Express Port Bus driver from loading a service driver.
 
 int pcie_port_service_register(struct pcie_port_service_driver *new)
 
-This API replaces the Linux Driver Model's pci_module_init API. A
+This API replaces the Linux Driver Model's pci_register_driver API. A
 service driver should always calls pcie_port_service_register at
 module init. Note that after service driver being loaded, calls
 such as pci_enable_device(dev) and pci_set_master(dev) are no longer
index d9e5d6f41b927c09ce0c98e8dfd6a448bddee236..93feb8444489686b1a9874da9c964f388d5ed316 100644 (file)
@@ -252,10 +252,8 @@ cgroup file system directories.
 When a task is moved from one cgroup to another, it gets a new
 css_set pointer - if there's an already existing css_set with the
 desired collection of cgroups then that group is reused, else a new
-css_set is allocated. Note that the current implementation uses a
-linear search to locate an appropriate existing css_set, so isn't
-very efficient. A future version will use a hash table for better
-performance.
+css_set is allocated. The appropriate existing css_set is located by
+looking into a hash table.
 
 To allow access from a cgroup to the css_sets (and hence tasks)
 that comprise it, a set of cg_cgroup_link objects form a lattice;
index 5c86c258c7913dd9c97da4a3e4f7a0dd666745bc..0611e9528c7c236c3dbdeb3038e762664614dec5 100644 (file)
@@ -142,7 +142,7 @@ into the rest of the kernel, none in performance critical paths:
  - in fork and exit, to attach and detach a task from its cpuset.
  - in sched_setaffinity, to mask the requested CPUs by what's
    allowed in that tasks cpuset.
- - in sched.c migrate_all_tasks(), to keep migrating tasks within
+ - in sched.c migrate_live_tasks(), to keep migrating tasks within
    the CPUs allowed by their cpuset, if possible.
  - in the mbind and set_mempolicy system calls, to mask the requested
    Memory Nodes by what's allowed in that tasks cpuset.
@@ -175,6 +175,10 @@ files describing that cpuset:
  - mem_exclusive flag: is memory placement exclusive?
  - mem_hardwall flag:  is memory allocation hardwalled
  - memory_pressure: measure of how much paging pressure in cpuset
+ - memory_spread_page flag: if set, spread page cache evenly on allowed nodes
+ - memory_spread_slab flag: if set, spread slab cache evenly on allowed nodes
+ - sched_load_balance flag: if set, load balance within CPUs on that cpuset
+ - sched_relax_domain_level: the searching range when migrating tasks
 
 In addition, the root cpuset only has the following file:
  - memory_pressure_enabled flag: compute memory_pressure?
@@ -252,7 +256,7 @@ is causing.
 
 This is useful both on tightly managed systems running a wide mix of
 submitted jobs, which may choose to terminate or re-prioritize jobs that
-are trying to use more memory than allowed on the nodes assigned them,
+are trying to use more memory than allowed on the nodes assigned to them,
 and with tightly coupled, long running, massively parallel scientific
 computing jobs that will dramatically fail to meet required performance
 goals if they start to use more memory than allowed to them.
@@ -378,7 +382,7 @@ as cpusets and sched_setaffinity.
 The algorithmic cost of load balancing and its impact on key shared
 kernel data structures such as the task list increases more than
 linearly with the number of CPUs being balanced.  So the scheduler
-has support to  partition the systems CPUs into a number of sched
+has support to partition the systems CPUs into a number of sched
 domains such that it only load balances within each sched domain.
 Each sched domain covers some subset of the CPUs in the system;
 no two sched domains overlap; some CPUs might not be in any sched
@@ -485,17 +489,22 @@ of CPUs allowed to a cpuset having 'sched_load_balance' enabled.
 The internal kernel cpuset to scheduler interface passes from the
 cpuset code to the scheduler code a partition of the load balanced
 CPUs in the system. This partition is a set of subsets (represented
-as an array of cpumask_t) of CPUs, pairwise disjoint, that cover all
-the CPUs that must be load balanced.
-
-Whenever the 'sched_load_balance' flag changes, or CPUs come or go
-from a cpuset with this flag enabled, or a cpuset with this flag
-enabled is removed, the cpuset code builds a new such partition and
-passes it to the scheduler sched domain setup code, to have the sched
-domains rebuilt as necessary.
+as an array of struct cpumask) of CPUs, pairwise disjoint, that cover
+all the CPUs that must be load balanced.
+
+The cpuset code builds a new such partition and passes it to the
+scheduler sched domain setup code, to have the sched domains rebuilt
+as necessary, whenever:
+ - the 'sched_load_balance' flag of a cpuset with non-empty CPUs changes,
+ - or CPUs come or go from a cpuset with this flag enabled,
+ - or 'sched_relax_domain_level' value of a cpuset with non-empty CPUs
+   and with this flag enabled changes,
+ - or a cpuset with non-empty CPUs and with this flag enabled is removed,
+ - or a cpu is offlined/onlined.
 
 This partition exactly defines what sched domains the scheduler should
-setup - one sched domain for each element (cpumask_t) in the partition.
+setup - one sched domain for each element (struct cpumask) in the
+partition.
 
 The scheduler remembers the currently active sched domain partitions.
 When the scheduler routine partition_sched_domains() is invoked from
@@ -559,7 +568,7 @@ domain, the largest value among those is used.  Be careful, if one
 requests 0 and others are -1 then 0 is used.
 
 Note that modifying this file will have both good and bad effects,
-and whether it is acceptable or not will be depend on your situation.
+and whether it is acceptable or not depends on your situation.
 Don't modify this file if you are not sure.
 
 If your situation is:
@@ -600,19 +609,15 @@ to allocate a page of memory for that task.
 
 If a cpuset has its 'cpus' modified, then each task in that cpuset
 will have its allowed CPU placement changed immediately.  Similarly,
-if a tasks pid is written to a cpusets 'tasks' file, in either its
-current cpuset or another cpuset, then its allowed CPU placement is
-changed immediately.  If such a task had been bound to some subset
-of its cpuset using the sched_setaffinity() call, the task will be
-allowed to run on any CPU allowed in its new cpuset, negating the
-affect of the prior sched_setaffinity() call.
+if a tasks pid is written to another cpusets 'tasks' file, then its
+allowed CPU placement is changed immediately.  If such a task had been
+bound to some subset of its cpuset using the sched_setaffinity() call,
+the task will be allowed to run on any CPU allowed in its new cpuset,
+negating the effect of the prior sched_setaffinity() call.
 
 In summary, the memory placement of a task whose cpuset is changed is
 updated by the kernel, on the next allocation of a page for that task,
-but the processor placement is not updated, until that tasks pid is
-rewritten to the 'tasks' file of its cpuset.  This is done to avoid
-impacting the scheduler code in the kernel with a check for changes
-in a tasks processor placement.
+and the processor placement is updated immediately.
 
 Normally, once a page is allocated (given a physical page
 of main memory) then that page stays on whatever node it
@@ -681,10 +686,14 @@ and then start a subshell 'sh' in that cpuset:
   # The next line should display '/Charlie'
   cat /proc/self/cpuset
 
-In the future, a C library interface to cpusets will likely be
-available.  For now, the only way to query or modify cpusets is
-via the cpuset file system, using the various cd, mkdir, echo, cat,
-rmdir commands from the shell, or their equivalent from C.
+There are ways to query or modify cpusets:
+ - via the cpuset file system directly, using the various cd, mkdir, echo,
+   cat, rmdir commands from the shell, or their equivalent from C.
+ - via the C library libcpuset.
+ - via the C library libcgroup.
+   (http://sourceforge.net/proects/libcg/)
+ - via the python application cset.
+   (http://developer.novell.com/wiki/index.php/Cpuset)
 
 The sched_setaffinity calls can also be done at the shell prompt using
 SGI's runon or Robert Love's taskset.  The mbind and set_mempolicy
@@ -756,7 +765,7 @@ mount -t cpuset X /dev/cpuset
 
 is equivalent to
 
-mount -t cgroup -ocpuset X /dev/cpuset
+mount -t cgroup -ocpuset,noprefix X /dev/cpuset
 echo "/sbin/cpuset_release_agent" > /dev/cpuset/release_agent
 
 2.2 Adding/removing cpus
index e3443ddcfb890028cc8f1a9576a029c35d200154..917918f84fc75ac09061be1f1f242159823983cf 100644 (file)
@@ -195,19 +195,3 @@ scaling_setspeed.          By "echoing" a new frequency into this
                                you can change the speed of the CPU,
                                but only within the limits of
                                scaling_min_freq and scaling_max_freq.
-                               
-
-3.2 Deprecated Interfaces
--------------------------
-
-Depending on your kernel configuration, you might find the following 
-cpufreq-related files:
-/proc/cpufreq
-/proc/sys/cpu/*/speed
-/proc/sys/cpu/*/speed-min
-/proc/sys/cpu/*/speed-max
-
-These are files for deprecated interfaces to cpufreq, which offer far
-less functionality. Because of this, these interfaces aren't described
-here.
-
index a05ec50f8004dd65f29c87579612389f93660187..a7cbfff40d077047f76463377381b269b5d41fc4 100644 (file)
@@ -127,9 +127,11 @@ void unlock_device(struct device * dev);
 Attributes
 ~~~~~~~~~~
 struct device_attribute {
-        struct attribute        attr;
-        ssize_t (*show)(struct device * dev, char * buf, size_t count, loff_t off);
-        ssize_t (*store)(struct device * dev, const char * buf, size_t count, loff_t off);
+       struct attribute        attr;
+       ssize_t (*show)(struct device *dev, struct device_attribute *attr,
+                       char *buf);
+       ssize_t (*store)(struct device *dev, struct device_attribute *attr,
+                        const char *buf, size_t count);
 };
 
 Attributes of devices can be exported via drivers using a simple
index 5ddbe350487acad3a92bc70b057da477901cdc1c..ac98851f7a0cb815043e9ccb355cd40ff9fb89de 100644 (file)
@@ -229,7 +229,9 @@ Who:        Jan Engelhardt <jengelh@computergmbh.de>
 ---------------------------
 
 What:  b43 support for firmware revision < 410
-When:  July 2008
+When:  The schedule was July 2008, but it was decided that we are going to keep the
+        code as long as there are no major maintanance headaches.
+       So it _could_ be removed _any_ time now, if it conflicts with something new.
 Why:   The support code for the old firmware hurts code readability/maintainability
        and slightly hurts runtime performance. Bugfixes for the old firmware
        are not provided by Broadcom anymore.
index 68ef48839c0484db0dea98da2b419eb4f94b28bf..9f8740ca3f3bc514d9f5426168eb5b2273b96d42 100644 (file)
@@ -9,6 +9,7 @@ that support it.  For example, a given bus might look like this:
      |   |-- class
      |   |-- config
      |   |-- device
+     |   |-- enable
      |   |-- irq
      |   |-- local_cpus
      |   |-- resource
@@ -32,6 +33,7 @@ files, each with their own function.
        class              PCI class (ascii, ro)
        config             PCI config space (binary, rw)
        device             PCI device (ascii, ro)
+       enable             Whether the device is enabled (ascii, rw)
        irq                IRQ number (ascii, ro)
        local_cpus         nearby CPU mask (cpumask, ro)
        resource                   PCI resource host addresses (ascii, ro)
@@ -57,10 +59,19 @@ used to do actual device programming from userspace.  Note that some platforms
 don't support mmapping of certain resources, so be sure to check the return
 value from any attempted mmap.
 
+The 'enable' file provides a counter that indicates how many times the device 
+has been enabled.  If the 'enable' file currently returns '4', and a '1' is
+echoed into it, it will then return '5'.  Echoing a '0' into it will decrease
+the count.  Even when it returns to 0, though, some of the initialisation
+may not be reversed.  
+
 The 'rom' file is special in that it provides read-only access to the device's
 ROM file, if available.  It's disabled by default, however, so applications
 should write the string "1" to the file to enable it before attempting a read
-call, and disable it following the access by writing "0" to the file.
+call, and disable it following the access by writing "0" to the file.  Note
+that the device must be enabled for a rom read to return data succesfully.
+In the event a driver is not bound to the device, it can be enabled using the
+'enable' file, documented above.
 
 Accessing legacy resources through sysfs
 ----------------------------------------
index 9e9c348275a96fd362acf9916d2789be8a08c4c8..7e81e37c0b1ec0ccbea30a92ffbf70f495ffdbd0 100644 (file)
@@ -2,8 +2,10 @@
 sysfs - _The_ filesystem for exporting kernel objects. 
 
 Patrick Mochel <mochel@osdl.org>
+Mike Murphy <mamurph@cs.clemson.edu>
 
-10 January 2003
+Revised:    22 February 2009
+Original:   10 January 2003
 
 
 What it is:
@@ -64,12 +66,13 @@ An attribute definition is simply:
 
 struct attribute {
         char                    * name;
+        struct module          *owner;
         mode_t                  mode;
 };
 
 
-int sysfs_create_file(struct kobject * kobj, struct attribute * attr);
-void sysfs_remove_file(struct kobject * kobj, struct attribute * attr);
+int sysfs_create_file(struct kobject * kobj, const struct attribute * attr);
+void sysfs_remove_file(struct kobject * kobj, const struct attribute * attr);
 
 
 A bare attribute contains no means to read or write the value of the
@@ -80,9 +83,11 @@ a specific object type.
 For example, the driver model defines struct device_attribute like:
 
 struct device_attribute {
-        struct attribute        attr;
-        ssize_t (*show)(struct device * dev, char * buf);
-        ssize_t (*store)(struct device * dev, const char * buf);
+       struct attribute        attr;
+       ssize_t (*show)(struct device *dev, struct device_attribute *attr,
+                       char *buf);
+       ssize_t (*store)(struct device *dev, struct device_attribute *attr,
+                        const char *buf, size_t count);
 };
 
 int device_create_file(struct device *, struct device_attribute *);
@@ -90,12 +95,8 @@ void device_remove_file(struct device *, struct device_attribute *);
 
 It also defines this helper for defining device attributes: 
 
-#define DEVICE_ATTR(_name, _mode, _show, _store)      \
-struct device_attribute dev_attr_##_name = {            \
-        .attr = {.name  = __stringify(_name) , .mode   = _mode },      \
-        .show   = _show,                                \
-        .store  = _store,                               \
-};
+#define DEVICE_ATTR(_name, _mode, _show, _store) \
+struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
 
 For example, declaring
 
@@ -107,9 +108,9 @@ static struct device_attribute dev_attr_foo = {
        .attr   = {
                .name = "foo",
                .mode = S_IWUSR | S_IRUGO,
+               .show = show_foo,
+               .store = store_foo,
        },
-       .show = show_foo,
-       .store = store_foo,
 };
 
 
@@ -161,10 +162,12 @@ To read or write attributes, show() or store() methods must be
 specified when declaring the attribute. The method types should be as
 simple as those defined for device attributes:
 
-        ssize_t (*show)(struct device * dev, char * buf);
-        ssize_t (*store)(struct device * dev, const char * buf);
+ssize_t (*show)(struct device * dev, struct device_attribute * attr,
+                char * buf);
+ssize_t (*store)(struct device * dev, struct device_attribute * attr,
+                 const char * buf);
 
-IOW, they should take only an object and a buffer as parameters. 
+IOW, they should take only an object, an attribute, and a buffer as parameters.
 
 
 sysfs allocates a buffer of size (PAGE_SIZE) and passes it to the
@@ -299,14 +302,16 @@ The following interface layers currently exist in sysfs:
 Structure:
 
 struct device_attribute {
-        struct attribute        attr;
-        ssize_t (*show)(struct device * dev, char * buf);
-        ssize_t (*store)(struct device * dev, const char * buf);
+       struct attribute        attr;
+       ssize_t (*show)(struct device *dev, struct device_attribute *attr,
+                       char *buf);
+       ssize_t (*store)(struct device *dev, struct device_attribute *attr,
+                        const char *buf, size_t count);
 };
 
 Declaring:
 
-DEVICE_ATTR(_name, _str, _mode, _show, _store);
+DEVICE_ATTR(_name, _mode, _show, _store);
 
 Creation/Removal:
 
@@ -342,7 +347,8 @@ Structure:
 struct driver_attribute {
         struct attribute        attr;
         ssize_t (*show)(struct device_driver *, char * buf);
-        ssize_t (*store)(struct device_driver *, const char * buf);
+        ssize_t (*store)(struct device_driver *, const char * buf,
+                         size_t count);
 };
 
 Declaring:
index 84da2a4ba25ab698b8788e03d33d1678f86eba22..12fedb7834c65b27d9eda747e1d38b13ac49777b 100644 (file)
@@ -79,13 +79,6 @@ Mount options
 
 (*) == default.
 
-norm_unmount (*)       commit on unmount; the journal is committed
-                       when the file-system is unmounted so that the
-                       next mount does not have to replay the journal
-                       and it becomes very fast;
-fast_unmount           do not commit on unmount; this option makes
-                       unmount faster, but the next mount slower
-                       because of the need to replay the journal.
 bulk_read              read more in one go to take advantage of flash
                        media that read faster sequentially
 no_bulk_read (*)       do not bulk-read
diff --git a/Documentation/hwmon/hpfall.c b/Documentation/hwmon/hpfall.c
new file mode 100644 (file)
index 0000000..bbea1cc
--- /dev/null
@@ -0,0 +1,101 @@
+/* Disk protection for HP machines.
+ *
+ * Copyright 2008 Eric Piel
+ * Copyright 2009 Pavel Machek <pavel@suse.cz>
+ *
+ * GPLv2.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <string.h>
+#include <stdint.h>
+#include <errno.h>
+#include <signal.h>
+
+void write_int(char *path, int i)
+{
+       char buf[1024];
+       int fd = open(path, O_RDWR);
+       if (fd < 0) {
+               perror("open");
+               exit(1);
+       }
+       sprintf(buf, "%d", i);
+       if (write(fd, buf, strlen(buf)) != strlen(buf)) {
+               perror("write");
+               exit(1);
+       }
+       close(fd);
+}
+
+void set_led(int on)
+{
+       write_int("/sys/class/leds/hp::hddprotect/brightness", on);
+}
+
+void protect(int seconds)
+{
+       write_int("/sys/block/sda/device/unload_heads", seconds*1000);
+}
+
+int on_ac(void)
+{
+//     /sys/class/power_supply/AC0/online
+}
+
+int lid_open(void)
+{
+//     /proc/acpi/button/lid/LID/state
+}
+
+void ignore_me(void)
+{
+       protect(0);
+       set_led(0);
+
+}
+
+int main(int argc, char* argv[])
+{
+       int fd, ret;
+
+       fd = open("/dev/freefall", O_RDONLY);
+       if (fd < 0) {
+               perror("open");
+               return EXIT_FAILURE;
+       }
+
+       signal(SIGALRM, ignore_me);
+
+       for (;;) {
+              unsigned char count;
+
+               ret = read(fd, &count, sizeof(count));
+              alarm(0);
+              if ((ret == -1) && (errno == EINTR)) {
+                      /* Alarm expired, time to unpark the heads */
+                      continue;
+              }
+
+               if (ret != sizeof(count)) {
+                       perror("read");
+                       break;
+               }
+
+              protect(21);
+              set_led(1);
+              if (1 || on_ac() || lid_open()) {
+                      alarm(2);
+              } else {
+                      alarm(20);
+              }
+       }
+
+       close(fd);
+       return EXIT_SUCCESS;
+}
index 0fcfc4a7ccdc0c9b7934a42054d60139e3320a4a..287f8c902656db40353954b967b06503d517dc70 100644 (file)
@@ -33,6 +33,14 @@ rate - reports the sampling rate of the accelerometer device in HZ
 This driver also provides an absolute input class device, allowing
 the laptop to act as a pinball machine-esque joystick.
 
+Another feature of the driver is misc device called "freefall" that
+acts similar to /dev/rtc and reacts on free-fall interrupts received
+from the device. It supports blocking operations, poll/select and
+fasync operation modes. You must read 1 bytes from the device.  The
+result is number of free-fall interrupts since the last successful
+read (or 255 if number of interrupts would not fit).
+
+
 Axes orientation
 ----------------
 
index d73fbd2b2b4503e4fb36325fe1ed2337eda6325f..026ec7d573840f8be024d5945addfcda73373118 100644 (file)
@@ -43,7 +43,8 @@ Only comments so marked will be considered by the kernel-doc scripts,
 and any comment so marked must be in kernel-doc format.  Do not use
 "/**" to be begin a comment block unless the comment block contains
 kernel-doc formatted comments.  The closing comment marker for
-kernel-doc comments can be either "*/" or "**/".
+kernel-doc comments can be either "*/" or "**/", but "*/" is
+preferred in the Linux kernel tree.
 
 Kernel-doc comments should be placed just before the function
 or data structure being described.
@@ -63,7 +64,7 @@ Example kernel-doc function comment:
  * comment lines.
  *
  * The longer description can have multiple paragraphs.
- **/
+ */
 
 The first line, with the short description, must be on a single line.
 
@@ -85,7 +86,7 @@ Example kernel-doc data structure comment.
  *             perhaps with more lines and words.
  *
  * Longer description of this structure.
- **/
+ */
 
 The kernel-doc function comments describe each parameter to the
 function, in order, with the @name lines.
index d8362cf9909ec3c42d6e1dfd5188e4bb5ab0d475..319785b6dcb1d024892bca7f9eb6c8195d8bcf11 100644 (file)
@@ -134,7 +134,7 @@ and is between 256 and 4096 characters. It is defined in the file
 
        acpi=           [HW,ACPI,X86-64,i386]
                        Advanced Configuration and Power Interface
-                       Format: { force | off | ht | strict | noirq }
+                       Format: { force | off | ht | strict | noirq | rsdt }
                        force -- enable ACPI if default was off
                        off -- disable ACPI if default was on
                        noirq -- do not use ACPI for IRQ routing
@@ -937,6 +937,8 @@ and is between 256 and 4096 characters. It is defined in the file
 
 
        intel_iommu=    [DMAR] Intel IOMMU driver (DMAR) option
+               on
+                       Enable intel iommu driver.
                off
                        Disable intel iommu driver.
                igfx_off [Default Off]
index 7a3bb1abb8304a1fe7222e354e43164a7a7635bb..b132e4a3cf0f137b7e8d6a18f67b01b5c44a95c2 100644 (file)
@@ -141,7 +141,8 @@ rx_ccid = 2
        Default CCID for the receiver-sender half-connection; see tx_ccid.
 
 seq_window = 100
-       The initial sequence window (sec. 7.5.2).
+       The initial sequence window (sec. 7.5.2) of the sender. This influences
+       the local ackno validity and the remote seqno validity windows (7.5.1).
 
 tx_qlen = 5
        The size of the transmit buffer in packets. A value of 0 corresponds
index c7712787933c1734c98a0191db23d9cb2886d0f8..7185e4c41e590a985b7decfe593c7647cb023389 100644 (file)
@@ -2,7 +2,7 @@
 
 ip_forward - BOOLEAN
        0 - disabled (default)
-       not 0 - enabled 
+       not 0 - enabled
 
        Forward Packets between interfaces.
 
@@ -36,49 +36,49 @@ rt_cache_rebuild_count - INTEGER
 IP Fragmentation:
 
 ipfrag_high_thresh - INTEGER
-       Maximum memory used to reassemble IP fragments. When 
+       Maximum memory used to reassemble IP fragments. When
        ipfrag_high_thresh bytes of memory is allocated for this purpose,
        the fragment handler will toss packets until ipfrag_low_thresh
        is reached.
-       
+
 ipfrag_low_thresh - INTEGER
-       See ipfrag_high_thresh  
+       See ipfrag_high_thresh
 
 ipfrag_time - INTEGER
-       Time in seconds to keep an IP fragment in memory.       
+       Time in seconds to keep an IP fragment in memory.
 
 ipfrag_secret_interval - INTEGER
-       Regeneration interval (in seconds) of the hash secret (or lifetime 
+       Regeneration interval (in seconds) of the hash secret (or lifetime
        for the hash secret) for IP fragments.
        Default: 600
 
 ipfrag_max_dist - INTEGER
-       ipfrag_max_dist is a non-negative integer value which defines the 
-       maximum "disorder" which is allowed among fragments which share a 
-       common IP source address. Note that reordering of packets is 
-       not unusual, but if a large number of fragments arrive from a source 
-       IP address while a particular fragment queue remains incomplete, it 
-       probably indicates that one or more fragments belonging to that queue 
-       have been lost. When ipfrag_max_dist is positive, an additional check 
-       is done on fragments before they are added to a reassembly queue - if 
-       ipfrag_max_dist (or more) fragments have arrived from a particular IP 
-       address between additions to any IP fragment queue using that source 
-       address, it's presumed that one or more fragments in the queue are 
-       lost. The existing fragment queue will be dropped, and a new one 
+       ipfrag_max_dist is a non-negative integer value which defines the
+       maximum "disorder" which is allowed among fragments which share a
+       common IP source address. Note that reordering of packets is
+       not unusual, but if a large number of fragments arrive from a source
+       IP address while a particular fragment queue remains incomplete, it
+       probably indicates that one or more fragments belonging to that queue
+       have been lost. When ipfrag_max_dist is positive, an additional check
+       is done on fragments before they are added to a reassembly queue - if
+       ipfrag_max_dist (or more) fragments have arrived from a particular IP
+       address between additions to any IP fragment queue using that source
+       address, it's presumed that one or more fragments in the queue are
+       lost. The existing fragment queue will be dropped, and a new one
        started. An ipfrag_max_dist value of zero disables this check.
 
        Using a very small value, e.g. 1 or 2, for ipfrag_max_dist can
        result in unnecessarily dropping fragment queues when normal
-       reordering of packets occurs, which could lead to poor application 
-       performance. Using a very large value, e.g. 50000, increases the 
-       likelihood of incorrectly reassembling IP fragments that originate 
+       reordering of packets occurs, which could lead to poor application
+       performance. Using a very large value, e.g. 50000, increases the
+       likelihood of incorrectly reassembling IP fragments that originate
        from different IP datagrams, which could result in data corruption.
        Default: 64
 
 INET peer storage:
 
 inet_peer_threshold - INTEGER
-       The approximate size of the storage.  Starting from this threshold      
+       The approximate size of the storage.  Starting from this threshold
        entries will be thrown aggressively.  This threshold also determines
        entries' time-to-live and time intervals between garbage collection
        passes.  More entries, less time-to-live, less GC interval.
@@ -105,7 +105,7 @@ inet_peer_gc_maxtime - INTEGER
        in effect under low (or absent) memory pressure on the pool.
        Measured in seconds.
 
-TCP variables: 
+TCP variables:
 
 somaxconn - INTEGER
        Limit of socket listen() backlog, known in userspace as SOMAXCONN.
@@ -310,7 +310,7 @@ tcp_orphan_retries - INTEGER
 
 tcp_reordering - INTEGER
        Maximal reordering of packets in a TCP stream.
-       Default: 3      
+       Default: 3
 
 tcp_retrans_collapse - BOOLEAN
        Bug-to-bug compatibility with some broken printers.
@@ -521,7 +521,7 @@ IP Variables:
 
 ip_local_port_range - 2 INTEGERS
        Defines the local port range that is used by TCP and UDP to
-       choose the local port. The first number is the first, the 
+       choose the local port. The first number is the first, the
        second the last local port number. Default value depends on
        amount of memory available on the system:
        > 128Mb 32768-61000
@@ -594,12 +594,12 @@ icmp_errors_use_inbound_ifaddr - BOOLEAN
 
        If zero, icmp error messages are sent with the primary address of
        the exiting interface.
+
        If non-zero, the message will be sent with the primary address of
        the interface that received the packet that caused the icmp error.
        This is the behaviour network many administrators will expect from
        a router. And it can make debugging complicated network layouts
-       much easier. 
+       much easier.
 
        Note that if no primary address exists for the interface selected,
        then the primary address of the first non-loopback interface that
@@ -611,7 +611,7 @@ igmp_max_memberships - INTEGER
        Change the maximum number of multicast groups we can subscribe to.
        Default: 20
 
-conf/interface/*  changes special settings per interface (where "interface" is 
+conf/interface/*  changes special settings per interface (where "interface" is
                  the name of your network interface)
 conf/all/*       is special, changes the settings for all interfaces
 
@@ -625,11 +625,11 @@ log_martians - BOOLEAN
 accept_redirects - BOOLEAN
        Accept ICMP redirect messages.
        accept_redirects for the interface will be enabled if:
-       - both conf/{all,interface}/accept_redirects are TRUE in the case forwarding
-         for the interface is enabled
+       - both conf/{all,interface}/accept_redirects are TRUE in the case
+         forwarding for the interface is enabled
        or
-       - at least one of conf/{all,interface}/accept_redirects is TRUE in the case
-         forwarding for the interface is disabled
+       - at least one of conf/{all,interface}/accept_redirects is TRUE in the
+         case forwarding for the interface is disabled
        accept_redirects for the interface will be disabled otherwise
        default TRUE (host)
                FALSE (router)
@@ -640,8 +640,8 @@ forwarding - BOOLEAN
 mc_forwarding - BOOLEAN
        Do multicast routing. The kernel needs to be compiled with CONFIG_MROUTE
        and a multicast routing daemon is required.
-       conf/all/mc_forwarding must also be set to TRUE to enable multicast routing
-       for the interface
+       conf/all/mc_forwarding must also be set to TRUE to enable multicast
+       routing for the interface
 
 medium_id - INTEGER
        Integer value used to differentiate the devices by the medium they
@@ -649,7 +649,7 @@ medium_id - INTEGER
        the broadcast packets are received only on one of them.
        The default value 0 means that the device is the only interface
        to its medium, value of -1 means that medium is not known.
-       
+
        Currently, it is used to change the proxy_arp behavior:
        the proxy_arp feature is enabled for packets forwarded between
        two devices attached to different media.
@@ -699,16 +699,22 @@ accept_source_route - BOOLEAN
        default TRUE (router)
                FALSE (host)
 
-rp_filter - BOOLEAN
-       1 - do source validation by reversed path, as specified in RFC1812
-           Recommended option for single homed hosts and stub network
-           routers. Could cause troubles for complicated (not loop free)
-           networks running a slow unreliable protocol (sort of RIP),
-           or using static routes.
-
+rp_filter - INTEGER
        0 - No source validation.
-
-       conf/all/rp_filter must also be set to TRUE to do source validation
+       1 - Strict mode as defined in RFC3704 Strict Reverse Path
+           Each incoming packet is tested against the FIB and if the interface
+           is not the best reverse path the packet check will fail.
+           By default failed packets are discarded.
+       2 - Loose mode as defined in RFC3704 Loose Reverse Path
+           Each incoming packet's source address is also tested against the FIB
+           and if the source address is not reachable via any interface
+           the packet check will fail.
+
+       Current recommended practice in RFC3704 is to enable strict mode
+       to prevent IP spoofing from DDos attacks. If using asymmetric routing
+       or other complicated routing, then loose mode is recommended.
+
+       conf/all/rp_filter must also be set to non-zero to do source validation
        on the interface
 
        Default value is 0. Note that some distributions enable it
@@ -782,6 +788,12 @@ arp_ignore - INTEGER
        The max value from conf/{all,interface}/arp_ignore is used
        when ARP request is received on the {interface}
 
+arp_notify - BOOLEAN
+       Define mode for notification of address and device changes.
+       0 - (default): do nothing
+       1 - Generate gratuitous arp replies when device is brought up
+           or hardware address changes.
+
 arp_accept - BOOLEAN
        Define behavior when gratuitous arp replies are received:
        0 - drop gratuitous arp frames
@@ -823,7 +835,7 @@ apply to IPv6 [XXX?].
 
 bindv6only - BOOLEAN
        Default value for IPV6_V6ONLY socket option,
-       which restricts use of the IPv6 socket to IPv6 communication 
+       which restricts use of the IPv6 socket to IPv6 communication
        only.
                TRUE: disable IPv4-mapped address feature
                FALSE: enable IPv4-mapped address feature
@@ -833,19 +845,19 @@ bindv6only - BOOLEAN
 IPv6 Fragmentation:
 
 ip6frag_high_thresh - INTEGER
-       Maximum memory used to reassemble IPv6 fragments. When 
+       Maximum memory used to reassemble IPv6 fragments. When
        ip6frag_high_thresh bytes of memory is allocated for this purpose,
        the fragment handler will toss packets until ip6frag_low_thresh
        is reached.
-       
+
 ip6frag_low_thresh - INTEGER
-       See ip6frag_high_thresh 
+       See ip6frag_high_thresh
 
 ip6frag_time - INTEGER
        Time in seconds to keep an IPv6 fragment in memory.
 
 ip6frag_secret_interval - INTEGER
-       Regeneration interval (in seconds) of the hash secret (or lifetime 
+       Regeneration interval (in seconds) of the hash secret (or lifetime
        for the hash secret) for IPv6 fragments.
        Default: 600
 
@@ -854,17 +866,17 @@ conf/default/*:
 
 
 conf/all/*:
-       Change all the interface-specific settings.  
+       Change all the interface-specific settings.
 
        [XXX:  Other special features than forwarding?]
 
 conf/all/forwarding - BOOLEAN
-       Enable global IPv6 forwarding between all interfaces.  
+       Enable global IPv6 forwarding between all interfaces.
 
-       IPv4 and IPv6 work differently here; e.g. netfilter must be used 
+       IPv4 and IPv6 work differently here; e.g. netfilter must be used
        to control which interfaces may forward packets and which not.
 
-       This also sets all interfaces' Host/Router setting 
+       This also sets all interfaces' Host/Router setting
        'forwarding' to the specified value.  See below for details.
 
        This referred to as global forwarding.
@@ -875,12 +887,12 @@ proxy_ndp - BOOLEAN
 conf/interface/*:
        Change special settings per interface.
 
-       The functional behaviour for certain settings is different 
+       The functional behaviour for certain settings is different
        depending on whether local forwarding is enabled or not.
 
 accept_ra - BOOLEAN
        Accept Router Advertisements; autoconfigure using them.
-       
+
        Functional default: enabled if local forwarding is disabled.
                            disabled if local forwarding is enabled.
 
@@ -926,7 +938,7 @@ accept_source_route - INTEGER
        Default: 0
 
 autoconf - BOOLEAN
-       Autoconfigure addresses using Prefix Information in Router 
+       Autoconfigure addresses using Prefix Information in Router
        Advertisements.
 
        Functional default: enabled if accept_ra_pinfo is enabled.
@@ -935,11 +947,11 @@ autoconf - BOOLEAN
 dad_transmits - INTEGER
        The amount of Duplicate Address Detection probes to send.
        Default: 1
-       
+
 forwarding - BOOLEAN
-       Configure interface-specific Host/Router behaviour.  
+       Configure interface-specific Host/Router behaviour.
 
-       Note: It is recommended to have the same setting on all 
+       Note: It is recommended to have the same setting on all
        interfaces; mixed router/host scenarios are rather uncommon.
 
        FALSE:
@@ -948,13 +960,13 @@ forwarding - BOOLEAN
 
        1. IsRouter flag is not set in Neighbour Advertisements.
        2. Router Solicitations are being sent when necessary.
-       3. If accept_ra is TRUE (default), accept Router 
+       3. If accept_ra is TRUE (default), accept Router
           Advertisements (and do autoconfiguration).
        4. If accept_redirects is TRUE (default), accept Redirects.
 
        TRUE:
 
-       If local forwarding is enabled, Router behaviour is assumed. 
+       If local forwarding is enabled, Router behaviour is assumed.
        This means exactly the reverse from the above:
 
        1. IsRouter flag is set in Neighbour Advertisements.
@@ -989,7 +1001,7 @@ router_solicitation_interval - INTEGER
        Default: 4
 
 router_solicitations - INTEGER
-       Number of Router Solicitations to send until assuming no 
+       Number of Router Solicitations to send until assuming no
        routers are present.
        Default: 3
 
@@ -1013,11 +1025,11 @@ temp_prefered_lft - INTEGER
 
 max_desync_factor - INTEGER
        Maximum value for DESYNC_FACTOR, which is a random value
-       that ensures that clients don't synchronize with each 
+       that ensures that clients don't synchronize with each
        other and generate new addresses at exactly the same time.
        value is in seconds.
        Default: 600
-       
+
 regen_max_retry - INTEGER
        Number of attempts before give up attempting to generate
        valid temporary addresses.
@@ -1025,8 +1037,8 @@ regen_max_retry - INTEGER
 
 max_addresses - INTEGER
        Number of maximum addresses per interface.  0 disables limitation.
-       It is recommended not set too large value (or 0) because it would 
-       be too easy way to crash kernel to allow to create too much of 
+       It is recommended not set too large value (or 0) because it would
+       be too easy way to crash kernel to allow to create too much of
        autoconfigured addresses.
        Default: 16
 
diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt
new file mode 100644 (file)
index 0000000..0e58b45
--- /dev/null
@@ -0,0 +1,180 @@
+The existing interfaces for getting network packages time stamped are:
+
+* SO_TIMESTAMP
+  Generate time stamp for each incoming packet using the (not necessarily
+  monotonous!) system time. Result is returned via recv_msg() in a
+  control message as timeval (usec resolution).
+
+* SO_TIMESTAMPNS
+  Same time stamping mechanism as SO_TIMESTAMP, but returns result as
+  timespec (nsec resolution).
+
+* IP_MULTICAST_LOOP + SO_TIMESTAMP[NS]
+  Only for multicasts: approximate send time stamp by receiving the looped
+  packet and using its receive time stamp.
+
+The following interface complements the existing ones: receive time
+stamps can be generated and returned for arbitrary packets and much
+closer to the point where the packet is really sent. Time stamps can
+be generated in software (as before) or in hardware (if the hardware
+has such a feature).
+
+SO_TIMESTAMPING:
+
+Instructs the socket layer which kind of information is wanted. The
+parameter is an integer with some of the following bits set. Setting
+other bits is an error and doesn't change the current state.
+
+SOF_TIMESTAMPING_TX_HARDWARE:  try to obtain send time stamp in hardware
+SOF_TIMESTAMPING_TX_SOFTWARE:  if SOF_TIMESTAMPING_TX_HARDWARE is off or
+                               fails, then do it in software
+SOF_TIMESTAMPING_RX_HARDWARE:  return the original, unmodified time stamp
+                               as generated by the hardware
+SOF_TIMESTAMPING_RX_SOFTWARE:  if SOF_TIMESTAMPING_RX_HARDWARE is off or
+                               fails, then do it in software
+SOF_TIMESTAMPING_RAW_HARDWARE: return original raw hardware time stamp
+SOF_TIMESTAMPING_SYS_HARDWARE: return hardware time stamp transformed to
+                               the system time base
+SOF_TIMESTAMPING_SOFTWARE:     return system time stamp generated in
+                               software
+
+SOF_TIMESTAMPING_TX/RX determine how time stamps are generated.
+SOF_TIMESTAMPING_RAW/SYS determine how they are reported in the
+following control message:
+    struct scm_timestamping {
+           struct timespec systime;
+           struct timespec hwtimetrans;
+           struct timespec hwtimeraw;
+    };
+
+recvmsg() can be used to get this control message for regular incoming
+packets. For send time stamps the outgoing packet is looped back to
+the socket's error queue with the send time stamp(s) attached. It can
+be received with recvmsg(flags=MSG_ERRQUEUE). The call returns the
+original outgoing packet data including all headers preprended down to
+and including the link layer, the scm_timestamping control message and
+a sock_extended_err control message with ee_errno==ENOMSG and
+ee_origin==SO_EE_ORIGIN_TIMESTAMPING. A socket with such a pending
+bounced packet is ready for reading as far as select() is concerned.
+If the outgoing packet has to be fragmented, then only the first
+fragment is time stamped and returned to the sending socket.
+
+All three values correspond to the same event in time, but were
+generated in different ways. Each of these values may be empty (= all
+zero), in which case no such value was available. If the application
+is not interested in some of these values, they can be left blank to
+avoid the potential overhead of calculating them.
+
+systime is the value of the system time at that moment. This
+corresponds to the value also returned via SO_TIMESTAMP[NS]. If the
+time stamp was generated by hardware, then this field is
+empty. Otherwise it is filled in if SOF_TIMESTAMPING_SOFTWARE is
+set.
+
+hwtimeraw is the original hardware time stamp. Filled in if
+SOF_TIMESTAMPING_RAW_HARDWARE is set. No assumptions about its
+relation to system time should be made.
+
+hwtimetrans is the hardware time stamp transformed so that it
+corresponds as good as possible to system time. This correlation is
+not perfect; as a consequence, sorting packets received via different
+NICs by their hwtimetrans may differ from the order in which they were
+received. hwtimetrans may be non-monotonic even for the same NIC.
+Filled in if SOF_TIMESTAMPING_SYS_HARDWARE is set. Requires support
+by the network device and will be empty without that support.
+
+
+SIOCSHWTSTAMP:
+
+Hardware time stamping must also be initialized for each device driver
+that is expected to do hardware time stamping. The parameter is:
+
+struct hwtstamp_config {
+    int flags;           /* no flags defined right now, must be zero */
+    int tx_type;         /* HWTSTAMP_TX_* */
+    int rx_filter;       /* HWTSTAMP_FILTER_* */
+};
+
+Desired behavior is passed into the kernel and to a specific device by
+calling ioctl(SIOCSHWTSTAMP) with a pointer to a struct ifreq whose
+ifr_data points to a struct hwtstamp_config. The tx_type and
+rx_filter are hints to the driver what it is expected to do. If
+the requested fine-grained filtering for incoming packets is not
+supported, the driver may time stamp more than just the requested types
+of packets.
+
+A driver which supports hardware time stamping shall update the struct
+with the actual, possibly more permissive configuration. If the
+requested packets cannot be time stamped, then nothing should be
+changed and ERANGE shall be returned (in contrast to EINVAL, which
+indicates that SIOCSHWTSTAMP is not supported at all).
+
+Only a processes with admin rights may change the configuration. User
+space is responsible to ensure that multiple processes don't interfere
+with each other and that the settings are reset.
+
+/* possible values for hwtstamp_config->tx_type */
+enum {
+       /*
+        * no outgoing packet will need hardware time stamping;
+        * should a packet arrive which asks for it, no hardware
+        * time stamping will be done
+        */
+       HWTSTAMP_TX_OFF,
+
+       /*
+        * enables hardware time stamping for outgoing packets;
+        * the sender of the packet decides which are to be
+        * time stamped by setting SOF_TIMESTAMPING_TX_SOFTWARE
+        * before sending the packet
+        */
+       HWTSTAMP_TX_ON,
+};
+
+/* possible values for hwtstamp_config->rx_filter */
+enum {
+       /* time stamp no incoming packet at all */
+       HWTSTAMP_FILTER_NONE,
+
+       /* time stamp any incoming packet */
+       HWTSTAMP_FILTER_ALL,
+
+        /* return value: time stamp all packets requested plus some others */
+        HWTSTAMP_FILTER_SOME,
+
+       /* PTP v1, UDP, any kind of event packet */
+       HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
+
+        ...
+};
+
+
+DEVICE IMPLEMENTATION
+
+A driver which supports hardware time stamping must support the
+SIOCSHWTSTAMP ioctl. Time stamps for received packets must be stored
+in the skb with skb_hwtstamp_set().
+
+Time stamps for outgoing packets are to be generated as follows:
+- In hard_start_xmit(), check if skb_hwtstamp_check_tx_hardware()
+  returns non-zero. If yes, then the driver is expected
+  to do hardware time stamping.
+- If this is possible for the skb and requested, then declare
+  that the driver is doing the time stamping by calling
+  skb_hwtstamp_tx_in_progress(). A driver not supporting
+  hardware time stamping doesn't do that. A driver must never
+  touch sk_buff::tstamp! It is used to store how time stamping
+  for an outgoing packets is to be done.
+- As soon as the driver has sent the packet and/or obtained a
+  hardware time stamp for it, it passes the time stamp back by
+  calling skb_hwtstamp_tx() with the original skb, the raw
+  hardware time stamp and a handle to the device (necessary
+  to convert the hardware time stamp to system time). If obtaining
+  the hardware time stamp somehow fails, then the driver should
+  not fall back to software time stamping. The rationale is that
+  this would occur at a later time in the processing pipeline
+  than other software time stamping and therefore could lead
+  to unexpected deltas between time stamps.
+- If the driver did not call skb_hwtstamp_tx_in_progress(), then
+  dev_hard_start_xmit() checks whether software time stamping
+  is wanted as fallback and potentially generates the time stamp.
diff --git a/Documentation/networking/timestamping/.gitignore b/Documentation/networking/timestamping/.gitignore
new file mode 100644 (file)
index 0000000..71e81eb
--- /dev/null
@@ -0,0 +1 @@
+timestamping
diff --git a/Documentation/networking/timestamping/Makefile b/Documentation/networking/timestamping/Makefile
new file mode 100644 (file)
index 0000000..2a1489f
--- /dev/null
@@ -0,0 +1,6 @@
+CPPFLAGS = -I../../../include
+
+timestamping: timestamping.c
+
+clean:
+       rm -f timestamping
diff --git a/Documentation/networking/timestamping/timestamping.c b/Documentation/networking/timestamping/timestamping.c
new file mode 100644 (file)
index 0000000..43d1431
--- /dev/null
@@ -0,0 +1,533 @@
+/*
+ * This program demonstrates how the various time stamping features in
+ * the Linux kernel work. It emulates the behavior of a PTP
+ * implementation in stand-alone master mode by sending PTPv1 Sync
+ * multicasts once every second. It looks for similar packets, but
+ * beyond that doesn't actually implement PTP.
+ *
+ * Outgoing packets are time stamped with SO_TIMESTAMPING with or
+ * without hardware support.
+ *
+ * Incoming packets are time stamped with SO_TIMESTAMPING with or
+ * without hardware support, SIOCGSTAMP[NS] (per-socket time stamp) and
+ * SO_TIMESTAMP[NS].
+ *
+ * Copyright (C) 2009 Intel Corporation.
+ * Author: Patrick Ohly <patrick.ohly@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/select.h>
+#include <sys/ioctl.h>
+#include <arpa/inet.h>
+#include <net/if.h>
+
+#include "asm/types.h"
+#include "linux/net_tstamp.h"
+#include "linux/errqueue.h"
+
+#ifndef SO_TIMESTAMPING
+# define SO_TIMESTAMPING         37
+# define SCM_TIMESTAMPING        SO_TIMESTAMPING
+#endif
+
+#ifndef SO_TIMESTAMPNS
+# define SO_TIMESTAMPNS 35
+#endif
+
+#ifndef SIOCGSTAMPNS
+# define SIOCGSTAMPNS 0x8907
+#endif
+
+#ifndef SIOCSHWTSTAMP
+# define SIOCSHWTSTAMP 0x89b0
+#endif
+
+static void usage(const char *error)
+{
+       if (error)
+               printf("invalid option: %s\n", error);
+       printf("timestamping interface option*\n\n"
+              "Options:\n"
+              "  IP_MULTICAST_LOOP - looping outgoing multicasts\n"
+              "  SO_TIMESTAMP - normal software time stamping, ms resolution\n"
+              "  SO_TIMESTAMPNS - more accurate software time stamping\n"
+              "  SOF_TIMESTAMPING_TX_HARDWARE - hardware time stamping of outgoing packets\n"
+              "  SOF_TIMESTAMPING_TX_SOFTWARE - software fallback for outgoing packets\n"
+              "  SOF_TIMESTAMPING_RX_HARDWARE - hardware time stamping of incoming packets\n"
+              "  SOF_TIMESTAMPING_RX_SOFTWARE - software fallback for incoming packets\n"
+              "  SOF_TIMESTAMPING_SOFTWARE - request reporting of software time stamps\n"
+              "  SOF_TIMESTAMPING_SYS_HARDWARE - request reporting of transformed HW time stamps\n"
+              "  SOF_TIMESTAMPING_RAW_HARDWARE - request reporting of raw HW time stamps\n"
+              "  SIOCGSTAMP - check last socket time stamp\n"
+              "  SIOCGSTAMPNS - more accurate socket time stamp\n");
+       exit(1);
+}
+
+static void bail(const char *error)
+{
+       printf("%s: %s\n", error, strerror(errno));
+       exit(1);
+}
+
+static const unsigned char sync[] = {
+       0x00, 0x01, 0x00, 0x01,
+       0x5f, 0x44, 0x46, 0x4c,
+       0x54, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x01, 0x01,
+
+       /* fake uuid */
+       0x00, 0x01,
+       0x02, 0x03, 0x04, 0x05,
+
+       0x00, 0x01, 0x00, 0x37,
+       0x00, 0x00, 0x00, 0x08,
+       0x00, 0x00, 0x00, 0x00,
+       0x49, 0x05, 0xcd, 0x01,
+       0x29, 0xb1, 0x8d, 0xb0,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x01,
+
+       /* fake uuid */
+       0x00, 0x01,
+       0x02, 0x03, 0x04, 0x05,
+
+       0x00, 0x00, 0x00, 0x37,
+       0x00, 0x00, 0x00, 0x04,
+       0x44, 0x46, 0x4c, 0x54,
+       0x00, 0x00, 0xf0, 0x60,
+       0x00, 0x01, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x01,
+       0x00, 0x00, 0xf0, 0x60,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x04,
+       0x44, 0x46, 0x4c, 0x54,
+       0x00, 0x01,
+
+       /* fake uuid */
+       0x00, 0x01,
+       0x02, 0x03, 0x04, 0x05,
+
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00
+};
+
+static void sendpacket(int sock, struct sockaddr *addr, socklen_t addr_len)
+{
+       struct timeval now;
+       int res;
+
+       res = sendto(sock, sync, sizeof(sync), 0,
+               addr, addr_len);
+       gettimeofday(&now, 0);
+       if (res < 0)
+               printf("%s: %s\n", "send", strerror(errno));
+       else
+               printf("%ld.%06ld: sent %d bytes\n",
+                      (long)now.tv_sec, (long)now.tv_usec,
+                      res);
+}
+
+static void printpacket(struct msghdr *msg, int res,
+                       char *data,
+                       int sock, int recvmsg_flags,
+                       int siocgstamp, int siocgstampns)
+{
+       struct sockaddr_in *from_addr = (struct sockaddr_in *)msg->msg_name;
+       struct cmsghdr *cmsg;
+       struct timeval tv;
+       struct timespec ts;
+       struct timeval now;
+
+       gettimeofday(&now, 0);
+
+       printf("%ld.%06ld: received %s data, %d bytes from %s, %d bytes control messages\n",
+              (long)now.tv_sec, (long)now.tv_usec,
+              (recvmsg_flags & MSG_ERRQUEUE) ? "error" : "regular",
+              res,
+              inet_ntoa(from_addr->sin_addr),
+              msg->msg_controllen);
+       for (cmsg = CMSG_FIRSTHDR(msg);
+            cmsg;
+            cmsg = CMSG_NXTHDR(msg, cmsg)) {
+               printf("   cmsg len %d: ", cmsg->cmsg_len);
+               switch (cmsg->cmsg_level) {
+               case SOL_SOCKET:
+                       printf("SOL_SOCKET ");
+                       switch (cmsg->cmsg_type) {
+                       case SO_TIMESTAMP: {
+                               struct timeval *stamp =
+                                       (struct timeval *)CMSG_DATA(cmsg);
+                               printf("SO_TIMESTAMP %ld.%06ld",
+                                      (long)stamp->tv_sec,
+                                      (long)stamp->tv_usec);
+                               break;
+                       }
+                       case SO_TIMESTAMPNS: {
+                               struct timespec *stamp =
+                                       (struct timespec *)CMSG_DATA(cmsg);
+                               printf("SO_TIMESTAMPNS %ld.%09ld",
+                                      (long)stamp->tv_sec,
+                                      (long)stamp->tv_nsec);
+                               break;
+                       }
+                       case SO_TIMESTAMPING: {
+                               struct timespec *stamp =
+                                       (struct timespec *)CMSG_DATA(cmsg);
+                               printf("SO_TIMESTAMPING ");
+                               printf("SW %ld.%09ld ",
+                                      (long)stamp->tv_sec,
+                                      (long)stamp->tv_nsec);
+                               stamp++;
+                               printf("HW transformed %ld.%09ld ",
+                                      (long)stamp->tv_sec,
+                                      (long)stamp->tv_nsec);
+                               stamp++;
+                               printf("HW raw %ld.%09ld",
+                                      (long)stamp->tv_sec,
+                                      (long)stamp->tv_nsec);
+                               break;
+                       }
+                       default:
+                               printf("type %d", cmsg->cmsg_type);
+                               break;
+                       }
+                       break;
+               case IPPROTO_IP:
+                       printf("IPPROTO_IP ");
+                       switch (cmsg->cmsg_type) {
+                       case IP_RECVERR: {
+                               struct sock_extended_err *err =
+                                       (struct sock_extended_err *)CMSG_DATA(cmsg);
+                               printf("IP_RECVERR ee_errno '%s' ee_origin %d => %s",
+                                       strerror(err->ee_errno),
+                                       err->ee_origin,
+#ifdef SO_EE_ORIGIN_TIMESTAMPING
+                                       err->ee_origin == SO_EE_ORIGIN_TIMESTAMPING ?
+                                       "bounced packet" : "unexpected origin"
+#else
+                                       "probably SO_EE_ORIGIN_TIMESTAMPING"
+#endif
+                                       );
+                               if (res < sizeof(sync))
+                                       printf(" => truncated data?!");
+                               else if (!memcmp(sync, data + res - sizeof(sync),
+                                                       sizeof(sync)))
+                                       printf(" => GOT OUR DATA BACK (HURRAY!)");
+                               break;
+                       }
+                       case IP_PKTINFO: {
+                               struct in_pktinfo *pktinfo =
+                                       (struct in_pktinfo *)CMSG_DATA(cmsg);
+                               printf("IP_PKTINFO interface index %u",
+                                       pktinfo->ipi_ifindex);
+                               break;
+                       }
+                       default:
+                               printf("type %d", cmsg->cmsg_type);
+                               break;
+                       }
+                       break;
+               default:
+                       printf("level %d type %d",
+                               cmsg->cmsg_level,
+                               cmsg->cmsg_type);
+                       break;
+               }
+               printf("\n");
+       }
+
+       if (siocgstamp) {
+               if (ioctl(sock, SIOCGSTAMP, &tv))
+                       printf("   %s: %s\n", "SIOCGSTAMP", strerror(errno));
+               else
+                       printf("SIOCGSTAMP %ld.%06ld\n",
+                              (long)tv.tv_sec,
+                              (long)tv.tv_usec);
+       }
+       if (siocgstampns) {
+               if (ioctl(sock, SIOCGSTAMPNS, &ts))
+                       printf("   %s: %s\n", "SIOCGSTAMPNS", strerror(errno));
+               else
+                       printf("SIOCGSTAMPNS %ld.%09ld\n",
+                              (long)ts.tv_sec,
+                              (long)ts.tv_nsec);
+       }
+}
+
+static void recvpacket(int sock, int recvmsg_flags,
+                      int siocgstamp, int siocgstampns)
+{
+       char data[256];
+       struct msghdr msg;
+       struct iovec entry;
+       struct sockaddr_in from_addr;
+       struct {
+               struct cmsghdr cm;
+               char control[512];
+       } control;
+       int res;
+
+       memset(&msg, 0, sizeof(msg));
+       msg.msg_iov = &entry;
+       msg.msg_iovlen = 1;
+       entry.iov_base = data;
+       entry.iov_len = sizeof(data);
+       msg.msg_name = (caddr_t)&from_addr;
+       msg.msg_namelen = sizeof(from_addr);
+       msg.msg_control = &control;
+       msg.msg_controllen = sizeof(control);
+
+       res = recvmsg(sock, &msg, recvmsg_flags|MSG_DONTWAIT);
+       if (res < 0) {
+               printf("%s %s: %s\n",
+                      "recvmsg",
+                      (recvmsg_flags & MSG_ERRQUEUE) ? "error" : "regular",
+                      strerror(errno));
+       } else {
+               printpacket(&msg, res, data,
+                           sock, recvmsg_flags,
+                           siocgstamp, siocgstampns);
+       }
+}
+
+int main(int argc, char **argv)
+{
+       int so_timestamping_flags = 0;
+       int so_timestamp = 0;
+       int so_timestampns = 0;
+       int siocgstamp = 0;
+       int siocgstampns = 0;
+       int ip_multicast_loop = 0;
+       char *interface;
+       int i;
+       int enabled = 1;
+       int sock;
+       struct ifreq device;
+       struct ifreq hwtstamp;
+       struct hwtstamp_config hwconfig, hwconfig_requested;
+       struct sockaddr_in addr;
+       struct ip_mreq imr;
+       struct in_addr iaddr;
+       int val;
+       socklen_t len;
+       struct timeval next;
+
+       if (argc < 2)
+               usage(0);
+       interface = argv[1];
+
+       for (i = 2; i < argc; i++) {
+               if (!strcasecmp(argv[i], "SO_TIMESTAMP"))
+                       so_timestamp = 1;
+               else if (!strcasecmp(argv[i], "SO_TIMESTAMPNS"))
+                       so_timestampns = 1;
+               else if (!strcasecmp(argv[i], "SIOCGSTAMP"))
+                       siocgstamp = 1;
+               else if (!strcasecmp(argv[i], "SIOCGSTAMPNS"))
+                       siocgstampns = 1;
+               else if (!strcasecmp(argv[i], "IP_MULTICAST_LOOP"))
+                       ip_multicast_loop = 1;
+               else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_TX_HARDWARE"))
+                       so_timestamping_flags |= SOF_TIMESTAMPING_TX_HARDWARE;
+               else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_TX_SOFTWARE"))
+                       so_timestamping_flags |= SOF_TIMESTAMPING_TX_SOFTWARE;
+               else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_RX_HARDWARE"))
+                       so_timestamping_flags |= SOF_TIMESTAMPING_RX_HARDWARE;
+               else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_RX_SOFTWARE"))
+                       so_timestamping_flags |= SOF_TIMESTAMPING_RX_SOFTWARE;
+               else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_SOFTWARE"))
+                       so_timestamping_flags |= SOF_TIMESTAMPING_SOFTWARE;
+               else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_SYS_HARDWARE"))
+                       so_timestamping_flags |= SOF_TIMESTAMPING_SYS_HARDWARE;
+               else if (!strcasecmp(argv[i], "SOF_TIMESTAMPING_RAW_HARDWARE"))
+                       so_timestamping_flags |= SOF_TIMESTAMPING_RAW_HARDWARE;
+               else
+                       usage(argv[i]);
+       }
+
+       sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_UDP);
+       if (socket < 0)
+               bail("socket");
+
+       memset(&device, 0, sizeof(device));
+       strncpy(device.ifr_name, interface, sizeof(device.ifr_name));
+       if (ioctl(sock, SIOCGIFADDR, &device) < 0)
+               bail("getting interface IP address");
+
+       memset(&hwtstamp, 0, sizeof(hwtstamp));
+       strncpy(hwtstamp.ifr_name, interface, sizeof(hwtstamp.ifr_name));
+       hwtstamp.ifr_data = (void *)&hwconfig;
+       memset(&hwconfig, 0, sizeof(&hwconfig));
+       hwconfig.tx_type =
+               (so_timestamping_flags & SOF_TIMESTAMPING_TX_HARDWARE) ?
+               HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF;
+       hwconfig.rx_filter =
+               (so_timestamping_flags & SOF_TIMESTAMPING_RX_HARDWARE) ?
+               HWTSTAMP_FILTER_PTP_V1_L4_SYNC : HWTSTAMP_FILTER_NONE;
+       hwconfig_requested = hwconfig;
+       if (ioctl(sock, SIOCSHWTSTAMP, &hwtstamp) < 0) {
+               if ((errno == EINVAL || errno == ENOTSUP) &&
+                   hwconfig_requested.tx_type == HWTSTAMP_TX_OFF &&
+                   hwconfig_requested.rx_filter == HWTSTAMP_FILTER_NONE)
+                       printf("SIOCSHWTSTAMP: disabling hardware time stamping not possible\n");
+               else
+                       bail("SIOCSHWTSTAMP");
+       }
+       printf("SIOCSHWTSTAMP: tx_type %d requested, got %d; rx_filter %d requested, got %d\n",
+              hwconfig_requested.tx_type, hwconfig.tx_type,
+              hwconfig_requested.rx_filter, hwconfig.rx_filter);
+
+       /* bind to PTP port */
+       addr.sin_family = AF_INET;
+       addr.sin_addr.s_addr = htonl(INADDR_ANY);
+       addr.sin_port = htons(319 /* PTP event port */);
+       if (bind(sock,
+                (struct sockaddr *)&addr,
+                sizeof(struct sockaddr_in)) < 0)
+               bail("bind");
+
+       /* set multicast group for outgoing packets */
+       inet_aton("224.0.1.130", &iaddr); /* alternate PTP domain 1 */
+       addr.sin_addr = iaddr;
+       imr.imr_multiaddr.s_addr = iaddr.s_addr;
+       imr.imr_interface.s_addr =
+               ((struct sockaddr_in *)&device.ifr_addr)->sin_addr.s_addr;
+       if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_IF,
+                      &imr.imr_interface.s_addr, sizeof(struct in_addr)) < 0)
+               bail("set multicast");
+
+       /* join multicast group, loop our own packet */
+       if (setsockopt(sock, IPPROTO_IP, IP_ADD_MEMBERSHIP,
+                      &imr, sizeof(struct ip_mreq)) < 0)
+               bail("join multicast group");
+
+       if (setsockopt(sock, IPPROTO_IP, IP_MULTICAST_LOOP,
+                      &ip_multicast_loop, sizeof(enabled)) < 0) {
+               bail("loop multicast");
+       }
+
+       /* set socket options for time stamping */
+       if (so_timestamp &&
+               setsockopt(sock, SOL_SOCKET, SO_TIMESTAMP,
+                          &enabled, sizeof(enabled)) < 0)
+               bail("setsockopt SO_TIMESTAMP");
+
+       if (so_timestampns &&
+               setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPNS,
+                          &enabled, sizeof(enabled)) < 0)
+               bail("setsockopt SO_TIMESTAMPNS");
+
+       if (so_timestamping_flags &&
+               setsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING,
+                          &so_timestamping_flags,
+                          sizeof(so_timestamping_flags)) < 0)
+               bail("setsockopt SO_TIMESTAMPING");
+
+       /* request IP_PKTINFO for debugging purposes */
+       if (setsockopt(sock, SOL_IP, IP_PKTINFO,
+                      &enabled, sizeof(enabled)) < 0)
+               printf("%s: %s\n", "setsockopt IP_PKTINFO", strerror(errno));
+
+       /* verify socket options */
+       len = sizeof(val);
+       if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMP, &val, &len) < 0)
+               printf("%s: %s\n", "getsockopt SO_TIMESTAMP", strerror(errno));
+       else
+               printf("SO_TIMESTAMP %d\n", val);
+
+       if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMPNS, &val, &len) < 0)
+               printf("%s: %s\n", "getsockopt SO_TIMESTAMPNS",
+                      strerror(errno));
+       else
+               printf("SO_TIMESTAMPNS %d\n", val);
+
+       if (getsockopt(sock, SOL_SOCKET, SO_TIMESTAMPING, &val, &len) < 0) {
+               printf("%s: %s\n", "getsockopt SO_TIMESTAMPING",
+                      strerror(errno));
+       } else {
+               printf("SO_TIMESTAMPING %d\n", val);
+               if (val != so_timestamping_flags)
+                       printf("   not the expected value %d\n",
+                              so_timestamping_flags);
+       }
+
+       /* send packets forever every five seconds */
+       gettimeofday(&next, 0);
+       next.tv_sec = (next.tv_sec + 1) / 5 * 5;
+       next.tv_usec = 0;
+       while (1) {
+               struct timeval now;
+               struct timeval delta;
+               long delta_us;
+               int res;
+               fd_set readfs, errorfs;
+
+               gettimeofday(&now, 0);
+               delta_us = (long)(next.tv_sec - now.tv_sec) * 1000000 +
+                       (long)(next.tv_usec - now.tv_usec);
+               if (delta_us > 0) {
+                       /* continue waiting for timeout or data */
+                       delta.tv_sec = delta_us / 1000000;
+                       delta.tv_usec = delta_us % 1000000;
+
+                       FD_ZERO(&readfs);
+                       FD_ZERO(&errorfs);
+                       FD_SET(sock, &readfs);
+                       FD_SET(sock, &errorfs);
+                       printf("%ld.%06ld: select %ldus\n",
+                              (long)now.tv_sec, (long)now.tv_usec,
+                              delta_us);
+                       res = select(sock + 1, &readfs, 0, &errorfs, &delta);
+                       gettimeofday(&now, 0);
+                       printf("%ld.%06ld: select returned: %d, %s\n",
+                              (long)now.tv_sec, (long)now.tv_usec,
+                              res,
+                              res < 0 ? strerror(errno) : "success");
+                       if (res > 0) {
+                               if (FD_ISSET(sock, &readfs))
+                                       printf("ready for reading\n");
+                               if (FD_ISSET(sock, &errorfs))
+                                       printf("has error\n");
+                               recvpacket(sock, 0,
+                                          siocgstamp,
+                                          siocgstampns);
+                               recvpacket(sock, MSG_ERRQUEUE,
+                                          siocgstamp,
+                                          siocgstampns);
+                       }
+               } else {
+                       /* write one packet */
+                       sendpacket(sock,
+                                  (struct sockaddr *)&addr,
+                                  sizeof(addr));
+                       next.tv_sec += 5;
+                       continue;
+               }
+       }
+
+       return 0;
+}
index 7fa4b27574b5f54aabb1c9839e61fcf9f053c0ad..edb7ae19e868a2166c8c93e977a0d4064e95dfc2 100644 (file)
@@ -56,6 +56,12 @@ Properties:
     hardware.
   - fsl,magic-packet : If present, indicates that the hardware supports
     waking up via magic packet.
+  - bd-stash : If present, indicates that the hardware supports stashing
+    buffer descriptors in the L2.
+  - rx-stash-len : Denotes the number of bytes of a received buffer to stash
+    in the L2.
+  - rx-stash-idx : Denotes the index of the first byte from the received
+    buffer to stash in the L2.
 
 Example:
        ethernet@24000 {
index cde23b4a12a19a9306464ec1296cb4fee19eb9c0..5731c67abc558f4ac91d9f54d78bf88cacb8dad6 100644 (file)
@@ -78,12 +78,10 @@ to view your kernel log and look for "mmiotrace has lost events" warning. If
 events were lost, the trace is incomplete. You should enlarge the buffers and
 try again. Buffers are enlarged by first seeing how large the current buffers
 are:
-$ cat /debug/tracing/trace_entries
+$ cat /debug/tracing/buffer_size_kb
 gives you a number. Approximately double this number and write it back, for
 instance:
-$ echo 0 > /debug/tracing/tracing_enabled
-$ echo 128000 > /debug/tracing/trace_entries
-$ echo 1 > /debug/tracing/tracing_enabled
+$ echo 128000 > /debug/tracing/buffer_size_kb
 Then start again from the top.
 
 If you are doing a trace for a driver project, e.g. Nouveau, you should also
index 474ec0c5327208687148276d4008d28027075026..59fd2d1d94a772a6262669ff8947b35b4bbd0f7a 100644 (file)
@@ -692,6 +692,13 @@ M: kernel@wantstofly.org
 L:     linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
 S:     Maintained
 
+ARM/NUVOTON W90X900 ARM ARCHITECTURE
+P:      Wan ZongShun
+M:      mcuos.com@gmail.com
+L:      linux-arm-kernel@lists.arm.linux.org.uk (subscribers-only)
+W:      http://www.mcuos.com
+S:      Maintained
+
 ARPD SUPPORT
 P:     Jonathan Layes
 L:     netdev@vger.kernel.org
@@ -911,7 +918,7 @@ S:  Maintained
 BLACKFIN ARCHITECTURE
 P:     Bryan Wu
 M:     cooloney@kernel.org
-L:     uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
+L:     uclinux-dist-devel@blackfin.uclinux.org
 W:     http://blackfin.uclinux.org
 S:     Supported
 
@@ -1021,6 +1028,14 @@ M:       mb@bu3sch.de
 W:     http://bu3sch.de/btgpio.php
 S:     Maintained
 
+BTRFS FILE SYSTEM
+P:     Chris Mason
+M:     chris.mason@oracle.com
+L:     linux-btrfs@vger.kernel.org
+W:     http://btrfs.wiki.kernel.org/
+T:     git kernel.org:/pub/scm/linux/kernel/git/mason/btrfs-unstable.git
+S:     Maintained
+
 BTTV VIDEO4LINUX DRIVER
 P:     Mauro Carvalho Chehab
 M:     mchehab@infradead.org
@@ -1194,6 +1209,8 @@ S:        Supported
 CONTROL GROUPS (CGROUPS)
 P:     Paul Menage
 M:     menage@google.com
+P:     Li Zefan
+M:     lizf@cn.fujitsu.com
 L:     containers@lists.linux-foundation.org
 S:     Maintained
 
@@ -1895,10 +1912,10 @@ W:      http://gigaset307x.sourceforge.net/
 S:     Maintained
 
 HARD DRIVE ACTIVE PROTECTION SYSTEM (HDAPS) DRIVER
-P:     Robert Love
-M:     rlove@rlove.org
-M:     linux-kernel@vger.kernel.org
-W:     http://www.kernel.org/pub/linux/kernel/people/rml/hdaps/
+P:     Frank Seidel
+M:     frank@f-seidel.de
+L:     lm-sensors@lm-sensors.org
+W:     http://www.kernel.org/pub/linux/kernel/people/fseidel/hdaps/
 S:     Maintained
 
 GSPCA FINEPIX SUBDRIVER
@@ -1991,7 +2008,7 @@ S:        Maintained
 
 HIBERNATION (aka Software Suspend, aka swsusp)
 P:     Pavel Machek
-M:     pavel@suse.cz
+M:     pavel@ucw.cz
 P:     Rafael J. Wysocki
 M:     rjw@sisk.pl
 L:     linux-pm@lists.linux-foundation.org
@@ -2212,7 +2229,7 @@ P:        Sean Hefty
 M:     sean.hefty@intel.com
 P:     Hal Rosenstock
 M:     hal.rosenstock@gmail.com
-L:     general@lists.openfabrics.org
+L:     general@lists.openfabrics.org (moderated for non-subscribers)
 W:     http://www.openib.org/
 T:     git kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
 S:     Supported
@@ -3317,8 +3334,8 @@ P:        Jeremy Fitzhardinge
 M:     jeremy@xensource.com
 P:     Chris Wright
 M:     chrisw@sous-sol.org
-P:     Zachary Amsden
-M:     zach@vmware.com
+P:     Alok Kataria
+M:     akataria@vmware.com
 P:     Rusty Russell
 M:     rusty@rustcorp.com.au
 L:     virtualization@lists.osdl.org
@@ -3529,6 +3546,12 @@ S:       Maintained
 PXA MMCI DRIVER
 S:     Orphan
 
+PXA RTC DRIVER
+P:     Robert Jarzmik
+M:     robert.jarzmik@free.fr
+L:     rtc-linux@googlegroups.com
+S:     Maintained
+
 QLOGIC QLA2XXX FC-SCSI DRIVER
 P:     Andrew Vasquez
 M:     linux-driver@qlogic.com
@@ -4156,7 +4179,7 @@ SUSPEND TO RAM
 P:     Len Brown
 M:     len.brown@intel.com
 P:     Pavel Machek
-M:     pavel@suse.cz
+M:     pavel@ucw.cz
 P:     Rafael J. Wysocki
 M:     rjw@sisk.pl
 L:     linux-pm@lists.linux-foundation.org
@@ -4277,8 +4300,8 @@ P:        Rajiv Andrade
 M:     srajiv@linux.vnet.ibm.com
 W:     http://tpmdd.sourceforge.net
 P:     Marcel Selhorst
-M:     tpm@selhorst.net
-W:     http://www.prosec.rub.de/tpm/
+M:     m.selhorst@sirrix.com
+W:     http://www.sirrix.com
 L:     tpmdd-devel@lists.sourceforge.net (moderated for non-subscribers)
 S:     Maintained
 
@@ -4841,6 +4864,7 @@ P:        Ingo Molnar
 M:     mingo@redhat.com
 P:     H. Peter Anvin
 M:     hpa@zytor.com
+M:     x86@kernel.org
 L:     linux-kernel@vger.kernel.org
 T:     git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-x86.git
 S:     Maintained
@@ -4907,11 +4931,11 @@ L:      zd1211-devs@lists.sourceforge.net (subscribers-only)
 S:     Maintained
 
 ZR36067 VIDEO FOR LINUX DRIVER
-P:     Ronald Bultje
-M:     rbultje@ronald.bitfreak.net
 L:     mjpeg-users@lists.sourceforge.net
+L:     linux-media@vger.kernel.org
 W:     http://mjpeg.sourceforge.net/driver-zoran/
-S:     Maintained
+T:     Mercurial http://linuxtv.org/hg/v4l-dvb
+S:     Odd Fixes
 
 ZS DECSTATION Z85C30 SERIAL DRIVER
 P:     Maciej W. Rozycki
index 7715b2c14fb48d59fbd05c4bee18d66df2188bc3..df6ce3e8009091b4b6a4e96e131bd1f7adcea74d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 29
-EXTRAVERSION = -rc3
+EXTRAVERSION = -rc6
 NAME = Erotic Pickled Herring
 
 # *DOCUMENTATION*
@@ -389,6 +389,7 @@ PHONY += outputmakefile
 # output directory.
 outputmakefile:
 ifneq ($(KBUILD_SRC),)
+       $(Q)ln -fsn $(srctree) source
        $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkmakefile \
            $(srctree) $(objtree) $(VERSION) $(PATCHLEVEL)
 endif
@@ -946,7 +947,6 @@ ifneq ($(KBUILD_SRC),)
            mkdir -p include2;                                          \
            ln -fsn $(srctree)/include/asm-$(SRCARCH) include2/asm;     \
        fi
-       ln -fsn $(srctree) source
 endif
 
 # prepare2 creates a makefile if using a separate output directory
diff --git a/README b/README
index 90a07658ede14840346eee6610648bcf4ec79997..d6c6c742c1d78aea9f64e4307e36e06a2a0959da 100644 (file)
--- a/README
+++ b/README
@@ -188,7 +188,7 @@ CONFIGURING the kernel:
                           values to random values.
 
    You can find more information on using the Linux kernel config tools
-   in Documentation/kbuild/make-configs.txt.
+   in Documentation/kbuild/kconfig.txt.
 
        NOTES on "make config":
        - having unnecessary drivers will make the kernel bigger, and can
index 7b85b7c93709f9c584b678ff9d2b3f3cb9fd5b0a..1720c8ad86fec780ca054e42ed8baaa21735e899 100644 (file)
@@ -8,12 +8,12 @@
 
 /* ??? Would be nice to use .gprel32 here, but we can't be sure that the
    function loaded the GP, so this could fail in modules.  */
-#define BUG()  {                                                       \
+#define BUG()  do {                                                    \
        __asm__ __volatile__(                                           \
                "call_pal %0  # bugchk\n\t"                             \
                ".long %1\n\t.8byte %2"                                 \
                : : "i"(PAL_bugchk), "i"(__LINE__), "i"(__FILE__));     \
-       for ( ; ; ); }
+       for ( ; ; ); } while (0)
 
 #define HAVE_ARCH_BUG
 #endif
index a1057c2d95e7047e06ab1c9df73392b9f49e8ab6..3641ec1452f49f14f3082e543a93bfa38e3da972 100644 (file)
@@ -62,6 +62,9 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 /* O_NONBLOCK clashes with the bits used for socket types.  Therefore we
  * have to define SOCK_NONBLOCK to a different value here.
  */
index f238370c907d9f4c86ecbed9da7332ccf08908c3..8d0097f10208dad922760de0a72756a55272c722 100644 (file)
@@ -93,8 +93,8 @@ common_shutdown_1(void *generic_ptr)
        if (cpuid != boot_cpuid) {
                flags |= 0x00040000UL; /* "remain halted" */
                *pflags = flags;
-               cpu_clear(cpuid, cpu_present_map);
-               cpu_clear(cpuid, cpu_possible_map);
+               set_cpu_present(cpuid, false);
+               set_cpu_possible(cpuid, false);
                halt();
        }
 #endif
@@ -120,8 +120,8 @@ common_shutdown_1(void *generic_ptr)
 
 #ifdef CONFIG_SMP
        /* Wait for the secondaries to halt. */
-       cpu_clear(boot_cpuid, cpu_present_map);
-       cpu_clear(boot_cpuid, cpu_possible_map);
+       set_cpu_present(boot_cpuid, false);
+       set_cpu_possible(boot_cpuid, false);
        while (cpus_weight(cpu_present_map))
                barrier();
 #endif
index 00f1dc3dfd5f215e5e1068c89c2376afed7f7830..b1fe5674c3a1fb286c3af38559a52009ce054478 100644 (file)
@@ -120,12 +120,12 @@ void __cpuinit
 smp_callin(void)
 {
        int cpuid = hard_smp_processor_id();
-       cpumask_t mask = cpu_online_map;
 
-       if (cpu_test_and_set(cpuid, mask)) {
+       if (cpu_online(cpuid)) {
                printk("??, cpu 0x%x already present??\n", cpuid);
                BUG();
        }
+       set_cpu_online(cpuid, true);
 
        /* Turn on machine checks.  */
        wrmces(7);
@@ -436,8 +436,8 @@ setup_smp(void)
                                ((char *)cpubase + i*hwrpb->processor_size);
                        if ((cpu->flags & 0x1cc) == 0x1cc) {
                                smp_num_probed++;
-                               cpu_set(i, cpu_possible_map);
-                               cpu_set(i, cpu_present_map);
+                               set_cpu_possible(i, true);
+                               set_cpu_present(i, true);
                                cpu->pal_revision = boot_cpu_palrev;
                        }
 
@@ -470,8 +470,8 @@ smp_prepare_cpus(unsigned int max_cpus)
 
        /* Nothing to do on a UP box, or when told not to.  */
        if (smp_num_probed == 1 || max_cpus == 0) {
-               cpu_possible_map = cpumask_of_cpu(boot_cpuid);
-               cpu_present_map = cpumask_of_cpu(boot_cpuid);
+               init_cpu_possible(cpumask_of(boot_cpuid));
+               init_cpu_present(cpumask_of(boot_cpuid));
                printk(KERN_INFO "SMP mode deactivated.\n");
                return;
        }
index e0ee7060f9aadf607f8830bda764f4df66f16b96..98e2f3de4bc5819420c7f538fdfd2937a682e692 100644 (file)
@@ -608,7 +608,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
 # Watchdog Device Drivers
 #
 # CONFIG_SOFT_WATCHDOG is not set
-CONFIG_AT91SAM9_WATCHDOG=y
+CONFIG_AT91SAM9X_WATCHDOG=y
 
 #
 # USB-based Watchdog Cards
index 01d1ef97d8be0e4ed395a9f87653f5269cb2c4f6..149456142392b84d2a12d9cdd92b08d0595175c3 100644 (file)
@@ -700,7 +700,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
 # Watchdog Device Drivers
 #
 # CONFIG_SOFT_WATCHDOG is not set
-CONFIG_AT91SAM9_WATCHDOG=y
+CONFIG_AT91SAM9X_WATCHDOG=y
 
 #
 # USB-based Watchdog Cards
index 036a126725c16ad5b284442591e1154f3628bb44..21599f3c6275bc98fafe4331490cc17e853fef92 100644 (file)
@@ -710,7 +710,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
 # Watchdog Device Drivers
 #
 # CONFIG_SOFT_WATCHDOG is not set
-CONFIG_AT91SAM9_WATCHDOG=y
+CONFIG_AT91SAM9X_WATCHDOG=y
 
 #
 # USB-based Watchdog Cards
index 237a2a6a8517b17583b8dd01009f27594ba0b534..e2df81a3e804199da7b3701924df98db70ede1a8 100644 (file)
@@ -606,7 +606,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
 # Watchdog Device Drivers
 #
 # CONFIG_SOFT_WATCHDOG is not set
-CONFIG_AT91SAM9_WATCHDOG=y
+CONFIG_AT91SAM9X_WATCHDOG=y
 
 #
 # Sonics Silicon Backplane
index cd1d717903ac5dec800e566f0bf7a6bf6bdb5a22..9b32d0eb89bac0a93e09000f1ab2897ecc10b5bd 100644 (file)
@@ -727,7 +727,7 @@ CONFIG_WATCHDOG_NOWAYOUT=y
 # Watchdog Device Drivers
 #
 # CONFIG_SOFT_WATCHDOG is not set
-# CONFIG_AT91SAM9_WATCHDOG is not set
+# CONFIG_AT91SAM9X_WATCHDOG is not set
 
 #
 # USB-based Watchdog Cards
index 6817be9573a6bf65d29ef5092a4a869017cf87bc..537de4e0ef50657ff4d855443043ca73e33ec689 100644 (file)
@@ -54,4 +54,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_SOCKET_H */
index 84849098c8e8139da19ae6b8d8fecd089539ee30..d4a0da1e48f40988bb7f92ce34664d86adb74a32 100644 (file)
@@ -74,9 +74,9 @@ EXPORT_SYMBOL(elf_set_personality);
  */
 int arm_elf_read_implies_exec(const struct elf32_hdr *x, int executable_stack)
 {
-       if (executable_stack != EXSTACK_ENABLE_X)
+       if (executable_stack != EXSTACK_DISABLE_X)
                return 1;
-       if (cpu_architecture() <= CPU_ARCH_ARMv6)
+       if (cpu_architecture() < CPU_ARCH_ARMv6)
                return 1;
        return 0;
 }
index 77b047475539b9683ef9671caf738adf8ad22a9a..85040cfeb5e515d303afaa7e6025b16e604cda84 100644 (file)
@@ -650,6 +650,7 @@ ENTRY(fp_enter)
 no_fp: mov     pc, lr
 
 __und_usr_unknown:
+       enable_irq
        mov     r0, sp
        adr     lr, ret_from_exception
        b       do_undefinstr
index 06269ea375c52f392f3d45eb94254cc3be7e2bb3..49a6ba926c2bc346bcde289d7948ad4521bf985d 100644 (file)
@@ -136,7 +136,7 @@ ENTRY(mcount)
        ldmia sp!, {r0-r3, pc}
 
 trace:
-       ldr r1, [fp, #-4]
+       ldr r1, [fp, #-4]                       @ lr of instrumented routine
        mov r0, lr
        sub r0, r0, #MCOUNT_INSN_SIZE
        mov lr, pc
index 7141cee1fab71e8b131d03e0d8e6dbfc043dbb85..363db186cb93334791588db5b2158e6f295c5c54 100644 (file)
@@ -101,7 +101,7 @@ unlock:
 /* Handle bad interrupts */
 static struct irq_desc bad_irq_desc = {
        .handle_irq = handle_bad_irq,
-       .lock = SPIN_LOCK_UNLOCKED
+       .lock = __SPIN_LOCK_UNLOCKED(bad_irq_desc.lock),
 };
 
 /*
index 440dc62cdc3a137ef0cdf554918c7a348d63511d..598ca61e7bca8496a853128a433dc7d1dfba0edf 100644 (file)
@@ -13,8 +13,8 @@
 #include <asm/cacheflush.h>
 #include <asm/mach-types.h>
 
-const extern unsigned char relocate_new_kernel[];
-const extern unsigned int relocate_new_kernel_size;
+extern const unsigned char relocate_new_kernel[];
+extern const unsigned int relocate_new_kernel_size;
 
 extern void setup_mm_for_reboot(char mode);
 
index 9eca2209cde630dd656491ef5c964461f2c8b5b2..412aa49ad2fb432ca1e98fa7876f3d78234eb16b 100644 (file)
@@ -697,7 +697,7 @@ static void __init at91_add_device_rtt(void)
  *  Watchdog
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
 static struct platform_device at91cap9_wdt_device = {
        .name           = "at91_wdt",
        .id             = -1,
index fdde1ea21b0729738ade6357b728a634ff505fc6..d74c9ac007e75c1d91642d711c7ef19c93b320e1 100644 (file)
@@ -643,7 +643,7 @@ static void __init at91_add_device_rtt(void)
  *  Watchdog
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
 static struct platform_device at91sam9260_wdt_device = {
        .name           = "at91_wdt",
        .id             = -1,
index 17289756f80ffe8c5eb6d34bd561ea2fe119a0f5..59fc48311fb07d11760382e85e5ff386986a93f6 100644 (file)
@@ -621,7 +621,7 @@ static void __init at91_add_device_rtt(void)
  *  Watchdog
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
 static struct platform_device at91sam9261_wdt_device = {
        .name           = "at91_wdt",
        .id             = -1,
index b753cb879d8e6ae5ee7621492709fae1895eaebd..134af97ff3403f1c309b4b6c962665c860fa796d 100644 (file)
@@ -854,7 +854,7 @@ static void __init at91_add_device_rtt(void)
  *  Watchdog
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
 static struct platform_device at91sam9263_wdt_device = {
        .name           = "at91_wdt",
        .id             = -1,
index 145324f4ec5671fca146f160196dc54b5cd0cfb6..728186515cdf2a2b3db5a99fce5564336be92218 100644 (file)
@@ -609,7 +609,7 @@ static void __init at91_add_device_rtt(void)
  *  Watchdog
  * -------------------------------------------------------------------- */
 
-#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
+#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
 static struct platform_device at91sam9rl_wdt_device = {
        .name           = "at91_wdt",
        .id             = -1,
index 9b0447c3d59b15443539c44eb1cb3a23dedd3a3b..2f7d4977dce95b3c43c575d2696b30888af5e187 100644 (file)
@@ -490,7 +490,8 @@ postcore_initcall(at91_gpio_debugfs_init);
 
 /*--------------------------------------------------------------------------*/
 
-/* This lock class tells lockdep that GPIO irqs are in a different
+/*
+ * This lock class tells lockdep that GPIO irqs are in a different
  * category than their parents, so it won't report false recursion.
  */
 static struct lock_class_key gpio_lock_class;
@@ -509,9 +510,6 @@ void __init at91_gpio_irq_setup(void)
                unsigned        id = this->id;
                unsigned        i;
 
-               /* enable PIO controller's clock */
-               clk_enable(this->clock);
-
                __raw_writel(~0, this->regbase + PIO_IDR);
 
                for (i = 0, pin = this->chipbase; i < 32; i++, pin++) {
@@ -556,7 +554,14 @@ void __init at91_gpio_init(struct at91_gpio_bank *data, int nr_banks)
                data->chipbase = PIN_BASE + i * 32;
                data->regbase = data->offset + (void __iomem *)AT91_VA_BASE_SYS;
 
-               /* AT91SAM9263_ID_PIOCDE groups PIOC, PIOD, PIOE */
+               /* enable PIO controller's clock */
+               clk_enable(data->clock);
+
+               /*
+                * Some processors share peripheral ID between multiple GPIO banks.
+                *  SAM9263 (PIOC, PIOD, PIOE)
+                *  CAP9 (PIOA, PIOB, PIOC, PIOD)
+                */
                if (last && last->id == data->id)
                        last->next = data;
        }
index fb51f0e0a83fb933b718c80960a46cd60b831ce8..0b3ae21b4565abb471fbedd59c15c96a3e4450f5 100644 (file)
@@ -93,6 +93,7 @@ struct atmel_nand_data {
        u8              enable_pin;     /* chip enable */
        u8              det_pin;        /* card detect */
        u8              rdy_pin;        /* ready/busy */
+       u8              rdy_pin_active_low;     /* rdy_pin value is inverted */
        u8              ale;            /* address line number connected to ALE */
        u8              cle;            /* address line number connected to CLE */
        u8              bus_width_16;   /* buswidth is 16 bit */
diff --git a/arch/arm/mach-ep93xx/include/mach/gesbc9312.h b/arch/arm/mach-ep93xx/include/mach/gesbc9312.h
deleted file mode 100644 (file)
index 21fe2b9..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/*
- * arch/arm/mach-ep93xx/include/mach/gesbc9312.h
- */
index 529807d182bf2c28a8b47350dec7c2eb942cb12d..2866297310b7c9e38f80a7992921481e7140d00b 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "platform.h"
 
-#include "gesbc9312.h"
 #include "ts72xx.h"
 
 #endif
index efb86b700276bf965c611526e83d8973d20b7a90..06083b23bb446a6743a894afd0c605c5b2932274 100644 (file)
@@ -42,7 +42,7 @@ void __init kirkwood_init_irq(void)
        writel(0, GPIO_EDGE_CAUSE(32));
 
        for (i = IRQ_KIRKWOOD_GPIO_START; i < NR_IRQS; i++) {
-               set_irq_chip(i, &orion_gpio_irq_level_chip);
+               set_irq_chip(i, &orion_gpio_irq_chip);
                set_irq_handler(i, handle_level_irq);
                irq_desc[i].status |= IRQ_LEVEL;
                set_irq_flags(i, IRQF_VALID);
index c2a96e3965a6ccfab9bb15e6e2fd0cf8ef0b3fe0..e61967dde9a1fea73b5181550a1ffe10ebe79bb9 100644 (file)
@@ -27,6 +27,7 @@
 #include <asm/mach/map.h>
 #include <asm/mach/flash.h>
 
+#include <mach/irqs.h>
 #include <mach/board.h>
 #include <mach/msm_iomap.h>
 
index e273418797b41cbaa309469fac12656aff97b986..30b7e4bcdbc7c7523affdb36f4884e819acf0420 100644 (file)
@@ -40,7 +40,7 @@ void __init mv78xx0_init_irq(void)
        writel(0, GPIO_EDGE_CAUSE(0));
 
        for (i = IRQ_MV78XX0_GPIO_START; i < NR_IRQS; i++) {
-               set_irq_chip(i, &orion_gpio_irq_level_chip);
+               set_irq_chip(i, &orion_gpio_irq_chip);
                set_irq_handler(i, handle_level_irq);
                irq_desc[i].status |= IRQ_LEVEL;
                set_irq_flags(i, IRQF_VALID);
index 77382d8b6b2f61a4d0c4a93fb4357ba48220d061..ba5d7c08dc17f16ca741f0913fdf39769431499a 100644 (file)
@@ -181,7 +181,7 @@ void __init omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
                }
                size = OMAP1_MMC_SIZE;
 
-               omap_mmc_add(i, base, size, irq, mmc_data[i]);
+               omap_mmc_add("mmci-omap", i, base, size, irq, mmc_data[i]);
        };
 }
 
index ca7a0cc1707c29779bf3b6d9c279da4d558682c7..575ba31295cf125c676351f4a8e75258a3befa27 100644 (file)
 #define DPS_RSTCT2_PER_EN      (1 << 0)
 #define DSP_RSTCT2_WD_PER_EN   (1 << 1)
 
-struct mcbsp_internal_clk {
-       struct clk clk;
-       struct clk **childs;
-       int n_childs;
-};
-
 #if defined(CONFIG_ARCH_OMAP15XX) || defined(CONFIG_ARCH_OMAP16XX)
-static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
-{
-       const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
-       int i;
-
-       mclk->n_childs = ARRAY_SIZE(clk_names);
-       mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
-                               GFP_KERNEL);
-
-       for (i = 0; i < mclk->n_childs; i++) {
-               /* We fake a platform device to get correct device id */
-               struct platform_device pdev;
-
-               pdev.dev.bus = &platform_bus_type;
-               pdev.id = mclk->clk.id;
-               mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
-               if (IS_ERR(mclk->childs[i]))
-                       printk(KERN_ERR "Could not get clock %s (%d).\n",
-                               clk_names[i], mclk->clk.id);
-       }
-}
-
-static int omap_mcbsp_clk_enable(struct clk *clk)
-{
-       struct mcbsp_internal_clk *mclk = container_of(clk,
-                                       struct mcbsp_internal_clk, clk);
-       int i;
-
-       for (i = 0; i < mclk->n_childs; i++)
-               clk_enable(mclk->childs[i]);
-       return 0;
-}
-
-static void omap_mcbsp_clk_disable(struct clk *clk)
-{
-       struct mcbsp_internal_clk *mclk = container_of(clk,
-                                       struct mcbsp_internal_clk, clk);
-       int i;
-
-       for (i = 0; i < mclk->n_childs; i++)
-               clk_disable(mclk->childs[i]);
-}
-
-static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
-       {
-               .clk = {
-                       .name           = "mcbsp_clk",
-                       .id             = 1,
-                       .enable         = omap_mcbsp_clk_enable,
-                       .disable        = omap_mcbsp_clk_disable,
-               },
-       },
-       {
-               .clk = {
-                       .name           = "mcbsp_clk",
-                       .id             = 3,
-                       .enable         = omap_mcbsp_clk_enable,
-                       .disable        = omap_mcbsp_clk_disable,
-               },
-       },
-};
-
-#define omap_mcbsp_clks_size   ARRAY_SIZE(omap_mcbsp_clks)
-#else
-#define omap_mcbsp_clks_size   0
-static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
-static inline void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
-{ }
+const char *clk_names[] = { "dsp_ck", "api_ck", "dspxor_ck" };
 #endif
 
 static void omap1_mcbsp_request(unsigned int id)
@@ -167,8 +94,9 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
                .rx_irq         = INT_McBSP1RX,
                .tx_irq         = INT_McBSP1TX,
                .ops            = &omap1_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
-               },
+               .clk_names      = clk_names,
+               .num_clks       = 3,
+       },
        {
                .phys_base      = OMAP1510_MCBSP2_BASE,
                .dma_rx_sync    = OMAP_DMA_MCBSP2_RX,
@@ -184,7 +112,8 @@ static struct omap_mcbsp_platform_data omap15xx_mcbsp_pdata[] = {
                .rx_irq         = INT_McBSP3RX,
                .tx_irq         = INT_McBSP3TX,
                .ops            = &omap1_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 3,
        },
 };
 #define OMAP15XX_MCBSP_PDATA_SZ                ARRAY_SIZE(omap15xx_mcbsp_pdata)
@@ -202,7 +131,8 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
                .rx_irq         = INT_McBSP1RX,
                .tx_irq         = INT_McBSP1TX,
                .ops            = &omap1_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 3,
        },
        {
                .phys_base      = OMAP1610_MCBSP2_BASE,
@@ -219,7 +149,8 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
                .rx_irq         = INT_McBSP3RX,
                .tx_irq         = INT_McBSP3TX,
                .ops            = &omap1_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 3,
        },
 };
 #define OMAP16XX_MCBSP_PDATA_SZ                ARRAY_SIZE(omap16xx_mcbsp_pdata)
@@ -230,15 +161,6 @@ static struct omap_mcbsp_platform_data omap16xx_mcbsp_pdata[] = {
 
 int __init omap1_mcbsp_init(void)
 {
-       int i;
-
-       for (i = 0; i < omap_mcbsp_clks_size; i++) {
-               if (cpu_is_omap15xx() || cpu_is_omap16xx()) {
-                       omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
-                       clk_register(&omap_mcbsp_clks[i].clk);
-               }
-       }
-
        if (cpu_is_omap730())
                omap_mcbsp_count = OMAP730_MCBSP_PDATA_SZ;
        if (cpu_is_omap15xx())
index ad721e0cbf7a1ded6c54ab2212efb4a5da1f281e..ce4d46a4a8381d2bd2b0cff19f840ae16ac2c153 100644 (file)
@@ -565,7 +565,7 @@ u32 omap2_clksel_to_divisor(struct clk *clk, u32 field_val)
  *
  * Given a struct clk of a rate-selectable clksel clock, and a clock divisor,
  * find the corresponding register field value.  The return register value is
- * the value before left-shifting.  Returns 0xffffffff on error
+ * the value before left-shifting.  Returns ~0 on error
  */
 u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
 {
@@ -577,7 +577,7 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
 
        clks = omap2_get_clksel_by_parent(clk, clk->parent);
        if (clks == NULL)
-               return 0;
+               return ~0;
 
        for (clkr = clks->rates; clkr->div; clkr++) {
                if ((clkr->flags & cpu_mask) && (clkr->div == div))
@@ -588,7 +588,7 @@ u32 omap2_divisor_to_clksel(struct clk *clk, u32 div)
                printk(KERN_ERR "clock: Could not find divisor %d for "
                       "clock %s parent %s\n", div, clk->name,
                       clk->parent->name);
-               return 0;
+               return ~0;
        }
 
        return clkr->val;
@@ -708,7 +708,7 @@ static u32 omap2_clksel_get_src_field(void __iomem **src_addr,
                return 0;
 
        for (clkr = clks->rates; clkr->div; clkr++) {
-               if (clkr->flags & (cpu_mask | DEFAULT_RATE))
+               if (clkr->flags & cpu_mask && clkr->flags & DEFAULT_RATE)
                        break; /* Found the default rate for this platform */
        }
 
@@ -746,7 +746,7 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
                return -EINVAL;
 
        if (clk->usecount > 0)
-               _omap2_clk_disable(clk);
+               omap2_clk_disable(clk);
 
        /* Set new source value (previous dividers if any in effect) */
        reg_val = __raw_readl(src_addr) & ~field_mask;
@@ -759,11 +759,11 @@ int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
                wmb();
        }
 
-       if (clk->usecount > 0)
-               _omap2_clk_enable(clk);
-
        clk->parent = new_parent;
 
+       if (clk->usecount > 0)
+               omap2_clk_enable(clk);
+
        /* CLKSEL clocks follow their parents' rates, divided by a divisor */
        clk->rate = new_parent->rate;
 
index 9d7216ff6c9f58d4d5ffbb4a85a3bfc4f764c74e..ce03fa750775d25d4d715175218354e90a8d2567 100644 (file)
@@ -421,6 +421,7 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                        int nr_controllers)
 {
        int i;
+       char *name;
 
        for (i = 0; i < nr_controllers; i++) {
                unsigned long base, size;
@@ -450,12 +451,14 @@ void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                        continue;
                }
 
-               if (cpu_is_omap2420())
+               if (cpu_is_omap2420()) {
                        size = OMAP2420_MMC_SIZE;
-               else
+                       name = "mmci-omap";
+               } else {
                        size = HSMMC_SIZE;
-
-               omap_mmc_add(i, base, size, irq, mmc_data[i]);
+                       name = "mmci-omap-hs";
+               }
+               omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
        };
 }
 
index b0f8e7d627987fd78e991c0fafdae4860f1d15a3..b52a02fc7cd6356abe1c3bd08ba17dc632d8fa18 100644 (file)
@@ -172,9 +172,13 @@ void __init omap34xx_check_revision(void)
                        omap_revision = OMAP3430_REV_ES3_0;
                        rev_name = "ES3.0";
                        break;
+               case 4:
+                       omap_revision = OMAP3430_REV_ES3_1;
+                       rev_name = "ES3.1";
+                       break;
                default:
                        /* Use the latest known revision as default */
-                       omap_revision = OMAP3430_REV_ES3_0;
+                       omap_revision = OMAP3430_REV_ES3_1;
                        rev_name = "Unknown revision\n";
                }
        }
index 636e2821af7da8a9bd76f33bcbfabac5bb5fb0db..9ba20d985dda252f5a38bb54f478d543454e4599 100644 (file)
@@ -134,6 +134,7 @@ static struct irq_chip omap_irq_chip = {
        .ack    = omap_mask_ack_irq,
        .mask   = omap_mask_irq,
        .unmask = omap_unmask_irq,
+       .disable = omap_mask_irq,
 };
 
 static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
index e20023c9d15ded6c474bf6d081285767c425607c..a9e631fc1134177de2ee7568380b96cb3157835c 100644 (file)
 #include <mach/cpu.h>
 #include <mach/mcbsp.h>
 
-struct mcbsp_internal_clk {
-       struct clk clk;
-       struct clk **childs;
-       int n_childs;
-};
-
-#if defined(CONFIG_ARCH_OMAP24XX) || defined(CONFIG_ARCH_OMAP34XX)
-static void omap_mcbsp_clk_init(struct mcbsp_internal_clk *mclk)
-{
-       const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" };
-       int i;
-
-       mclk->n_childs = ARRAY_SIZE(clk_names);
-       mclk->childs = kzalloc(mclk->n_childs * sizeof(struct clk *),
-                               GFP_KERNEL);
-
-       for (i = 0; i < mclk->n_childs; i++) {
-               /* We fake a platform device to get correct device id */
-               struct platform_device pdev;
-
-               pdev.dev.bus = &platform_bus_type;
-               pdev.id = mclk->clk.id;
-               mclk->childs[i] = clk_get(&pdev.dev, clk_names[i]);
-               if (IS_ERR(mclk->childs[i]))
-                       printk(KERN_ERR "Could not get clock %s (%d).\n",
-                               clk_names[i], mclk->clk.id);
-       }
-}
-
-static int omap_mcbsp_clk_enable(struct clk *clk)
-{
-       struct mcbsp_internal_clk *mclk = container_of(clk,
-                                       struct mcbsp_internal_clk, clk);
-       int i;
-
-       for (i = 0; i < mclk->n_childs; i++)
-               clk_enable(mclk->childs[i]);
-       return 0;
-}
-
-static void omap_mcbsp_clk_disable(struct clk *clk)
-{
-       struct mcbsp_internal_clk *mclk = container_of(clk,
-                                       struct mcbsp_internal_clk, clk);
-       int i;
-
-       for (i = 0; i < mclk->n_childs; i++)
-               clk_disable(mclk->childs[i]);
-}
-
-static struct mcbsp_internal_clk omap_mcbsp_clks[] = {
-       {
-               .clk = {
-                       .name           = "mcbsp_clk",
-                       .id             = 1,
-                       .enable         = omap_mcbsp_clk_enable,
-                       .disable        = omap_mcbsp_clk_disable,
-               },
-       },
-       {
-               .clk = {
-                       .name           = "mcbsp_clk",
-                       .id             = 2,
-                       .enable         = omap_mcbsp_clk_enable,
-                       .disable        = omap_mcbsp_clk_disable,
-               },
-       },
-       {
-               .clk = {
-                       .name           = "mcbsp_clk",
-                       .id             = 3,
-                       .enable         = omap_mcbsp_clk_enable,
-                       .disable        = omap_mcbsp_clk_disable,
-               },
-       },
-       {
-               .clk = {
-                       .name           = "mcbsp_clk",
-                       .id             = 4,
-                       .enable         = omap_mcbsp_clk_enable,
-                       .disable        = omap_mcbsp_clk_disable,
-               },
-       },
-       {
-               .clk = {
-                       .name           = "mcbsp_clk",
-                       .id             = 5,
-                       .enable         = omap_mcbsp_clk_enable,
-                       .disable        = omap_mcbsp_clk_disable,
-               },
-       },
-};
-
-#define omap_mcbsp_clks_size   ARRAY_SIZE(omap_mcbsp_clks)
-#else
-#define omap_mcbsp_clks_size   0
-static struct mcbsp_internal_clk __initdata *omap_mcbsp_clks;
-static inline void omap_mcbsp_clk_init(struct clk *clk)
-{ }
-#endif
+const char *clk_names[] = { "mcbsp_ick", "mcbsp_fck" };
 
 static void omap2_mcbsp2_mux_setup(void)
 {
@@ -156,7 +57,8 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP1_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP1_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP24XX_MCBSP2_BASE,
@@ -165,7 +67,8 @@ static struct omap_mcbsp_platform_data omap2420_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP2_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP2_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
 };
 #define OMAP2420_MCBSP_PDATA_SZ                ARRAY_SIZE(omap2420_mcbsp_pdata)
@@ -183,7 +86,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP1_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP1_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP24XX_MCBSP2_BASE,
@@ -192,7 +96,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP2_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP2_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP2430_MCBSP3_BASE,
@@ -201,7 +106,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP3_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP3_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP2430_MCBSP4_BASE,
@@ -210,7 +116,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP4_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP4_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP2430_MCBSP5_BASE,
@@ -219,7 +126,8 @@ static struct omap_mcbsp_platform_data omap2430_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP5_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP5_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
 };
 #define OMAP2430_MCBSP_PDATA_SZ                ARRAY_SIZE(omap2430_mcbsp_pdata)
@@ -237,7 +145,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP1_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP1_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP34XX_MCBSP2_BASE,
@@ -246,7 +155,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP2_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP2_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP34XX_MCBSP3_BASE,
@@ -255,7 +165,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP3_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP3_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP34XX_MCBSP4_BASE,
@@ -264,7 +175,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP4_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP4_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
        {
                .phys_base      = OMAP34XX_MCBSP5_BASE,
@@ -273,7 +185,8 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
                .rx_irq         = INT_24XX_MCBSP5_IRQ_RX,
                .tx_irq         = INT_24XX_MCBSP5_IRQ_TX,
                .ops            = &omap2_mcbsp_ops,
-               .clk_name       = "mcbsp_clk",
+               .clk_names      = clk_names,
+               .num_clks       = 2,
        },
 };
 #define OMAP34XX_MCBSP_PDATA_SZ                ARRAY_SIZE(omap34xx_mcbsp_pdata)
@@ -284,14 +197,6 @@ static struct omap_mcbsp_platform_data omap34xx_mcbsp_pdata[] = {
 
 static int __init omap2_mcbsp_init(void)
 {
-       int i;
-
-       for (i = 0; i < omap_mcbsp_clks_size; i++) {
-               /* Once we call clk_get inside init, we do not register it */
-               omap_mcbsp_clk_init(&omap_mcbsp_clks[i]);
-               clk_register(&omap_mcbsp_clks[i].clk);
-       }
-
        if (cpu_is_omap2420())
                omap_mcbsp_count = OMAP2420_MCBSP_PDATA_SZ;
        if (cpu_is_omap2430())
index 43336b93b21c0398494c19a925c88f24a37c709a..bf9e96105e111edb4705bdc1d8d342bd05bd6b52 100644 (file)
@@ -93,9 +93,8 @@ ENTRY(omap24xx_cpu_suspend)
        orr     r4, r4, #0x40           @ enable self refresh on idle req
        mov     r5, #0x2000             @ set delay (DPLL relock + DLL relock)
        str     r4, [r2]                @ make it so
-       mov     r2, #0
        nop
-       mcr     p15, 0, r2, c7, c0, 4   @ wait for interrupt
+       mcr     p15, 0, r3, c7, c0, 4   @ wait for interrupt
        nop
 loop:
        subs    r5, r5, #0x1            @ awake, wait just a bit
index ae6036300f603521ce2b59267fee71d5f668e589..9fc13a2cc3f4ed8031e78b40a3ada44993a78911 100644 (file)
@@ -118,7 +118,8 @@ static void __init omap2_gp_clockevent_init(void)
        clockevent_gpt.max_delta_ns =
                clockevent_delta2ns(0xffffffff, &clockevent_gpt);
        clockevent_gpt.min_delta_ns =
-               clockevent_delta2ns(1, &clockevent_gpt);
+               clockevent_delta2ns(3, &clockevent_gpt);
+               /* Timer internal resynch latency. */
 
        clockevent_gpt.cpumask = cpumask_of(0);
        clockevents_register_device(&clockevent_gpt);
index 0caae43301e54e472d82187680ed69fca4feda72..e03f7b45cb0d114ad0b0e343d424ba1122b03472 100644 (file)
@@ -44,7 +44,7 @@ void __init orion5x_init_irq(void)
         * User can use set_type() if he wants to use edge types handlers.
         */
        for (i = IRQ_ORION5X_GPIO_START; i < NR_IRQS; i++) {
-               set_irq_chip(i, &orion_gpio_irq_level_chip);
+               set_irq_chip(i, &orion_gpio_irq_chip);
                set_irq_handler(i, handle_level_irq);
                irq_desc[i].status |= IRQ_LEVEL;
                set_irq_flags(i, IRQF_VALID);
index b1514fb20d3a6b829ccfbab0388a3fb59a7d26a0..7de17fc5d54b2b219975d2ed90faa4615b648eac 100644 (file)
@@ -121,20 +121,22 @@ int __init pxa_init_dma(int num_ch)
        if (dma_channels == NULL)
                return -ENOMEM;
 
-       ret = request_irq(IRQ_DMA, dma_irq_handler, IRQF_DISABLED, "DMA", NULL);
-       if (ret) {
-               printk (KERN_CRIT "Wow!  Can't register IRQ for DMA\n");
-               kfree(dma_channels);
-               return ret;
-       }
-
        /* dma channel priorities on pxa2xx processors:
         * ch 0 - 3,  16 - 19  <--> (0) DMA_PRIO_HIGH
         * ch 4 - 7,  20 - 23  <--> (1) DMA_PRIO_MEDIUM
         * ch 8 - 15, 24 - 31  <--> (2) DMA_PRIO_LOW
         */
-       for (i = 0; i < num_ch; i++)
+       for (i = 0; i < num_ch; i++) {
+               DCSR(i) = 0;
                dma_channels[i].prio = min((i & 0xf) >> 2, DMA_PRIO_LOW);
+       }
+
+       ret = request_irq(IRQ_DMA, dma_irq_handler, IRQF_DISABLED, "DMA", NULL);
+       if (ret) {
+               printk (KERN_CRIT "Wow!  Can't register IRQ for DMA\n");
+               kfree(dma_channels);
+               return ret;
+       }
 
        num_dma_channels = num_ch;
        return 0;
index e41b9d202b8cff06c5569c3b5da6c9189e88a0df..b8d14bd9ae593e42d1921b3f349846872204aaae 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __ASM_ARCH_REGS_AC97_H
 #define __ASM_ARCH_REGS_AC97_H
 
+#include <mach/hardware.h>
+
 /*
  * AC97 Controller registers
  */
index 3c04cde2cf1f9f1b9fb97cad1c355fd0d0b17329..cf31986f6f05d1b0f8637e020c4fd421e97e03fd 100644 (file)
@@ -41,6 +41,9 @@
 #elif defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
 #define SSCR0_SCR      (0x000fff00)    /* Serial Clock Rate (mask) */
 #define SSCR0_SerClkDiv(x) (((x) - 1) << 8) /* Divisor [1..4096] */
+#endif
+
+#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
 #define SSCR0_EDSS     (1 << 20)       /* Extended data size select */
 #define SSCR0_NCS      (1 << 21)       /* Network clock select */
 #define SSCR0_RIM      (1 << 22)       /* Receive FIFO overrrun interrupt mask */
index f735e58e666997c7c92cd985d812ba6197ea7f76..83fb609b6eb71bef6efc3769cd0f99a1c7634bd1 100644 (file)
@@ -88,13 +88,13 @@ static struct pxa3xx_mfp_addr_map pxa310_mfp_addr_map[] __initdata = {
 static DEFINE_PXA3_CKEN(common_nand, NAND, 156000000, 0);
 
 static struct clk_lookup common_clkregs[] = {
-       INIT_CLKREG(&clk_common_nand, "pxa3xx-nand", "NANDCLK"),
+       INIT_CLKREG(&clk_common_nand, "pxa3xx-nand", NULL),
 };
 
 static DEFINE_PXA3_CKEN(pxa310_mmc3, MMC3, 19500000, 0);
 
 static struct clk_lookup pxa310_clkregs[] = {
-       INIT_CLKREG(&clk_pxa310_mmc3, "pxa2xx-mci.2", "MMCCLK"),
+       INIT_CLKREG(&clk_pxa310_mmc3, "pxa2xx-mci.2", NULL),
 };
 
 static int __init pxa300_init(void)
index effe408c186f24b648a02ef5114df14e91e91780..36f066196fa204ed6d2fce528178943c4bfd6f83 100644 (file)
@@ -83,7 +83,7 @@ static struct pxa3xx_mfp_addr_map pxa320_mfp_addr_map[] __initdata = {
 static DEFINE_PXA3_CKEN(pxa320_nand, NAND, 104000000, 0);
 
 static struct clk_lookup pxa320_clkregs[] = {
-       INIT_CLKREG(&clk_pxa320_nand, "pxa3xx-nand", "NANDCLK"),
+       INIT_CLKREG(&clk_pxa320_nand, "pxa3xx-nand", NULL),
 };
 
 static int __init pxa320_init(void)
index c1fbd5b5f9c459fa772df1295a337b365bd49e88..23cfdd5939541d82be5f1670ce19ddd9f5bf224e 100644 (file)
@@ -289,7 +289,7 @@ static struct platform_device sa11x0pcmcia_device = {
 };
 
 static struct platform_device sa11x0mtd_device = {
-       .name           = "flash",
+       .name           = "sa1100-mtd",
        .id             = -1,
 };
 
index 81d0b8772de33c47b108a7246967adde0d380251..bc0099d5ae85c022d12a051062915fa1bae6aefb 100644 (file)
@@ -66,7 +66,10 @@ static int adjust_pte(struct vm_area_struct *vma, unsigned long address)
         * fault (ie, is old), we can safely ignore any issues.
         */
        if (ret && (pte_val(entry) & L_PTE_MT_MASK) != shared_pte_mask) {
-               flush_cache_page(vma, address, pte_pfn(entry));
+               unsigned long pfn = pte_pfn(entry);
+               flush_cache_page(vma, address, pfn);
+               outer_flush_range((pfn << PAGE_SHIFT),
+                                 (pfn << PAGE_SHIFT) + PAGE_SIZE);
                pte_val(entry) &= ~L_PTE_MT_MASK;
                pte_val(entry) |= shared_pte_mask;
                set_pte_at(vma->vm_mm, address, pte, entry);
index 9b36c5cb5e9f68306c017cf63f94ab55ccc1ce3f..d4d082c5c2d4ad2be9f1eb331cce837fff3de325 100644 (file)
@@ -693,7 +693,8 @@ static void __init sanity_check_meminfo(void)
                 * Check whether this memory bank would entirely overlap
                 * the vmalloc area.
                 */
-               if (__va(bank->start) >= VMALLOC_MIN) {
+               if (__va(bank->start) >= VMALLOC_MIN ||
+                   __va(bank->start) < PAGE_OFFSET) {
                        printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
                               "(vmalloc region overlap).\n",
                               bank->start, bank->start + bank->size - 1);
index ac15c23fd5da840e5816e6223b3456d60b24c0c6..208dbb121f477e11d2eb4d79601633f379bcc313 100644 (file)
@@ -200,14 +200,15 @@ void omap_mcbsp_register_board_cfg(struct omap_mcbsp_platform_data *config,
 /*
  * Register MMC devices. Called from mach-omap1 and mach-omap2 device init.
  */
-int __init omap_mmc_add(int id, unsigned long base, unsigned long size,
-               unsigned int irq, struct omap_mmc_platform_data *data)
+int __init omap_mmc_add(const char *name, int id, unsigned long base,
+                               unsigned long size, unsigned int irq,
+                               struct omap_mmc_platform_data *data)
 {
        struct platform_device *pdev;
        struct resource res[OMAP_MMC_NR_RES];
        int ret;
 
-       pdev = platform_device_alloc("mmci-omap", id);
+       pdev = platform_device_alloc(name, id);
        if (!pdev)
                return -ENOMEM;
 
index e77373c39f8c8a3ac76cab7b4f5c336a02ecd947..47ec77af4ccbe3a66e6071dce829797152806c1e 100644 (file)
@@ -709,6 +709,7 @@ int omap_request_dma(int dev_id, const char *dev_name,
        chan->dev_name = dev_name;
        chan->callback = callback;
        chan->data = data;
+       chan->flags = 0;
 
 #ifndef CONFIG_ARCH_OMAP1
        if (cpu_class_is_omap2()) {
@@ -1888,11 +1889,11 @@ static int omap2_dma_handle_ch(int ch)
                status = dma_read(CSR(ch));
        }
 
+       dma_write(status, CSR(ch));
+
        if (likely(dma_chan[ch].callback != NULL))
                dma_chan[ch].callback(ch, status, dma_chan[ch].data);
 
-       dma_write(status, CSR(ch));
-
        return 0;
 }
 
index b2062f1175de0c73196e05ee1ceaae4e68725da5..a8e1178a946877e73df2f52f978c22cf79a30786 100644 (file)
@@ -339,6 +339,7 @@ IS_OMAP_TYPE(3430, 0x3430)
 #define OMAP3430_REV_ES2_0     0x34301034
 #define OMAP3430_REV_ES2_1     0x34302034
 #define OMAP3430_REV_ES3_0     0x34303034
+#define OMAP3430_REV_ES3_1     0x34304034
 
 /*
  * omap_chip bits
index eef873db3d48f54f420da4b2840cf717b58b9aae..113c2466c86a7d789fa5316118dfa4fc2a02941b 100644 (file)
@@ -344,7 +344,8 @@ struct omap_mcbsp_platform_data {
        u8 dma_rx_sync, dma_tx_sync;
        u16 rx_irq, tx_irq;
        struct omap_mcbsp_ops *ops;
-       char const *clk_name;
+       char const **clk_names;
+       int num_clks;
 };
 
 struct omap_mcbsp {
@@ -376,7 +377,8 @@ struct omap_mcbsp {
        /* Protect the field .free, while checking if the mcbsp is in use */
        spinlock_t lock;
        struct omap_mcbsp_platform_data *pdata;
-       struct clk *clk;
+       struct clk **clks;
+       int num_clks;
 };
 extern struct omap_mcbsp **mcbsp_ptr;
 extern int omap_mcbsp_count;
index 031250f028050b4e95bb805194ba36484b6e4229..73a9e15031b18e1c022ec372c5f04b8a97e49f69 100644 (file)
@@ -115,8 +115,9 @@ void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
                                int nr_controllers);
 void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                                int nr_controllers);
-int omap_mmc_add(int id, unsigned long base, unsigned long size,
-                       unsigned int irq, struct omap_mmc_platform_data *data);
+int omap_mmc_add(const char *name, int id, unsigned long base,
+                               unsigned long size, unsigned int irq,
+                               struct omap_mmc_platform_data *data);
 #else
 static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
                                int nr_controllers)
@@ -126,8 +127,9 @@ static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
                                int nr_controllers)
 {
 }
-static inline int omap_mmc_add(int id, unsigned long base, unsigned long size,
-               unsigned int irq, struct omap_mmc_platform_data *data)
+static inline int omap_mmc_add(const char *name, int id, unsigned long base,
+                               unsigned long size, unsigned int irq,
+                               struct omap_mmc_platform_data *data)
 {
        return 0;
 }
index f2401a831f991f3f2a27a1705ae32c14190b9bbc..e5842e30e534485b6a1c5faa11bbd9ce2de94272 100644 (file)
@@ -214,6 +214,7 @@ EXPORT_SYMBOL(omap_mcbsp_set_io_type);
 int omap_mcbsp_request(unsigned int id)
 {
        struct omap_mcbsp *mcbsp;
+       int i;
        int err;
 
        if (!omap_mcbsp_check_valid_id(id)) {
@@ -225,7 +226,8 @@ int omap_mcbsp_request(unsigned int id)
        if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->request)
                mcbsp->pdata->ops->request(id);
 
-       clk_enable(mcbsp->clk);
+       for (i = 0; i < mcbsp->num_clks; i++)
+               clk_enable(mcbsp->clks[i]);
 
        spin_lock(&mcbsp->lock);
        if (!mcbsp->free) {
@@ -276,6 +278,7 @@ EXPORT_SYMBOL(omap_mcbsp_request);
 void omap_mcbsp_free(unsigned int id)
 {
        struct omap_mcbsp *mcbsp;
+       int i;
 
        if (!omap_mcbsp_check_valid_id(id)) {
                printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
@@ -286,7 +289,8 @@ void omap_mcbsp_free(unsigned int id)
        if (mcbsp->pdata && mcbsp->pdata->ops && mcbsp->pdata->ops->free)
                mcbsp->pdata->ops->free(id);
 
-       clk_disable(mcbsp->clk);
+       for (i = mcbsp->num_clks - 1; i >= 0; i--)
+               clk_disable(mcbsp->clks[i]);
 
        spin_lock(&mcbsp->lock);
        if (mcbsp->free) {
@@ -872,6 +876,7 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
        struct omap_mcbsp_platform_data *pdata = pdev->dev.platform_data;
        struct omap_mcbsp *mcbsp;
        int id = pdev->id - 1;
+       int i;
        int ret = 0;
 
        if (!pdata) {
@@ -916,14 +921,25 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
        mcbsp->dma_rx_sync = pdata->dma_rx_sync;
        mcbsp->dma_tx_sync = pdata->dma_tx_sync;
 
-       if (pdata->clk_name)
-               mcbsp->clk = clk_get(&pdev->dev, pdata->clk_name);
-       if (IS_ERR(mcbsp->clk)) {
-               dev_err(&pdev->dev,
-                       "Invalid clock configuration for McBSP%d.\n",
-                       mcbsp->id);
-               ret = PTR_ERR(mcbsp->clk);
-               goto err_clk;
+       if (pdata->num_clks) {
+               mcbsp->num_clks = pdata->num_clks;
+               mcbsp->clks = kzalloc(mcbsp->num_clks * sizeof(struct clk *),
+                                       GFP_KERNEL);
+               if (!mcbsp->clks) {
+                       ret = -ENOMEM;
+                       goto exit;
+               }
+               for (i = 0; i < mcbsp->num_clks; i++) {
+                       mcbsp->clks[i] = clk_get(&pdev->dev, pdata->clk_names[i]);
+                       if (IS_ERR(mcbsp->clks[i])) {
+                               dev_err(&pdev->dev,
+                                       "Invalid %s configuration for McBSP%d.\n",
+                                       pdata->clk_names[i], mcbsp->id);
+                               ret = PTR_ERR(mcbsp->clks[i]);
+                               goto err_clk;
+                       }
+               }
+
        }
 
        mcbsp->pdata = pdata;
@@ -932,6 +948,9 @@ static int __devinit omap_mcbsp_probe(struct platform_device *pdev)
        return 0;
 
 err_clk:
+       while (i--)
+               clk_put(mcbsp->clks[i]);
+       kfree(mcbsp->clks);
        iounmap(mcbsp->io_base);
 err_ioremap:
        mcbsp->free = 0;
@@ -942,6 +961,7 @@ exit:
 static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
 {
        struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
+       int i;
 
        platform_set_drvdata(pdev, NULL);
        if (mcbsp) {
@@ -950,12 +970,18 @@ static int __devexit omap_mcbsp_remove(struct platform_device *pdev)
                                mcbsp->pdata->ops->free)
                        mcbsp->pdata->ops->free(mcbsp->id);
 
-               clk_disable(mcbsp->clk);
-               clk_put(mcbsp->clk);
+               for (i = mcbsp->num_clks - 1; i >= 0; i--) {
+                       clk_disable(mcbsp->clks[i]);
+                       clk_put(mcbsp->clks[i]);
+               }
 
                iounmap(mcbsp->io_base);
 
-               mcbsp->clk = NULL;
+               if (mcbsp->num_clks) {
+                       kfree(mcbsp->clks);
+                       mcbsp->clks = NULL;
+                       mcbsp->num_clks = 0;
+               }
                mcbsp->free = 0;
                mcbsp->dev = NULL;
        }
index 967186425ca1073ecea837206ebe22c081335693..0d12c21647663d5191167569354bd3af1d7d84b5 100644 (file)
@@ -265,51 +265,36 @@ EXPORT_SYMBOL(orion_gpio_set_blink);
  *        polarity    LEVEL          mask
  *
  ****************************************************************************/
-static void gpio_irq_edge_ack(u32 irq)
-{
-       int pin = irq_to_gpio(irq);
-
-       writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin));
-}
-
-static void gpio_irq_edge_mask(u32 irq)
-{
-       int pin = irq_to_gpio(irq);
-       u32 u;
-
-       u = readl(GPIO_EDGE_MASK(pin));
-       u &= ~(1 << (pin & 31));
-       writel(u, GPIO_EDGE_MASK(pin));
-}
 
-static void gpio_irq_edge_unmask(u32 irq)
+static void gpio_irq_ack(u32 irq)
 {
-       int pin = irq_to_gpio(irq);
-       u32 u;
-
-       u = readl(GPIO_EDGE_MASK(pin));
-       u |= 1 << (pin & 31);
-       writel(u, GPIO_EDGE_MASK(pin));
+       int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK;
+       if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
+               int pin = irq_to_gpio(irq);
+               writel(~(1 << (pin & 31)), GPIO_EDGE_CAUSE(pin));
+       }
 }
 
-static void gpio_irq_level_mask(u32 irq)
+static void gpio_irq_mask(u32 irq)
 {
        int pin = irq_to_gpio(irq);
-       u32 u;
-
-       u = readl(GPIO_LEVEL_MASK(pin));
+       int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK;
+       u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ?
+               GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin);
+       u32 u = readl(reg);
        u &= ~(1 << (pin & 31));
-       writel(u, GPIO_LEVEL_MASK(pin));
+       writel(u, reg);
 }
 
-static void gpio_irq_level_unmask(u32 irq)
+static void gpio_irq_unmask(u32 irq)
 {
        int pin = irq_to_gpio(irq);
-       u32 u;
-
-       u = readl(GPIO_LEVEL_MASK(pin));
+       int type = irq_desc[irq].status & IRQ_TYPE_SENSE_MASK;
+       u32 reg = (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) ?
+               GPIO_EDGE_MASK(pin) : GPIO_LEVEL_MASK(pin);
+       u32 u = readl(reg);
        u |= 1 << (pin & 31);
-       writel(u, GPIO_LEVEL_MASK(pin));
+       writel(u, reg);
 }
 
 static int gpio_irq_set_type(u32 irq, u32 type)
@@ -331,9 +316,9 @@ static int gpio_irq_set_type(u32 irq, u32 type)
         * Set edge/level type.
         */
        if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING)) {
-               desc->chip = &orion_gpio_irq_edge_chip;
+               desc->handle_irq = handle_edge_irq;
        } else if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
-               desc->chip = &orion_gpio_irq_level_chip;
+               desc->handle_irq = handle_level_irq;
        } else {
                printk(KERN_ERR "failed to set irq=%d (type=%d)\n", irq, type);
                return -EINVAL;
@@ -371,19 +356,11 @@ static int gpio_irq_set_type(u32 irq, u32 type)
        return 0;
 }
 
-struct irq_chip orion_gpio_irq_edge_chip = {
-       .name           = "orion_gpio_irq_edge",
-       .ack            = gpio_irq_edge_ack,
-       .mask           = gpio_irq_edge_mask,
-       .unmask         = gpio_irq_edge_unmask,
-       .set_type       = gpio_irq_set_type,
-};
-
-struct irq_chip orion_gpio_irq_level_chip = {
-       .name           = "orion_gpio_irq_level",
-       .mask           = gpio_irq_level_mask,
-       .mask_ack       = gpio_irq_level_mask,
-       .unmask         = gpio_irq_level_unmask,
+struct irq_chip orion_gpio_irq_chip = {
+       .name           = "orion_gpio",
+       .ack            = gpio_irq_ack,
+       .mask           = gpio_irq_mask,
+       .unmask         = gpio_irq_unmask,
        .set_type       = gpio_irq_set_type,
 };
 
index 54deaf274b5268a6983dae399f8285f4e4a92ea6..ec743e82c876cab82abd00a9c415c265258feea9 100644 (file)
@@ -31,8 +31,7 @@ void orion_gpio_set_blink(unsigned pin, int blink);
 /*
  * GPIO interrupt handling.
  */
-extern struct irq_chip orion_gpio_irq_edge_chip;
-extern struct irq_chip orion_gpio_irq_level_chip;
+extern struct irq_chip orion_gpio_irq_chip;
 void orion_gpio_irq_handler(int irqoff);
 
 
index 35863f260929abe002d57f154c3d5749b2ce1d69..04c8606197007b9003d650e100ff4ff54ba8bd2b 100644 (file)
@@ -54,4 +54,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* __ASM_AVR32_SOCKET_H */
index aafaf7a78886951ed50017c6d414e6b5758cff05..cff8e84f78f21b64e580034a999cefc48d7536b1 100644 (file)
@@ -116,6 +116,7 @@ struct atmel_nand_data {
        int     enable_pin;     /* chip enable */
        int     det_pin;        /* card detect */
        int     rdy_pin;        /* ready/busy */
+       u8      rdy_pin_active_low;     /* rdy_pin value is inverted */
        u8      ale;            /* address line number connected to ALE */
        u8      cle;            /* address line number connected to CLE */
        u8      bus_width_16;   /* buswidth is 16 bit */
index a949c4fbbddd4cb428c5cd21fd9a9557db9a5eb4..8f1f97d56e1ecfec191b185350e7f374cd0df00b 100644 (file)
@@ -169,26 +169,51 @@ config BF542
        help
          BF542 Processor Support.
 
+config BF542M
+       bool "BF542m"
+       help
+         BF542 Processor Support.
+
 config BF544
        bool "BF544"
        help
          BF544 Processor Support.
 
+config BF544M
+       bool "BF544m"
+       help
+         BF544 Processor Support.
+
 config BF547
        bool "BF547"
        help
          BF547 Processor Support.
 
+config BF547M
+       bool "BF547m"
+       help
+         BF547 Processor Support.
+
 config BF548
        bool "BF548"
        help
          BF548 Processor Support.
 
+config BF548M
+       bool "BF548m"
+       help
+         BF548 Processor Support.
+
 config BF549
        bool "BF549"
        help
          BF549 Processor Support.
 
+config BF549M
+       bool "BF549m"
+       help
+         BF549 Processor Support.
+
 config BF561
        bool "BF561"
        help
@@ -224,39 +249,39 @@ config TICK_SOURCE_SYSTMR0
 
 config BF_REV_MIN
        int
-       default 0 if (BF51x || BF52x || BF54x)
+       default 0 if (BF51x || BF52x || (BF54x && !BF54xM))
        default 2 if (BF537 || BF536 || BF534)
-       default 3 if (BF561 ||BF533 || BF532 || BF531)
+       default 3 if (BF561 || BF533 || BF532 || BF531 || BF54xM)
        default 4 if (BF538 || BF539)
 
 config BF_REV_MAX
        int
-       default 2 if (BF51x || BF52x || BF54x)
-       default 3 if (BF537 || BF536 || BF534)
+       default 2 if (BF51x || BF52x || (BF54x && !BF54xM))
+       default 3 if (BF537 || BF536 || BF534 || BF54xM)
        default 5 if (BF561 || BF538 || BF539)
        default 6 if (BF533 || BF532 || BF531)
 
 choice
        prompt "Silicon Rev"
-       default BF_REV_0_1 if (BF51x || BF52x || BF54x)
+       default BF_REV_0_1 if (BF51x || BF52x || (BF54x && !BF54xM))
        default BF_REV_0_2 if (BF534 || BF536 || BF537)
-       default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF561)
+       default BF_REV_0_3 if (BF531 || BF532 || BF533 || BF54xM || BF561)
 
 config BF_REV_0_0
        bool "0.0"
-       depends on (BF51x || BF52x || BF54x)
+       depends on (BF51x || BF52x || (BF54x && !BF54xM))
 
 config BF_REV_0_1
        bool "0.1"
-       depends on (BF52x || BF54x)
+       depends on (BF52x || (BF54x && !BF54xM))
 
 config BF_REV_0_2
        bool "0.2"
-       depends on (BF52x || BF537 || BF536 || BF534 || BF54x)
+       depends on (BF52x || BF537 || BF536 || BF534 || (BF54x && !BF54xM))
 
 config BF_REV_0_3
        bool "0.3"
-       depends on (BF561 || BF537 || BF536 || BF534 || BF533 || BF532 || BF531)
+       depends on (BF54xM || BF561 || BF537 || BF536 || BF534 || BF533 || BF532 || BF531)
 
 config BF_REV_0_4
        bool "0.4"
@@ -293,9 +318,14 @@ config BF53x
        depends on (BF531 || BF532 || BF533 || BF534 || BF536 || BF537)
        default y
 
+config BF54xM
+       bool
+       depends on (BF542M || BF544M || BF547M || BF548M || BF549M)
+       default y
+
 config BF54x
        bool
-       depends on (BF542 || BF544 || BF547 || BF548 || BF549)
+       depends on (BF542 || BF544 || BF547 || BF548 || BF549 || BF54xM)
        default y
 
 config MEM_GENERIC_BOARD
index e550c8d460669ed2c96e0b97ec4c13ee2edb2f81..d54c8283825c429c3573209f1343259c6baaac95 100644 (file)
@@ -21,57 +21,67 @@ KALLSYMS         += --symbol-prefix=_
 KBUILD_DEFCONFIG := BF537-STAMP_defconfig
 
 # setup the machine name and the machine dependent settings
-machine-$(CONFIG_BF512) := bf518
-machine-$(CONFIG_BF514) := bf518
-machine-$(CONFIG_BF516) := bf518
-machine-$(CONFIG_BF518) := bf518
-machine-$(CONFIG_BF522) := bf527
-machine-$(CONFIG_BF523) := bf527
-machine-$(CONFIG_BF524) := bf527
-machine-$(CONFIG_BF525) := bf527
-machine-$(CONFIG_BF526) := bf527
-machine-$(CONFIG_BF527) := bf527
-machine-$(CONFIG_BF531) := bf533
-machine-$(CONFIG_BF532) := bf533
-machine-$(CONFIG_BF533) := bf533
-machine-$(CONFIG_BF534) := bf537
-machine-$(CONFIG_BF536) := bf537
-machine-$(CONFIG_BF537) := bf537
-machine-$(CONFIG_BF538) := bf538
-machine-$(CONFIG_BF539) := bf538
-machine-$(CONFIG_BF542) := bf548
-machine-$(CONFIG_BF544) := bf548
-machine-$(CONFIG_BF547) := bf548
-machine-$(CONFIG_BF548) := bf548
-machine-$(CONFIG_BF549) := bf548
-machine-$(CONFIG_BF561) := bf561
+machine-$(CONFIG_BF512)  := bf518
+machine-$(CONFIG_BF514)  := bf518
+machine-$(CONFIG_BF516)  := bf518
+machine-$(CONFIG_BF518)  := bf518
+machine-$(CONFIG_BF522)  := bf527
+machine-$(CONFIG_BF523)  := bf527
+machine-$(CONFIG_BF524)  := bf527
+machine-$(CONFIG_BF525)  := bf527
+machine-$(CONFIG_BF526)  := bf527
+machine-$(CONFIG_BF527)  := bf527
+machine-$(CONFIG_BF531)  := bf533
+machine-$(CONFIG_BF532)  := bf533
+machine-$(CONFIG_BF533)  := bf533
+machine-$(CONFIG_BF534)  := bf537
+machine-$(CONFIG_BF536)  := bf537
+machine-$(CONFIG_BF537)  := bf537
+machine-$(CONFIG_BF538)  := bf538
+machine-$(CONFIG_BF539)  := bf538
+machine-$(CONFIG_BF542)  := bf548
+machine-$(CONFIG_BF542M) := bf548
+machine-$(CONFIG_BF544)  := bf548
+machine-$(CONFIG_BF544M) := bf548
+machine-$(CONFIG_BF547)  := bf548
+machine-$(CONFIG_BF547M) := bf548
+machine-$(CONFIG_BF548)  := bf548
+machine-$(CONFIG_BF548M) := bf548
+machine-$(CONFIG_BF549)  := bf548
+machine-$(CONFIG_BF549M) := bf548
+machine-$(CONFIG_BF561)  := bf561
 MACHINE := $(machine-y)
 export MACHINE
 
-cpu-$(CONFIG_BF512) := bf512
-cpu-$(CONFIG_BF514) := bf514
-cpu-$(CONFIG_BF516) := bf516
-cpu-$(CONFIG_BF518) := bf518
-cpu-$(CONFIG_BF522) := bf522
-cpu-$(CONFIG_BF523) := bf523
-cpu-$(CONFIG_BF524) := bf524
-cpu-$(CONFIG_BF525) := bf525
-cpu-$(CONFIG_BF526) := bf526
-cpu-$(CONFIG_BF527) := bf527
-cpu-$(CONFIG_BF531) := bf531
-cpu-$(CONFIG_BF532) := bf532
-cpu-$(CONFIG_BF533) := bf533
-cpu-$(CONFIG_BF534) := bf534
-cpu-$(CONFIG_BF536) := bf536
-cpu-$(CONFIG_BF537) := bf537
-cpu-$(CONFIG_BF538) := bf538
-cpu-$(CONFIG_BF539) := bf539
-cpu-$(CONFIG_BF542) := bf542
-cpu-$(CONFIG_BF544) := bf544
-cpu-$(CONFIG_BF547) := bf547
-cpu-$(CONFIG_BF548) := bf548
-cpu-$(CONFIG_BF549) := bf549
-cpu-$(CONFIG_BF561) := bf561
+cpu-$(CONFIG_BF512)  := bf512
+cpu-$(CONFIG_BF514)  := bf514
+cpu-$(CONFIG_BF516)  := bf516
+cpu-$(CONFIG_BF518)  := bf518
+cpu-$(CONFIG_BF522)  := bf522
+cpu-$(CONFIG_BF523)  := bf523
+cpu-$(CONFIG_BF524)  := bf524
+cpu-$(CONFIG_BF525)  := bf525
+cpu-$(CONFIG_BF526)  := bf526
+cpu-$(CONFIG_BF527)  := bf527
+cpu-$(CONFIG_BF531)  := bf531
+cpu-$(CONFIG_BF532)  := bf532
+cpu-$(CONFIG_BF533)  := bf533
+cpu-$(CONFIG_BF534)  := bf534
+cpu-$(CONFIG_BF536)  := bf536
+cpu-$(CONFIG_BF537)  := bf537
+cpu-$(CONFIG_BF538)  := bf538
+cpu-$(CONFIG_BF539)  := bf539
+cpu-$(CONFIG_BF542)  := bf542
+cpu-$(CONFIG_BF542M) := bf542m
+cpu-$(CONFIG_BF544)  := bf544
+cpu-$(CONFIG_BF544M) := bf544m
+cpu-$(CONFIG_BF547)  := bf547
+cpu-$(CONFIG_BF547M) := bf547m
+cpu-$(CONFIG_BF548)  := bf548
+cpu-$(CONFIG_BF548M) := bf548m
+cpu-$(CONFIG_BF549)  := bf549
+cpu-$(CONFIG_BF549M) := bf549m
+cpu-$(CONFIG_BF561)  := bf561
 
 rev-$(CONFIG_BF_REV_0_0)  := 0.0
 rev-$(CONFIG_BF_REV_0_1)  := 0.1
index defb9785c65b961d893ced60ad668c7d07f216d8..4fdb9e04759f779abdcfaa6d6ee2e932a7e41ca7 100644 (file)
@@ -1,6 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.28-rc2
+# Fri Jan  9 17:58:41 2009
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
@@ -149,6 +150,7 @@ CONFIG_BF_REV_0_0=y
 # CONFIG_BF_REV_ANY is not set
 # CONFIG_BF_REV_NONE is not set
 CONFIG_BF51x=y
+CONFIG_MEM_MT48LC32M8A2_75=y
 CONFIG_BFIN518F_EZBRD=y
 
 #
@@ -598,7 +600,10 @@ CONFIG_PHYLIB=y
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
-# CONFIG_BFIN_MAC is not set
+CONFIG_BFIN_MAC=y
+CONFIG_BFIN_TX_DESC_NUM=10
+CONFIG_BFIN_RX_DESC_NUM=20
+# CONFIG_BFIN_MAC_RMII is not set
 # CONFIG_SMC91X is not set
 # CONFIG_SMSC911X is not set
 # CONFIG_DM9000 is not set
@@ -679,7 +684,7 @@ CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 992424ff31538f3b8449e9ba9738373a23545352..8e2b855b8db7825aafceb95711c57b7acc81f785 100644 (file)
@@ -723,7 +723,7 @@ CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 21e3c1af55bad24649f02cb4863434b5bd5f0a53..833128b3972496931aaa2028751bfaab52d8ba2b 100644 (file)
@@ -767,7 +767,7 @@ CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 0bdf20a1af6134a777a6fb6b549b126eabe8d387..334c94b51c402fb11af7e25be76d9b27f40f1c99 100644 (file)
@@ -672,7 +672,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 2f747d6e97e2dec3064cea3e5e763c898ffcc5a6..9d733436e3009ed0e8fbdb0eeb53a1a051156bd2 100644 (file)
@@ -679,7 +679,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 8b0a81294e652000d9ad251869a08975fd52a501..4fb4108d310322fbc9b82dc0e02d51a5fc461d67 100644 (file)
@@ -722,7 +722,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index a1f766bf7d9b9243fd038c12a6e71597f5fa853f..cb32f5624a1b5b859bfbd23ed0f352fa99030a71 100644 (file)
@@ -726,7 +726,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index cd2da6b7692c73c04dd969245c83287f568ce9c8..0f8697618aa5605f29e52774e7db0d3bde4fb37a 100644 (file)
@@ -856,7 +856,7 @@ CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 # CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index b398ca202dbd8b44f0d4aa3a5986fce579bc82ce..042c7adfccfa994e42baba76eed0a56c081be836 100644 (file)
@@ -709,7 +709,7 @@ CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
-# CONFIG_BFIN_JTAG_COMM is not set
+CONFIG_BFIN_JTAG_COMM=m
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
index 95146948166f4a259800abbb6142673352b8a2d3..865ed85a5760e4ce27ac4d848c074fe8865dca6a 100644 (file)
@@ -1,7 +1,6 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.24.7
-# Fri Jul 18 18:00:41 2008
+# Linux kernel version: 2.6.28
 #
 # CONFIG_MMU is not set
 # CONFIG_FPU is not set
@@ -9,7 +8,6 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
 CONFIG_BLACKFIN=y
 CONFIG_ZONE_DMA=y
-CONFIG_SEMAPHORE_SLEEPERS=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_HARDIRQS=y
@@ -32,18 +30,16 @@ CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_USER_NS is not set
-# CONFIG_PID_NS is not set
 # CONFIG_AUDIT is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_CGROUPS is not set
-CONFIG_FAIR_GROUP_SCHED=y
-CONFIG_FAIR_USER_SCHED=y
-# CONFIG_FAIR_CGROUP_SCHED is not set
-# CONFIG_SYSFS_DEPRECATED is not set
+# CONFIG_GROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -52,26 +48,35 @@ CONFIG_EMBEDDED=y
 CONFIG_UID16=y
 CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
 CONFIG_HOTPLUG=y
 CONFIG_PRINTK=y
 CONFIG_BUG=y
 # CONFIG_ELF_CORE is not set
+CONFIG_COMPAT_BRK=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
 CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
 CONFIG_EVENTFD=y
+CONFIG_AIO=y
 CONFIG_VM_EVENT_COUNTERS=y
 CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+# CONFIG_MARKERS is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
 CONFIG_TINY_SHMEM=y
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
@@ -82,6 +87,7 @@ CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
 # CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
 
 #
 # IO Schedulers
@@ -95,9 +101,11 @@ CONFIG_IOSCHED_CFQ=y
 CONFIG_DEFAULT_CFQ=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="cfq"
+CONFIG_CLASSIC_RCU=y
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
+# CONFIG_FREEZER is not set
 
 #
 # Blackfin Processor Options
@@ -106,6 +114,10 @@ CONFIG_PREEMPT_VOLUNTARY=y
 #
 # Processor and Board Settings
 #
+# CONFIG_BF512 is not set
+# CONFIG_BF514 is not set
+# CONFIG_BF516 is not set
+# CONFIG_BF518 is not set
 # CONFIG_BF522 is not set
 # CONFIG_BF523 is not set
 # CONFIG_BF524 is not set
@@ -118,48 +130,32 @@ CONFIG_BF527=y
 # CONFIG_BF534 is not set
 # CONFIG_BF536 is not set
 # CONFIG_BF537 is not set
+# CONFIG_BF538 is not set
+# CONFIG_BF539 is not set
 # CONFIG_BF542 is not set
+# CONFIG_BF542M is not set
 # CONFIG_BF544 is not set
+# CONFIG_BF544M is not set
 # CONFIG_BF547 is not set
+# CONFIG_BF547M is not set
 # CONFIG_BF548 is not set
+# CONFIG_BF548M is not set
 # CONFIG_BF549 is not set
+# CONFIG_BF549M is not set
 # CONFIG_BF561 is not set
+CONFIG_BF_REV_MIN=0
+CONFIG_BF_REV_MAX=2
 # CONFIG_BF_REV_0_0 is not set
 CONFIG_BF_REV_0_1=y
 # CONFIG_BF_REV_0_2 is not set
 # CONFIG_BF_REV_0_3 is not set
 # CONFIG_BF_REV_0_4 is not set
 # CONFIG_BF_REV_0_5 is not set
+# CONFIG_BF_REV_0_6 is not set
 # CONFIG_BF_REV_ANY is not set
 # CONFIG_BF_REV_NONE is not set
 CONFIG_BF52x=y
 CONFIG_MEM_MT48LC16M16A2TG_75=y
-# CONFIG_BFIN527_EZKIT is not set
-CONFIG_BFIN527_BLUETECHNIX_CM=y
-
-#
-# BF527 Specific Configuration
-#
-
-#
-# Alternative Multiplexing Scheme
-#
-# CONFIG_BF527_SPORT0_PORTF is not set
-CONFIG_BF527_SPORT0_PORTG=y
-CONFIG_BF527_SPORT0_TSCLK_PG10=y
-# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
-CONFIG_BF527_UART1_PORTF=y
-# CONFIG_BF527_UART1_PORTG is not set
-# CONFIG_BF527_NAND_D_PORTF is not set
-CONFIG_BF527_NAND_D_PORTH=y
-
-#
-# Interrupt Priority Assignment
-#
-
-#
-# Priority
-#
 CONFIG_IRQ_PLL_WAKEUP=7
 CONFIG_IRQ_DMA0_ERROR=7
 CONFIG_IRQ_DMAR0_BLK=7
@@ -179,7 +175,6 @@ CONFIG_IRQ_SPORT0_TX=9
 CONFIG_IRQ_SPORT1_RX=9
 CONFIG_IRQ_SPORT1_TX=9
 CONFIG_IRQ_TWI=10
-CONFIG_IRQ_SPI=10
 CONFIG_IRQ_UART0_RX=10
 CONFIG_IRQ_UART0_TX=10
 CONFIG_IRQ_UART1_RX=10
@@ -205,6 +200,34 @@ CONFIG_IRQ_MEM_DMA1=13
 CONFIG_IRQ_WATCH=13
 CONFIG_IRQ_PORTF_INTA=13
 CONFIG_IRQ_PORTF_INTB=13
+# CONFIG_BFIN527_EZKIT is not set
+CONFIG_BFIN527_BLUETECHNIX_CM=y
+# CONFIG_BFIN526_EZBRD is not set
+
+#
+# BF527 Specific Configuration
+#
+
+#
+# Alternative Multiplexing Scheme
+#
+# CONFIG_BF527_SPORT0_PORTF is not set
+CONFIG_BF527_SPORT0_PORTG=y
+CONFIG_BF527_SPORT0_TSCLK_PG10=y
+# CONFIG_BF527_SPORT0_TSCLK_PG14 is not set
+CONFIG_BF527_UART1_PORTF=y
+# CONFIG_BF527_UART1_PORTG is not set
+# CONFIG_BF527_NAND_D_PORTF is not set
+CONFIG_BF527_NAND_D_PORTH=y
+
+#
+# Interrupt Priority Assignment
+#
+
+#
+# Priority
+#
+CONFIG_IRQ_SPI=10
 CONFIG_IRQ_SPI_ERROR=7
 CONFIG_IRQ_NFC_ERROR=7
 CONFIG_IRQ_HDMA_ERROR=7
@@ -226,7 +249,6 @@ CONFIG_BOOT_LOAD=0x1000
 #
 CONFIG_CLKIN_HZ=25000000
 # CONFIG_BFIN_KERNEL_CLOCK is not set
-CONFIG_MAX_MEM_SIZE=512
 CONFIG_MAX_VCO_HZ=600000000
 CONFIG_MIN_VCO_HZ=50000000
 CONFIG_MAX_SCLK_HZ=133333333
@@ -240,10 +262,10 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
 CONFIG_GENERIC_TIME=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 # CONFIG_CYCLES_CLOCKSOURCE is not set
-# CONFIG_TICK_ONESHOT is not set
 # CONFIG_NO_HZ is not set
 # CONFIG_HIGH_RES_TIMERS is not set
 CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -277,6 +299,12 @@ CONFIG_ACCESS_OK_L1=y
 CONFIG_CACHELINE_ALIGNED_L1=y
 # CONFIG_SYSCALL_TAB_L1 is not set
 # CONFIG_CPLB_SWITCH_TAB_L1 is not set
+CONFIG_APP_STACK_L1=y
+
+#
+# Speed Optimizations
+#
+CONFIG_BFIN_INS_LOWOVERHEAD=y
 CONFIG_RAMKERNEL=y
 # CONFIG_ROMKERNEL is not set
 CONFIG_SELECT_MEMORY_MODEL=y
@@ -285,10 +313,10 @@ CONFIG_FLATMEM_MANUAL=y
 # CONFIG_SPARSEMEM_MANUAL is not set
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
-# CONFIG_SPARSEMEM_VMEMMAP_ENABLE is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+# CONFIG_PHYS_ADDR_T_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_VIRT_TO_BUS=y
 CONFIG_BFIN_GPTIMERS=y
@@ -334,7 +362,6 @@ CONFIG_BANK_3=0xFFC0
 #
 # Bus options (PCI, PCMCIA, EISA, MCA, ISA)
 #
-# CONFIG_PCI is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCCARD is not set
 
@@ -345,25 +372,20 @@ CONFIG_BINFMT_ELF_FDPIC=y
 CONFIG_BINFMT_FLAT=y
 CONFIG_BINFMT_ZFLAT=y
 # CONFIG_BINFMT_SHARED_FLAT is not set
+# CONFIG_HAVE_AOUT is not set
 # CONFIG_BINFMT_MISC is not set
 
 #
 # Power management options
 #
 # CONFIG_PM is not set
-CONFIG_SUSPEND_UP_POSSIBLE=y
-# CONFIG_PM_BFIN_SLEEP_DEEPER is not set
-# CONFIG_PM_BFIN_SLEEP is not set
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
 # CONFIG_PM_WAKEUP_BY_GPIO is not set
 
 #
 # CPU Frequency scaling
 #
 # CONFIG_CPU_FREQ is not set
-
-#
-# Networking
-#
 CONFIG_NET=y
 
 #
@@ -376,6 +398,7 @@ CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
 # CONFIG_XFRM_SUB_POLICY is not set
 # CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
@@ -405,8 +428,6 @@ CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
 # CONFIG_NETLABEL is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
@@ -415,6 +436,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
 # CONFIG_VLAN_8021Q is not set
 # CONFIG_DECNET is not set
 # CONFIG_LLC2 is not set
@@ -431,14 +453,14 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 #
 # CONFIG_NET_PKTGEN is not set
 # CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
 # CONFIG_AF_RXRPC is not set
-
-#
-# Wireless
-#
+# CONFIG_PHONET is not set
+CONFIG_WIRELESS=y
 # CONFIG_CFG80211 is not set
+CONFIG_WIRELESS_OLD_REGULATORY=y
 # CONFIG_WIRELESS_EXT is not set
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
@@ -456,6 +478,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
 # CONFIG_CONNECTOR is not set
 CONFIG_MTD=y
@@ -464,6 +488,7 @@ CONFIG_MTD=y
 CONFIG_MTD_PARTITIONS=y
 # CONFIG_MTD_REDBOOT_PARTS is not set
 # CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AR7_PARTS is not set
 
 #
 # User Modules And Translation Layers
@@ -507,6 +532,7 @@ CONFIG_MTD_ROM=m
 #
 CONFIG_MTD_COMPLEX_MAPPINGS=y
 # CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_GPIO_ADDR is not set
 # CONFIG_MTD_UCLINUX is not set
 # CONFIG_MTD_PLATRAM is not set
 
@@ -542,10 +568,12 @@ CONFIG_BLK_DEV=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
-CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
+# CONFIG_BLK_DEV_XIP is not set
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
 # CONFIG_MISC_DEVICES is not set
+CONFIG_HAVE_IDE=y
 # CONFIG_IDE is not set
 
 #
@@ -558,7 +586,6 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 CONFIG_NETDEVICES=y
-# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
 # CONFIG_MACVLAN is not set
@@ -579,6 +606,7 @@ CONFIG_PHYLIB=y
 # CONFIG_SMSC_PHY is not set
 # CONFIG_BROADCOM_PHY is not set
 # CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
 # CONFIG_FIXED_PHY is not set
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
@@ -591,11 +619,14 @@ CONFIG_BFIN_MAC_RMII=y
 # CONFIG_SMC91X is not set
 # CONFIG_SMSC911X is not set
 # CONFIG_DM9000 is not set
+# CONFIG_ENC28J60 is not set
 # CONFIG_IBM_NEW_EMAC_ZMII is not set
 # CONFIG_IBM_NEW_EMAC_RGMII is not set
 # CONFIG_IBM_NEW_EMAC_TAH is not set
 # CONFIG_IBM_NEW_EMAC_EMAC4 is not set
-# CONFIG_B44 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
 # CONFIG_NETDEV_1000 is not set
 # CONFIG_NETDEV_10000 is not set
 
@@ -604,6 +635,7 @@ CONFIG_BFIN_MAC_RMII=y
 #
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
 
 #
 # USB Network Adapters
@@ -616,7 +648,6 @@ CONFIG_BFIN_MAC_RMII=y
 # CONFIG_WAN is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
-# CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
@@ -642,14 +673,15 @@ CONFIG_BFIN_MAC_RMII=y
 # CONFIG_BF5xx_PPIFCD is not set
 # CONFIG_BFIN_SIMPLE_TIMER is not set
 # CONFIG_BF5xx_PPI is not set
-CONFIG_BFIN_OTP=y
-# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
+# CONFIG_BF5xx_EPPI is not set
 # CONFIG_BFIN_SPORT is not set
 # CONFIG_BFIN_TIMER_LATENCY is not set
 # CONFIG_TWI_LCD is not set
+CONFIG_BFIN_DMA_INTERFACE=m
 CONFIG_SIMPLE_GPIO=m
 # CONFIG_VT is not set
 # CONFIG_DEVKMEM is not set
+# CONFIG_BFIN_JTAG_COMM is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -673,6 +705,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 # CONFIG_SERIAL_BFIN_SPORT is not set
 CONFIG_UNIX98_PTYS=y
 # CONFIG_LEGACY_PTYS is not set
+CONFIG_BFIN_OTP=y
+# CONFIG_BFIN_OTP_WRITE_ENABLE is not set
 
 #
 # CAN, the car bus and industrial fieldbus
@@ -680,44 +714,49 @@ CONFIG_UNIX98_PTYS=y
 # CONFIG_CAN4LINUX is not set
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_HW_RANDOM is not set
-# CONFIG_GEN_RTC is not set
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_TCG_TPM is not set
 CONFIG_I2C=y
 CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=m
+CONFIG_I2C_HELPER_AUTO=y
 
 #
-# I2C Algorithms
+# I2C Hardware Bus support
 #
-# CONFIG_I2C_ALGOBIT is not set
-# CONFIG_I2C_ALGOPCF is not set
-# CONFIG_I2C_ALGOPCA is not set
 
 #
-# I2C Hardware Bus support
+# I2C system bus drivers (mostly embedded / system-on-chip)
 #
 CONFIG_I2C_BLACKFIN_TWI=m
 CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
 # CONFIG_I2C_GPIO is not set
 # CONFIG_I2C_OCORES is not set
-# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_TAOS_EVM is not set
-# CONFIG_I2C_STUB is not set
 # CONFIG_I2C_TINY_USB is not set
 
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
 #
 # Miscellaneous I2C Chip support
 #
-# CONFIG_SENSORS_DS1337 is not set
-# CONFIG_SENSORS_DS1374 is not set
 # CONFIG_DS1682 is not set
+# CONFIG_AT24 is not set
 # CONFIG_SENSORS_AD5252 is not set
-# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_SENSORS_EEPROM is not set
 # CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_SENSORS_PCF8575 is not set
+# CONFIG_PCF8575 is not set
 # CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_PCF8591 is not set
 # CONFIG_SENSORS_MAX6875 is not set
@@ -726,37 +765,41 @@ CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=100
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
 # CONFIG_I2C_DEBUG_CHIP is not set
-
-#
-# SPI support
-#
 CONFIG_SPI=y
+# CONFIG_SPI_DEBUG is not set
 CONFIG_SPI_MASTER=y
 
 #
 # SPI Master Controller Drivers
 #
 CONFIG_SPI_BFIN=y
+# CONFIG_SPI_BFIN_LOCK is not set
 # CONFIG_SPI_BITBANG is not set
 
 #
 # SPI Protocol Masters
 #
-# CONFIG_EEPROM_AT25 is not set
+# CONFIG_SPI_AT25 is not set
 # CONFIG_SPI_SPIDEV is not set
 # CONFIG_SPI_TLE62X0 is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
 # CONFIG_W1 is not set
 # CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
+# CONFIG_SENSORS_AD7414 is not set
 # CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADCXX is not set
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
 # CONFIG_SENSORS_ADM1029 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7462 is not set
 # CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7473 is not set
 # CONFIG_SENSORS_ATXP1 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_F71805F is not set
@@ -777,6 +820,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_MAX1111 is not set
 # CONFIG_SENSORS_MAX1619 is not set
 # CONFIG_SENSORS_MAX6650 is not set
 # CONFIG_SENSORS_PC87360 is not set
@@ -785,6 +829,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_SMSC47M192 is not set
 # CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_ADS7828 is not set
 # CONFIG_SENSORS_THMC50 is not set
 # CONFIG_SENSORS_VT1211 is not set
 # CONFIG_SENSORS_W83781D is not set
@@ -792,9 +837,12 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83792D is not set
 # CONFIG_SENSORS_W83793 is not set
 # CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
+# CONFIG_THERMAL is not set
+# CONFIG_THERMAL_HWMON is not set
 CONFIG_WATCHDOG=y
 # CONFIG_WATCHDOG_NOWAYOUT is not set
 
@@ -809,22 +857,32 @@ CONFIG_BFIN_WDT=y
 #
 # CONFIG_USBPCWATCHDOG is not set
 
-#
-# Sonics Silicon Backplane
-#
-CONFIG_SSB_POSSIBLE=y
-# CONFIG_SSB is not set
-
 #
 # Multifunction device drivers
 #
+# CONFIG_MFD_CORE is not set
 # CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_REGULATOR is not set
 
 #
 # Multimedia devices
 #
+
+#
+# Multimedia core support
+#
 # CONFIG_VIDEO_DEV is not set
 # CONFIG_DVB_CORE is not set
+# CONFIG_VIDEO_MEDIA is not set
+
+#
+# Multimedia drivers
+#
 # CONFIG_DAB is not set
 
 #
@@ -839,10 +897,6 @@ CONFIG_SSB_POSSIBLE=y
 # Display device support
 #
 # CONFIG_DISPLAY_SUPPORT is not set
-
-#
-# Sound
-#
 # CONFIG_SOUND is not set
 CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
@@ -850,6 +904,7 @@ CONFIG_USB_ARCH_HAS_HCD=y
 # CONFIG_USB_ARCH_HAS_EHCI is not set
 CONFIG_USB=y
 # CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
 
 #
 # Miscellaneous USB options
@@ -860,40 +915,48 @@ CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_OTG is not set
 # CONFIG_USB_OTG_WHITELIST is not set
 CONFIG_USB_OTG_BLACKLIST_HUB=y
+CONFIG_USB_MON=y
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
 
 #
 # USB Host Controller Drivers
 #
+# CONFIG_USB_C67X00_HCD is not set
 # CONFIG_USB_ISP116X_HCD is not set
-# CONFIG_USB_ISP1362_HCD is not set
 # CONFIG_USB_ISP1760_HCD is not set
+# CONFIG_USB_ISP1362_HCD is not set
 # CONFIG_USB_SL811_HCD is not set
 # CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
 CONFIG_USB_MUSB_HDRC=y
 CONFIG_USB_MUSB_SOC=y
 
 #
-# Blackfin high speed USB support
+# Blackfin high speed USB Support
 #
 CONFIG_USB_MUSB_HOST=y
 # CONFIG_USB_MUSB_PERIPHERAL is not set
 # CONFIG_USB_MUSB_OTG is not set
 CONFIG_USB_MUSB_HDRC_HCD=y
 CONFIG_MUSB_PIO_ONLY=y
-CONFIG_USB_MUSB_LOGLEVEL=0
+CONFIG_MUSB_DMA_POLL=y
+# CONFIG_USB_MUSB_DEBUG is not set
 
 #
 # USB Device Class drivers
 #
 # CONFIG_USB_ACM is not set
 # CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
 #
 
 #
-# may also be needed; see USB_STORAGE Help for more information
+# see USB_STORAGE Help for more information
 #
 # CONFIG_USB_LIBUSUAL is not set
 
@@ -901,15 +964,10 @@ CONFIG_USB_MUSB_LOGLEVEL=0
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
-CONFIG_USB_MON=y
 
 #
 # USB port drivers
 #
-
-#
-# USB Serial Converter support
-#
 # CONFIG_USB_SERIAL is not set
 
 #
@@ -918,7 +976,7 @@ CONFIG_USB_MON=y
 # CONFIG_USB_EMI62 is not set
 # CONFIG_USB_EMI26 is not set
 # CONFIG_USB_ADUTUX is not set
-# CONFIG_USB_AUERSWALD is not set
+# CONFIG_USB_SEVSEG is not set
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
@@ -934,17 +992,13 @@ CONFIG_USB_MON=y
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
 # CONFIG_USB_IOWARRIOR is not set
-
-#
-# USB DSL modem support
-#
-
-#
-# USB Gadget Support
-#
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
 # CONFIG_USB_GADGET is not set
 # CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
 CONFIG_RTC_LIB=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_HCTOSYS=y
@@ -973,51 +1027,59 @@ CONFIG_RTC_INTF_DEV=y
 # CONFIG_RTC_DRV_PCF8563 is not set
 # CONFIG_RTC_DRV_PCF8583 is not set
 # CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
 
 #
 # SPI RTC drivers
 #
-# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_M41T94 is not set
+# CONFIG_RTC_DRV_DS1305 is not set
+# CONFIG_RTC_DRV_DS1390 is not set
 # CONFIG_RTC_DRV_MAX6902 is not set
+# CONFIG_RTC_DRV_R9701 is not set
+# CONFIG_RTC_DRV_RS5C348 is not set
+# CONFIG_RTC_DRV_DS3234 is not set
 
 #
 # Platform RTC drivers
 #
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
 # CONFIG_RTC_DRV_DS1553 is not set
-# CONFIG_RTC_DRV_STK17TA8 is not set
 # CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
 # CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
 # CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
 # CONFIG_RTC_DRV_V3020 is not set
 
 #
 # on-CPU RTC drivers
 #
 CONFIG_RTC_DRV_BFIN=y
-
-#
-# Userspace I/O
-#
+# CONFIG_DMADEVICES is not set
 # CONFIG_UIO is not set
+# CONFIG_STAGING is not set
 
 #
 # File systems
 #
 # CONFIG_EXT2_FS is not set
 # CONFIG_EXT3_FS is not set
-# CONFIG_EXT4DEV_FS is not set
+# CONFIG_EXT4_FS is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
+CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
-# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
+# CONFIG_DNOTIFY is not set
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
-# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -1059,8 +1121,11 @@ CONFIG_SYSFS=y
 # CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
 # CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
 # CONFIG_SYSV_FS is not set
 # CONFIG_UFS_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
@@ -1068,13 +1133,12 @@ CONFIG_NFS_FS=m
 CONFIG_NFS_V3=y
 # CONFIG_NFS_V3_ACL is not set
 # CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
 # CONFIG_NFSD is not set
 CONFIG_LOCKD=m
 CONFIG_LOCKD_V4=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=m
-# CONFIG_SUNRPC_BIND34 is not set
+# CONFIG_SUNRPC_REGISTER_V4 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 CONFIG_SMB_FS=m
@@ -1130,7 +1194,6 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 # CONFIG_DLM is not set
-# CONFIG_INSTRUMENTATION is not set
 
 #
 # Kernel hacking
@@ -1138,14 +1201,61 @@ CONFIG_NLS_DEFAULT="iso8859-1"
 # CONFIG_PRINTK_TIME is not set
 CONFIG_ENABLE_WARN_DEPRECATED=y
 CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
 # CONFIG_MAGIC_SYSRQ is not set
 # CONFIG_UNUSED_SYMBOLS is not set
 CONFIG_DEBUG_FS=y
 # CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+# CONFIG_SCHED_DEBUG is not set
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
 # CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_FRAME_POINTER is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+
+#
+# Tracers
+#
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_BOOT_TRACER is not set
+# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 # CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_DEBUG_STACKOVERFLOW is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_KGDB_TESTCASE is not set
+CONFIG_DEBUG_VERBOSE=y
 CONFIG_DEBUG_MMRS=y
+# CONFIG_DEBUG_HWERR is not set
+# CONFIG_DEBUG_DOUBLEFAULT is not set
 CONFIG_DEBUG_HUNT_FOR_ZERO=y
 CONFIG_DEBUG_BFIN_HWTRACE_ON=y
 CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
@@ -1154,7 +1264,7 @@ CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_OFF=y
 CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION=0
 # CONFIG_DEBUG_BFIN_HWTRACE_EXPAND is not set
 # CONFIG_DEBUG_BFIN_NO_KERN_HWTRACE is not set
-CONFIG_EARLY_PRINTK=y
+# CONFIG_EARLY_PRINTK is not set
 # CONFIG_CPLB_INFO is not set
 CONFIG_ACCESS_CHECK=y
 
@@ -1163,10 +1273,96 @@ CONFIG_ACCESS_CHECK=y
 #
 # CONFIG_KEYS is not set
 CONFIG_SECURITY=y
+# CONFIG_SECURITYFS is not set
 # CONFIG_SECURITY_NETWORK is not set
-# CONFIG_SECURITY_CAPABILITIES is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
 # CONFIG_SECURITY_ROOTPLUG is not set
-# CONFIG_CRYPTO is not set
+CONFIG_SECURITY_DEFAULT_MMAP_MIN_ADDR=0
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_FIPS is not set
+# CONFIG_CRYPTO_MANAGER is not set
+# CONFIG_CRYPTO_MANAGER2 is not set
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+# CONFIG_CRYPTO_ECB is not set
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+CONFIG_CRYPTO_HW=y
 
 #
 # Library routines
@@ -1174,6 +1370,7 @@ CONFIG_SECURITY=y
 CONFIG_BITREVERSE=y
 CONFIG_CRC_CCITT=m
 # CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
 # CONFIG_CRC7 is not set
index f67289a0d8d2c5ccf3bb08bf427424e57f6cd736..793581fc955610f574f604ac7f214fadda47f06c 100644 (file)
@@ -63,23 +63,23 @@ static inline __wsum
 csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
                   unsigned short proto, __wsum sum)
 {
-
-       __asm__ ("%0 = %0 + %1;\n\t"
-                "CC = AC0;\n\t"
-                "if !CC jump 4;\n\t"
-                "%0 = %0 + %4;\n\t"
-                "%0 = %0 + %2;\n\t"
-                "CC = AC0;\n\t"
-                 "if !CC jump 4;\n\t"
-                 "%0 = %0 + %4;\n\t"
-                "%0 = %0 + %3;\n\t"
-                "CC = AC0;\n\t"
-                 "if !CC jump 4;\n\t"
-                 "%0 = %0 + %4;\n\t"
-                 "NOP;\n\t"
-                : "=d" (sum)
-                : "d" (daddr), "d" (saddr), "d" ((ntohs(len)<<16)+proto*256), "d" (1), "0"(sum)
-                : "CC");
+       unsigned int carry;
+
+       __asm__ ("%0 = %0 + %2;\n\t"
+               "CC = AC0;\n\t"
+               "%1 = CC;\n\t"
+               "%0 = %0 + %1;\n\t"
+               "%0 = %0 + %3;\n\t"
+               "CC = AC0;\n\t"
+               "%1 = CC;\n\t"
+               "%0 = %0 + %1;\n\t"
+               "%0 = %0 + %4;\n\t"
+               "CC = AC0;\n\t"
+               "%1 = CC;\n\t"
+               "%0 = %0 + %1;\n\t"
+               : "=d" (sum), "=&d" (carry)
+               : "d" (daddr), "d" (saddr), "d" ((len + proto) << 8), "0"(sum)
+               : "CC");
 
        return (sum);
 }
index 0889c3abb593c4683a62b973de0bd8bd75013d50..c31f91cc1d5dbd5cd0677ed007c002313a784109 100644 (file)
 
 static inline void __delay(unsigned long loops)
 {
-       if (ANOMALY_05000312) {
-               /* Interrupted loads to loop registers -> bad */
-               unsigned long tmp;
-               __asm__ __volatile__(
-                       "[--SP] = LC0;"
-                       "[--SP] = LT0;"
-                       "[--SP] = LB0;"
-                       "LSETUP (1f,1f) LC0 = %1;"
-                       "1: NOP;"
-                       /* We take advantage of the fact that LC0 is 0 at
-                        * the end of the loop.  Otherwise we'd need some
-                        * NOPs after the CLI here.
-                        */
-                       "CLI %0;"
-                       "LB0 = [SP++];"
-                       "LT0 = [SP++];"
-                       "LC0 = [SP++];"
-                       "STI %0;"
-                       : "=d" (tmp)
-                       : "a" (loops)
-               );
-       } else
-               __asm__ __volatile__ (
+__asm__ __volatile__ (
                        "LSETUP(1f, 1f) LC0 = %0;"
                        "1: NOP;"
                        :
@@ -47,16 +25,15 @@ static inline void __delay(unsigned long loops)
 #include <linux/param.h>       /* needed for HZ */
 
 /*
- * Use only for very small delays ( < 1 msec).  Should probably use a
- * lookup table, really, as the multiplications take much too long with
- * short delays.  This is a "reasonable" implementation, though (and the
- * first constant multiplications gets optimized away if the delay is
- * a constant)
+ * close approximation borrowed from m68knommu to avoid 64-bit math
  */
+
+#define        HZSCALE         (268435456 / (1000000/HZ))
+
 static inline void udelay(unsigned long usecs)
 {
        extern unsigned long loops_per_jiffy;
-       __delay(usecs * loops_per_jiffy / (1000000 / HZ));
+       __delay((((usecs * HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6);
 }
 
 #endif
index 9477d82fcad2b2451dd2948d6cfa01ba1aff06bd..d4a082ef75b472456f3f206b7d087ead9e2da39d 100644 (file)
  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-/*
-*  Number     BF537/6/4    BF561    BF533/2/1
-*             BF527/5/2
-*
-*  GPIO_0       PF0         PF0        PF0
-*  GPIO_1       PF1         PF1        PF1
-*  GPIO_2       PF2         PF2        PF2
-*  GPIO_3       PF3         PF3        PF3
-*  GPIO_4       PF4         PF4        PF4
-*  GPIO_5       PF5         PF5        PF5
-*  GPIO_6       PF6         PF6        PF6
-*  GPIO_7       PF7         PF7        PF7
-*  GPIO_8       PF8         PF8        PF8
-*  GPIO_9       PF9         PF9        PF9
-*  GPIO_10      PF10        PF10       PF10
-*  GPIO_11      PF11        PF11       PF11
-*  GPIO_12      PF12        PF12       PF12
-*  GPIO_13      PF13        PF13       PF13
-*  GPIO_14      PF14        PF14       PF14
-*  GPIO_15      PF15        PF15       PF15
-*  GPIO_16      PG0         PF16
-*  GPIO_17      PG1         PF17
-*  GPIO_18      PG2         PF18
-*  GPIO_19      PG3         PF19
-*  GPIO_20      PG4         PF20
-*  GPIO_21      PG5         PF21
-*  GPIO_22      PG6         PF22
-*  GPIO_23      PG7         PF23
-*  GPIO_24      PG8         PF24
-*  GPIO_25      PG9         PF25
-*  GPIO_26      PG10        PF26
-*  GPIO_27      PG11        PF27
-*  GPIO_28      PG12        PF28
-*  GPIO_29      PG13        PF29
-*  GPIO_30      PG14        PF30
-*  GPIO_31      PG15        PF31
-*  GPIO_32      PH0         PF32
-*  GPIO_33      PH1         PF33
-*  GPIO_34      PH2         PF34
-*  GPIO_35      PH3         PF35
-*  GPIO_36      PH4         PF36
-*  GPIO_37      PH5         PF37
-*  GPIO_38      PH6         PF38
-*  GPIO_39      PH7         PF39
-*  GPIO_40      PH8         PF40
-*  GPIO_41      PH9         PF41
-*  GPIO_42      PH10        PF42
-*  GPIO_43      PH11        PF43
-*  GPIO_44      PH12        PF44
-*  GPIO_45      PH13        PF45
-*  GPIO_46      PH14        PF46
-*  GPIO_47      PH15        PF47
-*/
-
 #ifndef __ARCH_BLACKFIN_GPIO_H__
 #define __ARCH_BLACKFIN_GPIO_H__
 
@@ -295,10 +241,6 @@ int bfin_gpio_direction_output(unsigned gpio, int value);
 int bfin_gpio_get_value(unsigned gpio);
 void bfin_gpio_set_value(unsigned gpio, int value);
 
-#ifndef BF548_FAMILY
-#define bfin_gpio_set_value(gpio, value)    set_gpio_data(gpio, value)
-#endif
-
 #ifdef CONFIG_GPIOLIB
 #include <asm-generic/gpio.h>          /* cansleep wrappers */
 
index 26ebac6646d879b61e7acb1759a81f4328d484c4..c8b256d2ea30ec6d86fdb3a353bc2cce3a2edf78 100644 (file)
@@ -1,32 +1,8 @@
-/*
- * File:         include/asm-blackfin/kgdb.h
- * Based on:
- * Author:       Sonic Zhang
- *
- * Created:
- * Description:
- *
- * Rev:          $Id: kgdb_bfin_linux-2.6.x.patch 4934 2007-02-13 09:32:11Z sonicz $
- *
- * Modified:
- *               Copyright 2005-2006 Analog Devices Inc.
- *
- * Bugs:         Enter bugs at http://blackfin.uclinux.org/
+/* Blackfin KGDB header
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * Copyright 2005-2009 Analog Devices Inc.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, see the file COPYING, or write
- * to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ * Licensed under the GPL-2 or later.
  */
 
 #ifndef __ASM_BLACKFIN_KGDB_H__
 /* gdb locks */
 #define KGDB_MAX_NO_CPUS 8
 
-/************************************************************************/
-/* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/
-/* at least NUMREGBYTES*2 are needed for register packets */
-/* Longer buffer is needed to list all threads */
+/*
+ * BUFMAX defines the maximum number of characters in inbound/outbound buffers.
+ * At least NUMREGBYTES*2 are needed for register packets.
+ * Longer buffer is needed to list all threads.
+ */
 #define BUFMAX 2048
 
 /*
- *  Note that this register image is different from
- *  the register image that Linux produces at interrupt time.
- *  
- *  Linux's register image is defined by struct pt_regs in ptrace.h.
+ * Note that this register image is different from
+ * the register image that Linux produces at interrupt time.
+ *
+ * Linux's register image is defined by struct pt_regs in ptrace.h.
  */
 enum regnames {
   /* Core Registers */
@@ -104,14 +81,14 @@ enum regnames {
   BFIN_RETX,
   BFIN_RETN,
   BFIN_RETE,
-  
+
   /* Pseudo Registers */
   BFIN_PC,
   BFIN_CC,
   BFIN_EXTRA1,         /* Address of .text section.  */
   BFIN_EXTRA2,         /* Address of .data section.  */
   BFIN_EXTRA3,         /* Address of .bss section.  */
-  BFIN_FDPIC_EXEC, 
+  BFIN_FDPIC_EXEC,
   BFIN_FDPIC_INTERP,
 
   /* MMRs */
@@ -126,7 +103,7 @@ enum regnames {
 
 static inline void arch_kgdb_breakpoint(void)
 {
-       asm("   EXCPT 2;");
+       asm("EXCPT 2;");
 }
 #define BREAK_INSTR_SIZE       2
 #define CACHE_FLUSH_IS_SAFE    1
index 255a9316ad367e8c5e6b3793007e307033d59d4c..61f7487fbf12a6bd3e194030a8e35deccdd9d465 100644 (file)
 #define mem_SDRRC       (((CONFIG_SCLK_HZ / 1000) * SDRAM_Tref) / SDRAM_NRA) - (SDRAM_tRAS_num + SDRAM_tRP_num)
 
 /* Enable SCLK Out */
-#define mem_SDGCTL        (0x80000000 | SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
+#define mem_SDGCTL        (SCTLE | SDRAM_CL | SDRAM_tRAS | SDRAM_tRP | SDRAM_tRCD | SDRAM_tWR | PSS)
 #else
 #define mem_SDRRC      CONFIG_MEM_SDRRC
 #define mem_SDGCTL     CONFIG_MEM_SDGCTL
index bd8d4a7efeb29720e0e4171c1359ba7740ffb08d..a67142740df0b4fa9592ec8c95c8df93dd0d5617 100644 (file)
@@ -59,6 +59,7 @@ struct blackfin_pda {                 /* Per-processor Data Area */
        unsigned long icplb_fault_addr;
        unsigned long retx;
        unsigned long seqstat;
+       unsigned int __nmi_count;       /* number of times NMI asserted on this CPU */
 };
 
 extern struct blackfin_pda cpu_pda[];
index 4856d62b7467af1bccad5a3817e5fa2cfc421dfb..ae1e36329bec7c71af865d8790eb2ff3a4e29af0 100644 (file)
@@ -15,6 +15,6 @@ extern void native_machine_halt(void);
 extern void native_machine_power_off(void);
 
 /* common reboot workarounds */
-extern void bfin_gpio_reset_spi0_ssel1(void);
+extern void bfin_reset_boot_spi_cs(unsigned short pin);
 
 #endif
index 2ca702e44d4759420051ed73dc9c3662eb2fb5c4..fac7fe9e1f8a670f85b1119e1ddfd98a34ae5255 100644 (file)
@@ -53,4 +53,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif                         /* _ASM_SOCKET_H */
index 38a233374f0720f2596cdfee29bc81147f03b20f..4a92a86824b7bd1d6164eae8d8dcb2ca08bbfd80 100644 (file)
@@ -15,6 +15,8 @@ else
     obj-y += time.o
 endif
 
+CFLAGS_kgdb_test.o := -mlong-calls -O0
+
 obj-$(CONFIG_IPIPE)                  += ipipe.o
 obj-$(CONFIG_IPIPE_TRACE_MCOUNT)     += mcount.o
 obj-$(CONFIG_BFIN_GPTIMERS)          += gptimers.o
index 07e02c0d1c07c17a8a3b232339644acb80810c4f..8531693fb48d8b5cddc10e60b13d3fc5f5b56275 100644 (file)
@@ -249,6 +249,13 @@ static void __dma_memcpy(u32 daddr, s16 dmod, u32 saddr, s16 smod, size_t cnt, u
 
        spin_lock_irqsave(&mdma_lock, flags);
 
+       /* Force a sync in case a previous config reset on this channel
+        * occurred.  This is needed so subsequent writes to DMA registers
+        * are not spuriously lost/corrupted.  Do it under irq lock and
+        * without the anomaly version (because we are atomic already).
+        */
+       __builtin_bfin_ssync();
+
        if (bfin_read_MDMA_S0_CONFIG())
                while (!(bfin_read_MDMA_D0_IRQ_STATUS() & DMA_DONE))
                        continue;
index 4c14331978f6e369b70ea862632f4d913cc814f0..51dac55c524a486ed1a4c655e062d9f79a5db6f6 100644 (file)
  * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-/*
-*  Number     BF537/6/4    BF561    BF533/2/1     BF549/8/4/2
-*
-*  GPIO_0       PF0         PF0        PF0        PA0...PJ13
-*  GPIO_1       PF1         PF1        PF1
-*  GPIO_2       PF2         PF2        PF2
-*  GPIO_3       PF3         PF3        PF3
-*  GPIO_4       PF4         PF4        PF4
-*  GPIO_5       PF5         PF5        PF5
-*  GPIO_6       PF6         PF6        PF6
-*  GPIO_7       PF7         PF7        PF7
-*  GPIO_8       PF8         PF8        PF8
-*  GPIO_9       PF9         PF9        PF9
-*  GPIO_10      PF10        PF10       PF10
-*  GPIO_11      PF11        PF11       PF11
-*  GPIO_12      PF12        PF12       PF12
-*  GPIO_13      PF13        PF13       PF13
-*  GPIO_14      PF14        PF14       PF14
-*  GPIO_15      PF15        PF15       PF15
-*  GPIO_16      PG0         PF16
-*  GPIO_17      PG1         PF17
-*  GPIO_18      PG2         PF18
-*  GPIO_19      PG3         PF19
-*  GPIO_20      PG4         PF20
-*  GPIO_21      PG5         PF21
-*  GPIO_22      PG6         PF22
-*  GPIO_23      PG7         PF23
-*  GPIO_24      PG8         PF24
-*  GPIO_25      PG9         PF25
-*  GPIO_26      PG10        PF26
-*  GPIO_27      PG11        PF27
-*  GPIO_28      PG12        PF28
-*  GPIO_29      PG13        PF29
-*  GPIO_30      PG14        PF30
-*  GPIO_31      PG15        PF31
-*  GPIO_32      PH0         PF32
-*  GPIO_33      PH1         PF33
-*  GPIO_34      PH2         PF34
-*  GPIO_35      PH3         PF35
-*  GPIO_36      PH4         PF36
-*  GPIO_37      PH5         PF37
-*  GPIO_38      PH6         PF38
-*  GPIO_39      PH7         PF39
-*  GPIO_40      PH8         PF40
-*  GPIO_41      PH9         PF41
-*  GPIO_42      PH10        PF42
-*  GPIO_43      PH11        PF43
-*  GPIO_44      PH12        PF44
-*  GPIO_45      PH13        PF45
-*  GPIO_46      PH14        PF46
-*  GPIO_47      PH15        PF47
-*/
-
 #include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/err.h>
@@ -119,62 +66,61 @@ enum {
 #define AWA_DUMMY_READ(...)  do { } while (0)
 #endif
 
+static struct gpio_port_t * const gpio_array[] = {
 #if defined(BF533_FAMILY) || defined(BF538_FAMILY)
-static struct gpio_port_t *gpio_bankb[] = {
        (struct gpio_port_t *) FIO_FLAG_D,
-};
-#endif
-
-#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
-static struct gpio_port_t *gpio_bankb[] = {
+#elif defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
        (struct gpio_port_t *) PORTFIO,
        (struct gpio_port_t *) PORTGIO,
        (struct gpio_port_t *) PORTHIO,
+#elif defined(BF561_FAMILY)
+       (struct gpio_port_t *) FIO0_FLAG_D,
+       (struct gpio_port_t *) FIO1_FLAG_D,
+       (struct gpio_port_t *) FIO2_FLAG_D,
+#elif defined(BF548_FAMILY)
+       (struct gpio_port_t *)PORTA_FER,
+       (struct gpio_port_t *)PORTB_FER,
+       (struct gpio_port_t *)PORTC_FER,
+       (struct gpio_port_t *)PORTD_FER,
+       (struct gpio_port_t *)PORTE_FER,
+       (struct gpio_port_t *)PORTF_FER,
+       (struct gpio_port_t *)PORTG_FER,
+       (struct gpio_port_t *)PORTH_FER,
+       (struct gpio_port_t *)PORTI_FER,
+       (struct gpio_port_t *)PORTJ_FER,
+#else
+# error no gpio arrays defined
+#endif
 };
 
-static unsigned short *port_fer[] = {
+#if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
+static unsigned short * const port_fer[] = {
        (unsigned short *) PORTF_FER,
        (unsigned short *) PORTG_FER,
        (unsigned short *) PORTH_FER,
 };
-#endif
 
-#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
-static unsigned short *port_mux[] = {
+# if !defined(BF537_FAMILY)
+static unsigned short * const port_mux[] = {
        (unsigned short *) PORTF_MUX,
        (unsigned short *) PORTG_MUX,
        (unsigned short *) PORTH_MUX,
 };
 
 static const
-u8 pmux_offset[][16] =
-       {{ 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */
-        { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */
-        { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */
-       };
-#endif
-
-#ifdef BF561_FAMILY
-static struct gpio_port_t *gpio_bankb[] = {
-       (struct gpio_port_t *) FIO0_FLAG_D,
-       (struct gpio_port_t *) FIO1_FLAG_D,
-       (struct gpio_port_t *) FIO2_FLAG_D,
+u8 pmux_offset[][16] = {
+#  if defined(BF527_FAMILY)
+       { 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 4, 6, 8, 8, 10, 10 }, /* PORTF */
+       { 0, 0, 0, 0, 0, 2, 2, 4, 4, 6, 8, 10, 10, 10, 12, 12 }, /* PORTG */
+       { 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 4, 4, 4, 4, 4, 4 }, /* PORTH */
+#  elif defined(BF518_FAMILY)
+       { 0, 2, 2, 2, 2, 2, 2, 4, 6, 6, 6, 8, 8, 8, 8, 10 }, /* PORTF */
+       { 0, 0, 0, 2, 4, 6, 6, 6, 8, 10, 10, 12, 14, 14, 14, 14 }, /* PORTG */
+       { 0, 0, 0, 0, 2, 2, 4, 6, 10, 10, 10, 10, 10, 10, 10, 10 }, /* PORTH */
+#  endif
 };
-#endif
+# endif
 
-#ifdef BF548_FAMILY
-static struct gpio_port_t *gpio_array[] = {
-       (struct gpio_port_t *)PORTA_FER,
-       (struct gpio_port_t *)PORTB_FER,
-       (struct gpio_port_t *)PORTC_FER,
-       (struct gpio_port_t *)PORTD_FER,
-       (struct gpio_port_t *)PORTE_FER,
-       (struct gpio_port_t *)PORTF_FER,
-       (struct gpio_port_t *)PORTG_FER,
-       (struct gpio_port_t *)PORTH_FER,
-       (struct gpio_port_t *)PORTI_FER,
-       (struct gpio_port_t *)PORTJ_FER,
-};
 #endif
 
 static unsigned short reserved_gpio_map[GPIO_BANK_NUM];
@@ -188,35 +134,9 @@ static struct str_ident {
 } str_ident[MAX_RESOURCES];
 
 #if defined(CONFIG_PM)
-#if defined(CONFIG_BF54x)
-static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
-#else
-static unsigned short wakeup_map[GPIO_BANK_NUM];
-static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
 static struct gpio_port_s gpio_bank_saved[GPIO_BANK_NUM];
-
-#ifdef BF533_FAMILY
-static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB};
-#endif
-
-#ifdef BF537_FAMILY
-static unsigned int sic_iwr_irqs[] = {IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX};
-#endif
-
-#ifdef BF538_FAMILY
-static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB};
 #endif
 
-#if defined(BF527_FAMILY) || defined(BF518_FAMILY)
-static unsigned int sic_iwr_irqs[] = {IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB};
-#endif
-
-#ifdef BF561_FAMILY
-static unsigned int sic_iwr_irqs[] = {IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB};
-#endif
-#endif
-#endif /* CONFIG_PM */
-
 inline int check_gpio(unsigned gpio)
 {
 #if defined(BF548_FAMILY)
@@ -330,9 +250,10 @@ static struct {
        {.res = P_SPI0_SSEL3, .offset = 0},
 };
 
-static void portmux_setup(unsigned short per, unsigned short function)
+static void portmux_setup(unsigned short per)
 {
        u16 y, offset, muxreg;
+       u16 function = P_FUNCT2MUX(per);
 
        for (y = 0; y < ARRAY_SIZE(port_mux_lut); y++) {
                if (port_mux_lut[y].res == per) {
@@ -353,30 +274,33 @@ static void portmux_setup(unsigned short per, unsigned short function)
        }
 }
 #elif defined(BF548_FAMILY)
-inline void portmux_setup(unsigned short portno, unsigned short function)
+inline void portmux_setup(unsigned short per)
 {
        u32 pmux;
+       u16 ident = P_IDENT(per);
+       u16 function = P_FUNCT2MUX(per);
 
-       pmux = gpio_array[gpio_bank(portno)]->port_mux;
+       pmux = gpio_array[gpio_bank(ident)]->port_mux;
 
-       pmux &= ~(0x3 << (2 * gpio_sub_n(portno)));
-       pmux |= (function & 0x3) << (2 * gpio_sub_n(portno));
+       pmux &= ~(0x3 << (2 * gpio_sub_n(ident)));
+       pmux |= (function & 0x3) << (2 * gpio_sub_n(ident));
 
-       gpio_array[gpio_bank(portno)]->port_mux = pmux;
+       gpio_array[gpio_bank(ident)]->port_mux = pmux;
 }
 
-inline u16 get_portmux(unsigned short portno)
+inline u16 get_portmux(unsigned short per)
 {
        u32 pmux;
+       u16 ident = P_IDENT(per);
 
-       pmux = gpio_array[gpio_bank(portno)]->port_mux;
+       pmux = gpio_array[gpio_bank(ident)]->port_mux;
 
-       return (pmux >> (2 * gpio_sub_n(portno)) & 0x3);
+       return (pmux >> (2 * gpio_sub_n(ident)) & 0x3);
 }
 #elif defined(BF527_FAMILY) || defined(BF518_FAMILY)
-inline void portmux_setup(unsigned short portno, unsigned short function)
+inline void portmux_setup(unsigned short per)
 {
-       u16 pmux, ident = P_IDENT(portno);
+       u16 pmux, ident = P_IDENT(per), function = P_FUNCT2MUX(per);
        u8 offset = pmux_offset[gpio_bank(ident)][gpio_sub_n(ident)];
 
        pmux = *port_mux[gpio_bank(ident)];
@@ -424,90 +348,71 @@ void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
        unsigned long flags; \
        local_irq_save_hw(flags); \
        if (arg) \
-               gpio_bankb[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
+               gpio_array[gpio_bank(gpio)]->name |= gpio_bit(gpio); \
        else \
-               gpio_bankb[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \
+               gpio_array[gpio_bank(gpio)]->name &= ~gpio_bit(gpio); \
        AWA_DUMMY_READ(name); \
        local_irq_restore_hw(flags); \
 } \
 EXPORT_SYMBOL(set_gpio_ ## name);
 
-SET_GPIO(dir)
-SET_GPIO(inen)
-SET_GPIO(polar)
-SET_GPIO(edge)
-SET_GPIO(both)
+SET_GPIO(dir)   /* set_gpio_dir() */
+SET_GPIO(inen)  /* set_gpio_inen() */
+SET_GPIO(polar) /* set_gpio_polar() */
+SET_GPIO(edge)  /* set_gpio_edge() */
+SET_GPIO(both)  /* set_gpio_both() */
 
 
-#if ANOMALY_05000311 || ANOMALY_05000323
 #define SET_GPIO_SC(name) \
 void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
 { \
        unsigned long flags; \
-       local_irq_save_hw(flags); \
-       if (arg) \
-               gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
-       else \
-               gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
-       AWA_DUMMY_READ(name); \
-       local_irq_restore_hw(flags); \
-} \
-EXPORT_SYMBOL(set_gpio_ ## name);
-#else
-#define SET_GPIO_SC(name) \
-void set_gpio_ ## name(unsigned gpio, unsigned short arg) \
-{ \
+       if (ANOMALY_05000311 || ANOMALY_05000323) \
+               local_irq_save_hw(flags); \
        if (arg) \
-               gpio_bankb[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
+               gpio_array[gpio_bank(gpio)]->name ## _set = gpio_bit(gpio); \
        else \
-               gpio_bankb[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
+               gpio_array[gpio_bank(gpio)]->name ## _clear = gpio_bit(gpio); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) { \
+               AWA_DUMMY_READ(name); \
+               local_irq_restore_hw(flags); \
+       } \
 } \
 EXPORT_SYMBOL(set_gpio_ ## name);
-#endif
 
 SET_GPIO_SC(maska)
 SET_GPIO_SC(maskb)
 SET_GPIO_SC(data)
 
-#if ANOMALY_05000311 || ANOMALY_05000323
 void set_gpio_toggle(unsigned gpio)
 {
        unsigned long flags;
-       local_irq_save_hw(flags);
-       gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
-       AWA_DUMMY_READ(toggle);
-       local_irq_restore_hw(flags);
-}
-#else
-void set_gpio_toggle(unsigned gpio)
-{
-       gpio_bankb[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
+       if (ANOMALY_05000311 || ANOMALY_05000323)
+               local_irq_save_hw(flags);
+       gpio_array[gpio_bank(gpio)]->toggle = gpio_bit(gpio);
+       if (ANOMALY_05000311 || ANOMALY_05000323) {
+               AWA_DUMMY_READ(toggle);
+               local_irq_restore_hw(flags);
+       }
 }
-#endif
 EXPORT_SYMBOL(set_gpio_toggle);
 
 
 /*Set current PORT date (16-bit word)*/
 
-#if ANOMALY_05000311 || ANOMALY_05000323
 #define SET_GPIO_P(name) \
 void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
 { \
        unsigned long flags; \
-       local_irq_save_hw(flags); \
-       gpio_bankb[gpio_bank(gpio)]->name = arg; \
-       AWA_DUMMY_READ(name); \
-       local_irq_restore_hw(flags); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) \
+               local_irq_save_hw(flags); \
+       gpio_array[gpio_bank(gpio)]->name = arg; \
+       if (ANOMALY_05000311 || ANOMALY_05000323) { \
+               AWA_DUMMY_READ(name); \
+               local_irq_restore_hw(flags); \
+       } \
 } \
 EXPORT_SYMBOL(set_gpiop_ ## name);
-#else
-#define SET_GPIO_P(name) \
-void set_gpiop_ ## name(unsigned gpio, unsigned short arg) \
-{ \
-       gpio_bankb[gpio_bank(gpio)]->name = arg; \
-} \
-EXPORT_SYMBOL(set_gpiop_ ## name);
-#endif
 
 SET_GPIO_P(data)
 SET_GPIO_P(dir)
@@ -519,27 +424,21 @@ SET_GPIO_P(maska)
 SET_GPIO_P(maskb)
 
 /* Get a specific bit */
-#if ANOMALY_05000311 || ANOMALY_05000323
 #define GET_GPIO(name) \
 unsigned short get_gpio_ ## name(unsigned gpio) \
 { \
        unsigned long flags; \
        unsigned short ret; \
-       local_irq_save_hw(flags); \
-       ret = 0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \
-       AWA_DUMMY_READ(name); \
-       local_irq_restore_hw(flags); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) \
+               local_irq_save_hw(flags); \
+       ret = 0x01 & (gpio_array[gpio_bank(gpio)]->name >> gpio_sub_n(gpio)); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) { \
+               AWA_DUMMY_READ(name); \
+               local_irq_restore_hw(flags); \
+       } \
        return ret; \
 } \
 EXPORT_SYMBOL(get_gpio_ ## name);
-#else
-#define GET_GPIO(name) \
-unsigned short get_gpio_ ## name(unsigned gpio) \
-{ \
-       return (0x01 & (gpio_bankb[gpio_bank(gpio)]->name >> gpio_sub_n(gpio))); \
-} \
-EXPORT_SYMBOL(get_gpio_ ## name);
-#endif
 
 GET_GPIO(data)
 GET_GPIO(dir)
@@ -552,27 +451,21 @@ GET_GPIO(maskb)
 
 /*Get current PORT date (16-bit word)*/
 
-#if ANOMALY_05000311 || ANOMALY_05000323
 #define GET_GPIO_P(name) \
 unsigned short get_gpiop_ ## name(unsigned gpio) \
 { \
        unsigned long flags; \
        unsigned short ret; \
-       local_irq_save_hw(flags); \
-       ret = (gpio_bankb[gpio_bank(gpio)]->name); \
-       AWA_DUMMY_READ(name); \
-       local_irq_restore_hw(flags); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) \
+               local_irq_save_hw(flags); \
+       ret = (gpio_array[gpio_bank(gpio)]->name); \
+       if (ANOMALY_05000311 || ANOMALY_05000323) { \
+               AWA_DUMMY_READ(name); \
+               local_irq_restore_hw(flags); \
+       } \
        return ret; \
 } \
 EXPORT_SYMBOL(get_gpiop_ ## name);
-#else
-#define GET_GPIO_P(name) \
-unsigned short get_gpiop_ ## name(unsigned gpio) \
-{ \
-       return (gpio_bankb[gpio_bank(gpio)]->name);\
-} \
-EXPORT_SYMBOL(get_gpiop_ ## name);
-#endif
 
 GET_GPIO_P(data)
 GET_GPIO_P(dir)
@@ -585,6 +478,26 @@ GET_GPIO_P(maskb)
 
 
 #ifdef CONFIG_PM
+
+static unsigned short wakeup_map[GPIO_BANK_NUM];
+static unsigned char wakeup_flags_map[MAX_BLACKFIN_GPIOS];
+
+static const unsigned int sic_iwr_irqs[] = {
+#if defined(BF533_FAMILY)
+       IRQ_PROG_INTB
+#elif defined(BF537_FAMILY)
+       IRQ_PROG_INTB, IRQ_PORTG_INTB, IRQ_MAC_TX
+#elif defined(BF538_FAMILY)
+       IRQ_PORTF_INTB
+#elif defined(BF527_FAMILY) || defined(BF518_FAMILY)
+       IRQ_PORTF_INTB, IRQ_PORTG_INTB, IRQ_PORTH_INTB
+#elif defined(BF561_FAMILY)
+       IRQ_PROG0_INTB, IRQ_PROG1_INTB, IRQ_PROG2_INTB
+#else
+# error no SIC_IWR defined
+#endif
+};
+
 /***********************************************************
 *
 * FUNCTIONS: Blackfin PM Setup API
@@ -669,18 +582,18 @@ u32 bfin_pm_standby_setup(void)
                mask = wakeup_map[gpio_bank(i)];
                bank = gpio_bank(i);
 
-               gpio_bank_saved[bank].maskb = gpio_bankb[bank]->maskb;
-               gpio_bankb[bank]->maskb = 0;
+               gpio_bank_saved[bank].maskb = gpio_array[bank]->maskb;
+               gpio_array[bank]->maskb = 0;
 
                if (mask) {
 #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
                        gpio_bank_saved[bank].fer   = *port_fer[bank];
 #endif
-                       gpio_bank_saved[bank].inen  = gpio_bankb[bank]->inen;
-                       gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar;
-                       gpio_bank_saved[bank].dir   = gpio_bankb[bank]->dir;
-                       gpio_bank_saved[bank].edge  = gpio_bankb[bank]->edge;
-                       gpio_bank_saved[bank].both  = gpio_bankb[bank]->both;
+                       gpio_bank_saved[bank].inen  = gpio_array[bank]->inen;
+                       gpio_bank_saved[bank].polar = gpio_array[bank]->polar;
+                       gpio_bank_saved[bank].dir   = gpio_array[bank]->dir;
+                       gpio_bank_saved[bank].edge  = gpio_array[bank]->edge;
+                       gpio_bank_saved[bank].both  = gpio_array[bank]->both;
                        gpio_bank_saved[bank].reserved =
                                                reserved_gpio_map[bank];
 
@@ -700,7 +613,7 @@ u32 bfin_pm_standby_setup(void)
                        }
 
                        bfin_internal_set_wake(sic_iwr_irqs[bank], 1);
-                       gpio_bankb[bank]->maskb_set = wakeup_map[gpio_bank(i)];
+                       gpio_array[bank]->maskb_set = wakeup_map[gpio_bank(i)];
                }
        }
 
@@ -721,18 +634,18 @@ void bfin_pm_standby_restore(void)
 #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
                        *port_fer[bank]         = gpio_bank_saved[bank].fer;
 #endif
-                       gpio_bankb[bank]->inen  = gpio_bank_saved[bank].inen;
-                       gpio_bankb[bank]->dir   = gpio_bank_saved[bank].dir;
-                       gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar;
-                       gpio_bankb[bank]->edge  = gpio_bank_saved[bank].edge;
-                       gpio_bankb[bank]->both  = gpio_bank_saved[bank].both;
+                       gpio_array[bank]->inen  = gpio_bank_saved[bank].inen;
+                       gpio_array[bank]->dir   = gpio_bank_saved[bank].dir;
+                       gpio_array[bank]->polar = gpio_bank_saved[bank].polar;
+                       gpio_array[bank]->edge  = gpio_bank_saved[bank].edge;
+                       gpio_array[bank]->both  = gpio_bank_saved[bank].both;
 
                        reserved_gpio_map[bank] =
                                        gpio_bank_saved[bank].reserved;
                        bfin_internal_set_wake(sic_iwr_irqs[bank], 0);
                }
 
-               gpio_bankb[bank]->maskb = gpio_bank_saved[bank].maskb;
+               gpio_array[bank]->maskb = gpio_bank_saved[bank].maskb;
        }
        AWA_DUMMY_READ(maskb);
 }
@@ -745,21 +658,21 @@ void bfin_gpio_pm_hibernate_suspend(void)
                bank = gpio_bank(i);
 
 #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
-                       gpio_bank_saved[bank].fer   = *port_fer[bank];
+               gpio_bank_saved[bank].fer = *port_fer[bank];
 #if defined(BF527_FAMILY) || defined(BF518_FAMILY)
-                       gpio_bank_saved[bank].mux   = *port_mux[bank];
+               gpio_bank_saved[bank].mux = *port_mux[bank];
 #else
-                       if (bank == 0)
-                               gpio_bank_saved[bank].mux   = bfin_read_PORT_MUX();
+               if (bank == 0)
+                       gpio_bank_saved[bank].mux = bfin_read_PORT_MUX();
 #endif
 #endif
-                       gpio_bank_saved[bank].data  = gpio_bankb[bank]->data;
-                       gpio_bank_saved[bank].inen  = gpio_bankb[bank]->inen;
-                       gpio_bank_saved[bank].polar = gpio_bankb[bank]->polar;
-                       gpio_bank_saved[bank].dir   = gpio_bankb[bank]->dir;
-                       gpio_bank_saved[bank].edge  = gpio_bankb[bank]->edge;
-                       gpio_bank_saved[bank].both  = gpio_bankb[bank]->both;
-                       gpio_bank_saved[bank].maska  = gpio_bankb[bank]->maska;
+               gpio_bank_saved[bank].data  = gpio_array[bank]->data;
+               gpio_bank_saved[bank].inen  = gpio_array[bank]->inen;
+               gpio_bank_saved[bank].polar = gpio_array[bank]->polar;
+               gpio_bank_saved[bank].dir   = gpio_array[bank]->dir;
+               gpio_bank_saved[bank].edge  = gpio_array[bank]->edge;
+               gpio_bank_saved[bank].both  = gpio_array[bank]->both;
+               gpio_bank_saved[bank].maska = gpio_array[bank]->maska;
        }
 
        AWA_DUMMY_READ(maska);
@@ -770,27 +683,27 @@ void bfin_gpio_pm_hibernate_restore(void)
        int i, bank;
 
        for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
-                       bank = gpio_bank(i);
+               bank = gpio_bank(i);
 
 #if defined(BF527_FAMILY) || defined(BF537_FAMILY) || defined(BF518_FAMILY)
 #if defined(BF527_FAMILY) || defined(BF518_FAMILY)
-                       *port_mux[bank] = gpio_bank_saved[bank].mux;
+               *port_mux[bank] = gpio_bank_saved[bank].mux;
 #else
-                       if (bank == 0)
-                               bfin_write_PORT_MUX(gpio_bank_saved[bank].mux);
+               if (bank == 0)
+                       bfin_write_PORT_MUX(gpio_bank_saved[bank].mux);
 #endif
-                       *port_fer[bank]         = gpio_bank_saved[bank].fer;
+               *port_fer[bank] = gpio_bank_saved[bank].fer;
 #endif
-                       gpio_bankb[bank]->inen  = gpio_bank_saved[bank].inen;
-                       gpio_bankb[bank]->dir   = gpio_bank_saved[bank].dir;
-                       gpio_bankb[bank]->polar = gpio_bank_saved[bank].polar;
-                       gpio_bankb[bank]->edge  = gpio_bank_saved[bank].edge;
-                       gpio_bankb[bank]->both  = gpio_bank_saved[bank].both;
+               gpio_array[bank]->inen  = gpio_bank_saved[bank].inen;
+               gpio_array[bank]->dir   = gpio_bank_saved[bank].dir;
+               gpio_array[bank]->polar = gpio_bank_saved[bank].polar;
+               gpio_array[bank]->edge  = gpio_bank_saved[bank].edge;
+               gpio_array[bank]->both  = gpio_bank_saved[bank].both;
 
-                       gpio_bankb[bank]->data_set = gpio_bank_saved[bank].data
-                                                       | gpio_bank_saved[bank].dir;
+               gpio_array[bank]->data_set = gpio_bank_saved[bank].data
+                                               | gpio_bank_saved[bank].dir;
 
-                       gpio_bankb[bank]->maska = gpio_bank_saved[bank].maska;
+               gpio_array[bank]->maska = gpio_bank_saved[bank].maska;
        }
        AWA_DUMMY_READ(maska);
 }
@@ -817,12 +730,12 @@ void bfin_gpio_pm_hibernate_suspend(void)
        for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
                bank = gpio_bank(i);
 
-                       gpio_bank_saved[bank].fer  = gpio_array[bank]->port_fer;
-                       gpio_bank_saved[bank].mux  = gpio_array[bank]->port_mux;
-                       gpio_bank_saved[bank].data  = gpio_array[bank]->port_data;
-                       gpio_bank_saved[bank].data  = gpio_array[bank]->port_data;
-                       gpio_bank_saved[bank].inen  = gpio_array[bank]->port_inen;
-                       gpio_bank_saved[bank].dir   = gpio_array[bank]->port_dir_set;
+               gpio_bank_saved[bank].fer = gpio_array[bank]->port_fer;
+               gpio_bank_saved[bank].mux = gpio_array[bank]->port_mux;
+               gpio_bank_saved[bank].data = gpio_array[bank]->data;
+               gpio_bank_saved[bank].data = gpio_array[bank]->data;
+               gpio_bank_saved[bank].inen = gpio_array[bank]->inen;
+               gpio_bank_saved[bank].dir = gpio_array[bank]->dir_set;
        }
 }
 
@@ -831,21 +744,21 @@ void bfin_gpio_pm_hibernate_restore(void)
        int i, bank;
 
        for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) {
-                       bank = gpio_bank(i);
-
-                       gpio_array[bank]->port_mux  = gpio_bank_saved[bank].mux;
-                       gpio_array[bank]->port_fer  = gpio_bank_saved[bank].fer;
-                       gpio_array[bank]->port_inen  = gpio_bank_saved[bank].inen;
-                       gpio_array[bank]->port_dir_set   = gpio_bank_saved[bank].dir;
-                       gpio_array[bank]->port_set = gpio_bank_saved[bank].data
-                                                       | gpio_bank_saved[bank].dir;
+               bank = gpio_bank(i);
+
+               gpio_array[bank]->port_mux = gpio_bank_saved[bank].mux;
+               gpio_array[bank]->port_fer = gpio_bank_saved[bank].fer;
+               gpio_array[bank]->inen = gpio_bank_saved[bank].inen;
+               gpio_array[bank]->dir_set = gpio_bank_saved[bank].dir;
+               gpio_array[bank]->data_set = gpio_bank_saved[bank].data
+                                               | gpio_bank_saved[bank].dir;
        }
 }
 #endif
 
 unsigned short get_gpio_dir(unsigned gpio)
 {
-       return (0x01 & (gpio_array[gpio_bank(gpio)]->port_dir_clear >> gpio_sub_n(gpio)));
+       return (0x01 & (gpio_array[gpio_bank(gpio)]->dir_clear >> gpio_sub_n(gpio)));
 }
 EXPORT_SYMBOL(get_gpio_dir);
 
@@ -905,9 +818,7 @@ int peripheral_request(unsigned short per, const char *label)
                 */
 
 #ifdef BF548_FAMILY
-               u16 funct = get_portmux(ident);
-
-               if (!((per & P_MAYSHARE) && (funct == P_FUNCT2MUX(per)))) {
+               if (!((per & P_MAYSHARE) && get_portmux(per) == P_FUNCT2MUX(per))) {
 #else
                if (!(per & P_MAYSHARE)) {
 #endif
@@ -931,11 +842,7 @@ int peripheral_request(unsigned short per, const char *label)
  anyway:
        reserved_peri_map[gpio_bank(ident)] |= gpio_bit(ident);
 
-#ifdef BF548_FAMILY
-       portmux_setup(ident, P_FUNCT2MUX(per));
-#else
-       portmux_setup(per, P_FUNCT2MUX(per));
-#endif
+       portmux_setup(per);
        port_setup(ident, PERIPHERAL_USAGE);
 
        local_irq_restore_hw(flags);
@@ -977,9 +884,6 @@ void peripheral_free(unsigned short per)
        if (!(per & P_DEFINED))
                return;
 
-       if (check_gpio(ident) < 0)
-               return;
-
        local_irq_save_hw(flags);
 
        if (unlikely(!(reserved_peri_map[gpio_bank(ident)] & gpio_bit(ident)))) {
@@ -1056,9 +960,15 @@ int bfin_gpio_request(unsigned gpio, const char *label)
                local_irq_restore_hw(flags);
                return -EBUSY;
        }
-       if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio)))
+       if (unlikely(reserved_gpio_irq_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
                printk(KERN_NOTICE "bfin-gpio: GPIO %d is already reserved as gpio-irq!"
                       " (Documentation/blackfin/bfin-gpio-notes.txt)\n", gpio);
+       }
+#ifndef BF548_FAMILY
+       else {  /* Reset POLAR setting when acquiring a gpio for the first time */
+               set_gpio_polar(gpio, 0);
+       }
+#endif
 
        reserved_gpio_map[gpio_bank(gpio)] |= gpio_bit(gpio);
        set_label(gpio, label);
@@ -1078,6 +988,8 @@ void bfin_gpio_free(unsigned gpio)
        if (check_gpio(gpio) < 0)
                return;
 
+       might_sleep();
+
        local_irq_save_hw(flags);
 
        if (unlikely(!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio)))) {
@@ -1158,8 +1070,16 @@ void bfin_gpio_irq_free(unsigned gpio)
        local_irq_restore_hw(flags);
 }
 
-
+static inline void __bfin_gpio_direction_input(unsigned gpio)
+{
 #ifdef BF548_FAMILY
+       gpio_array[gpio_bank(gpio)]->dir_clear = gpio_bit(gpio);
+#else
+       gpio_array[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
+#endif
+       gpio_array[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
+}
+
 int bfin_gpio_direction_input(unsigned gpio)
 {
        unsigned long flags;
@@ -1170,125 +1090,85 @@ int bfin_gpio_direction_input(unsigned gpio)
        }
 
        local_irq_save_hw(flags);
-       gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
-       gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
+       __bfin_gpio_direction_input(gpio);
+       AWA_DUMMY_READ(inen);
        local_irq_restore_hw(flags);
 
        return 0;
 }
 EXPORT_SYMBOL(bfin_gpio_direction_input);
 
-int bfin_gpio_direction_output(unsigned gpio, int value)
+void bfin_gpio_irq_prepare(unsigned gpio)
 {
+#ifdef BF548_FAMILY
        unsigned long flags;
+#endif
 
-       if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
-               gpio_error(gpio);
-               return -EINVAL;
-       }
+       port_setup(gpio, GPIO_USAGE);
 
+#ifdef BF548_FAMILY
        local_irq_save_hw(flags);
-       gpio_array[gpio_bank(gpio)]->port_inen &= ~gpio_bit(gpio);
-       gpio_set_value(gpio, value);
-       gpio_array[gpio_bank(gpio)]->port_dir_set = gpio_bit(gpio);
+       __bfin_gpio_direction_input(gpio);
        local_irq_restore_hw(flags);
-
-       return 0;
+#endif
 }
-EXPORT_SYMBOL(bfin_gpio_direction_output);
 
 void bfin_gpio_set_value(unsigned gpio, int arg)
 {
        if (arg)
-               gpio_array[gpio_bank(gpio)]->port_set = gpio_bit(gpio);
+               gpio_array[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
        else
-               gpio_array[gpio_bank(gpio)]->port_clear = gpio_bit(gpio);
+               gpio_array[gpio_bank(gpio)]->data_clear = gpio_bit(gpio);
 }
 EXPORT_SYMBOL(bfin_gpio_set_value);
 
-int bfin_gpio_get_value(unsigned gpio)
-{
-       return (1 & (gpio_array[gpio_bank(gpio)]->port_data >> gpio_sub_n(gpio)));
-}
-EXPORT_SYMBOL(bfin_gpio_get_value);
-
-void bfin_gpio_irq_prepare(unsigned gpio)
+int bfin_gpio_direction_output(unsigned gpio, int value)
 {
        unsigned long flags;
 
-       port_setup(gpio, GPIO_USAGE);
+       if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
+               gpio_error(gpio);
+               return -EINVAL;
+       }
 
        local_irq_save_hw(flags);
-       gpio_array[gpio_bank(gpio)]->port_dir_clear = gpio_bit(gpio);
-       gpio_array[gpio_bank(gpio)]->port_inen |= gpio_bit(gpio);
-       local_irq_restore_hw(flags);
-}
 
+       gpio_array[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
+       gpio_set_value(gpio, value);
+#ifdef BF548_FAMILY
+       gpio_array[gpio_bank(gpio)]->dir_set = gpio_bit(gpio);
 #else
+       gpio_array[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
+#endif
+
+       AWA_DUMMY_READ(dir);
+       local_irq_restore_hw(flags);
+
+       return 0;
+}
+EXPORT_SYMBOL(bfin_gpio_direction_output);
 
 int bfin_gpio_get_value(unsigned gpio)
 {
+#ifdef BF548_FAMILY
+       return (1 & (gpio_array[gpio_bank(gpio)]->data >> gpio_sub_n(gpio)));
+#else
        unsigned long flags;
-       int ret;
 
        if (unlikely(get_gpio_edge(gpio))) {
+               int ret;
                local_irq_save_hw(flags);
                set_gpio_edge(gpio, 0);
                ret = get_gpio_data(gpio);
                set_gpio_edge(gpio, 1);
                local_irq_restore_hw(flags);
-
                return ret;
        } else
                return get_gpio_data(gpio);
+#endif
 }
 EXPORT_SYMBOL(bfin_gpio_get_value);
 
-
-int bfin_gpio_direction_input(unsigned gpio)
-{
-       unsigned long flags;
-
-       if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
-               gpio_error(gpio);
-               return -EINVAL;
-       }
-
-       local_irq_save_hw(flags);
-       gpio_bankb[gpio_bank(gpio)]->dir &= ~gpio_bit(gpio);
-       gpio_bankb[gpio_bank(gpio)]->inen |= gpio_bit(gpio);
-       AWA_DUMMY_READ(inen);
-       local_irq_restore_hw(flags);
-
-       return 0;
-}
-EXPORT_SYMBOL(bfin_gpio_direction_input);
-
-int bfin_gpio_direction_output(unsigned gpio, int value)
-{
-       unsigned long flags;
-
-       if (!(reserved_gpio_map[gpio_bank(gpio)] & gpio_bit(gpio))) {
-               gpio_error(gpio);
-               return -EINVAL;
-       }
-
-       local_irq_save_hw(flags);
-       gpio_bankb[gpio_bank(gpio)]->inen &= ~gpio_bit(gpio);
-
-       if (value)
-               gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
-       else
-               gpio_bankb[gpio_bank(gpio)]->data_clear = gpio_bit(gpio);
-
-       gpio_bankb[gpio_bank(gpio)]->dir |= gpio_bit(gpio);
-       AWA_DUMMY_READ(dir);
-       local_irq_restore_hw(flags);
-
-       return 0;
-}
-EXPORT_SYMBOL(bfin_gpio_direction_output);
-
 /* If we are booting from SPI and our board lacks a strong enough pull up,
  * the core can reset and execute the bootrom faster than the resistor can
  * pull the signal logically high.  To work around this (common) error in
@@ -1299,23 +1179,15 @@ EXPORT_SYMBOL(bfin_gpio_direction_output);
  * lives here as we need to force all the GPIO states w/out going through
  * BUG() checks and such.
  */
-void bfin_gpio_reset_spi0_ssel1(void)
+void bfin_reset_boot_spi_cs(unsigned short pin)
 {
-       u16 gpio = P_IDENT(P_SPI0_SSEL1);
-
+       unsigned short gpio = P_IDENT(pin);
        port_setup(gpio, GPIO_USAGE);
-       gpio_bankb[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
+       gpio_array[gpio_bank(gpio)]->data_set = gpio_bit(gpio);
        AWA_DUMMY_READ(data_set);
        udelay(1);
 }
 
-void bfin_gpio_irq_prepare(unsigned gpio)
-{
-       port_setup(gpio, GPIO_USAGE);
-}
-
-#endif /*BF548_FAMILY */
-
 #if defined(CONFIG_PROC_FS)
 static int gpio_proc_read(char *buf, char **start, off_t offset,
                          int len, int *unused_i, void *unused_v)
@@ -1369,11 +1241,7 @@ int bfin_gpiolib_get_value(struct gpio_chip *chip, unsigned gpio)
 
 void bfin_gpiolib_set_value(struct gpio_chip *chip, unsigned gpio, int value)
 {
-#ifdef BF548_FAMILY
        return bfin_gpio_set_value(gpio, value);
-#else
-       return set_gpio_data(gpio, value);
-#endif
 }
 
 int bfin_gpiolib_gpio_request(struct gpio_chip *chip, unsigned gpio)
index bdb958486e7682281fae9270a016f84ad977a77c..3e329a6ce041ad79e5429d0e0ea557ca98478569 100644 (file)
@@ -63,10 +63,8 @@ void __init generate_cplb_tables_cpu(unsigned int cpu)
        dcplb_tbl[cpu][i_d].addr = 0;
        dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB;
 
-#if 0
        icplb_tbl[cpu][i_i].addr = 0;
-       icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_4KB;
-#endif
+       icplb_tbl[cpu][i_i++].data = i_cache | CPLB_USER_RD | PAGE_SIZE_1KB;
 
        /* Cover kernel memory with 4M pages.  */
        addr = 0;
index 376249ab26945d5d588946a05967b03662366148..8cbb47c7b6639a76434f395b820304a62ecf9f82 100644 (file)
@@ -163,12 +163,14 @@ MGR_ATTR static int icplb_miss(int cpu)
                nr_icplb_supv_miss[cpu]++;
 
        base = 0;
-       for (idx = 0; idx < icplb_nr_bounds; idx++) {
+       idx = 0;
+       do {
                eaddr = icplb_bounds[idx].eaddr;
                if (addr < eaddr)
                        break;
                base = eaddr;
-       }
+       } while (++idx < icplb_nr_bounds);
+
        if (unlikely(idx == icplb_nr_bounds))
                return CPLB_NO_ADDR_MATCH;
 
@@ -208,12 +210,14 @@ MGR_ATTR static int dcplb_miss(int cpu)
                nr_dcplb_supv_miss[cpu]++;
 
        base = 0;
-       for (idx = 0; idx < dcplb_nr_bounds; idx++) {
+       idx = 0;
+       do {
                eaddr = dcplb_bounds[idx].eaddr;
                if (addr < eaddr)
                        break;
                base = eaddr;
-       }
+       } while (++idx < dcplb_nr_bounds);
+
        if (unlikely(idx == dcplb_nr_bounds))
                return CPLB_NO_ADDR_MATCH;
 
index ab8209cbbad0368f1ebc2bc252c7532478ec6b5a..75724eee6494c65c87545e14682f8cfe213877dd 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <asm/trace.h>
+#include <asm/pda.h>
 
 static atomic_t irq_err_count;
 static spinlock_t irq_controller_lock;
@@ -91,8 +92,13 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_putc(p, '\n');
  skip:
                spin_unlock_irqrestore(&irq_desc[i].lock, flags);
-       } else if (i == NR_IRQS)
+       } else if (i == NR_IRQS) {
+               seq_printf(p, "NMI: ");
+               for_each_online_cpu(j)
+                       seq_printf(p, "%10u ", cpu_pda[j].__nmi_count);
+               seq_printf(p, "     CORE  Non Maskable Interrupt\n");
                seq_printf(p, "Err: %10u\n",  atomic_read(&irq_err_count));
+       }
        return 0;
 }
 
index eeee8cb433606bfce39c3169e007979c005ea1b5..53d08dee8531b1ba588fcef55a97b288a89c0054 100644 (file)
@@ -20,8 +20,8 @@
  * reset while the Core B bit (on dual core parts) is cleared by
  * the core reset.
  */
-__attribute__((l1_text))
-static void _bfin_reset(void)
+__attribute__ ((__l1_text__, __noreturn__))
+static void bfin_reset(void)
 {
        /* Wait for completion of "system" events such as cache line
         * line fills so that we avoid infinite stalls later on as
@@ -30,7 +30,11 @@ static void _bfin_reset(void)
         */
        __builtin_bfin_ssync();
 
-       while (1) {
+       /* The bootrom checks to see how it was reset and will
+        * automatically perform a software reset for us when
+        * it starts executing after the core reset.
+        */
+       if (ANOMALY_05000353 || ANOMALY_05000386) {
                /* Initiate System software reset. */
                bfin_write_SWRST(0x7);
 
@@ -50,6 +54,11 @@ static void _bfin_reset(void)
                /* Clear System software reset */
                bfin_write_SWRST(0);
 
+               /* The BF526 ROM will crash during reset */
+#if defined(__ADSPBF522__) || defined(__ADSPBF524__) || defined(__ADSPBF526__)
+               bfin_read_SWRST();
+#endif
+
                /* Wait for the SWRST write to complete.  Cannot rely on SSYNC
                 * though as the System state is all reset now.
                 */
@@ -60,22 +69,11 @@ static void _bfin_reset(void)
                        : "a" (15 * 1)
                        : "LC1", "LB1", "LT1"
                );
+       }
 
+       while (1)
                /* Issue core reset */
                asm("raise 1");
-       }
-}
-
-static void bfin_reset(void)
-{
-       if (ANOMALY_05000353 || ANOMALY_05000386)
-               _bfin_reset();
-       else
-               /* the bootrom checks to see how it was reset and will
-                * automatically perform a software reset for us when
-                * it starts executing boot
-                */
-               asm("raise 1;");
 }
 
 __attribute__((weak))
index b2a811347b655070472857cac98e6f782c692a78..e5c11623080015fec2cf4a2f671639448f745277 100644 (file)
@@ -60,7 +60,7 @@ void __initdata *init_retx, *init_saved_retx, *init_saved_seqstat,
 #define BFIN_MEMMAP_MAX                128 /* number of entries in bfin_memmap */
 #define BFIN_MEMMAP_RAM                1
 #define BFIN_MEMMAP_RESERVED   2
-struct bfin_memmap {
+static struct bfin_memmap {
        int nr_map;
        struct bfin_memmap_entry {
                unsigned long long addr; /* start of memory segment */
@@ -824,7 +824,15 @@ void __init setup_arch(char **cmdline_p)
        flash_probe();
 #endif
 
+       printk(KERN_INFO "Boot Mode: %i\n", bfin_read_SYSCR() & 0xF);
+
+       /* Newer parts mirror SWRST bits in SYSCR */
+#if defined(CONFIG_BF53x) || defined(CONFIG_BF561) || \
+    defined(CONFIG_BF538) || defined(CONFIG_BF539)
        _bfin_swrst = bfin_read_SWRST();
+#else
+       _bfin_swrst = bfin_read_SYSCR();
+#endif
 
 #ifdef CONFIG_DEBUG_DOUBLEFAULT_PRINT
        bfin_write_SWRST(_bfin_swrst & ~DOUBLE_FAULT);
@@ -853,7 +861,7 @@ void __init setup_arch(char **cmdline_p)
        else if (_bfin_swrst & RESET_SOFTWARE)
                printk(KERN_NOTICE "Reset caused by Software reset\n");
 
-       printk(KERN_INFO "Blackfin support (C) 2004-2008 Analog Devices, Inc.\n");
+       printk(KERN_INFO "Blackfin support (C) 2004-2009 Analog Devices, Inc.\n");
        if (bfin_compiled_revid() == 0xffff)
                printk(KERN_INFO "Compiled for ADSP-%s Rev any\n", CPU);
        else if (bfin_compiled_revid() == -1)
index 5b0667da8d05ef3256c3b403111075028ef31bb7..ffe7fb53eccbdaccd344fbe27029fdc5bba12b14 100644 (file)
@@ -673,6 +673,14 @@ static void decode_instruction(unsigned short *address)
                        verbose_printk("RTI");
                else if (opcode == 0x0012)
                        verbose_printk("RTX");
+               else if (opcode == 0x0013)
+                       verbose_printk("RTN");
+               else if (opcode == 0x0014)
+                       verbose_printk("RTE");
+               else if (opcode == 0x0025)
+                       verbose_printk("EMUEXCPT");
+               else if (opcode == 0x0040 && opcode <= 0x0047)
+                       verbose_printk("STI R%i", opcode & 7);
                else if (opcode >= 0x0050 && opcode <= 0x0057)
                        verbose_printk("JUMP (P%i)", opcode & 7);
                else if (opcode >= 0x0060 && opcode <= 0x0067)
@@ -681,6 +689,10 @@ static void decode_instruction(unsigned short *address)
                        verbose_printk("CALL (PC+P%i)", opcode & 7);
                else if (opcode >= 0x0080 && opcode <= 0x0087)
                        verbose_printk("JUMP (PC+P%i)", opcode & 7);
+               else if (opcode >= 0x0090 && opcode <= 0x009F)
+                       verbose_printk("RAISE 0x%x", opcode & 0xF);
+               else if (opcode >= 0x00A0 && opcode <= 0x00AF)
+                       verbose_printk("EXCPT 0x%x", opcode & 0xF);
                else if ((opcode >= 0x1000 && opcode <= 0x13FF) || (opcode >= 0x1800 && opcode <= 0x1BFF))
                        verbose_printk("IF !CC JUMP");
                else if ((opcode >= 0x1400 && opcode <= 0x17ff) || (opcode >= 0x1c00 && opcode <= 0x1fff))
@@ -820,11 +832,8 @@ void show_stack(struct task_struct *task, unsigned long *stack)
        decode_address(buf, (unsigned int)stack);
        printk(KERN_NOTICE " SP: [0x%p] %s\n", stack, buf);
 
-       addr = (unsigned int *)((unsigned int)stack & ~0x3F);
-
        /* First thing is to look for a frame pointer */
-       for (addr = (unsigned int *)((unsigned int)stack & ~0xF), i = 0;
-               addr < endstack; addr++, i++) {
+       for (addr = (unsigned int *)((unsigned int)stack & ~0xF); addr < endstack; addr++) {
                if (*addr & 0x1)
                        continue;
                ins_addr = (unsigned short *)*addr;
@@ -834,7 +843,8 @@ void show_stack(struct task_struct *task, unsigned long *stack)
 
                if (fp) {
                        /* Let's check to see if it is a frame pointer */
-                       while (fp >= (addr - 1) && fp < endstack && fp)
+                       while (fp >= (addr - 1) && fp < endstack
+                              && fp && ((unsigned int) fp & 0x3) == 0)
                                fp = (unsigned int *)*fp;
                        if (fp == 0 || fp == endstack) {
                                fp = addr - 1;
@@ -1052,8 +1062,9 @@ void show_regs(struct pt_regs *fp)
        char buf [150];
        struct irqaction *action;
        unsigned int i;
-       unsigned long flags;
+       unsigned long flags = 0;
        unsigned int cpu = smp_processor_id();
+       unsigned char in_atomic = (bfin_read_IPEND() & 0x10) || in_atomic();
 
        verbose_printk(KERN_NOTICE "\n" KERN_NOTICE "SEQUENCER STATUS:\t\t%s\n", print_tainted());
        verbose_printk(KERN_NOTICE " SEQSTAT: %08lx  IPEND: %04lx  SYSCFG: %04lx\n",
@@ -1073,17 +1084,22 @@ void show_regs(struct pt_regs *fp)
        }
        verbose_printk(KERN_NOTICE "  EXCAUSE   : 0x%lx\n",
                fp->seqstat & SEQSTAT_EXCAUSE);
-       for (i = 6; i <= 15 ; i++) {
+       for (i = 2; i <= 15 ; i++) {
                if (fp->ipend & (1 << i)) {
-                       decode_address(buf, bfin_read32(EVT0 + 4*i));
-                       verbose_printk(KERN_NOTICE "  physical IVG%i asserted : %s\n", i, buf);
+                       if (i != 4) {
+                               decode_address(buf, bfin_read32(EVT0 + 4*i));
+                               verbose_printk(KERN_NOTICE "  physical IVG%i asserted : %s\n", i, buf);
+                       } else
+                               verbose_printk(KERN_NOTICE "  interrupts disabled\n");
                }
        }
 
        /* if no interrupts are going off, don't print this out */
        if (fp->ipend & ~0x3F) {
                for (i = 0; i < (NR_IRQS - 1); i++) {
-                       spin_lock_irqsave(&irq_desc[i].lock, flags);
+                       if (!in_atomic)
+                               spin_lock_irqsave(&irq_desc[i].lock, flags);
+
                        action = irq_desc[i].action;
                        if (!action)
                                goto unlock;
@@ -1096,7 +1112,8 @@ void show_regs(struct pt_regs *fp)
                        }
                        verbose_printk("\n");
 unlock:
-                       spin_unlock_irqrestore(&irq_desc[i].lock, flags);
+                       if (!in_atomic)
+                               spin_unlock_irqrestore(&irq_desc[i].lock, flags);
                }
        }
 
index 15f1351c8645834a680103f4e2141ad309950f99..0e175342112e45340d72fbe558234d97840027a2 100644 (file)
@@ -46,6 +46,7 @@
 #include <asm/dpmc.h>
 #include <asm/bfin_sdh.h>
 #include <linux/spi/ad7877.h>
+#include <net/dsa.h>
 
 /*
  * Name the Board for the /proc/cpuinfo
@@ -104,8 +105,31 @@ static struct platform_device rtc_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
+};
+#endif
+
+#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
+static struct dsa_platform_data ksz8893m_switch_data = {
+       .mii_bus = &bfin_mii_bus.dev,
+       .netdev = &bfin_mac_device.dev,
+       .port_names[0]  = NULL,
+       .port_names[1]  = "eth%d",
+       .port_names[2]  = "eth%d",
+       .port_names[3]  = "cpu",
+};
+
+static struct platform_device ksz8893m_switch_device = {
+       .name           = "dsa",
+       .id             = 0,
+       .num_resources  = 0,
+       .dev.platform_data = &ksz8893m_switch_data,
 };
 #endif
 
@@ -147,6 +171,15 @@ static struct bfin5xx_spi_chip spi_adc_chip_info = {
 };
 #endif
 
+#if defined(CONFIG_NET_DSA_KSZ8893M) \
+       || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
+/* SPI SWITCH CHIP */
+static struct bfin5xx_spi_chip spi_switch_info = {
+       .enable_dma = 0,
+       .bits_per_word = 8,
+};
+#endif
+
 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
 static struct bfin5xx_spi_chip spi_mmc_chip_info = {
        .enable_dma = 1,
@@ -226,6 +259,19 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
        },
 #endif
 
+#if defined(CONFIG_NET_DSA_KSZ8893M) \
+       || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
+       {
+               .modalias = "ksz8893m",
+               .max_speed_hz = 5000000,
+               .bus_num = 0,
+               .chip_select = 1,
+               .platform_data = NULL,
+               .controller_data = &spi_switch_info,
+               .mode = SPI_MODE_3,
+       },
+#endif
+
 #if defined(CONFIG_SPI_MMC) || defined(CONFIG_SPI_MMC_MODULE)
        {
                .modalias = "spi_mmc_dummy",
@@ -473,7 +519,6 @@ static struct platform_device i2c_bfin_twi_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
        {
@@ -487,7 +532,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -584,9 +628,14 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
+#if defined(CONFIG_NET_DSA_KSZ8893M) || defined(CONFIG_NET_DSA_KSZ8893M_MODULE)
+       &ksz8893m_switch_device,
+#endif
+
 #if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
        &bfin_spi0_device,
        &bfin_spi1_device,
@@ -632,12 +681,8 @@ static struct platform_device *stamp_devices[] __initdata = {
 static int __init ezbrd_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
        return 0;
@@ -649,7 +694,7 @@ void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 void bfin_get_ether_addr(char *addr)
index ac16d54734d4cfd8fa7ced7934fc7390117fe6c9..f618b487b2b0eabd96d03e1be423b282122770ca 100644 (file)
 #define P_SPI1_SSEL4   (P_DEFINED | P_IDENT(GPIO_PF8) | P_FUNCT(2))
 #define P_SPI1_SSEL5   (P_DEFINED | P_IDENT(GPIO_PG11) | P_FUNCT(2))
 
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
+
 /* SPORT Port Mux */
 #define P_SPORT0_DRPRI (P_DEFINED | P_IDENT(GPIO_PG3) | P_FUNCT(0))
 #define P_SPORT0_RSCLK (P_DEFINED | P_IDENT(GPIO_PG4) | P_FUNCT(0))
index a2c3578f4b6c8a82ee9b50e4836af895ddefca36..856c097b5317eda49cc70cf8456f8dfee1bfbc6c 100644 (file)
@@ -403,8 +403,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -793,7 +798,6 @@ static struct platform_device i2c_bfin_twi_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
        {
@@ -809,7 +813,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -920,6 +923,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -968,27 +972,23 @@ static struct platform_device *stamp_devices[] __initdata = {
        &bfin_gpios_device,
 };
 
-static int __init stamp_init(void)
+static int __init cm_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(cm_init);
 
 void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 void bfin_get_ether_addr(char *addr)
index 0314bd3355eba4a76123c21ad2b51b625c5e324b..83606fcdde2757ea8a6d7361864c27c7d2240b9c 100644 (file)
@@ -208,8 +208,13 @@ static struct platform_device rtc_device = {
 
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -590,7 +595,6 @@ static struct platform_device i2c_bfin_twi_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
        {
@@ -604,7 +608,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -720,6 +723,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -764,27 +768,23 @@ static struct platform_device *stamp_devices[] __initdata = {
        &bfin_gpios_device,
 };
 
-static int __init stamp_init(void)
+static int __init ezbrd_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(ezbrd_init);
 
 void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 void bfin_get_ether_addr(char *addr)
index 9454fb7b18c3e4d403f5fb09acbfb38b4f682fa8..d0864111ef594f3b05ed613c31d18251c87961c3 100644 (file)
@@ -425,8 +425,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -830,7 +835,6 @@ static struct platform_device i2c_bfin_twi_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_TWI_LCD) || defined(CONFIG_TWI_LCD_MODULE)
        {
@@ -844,7 +848,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -988,6 +991,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -1048,27 +1052,23 @@ static struct platform_device *stamp_devices[] __initdata = {
        &bfin_gpios_device,
 };
 
-static int __init stamp_init(void)
+static int __init ezkit_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(ezkit_init);
 
 void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 void bfin_get_ether_addr(char *addr)
index 7f6da2c386bb80c3072fc8bf4ba1176b4a0e0c40..72b1652be4dabe6abd500ba11569e411ebc14600 100644 (file)
@@ -73,6 +73,8 @@
 
 #define P_HWAIT                (P_DONTCARE)
 
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
+
 #define P_SPI0_SS      (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0))
 #define P_SPI0_SSEL1   (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(2))
 #define P_SPI0_SCK     (P_DEFINED | P_IDENT(GPIO_PG2) | P_FUNCT(2))
index 6ee607c259acfb933fa3ecb3f46a410badb7d211..015c18f85e7faf2d272c2fc5dffb6cdc89547a44 100644 (file)
@@ -309,10 +309,8 @@ static struct platform_device i2c_gpio_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 };
-#endif
 
 static const unsigned int cclk_vlev_datasheet[] =
 {
@@ -390,10 +388,8 @@ static int __init blackstamp_init(void)
 
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
 
        ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        if (ret < 0)
index 07f9ad1e189c4c66d44d27c0810d7066476577ac..db96f33f72e238ee5d4c64178232859a692645cf 100644 (file)
@@ -441,7 +441,6 @@ static struct platform_device i2c_gpio_device = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
        {
@@ -461,7 +460,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 static const unsigned int cclk_vlev_datasheet[] =
 {
@@ -550,10 +548,8 @@ static int __init stamp_init(void)
 
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
 
        ret = platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        if (ret < 0)
index 685a2651dcda305d07ae85525e4ed1af96965740..2f59ce0b0cb5400319b64b61176aeb96f239bf7b 100644 (file)
 #define P_SPI0_SSEL2   (P_DEFINED | P_IDENT(GPIO_PF2))
 #define P_SPI0_SSEL1   (P_DEFINED | P_IDENT(GPIO_PF1))
 #define P_SPI0_SS      (P_DEFINED | P_IDENT(GPIO_PF0))
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
 
 #define P_TMR2         (P_DONTCARE)
 #define P_TMR1         (P_DONTCARE)
 #define P_TMR0         (P_DONTCARE)
 #define P_TMRCLK       (P_DEFINED | P_IDENT(GPIO_PF1))
 
-
-
-
-
 #endif /* _MACH_PORTMUX_H_ */
index 6ac8e4d5bd386dadc8d108531d29c4d81250d6a3..9cd8fb2a30d32ba3d81ef2409e9078df884b55f0 100644 (file)
@@ -479,8 +479,13 @@ static struct platform_device bfin_sport1_uart_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -591,6 +596,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
index dd6e6bfb98eadf00d33ba184ab4f99c316cc537b..da710fdc4569d46963e77e2ed4ec428a480797ed 100644 (file)
@@ -262,8 +262,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -662,6 +667,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -708,7 +714,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 };
 
-static int __init stamp_init(void)
+static int __init generic_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
@@ -720,13 +726,13 @@ static int __init stamp_init(void)
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(generic_init);
 
 void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
index bb795341cb178545c7437501e87a5a829c07b189..db7d3a385e4bda4ade36365ca439080a3c4787aa 100644 (file)
@@ -61,8 +61,13 @@ static struct platform_device rtc_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -324,6 +329,7 @@ static struct platform_device *minotaur_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -377,5 +383,5 @@ void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
index 89de94f4545dae898a4e40ed2da71fd504d72db9..590eb3a139b7a7542a070aa4b885a561997c188a 100644 (file)
@@ -198,8 +198,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -529,6 +534,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -558,7 +564,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 };
 
-static int __init stamp_init(void)
+static int __init pnav_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
@@ -569,7 +575,7 @@ static int __init stamp_init(void)
        return 0;
 }
 
-arch_initcall(stamp_init);
+arch_initcall(pnav_init);
 
 void bfin_get_ether_addr(char *addr)
 {
index d812e2514a2f6b5c09a637cfd3d676753b78ee99..cd04c5e448788ab811f77f8681d0cba87a461f45 100644 (file)
@@ -321,8 +321,13 @@ static struct platform_device isp1362_hcd_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -1068,7 +1073,6 @@ static struct adp5588_kpad_platform_data adp5588_kpad_data = {
 };
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
 #if defined(CONFIG_JOYSTICK_AD7142) || defined(CONFIG_JOYSTICK_AD7142_MODULE)
        {
@@ -1102,7 +1106,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
        },
 #endif
 };
-#endif
 
 #if defined(CONFIG_SERIAL_BFIN_SPORT) || defined(CONFIG_SERIAL_BFIN_SPORT_MODULE)
 static struct platform_device bfin_sport0_uart_device = {
@@ -1217,6 +1220,7 @@ static struct platform_device *stamp_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -1284,12 +1288,8 @@ static struct platform_device *stamp_devices[] __initdata = {
 static int __init stamp_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
-
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info,
                                ARRAY_SIZE(bfin_i2c_board_info));
-#endif
-
        bfin_plat_nand_init();
        platform_add_devices(stamp_devices, ARRAY_SIZE(stamp_devices));
        spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
@@ -1307,7 +1307,7 @@ void native_machine_restart(char *cmd)
 {
        /* workaround reboot hang when booting from SPI */
        if ((bfin_read_SYSCR() & 0x7) == 0x3)
-               bfin_gpio_reset_spi0_ssel1();
+               bfin_reset_boot_spi_cs(P_DEFAULT_BOOT_SPI_CS);
 }
 
 /*
index 2f4b066153c52dd87185607797d9f5ee106d3024..3f4f203a06ec9b0c0ffb570d7e00b8e1b611db60 100644 (file)
@@ -481,8 +481,13 @@ static struct platform_device bfin_sport1_uart_device = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+static struct platform_device bfin_mii_bus = {
+       .name = "bfin_mii_bus",
+};
+
 static struct platform_device bfin_mac_device = {
        .name = "bfin_mac",
+       .dev.platform_data = &bfin_mii_bus,
 };
 #endif
 
@@ -593,6 +598,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
 #endif
 
 #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)
+       &bfin_mii_bus,
        &bfin_mac_device,
 #endif
 
@@ -615,7 +621,7 @@ static struct platform_device *cm_bf537_devices[] __initdata = {
        &bfin_gpios_device,
 };
 
-static int __init cm_bf537_init(void)
+static int __init tcm_bf537_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
        platform_add_devices(cm_bf537_devices, ARRAY_SIZE(cm_bf537_devices));
@@ -629,7 +635,7 @@ static int __init cm_bf537_init(void)
        return 0;
 }
 
-arch_initcall(cm_bf537_init);
+arch_initcall(tcm_bf537_init);
 
 void bfin_get_ether_addr(char *addr)
 {
index 78fee6e0f23730cb2fc621b80ede4cb4f3fa21df..87285e75e903107e04d1eab8e168c6c742d0b218 100644 (file)
@@ -31,6 +31,7 @@
 #define P_PPI0_FS1     (P_DEFINED | P_IDENT(GPIO_PF9) | P_FUNCT(1))
 #define P_TACLK0       (P_DEFINED | P_IDENT(GPIO_PF14) | P_FUNCT(1))
 #define P_TMRCLK       (P_DEFINED | P_IDENT(GPIO_PF15) | P_FUNCT(1))
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
 
 #define P_PPI0_D0      (P_DEFINED | P_IDENT(GPIO_PG0) | P_FUNCT(0))
 #define P_PPI0_D1      (P_DEFINED | P_IDENT(GPIO_PG1) | P_FUNCT(0))
index 1e031b588b47bce7ee8fa0ca40700c446e504d71..c8db264e3e4d83779f17faa2e543470ae9d5ad2b 100644 (file)
 #define P_SPI0_SSEL2   (P_DEFINED | P_IDENT(GPIO_PF2))
 #define P_SPI0_SSEL1   (P_DEFINED | P_IDENT(GPIO_PF1))
 #define P_SPI0_SS      (P_DEFINED | P_IDENT(GPIO_PF0))
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
 
 #endif /* _MACH_PORTMUX_H_ */
index 309c16014caea54d8582f8dfc222e36a08eb78ab..096e661700a7d666ab4534edbdb847a83975100f 100644 (file)
@@ -781,7 +781,6 @@ static struct platform_device i2c_bfin_twi1_device = {
 #endif
 #endif
 
-#ifdef CONFIG_I2C_BOARDINFO
 static struct i2c_board_info __initdata bfin_i2c_board_info0[] = {
 };
 
@@ -800,7 +799,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info1[] = {
 #endif
 };
 #endif
-#endif
 
 #if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
 #include <linux/gpio_keys.h>
@@ -956,13 +954,11 @@ static int __init ezkit_init(void)
 {
        printk(KERN_INFO "%s(): registering device resources\n", __func__);
 
-#ifdef CONFIG_I2C_BOARDINFO
        i2c_register_board_info(0, bfin_i2c_board_info0,
                                ARRAY_SIZE(bfin_i2c_board_info0));
 #if !defined(CONFIG_BF542)     /* The BF542 only has 1 TWI */
        i2c_register_board_info(1, bfin_i2c_board_info1,
                                ARRAY_SIZE(bfin_i2c_board_info1));
-#endif
 #endif
 
        platform_add_devices(ezkit_devices, ARRAY_SIZE(ezkit_devices));
index 3b5430999f4f8f4f3c75eb577a06250b7355b6a4..23d03c52f4b46df8d8a7e5aa7c638a8d5e0d7889 100644 (file)
 #define ANOMALY_05000311 (0)
 #define ANOMALY_05000323 (0)
 #define ANOMALY_05000363 (0)
+#define ANOMALY_05000380 (0)
 #define ANOMALY_05000412 (0)
 #define ANOMALY_05000432 (0)
 #define ANOMALY_05000435 (0)
index f0e569984810e751a682d09909f41e6a5579f654..cd31f72bdd820e70ad22732d89ca17a9e45e62f1 100644 (file)
 
 #define AMGCTLVAL      (V_AMBEN | V_AMCKEN)
 
+#if defined(CONFIG_BF542M)
+# define CONFIG_BF542
+#elif defined(CONFIG_BF544M)
+# define CONFIG_BF544
+#elif defined(CONFIG_BF547M)
+# define CONFIG_BF547
+#elif defined(CONFIG_BF548M)
+# define CONFIG_BF548
+#elif defined(CONFIG_BF549M)
+# define CONFIG_BF549
+#endif
+
 #if defined(CONFIG_BF542)
 # define CPU   "BF542"
 # define CPUID 0x27de
index bba82dc75f16be127fabab1d5d96559d4c57044f..3a2051709787d0c24c8c5b33292a8b6b30014290 100644 (file)
 struct gpio_port_t {
        unsigned short port_fer;
        unsigned short dummy1;
-       unsigned short port_data;
+       unsigned short data;
        unsigned short dummy2;
-       unsigned short port_set;
+       unsigned short data_set;
        unsigned short dummy3;
-       unsigned short port_clear;
+       unsigned short data_clear;
        unsigned short dummy4;
-       unsigned short port_dir_set;
+       unsigned short dir_set;
        unsigned short dummy5;
-       unsigned short port_dir_clear;
+       unsigned short dir_clear;
        unsigned short dummy6;
-       unsigned short port_inen;
+       unsigned short inen;
        unsigned short dummy7;
        unsigned int port_mux;
 };
index 8177a567dcdbd0eae89c16f13e409ea838ea49b2..ffb1d0a44b4d798e9f83df9a2e5e9b4c02b5d155 100644 (file)
 #define P_KEY_COL2     (P_DEFINED | P_IDENT(GPIO_PD14) | P_FUNCT(3))
 #define P_KEY_COL3     (P_DEFINED | P_IDENT(GPIO_PD15) | P_FUNCT(3))
 
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL1
 #define P_SPI0_SCK     (P_DEFINED | P_IDENT(GPIO_PE0) | P_FUNCT(0))
 #define P_SPI0_MISO    (P_DEFINED | P_IDENT(GPIO_PE1) | P_FUNCT(0))
 #define P_SPI0_MOSI    (P_DEFINED | P_IDENT(GPIO_PE2) | P_FUNCT(0))
index d7c509759659b604800ff9b5bca337975f32f6c2..cf922295f4ce61902a1e959c8ae74f5522592121 100644 (file)
 #define DLEN_8              0x0        /* PPI Data Length mask for DLEN=8 */
 #define DLEN(x)        (((x-9) & 0x07) << 11)  /* PPI Data Length (only works for x=10-->x=16) */
 #define POL                  0x0000C000        /* PPI Signal Polarities       */
+#define        POLC            0x4000          /* PPI Clock Polarity */
+#define        POLS            0x8000          /* PPI Frame Sync Polarity */
 
 /* PPI_STATUS Masks */
 #define FLD                 0x00000400 /* Field Indicator   */
index a6ee8206efb6dd9a68337a4fab2afa5fb9d1f97c..2e5ad6347dea74738fd56b3cb04cf8032a9feb3c 100644 (file)
@@ -85,5 +85,6 @@
 #define P_SPI0_MOSI    (P_DONTCARE)
 #define P_SPI0_MISO    (P_DONTCARE)
 #define P_SPI0_SCK     (P_DONTCARE)
+#define P_DEFAULT_BOOT_SPI_CS P_SPI0_SSEL2
 
 #endif /* _MACH_PORTMUX_H_ */
index 5d182abefc7bb25b2f0c361acf5ec6c8b65fa818..9dddb6f8cc855296c5e98213bc45b8d76d123276 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/clocks.h>
 #include <asm/mem_init.h>
 
+#define SDGCTL_WIDTH (1 << 31) /* SDRAM external data path width */
 #define PLL_CTL_VAL \
        (((CONFIG_VCO_MULT & 63) << 9) | CLKIN_HALF | \
         (PLL_BYPASS << 8) | (ANOMALY_05000265 ? 0x8000 : 0))
@@ -76,7 +77,7 @@ void init_clocks(void)
        bfin_write_PLL_DIV(CONFIG_CCLK_ACT_DIV | CONFIG_SCLK_DIV);
 #ifdef EBIU_SDGCTL
        bfin_write_EBIU_SDRRC(mem_SDRRC);
-       bfin_write_EBIU_SDGCTL(mem_SDGCTL);
+       bfin_write_EBIU_SDGCTL((bfin_read_EBIU_SDGCTL() & SDGCTL_WIDTH) | mem_SDGCTL);
 #else
        bfin_write_EBIU_RSTCTL(bfin_read_EBIU_RSTCTL() & ~(SRREQ));
        do_sync();
index fae77465137457f40e120b2b090e0ffbf5853124..88de053bbe8ed58dcdb6e7b4bad80657a3e011db 100644 (file)
@@ -151,13 +151,6 @@ ENTRY(_ex_syscall)
        jump.s _bfin_return_from_exception;
 ENDPROC(_ex_syscall)
 
-ENTRY(_ex_soft_bp)
-       r7 = retx;
-       r7 += -2;
-       retx = r7;
-       jump.s _ex_trap_c;
-ENDPROC(_ex_soft_bp)
-
 ENTRY(_ex_single_step)
        /* If we just returned from an interrupt, the single step event is
           for the RTI instruction.  */
@@ -1087,7 +1080,7 @@ ENTRY(_ex_table)
         * EXCPT instruction can provide 4 bits of EXCAUSE, allowing 16 to be user defined
         */
        .long _ex_syscall       /* 0x00 - User Defined - Linux Syscall */
-       .long _ex_soft_bp       /* 0x01 - User Defined - Software breakpoint */
+       .long _ex_trap_c        /* 0x01 - User Defined - Software breakpoint */
 #ifdef CONFIG_KGDB
        .long _ex_trap_c        /* 0x02 - User Defined - KGDB initial connection
                                                         and break signal trap */
index e1e42c029e15ba3d90dd2f9dbe60fb5a85531d20..698d4c05947e8ba48a21320344a8fc3f93162c00 100644 (file)
 
 __INIT
 
+ENTRY(__init_clear_bss)
+       r2 = r2 - r1;
+       cc = r2 == 0;
+       if cc jump .L_bss_done;
+       r2 >>= 2;
+       p1 = r1;
+       p2 = r2;
+       lsetup (1f, 1f) lc0 = p2;
+1:     [p1++] = r0;
+.L_bss_done:
+       rts;
+ENDPROC(__init_clear_bss)
+
 #define INITIAL_STACK  (L1_SCRATCH_START + L1_SCRATCH_LENGTH - 12)
 
 ENTRY(__start)
@@ -144,6 +157,35 @@ ENTRY(__start)
        call _init_early_exception_vectors;
 #endif
 
+       r0 = 0 (x);
+       /* Zero out all of the fun bss regions */
+#if L1_DATA_A_LENGTH > 0
+       r1.l = __sbss_l1;
+       r1.h = __sbss_l1;
+       r2.l = __ebss_l1;
+       r2.h = __ebss_l1;
+       call __init_clear_bss
+#endif
+#if L1_DATA_B_LENGTH > 0
+       r1.l = __sbss_b_l1;
+       r1.h = __sbss_b_l1;
+       r2.l = __ebss_b_l1;
+       r2.h = __ebss_b_l1;
+       call __init_clear_bss
+#endif
+#if L2_LENGTH > 0
+       r1.l = __sbss_l2;
+       r1.h = __sbss_l2;
+       r2.l = __ebss_l2;
+       r2.h = __ebss_l2;
+       call __init_clear_bss
+#endif
+       r1.l = ___bss_start;
+       r1.h = ___bss_start;
+       r2.l = ___bss_stop;
+       r2.h = ___bss_stop;
+       call __init_clear_bss
+
        /* Put The Code for PLL Programming and SDRAM Programming in L1 ISRAM */
        call _bfin_relocate_l1_mem;
 #ifdef CONFIG_BFIN_KERNEL_CLOCK
@@ -185,19 +227,6 @@ ENDPROC(__start)
 # define WDOG_CTL WDOGA_CTL
 #endif
 
-ENTRY(__init_clear_bss)
-       r2 = r2 - r1;
-       cc = r2 == 0;
-       if cc jump .L_bss_done;
-       r2 >>= 2;
-       p1 = r1;
-       p2 = r2;
-       lsetup (1f, 1f) lc0 = p2;
-1:     [p1++] = r0;
-.L_bss_done:
-       rts;
-ENDPROC(__init_clear_bss)
-
 ENTRY(_real_start)
        /* Enable nested interrupts */
        [--sp] = reti;
@@ -209,35 +238,6 @@ ENTRY(_real_start)
        w[p0] = r0;
        ssync;
 
-       r0 = 0 (x);
-       /* Zero out all of the fun bss regions */
-#if L1_DATA_A_LENGTH > 0
-       r1.l = __sbss_l1;
-       r1.h = __sbss_l1;
-       r2.l = __ebss_l1;
-       r2.h = __ebss_l1;
-       call __init_clear_bss
-#endif
-#if L1_DATA_B_LENGTH > 0
-       r1.l = __sbss_b_l1;
-       r1.h = __sbss_b_l1;
-       r2.l = __ebss_b_l1;
-       r2.h = __ebss_b_l1;
-       call __init_clear_bss
-#endif
-#if L2_LENGTH > 0
-       r1.l = __sbss_l2;
-       r1.h = __sbss_l2;
-       r2.l = __ebss_l2;
-       r2.h = __ebss_l2;
-       call __init_clear_bss
-#endif
-       r1.l = ___bss_start;
-       r1.h = ___bss_start;
-       r2.l = ___bss_stop;
-       r2.h = ___bss_stop;
-       call __init_clear_bss
-
        /* Pass the u-boot arguments to the global value command line */
        R0 = R7;
        call _cmdline_init;
index 473df0f7fa78cdeb896fd404a54b8160f4823804..43c4eb9acb65e11b0ce1c0fdc480cb1849005a4d 100644 (file)
@@ -195,7 +195,7 @@ ENDPROC(_evt_ivhw)
 /* Interrupt routine for evt2 (NMI).
  * We don't actually use this, so just return.
  * For inner circle type details, please see:
- * http://docs.blackfin.uclinux.org/doku.php?id=linux:nmi
+ * http://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:nmi
  */
 ENTRY(_evt_nmi)
 .weak _evt_nmi
index 1bba6030dce97e7d3521e6cf43c45e03c9118755..202494568c6c0303b76cafb279b1b06f97fc9963 100644 (file)
@@ -1101,10 +1101,9 @@ int __init init_arch_irq(void)
            IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
            IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
 
-#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \
-       || defined(BF538_FAMILY) || defined(CONFIG_BF51x)
+#ifdef SIC_IWR0
        bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
-#if defined(CONFIG_BF52x) || defined(CONFIG_BF51x)
+# ifdef SIC_IWR1
        /* BF52x/BF51x system reset does not properly reset SIC_IWR1 which
         * will screw up the bootrom as it relies on MDMA0/1 waking it
         * up from IDLE instructions.  See this report for more info:
@@ -1114,10 +1113,8 @@ int __init init_arch_irq(void)
                bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
        else
                bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
-#else
-       bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
-#endif
-# ifdef CONFIG_BF54x
+# endif
+# ifdef SIC_IWR2
        bfin_write_SIC_IWR2(IWR_DISABLE_ALL);
 # endif
 #else
index d3d70fd67c16190519693867521890acb95a62e9..f48a6aebb49b4e75abb7919a209c742f3e2b4369 100644 (file)
@@ -82,10 +82,9 @@ void bfin_pm_suspend_standby_enter(void)
 
        bfin_pm_standby_restore();
 
-#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x)  || defined(CONFIG_BF561) || \
-       defined(CONFIG_BF538) || defined(CONFIG_BF539) || defined(CONFIG_BF51x)
+#ifdef SIC_IWR0
        bfin_write_SIC_IWR0(IWR_DISABLE_ALL);
-#if defined(CONFIG_BF52x) || defined(CONFIG_BF51x)
+# ifdef SIC_IWR1
        /* BF52x system reset does not properly reset SIC_IWR1 which
         * will screw up the bootrom as it relies on MDMA0/1 waking it
         * up from IDLE instructions.  See this report for more info:
@@ -95,10 +94,8 @@ void bfin_pm_suspend_standby_enter(void)
                bfin_write_SIC_IWR1(IWR_ENABLE(10) | IWR_ENABLE(11));
        else
                bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
-#else
-       bfin_write_SIC_IWR1(IWR_DISABLE_ALL);
-#endif
-# ifdef CONFIG_BF54x
+# endif
+# ifdef SIC_IWR2
        bfin_write_SIC_IWR2(IWR_DISABLE_ALL);
 # endif
 #else
index 9df0ca82f5dedf90437954406dc201e1d073f898..d5cf740054082d5ca51fd184bd9d88cef4d5e4bb 100644 (file)
@@ -56,6 +56,9 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_SOCKET_H */
 
 
index dc6522c464d4719d3f72558127cd654840ae035d..44840e73e90756c13a670a59321549d4b14c3efc 100644 (file)
 #include <linux/vmalloc.h>
 #include <linux/init.h>
 #include <linux/pci.h>
+#include <linux/hardirq.h>
 
 #include <asm/pgalloc.h>
 #include <asm/io.h>
-#include <asm/hardirq.h>
 #include <asm/mmu_context.h>
 #include <asm/pgtable.h>
 #include <asm/mmu.h>
index da2520dbf2547e2643af27749b178e7e5a4dd0eb..602518a70a1a4a32d4771e869b884f3becc6721e 100644 (file)
@@ -54,4 +54,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_SOCKET_H */
index 6183aeccecf1f9d564cc2bc2832943a235ed3871..4eb45c0124986279a35d33731a71fcdaf72d53aa 100644 (file)
@@ -221,7 +221,11 @@ config IA64_HP_SIM
 
 config IA64_XEN_GUEST
        bool "Xen guest"
+       select SWIOTLB
        depends on XEN
+       help
+         Build a kernel that runs on Xen guest domain. At this moment only
+         16KB page size in supported.
 
 endchoice
 
@@ -479,8 +483,7 @@ config HOLES_IN_ZONE
        default y if VIRTUAL_MEM_MAP
 
 config HAVE_ARCH_EARLY_PFN_TO_NID
-       def_bool y
-       depends on NEED_MULTIPLE_NODES
+       def_bool NUMA && SPARSEMEM
 
 config HAVE_ARCH_NODEDATA_EXTENSION
        def_bool y
diff --git a/arch/ia64/configs/xen_domu_defconfig b/arch/ia64/configs/xen_domu_defconfig
new file mode 100644 (file)
index 0000000..0bb0714
--- /dev/null
@@ -0,0 +1,1601 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.29-rc1
+# Fri Jan 16 11:49:59 2009
+#
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+CONFIG_POSIX_MQUEUE=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=20
+CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
+# CONFIG_GROUP_SCHED is not set
+
+#
+# Control Group support
+#
+# CONFIG_CGROUPS is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_RELAY is not set
+CONFIG_NAMESPACES=y
+# CONFIG_UTS_NS is not set
+# CONFIG_IPC_NS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
+# CONFIG_EMBEDDED is not set
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+CONFIG_KALLSYMS_STRIP_GENERATED=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_COMPAT_BRK=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_PCI_QUIRKS=y
+CONFIG_SLUB_DEBUG=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_MODVERSIONS=y
+CONFIG_MODULE_SRCVERSION_ALL=y
+CONFIG_STOP_MACHINE=y
+CONFIG_BLOCK=y
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
+CONFIG_FREEZER=y
+
+#
+# Processor type and features
+#
+CONFIG_IA64=y
+CONFIG_64BIT=y
+CONFIG_ZONE_DMA=y
+CONFIG_QUICKLIST=y
+CONFIG_MMU=y
+CONFIG_SWIOTLB=y
+CONFIG_IOMMU_HELPER=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_HAVE_SETUP_PER_CPU_AREA=y
+CONFIG_DMI=y
+CONFIG_EFI=y
+CONFIG_GENERIC_IOMAP=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_AUDIT_ARCH=y
+CONFIG_PARAVIRT_GUEST=y
+CONFIG_PARAVIRT=y
+CONFIG_XEN=y
+CONFIG_XEN_XENCOMM=y
+CONFIG_NO_IDLE_HZ=y
+# CONFIG_IA64_GENERIC is not set
+# CONFIG_IA64_DIG is not set
+# CONFIG_IA64_DIG_VTD is not set
+# CONFIG_IA64_HP_ZX1 is not set
+# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
+# CONFIG_IA64_SGI_SN2 is not set
+# CONFIG_IA64_SGI_UV is not set
+# CONFIG_IA64_HP_SIM is not set
+CONFIG_IA64_XEN_GUEST=y
+# CONFIG_ITANIUM is not set
+CONFIG_MCKINLEY=y
+# CONFIG_IA64_PAGE_SIZE_4KB is not set
+# CONFIG_IA64_PAGE_SIZE_8KB is not set
+CONFIG_IA64_PAGE_SIZE_16KB=y
+# CONFIG_IA64_PAGE_SIZE_64KB is not set
+CONFIG_PGTABLE_3=y
+# CONFIG_PGTABLE_4 is not set
+CONFIG_HZ=250
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+# CONFIG_SCHED_HRTICK is not set
+CONFIG_IA64_L1_CACHE_SHIFT=7
+CONFIG_IA64_CYCLONE=y
+CONFIG_IOSAPIC=y
+CONFIG_FORCE_MAX_ZONEORDER=17
+# CONFIG_VIRT_CPU_ACCOUNTING is not set
+CONFIG_SMP=y
+CONFIG_NR_CPUS=16
+CONFIG_HOTPLUG_CPU=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+# CONFIG_SCHED_SMT is not set
+CONFIG_PERMIT_BSP_REMOVE=y
+CONFIG_FORCE_CPEI_RETARGET=y
+CONFIG_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_MIGRATION=y
+CONFIG_PHYS_ADDR_T_64BIT=y
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_NR_QUICK=1
+CONFIG_VIRT_TO_BUS=y
+CONFIG_UNEVICTABLE_LRU=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
+CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+CONFIG_VIRTUAL_MEM_MAP=y
+CONFIG_HOLES_IN_ZONE=y
+# CONFIG_IA32_SUPPORT is not set
+# CONFIG_COMPAT_FOR_U64_ALIGNMENT is not set
+CONFIG_IA64_MCA_RECOVERY=y
+CONFIG_PERFMON=y
+CONFIG_IA64_PALINFO=y
+# CONFIG_IA64_MC_ERR_INJECT is not set
+# CONFIG_IA64_ESI is not set
+# CONFIG_IA64_HP_AML_NFW is not set
+CONFIG_KEXEC=y
+# CONFIG_CRASH_DUMP is not set
+
+#
+# Firmware Drivers
+#
+# CONFIG_FIRMWARE_MEMMAP is not set
+CONFIG_EFI_VARS=y
+CONFIG_EFI_PCDP=y
+CONFIG_DMIID=y
+CONFIG_BINFMT_ELF=y
+# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
+# CONFIG_HAVE_AOUT is not set
+CONFIG_BINFMT_MISC=m
+
+#
+# Power management and ACPI options
+#
+CONFIG_PM=y
+# CONFIG_PM_DEBUG is not set
+CONFIG_PM_SLEEP=y
+CONFIG_SUSPEND=y
+CONFIG_SUSPEND_FREEZER=y
+CONFIG_ACPI=y
+CONFIG_ACPI_SLEEP=y
+CONFIG_ACPI_PROCFS=y
+CONFIG_ACPI_PROCFS_POWER=y
+CONFIG_ACPI_SYSFS_POWER=y
+CONFIG_ACPI_PROC_EVENT=y
+CONFIG_ACPI_BUTTON=m
+CONFIG_ACPI_FAN=m
+# CONFIG_ACPI_DOCK is not set
+CONFIG_ACPI_PROCESSOR=m
+CONFIG_ACPI_HOTPLUG_CPU=y
+CONFIG_ACPI_THERMAL=m
+# CONFIG_ACPI_CUSTOM_DSDT is not set
+CONFIG_ACPI_BLACKLIST_YEAR=0
+# CONFIG_ACPI_DEBUG is not set
+# CONFIG_ACPI_PCI_SLOT is not set
+CONFIG_ACPI_SYSTEM=y
+CONFIG_ACPI_CONTAINER=m
+
+#
+# CPU Frequency scaling
+#
+# CONFIG_CPU_FREQ is not set
+
+#
+# Bus options (PCI, PCMCIA)
+#
+CONFIG_PCI=y
+CONFIG_PCI_DOMAINS=y
+CONFIG_PCI_SYSCALL=y
+# CONFIG_PCIEPORTBUS is not set
+CONFIG_ARCH_SUPPORTS_MSI=y
+# CONFIG_PCI_MSI is not set
+CONFIG_PCI_LEGACY=y
+# CONFIG_PCI_DEBUG is not set
+# CONFIG_PCI_STUB is not set
+CONFIG_HOTPLUG_PCI=m
+# CONFIG_HOTPLUG_PCI_FAKE is not set
+CONFIG_HOTPLUG_PCI_ACPI=m
+# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
+# CONFIG_HOTPLUG_PCI_CPCI is not set
+# CONFIG_HOTPLUG_PCI_SHPC is not set
+# CONFIG_PCCARD is not set
+CONFIG_NET=y
+
+#
+# Networking options
+#
+# CONFIG_NET_NS is not set
+CONFIG_COMPAT_NET_DEV_OPS=y
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER is not set
+# CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
+# CONFIG_XFRM_STATISTICS is not set
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+# CONFIG_IP_PNP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
+CONFIG_ARPD=y
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+CONFIG_INET_XFRM_MODE_TRANSPORT=y
+CONFIG_INET_XFRM_MODE_TUNNEL=y
+CONFIG_INET_XFRM_MODE_BEET=y
+# CONFIG_INET_LRO is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+# CONFIG_PHONET is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+CONFIG_FIRMWARE_IN_KERNEL=y
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+# CONFIG_PARPORT is not set
+CONFIG_PNP=y
+CONFIG_PNP_DEBUG_MESSAGES=y
+
+#
+# Protocols
+#
+CONFIG_PNPACPI=y
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_CPQ_DA is not set
+# CONFIG_BLK_CPQ_CISS_DA is not set
+# CONFIG_BLK_DEV_DAC960 is not set
+# CONFIG_BLK_DEV_UMEM is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=m
+CONFIG_BLK_DEV_CRYPTOLOOP=m
+CONFIG_BLK_DEV_NBD=m
+# CONFIG_BLK_DEV_SX8 is not set
+# CONFIG_BLK_DEV_UB is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+CONFIG_XEN_BLKDEV_FRONTEND=y
+# CONFIG_BLK_DEV_HD is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_PHANTOM is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_SGI_IOC4 is not set
+# CONFIG_TIFM_CORE is not set
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_HP_ILO is not set
+# CONFIG_C2PORT is not set
+CONFIG_HAVE_IDE=y
+CONFIG_IDE=y
+
+#
+# Please see Documentation/ide/ide.txt for help/info on IDE drives
+#
+CONFIG_IDE_TIMINGS=y
+CONFIG_IDE_ATAPI=y
+# CONFIG_BLK_DEV_IDE_SATA is not set
+CONFIG_IDE_GD=y
+CONFIG_IDE_GD_ATA=y
+# CONFIG_IDE_GD_ATAPI is not set
+CONFIG_BLK_DEV_IDECD=y
+CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
+# CONFIG_BLK_DEV_IDETAPE is not set
+# CONFIG_BLK_DEV_IDEACPI is not set
+# CONFIG_IDE_TASK_IOCTL is not set
+CONFIG_IDE_PROC_FS=y
+
+#
+# IDE chipset support/bugfixes
+#
+# CONFIG_IDE_GENERIC is not set
+# CONFIG_BLK_DEV_PLATFORM is not set
+# CONFIG_BLK_DEV_IDEPNP is not set
+CONFIG_BLK_DEV_IDEDMA_SFF=y
+
+#
+# PCI IDE chipsets support
+#
+CONFIG_BLK_DEV_IDEPCI=y
+CONFIG_IDEPCI_PCIBUS_ORDER=y
+# CONFIG_BLK_DEV_OFFBOARD is not set
+CONFIG_BLK_DEV_GENERIC=y
+# CONFIG_BLK_DEV_OPTI621 is not set
+CONFIG_BLK_DEV_IDEDMA_PCI=y
+# CONFIG_BLK_DEV_AEC62XX is not set
+# CONFIG_BLK_DEV_ALI15X3 is not set
+# CONFIG_BLK_DEV_AMD74XX is not set
+CONFIG_BLK_DEV_CMD64X=y
+# CONFIG_BLK_DEV_TRIFLEX is not set
+# CONFIG_BLK_DEV_CS5520 is not set
+# CONFIG_BLK_DEV_CS5530 is not set
+# CONFIG_BLK_DEV_HPT366 is not set
+# CONFIG_BLK_DEV_JMICRON is not set
+# CONFIG_BLK_DEV_SC1200 is not set
+CONFIG_BLK_DEV_PIIX=y
+# CONFIG_BLK_DEV_IT8172 is not set
+# CONFIG_BLK_DEV_IT8213 is not set
+# CONFIG_BLK_DEV_IT821X is not set
+# CONFIG_BLK_DEV_NS87415 is not set
+# CONFIG_BLK_DEV_PDC202XX_OLD is not set
+# CONFIG_BLK_DEV_PDC202XX_NEW is not set
+# CONFIG_BLK_DEV_SVWKS is not set
+# CONFIG_BLK_DEV_SIIMAGE is not set
+# CONFIG_BLK_DEV_SLC90E66 is not set
+# CONFIG_BLK_DEV_TRM290 is not set
+# CONFIG_BLK_DEV_VIA82CXXX is not set
+# CONFIG_BLK_DEV_TC86C001 is not set
+CONFIG_BLK_DEV_IDEDMA=y
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+CONFIG_SCSI_NETLINK=y
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+CONFIG_CHR_DEV_ST=m
+# CONFIG_CHR_DEV_OSST is not set
+CONFIG_BLK_DEV_SR=m
+# CONFIG_BLK_DEV_SR_VENDOR is not set
+CONFIG_CHR_DEV_SG=m
+# CONFIG_CHR_DEV_SCH is not set
+
+#
+# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
+#
+# CONFIG_SCSI_MULTI_LUN is not set
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+# CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+CONFIG_SCSI_SPI_ATTRS=y
+CONFIG_SCSI_FC_ATTRS=y
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_SCSI_CXGB3_ISCSI is not set
+# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
+# CONFIG_SCSI_3W_9XXX is not set
+# CONFIG_SCSI_ACARD is not set
+# CONFIG_SCSI_AACRAID is not set
+# CONFIG_SCSI_AIC7XXX is not set
+# CONFIG_SCSI_AIC7XXX_OLD is not set
+# CONFIG_SCSI_AIC79XX is not set
+# CONFIG_SCSI_AIC94XX is not set
+# CONFIG_SCSI_DPT_I2O is not set
+# CONFIG_SCSI_ADVANSYS is not set
+# CONFIG_SCSI_ARCMSR is not set
+# CONFIG_MEGARAID_NEWGEN is not set
+# CONFIG_MEGARAID_LEGACY is not set
+# CONFIG_MEGARAID_SAS is not set
+# CONFIG_SCSI_HPTIOP is not set
+# CONFIG_LIBFC is not set
+# CONFIG_FCOE is not set
+# CONFIG_SCSI_DMX3191D is not set
+# CONFIG_SCSI_FUTURE_DOMAIN is not set
+# CONFIG_SCSI_IPS is not set
+# CONFIG_SCSI_INITIO is not set
+# CONFIG_SCSI_INIA100 is not set
+# CONFIG_SCSI_MVSAS is not set
+# CONFIG_SCSI_STEX is not set
+CONFIG_SCSI_SYM53C8XX_2=y
+CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
+CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
+CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
+CONFIG_SCSI_SYM53C8XX_MMIO=y
+CONFIG_SCSI_QLOGIC_1280=y
+# CONFIG_SCSI_QLA_FC is not set
+# CONFIG_SCSI_QLA_ISCSI is not set
+# CONFIG_SCSI_LPFC is not set
+# CONFIG_SCSI_DC395x is not set
+# CONFIG_SCSI_DC390T is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_SRP is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_ATA is not set
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=m
+CONFIG_MD_LINEAR=m
+CONFIG_MD_RAID0=m
+CONFIG_MD_RAID1=m
+# CONFIG_MD_RAID10 is not set
+# CONFIG_MD_RAID456 is not set
+CONFIG_MD_MULTIPATH=m
+# CONFIG_MD_FAULTY is not set
+CONFIG_BLK_DEV_DM=m
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_CRYPT=m
+CONFIG_DM_SNAPSHOT=m
+CONFIG_DM_MIRROR=m
+CONFIG_DM_ZERO=m
+# CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
+# CONFIG_DM_UEVENT is not set
+CONFIG_FUSION=y
+CONFIG_FUSION_SPI=y
+CONFIG_FUSION_FC=y
+# CONFIG_FUSION_SAS is not set
+CONFIG_FUSION_MAX_SGE=128
+CONFIG_FUSION_CTL=y
+# CONFIG_FUSION_LOGGING is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+
+#
+# Enable only one of the two stacks, unless you know what you are doing
+#
+# CONFIG_FIREWIRE is not set
+# CONFIG_IEEE1394 is not set
+# CONFIG_I2O is not set
+CONFIG_NETDEVICES=y
+CONFIG_DUMMY=m
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+# CONFIG_NET_SB1000 is not set
+# CONFIG_ARCNET is not set
+CONFIG_PHYLIB=y
+
+#
+# MII PHY device drivers
+#
+# CONFIG_MARVELL_PHY is not set
+# CONFIG_DAVICOM_PHY is not set
+# CONFIG_QSEMI_PHY is not set
+# CONFIG_LXT_PHY is not set
+# CONFIG_CICADA_PHY is not set
+# CONFIG_VITESSE_PHY is not set
+# CONFIG_SMSC_PHY is not set
+# CONFIG_BROADCOM_PHY is not set
+# CONFIG_ICPLUS_PHY is not set
+# CONFIG_REALTEK_PHY is not set
+# CONFIG_NATIONAL_PHY is not set
+# CONFIG_STE10XP is not set
+# CONFIG_LSI_ET1011C_PHY is not set
+# CONFIG_FIXED_PHY is not set
+# CONFIG_MDIO_BITBANG is not set
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=m
+# CONFIG_HAPPYMEAL is not set
+# CONFIG_SUNGEM is not set
+# CONFIG_CASSINI is not set
+# CONFIG_NET_VENDOR_3COM is not set
+CONFIG_NET_TULIP=y
+# CONFIG_DE2104X is not set
+CONFIG_TULIP=m
+# CONFIG_TULIP_MWI is not set
+# CONFIG_TULIP_MMIO is not set
+# CONFIG_TULIP_NAPI is not set
+# CONFIG_DE4X5 is not set
+# CONFIG_WINBOND_840 is not set
+# CONFIG_DM9102 is not set
+# CONFIG_ULI526X is not set
+# CONFIG_HP100 is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+CONFIG_NET_PCI=y
+# CONFIG_PCNET32 is not set
+# CONFIG_AMD8111_ETH is not set
+# CONFIG_ADAPTEC_STARFIRE is not set
+# CONFIG_B44 is not set
+# CONFIG_FORCEDETH is not set
+CONFIG_E100=m
+# CONFIG_FEALNX is not set
+# CONFIG_NATSEMI is not set
+# CONFIG_NE2K_PCI is not set
+# CONFIG_8139CP is not set
+# CONFIG_8139TOO is not set
+# CONFIG_R6040 is not set
+# CONFIG_SIS900 is not set
+# CONFIG_EPIC100 is not set
+# CONFIG_SMSC9420 is not set
+# CONFIG_SUNDANCE is not set
+# CONFIG_TLAN is not set
+# CONFIG_VIA_RHINE is not set
+# CONFIG_SC92031 is not set
+# CONFIG_ATL2 is not set
+CONFIG_NETDEV_1000=y
+# CONFIG_ACENIC is not set
+# CONFIG_DL2K is not set
+CONFIG_E1000=y
+# CONFIG_E1000E is not set
+# CONFIG_IP1000 is not set
+# CONFIG_IGB is not set
+# CONFIG_NS83820 is not set
+# CONFIG_HAMACHI is not set
+# CONFIG_YELLOWFIN is not set
+# CONFIG_R8169 is not set
+# CONFIG_SIS190 is not set
+# CONFIG_SKGE is not set
+# CONFIG_SKY2 is not set
+# CONFIG_VIA_VELOCITY is not set
+CONFIG_TIGON3=y
+# CONFIG_BNX2 is not set
+# CONFIG_QLA3XXX is not set
+# CONFIG_ATL1 is not set
+# CONFIG_ATL1E is not set
+# CONFIG_JME is not set
+CONFIG_NETDEV_10000=y
+# CONFIG_CHELSIO_T1 is not set
+CONFIG_CHELSIO_T3_DEPENDS=y
+# CONFIG_CHELSIO_T3 is not set
+# CONFIG_ENIC is not set
+# CONFIG_IXGBE is not set
+# CONFIG_IXGB is not set
+# CONFIG_S2IO is not set
+# CONFIG_MYRI10GE is not set
+# CONFIG_NETXEN_NIC is not set
+# CONFIG_NIU is not set
+# CONFIG_MLX4_EN is not set
+# CONFIG_MLX4_CORE is not set
+# CONFIG_TEHUTI is not set
+# CONFIG_BNX2X is not set
+# CONFIG_QLGE is not set
+# CONFIG_SFC is not set
+# CONFIG_TR is not set
+
+#
+# Wireless LAN
+#
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
+# CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+
+#
+# USB Network Adapters
+#
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET is not set
+# CONFIG_WAN is not set
+CONFIG_XEN_NETDEV_FRONTEND=y
+# CONFIG_FDDI is not set
+# CONFIG_HIPPI is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NET_FC is not set
+CONFIG_NETCONSOLE=y
+# CONFIG_NETCONSOLE_DYNAMIC is not set
+CONFIG_NETPOLL=y
+# CONFIG_NETPOLL_TRAP is not set
+CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_ISDN is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_EVDEV is not set
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_KEYBOARD_ATKBD=y
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+CONFIG_INPUT_MOUSE=y
+CONFIG_MOUSE_PS2=y
+CONFIG_MOUSE_PS2_ALPS=y
+CONFIG_MOUSE_PS2_LOGIPS2PP=y
+CONFIG_MOUSE_PS2_SYNAPTICS=y
+CONFIG_MOUSE_PS2_LIFEBOOK=y
+CONFIG_MOUSE_PS2_TRACKPOINT=y
+# CONFIG_MOUSE_PS2_ELANTECH is not set
+# CONFIG_MOUSE_PS2_TOUCHKIT is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_APPLETOUCH is not set
+# CONFIG_MOUSE_BCM5974 is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_I8042=y
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_SERIO_PCIPS2 is not set
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+CONFIG_GAMEPORT=m
+# CONFIG_GAMEPORT_NS558 is not set
+# CONFIG_GAMEPORT_L4 is not set
+# CONFIG_GAMEPORT_EMU10K1 is not set
+# CONFIG_GAMEPORT_FM801 is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+CONFIG_DEVKMEM=y
+CONFIG_SERIAL_NONSTANDARD=y
+# CONFIG_COMPUTONE is not set
+# CONFIG_ROCKETPORT is not set
+# CONFIG_CYCLADES is not set
+# CONFIG_DIGIEPCA is not set
+# CONFIG_MOXA_INTELLIO is not set
+# CONFIG_MOXA_SMARTIO is not set
+# CONFIG_ISI is not set
+# CONFIG_SYNCLINKMP is not set
+# CONFIG_SYNCLINK_GT is not set
+# CONFIG_N_HDLC is not set
+# CONFIG_RISCOM8 is not set
+# CONFIG_SPECIALIX is not set
+# CONFIG_SX is not set
+# CONFIG_RIO is not set
+# CONFIG_STALDRV is not set
+# CONFIG_NOZOMI is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_PCI=y
+CONFIG_SERIAL_8250_PNP=y
+CONFIG_SERIAL_8250_NR_UARTS=6
+CONFIG_SERIAL_8250_RUNTIME_UARTS=4
+CONFIG_SERIAL_8250_EXTENDED=y
+CONFIG_SERIAL_8250_SHARE_IRQ=y
+# CONFIG_SERIAL_8250_DETECT_IRQ is not set
+# CONFIG_SERIAL_8250_RSA is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+# CONFIG_SERIAL_JSM is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+CONFIG_HVC_DRIVER=y
+CONFIG_HVC_IRQ=y
+CONFIG_HVC_XEN=y
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_HW_RANDOM is not set
+CONFIG_EFI_RTC=y
+# CONFIG_R3964 is not set
+# CONFIG_APPLICOM is not set
+CONFIG_RAW_DRIVER=m
+CONFIG_MAX_RAW_DEVS=256
+CONFIG_HPET=y
+CONFIG_HPET_MMAP=y
+# CONFIG_HANGCHECK_TIMER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_DEVPORT=y
+CONFIG_I2C=m
+CONFIG_I2C_BOARDINFO=y
+# CONFIG_I2C_CHARDEV is not set
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=m
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# PC SMBus host controller drivers
+#
+# CONFIG_I2C_ALI1535 is not set
+# CONFIG_I2C_ALI1563 is not set
+# CONFIG_I2C_ALI15X3 is not set
+# CONFIG_I2C_AMD756 is not set
+# CONFIG_I2C_AMD8111 is not set
+# CONFIG_I2C_I801 is not set
+# CONFIG_I2C_ISCH is not set
+# CONFIG_I2C_PIIX4 is not set
+# CONFIG_I2C_NFORCE2 is not set
+# CONFIG_I2C_SIS5595 is not set
+# CONFIG_I2C_SIS630 is not set
+# CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_VIA is not set
+# CONFIG_I2C_VIAPRO is not set
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+# CONFIG_I2C_TINY_USB is not set
+
+#
+# Graphics adapter I2C/DDC channel drivers
+#
+# CONFIG_I2C_VOODOO3 is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_AT24 is not set
+# CONFIG_SENSORS_EEPROM is not set
+# CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_PCF8575 is not set
+# CONFIG_SENSORS_PCA9539 is not set
+# CONFIG_SENSORS_PCF8591 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+# CONFIG_SPI is not set
+# CONFIG_W1 is not set
+CONFIG_POWER_SUPPLY=y
+# CONFIG_POWER_SUPPLY_DEBUG is not set
+# CONFIG_PDA_POWER is not set
+# CONFIG_BATTERY_DS2760 is not set
+# CONFIG_BATTERY_BQ27x00 is not set
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID is not set
+# CONFIG_SENSORS_AD7414 is not set
+# CONFIG_SENSORS_AD7418 is not set
+# CONFIG_SENSORS_ADM1021 is not set
+# CONFIG_SENSORS_ADM1025 is not set
+# CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
+# CONFIG_SENSORS_ADM1031 is not set
+# CONFIG_SENSORS_ADM9240 is not set
+# CONFIG_SENSORS_ADT7462 is not set
+# CONFIG_SENSORS_ADT7470 is not set
+# CONFIG_SENSORS_ADT7473 is not set
+# CONFIG_SENSORS_ATXP1 is not set
+# CONFIG_SENSORS_DS1621 is not set
+# CONFIG_SENSORS_I5K_AMB is not set
+# CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_F71882FG is not set
+# CONFIG_SENSORS_F75375S is not set
+# CONFIG_SENSORS_GL518SM is not set
+# CONFIG_SENSORS_GL520SM is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_LM63 is not set
+# CONFIG_SENSORS_LM75 is not set
+# CONFIG_SENSORS_LM77 is not set
+# CONFIG_SENSORS_LM78 is not set
+# CONFIG_SENSORS_LM80 is not set
+# CONFIG_SENSORS_LM83 is not set
+# CONFIG_SENSORS_LM85 is not set
+# CONFIG_SENSORS_LM87 is not set
+# CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
+# CONFIG_SENSORS_LM93 is not set
+# CONFIG_SENSORS_LTC4245 is not set
+# CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX6650 is not set
+# CONFIG_SENSORS_PC87360 is not set
+# CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_SIS5595 is not set
+# CONFIG_SENSORS_DME1737 is not set
+# CONFIG_SENSORS_SMSC47M1 is not set
+# CONFIG_SENSORS_SMSC47M192 is not set
+# CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_ADS7828 is not set
+# CONFIG_SENSORS_THMC50 is not set
+# CONFIG_SENSORS_VIA686A is not set
+# CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_VT8231 is not set
+# CONFIG_SENSORS_W83781D is not set
+# CONFIG_SENSORS_W83791D is not set
+# CONFIG_SENSORS_W83792D is not set
+# CONFIG_SENSORS_W83793 is not set
+# CONFIG_SENSORS_W83L785TS is not set
+# CONFIG_SENSORS_W83L786NG is not set
+# CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_SENSORS_LIS3LV02D is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
+CONFIG_THERMAL=m
+# CONFIG_THERMAL_HWMON is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_REGULATOR is not set
+
+#
+# Multimedia devices
+#
+
+#
+# Multimedia core support
+#
+# CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_VIDEO_MEDIA is not set
+
+#
+# Multimedia drivers
+#
+CONFIG_DAB=y
+# CONFIG_USB_DABUSB is not set
+
+#
+# Graphics support
+#
+CONFIG_AGP=m
+CONFIG_DRM=m
+CONFIG_DRM_TDFX=m
+CONFIG_DRM_R128=m
+CONFIG_DRM_RADEON=m
+CONFIG_DRM_MGA=m
+CONFIG_DRM_SIS=m
+# CONFIG_DRM_VIA is not set
+# CONFIG_DRM_SAVAGE is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+# CONFIG_FB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+CONFIG_VGA_CONSOLE=y
+# CONFIG_VGACON_SOFT_SCROLLBACK is not set
+CONFIG_DUMMY_CONSOLE=y
+# CONFIG_SOUND is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
+# CONFIG_HIDRAW is not set
+
+#
+# USB Input Devices
+#
+CONFIG_USB_HID=y
+# CONFIG_HID_PID is not set
+# CONFIG_USB_HIDDEV is not set
+
+#
+# Special HID drivers
+#
+CONFIG_HID_COMPAT=y
+CONFIG_HID_A4TECH=y
+CONFIG_HID_APPLE=y
+CONFIG_HID_BELKIN=y
+CONFIG_HID_CHERRY=y
+CONFIG_HID_CHICONY=y
+CONFIG_HID_CYPRESS=y
+CONFIG_HID_EZKEY=y
+CONFIG_HID_GYRATION=y
+CONFIG_HID_LOGITECH=y
+# CONFIG_LOGITECH_FF is not set
+# CONFIG_LOGIRUMBLEPAD2_FF is not set
+CONFIG_HID_MICROSOFT=y
+CONFIG_HID_MONTEREY=y
+CONFIG_HID_NTRIG=y
+CONFIG_HID_PANTHERLORD=y
+# CONFIG_PANTHERLORD_FF is not set
+CONFIG_HID_PETALYNX=y
+CONFIG_HID_SAMSUNG=y
+CONFIG_HID_SONY=y
+CONFIG_HID_SUNPLUS=y
+# CONFIG_GREENASIA_FF is not set
+CONFIG_HID_TOPSEED=y
+# CONFIG_THRUSTMASTER_FF is not set
+# CONFIG_ZEROPLUS_FF is not set
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+CONFIG_USB_ARCH_HAS_EHCI=y
+CONFIG_USB=y
+# CONFIG_USB_DEBUG is not set
+# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
+
+#
+# Miscellaneous USB options
+#
+CONFIG_USB_DEVICEFS=y
+CONFIG_USB_DEVICE_CLASS=y
+# CONFIG_USB_DYNAMIC_MINORS is not set
+# CONFIG_USB_SUSPEND is not set
+# CONFIG_USB_OTG is not set
+# CONFIG_USB_MON is not set
+# CONFIG_USB_WUSB is not set
+# CONFIG_USB_WUSB_CBAF is not set
+
+#
+# USB Host Controller Drivers
+#
+# CONFIG_USB_C67X00_HCD is not set
+CONFIG_USB_EHCI_HCD=m
+# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
+# CONFIG_USB_EHCI_TT_NEWSCHED is not set
+# CONFIG_USB_OXU210HP_HCD is not set
+# CONFIG_USB_ISP116X_HCD is not set
+# CONFIG_USB_ISP1760_HCD is not set
+CONFIG_USB_OHCI_HCD=m
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_LITTLE_ENDIAN=y
+CONFIG_USB_UHCI_HCD=y
+# CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
+# CONFIG_USB_WHCI_HCD is not set
+# CONFIG_USB_HWA_HCD is not set
+
+#
+# USB Device Class drivers
+#
+# CONFIG_USB_ACM is not set
+# CONFIG_USB_PRINTER is not set
+# CONFIG_USB_WDM is not set
+# CONFIG_USB_TMC is not set
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
+#
+
+#
+# see USB_STORAGE Help for more information
+#
+CONFIG_USB_STORAGE=m
+# CONFIG_USB_STORAGE_DEBUG is not set
+# CONFIG_USB_STORAGE_DATAFAB is not set
+# CONFIG_USB_STORAGE_FREECOM is not set
+# CONFIG_USB_STORAGE_ISD200 is not set
+# CONFIG_USB_STORAGE_USBAT is not set
+# CONFIG_USB_STORAGE_SDDR09 is not set
+# CONFIG_USB_STORAGE_SDDR55 is not set
+# CONFIG_USB_STORAGE_JUMPSHOT is not set
+# CONFIG_USB_STORAGE_ALAUDA is not set
+# CONFIG_USB_STORAGE_ONETOUCH is not set
+# CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
+# CONFIG_USB_LIBUSUAL is not set
+
+#
+# USB Imaging devices
+#
+# CONFIG_USB_MDC800 is not set
+# CONFIG_USB_MICROTEK is not set
+
+#
+# USB port drivers
+#
+# CONFIG_USB_SERIAL is not set
+
+#
+# USB Miscellaneous drivers
+#
+# CONFIG_USB_EMI62 is not set
+# CONFIG_USB_EMI26 is not set
+# CONFIG_USB_ADUTUX is not set
+# CONFIG_USB_SEVSEG is not set
+# CONFIG_USB_RIO500 is not set
+# CONFIG_USB_LEGOTOWER is not set
+# CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
+# CONFIG_USB_LED is not set
+# CONFIG_USB_CYPRESS_CY7C63 is not set
+# CONFIG_USB_CYTHERM is not set
+# CONFIG_USB_PHIDGET is not set
+# CONFIG_USB_IDMOUSE is not set
+# CONFIG_USB_FTDI_ELAN is not set
+# CONFIG_USB_APPLEDISPLAY is not set
+# CONFIG_USB_SISUSBVGA is not set
+# CONFIG_USB_LD is not set
+# CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
+# CONFIG_USB_TEST is not set
+# CONFIG_USB_ISIGHTFW is not set
+# CONFIG_USB_VST is not set
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_UWB is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_INFINIBAND is not set
+# CONFIG_RTC_CLASS is not set
+# CONFIG_DMADEVICES is not set
+# CONFIG_UIO is not set
+CONFIG_XEN_BALLOON=y
+CONFIG_XEN_SCRUB_PAGES=y
+CONFIG_XENFS=y
+CONFIG_XEN_COMPAT_XENFS=y
+# CONFIG_STAGING is not set
+# CONFIG_MSPEC is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+CONFIG_EXT2_FS_POSIX_ACL=y
+CONFIG_EXT2_FS_SECURITY=y
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+CONFIG_EXT3_FS_XATTR=y
+CONFIG_EXT3_FS_POSIX_ACL=y
+CONFIG_EXT3_FS_SECURITY=y
+# CONFIG_EXT4_FS is not set
+CONFIG_JBD=y
+CONFIG_FS_MBCACHE=y
+CONFIG_REISERFS_FS=y
+# CONFIG_REISERFS_CHECK is not set
+# CONFIG_REISERFS_PROC_INFO is not set
+CONFIG_REISERFS_FS_XATTR=y
+CONFIG_REISERFS_FS_POSIX_ACL=y
+CONFIG_REISERFS_FS_SECURITY=y
+# CONFIG_JFS_FS is not set
+CONFIG_FS_POSIX_ACL=y
+CONFIG_FILE_LOCKING=y
+CONFIG_XFS_FS=y
+# CONFIG_XFS_QUOTA is not set
+# CONFIG_XFS_POSIX_ACL is not set
+# CONFIG_XFS_RT is not set
+# CONFIG_XFS_DEBUG is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+CONFIG_AUTOFS_FS=y
+CONFIG_AUTOFS4_FS=y
+# CONFIG_FUSE_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=m
+CONFIG_JOLIET=y
+# CONFIG_ZISOFS is not set
+CONFIG_UDF_FS=m
+CONFIG_UDF_NLS=y
+
+#
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+# CONFIG_MSDOS_FS is not set
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+CONFIG_NTFS_FS=m
+# CONFIG_NTFS_DEBUG is not set
+# CONFIG_NTFS_RW is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_PROC_SYSCTL=y
+CONFIG_PROC_PAGE_MONITOR=y
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+CONFIG_HUGETLBFS=y
+CONFIG_HUGETLB_PAGE=y
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=m
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+CONFIG_NFS_V4=y
+CONFIG_NFSD=m
+CONFIG_NFSD_V3=y
+# CONFIG_NFSD_V3_ACL is not set
+CONFIG_NFSD_V4=y
+CONFIG_LOCKD=m
+CONFIG_LOCKD_V4=y
+CONFIG_EXPORTFS=m
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=m
+CONFIG_SUNRPC_GSS=m
+# CONFIG_SUNRPC_REGISTER_V4 is not set
+CONFIG_RPCSEC_GSS_KRB5=m
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+CONFIG_SMB_FS=m
+CONFIG_SMB_NLS_DEFAULT=y
+CONFIG_SMB_NLS_REMOTE="cp437"
+CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_ACORN_PARTITION is not set
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
+# CONFIG_ATARI_PARTITION is not set
+# CONFIG_MAC_PARTITION is not set
+CONFIG_MSDOS_PARTITION=y
+# CONFIG_BSD_DISKLABEL is not set
+# CONFIG_MINIX_SUBPARTITION is not set
+# CONFIG_SOLARIS_X86_PARTITION is not set
+# CONFIG_UNIXWARE_DISKLABEL is not set
+# CONFIG_LDM_PARTITION is not set
+CONFIG_SGI_PARTITION=y
+# CONFIG_ULTRIX_PARTITION is not set
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
+CONFIG_EFI_PARTITION=y
+# CONFIG_SYSV68_PARTITION is not set
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+CONFIG_NLS_CODEPAGE_737=m
+CONFIG_NLS_CODEPAGE_775=m
+CONFIG_NLS_CODEPAGE_850=m
+CONFIG_NLS_CODEPAGE_852=m
+CONFIG_NLS_CODEPAGE_855=m
+CONFIG_NLS_CODEPAGE_857=m
+CONFIG_NLS_CODEPAGE_860=m
+CONFIG_NLS_CODEPAGE_861=m
+CONFIG_NLS_CODEPAGE_862=m
+CONFIG_NLS_CODEPAGE_863=m
+CONFIG_NLS_CODEPAGE_864=m
+CONFIG_NLS_CODEPAGE_865=m
+CONFIG_NLS_CODEPAGE_866=m
+CONFIG_NLS_CODEPAGE_869=m
+CONFIG_NLS_CODEPAGE_936=m
+CONFIG_NLS_CODEPAGE_950=m
+CONFIG_NLS_CODEPAGE_932=m
+CONFIG_NLS_CODEPAGE_949=m
+CONFIG_NLS_CODEPAGE_874=m
+CONFIG_NLS_ISO8859_8=m
+CONFIG_NLS_CODEPAGE_1250=m
+CONFIG_NLS_CODEPAGE_1251=m
+# CONFIG_NLS_ASCII is not set
+CONFIG_NLS_ISO8859_1=y
+CONFIG_NLS_ISO8859_2=m
+CONFIG_NLS_ISO8859_3=m
+CONFIG_NLS_ISO8859_4=m
+CONFIG_NLS_ISO8859_5=m
+CONFIG_NLS_ISO8859_6=m
+CONFIG_NLS_ISO8859_7=m
+CONFIG_NLS_ISO8859_9=m
+CONFIG_NLS_ISO8859_13=m
+CONFIG_NLS_ISO8859_14=m
+CONFIG_NLS_ISO8859_15=m
+CONFIG_NLS_KOI8_R=m
+CONFIG_NLS_KOI8_U=m
+CONFIG_NLS_UTF8=m
+# CONFIG_DLM is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=2048
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+CONFIG_SCHED_DEBUG=y
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_SLUB_DEBUG_ON is not set
+# CONFIG_SLUB_STATS is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+CONFIG_DEBUG_MUTEXES=y
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+# CONFIG_DEBUG_KOBJECT is not set
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+CONFIG_DEBUG_MEMORY_INIT=y
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_BOOT_PRINTK_DELAY is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_FAULT_INJECTION is not set
+# CONFIG_SYSCTL_SYSCALL_CHECK is not set
+
+#
+# Tracers
+#
+# CONFIG_SCHED_TRACER is not set
+# CONFIG_CONTEXT_SWITCH_TRACER is not set
+# CONFIG_BOOT_TRACER is not set
+# CONFIG_TRACE_BRANCH_PROFILING is not set
+# CONFIG_DYNAMIC_PRINTK_DEBUG is not set
+# CONFIG_SAMPLES is not set
+CONFIG_IA64_GRANULE_16MB=y
+# CONFIG_IA64_GRANULE_64MB is not set
+# CONFIG_IA64_PRINT_HAZARDS is not set
+# CONFIG_DISABLE_VHPT is not set
+# CONFIG_IA64_DEBUG_CMPXCHG is not set
+# CONFIG_IA64_DEBUG_IRQ is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+# CONFIG_CRYPTO_FIPS is not set
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=m
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_MANAGER=m
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+CONFIG_CRYPTO_CBC=m
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=m
+# CONFIG_CRYPTO_LRW is not set
+CONFIG_CRYPTO_PCBC=m
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_MD4 is not set
+CONFIG_CRYPTO_MD5=y
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+# CONFIG_CRYPTO_AES is not set
+# CONFIG_CRYPTO_ANUBIS is not set
+# CONFIG_CRYPTO_ARC4 is not set
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+CONFIG_CRYPTO_DES=m
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+CONFIG_CRYPTO_HW=y
+# CONFIG_CRYPTO_DEV_HIFN_795X is not set
+CONFIG_HAVE_KVM=y
+CONFIG_VIRTUALIZATION=y
+# CONFIG_KVM is not set
+# CONFIG_VIRTIO_PCI is not set
+# CONFIG_VIRTIO_BALLOON is not set
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+CONFIG_CRC_ITU_T=m
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_IRQ_PROBE=y
+CONFIG_GENERIC_PENDING_IRQ=y
+CONFIG_IRQ_PER_CPU=y
+# CONFIG_IOMMU_API is not set
index 68aa6da807c191fa74344c85b562b97f6d14694b..bfa86b6af7cd0774d652c99d800e822284f74c23 100644 (file)
 
 #include <linux/ioctl.h>
 
+/* Select x86 specific features in <linux/kvm.h> */
+#define __KVM_HAVE_IOAPIC
+#define __KVM_HAVE_DEVICE_ASSIGNMENT
+
 /* Architectural interrupt line count. */
 #define KVM_NR_INTERRUPTS 256
 
index 34efe88eb84948f042474988089fa6d1ef1f82f8..f2ca32069b3ff5e2b4f97925cabf6540f0d3dea7 100644 (file)
@@ -31,10 +31,6 @@ static inline int pfn_to_nid(unsigned long pfn)
 #endif
 }
 
-#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
-extern int early_pfn_to_nid(unsigned long pfn);
-#endif
-
 #ifdef CONFIG_IA64_DIG /* DIG systems are small */
 # define MAX_PHYSNODE_ID       8
 # define NR_NODE_MEMBLKS       (MAX_NUMNODES * 8)
index 5efecf06c9a42efef99870084a3748e9bd3dfc15..96798d2da7c272fe4e9417f5329702d8f4559042 100644 (file)
@@ -39,7 +39,7 @@
 /* BTE status register only supports 16 bits for length field */
 #define BTE_LEN_BITS (16)
 #define BTE_LEN_MASK ((1 << BTE_LEN_BITS) - 1)
-#define BTE_MAX_XFER ((1 << BTE_LEN_BITS) * L1_CACHE_BYTES)
+#define BTE_MAX_XFER (BTE_LEN_MASK << L1_CACHE_SHIFT)
 
 
 /* Define hardware */
index d5ef0aa3e312e82630c0f7d636f6d0c9d2156b95..745421225ec6b5a4c6eec31897cc8d7199883ab4 100644 (file)
@@ -63,4 +63,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_IA64_SOCKET_H */
index 11463994a7d540b63de364b80d3077a5f51f6445..52290547c85ba89edd5ba3fa1a98985891803361 100644 (file)
@@ -736,14 +736,15 @@ int __cpu_disable(void)
                        return -EBUSY;
        }
 
+       cpu_clear(cpu, cpu_online_map);
+
        if (migrate_platform_irqs(cpu)) {
                cpu_set(cpu, cpu_online_map);
-               return (-EBUSY);
+               return -EBUSY;
        }
 
        remove_siblinginfo(cpu);
        fixup_irqs();
-       cpu_clear(cpu, cpu_online_map);
        local_flush_tlb_all();
        cpu_clear(cpu, cpu_callin_map);
        return 0;
index 4e586f6110aa08c4d2df47f8aa16a053748f8268..28f982045f29c6c1623c2ac06e032e904efb0720 100644 (file)
@@ -1337,6 +1337,10 @@ static void kvm_release_vm_pages(struct kvm *kvm)
        }
 }
 
+void kvm_arch_sync_events(struct kvm *kvm)
+{
+}
+
 void kvm_arch_destroy_vm(struct kvm *kvm)
 {
        kvm_iommu_unmap_guest(kvm);
index 552d07724207e213b5949e2dd15c00bc31c74dd3..230eae482f3262a443e2ef9acf5111820937b574 100644 (file)
@@ -455,13 +455,18 @@ fpswa_ret_t vmm_fp_emulate(int fp_fault, void *bundle, unsigned long *ipsr,
        if (!vmm_fpswa_interface)
                return (fpswa_ret_t) {-1, 0, 0, 0};
 
-       /*
-        * Just let fpswa driver to use hardware fp registers.
-        * No fp register is valid in memory.
-        */
        memset(&fp_state, 0, sizeof(fp_state_t));
 
        /*
+        * compute fp_state.  only FP registers f6 - f11 are used by the
+        * vmm, so set those bits in the mask and set the low volatile
+        * pointer to point to these registers.
+        */
+       fp_state.bitmask_low64 = 0xfc0;  /* bit6..bit11 */
+
+       fp_state.fp_state_low_volatile = (fp_state_low_volatile_t *) &regs->f6;
+
+   /*
         * unsigned long (*EFI_FPSWA) (
         *      unsigned long    trap_type,
         *      void             *Bundle,
@@ -545,10 +550,6 @@ void reflect_interruption(u64 ifa, u64 isr, u64 iim,
                status = vmm_handle_fpu_swa(0, regs, isr);
                if (!status)
                        return ;
-               else if (-EAGAIN == status) {
-                       vcpu_decrement_iip(vcpu);
-                       return ;
-               }
                break;
        }
 
index b73bf1838e57750fb69f3ae27d6950bcc9dc46c8..3efea7d0a351c5159d5e843406e744fe0948a33d 100644 (file)
@@ -58,7 +58,7 @@ paddr_to_nid(unsigned long paddr)
  * SPARSEMEM to allocate the SPARSEMEM sectionmap on the NUMA node where
  * the section resides.
  */
-int early_pfn_to_nid(unsigned long pfn)
+int __meminit __early_pfn_to_nid(unsigned long pfn)
 {
        int i, section = pfn >> PFN_SECTION_SHIFT, ssec, esec;
 
@@ -70,7 +70,7 @@ int early_pfn_to_nid(unsigned long pfn)
                        return node_memblk[i].nid;
        }
 
-       return 0;
+       return -1;
 }
 
 #ifdef CONFIG_MEMORY_HOTPLUG
index 9456d4034024aa97eed31518162e6ddb68e7a436..c6d6b62db66c99c05c4cc5ee8c84f19c4a768d5b 100644 (file)
@@ -97,9 +97,10 @@ bte_result_t bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification)
                return BTE_SUCCESS;
        }
 
-       BUG_ON((len & L1_CACHE_MASK) ||
-                (src & L1_CACHE_MASK) || (dest & L1_CACHE_MASK));
-       BUG_ON(!(len < ((BTE_LEN_MASK + 1) << L1_CACHE_SHIFT)));
+       BUG_ON(len & L1_CACHE_MASK);
+       BUG_ON(src & L1_CACHE_MASK);
+       BUG_ON(dest & L1_CACHE_MASK);
+       BUG_ON(len > BTE_MAX_XFER);
 
        /*
         * Start with interface corresponding to cpu number
index c5a214026a775c5d82e27fddd1c85cad2d883598..d0223abbbbd4c464df26e0aed6823de0b827944f 100644 (file)
@@ -443,7 +443,7 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
                size = pci_resource_len(dev, PCI_ROM_RESOURCE);
                addr = ioremap(pcidev_info->pdi_pio_mapped_addr[PCI_ROM_RESOURCE],
                               size);
-               image_size = pci_get_rom_size(addr, size);
+               image_size = pci_get_rom_size(dev, addr, size);
                dev->resource[PCI_ROM_RESOURCE].start = (unsigned long) addr;
                dev->resource[PCI_ROM_RESOURCE].end =
                                        (unsigned long) addr + image_size - 1;
index 4e1801bad83a7fdc171a90af0ff3c2df4277f62f..e2eb2da60f963ee3aa7e62c727ef408026b4cd13 100644 (file)
@@ -269,7 +269,7 @@ sn_io_slot_fixup(struct pci_dev *dev)
 
                        rom = ioremap(pci_resource_start(dev, PCI_ROM_RESOURCE),
                                      size + 1);
-                       image_size = pci_get_rom_size(rom, size + 1);
+                       image_size = pci_get_rom_size(dev, rom, size + 1);
                        dev->resource[PCI_ROM_RESOURCE].end =
                                dev->resource[PCI_ROM_RESOURCE].start +
                                image_size - 1;
index f1683a20275b8caad1e6ae92c982a483a2f524ad..515e0826803a8f6eb349153658a4b59fdd56a21a 100644 (file)
@@ -8,8 +8,7 @@ config XEN
        depends on PARAVIRT && MCKINLEY && IA64_PAGE_SIZE_16KB && EXPERIMENTAL
        select XEN_XENCOMM
        select NO_IDLE_HZ
-
-       # those are required to save/restore.
+       # followings are required to save/restore.
        select ARCH_SUSPEND_POSSIBLE
        select SUSPEND
        select PM_SLEEP
index 04cd12350455f33a2a563be95c0a3e9ad5e3ea02..936cff3c96e0215f413054d038950fc8ecc22973 100644 (file)
@@ -153,7 +153,7 @@ xen_post_smp_prepare_boot_cpu(void)
        xen_setup_vcpu_info_placement();
 }
 
-static const struct pv_init_ops xen_init_ops __initdata = {
+static const struct pv_init_ops xen_init_ops __initconst = {
        .banner = xen_banner,
 
        .reserve_memory = xen_reserve_memory,
@@ -337,7 +337,7 @@ xen_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
        HYPERVISOR_physdev_op(PHYSDEVOP_apic_write, &apic_op);
 }
 
-static const struct pv_iosapic_ops xen_iosapic_ops __initdata = {
+static const struct pv_iosapic_ops xen_iosapic_ops __initconst = {
        .pcat_compat_init = xen_pcat_compat_init,
        .__get_irq_chip = xen_iosapic_get_irq_chip,
 
index dba4afabb444a41bb7c294475825726e607f1881..39478dd08e67dd8a5d34a76fecc21bc511e1f4b2 100644 (file)
@@ -187,8 +187,8 @@ __asm__ (__ALIGN_STR "\n"                                              \
 "      jbra    ret_from_interrupt\n"                                      \
         : : "i" (&kstat_cpu(0).irqs[n+8]), "i" (&irq_handler[n+8]),       \
             "n" (PT_OFF_SR), "n" (n),                                     \
-            "i" (n & 8 ? (n & 16 ? &tt_mfp.int_mk_a : &mfp.int_mk_a)      \
-                       : (n & 16 ? &tt_mfp.int_mk_b : &mfp.int_mk_b)),    \
+            "i" (n & 8 ? (n & 16 ? &tt_mfp.int_mk_a : &st_mfp.int_mk_a)   \
+                       : (n & 16 ? &tt_mfp.int_mk_b : &st_mfp.int_mk_b)), \
             "m" (preempt_count()), "di" (HARDIRQ_OFFSET)                  \
 );                                                                        \
        for (;;);                       /* fake noreturn */                \
@@ -366,14 +366,14 @@ void __init atari_init_IRQ(void)
        /* Initialize the MFP(s) */
 
 #ifdef ATARI_USE_SOFTWARE_EOI
-       mfp.vec_adr  = 0x48;    /* Software EOI-Mode */
+       st_mfp.vec_adr  = 0x48; /* Software EOI-Mode */
 #else
-       mfp.vec_adr  = 0x40;    /* Automatic EOI-Mode */
+       st_mfp.vec_adr  = 0x40; /* Automatic EOI-Mode */
 #endif
-       mfp.int_en_a = 0x00;    /* turn off MFP-Ints */
-       mfp.int_en_b = 0x00;
-       mfp.int_mk_a = 0xff;    /* no Masking */
-       mfp.int_mk_b = 0xff;
+       st_mfp.int_en_a = 0x00; /* turn off MFP-Ints */
+       st_mfp.int_en_b = 0x00;
+       st_mfp.int_mk_a = 0xff; /* no Masking */
+       st_mfp.int_mk_b = 0xff;
 
        if (ATARIHW_PRESENT(TT_MFP)) {
 #ifdef ATARI_USE_SOFTWARE_EOI
index a5f33c059979077ea17229a97c36fe692041cb23..4add96d13b1964db9b97aa6103005b5f803a75ed 100644 (file)
@@ -609,10 +609,10 @@ int atari_keyb_init(void)
                                 ACIA_RHTID : 0);
 
        /* make sure the interrupt line is up */
-       } while ((mfp.par_dt_reg & 0x10) == 0);
+       } while ((st_mfp.par_dt_reg & 0x10) == 0);
 
        /* enable ACIA Interrupts */
-       mfp.active_edge &= ~0x10;
+       st_mfp.active_edge &= ~0x10;
        atari_turnon_irq(IRQ_MFP_ACIA);
 
        ikbd_self_test = 1;
index 49c28cdbea5c5bf6cc89d00be99eee339900838c..ae2d96e5d618eba94ed0428468ca2e9f025e983f 100644 (file)
@@ -258,7 +258,7 @@ void __init config_atari(void)
                        printk("STND_SHIFTER ");
                }
        }
-       if (hwreg_present(&mfp.par_dt_reg)) {
+       if (hwreg_present(&st_mfp.par_dt_reg)) {
                ATARIHW_SET(ST_MFP);
                printk("ST_MFP ");
        }
index 702b15ccfab7b0f5c2bd53d3f73f18cdfa8ae50e..28efdc33c1aeab89afde05ff5249ba5bdf2f20ac 100644 (file)
@@ -34,9 +34,9 @@ static struct console atari_console_driver = {
 
 static inline void ata_mfp_out(char c)
 {
-       while (!(mfp.trn_stat & 0x80))  /* wait for tx buf empty */
+       while (!(st_mfp.trn_stat & 0x80))       /* wait for tx buf empty */
                barrier();
-       mfp.usart_dta = c;
+       st_mfp.usart_dta = c;
 }
 
 static void atari_mfp_console_write(struct console *co, const char *str,
@@ -91,7 +91,7 @@ static int ata_par_out(char c)
        /* This a some-seconds timeout in case no printer is connected */
        unsigned long i = loops_per_jiffy > 1 ? loops_per_jiffy : 10000000/HZ;
 
-       while ((mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */
+       while ((st_mfp.par_dt_reg & 1) && --i) /* wait for BUSY == L */
                ;
        if (!i)
                return 0;
@@ -131,9 +131,9 @@ static void atari_par_console_write(struct console *co, const char *str,
 #if 0
 int atari_mfp_console_wait_key(struct console *co)
 {
-       while (!(mfp.rcv_stat & 0x80))  /* wait for rx buf filled */
+       while (!(st_mfp.rcv_stat & 0x80))       /* wait for rx buf filled */
                barrier();
-       return mfp.usart_dta;
+       return st_mfp.usart_dta;
 }
 
 int atari_scc_console_wait_key(struct console *co)
@@ -175,12 +175,12 @@ static void __init atari_init_mfp_port(int cflag)
                baud = B9600;           /* use default 9600bps for non-implemented rates */
        baud -= B1200;                  /* baud_table[] starts at 1200bps */
 
-       mfp.trn_stat &= ~0x01;          /* disable TX */
-       mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
-       mfp.tim_ct_cd &= 0x70;          /* stop timer D */
-       mfp.tim_dt_d = baud_table[baud];
-       mfp.tim_ct_cd |= 0x01;          /* start timer D, 1:4 */
-       mfp.trn_stat |= 0x01;           /* enable TX */
+       st_mfp.trn_stat &= ~0x01;       /* disable TX */
+       st_mfp.usart_ctr = parity | csize | 0x88; /* 1:16 clk mode, 1 stop bit */
+       st_mfp.tim_ct_cd &= 0x70;       /* stop timer D */
+       st_mfp.tim_dt_d = baud_table[baud];
+       st_mfp.tim_ct_cd |= 0x01;       /* start timer D, 1:4 */
+       st_mfp.trn_stat |= 0x01;        /* enable TX */
 }
 
 #define SCC_WRITE(reg, val)                            \
index d076ff8d1b39138ba16b4483d2874a7d5b4bcaa9..a0531f34c617ca90df986902735e0b6ae5d26574 100644 (file)
@@ -27,9 +27,9 @@ void __init
 atari_sched_init(irq_handler_t timer_routine)
 {
     /* set Timer C data Register */
-    mfp.tim_dt_c = INT_TICKS;
+    st_mfp.tim_dt_c = INT_TICKS;
     /* start timer C, div = 1:100 */
-    mfp.tim_ct_cd = (mfp.tim_ct_cd & 15) | 0x60;
+    st_mfp.tim_ct_cd = (st_mfp.tim_ct_cd & 15) | 0x60;
     /* install interrupt service routine for MFP Timer C */
     if (request_irq(IRQ_MFP_TIMC, timer_routine, IRQ_TYPE_SLOW,
                    "timer", timer_routine))
@@ -46,11 +46,11 @@ unsigned long atari_gettimeoffset (void)
   unsigned long ticks, offset = 0;
 
   /* read MFP timer C current value */
-  ticks = mfp.tim_dt_c;
+  ticks = st_mfp.tim_dt_c;
   /* The probability of underflow is less than 2% */
   if (ticks > INT_TICKS - INT_TICKS / 50)
     /* Check for pending timer interrupt */
-    if (mfp.int_pn_b & (1 << 5))
+    if (st_mfp.int_pn_b & (1 << 5))
       offset = TICK_SIZE;
 
   ticks = INT_TICKS - ticks;
index 1412b4ab202f1e753324e734d42dc92bbb635e7e..a714e1aa072a0e4bf4981894ed2c00b71ce7ca6c 100644 (file)
@@ -113,7 +113,7 @@ extern struct atari_hw_present atari_hw_present;
  * of nops on various machines. Somebody claimed that the tstb takes 600 ns.
  */
 #define        MFPDELAY() \
-       __asm__ __volatile__ ( "tstb %0" : : "m" (mfp.par_dt_reg) : "cc" );
+       __asm__ __volatile__ ( "tstb %0" : : "m" (st_mfp.par_dt_reg) : "cc" );
 
 /* Do cache push/invalidate for DMA read/write. This function obeys the
  * snooping on some machines (Medusa) and processors: The Medusa itself can
@@ -565,7 +565,7 @@ struct MFP
   u_char char_dummy23;
   u_char usart_dta;
  };
-# define mfp ((*(volatile struct MFP*)MFP_BAS))
+# define st_mfp ((*(volatile struct MFP*)MFP_BAS))
 
 /* TT's second MFP */
 
index 5748e99f4e260a2c3337a6bb4808dfc62ab8c774..f597892e43a00a6699219298dca76e6f081c9161 100644 (file)
@@ -113,7 +113,7 @@ static inline int get_mfp_bit( unsigned irq, int type )
 {      unsigned char   mask, *reg;
 
        mask = 1 << (irq & 7);
-       reg = (unsigned char *)&mfp.int_en_a + type*4 +
+       reg = (unsigned char *)&st_mfp.int_en_a + type*4 +
                  ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
        return( *reg & mask );
 }
@@ -123,7 +123,7 @@ static inline void set_mfp_bit( unsigned irq, int type )
 {      unsigned char   mask, *reg;
 
        mask = 1 << (irq & 7);
-       reg = (unsigned char *)&mfp.int_en_a + type*4 +
+       reg = (unsigned char *)&st_mfp.int_en_a + type*4 +
                  ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
        __asm__ __volatile__ ( "orb %0,%1"
                              : : "di" (mask), "m" (*reg) : "memory" );
@@ -134,7 +134,7 @@ static inline void clear_mfp_bit( unsigned irq, int type )
 {      unsigned char   mask, *reg;
 
        mask = ~(1 << (irq & 7));
-       reg = (unsigned char *)&mfp.int_en_a + type*4 +
+       reg = (unsigned char *)&st_mfp.int_en_a + type*4 +
                  ((irq & 8) >> 2) + (((irq-8) & 16) << 3);
        if (type == MFP_PENDING || type == MFP_SERVICE)
                __asm__ __volatile__ ( "moveb %0,%1"
index dbc64e92c41ac572bd80b99790f80977ed5e8c75..ca87f938b03f15ac041492791bab3e3e5aceca27 100644 (file)
@@ -54,4 +54,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_SOCKET_H */
index facc2d7a87cafaa7220a842cdce0954f15bdd78c..2abca17801696314c979fb2997761649e977bb36 100644 (file)
@@ -75,6 +75,9 @@ To add: #define SO_REUSEPORT 0x0200   /* Allow local address and port reuse.  */
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #ifdef __KERNEL__
 
 /** sock_type - Socket types
index 1a1f320c30d8286cff6d8d16374c9a41fa318ac3..0884947ebe270c404bb293b2acac0b067e7fd9d7 100644 (file)
@@ -51,6 +51,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
 
        return (((counters >> 14) - counters) & 0x1fff) > 1;
 }
+#define __raw_spin_is_contended        __raw_spin_is_contended
 
 static inline void __raw_spin_lock(raw_spinlock_t *lock)
 {
index 9a9f433588792f5030796b2686193f4983c98ce9..41d16822e616b0f61062f04ba3d3560a579cb946 100644 (file)
@@ -7,6 +7,7 @@ mainmenu "Linux Kernel Configuration"
 
 config MN10300
        def_bool y
+       select HAVE_OPROFILE
 
 config AM33
        def_bool y
index 1a86425fec42302a9f6558c6e40279ddcc85e2f2..07dbbcda3b2e5dc57f71ee2ba376f6da83010d63 100644 (file)
@@ -173,7 +173,7 @@ static int pci_ampci_write_config_byte(struct pci_bus *bus, unsigned int devfn,
                BRIDGEREGB(where) = value;
        } else {
                if (bus->number == 0 &&
-                   (devfn == PCI_DEVFN(2, 0) && devfn == PCI_DEVFN(3, 0))
+                   (devfn == PCI_DEVFN(2, 0) || devfn == PCI_DEVFN(3, 0))
                    )
                        __pcidebug("<= %02x", bus, devfn, where, value);
                CONFIG_ADDRESS = CONFIG_CMD(bus, devfn, where);
index fba402c95ac2d403856e141508453646c3a38b5e..885472bf7b7883254afe15bf4c3c3d408731efc2 100644 (file)
@@ -54,6 +54,9 @@
 
 #define SO_MARK                        0x401f
 
+#define SO_TIMESTAMPING                0x4020
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 /* O_NONBLOCK clashes with the bits used for socket types.  Therefore we
  * have to define SOCK_NONBLOCK to a different value here.
  */
index 909a89cab9aca20d7bc8f651ecd1c1caef4ae10c..3ebf7ec0484cde8820b97806ad929df74155dbe8 100644 (file)
                        interrupts = <37 0x8 36 0x8 35 0x8>;
                        interrupt-parent = <&ipic>;
                        tbi-handle = < &tbi0 >;
-                       phy-handle = < &phy1 >;
+                       /* Vitesse 7385 isn't on the MDIO bus */
+                       fixed-link = <1 1 1000 0 0>;
                        fsl,magic-packet;
 
                        mdio@24520 {
                                #size-cells = <0>;
                                compatible = "fsl,gianfar-mdio";
                                reg = <0x24520 0x20>;
-                               phy1: ethernet-phy@1 {
-                                       interrupt-parent = <&ipic>;
-                                       interrupts = <19 0x8>;
-                                       reg = <0x1>;
-                                       device_type = "ethernet-phy";
-                               };
                                phy4: ethernet-phy@4 {
                                        interrupt-parent = <&ipic>;
                                        interrupts = <20 0x8>;
                };
 
                enet1: ethernet@25000 {
+                       #address-cells = <1>;
+                       #size-cells = <1>;
                        cell-index = <1>;
                        device_type = "network";
                        model = "eTSEC";
index 9e47ae957e2e4e90af237933880e48abe2b8ce38..409d017621a8f7a8ea4f8f5395e8549439a48c67 100644 (file)
@@ -651,7 +651,7 @@ CONFIG_CICADA_PHY=y
 # CONFIG_NATIONAL_PHY is not set
 # CONFIG_STE10XP is not set
 # CONFIG_LSI_ET1011C_PHY is not set
-# CONFIG_FIXED_PHY is not set
+CONFIG_FIXED_PHY=y
 # CONFIG_MDIO_BITBANG is not set
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
index 6b18ba9d2d856fabc31e86dc9d6ebbb300aac63d..1dbca4e7de67d70b1d28ed52c370312f81c2e041 100644 (file)
@@ -60,7 +60,7 @@
 /* It should be preserving the high 48 bits and then specifically */
 /* preserving _PAGE_SECONDARY | _PAGE_GROUP_IX */
 #define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \
-                         _PAGE_HPTEFLAGS)
+                         _PAGE_HPTEFLAGS | _PAGE_SPECIAL)
 
 /* Bits to mask out from a PMD to get to the PTE page */
 #define PMD_MASKED_BITS                0
index 07b0d8f09cb60ecbad1a963193fa0cfec85a0155..7389003349a693a4f021f0144fc56d9d2e3fe4d2 100644 (file)
@@ -114,7 +114,7 @@ static inline struct subpage_prot_table *pgd_subpage_prot(pgd_t *pgd)
  * pgprot changes
  */
 #define _PAGE_CHG_MASK (PTE_RPN_MASK | _PAGE_HPTEFLAGS | _PAGE_DIRTY | \
-                         _PAGE_ACCESSED)
+                         _PAGE_ACCESSED | _PAGE_SPECIAL)
 
 /* Bits to mask out from a PMD to get to the PTE page */
 #define PMD_MASKED_BITS                0x1ff
index f69a4d97772904ea5c42beda4748a8d4cc085202..820b5f0a35ce309fcc1b2f662625d0205abfc8dc 100644 (file)
@@ -429,7 +429,8 @@ extern int icache_44x_need_flush;
 #define PMD_PAGE_SIZE(pmd)     bad_call_to_PMD_PAGE_SIZE()
 #endif
 
-#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
+#define _PAGE_CHG_MASK (PAGE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY | \
+                        _PAGE_SPECIAL)
 
 
 #define PAGE_PROT_BITS (_PAGE_GUARDED | _PAGE_COHERENT | _PAGE_NO_CACHE | \
index f5a4e168e498b6641c3c1ea3b0afac640a233015..1e5cfad0e3f7d664220ebcb4f93a3ab9ae67979e 100644 (file)
@@ -61,4 +61,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_POWERPC_SOCKET_H */
index 5af4e9b2dbe2c6dcdde0213809f0d74673e19252..ada06924a423b312e1e404c65a3d446e92fb31ea 100644 (file)
@@ -646,11 +646,16 @@ static int emulate_vsx(unsigned char __user *addr, unsigned int reg,
                       unsigned int areg, struct pt_regs *regs,
                       unsigned int flags, unsigned int length)
 {
-       char *ptr = (char *) &current->thread.TS_FPR(reg);
+       char *ptr;
        int ret = 0;
 
        flush_vsx_to_thread(current);
 
+       if (reg < 32)
+               ptr = (char *) &current->thread.TS_FPR(reg);
+       else
+               ptr = (char *) &current->thread.vr[reg - 32];
+
        if (flags & ST)
                ret = __copy_to_user(addr, ptr, length);
         else {
index 5355244c99ff934abde18ce75336fe9a37689bcb..60c60ccf5e3c83cdd3f9d02fe2b0d48c88edf66b 100644 (file)
@@ -195,8 +195,9 @@ __ftrace_make_nop(struct module *mod,
                return -EINVAL;
        }
 
-       offset = (unsigned)((unsigned short)jmp[0]) << 16 |
-               (unsigned)((unsigned short)jmp[1]);
+       /* The bottom half is signed extended */
+       offset = ((unsigned)((unsigned short)jmp[0]) << 16) +
+               (int)((short)jmp[1]);
 
        DEBUGP(" %x ", offset);
 
index 19b12d2cbb4ba2e97f2aaff19f32a1eb54cecc73..0f418127231155e8c0589ab7d0c990e2851e5c7e 100644 (file)
@@ -561,8 +561,21 @@ int pci_mmap_legacy_page_range(struct pci_bus *bus,
                 (unsigned long long)(offset + size - 1));
 
        if (mmap_state == pci_mmap_mem) {
-               if ((offset + size) > hose->isa_mem_size)
-                       return -ENXIO;
+               /* Hack alert !
+                *
+                * Because X is lame and can fail starting if it gets an error trying
+                * to mmap legacy_mem (instead of just moving on without legacy memory
+                * access) we fake it here by giving it anonymous memory, effectively
+                * behaving just like /dev/zero
+                */
+               if ((offset + size) > hose->isa_mem_size) {
+                       printk(KERN_DEBUG
+                              "Process %s (pid:%d) mapped non-existing PCI legacy memory for 0%04x:%02x\n",
+                              current->comm, current->pid, pci_domain_nr(bus), bus->number);
+                       if (vma->vm_flags & VM_SHARED)
+                               return shmem_zero_setup(vma);
+                       return 0;
+               }
                offset += hose->isa_mem_phys;
        } else {
                unsigned long io_offset = (unsigned long)hose->io_base_virt - _IO_BASE;
index 2822c8ccfaaf3ae036d6ce8da0fc16b4cf7c12a7..5f81256287f5967d1480e7abbbac2fbcab40ac9c 100644 (file)
@@ -125,6 +125,10 @@ static void kvmppc_free_vcpus(struct kvm *kvm)
        }
 }
 
+void kvm_arch_sync_events(struct kvm *kvm)
+{
+}
+
 void kvm_arch_destroy_vm(struct kvm *kvm)
 {
        kvmppc_free_vcpus(kvm);
index 4aae0c3876452919d17b95322682ea7486d0beb6..13b7d54f185bba4013ff736cfaa54035c5072d38 100644 (file)
@@ -172,6 +172,8 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
                        }
                        break;
                case 0x378:     /* orx */
+                       if (instr & 1)
+                               break;
                        rs = (instr >> 21) & 0x1f;
                        rb = (instr >> 11) & 0x1f;
                        if (rs == rb) {         /* mr */
index 1971e4ee3d6e05b657e15ddcd7e62b7bcda5f5a5..ea6e41e39d9fc60ff38c2cb911952f9f013d3ef3 100644 (file)
@@ -73,7 +73,7 @@ extern unsigned int tlbcam_index;
 /*
  * Return PA for this VA if it is mapped by a CAM, or 0
  */
-unsigned long v_mapped_by_tlbcam(unsigned long va)
+phys_addr_t v_mapped_by_tlbcam(unsigned long va)
 {
        int b;
        for (b = 0; b < tlbcam_index; ++b)
@@ -85,7 +85,7 @@ unsigned long v_mapped_by_tlbcam(unsigned long va)
 /*
  * Return VA for a given PA or 0 if not mapped
  */
-unsigned long p_mapped_by_tlbcam(unsigned long pa)
+unsigned long p_mapped_by_tlbcam(phys_addr_t pa)
 {
        int b;
        for (b = 0; b < tlbcam_index; ++b)
index 67850ec9feb36e04ae26ddb6acef20709ff6db16..14af8cedab704031502b59163cf8b2a354c9d5bb 100644 (file)
@@ -320,7 +320,7 @@ _GLOBAL(create_hpte)
        and     r8,r8,r0                /* writable if _RW & _DIRTY */
        rlwimi  r5,r5,32-1,30,30        /* _PAGE_USER -> PP msb */
        rlwimi  r5,r5,32-2,31,31        /* _PAGE_USER -> PP lsb */
-       ori     r8,r8,0xe14             /* clear out reserved bits and M */
+       ori     r8,r8,0xe04             /* clear out reserved bits */
        andc    r8,r5,r8                /* PP = user? (rw&dirty? 2: 3): 0 */
 BEGIN_FTR_SECTION
        rlwinm  r8,r8,0,~_PAGE_COHERENT /* clear M (coherence not required) */
index 7393bd76d698406f85a70b423113c8e163afacae..5ac08b8ab654f50391ebc8087c57a2b84c48aa52 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/notifier.h>
 #include <linux/lmb.h>
 #include <linux/of.h>
+#include <linux/pfn.h>
 #include <asm/sparsemem.h>
 #include <asm/prom.h>
 #include <asm/system.h>
@@ -882,7 +883,7 @@ static void mark_reserved_regions_for_nid(int nid)
                unsigned long physbase = lmb.reserved.region[i].base;
                unsigned long size = lmb.reserved.region[i].size;
                unsigned long start_pfn = physbase >> PAGE_SHIFT;
-               unsigned long end_pfn = ((physbase + size) >> PAGE_SHIFT);
+               unsigned long end_pfn = PFN_UP(physbase + size);
                struct node_active_region node_ar;
                unsigned long node_end_pfn = node->node_start_pfn +
                                             node->node_spanned_pages;
@@ -908,7 +909,7 @@ static void mark_reserved_regions_for_nid(int nid)
                         */
                        if (end_pfn > node_ar.end_pfn)
                                reserve_size = (node_ar.end_pfn << PAGE_SHIFT)
-                                       - (start_pfn << PAGE_SHIFT);
+                                       - physbase;
                        /*
                         * Only worry about *this* node, others may not
                         * yet have valid NODE_DATA().
index 22972cd83cc981b33cf8274f8e6e35e9b99989ad..58bcaeba728d6b6a57355f1736d8737e6f0bbd3b 100644 (file)
@@ -61,8 +61,8 @@ void setbat(int index, unsigned long virt, phys_addr_t phys,
 
 #ifdef HAVE_TLBCAM
 extern unsigned int tlbcam_index;
-extern unsigned long v_mapped_by_tlbcam(unsigned long va);
-extern unsigned long p_mapped_by_tlbcam(unsigned long pa);
+extern phys_addr_t v_mapped_by_tlbcam(unsigned long va);
+extern unsigned long p_mapped_by_tlbcam(phys_addr_t pa);
 #else /* !HAVE_TLBCAM */
 #define v_mapped_by_tlbcam(x)  (0UL)
 #define p_mapped_by_tlbcam(x)  (0UL)
index 9305ddaac5125d941772dc45552264215d1adf8d..b129d007e7fe34355de00d171d0a1282c3e05517 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/smp.h>
 #include <linux/slab.h>
 #include <asm/cell-pmu.h>
+#include <asm/time.h>
 #include "pr_util.h"
 
 #define SCALE_SHIFT 14
index 9876d7e072f46b3f825dc9df9683ac2b573cf1ae..ddf0bdc0fc8ba1a6845fb283a5330d21ab0701ce 100644 (file)
@@ -186,7 +186,7 @@ out_unmap_regs:
        iounmap(priv->regs);
 out_free_bootmem:
        free_bootmem((unsigned long)priv,
-                    sizeof(sizeof(struct pq2ads_pci_pic)));
+                    sizeof(struct pq2ads_pci_pic));
        of_node_put(np);
 out_unmap_irq:
        irq_dispose_mapping(irq);
index 67de6bf3db3d243a6d542dec9b9028d7f9fcf111..d281cc0bca712fd24553ca34b9477d5c8e47b68e 100644 (file)
@@ -328,7 +328,7 @@ static int __init ps3_mm_add_memory(void)
        return result;
 }
 
-core_initcall(ps3_mm_add_memory);
+device_initcall(ps3_mm_add_memory);
 
 /*============================================================================*/
 /* dma routines                                                               */
index a623ad256e9e500684cd972ccae1be3b4866c62e..9b21ee68ea5070d4e04eb1392505b913ac7f4cf2 100644 (file)
@@ -14,6 +14,7 @@
 #include <asm/firmware.h>
 #include <asm/machdep.h>
 #include <asm/pSeries_reconfig.h>
+#include <asm/sparsemem.h>
 
 static int pseries_remove_lmb(unsigned long base, unsigned int lmb_size)
 {
index b16ca3ed65d25bbee94aaeb82809c6810e60db97..78f1f7cca0a017ba6ee17d83065ba1544f0dbb71 100644 (file)
@@ -165,7 +165,7 @@ static int cpm2_set_irq_type(unsigned int virq, unsigned int flow_type)
                        edibit = (14 - (src - CPM2_IRQ_EXT1));
        else
                if (src >= CPM2_IRQ_PORTC15 && src <= CPM2_IRQ_PORTC0)
-                       edibit = (31 - (src - CPM2_IRQ_PORTC15));
+                       edibit = (31 - (CPM2_IRQ_PORTC0 - src));
                else
                        return (flow_type & IRQ_TYPE_LEVEL_LOW) ? 0 : -EINVAL;
 
index 88a983ece5c9aa4e25749072f962c3317dba3a34..9a89cd3e80a25d914c481c3d0067810cccc7941f 100644 (file)
@@ -890,7 +890,7 @@ unsigned int ipic_get_irq(void)
        return irq_linear_revmap(primary_ipic->irqhost, irq);
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_SUSPEND
 static struct {
        u32 sicfr;
        u32 siprr[2];
index a0e748da99094e5dd93f343f419527d6bd9d78c1..31e809c77790200c19064084f297bd7ad27eae30 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28-rc6
-# Thu Nov 27 11:00:49 2008
+# Linux kernel version: 2.6.29-rc4
+# Wed Feb 11 10:07:16 2009
 #
 CONFIG_SCHED_MC=y
 CONFIG_MMU=y
@@ -14,12 +14,14 @@ CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_BUG=y
 CONFIG_NO_IOMEM=y
 CONFIG_NO_DMA=y
 CONFIG_GENERIC_LOCKBREAK=y
 CONFIG_PGSTE=y
+CONFIG_VIRT_CPU_ACCOUNTING=y
 CONFIG_S390=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
@@ -39,20 +41,29 @@ CONFIG_POSIX_MQUEUE=y
 # CONFIG_TASKSTATS is not set
 CONFIG_AUDIT=y
 # CONFIG_AUDITSYSCALL is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_CLASSIC_RCU=y
+# CONFIG_TREE_RCU is not set
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_TREE_RCU_TRACE is not set
+# CONFIG_PREEMPT_RCU_TRACE is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=17
+CONFIG_GROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_RT_GROUP_SCHED is not set
+CONFIG_USER_SCHED=y
+# CONFIG_CGROUP_SCHED is not set
 CONFIG_CGROUPS=y
 # CONFIG_CGROUP_DEBUG is not set
 CONFIG_CGROUP_NS=y
 # CONFIG_CGROUP_FREEZER is not set
 # CONFIG_CGROUP_DEVICE is not set
 # CONFIG_CPUSETS is not set
-CONFIG_GROUP_SCHED=y
-CONFIG_FAIR_GROUP_SCHED=y
-# CONFIG_RT_GROUP_SCHED is not set
-CONFIG_USER_SCHED=y
-# CONFIG_CGROUP_SCHED is not set
 # CONFIG_CGROUP_CPUACCT is not set
 # CONFIG_RESOURCE_COUNTERS is not set
 CONFIG_SYSFS_DEPRECATED=y
@@ -63,6 +74,7 @@ CONFIG_UTS_NS=y
 CONFIG_IPC_NS=y
 # CONFIG_USER_NS is not set
 # CONFIG_PID_NS is not set
+# CONFIG_NET_NS is not set
 CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
@@ -91,17 +103,17 @@ CONFIG_SLAB=y
 # CONFIG_SLUB is not set
 # CONFIG_SLOB is not set
 # CONFIG_PROFILING is not set
-# CONFIG_MARKERS is not set
 CONFIG_HAVE_OPROFILE=y
 CONFIG_KPROBES=y
+CONFIG_HAVE_SYSCALL_WRAPPERS=y
 CONFIG_KRETPROBES=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
 CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
 # CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
 # CONFIG_MODULE_FORCE_LOAD is not set
@@ -109,7 +121,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_MODVERSIONS=y
 # CONFIG_MODULE_SRCVERSION_ALL is not set
-CONFIG_KMOD=y
+CONFIG_INIT_ALL_POSSIBLE=y
 CONFIG_STOP_MACHINE=y
 CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
@@ -130,7 +142,6 @@ CONFIG_DEFAULT_DEADLINE=y
 # CONFIG_DEFAULT_NOOP is not set
 CONFIG_DEFAULT_IOSCHED="deadline"
 CONFIG_PREEMPT_NOTIFIERS=y
-CONFIG_CLASSIC_RCU=y
 # CONFIG_FREEZER is not set
 
 #
@@ -161,6 +172,7 @@ CONFIG_S390_EXEC_PROTECT=y
 CONFIG_MARCH_Z900=y
 # CONFIG_MARCH_Z990 is not set
 # CONFIG_MARCH_Z9_109 is not set
+# CONFIG_MARCH_Z10 is not set
 CONFIG_PACK_STACK=y
 # CONFIG_SMALL_STACK is not set
 CONFIG_CHECK_STACK=y
@@ -174,7 +186,6 @@ CONFIG_ARCH_POPULATES_NODE_MAP=y
 # CONFIG_PREEMPT_NONE is not set
 # CONFIG_PREEMPT_VOLUNTARY is not set
 CONFIG_PREEMPT=y
-# CONFIG_PREEMPT_RCU is not set
 CONFIG_ARCH_SPARSEMEM_ENABLE=y
 CONFIG_ARCH_SPARSEMEM_DEFAULT=y
 CONFIG_ARCH_SELECT_MEMORY_MODEL=y
@@ -195,7 +206,6 @@ CONFIG_MEMORY_HOTREMOVE=y
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
-CONFIG_RESOURCES_64BIT=y
 CONFIG_PHYS_ADDR_T_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
@@ -207,7 +217,6 @@ CONFIG_UNEVICTABLE_LRU=y
 #
 CONFIG_MACHCHK_WARNING=y
 CONFIG_QDIO=y
-# CONFIG_QDIO_DEBUG is not set
 CONFIG_CHSC_SCH=m
 
 #
@@ -227,15 +236,13 @@ CONFIG_PFAULT=y
 # CONFIG_SHARED_KERNEL is not set
 # CONFIG_CMM is not set
 # CONFIG_PAGE_STATES is not set
-CONFIG_VIRT_TIMER=y
-CONFIG_VIRT_CPU_ACCOUNTING=y
 # CONFIG_APPLDATA_BASE is not set
 CONFIG_HZ_100=y
 # CONFIG_HZ_250 is not set
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=100
-# CONFIG_SCHED_HRTICK is not set
+CONFIG_SCHED_HRTICK=y
 CONFIG_S390_HYPFS_FS=y
 CONFIG_KEXEC=y
 # CONFIG_ZFCPDUMP is not set
@@ -245,6 +252,7 @@ CONFIG_NET=y
 #
 # Networking options
 #
+CONFIG_COMPAT_NET_DEV_OPS=y
 CONFIG_PACKET=y
 # CONFIG_PACKET_MMAP is not set
 CONFIG_UNIX=y
@@ -383,6 +391,7 @@ CONFIG_NET_SCH_TBF=m
 CONFIG_NET_SCH_GRED=m
 CONFIG_NET_SCH_DSMARK=m
 # CONFIG_NET_SCH_NETEM is not set
+# CONFIG_NET_SCH_DRR is not set
 # CONFIG_NET_SCH_INGRESS is not set
 
 #
@@ -400,6 +409,7 @@ CONFIG_CLS_U32_MARK=y
 CONFIG_NET_CLS_RSVP=m
 CONFIG_NET_CLS_RSVP6=m
 CONFIG_NET_CLS_FLOW=m
+# CONFIG_NET_CLS_CGROUP is not set
 # CONFIG_NET_EMATCH is not set
 CONFIG_NET_CLS_ACT=y
 CONFIG_NET_ACT_POLICE=y
@@ -411,6 +421,7 @@ CONFIG_NET_ACT_NAT=m
 # CONFIG_NET_ACT_SKBEDIT is not set
 # CONFIG_NET_CLS_IND is not set
 CONFIG_NET_SCH_FIFO=y
+# CONFIG_DCB is not set
 
 #
 # Network testing
@@ -428,6 +439,7 @@ CONFIG_CAN_VCAN=m
 # CONFIG_CAN_DEBUG_DEVICES is not set
 # CONFIG_AF_RXRPC is not set
 # CONFIG_PHONET is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 # CONFIG_PCMCIA is not set
@@ -475,10 +487,14 @@ CONFIG_DASD_DIAG=y
 CONFIG_DASD_EER=y
 CONFIG_VIRTIO_BLK=m
 CONFIG_MISC_DEVICES=y
-# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_ENCLOSURE_SERVICES is not set
 # CONFIG_C2PORT is not set
 
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+
 #
 # SCSI device support
 #
@@ -520,6 +536,7 @@ CONFIG_SCSI_FC_ATTRS=y
 # CONFIG_SCSI_SRP_ATTRS is not set
 CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
+# CONFIG_LIBFC is not set
 # CONFIG_SCSI_DEBUG is not set
 CONFIG_ZFCP=y
 CONFIG_SCSI_DH=m
@@ -566,6 +583,10 @@ CONFIG_NET_ETHERNET=y
 CONFIG_NETDEV_1000=y
 CONFIG_NETDEV_10000=y
 # CONFIG_TR is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
 # CONFIG_WAN is not set
 
 #
@@ -593,9 +614,11 @@ CONFIG_VIRTIO_NET=m
 #
 CONFIG_DEVKMEM=y
 CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
 CONFIG_HVC_DRIVER=y
+CONFIG_HVC_IUCV=y
 CONFIG_VIRTIO_CONSOLE=y
 CONFIG_HW_RANDOM=m
 CONFIG_HW_RANDOM_VIRTIO=m
@@ -645,7 +668,6 @@ CONFIG_S390_VMUR=m
 # CONFIG_NEW_LEDS is not set
 CONFIG_ACCESSIBILITY=y
 # CONFIG_STAGING is not set
-CONFIG_STAGING_EXCLUDE_BUILD=y
 
 #
 # File systems
@@ -668,6 +690,7 @@ CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -703,10 +726,7 @@ CONFIG_TMPFS_POSIX_ACL=y
 # CONFIG_HUGETLBFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_CONFIGFS_FS=m
-
-#
-# Miscellaneous filesystems
-#
+CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_ADFS_FS is not set
 # CONFIG_AFFS_FS is not set
 # CONFIG_HFS_FS is not set
@@ -715,6 +735,7 @@ CONFIG_CONFIGFS_FS=m
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
 # CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
@@ -808,6 +829,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_DEBUG_MEMORY_INIT=y
 # CONFIG_DEBUG_LIST is not set
 # CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
 # CONFIG_FRAME_POINTER is not set
 # CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_RCU_CPU_STALL_DETECTOR is not set
@@ -818,15 +840,19 @@ CONFIG_DEBUG_MEMORY_INIT=y
 # CONFIG_FAULT_INJECTION is not set
 # CONFIG_LATENCYTOP is not set
 CONFIG_SYSCTL_SYSCALL_CHECK=y
+CONFIG_HAVE_FUNCTION_TRACER=y
 
 #
 # Tracers
 #
+# CONFIG_FUNCTION_TRACER is not set
 # CONFIG_IRQSOFF_TRACER is not set
 # CONFIG_PREEMPT_TRACER is not set
 # CONFIG_SCHED_TRACER is not set
 # CONFIG_CONTEXT_SWITCH_TRACER is not set
 # CONFIG_BOOT_TRACER is not set
+# CONFIG_TRACE_BRANCH_PROFILING is not set
+# CONFIG_STACK_TRACER is not set
 # CONFIG_DYNAMIC_PRINTK_DEBUG is not set
 CONFIG_SAMPLES=y
 # CONFIG_SAMPLE_KOBJECT is not set
@@ -847,11 +873,17 @@ CONFIG_CRYPTO=y
 #
 CONFIG_CRYPTO_FIPS=y
 CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_AEAD=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD=m
+CONFIG_CRYPTO_AEAD2=y
 CONFIG_CRYPTO_BLKCIPHER=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_RNG=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH=m
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG=m
+CONFIG_CRYPTO_RNG2=y
 CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
 CONFIG_CRYPTO_GF128MUL=m
 # CONFIG_CRYPTO_NULL is not set
 # CONFIG_CRYPTO_CRYPTD is not set
@@ -885,7 +917,7 @@ CONFIG_CRYPTO_HMAC=m
 #
 # Digest
 #
-# CONFIG_CRYPTO_CRC32C is not set
+CONFIG_CRYPTO_CRC32C=m
 # CONFIG_CRYPTO_MD4 is not set
 CONFIG_CRYPTO_MD5=m
 # CONFIG_CRYPTO_MICHAEL_MIC is not set
@@ -942,6 +974,7 @@ CONFIG_S390_PRNG=m
 # Library routines
 #
 CONFIG_BITREVERSE=m
+CONFIG_GENERIC_FIND_LAST_BIT=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
 CONFIG_CRC_T10DIF=y
index 521726430afac81fcb19e870e4765a44fa85e528..95b0f7db3c69dcb076c7969ceacba1f5ab2f82b0 100644 (file)
@@ -145,7 +145,7 @@ cputime_to_timeval(const cputime_t cputime, struct timeval *value)
        value->tv_usec = rp.subreg.even / 4096;
        value->tv_sec = rp.subreg.odd;
 #else
-       value->tv_usec = cputime % 4096000000ULL;
+       value->tv_usec = (cputime % 4096000000ULL) / 4096;
        value->tv_sec = cputime / 4096000000ULL;
 #endif
 }
index ffdef5fe8587017a6b25aa2ba44c37a5aa1f9ce6..f3720defdd164de6e47cc5524cc9f5f67564f3b9 100644 (file)
@@ -384,8 +384,8 @@ struct _lowcore
         __u32        panic_magic;              /* 0xe00 */
 
        /* Per cpu primary space access list */
-       __u8         pad_0xe04[0xe3c-0xe04];   /* 0xe04 */
-       __u32        vdso_per_cpu_data;        /* 0xe3c */
+       __u8         pad_0xe04[0xe38-0xe04];   /* 0xe04 */
+       __u64        vdso_per_cpu_data;        /* 0xe38 */
        __u32        paste[16];                /* 0xe40 */
 
        __u8         pad13[0x11b8-0xe80];      /* 0xe80 */
index 2bd9faeb3919a0a3b7fae325769c3042db144d44..e8bd6ac22c996e40378654d7bdad1b9824ac826f 100644 (file)
@@ -43,6 +43,8 @@ struct mem_chunk {
 
 extern struct mem_chunk memory_chunk[];
 extern unsigned long real_memory_size;
+extern int memory_end_set;
+extern unsigned long memory_end;
 
 void detect_memory_layout(struct mem_chunk chunk[]);
 
index c786ab623b2d2d0f3f63aedfa5873248f40b156d..02330c50241b161a50b748e501d0b386054f88a1 100644 (file)
@@ -62,4 +62,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_SOCKET_H */
index e7c5bfb7c755acf812f563a6c4d2986843fcbd04..026a37a94fc9fa6c3560de0bb1424688fddd4f39 100644 (file)
@@ -95,6 +95,7 @@ asmlinkage void do_softirq(void)
        local_irq_restore(flags);
 }
 
+#ifdef CONFIG_PROC_FS
 void init_irq_proc(void)
 {
        struct proc_dir_entry *root_irq_dir;
@@ -102,3 +103,4 @@ void init_irq_proc(void)
        root_irq_dir = proc_mkdir("irq", NULL);
        create_prof_cpu_mask(root_irq_dir);
 }
+#endif
index d825f4950e4e2f721e89de76fc98fe3dad91971b..c5cfb6185eaca51eb5e9ee3667d1c4d06ee22a52 100644 (file)
@@ -82,7 +82,9 @@ char elf_platform[ELF_PLATFORM_SIZE];
 
 struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
 volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
-static unsigned long __initdata memory_end;
+
+int __initdata memory_end_set;
+unsigned long __initdata memory_end;
 
 /*
  * This is set up by the setup-routine at boot-time
@@ -281,6 +283,7 @@ void (*pm_power_off)(void) = machine_power_off;
 static int __init early_parse_mem(char *p)
 {
        memory_end = memparse(p, &p);
+       memory_end_set = 1;
        return 0;
 }
 early_param("mem", early_parse_mem);
@@ -508,8 +511,10 @@ static void __init setup_memory_end(void)
        int i;
 
 #if defined(CONFIG_ZFCPDUMP) || defined(CONFIG_ZFCPDUMP_MODULE)
-       if (ipl_info.type == IPL_TYPE_FCP_DUMP)
+       if (ipl_info.type == IPL_TYPE_FCP_DUMP) {
                memory_end = ZFCPDUMP_HSA_SIZE;
+               memory_end_set = 1;
+       }
 #endif
        memory_size = 0;
        memory_end &= PAGE_MASK;
index be8497186b96d86472f1ae692c9c74e7c88515f4..0d33893e1e898448c05b7ec2573904a81850180b 100644 (file)
@@ -212,6 +212,10 @@ static void kvm_free_vcpus(struct kvm *kvm)
        }
 }
 
+void kvm_arch_sync_events(struct kvm *kvm)
+{
+}
+
 void kvm_arch_destroy_vm(struct kvm *kvm)
 {
        kvm_free_vcpus(kvm);
index caf4c33f4e8417afa35e5a72c57a0606fce8555b..7c35787d29b45b22a41c58bb57491137df7f4db4 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/gpio.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi_gpio.h>
+#include <media/ov772x.h>
 #include <media/soc_camera_platform.h>
 #include <media/sh_mobile_ceu.h>
 #include <video/sh_mobile_lcdc.h>
@@ -216,7 +217,14 @@ static struct platform_device lcdc_device = {
        },
 };
 
+static void camera_power(int val)
+{
+       gpio_set_value(GPIO_PTZ5, val); /* RST_CAM/RSTB */
+       mdelay(10);
+}
+
 #ifdef CONFIG_I2C
+/* support for the old ncm03j camera */
 static unsigned char camera_ncm03j_magic[] =
 {
        0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8,
@@ -237,6 +245,23 @@ static unsigned char camera_ncm03j_magic[] =
        0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F,
 };
 
+static int camera_probe(void)
+{
+       struct i2c_adapter *a = i2c_get_adapter(0);
+       struct i2c_msg msg;
+       int ret;
+
+       camera_power(1);
+       msg.addr = 0x6e;
+       msg.buf = camera_ncm03j_magic;
+       msg.len = 2;
+       msg.flags = 0;
+       ret = i2c_transfer(a, &msg, 1);
+       camera_power(0);
+
+       return ret;
+}
+
 static int camera_set_capture(struct soc_camera_platform_info *info,
                              int enable)
 {
@@ -245,9 +270,11 @@ static int camera_set_capture(struct soc_camera_platform_info *info,
        int ret = 0;
        int i;
 
+       camera_power(0);
        if (!enable)
                return 0; /* no disable for now */
 
+       camera_power(1);
        for (i = 0; i < ARRAY_SIZE(camera_ncm03j_magic); i += 2) {
                u_int8_t buf[8];
 
@@ -286,8 +313,35 @@ static struct platform_device camera_device = {
                .platform_data  = &camera_info,
        },
 };
+
+static int __init camera_setup(void)
+{
+       if (camera_probe() > 0)
+               platform_device_register(&camera_device);
+
+       return 0;
+}
+late_initcall(camera_setup);
+
 #endif /* CONFIG_I2C */
 
+static int ov7725_power(struct device *dev, int mode)
+{
+       camera_power(0);
+       if (mode)
+               camera_power(1);
+
+       return 0;
+}
+
+static struct ov772x_camera_info ov7725_info = {
+       .buswidth  = SOCAM_DATAWIDTH_8,
+       .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
+       .link = {
+               .power  = ov7725_power,
+       },
+};
+
 static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
        .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
        SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
@@ -338,9 +392,6 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
        &ap325rxa_nor_flash_device,
        &lcdc_device,
        &ceu_device,
-#ifdef CONFIG_I2C
-       &camera_device,
-#endif
        &nand_flash_device,
        &sdcard_cn3_device,
 };
@@ -349,6 +400,10 @@ static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
        {
                I2C_BOARD_INFO("pcf8563", 0x51),
        },
+       {
+               I2C_BOARD_INFO("ov772x", 0x21),
+               .platform_data = &ov7725_info,
+       },
 };
 
 static struct spi_board_info ap325rxa_spi_devices[] = {
@@ -426,7 +481,7 @@ static int __init ap325rxa_devices_setup(void)
        gpio_request(GPIO_PTZ6, NULL);
        gpio_direction_output(GPIO_PTZ6, 0); /* STBY_CAM */
        gpio_request(GPIO_PTZ5, NULL);
-       gpio_direction_output(GPIO_PTZ5, 1); /* RST_CAM */
+       gpio_direction_output(GPIO_PTZ5, 0); /* RST_CAM */
        gpio_request(GPIO_PTZ4, NULL);
        gpio_direction_output(GPIO_PTZ4, 0); /* SADDR */
 
index 5c423fa8e6b89d8d022bdb95d895e3623f2e686d..352f87d50fdca7f1be524e7009ccb9e5745812df 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28
-# Fri Jan  9 16:54:19 2009
+# Linux kernel version: 2.6.29-rc2
+# Tue Jan 27 11:45:08 2009
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
@@ -45,12 +45,12 @@ CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 CONFIG_GROUP_SCHED=y
 CONFIG_FAIR_GROUP_SCHED=y
 # CONFIG_RT_GROUP_SCHED is not set
 CONFIG_USER_SCHED=y
 # CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -378,6 +378,7 @@ CONFIG_WIRELESS=y
 # CONFIG_WIRELESS_EXT is not set
 # CONFIG_LIB80211 is not set
 # CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -400,6 +401,7 @@ CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_AR7_PARTS is not set
@@ -447,9 +449,7 @@ CONFIG_MTD_CFI_UTIL=y
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_START=0xffffffff
-CONFIG_MTD_PHYSMAP_LEN=0
-CONFIG_MTD_PHYSMAP_BANKWIDTH=0
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -479,6 +479,12 @@ CONFIG_MTD_NAND_IDS=y
 CONFIG_MTD_NAND_SH_FLCTL=y
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -607,6 +613,10 @@ CONFIG_SMSC911X=y
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
 # CONFIG_WAN is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
@@ -790,6 +800,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -837,7 +848,7 @@ CONFIG_SOC_CAMERA=y
 # CONFIG_SOC_CAMERA_MT9V022 is not set
 # CONFIG_SOC_CAMERA_TW9910 is not set
 CONFIG_SOC_CAMERA_PLATFORM=y
-# CONFIG_SOC_CAMERA_OV772X is not set
+CONFIG_SOC_CAMERA_OV772X=y
 CONFIG_VIDEO_SH_MOBILE_CEU=y
 # CONFIG_RADIO_ADAPTERS is not set
 # CONFIG_DAB is not set
@@ -1012,6 +1023,7 @@ CONFIG_FS_POSIX_ACL=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 CONFIG_DNOTIFY=y
 CONFIG_INOTIFY=y
 CONFIG_INOTIFY_USER=y
@@ -1060,6 +1072,7 @@ CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_JFFS2_FS is not set
 # CONFIG_UBIFS_FS is not set
 # CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
index 7758263514bccc8e5f929961eb0f240abac5f84d..678576796bdfc1c1fdc27f1bbe754fe32323510c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.28
-# Fri Jan  9 17:09:35 2009
+# Linux kernel version: 2.6.29-rc1
+# Thu Jan 22 09:16:16 2009
 #
 CONFIG_SUPERH=y
 CONFIG_SUPERH32=y
@@ -45,8 +45,12 @@ CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_CGROUPS is not set
 # CONFIG_GROUP_SCHED is not set
+
+#
+# Control Group support
+#
+# CONFIG_CGROUPS is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -389,6 +393,7 @@ CONFIG_WIRELESS_EXT=y
 CONFIG_WIRELESS_EXT_SYSFS=y
 # CONFIG_LIB80211 is not set
 # CONFIG_MAC80211 is not set
+# CONFIG_WIMAX is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -411,6 +416,7 @@ CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 CONFIG_MTD_CONCAT=y
 CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_TESTS is not set
 # CONFIG_MTD_REDBOOT_PARTS is not set
 CONFIG_MTD_CMDLINE_PARTS=y
 # CONFIG_MTD_AR7_PARTS is not set
@@ -458,9 +464,7 @@ CONFIG_MTD_CFI_UTIL=y
 #
 # CONFIG_MTD_COMPLEX_MAPPINGS is not set
 CONFIG_MTD_PHYSMAP=y
-CONFIG_MTD_PHYSMAP_START=0xffffffff
-CONFIG_MTD_PHYSMAP_LEN=0
-CONFIG_MTD_PHYSMAP_BANKWIDTH=0
+# CONFIG_MTD_PHYSMAP_COMPAT is not set
 # CONFIG_MTD_PLATRAM is not set
 
 #
@@ -487,6 +491,12 @@ CONFIG_MTD_NAND_IDS=y
 CONFIG_MTD_NAND_PLATFORM=y
 # CONFIG_MTD_ONENAND is not set
 
+#
+# LPDDR flash memory drivers
+#
+# CONFIG_MTD_LPDDR is not set
+# CONFIG_MTD_QINFO_PROBE is not set
+
 #
 # UBI - Unsorted block images
 #
@@ -587,6 +597,10 @@ CONFIG_SMC91X=y
 # CONFIG_WLAN_PRE80211 is not set
 # CONFIG_WLAN_80211 is not set
 # CONFIG_IWLWIFI_LEDS is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
 # CONFIG_WAN is not set
 # CONFIG_PPP is not set
 # CONFIG_SLIP is not set
@@ -761,6 +775,7 @@ CONFIG_SSB_POSSIBLE=y
 # CONFIG_PMIC_DA903X is not set
 # CONFIG_MFD_WM8400 is not set
 # CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
 # CONFIG_REGULATOR is not set
 
 #
@@ -806,9 +821,9 @@ CONFIG_SOC_CAMERA=y
 # CONFIG_SOC_CAMERA_MT9M111 is not set
 # CONFIG_SOC_CAMERA_MT9T031 is not set
 # CONFIG_SOC_CAMERA_MT9V022 is not set
-# CONFIG_SOC_CAMERA_TW9910 is not set
-CONFIG_SOC_CAMERA_PLATFORM=y
-# CONFIG_SOC_CAMERA_OV772X is not set
+CONFIG_SOC_CAMERA_TW9910=y
+# CONFIG_SOC_CAMERA_PLATFORM is not set
+CONFIG_SOC_CAMERA_OV772X=y
 CONFIG_VIDEO_SH_MOBILE_CEU=y
 # CONFIG_RADIO_ADAPTERS is not set
 # CONFIG_DAB is not set
@@ -866,11 +881,13 @@ CONFIG_USB_GADGET_SELECTED=y
 # CONFIG_USB_GADGET_PXA25X is not set
 # CONFIG_USB_GADGET_PXA27X is not set
 # CONFIG_USB_GADGET_S3C2410 is not set
+# CONFIG_USB_GADGET_IMX is not set
 CONFIG_USB_GADGET_M66592=y
 CONFIG_USB_M66592=y
 CONFIG_SUPERH_BUILT_IN_M66592=y
 # CONFIG_USB_GADGET_AMD5536UDC is not set
 # CONFIG_USB_GADGET_FSL_QE is not set
+# CONFIG_USB_GADGET_CI13XXX is not set
 # CONFIG_USB_GADGET_NET2280 is not set
 # CONFIG_USB_GADGET_GOKU is not set
 # CONFIG_USB_GADGET_DUMMY_HCD is not set
@@ -883,6 +900,11 @@ CONFIG_USB_G_SERIAL=y
 # CONFIG_USB_MIDI_GADGET is not set
 # CONFIG_USB_G_PRINTER is not set
 # CONFIG_USB_CDC_COMPOSITE is not set
+
+#
+# OTG and related infrastructure
+#
+# CONFIG_USB_GPIO_VBUS is not set
 # CONFIG_MMC is not set
 # CONFIG_MEMSTICK is not set
 # CONFIG_NEW_LEDS is not set
@@ -961,6 +983,7 @@ CONFIG_UIO_PDRV_GENIRQ=y
 CONFIG_FILE_LOCKING=y
 # CONFIG_XFS_FS is not set
 # CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
 # CONFIG_DNOTIFY is not set
 # CONFIG_INOTIFY is not set
 # CONFIG_QUOTA is not set
@@ -1004,6 +1027,7 @@ CONFIG_MISC_FILESYSTEMS=y
 # CONFIG_EFS_FS is not set
 # CONFIG_JFFS2_FS is not set
 # CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
 # CONFIG_VXFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_OMFS_FS is not set
index ee839ee58ac84894515d328b78f1bb73dc43119f..090358a7e1bbd6ff9da88a10282da83662ca9fd4 100644 (file)
 static inline void
 __mutex_fastpath_lock(atomic_t *count, void (*fail_fn)(atomic_t *))
 {
-       int __ex_flag, __res;
+       int __done, __res;
 
        __asm__ __volatile__ (
                "movli.l        @%2, %0 \n"
                "add            #-1, %0 \n"
                "movco.l        %0, @%2 \n"
                "movt           %1      \n"
-               : "=&z" (__res), "=&r" (__ex_flag)
+               : "=&z" (__res), "=&r" (__done)
                : "r" (&(count)->counter)
                : "t");
 
-       __res |= !__ex_flag;
-       if (unlikely(__res != 0))
+       if (unlikely(!__done || __res != 0))
                fail_fn(count);
 }
 
 static inline int
 __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
 {
-       int __ex_flag, __res;
+       int __done, __res;
 
        __asm__ __volatile__ (
                "movli.l        @%2, %0 \n"
                "add            #-1, %0 \n"
                "movco.l        %0, @%2 \n"
                "movt           %1      \n"
-               : "=&z" (__res), "=&r" (__ex_flag)
+               : "=&z" (__res), "=&r" (__done)
                : "r" (&(count)->counter)
                : "t");
 
-       __res |= !__ex_flag;
-       if (unlikely(__res != 0))
+       if (unlikely(!__done || __res != 0))
                __res = fail_fn(count);
 
        return __res;
@@ -61,19 +59,18 @@ __mutex_fastpath_lock_retval(atomic_t *count, int (*fail_fn)(atomic_t *))
 static inline void
 __mutex_fastpath_unlock(atomic_t *count, void (*fail_fn)(atomic_t *))
 {
-       int __ex_flag, __res;
+       int __done, __res;
 
        __asm__ __volatile__ (
                "movli.l        @%2, %0 \n\t"
                "add            #1, %0  \n\t"
                "movco.l        %0, @%2 \n\t"
                "movt           %1      \n\t"
-               : "=&z" (__res), "=&r" (__ex_flag)
+               : "=&z" (__res), "=&r" (__done)
                : "r" (&(count)->counter)
                : "t");
 
-       __res |= !__ex_flag;
-       if (unlikely(__res <= 0))
+       if (unlikely(!__done || __res <= 0))
                fail_fn(count);
 }
 
index 6d4bf6512959ef0a8b2e610e4fd2aeb99c88e5bf..345653b968263521f967e7968cd1be2709daaea7 100644 (file)
@@ -54,4 +54,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* __ASM_SH_SOCKET_H */
index 05a868a71ef5a7502736fd81586c540acc80ffea..5bc34681d99451ae8485a75e4c92b1c24285acbb 100644 (file)
@@ -21,23 +21,10 @@ static inline void syscall_rollback(struct task_struct *task,
         */
 }
 
-static inline bool syscall_has_error(struct pt_regs *regs)
-{
-       return (regs->sr & 0x1) ? true : false;
-}
-static inline void syscall_set_error(struct pt_regs *regs)
-{
-       regs->sr |= 0x1;
-}
-static inline void syscall_clear_error(struct pt_regs *regs)
-{
-       regs->sr &= ~0x1;
-}
-
 static inline long syscall_get_error(struct task_struct *task,
                                     struct pt_regs *regs)
 {
-       return syscall_has_error(regs) ? regs->regs[0] : 0;
+       return IS_ERR_VALUE(regs->regs[0]) ? regs->regs[0] : 0;
 }
 
 static inline long syscall_get_return_value(struct task_struct *task,
@@ -50,13 +37,10 @@ static inline void syscall_set_return_value(struct task_struct *task,
                                            struct pt_regs *regs,
                                            int error, long val)
 {
-       if (error) {
-               syscall_set_error(regs);
+       if (error)
                regs->regs[0] = -error;
-       } else {
-               syscall_clear_error(regs);
+       else
                regs->regs[0] = val;
-       }
 }
 
 static inline void syscall_get_arguments(struct task_struct *task,
index e1143b9784d62d9247760efe5738b8ba4c642d92..c3561ca72bee9fb284dbe52b823da3ca6feadbc0 100644 (file)
@@ -21,23 +21,10 @@ static inline void syscall_rollback(struct task_struct *task,
         */
 }
 
-static inline bool syscall_has_error(struct pt_regs *regs)
-{
-       return (regs->sr & 0x1) ? true : false;
-}
-static inline void syscall_set_error(struct pt_regs *regs)
-{
-       regs->sr |= 0x1;
-}
-static inline void syscall_clear_error(struct pt_regs *regs)
-{
-       regs->sr &= ~0x1;
-}
-
 static inline long syscall_get_error(struct task_struct *task,
                                     struct pt_regs *regs)
 {
-       return syscall_has_error(regs) ? regs->regs[9] : 0;
+       return IS_ERR_VALUE(regs->regs[9]) ? regs->regs[9] : 0;
 }
 
 static inline long syscall_get_return_value(struct task_struct *task,
@@ -50,13 +37,10 @@ static inline void syscall_set_return_value(struct task_struct *task,
                                            struct pt_regs *regs,
                                            int error, long val)
 {
-       if (error) {
-               syscall_set_error(regs);
+       if (error)
                regs->regs[9] = -error;
-       } else {
-               syscall_clear_error(regs);
+       else
                regs->regs[9] = val;
-       }
 }
 
 static inline void syscall_get_arguments(struct task_struct *task,
index 2780917c0088c410491c4729e92727e4ec019d0e..e3ea5411da6d8df6469623005951ef77245ed4fe 100644 (file)
@@ -423,7 +423,7 @@ static int ieee_fpe_handler(struct pt_regs *regs)
                int m;
                unsigned int hx;
 
-               m = (finsn >> 9) & 0x7;
+               m = (finsn >> 8) & 0x7;
                hx = tsk->thread.fpu.hard.fp_regs[m];
 
                if ((tsk->thread.fpu.hard.fpscr & FPSCR_CAUSE_ERROR)
index 5342475085724c3a2de5959e5cda9ea3e9d6f623..370d2cfa34eba0c427da15cc3b35fb7e34078b97 100644 (file)
@@ -262,11 +262,11 @@ void __init setup_bootmem_allocator(unsigned long free_pfn)
                        BOOTMEM_DEFAULT);
 
        /*
-        * reserve physical page 0 - it's a special BIOS page on many boxes,
-        * enabling clean reboots, SMP operation, laptop functions.
+        * Reserve physical pages below CONFIG_ZERO_PAGE_OFFSET.
         */
-       reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET,
-                       BOOTMEM_DEFAULT);
+       if (CONFIG_ZERO_PAGE_OFFSET != 0)
+               reserve_bootmem(__MEMORY_START, CONFIG_ZERO_PAGE_OFFSET,
+                               BOOTMEM_DEFAULT);
 
        sparse_memory_present_with_active_regions(0);
 
index 77c21bde376aa7d203870969c8571182049df6db..17784e19ae340ec40dbc8c97e79e3790877c98de 100644 (file)
@@ -510,7 +510,6 @@ handle_syscall_restart(unsigned long save_r0, struct pt_regs *regs,
                case -ERESTARTNOHAND:
                no_system_call_restart:
                        regs->regs[0] = -EINTR;
-                       regs->sr |= 1;
                        break;
 
                case -ERESTARTSYS:
@@ -589,8 +588,7 @@ static void do_signal(struct pt_regs *regs, unsigned int save_r0)
 
        signr = get_signal_to_deliver(&info, &ka, regs, NULL);
        if (signr > 0) {
-               if (regs->sr & 1)
-                       handle_syscall_restart(save_r0, regs, &ka.sa);
+               handle_syscall_restart(save_r0, regs, &ka.sa);
 
                /* Whee!  Actually deliver the signal.  */
                if (handle_signal(signr, &ka, &info, oldset,
index b22fdfaaa19188667e3d926d3f8433378e8544df..0663a0ee6021f4ab31c2bb32fd7a24fa82cd9a6a 100644 (file)
@@ -60,7 +60,6 @@ handle_syscall_restart(struct pt_regs *regs, struct sigaction *sa)
                case -ERESTARTNOHAND:
                no_system_call_restart:
                        regs->regs[REG_RET] = -EINTR;
-                       regs->sr |= 1;
                        break;
 
                case -ERESTARTSYS:
@@ -109,8 +108,7 @@ static int do_signal(struct pt_regs *regs, sigset_t *oldset)
 
        signr = get_signal_to_deliver(&info, &ka, regs, 0);
        if (signr > 0) {
-               if (regs->sr & 1)
-                       handle_syscall_restart(regs, &ka.sa);
+               handle_syscall_restart(regs, &ka.sa);
 
                /* Whee!  Actually deliver the signal.  */
                if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
index cbdd0d40e545f0fa0d5cea817a472f46175f5a47..356c8ec928930fc3d4c00487767c94ee321d67b5 100644 (file)
@@ -36,8 +36,7 @@
  */
 
 /*     
- * unsigned int csum_partial(const unsigned char *buf, int len,
- *                           unsigned int sum);
+ * asmlinkage __wsum csum_partial(const void *buf, int len, __wsum sum);
  */
 
 .text
@@ -49,11 +48,31 @@ ENTRY(csum_partial)
           * Fortunately, it is easy to convert 2-byte alignment to 4-byte
           * alignment for the unrolled loop.
           */
-       mov     r5, r1
        mov     r4, r0
-       tst     #2, r0          ! Check alignment.
-       bt      2f              ! Jump if alignment is ok.
+       tst     #3, r0          ! Check alignment.
+       bt/s    2f              ! Jump if alignment is ok.
+        mov    r4, r7          ! Keep a copy to check for alignment
        !
+       tst     #1, r0          ! Check alignment.
+       bt      21f             ! Jump if alignment is boundary of 2bytes.
+
+       ! buf is odd
+       tst     r5, r5
+       add     #-1, r5
+       bt      9f
+       mov.b   @r4+, r0
+       extu.b  r0, r0
+       addc    r0, r6          ! t=0 from previous tst
+       mov     r6, r0
+       shll8   r6
+       shlr16  r0
+       shlr8   r0
+       or      r0, r6
+       mov     r4, r0
+       tst     #2, r0
+       bt      2f
+21:
+       ! buf is 2 byte aligned (len could be 0)
        add     #-2, r5         ! Alignment uses up two bytes.
        cmp/pz  r5              !
        bt/s    1f              ! Jump if we had at least two bytes.
@@ -61,16 +80,17 @@ ENTRY(csum_partial)
        bra     6f
         add    #2, r5          ! r5 was < 2.  Deal with it.
 1:
-       mov     r5, r1          ! Save new len for later use.
        mov.w   @r4+, r0
        extu.w  r0, r0
        addc    r0, r6
        bf      2f
        add     #1, r6
 2:
+       ! buf is 4 byte aligned (len could be 0)
+       mov     r5, r1
        mov     #-5, r0
-       shld    r0, r5
-       tst     r5, r5
+       shld    r0, r1
+       tst     r1, r1
        bt/s    4f              ! if it's =0, go to 4f
         clrt
        .align  2
@@ -92,30 +112,31 @@ ENTRY(csum_partial)
        addc    r0, r6
        addc    r2, r6
        movt    r0
-       dt      r5
+       dt      r1
        bf/s    3b
         cmp/eq #1, r0
-       ! here, we know r5==0
-       addc    r5, r6                  ! add carry to r6
+       ! here, we know r1==0
+       addc    r1, r6                  ! add carry to r6
 4:
-       mov     r1, r0
+       mov     r5, r0
        and     #0x1c, r0
        tst     r0, r0
-       bt/s    6f
-        mov    r0, r5
-       shlr2   r5
+       bt      6f
+       ! 4 bytes or more remaining
+       mov     r0, r1
+       shlr2   r1
        mov     #0, r2
 5:
        addc    r2, r6
        mov.l   @r4+, r2
        movt    r0
-       dt      r5
+       dt      r1
        bf/s    5b
         cmp/eq #1, r0
        addc    r2, r6
-       addc    r5, r6          ! r5==0 here, so it means add carry-bit
+       addc    r1, r6          ! r1==0 here, so it means add carry-bit
 6:
-       mov     r1, r5
+       ! 3 bytes or less remaining
        mov     #3, r0
        and     r0, r5
        tst     r5, r5
@@ -139,8 +160,18 @@ ENTRY(csum_partial)
 8:
        addc    r0, r6
        mov     #0, r0
-       addc    r0, r6 
+       addc    r0, r6
 9:
+       ! Check if the buffer was misaligned, if so realign sum
+       mov     r7, r0
+       tst     #1, r0
+       bt      10f
+       mov     r6, r0
+       shll8   r6
+       shlr16  r0
+       shlr8   r0
+       or      r0, r6
+10:
        rts
         mov    r6, r0
 
index 7da7c13d23c4f10af35b4aa159976f9dfa277808..a11b89ee9ef8f0a9e0758811dd633101adb4b12f 100644 (file)
@@ -17,7 +17,7 @@
 typedef struct {
        /* Dcache line 1 */
        unsigned int    __softirq_pending; /* must be 1st, see rtrap.S */
-       unsigned int    __pad0;
+       unsigned int    __nmi_count;
        unsigned long   clock_tick;     /* %tick's per second */
        unsigned long   __pad;
        unsigned int    __pad1;
index d47d4a1955a974169b8a9bf432915c5d4263807c..1934f2cbf5132a7e7ba5e71e97dc1d1ada6f5589 100644 (file)
@@ -66,9 +66,6 @@ extern void virt_irq_free(unsigned int virt_irq);
 extern void __init init_IRQ(void);
 extern void fixup_irqs(void);
 
-extern int register_perfctr_intr(void (*handler)(struct pt_regs *));
-extern void release_perfctr_intr(void (*handler)(struct pt_regs *));
-
 static inline void set_softint(unsigned long bits)
 {
        __asm__ __volatile__("wr        %0, 0x0, %%set_softint"
@@ -98,5 +95,6 @@ void __trigger_all_cpu_backtrace(void);
 extern void *hardirq_stack[NR_CPUS];
 extern void *softirq_stack[NR_CPUS];
 #define __ARCH_HAS_DO_SOFTIRQ
+#define ARCH_HAS_NMI_WATCHDOG
 
 #endif
index f905b773235a2f977db3383559629d4fbd3e4fda..feb3578e12c4f5ce6a0e0a3d340fe913a7c36501 100644 (file)
@@ -14,6 +14,8 @@ enum die_val {
        DIE_TRAP,
        DIE_TRAP_TL1,
        DIE_CALL,
+       DIE_NMI,
+       DIE_NMIWATCHDOG,
 };
 
 #endif
diff --git a/arch/sparc/include/asm/nmi.h b/arch/sparc/include/asm/nmi.h
new file mode 100644 (file)
index 0000000..fbd546d
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef __NMI_H
+#define __NMI_H
+
+extern int __init nmi_init(void);
+extern void perfctr_irq(int irq, struct pt_regs *regs);
+extern void nmi_adjust_hz(unsigned int new_hz);
+
+extern int nmi_usable;
+
+#endif /* __NMI_H */
diff --git a/arch/sparc/include/asm/pcr.h b/arch/sparc/include/asm/pcr.h
new file mode 100644 (file)
index 0000000..a2f5c61
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef __PCR_H
+#define __PCR_H
+
+struct pcr_ops {
+       u64 (*read)(void);
+       void (*write)(u64);
+};
+extern const struct pcr_ops *pcr_ops;
+
+extern void deferred_pcr_work_irq(int irq, struct pt_regs *regs);
+extern void schedule_deferred_pcr_work(void);
+
+#define PCR_PIC_PRIV           0x00000001 /* PIC access is privileged */
+#define PCR_STRACE             0x00000002 /* Trace supervisor events  */
+#define PCR_UTRACE             0x00000004 /* Trace user events        */
+#define PCR_N2_HTRACE          0x00000008 /* Trace hypervisor events  */
+#define PCR_N2_TOE_OV0         0x00000010 /* Trap if PIC 0 overflows  */
+#define PCR_N2_TOE_OV1         0x00000020 /* Trap if PIC 1 overflows  */
+#define PCR_N2_MASK0           0x00003fc0
+#define PCR_N2_MASK0_SHIFT     6
+#define PCR_N2_SL0             0x0003c000
+#define PCR_N2_SL0_SHIFT       14
+#define PCR_N2_OV0             0x00040000
+#define PCR_N2_MASK1           0x07f80000
+#define PCR_N2_MASK1_SHIFT     19
+#define PCR_N2_SL1             0x78000000
+#define PCR_N2_SL1_SHIFT       27
+#define PCR_N2_OV1             0x80000000
+
+extern unsigned int picl_shift;
+
+/* In order to commonize as much of the implementation as
+ * possible, we use PICH as our counter.  Mostly this is
+ * to accomodate Niagara-1 which can only count insn cycles
+ * in PICH.
+ */
+static inline u64 picl_value(unsigned int nmi_hz)
+{
+       u32 delta = local_cpu_data().clock_tick / (nmi_hz << picl_shift);
+
+       return ((u64)((0 - delta) & 0xffffffff)) << 32;
+}
+
+extern u64 pcr_enable;
+
+#endif /* __PCR_H */
index d573820c0ff4fc9bc766687174acdde78d664700..32a7efe76d00ab1367e143be8d93777c47d1d214 100644 (file)
@@ -23,6 +23,7 @@
 #define PIL_SMP_CTX_NEW_VERSION        4
 #define PIL_DEVICE_IRQ         5
 #define PIL_SMP_CALL_FUNC_SNGL 6
+#define PIL_DEFERRED_PCR_WORK  7
 #define PIL_NORMAL_MAX         14
 #define PIL_NMI                        15
 
index bf50d0c2d583a5083b399adeb9371ab9bb0da704..982a12f959f476ea9c55c37bb27ce790f2b250ca 100644 (file)
@@ -50,6 +50,9 @@
 
 #define SO_MARK                        0x0022
 
+#define SO_TIMESTAMPING                0x0023
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 /* Security levels - as per NRL IPv6 - don't actually do anything */
 #define SO_SECURITY_AUTHENTICATION             0x5001
 #define SO_SECURITY_ENCRYPTION_TRANSPORT       0x5002
index 53adcaa0348ba8f50d60c1a7baa1951a858882da..54742e58831c4d78e19bad176145e8ce0bae7d6b 100644 (file)
@@ -52,6 +52,8 @@ obj-$(CONFIG_SPARC64)   += visemul.o
 obj-$(CONFIG_SPARC64)   += hvapi.o
 obj-$(CONFIG_SPARC64)   += sstate.o
 obj-$(CONFIG_SPARC64)   += mdesc.o
+obj-$(CONFIG_SPARC64)  += pcr.o
+obj-$(CONFIG_SPARC64)  += nmi.o
 
 # sparc32 do not use GENERIC_HARDIRQS but uses the generic devres implementation
 obj-$(CONFIG_SPARC32)     += devres.o
index 32d32b4824f5c6aee4d4eecb15f1a864939fbc83..d85c3dc4953a931acde5fad87db15976a92e0904 100644 (file)
@@ -26,6 +26,7 @@ EXPORT_PER_CPU_SYMBOL(__cpu_data);
 struct cpu_info {
        int psr_vers;
        const char *name;
+       const char *pmu_name;
 };
 
 struct fpu_info {
@@ -45,6 +46,9 @@ struct manufacturer_info {
 #define CPU(ver, _name) \
 { .psr_vers = ver, .name = _name }
 
+#define CPU_PMU(ver, _name, _pmu_name) \
+{ .psr_vers = ver, .name = _name, .pmu_name = _pmu_name }
+
 #define FPU(ver, _name) \
 { .fp_vers = ver, .name = _name }
 
@@ -183,10 +187,10 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
 },{
        0x17,
        .cpu_info = {
-               CPU(0x10, "TI UltraSparc I   (SpitFire)"),
-               CPU(0x11, "TI UltraSparc II  (BlackBird)"),
-               CPU(0x12, "TI UltraSparc IIi (Sabre)"),
-               CPU(0x13, "TI UltraSparc IIe (Hummingbird)"),
+               CPU_PMU(0x10, "TI UltraSparc I   (SpitFire)", "ultra12"),
+               CPU_PMU(0x11, "TI UltraSparc II  (BlackBird)", "ultra12"),
+               CPU_PMU(0x12, "TI UltraSparc IIi (Sabre)", "ultra12"),
+               CPU_PMU(0x13, "TI UltraSparc IIe (Hummingbird)", "ultra12"),
                CPU(-1, NULL)
        },
        .fpu_info = {
@@ -199,7 +203,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
 },{
        0x22,
        .cpu_info = {
-               CPU(0x10, "TI UltraSparc I   (SpitFire)"),
+               CPU_PMU(0x10, "TI UltraSparc I   (SpitFire)", "ultra12"),
                CPU(-1, NULL)
        },
        .fpu_info = {
@@ -209,12 +213,12 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
 },{
        0x3e,
        .cpu_info = {
-               CPU(0x14, "TI UltraSparc III (Cheetah)"),
-               CPU(0x15, "TI UltraSparc III+ (Cheetah+)"),
-               CPU(0x16, "TI UltraSparc IIIi (Jalapeno)"),
-               CPU(0x18, "TI UltraSparc IV (Jaguar)"),
-               CPU(0x19, "TI UltraSparc IV+ (Panther)"),
-               CPU(0x22, "TI UltraSparc IIIi+ (Serrano)"),
+               CPU_PMU(0x14, "TI UltraSparc III (Cheetah)", "ultra3"),
+               CPU_PMU(0x15, "TI UltraSparc III+ (Cheetah+)", "ultra3+"),
+               CPU_PMU(0x16, "TI UltraSparc IIIi (Jalapeno)", "ultra3i"),
+               CPU_PMU(0x18, "TI UltraSparc IV (Jaguar)", "ultra3+"),
+               CPU_PMU(0x19, "TI UltraSparc IV+ (Panther)", "ultra4+"),
+               CPU_PMU(0x22, "TI UltraSparc IIIi+ (Serrano)", "ultra3i"),
                CPU(-1, NULL)
        },
        .fpu_info = {
@@ -234,6 +238,7 @@ static const struct manufacturer_info __initconst manufacturer_info[] = {
 
 const char *sparc_cpu_type;
 const char *sparc_fpu_type;
+const char *sparc_pmu_type;
 
 unsigned int fsr_storage;
 
@@ -244,6 +249,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
 
        sparc_cpu_type = NULL;
        sparc_fpu_type = NULL;
+       sparc_pmu_type = NULL;
        manuf = NULL;
 
        for (i = 0; i < ARRAY_SIZE(manufacturer_info); i++)
@@ -263,6 +269,7 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
                {
                        if (cpu->psr_vers == psr_vers) {
                                sparc_cpu_type = cpu->name;
+                               sparc_pmu_type = cpu->pmu_name;
                                sparc_fpu_type = "No FPU";
                                break;
                        }
@@ -290,6 +297,8 @@ static void set_cpu_and_fpu(int psr_impl, int psr_vers, int fpu_vers)
                       psr_impl, fpu_vers);
                sparc_fpu_type = "Unknown FPU";
        }
+       if (sparc_pmu_type == NULL)
+               sparc_pmu_type = "Unknown PMU";
 }
 
 #ifdef CONFIG_SPARC32
@@ -315,11 +324,13 @@ static void __init sun4v_cpu_probe(void)
        case SUN4V_CHIP_NIAGARA1:
                sparc_cpu_type = "UltraSparc T1 (Niagara)";
                sparc_fpu_type = "UltraSparc T1 integrated FPU";
+               sparc_pmu_type = "niagara";
                break;
 
        case SUN4V_CHIP_NIAGARA2:
                sparc_cpu_type = "UltraSparc T2 (Niagara2)";
                sparc_fpu_type = "UltraSparc T2 integrated FPU";
+               sparc_pmu_type = "niagara2";
                break;
 
        default:
index 8ffee714f932a026fdeea5d2c2973dbcd724bdb0..a46c3a21e26ded67dc59b816e9c8b8f5f7eade1f 100644 (file)
@@ -891,10 +891,35 @@ prom_tba: .xword  0
 tlb_type:      .word   0       /* Must NOT end up in BSS */
        .section        ".fixup",#alloc,#execinstr
 
-       .globl  __ret_efault, __retl_efault
-__ret_efault:
+       .globl  __ret_efault, __retl_efault, __ret_one, __retl_one
+ENTRY(__ret_efault)
        ret
         restore %g0, -EFAULT, %o0
-__retl_efault:
+ENDPROC(__ret_efault)
+
+ENTRY(__retl_efault)
        retl
         mov    -EFAULT, %o0
+ENDPROC(__retl_efault)
+
+ENTRY(__retl_one)
+       retl
+        mov    1, %o0
+ENDPROC(__retl_one)
+
+ENTRY(__ret_one_asi)
+       wr      %g0, ASI_AIUS, %asi
+       ret
+        restore %g0, 1, %o0
+ENDPROC(__ret_one_asi)
+
+ENTRY(__retl_one_asi)
+       wr      %g0, ASI_AIUS, %asi
+       retl
+        mov    1, %o0
+ENDPROC(__retl_one_asi)
+
+ENTRY(__retl_o1)
+       retl
+        mov    %o1, %o0
+ENDPROC(__retl_o1)
index cab8e02868716d691a38b9bad239ec754dd39134..e289376198eb2be4e722b5cbf1a31d440c580631 100644 (file)
@@ -196,6 +196,11 @@ int show_interrupts(struct seq_file *p, void *v)
                seq_putc(p, '\n');
 skip:
                spin_unlock_irqrestore(&irq_desc[i].lock, flags);
+       } else if (i == NR_IRQS) {
+               seq_printf(p, "NMI: ");
+               for_each_online_cpu(j)
+                       seq_printf(p, "%10u ", cpu_data(j).__nmi_count);
+               seq_printf(p, "     Non-maskable interrupts\n");
        }
        return 0;
 }
@@ -778,69 +783,6 @@ void do_softirq(void)
        local_irq_restore(flags);
 }
 
-static void unhandled_perf_irq(struct pt_regs *regs)
-{
-       unsigned long pcr, pic;
-
-       read_pcr(pcr);
-       read_pic(pic);
-
-       write_pcr(0);
-
-       printk(KERN_EMERG "CPU %d: Got unexpected perf counter IRQ.\n",
-              smp_processor_id());
-       printk(KERN_EMERG "CPU %d: PCR[%016lx] PIC[%016lx]\n",
-              smp_processor_id(), pcr, pic);
-}
-
-/* Almost a direct copy of the powerpc PMC code.  */
-static DEFINE_SPINLOCK(perf_irq_lock);
-static void *perf_irq_owner_caller; /* mostly for debugging */
-static void (*perf_irq)(struct pt_regs *regs) = unhandled_perf_irq;
-
-/* Invoked from level 15 PIL handler in trap table.  */
-void perfctr_irq(int irq, struct pt_regs *regs)
-{
-       clear_softint(1 << irq);
-       perf_irq(regs);
-}
-
-int register_perfctr_intr(void (*handler)(struct pt_regs *))
-{
-       int ret;
-
-       if (!handler)
-               return -EINVAL;
-
-       spin_lock(&perf_irq_lock);
-       if (perf_irq != unhandled_perf_irq) {
-               printk(KERN_WARNING "register_perfctr_intr: "
-                      "perf IRQ busy (reserved by caller %p)\n",
-                      perf_irq_owner_caller);
-               ret = -EBUSY;
-               goto out;
-       }
-
-       perf_irq_owner_caller = __builtin_return_address(0);
-       perf_irq = handler;
-
-       ret = 0;
-out:
-       spin_unlock(&perf_irq_lock);
-
-       return ret;
-}
-EXPORT_SYMBOL_GPL(register_perfctr_intr);
-
-void release_perfctr_intr(void (*handler)(struct pt_regs *))
-{
-       spin_lock(&perf_irq_lock);
-       perf_irq_owner_caller = NULL;
-       perf_irq = unhandled_perf_irq;
-       spin_unlock(&perf_irq_lock);
-}
-EXPORT_SYMBOL_GPL(release_perfctr_intr);
-
 #ifdef CONFIG_HOTPLUG_CPU
 void fixup_irqs(void)
 {
index 81a972e8d8ea17e78fc18a529f4fc7d8640b10ca..15d8a3f645c9e7ba599753f4f94ce84875af7429 100644 (file)
@@ -5,6 +5,7 @@
 
 /* cpu.c */
 extern const char *sparc_cpu_type;
+extern const char *sparc_pmu_type;
 extern const char *sparc_fpu_type;
 
 extern unsigned int fsr_storage;
diff --git a/arch/sparc/kernel/nmi.c b/arch/sparc/kernel/nmi.c
new file mode 100644 (file)
index 0000000..f357722
--- /dev/null
@@ -0,0 +1,225 @@
+/* Pseudo NMI support on sparc64 systems.
+ *
+ * Copyright (C) 2009 David S. Miller <davem@davemloft.net>
+ *
+ * The NMI watchdog support and infrastructure is based almost
+ * entirely upon the x86 NMI support code.
+ */
+#include <linux/kernel.h>
+#include <linux/param.h>
+#include <linux/init.h>
+#include <linux/percpu.h>
+#include <linux/nmi.h>
+#include <linux/module.h>
+#include <linux/kprobes.h>
+#include <linux/kernel_stat.h>
+#include <linux/slab.h>
+#include <linux/kdebug.h>
+#include <linux/delay.h>
+#include <linux/smp.h>
+
+#include <asm/ptrace.h>
+#include <asm/local.h>
+#include <asm/pcr.h>
+
+/* We don't have a real NMI on sparc64, but we can fake one
+ * up using profiling counter overflow interrupts and interrupt
+ * levels.
+ *
+ * The profile overflow interrupts at level 15, so we use
+ * level 14 as our IRQ off level.
+ */
+
+static int nmi_watchdog_active;
+static int panic_on_timeout;
+
+int nmi_usable;
+EXPORT_SYMBOL_GPL(nmi_usable);
+
+static unsigned int nmi_hz = HZ;
+
+static DEFINE_PER_CPU(unsigned int, last_irq_sum);
+static DEFINE_PER_CPU(local_t, alert_counter);
+static DEFINE_PER_CPU(int, nmi_touch);
+
+void touch_nmi_watchdog(void)
+{
+       if (nmi_watchdog_active) {
+               int cpu;
+
+               for_each_present_cpu(cpu) {
+                       if (per_cpu(nmi_touch, cpu) != 1)
+                               per_cpu(nmi_touch, cpu) = 1;
+               }
+       }
+
+       touch_softlockup_watchdog();
+}
+EXPORT_SYMBOL(touch_nmi_watchdog);
+
+static void die_nmi(const char *str, struct pt_regs *regs, int do_panic)
+{
+       if (notify_die(DIE_NMIWATCHDOG, str, regs, 0,
+                      pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
+               return;
+
+       console_verbose();
+       bust_spinlocks(1);
+
+       printk(KERN_EMERG "%s", str);
+       printk(" on CPU%d, ip %08lx, registers:\n",
+              smp_processor_id(), regs->tpc);
+       show_regs(regs);
+       dump_stack();
+
+       bust_spinlocks(0);
+
+       if (do_panic || panic_on_oops)
+               panic("Non maskable interrupt");
+
+       local_irq_enable();
+       do_exit(SIGBUS);
+}
+
+notrace __kprobes void perfctr_irq(int irq, struct pt_regs *regs)
+{
+       unsigned int sum, touched = 0;
+       int cpu = smp_processor_id();
+
+       clear_softint(1 << irq);
+       pcr_ops->write(PCR_PIC_PRIV);
+
+       local_cpu_data().__nmi_count++;
+
+       if (notify_die(DIE_NMI, "nmi", regs, 0,
+                      pt_regs_trap_type(regs), SIGINT) == NOTIFY_STOP)
+               touched = 1;
+
+       sum = kstat_irqs_cpu(0, cpu);
+       if (__get_cpu_var(nmi_touch)) {
+               __get_cpu_var(nmi_touch) = 0;
+               touched = 1;
+       }
+       if (!touched && __get_cpu_var(last_irq_sum) == sum) {
+               local_inc(&__get_cpu_var(alert_counter));
+               if (local_read(&__get_cpu_var(alert_counter)) == 5 * nmi_hz)
+                       die_nmi("BUG: NMI Watchdog detected LOCKUP",
+                               regs, panic_on_timeout);
+       } else {
+               __get_cpu_var(last_irq_sum) = sum;
+               local_set(&__get_cpu_var(alert_counter), 0);
+       }
+       if (nmi_usable) {
+               write_pic(picl_value(nmi_hz));
+               pcr_ops->write(pcr_enable);
+       }
+}
+
+static inline unsigned int get_nmi_count(int cpu)
+{
+       return cpu_data(cpu).__nmi_count;
+}
+
+static int endflag __initdata;
+
+static __init void nmi_cpu_busy(void *data)
+{
+       local_irq_enable_in_hardirq();
+       while (endflag == 0)
+               mb();
+}
+
+static void report_broken_nmi(int cpu, int *prev_nmi_count)
+{
+       printk(KERN_CONT "\n");
+
+       printk(KERN_WARNING
+               "WARNING: CPU#%d: NMI appears to be stuck (%d->%d)!\n",
+                       cpu, prev_nmi_count[cpu], get_nmi_count(cpu));
+
+       printk(KERN_WARNING
+               "Please report this to bugzilla.kernel.org,\n");
+       printk(KERN_WARNING
+               "and attach the output of the 'dmesg' command.\n");
+
+       nmi_usable = 0;
+}
+
+static void stop_watchdog(void *unused)
+{
+       pcr_ops->write(PCR_PIC_PRIV);
+}
+
+static int __init check_nmi_watchdog(void)
+{
+       unsigned int *prev_nmi_count;
+       int cpu, err;
+
+       prev_nmi_count = kmalloc(nr_cpu_ids * sizeof(unsigned int), GFP_KERNEL);
+       if (!prev_nmi_count) {
+               err = -ENOMEM;
+               goto error;
+       }
+
+       printk(KERN_INFO "Testing NMI watchdog ... ");
+
+       smp_call_function(nmi_cpu_busy, (void *)&endflag, 0);
+
+       for_each_possible_cpu(cpu)
+               prev_nmi_count[cpu] = get_nmi_count(cpu);
+       local_irq_enable();
+       mdelay((20 * 1000) / nmi_hz); /* wait 20 ticks */
+
+       for_each_online_cpu(cpu) {
+               if (get_nmi_count(cpu) - prev_nmi_count[cpu] <= 5)
+                       report_broken_nmi(cpu, prev_nmi_count);
+       }
+       endflag = 1;
+       if (!nmi_usable) {
+               kfree(prev_nmi_count);
+               err = -ENODEV;
+               goto error;
+       }
+       printk("OK.\n");
+
+       nmi_hz = 1;
+
+       kfree(prev_nmi_count);
+       return 0;
+error:
+       on_each_cpu(stop_watchdog, NULL, 1);
+       return err;
+}
+
+static void start_watchdog(void *unused)
+{
+       pcr_ops->write(PCR_PIC_PRIV);
+       write_pic(picl_value(nmi_hz));
+
+       pcr_ops->write(pcr_enable);
+}
+
+void nmi_adjust_hz(unsigned int new_hz)
+{
+       nmi_hz = new_hz;
+       on_each_cpu(start_watchdog, NULL, 1);
+}
+EXPORT_SYMBOL_GPL(nmi_adjust_hz);
+
+int __init nmi_init(void)
+{
+       nmi_usable = 1;
+
+       on_each_cpu(start_watchdog, NULL, 1);
+
+       return check_nmi_watchdog();
+}
+
+static int __init setup_nmi_watchdog(char *str)
+{
+       if (!strncmp(str, "panic", 5))
+               panic_on_timeout = 1;
+
+       return 0;
+}
+__setup("nmi_watchdog=", setup_nmi_watchdog);
diff --git a/arch/sparc/kernel/pcr.c b/arch/sparc/kernel/pcr.c
new file mode 100644 (file)
index 0000000..1ae8cdd
--- /dev/null
@@ -0,0 +1,158 @@
+/* pcr.c: Generic sparc64 performance counter infrastructure.
+ *
+ * Copyright (C) 2009 David S. Miller (davem@davemloft.net)
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+
+#include <asm/pil.h>
+#include <asm/pcr.h>
+#include <asm/nmi.h>
+
+/* This code is shared between various users of the performance
+ * counters.  Users will be oprofile, pseudo-NMI watchdog, and the
+ * perf_counter support layer.
+ */
+
+#define PCR_SUN4U_ENABLE       (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
+#define PCR_N2_ENABLE          (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \
+                                PCR_N2_TOE_OV1 | \
+                                (2 << PCR_N2_SL1_SHIFT) | \
+                                (0xff << PCR_N2_MASK1_SHIFT))
+
+u64 pcr_enable;
+unsigned int picl_shift;
+
+/* Performance counter interrupts run unmasked at PIL level 15.
+ * Therefore we can't do things like wakeups and other work
+ * that expects IRQ disabling to be adhered to in locking etc.
+ *
+ * Therefore in such situations we defer the work by signalling
+ * a lower level cpu IRQ.
+ */
+void deferred_pcr_work_irq(int irq, struct pt_regs *regs)
+{
+       clear_softint(1 << PIL_DEFERRED_PCR_WORK);
+}
+
+void schedule_deferred_pcr_work(void)
+{
+       set_softint(1 << PIL_DEFERRED_PCR_WORK);
+}
+
+const struct pcr_ops *pcr_ops;
+EXPORT_SYMBOL_GPL(pcr_ops);
+
+static u64 direct_pcr_read(void)
+{
+       u64 val;
+
+       read_pcr(val);
+       return val;
+}
+
+static void direct_pcr_write(u64 val)
+{
+       write_pcr(val);
+}
+
+static const struct pcr_ops direct_pcr_ops = {
+       .read   = direct_pcr_read,
+       .write  = direct_pcr_write,
+};
+
+static void n2_pcr_write(u64 val)
+{
+       unsigned long ret;
+
+       ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
+       if (val != HV_EOK)
+               write_pcr(val);
+}
+
+static const struct pcr_ops n2_pcr_ops = {
+       .read   = direct_pcr_read,
+       .write  = n2_pcr_write,
+};
+
+static unsigned long perf_hsvc_group;
+static unsigned long perf_hsvc_major;
+static unsigned long perf_hsvc_minor;
+
+static int __init register_perf_hsvc(void)
+{
+       if (tlb_type == hypervisor) {
+               switch (sun4v_chip_type) {
+               case SUN4V_CHIP_NIAGARA1:
+                       perf_hsvc_group = HV_GRP_NIAG_PERF;
+                       break;
+
+               case SUN4V_CHIP_NIAGARA2:
+                       perf_hsvc_group = HV_GRP_N2_CPU;
+                       break;
+
+               default:
+                       return -ENODEV;
+               }
+
+
+               perf_hsvc_major = 1;
+               perf_hsvc_minor = 0;
+               if (sun4v_hvapi_register(perf_hsvc_group,
+                                        perf_hsvc_major,
+                                        &perf_hsvc_minor)) {
+                       printk("perfmon: Could not register hvapi.\n");
+                       return -ENODEV;
+               }
+       }
+       return 0;
+}
+
+static void __init unregister_perf_hsvc(void)
+{
+       if (tlb_type != hypervisor)
+               return;
+       sun4v_hvapi_unregister(perf_hsvc_group);
+}
+
+int __init pcr_arch_init(void)
+{
+       int err = register_perf_hsvc();
+
+       if (err)
+               return err;
+
+       switch (tlb_type) {
+       case hypervisor:
+               pcr_ops = &n2_pcr_ops;
+               pcr_enable = PCR_N2_ENABLE;
+               picl_shift = 2;
+               break;
+
+       case cheetah:
+       case cheetah_plus:
+               pcr_ops = &direct_pcr_ops;
+               pcr_enable = PCR_SUN4U_ENABLE;
+               break;
+
+       case spitfire:
+               /* UltraSPARC-I/II and derivatives lack a profile
+                * counter overflow interrupt so we can't make use of
+                * their hardware currently.
+                */
+               /* fallthrough */
+       default:
+               err = -ENODEV;
+               goto out_unregister;
+       }
+
+       return nmi_init();
+
+out_unregister:
+       unregister_perf_hsvc();
+       return err;
+}
+
+arch_initcall(pcr_arch_init);
index cc8b5604442cc0968c6ff96311e9c998e45df86f..a73954b87f0a511ad7431b4b33f82216f22e2b7c 100644 (file)
@@ -29,6 +29,7 @@
 #include <linux/cpu.h>
 #include <linux/elfcore.h>
 #include <linux/sysrq.h>
+#include <linux/nmi.h>
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
 static void sparc64_yield(int cpu)
 {
-       if (tlb_type != hypervisor)
+       if (tlb_type != hypervisor) {
+               touch_nmi_watchdog();
                return;
+       }
 
        clear_thread_flag(TIF_POLLING_NRFLAG);
        smp_mb__after_clear_bit();
index 49d061f4ae9d43319ed5098d6a8bd3ad309e1636..f2bcfd2967d76e463d183873ce309b4c71e5ca42 100644 (file)
@@ -354,6 +354,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
        seq_printf(m, 
                   "cpu\t\t: %s\n"
                   "fpu\t\t: %s\n"
+                  "pmu\t\t: %s\n"
                   "prom\t\t: %s\n"
                   "type\t\t: %s\n"
                   "ncpus probed\t: %d\n"
@@ -366,6 +367,7 @@ static int show_cpuinfo(struct seq_file *m, void *__unused)
                   ,
                   sparc_cpu_type,
                   sparc_fpu_type,
+                  sparc_pmu_type,
                   prom_version,
                   ((tlb_type == hypervisor) ?
                    "sun4v" :
index ea925503b42e59fa051d591ebf752eb708243c7d..d9bdfb9d5c187468e056afff9e66e8976f20e31d 100644 (file)
@@ -63,7 +63,8 @@ tl0_irq6:     TRAP_IRQ(smp_call_function_single_client, 6)
 #else
 tl0_irq6:      BTRAP(0x46)
 #endif
-tl0_irq7:      BTRAP(0x47) BTRAP(0x48) BTRAP(0x49)
+tl0_irq7:      TRAP_IRQ(deferred_pcr_work_irq, 7)
+tl0_irq8:      BTRAP(0x48) BTRAP(0x49)
 tl0_irq10:     BTRAP(0x4a) BTRAP(0x4b) BTRAP(0x4c) BTRAP(0x4d)
 tl0_irq14:     TRAP_IRQ(timer_interrupt, 14)
 tl0_irq15:     TRAP_NMI_IRQ(perfctr_irq, 15)
index 6a4f956a2f7a4a99d7388d0dafed55e65b506c30..8e7a843ddd88366411de59480377798033d4c0a9 100644 (file)
@@ -6,13 +6,9 @@
 
 #define EX_ST(x,y)             \
 98:    x,y;                    \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    %o1, %o0;       \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_o1;   \
        .text;                  \
        .align 4;
 
index 2b9df99e87f9f9190780a47ec534d5173e9d032e..b7d0bd6b14063bc1e62cfed3c0e32f0b43799396 100644 (file)
@@ -5,13 +5,9 @@
 
 #define EX_LD(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    1, %o0;         \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one;  \
        .text;                  \
        .align 4;
 
@@ -27,7 +23,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop
 #endif
 
index bb3f7084daf9fb0282f88ad390f6b73551854bc5..780550e1afc74fd6efe38ef16f73a07ea021a8f2 100644 (file)
@@ -5,13 +5,9 @@
 
 #define EX_ST(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    1, %o0;         \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one;  \
        .text;                  \
        .align 4;
 
@@ -31,7 +27,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop
 #endif
 
index c77ef5f22102bc25e5db7c869bc6e4c84695d0f3..119ccb9a54f49e2ac2724650060eb7a1d70e8d9e 100644 (file)
@@ -5,14 +5,9 @@
 
 #define EX_LD(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    wr      %g0, ASI_AIUS, %asi;\
-       retl;                   \
-        mov    1, %o0;         \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one_asi;\
        .text;                  \
        .align 4;
 
@@ -33,7 +28,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop
 #endif
 
index 4bd4093acbbd561f03199f5d95f86e7dd417edb8..7fe1ccefd9d056a104407c8d1595095c7fc5add8 100644 (file)
@@ -5,14 +5,9 @@
 
 #define EX_ST(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    wr      %g0, ASI_AIUS, %asi;\
-       retl;                   \
-        mov    1, %o0;         \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one_asi;\
        .text;                  \
        .align 4;
 
@@ -42,7 +37,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop
 #endif
 
index 814d5f7a45e1c3e9fe132f094d48a5ce7f050e08..beab29bf419b606ae23a7c1e8151e2527bc0943c 100644 (file)
@@ -6,13 +6,9 @@
 
 #define EX_ST(x,y)             \
 98:    x,y;                    \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    %o1, %o0;       \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_o1;   \
        .text;                  \
        .align 4;
 
index e7f433f71b42bd473b06e22e7b70e0e40e111c9b..5d1e4d1ac21edf09a664663dc005e1fcae805b6a 100644 (file)
@@ -5,14 +5,9 @@
 
 #define EX_LD(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    wr      %g0, ASI_AIUS, %asi;\
-       ret;                    \
-        restore %g0, 1, %o0;   \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __ret_one_asi;\
        .text;                  \
        .align 4;
 
@@ -30,7 +25,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop
 #endif
 
index 6ea01c5532a0a87e30f4a737dee0a44b55da3df1..ff630dcb273c9649de6fc9e145fce42e72667787 100644 (file)
@@ -5,14 +5,9 @@
 
 #define EX_ST(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    wr      %g0, ASI_AIUS, %asi;\
-       ret;                    \
-        restore %g0, 1, %o0;   \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __ret_one_asi;\
        .text;                  \
        .align 4;
 
@@ -33,7 +28,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop
 #endif
 
index 3192b0bf4fab93466ace297240a6b17e50d1e98a..a6ae2ea04bf5dfbffda2884a6a46b051ae2ac2a8 100644 (file)
@@ -5,13 +5,9 @@
 
 #define EX_LD(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    1, %o0;         \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one;  \
        .text;                  \
        .align 4;
 
@@ -27,7 +23,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop;                                           \
 
 #include "U1memcpy.S"
index d1210ffb0b82aa444b71079bb617c83025473d6c..f4b970eeb485f838ce23dc5507a5bccd6defd348 100644 (file)
@@ -5,13 +5,9 @@
 
 #define EX_ST(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    1, %o0;         \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one;  \
        .text;                  \
        .align 4;
 
@@ -27,7 +23,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop;                                           \
 
 #include "U1memcpy.S"
index f5bfc8d9d216686b031d685aa8f577fab4634324..b1acd1331c338fce1a70e6a13f597509b28501a7 100644 (file)
@@ -5,13 +5,9 @@
 
 #define EX_LD(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    1, %o0;         \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one;  \
        .text;                  \
        .align 4;
 
index 2334f111bb0c81c36f4b1016725a238650e28d97..ef1e493afdfa900a1b32863c2bf2995560cbe0cd 100644 (file)
@@ -5,13 +5,9 @@
 
 #define EX_ST(x)               \
 98:    x;                      \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    1, %o0;         \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one;  \
        .text;                  \
        .align 4;
 
@@ -27,7 +23,7 @@
 #define PREAMBLE                                       \
        rd              %asi, %g1;                      \
        cmp             %g1, ASI_AIUS;                  \
-       bne,pn          %icc, memcpy_user_stub;         \
+       bne,pn          %icc, ___copy_in_user;          \
         nop;                                           \
 
 #include "U3memcpy.S"
index c7bbae8c590f479f32d6a38db364840f295785d7..b6557297440f0dbb65a06a8153623be6ad8dc193 100644 (file)
@@ -88,13 +88,9 @@ __bzero_done:
 
 #define EX_ST(x,y)             \
 98:    x,y;                    \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov    %o1, %o0;       \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_o1;   \
        .text;                  \
        .align 4;
 
index 650af3f21f7860b6c5ad30234f48a04f595e797d..302c0e60dc2ceb48a3212840ac7891f337419d14 100644 (file)
@@ -3,19 +3,16 @@
  * Copyright (C) 1999, 2000, 2004 David S. Miller (davem@redhat.com)
  */
 
+#include <linux/linkage.h>
 #include <asm/asi.h>
 
 #define XCC xcc
 
 #define EX(x,y)                        \
 98:    x,y;                    \
-       .section .fixup;        \
-       .align 4;               \
-99:    retl;                   \
-        mov 1, %o0;            \
        .section __ex_table,"a";\
        .align 4;               \
-       .word 98b, 99b;         \
+       .word 98b, __retl_one;  \
        .text;                  \
        .align 4;
 
         * to copy register windows around during thread cloning.
         */
 
-       .globl          ___copy_in_user
-       .type           ___copy_in_user,#function
-___copy_in_user:       /* %o0=dst, %o1=src, %o2=len */
-       /* Writing to %asi is _expensive_ so we hardcode it.
-        * Reading %asi to check for KERNEL_DS is comparatively
-        * cheap.
-        */
-       rd              %asi, %g1
-       cmp             %g1, ASI_AIUS
-       bne,pn          %icc, memcpy_user_stub
-        nop
-
+ENTRY(___copy_in_user) /* %o0=dst, %o1=src, %o2=len */
        cmp             %o2, 0
        be,pn           %XCC, 85f
         or             %o0, %o1, %o3
@@ -53,22 +39,24 @@ ___copy_in_user:    /* %o0=dst, %o1=src, %o2=len */
        /* 16 < len <= 64 */
        andcc           %o3, 0x7, %g0
        bne,pn          %XCC, 90f
-        sub            %o0, %o1, %o3
+        nop
 
        andn            %o2, 0x7, %o4
        and             %o2, 0x7, %o2
 1:     subcc           %o4, 0x8, %o4
        EX(ldxa [%o1] %asi, %o5)
-       EX(stxa %o5, [%o1 + %o3] ASI_AIUS)
+       EX(stxa %o5, [%o0] %asi)
+       add             %o1, 0x8, %o1
        bgu,pt          %XCC, 1b
-        add            %o1, 0x8, %o1
+        add            %o0, 0x8, %o0
        andcc           %o2, 0x4, %g0
        be,pt           %XCC, 1f
         nop
        sub             %o2, 0x4, %o2
        EX(lduwa [%o1] %asi, %o5)
-       EX(stwa %o5, [%o1 + %o3] ASI_AIUS)
+       EX(stwa %o5, [%o0] %asi)
        add             %o1, 0x4, %o1
+       add             %o0, 0x4, %o0
 1:     cmp             %o2, 0
        be,pt           %XCC, 85f
         nop
@@ -78,14 +66,15 @@ ___copy_in_user:    /* %o0=dst, %o1=src, %o2=len */
 80:    /* 0 < len <= 16 */
        andcc           %o3, 0x3, %g0
        bne,pn          %XCC, 90f
-        sub            %o0, %o1, %o3
+        nop
 
 82:
        subcc           %o2, 4, %o2
        EX(lduwa [%o1] %asi, %g1)
-       EX(stwa %g1, [%o1 + %o3] ASI_AIUS)
+       EX(stwa %g1, [%o0] %asi)
+       add             %o1, 4, %o1
        bgu,pt          %XCC, 82b
-        add            %o1, 4, %o1
+        add            %o0, 4, %o0
 
 85:    retl
         clr            %o0
@@ -94,26 +83,10 @@ ___copy_in_user:    /* %o0=dst, %o1=src, %o2=len */
 90:
        subcc           %o2, 1, %o2
        EX(lduba [%o1] %asi, %g1)
-       EX(stba %g1, [%o1 + %o3] ASI_AIUS)
+       EX(stba %g1, [%o0] %asi)
+       add             %o1, 1, %o1
        bgu,pt          %XCC, 90b
-        add            %o1, 1, %o1
+        add            %o0, 1, %o0
        retl
         clr            %o0
-
-       .size           ___copy_in_user, .-___copy_in_user
-
-       /* Act like copy_{to,in}_user(), ie. return zero instead
-        * of original destination pointer.  This is invoked when
-        * copy_{to,in}_user() finds that %asi is kernel space.
-        */
-       .globl          memcpy_user_stub
-       .type           memcpy_user_stub,#function
-memcpy_user_stub:
-       save            %sp, -192, %sp
-       mov             %i0, %o0
-       mov             %i1, %o1
-       call            memcpy
-        mov            %i2, %o2
-       ret
-        restore        %g0, %g0, %o0
-       .size           memcpy_user_stub, .-memcpy_user_stub
+ENDPROC(___copy_in_user)
index a9e474bf63856077826d7ba0974ee887ca8d8c46..4ab8993b0863cda9f432464038daa14b483ae463 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/interrupt.h>
 #include <linux/kprobes.h>
 #include <linux/kdebug.h>
+#include <linux/percpu.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -224,6 +225,30 @@ cannot_handle:
        unhandled_fault (address, current, regs);
 }
 
+static void noinline bogus_32bit_fault_tpc(struct pt_regs *regs)
+{
+       static int times;
+
+       if (times++ < 10)
+               printk(KERN_ERR "FAULT[%s:%d]: 32-bit process reports "
+                      "64-bit TPC [%lx]\n",
+                      current->comm, current->pid,
+                      regs->tpc);
+       show_regs(regs);
+}
+
+static void noinline bogus_32bit_fault_address(struct pt_regs *regs,
+                                              unsigned long addr)
+{
+       static int times;
+
+       if (times++ < 10)
+               printk(KERN_ERR "FAULT[%s:%d]: 32-bit process "
+                      "reports 64-bit fault address [%lx]\n",
+                      current->comm, current->pid, addr);
+       show_regs(regs);
+}
+
 asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
 {
        struct mm_struct *mm = current->mm;
@@ -244,6 +269,19 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
            (fault_code & FAULT_CODE_DTLB))
                BUG();
 
+       if (test_thread_flag(TIF_32BIT)) {
+               if (!(regs->tstate & TSTATE_PRIV)) {
+                       if (unlikely((regs->tpc >> 32) != 0)) {
+                               bogus_32bit_fault_tpc(regs);
+                               goto intr_or_no_mm;
+                       }
+               }
+               if (unlikely((address >> 32) != 0)) {
+                       bogus_32bit_fault_address(regs, address);
+                       goto intr_or_no_mm;
+               }
+       }
+
        if (regs->tstate & TSTATE_PRIV) {
                unsigned long tpc = regs->tpc;
 
@@ -264,12 +302,6 @@ asmlinkage void __kprobes do_sparc64_fault(struct pt_regs *regs)
        if (in_atomic() || !mm)
                goto intr_or_no_mm;
 
-       if (test_thread_flag(TIF_32BIT)) {
-               if (!(regs->tstate & TSTATE_PRIV))
-                       regs->tpc &= 0xffffffff;
-               address &= 0xffffffff;
-       }
-
        if (!down_read_trylock(&mm->mmap_sem)) {
                if ((regs->tstate & TSTATE_PRIV) &&
                    !search_exception_tables(regs->tpc)) {
index d6e170c074fc5023b1befcbd7e9525e44f7ad96a..d172f86439b1b8be67b58c0f2ad1b64deb30068e 100644 (file)
 #include <linux/init.h>
  
 #ifdef CONFIG_SPARC64
-#include <asm/hypervisor.h>
-#include <asm/spitfire.h>
-#include <asm/cpudata.h>
-#include <asm/irq.h>
+#include <linux/notifier.h>
+#include <linux/rcupdate.h>
+#include <linux/kdebug.h>
+#include <asm/nmi.h>
 
-static int nmi_enabled;
-
-struct pcr_ops {
-       u64 (*read)(void);
-       void (*write)(u64);
-};
-static const struct pcr_ops *pcr_ops;
-
-static u64 direct_pcr_read(void)
-{
-       u64 val;
-
-       read_pcr(val);
-       return val;
-}
-
-static void direct_pcr_write(u64 val)
-{
-       write_pcr(val);
-}
-
-static const struct pcr_ops direct_pcr_ops = {
-       .read   = direct_pcr_read,
-       .write  = direct_pcr_write,
-};
-
-static void n2_pcr_write(u64 val)
+static int profile_timer_exceptions_notify(struct notifier_block *self,
+                                          unsigned long val, void *data)
 {
-       unsigned long ret;
-
-       ret = sun4v_niagara2_setperf(HV_N2_PERF_SPARC_CTL, val);
-       if (val != HV_EOK)
-               write_pcr(val);
-}
-
-static const struct pcr_ops n2_pcr_ops = {
-       .read   = direct_pcr_read,
-       .write  = n2_pcr_write,
-};
-
-/* In order to commonize as much of the implementation as
- * possible, we use PICH as our counter.  Mostly this is
- * to accomodate Niagara-1 which can only count insn cycles
- * in PICH.
- */
-static u64 picl_value(void)
-{
-       u32 delta = local_cpu_data().clock_tick / HZ;
-
-       return ((u64)((0 - delta) & 0xffffffff)) << 32;
-}
-
-#define PCR_PIC_PRIV           0x00000001 /* PIC access is privileged */
-#define PCR_STRACE             0x00000002 /* Trace supervisor events  */
-#define PCR_UTRACE             0x00000004 /* Trace user events        */
-#define PCR_N2_HTRACE          0x00000008 /* Trace hypervisor events  */
-#define PCR_N2_TOE_OV0         0x00000010 /* Trap if PIC 0 overflows  */
-#define PCR_N2_TOE_OV1         0x00000020 /* Trap if PIC 1 overflows  */
-#define PCR_N2_MASK0           0x00003fc0
-#define PCR_N2_MASK0_SHIFT     6
-#define PCR_N2_SL0             0x0003c000
-#define PCR_N2_SL0_SHIFT       14
-#define PCR_N2_OV0             0x00040000
-#define PCR_N2_MASK1           0x07f80000
-#define PCR_N2_MASK1_SHIFT     19
-#define PCR_N2_SL1             0x78000000
-#define PCR_N2_SL1_SHIFT       27
-#define PCR_N2_OV1             0x80000000
-
-#define PCR_SUN4U_ENABLE       (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE)
-#define PCR_N2_ENABLE          (PCR_PIC_PRIV | PCR_STRACE | PCR_UTRACE | \
-                                PCR_N2_TOE_OV1 | \
-                                (2 << PCR_N2_SL1_SHIFT) | \
-                                (0xff << PCR_N2_MASK1_SHIFT))
-
-static u64 pcr_enable = PCR_SUN4U_ENABLE;
-
-static void nmi_handler(struct pt_regs *regs)
-{
-       pcr_ops->write(PCR_PIC_PRIV);
-
-       if (nmi_enabled) {
-               oprofile_add_sample(regs, 0);
-
-               write_pic(picl_value());
-               pcr_ops->write(pcr_enable);
-       }
-}
-
-/* We count "clock cycle" events in the lower 32-bit PIC.
- * Then configure it such that it overflows every HZ, and thus
- * generates a level 15 interrupt at that frequency.
- */
-static void cpu_nmi_start(void *_unused)
-{
-       pcr_ops->write(PCR_PIC_PRIV);
-       write_pic(picl_value());
-
-       pcr_ops->write(pcr_enable);
-}
+       struct die_args *args = (struct die_args *)data;
+       int ret = NOTIFY_DONE;
 
-static void cpu_nmi_stop(void *_unused)
-{
-       pcr_ops->write(PCR_PIC_PRIV);
-}
-
-static int nmi_start(void)
-{
-       int err = register_perfctr_intr(nmi_handler);
-
-       if (!err) {
-               nmi_enabled = 1;
-               wmb();
-               err = on_each_cpu(cpu_nmi_start, NULL, 1);
-               if (err) {
-                       nmi_enabled = 0;
-                       wmb();
-                       on_each_cpu(cpu_nmi_stop, NULL, 1);
-                       release_perfctr_intr(nmi_handler);
-               }
+       switch (val) {
+       case DIE_NMI:
+               oprofile_add_sample(args->regs, 0);
+               ret = NOTIFY_STOP;
+               break;
+       default:
+               break;
        }
-
-       return err;
-}
-
-static void nmi_stop(void)
-{
-       nmi_enabled = 0;
-       wmb();
-
-       on_each_cpu(cpu_nmi_stop, NULL, 1);
-       release_perfctr_intr(nmi_handler);
-       synchronize_sched();
+       return ret;
 }
 
-static unsigned long perf_hsvc_group;
-static unsigned long perf_hsvc_major;
-static unsigned long perf_hsvc_minor;
+static struct notifier_block profile_timer_exceptions_nb = {
+       .notifier_call  = profile_timer_exceptions_notify,
+};
 
-static int __init register_perf_hsvc(void)
+static int timer_start(void)
 {
-       if (tlb_type == hypervisor) {
-               switch (sun4v_chip_type) {
-               case SUN4V_CHIP_NIAGARA1:
-                       perf_hsvc_group = HV_GRP_NIAG_PERF;
-                       break;
-
-               case SUN4V_CHIP_NIAGARA2:
-                       perf_hsvc_group = HV_GRP_N2_CPU;
-                       break;
-
-               default:
-                       return -ENODEV;
-               }
-
-
-               perf_hsvc_major = 1;
-               perf_hsvc_minor = 0;
-               if (sun4v_hvapi_register(perf_hsvc_group,
-                                        perf_hsvc_major,
-                                        &perf_hsvc_minor)) {
-                       printk("perfmon: Could not register N2 hvapi.\n");
-                       return -ENODEV;
-               }
-       }
+       if (register_die_notifier(&profile_timer_exceptions_nb))
+               return 1;
+       nmi_adjust_hz(HZ);
        return 0;
 }
 
-static void unregister_perf_hsvc(void)
+
+static void timer_stop(void)
 {
-       if (tlb_type != hypervisor)
-               return;
-       sun4v_hvapi_unregister(perf_hsvc_group);
+       nmi_adjust_hz(1);
+       unregister_die_notifier(&profile_timer_exceptions_nb);
+       synchronize_sched();  /* Allow already-started NMIs to complete. */
 }
 
-static int oprofile_nmi_init(struct oprofile_operations *ops)
+static int op_nmi_timer_init(struct oprofile_operations *ops)
 {
-       int err = register_perf_hsvc();
-
-       if (err)
-               return err;
-
-       switch (tlb_type) {
-       case hypervisor:
-               pcr_ops = &n2_pcr_ops;
-               pcr_enable = PCR_N2_ENABLE;
-               break;
-
-       case cheetah:
-       case cheetah_plus:
-               pcr_ops = &direct_pcr_ops;
-               break;
-
-       default:
+       if (!nmi_usable)
                return -ENODEV;
-       }
 
-       ops->create_files = NULL;
-       ops->setup = NULL;
-       ops->shutdown = NULL;
-       ops->start = nmi_start;
-       ops->stop = nmi_stop;
+       ops->start = timer_start;
+       ops->stop = timer_stop;
        ops->cpu_type = "timer";
-
-       printk(KERN_INFO "oprofile: Using perfctr based NMI timer interrupt.\n");
-
+       printk(KERN_INFO "oprofile: Using perfctr NMI timer interrupt.\n");
        return 0;
 }
 #endif
@@ -233,7 +73,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        int ret = -ENODEV;
 
 #ifdef CONFIG_SPARC64
-       ret = oprofile_nmi_init(ops);
+       ret = op_nmi_timer_init(ops);
        if (!ret)
                return ret;
 #endif
@@ -241,10 +81,6 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
        return ret;
 }
 
-
 void oprofile_arch_exit(void)
 {
-#ifdef CONFIG_SPARC64
-       unregister_perf_hsvc();
-#endif
 }
index 56533db25343129bcd60c152744966a2b84241cc..c5c43253e6ce4994778205e1853e2026f19a0cae 100644 (file)
@@ -78,7 +78,7 @@ void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init)
 {
        struct vde_open_args *args;
 
-       vpri->args = kmalloc(sizeof(struct vde_open_args), UM_GFP_KERNEL);
+       vpri->args = uml_kmalloc(sizeof(struct vde_open_args), UM_GFP_KERNEL);
        if (vpri->args == NULL) {
                printk(UM_KERN_ERR "vde_init_libstuff - vde_open_args "
                       "allocation failed");
@@ -91,8 +91,8 @@ void vde_init_libstuff(struct vde_data *vpri, struct vde_init *init)
        args->group = init->group;
        args->mode = init->mode ? init->mode : 0700;
 
-       args->port ?  printk(UM_KERN_INFO "port %d", args->port) :
-               printk(UM_KERN_INFO "undefined port");
+       args->port ?  printk("port %d", args->port) :
+               printk("undefined port");
 }
 
 int vde_user_read(void *conn, void *buf, int len)
index 73f7fe8fd4d1c52d0e6851745067035fc008821e..9c39095b33fc0d1dbdc7f92408314dae1ed38e87 100644 (file)
@@ -1802,6 +1802,17 @@ config DMAR
          and include PCI device scope covered by these DMA
          remapping devices.
 
+config DMAR_DEFAULT_ON
+       def_bool n
+       prompt "Enable DMA Remapping Devices by default"
+       depends on DMAR
+       help
+         Selecting this option will enable a DMAR device at boot time if
+         one is found. If this option is not selected, DMAR support can
+         be enabled by passing intel_iommu=on to the kernel. It is
+         recommended you say N here while the DMAR code remains
+         experimental.
+
 config DMAR_GFX_WA
        def_bool y
        prompt "Support for Graphics workaround"
index 8078955845ae8778482f0f0662c1e2a50bae5713..c98d52e82966f9a965b4b2ddc2af2e1272bea7b2 100644 (file)
@@ -167,9 +167,9 @@ config MK7
 config MK8
        bool "Opteron/Athlon64/Hammer/K8"
        help
-         Select this for an AMD Opteron or Athlon64 Hammer-family processor.  Enables
-         use of some extended instructions, and passes appropriate optimization
-         flags to GCC.
+         Select this for an AMD Opteron or Athlon64 Hammer-family processor.
+         Enables use of some extended instructions, and passes appropriate
+         optimization flags to GCC.
 
 config MCRUSOE
        bool "Crusoe"
@@ -256,9 +256,11 @@ config MPSC
 config MCORE2
        bool "Core 2/newer Xeon"
        help
-         Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and 53xx)
-         CPUs. You can distinguish newer from older Xeons by the CPU family
-         in /proc/cpuinfo. Newer ones have 6 and older ones 15 (not a typo)
+
+         Select this for Intel Core 2 and newer Core 2 Xeons (Xeon 51xx and
+         53xx) CPUs. You can distinguish newer from older Xeons by the CPU
+         family in /proc/cpuinfo. Newer ones have 6 and older ones 15
+         (not a typo)
 
 config GENERIC_CPU
        bool "Generic-x86-64"
@@ -320,14 +322,14 @@ config X86_PPRO_FENCE
        bool "PentiumPro memory ordering errata workaround"
        depends on M686 || M586MMX || M586TSC || M586 || M486 || M386 || MGEODEGX1
        help
-         Old PentiumPro multiprocessor systems had errata that could cause memory
-         operations to violate the x86 ordering standard in rare cases. Enabling this
-         option will attempt to work around some (but not all) occurances of
-         this problem, at the cost of much heavier spinlock and memory barrier
-         operations.
+         Old PentiumPro multiprocessor systems had errata that could cause
+         memory operations to violate the x86 ordering standard in rare cases.
+         Enabling this option will attempt to work around some (but not all)
+         occurances of this problem, at the cost of much heavier spinlock and
+         memory barrier operations.
 
-         If unsure, say n here. Even distro kernels should think twice before enabling
-         this: there are few systems, and an unlikely bug.
+         If unsure, say n here. Even distro kernels should think twice before
+         enabling this: there are few systems, and an unlikely bug.
 
 config X86_F00F_BUG
        def_bool y
index 10d6cc3fd052fd56c6817f2736e78a113bfa1046..e1983fa025d2a941f86c5ac6dc4012fc3b1d4e71 100644 (file)
@@ -174,28 +174,8 @@ config IOMMU_LEAK
          Add a simple leak tracer to the IOMMU code. This is useful when you
          are debugging a buggy device driver that leaks IOMMU mappings.
 
-config MMIOTRACE
-       bool "Memory mapped IO tracing"
-       depends on DEBUG_KERNEL && PCI
-       select TRACING
-       help
-         Mmiotrace traces Memory Mapped I/O access and is meant for
-         debugging and reverse engineering. It is called from the ioremap
-         implementation and works via page faults. Tracing is disabled by
-         default and can be enabled at run-time.
-
-         See Documentation/tracers/mmiotrace.txt.
-         If you are not helping to develop drivers, say N.
-
-config MMIOTRACE_TEST
-       tristate "Test module for mmiotrace"
-       depends on MMIOTRACE && m
-       help
-         This is a dumb module for testing mmiotrace. It is very dangerous
-         as it will write garbage to IO memory starting at a given address.
-         However, it should be safe to use on e.g. unused portion of VRAM.
-
-         Say N, unless you absolutely know what you are doing.
+config HAVE_MMIOTRACE_SUPPORT
+       def_bool y
 
 #
 # IO delay types:
index 256b00b61892b2e3049ef8ff65a672df701efc77..5a0d76dc56a46431690702be8f745d6813db4cfc 100644 (file)
@@ -418,9 +418,9 @@ ENTRY(ia32_syscall)
        orl   $TS_COMPAT,TI_status(%r10)
        testl $_TIF_WORK_SYSCALL_ENTRY,TI_flags(%r10)
        jnz ia32_tracesys
-ia32_do_syscall:       
        cmpl $(IA32_NR_syscalls-1),%eax
-       ja  int_ret_from_sys_call       /* ia32_tracesys has set RAX(%rsp) */
+       ja ia32_badsys
+ia32_do_call:
        IA32_ARG_FIXUP
        call *ia32_sys_call_table(,%rax,8) # xxx: rip relative
 ia32_sysret:
@@ -435,7 +435,9 @@ ia32_tracesys:
        call syscall_trace_enter
        LOAD_ARGS32 ARGOFFSET  /* reload args from stack in case ptrace changed it */
        RESTORE_REST
-       jmp ia32_do_syscall
+       cmpl $(IA32_NR_syscalls-1),%eax
+       ja  int_ret_from_sys_call       /* ia32_tracesys has set RAX(%rsp) */
+       jmp ia32_do_call
 END(ia32_syscall)
 
 ia32_badsys:
index 37822206083e2684026984d69ee8732a9b74118a..3c601f8224bec75642bbb86c0a0b9a369f9c81a1 100644 (file)
@@ -23,8 +23,6 @@
  */
 static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
 {
-       u16 gs;
-
 /* changed the size calculations - should hopefully work better. lbt */
        dump->magic = CMAGIC;
        dump->start_code = 0;
@@ -57,7 +55,7 @@ static inline void aout_dump_thread(struct pt_regs *regs, struct user *dump)
        dump->regs.ds = (u16)regs->ds;
        dump->regs.es = (u16)regs->es;
        dump->regs.fs = (u16)regs->fs;
-       savesegment(gs, gs);
+       savesegment(gs, dump->regs.gs);
        dump->regs.orig_ax = regs->orig_ax;
        dump->regs.ip = regs->ip;
        dump->regs.cs = (u16)regs->cs;
index ea408dcba5135a04d35514e784ce7837ad90e285..7301e60dc4a83c56e28b6e8867ab6a15419347bf 100644 (file)
@@ -93,6 +93,7 @@
 #define X86_FEATURE_XTOPOLOGY  (3*32+22) /* cpu topology enum extensions */
 #define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */
 #define X86_FEATURE_NONSTOP_TSC        (3*32+24) /* TSC does not stop in C states */
+#define X86_FEATURE_CLFLUSH_MONITOR (3*32+25) /* "" clflush reqd with monitor */
 
 /* Intel-defined CPU features, CPUID level 0x00000001 (ecx), word 4 */
 #define X86_FEATURE_XMM3       (4*32+ 0) /* "pni" SSE-3 */
index d2e3bf3608af549cb544fddc17c590c139c80733..886c9402ec4583fd94fc9f6eb44aa8bda088ab3a 100644 (file)
@@ -9,6 +9,13 @@
 #include <linux/types.h>
 #include <linux/ioctl.h>
 
+/* Select x86 specific features in <linux/kvm.h> */
+#define __KVM_HAVE_PIT
+#define __KVM_HAVE_IOAPIC
+#define __KVM_HAVE_DEVICE_ASSIGNMENT
+#define __KVM_HAVE_MSI
+#define __KVM_HAVE_USER_NMI
+
 /* Architectural interrupt line count. */
 #define KVM_NR_INTERRUPTS 256
 
index 5a65b107ad58350b4eb76bf6aaa4e639d2404b62..031f6266f42564441f86535157923b146feff0c2 100644 (file)
@@ -1,31 +1,18 @@
 #ifndef _ASM_X86_MATH_EMU_H
 #define _ASM_X86_MATH_EMU_H
 
+#include <asm/ptrace.h>
+#include <asm/vm86.h>
+
 /* This structure matches the layout of the data saved to the stack
    following a device-not-present interrupt, part of it saved
    automatically by the 80386/80486.
    */
-struct info {
+struct math_emu_info {
        long ___orig_eip;
-       long ___ebx;
-       long ___ecx;
-       long ___edx;
-       long ___esi;
-       long ___edi;
-       long ___ebp;
-       long ___eax;
-       long ___ds;
-       long ___es;
-       long ___fs;
-       long ___orig_eax;
-       long ___eip;
-       long ___cs;
-       long ___eflags;
-       long ___esp;
-       long ___ss;
-       long ___vm86_es; /* This and the following only in vm86 mode */
-       long ___vm86_ds;
-       long ___vm86_fs;
-       long ___vm86_gs;
+       union {
+               struct pt_regs *regs;
+               struct kernel_vm86_regs *vm86;
+       };
 };
 #endif /* _ASM_X86_MATH_EMU_H */
index 07f1af494ca5c011801c9260a088d2dd34a4ae8e..105fb90a063527d761ed47350d553ecb755bd3cb 100644 (file)
@@ -32,8 +32,6 @@ static inline void get_memcfg_numa(void)
        get_memcfg_numa_flat();
 }
 
-extern int early_pfn_to_nid(unsigned long pfn);
-
 extern void resume_map_numa_kva(pgd_t *pgd);
 
 #else /* !CONFIG_NUMA */
index a5b3817d4b9e621e2615ddd16435b83011206548..a29f48c2a3229fc5a8a23599fdf51bcfb94c3dea 100644 (file)
@@ -40,8 +40,6 @@ static inline __attribute__((pure)) int phys_to_nid(unsigned long addr)
 #define node_end_pfn(nid)       (NODE_DATA(nid)->node_start_pfn +      \
                                 NODE_DATA(nid)->node_spanned_pages)
 
-extern int early_pfn_to_nid(unsigned long pfn);
-
 #ifdef CONFIG_NUMA_EMU
 #define FAKE_NODE_MIN_SIZE     (64 * 1024 * 1024)
 #define FAKE_NODE_MIN_HASH_MASK        (~(FAKE_NODE_MIN_SIZE - 1UL))
index 62d14ce3cd0050f2fc3e36beb0ffbe98cc08dcb5..bd22f2a3713fe15bac77d53847f06ac0d1be45e7 100644 (file)
@@ -60,6 +60,7 @@ extern void mp_override_legacy_irq(u8 bus_irq, u8 polarity, u8 trigger,
                                   u32 gsi);
 extern void mp_config_acpi_legacy_irqs(void);
 extern int mp_register_gsi(u32 gsi, int edge_level, int active_high_low);
+extern int acpi_probe_gsi(void);
 #ifdef CONFIG_X86_IO_APIC
 extern int mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
                                u32 gsi, int triggering, int polarity);
@@ -71,6 +72,11 @@ mp_config_acpi_gsi(unsigned char number, unsigned int devfn, u8 pin,
        return 0;
 }
 #endif
+#else /* !CONFIG_ACPI: */
+static inline int acpi_probe_gsi(void)
+{
+       return 0;
+}
 #endif /* CONFIG_ACPI */
 
 #define PHYSID_ARRAY_SIZE      BITS_TO_LONGS(MAX_APICS)
index e9873a2e86951d10c7a5576e3b908956d0e3e6f8..776579119a009feb1b2854a9ea18a68183d63243 100644 (file)
@@ -57,7 +57,6 @@ typedef struct { pgdval_t pgd; } pgd_t;
 typedef struct { pgprotval_t pgprot; } pgprot_t;
 
 extern int page_is_ram(unsigned long pagenr);
-extern int pagerange_is_ram(unsigned long start, unsigned long end);
 extern int devmem_is_allowed(unsigned long pagenr);
 extern void map_devmem(unsigned long pfn, unsigned long size,
                       pgprot_t vma_prot);
index ba3e2ff6aedcb1a7c6648acdc9257ad0bb7e3202..e299287e8e3396d95b3169c5a9e9a1086e662a1a 100644 (file)
@@ -1352,14 +1352,7 @@ static inline void arch_leave_lazy_cpu_mode(void)
        PVOP_VCALL0(pv_cpu_ops.lazy_mode.leave);
 }
 
-static inline void arch_flush_lazy_cpu_mode(void)
-{
-       if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU)) {
-               arch_leave_lazy_cpu_mode();
-               arch_enter_lazy_cpu_mode();
-       }
-}
-
+void arch_flush_lazy_cpu_mode(void);
 
 #define  __HAVE_ARCH_ENTER_LAZY_MMU_MODE
 static inline void arch_enter_lazy_mmu_mode(void)
@@ -1372,13 +1365,7 @@ static inline void arch_leave_lazy_mmu_mode(void)
        PVOP_VCALL0(pv_mmu_ops.lazy_mode.leave);
 }
 
-static inline void arch_flush_lazy_mmu_mode(void)
-{
-       if (unlikely(paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU)) {
-               arch_leave_lazy_mmu_mode();
-               arch_enter_lazy_mmu_mode();
-       }
-}
+void arch_flush_lazy_mmu_mode(void);
 
 static inline void __set_fixmap(unsigned /* enum fixed_addresses */ idx,
                                unsigned long phys, pgprot_t flags)
@@ -1402,6 +1389,7 @@ static inline int __raw_spin_is_contended(struct raw_spinlock *lock)
 {
        return PVOP_CALL1(int, pv_lock_ops.spin_is_contended, lock);
 }
+#define __raw_spin_is_contended        __raw_spin_is_contended
 
 static __always_inline void __raw_spin_lock(struct raw_spinlock *lock)
 {
index 06bbcbd66e9c508285020b65c6d411afd2bfe59b..4f5af8447d549eee4a088ba77f1d1f3991c0b2d5 100644 (file)
@@ -302,16 +302,30 @@ static inline pte_t pte_mkspecial(pte_t pte)
 
 extern pteval_t __supported_pte_mask;
 
+/*
+ * Mask out unsupported bits in a present pgprot.  Non-present pgprots
+ * can use those bits for other purposes, so leave them be.
+ */
+static inline pgprotval_t massage_pgprot(pgprot_t pgprot)
+{
+       pgprotval_t protval = pgprot_val(pgprot);
+
+       if (protval & _PAGE_PRESENT)
+               protval &= __supported_pte_mask;
+
+       return protval;
+}
+
 static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
 {
-       return __pte((((phys_addr_t)page_nr << PAGE_SHIFT) |
-                     pgprot_val(pgprot)) & __supported_pte_mask);
+       return __pte(((phys_addr_t)page_nr << PAGE_SHIFT) |
+                    massage_pgprot(pgprot));
 }
 
 static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
 {
-       return __pmd((((phys_addr_t)page_nr << PAGE_SHIFT) |
-                     pgprot_val(pgprot)) & __supported_pte_mask);
+       return __pmd(((phys_addr_t)page_nr << PAGE_SHIFT) |
+                    massage_pgprot(pgprot));
 }
 
 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
@@ -323,7 +337,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
         * the newprot (if present):
         */
        val &= _PAGE_CHG_MASK;
-       val |= pgprot_val(newprot) & (~_PAGE_CHG_MASK) & __supported_pte_mask;
+       val |= massage_pgprot(newprot) & ~_PAGE_CHG_MASK;
 
        return __pte(val);
 }
@@ -339,7 +353,7 @@ static inline pgprot_t pgprot_modify(pgprot_t oldprot, pgprot_t newprot)
 
 #define pte_pgprot(x) __pgprot(pte_flags(x) & PTE_FLAGS_MASK)
 
-#define canon_pgprot(p) __pgprot(pgprot_val(p) & __supported_pte_mask)
+#define canon_pgprot(p) __pgprot(massage_pgprot(p))
 
 static inline int is_new_memtype_allowed(unsigned long flags,
                                                unsigned long new_flags)
index 091cd8855f2e61707747d07c94286399619852e9..3bfd5235a9eb46dbf5e1386cf8ba34b6e8765066 100644 (file)
@@ -353,7 +353,7 @@ struct i387_soft_struct {
        u8                      no_update;
        u8                      rm;
        u8                      alimit;
-       struct info             *info;
+       struct math_emu_info    *info;
        u32                     entry_eip;
 };
 
index 8ab9cc8b2eccb8949e99f7e2adb19144dedbebb3..ca8bf2cd0ba99278af42bdd46a1747e8ea6e7f43 100644 (file)
@@ -54,4 +54,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_X86_SOCKET_H */
index d17c91981da2f1c94a5fb045067f821ece61b4fe..8247e94ac6b18dc337f9404cffc97800660c64d8 100644 (file)
@@ -245,6 +245,7 @@ static inline int __raw_spin_is_contended(raw_spinlock_t *lock)
 {
        return __ticket_spin_is_contended(lock);
 }
+#define __raw_spin_is_contended        __raw_spin_is_contended
 
 static __always_inline void __raw_spin_lock(raw_spinlock_t *lock)
 {
index 2ee0a3bceedf4738cc0e65b1cda67110399550f1..cf3bb053da0b83cb51909168893c35726bc8290a 100644 (file)
@@ -41,7 +41,7 @@ dotraplinkage void do_int3(struct pt_regs *, long);
 dotraplinkage void do_overflow(struct pt_regs *, long);
 dotraplinkage void do_bounds(struct pt_regs *, long);
 dotraplinkage void do_invalid_op(struct pt_regs *, long);
-dotraplinkage void do_device_not_available(struct pt_regs *, long);
+dotraplinkage void do_device_not_available(struct pt_regs);
 dotraplinkage void do_coprocessor_segment_overrun(struct pt_regs *, long);
 dotraplinkage void do_invalid_TSS(struct pt_regs *, long);
 dotraplinkage void do_segment_not_present(struct pt_regs *, long);
@@ -77,7 +77,7 @@ extern int panic_on_unrecovered_nmi;
 extern int kstack_depth_to_print;
 
 void math_error(void __user *);
-asmlinkage void math_emulate(long);
+void math_emulate(struct math_emu_info *);
 #ifdef CONFIG_X86_32
 unsigned long patch_espfix_desc(unsigned long, unsigned long);
 #else
index 7ef617ef1df3ca38c1d29286a4742e770982dc67..4bd990ee43df840a99ffb1a283cb2b6a664af7f2 100644 (file)
@@ -137,7 +137,7 @@ static inline pte_t mfn_pte(unsigned long page_nr, pgprot_t pgprot)
        pte_t pte;
 
        pte.pte = ((phys_addr_t)page_nr << PAGE_SHIFT) |
-               (pgprot_val(pgprot) & __supported_pte_mask);
+                       massage_pgprot(pgprot);
 
        return pte;
 }
index d37593c2f438d80ff609ed61e0584032670db260..7678f10c45686e1113381ccf5af41fb2c4ad3906 100644 (file)
@@ -973,6 +973,29 @@ void __init mp_register_ioapic(int id, u32 address, u32 gsi_base)
        nr_ioapics++;
 }
 
+int __init acpi_probe_gsi(void)
+{
+       int idx;
+       int gsi;
+       int max_gsi = 0;
+
+       if (acpi_disabled)
+               return 0;
+
+       if (!acpi_ioapic)
+               return 0;
+
+       max_gsi = 0;
+       for (idx = 0; idx < nr_ioapics; idx++) {
+               gsi = mp_ioapic_routing[idx].gsi_end;
+
+               if (gsi > max_gsi)
+                       max_gsi = gsi;
+       }
+
+       return max_gsi + 1;
+}
+
 static void assign_to_mp_irq(struct mp_config_intsrc *m,
                                    struct mp_config_intsrc *mp_irq)
 {
index 707c1f6f95faedfb7db7aed696c45c79461b0ea2..a60c1f3bcb87826ebdfffc15f2ca78488308ba2f 100644 (file)
@@ -156,11 +156,11 @@ static int __init acpi_sleep_setup(char *str)
 #ifdef CONFIG_HIBERNATION
                if (strncmp(str, "s4_nohwsig", 10) == 0)
                        acpi_no_s4_hw_signature();
+               if (strncmp(str, "s4_nonvs", 8) == 0)
+                       acpi_s4_no_nvs();
 #endif
                if (strncmp(str, "old_ordering", 12) == 0)
                        acpi_old_suspend_ordering();
-               if (strncmp(str, "s4_nonvs", 8) == 0)
-                       acpi_s4_no_nvs();
                str = strchr(str, ',');
                if (str != NULL)
                        str += strspn(str, ", \t");
index bcc293423a7026cb28e8c659b693d464a8cfe28e..96258d9dc9743c094e0d42af3ff6201d960a6abb 100644 (file)
@@ -13,7 +13,6 @@
         * Hooray, we are in Long 64-bit mode (but still running in low memory)
         */
 ENTRY(wakeup_long64)
-wakeup_long64:
        movq    saved_magic, %rax
        movq    $0x123456789abcdef0, %rdx
        cmpq    %rdx, %rax
@@ -34,16 +33,12 @@ wakeup_long64:
 
        movq    saved_rip, %rax
        jmp     *%rax
+ENDPROC(wakeup_long64)
 
 bogus_64_magic:
        jmp     bogus_64_magic
 
-       .align 2
-       .p2align 4,,15
-.globl do_suspend_lowlevel
-       .type   do_suspend_lowlevel,@function
-do_suspend_lowlevel:
-.LFB5:
+ENTRY(do_suspend_lowlevel)
        subq    $8, %rsp
        xorl    %eax, %eax
        call    save_processor_state
@@ -67,7 +62,7 @@ do_suspend_lowlevel:
        pushfq
        popq    pt_regs_flags(%rax)
 
-       movq    $.L97, saved_rip(%rip)
+       movq    $resume_point, saved_rip(%rip)
 
        movq    %rsp, saved_rsp
        movq    %rbp, saved_rbp
@@ -78,14 +73,12 @@ do_suspend_lowlevel:
        addq    $8, %rsp
        movl    $3, %edi
        xorl    %eax, %eax
-       jmp     acpi_enter_sleep_state
-.L97:
-       .p2align 4,,7
-.L99:
-       .align 4
-       movl    $24, %eax
-       movw    %ax, %ds
+       call    acpi_enter_sleep_state
+       /* in case something went wrong, restore the machine status and go on */
+       jmp     resume_point
 
+       .align 4
+resume_point:
        /* We don't restore %rax, it must be 0 anyway */
        movq    $saved_context, %rax
        movq    saved_context_cr4(%rax), %rbx
@@ -117,12 +110,9 @@ do_suspend_lowlevel:
        xorl    %eax, %eax
        addq    $8, %rsp
        jmp     restore_processor_state
-.LFE5:
-.Lfe5:
-       .size   do_suspend_lowlevel, .Lfe5-do_suspend_lowlevel
-       
+ENDPROC(do_suspend_lowlevel)
+
 .data
-ALIGN
 ENTRY(saved_rbp)       .quad   0
 ENTRY(saved_rsi)       .quad   0
 ENTRY(saved_rdi)       .quad   0
index 4b6df2469fe3ddda97dd7b901171b8bba5c483f0..570f36e44e59671d7bdc0722a2370f1e8633fbe4 100644 (file)
@@ -862,7 +862,7 @@ void clear_local_APIC(void)
        }
 
        /* lets not touch this if we didn't frob it */
-#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(X86_MCE_INTEL)
+#if defined(CONFIG_X86_MCE_P4THERMAL) || defined(CONFIG_X86_MCE_INTEL)
        if (maxlvt >= 5) {
                v = apic_read(APIC_LVTTHMR);
                apic_write(APIC_LVTTHMR, v | APIC_LVT_MASKED);
@@ -1436,7 +1436,7 @@ static int __init detect_init_APIC(void)
        switch (boot_cpu_data.x86_vendor) {
        case X86_VENDOR_AMD:
                if ((boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model > 1) ||
-                   (boot_cpu_data.x86 == 15))
+                   (boot_cpu_data.x86 >= 15))
                        break;
                goto no_apic;
        case X86_VENDOR_INTEL:
index 98807bb095adadf6e03003beffff4c640161f33a..266ec6c18b6c6b9aea5696d796c7dc565105286b 100644 (file)
@@ -1192,6 +1192,7 @@ static int suspend(int vetoable)
        device_suspend(PMSG_SUSPEND);
        local_irq_disable();
        device_power_down(PMSG_SUSPEND);
+       sysdev_suspend(PMSG_SUSPEND);
 
        local_irq_enable();
 
@@ -1208,6 +1209,7 @@ static int suspend(int vetoable)
        if (err != APM_SUCCESS)
                apm_error("suspend", err);
        err = (err == APM_SUCCESS) ? 0 : -EIO;
+       sysdev_resume();
        device_power_up(PMSG_RESUME);
        local_irq_enable();
        device_resume(PMSG_RESUME);
@@ -1228,6 +1230,7 @@ static void standby(void)
 
        local_irq_disable();
        device_power_down(PMSG_SUSPEND);
+       sysdev_suspend(PMSG_SUSPEND);
        local_irq_enable();
 
        err = set_system_power_state(APM_STATE_STANDBY);
@@ -1235,6 +1238,7 @@ static void standby(void)
                apm_error("standby", err);
 
        local_irq_disable();
+       sysdev_resume();
        device_power_up(PMSG_RESUME);
        local_irq_enable();
 }
index efae3b22a0ff7deda3b211f482553ec5feda43a7..65792c2cc4625f7c44337ddb043bbcd92090aee5 100644 (file)
@@ -245,17 +245,6 @@ config X86_E_POWERSAVER
 
 comment "shared options"
 
-config X86_ACPI_CPUFREQ_PROC_INTF
-       bool "/proc/acpi/processor/../performance interface (deprecated)"
-       depends on PROC_FS
-       depends on X86_ACPI_CPUFREQ || X86_POWERNOW_K7_ACPI || X86_POWERNOW_K8_ACPI
-       help
-         This enables the deprecated /proc/acpi/processor/../performance
-         interface. While it is helpful for debugging, the generic,
-         cross-architecture cpufreq interfaces should be used.
-
-         If in doubt, say N.
-
 config X86_SPEEDSTEP_LIB
        tristate
        default (X86_SPEEDSTEP_ICH || X86_SPEEDSTEP_SMI || X86_P4_CLOCKMOD)
index 5c28b37dea1181bd6813bc21be7de45ed6a4c872..6428aa17b40e794683b5359ed0589dc3dbfbf592 100644 (file)
@@ -939,10 +939,25 @@ static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data)
        free_cpumask_var(data->acpi_data.shared_cpu_map);
 }
 
+static int get_transition_latency(struct powernow_k8_data *data)
+{
+       int max_latency = 0;
+       int i;
+       for (i = 0; i < data->acpi_data.state_count; i++) {
+               int cur_latency = data->acpi_data.states[i].transition_latency
+                       + data->acpi_data.states[i].bus_master_latency;
+               if (cur_latency > max_latency)
+                       max_latency = cur_latency;
+       }
+       /* value in usecs, needs to be in nanoseconds */
+       return 1000 * max_latency;
+}
+
 #else
 static int powernow_k8_cpu_init_acpi(struct powernow_k8_data *data) { return -ENODEV; }
 static void powernow_k8_cpu_exit_acpi(struct powernow_k8_data *data) { return; }
 static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index) { return; }
+static int get_transition_latency(struct powernow_k8_data *data) { return 0; }
 #endif /* CONFIG_X86_POWERNOW_K8_ACPI */
 
 /* Take a frequency, and issue the fid/vid transition command */
@@ -1142,8 +1157,7 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
        data->cpu = pol->cpu;
        data->currpstate = HW_PSTATE_INVALID;
 
-       rc = powernow_k8_cpu_init_acpi(data);
-       if (rc) {
+       if (powernow_k8_cpu_init_acpi(data)) {
                /*
                 * Use the PSB BIOS structure. This is only availabe on
                 * an UP version, and is deprecated by AMD.
@@ -1161,19 +1175,28 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
                               "ACPI maintainers and complain to your BIOS "
                               "vendor.\n");
 #endif
-                       goto err_out;
+                       kfree(data);
+                       return -ENODEV;
                }
                if (pol->cpu != 0) {
                        printk(KERN_ERR FW_BUG PFX "No ACPI _PSS objects for "
                               "CPU other than CPU0. Complain to your BIOS "
                               "vendor.\n");
-                       goto err_out;
+                       kfree(data);
+                       return -ENODEV;
                }
                rc = find_psb_table(data);
                if (rc) {
-                       goto err_out;
+                       kfree(data);
+                       return -ENODEV;
                }
-       }
+               /* Take a crude guess here.
+                * That guess was in microseconds, so multiply with 1000 */
+               pol->cpuinfo.transition_latency = (
+                        ((data->rvo + 8) * data->vstable * VST_UNITS_20US) +
+                        ((1 << data->irt) * 30)) * 1000;
+       } else /* ACPI _PSS objects available */
+               pol->cpuinfo.transition_latency = get_transition_latency(data);
 
        /* only run on specific CPU from here on */
        oldmask = current->cpus_allowed;
@@ -1204,11 +1227,6 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
                cpumask_copy(pol->cpus, &per_cpu(cpu_core_map, pol->cpu));
        data->available_cores = pol->cpus;
 
-       /* Take a crude guess here.
-        * That guess was in microseconds, so multiply with 1000 */
-       pol->cpuinfo.transition_latency = (((data->rvo + 8) * data->vstable * VST_UNITS_20US)
-           + (3 * (1 << data->irt) * 10)) * 1000;
-
        if (cpu_family == CPU_HW_PSTATE)
                pol->cur = find_khz_freq_from_pstate(data->powernow_table, data->currpstate);
        else
index 430e5c38a5449a93c65e0877d780bbf2cac97884..24ff26a38adecff5ef27d4e76fb74caebd1fbb88 100644 (file)
@@ -291,6 +291,9 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
                ds_init_intel(c);
        }
 
+       if (c->x86 == 6 && c->x86_model == 29 && cpu_has_clflush)
+               set_cpu_cap(c, X86_FEATURE_CLFLUSH_MONITOR);
+
 #ifdef CONFIG_X86_64
        if (c->x86 == 15)
                c->x86_cache_alignment = c->x86_clflush_size * 2;
index 48533d77be7850c786a0482968ab5ef0d4f4ac51..da299eb85fc09b8086e0dc9e883fcdd1a59db12a 100644 (file)
@@ -36,8 +36,11 @@ static struct _cache_table cache_table[] __cpuinitdata =
 {
        { 0x06, LVL_1_INST, 8 },        /* 4-way set assoc, 32 byte line size */
        { 0x08, LVL_1_INST, 16 },       /* 4-way set assoc, 32 byte line size */
+       { 0x09, LVL_1_INST, 32 },       /* 4-way set assoc, 64 byte line size */
        { 0x0a, LVL_1_DATA, 8 },        /* 2 way set assoc, 32 byte line size */
        { 0x0c, LVL_1_DATA, 16 },       /* 4-way set assoc, 32 byte line size */
+       { 0x0d, LVL_1_DATA, 16 },       /* 4-way set assoc, 64 byte line size */
+       { 0x21, LVL_2,      256 },      /* 8-way set assoc, 64 byte line size */
        { 0x22, LVL_3,      512 },      /* 4-way set assoc, sectored cache, 64 byte line size */
        { 0x23, LVL_3,      1024 },     /* 8-way set assoc, sectored cache, 64 byte line size */
        { 0x25, LVL_3,      2048 },     /* 8-way set assoc, sectored cache, 64 byte line size */
@@ -85,6 +88,18 @@ static struct _cache_table cache_table[] __cpuinitdata =
        { 0x85, LVL_2,    2048 },       /* 8-way set assoc, 32 byte line size */
        { 0x86, LVL_2,     512 },       /* 4-way set assoc, 64 byte line size */
        { 0x87, LVL_2,    1024 },       /* 8-way set assoc, 64 byte line size */
+       { 0xd0, LVL_3,     512 },       /* 4-way set assoc, 64 byte line size */
+       { 0xd1, LVL_3,    1024 },       /* 4-way set assoc, 64 byte line size */
+       { 0xd2, LVL_3,    2048 },       /* 4-way set assoc, 64 byte line size */
+       { 0xd6, LVL_3,    1024 },       /* 8-way set assoc, 64 byte line size */
+       { 0xd7, LVL_3,    2038 },       /* 8-way set assoc, 64 byte line size */
+       { 0xd8, LVL_3,    4096 },       /* 12-way set assoc, 64 byte line size */
+       { 0xdc, LVL_3,    2048 },       /* 12-way set assoc, 64 byte line size */
+       { 0xdd, LVL_3,    4096 },       /* 12-way set assoc, 64 byte line size */
+       { 0xde, LVL_3,    8192 },       /* 12-way set assoc, 64 byte line size */
+       { 0xe2, LVL_3,    2048 },       /* 16-way set assoc, 64 byte line size */
+       { 0xe3, LVL_3,    4096 },       /* 16-way set assoc, 64 byte line size */
+       { 0xe4, LVL_3,    8192 },       /* 16-way set assoc, 64 byte line size */
        { 0x00, 0, 0}
 };
 
index 1c838032fd3732fde9bff776cbb63a2821115d60..fe79985ce0f2f6fb4ae23f3bc92a791994ed9f62 100644 (file)
@@ -295,11 +295,11 @@ void do_machine_check(struct pt_regs * regs, long error_code)
                 * If we know that the error was in user space, send a
                 * SIGBUS.  Otherwise, panic if tolerance is low.
                 *
-                * do_exit() takes an awful lot of locks and has a slight
+                * force_sig() takes an awful lot of locks and has a slight
                 * risk of deadlocking.
                 */
                if (user_space) {
-                       do_exit(SIGBUS);
+                       force_sig(SIGBUS, current);
                } else if (panic_on_oops || tolerant < 2) {
                        mce_panic("Uncorrected machine check",
                                &panicm, mcestart);
@@ -490,7 +490,7 @@ static void __cpuinit mce_cpu_quirks(struct cpuinfo_x86 *c)
 
 }
 
-static void __cpuinit mce_cpu_features(struct cpuinfo_x86 *c)
+static void mce_cpu_features(struct cpuinfo_x86 *c)
 {
        switch (c->x86_vendor) {
        case X86_VENDOR_INTEL:
@@ -734,6 +734,7 @@ __setup("mce=", mcheck_enable);
 static int mce_resume(struct sys_device *dev)
 {
        mce_init(NULL);
+       mce_cpu_features(&current_cpu_data);
        return 0;
 }
 
index 8ae8c4ff094d1910ad77ca398192b4f362731e59..f2ee0ae29bd6e00b7755ab0573deae02e17ae592 100644 (file)
@@ -121,7 +121,7 @@ static long threshold_restart_bank(void *_tr)
 }
 
 /* cpu init entry point, called from mce.c with preempt off */
-void __cpuinit mce_amd_feature_init(struct cpuinfo_x86 *c)
+void mce_amd_feature_init(struct cpuinfo_x86 *c)
 {
        unsigned int bank, block;
        unsigned int cpu = smp_processor_id();
index 4b48f251fd39ed540f99a2c91b6e7d66d93e1b56..f44c366243602b594566147a8447bfaa3d641013 100644 (file)
@@ -30,7 +30,7 @@ asmlinkage void smp_thermal_interrupt(void)
        irq_exit();
 }
 
-static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
+static void intel_init_thermal(struct cpuinfo_x86 *c)
 {
        u32 l, h;
        int tm2 = 0;
@@ -84,7 +84,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
        return;
 }
 
-void __cpuinit mce_intel_feature_init(struct cpuinfo_x86 *c)
+void mce_intel_feature_init(struct cpuinfo_x86 *c)
 {
        intel_init_thermal(c);
 }
index e28c7a987793cbd25c628c7568fc15ca2c8c39f5..a1346217e43c4d6cc636fa80ca70853970e64417 100644 (file)
@@ -346,6 +346,7 @@ ENTRY(save_args)
        popq_cfi %rax                   /* move return address... */
        mov %gs:pda_irqstackptr,%rsp
        EMPTY_FRAME 0
+       pushq_cfi %rbp                  /* backlink for unwinder */
        pushq_cfi %rax                  /* ... to the new stack */
        /*
         * We entered an interrupt context - irqs are off:
index 1b43086b097a8489a85adcd41a3336fb0cde4f88..231bdd3c5b1c710131dbdb2624f3f84cb8eeb6c8 100644 (file)
@@ -488,20 +488,21 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
         * ignore such a protection.
         */
        asm volatile(
-               "1: " _ASM_MOV " (%[parent_old]), %[old]\n"
-               "2: " _ASM_MOV " %[return_hooker], (%[parent_replaced])\n"
+               "1: " _ASM_MOV " (%[parent]), %[old]\n"
+               "2: " _ASM_MOV " %[return_hooker], (%[parent])\n"
                "   movl $0, %[faulted]\n"
+               "3:\n"
 
                ".section .fixup, \"ax\"\n"
-               "3: movl $1, %[faulted]\n"
+               "4: movl $1, %[faulted]\n"
+               "   jmp 3b\n"
                ".previous\n"
 
-               _ASM_EXTABLE(1b, 3b)
-               _ASM_EXTABLE(2b, 3b)
+               _ASM_EXTABLE(1b, 4b)
+               _ASM_EXTABLE(2b, 4b)
 
-               : [parent_replaced] "=r" (parent), [old] "=r" (old),
-                 [faulted] "=r" (faulted)
-               : [parent_old] "0" (parent), [return_hooker] "r" (return_hooker)
+               : [old] "=r" (old), [faulted] "=r" (faulted)
+               : [parent] "r" (parent), [return_hooker] "r" (return_hooker)
                : "memory"
        );
 
index 64d5ad0b8add85190ef600bb4f4887889729ef29..a00545fe5cdd1dae730fe18031b631bd1f57d8d5 100644 (file)
@@ -269,6 +269,8 @@ static void hpet_set_mode(enum clock_event_mode mode,
                now = hpet_readl(HPET_COUNTER);
                cmp = now + (unsigned long) delta;
                cfg = hpet_readl(HPET_Tn_CFG(timer));
+               /* Make sure we use edge triggered interrupts */
+               cfg &= ~HPET_TN_LEVEL;
                cfg |= HPET_TN_ENABLE | HPET_TN_PERIODIC |
                       HPET_TN_SETVAL | HPET_TN_32BIT;
                hpet_writel(cfg, HPET_Tn_CFG(timer));
@@ -897,13 +899,21 @@ static unsigned long hpet_rtc_flags;
 static int hpet_prev_update_sec;
 static struct rtc_time hpet_alarm_time;
 static unsigned long hpet_pie_count;
-static unsigned long hpet_t1_cmp;
+static u32 hpet_t1_cmp;
 static unsigned long hpet_default_delta;
 static unsigned long hpet_pie_delta;
 static unsigned long hpet_pie_limit;
 
 static rtc_irq_handler irq_handler;
 
+/*
+ * Check that the hpet counter c1 is ahead of the c2
+ */
+static inline int hpet_cnt_ahead(u32 c1, u32 c2)
+{
+       return (s32)(c2 - c1) < 0;
+}
+
 /*
  * Registers a IRQ handler.
  */
@@ -1075,7 +1085,7 @@ static void hpet_rtc_timer_reinit(void)
                hpet_t1_cmp += delta;
                hpet_writel(hpet_t1_cmp, HPET_T1_CMP);
                lost_ints++;
-       } while ((long)(hpet_readl(HPET_COUNTER) - hpet_t1_cmp) > 0);
+       } while (!hpet_cnt_ahead(hpet_t1_cmp, hpet_readl(HPET_COUNTER)));
 
        if (lost_ints) {
                if (hpet_rtc_flags & RTC_PIE)
index dbd6c1d1b638bcd739747e54eac08f639d304242..b42ca694dc68355550b174f1ef93167b27454c99 100644 (file)
@@ -28,10 +28,10 @@ static int i8237A_resume(struct sys_device *dev)
 
        flags = claim_dma_lock();
 
-       dma_outb(DMA1_RESET_REG, 0);
-       dma_outb(DMA2_RESET_REG, 0);
+       dma_outb(0, DMA1_RESET_REG);
+       dma_outb(0, DMA2_RESET_REG);
 
-       for (i = 0;i < 8;i++) {
+       for (i = 0; i < 8; i++) {
                set_dma_addr(i, 0x000000);
                /* DMA count is a bit weird so this is not 0 */
                set_dma_count(i, 1);
@@ -51,14 +51,14 @@ static int i8237A_suspend(struct sys_device *dev, pm_message_t state)
 }
 
 static struct sysdev_class i8237_sysdev_class = {
-       .name = "i8237",
-       .suspend = i8237A_suspend,
-       .resume = i8237A_resume,
+       .name           = "i8237",
+       .suspend        = i8237A_suspend,
+       .resume         = i8237A_resume,
 };
 
 static struct sys_device device_i8237A = {
-       .id     = 0,
-       .cls    = &i8237_sysdev_class,
+       .id             = 0,
+       .cls            = &i8237_sysdev_class,
 };
 
 static int __init i8237A_init_sysfs(void)
@@ -68,5 +68,4 @@ static int __init i8237A_init_sysfs(void)
                error = sysdev_register(&device_i8237A);
        return error;
 }
-
 device_initcall(i8237A_init_sysfs);
index 1c4a1302536c692dc935acecad4720dbe2395fa9..bc7ac4da90d745a04fc85026c5a6e3f1663263f9 100644 (file)
@@ -2528,14 +2528,15 @@ static void irq_complete_move(struct irq_desc **descp)
 
        vector = ~get_irq_regs()->orig_ax;
        me = smp_processor_id();
+
+       if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain)) {
 #ifdef CONFIG_NUMA_MIGRATE_IRQ_DESC
                *descp = desc = move_irq_desc(desc, me);
                /* get the new one */
                cfg = desc->chip_data;
 #endif
-
-       if (vector == cfg->vector && cpumask_test_cpu(me, cfg->domain))
                send_cleanup_vector(cfg);
+       }
 }
 #else
 static inline void irq_complete_move(struct irq_desc **descp) {}
@@ -3840,14 +3841,24 @@ int __init io_apic_get_redir_entries (int ioapic)
 
 void __init probe_nr_irqs_gsi(void)
 {
-       int idx;
        int nr = 0;
 
-       for (idx = 0; idx < nr_ioapics; idx++)
-               nr += io_apic_get_redir_entries(idx) + 1;
-
-       if (nr > nr_irqs_gsi)
+       nr = acpi_probe_gsi();
+       if (nr > nr_irqs_gsi) {
                nr_irqs_gsi = nr;
+       } else {
+               /* for acpi=off or acpi is not compiled in */
+               int idx;
+
+               nr = 0;
+               for (idx = 0; idx < nr_ioapics; idx++)
+                       nr += io_apic_get_redir_entries(idx) + 1;
+
+               if (nr > nr_irqs_gsi)
+                       nr_irqs_gsi = nr;
+       }
+
+       printk(KERN_DEBUG "nr_irqs_gsi: %d\n", nr_irqs_gsi);
 }
 
 /* --------------------------------------------------------------------------
index 1507ad4e674d253f93b60e8df9188bd17354a987..10a09c2f1828c102893d71a5add47ae320e2df55 100644 (file)
@@ -78,15 +78,6 @@ void __init init_ISA_irqs(void)
        }
 }
 
-/*
- * IRQ2 is cascade interrupt to second interrupt controller
- */
-static struct irqaction irq2 = {
-       .handler = no_action,
-       .mask = CPU_MASK_NONE,
-       .name = "cascade",
-};
-
 DEFINE_PER_CPU(vector_irq_t, vector_irq) = {
        [0 ... IRQ0_VECTOR - 1] = -1,
        [IRQ0_VECTOR] = 0,
@@ -178,9 +169,6 @@ void __init native_init_IRQ(void)
        alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
 #endif
 
-       if (!acpi_ioapic)
-               setup_irq(2, &irq2);
-
        /* setup after call gates are initialised (usually add in
         * the architecture specific gates)
         */
index 7a13fac63a1f11ccd8cfe2cf72160117a0477cd2..4006c522adc780a0ce016b43b2d5a7ae93ca0f14 100644 (file)
@@ -203,7 +203,7 @@ static void __init platform_detect(void)
 static void __init platform_detect(void)
 {
        /* stopgap until OFW support is added to the kernel */
-       olpc_platform_info.boardrev = 0xc2;
+       olpc_platform_info.boardrev = olpc_board(0xc2);
 }
 #endif
 
index e4c8fb608873797c381f825cc874c5a4e0506e1b..c6520a4e85d4fe3479070d03867bfd65e50dd081 100644 (file)
@@ -268,6 +268,32 @@ enum paravirt_lazy_mode paravirt_get_lazy_mode(void)
        return __get_cpu_var(paravirt_lazy_mode);
 }
 
+void arch_flush_lazy_mmu_mode(void)
+{
+       preempt_disable();
+
+       if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_MMU) {
+               WARN_ON(preempt_count() == 1);
+               arch_leave_lazy_mmu_mode();
+               arch_enter_lazy_mmu_mode();
+       }
+
+       preempt_enable();
+}
+
+void arch_flush_lazy_cpu_mode(void)
+{
+       preempt_disable();
+
+       if (paravirt_get_lazy_mode() == PARAVIRT_LAZY_CPU) {
+               WARN_ON(preempt_count() == 1);
+               arch_leave_lazy_cpu_mode();
+               arch_enter_lazy_cpu_mode();
+       }
+
+       preempt_enable();
+}
+
 struct pv_info pv_info = {
        .name = "bare hardware",
        .paravirt_enabled = 0,
index e68bb9e30864e50e764ce2581484f53aef0bfdda..6d12f7e37f8c1da5a465b110ff75ecae8c01f0c8 100644 (file)
@@ -180,6 +180,9 @@ void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
 
        trace_power_start(&it, POWER_CSTATE, (ax>>4)+1);
        if (!need_resched()) {
+               if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
+                       clflush((void *)&current_thread_info()->flags);
+
                __monitor((void *)&current_thread_info()->flags, 0, 0);
                smp_mb();
                if (!need_resched())
@@ -194,6 +197,9 @@ static void mwait_idle(void)
        struct power_trace it;
        if (!need_resched()) {
                trace_power_start(&it, POWER_CSTATE, 1);
+               if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
+                       clflush((void *)&current_thread_info()->flags);
+
                __monitor((void *)&current_thread_info()->flags, 0, 0);
                smp_mb();
                if (!need_resched())
index a546f55c77b4639f5e3f5773a1599d81cc53432d..bd4da2af08aec72ff1933eea7164a2b3d8f73139 100644 (file)
@@ -104,9 +104,6 @@ void cpu_idle(void)
                        check_pgt_cache();
                        rmb();
 
-                       if (rcu_pending(cpu))
-                               rcu_check_callbacks(cpu, 0);
-
                        if (cpu_is_offline(cpu))
                                play_dead();
 
index 416fb9282f4fc73b666586d1964ca277f14f44cc..85b4cb5c1980f7e089f1f731fb51c6a680ed7623 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/uaccess.h>
 #include <linux/io.h>
 #include <linux/ftrace.h>
+#include <linux/dmi.h>
 
 #include <asm/pgtable.h>
 #include <asm/system.h>
@@ -151,14 +152,18 @@ void __show_regs(struct pt_regs *regs, int all)
        unsigned long d0, d1, d2, d3, d6, d7;
        unsigned int fsindex, gsindex;
        unsigned int ds, cs, es;
+       const char *board;
 
        printk("\n");
        print_modules();
-       printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s\n",
+       board = dmi_get_system_info(DMI_PRODUCT_NAME);
+       if (!board)
+               board = "";
+       printk(KERN_INFO "Pid: %d, comm: %.20s %s %s %.*s %s\n",
                current->pid, current->comm, print_tainted(),
                init_utsname()->release,
                (int)strcspn(init_utsname()->version, " "),
-               init_utsname()->version);
+               init_utsname()->version, board);
        printk(KERN_INFO "RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->ip);
        printk_address(regs->ip, 1);
        printk(KERN_INFO "RSP: %04lx:%016lx  EFLAGS: %08lx\n", regs->ss,
index 0a5df5f82fb9579b1be4e824aa499ac561d9ba10..5a4c23d898926149e65b8cb5d826b7e868f4a527 100644 (file)
@@ -810,12 +810,16 @@ static void ptrace_bts_untrace(struct task_struct *child)
 
 static void ptrace_bts_detach(struct task_struct *child)
 {
-       if (unlikely(child->bts)) {
-               ds_release_bts(child->bts);
-               child->bts = NULL;
-
-               ptrace_bts_free_buffer(child);
-       }
+       /*
+        * Ptrace_detach() races with ptrace_untrace() in case
+        * the child dies and is reaped by another thread.
+        *
+        * We only do the memory accounting at this point and
+        * leave the buffer deallocation and the bts tracer
+        * release to ptrace_bts_untrace() which will be called
+        * later on with tasklist_lock held.
+        */
+       release_locked_buffer(child->bts_buffer, child->bts_size);
 }
 #else
 static inline void ptrace_bts_fork(struct task_struct *tsk) {}
index ae0d8042cf69527542b4e554d4567eea154eff45..c461f6d6907487cd60211e06b115ac1be76dd697 100644 (file)
@@ -607,7 +607,7 @@ struct x86_quirks *x86_quirks __initdata = &default_x86_quirks;
 static int __init dmi_low_memory_corruption(const struct dmi_system_id *d)
 {
        printk(KERN_NOTICE
-               "%s detected: BIOS may corrupt low RAM, working it around.\n",
+               "%s detected: BIOS may corrupt low RAM, working around it.\n",
                d->ident);
 
        e820_update_range(0, 0x10000, E820_RAM, E820_RESERVED);
index e6e695acd725739a645b5664f83a8356ff5b13a7..241ec3923f611bf03cb266362409924daabf1f6f 100644 (file)
@@ -115,7 +115,7 @@ unsigned long __init calibrate_cpu(void)
 
 static struct irqaction irq0 = {
        .handler        = timer_interrupt,
-       .flags          = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING,
+       .flags          = IRQF_DISABLED | IRQF_IRQPOLL | IRQF_NOBALANCING | IRQF_TIMER,
        .mask           = CPU_MASK_NONE,
        .name           = "timer"
 };
index 98c2d055284b32fb2ce6ff6776b9cb049c103ae0..a9e7548e17906f885f28e4763128e749c7a76481 100644 (file)
@@ -99,6 +99,12 @@ static inline void preempt_conditional_sti(struct pt_regs *regs)
                local_irq_enable();
 }
 
+static inline void conditional_cli(struct pt_regs *regs)
+{
+       if (regs->flags & X86_EFLAGS_IF)
+               local_irq_disable();
+}
+
 static inline void preempt_conditional_cli(struct pt_regs *regs)
 {
        if (regs->flags & X86_EFLAGS_IF)
@@ -626,8 +632,10 @@ clear_dr7:
 
 #ifdef CONFIG_X86_32
 debug_vm86:
+       /* reenable preemption: handle_vm86_trap() might sleep */
+       dec_preempt_count();
        handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1);
-       preempt_conditional_cli(regs);
+       conditional_cli(regs);
        return;
 #endif
 
@@ -896,7 +904,7 @@ asmlinkage void math_state_restore(void)
 EXPORT_SYMBOL_GPL(math_state_restore);
 
 #ifndef CONFIG_MATH_EMULATION
-asmlinkage void math_emulate(long arg)
+void math_emulate(struct math_emu_info *info)
 {
        printk(KERN_EMERG
                "math-emulation not enabled and no coprocessor found.\n");
@@ -906,16 +914,19 @@ asmlinkage void math_emulate(long arg)
 }
 #endif /* CONFIG_MATH_EMULATION */
 
-dotraplinkage void __kprobes
-do_device_not_available(struct pt_regs *regs, long error)
+dotraplinkage void __kprobes do_device_not_available(struct pt_regs regs)
 {
 #ifdef CONFIG_X86_32
        if (read_cr0() & X86_CR0_EM) {
-               conditional_sti(regs);
-               math_emulate(0);
+               struct math_emu_info info = { };
+
+               conditional_sti(&regs);
+
+               info.regs = &regs;
+               math_emulate(&info);
        } else {
                math_state_restore(); /* interrupts still off */
-               conditional_sti(regs);
+               conditional_sti(&regs);
        }
 #else
        math_state_restore();
index 1d3302cc2ddf65cc5d03d72940726345e03d51c7..bef58b4982dbc449696b624e24318cdf5b773926 100644 (file)
@@ -320,6 +320,16 @@ static void vmi_release_pmd(unsigned long pfn)
        vmi_ops.release_page(pfn, VMI_PAGE_L2);
 }
 
+/*
+ * We use the pgd_free hook for releasing the pgd page:
+ */
+static void vmi_pgd_free(struct mm_struct *mm, pgd_t *pgd)
+{
+       unsigned long pfn = __pa(pgd) >> PAGE_SHIFT;
+
+       vmi_ops.release_page(pfn, VMI_PAGE_L2);
+}
+
 /*
  * Helper macros for MMU update flags.  We can defer updates until a flush
  * or page invalidation only if the update is to the current address space
@@ -762,6 +772,7 @@ static inline int __init activate_vmi(void)
        if (vmi_ops.release_page) {
                pv_mmu_ops.release_pte = vmi_release_pte;
                pv_mmu_ops.release_pmd = vmi_release_pmd;
+               pv_mmu_ops.pgd_free = vmi_pgd_free;
        }
 
        /* Set linear is needed in all cases */
index c4c1f9e094027089373189f7e57cb7ede8149be9..e5b088fffa40f56f1418179efcd89ba480bcae6d 100644 (file)
@@ -202,7 +202,7 @@ static irqreturn_t vmi_timer_interrupt(int irq, void *dev_id)
 static struct irqaction vmi_clock_action  = {
        .name           = "vmi-timer",
        .handler        = vmi_timer_interrupt,
-       .flags          = IRQF_DISABLED | IRQF_NOBALANCING,
+       .flags          = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_TIMER,
        .mask           = CPU_MASK_ALL,
 };
 
@@ -283,10 +283,13 @@ void __devinit vmi_time_ap_init(void)
 #endif
 
 /** vmi clocksource */
+static struct clocksource clocksource_vmi;
 
 static cycle_t read_real_cycles(void)
 {
-       return vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
+       cycle_t ret = (cycle_t)vmi_timer_ops.get_cycle_counter(VMI_CYCLES_REAL);
+       return ret >= clocksource_vmi.cycle_last ?
+               ret : clocksource_vmi.cycle_last;
 }
 
 static struct clocksource clocksource_vmi = {
index e665d1c623ca04f45444daf5324e6c6d6477612d..72bd275a9b5cee632b393448e325f371610f860b 100644 (file)
@@ -207,7 +207,7 @@ static int __pit_timer_fn(struct kvm_kpit_state *ps)
        hrtimer_add_expires_ns(&pt->timer, pt->period);
        pt->scheduled = hrtimer_get_expires_ns(&pt->timer);
        if (pt->period)
-               ps->channels[0].count_load_time = hrtimer_get_expires(&pt->timer);
+               ps->channels[0].count_load_time = ktime_get();
 
        return (pt->period == 0 ? 0 : 1);
 }
index c019b8edcdb76bab269ceb48f8bc96e02fae7817..cf17ed52f6fbbe33563668604df0fa814f3cf493 100644 (file)
@@ -87,13 +87,6 @@ void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
 }
 EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs);
 
-void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec)
-{
-       kvm_apic_timer_intr_post(vcpu, vec);
-       /* TODO: PIT, RTC etc. */
-}
-EXPORT_SYMBOL_GPL(kvm_timer_intr_post);
-
 void __kvm_migrate_timers(struct kvm_vcpu *vcpu)
 {
        __kvm_migrate_apic_timer(vcpu);
index 2bf32a03ceecf5837f6e30ef99b80067423632da..82579ee538d08b257f2a53a230cfb9cbf1a51986 100644 (file)
@@ -89,7 +89,6 @@ static inline int irqchip_in_kernel(struct kvm *kvm)
 
 void kvm_pic_reset(struct kvm_kpic_state *s);
 
-void kvm_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
 void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu);
 void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu);
 void kvm_apic_nmi_wd_deliver(struct kvm_vcpu *vcpu);
index afac68c0815c78e712edc789821029d05b1d2d2f..f0b67f2cdd695a71c636ddfbe45b9ec9248b0748 100644 (file)
 #include "kvm_cache_regs.h"
 #include "irq.h"
 
+#ifndef CONFIG_X86_64
+#define mod_64(x, y) ((x) - (y) * div64_u64(x, y))
+#else
+#define mod_64(x, y) ((x) % (y))
+#endif
+
 #define PRId64 "d"
 #define PRIx64 "llx"
 #define PRIu64 "u"
@@ -511,52 +517,22 @@ static void apic_send_ipi(struct kvm_lapic *apic)
 
 static u32 apic_get_tmcct(struct kvm_lapic *apic)
 {
-       u64 counter_passed;
-       ktime_t passed, now;
+       ktime_t remaining;
+       s64 ns;
        u32 tmcct;
 
        ASSERT(apic != NULL);
 
-       now = apic->timer.dev.base->get_time();
-       tmcct = apic_get_reg(apic, APIC_TMICT);
-
        /* if initial count is 0, current count should also be 0 */
-       if (tmcct == 0)
+       if (apic_get_reg(apic, APIC_TMICT) == 0)
                return 0;
 
-       if (unlikely(ktime_to_ns(now) <=
-               ktime_to_ns(apic->timer.last_update))) {
-               /* Wrap around */
-               passed = ktime_add(( {
-                                   (ktime_t) {
-                                   .tv64 = KTIME_MAX -
-                                   (apic->timer.last_update).tv64}; }
-                                  ), now);
-               apic_debug("time elapsed\n");
-       } else
-               passed = ktime_sub(now, apic->timer.last_update);
-
-       counter_passed = div64_u64(ktime_to_ns(passed),
-                                  (APIC_BUS_CYCLE_NS * apic->timer.divide_count));
-
-       if (counter_passed > tmcct) {
-               if (unlikely(!apic_lvtt_period(apic))) {
-                       /* one-shot timers stick at 0 until reset */
-                       tmcct = 0;
-               } else {
-                       /*
-                        * periodic timers reset to APIC_TMICT when they
-                        * hit 0. The while loop simulates this happening N
-                        * times. (counter_passed %= tmcct) would also work,
-                        * but might be slower or not work on 32-bit??
-                        */
-                       while (counter_passed > tmcct)
-                               counter_passed -= tmcct;
-                       tmcct -= counter_passed;
-               }
-       } else {
-               tmcct -= counter_passed;
-       }
+       remaining = hrtimer_expires_remaining(&apic->timer.dev);
+       if (ktime_to_ns(remaining) < 0)
+               remaining = ktime_set(0, 0);
+
+       ns = mod_64(ktime_to_ns(remaining), apic->timer.period);
+       tmcct = div64_u64(ns, (APIC_BUS_CYCLE_NS * apic->timer.divide_count));
 
        return tmcct;
 }
@@ -653,8 +629,6 @@ static void start_apic_timer(struct kvm_lapic *apic)
 {
        ktime_t now = apic->timer.dev.base->get_time();
 
-       apic->timer.last_update = now;
-
        apic->timer.period = apic_get_reg(apic, APIC_TMICT) *
                    APIC_BUS_CYCLE_NS * apic->timer.divide_count;
        atomic_set(&apic->timer.pending, 0);
@@ -1110,16 +1084,6 @@ void kvm_inject_apic_timer_irqs(struct kvm_vcpu *vcpu)
        }
 }
 
-void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec)
-{
-       struct kvm_lapic *apic = vcpu->arch.apic;
-
-       if (apic && apic_lvt_vector(apic, APIC_LVTT) == vec)
-               apic->timer.last_update = ktime_add_ns(
-                               apic->timer.last_update,
-                               apic->timer.period);
-}
-
 int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)
 {
        int vector = kvm_apic_has_interrupt(vcpu);
index 81858881287e6962c4ab4863191f8e71cfef7a1b..45ab6ee71209f586596447c0b1ad02feca125698 100644 (file)
@@ -12,7 +12,6 @@ struct kvm_lapic {
                atomic_t pending;
                s64 period;     /* unit: ns */
                u32 divide_count;
-               ktime_t last_update;
                struct hrtimer dev;
        } timer;
        struct kvm_vcpu *vcpu;
@@ -42,7 +41,6 @@ void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data);
 void kvm_apic_post_state_restore(struct kvm_vcpu *vcpu);
 int kvm_lapic_enabled(struct kvm_vcpu *vcpu);
 int kvm_lapic_find_highest_irr(struct kvm_vcpu *vcpu);
-void kvm_apic_timer_intr_post(struct kvm_vcpu *vcpu, int vec);
 
 void kvm_lapic_set_vapic_addr(struct kvm_vcpu *vcpu, gpa_t vapic_addr);
 void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu);
index 83f11c7474a1d74ef996ca7245078e1b6dda7051..2d4477c7147372c28ed84f5a513ca553dc46979c 100644 (file)
@@ -1698,8 +1698,13 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte,
        if (largepage)
                spte |= PT_PAGE_SIZE_MASK;
        if (mt_mask) {
-               mt_mask = get_memory_type(vcpu, gfn) <<
-                         kvm_x86_ops->get_mt_mask_shift();
+               if (!kvm_is_mmio_pfn(pfn)) {
+                       mt_mask = get_memory_type(vcpu, gfn) <<
+                               kvm_x86_ops->get_mt_mask_shift();
+                       mt_mask |= VMX_EPT_IGMT_BIT;
+               } else
+                       mt_mask = MTRR_TYPE_UNCACHABLE <<
+                               kvm_x86_ops->get_mt_mask_shift();
                spte |= mt_mask;
        }
 
index 1452851ae2583b689f250a403ce6ee08075144c8..a9e769e4e2513b552d1a035884959a8a5280c84d 100644 (file)
@@ -1600,7 +1600,6 @@ static void svm_intr_assist(struct kvm_vcpu *vcpu)
        /* Okay, we can deliver the interrupt: grab it and update PIC state. */
        intr_vector = kvm_cpu_get_interrupt(vcpu);
        svm_inject_irq(svm, intr_vector);
-       kvm_timer_intr_post(vcpu, intr_vector);
 out:
        update_cr8_intercept(vcpu);
 }
index 6259d7467648e1209456abff3666ad9a4e4a3cb4..7611af576829d820eba8de4a79d389e8baef7759 100644 (file)
@@ -903,6 +903,7 @@ static int vmx_get_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata)
                data = vmcs_readl(GUEST_SYSENTER_ESP);
                break;
        default:
+               vmx_load_host_state(to_vmx(vcpu));
                msr = find_msr_entry(to_vmx(vcpu), msr_index);
                if (msr) {
                        data = msr->data;
@@ -3285,7 +3286,6 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu)
        }
        if (vcpu->arch.interrupt.pending) {
                vmx_inject_irq(vcpu, vcpu->arch.interrupt.nr);
-               kvm_timer_intr_post(vcpu, vcpu->arch.interrupt.nr);
                if (kvm_cpu_has_interrupt(vcpu))
                        enable_irq_window(vcpu);
        }
@@ -3687,8 +3687,7 @@ static int __init vmx_init(void)
        if (vm_need_ept()) {
                bypass_guest_pf = 0;
                kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
-                       VMX_EPT_WRITABLE_MASK |
-                       VMX_EPT_IGMT_BIT);
+                       VMX_EPT_WRITABLE_MASK);
                kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull,
                                VMX_EPT_EXECUTABLE_MASK,
                                VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
index cc17546a2406af860329ea28d1ae85b7ebb4aa23..758b7a155ae9113559b5993b38abfc3cf603fe70 100644 (file)
@@ -967,7 +967,6 @@ int kvm_dev_ioctl_check_extension(long ext)
        case KVM_CAP_MMU_SHADOW_CACHE_CONTROL:
        case KVM_CAP_SET_TSS_ADDR:
        case KVM_CAP_EXT_CPUID:
-       case KVM_CAP_CLOCKSOURCE:
        case KVM_CAP_PIT:
        case KVM_CAP_NOP_IO_DELAY:
        case KVM_CAP_MP_STATE:
@@ -992,6 +991,9 @@ int kvm_dev_ioctl_check_extension(long ext)
        case KVM_CAP_IOMMU:
                r = iommu_found();
                break;
+       case KVM_CAP_CLOCKSOURCE:
+               r = boot_cpu_has(X86_FEATURE_CONSTANT_TSC);
+               break;
        default:
                r = 0;
                break;
@@ -4127,9 +4129,13 @@ static void kvm_free_vcpus(struct kvm *kvm)
 
 }
 
-void kvm_arch_destroy_vm(struct kvm *kvm)
+void kvm_arch_sync_events(struct kvm *kvm)
 {
        kvm_free_all_assigned_devices(kvm);
+}
+
+void kvm_arch_destroy_vm(struct kvm *kvm)
+{
        kvm_iommu_unmap_guest(kvm);
        kvm_free_pit(kvm);
        kfree(kvm->arch.vpic);
index df167f2656228c83eb58ce2ebd4600074d766e77..50b5918711289a175287e0c8fb3b39f4c85a541e 100644 (file)
@@ -38,6 +38,15 @@ void __init pre_intr_init_hook(void)
        init_ISA_irqs();
 }
 
+/*
+ * IRQ2 is cascade interrupt to second interrupt controller
+ */
+static struct irqaction irq2 = {
+       .handler = no_action,
+       .mask = CPU_MASK_NONE,
+       .name = "cascade",
+};
+
 /**
  * intr_init_hook - post gate setup interrupt initialisation
  *
@@ -53,6 +62,9 @@ void __init intr_init_hook(void)
                if (x86_quirks->arch_intr_init())
                        return;
        }
+       if (!acpi_ioapic)
+               setup_irq(2, &irq2);
+
 }
 
 /**
@@ -84,7 +96,7 @@ void __init trap_init_hook(void)
 
 static struct irqaction irq0  = {
        .handler = timer_interrupt,
-       .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
+       .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
        .mask = CPU_MASK_NONE,
        .name = "timer"
 };
index a580b9562e76cc078ab3fd0b2b90c722d10fdf01..8e5118371f0fac1cb3ff2e90d87e0c038c484aed 100644 (file)
@@ -33,20 +33,30 @@ void __init intr_init_hook(void)
        setup_irq(2, &irq2);
 }
 
-void __init pre_setup_arch_hook(void)
+static void voyager_disable_tsc(void)
 {
        /* Voyagers run their CPUs from independent clocks, so disable
         * the TSC code because we can't sync them */
        setup_clear_cpu_cap(X86_FEATURE_TSC);
 }
 
+void __init pre_setup_arch_hook(void)
+{
+       voyager_disable_tsc();
+}
+
+void __init pre_time_init_hook(void)
+{
+       voyager_disable_tsc();
+}
+
 void __init trap_init_hook(void)
 {
 }
 
 static struct irqaction irq0 = {
        .handler = timer_interrupt,
-       .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL,
+       .flags = IRQF_DISABLED | IRQF_NOBALANCING | IRQF_IRQPOLL | IRQF_TIMER,
        .mask = CPU_MASK_NONE,
        .name = "timer"
 };
index 9840b7ec749a00dfc7a906e8a9045b76d545650d..7ffcdeec4631fa7b1adf54ec2bbbd71ee98402ba 100644 (file)
@@ -81,7 +81,7 @@ static void enable_local_vic_irq(unsigned int irq);
 static void disable_local_vic_irq(unsigned int irq);
 static void before_handle_vic_irq(unsigned int irq);
 static void after_handle_vic_irq(unsigned int irq);
-static void set_vic_irq_affinity(unsigned int irq, cpumask_t mask);
+static void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask);
 static void ack_vic_irq(unsigned int irq);
 static void vic_enable_cpi(void);
 static void do_boot_cpu(__u8 cpuid);
@@ -211,8 +211,6 @@ static __u32 cpu_booted_map;
 static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
 
 /* This is for the new dynamic CPU boot code */
-cpumask_t cpu_callin_map = CPU_MASK_NONE;
-cpumask_t cpu_callout_map = CPU_MASK_NONE;
 
 /* The per processor IRQ masks (these are usually kept in sync) */
 static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned;
@@ -378,7 +376,7 @@ void __init find_smp_config(void)
        cpus_addr(phys_cpu_present_map)[0] |=
            voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
                                       3) << 24;
-       cpu_possible_map = phys_cpu_present_map;
+       init_cpu_possible(&phys_cpu_present_map);
        printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n",
               cpus_addr(phys_cpu_present_map)[0]);
        /* Here we set up the VIC to enable SMP */
@@ -1599,16 +1597,16 @@ static void after_handle_vic_irq(unsigned int irq)
  * change the mask and then do an interrupt enable CPI to re-enable on
  * the selected processors */
 
-void set_vic_irq_affinity(unsigned int irq, cpumask_t mask)
+void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask)
 {
        /* Only extended processors handle interrupts */
        unsigned long real_mask;
        unsigned long irq_mask = 1 << irq;
        int cpu;
 
-       real_mask = cpus_addr(mask)[0] & voyager_extended_vic_processors;
+       real_mask = cpus_addr(*mask)[0] & voyager_extended_vic_processors;
 
-       if (cpus_addr(mask)[0] == 0)
+       if (cpus_addr(*mask)[0] == 0)
                /* can't have no CPUs to accept the interrupt -- extremely
                 * bad things will happen */
                return;
@@ -1750,10 +1748,11 @@ static void __cpuinit voyager_smp_prepare_boot_cpu(void)
        init_gdt(smp_processor_id());
        switch_to_new_gdt();
 
-       cpu_set(smp_processor_id(), cpu_online_map);
-       cpu_set(smp_processor_id(), cpu_callout_map);
-       cpu_set(smp_processor_id(), cpu_possible_map);
-       cpu_set(smp_processor_id(), cpu_present_map);
+       cpu_online_map = cpumask_of_cpu(smp_processor_id());
+       cpu_callout_map = cpumask_of_cpu(smp_processor_id());
+       cpu_callin_map = CPU_MASK_NONE;
+       cpu_present_map = cpumask_of_cpu(smp_processor_id());
+
 }
 
 static int __cpuinit voyager_cpu_up(unsigned int cpu)
@@ -1783,9 +1782,9 @@ void __init smp_setup_processor_id(void)
        x86_write_percpu(cpu_number, hard_smp_processor_id());
 }
 
-static void voyager_send_call_func(cpumask_t callmask)
+static void voyager_send_call_func(const struct cpumask *callmask)
 {
-       __u32 mask = cpus_addr(callmask)[0] & ~(1 << smp_processor_id());
+       __u32 mask = cpus_addr(*callmask)[0] & ~(1 << smp_processor_id());
        send_CPI(mask, VIC_CALL_FUNCTION_CPI);
 }
 
index c7b06feb139b9af7077a3c3ff8d15c4534a29368..5d87f586f8d7242cc48c41265a90ab67069a7800 100644 (file)
@@ -131,7 +131,7 @@ u_char emulating = 0;
 static int valid_prefix(u_char *Byte, u_char __user ** fpu_eip,
                        overrides * override);
 
-asmlinkage void math_emulate(long arg)
+void math_emulate(struct math_emu_info *info)
 {
        u_char FPU_modrm, byte1;
        unsigned short code;
@@ -161,7 +161,7 @@ asmlinkage void math_emulate(long arg)
        RE_ENTRANT_CHECK_ON;
 #endif /* RE_ENTRANT_CHECKING */
 
-       SETUP_DATA_AREA(arg);
+       FPU_info = info;
 
        FPU_ORIG_EIP = FPU_EIP;
 
@@ -659,7 +659,7 @@ static int valid_prefix(u_char *Byte, u_char __user **fpu_eip,
        }
 }
 
-void math_abort(struct info *info, unsigned int signal)
+void math_abort(struct math_emu_info *info, unsigned int signal)
 {
        FPU_EIP = FPU_ORIG_EIP;
        current->thread.trap_no = 16;
index aa49b6a0d850c616d1f257c563d8ad92ab255d95..9779df436b7d8c70ed8e5249f508c97f098a6c1b 100644 (file)
@@ -51,8 +51,8 @@ extern void ffreep(void);
 extern void fst_i_(void);
 extern void fstp_i(void);
 /* fpu_entry.c */
-asmlinkage extern void math_emulate(long arg);
-extern void math_abort(struct info *info, unsigned int signal);
+extern void math_emulate(struct math_emu_info *info);
+extern void math_abort(struct math_emu_info *info, unsigned int signal);
 /* fpu_etc.c */
 extern void FPU_etc(void);
 /* fpu_tags.c */
index 13488fa153e0c81dacc9370edc1f0a2128d0babd..50fa0ec2c8a5f87a463a14164cf365291627a532 100644 (file)
 #include <linux/kernel.h>
 #include <linux/mm.h>
 
-/* This sets the pointer FPU_info to point to the argument part
-   of the stack frame of math_emulate() */
-#define SETUP_DATA_AREA(arg)   FPU_info = (struct info *) &arg
-
 /* s is always from a cpu register, and the cpu does bounds checking
  * during register load --> no further bounds checks needed */
 #define LDT_DESCRIPTOR(s)      (((struct desc_struct *)current->mm->context.ldt)[(s) >> 3])
 #define I387                   (current->thread.xstate)
 #define FPU_info               (I387->soft.info)
 
-#define FPU_CS                 (*(unsigned short *) &(FPU_info->___cs))
-#define FPU_SS                 (*(unsigned short *) &(FPU_info->___ss))
-#define FPU_DS                 (*(unsigned short *) &(FPU_info->___ds))
-#define FPU_EAX                        (FPU_info->___eax)
-#define FPU_EFLAGS             (FPU_info->___eflags)
-#define FPU_EIP                        (FPU_info->___eip)
+#define FPU_CS                 (*(unsigned short *) &(FPU_info->regs->cs))
+#define FPU_SS                 (*(unsigned short *) &(FPU_info->regs->ss))
+#define FPU_DS                 (*(unsigned short *) &(FPU_info->regs->ds))
+#define FPU_EAX                        (FPU_info->regs->ax)
+#define FPU_EFLAGS             (FPU_info->regs->flags)
+#define FPU_EIP                        (FPU_info->regs->ip)
 #define FPU_ORIG_EIP           (FPU_info->___orig_eip)
 
 #define FPU_lookahead           (I387->soft.lookahead)
index d701e2b39e4438aacb8fc22ff000e79083f3bcec..420b3b6e39152d86d1c81e4e6ab69f65dbc69cbf 100644 (file)
 #define FPU_WRITE_BIT 0x10
 
 static int reg_offset[] = {
-       offsetof(struct info, ___eax),
-       offsetof(struct info, ___ecx),
-       offsetof(struct info, ___edx),
-       offsetof(struct info, ___ebx),
-       offsetof(struct info, ___esp),
-       offsetof(struct info, ___ebp),
-       offsetof(struct info, ___esi),
-       offsetof(struct info, ___edi)
+       offsetof(struct pt_regs, ax),
+       offsetof(struct pt_regs, cx),
+       offsetof(struct pt_regs, dx),
+       offsetof(struct pt_regs, bx),
+       offsetof(struct pt_regs, sp),
+       offsetof(struct pt_regs, bp),
+       offsetof(struct pt_regs, si),
+       offsetof(struct pt_regs, di)
 };
 
-#define REG_(x) (*(long *)(reg_offset[(x)]+(u_char *) FPU_info))
+#define REG_(x) (*(long *)(reg_offset[(x)] + (u_char *)FPU_info->regs))
 
 static int reg_offset_vm86[] = {
-       offsetof(struct info, ___cs),
-       offsetof(struct info, ___vm86_ds),
-       offsetof(struct info, ___vm86_es),
-       offsetof(struct info, ___vm86_fs),
-       offsetof(struct info, ___vm86_gs),
-       offsetof(struct info, ___ss),
-       offsetof(struct info, ___vm86_ds)
+       offsetof(struct pt_regs, cs),
+       offsetof(struct kernel_vm86_regs, ds),
+       offsetof(struct kernel_vm86_regs, es),
+       offsetof(struct kernel_vm86_regs, fs),
+       offsetof(struct kernel_vm86_regs, gs),
+       offsetof(struct pt_regs, ss),
+       offsetof(struct kernel_vm86_regs, ds)
 };
 
 #define VM86_REG_(x) (*(unsigned short *) \
-                     (reg_offset_vm86[((unsigned)x)]+(u_char *) FPU_info))
-
-/* This dummy, gs is not saved on the stack. */
-#define ___GS ___ds
+               (reg_offset_vm86[((unsigned)x)] + (u_char *)FPU_info->regs))
 
 static int reg_offset_pm[] = {
-       offsetof(struct info, ___cs),
-       offsetof(struct info, ___ds),
-       offsetof(struct info, ___es),
-       offsetof(struct info, ___fs),
-       offsetof(struct info, ___GS),
-       offsetof(struct info, ___ss),
-       offsetof(struct info, ___ds)
+       offsetof(struct pt_regs, cs),
+       offsetof(struct pt_regs, ds),
+       offsetof(struct pt_regs, es),
+       offsetof(struct pt_regs, fs),
+       offsetof(struct pt_regs, ds),   /* dummy, not saved on stack */
+       offsetof(struct pt_regs, ss),
+       offsetof(struct pt_regs, ds)
 };
 
 #define PM_REG_(x) (*(unsigned short *) \
-                     (reg_offset_pm[((unsigned)x)]+(u_char *) FPU_info))
+               (reg_offset_pm[((unsigned)x)] + (u_char *)FPU_info->regs))
 
 /* Decode the SIB byte. This function assumes mod != 0 */
 static int sib(int mod, unsigned long *fpu_eip)
@@ -349,34 +346,34 @@ void __user *FPU_get_address_16(u_char FPU_modrm, unsigned long *fpu_eip,
        }
        switch (rm) {
        case 0:
-               address += FPU_info->___ebx + FPU_info->___esi;
+               address += FPU_info->regs->bx + FPU_info->regs->si;
                break;
        case 1:
-               address += FPU_info->___ebx + FPU_info->___edi;
+               address += FPU_info->regs->bx + FPU_info->regs->di;
                break;
        case 2:
-               address += FPU_info->___ebp + FPU_info->___esi;
+               address += FPU_info->regs->bp + FPU_info->regs->si;
                if (addr_modes.override.segment == PREFIX_DEFAULT)
                        addr_modes.override.segment = PREFIX_SS_;
                break;
        case 3:
-               address += FPU_info->___ebp + FPU_info->___edi;
+               address += FPU_info->regs->bp + FPU_info->regs->di;
                if (addr_modes.override.segment == PREFIX_DEFAULT)
                        addr_modes.override.segment = PREFIX_SS_;
                break;
        case 4:
-               address += FPU_info->___esi;
+               address += FPU_info->regs->si;
                break;
        case 5:
-               address += FPU_info->___edi;
+               address += FPU_info->regs->di;
                break;
        case 6:
-               address += FPU_info->___ebp;
+               address += FPU_info->regs->bp;
                if (addr_modes.override.segment == PREFIX_DEFAULT)
                        addr_modes.override.segment = PREFIX_SS_;
                break;
        case 7:
-               address += FPU_info->___ebx;
+               address += FPU_info->regs->bx;
                break;
        }
 
index 90dfae511a41e1dcf7fcf188b94d13c123780606..c76ef1d701c9f48625aed06d4e7b4ec3d98e8862 100644 (file)
@@ -603,8 +603,6 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
 
        si_code = SEGV_MAPERR;
 
-       if (notify_page_fault(regs))
-               return;
        if (unlikely(kmmio_fault(regs, address)))
                return;
 
@@ -634,6 +632,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
                if (spurious_fault(address, error_code))
                        return;
 
+               /* kprobes don't want to hook the spurious faults. */
+               if (notify_page_fault(regs))
+                       return;
                /*
                 * Don't take the mm semaphore here. If we fixup a prefetch
                 * fault we could otherwise deadlock.
@@ -641,6 +642,9 @@ void __kprobes do_page_fault(struct pt_regs *regs, unsigned long error_code)
                goto bad_area_nosemaphore;
        }
 
+       /* kprobes don't want to hook the spurious faults. */
+       if (notify_page_fault(regs))
+               return;
 
        /*
         * It's safe to allow irq's after cr2 has been saved and the
index af750ab973b6943840e9de53e4716819da06c4a2..f45d5e29a72edf4e15616d48c0d174f7905ac417 100644 (file)
@@ -134,25 +134,6 @@ int page_is_ram(unsigned long pagenr)
        return 0;
 }
 
-int pagerange_is_ram(unsigned long start, unsigned long end)
-{
-       int ram_page = 0, not_rampage = 0;
-       unsigned long page_nr;
-
-       for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT);
-            ++page_nr) {
-               if (page_is_ram(page_nr))
-                       ram_page = 1;
-               else
-                       not_rampage = 1;
-
-               if (ram_page == not_rampage)
-                       return -1;
-       }
-
-       return ram_page;
-}
-
 /*
  * Fix up the linear direct mapping of the kernel to avoid cache attribute
  * conflicts.
index 71a14f89f89e7367c72f2de85da6708acc83c069..f3516da035d141947d04ddfbd61bd56f74623fd3 100644 (file)
@@ -145,7 +145,7 @@ int __init compute_hash_shift(struct bootnode *nodes, int numnodes,
        return shift;
 }
 
-int early_pfn_to_nid(unsigned long pfn)
+int __meminit  __early_pfn_to_nid(unsigned long pfn)
 {
        return phys_to_nid(pfn << PAGE_SHIFT);
 }
index 84ba74820ad6436479a6456ec8d8e3a9a3c5c591..7be47d1a97e463590fe0565e72f36499d95949b5 100644 (file)
@@ -508,18 +508,13 @@ static int split_large_page(pte_t *kpte, unsigned long address)
 #endif
 
        /*
-        * Install the new, split up pagetable. Important details here:
+        * Install the new, split up pagetable.
         *
-        * On Intel the NX bit of all levels must be cleared to make a
-        * page executable. See section 4.13.2 of Intel 64 and IA-32
-        * Architectures Software Developer's Manual).
-        *
-        * Mark the entry present. The current mapping might be
-        * set to not present, which we preserved above.
+        * We use the standard kernel pagetable protections for the new
+        * pagetable protections, the actual ptes set above control the
+        * primary protection behavior:
         */
-       ref_prot = pte_pgprot(pte_mkexec(pte_clrhuge(*kpte)));
-       pgprot_val(ref_prot) |= _PAGE_PRESENT;
-       __set_pmd_pte(kpte, address, mk_pte(base, ref_prot));
+       __set_pmd_pte(kpte, address, mk_pte(base, __pgprot(_KERNPG_TABLE)));
        base = NULL;
 
 out_unlock:
@@ -575,7 +570,6 @@ static int __change_page_attr(struct cpa_data *cpa, int primary)
                address = cpa->vaddr[cpa->curpage];
        else
                address = *cpa->vaddr;
-
 repeat:
        kpte = lookup_address(address, &level);
        if (!kpte)
@@ -812,6 +806,13 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
 
        vm_unmap_aliases();
 
+       /*
+        * If we're called with lazy mmu updates enabled, the
+        * in-memory pte state may be stale.  Flush pending updates to
+        * bring them up to date.
+        */
+       arch_flush_lazy_mmu_mode();
+
        cpa.vaddr = addr;
        cpa.numpages = numpages;
        cpa.mask_set = mask_set;
@@ -854,6 +855,13 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages,
        } else
                cpa_flush_all(cache);
 
+       /*
+        * If we've been called with lazy mmu updates enabled, then
+        * make sure that everything gets flushed out before we
+        * return.
+        */
+       arch_flush_lazy_mmu_mode();
+
 out:
        return ret;
 }
index 7b61036427df69d11a33044d60bc85102931e385..aebbf67a79d02326724e91065180675ecb525637 100644 (file)
@@ -211,6 +211,33 @@ chk_conflict(struct memtype *new, struct memtype *entry, unsigned long *type)
 static struct memtype *cached_entry;
 static u64 cached_start;
 
+static int pat_pagerange_is_ram(unsigned long start, unsigned long end)
+{
+       int ram_page = 0, not_rampage = 0;
+       unsigned long page_nr;
+
+       for (page_nr = (start >> PAGE_SHIFT); page_nr < (end >> PAGE_SHIFT);
+            ++page_nr) {
+               /*
+                * For legacy reasons, physical address range in the legacy ISA
+                * region is tracked as non-RAM. This will allow users of
+                * /dev/mem to map portions of legacy ISA region, even when
+                * some of those portions are listed(or not even listed) with
+                * different e820 types(RAM/reserved/..)
+                */
+               if (page_nr >= (ISA_END_ADDRESS >> PAGE_SHIFT) &&
+                   page_is_ram(page_nr))
+                       ram_page = 1;
+               else
+                       not_rampage = 1;
+
+               if (ram_page == not_rampage)
+                       return -1;
+       }
+
+       return ram_page;
+}
+
 /*
  * For RAM pages, mark the pages as non WB memory type using
  * PageNonWB (PG_arch_1). We allow only one set_memory_uc() or
@@ -336,20 +363,12 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
        if (new_type)
                *new_type = actual_type;
 
-       /*
-        * For legacy reasons, some parts of the physical address range in the
-        * legacy 1MB region is treated as non-RAM (even when listed as RAM in
-        * the e820 tables).  So we will track the memory attributes of this
-        * legacy 1MB region using the linear memtype_list always.
-        */
-       if (end >= ISA_END_ADDRESS) {
-               is_range_ram = pagerange_is_ram(start, end);
-               if (is_range_ram == 1)
-                       return reserve_ram_pages_type(start, end, req_type,
-                                                     new_type);
-               else if (is_range_ram < 0)
-                       return -EINVAL;
-       }
+       is_range_ram = pat_pagerange_is_ram(start, end);
+       if (is_range_ram == 1)
+               return reserve_ram_pages_type(start, end, req_type,
+                                             new_type);
+       else if (is_range_ram < 0)
+               return -EINVAL;
 
        new  = kmalloc(sizeof(struct memtype), GFP_KERNEL);
        if (!new)
@@ -446,19 +465,11 @@ int free_memtype(u64 start, u64 end)
        if (is_ISA_range(start, end - 1))
                return 0;
 
-       /*
-        * For legacy reasons, some parts of the physical address range in the
-        * legacy 1MB region is treated as non-RAM (even when listed as RAM in
-        * the e820 tables).  So we will track the memory attributes of this
-        * legacy 1MB region using the linear memtype_list always.
-        */
-       if (end >= ISA_END_ADDRESS) {
-               is_range_ram = pagerange_is_ram(start, end);
-               if (is_range_ram == 1)
-                       return free_ram_pages_type(start, end);
-               else if (is_range_ram < 0)
-                       return -EINVAL;
-       }
+       is_range_ram = pat_pagerange_is_ram(start, end);
+       if (is_range_ram == 1)
+               return free_ram_pages_type(start, end);
+       else if (is_range_ram < 0)
+               return -EINVAL;
 
        spin_lock(&memtype_lock);
        list_for_each_entry(entry, &memtype_list, nd) {
@@ -626,17 +637,13 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
        unsigned long flags;
        unsigned long want_flags = (pgprot_val(*vma_prot) & _PAGE_CACHE_MASK);
 
-       is_ram = pagerange_is_ram(paddr, paddr + size);
+       is_ram = pat_pagerange_is_ram(paddr, paddr + size);
 
-       if (is_ram != 0) {
-               /*
-                * For mapping RAM pages, drivers need to call
-                * set_memory_[uc|wc|wb] directly, for reserve and free, before
-                * setting up the PTE.
-                */
-               WARN_ON_ONCE(1);
-               return 0;
-       }
+       /*
+        * reserve_pfn_range() doesn't support RAM pages.
+        */
+       if (is_ram != 0)
+               return -EINVAL;
 
        ret = reserve_memtype(paddr, paddr + size, want_flags, &flags);
        if (ret)
@@ -693,7 +700,7 @@ static void free_pfn_range(u64 paddr, unsigned long size)
 {
        int is_ram;
 
-       is_ram = pagerange_is_ram(paddr, paddr + size);
+       is_ram = pat_pagerange_is_ram(paddr, paddr + size);
        if (is_ram == 0)
                free_memtype(paddr, paddr + size);
 }
index 858938241616ab88ff53700a4463c698c11dad3d..fa3e10725d985021d55f9f44beaff3cd05c0ad7a 100644 (file)
@@ -19,8 +19,10 @@ DECLARE_PER_CPU(unsigned long, xen_mc_irq_flags);
    paired with xen_mc_issue() */
 static inline void xen_mc_batch(void)
 {
+       unsigned long flags;
        /* need to disable interrupts until this entry is complete */
-       local_irq_save(__get_cpu_var(xen_mc_irq_flags));
+       local_irq_save(flags);
+       __get_cpu_var(xen_mc_irq_flags) = flags;
 }
 
 static inline struct multicall_space xen_mc_entry(size_t args)
index 6100682b1da22248debf67ccf0cfca02a524180f..dd1a7a4a1ceaa122a403fa7c173e0720c9d4a1d2 100644 (file)
@@ -65,4 +65,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _XTENSA_SOCKET_H */
index a09535377a94c0b84a59118533f5e4ddeaa1076d..bbbdc4b8ccf27a9d0d1f4a9648a930b89f8761a0 100644 (file)
@@ -209,12 +209,19 @@ void blk_abort_queue(struct request_queue *q)
 {
        unsigned long flags;
        struct request *rq, *tmp;
+       LIST_HEAD(list);
 
        spin_lock_irqsave(q->queue_lock, flags);
 
        elv_abort_queue(q);
 
-       list_for_each_entry_safe(rq, tmp, &q->timeout_list, timeout_list)
+       /*
+        * Splice entries to local list, to avoid deadlocking if entries
+        * get readded to the timeout list by error handling
+        */
+       list_splice_init(&q->timeout_list, &list);
+
+       list_for_each_entry_safe(rq, tmp, &list, timeout_list)
                blk_abort_request(rq);
 
        spin_unlock_irqrestore(q->queue_lock, flags);
index 39cc3bfe56e41055793a804e1461dad39045b264..7cf9d1ff45a015e0d8fe7be2546c6fb7f95f590e 100644 (file)
@@ -142,7 +142,7 @@ static void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
 
        what |= ddir_act[rw & WRITE];
        what |= MASK_TC_BIT(rw, BARRIER);
-       what |= MASK_TC_BIT(rw, SYNC);
+       what |= MASK_TC_BIT(rw, SYNCIO);
        what |= MASK_TC_BIT(rw, AHEAD);
        what |= MASK_TC_BIT(rw, META);
        what |= MASK_TC_BIT(rw, DISCARD);
index d414bb5607e89f4e3a05466b2a488db5e79c98a3..0ce8806dd0c1a3786b6cd86ba8a90b743ca81b8d 100644 (file)
@@ -244,7 +244,8 @@ bsg_validate_sgv4_hdr(struct request_queue *q, struct sg_io_v4 *hdr, int *rw)
  * map sg_io_v4 to a request.
  */
 static struct request *
-bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
+bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm,
+           u8 *sense)
 {
        struct request_queue *q = bd->queue;
        struct request *rq, *next_rq = NULL;
@@ -306,6 +307,10 @@ bsg_map_hdr(struct bsg_device *bd, struct sg_io_v4 *hdr, fmode_t has_write_perm)
                if (ret)
                        goto out;
        }
+
+       rq->sense = sense;
+       rq->sense_len = 0;
+
        return rq;
 out:
        if (rq->cmd != rq->__cmd)
@@ -348,9 +353,6 @@ static void bsg_rq_end_io(struct request *rq, int uptodate)
 static void bsg_add_command(struct bsg_device *bd, struct request_queue *q,
                            struct bsg_command *bc, struct request *rq)
 {
-       rq->sense = bc->sense;
-       rq->sense_len = 0;
-
        /*
         * add bc command to busy queue and submit rq for io
         */
@@ -419,7 +421,7 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
 {
        int ret = 0;
 
-       dprintk("rq %p bio %p %u\n", rq, bio, rq->errors);
+       dprintk("rq %p bio %p 0x%x\n", rq, bio, rq->errors);
        /*
         * fill in all the output members
         */
@@ -635,7 +637,7 @@ static int __bsg_write(struct bsg_device *bd, const char __user *buf,
                /*
                 * get a request, fill in the blanks, and add to request queue
                 */
-               rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm);
+               rq = bsg_map_hdr(bd, &bc->hdr, has_write_perm, bc->sense);
                if (IS_ERR(rq)) {
                        ret = PTR_ERR(rq);
                        rq = NULL;
@@ -922,11 +924,12 @@ static long bsg_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                struct request *rq;
                struct bio *bio, *bidi_bio = NULL;
                struct sg_io_v4 hdr;
+               u8 sense[SCSI_SENSE_BUFFERSIZE];
 
                if (copy_from_user(&hdr, uarg, sizeof(hdr)))
                        return -EFAULT;
 
-               rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE);
+               rq = bsg_map_hdr(bd, &hdr, file->f_mode & FMODE_WRITE, sense);
                if (IS_ERR(rq))
                        return PTR_ERR(rq);
 
index 397960cf26afcd61fc7c2bba2365944c8485c767..e1eadcc9546a72ec0d1c76d933143767dd357536 100644 (file)
@@ -1087,6 +1087,14 @@ dev_t blk_lookup_devt(const char *name, int partno)
                if (strcmp(dev_name(dev), name))
                        continue;
 
+               if (partno < disk->minors) {
+                       /* We need to return the right devno, even
+                        * if the partition doesn't exist yet.
+                        */
+                       devt = MKDEV(MAJOR(dev->devt),
+                                    MINOR(dev->devt) + partno);
+                       break;
+               }
                part = disk_get_part(disk, partno);
                if (part) {
                        devt = part_devt(part);
index ba5292d69ebd206cdbf9961e130cf089dc584dd2..b2d1ee32cfe829c774071367b5e40a9d5553dc3f 100644 (file)
@@ -214,7 +214,7 @@ static void crypto_ahash_show(struct seq_file *m, struct crypto_alg *alg)
        seq_printf(m, "async        : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ?
                                             "yes" : "no");
        seq_printf(m, "blocksize    : %u\n", alg->cra_blocksize);
-       seq_printf(m, "digestsize   : %u\n", alg->cra_hash.digestsize);
+       seq_printf(m, "digestsize   : %u\n", alg->cra_ahash.digestsize);
 }
 
 const struct crypto_type crypto_ahash_type = {
index 7c41e7405c41a4392791cc4a01a22cce52f983b0..56c62e2858d56a9eee11b9167fe8362a71a7c6c1 100644 (file)
@@ -149,6 +149,9 @@ static struct crypto_larval *__crypto_register_alg(struct crypto_alg *alg)
                if (q == alg)
                        goto err;
 
+               if (crypto_is_moribund(q))
+                       continue;
+
                if (crypto_is_larval(q)) {
                        if (!strcmp(alg->cra_driver_name, q->cra_driver_name))
                                goto err;
@@ -197,7 +200,7 @@ void crypto_alg_tested(const char *name, int err)
 
        down_write(&crypto_alg_sem);
        list_for_each_entry(q, &crypto_alg_list, cra_list) {
-               if (!crypto_is_larval(q))
+               if (crypto_is_moribund(q) || !crypto_is_larval(q))
                        continue;
 
                test = (struct crypto_larval *)q;
@@ -210,6 +213,7 @@ void crypto_alg_tested(const char *name, int err)
        goto unlock;
 
 found:
+       q->cra_flags |= CRYPTO_ALG_DEAD;
        alg = test->adult;
        if (err || list_empty(&alg->cra_list))
                goto complete;
index 9975a7bd246c21d4d7e3152249ffefdb38812ee5..efe77df6863f4378f4f0da414591f940870b76ea 100644 (file)
@@ -557,34 +557,34 @@ err:
        return ERR_PTR(err);
 }
 EXPORT_SYMBOL_GPL(crypto_alloc_tfm);
+
 /*
- *     crypto_free_tfm - Free crypto transform
+ *     crypto_destroy_tfm - Free crypto transform
+ *     @mem: Start of tfm slab
  *     @tfm: Transform to free
  *
- *     crypto_free_tfm() frees up the transform and any associated resources,
+ *     This function frees up the transform and any associated resources,
  *     then drops the refcount on the associated algorithm.
  */
-void crypto_free_tfm(struct crypto_tfm *tfm)
+void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
 {
        struct crypto_alg *alg;
        int size;
 
-       if (unlikely(!tfm))
+       if (unlikely(!mem))
                return;
 
        alg = tfm->__crt_alg;
-       size = sizeof(*tfm) + alg->cra_ctxsize;
+       size = ksize(mem);
 
        if (!tfm->exit && alg->cra_exit)
                alg->cra_exit(tfm);
        crypto_exit_ops(tfm);
        crypto_mod_put(alg);
-       memset(tfm, 0, size);
-       kfree(tfm);
+       memset(mem, 0, size);
+       kfree(mem);
 }
-
-EXPORT_SYMBOL_GPL(crypto_free_tfm);
+EXPORT_SYMBOL_GPL(crypto_destroy_tfm);
 
 int crypto_has_alg(const char *name, u32 type, u32 mask)
 {
index 8ef664e3bcd9a90c93a5436e551549e72df1ff82..358f80be2bf97d128ebd648887325a01ea051a70 100644 (file)
@@ -45,7 +45,13 @@ struct priv {
 
 static inline void setbit128_bbe(void *b, int bit)
 {
-       __set_bit(bit ^ 0x78, b);
+       __set_bit(bit ^ (0x80 -
+#ifdef __BIG_ENDIAN
+                        BITS_PER_LONG
+#else
+                        BITS_PER_BYTE
+#endif
+                       ), b);
 }
 
 static int setkey(struct crypto_tfm *parent, const u8 *key,
index 9aeeb52004a5399d0a9b7a3484044b5de1e3083c..3de89a424401c1918818145a3d27df627c99f7ef 100644 (file)
@@ -54,7 +54,8 @@ static void scatterwalk_pagedone(struct scatter_walk *walk, int out,
                struct page *page;
 
                page = sg_page(walk->sg) + ((walk->offset - 1) >> PAGE_SHIFT);
-               flush_dcache_page(page);
+               if (!PageSlab(page))
+                       flush_dcache_page(page);
        }
 
        if (more) {
index c9df367332ffd1f122b1d675bcb434b936848bc4..d5a2b619c55f79e3b7cbff1f1d06d3048364b49c 100644 (file)
@@ -388,10 +388,15 @@ static int crypto_init_shash_ops_compat(struct crypto_tfm *tfm)
        struct shash_desc *desc = crypto_tfm_ctx(tfm);
        struct crypto_shash *shash;
 
+       if (!crypto_mod_get(calg))
+               return -EAGAIN;
+
        shash = __crypto_shash_cast(crypto_create_tfm(
                calg, &crypto_shash_type));
-       if (IS_ERR(shash))
+       if (IS_ERR(shash)) {
+               crypto_mod_put(calg);
                return PTR_ERR(shash);
+       }
 
        desc->tfm = shash;
        tfm->exit = crypto_exit_shash_ops_compat;
index d7f9839ba264d34fd0159ba1b70289530129ba4c..8a851d0f438458392f03fce3c8ded88957f96124 100644 (file)
@@ -9,6 +9,7 @@ menuconfig ACPI
        depends on PCI
        depends on PM
        select PNP
+       select CPU_IDLE
        default y
        ---help---
          Advanced Configuration and Power Interface (ACPI) support for 
@@ -253,13 +254,6 @@ config ACPI_PCI_SLOT
          help you correlate PCI bus addresses with the physical geography
          of your slots. If you are unsure, say N.
 
-config ACPI_SYSTEM
-       bool
-       default y
-       help
-         This driver will enable your system to shut down using ACPI, and
-         dump your ACPI DSDT table using /proc/acpi/dsdt.
-
 config X86_PM_TIMER
        bool "Power Management Timer Support" if EMBEDDED
        depends on X86
@@ -287,7 +281,7 @@ config ACPI_CONTAINER
          support physical cpu/memory hot-plug.
 
          If one selects "m", this driver can be loaded with
-         "modprobe acpi_container".
+         "modprobe container".
 
 config ACPI_HOTPLUG_MEMORY
        tristate "Memory Hotplug"
index 65d90c720b5a63995179235af6683577e112cc44..b130ea0d0759a3f95c8b81d3c203e4bdea1c5820 100644 (file)
@@ -52,7 +52,7 @@ obj-$(CONFIG_ACPI_PROCESSOR)  += processor.o
 obj-$(CONFIG_ACPI_CONTAINER)   += container.o
 obj-$(CONFIG_ACPI_THERMAL)     += thermal.o
 obj-y                          += power.o
-obj-$(CONFIG_ACPI_SYSTEM)      += system.o event.o
+obj-y                          += system.o event.o
 obj-$(CONFIG_ACPI_DEBUG)       += debug.o
 obj-$(CONFIG_ACPI_NUMA)                += numa.o
 obj-$(CONFIG_ACPI_HOTPLUG_MEMORY)      += acpi_memhotplug.o
index 9684cc827930c7e4682aab1d16ae98fcdbb12ab1..22ce489857202b73fa13d293367fa35e346f5d7a 100644 (file)
@@ -538,10 +538,9 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
                        if (ACPI_FAILURE(status)) {
                                ACPI_WARNING((AE_INFO,
                                              "Truncating %u table entries!",
-                                             (unsigned)
-                                             (acpi_gbl_root_table_list.size -
-                                              acpi_gbl_root_table_list.
-                                              count)));
+                                             (unsigned) (table_count -
+                                              (acpi_gbl_root_table_list.
+                                              count - 2))));
                                break;
                        }
                }
index da9450bc60f7062e05f0f0ba385572525e5a4f23..9c9897dbe9071ae83d56b994b1f3c03de1ab2e91 100644 (file)
@@ -116,9 +116,9 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
                return_ACPI_STATUS(AE_NO_MEMORY);
        }
 
-       /* Default return value is SUPPORTED */
+       /* Default return value is 0, NOT-SUPPORTED */
 
-       return_desc->integer.value = ACPI_UINT32_MAX;
+       return_desc->integer.value = 0;
        walk_state->return_desc = return_desc;
 
        /* Compare input string to static table of supported interfaces */
@@ -127,10 +127,8 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
                if (!ACPI_STRCMP
                    (string_desc->string.pointer,
                     acpi_interfaces_supported[i])) {
-
-                       /* The interface is supported */
-
-                       return_ACPI_STATUS(AE_OK);
+                       return_desc->integer.value = ACPI_UINT32_MAX;
+                       goto done;
                }
        }
 
@@ -141,15 +139,14 @@ acpi_status acpi_ut_osi_implementation(struct acpi_walk_state *walk_state)
         */
        status = acpi_os_validate_interface(string_desc->string.pointer);
        if (ACPI_SUCCESS(status)) {
-
-               /* The interface is supported */
-
-               return_ACPI_STATUS(AE_OK);
+               return_desc->integer.value = ACPI_UINT32_MAX;
        }
 
-       /* The interface is not supported */
+done:
+       ACPI_DEBUG_PRINT_RAW((ACPI_DB_INFO, "ACPI: BIOS _OSI(%s) %ssupported\n",
+               string_desc->string.pointer,
+               return_desc->integer.value == 0 ? "not-" : ""));
 
-       return_desc->integer.value = 0;
        return_ACPI_STATUS(AE_OK);
 }
 
index 65132f9204596eb9908b8e0424531ec682a8b731..69cbc57c2d1cd248e7431bb40661e9ea139efbb7 100644 (file)
@@ -138,6 +138,29 @@ static int acpi_battery_technology(struct acpi_battery *battery)
 
 static int acpi_battery_get_state(struct acpi_battery *battery);
 
+static int acpi_battery_is_charged(struct acpi_battery *battery)
+{
+       /* either charging or discharging */
+       if (battery->state != 0)
+               return 0;
+
+       /* battery not reporting charge */
+       if (battery->capacity_now == ACPI_BATTERY_VALUE_UNKNOWN ||
+           battery->capacity_now == 0)
+               return 0;
+
+       /* good batteries update full_charge as the batteries degrade */
+       if (battery->full_charge_capacity == battery->capacity_now)
+               return 1;
+
+       /* fallback to using design values for broken batteries */
+       if (battery->design_capacity == battery->capacity_now)
+               return 1;
+
+       /* we don't do any sort of metric based on percentages */
+       return 0;
+}
+
 static int acpi_battery_get_property(struct power_supply *psy,
                                     enum power_supply_property psp,
                                     union power_supply_propval *val)
@@ -155,7 +178,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
                        val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
                else if (battery->state & 0x02)
                        val->intval = POWER_SUPPLY_STATUS_CHARGING;
-               else if (battery->state == 0)
+               else if (acpi_battery_is_charged(battery))
                        val->intval = POWER_SUPPLY_STATUS_FULL;
                else
                        val->intval = POWER_SUPPLY_STATUS_UNKNOWN;
index 17020c12623c727c7c8ff0a18e7602bf18a85c5a..fe0cdf83641a3b5a0ddcf022e520941c1be10d92 100644 (file)
@@ -163,7 +163,7 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
        case ACPI_NOTIFY_BUS_CHECK:
                /* Fall through */
        case ACPI_NOTIFY_DEVICE_CHECK:
-               printk("Container driver received %s event\n",
+               printk(KERN_WARNING "Container driver received %s event\n",
                       (type == ACPI_NOTIFY_BUS_CHECK) ?
                       "ACPI_NOTIFY_BUS_CHECK" : "ACPI_NOTIFY_DEVICE_CHECK");
                status = acpi_bus_get_device(handle, &device);
@@ -174,7 +174,8 @@ static void container_notify_cb(acpi_handle handle, u32 type, void *context)
                                        kobject_uevent(&device->dev.kobj,
                                                       KOBJ_ONLINE);
                                else
-                                       printk("Failed to add container\n");
+                                       printk(KERN_WARNING
+                                              "Failed to add container\n");
                        }
                } else {
                        if (ACPI_SUCCESS(status)) {
index 5b30b8d91d716126cdd3305d61ee8fd625eea016..35094f230b1e339d2d969ca27cb89816c7d3d9de 100644 (file)
@@ -855,10 +855,14 @@ fdd_out:
 static ssize_t show_docked(struct device *dev,
                           struct device_attribute *attr, char *buf)
 {
+       struct acpi_device *tmp;
+
        struct dock_station *dock_station = *((struct dock_station **)
                dev->platform_data);
-       return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station));
 
+       if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp)))
+               return snprintf(buf, PAGE_SIZE, "1\n");
+       return snprintf(buf, PAGE_SIZE, "0\n");
 }
 static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);
 
@@ -984,7 +988,7 @@ static int dock_add(acpi_handle handle)
 
        ret = device_create_file(&dock_device->dev, &dev_attr_docked);
        if (ret) {
-               printk("Error %d adding sysfs file\n", ret);
+               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
                platform_device_unregister(dock_device);
                kfree(dock_station);
                dock_station = NULL;
@@ -992,7 +996,7 @@ static int dock_add(acpi_handle handle)
        }
        ret = device_create_file(&dock_device->dev, &dev_attr_undock);
        if (ret) {
-               printk("Error %d adding sysfs file\n", ret);
+               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
                device_remove_file(&dock_device->dev, &dev_attr_docked);
                platform_device_unregister(dock_device);
                kfree(dock_station);
@@ -1001,7 +1005,7 @@ static int dock_add(acpi_handle handle)
        }
        ret = device_create_file(&dock_device->dev, &dev_attr_uid);
        if (ret) {
-               printk("Error %d adding sysfs file\n", ret);
+               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
                device_remove_file(&dock_device->dev, &dev_attr_docked);
                device_remove_file(&dock_device->dev, &dev_attr_undock);
                platform_device_unregister(dock_device);
@@ -1011,7 +1015,7 @@ static int dock_add(acpi_handle handle)
        }
        ret = device_create_file(&dock_device->dev, &dev_attr_flags);
        if (ret) {
-               printk("Error %d adding sysfs file\n", ret);
+               printk(KERN_ERR "Error %d adding sysfs file\n", ret);
                device_remove_file(&dock_device->dev, &dev_attr_docked);
                device_remove_file(&dock_device->dev, &dev_attr_undock);
                device_remove_file(&dock_device->dev, &dev_attr_uid);
index a2b82c90a6838eaff23a83cd30e741e0c3422e2a..2fe15060dcdc2c3a51dd9f3ef20171e0b4e50c8e 100644 (file)
@@ -120,6 +120,8 @@ static struct acpi_ec {
        spinlock_t curr_lock;
 } *boot_ec, *first_ec;
 
+static int EC_FLAGS_MSI; /* Out-of-spec MSI controller */
+
 /* --------------------------------------------------------------------------
                              Transaction Management
    -------------------------------------------------------------------------- */
@@ -259,6 +261,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec,
                clear_bit(EC_FLAGS_GPE_MODE, &ec->flags);
                acpi_disable_gpe(NULL, ec->gpe);
        }
+       if (EC_FLAGS_MSI)
+               udelay(ACPI_EC_DELAY);
        /* start transaction */
        spin_lock_irqsave(&ec->curr_lock, tmp);
        /* following two actions should be kept atomic */
@@ -967,6 +971,11 @@ int __init acpi_ec_ecdt_probe(void)
        /*
         * Generate a boot ec context
         */
+       if (dmi_name_in_vendors("Micro-Star") ||
+           dmi_name_in_vendors("Notebook")) {
+               pr_info(PREFIX "Enabling special treatment for EC from MSI.\n");
+               EC_FLAGS_MSI = 1;
+       }
        status = acpi_get_table(ACPI_SIG_ECDT, 1,
                                (struct acpi_table_header **)&ecdt_ptr);
        if (ACPI_SUCCESS(status)) {
@@ -982,7 +991,7 @@ int __init acpi_ec_ecdt_probe(void)
                saved_ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL);
                if (!saved_ec)
                        return -ENOMEM;
-               memcpy(&saved_ec, boot_ec, sizeof(saved_ec));
+               memcpy(saved_ec, boot_ec, sizeof(*saved_ec));
        /* fall through */
        }
        /* This workaround is needed only on some broken machines,
index 0c24bd4d65629bb4647fee1958ceeac2dda424ad..aeb7e5fb4a043b2fbacf8245b3bb4ccabf5a0691 100644 (file)
@@ -235,11 +235,7 @@ int acpi_bus_generate_netlink_event(const char *device_class,
                return result;
        }
 
-       result =
-           genlmsg_multicast(skb, 0, acpi_event_mcgrp.id, GFP_ATOMIC);
-       if (result)
-               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                                 "Failed to send a Genetlink message!\n"));
+       genlmsg_multicast(skb, 0, acpi_event_mcgrp.id, GFP_ATOMIC);
        return 0;
 }
 
index adec3d15810a347d7ef6bf4cabc1b84d950ec1b1..5479b9f42513a17d7ab27aa8ed48d3035d547651 100644 (file)
@@ -255,12 +255,12 @@ static int acpi_platform_notify(struct device *dev)
        }
        type = acpi_get_bus_type(dev->bus);
        if (!type) {
-               DBG("No ACPI bus support for %s\n", dev->bus_id);
+               DBG("No ACPI bus support for %s\n", dev_name(dev));
                ret = -EINVAL;
                goto end;
        }
        if ((ret = type->find_device(dev, &handle)) != 0)
-               DBG("Can't get handler for %s\n", dev->bus_id);
+               DBG("Can't get handler for %s\n", dev_name(dev));
       end:
        if (!ret)
                acpi_bind_one(dev, handle);
@@ -271,10 +271,10 @@ static int acpi_platform_notify(struct device *dev)
 
                acpi_get_name(dev->archdata.acpi_handle,
                              ACPI_FULL_PATHNAME, &buffer);
-               DBG("Device %s -> %s\n", dev->bus_id, (char *)buffer.pointer);
+               DBG("Device %s -> %s\n", dev_name(dev), (char *)buffer.pointer);
                kfree(buffer.pointer);
        } else
-               DBG("Device %s -> No ACPI support\n", dev->bus_id);
+               DBG("Device %s -> No ACPI support\n", dev_name(dev));
 #endif
 
        return ret;
index 6729a4992f2bd73543a561f36454f037db01298d..b3193ec0a2ef36eae859111a525a1d5931590b78 100644 (file)
@@ -228,10 +228,10 @@ void acpi_os_vprintf(const char *fmt, va_list args)
        if (acpi_in_debugger) {
                kdb_printf("%s", buffer);
        } else {
-               printk("%s", buffer);
+               printk(KERN_CONT "%s", buffer);
        }
 #else
-       printk("%s", buffer);
+       printk(KERN_CONT "%s", buffer);
 #endif
 }
 
@@ -1317,6 +1317,54 @@ acpi_os_validate_interface (char *interface)
        return AE_SUPPORT;
 }
 
+#ifdef CONFIG_X86
+
+struct aml_port_desc {
+       uint    start;
+       uint    end;
+       char*   name;
+       char    warned;
+};
+
+static struct aml_port_desc aml_invalid_port_list[] = {
+       {0x20, 0x21, "PIC0", 0},
+       {0xA0, 0xA1, "PIC1", 0},
+       {0x4D0, 0x4D1, "ELCR", 0}
+};
+
+/*
+ * valid_aml_io_address()
+ *
+ * if valid, return true
+ * else invalid, warn once, return false
+ */
+static bool valid_aml_io_address(uint address, uint length)
+{
+       int i;
+       int entries = sizeof(aml_invalid_port_list) / sizeof(struct aml_port_desc);
+
+       for (i = 0; i < entries; ++i) {
+               if ((address >= aml_invalid_port_list[i].start &&
+                       address <= aml_invalid_port_list[i].end) ||
+                       (address + length >= aml_invalid_port_list[i].start &&
+                       address  + length <= aml_invalid_port_list[i].end))
+               {
+                       if (!aml_invalid_port_list[i].warned)
+                       {
+                               printk(KERN_ERR "ACPI: Denied BIOS AML access"
+                                       " to invalid port 0x%x+0x%x (%s)\n",
+                                       address, length,
+                                       aml_invalid_port_list[i].name);
+                               aml_invalid_port_list[i].warned = 1;
+                       }
+                       return false;   /* invalid */
+               }
+       }
+       return true;    /* valid */
+}
+#else
+static inline bool valid_aml_io_address(uint address, uint length) { return true; }
+#endif
 /******************************************************************************
  *
  * FUNCTION:    acpi_os_validate_address
@@ -1346,6 +1394,8 @@ acpi_os_validate_address (
 
        switch (space_id) {
        case ACPI_ADR_SPACE_SYSTEM_IO:
+               if (!valid_aml_io_address(address, length))
+                       return AE_AML_ILLEGAL_ADDRESS;
        case ACPI_ADR_SPACE_SYSTEM_MEMORY:
                /* Only interference checks against SystemIO and SytemMemory
                   are needed */
index 1c6e73c7865edcb4fca3dbe0f2f5964a12c22f9f..6c772ca76bd1a52f1e3758193022068bd8a29d12 100644 (file)
@@ -593,7 +593,7 @@ static int acpi_pci_link_allocate(struct acpi_pci_link *link)
                return -ENODEV;
        } else {
                acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING;
-               printk(PREFIX "%s [%s] enabled at IRQ %d\n",
+               printk(KERN_WARNING PREFIX "%s [%s] enabled at IRQ %d\n",
                       acpi_device_name(link->device),
                       acpi_device_bid(link->device), link->irq.active);
        }
index 66a9d81455628454f628496415f4bbee495732b4..7bc22a471fe36c384647c5adff2bd3eaf10dd930 100644 (file)
@@ -66,43 +66,17 @@ ACPI_MODULE_NAME("processor_idle");
 #define ACPI_PROCESSOR_FILE_POWER      "power"
 #define US_TO_PM_TIMER_TICKS(t)                ((t * (PM_TIMER_FREQUENCY/1000)) / 1000)
 #define PM_TIMER_TICK_NS               (1000000000ULL/PM_TIMER_FREQUENCY)
-#ifndef CONFIG_CPU_IDLE
-#define C2_OVERHEAD                    4       /* 1us (3.579 ticks per us) */
-#define C3_OVERHEAD                    4       /* 1us (3.579 ticks per us) */
-static void (*pm_idle_save) (void) __read_mostly;
-#else
 #define C2_OVERHEAD                    1       /* 1us */
 #define C3_OVERHEAD                    1       /* 1us */
-#endif
 #define PM_TIMER_TICKS_TO_US(p)                (((p) * 1000)/(PM_TIMER_FREQUENCY/1000))
 
 static unsigned int max_cstate __read_mostly = ACPI_PROCESSOR_MAX_POWER;
-#ifdef CONFIG_CPU_IDLE
 module_param(max_cstate, uint, 0000);
-#else
-module_param(max_cstate, uint, 0644);
-#endif
 static unsigned int nocst __read_mostly;
 module_param(nocst, uint, 0000);
 
-#ifndef CONFIG_CPU_IDLE
-/*
- * bm_history -- bit-mask with a bit per jiffy of bus-master activity
- * 1000 HZ: 0xFFFFFFFF: 32 jiffies = 32ms
- * 800 HZ: 0xFFFFFFFF: 32 jiffies = 40ms
- * 100 HZ: 0x0000000F: 4 jiffies = 40ms
- * reduce history for more aggressive entry into C3
- */
-static unsigned int bm_history __read_mostly =
-    (HZ >= 800 ? 0xFFFFFFFF : ((1U << (HZ / 25)) - 1));
-module_param(bm_history, uint, 0644);
-
-static int acpi_processor_set_power_policy(struct acpi_processor *pr);
-
-#else  /* CONFIG_CPU_IDLE */
 static unsigned int latency_factor __read_mostly = 2;
 module_param(latency_factor, uint, 0644);
-#endif
 
 /*
  * IBM ThinkPad R40e crashes mysteriously when going into C2 or C3.
@@ -224,71 +198,6 @@ static void acpi_safe_halt(void)
        current_thread_info()->status |= TS_POLLING;
 }
 
-#ifndef CONFIG_CPU_IDLE
-
-static void
-acpi_processor_power_activate(struct acpi_processor *pr,
-                             struct acpi_processor_cx *new)
-{
-       struct acpi_processor_cx *old;
-
-       if (!pr || !new)
-               return;
-
-       old = pr->power.state;
-
-       if (old)
-               old->promotion.count = 0;
-       new->demotion.count = 0;
-
-       /* Cleanup from old state. */
-       if (old) {
-               switch (old->type) {
-               case ACPI_STATE_C3:
-                       /* Disable bus master reload */
-                       if (new->type != ACPI_STATE_C3 && pr->flags.bm_check)
-                               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
-                       break;
-               }
-       }
-
-       /* Prepare to use new state. */
-       switch (new->type) {
-       case ACPI_STATE_C3:
-               /* Enable bus master reload */
-               if (old->type != ACPI_STATE_C3 && pr->flags.bm_check)
-                       acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
-               break;
-       }
-
-       pr->power.state = new;
-
-       return;
-}
-
-static atomic_t c3_cpu_count;
-
-/* Common C-state entry for C2, C3, .. */
-static void acpi_cstate_enter(struct acpi_processor_cx *cstate)
-{
-       /* Don't trace irqs off for idle */
-       stop_critical_timings();
-       if (cstate->entry_method == ACPI_CSTATE_FFH) {
-               /* Call into architectural FFH based C-state */
-               acpi_processor_ffh_cstate_enter(cstate);
-       } else {
-               int unused;
-               /* IO port based C-state */
-               inb(cstate->address);
-               /* Dummy wait op - must do something useless after P_LVL2 read
-                  because chipsets cannot guarantee that STPCLK# signal
-                  gets asserted in time to freeze execution properly. */
-               unused = inl(acpi_gbl_FADT.xpm_timer_block.address);
-       }
-       start_critical_timings();
-}
-#endif /* !CONFIG_CPU_IDLE */
-
 #ifdef ARCH_APICTIMER_STOPS_ON_C3
 
 /*
@@ -390,421 +299,6 @@ static int tsc_halts_in_c(int state)
 }
 #endif
 
-#ifndef CONFIG_CPU_IDLE
-static void acpi_processor_idle(void)
-{
-       struct acpi_processor *pr = NULL;
-       struct acpi_processor_cx *cx = NULL;
-       struct acpi_processor_cx *next_state = NULL;
-       int sleep_ticks = 0;
-       u32 t1, t2 = 0;
-
-       /*
-        * Interrupts must be disabled during bus mastering calculations and
-        * for C2/C3 transitions.
-        */
-       local_irq_disable();
-
-       pr = __get_cpu_var(processors);
-       if (!pr) {
-               local_irq_enable();
-               return;
-       }
-
-       /*
-        * Check whether we truly need to go idle, or should
-        * reschedule:
-        */
-       if (unlikely(need_resched())) {
-               local_irq_enable();
-               return;
-       }
-
-       cx = pr->power.state;
-       if (!cx || acpi_idle_suspend) {
-               if (pm_idle_save) {
-                       pm_idle_save(); /* enables IRQs */
-               } else {
-                       acpi_safe_halt();
-                       local_irq_enable();
-               }
-
-               return;
-       }
-
-       /*
-        * Check BM Activity
-        * -----------------
-        * Check for bus mastering activity (if required), record, and check
-        * for demotion.
-        */
-       if (pr->flags.bm_check) {
-               u32 bm_status = 0;
-               unsigned long diff = jiffies - pr->power.bm_check_timestamp;
-
-               if (diff > 31)
-                       diff = 31;
-
-               pr->power.bm_activity <<= diff;
-
-               acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
-               if (bm_status) {
-                       pr->power.bm_activity |= 0x1;
-                       acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
-               }
-               /*
-                * PIIX4 Erratum #18: Note that BM_STS doesn't always reflect
-                * the true state of bus mastering activity; forcing us to
-                * manually check the BMIDEA bit of each IDE channel.
-                */
-               else if (errata.piix4.bmisx) {
-                       if ((inb_p(errata.piix4.bmisx + 0x02) & 0x01)
-                           || (inb_p(errata.piix4.bmisx + 0x0A) & 0x01))
-                               pr->power.bm_activity |= 0x1;
-               }
-
-               pr->power.bm_check_timestamp = jiffies;
-
-               /*
-                * If bus mastering is or was active this jiffy, demote
-                * to avoid a faulty transition.  Note that the processor
-                * won't enter a low-power state during this call (to this
-                * function) but should upon the next.
-                *
-                * TBD: A better policy might be to fallback to the demotion
-                *      state (use it for this quantum only) istead of
-                *      demoting -- and rely on duration as our sole demotion
-                *      qualification.  This may, however, introduce DMA
-                *      issues (e.g. floppy DMA transfer overrun/underrun).
-                */
-               if ((pr->power.bm_activity & 0x1) &&
-                   cx->demotion.threshold.bm) {
-                       local_irq_enable();
-                       next_state = cx->demotion.state;
-                       goto end;
-               }
-       }
-
-#ifdef CONFIG_HOTPLUG_CPU
-       /*
-        * Check for P_LVL2_UP flag before entering C2 and above on
-        * an SMP system. We do it here instead of doing it at _CST/P_LVL
-        * detection phase, to work cleanly with logical CPU hotplug.
-        */
-       if ((cx->type != ACPI_STATE_C1) && (num_online_cpus() > 1) &&
-           !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED))
-               cx = &pr->power.states[ACPI_STATE_C1];
-#endif
-
-       /*
-        * Sleep:
-        * ------
-        * Invoke the current Cx state to put the processor to sleep.
-        */
-       if (cx->type == ACPI_STATE_C2 || cx->type == ACPI_STATE_C3) {
-               current_thread_info()->status &= ~TS_POLLING;
-               /*
-                * TS_POLLING-cleared state must be visible before we
-                * test NEED_RESCHED:
-                */
-               smp_mb();
-               if (need_resched()) {
-                       current_thread_info()->status |= TS_POLLING;
-                       local_irq_enable();
-                       return;
-               }
-       }
-
-       switch (cx->type) {
-
-       case ACPI_STATE_C1:
-               /*
-                * Invoke C1.
-                * Use the appropriate idle routine, the one that would
-                * be used without acpi C-states.
-                */
-               if (pm_idle_save) {
-                       pm_idle_save(); /* enables IRQs */
-               } else {
-                       acpi_safe_halt();
-                       local_irq_enable();
-               }
-
-               /*
-                * TBD: Can't get time duration while in C1, as resumes
-                *      go to an ISR rather than here.  Need to instrument
-                *      base interrupt handler.
-                *
-                * Note: the TSC better not stop in C1, sched_clock() will
-                *       skew otherwise.
-                */
-               sleep_ticks = 0xFFFFFFFF;
-
-               break;
-
-       case ACPI_STATE_C2:
-               /* Get start time (ticks) */
-               t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
-               /* Tell the scheduler that we are going deep-idle: */
-               sched_clock_idle_sleep_event();
-               /* Invoke C2 */
-               acpi_state_timer_broadcast(pr, cx, 1);
-               acpi_cstate_enter(cx);
-               /* Get end time (ticks) */
-               t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
-
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
-               /* TSC halts in C2, so notify users */
-               if (tsc_halts_in_c(ACPI_STATE_C2))
-                       mark_tsc_unstable("possible TSC halt in C2");
-#endif
-               /* Compute time (ticks) that we were actually asleep */
-               sleep_ticks = ticks_elapsed(t1, t2);
-
-               /* Tell the scheduler how much we idled: */
-               sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
-
-               /* Re-enable interrupts */
-               local_irq_enable();
-               /* Do not account our idle-switching overhead: */
-               sleep_ticks -= cx->latency_ticks + C2_OVERHEAD;
-
-               current_thread_info()->status |= TS_POLLING;
-               acpi_state_timer_broadcast(pr, cx, 0);
-               break;
-
-       case ACPI_STATE_C3:
-               acpi_unlazy_tlb(smp_processor_id());
-               /*
-                * Must be done before busmaster disable as we might
-                * need to access HPET !
-                */
-               acpi_state_timer_broadcast(pr, cx, 1);
-               /*
-                * disable bus master
-                * bm_check implies we need ARB_DIS
-                * !bm_check implies we need cache flush
-                * bm_control implies whether we can do ARB_DIS
-                *
-                * That leaves a case where bm_check is set and bm_control is
-                * not set. In that case we cannot do much, we enter C3
-                * without doing anything.
-                */
-               if (pr->flags.bm_check && pr->flags.bm_control) {
-                       if (atomic_inc_return(&c3_cpu_count) ==
-                           num_online_cpus()) {
-                               /*
-                                * All CPUs are trying to go to C3
-                                * Disable bus master arbitration
-                                */
-                               acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1);
-                       }
-               } else if (!pr->flags.bm_check) {
-                       /* SMP with no shared cache... Invalidate cache  */
-                       ACPI_FLUSH_CPU_CACHE();
-               }
-
-               /* Get start time (ticks) */
-               t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
-               /* Invoke C3 */
-               /* Tell the scheduler that we are going deep-idle: */
-               sched_clock_idle_sleep_event();
-               acpi_cstate_enter(cx);
-               /* Get end time (ticks) */
-               t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
-               if (pr->flags.bm_check && pr->flags.bm_control) {
-                       /* Enable bus master arbitration */
-                       atomic_dec(&c3_cpu_count);
-                       acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0);
-               }
-
-#if defined (CONFIG_GENERIC_TIME) && defined (CONFIG_X86)
-               /* TSC halts in C3, so notify users */
-               if (tsc_halts_in_c(ACPI_STATE_C3))
-                       mark_tsc_unstable("TSC halts in C3");
-#endif
-               /* Compute time (ticks) that we were actually asleep */
-               sleep_ticks = ticks_elapsed(t1, t2);
-               /* Tell the scheduler how much we idled: */
-               sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS);
-
-               /* Re-enable interrupts */
-               local_irq_enable();
-               /* Do not account our idle-switching overhead: */
-               sleep_ticks -= cx->latency_ticks + C3_OVERHEAD;
-
-               current_thread_info()->status |= TS_POLLING;
-               acpi_state_timer_broadcast(pr, cx, 0);
-               break;
-
-       default:
-               local_irq_enable();
-               return;
-       }
-       cx->usage++;
-       if ((cx->type != ACPI_STATE_C1) && (sleep_ticks > 0))
-               cx->time += sleep_ticks;
-
-       next_state = pr->power.state;
-
-#ifdef CONFIG_HOTPLUG_CPU
-       /* Don't do promotion/demotion */
-       if ((cx->type == ACPI_STATE_C1) && (num_online_cpus() > 1) &&
-           !pr->flags.has_cst && !(acpi_gbl_FADT.flags & ACPI_FADT_C2_MP_SUPPORTED)) {
-               next_state = cx;
-               goto end;
-       }
-#endif
-
-       /*
-        * Promotion?
-        * ----------
-        * Track the number of longs (time asleep is greater than threshold)
-        * and promote when the count threshold is reached.  Note that bus
-        * mastering activity may prevent promotions.
-        * Do not promote above max_cstate.
-        */
-       if (cx->promotion.state &&
-           ((cx->promotion.state - pr->power.states) <= max_cstate)) {
-               if (sleep_ticks > cx->promotion.threshold.ticks &&
-                 cx->promotion.state->latency <=
-                               pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) {
-                       cx->promotion.count++;
-                       cx->demotion.count = 0;
-                       if (cx->promotion.count >=
-                           cx->promotion.threshold.count) {
-                               if (pr->flags.bm_check) {
-                                       if (!
-                                           (pr->power.bm_activity & cx->
-                                            promotion.threshold.bm)) {
-                                               next_state =
-                                                   cx->promotion.state;
-                                               goto end;
-                                       }
-                               } else {
-                                       next_state = cx->promotion.state;
-                                       goto end;
-                               }
-                       }
-               }
-       }
-
-       /*
-        * Demotion?
-        * ---------
-        * Track the number of shorts (time asleep is less than time threshold)
-        * and demote when the usage threshold is reached.
-        */
-       if (cx->demotion.state) {
-               if (sleep_ticks < cx->demotion.threshold.ticks) {
-                       cx->demotion.count++;
-                       cx->promotion.count = 0;
-                       if (cx->demotion.count >= cx->demotion.threshold.count) {
-                               next_state = cx->demotion.state;
-                               goto end;
-                       }
-               }
-       }
-
-      end:
-       /*
-        * Demote if current state exceeds max_cstate
-        * or if the latency of the current state is unacceptable
-        */
-       if ((pr->power.state - pr->power.states) > max_cstate ||
-               pr->power.state->latency >
-                               pm_qos_requirement(PM_QOS_CPU_DMA_LATENCY)) {
-               if (cx->demotion.state)
-                       next_state = cx->demotion.state;
-       }
-
-       /*
-        * New Cx State?
-        * -------------
-        * If we're going to start using a new Cx state we must clean up
-        * from the previous and prepare to use the new.
-        */
-       if (next_state != pr->power.state)
-               acpi_processor_power_activate(pr, next_state);
-}
-
-static int acpi_processor_set_power_policy(struct acpi_processor *pr)
-{
-       unsigned int i;
-       unsigned int state_is_set = 0;
-       struct acpi_processor_cx *lower = NULL;
-       struct acpi_processor_cx *higher = NULL;
-       struct acpi_processor_cx *cx;
-
-
-       if (!pr)
-               return -EINVAL;
-
-       /*
-        * This function sets the default Cx state policy (OS idle handler).
-        * Our scheme is to promote quickly to C2 but more conservatively
-        * to C3.  We're favoring C2  for its characteristics of low latency
-        * (quick response), good power savings, and ability to allow bus
-        * mastering activity.  Note that the Cx state policy is completely
-        * customizable and can be altered dynamically.
-        */
-
-       /* startup state */
-       for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
-               cx = &pr->power.states[i];
-               if (!cx->valid)
-                       continue;
-
-               if (!state_is_set)
-                       pr->power.state = cx;
-               state_is_set++;
-               break;
-       }
-
-       if (!state_is_set)
-               return -ENODEV;
-
-       /* demotion */
-       for (i = 1; i < ACPI_PROCESSOR_MAX_POWER; i++) {
-               cx = &pr->power.states[i];
-               if (!cx->valid)
-                       continue;
-
-               if (lower) {
-                       cx->demotion.state = lower;
-                       cx->demotion.threshold.ticks = cx->latency_ticks;
-                       cx->demotion.threshold.count = 1;
-                       if (cx->type == ACPI_STATE_C3)
-                               cx->demotion.threshold.bm = bm_history;
-               }
-
-               lower = cx;
-       }
-
-       /* promotion */
-       for (i = (ACPI_PROCESSOR_MAX_POWER - 1); i > 0; i--) {
-               cx = &pr->power.states[i];
-               if (!cx->valid)
-                       continue;
-
-               if (higher) {
-                       cx->promotion.state = higher;
-                       cx->promotion.threshold.ticks = cx->latency_ticks;
-                       if (cx->type >= ACPI_STATE_C2)
-                               cx->promotion.threshold.count = 4;
-                       else
-                               cx->promotion.threshold.count = 10;
-                       if (higher->type == ACPI_STATE_C3)
-                               cx->promotion.threshold.bm = bm_history;
-               }
-
-               higher = cx;
-       }
-
-       return 0;
-}
-#endif /* !CONFIG_CPU_IDLE */
-
 static int acpi_processor_get_power_info_fadt(struct acpi_processor *pr)
 {
 
@@ -1047,11 +541,7 @@ static void acpi_processor_power_verify_c2(struct acpi_processor_cx *cx)
         */
        cx->valid = 1;
 
-#ifndef CONFIG_CPU_IDLE
-       cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
-#else
        cx->latency_ticks = cx->latency;
-#endif
 
        return;
 }
@@ -1121,7 +611,6 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
                                          " for C3 to be enabled on SMP systems\n"));
                        return;
                }
-               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
        }
 
        /*
@@ -1132,11 +621,16 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
         */
        cx->valid = 1;
 
-#ifndef CONFIG_CPU_IDLE
-       cx->latency_ticks = US_TO_PM_TIMER_TICKS(cx->latency);
-#else
        cx->latency_ticks = cx->latency;
-#endif
+       /*
+        * On older chipsets, BM_RLD needs to be set
+        * in order for Bus Master activity to wake the
+        * system from C3.  Newer chipsets handle DMA
+        * during C3 automatically and BM_RLD is a NOP.
+        * In either case, the proper way to
+        * handle BM_RLD is to set it and leave it set.
+        */
+       acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
 
        return;
 }
@@ -1201,20 +695,6 @@ static int acpi_processor_get_power_info(struct acpi_processor *pr)
 
        pr->power.count = acpi_processor_power_verify(pr);
 
-#ifndef CONFIG_CPU_IDLE
-       /*
-        * Set Default Policy
-        * ------------------
-        * Now that we know which states are supported, set the default
-        * policy.  Note that this policy can be changed dynamically
-        * (e.g. encourage deeper sleeps to conserve battery life when
-        * not on AC).
-        */
-       result = acpi_processor_set_power_policy(pr);
-       if (result)
-               return result;
-#endif
-
        /*
         * if one state of type C2 or C3 is available, mark this
         * CPU as being "idle manageable"
@@ -1312,69 +792,6 @@ static const struct file_operations acpi_processor_power_fops = {
        .release = single_release,
 };
 
-#ifndef CONFIG_CPU_IDLE
-
-int acpi_processor_cst_has_changed(struct acpi_processor *pr)
-{
-       int result = 0;
-
-       if (boot_option_idle_override)
-               return 0;
-
-       if (!pr)
-               return -EINVAL;
-
-       if (nocst) {
-               return -ENODEV;
-       }
-
-       if (!pr->flags.power_setup_done)
-               return -ENODEV;
-
-       /*
-        * Fall back to the default idle loop, when pm_idle_save had
-        * been initialized.
-        */
-       if (pm_idle_save) {
-               pm_idle = pm_idle_save;
-               /* Relies on interrupts forcing exit from idle. */
-               synchronize_sched();
-       }
-
-       pr->flags.power = 0;
-       result = acpi_processor_get_power_info(pr);
-       if ((pr->flags.power == 1) && (pr->flags.power_setup_done))
-               pm_idle = acpi_processor_idle;
-
-       return result;
-}
-
-#ifdef CONFIG_SMP
-static void smp_callback(void *v)
-{
-       /* we already woke the CPU up, nothing more to do */
-}
-
-/*
- * This function gets called when a part of the kernel has a new latency
- * requirement.  This means we need to get all processors out of their C-state,
- * and then recalculate a new suitable C-state. Just do a cross-cpu IPI; that
- * wakes them all right up.
- */
-static int acpi_processor_latency_notify(struct notifier_block *b,
-               unsigned long l, void *v)
-{
-       smp_call_function(smp_callback, NULL, 1);
-       return NOTIFY_OK;
-}
-
-static struct notifier_block acpi_processor_latency_notifier = {
-       .notifier_call = acpi_processor_latency_notify,
-};
-
-#endif
-
-#else /* CONFIG_CPU_IDLE */
 
 /**
  * acpi_idle_bm_check - checks if bus master activity was detected
@@ -1383,7 +800,7 @@ static int acpi_idle_bm_check(void)
 {
        u32 bm_status = 0;
 
-       acpi_get_register(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
+       acpi_get_register_unlocked(ACPI_BITREG_BUS_MASTER_STATUS, &bm_status);
        if (bm_status)
                acpi_set_register(ACPI_BITREG_BUS_MASTER_STATUS, 1);
        /*
@@ -1399,25 +816,6 @@ static int acpi_idle_bm_check(void)
        return bm_status;
 }
 
-/**
- * acpi_idle_update_bm_rld - updates the BM_RLD bit depending on target state
- * @pr: the processor
- * @target: the new target state
- */
-static inline void acpi_idle_update_bm_rld(struct acpi_processor *pr,
-                                          struct acpi_processor_cx *target)
-{
-       if (pr->flags.bm_rld_set && target->type != ACPI_STATE_C3) {
-               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 0);
-               pr->flags.bm_rld_set = 0;
-       }
-
-       if (!pr->flags.bm_rld_set && target->type == ACPI_STATE_C3) {
-               acpi_set_register(ACPI_BITREG_BUS_MASTER_RLD, 1);
-               pr->flags.bm_rld_set = 1;
-       }
-}
-
 /**
  * acpi_idle_do_entry - a helper function that does C2 and C3 type entry
  * @cx: cstate data
@@ -1473,9 +871,6 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev,
                return 0;
        }
 
-       if (pr->flags.bm_check)
-               acpi_idle_update_bm_rld(pr, cx);
-
        t1 = inl(acpi_gbl_FADT.xpm_timer_block.address);
        acpi_idle_do_entry(cx);
        t2 = inl(acpi_gbl_FADT.xpm_timer_block.address);
@@ -1527,9 +922,6 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev,
         */
        acpi_state_timer_broadcast(pr, cx, 1);
 
-       if (pr->flags.bm_check)
-               acpi_idle_update_bm_rld(pr, cx);
-
        if (cx->type == ACPI_STATE_C3)
                ACPI_FLUSH_CPU_CACHE();
 
@@ -1621,8 +1013,6 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev,
         */
        acpi_state_timer_broadcast(pr, cx, 1);
 
-       acpi_idle_update_bm_rld(pr, cx);
-
        /*
         * disable bus master
         * bm_check implies we need ARB_DIS
@@ -1795,8 +1185,6 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr)
        return ret;
 }
 
-#endif /* CONFIG_CPU_IDLE */
-
 int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
                              struct acpi_device *device)
 {
@@ -1825,10 +1213,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
                               "ACPI: processor limited to max C-state %d\n",
                               max_cstate);
                first_run++;
-#if !defined(CONFIG_CPU_IDLE) && defined(CONFIG_SMP)
-               pm_qos_add_notifier(PM_QOS_CPU_DMA_LATENCY,
-                               &acpi_processor_latency_notifier);
-#endif
        }
 
        if (!pr)
@@ -1852,11 +1236,9 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
         * platforms that only support C1.
         */
        if (pr->flags.power) {
-#ifdef CONFIG_CPU_IDLE
                acpi_processor_setup_cpuidle(pr);
                if (cpuidle_register_device(&pr->power.dev))
                        return -EIO;
-#endif
 
                printk(KERN_INFO PREFIX "CPU%d (power states:", pr->id);
                for (i = 1; i <= pr->power.count; i++)
@@ -1864,13 +1246,6 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr,
                                printk(" C%d[C%d]", i,
                                       pr->power.states[i].type);
                printk(")\n");
-
-#ifndef CONFIG_CPU_IDLE
-               if (pr->id == 0) {
-                       pm_idle_save = pm_idle;
-                       pm_idle = acpi_processor_idle;
-               }
-#endif
        }
 
        /* 'power' [R] */
@@ -1889,34 +1264,12 @@ int acpi_processor_power_exit(struct acpi_processor *pr,
        if (boot_option_idle_override)
                return 0;
 
-#ifdef CONFIG_CPU_IDLE
        cpuidle_unregister_device(&pr->power.dev);
-#endif
        pr->flags.power_setup_done = 0;
 
        if (acpi_device_dir(device))
                remove_proc_entry(ACPI_PROCESSOR_FILE_POWER,
                                  acpi_device_dir(device));
 
-#ifndef CONFIG_CPU_IDLE
-
-       /* Unregister the idle handler when processor #0 is removed. */
-       if (pr->id == 0) {
-               if (pm_idle_save)
-                       pm_idle = pm_idle_save;
-
-               /*
-                * We are about to unload the current idle thread pm callback
-                * (pm_idle), Wait for all processors to update cached/local
-                * copies of pm_idle before proceeding.
-                */
-               cpu_idle_wait();
-#ifdef CONFIG_SMP
-               pm_qos_remove_notifier(PM_QOS_CPU_DMA_LATENCY,
-                               &acpi_processor_latency_notifier);
-#endif
-       }
-#endif
-
        return 0;
 }
index 846e227592d48770787672223a4c37c37ec6468c..9cc769b587ff7bbe061ae0c5ab5cc66d67e62ae5 100644 (file)
 #include <linux/init.h>
 #include <linux/cpufreq.h>
 
-#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
-#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/mutex.h>
-
-#include <asm/uaccess.h>
-#endif
-
 #ifdef CONFIG_X86
 #include <asm/cpufeature.h>
 #endif
@@ -434,96 +426,6 @@ int acpi_processor_notify_smm(struct module *calling_module)
 
 EXPORT_SYMBOL(acpi_processor_notify_smm);
 
-#ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF
-/* /proc/acpi/processor/../performance interface (DEPRECATED) */
-
-static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file);
-static struct file_operations acpi_processor_perf_fops = {
-       .owner = THIS_MODULE,
-       .open = acpi_processor_perf_open_fs,
-       .read = seq_read,
-       .llseek = seq_lseek,
-       .release = single_release,
-};
-
-static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset)
-{
-       struct acpi_processor *pr = seq->private;
-       int i;
-
-
-       if (!pr)
-               goto end;
-
-       if (!pr->performance) {
-               seq_puts(seq, "<not supported>\n");
-               goto end;
-       }
-
-       seq_printf(seq, "state count:             %d\n"
-                  "active state:            P%d\n",
-                  pr->performance->state_count, pr->performance->state);
-
-       seq_puts(seq, "states:\n");
-       for (i = 0; i < pr->performance->state_count; i++)
-               seq_printf(seq,
-                          "   %cP%d:                  %d MHz, %d mW, %d uS\n",
-                          (i == pr->performance->state ? '*' : ' '), i,
-                          (u32) pr->performance->states[i].core_frequency,
-                          (u32) pr->performance->states[i].power,
-                          (u32) pr->performance->states[i].transition_latency);
-
-      end:
-       return 0;
-}
-
-static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file)
-{
-       return single_open(file, acpi_processor_perf_seq_show,
-                          PDE(inode)->data);
-}
-
-static void acpi_cpufreq_add_file(struct acpi_processor *pr)
-{
-       struct acpi_device *device = NULL;
-
-
-       if (acpi_bus_get_device(pr->handle, &device))
-               return;
-
-       /* add file 'performance' [R/W] */
-       proc_create_data(ACPI_PROCESSOR_FILE_PERFORMANCE, S_IFREG | S_IRUGO,
-                        acpi_device_dir(device),
-                        &acpi_processor_perf_fops, acpi_driver_data(device));
-       return;
-}
-
-static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
-{
-       struct acpi_device *device = NULL;
-
-
-       if (acpi_bus_get_device(pr->handle, &device))
-               return;
-
-       /* remove file 'performance' */
-       remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE,
-                         acpi_device_dir(device));
-
-       return;
-}
-
-#else
-static void acpi_cpufreq_add_file(struct acpi_processor *pr)
-{
-       return;
-}
-static void acpi_cpufreq_remove_file(struct acpi_processor *pr)
-{
-       return;
-}
-#endif                         /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */
-
 static int acpi_processor_get_psd(struct acpi_processor        *pr)
 {
        int result = 0;
@@ -747,14 +649,12 @@ err_ret:
 }
 EXPORT_SYMBOL(acpi_processor_preregister_performance);
 
-
 int
 acpi_processor_register_performance(struct acpi_processor_performance
                                    *performance, unsigned int cpu)
 {
        struct acpi_processor *pr;
 
-
        if (!(acpi_processor_ppc_status & PPC_REGISTERED))
                return -EINVAL;
 
@@ -781,8 +681,6 @@ acpi_processor_register_performance(struct acpi_processor_performance
                return -EIO;
        }
 
-       acpi_cpufreq_add_file(pr);
-
        mutex_unlock(&performance_mutex);
        return 0;
 }
@@ -795,7 +693,6 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
 {
        struct acpi_processor *pr;
 
-
        mutex_lock(&performance_mutex);
 
        pr = per_cpu(processors, cpu);
@@ -808,8 +705,6 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
                kfree(pr->performance->states);
        pr->performance = NULL;
 
-       acpi_cpufreq_remove_file(pr);
-
        mutex_unlock(&performance_mutex);
 
        return;
index 7e3c609cbef27194c13dbacc7c036956e0217b73..519266654f06cf60bbd6712ee51836abb22fe198 100644 (file)
@@ -90,31 +90,6 @@ void __init acpi_old_suspend_ordering(void)
        old_suspend_ordering = true;
 }
 
-/*
- * According to the ACPI specification the BIOS should make sure that ACPI is
- * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states.  Still,
- * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
- * on such systems during resume.  Unfortunately that doesn't help in
- * particularly pathological cases in which SCI_EN has to be set directly on
- * resume, although the specification states very clearly that this flag is
- * owned by the hardware.  The set_sci_en_on_resume variable will be set in such
- * cases.
- */
-static bool set_sci_en_on_resume;
-/*
- * The ACPI specification wants us to save NVS memory regions during hibernation
- * and to restore them during the subsequent resume.  However, it is not certain
- * if this mechanism is going to work on all machines, so we allow the user to
- * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line
- * option.
- */
-static bool s4_no_nvs;
-
-void __init acpi_s4_no_nvs(void)
-{
-       s4_no_nvs = true;
-}
-
 /**
  *     acpi_pm_disable_gpes - Disable the GPEs.
  */
@@ -193,6 +168,18 @@ static void acpi_pm_end(void)
 #endif /* CONFIG_ACPI_SLEEP */
 
 #ifdef CONFIG_SUSPEND
+/*
+ * According to the ACPI specification the BIOS should make sure that ACPI is
+ * enabled and SCI_EN bit is set on wake-up from S1 - S3 sleep states.  Still,
+ * some BIOSes don't do that and therefore we use acpi_enable() to enable ACPI
+ * on such systems during resume.  Unfortunately that doesn't help in
+ * particularly pathological cases in which SCI_EN has to be set directly on
+ * resume, although the specification states very clearly that this flag is
+ * owned by the hardware.  The set_sci_en_on_resume variable will be set in such
+ * cases.
+ */
+static bool set_sci_en_on_resume;
+
 extern void do_suspend_lowlevel(void);
 
 static u32 acpi_suspend_states[] = {
@@ -396,6 +383,20 @@ static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
 #endif /* CONFIG_SUSPEND */
 
 #ifdef CONFIG_HIBERNATION
+/*
+ * The ACPI specification wants us to save NVS memory regions during hibernation
+ * and to restore them during the subsequent resume.  However, it is not certain
+ * if this mechanism is going to work on all machines, so we allow the user to
+ * disable this mechanism using the 'acpi_sleep=s4_nonvs' kernel command line
+ * option.
+ */
+static bool s4_no_nvs;
+
+void __init acpi_s4_no_nvs(void)
+{
+       s4_no_nvs = true;
+}
+
 static unsigned long s4_hardware_signature;
 static struct acpi_table_facs *facs;
 static bool nosigcheck;
@@ -679,7 +680,7 @@ static void acpi_power_off_prepare(void)
 static void acpi_power_off(void)
 {
        /* acpi_sleep_prepare(ACPI_STATE_S5) should have already been called */
-       printk("%s called\n", __func__);
+       printk(KERN_DEBUG "%s called\n", __func__);
        local_irq_disable();
        acpi_enable_wakeup_device(ACPI_STATE_S5);
        acpi_enter_sleep_state(ACPI_STATE_S5);
index 775c97a282bd0d036bdcee72e192d502e8ba08ea..a8852952fac409de6550b467d5d49b4f7e5ace07 100644 (file)
@@ -293,7 +293,12 @@ static void __init check_multiple_madt(void)
 
 int __init acpi_table_init(void)
 {
-       acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
+       acpi_status status;
+
+       status = acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
+       if (ACPI_FAILURE(status))
+               return 1;
+
        check_multiple_madt();
        return 0;
 }
index f261737636da7a5550c6ac26ab3d178c6220ab9a..bb5ed059114aa296e826b91f8b35083ccc773028 100644 (file)
@@ -1020,7 +1020,7 @@ acpi_video_device_brightness_seq_show(struct seq_file *seq, void *offset)
        }
 
        seq_printf(seq, "levels: ");
-       for (i = 0; i < dev->brightness->count; i++)
+       for (i = 2; i < dev->brightness->count; i++)
                seq_printf(seq, " %d", dev->brightness->levels[i]);
        seq_printf(seq, "\ncurrent: %d\n", dev->brightness->curr);
 
@@ -1059,7 +1059,7 @@ acpi_video_device_write_brightness(struct file *file,
                return -EFAULT;
 
        /* validate through the list of available levels */
-       for (i = 0; i < dev->brightness->count; i++)
+       for (i = 2; i < dev->brightness->count; i++)
                if (level == dev->brightness->levels[i]) {
                        if (ACPI_SUCCESS
                            (acpi_video_device_lcd_set_level(dev, level)))
@@ -1260,7 +1260,7 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
                        printk(KERN_WARNING PREFIX
                               "This indicates a BIOS bug. Please contact the manufacturer.\n");
                }
-               printk("%llx\n", options);
+               printk(KERN_WARNING "%llx\n", options);
                seq_printf(seq, "can POST: <integrated video>");
                if (options & 2)
                        seq_printf(seq, " <PCI video>");
@@ -1712,7 +1712,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
        max = max_below = 0;
        min = min_above = 255;
        /* Find closest level to level_current */
-       for (i = 0; i < device->brightness->count; i++) {
+       for (i = 2; i < device->brightness->count; i++) {
                l = device->brightness->levels[i];
                if (abs(l - level_current) < abs(delta)) {
                        delta = l - level_current;
@@ -1722,7 +1722,7 @@ acpi_video_get_next_level(struct acpi_video_device *device,
        }
        /* Ajust level_current to closest available level */
        level_current += delta;
-       for (i = 0; i < device->brightness->count; i++) {
+       for (i = 2; i < device->brightness->count; i++) {
                l = device->brightness->levels[i];
                if (l < min)
                        min = l;
@@ -2006,6 +2006,12 @@ static int acpi_video_bus_add(struct acpi_device *device)
                        device->pnp.bus_id[3] = '0' + instance;
                instance ++;
        }
+       /* a hack to fix the duplicate name "VGA" problem on Pa 3553 */
+       if (!strcmp(device->pnp.bus_id, "VGA")) {
+               if (instance)
+                       device->pnp.bus_id[3] = '0' + instance;
+               instance++;
+       }
 
        video->device = device;
        strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
index 77bba4c083cbe60efb19a714265a7cc44730212b..a603bbf9b1b706caf37a15b94eb8b6ecb4a3e8dc 100644 (file)
 #define EM_MSG_LED_VALUE_ON           0x00010000
 
 static int ahci_skip_host_reset;
+static int ahci_ignore_sss;
+
 module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444);
 MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)");
 
+module_param_named(ignore_sss, ahci_ignore_sss, int, 0444);
+MODULE_PARM_DESC(ignore_sss, "Ignore staggered spinup flag (0=don't ignore, 1=ignore)");
+
 static int ahci_enable_alpm(struct ata_port *ap,
                enum link_pm policy);
 static void ahci_disable_alpm(struct ata_port *ap);
@@ -2692,8 +2697,10 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        host->iomap = pcim_iomap_table(pdev);
        host->private_data = hpriv;
 
-       if (!(hpriv->cap & HOST_CAP_SSS))
+       if (!(hpriv->cap & HOST_CAP_SSS) || ahci_ignore_sss)
                host->flags |= ATA_HOST_PARALLEL_SCAN;
+       else
+               printk(KERN_INFO "ahci: SSS flag set, parallel bus scan disabled\n");
 
        if (pi.flags & ATA_FLAG_EM)
                ahci_reset_em(host);
index 88c242856dae999861f6864e9d70e064035a82b0..9fbf0595f3d44fd3f51d1339c9bbe127db7fa698 100644 (file)
@@ -164,6 +164,11 @@ MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 
 
+static bool ata_sstatus_online(u32 sstatus)
+{
+       return (sstatus & 0xf) == 0x3;
+}
+
 /**
  *     ata_link_next - link iteration helper
  *     @link: the previous link, NULL to start
@@ -1015,18 +1020,6 @@ static const char *sata_spd_string(unsigned int spd)
        return spd_str[spd - 1];
 }
 
-void ata_dev_disable(struct ata_device *dev)
-{
-       if (ata_dev_enabled(dev)) {
-               if (ata_msg_drv(dev->link->ap))
-                       ata_dev_printk(dev, KERN_WARNING, "disabled\n");
-               ata_acpi_on_disable(dev);
-               ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 |
-                                            ATA_DNXFER_QUIET);
-               dev->class++;
-       }
-}
-
 static int ata_dev_set_dipm(struct ata_device *dev, enum link_pm policy)
 {
        struct ata_link *link = dev->link;
@@ -2239,6 +2232,40 @@ retry:
        return rc;
 }
 
+static int ata_do_link_spd_horkage(struct ata_device *dev)
+{
+       struct ata_link *plink = ata_dev_phys_link(dev);
+       u32 target, target_limit;
+
+       if (!sata_scr_valid(plink))
+               return 0;
+
+       if (dev->horkage & ATA_HORKAGE_1_5_GBPS)
+               target = 1;
+       else
+               return 0;
+
+       target_limit = (1 << target) - 1;
+
+       /* if already on stricter limit, no need to push further */
+       if (plink->sata_spd_limit <= target_limit)
+               return 0;
+
+       plink->sata_spd_limit = target_limit;
+
+       /* Request another EH round by returning -EAGAIN if link is
+        * going faster than the target speed.  Forward progress is
+        * guaranteed by setting sata_spd_limit to target_limit above.
+        */
+       if (plink->sata_spd > target) {
+               ata_dev_printk(dev, KERN_INFO,
+                              "applying link speed limit horkage to %s\n",
+                              sata_spd_string(target));
+               return -EAGAIN;
+       }
+       return 0;
+}
+
 static inline u8 ata_dev_knobble(struct ata_device *dev)
 {
        struct ata_port *ap = dev->link->ap;
@@ -2329,6 +2356,10 @@ int ata_dev_configure(struct ata_device *dev)
                return 0;
        }
 
+       rc = ata_do_link_spd_horkage(dev);
+       if (rc)
+               return rc;
+
        /* let ACPI work its magic */
        rc = ata_acpi_on_devcfg(dev);
        if (rc)
@@ -2784,7 +2815,7 @@ int ata_bus_probe(struct ata_port *ap)
                        /* This is the last chance, better to slow
                         * down than lose it.
                         */
-                       sata_down_spd_limit(&ap->link);
+                       sata_down_spd_limit(&ap->link, 0);
                        ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
                }
        }
@@ -2880,21 +2911,27 @@ void ata_port_disable(struct ata_port *ap)
 /**
  *     sata_down_spd_limit - adjust SATA spd limit downward
  *     @link: Link to adjust SATA spd limit for
+ *     @spd_limit: Additional limit
  *
  *     Adjust SATA spd limit of @link downward.  Note that this
  *     function only adjusts the limit.  The change must be applied
  *     using sata_set_spd().
  *
+ *     If @spd_limit is non-zero, the speed is limited to equal to or
+ *     lower than @spd_limit if such speed is supported.  If
+ *     @spd_limit is slower than any supported speed, only the lowest
+ *     supported speed is allowed.
+ *
  *     LOCKING:
  *     Inherited from caller.
  *
  *     RETURNS:
  *     0 on success, negative errno on failure
  */
-int sata_down_spd_limit(struct ata_link *link)
+int sata_down_spd_limit(struct ata_link *link, u32 spd_limit)
 {
        u32 sstatus, spd, mask;
-       int rc, highbit;
+       int rc, bit;
 
        if (!sata_scr_valid(link))
                return -EOPNOTSUPP;
@@ -2903,7 +2940,7 @@ int sata_down_spd_limit(struct ata_link *link)
         * If not, use cached value in link->sata_spd.
         */
        rc = sata_scr_read(link, SCR_STATUS, &sstatus);
-       if (rc == 0)
+       if (rc == 0 && ata_sstatus_online(sstatus))
                spd = (sstatus >> 4) & 0xf;
        else
                spd = link->sata_spd;
@@ -2913,8 +2950,8 @@ int sata_down_spd_limit(struct ata_link *link)
                return -EINVAL;
 
        /* unconditionally mask off the highest bit */
-       highbit = fls(mask) - 1;
-       mask &= ~(1 << highbit);
+       bit = fls(mask) - 1;
+       mask &= ~(1 << bit);
 
        /* Mask off all speeds higher than or equal to the current
         * one.  Force 1.5Gbps if current SPD is not available.
@@ -2928,6 +2965,15 @@ int sata_down_spd_limit(struct ata_link *link)
        if (!mask)
                return -EINVAL;
 
+       if (spd_limit) {
+               if (mask & ((1 << spd_limit) - 1))
+                       mask &= (1 << spd_limit) - 1;
+               else {
+                       bit = ffs(mask) - 1;
+                       mask = 1 << bit;
+               }
+       }
+
        link->sata_spd_limit = mask;
 
        ata_link_printk(link, KERN_WARNING, "limiting SATA link speed to %s\n",
@@ -4215,6 +4261,9 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        /* Devices that do not need bridging limits applied */
        { "MTRON MSP-SATA*",            NULL,   ATA_HORKAGE_BRIDGE_OK, },
 
+       /* Devices which aren't very happy with higher link speeds */
+       { "WD My Book",                 NULL,   ATA_HORKAGE_1_5_GBPS, },
+
        /* End Marker */
        { }
 };
@@ -4709,8 +4758,7 @@ void swap_buf_le16(u16 *buf, unsigned int buf_words)
 
 /**
  *     ata_qc_new - Request an available ATA command, for queueing
- *     @ap: Port associated with device @dev
- *     @dev: Device from whom we request an available command structure
+ *     @ap: target port
  *
  *     LOCKING:
  *     None.
@@ -5175,7 +5223,7 @@ bool ata_phys_link_online(struct ata_link *link)
        u32 sstatus;
 
        if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
-           (sstatus & 0xf) == 0x3)
+           ata_sstatus_online(sstatus))
                return true;
        return false;
 }
@@ -5199,7 +5247,7 @@ bool ata_phys_link_offline(struct ata_link *link)
        u32 sstatus;
 
        if (sata_scr_read(link, SCR_STATUS, &sstatus) == 0 &&
-           (sstatus & 0xf) != 0x3)
+           !ata_sstatus_online(sstatus))
                return true;
        return false;
 }
@@ -5412,8 +5460,8 @@ void ata_dev_init(struct ata_device *dev)
        dev->horkage = 0;
        spin_unlock_irqrestore(ap->lock, flags);
 
-       memset((void *)dev + ATA_DEVICE_CLEAR_OFFSET, 0,
-              sizeof(*dev) - ATA_DEVICE_CLEAR_OFFSET);
+       memset((void *)dev + ATA_DEVICE_CLEAR_BEGIN, 0,
+              ATA_DEVICE_CLEAR_END - ATA_DEVICE_CLEAR_BEGIN);
        dev->pio_mask = UINT_MAX;
        dev->mwdma_mask = UINT_MAX;
        dev->udma_mask = UINT_MAX;
index 8147a838637094cc16d0217fe8c8ac135edc9c0a..ce2ef04753390b2c95dacd591662efd3c1800ebb 100644 (file)
@@ -82,6 +82,10 @@ enum {
        ATA_EH_FASTDRAIN_INTERVAL       =  3000,
 
        ATA_EH_UA_TRIES                 = 5,
+
+       /* probe speed down parameters, see ata_eh_schedule_probe() */
+       ATA_EH_PROBE_TRIAL_INTERVAL     = 60000,        /* 1 min */
+       ATA_EH_PROBE_TRIALS             = 2,
 };
 
 /* The following table determines how we sequence resets.  Each entry
@@ -1175,6 +1179,32 @@ void ata_eh_qc_retry(struct ata_queued_cmd *qc)
        __ata_eh_qc_complete(qc);
 }
 
+/**
+ *     ata_dev_disable - disable ATA device
+ *     @dev: ATA device to disable
+ *
+ *     Disable @dev.
+ *
+ *     Locking:
+ *     EH context.
+ */
+void ata_dev_disable(struct ata_device *dev)
+{
+       if (!ata_dev_enabled(dev))
+               return;
+
+       if (ata_msg_drv(dev->link->ap))
+               ata_dev_printk(dev, KERN_WARNING, "disabled\n");
+       ata_acpi_on_disable(dev);
+       ata_down_xfermask_limit(dev, ATA_DNXFER_FORCE_PIO0 | ATA_DNXFER_QUIET);
+       dev->class++;
+
+       /* From now till the next successful probe, ering is used to
+        * track probe failures.  Clear accumulated device error info.
+        */
+       ata_ering_clear(&dev->ering);
+}
+
 /**
  *     ata_eh_detach_dev - detach ATA device
  *     @dev: ATA device to detach
@@ -1849,7 +1879,7 @@ static unsigned int ata_eh_speed_down(struct ata_device *dev,
        /* speed down? */
        if (verdict & ATA_EH_SPDN_SPEED_DOWN) {
                /* speed down SATA link speed if possible */
-               if (sata_down_spd_limit(link) == 0) {
+               if (sata_down_spd_limit(link, 0) == 0) {
                        action |= ATA_EH_RESET;
                        goto done;
                }
@@ -2601,11 +2631,11 @@ int ata_eh_reset(struct ata_link *link, int classify,
        }
 
        if (try == max_tries - 1) {
-               sata_down_spd_limit(link);
+               sata_down_spd_limit(link, 0);
                if (slave)
-                       sata_down_spd_limit(slave);
+                       sata_down_spd_limit(slave, 0);
        } else if (rc == -EPIPE)
-               sata_down_spd_limit(failed_link);
+               sata_down_spd_limit(failed_link, 0);
 
        if (hardreset)
                reset = hardreset;
@@ -2744,6 +2774,8 @@ static int ata_eh_revalidate_and_attach(struct ata_link *link,
                                                     readid_flags, dev->id);
                        switch (rc) {
                        case 0:
+                               /* clear error info accumulated during probe */
+                               ata_ering_clear(&dev->ering);
                                new_mask |= 1 << dev->devno;
                                break;
                        case -ENOENT:
@@ -2947,9 +2979,24 @@ static int ata_eh_skip_recovery(struct ata_link *link)
        return 1;
 }
 
+static int ata_count_probe_trials_cb(struct ata_ering_entry *ent, void *void_arg)
+{
+       u64 interval = msecs_to_jiffies(ATA_EH_PROBE_TRIAL_INTERVAL);
+       u64 now = get_jiffies_64();
+       int *trials = void_arg;
+
+       if (ent->timestamp < now - min(now, interval))
+               return -1;
+
+       (*trials)++;
+       return 0;
+}
+
 static int ata_eh_schedule_probe(struct ata_device *dev)
 {
        struct ata_eh_context *ehc = &dev->link->eh_context;
+       struct ata_link *link = ata_dev_phys_link(dev);
+       int trials = 0;
 
        if (!(ehc->i.probe_mask & (1 << dev->devno)) ||
            (ehc->did_probe_mask & (1 << dev->devno)))
@@ -2962,6 +3009,25 @@ static int ata_eh_schedule_probe(struct ata_device *dev)
        ehc->saved_xfer_mode[dev->devno] = 0;
        ehc->saved_ncq_enabled &= ~(1 << dev->devno);
 
+       /* Record and count probe trials on the ering.  The specific
+        * error mask used is irrelevant.  Because a successful device
+        * detection clears the ering, this count accumulates only if
+        * there are consecutive failed probes.
+        *
+        * If the count is equal to or higher than ATA_EH_PROBE_TRIALS
+        * in the last ATA_EH_PROBE_TRIAL_INTERVAL, link speed is
+        * forced to 1.5Gbps.
+        *
+        * This is to work around cases where failed link speed
+        * negotiation results in device misdetection leading to
+        * infinite DEVXCHG or PHRDY CHG events.
+        */
+       ata_ering_record(&dev->ering, 0, AC_ERR_OTHER);
+       ata_ering_map(&dev->ering, ata_count_probe_trials_cb, &trials);
+
+       if (trials > ATA_EH_PROBE_TRIALS)
+               sata_down_spd_limit(link, 1);
+
        return 1;
 }
 
@@ -2969,7 +3035,11 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
 {
        struct ata_eh_context *ehc = &dev->link->eh_context;
 
-       ehc->tries[dev->devno]--;
+       /* -EAGAIN from EH routine indicates retry without prejudice.
+        * The requester is responsible for ensuring forward progress.
+        */
+       if (err != -EAGAIN)
+               ehc->tries[dev->devno]--;
 
        switch (err) {
        case -ENODEV:
@@ -2979,12 +3049,13 @@ static int ata_eh_handle_dev_fail(struct ata_device *dev, int err)
                /* give it just one more chance */
                ehc->tries[dev->devno] = min(ehc->tries[dev->devno], 1);
        case -EIO:
-               if (ehc->tries[dev->devno] == 1 && dev->pio_mode > XFER_PIO_0) {
+               if (ehc->tries[dev->devno] == 1) {
                        /* This is the last chance, better to slow
                         * down than lose it.
                         */
-                       sata_down_spd_limit(ata_dev_phys_link(dev));
-                       ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
+                       sata_down_spd_limit(ata_dev_phys_link(dev), 0);
+                       if (dev->pio_mode > XFER_PIO_0)
+                               ata_down_xfermask_limit(dev, ATA_DNXFER_PIO);
                }
        }
 
index 98ca07a2db87e22a49895e8d1bfd48c332875f49..619f2c33950e5dab2692cae7fdb3df0310310417 100644 (file)
@@ -729,7 +729,7 @@ static int sata_pmp_eh_recover_pmp(struct ata_port *ap,
                if (tries) {
                        /* consecutive revalidation failures? speed down */
                        if (reval_failed)
-                               sata_down_spd_limit(link);
+                               sata_down_spd_limit(link, 0);
                        else
                                reval_failed = 1;
 
index 3c4c5ae277ba583074a2f407fe5cf25caf2b0320..b9747fa59e542866e4659c6648d2f448beb9f9a7 100644 (file)
@@ -415,6 +415,7 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
 
 /**
  *     ata_get_identity - Handler for HDIO_GET_IDENTITY ioctl
+ *     @ap: target port
  *     @sdev: SCSI device to get identify data for
  *     @arg: User buffer area for identify data
  *
index 0b299b0f81721bbe1446169b8fa5b51c86eecd2d..714cb046b594200a17d096768f0d8a45f89a835a 100644 (file)
@@ -773,18 +773,32 @@ unsigned int ata_sff_data_xfer32(struct ata_device *dev, unsigned char *buf,
        else
                iowrite32_rep(data_addr, buf, words);
 
+       /* Transfer trailing bytes, if any */
        if (unlikely(slop)) {
-               __le32 pad;
+               unsigned char pad[4];
+
+               /* Point buf to the tail of buffer */
+               buf += buflen - slop;
+
+               /*
+                * Use io*_rep() accessors here as well to avoid pointlessly
+                * swapping bytes to and fro on the big endian machines...
+                */
                if (rw == READ) {
-                       pad = cpu_to_le32(ioread32(ap->ioaddr.data_addr));
-                       memcpy(buf + buflen - slop, &pad, slop);
+                       if (slop < 3)
+                               ioread16_rep(data_addr, pad, 1);
+                       else
+                               ioread32_rep(data_addr, pad, 1);
+                       memcpy(buf, pad, slop);
                } else {
-                       memcpy(&pad, buf + buflen - slop, slop);
-                       iowrite32(le32_to_cpu(pad), ap->ioaddr.data_addr);
+                       memcpy(pad, buf, slop);
+                       if (slop < 3)
+                               iowrite16_rep(data_addr, pad, 1);
+                       else
+                               iowrite32_rep(data_addr, pad, 1);
                }
-               words++;
        }
-       return words << 2;
+       return (buflen + 1) & ~1;
 }
 EXPORT_SYMBOL_GPL(ata_sff_data_xfer32);
 
index fe2839e58774f01b86b589e3aa59a9c140e0c0d2..cea8014cd87e80614765d68aa5cfee5e83e814ca 100644 (file)
@@ -79,7 +79,6 @@ extern int ata_build_rw_tf(struct ata_taskfile *tf, struct ata_device *dev,
                           u64 block, u32 n_block, unsigned int tf_flags,
                           unsigned int tag);
 extern u64 ata_tf_read_block(struct ata_taskfile *tf, struct ata_device *dev);
-extern void ata_dev_disable(struct ata_device *dev);
 extern void ata_pio_queue_task(struct ata_port *ap, void *data,
                               unsigned long delay);
 extern void ata_port_flush_task(struct ata_port *ap);
@@ -100,7 +99,7 @@ extern int ata_dev_reread_id(struct ata_device *dev, unsigned int readid_flags);
 extern int ata_dev_revalidate(struct ata_device *dev, unsigned int new_class,
                              unsigned int readid_flags);
 extern int ata_dev_configure(struct ata_device *dev);
-extern int sata_down_spd_limit(struct ata_link *link);
+extern int sata_down_spd_limit(struct ata_link *link, u32 spd_limit);
 extern int ata_down_xfermask_limit(struct ata_device *dev, unsigned int sel);
 extern void ata_sg_clean(struct ata_queued_cmd *qc);
 extern void ata_qc_free(struct ata_queued_cmd *qc);
@@ -160,6 +159,7 @@ extern void ata_scsi_error(struct Scsi_Host *host);
 extern void ata_port_wait_eh(struct ata_port *ap);
 extern void ata_eh_fastdrain_timerfn(unsigned long arg);
 extern void ata_qc_schedule_eh(struct ata_queued_cmd *qc);
+extern void ata_dev_disable(struct ata_device *dev);
 extern void ata_eh_detach_dev(struct ata_device *dev);
 extern void ata_eh_about_to_do(struct ata_link *link, struct ata_device *dev,
                               unsigned int action);
index 3080f371222cd6158df812dfc2e98dc030c09a64..f1b26f7c8e4d2353cdf79b34157bfffbbfe9a1d1 100644 (file)
@@ -12,7 +12,7 @@
  *
  * Probe code based on drivers/ide/legacy/qd65xx.c
  * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by
- * Samuel Thibault <samuel.thibault@fnac.net>
+ * Samuel Thibault <samuel.thibault@ens-lyon.org>
  */
 
 #include <linux/kernel.h>
index 79a6c9a0b721b5caacb43c9785bebb877d16c9d1..ba556d3e696368ecea761e4440f82434695318f9 100644 (file)
@@ -110,7 +110,8 @@ static const struct via_isa_bridge {
        { "vt8237s",    PCI_DEVICE_ID_VIA_8237S,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
        { "vt8251",     PCI_DEVICE_ID_VIA_8251,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
        { "cx700",      PCI_DEVICE_ID_VIA_CX700,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_SATA_PATA },
-       { "vt6410",     PCI_DEVICE_ID_VIA_6410,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES},
+       { "vt6410",     PCI_DEVICE_ID_VIA_6410,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
+       { "vt6415",     PCI_DEVICE_ID_VIA_6415,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST | VIA_NO_ENABLES },
        { "vt8237a",    PCI_DEVICE_ID_VIA_8237A,    0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
        { "vt8237",     PCI_DEVICE_ID_VIA_8237,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
        { "vt8235",     PCI_DEVICE_ID_VIA_8235,     0x00, 0x2f, VIA_UDMA_133 | VIA_BAD_AST },
@@ -593,6 +594,7 @@ static int via_reinit_one(struct pci_dev *pdev)
 #endif
 
 static const struct pci_device_id via[] = {
+       { PCI_VDEVICE(VIA, 0x0415), },
        { PCI_VDEVICE(VIA, 0x0571), },
        { PCI_VDEVICE(VIA, 0x0581), },
        { PCI_VDEVICE(VIA, 0x1571), },
index f2d8a020ea53cb329bc8e2c846e752a33011099f..4ae1a4138b47078072bedf2e889338e6bd8a0cb2 100644 (file)
@@ -663,8 +663,8 @@ static const struct pci_device_id mv_pci_tbl[] = {
        { PCI_VDEVICE(MARVELL, 0x5081), chip_508x },
        /* RocketRAID 1720/174x have different identifiers */
        { PCI_VDEVICE(TTI, 0x1720), chip_6042 },
-       { PCI_VDEVICE(TTI, 0x1740), chip_508x },
-       { PCI_VDEVICE(TTI, 0x1742), chip_508x },
+       { PCI_VDEVICE(TTI, 0x1740), chip_6042 },
+       { PCI_VDEVICE(TTI, 0x1742), chip_6042 },
 
        { PCI_VDEVICE(MARVELL, 0x6040), chip_604x },
        { PCI_VDEVICE(MARVELL, 0x6041), chip_604x },
index c49ad0e61b6f2550a8b3f0b84122aa6f0bc0b40b..55a8eed3f3a35cb9fa64b9e67800a40d72d5d062 100644 (file)
@@ -421,26 +421,33 @@ static struct ata_port_operations nv_generic_ops = {
        .hardreset              = ATA_OP_NULL,
 };
 
-/* OSDL bz3352 reports that nf2/3 controllers can't determine device
- * signature reliably.  Also, the following thread reports detection
- * failure on cold boot with the standard debouncing timing.
+/* nf2 is ripe with hardreset related problems.
+ *
+ * kernel bz#3352 reports nf2/3 controllers can't determine device
+ * signature reliably.  The following thread reports detection failure
+ * on cold boot with the standard debouncing timing.
  *
  * http://thread.gmane.org/gmane.linux.ide/34098
  *
- * Debounce with hotplug timing and request follow-up SRST.
+ * And bz#12176 reports that hardreset simply doesn't work on nf2.
+ * Give up on it and just don't do hardreset.
  */
 static struct ata_port_operations nv_nf2_ops = {
-       .inherits               = &nv_common_ops,
+       .inherits               = &nv_generic_ops,
        .freeze                 = nv_nf2_freeze,
        .thaw                   = nv_nf2_thaw,
-       .hardreset              = nv_noclassify_hardreset,
 };
 
-/* CK804 finally gets hardreset right */
+/* For initial probing after boot and hot plugging, hardreset mostly
+ * works fine on CK804 but curiously, reprobing on the initial port by
+ * rescanning or rmmod/insmod fails to acquire the initial D2H Reg FIS
+ * in somewhat undeterministic way.  Use noclassify hardreset.
+ */
 static struct ata_port_operations nv_ck804_ops = {
        .inherits               = &nv_common_ops,
        .freeze                 = nv_ck804_freeze,
        .thaw                   = nv_ck804_thaw,
+       .hardreset              = nv_noclassify_hardreset,
        .host_stop              = nv_ck804_host_stop,
 };
 
index 9f029595f454f6a03ee40cd1f08efd9944f37f10..d0091609e210bde14a9c5eb85c0ab9f26dd3b087 100644 (file)
@@ -324,7 +324,7 @@ static void sil_fill_sg(struct ata_queued_cmd *qc)
 
                prd->addr = cpu_to_le32(addr);
                prd->flags_len = cpu_to_le32(sg_len);
-               VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, sg_len);
+               VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", si, addr, sg_len);
 
                last_prd = prd;
                prd++;
index 98099f526d82663343bf85bae33781616fe5e651..b119640e1ee9d0f6403aae0a3156405e6a72c7bc 100644 (file)
@@ -1690,17 +1690,17 @@ static int __devinit fs_init (struct fs_dev *dev)
                  | (0 * SARMODE0_SHADEN) /* We don't use shadow registers. */
                  | (1 * SARMODE0_INTMODE_READCLEAR)
                  | (1 * SARMODE0_CWRE)
-                 | IS_FS50(dev)?SARMODE0_PRPWT_FS50_5: 
-                                SARMODE0_PRPWT_FS155_3
+                 | (IS_FS50(dev) ? SARMODE0_PRPWT_FS50_5:
+                         SARMODE0_PRPWT_FS155_3)
                  | (1 * SARMODE0_CALSUP_1)
-                 | IS_FS50 (dev)?(0
+                 | (IS_FS50(dev) ? (0
                                   | SARMODE0_RXVCS_32
                                   | SARMODE0_ABRVCS_32 
                                   | SARMODE0_TXVCS_32):
                                  (0
                                   | SARMODE0_RXVCS_1k
                                   | SARMODE0_ABRVCS_1k 
-                                  | SARMODE0_TXVCS_1k));
+                                  | SARMODE0_TXVCS_1k)));
 
        /* 10ms * 100 is 1 second. That should be enough, as AN3:9 says it takes
           1ms. */
index 0a5f055dffbaa389fd8f4b2f0bfe81fe5a352241..9f50f1b545dc49de323135663628da1566797175 100644 (file)
@@ -88,8 +88,6 @@ extern void driver_detach(struct device_driver *drv);
 extern int driver_probe_device(struct device_driver *drv, struct device *dev);
 
 extern void sysdev_shutdown(void);
-extern int sysdev_suspend(pm_message_t state);
-extern int sysdev_resume(void);
 
 extern char *make_class_name(const char *name, struct kobject *kobj);
 
index 315bed8d5e7fc5e33d1ea10e9f4c084e03428036..1352312391032fcda76f672c5b43a76e5c6df6f0 100644 (file)
  */
 
 #include <linux/device.h>
+#include <linux/delay.h>
 #include <linux/module.h>
 #include <linux/kthread.h>
 #include <linux/wait.h>
+#include <linux/async.h>
 
 #include "base.h"
 #include "power/power.h"
@@ -167,6 +169,21 @@ int driver_probe_done(void)
        return 0;
 }
 
+/**
+ * wait_for_device_probe
+ * Wait for device probing to be completed.
+ *
+ * Note: this function polls at 100 msec intervals.
+ */
+int wait_for_device_probe(void)
+{
+       /* wait for the known devices to complete their probing */
+       while (driver_probe_done() != 0)
+               msleep(100);
+       async_synchronize_full();
+       return 0;
+}
+
 /**
  * driver_probe_device - attempt to bind device & driver together
  * @drv: driver to bind a device to
index 670c9d6c140743a7fac01bcfada07254d4da5016..2d14f4ae6c01da28be636629db5e50b9205b5699 100644 (file)
@@ -333,7 +333,6 @@ static void dpm_power_up(pm_message_t state)
  */
 void device_power_up(pm_message_t state)
 {
-       sysdev_resume();
        dpm_power_up(state);
 }
 EXPORT_SYMBOL_GPL(device_power_up);
@@ -577,8 +576,6 @@ int device_power_down(pm_message_t state)
                }
                dev->power.status = DPM_OFF_IRQ;
        }
-       if (!error)
-               error = sysdev_suspend(state);
        if (error)
                dpm_power_up(resume_event(state));
        return error;
index c98c31ec2f752189e2481a278ed8e7f02cf01985..b428c8c4bc6464177ea32524341e85992346ce3b 100644 (file)
@@ -303,7 +303,6 @@ void sysdev_unregister(struct sys_device * sysdev)
  *     is guaranteed by virtue of the fact that child devices are registered
  *     after their parents.
  */
-
 void sysdev_shutdown(void)
 {
        struct sysdev_class * cls;
@@ -363,7 +362,6 @@ static void __sysdev_resume(struct sys_device *dev)
  *     This is only called by the device PM core, so we let them handle
  *     all synchronization.
  */
-
 int sysdev_suspend(pm_message_t state)
 {
        struct sysdev_class * cls;
@@ -432,7 +430,7 @@ aux_driver:
        }
        return ret;
 }
-
+EXPORT_SYMBOL_GPL(sysdev_suspend);
 
 /**
  *     sysdev_resume - Bring system devices back to life.
@@ -442,7 +440,6 @@ aux_driver:
  *
  *     Note: Interrupts are disabled when called.
  */
-
 int sysdev_resume(void)
 {
        struct sysdev_class * cls;
@@ -463,7 +460,7 @@ int sysdev_resume(void)
        }
        return 0;
 }
-
+EXPORT_SYMBOL_GPL(sysdev_resume);
 
 int __init system_bus_init(void)
 {
index c237527b1aa59880b272a13bc8d0a17d6206ca2a..5e41e6dd657b9a7326ba1347346c8147c428f3c2 100644 (file)
@@ -18,6 +18,7 @@
 enum {
        AOECMD_ATA,
        AOECMD_CFG,
+       AOECMD_VEND_MIN = 0xf0,
 
        AOEFL_RSP = (1<<3),
        AOEFL_ERR = (1<<2),
index 30de5b1c647e80b05007a22f1a4e0b79a38dcad4..c6099ba9a4b895ebabb5905255fd5a3f589145a8 100644 (file)
@@ -142,6 +142,8 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
                aoecmd_cfg_rsp(skb);
                break;
        default:
+               if (h->cmd >= AOECMD_VEND_MIN)
+                       break;  /* don't complain about vendor commands */
                printk(KERN_INFO "aoe: unknown cmd %d\n", h->cmd);
        }
 exit:
index 69e1df7dfa14a4447c6797a0b6f1f6d8c18993fb..4234c11c1e4cfe34592c9830eca7d2a68400b052 100644 (file)
@@ -1730,7 +1730,7 @@ static int __init fd_test_drive_present( int drive )
 
        timeout = jiffies + 2*HZ+HZ/2;
        while (time_before(jiffies, timeout))
-               if (!(mfp.par_dt_reg & 0x20))
+               if (!(st_mfp.par_dt_reg & 0x20))
                        break;
 
        status = FDC_READ( FDCREG_STATUS );
@@ -1747,7 +1747,7 @@ static int __init fd_test_drive_present( int drive )
                /* dummy seek command to make WP bit accessible */
                FDC_WRITE( FDCREG_DATA, 0 );
                FDC_WRITE( FDCREG_CMD, FDCCMD_SEEK );
-               while( mfp.par_dt_reg & 0x20 )
+               while( st_mfp.par_dt_reg & 0x20 )
                        ;
                status = FDC_READ( FDCREG_STATUS );
        }
index 01e69383d9c07ece3df6e56d23b4d3b2bf687475..d2cb67b61176674f7e8df4230f1d807db2190ee3 100644 (file)
@@ -3390,6 +3390,203 @@ static void free_hba(int i)
        kfree(p);
 }
 
+/* Send a message CDB to the firmware. */
+static __devinit int cciss_message(struct pci_dev *pdev, unsigned char opcode, unsigned char type)
+{
+       typedef struct {
+               CommandListHeader_struct CommandHeader;
+               RequestBlock_struct Request;
+               ErrDescriptor_struct ErrorDescriptor;
+       } Command;
+       static const size_t cmd_sz = sizeof(Command) + sizeof(ErrorInfo_struct);
+       Command *cmd;
+       dma_addr_t paddr64;
+       uint32_t paddr32, tag;
+       void __iomem *vaddr;
+       int i, err;
+
+       vaddr = ioremap_nocache(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
+       if (vaddr == NULL)
+               return -ENOMEM;
+
+       /* The Inbound Post Queue only accepts 32-bit physical addresses for the
+          CCISS commands, so they must be allocated from the lower 4GiB of
+          memory. */
+       err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
+       if (err) {
+               iounmap(vaddr);
+               return -ENOMEM;
+       }
+
+       cmd = pci_alloc_consistent(pdev, cmd_sz, &paddr64);
+       if (cmd == NULL) {
+               iounmap(vaddr);
+               return -ENOMEM;
+       }
+
+       /* This must fit, because of the 32-bit consistent DMA mask.  Also,
+          although there's no guarantee, we assume that the address is at
+          least 4-byte aligned (most likely, it's page-aligned). */
+       paddr32 = paddr64;
+
+       cmd->CommandHeader.ReplyQueue = 0;
+       cmd->CommandHeader.SGList = 0;
+       cmd->CommandHeader.SGTotal = 0;
+       cmd->CommandHeader.Tag.lower = paddr32;
+       cmd->CommandHeader.Tag.upper = 0;
+       memset(&cmd->CommandHeader.LUN.LunAddrBytes, 0, 8);
+
+       cmd->Request.CDBLen = 16;
+       cmd->Request.Type.Type = TYPE_MSG;
+       cmd->Request.Type.Attribute = ATTR_HEADOFQUEUE;
+       cmd->Request.Type.Direction = XFER_NONE;
+       cmd->Request.Timeout = 0; /* Don't time out */
+       cmd->Request.CDB[0] = opcode;
+       cmd->Request.CDB[1] = type;
+       memset(&cmd->Request.CDB[2], 0, 14); /* the rest of the CDB is reserved */
+
+       cmd->ErrorDescriptor.Addr.lower = paddr32 + sizeof(Command);
+       cmd->ErrorDescriptor.Addr.upper = 0;
+       cmd->ErrorDescriptor.Len = sizeof(ErrorInfo_struct);
+
+       writel(paddr32, vaddr + SA5_REQUEST_PORT_OFFSET);
+
+       for (i = 0; i < 10; i++) {
+               tag = readl(vaddr + SA5_REPLY_PORT_OFFSET);
+               if ((tag & ~3) == paddr32)
+                       break;
+               schedule_timeout_uninterruptible(HZ);
+       }
+
+       iounmap(vaddr);
+
+       /* we leak the DMA buffer here ... no choice since the controller could
+          still complete the command. */
+       if (i == 10) {
+               printk(KERN_ERR "cciss: controller message %02x:%02x timed out\n",
+                       opcode, type);
+               return -ETIMEDOUT;
+       }
+
+       pci_free_consistent(pdev, cmd_sz, cmd, paddr64);
+
+       if (tag & 2) {
+               printk(KERN_ERR "cciss: controller message %02x:%02x failed\n",
+                       opcode, type);
+               return -EIO;
+       }
+
+       printk(KERN_INFO "cciss: controller message %02x:%02x succeeded\n",
+               opcode, type);
+       return 0;
+}
+
+#define cciss_soft_reset_controller(p) cciss_message(p, 1, 0)
+#define cciss_noop(p) cciss_message(p, 3, 0)
+
+static __devinit int cciss_reset_msi(struct pci_dev *pdev)
+{
+/* the #defines are stolen from drivers/pci/msi.h. */
+#define msi_control_reg(base)          (base + PCI_MSI_FLAGS)
+#define PCI_MSIX_FLAGS_ENABLE          (1 << 15)
+
+       int pos;
+       u16 control = 0;
+
+       pos = pci_find_capability(pdev, PCI_CAP_ID_MSI);
+       if (pos) {
+               pci_read_config_word(pdev, msi_control_reg(pos), &control);
+               if (control & PCI_MSI_FLAGS_ENABLE) {
+                       printk(KERN_INFO "cciss: resetting MSI\n");
+                       pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSI_FLAGS_ENABLE);
+               }
+       }
+
+       pos = pci_find_capability(pdev, PCI_CAP_ID_MSIX);
+       if (pos) {
+               pci_read_config_word(pdev, msi_control_reg(pos), &control);
+               if (control & PCI_MSIX_FLAGS_ENABLE) {
+                       printk(KERN_INFO "cciss: resetting MSI-X\n");
+                       pci_write_config_word(pdev, msi_control_reg(pos), control & ~PCI_MSIX_FLAGS_ENABLE);
+               }
+       }
+
+       return 0;
+}
+
+/* This does a hard reset of the controller using PCI power management
+ * states. */
+static __devinit int cciss_hard_reset_controller(struct pci_dev *pdev)
+{
+       u16 pmcsr, saved_config_space[32];
+       int i, pos;
+
+       printk(KERN_INFO "cciss: using PCI PM to reset controller\n");
+
+       /* This is very nearly the same thing as
+
+          pci_save_state(pci_dev);
+          pci_set_power_state(pci_dev, PCI_D3hot);
+          pci_set_power_state(pci_dev, PCI_D0);
+          pci_restore_state(pci_dev);
+
+          but we can't use these nice canned kernel routines on
+          kexec, because they also check the MSI/MSI-X state in PCI
+          configuration space and do the wrong thing when it is
+          set/cleared.  Also, the pci_save/restore_state functions
+          violate the ordering requirements for restoring the
+          configuration space from the CCISS document (see the
+          comment below).  So we roll our own .... */
+
+       for (i = 0; i < 32; i++)
+               pci_read_config_word(pdev, 2*i, &saved_config_space[i]);
+
+       pos = pci_find_capability(pdev, PCI_CAP_ID_PM);
+       if (pos == 0) {
+               printk(KERN_ERR "cciss_reset_controller: PCI PM not supported\n");
+               return -ENODEV;
+       }
+
+       /* Quoting from the Open CISS Specification: "The Power
+        * Management Control/Status Register (CSR) controls the power
+        * state of the device.  The normal operating state is D0,
+        * CSR=00h.  The software off state is D3, CSR=03h.  To reset
+        * the controller, place the interface device in D3 then to
+        * D0, this causes a secondary PCI reset which will reset the
+        * controller." */
+
+       /* enter the D3hot power management state */
+       pci_read_config_word(pdev, pos + PCI_PM_CTRL, &pmcsr);
+       pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
+       pmcsr |= PCI_D3hot;
+       pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
+
+       schedule_timeout_uninterruptible(HZ >> 1);
+
+       /* enter the D0 power management state */
+       pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
+       pmcsr |= PCI_D0;
+       pci_write_config_word(pdev, pos + PCI_PM_CTRL, pmcsr);
+
+       schedule_timeout_uninterruptible(HZ >> 1);
+
+       /* Restore the PCI configuration space.  The Open CISS
+        * Specification says, "Restore the PCI Configuration
+        * Registers, offsets 00h through 60h. It is important to
+        * restore the command register, 16-bits at offset 04h,
+        * last. Do not restore the configuration status register,
+        * 16-bits at offset 06h."  Note that the offset is 2*i. */
+       for (i = 0; i < 32; i++) {
+               if (i == 2 || i == 3)
+                       continue;
+               pci_write_config_word(pdev, 2*i, saved_config_space[i]);
+       }
+       wmb();
+       pci_write_config_word(pdev, 4, saved_config_space[2]);
+
+       return 0;
+}
+
 /*
  *  This is it.  Find all the controllers and register them.  I really hate
  *  stealing all these major device numbers.
@@ -3404,6 +3601,24 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
        int dac, return_code;
        InquiryData_struct *inq_buff = NULL;
 
+       if (reset_devices) {
+               /* Reset the controller with a PCI power-cycle */
+               if (cciss_hard_reset_controller(pdev) || cciss_reset_msi(pdev))
+                       return -ENODEV;
+
+               /* Some devices (notably the HP Smart Array 5i Controller)
+                  need a little pause here */
+               schedule_timeout_uninterruptible(30*HZ);
+
+               /* Now try to get the controller to respond to a no-op */
+               for (i=0; i<12; i++) {
+                       if (cciss_noop(pdev) == 0)
+                               break;
+                       else
+                               printk("cciss: no-op failed%s\n", (i < 11 ? "; re-trying" : ""));
+               }
+       }
+
        i = alloc_cciss_hba();
        if (i < 0)
                return -1;
index cf29cc4e6ab73d2d95e6d4778f576aae9c98b327..83d8ed39433d058f70896057e52fc4d1e4dc99f3 100644 (file)
@@ -558,6 +558,8 @@ static void process_fd_request(void);
 static void recalibrate_floppy(void);
 static void floppy_shutdown(unsigned long);
 
+static int floppy_request_regions(int);
+static void floppy_release_regions(int);
 static int floppy_grab_irq_and_dma(void);
 static void floppy_release_irq_and_dma(void);
 
@@ -4274,8 +4276,7 @@ static int __init floppy_init(void)
                FDCS->rawcmd = 2;
                if (user_reset_fdc(-1, FD_RESET_ALWAYS, 0)) {
                        /* free ioports reserved by floppy_grab_irq_and_dma() */
-                       release_region(FDCS->address + 2, 4);
-                       release_region(FDCS->address + 7, 1);
+                       floppy_release_regions(fdc);
                        FDCS->address = -1;
                        FDCS->version = FDC_NONE;
                        continue;
@@ -4284,8 +4285,7 @@ static int __init floppy_init(void)
                FDCS->version = get_fdc_version();
                if (FDCS->version == FDC_NONE) {
                        /* free ioports reserved by floppy_grab_irq_and_dma() */
-                       release_region(FDCS->address + 2, 4);
-                       release_region(FDCS->address + 7, 1);
+                       floppy_release_regions(fdc);
                        FDCS->address = -1;
                        continue;
                }
@@ -4358,6 +4358,47 @@ out_put_disk:
 
 static DEFINE_SPINLOCK(floppy_usage_lock);
 
+static const struct io_region {
+       int offset;
+       int size;
+} io_regions[] = {
+       { 2, 1 },
+       /* address + 3 is sometimes reserved by pnp bios for motherboard */
+       { 4, 2 },
+       /* address + 6 is reserved, and may be taken by IDE.
+        * Unfortunately, Adaptec doesn't know this :-(, */
+       { 7, 1 },
+};
+
+static void floppy_release_allocated_regions(int fdc, const struct io_region *p)
+{
+       while (p != io_regions) {
+               p--;
+               release_region(FDCS->address + p->offset, p->size);
+       }
+}
+
+#define ARRAY_END(X) (&((X)[ARRAY_SIZE(X)]))
+
+static int floppy_request_regions(int fdc)
+{
+       const struct io_region *p;
+
+       for (p = io_regions; p < ARRAY_END(io_regions); p++) {
+               if (!request_region(FDCS->address + p->offset, p->size, "floppy")) {
+                       DPRINT("Floppy io-port 0x%04lx in use\n", FDCS->address + p->offset);
+                       floppy_release_allocated_regions(fdc, p);
+                       return -EBUSY;
+               }
+       }
+       return 0;
+}
+
+static void floppy_release_regions(int fdc)
+{
+       floppy_release_allocated_regions(fdc, ARRAY_END(io_regions));
+}
+
 static int floppy_grab_irq_and_dma(void)
 {
        unsigned long flags;
@@ -4399,18 +4440,8 @@ static int floppy_grab_irq_and_dma(void)
 
        for (fdc = 0; fdc < N_FDC; fdc++) {
                if (FDCS->address != -1) {
-                       if (!request_region(FDCS->address + 2, 4, "floppy")) {
-                               DPRINT("Floppy io-port 0x%04lx in use\n",
-                                      FDCS->address + 2);
-                               goto cleanup1;
-                       }
-                       if (!request_region(FDCS->address + 7, 1, "floppy DIR")) {
-                               DPRINT("Floppy io-port 0x%04lx in use\n",
-                                      FDCS->address + 7);
-                               goto cleanup2;
-                       }
-                       /* address + 6 is reserved, and may be taken by IDE.
-                        * Unfortunately, Adaptec doesn't know this :-(, */
+                       if (floppy_request_regions(fdc))
+                               goto cleanup;
                }
        }
        for (fdc = 0; fdc < N_FDC; fdc++) {
@@ -4432,15 +4463,11 @@ static int floppy_grab_irq_and_dma(void)
        fdc = 0;
        irqdma_allocated = 1;
        return 0;
-cleanup2:
-       release_region(FDCS->address + 2, 4);
-cleanup1:
+cleanup:
        fd_free_irq();
        fd_free_dma();
-       while (--fdc >= 0) {
-               release_region(FDCS->address + 2, 4);
-               release_region(FDCS->address + 7, 1);
-       }
+       while (--fdc >= 0)
+               floppy_release_regions(fdc);
        spin_lock_irqsave(&floppy_usage_lock, flags);
        usage_count--;
        spin_unlock_irqrestore(&floppy_usage_lock, flags);
@@ -4501,10 +4528,8 @@ static void floppy_release_irq_and_dma(void)
 #endif
        old_fdc = fdc;
        for (fdc = 0; fdc < N_FDC; fdc++)
-               if (FDCS->address != -1) {
-                       release_region(FDCS->address + 2, 4);
-                       release_region(FDCS->address + 7, 1);
-               }
+               if (FDCS->address != -1)
+                       floppy_release_regions(fdc);
        fdc = old_fdc;
 }
 
index 34f80fa6fed16d379733e3db018f765831e09778..8299e2d3b61163b2d2d82bb8b00ea4495e3000f9 100644 (file)
@@ -549,6 +549,15 @@ static void do_nbd_request(struct request_queue * q)
 
                BUG_ON(lo->magic != LO_MAGIC);
 
+               if (unlikely(!lo->sock)) {
+                       printk(KERN_ERR "%s: Attempted send on closed socket\n",
+                               lo->disk->disk_name);
+                       req->errors++;
+                       nbd_end_request(req);
+                       spin_lock_irq(q->queue_lock);
+                       continue;
+               }
+
                spin_lock_irq(&lo->queue_lock);
                list_add_tail(&req->queuelist, &lo->waiting_queue);
                spin_unlock_irq(&lo->queue_lock);
index 9dfa27163001e9d31de36f5196be7db0f2334a2d..c397b3ddba9b8676293bf773edfa90b29cf3101d 100644 (file)
@@ -422,7 +422,7 @@ static void xs(char *buf, char *targ, int len)
 
        for (k = 0; k < len; k++) {
                char c = *buf++;
-               if (c != ' ' || c != l)
+               if (c != ' ' && c != l)
                        l = *targ++ = c;
        }
        if (l == ' ')
index f5be8081cd8187e87a5e3d85254abefc2be1e85b..735bbe2be51aaf73819078c543320c5fc9111bbc 100644 (file)
@@ -761,7 +761,7 @@ source "drivers/char/hw_random/Kconfig"
 
 config NVRAM
        tristate "/dev/nvram support"
-       depends on ATARI || X86 || ARM || GENERIC_NVRAM
+       depends on ATARI || X86 || (ARM && RTC_DRV_CMOS) || GENERIC_NVRAM
        ---help---
          If you say Y here and create a character special file /dev/nvram
          with major number 10 and minor number 144 using mknod ("man mknod"),
index dc073e167abc68ed14f3dc67332568a845aac429..5608a1e5a3b3416fa44e44e504c9a2817d1c3c2c 100644 (file)
@@ -4311,10 +4311,17 @@ static void hdlcdev_rx(MGSLPC_INFO *info, char *buf, int size)
        dev->stats.rx_bytes += size;
 
        netif_rx(skb);
-
-       dev->last_rx = jiffies;
 }
 
+static const struct net_device_ops hdlcdev_ops = {
+       .ndo_open       = hdlcdev_open,
+       .ndo_stop       = hdlcdev_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = hdlcdev_ioctl,
+       .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
 /**
  * called by device driver when adding device instance
  * do generic HDLC initialization
@@ -4341,11 +4348,8 @@ static int hdlcdev_init(MGSLPC_INFO *info)
        dev->irq       = info->irq_level;
 
        /* network layer callbacks and settings */
-       dev->do_ioctl       = hdlcdev_ioctl;
-       dev->open           = hdlcdev_open;
-       dev->stop           = hdlcdev_close;
-       dev->tx_timeout     = hdlcdev_tx_timeout;
-       dev->watchdog_timeo = 10*HZ;
+       dev->netdev_ops     = &hdlcdev_ops;
+       dev->watchdog_timeo = 10 * HZ;
        dev->tx_queue_len   = 50;
 
        /* generic HDLC layer callbacks and settings */
index 93998f5baff576d9a68dcbd4077aa1ad37be1c95..341b1142bea864228d0b42a00fb64824d2afc6ca 100644 (file)
@@ -387,7 +387,7 @@ struct scc_port {
 /* The SCC needs 3.5 PCLK cycles recovery time between to register
  * accesses. PCLK runs with 8 MHz on an Atari, so this delay is 3.5 *
  * 125 ns = 437.5 ns. This is too short for udelay().
- * 10/16/95: A tstb mfp.par_dt_reg takes 600ns (sure?) and thus should be
+ * 10/16/95: A tstb st_mfp.par_dt_reg takes 600ns (sure?) and thus should be
  * quite right
  */
 
index b60be7b0decf277f3220898a27906ed0c4d7e79b..518f2a25d91ec6b1a208c6fe233c505a7395aa47 100644 (file)
@@ -1713,8 +1713,8 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
                for (i = 0; i < SX_NBOARDS; i++)
                        sx_dprintk(SX_DEBUG_FIRMWARE, "<%x> ", boards[i].flags);
                sx_dprintk(SX_DEBUG_FIRMWARE, "\n");
-               unlock_kernel();
-               return -EIO;
+               rc = -EIO;
+               goto out;
        }
 
        switch (cmd) {
@@ -1746,8 +1746,10 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
                sx_dprintk(SX_DEBUG_FIRMWARE, "returning type= %ld\n", rc);
                break;
        case SXIO_DO_RAMTEST:
-               if (sx_initialized)     /* Already initialized: better not ramtest the board.  */
-                       return -EPERM;
+               if (sx_initialized) {   /* Already initialized: better not ramtest the board.  */
+                       rc = -EPERM;
+                       break;
+               }
                if (IS_SX_BOARD(board)) {
                        rc = do_memtest(board, 0, 0x7000);
                        if (!rc)
@@ -1787,7 +1789,7 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
                                                nbytes - i : SX_CHUNK_SIZE)) {
                                        kfree(tmp);
                                        rc = -EFAULT;
-                                       break;
+                                       goto out;
                                }
                                memcpy_toio(board->base2 + offset + i, tmp,
                                                (i + SX_CHUNK_SIZE > nbytes) ?
@@ -1844,6 +1846,7 @@ static long sx_fw_ioctl(struct file *filp, unsigned int cmd,
                rc = -ENOTTY;
                break;
        }
+out:
        unlock_kernel();
        func_exit();
        return rc;
index b8063d4cad32ce9c122b051f9560656046864205..0057a8f58cb1261c71b48db67f1562d74282ee59 100644 (file)
@@ -8007,10 +8007,17 @@ static void hdlcdev_rx(struct mgsl_struct *info, char *buf, int size)
        dev->stats.rx_bytes += size;
 
        netif_rx(skb);
-
-       dev->last_rx = jiffies;
 }
 
+static const struct net_device_ops hdlcdev_ops = {
+       .ndo_open       = hdlcdev_open,
+       .ndo_stop       = hdlcdev_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = hdlcdev_ioctl,
+       .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
 /**
  * called by device driver when adding device instance
  * do generic HDLC initialization
@@ -8038,11 +8045,8 @@ static int hdlcdev_init(struct mgsl_struct *info)
        dev->dma       = info->dma_level;
 
        /* network layer callbacks and settings */
-       dev->do_ioctl       = hdlcdev_ioctl;
-       dev->open           = hdlcdev_open;
-       dev->stop           = hdlcdev_close;
-       dev->tx_timeout     = hdlcdev_tx_timeout;
-       dev->watchdog_timeo = 10*HZ;
+       dev->netdev_ops     = &hdlcdev_ops;
+       dev->watchdog_timeo = 10 * HZ;
        dev->tx_queue_len   = 50;
 
        /* generic HDLC layer callbacks and settings */
index f329f459817cb41bb4cb1ffb0c2ac6b08278ea3c..efb3dc928a43a7b6fe26bcfc551511f84d601772 100644 (file)
@@ -1763,10 +1763,17 @@ static void hdlcdev_rx(struct slgt_info *info, char *buf, int size)
        dev->stats.rx_bytes += size;
 
        netif_rx(skb);
-
-       dev->last_rx = jiffies;
 }
 
+static const struct net_device_ops hdlcdev_ops = {
+       .ndo_open       = hdlcdev_open,
+       .ndo_stop       = hdlcdev_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = hdlcdev_ioctl,
+       .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
 /**
  * called by device driver when adding device instance
  * do generic HDLC initialization
@@ -1794,11 +1801,8 @@ static int hdlcdev_init(struct slgt_info *info)
        dev->irq       = info->irq_level;
 
        /* network layer callbacks and settings */
-       dev->do_ioctl       = hdlcdev_ioctl;
-       dev->open           = hdlcdev_open;
-       dev->stop           = hdlcdev_close;
-       dev->tx_timeout     = hdlcdev_tx_timeout;
-       dev->watchdog_timeo = 10*HZ;
+       dev->netdev_ops     = &hdlcdev_ops;
+       dev->watchdog_timeo = 10 * HZ;
        dev->tx_queue_len   = 50;
 
        /* generic HDLC layer callbacks and settings */
index 7b0c5b2dd2635cbefbb9a919158aba8d5cef9a0b..8eb6c89a980ec1cb674eef7fe83e42142ea4d5cf 100644 (file)
@@ -1907,10 +1907,17 @@ static void hdlcdev_rx(SLMP_INFO *info, char *buf, int size)
        dev->stats.rx_bytes += size;
 
        netif_rx(skb);
-
-       dev->last_rx = jiffies;
 }
 
+static const struct net_device_ops hdlcdev_ops = {
+       .ndo_open       = hdlcdev_open,
+       .ndo_stop       = hdlcdev_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = hdlcdev_ioctl,
+       .ndo_tx_timeout = hdlcdev_tx_timeout,
+};
+
 /**
  * called by device driver when adding device instance
  * do generic HDLC initialization
@@ -1938,11 +1945,8 @@ static int hdlcdev_init(SLMP_INFO *info)
        dev->irq       = info->irq_level;
 
        /* network layer callbacks and settings */
-       dev->do_ioctl       = hdlcdev_ioctl;
-       dev->open           = hdlcdev_open;
-       dev->stop           = hdlcdev_close;
-       dev->tx_timeout     = hdlcdev_tx_timeout;
-       dev->watchdog_timeo = 10*HZ;
+       dev->netdev_ops     = &hdlcdev_ops;
+       dev->watchdog_timeo = 10 * HZ;
        dev->tx_queue_len   = 50;
 
        /* generic HDLC layer callbacks and settings */
index 726ee8a0277fe6fbefebd58e93c28da5713d9f9a..ecba4942fc8e313db48152b4818c0ff935a9a870 100644 (file)
@@ -4,7 +4,7 @@
  * SLD 9630 TT 1.1 and SLB 9635 TT 1.2 Trusted Platform Module
  * Specifications at www.trustedcomputinggroup.org
  *
- * Copyright (C) 2005, Marcel Selhorst <selhorst@crypto.rub.de>
+ * Copyright (C) 2005, Marcel Selhorst <m.selhorst@sirrix.com>
  * Sirrix AG - security technologies, http://www.sirrix.com and
  * Applied Data Security Group, Ruhr-University Bochum, Germany
  * Project-Homepage: http://www.prosec.rub.de/tpm
@@ -636,7 +636,7 @@ static void __exit cleanup_inf(void)
 module_init(init_inf);
 module_exit(cleanup_inf);
 
-MODULE_AUTHOR("Marcel Selhorst <selhorst@crypto.rub.de>");
+MODULE_AUTHOR("Marcel Selhorst <m.selhorst@sirrix.com>");
 MODULE_DESCRIPTION("Driver for Infineon TPM SLD 9630 TT 1.1 / SLB 9635 TT 1.2");
 MODULE_VERSION("1.9");
 MODULE_LICENSE("GPL");
index b6fe7e7a2c2fd71e6818a850fd6b8adbfd613bf5..c769ef269fb5833e96b3ac32ece432c4ce1de564 100644 (file)
@@ -1,9 +1,9 @@
 /*
  *     cn_queue.c
- * 
+ *
  * 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
  * All rights reserved.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
 #include <linux/connector.h>
 #include <linux/delay.h>
 
+
+/*
+ * This job is sent to the kevent workqueue.
+ * While no event is once sent to any callback, the connector workqueue
+ * is not created to avoid a useless waiting kernel task.
+ * Once the first event is received, we create this dedicated workqueue which
+ * is necessary because the flow of data can be high and we don't want
+ * to encumber keventd with that.
+ */
+static void cn_queue_create(struct work_struct *work)
+{
+       struct cn_queue_dev *dev;
+
+       dev = container_of(work, struct cn_queue_dev, wq_creation);
+
+       dev->cn_queue = create_singlethread_workqueue(dev->name);
+       /* If we fail, we will use keventd for all following connector jobs */
+       WARN_ON(!dev->cn_queue);
+}
+
+/*
+ * Queue a data sent to a callback.
+ * If the connector workqueue is already created, we queue the job on it.
+ * Otherwise, we queue the job to kevent and queue the connector workqueue
+ * creation too.
+ */
+int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work)
+{
+       struct cn_queue_dev *pdev = cbq->pdev;
+
+       if (likely(pdev->cn_queue))
+               return queue_work(pdev->cn_queue, work);
+
+       /* Don't create the connector workqueue twice */
+       if (atomic_inc_return(&pdev->wq_requested) == 1)
+               schedule_work(&pdev->wq_creation);
+       else
+               atomic_dec(&pdev->wq_requested);
+
+       return schedule_work(work);
+}
+
 void cn_queue_wrapper(struct work_struct *work)
 {
        struct cn_callback_entry *cbq =
@@ -58,14 +100,17 @@ static struct cn_callback_entry *cn_queue_alloc_callback_entry(char *name, struc
        snprintf(cbq->id.name, sizeof(cbq->id.name), "%s", name);
        memcpy(&cbq->id.id, id, sizeof(struct cb_id));
        cbq->data.callback = callback;
-       
+
        INIT_WORK(&cbq->work, &cn_queue_wrapper);
        return cbq;
 }
 
 static void cn_queue_free_callback(struct cn_callback_entry *cbq)
 {
-       flush_workqueue(cbq->pdev->cn_queue);
+       /* The first jobs have been sent to kevent, flush them too */
+       flush_scheduled_work();
+       if (cbq->pdev->cn_queue)
+               flush_workqueue(cbq->pdev->cn_queue);
 
        kfree(cbq);
 }
@@ -143,14 +188,11 @@ struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *nls)
        atomic_set(&dev->refcnt, 0);
        INIT_LIST_HEAD(&dev->queue_list);
        spin_lock_init(&dev->queue_lock);
+       init_waitqueue_head(&dev->wq_created);
 
        dev->nls = nls;
 
-       dev->cn_queue = create_singlethread_workqueue(dev->name);
-       if (!dev->cn_queue) {
-               kfree(dev);
-               return NULL;
-       }
+       INIT_WORK(&dev->wq_creation, cn_queue_create);
 
        return dev;
 }
@@ -158,9 +200,25 @@ struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *nls)
 void cn_queue_free_dev(struct cn_queue_dev *dev)
 {
        struct cn_callback_entry *cbq, *n;
+       long timeout;
+       DEFINE_WAIT(wait);
+
+       /* Flush the first pending jobs queued on kevent */
+       flush_scheduled_work();
+
+       /* If the connector workqueue creation is still pending, wait for it */
+       prepare_to_wait(&dev->wq_created, &wait, TASK_UNINTERRUPTIBLE);
+       if (atomic_read(&dev->wq_requested) && !dev->cn_queue) {
+               timeout = schedule_timeout(HZ * 2);
+               if (!timeout && !dev->cn_queue)
+                       WARN_ON(1);
+       }
+       finish_wait(&dev->wq_created, &wait);
 
-       flush_workqueue(dev->cn_queue);
-       destroy_workqueue(dev->cn_queue);
+       if (dev->cn_queue) {
+               flush_workqueue(dev->cn_queue);
+               destroy_workqueue(dev->cn_queue);
+       }
 
        spin_lock_bh(&dev->queue_lock);
        list_for_each_entry_safe(cbq, n, &dev->queue_list, callback_entry)
index bf4830082a135e126d9f35f1a72a7bf5b18fbecf..fd336c5a9057a8da729ebd2d3961cbb7b6a4c271 100644 (file)
@@ -1,9 +1,9 @@
 /*
  *     connector.c
- * 
+ *
  * 2004-2005 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
  * All rights reserved.
- * 
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -145,14 +145,13 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
                                __cbq->data.ddata = data;
                                __cbq->data.destruct_data = destruct_data;
 
-                               if (queue_work(dev->cbdev->cn_queue,
-                                                       &__cbq->work))
+                               if (queue_cn_work(__cbq, &__cbq->work))
                                        err = 0;
                                else
                                        err = -EINVAL;
                        } else {
                                struct cn_callback_data *d;
-                               
+
                                err = -ENOMEM;
                                __new_cbq = kzalloc(sizeof(struct cn_callback_entry), GFP_ATOMIC);
                                if (__new_cbq) {
@@ -163,10 +162,12 @@ static int cn_call_callback(struct cn_msg *msg, void (*destruct_data)(void *), v
                                        d->destruct_data = destruct_data;
                                        d->free = __new_cbq;
 
+                                       __new_cbq->pdev = __cbq->pdev;
+
                                        INIT_WORK(&__new_cbq->work,
                                                        &cn_queue_wrapper);
 
-                                       if (queue_work(dev->cbdev->cn_queue,
+                                       if (queue_cn_work(__new_cbq,
                                                    &__new_cbq->work))
                                                err = 0;
                                        else {
@@ -237,7 +238,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event)
 
                req = (struct cn_notify_req *)ctl->data;
                for (i = 0; i < ctl->idx_notify_num; ++i, ++req) {
-                       if (id->idx >= req->first && 
+                       if (id->idx >= req->first &&
                                        id->idx < req->first + req->range) {
                                idx_found = 1;
                                break;
@@ -245,7 +246,7 @@ static void cn_notify(struct cb_id *id, u32 notify_event)
                }
 
                for (i = 0; i < ctl->val_notify_num; ++i, ++req) {
-                       if (id->val >= req->first && 
+                       if (id->val >= req->first &&
                                        id->val < req->first + req->range) {
                                val_found = 1;
                                break;
@@ -459,7 +460,7 @@ static int __devinit cn_init(void)
                netlink_kernel_release(dev->nls);
                return -EINVAL;
        }
-       
+
        cn_already_initialized = 1;
 
        err = cn_add_callback(&dev->id, "connector", &cn_callback);
index 6a2b036c93894fa3307dd4aebf8505e30c1178ea..6f45b1658a67d0bee41c5156cdca709e639d0b67 100644 (file)
@@ -117,11 +117,7 @@ static inline cputime64_t get_cpu_idle_time_jiffy(unsigned int cpu,
        busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.irq);
        busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.softirq);
        busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.steal);
-
-       if (!dbs_tuners_ins.ignore_nice) {
-               busy_time = cputime64_add(busy_time,
-                               kstat_cpu(cpu).cpustat.nice);
-       }
+       busy_time = cputime64_add(busy_time, kstat_cpu(cpu).cpustat.nice);
 
        idle_time = cputime64_sub(cur_wall_time, busy_time);
        if (wall)
@@ -137,23 +133,6 @@ static inline cputime64_t get_cpu_idle_time(unsigned int cpu, cputime64_t *wall)
        if (idle_time == -1ULL)
                return get_cpu_idle_time_jiffy(cpu, wall);
 
-       if (dbs_tuners_ins.ignore_nice) {
-               cputime64_t cur_nice;
-               unsigned long cur_nice_jiffies;
-               struct cpu_dbs_info_s *dbs_info;
-
-               dbs_info = &per_cpu(cpu_dbs_info, cpu);
-               cur_nice = cputime64_sub(kstat_cpu(cpu).cpustat.nice,
-                                        dbs_info->prev_cpu_nice);
-               /*
-                * Assumption: nice time between sampling periods will be
-                * less than 2^32 jiffies for 32 bit sys
-                */
-               cur_nice_jiffies = (unsigned long)
-                                       cputime64_to_jiffies64(cur_nice);
-               dbs_info->prev_cpu_nice = kstat_cpu(cpu).cpustat.nice;
-               return idle_time + jiffies_to_usecs(cur_nice_jiffies);
-       }
        return idle_time;
 }
 
@@ -319,6 +298,9 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
                dbs_info = &per_cpu(cpu_dbs_info, j);
                dbs_info->prev_cpu_idle = get_cpu_idle_time(j,
                                                &dbs_info->prev_cpu_wall);
+               if (dbs_tuners_ins.ignore_nice)
+                       dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice;
+
        }
        mutex_unlock(&dbs_mutex);
 
@@ -419,6 +401,23 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
                                j_dbs_info->prev_cpu_idle);
                j_dbs_info->prev_cpu_idle = cur_idle_time;
 
+               if (dbs_tuners_ins.ignore_nice) {
+                       cputime64_t cur_nice;
+                       unsigned long cur_nice_jiffies;
+
+                       cur_nice = cputime64_sub(kstat_cpu(j).cpustat.nice,
+                                        j_dbs_info->prev_cpu_nice);
+                       /*
+                        * Assumption: nice time between sampling periods will
+                        * be less than 2^32 jiffies for 32 bit sys
+                        */
+                       cur_nice_jiffies = (unsigned long)
+                                       cputime64_to_jiffies64(cur_nice);
+
+                       j_dbs_info->prev_cpu_nice = kstat_cpu(j).cpustat.nice;
+                       idle_time += jiffies_to_usecs(cur_nice_jiffies);
+               }
+
                if (unlikely(!wall_time || wall_time < idle_time))
                        continue;
 
@@ -575,6 +574,10 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
 
                        j_dbs_info->prev_cpu_idle = get_cpu_idle_time(j,
                                                &j_dbs_info->prev_cpu_wall);
+                       if (dbs_tuners_ins.ignore_nice) {
+                               j_dbs_info->prev_cpu_nice =
+                                               kstat_cpu(j).cpustat.nice;
+                       }
                }
                this_dbs_info->cpu = cpu;
                /*
index a58993011edb4bc369a39b6caed0a93f62dc44a8..280a9d263eb3c4271d1cff6e55448cae0a93b387 100644 (file)
@@ -518,6 +518,7 @@ struct dma_chan *__dma_request_channel(dma_cap_mask_t *mask, dma_filter_fn fn, v
                                       dma_chan_name(chan), err);
                        else
                                break;
+                       chan->private = NULL;
                        chan = NULL;
                }
        }
@@ -536,6 +537,7 @@ void dma_release_channel(struct dma_chan *chan)
        WARN_ONCE(chan->client_count != 1,
                  "chan reference count %d != 1\n", chan->client_count);
        dma_chan_put(chan);
+       chan->private = NULL;
        mutex_unlock(&dma_list_mutex);
 }
 EXPORT_SYMBOL_GPL(dma_release_channel);
index 6b702cc46b3d1c36d4a7bdd19228f7c253f35ca8..a97c07eef7ec92468c24150669e690033f310a4f 100644 (file)
@@ -560,7 +560,7 @@ dwc_prep_slave_sg(struct dma_chan *chan, struct scatterlist *sgl,
                unsigned long flags)
 {
        struct dw_dma_chan      *dwc = to_dw_dma_chan(chan);
-       struct dw_dma_slave     *dws = dwc->dws;
+       struct dw_dma_slave     *dws = chan->private;
        struct dw_desc          *prev;
        struct dw_desc          *first;
        u32                     ctllo;
@@ -790,7 +790,7 @@ static int dwc_alloc_chan_resources(struct dma_chan *chan)
        cfghi = DWC_CFGH_FIFO_MODE;
        cfglo = 0;
 
-       dws = dwc->dws;
+       dws = chan->private;
        if (dws) {
                /*
                 * We need controller-specific data to set up slave
@@ -866,7 +866,6 @@ static void dwc_free_chan_resources(struct dma_chan *chan)
        spin_lock_bh(&dwc->lock);
        list_splice_init(&dwc->free_list, &list);
        dwc->descs_allocated = 0;
-       dwc->dws = NULL;
 
        /* Disable interrupts */
        channel_clear_bit(dw, MASK.XFER, dwc->mask);
index 00fdd187bb0cf7ddbb5188cc33097f9739ee4ea7..b252b202c5cf1888f65149d3e22deee3d9cfeef0 100644 (file)
@@ -139,8 +139,6 @@ struct dw_dma_chan {
        struct list_head        queue;
        struct list_head        free_list;
 
-       struct dw_dma_slave     *dws;
-
        unsigned int            descs_allocated;
 };
 
index 7be2cf3514e71e06164ec64d2aa8a97eaacdca44..a5dd7a665aa89e1551dd89653af01234a0d2adc8 100644 (file)
@@ -412,6 +412,7 @@ fw_card_add(struct fw_card *card,
 {
        u32 *config_rom;
        size_t length;
+       int err;
 
        card->max_receive = max_receive;
        card->link_speed = link_speed;
@@ -422,7 +423,13 @@ fw_card_add(struct fw_card *card,
        list_add_tail(&card->link, &card_list);
        mutex_unlock(&card_mutex);
 
-       return card->driver->enable(card, config_rom, length);
+       err = card->driver->enable(card, config_rom, length);
+       if (err < 0) {
+               mutex_lock(&card_mutex);
+               list_del(&card->link);
+               mutex_unlock(&card_mutex);
+       }
+       return err;
 }
 EXPORT_SYMBOL(fw_card_add);
 
index 261b9aa3f248e6c2df0c67d5492b35586cf1bb96..05aa2d406ac64769ecfbb3f6827d5e7fb53915e3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * linux/drivers/firmware/memmap.c
  *  Copyright (C) 2008 SUSE LINUX Products GmbH
- *  by Bernhard Walle <bwalle@suse.de>
+ *  by Bernhard Walle <bernhard.walle@gmx.de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License v2.0 as published by
index 5130b72d593c5726e34263ad0d63eb248b1265f6..3a22eb9be3783ac890514980e4ea7939c0a38e31 100644 (file)
@@ -70,7 +70,7 @@ config DRM_I915
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
        select FB_CFB_IMAGEBLIT
-       depends on FB
+       select FB
        tristate "i915 driver"
        help
          Choose this option if you have a system that has Intel 830M, 845G,
@@ -80,18 +80,17 @@ config DRM_I915
          XFree86 4.4 and above. If unsure, build this and i830 as modules and
          the X server will load the correct one.
 
-endchoice
-
 config DRM_I915_KMS
        bool "Enable modesetting on intel by default"
        depends on DRM_I915
        help
-       Choose this option if you want kernel modesetting enabled by default,
-       and you have a new enough userspace to support this. Running old
-       userspaces with this enabled will cause pain.  Note that this causes
-       the driver to bind to PCI devices, which precludes loading things
-       like intelfb.
+         Choose this option if you want kernel modesetting enabled by default,
+         and you have a new enough userspace to support this. Running old
+         userspaces with this enabled will cause pain.  Note that this causes
+         the driver to bind to PCI devices, which precludes loading things
+         like intelfb.
 
+endchoice
 
 config DRM_MGA
        tristate "Matrox g200/g400"
index bfce0992fefbcaa3c3b6848f3e440f88577b2af7..94a76887173444f0e8390014a0ff586eefbea8f8 100644 (file)
@@ -1741,9 +1741,8 @@ out:
  * RETURNS:
  * Zero on success, errno on failure.
  */
-void drm_fb_release(struct file *filp)
+void drm_fb_release(struct drm_file *priv)
 {
-       struct drm_file *priv = filp->private_data;
        struct drm_device *dev = priv->minor->dev;
        struct drm_framebuffer *fb, *tfb;
 
index 964c5eb1fada4266795056abbad038ac23463dd7..733028b4d45e413e9d1689cd73a5fdec0618a982 100644 (file)
@@ -512,8 +512,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
        if (drm_mode_equal(&saved_mode, &crtc->mode)) {
                if (saved_x != crtc->x || saved_y != crtc->y ||
                    depth_changed || bpp_changed) {
-                       crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y,
-                                                 old_fb);
+                       ret = !crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y,
+                                                        old_fb);
                        goto done;
                }
        }
@@ -552,7 +552,9 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
        /* Set up the DPLL and any encoders state that needs to adjust or depend
         * on the DPLL.
         */
-       crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb);
+       ret = !crtc_funcs->mode_set(crtc, mode, adjusted_mode, x, y, old_fb);
+       if (!ret)
+           goto done;
 
        list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
 
@@ -752,6 +754,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
                        if (!drm_crtc_helper_set_mode(set->crtc, set->mode,
                                                      set->x, set->y,
                                                      old_fb)) {
+                               DRM_ERROR("failed to set mode on crtc %p\n",
+                                         set->crtc);
                                ret = -EINVAL;
                                goto fail_set_mode;
                        }
@@ -765,7 +769,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
                old_fb = set->crtc->fb;
                if (set->crtc->fb != set->fb)
                        set->crtc->fb = set->fb;
-               crtc_funcs->mode_set_base(set->crtc, set->x, set->y, old_fb);
+               ret = crtc_funcs->mode_set_base(set->crtc,
+                                               set->x, set->y, old_fb);
+               if (ret != 0)
+                   goto fail_set_mode;
        }
 
        kfree(save_encoders);
@@ -775,8 +782,12 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
 fail_set_mode:
        set->crtc->enabled = save_enabled;
        count = 0;
-       list_for_each_entry(connector, &dev->mode_config.connector_list, head)
+       list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+               if (!connector->encoder)
+                       continue;
+
                connector->encoder->crtc = save_crtcs[count++];
+       }
 fail_no_encoder:
        kfree(save_crtcs);
        count = 0;
index b06a53715853af03df4717108106a72c1effdba5..6c020fe5431ca5eea366e60fd9560f5096e6da58 100644 (file)
@@ -457,6 +457,9 @@ int drm_release(struct inode *inode, struct file *filp)
        if (dev->driver->driver_features & DRIVER_GEM)
                drm_gem_release(dev, file_priv);
 
+       if (dev->driver->driver_features & DRIVER_MODESET)
+               drm_fb_release(file_priv);
+
        mutex_lock(&dev->ctxlist_mutex);
        if (!list_empty(&dev->ctxlist)) {
                struct drm_ctx_list *pos, *n;
index 6915fb82d0b0ea6aaa4a5c82b1ac5cf61b572e74..88d3368ffddd946974ba9a42ac273810f9c68c21 100644 (file)
@@ -104,8 +104,8 @@ drm_gem_init(struct drm_device *dev)
 
        if (drm_mm_init(&mm->offset_manager, DRM_FILE_PAGE_OFFSET_START,
                        DRM_FILE_PAGE_OFFSET_SIZE)) {
-               drm_free(mm, sizeof(struct drm_gem_mm), DRM_MEM_MM);
                drm_ht_remove(&mm->offset_hash);
+               drm_free(mm, sizeof(struct drm_gem_mm), DRM_MEM_MM);
                return -ENOMEM;
        }
 
@@ -295,35 +295,37 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
                return -EBADF;
 
 again:
-       if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0)
-               return -ENOMEM;
+       if (idr_pre_get(&dev->object_name_idr, GFP_KERNEL) == 0) {
+               ret = -ENOMEM;
+               goto err;
+       }
 
        spin_lock(&dev->object_name_lock);
-       if (obj->name) {
-               args->name = obj->name;
+       if (!obj->name) {
+               ret = idr_get_new_above(&dev->object_name_idr, obj, 1,
+                                       &obj->name);
+               args->name = (uint64_t) obj->name;
                spin_unlock(&dev->object_name_lock);
-               return 0;
-       }
-       ret = idr_get_new_above(&dev->object_name_idr, obj, 1,
-                                &obj->name);
-       spin_unlock(&dev->object_name_lock);
-       if (ret == -EAGAIN)
-               goto again;
 
-       if (ret != 0) {
-               mutex_lock(&dev->struct_mutex);
-               drm_gem_object_unreference(obj);
-               mutex_unlock(&dev->struct_mutex);
-               return ret;
-       }
+               if (ret == -EAGAIN)
+                       goto again;
 
-       /*
-        * Leave the reference from the lookup around as the
-        * name table now holds one
-        */
-       args->name = (uint64_t) obj->name;
+               if (ret != 0)
+                       goto err;
 
-       return 0;
+               /* Allocate a reference for the name table.  */
+               drm_gem_object_reference(obj);
+       } else {
+               args->name = (uint64_t) obj->name;
+               spin_unlock(&dev->object_name_lock);
+               ret = 0;
+       }
+
+err:
+       mutex_lock(&dev->struct_mutex);
+       drm_gem_object_unreference(obj);
+       mutex_unlock(&dev->struct_mutex);
+       return ret;
 }
 
 /**
@@ -448,6 +450,7 @@ drm_gem_object_handle_free(struct kref *kref)
        spin_lock(&dev->object_name_lock);
        if (obj->name) {
                idr_remove(&dev->object_name_idr, obj->name);
+               obj->name = 0;
                spin_unlock(&dev->object_name_lock);
                /*
                 * The object name held a reference to this object, drop
@@ -460,6 +463,26 @@ drm_gem_object_handle_free(struct kref *kref)
 }
 EXPORT_SYMBOL(drm_gem_object_handle_free);
 
+void drm_gem_vm_open(struct vm_area_struct *vma)
+{
+       struct drm_gem_object *obj = vma->vm_private_data;
+
+       drm_gem_object_reference(obj);
+}
+EXPORT_SYMBOL(drm_gem_vm_open);
+
+void drm_gem_vm_close(struct vm_area_struct *vma)
+{
+       struct drm_gem_object *obj = vma->vm_private_data;
+       struct drm_device *dev = obj->dev;
+
+       mutex_lock(&dev->struct_mutex);
+       drm_gem_object_unreference(obj);
+       mutex_unlock(&dev->struct_mutex);
+}
+EXPORT_SYMBOL(drm_gem_vm_close);
+
+
 /**
  * drm_gem_mmap - memory map routine for GEM objects
  * @filp: DRM file pointer
@@ -521,6 +544,14 @@ int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma)
 #endif
        vma->vm_page_prot = __pgprot(prot);
 
+       /* Take a ref for this mapping of the object, so that the fault
+        * handler can dereference the mmap offset's pointer to the object.
+        * This reference is cleaned up by the corresponding vm_close
+        * (which should happen whether the vma was created by this call, or
+        * by a vm_open due to mremap or partial unmap or whatever).
+        */
+       drm_gem_object_reference(obj);
+
        vma->vm_file = filp;    /* Needed for drm_vm_open() */
        drm_vm_open_locked(vma);
 
index 69aa0ab284030a26a0cc3dbbecea34ec49f9ca83..3795dbc0f50cff99b167fc0659f0d0862c8d57d5 100644 (file)
@@ -276,6 +276,7 @@ int drm_irq_uninstall(struct drm_device * dev)
        for (i = 0; i < dev->num_crtcs; i++) {
                DRM_WAKEUP(&dev->vbl_queue[i]);
                dev->vblank_enabled[i] = 0;
+               dev->last_vblank[i] = dev->driver->get_vblank_counter(dev, i);
        }
        spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
 
index 803bc9e7ce3c8639f026d3479b5ec2217a84802d..bcc869bc409260c2add316ecead05fb68568d747 100644 (file)
@@ -171,9 +171,14 @@ EXPORT_SYMBOL(drm_core_ioremap);
 
 void drm_core_ioremap_wc(struct drm_map *map, struct drm_device *dev)
 {
-       map->handle = ioremap_wc(map->offset, map->size);
+       if (drm_core_has_AGP(dev) &&
+           dev->agp && dev->agp->cant_use_aperture && map->type == _DRM_AGP)
+               map->handle = agp_remap(map->offset, map->size, dev);
+       else
+               map->handle = ioremap_wc(map->offset, map->size);
 }
 EXPORT_SYMBOL(drm_core_ioremap_wc);
+
 void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev)
 {
        if (!map->handle || !map->size)
index ee64b7301f6722300bc4362ac5c84010e9355562..2d797ffe8137c43472f08a3019ecb2052d664ec6 100644 (file)
@@ -202,7 +202,7 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
                dev_priv->ring.map.flags = 0;
                dev_priv->ring.map.mtrr = 0;
 
-               drm_core_ioremap(&dev_priv->ring.map, dev);
+               drm_core_ioremap_wc(&dev_priv->ring.map, dev);
 
                if (dev_priv->ring.map.handle == NULL) {
                        i915_dma_cleanup(dev);
@@ -731,8 +731,11 @@ static int i915_getparam(struct drm_device *dev, void *data,
        case I915_PARAM_HAS_GEM:
                value = dev_priv->has_gem;
                break;
+       case I915_PARAM_NUM_FENCES_AVAIL:
+               value = dev_priv->num_fence_regs - dev_priv->fence_reg_start;
+               break;
        default:
-               DRM_ERROR("Unknown parameter %d\n", param->param);
+               DRM_DEBUG("Unknown parameter %d\n", param->param);
                return -EINVAL;
        }
 
@@ -764,8 +767,15 @@ static int i915_setparam(struct drm_device *dev, void *data,
        case I915_SETPARAM_ALLOW_BATCHBUFFER:
                dev_priv->allow_batchbuffer = param->value;
                break;
+       case I915_SETPARAM_NUM_USED_FENCES:
+               if (param->value > dev_priv->num_fence_regs ||
+                   param->value < 0)
+                       return -EINVAL;
+               /* Userspace can use first N regs */
+               dev_priv->fence_reg_start = param->value;
+               break;
        default:
-               DRM_ERROR("unknown parameter %d\n", param->param);
+               DRM_DEBUG("unknown parameter %d\n", param->param);
                return -EINVAL;
        }
 
@@ -966,10 +976,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
        if (ret)
                goto kfree_devname;
 
-        dev_priv->mm.gtt_mapping =
-               io_mapping_create_wc(dev->agp->base,
-                                    dev->agp->agp_info.aper_size * 1024*1024);
-
        /* Allow hardware batchbuffers unless told otherwise.
         */
        dev_priv->allow_batchbuffer = 1;
@@ -1081,6 +1087,23 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
                goto free_priv;
        }
 
+        dev_priv->mm.gtt_mapping =
+               io_mapping_create_wc(dev->agp->base,
+                                    dev->agp->agp_info.aper_size * 1024*1024);
+       /* Set up a WC MTRR for non-PAT systems.  This is more common than
+        * one would think, because the kernel disables PAT on first
+        * generation Core chips because WC PAT gets overridden by a UC
+        * MTRR if present.  Even if a UC MTRR isn't present.
+        */
+       dev_priv->mm.gtt_mtrr = mtrr_add(dev->agp->base,
+                                        dev->agp->agp_info.aper_size *
+                                        1024 * 1024,
+                                        MTRR_TYPE_WRCOMB, 1);
+       if (dev_priv->mm.gtt_mtrr < 0) {
+               DRM_INFO("MTRR allocation failed\n.  Graphics "
+                        "performance may suffer.\n");
+       }
+
 #ifdef CONFIG_HIGHMEM64G
        /* don't enable GEM on PAE - needs agp + set_memory_* interface fixes */
        dev_priv->has_gem = 0;
@@ -1089,6 +1112,10 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
        dev_priv->has_gem = 1;
 #endif
 
+       dev->driver->get_vblank_counter = i915_get_vblank_counter;
+       if (IS_GM45(dev))
+               dev->driver->get_vblank_counter = gm45_get_vblank_counter;
+
        i915_gem_load(dev);
 
        /* Init HWS */
@@ -1145,8 +1172,14 @@ int i915_driver_unload(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
 
+       io_mapping_free(dev_priv->mm.gtt_mapping);
+       if (dev_priv->mm.gtt_mtrr >= 0) {
+               mtrr_del(dev_priv->mm.gtt_mtrr, dev->agp->base,
+                        dev->agp->agp_info.aper_size * 1024 * 1024);
+               dev_priv->mm.gtt_mtrr = -1;
+       }
+
        if (drm_core_check_feature(dev, DRIVER_MODESET)) {
-               io_mapping_free(dev_priv->mm.gtt_mapping);
                drm_irq_uninstall(dev);
        }
 
index f8b3df0926c015a24bda63d9c7ed1756801c2797..b293ef0bae7153805d587201c8ce6c84f3703f4c 100644 (file)
@@ -27,6 +27,7 @@
  *
  */
 
+#include <linux/device.h>
 #include "drmP.h"
 #include "drm.h"
 #include "i915_drm.h"
@@ -66,6 +67,14 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
 
        i915_save_state(dev);
 
+       /* If KMS is active, we do the leavevt stuff here */
+       if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+               if (i915_gem_idle(dev))
+                       dev_err(&dev->pdev->dev,
+                               "GEM idle failed, resume may fail\n");
+               drm_irq_uninstall(dev);
+       }
+
        intel_opregion_free(dev);
 
        if (state.event == PM_EVENT_SUSPEND) {
@@ -79,6 +88,9 @@ static int i915_suspend(struct drm_device *dev, pm_message_t state)
 
 static int i915_resume(struct drm_device *dev)
 {
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       int ret = 0;
+
        pci_set_power_state(dev->pdev, PCI_D0);
        pci_restore_state(dev->pdev);
        if (pci_enable_device(dev->pdev))
@@ -89,11 +101,26 @@ static int i915_resume(struct drm_device *dev)
 
        intel_opregion_init(dev);
 
-       return 0;
+       /* KMS EnterVT equivalent */
+       if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+               mutex_lock(&dev->struct_mutex);
+               dev_priv->mm.suspended = 0;
+
+               ret = i915_gem_init_ringbuffer(dev);
+               if (ret != 0)
+                       ret = -1;
+               mutex_unlock(&dev->struct_mutex);
+
+               drm_irq_install(dev);
+       }
+
+       return ret;
 }
 
 static struct vm_operations_struct i915_gem_vm_ops = {
        .fault = i915_gem_fault,
+       .open = drm_gem_vm_open,
+       .close = drm_gem_vm_close,
 };
 
 static struct drm_driver driver = {
@@ -112,7 +139,6 @@ static struct drm_driver driver = {
        .suspend = i915_suspend,
        .resume = i915_resume,
        .device_is_agp = i915_driver_device_is_agp,
-       .get_vblank_counter = i915_get_vblank_counter,
        .enable_vblank = i915_enable_vblank,
        .disable_vblank = i915_disable_vblank,
        .irq_preinstall = i915_driver_irq_preinstall,
index e1351825200712078b8fe2bf65d238d57435e7b5..17fa40858d26147b5ae6ca041adb5984c05ac06a 100644 (file)
@@ -184,6 +184,8 @@ typedef struct drm_i915_private {
        unsigned int lvds_dither:1;
        unsigned int lvds_vbt:1;
        unsigned int int_crt_support:1;
+       unsigned int lvds_use_ssc:1;
+       int lvds_ssc_freq;
 
        struct drm_i915_fence_reg fence_regs[16]; /* assume 965 */
        int fence_reg_start; /* 4 if userland hasn't ioctl'd us yet */
@@ -284,6 +286,7 @@ typedef struct drm_i915_private {
                struct drm_mm gtt_space;
 
                struct io_mapping *gtt_mapping;
+               int gtt_mtrr;
 
                /**
                 * List of objects currently involved in rendering from the
@@ -534,6 +537,7 @@ extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
 extern int i915_enable_vblank(struct drm_device *dev, int crtc);
 extern void i915_disable_vblank(struct drm_device *dev, int crtc);
 extern u32 i915_get_vblank_counter(struct drm_device *dev, int crtc);
+extern u32 gm45_get_vblank_counter(struct drm_device *dev, int crtc);
 extern int i915_vblank_swap(struct drm_device *dev, void *data,
                            struct drm_file *file_priv);
 extern void i915_enable_irq(drm_i915_private_t *dev_priv, u32 mask);
@@ -601,6 +605,7 @@ int i915_gem_init_object(struct drm_gem_object *obj);
 void i915_gem_free_object(struct drm_gem_object *obj);
 int i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment);
 void i915_gem_object_unpin(struct drm_gem_object *obj);
+int i915_gem_object_unbind(struct drm_gem_object *obj);
 void i915_gem_lastclose(struct drm_device *dev);
 uint32_t i915_get_gem_seqno(struct drm_device *dev);
 void i915_gem_retire_requests(struct drm_device *dev);
@@ -613,6 +618,7 @@ int i915_gem_init_ringbuffer(struct drm_device *dev);
 void i915_gem_cleanup_ringbuffer(struct drm_device *dev);
 int i915_gem_do_init(struct drm_device *dev, unsigned long start,
                     unsigned long end);
+int i915_gem_idle(struct drm_device *dev);
 int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
 int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
                                      int write);
@@ -784,6 +790,11 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
                        IS_I945GM(dev) || IS_I965GM(dev) || IS_GM45(dev))
 
 #define I915_NEED_GFX_HWS(dev) (IS_G33(dev) || IS_GM45(dev) || IS_G4X(dev))
+/* With the 945 and later, Y tiling got adjusted so that it was 32 128-byte
+ * rows, which changed the alignment requirements and fence programming.
+ */
+#define HAS_128_BYTE_Y_TILING(dev) (IS_I9XX(dev) && !(IS_I915G(dev) || \
+                                                     IS_I915GM(dev)))
 #define SUPPORTS_INTEGRATED_HDMI(dev)  (IS_G4X(dev))
 
 #define PRIMARY_RINGBUFFER_SIZE         (128*1024)
index debad5c04cc01d8f4ea70d1efcdd746ff40fe841..28b726d07a0cf640c16b962f5094f7d8ddc8962c 100644 (file)
 
 #define I915_GEM_GPU_DOMAINS   (~(I915_GEM_DOMAIN_CPU | I915_GEM_DOMAIN_GTT))
 
-static void
-i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
-                                 uint32_t read_domains,
-                                 uint32_t write_domain);
 static void i915_gem_object_flush_gpu_write_domain(struct drm_gem_object *obj);
 static void i915_gem_object_flush_gtt_write_domain(struct drm_gem_object *obj);
 static void i915_gem_object_flush_cpu_write_domain(struct drm_gem_object *obj);
@@ -52,7 +48,7 @@ static void i915_gem_object_free_page_list(struct drm_gem_object *obj);
 static int i915_gem_object_wait_rendering(struct drm_gem_object *obj);
 static int i915_gem_object_bind_to_gtt(struct drm_gem_object *obj,
                                           unsigned alignment);
-static void i915_gem_object_get_fence_reg(struct drm_gem_object *obj);
+static int i915_gem_object_get_fence_reg(struct drm_gem_object *obj, bool write);
 static void i915_gem_clear_fence_reg(struct drm_gem_object *obj);
 static int i915_gem_evict_something(struct drm_device *dev);
 static int i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
@@ -567,6 +563,7 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        pgoff_t page_offset;
        unsigned long pfn;
        int ret = 0;
+       bool write = !!(vmf->flags & FAULT_FLAG_WRITE);
 
        /* We don't use vmf->pgoff since that has the fake offset */
        page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start) >>
@@ -585,8 +582,13 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 
        /* Need a new fence register? */
        if (obj_priv->fence_reg == I915_FENCE_REG_NONE &&
-           obj_priv->tiling_mode != I915_TILING_NONE)
-               i915_gem_object_get_fence_reg(obj);
+           obj_priv->tiling_mode != I915_TILING_NONE) {
+               ret = i915_gem_object_get_fence_reg(obj, write);
+               if (ret) {
+                       mutex_unlock(&dev->struct_mutex);
+                       return VM_FAULT_SIGBUS;
+               }
+       }
 
        pfn = ((dev->agp->base + obj_priv->gtt_offset) >> PAGE_SHIFT) +
                page_offset;
@@ -601,8 +603,6 @@ int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
        case -EAGAIN:
                return VM_FAULT_OOM;
        case -EFAULT:
-       case -EBUSY:
-               DRM_ERROR("can't insert pfn??  fault or busy...\n");
                return VM_FAULT_SIGBUS;
        default:
                return VM_FAULT_NOPAGE;
@@ -678,6 +678,30 @@ out_free_list:
        return ret;
 }
 
+static void
+i915_gem_free_mmap_offset(struct drm_gem_object *obj)
+{
+       struct drm_device *dev = obj->dev;
+       struct drm_i915_gem_object *obj_priv = obj->driver_private;
+       struct drm_gem_mm *mm = dev->mm_private;
+       struct drm_map_list *list;
+
+       list = &obj->map_list;
+       drm_ht_remove_item(&mm->offset_hash, &list->hash);
+
+       if (list->file_offset_node) {
+               drm_mm_put_block(list->file_offset_node);
+               list->file_offset_node = NULL;
+       }
+
+       if (list->map) {
+               drm_free(list->map, sizeof(struct drm_map), DRM_MEM_DRIVER);
+               list->map = NULL;
+       }
+
+       obj_priv->mmap_offset = 0;
+}
+
 /**
  * i915_gem_get_gtt_alignment - return required GTT alignment for an object
  * @obj: object to check
@@ -752,8 +776,11 @@ i915_gem_mmap_gtt_ioctl(struct drm_device *dev, void *data,
 
        if (!obj_priv->mmap_offset) {
                ret = i915_gem_create_mmap_offset(obj);
-               if (ret)
+               if (ret) {
+                       drm_gem_object_unreference(obj);
+                       mutex_unlock(&dev->struct_mutex);
                        return ret;
+               }
        }
 
        args->offset = obj_priv->mmap_offset;
@@ -1024,6 +1051,9 @@ i915_gem_retire_requests(struct drm_device *dev)
        drm_i915_private_t *dev_priv = dev->dev_private;
        uint32_t seqno;
 
+       if (!dev_priv->hw_status_page)
+               return;
+
        seqno = i915_get_gem_seqno(dev);
 
        while (!list_empty(&dev_priv->mm.request_list)) {
@@ -1211,7 +1241,7 @@ i915_gem_object_wait_rendering(struct drm_gem_object *obj)
 /**
  * Unbinds an object from the GTT aperture.
  */
-static int
+int
 i915_gem_object_unbind(struct drm_gem_object *obj)
 {
        struct drm_device *dev = obj->dev;
@@ -1445,21 +1475,26 @@ static void i915_write_fence_reg(struct drm_i915_fence_reg *reg)
        drm_i915_private_t *dev_priv = dev->dev_private;
        struct drm_i915_gem_object *obj_priv = obj->driver_private;
        int regnum = obj_priv->fence_reg;
+       int tile_width;
        uint32_t val;
        uint32_t pitch_val;
 
        if ((obj_priv->gtt_offset & ~I915_FENCE_START_MASK) ||
            (obj_priv->gtt_offset & (obj->size - 1))) {
-               WARN(1, "%s: object not 1M or size aligned\n", __func__);
+               WARN(1, "%s: object 0x%08x not 1M or size (0x%zx) aligned\n",
+                    __func__, obj_priv->gtt_offset, obj->size);
                return;
        }
 
-       if (obj_priv->tiling_mode == I915_TILING_Y && (IS_I945G(dev) ||
-                                                      IS_I945GM(dev) ||
-                                                      IS_G33(dev)))
-               pitch_val = (obj_priv->stride / 128) - 1;
+       if (obj_priv->tiling_mode == I915_TILING_Y &&
+           HAS_128_BYTE_Y_TILING(dev))
+               tile_width = 128;
        else
-               pitch_val = (obj_priv->stride / 512) - 1;
+               tile_width = 512;
+
+       /* Note: pitch better be a power of two tile widths */
+       pitch_val = obj_priv->stride / tile_width;
+       pitch_val = ffs(pitch_val) - 1;
 
        val = obj_priv->gtt_offset;
        if (obj_priv->tiling_mode == I915_TILING_Y)
@@ -1483,7 +1518,8 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg)
 
        if ((obj_priv->gtt_offset & ~I915_FENCE_START_MASK) ||
            (obj_priv->gtt_offset & (obj->size - 1))) {
-               WARN(1, "%s: object not 1M or size aligned\n", __func__);
+               WARN(1, "%s: object 0x%08x not 1M or size aligned\n",
+                    __func__, obj_priv->gtt_offset);
                return;
        }
 
@@ -1503,6 +1539,7 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg)
 /**
  * i915_gem_object_get_fence_reg - set up a fence reg for an object
  * @obj: object to map through a fence reg
+ * @write: object is about to be written
  *
  * When mapping objects through the GTT, userspace wants to be able to write
  * to them without having to worry about swizzling if the object is tiled.
@@ -1513,8 +1550,8 @@ static void i830_write_fence_reg(struct drm_i915_fence_reg *reg)
  * It then sets up the reg based on the object's properties: address, pitch
  * and tiling format.
  */
-static void
-i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
+static int
+i915_gem_object_get_fence_reg(struct drm_gem_object *obj, bool write)
 {
        struct drm_device *dev = obj->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1527,12 +1564,18 @@ i915_gem_object_get_fence_reg(struct drm_gem_object *obj)
                WARN(1, "allocating a fence for non-tiled object?\n");
                break;
        case I915_TILING_X:
-               WARN(obj_priv->stride & (512 - 1),
-                    "object is X tiled but has non-512B pitch\n");
+               if (!obj_priv->stride)
+                       return -EINVAL;
+               WARN((obj_priv->stride & (512 - 1)),
+                    "object 0x%08x is X tiled but has non-512B pitch\n",
+                    obj_priv->gtt_offset);
                break;
        case I915_TILING_Y:
-               WARN(obj_priv->stride & (128 - 1),
-                    "object is Y tiled but has non-128B pitch\n");
+               if (!obj_priv->stride)
+                       return -EINVAL;
+               WARN((obj_priv->stride & (128 - 1)),
+                    "object 0x%08x is Y tiled but has non-128B pitch\n",
+                    obj_priv->gtt_offset);
                break;
        }
 
@@ -1563,10 +1606,11 @@ try_again:
                 * objects to finish before trying again.
                 */
                if (i == dev_priv->num_fence_regs) {
-                       ret = i915_gem_object_wait_rendering(reg->obj);
+                       ret = i915_gem_object_set_to_gtt_domain(reg->obj, 0);
                        if (ret) {
-                               WARN(ret, "wait_rendering failed: %d\n", ret);
-                               return;
+                               WARN(ret != -ERESTARTSYS,
+                                    "switch to GTT domain failed: %d\n", ret);
+                               return ret;
                        }
                        goto try_again;
                }
@@ -1591,6 +1635,8 @@ try_again:
                i915_write_fence_reg(reg);
        else
                i830_write_fence_reg(reg);
+
+       return 0;
 }
 
 /**
@@ -1631,7 +1677,7 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
        if (dev_priv->mm.suspended)
                return -EBUSY;
        if (alignment == 0)
-               alignment = PAGE_SIZE;
+               alignment = i915_gem_get_gtt_alignment(obj);
        if (alignment & (PAGE_SIZE - 1)) {
                DRM_ERROR("Invalid object alignment requested %u\n", alignment);
                return -EINVAL;
@@ -1974,30 +2020,28 @@ i915_gem_object_set_to_cpu_domain(struct drm_gem_object *obj, int write)
  *             drm_agp_chipset_flush
  */
 static void
-i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
-                                 uint32_t read_domains,
-                                 uint32_t write_domain)
+i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj)
 {
        struct drm_device               *dev = obj->dev;
        struct drm_i915_gem_object      *obj_priv = obj->driver_private;
        uint32_t                        invalidate_domains = 0;
        uint32_t                        flush_domains = 0;
 
-       BUG_ON(read_domains & I915_GEM_DOMAIN_CPU);
-       BUG_ON(write_domain == I915_GEM_DOMAIN_CPU);
+       BUG_ON(obj->pending_read_domains & I915_GEM_DOMAIN_CPU);
+       BUG_ON(obj->pending_write_domain == I915_GEM_DOMAIN_CPU);
 
 #if WATCH_BUF
        DRM_INFO("%s: object %p read %08x -> %08x write %08x -> %08x\n",
                 __func__, obj,
-                obj->read_domains, read_domains,
-                obj->write_domain, write_domain);
+                obj->read_domains, obj->pending_read_domains,
+                obj->write_domain, obj->pending_write_domain);
 #endif
        /*
         * If the object isn't moving to a new write domain,
         * let the object stay in multiple read domains
         */
-       if (write_domain == 0)
-               read_domains |= obj->read_domains;
+       if (obj->pending_write_domain == 0)
+               obj->pending_read_domains |= obj->read_domains;
        else
                obj_priv->dirty = 1;
 
@@ -2007,15 +2051,17 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
         * any read domains which differ from the old
         * write domain
         */
-       if (obj->write_domain && obj->write_domain != read_domains) {
+       if (obj->write_domain &&
+           obj->write_domain != obj->pending_read_domains) {
                flush_domains |= obj->write_domain;
-               invalidate_domains |= read_domains & ~obj->write_domain;
+               invalidate_domains |=
+                       obj->pending_read_domains & ~obj->write_domain;
        }
        /*
         * Invalidate any read caches which may have
         * stale data. That is, any new read domains.
         */
-       invalidate_domains |= read_domains & ~obj->read_domains;
+       invalidate_domains |= obj->pending_read_domains & ~obj->read_domains;
        if ((flush_domains | invalidate_domains) & I915_GEM_DOMAIN_CPU) {
 #if WATCH_BUF
                DRM_INFO("%s: CPU domain flush %08x invalidate %08x\n",
@@ -2024,9 +2070,15 @@ i915_gem_object_set_to_gpu_domain(struct drm_gem_object *obj,
                i915_gem_clflush_object(obj);
        }
 
-       if ((write_domain | flush_domains) != 0)
-               obj->write_domain = write_domain;
-       obj->read_domains = read_domains;
+       /* The actual obj->write_domain will be updated with
+        * pending_write_domain after we emit the accumulated flush for all
+        * of our domain changes in execbuffers (which clears objects'
+        * write_domains).  So if we have a current write domain that we
+        * aren't changing, set pending_write_domain to that.
+        */
+       if (flush_domains == 0 && obj->pending_write_domain == 0)
+               obj->pending_write_domain = obj->write_domain;
+       obj->read_domains = obj->pending_read_domains;
 
        dev->invalidate_domains |= invalidate_domains;
        dev->flush_domains |= flush_domains;
@@ -2229,6 +2281,8 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
                                  (int) reloc.offset,
                                  reloc.read_domains,
                                  reloc.write_domain);
+                       drm_gem_object_unreference(target_obj);
+                       i915_gem_object_unpin(obj);
                        return -EINVAL;
                }
 
@@ -2458,13 +2512,15 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
        if (dev_priv->mm.wedged) {
                DRM_ERROR("Execbuf while wedged\n");
                mutex_unlock(&dev->struct_mutex);
-               return -EIO;
+               ret = -EIO;
+               goto pre_mutex_err;
        }
 
        if (dev_priv->mm.suspended) {
                DRM_ERROR("Execbuf while VT-switched.\n");
                mutex_unlock(&dev->struct_mutex);
-               return -EBUSY;
+               ret = -EBUSY;
+               goto pre_mutex_err;
        }
 
        /* Look up object handles */
@@ -2532,9 +2588,7 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
                struct drm_gem_object *obj = object_list[i];
 
                /* Compute new gpu domains and update invalidate/flush */
-               i915_gem_object_set_to_gpu_domain(obj,
-                                                 obj->pending_read_domains,
-                                                 obj->pending_write_domain);
+               i915_gem_object_set_to_gpu_domain(obj);
        }
 
        i915_verify_inactive(dev, __FILE__, __LINE__);
@@ -2553,6 +2607,12 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
                        (void)i915_add_request(dev, dev->flush_domains);
        }
 
+       for (i = 0; i < args->buffer_count; i++) {
+               struct drm_gem_object *obj = object_list[i];
+
+               obj->write_domain = obj->pending_write_domain;
+       }
+
        i915_verify_inactive(dev, __FILE__, __LINE__);
 
 #if WATCH_COHERENCY
@@ -2610,15 +2670,6 @@ i915_gem_execbuffer(struct drm_device *dev, void *data,
 
        i915_verify_inactive(dev, __FILE__, __LINE__);
 
-       /* Copy the new buffer offsets back to the user's exec list. */
-       ret = copy_to_user((struct drm_i915_relocation_entry __user *)
-                          (uintptr_t) args->buffers_ptr,
-                          exec_list,
-                          sizeof(*exec_list) * args->buffer_count);
-       if (ret)
-               DRM_ERROR("failed to copy %d exec entries "
-                         "back to user (%d)\n",
-                          args->buffer_count, ret);
 err:
        for (i = 0; i < pinned; i++)
                i915_gem_object_unpin(object_list[i]);
@@ -2628,6 +2679,18 @@ err:
 
        mutex_unlock(&dev->struct_mutex);
 
+       if (!ret) {
+               /* Copy the new buffer offsets back to the user's exec list. */
+               ret = copy_to_user((struct drm_i915_relocation_entry __user *)
+                                  (uintptr_t) args->buffers_ptr,
+                                  exec_list,
+                                  sizeof(*exec_list) * args->buffer_count);
+               if (ret)
+                       DRM_ERROR("failed to copy %d exec entries "
+                                 "back to user (%d)\n",
+                                 args->buffer_count, ret);
+       }
+
 pre_mutex_err:
        drm_free(object_list, sizeof(*object_list) * args->buffer_count,
                 DRM_MEM_DRIVER);
@@ -2652,6 +2715,14 @@ i915_gem_object_pin(struct drm_gem_object *obj, uint32_t alignment)
                                DRM_ERROR("Failure to bind: %d", ret);
                        return ret;
                }
+               /*
+                * Pre-965 chips need a fence register set up in order to
+                * properly handle tiled surfaces.
+                */
+               if (!IS_I965G(dev) &&
+                   obj_priv->fence_reg == I915_FENCE_REG_NONE &&
+                   obj_priv->tiling_mode != I915_TILING_NONE)
+                       i915_gem_object_get_fence_reg(obj, true);
        }
        obj_priv->pin_count++;
 
@@ -2723,6 +2794,7 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
        if (obj_priv->pin_filp != NULL && obj_priv->pin_filp != file_priv) {
                DRM_ERROR("Already pinned in i915_gem_pin_ioctl(): %d\n",
                          args->handle);
+               drm_gem_object_unreference(obj);
                mutex_unlock(&dev->struct_mutex);
                return -EINVAL;
        }
@@ -2803,6 +2875,13 @@ i915_gem_busy_ioctl(struct drm_device *dev, void *data,
                return -EBADF;
        }
 
+       /* Update the active list for the hardware's current position.
+        * Otherwise this only updates on a delayed timer or when irqs are
+        * actually unmasked, and our working set ends up being larger than
+        * required.
+        */
+       i915_gem_retire_requests(dev);
+
        obj_priv = obj->driver_private;
        /* Don't count being on the flushing list against the object being
         * done.  Otherwise, a buffer left on the flushing list but not getting
@@ -2855,9 +2934,6 @@ int i915_gem_init_object(struct drm_gem_object *obj)
 void i915_gem_free_object(struct drm_gem_object *obj)
 {
        struct drm_device *dev = obj->dev;
-       struct drm_gem_mm *mm = dev->mm_private;
-       struct drm_map_list *list;
-       struct drm_map *map;
        struct drm_i915_gem_object *obj_priv = obj->driver_private;
 
        while (obj_priv->pin_count > 0)
@@ -2868,19 +2944,7 @@ void i915_gem_free_object(struct drm_gem_object *obj)
 
        i915_gem_object_unbind(obj);
 
-       list = &obj->map_list;
-       drm_ht_remove_item(&mm->offset_hash, &list->hash);
-
-       if (list->file_offset_node) {
-               drm_mm_put_block(list->file_offset_node);
-               list->file_offset_node = NULL;
-       }
-
-       map = list->map;
-       if (map) {
-               drm_free(map, sizeof(*map), DRM_MEM_DRIVER);
-               list->map = NULL;
-       }
+       i915_gem_free_mmap_offset(obj);
 
        drm_free(obj_priv->page_cpu_valid, 1, DRM_MEM_DRIVER);
        drm_free(obj->driver_private, 1, DRM_MEM_DRIVER);
@@ -2919,7 +2983,7 @@ i915_gem_evict_from_list(struct drm_device *dev, struct list_head *head)
        return 0;
 }
 
-static int
+int
 i915_gem_idle(struct drm_device *dev)
 {
        drm_i915_private_t *dev_priv = dev->dev_private;
@@ -3065,6 +3129,7 @@ i915_gem_init_hws(struct drm_device *dev)
        if (dev_priv->hw_status_page == NULL) {
                DRM_ERROR("Failed to map status page.\n");
                memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
+               i915_gem_object_unpin(obj);
                drm_gem_object_unreference(obj);
                return -EINVAL;
        }
@@ -3077,6 +3142,31 @@ i915_gem_init_hws(struct drm_device *dev)
        return 0;
 }
 
+static void
+i915_gem_cleanup_hws(struct drm_device *dev)
+{
+       drm_i915_private_t *dev_priv = dev->dev_private;
+       struct drm_gem_object *obj;
+       struct drm_i915_gem_object *obj_priv;
+
+       if (dev_priv->hws_obj == NULL)
+               return;
+
+       obj = dev_priv->hws_obj;
+       obj_priv = obj->driver_private;
+
+       kunmap(obj_priv->page_list[0]);
+       i915_gem_object_unpin(obj);
+       drm_gem_object_unreference(obj);
+       dev_priv->hws_obj = NULL;
+
+       memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
+       dev_priv->hw_status_page = NULL;
+
+       /* Write high address into HWS_PGA when disabling. */
+       I915_WRITE(HWS_PGA, 0x1ffff000);
+}
+
 int
 i915_gem_init_ringbuffer(struct drm_device *dev)
 {
@@ -3094,6 +3184,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
        obj = drm_gem_object_alloc(dev, 128 * 1024);
        if (obj == NULL) {
                DRM_ERROR("Failed to allocate ringbuffer\n");
+               i915_gem_cleanup_hws(dev);
                return -ENOMEM;
        }
        obj_priv = obj->driver_private;
@@ -3101,6 +3192,7 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
        ret = i915_gem_object_pin(obj, 4096);
        if (ret != 0) {
                drm_gem_object_unreference(obj);
+               i915_gem_cleanup_hws(dev);
                return ret;
        }
 
@@ -3118,7 +3210,9 @@ i915_gem_init_ringbuffer(struct drm_device *dev)
        if (ring->map.handle == NULL) {
                DRM_ERROR("Failed to map ringbuffer.\n");
                memset(&dev_priv->ring, 0, sizeof(dev_priv->ring));
+               i915_gem_object_unpin(obj);
                drm_gem_object_unreference(obj);
+               i915_gem_cleanup_hws(dev);
                return -EINVAL;
        }
        ring->ring_obj = obj;
@@ -3198,20 +3292,7 @@ i915_gem_cleanup_ringbuffer(struct drm_device *dev)
        dev_priv->ring.ring_obj = NULL;
        memset(&dev_priv->ring, 0, sizeof(dev_priv->ring));
 
-       if (dev_priv->hws_obj != NULL) {
-               struct drm_gem_object *obj = dev_priv->hws_obj;
-               struct drm_i915_gem_object *obj_priv = obj->driver_private;
-
-               kunmap(obj_priv->page_list[0]);
-               i915_gem_object_unpin(obj);
-               drm_gem_object_unreference(obj);
-               dev_priv->hws_obj = NULL;
-               memset(&dev_priv->hws_map, 0, sizeof(dev_priv->hws_map));
-               dev_priv->hw_status_page = NULL;
-
-               /* Write high address into HWS_PGA when disabling. */
-               I915_WRITE(HWS_PGA, 0x1ffff000);
-       }
+       i915_gem_cleanup_hws(dev);
 }
 
 int
@@ -3229,10 +3310,6 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
                dev_priv->mm.wedged = 0;
        }
 
-       dev_priv->mm.gtt_mapping = io_mapping_create_wc(dev->agp->base,
-                                                       dev->agp->agp_info.aper_size
-                                                       * 1024 * 1024);
-
        mutex_lock(&dev->struct_mutex);
        dev_priv->mm.suspended = 0;
 
@@ -3255,7 +3332,6 @@ int
 i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
                       struct drm_file *file_priv)
 {
-       drm_i915_private_t *dev_priv = dev->dev_private;
        int ret;
 
        if (drm_core_check_feature(dev, DRIVER_MODESET))
@@ -3264,7 +3340,6 @@ i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
        ret = i915_gem_idle(dev);
        drm_irq_uninstall(dev);
 
-       io_mapping_free(dev_priv->mm.gtt_mapping);
        return ret;
 }
 
@@ -3273,6 +3348,9 @@ i915_gem_lastclose(struct drm_device *dev)
 {
        int ret;
 
+       if (drm_core_check_feature(dev, DRIVER_MODESET))
+               return;
+
        ret = i915_gem_idle(dev);
        if (ret)
                DRM_ERROR("failed to idle hardware: %d\n", ret);
@@ -3294,7 +3372,7 @@ i915_gem_load(struct drm_device *dev)
        /* Old X drivers will take 0-2 for front, back, depth buffers */
        dev_priv->fence_reg_start = 3;
 
-       if (IS_I965G(dev))
+       if (IS_I965G(dev) || IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
                dev_priv->num_fence_regs = 16;
        else
                dev_priv->num_fence_regs = 8;
index 241f39b7f460251e0570c1e21ac9b3cccb53b8fc..7fb4191ef934c2b9a9549a36737e075d6ee3fca7 100644 (file)
@@ -173,6 +173,73 @@ i915_gem_detect_bit_6_swizzle(struct drm_device *dev)
        dev_priv->mm.bit_6_swizzle_y = swizzle_y;
 }
 
+
+/**
+ * Returns the size of the fence for a tiled object of the given size.
+ */
+static int
+i915_get_fence_size(struct drm_device *dev, int size)
+{
+       int i;
+       int start;
+
+       if (IS_I965G(dev)) {
+               /* The 965 can have fences at any page boundary. */
+               return ALIGN(size, 4096);
+       } else {
+               /* Align the size to a power of two greater than the smallest
+                * fence size.
+                */
+               if (IS_I9XX(dev))
+                       start = 1024 * 1024;
+               else
+                       start = 512 * 1024;
+
+               for (i = start; i < size; i <<= 1)
+                       ;
+
+               return i;
+       }
+}
+
+/* Check pitch constriants for all chips & tiling formats */
+static bool
+i915_tiling_ok(struct drm_device *dev, int stride, int size, int tiling_mode)
+{
+       int tile_width;
+
+       /* Linear is always fine */
+       if (tiling_mode == I915_TILING_NONE)
+               return true;
+
+       if (tiling_mode == I915_TILING_Y && HAS_128_BYTE_Y_TILING(dev))
+               tile_width = 128;
+       else
+               tile_width = 512;
+
+       /* 965+ just needs multiples of tile width */
+       if (IS_I965G(dev)) {
+               if (stride & (tile_width - 1))
+                       return false;
+               return true;
+       }
+
+       /* Pre-965 needs power of two tile widths */
+       if (stride < tile_width)
+               return false;
+
+       if (stride & (stride - 1))
+               return false;
+
+       /* We don't handle the aperture area covered by the fence being bigger
+        * than the object size.
+        */
+       if (i915_get_fence_size(dev, size) != size)
+               return false;
+
+       return true;
+}
+
 /**
  * Sets the tiling mode of an object, returning the required swizzling of
  * bit 6 of addresses in the object.
@@ -191,6 +258,11 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
                return -EINVAL;
        obj_priv = obj->driver_private;
 
+       if (!i915_tiling_ok(dev, args->stride, obj->size, args->tiling_mode)) {
+               drm_gem_object_unreference(obj);
+               return -EINVAL;
+       }
+
        mutex_lock(&dev->struct_mutex);
 
        if (args->tiling_mode == I915_TILING_NONE) {
@@ -207,12 +279,28 @@ i915_gem_set_tiling(struct drm_device *dev, void *data,
                        args->swizzle_mode = I915_BIT_6_SWIZZLE_NONE;
                }
        }
-       obj_priv->tiling_mode = args->tiling_mode;
-       obj_priv->stride = args->stride;
+       if (args->tiling_mode != obj_priv->tiling_mode) {
+               int ret;
 
-       mutex_unlock(&dev->struct_mutex);
+               /* Unbind the object, as switching tiling means we're
+                * switching the cache organization due to fencing, probably.
+                */
+               ret = i915_gem_object_unbind(obj);
+               if (ret != 0) {
+                       WARN(ret != -ERESTARTSYS,
+                            "failed to unbind object for tiling switch");
+                       args->tiling_mode = obj_priv->tiling_mode;
+                       mutex_unlock(&dev->struct_mutex);
+                       drm_gem_object_unreference(obj);
+
+                       return ret;
+               }
+               obj_priv->tiling_mode = args->tiling_mode;
+       }
+       obj_priv->stride = args->stride;
 
        drm_gem_object_unreference(obj);
+       mutex_unlock(&dev->struct_mutex);
 
        return 0;
 }
@@ -251,9 +339,8 @@ i915_gem_get_tiling(struct drm_device *dev, void *data,
                DRM_ERROR("unknown tiling mode\n");
        }
 
-       mutex_unlock(&dev->struct_mutex);
-
        drm_gem_object_unreference(obj);
+       mutex_unlock(&dev->struct_mutex);
 
        return 0;
 }
index 6290219de6c8e832aa4209d761f7d2be0317211b..548ff2c66431ee93a205b15d84362084da7486ce 100644 (file)
@@ -174,6 +174,19 @@ u32 i915_get_vblank_counter(struct drm_device *dev, int pipe)
        return count;
 }
 
+u32 gm45_get_vblank_counter(struct drm_device *dev, int pipe)
+{
+       drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
+       int reg = pipe ? PIPEB_FRMCOUNT_GM45 : PIPEA_FRMCOUNT_GM45;
+
+       if (!i915_pipe_enabled(dev, pipe)) {
+               DRM_ERROR("trying to get vblank count for disabled pipe %d\n", pipe);
+               return 0;
+       }
+
+       return I915_READ(reg);
+}
+
 irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS)
 {
        struct drm_device *dev = (struct drm_device *) arg;
index 273162579e1bcad75ced61ff384e465e75162b40..9d6539a868b30fdf89154a0d046af1170db65836 100644 (file)
 #define FENCE_REG_830_0                        0x2000
 #define   I830_FENCE_START_MASK                0x07f80000
 #define   I830_FENCE_TILING_Y_SHIFT    12
-#define   I830_FENCE_SIZE_BITS(size)   ((get_order(size >> 19) - 1) << 8)
+#define   I830_FENCE_SIZE_BITS(size)   ((ffs((size) >> 19) - 1) << 8)
 #define   I830_FENCE_PITCH_SHIFT       4
 #define   I830_FENCE_REG_VALID         (1<<0)
 
 #define   I915_FENCE_START_MASK                0x0ff00000
-#define   I915_FENCE_SIZE_BITS(size)   ((get_order(size >> 20) - 1) << 8)
+#define   I915_FENCE_SIZE_BITS(size)   ((ffs((size) >> 20) - 1) << 8)
 
 #define FENCE_REG_965_0                        0x03000
 #define   I965_FENCE_PITCH_SHIFT       2
 #define   PIPE_FRAME_LOW_SHIFT    24
 #define   PIPE_PIXEL_MASK         0x00ffffff
 #define   PIPE_PIXEL_SHIFT        0
+/* GM45+ just has to be different */
+#define PIPEA_FRMCOUNT_GM45    0x70040
+#define PIPEA_FLIPCOUNT_GM45   0x70044
 
 /* Cursor A & B regs */
 #define CURACNTR               0x70080
 #define PIPEBSTAT              0x71024
 #define PIPEBFRAMEHIGH         0x71040
 #define PIPEBFRAMEPIXEL                0x71044
+#define PIPEB_FRMCOUNT_GM45    0x71040
+#define PIPEB_FLIPCOUNT_GM45   0x71044
+
 
 /* Display B control */
 #define DSPBCNTR               0x71180
index 4ca82a0255255e09f82426bc23b2bc25da555f08..65be30dccc7767d8781cad444a317c43930a6064 100644 (file)
@@ -135,6 +135,14 @@ parse_general_features(struct drm_i915_private *dev_priv,
        if (general) {
                dev_priv->int_tv_support = general->int_tv_support;
                dev_priv->int_crt_support = general->int_crt_support;
+               dev_priv->lvds_use_ssc = general->enable_ssc;
+
+               if (dev_priv->lvds_use_ssc) {
+                 if (IS_I855(dev_priv->dev))
+                   dev_priv->lvds_ssc_freq = general->ssc_freq ? 66 : 48;
+                 else
+                   dev_priv->lvds_ssc_freq = general->ssc_freq ? 100 : 96;
+               }
        }
 }
 
index 31c3732b7a690aa7d813f4ecad46a071a7ef684f..65b635ce28c8c78da6563f21538d9d6434de23a9 100644 (file)
@@ -90,12 +90,12 @@ typedef struct {
 #define I9XX_DOT_MAX            400000
 #define I9XX_VCO_MIN           1400000
 #define I9XX_VCO_MAX           2800000
-#define I9XX_N_MIN                   3
-#define I9XX_N_MAX                   8
+#define I9XX_N_MIN                   1
+#define I9XX_N_MAX                   6
 #define I9XX_M_MIN                  70
 #define I9XX_M_MAX                 120
 #define I9XX_M1_MIN                 10
-#define I9XX_M1_MAX                 20
+#define I9XX_M1_MAX                 22
 #define I9XX_M2_MIN                  5
 #define I9XX_M2_MAX                  9
 #define I9XX_P_SDVO_DAC_MIN          5
@@ -189,9 +189,7 @@ static const intel_limit_t *intel_limit(struct drm_crtc *crtc)
        return limit;
 }
 
-/** Derive the pixel clock for the given refclk and divisors for 8xx chips. */
-
-static void i8xx_clock(int refclk, intel_clock_t *clock)
+static void intel_clock(int refclk, intel_clock_t *clock)
 {
        clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
        clock->p = clock->p1 * clock->p2;
@@ -199,25 +197,6 @@ static void i8xx_clock(int refclk, intel_clock_t *clock)
        clock->dot = clock->vco / clock->p;
 }
 
-/** Derive the pixel clock for the given refclk and divisors for 9xx chips. */
-
-static void i9xx_clock(int refclk, intel_clock_t *clock)
-{
-       clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
-       clock->p = clock->p1 * clock->p2;
-       clock->vco = refclk * clock->m / (clock->n + 2);
-       clock->dot = clock->vco / clock->p;
-}
-
-static void intel_clock(struct drm_device *dev, int refclk,
-                       intel_clock_t *clock)
-{
-       if (IS_I9XX(dev))
-               i9xx_clock (refclk, clock);
-       else
-               i8xx_clock (refclk, clock);
-}
-
 /**
  * Returns whether any output on the specified pipe is of the specified type
  */
@@ -238,7 +217,7 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type)
     return false;
 }
 
-#define INTELPllInvalid(s)   { /* ErrorF (s) */; return false; }
+#define INTELPllInvalid(s)   do { DRM_DEBUG(s); return false; } while (0)
 /**
  * Returns whether the given set of divisors are valid for a given refclk with
  * the given connectors.
@@ -318,7 +297,7 @@ static bool intel_find_best_PLL(struct drm_crtc *crtc, int target,
                                     clock.p1 <= limit->p1.max; clock.p1++) {
                                        int this_err;
 
-                                       intel_clock(dev, refclk, &clock);
+                                       intel_clock(refclk, &clock);
 
                                        if (!intel_PLL_is_valid(crtc, &clock))
                                                continue;
@@ -343,7 +322,7 @@ intel_wait_for_vblank(struct drm_device *dev)
        udelay(20000);
 }
 
-static void
+static int
 intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
                    struct drm_framebuffer *old_fb)
 {
@@ -361,11 +340,21 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
        int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE;
        int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR;
        u32 dspcntr, alignment;
+       int ret;
 
        /* no fb bound */
        if (!crtc->fb) {
                DRM_DEBUG("No FB bound\n");
-               return;
+               return 0;
+       }
+
+       switch (pipe) {
+       case 0:
+       case 1:
+               break;
+       default:
+               DRM_ERROR("Can't update pipe %d in SAREA\n", pipe);
+               return -EINVAL;
        }
 
        intel_fb = to_intel_framebuffer(crtc->fb);
@@ -377,28 +366,30 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
                alignment = 64 * 1024;
                break;
        case I915_TILING_X:
-               if (IS_I9XX(dev))
-                       alignment = 1024 * 1024;
-               else
-                       alignment = 512 * 1024;
+               /* pin() will align the object as required by fence */
+               alignment = 0;
                break;
        case I915_TILING_Y:
                /* FIXME: Is this true? */
                DRM_ERROR("Y tiled not allowed for scan out buffers\n");
-               return;
+               return -EINVAL;
        default:
                BUG();
        }
 
-       if (i915_gem_object_pin(intel_fb->obj, alignment))
-               return;
-
-       i915_gem_object_set_to_gtt_domain(intel_fb->obj, 1);
-
-       Start = obj_priv->gtt_offset;
-       Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8);
+       mutex_lock(&dev->struct_mutex);
+       ret = i915_gem_object_pin(intel_fb->obj, alignment);
+       if (ret != 0) {
+               mutex_unlock(&dev->struct_mutex);
+               return ret;
+       }
 
-       I915_WRITE(dspstride, crtc->fb->pitch);
+       ret = i915_gem_object_set_to_gtt_domain(intel_fb->obj, 1);
+       if (ret != 0) {
+               i915_gem_object_unpin(intel_fb->obj);
+               mutex_unlock(&dev->struct_mutex);
+               return ret;
+       }
 
        dspcntr = I915_READ(dspcntr_reg);
        /* Mask out pixel format bits in case we change it */
@@ -419,11 +410,17 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
                break;
        default:
                DRM_ERROR("Unknown color depth\n");
-               return;
+               i915_gem_object_unpin(intel_fb->obj);
+               mutex_unlock(&dev->struct_mutex);
+               return -EINVAL;
        }
        I915_WRITE(dspcntr_reg, dspcntr);
 
+       Start = obj_priv->gtt_offset;
+       Offset = y * crtc->fb->pitch + x * (crtc->fb->bits_per_pixel / 8);
+
        DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y);
+       I915_WRITE(dspstride, crtc->fb->pitch);
        if (IS_I965G(dev)) {
                I915_WRITE(dspbase, Offset);
                I915_READ(dspbase);
@@ -440,27 +437,24 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
                intel_fb = to_intel_framebuffer(old_fb);
                i915_gem_object_unpin(intel_fb->obj);
        }
+       mutex_unlock(&dev->struct_mutex);
 
        if (!dev->primary->master)
-               return;
+               return 0;
 
        master_priv = dev->primary->master->driver_priv;
        if (!master_priv->sarea_priv)
-               return;
+               return 0;
 
-       switch (pipe) {
-       case 0:
-               master_priv->sarea_priv->pipeA_x = x;
-               master_priv->sarea_priv->pipeA_y = y;
-               break;
-       case 1:
+       if (pipe) {
                master_priv->sarea_priv->pipeB_x = x;
                master_priv->sarea_priv->pipeB_y = y;
-               break;
-       default:
-               DRM_ERROR("Can't update pipe %d in SAREA\n", pipe);
-               break;
+       } else {
+               master_priv->sarea_priv->pipeA_x = x;
+               master_priv->sarea_priv->pipeA_y = y;
        }
+
+       return 0;
 }
 
 
@@ -708,11 +702,11 @@ static int intel_panel_fitter_pipe (struct drm_device *dev)
        return 1;
 }
 
-static void intel_crtc_mode_set(struct drm_crtc *crtc,
-                               struct drm_display_mode *mode,
-                               struct drm_display_mode *adjusted_mode,
-                               int x, int y,
-                               struct drm_framebuffer *old_fb)
+static int intel_crtc_mode_set(struct drm_crtc *crtc,
+                              struct drm_display_mode *mode,
+                              struct drm_display_mode *adjusted_mode,
+                              int x, int y,
+                              struct drm_framebuffer *old_fb)
 {
        struct drm_device *dev = crtc->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
@@ -732,13 +726,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
        int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE;
        int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS;
        int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC;
-       int refclk;
+       int refclk, num_outputs = 0;
        intel_clock_t clock;
        u32 dpll = 0, fp = 0, dspcntr, pipeconf;
        bool ok, is_sdvo = false, is_dvo = false;
        bool is_crt = false, is_lvds = false, is_tv = false;
        struct drm_mode_config *mode_config = &dev->mode_config;
        struct drm_connector *connector;
+       int ret;
 
        drm_vblank_pre_modeset(dev, pipe);
 
@@ -755,6 +750,8 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
                case INTEL_OUTPUT_SDVO:
                case INTEL_OUTPUT_HDMI:
                        is_sdvo = true;
+                       if (intel_output->needs_tv_clock)
+                               is_tv = true;
                        break;
                case INTEL_OUTPUT_DVO:
                        is_dvo = true;
@@ -766,9 +763,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
                        is_crt = true;
                        break;
                }
+
+               num_outputs++;
        }
 
-       if (IS_I9XX(dev)) {
+       if (is_lvds && dev_priv->lvds_use_ssc && num_outputs < 2) {
+               refclk = dev_priv->lvds_ssc_freq * 1000;
+               DRM_DEBUG("using SSC reference clock of %d MHz\n", refclk / 1000);
+       } else if (IS_I9XX(dev)) {
                refclk = 96000;
        } else {
                refclk = 48000;
@@ -777,7 +779,7 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
        ok = intel_find_best_PLL(crtc, adjusted_mode->clock, refclk, &clock);
        if (!ok) {
                DRM_ERROR("Couldn't find PLL settings for mode!\n");
-               return;
+               return -EINVAL;
        }
 
        fp = clock.n << 16 | clock.m1 << 8 | clock.m2;
@@ -827,11 +829,14 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
                }
        }
 
-       if (is_tv) {
+       if (is_sdvo && is_tv)
+               dpll |= PLL_REF_INPUT_TVCLKINBC;
+       else if (is_tv)
                /* XXX: just matching BIOS for now */
-/*     dpll |= PLL_REF_INPUT_TVCLKINBC; */
+               /*      dpll |= PLL_REF_INPUT_TVCLKINBC; */
                dpll |= 3;
-       }
+       else if (is_lvds && dev_priv->lvds_use_ssc && num_outputs < 2)
+               dpll |= PLLB_REF_INPUT_SPREADSPECTRUMIN;
        else
                dpll |= PLL_REF_INPUT_DREFCLK;
 
@@ -948,9 +953,13 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
        I915_WRITE(dspcntr_reg, dspcntr);
 
        /* Flush the plane changes */
-       intel_pipe_set_base(crtc, x, y, old_fb);
+       ret = intel_pipe_set_base(crtc, x, y, old_fb);
+       if (ret != 0)
+           return ret;
 
        drm_vblank_post_modeset(dev, pipe);
+
+       return 0;
 }
 
 /** Loads the palette/gamma unit for the CRTC with the prepared values */
@@ -999,6 +1008,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
                temp = CURSOR_MODE_DISABLE;
                addr = 0;
                bo = NULL;
+               mutex_lock(&dev->struct_mutex);
                goto finish;
        }
 
@@ -1021,18 +1031,19 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
        }
 
        /* we only need to pin inside GTT if cursor is non-phy */
+       mutex_lock(&dev->struct_mutex);
        if (!dev_priv->cursor_needs_physical) {
                ret = i915_gem_object_pin(bo, PAGE_SIZE);
                if (ret) {
                        DRM_ERROR("failed to pin cursor bo\n");
-                       goto fail;
+                       goto fail_locked;
                }
                addr = obj_priv->gtt_offset;
        } else {
                ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
                if (ret) {
                        DRM_ERROR("failed to attach phys object\n");
-                       goto fail;
+                       goto fail_locked;
                }
                addr = obj_priv->phys_obj->handle->busaddr;
        }
@@ -1052,10 +1063,9 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
                                i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
                } else
                        i915_gem_object_unpin(intel_crtc->cursor_bo);
-               mutex_lock(&dev->struct_mutex);
                drm_gem_object_unreference(intel_crtc->cursor_bo);
-               mutex_unlock(&dev->struct_mutex);
        }
+       mutex_unlock(&dev->struct_mutex);
 
        intel_crtc->cursor_addr = addr;
        intel_crtc->cursor_bo = bo;
@@ -1063,6 +1073,7 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
        return 0;
 fail:
        mutex_lock(&dev->struct_mutex);
+fail_locked:
        drm_gem_object_unreference(bo);
        mutex_unlock(&dev->struct_mutex);
        return ret;
@@ -1290,7 +1301,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
                }
 
                /* XXX: Handle the 100Mhz refclk */
-               i9xx_clock(96000, &clock);
+               intel_clock(96000, &clock);
        } else {
                bool is_lvds = (pipe == 1) && (I915_READ(LVDS) & LVDS_PORT_EN);
 
@@ -1302,9 +1313,9 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
                        if ((dpll & PLL_REF_INPUT_MASK) ==
                            PLLB_REF_INPUT_SPREADSPECTRUMIN) {
                                /* XXX: might not be 66MHz */
-                               i8xx_clock(66000, &clock);
+                               intel_clock(66000, &clock);
                        } else
-                               i8xx_clock(48000, &clock);
+                               intel_clock(48000, &clock);
                } else {
                        if (dpll & PLL_P1_DIVIDE_BY_TWO)
                                clock.p1 = 2;
@@ -1317,7 +1328,7 @@ static int intel_crtc_clock_get(struct drm_device *dev, struct drm_crtc *crtc)
                        else
                                clock.p2 = 2;
 
-                       i8xx_clock(48000, &clock);
+                       intel_clock(48000, &clock);
                }
        }
 
@@ -1452,6 +1463,7 @@ static int intel_connector_clones(struct drm_device *dev, int type_mask)
 
 static void intel_setup_outputs(struct drm_device *dev)
 {
+       struct drm_i915_private *dev_priv = dev->dev_private;
        struct drm_connector *connector;
 
        intel_crt_init(dev);
@@ -1463,13 +1475,16 @@ static void intel_setup_outputs(struct drm_device *dev)
        if (IS_I9XX(dev)) {
                int found;
 
-               found = intel_sdvo_init(dev, SDVOB);
-               if (!found && SUPPORTS_INTEGRATED_HDMI(dev))
-                       intel_hdmi_init(dev, SDVOB);
-
-               found = intel_sdvo_init(dev, SDVOC);
-               if (!found && SUPPORTS_INTEGRATED_HDMI(dev))
-                       intel_hdmi_init(dev, SDVOC);
+               if (I915_READ(SDVOB) & SDVO_DETECTED) {
+                       found = intel_sdvo_init(dev, SDVOB);
+                       if (!found && SUPPORTS_INTEGRATED_HDMI(dev))
+                               intel_hdmi_init(dev, SDVOB);
+               }
+               if (!IS_G4X(dev) || (I915_READ(SDVOB) & SDVO_DETECTED)) {
+                       found = intel_sdvo_init(dev, SDVOC);
+                       if (!found && SUPPORTS_INTEGRATED_HDMI(dev))
+                               intel_hdmi_init(dev, SDVOC);
+               }
        } else
                intel_dvo_init(dev);
 
@@ -1592,7 +1607,9 @@ intel_user_framebuffer_create(struct drm_device *dev,
 
        ret = intel_framebuffer_create(dev, mode_cmd, &fb, obj);
        if (ret) {
+               mutex_lock(&dev->struct_mutex);
                drm_gem_object_unreference(obj);
+               mutex_unlock(&dev->struct_mutex);
                return NULL;
        }
 
index 8a4cc50c5b4e06d3331e63704551051fe71cbda3..957daef8edff81da8fddab09e2e9ea4f0ecf2885 100644 (file)
@@ -82,6 +82,7 @@ struct intel_output {
        struct intel_i2c_chan *i2c_bus; /* for control functions */
        struct intel_i2c_chan *ddc_bus; /* for DDC only stuff */
        bool load_detect_temp;
+       bool needs_tv_clock;
        void *dev_priv;
 };
 
index afd1217b8a02cb4bfff4b7371baf2f842a4599fb..b7f0ebe9f810105b1d68a2446a5bab9921fa795c 100644 (file)
@@ -473,7 +473,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
        ret = intel_framebuffer_create(dev, &mode_cmd, &fb, fbo);
        if (ret) {
                DRM_ERROR("failed to allocate fb.\n");
-               goto out_unref;
+               goto out_unpin;
        }
 
        list_add(&fb->filp_head, &dev->mode_config.fb_kernel_list);
@@ -484,7 +484,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
        info = framebuffer_alloc(sizeof(struct intelfb_par), device);
        if (!info) {
                ret = -ENOMEM;
-               goto out_unref;
+               goto out_unpin;
        }
 
        par = info->par;
@@ -513,7 +513,7 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
                                       size);
        if (!info->screen_base) {
                ret = -ENOSPC;
-               goto out_unref;
+               goto out_unpin;
        }
        info->screen_size = size;
 
@@ -608,6 +608,8 @@ static int intelfb_create(struct drm_device *dev, uint32_t fb_width,
        mutex_unlock(&dev->struct_mutex);
        return 0;
 
+out_unpin:
+       i915_gem_object_unpin(fbo);
 out_unref:
        drm_gem_object_unreference(fbo);
        mutex_unlock(&dev->struct_mutex);
index b36a5214d8dfafe32767990d34cf61362e16ffb3..0d211af98854c18debd6af4f1ea6a246af16871d 100644 (file)
@@ -27,6 +27,7 @@
  *      Jesse Barnes <jesse.barnes@intel.com>
  */
 
+#include <linux/dmi.h>
 #include <linux/i2c.h>
 #include "drmP.h"
 #include "drm.h"
@@ -311,10 +312,8 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
        if (dev_priv->panel_fixed_mode != NULL) {
                struct drm_display_mode *mode;
 
-               mutex_lock(&dev->mode_config.mutex);
                mode = drm_mode_duplicate(dev, dev_priv->panel_fixed_mode);
                drm_mode_probed_add(connector, mode);
-               mutex_unlock(&dev->mode_config.mutex);
 
                return 1;
        }
@@ -405,6 +404,16 @@ void intel_lvds_init(struct drm_device *dev)
        u32 lvds;
        int pipe;
 
+       /* Blacklist machines that we know falsely report LVDS. */
+       /* FIXME: add a check for the Aopen Mini PC */
+
+       /* Apple Mac Mini Core Duo and Mac Mini Core 2 Duo */
+       if(dmi_match(DMI_PRODUCT_NAME, "Macmini1,1") ||
+          dmi_match(DMI_PRODUCT_NAME, "Macmini2,1")) {
+               DRM_DEBUG("Skipping LVDS initialization for Apple Mac Mini\n");
+               return;
+       }
+
        intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
        if (!intel_output) {
                return;
@@ -458,7 +467,7 @@ void intel_lvds_init(struct drm_device *dev)
                        dev_priv->panel_fixed_mode =
                                drm_mode_duplicate(dev, scan);
                        mutex_unlock(&dev->mode_config.mutex);
-                       goto out; /* FIXME: check for quirks */
+                       goto out;
                }
                mutex_unlock(&dev->mode_config.mutex);
        }
@@ -472,8 +481,6 @@ void intel_lvds_init(struct drm_device *dev)
                if (dev_priv->panel_fixed_mode) {
                        dev_priv->panel_fixed_mode->type |=
                                DRM_MODE_TYPE_PREFERRED;
-                       drm_mode_probed_add(connector,
-                                           dev_priv->panel_fixed_mode);
                        goto out;
                }
        }
@@ -492,7 +499,7 @@ void intel_lvds_init(struct drm_device *dev)
                if (dev_priv->panel_fixed_mode) {
                        dev_priv->panel_fixed_mode->type |=
                                DRM_MODE_TYPE_PREFERRED;
-                       goto out; /* FIXME: check for quirks */
+                       goto out;
                }
        }
 
@@ -500,38 +507,6 @@ void intel_lvds_init(struct drm_device *dev)
        if (!dev_priv->panel_fixed_mode)
                goto failed;
 
-       /* FIXME: detect aopen & mac mini type stuff automatically? */
-       /*
-        * Blacklist machines with BIOSes that list an LVDS panel without
-        * actually having one.
-        */
-       if (IS_I945GM(dev)) {
-               /* aopen mini pc */
-               if (dev->pdev->subsystem_vendor == 0xa0a0)
-                       goto failed;
-
-               if ((dev->pdev->subsystem_vendor == 0x8086) &&
-                   (dev->pdev->subsystem_device == 0x7270)) {
-                       /* It's a Mac Mini or Macbook Pro.
-                        *
-                        * Apple hardware is out to get us.  The macbook pro
-                        * has a real LVDS panel, but the mac mini does not,
-                        * and they have the same device IDs.  We'll
-                        * distinguish by panel size, on the assumption
-                        * that Apple isn't about to make any machines with an
-                        * 800x600 display.
-                        */
-
-                       if (dev_priv->panel_fixed_mode != NULL &&
-                           dev_priv->panel_fixed_mode->hdisplay == 800 &&
-                           dev_priv->panel_fixed_mode->vdisplay == 600) {
-                               DRM_DEBUG("Suspected Mac Mini, ignoring the LVDS\n");
-                               goto failed;
-                       }
-               }
-       }
-
-
 out:
        drm_sysfs_connector_add(connector);
        return;
index 407215469102a215fb2038d9a260efe033472212..fbe6f3931b1b116cb022daa2238ee78d2e7c359c 100644 (file)
 struct intel_sdvo_priv {
        struct intel_i2c_chan *i2c_bus;
        int slaveaddr;
+
+       /* Register for the SDVO device: SDVOB or SDVOC */
        int output_device;
 
-       u16 active_outputs;
+       /* Active outputs controlled by this SDVO output */
+       uint16_t controlled_output;
 
+       /*
+        * Capabilities of the SDVO device returned by
+        * i830_sdvo_get_capabilities()
+        */
        struct intel_sdvo_caps caps;
+
+       /* Pixel clock limitations reported by the SDVO device, in kHz */
        int pixel_clock_min, pixel_clock_max;
 
+       /**
+        * This is set if we're going to treat the device as TV-out.
+        *
+        * While we have these nice friendly flags for output types that ought
+        * to decide this for us, the S-Video output on our HDMI+S-Video card
+        * shows up as RGB1 (VGA).
+        */
+       bool is_tv;
+
+       /**
+        * This is set if we treat the device as HDMI, instead of DVI.
+        */
+       bool is_hdmi;
+
+       /**
+        * Returned SDTV resolutions allowed for the current format, if the
+        * device reported it.
+        */
+       struct intel_sdvo_sdtv_resolution_reply sdtv_resolutions;
+
+       /**
+        * Current selected TV format.
+        *
+        * This is stored in the same structure that's passed to the device, for
+        * convenience.
+        */
+       struct intel_sdvo_tv_format tv_format;
+
+       /*
+        * supported encoding mode, used to determine whether HDMI is
+        * supported
+        */
+       struct intel_sdvo_encode encode;
+
+       /* DDC bus used by this SDVO output */
+       uint8_t ddc_bus;
+
        int save_sdvo_mult;
        u16 save_active_outputs;
        struct intel_sdvo_dtd save_input_dtd_1, save_input_dtd_2;
@@ -147,9 +193,9 @@ static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr,
 
 #define SDVO_CMD_NAME_ENTRY(cmd) {cmd, #cmd}
 /** Mapping of command numbers to names, for debug output */
-const static struct _sdvo_cmd_name {
-    u8 cmd;
-    char *name;
+static const struct _sdvo_cmd_name {
+       u8 cmd;
+       char *name;
 } sdvo_cmd_names[] = {
     SDVO_CMD_NAME_ENTRY(SDVO_CMD_RESET),
     SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_DEVICE_CAPS),
@@ -186,8 +232,35 @@ const static struct _sdvo_cmd_name {
     SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_TV_FORMATS),
     SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_TV_FORMAT),
     SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TV_FORMAT),
-    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_TV_RESOLUTION_SUPPORT),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_POWER_STATES),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_POWER_STATE),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_ENCODER_POWER_STATE),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_DISPLAY_POWER_STATE),
     SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_CONTROL_BUS_SWITCH),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SCALED_HDTV_RESOLUTION_SUPPORT),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPPORTED_ENHANCEMENTS),
+    /* HDMI op code */
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_SUPP_ENCODE),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_ENCODE),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_ENCODE),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_PIXEL_REPLI),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_PIXEL_REPLI),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_COLORIMETRY_CAP),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_COLORIMETRY),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_COLORIMETRY),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_AUDIO_ENCRYPT_PREFER),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_AUDIO_STAT),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_AUDIO_STAT),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_INDEX),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_INDEX),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_INFO),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_AV_SPLIT),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_AV_SPLIT),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_TXRATE),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_TXRATE),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_SET_HBUF_DATA),
+    SDVO_CMD_NAME_ENTRY(SDVO_CMD_GET_HBUF_DATA),
 };
 
 #define SDVO_NAME(dev_priv) ((dev_priv)->output_device == SDVOB ? "SDVOB" : "SDVOC")
@@ -506,6 +579,50 @@ static bool intel_sdvo_set_output_timing(struct intel_output *intel_output,
                                     SDVO_CMD_SET_OUTPUT_TIMINGS_PART1, dtd);
 }
 
+static bool
+intel_sdvo_create_preferred_input_timing(struct intel_output *output,
+                                        uint16_t clock,
+                                        uint16_t width,
+                                        uint16_t height)
+{
+       struct intel_sdvo_preferred_input_timing_args args;
+       uint8_t status;
+
+       args.clock = clock;
+       args.width = width;
+       args.height = height;
+       intel_sdvo_write_cmd(output, SDVO_CMD_CREATE_PREFERRED_INPUT_TIMING,
+                            &args, sizeof(args));
+       status = intel_sdvo_read_response(output, NULL, 0);
+       if (status != SDVO_CMD_STATUS_SUCCESS)
+               return false;
+
+       return true;
+}
+
+static bool intel_sdvo_get_preferred_input_timing(struct intel_output *output,
+                                                 struct intel_sdvo_dtd *dtd)
+{
+       bool status;
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_GET_PREFERRED_INPUT_TIMING_PART1,
+                            NULL, 0);
+
+       status = intel_sdvo_read_response(output, &dtd->part1,
+                                         sizeof(dtd->part1));
+       if (status != SDVO_CMD_STATUS_SUCCESS)
+               return false;
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_GET_PREFERRED_INPUT_TIMING_PART2,
+                            NULL, 0);
+
+       status = intel_sdvo_read_response(output, &dtd->part2,
+                                         sizeof(dtd->part2));
+       if (status != SDVO_CMD_STATUS_SUCCESS)
+               return false;
+
+       return false;
+}
 
 static int intel_sdvo_get_clock_rate_mult(struct intel_output *intel_output)
 {
@@ -536,36 +653,12 @@ static bool intel_sdvo_set_clock_rate_mult(struct intel_output *intel_output, u8
        return true;
 }
 
-static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder,
-                                 struct drm_display_mode *mode,
-                                 struct drm_display_mode *adjusted_mode)
-{
-       /* Make the CRTC code factor in the SDVO pixel multiplier.  The SDVO
-        * device will be told of the multiplier during mode_set.
-        */
-       adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode);
-       return true;
-}
-
-static void intel_sdvo_mode_set(struct drm_encoder *encoder,
-                               struct drm_display_mode *mode,
-                               struct drm_display_mode *adjusted_mode)
+static void intel_sdvo_get_dtd_from_mode(struct intel_sdvo_dtd *dtd,
+                                        struct drm_display_mode *mode)
 {
-       struct drm_device *dev = encoder->dev;
-       struct drm_i915_private *dev_priv = dev->dev_private;
-       struct drm_crtc *crtc = encoder->crtc;
-       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-       struct intel_output *intel_output = enc_to_intel_output(encoder);
-       struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
-       u16 width, height;
-       u16 h_blank_len, h_sync_len, v_blank_len, v_sync_len;
-       u16 h_sync_offset, v_sync_offset;
-       u32 sdvox;
-       struct intel_sdvo_dtd output_dtd;
-       int sdvo_pixel_multiply;
-
-       if (!mode)
-               return;
+       uint16_t width, height;
+       uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len;
+       uint16_t h_sync_offset, v_sync_offset;
 
        width = mode->crtc_hdisplay;
        height = mode->crtc_vdisplay;
@@ -580,93 +673,423 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
        h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start;
        v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start;
 
-       output_dtd.part1.clock = mode->clock / 10;
-       output_dtd.part1.h_active = width & 0xff;
-       output_dtd.part1.h_blank = h_blank_len & 0xff;
-       output_dtd.part1.h_high = (((width >> 8) & 0xf) << 4) |
+       dtd->part1.clock = mode->clock / 10;
+       dtd->part1.h_active = width & 0xff;
+       dtd->part1.h_blank = h_blank_len & 0xff;
+       dtd->part1.h_high = (((width >> 8) & 0xf) << 4) |
                ((h_blank_len >> 8) & 0xf);
-       output_dtd.part1.v_active = height & 0xff;
-       output_dtd.part1.v_blank = v_blank_len & 0xff;
-       output_dtd.part1.v_high = (((height >> 8) & 0xf) << 4) |
+       dtd->part1.v_active = height & 0xff;
+       dtd->part1.v_blank = v_blank_len & 0xff;
+       dtd->part1.v_high = (((height >> 8) & 0xf) << 4) |
                ((v_blank_len >> 8) & 0xf);
 
-       output_dtd.part2.h_sync_off = h_sync_offset;
-       output_dtd.part2.h_sync_width = h_sync_len & 0xff;
-       output_dtd.part2.v_sync_off_width = (v_sync_offset & 0xf) << 4 |
+       dtd->part2.h_sync_off = h_sync_offset;
+       dtd->part2.h_sync_width = h_sync_len & 0xff;
+       dtd->part2.v_sync_off_width = (v_sync_offset & 0xf) << 4 |
                (v_sync_len & 0xf);
-       output_dtd.part2.sync_off_width_high = ((h_sync_offset & 0x300) >> 2) |
+       dtd->part2.sync_off_width_high = ((h_sync_offset & 0x300) >> 2) |
                ((h_sync_len & 0x300) >> 4) | ((v_sync_offset & 0x30) >> 2) |
                ((v_sync_len & 0x30) >> 4);
 
-       output_dtd.part2.dtd_flags = 0x18;
+       dtd->part2.dtd_flags = 0x18;
        if (mode->flags & DRM_MODE_FLAG_PHSYNC)
-               output_dtd.part2.dtd_flags |= 0x2;
+               dtd->part2.dtd_flags |= 0x2;
        if (mode->flags & DRM_MODE_FLAG_PVSYNC)
-               output_dtd.part2.dtd_flags |= 0x4;
+               dtd->part2.dtd_flags |= 0x4;
+
+       dtd->part2.sdvo_flags = 0;
+       dtd->part2.v_sync_off_high = v_sync_offset & 0xc0;
+       dtd->part2.reserved = 0;
+}
+
+static void intel_sdvo_get_mode_from_dtd(struct drm_display_mode * mode,
+                                        struct intel_sdvo_dtd *dtd)
+{
+       uint16_t width, height;
+       uint16_t h_blank_len, h_sync_len, v_blank_len, v_sync_len;
+       uint16_t h_sync_offset, v_sync_offset;
+
+       width = mode->crtc_hdisplay;
+       height = mode->crtc_vdisplay;
+
+       /* do some mode translations */
+       h_blank_len = mode->crtc_hblank_end - mode->crtc_hblank_start;
+       h_sync_len = mode->crtc_hsync_end - mode->crtc_hsync_start;
+
+       v_blank_len = mode->crtc_vblank_end - mode->crtc_vblank_start;
+       v_sync_len = mode->crtc_vsync_end - mode->crtc_vsync_start;
+
+       h_sync_offset = mode->crtc_hsync_start - mode->crtc_hblank_start;
+       v_sync_offset = mode->crtc_vsync_start - mode->crtc_vblank_start;
+
+       mode->hdisplay = dtd->part1.h_active;
+       mode->hdisplay += ((dtd->part1.h_high >> 4) & 0x0f) << 8;
+       mode->hsync_start = mode->hdisplay + dtd->part2.h_sync_off;
+       mode->hsync_start += (dtd->part2.sync_off_width_high & 0xa0) << 2;
+       mode->hsync_end = mode->hsync_start + dtd->part2.h_sync_width;
+       mode->hsync_end += (dtd->part2.sync_off_width_high & 0x30) << 4;
+       mode->htotal = mode->hdisplay + dtd->part1.h_blank;
+       mode->htotal += (dtd->part1.h_high & 0xf) << 8;
+
+       mode->vdisplay = dtd->part1.v_active;
+       mode->vdisplay += ((dtd->part1.v_high >> 4) & 0x0f) << 8;
+       mode->vsync_start = mode->vdisplay;
+       mode->vsync_start += (dtd->part2.v_sync_off_width >> 4) & 0xf;
+       mode->vsync_start += (dtd->part2.sync_off_width_high & 0x0a) << 2;
+       mode->vsync_start += dtd->part2.v_sync_off_high & 0xc0;
+       mode->vsync_end = mode->vsync_start +
+               (dtd->part2.v_sync_off_width & 0xf);
+       mode->vsync_end += (dtd->part2.sync_off_width_high & 0x3) << 4;
+       mode->vtotal = mode->vdisplay + dtd->part1.v_blank;
+       mode->vtotal += (dtd->part1.v_high & 0xf) << 8;
+
+       mode->clock = dtd->part1.clock * 10;
+
+       mode->flags &= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
+       if (dtd->part2.dtd_flags & 0x2)
+               mode->flags |= DRM_MODE_FLAG_PHSYNC;
+       if (dtd->part2.dtd_flags & 0x4)
+               mode->flags |= DRM_MODE_FLAG_PVSYNC;
+}
+
+static bool intel_sdvo_get_supp_encode(struct intel_output *output,
+                                      struct intel_sdvo_encode *encode)
+{
+       uint8_t status;
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_GET_SUPP_ENCODE, NULL, 0);
+       status = intel_sdvo_read_response(output, encode, sizeof(*encode));
+       if (status != SDVO_CMD_STATUS_SUCCESS) { /* non-support means DVI */
+               memset(encode, 0, sizeof(*encode));
+               return false;
+       }
+
+       return true;
+}
+
+static bool intel_sdvo_set_encode(struct intel_output *output, uint8_t mode)
+{
+       uint8_t status;
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_SET_ENCODE, &mode, 1);
+       status = intel_sdvo_read_response(output, NULL, 0);
+
+       return (status == SDVO_CMD_STATUS_SUCCESS);
+}
+
+static bool intel_sdvo_set_colorimetry(struct intel_output *output,
+                                      uint8_t mode)
+{
+       uint8_t status;
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_SET_COLORIMETRY, &mode, 1);
+       status = intel_sdvo_read_response(output, NULL, 0);
+
+       return (status == SDVO_CMD_STATUS_SUCCESS);
+}
+
+#if 0
+static void intel_sdvo_dump_hdmi_buf(struct intel_output *output)
+{
+       int i, j;
+       uint8_t set_buf_index[2];
+       uint8_t av_split;
+       uint8_t buf_size;
+       uint8_t buf[48];
+       uint8_t *pos;
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_GET_HBUF_AV_SPLIT, NULL, 0);
+       intel_sdvo_read_response(output, &av_split, 1);
+
+       for (i = 0; i <= av_split; i++) {
+               set_buf_index[0] = i; set_buf_index[1] = 0;
+               intel_sdvo_write_cmd(output, SDVO_CMD_SET_HBUF_INDEX,
+                                    set_buf_index, 2);
+               intel_sdvo_write_cmd(output, SDVO_CMD_GET_HBUF_INFO, NULL, 0);
+               intel_sdvo_read_response(output, &buf_size, 1);
+
+               pos = buf;
+               for (j = 0; j <= buf_size; j += 8) {
+                       intel_sdvo_write_cmd(output, SDVO_CMD_GET_HBUF_DATA,
+                                            NULL, 0);
+                       intel_sdvo_read_response(output, pos, 8);
+                       pos += 8;
+               }
+       }
+}
+#endif
+
+static void intel_sdvo_set_hdmi_buf(struct intel_output *output, int index,
+                               uint8_t *data, int8_t size, uint8_t tx_rate)
+{
+    uint8_t set_buf_index[2];
+
+    set_buf_index[0] = index;
+    set_buf_index[1] = 0;
+
+    intel_sdvo_write_cmd(output, SDVO_CMD_SET_HBUF_INDEX, set_buf_index, 2);
+
+    for (; size > 0; size -= 8) {
+       intel_sdvo_write_cmd(output, SDVO_CMD_SET_HBUF_DATA, data, 8);
+       data += 8;
+    }
+
+    intel_sdvo_write_cmd(output, SDVO_CMD_SET_HBUF_TXRATE, &tx_rate, 1);
+}
+
+static uint8_t intel_sdvo_calc_hbuf_csum(uint8_t *data, uint8_t size)
+{
+       uint8_t csum = 0;
+       int i;
+
+       for (i = 0; i < size; i++)
+               csum += data[i];
+
+       return 0x100 - csum;
+}
+
+#define DIP_TYPE_AVI   0x82
+#define DIP_VERSION_AVI        0x2
+#define DIP_LEN_AVI    13
+
+struct dip_infoframe {
+       uint8_t type;
+       uint8_t version;
+       uint8_t len;
+       uint8_t checksum;
+       union {
+               struct {
+                       /* Packet Byte #1 */
+                       uint8_t S:2;
+                       uint8_t B:2;
+                       uint8_t A:1;
+                       uint8_t Y:2;
+                       uint8_t rsvd1:1;
+                       /* Packet Byte #2 */
+                       uint8_t R:4;
+                       uint8_t M:2;
+                       uint8_t C:2;
+                       /* Packet Byte #3 */
+                       uint8_t SC:2;
+                       uint8_t Q:2;
+                       uint8_t EC:3;
+                       uint8_t ITC:1;
+                       /* Packet Byte #4 */
+                       uint8_t VIC:7;
+                       uint8_t rsvd2:1;
+                       /* Packet Byte #5 */
+                       uint8_t PR:4;
+                       uint8_t rsvd3:4;
+                       /* Packet Byte #6~13 */
+                       uint16_t top_bar_end;
+                       uint16_t bottom_bar_start;
+                       uint16_t left_bar_end;
+                       uint16_t right_bar_start;
+               } avi;
+               struct {
+                       /* Packet Byte #1 */
+                       uint8_t channel_count:3;
+                       uint8_t rsvd1:1;
+                       uint8_t coding_type:4;
+                       /* Packet Byte #2 */
+                       uint8_t sample_size:2; /* SS0, SS1 */
+                       uint8_t sample_frequency:3;
+                       uint8_t rsvd2:3;
+                       /* Packet Byte #3 */
+                       uint8_t coding_type_private:5;
+                       uint8_t rsvd3:3;
+                       /* Packet Byte #4 */
+                       uint8_t channel_allocation;
+                       /* Packet Byte #5 */
+                       uint8_t rsvd4:3;
+                       uint8_t level_shift:4;
+                       uint8_t downmix_inhibit:1;
+               } audio;
+               uint8_t payload[28];
+       } __attribute__ ((packed)) u;
+} __attribute__((packed));
+
+static void intel_sdvo_set_avi_infoframe(struct intel_output *output,
+                                        struct drm_display_mode * mode)
+{
+       struct dip_infoframe avi_if = {
+               .type = DIP_TYPE_AVI,
+               .version = DIP_VERSION_AVI,
+               .len = DIP_LEN_AVI,
+       };
+
+       avi_if.checksum = intel_sdvo_calc_hbuf_csum((uint8_t *)&avi_if,
+                                                   4 + avi_if.len);
+       intel_sdvo_set_hdmi_buf(output, 1, (uint8_t *)&avi_if, 4 + avi_if.len,
+                               SDVO_HBUF_TX_VSYNC);
+}
+
+static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder,
+                                 struct drm_display_mode *mode,
+                                 struct drm_display_mode *adjusted_mode)
+{
+       struct intel_output *output = enc_to_intel_output(encoder);
+       struct intel_sdvo_priv *dev_priv = output->dev_priv;
 
-       output_dtd.part2.sdvo_flags = 0;
-       output_dtd.part2.v_sync_off_high = v_sync_offset & 0xc0;
-       output_dtd.part2.reserved = 0;
+       if (!dev_priv->is_tv) {
+               /* Make the CRTC code factor in the SDVO pixel multiplier.  The
+                * SDVO device will be told of the multiplier during mode_set.
+                */
+               adjusted_mode->clock *= intel_sdvo_get_pixel_multiplier(mode);
+       } else {
+               struct intel_sdvo_dtd output_dtd;
+               bool success;
+
+               /* We need to construct preferred input timings based on our
+                * output timings.  To do that, we have to set the output
+                * timings, even though this isn't really the right place in
+                * the sequence to do it. Oh well.
+                */
+
+
+               /* Set output timings */
+               intel_sdvo_get_dtd_from_mode(&output_dtd, mode);
+               intel_sdvo_set_target_output(output,
+                                            dev_priv->controlled_output);
+               intel_sdvo_set_output_timing(output, &output_dtd);
+
+               /* Set the input timing to the screen. Assume always input 0. */
+               intel_sdvo_set_target_input(output, true, false);
+
+
+               success = intel_sdvo_create_preferred_input_timing(output,
+                                                                  mode->clock / 10,
+                                                                  mode->hdisplay,
+                                                                  mode->vdisplay);
+               if (success) {
+                       struct intel_sdvo_dtd input_dtd;
 
-       /* Set the output timing to the screen */
-       intel_sdvo_set_target_output(intel_output, sdvo_priv->active_outputs);
-       intel_sdvo_set_output_timing(intel_output, &output_dtd);
+                       intel_sdvo_get_preferred_input_timing(output,
+                                                            &input_dtd);
+                       intel_sdvo_get_mode_from_dtd(adjusted_mode, &input_dtd);
+
+               } else {
+                       return false;
+               }
+       }
+       return true;
+}
+
+static void intel_sdvo_mode_set(struct drm_encoder *encoder,
+                               struct drm_display_mode *mode,
+                               struct drm_display_mode *adjusted_mode)
+{
+       struct drm_device *dev = encoder->dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct drm_crtc *crtc = encoder->crtc;
+       struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
+       struct intel_output *output = enc_to_intel_output(encoder);
+       struct intel_sdvo_priv *sdvo_priv = output->dev_priv;
+       u32 sdvox = 0;
+       int sdvo_pixel_multiply;
+       struct intel_sdvo_in_out_map in_out;
+       struct intel_sdvo_dtd input_dtd;
+       u8 status;
+
+       if (!mode)
+               return;
+
+       /* First, set the input mapping for the first input to our controlled
+        * output. This is only correct if we're a single-input device, in
+        * which case the first input is the output from the appropriate SDVO
+        * channel on the motherboard.  In a two-input device, the first input
+        * will be SDVOB and the second SDVOC.
+        */
+       in_out.in0 = sdvo_priv->controlled_output;
+       in_out.in1 = 0;
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_SET_IN_OUT_MAP,
+                            &in_out, sizeof(in_out));
+       status = intel_sdvo_read_response(output, NULL, 0);
+
+       if (sdvo_priv->is_hdmi) {
+               intel_sdvo_set_avi_infoframe(output, mode);
+               sdvox |= SDVO_AUDIO_ENABLE;
+       }
+
+       intel_sdvo_get_dtd_from_mode(&input_dtd, mode);
+
+       /* If it's a TV, we already set the output timing in mode_fixup.
+        * Otherwise, the output timing is equal to the input timing.
+        */
+       if (!sdvo_priv->is_tv) {
+               /* Set the output timing to the screen */
+               intel_sdvo_set_target_output(output,
+                                            sdvo_priv->controlled_output);
+               intel_sdvo_set_output_timing(output, &input_dtd);
+       }
 
        /* Set the input timing to the screen. Assume always input 0. */
-       intel_sdvo_set_target_input(intel_output, true, false);
+       intel_sdvo_set_target_input(output, true, false);
 
-       /* We would like to use i830_sdvo_create_preferred_input_timing() to
+       /* We would like to use intel_sdvo_create_preferred_input_timing() to
         * provide the device with a timing it can support, if it supports that
         * feature.  However, presumably we would need to adjust the CRTC to
         * output the preferred timing, and we don't support that currently.
         */
-       intel_sdvo_set_input_timing(intel_output, &output_dtd);
+#if 0
+       success = intel_sdvo_create_preferred_input_timing(output, clock,
+                                                          width, height);
+       if (success) {
+               struct intel_sdvo_dtd *input_dtd;
+
+               intel_sdvo_get_preferred_input_timing(output, &input_dtd);
+               intel_sdvo_set_input_timing(output, &input_dtd);
+       }
+#else
+       intel_sdvo_set_input_timing(output, &input_dtd);
+#endif
 
        switch (intel_sdvo_get_pixel_multiplier(mode)) {
        case 1:
-               intel_sdvo_set_clock_rate_mult(intel_output,
+               intel_sdvo_set_clock_rate_mult(output,
                                               SDVO_CLOCK_RATE_MULT_1X);
                break;
        case 2:
-               intel_sdvo_set_clock_rate_mult(intel_output,
+               intel_sdvo_set_clock_rate_mult(output,
                                               SDVO_CLOCK_RATE_MULT_2X);
                break;
        case 4:
-               intel_sdvo_set_clock_rate_mult(intel_output,
+               intel_sdvo_set_clock_rate_mult(output,
                                               SDVO_CLOCK_RATE_MULT_4X);
                break;
        }
 
        /* Set the SDVO control regs. */
-        if (0/*IS_I965GM(dev)*/) {
-                sdvox = SDVO_BORDER_ENABLE;
-        } else {
-                sdvox = I915_READ(sdvo_priv->output_device);
-                switch (sdvo_priv->output_device) {
-                case SDVOB:
-                        sdvox &= SDVOB_PRESERVE_MASK;
-                        break;
-                case SDVOC:
-                        sdvox &= SDVOC_PRESERVE_MASK;
-                        break;
-                }
-                sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
-        }
+       if (IS_I965G(dev)) {
+               sdvox |= SDVO_BORDER_ENABLE |
+                       SDVO_VSYNC_ACTIVE_HIGH |
+                       SDVO_HSYNC_ACTIVE_HIGH;
+       } else {
+               sdvox |= I915_READ(sdvo_priv->output_device);
+               switch (sdvo_priv->output_device) {
+               case SDVOB:
+                       sdvox &= SDVOB_PRESERVE_MASK;
+                       break;
+               case SDVOC:
+                       sdvox &= SDVOC_PRESERVE_MASK;
+                       break;
+               }
+               sdvox |= (9 << 19) | SDVO_BORDER_ENABLE;
+       }
        if (intel_crtc->pipe == 1)
                sdvox |= SDVO_PIPE_B_SELECT;
 
        sdvo_pixel_multiply = intel_sdvo_get_pixel_multiplier(mode);
        if (IS_I965G(dev)) {
-               /* done in crtc_mode_set as the dpll_md reg must be written
-                  early */
-       } else if (IS_I945G(dev) || IS_I945GM(dev)) {
-               /* done in crtc_mode_set as it lives inside the
-                  dpll register */
+               /* done in crtc_mode_set as the dpll_md reg must be written early */
+       } else if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev)) {
+               /* done in crtc_mode_set as it lives inside the dpll register */
        } else {
                sdvox |= (sdvo_pixel_multiply - 1) << SDVO_PORT_MULTIPLY_SHIFT;
        }
 
-       intel_sdvo_write_sdvox(intel_output, sdvox);
+       intel_sdvo_write_sdvox(output, sdvox);
 }
 
 static void intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
@@ -714,7 +1137,7 @@ static void intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
 
                if (0)
                        intel_sdvo_set_encoder_power_state(intel_output, mode);
-               intel_sdvo_set_active_outputs(intel_output, sdvo_priv->active_outputs);
+               intel_sdvo_set_active_outputs(intel_output, sdvo_priv->controlled_output);
        }
        return;
 }
@@ -752,6 +1175,9 @@ static void intel_sdvo_save(struct drm_connector *connector)
                                                     &sdvo_priv->save_output_dtd[o]);
                }
        }
+       if (sdvo_priv->is_tv) {
+               /* XXX: Save TV format/enhancements. */
+       }
 
        sdvo_priv->save_SDVOX = I915_READ(sdvo_priv->output_device);
 }
@@ -759,7 +1185,6 @@ static void intel_sdvo_save(struct drm_connector *connector)
 static void intel_sdvo_restore(struct drm_connector *connector)
 {
        struct drm_device *dev = connector->dev;
-       struct drm_i915_private *dev_priv = dev->dev_private;
        struct intel_output *intel_output = to_intel_output(connector);
        struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
        int o;
@@ -790,7 +1215,11 @@ static void intel_sdvo_restore(struct drm_connector *connector)
 
        intel_sdvo_set_clock_rate_mult(intel_output, sdvo_priv->save_sdvo_mult);
 
-       I915_WRITE(sdvo_priv->output_device, sdvo_priv->save_SDVOX);
+       if (sdvo_priv->is_tv) {
+               /* XXX: Restore TV format/enhancements. */
+       }
+
+       intel_sdvo_write_sdvox(intel_output, sdvo_priv->save_SDVOX);
 
        if (sdvo_priv->save_SDVOX & SDVO_ENABLE)
        {
@@ -916,20 +1345,173 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
        status = intel_sdvo_read_response(intel_output, &response, 2);
 
        DRM_DEBUG("SDVO response %d %d\n", response[0], response[1]);
+
+       if (status != SDVO_CMD_STATUS_SUCCESS)
+               return connector_status_unknown;
+
        if ((response[0] != 0) || (response[1] != 0))
                return connector_status_connected;
        else
                return connector_status_disconnected;
 }
 
-static int intel_sdvo_get_modes(struct drm_connector *connector)
+static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
 {
        struct intel_output *intel_output = to_intel_output(connector);
+       struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv;
 
        /* set the bus switch and get the modes */
-       intel_sdvo_set_control_bus_switch(intel_output, SDVO_CONTROL_BUS_DDC2);
+       intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus);
        intel_ddc_get_modes(intel_output);
 
+#if 0
+       struct drm_device *dev = encoder->dev;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       /* Mac mini hack.  On this device, I get DDC through the analog, which
+        * load-detects as disconnected.  I fail to DDC through the SDVO DDC,
+        * but it does load-detect as connected.  So, just steal the DDC bits
+        * from analog when we fail at finding it the right way.
+        */
+       crt = xf86_config->output[0];
+       intel_output = crt->driver_private;
+       if (intel_output->type == I830_OUTPUT_ANALOG &&
+           crt->funcs->detect(crt) == XF86OutputStatusDisconnected) {
+               I830I2CInit(pScrn, &intel_output->pDDCBus, GPIOA, "CRTDDC_A");
+               edid_mon = xf86OutputGetEDID(crt, intel_output->pDDCBus);
+               xf86DestroyI2CBusRec(intel_output->pDDCBus, true, true);
+       }
+       if (edid_mon) {
+               xf86OutputSetEDID(output, edid_mon);
+               modes = xf86OutputGetEDIDModes(output);
+       }
+#endif
+}
+
+/**
+ * This function checks the current TV format, and chooses a default if
+ * it hasn't been set.
+ */
+static void
+intel_sdvo_check_tv_format(struct intel_output *output)
+{
+       struct intel_sdvo_priv *dev_priv = output->dev_priv;
+       struct intel_sdvo_tv_format format, unset;
+       uint8_t status;
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_GET_TV_FORMAT, NULL, 0);
+       status = intel_sdvo_read_response(output, &format, sizeof(format));
+       if (status != SDVO_CMD_STATUS_SUCCESS)
+               return;
+
+       memset(&unset, 0, sizeof(unset));
+       if (memcmp(&format, &unset, sizeof(format))) {
+               DRM_DEBUG("%s: Choosing default TV format of NTSC-M\n",
+                         SDVO_NAME(dev_priv));
+
+               format.ntsc_m = true;
+               intel_sdvo_write_cmd(output, SDVO_CMD_SET_TV_FORMAT, NULL, 0);
+               status = intel_sdvo_read_response(output, NULL, 0);
+       }
+}
+
+/*
+ * Set of SDVO TV modes.
+ * Note!  This is in reply order (see loop in get_tv_modes).
+ * XXX: all 60Hz refresh?
+ */
+struct drm_display_mode sdvo_tv_modes[] = {
+       { DRM_MODE("320x200", DRM_MODE_TYPE_DRIVER, 5815680, 321, 384, 416,
+                  200, 0, 232, 201, 233, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("320x240", DRM_MODE_TYPE_DRIVER, 6814080, 321, 384, 416,
+                  240, 0, 272, 241, 273, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("400x300", DRM_MODE_TYPE_DRIVER, 9910080, 401, 464, 496,
+                  300, 0, 332, 301, 333, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("640x350", DRM_MODE_TYPE_DRIVER, 16913280, 641, 704, 736,
+                  350, 0, 382, 351, 383, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("640x400", DRM_MODE_TYPE_DRIVER, 19121280, 641, 704, 736,
+                  400, 0, 432, 401, 433, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("640x400", DRM_MODE_TYPE_DRIVER, 19121280, 641, 704, 736,
+                  400, 0, 432, 401, 433, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("704x480", DRM_MODE_TYPE_DRIVER, 24624000, 705, 768, 800,
+                  480, 0, 512, 481, 513, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("704x576", DRM_MODE_TYPE_DRIVER, 29232000, 705, 768, 800,
+                  576, 0, 608, 577, 609, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("720x350", DRM_MODE_TYPE_DRIVER, 18751680, 721, 784, 816,
+                  350, 0, 382, 351, 383, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("720x400", DRM_MODE_TYPE_DRIVER, 21199680, 721, 784, 816,
+                  400, 0, 432, 401, 433, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 25116480, 721, 784, 816,
+                  480, 0, 512, 481, 513, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("720x540", DRM_MODE_TYPE_DRIVER, 28054080, 721, 784, 816,
+                  540, 0, 572, 541, 573, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 29816640, 721, 784, 816,
+                  576, 0, 608, 577, 609, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("768x576", DRM_MODE_TYPE_DRIVER, 31570560, 769, 832, 864,
+                  576, 0, 608, 577, 609, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("800x600", DRM_MODE_TYPE_DRIVER, 34030080, 801, 864, 896,
+                  600, 0, 632, 601, 633, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("832x624", DRM_MODE_TYPE_DRIVER, 36581760, 833, 896, 928,
+                  624, 0, 656, 625, 657, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("920x766", DRM_MODE_TYPE_DRIVER, 48707040, 921, 984, 1016,
+                  766, 0, 798, 767, 799, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("1024x768", DRM_MODE_TYPE_DRIVER, 53827200, 1025, 1088, 1120,
+                  768, 0, 800, 769, 801, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+       { DRM_MODE("1280x1024", DRM_MODE_TYPE_DRIVER, 87265920, 1281, 1344, 1376,
+                  1024, 0, 1056, 1025, 1057, 4196112, 0,
+                  DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
+};
+
+static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
+{
+       struct intel_output *output = to_intel_output(connector);
+       uint32_t reply = 0;
+       uint8_t status;
+       int i = 0;
+
+       intel_sdvo_check_tv_format(output);
+
+       /* Read the list of supported input resolutions for the selected TV
+        * format.
+        */
+       intel_sdvo_write_cmd(output, SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT,
+                            NULL, 0);
+       status = intel_sdvo_read_response(output, &reply, 3);
+       if (status != SDVO_CMD_STATUS_SUCCESS)
+               return;
+
+       for (i = 0; i < ARRAY_SIZE(sdvo_tv_modes); i++)
+               if (reply & (1 << i))
+                       drm_mode_probed_add(connector, &sdvo_tv_modes[i]);
+}
+
+static int intel_sdvo_get_modes(struct drm_connector *connector)
+{
+       struct intel_output *output = to_intel_output(connector);
+       struct intel_sdvo_priv *sdvo_priv = output->dev_priv;
+
+       if (sdvo_priv->is_tv)
+               intel_sdvo_get_tv_modes(connector);
+       else
+               intel_sdvo_get_ddc_modes(connector);
+
        if (list_empty(&connector->probed_modes))
                return 0;
        return 1;
@@ -978,6 +1560,65 @@ static const struct drm_encoder_funcs intel_sdvo_enc_funcs = {
 };
 
 
+/**
+ * Choose the appropriate DDC bus for control bus switch command for this
+ * SDVO output based on the controlled output.
+ *
+ * DDC bus number assignment is in a priority order of RGB outputs, then TMDS
+ * outputs, then LVDS outputs.
+ */
+static void
+intel_sdvo_select_ddc_bus(struct intel_sdvo_priv *dev_priv)
+{
+       uint16_t mask = 0;
+       unsigned int num_bits;
+
+       /* Make a mask of outputs less than or equal to our own priority in the
+        * list.
+        */
+       switch (dev_priv->controlled_output) {
+       case SDVO_OUTPUT_LVDS1:
+               mask |= SDVO_OUTPUT_LVDS1;
+       case SDVO_OUTPUT_LVDS0:
+               mask |= SDVO_OUTPUT_LVDS0;
+       case SDVO_OUTPUT_TMDS1:
+               mask |= SDVO_OUTPUT_TMDS1;
+       case SDVO_OUTPUT_TMDS0:
+               mask |= SDVO_OUTPUT_TMDS0;
+       case SDVO_OUTPUT_RGB1:
+               mask |= SDVO_OUTPUT_RGB1;
+       case SDVO_OUTPUT_RGB0:
+               mask |= SDVO_OUTPUT_RGB0;
+               break;
+       }
+
+       /* Count bits to find what number we are in the priority list. */
+       mask &= dev_priv->caps.output_flags;
+       num_bits = hweight16(mask);
+       if (num_bits > 3) {
+               /* if more than 3 outputs, default to DDC bus 3 for now */
+               num_bits = 3;
+       }
+
+       /* Corresponds to SDVO_CONTROL_BUS_DDCx */
+       dev_priv->ddc_bus = 1 << num_bits;
+}
+
+static bool
+intel_sdvo_get_digital_encoding_mode(struct intel_output *output)
+{
+       struct intel_sdvo_priv *sdvo_priv = output->dev_priv;
+       uint8_t status;
+
+       intel_sdvo_set_target_output(output, sdvo_priv->controlled_output);
+
+       intel_sdvo_write_cmd(output, SDVO_CMD_GET_ENCODE, NULL, 0);
+       status = intel_sdvo_read_response(output, &sdvo_priv->is_hdmi, 1);
+       if (status != SDVO_CMD_STATUS_SUCCESS)
+               return false;
+       return true;
+}
+
 bool intel_sdvo_init(struct drm_device *dev, int output_device)
 {
        struct drm_connector *connector;
@@ -1040,45 +1681,76 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
 
        intel_sdvo_get_capabilities(intel_output, &sdvo_priv->caps);
 
-       memset(&sdvo_priv->active_outputs, 0, sizeof(sdvo_priv->active_outputs));
+       if (sdvo_priv->caps.output_flags &
+           (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) {
+               if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_TMDS0)
+                       sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS0;
+               else
+                       sdvo_priv->controlled_output = SDVO_OUTPUT_TMDS1;
+
+               connector->display_info.subpixel_order = SubPixelHorizontalRGB;
+               encoder_type = DRM_MODE_ENCODER_TMDS;
+               connector_type = DRM_MODE_CONNECTOR_DVID;
 
-       /* TODO, CVBS, SVID, YPRPB & SCART outputs. */
-       if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB0)
+               if (intel_sdvo_get_supp_encode(intel_output,
+                                              &sdvo_priv->encode) &&
+                   intel_sdvo_get_digital_encoding_mode(intel_output) &&
+                   sdvo_priv->is_hdmi) {
+                       /* enable hdmi encoding mode if supported */
+                       intel_sdvo_set_encode(intel_output, SDVO_ENCODE_HDMI);
+                       intel_sdvo_set_colorimetry(intel_output,
+                                                  SDVO_COLORIMETRY_RGB256);
+                       connector_type = DRM_MODE_CONNECTOR_HDMIA;
+               }
+       }
+       else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_SVID0)
        {
-               sdvo_priv->active_outputs = SDVO_OUTPUT_RGB0;
+               sdvo_priv->controlled_output = SDVO_OUTPUT_SVID0;
+               connector->display_info.subpixel_order = SubPixelHorizontalRGB;
+               encoder_type = DRM_MODE_ENCODER_TVDAC;
+               connector_type = DRM_MODE_CONNECTOR_SVIDEO;
+               sdvo_priv->is_tv = true;
+               intel_output->needs_tv_clock = true;
+       }
+       else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB0)
+       {
+               sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0;
                connector->display_info.subpixel_order = SubPixelHorizontalRGB;
                encoder_type = DRM_MODE_ENCODER_DAC;
                connector_type = DRM_MODE_CONNECTOR_VGA;
        }
        else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_RGB1)
        {
-               sdvo_priv->active_outputs = SDVO_OUTPUT_RGB1;
+               sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1;
                connector->display_info.subpixel_order = SubPixelHorizontalRGB;
                encoder_type = DRM_MODE_ENCODER_DAC;
                connector_type = DRM_MODE_CONNECTOR_VGA;
        }
-       else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_TMDS0)
+       else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS0)
        {
-               sdvo_priv->active_outputs = SDVO_OUTPUT_TMDS0;
+               sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0;
                connector->display_info.subpixel_order = SubPixelHorizontalRGB;
-               encoder_type = DRM_MODE_ENCODER_TMDS;
-               connector_type = DRM_MODE_CONNECTOR_DVID;
+               encoder_type = DRM_MODE_ENCODER_LVDS;
+               connector_type = DRM_MODE_CONNECTOR_LVDS;
        }
-       else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_TMDS1)
+       else if (sdvo_priv->caps.output_flags & SDVO_OUTPUT_LVDS1)
        {
-               sdvo_priv->active_outputs = SDVO_OUTPUT_TMDS1;
+               sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS1;
                connector->display_info.subpixel_order = SubPixelHorizontalRGB;
-               encoder_type = DRM_MODE_ENCODER_TMDS;
-               connector_type = DRM_MODE_CONNECTOR_DVID;
+               encoder_type = DRM_MODE_ENCODER_LVDS;
+               connector_type = DRM_MODE_CONNECTOR_LVDS;
        }
        else
        {
                unsigned char bytes[2];
 
+               sdvo_priv->controlled_output = 0;
                memcpy (bytes, &sdvo_priv->caps.output_flags, 2);
-               DRM_DEBUG("%s: No active RGB or TMDS outputs (0x%02x%02x)\n",
+               DRM_DEBUG("%s: Unknown SDVO output type (0x%02x%02x)\n",
                          SDVO_NAME(sdvo_priv),
                          bytes[0], bytes[1]);
+               encoder_type = DRM_MODE_ENCODER_NONE;
+               connector_type = DRM_MODE_CONNECTOR_Unknown;
                goto err_i2c;
        }
 
@@ -1089,6 +1761,8 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
        drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc);
        drm_sysfs_connector_add(connector);
 
+       intel_sdvo_select_ddc_bus(sdvo_priv);
+
        /* Set the input timing to the screen. Assume always input 0. */
        intel_sdvo_set_target_input(intel_output, true, false);
 
index 861a43f8693cf5871a885be49ed7cad1744bbbb2..1117b9c151a671d655779331dea38164f7508dd4 100644 (file)
@@ -173,6 +173,9 @@ struct intel_sdvo_get_trained_inputs_response {
  * Returns two struct intel_sdvo_output_flags structures.
  */
 #define SDVO_CMD_GET_IN_OUT_MAP                                0x06
+struct intel_sdvo_in_out_map {
+    u16 in0, in1;
+};
 
 /**
  * Sets the current mapping of SDVO inputs to outputs on the device.
@@ -206,7 +209,8 @@ struct intel_sdvo_get_trained_inputs_response {
 struct intel_sdvo_get_interrupt_event_source_response {
     u16 interrupt_status;
     unsigned int ambient_light_interrupt:1;
-    unsigned int pad:7;
+    unsigned int hdmi_audio_encrypt_change:1;
+    unsigned int pad:6;
 } __attribute__((packed));
 
 /**
@@ -305,23 +309,411 @@ struct intel_sdvo_set_target_input_args {
 # define SDVO_CLOCK_RATE_MULT_4X                               (1 << 3)
 
 #define SDVO_CMD_GET_SUPPORTED_TV_FORMATS              0x27
+/** 5 bytes of bit flags for TV formats shared by all TV format functions */
+struct intel_sdvo_tv_format {
+    unsigned int ntsc_m:1;
+    unsigned int ntsc_j:1;
+    unsigned int ntsc_443:1;
+    unsigned int pal_b:1;
+    unsigned int pal_d:1;
+    unsigned int pal_g:1;
+    unsigned int pal_h:1;
+    unsigned int pal_i:1;
+
+    unsigned int pal_m:1;
+    unsigned int pal_n:1;
+    unsigned int pal_nc:1;
+    unsigned int pal_60:1;
+    unsigned int secam_b:1;
+    unsigned int secam_d:1;
+    unsigned int secam_g:1;
+    unsigned int secam_k:1;
+
+    unsigned int secam_k1:1;
+    unsigned int secam_l:1;
+    unsigned int secam_60:1;
+    unsigned int hdtv_std_smpte_240m_1080i_59:1;
+    unsigned int hdtv_std_smpte_240m_1080i_60:1;
+    unsigned int hdtv_std_smpte_260m_1080i_59:1;
+    unsigned int hdtv_std_smpte_260m_1080i_60:1;
+    unsigned int hdtv_std_smpte_274m_1080i_50:1;
+
+    unsigned int hdtv_std_smpte_274m_1080i_59:1;
+    unsigned int hdtv_std_smpte_274m_1080i_60:1;
+    unsigned int hdtv_std_smpte_274m_1080p_23:1;
+    unsigned int hdtv_std_smpte_274m_1080p_24:1;
+    unsigned int hdtv_std_smpte_274m_1080p_25:1;
+    unsigned int hdtv_std_smpte_274m_1080p_29:1;
+    unsigned int hdtv_std_smpte_274m_1080p_30:1;
+    unsigned int hdtv_std_smpte_274m_1080p_50:1;
+
+    unsigned int hdtv_std_smpte_274m_1080p_59:1;
+    unsigned int hdtv_std_smpte_274m_1080p_60:1;
+    unsigned int hdtv_std_smpte_295m_1080i_50:1;
+    unsigned int hdtv_std_smpte_295m_1080p_50:1;
+    unsigned int hdtv_std_smpte_296m_720p_59:1;
+    unsigned int hdtv_std_smpte_296m_720p_60:1;
+    unsigned int hdtv_std_smpte_296m_720p_50:1;
+    unsigned int hdtv_std_smpte_293m_480p_59:1;
+
+    unsigned int hdtv_std_smpte_170m_480i_59:1;
+    unsigned int hdtv_std_iturbt601_576i_50:1;
+    unsigned int hdtv_std_iturbt601_576p_50:1;
+    unsigned int hdtv_std_eia_7702a_480i_60:1;
+    unsigned int hdtv_std_eia_7702a_480p_60:1;
+    unsigned int pad:3;
+} __attribute__((packed));
 
 #define SDVO_CMD_GET_TV_FORMAT                         0x28
 
 #define SDVO_CMD_SET_TV_FORMAT                         0x29
 
+/** Returns the resolutiosn that can be used with the given TV format */
+#define SDVO_CMD_GET_SDTV_RESOLUTION_SUPPORT           0x83
+struct intel_sdvo_sdtv_resolution_request {
+    unsigned int ntsc_m:1;
+    unsigned int ntsc_j:1;
+    unsigned int ntsc_443:1;
+    unsigned int pal_b:1;
+    unsigned int pal_d:1;
+    unsigned int pal_g:1;
+    unsigned int pal_h:1;
+    unsigned int pal_i:1;
+
+    unsigned int pal_m:1;
+    unsigned int pal_n:1;
+    unsigned int pal_nc:1;
+    unsigned int pal_60:1;
+    unsigned int secam_b:1;
+    unsigned int secam_d:1;
+    unsigned int secam_g:1;
+    unsigned int secam_k:1;
+
+    unsigned int secam_k1:1;
+    unsigned int secam_l:1;
+    unsigned int secam_60:1;
+    unsigned int pad:5;
+} __attribute__((packed));
+
+struct intel_sdvo_sdtv_resolution_reply {
+    unsigned int res_320x200:1;
+    unsigned int res_320x240:1;
+    unsigned int res_400x300:1;
+    unsigned int res_640x350:1;
+    unsigned int res_640x400:1;
+    unsigned int res_640x480:1;
+    unsigned int res_704x480:1;
+    unsigned int res_704x576:1;
+
+    unsigned int res_720x350:1;
+    unsigned int res_720x400:1;
+    unsigned int res_720x480:1;
+    unsigned int res_720x540:1;
+    unsigned int res_720x576:1;
+    unsigned int res_768x576:1;
+    unsigned int res_800x600:1;
+    unsigned int res_832x624:1;
+
+    unsigned int res_920x766:1;
+    unsigned int res_1024x768:1;
+    unsigned int res_1280x1024:1;
+    unsigned int pad:5;
+} __attribute__((packed));
+
+/* Get supported resolution with squire pixel aspect ratio that can be
+   scaled for the requested HDTV format */
+#define SDVO_CMD_GET_SCALED_HDTV_RESOLUTION_SUPPORT            0x85
+
+struct intel_sdvo_hdtv_resolution_request {
+    unsigned int hdtv_std_smpte_240m_1080i_59:1;
+    unsigned int hdtv_std_smpte_240m_1080i_60:1;
+    unsigned int hdtv_std_smpte_260m_1080i_59:1;
+    unsigned int hdtv_std_smpte_260m_1080i_60:1;
+    unsigned int hdtv_std_smpte_274m_1080i_50:1;
+    unsigned int hdtv_std_smpte_274m_1080i_59:1;
+    unsigned int hdtv_std_smpte_274m_1080i_60:1;
+    unsigned int hdtv_std_smpte_274m_1080p_23:1;
+
+    unsigned int hdtv_std_smpte_274m_1080p_24:1;
+    unsigned int hdtv_std_smpte_274m_1080p_25:1;
+    unsigned int hdtv_std_smpte_274m_1080p_29:1;
+    unsigned int hdtv_std_smpte_274m_1080p_30:1;
+    unsigned int hdtv_std_smpte_274m_1080p_50:1;
+    unsigned int hdtv_std_smpte_274m_1080p_59:1;
+    unsigned int hdtv_std_smpte_274m_1080p_60:1;
+    unsigned int hdtv_std_smpte_295m_1080i_50:1;
+
+    unsigned int hdtv_std_smpte_295m_1080p_50:1;
+    unsigned int hdtv_std_smpte_296m_720p_59:1;
+    unsigned int hdtv_std_smpte_296m_720p_60:1;
+    unsigned int hdtv_std_smpte_296m_720p_50:1;
+    unsigned int hdtv_std_smpte_293m_480p_59:1;
+    unsigned int hdtv_std_smpte_170m_480i_59:1;
+    unsigned int hdtv_std_iturbt601_576i_50:1;
+    unsigned int hdtv_std_iturbt601_576p_50:1;
+
+    unsigned int hdtv_std_eia_7702a_480i_60:1;
+    unsigned int hdtv_std_eia_7702a_480p_60:1;
+    unsigned int pad:6;
+} __attribute__((packed));
+
+struct intel_sdvo_hdtv_resolution_reply {
+    unsigned int res_640x480:1;
+    unsigned int res_800x600:1;
+    unsigned int res_1024x768:1;
+    unsigned int res_1280x960:1;
+    unsigned int res_1400x1050:1;
+    unsigned int res_1600x1200:1;
+    unsigned int res_1920x1440:1;
+    unsigned int res_2048x1536:1;
+
+    unsigned int res_2560x1920:1;
+    unsigned int res_3200x2400:1;
+    unsigned int res_3840x2880:1;
+    unsigned int pad1:5;
+
+    unsigned int res_848x480:1;
+    unsigned int res_1064x600:1;
+    unsigned int res_1280x720:1;
+    unsigned int res_1360x768:1;
+    unsigned int res_1704x960:1;
+    unsigned int res_1864x1050:1;
+    unsigned int res_1920x1080:1;
+    unsigned int res_2128x1200:1;
+
+    unsigned int res_2560x1400:1;
+    unsigned int res_2728x1536:1;
+    unsigned int res_3408x1920:1;
+    unsigned int res_4264x2400:1;
+    unsigned int res_5120x2880:1;
+    unsigned int pad2:3;
+
+    unsigned int res_768x480:1;
+    unsigned int res_960x600:1;
+    unsigned int res_1152x720:1;
+    unsigned int res_1124x768:1;
+    unsigned int res_1536x960:1;
+    unsigned int res_1680x1050:1;
+    unsigned int res_1728x1080:1;
+    unsigned int res_1920x1200:1;
+
+    unsigned int res_2304x1440:1;
+    unsigned int res_2456x1536:1;
+    unsigned int res_3072x1920:1;
+    unsigned int res_3840x2400:1;
+    unsigned int res_4608x2880:1;
+    unsigned int pad3:3;
+
+    unsigned int res_1280x1024:1;
+    unsigned int pad4:7;
+
+    unsigned int res_1280x768:1;
+    unsigned int pad5:7;
+} __attribute__((packed));
+
+/* Get supported power state returns info for encoder and monitor, rely on
+   last SetTargetInput and SetTargetOutput calls */
 #define SDVO_CMD_GET_SUPPORTED_POWER_STATES            0x2a
+/* Get power state returns info for encoder and monitor, rely on last
+   SetTargetInput and SetTargetOutput calls */
+#define SDVO_CMD_GET_POWER_STATE                       0x2b
 #define SDVO_CMD_GET_ENCODER_POWER_STATE               0x2b
 #define SDVO_CMD_SET_ENCODER_POWER_STATE               0x2c
 # define SDVO_ENCODER_STATE_ON                                 (1 << 0)
 # define SDVO_ENCODER_STATE_STANDBY                            (1 << 1)
 # define SDVO_ENCODER_STATE_SUSPEND                            (1 << 2)
 # define SDVO_ENCODER_STATE_OFF                                        (1 << 3)
+# define SDVO_MONITOR_STATE_ON                                 (1 << 4)
+# define SDVO_MONITOR_STATE_STANDBY                            (1 << 5)
+# define SDVO_MONITOR_STATE_SUSPEND                            (1 << 6)
+# define SDVO_MONITOR_STATE_OFF                                        (1 << 7)
+
+#define SDVO_CMD_GET_MAX_PANEL_POWER_SEQUENCING                0x2d
+#define SDVO_CMD_GET_PANEL_POWER_SEQUENCING            0x2e
+#define SDVO_CMD_SET_PANEL_POWER_SEQUENCING            0x2f
+/**
+ * The panel power sequencing parameters are in units of milliseconds.
+ * The high fields are bits 8:9 of the 10-bit values.
+ */
+struct sdvo_panel_power_sequencing {
+    u8 t0;
+    u8 t1;
+    u8 t2;
+    u8 t3;
+    u8 t4;
+
+    unsigned int t0_high:2;
+    unsigned int t1_high:2;
+    unsigned int t2_high:2;
+    unsigned int t3_high:2;
+
+    unsigned int t4_high:2;
+    unsigned int pad:6;
+} __attribute__((packed));
+
+#define SDVO_CMD_GET_MAX_BACKLIGHT_LEVEL               0x30
+struct sdvo_max_backlight_reply {
+    u8 max_value;
+    u8 default_value;
+} __attribute__((packed));
+
+#define SDVO_CMD_GET_BACKLIGHT_LEVEL                   0x31
+#define SDVO_CMD_SET_BACKLIGHT_LEVEL                   0x32
+
+#define SDVO_CMD_GET_AMBIENT_LIGHT                     0x33
+struct sdvo_get_ambient_light_reply {
+    u16 trip_low;
+    u16 trip_high;
+    u16 value;
+} __attribute__((packed));
+#define SDVO_CMD_SET_AMBIENT_LIGHT                     0x34
+struct sdvo_set_ambient_light_reply {
+    u16 trip_low;
+    u16 trip_high;
+    unsigned int enable:1;
+    unsigned int pad:7;
+} __attribute__((packed));
+
+/* Set display power state */
+#define SDVO_CMD_SET_DISPLAY_POWER_STATE               0x7d
+# define SDVO_DISPLAY_STATE_ON                         (1 << 0)
+# define SDVO_DISPLAY_STATE_STANDBY                    (1 << 1)
+# define SDVO_DISPLAY_STATE_SUSPEND                    (1 << 2)
+# define SDVO_DISPLAY_STATE_OFF                                (1 << 3)
+
+#define SDVO_CMD_GET_SUPPORTED_ENHANCEMENTS            0x84
+struct intel_sdvo_enhancements_reply {
+    unsigned int flicker_filter:1;
+    unsigned int flicker_filter_adaptive:1;
+    unsigned int flicker_filter_2d:1;
+    unsigned int saturation:1;
+    unsigned int hue:1;
+    unsigned int brightness:1;
+    unsigned int contrast:1;
+    unsigned int overscan_h:1;
+
+    unsigned int overscan_v:1;
+    unsigned int position_h:1;
+    unsigned int position_v:1;
+    unsigned int sharpness:1;
+    unsigned int dot_crawl:1;
+    unsigned int dither:1;
+    unsigned int max_tv_chroma_filter:1;
+    unsigned int max_tv_luma_filter:1;
+} __attribute__((packed));
+
+/* Picture enhancement limits below are dependent on the current TV format,
+ * and thus need to be queried and set after it.
+ */
+#define SDVO_CMD_GET_MAX_FLICKER_FITER                 0x4d
+#define SDVO_CMD_GET_MAX_ADAPTIVE_FLICKER_FITER                0x7b
+#define SDVO_CMD_GET_MAX_2D_FLICKER_FITER              0x52
+#define SDVO_CMD_GET_MAX_SATURATION                    0x55
+#define SDVO_CMD_GET_MAX_HUE                           0x58
+#define SDVO_CMD_GET_MAX_BRIGHTNESS                    0x5b
+#define SDVO_CMD_GET_MAX_CONTRAST                      0x5e
+#define SDVO_CMD_GET_MAX_OVERSCAN_H                    0x61
+#define SDVO_CMD_GET_MAX_OVERSCAN_V                    0x64
+#define SDVO_CMD_GET_MAX_POSITION_H                    0x67
+#define SDVO_CMD_GET_MAX_POSITION_V                    0x6a
+#define SDVO_CMD_GET_MAX_SHARPNESS_V                   0x6d
+#define SDVO_CMD_GET_MAX_TV_CHROMA                     0x74
+#define SDVO_CMD_GET_MAX_TV_LUMA                       0x77
+struct intel_sdvo_enhancement_limits_reply {
+    u16 max_value;
+    u16 default_value;
+} __attribute__((packed));
 
-#define SDVO_CMD_SET_TV_RESOLUTION_SUPPORT             0x93
+#define SDVO_CMD_GET_LVDS_PANEL_INFORMATION            0x7f
+#define SDVO_CMD_SET_LVDS_PANEL_INFORMATION            0x80
+# define SDVO_LVDS_COLOR_DEPTH_18                      (0 << 0)
+# define SDVO_LVDS_COLOR_DEPTH_24                      (1 << 0)
+# define SDVO_LVDS_CONNECTOR_SPWG                      (0 << 2)
+# define SDVO_LVDS_CONNECTOR_OPENLDI                   (1 << 2)
+# define SDVO_LVDS_SINGLE_CHANNEL                      (0 << 4)
+# define SDVO_LVDS_DUAL_CHANNEL                                (1 << 4)
+
+#define SDVO_CMD_GET_FLICKER_FILTER                    0x4e
+#define SDVO_CMD_SET_FLICKER_FILTER                    0x4f
+#define SDVO_CMD_GET_ADAPTIVE_FLICKER_FITER            0x50
+#define SDVO_CMD_SET_ADAPTIVE_FLICKER_FITER            0x51
+#define SDVO_CMD_GET_2D_FLICKER_FITER                  0x53
+#define SDVO_CMD_SET_2D_FLICKER_FITER                  0x54
+#define SDVO_CMD_GET_SATURATION                                0x56
+#define SDVO_CMD_SET_SATURATION                                0x57
+#define SDVO_CMD_GET_HUE                               0x59
+#define SDVO_CMD_SET_HUE                               0x5a
+#define SDVO_CMD_GET_BRIGHTNESS                                0x5c
+#define SDVO_CMD_SET_BRIGHTNESS                                0x5d
+#define SDVO_CMD_GET_CONTRAST                          0x5f
+#define SDVO_CMD_SET_CONTRAST                          0x60
+#define SDVO_CMD_GET_OVERSCAN_H                                0x62
+#define SDVO_CMD_SET_OVERSCAN_H                                0x63
+#define SDVO_CMD_GET_OVERSCAN_V                                0x65
+#define SDVO_CMD_SET_OVERSCAN_V                                0x66
+#define SDVO_CMD_GET_POSITION_H                                0x68
+#define SDVO_CMD_SET_POSITION_H                                0x69
+#define SDVO_CMD_GET_POSITION_V                                0x6b
+#define SDVO_CMD_SET_POSITION_V                                0x6c
+#define SDVO_CMD_GET_SHARPNESS                         0x6e
+#define SDVO_CMD_SET_SHARPNESS                         0x6f
+#define SDVO_CMD_GET_TV_CHROMA                         0x75
+#define SDVO_CMD_SET_TV_CHROMA                         0x76
+#define SDVO_CMD_GET_TV_LUMA                           0x78
+#define SDVO_CMD_SET_TV_LUMA                           0x79
+struct intel_sdvo_enhancements_arg {
+    u16 value;
+}__attribute__((packed));
+
+#define SDVO_CMD_GET_DOT_CRAWL                         0x70
+#define SDVO_CMD_SET_DOT_CRAWL                         0x71
+# define SDVO_DOT_CRAWL_ON                                     (1 << 0)
+# define SDVO_DOT_CRAWL_DEFAULT_ON                             (1 << 1)
+
+#define SDVO_CMD_GET_DITHER                            0x72
+#define SDVO_CMD_SET_DITHER                            0x73
+# define SDVO_DITHER_ON                                                (1 << 0)
+# define SDVO_DITHER_DEFAULT_ON                                        (1 << 1)
 
 #define SDVO_CMD_SET_CONTROL_BUS_SWITCH                        0x7a
-# define SDVO_CONTROL_BUS_PROM                         0x0
-# define SDVO_CONTROL_BUS_DDC1                         0x1
-# define SDVO_CONTROL_BUS_DDC2                         0x2
-# define SDVO_CONTROL_BUS_DDC3                         0x3
+# define SDVO_CONTROL_BUS_PROM                         (1 << 0)
+# define SDVO_CONTROL_BUS_DDC1                         (1 << 1)
+# define SDVO_CONTROL_BUS_DDC2                         (1 << 2)
+# define SDVO_CONTROL_BUS_DDC3                         (1 << 3)
+
+/* HDMI op codes */
+#define SDVO_CMD_GET_SUPP_ENCODE       0x9d
+#define SDVO_CMD_GET_ENCODE            0x9e
+#define SDVO_CMD_SET_ENCODE            0x9f
+  #define SDVO_ENCODE_DVI      0x0
+  #define SDVO_ENCODE_HDMI     0x1
+#define SDVO_CMD_SET_PIXEL_REPLI       0x8b
+#define SDVO_CMD_GET_PIXEL_REPLI       0x8c
+#define SDVO_CMD_GET_COLORIMETRY_CAP   0x8d
+#define SDVO_CMD_SET_COLORIMETRY       0x8e
+  #define SDVO_COLORIMETRY_RGB256   0x0
+  #define SDVO_COLORIMETRY_RGB220   0x1
+  #define SDVO_COLORIMETRY_YCrCb422 0x3
+  #define SDVO_COLORIMETRY_YCrCb444 0x4
+#define SDVO_CMD_GET_COLORIMETRY       0x8f
+#define SDVO_CMD_GET_AUDIO_ENCRYPT_PREFER 0x90
+#define SDVO_CMD_SET_AUDIO_STAT                0x91
+#define SDVO_CMD_GET_AUDIO_STAT                0x92
+#define SDVO_CMD_SET_HBUF_INDEX                0x93
+#define SDVO_CMD_GET_HBUF_INDEX                0x94
+#define SDVO_CMD_GET_HBUF_INFO         0x95
+#define SDVO_CMD_SET_HBUF_AV_SPLIT     0x96
+#define SDVO_CMD_GET_HBUF_AV_SPLIT     0x97
+#define SDVO_CMD_SET_HBUF_DATA         0x98
+#define SDVO_CMD_GET_HBUF_DATA         0x99
+#define SDVO_CMD_SET_HBUF_TXRATE       0x9a
+#define SDVO_CMD_GET_HBUF_TXRATE       0x9b
+  #define SDVO_HBUF_TX_DISABLED        (0 << 6)
+  #define SDVO_HBUF_TX_ONCE    (2 << 6)
+  #define SDVO_HBUF_TX_VSYNC   (3 << 6)
+#define SDVO_CMD_GET_AUDIO_TX_INFO     0x9c
+
+struct intel_sdvo_encode{
+    u8 dvi_rev;
+    u8 hdmi_rev;
+} __attribute__ ((packed));
index fbb35dc56f5c15ee917a892b1ab2df9f45398d9b..56485d67369b8dcf913b28b17afa9bb3bd3b3de8 100644 (file)
@@ -411,7 +411,7 @@ struct tv_mode {
  * These values account for -1s required.
  */
 
-const static struct tv_mode tv_modes[] = {
+static const struct tv_mode tv_modes[] = {
        {
                .name           = "NTSC-M",
                .clock          = 107520,
index 63212d7bbc287a36ef9bcc3cba45b3ac6cd97deb..92965dbb3c147a7b46c3cf248466765f2d08f5e8 100644 (file)
@@ -557,8 +557,10 @@ static int radeon_do_engine_reset(struct drm_device * dev)
 }
 
 static void radeon_cp_init_ring_buffer(struct drm_device * dev,
-                                      drm_radeon_private_t * dev_priv)
+                                      drm_radeon_private_t *dev_priv,
+                                      struct drm_file *file_priv)
 {
+       struct drm_radeon_master_private *master_priv;
        u32 ring_start, cur_read_ptr;
        u32 tmp;
 
@@ -677,6 +679,14 @@ static void radeon_cp_init_ring_buffer(struct drm_device * dev,
        dev_priv->scratch[2] = 0;
        RADEON_WRITE(RADEON_LAST_CLEAR_REG, 0);
 
+       /* reset sarea copies of these */
+       master_priv = file_priv->master->driver_priv;
+       if (master_priv->sarea_priv) {
+               master_priv->sarea_priv->last_frame = 0;
+               master_priv->sarea_priv->last_dispatch = 0;
+               master_priv->sarea_priv->last_clear = 0;
+       }
+
        radeon_do_wait_for_idle(dev_priv);
 
        /* Sync everything up */
@@ -1039,9 +1049,9 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
 
 #if __OS_HAS_AGP
        if (dev_priv->flags & RADEON_IS_AGP) {
-               drm_core_ioremap(dev_priv->cp_ring, dev);
-               drm_core_ioremap(dev_priv->ring_rptr, dev);
-               drm_core_ioremap(dev->agp_buffer_map, dev);
+               drm_core_ioremap_wc(dev_priv->cp_ring, dev);
+               drm_core_ioremap_wc(dev_priv->ring_rptr, dev);
+               drm_core_ioremap_wc(dev->agp_buffer_map, dev);
                if (!dev_priv->cp_ring->handle ||
                    !dev_priv->ring_rptr->handle ||
                    !dev->agp_buffer_map->handle) {
@@ -1215,7 +1225,7 @@ static int radeon_do_init_cp(struct drm_device *dev, drm_radeon_init_t *init,
        }
 
        radeon_cp_load_microcode(dev_priv);
-       radeon_cp_init_ring_buffer(dev, dev_priv);
+       radeon_cp_init_ring_buffer(dev, dev_priv, file_priv);
 
        dev_priv->last_buf = 0;
 
@@ -1281,7 +1291,7 @@ static int radeon_do_cleanup_cp(struct drm_device * dev)
  *
  * Charl P. Botha <http://cpbotha.net>
  */
-static int radeon_do_resume_cp(struct drm_device * dev)
+static int radeon_do_resume_cp(struct drm_device *dev, struct drm_file *file_priv)
 {
        drm_radeon_private_t *dev_priv = dev->dev_private;
 
@@ -1304,7 +1314,7 @@ static int radeon_do_resume_cp(struct drm_device * dev)
        }
 
        radeon_cp_load_microcode(dev_priv);
-       radeon_cp_init_ring_buffer(dev, dev_priv);
+       radeon_cp_init_ring_buffer(dev, dev_priv, file_priv);
 
        radeon_do_engine_reset(dev);
        radeon_irq_set_state(dev, RADEON_SW_INT_ENABLE, 1);
@@ -1479,8 +1489,7 @@ int radeon_cp_idle(struct drm_device *dev, void *data, struct drm_file *file_pri
  */
 int radeon_cp_resume(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
-
-       return radeon_do_resume_cp(dev);
+       return radeon_do_resume_cp(dev, file_priv);
 }
 
 int radeon_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv)
index 6cad69ed21c558c908b68fb9751a381a92cf0eae..1cc967448f4d5c760a8d75329c4e76bb82f4000f 100644 (file)
@@ -1300,7 +1300,13 @@ static const struct hid_device_id hid_blacklist[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
        { HID_USB_DEVICE(USB_VENDOR_ID_TOPSEED, USB_DEVICE_ID_TOPSEED_CYBERLINK) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
 
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, 0x030c) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
@@ -1605,6 +1611,7 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0002) },
        { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0003) },
        { HID_USB_DEVICE(USB_VENDOR_ID_PANJIT, 0x0004) },
+       { HID_USB_DEVICE(USB_VENDOR_ID_POWERCOM, USB_DEVICE_ID_POWERCOM_UPS) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD2) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD3) },
@@ -1612,10 +1619,6 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_SOUNDGRAPH, USB_DEVICE_ID_SOUNDGRAPH_IMON_LCD5) },
        { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY1) },
        { HID_USB_DEVICE(USB_VENDOR_ID_TENX, USB_DEVICE_ID_TENX_IBUDDY2) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb651) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb654) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_LABPRO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_GOTEMP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_VERNIER, USB_DEVICE_ID_VERNIER_SKIP) },
@@ -1626,8 +1629,6 @@ static const struct hid_device_id hid_ignore_list[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_1_PHIDGETSERVO_20) },
        { HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP, USB_DEVICE_ID_8_8_4_IF_KIT) },
        { HID_USB_DEVICE(USB_VENDOR_ID_YEALINK, USB_DEVICE_ID_YEALINK_P1K_P4K_B2K) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0005) },
-       { HID_USB_DEVICE(USB_VENDOR_ID_ZEROPLUS, 0x0030) },
        { }
 };
 
index e899f510ebeb5c474c1e682f874559ea9f690e79..88511970508d71b8ceae437ae78726ca35563cc8 100644 (file)
 #define USB_VENDOR_ID_PLAYDOTCOM       0x0b43
 #define USB_DEVICE_ID_PLAYDOTCOM_EMS_USBII     0x0003
 
+#define USB_VENDOR_ID_POWERCOM         0x0d9f
+#define USB_DEVICE_ID_POWERCOM_UPS     0x0002
+
 #define USB_VENDOR_ID_SAITEK           0x06a3
 #define USB_DEVICE_ID_SAITEK_RUMBLEPAD 0xff17
 
index 732449628971185d7603728aaa4c764266342274..02b19db5442ebd1d1fce7c0716bb2a071f528e12 100644 (file)
@@ -267,8 +267,10 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
                default:
                        {
                                struct hid_device *hid = dev->hid;
-                               if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ)
-                                       return -EINVAL;
+                               if (_IOC_TYPE(cmd) != 'H' || _IOC_DIR(cmd) != _IOC_READ) {
+                                       ret = -EINVAL;
+                                       break;
+                               }
 
                                if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWNAME(0))) {
                                        int len;
@@ -277,8 +279,9 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
                                        len = strlen(hid->name) + 1;
                                        if (len > _IOC_SIZE(cmd))
                                                len = _IOC_SIZE(cmd);
-                                       return copy_to_user(user_arg, hid->name, len) ?
+                                       ret = copy_to_user(user_arg, hid->name, len) ?
                                                -EFAULT : len;
+                                       break;
                                }
 
                                if (_IOC_NR(cmd) == _IOC_NR(HIDIOCGRAWPHYS(0))) {
@@ -288,12 +291,13 @@ static long hidraw_ioctl(struct file *file, unsigned int cmd,
                                        len = strlen(hid->phys) + 1;
                                        if (len > _IOC_SIZE(cmd))
                                                len = _IOC_SIZE(cmd);
-                                       return copy_to_user(user_arg, hid->phys, len) ?
+                                       ret = copy_to_user(user_arg, hid->phys, len) ?
                                                -EFAULT : len;
+                                       break;
                                }
                 }
 
-                       ret = -ENOTTY;
+               ret = -ENOTTY;
        }
        unlock_kernel();
        return ret;
index 609cafff86bc2ce23c364831f959c2dbcd310baf..5f81ddf7150871e67c7fe3ff1647df7e01c6c2c5 100644 (file)
@@ -1872,7 +1872,7 @@ static int __init f71882fg_find(int sioaddr, unsigned short *address,
 
        devid = superio_inw(sioaddr, SIO_REG_MANID);
        if (devid != SIO_FINTEK_ID) {
-               printk(KERN_INFO DRVNAME ": Not a Fintek device\n");
+               pr_debug(DRVNAME ": Not a Fintek device\n");
                goto exit;
        }
 
@@ -1932,7 +1932,7 @@ static int __init f71882fg_device_add(unsigned short address,
        res.name = f71882fg_pdev->name;
        err = acpi_check_resource_conflict(&res);
        if (err)
-               return err;
+               goto exit_device_put;
 
        err = platform_device_add_resources(f71882fg_pdev, &res, 1);
        if (err) {
index 03705240000f7755e9773d6ec0492a3a2a27f63b..29c83b5b96974bb88cbeb67d896ba46ee71469f2 100644 (file)
@@ -153,7 +153,10 @@ static struct axis_conversion lis3lv02d_axis_y_inverted = {1, -2, 3};
 static struct axis_conversion lis3lv02d_axis_x_inverted = {-1, 2, 3};
 static struct axis_conversion lis3lv02d_axis_z_inverted = {1, 2, -3};
 static struct axis_conversion lis3lv02d_axis_xy_rotated_left = {-2, 1, 3};
+static struct axis_conversion lis3lv02d_axis_xy_rotated_left_usd = {-2, 1, -3};
 static struct axis_conversion lis3lv02d_axis_xy_swap_inverted = {-2, -1, 3};
+static struct axis_conversion lis3lv02d_axis_xy_rotated_right = {2, -1, 3};
+static struct axis_conversion lis3lv02d_axis_xy_swap_yz_inverted = {2, -1, -3};
 
 #define AXIS_DMI_MATCH(_ident, _name, _axis) {         \
        .ident = _ident,                                \
@@ -163,6 +166,18 @@ static struct axis_conversion lis3lv02d_axis_xy_swap_inverted = {-2, -1, 3};
        },                                              \
        .driver_data = &lis3lv02d_axis_##_axis          \
 }
+
+#define AXIS_DMI_MATCH2(_ident, _class1, _name1,       \
+                               _class2, _name2,        \
+                               _axis) {                \
+       .ident = _ident,                                \
+       .callback = lis3lv02d_dmi_matched,              \
+       .matches = {                                    \
+               DMI_MATCH(DMI_##_class1, _name1),       \
+               DMI_MATCH(DMI_##_class2, _name2),       \
+       },                                              \
+       .driver_data = &lis3lv02d_axis_##_axis          \
+}
 static struct dmi_system_id lis3lv02d_dmi_ids[] = {
        /* product names are truncated to match all kinds of a same model */
        AXIS_DMI_MATCH("NC64x0", "HP Compaq nc64", x_inverted),
@@ -172,10 +187,22 @@ static struct dmi_system_id lis3lv02d_dmi_ids[] = {
        AXIS_DMI_MATCH("NC2510", "HP Compaq 2510", y_inverted),
        AXIS_DMI_MATCH("NC8510", "HP Compaq 8510", xy_swap_inverted),
        AXIS_DMI_MATCH("HP2133", "HP 2133", xy_rotated_left),
+       AXIS_DMI_MATCH("NC653x", "HP Compaq 653", xy_rotated_left_usd),
+       AXIS_DMI_MATCH("NC673x", "HP Compaq 673", xy_rotated_left_usd),
+       AXIS_DMI_MATCH("NC651xx", "HP Compaq 651", xy_rotated_right),
+       AXIS_DMI_MATCH("NC671xx", "HP Compaq 671", xy_swap_yz_inverted),
+       /* Intel-based HP Pavilion dv5 */
+       AXIS_DMI_MATCH2("HPDV5_I",
+                       PRODUCT_NAME, "HP Pavilion dv5",
+                       BOARD_NAME, "3603",
+                       x_inverted),
+       /* AMD-based HP Pavilion dv5 */
+       AXIS_DMI_MATCH2("HPDV5_A",
+                       PRODUCT_NAME, "HP Pavilion dv5",
+                       BOARD_NAME, "3600",
+                       y_inverted),
        { NULL, }
 /* Laptop models without axis info (yet):
- * "NC651xx" "HP Compaq 651"
- * "NC671xx" "HP Compaq 671"
  * "NC6910" "HP Compaq 6910"
  * HP Compaq 8710x Notebook PC / Mobile Workstation
  * "NC2400" "HP Compaq nc2400"
@@ -208,9 +235,49 @@ static struct delayed_led_classdev hpled_led = {
        .set_brightness = hpled_set,
 };
 
+static acpi_status
+lis3lv02d_get_resource(struct acpi_resource *resource, void *context)
+{
+       if (resource->type == ACPI_RESOURCE_TYPE_EXTENDED_IRQ) {
+               struct acpi_resource_extended_irq *irq;
+               u32 *device_irq = context;
+
+               irq = &resource->data.extended_irq;
+               *device_irq = irq->interrupts[0];
+       }
+
+       return AE_OK;
+}
+
+static void lis3lv02d_enum_resources(struct acpi_device *device)
+{
+       acpi_status status;
+
+       status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+                                       lis3lv02d_get_resource, &adev.irq);
+       if (ACPI_FAILURE(status))
+               printk(KERN_DEBUG DRIVER_NAME ": Error getting resources\n");
+}
+
+static s16 lis3lv02d_read_16(acpi_handle handle, int reg)
+{
+       u8 lo, hi;
+
+       adev.read(handle, reg - 1, &lo);
+       adev.read(handle, reg, &hi);
+       /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */
+       return (s16)((hi << 8) | lo);
+}
+
+static s16 lis3lv02d_read_8(acpi_handle handle, int reg)
+{
+       s8 lo;
+       adev.read(handle, reg, &lo);
+       return lo;
+}
+
 static int lis3lv02d_add(struct acpi_device *device)
 {
-       u8 val;
        int ret;
 
        if (!device)
@@ -224,10 +291,22 @@ static int lis3lv02d_add(struct acpi_device *device)
        strcpy(acpi_device_class(device), ACPI_MDPS_CLASS);
        device->driver_data = &adev;
 
-       lis3lv02d_acpi_read(device->handle, WHO_AM_I, &val);
-       if ((val != LIS3LV02DL_ID) && (val != LIS302DL_ID)) {
+       lis3lv02d_acpi_read(device->handle, WHO_AM_I, &adev.whoami);
+       switch (adev.whoami) {
+       case LIS_DOUBLE_ID:
+               printk(KERN_INFO DRIVER_NAME ": 2-byte sensor found\n");
+               adev.read_data = lis3lv02d_read_16;
+               adev.mdps_max_val = 2048;
+               break;
+       case LIS_SINGLE_ID:
+               printk(KERN_INFO DRIVER_NAME ": 1-byte sensor found\n");
+               adev.read_data = lis3lv02d_read_8;
+               adev.mdps_max_val = 128;
+               break;
+       default:
                printk(KERN_ERR DRIVER_NAME
-                               ": Accelerometer chip not LIS3LV02D{L,Q}\n");
+                       ": unknown sensor type 0x%X\n", adev.whoami);
+               return -EINVAL;
        }
 
        /* If possible use a "standard" axes order */
@@ -242,6 +321,9 @@ static int lis3lv02d_add(struct acpi_device *device)
        if (ret)
                return ret;
 
+       /* obtain IRQ number of our device from ACPI */
+       lis3lv02d_enum_resources(adev.device);
+
        ret = lis3lv02d_init_device(&adev);
        if (ret) {
                flush_work(&hpled_led.work);
index 219d2d0d5a626713377ada0f311d190dca9048c6..8bb2158f0453c01f3c089ffaa88d8eea2927fd9d 100644 (file)
@@ -3,7 +3,7 @@
  *
  *  Copyright (C) 2007-2008 Yan Burman
  *  Copyright (C) 2008 Eric Piel
- *  Copyright (C) 2008 Pavel Machek
+ *  Copyright (C) 2008-2009 Pavel Machek
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -35,6 +35,7 @@
 #include <linux/poll.h>
 #include <linux/freezer.h>
 #include <linux/uaccess.h>
+#include <linux/miscdevice.h>
 #include <acpi/acpi_drivers.h>
 #include <asm/atomic.h>
 #include "lis3lv02d.h"
  * joystick.
  */
 
-/* Maximum value our axis may get for the input device (signed 12 bits) */
-#define MDPS_MAX_VAL 2048
+struct acpi_lis3lv02d adev = {
+       .misc_wait   = __WAIT_QUEUE_HEAD_INITIALIZER(adev.misc_wait),
+};
 
-struct acpi_lis3lv02d adev;
 EXPORT_SYMBOL_GPL(adev);
 
 static int lis3lv02d_add_fs(struct acpi_device *device);
 
-static s16 lis3lv02d_read_16(acpi_handle handle, int reg)
-{
-       u8 lo, hi;
-
-       adev.read(handle, reg, &lo);
-       adev.read(handle, reg + 1, &hi);
-       /* In "12 bit right justified" mode, bit 6, bit 7, bit 8 = bit 5 */
-       return (s16)((hi << 8) | lo);
-}
-
 /**
  * lis3lv02d_get_axis - For the given axis, give the value converted
  * @axis:      1,2,3 - can also be negative
@@ -98,9 +89,9 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z)
 {
        int position[3];
 
-       position[0] = lis3lv02d_read_16(handle, OUTX_L);
-       position[1] = lis3lv02d_read_16(handle, OUTY_L);
-       position[2] = lis3lv02d_read_16(handle, OUTZ_L);
+       position[0] = adev.read_data(handle, OUTX);
+       position[1] = adev.read_data(handle, OUTY);
+       position[2] = adev.read_data(handle, OUTZ);
 
        *x = lis3lv02d_get_axis(adev.ac.x, position);
        *y = lis3lv02d_get_axis(adev.ac.y, position);
@@ -110,26 +101,13 @@ static void lis3lv02d_get_xyz(acpi_handle handle, int *x, int *y, int *z)
 void lis3lv02d_poweroff(acpi_handle handle)
 {
        adev.is_on = 0;
-       /* disable X,Y,Z axis and power down */
-       adev.write(handle, CTRL_REG1, 0x00);
 }
 EXPORT_SYMBOL_GPL(lis3lv02d_poweroff);
 
 void lis3lv02d_poweron(acpi_handle handle)
 {
-       u8 val;
-
        adev.is_on = 1;
        adev.init(handle);
-       adev.write(handle, FF_WU_CFG, 0);
-       /*
-        * BDU: LSB and MSB values are not updated until both have been read.
-        *      So the value read will always be correct.
-        * IEN: Interrupt for free-fall and DD, not for data-ready.
-        */
-       adev.read(handle, CTRL_REG2, &val);
-       val |= CTRL2_BDU | CTRL2_IEN;
-       adev.write(handle, CTRL_REG2, val);
 }
 EXPORT_SYMBOL_GPL(lis3lv02d_poweron);
 
@@ -162,6 +140,140 @@ static void lis3lv02d_decrease_use(struct acpi_lis3lv02d *dev)
        mutex_unlock(&dev->lock);
 }
 
+static irqreturn_t lis302dl_interrupt(int irq, void *dummy)
+{
+       /*
+        * Be careful: on some HP laptops the bios force DD when on battery and
+        * the lid is closed. This leads to interrupts as soon as a little move
+        * is done.
+        */
+       atomic_inc(&adev.count);
+
+       wake_up_interruptible(&adev.misc_wait);
+       kill_fasync(&adev.async_queue, SIGIO, POLL_IN);
+       return IRQ_HANDLED;
+}
+
+static int lis3lv02d_misc_open(struct inode *inode, struct file *file)
+{
+       int ret;
+
+       if (test_and_set_bit(0, &adev.misc_opened))
+               return -EBUSY; /* already open */
+
+       atomic_set(&adev.count, 0);
+
+       /*
+        * The sensor can generate interrupts for free-fall and direction
+        * detection (distinguishable with FF_WU_SRC and DD_SRC) but to keep
+        * the things simple and _fast_ we activate it only for free-fall, so
+        * no need to read register (very slow with ACPI). For the same reason,
+        * we forbid shared interrupts.
+        *
+        * IRQF_TRIGGER_RISING seems pointless on HP laptops because the
+        * io-apic is not configurable (and generates a warning) but I keep it
+        * in case of support for other hardware.
+        */
+       ret = request_irq(adev.irq, lis302dl_interrupt, IRQF_TRIGGER_RISING,
+                         DRIVER_NAME, &adev);
+
+       if (ret) {
+               clear_bit(0, &adev.misc_opened);
+               printk(KERN_ERR DRIVER_NAME ": IRQ%d allocation failed\n", adev.irq);
+               return -EBUSY;
+       }
+       lis3lv02d_increase_use(&adev);
+       printk("lis3: registered interrupt %d\n", adev.irq);
+       return 0;
+}
+
+static int lis3lv02d_misc_release(struct inode *inode, struct file *file)
+{
+       fasync_helper(-1, file, 0, &adev.async_queue);
+       lis3lv02d_decrease_use(&adev);
+       free_irq(adev.irq, &adev);
+       clear_bit(0, &adev.misc_opened); /* release the device */
+       return 0;
+}
+
+static ssize_t lis3lv02d_misc_read(struct file *file, char __user *buf,
+                               size_t count, loff_t *pos)
+{
+       DECLARE_WAITQUEUE(wait, current);
+       u32 data;
+       unsigned char byte_data;
+       ssize_t retval = 1;
+
+       if (count < 1)
+               return -EINVAL;
+
+       add_wait_queue(&adev.misc_wait, &wait);
+       while (true) {
+               set_current_state(TASK_INTERRUPTIBLE);
+               data = atomic_xchg(&adev.count, 0);
+               if (data)
+                       break;
+
+               if (file->f_flags & O_NONBLOCK) {
+                       retval = -EAGAIN;
+                       goto out;
+               }
+
+               if (signal_pending(current)) {
+                       retval = -ERESTARTSYS;
+                       goto out;
+               }
+
+               schedule();
+       }
+
+       if (data < 255)
+               byte_data = data;
+       else
+               byte_data = 255;
+
+       /* make sure we are not going into copy_to_user() with
+        * TASK_INTERRUPTIBLE state */
+       set_current_state(TASK_RUNNING);
+       if (copy_to_user(buf, &byte_data, sizeof(byte_data)))
+               retval = -EFAULT;
+
+out:
+       __set_current_state(TASK_RUNNING);
+       remove_wait_queue(&adev.misc_wait, &wait);
+
+       return retval;
+}
+
+static unsigned int lis3lv02d_misc_poll(struct file *file, poll_table *wait)
+{
+       poll_wait(file, &adev.misc_wait, wait);
+       if (atomic_read(&adev.count))
+               return POLLIN | POLLRDNORM;
+       return 0;
+}
+
+static int lis3lv02d_misc_fasync(int fd, struct file *file, int on)
+{
+       return fasync_helper(fd, file, on, &adev.async_queue);
+}
+
+static const struct file_operations lis3lv02d_misc_fops = {
+       .owner   = THIS_MODULE,
+       .llseek  = no_llseek,
+       .read    = lis3lv02d_misc_read,
+       .open    = lis3lv02d_misc_open,
+       .release = lis3lv02d_misc_release,
+       .poll    = lis3lv02d_misc_poll,
+       .fasync  = lis3lv02d_misc_fasync,
+};
+
+static struct miscdevice lis3lv02d_misc_device = {
+       .minor   = MISC_DYNAMIC_MINOR,
+       .name    = "freefall",
+       .fops    = &lis3lv02d_misc_fops,
+};
+
 /**
  * lis3lv02d_joystick_kthread - Kthread polling function
  * @data: unused - here to conform to threadfn prototype
@@ -203,7 +315,6 @@ static void lis3lv02d_joystick_close(struct input_dev *input)
        lis3lv02d_decrease_use(&adev);
 }
 
-
 static inline void lis3lv02d_calibrate_joystick(void)
 {
        lis3lv02d_get_xyz(adev.device->handle, &adev.xcalib, &adev.ycalib, &adev.zcalib);
@@ -231,9 +342,9 @@ int lis3lv02d_joystick_enable(void)
        adev.idev->close      = lis3lv02d_joystick_close;
 
        set_bit(EV_ABS, adev.idev->evbit);
-       input_set_abs_params(adev.idev, ABS_X, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3);
-       input_set_abs_params(adev.idev, ABS_Y, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3);
-       input_set_abs_params(adev.idev, ABS_Z, -MDPS_MAX_VAL, MDPS_MAX_VAL, 3, 3);
+       input_set_abs_params(adev.idev, ABS_X, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);
+       input_set_abs_params(adev.idev, ABS_Y, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);
+       input_set_abs_params(adev.idev, ABS_Z, -adev.mdps_max_val, adev.mdps_max_val, 3, 3);
 
        err = input_register_device(adev.idev);
        if (err) {
@@ -250,6 +361,7 @@ void lis3lv02d_joystick_disable(void)
        if (!adev.idev)
                return;
 
+       misc_deregister(&lis3lv02d_misc_device);
        input_unregister_device(adev.idev);
        adev.idev = NULL;
 }
@@ -268,6 +380,19 @@ int lis3lv02d_init_device(struct acpi_lis3lv02d *dev)
        if (lis3lv02d_joystick_enable())
                printk(KERN_ERR DRIVER_NAME ": joystick initialization failed\n");
 
+       printk("lis3_init_device: irq %d\n", dev->irq);
+
+       /* if we did not get an IRQ from ACPI - we have nothing more to do */
+       if (!dev->irq) {
+               printk(KERN_ERR DRIVER_NAME
+                       ": No IRQ in ACPI. Disabling /dev/freefall\n");
+               goto out;
+       }
+
+       printk("lis3: registering device\n");
+       if (misc_register(&lis3lv02d_misc_device))
+               printk(KERN_ERR DRIVER_NAME ": misc_register failed\n");
+out:
        lis3lv02d_decrease_use(dev);
        return 0;
 }
@@ -351,6 +476,6 @@ int lis3lv02d_remove_fs(void)
 EXPORT_SYMBOL_GPL(lis3lv02d_remove_fs);
 
 MODULE_DESCRIPTION("ST LIS3LV02Dx three-axis digital accelerometer driver");
-MODULE_AUTHOR("Yan Burman and Eric Piel");
+MODULE_AUTHOR("Yan Burman, Eric Piel, Pavel Machek");
 MODULE_LICENSE("GPL");
 
index 223f1c0763bba4decc69c85e74c990ba4472ba9d..75972bf372ff474a2fd1a43cdaf85db9ddddebd4 100644 (file)
 /*
  * The actual chip is STMicroelectronics LIS3LV02DL or LIS3LV02DQ that seems to
  * be connected via SPI. There exists also several similar chips (such as LIS302DL or
- * LIS3L02DQ) but not in the HP laptops and they have slightly different registers.
+ * LIS3L02DQ) and they have slightly different registers, but we can provide a
+ * common interface for all of them.
  * They can also be connected via I²C.
  */
 
-#define LIS3LV02DL_ID  0x3A /* Also the LIS3LV02DQ */
-#define LIS302DL_ID    0x3B /* Also the LIS202DL! */
+/* 2-byte registers */
+#define LIS_DOUBLE_ID  0x3A /* LIS3LV02D[LQ] */
+/* 1-byte registers */
+#define LIS_SINGLE_ID  0x3B /* LIS[32]02DL and others */
 
 enum lis3lv02d_reg {
        WHO_AM_I        = 0x0F,
@@ -44,10 +47,13 @@ enum lis3lv02d_reg {
        STATUS_REG      = 0x27,
        OUTX_L          = 0x28,
        OUTX_H          = 0x29,
+       OUTX            = 0x29,
        OUTY_L          = 0x2A,
        OUTY_H          = 0x2B,
+       OUTY            = 0x2B,
        OUTZ_L          = 0x2C,
        OUTZ_H          = 0x2D,
+       OUTZ            = 0x2D,
        FF_WU_CFG       = 0x30,
        FF_WU_SRC       = 0x31,
        FF_WU_ACK       = 0x32,
@@ -159,6 +165,10 @@ struct acpi_lis3lv02d {
        acpi_status (*write) (acpi_handle handle, int reg, u8 val);
        acpi_status (*read) (acpi_handle handle, int reg, u8 *ret);
 
+       u8                      whoami;    /* 3Ah: 2-byte registries, 3Bh: 1-byte registries */
+       s16 (*read_data) (acpi_handle handle, int reg);
+       int                     mdps_max_val;
+
        struct input_dev        *idev;     /* input device */
        struct task_struct      *kthread;  /* kthread for input */
        struct mutex            lock;
@@ -170,6 +180,11 @@ struct acpi_lis3lv02d {
        unsigned char           is_on;     /* whether the device is on or off */
        unsigned char           usage;     /* usage counter */
        struct axis_conversion  ac;        /* hw -> logical axis */
+
+       u32                     irq;       /* IRQ number */
+       struct fasync_struct    *async_queue; /* queue for the misc device */
+       wait_queue_head_t       misc_wait; /* Wait queue for the misc device */
+       unsigned long           misc_opened; /* bit0: whether the device is open */
 };
 
 int lis3lv02d_init_device(struct acpi_lis3lv02d *dev);
index b0ce3785228101f6cf8ff388497e57e5b0f44f98..73f77a9b8b188fb15840beea34d5f2f07a8d8a4f 100644 (file)
@@ -1262,7 +1262,7 @@ static int __init vt1211_device_add(unsigned short address)
        res.name = pdev->name;
        err = acpi_check_resource_conflict(&res);
        if (err)
-               goto EXIT;
+               goto EXIT_DEV_PUT;
 
        err = platform_device_add_resources(pdev, &res, 1);
        if (err) {
index cb808d0153619838378bd70f1ea5bfc3ca1c5ad2..feae743ba99163c2475b0f51663c89fc7e7f1375 100644 (file)
@@ -1548,7 +1548,7 @@ static int __init sensors_w83627ehf_init(void)
 
        err = acpi_check_resource_conflict(&res);
        if (err)
-               goto exit;
+               goto exit_device_put;
 
        err = platform_device_add_resources(pdev, &res, 1);
        if (err) {
index 5b2e3af43c4b0c98daa54859a78055f819db5ace..08c4fa35e9b19481df1ac94b4772599b2fe57036 100644 (file)
@@ -16,7 +16,7 @@
 
 /*
  * Rewritten from the work of Colten Edwards <pje120@cs.usask.ca> by
- * Samuel Thibault <samuel.thibault@fnac.net>
+ * Samuel Thibault <samuel.thibault@ens-lyon.org>
  */
 
 #include <linux/module.h>
index 6636f9665d169e8cf3c9beabe4b0e8867314138a..d7e67a1a1dcc43d0f2fa097f46b8cac7d8cf32c4 100644 (file)
@@ -4,7 +4,7 @@
 
 /*
  * Authors:    Petr Soucek <petr@ryston.cz>
- *             Samuel Thibault <samuel.thibault@fnac.net>
+ *             Samuel Thibault <samuel.thibault@ens-lyon.org>
  */
 
 /* truncates a in [b,c] */
index a329e6bd5d2d47b26f147f8a8169234b95e94600..3838bc4acabac07b01b2c7b2488d07d825aa28ae 100644 (file)
@@ -1823,6 +1823,10 @@ static int dv1394_open(struct inode *inode, struct file *file)
 
 #endif
 
+       printk(KERN_INFO "%s: NOTE, the dv1394 interface is unsupported "
+              "and will not be available in the new firewire driver stack. "
+              "Try libraw1394 based programs instead.\n", current->comm);
+
        return 0;
 }
 
@@ -2567,10 +2571,6 @@ static int __init dv1394_init_module(void)
 {
        int ret;
 
-       printk(KERN_WARNING
-              "NOTE: The dv1394 driver is unsupported and may be removed in a "
-              "future Linux release. Use raw1394 instead.\n");
-
        cdev_init(&dv1394_cdev, &dv1394_fops);
        dv1394_cdev.owner = THIS_MODULE;
        ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16);
index 4dcf08b3fd832dd12d96a5a5ce3c9dcc1c8a5058..11efd3528ce4e8e9943153c3914d45de3467e02e 100644 (file)
@@ -701,6 +701,9 @@ static int __cxio_tpt_op(struct cxio_rdev *rdev_p, u32 reset_tpt_entry,
        u32 stag_idx;
        u32 wptr;
 
+       if (rdev_p->flags)
+               return -EIO;
+
        stag_state = stag_state > 0;
        stag_idx = (*stag) >> 8;
 
index 656fe47bc84f94ea2d1af60e2d916be85a69cd47..9ed65b055171e331fda71fc32302de55106682c8 100644 (file)
@@ -108,6 +108,8 @@ struct cxio_rdev {
        struct gen_pool *pbl_pool;
        struct gen_pool *rqt_pool;
        struct list_head entry;
+       u32     flags;
+#define        CXIO_ERROR_FATAL        1
 };
 
 static inline int cxio_num_stags(struct cxio_rdev *rdev_p)
index 4489c89d6710c6b22c478f4b7742ff0ff4688576..37a4fc264a07a10bc34ff8e7f92b34869153e640 100644 (file)
@@ -51,13 +51,15 @@ cxgb3_cpl_handler_func t3c_handlers[NUM_CPL_CMDS];
 
 static void open_rnic_dev(struct t3cdev *);
 static void close_rnic_dev(struct t3cdev *);
+static void iwch_err_handler(struct t3cdev *, u32, u32);
 
 struct cxgb3_client t3c_client = {
        .name = "iw_cxgb3",
        .add = open_rnic_dev,
        .remove = close_rnic_dev,
        .handlers = t3c_handlers,
-       .redirect = iwch_ep_redirect
+       .redirect = iwch_ep_redirect,
+       .err_handler = iwch_err_handler
 };
 
 static LIST_HEAD(dev_list);
@@ -160,6 +162,17 @@ static void close_rnic_dev(struct t3cdev *tdev)
        mutex_unlock(&dev_mutex);
 }
 
+static void iwch_err_handler(struct t3cdev *tdev, u32 status, u32 error)
+{
+       struct cxio_rdev *rdev = tdev->ulp;
+
+       if (status == OFFLOAD_STATUS_DOWN)
+               rdev->flags = CXIO_ERROR_FATAL;
+
+       return;
+
+}
+
 static int __init iwch_init_module(void)
 {
        int err;
index 5d139db1b771e745e9c248df0536c3bbdbc5d01e..53df9de23423bdcb9a96a7d4ea0992e6694bde43 100644 (file)
@@ -2541,7 +2541,7 @@ static void nes_nic_napi_ce_handler(struct nes_device *nesdev, struct nes_hw_nic
 {
        struct nes_vnic *nesvnic = container_of(cq, struct nes_vnic, nic_cq);
 
-       netif_rx_schedule(&nesvnic->napi);
+       napi_schedule(&nesvnic->napi);
 }
 
 
index 57a47cf7e513ca60d86a1a108454f36248bcd16a..f5484ad1279bd2110a253870b482b7de5fc8b537 100644 (file)
@@ -111,7 +111,7 @@ static int nes_netdev_poll(struct napi_struct *napi, int budget)
        nes_nic_ce_handler(nesdev, nescq);
 
        if (nescq->cqes_pending == 0) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                /* clear out completed cqes and arm */
                nes_write32(nesdev->regs+NES_CQE_ALLOC, NES_CQE_ALLOC_NOTIFY_NEXT |
                                nescq->cq_number | (nescq->cqe_allocs_pending << 16));
index a1925810be3cb23f8e768b030c60d68944267b5f..da6082739839968ed3c64cc402a3bb438b28b8eb 100644 (file)
@@ -446,11 +446,11 @@ poll_more:
                if (dev->features & NETIF_F_LRO)
                        lro_flush_all(&priv->lro.lro_mgr);
 
-               netif_rx_complete(napi);
+               napi_complete(napi);
                if (unlikely(ib_req_notify_cq(priv->recv_cq,
                                              IB_CQ_NEXT_COMP |
                                              IB_CQ_REPORT_MISSED_EVENTS)) &&
-                   netif_rx_reschedule(napi))
+                   napi_reschedule(napi))
                        goto poll_more;
        }
 
@@ -462,7 +462,7 @@ void ipoib_ib_completion(struct ib_cq *cq, void *dev_ptr)
        struct net_device *dev = dev_ptr;
        struct ipoib_dev_priv *priv = netdev_priv(dev);
 
-       netif_rx_schedule(&priv->napi);
+       napi_schedule(&priv->napi);
 }
 
 static void drain_tx_cq(struct net_device *dev)
index f0e14dfcf71da0054181547d5c976d2e546ce633..641a9cd1a5323947a00ef1e14bb150265ca287b5 100644 (file)
@@ -56,8 +56,8 @@ static const char *hfcpci_revision = "2.0";
 static int HFC_cnt;
 static uint debug;
 static uint poll, tics;
-struct timer_list hfc_tl;
-u32    hfc_jiffies;
+static struct timer_list hfc_tl;
+static unsigned long hfc_jiffies;
 
 MODULE_AUTHOR("Karsten Keil");
 MODULE_LICENSE("GPL");
index ba6925fbf38aefd0f836dc0c7b2359002b2ba8ab..9c427fb204eec17f43e848c77f996b05914f592f 100644 (file)
@@ -35,7 +35,7 @@
 #include <linux/mISDNhw.h>
 #include "hfcsusb.h"
 
-const char *hfcsusb_rev = "Revision: 0.3.3 (socket), 2008-11-05";
+static const char *hfcsusb_rev = "Revision: 0.3.3 (socket), 2008-11-05";
 
 static unsigned int debug;
 static int poll = DEFAULT_TRANSP_BURST_SZ;
@@ -974,7 +974,7 @@ hfcsusb_rx_frame(struct usb_fifo *fifo, __u8 *data, unsigned int len,
        spin_unlock(&hw->lock);
 }
 
-void
+static void
 fill_isoc_urb(struct urb *urb, struct usb_device *dev, unsigned int pipe,
              void *buf, int num_packets, int packet_size, int interval,
              usb_complete_t complete, void *context)
@@ -1720,7 +1720,7 @@ hfcsusb_stop_endpoint(struct hfcsusb *hw, int channel)
 
 
 /* Hardware Initialization */
-int
+static int
 setup_hfcsusb(struct hfcsusb *hw)
 {
        int err;
index 098486b8e8d247d395b15a1bbb622bef68f867f4..43efe7358fa3d00a2d9453b6c115984f15b0bea0 100644 (file)
@@ -198,7 +198,7 @@ validconf[][19] = {
 };
 
 /* string description of chosen config */
-char *conf_str[] = {
+static char *conf_str[] = {
        "4 Interrupt IN + 3 Isochron OUT",
        "3 Interrupt IN + 3 Isochron OUT",
        "4 Isochron IN + 3 Isochron OUT",
@@ -316,7 +316,7 @@ struct hfcsusb_vdata {
 #define HFC_MAX_TE_LAYER1_STATE 8
 #define HFC_MAX_NT_LAYER1_STATE 4
 
-const char *HFC_TE_LAYER1_STATES[HFC_MAX_TE_LAYER1_STATE + 1] = {
+static const char *HFC_TE_LAYER1_STATES[HFC_MAX_TE_LAYER1_STATE + 1] = {
        "TE F0 - Reset",
        "TE F1 - Reset",
        "TE F2 - Sensing",
@@ -328,7 +328,7 @@ const char *HFC_TE_LAYER1_STATES[HFC_MAX_TE_LAYER1_STATE + 1] = {
        "TE F8 - Lost framing",
 };
 
-const char *HFC_NT_LAYER1_STATES[HFC_MAX_NT_LAYER1_STATE + 1] = {
+static const char *HFC_NT_LAYER1_STATES[HFC_MAX_NT_LAYER1_STATE + 1] = {
        "NT G0 - Reset",
        "NT G1 - Deactive",
        "NT G2 - Pending activation",
index 44d9c3d5d33d5c25167b1f845ed2243e8e96f51f..f1bbc88763b283656777209c9164a0cb9847d371 100644 (file)
 
 static u_int *debug;
 static LIST_HEAD(iclock_list);
-DEFINE_RWLOCK(iclock_lock);
-u16    iclock_count;           /* counter of last clock */
-struct timeval iclock_tv;      /* time stamp of last clock */
-int    iclock_tv_valid;        /* already received one timestamp */
-struct mISDNclock *iclock_current;
+static DEFINE_RWLOCK(iclock_lock);
+static u16 iclock_count;               /* counter of last clock */
+static struct timeval iclock_tv;       /* time stamp of last clock */
+static int iclock_tv_valid;            /* already received one timestamp */
+static struct mISDNclock *iclock_current;
 
 void
 mISDN_init_clock(u_int *dp)
index a34338567a2a601c3cdbda72441d54299301f89a..f14813be4eff88ccdc082b62336690e20b0342cb 100644 (file)
@@ -328,7 +328,7 @@ static void dispatch_io(int rw, unsigned int num_regions,
        struct dpages old_pages = *dp;
 
        if (sync)
-               rw |= (1 << BIO_RW_SYNC);
+               rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
 
        /*
         * For multiple regions we need to be careful to rewind
index 3073618269ea3030e468541ea2af6f05dd2aac65..0a225da21272543c33b4992a9bf1c83b923b8bbf 100644 (file)
@@ -344,7 +344,7 @@ static int run_io_job(struct kcopyd_job *job)
 {
        int r;
        struct dm_io_request io_req = {
-               .bi_rw = job->rw | (1 << BIO_RW_SYNC),
+               .bi_rw = job->rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG),
                .mem.type = DM_IO_PAGE_LIST,
                .mem.ptr.pl = job->pages,
                .mem.offset = job->offset,
index 1e3aea9eecf18009f4ff0bc2e4c474914e1bcf74..09658b218474a3a8f676995f02e59fdfa10693b0 100644 (file)
@@ -25,13 +25,13 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector)
 {
        dev_info_t *hash;
        linear_conf_t *conf = mddev_to_conf(mddev);
+       sector_t idx = sector >> conf->sector_shift;
 
        /*
         * sector_div(a,b) returns the remainer and sets a to a/b
         */
-       sector >>= conf->sector_shift;
-       (void)sector_div(sector, conf->spacing);
-       hash = conf->hash_table[sector];
+       (void)sector_div(idx, conf->spacing);
+       hash = conf->hash_table[idx];
 
        while (sector >= hash->num_sectors + hash->start_sector)
                hash++;
index 41e2509bf896c9356f9f9bd55f93f811120d7639..03b4cd0a6344cf2e458a035325eb2ec7ffc8805a 100644 (file)
@@ -474,7 +474,7 @@ void md_super_write(mddev_t *mddev, mdk_rdev_t *rdev,
         * causes ENOTSUPP, we allocate a spare bio...
         */
        struct bio *bio = bio_alloc(GFP_NOIO, 1);
-       int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNC);
+       int rw = (1<<BIO_RW) | (1<<BIO_RW_SYNCIO) | (1<<BIO_RW_UNPLUG);
 
        bio->bi_bdev = rdev->bdev;
        bio->bi_sector = sector;
@@ -531,7 +531,7 @@ int sync_page_io(struct block_device *bdev, sector_t sector, int size,
        struct completion event;
        int ret;
 
-       rw |= (1 << BIO_RW_SYNC);
+       rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
 
        bio->bi_bdev = bdev;
        bio->bi_sector = sector;
@@ -1481,6 +1481,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
                if (find_rdev_nr(mddev, rdev->desc_nr))
                        return -EBUSY;
        }
+       if (mddev->max_disks && rdev->desc_nr >= mddev->max_disks) {
+               printk(KERN_WARNING "md: %s: array is limited to %d devices\n",
+                      mdname(mddev), mddev->max_disks);
+               return -EBUSY;
+       }
        bdevname(rdev->bdev,b);
        while ( (s=strchr(b, '/')) != NULL)
                *s = '!';
@@ -2441,6 +2446,15 @@ static void analyze_sbs(mddev_t * mddev)
 
        i = 0;
        rdev_for_each(rdev, tmp, mddev) {
+               if (rdev->desc_nr >= mddev->max_disks ||
+                   i > mddev->max_disks) {
+                       printk(KERN_WARNING
+                              "md: %s: %s: only %d devices permitted\n",
+                              mdname(mddev), bdevname(rdev->bdev, b),
+                              mddev->max_disks);
+                       kick_rdev_from_array(rdev);
+                       continue;
+               }
                if (rdev != freshest)
                        if (super_types[mddev->major_version].
                            validate_super(mddev, rdev)) {
@@ -4614,13 +4628,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
         * noticed in interrupt contexts ...
         */
 
-       if (rdev->desc_nr == mddev->max_disks) {
-               printk(KERN_WARNING "%s: can not hot-add to full array!\n",
-                       mdname(mddev));
-               err = -EBUSY;
-               goto abort_unbind_export;
-       }
-
        rdev->raid_disk = -1;
 
        md_update_sb(mddev, 1);
@@ -4634,9 +4641,6 @@ static int hot_add_disk(mddev_t * mddev, dev_t dev)
        md_new_event(mddev);
        return 0;
 
-abort_unbind_export:
-       unbind_rdev_from_array(rdev);
-
 abort_export:
        export_rdev(rdev);
        return err;
index 7b4f5f7155d8726705c1f42757f68dd1de869624..01e3cffd03b8fd28dae613614f3efd10c04f2416 100644 (file)
@@ -1640,7 +1640,8 @@ static void raid1d(mddev_t *mddev)
                        }
 
                        bio = r1_bio->bios[r1_bio->read_disk];
-                       if ((disk=read_balance(conf, r1_bio)) == -1) {
+                       if ((disk=read_balance(conf, r1_bio)) == -1 ||
+                           disk == r1_bio->read_disk) {
                                printk(KERN_ALERT "raid1: %s: unrecoverable I/O"
                                       " read error for block %llu\n",
                                       bdevname(bio->bi_bdev,b),
index de7adaf5fa5b1d186c8c05b8c46925bea1c52d65..78412c9c424a13e492a59ad467368716755be6b2 100644 (file)
@@ -318,7 +318,6 @@ static int simple_std_setup(struct dvb_frontend *fe,
                            u8 *config, u8 *cb)
 {
        struct tuner_simple_priv *priv = fe->tuner_priv;
-       u8 tuneraddr;
        int rc;
 
        /* tv norm specific stuff for multi-norm tuners */
@@ -387,6 +386,7 @@ static int simple_std_setup(struct dvb_frontend *fe,
 
        case TUNER_PHILIPS_TUV1236D:
        {
+               struct tuner_i2c_props i2c = priv->i2c_props;
                /* 0x40 -> ATSC antenna input 1 */
                /* 0x48 -> ATSC antenna input 2 */
                /* 0x00 -> NTSC antenna input 1 */
@@ -398,17 +398,15 @@ static int simple_std_setup(struct dvb_frontend *fe,
                        buffer[1] = 0x04;
                }
                /* set to the correct mode (analog or digital) */
-               tuneraddr = priv->i2c_props.addr;
-               priv->i2c_props.addr = 0x0a;
-               rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[0], 2);
+               i2c.addr = 0x0a;
+               rc = tuner_i2c_xfer_send(&i2c, &buffer[0], 2);
                if (2 != rc)
                        tuner_warn("i2c i/o error: rc == %d "
                                   "(should be 2)\n", rc);
-               rc = tuner_i2c_xfer_send(&priv->i2c_props, &buffer[2], 2);
+               rc = tuner_i2c_xfer_send(&i2c, &buffer[2], 2);
                if (2 != rc)
                        tuner_warn("i2c i/o error: rc == %d "
                                   "(should be 2)\n", rc);
-               priv->i2c_props.addr = tuneraddr;
                break;
        }
        }
index 0c733c66a44150d7abd6afdea0acbbd760fe385b..069d847ba887c39e2f1f83eafdf7c06a07b838a7 100644 (file)
@@ -364,16 +364,15 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
                                       enum dmx_success success)
 {
        struct dmxdev_filter *dmxdevfilter = filter->priv;
-       unsigned long flags;
        int ret;
 
        if (dmxdevfilter->buffer.error) {
                wake_up(&dmxdevfilter->buffer.queue);
                return 0;
        }
-       spin_lock_irqsave(&dmxdevfilter->dev->lock, flags);
+       spin_lock(&dmxdevfilter->dev->lock);
        if (dmxdevfilter->state != DMXDEV_STATE_GO) {
-               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
+               spin_unlock(&dmxdevfilter->dev->lock);
                return 0;
        }
        del_timer(&dmxdevfilter->timer);
@@ -392,7 +391,7 @@ static int dvb_dmxdev_section_callback(const u8 *buffer1, size_t buffer1_len,
        }
        if (dmxdevfilter->params.sec.flags & DMX_ONESHOT)
                dmxdevfilter->state = DMXDEV_STATE_DONE;
-       spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
+       spin_unlock(&dmxdevfilter->dev->lock);
        wake_up(&dmxdevfilter->buffer.queue);
        return 0;
 }
@@ -404,12 +403,11 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
 {
        struct dmxdev_filter *dmxdevfilter = feed->priv;
        struct dvb_ringbuffer *buffer;
-       unsigned long flags;
        int ret;
 
-       spin_lock_irqsave(&dmxdevfilter->dev->lock, flags);
+       spin_lock(&dmxdevfilter->dev->lock);
        if (dmxdevfilter->params.pes.output == DMX_OUT_DECODER) {
-               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
+               spin_unlock(&dmxdevfilter->dev->lock);
                return 0;
        }
 
@@ -419,7 +417,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
        else
                buffer = &dmxdevfilter->dev->dvr_buffer;
        if (buffer->error) {
-               spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
+               spin_unlock(&dmxdevfilter->dev->lock);
                wake_up(&buffer->queue);
                return 0;
        }
@@ -430,7 +428,7 @@ static int dvb_dmxdev_ts_callback(const u8 *buffer1, size_t buffer1_len,
                dvb_ringbuffer_flush(buffer);
                buffer->error = ret;
        }
-       spin_unlock_irqrestore(&dmxdevfilter->dev->lock, flags);
+       spin_unlock(&dmxdevfilter->dev->lock);
        wake_up(&buffer->queue);
        return 0;
 }
index a2c1fd5d2f67b05b5b25da04cf6a8dc0d7e8da49..e2eca0b1fe7cfad6dc1215aa6d2bd1247497b93e 100644 (file)
@@ -399,9 +399,7 @@ static void dvb_dmx_swfilter_packet(struct dvb_demux *demux, const u8 *buf)
 void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
                              size_t count)
 {
-       unsigned long flags;
-
-       spin_lock_irqsave(&demux->lock, flags);
+       spin_lock(&demux->lock);
 
        while (count--) {
                if (buf[0] == 0x47)
@@ -409,17 +407,16 @@ void dvb_dmx_swfilter_packets(struct dvb_demux *demux, const u8 *buf,
                buf += 188;
        }
 
-       spin_unlock_irqrestore(&demux->lock, flags);
+       spin_unlock(&demux->lock);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter_packets);
 
 void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
 {
-       unsigned long flags;
        int p = 0, i, j;
 
-       spin_lock_irqsave(&demux->lock, flags);
+       spin_lock(&demux->lock);
 
        if (demux->tsbufp) {
                i = demux->tsbufp;
@@ -452,18 +449,17 @@ void dvb_dmx_swfilter(struct dvb_demux *demux, const u8 *buf, size_t count)
        }
 
 bailout:
-       spin_unlock_irqrestore(&demux->lock, flags);
+       spin_unlock(&demux->lock);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter);
 
 void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
 {
-       unsigned long flags;
        int p = 0, i, j;
        u8 tmppack[188];
 
-       spin_lock_irqsave(&demux->lock, flags);
+       spin_lock(&demux->lock);
 
        if (demux->tsbufp) {
                i = demux->tsbufp;
@@ -504,7 +500,7 @@ void dvb_dmx_swfilter_204(struct dvb_demux *demux, const u8 *buf, size_t count)
        }
 
 bailout:
-       spin_unlock_irqrestore(&demux->lock, flags);
+       spin_unlock(&demux->lock);
 }
 
 EXPORT_SYMBOL(dvb_dmx_swfilter_204);
index 67cbce82cb913a0619f3a72fb8a4e519076cbf96..4dfed6aa2dbc54921e175a591f8a40668553b294 100644 (file)
  *             - blacklisted KWorld radio in hid-core.c and hid-ids.h
  * 2008-12-03  Mark Lord <mlord@pobox.com>
  *             - add support for DealExtreme USB Radio
+ * 2009-01-31  Bob Ross <pigiron@gmx.com>
+ *             - correction of stereo detection/setting
+ *             - correction of signal strength indicator scaling
+ * 2009-01-31  Rick Bronson <rick@efn.org>
+ *             Tobias Lorenz <tobias.lorenz@gmx.net>
+ *             - add LED status output
  *
  * ToDo:
  * - add firmware download/update support
  * - RDS support: interrupt mode, instead of polling
- * - add LED status output (check if that's not already done in firmware)
  */
 
 
@@ -881,6 +886,30 @@ static int si470x_rds_on(struct si470x_device *radio)
 
 
 
+/**************************************************************************
+ * General Driver Functions - LED_REPORT
+ **************************************************************************/
+
+/*
+ * si470x_set_led_state - sets the led state
+ */
+static int si470x_set_led_state(struct si470x_device *radio,
+               unsigned char led_state)
+{
+       unsigned char buf[LED_REPORT_SIZE];
+       int retval;
+
+       buf[0] = LED_REPORT;
+       buf[1] = LED_COMMAND;
+       buf[2] = led_state;
+
+       retval = si470x_set_report(radio, (void *) &buf, sizeof(buf));
+
+       return (retval < 0) ? -EINVAL : 0;
+}
+
+
+
 /**************************************************************************
  * RDS Driver Functions
  **************************************************************************/
@@ -1385,20 +1414,22 @@ static int si470x_vidioc_g_tuner(struct file *file, void *priv,
        };
 
        /* stereo indicator == stereo (instead of mono) */
-       if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 1)
-               tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
-       else
+       if ((radio->registers[STATUSRSSI] & STATUSRSSI_ST) == 0)
                tuner->rxsubchans = V4L2_TUNER_SUB_MONO;
+       else
+               tuner->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
 
        /* mono/stereo selector */
-       if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 1)
-               tuner->audmode = V4L2_TUNER_MODE_MONO;
-       else
+       if ((radio->registers[POWERCFG] & POWERCFG_MONO) == 0)
                tuner->audmode = V4L2_TUNER_MODE_STEREO;
+       else
+               tuner->audmode = V4L2_TUNER_MODE_MONO;
 
        /* min is worst, max is best; signal:0..0xffff; rssi: 0..0xff */
-       tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI)
-                               * 0x0101;
+       /* measured in units of dbµV in 1 db increments (max at ~75 dbµV) */
+       tuner->signal = (radio->registers[STATUSRSSI] & STATUSRSSI_RSSI);
+       /* the ideal factor is 0xffff/75 = 873,8 */
+       tuner->signal = (tuner->signal * 873) + (8 * tuner->signal / 10);
 
        /* automatic frequency control: -1: freq to low, 1 freq to high */
        /* AFCRL does only indicate that freq. differs, not if too low/high */
@@ -1632,6 +1663,9 @@ static int si470x_usb_driver_probe(struct usb_interface *intf,
        /* set initial frequency */
        si470x_set_freq(radio, 87.5 * FREQ_MUL); /* available in all regions */
 
+       /* set led to connect state */
+       si470x_set_led_state(radio, BLINK_GREEN_LED);
+
        /* rds buffer allocation */
        radio->buf_size = rds_buf * 3;
        radio->buffer = kmalloc(radio->buf_size, GFP_KERNEL);
@@ -1715,6 +1749,9 @@ static void si470x_usb_driver_disconnect(struct usb_interface *intf)
        cancel_delayed_work_sync(&radio->work);
        usb_set_intfdata(intf, NULL);
        if (radio->users == 0) {
+               /* set led to disconnect state */
+               si470x_set_led_state(radio, BLINK_ORANGE_LED);
+
                video_unregister_device(radio->videodev);
                kfree(radio->buffer);
                kfree(radio);
index 2ed24527ecd61cea70287dd668725445799ee4fa..65e4901f4db70a713a4b1d60c0400c4ec9f9250a 100644 (file)
@@ -422,6 +422,7 @@ static void destroy_urbs(struct gspca_dev *gspca_dev)
                if (urb == NULL)
                        break;
 
+               BUG_ON(!gspca_dev->dev);
                gspca_dev->urb[i] = NULL;
                if (!gspca_dev->present)
                        usb_kill_urb(urb);
@@ -1950,8 +1951,12 @@ void gspca_disconnect(struct usb_interface *intf)
 {
        struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
 
+       mutex_lock(&gspca_dev->usb_lock);
        gspca_dev->present = 0;
+       mutex_unlock(&gspca_dev->usb_lock);
 
+       destroy_urbs(gspca_dev);
+       gspca_dev->dev = NULL;
        usb_set_intfdata(intf, NULL);
 
        /* release the device */
index f6b3ef6e691be8465ab82b397b7c796bd27b0cf4..c13bd2aa0bea6180a98fe078be7449e6ea2e25ca 100644 (file)
@@ -393,7 +393,7 @@ static int ivtv_g_fmt_sliced_vbi_cap(struct file *file, void *fh, struct v4l2_fo
                return 0;
        }
 
-       v4l2_subdev_call(itv->sd_video, video, s_fmt, fmt);
+       v4l2_subdev_call(itv->sd_video, video, g_fmt, fmt);
        vbifmt->service_set = ivtv_get_service_set(vbifmt);
        return 0;
 }
@@ -1748,6 +1748,18 @@ static long ivtv_default(struct file *file, void *fh, int cmd, void *arg)
                break;
        }
 
+       case IVTV_IOC_DMA_FRAME:
+       case VIDEO_GET_PTS:
+       case VIDEO_GET_FRAME_COUNT:
+       case VIDEO_GET_EVENT:
+       case VIDEO_PLAY:
+       case VIDEO_STOP:
+       case VIDEO_FREEZE:
+       case VIDEO_CONTINUE:
+       case VIDEO_COMMAND:
+       case VIDEO_TRY_COMMAND:
+               return ivtv_decoder_ioctls(file, cmd, (void *)arg);
+
        default:
                return -EINVAL;
        }
@@ -1790,18 +1802,6 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp,
                ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
                return 0;
 
-       case IVTV_IOC_DMA_FRAME:
-       case VIDEO_GET_PTS:
-       case VIDEO_GET_FRAME_COUNT:
-       case VIDEO_GET_EVENT:
-       case VIDEO_PLAY:
-       case VIDEO_STOP:
-       case VIDEO_FREEZE:
-       case VIDEO_CONTINUE:
-       case VIDEO_COMMAND:
-       case VIDEO_TRY_COMMAND:
-               return ivtv_decoder_ioctls(filp, cmd, (void *)arg);
-
        default:
                break;
        }
index 1a4d04664d6dca96426c965b0ad80062f3042a95..aa266e1f69b255875ee5b98e67988b31019fcf18 100644 (file)
@@ -286,7 +286,7 @@ static int __init egpio_probe(struct platform_device *pdev)
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res)
                goto fail;
-       ei->base_addr = ioremap_nocache(res->start, res->end - res->start);
+       ei->base_addr = ioremap_nocache(res->start, resource_size(res));
        if (!ei->base_addr)
                goto fail;
        pr_debug("EGPIO phys=%08x virt=%p\n", (u32)res->start, ei->base_addr);
@@ -307,7 +307,7 @@ static int __init egpio_probe(struct platform_device *pdev)
 
        ei->nchips = pdata->num_chips;
        ei->chip = kzalloc(sizeof(struct egpio_chip) * ei->nchips, GFP_KERNEL);
-       if (!ei) {
+       if (!ei->chip) {
                ret = -ENOMEM;
                goto fail;
        }
index 24508e28e3fb87aae68d01d4fd2c8922201aefc0..2e36057659e12acedd5d2be43268d692aaefe8e3 100644 (file)
@@ -626,7 +626,6 @@ static int __devinit pcf50633_probe(struct i2c_client *client,
        }
 
        if (client->irq) {
-               set_irq_handler(client->irq, handle_level_irq);
                ret = request_irq(client->irq, pcf50633_irq,
                                IRQF_TRIGGER_LOW, "pcf50633", pcf);
 
@@ -679,6 +678,7 @@ static int __devexit pcf50633_remove(struct i2c_client *client)
 
 static struct i2c_device_id pcf50633_id_table[] = {
        {"pcf50633", 0x73},
+       {/* end of list */}
 };
 
 static struct i2c_driver pcf50633_driver = {
index 0e5761f12634c02c493e4b346b29ec8722eb3f21..4c7b7962f6b8002b18ef57c0a6d4015bcf7c2fc1 100644 (file)
@@ -1050,7 +1050,7 @@ static int __devinit sm501_gpio_register_chip(struct sm501_devdata *sm,
        return gpiochip_add(gchip);
 }
 
-static int sm501_register_gpio(struct sm501_devdata *sm)
+static int __devinit sm501_register_gpio(struct sm501_devdata *sm)
 {
        struct sm501_gpio *gpio = &sm->gpio;
        resource_size_t iobase = sm->io_res->start + SM501_GPIO;
@@ -1321,7 +1321,7 @@ static unsigned int sm501_mem_local[] = {
  * Common init code for an SM501
 */
 
-static int sm501_init_dev(struct sm501_devdata *sm)
+static int __devinit sm501_init_dev(struct sm501_devdata *sm)
 {
        struct sm501_initdata *idata;
        struct sm501_platdata *pdata;
@@ -1397,7 +1397,7 @@ static int sm501_init_dev(struct sm501_devdata *sm)
        return 0;
 }
 
-static int sm501_plat_probe(struct platform_device *dev)
+static int __devinit sm501_plat_probe(struct platform_device *dev)
 {
        struct sm501_devdata *sm;
        int ret;
@@ -1586,8 +1586,8 @@ static struct sm501_platdata sm501_pci_platdata = {
        .gpio_base      = -1,
 };
 
-static int sm501_pci_probe(struct pci_dev *dev,
-                          const struct pci_device_id *id)
+static int __devinit sm501_pci_probe(struct pci_dev *dev,
+                                    const struct pci_device_id *id)
 {
        struct sm501_devdata *sm;
        int err;
@@ -1693,7 +1693,7 @@ static void sm501_dev_remove(struct sm501_devdata *sm)
        sm501_gpio_remove(sm);
 }
 
-static void sm501_pci_remove(struct pci_dev *dev)
+static void __devexit sm501_pci_remove(struct pci_dev *dev)
 {
        struct sm501_devdata *sm = pci_get_drvdata(dev);
 
@@ -1727,16 +1727,16 @@ static struct pci_device_id sm501_pci_tbl[] = {
 
 MODULE_DEVICE_TABLE(pci, sm501_pci_tbl);
 
-static struct pci_driver sm501_pci_drv = {
+static struct pci_driver sm501_pci_driver = {
        .name           = "sm501",
        .id_table       = sm501_pci_tbl,
        .probe          = sm501_pci_probe,
-       .remove         = sm501_pci_remove,
+       .remove         = __devexit_p(sm501_pci_remove),
 };
 
 MODULE_ALIAS("platform:sm501");
 
-static struct platform_driver sm501_plat_drv = {
+static struct platform_driver sm501_plat_driver = {
        .driver         = {
                .name   = "sm501",
                .owner  = THIS_MODULE,
@@ -1749,14 +1749,14 @@ static struct platform_driver sm501_plat_drv = {
 
 static int __init sm501_base_init(void)
 {
-       platform_driver_register(&sm501_plat_drv);
-       return pci_register_driver(&sm501_pci_drv);
+       platform_driver_register(&sm501_plat_driver);
+       return pci_register_driver(&sm501_pci_driver);
 }
 
 static void __exit sm501_base_exit(void)
 {
-       platform_driver_unregister(&sm501_plat_drv);
-       pci_unregister_driver(&sm501_pci_drv);
+       platform_driver_unregister(&sm501_plat_driver);
+       pci_unregister_driver(&sm501_pci_driver);
 }
 
 module_init(sm501_base_init);
index e7ab0035d3054fdfd159b48c9e548150758b986b..68826f1e36bccd057f938919083e6877731025c3 100644 (file)
@@ -38,7 +38,7 @@
 #include <linux/i2c.h>
 #include <linux/i2c/twl4030.h>
 
-#ifdef CONFIG_ARM
+#if defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
 #include <mach/cpu.h>
 #endif
 
index f92595c8f165b7223d66958f648ba183dbb5519e..84d5ea1ec17120e9c4d8d94b6a2c9376ac241449 100644 (file)
@@ -1111,7 +1111,7 @@ int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref)
        do {
                schedule_timeout_interruptible(1);
                reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1);
-       } while (tries-- && (reg & WM8350_AUXADC_POLL));
+       } while (--tries && (reg & WM8350_AUXADC_POLL));
 
        if (!tries)
                dev_err(wm8350->dev, "adc chn %d read timeout\n", channel);
@@ -1297,14 +1297,29 @@ static void wm8350_client_dev_register(struct wm8350 *wm8350,
 int wm8350_device_init(struct wm8350 *wm8350, int irq,
                       struct wm8350_platform_data *pdata)
 {
-       int ret = -EINVAL;
+       int ret;
        u16 id1, id2, mask_rev;
        u16 cust_id, mode, chip_rev;
 
        /* get WM8350 revision and config mode */
-       wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
-       wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);
-       wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev);
+       ret = wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1);
+       if (ret != 0) {
+               dev_err(wm8350->dev, "Failed to read ID: %d\n", ret);
+               goto err;
+       }
+
+       ret = wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2);
+       if (ret != 0) {
+               dev_err(wm8350->dev, "Failed to read ID: %d\n", ret);
+               goto err;
+       }
+
+       ret = wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev),
+                              &mask_rev);
+       if (ret != 0) {
+               dev_err(wm8350->dev, "Failed to read revision: %d\n", ret);
+               goto err;
+       }
 
        id1 = be16_to_cpu(id1);
        id2 = be16_to_cpu(id2);
@@ -1404,14 +1419,12 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
                return ret;
        }
 
-       if (pdata && pdata->init) {
-               ret = pdata->init(wm8350);
-               if (ret != 0) {
-                       dev_err(wm8350->dev, "Platform init() failed: %d\n",
-                               ret);
-                       goto err;
-               }
-       }
+       wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0xFFFF);
+       wm8350_reg_write(wm8350, WM8350_INT_STATUS_1_MASK, 0xFFFF);
+       wm8350_reg_write(wm8350, WM8350_INT_STATUS_2_MASK, 0xFFFF);
+       wm8350_reg_write(wm8350, WM8350_UNDER_VOLTAGE_INT_STATUS_MASK, 0xFFFF);
+       wm8350_reg_write(wm8350, WM8350_GPIO_INT_STATUS_MASK, 0xFFFF);
+       wm8350_reg_write(wm8350, WM8350_COMPARATOR_INT_STATUS_MASK, 0xFFFF);
 
        mutex_init(&wm8350->auxadc_mutex);
        mutex_init(&wm8350->irq_mutex);
@@ -1430,6 +1443,15 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq,
        }
        wm8350->chip_irq = irq;
 
+       if (pdata && pdata->init) {
+               ret = pdata->init(wm8350);
+               if (ret != 0) {
+                       dev_err(wm8350->dev, "Platform init() failed: %d\n",
+                               ret);
+                       goto err;
+               }
+       }
+
        wm8350_reg_write(wm8350, WM8350_SYSTEM_INTERRUPTS_MASK, 0x0);
 
        wm8350_client_dev_register(wm8350, "wm8350-codec",
index 68887b817d17e071a834fbbd71c4a86c44fc2796..9a4cc954cb7c72fcbfd4ef18e363e05795dab287 100644 (file)
@@ -3188,7 +3188,7 @@ const struct wm8350_reg_access wm8350_reg_io_map[] = {
        { 0x7CFF, 0x0C00, 0x7FFF }, /* R1   - ID */
        { 0x0000, 0x0000, 0x0000 }, /* R2 */
        { 0xBE3B, 0xBE3B, 0x8000 }, /* R3   - System Control 1 */
-       { 0xFCF7, 0xFCF7, 0xF800 }, /* R4   - System Control 2 */
+       { 0xFEF7, 0xFEF7, 0xF800 }, /* R4   - System Control 2 */
        { 0x80FF, 0x80FF, 0x8000 }, /* R5   - System Hibernate */
        { 0xFB0E, 0xFB0E, 0x0000 }, /* R6   - Interface Control */
        { 0x0000, 0x0000, 0x0000 }, /* R7 */
index 56073199ceba8474d3e78321af3aca6c3a466cde..c64e6798878a529035154426c3db9af0d587bdb3 100644 (file)
@@ -217,6 +217,7 @@ config DELL_LAPTOP
        depends on EXPERIMENTAL
        depends on BACKLIGHT_CLASS_DEVICE
        depends on RFKILL
+       depends on POWER_SUPPLY
        default n
        ---help---
        This driver adds support for rfkill and backlight control to Dell
index bf5e4d065436a2153c76ff13ef6adae2f2604a49..558bf3f2c27698154a6088c43a8daa781577c42b 100644 (file)
@@ -35,7 +35,7 @@ struct ssc_device *ssc_request(unsigned int ssc_num)
 
        if (!ssc_valid) {
                spin_unlock(&user_lock);
-               dev_dbg(&ssc->pdev->dev, "could not find requested device\n");
+               pr_err("ssc: ssc%d platform device is missing\n", ssc_num);
                return ERR_PTR(-ENODEV);
        }
 
index 10c421b73eaf95d3d8e9deb1b793868426d3430d..f26667a7abf7c6ce0e7a3a911d7bb193f2489859 100644 (file)
@@ -207,7 +207,7 @@ static void ilo_ccb_close(struct pci_dev *pdev, struct ccb_data *data)
                  &device_ccb->recv_ctrl);
 
        /* give iLO some time to process stop request */
-       for (retries = 1000; retries > 0; retries--) {
+       for (retries = MAX_WAIT; retries > 0; retries--) {
                doorbell_set(driver_ccb);
                udelay(1);
                if (!(ioread32(&device_ccb->send_ctrl) & (1 << CTRL_BITPOS_A))
@@ -309,7 +309,7 @@ static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
        doorbell_clr(driver_ccb);
 
        /* make sure iLO is really handling requests */
-       for (i = 1000; i > 0; i--) {
+       for (i = MAX_WAIT; i > 0; i--) {
                if (ilo_pkt_dequeue(hw, driver_ccb, SENDQ, &pkt_id, NULL, NULL))
                        break;
                udelay(1);
@@ -326,7 +326,7 @@ static int ilo_ccb_open(struct ilo_hwinfo *hw, struct ccb_data *data, int slot)
 
        return 0;
 free:
-       pci_free_consistent(pdev, data->dma_size, data->dma_va, data->dma_pa);
+       ilo_ccb_close(pdev, data);
 out:
        return error;
 }
index a281207696c1b8286f5c9ee08e7f24b504647a61..b64a20ef07e3cc6e7280386b5dc462233e1fd99a 100644 (file)
@@ -19,6 +19,8 @@
 #define MAX_ILO_DEV    1
 /* max number of files */
 #define MAX_OPEN       (MAX_CCB * MAX_ILO_DEV)
+/* spin counter for open/close delay */
+#define MAX_WAIT       10000
 
 /*
  * Per device, used to track global memory allocations.
index a5bd658c2e83b13a5d9dee5805a71eb191750e21..275b78896a73622362b6b53b5776db6fe20245d5 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2004-2008 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2004-2009 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 /*
@@ -514,7 +514,8 @@ struct xpc_channel_uv {
                                                /* partition's notify mq */
 
        struct xpc_send_msg_slot_uv *send_msg_slots;
-       struct xpc_notify_mq_msg_uv *recv_msg_slots;
+       void *recv_msg_slots;   /* each slot will hold a xpc_notify_mq_msg_uv */
+                               /* structure plus the user's payload */
 
        struct xpc_fifo_head_uv msg_slot_free_list;
        struct xpc_fifo_head_uv recv_msg_list;  /* deliverable payloads */
index f17f7d40ea2c686789e3a80f7da975499a5c05c8..29c0502a96b26fd9e9436d65f133136ccfce5410 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (c) 2008 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2008-2009 Silicon Graphics, Inc.  All Rights Reserved.
  */
 
 /*
@@ -1010,8 +1010,8 @@ xpc_allocate_recv_msg_slot_uv(struct xpc_channel *ch)
                        continue;
 
                for (entry = 0; entry < nentries; entry++) {
-                       msg_slot = ch_uv->recv_msg_slots + entry *
-                           ch->entry_size;
+                       msg_slot = ch_uv->recv_msg_slots +
+                           entry * ch->entry_size;
 
                        msg_slot->hdr.msg_slot_number = entry;
                }
@@ -1308,9 +1308,8 @@ xpc_handle_notify_mq_msg_uv(struct xpc_partition *part,
        /* we're dealing with a normal message sent via the notify_mq */
        ch_uv = &ch->sn.uv;
 
-       msg_slot = (struct xpc_notify_mq_msg_uv *)((u64)ch_uv->recv_msg_slots +
-                   (msg->hdr.msg_slot_number % ch->remote_nentries) *
-                   ch->entry_size);
+       msg_slot = ch_uv->recv_msg_slots +
+           (msg->hdr.msg_slot_number % ch->remote_nentries) * ch->entry_size;
 
        BUG_ON(msg->hdr.msg_slot_number != msg_slot->hdr.msg_slot_number);
        BUG_ON(msg_slot->hdr.size != 0);
index 45b1f430685fca915aa12c7f28913fa4ed6a0733..513eb09a638f305d93f28aa2bdbfe967f70c32fc 100644 (file)
@@ -584,7 +584,7 @@ static int mmc_blk_probe(struct mmc_card *card)
        if (err)
                goto out;
 
-       string_get_size(get_capacity(md->disk) << 9, STRING_UNITS_2,
+       string_get_size((u64)get_capacity(md->disk) << 9, STRING_UNITS_2,
                        cap_str, sizeof(cap_str));
        printk(KERN_INFO "%s: %s %s %s %s\n",
                md->disk->disk_name, mmc_card_id(card), mmc_card_name(card),
index b92b172074ee5a6f2b698a0292951b900dbd3008..b9f1e84897cc14fc2cbfa1e12adff95b4b93bb2e 100644 (file)
@@ -494,7 +494,7 @@ static int mmc_test_basic_read(struct mmc_test_card *test)
 
        sg_init_one(&sg, test->buffer, 512);
 
-       ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 1);
+       ret = mmc_test_simple_transfer(test, &sg, 1, 0, 1, 512, 0);
        if (ret)
                return ret;
 
index 76bfe16c09b1e3e159a8016b479408a906c5bebd..2b1196e6142c1b951e47655d36ea185ac9466019 100644 (file)
@@ -1548,9 +1548,10 @@ static bool filter(struct dma_chan *chan, void *slave)
 {
        struct dw_dma_slave *dws = slave;
 
-       if (dws->dma_dev == chan->device->dev)
+       if (dws->dma_dev == chan->device->dev) {
+               chan->private = dws;
                return true;
-       else
+       else
                return false;
 }
 #endif
index db37490f67ec724d68732cd56054735d684a223e..a631c81dce1243bcb9bacefd26dcd3f0e439073d 100644 (file)
@@ -55,6 +55,7 @@
 #define VS30                   (1 << 25)
 #define SDVS18                 (0x5 << 9)
 #define SDVS30                 (0x6 << 9)
+#define SDVS33                 (0x7 << 9)
 #define SDVSCLR                        0xFFFFF1FF
 #define SDVSDET                        0x00000400
 #define AUTOIDLE               0x1
@@ -375,6 +376,32 @@ static void mmc_omap_report_irq(struct mmc_omap_host *host, u32 status)
 }
 #endif  /* CONFIG_MMC_DEBUG */
 
+/*
+ * MMC controller internal state machines reset
+ *
+ * Used to reset command or data internal state machines, using respectively
+ *  SRC or SRD bit of SYSCTL register
+ * Can be called from interrupt context
+ */
+static inline void mmc_omap_reset_controller_fsm(struct mmc_omap_host *host,
+               unsigned long bit)
+{
+       unsigned long i = 0;
+       unsigned long limit = (loops_per_jiffy *
+                               msecs_to_jiffies(MMC_TIMEOUT_MS));
+
+       OMAP_HSMMC_WRITE(host->base, SYSCTL,
+                        OMAP_HSMMC_READ(host->base, SYSCTL) | bit);
+
+       while ((OMAP_HSMMC_READ(host->base, SYSCTL) & bit) &&
+               (i++ < limit))
+               cpu_relax();
+
+       if (OMAP_HSMMC_READ(host->base, SYSCTL) & bit)
+               dev_err(mmc_dev(host->mmc),
+                       "Timeout waiting on controller reset in %s\n",
+                       __func__);
+}
 
 /*
  * MMC controller IRQ handler
@@ -403,21 +430,17 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
                        (status & CMD_CRC)) {
                        if (host->cmd) {
                                if (status & CMD_TIMEOUT) {
-                                       OMAP_HSMMC_WRITE(host->base, SYSCTL,
-                                               OMAP_HSMMC_READ(host->base,
-                                                               SYSCTL) | SRC);
-                                       while (OMAP_HSMMC_READ(host->base,
-                                                       SYSCTL) & SRC)
-                                               ;
-
+                                       mmc_omap_reset_controller_fsm(host, SRC);
                                        host->cmd->error = -ETIMEDOUT;
                                } else {
                                        host->cmd->error = -EILSEQ;
                                }
                                end_cmd = 1;
                        }
-                       if (host->data)
+                       if (host->data) {
                                mmc_dma_cleanup(host);
+                               mmc_omap_reset_controller_fsm(host, SRD);
+                       }
                }
                if ((status & DATA_TIMEOUT) ||
                        (status & DATA_CRC)) {
@@ -426,12 +449,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
                                        mmc_dma_cleanup(host);
                                else
                                        host->data->error = -EILSEQ;
-                               OMAP_HSMMC_WRITE(host->base, SYSCTL,
-                                       OMAP_HSMMC_READ(host->base,
-                                                       SYSCTL) | SRD);
-                               while (OMAP_HSMMC_READ(host->base,
-                                               SYSCTL) & SRD)
-                                       ;
+                               mmc_omap_reset_controller_fsm(host, SRD);
                                end_trans = 1;
                        }
                }
@@ -456,13 +474,20 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
 }
 
 /*
- * Switch MMC operating voltage
+ * Switch MMC interface voltage ... only relevant for MMC1.
+ *
+ * MMC2 and MMC3 use fixed 1.8V levels, and maybe a transceiver.
+ * The MMC2 transceiver controls are used instead of DAT4..DAT7.
+ * Some chips, like eMMC ones, use internal transceivers.
  */
 static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd)
 {
        u32 reg_val = 0;
        int ret;
 
+       if (host->id != OMAP_MMC1_DEVID)
+               return 0;
+
        /* Disable the clocks */
        clk_disable(host->fclk);
        clk_disable(host->iclk);
@@ -485,19 +510,26 @@ static int omap_mmc_switch_opcond(struct mmc_omap_host *host, int vdd)
        OMAP_HSMMC_WRITE(host->base, HCTL,
                OMAP_HSMMC_READ(host->base, HCTL) & SDVSCLR);
        reg_val = OMAP_HSMMC_READ(host->base, HCTL);
+
        /*
         * If a MMC dual voltage card is detected, the set_ios fn calls
         * this fn with VDD bit set for 1.8V. Upon card removal from the
         * slot, omap_mmc_set_ios sets the VDD back to 3V on MMC_POWER_OFF.
         *
-        * Only MMC1 supports 3.0V.  MMC2 will not function if SDVS30 is
-        * set in HCTL.
+        * Cope with a bit of slop in the range ... per data sheets:
+        *  - "1.8V" for vdds_mmc1/vdds_mmc1a can be up to 2.45V max,
+        *    but recommended values are 1.71V to 1.89V
+        *  - "3.0V" for vdds_mmc1/vdds_mmc1a can be up to 3.5V max,
+        *    but recommended values are 2.7V to 3.3V
+        *
+        * Board setup code shouldn't permit anything very out-of-range.
+        * TWL4030-family VMMC1 and VSIM regulators are fine (avoiding the
+        * middle range) but VSIM can't power DAT4..DAT7 at more than 3V.
         */
-       if (host->id == OMAP_MMC1_DEVID && (((1 << vdd) == MMC_VDD_32_33) ||
-                               ((1 << vdd) == MMC_VDD_33_34)))
-               reg_val |= SDVS30;
-       if ((1 << vdd) == MMC_VDD_165_195)
+       if ((1 << vdd) <= MMC_VDD_23_24)
                reg_val |= SDVS18;
+       else
+               reg_val |= SDVS30;
 
        OMAP_HSMMC_WRITE(host->base, HCTL, reg_val);
 
@@ -517,16 +549,15 @@ static void mmc_omap_detect(struct work_struct *work)
 {
        struct mmc_omap_host *host = container_of(work, struct mmc_omap_host,
                                                mmc_carddetect_work);
+       struct omap_mmc_slot_data *slot = &mmc_slot(host);
+
+       host->carddetect = slot->card_detect(slot->card_detect_irq);
 
        sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch");
        if (host->carddetect) {
                mmc_detect_change(host->mmc, (HZ * 200) / 1000);
        } else {
-               OMAP_HSMMC_WRITE(host->base, SYSCTL,
-                       OMAP_HSMMC_READ(host->base, SYSCTL) | SRD);
-               while (OMAP_HSMMC_READ(host->base, SYSCTL) & SRD)
-                       ;
-
+               mmc_omap_reset_controller_fsm(host, SRD);
                mmc_detect_change(host->mmc, (HZ * 50) / 1000);
        }
 }
@@ -538,7 +569,6 @@ static irqreturn_t omap_mmc_cd_handler(int irq, void *dev_id)
 {
        struct mmc_omap_host *host = (struct mmc_omap_host *)dev_id;
 
-       host->carddetect = mmc_slot(host).card_detect(irq);
        schedule_work(&host->mmc_carddetect_work);
 
        return IRQ_HANDLED;
@@ -757,10 +787,14 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        case MMC_POWER_OFF:
                mmc_slot(host).set_power(host->dev, host->slot_id, 0, 0);
                /*
-                * Reset bus voltage to 3V if it got set to 1.8V earlier.
+                * Reset interface voltage to 3V if it's 1.8V now;
+                * only relevant on MMC-1, the others always use 1.8V.
+                *
                 * REVISIT: If we are able to detect cards after unplugging
                 * a 1.8V card, this code should not be needed.
                 */
+               if (host->id != OMAP_MMC1_DEVID)
+                       break;
                if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
                        int vdd = fls(host->mmc->ocr_avail) - 1;
                        if (omap_mmc_switch_opcond(host, vdd) != 0)
@@ -784,7 +818,9 @@ static void omap_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
        }
 
        if (host->id == OMAP_MMC1_DEVID) {
-               /* Only MMC1 can operate at 3V/1.8V */
+               /* Only MMC1 can interface at 3V without some flavor
+                * of external transceiver; but they all handle 1.8V.
+                */
                if ((OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET) &&
                        (ios->vdd == DUAL_VOLT_OCR_BIT)) {
                                /*
@@ -1137,7 +1173,9 @@ static int omap_mmc_suspend(struct platform_device *pdev, pm_message_t state)
                                                " level suspend\n");
                        }
 
-                       if (!(OMAP_HSMMC_READ(host->base, HCTL) & SDVSDET)) {
+                       if (host->id == OMAP_MMC1_DEVID
+                                       && !(OMAP_HSMMC_READ(host->base, HCTL)
+                                                       & SDVSDET)) {
                                OMAP_HSMMC_WRITE(host->base, HCTL,
                                        OMAP_HSMMC_READ(host->base, HCTL)
                                        & SDVSCLR);
index 35a98eec74149a916c1baf735bff1b6ceff0baa4..f4a67c65d301b4d5aacc52ac85c8e452d6c63fd7 100644 (file)
@@ -329,7 +329,7 @@ static void do_pio_write(struct s3cmci_host *host)
 
        to_ptr = host->base + host->sdidata;
 
-       while ((fifo = fifo_free(host))) {
+       while ((fifo = fifo_free(host)) > 3) {
                if (!host->pio_bytes) {
                        res = get_data_buffer(host, &host->pio_bytes,
                                                        &host->pio_ptr);
index f07255cb17ee7a9d50dd3beacecd9157f523f1f0..8cff5f5e7f86dfa6f743317910afb028db7ca2df 100644 (file)
@@ -144,8 +144,7 @@ static int jmicron_probe(struct sdhci_pci_chip *chip)
                          SDHCI_QUIRK_32BIT_DMA_SIZE |
                          SDHCI_QUIRK_32BIT_ADMA_SIZE |
                          SDHCI_QUIRK_RESET_AFTER_REQUEST |
-                         SDHCI_QUIRK_BROKEN_SMALL_PIO |
-                         SDHCI_QUIRK_FORCE_HIGHSPEED;
+                         SDHCI_QUIRK_BROKEN_SMALL_PIO;
        }
 
        /*
index 6b2d1f99af6728d9cd12d42ebe2c71e0adaf08fe..f52f3053ed9251a9d3c3b795997e0f6dbd3ffbf5 100644 (file)
@@ -1636,8 +1636,7 @@ int sdhci_add_host(struct sdhci_host *host)
        mmc->f_max = host->max_clk;
        mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;
 
-       if ((caps & SDHCI_CAN_DO_HISPD) ||
-               (host->quirks & SDHCI_QUIRK_FORCE_HIGHSPEED))
+       if (caps & SDHCI_CAN_DO_HISPD)
                mmc->caps |= MMC_CAP_SD_HIGHSPEED;
 
        mmc->ocr_avail = 0;
@@ -1723,7 +1722,9 @@ int sdhci_add_host(struct sdhci_host *host)
 #endif
 
 #ifdef SDHCI_USE_LEDS_CLASS
-       host->led.name = mmc_hostname(mmc);
+       snprintf(host->led_name, sizeof(host->led_name),
+               "%s::", mmc_hostname(mmc));
+       host->led.name = host->led_name;
        host->led.brightness = LED_OFF;
        host->led.default_trigger = mmc_hostname(mmc);
        host->led.brightness_set = sdhci_led_control;
index 3efba236394164b195674905d4e978856494b477..ebb83657e27ab2b1257ab8ef54a3cb6de18d5abf 100644 (file)
@@ -208,8 +208,6 @@ struct sdhci_host {
 #define SDHCI_QUIRK_BROKEN_TIMEOUT_VAL                 (1<<12)
 /* Controller has an issue with buffer bits for small transfers */
 #define SDHCI_QUIRK_BROKEN_SMALL_PIO                   (1<<13)
-/* Controller supports high speed but doesn't have the caps bit set */
-#define SDHCI_QUIRK_FORCE_HIGHSPEED                    (1<<14)
 
        int                     irq;            /* Device IRQ */
        void __iomem *          ioaddr;         /* Mapped address */
@@ -222,6 +220,7 @@ struct sdhci_host {
 
 #if defined(CONFIG_LEDS_CLASS) || defined(CONFIG_LEDS_CLASS_MODULE)
        struct led_classdev     led;            /* LED control */
+       char   led_name[32];
 #endif
 
        spinlock_t              lock;           /* Mutex */
index 7df6bbf0e4d9337e8ea01da8f93b1821577ca8c3..6f6a0f6dafd6106b9042f27d892758ecee45916c 100644 (file)
@@ -453,7 +453,7 @@ static struct platform_driver sa1100_mtd_driver = {
        .resume         = sa1100_mtd_resume,
        .shutdown       = sa1100_mtd_shutdown,
        .driver         = {
-               .name   = "flash",
+               .name   = "sa1100-mtd",
                .owner  = THIS_MODULE,
        },
 };
@@ -474,4 +474,4 @@ module_exit(sa1100_mtd_exit);
 MODULE_AUTHOR("Nicolas Pitre");
 MODULE_DESCRIPTION("SA1100 CFI map driver");
 MODULE_LICENSE("GPL");
-MODULE_ALIAS("platform:flash");
+MODULE_ALIAS("platform:sa1100-mtd");
index c98c1570a40b1ef5f3f3931ab4e0512be0341406..47a33cec3793d4b3f1a8b512e3fcf95d5ca83aba 100644 (file)
@@ -139,7 +139,8 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
        struct nand_chip *nand_chip = mtd->priv;
        struct atmel_nand_host *host = nand_chip->priv;
 
-       return gpio_get_value(host->board->rdy_pin);
+       return gpio_get_value(host->board->rdy_pin) ^
+                !!host->board->rdy_pin_active_low;
 }
 
 /*
index 3d1318a3e6885901a5f1e4efab65b0964a5dc48e..1c5344aa57cc32473a0b019d7ab1205e3df2b9e0 100644 (file)
@@ -197,6 +197,17 @@ out:
        return ERR_PTR(err);
 }
 
+static const struct net_device_ops el_netdev_ops = {
+       .ndo_open               = el_open,
+       .ndo_stop               = el1_close,
+       .ndo_start_xmit         = el_start_xmit,
+       .ndo_tx_timeout         = el_timeout,
+       .ndo_set_multicast_list = set_multicast_list,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 /**
  *     el1_probe1:
  *     @dev: The device structure to use
@@ -305,12 +316,8 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
         *      The EL1-specific entries in the device structure.
         */
 
-       dev->open = &el_open;
-       dev->hard_start_xmit = &el_start_xmit;
-       dev->tx_timeout = &el_timeout;
+       dev->netdev_ops = &el_netdev_ops;
        dev->watchdog_timeo = HZ;
-       dev->stop = &el1_close;
-       dev->set_multicast_list = &set_multicast_list;
        dev->ethtool_ops = &netdev_ethtool_ops;
        return 0;
 }
index a8107f992fb4b03a243287ecadf879dbc21e024d..2de1c9cd7bdeffaff03be9c88a024047b31ec1ae 100644 (file)
@@ -1354,6 +1354,17 @@ static int __init elp_autodetect(struct net_device *dev)
        return 0;               /* Because of this, the layer above will return -ENODEV */
 }
 
+static const struct net_device_ops elp_netdev_ops = {
+       .ndo_open               = elp_open,
+       .ndo_stop               = elp_close,
+       .ndo_get_stats          = elp_get_stats,
+       .ndo_start_xmit         = elp_start_xmit,
+       .ndo_tx_timeout         = elp_timeout,
+       .ndo_set_multicast_list = elp_set_mc_list,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
 
 /******************************************************
  *
@@ -1558,13 +1569,8 @@ static int __init elplus_setup(struct net_device *dev)
                printk(KERN_ERR "%s: adapter configuration failed\n", dev->name);
        }
 
-       dev->open = elp_open;                           /* local */
-       dev->stop = elp_close;                          /* local */
-       dev->get_stats = elp_get_stats;                 /* local */
-       dev->hard_start_xmit = elp_start_xmit;          /* local */
-       dev->tx_timeout = elp_timeout;                  /* local */
+       dev->netdev_ops = &elp_netdev_ops;
        dev->watchdog_timeo = 10*HZ;
-       dev->set_multicast_list = elp_set_mc_list;      /* local */
        dev->ethtool_ops = &netdev_ethtool_ops;         /* local */
 
        dev->mem_start = dev->mem_end = 0;
index 423e65d0ba737740091fa9488f5305776475200b..fbbaf826deff829531a6dddaac7d652146df030b 100644 (file)
@@ -352,6 +352,16 @@ out:
        return ERR_PTR(err);
 }
 
+static const struct net_device_ops netdev_ops = {
+       .ndo_open               = el16_open,
+       .ndo_stop               = el16_close,
+       .ndo_start_xmit         = el16_send_packet,
+       .ndo_tx_timeout         = el16_tx_timeout,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 static int __init el16_probe1(struct net_device *dev, int ioaddr)
 {
        static unsigned char init_ID_done, version_printed;
@@ -449,10 +459,7 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
                goto out1;
        }
 
-       dev->open = el16_open;
-       dev->stop = el16_close;
-       dev->hard_start_xmit = el16_send_packet;
-       dev->tx_timeout = el16_tx_timeout;
+       dev->netdev_ops = &netdev_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
        dev->ethtool_ops = &netdev_ethtool_ops;
        dev->flags &= ~IFF_MULTICAST;   /* Multicast doesn't work */
index 8c694213035b684d049361f3121b25d7def2f6ff..fbb3719219911f5a3b33fcc421ac58e3e4afa147 100644 (file)
@@ -537,6 +537,21 @@ static struct mca_driver el3_mca_driver = {
 static int mca_registered;
 #endif /* CONFIG_MCA */
 
+static const struct net_device_ops netdev_ops = {
+       .ndo_open               = el3_open,
+       .ndo_stop               = el3_close,
+       .ndo_start_xmit         = el3_start_xmit,
+       .ndo_get_stats          = el3_get_stats,
+       .ndo_set_multicast_list = set_multicast_list,
+       .ndo_tx_timeout         = el3_tx_timeout,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = el3_poll_controller,
+#endif
+};
+
 static int __devinit el3_common_init(struct net_device *dev)
 {
        struct el3_private *lp = netdev_priv(dev);
@@ -553,16 +568,8 @@ static int __devinit el3_common_init(struct net_device *dev)
        }
 
        /* The EL3-specific entries in the device structure. */
-       dev->open = &el3_open;
-       dev->hard_start_xmit = &el3_start_xmit;
-       dev->stop = &el3_close;
-       dev->get_stats = &el3_get_stats;
-       dev->set_multicast_list = &set_multicast_list;
-       dev->tx_timeout = el3_tx_timeout;
+       dev->netdev_ops = &netdev_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = el3_poll_controller;
-#endif
        SET_ETHTOOL_OPS(dev, &ethtool_ops);
 
        err = register_netdev(dev);
index 39ac12233aa72778362d0e00eee37830f7d387ce..167bf23066eab6e5e376d4356acde830f2e06aaf 100644 (file)
@@ -563,6 +563,20 @@ no_pnp:
        return NULL;
 }
 
+
+static const struct net_device_ops netdev_ops = {
+       .ndo_open               = corkscrew_open,
+       .ndo_stop               = corkscrew_close,
+       .ndo_start_xmit         = corkscrew_start_xmit,
+       .ndo_tx_timeout         = corkscrew_timeout,
+       .ndo_get_stats          = corkscrew_get_stats,
+       .ndo_set_multicast_list = set_rx_mode,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
+
 static int corkscrew_setup(struct net_device *dev, int ioaddr,
                            struct pnp_dev *idev, int card_number)
 {
@@ -681,13 +695,8 @@ static int corkscrew_setup(struct net_device *dev, int ioaddr,
        vp->full_bus_master_rx = (vp->capabilities & 0x20) ? 1 : 0;
 
        /* The 3c51x-specific entries in the device structure. */
-       dev->open = &corkscrew_open;
-       dev->hard_start_xmit = &corkscrew_start_xmit;
-       dev->tx_timeout = &corkscrew_timeout;
+       dev->netdev_ops = &netdev_ops;
        dev->watchdog_timeo = (400 * HZ) / 1000;
-       dev->stop = &corkscrew_close;
-       dev->get_stats = &corkscrew_get_stats;
-       dev->set_multicast_list = &set_rx_mode;
        dev->ethtool_ops = &netdev_ethtool_ops;
 
        return register_netdev(dev);
index ff41e1ff56031876862db4a387c45a0dedb5d0b9..8f734d74b513f66b33e3c89b7c8779125e832246 100644 (file)
@@ -403,6 +403,20 @@ static int elmc_getinfo(char *buf, int slot, void *d)
        return len;
 }                              /* elmc_getinfo() */
 
+static const struct net_device_ops netdev_ops = {
+       .ndo_open               = elmc_open,
+       .ndo_stop               = elmc_close,
+       .ndo_get_stats          = elmc_get_stats,
+       .ndo_start_xmit         = elmc_send_packet,
+       .ndo_tx_timeout         = elmc_timeout,
+#ifdef ELMC_MULTICAST
+       .ndo_set_multicast_list = set_multicast_list,
+#endif
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 /*****************************************************************/
 
 static int __init do_elmc_probe(struct net_device *dev)
@@ -544,17 +558,8 @@ static int __init do_elmc_probe(struct net_device *dev)
        printk(KERN_INFO "%s: hardware address %pM\n",
               dev->name, dev->dev_addr);
 
-       dev->open = &elmc_open;
-       dev->stop = &elmc_close;
-       dev->get_stats = &elmc_get_stats;
-       dev->hard_start_xmit = &elmc_send_packet;
-       dev->tx_timeout = &elmc_timeout;
+       dev->netdev_ops = &netdev_ops;
        dev->watchdog_timeo = HZ;
-#ifdef ELMC_MULTICAST
-       dev->set_multicast_list = &set_multicast_list;
-#else
-       dev->set_multicast_list = NULL;
-#endif
        dev->ethtool_ops = &netdev_ethtool_ops;
 
        /* note that we haven't actually requested the IRQ from the kernel.
index 2df3af3b9b20130ead927f93db05730029430d9c..b61073c42bf8641b1623243e5fa30d19299b79aa 100644 (file)
@@ -288,6 +288,18 @@ struct net_device *__init mc32_probe(int unit)
        return ERR_PTR(-ENODEV);
 }
 
+static const struct net_device_ops netdev_ops = {
+       .ndo_open               = mc32_open,
+       .ndo_stop               = mc32_close,
+       .ndo_start_xmit         = mc32_send_packet,
+       .ndo_get_stats          = mc32_get_stats,
+       .ndo_set_multicast_list = mc32_set_multicast_list,
+       .ndo_tx_timeout         = mc32_timeout,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 /**
  * mc32_probe1 -       Check a given slot for a board and test the card
  * @dev:  Device structure to fill in
@@ -518,12 +530,7 @@ static int __init mc32_probe1(struct net_device *dev, int slot)
        printk("%s: Firmware Rev %d. %d RX buffers, %d TX buffers. Base of 0x%08X.\n",
                dev->name, lp->exec_box->data[12], lp->rx_len, lp->tx_len, lp->base);
 
-       dev->open               = mc32_open;
-       dev->stop               = mc32_close;
-       dev->hard_start_xmit    = mc32_send_packet;
-       dev->get_stats          = mc32_get_stats;
-       dev->set_multicast_list = mc32_set_multicast_list;
-       dev->tx_timeout         = mc32_timeout;
+       dev->netdev_ops         = &netdev_ops;
        dev->watchdog_timeo     = HZ*5; /* Board does all the work */
        dev->ethtool_ops        = &netdev_ethtool_ops;
 
index cdbbb6226fc598d3fd5bb5b072fd5ffba7ef1c9d..b2563d384cf2998a8b763cf9767146716b718b86 100644 (file)
@@ -992,6 +992,42 @@ out:
        return rc;
 }
 
+static const struct net_device_ops boomrang_netdev_ops = {
+       .ndo_open               = vortex_open,
+       .ndo_stop               = vortex_close,
+       .ndo_start_xmit         = boomerang_start_xmit,
+       .ndo_tx_timeout         = vortex_tx_timeout,
+       .ndo_get_stats          = vortex_get_stats,
+#ifdef CONFIG_PCI
+       .ndo_do_ioctl           = vortex_ioctl,
+#endif
+       .ndo_set_multicast_list = set_rx_mode,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = poll_vortex,
+#endif
+};
+
+static const struct net_device_ops vortex_netdev_ops = {
+       .ndo_open               = vortex_open,
+       .ndo_stop               = vortex_close,
+       .ndo_start_xmit         = vortex_start_xmit,
+       .ndo_tx_timeout         = vortex_tx_timeout,
+       .ndo_get_stats          = vortex_get_stats,
+#ifdef CONFIG_PCI
+       .ndo_do_ioctl           = vortex_ioctl,
+#endif
+       .ndo_set_multicast_list = set_rx_mode,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = poll_vortex,
+#endif
+};
+
 /*
  * Start up the PCI/EISA device which is described by *gendev.
  * Return 0 on success.
@@ -1366,18 +1402,16 @@ static int __devinit vortex_probe1(struct device *gendev,
        }
 
        /* The 3c59x-specific entries in the device structure. */
-       dev->open = vortex_open;
        if (vp->full_bus_master_tx) {
-               dev->hard_start_xmit = boomerang_start_xmit;
+               dev->netdev_ops = &boomrang_netdev_ops;
                /* Actually, it still should work with iommu. */
                if (card_idx < MAX_UNITS &&
                    ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) ||
                                hw_checksums[card_idx] == 1)) {
                        dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG;
                }
-       } else {
-               dev->hard_start_xmit = vortex_start_xmit;
-       }
+       } else
+               dev->netdev_ops =  &vortex_netdev_ops;
 
        if (print_info) {
                printk(KERN_INFO "%s: scatter/gather %sabled. h/w checksums %sabled\n",
@@ -1386,18 +1420,9 @@ static int __devinit vortex_probe1(struct device *gendev,
                                (dev->features & NETIF_F_IP_CSUM) ? "en":"dis");
        }
 
-       dev->stop = vortex_close;
-       dev->get_stats = vortex_get_stats;
-#ifdef CONFIG_PCI
-       dev->do_ioctl = vortex_ioctl;
-#endif
        dev->ethtool_ops = &vortex_ethtool_ops;
-       dev->set_multicast_list = set_rx_mode;
-       dev->tx_timeout = vortex_tx_timeout;
        dev->watchdog_timeo = (watchdog * HZ) / 1000;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = poll_vortex;
-#endif
+
        if (pdev) {
                vp->pm_state_valid = 1;
                pci_save_state(VORTEX_PCI(vp));
index 4e19ae3ce6bef0d2f10b9c4225974ee6e088754a..35517b06ec3ff39901f8eeba255146e84ea8e7b0 100644 (file)
@@ -604,7 +604,7 @@ rx_next:
 
                spin_lock_irqsave(&cp->lock, flags);
                cpw16_f(IntrMask, cp_intr_mask);
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
                spin_unlock_irqrestore(&cp->lock, flags);
        }
 
@@ -641,9 +641,9 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance)
        }
 
        if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr))
-               if (netif_rx_schedule_prep(&cp->napi)) {
+               if (napi_schedule_prep(&cp->napi)) {
                        cpw16_f(IntrMask, cp_norx_intr_mask);
-                       __netif_rx_schedule(&cp->napi);
+                       __napi_schedule(&cp->napi);
                }
 
        if (status & (TxOK | TxErr | TxEmpty | SWInt))
index a5b24202d5649e5c292e5267701d39f0699bae9a..5341da604e8465df4aafedf5ebba6404db627ee6 100644 (file)
@@ -2128,7 +2128,7 @@ static int rtl8139_poll(struct napi_struct *napi, int budget)
                 */
                spin_lock_irqsave(&tp->lock, flags);
                RTL_W16_F(IntrMask, rtl8139_intr_mask);
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
                spin_unlock_irqrestore(&tp->lock, flags);
        }
        spin_unlock(&tp->rx_lock);
@@ -2178,9 +2178,9 @@ static irqreturn_t rtl8139_interrupt (int irq, void *dev_instance)
        /* Receive packets are processed by poll routine.
           If not running start it now. */
        if (status & RxAckBits){
-               if (netif_rx_schedule_prep(&tp->napi)) {
+               if (napi_schedule_prep(&tp->napi)) {
                        RTL_W16_F (IntrMask, rtl8139_norx_intr_mask);
-                       __netif_rx_schedule(&tp->napi);
+                       __napi_schedule(&tp->napi);
                }
        }
 
index b273596368e36d9c2a99e1143b673e518f93aeed..cca94b9c08ae5360428554fcff302620009488b4 100644 (file)
@@ -1122,6 +1122,17 @@ static void print_eth(unsigned char *add, char *str)
 static int io = 0x300;
 static int irq = 10;
 
+static const struct net_device_ops i596_netdev_ops = {
+       .ndo_open               = i596_open,
+       .ndo_stop               = i596_close,
+       .ndo_start_xmit         = i596_start_xmit,
+       .ndo_set_multicast_list = set_multicast_list,
+       .ndo_tx_timeout         = i596_tx_timeout,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 struct net_device * __init i82596_probe(int unit)
 {
        struct net_device *dev;
@@ -1232,11 +1243,7 @@ found:
        DEB(DEB_PROBE,printk(KERN_INFO "%s", version));
 
        /* The 82596-specific entries in the device structure. */
-       dev->open = i596_open;
-       dev->stop = i596_close;
-       dev->hard_start_xmit = i596_start_xmit;
-       dev->set_multicast_list = set_multicast_list;
-       dev->tx_timeout = i596_tx_timeout;
+       dev->netdev_ops = &i596_netdev_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
 
        dev->ml_priv = (void *)(dev->mem_start);
index a2f185fd70725eb84c1e239afe7831c7a3ba828b..7159a39aa2b98ade0ca5aa4aa204fa10c6d7c250 100644 (file)
@@ -1829,10 +1829,10 @@ config 68360_ENET
 
 config FEC
        bool "FEC ethernet controller (of ColdFire CPUs)"
-       depends on M523x || M527x || M5272 || M528x || M520x || M532x
+       depends on M523x || M527x || M5272 || M528x || M520x || M532x || MACH_MX27
        help
          Say Y here if you want to use the built-in 10/100 Fast ethernet
-         controller on some Motorola ColdFire processors.
+         controller on some Motorola ColdFire and Freescale i.MX processors.
 
 config FEC2
        bool "Second FEC ethernet controller (on some ColdFire CPUs)"
@@ -2019,15 +2019,6 @@ config IGB
          To compile this driver as a module, choose M here. The module
          will be called igb.
 
-config IGB_LRO 
-       bool "Use software LRO"
-       depends on IGB && INET
-       select INET_LRO
-       ---help---
-         Say Y here if you want to use large receive offload. 
-
-         If in doubt, say N.
-
 config IGB_DCA
        bool "Direct Cache Access (DCA) Support"
        default y
@@ -2273,9 +2264,17 @@ config GELIC_WIRELESS_OLD_PSK_INTERFACE
 
           If unsure, say N.
 
+config FSL_PQ_MDIO
+       tristate "Freescale PQ MDIO"
+       depends on FSL_SOC
+       select PHYLIB
+       help
+         This driver supports the MDIO bus used by the gianfar and UCC drivers.
+
 config GIANFAR
        tristate "Gianfar Ethernet"
        depends on FSL_SOC
+       select FSL_PQ_MDIO
        select PHYLIB
        select CRC32
        help
@@ -2285,6 +2284,7 @@ config GIANFAR
 config UCC_GETH
        tristate "Freescale QE Gigabit Ethernet"
        depends on QUICC_ENGINE
+       select FSL_PQ_MDIO
        select PHYLIB
        help
          This driver supports the Gigabit Ethernet mode of the QUICC Engine,
@@ -2310,6 +2310,16 @@ config MV643XX_ETH
          Some boards that use the Discovery chipset are the Momenco
          Ocelot C and Jaguar ATX and Pegasos II.
 
+config MV643XX_ETH_LRO
+       tristate "Marvell 643XX ethernet driver LRO support"
+       depends on MV643XX_ETH
+       select INET_LRO
+       help
+         Say y here if you want to use Large Receive Offload for the
+         mv643xx_eth driver.
+
+         If in doubt, say N.
+
 config QLA3XXX
        tristate "QLogic QLA3XXX Network Driver Support"
        depends on PCI
@@ -2419,7 +2429,6 @@ config CHELSIO_T3
        tristate "Chelsio Communications T3 10Gb Ethernet support"
        depends on CHELSIO_T3_DEPENDS
        select FW_LOADER
-       select INET_LRO
        help
          This driver supports Chelsio T3-based gigabit and 10Gb Ethernet
          adapters.
@@ -2455,7 +2464,6 @@ config ENIC
 config IXGBE
        tristate "Intel(R) 10GbE PCI Express adapters support"
        depends on PCI && INET
-       select INET_LRO
        ---help---
          This driver supports Intel(R) 10GbE PCI Express family of
          adapters.  For more information on how to identify your adapter, go
index aca8492db65453fed3bae5a106497d597fb7c0c6..3f8cb311e077668ba0ea0866667aa7d37f49c5f6 100644 (file)
@@ -25,11 +25,12 @@ obj-$(CONFIG_JME) += jme.o
 
 gianfar_driver-objs := gianfar.o \
                gianfar_ethtool.o \
-               gianfar_mii.o \
                gianfar_sysfs.o
 
 obj-$(CONFIG_UCC_GETH) += ucc_geth_driver.o
-ucc_geth_driver-objs := ucc_geth.o ucc_geth_mii.o ucc_geth_ethtool.o
+ucc_geth_driver-objs := ucc_geth.o ucc_geth_ethtool.o
+
+obj-$(CONFIG_FSL_PQ_MDIO) += fsl_pq_mdio.o
 
 #
 # link order important here
index 7709992bb6bf21d5e85814c65dc63305412586d8..cb9c95d3ed0ab45854da0e1b1e8e0240c6c044d6 100644 (file)
@@ -831,7 +831,7 @@ static int amd8111e_rx_poll(struct napi_struct *napi, int budget)
        if (rx_pkt_limit > 0) {
                /* Receive descriptor is empty now */
                spin_lock_irqsave(&lp->lock, flags);
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
                writel(VAL0|RINTEN0, mmio + INTEN0);
                writel(VAL2 | RDMD0, mmio + CMD0);
                spin_unlock_irqrestore(&lp->lock, flags);
@@ -1170,11 +1170,11 @@ static irqreturn_t amd8111e_interrupt(int irq, void *dev_id)
 
        /* Check if Receive Interrupt has occurred. */
        if (intr0 & RINT0) {
-               if (netif_rx_schedule_prep(&lp->napi)) {
+               if (napi_schedule_prep(&lp->napi)) {
                        /* Disable receive interupts */
                        writel(RINTEN0, mmio + INTEN0);
                        /* Schedule a polling routine */
-                       __netif_rx_schedule(&lp->napi);
+                       __napi_schedule(&lp->napi);
                } else if (intren0 & RINTEN0) {
                        printk("************Driver bug! \
                                interrupt while in poll\n");
index 3ff9affb1a914e212de008728985598e8e724bf8..646dfc5f50c9827014f343ba3c62bc7960b85f4e 100644 (file)
@@ -102,7 +102,7 @@ static void rx(struct net_device *dev, int bufnum,
        skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
        if (skb == NULL) {
                BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
-               lp->stats.rx_dropped++;
+               dev->stats.rx_dropped++;
                return;
        }
        skb_put(skb, length + ARC_HDR_SIZE);
@@ -122,7 +122,7 @@ static void rx(struct net_device *dev, int bufnum,
 
        BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
 
-       skb->protocol = __constant_htons(ETH_P_ARCNET);
+       skb->protocol = cpu_to_be16(ETH_P_ARCNET);
 ;
        netif_rx(skb);
 }
index 6b53e5ed125cfbb10c2be5f34edca1a04fe36097..d6d4ab3b430ccf77a25fe865384f3daaa8b6b7b4 100644 (file)
@@ -95,17 +95,16 @@ EXPORT_SYMBOL(arcnet_unregister_proto);
 EXPORT_SYMBOL(arcnet_debug);
 EXPORT_SYMBOL(alloc_arcdev);
 EXPORT_SYMBOL(arcnet_interrupt);
+EXPORT_SYMBOL(arcnet_open);
+EXPORT_SYMBOL(arcnet_close);
+EXPORT_SYMBOL(arcnet_send_packet);
+EXPORT_SYMBOL(arcnet_timeout);
 
 /* Internal function prototypes */
-static int arcnet_open(struct net_device *dev);
-static int arcnet_close(struct net_device *dev);
-static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev);
-static void arcnet_timeout(struct net_device *dev);
 static int arcnet_header(struct sk_buff *skb, struct net_device *dev,
                         unsigned short type, const void *daddr,
                         const void *saddr, unsigned len);
 static int arcnet_rebuild_header(struct sk_buff *skb);
-static struct net_device_stats *arcnet_get_stats(struct net_device *dev);
 static int go_tx(struct net_device *dev);
 
 static int debug = ARCNET_DEBUG;
@@ -322,11 +321,18 @@ static const struct header_ops arcnet_header_ops = {
        .rebuild = arcnet_rebuild_header,
 };
 
+static const struct net_device_ops arcnet_netdev_ops = {
+       .ndo_open       = arcnet_open,
+       .ndo_stop       = arcnet_close,
+       .ndo_start_xmit = arcnet_send_packet,
+       .ndo_tx_timeout = arcnet_timeout,
+};
 
 /* Setup a struct device for ARCnet. */
 static void arcdev_setup(struct net_device *dev)
 {
        dev->type = ARPHRD_ARCNET;
+       dev->netdev_ops = &arcnet_netdev_ops;
        dev->header_ops = &arcnet_header_ops;
        dev->hard_header_len = sizeof(struct archdr);
        dev->mtu = choose_mtu();
@@ -339,18 +345,9 @@ static void arcdev_setup(struct net_device *dev)
        /* New-style flags. */
        dev->flags = IFF_BROADCAST;
 
-       /*
-        * Put in this stuff here, so we don't have to export the symbols to
-        * the chipset drivers.
-        */
-       dev->open = arcnet_open;
-       dev->stop = arcnet_close;
-       dev->hard_start_xmit = arcnet_send_packet;
-       dev->tx_timeout = arcnet_timeout;
-       dev->get_stats = arcnet_get_stats;
 }
 
-struct net_device *alloc_arcdev(char *name)
+struct net_device *alloc_arcdev(const char *name)
 {
        struct net_device *dev;
 
@@ -372,7 +369,7 @@ struct net_device *alloc_arcdev(char *name)
  * that "should" only need to be set once at boot, so that there is
  * non-reboot way to recover if something goes wrong.
  */
-static int arcnet_open(struct net_device *dev)
+int arcnet_open(struct net_device *dev)
 {
        struct arcnet_local *lp = netdev_priv(dev);
        int count, newmtu, error;
@@ -383,7 +380,6 @@ static int arcnet_open(struct net_device *dev)
                return -ENODEV;
 
        BUGLVL(D_PROTO) {
-               int count;
                BUGMSG(D_PROTO, "protocol map (default is '%c'): ",
                       arc_proto_default->suffix);
                for (count = 0; count < 256; count++)
@@ -472,7 +468,7 @@ static int arcnet_open(struct net_device *dev)
 
 
 /* The inverse routine to arcnet_open - shuts down the card. */
-static int arcnet_close(struct net_device *dev)
+int arcnet_close(struct net_device *dev)
 {
        struct arcnet_local *lp = netdev_priv(dev);
 
@@ -583,8 +579,8 @@ static int arcnet_rebuild_header(struct sk_buff *skb)
        } else {
                BUGMSG(D_NORMAL,
                       "I don't understand ethernet protocol %Xh addresses!\n", type);
-               lp->stats.tx_errors++;
-               lp->stats.tx_aborted_errors++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_aborted_errors++;
        }
 
        /* if we couldn't resolve the address... give up. */
@@ -601,7 +597,7 @@ static int arcnet_rebuild_header(struct sk_buff *skb)
 
 
 /* Called by the kernel in order to transmit a packet. */
-static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
+int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
 {
        struct arcnet_local *lp = netdev_priv(dev);
        struct archdr *pkt;
@@ -645,7 +641,7 @@ static int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev)
                    !proto->ack_tx) {
                        /* done right away and we don't want to acknowledge
                           the package later - forget about it now */
-                       lp->stats.tx_bytes += skb->len;
+                       dev->stats.tx_bytes += skb->len;
                        freeskb = 1;
                } else {
                        /* do it the 'split' way */
@@ -709,7 +705,7 @@ static int go_tx(struct net_device *dev)
        /* start sending */
        ACOMMAND(TXcmd | (lp->cur_tx << 3));
 
-       lp->stats.tx_packets++;
+       dev->stats.tx_packets++;
        lp->lasttrans_dest = lp->lastload_dest;
        lp->lastload_dest = 0;
        lp->excnak_pending = 0;
@@ -720,7 +716,7 @@ static int go_tx(struct net_device *dev)
 
 
 /* Called by the kernel when transmit times out */
-static void arcnet_timeout(struct net_device *dev)
+void arcnet_timeout(struct net_device *dev)
 {
        unsigned long flags;
        struct arcnet_local *lp = netdev_priv(dev);
@@ -732,11 +728,11 @@ static void arcnet_timeout(struct net_device *dev)
                msg = " - missed IRQ?";
        } else {
                msg = "";
-               lp->stats.tx_aborted_errors++;
+               dev->stats.tx_aborted_errors++;
                lp->timed_out = 1;
                ACOMMAND(NOTXcmd | (lp->cur_tx << 3));
        }
-       lp->stats.tx_errors++;
+       dev->stats.tx_errors++;
 
        /* make sure we didn't miss a TX or a EXC NAK IRQ */
        AINTMASK(0);
@@ -865,8 +861,8 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
                                                       "transmit was not acknowledged! "
                                                       "(status=%Xh, dest=%02Xh)\n",
                                                       status, lp->lasttrans_dest);
-                                               lp->stats.tx_errors++;
-                                               lp->stats.tx_carrier_errors++;
+                                               dev->stats.tx_errors++;
+                                               dev->stats.tx_carrier_errors++;
                                        } else {
                                                BUGMSG(D_DURING,
                                                       "broadcast was not acknowledged; that's normal "
@@ -905,7 +901,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
                                if (txbuf != -1) {
                                        if (lp->outgoing.proto->continue_tx(dev, txbuf)) {
                                                /* that was the last segment */
-                                               lp->stats.tx_bytes += lp->outgoing.skb->len;
+                                               dev->stats.tx_bytes += lp->outgoing.skb->len;
                                                if(!lp->outgoing.proto->ack_tx)
                                                  {
                                                    dev_kfree_skb_irq(lp->outgoing.skb);
@@ -930,7 +926,7 @@ irqreturn_t arcnet_interrupt(int irq, void *dev_id)
                }
                if (status & lp->intmask & RECONflag) {
                        ACOMMAND(CFLAGScmd | CONFIGclear);
-                       lp->stats.tx_carrier_errors++;
+                       dev->stats.tx_carrier_errors++;
 
                        BUGMSG(D_RECON, "Network reconfiguration detected (status=%Xh)\n",
                               status);
@@ -1038,8 +1034,8 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
               "(%d+4 bytes)\n",
               bufnum, pkt.hard.source, pkt.hard.dest, length);
 
-       lp->stats.rx_packets++;
-       lp->stats.rx_bytes += length + ARC_HDR_SIZE;
+       dev->stats.rx_packets++;
+       dev->stats.rx_bytes += length + ARC_HDR_SIZE;
 
        /* call the right receiver for the protocol */
        if (arc_proto_map[soft->proto]->is_ip) {
@@ -1067,18 +1063,6 @@ static void arcnet_rx(struct net_device *dev, int bufnum)
 }
 
 
-
-/* 
- * Get the current statistics.  This may be called with the card open or
- * closed.
- */
-static struct net_device_stats *arcnet_get_stats(struct net_device *dev)
-{
-       struct arcnet_local *lp = netdev_priv(dev);
-       return &lp->stats;
-}
-
-
 static void null_rx(struct net_device *dev, int bufnum,
                    struct archdr *pkthdr, int length)
 {
index 30580bbe252d4ff11a346d0d7bbc0db1a0a2bef5..083e21094b20d69ae6fba917bef34485a5cd5766 100644 (file)
@@ -119,7 +119,7 @@ static void rx(struct net_device *dev, int bufnum,
        skb = alloc_skb(length + ARC_HDR_SIZE + sizeof(int), GFP_ATOMIC);
        if (skb == NULL) {
                BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
-               lp->stats.rx_dropped++;
+               dev->stats.rx_dropped++;
                return;
        }
        skb_put(skb, length + ARC_HDR_SIZE + sizeof(int));
@@ -148,7 +148,7 @@ static void rx(struct net_device *dev, int bufnum,
 
        BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
 
-       skb->protocol = __constant_htons(ETH_P_ARCNET);
+       skb->protocol = cpu_to_be16(ETH_P_ARCNET);
 ;
        netif_rx(skb);
 }
@@ -282,7 +282,7 @@ static int ack_tx(struct net_device *dev, int acked)
   BUGMSG(D_PROTO, "Ackknowledge for cap packet %x.\n",
         *((int*)&ackpkt->soft.cap.cookie[0]));
 
-  ackskb->protocol = __constant_htons(ETH_P_ARCNET);
+  ackskb->protocol = cpu_to_be16(ETH_P_ARCNET);
 
   BUGLVL(D_SKB) arcnet_dump_skb(dev, ackskb, "ack_tx_recv");
   netif_rx(ackskb);
index ea53a940272f1172ec4b51070d608becbf71e134..db08fc24047a5b569a3f0e411b1cafea435cd5e2 100644 (file)
@@ -151,6 +151,8 @@ static int __init com20020_init(void)
        if (node && node != 0xff)
                dev->dev_addr[0] = node;
 
+       dev->netdev_ops = &com20020_netdev_ops;
+
        lp = netdev_priv(dev);
        lp->backplane = backplane;
        lp->clockp = clockp & 7;
index 8b51f632581d1810f2f712e2b3b63ae942b33ed3..dbf4de39754d1f4009edfdb02f4bfa1e80e56baa 100644 (file)
@@ -72,6 +72,9 @@ static int __devinit com20020pci_probe(struct pci_dev *pdev, const struct pci_de
        dev = alloc_arcdev(device);
        if (!dev)
                return -ENOMEM;
+
+       dev->netdev_ops = &com20020_netdev_ops;
+
        lp = netdev_priv(dev);
 
        pci_set_drvdata(pdev, dev);
index 103688358fb84721af7568c9a4f14a90ba81659c..651275a5f3d27020022d1682930c89a7db6ace3b 100644 (file)
@@ -149,6 +149,14 @@ int com20020_check(struct net_device *dev)
        return 0;
 }
 
+const struct net_device_ops com20020_netdev_ops = {
+       .ndo_open       = arcnet_open,
+       .ndo_stop       = arcnet_close,
+       .ndo_start_xmit = arcnet_send_packet,
+       .ndo_tx_timeout = arcnet_timeout,
+       .ndo_set_multicast_list = com20020_set_mc_list,
+};
+
 /* Set up the struct net_device associated with this card.  Called after
  * probing succeeds.
  */
@@ -170,8 +178,6 @@ int com20020_found(struct net_device *dev, int shared)
        lp->hw.copy_from_card = com20020_copy_from_card;
        lp->hw.close = com20020_close;
 
-       dev->set_multicast_list = com20020_set_mc_list;
-
        if (!dev->dev_addr[0])
                dev->dev_addr[0] = inb(ioaddr + BUS_ALIGN*8);   /* FIXME: do this some other way! */
 
@@ -342,6 +348,7 @@ static void com20020_set_mc_list(struct net_device *dev)
     defined(CONFIG_ARCNET_COM20020_CS_MODULE)
 EXPORT_SYMBOL(com20020_check);
 EXPORT_SYMBOL(com20020_found);
+EXPORT_SYMBOL(com20020_netdev_ops);
 #endif
 
 MODULE_LICENSE("GPL");
index 49d39a9cb696331052f7a590cb72b71e4dab2452..06f8fa2f8f2fb90b0317bf02cdacb3476a2823c7 100644 (file)
@@ -88,7 +88,6 @@ MODULE_LICENSE("GPL");
  */
 static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
 {
-       struct arcnet_local *lp = netdev_priv(dev);
        struct archdr *pkt = (struct archdr *) skb->data;
        struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
        int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
@@ -112,8 +111,8 @@ static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
                return htons(ETH_P_ARP);
 
        default:
-               lp->stats.rx_errors++;
-               lp->stats.rx_crc_errors++;
+               dev->stats.rx_errors++;
+               dev->stats.rx_crc_errors++;
                return 0;
        }
 
@@ -140,7 +139,7 @@ static void rx(struct net_device *dev, int bufnum,
        skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
        if (skb == NULL) {
                BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
-               lp->stats.rx_dropped++;
+               dev->stats.rx_dropped++;
                return;
        }
        skb_put(skb, length + ARC_HDR_SIZE);
@@ -168,7 +167,6 @@ static void rx(struct net_device *dev, int bufnum,
 static int build_header(struct sk_buff *skb, struct net_device *dev,
                        unsigned short type, uint8_t daddr)
 {
-       struct arcnet_local *lp = netdev_priv(dev);
        int hdr_size = ARC_HDR_SIZE + RFC1051_HDR_SIZE;
        struct archdr *pkt = (struct archdr *) skb_push(skb, hdr_size);
        struct arc_rfc1051 *soft = &pkt->soft.rfc1051;
@@ -184,8 +182,8 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
        default:
                BUGMSG(D_NORMAL, "RFC1051: I don't understand protocol %d (%Xh)\n",
                       type, type);
-               lp->stats.tx_errors++;
-               lp->stats.tx_aborted_errors++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_aborted_errors++;
                return 0;
        }
 
index 2303d3a1f4b63d512aea87ef1287fb39e54b10d9..745530651c454c3fd25ab85313e90e40b69624a9 100644 (file)
@@ -92,7 +92,6 @@ static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
 {
        struct archdr *pkt = (struct archdr *) skb->data;
        struct arc_rfc1201 *soft = &pkt->soft.rfc1201;
-       struct arcnet_local *lp = netdev_priv(dev);
        int hdr_size = ARC_HDR_SIZE + RFC1201_HDR_SIZE;
 
        /* Pull off the arcnet header. */
@@ -121,8 +120,8 @@ static __be16 type_trans(struct sk_buff *skb, struct net_device *dev)
        case ARC_P_NOVELL_EC:
                return htons(ETH_P_802_3);
        default:
-               lp->stats.rx_errors++;
-               lp->stats.rx_crc_errors++;
+               dev->stats.rx_errors++;
+               dev->stats.rx_crc_errors++;
                return 0;
        }
 
@@ -172,8 +171,8 @@ static void rx(struct net_device *dev, int bufnum,
                         in->sequence, soft->split_flag, soft->sequence);
                        lp->rfc1201.aborted_seq = soft->sequence;
                        dev_kfree_skb_irq(in->skb);
-                       lp->stats.rx_errors++;
-                       lp->stats.rx_missed_errors++;
+                       dev->stats.rx_errors++;
+                       dev->stats.rx_missed_errors++;
                        in->skb = NULL;
                }
                in->sequence = soft->sequence;
@@ -181,7 +180,7 @@ static void rx(struct net_device *dev, int bufnum,
                skb = alloc_skb(length + ARC_HDR_SIZE, GFP_ATOMIC);
                if (skb == NULL) {
                        BUGMSG(D_NORMAL, "Memory squeeze, dropping packet.\n");
-                       lp->stats.rx_dropped++;
+                       dev->stats.rx_dropped++;
                        return;
                }
                skb_put(skb, length + ARC_HDR_SIZE);
@@ -213,7 +212,7 @@ static void rx(struct net_device *dev, int bufnum,
                                        BUGMSG(D_EXTRA,
                                               "ARP source address was 00h, set to %02Xh.\n",
                                               saddr);
-                                       lp->stats.rx_crc_errors++;
+                                       dev->stats.rx_crc_errors++;
                                        *cptr = saddr;
                                } else {
                                        BUGMSG(D_DURING, "ARP source address (%Xh) is fine.\n",
@@ -222,8 +221,8 @@ static void rx(struct net_device *dev, int bufnum,
                        } else {
                                BUGMSG(D_NORMAL, "funny-shaped ARP packet. (%Xh, %Xh)\n",
                                       arp->ar_hln, arp->ar_pln);
-                               lp->stats.rx_errors++;
-                               lp->stats.rx_crc_errors++;
+                               dev->stats.rx_errors++;
+                               dev->stats.rx_crc_errors++;
                        }
                }
                BUGLVL(D_SKB) arcnet_dump_skb(dev, skb, "rx");
@@ -257,8 +256,8 @@ static void rx(struct net_device *dev, int bufnum,
                               soft->split_flag);
                        dev_kfree_skb_irq(in->skb);
                        in->skb = NULL;
-                       lp->stats.rx_errors++;
-                       lp->stats.rx_missed_errors++;
+                       dev->stats.rx_errors++;
+                       dev->stats.rx_missed_errors++;
                        in->lastpacket = in->numpackets = 0;
                }
                if (soft->split_flag & 1) {     /* first packet in split */
@@ -269,8 +268,8 @@ static void rx(struct net_device *dev, int bufnum,
                                       "(splitflag=%d, seq=%d)\n",
                                       in->sequence, soft->split_flag,
                                       soft->sequence);
-                               lp->stats.rx_errors++;
-                               lp->stats.rx_missed_errors++;
+                               dev->stats.rx_errors++;
+                               dev->stats.rx_missed_errors++;
                                dev_kfree_skb_irq(in->skb);
                        }
                        in->sequence = soft->sequence;
@@ -281,8 +280,8 @@ static void rx(struct net_device *dev, int bufnum,
                                BUGMSG(D_EXTRA, "incoming packet more than 16 segments; dropping. (splitflag=%d)\n",
                                       soft->split_flag);
                                lp->rfc1201.aborted_seq = soft->sequence;
-                               lp->stats.rx_errors++;
-                               lp->stats.rx_length_errors++;
+                               dev->stats.rx_errors++;
+                               dev->stats.rx_length_errors++;
                                return;
                        }
                        in->skb = skb = alloc_skb(508 * in->numpackets + ARC_HDR_SIZE,
@@ -290,7 +289,7 @@ static void rx(struct net_device *dev, int bufnum,
                        if (skb == NULL) {
                                BUGMSG(D_NORMAL, "(split) memory squeeze, dropping packet.\n");
                                lp->rfc1201.aborted_seq = soft->sequence;
-                               lp->stats.rx_dropped++;
+                               dev->stats.rx_dropped++;
                                return;
                        }
                        skb->dev = dev;
@@ -314,8 +313,8 @@ static void rx(struct net_device *dev, int bufnum,
                                               "first! (splitflag=%d, seq=%d, aborted=%d)\n",
                                        soft->split_flag, soft->sequence,
                                               lp->rfc1201.aborted_seq);
-                                       lp->stats.rx_errors++;
-                                       lp->stats.rx_missed_errors++;
+                                       dev->stats.rx_errors++;
+                                       dev->stats.rx_missed_errors++;
                                }
                                return;
                        }
@@ -325,8 +324,8 @@ static void rx(struct net_device *dev, int bufnum,
                                if (packetnum <= in->lastpacket - 1) {
                                        BUGMSG(D_EXTRA, "duplicate splitpacket ignored! (splitflag=%d)\n",
                                               soft->split_flag);
-                                       lp->stats.rx_errors++;
-                                       lp->stats.rx_frame_errors++;
+                                       dev->stats.rx_errors++;
+                                       dev->stats.rx_frame_errors++;
                                        return;
                                }
                                /* "bad" duplicate, kill reassembly */
@@ -336,8 +335,8 @@ static void rx(struct net_device *dev, int bufnum,
                                lp->rfc1201.aborted_seq = soft->sequence;
                                dev_kfree_skb_irq(in->skb);
                                in->skb = NULL;
-                               lp->stats.rx_errors++;
-                               lp->stats.rx_missed_errors++;
+                               dev->stats.rx_errors++;
+                               dev->stats.rx_missed_errors++;
                                in->lastpacket = in->numpackets = 0;
                                return;
                        }
@@ -404,8 +403,8 @@ static int build_header(struct sk_buff *skb, struct net_device *dev,
        default:
                BUGMSG(D_NORMAL, "RFC1201: I don't understand protocol %d (%Xh)\n",
                       type, type);
-               lp->stats.tx_errors++;
-               lp->stats.tx_aborted_errors++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_aborted_errors++;
                return 0;
        }
 
index 3ec20cc18b0cb397524f5108cd257086b48f871e..cc7708775da0c91e4e86a713a13ed17b781a1cc6 100644 (file)
@@ -298,7 +298,7 @@ poll_some_more:
                int more = 0;
 
                spin_lock_irq(&ep->rx_lock);
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
                wrl(ep, REG_INTEN, REG_INTEN_TX | REG_INTEN_RX);
                if (ep93xx_have_more_rx(ep)) {
                        wrl(ep, REG_INTEN, REG_INTEN_TX);
@@ -307,7 +307,7 @@ poll_some_more:
                }
                spin_unlock_irq(&ep->rx_lock);
 
-               if (more && netif_rx_reschedule(napi))
+               if (more && napi_reschedule(napi))
                        goto poll_some_more;
        }
 
@@ -415,9 +415,9 @@ static irqreturn_t ep93xx_irq(int irq, void *dev_id)
 
        if (status & REG_INTSTS_RX) {
                spin_lock(&ep->rx_lock);
-               if (likely(netif_rx_schedule_prep(&ep->napi))) {
+               if (likely(napi_schedule_prep(&ep->napi))) {
                        wrl(ep, REG_INTEN, REG_INTEN_TX);
-                       __netif_rx_schedule(&ep->napi);
+                       __napi_schedule(&ep->napi);
                }
                spin_unlock(&ep->rx_lock);
        }
index d15d8b79d8e5332891134ab5bb1424aa83b66388..54b52e5b1821bbcd196b3f2f70cea19c51a5ec37 100644 (file)
@@ -646,7 +646,7 @@ static const struct net_device_ops etherh_netdev_ops = {
        .ndo_get_stats          = ei_get_stats,
        .ndo_set_multicast_list = ei_set_multicast_list,
        .ndo_validate_addr      = eth_validate_addr,
-       .ndo_set_mac_address    = eth_set_mac_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
        .ndo_change_mtu         = eth_change_mtu,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller    = ei_poll,
index 5fce1d5c1a1a6cf273bc25b9983a10f620201df3..5fe17d5eaa5440a4ea81a3f439ba0bbd40603f13 100644 (file)
@@ -473,7 +473,7 @@ static void eth_rx_irq(void *pdev)
        printk(KERN_DEBUG "%s: eth_rx_irq\n", dev->name);
 #endif
        qmgr_disable_irq(port->plat->rxq);
-       netif_rx_schedule(&port->napi);
+       napi_schedule(&port->napi);
 }
 
 static int eth_poll(struct napi_struct *napi, int budget)
@@ -498,16 +498,16 @@ static int eth_poll(struct napi_struct *napi, int budget)
 
                if ((n = queue_get_desc(rxq, port, 0)) < 0) {
 #if DEBUG_RX
-                       printk(KERN_DEBUG "%s: eth_poll netif_rx_complete\n",
+                       printk(KERN_DEBUG "%s: eth_poll napi_complete\n",
                               dev->name);
 #endif
-                       netif_rx_complete(napi);
+                       napi_complete(napi);
                        qmgr_enable_irq(rxq);
                        if (!qmgr_stat_empty(rxq) &&
-                           netif_rx_reschedule(napi)) {
+                           napi_reschedule(napi)) {
 #if DEBUG_RX
                                printk(KERN_DEBUG "%s: eth_poll"
-                                      " netif_rx_reschedule successed\n",
+                                      " napi_reschedule successed\n",
                                       dev->name);
 #endif
                                qmgr_disable_irq(rxq);
@@ -1036,7 +1036,7 @@ static int eth_open(struct net_device *dev)
        }
        ports_open++;
        /* we may already have RX data, enables IRQ */
-       netif_rx_schedule(&port->napi);
+       napi_schedule(&port->napi);
        return 0;
 }
 
index 1cf2f949c0b4d3f60c75b63399a64aa39f9c5f3d..b39210cf4fb39fd3f16e6831ad8cf7e095f58e11 100644 (file)
@@ -1059,7 +1059,7 @@ ks8695_get_drvinfo(struct net_device *ndev, struct ethtool_drvinfo *info)
 {
        strlcpy(info->driver, MODULENAME, sizeof(info->driver));
        strlcpy(info->version, MODULEVERSION, sizeof(info->version));
-       strlcpy(info->bus_info, ndev->dev.parent->bus_id,
+       strlcpy(info->bus_info, dev_name(ndev->dev.parent),
                sizeof(info->bus_info));
 }
 
index 72ea6e378f8dda5dec528cdad250c23cd6ce6677..ced70799b898faa6006cacf9a31cf56cff2a99c6 100644 (file)
@@ -828,7 +828,6 @@ set_rx_mode(struct net_device *dev)
        struct net_local *lp = netdev_priv(dev);
        unsigned char mc_filter[8];              /* Multicast hash filter */
        unsigned long flags;
-       int i;
 
        if (dev->flags & IFF_PROMISC) {
                memset(mc_filter, 0xff, sizeof(mc_filter));
@@ -857,6 +856,7 @@ set_rx_mode(struct net_device *dev)
 
        spin_lock_irqsave (&lp->lock, flags);
        if (memcmp(mc_filter, lp->mc_filter, sizeof(mc_filter))) {
+               int i;
                int saved_bank = inw(ioaddr + CONFIG_0);
                /* Switch to bank 1 and set the multicast table. */
                outw((saved_bank & ~0x0C00) | 0x0480, ioaddr + CONFIG_0);
index c49550d507a0b4c9789a46fb275c0efdc00993eb..2bf63b4368e20abdeb844aece0845443454df838 100644 (file)
@@ -448,7 +448,7 @@ struct atl1e_adapter {
        /* All Descriptor memory */
        dma_addr_t      ring_dma;
        void            *ring_vir_addr;
-       int             ring_size;
+       u32             ring_size;
 
        struct atl1e_tx_ring tx_ring;
        struct atl1e_rx_ring rx_ring;
index bb9094d4cbc9014f2686033162cfde22fcc0d972..c758884728a53ee545879d61cc5b128de2bbe219 100644 (file)
@@ -1326,9 +1326,9 @@ static irqreturn_t atl1e_intr(int irq, void *data)
                        AT_WRITE_REG(hw, REG_IMR,
                                     IMR_NORMAL_MASK & ~ISR_RX_EVENT);
                        AT_WRITE_FLUSH(hw);
-                       if (likely(netif_rx_schedule_prep(
+                       if (likely(napi_schedule_prep(
                                   &adapter->napi)))
-                               __netif_rx_schedule(&adapter->napi);
+                               __napi_schedule(&adapter->napi);
                }
        } while (--max_ints > 0);
        /* re-enable Interrupt*/
@@ -1514,7 +1514,7 @@ static int atl1e_clean(struct napi_struct *napi, int budget)
        /* If no Tx and not enough Rx work done, exit the polling mode */
        if (work_done < budget) {
 quit_polling:
-               netif_rx_complete(napi);
+               napi_complete(napi);
                imr_data = AT_READ_REG(&adapter->hw, REG_IMR);
                AT_WRITE_REG(&adapter->hw, REG_IMR, imr_data | ISR_RX_EVENT);
                /* test debug */
index f72abb34b0cd5197389d2f07d880f5432a87679f..b3be59fd3fb594591b18c1c15ce495a9e07faea3 100644 (file)
@@ -41,7 +41,7 @@
 
 #define ATL1E_PARAM(x, desc) \
        static int __devinitdata x[ATL1E_MAX_NIC + 1] = ATL1E_PARAM_INIT; \
-       static int num_##x; \
+       static unsigned int num_##x; \
        module_param_array_named(x, x, int, &num_##x, 0); \
        MODULE_PARM_DESC(x, desc);
 
index c0ceee0d7c808ed4f4df1fdb12806239b37dad63..43fc1b2ca3cd62d70cfacaa14dbc54ca89eb4490 100644 (file)
  * Default Value: 100 (200us)
  */
 static int __devinitdata int_mod_timer[ATL1_MAX_NIC+1] = ATL1_PARAM_INIT;
-static int num_int_mod_timer;
+static unsigned int num_int_mod_timer;
 module_param_array_named(int_mod_timer, int_mod_timer, int,
        &num_int_mod_timer, 0);
 MODULE_PARM_DESC(int_mod_timer, "Interrupt moderator timer");
index bc394491b63bb45397bc15df3d058987c0bec0d6..9fe06c3f409731b429371fbe0166693ec958c5e8 100644 (file)
@@ -2854,7 +2854,7 @@ static void atl2_force_ps(struct atl2_hw *hw)
 #else
 #define ATL2_PARAM(X, desc) \
     static int __devinitdata X[ATL2_MAX_NIC+1] = ATL2_PARAM_INIT; \
-    static int num_##X = 0; \
+    static unsigned int num_##X; \
     module_param_array_named(X, X, int, &num_##X, 0); \
     MODULE_PARM_DESC(X, desc);
 #endif
index 9c875bb3f76c642f93203f9096942af72a0e3e53..4274e4ac963b10467e2a683d343d7f00720794aa 100644 (file)
@@ -81,24 +81,6 @@ MODULE_AUTHOR(DRV_AUTHOR);
 MODULE_DESCRIPTION(DRV_DESC);
 MODULE_LICENSE("GPL");
 
-// prototypes
-static void hard_stop(struct net_device *);
-static void enable_rx_tx(struct net_device *dev);
-static struct net_device * au1000_probe(int port_num);
-static int au1000_init(struct net_device *);
-static int au1000_open(struct net_device *);
-static int au1000_close(struct net_device *);
-static int au1000_tx(struct sk_buff *, struct net_device *);
-static int au1000_rx(struct net_device *);
-static irqreturn_t au1000_interrupt(int, void *);
-static void au1000_tx_timeout(struct net_device *);
-static void set_rx_mode(struct net_device *);
-static int au1000_ioctl(struct net_device *, struct ifreq *, int);
-static int au1000_mdio_read(struct net_device *, int, int);
-static void au1000_mdio_write(struct net_device *, int, int, u16);
-static void au1000_adjust_link(struct net_device *);
-static void enable_mac(struct net_device *, int);
-
 /*
  * Theory of operation
  *
@@ -188,6 +170,26 @@ struct au1000_private *au_macs[NUM_ETH_INTERFACES];
 # error MAC0-associated PHY attached 2nd MACs MII bus not supported yet
 #endif
 
+static void enable_mac(struct net_device *dev, int force_reset)
+{
+       unsigned long flags;
+       struct au1000_private *aup = netdev_priv(dev);
+
+       spin_lock_irqsave(&aup->lock, flags);
+
+       if(force_reset || (!aup->mac_enabled)) {
+               *aup->enable = MAC_EN_CLOCK_ENABLE;
+               au_sync_delay(2);
+               *aup->enable = (MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2
+                               | MAC_EN_CLOCK_ENABLE);
+               au_sync_delay(2);
+
+               aup->mac_enabled = 1;
+       }
+
+       spin_unlock_irqrestore(&aup->lock, flags);
+}
+
 /*
  * MII operations
  */
@@ -281,6 +283,107 @@ static int au1000_mdiobus_reset(struct mii_bus *bus)
        return 0;
 }
 
+static void hard_stop(struct net_device *dev)
+{
+       struct au1000_private *aup = netdev_priv(dev);
+
+       if (au1000_debug > 4)
+               printk(KERN_INFO "%s: hard stop\n", dev->name);
+
+       aup->mac->control &= ~(MAC_RX_ENABLE | MAC_TX_ENABLE);
+       au_sync_delay(10);
+}
+
+static void enable_rx_tx(struct net_device *dev)
+{
+       struct au1000_private *aup = netdev_priv(dev);
+
+       if (au1000_debug > 4)
+               printk(KERN_INFO "%s: enable_rx_tx\n", dev->name);
+
+       aup->mac->control |= (MAC_RX_ENABLE | MAC_TX_ENABLE);
+       au_sync_delay(10);
+}
+
+static void
+au1000_adjust_link(struct net_device *dev)
+{
+       struct au1000_private *aup = netdev_priv(dev);
+       struct phy_device *phydev = aup->phy_dev;
+       unsigned long flags;
+
+       int status_change = 0;
+
+       BUG_ON(!aup->phy_dev);
+
+       spin_lock_irqsave(&aup->lock, flags);
+
+       if (phydev->link && (aup->old_speed != phydev->speed)) {
+               // speed changed
+
+               switch(phydev->speed) {
+               case SPEED_10:
+               case SPEED_100:
+                       break;
+               default:
+                       printk(KERN_WARNING
+                              "%s: Speed (%d) is not 10/100 ???\n",
+                              dev->name, phydev->speed);
+                       break;
+               }
+
+               aup->old_speed = phydev->speed;
+
+               status_change = 1;
+       }
+
+       if (phydev->link && (aup->old_duplex != phydev->duplex)) {
+               // duplex mode changed
+
+               /* switching duplex mode requires to disable rx and tx! */
+               hard_stop(dev);
+
+               if (DUPLEX_FULL == phydev->duplex)
+                       aup->mac->control = ((aup->mac->control
+                                            | MAC_FULL_DUPLEX)
+                                            & ~MAC_DISABLE_RX_OWN);
+               else
+                       aup->mac->control = ((aup->mac->control
+                                             & ~MAC_FULL_DUPLEX)
+                                            | MAC_DISABLE_RX_OWN);
+               au_sync_delay(1);
+
+               enable_rx_tx(dev);
+               aup->old_duplex = phydev->duplex;
+
+               status_change = 1;
+       }
+
+       if(phydev->link != aup->old_link) {
+               // link state changed
+
+               if (!phydev->link) {
+                       /* link went down */
+                       aup->old_speed = 0;
+                       aup->old_duplex = -1;
+               }
+
+               aup->old_link = phydev->link;
+               status_change = 1;
+       }
+
+       spin_unlock_irqrestore(&aup->lock, flags);
+
+       if (status_change) {
+               if (phydev->link)
+                       printk(KERN_INFO "%s: link up (%d/%s)\n",
+                              dev->name, phydev->speed,
+                              DUPLEX_FULL == phydev->duplex ? "Full" : "Half");
+               else
+                       printk(KERN_INFO "%s: link down\n", dev->name);
+       }
+}
+
 static int mii_probe (struct net_device *dev)
 {
        struct au1000_private *const aup = netdev_priv(dev);
@@ -355,8 +458,8 @@ static int mii_probe (struct net_device *dev)
        /* now we are supposed to have a proper phydev, to attach to... */
        BUG_ON(phydev->attached_dev);
 
-       phydev = phy_connect(dev, phydev->dev.bus_id, &au1000_adjust_link, 0,
-                       PHY_INTERFACE_MODE_MII);
+       phydev = phy_connect(dev, dev_name(&phydev->dev), &au1000_adjust_link,
+                       0, PHY_INTERFACE_MODE_MII);
 
        if (IS_ERR(phydev)) {
                printk(KERN_ERR "%s: Could not attach to PHY\n", dev->name);
@@ -381,8 +484,8 @@ static int mii_probe (struct net_device *dev)
        aup->phy_dev = phydev;
 
        printk(KERN_INFO "%s: attached PHY driver [%s] "
-              "(mii_bus:phy_addr=%s, irq=%d)\n",
-              dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
+              "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
+              phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
 
        return 0;
 }
@@ -412,48 +515,6 @@ void ReleaseDB(struct au1000_private *aup, db_dest_t *pDB)
        aup->pDBfree = pDB;
 }
 
-static void enable_rx_tx(struct net_device *dev)
-{
-       struct au1000_private *aup = netdev_priv(dev);
-
-       if (au1000_debug > 4)
-               printk(KERN_INFO "%s: enable_rx_tx\n", dev->name);
-
-       aup->mac->control |= (MAC_RX_ENABLE | MAC_TX_ENABLE);
-       au_sync_delay(10);
-}
-
-static void hard_stop(struct net_device *dev)
-{
-       struct au1000_private *aup = netdev_priv(dev);
-
-       if (au1000_debug > 4)
-               printk(KERN_INFO "%s: hard stop\n", dev->name);
-
-       aup->mac->control &= ~(MAC_RX_ENABLE | MAC_TX_ENABLE);
-       au_sync_delay(10);
-}
-
-static void enable_mac(struct net_device *dev, int force_reset)
-{
-       unsigned long flags;
-       struct au1000_private *aup = netdev_priv(dev);
-
-       spin_lock_irqsave(&aup->lock, flags);
-
-       if(force_reset || (!aup->mac_enabled)) {
-               *aup->enable = MAC_EN_CLOCK_ENABLE;
-               au_sync_delay(2);
-               *aup->enable = (MAC_EN_RESET0 | MAC_EN_RESET1 | MAC_EN_RESET2
-                               | MAC_EN_CLOCK_ENABLE);
-               au_sync_delay(2);
-
-               aup->mac_enabled = 1;
-       }
-
-       spin_unlock_irqrestore(&aup->lock, flags);
-}
-
 static void reset_mac_unlocked(struct net_device *dev)
 {
        struct au1000_private *const aup = netdev_priv(dev);
@@ -541,30 +602,6 @@ static struct {
 
 static int num_ifs;
 
-/*
- * Setup the base address and interrupt of the Au1xxx ethernet macs
- * based on cpu type and whether the interface is enabled in sys_pinfunc
- * register. The last interface is enabled if SYS_PF_NI2 (bit 4) is 0.
- */
-static int __init au1000_init_module(void)
-{
-       int ni = (int)((au_readl(SYS_PINFUNC) & (u32)(SYS_PF_NI2)) >> 4);
-       struct net_device *dev;
-       int i, found_one = 0;
-
-       num_ifs = NUM_ETH_INTERFACES - ni;
-
-       for(i = 0; i < num_ifs; i++) {
-               dev = au1000_probe(i);
-               iflist[i].dev = dev;
-               if (dev)
-                       found_one++;
-       }
-       if (!found_one)
-               return -ENODEV;
-       return 0;
-}
-
 /*
  * ethtool operations
  */
@@ -611,336 +648,230 @@ static const struct ethtool_ops au1000_ethtool_ops = {
        .get_link = ethtool_op_get_link,
 };
 
-static struct net_device * au1000_probe(int port_num)
+
+/*
+ * Initialize the interface.
+ *
+ * When the device powers up, the clocks are disabled and the
+ * mac is in reset state.  When the interface is closed, we
+ * do the same -- reset the device and disable the clocks to
+ * conserve power. Thus, whenever au1000_init() is called,
+ * the device should already be in reset state.
+ */
+static int au1000_init(struct net_device *dev)
 {
-       static unsigned version_printed = 0;
-       struct au1000_private *aup = NULL;
-       struct net_device *dev = NULL;
-       db_dest_t *pDB, *pDBfree;
-       char ethaddr[6];
-       int irq, i, err;
-       u32 base, macen;
+       struct au1000_private *aup = netdev_priv(dev);
+       unsigned long flags;
+       int i;
+       u32 control;
 
-       if (port_num >= NUM_ETH_INTERFACES)
-               return NULL;
+       if (au1000_debug > 4)
+               printk("%s: au1000_init\n", dev->name);
 
-       base  = CPHYSADDR(iflist[port_num].base_addr );
-       macen = CPHYSADDR(iflist[port_num].macen_addr);
-       irq = iflist[port_num].irq;
+       /* bring the device out of reset */
+       enable_mac(dev, 1);
 
-       if (!request_mem_region( base, MAC_IOSIZE, "Au1x00 ENET") ||
-           !request_mem_region(macen, 4, "Au1x00 ENET"))
-               return NULL;
+       spin_lock_irqsave(&aup->lock, flags);
 
-       if (version_printed++ == 0)
-               printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR);
+       aup->mac->control = 0;
+       aup->tx_head = (aup->tx_dma_ring[0]->buff_stat & 0xC) >> 2;
+       aup->tx_tail = aup->tx_head;
+       aup->rx_head = (aup->rx_dma_ring[0]->buff_stat & 0xC) >> 2;
 
-       dev = alloc_etherdev(sizeof(struct au1000_private));
-       if (!dev) {
-               printk(KERN_ERR "%s: alloc_etherdev failed\n", DRV_NAME);
-               return NULL;
+       aup->mac->mac_addr_high = dev->dev_addr[5]<<8 | dev->dev_addr[4];
+       aup->mac->mac_addr_low = dev->dev_addr[3]<<24 | dev->dev_addr[2]<<16 |
+               dev->dev_addr[1]<<8 | dev->dev_addr[0];
+
+       for (i = 0; i < NUM_RX_DMA; i++) {
+               aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE;
        }
+       au_sync();
 
-       if ((err = register_netdev(dev)) != 0) {
-               printk(KERN_ERR "%s: Cannot register net device, error %d\n",
-                               DRV_NAME, err);
-               free_netdev(dev);
-               return NULL;
+       control = MAC_RX_ENABLE | MAC_TX_ENABLE;
+#ifndef CONFIG_CPU_LITTLE_ENDIAN
+       control |= MAC_BIG_ENDIAN;
+#endif
+       if (aup->phy_dev) {
+               if (aup->phy_dev->link && (DUPLEX_FULL == aup->phy_dev->duplex))
+                       control |= MAC_FULL_DUPLEX;
+               else
+                       control |= MAC_DISABLE_RX_OWN;
+       } else { /* PHY-less op, assume full-duplex */
+               control |= MAC_FULL_DUPLEX;
        }
 
-       printk("%s: Au1xx0 Ethernet found at 0x%x, irq %d\n",
-               dev->name, base, irq);
-
-       aup = netdev_priv(dev);
-
-       spin_lock_init(&aup->lock);
-
-       /* Allocate the data buffers */
-       /* Snooping works fine with eth on all au1xxx */
-       aup->vaddr = (u32)dma_alloc_noncoherent(NULL, MAX_BUF_SIZE *
-                                               (NUM_TX_BUFFS + NUM_RX_BUFFS),
-                                               &aup->dma_addr, 0);
-       if (!aup->vaddr) {
-               free_netdev(dev);
-               release_mem_region( base, MAC_IOSIZE);
-               release_mem_region(macen, 4);
-               return NULL;
-       }
-
-       /* aup->mac is the base address of the MAC's registers */
-       aup->mac = (volatile mac_reg_t *)iflist[port_num].base_addr;
-
-       /* Setup some variables for quick register address access */
-       aup->enable = (volatile u32 *)iflist[port_num].macen_addr;
-       aup->mac_id = port_num;
-       au_macs[port_num] = aup;
-
-       if (port_num == 0) {
-               if (prom_get_ethernet_addr(ethaddr) == 0)
-                       memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
-               else {
-                       printk(KERN_INFO "%s: No MAC address found\n",
-                                        dev->name);
-                               /* Use the hard coded MAC addresses */
-               }
-
-               setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
-       } else if (port_num == 1)
-               setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
-
-       /*
-        * Assign to the Ethernet ports two consecutive MAC addresses
-        * to match those that are printed on their stickers
-        */
-       memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
-       dev->dev_addr[5] += port_num;
-
-       *aup->enable = 0;
-       aup->mac_enabled = 0;
-
-       aup->mii_bus = mdiobus_alloc();
-       if (aup->mii_bus == NULL)
-               goto err_out;
-
-       aup->mii_bus->priv = dev;
-       aup->mii_bus->read = au1000_mdiobus_read;
-       aup->mii_bus->write = au1000_mdiobus_write;
-       aup->mii_bus->reset = au1000_mdiobus_reset;
-       aup->mii_bus->name = "au1000_eth_mii";
-       snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id);
-       aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
-       for(i = 0; i < PHY_MAX_ADDR; ++i)
-               aup->mii_bus->irq[i] = PHY_POLL;
-
-       /* if known, set corresponding PHY IRQs */
-#if defined(AU1XXX_PHY_STATIC_CONFIG)
-# if defined(AU1XXX_PHY0_IRQ)
-       if (AU1XXX_PHY0_BUSID == aup->mac_id)
-               aup->mii_bus->irq[AU1XXX_PHY0_ADDR] = AU1XXX_PHY0_IRQ;
-# endif
-# if defined(AU1XXX_PHY1_IRQ)
-       if (AU1XXX_PHY1_BUSID == aup->mac_id)
-               aup->mii_bus->irq[AU1XXX_PHY1_ADDR] = AU1XXX_PHY1_IRQ;
-# endif
-#endif
-       mdiobus_register(aup->mii_bus);
-
-       if (mii_probe(dev) != 0) {
-               goto err_out;
-       }
-
-       pDBfree = NULL;
-       /* setup the data buffer descriptors and attach a buffer to each one */
-       pDB = aup->db;
-       for (i = 0; i < (NUM_TX_BUFFS+NUM_RX_BUFFS); i++) {
-               pDB->pnext = pDBfree;
-               pDBfree = pDB;
-               pDB->vaddr = (u32 *)((unsigned)aup->vaddr + MAX_BUF_SIZE*i);
-               pDB->dma_addr = (dma_addr_t)virt_to_bus(pDB->vaddr);
-               pDB++;
-       }
-       aup->pDBfree = pDBfree;
-
-       for (i = 0; i < NUM_RX_DMA; i++) {
-               pDB = GetFreeDB(aup);
-               if (!pDB) {
-                       goto err_out;
-               }
-               aup->rx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr;
-               aup->rx_db_inuse[i] = pDB;
-       }
-       for (i = 0; i < NUM_TX_DMA; i++) {
-               pDB = GetFreeDB(aup);
-               if (!pDB) {
-                       goto err_out;
-               }
-               aup->tx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr;
-               aup->tx_dma_ring[i]->len = 0;
-               aup->tx_db_inuse[i] = pDB;
-       }
+       aup->mac->control = control;
+       aup->mac->vlan1_tag = 0x8100; /* activate vlan support */
+       au_sync();
 
-       dev->base_addr = base;
-       dev->irq = irq;
-       dev->open = au1000_open;
-       dev->hard_start_xmit = au1000_tx;
-       dev->stop = au1000_close;
-       dev->set_multicast_list = &set_rx_mode;
-       dev->do_ioctl = &au1000_ioctl;
-       SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
-       dev->tx_timeout = au1000_tx_timeout;
-       dev->watchdog_timeo = ETH_TX_TIMEOUT;
+       spin_unlock_irqrestore(&aup->lock, flags);
+       return 0;
+}
 
-       /*
-        * The boot code uses the ethernet controller, so reset it to start
-        * fresh.  au1000_init() expects that the device is in reset state.
-        */
-       reset_mac(dev);
+static inline void update_rx_stats(struct net_device *dev, u32 status)
+{
+       struct au1000_private *aup = netdev_priv(dev);
+       struct net_device_stats *ps = &dev->stats;
 
-       return dev;
+       ps->rx_packets++;
+       if (status & RX_MCAST_FRAME)
+               ps->multicast++;
 
-err_out:
-       if (aup->mii_bus != NULL) {
-               mdiobus_unregister(aup->mii_bus);
-               mdiobus_free(aup->mii_bus);
+       if (status & RX_ERROR) {
+               ps->rx_errors++;
+               if (status & RX_MISSED_FRAME)
+                       ps->rx_missed_errors++;
+               if (status & (RX_OVERLEN | RX_OVERLEN | RX_LEN_ERROR))
+                       ps->rx_length_errors++;
+               if (status & RX_CRC_ERROR)
+                       ps->rx_crc_errors++;
+               if (status & RX_COLL)
+                       ps->collisions++;
        }
+       else
+               ps->rx_bytes += status & RX_FRAME_LEN_MASK;
 
-       /* here we should have a valid dev plus aup-> register addresses
-        * so we can reset the mac properly.*/
-       reset_mac(dev);
-
-       for (i = 0; i < NUM_RX_DMA; i++) {
-               if (aup->rx_db_inuse[i])
-                       ReleaseDB(aup, aup->rx_db_inuse[i]);
-       }
-       for (i = 0; i < NUM_TX_DMA; i++) {
-               if (aup->tx_db_inuse[i])
-                       ReleaseDB(aup, aup->tx_db_inuse[i]);
-       }
-       dma_free_noncoherent(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
-                            (void *)aup->vaddr, aup->dma_addr);
-       unregister_netdev(dev);
-       free_netdev(dev);
-       release_mem_region( base, MAC_IOSIZE);
-       release_mem_region(macen, 4);
-       return NULL;
 }
 
 /*
- * Initialize the interface.
- *
- * When the device powers up, the clocks are disabled and the
- * mac is in reset state.  When the interface is closed, we
- * do the same -- reset the device and disable the clocks to
- * conserve power. Thus, whenever au1000_init() is called,
- * the device should already be in reset state.
+ * Au1000 receive routine.
  */
-static int au1000_init(struct net_device *dev)
+static int au1000_rx(struct net_device *dev)
 {
        struct au1000_private *aup = netdev_priv(dev);
-       unsigned long flags;
-       int i;
-       u32 control;
-
-       if (au1000_debug > 4)
-               printk("%s: au1000_init\n", dev->name);
-
-       /* bring the device out of reset */
-       enable_mac(dev, 1);
-
-       spin_lock_irqsave(&aup->lock, flags);
+       struct sk_buff *skb;
+       volatile rx_dma_t *prxd;
+       u32 buff_stat, status;
+       db_dest_t *pDB;
+       u32     frmlen;
 
-       aup->mac->control = 0;
-       aup->tx_head = (aup->tx_dma_ring[0]->buff_stat & 0xC) >> 2;
-       aup->tx_tail = aup->tx_head;
-       aup->rx_head = (aup->rx_dma_ring[0]->buff_stat & 0xC) >> 2;
+       if (au1000_debug > 5)
+               printk("%s: au1000_rx head %d\n", dev->name, aup->rx_head);
 
-       aup->mac->mac_addr_high = dev->dev_addr[5]<<8 | dev->dev_addr[4];
-       aup->mac->mac_addr_low = dev->dev_addr[3]<<24 | dev->dev_addr[2]<<16 |
-               dev->dev_addr[1]<<8 | dev->dev_addr[0];
+       prxd = aup->rx_dma_ring[aup->rx_head];
+       buff_stat = prxd->buff_stat;
+       while (buff_stat & RX_T_DONE)  {
+               status = prxd->status;
+               pDB = aup->rx_db_inuse[aup->rx_head];
+               update_rx_stats(dev, status);
+               if (!(status & RX_ERROR))  {
 
-       for (i = 0; i < NUM_RX_DMA; i++) {
-               aup->rx_dma_ring[i]->buff_stat |= RX_DMA_ENABLE;
-       }
-       au_sync();
+                       /* good frame */
+                       frmlen = (status & RX_FRAME_LEN_MASK);
+                       frmlen -= 4; /* Remove FCS */
+                       skb = dev_alloc_skb(frmlen + 2);
+                       if (skb == NULL) {
+                               printk(KERN_ERR
+                                      "%s: Memory squeeze, dropping packet.\n",
+                                      dev->name);
+                               dev->stats.rx_dropped++;
+                               continue;
+                       }
+                       skb_reserve(skb, 2);    /* 16 byte IP header align */
+                       skb_copy_to_linear_data(skb,
+                               (unsigned char *)pDB->vaddr, frmlen);
+                       skb_put(skb, frmlen);
+                       skb->protocol = eth_type_trans(skb, dev);
+                       netif_rx(skb);  /* pass the packet to upper layers */
+               }
+               else {
+                       if (au1000_debug > 4) {
+                               if (status & RX_MISSED_FRAME)
+                                       printk("rx miss\n");
+                               if (status & RX_WDOG_TIMER)
+                                       printk("rx wdog\n");
+                               if (status & RX_RUNT)
+                                       printk("rx runt\n");
+                               if (status & RX_OVERLEN)
+                                       printk("rx overlen\n");
+                               if (status & RX_COLL)
+                                       printk("rx coll\n");
+                               if (status & RX_MII_ERROR)
+                                       printk("rx mii error\n");
+                               if (status & RX_CRC_ERROR)
+                                       printk("rx crc error\n");
+                               if (status & RX_LEN_ERROR)
+                                       printk("rx len error\n");
+                               if (status & RX_U_CNTRL_FRAME)
+                                       printk("rx u control frame\n");
+                               if (status & RX_MISSED_FRAME)
+                                       printk("rx miss\n");
+                       }
+               }
+               prxd->buff_stat = (u32)(pDB->dma_addr | RX_DMA_ENABLE);
+               aup->rx_head = (aup->rx_head + 1) & (NUM_RX_DMA - 1);
+               au_sync();
 
-       control = MAC_RX_ENABLE | MAC_TX_ENABLE;
-#ifndef CONFIG_CPU_LITTLE_ENDIAN
-       control |= MAC_BIG_ENDIAN;
-#endif
-       if (aup->phy_dev) {
-               if (aup->phy_dev->link && (DUPLEX_FULL == aup->phy_dev->duplex))
-                       control |= MAC_FULL_DUPLEX;
-               else
-                       control |= MAC_DISABLE_RX_OWN;
-       } else { /* PHY-less op, assume full-duplex */
-               control |= MAC_FULL_DUPLEX;
+               /* next descriptor */
+               prxd = aup->rx_dma_ring[aup->rx_head];
+               buff_stat = prxd->buff_stat;
        }
-
-       aup->mac->control = control;
-       aup->mac->vlan1_tag = 0x8100; /* activate vlan support */
-       au_sync();
-
-       spin_unlock_irqrestore(&aup->lock, flags);
        return 0;
 }
 
-static void
-au1000_adjust_link(struct net_device *dev)
+static void update_tx_stats(struct net_device *dev, u32 status)
 {
        struct au1000_private *aup = netdev_priv(dev);
-       struct phy_device *phydev = aup->phy_dev;
-       unsigned long flags;
-
-       int status_change = 0;
-
-       BUG_ON(!aup->phy_dev);
-
-       spin_lock_irqsave(&aup->lock, flags);
-
-       if (phydev->link && (aup->old_speed != phydev->speed)) {
-               // speed changed
+       struct net_device_stats *ps = &dev->stats;
 
-               switch(phydev->speed) {
-               case SPEED_10:
-               case SPEED_100:
-                       break;
-               default:
-                       printk(KERN_WARNING
-                              "%s: Speed (%d) is not 10/100 ???\n",
-                              dev->name, phydev->speed);
-                       break;
+       if (status & TX_FRAME_ABORTED) {
+               if (!aup->phy_dev || (DUPLEX_FULL == aup->phy_dev->duplex)) {
+                       if (status & (TX_JAB_TIMEOUT | TX_UNDERRUN)) {
+                               /* any other tx errors are only valid
+                                * in half duplex mode */
+                               ps->tx_errors++;
+                               ps->tx_aborted_errors++;
+                       }
                }
+               else {
+                       ps->tx_errors++;
+                       ps->tx_aborted_errors++;
+                       if (status & (TX_NO_CARRIER | TX_LOSS_CARRIER))
+                               ps->tx_carrier_errors++;
+               }
+       }
+}
 
-               aup->old_speed = phydev->speed;
-
-               status_change = 1;
-       }
-
-       if (phydev->link && (aup->old_duplex != phydev->duplex)) {
-               // duplex mode changed
-
-               /* switching duplex mode requires to disable rx and tx! */
-               hard_stop(dev);
-
-               if (DUPLEX_FULL == phydev->duplex)
-                       aup->mac->control = ((aup->mac->control
-                                            | MAC_FULL_DUPLEX)
-                                            & ~MAC_DISABLE_RX_OWN);
-               else
-                       aup->mac->control = ((aup->mac->control
-                                             & ~MAC_FULL_DUPLEX)
-                                            | MAC_DISABLE_RX_OWN);
-               au_sync_delay(1);
-
-               enable_rx_tx(dev);
-               aup->old_duplex = phydev->duplex;
+/*
+ * Called from the interrupt service routine to acknowledge
+ * the TX DONE bits.  This is a must if the irq is setup as
+ * edge triggered.
+ */
+static void au1000_tx_ack(struct net_device *dev)
+{
+       struct au1000_private *aup = netdev_priv(dev);
+       volatile tx_dma_t *ptxd;
 
-               status_change = 1;
-       }
+       ptxd = aup->tx_dma_ring[aup->tx_tail];
 
-       if(phydev->link != aup->old_link) {
-               // link state changed
+       while (ptxd->buff_stat & TX_T_DONE) {
+               update_tx_stats(dev, ptxd->status);
+               ptxd->buff_stat &= ~TX_T_DONE;
+               ptxd->len = 0;
+               au_sync();
 
-               if (!phydev->link) {
-                       /* link went down */
-                       aup->old_speed = 0;
-                       aup->old_duplex = -1;
-               }
+               aup->tx_tail = (aup->tx_tail + 1) & (NUM_TX_DMA - 1);
+               ptxd = aup->tx_dma_ring[aup->tx_tail];
 
-               aup->old_link = phydev->link;
-               status_change = 1;
+               if (aup->tx_full) {
+                       aup->tx_full = 0;
+                       netif_wake_queue(dev);
+               }
        }
+}
 
-       spin_unlock_irqrestore(&aup->lock, flags);
+/*
+ * Au1000 interrupt service routine.
+ */
+static irqreturn_t au1000_interrupt(int irq, void *dev_id)
+{
+       struct net_device *dev = dev_id;
 
-       if (status_change) {
-               if (phydev->link)
-                       printk(KERN_INFO "%s: link up (%d/%s)\n",
-                              dev->name, phydev->speed,
-                              DUPLEX_FULL == phydev->duplex ? "Full" : "Half");
-               else
-                       printk(KERN_INFO "%s: link down\n", dev->name);
-       }
+       /* Handle RX interrupts first to minimize chance of overrun */
+
+       au1000_rx(dev);
+       au1000_tx_ack(dev);
+       return IRQ_RETVAL(1);
 }
 
 static int au1000_open(struct net_device *dev)
@@ -1003,88 +934,6 @@ static int au1000_close(struct net_device *dev)
        return 0;
 }
 
-static void __exit au1000_cleanup_module(void)
-{
-       int i, j;
-       struct net_device *dev;
-       struct au1000_private *aup;
-
-       for (i = 0; i < num_ifs; i++) {
-               dev = iflist[i].dev;
-               if (dev) {
-                       aup = netdev_priv(dev);
-                       unregister_netdev(dev);
-                       mdiobus_unregister(aup->mii_bus);
-                       mdiobus_free(aup->mii_bus);
-                       for (j = 0; j < NUM_RX_DMA; j++)
-                               if (aup->rx_db_inuse[j])
-                                       ReleaseDB(aup, aup->rx_db_inuse[j]);
-                       for (j = 0; j < NUM_TX_DMA; j++)
-                               if (aup->tx_db_inuse[j])
-                                       ReleaseDB(aup, aup->tx_db_inuse[j]);
-                       dma_free_noncoherent(NULL, MAX_BUF_SIZE *
-                                            (NUM_TX_BUFFS + NUM_RX_BUFFS),
-                                            (void *)aup->vaddr, aup->dma_addr);
-                       release_mem_region(dev->base_addr, MAC_IOSIZE);
-                       release_mem_region(CPHYSADDR(iflist[i].macen_addr), 4);
-                       free_netdev(dev);
-               }
-       }
-}
-
-static void update_tx_stats(struct net_device *dev, u32 status)
-{
-       struct au1000_private *aup = netdev_priv(dev);
-       struct net_device_stats *ps = &dev->stats;
-
-       if (status & TX_FRAME_ABORTED) {
-               if (!aup->phy_dev || (DUPLEX_FULL == aup->phy_dev->duplex)) {
-                       if (status & (TX_JAB_TIMEOUT | TX_UNDERRUN)) {
-                               /* any other tx errors are only valid
-                                * in half duplex mode */
-                               ps->tx_errors++;
-                               ps->tx_aborted_errors++;
-                       }
-               }
-               else {
-                       ps->tx_errors++;
-                       ps->tx_aborted_errors++;
-                       if (status & (TX_NO_CARRIER | TX_LOSS_CARRIER))
-                               ps->tx_carrier_errors++;
-               }
-       }
-}
-
-
-/*
- * Called from the interrupt service routine to acknowledge
- * the TX DONE bits.  This is a must if the irq is setup as
- * edge triggered.
- */
-static void au1000_tx_ack(struct net_device *dev)
-{
-       struct au1000_private *aup = netdev_priv(dev);
-       volatile tx_dma_t *ptxd;
-
-       ptxd = aup->tx_dma_ring[aup->tx_tail];
-
-       while (ptxd->buff_stat & TX_T_DONE) {
-               update_tx_stats(dev, ptxd->status);
-               ptxd->buff_stat &= ~TX_T_DONE;
-               ptxd->len = 0;
-               au_sync();
-
-               aup->tx_tail = (aup->tx_tail + 1) & (NUM_TX_DMA - 1);
-               ptxd = aup->tx_dma_ring[aup->tx_tail];
-
-               if (aup->tx_full) {
-                       aup->tx_full = 0;
-                       netif_wake_queue(dev);
-               }
-       }
-}
-
-
 /*
  * Au1000 transmit routine.
  */
@@ -1129,136 +978,19 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
                ptxd->len = ETH_ZLEN;
        }
        else
-               ptxd->len = skb->len;
-
-       ps->tx_packets++;
-       ps->tx_bytes += ptxd->len;
-
-       ptxd->buff_stat = pDB->dma_addr | TX_DMA_ENABLE;
-       au_sync();
-       dev_kfree_skb(skb);
-       aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1);
-       dev->trans_start = jiffies;
-       return 0;
-}
-
-static inline void update_rx_stats(struct net_device *dev, u32 status)
-{
-       struct au1000_private *aup = netdev_priv(dev);
-       struct net_device_stats *ps = &dev->stats;
-
-       ps->rx_packets++;
-       if (status & RX_MCAST_FRAME)
-               ps->multicast++;
-
-       if (status & RX_ERROR) {
-               ps->rx_errors++;
-               if (status & RX_MISSED_FRAME)
-                       ps->rx_missed_errors++;
-               if (status & (RX_OVERLEN | RX_OVERLEN | RX_LEN_ERROR))
-                       ps->rx_length_errors++;
-               if (status & RX_CRC_ERROR)
-                       ps->rx_crc_errors++;
-               if (status & RX_COLL)
-                       ps->collisions++;
-       }
-       else
-               ps->rx_bytes += status & RX_FRAME_LEN_MASK;
-
-}
-
-/*
- * Au1000 receive routine.
- */
-static int au1000_rx(struct net_device *dev)
-{
-       struct au1000_private *aup = netdev_priv(dev);
-       struct sk_buff *skb;
-       volatile rx_dma_t *prxd;
-       u32 buff_stat, status;
-       db_dest_t *pDB;
-       u32     frmlen;
-
-       if (au1000_debug > 5)
-               printk("%s: au1000_rx head %d\n", dev->name, aup->rx_head);
-
-       prxd = aup->rx_dma_ring[aup->rx_head];
-       buff_stat = prxd->buff_stat;
-       while (buff_stat & RX_T_DONE)  {
-               status = prxd->status;
-               pDB = aup->rx_db_inuse[aup->rx_head];
-               update_rx_stats(dev, status);
-               if (!(status & RX_ERROR))  {
-
-                       /* good frame */
-                       frmlen = (status & RX_FRAME_LEN_MASK);
-                       frmlen -= 4; /* Remove FCS */
-                       skb = dev_alloc_skb(frmlen + 2);
-                       if (skb == NULL) {
-                               printk(KERN_ERR
-                                      "%s: Memory squeeze, dropping packet.\n",
-                                      dev->name);
-                               dev->stats.rx_dropped++;
-                               continue;
-                       }
-                       skb_reserve(skb, 2);    /* 16 byte IP header align */
-                       skb_copy_to_linear_data(skb,
-                               (unsigned char *)pDB->vaddr, frmlen);
-                       skb_put(skb, frmlen);
-                       skb->protocol = eth_type_trans(skb, dev);
-                       netif_rx(skb);  /* pass the packet to upper layers */
-               }
-               else {
-                       if (au1000_debug > 4) {
-                               if (status & RX_MISSED_FRAME)
-                                       printk("rx miss\n");
-                               if (status & RX_WDOG_TIMER)
-                                       printk("rx wdog\n");
-                               if (status & RX_RUNT)
-                                       printk("rx runt\n");
-                               if (status & RX_OVERLEN)
-                                       printk("rx overlen\n");
-                               if (status & RX_COLL)
-                                       printk("rx coll\n");
-                               if (status & RX_MII_ERROR)
-                                       printk("rx mii error\n");
-                               if (status & RX_CRC_ERROR)
-                                       printk("rx crc error\n");
-                               if (status & RX_LEN_ERROR)
-                                       printk("rx len error\n");
-                               if (status & RX_U_CNTRL_FRAME)
-                                       printk("rx u control frame\n");
-                               if (status & RX_MISSED_FRAME)
-                                       printk("rx miss\n");
-                       }
-               }
-               prxd->buff_stat = (u32)(pDB->dma_addr | RX_DMA_ENABLE);
-               aup->rx_head = (aup->rx_head + 1) & (NUM_RX_DMA - 1);
-               au_sync();
-
-               /* next descriptor */
-               prxd = aup->rx_dma_ring[aup->rx_head];
-               buff_stat = prxd->buff_stat;
-       }
-       return 0;
-}
-
-
-/*
- * Au1000 interrupt service routine.
- */
-static irqreturn_t au1000_interrupt(int irq, void *dev_id)
-{
-       struct net_device *dev = dev_id;
+               ptxd->len = skb->len;
 
-       /* Handle RX interrupts first to minimize chance of overrun */
+       ps->tx_packets++;
+       ps->tx_bytes += ptxd->len;
 
-       au1000_rx(dev);
-       au1000_tx_ack(dev);
-       return IRQ_RETVAL(1);
+       ptxd->buff_stat = pDB->dma_addr | TX_DMA_ENABLE;
+       au_sync();
+       dev_kfree_skb(skb);
+       aup->tx_head = (aup->tx_head + 1) & (NUM_TX_DMA - 1);
+       dev->trans_start = jiffies;
+       return 0;
 }
 
-
 /*
  * The Tx ring has been full longer than the watchdog timeout
  * value. The transmitter must be hung?
@@ -1315,5 +1047,252 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
        return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
 }
 
+static struct net_device * au1000_probe(int port_num)
+{
+       static unsigned version_printed = 0;
+       struct au1000_private *aup = NULL;
+       struct net_device *dev = NULL;
+       db_dest_t *pDB, *pDBfree;
+       char ethaddr[6];
+       int irq, i, err;
+       u32 base, macen;
+
+       if (port_num >= NUM_ETH_INTERFACES)
+               return NULL;
+
+       base  = CPHYSADDR(iflist[port_num].base_addr );
+       macen = CPHYSADDR(iflist[port_num].macen_addr);
+       irq = iflist[port_num].irq;
+
+       if (!request_mem_region( base, MAC_IOSIZE, "Au1x00 ENET") ||
+           !request_mem_region(macen, 4, "Au1x00 ENET"))
+               return NULL;
+
+       if (version_printed++ == 0)
+               printk("%s version %s %s\n", DRV_NAME, DRV_VERSION, DRV_AUTHOR);
+
+       dev = alloc_etherdev(sizeof(struct au1000_private));
+       if (!dev) {
+               printk(KERN_ERR "%s: alloc_etherdev failed\n", DRV_NAME);
+               return NULL;
+       }
+
+       if ((err = register_netdev(dev)) != 0) {
+               printk(KERN_ERR "%s: Cannot register net device, error %d\n",
+                               DRV_NAME, err);
+               free_netdev(dev);
+               return NULL;
+       }
+
+       printk("%s: Au1xx0 Ethernet found at 0x%x, irq %d\n",
+               dev->name, base, irq);
+
+       aup = netdev_priv(dev);
+
+       spin_lock_init(&aup->lock);
+
+       /* Allocate the data buffers */
+       /* Snooping works fine with eth on all au1xxx */
+       aup->vaddr = (u32)dma_alloc_noncoherent(NULL, MAX_BUF_SIZE *
+                                               (NUM_TX_BUFFS + NUM_RX_BUFFS),
+                                               &aup->dma_addr, 0);
+       if (!aup->vaddr) {
+               free_netdev(dev);
+               release_mem_region( base, MAC_IOSIZE);
+               release_mem_region(macen, 4);
+               return NULL;
+       }
+
+       /* aup->mac is the base address of the MAC's registers */
+       aup->mac = (volatile mac_reg_t *)iflist[port_num].base_addr;
+
+       /* Setup some variables for quick register address access */
+       aup->enable = (volatile u32 *)iflist[port_num].macen_addr;
+       aup->mac_id = port_num;
+       au_macs[port_num] = aup;
+
+       if (port_num == 0) {
+               if (prom_get_ethernet_addr(ethaddr) == 0)
+                       memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
+               else {
+                       printk(KERN_INFO "%s: No MAC address found\n",
+                                        dev->name);
+                               /* Use the hard coded MAC addresses */
+               }
+
+               setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
+       } else if (port_num == 1)
+               setup_hw_rings(aup, MAC1_RX_DMA_ADDR, MAC1_TX_DMA_ADDR);
+
+       /*
+        * Assign to the Ethernet ports two consecutive MAC addresses
+        * to match those that are printed on their stickers
+        */
+       memcpy(dev->dev_addr, au1000_mac_addr, sizeof(au1000_mac_addr));
+       dev->dev_addr[5] += port_num;
+
+       *aup->enable = 0;
+       aup->mac_enabled = 0;
+
+       aup->mii_bus = mdiobus_alloc();
+       if (aup->mii_bus == NULL)
+               goto err_out;
+
+       aup->mii_bus->priv = dev;
+       aup->mii_bus->read = au1000_mdiobus_read;
+       aup->mii_bus->write = au1000_mdiobus_write;
+       aup->mii_bus->reset = au1000_mdiobus_reset;
+       aup->mii_bus->name = "au1000_eth_mii";
+       snprintf(aup->mii_bus->id, MII_BUS_ID_SIZE, "%x", aup->mac_id);
+       aup->mii_bus->irq = kmalloc(sizeof(int)*PHY_MAX_ADDR, GFP_KERNEL);
+       for(i = 0; i < PHY_MAX_ADDR; ++i)
+               aup->mii_bus->irq[i] = PHY_POLL;
+
+       /* if known, set corresponding PHY IRQs */
+#if defined(AU1XXX_PHY_STATIC_CONFIG)
+# if defined(AU1XXX_PHY0_IRQ)
+       if (AU1XXX_PHY0_BUSID == aup->mac_id)
+               aup->mii_bus->irq[AU1XXX_PHY0_ADDR] = AU1XXX_PHY0_IRQ;
+# endif
+# if defined(AU1XXX_PHY1_IRQ)
+       if (AU1XXX_PHY1_BUSID == aup->mac_id)
+               aup->mii_bus->irq[AU1XXX_PHY1_ADDR] = AU1XXX_PHY1_IRQ;
+# endif
+#endif
+       mdiobus_register(aup->mii_bus);
+
+       if (mii_probe(dev) != 0) {
+               goto err_out;
+       }
+
+       pDBfree = NULL;
+       /* setup the data buffer descriptors and attach a buffer to each one */
+       pDB = aup->db;
+       for (i = 0; i < (NUM_TX_BUFFS+NUM_RX_BUFFS); i++) {
+               pDB->pnext = pDBfree;
+               pDBfree = pDB;
+               pDB->vaddr = (u32 *)((unsigned)aup->vaddr + MAX_BUF_SIZE*i);
+               pDB->dma_addr = (dma_addr_t)virt_to_bus(pDB->vaddr);
+               pDB++;
+       }
+       aup->pDBfree = pDBfree;
+
+       for (i = 0; i < NUM_RX_DMA; i++) {
+               pDB = GetFreeDB(aup);
+               if (!pDB) {
+                       goto err_out;
+               }
+               aup->rx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr;
+               aup->rx_db_inuse[i] = pDB;
+       }
+       for (i = 0; i < NUM_TX_DMA; i++) {
+               pDB = GetFreeDB(aup);
+               if (!pDB) {
+                       goto err_out;
+               }
+               aup->tx_dma_ring[i]->buff_stat = (unsigned)pDB->dma_addr;
+               aup->tx_dma_ring[i]->len = 0;
+               aup->tx_db_inuse[i] = pDB;
+       }
+
+       dev->base_addr = base;
+       dev->irq = irq;
+       dev->open = au1000_open;
+       dev->hard_start_xmit = au1000_tx;
+       dev->stop = au1000_close;
+       dev->set_multicast_list = &set_rx_mode;
+       dev->do_ioctl = &au1000_ioctl;
+       SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
+       dev->tx_timeout = au1000_tx_timeout;
+       dev->watchdog_timeo = ETH_TX_TIMEOUT;
+
+       /*
+        * The boot code uses the ethernet controller, so reset it to start
+        * fresh.  au1000_init() expects that the device is in reset state.
+        */
+       reset_mac(dev);
+
+       return dev;
+
+err_out:
+       if (aup->mii_bus != NULL) {
+               mdiobus_unregister(aup->mii_bus);
+               mdiobus_free(aup->mii_bus);
+       }
+
+       /* here we should have a valid dev plus aup-> register addresses
+        * so we can reset the mac properly.*/
+       reset_mac(dev);
+
+       for (i = 0; i < NUM_RX_DMA; i++) {
+               if (aup->rx_db_inuse[i])
+                       ReleaseDB(aup, aup->rx_db_inuse[i]);
+       }
+       for (i = 0; i < NUM_TX_DMA; i++) {
+               if (aup->tx_db_inuse[i])
+                       ReleaseDB(aup, aup->tx_db_inuse[i]);
+       }
+       dma_free_noncoherent(NULL, MAX_BUF_SIZE * (NUM_TX_BUFFS + NUM_RX_BUFFS),
+                            (void *)aup->vaddr, aup->dma_addr);
+       unregister_netdev(dev);
+       free_netdev(dev);
+       release_mem_region( base, MAC_IOSIZE);
+       release_mem_region(macen, 4);
+       return NULL;
+}
+
+/*
+ * Setup the base address and interrupt of the Au1xxx ethernet macs
+ * based on cpu type and whether the interface is enabled in sys_pinfunc
+ * register. The last interface is enabled if SYS_PF_NI2 (bit 4) is 0.
+ */
+static int __init au1000_init_module(void)
+{
+       int ni = (int)((au_readl(SYS_PINFUNC) & (u32)(SYS_PF_NI2)) >> 4);
+       struct net_device *dev;
+       int i, found_one = 0;
+
+       num_ifs = NUM_ETH_INTERFACES - ni;
+
+       for(i = 0; i < num_ifs; i++) {
+               dev = au1000_probe(i);
+               iflist[i].dev = dev;
+               if (dev)
+                       found_one++;
+       }
+       if (!found_one)
+               return -ENODEV;
+       return 0;
+}
+
+static void __exit au1000_cleanup_module(void)
+{
+       int i, j;
+       struct net_device *dev;
+       struct au1000_private *aup;
+
+       for (i = 0; i < num_ifs; i++) {
+               dev = iflist[i].dev;
+               if (dev) {
+                       aup = netdev_priv(dev);
+                       unregister_netdev(dev);
+                       mdiobus_unregister(aup->mii_bus);
+                       mdiobus_free(aup->mii_bus);
+                       for (j = 0; j < NUM_RX_DMA; j++)
+                               if (aup->rx_db_inuse[j])
+                                       ReleaseDB(aup, aup->rx_db_inuse[j]);
+                       for (j = 0; j < NUM_TX_DMA; j++)
+                               if (aup->tx_db_inuse[j])
+                                       ReleaseDB(aup, aup->tx_db_inuse[j]);
+                       dma_free_noncoherent(NULL, MAX_BUF_SIZE *
+                                            (NUM_TX_BUFFS + NUM_RX_BUFFS),
+                                            (void *)aup->vaddr, aup->dma_addr);
+                       release_mem_region(dev->base_addr, MAC_IOSIZE);
+                       release_mem_region(CPHYSADDR(iflist[i].macen_addr), 4);
+                       free_netdev(dev);
+               }
+       }
+}
+
 module_init(au1000_init_module);
 module_exit(au1000_cleanup_module);
index c38512ebcea65fd0408ae0821d3be177b2854e26..2a51c757997688849f07be96d5e125e16031efb9 100644 (file)
@@ -874,7 +874,7 @@ static int b44_poll(struct napi_struct *napi, int budget)
        }
 
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                b44_enable_ints(bp);
        }
 
@@ -906,13 +906,13 @@ static irqreturn_t b44_interrupt(int irq, void *dev_id)
                        goto irq_ack;
                }
 
-               if (netif_rx_schedule_prep(&bp->napi)) {
+               if (napi_schedule_prep(&bp->napi)) {
                        /* NOTE: These writes are posted by the readback of
                         *       the ISTAT register below.
                         */
                        bp->istat = istat;
                        __b44_disable_ints(bp);
-                       __netif_rx_schedule(&bp->napi);
+                       __napi_schedule(&bp->napi);
                } else {
                        printk(KERN_ERR PFX "%s: Error, poll already scheduled\n",
                               dev->name);
@@ -973,7 +973,7 @@ static int b44_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        ssb_dma_unmap_single(bp->sdev, mapping, len,
                                             DMA_TO_DEVICE);
 
-               bounce_skb = __dev_alloc_skb(len, GFP_ATOMIC | GFP_DMA);
+               bounce_skb = __netdev_alloc_skb(dev, len, GFP_ATOMIC | GFP_DMA);
                if (!bounce_skb)
                        goto err_out;
 
index 78e31aa861e020e461336e2323cea4647d7cb9c8..9afe8092dfc4c9f3b8fe04d1a915d2040206d794 100644 (file)
@@ -415,11 +415,11 @@ static int mii_probe(struct net_device *dev)
        }
 
 #if defined(CONFIG_BFIN_MAC_RMII)
-       phydev = phy_connect(dev, phydev->dev.bus_id, &bfin_mac_adjust_link, 0,
-                       PHY_INTERFACE_MODE_RMII);
+       phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link,
+                       0, PHY_INTERFACE_MODE_RMII);
 #else
-       phydev = phy_connect(dev, phydev->dev.bus_id, &bfin_mac_adjust_link, 0,
-                       PHY_INTERFACE_MODE_MII);
+       phydev = phy_connect(dev, dev_name(&phydev->dev), &bfin_mac_adjust_link,
+                       0, PHY_INTERFACE_MODE_MII);
 #endif
 
        if (IS_ERR(phydev)) {
@@ -447,7 +447,7 @@ static int mii_probe(struct net_device *dev)
        printk(KERN_INFO "%s: attached PHY driver [%s] "
               "(mii_bus:phy_addr=%s, irq=%d, mdc_clk=%dHz(mdc_div=%d)"
               "@sclk=%dMHz)\n",
-              DRV_NAME, phydev->drv->name, phydev->dev.bus_id, phydev->irq,
+              DRV_NAME, phydev->drv->name, dev_name(&phydev->dev), phydev->irq,
               MDC_CLK, mdc_div, sclk/1000000);
 
        return 0;
@@ -488,7 +488,7 @@ static void bfin_mac_ethtool_getdrvinfo(struct net_device *dev,
        strcpy(info->driver, DRV_NAME);
        strcpy(info->version, DRV_VERSION);
        strcpy(info->fw_version, "N/A");
-       strcpy(info->bus_info, dev->dev.bus_id);
+       strcpy(info->bus_info, dev_name(&dev->dev));
 }
 
 static struct ethtool_ops bfin_mac_ethtool_ops = {
index 8a546a33d58124fb39cf67ff673e305f7a7fd418..1ab58375d0617039cfdf658d7ee8c56f0f6bbf09 100644 (file)
@@ -1240,7 +1240,7 @@ static void bmac_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *inf
 {
        struct bmac_data *bp = netdev_priv(dev);
        strcpy(info->driver, "bmac");
-       strcpy(info->bus_info, bp->mdev->ofdev.dev.bus_id);
+       strcpy(info->bus_info, dev_name(&bp->mdev->ofdev.dev));
 }
 
 static const struct ethtool_ops bmac_ethtool_ops = {
index 6500b7c4739ffde3ed86c00819962cfc79c86a56..8466d351a70375b7e733d4498862086302cca349 100644 (file)
@@ -1497,6 +1497,8 @@ static int bnx2_fw_sync(struct bnx2 *, u32, int, int);
 
 static int
 bnx2_setup_remote_phy(struct bnx2 *bp, u8 port)
+__releases(&bp->phy_lock)
+__acquires(&bp->phy_lock)
 {
        u32 speed_arg = 0, pause_adv;
 
@@ -1554,6 +1556,8 @@ bnx2_setup_remote_phy(struct bnx2 *bp, u8 port)
 
 static int
 bnx2_setup_serdes_phy(struct bnx2 *bp, u8 port)
+__releases(&bp->phy_lock)
+__acquires(&bp->phy_lock)
 {
        u32 adv, bmcr;
        u32 new_adv = 0;
@@ -1866,6 +1870,8 @@ bnx2_set_remote_link(struct bnx2 *bp)
 
 static int
 bnx2_setup_copper_phy(struct bnx2 *bp)
+__releases(&bp->phy_lock)
+__acquires(&bp->phy_lock)
 {
        u32 bmcr;
        u32 new_bmcr;
@@ -1963,6 +1969,8 @@ bnx2_setup_copper_phy(struct bnx2 *bp)
 
 static int
 bnx2_setup_phy(struct bnx2 *bp, u8 port)
+__releases(&bp->phy_lock)
+__acquires(&bp->phy_lock)
 {
        if (bp->loopback == MAC_LOOPBACK)
                return 0;
@@ -2176,6 +2184,8 @@ bnx2_init_copper_phy(struct bnx2 *bp, int reset_phy)
 
 static int
 bnx2_init_phy(struct bnx2 *bp, int reset_phy)
+__releases(&bp->phy_lock)
+__acquires(&bp->phy_lock)
 {
        u32 val;
        int rc = 0;
@@ -3005,6 +3015,8 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
                                skb->ip_summed = CHECKSUM_UNNECESSARY;
                }
 
+               skb_record_rx_queue(skb, bnapi - &bp->bnx2_napi[0]);
+
 #ifdef BCM_VLAN
                if (hw_vlan)
                        vlan_hwaccel_receive_skb(skb, bp->vlgrp, vtag);
@@ -3061,7 +3073,7 @@ bnx2_msi(int irq, void *dev_instance)
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       netif_rx_schedule(&bnapi->napi);
+       napi_schedule(&bnapi->napi);
 
        return IRQ_HANDLED;
 }
@@ -3078,7 +3090,7 @@ bnx2_msi_1shot(int irq, void *dev_instance)
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       netif_rx_schedule(&bnapi->napi);
+       napi_schedule(&bnapi->napi);
 
        return IRQ_HANDLED;
 }
@@ -3114,9 +3126,9 @@ bnx2_interrupt(int irq, void *dev_instance)
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       if (netif_rx_schedule_prep(&bnapi->napi)) {
+       if (napi_schedule_prep(&bnapi->napi)) {
                bnapi->last_status_idx = sblk->status_idx;
-               __netif_rx_schedule(&bnapi->napi);
+               __napi_schedule(&bnapi->napi);
        }
 
        return IRQ_HANDLED;
@@ -3226,7 +3238,7 @@ static int bnx2_poll_msix(struct napi_struct *napi, int budget)
                rmb();
                if (likely(!bnx2_has_fast_work(bnapi))) {
 
-                       netif_rx_complete(napi);
+                       napi_complete(napi);
                        REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num |
                               BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
                               bnapi->last_status_idx);
@@ -3259,7 +3271,7 @@ static int bnx2_poll(struct napi_struct *napi, int budget)
 
                rmb();
                if (likely(!bnx2_has_work(bnapi))) {
-                       netif_rx_complete(napi);
+                       napi_complete(napi);
                        if (likely(bp->flags & BNX2_FLAG_USING_MSI_OR_MSIX)) {
                                REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
                                       BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
index 15a5cf0f676be78f23f0043ba91750864e201113..408eae7d6cc613b8ce059c49f75d2db0b2486140 100644 (file)
 #endif
 
 
+#define BNX2X_MULTI_QUEUE
+
+#define BNX2X_NEW_NAPI
+
+
+#include "bnx2x_reg.h"
+#include "bnx2x_fw_defs.h"
+#include "bnx2x_hsi.h"
+#include "bnx2x_link.h"
+
 /* error/debug prints */
 
 #define DRV_MODULE_NAME                "bnx2x"
 
 #define REG_RD(bp, offset)             readl(REG_ADDR(bp, offset))
 #define REG_RD8(bp, offset)            readb(REG_ADDR(bp, offset))
-#define REG_RD64(bp, offset)           readq(REG_ADDR(bp, offset))
 
 #define REG_WR(bp, offset, val)                writel((u32)val, REG_ADDR(bp, offset))
 #define REG_WR8(bp, offset, val)       writeb((u8)val, REG_ADDR(bp, offset))
 #define REG_WR16(bp, offset, val)      writew((u16)val, REG_ADDR(bp, offset))
-#define REG_WR32(bp, offset, val)      REG_WR(bp, offset, val)
 
 #define REG_RD_IND(bp, offset)         bnx2x_reg_rd_ind(bp, offset)
 #define REG_WR_IND(bp, offset, val)    bnx2x_reg_wr_ind(bp, offset, val)
@@ -154,8 +162,6 @@ struct sw_rx_page {
 #define SGE_PAGE_SHIFT                 PAGE_SHIFT
 #define SGE_PAGE_ALIGN(addr)           PAGE_ALIGN(addr)
 
-#define BCM_RX_ETH_PAYLOAD_ALIGN       64
-
 /* SGE ring related macros */
 #define NUM_RX_SGE_PAGES               2
 #define RX_SGE_CNT             (BCM_PAGE_SIZE / sizeof(struct eth_rx_sge))
@@ -187,6 +193,43 @@ struct sw_rx_page {
 #define NEXT_SGE_MASK_ELEM(el)         (((el) + 1) & RX_SGE_MASK_LEN_MASK)
 
 
+struct bnx2x_eth_q_stats {
+       u32 total_bytes_received_hi;
+       u32 total_bytes_received_lo;
+       u32 total_bytes_transmitted_hi;
+       u32 total_bytes_transmitted_lo;
+       u32 total_unicast_packets_received_hi;
+       u32 total_unicast_packets_received_lo;
+       u32 total_multicast_packets_received_hi;
+       u32 total_multicast_packets_received_lo;
+       u32 total_broadcast_packets_received_hi;
+       u32 total_broadcast_packets_received_lo;
+       u32 total_unicast_packets_transmitted_hi;
+       u32 total_unicast_packets_transmitted_lo;
+       u32 total_multicast_packets_transmitted_hi;
+       u32 total_multicast_packets_transmitted_lo;
+       u32 total_broadcast_packets_transmitted_hi;
+       u32 total_broadcast_packets_transmitted_lo;
+       u32 valid_bytes_received_hi;
+       u32 valid_bytes_received_lo;
+
+       u32 error_bytes_received_hi;
+       u32 error_bytes_received_lo;
+       u32 etherstatsoverrsizepkts_hi;
+       u32 etherstatsoverrsizepkts_lo;
+       u32 no_buff_discard_hi;
+       u32 no_buff_discard_lo;
+
+       u32 driver_xoff;
+       u32 rx_err_discard_pkt;
+       u32 rx_skb_alloc_failed;
+       u32 hw_csum_err;
+};
+
+#define BNX2X_NUM_Q_STATS              11
+#define Q_STATS_OFFSET32(stat_name) \
+                       (offsetof(struct bnx2x_eth_q_stats, stat_name) / 4)
+
 struct bnx2x_fastpath {
 
        struct napi_struct      napi;
@@ -228,20 +271,15 @@ struct bnx2x_fastpath {
        u8                      index;  /* number in fp array */
        u8                      cl_id;  /* eth client id */
        u8                      sb_id;  /* status block number in HW */
-#define FP_IDX(fp)                     (fp->index)
-#define FP_CL_ID(fp)                   (fp->cl_id)
-#define BP_CL_ID(bp)                   (bp->fp[0].cl_id)
-#define FP_SB_ID(fp)                   (fp->sb_id)
-#define CNIC_SB_ID                     0
 
        u16                     tx_pkt_prod;
        u16                     tx_pkt_cons;
        u16                     tx_bd_prod;
        u16                     tx_bd_cons;
-       u16                     *tx_cons_sb;
+       __le16                  *tx_cons_sb;
 
-       u16                     fp_c_idx;
-       u16                     fp_u_idx;
+       __le16                  fp_c_idx;
+       __le16                  fp_u_idx;
 
        u16                     rx_bd_prod;
        u16                     rx_bd_cons;
@@ -250,8 +288,8 @@ struct bnx2x_fastpath {
        u16                     rx_sge_prod;
        /* The last maximal completed SGE */
        u16                     last_max_sge;
-       u16                     *rx_cons_sb;
-       u16                     *rx_bd_cons_sb;
+       __le16                  *rx_cons_sb;
+       __le16                  *rx_bd_cons_sb;
 
        unsigned long           tx_pkt,
                                rx_pkt,
@@ -266,6 +304,12 @@ struct bnx2x_fastpath {
        u64                     tpa_queue_used;
 #endif
 
+       struct tstorm_per_client_stats old_tclient;
+       struct ustorm_per_client_stats old_uclient;
+       struct xstorm_per_client_stats old_xclient;
+       struct bnx2x_eth_q_stats eth_q_stats;
+
+       char                    name[IFNAMSIZ];
        struct bnx2x            *bp; /* parent */
 };
 
@@ -401,10 +445,13 @@ struct bnx2x_fastpath {
 #define BNX2X_RX_CSUM_OK(cqe) \
                        (!(BNX2X_L4_CSUM_ERR(cqe) || BNX2X_IP_CSUM_ERR(cqe)))
 
+#define BNX2X_PRS_FLAG_OVERETH_IPV4(flags) \
+                               (((le16_to_cpu(flags) & \
+                                  PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) >> \
+                                 PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT) \
+                                == PRS_FLAG_OVERETH_IPV4)
 #define BNX2X_RX_SUM_FIX(cqe) \
-                       ((le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & \
-                         PARSING_FLAGS_OVER_ETHERNET_PROTOCOL) == \
-                        (1 << PARSING_FLAGS_OVER_ETHERNET_PROTOCOL_SHIFT))
+       BNX2X_PRS_FLAG_OVERETH_IPV4(cqe->fast_path_cqe.pars_flags.flags)
 
 
 #define FP_USB_FUNC_OFF                        (2 + 2*HC_USTORM_SB_NUM_INDICES)
@@ -478,11 +525,8 @@ struct bnx2x_common {
        u32                     shmem_base;
 
        u32                     hw_config;
-       u32                     board;
 
        u32                     bc_ver;
-
-       char                    *name;
 };
 
 
@@ -528,6 +572,7 @@ struct bnx2x_port {
 
        /* used to synchronize phy accesses */
        struct mutex            phy_mutex;
+       int                     need_hw_lock;
 
        u32                     port_stx;
 
@@ -573,6 +618,10 @@ struct bnx2x_eth_stats {
 
        u32 error_bytes_received_hi;
        u32 error_bytes_received_lo;
+       u32 etherstatsoverrsizepkts_hi;
+       u32 etherstatsoverrsizepkts_lo;
+       u32 no_buff_discard_hi;
+       u32 no_buff_discard_lo;
 
        u32 rx_stat_ifhcinbadoctets_hi;
        u32 rx_stat_ifhcinbadoctets_lo;
@@ -651,19 +700,20 @@ struct bnx2x_eth_stats {
        u32 tx_stat_bmac_ufl_hi;
        u32 tx_stat_bmac_ufl_lo;
 
-       u32 brb_drop_hi;
-       u32 brb_drop_lo;
-       u32 brb_truncate_hi;
-       u32 brb_truncate_lo;
-
-       u32 jabber_packets_received;
+       u32 pause_frames_received_hi;
+       u32 pause_frames_received_lo;
+       u32 pause_frames_sent_hi;
+       u32 pause_frames_sent_lo;
 
        u32 etherstatspkts1024octetsto1522octets_hi;
        u32 etherstatspkts1024octetsto1522octets_lo;
        u32 etherstatspktsover1522octets_hi;
        u32 etherstatspktsover1522octets_lo;
 
-       u32 no_buff_discard;
+       u32 brb_drop_hi;
+       u32 brb_drop_lo;
+       u32 brb_truncate_hi;
+       u32 brb_truncate_lo;
 
        u32 mac_filter_discard;
        u32 xxoverflow_discard;
@@ -674,17 +724,16 @@ struct bnx2x_eth_stats {
        u32 rx_err_discard_pkt;
        u32 rx_skb_alloc_failed;
        u32 hw_csum_err;
+
+       u32 nig_timer_max;
 };
 
+#define BNX2X_NUM_STATS                        41
 #define STATS_OFFSET32(stat_name) \
                        (offsetof(struct bnx2x_eth_stats, stat_name) / 4)
 
 
-#ifdef BNX2X_MULTI
 #define MAX_CONTEXT                    16
-#else
-#define MAX_CONTEXT                    1
-#endif
 
 union cdu_context {
        struct eth_context eth;
@@ -739,6 +788,9 @@ struct bnx2x {
 
        atomic_t                intr_sem;
        struct msix_entry       msix_table[MAX_CONTEXT+1];
+#define INT_MODE_INTx                  1
+#define INT_MODE_MSI                   2
+#define INT_MODE_MSIX                  3
 
        int                     tx_ring_size;
 
@@ -747,23 +799,26 @@ struct bnx2x {
 #endif
 
        u32                     rx_csum;
-       u32                     rx_offset;
        u32                     rx_buf_size;
 #define ETH_OVREHEAD                   (ETH_HLEN + 8)  /* 8 for CRC + VLAN */
 #define ETH_MIN_PACKET_SIZE            60
 #define ETH_MAX_PACKET_SIZE            1500
 #define ETH_MAX_JUMBO_PACKET_SIZE      9600
 
+       /* Max supported alignment is 256 (8 shift) */
+#define BNX2X_RX_ALIGN_SHIFT           ((L1_CACHE_SHIFT < 8) ? \
+                                        L1_CACHE_SHIFT : 8)
+#define BNX2X_RX_ALIGN                 (1 << BNX2X_RX_ALIGN_SHIFT)
+
        struct host_def_status_block *def_status_blk;
 #define DEF_SB_ID                      16
-       u16                     def_c_idx;
-       u16                     def_u_idx;
-       u16                     def_x_idx;
-       u16                     def_t_idx;
-       u16                     def_att_idx;
+       __le16                  def_c_idx;
+       __le16                  def_u_idx;
+       __le16                  def_x_idx;
+       __le16                  def_t_idx;
+       __le16                  def_att_idx;
        u32                     attn_state;
        struct attn_route       attn_group[MAX_DYNAMIC_ATTN_GRPS];
-       u32                     nig_mask;
 
        /* slow path ring */
        struct eth_spe          *spq;
@@ -771,7 +826,7 @@ struct bnx2x {
        u16                     spq_prod_idx;
        struct eth_spe          *spq_prod_bd;
        struct eth_spe          *spq_last_bd;
-       u16                     *dsb_sp_prod;
+       __le16                  *dsb_sp_prod;
        u16                     spq_left; /* serialize spq */
        /* used to synchronize spq accesses */
        spinlock_t              spq_lock;
@@ -789,11 +844,11 @@ struct bnx2x {
        u32                     flags;
 #define PCIX_FLAG                      1
 #define PCI_32BIT_FLAG                 2
-#define ONE_TDMA_FLAG                  4       /* no longer used */
+#define ONE_PORT_FLAG                  4
 #define NO_WOL_FLAG                    8
 #define USING_DAC_FLAG                 0x10
 #define USING_MSIX_FLAG                        0x20
-#define ASF_ENABLE_FLAG                        0x40
+#define USING_MSI_FLAG                 0x40
 #define TPA_ENABLE_FLAG                        0x80
 #define NO_MCP_FLAG                    0x100
 #define BP_NOMCP(bp)                   (bp->flags & NO_MCP_FLAG)
@@ -808,12 +863,12 @@ struct bnx2x {
 
        int                     pm_cap;
        int                     pcie_cap;
+       int                     mrrs;
 
        struct delayed_work     sp_task;
        struct work_struct      reset_task;
 
        struct timer_list       timer;
-       int                     timer_interval;
        int                     current_interval;
 
        u16                     fw_seq;
@@ -826,6 +881,9 @@ struct bnx2x {
        struct bnx2x_common     common;
        struct bnx2x_port       port;
 
+       struct cmng_struct_per_port cmng;
+       u32                     vn_weight_sum;
+
        u32                     mf_config;
        u16                     e1hov;
        u8                      e1hmf;
@@ -848,7 +906,7 @@ struct bnx2x {
        u32                     lin_cnt;
 
        int                     state;
-#define BNX2X_STATE_CLOSED             0x0
+#define BNX2X_STATE_CLOSED             0
 #define BNX2X_STATE_OPENING_WAIT4_LOAD 0x1000
 #define BNX2X_STATE_OPENING_WAIT4_PORT 0x2000
 #define BNX2X_STATE_OPEN               0x3000
@@ -859,8 +917,9 @@ struct bnx2x {
 #define BNX2X_STATE_DIAG               0xe000
 #define BNX2X_STATE_ERROR              0xf000
 
-       int                     num_queues;
-#define BP_MAX_QUEUES(bp)              (IS_E1HMF(bp) ? 4 : 16)
+       int                     multi_mode;
+       int                     num_rx_queues;
+       int                     num_tx_queues;
 
        u32                     rx_mode;
 #define BNX2X_RX_MODE_NONE             0
@@ -898,8 +957,6 @@ struct bnx2x {
        int                     executer_idx;
 
        u16                     stats_counter;
-       struct tstorm_per_client_stats old_tclient;
-       struct xstorm_per_client_stats old_xclient;
        struct bnx2x_eth_stats  eth_stats;
 
        struct z_stream_s       *strm;
@@ -911,17 +968,27 @@ struct bnx2x {
 };
 
 
-#define for_each_queue(bp, var)        for (var = 0; var < bp->num_queues; var++)
+#define BNX2X_MAX_QUEUES(bp)   (IS_E1HMF(bp) ? (MAX_CONTEXT / E1HVN_MAX) : \
+                                                MAX_CONTEXT)
+#define BNX2X_NUM_QUEUES(bp)   max(bp->num_rx_queues, bp->num_tx_queues)
+#define is_multi(bp)           (BNX2X_NUM_QUEUES(bp) > 1)
 
+#define for_each_rx_queue(bp, var) \
+                       for (var = 0; var < bp->num_rx_queues; var++)
+#define for_each_tx_queue(bp, var) \
+                       for (var = 0; var < bp->num_tx_queues; var++)
+#define for_each_queue(bp, var) \
+                       for (var = 0; var < BNX2X_NUM_QUEUES(bp); var++)
 #define for_each_nondefault_queue(bp, var) \
-                               for (var = 1; var < bp->num_queues; var++)
-#define is_multi(bp)           (bp->num_queues > 1)
+                       for (var = 1; var < BNX2X_NUM_QUEUES(bp); var++)
 
 
 void bnx2x_read_dmae(struct bnx2x *bp, u32 src_addr, u32 len32);
 void bnx2x_write_dmae(struct bnx2x *bp, dma_addr_t dma_addr, u32 dst_addr,
                      u32 len32);
+int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port);
 int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port);
+int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port);
 
 static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
                           int wait)
@@ -992,13 +1059,12 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define PCICFG_LINK_SPEED_SHIFT                16
 
 
-#define BNX2X_NUM_STATS                        42
-#define BNX2X_NUM_TESTS                        8
+#define BNX2X_NUM_TESTS                        7
 
-#define BNX2X_MAC_LOOPBACK             0
-#define BNX2X_PHY_LOOPBACK             1
-#define BNX2X_MAC_LOOPBACK_FAILED      1
-#define BNX2X_PHY_LOOPBACK_FAILED      2
+#define BNX2X_PHY_LOOPBACK             0
+#define BNX2X_MAC_LOOPBACK             1
+#define BNX2X_PHY_LOOPBACK_FAILED      1
+#define BNX2X_MAC_LOOPBACK_FAILED      2
 #define BNX2X_LOOPBACK_FAILED          (BNX2X_MAC_LOOPBACK_FAILED | \
                                         BNX2X_PHY_LOOPBACK_FAILED)
 
@@ -1061,9 +1127,6 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
 #define BNX2X_MCP_ASSERT \
        GENERAL_ATTEN_OFFSET(MCP_FATAL_ASSERT_ATTENTION_BIT)
 
-#define BNX2X_DOORQ_ASSERT \
-       AEU_INPUTS_ATTN_BITS_DOORBELLQ_HW_INTERRUPT
-
 #define BNX2X_GRC_TIMEOUT      GENERAL_ATTEN_OFFSET(LATCHED_ATTN_TIMEOUT_GRC)
 #define BNX2X_GRC_RSV          (GENERAL_ATTEN_OFFSET(LATCHED_ATTN_RBCR) | \
                                 GENERAL_ATTEN_OFFSET(LATCHED_ATTN_RBCT) | \
@@ -1120,12 +1183,13 @@ static inline u32 reg_poll(struct bnx2x *bp, u32 reg, u32 expected, int ms,
                                 AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR)
 
 
-#define MULTI_FLAGS \
+#define MULTI_FLAGS(bp) \
                (TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY | \
                 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_TCP_CAPABILITY | \
                 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY | \
                 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY | \
-                TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_ENABLE)
+                (bp->multi_mode << \
+                 TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT))
 
 #define MULTI_MASK                     0x7f
 
index 192fa981b9307b93f7509c370d3344fcdd4a67b2..e2df238035988cba6f42b32c843180ae688c42a4 100644 (file)
@@ -1,6 +1,6 @@
 /* bnx2x_fw_defs.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2008 Broadcom Corporation
+ * Copyright (c) 2007-2009 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #define TSTORM_ASSERT_LIST_OFFSET(idx) \
        (IS_E1H_OFFSET ? (0xa020 + (idx * 0x10)) : (0x1020 + (idx * 0x10)))
 #define TSTORM_CLIENT_CONFIG_OFFSET(port, client_id) \
-       (IS_E1H_OFFSET ? (0x3358 + (port * 0x3e8) + (client_id * 0x28)) \
-       : (0x9c8 + (port * 0x2f8) + (client_id * 0x28)))
+       (IS_E1H_OFFSET ? (0x3350 + (port * 0x190) + (client_id * 0x10)) \
+       : (0x9c0 + (port * 0x130) + (client_id * 0x10)))
+#define TSTORM_COMMON_SAFC_WORKAROUND_ENABLE_OFFSET \
+       (IS_E1H_OFFSET ? 0x1ad8 : 0xffffffff)
 #define TSTORM_DEF_SB_HC_DISABLE_OFFSET(function, index) \
        (IS_E1H_OFFSET ? (0xb01a + ((function>>1) * 0x28) + \
        ((function&1) * 0xa0) + (index * 0x4)) : (0x141a + (function * \
        (function * 0x38)))
 #define TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, stats_counter_id) \
        (IS_E1H_OFFSET ? (0x2010 + (port * 0x5b0) + (stats_counter_id * \
-       0x50)) : (0x4000 + (port * 0x3f0) + (stats_counter_id * 0x38)))
-#define TSTORM_RX_PRODS_OFFSET(port, client_id) \
-       (IS_E1H_OFFSET ? (0x3350 + (port * 0x3e8) + (client_id * 0x28)) \
-       : (0x9c0 + (port * 0x2f8) + (client_id * 0x28)))
+       0x50)) : (0x4080 + (port * 0x5b0) + (stats_counter_id * 0x50)))
 #define TSTORM_STATS_FLAGS_OFFSET(function) \
        (IS_E1H_OFFSET ? (0x2c00 + (function * 0x8)) : (0x4b88 + \
        (function * 0x8)))
-#define TSTORM_TPA_EXIST_OFFSET (IS_E1H_OFFSET ? 0x3b30 : 0x1c20)
+#define TSTORM_TPA_EXIST_OFFSET (IS_E1H_OFFSET ? 0x3680 : 0x1c20)
 #define USTORM_AGG_DATA_OFFSET (IS_E1H_OFFSET ? 0xa040 : 0x2c10)
 #define USTORM_AGG_DATA_SIZE (IS_E1H_OFFSET ? 0x2440 : 0x1200)
 #define USTORM_ASSERT_LIST_INDEX_OFFSET \
-       (IS_E1H_OFFSET ? 0x8000 : 0x1000)
+       (IS_E1H_OFFSET ? 0x8960 : 0x1000)
 #define USTORM_ASSERT_LIST_OFFSET(idx) \
-       (IS_E1H_OFFSET ? (0x8020 + (idx * 0x10)) : (0x1020 + (idx * 0x10)))
+       (IS_E1H_OFFSET ? (0x8980 + (idx * 0x10)) : (0x1020 + (idx * 0x10)))
 #define USTORM_CQE_PAGE_BASE_OFFSET(port, clientId) \
-       (IS_E1H_OFFSET ? (0x3298 + (port * 0x258) + (clientId * 0x18)) : \
-       (0x5450 + (port * 0x1c8) + (clientId * 0x18)))
+       (IS_E1H_OFFSET ? (0x8018 + (port * 0x4b0) + (clientId * 0x30)) : \
+       (0x5330 + (port * 0x260) + (clientId * 0x20)))
 #define USTORM_DEF_SB_HC_DISABLE_OFFSET(function, index) \
-       (IS_E1H_OFFSET ? (0x951a + ((function>>1) * 0x28) + \
-       ((function&1) * 0xa0) + (index * 0x4)) : (0x191a + (function * \
-       0x28) + (index * 0x4)))
+       (IS_E1H_OFFSET ? (0x9522 + ((function>>1) * 0x40) + \
+       ((function&1) * 0x100) + (index * 0x4)) : (0x1922 + (function * \
+       0x40) + (index * 0x4)))
 #define USTORM_DEF_SB_HOST_SB_ADDR_OFFSET(function) \
-       (IS_E1H_OFFSET ? (0x9500 + ((function>>1) * 0x28) + \
-       ((function&1) * 0xa0)) : (0x1900 + (function * 0x28)))
+       (IS_E1H_OFFSET ? (0x9500 + ((function>>1) * 0x40) + \
+       ((function&1) * 0x100)) : (0x1900 + (function * 0x40)))
 #define USTORM_DEF_SB_HOST_STATUS_BLOCK_OFFSET(function) \
-       (IS_E1H_OFFSET ? (0x9508 + ((function>>1) * 0x28) + \
-       ((function&1) * 0xa0)) : (0x1908 + (function * 0x28)))
+       (IS_E1H_OFFSET ? (0x9508 + ((function>>1) * 0x40) + \
+       ((function&1) * 0x100)) : (0x1908 + (function * 0x40)))
+#define USTORM_ETH_RING_PAUSE_DATA_OFFSET(port, clientId) \
+       (IS_E1H_OFFSET ? (0x8020 + (port * 0x4b0) + (clientId * 0x30)) : \
+       0xffffffff)
+#define USTORM_ETH_STATS_QUERY_ADDR_OFFSET(function) \
+       (IS_E1H_OFFSET ? (0x2a50 + (function * 0x8)) : (0x1d98 + \
+       (function * 0x8)))
 #define USTORM_FUNCTION_MODE_OFFSET \
        (IS_E1H_OFFSET ? 0x2448 : 0xffffffff)
 #define USTORM_HC_BTR_OFFSET(port) \
-       (IS_E1H_OFFSET ? (0x9644 + (port * 0xd0)) : (0x1954 + (port * 0xb8)))
+       (IS_E1H_OFFSET ? (0x9704 + (port * 0xf0)) : (0x1984 + (port * 0xc0)))
 #define USTORM_MAX_AGG_SIZE_OFFSET(port, clientId) \
-       (IS_E1H_OFFSET ? (0x3290 + (port * 0x258) + (clientId * 0x18)) : \
-       (0x5448 + (port * 0x1c8) + (clientId * 0x18)))
+       (IS_E1H_OFFSET ? (0x8010 + (port * 0x4b0) + (clientId * 0x30)) : \
+       (0x5328 + (port * 0x260) + (clientId * 0x20)))
 #define USTORM_MEM_WORKAROUND_ADDRESS_OFFSET(function) \
-       (IS_E1H_OFFSET ? (0x2408 + (function * 0x8)) : (0x5408 + \
+       (IS_E1H_OFFSET ? (0x2408 + (function * 0x8)) : (0x5308 + \
        (function * 0x8)))
+#define USTORM_PAUSE_ENABLED_OFFSET(port) \
+       (IS_E1H_OFFSET ? (0x2ad4 + (port * 0x8)) : 0xffffffff)
+#define USTORM_PER_COUNTER_ID_STATS_OFFSET(port, stats_counter_id) \
+       (IS_E1H_OFFSET ? (0x2450 + (port * 0x2d0) + (stats_counter_id * \
+       0x28)) : (0x4740 + (port * 0x2d0) + (stats_counter_id * 0x28)))
+#define USTORM_RX_PRODS_OFFSET(port, client_id) \
+       (IS_E1H_OFFSET ? (0x8000 + (port * 0x4b0) + (client_id * 0x30)) \
+       : (0x5318 + (port * 0x260) + (client_id * 0x20)))
 #define USTORM_SB_HC_DISABLE_OFFSET(port, cpu_id, index) \
        (IS_E1H_OFFSET ? (0x901a + (port * 0x280) + (cpu_id * 0x28) + \
        (index * 0x4)) : (0x141a + (port * 0x280) + (cpu_id * 0x28) + \
 #define USTORM_SB_HOST_STATUS_BLOCK_OFFSET(port, cpu_id) \
        (IS_E1H_OFFSET ? (0x9008 + (port * 0x280) + (cpu_id * 0x28)) : \
        (0x1408 + (port * 0x280) + (cpu_id * 0x28)))
+#define USTORM_STATS_FLAGS_OFFSET(function) \
+       (IS_E1H_OFFSET ? (0x29f0 + (function * 0x8)) : (0x1d80 + \
+       (function * 0x8)))
 #define XSTORM_ASSERT_LIST_INDEX_OFFSET \
        (IS_E1H_OFFSET ? 0x9000 : 0x1000)
 #define XSTORM_ASSERT_LIST_OFFSET(idx) \
        (IS_E1H_OFFSET ? (0x9020 + (idx * 0x10)) : (0x1020 + (idx * 0x10)))
 #define XSTORM_CMNG_PER_PORT_VARS_OFFSET(port) \
-       (IS_E1H_OFFSET ? (0x24a8 + (port * 0x40)) : (0x3ba0 + (port * 0x40)))
+       (IS_E1H_OFFSET ? (0x24a8 + (port * 0x50)) : (0x3ba0 + (port * 0x50)))
 #define XSTORM_DEF_SB_HC_DISABLE_OFFSET(function, index) \
        (IS_E1H_OFFSET ? (0xa01a + ((function>>1) * 0x28) + \
        ((function&1) * 0xa0) + (index * 0x4)) : (0x141a + (function * \
        (IS_E1H_OFFSET ? (0xa008 + ((function>>1) * 0x28) + \
        ((function&1) * 0xa0)) : (0x1408 + (function * 0x28)))
 #define XSTORM_E1HOV_OFFSET(function) \
-       (IS_E1H_OFFSET ? (0x2ab8 + (function * 0x2)) : 0xffffffff)
+       (IS_E1H_OFFSET ? (0x2c10 + (function * 0x2)) : 0xffffffff)
 #define XSTORM_ETH_STATS_QUERY_ADDR_OFFSET(function) \
        (IS_E1H_OFFSET ? (0x2418 + (function * 0x8)) : (0x3b70 + \
        (function * 0x8)))
 #define XSTORM_FAIRNESS_PER_VN_VARS_OFFSET(function) \
-       (IS_E1H_OFFSET ? (0x2568 + (function * 0x70)) : (0x3c60 + \
-       (function * 0x70)))
+       (IS_E1H_OFFSET ? (0x2588 + (function * 0x90)) : (0x3c80 + \
+       (function * 0x90)))
 #define XSTORM_FUNCTION_MODE_OFFSET \
-       (IS_E1H_OFFSET ? 0x2ac8 : 0xffffffff)
+       (IS_E1H_OFFSET ? 0x2c20 : 0xffffffff)
 #define XSTORM_HC_BTR_OFFSET(port) \
        (IS_E1H_OFFSET ? (0xa144 + (port * 0x30)) : (0x1454 + (port * 0x18)))
 #define XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, stats_counter_id) \
        (IS_E1H_OFFSET ? (0xc000 + (port * 0x3f0) + (stats_counter_id * \
        0x38)) : (0x3378 + (port * 0x3f0) + (stats_counter_id * 0x38)))
 #define XSTORM_RATE_SHAPING_PER_VN_VARS_OFFSET(function) \
-       (IS_E1H_OFFSET ? (0x2528 + (function * 0x70)) : (0x3c20 + \
-       (function * 0x70)))
+       (IS_E1H_OFFSET ? (0x2548 + (function * 0x90)) : (0x3c40 + \
+       (function * 0x90)))
 #define XSTORM_SPQ_PAGE_BASE_OFFSET(function) \
        (IS_E1H_OFFSET ? (0x2000 + (function * 0x10)) : (0x3328 + \
        (function * 0x10)))
 #define COMMON_ASM_INVALID_ASSERT_OPCODE 0x0
 
 /**
-* This file defines HSI constatnts for the ETH flow
+* This file defines HSI constants for the ETH flow
 */
 #ifdef _EVEREST_MICROCODE
 #include "microcode_constants.h"
 #define IPV6_HASH_TYPE 3
 #define TCP_IPV6_HASH_TYPE 4
 
-/* Ethernet Ring parmaters */
+
+/* Ethernet Ring parameters */
 #define X_ETH_LOCAL_RING_SIZE 13
 #define FIRST_BD_IN_PKT 0
 #define PARSE_BD_INDEX 1
-#define NUM_OF_ETH_BDS_IN_PAGE \
-       ((PAGE_SIZE) / (STRUCT_SIZE(eth_tx_bd)/8))
+#define NUM_OF_ETH_BDS_IN_PAGE ((PAGE_SIZE)/(STRUCT_SIZE(eth_tx_bd)/8))
 
 
 /* Rx ring params */
-#define U_ETH_LOCAL_BD_RING_SIZE (16)
-#define U_ETH_LOCAL_SGE_RING_SIZE (12)
-#define U_ETH_SGL_SIZE (8)
+#define U_ETH_LOCAL_BD_RING_SIZE 16
+#define U_ETH_LOCAL_SGE_RING_SIZE 12
+#define U_ETH_SGL_SIZE 8
 
 
 #define U_ETH_BDS_PER_PAGE_MASK \
 #define U_ETH_UNDEFINED_Q 0xFF
 
 /* values of command IDs in the ramrod message */
-#define RAMROD_CMD_ID_ETH_PORT_SETUP (80)
-#define RAMROD_CMD_ID_ETH_CLIENT_SETUP (85)
-#define RAMROD_CMD_ID_ETH_STAT_QUERY (90)
-#define RAMROD_CMD_ID_ETH_UPDATE (100)
-#define RAMROD_CMD_ID_ETH_HALT (105)
-#define RAMROD_CMD_ID_ETH_SET_MAC (110)
-#define RAMROD_CMD_ID_ETH_CFC_DEL (115)
-#define RAMROD_CMD_ID_ETH_PORT_DEL (120)
-#define RAMROD_CMD_ID_ETH_FORWARD_SETUP (125)
+#define RAMROD_CMD_ID_ETH_PORT_SETUP 80
+#define RAMROD_CMD_ID_ETH_CLIENT_SETUP 85
+#define RAMROD_CMD_ID_ETH_STAT_QUERY 90
+#define RAMROD_CMD_ID_ETH_UPDATE 100
+#define RAMROD_CMD_ID_ETH_HALT 105
+#define RAMROD_CMD_ID_ETH_SET_MAC 110
+#define RAMROD_CMD_ID_ETH_CFC_DEL 115
+#define RAMROD_CMD_ID_ETH_PORT_DEL 120
+#define RAMROD_CMD_ID_ETH_FORWARD_SETUP 125
 
 
 /* command values for set mac command */
 #define ETH_MAX_RX_CLIENTS_E1H 25
 
 /* Maximal aggregation queues supported */
-#define ETH_MAX_AGGREGATION_QUEUES_E1 (32)
-#define ETH_MAX_AGGREGATION_QUEUES_E1H (64)
+#define ETH_MAX_AGGREGATION_QUEUES_E1 32
+#define ETH_MAX_AGGREGATION_QUEUES_E1H 64
+
+/* ETH RSS modes */
+#define ETH_RSS_MODE_DISABLED 0
+#define ETH_RSS_MODE_REGULAR 1
 
 
 /**
-* This file defines HSI constatnts common to all microcode flows
+* This file defines HSI constants common to all microcode flows
 */
 
 /* Connection types */
 #define ETH_STATE (ETH_CONNECTION_TYPE << PROTOCOL_STATE_BIT_OFFSET)
 #define TOE_STATE (TOE_CONNECTION_TYPE << PROTOCOL_STATE_BIT_OFFSET)
 #define RDMA_STATE (RDMA_CONNECTION_TYPE << PROTOCOL_STATE_BIT_OFFSET)
-#define ISCSI_STATE \
-       (ISCSI_CONNECTION_TYPE << PROTOCOL_STATE_BIT_OFFSET)
-#define FCOE_STATE (FCOE_CONNECTION_TYPE << PROTOCOL_STATE_BIT_OFFSET)
 
 /* microcode fixed page page size 4K (chains and ring segments) */
-#define MC_PAGE_SIZE (4096)
+#define MC_PAGE_SIZE 4096
 
 
 /* Host coalescing constants */
 
 /* index numbers */
-#define HC_USTORM_DEF_SB_NUM_INDICES 4
+#define HC_USTORM_DEF_SB_NUM_INDICES 8
 #define HC_CSTORM_DEF_SB_NUM_INDICES 8
 #define HC_XSTORM_DEF_SB_NUM_INDICES 4
 #define HC_TSTORM_DEF_SB_NUM_INDICES 4
 #define HC_USTORM_SB_NUM_INDICES 4
 #define HC_CSTORM_SB_NUM_INDICES 4
 
-/* index values - which counterto update */
+/* index values - which counter to update */
 
 #define HC_INDEX_U_TOE_RX_CQ_CONS 0
 #define HC_INDEX_U_ETH_RX_CQ_CONS 1
 #define ATTENTION_ID 4
 
 /* max number of slow path commands per port */
-#define MAX_RAMRODS_PER_PORT (8)
+#define MAX_RAMRODS_PER_PORT 8
 
 /* values for RX ETH CQE type field */
-#define RX_ETH_CQE_TYPE_ETH_FASTPATH (0)
-#define RX_ETH_CQE_TYPE_ETH_RAMROD (1)
+#define RX_ETH_CQE_TYPE_ETH_FASTPATH 0
+#define RX_ETH_CQE_TYPE_ETH_RAMROD 1
 
 
 /**** DEFINES FOR TIMERS/CLOCKS RESOLUTIONS ****/
-#define EMULATION_FREQUENCY_FACTOR (1600)
-#define FPGA_FREQUENCY_FACTOR (100)
+#define EMULATION_FREQUENCY_FACTOR 1600
+#define FPGA_FREQUENCY_FACTOR 100
 
 #define TIMERS_TICK_SIZE_CHIP (1e-3)
 #define TIMERS_TICK_SIZE_EMUL \
 #define TSEMI_CLK1_RESUL_FPGA \
  ((TSEMI_CLK1_RESUL_CHIP)/(FPGA_FREQUENCY_FACTOR))
 
-#define USEMI_CLK1_RESUL_CHIP \
- (TIMERS_TICK_SIZE_CHIP)
-#define USEMI_CLK1_RESUL_EMUL \
- (TIMERS_TICK_SIZE_EMUL)
-#define USEMI_CLK1_RESUL_FPGA \
- (TIMERS_TICK_SIZE_FPGA)
+#define USEMI_CLK1_RESUL_CHIP (TIMERS_TICK_SIZE_CHIP)
+#define USEMI_CLK1_RESUL_EMUL (TIMERS_TICK_SIZE_EMUL)
+#define USEMI_CLK1_RESUL_FPGA (TIMERS_TICK_SIZE_FPGA)
 
 #define XSEMI_CLK1_RESUL_CHIP (1e-3)
 #define XSEMI_CLK1_RESUL_EMUL \
 #define XSTORM_IP_ID_ROLL_HALF 0x8000
 #define XSTORM_IP_ID_ROLL_ALL 0
 
-#define FW_LOG_LIST_SIZE (50)
+#define FW_LOG_LIST_SIZE 50
 
 #define NUM_OF_PROTOCOLS 4
-#define MAX_COS_NUMBER 16
+#define NUM_OF_SAFC_BITS 16
+#define MAX_COS_NUMBER 4
 #define MAX_T_STAT_COUNTER_ID 18
 #define MAX_X_STAT_COUNTER_ID 18
+#define MAX_U_STAT_COUNTER_ID 18
+
 
 #define UNKNOWN_ADDRESS 0
 #define UNICAST_ADDRESS 1
index efd764427fa12785284a924f2a8f7ca2e8dc98eb..03c62421d999ddb0e6687f7dde070b9fbd86f216 100644 (file)
@@ -1,6 +1,6 @@
 /* bnx2x_hsi.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2008 Broadcom Corporation
+ * Copyright (c) 2007-2009 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -119,35 +119,15 @@ struct shared_hw_cfg {                                     /* NVRAM Offset */
 #define SHARED_HW_CFG_UMP_NC_SI_EXT_PHY_TYPE_BCM5221 0x00010000
 
        u32 board;                                              /* 0x124 */
-#define SHARED_HW_CFG_BOARD_TYPE_MASK              0x0000ffff
-#define SHARED_HW_CFG_BOARD_TYPE_SHIFT             0
-#define SHARED_HW_CFG_BOARD_TYPE_NONE              0x00000000
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1000     0x00000001
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1001     0x00000002
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1002G    0x00000003
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1004G    0x00000004
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1007G    0x00000005
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1015G    0x00000006
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710A1020G    0x00000007
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710T1003G    0x00000008
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G    0x00000009
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G    0x0000000a
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710A1023G    0x0000000b
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957710A1033G    0x0000000c
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957711T1101     0x0000000d
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957711ET1201    0x0000000e
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957711A1133G    0x0000000f
-#define SHARED_HW_CFG_BOARD_TYPE_BCM957711EA1233G   0x00000010
-
-#define SHARED_HW_CFG_BOARD_VER_MASK               0xffff0000
-#define SHARED_HW_CFG_BOARD_VER_SHIFT              16
-#define SHARED_HW_CFG_BOARD_MAJOR_VER_MASK         0xf0000000
-#define SHARED_HW_CFG_BOARD_MAJOR_VER_SHIFT        28
-#define SHARED_HW_CFG_BOARD_MINOR_VER_MASK         0x0f000000
-#define SHARED_HW_CFG_BOARD_MINOR_VER_SHIFT        24
-#define SHARED_HW_CFG_BOARD_REV_MASK               0x00ff0000
+#define SHARED_HW_CFG_BOARD_REV_MASK               0x00FF0000
 #define SHARED_HW_CFG_BOARD_REV_SHIFT              16
 
+#define SHARED_HW_CFG_BOARD_MAJOR_VER_MASK         0x0F000000
+#define SHARED_HW_CFG_BOARD_MAJOR_VER_SHIFT        24
+
+#define SHARED_HW_CFG_BOARD_MINOR_VER_MASK         0xF0000000
+#define SHARED_HW_CFG_BOARD_MINOR_VER_SHIFT        28
+
        u32 reserved;                                           /* 0x128 */
 
 };
@@ -198,36 +178,21 @@ struct port_hw_cfg {                          /* port 0: 0x12c  port 1: 0x2bc */
        u32 rdma_mac_lower;
 
        u32 serdes_config;
-       /* for external PHY, or forced mode or during AN */
-#define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_MASK 0xffff0000
-#define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_SHIFT  16
+#define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_MASK          0x0000FFFF
+#define PORT_HW_CFG_SERDES_TX_DRV_PRE_EMPHASIS_SHIFT         0
 
-#define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_MASK    0x0000ffff
-#define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT   0
+#define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_MASK             0xFFFF0000
+#define PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT            16
 
-       u16 serdes_tx_driver_pre_emphasis[16];
-       u16 serdes_rx_driver_equalizer[16];
 
-       u32 xgxs_config_lane0;
-       u32 xgxs_config_lane1;
-       u32 xgxs_config_lane2;
-       u32 xgxs_config_lane3;
-       /* for external PHY, or forced mode or during AN */
-#define PORT_HW_CFG_XGXS_TX_DRV_PRE_EMPHASIS_MASK   0xffff0000
-#define PORT_HW_CFG_XGXS_TX_DRV_PRE_EMPHASIS_SHIFT  16
+       u32 Reserved0[16];                                  /* 0x158 */
 
-#define PORT_HW_CFG_XGXS_RX_DRV_EQUALIZER_MASK     0x0000ffff
-#define PORT_HW_CFG_XGXS_RX_DRV_EQUALIZER_SHIFT     0
+       /*  for external PHY, or forced mode or during AN */
+       u16 xgxs_config_rx[4];                              /* 0x198 */
 
-       u16 xgxs_tx_driver_pre_emphasis_lane0[16];
-       u16 xgxs_tx_driver_pre_emphasis_lane1[16];
-       u16 xgxs_tx_driver_pre_emphasis_lane2[16];
-       u16 xgxs_tx_driver_pre_emphasis_lane3[16];
+       u16 xgxs_config_tx[4];                              /* 0x1A0 */
 
-       u16 xgxs_rx_driver_equalizer_lane0[16];
-       u16 xgxs_rx_driver_equalizer_lane1[16];
-       u16 xgxs_rx_driver_equalizer_lane2[16];
-       u16 xgxs_rx_driver_equalizer_lane3[16];
+       u32 Reserved1[64];                                  /* 0x1A8 */
 
        u32 lane_config;
 #define PORT_HW_CFG_LANE_SWAP_CFG_MASK             0x0000ffff
@@ -265,7 +230,7 @@ struct port_hw_cfg {                            /* port 0: 0x12c  port 1: 0x2bc */
 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073      0x00000300
 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705      0x00000400
 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706      0x00000500
-#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8276      0x00000600
+#define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726      0x00000600
 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481      0x00000700
 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101      0x00000800
 #define PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE      0x0000fd00
@@ -319,6 +284,12 @@ struct shared_feat_cfg {                            /* NVRAM Offset */
 
        u32 config;                                             /* 0x450 */
 #define SHARED_FEATURE_BMC_ECHO_MODE_EN            0x00000001
+
+       /*  Use the values from options 47 and 48 instead of the HW default
+         values */
+#define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_DISABLED     0x00000000
+#define SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_ENABLED      0x00000002
+
 #define SHARED_FEATURE_MF_MODE_DISABLED            0x00000100
 
 };
@@ -372,6 +343,11 @@ struct port_feat_cfg {                         /* port 0: 0x454  port 1: 0x4c8 */
 #define PORT_FEATURE_MBA_ENABLED                   0x02000000
 #define PORT_FEATURE_MFW_ENABLED                   0x04000000
 
+       /*  Check the optic vendor via i2c before allowing it to be used by
+         SW */
+#define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_DISABLED              0x00000000
+#define PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_ENABLED               0x08000000
+
        u32 wol_config;
        /* Default is used when driver sets to "auto" mode */
 #define PORT_FEATURE_WOL_DEFAULT_MASK              0x00000003
@@ -512,7 +488,7 @@ struct port_feat_cfg {                          /* port 0: 0x454  port 1: 0x4c8 */
 /****************************************************************************
  * Device Information                                                      *
  ****************************************************************************/
-struct dev_info {                                                  /* size */
+struct shm_dev_info {                                              /* size */
 
        u32    bc_rev; /* 8 bits each: major, minor, build */          /* 4 */
 
@@ -641,7 +617,10 @@ struct drv_port_mb {
 
        u32 port_stx;
 
-       u32 reserved[2];
+       u32 stat_nig_timer;
+
+       /* MCP firmware does not use this field */
+       u32 ext_phy_fw_version;
 
 };
 
@@ -827,11 +806,7 @@ struct mf_cfg {
 
        struct shared_mf_cfg    shared_mf_config;
        struct port_mf_cfg      port_mf_config[PORT_MAX];
-#if defined(b710)
-       struct func_mf_cfg      func_mf_config[E1_FUNC_MAX];
-#else
        struct func_mf_cfg      func_mf_config[E1H_FUNC_MAX];
-#endif
 
 };
 
@@ -862,7 +837,7 @@ struct shmem_region {                              /*   SharedMem Offset (size) */
 #define SHR_MEM_VALIDITY_ACTIVE_MFW_NONE           0x000001c0
 #define SHR_MEM_VALIDITY_ACTIVE_MFW_MASK           0x000001c0
 
-       struct dev_info         dev_info;                /* 0x8     (0x438) */
+       struct shm_dev_info     dev_info;                /* 0x8     (0x438) */
 
        u8                      reserved[52*PORT_MAX];
 
@@ -1212,8 +1187,9 @@ struct host_func_stats {
 
 
 #define BCM_5710_FW_MAJOR_VERSION                      4
-#define BCM_5710_FW_MINOR_VERSION                      5
-#define BCM_5710_FW_REVISION_VERSION                   1
+#define BCM_5710_FW_MINOR_VERSION                      8
+#define BCM_5710_FW_REVISION_VERSION                   53
+#define BCM_5710_FW_ENGINEERING_VERSION                0
 #define BCM_5710_FW_COMPILE_FLAGS                      1
 
 
@@ -1221,18 +1197,12 @@ struct host_func_stats {
  * attention bits
  */
 struct atten_def_status_block {
-       u32 attn_bits;
-       u32 attn_bits_ack;
-#if defined(__BIG_ENDIAN)
-       u16 attn_bits_index;
-       u8 reserved0;
-       u8 status_block_id;
-#elif defined(__LITTLE_ENDIAN)
+       __le32 attn_bits;
+       __le32 attn_bits_ack;
        u8 status_block_id;
        u8 reserved0;
-       u16 attn_bits_index;
-#endif
-       u32 reserved1;
+       __le16 attn_bits_index;
+       __le32 reserved1;
 };
 
 
@@ -1305,7 +1275,7 @@ struct igu_ack_register {
  * Parser parsing flags field
  */
 struct parsing_flags {
-       u16 flags;
+       __le16 flags;
 #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE (0x1<<0)
 #define PARSING_FLAGS_ETHERNET_ADDRESS_TYPE_SHIFT 0
 #define PARSING_FLAGS_VLAN (0x1<<1)
@@ -1336,8 +1306,8 @@ struct parsing_flags {
 
 
 struct regpair {
-       u32 lo;
-       u32 hi;
+       __le32 lo;
+       __le32 hi;
 };
 
 
@@ -1434,8 +1404,10 @@ struct ustorm_eth_st_context_config {
 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_TPA_SHIFT 2
 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_SGE_RING (0x1<<3)
 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_SGE_RING_SHIFT 3
-#define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0 (0xF<<4)
-#define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0_SHIFT 4
+#define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS (0x1<<4)
+#define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS_SHIFT 4
+#define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0 (0x7<<5)
+#define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0_SHIFT 5
        u8 status_block_id;
        u8 clientId;
        u8 sb_index_numbers;
@@ -1460,14 +1432,18 @@ struct ustorm_eth_st_context_config {
 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_TPA_SHIFT 2
 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_SGE_RING (0x1<<3)
 #define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_SGE_RING_SHIFT 3
-#define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0 (0xF<<4)
-#define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0_SHIFT 4
+#define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS (0x1<<4)
+#define USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS_SHIFT 4
+#define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0 (0x7<<5)
+#define __USTORM_ETH_ST_CONTEXT_CONFIG_RESERVED0_SHIFT 5
 #endif
 #if defined(__BIG_ENDIAN)
        u16 bd_buff_size;
-       u16 mc_alignment_size;
+       u8 statistics_counter_id;
+       u8 mc_alignment_log_size;
 #elif defined(__LITTLE_ENDIAN)
-       u16 mc_alignment_size;
+       u8 mc_alignment_log_size;
+       u8 statistics_counter_id;
        u16 bd_buff_size;
 #endif
 #if defined(__BIG_ENDIAN)
@@ -1479,13 +1455,7 @@ struct ustorm_eth_st_context_config {
        u8 __local_bd_prod;
        u8 __local_sge_prod;
 #endif
-#if defined(__BIG_ENDIAN)
-       u16 __bd_cons;
-       u16 __sge_cons;
-#elif defined(__LITTLE_ENDIAN)
-       u16 __sge_cons;
-       u16 __bd_cons;
-#endif
+       u32 reserved;
        u32 bd_page_base_lo;
        u32 bd_page_base_hi;
        u32 sge_page_base_lo;
@@ -1496,16 +1466,16 @@ struct ustorm_eth_st_context_config {
  * The eth Rx Buffer Descriptor
  */
 struct eth_rx_bd {
-       u32 addr_lo;
-       u32 addr_hi;
+       __le32 addr_lo;
+       __le32 addr_hi;
 };
 
 /*
  * The eth Rx SGE Descriptor
  */
 struct eth_rx_sge {
-       u32 addr_lo;
-       u32 addr_hi;
+       __le32 addr_lo;
+       __le32 addr_hi;
 };
 
 /*
@@ -1697,7 +1667,7 @@ struct xstorm_eth_ag_context {
 };
 
 /*
- * The eth aggregative context section of Tstorm
+ * The eth extra aggregative context section of Tstorm
  */
 struct tstorm_eth_extra_ag_context_section {
        u32 __agg_val1;
@@ -1908,11 +1878,11 @@ struct eth_tx_bd_flags {
  * The eth Tx Buffer Descriptor
  */
 struct eth_tx_bd {
-       u32 addr_lo;
-       u32 addr_hi;
-       u16 nbd;
-       u16 nbytes;
-       u16 vlan;
+       __le32 addr_lo;
+       __le32 addr_hi;
+       __le16 nbd;
+       __le16 nbytes;
+       __le16 vlan;
        struct eth_tx_bd_flags bd_flags;
        u8 general_data;
 #define ETH_TX_BD_HDR_NBDS (0x3F<<0)
@@ -1955,11 +1925,11 @@ struct eth_tx_parse_bd {
 #define ETH_TX_PARSE_BD_CWR_FLG_SHIFT 7
        u8 ip_hlen;
        s8 cs_offset;
-       u16 total_hlen;
-       u16 lso_mss;
-       u16 tcp_pseudo_csum;
-       u16 ip_id;
-       u32 tcp_send_seq;
+       __le16 total_hlen;
+       __le16 lso_mss;
+       __le16 tcp_pseudo_csum;
+       __le16 ip_id;
+       __le32 tcp_send_seq;
 };
 
 /*
@@ -2075,44 +2045,44 @@ struct eth_tx_doorbell {
  * ustorm status block
  */
 struct ustorm_def_status_block {
-       u16 index_values[HC_USTORM_DEF_SB_NUM_INDICES];
-       u16 status_block_index;
+       __le16 index_values[HC_USTORM_DEF_SB_NUM_INDICES];
+       __le16 status_block_index;
        u8 func;
        u8 status_block_id;
-       u32 __flags;
+       __le32 __flags;
 };
 
 /*
  * cstorm status block
  */
 struct cstorm_def_status_block {
-       u16 index_values[HC_CSTORM_DEF_SB_NUM_INDICES];
-       u16 status_block_index;
+       __le16 index_values[HC_CSTORM_DEF_SB_NUM_INDICES];
+       __le16 status_block_index;
        u8 func;
        u8 status_block_id;
-       u32 __flags;
+       __le32 __flags;
 };
 
 /*
  * xstorm status block
  */
 struct xstorm_def_status_block {
-       u16 index_values[HC_XSTORM_DEF_SB_NUM_INDICES];
-       u16 status_block_index;
+       __le16 index_values[HC_XSTORM_DEF_SB_NUM_INDICES];
+       __le16 status_block_index;
        u8 func;
        u8 status_block_id;
-       u32 __flags;
+       __le32 __flags;
 };
 
 /*
  * tstorm status block
  */
 struct tstorm_def_status_block {
-       u16 index_values[HC_TSTORM_DEF_SB_NUM_INDICES];
-       u16 status_block_index;
+       __le16 index_values[HC_TSTORM_DEF_SB_NUM_INDICES];
+       __le16 status_block_index;
        u8 func;
        u8 status_block_id;
-       u32 __flags;
+       __le32 __flags;
 };
 
 /*
@@ -2131,22 +2101,22 @@ struct host_def_status_block {
  * ustorm status block
  */
 struct ustorm_status_block {
-       u16 index_values[HC_USTORM_SB_NUM_INDICES];
-       u16 status_block_index;
+       __le16 index_values[HC_USTORM_SB_NUM_INDICES];
+       __le16 status_block_index;
        u8 func;
        u8 status_block_id;
-       u32 __flags;
+       __le32 __flags;
 };
 
 /*
  * cstorm status block
  */
 struct cstorm_status_block {
-       u16 index_values[HC_CSTORM_SB_NUM_INDICES];
-       u16 status_block_index;
+       __le16 index_values[HC_CSTORM_SB_NUM_INDICES];
+       __le16 status_block_index;
        u8 func;
        u8 status_block_id;
-       u32 __flags;
+       __le32 __flags;
 };
 
 /*
@@ -2162,9 +2132,9 @@ struct host_status_block {
  * The data for RSS setup ramrod
  */
 struct eth_client_setup_ramrod_data {
-       u32 client_id_5b;
-       u8 is_rdma_1b;
-       u8 reserved0;
+       u32 client_id;
+       u8 is_rdma;
+       u8 is_fcoe;
        u16 reserved1;
 };
 
@@ -2212,12 +2182,12 @@ struct eth_fast_path_rx_cqe {
 #define ETH_FAST_PATH_RX_CQE_L4_XSUM_NO_VALIDATION_FLG_SHIFT 7
        u8 placement_offset;
        u8 queue_index;
-       u32 rss_hash_result;
-       u16 vlan_tag;
-       u16 pkt_len;
-       u16 len_on_bd;
+       __le32 rss_hash_result;
+       __le16 vlan_tag;
+       __le16 pkt_len;
+       __le16 len_on_bd;
        struct parsing_flags pars_flags;
-       u16 sgl[8];
+       __le16 sgl[8];
 };
 
 
@@ -2225,7 +2195,7 @@ struct eth_fast_path_rx_cqe {
  * The data for RSS setup ramrod
  */
 struct eth_halt_ramrod_data {
-       u32 client_id_5b;
+       u32 client_id;
        u32 reserved0;
 };
 
@@ -2236,11 +2206,11 @@ struct eth_halt_ramrod_data {
 struct eth_query_ramrod_data {
 #if defined(__BIG_ENDIAN)
        u8 reserved0;
-       u8 collect_port_1b;
+       u8 collect_port;
        u16 drv_counter;
 #elif defined(__LITTLE_ENDIAN)
        u16 drv_counter;
-       u8 collect_port_1b;
+       u8 collect_port;
        u8 reserved0;
 #endif
        u32 ctr_id_vector;
@@ -2251,8 +2221,8 @@ struct eth_query_ramrod_data {
  * Place holder for ramrods protocol specific data
  */
 struct ramrod_data {
-       u32 data_lo;
-       u32 data_hi;
+       __le32 data_lo;
+       __le32 data_hi;
 };
 
 /*
@@ -2263,16 +2233,6 @@ union eth_ramrod_data {
 };
 
 
-/*
- * Rx Last BD in page (in ETH)
- */
-struct eth_rx_bd_next_page {
-       u32 addr_lo;
-       u32 addr_hi;
-       u8 reserved[8];
-};
-
-
 /*
  * Eth Rx Cqe structure- general structure for ramrods
  */
@@ -2282,24 +2242,24 @@ struct common_ramrod_eth_rx_cqe {
 #define COMMON_RAMROD_ETH_RX_CQE_TYPE_SHIFT 0
 #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0 (0x7F<<1)
 #define COMMON_RAMROD_ETH_RX_CQE_RESERVED0_SHIFT 1
-       u8 conn_type_3b;
-       u16 reserved1;
-       u32 conn_and_cmd_data;
+       u8 conn_type;
+       __le16 reserved1;
+       __le32 conn_and_cmd_data;
 #define COMMON_RAMROD_ETH_RX_CQE_CID (0xFFFFFF<<0)
 #define COMMON_RAMROD_ETH_RX_CQE_CID_SHIFT 0
 #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID (0xFF<<24)
 #define COMMON_RAMROD_ETH_RX_CQE_CMD_ID_SHIFT 24
        struct ramrod_data protocol_data;
-       u32 reserved2[4];
+       __le32 reserved2[4];
 };
 
 /*
  * Rx Last CQE in page (in ETH)
  */
 struct eth_rx_cqe_next_page {
-       u32 addr_lo;
-       u32 addr_hi;
-       u32 reserved[6];
+       __le32 addr_lo;
+       __le32 addr_hi;
+       __le32 reserved[6];
 };
 
 /*
@@ -2316,17 +2276,17 @@ union eth_rx_cqe {
  * common data for all protocols
  */
 struct spe_hdr {
-       u32 conn_and_cmd_data;
+       __le32 conn_and_cmd_data;
 #define SPE_HDR_CID (0xFFFFFF<<0)
 #define SPE_HDR_CID_SHIFT 0
 #define SPE_HDR_CMD_ID (0xFF<<24)
 #define SPE_HDR_CMD_ID_SHIFT 24
-       u16 type;
+       __le16 type;
 #define SPE_HDR_CONN_TYPE (0xFF<<0)
 #define SPE_HDR_CONN_TYPE_SHIFT 0
 #define SPE_HDR_COMMON_RAMROD (0xFF<<8)
 #define SPE_HDR_COMMON_RAMROD_SHIFT 8
-       u16 reserved;
+       __le16 reserved;
 };
 
 /*
@@ -2355,9 +2315,9 @@ struct eth_spe {
  * doorbell data in host memory
  */
 struct eth_tx_db_data {
-       u32 packets_prod;
-       u16 bds_prod;
-       u16 reserved;
+       __le32 packets_prod;
+       __le16 bds_prod;
+       __le16 reserved;
 };
 
 
@@ -2377,14 +2337,16 @@ struct tstorm_eth_function_common_config {
 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_ENABLE (0x1<<4)
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_ENABLE_SHIFT 4
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE (0x1<<5)
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE_SHIFT 5
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM (0x1<<6)
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM_SHIFT 6
-#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0x1FF<<7)
-#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 7
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE (0x1<<7)
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE_SHIFT 7
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM (0x1<<8)
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM_SHIFT 8
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM (0x1<<9)
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM_SHIFT 9
+#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0x3F<<10)
+#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 10
 #elif defined(__LITTLE_ENDIAN)
        u16 config_flags;
 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV4_CAPABILITY (0x1<<0)
@@ -2395,14 +2357,16 @@ struct tstorm_eth_function_common_config {
 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_CAPABILITY_SHIFT 2
 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY (0x1<<3)
 #define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_IPV6_TCP_CAPABILITY_SHIFT 3
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_ENABLE (0x1<<4)
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_ENABLE_SHIFT 4
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE (0x1<<5)
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE_SHIFT 5
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM (0x1<<6)
-#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM_SHIFT 6
-#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0x1FF<<7)
-#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 7
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE (0x7<<4)
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_RSS_MODE_SHIFT 4
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE (0x1<<7)
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_DEFAULT_ENABLE_SHIFT 7
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM (0x1<<8)
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_VLAN_IN_CAM_SHIFT 8
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM (0x1<<9)
+#define TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM_SHIFT 9
+#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0 (0x3F<<10)
+#define __TSTORM_ETH_FUNCTION_COMMON_CONFIG_RESERVED0_SHIFT 10
        u8 rss_result_mask;
        u8 leading_client_id;
 #endif
@@ -2422,7 +2386,7 @@ struct eth_update_ramrod_data {
  * MAC filtering configuration command header
  */
 struct mac_configuration_hdr {
-       u8 length_6b;
+       u8 length;
        u8 offset;
        u16 client_id;
        u32 reserved1;
@@ -2432,10 +2396,10 @@ struct mac_configuration_hdr {
  * MAC address in list for ramrod
  */
 struct tstorm_cam_entry {
-       u16 lsb_mac_addr;
-       u16 middle_mac_addr;
-       u16 msb_mac_addr;
-       u16 flags;
+       __le16 lsb_mac_addr;
+       __le16 middle_mac_addr;
+       __le16 msb_mac_addr;
+       __le16 flags;
 #define TSTORM_CAM_ENTRY_PORT_ID (0x1<<0)
 #define TSTORM_CAM_ENTRY_PORT_ID_SHIFT 0
 #define TSTORM_CAM_ENTRY_RSRVVAL0 (0x7<<1)
@@ -2484,11 +2448,11 @@ struct mac_configuration_cmd {
  * MAC address in list for ramrod
  */
 struct mac_configuration_entry_e1h {
-       u16 lsb_mac_addr;
-       u16 middle_mac_addr;
-       u16 msb_mac_addr;
-       u16 vlan_id;
-       u16 e1hov_id;
+       __le16 lsb_mac_addr;
+       __le16 middle_mac_addr;
+       __le16 msb_mac_addr;
+       __le16 vlan_id;
+       __le16 e1hov_id;
        u8 client_id;
        u8 flags;
 #define MAC_CONFIGURATION_ENTRY_E1H_PORT (0x1<<0)
@@ -2544,24 +2508,28 @@ struct tstorm_eth_client_config {
 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED1 (0xFFF<<4)
 #define __TSTORM_ETH_CLIENT_CONFIG_RESERVED1_SHIFT 4
        u16 config_flags;
-#define TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE (0x1<<0)
-#define TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE_SHIFT 0
-#define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE (0x1<<1)
-#define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE_SHIFT 1
-#define TSTORM_ETH_CLIENT_CONFIG_ENABLE_SGE_RING (0x1<<2)
-#define TSTORM_ETH_CLIENT_CONFIG_ENABLE_SGE_RING_SHIFT 2
-#define __TSTORM_ETH_CLIENT_CONFIG_RESERVED0 (0x1FFF<<3)
-#define __TSTORM_ETH_CLIENT_CONFIG_RESERVED0_SHIFT 3
+#define TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE (0x1<<0)
+#define TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE_SHIFT 0
+#define TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE (0x1<<1)
+#define TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE_SHIFT 1
+#define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE (0x1<<2)
+#define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE_SHIFT 2
+#define TSTORM_ETH_CLIENT_CONFIG_ENABLE_SGE_RING (0x1<<3)
+#define TSTORM_ETH_CLIENT_CONFIG_ENABLE_SGE_RING_SHIFT 3
+#define __TSTORM_ETH_CLIENT_CONFIG_RESERVED0 (0xFFF<<4)
+#define __TSTORM_ETH_CLIENT_CONFIG_RESERVED0_SHIFT 4
 #elif defined(__LITTLE_ENDIAN)
        u16 config_flags;
-#define TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE (0x1<<0)
-#define TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE_SHIFT 0
-#define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE (0x1<<1)
-#define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE_SHIFT 1
-#define TSTORM_ETH_CLIENT_CONFIG_ENABLE_SGE_RING (0x1<<2)
-#define TSTORM_ETH_CLIENT_CONFIG_ENABLE_SGE_RING_SHIFT 2
-#define __TSTORM_ETH_CLIENT_CONFIG_RESERVED0 (0x1FFF<<3)
-#define __TSTORM_ETH_CLIENT_CONFIG_RESERVED0_SHIFT 3
+#define TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE (0x1<<0)
+#define TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE_SHIFT 0
+#define TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE (0x1<<1)
+#define TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE_SHIFT 1
+#define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE (0x1<<2)
+#define TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE_SHIFT 2
+#define TSTORM_ETH_CLIENT_CONFIG_ENABLE_SGE_RING (0x1<<3)
+#define TSTORM_ETH_CLIENT_CONFIG_ENABLE_SGE_RING_SHIFT 3
+#define __TSTORM_ETH_CLIENT_CONFIG_RESERVED0 (0xFFF<<4)
+#define __TSTORM_ETH_CLIENT_CONFIG_RESERVED0_SHIFT 4
        u16 drop_flags;
 #define TSTORM_ETH_CLIENT_CONFIG_DROP_IP_CS_ERR (0x1<<0)
 #define TSTORM_ETH_CLIENT_CONFIG_DROP_IP_CS_ERR_SHIFT 0
@@ -2593,10 +2561,62 @@ struct tstorm_eth_mac_filter_config {
 };
 
 
+/*
+ * common flag to indicate existance of TPA.
+ */
+struct tstorm_eth_tpa_exist {
+#if defined(__BIG_ENDIAN)
+       u16 reserved1;
+       u8 reserved0;
+       u8 tpa_exist;
+#elif defined(__LITTLE_ENDIAN)
+       u8 tpa_exist;
+       u8 reserved0;
+       u16 reserved1;
+#endif
+       u32 reserved2;
+};
+
+
+/*
+ * rx rings pause data for E1h only
+ */
+struct ustorm_eth_rx_pause_data_e1h {
+#if defined(__BIG_ENDIAN)
+       u16 bd_thr_low;
+       u16 cqe_thr_low;
+#elif defined(__LITTLE_ENDIAN)
+       u16 cqe_thr_low;
+       u16 bd_thr_low;
+#endif
+#if defined(__BIG_ENDIAN)
+       u16 cos;
+       u16 sge_thr_low;
+#elif defined(__LITTLE_ENDIAN)
+       u16 sge_thr_low;
+       u16 cos;
+#endif
+#if defined(__BIG_ENDIAN)
+       u16 bd_thr_high;
+       u16 cqe_thr_high;
+#elif defined(__LITTLE_ENDIAN)
+       u16 cqe_thr_high;
+       u16 bd_thr_high;
+#endif
+#if defined(__BIG_ENDIAN)
+       u16 reserved0;
+       u16 sge_thr_high;
+#elif defined(__LITTLE_ENDIAN)
+       u16 sge_thr_high;
+       u16 reserved0;
+#endif
+};
+
+
 /*
  * Three RX producers for ETH
  */
-struct tstorm_eth_rx_producers {
+struct ustorm_eth_rx_producers {
 #if defined(__BIG_ENDIAN)
        u16 bd_prod;
        u16 cqe_prod;
@@ -2614,39 +2634,24 @@ struct tstorm_eth_rx_producers {
 };
 
 
-/*
- * common flag to indicate existence of TPA.
- */
-struct tstorm_eth_tpa_exist {
-#if defined(__BIG_ENDIAN)
-       u16 reserved1;
-       u8 reserved0;
-       u8 tpa_exist;
-#elif defined(__LITTLE_ENDIAN)
-       u8 tpa_exist;
-       u8 reserved0;
-       u16 reserved1;
-#endif
-       u32 reserved2;
-};
-
-
 /*
  * per-port SAFC demo variables
  */
 struct cmng_flags_per_port {
        u8 con_number[NUM_OF_PROTOCOLS];
-#if defined(__BIG_ENDIAN)
-       u8 fairness_enable;
-       u8 rate_shaping_enable;
-       u8 cmng_protocol_enable;
-       u8 cmng_vn_enable;
-#elif defined(__LITTLE_ENDIAN)
-       u8 cmng_vn_enable;
-       u8 cmng_protocol_enable;
-       u8 rate_shaping_enable;
-       u8 fairness_enable;
-#endif
+       u32 cmng_enables;
+#define CMNG_FLAGS_PER_PORT_FAIRNESS_VN (0x1<<0)
+#define CMNG_FLAGS_PER_PORT_FAIRNESS_VN_SHIFT 0
+#define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN (0x1<<1)
+#define CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN_SHIFT 1
+#define CMNG_FLAGS_PER_PORT_FAIRNESS_PROTOCOL (0x1<<2)
+#define CMNG_FLAGS_PER_PORT_FAIRNESS_PROTOCOL_SHIFT 2
+#define CMNG_FLAGS_PER_PORT_RATE_SHAPING_PROTOCOL (0x1<<3)
+#define CMNG_FLAGS_PER_PORT_RATE_SHAPING_PROTOCOL_SHIFT 3
+#define CMNG_FLAGS_PER_PORT_FAIRNESS_COS (0x1<<4)
+#define CMNG_FLAGS_PER_PORT_FAIRNESS_COS_SHIFT 4
+#define __CMNG_FLAGS_PER_PORT_RESERVED0 (0x7FFFFFF<<5)
+#define __CMNG_FLAGS_PER_PORT_RESERVED0_SHIFT 5
 };
 
 
@@ -2674,15 +2679,15 @@ struct fairness_vars_per_port {
  */
 struct safc_struct_per_port {
 #if defined(__BIG_ENDIAN)
-       u16 __reserved0;
-       u8 cur_cos_types;
+       u16 __reserved1;
+       u8 __reserved0;
        u8 safc_timeout_usec;
 #elif defined(__LITTLE_ENDIAN)
        u8 safc_timeout_usec;
-       u8 cur_cos_types;
-       u16 __reserved0;
+       u8 __reserved0;
+       u16 __reserved1;
 #endif
-       u8 cos_to_protocol[MAX_COS_NUMBER];
+       u16 cos_to_pause_mask[NUM_OF_SAFC_BITS];
 };
 
 
@@ -2702,16 +2707,16 @@ struct cmng_struct_per_port {
  */
 struct xstorm_per_client_stats {
        struct regpair total_sent_bytes;
-       u32 total_sent_pkts;
-       u32 unicast_pkts_sent;
+       __le32 total_sent_pkts;
+       __le32 unicast_pkts_sent;
        struct regpair unicast_bytes_sent;
        struct regpair multicast_bytes_sent;
-       u32 multicast_pkts_sent;
-       u32 broadcast_pkts_sent;
+       __le32 multicast_pkts_sent;
+       __le32 broadcast_pkts_sent;
        struct regpair broadcast_bytes_sent;
-       u16 stats_counter;
-       u16 reserved0;
-       u32 reserved1;
+       __le16 stats_counter;
+       __le16 reserved0;
+       __le32 reserved1;
 };
 
 
@@ -2727,10 +2732,10 @@ struct xstorm_common_stats {
  * Protocol-common statistics collected by the Tstorm (per port)
  */
 struct tstorm_per_port_stats {
-       u32 mac_filter_discard;
-       u32 xxoverflow_discard;
-       u32 brb_truncate_discard;
-       u32 mac_discard;
+       __le32 mac_filter_discard;
+       __le32 xxoverflow_discard;
+       __le32 brb_truncate_discard;
+       __le32 mac_discard;
 };
 
 
@@ -2743,17 +2748,17 @@ struct tstorm_per_client_stats {
        struct regpair rcv_broadcast_bytes;
        struct regpair rcv_multicast_bytes;
        struct regpair rcv_error_bytes;
-       u32 checksum_discard;
-       u32 packets_too_big_discard;
-       u32 total_rcv_pkts;
-       u32 rcv_unicast_pkts;
-       u32 rcv_broadcast_pkts;
-       u32 rcv_multicast_pkts;
-       u32 no_buff_discard;
-       u32 ttl0_discard;
-       u16 stats_counter;
-       u16 reserved0;
-       u32 reserved1;
+       __le32 checksum_discard;
+       __le32 packets_too_big_discard;
+       __le32 total_rcv_pkts;
+       __le32 rcv_unicast_pkts;
+       __le32 rcv_broadcast_pkts;
+       __le32 rcv_multicast_pkts;
+       __le32 no_buff_discard;
+       __le32 ttl0_discard;
+       __le16 stats_counter;
+       __le16 reserved0;
+       __le32 reserved1;
 };
 
 /*
@@ -2764,12 +2769,34 @@ struct tstorm_common_stats {
  struct tstorm_per_client_stats client_statistics[MAX_T_STAT_COUNTER_ID];
 };
 
+/*
+ * Protocol-common statistics collected by the Ustorm (per client)
+ */
+struct ustorm_per_client_stats {
+       struct regpair ucast_no_buff_bytes;
+       struct regpair mcast_no_buff_bytes;
+       struct regpair bcast_no_buff_bytes;
+       __le32 ucast_no_buff_pkts;
+       __le32 mcast_no_buff_pkts;
+       __le32 bcast_no_buff_pkts;
+       __le16 stats_counter;
+       __le16 reserved0;
+};
+
+/*
+ * Protocol-common statistics collected by the Ustorm
+ */
+struct ustorm_common_stats {
+ struct ustorm_per_client_stats client_statistics[MAX_U_STAT_COUNTER_ID];
+};
+
 /*
  * Eth statistics query structure for the eth_stats_query ramrod
  */
 struct eth_stats_query {
        struct xstorm_common_stats xstorm_common;
        struct tstorm_common_stats tstorm_common;
+       struct ustorm_common_stats ustorm_common;
 };
 
 
@@ -2777,6 +2804,7 @@ struct eth_stats_query {
  * per-vnic fairness variables
  */
 struct fairness_vars_per_vn {
+       u32 cos_credit_delta[MAX_COS_NUMBER];
        u32 protocol_credit_delta[NUM_OF_PROTOCOLS];
        u32 vn_credit_delta;
        u32 __reserved0;
@@ -2788,13 +2816,15 @@ struct fairness_vars_per_vn {
  */
 struct fw_version {
 #if defined(__BIG_ENDIAN)
-       u16 patch;
-       u8 primary;
-       u8 client;
+       u8 engineering;
+       u8 revision;
+       u8 minor;
+       u8 major;
 #elif defined(__LITTLE_ENDIAN)
-       u8 client;
-       u8 primary;
-       u16 patch;
+       u8 major;
+       u8 minor;
+       u8 revision;
+       u8 engineering;
 #endif
        u32 flags;
 #define FW_VERSION_OPTIMIZED (0x1<<0)
@@ -2812,9 +2842,10 @@ struct fw_version {
  * FW version stored in first line of pram
  */
 struct pram_fw_version {
-       u8 client;
-       u8 primary;
-       u16 patch;
+       u8 major;
+       u8 minor;
+       u8 revision;
+       u8 engineering;
        u8 flags;
 #define PRAM_FW_VERSION_OPTIMIZED (0x1<<0)
 #define PRAM_FW_VERSION_OPTIMIZED_SHIFT 0
index a6c0b3abba290a9cd75c7b7c4a764874c4e55801..8af27573afe804495a8f34bfd6fee958f1072f2c 100644 (file)
@@ -1,6 +1,6 @@
 /* bnx2x_init.h: Broadcom Everest network driver.
  *
- * Copyright (c) 2007-2008 Broadcom Corporation
+ * Copyright (c) 2007-2009 Broadcom Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -274,6 +274,9 @@ static void bnx2x_init_wr_wb(struct bnx2x *bp, u32 addr, const u32 *data,
                rc = bnx2x_gunzip(bp, (u8 *)data, len);
                if (rc) {
                        BNX2X_ERR("gunzip failed ! rc %d\n", rc);
+#ifdef __BIG_ENDIAN
+                       kfree(temp);
+#endif
                        return;
                }
                len = bp->gunzip_outlen;
@@ -426,57 +429,57 @@ struct arb_line {
 
 /* derived configuration for each read queue for each max request size */
 static const struct arb_line read_arb_data[NUM_RD_Q][MAX_RD_ORD + 1] = {
-       {{8 , 64 , 25}, {16 , 64 , 25}, {32 , 64 , 25}, {64 , 64 , 41} },
-       {{4 , 8 , 4},   {4 , 8 , 4},    {4 , 8 , 4},    {4 , 8 , 4} },
-       {{4 , 3 , 3},   {4 , 3 , 3},    {4 , 3 , 3},    {4 , 3 , 3} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {16 , 3 , 11},  {16 , 3 , 11} },
-       {{8 , 64 , 25}, {16 , 64 , 25}, {32 , 64 , 25}, {64 , 64 , 41} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {64 , 3 , 41} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {64 , 3 , 41} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {64 , 3 , 41} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {64 , 3 , 41} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 3 , 6},   {16 , 3 , 11},  {32 , 3 , 21},  {32 , 3 , 21} },
-       {{8 , 64 , 25}, {16 , 64 , 41}, {32 , 64 , 81}, {64 , 64 , 120} }
+/* 1 */        { {8, 64, 25}, {16, 64, 25}, {32, 64, 25}, {64, 64, 41} },
+       { {4, 8,  4},  {4,  8,  4},  {4,  8,  4},  {4,  8,  4}  },
+       { {4, 3,  3},  {4,  3,  3},  {4,  3,  3},  {4,  3,  3}  },
+       { {8, 3,  6},  {16, 3,  11}, {16, 3,  11}, {16, 3,  11} },
+       { {8, 64, 25}, {16, 64, 25}, {32, 64, 25}, {64, 64, 41} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {64, 3,  41} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {64, 3,  41} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {64, 3,  41} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {64, 3,  41} },
+/* 10 */{ {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+/* 20 */{ {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 3,  6},  {16, 3,  11}, {32, 3,  21}, {32, 3,  21} },
+       { {8, 64, 25}, {16, 64, 41}, {32, 64, 81}, {64, 64, 120} }
 };
 
 /* derived configuration for each write queue for each max request size */
 static const struct arb_line write_arb_data[NUM_WR_Q][MAX_WR_ORD + 1] = {
-       {{4 , 6 , 3},   {4 , 6 , 3},    {4 , 6 , 3} },
-       {{4 , 2 , 3},   {4 , 2 , 3},    {4 , 2 , 3} },
-       {{8 , 2 , 6},   {16 , 2 , 11},  {16 , 2 , 11} },
-       {{8 , 2 , 6},   {16 , 2 , 11},  {32 , 2 , 21} },
-       {{8 , 2 , 6},   {16 , 2 , 11},  {32 , 2 , 21} },
-       {{8 , 2 , 6},   {16 , 2 , 11},  {32 , 2 , 21} },
-       {{8 , 64 , 25}, {16 , 64 , 25}, {32 , 64 , 25} },
-       {{8 , 2 , 6},   {16 , 2 , 11},  {16 , 2 , 11} },
-       {{8 , 2 , 6},   {16 , 2 , 11},  {16 , 2 , 11} },
-       {{8 , 9 , 6},   {16 , 9 , 11},  {32 , 9 , 21} },
-       {{8 , 47 , 19}, {16 , 47 , 19}, {32 , 47 , 21} },
-       {{8 , 9 , 6},   {16 , 9 , 11},  {16 , 9 , 11} },
-       {{8 , 64 , 25}, {16 , 64 , 41}, {32 , 64 , 81} }
+/* 1 */        { {4, 6,  3},  {4,  6,  3},  {4,  6,  3} },
+       { {4, 2,  3},  {4,  2,  3},  {4,  2,  3} },
+       { {8, 2,  6},  {16, 2,  11}, {16, 2,  11} },
+       { {8, 2,  6},  {16, 2,  11}, {32, 2,  21} },
+       { {8, 2,  6},  {16, 2,  11}, {32, 2,  21} },
+       { {8, 2,  6},  {16, 2,  11}, {32, 2,  21} },
+       { {8, 64, 25}, {16, 64, 25}, {32, 64, 25} },
+       { {8, 2,  6},  {16, 2,  11}, {16, 2,  11} },
+       { {8, 2,  6},  {16, 2,  11}, {16, 2,  11} },
+/* 10 */{ {8, 9,  6},  {16, 9,  11}, {32, 9,  21} },
+       { {8, 47, 19}, {16, 47, 19}, {32, 47, 21} },
+       { {8, 9,  6},  {16, 9,  11}, {16, 9,  11} },
+       { {8, 64, 25}, {16, 64, 41}, {32, 64, 81} }
 };
 
 /* register addresses for read queues */
 static const struct arb_line read_arb_addr[NUM_RD_Q-1] = {
-       {PXP2_REG_RQ_BW_RD_L0, PXP2_REG_RQ_BW_RD_ADD0,
+/* 1 */        {PXP2_REG_RQ_BW_RD_L0, PXP2_REG_RQ_BW_RD_ADD0,
                PXP2_REG_RQ_BW_RD_UBOUND0},
        {PXP2_REG_PSWRQ_BW_L1, PXP2_REG_PSWRQ_BW_ADD1,
                PXP2_REG_PSWRQ_BW_UB1},
@@ -494,7 +497,7 @@ static const struct arb_line read_arb_addr[NUM_RD_Q-1] = {
                PXP2_REG_PSWRQ_BW_UB7},
        {PXP2_REG_PSWRQ_BW_L8, PXP2_REG_PSWRQ_BW_ADD8,
                PXP2_REG_PSWRQ_BW_UB8},
-       {PXP2_REG_PSWRQ_BW_L9, PXP2_REG_PSWRQ_BW_ADD9,
+/* 10 */{PXP2_REG_PSWRQ_BW_L9, PXP2_REG_PSWRQ_BW_ADD9,
                PXP2_REG_PSWRQ_BW_UB9},
        {PXP2_REG_PSWRQ_BW_L10, PXP2_REG_PSWRQ_BW_ADD10,
                PXP2_REG_PSWRQ_BW_UB10},
@@ -514,7 +517,7 @@ static const struct arb_line read_arb_addr[NUM_RD_Q-1] = {
                PXP2_REG_RQ_BW_RD_UBOUND17},
        {PXP2_REG_RQ_BW_RD_L18, PXP2_REG_RQ_BW_RD_ADD18,
                PXP2_REG_RQ_BW_RD_UBOUND18},
-       {PXP2_REG_RQ_BW_RD_L19, PXP2_REG_RQ_BW_RD_ADD19,
+/* 20 */{PXP2_REG_RQ_BW_RD_L19, PXP2_REG_RQ_BW_RD_ADD19,
                PXP2_REG_RQ_BW_RD_UBOUND19},
        {PXP2_REG_RQ_BW_RD_L20, PXP2_REG_RQ_BW_RD_ADD20,
                PXP2_REG_RQ_BW_RD_UBOUND20},
@@ -536,7 +539,7 @@ static const struct arb_line read_arb_addr[NUM_RD_Q-1] = {
 
 /* register addresses for write queues */
 static const struct arb_line write_arb_addr[NUM_WR_Q-1] = {
-       {PXP2_REG_PSWRQ_BW_L1, PXP2_REG_PSWRQ_BW_ADD1,
+/* 1 */        {PXP2_REG_PSWRQ_BW_L1, PXP2_REG_PSWRQ_BW_ADD1,
                PXP2_REG_PSWRQ_BW_UB1},
        {PXP2_REG_PSWRQ_BW_L2, PXP2_REG_PSWRQ_BW_ADD2,
                PXP2_REG_PSWRQ_BW_UB2},
@@ -554,7 +557,7 @@ static const struct arb_line write_arb_addr[NUM_WR_Q-1] = {
                PXP2_REG_PSWRQ_BW_UB10},
        {PXP2_REG_PSWRQ_BW_L11, PXP2_REG_PSWRQ_BW_ADD11,
                PXP2_REG_PSWRQ_BW_UB11},
-       {PXP2_REG_PSWRQ_BW_L28, PXP2_REG_PSWRQ_BW_ADD28,
+/* 10 */{PXP2_REG_PSWRQ_BW_L28, PXP2_REG_PSWRQ_BW_ADD28,
                PXP2_REG_PSWRQ_BW_UB28},
        {PXP2_REG_RQ_BW_WR_L29, PXP2_REG_RQ_BW_WR_ADD29,
                PXP2_REG_RQ_BW_WR_UBOUND29},
@@ -572,7 +575,12 @@ static void bnx2x_init_pxp(struct bnx2x *bp)
                             bp->pcie_cap + PCI_EXP_DEVCTL, &devctl);
        DP(NETIF_MSG_HW, "read 0x%x from devctl\n", devctl);
        w_order = ((devctl & PCI_EXP_DEVCTL_PAYLOAD) >> 5);
-       r_order = ((devctl & PCI_EXP_DEVCTL_READRQ) >> 12);
+       if (bp->mrrs == -1)
+               r_order = ((devctl & PCI_EXP_DEVCTL_READRQ) >> 12);
+       else {
+               DP(NETIF_MSG_HW, "force read order to %d\n", bp->mrrs);
+               r_order = bp->mrrs;
+       }
 
        if (r_order > MAX_RD_ORD) {
                DP(NETIF_MSG_HW, "read order of %d  order adjusted to %d\n",
@@ -647,17 +655,18 @@ static void bnx2x_init_pxp(struct bnx2x *bp)
        REG_WR(bp, PXP2_REG_WR_USDMDP_TH, (0x18 << w_order));
 
        if (CHIP_IS_E1H(bp)) {
-               REG_WR(bp, PXP2_REG_WR_HC_MPS, w_order+1);
-               REG_WR(bp, PXP2_REG_WR_USDM_MPS, w_order+1);
-               REG_WR(bp, PXP2_REG_WR_CSDM_MPS, w_order+1);
-               REG_WR(bp, PXP2_REG_WR_TSDM_MPS, w_order+1);
-               REG_WR(bp, PXP2_REG_WR_XSDM_MPS, w_order+1);
-               REG_WR(bp, PXP2_REG_WR_QM_MPS, w_order+1);
-               REG_WR(bp, PXP2_REG_WR_TM_MPS, w_order+1);
-               REG_WR(bp, PXP2_REG_WR_SRC_MPS, w_order+1);
-               REG_WR(bp, PXP2_REG_WR_DBG_MPS, w_order+1);
+               val = ((w_order == 0) ? 2 : 3);
+               REG_WR(bp, PXP2_REG_WR_HC_MPS, val);
+               REG_WR(bp, PXP2_REG_WR_USDM_MPS, val);
+               REG_WR(bp, PXP2_REG_WR_CSDM_MPS, val);
+               REG_WR(bp, PXP2_REG_WR_TSDM_MPS, val);
+               REG_WR(bp, PXP2_REG_WR_XSDM_MPS, val);
+               REG_WR(bp, PXP2_REG_WR_QM_MPS, val);
+               REG_WR(bp, PXP2_REG_WR_TM_MPS, val);
+               REG_WR(bp, PXP2_REG_WR_SRC_MPS, val);
+               REG_WR(bp, PXP2_REG_WR_DBG_MPS, val);
                REG_WR(bp, PXP2_REG_WR_DMAE_MPS, 2); /* DMAE is special */
-               REG_WR(bp, PXP2_REG_WR_CDU_MPS, w_order+1);
+               REG_WR(bp, PXP2_REG_WR_CDU_MPS, val);
        }
 }
 
index 9755bf6b08ddff3b4abe47fd2d573e3676912dee..6e18a556fb5e7d02676b6ebbdb607518e702f458 100644 (file)
@@ -47,12 +47,16 @@ static const struct raw_op init_ops[] = {
        {OP_WR, PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_1, 0x10100000},
        {OP_WR, PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_2, 0x20100000},
        {OP_WR, PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_3, 0x30100000},
-       {OP_ZR, PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_4, 0x4},
+       {OP_ZR_E1, PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_4, 0x4},
+       {OP_WR_E1H, PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_4, 0x40100000},
+       {OP_ZR_E1H, PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_5, 0x3},
        {OP_WR, PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_0, 0x100000},
        {OP_WR, PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_1, 0x12140000},
        {OP_WR, PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_2, 0x22140000},
        {OP_WR, PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_3, 0x32140000},
-       {OP_ZR, PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_4, 0x4},
+       {OP_ZR_E1, PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_4, 0x4},
+       {OP_WR_E1H, PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_4, 0x42140000},
+       {OP_ZR_E1H, PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_5, 0x3},
        {OP_RD, PRS_REG_NUM_OF_PACKETS, 0x0},
        {OP_RD, PRS_REG_NUM_OF_CFC_FLUSH_MESSAGES, 0x0},
        {OP_RD, PRS_REG_NUM_OF_TRANSPARENT_FLUSH_MESSAGES, 0x0},
@@ -71,15 +75,16 @@ static const struct raw_op init_ops[] = {
        {OP_WR, PRS_REG_PACKET_REGIONS_TYPE_1, 0x3f},
        {OP_WR, PRS_REG_PACKET_REGIONS_TYPE_2, 0x3f},
        {OP_WR, PRS_REG_PACKET_REGIONS_TYPE_3, 0x3f},
-       {OP_WR, PRS_REG_PACKET_REGIONS_TYPE_4, 0x0},
+       {OP_WR_E1, PRS_REG_PACKET_REGIONS_TYPE_4, 0x0},
+       {OP_WR_E1H, PRS_REG_PACKET_REGIONS_TYPE_4, 0x3f},
        {OP_WR, PRS_REG_PACKET_REGIONS_TYPE_5, 0x3f},
        {OP_WR, PRS_REG_PACKET_REGIONS_TYPE_6, 0x3f},
        {OP_WR, PRS_REG_PACKET_REGIONS_TYPE_7, 0x3f},
-#define PRS_COMMON_END          47
-#define SRCH_COMMON_START       47
+#define PRS_COMMON_END          52
+#define SRCH_COMMON_START       52
        {OP_WR_E1H, SRC_REG_E1HMF_ENABLE, 0x1},
-#define SRCH_COMMON_END         48
-#define TSDM_COMMON_START       48
+#define SRCH_COMMON_END         53
+#define TSDM_COMMON_START       53
        {OP_WR_E1, TSDM_REG_CFC_RSP_START_ADDR, 0x411},
        {OP_WR_E1H, TSDM_REG_CFC_RSP_START_ADDR, 0x211},
        {OP_WR_E1, TSDM_REG_CMP_COUNTER_START_ADDR, 0x400},
@@ -92,10 +97,15 @@ static const struct raw_op init_ops[] = {
        {OP_WR, TSDM_REG_CMP_COUNTER_MAX1, 0xffff},
        {OP_WR, TSDM_REG_CMP_COUNTER_MAX2, 0xffff},
        {OP_WR, TSDM_REG_CMP_COUNTER_MAX3, 0xffff},
-       {OP_ZR, TSDM_REG_AGG_INT_EVENT_0, 0x2},
+       {OP_ZR_E1, TSDM_REG_AGG_INT_EVENT_0, 0x2},
+       {OP_WR_E1H, TSDM_REG_AGG_INT_EVENT_0, 0x20},
+       {OP_WR_E1H, TSDM_REG_AGG_INT_EVENT_1, 0x0},
        {OP_WR, TSDM_REG_AGG_INT_EVENT_2, 0x34},
        {OP_WR, TSDM_REG_AGG_INT_EVENT_3, 0x35},
-       {OP_ZR, TSDM_REG_AGG_INT_EVENT_4, 0x7c},
+       {OP_ZR_E1, TSDM_REG_AGG_INT_EVENT_4, 0x7c},
+       {OP_ZR_E1H, TSDM_REG_AGG_INT_EVENT_4, 0x1c},
+       {OP_WR_E1H, TSDM_REG_AGG_INT_T_0, 0x1},
+       {OP_ZR_E1H, TSDM_REG_AGG_INT_T_1, 0x5f},
        {OP_WR, TSDM_REG_ENABLE_IN1, 0x7ffffff},
        {OP_WR, TSDM_REG_ENABLE_IN2, 0x3f},
        {OP_WR, TSDM_REG_ENABLE_OUT1, 0x7ffffff},
@@ -118,8 +128,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_ASIC, TSDM_REG_TIMER_TICK, 0x3e8},
        {OP_WR_EMUL, TSDM_REG_TIMER_TICK, 0x1},
        {OP_WR_FPGA, TSDM_REG_TIMER_TICK, 0xa},
-#define TSDM_COMMON_END         86
-#define TCM_COMMON_START        86
+#define TSDM_COMMON_END         96
+#define TCM_COMMON_START        96
        {OP_WR, TCM_REG_XX_MAX_LL_SZ, 0x20},
        {OP_WR, TCM_REG_XX_OVFL_EVNT_ID, 0x32},
        {OP_WR, TCM_REG_TQM_TCM_HDR_P, 0x2150020},
@@ -129,10 +139,16 @@ static const struct raw_op init_ops[] = {
        {OP_WR, TCM_REG_ERR_EVNT_ID, 0x33},
        {OP_WR, TCM_REG_EXPR_EVNT_ID, 0x30},
        {OP_WR, TCM_REG_STOP_EVNT_ID, 0x31},
-       {OP_WR, TCM_REG_PRS_WEIGHT, 0x4},
-       {OP_WR, TCM_REG_PBF_WEIGHT, 0x5},
+       {OP_WR, TCM_REG_STORM_WEIGHT, 0x2},
+       {OP_WR, TCM_REG_PRS_WEIGHT, 0x5},
+       {OP_WR, TCM_REG_PBF_WEIGHT, 0x6},
+       {OP_WR, TCM_REG_USEM_WEIGHT, 0x2},
+       {OP_WR, TCM_REG_CSEM_WEIGHT, 0x2},
        {OP_WR, TCM_REG_CP_WEIGHT, 0x0},
-       {OP_WR, TCM_REG_TSDM_WEIGHT, 0x4},
+       {OP_WR, TCM_REG_TSDM_WEIGHT, 0x5},
+       {OP_WR, TCM_REG_TQM_P_WEIGHT, 0x2},
+       {OP_WR, TCM_REG_TQM_S_WEIGHT, 0x2},
+       {OP_WR, TCM_REG_TM_WEIGHT, 0x2},
        {OP_WR, TCM_REG_TCM_TQM_USE_Q, 0x1},
        {OP_WR, TCM_REG_GR_ARB_TYPE, 0x1},
        {OP_WR, TCM_REG_GR_LD0_PR, 0x1},
@@ -149,7 +165,9 @@ static const struct raw_op init_ops[] = {
        {OP_WR, TCM_REG_N_SM_CTX_LD_1, 0x7},
        {OP_WR, TCM_REG_N_SM_CTX_LD_2, 0x8},
        {OP_WR, TCM_REG_N_SM_CTX_LD_3, 0x8},
-       {OP_ZR, TCM_REG_N_SM_CTX_LD_4, 0x4},
+       {OP_ZR_E1, TCM_REG_N_SM_CTX_LD_4, 0x4},
+       {OP_WR_E1H, TCM_REG_N_SM_CTX_LD_4, 0x1},
+       {OP_ZR_E1H, TCM_REG_N_SM_CTX_LD_5, 0x3},
        {OP_WR, TCM_REG_TCM_REG0_SZ, 0x6},
        {OP_WR_E1, TCM_REG_PHYS_QNUM0_0, 0xd},
        {OP_WR_E1, TCM_REG_PHYS_QNUM0_1, 0x2d},
@@ -175,75 +193,75 @@ static const struct raw_op init_ops[] = {
        {OP_WR, TCM_REG_CDU_SM_WR_IFEN, 0x1},
        {OP_WR, TCM_REG_CDU_SM_RD_IFEN, 0x1},
        {OP_WR, TCM_REG_TCM_CFC_IFEN, 0x1},
-#define TCM_COMMON_END          141
-#define TCM_FUNC0_START         141
+#define TCM_COMMON_END          159
+#define TCM_FUNC0_START         159
        {OP_WR_E1H, TCM_REG_PHYS_QNUM0_0, 0xd},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM1_0, 0x7},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM2_0, 0x7},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM3_0, 0x7},
-#define TCM_FUNC0_END           145
-#define TCM_FUNC1_START         145
+#define TCM_FUNC0_END           163
+#define TCM_FUNC1_START         163
        {OP_WR_E1H, TCM_REG_PHYS_QNUM0_1, 0x2d},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM1_1, 0x27},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM2_1, 0x27},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM3_1, 0x27},
-#define TCM_FUNC1_END           149
-#define TCM_FUNC2_START         149
+#define TCM_FUNC1_END           167
+#define TCM_FUNC2_START         167
        {OP_WR_E1H, TCM_REG_PHYS_QNUM0_0, 0x1d},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM1_0, 0x17},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM2_0, 0x17},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM3_0, 0x17},
-#define TCM_FUNC2_END           153
-#define TCM_FUNC3_START         153
+#define TCM_FUNC2_END           171
+#define TCM_FUNC3_START         171
        {OP_WR_E1H, TCM_REG_PHYS_QNUM0_1, 0x3d},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM1_1, 0x37},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM2_1, 0x37},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM3_1, 0x37},
-#define TCM_FUNC3_END           157
-#define TCM_FUNC4_START         157
+#define TCM_FUNC3_END           175
+#define TCM_FUNC4_START         175
        {OP_WR_E1H, TCM_REG_PHYS_QNUM0_0, 0x4d},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM1_0, 0x47},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM2_0, 0x47},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM3_0, 0x47},
-#define TCM_FUNC4_END           161
-#define TCM_FUNC5_START         161
+#define TCM_FUNC4_END           179
+#define TCM_FUNC5_START         179
        {OP_WR_E1H, TCM_REG_PHYS_QNUM0_1, 0x6d},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM1_1, 0x67},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM2_1, 0x67},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM3_1, 0x67},
-#define TCM_FUNC5_END           165
-#define TCM_FUNC6_START         165
+#define TCM_FUNC5_END           183
+#define TCM_FUNC6_START         183
        {OP_WR_E1H, TCM_REG_PHYS_QNUM0_0, 0x5d},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM1_0, 0x57},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM2_0, 0x57},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM3_0, 0x57},
-#define TCM_FUNC6_END           169
-#define TCM_FUNC7_START         169
+#define TCM_FUNC6_END           187
+#define TCM_FUNC7_START         187
        {OP_WR_E1H, TCM_REG_PHYS_QNUM0_1, 0x7d},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM1_1, 0x77},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM2_1, 0x77},
        {OP_WR_E1H, TCM_REG_PHYS_QNUM3_1, 0x77},
-#define TCM_FUNC7_END           173
-#define BRB1_COMMON_START       173
+#define TCM_FUNC7_END           191
+#define BRB1_COMMON_START       191
        {OP_SW, BRB1_REG_LL_RAM, 0x2000020},
        {OP_WR, BRB1_REG_SOFT_RESET, 0x1},
        {OP_RD, BRB1_REG_NUM_OF_FULL_CYCLES_4, 0x0},
        {OP_SW, BRB1_REG_FREE_LIST_PRS_CRDT, 0x30220},
        {OP_WR, BRB1_REG_SOFT_RESET, 0x0},
-#define BRB1_COMMON_END         178
-#define BRB1_PORT0_START        178
+#define BRB1_COMMON_END         196
+#define BRB1_PORT0_START        196
        {OP_WR_E1, BRB1_REG_PAUSE_LOW_THRESHOLD_0, 0xb8},
        {OP_WR_E1, BRB1_REG_PAUSE_HIGH_THRESHOLD_0, 0x114},
        {OP_RD, BRB1_REG_NUM_OF_PAUSE_CYCLES_0, 0x0},
        {OP_RD, BRB1_REG_NUM_OF_FULL_CYCLES_0, 0x0},
-#define BRB1_PORT0_END          182
-#define BRB1_PORT1_START        182
+#define BRB1_PORT0_END          200
+#define BRB1_PORT1_START        200
        {OP_WR_E1, BRB1_REG_PAUSE_LOW_THRESHOLD_1, 0xb8},
        {OP_WR_E1, BRB1_REG_PAUSE_HIGH_THRESHOLD_1, 0x114},
        {OP_RD, BRB1_REG_NUM_OF_PAUSE_CYCLES_1, 0x0},
        {OP_RD, BRB1_REG_NUM_OF_FULL_CYCLES_1, 0x0},
-#define BRB1_PORT1_END          186
-#define TSEM_COMMON_START       186
+#define BRB1_PORT1_END          204
+#define TSEM_COMMON_START       204
        {OP_RD, TSEM_REG_MSG_NUM_FIC0, 0x0},
        {OP_RD, TSEM_REG_MSG_NUM_FIC1, 0x0},
        {OP_RD, TSEM_REG_MSG_NUM_FOC0, 0x0},
@@ -303,143 +321,166 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0xa020, 0xc8},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1c18, 0x4},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0xa000, 0x2},
-       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x800, 0x2},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1c10, 0x2},
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x1ad0, 0x0},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x800, 0x2},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x1ad8, 0x4},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x808, 0x2},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3b28, 0x6},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3678, 0x6},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x810, 0x4},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5000, 0x2},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3670, 0x2},
        {OP_SW_E1, TSEM_REG_FAST_MEMORY + 0x1fb0, 0x40224},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5008, 0x4},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5000, 0x2},
        {OP_SW_E1, TSEM_REG_FAST_MEMORY + 0x4cb0, 0x80228},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5008, 0x4},
+       {OP_ZP_E1, TSEM_REG_INT_TABLE, 0x930000},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5018, 0x4},
-       {OP_ZP_E1, TSEM_REG_INT_TABLE, 0x940000},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5028, 0x4},
        {OP_WR_64_E1, TSEM_REG_INT_TABLE + 0x360, 0x140230},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5028, 0x4},
+       {OP_ZP_E1, TSEM_REG_PRAM, 0x324f0000},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5038, 0x4},
-       {OP_ZP_E1, TSEM_REG_PRAM, 0x30b10000},
+       {OP_ZP_E1, TSEM_REG_PRAM + 0x8000, 0x33250c94},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5048, 0x4},
-       {OP_ZP_E1, TSEM_REG_PRAM + 0x8000, 0x33c50c2d},
+       {OP_ZP_E1, TSEM_REG_PRAM + 0x10000, 0xe4d195e},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5058, 0x4},
-       {OP_ZP_E1, TSEM_REG_PRAM + 0x10000, 0xbc6191f},
+       {OP_WR_64_E1, TSEM_REG_PRAM + 0x11e00, 0x5c400232},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5068, 0x4},
-       {OP_WR_64_E1, TSEM_REG_PRAM + 0x117f0, 0x5d020232},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5078, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x4000, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x4008, 0x2},
-       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x6140, 0x200224},
-       {OP_ZP_E1H, TSEM_REG_INT_TABLE, 0x960000},
-       {OP_WR_64_E1H, TSEM_REG_INT_TABLE + 0x360, 0x140244},
-       {OP_ZP_E1H, TSEM_REG_PRAM, 0x30cc0000},
-       {OP_ZP_E1H, TSEM_REG_PRAM + 0x8000, 0x33df0c33},
-       {OP_ZP_E1H, TSEM_REG_PRAM + 0x10000, 0xdce192b},
-       {OP_WR_64_E1H, TSEM_REG_PRAM + 0x11c70, 0x5c720246},
-#define TSEM_COMMON_END         276
-#define TSEM_PORT0_START        276
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x62c0, 0x200224},
+       {OP_ZP_E1H, TSEM_REG_INT_TABLE, 0x9b0000},
+       {OP_WR_64_E1H, TSEM_REG_INT_TABLE + 0x398, 0xd0244},
+       {OP_ZP_E1H, TSEM_REG_PRAM, 0x325e0000},
+       {OP_ZP_E1H, TSEM_REG_PRAM + 0x8000, 0x35960c98},
+       {OP_ZP_E1H, TSEM_REG_PRAM + 0x10000, 0x1aea19fe},
+       {OP_WR_64_E1H, TSEM_REG_PRAM + 0x143d0, 0x57860246},
+#define TSEM_COMMON_END         297
+#define TSEM_PORT0_START        297
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x22c8, 0x20},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x2000, 0x16c},
-       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x4000, 0xfc},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x4000, 0x16c},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0xb000, 0x28},
        {OP_WR_E1, TSEM_REG_FAST_MEMORY + 0x4b60, 0x0},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0xb140, 0xc},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1400, 0xa},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x32c0, 0x12},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1450, 0x6},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3350, 0xfa},
-       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1500, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3350, 0x64},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1500, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x8108, 0x2},
+       {OP_SW_E1, TSEM_REG_FAST_MEMORY + 0x1500 + 0x8, 0x50234},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1500 + 0x1c, 0x7},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1570, 0x12},
-       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x9c0, 0xbe},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x9c0, 0x4c},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x800, 0x2},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x820, 0xe},
-       {OP_SW_E1, TSEM_REG_FAST_MEMORY + 0x1fb0, 0x20234},
+       {OP_SW_E1, TSEM_REG_FAST_MEMORY + 0x1fb0, 0x20239},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x2908, 0x2},
-#define TSEM_PORT0_END          294
-#define TSEM_PORT1_START        294
+#define TSEM_PORT0_END          317
+#define TSEM_PORT1_START        317
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x2348, 0x20},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x25b0, 0x16c},
-       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x43f0, 0xfc},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x45b0, 0x16c},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0xb0a0, 0x28},
        {OP_WR_E1, TSEM_REG_FAST_MEMORY + 0x4b64, 0x0},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0xb170, 0xc},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1428, 0xa},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3308, 0x12},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1468, 0x6},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3738, 0xfa},
-       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1538, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x34e0, 0x64},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1538, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x8110, 0x2},
+       {OP_SW_E1, TSEM_REG_FAST_MEMORY + 0x1538 + 0x8, 0x5023b},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x1538 + 0x1c, 0x7},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x15b8, 0x12},
-       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0xcb8, 0xbe},
+       {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0xaf0, 0x4c},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x808, 0x2},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x858, 0xe},
-       {OP_SW_E1, TSEM_REG_FAST_MEMORY + 0x1fb8, 0x20236},
+       {OP_SW_E1, TSEM_REG_FAST_MEMORY + 0x1fb8, 0x20240},
        {OP_ZR_E1, TSEM_REG_FAST_MEMORY + 0x2910, 0x2},
-#define TSEM_PORT1_END          312
-#define TSEM_FUNC0_START        312
+#define TSEM_PORT1_END          337
+#define TSEM_FUNC0_START        337
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x2b60, 0x0},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3000, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3000, 0x2},
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x3000 + 0x8, 0x50248},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3000 + 0x1c, 0x7},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x31c0, 0x8},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5000, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5080, 0x12},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x4000, 0x2},
-#define TSEM_FUNC0_END          318
-#define TSEM_FUNC1_START        318
+#define TSEM_FUNC0_END          345
+#define TSEM_FUNC1_START        345
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x2b64, 0x0},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3038, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3038, 0x2},
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x3038 + 0x8, 0x5024d},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3038 + 0x1c, 0x7},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x31e0, 0x8},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5010, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x50c8, 0x12},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x4008, 0x2},
-#define TSEM_FUNC1_END          324
-#define TSEM_FUNC2_START        324
+#define TSEM_FUNC1_END          353
+#define TSEM_FUNC2_START        353
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x2b68, 0x0},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3070, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3070, 0x2},
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x3070 + 0x8, 0x50252},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3070 + 0x1c, 0x7},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3200, 0x8},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5020, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5110, 0x12},
-       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4010, 0x20248},
-#define TSEM_FUNC2_END          330
-#define TSEM_FUNC3_START        330
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4010, 0x20257},
+#define TSEM_FUNC2_END          361
+#define TSEM_FUNC3_START        361
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x2b6c, 0x0},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x30a8, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x30a8, 0x2},
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x30a8 + 0x8, 0x50259},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x30a8 + 0x1c, 0x7},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3220, 0x8},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5030, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5158, 0x12},
-       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4018, 0x2024a},
-#define TSEM_FUNC3_END          336
-#define TSEM_FUNC4_START        336
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4018, 0x2025e},
+#define TSEM_FUNC3_END          369
+#define TSEM_FUNC4_START        369
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x2b70, 0x0},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x30e0, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x30e0, 0x2},
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x30e0 + 0x8, 0x50260},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x30e0 + 0x1c, 0x7},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3240, 0x8},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5040, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x51a0, 0x12},
-       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4020, 0x2024c},
-#define TSEM_FUNC4_END          342
-#define TSEM_FUNC5_START        342
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4020, 0x20265},
+#define TSEM_FUNC4_END          377
+#define TSEM_FUNC5_START        377
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x2b74, 0x0},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3118, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3118, 0x2},
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x3118 + 0x8, 0x50267},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3118 + 0x1c, 0x7},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3260, 0x8},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5050, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x51e8, 0x12},
-       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4028, 0x2024e},
-#define TSEM_FUNC5_END          348
-#define TSEM_FUNC6_START        348
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4028, 0x2026c},
+#define TSEM_FUNC5_END          385
+#define TSEM_FUNC6_START        385
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x2b78, 0x0},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3150, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3150, 0x2},
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x3150 + 0x8, 0x5026e},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3150 + 0x1c, 0x7},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3280, 0x8},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5060, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5230, 0x12},
-       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4030, 0x20250},
-#define TSEM_FUNC6_END          354
-#define TSEM_FUNC7_START        354
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4030, 0x20273},
+#define TSEM_FUNC6_END          393
+#define TSEM_FUNC7_START        393
        {OP_WR_E1H, TSEM_REG_FAST_MEMORY + 0x2b7c, 0x0},
-       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3188, 0xe},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3188, 0x2},
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x3188 + 0x8, 0x50275},
+       {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x3188 + 0x1c, 0x7},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x32a0, 0x8},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5070, 0x2},
        {OP_ZR_E1H, TSEM_REG_FAST_MEMORY + 0x5278, 0x12},
-       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4038, 0x20252},
-#define TSEM_FUNC7_END          360
-#define MISC_COMMON_START       360
+       {OP_SW_E1H, TSEM_REG_FAST_MEMORY + 0x4038, 0x2027a},
+#define TSEM_FUNC7_END          401
+#define MISC_COMMON_START       401
        {OP_WR_E1, MISC_REG_GRC_TIMEOUT_EN, 0x1},
        {OP_WR, MISC_REG_PLL_STORM_CTRL_1, 0x71d2911},
        {OP_WR, MISC_REG_PLL_STORM_CTRL_2, 0x0},
@@ -447,39 +488,39 @@ static const struct raw_op init_ops[] = {
        {OP_WR, MISC_REG_PLL_STORM_CTRL_4, 0x0},
        {OP_WR, MISC_REG_LCPLL_CTRL_1, 0x209},
        {OP_WR_E1, MISC_REG_SPIO, 0xff000000},
-#define MISC_COMMON_END         367
-#define MISC_FUNC0_START        367
+#define MISC_COMMON_END         408
+#define MISC_FUNC0_START        408
        {OP_WR_E1H, MISC_REG_NIG_WOL_P0, 0x0},
-#define MISC_FUNC0_END          368
-#define MISC_FUNC1_START        368
+#define MISC_FUNC0_END          409
+#define MISC_FUNC1_START        409
        {OP_WR_E1H, MISC_REG_NIG_WOL_P1, 0x0},
-#define MISC_FUNC1_END          369
-#define MISC_FUNC2_START        369
+#define MISC_FUNC1_END          410
+#define MISC_FUNC2_START        410
        {OP_WR_E1H, MISC_REG_NIG_WOL_P0, 0x0},
-#define MISC_FUNC2_END          370
-#define MISC_FUNC3_START        370
+#define MISC_FUNC2_END          411
+#define MISC_FUNC3_START        411
        {OP_WR_E1H, MISC_REG_NIG_WOL_P1, 0x0},
-#define MISC_FUNC3_END          371
-#define MISC_FUNC4_START        371
+#define MISC_FUNC3_END          412
+#define MISC_FUNC4_START        412
        {OP_WR_E1H, MISC_REG_NIG_WOL_P0, 0x0},
-#define MISC_FUNC4_END          372
-#define MISC_FUNC5_START        372
+#define MISC_FUNC4_END          413
+#define MISC_FUNC5_START        413
        {OP_WR_E1H, MISC_REG_NIG_WOL_P1, 0x0},
-#define MISC_FUNC5_END          373
-#define MISC_FUNC6_START        373
+#define MISC_FUNC5_END          414
+#define MISC_FUNC6_START        414
        {OP_WR_E1H, MISC_REG_NIG_WOL_P0, 0x0},
-#define MISC_FUNC6_END          374
-#define MISC_FUNC7_START        374
+#define MISC_FUNC6_END          415
+#define MISC_FUNC7_START        415
        {OP_WR_E1H, MISC_REG_NIG_WOL_P1, 0x0},
-#define MISC_FUNC7_END          375
-#define NIG_COMMON_START        375
+#define MISC_FUNC7_END          416
+#define NIG_COMMON_START        416
        {OP_WR, NIG_REG_PBF_LB_IN_EN, 0x1},
        {OP_WR, NIG_REG_PRS_REQ_IN_EN, 0x1},
        {OP_WR, NIG_REG_EGRESS_DEBUG_IN_EN, 0x1},
        {OP_WR, NIG_REG_BRB_LB_OUT_EN, 0x1},
        {OP_WR, NIG_REG_PRS_EOP_OUT_EN, 0x1},
-#define NIG_COMMON_END          380
-#define NIG_PORT0_START         380
+#define NIG_COMMON_END          421
+#define NIG_PORT0_START         421
        {OP_WR, NIG_REG_LLH0_CM_HEADER, 0x300000},
        {OP_WR, NIG_REG_LLH0_EVENT_ID, 0x28},
        {OP_WR, NIG_REG_LLH0_ERROR_MASK, 0x0},
@@ -492,8 +533,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR, NIG_REG_EGRESS_PBF0_IN_EN, 0x1},
        {OP_WR, NIG_REG_BRB0_OUT_EN, 0x1},
        {OP_WR, NIG_REG_XCM0_OUT_EN, 0x1},
-#define NIG_PORT0_END           392
-#define NIG_PORT1_START         392
+#define NIG_PORT0_END           433
+#define NIG_PORT1_START         433
        {OP_WR, NIG_REG_LLH1_CM_HEADER, 0x300000},
        {OP_WR, NIG_REG_LLH1_EVENT_ID, 0x28},
        {OP_WR, NIG_REG_LLH1_ERROR_MASK, 0x0},
@@ -506,11 +547,11 @@ static const struct raw_op init_ops[] = {
        {OP_WR, NIG_REG_EGRESS_PBF1_IN_EN, 0x1},
        {OP_WR, NIG_REG_BRB1_OUT_EN, 0x1},
        {OP_WR, NIG_REG_XCM1_OUT_EN, 0x1},
-#define NIG_PORT1_END           404
-#define UPB_COMMON_START        404
+#define NIG_PORT1_END           445
+#define UPB_COMMON_START        445
        {OP_WR, GRCBASE_UPB + PB_REG_CONTROL, 0x20},
-#define UPB_COMMON_END          405
-#define CSDM_COMMON_START       405
+#define UPB_COMMON_END          446
+#define CSDM_COMMON_START       446
        {OP_WR_E1, CSDM_REG_CFC_RSP_START_ADDR, 0xa11},
        {OP_WR_E1H, CSDM_REG_CFC_RSP_START_ADDR, 0x211},
        {OP_WR_E1, CSDM_REG_CMP_COUNTER_START_ADDR, 0xa00},
@@ -550,8 +591,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_ASIC, CSDM_REG_TIMER_TICK, 0x3e8},
        {OP_WR_EMUL, CSDM_REG_TIMER_TICK, 0x1},
        {OP_WR_FPGA, CSDM_REG_TIMER_TICK, 0xa},
-#define CSDM_COMMON_END         444
-#define USDM_COMMON_START       444
+#define CSDM_COMMON_END         485
+#define USDM_COMMON_START       485
        {OP_WR_E1, USDM_REG_CFC_RSP_START_ADDR, 0xa11},
        {OP_WR_E1H, USDM_REG_CFC_RSP_START_ADDR, 0x411},
        {OP_WR_E1, USDM_REG_CMP_COUNTER_START_ADDR, 0xa00},
@@ -568,9 +609,14 @@ static const struct raw_op init_ops[] = {
        {OP_WR, USDM_REG_AGG_INT_EVENT_1, 0x5},
        {OP_WR, USDM_REG_AGG_INT_EVENT_2, 0x34},
        {OP_WR, USDM_REG_AGG_INT_EVENT_3, 0x35},
-       {OP_ZR, USDM_REG_AGG_INT_EVENT_4, 0x5c},
+       {OP_ZR_E1, USDM_REG_AGG_INT_EVENT_4, 0x5c},
+       {OP_WR_E1H, USDM_REG_AGG_INT_EVENT_4, 0x7},
+       {OP_ZR_E1H, USDM_REG_AGG_INT_EVENT_5, 0x5b},
        {OP_WR, USDM_REG_AGG_INT_MODE_0, 0x1},
-       {OP_ZR, USDM_REG_AGG_INT_MODE_1, 0x1f},
+       {OP_ZR_E1, USDM_REG_AGG_INT_MODE_1, 0x1f},
+       {OP_ZR_E1H, USDM_REG_AGG_INT_MODE_1, 0x3},
+       {OP_WR_E1H, USDM_REG_AGG_INT_MODE_4, 0x1},
+       {OP_ZR_E1H, USDM_REG_AGG_INT_MODE_5, 0x1b},
        {OP_WR, USDM_REG_ENABLE_IN1, 0x7ffffff},
        {OP_WR, USDM_REG_ENABLE_IN2, 0x3f},
        {OP_WR, USDM_REG_ENABLE_OUT1, 0x7ffffff},
@@ -594,18 +640,21 @@ static const struct raw_op init_ops[] = {
        {OP_WR_ASIC, USDM_REG_TIMER_TICK, 0x3e8},
        {OP_WR_EMUL, USDM_REG_TIMER_TICK, 0x1},
        {OP_WR_FPGA, USDM_REG_TIMER_TICK, 0xa},
-#define USDM_COMMON_END         486
-#define CCM_COMMON_START        486
+#define USDM_COMMON_END         532
+#define CCM_COMMON_START        532
        {OP_WR, CCM_REG_XX_OVFL_EVNT_ID, 0x32},
        {OP_WR, CCM_REG_CQM_CCM_HDR_P, 0x2150020},
        {OP_WR, CCM_REG_CQM_CCM_HDR_S, 0x2150020},
        {OP_WR, CCM_REG_ERR_CCM_HDR, 0x8100000},
        {OP_WR, CCM_REG_ERR_EVNT_ID, 0x33},
+       {OP_WR, CCM_REG_STORM_WEIGHT, 0x2},
        {OP_WR, CCM_REG_TSEM_WEIGHT, 0x0},
-       {OP_WR, CCM_REG_XSEM_WEIGHT, 0x4},
-       {OP_WR, CCM_REG_USEM_WEIGHT, 0x4},
+       {OP_WR, CCM_REG_XSEM_WEIGHT, 0x5},
+       {OP_WR, CCM_REG_USEM_WEIGHT, 0x5},
        {OP_ZR, CCM_REG_PBF_WEIGHT, 0x2},
-       {OP_WR, CCM_REG_CQM_P_WEIGHT, 0x2},
+       {OP_WR, CCM_REG_CSDM_WEIGHT, 0x2},
+       {OP_WR, CCM_REG_CQM_P_WEIGHT, 0x3},
+       {OP_WR, CCM_REG_CQM_S_WEIGHT, 0x2},
        {OP_WR, CCM_REG_CCM_CQM_USE_Q, 0x1},
        {OP_WR, CCM_REG_CNT_AUX1_Q, 0x2},
        {OP_WR, CCM_REG_CNT_AUX2_Q, 0x2},
@@ -620,8 +669,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR, CCM_REG_XX_INIT_CRD, 0x3},
        {OP_WR, CCM_REG_XX_MSG_NUM, 0x18},
        {OP_ZR, CCM_REG_XX_TABLE, 0x12},
-       {OP_SW_E1, CCM_REG_XX_DESCR_TABLE, 0x240238},
-       {OP_SW_E1H, CCM_REG_XX_DESCR_TABLE, 0x240254},
+       {OP_SW_E1, CCM_REG_XX_DESCR_TABLE, 0x240242},
+       {OP_SW_E1H, CCM_REG_XX_DESCR_TABLE, 0x24027c},
        {OP_WR, CCM_REG_N_SM_CTX_LD_0, 0x1},
        {OP_WR, CCM_REG_N_SM_CTX_LD_1, 0x2},
        {OP_WR, CCM_REG_N_SM_CTX_LD_2, 0x8},
@@ -657,8 +706,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR, CCM_REG_CDU_SM_WR_IFEN, 0x1},
        {OP_WR, CCM_REG_CDU_SM_RD_IFEN, 0x1},
        {OP_WR, CCM_REG_CCM_CFC_IFEN, 0x1},
-#define CCM_COMMON_END          547
-#define CCM_FUNC0_START         547
+#define CCM_COMMON_END          596
+#define CCM_FUNC0_START         596
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM0_0, 0x9},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM1_0, 0xa},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM2_0, 0x7},
@@ -666,8 +715,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CCM_REG_PHYS_QNUM1_0, 0xc},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM2_0, 0xb},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM3_0, 0x7},
-#define CCM_FUNC0_END           554
-#define CCM_FUNC1_START         554
+#define CCM_FUNC0_END           603
+#define CCM_FUNC1_START         603
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM0_1, 0x29},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM1_1, 0x2a},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM2_1, 0x27},
@@ -675,8 +724,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CCM_REG_PHYS_QNUM1_1, 0x2c},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM2_1, 0x2b},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM3_1, 0x27},
-#define CCM_FUNC1_END           561
-#define CCM_FUNC2_START         561
+#define CCM_FUNC1_END           610
+#define CCM_FUNC2_START         610
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM0_0, 0x19},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM1_0, 0x1a},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM2_0, 0x17},
@@ -684,8 +733,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CCM_REG_PHYS_QNUM1_0, 0x1c},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM2_0, 0x1b},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM3_0, 0x17},
-#define CCM_FUNC2_END           568
-#define CCM_FUNC3_START         568
+#define CCM_FUNC2_END           617
+#define CCM_FUNC3_START         617
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM0_1, 0x39},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM1_1, 0x3a},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM2_1, 0x37},
@@ -693,8 +742,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CCM_REG_PHYS_QNUM1_1, 0x3c},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM2_1, 0x3b},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM3_1, 0x37},
-#define CCM_FUNC3_END           575
-#define CCM_FUNC4_START         575
+#define CCM_FUNC3_END           624
+#define CCM_FUNC4_START         624
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM0_0, 0x49},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM1_0, 0x4a},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM2_0, 0x47},
@@ -702,8 +751,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CCM_REG_PHYS_QNUM1_0, 0x4c},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM2_0, 0x4b},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM3_0, 0x47},
-#define CCM_FUNC4_END           582
-#define CCM_FUNC5_START         582
+#define CCM_FUNC4_END           631
+#define CCM_FUNC5_START         631
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM0_1, 0x69},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM1_1, 0x6a},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM2_1, 0x67},
@@ -711,8 +760,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CCM_REG_PHYS_QNUM1_1, 0x6c},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM2_1, 0x6b},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM3_1, 0x67},
-#define CCM_FUNC5_END           589
-#define CCM_FUNC6_START         589
+#define CCM_FUNC5_END           638
+#define CCM_FUNC6_START         638
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM0_0, 0x59},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM1_0, 0x5a},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM2_0, 0x57},
@@ -720,8 +769,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CCM_REG_PHYS_QNUM1_0, 0x5c},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM2_0, 0x5b},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM3_0, 0x57},
-#define CCM_FUNC6_END           596
-#define CCM_FUNC7_START         596
+#define CCM_FUNC6_END           645
+#define CCM_FUNC7_START         645
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM0_1, 0x79},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM1_1, 0x7a},
        {OP_WR_E1H, CCM_REG_QOS_PHYS_QNUM2_1, 0x77},
@@ -729,8 +778,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CCM_REG_PHYS_QNUM1_1, 0x7c},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM2_1, 0x7b},
        {OP_WR_E1H, CCM_REG_PHYS_QNUM3_1, 0x77},
-#define CCM_FUNC7_END           603
-#define UCM_COMMON_START        603
+#define CCM_FUNC7_END           652
+#define UCM_COMMON_START        652
        {OP_WR, UCM_REG_XX_OVFL_EVNT_ID, 0x32},
        {OP_WR, UCM_REG_UQM_UCM_HDR_P, 0x2150020},
        {OP_WR, UCM_REG_UQM_UCM_HDR_S, 0x2150020},
@@ -739,10 +788,16 @@ static const struct raw_op init_ops[] = {
        {OP_WR, UCM_REG_ERR_EVNT_ID, 0x33},
        {OP_WR, UCM_REG_EXPR_EVNT_ID, 0x30},
        {OP_WR, UCM_REG_STOP_EVNT_ID, 0x31},
-       {OP_WR, UCM_REG_TSEM_WEIGHT, 0x3},
+       {OP_WR, UCM_REG_STORM_WEIGHT, 0x2},
+       {OP_WR, UCM_REG_TSEM_WEIGHT, 0x4},
        {OP_WR, UCM_REG_CSEM_WEIGHT, 0x0},
+       {OP_WR, UCM_REG_XSEM_WEIGHT, 0x2},
+       {OP_WR, UCM_REG_DORQ_WEIGHT, 0x2},
        {OP_WR, UCM_REG_CP_WEIGHT, 0x0},
-       {OP_WR, UCM_REG_UQM_P_WEIGHT, 0x6},
+       {OP_WR, UCM_REG_USDM_WEIGHT, 0x2},
+       {OP_WR, UCM_REG_UQM_P_WEIGHT, 0x7},
+       {OP_WR, UCM_REG_UQM_S_WEIGHT, 0x2},
+       {OP_WR, UCM_REG_TM_WEIGHT, 0x2},
        {OP_WR, UCM_REG_UCM_UQM_USE_Q, 0x1},
        {OP_WR, UCM_REG_INV_CFLG_Q, 0x1},
        {OP_WR, UCM_REG_GR_ARB_TYPE, 0x1},
@@ -756,14 +811,14 @@ static const struct raw_op init_ops[] = {
        {OP_WR, UCM_REG_XX_INIT_CRD, 0xe},
        {OP_WR, UCM_REG_XX_MSG_NUM, 0x1b},
        {OP_ZR, UCM_REG_XX_TABLE, 0x12},
-       {OP_SW_E1, UCM_REG_XX_DESCR_TABLE, 0x1b025c},
-       {OP_SW_E1H, UCM_REG_XX_DESCR_TABLE, 0x1b0278},
+       {OP_SW_E1, UCM_REG_XX_DESCR_TABLE, 0x1b0266},
+       {OP_SW_E1H, UCM_REG_XX_DESCR_TABLE, 0x1b02a0},
        {OP_WR, UCM_REG_N_SM_CTX_LD_0, 0x10},
        {OP_WR, UCM_REG_N_SM_CTX_LD_1, 0x7},
        {OP_WR, UCM_REG_N_SM_CTX_LD_2, 0xf},
        {OP_WR, UCM_REG_N_SM_CTX_LD_3, 0x10},
        {OP_ZR_E1, UCM_REG_N_SM_CTX_LD_4, 0x4},
-       {OP_WR_E1H, UCM_REG_N_SM_CTX_LD_4, 0xd},
+       {OP_WR_E1H, UCM_REG_N_SM_CTX_LD_4, 0xb},
        {OP_ZR_E1H, UCM_REG_N_SM_CTX_LD_5, 0x3},
        {OP_WR, UCM_REG_UCM_REG0_SZ, 0x3},
        {OP_WR_E1, UCM_REG_PHYS_QNUM0_0, 0xf},
@@ -787,56 +842,56 @@ static const struct raw_op init_ops[] = {
        {OP_WR, UCM_REG_CDU_SM_WR_IFEN, 0x1},
        {OP_WR, UCM_REG_CDU_SM_RD_IFEN, 0x1},
        {OP_WR, UCM_REG_UCM_CFC_IFEN, 0x1},
-#define UCM_COMMON_END          659
-#define UCM_FUNC0_START         659
+#define UCM_COMMON_END          714
+#define UCM_FUNC0_START         714
        {OP_WR_E1H, UCM_REG_PHYS_QNUM0_0, 0xf},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM1_0, 0xe},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM2_0, 0x0},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM3_0, 0x0},
-#define UCM_FUNC0_END           663
-#define UCM_FUNC1_START         663
+#define UCM_FUNC0_END           718
+#define UCM_FUNC1_START         718
        {OP_WR_E1H, UCM_REG_PHYS_QNUM0_1, 0x2f},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM1_1, 0x2e},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM2_1, 0x0},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM3_1, 0x0},
-#define UCM_FUNC1_END           667
-#define UCM_FUNC2_START         667
+#define UCM_FUNC1_END           722
+#define UCM_FUNC2_START         722
        {OP_WR_E1H, UCM_REG_PHYS_QNUM0_0, 0x1f},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM1_0, 0x1e},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM2_0, 0x0},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM3_0, 0x0},
-#define UCM_FUNC2_END           671
-#define UCM_FUNC3_START         671
+#define UCM_FUNC2_END           726
+#define UCM_FUNC3_START         726
        {OP_WR_E1H, UCM_REG_PHYS_QNUM0_1, 0x3f},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM1_1, 0x3e},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM2_1, 0x0},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM3_1, 0x0},
-#define UCM_FUNC3_END           675
-#define UCM_FUNC4_START         675
+#define UCM_FUNC3_END           730
+#define UCM_FUNC4_START         730
        {OP_WR_E1H, UCM_REG_PHYS_QNUM0_0, 0x4f},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM1_0, 0x4e},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM2_0, 0x0},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM3_0, 0x0},
-#define UCM_FUNC4_END           679
-#define UCM_FUNC5_START         679
+#define UCM_FUNC4_END           734
+#define UCM_FUNC5_START         734
        {OP_WR_E1H, UCM_REG_PHYS_QNUM0_1, 0x6f},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM1_1, 0x6e},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM2_1, 0x0},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM3_1, 0x0},
-#define UCM_FUNC5_END           683
-#define UCM_FUNC6_START         683
+#define UCM_FUNC5_END           738
+#define UCM_FUNC6_START         738
        {OP_WR_E1H, UCM_REG_PHYS_QNUM0_0, 0x5f},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM1_0, 0x5e},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM2_0, 0x0},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM3_0, 0x0},
-#define UCM_FUNC6_END           687
-#define UCM_FUNC7_START         687
+#define UCM_FUNC6_END           742
+#define UCM_FUNC7_START         742
        {OP_WR_E1H, UCM_REG_PHYS_QNUM0_1, 0x7f},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM1_1, 0x7e},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM2_1, 0x0},
        {OP_WR_E1H, UCM_REG_PHYS_QNUM3_1, 0x0},
-#define UCM_FUNC7_END           691
-#define USEM_COMMON_START       691
+#define UCM_FUNC7_END           746
+#define USEM_COMMON_START       746
        {OP_RD, USEM_REG_MSG_NUM_FIC0, 0x0},
        {OP_RD, USEM_REG_MSG_NUM_FIC1, 0x0},
        {OP_RD, USEM_REG_MSG_NUM_FOC0, 0x0},
@@ -887,69 +942,72 @@ static const struct raw_op init_ops[] = {
        {OP_WR_ASIC, USEM_REG_FAST_MEMORY + 0x18380, 0x1dcd6500},
        {OP_WR_EMUL, USEM_REG_FAST_MEMORY + 0x18380, 0x4c4b4},
        {OP_WR_FPGA, USEM_REG_FAST_MEMORY + 0x18380, 0x4c4b40},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x5000, 0x102},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x5000, 0xc2},
        {OP_WR_EMUL_E1H, USEM_REG_FAST_MEMORY + 0x11480, 0x0},
        {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1020, 0xc8},
        {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x11480, 0x1},
        {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1000, 0x2},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x2000, 0x102},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x57e8, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x8020, 0xc8},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x57d0, 0x5},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x8000, 0x2},
-       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x57d0 + 0x14, 0x10277},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3760, 0x4},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1e20, 0x42},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3738, 0x9},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4b68, 0x2},
-       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x3738 + 0x24, 0x10293},
-       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x4b68 + 0x8, 0x20278},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3180, 0x42},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4b10, 0x2},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4640, 0x40},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x8980, 0xc8},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x57f0, 0x4},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x8960, 0x2},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x57d8, 0x5},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3228, 0x4},
+       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x57d8 + 0x14, 0x10281},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3200, 0x9},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1c60, 0x20},
+       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x3200 + 0x24, 0x102bb},
+       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x2830, 0x20282},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3180, 0x20},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5000, 0x400},
-       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x2830, 0x2027a},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4000, 0x2},
-       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x4000 + 0x8, 0x20294},
+       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x4000 + 0x8, 0x102bc},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4000 + 0xc, 0x3},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x6b68, 0x2},
-       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x6b68 + 0x8, 0x20296},
+       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x6b68 + 0x8, 0x202bd},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x6b10, 0x2},
-       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x74c0, 0x20298},
+       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x74c0, 0x202bf},
        {OP_WR, USEM_REG_FAST_MEMORY + 0x10800, 0x1000000},
-       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x10c00, 0x10027c},
-       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x10c00, 0x10029a},
+       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x10c00, 0x100284},
+       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x10c00, 0x1002c1},
        {OP_WR, USEM_REG_FAST_MEMORY + 0x10800, 0x0},
-       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x10c40, 0x10028c},
-       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x10c40, 0x1002aa},
-       {OP_ZP_E1, USEM_REG_INT_TABLE, 0xc20000},
-       {OP_ZP_E1H, USEM_REG_INT_TABLE, 0xc40000},
-       {OP_WR_64_E1, USEM_REG_INT_TABLE + 0x368, 0x13029c},
-       {OP_WR_64_E1H, USEM_REG_INT_TABLE + 0x368, 0x1302ba},
-       {OP_ZP_E1, USEM_REG_PRAM, 0x311c0000},
-       {OP_ZP_E1H, USEM_REG_PRAM, 0x31070000},
-       {OP_ZP_E1, USEM_REG_PRAM + 0x8000, 0x33450c47},
-       {OP_ZP_E1H, USEM_REG_PRAM + 0x8000, 0x330e0c42},
-       {OP_ZP_E1, USEM_REG_PRAM + 0x10000, 0x38561919},
-       {OP_ZP_E1H, USEM_REG_PRAM + 0x10000, 0x389b1906},
-       {OP_WR_64_E1, USEM_REG_PRAM + 0x17fe0, 0x5004029e},
-       {OP_ZP_E1H, USEM_REG_PRAM + 0x18000, 0x132272d},
-       {OP_WR_64_E1H, USEM_REG_PRAM + 0x18250, 0x4fb602bc},
-#define USEM_COMMON_END         787
-#define USEM_PORT0_START        787
+       {OP_SW_E1, USEM_REG_FAST_MEMORY + 0x10c40, 0x100294},
+       {OP_SW_E1H, USEM_REG_FAST_MEMORY + 0x10c40, 0x1002d1},
+       {OP_ZP_E1, USEM_REG_INT_TABLE, 0xc30000},
+       {OP_ZP_E1H, USEM_REG_INT_TABLE, 0xd20000},
+       {OP_WR_64_E1, USEM_REG_INT_TABLE + 0x368, 0x1302a4},
+       {OP_WR_64_E1H, USEM_REG_INT_TABLE + 0x3a8, 0xb02e1},
+       {OP_ZP_E1, USEM_REG_PRAM, 0x314c0000},
+       {OP_ZP_E1H, USEM_REG_PRAM, 0x31b60000},
+       {OP_ZP_E1, USEM_REG_PRAM + 0x8000, 0x35ef0c53},
+       {OP_ZP_E1H, USEM_REG_PRAM + 0x8000, 0x36500c6e},
+       {OP_ZP_E1, USEM_REG_PRAM + 0x10000, 0x361319cf},
+       {OP_ZP_E1H, USEM_REG_PRAM + 0x10000, 0x37591a02},
+       {OP_ZP_E1, USEM_REG_PRAM + 0x18000, 0x7112754},
+       {OP_ZP_E1H, USEM_REG_PRAM + 0x18000, 0x286127d9},
+       {OP_WR_64_E1, USEM_REG_PRAM + 0x18ee0, 0x4e2402a6},
+       {OP_WR_64_E1H, USEM_REG_PRAM + 0x1ff40, 0x401802e3},
+#define USEM_COMMON_END         842
+#define USEM_PORT0_START        842
        {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1400, 0xa0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x9000, 0xa0},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1900, 0xa},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x9500, 0x28},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1950, 0x2e},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x9640, 0x34},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1d00, 0x4},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1900, 0x10},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x9500, 0x40},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1980, 0x30},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x9700, 0x3c},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4740, 0xb4},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x2450, 0xb4},
+       {OP_WR_E1, USEM_REG_FAST_MEMORY + 0x1d90, 0x0},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x2ad0, 0x2},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1b40, 0x4},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3080, 0x20},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1d20, 0x20},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3288, 0x96},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x5440, 0x72},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1b60, 0x20},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x8000, 0x12c},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x5318, 0x98},
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x3238, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5000, 0x20},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4b78, 0x52},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5100, 0x20},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4e08, 0xc},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5200, 0x20},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5300, 0x20},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5400, 0x20},
@@ -966,23 +1024,26 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5f00, 0x20},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x6b78, 0x52},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x6e08, 0xc},
-#define USEM_PORT0_END          818
-#define USEM_PORT1_START        818
+#define USEM_PORT0_END          876
+#define USEM_PORT1_START        876
        {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1680, 0xa0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x9280, 0xa0},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1928, 0xa},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x95a0, 0x28},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1a08, 0x2e},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x9710, 0x34},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1d10, 0x4},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1940, 0x10},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x9600, 0x40},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1a40, 0x30},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x97f0, 0x3c},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4a10, 0xb4},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x2720, 0xb4},
+       {OP_WR_E1, USEM_REG_FAST_MEMORY + 0x1d94, 0x0},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x2ad8, 0x2},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1b50, 0x4},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3100, 0x20},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1da0, 0x20},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x34e0, 0x96},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x5608, 0x72},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x1be0, 0x20},
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x84b0, 0x12c},
+       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x5578, 0x98},
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x323c, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5080, 0x20},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4cc0, 0x52},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5180, 0x20},
-       {OP_ZR_E1, USEM_REG_FAST_MEMORY + 0x4e38, 0xc},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5280, 0x20},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5380, 0x20},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5480, 0x20},
@@ -999,40 +1060,48 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x5f80, 0x20},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x6cc0, 0x52},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x6e38, 0xc},
-#define USEM_PORT1_END          849
-#define USEM_FUNC0_START        849
+#define USEM_PORT1_END          910
+#define USEM_FUNC0_START        910
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x2a30, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3000, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4010, 0x2},
-#define USEM_FUNC0_END          851
-#define USEM_FUNC1_START        851
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4018, 0x2},
+#define USEM_FUNC0_END          913
+#define USEM_FUNC1_START        913
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x2a34, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3010, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4020, 0x2},
-#define USEM_FUNC1_END          853
-#define USEM_FUNC2_START        853
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4028, 0x2},
+#define USEM_FUNC1_END          916
+#define USEM_FUNC2_START        916
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x2a38, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3020, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4030, 0x2},
-#define USEM_FUNC2_END          855
-#define USEM_FUNC3_START        855
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4038, 0x2},
+#define USEM_FUNC2_END          919
+#define USEM_FUNC3_START        919
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x2a3c, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3030, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4040, 0x2},
-#define USEM_FUNC3_END          857
-#define USEM_FUNC4_START        857
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4048, 0x2},
+#define USEM_FUNC3_END          922
+#define USEM_FUNC4_START        922
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x2a40, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3040, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4050, 0x2},
-#define USEM_FUNC4_END          859
-#define USEM_FUNC5_START        859
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4058, 0x2},
+#define USEM_FUNC4_END          925
+#define USEM_FUNC5_START        925
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x2a44, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3050, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4060, 0x2},
-#define USEM_FUNC5_END          861
-#define USEM_FUNC6_START        861
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4068, 0x2},
+#define USEM_FUNC5_END          928
+#define USEM_FUNC6_START        928
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x2a48, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3060, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4070, 0x2},
-#define USEM_FUNC6_END          863
-#define USEM_FUNC7_START        863
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4078, 0x2},
+#define USEM_FUNC6_END          931
+#define USEM_FUNC7_START        931
+       {OP_WR_E1H, USEM_REG_FAST_MEMORY + 0x2a4c, 0x0},
        {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x3070, 0x4},
-       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4080, 0x2},
-#define USEM_FUNC7_END          865
-#define CSEM_COMMON_START       865
+       {OP_ZR_E1H, USEM_REG_FAST_MEMORY + 0x4088, 0x2},
+#define USEM_FUNC7_END          934
+#define CSEM_COMMON_START       934
        {OP_RD, CSEM_REG_MSG_NUM_FIC0, 0x0},
        {OP_RD, CSEM_REG_MSG_NUM_FIC1, 0x0},
        {OP_RD, CSEM_REG_MSG_NUM_FOC0, 0x0},
@@ -1091,29 +1160,30 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x11e8, 0x0},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x25c0, 0x240},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3000, 0xc0},
-       {OP_SW_E1, CSEM_REG_FAST_MEMORY + 0x2ec8, 0x802a0},
+       {OP_SW_E1, CSEM_REG_FAST_MEMORY + 0x2ec8, 0x802a8},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x4070, 0x80},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x5280, 0x4},
-       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6280, 0x240},
-       {OP_SW_E1H, CSEM_REG_FAST_MEMORY + 0x6b88, 0x2002be},
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6700, 0x100},
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x9000, 0x400},
+       {OP_SW_E1H, CSEM_REG_FAST_MEMORY + 0x6b08, 0x2002e5},
        {OP_WR, CSEM_REG_FAST_MEMORY + 0x10800, 0x13fffff},
-       {OP_SW_E1, CSEM_REG_FAST_MEMORY + 0x10c00, 0x1002a8},
-       {OP_SW_E1H, CSEM_REG_FAST_MEMORY + 0x10c00, 0x1002de},
+       {OP_SW_E1, CSEM_REG_FAST_MEMORY + 0x10c00, 0x1002b0},
+       {OP_SW_E1H, CSEM_REG_FAST_MEMORY + 0x10c00, 0x100305},
        {OP_WR, CSEM_REG_FAST_MEMORY + 0x10800, 0x0},
-       {OP_SW_E1, CSEM_REG_FAST_MEMORY + 0x10c40, 0x1002b8},
-       {OP_SW_E1H, CSEM_REG_FAST_MEMORY + 0x10c40, 0x1002ee},
-       {OP_ZP_E1, CSEM_REG_INT_TABLE, 0x6e0000},
-       {OP_ZP_E1H, CSEM_REG_INT_TABLE, 0x6f0000},
-       {OP_WR_64_E1, CSEM_REG_INT_TABLE + 0x380, 0x1002c8},
-       {OP_WR_64_E1H, CSEM_REG_INT_TABLE + 0x380, 0x1002fe},
-       {OP_ZP_E1, CSEM_REG_PRAM, 0x32580000},
-       {OP_ZP_E1H, CSEM_REG_PRAM, 0x31fa0000},
-       {OP_ZP_E1, CSEM_REG_PRAM + 0x8000, 0x18270c96},
-       {OP_ZP_E1H, CSEM_REG_PRAM + 0x8000, 0x19040c7f},
-       {OP_WR_64_E1, CSEM_REG_PRAM + 0xb210, 0x682402ca},
-       {OP_WR_64_E1H, CSEM_REG_PRAM + 0xb430, 0x67e00300},
-#define CSEM_COMMON_END         944
-#define CSEM_PORT0_START        944
+       {OP_SW_E1, CSEM_REG_FAST_MEMORY + 0x10c40, 0x1002c0},
+       {OP_SW_E1H, CSEM_REG_FAST_MEMORY + 0x10c40, 0x100315},
+       {OP_ZP_E1, CSEM_REG_INT_TABLE, 0x710000},
+       {OP_ZP_E1H, CSEM_REG_INT_TABLE, 0x740000},
+       {OP_WR_64_E1, CSEM_REG_INT_TABLE + 0x380, 0x1002d0},
+       {OP_WR_64_E1H, CSEM_REG_INT_TABLE + 0x380, 0x100325},
+       {OP_ZP_E1, CSEM_REG_PRAM, 0x32290000},
+       {OP_ZP_E1H, CSEM_REG_PRAM, 0x32260000},
+       {OP_ZP_E1, CSEM_REG_PRAM + 0x8000, 0x23630c8b},
+       {OP_ZP_E1H, CSEM_REG_PRAM + 0x8000, 0x246e0c8a},
+       {OP_WR_64_E1, CSEM_REG_PRAM + 0xc930, 0x654002d2},
+       {OP_WR_64_E1H, CSEM_REG_PRAM + 0xcbb0, 0x64f00327},
+#define CSEM_COMMON_END         1014
+#define CSEM_PORT0_START        1014
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x1400, 0xa0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x8000, 0xa0},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x1900, 0x10},
@@ -1123,11 +1193,10 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, CSEM_REG_FAST_MEMORY + 0x5118, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x4040, 0x6},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x2300, 0xe},
-       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6040, 0x30},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x3040, 0x6},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x2410, 0x30},
-#define CSEM_PORT0_END          956
-#define CSEM_PORT1_START        956
+#define CSEM_PORT0_END          1025
+#define CSEM_PORT1_START        1025
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x1680, 0xa0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x8280, 0xa0},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x1940, 0x10},
@@ -1137,46 +1206,53 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, CSEM_REG_FAST_MEMORY + 0x511c, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x4058, 0x6},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x2338, 0xe},
-       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6100, 0x30},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x3058, 0x6},
        {OP_ZR_E1, CSEM_REG_FAST_MEMORY + 0x24d0, 0x30},
-#define CSEM_PORT1_END          968
-#define CSEM_FUNC0_START        968
+#define CSEM_PORT1_END          1036
+#define CSEM_FUNC0_START        1036
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x1148, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3300, 0x2},
-#define CSEM_FUNC0_END          970
-#define CSEM_FUNC1_START        970
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6040, 0x30},
+#define CSEM_FUNC0_END          1039
+#define CSEM_FUNC1_START        1039
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x114c, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3308, 0x2},
-#define CSEM_FUNC1_END          972
-#define CSEM_FUNC2_START        972
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6100, 0x30},
+#define CSEM_FUNC1_END          1042
+#define CSEM_FUNC2_START        1042
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x1150, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3310, 0x2},
-#define CSEM_FUNC2_END          974
-#define CSEM_FUNC3_START        974
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x61c0, 0x30},
+#define CSEM_FUNC2_END          1045
+#define CSEM_FUNC3_START        1045
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x1154, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3318, 0x2},
-#define CSEM_FUNC3_END          976
-#define CSEM_FUNC4_START        976
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6280, 0x30},
+#define CSEM_FUNC3_END          1048
+#define CSEM_FUNC4_START        1048
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x1158, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3320, 0x2},
-#define CSEM_FUNC4_END          978
-#define CSEM_FUNC5_START        978
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6340, 0x30},
+#define CSEM_FUNC4_END          1051
+#define CSEM_FUNC5_START        1051
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x115c, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3328, 0x2},
-#define CSEM_FUNC5_END          980
-#define CSEM_FUNC6_START        980
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6400, 0x30},
+#define CSEM_FUNC5_END          1054
+#define CSEM_FUNC6_START        1054
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x1160, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3330, 0x2},
-#define CSEM_FUNC6_END          982
-#define CSEM_FUNC7_START        982
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x64c0, 0x30},
+#define CSEM_FUNC6_END          1057
+#define CSEM_FUNC7_START        1057
        {OP_WR_E1H, CSEM_REG_FAST_MEMORY + 0x1164, 0x0},
        {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x3338, 0x2},
-#define CSEM_FUNC7_END          984
-#define XPB_COMMON_START        984
+       {OP_ZR_E1H, CSEM_REG_FAST_MEMORY + 0x6580, 0x30},
+#define CSEM_FUNC7_END          1060
+#define XPB_COMMON_START        1060
        {OP_WR, GRCBASE_XPB + PB_REG_CONTROL, 0x20},
-#define XPB_COMMON_END          985
-#define DQ_COMMON_START         985
+#define XPB_COMMON_END          1061
+#define DQ_COMMON_START         1061
        {OP_WR, DORQ_REG_MODE_ACT, 0x2},
        {OP_WR, DORQ_REG_NORM_CID_OFST, 0x3},
        {OP_WR, DORQ_REG_OUTST_REQ, 0x4},
@@ -1195,8 +1271,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR, DORQ_REG_DQ_FIFO_AFULL_TH, 0x76c},
        {OP_WR, DORQ_REG_REGN, 0x7c1004},
        {OP_WR, DORQ_REG_IF_EN, 0xf},
-#define DQ_COMMON_END           1003
-#define TIMERS_COMMON_START     1003
+#define DQ_COMMON_END           1079
+#define TIMERS_COMMON_START     1079
        {OP_ZR, TM_REG_CLIN_PRIOR0_CLIENT, 0x2},
        {OP_WR, TM_REG_LIN_SETCLR_FIFO_ALFULL_THR, 0x1c},
        {OP_WR, TM_REG_CFC_AC_CRDCNT_VAL, 0x1},
@@ -1219,14 +1295,18 @@ static const struct raw_op init_ops[] = {
        {OP_WR, TM_REG_EN_CL0_INPUT, 0x1},
        {OP_WR, TM_REG_EN_CL1_INPUT, 0x1},
        {OP_WR, TM_REG_EN_CL2_INPUT, 0x1},
-#define TIMERS_COMMON_END       1025
-#define TIMERS_PORT0_START      1025
+#define TIMERS_COMMON_END       1101
+#define TIMERS_PORT0_START      1101
+       {OP_WR, TM_REG_LIN0_LOGIC_ADDR, 0x0},
+       {OP_WR, TM_REG_LIN0_PHY_ADDR_VALID, 0x0},
        {OP_ZR, TM_REG_LIN0_PHY_ADDR, 0x2},
-#define TIMERS_PORT0_END        1026
-#define TIMERS_PORT1_START      1026
+#define TIMERS_PORT0_END        1104
+#define TIMERS_PORT1_START      1104
+       {OP_WR, TM_REG_LIN1_LOGIC_ADDR, 0x0},
+       {OP_WR, TM_REG_LIN1_PHY_ADDR_VALID, 0x0},
        {OP_ZR, TM_REG_LIN1_PHY_ADDR, 0x2},
-#define TIMERS_PORT1_END        1027
-#define XSDM_COMMON_START       1027
+#define TIMERS_PORT1_END        1107
+#define XSDM_COMMON_START       1107
        {OP_WR_E1, XSDM_REG_CFC_RSP_START_ADDR, 0x614},
        {OP_WR_E1H, XSDM_REG_CFC_RSP_START_ADDR, 0x424},
        {OP_WR_E1, XSDM_REG_CMP_COUNTER_START_ADDR, 0x600},
@@ -1249,7 +1329,9 @@ static const struct raw_op init_ops[] = {
        {OP_WR, XSDM_REG_AGG_INT_EVENT_9, 0x29},
        {OP_WR, XSDM_REG_AGG_INT_EVENT_10, 0x2a},
        {OP_WR, XSDM_REG_AGG_INT_EVENT_11, 0x2b},
-       {OP_ZR, XSDM_REG_AGG_INT_EVENT_12, 0x54},
+       {OP_WR, XSDM_REG_AGG_INT_EVENT_12, 0x2c},
+       {OP_WR, XSDM_REG_AGG_INT_EVENT_13, 0x2d},
+       {OP_ZR, XSDM_REG_AGG_INT_EVENT_14, 0x52},
        {OP_WR, XSDM_REG_AGG_INT_MODE_0, 0x1},
        {OP_ZR, XSDM_REG_AGG_INT_MODE_1, 0x1f},
        {OP_WR, XSDM_REG_ENABLE_IN1, 0x7ffffff},
@@ -1274,8 +1356,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_ASIC, XSDM_REG_TIMER_TICK, 0x3e8},
        {OP_WR_EMUL, XSDM_REG_TIMER_TICK, 0x1},
        {OP_WR_FPGA, XSDM_REG_TIMER_TICK, 0xa},
-#define XSDM_COMMON_END         1074
-#define QM_COMMON_START         1074
+#define XSDM_COMMON_END         1156
+#define QM_COMMON_START         1156
        {OP_WR, QM_REG_ACTCTRINITVAL_0, 0x6},
        {OP_WR, QM_REG_ACTCTRINITVAL_1, 0x5},
        {OP_WR, QM_REG_ACTCTRINITVAL_2, 0xa},
@@ -1576,8 +1658,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, QM_REG_PQ2PCIFUNC_6, 0x5},
        {OP_WR_E1H, QM_REG_PQ2PCIFUNC_7, 0x7},
        {OP_WR, QM_REG_CMINTEN, 0xff},
-#define QM_COMMON_END           1374
-#define PBF_COMMON_START        1374
+#define QM_COMMON_END           1456
+#define PBF_COMMON_START        1456
        {OP_WR, PBF_REG_INIT, 0x1},
        {OP_WR, PBF_REG_INIT_P4, 0x1},
        {OP_WR, PBF_REG_MAC_LB_ENABLE, 0x1},
@@ -1585,20 +1667,20 @@ static const struct raw_op init_ops[] = {
        {OP_WR, PBF_REG_INIT_P4, 0x0},
        {OP_WR, PBF_REG_INIT, 0x0},
        {OP_WR, PBF_REG_DISABLE_NEW_TASK_PROC_P4, 0x0},
-#define PBF_COMMON_END          1381
-#define PBF_PORT0_START         1381
+#define PBF_COMMON_END          1463
+#define PBF_PORT0_START         1463
        {OP_WR, PBF_REG_INIT_P0, 0x1},
        {OP_WR, PBF_REG_MAC_IF0_ENABLE, 0x1},
        {OP_WR, PBF_REG_INIT_P0, 0x0},
        {OP_WR, PBF_REG_DISABLE_NEW_TASK_PROC_P0, 0x0},
-#define PBF_PORT0_END           1385
-#define PBF_PORT1_START         1385
+#define PBF_PORT0_END           1467
+#define PBF_PORT1_START         1467
        {OP_WR, PBF_REG_INIT_P1, 0x1},
        {OP_WR, PBF_REG_MAC_IF1_ENABLE, 0x1},
        {OP_WR, PBF_REG_INIT_P1, 0x0},
        {OP_WR, PBF_REG_DISABLE_NEW_TASK_PROC_P1, 0x0},
-#define PBF_PORT1_END           1389
-#define XCM_COMMON_START        1389
+#define PBF_PORT1_END           1471
+#define XCM_COMMON_START        1471
        {OP_WR, XCM_REG_XX_OVFL_EVNT_ID, 0x32},
        {OP_WR, XCM_REG_XQM_XCM_HDR_P, 0x3150020},
        {OP_WR, XCM_REG_XQM_XCM_HDR_S, 0x3150020},
@@ -1607,15 +1689,18 @@ static const struct raw_op init_ops[] = {
        {OP_WR, XCM_REG_ERR_EVNT_ID, 0x33},
        {OP_WR, XCM_REG_EXPR_EVNT_ID, 0x30},
        {OP_WR, XCM_REG_STOP_EVNT_ID, 0x31},
-       {OP_WR, XCM_REG_STORM_WEIGHT, 0x2},
-       {OP_WR, XCM_REG_TSEM_WEIGHT, 0x5},
-       {OP_WR, XCM_REG_CSEM_WEIGHT, 0x2},
-       {OP_WR, XCM_REG_USEM_WEIGHT, 0x2},
-       {OP_WR, XCM_REG_PBF_WEIGHT, 0x7},
-       {OP_WR, XCM_REG_NIG1_WEIGHT, 0x1},
+       {OP_WR, XCM_REG_STORM_WEIGHT, 0x3},
+       {OP_WR, XCM_REG_TSEM_WEIGHT, 0x6},
+       {OP_WR, XCM_REG_CSEM_WEIGHT, 0x3},
+       {OP_WR, XCM_REG_USEM_WEIGHT, 0x3},
+       {OP_WR, XCM_REG_DORQ_WEIGHT, 0x2},
+       {OP_WR, XCM_REG_PBF_WEIGHT, 0x0},
+       {OP_WR, XCM_REG_NIG0_WEIGHT, 0x2},
        {OP_WR, XCM_REG_CP_WEIGHT, 0x0},
-       {OP_WR, XCM_REG_XSDM_WEIGHT, 0x5},
-       {OP_WR, XCM_REG_XQM_P_WEIGHT, 0x3},
+       {OP_WR, XCM_REG_XSDM_WEIGHT, 0x6},
+       {OP_WR, XCM_REG_XQM_P_WEIGHT, 0x4},
+       {OP_WR, XCM_REG_XQM_S_WEIGHT, 0x2},
+       {OP_WR, XCM_REG_TM_WEIGHT, 0x2},
        {OP_WR, XCM_REG_XCM_XQM_USE_Q, 0x1},
        {OP_WR, XCM_REG_XQM_BYP_ACT_UPD, 0x6},
        {OP_WR, XCM_REG_UNA_GT_NXT_Q, 0x0},
@@ -1633,14 +1718,14 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, XCM_REG_XX_MSG_NUM, 0x1f},
        {OP_WR_E1H, XCM_REG_XX_MSG_NUM, 0x20},
        {OP_ZR, XCM_REG_XX_TABLE, 0x12},
-       {OP_SW_E1, XCM_REG_XX_DESCR_TABLE, 0x1f02cc},
-       {OP_SW_E1H, XCM_REG_XX_DESCR_TABLE, 0x1f0302},
+       {OP_SW_E1, XCM_REG_XX_DESCR_TABLE, 0x1f02d4},
+       {OP_SW_E1H, XCM_REG_XX_DESCR_TABLE, 0x1f0329},
        {OP_WR, XCM_REG_N_SM_CTX_LD_0, 0xf},
        {OP_WR, XCM_REG_N_SM_CTX_LD_1, 0x7},
        {OP_WR, XCM_REG_N_SM_CTX_LD_2, 0xb},
        {OP_WR, XCM_REG_N_SM_CTX_LD_3, 0xe},
        {OP_ZR_E1, XCM_REG_N_SM_CTX_LD_4, 0x4},
-       {OP_WR_E1H, XCM_REG_N_SM_CTX_LD_4, 0xc},
+       {OP_WR_E1H, XCM_REG_N_SM_CTX_LD_4, 0xe},
        {OP_ZR_E1H, XCM_REG_N_SM_CTX_LD_5, 0x3},
        {OP_WR, XCM_REG_XCM_REG0_SZ, 0x4},
        {OP_WR, XCM_REG_XCM_STORM0_IFEN, 0x1},
@@ -1663,8 +1748,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR, XCM_REG_CDU_SM_WR_IFEN, 0x1},
        {OP_WR, XCM_REG_CDU_SM_RD_IFEN, 0x1},
        {OP_WR, XCM_REG_XCM_CFC_IFEN, 0x1},
-#define XCM_COMMON_END          1453
-#define XCM_PORT0_START         1453
+#define XCM_COMMON_END          1538
+#define XCM_PORT0_START         1538
        {OP_WR_E1, XCM_REG_GLB_DEL_ACK_TMR_VAL_0, 0xc8},
        {OP_WR_E1, XCM_REG_GLB_DEL_ACK_MAX_CNT_0, 0x2},
        {OP_WR_E1, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD00, 0x0},
@@ -1673,8 +1758,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, XCM_REG_WU_DA_CNT_CMD10, 0x2},
        {OP_WR_E1, XCM_REG_WU_DA_CNT_UPD_VAL00, 0xff},
        {OP_WR_E1, XCM_REG_WU_DA_CNT_UPD_VAL10, 0xff},
-#define XCM_PORT0_END           1461
-#define XCM_PORT1_START         1461
+#define XCM_PORT0_END           1546
+#define XCM_PORT1_START         1546
        {OP_WR_E1, XCM_REG_GLB_DEL_ACK_TMR_VAL_1, 0xc8},
        {OP_WR_E1, XCM_REG_GLB_DEL_ACK_MAX_CNT_1, 0x2},
        {OP_WR_E1, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD01, 0x0},
@@ -1683,8 +1768,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, XCM_REG_WU_DA_CNT_CMD11, 0x2},
        {OP_WR_E1, XCM_REG_WU_DA_CNT_UPD_VAL01, 0xff},
        {OP_WR_E1, XCM_REG_WU_DA_CNT_UPD_VAL11, 0xff},
-#define XCM_PORT1_END           1469
-#define XCM_FUNC0_START         1469
+#define XCM_PORT1_END           1554
+#define XCM_FUNC0_START         1554
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_TMR_VAL_0, 0xc8},
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_MAX_CNT_0, 0x2},
        {OP_WR_E1H, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD00, 0x0},
@@ -1694,8 +1779,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL00, 0xff},
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL10, 0xff},
        {OP_WR_E1H, XCM_REG_PHYS_QNUM3_0, 0x0},
-#define XCM_FUNC0_END           1478
-#define XCM_FUNC1_START         1478
+#define XCM_FUNC0_END           1563
+#define XCM_FUNC1_START         1563
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_TMR_VAL_1, 0xc8},
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_MAX_CNT_1, 0x2},
        {OP_WR_E1H, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD01, 0x0},
@@ -1705,8 +1790,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL01, 0xff},
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL11, 0xff},
        {OP_WR_E1H, XCM_REG_PHYS_QNUM3_1, 0x0},
-#define XCM_FUNC1_END           1487
-#define XCM_FUNC2_START         1487
+#define XCM_FUNC1_END           1572
+#define XCM_FUNC2_START         1572
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_TMR_VAL_0, 0xc8},
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_MAX_CNT_0, 0x2},
        {OP_WR_E1H, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD00, 0x0},
@@ -1716,8 +1801,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL00, 0xff},
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL10, 0xff},
        {OP_WR_E1H, XCM_REG_PHYS_QNUM3_0, 0x0},
-#define XCM_FUNC2_END           1496
-#define XCM_FUNC3_START         1496
+#define XCM_FUNC2_END           1581
+#define XCM_FUNC3_START         1581
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_TMR_VAL_1, 0xc8},
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_MAX_CNT_1, 0x2},
        {OP_WR_E1H, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD01, 0x0},
@@ -1727,8 +1812,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL01, 0xff},
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL11, 0xff},
        {OP_WR_E1H, XCM_REG_PHYS_QNUM3_1, 0x0},
-#define XCM_FUNC3_END           1505
-#define XCM_FUNC4_START         1505
+#define XCM_FUNC3_END           1590
+#define XCM_FUNC4_START         1590
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_TMR_VAL_0, 0xc8},
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_MAX_CNT_0, 0x2},
        {OP_WR_E1H, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD00, 0x0},
@@ -1738,8 +1823,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL00, 0xff},
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL10, 0xff},
        {OP_WR_E1H, XCM_REG_PHYS_QNUM3_0, 0x0},
-#define XCM_FUNC4_END           1514
-#define XCM_FUNC5_START         1514
+#define XCM_FUNC4_END           1599
+#define XCM_FUNC5_START         1599
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_TMR_VAL_1, 0xc8},
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_MAX_CNT_1, 0x2},
        {OP_WR_E1H, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD01, 0x0},
@@ -1749,8 +1834,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL01, 0xff},
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL11, 0xff},
        {OP_WR_E1H, XCM_REG_PHYS_QNUM3_1, 0x0},
-#define XCM_FUNC5_END           1523
-#define XCM_FUNC6_START         1523
+#define XCM_FUNC5_END           1608
+#define XCM_FUNC6_START         1608
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_TMR_VAL_0, 0xc8},
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_MAX_CNT_0, 0x2},
        {OP_WR_E1H, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD00, 0x0},
@@ -1760,8 +1845,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL00, 0xff},
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL10, 0xff},
        {OP_WR_E1H, XCM_REG_PHYS_QNUM3_0, 0x0},
-#define XCM_FUNC6_END           1532
-#define XCM_FUNC7_START         1532
+#define XCM_FUNC6_END           1617
+#define XCM_FUNC7_START         1617
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_TMR_VAL_1, 0xc8},
        {OP_WR_E1H, XCM_REG_GLB_DEL_ACK_MAX_CNT_1, 0x2},
        {OP_WR_E1H, XCM_REG_WU_DA_SET_TMR_CNT_FLG_CMD01, 0x0},
@@ -1771,8 +1856,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL01, 0xff},
        {OP_WR_E1H, XCM_REG_WU_DA_CNT_UPD_VAL11, 0xff},
        {OP_WR_E1H, XCM_REG_PHYS_QNUM3_1, 0x0},
-#define XCM_FUNC7_END           1541
-#define XSEM_COMMON_START       1541
+#define XCM_FUNC7_END           1626
+#define XSEM_COMMON_START       1626
        {OP_RD, XSEM_REG_MSG_NUM_FIC0, 0x0},
        {OP_RD, XSEM_REG_MSG_NUM_FIC1, 0x0},
        {OP_RD, XSEM_REG_MSG_NUM_FOC0, 0x0},
@@ -1827,10 +1912,12 @@ static const struct raw_op init_ops[] = {
        {OP_WR_ASIC, XSEM_REG_FAST_MEMORY + 0x18380, 0x1dcd6500},
        {OP_WR_EMUL_E1H, XSEM_REG_FAST_MEMORY + 0x11480, 0x0},
        {OP_WR_FPGA, XSEM_REG_FAST_MEMORY + 0x18380, 0x4c4b40},
-       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3d00, 0x4},
+       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3d60, 0x4},
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x11480, 0x1},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3d60 + 0x10, 0x202f3},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x29c8, 0x4},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3000, 0x48},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x28a8, 0x4},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x29c8 + 0x10, 0x20348},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x1020, 0xc8},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2080, 0x48},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x1000, 0x2},
@@ -1839,68 +1926,73 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x9000, 0x2},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x3368, 0x0},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x21a8, 0x86},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3370, 0x202eb},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3370, 0x202f5},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2000, 0x20},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3b90, 0x402ed},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3b90, 0x402f7},
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x23c8, 0x0},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3e20, 0x202fb},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x23d0, 0x2034a},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x1518, 0x1},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x23d0, 0x20321},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2498, 0x4034c},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x1830, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2498, 0x40323},
+       {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x2c20, 0x0},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x1838, 0x0},
-       {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x2ac8, 0x0},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x1820, 0x202f1},
-       {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x2ab8, 0x0},
+       {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x2c10, 0x0},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x1820, 0x202fd},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2c08, 0x20350},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x4ac0, 0x2},
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x3010, 0x1},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x4b00, 0x4},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x4040, 0x10},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x1f50, 0x202f3},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x4000, 0x100327},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x1f48, 0x202ff},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x4000, 0x100352},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x6ac0, 0x2},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x6b00, 0x4},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x83b0, 0x20337},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x8408, 0x20362},
        {OP_WR, XSEM_REG_FAST_MEMORY + 0x10800, 0x0},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x10c00, 0x1002f5},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x10c00, 0x100339},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x10c00, 0x100301},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x10c00, 0x100364},
        {OP_WR, XSEM_REG_FAST_MEMORY + 0x10800, 0x1000000},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x10c40, 0x80305},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x10c40, 0x80349},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x10c40, 0x80311},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x10c40, 0x80374},
        {OP_WR, XSEM_REG_FAST_MEMORY + 0x10800, 0x2000000},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x10c60, 0x8030d},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x10c60, 0x80351},
-       {OP_ZP_E1, XSEM_REG_INT_TABLE, 0xa90000},
-       {OP_ZP_E1H, XSEM_REG_INT_TABLE, 0xac0000},
-       {OP_WR_64_E1, XSEM_REG_INT_TABLE + 0x368, 0x130315},
-       {OP_WR_64_E1H, XSEM_REG_INT_TABLE + 0x368, 0x130359},
-       {OP_ZP_E1, XSEM_REG_PRAM, 0x344e0000},
-       {OP_ZP_E1H, XSEM_REG_PRAM, 0x34620000},
-       {OP_ZP_E1, XSEM_REG_PRAM + 0x8000, 0x38840d14},
-       {OP_ZP_E1H, XSEM_REG_PRAM + 0x8000, 0x38240d19},
-       {OP_ZP_E1, XSEM_REG_PRAM + 0x10000, 0x3e711b35},
-       {OP_ZP_E1H, XSEM_REG_PRAM + 0x10000, 0x3e971b22},
-       {OP_ZP_E1, XSEM_REG_PRAM + 0x18000, 0x1dd02ad2},
-       {OP_ZP_E1H, XSEM_REG_PRAM + 0x18000, 0x21542ac8},
-       {OP_WR_64_E1, XSEM_REG_PRAM + 0x1c0d0, 0x47e60317},
-       {OP_WR_64_E1H, XSEM_REG_PRAM + 0x1c8d0, 0x46e6035b},
-#define XSEM_COMMON_END         1651
-#define XSEM_PORT0_START        1651
-       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3ba0, 0x10},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x10c60, 0x80319},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x10c60, 0x8037c},
+       {OP_ZP_E1, XSEM_REG_INT_TABLE, 0xb50000},
+       {OP_ZP_E1H, XSEM_REG_INT_TABLE, 0xbd0000},
+       {OP_WR_64_E1, XSEM_REG_INT_TABLE + 0x368, 0x130321},
+       {OP_WR_64_E1H, XSEM_REG_INT_TABLE + 0x3a8, 0xb0384},
+       {OP_ZP_E1, XSEM_REG_PRAM, 0x33660000},
+       {OP_ZP_E1H, XSEM_REG_PRAM, 0x34060000},
+       {OP_ZP_E1, XSEM_REG_PRAM + 0x8000, 0x38b30cda},
+       {OP_ZP_E1H, XSEM_REG_PRAM + 0x8000, 0x37960d02},
+       {OP_ZP_E1, XSEM_REG_PRAM + 0x10000, 0x3bb11b07},
+       {OP_ZP_E1H, XSEM_REG_PRAM + 0x10000, 0x3bc31ae8},
+       {OP_ZP_E1, XSEM_REG_PRAM + 0x18000, 0x2a2629f4},
+       {OP_ZP_E1H, XSEM_REG_PRAM + 0x18000, 0x382629d9},
+       {OP_WR_64_E1, XSEM_REG_PRAM + 0x1d6c0, 0x45280323},
+       {OP_ZP_E1H, XSEM_REG_PRAM + 0x20000, 0x124537e3},
+       {OP_WR_64_E1H, XSEM_REG_PRAM + 0x22220, 0x3bbc0386},
+#define XSEM_COMMON_END         1741
+#define XSEM_PORT0_START        1741
+       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3ba0, 0x14},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0xc000, 0xfc},
-       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3c20, 0x1c},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x24a8, 0x10},
+       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3c40, 0x24},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x24a8, 0x14},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x1400, 0xa},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2528, 0x1c},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2548, 0x24},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x1450, 0x6},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2608, 0x1c},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2668, 0x24},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3378, 0xfc},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x26e8, 0x1c},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2788, 0x24},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x3b58, 0x0},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x27c8, 0x1c},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3d10, 0x100319},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x28a8, 0x24},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3d78, 0x20325},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0xa000, 0x28},
-       {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x1500, 0x0},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3d88, 0x100327},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0xa140, 0xc},
+       {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x1500, 0x0},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x29e0, 0x20388},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x1508, 0x1},
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x3000, 0x1},
        {OP_ZR, XSEM_REG_FAST_MEMORY + 0x5020, 0x2},
@@ -1910,31 +2002,33 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x5040, 0x0},
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x5208, 0x1},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x5048, 0xe},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x6ac8, 0x2035d},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x6ac8, 0x2038a},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x50b8, 0x1},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x6b10, 0x42},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x4ac8, 0x20329},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x4ac8, 0x20337},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x6d20, 0x4},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x4b10, 0x42},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x4d20, 0x4},
-#define XSEM_PORT0_END          1683
-#define XSEM_PORT1_START        1683
-       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3be0, 0x10},
+#define XSEM_PORT0_END          1775
+#define XSEM_PORT1_START        1775
+       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3bf0, 0x14},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0xc3f0, 0xfc},
-       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3c90, 0x1c},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x24e8, 0x10},
+       {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3cd0, 0x24},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x24f8, 0x14},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x1428, 0xa},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2598, 0x1c},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x25d8, 0x24},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x1468, 0x6},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2678, 0x1c},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x26f8, 0x24},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x3768, 0xfc},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2758, 0x1c},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2818, 0x24},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x3b5c, 0x0},
-       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2838, 0x1c},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3d50, 0x10032b},
+       {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x2938, 0x24},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3d80, 0x20339},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0xa0a0, 0x28},
-       {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x1504, 0x0},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x3dc8, 0x10033b},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0xa170, 0xc},
+       {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x1504, 0x0},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x29e8, 0x2038c},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x150c, 0x1},
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x3004, 0x1},
        {OP_ZR, XSEM_REG_FAST_MEMORY + 0x5028, 0x2},
@@ -1944,68 +2038,68 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x5044, 0x0},
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0x520c, 0x1},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x5080, 0xe},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x6ad0, 0x2035f},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x6ad0, 0x2038e},
        {OP_WR_E1, XSEM_REG_FAST_MEMORY + 0x50bc, 0x1},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x6c18, 0x42},
-       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x4ad0, 0x2033b},
+       {OP_SW_E1, XSEM_REG_FAST_MEMORY + 0x4ad0, 0x2034b},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x6d30, 0x4},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x4c18, 0x42},
        {OP_ZR_E1, XSEM_REG_FAST_MEMORY + 0x4d30, 0x4},
-#define XSEM_PORT1_END          1715
-#define XSEM_FUNC0_START        1715
+#define XSEM_PORT1_END          1809
+#define XSEM_FUNC0_START        1809
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0xc7e0, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x28b8, 0x100361},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x29f0, 0x100390},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x5048, 0xe},
-#define XSEM_FUNC0_END          1718
-#define XSEM_FUNC1_START        1718
+#define XSEM_FUNC0_END          1812
+#define XSEM_FUNC1_START        1812
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0xc7e4, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x28f8, 0x100371},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2a30, 0x1003a0},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x5080, 0xe},
-#define XSEM_FUNC1_END          1721
-#define XSEM_FUNC2_START        1721
+#define XSEM_FUNC1_END          1815
+#define XSEM_FUNC2_START        1815
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0xc7e8, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2938, 0x100381},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2a70, 0x1003b0},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x50b8, 0xe},
-#define XSEM_FUNC2_END          1724
-#define XSEM_FUNC3_START        1724
+#define XSEM_FUNC2_END          1818
+#define XSEM_FUNC3_START        1818
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0xc7ec, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2978, 0x100391},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2ab0, 0x1003c0},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x50f0, 0xe},
-#define XSEM_FUNC3_END          1727
-#define XSEM_FUNC4_START        1727
+#define XSEM_FUNC3_END          1821
+#define XSEM_FUNC4_START        1821
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0xc7f0, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x29b8, 0x1003a1},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2af0, 0x1003d0},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x5128, 0xe},
-#define XSEM_FUNC4_END          1730
-#define XSEM_FUNC5_START        1730
+#define XSEM_FUNC4_END          1824
+#define XSEM_FUNC5_START        1824
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0xc7f4, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x29f8, 0x1003b1},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2b30, 0x1003e0},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x5160, 0xe},
-#define XSEM_FUNC5_END          1733
-#define XSEM_FUNC6_START        1733
+#define XSEM_FUNC5_END          1827
+#define XSEM_FUNC6_START        1827
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0xc7f8, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2a38, 0x1003c1},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2b70, 0x1003f0},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x5198, 0xe},
-#define XSEM_FUNC6_END          1736
-#define XSEM_FUNC7_START        1736
+#define XSEM_FUNC6_END          1830
+#define XSEM_FUNC7_START        1830
        {OP_WR_E1H, XSEM_REG_FAST_MEMORY + 0xc7fc, 0x0},
-       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2a78, 0x1003d1},
+       {OP_SW_E1H, XSEM_REG_FAST_MEMORY + 0x2bb0, 0x100400},
        {OP_ZR_E1H, XSEM_REG_FAST_MEMORY + 0x51d0, 0xe},
-#define XSEM_FUNC7_END          1739
-#define CDU_COMMON_START        1739
+#define XSEM_FUNC7_END          1833
+#define CDU_COMMON_START        1833
        {OP_WR, CDU_REG_CDU_CONTROL0, 0x1},
        {OP_WR_E1H, CDU_REG_MF_MODE, 0x1},
        {OP_WR, CDU_REG_CDU_CHK_MASK0, 0x3d000},
        {OP_WR, CDU_REG_CDU_CHK_MASK1, 0x3d},
-       {OP_WB_E1, CDU_REG_L1TT, 0x200033d},
-       {OP_WB_E1H, CDU_REG_L1TT, 0x20003e1},
-       {OP_WB_E1, CDU_REG_MATT, 0x20053d},
-       {OP_WB_E1H, CDU_REG_MATT, 0x2805e1},
+       {OP_WB_E1, CDU_REG_L1TT, 0x200034d},
+       {OP_WB_E1H, CDU_REG_L1TT, 0x2000410},
+       {OP_WB_E1, CDU_REG_MATT, 0x20054d},
+       {OP_WB_E1H, CDU_REG_MATT, 0x280610},
        {OP_ZR_E1, CDU_REG_MATT + 0x80, 0x2},
-       {OP_WB_E1, CDU_REG_MATT + 0x88, 0x6055d},
+       {OP_WB_E1, CDU_REG_MATT + 0x88, 0x6056d},
        {OP_ZR, CDU_REG_MATT + 0xa0, 0x18},
-#define CDU_COMMON_END          1750
-#define DMAE_COMMON_START       1750
+#define CDU_COMMON_END          1844
+#define DMAE_COMMON_START       1844
        {OP_ZR, DMAE_REG_CMD_MEM, 0xe0},
        {OP_WR, DMAE_REG_CRC16C_INIT, 0x0},
        {OP_WR, DMAE_REG_CRC16T10_INIT, 0x1},
@@ -2013,24 +2107,27 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, DMAE_REG_PXP_REQ_INIT_CRD, 0x2},
        {OP_WR, DMAE_REG_PCI_IFEN, 0x1},
        {OP_WR, DMAE_REG_GRC_IFEN, 0x1},
-#define DMAE_COMMON_END         1757
-#define PXP_COMMON_START        1757
-       {OP_WB_E1, PXP_REG_HST_INBOUND_INT + 0x400, 0x50563},
-       {OP_WB_E1H, PXP_REG_HST_INBOUND_INT + 0x400, 0x50609},
-       {OP_WB_E1, PXP_REG_HST_INBOUND_INT + 0x420, 0x50568},
-       {OP_WB_E1H, PXP_REG_HST_INBOUND_INT, 0x5060e},
-       {OP_WB_E1, PXP_REG_HST_INBOUND_INT, 0x5056d},
-#define PXP_COMMON_END          1762
-#define CFC_COMMON_START        1762
+#define DMAE_COMMON_END         1851
+#define PXP_COMMON_START        1851
+       {OP_WB_E1, PXP_REG_HST_INBOUND_INT + 0x400, 0x50573},
+       {OP_WB_E1H, PXP_REG_HST_INBOUND_INT + 0x400, 0x50638},
+       {OP_WB_E1, PXP_REG_HST_INBOUND_INT + 0x420, 0x50578},
+       {OP_WB_E1H, PXP_REG_HST_INBOUND_INT, 0x5063d},
+       {OP_WB_E1, PXP_REG_HST_INBOUND_INT, 0x5057d},
+       {OP_WB_E1H, PXP_REG_HST_INBOUND_INT + 0x20, 0x50642},
+#define PXP_COMMON_END          1857
+#define CFC_COMMON_START        1857
        {OP_ZR_E1H, CFC_REG_LINK_LIST, 0x100},
        {OP_WR, CFC_REG_CONTROL0, 0x10},
        {OP_WR, CFC_REG_DISABLE_ON_ERROR, 0x3fff},
+       {OP_WR, CFC_REG_INTERFACES, 0x280000},
        {OP_WR, CFC_REG_LCREQ_WEIGHTS, 0x84924a},
-#define CFC_COMMON_END          1766
-#define HC_COMMON_START         1766
+       {OP_WR, CFC_REG_INTERFACES, 0x0},
+#define CFC_COMMON_END          1863
+#define HC_COMMON_START         1863
        {OP_ZR_E1, HC_REG_USTORM_ADDR_FOR_COALESCE, 0x4},
-#define HC_COMMON_END           1767
-#define HC_PORT0_START          1767
+#define HC_COMMON_END           1864
+#define HC_PORT0_START          1864
        {OP_WR_E1, HC_REG_CONFIG_0, 0x1080},
        {OP_ZR_E1, HC_REG_UC_RAM_ADDR_0, 0x2},
        {OP_WR_E1, HC_REG_ATTN_NUM_P0, 0x10},
@@ -2049,8 +2146,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1, HC_REG_STATISTIC_COUNTERS + 0x120, 0x4a},
        {OP_ZR_E1, HC_REG_STATISTIC_COUNTERS + 0x370, 0x4a},
        {OP_ZR_E1, HC_REG_STATISTIC_COUNTERS + 0x5c0, 0x4a},
-#define HC_PORT0_END            1785
-#define HC_PORT1_START          1785
+#define HC_PORT0_END            1882
+#define HC_PORT1_START          1882
        {OP_WR_E1, HC_REG_CONFIG_1, 0x1080},
        {OP_ZR_E1, HC_REG_UC_RAM_ADDR_1, 0x2},
        {OP_WR_E1, HC_REG_ATTN_NUM_P1, 0x10},
@@ -2069,8 +2166,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1, HC_REG_STATISTIC_COUNTERS + 0x248, 0x4a},
        {OP_ZR_E1, HC_REG_STATISTIC_COUNTERS + 0x498, 0x4a},
        {OP_ZR_E1, HC_REG_STATISTIC_COUNTERS + 0x6e8, 0x4a},
-#define HC_PORT1_END            1803
-#define HC_FUNC0_START          1803
+#define HC_PORT1_END            1900
+#define HC_FUNC0_START          1900
        {OP_WR_E1H, HC_REG_CONFIG_0, 0x1080},
        {OP_WR_E1H, HC_REG_FUNC_NUM_P0, 0x0},
        {OP_WR_E1H, HC_REG_ATTN_NUM_P0, 0x10},
@@ -2086,8 +2183,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x120, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x370, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x5c0, 0x4a},
-#define HC_FUNC0_END            1818
-#define HC_FUNC1_START          1818
+#define HC_FUNC0_END            1915
+#define HC_FUNC1_START          1915
        {OP_WR_E1H, HC_REG_CONFIG_1, 0x1080},
        {OP_WR_E1H, HC_REG_FUNC_NUM_P1, 0x1},
        {OP_WR_E1H, HC_REG_ATTN_NUM_P1, 0x10},
@@ -2103,8 +2200,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x248, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x498, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x6e8, 0x4a},
-#define HC_FUNC1_END            1833
-#define HC_FUNC2_START          1833
+#define HC_FUNC1_END            1930
+#define HC_FUNC2_START          1930
        {OP_WR_E1H, HC_REG_CONFIG_0, 0x1080},
        {OP_WR_E1H, HC_REG_FUNC_NUM_P0, 0x2},
        {OP_WR_E1H, HC_REG_ATTN_NUM_P0, 0x10},
@@ -2120,8 +2217,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x120, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x370, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x5c0, 0x4a},
-#define HC_FUNC2_END            1848
-#define HC_FUNC3_START          1848
+#define HC_FUNC2_END            1945
+#define HC_FUNC3_START          1945
        {OP_WR_E1H, HC_REG_CONFIG_1, 0x1080},
        {OP_WR_E1H, HC_REG_FUNC_NUM_P1, 0x3},
        {OP_WR_E1H, HC_REG_ATTN_NUM_P1, 0x10},
@@ -2137,8 +2234,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x248, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x498, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x6e8, 0x4a},
-#define HC_FUNC3_END            1863
-#define HC_FUNC4_START          1863
+#define HC_FUNC3_END            1960
+#define HC_FUNC4_START          1960
        {OP_WR_E1H, HC_REG_CONFIG_0, 0x1080},
        {OP_WR_E1H, HC_REG_FUNC_NUM_P0, 0x4},
        {OP_WR_E1H, HC_REG_ATTN_NUM_P0, 0x10},
@@ -2154,8 +2251,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x120, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x370, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x5c0, 0x4a},
-#define HC_FUNC4_END            1878
-#define HC_FUNC5_START          1878
+#define HC_FUNC4_END            1975
+#define HC_FUNC5_START          1975
        {OP_WR_E1H, HC_REG_CONFIG_1, 0x1080},
        {OP_WR_E1H, HC_REG_FUNC_NUM_P1, 0x5},
        {OP_WR_E1H, HC_REG_ATTN_NUM_P1, 0x10},
@@ -2171,8 +2268,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x248, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x498, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x6e8, 0x4a},
-#define HC_FUNC5_END            1893
-#define HC_FUNC6_START          1893
+#define HC_FUNC5_END            1990
+#define HC_FUNC6_START          1990
        {OP_WR_E1H, HC_REG_CONFIG_0, 0x1080},
        {OP_WR_E1H, HC_REG_FUNC_NUM_P0, 0x6},
        {OP_WR_E1H, HC_REG_ATTN_NUM_P0, 0x10},
@@ -2188,8 +2285,8 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x120, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x370, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x5c0, 0x4a},
-#define HC_FUNC6_END            1908
-#define HC_FUNC7_START          1908
+#define HC_FUNC6_END            2005
+#define HC_FUNC7_START          2005
        {OP_WR_E1H, HC_REG_CONFIG_1, 0x1080},
        {OP_WR_E1H, HC_REG_FUNC_NUM_P1, 0x7},
        {OP_WR_E1H, HC_REG_ATTN_NUM_P1, 0x10},
@@ -2205,10 +2302,10 @@ static const struct raw_op init_ops[] = {
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x248, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x498, 0x4a},
        {OP_ZR_E1H, HC_REG_STATISTIC_COUNTERS + 0x6e8, 0x4a},
-#define HC_FUNC7_END            1923
-#define PXP2_COMMON_START       1923
-       {OP_WR_E1, PXP2_REG_PGL_CONTROL0, 0xe38340},
+#define HC_FUNC7_END            2020
+#define PXP2_COMMON_START       2020
        {OP_WR_E1H, PXP2_REG_RQ_DRAM_ALIGN, 0x1},
+       {OP_WR, PXP2_REG_PGL_CONTROL0, 0xe38340},
        {OP_WR, PXP2_REG_PGL_CONTROL1, 0x3c10},
        {OP_WR_E1H, PXP2_REG_RQ_ELT_DISABLE, 0x1},
        {OP_WR_E1H, PXP2_REG_WR_REV_MODE, 0x0},
@@ -2220,7 +2317,7 @@ static const struct raw_op init_ops[] = {
        {OP_WR, PXP2_REG_PGL_INT_TSDM_5, 0xffffffff},
        {OP_WR, PXP2_REG_PGL_INT_TSDM_6, 0xffffffff},
        {OP_WR, PXP2_REG_PGL_INT_TSDM_7, 0xffffffff},
-       {OP_WR, PXP2_REG_PGL_INT_USDM_1, 0xffffffff},
+       {OP_WR_E1, PXP2_REG_PGL_INT_USDM_1, 0xffffffff},
        {OP_WR, PXP2_REG_PGL_INT_USDM_2, 0xffffffff},
        {OP_WR, PXP2_REG_PGL_INT_USDM_3, 0xffffffff},
        {OP_WR, PXP2_REG_PGL_INT_USDM_4, 0xffffffff},
@@ -2247,6 +2344,7 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, PXP2_REG_PGL_INT_XSDM_1, 0xffff3340},
        {OP_WR_E1H, PXP2_REG_PGL_INT_USDM_0, 0xf0005000},
        {OP_WR_E1, PXP2_REG_PGL_INT_USDM_0, 0xf0003000},
+       {OP_WR_E1H, PXP2_REG_PGL_INT_USDM_1, 0xf0008000},
        {OP_WR, PXP2_REG_RD_MAX_BLKS_VQ6, 0x8},
        {OP_WR, PXP2_REG_RD_MAX_BLKS_VQ9, 0x8},
        {OP_WR, PXP2_REG_RD_MAX_BLKS_VQ10, 0x8},
@@ -2323,9 +2421,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR, PXP2_REG_PSWRQ_BW_WR, 0x106440},
        {OP_WR_E1H, PXP2_REG_RQ_ILT_MODE, 0x1},
        {OP_WR, PXP2_REG_RQ_RBC_DONE, 0x1},
-       {OP_WR_E1H, PXP2_REG_PGL_CONTROL0, 0xe38340},
-#define PXP2_COMMON_END         2040
-#define MISC_AEU_COMMON_START   2040
+#define PXP2_COMMON_END         2137
+#define MISC_AEU_COMMON_START   2137
        {OP_ZR, MISC_REG_AEU_GENERAL_ATTN_0, 0x16},
        {OP_WR_E1H, MISC_REG_AEU_ENABLE1_NIG_0, 0x55540000},
        {OP_WR_E1H, MISC_REG_AEU_ENABLE2_NIG_0, 0x55555555},
@@ -2345,8 +2442,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1H, MISC_REG_AEU_ENABLE4_PXP_1, 0x0},
        {OP_WR_E1H, MISC_REG_AEU_CLR_LATCH_SIGNAL, 0xc00},
        {OP_WR_E1H, MISC_REG_AEU_GENERAL_MASK, 0x3},
-#define MISC_AEU_COMMON_END     2059
-#define MISC_AEU_PORT0_START    2059
+#define MISC_AEU_COMMON_END     2156
+#define MISC_AEU_PORT0_START    2156
        {OP_WR_E1, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0, 0xbf5c0000},
        {OP_WR_E1H, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0, 0xff5c0000},
        {OP_WR_E1, MISC_REG_AEU_ENABLE2_FUNC_0_OUT_0, 0xfff51fef},
@@ -2379,8 +2476,8 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, MISC_REG_AEU_INVERTER_1_FUNC_0, 0x0},
        {OP_ZR_E1, MISC_REG_AEU_INVERTER_2_FUNC_0, 0x3},
        {OP_WR_E1, MISC_REG_AEU_MASK_ATTN_FUNC_0, 0x7},
-#define MISC_AEU_PORT0_END      2091
-#define MISC_AEU_PORT1_START    2091
+#define MISC_AEU_PORT0_END      2188
+#define MISC_AEU_PORT1_START    2188
        {OP_WR_E1, MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0, 0xbf5c0000},
        {OP_WR_E1H, MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0, 0xff5c0000},
        {OP_WR_E1, MISC_REG_AEU_ENABLE2_FUNC_1_OUT_0, 0xfff51fef},
@@ -2413,7 +2510,7 @@ static const struct raw_op init_ops[] = {
        {OP_WR_E1, MISC_REG_AEU_INVERTER_1_FUNC_1, 0x0},
        {OP_ZR_E1, MISC_REG_AEU_INVERTER_2_FUNC_1, 0x3},
        {OP_WR_E1, MISC_REG_AEU_MASK_ATTN_FUNC_1, 0x7},
-#define MISC_AEU_PORT1_END      2123
+#define MISC_AEU_PORT1_END      2220
 
 };
 
@@ -2512,72 +2609,64 @@ static const u32 init_data_e1[] = {
        0x00000200, 0x00000001, 0x00000003, 0x00bebc20, 0x00000003, 0x00bebc20,
        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
        0xffffffff, 0xffffffff, 0x00000000, 0x00007ff8, 0x00000000, 0x00003500,
-       0x00000003, 0x00bebc20, 0x00000003, 0x00bebc20, 0x00002000, 0x000040c0,
-       0x00006180, 0x00008240, 0x0000a300, 0x0000c3c0, 0x0000e480, 0x00010540,
-       0x00012600, 0x000146c0, 0x00016780, 0x00018840, 0x0001a900, 0x0001c9c0,
-       0x0001ea80, 0x00020b40, 0x00022c00, 0x00024cc0, 0x00026d80, 0x00028e40,
-       0x0002af00, 0x0002cfc0, 0x0002f080, 0x00031140, 0x00033200, 0x000352c0,
-       0x00037380, 0x00039440, 0x0003b500, 0x0003d5c0, 0x0003f680, 0x00041740,
-       0x00043800, 0x000458c0, 0x00047980, 0x00049a40, 0x00008000, 0x00010380,
-       0x00018700, 0x00020a80, 0x00028e00, 0x00031180, 0x00039500, 0x00041880,
-       0x00049c00, 0x00051f80, 0x0005a300, 0x00062680, 0x0006aa00, 0x00072d80,
-       0x0007b100, 0x00083480, 0x0008b800, 0x00093b80, 0x0009bf00, 0x000a4280,
-       0x000ac600, 0x000b4980, 0x000bcd00, 0x000c5080, 0x000cd400, 0x000d5780,
-       0x000ddb00, 0x00001900, 0x00100000, 0x00000000, 0x00000000, 0xffffffff,
+       0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000003,
+       0x00bebc20, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff,
+       0x00000003, 0x00bebc20, 0x00002000, 0x000040c0, 0x00006180, 0x00008240,
+       0x0000a300, 0x0000c3c0, 0x0000e480, 0x00010540, 0x00012600, 0x000146c0,
+       0x00016780, 0x00018840, 0x0001a900, 0x0001c9c0, 0x0001ea80, 0x00020b40,
+       0x00022c00, 0x00024cc0, 0x00026d80, 0x00028e40, 0x0002af00, 0x0002cfc0,
+       0x0002f080, 0x00031140, 0x00033200, 0x000352c0, 0x00037380, 0x00039440,
+       0x0003b500, 0x0003d5c0, 0x0003f680, 0x00041740, 0x00043800, 0x000458c0,
+       0x00047980, 0x00049a40, 0x00008000, 0x00010380, 0x00018700, 0x00020a80,
+       0x00028e00, 0x00031180, 0x00039500, 0x00041880, 0x00049c00, 0x00051f80,
+       0x0005a300, 0x00062680, 0x0006aa00, 0x00072d80, 0x0007b100, 0x00083480,
+       0x0008b800, 0x00093b80, 0x0009bf00, 0x000a4280, 0x000ac600, 0x000b4980,
+       0x000bcd00, 0x000c5080, 0x000cd400, 0x000d5780, 0x000ddb00, 0x00001900,
+       0x00000000, 0xffffffff, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+       0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x00000000, 0x00007ff8,
+       0x00000000, 0x00001500, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
+       0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
-       0x40000000, 0x40000000, 0x00000000, 0x00007ff8, 0x00000000, 0x00001500,
-       0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
-       0xffffffff, 0xffffffff, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
-       0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x00000000, 0x00007ff8,
-       0x00000000, 0x00003500, 0x00001000, 0x00002080, 0x00003100, 0x00004180,
-       0x00005200, 0x00006280, 0x00007300, 0x00008380, 0x00009400, 0x0000a480,
-       0x0000b500, 0x0000c580, 0x0000d600, 0x0000e680, 0x0000f700, 0x00010780,
-       0x00011800, 0x00012880, 0x00013900, 0x00014980, 0x00015a00, 0x00016a80,
-       0x00017b00, 0x00018b80, 0x00019c00, 0x0001ac80, 0x0001bd00, 0x0001cd80,
-       0x0001de00, 0x0001ee80, 0x0001ff00, 0x00000000, 0x00010001, 0x00000604,
-       0xccccccc1, 0xffffffff, 0xffffffff, 0xcccc0201, 0xcccccccc, 0x00000000,
+       0x00000000, 0x00007ff8, 0x00000000, 0x00001500, 0x00001000, 0x00002080,
+       0x00003100, 0x00004180, 0x00005200, 0x00006280, 0x00007300, 0x00008380,
+       0x00009400, 0x0000a480, 0x0000b500, 0x0000c580, 0x0000d600, 0x0000e680,
+       0x0000f700, 0x00010780, 0x00011800, 0x00012880, 0x00013900, 0x00014980,
+       0x00015a00, 0x00016a80, 0x00017b00, 0x00018b80, 0x00019c00, 0x0001ac80,
+       0x0001bd00, 0x0001cd80, 0x0001de00, 0x0001ee80, 0x0001ff00, 0x10000000,
+       0x000028ad, 0x00000000, 0x00010001, 0x00350804, 0xccccccc1, 0xffffffff,
+       0xffffffff, 0x7058103c, 0x00000000, 0xcccc0201, 0xcccccccc, 0x00000000,
        0xffffffff, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x00000000, 0x00007ff8, 0x00000000,
-       0x00003500, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
+       0x00003500, 0x000e01b7, 0x011600d6, 0x0000ffff, 0x00000000, 0x0000ffff,
        0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x00100000,
        0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
+       0x00000000, 0x00100000, 0x00000000, 0x007201bb, 0x012300f3, 0x0000ffff,
        0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x00100000,
-       0x00000000, 0xfffffff3, 0x320fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1, 0x30efffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6,
-       0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c,
-       0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305, 0xc30c30c3, 0xcf300014,
-       0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa,
-       0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c,
-       0xcdcdcdcd, 0xfffffff7, 0x31efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5, 0x302fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xfffffff3,
-       0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c,
-       0xcdcdcdcd, 0xfffffff1, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
+       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
+       0x00000000, 0x0000ffff, 0x00000000, 0x00100000, 0x00000000, 0xfffffff3,
+       0x320fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c,
+       0xcdcdcdcd, 0xfffffff1, 0x30efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
        0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6, 0x305fffff, 0x0c30c30c,
        0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xfffff406,
        0x1cbfffff, 0x0c30c305, 0xc30c30c3, 0xcf300014, 0xf3cf3cf3, 0x0004cf3c,
        0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
        0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa, 0x302fffff, 0x0c30c30c,
        0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xfffffff7,
-       0x30efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0020cf3c,
-       0xcdcdcdcd, 0xfffffff5, 0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xfffffff3, 0x31efffff, 0x0c30c30c,
+       0x31efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0020cf3c,
+       0xcdcdcdcd, 0xfffffff5, 0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
+       0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xfffffff3, 0x310fffff, 0x0c30c30c,
        0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1,
        0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c,
        0xcdcdcdcd, 0xfffffff6, 0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
@@ -2585,41 +2674,41 @@ static const u32 init_data_e1[] = {
        0xc30c30c3, 0xcf300014, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2,
        0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c,
        0xcdcdcdcd, 0xfffffffa, 0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffff97, 0x056fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5,
-       0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c,
-       0xcdcdcdcd, 0xfffffff3, 0x320fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
+       0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xfffffff7, 0x30efffff, 0x0c30c30c,
+       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5,
+       0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c,
+       0xcdcdcdcd, 0xfffffff3, 0x31efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
        0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1, 0x310fffff, 0x0c30c30c,
        0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6,
        0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c,
        0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305, 0xc30c30c3, 0xcf300014,
        0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xffffff8a,
-       0x042fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0010cf3c,
-       0xcdcdcdcd, 0xffffff97, 0x05cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000,
+       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa,
+       0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c,
+       0xcdcdcdcd, 0xffffff97, 0x056fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000,
        0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5, 0x310fffff, 0x0c30c30c,
        0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xfffffff3,
-       0x300fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c,
-       0xcdcdcdcd, 0xfffffff1, 0x300fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
+       0x320fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c,
+       0xcdcdcdcd, 0xfffffff1, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
        0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6, 0x305fffff, 0x0c30c30c,
        0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xfffff406,
        0x1cbfffff, 0x0c30c305, 0xc30c30c3, 0xcf300014, 0xf3cf3cf3, 0x0004cf3c,
        0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa, 0x302fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffff97,
-       0x040fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0020cf3c,
-       0xcdcdcdcd, 0xfffffff5, 0x300fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0001cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0008cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0040cf3c,
+       0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xffffff8a, 0x042fffff, 0x0c30c30c,
+       0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffff97,
+       0x05cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0020cf3c,
+       0xcdcdcdcd, 0xfffffff5, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
+       0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xfffffff3, 0x300fffff, 0x0c30c30c,
+       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1,
+       0x300fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c,
+       0xcdcdcdcd, 0xfffffff6, 0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
+       0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305,
+       0xc30c30c3, 0xcf300014, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2,
+       0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c,
+       0xcdcdcdcd, 0xfffffffa, 0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
+       0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffff97, 0x040fffff, 0x0c30c30c,
+       0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5,
+       0x300fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c,
        0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
        0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
        0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xffffffff,
@@ -2641,16 +2730,26 @@ static const u32 init_data_e1[] = {
        0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffffff,
        0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0020cf3c,
        0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0x00100000, 0x00070100, 0x00028170,
-       0x000b8198, 0x00020250, 0x00010270, 0x000f0280, 0x00010370, 0x00080000,
-       0x00080080, 0x00028100, 0x000b8128, 0x000201e0, 0x00010200, 0x00070210,
-       0x00020280, 0x000f0000, 0x000800f0, 0x00028170, 0x000b8198, 0x00020250,
-       0x00010270, 0x000b8280, 0x00080338, 0x00100000, 0x00080100, 0x00028180,
-       0x000b81a8, 0x00020260, 0x00018280, 0x000e8298, 0x00080380, 0x00028000,
-       0x000b8028, 0x000200e0, 0x00010100, 0x00008110, 0x00000118, 0xcccccccc,
-       0xcccccccc, 0xcccccccc, 0xcccccccc, 0x00002000, 0xcccccccc, 0xcccccccc,
-       0xcccccccc, 0xcccccccc, 0x00002000, 0xcccccccc, 0xcccccccc, 0xcccccccc,
-       0xcccccccc, 0x00002000
+       0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
+       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xffffffff,
+       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0001cf3c,
+       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
+       0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
+       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xffffffff,
+       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0008cf3c,
+       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
+       0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
+       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xffffffff,
+       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0040cf3c,
+       0xcdcdcdcd, 0x00100000, 0x00070100, 0x00028170, 0x000b8198, 0x00020250,
+       0x00010270, 0x000f0280, 0x00010370, 0x00080000, 0x00080080, 0x00028100,
+       0x000b8128, 0x000201e0, 0x00010200, 0x00070210, 0x00020280, 0x000f0000,
+       0x000800f0, 0x00028170, 0x000b8198, 0x00020250, 0x00010270, 0x000b8280,
+       0x00080338, 0x00100000, 0x00080100, 0x00028180, 0x000b81a8, 0x00020260,
+       0x00018280, 0x000e8298, 0x00080380, 0x00028000, 0x000b8028, 0x000200e0,
+       0x00010100, 0x00008110, 0x00000118, 0xcccccccc, 0xcccccccc, 0xcccccccc,
+       0xcccccccc, 0x00002000, 0xcccccccc, 0xcccccccc, 0xcccccccc, 0xcccccccc,
+       0x00002000, 0xcccccccc, 0xcccccccc, 0xcccccccc, 0xcccccccc, 0x00002000
 };
 
 static const u32 init_data_e1h[] = {
@@ -2751,11973 +2850,13457 @@ static const u32 init_data_e1h[] = {
        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00007ff8,
-       0x00000000, 0x00003500, 0x00000003, 0x00bebc20, 0x00000003, 0x00bebc20,
-       0x00000003, 0x00bebc20, 0x00000003, 0x00bebc20, 0x00000003, 0x00bebc20,
-       0x00000003, 0x00bebc20, 0x00002000, 0x000040c0, 0x00006180, 0x00008240,
-       0x0000a300, 0x0000c3c0, 0x0000e480, 0x00010540, 0x00012600, 0x000146c0,
-       0x00016780, 0x00018840, 0x0001a900, 0x0001c9c0, 0x0001ea80, 0x00020b40,
-       0x00022c00, 0x00024cc0, 0x00026d80, 0x00028e40, 0x0002af00, 0x0002cfc0,
-       0x0002f080, 0x00031140, 0x00033200, 0x000352c0, 0x00037380, 0x00039440,
-       0x0003b500, 0x0003d5c0, 0x0003f680, 0x00041740, 0x00043800, 0x000458c0,
-       0x00047980, 0x00049a40, 0x00008000, 0x00010380, 0x00018700, 0x00020a80,
-       0x00028e00, 0x00031180, 0x00039500, 0x00041880, 0x00049c00, 0x00051f80,
-       0x0005a300, 0x00062680, 0x0006aa00, 0x00072d80, 0x0007b100, 0x00083480,
-       0x0008b800, 0x00093b80, 0x0009bf00, 0x000a4280, 0x000ac600, 0x000b4980,
-       0x000bcd00, 0x000c5080, 0x000cd400, 0x000d5780, 0x000ddb00, 0x00001900,
-       0x00000028, 0x00000000, 0x00100000, 0x00000000, 0x00000000, 0xffffffff,
-       0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+       0x00000000, 0x00003500, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
+       0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff,
+       0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000003,
+       0x00bebc20, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000, 0xffffffff,
+       0x00000003, 0x00bebc20, 0xffffffff, 0x00000000, 0xffffffff, 0x00000000,
+       0xffffffff, 0x00000003, 0x00bebc20, 0xffffffff, 0x00000000, 0xffffffff,
+       0x00000000, 0xffffffff, 0x00000003, 0x00bebc20, 0xffffffff, 0x00000000,
+       0xffffffff, 0x00000000, 0xffffffff, 0x00000003, 0x00bebc20, 0xffffffff,
+       0x00000000, 0xffffffff, 0x00000000, 0xffffffff, 0x00000003, 0x00bebc20,
+       0x00002000, 0x000040c0, 0x00006180, 0x00008240, 0x0000a300, 0x0000c3c0,
+       0x0000e480, 0x00010540, 0x00012600, 0x000146c0, 0x00016780, 0x00018840,
+       0x0001a900, 0x0001c9c0, 0x0001ea80, 0x00020b40, 0x00022c00, 0x00024cc0,
+       0x00026d80, 0x00028e40, 0x0002af00, 0x0002cfc0, 0x0002f080, 0x00031140,
+       0x00033200, 0x000352c0, 0x00037380, 0x00039440, 0x0003b500, 0x0003d5c0,
+       0x0003f680, 0x00041740, 0x00043800, 0x000458c0, 0x00047980, 0x00049a40,
+       0x00008000, 0x00010380, 0x00018700, 0x00020a80, 0x00028e00, 0x00031180,
+       0x00039500, 0x00041880, 0x00049c00, 0x00051f80, 0x0005a300, 0x00062680,
+       0x0006aa00, 0x00072d80, 0x0007b100, 0x00083480, 0x0008b800, 0x00093b80,
+       0x0009bf00, 0x000a4280, 0x000ac600, 0x000b4980, 0x000bcd00, 0x000c5080,
+       0x000cd400, 0x000d5780, 0x000ddb00, 0x00001900, 0x00000028, 0x00100000,
+       0x00000000, 0x00000000, 0xffffffff, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
-       0x40000000, 0x40000000, 0x00000000, 0x00007ff8, 0x00000000, 0x00001500,
-       0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
+       0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x00000000,
+       0x00007ff8, 0x00000000, 0x00001500, 0xffffffff, 0xffffffff, 0xffffffff,
        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
        0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
-       0xffffffff, 0xffffffff, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+       0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
-       0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x00000000, 0x00007ff8,
-       0x00000000, 0x00003500, 0x00001000, 0x00002080, 0x00003100, 0x00004180,
-       0x00005200, 0x00006280, 0x00007300, 0x00008380, 0x00009400, 0x0000a480,
-       0x0000b500, 0x0000c580, 0x0000d600, 0x0000e680, 0x0000f700, 0x00010780,
-       0x00011800, 0x00012880, 0x00013900, 0x00014980, 0x00015a00, 0x00016a80,
-       0x00017b00, 0x00018b80, 0x00019c00, 0x0001ac80, 0x0001bd00, 0x0001cd80,
-       0x0001de00, 0x0001ee80, 0x0001ff00, 0x00000000, 0x00010001, 0x00000604,
-       0xccccccc5, 0xffffffff, 0xffffffff, 0xcccc0201, 0xcccccccc, 0xcccc0201,
-       0xcccccccc, 0xcccc0201, 0xcccccccc, 0xcccc0201, 0xcccccccc, 0xcccc0201,
-       0xcccccccc, 0xcccc0201, 0xcccccccc, 0xcccc0201, 0xcccccccc, 0xcccc0201,
-       0xcccccccc, 0x00000000, 0xffffffff, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+       0x40000000, 0x00000000, 0x00007ff8, 0x00000000, 0x00001500, 0x00001000,
+       0x00002080, 0x00003100, 0x00004180, 0x00005200, 0x00006280, 0x00007300,
+       0x00008380, 0x00009400, 0x0000a480, 0x0000b500, 0x0000c580, 0x0000d600,
+       0x0000e680, 0x0000f700, 0x00010780, 0x00011800, 0x00012880, 0x00013900,
+       0x00014980, 0x00015a00, 0x00016a80, 0x00017b00, 0x00018b80, 0x00019c00,
+       0x0001ac80, 0x0001bd00, 0x0001cd80, 0x0001de00, 0x0001ee80, 0x0001ff00,
+       0x10000000, 0x000028ad, 0x00000000, 0x00010001, 0x00350804, 0xccccccc5,
+       0xffffffff, 0xffffffff, 0x7058103c, 0x00000000, 0xcccc0201, 0xcccccccc,
+       0xcccc0201, 0xcccccccc, 0xcccc0201, 0xcccccccc, 0xcccc0201, 0xcccccccc,
+       0xcccc0201, 0xcccccccc, 0xcccc0201, 0xcccccccc, 0xcccc0201, 0xcccccccc,
+       0xcccc0201, 0xcccccccc, 0x00000000, 0xffffffff, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
        0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
-       0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x00000000,
-       0x00007ff8, 0x00000000, 0x00003500, 0x00100000, 0x00000000, 0x00100000,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff,
-       0x00000000, 0x0000ffff, 0x00000000, 0xfffffff3, 0x320fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1,
-       0x30efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c,
-       0xcdcdcdcd, 0xfffffff6, 0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305,
-       0xc30c30c3, 0xcf300014, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2,
-       0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c,
-       0xcdcdcdcd, 0xfffffffa, 0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xfffffff7, 0x31efffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5,
-       0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c,
-       0xcdcdcdcd, 0xfffffff3, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1, 0x310fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6,
-       0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c,
-       0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305, 0xc30c30c3, 0xcf300014,
-       0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa,
-       0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c,
-       0xcdcdcdcd, 0xfffffff7, 0x30efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5, 0x304fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xfffffff3,
-       0x31efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c,
-       0xcdcdcdcd, 0xfffffff1, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6, 0x305fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xfffff406,
-       0x1cbfffff, 0x0c30c305, 0xc30c30c3, 0xcf300014, 0xf3cf3cf3, 0x0004cf3c,
-       0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa, 0x302fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffff97,
-       0x056fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0020cf3c,
-       0xcdcdcdcd, 0xfffffff5, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xfffffff3, 0x320fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1,
-       0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c,
-       0xcdcdcdcd, 0xfffffff6, 0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305,
-       0xc30c30c3, 0xcf300014, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2,
-       0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c,
-       0xcdcdcdcd, 0xffffff8a, 0x042fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000,
-       0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffff97, 0x05cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5,
-       0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c,
-       0xcdcdcdcd, 0xfffffff3, 0x31afffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300,
-       0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1, 0x300fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6,
-       0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c,
-       0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305, 0xc30c30c3, 0xcf300014,
-       0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa,
-       0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c,
-       0xcdcdcdcd, 0xffffff97, 0x058fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000,
-       0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5, 0x300fffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0000cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0004cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0020cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0001cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0008cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0040cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0002cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xffffffff,
-       0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0010cf3c,
-       0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc,
-       0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c,
-       0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0x00100000,
-       0x00070100, 0x00028170, 0x000b8198, 0x00020250, 0x00010270, 0x000f0280,
-       0x00010370, 0x00080000, 0x00080080, 0x00028100, 0x000b8128, 0x000201e0,
-       0x00010200, 0x00070210, 0x00020280, 0x000f0000, 0x000800f0, 0x00028170,
-       0x000b8198, 0x00020250, 0x00010270, 0x000b8280, 0x00080338, 0x00100000,
-       0x00080100, 0x00028180, 0x000b81a8, 0x00020260, 0x00018280, 0x000e8298,
-       0x00080380, 0x000d0000, 0x000000d0, 0x000280d0, 0x000b80f8, 0x000201b0,
-       0x000101d0, 0x000c81e0, 0x000002a8, 0xcccccccc, 0xcccccccc, 0xcccccccc,
-       0xcccccccc, 0x00002000, 0xcccccccc, 0xcccccccc, 0xcccccccc, 0xcccccccc,
-       0x00002000
+       0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+       0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000, 0x40000000,
+       0x00000000, 0x00007ff8, 0x00000000, 0x00003500, 0x000e0232, 0x011600d6,
+       0x00100000, 0x00000000, 0x00720236, 0x012300f3, 0x00100000, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000, 0x0000ffff, 0x00000000,
+       0x0000ffff, 0x00000000, 0xfffffff3, 0x320fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1, 0x30efffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd,
+       0xfffffff6, 0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0002cf3c, 0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305, 0xc30c30c3,
+       0xcf300014, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2, 0x304fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd,
+       0xfffffffa, 0x302fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0010cf3c, 0xcdcdcdcd, 0xfffffff7, 0x31efffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5, 0x302fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd,
+       0xfffffff3, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0000cf3c, 0xcdcdcdcd, 0xfffffff1, 0x310fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6, 0x305fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd,
+       0xfffff406, 0x1cbfffff, 0x0c30c305, 0xc30c30c3, 0xcf300014, 0xf3cf3cf3,
+       0x0004cf3c, 0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa, 0x302fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd,
+       0xfffffff7, 0x30efffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0020cf3c, 0xcdcdcdcd, 0xfffffff5, 0x304fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xfffffff3, 0x31efffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd,
+       0xfffffff1, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0001cf3c, 0xcdcdcdcd, 0xfffffff6, 0x305fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xfffff406, 0x1cbfffff,
+       0x0c30c305, 0xc30c30c3, 0xcf300014, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd,
+       0xfffffff2, 0x304fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0008cf3c, 0xcdcdcdcd, 0xfffffffa, 0x302fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffff97, 0x056fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd,
+       0xfffffff5, 0x310fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0040cf3c, 0xcdcdcdcd, 0xfffffff3, 0x320fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xfffffff1, 0x310fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd,
+       0xfffffff6, 0x305fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0002cf3c, 0xcdcdcdcd, 0xfffff406, 0x1cbfffff, 0x0c30c305, 0xc30c30c3,
+       0xcf300014, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xfffffff2, 0x304fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd,
+       0xffffff8a, 0x042fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cc000, 0xf3cf3cf3,
+       0x0010cf3c, 0xcdcdcdcd, 0xffffff97, 0x05cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cc000, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xfffffff5, 0x310fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd,
+       0xfffffff3, 0x316fffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0000cf3c, 0xcdcdcdcd, 0xfffffff1, 0x302fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xfffffff6, 0x305fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd,
+       0xfffffff6, 0x30bfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf314, 0xf3cf3cf3,
+       0x0004cf3c, 0xcdcdcdcd, 0xfffffff2, 0x304fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xfffffffa, 0x302fffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd,
+       0xfffffff7, 0x31cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf300, 0xf3cf3cf3,
+       0x0020cf3c, 0xcdcdcdcd, 0xfffffff0, 0x307fffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf300, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd,
+       0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3,
+       0x0001cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf3cc, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd,
+       0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3,
+       0x0008cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf3cc, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd,
+       0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3,
+       0x0040cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf3cc, 0xf3cf3cf3, 0x0000cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd,
+       0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3,
+       0x0002cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf3cc, 0xf3cf3cf3, 0x0004cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd,
+       0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3,
+       0x0010cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf3cc, 0xf3cf3cf3, 0x0020cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd,
+       0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3,
+       0x0000cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf3cc, 0xf3cf3cf3, 0x0001cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0002cf3c, 0xcdcdcdcd,
+       0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3,
+       0x0004cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf3cc, 0xf3cf3cf3, 0x0008cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff,
+       0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3, 0x0010cf3c, 0xcdcdcdcd,
+       0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3, 0xcf3cf3cc, 0xf3cf3cf3,
+       0x0020cf3c, 0xcdcdcdcd, 0xffffffff, 0x30cfffff, 0x0c30c30c, 0xc30c30c3,
+       0xcf3cf3cc, 0xf3cf3cf3, 0x0040cf3c, 0xcdcdcdcd, 0x00100000, 0x00070100,
+       0x00028170, 0x000b8198, 0x00020250, 0x00010270, 0x000f0280, 0x00010370,
+       0x00080000, 0x00080080, 0x00028100, 0x000b8128, 0x000201e0, 0x00010200,
+       0x00070210, 0x00020280, 0x000f0000, 0x000800f0, 0x00028170, 0x000b8198,
+       0x00020250, 0x00010270, 0x000b8280, 0x00080338, 0x00100000, 0x00080100,
+       0x00028180, 0x000b81a8, 0x00020260, 0x00018280, 0x000e8298, 0x00080380,
+       0x000b0000, 0x000100b0, 0x000280c0, 0x000580e8, 0x00020140, 0x00010160,
+       0x000e0170, 0x00038250, 0xcccccccc, 0xcccccccc, 0xcccccccc, 0xcccccccc,
+       0x00002000, 0xcccccccc, 0xcccccccc, 0xcccccccc, 0xcccccccc, 0x00002000,
+       0xcccccccc, 0xcccccccc, 0xcccccccc, 0xcccccccc, 0x04002000
 };
 
 static const u32 tsem_int_table_data_e1[] = {
-       0x00088b1f, 0x00000000, 0x51fbff00, 0x03f0c0cf, 0x19d9b38a, 0x22717618,
-       0xa70143f8, 0xa4303332, 0x10267103, 0x97e204af, 0xaf0c0c8c, 0x2fd78918,
-       0xcf608621, 0x38606610, 0x4206c402, 0x22450c0c, 0xa07af108, 0xfe407b9a,
-       0xb698a842, 0x76c30328, 0x3bf781d1, 0x34957035, 0x24a458a6, 0x458d5d82,
-       0xa0d7191e, 0x4494efc9, 0xd012d7e5, 0x4538d03f, 0x513f9509, 0x547f4201,
-       0x342fa684, 0xf95049f9, 0xa57f5039, 0x77376129, 0x001e542e, 0x61aa8a92,
-       0x00000360
+       0x00088b1f, 0x00000000, 0x51fbff00, 0x03f0c0cf, 0x19d9458a, 0x1138fc18,
+       0x5980a1fc, 0xd8181998, 0x88039880, 0x81b8803d, 0x91a18191, 0xdafd7891,
+       0xbf760862, 0x6ec30330, 0x0211e620, 0x1082239a, 0xf354029f, 0x0f5fc806,
+       0x6512b315, 0x3a263860, 0x06a77ef0, 0x298d2ade, 0xc1124536, 0x1e4586de,
+       0x93476f19, 0xca8922ff, 0xff4041df, 0x65296340, 0x229dbe54, 0x04a65e84,
+       0xe4d1a5a1, 0xd7f2a1ed, 0x5192fea1, 0x0dee6ec6, 0xf8003ca8, 0x6065495c,
+       0x00606549
 };
 
 static const u32 tsem_pram_data_e1[] = {
        0x00088b1f, 0x00000000, 0x7dedff00, 0xd554780b, 0x733ef0b5, 0x49999cce,
-       0x204e4cce, 0x30840909, 0x43511879, 0x7c061e1c, 0x201276f4, 0x06bf2ae5,
-       0x0ea2a17c, 0x2de42108, 0xebf8fea5, 0x092132fd, 0xf636c544, 0xda2f45a2,
-       0x05a855e1, 0xa180d03b, 0x4a00ee05, 0x7836daa1, 0xf5ab15bd, 0x62a2968e,
-       0x96ad2248, 0xbfcb17fe, 0x24fbdad6, 0x00664e73, 0xbbf7bdcb, 0x9fa7efd7,
-       0xece7d9dd, 0xebdaf7b3, 0x7b5ad7b5, 0x5d8a3ded, 0x19d7ea62, 0xa0ff873b,
-       0xc631b3ec, 0x9f2c19ae, 0x23a57cc8, 0x6ad8cbd7, 0x3127d43b, 0x0f623c16,
-       0x5b18926d, 0xb59fda32, 0x71ca0d30, 0xbc20be69, 0xebe16767, 0xc654c612,
-       0x9b4aadff, 0xe8f2c994, 0xf073b9f9, 0xf30f81dc, 0x58564b19, 0x63026530,
-       0xafcc6c2b, 0x8fba830f, 0xfc9c0fb1, 0x7ff8739b, 0xf61b24c1, 0xbf874233,
-       0xaf3edfa1, 0x814f682d, 0xedcdb37e, 0x1215494e, 0xd5db1993, 0x140bd2c4,
-       0x9c9abac6, 0x49b4fe54, 0x60282f4f, 0x26534f6c, 0x7935f7d5, 0x8d348ca9,
-       0x9a07e7a5, 0xb34f547c, 0xf7e3d7f5, 0x2b7c8e23, 0xce0d1595, 0x68ae5adf,
-       0x060b7182, 0x64cc7feb, 0xf9e00541, 0xafeec2a3, 0x5f9aef80, 0x8512989f,
-       0x802c99f2, 0xf7e86536, 0x45fb2ecf, 0x8ce1b4fe, 0x387c3d65, 0x6844da7f,
-       0xe139b127, 0x87459c22, 0xe25c6b34, 0x77b19f71, 0xcdc032a4, 0x6991802d,
-       0xb9b58c99, 0x4f2e6ffa, 0x44f5cc65, 0x0b9a7fb6, 0x5d0cdde6, 0x2eec648c,
-       0xde0c1056, 0xf81ffd00, 0xe80525b8, 0x614976a1, 0x4b26cd78, 0xd012cd15,
-       0x7ccedd8b, 0xa538709b, 0xd41479a2, 0xde60eefb, 0xe383bdc7, 0x9880c5dc,
-       0x46ccd8e9, 0x32a864e5, 0xa5dd87e8, 0xe2e53686, 0x15c5fd87, 0x2fb712e3,
-       0xd517f839, 0xf6f1a6eb, 0x078d328f, 0x7f13b9df, 0xcbe07597, 0xaef7d77d,
-       0x78842332, 0xe11f9853, 0xc657753b, 0xde25c7ba, 0x7d8f163e, 0xc70aab2a,
-       0x8e1567a1, 0x66dcfc0b, 0x367b74e7, 0xb18d4a17, 0x16663835, 0x9c62b563,
-       0x03d95a29, 0x3000b258, 0xb58cb5e7, 0xdda0bd20, 0x3abf6894, 0xdf4ae00f,
-       0x852a4b33, 0x0af1fa7a, 0xf2115e69, 0x10cf41a1, 0xb1259ff5, 0x9ef81d8a,
-       0x70ca92cd, 0xe71f3b1c, 0x8b50fe86, 0xe86ee007, 0xec9eddca, 0x6194fde5,
-       0x48553fbb, 0x3858b5f3, 0x7a4fd4bd, 0xdf038c17, 0x38c0f7a7, 0xa56b3ef0,
-       0xfe69bac4, 0xe1a614de, 0x32c67e78, 0x70a6a440, 0xa8d99099, 0x7867e424,
-       0xfc8165ae, 0x3f2e3364, 0x8be635a7, 0x9f737e00, 0xd0d47cd4, 0x783579ab,
-       0x69c85a3f, 0x266aa076, 0x01b630f3, 0x530593d0, 0x7ca8dd1e, 0xb3918d10,
-       0xcda37331, 0x9663fa28, 0x997b9f99, 0x9cf286d7, 0xcf3f341b, 0xbfd7376f,
-       0x2769dccd, 0xdc3f82ae, 0x8e4e7dcc, 0xc0e38f33, 0x12cf00d4, 0x6fc0ef21,
-       0xadbf2c6a, 0x5a19626d, 0x91396241, 0x5dce1c96, 0xb7687a89, 0xf7c073e4,
-       0x907b602f, 0x6ef890ef, 0x05d7a8bd, 0x0d5d8555, 0x1e282025, 0x958afc7f,
-       0x1fba406e, 0x101b6567, 0xbf4a0dff, 0x0d7c03aa, 0xa43faa8d, 0x17bf6d0d,
-       0xd7db1118, 0x4e03be2b, 0x99bfbf18, 0xf8c3d6f9, 0x197aec4b, 0xec3c97d6,
-       0xd798bd25, 0x7e472d1e, 0xea05d31d, 0xfbf0772a, 0x2767808b, 0xecf001c2,
-       0x97f4e3e4, 0xdfedfea3, 0xb9f5b12b, 0x77ef0e38, 0x165ceec9, 0xe70c4dcc,
-       0xfc4ecc73, 0xbc0b40b4, 0x267ee582, 0x02c62729, 0x83cc3d9a, 0xcaa968f4,
-       0x54394efb, 0xe9f7c69f, 0xf9ccf583, 0x00033233, 0x6618d657, 0xb3a557a2,
-       0x7af50731, 0x1cb84575, 0x25c3e2f9, 0x12c0acaf, 0x00ae9cf0, 0x2a388fbe,
-       0xea7ec75e, 0xa21636e6, 0xe870edc8, 0x7b1afe34, 0x7237d647, 0x1fa50f11,
-       0xd06fc02b, 0x1865306d, 0xff4595f2, 0xc60fbfc3, 0x989cba8a, 0x172a17ee,
-       0xe20a3f60, 0xf59fcb8d, 0x0f4207fd, 0xf8261e81, 0x957ecbbc, 0xb63c305f,
-       0xc17e7afe, 0x09500144, 0x13f0cbc1, 0x4552a2c6, 0x663dbd1c, 0xa561e977,
-       0xff3c3138, 0x7404f3d9, 0x001a7cd2, 0x7527c8b7, 0x1cb4356e, 0xa7753df0,
-       0xe075f23d, 0x5275ba93, 0xdb7501c8, 0xefbd173e, 0x11ebcb5d, 0xe9f5cab7,
-       0x0a83a846, 0x7f74706c, 0xb3e47afb, 0x8f5b329d, 0xf5858edd, 0x09ccf418,
-       0xc49b3b01, 0x174ae7d7, 0xdbadd6af, 0x5f7e1f7f, 0x2e60e5d5, 0xf76eafe8,
-       0x87af9ba2, 0x76c3a2fa, 0x36ea4d86, 0xa123ab35, 0xd7c438be, 0x0e32bea5,
-       0x4c97705f, 0xa79f4beb, 0xa076e33b, 0x2726c9cf, 0xd0f182f3, 0xb8ceeee2,
-       0x3aadf80d, 0xbf1cbdb4, 0xf92adeab, 0x7753ed10, 0x85943a6e, 0x9721faf3,
-       0xc92d9af3, 0x0fe06bcc, 0x29d13bfe, 0xef0ebe47, 0x193cc097, 0x7588bbf4,
-       0xac3ea394, 0xad14f4db, 0x4ebe0633, 0xce34e936, 0x10fe1c80, 0xeaef81c6,
-       0x387c925f, 0x0b1b7ac5, 0xeef63ca0, 0xa0d9cd76, 0xd59afce1, 0x6bce3742,
-       0x16ed8aa5, 0x72ede685, 0x75be1179, 0xafbc396a, 0xad4ebb5e, 0x9adf918c,
-       0x70cdc32d, 0x111fc9ad, 0x717d8f38, 0x6f0bec12, 0x1abd60e1, 0x45ea01f5,
-       0xaec6a425, 0xa9496f6b, 0x2d9adf44, 0xf89af332, 0xf83dd388, 0xedd68caf,
-       0x5f375ee0, 0x06dd05b7, 0xdba0aaf4, 0x51d05d69, 0x67892fe9, 0xe91b7c7f,
-       0x2074f000, 0x255ca09e, 0xc0dcf3e0, 0xdfe8154a, 0x2e3a67e3, 0xcbe217bb,
-       0xc79b3b0e, 0xcd39ac60, 0xac0afd9b, 0x7b2a1da3, 0xef99ed10, 0xd3fd86b6,
-       0x966dbd60, 0x8025b302, 0xaa05b65b, 0xce15baf8, 0x857f75c4, 0x946f6f58,
-       0x15af34bc, 0x809fc059, 0x25e98ef7, 0xc049641b, 0xcaf5869e, 0x4b9e3c1f,
-       0xfd43dcfd, 0xfe4fd0a8, 0xcbd1fb85, 0xd1fa98a7, 0x7e8cabcb, 0x493f5016,
-       0x474fd717, 0x786675f9, 0x7e8dabca, 0xcf1fa8ea, 0xff4bcdc5, 0x78660dc6,
-       0xfd4b51be, 0xb1f34ea4, 0xbaeb8680, 0xedd607e0, 0xb6bde197, 0xe3c27535,
-       0xca2f962c, 0xdcf1c61e, 0x7cb12520, 0xc9253291, 0xfea987c4, 0xf43aa661,
-       0x2cbad3a4, 0xe3df8ff4, 0x4754b924, 0x4a17a4aa, 0x9e093a47, 0xa46a4687,
-       0x2eba1e17, 0x87ae3970, 0x4bda3638, 0xab81a90f, 0x0d7c38f5, 0x132c4a70,
-       0x320fb04b, 0x695fbe87, 0x1b2878e7, 0x7df0b675, 0xd6c1bef8, 0xf50a985f,
-       0x3fe95b36, 0x959e3ce2, 0x24969db8, 0x976c46b3, 0xdef6e0e4, 0x0d92dcca,
-       0xb53c18c1, 0x4bfa068f, 0xdbb6fd83, 0x5fc89903, 0x0ebf4bcf, 0x18adbf22,
-       0xfc7d92ad, 0x22aff342, 0x2b8fd041, 0x22665747, 0xc82a1d3e, 0x2af8ec77,
-       0xe3445f8c, 0x7ff1c06f, 0x477c6098, 0xf8d314de, 0xd32a9cce, 0xc6154ef8,
-       0x26df7e07, 0x07c625bd, 0xd8c75dfc, 0xa1bfcd4b, 0x55391df1, 0xb44afe34,
-       0x4fc7634f, 0x27ff181a, 0x5bbb8c12, 0x90d2ebe2, 0x675de7f9, 0xb54e7f9e,
-       0x9f2afe79, 0xdfe95eff, 0x3449f8c4, 0xefcd7dff, 0x54e7f9f1, 0x783bf9f3,
-       0x7be303bf, 0x107ff006, 0xd1247fe7, 0x306ff3fc, 0xad4c7fcf, 0x3e0efe79,
-       0x0fa52ffe, 0x8d1af8c5, 0x13e6abff, 0x6a63fe7c, 0x11d57c69, 0xa91f21f0,
-       0xc91a92a3, 0xed06cf9e, 0x94748234, 0xdcb1ca9f, 0xf2976eee, 0x250f0f08,
-       0x3cfbbe71, 0x1b4df809, 0x042c77d4, 0xacfa0512, 0xcd7cf05e, 0x503552d6,
-       0xde83de24, 0x5d40285b, 0x5f1325d0, 0xd08ed5b3, 0x6f6f0065, 0xfac41c97,
-       0x0b5fd582, 0x71deb4c9, 0xb9cc007f, 0xc3ff3e08, 0xc7d6e3d3, 0x2e5acbce,
-       0x889fb0ec, 0xc388e49a, 0x63632c13, 0x6bbe011b, 0x67f09d25, 0x1e804fd4,
-       0x3f3fa065, 0xe58a3d00, 0x381fc287, 0xa9967a0e, 0x4cd372b1, 0x6f7741df,
-       0xeebcc116, 0x509ff010, 0x2c4fbe38, 0xff884295, 0x507a9fcf, 0xb0b4fd45,
-       0x3e901923, 0xa0834708, 0x476eff53, 0xf844bd68, 0xee7e22f4, 0xec645124,
-       0x5fbec277, 0xe9b866b4, 0xd42cb9bb, 0x1fed0996, 0xb46f3558, 0x67bff30e,
-       0x4c82638e, 0x947f9f7e, 0x8d98e48d, 0x318f81b2, 0xfb29f3a7, 0x39dca828,
-       0xefb26ec7, 0xeb980aef, 0xeb9954f7, 0xdd90f6bd, 0x62c6f686, 0x7e83ad89,
-       0xbf346def, 0xdbb1c637, 0x8c7b0986, 0x0647778f, 0x2c5ef787, 0x9d63e027,
-       0xce9f7ae8, 0x69e035bf, 0x22cec478, 0xd3465eb4, 0xc1678fd1, 0x02d7b274,
-       0x15b79f3a, 0x4eecfbde, 0x73c0057f, 0xe132c3df, 0x747f0ad3, 0x06dfb25f,
-       0xcd745c76, 0xe768ed1f, 0x8563e75a, 0xd665feff, 0xea2ae8f9, 0xeb4179fb,
-       0x5627ce73, 0x2ae86a7e, 0xa63c7e1d, 0xeff85d5d, 0xe18f1f87, 0xb32d9aaf,
-       0xa1c5f54c, 0x17ed4cbb, 0x7a6799ad, 0xb163b0bf, 0xed03fde9, 0xf3ea9a0f,
-       0xda9b0f82, 0xd9acbfdf, 0xc6defef4, 0xefef4cc7, 0x54ca7aa9, 0xacf02bbf,
-       0x739dfda9, 0x4bde99d6, 0x898f16fb, 0x8c0d5e92, 0xf2bb42c9, 0x7e43076d,
-       0x90ddf834, 0x329a8f87, 0xe4d93ca9, 0xe519b2a5, 0xb6dfe414, 0xeb0d979b,
-       0x63d18de7, 0xed0ff6ec, 0x4f28398d, 0xe2b7be56, 0xf0dfcad3, 0x75bc546f,
-       0xc16b28c8, 0xd73d475f, 0xe367d627, 0xf8648f79, 0x2e49cb07, 0xb72e556b,
-       0xcab23bb5, 0x55ae5fd0, 0x718d8523, 0x79018afc, 0x0f344b0e, 0x3a745686,
-       0xd5b80dd2, 0x137cd744, 0x65fb3d9c, 0x651ebf1a, 0xffdff417, 0xb2df1565,
-       0x1c883ea1, 0x1c75b9cc, 0xc87fe3c2, 0xa574f086, 0xd3dbfad3, 0x71f86334,
-       0x4157f105, 0x734d47e5, 0x14d13ca8, 0x5378f2a0, 0x341f9515, 0x6d195235,
-       0x7be5465a, 0xdf2a414d, 0xf2a76a6d, 0x541d4db7, 0x435a6b1e, 0x429a6fe5,
-       0xf936f654, 0x2bf01ca9, 0x26993d0c, 0xff614aec, 0xf5410ac3, 0x322e62d3,
-       0xf24dddfc, 0x7944cbe8, 0x5e7dad3c, 0xe9f37688, 0x72c60e63, 0xcacbe313,
-       0xcaf1090f, 0x545764fc, 0x4c394086, 0x95defa1c, 0xb2e4e9c4, 0xf40c19b1,
-       0xfd9763c6, 0x88bf37c0, 0x861b0aea, 0xb37c87df, 0x05fa71dc, 0x75e915df,
-       0x7f313a21, 0xa06cf17f, 0xfee789c7, 0xedfb04bd, 0xd70a75c1, 0xad3283cb,
-       0xc1b22c97, 0xc18af487, 0xfd3fad1b, 0xbe5e853b, 0xa54efe00, 0xceebf81b,
-       0xd8bb7f41, 0xa7ff53a6, 0x414c1d3b, 0x0e49ee3c, 0xf4eaa861, 0x5c1e0de1,
-       0xda6496ef, 0xf071e3f4, 0xe1759460, 0x5d8b5d5c, 0xf5ccba27, 0x0cd21dd3,
-       0xa6f2bf1e, 0xd67c86dc, 0x0bc7eba4, 0x5499fe90, 0xc92cfd1a, 0xe4e3f554,
-       0x3af8871f, 0xf89535b5, 0x6a36fc14, 0x470d1ff7, 0xe1067ea2, 0x87bf64e8,
-       0xc917c9ef, 0x337ef2ff, 0x7144fe53, 0xfec7b626, 0x0ee7ae39, 0xf91ceff8,
-       0x8dd50af7, 0x72c21b7e, 0x3e3571d0, 0x0f1a6adf, 0x3e1af3be, 0xf3bcb9f1,
-       0x4ec2abf1, 0xbdf9f8c4, 0x71f90638, 0xf7acdd2e, 0x86f54d53, 0xb4dd2cae,
-       0x201fe00e, 0x524aacf7, 0x056a5f90, 0x5a29f4f7, 0x1df004bb, 0x2e8979b1,
-       0x576f120d, 0x01aa8ce7, 0xcb4df22f, 0xb17bd71d, 0x2f1a8765, 0xe9b2716e,
-       0x125157b0, 0x9f235fc3, 0x8e22a87e, 0x8d1c3f9d, 0x368bd427, 0x67334f6e,
-       0x24fe83d0, 0x667a0ccb, 0x6d3409bb, 0x07e43f00, 0x753138c1, 0x21c59fa3,
-       0x75bc7f7b, 0xedc6c7b2, 0x05b8eb64, 0xf85174b2, 0xb47adfab, 0xc56de71c,
-       0xa7d77d63, 0x0be4806a, 0x883257fe, 0x47bf0347, 0x3205156c, 0xe5bd5ff4,
-       0x3f27b27d, 0x1f0b07b2, 0x1ade8f39, 0x7996bf0a, 0xde663922, 0xe38dd641,
-       0x5a7117cc, 0xdf3befe0, 0xe3f17581, 0xe30cecd7, 0xb42cecf0, 0x8303818a,
-       0x3fa8364c, 0x3bf36a20, 0xfb3e286b, 0x41db8db1, 0x0785580b, 0xd62ac29d,
-       0xe0768251, 0x819b6629, 0xdec53a78, 0xa18c4cf0, 0x25590cd3, 0x6ed03cfa,
-       0x7ec043b6, 0xad17d535, 0xd92bd731, 0x33d40cec, 0x2cedab95, 0x4cfcd124,
-       0x3ac8a7ef, 0x3588bbf5, 0xb9f5c0ae, 0xdfe3cec5, 0x8ca675f3, 0x5eeaf802,
-       0xe304be7e, 0xdcc8b7e2, 0x1be2308f, 0xf871878b, 0x54ebc3ab, 0x7dffbc3f,
-       0xae3bc4e7, 0x687df867, 0xc10fae05, 0x936f929d, 0xbf7e2877, 0x7856fc2c,
-       0x487bf58d, 0x51c0459c, 0x1b8a45b7, 0xf057bd37, 0x3f8fc1b7, 0xec36f312,
-       0x1eb197fa, 0xca37f763, 0x332aae22, 0x4a7ee919, 0x296d0677, 0xefe29ef4,
-       0x5f0e1dc1, 0xacefcc0b, 0xf22962ad, 0xc50fd817, 0x59dda62c, 0xf79e805b,
-       0xd257af48, 0xa11299be, 0x7b58107d, 0x357dd894, 0x8c53c939, 0x83376371,
-       0xf71f35f5, 0x241482d5, 0x9aaee158, 0x6e318ac9, 0xfa00fa0d, 0x7e53d27b,
-       0x4bba8258, 0x9fd864eb, 0x971cd323, 0xf5cd7977, 0xf703fc06, 0x8a32c67d,
-       0x558f251f, 0x308c782c, 0x9f6e1fd4, 0xe42fbe25, 0x1f13de11, 0xa1c5887b,
-       0xb9116a74, 0xe9461918, 0xf297f019, 0xf0e35fd0, 0xda007c53, 0xfb79d52f,
-       0x5f07117a, 0x88d976fa, 0x9789e761, 0x15819c35, 0xdd4c7868, 0x519fd388,
-       0x25e26858, 0xac2f55e8, 0xf57a31b6, 0x07e05b65, 0xa3d40f48, 0xe3049f08,
-       0x04f86204, 0x563d571c, 0xf85a0fce, 0x23866fe1, 0xfbf4998d, 0xe5e05b11,
-       0xcdfc7078, 0xe90e67fd, 0x687fe0ff, 0xfa4305ff, 0xfebc75ff, 0xb6de5eeb,
-       0x54fc082b, 0x3da7e3fd, 0x63ecccc0, 0x07c323a5, 0xd4ddaf74, 0xfcb941e6,
-       0x907a0948, 0x64871fae, 0xf2b3f7da, 0xe4315d81, 0x2549afd3, 0x47c43fc4,
-       0xe27c5f27, 0x3eb7b466, 0xc9d764df, 0x88e2dfbf, 0xeb298038, 0xf973173b,
-       0x9f78e2d8, 0x8a7e57d7, 0x65d0d9fc, 0x9bd517d6, 0xd2f0ce9f, 0xfe1415fa,
-       0x87fc846f, 0x287f8dfa, 0x81ac7b47, 0xb3de93f5, 0x9fe3877e, 0xc2f64619,
-       0xe865353c, 0xaebf637b, 0xa1a5e041, 0x654f89f3, 0xf9289612, 0x55f6d68b,
-       0x5cf80fc2, 0x9367fb16, 0x33e464d9, 0xc42c1f03, 0xe5f900fd, 0x8e318be7,
-       0x35f1b3d3, 0xcb14548f, 0x9def5c9f, 0xfdf03f0e, 0xcb137a9f, 0xc5e82f53,
-       0xb0db7b58, 0xc25dbcef, 0xcbc3d97f, 0x83c47b5a, 0x75dafd71, 0x1e105f76,
-       0xf0db6ed7, 0xae30e783, 0x77c3b6f2, 0xb35ff419, 0x5cdfd5ed, 0xed9af507,
-       0x7c99b4f6, 0x31949a1a, 0xf8069748, 0x4184d96f, 0xe4ff543a, 0x8e3bd555,
-       0xd8747f3f, 0xb66a3d20, 0xb8d957ef, 0x1a98f8a1, 0xb546afde, 0xbf097438,
-       0x867e8e5f, 0x2a17f2fc, 0x7de3fdd2, 0x1b911b12, 0x5eeb9f07, 0xf1197b25,
-       0x74147444, 0xa59ba01a, 0x05d0037d, 0x2741abf5, 0x4263fbeb, 0x6f3fb1de,
-       0x4bf3f111, 0x907dc53f, 0x387c3adf, 0xbe97aaff, 0x7c79c1e9, 0xbe7234a8,
-       0xc32dbe7e, 0xd956e30f, 0x953a1983, 0x0bd579fc, 0x5b7e22df, 0x195bf474,
-       0xfe60bf14, 0x0ad91b2c, 0xdf9c2cc1, 0xd3b7b5c2, 0x80592afc, 0x79eaaef8,
-       0xabd702b9, 0x633614cf, 0x78b91c7b, 0x87c5c844, 0x80f1c1eb, 0x0b887df9,
-       0xbc0bee07, 0x06de5321, 0x7c520f63, 0x7ec65be4, 0xf5425b0e, 0x4e9c9ccf,
-       0xefc315b3, 0x96279585, 0xecae375f, 0x1c9cfa46, 0x71811fed, 0x04a606df,
-       0x73a43e05, 0x747cafd0, 0x1f4e08fa, 0xc44a55e6, 0xa7efa077, 0xdf6c73e2,
-       0x8abbf76d, 0x73b1df4d, 0x2fe383b9, 0xdc03e315, 0x7ecf6849, 0x1f7f1198,
-       0xac62b37f, 0xc5576037, 0x7c8c57f0, 0xf8df7973, 0x436f9718, 0x66b343de,
-       0xbd3ffbe0, 0xbf07e5c9, 0xe0057b43, 0xf7a08c8a, 0x48936ffb, 0x2458381f,
-       0xb46f5c9e, 0xbf36b90b, 0xe004f837, 0x1ddd7056, 0x7fec17e0, 0xec9fe118,
-       0xf0d5cad8, 0x6cbe8c5d, 0x433cf1c0, 0x76e433fb, 0x87ff9091, 0xb3fcb314,
-       0x13ee5cb5, 0xc2411bfb, 0xf43dad4f, 0x5e50e783, 0x1f713e41, 0xbd9b76ba,
-       0xc9fde702, 0xb9bf83d6, 0x93e4e41b, 0x66a721b0, 0xd39569fd, 0xb0d71daa,
-       0x09fa7278, 0x93c413a6, 0x571e7853, 0xf128b54e, 0xfe957ff1, 0x82f7f034,
-       0x3e867f05, 0xab47844c, 0xf15ebc3e, 0xfaad3e12, 0xc9bdfe10, 0x9ff2864a,
-       0xbf0677c1, 0x6ea8ff55, 0x019dea0c, 0x6ef834be, 0xbe0d2f80, 0x342f121b,
-       0x3e886fe1, 0xf00cd8c3, 0x7feec549, 0x99fcc72d, 0x5f7c3dda, 0x843bbe14,
-       0x9f93c075, 0x871d61bb, 0xd6c5a546, 0xd87a9643, 0xa96fded2, 0x07da5857,
-       0x4b46f52c, 0x0bf710fb, 0x3caa0ebb, 0x6a62254f, 0x82ce5f6f, 0xef538c6e,
-       0xd21e2995, 0xc0af3007, 0xb9ada4bc, 0x6863cc21, 0x5338f173, 0x02baba7f,
-       0xde9f57f5, 0xb07b41ef, 0x73e3c5df, 0x9efd157d, 0xec3b18d4, 0xe9323dfd,
-       0xcd8868df, 0x822fe788, 0x8bf44187, 0x79ef44b2, 0xacba7ddc, 0xf8c32ce5,
-       0xc3ec874a, 0xe682cd90, 0xdfb83d3b, 0xff27b7df, 0x7cf03996, 0xb69911e1,
-       0xfed0faf3, 0xfb34414e, 0x3f18ac95, 0x7c1623ed, 0xa38c06e6, 0xdafee1ef,
-       0xbb165582, 0xbe22ad82, 0xaa96d4a8, 0xbfc117a8, 0x8fbcc0fa, 0x5abbf9c0,
-       0xd6b557f4, 0xdef8defc, 0x37abe3f0, 0x8407df9a, 0xf9167fdf, 0xf1d2ed1d,
-       0xbbf73c6c, 0x09378f19, 0x2e5d3afd, 0xe00e65ba, 0xccb0efbf, 0xef4e5f90,
-       0xa7ff0991, 0x737df2b7, 0x8b5f9f8a, 0x7a4fda7c, 0x0f53c0cd, 0x589a85ca,
-       0xfcecf4ef, 0xd023c95d, 0x3bd776a4, 0x6504ffc5, 0x0bb7aecf, 0x97f5867f,
-       0x8779cadf, 0x753f6d0d, 0x2bf68b9f, 0x69b9f6fa, 0xef6fb17f, 0xc11e732f,
-       0x8f876efa, 0xfdf6fef2, 0xa7f918b9, 0x0aa3b96f, 0x68df56f5, 0xecb667ee,
-       0x947173fd, 0xa256c9d6, 0xee76e5db, 0xf3de9ee7, 0x6949efef, 0x70acc258,
-       0x4c97dffd, 0x9f86b771, 0xd65e28ba, 0x25cff7b7, 0xa5fbf6b1, 0xec5ea7ce,
-       0xd9b9f623, 0x5f081d9c, 0x697fdf2a, 0x1bb5d9f8, 0xa20f319a, 0x00fabf73,
-       0xcffa9fbc, 0x3ea3145f, 0xedc1dbec, 0xf47b5e9a, 0x9b27dc05, 0xb962b6d0,
-       0x8bd5e81d, 0x64fb8142, 0x0b2f3f6d, 0xf2f0f16a, 0x2f01c505, 0x8f7f1f16,
-       0x9fff48f8, 0xf6890f80, 0xb8f76bbf, 0xe7094e43, 0xdef797fd, 0xcfb03d41,
-       0xcc697c41, 0x337093f7, 0x9a171dd9, 0x6e57d577, 0x62e452de, 0xbff2bde6,
-       0xedbbff39, 0x2acf825e, 0x7cf94307, 0xdf5443ef, 0xbc11f6e6, 0x9befc917,
-       0xdf746abf, 0x5cf77401, 0xfe87de78, 0xc8fdd2c7, 0x3aee827d, 0xfc3499e6,
-       0xdf0417f3, 0x2773d597, 0x3dd39bfe, 0xfb0dfcd1, 0xaf9b71fc, 0x6ce30f23,
-       0x3ac3fd68, 0xb767b9ad, 0xf1efd863, 0xb475b3b1, 0x2fb16517, 0x846f8569,
-       0x191ffdca, 0x5e3127f7, 0x3c899a37, 0xd10fee6d, 0xad0c1d96, 0x8f649568,
-       0x6e0ada2a, 0x6ebe2b27, 0xf1e5e03f, 0x28fbe72b, 0x384d8787, 0xf67ac016,
-       0x438a3e0d, 0x56c2fc5b, 0xb025f989, 0x6f2b9553, 0x8a7e8c3c, 0xe22dac7d,
-       0x7df2a628, 0xf88a572c, 0x4d575da2, 0x64568bfe, 0xe6bcbbae, 0xe7f443ba,
-       0x677e1c64, 0x9c610b26, 0x80e2be59, 0xf265f98e, 0x50498578, 0x208eb177,
-       0x4c8e09fa, 0xc47ff7f3, 0xb898d364, 0x11ebda2c, 0xbe7fd7b0, 0x07c50375,
-       0xfef8bd4e, 0xcd6fd8cd, 0x04e664cf, 0x756ef4bc, 0x8df208b3, 0xffd15212,
-       0xfd94eea8, 0x523c8f3c, 0x3ecc6b72, 0xd62761a0, 0x704dd8fc, 0x8470ef55,
-       0xd5f7c266, 0x4c5f7ebb, 0x7ef2f6eb, 0x2f8363b2, 0x3d4f3c4a, 0x7dc62d18,
-       0x0e716abe, 0xf1a74ac0, 0xf77f8f2a, 0x839e4eec, 0x85b4bafe, 0x875649e7,
-       0x623bb4ef, 0xaac64bf2, 0xf11da376, 0x1287f051, 0x7c20a9e5, 0x8679f9b1,
-       0x43f3da9d, 0x65d7c389, 0x65be610f, 0xbded96f5, 0x3ea87718, 0xd9a1f0e6,
-       0x53e5b0d7, 0xfd4f6b8a, 0x944f36f1, 0xe4d92cfc, 0xf7f10e77, 0xd744c8b6,
-       0xb23acefa, 0xf44ea15b, 0x8fc70fad, 0x2fc85c7b, 0xdef1f9a9, 0x6140415d,
-       0x7b364fcd, 0xb271ae30, 0xfc87937b, 0x8fe72dbe, 0xeff10cb7, 0xd79d8fc2,
-       0x7f893bbf, 0xb774fd80, 0xb78ff16a, 0x15fb270c, 0xb7892be0, 0x4df065df,
-       0x5ecfb6cd, 0xcf63f8c0, 0x405e4f8e, 0xfaff6b78, 0xfed017c7, 0x3a5cfb64,
-       0xbc3443ee, 0xbf14aff8, 0x2a5bbe31, 0x87f7aee4, 0xd5ee299b, 0xf6357e0b,
-       0xc3f7bbd6, 0x7a3ff41c, 0x0325ffb7, 0x7ba5e4fd, 0xf9c08fa7, 0x7539dd2e,
-       0xbf238b04, 0x1b7c8946, 0x9bb888ba, 0x3b075e95, 0x7c9d920f, 0x7e8de80a,
-       0x1ebf80ca, 0x0ff1e3ae, 0xb7d3f0af, 0x0e6f8fc6, 0x6f3bcbf1, 0x936be5bd,
-       0x50fbb4b0, 0x3fd05c0d, 0x78e8137f, 0x6fd045f5, 0x5fc263eb, 0x53bf4f89,
-       0xe9d007f8, 0x57f0aabb, 0xeb3efd04, 0xe7fdf85c, 0xf0e75df0, 0xe479fe84,
-       0xc466f022, 0xfd57ef4f, 0x3728abcf, 0xf1447e3b, 0x4cdba410, 0xb6ef6898,
-       0xee3072cf, 0xffbd91fc, 0xef579e3e, 0xad1fd1d0, 0xc916fbde, 0xa3ceef4f,
-       0x22649f14, 0x06cbd98e, 0x93b8f1fe, 0xd86b85c8, 0xbd7ee6e8, 0xfdfa3fc0,
-       0x173d0f5e, 0x63e73dfe, 0xe44fefc3, 0xf2a9bfef, 0xae23023c, 0x1df1b75b,
-       0xd20f3fe1, 0x74829a4b, 0x71bcff7a, 0x3a0f0368, 0x6c7261e2, 0x5c7e2afc,
-       0x29ce2065, 0xadc465e8, 0x5053e206, 0x4578c6cf, 0xc58b7a48, 0xebbd07d1,
-       0xd7abdc78, 0x199fce6e, 0x678f0fa4, 0xa72adafd, 0x638b8ba1, 0x2ffe085d,
-       0xea889f8b, 0x0c73c535, 0x8d9cf53c, 0xab4fc7af, 0x37fa9e3c, 0x902c87ef,
-       0x9f21fbac, 0x75d63f22, 0xf3f2afbe, 0xcbbcfc04, 0xc8b7bec0, 0x5179ebf7,
-       0x8ac878a6, 0xe3d241f0, 0xec617d56, 0x55e15997, 0xd54f5c1c, 0xa275f177,
-       0xa43b8767, 0x073d3f41, 0xd73f1376, 0x455f7d6f, 0x96d0f33f, 0x9edca89f,
-       0xeb83f2e2, 0xfe062844, 0x17f6979e, 0xcf1d78f3, 0x338eb63f, 0xd2f1c1cc,
-       0x38fe27b0, 0x353f5b0d, 0x0c13538d, 0xf37f3cab, 0x549de3fc, 0x7f6277fc,
-       0x0cedbb27, 0x864ef3f3, 0xf6f119e5, 0xeb133f67, 0x035e71a6, 0xb3ca4bd7,
-       0x33cfca3e, 0x89237a4c, 0x1e9798f2, 0x9e0ef19d, 0xe20a5b8b, 0x6760f68c,
-       0xced3e733, 0x428ff07f, 0xbd1e777a, 0x6a75c65b, 0xc637e217, 0xb3792c2e,
-       0xf41baa71, 0x15bbc942, 0xad5d9093, 0x31f266fa, 0x187e099b, 0x03ae0467,
-       0x9e0fd0ad, 0x27fcc02f, 0x94f64784, 0x647840cf, 0xe2bba6dd, 0xb5da95e4,
-       0x36f3ca0a, 0xe6ebb5fa, 0x76766e3c, 0xe9fb17a2, 0x0bc8c2bd, 0x3c4148aa,
-       0x3b7dd67d, 0x29159d2f, 0x99d679fa, 0xecbe848f, 0xef01f269, 0x581673f3,
-       0xbdf9106f, 0xd20e7b55, 0xb0aaa2b9, 0xaf80bcc4, 0xe483acc5, 0xaa4766e6,
-       0xdb335bc8, 0xfe7bd50f, 0x7757da85, 0x2c35f6f2, 0x3cf1ed4c, 0x1f24c446,
-       0x07762d13, 0x913eefe7, 0xa67b51d7, 0xf6624584, 0x7c13ef71, 0x9ba4d3db,
-       0xc22d7bf4, 0xa939e1a7, 0x2ea71a6e, 0x8e34dc3c, 0xcceeaed1, 0x93122c75,
-       0x74a7547f, 0x9dd5bf13, 0x671a3bf9, 0x329abe40, 0xfb890f09, 0x7b82651f,
-       0x2629ffb0, 0xbffb0778, 0xe6b5c681, 0xe6ce6677, 0x5bacc271, 0xce341979,
-       0x852654bd, 0xb76f005a, 0x0e25816b, 0x5ee99f68, 0xc32afb9d, 0x285356f3,
-       0x8761fa3f, 0x8cde50a4, 0x4a759f38, 0x583682d7, 0xd6d39f6f, 0xa303753f,
-       0x707f813c, 0x2793135c, 0x3e7422c0, 0xe43768d3, 0x208f25bd, 0x15013f1b,
-       0xf2f80b28, 0x68c11e45, 0xb4f3a516, 0x3cfcdd6b, 0xcd2d18e0, 0x106fdf86,
-       0xde71be76, 0x40f9c86f, 0x0bc0b9cb, 0x9b4c079d, 0x18e0fa5a, 0x396f631f,
-       0x798a9d3e, 0x967769e2, 0x83a51f6e, 0xa652c1df, 0xe9737d51, 0x97a82cf8,
-       0xf5e16fb5, 0xcf8e975f, 0xab957a81, 0x246bd793, 0xb35fabca, 0x60b4c172,
-       0xe5e825d1, 0x252300db, 0x11bcbd26, 0xe2aa71e9, 0x7a163bdd, 0x5fa14f31,
-       0x1565f8e5, 0x14f46ed8, 0xed6cb78e, 0xa788eddd, 0x3368b631, 0xefef93ea,
-       0xea2a73fd, 0x09d32f71, 0xd56b3a3f, 0x68f07e91, 0xe4f3b9ca, 0xc2f359c3,
-       0xa5d9fe0c, 0x1c227605, 0xd2c7f36d, 0xaae7bc39, 0x1fd13826, 0x6cf2235c,
-       0x0fc81d9e, 0x7ef1e7e4, 0x75fbe0ee, 0xeb0f2299, 0x29b9a3f4, 0x0fa3cec3,
-       0x5dbb321a, 0x7d5c0c4a, 0xb3ed3f4a, 0xff7d9df7, 0xc49bcc3e, 0x759c6a7a,
-       0x37fbf065, 0x93c90a5d, 0xe981ff39, 0x0b5fc469, 0xde217f04, 0xf879319c,
-       0xcaa0e48b, 0x8874c3cf, 0x8e9a6ef5, 0xb58297f3, 0xbeabb9f2, 0x68169e3c,
-       0xcf90f781, 0xbc8871df, 0x34be711b, 0x7be33ce6, 0x79eb4788, 0x8a8e8dc6,
-       0x55977e28, 0xe5072679, 0xa27ce06d, 0xf48591d4, 0x64779eb3, 0x9e2dbf4a,
-       0x9c5eb11f, 0xf7044c77, 0x3e819d8f, 0x9fef3f1c, 0x830e3bbd, 0x40bd5fdc,
-       0xe7ca61f5, 0xa526cbd5, 0x215cfc2b, 0x820d05d9, 0x5c6d32af, 0x1887b03f,
-       0x39f6d3ed, 0xebfa3f24, 0xc9d4df7d, 0x305ec80e, 0xbee6fc93, 0xe630dce4,
-       0xc23df513, 0xfd8297cf, 0x8f7ca120, 0x711293de, 0x3f3e4879, 0xe7e7c8b7,
-       0x3cc97b66, 0x6f39df6e, 0xd3fa9457, 0xc8607f45, 0x0f9e0c67, 0xfaf993ee,
-       0x25e4d7de, 0xe0b34638, 0x2f13b47e, 0xd38f3c76, 0xf017fe7c, 0xf0633baf,
-       0x811c740f, 0x426734f5, 0xc6708e3a, 0x1cf5a3a1, 0x204711ea, 0x587ddb1b,
-       0x86056879, 0x4fe7ac5e, 0x42cc1299, 0xdbe9593c, 0x6b3c74a0, 0xec662987,
-       0x16ec94f9, 0x2f577e83, 0xc32ba5f3, 0x8b1cf44d, 0xe7bd5e70, 0x6dc21b53,
-       0x527bf1d0, 0x8277bb7c, 0xd667af93, 0x44e632f1, 0xed38816d, 0x5095978b,
-       0x499f807f, 0x8f5cfc16, 0x14e29af3, 0xfc50c2eb, 0x2fed8f5c, 0x8bfe3f02,
-       0xc7e18fc1, 0xae3908d5, 0xa0277dc1, 0xb3bc1ff3, 0xdc60f233, 0x3e235972,
-       0xa649bc5d, 0x9fb42db8, 0x28319599, 0x6daf8bf7, 0x7e076fdc, 0x44bcfc59,
-       0x9c40b4fc, 0x9c44ff2f, 0xefe6b13f, 0x9209ce55, 0x1e70bd9e, 0x46f4885f,
-       0xf3f316cd, 0x7fc29dbb, 0xca1cb374, 0x47f715cb, 0xad7f82c8, 0x09ad3ff8,
-       0x6a905eb9, 0xc7a5676a, 0x299b46e8, 0xea6b3c0f, 0xd7e43f40, 0x6fbcda67,
-       0x17edfc51, 0x20f18676, 0x293692bf, 0x2498f882, 0x4b7ec34d, 0xfd197c85,
-       0xb666598d, 0xe68372eb, 0xedf979f3, 0x9779f3e6, 0xb5348c75, 0x9e4d7cbf,
-       0xa115fde9, 0xafef4d2b, 0x54c132da, 0xcebe171f, 0xaeeafed4, 0x7c7d5332,
-       0xfb5346e4, 0x9b678789, 0xdf74d7ea, 0xf93f6a6d, 0xfbd37cd8, 0xa6d5a36b,
-       0xb47fd7f7, 0x5aff54c4, 0xb531ffff, 0xfae42c8f, 0x665340eb, 0x7c98f1f6,
-       0xaa0f03e3, 0x3f9f1d36, 0x8bd36858, 0xf8679f63, 0x9658c5bd, 0x4e9fd1f8,
-       0x3aa767a4, 0xd763b2b3, 0x376652f7, 0x4ea99fe9, 0xf0643d73, 0x0bf00e4b,
-       0x45937f10, 0x6dbc80ef, 0xd5193941, 0x983b4378, 0xe2e46ca1, 0xa7941482,
-       0xc5f9f1a7, 0x9236d9c9, 0x9d08fab3, 0x0e738f8b, 0x17356dfe, 0xf7482ef9,
-       0x2e1980a1, 0xa33100ca, 0x9606e60c, 0x29060b0a, 0x28f99cd9, 0xeebad2ef,
-       0x15bdeb1b, 0xdc9c071f, 0x6178701e, 0xdfd9379d, 0x645fee21, 0x3129731e,
-       0xa8f590f8, 0x1ef0eea9, 0xd77fe2d6, 0xeb2e7a6d, 0x69754cc7, 0xffca4cd1,
-       0x3d970449, 0x1b4dfe73, 0xb3d9bf41, 0xcf1a5402, 0xe2d8e6db, 0x9d45f7e6,
-       0x9de79717, 0xf10bbed0, 0xfb18a5fc, 0x39748a2e, 0x33c6f695, 0x3f56af98,
-       0xeffc9fb7, 0x3f59872c, 0x237dd60c, 0x97963e78, 0xf9d4279f, 0xda9b6b9f,
-       0xdf75c26f, 0xb7c2e798, 0x7e606767, 0x7f027642, 0xe7c5c73c, 0xd55342f1,
-       0x8cf00b4d, 0x2589da09, 0x73b2e783, 0x68e50d22, 0xf9118d7f, 0xe2d8cfd4,
-       0x759d3de7, 0x047b7f72, 0x13b4682a, 0xcb3f7e34, 0x3d77caa9, 0x2455b298,
-       0x7f22ce07, 0xbbbabfce, 0xf65f9f84, 0x7c3cf265, 0xf437e09d, 0xf1568e5c,
-       0x1cadea0c, 0xb9bcd730, 0x3119e143, 0x2e4662b7, 0x661d6fbc, 0xef5469f3,
-       0xf05ce897, 0x870d8ca3, 0x957fadf6, 0x03d6be09, 0x905e52d7, 0xda1805aa,
-       0x993cc6e1, 0xf63037c8, 0xbb4b3e11, 0xd6d4fc8d, 0x05ce072b, 0xb55bf231,
-       0xf7ec6e8a, 0x0858bc33, 0x932d69c6, 0xb473ef4c, 0x010f078e, 0xc99d951c,
-       0xd6549714, 0x967e4cdc, 0x69e1c99a, 0xd962417d, 0xe3c3c112, 0x0f8e1ee6,
-       0x42ea83c0, 0x3f73fb3a, 0x869319b7, 0x2a2975f7, 0x9d1ceb9d, 0x8d719e20,
-       0x5b7ebf01, 0x9709d906, 0x5795e19b, 0x21e0fd3f, 0x89d903cc, 0xfde11637,
-       0x3d04cb22, 0x4b6df3cd, 0x5dcb7d9b, 0x4de5aed0, 0xb800c999, 0x30d8ca37,
-       0x0a1c879a, 0x41b7c1c5, 0x1afb802f, 0x535e5b84, 0x15ccf34e, 0x74045e74,
-       0xd32575c6, 0xe8833156, 0x3863619e, 0x37fc2b4f, 0x7fdcb8b8, 0x790ba5cd,
-       0xe369bcad, 0x90172c70, 0x9b5e81bc, 0xba97fd86, 0xd311da12, 0xdbf4715c,
-       0xa8ffee85, 0x087dd39d, 0x136fd94b, 0x61636d76, 0xfa0cbdac, 0xd7ec16f0,
-       0x8f29cba8, 0x17bf6316, 0x141bbbb2, 0xee617b5f, 0xb432ed85, 0x0cff90c7,
-       0x39e60c7b, 0xcfbbc70f, 0x31ebd665, 0xeb9e7c7a, 0x4ac9ece2, 0xdde1f76c,
-       0x12f6b891, 0x1bb271e8, 0xfaf8d5d3, 0x1e82fbee, 0x28caba0d, 0x3ec1302f,
-       0x5c5d77d1, 0x4ff3adae, 0xc85ddeb4, 0x611bc8ef, 0x14ec07ee, 0xa5583ff2,
-       0xa756fb4a, 0x58f75d1f, 0x68fbe621, 0x9bc79479, 0xcb519fa8, 0x0f3f20de,
-       0xe204f9f0, 0xbb5fc0c1, 0xc69e7f85, 0xc5d6f1f7, 0xcda7c05a, 0xd70ecf84,
-       0x7f9fd845, 0xf328b9fb, 0x815e9e79, 0x0ffbd077, 0xf5b83e92, 0xb38c12bd,
-       0x39fedfd4, 0x79bffde9, 0xb8e6399c, 0x802f1181, 0x9c716a71, 0x2aff5bde,
-       0x8a51bae2, 0xbcecb647, 0xab07ee9c, 0x49f4332b, 0x45ce93a3, 0x7d11e766,
-       0xf872ed4e, 0xc353ce11, 0xd4ec5c78, 0x3087c9ae, 0xd349f32e, 0x73d8bce1,
-       0x3a5ea759, 0xfe87625a, 0x5a38ed4e, 0x0f5e90a2, 0xf78cde11, 0xa5fee775,
-       0xe377fd04, 0xdf00c1fc, 0x4bafe339, 0xf9fc16bf, 0xf180f165, 0x525fda78,
-       0xcf68b3d8, 0xd6a5e00d, 0x2a7ff79c, 0xc412bdf9, 0x13ffe603, 0x463c045e,
-       0x8bb57bbc, 0xa45a9fc7, 0xc6e31060, 0x54f7522d, 0xff06d38c, 0x4073a317,
-       0x9256b799, 0xcc3dfe99, 0xd61abc03, 0xb7db0ca1, 0x3e667db1, 0x750b9b1b,
-       0x111d2bc7, 0x1dd49f7c, 0xed42bca6, 0x4b047758, 0x8fdfb44f, 0x47fa86db,
-       0x6f2c7efa, 0x86ff02d7, 0x0feb0fe3, 0xfdf2815e, 0x3313058f, 0x4ca12631,
-       0x62f61df5, 0x852ce21e, 0x7d3a6dee, 0x2275a658, 0x3d739663, 0xa8ceff3f,
-       0x5eedccfe, 0x9392375a, 0x81e9f38c, 0x15575c5c, 0xf611fa56, 0xf815d5bb,
-       0xc33ff904, 0x08785dd6, 0xfb1d73be, 0x79e60e6d, 0xeda2f71b, 0x8fd8ad2a,
-       0xbbfdc6fb, 0x367aef25, 0x9c9f6e34, 0x28dfe5c4, 0xbe3527bf, 0xc961f98d,
-       0x63a7db8f, 0xae7bebbc, 0x0547ba46, 0x999df9fe, 0x702b9fd0, 0x71854b0f,
-       0xc66da924, 0x876ea0d7, 0x7bf1e3f7, 0xd02b5b5b, 0x606a5761, 0xbbde0d94,
-       0x87ad73a5, 0x8dfc3df1, 0x49c965f9, 0x9ef15ae7, 0xe7493538, 0xb902d0f3,
-       0xba818748, 0x4c77750e, 0x2ba969dd, 0xabcc6ebc, 0x285fe0ee, 0x0f7eb3ef,
-       0xef07d7bf, 0x337dc333, 0xe50cb7bc, 0xe849353f, 0xb1698d09, 0xdacea1e7,
-       0x3c49e902, 0xe5c8593e, 0x265f88c4, 0x97e22f78, 0xe291ac85, 0x60f1236b,
-       0x5bda3e75, 0xb0e654dd, 0xf88d2a7e, 0x51f31e5b, 0xa82ac059, 0xa83acb1c,
-       0xa98592bc, 0x54dd622c, 0x2a7eb316, 0xb1974c7d, 0x547cc09c, 0x8f1ad9a6,
-       0xf97d474e, 0xcbe93b0b, 0x1e0f2dc2, 0x0508c918, 0x6aa5ba26, 0x69867e5c,
-       0x2864a1a5, 0x80388b57, 0x16a9ae71, 0x3545e669, 0xd07d90a0, 0x93ea6423,
-       0xee20b635, 0x2ab9b29f, 0xe715af3d, 0x3edf6b80, 0x27e47640, 0xaa79f8fe,
-       0x4b949353, 0xeb3287dc, 0x1ab586c7, 0x73e41be1, 0x1ebbe22a, 0xcdba82e1,
-       0x1ee74dd9, 0xdfc3cbed, 0x745f7196, 0x45f69d9b, 0xa026506b, 0x0c2ee35e,
-       0xa7984b35, 0x9f6a515b, 0xf24d7c44, 0xce1a9353, 0x9e0da098, 0x78fac407,
-       0xebdf906d, 0xc1ca9ebb, 0xf78ff67d, 0xf9eb4dbf, 0x34b9c9f5, 0xa3ceba9f,
-       0xfb4dc06a, 0xcdca2a76, 0xf603e9c7, 0x6d8dd937, 0x9e0a5f2e, 0x25ffe93b,
-       0xc0ca8fbf, 0x7e95f7df, 0xc7beec57, 0x745026e1, 0x37af632a, 0xabf95265,
-       0xbf952f26, 0x1f99d268, 0xf623b91c, 0xe11136a8, 0x11d02f4d, 0xf0f44fde,
-       0x612663eb, 0x179e7b1e, 0x7692d3e7, 0xd444d57c, 0x77d93e3f, 0x77638c19,
-       0xf7849f2f, 0xce64b627, 0x95947ca6, 0x1fe704da, 0xc5169e00, 0x71874ce7,
-       0x6876d35f, 0xd3794197, 0xb89d9317, 0xd696bfae, 0xdf7179a9, 0x3aedfc64,
-       0x7f4103ee, 0xfea56fab, 0x09bfa2ec, 0x18ff6c4e, 0xf60da3f6, 0x6fd45fb3,
-       0xc348ef72, 0x189a87f7, 0x7a537dc1, 0xf7f61a67, 0xaf85a2f3, 0xdf84984f,
-       0xbbdee2db, 0x3499d374, 0x67bb07e6, 0xe61c99e6, 0x737af587, 0x2895e359,
-       0x9a4ddfff, 0xf904e6d6, 0xab1b7257, 0x4dac5f51, 0x09cdb9ba, 0x3653efc6,
-       0xf54e93a0, 0x0015dae9, 0x1fae34c7, 0xbc36f200, 0x659ed06f, 0xfc3af8a3,
-       0x8e5eeba3, 0x8eb8fea0, 0x2d969fbf, 0xfda010f2, 0x9f9fc7cc, 0xad57768e,
-       0xe962f9c4, 0xd3ee8ced, 0x544f6448, 0xf3a2499d, 0x7afd4679, 0xf31104ba,
-       0x8fb483d8, 0x43c67552, 0xbe2efae7, 0x1ce9a73f, 0x34fed0e0, 0x95f0ef1a,
-       0x29f93f06, 0xbb74b36e, 0xf970cfc8, 0xefbb6047, 0x83f98dd9, 0x7c44edbd,
-       0x0a83d40d, 0xaa23dbe8, 0x6df9ff31, 0x6e7f40d3, 0xb3df0756, 0x658f9829,
-       0xf47e67bc, 0x89248f87, 0x7e3ab07a, 0xfb4b24fb, 0x4dfea33c, 0xe7856f6a,
-       0xbac1ae7b, 0x5f2bda13, 0x08ea0638, 0x4b3653df, 0xf18cc37f, 0x6afea11f,
-       0xbed16572, 0x12bf55f5, 0xaae0ef43, 0x667bd2f3, 0xad6dd3d2, 0x9011fdf0,
-       0x6ebf5a73, 0xa17eb467, 0xf462f9dc, 0x6eb14ce0, 0xd2b99d55, 0x3a418f44,
-       0xfee89b14, 0xec65c821, 0xada2eb3e, 0x2173a4df, 0xbcbc9333, 0xe7e4161f,
-       0x9be6d69c, 0x3fff57f6, 0x1c2b7f1c, 0x4c7004fe, 0x63862ffb, 0x41bc69ac,
-       0xf04c8a38, 0x51c3e7fd, 0xf28e0096, 0x561c14af, 0xc728c57b, 0xf642bda0,
-       0xb0f38f2a, 0xb7b236e5, 0x151552fb, 0x369897f3, 0x5204ec85, 0x8eea5e19,
-       0xf146f1f6, 0x8f7799ae, 0xf3b61e63, 0x995dac2a, 0xe82afa80, 0xed7dc3cc,
-       0xe07ef16f, 0x740561f9, 0x2754e8d0, 0x177b47ed, 0xfc60d454, 0xb2a73bdf,
-       0xf1bd4a8e, 0x33ffbc16, 0x3c7fa0a7, 0xb4eb77da, 0x98db17b4, 0x6905ef49,
-       0x241e97dd, 0x13ee76bb, 0x2c94dadb, 0xcf8d9bd4, 0x052c1da2, 0xce1db5b7,
-       0xeb9ef78a, 0x5f927bad, 0x542975a2, 0x3f44aec6, 0x850ae428, 0xda3d200f,
-       0x23d21f34, 0x7b5089f7, 0xc795d41e, 0x8066be6c, 0x6d0d4957, 0x2bf00f59,
-       0x9afa164f, 0xf5087de1, 0x527fb61f, 0xab3de109, 0xd9bc9a2b, 0x8b49bf78,
-       0xb7d68fb0, 0xdf31d4ce, 0xb30a9ed8, 0xb0ae5204, 0xf685de37, 0xd7e49afa,
-       0xe2d79cdb, 0x1f6be07a, 0x267af3ae, 0x8f39b5c0, 0xc55339e5, 0x437f587b,
-       0x1ea46ccd, 0x7f4af753, 0x5fbcf995, 0x80dff36f, 0x6a92fceb, 0x157fbfc6,
-       0x879b95e3, 0xefe17819, 0x5c7531bd, 0xc1e6944f, 0xf79834fa, 0xbeb9e786,
-       0x47fa147f, 0x13e61f7b, 0x1c6e3b24, 0x8c324f9f, 0x2710f78d, 0xf5a3cf8f,
-       0x8beb0435, 0x578fdf07, 0xb1963ce8, 0x671ce3bf, 0x6c1dfda3, 0xdce4f58f,
-       0x73ffda3c, 0x08be62ce, 0x6966ede6, 0xf150bf7c, 0x38fcc34f, 0xf8bf00f7,
-       0x8aa8de29, 0x926d0ffd, 0xa93fff79, 0x39b4bbf5, 0x7e64549e, 0xd7302cee,
-       0x1f37cc1d, 0xb66a9683, 0x592879f9, 0xb387efc4, 0xe457e891, 0x6c3682db,
-       0x510b0577, 0x908b1579, 0x458e3f5d, 0x86357ea9, 0x38f1f33e, 0x700e9794,
-       0x997e644d, 0x642b47c7, 0x68163bf4, 0xbf68cd81, 0xfe164c6f, 0x6fde48ca,
-       0x77c1454b, 0xbe297ba6, 0xc5e519b1, 0x559eafa8, 0x448df14e, 0x3c69a5f2,
-       0xdee2388e, 0xfbdef382, 0x8f8cf539, 0x3ce46379, 0xbb79e35d, 0xba31b70d,
-       0x0f61a28f, 0xf78ca3f7, 0x7ef324af, 0x2fc4121b, 0xc15fae41, 0x459f7c79,
-       0x74b9edcb, 0xd3dfc9cf, 0xda8fb03d, 0x17548218, 0x6dfb9b79, 0x513b7b16,
-       0x92cfd91e, 0x80f2fe79, 0x18fc235f, 0xce9035f2, 0xe0597fc2, 0xbe6ee832,
-       0xc7b8c1cf, 0x4dc84fa1, 0xc44aa55f, 0x09834068, 0x05b7e9ea, 0x4a801ee8,
-       0x35ca9f31, 0x1fe819a5, 0x177fd82c, 0xf570b9c1, 0x0e30352c, 0x23cdc9cf,
-       0x5d7818bc, 0xfe0ff160, 0xbcf131d8, 0x9ec332f1, 0xc303fc36, 0x09fab01f,
-       0x71bfbe89, 0x43a27eec, 0xed296679, 0x7b237edb, 0xc0eb0d96, 0x4fbc7e6d,
-       0x78af38ca, 0x9feecec4, 0x6439445d, 0xb3f9f033, 0x550f7e2e, 0x7543dc48,
-       0x0c3f9bd8, 0xff919bbf, 0xbe5815c5, 0xa86b0ce6, 0x7b3b5fb7, 0x1ff266f4,
-       0x7986b094, 0xee14a717, 0xc67519ff, 0xbf14c8ce, 0xc9bf7817, 0x8fdd06fd,
-       0xefee5370, 0x9d78bce8, 0x573a0dfb, 0x4ed3aa7e, 0xb9377279, 0xf7b169c2,
-       0xbb94dc67, 0xf87ced37, 0x2387fc31, 0x79c3de02, 0x6804e49f, 0xe19f915c,
-       0x4b9d20df, 0x35bdfc4e, 0x471ae33f, 0x61f23759, 0x5dd7e0b7, 0x8345205a,
-       0x21766db2, 0xacda4fc9, 0xbfde4e49, 0x94247f39, 0xc57c44cc, 0xff0647cc,
-       0x5905ef59, 0xe873f12a, 0x386ae089, 0xafad3363, 0xa884f783, 0x8af6beb4,
-       0x26774378, 0x907afa7b, 0xd1ac5997, 0xe26ffb4e, 0xc916957e, 0x313d476b,
-       0xdfb96fcb, 0x5551e447, 0x2df0f588, 0x6a051f91, 0xe63f55f1, 0x7d3f3175,
-       0x63ee2dd7, 0x8f602c61, 0xfd023f97, 0xaddaf49a, 0xdbf5cc33, 0xeb75cc2b,
-       0x1e46863d, 0x7a4d2bcc, 0x5d3dec76, 0x87e812d3, 0xa5db351b, 0xcd1a0fc5,
-       0xae2303f1, 0xc3f98757, 0xe3c2cfb4, 0x7c9dd37a, 0x8b88b2fc, 0x341a2ff6,
-       0xb8861d75, 0x3de19f51, 0xae35d3f6, 0x845e306f, 0x574d04f7, 0x436dfb8c,
-       0xef939f22, 0x6457a47b, 0x7dfdfb8a, 0x54af7499, 0x1ce99257, 0x386711ab,
-       0x494de05d, 0x3b7f0f3d, 0xad70d8d6, 0x54afa818, 0x07c89d1a, 0x5e79b32b,
-       0x871f20d5, 0xc754f14c, 0xfdee351a, 0x80fd0372, 0xe273c15e, 0xdb6fb12e,
-       0xd8f5f8ae, 0x5ec38478, 0xda7f23a1, 0x5edd65dd, 0xab55e5e0, 0xabc72cee,
-       0xbf305a0b, 0x4694ec17, 0x822bebed, 0xed3b4fe0, 0xaf78c3be, 0xf36dd3af,
-       0xacdc7ae2, 0xab3f68d9, 0xeb49d325, 0x56a90aef, 0xe8d2f5c7, 0x685519d7,
-       0x3cb5a73e, 0xe0897fd2, 0x669fc153, 0xbe631fb4, 0x6f3fea8f, 0x0dda8d3c,
-       0xe0eaffb9, 0x756714b5, 0xff946d79, 0x746816a4, 0x5fc19a8f, 0x6b9c7ed6,
-       0x24fdb894, 0xba427fc2, 0xd794a3db, 0xdfc5abd6, 0xbb497e5f, 0xb9eebcc4,
-       0xea777896, 0xf8230a6f, 0xe0f514bd, 0x8f902eb9, 0xab8c3497, 0xabfd3e8d,
-       0x47c92f52, 0xe1afcf06, 0x2da2db72, 0x5fbcf277, 0x89693df3, 0x4bc0d1f8,
-       0x47283c22, 0x4fdc51fe, 0xfab1601f, 0x563529c6, 0x68e1bed0, 0x138a6d85,
-       0x5cdc514f, 0x3e28b74f, 0x6bf95fe2, 0x075c4e15, 0x9ccad39a, 0xa6df9fb8,
-       0xd1725378, 0x33223c3e, 0xeab59b8c, 0xca31b966, 0x4f7ef1c7, 0x8898e380,
-       0x27df5a8b, 0x380bc825, 0xc7f5d627, 0xeddb5ff7, 0x009f0f3f, 0x491e68de,
-       0x7a8e8a79, 0x7873b641, 0xed7dc593, 0xc44dfa89, 0xe7ec4f1f, 0x8abbe0f7,
-       0xca8e749c, 0x38ab5e3a, 0xf00ad72f, 0x9adb9da0, 0xbee3e30d, 0xc9d157b8,
-       0xc49b1e8e, 0xa17c319c, 0xf7a24ea4, 0x3c34b5a7, 0x135ac7bb, 0xa7819df0,
-       0x1f552ed7, 0x97fc2c07, 0x978a5bfe, 0x5fdff0c7, 0x6bdff1e3, 0x1ce973c8,
-       0x2d7bd8fe, 0xbfbe5495, 0xc8d78567, 0xdb6677af, 0xc04bed4c, 0xa371e0b7,
-       0x032a1cef, 0x50311cd6, 0xf1870607, 0x71cf513a, 0x74e22e7f, 0x714fb60e,
-       0x55bca77f, 0xc39d3aa1, 0xebfcef83, 0xf74f6a34, 0xcea1d4d9, 0xf6aa3f07,
-       0xb0e98d4e, 0x4bd59f3e, 0x6f00ddd3, 0x7e01f749, 0x9d33a61e, 0xf88b5eff,
-       0x8def0ade, 0x1bf74e1e, 0x29953a3d, 0xc23ffcc7, 0xece83fdf, 0x1c62f24e,
-       0xfc5873b7, 0xcc7883df, 0x742fe46d, 0x28c8fd88, 0x4fa44bed, 0xff51ebe5,
-       0x8ff264ee, 0x99a7e286, 0xb16177df, 0xc1ee0637, 0x77642250, 0xc3bb0ad4,
-       0x2e64bf18, 0xf287aff3, 0xeed624d5, 0xca70fb04, 0x15dff8c0, 0x47802dfb,
-       0x9f96fb80, 0x4ffb455d, 0xc2af7f46, 0x33ed84b2, 0x92c5a232, 0x13fc097c,
-       0xcefba666, 0x42d19cea, 0xd97b1fdc, 0xf88e9816, 0xcd16386e, 0x1be77ac0,
-       0xbc1ec927, 0x72ee1e10, 0x7b9a7d73, 0x479f6195, 0xeb38d8d4, 0xe7a5edd2,
-       0x8b570f3d, 0xfd1890f1, 0x72b78836, 0x7e90ebc2, 0xe8af3fa1, 0xe92be31f,
-       0x3ae9f12d, 0x2c919f48, 0xf47cfc38, 0x89c161c9, 0x22a12e9c, 0xe7dc7f4e,
-       0x5d937983, 0xf59b741f, 0x8afeffc9, 0x130d37cc, 0xd29f80d1, 0xbef3c4a1,
-       0xde2cef78, 0xe3c4bb8f, 0x693fad35, 0x1d457b0a, 0x4987c316, 0xfa84e82c,
-       0x4be88e2d, 0x7518ff68, 0x0e2dfde3, 0xcfec69e0, 0x90c8e5c9, 0xf1b9dadf,
-       0xedc736e5, 0xc74df9e1, 0xf7dc1e22, 0x03e38e98, 0xbfc33bbe, 0x3ac77ba7,
-       0x3f8664bb, 0x6e62309d, 0x83680e40, 0x0fda1a74, 0xfc86abd7, 0x95793983,
-       0xed3fc85b, 0xfee32ee3, 0x8c67a1b5, 0x6b725eef, 0x8b8fa697, 0x7af39c86,
-       0xe408e509, 0xcb2e10ea, 0xbdf8cb39, 0x5ee2b577, 0x0f711e9b, 0xdfc207e2,
-       0xaff73a60, 0x3eb07b8d, 0xf7c81c28, 0xd6af3f23, 0xde0effe5, 0xca8ec343,
-       0x27fa6f94, 0xfdc29fdd, 0xd4bfb343, 0x31b9ee23, 0x66b6a5fc, 0x36736f71,
-       0x4936e7e7, 0xf6167fba, 0xf74a363b, 0xf0646718, 0xa738d3f5, 0xf4a332c7,
-       0x1f065a7b, 0x7fb3e225, 0x7a80f211, 0x8f97182f, 0xe32fe255, 0xeeb007f9,
-       0xb5ec6305, 0xd0151ff9, 0x98079bb9, 0x0f97e28f, 0x60b327b4, 0x5f3b5e0c,
-       0x732f9f88, 0x29db8c42, 0x456679ee, 0x7c835e7c, 0xb9d1e7ce, 0x0fdc3e3c,
-       0xe8fe70a7, 0x7779f714, 0xc464fe2a, 0xe175a253, 0xf65e80c4, 0x2b1f2327,
-       0x99bc1c5f, 0xc79af5c6, 0xfbf457bd, 0xe2cabfb3, 0x8f0004f7, 0x7b607f42,
-       0x1762c7a7, 0xf0feb25d, 0x419bd69b, 0xbd234fbc, 0x43fae972, 0x48fe80bf,
-       0xf2c2fa23, 0xe2bb41ee, 0x57bf30c5, 0xb6c3c5ed, 0xd0e3eb19, 0xe5c840ad,
-       0xdd0ae995, 0x84557643, 0xda89fbaf, 0xf7130c65, 0x5a3c0b0a, 0x8fcb4be1,
-       0x08b71fcf, 0xf196d43a, 0x9ef1917b, 0x942f9c76, 0xafe83e39, 0xd20b4ca7,
-       0xbc8bbff3, 0xdad17187, 0xfe2f0e1d, 0x0ecf524e, 0x85ea1557, 0xaa8e1d9e,
-       0xfa50daf5, 0x9bf42df9, 0xff8cec2c, 0x64bffae9, 0x2fe27fae, 0x4ba01f71,
-       0xad1c7ba6, 0x76e93dfd, 0xfa0377d3, 0xe5dd813b, 0x2d33fa10, 0x9ec5d399,
-       0xab4dd7c7, 0xf023dd5c, 0x67c08f76, 0x1e57b89a, 0xae2721d6, 0x39bb4643,
-       0x0094fde2, 0xef3f7b8b, 0xfa570863, 0xecf03ae0, 0xfbf632b2, 0x7d3bf8e1,
-       0x742b8a41, 0x839236fe, 0xf294f6fd, 0xfbf58138, 0x8c67c162, 0xc9e8ed99,
-       0xfd12bcd3, 0xd258611e, 0x807edf71, 0x4f7e61de, 0xb2770af0, 0xc5a2cfb0,
-       0xf73f92f7, 0x48a3f524, 0x0f1c50af, 0x0dbf366c, 0x0a7e88f3, 0x9e4c5b76,
-       0xbd16bde6, 0xbe678563, 0x13b7cf9b, 0xa3f637f5, 0xdde38b45, 0x5bac60ff,
-       0x86d3bcc6, 0x49e0e59b, 0x26c71f0f, 0x25974bc6, 0x6eba0f1a, 0xebe30c77,
-       0xe60bcf31, 0x479e127a, 0xc80b39e8, 0xfaee00e3, 0xfc6fc5fb, 0x59ce7888,
-       0x13d2b03d, 0x5da00763, 0xb095eb4e, 0xc6553bc3, 0x5d844bf7, 0x8274fa88,
-       0x90770b16, 0x6d974906, 0xf12b5f5c, 0x43cc35f5, 0x9b897efc, 0x2fb419fa,
-       0x4fb11db8, 0x389d6bcc, 0x8daafa3f, 0x21bd92b5, 0xe9c864f0, 0x6e9c8b4e,
-       0xec357cf5, 0x77e275b4, 0xf17e912d, 0x614ae1f4, 0xf31c95af, 0x95bcc78f,
-       0x1f342acb, 0xdd25a1fa, 0x9e600fb3, 0xfc1ee14e, 0x39419a61, 0x8cfc142e,
-       0xc18dcdfd, 0x6e3cefdf, 0xe6f7dd93, 0x857f0457, 0x7cc0d8c7, 0xebd18def,
-       0x7ae1eeff, 0x2dfc1d2b, 0x5fd38394, 0x785ebd11, 0x9e00e2ac, 0xba05aac3,
-       0xf830caa3, 0x6f3c33a3, 0xe1ed0bb9, 0xf687cc63, 0x9e786f74, 0x47f01c6d,
-       0x3f6e1aef, 0xd5f9e80e, 0x97a05f1c, 0x2f97a8c3, 0x2e4fe63b, 0xc296ba82,
-       0x7365eef5, 0x2967bf19, 0x5fa10eec, 0xf489e86d, 0xe2a7fadb, 0x727d6f3e,
-       0xe62bb363, 0x2efb40f9, 0xa83b9f68, 0xdf516a6f, 0xf3db1378, 0x79925323,
-       0xc71e7b3e, 0xe664f4cb, 0xaf3c0174, 0xdc6506e6, 0xb2f57cc7, 0xaf7809dc,
-       0x40a4a1fa, 0x7ef812d1, 0x0e3e0cf2, 0x2e8472eb, 0x47878dcb, 0x4433afae,
-       0xe44328dc, 0xf124676f, 0xe70a4572, 0x979d24f7, 0x1f9ce9f7, 0xe3f13c32,
-       0xbb44cb4c, 0x3bd71b3e, 0xb7c6978f, 0x914bae4b, 0x8b3ced2e, 0xdfc6b24f,
-       0x17494baf, 0x06db6af7, 0x3fc1b5f5, 0xc677c427, 0xfc6265f8, 0x89986745,
-       0x8d29167f, 0xce8b37c4, 0x8637c428, 0x3fe2245c, 0x1aeeff63, 0x14c6e047,
-       0x9fa3f79c, 0x209c6315, 0xdf0f6577, 0xdfdfc237, 0x7cb136b9, 0x4181eb18,
-       0x9df3d06f, 0x3d00cf18, 0xad0a693f, 0xfc8bcf43, 0x31a72e53, 0xf08ffa76,
-       0xbb3b1df7, 0x8e6bccaf, 0x7ac0eba1, 0x8cfee3e9, 0x85195d75, 0x89e9c049,
-       0x7298d5e7, 0xcaedfaa9, 0xf1787604, 0x5e1da97f, 0xe4813dd2, 0x578101f6,
-       0xc466be23, 0x7897f0b1, 0x8ab3bdb9, 0x1a7931f0, 0xffc06f97, 0x22ff8156,
-       0x1a7fff8e, 0x643dffc0, 0x79707427, 0x4bd688c9, 0xf45f24f9, 0x453bf19d,
-       0xa0df27b9, 0x293dce7c, 0xa9df7fdc, 0xbe409ffb, 0xbbf2255c, 0xa888cf27,
-       0x407b58de, 0x2ad17efc, 0x1af9c0fb, 0x591bc7ca, 0x0ecdfbcb, 0x189497ef,
-       0x8596d1f9, 0xf9802cc7, 0xf9f15767, 0x9bb14dac, 0x5875a7d6, 0x485f2e87,
-       0xbb2dfae1, 0x6015222a, 0x4a376b7f, 0x1237f40a, 0xf809877f, 0x0b236466,
-       0xd0fefec5, 0x4f1f1f48, 0x07a485f3, 0xd3e7068a, 0xa4559b6e, 0xcf695e83,
-       0xa0b5f648, 0x3606a4c8, 0xbed79f23, 0xf2fca11b, 0x2b76efc9, 0x9e5fc7e8,
-       0xcf82dfea, 0x6578f98d, 0xbefd247d, 0xce1cbbf9, 0x32f7610e, 0x71e1cd16,
-       0xfe0427ff, 0x887b0bd7, 0x23dfa61d, 0x94fdb8d2, 0xe9ac7cb1, 0xff0ce777,
-       0xfa73fd07, 0xb599693d, 0x70a78a33, 0xbcb196fd, 0x834bec90, 0x57e7a61f,
-       0xd3e7c46c, 0x01315c47, 0x5fc897ef, 0x77f05115, 0xd6ba7fa5, 0x94fef716,
-       0xc01f4243, 0xcec7f63c, 0x6b7242e3, 0x9d27b3b4, 0x67936f9f, 0x0ddbb7c4,
-       0x3e7d2c3e, 0x0fba6eed, 0xb86555b1, 0xffe064ef, 0x378ad4f2, 0xe1919e11,
-       0x46e11275, 0x49c4678c, 0xcfca39f0, 0x9cf9aa07, 0x5cf9425e, 0x82cc63b6,
-       0x556cf958, 0x2ceb3e89, 0xe86e13bf, 0xae14de8b, 0xad48efc7, 0x71f203f8,
-       0x1453d77d, 0x91bc59b7, 0x424c1eff, 0xfe245cfc, 0x78cdde60, 0xf80d5dcf,
-       0xa3ef7817, 0xeec89614, 0xf7c39dad, 0x72b76adf, 0x2aad657e, 0x1b5703dd,
-       0x7f411ede, 0x7ea3d462, 0xd5a76e1f, 0x2d2edd6c, 0xa8ebc18c, 0x27e510da,
-       0xe436ee5c, 0x2b19eb89, 0xd8dc63df, 0xc876fc05, 0x9eeaedc5, 0xff07ee52,
-       0x7ac9083f, 0x0080006b, 0x00000000, 0x00088b1f, 0x00000000, 0x7dd5ff00,
-       0xd5947c79, 0x6779f0b9, 0xcc93324f, 0x2133df64, 0x61262201, 0x01161212,
-       0xa0084933, 0x24584e08, 0x81ec36c8, 0x8bf628ac, 0x0c197e95, 0x6f62e452,
-       0xb90556ac, 0xda544076, 0x1a080962, 0x88b0e834, 0x148d6ad0, 0x43b05b05,
-       0x921088a5, 0x6f16b629, 0x79e7bd69, 0x799939ce, 0xf8b0ccdf, 0xabbf7ed1,
-       0x9cce1c7f, 0xf3cf6cf7, 0x273f679c, 0x2d675a5d, 0x2ba42229, 0xcae6c229,
-       0x9dbde424, 0x91488ee3, 0xe9769884, 0x55ae503d, 0xd034496d, 0x7483b5f6,
-       0x4eda16b6, 0x62909b88, 0x8e35a242, 0x12cfd0dd, 0x92adb26b, 0x49eab108,
-       0xc848d9a1, 0xeec4f1b0, 0xf0b7e5a6, 0xafad095f, 0x425cf5a4, 0xc1d334ee,
-       0x293fa0e2, 0xc9089874, 0x9c709b36, 0xc3211578, 0xac39090b, 0x34432e25,
-       0x8be0bb21, 0x89ac8411, 0xe399c472, 0xb10f1e60, 0xf196fed1, 0x4258f7f4,
-       0x5b891a6a, 0x6cd5f3a2, 0xf423adda, 0x76847277, 0x6524224a, 0xd6f384bb,
-       0x2d2cdf6c, 0x5e67bfa0, 0x075fb5d8, 0xa19357df, 0x7ab3f461, 0xd03b8d89,
-       0x7180cf62, 0xf61c7b49, 0x9654eb13, 0xbd70b884, 0xe9b7c6c3, 0x0e38b9ac,
-       0xbff4a3ee, 0x079f4ab6, 0x5666cfec, 0x9b3577e3, 0xa64feeb6, 0x626a91f3,
-       0xefc56fee, 0xe6c5dff6, 0xff89e8d7, 0x675864fb, 0xa2e75b2e, 0xc4baff5c,
-       0x2aaad7fe, 0xdfb4cd73, 0x5b08f8da, 0xb38b6d0b, 0x7ac18738, 0x0f3aa78d,
-       0x61918851, 0xa73a3ca7, 0x77febfd1, 0xd1848475, 0x58c3877e, 0x15b352ff,
-       0x47563ae1, 0xcebbf85c, 0xe3a56395, 0x8e17ee1d, 0x49b9bde3, 0xa4e01e35,
-       0x2773270d, 0x3793f9d3, 0xb454956d, 0xe6411b1e, 0x23d6023a, 0x5cc7bbd6,
-       0x062e6156, 0x1c227438, 0x706936ea, 0x473a15fd, 0xff5cf2f6, 0x2acc5377,
-       0xf4c0f79c, 0xfa5e74cf, 0x7c6fd3fb, 0x6ba9f884, 0xb06dec95, 0x748fd6de,
-       0xac00f2d3, 0x7893533f, 0xf6102642, 0x3e7b33df, 0xefe959d2, 0xfc337613,
-       0xa9deedd5, 0xaecb4059, 0x1a4ba352, 0x303c780c, 0xaeace807, 0x24c24f4d,
-       0x06739fc0, 0xa74943c0, 0x78841e02, 0x42be81d3, 0xe80233e1, 0x3aaa08a8,
-       0x67a47f77, 0xfa64e667, 0xdd346b7d, 0x8ee811bf, 0xd91883ed, 0xbec10fef,
-       0xc7e902e2, 0xafe60cb9, 0x801db708, 0x28515173, 0xac085ad9, 0x23ee18f3,
-       0x31c19cb6, 0x79953d70, 0x0ab3d6c1, 0x618b89e7, 0x378d12f3, 0xe713e61d,
-       0xd64d4e2b, 0xff7f4292, 0xfa578e26, 0x4efd87bb, 0xfcf239fa, 0x6de256eb,
-       0x75c259ab, 0x55a7a107, 0x53dacf80, 0xa7a30f1e, 0x93d00d4e, 0x8fa0bf58,
-       0xc6693657, 0x56e39e07, 0x6bc70eb3, 0x1d706b35, 0xa27e00cf, 0xe765a968,
-       0x065599f2, 0x198ff237, 0xf9488f63, 0xebf72f14, 0xabbe503c, 0xed0b5f9a,
-       0xf9b326ef, 0x0f54aad7, 0xa3ed7d40, 0xf882d246, 0xf0093fb4, 0x123d303c,
-       0xa55b52f1, 0x38e9eb73, 0xb126bf4f, 0x26e8cbba, 0xceb59ff4, 0x1fa10ba9,
-       0xbdb30d89, 0x1e737804, 0xf5334dd2, 0x3d2b27a5, 0xfbfa56f6, 0xce763684,
-       0xdb6a1e04, 0xdd015d18, 0x5c39bc23, 0xcb74f0fd, 0xc7c08dce, 0xa333289a,
-       0x00274a07, 0x616d9aef, 0x3606b3e6, 0xe804b7d7, 0x37ab22d2, 0xcf9927b4,
-       0x35ebf8e6, 0x83a00ff0, 0x8648c4ed, 0x75f075d2, 0xee72a1be, 0x19d43c02,
-       0x14b587bc, 0xfa4f43b5, 0xa2875cf0, 0x5fa69adb, 0x843b380d, 0x47896590,
-       0x55e714b0, 0x47ed8fdb, 0xc70eff7c, 0xd250cbfb, 0xba730ff1, 0xc36a29a9,
-       0xb67358f3, 0x71b1cf11, 0xc667e33c, 0x4d7e7253, 0xbf7c13c8, 0x8a9c71eb,
-       0x6ab1b688, 0x9f8af70a, 0x1216e64a, 0x912e5f9a, 0x8e8da388, 0x83a6c5f7,
-       0xbe00f391, 0xe355bf57, 0x7ed8c37e, 0xd0fe704f, 0x1c028db5, 0x4751bde9,
-       0x46f7ec82, 0xe39e23c7, 0x86bde012, 0x7b6bbec3, 0x513f88f9, 0x8b6d717a,
-       0xbdff01b2, 0xc3ca7db8, 0xeeeba27f, 0x53625ada, 0x38b4d903, 0x717c7e90,
-       0x942db661, 0x64d5627e, 0xbef144bc, 0xe460edaa, 0xcbefda48, 0xd42e0c5f,
-       0x7cdd7ed3, 0x535e179d, 0x1e5c0137, 0x9dc7657d, 0x96e35ed0, 0x778f8062,
-       0x3fe9fb6d, 0x6f57cf81, 0x9308006d, 0xa3bc5f96, 0x54efd2f3, 0xf7eccdee,
-       0xf866516d, 0x9f17cbee, 0xdde013bc, 0xed82d6d2, 0x8cdc5e17, 0xecaf03f5,
-       0xe9bffb78, 0x488eb577, 0xe1777c1b, 0x9788fdb5, 0x0ec6a75a, 0xd7450dfb,
-       0xcfdceccf, 0x849b64f8, 0x31548de7, 0x5ae825fe, 0xaf97efd0, 0x28111dcc,
-       0x8ed56a1f, 0x4fbe0954, 0x925edbd0, 0x9ca05e50, 0x688c3778, 0xdffee8c2,
-       0x9681a5a3, 0xfbe5ea15, 0x2ce780b5, 0xd908cfc6, 0xa7b5e42c, 0x6f7efe84,
-       0x75e6c449, 0x3eaeee70, 0x26e78d98, 0x1d1dd182, 0x31c7c0c7, 0x434438c0,
-       0x0fbeb0ec, 0xb2db6fd3, 0xa547ce8e, 0x924efb34, 0x47779c70, 0xce05bedf,
-       0x8c2f58bd, 0xda0f3937, 0x9e41532b, 0xf2d7df88, 0x670dae75, 0xe722edf2,
-       0xc6653537, 0x7c5e50b5, 0xf00aac35, 0x0ef3af53, 0x72fc00b0, 0x5b471d19,
-       0x6daebf18, 0x37adae5b, 0xe71c7f62, 0xa0a7ca13, 0xe9e7a3cc, 0xf49f3d1c,
-       0x0edfadab, 0xc97ef981, 0x193864f8, 0x3e98fb0e, 0xf0048ceb, 0xd46dc88b,
-       0x7f5c20d6, 0x9629dac1, 0xae87db02, 0x4947e760, 0x2316b9b7, 0xb73b1b87,
-       0x532bbbc9, 0xf4b7c8ad, 0xfa01feb6, 0xb3b57253, 0xbf7f44c5, 0xa6d3857b,
-       0xe6f774a6, 0x536363f9, 0x1c95fd68, 0xabd20869, 0xd8f2625a, 0xea79c465,
-       0xe7c8ca9a, 0x2d23bd74, 0x9bc75cec, 0x428ee689, 0x342a9e3f, 0xf8446344,
-       0xd5af90fb, 0x7af2e5ad, 0x31275b2b, 0x98a7d2f8, 0x8ef19fb0, 0x683aff68,
-       0xeb11a33f, 0xf2fbf4be, 0xaaba3e40, 0x755a3e50, 0x820bdeb8, 0xfe57117f,
-       0x7f3f3cec, 0x139b7aa0, 0x475e35e8, 0x8fe3234b, 0xfbfc7495, 0x9695a52c,
-       0x1f197f38, 0x7095dace, 0x74ed0f5a, 0x762dd79c, 0x8b6c8efc, 0x50afc991,
-       0xe39eb07c, 0xbbc919ff, 0xb5cce818, 0x740ccc37, 0x77a77f5d, 0x5c1f2040,
-       0xb07c616b, 0xf74dd39b, 0xef2f465e, 0xd82e54aa, 0x6e5bbbdf, 0xa8740cdf,
-       0xff03c794, 0x8695762b, 0x2edc9b8e, 0xc92f0199, 0xf0cb269b, 0x55baf547,
-       0xe5d657a0, 0x5f814348, 0x7fcbed48, 0xd7ad1b75, 0xbd41bc53, 0x9f3f377e,
-       0xef854f54, 0x172bdbeb, 0xb1297cc2, 0x12d4d977, 0x536347ea, 0x96bebd68,
-       0x7ff9c314, 0x37becd26, 0x9121f705, 0x4f20ac97, 0xf20d5ea9, 0xf50f2e34,
-       0x56e77af1, 0x8e49bfd4, 0x85bdcb8e, 0x27d7afa8, 0xf9c1b4ce, 0xf627c3ea,
-       0xaf7d42ae, 0x0b6e1ade, 0x684fdfa3, 0xfa601e97, 0xf5b0918e, 0x4fa87648,
-       0xc3748f70, 0xf8092e7a, 0x39db5288, 0xdeefe607, 0xda2e27a3, 0x71dedefe,
-       0xbd05cf28, 0xa3d75e98, 0x98d68f5c, 0x2fcbd025, 0xe7c9db36, 0x65982554,
-       0x05bc22b1, 0x67b66b3c, 0x5c9ce0aa, 0x9ff0ede2, 0x43cb9e35, 0x42dd69fa,
-       0x2d67d20f, 0xf563dbd7, 0x030782f6, 0x28f427f0, 0x82fc1d25, 0xa6f27fd3,
-       0x621c1243, 0xaeee7e25, 0xba069e26, 0xa937bbbe, 0xa8f9253c, 0x7c8fdd5f,
-       0x6c8e957f, 0xb78efa91, 0x8a8bf383, 0xf0014718, 0x46e98ac9, 0xaa7f205b,
-       0xc2abb708, 0x423cf402, 0xfa2a451c, 0x1378f9dd, 0xd875ffc2, 0xacbd1077,
-       0x63967fb7, 0x22bbc02b, 0xa7ed0c21, 0xf95d5a7b, 0x5d6d1fa4, 0xe7055e15,
-       0x2363f292, 0xed334df2, 0xdf8bbf4f, 0xe445f232, 0xd705a4b3, 0x6662d9b5,
-       0x8a38c4e3, 0x64b5811a, 0x39305639, 0xdb05b266, 0x3f7c7dcf, 0x29cfa607,
-       0x4c9d0150, 0xf4f4da35, 0x92dfa7bb, 0xb8dd23e6, 0xf384c0a8, 0xec715ce2,
-       0xd8af662e, 0x5388ee80, 0x7d56fa83, 0x9c1dc3a3, 0xd71d18ae, 0xf40bfd53,
-       0x88574a70, 0x2676fab7, 0xddb8227f, 0x50227c07, 0x4ae715df, 0xd7e05b9c,
-       0xde823740, 0xd1bdb9c4, 0xcfcdd9f3, 0x7fdd3747, 0xde9a7d20, 0x6eb97464,
-       0xda14b595, 0x731055d7, 0xb4aabda0, 0xf870ac83, 0x62fadd68, 0x11c61b84,
-       0xe2ce2e7c, 0xa8fc0b38, 0x35d1cb7e, 0x2f9cb648, 0xf8f9bfd5, 0x67e96b80,
-       0xcf1b0d06, 0x07708ee0, 0x82818fd2, 0xa58854db, 0x4473f80b, 0x12df5c93,
-       0xdcb93fe5, 0x65facef8, 0x7c01a4ae, 0xa8f2fd09, 0x0b4ff9ca, 0x45292fd7,
-       0xa626f490, 0xaf03c65f, 0x25b07e07, 0x24fc0dc2, 0x77389e3e, 0x97cf5905,
-       0xbc099cfc, 0x3e233b0a, 0x1c9f7d92, 0x5324f4cd, 0x8b2efb34, 0x0bf60197,
-       0xcaab079e, 0x43a88679, 0x8fd101cb, 0xc5db0bae, 0x1fed7a7a, 0xfc6f5b03,
-       0xacb603a3, 0xffa7c00b, 0x0856dd5c, 0xef5ace78, 0xfa37ccd1, 0x48f211e7,
-       0x7eb03f49, 0x9fb05b90, 0xdfd0dcca, 0x76e7eeb5, 0xcb9e829c, 0x633af9f8,
-       0xf2ddf821, 0x68eae718, 0x45159f5a, 0xff1431ec, 0x23d1deb3, 0xdf1c913d,
-       0x6b43b000, 0x8fa5c434, 0xdd6abc06, 0xfe3c00de, 0xfb40f00d, 0x2e0c98f5,
-       0x2d073d35, 0x68e2ce31, 0x8cab9e3a, 0xc7a03cd8, 0x0bf29f7e, 0x53c49738,
-       0x81a4fc0c, 0x8e012378, 0x239c982f, 0x757abbe0, 0xa9d43a67, 0xf30f931d,
-       0xecc11b3c, 0xb551df27, 0xc785207b, 0x47f78365, 0x2e7ae923, 0xb9b2c8af,
-       0xdfa738e8, 0xdf9efdfc, 0xed2fafd3, 0x19cd22f9, 0x0deb57c0, 0xc626832a,
-       0x4896ef5f, 0xbe105b55, 0xc99a233b, 0x09dbccd3, 0x68b804e9, 0xaeb7a87c,
-       0x8027b308, 0xbec567df, 0xe96b84d2, 0xca570df3, 0x9e603b88, 0xfa1fda06,
-       0x4b195c35, 0x8c8243dc, 0xf903c74b, 0x992570d0, 0x3cd862b8, 0x315437c0,
-       0xfbf8ce4c, 0xed1713a7, 0xaa455a7f, 0xe7fbad83, 0xbb5f0cd1, 0xac1f1909,
-       0xd7df077d, 0xfcec7eee, 0x6e4836fa, 0xaf160fb0, 0x14d47930, 0xcfe98ba4,
-       0x362d2fa0, 0x48aa3cbb, 0x8f943fe0, 0x4e34460d, 0x647b5035, 0xf467971e,
-       0xa028cd3b, 0xcf199757, 0xc39f93a1, 0x7defed79, 0xc589fe03, 0x4518621a,
-       0xb06f99c7, 0xbfa14e1d, 0x2638c9ff, 0xc2c4c412, 0x83c4a687, 0xd5984b1c,
-       0xbd2273a8, 0x7e83318d, 0xea51912a, 0xa5ae236f, 0x8f50690f, 0x74a27a45,
-       0xac718ba0, 0x3a00ba04, 0xf5983a04, 0xe26be320, 0x5e7e5cfb, 0x59f87495,
-       0x8ecf7c08, 0xf181cb29, 0x358e512c, 0x5e0fdf48, 0x6ebff192, 0xf3f2fbc9,
-       0x4dcba740, 0xdf4897b6, 0x70e13ffe, 0xd4e829ef, 0x2e5a2c91, 0xea3a47ff,
-       0x9def1da3, 0x675d3e04, 0xa0d47a30, 0x76d6ec57, 0x283ec579, 0xd945060e,
-       0xf073c29f, 0x739651c3, 0x02482694, 0xe3d71dfd, 0x03bf00dc, 0x0363db9d,
-       0x151adce9, 0xeba2740d, 0x10c38bc5, 0x490bc7ef, 0xd1f1c935, 0x31f11471,
-       0x01d760df, 0x1dd817dc, 0x5159beb8, 0x0cb3629e, 0x6feab9fe, 0xf871bf6f,
-       0xf9e7e7af, 0x61d28eb4, 0x83b07390, 0xc31543c3, 0x64e9c6f8, 0xd3a7af46,
-       0x282ef549, 0xf692d107, 0xd78fdd3b, 0x007d790b, 0xd59e2eff, 0x797e700f,
-       0xa77d9f3a, 0x3e33e79c, 0x7b18eccf, 0xf68bc007, 0x4f00e8f3, 0x41b9876f,
-       0xeafca64f, 0x8f13a700, 0x155f9025, 0x1f0006f9, 0xf8a629ec, 0x5759fba2,
-       0x013f4bea, 0xde9f64fc, 0x7d7ac5bc, 0xd7c27dbc, 0x97e59df5, 0xa1afca8d,
-       0x49f5f932, 0x885f9334, 0x1d12ba27, 0x11b2abd3, 0xea17483f, 0x5bcfc71b,
-       0xf4ee0c61, 0x51a3789c, 0x1cf2794e, 0xaffd7c01, 0x8f826e1c, 0xe3970e9c,
-       0xf7f7c5d1, 0xeb473f25, 0xde4ccda3, 0x30e97cd9, 0xe0e8e9ce, 0xc7ed5f78,
-       0x239e3747, 0x0c4e6fbd, 0xa8fbb7a5, 0x442ba0be, 0xf587ac7c, 0x734bb1f4,
-       0x73857f3d, 0x8980f0dc, 0x22bbdc80, 0xa1f22be6, 0x97ca937f, 0x4e8f0674,
-       0x87afd41d, 0x27d1f01f, 0xd4951a51, 0xd5a02274, 0x71c5621c, 0x9e3328c8,
-       0x3e5eb0b3, 0xf38989a2, 0xef3947c3, 0xc8af8e29, 0x0e734918, 0x36236af0,
-       0xa3e737e8, 0x29b34caf, 0x1b325c9d, 0xcf2a2a5c, 0xd19caaae, 0x79efe031,
-       0xbbea28f8, 0x019e74a7, 0xed20c6ad, 0xcf0bcf3a, 0xb9f6fe4a, 0x74bb533f,
-       0xeeef1cf4, 0x74c9faec, 0xa7677fba, 0xd8e706da, 0x1faff2b9, 0xa5bd030c,
-       0x4feb6b53, 0xd7aeae50, 0x991a3ec0, 0x254a767e, 0xefc5ff87, 0xc187edc9,
-       0x540f0c31, 0x133a409f, 0x5854e0fc, 0xeba13e64, 0xfd3c4259, 0x51e7ee81,
-       0xef4a17c3, 0x10f725f2, 0x181627ca, 0x7dfd22a7, 0xe85dc0f1, 0x9c485e6f,
-       0xb9e62fc8, 0xe40c7fb4, 0xcad60ba3, 0xe55a8beb, 0xc9cf25f5, 0xdffebdeb,
-       0x4effb972, 0x98635394, 0x0ba8ba5c, 0x863e3ede, 0x9777e3d1, 0xee5083c7,
-       0xf9c795f6, 0xe395a728, 0xaee5c3de, 0x1e42cb90, 0x84315c37, 0xe388c718,
-       0x7c1c5c5c, 0xf5f1f7fd, 0xa3315c37, 0x3fdbef7c, 0xd53ae516, 0x813bf0c4,
-       0x892b86cf, 0x0ba8bbf8, 0x2fdfd07d, 0x8ca3c715, 0xc22e7cdf, 0xdf85fe7f,
-       0x19efd057, 0xd0921889, 0xfb927b5e, 0xe0f9cc6b, 0xf2033a87, 0x39d9e29d,
-       0xa5edbc8e, 0x48f79c4b, 0x3f4d00d2, 0xf72b7d3f, 0x82e0e941, 0xd59f8037,
-       0x716298c6, 0x3064c1de, 0x73e82bcc, 0x5115c3ce, 0xb0ffdf20, 0x50213cb2,
-       0x6bf5eaff, 0x447d98e8, 0xaf265188, 0xcd9e4288, 0x2bf2a76b, 0x0188f51f,
-       0xef9f9740, 0xb9f4819b, 0x81e2d890, 0xe9f67b6e, 0xf7ffd1d3, 0x5898e51d,
-       0x3cd714cf, 0xa92fd32d, 0x65e7a090, 0x4a7f9f32, 0x5467d307, 0xf516bb06,
-       0x9ab13b15, 0x64a4d1e3, 0x130a96f2, 0x168fad0d, 0x5a1e2075, 0x2337c51f,
-       0xfeba7f41, 0xf324bcd1, 0x9e70899d, 0x1aaf30f4, 0x113b90d8, 0x361196ca,
-       0x9225942b, 0xc1d6c343, 0x34963cf0, 0x2af7c2a6, 0xf4cd5783, 0x7882ba25,
-       0x63e62fe8, 0xafaf1375, 0xce797a9e, 0x68ddf822, 0xe3af73c2, 0xf05578eb,
-       0xc031032f, 0xcf46f5be, 0xe24f1897, 0x8accaba5, 0x1faba876, 0x9c3fbb41,
-       0xd79811b4, 0x82e4bc68, 0x59899acd, 0xf9987a82, 0x0211e7b2, 0x52e8cd7c,
-       0xb6be460d, 0xf49af913, 0x7be062fe, 0x03e68f94, 0xaed90d1f, 0x2efea0f1,
-       0x5f3452f8, 0x4be70b5f, 0x21c18449, 0xbe71d886, 0x23169b1f, 0xae338a5f,
-       0x86ffa090, 0x97c8f1c8, 0xb4f001e2, 0x46bc663d, 0x1ce267c6, 0x95427af2,
-       0x94e49ebc, 0x14e40dd7, 0xe3c903ca, 0x0636fc48, 0xf01c91ed, 0xd8cb683b,
-       0xce1e99f9, 0xeb0dd5d6, 0x1139fba3, 0x937ffaa3, 0xbb7245fb, 0x475a3eb5,
-       0x4f150fd0, 0xa8c1e62d, 0x61889c07, 0x2e67c07a, 0x90fb5768, 0xfee09eff,
-       0x1de3a983, 0xdf8a1a15, 0x07c972fb, 0x8f9e5a76, 0xef869e73, 0xac691c67,
-       0xaaf5a5ab, 0x879e49f7, 0xe6250596, 0x9f14ed9a, 0x6c9b666b, 0x1afad28f,
-       0x576d2313, 0x22f51e9c, 0xb698f202, 0xa225566f, 0xfc01a3ff, 0x6bff74ad,
-       0x3a006f40, 0x5ed04fe8, 0x1ac87aa6, 0x79b7ed03, 0xcebcd99d, 0xdf2a7e0a,
-       0xfa07f058, 0x16f31116, 0x5c3ce412, 0xe28ce7a5, 0x53a845f5, 0xbe9c4a3c,
-       0xe15befc4, 0x2f562cf7, 0x1e760a19, 0x83ab2ffb, 0xcff02832, 0xfddce8e4,
-       0xa51d3d61, 0xcf5a38da, 0x7f43631a, 0x617ce131, 0x9f879898, 0x73fe91bb,
-       0xbc05ed80, 0x64f1dd9e, 0x978c3c45, 0xca7e504b, 0xd62c0dce, 0xca187f4c,
-       0x73c0edcc, 0xfff1077b, 0xfb95e307, 0x8dbc47c7, 0xceef6de1, 0x61d8f166,
-       0x387ecf1a, 0x597923d7, 0x8774cbc0, 0xa511fe54, 0xed8342d7, 0x802b1ee0,
-       0x7d86a1d4, 0xde3f350f, 0x708ff302, 0x7c03147c, 0xf281946c, 0x0cb65a03,
-       0x59ccd9b7, 0xf8156fb8, 0x42b5ba97, 0x40a3d91e, 0x92ad4dae, 0x7d00ff5c,
-       0xe11a8c60, 0xe53197f3, 0x7794d751, 0x3ab22a4d, 0xd6acce50, 0xf3f7fcc9,
-       0x65ff9963, 0xecd8ec5c, 0x2c079458, 0x962837de, 0xdba009f2, 0x7c03921c,
-       0xe71ce022, 0xa55d77c3, 0xce750ebf, 0x9cfcede5, 0xd10fb34f, 0xcfcb3ea2,
-       0x8eabe0bb, 0x669e7670, 0x74069210, 0x22349532, 0xba563dff, 0x7dfbcf14,
-       0x7805a5c4, 0xe0c65a7d, 0x653dd62c, 0x98af5cbc, 0xa7d790e6, 0x0ef52957,
-       0x7fbc7b3a, 0x794e19de, 0x3fa164fb, 0x8feb978e, 0x55cffeb3, 0x84b5ca0b,
-       0xcdbeeb97, 0x54f83f00, 0x03f81c6d, 0xfa33243b, 0x8c243bc1, 0x195434fb,
-       0x6c6fe0dc, 0x5bf16768, 0xefd05ab2, 0x7e80c7bc, 0x31da5653, 0xbedf571e,
-       0x80145a53, 0xb75a94af, 0x207cfc04, 0xc8275185, 0x9c77ae2f, 0x83f7bad0,
-       0x52c4fcbf, 0x9e74e24a, 0xe1df3c83, 0x143be410, 0x34cee9fa, 0x28fff987,
-       0x3c7fa315, 0x03611cd5, 0xaaad79bd, 0x6b85fd10, 0xbf324d23, 0xf655baee,
-       0xf84ef80a, 0xcafe4509, 0x6c693d74, 0x43a7fe63, 0xcc8d8cc8, 0x76e6e43f,
-       0xd32c7672, 0x6afb68cb, 0xce294ff4, 0x410c5c6d, 0x333711b9, 0x5580fd07,
-       0xe045051d, 0x07f2a587, 0xb1d9d3fd, 0xe55fec56, 0xd5ff402c, 0x1819c6dd,
-       0xd8e86817, 0xf46859ac, 0x82c3cfd3, 0x044822ee, 0x5faf5dd0, 0xfd1e9768,
-       0x8e555742, 0xd57d001f, 0x44f93cea, 0x7bf8974e, 0x84b2f928, 0xe65b5de3,
-       0xc288b198, 0x9d03e7a5, 0xaa3bec0d, 0x5ebe2040, 0xfe416bdb, 0x904c99a7,
-       0x252eafcf, 0x367b27c8, 0x17c8bf33, 0x687bea96, 0xb52d590b, 0x8eee1f22,
-       0x5ff08b1e, 0x7a843c66, 0x4a26f548, 0x7e7c014f, 0xbd7956d9, 0xb2fb3086,
-       0xba1f7b76, 0xf8247e44, 0x796efd55, 0xe4cd923f, 0xb9c38db7, 0x42d1f380,
-       0x054a6d87, 0x96cabd2c, 0x6244ecc5, 0xfc5e3e07, 0x0bfb8ebe, 0x85cf9967,
-       0x597b8b01, 0xd41e96ba, 0x66af3a63, 0xcdf198e7, 0x928f3e62, 0xfd73179f,
-       0x9d0d4ee7, 0xcfafd0a7, 0x3f561314, 0x2750eaa4, 0x2debfcaa, 0x1e84fde2,
-       0xc0a9f825, 0x4270e957, 0x3b3a5386, 0x8fddf020, 0xd37c03f4, 0x25ce91f1,
-       0xc68954c8, 0xef605df1, 0x51f3e48c, 0x5d01707a, 0x370654b9, 0xa91aefd0,
-       0x0188e511, 0xae5a65f4, 0x57c89c93, 0xa976a8df, 0x4823de01, 0x327b94e3,
-       0x4676bf81, 0x9d289c00, 0x9fa40e1c, 0xdf49e216, 0x08e8c929, 0xbf2cbbdb,
-       0x82474a0e, 0x653e7bef, 0xba04c0fa, 0x02a71863, 0x3cb40902, 0x3a412d24,
-       0x5a7c6719, 0xad7ffd03, 0x78d3f662, 0xfac0d6e2, 0xfc72cc2a, 0xd7944b8f,
-       0xa1f6b2ef, 0xdbff8c0f, 0xe4273c39, 0x82eddbc8, 0xdf39116f, 0x995724ca,
-       0xe1f8fb7d, 0x8eaec087, 0x10392268, 0x9d1aa3df, 0xf8907fad, 0x2dec4f49,
-       0xc4f7c3f7, 0xf7c3f106, 0xafbeb968, 0xc3faafa0, 0x27ace617, 0xe7143a7e,
-       0xa8d20ee1, 0x9370a44e, 0x8ef161de, 0x28fe803b, 0x90370c3d, 0x486fd05c,
-       0x8973f311, 0x6de821f3, 0xc545af28, 0x20cafa71, 0xa35f4019, 0xbfd0c3db,
-       0x19d00779, 0x3e02dba5, 0x42df90ae, 0xde196f2f, 0xa532ae87, 0x78e3942c,
-       0x1f1c84de, 0x7f9ed922, 0x72f41324, 0x01e5ea17, 0x87131474, 0x11d288fc,
-       0x723ecf9e, 0xa0aede52, 0xe3ef8133, 0x252cdf5c, 0x535f488d, 0x3d2c5655,
-       0x2f4ecc95, 0x40d54e37, 0x3326f7ff, 0x74031b3a, 0xcbdf0598, 0x20dca4e9,
-       0x90e92baf, 0x9c0aa8ce, 0xa1974957, 0xe8032ce8, 0x98c7c84c, 0xa8d9d3eb,
-       0x674e5bb8, 0x826ee2a3, 0xdadf04ce, 0x372e6619, 0x96aedc82, 0xf90c0e50,
-       0xea05bb20, 0x5132eb03, 0xb169dccf, 0x46f6c41d, 0x69d45ed6, 0x42de4357,
-       0x9ede0ad6, 0x7a8728e9, 0xa76d1343, 0x671f1743, 0x2bd90d79, 0xa3c17b59,
-       0xe04d078d, 0xfeb172c7, 0x46b97e6f, 0xdddb491d, 0xd2ff786b, 0x37a872d6,
-       0xbffd65ac, 0x60c87880, 0xb77287c8, 0xadb7efc0, 0xb331b4cf, 0x25b7e994,
-       0xa53bbf7c, 0x5fb1075d, 0xe4b7eb2b, 0xa09c21b0, 0xd6f4ccfd, 0x4b3ef93b,
-       0xc67db136, 0x78f77e7e, 0x458ba52b, 0x5fea173e, 0x43b554e7, 0xb085af91,
-       0xd6a54b3f, 0x51c72854, 0xdda50bb6, 0xeeab5b60, 0x5b61e2c7, 0x714d14e8,
-       0xe2217fcc, 0xaeaf1048, 0x9a67d00c, 0x245d98e2, 0x268f8bbe, 0x8d911fa8,
-       0x4437b426, 0x2cf3cb9c, 0x850ec091, 0x50bf423d, 0x5971af71, 0x8c2fa88d,
-       0x2ef110cb, 0x9d3e66af, 0xafdbe0b7, 0xaff306c6, 0x3d31c734, 0xbf8f3ce5,
-       0xddabdf8b, 0x13bf2e2c, 0xe0192488, 0x7057f87a, 0x3c42775e, 0x1727098b,
-       0x65780e19, 0x727e27f5, 0x6a5add60, 0x35512fbc, 0xcc205c6a, 0x23cc25d2,
-       0x3c49d49a, 0xd77d9151, 0x3c434e3f, 0x8407963a, 0xa2dc5feb, 0xc2203cc3,
-       0xc134d9f9, 0xc7f5469e, 0xe3953df3, 0x4fe0a369, 0xe010c843, 0xde38d34f,
-       0x3d5033ee, 0xab72e518, 0x5e37c156, 0x21b1be40, 0x6f2dfea4, 0x6a95f057,
-       0xae62ef3e, 0x3e252f77, 0x49ce4bd4, 0x6fcf2c6e, 0x8d777a60, 0x35ea38f1,
-       0x9e991b3d, 0xa8bc4b59, 0xcb752cf7, 0x36cd42f9, 0x4daebd79, 0x97686f5e,
-       0x5cf27bd7, 0x86cf4f38, 0x4fe0a1ba, 0x03ee7eab, 0x0b56dff4, 0xf396e2fe,
-       0x32564217, 0x20ecf2fe, 0xed28e7f4, 0xeef76a70, 0xa1f8c38b, 0xe82d6679,
-       0x58227305, 0x98da82be, 0x64c07c87, 0x14383b40, 0x39da501f, 0x8320ef42,
-       0x2a0f9f82, 0xcf000c69, 0xc6777800, 0x921edb5d, 0x21f02bb7, 0x39fb91ec,
-       0x7c50a63e, 0x93bf3cc3, 0x1cf768ec, 0x31f0ca5b, 0xe902b8cd, 0x0c65d3e1,
-       0xba2ec21f, 0xaec83b79, 0x90762efe, 0xce2e5fd2, 0xb09a7755, 0x8768ad4f,
-       0x29800036, 0xf37bae9f, 0x9fa00bc4, 0x358eef8a, 0xc04d3893, 0x2a563c79,
-       0x9e4e8ff7, 0xe4287a70, 0x2b0f6e3b, 0x93e00bfb, 0xffa1c474, 0xd8412eb0,
-       0xe9fc6c45, 0xf2eaff3c, 0xe8a8ccca, 0x89bdd96b, 0x009a619d, 0xc68f6cff,
-       0x4e760917, 0xe70955cf, 0x4825ba85, 0xffdfc91c, 0x87c41878, 0xf9dfcefb,
-       0x3f03dfbd, 0xe302217b, 0x3257977f, 0xa6f2ef7b, 0x7c079881, 0x0549c791,
-       0xde1c961c, 0xce17b6f6, 0x1c31d35b, 0x7f7246af, 0x1db687bd, 0xe2633bd5,
-       0x3caa0e41, 0x2c57463a, 0x1df6219e, 0x42e96fda, 0xc03ba6fe, 0x0a4face4,
-       0xfa4ebcc7, 0xb8c080fb, 0xe302524e, 0x7e0e42c3, 0x2d6afdcc, 0x17d8a5bd,
-       0xc4b42bf3, 0x3d60b3d8, 0xc1bac31f, 0x1691f43f, 0xbbf835f9, 0xa548ce21,
-       0xee89492e, 0xa3881ebb, 0x3881bd6f, 0xc99e2dba, 0xf694a583, 0x62cd3f30,
-       0xcef9802f, 0x79e1b8f3, 0x1f3a771e, 0x2350e2c9, 0x5f1f19e3, 0xe44dfbca,
-       0xf110f9e5, 0xd9ddf16e, 0x35618366, 0x9b1feb5d, 0x36756189, 0xf567f125,
-       0x339f988d, 0x67abed8b, 0x39f305af, 0xf8aabf45, 0x8eb0a5d2, 0x18c71621,
-       0x9eb61728, 0xa9fa05d1, 0xa83f607b, 0xf57db04f, 0xcc52b184, 0xb95f1557,
-       0x3ce01e34, 0xec788bc3, 0x75108fad, 0x33df8e07, 0xc24ff19a, 0xfc7510fd,
-       0x5b8a85fc, 0xa55e2f5d, 0xe6cefb8c, 0xefb889e3, 0x9914362c, 0x73bee3cd,
-       0x0a4d640c, 0x91db9f6d, 0x48d5ecc0, 0xdc5900d7, 0x537115d7, 0x87417771,
-       0xb8fe693d, 0x889bc6e9, 0xfe20fe9b, 0x7f4dc796, 0x6e241f10, 0xbfa78caa,
-       0xb6417a0e, 0x980f0f1f, 0xd42adc19, 0xcfe0e5b5, 0x6090bcbc, 0xe901731e,
-       0xd028ecf7, 0x89688eb3, 0x137c8adb, 0xe1ebe3f5, 0x22a1ce2d, 0x39df9956,
-       0xd603589c, 0x968ce49f, 0x0ee351d5, 0xa94c0fc8, 0x4ff5964e, 0xfb27ec6b,
-       0x9069a33e, 0x55d33dac, 0xad67ab28, 0x7df643bd, 0x5932d6ff, 0x7773e07d,
-       0xcdbfbecb, 0xbf56593d, 0x7e40ff0c, 0x767e46a6, 0x65fbb6fb, 0x1d1c97fd,
-       0xddca7e82, 0x9712fe5c, 0x287733bd, 0xfac0a373, 0xcbe6daf3, 0xc91e23c6,
-       0x45f6d123, 0x23174f1c, 0x85893dd9, 0x3f9fcc9d, 0x6c997db8, 0x2d751afc,
-       0x47194fe2, 0xc3be242c, 0x96ea3f98, 0x37d21e6c, 0x7db4b8ae, 0x9ebbf633,
-       0xfafc227e, 0xb14de207, 0x24c91748, 0x92b3d199, 0x70bd8c1e, 0x05197b80,
-       0xa3b3c064, 0x20f4648a, 0x1b851bc3, 0x6f2ea9fa, 0xd1de6137, 0x700ba392,
-       0x3944fa3d, 0xe559843d, 0x239110f4, 0x4d9307a7, 0xe1a8ff8e, 0xe12bfc72,
-       0xe9cbb16d, 0xffe97881, 0xcc7780d7, 0xfcbd3978, 0x1ddce0ab, 0x1c81e3cf,
-       0xd90e43be, 0x37088c5b, 0xec243f96, 0xa3b73d7b, 0xcfdcac49, 0x7fa7f425,
-       0x1578f3c6, 0xd5f8471f, 0xb42e48d7, 0x66e37bcb, 0x9ee93dc3, 0x1bcfb04c,
-       0x38f3f309, 0x41c50954, 0x7bf884fd, 0x80a13f28, 0x67ae54eb, 0xfa3b10d6,
-       0xfc4117a5, 0x2b67969b, 0x677fa297, 0x1d69f189, 0x9938bff4, 0xc4d563e9,
-       0x7afdfc8d, 0xdc256ff1, 0x01252f40, 0x1c25547e, 0x63c90ea5, 0xe5c33e02,
-       0x10e93240, 0xf2c9c072, 0x12fee5f8, 0x00b2f102, 0x5ef4253e, 0x9f80be31,
-       0x7c625fe0, 0xe059f83d, 0x19f8281c, 0x45e391c9, 0x63815fe9, 0x181a1860,
-       0xc092b12f, 0xafd28af8, 0x50a7f7e2, 0xa7ce92bb, 0x216cc8ce, 0xcc436f14,
-       0x15d7f476, 0xf099ce93, 0xa0a7f0bb, 0xd236e17f, 0x29085feb, 0x8f13ae9f,
-       0xbc92e29d, 0x8df667cf, 0x2eb88ac3, 0xbfe7c305, 0x49479da7, 0xe4f7c456,
-       0x01c60737, 0x2ff5f51d, 0x45be4eda, 0x7cab51c7, 0x3f7e8131, 0x4f7f5fe1,
-       0xee7ee2f2, 0x48c7f623, 0x4f519e80, 0xcccec6da, 0x952eff04, 0x3250918b,
-       0x5769143f, 0xf41ad9ea, 0x4ee8aaff, 0x486bde80, 0xd3329c40, 0x75758edf,
-       0xe68dfadf, 0xc13afcbb, 0x2cbd9dcc, 0xfe70935f, 0xd0c3ec27, 0x7d7c98f6,
-       0x330b8c0b, 0x82fbfa25, 0xc0dc75c0, 0x037e453a, 0x7884e3dc, 0x9f2a26c6,
-       0xb04bcf51, 0x17515ea2, 0x3b13ea7e, 0x99d4567c, 0x36d7a81e, 0x0301a8e8,
-       0x7aebf8f6, 0x936c9716, 0x4c3fcbeb, 0xa12ef960, 0xa8f3c0e1, 0xf5cc7614,
-       0x47911df4, 0x16e01135, 0x944b3eb0, 0x9f803fe3, 0x9ef49da4, 0xfefe5493,
-       0xcc2eea15, 0xaedcbc13, 0xf54efbc6, 0x1fc85da3, 0xf1aaf7ea, 0xe8777508,
-       0x756f3ef1, 0x93d441fb, 0x03299aba, 0x85c97aa2, 0xe6b33a66, 0xec57f01a,
-       0x207d9437, 0x4c5e8df2, 0x9f33fce0, 0x2be607e4, 0x8af83e51, 0xdaf60f8c,
-       0x4a79bdad, 0x93e304af, 0x28dcea15, 0x9bdae7b8, 0xa5f1a287, 0x8fc00e4f,
-       0x720f1f72, 0x1a37e43b, 0x5d025b47, 0xd4ce99d7, 0x0abc6067, 0x64e1c775,
-       0xc90acf80, 0x12b47106, 0xa87fbb3d, 0x35b72f57, 0x0375d806, 0x203b521f,
-       0xc57a795e, 0xbf70d183, 0x503b8c59, 0x393de152, 0xf67d7642, 0x9f8822fd,
-       0xa3adb2cd, 0x667ad9b5, 0x2f7e6657, 0xcf4593c2, 0x763a3bd7, 0xafdb4b3f,
-       0x7dfef311, 0xe3fa3516, 0x0c64d562, 0xaf5885d0, 0x7e2857b8, 0x70cefb87,
-       0x5efc4d7f, 0xf21be2d2, 0x071f2d00, 0xaff62cfa, 0x37dca4af, 0x87e8d1a4,
-       0x6e9c7d7b, 0xdd45e80d, 0x443f2606, 0x6b31159e, 0x30ad7cf0, 0xaa75f3b0,
-       0x3d9bb0bf, 0xeabfb026, 0x9851ecc3, 0x9a91f5e7, 0x17f95d80, 0x82ca3db3,
-       0xdea2b3fb, 0xfaccc2b9, 0xde7cf375, 0xa1969f15, 0x12d7165d, 0x7ce8cf3c,
-       0x6a9fb302, 0x7964a8af, 0x0f1ab546, 0x5ed50be6, 0x913e61d1, 0x148ffdf8,
-       0xfe01ae0e, 0xd9f3fcfa, 0x0b5d6163, 0x7c0d6d88, 0x046d60bf, 0x21e80571,
-       0x8958af22, 0x7c71efff, 0x44345bd7, 0xe7ef1833, 0xddf5ae3a, 0x0754ff5b,
-       0x9d12efbd, 0x5c71cec8, 0xa5ebcb39, 0xe1c60576, 0x2585df94, 0x6cfc8a4a,
-       0xecafde2f, 0x5bdb07cd, 0x61ae409a, 0xb15fd7e7, 0xebb3f2cb, 0x57e87f69,
-       0x228c657f, 0x4b8f9b3f, 0xfd1ab3c7, 0xe0a16079, 0x6604bdff, 0x9e43d4df,
-       0xdfc090d7, 0xe7f8fd19, 0x5b79e589, 0x7f3848de, 0xe3576f3f, 0x1f9fe3fd,
-       0x12df8d51, 0x12c3dd64, 0xc506dc19, 0xdc5cf069, 0xcdf621ee, 0xdf17e641,
-       0xe205fb89, 0x7d729c7e, 0x73bccbbb, 0xc6c3fd60, 0x72aeff30, 0xec89419c,
-       0xddeeb13b, 0xf51f0cd1, 0x607c536f, 0x9fcb08fe, 0x5ded1ddd, 0x2cc0fc8c,
-       0x8e7cf3c7, 0x7b77dde7, 0xcbbef1d3, 0x0e7ecc5d, 0xcd570f45, 0x4f8007ce,
-       0x42374ed4, 0xaa19192e, 0x01cc9469, 0xf47aebe7, 0x4abb87e0, 0x70bed786,
-       0xc57e21d7, 0xffdf42b8, 0xc63539f2, 0xc63cbff1, 0x1bb12dcf, 0xf77c80a5,
-       0xebf3092f, 0xa12ad97f, 0x49df3f9e, 0x2fe51348, 0xa0d6b6f3, 0xa5f8b85e,
-       0x03629821, 0x7ca4afbf, 0x21225e64, 0xfe72d277, 0x775c796a, 0x7e3efae1,
-       0x7f281239, 0x94469117, 0x969f8b17, 0xeb26abf7, 0x837a0cff, 0x3e8cde32,
-       0xcf176a4f, 0xf77ae44e, 0xf8143250, 0x7d2f03fd, 0x86b48ba5, 0x94f3ffa6,
-       0x806b669f, 0xecb01aaf, 0xb963366a, 0x28bed13c, 0x39a5c291, 0x089d59d1,
-       0x188f8cfe, 0x5ed72e3c, 0x2e00f266, 0x7e008e4f, 0xd33ca12d, 0xd8f164cf,
-       0x723dc21f, 0x9ebd0f0a, 0xd47575c9, 0x7093c9ca, 0xff846e95, 0x8e79af30,
-       0x2d8de505, 0xf63de811, 0x63c6e317, 0x222fd75e, 0x75bf00ec, 0xc197eea5,
-       0x556eb08f, 0x0d71fa38, 0xce0f167a, 0x82aa5eda, 0xedb703fb, 0x1f83f696,
-       0x5563a1a3, 0x37efdc0e, 0x8f31c35a, 0x5e63aa20, 0x6c639326, 0xc716d89e,
-       0x2c67c04e, 0xeba36bdc, 0x4ee9975a, 0xe99a7c64, 0xf61cf539, 0x3ff5923d,
-       0xebb39ee1, 0x21ef1aa8, 0xbcb0d65e, 0xe18441fa, 0xc12be455, 0x5cfa81dc,
-       0x241b8517, 0x939ef5d5, 0x8da3c936, 0x301c77c4, 0xa8fb50ce, 0xc8267e27,
-       0x30699f9b, 0xaebbd34e, 0x20ca9277, 0xcce4231e, 0xfcccc94c, 0x9d5f5c42,
-       0x2c7fc441, 0xe9c5539e, 0x53d70661, 0xf8304667, 0x74b627ce, 0x81bf77e8,
-       0xd1e8aa44, 0x56de5999, 0xd1abfb8c, 0x116f405a, 0x7ad08971, 0x4e7f7042,
-       0x7626cbfd, 0x0df2521f, 0x682e4180, 0x79d6b909, 0x43f9c3db, 0x97e600fd,
-       0x0ec4d925, 0xb7fab071, 0xf8866e07, 0xc59c3e87, 0x321f2959, 0xef277bc0,
-       0xfba63c82, 0x1856fa5e, 0xdc42bf7b, 0x0bdb3687, 0xc3617ee0, 0xcc42d4e4,
-       0xc3e9385f, 0xb5ba0877, 0xaf3c74de, 0x5448bf94, 0x38987e06, 0xa50d1eef,
-       0xaa64faf3, 0x3ffad16f, 0xbd581b12, 0x8ab1779f, 0x3d2407d6, 0xbc83eace,
-       0x4b6ea0e7, 0x0d1efa7a, 0xf42b63dc, 0xfad3562e, 0xac2da484, 0x324b060e,
-       0xcfd26f85, 0xf1d171ee, 0x3eb8582f, 0x3de2f363, 0x0737fad0, 0x84fd02aa,
-       0x7f189263, 0xbec610ba, 0xe64990bb, 0xe778064e, 0x873eff04, 0x5cf42f7f,
-       0x9fd15fb1, 0xf7ef0624, 0x4b7b9719, 0x92d03df9, 0x8c36b208, 0x915c95c5,
-       0x3a870f14, 0xec5c6206, 0xcb346240, 0xf17b35df, 0x8e31109d, 0x4f18a780,
-       0xe40cbbcc, 0xc9f311b0, 0xe2f964aa, 0x79d27e5c, 0xd93ce356, 0x727f7676,
-       0xe0016a72, 0xc34de28f, 0xbc01a6f1, 0x30d77b89, 0xf91f25ae, 0x43f010fd,
-       0xbf4aba1f, 0x5baff4cf, 0x38572749, 0x616d2c9d, 0x259f40f1, 0x24a9e90b,
-       0x513bbf82, 0x04c7df24, 0x4931bf0e, 0x5ecfb616, 0x384824bc, 0x63870b4f,
-       0xe4c077aa, 0x77df9bbc, 0xcf5b1278, 0x0077dead, 0x7ef0ecbe, 0xdbf6a1c4,
-       0x30fdb0b6, 0x473d017c, 0xa4f75ea3, 0xab0bbc6c, 0xd387fd14, 0x8dfb0903,
-       0x3ffec2ce, 0x100defe4, 0x5fb7a5b2, 0x3fd33e66, 0xf7152f41, 0x4eeb89e4,
-       0xed17e812, 0xc6df0fbd, 0xf7faadee, 0xdf114f79, 0xd3ef99a7, 0x96e9f6cc,
-       0xee392bd1, 0xea6a9f4b, 0xf0bdc74b, 0xb72f1def, 0x3b278f90, 0x83c6c1e7,
-       0x2f0a1d73, 0x316e93a3, 0x2a758a3d, 0x670bd9e0, 0x3c04fac5, 0xbf637ce1,
-       0x8a5d395c, 0x9d42da75, 0x38efccef, 0x57eb295f, 0xbfcb30f7, 0x5d395625,
-       0x54ceedd7, 0xf45bdc41, 0xee3e0a3b, 0xcb5fbf38, 0x98e3c499, 0x443524a9,
-       0xa4c2dcde, 0x30fea0b8, 0xe7695dfc, 0x3e5858f5, 0xefded2b2, 0xc275b389,
-       0x25d7343d, 0xa47a7f76, 0x71013fc2, 0x7f465d92, 0x917cbf3f, 0xf87177d7,
-       0xf8aff5f5, 0x91677ef0, 0xab35ecbe, 0x9bff908d, 0xebf20ef4, 0x07b2a8a2,
-       0xf57d6933, 0xdfc8fd86, 0xbeca528b, 0x7cfca4ca, 0xac0386cd, 0xafb2f6fd,
-       0xe93d41fa, 0xd897ab20, 0x4f7e035f, 0xc67bc1c8, 0x88f5f924, 0x7159261f,
-       0x0ab9755e, 0xd5eadfdf, 0xa3d1de5f, 0x1ae022fe, 0xabd22caa, 0x9fc5831a,
-       0x81e97b5a, 0xc38609c5, 0xa790ad3f, 0xaf78edc4, 0xf7c76646, 0xaffbb244,
-       0x86fefb3d, 0x4f9e19f7, 0xf004fe72, 0x35d110d0, 0x1fd69327, 0xe30cf88d,
-       0xea9d9250, 0xb0c7e021, 0xba2cc99a, 0x9d6ba95e, 0xb225f403, 0x20d066cc,
-       0x075fb95c, 0xf0a2f4de, 0x9fedeb7b, 0xa6c2923d, 0x463ac071, 0xf0d03e70,
-       0x435f37f6, 0x82e1b2dc, 0xe1ea06d1, 0x0f0d8e88, 0xa235be82, 0x30dfd7e3,
-       0x5feecc39, 0x008f7588, 0x7dfd1dbf, 0xd71ebb78, 0xb6e3a23f, 0xc8fdf045,
-       0x016476df, 0xe53e8c9d, 0xd0b60169, 0x148defb3, 0x2fcdfdf9, 0x186f99ae,
-       0xe0248e32, 0x54aa27f1, 0xde3c2145, 0x8ab8f060, 0x71dd51f9, 0xd178d6c7,
-       0xdfbf27b9, 0x8c76f542, 0xe1265e83, 0x8bd3f036, 0x7f4ac57b, 0xba4ac9e0,
-       0x68fbfa3f, 0x80415d1f, 0x85725cde, 0x7a01ffda, 0xc8b12978, 0x2486e5ea,
-       0xe615f7d9, 0xb8fb594c, 0xed64dbc4, 0x640b5977, 0x233909f5, 0xb44fdf64,
-       0xf7eaca95, 0xf64bbf0e, 0x52bda57d, 0xb4f02f56, 0x721fbec9, 0x7ede5da4,
-       0x0f01a89c, 0x076d2785, 0x6b3e2ca1, 0xd0e2b747, 0xa1078df3, 0x0617f11c,
-       0xf43fa50e, 0x076d2b8e, 0x0fe177e1, 0x1157de55, 0x6ae9d1fe, 0xdc175ba3,
-       0xa1a89a0f, 0x8bc925e5, 0x62ad44fc, 0x305e55f7, 0x6f01bb39, 0x094abee2,
-       0x122943f8, 0x625ee62a, 0x3167b2f7, 0x4049d87f, 0x19a7f00c, 0x9de3f426,
-       0xfabe36d4, 0x4ec7167b, 0xda37be03, 0x77db2557, 0x6ca715c9, 0xa964a5df,
-       0x65cb4f02, 0xc3f30af5, 0x25c7efb2, 0xdfb592ae, 0x815c7d65, 0xf56527a7,
-       0x0a0db689, 0xe0566d3c, 0x76b267e9, 0xdc1ddf41, 0xf836f53f, 0xca396895,
-       0x780e59db, 0x0fbcf3b8, 0xb3bc31f1, 0x74f01cb5, 0xc436c9c7, 0x51c79157,
-       0xe872ec0e, 0x5083c691, 0x05fda87a, 0x27340efd, 0xd9a87962, 0xc3a9fe8a,
-       0x1e5839cd, 0xefe1b669, 0x8e1e6abf, 0x76cdfbe5, 0x3cd37f2c, 0x66cecb1e,
-       0xcd6d9607, 0xaefdf86d, 0xdfe676e6, 0xd7bde98a, 0x807e069f, 0x1eb7956e,
-       0x27643eee, 0x7e044ec7, 0xedee1dd9, 0xaea3fa86, 0x2fc089e8, 0xa1130007,
-       0xcbcf9c78, 0x3df629b1, 0x0dbf94c9, 0x91756649, 0xb2a6d057, 0x5e1e8017,
-       0x09e331b2, 0x8f211a4d, 0x9a2472ad, 0xa06eac2d, 0xe6364475, 0x613c655b,
-       0x55e4254f, 0x60772510, 0x7bd4227d, 0x90fb58c2, 0x4113198d, 0xf1ceff0f,
-       0xbc9f7b60, 0x20e492c0, 0xcf57e0f1, 0xbfe04d5b, 0xa0757639, 0x8c71e009,
-       0xa4ecb1fb, 0x968f3b40, 0x2d029aa5, 0x0a93d9c8, 0x3d9444bd, 0xc9f1d2aa,
-       0xdb6fb071, 0xbe43cc34, 0x7e804b5b, 0xdecc4b27, 0x4ff5df15, 0x1317f9e1,
-       0x1d4f68f5, 0x6117d957, 0x7be493de, 0x64bce001, 0x7b8410e3, 0x0e97c98f,
-       0xb1b45bf0, 0x7ce3d590, 0x80b6482f, 0x67c196ba, 0x8982c6fa, 0x0a5bdcae,
-       0xe0c1059f, 0x666c9d53, 0x9ec7b6fa, 0xa8807a06, 0xd7b4af1f, 0x5e3e79c1,
-       0xa2fbc76a, 0x767a1cc7, 0xbc261d7e, 0xf63440e7, 0xfe0169e2, 0x5ac9b39c,
-       0x2e1537ec, 0xf35f819e, 0x739e357e, 0x29553c25, 0x3a470f4c, 0x46733b01,
-       0xc705da04, 0xb7deec55, 0x14ccfbf2, 0x0c5d1f66, 0xeb77ee0f, 0xa6cbdbc7,
-       0x87babdd4, 0x22b3d78e, 0x71ee870c, 0xac7d440c, 0x7bc251a7, 0x1be73db5,
-       0xbd76b12f, 0xe304838d, 0x5fe13392, 0x8ed5fdb4, 0x31faff07, 0x15b3fefd,
-       0x21943611, 0xbf0841e6, 0xb3c7f9fb, 0x3fa80c63, 0x569c9ecd, 0x26717206,
-       0x31cd738f, 0xdc31e269, 0xe0e8b1a5, 0xc685ba09, 0x82143582, 0xa56c7164,
-       0xa9cc9e0e, 0x06be5d4e, 0x4fd965ca, 0xf0ada2ea, 0x35ced77e, 0xd1d6c6a0,
-       0xfc8c5c23, 0x3341fbcf, 0x26dcd75d, 0x73d995b5, 0x6bdaae5c, 0x433f2a6e,
-       0x9e71efd0, 0x8081432f, 0x87166af6, 0xc597e8b7, 0x325b74e9, 0x91e4138f,
-       0xa7df763c, 0x1db00e37, 0xf66ba4e8, 0xc4420307, 0x5cede409, 0xc744fc7f,
-       0xbbbe55e6, 0x4ecde620, 0x71fe7a61, 0xd04ca51d, 0x7267ef27, 0xabeabf20,
-       0xfee98b47, 0x2acc3bf3, 0xadcfc38c, 0xb87803db, 0xa8f1cedc, 0x9e70ed25,
-       0x7de6b8a6, 0x8a4ab986, 0x93d79a7b, 0x734eb697, 0x2cbca079, 0x03ca3af2,
-       0x5f70e5e5, 0x45c8396b, 0x7c451f21, 0xcd5cd3d0, 0xf22372f9, 0x4dcd43d3,
-       0xecdc3f58, 0xf348f2c2, 0x5b97ce5a, 0xe6fdfdb1, 0x765f38e7, 0x0dbcbe73,
-       0xae68ef7f, 0x66edf2c2, 0x28969627, 0x7e016fc7, 0xcc4e0d53, 0x83777bef,
-       0xeb7c409e, 0xf31e8772, 0x7889e80e, 0xc858f9e1, 0xbde3d1a7, 0x8d5e653b,
-       0xd2f7cf92, 0x25f7df43, 0xf4f300fe, 0xbe80c3e6, 0x9e9a1198, 0x09ab118e,
-       0x92dfd2f8, 0xbe82269b, 0x356acc7d, 0x657d3e81, 0xa5f21363, 0x49ab7663,
-       0x24dfeb4b, 0x9ddacc3f, 0xd69e9356, 0xc3e37bff, 0x3565ddac, 0xdffad185,
-       0xeacfbf93, 0xc482c26e, 0xe7c8cd29, 0x0874894b, 0x21b947ce, 0x17150c73,
-       0x1e975e54, 0x2e317382, 0x3818de71, 0x56c97517, 0xacbb8fa4, 0x7d410eab,
-       0x0d66ce42, 0x1bb6c55c, 0xbf43560b, 0x0d4ad8b2, 0xba931bf4, 0x1bf4357c,
-       0x26a4fd9b, 0xdcf8dfb0, 0x7ea1ab9d, 0x06b36d8f, 0xce3ad3f4, 0xa238c4c7,
-       0x9f05da2e, 0x835e7916, 0x0f281c3b, 0x281ddbf2, 0xca5c040f, 0x063e56a6,
-       0x7686c77e, 0x3ac12cc9, 0xc1bd4aa6, 0xab91c86f, 0x291af787, 0xfe7a8ebf,
-       0xba2ad309, 0xdfa806cf, 0x5627f581, 0x9dfe5add, 0x97d71292, 0xe7e09f7f,
-       0xe43de41d, 0xb1d09f65, 0x001e32f7, 0x7de314b8, 0x2bbe1334, 0xd0269c49,
-       0x3cb89ab3, 0x6d25095f, 0x3bebcedf, 0xd9579c85, 0xdfd0a7fb, 0x7db85373,
-       0xd83f97d9, 0xfcf41d60, 0x8439ee2b, 0xa1fce768, 0x7b2cc530, 0xb08ea15f,
-       0xcbd7557b, 0x31e6531b, 0x9629f32b, 0xf6c3b691, 0x1479becc, 0xc7bd84b5,
-       0xae4fcca2, 0xad5eec27, 0xd7b94f32, 0xfc670aae, 0x0d780ab4, 0x2989e3a5,
-       0x6564f921, 0xe135f14a, 0x910f6f20, 0xb094bd97, 0xf93eec3c, 0x5b1f3c35,
-       0x8ce22fb9, 0xf25def63, 0xfee56cfc, 0xddf45d04, 0xbf832b5f, 0xea9fc186,
-       0x7d600b77, 0x044d7315, 0xfc8156fc, 0xf06be3e7, 0xbb3f251f, 0xfa727c55,
-       0x9f763adc, 0x6b1f2fbf, 0xc7c2094a, 0xb2975e44, 0xdc2a7a14, 0x3efc831b,
-       0xec060f78, 0x9c123bfc, 0x3d97402d, 0x55afbe65, 0xb2c68760, 0x2dbb93f7,
-       0xbbf035ce, 0x03f963a4, 0xbcf6af22, 0xd04bf5ca, 0xf94a9edb, 0x6ebbf215,
-       0x8cf41610, 0xe075a3ac, 0x8e2c4367, 0xe48fd0f5, 0xef817578, 0x1fca8730,
-       0xe1cb9a7d, 0xe59125be, 0xfe6cf655, 0x0fde86e6, 0x0a8f050a, 0xdc2f28f5,
-       0x3c3cb85f, 0x9767e502, 0xfef03c44, 0x3c69576b, 0x695d2dea, 0xb7940d3a,
-       0x4aee2eda, 0x2be3801b, 0xa4aee3ed, 0xef3606e1, 0xfe50f1d8, 0x115ce926,
-       0x790fbdc8, 0xcebb613e, 0xe037e435, 0x86111e1f, 0x257bfa71, 0x41c0116f,
-       0x1d775769, 0xcd66559d, 0xd35f6bef, 0xfd818dfd, 0x3d519ed5, 0xacddbf06,
-       0xf4db5dbd, 0xed3c8135, 0x09574d91, 0xbcdf8fe4, 0x9d19ddfd, 0xc2bd056f,
-       0x322402d9, 0x13ea8bac, 0xfcbd7eb4, 0xb5124ba4, 0xec0333d3, 0x66bfe1f2,
-       0x54bc4a79, 0xde7de7da, 0x92e65b4b, 0x7a95c3e7, 0x44df318a, 0xfbc48ded,
-       0x9ef62aaa, 0x7a57c882, 0xd4f3db8f, 0x829b3f5e, 0x74ceb87e, 0xfdfebd99,
-       0x823ce74f, 0xf30c207c, 0xff6d5e33, 0xfad60e3c, 0x9fb8ce87, 0xd3f565bc,
-       0x6bf98377, 0x5f679812, 0x565974db, 0xed7ee2ef, 0x2fbb2d56, 0x354ffb54,
-       0xc72a25ca, 0xc89e22d6, 0x0103dd01, 0xfdb495f2, 0x83de17b9, 0x04abbf29,
-       0x1d7ca180, 0xfb4ec939, 0x887b7255, 0x9d587790, 0x95c48fdb, 0xe271eac2,
-       0x7ab31ffb, 0xa9fef89a, 0x4f3a7649, 0xe7689265, 0x75e36ffd, 0x33d58797,
-       0x647ff7c5, 0xbb589bdf, 0x498ed37e, 0x3f05ce70, 0xdfcaa537, 0xddfca201,
-       0xcd7c5a92, 0x3b791a7c, 0xdde2ffe7, 0xdfef8a9f, 0x9c01f115, 0x730936d3,
-       0x6a576ae7, 0x317f5fd1, 0xf03f2dba, 0x7791507d, 0x613728e3, 0xebdd541e,
-       0x0b80b703, 0x1e3a6d53, 0x44ca7a0f, 0xa154ff9e, 0xe59c6236, 0xc7c67af2,
-       0x8b79e943, 0xe194de9b, 0x7f3b4fab, 0x9103178f, 0x4f4bbe74, 0x90f7b024,
-       0xee313bb3, 0xe995383f, 0x22bef0f1, 0xf915e7dc, 0xc459b15c, 0xec71f60e,
-       0x5dec611b, 0xc89db3c8, 0xc1bf175f, 0x1b75d7fc, 0x9b3ca20e, 0xffa2b6af,
-       0x673f5c68, 0x47c42a71, 0x30039d4c, 0x36f4ddee, 0x673fc39e, 0xcb9c7998,
-       0xcf081b97, 0x5fe17dd1, 0x97f81d7a, 0xbfe13bfe, 0x180dea9b, 0x8613dae7,
-       0xc6826cf6, 0x1c41b3ab, 0x577b24f3, 0xdb872172, 0xe23fced0, 0x7887ff7d,
-       0xc59daa3d, 0x959e4469, 0x54a1f798, 0x8f038313, 0x7e4dd487, 0x43c4147f,
-       0x224afe04, 0xb7f81b48, 0x1c6c1e29, 0x83c0360f, 0x2e3fb780, 0x0665fb42,
-       0xbd956b8e, 0x1ee02b5f, 0xe92b1cea, 0x195bac43, 0x3c665827, 0x5df80c54,
-       0x81799376, 0xbe38d297, 0xfbcc5e35, 0x410673fb, 0xb8f028b9, 0x5dde2fb2,
-       0xc4d771a9, 0x5ffdbcbb, 0xdc25778c, 0x8f2d6594, 0x7f7f297b, 0x2ff55521,
-       0x36ffe385, 0xc6ecea7f, 0xb9f6b2fd, 0xc86f474d, 0xa0fc2adf, 0xabbf2eff,
-       0x7a4eb7f0, 0xe20a896d, 0x7c7b4a32, 0x6be3ba5a, 0xdf7bbfa0, 0x09ee47fc,
-       0x00f57c58, 0x90793fcc, 0x51abe5ef, 0x11ecfb7f, 0x355f4f4a, 0xa9d43f32,
-       0xad6a5ffd, 0x63e97d79, 0xb11515f6, 0xecd5d007, 0x20b48fa6, 0xcd5366af,
-       0xea3c5822, 0x309e9cef, 0x81f2847f, 0xc6d1032a, 0x555ff3d2, 0xae73dec5,
-       0x344bc082, 0x6d271e96, 0x1e21a49f, 0xd2b5af78, 0x31e8f1a8, 0xb7bf241e,
-       0xb9efe7aa, 0x7652c352, 0x576d557f, 0xb4d37e63, 0x748e2ce1, 0xef0db1bf,
-       0xf238ce25, 0x6847a5e8, 0x2aed593b, 0xe2b77966, 0x54efd19e, 0xfa1f1337,
-       0x7e612a7b, 0x1dc78954, 0xee316b97, 0x61f7eca8, 0x4d63f32a, 0xbf2c4b52,
-       0x4fcb2f60, 0xee91e713, 0x90be88ef, 0xbbc3c1e5, 0x5a8d95a6, 0xd07cc0cf,
-       0xfea3f63f, 0x557c30d1, 0x61afe03e, 0x9f46748c, 0x1b03d7ef, 0xfd82fe9a,
-       0x5958fc95, 0xe9dfa8de, 0x4823e6b3, 0x3c5f422f, 0xbac1ecd5, 0xab350fd2,
-       0x6e303fe4, 0xee2fe233, 0x5e472816, 0x66189fb5, 0x95f6eefd, 0x9d84abb0,
-       0x04dbb4a5, 0xb5ef10bf, 0xc3fc140d, 0x777b11f0, 0xbccac351, 0x15ff3934,
-       0xd9f2957c, 0x7f8c3482, 0x006ff9ca, 0x7ff6c61f, 0xd3f61f17, 0xfc0da37d,
-       0xeca95535, 0xdd25737d, 0xf93226d7, 0x7577a4a9, 0x19f51ab9, 0x3a0bbd25,
-       0x19becfbf, 0x20b375fd, 0x31d74f56, 0xfbc241ab, 0xff5f2752, 0xba0643e1,
-       0xa7b6ae84, 0xe8f7b2b4, 0xfbee926e, 0xe9b381ca, 0x9677df30, 0x9c33a403,
-       0xf8665bdd, 0x47d69458, 0xbb4d2e8e, 0xb7951cb6, 0x17f18bff, 0xbe73ff64,
-       0xca241c9b, 0xd473057b, 0xd39f362a, 0x213ef2c8, 0xcdc7acef, 0x675579ee,
-       0xd37be2b6, 0x122fb864, 0x7dd2c8f8, 0xc58eb26a, 0x01493437, 0x117508ef,
-       0xe92327cf, 0xb1464bef, 0xf9943877, 0x4f3cf598, 0x37719973, 0xbe5213de,
-       0x3df22407, 0xca78f9eb, 0x7f448177, 0xf9582f71, 0x34c6d02e, 0x90ad7f7e,
-       0xf838b214, 0x3753f9b5, 0xff00c9c8, 0x66d5f770, 0xa4b673b4, 0xae47f1fd,
-       0x6f3c7e51, 0x3e7ee34b, 0xbf6c5d3f, 0xff6c5d0e, 0x6a1749ff, 0xef7c56d3,
-       0xe2e966e3, 0x3f7dab11, 0x8f9c5bac, 0x96fc73de, 0x78b1cf1e, 0xf967b80f,
-       0x471ef8ab, 0xe30437cf, 0xc3f3d740, 0x6bb17494, 0xbacfa33d, 0xaf144c5b,
-       0xd0b94f23, 0xb8e2303f, 0x0dbfef13, 0x990edf7b, 0x90e0a4c6, 0x16eb0d43,
-       0x1bd0827a, 0xdf80fcfc, 0x1d79e153, 0x6e37ca37, 0xaff1be36, 0xfb886b8a,
-       0x4f5add32, 0xdb9009f1, 0xbe82c37b, 0x8d257d97, 0xef50edc9, 0x9ca25a6e,
-       0x534f0057, 0xef15df38, 0xd9a8566f, 0x3b97b93b, 0x589fe8d5, 0xfedf83f1,
-       0xdf6b79f2, 0x58fa95f1, 0x5072f983, 0x0d9446fb, 0x5f2f962a, 0xbcc56e58,
-       0xc07bb02c, 0x17fc215f, 0x5847efca, 0xd1d3c2cb, 0x69d51ede, 0xc73cf587,
-       0x5f0a13d6, 0x123e4d0d, 0xa87ceef8, 0x15f61bf9, 0x9c07e79b, 0xbde9098f,
-       0x9cf99676, 0x1bef8fc1, 0x6dff8ba5, 0x3524fffa, 0xfe544971, 0xa66e49e6,
-       0x57a6124f, 0x589d22ce, 0x2c3e21ce, 0x4fe5849d, 0x2c3627cf, 0xaef61217,
-       0x670ca1f9, 0x8de83a49, 0x0fbe1f5a, 0xbff5e97b, 0x4cfbe2e7, 0x856c8e77,
-       0xe55ba89c, 0x55ea56b7, 0x8fbe053d, 0xd8ff03a7, 0x2b74f7f3, 0x7b1bffca,
-       0x94507aa7, 0x107a4a7d, 0x4a6ff6bf, 0xc4beecd5, 0x5e5107c9, 0x1f599a54,
-       0xfdf98632, 0xe2642627, 0xcdf3f1f9, 0x6f82cd84, 0xef2afc42, 0xdfc58a8c,
-       0x77f84a97, 0x2abdda79, 0x8b79623c, 0xa86add32, 0x79ed66ef, 0x44b71675,
-       0xc22379eb, 0x8b72fb58, 0x67ddf21b, 0xcb9e2f13, 0xaeed90b9, 0xbd13bff6,
-       0x7bf9d880, 0x127ebe06, 0xc3a8bfed, 0x89b6f2c0, 0x9bf61b37, 0x1049760f,
-       0xe997f73b, 0xee0fbcec, 0xe0fdf8c7, 0xe15fb932, 0x267ede21, 0xe013aca3,
-       0xfb74bbf1, 0x0d7ce0f7, 0xf75cee8e, 0x53f81154, 0xc2fc0454, 0x18788c5f,
-       0x5fa228e3, 0x11ecb598, 0xc4876ef8, 0xfb5d8bf2, 0xd2dde2f4, 0xfc7f40f8,
-       0x55f28ca1, 0x74daddf0, 0xc1429fc6, 0x942efe15, 0x261d8823, 0x8306d5f2,
-       0x427e886e, 0xed06ef82, 0x437d5890, 0x577bd8fa, 0xe977d11b, 0xcc33fd02,
-       0xec31fcea, 0x108eb063, 0xbfffac23, 0xd219bdf8, 0xef710e98, 0x55e82f25,
-       0x4a7c5fa0, 0x27dc31c5, 0x63b53df8, 0xed4d3ca1, 0x40ff2851, 0xcf2851ed,
-       0xca147b50, 0x0a3da9cf, 0x362ba2e5, 0x14971c78, 0xce7fd867, 0xbbf83ce8,
-       0x33a62f1b, 0xc32679b9, 0xc75b29d9, 0x63ae1d3e, 0xc7f3a587, 0xec75d14f,
-       0x82ad93d8, 0xe0a12cfb, 0x6fefb3d1, 0xf820cee9, 0x93dfcdec, 0x6ccbe782,
-       0xefe7f3e4, 0xcfdca0d6, 0x2e46f76f, 0x3daef80e, 0xc878875d, 0x123673db,
-       0xf736efc6, 0xd12ed5c2, 0xb1524ead, 0x330bfb7a, 0x0b9d5def, 0x0277b0fb,
-       0xeef9e8fe, 0xfdbf3280, 0xfb863fb7, 0x8c7c741b, 0xbe48f6c7, 0x532f4067,
-       0x6fb943ee, 0xffba2fb1, 0xc77fd075, 0x13b07e9e, 0x3b086fca, 0xfbd8fb2f,
-       0xbbf77db8, 0xaf7bd70a, 0xf70457de, 0x56fdee12, 0xf41f341d, 0xc229464c,
-       0x99d056bb, 0xba71b788, 0xaefaf812, 0x1e395ae7, 0x0017ef11, 0x3c82b50f,
-       0xfa091aba, 0x5b8f2560, 0xfeceefb6, 0x1cb9ef10, 0x3bf81351, 0xe5a38381,
-       0xc19d4ee7, 0xf3289dce, 0x801ce9f6, 0xcefb1daf, 0x9cfbc365, 0xf0d93f14,
-       0x4abf5b77, 0x17f32fef, 0x66f88de6, 0xfd0fd023, 0xe02eff1e, 0x02b9b20c,
-       0x0d33f3e2, 0x2d85dffb, 0xa99f36cd, 0xdcfcf880, 0x9430e944, 0x6399acf3,
-       0xf22f2e21, 0x94e4179a, 0x74a3861e, 0xf512ad8f, 0x2e6052b8, 0xdca17201,
-       0xe71fc110, 0x46287215, 0x98971f56, 0x2efefb22, 0x7dac966b, 0xb2edce42,
-       0x26fbdef6, 0xdffe21b6, 0x7c3c01fb, 0x465e20fd, 0x8efec1f7, 0x7dec4bd9,
-       0xc73dbcdd, 0xd69dbeef, 0x0d3cbd27, 0xc1db63df, 0x2aed27db, 0xd623bfc7,
-       0xa3a9e143, 0xe1f9d48a, 0x14f33f8f, 0x13b0a60c, 0x78bdf76a, 0xbe67de18,
-       0x1d709dae, 0xfbd420fb, 0xd2bfa2a1, 0xf2fca03e, 0x072fc0c7, 0x0cd53ebf,
-       0x231da1f1, 0x790649be, 0xefc19994, 0x21bb7187, 0x9ef4dd14, 0x61fac90f,
-       0x2528fde0, 0x28f210dd, 0x4e5643a7, 0x01eec63a, 0xfb3f2cdd, 0xb433f013,
-       0xf0245dc3, 0xfd2a08ef, 0xb6758365, 0xff041f0f, 0xb86a07ce, 0x3f7bd109,
-       0x5bfc316b, 0xb277a7ed, 0x4963f370, 0x0bbbf8b1, 0xee7ae0f4, 0xc1959b3f,
-       0x76a4ace2, 0x454963ff, 0xe2b276fe, 0xb27bec8c, 0xab235a52, 0xd794ceaf,
-       0x09ae97d7, 0x0f4a1fec, 0x3cdcfc5b, 0xee0f339d, 0xff4149f1, 0x7aef626e,
-       0xd85f3962, 0xecf904b7, 0xf14bfdb9, 0xbf2ab9ef, 0x81e3a7af, 0x08716fdf,
-       0xd3f82af9, 0xcf7b350c, 0x4cbed957, 0xb5bb67cc, 0x614a7df3, 0x6f5c798f,
-       0x69fbb930, 0x93275394, 0x7f4c19eb, 0xc9e1b4bd, 0x710d7c1f, 0x9eccbda4,
-       0x726164ba, 0x17f77f23, 0xcc7bf82a, 0x7d19c383, 0x2abd9be5, 0x53d327b8,
-       0xbc82e11d, 0x26a586ed, 0xdc1bb7cc, 0xa189f7cf, 0xfc1f9080, 0x1a7fd0f4,
-       0x0efe7d28, 0xc805bf2e, 0xb9d01ee1, 0x8cf1fd68, 0x49872843, 0xb86fcb2e,
-       0x9c7cfb55, 0xbfa864ea, 0x317e3194, 0xcb8fe807, 0x55cf422b, 0x57a463c3,
-       0x021f017e, 0xc0fd40b8, 0xf0fbdf4f, 0x1e33f069, 0xfc02fc65, 0x0f513307,
-       0x7ee51bb0, 0x1ef63685, 0x0bbd9598, 0x4242f222, 0x87658ff1, 0x5760755a,
-       0xf1fe6ade, 0xc4f9f5f2, 0x8f1409b1, 0x3e597b0d, 0xfe8ee5f7, 0x6f802451,
-       0xf0d7e128, 0xb7cf0a9c, 0xa87777a8, 0x5079c3c7, 0x70164bde, 0xb201e626,
-       0x181e78f7, 0x20c9b7fd, 0xa7d81f97, 0x50f44161, 0x1155acf3, 0x833cc06b,
-       0x8e51e9f7, 0x98f7f589, 0xf7d91f39, 0x5cd2e8d7, 0x220aae56, 0xa01ea94f,
-       0xa03d058d, 0xf5bb4252, 0x65097de3, 0x258fff00, 0xe216b1e2, 0x3a2f9810,
-       0xbf070d85, 0x899df11b, 0xe04d1cc4, 0x6ec27afb, 0x5a6fb69d, 0x3f57d07f,
-       0x63ff3dd9, 0x69f2198a, 0x879e1646, 0x1f8ef0e9, 0x16c7ef85, 0x43f81a47,
-       0xeb78f126, 0x175f16c7, 0x8f1fd5e8, 0x6fc0908e, 0x0d5fc749, 0x7d7d8be3,
-       0x35a475ac, 0xed17fa06, 0xfbd3be83, 0x42bda25d, 0x0274b2bd, 0x11678bc4,
-       0x5efcd77c, 0xc9a3d335, 0x0b3cec3b, 0x7520dabe, 0xc73be346, 0x32bb9319,
-       0xa684ff68, 0xab3da11f, 0x51ba27cc, 0x6ed7ba3d, 0x77b126de, 0x4e8c6c32,
-       0xfc5d47eb, 0x7f3a74c9, 0x41efb53d, 0xdf6babaf, 0x28a6ef8f, 0x7b5ef9ed,
-       0xbc2fe94a, 0x7fe83f8e, 0xca6fb100, 0x0080005b, 0x00000000, 0x00088b1f,
-       0x00000000, 0x58adff00, 0xe554700b, 0xdef73e15, 0x66cd927d, 0x421b22f3,
-       0x260ddde2, 0x9b709601, 0xf51e4357, 0x8ca4109a, 0x6388376d, 0xfadea56a,
-       0x59092040, 0xd6a27509, 0x0071a6e1, 0x3b634ea9, 0xb33088a3, 0x2331e1d2,
-       0x3054d353, 0x32d740a3, 0x5da96255, 0x66d42d8b, 0x88d46b98, 0xf1a6c935,
-       0xa1986655, 0x5ef7fce7, 0xd6086f76, 0xe6ccdd3a, 0xe73effec, 0x9cff8f3b,
-       0xaa36c01f, 0x5cfb0195, 0x8bdff016, 0xed2bf1f6, 0x8ca2c020, 0x06ac43b0,
-       0x27c8f2d8, 0xfb0dbd7f, 0x990dedd4, 0x47f18b63, 0x475f8e3e, 0x5c8054b3,
-       0x000ea580, 0xd4c0154f, 0xbee8b4fe, 0xf097f500, 0xd9b00350, 0x80453f87,
-       0x9c944e8f, 0x8ff1c6ed, 0x8703b0de, 0x9f1b275d, 0xdb107c9e, 0xf9a7f65b,
-       0x059e349c, 0xef8d3e6a, 0x38aa8d2b, 0x6a7e3ee1, 0x27073ba4, 0xfb4ba60e,
-       0xbdc3fc71, 0xc61fcfa5, 0xafe786f6, 0xaecd8897, 0xd9883c5d, 0x0d885fd8,
-       0x3e6dffea, 0xfd7e075b, 0xfd2e75dc, 0x92e0e15c, 0xf8d0379f, 0xce896cc1,
-       0xcb39a569, 0x75ec2e00, 0xf00e50cb, 0x7dcac419, 0x731f00c5, 0x1b8f18ea,
-       0xcf87f3b7, 0xb3c03c73, 0xe494a50e, 0x37fbb8de, 0x7947ab7f, 0xe77e0f9a,
-       0xdfc865e9, 0x40b93386, 0x5cf2c0fb, 0x787e0186, 0x1a728b98, 0x9708b5e7,
-       0x60085abc, 0x067158fa, 0xb4f89284, 0xdefb721f, 0xe2b81977, 0xd32073b7,
-       0xca1aeed2, 0x965fbdf7, 0x8e83b76c, 0xd9c3dc31, 0x7d0eff68, 0x65798608,
-       0x09d5f109, 0x0808039a, 0x97847298, 0x9c085400, 0x13ff840c, 0x65ff864e,
-       0xa490dcfa, 0xf8cf222d, 0x1941e0e8, 0x6cfce0f0, 0x702bf970, 0x97e3a2b9,
-       0xdf74a278, 0xad66c44e, 0xcd500598, 0xbd592df6, 0x8b7fc924, 0x15e9b230,
-       0x977a7fdc, 0xef627253, 0x0cee1bb8, 0xa73eae87, 0xeb64cc55, 0x053eb9d7,
-       0x7fb2765b, 0xadbfcf53, 0x51c810ed, 0x27d15f5c, 0xb48fde56, 0xafcbd0db,
-       0x0c35e1fc, 0x8f2781f7, 0xee78669e, 0x3a1de079, 0xe98794f7, 0xb8eb4e0f,
-       0x23683827, 0xd6fdcc39, 0x56c0a6b9, 0xc73efc49, 0xc7fb35f8, 0xae5b399e,
-       0x4763fee0, 0xda039716, 0x7c425df3, 0x67c459ec, 0xfe7e3d32, 0xa783a461,
-       0xf15732fe, 0x476fcd5c, 0xcfdb34cf, 0x1c738f6c, 0xe483b793, 0x829bfec0,
-       0x9e228de1, 0x09903603, 0x4b9dd1bf, 0x422d7e18, 0x9ff48328, 0xdfcac8f8,
-       0xfdcd3e4c, 0xfdccfe4d, 0xa43d79cd, 0xc261c42f, 0xc2cf2f11, 0xa24539fe,
-       0x6f09ae45, 0x43d33cbc, 0x3fd63efd, 0x14ed8591, 0x9fa36b7b, 0x1736dfa8,
-       0xbf9073d8, 0xea4e36b6, 0x42afd603, 0x0531a316, 0x2ffc3bc7, 0xd841b81b,
-       0xab767685, 0x93906761, 0x5a3f236d, 0xdf5dba03, 0x8bc7fb5a, 0x76e0179c,
-       0xfa03b018, 0xf7be39cb, 0xe3a42ec7, 0x13b4bf03, 0xbe10e87e, 0x4e5fb431,
-       0xbcbf877d, 0x4db96af8, 0xa58d804a, 0x5f831bc6, 0x22ca09b5, 0xcf84cfb8,
-       0x014bf2a3, 0x1b39119e, 0x8508579b, 0xa5c70f34, 0x3a81da18, 0x90fa94e8,
-       0x787c4b9f, 0xe1dfe12f, 0x1f939588, 0xf12eeb98, 0xe71feb0a, 0x7d23af4e,
-       0x1e562d83, 0x647d474e, 0x40cb803a, 0x65c52b9a, 0x0cfd43c4, 0x23015c58,
-       0x9518f1fe, 0x1d849ce8, 0x8f9106da, 0xfd37ea46, 0xaaa4ed13, 0x7a0c8f99,
-       0xfc93f392, 0x0195db5b, 0xb2aacfdd, 0x2cc0c8f9, 0xc327f1fe, 0x4060fb0f,
-       0xd617fdd0, 0x7ae710b8, 0x59006703, 0x64df7f20, 0x3cb937b4, 0x54e30131,
-       0x0552ebc2, 0x18febfe4, 0xf5db01ea, 0x44abd8b6, 0x07a1ebd1, 0x310759f5,
-       0x6b21bf7d, 0x8f70e6fc, 0xfc1c703b, 0xa91c598b, 0x8dbbd433, 0xd1e9008b,
-       0xee8cfd05, 0xd102e2e4, 0xa314c16f, 0x446cf832, 0x97467611, 0x15d19843,
-       0x25746110, 0x0aba33f4, 0x19bd1806, 0xa2c28ce2, 0xf8b01f58, 0x58df13ff,
-       0xdf6f921a, 0x5a465fc7, 0x66441b75, 0xc32987f3, 0x078dafce, 0xaf9af546,
-       0x500ac78f, 0x6baf8cfc, 0x8cbf32e1, 0x8b89b9d9, 0xd711ec93, 0x27ea21b9,
-       0xdb1a08da, 0x5c3206e7, 0x1046e7dc, 0x066ed46d, 0xbe5bb599, 0x9ab51e22,
-       0xb3425362, 0xbb3cd2e0, 0x70345c9d, 0xab2c25e9, 0x185afa93, 0xd4db5910,
-       0x149f201b, 0x27d6afff, 0x559f1114, 0x889f4d69, 0x03b22218, 0xc61b61bd,
-       0xa6caaad7, 0x2f6c62ee, 0xb7a93c08, 0xed2a9beb, 0xfbd39e12, 0x8c72f08b,
-       0xee0c2eab, 0x2845c46e, 0xa916a016, 0x0396f6e2, 0xb85395fa, 0x54ff225f,
-       0x10f100dc, 0x40b9e373, 0xc256d0fe, 0x3e2dbfee, 0x3aef3f5d, 0xda00f494,
-       0xe62ba777, 0x2de71115, 0x74792dbd, 0xe8776e0f, 0x2b9bbefb, 0x65057e2e,
-       0xae39e272, 0x383ca48a, 0xadb1baae, 0x4f776271, 0x57ee7920, 0x5020af38,
-       0x9af3ed7d, 0xfc488afc, 0x4804ab80, 0x3dc605cf, 0x2f58383d, 0xef9d3c49,
-       0xe96be763, 0x383ddd25, 0xbc3fa4f4, 0xa44bf690, 0x90b5f6eb, 0xd24dcff0,
-       0x94b90135, 0x27f667c6, 0x1a38bf7a, 0x1f137dc3, 0xaeb8c1e0, 0xd394a031,
-       0x56bc5db9, 0xf87a8954, 0x0779da69, 0x4fb4dfe9, 0x0772950e, 0x4327dbca,
-       0xbeecc1d4, 0xaf2577c1, 0x77da4e2a, 0x0fdc5ee2, 0x870aa871, 0x5c38ed9b,
-       0x493916d3, 0x6fe956b4, 0xa73a11c6, 0x12e9f89e, 0xbe91d6a6, 0x38cf3327,
-       0x37fe603e, 0x2333b75f, 0x313f1d2e, 0xde8170fc, 0x7f8a430c, 0xf8b89d75,
-       0x1e303ff9, 0x247b4d76, 0xec7f5e9a, 0x26f06e99, 0x3ab30afd, 0xfd30dc4b,
-       0x19c86eac, 0x85bcd813, 0xc6fcd2f7, 0x14c52333, 0xd1186f6f, 0x42dc30fa,
-       0x02d9f8e2, 0x7b8ddedd, 0xfb82fe41, 0x8b42f73a, 0xb8c74a80, 0x1088f9bf,
-       0x9b5ca275, 0xda304f29, 0x743fb62a, 0xd0649da1, 0x8f93d97c, 0xe437ad72,
-       0x83fe1cea, 0x6d3a8303, 0x1bbc92a3, 0xefd7fe0c, 0xca66fbb9, 0xed4436fb,
-       0xdf8ef8c9, 0x36e891f6, 0x90fdbbe2, 0x21229fb5, 0xac65dfc9, 0xabbca0ef,
-       0xeb37f298, 0xfc782ebc, 0xba97145f, 0x9bfdac86, 0x4c39e902, 0x063dc60f,
-       0x9f78be46, 0xa3e48731, 0x71f379bc, 0xb289d447, 0x2ddbde6d, 0xe85da8f9,
-       0xdd1c5891, 0x5bb328f3, 0xc9ec3e73, 0xfa623666, 0xc01d86e7, 0xc71360f2,
-       0x329c07a5, 0x81e963e9, 0x62df963c, 0x0af2ce5e, 0xcecc138c, 0x1c262297,
-       0x990bddda, 0xcf1e4153, 0x9978e179, 0xcbf37944, 0x6f78655b, 0x333f9241,
-       0x0e116f6f, 0x3ed03b37, 0x1f01efa6, 0x50357de5, 0xae0374f6, 0x87653eab,
-       0x834f8e28, 0x0be98fae, 0xebbfcb3c, 0x64fd2b86, 0x231cc207, 0x4f31f86e,
-       0x2dc3c14f, 0x253101ce, 0x75f135cf, 0x2b4b7a1a, 0xa78cb2cb, 0xeb2cf34b,
-       0xd6836a33, 0x0f1caaf5, 0xd69c50d5, 0x8bca67d7, 0xc341f32c, 0x306f1c3f,
-       0x5deedbe0, 0xb7ec8a71, 0x66feb3d1, 0x657b29c2, 0x53be6585, 0xff102638,
-       0x2cda9f0d, 0x8426fc7a, 0xce51d39b, 0x0f31b7da, 0xc6ea73c1, 0x4d6ee3ad,
-       0x7ee75a05, 0xa01f253b, 0x7b6b44fd, 0xf987b4c0, 0x1ed53f30, 0xae7b7892,
-       0x50f649e0, 0x782c0b03, 0x0aebc4cf, 0xf3071efe, 0x6ee1ba87, 0xd86e5fc6,
-       0x9b5e7b8a, 0xc57cf715, 0x7ac1738a, 0x1185ce2b, 0xf5d7ce2b, 0xa80d7158,
-       0x778adc56, 0x5fe659d4, 0x6964dfdf, 0x655aee97, 0xba30bf99, 0x7c5ed2da,
-       0xfccb76e8, 0x59770325, 0x6d0e97c6, 0xf69b8cb4, 0xdfff5335, 0x619e6d88,
-       0x5ff03c5f, 0x53caffa2, 0x99ce590f, 0x888077a9, 0x6bd6f840, 0x5703bb00,
-       0xedfabdeb, 0x578af07e, 0x0f029deb, 0xf5339de5, 0xa7fa453f, 0xffe86f38,
-       0xc629d233, 0x17bd37b9, 0xfd37271e, 0xcf1e9a6e, 0xb886845a, 0xb06d7a4c,
-       0xcfeb7ab3, 0x3a737662, 0x1ee303c5, 0x18f71b0b, 0xecc1dfac, 0xdbd3ec21,
-       0x493a5c52, 0x5ce2ac71, 0xaaf899b8, 0x512722d2, 0xd0b9a84c, 0xf3419cdf,
-       0x387d1065, 0xfaf0339f, 0x36072d5e, 0x7b613f8b, 0x5bcf126e, 0x03215ed4,
-       0x8a5fd727, 0x4b30b1f6, 0xbf9e0ec5, 0x6ae718da, 0x55a27bf5, 0x052d8376,
-       0xf35ac697, 0xfe3108fe, 0x316ffc4c, 0xe7cc08ea, 0x3cf941c1, 0x05f68aef,
-       0xa45fcb66, 0xafcb025d, 0xbd6f9614, 0xa27629ce, 0x22f15c6b, 0x9e4aeb8a,
-       0xb8882f32, 0xc892f24d, 0xeb4e33f2, 0x2412a123, 0x6a565d18, 0x754cab66,
-       0x30a39618, 0xd19f290f, 0xfb187aaa, 0x2f46ad3e, 0x1253e97b, 0x18838a54,
-       0xdf394717, 0xfb5c4ab6, 0x45c7dd66, 0xca2d6f74, 0xff501790, 0x3c8ef795,
-       0xabe30b94, 0x412a8bc6, 0xb1c43ea0, 0xda63e1fa, 0xdf8a5964, 0x7bb3b0ee,
-       0x6a7a8c0a, 0x599381ad, 0x9c61dd4f, 0xac5b8a3b, 0x76bdf8c7, 0x478675e8,
-       0xd59c7fbb, 0x926f689f, 0x7bbff70f, 0xea82a7be, 0x252b9049, 0xeb370ebd,
-       0x7fe102ab, 0x7acd47b9, 0xdbf35af4, 0x752c17fd, 0xefd61c2e, 0xafef6b97,
-       0xca4d7b32, 0xfa3fefad, 0x77bb1a58, 0x6c2b1f46, 0x7fdc9a22, 0x36bfed92,
-       0x3ec596f2, 0xbbf9ecee, 0xa47eeec5, 0xd7196bbe, 0x05eca672, 0x3476bf28,
-       0x100fc57f, 0xce2389bf, 0x5133aa1a, 0xa60fdf5f, 0x13dac1d4, 0xbce9cba5,
-       0x3fe72eff, 0x5b23be19, 0x905b60e3, 0xd6fcf394, 0x6dadac73, 0x299d18d5,
-       0x9a9759a7, 0x287bf1d4, 0xa67ea1b3, 0x6cd239b8, 0x41232cef, 0xb91f6f3d,
-       0xdd136e71, 0x0e8523bf, 0xf44b4e9b, 0x4bad7e76, 0x4958af6f, 0xecf76134,
-       0x8474baa0, 0x7b439903, 0xf9f79d18, 0x516e0701, 0x403ca797, 0xa69a2672,
-       0x2977a73e, 0x288ad1c8, 0x2a664c9e, 0x873f520f, 0x167e5fc9, 0xf284b3e3,
-       0xfabc0bff, 0x7018c06b, 0xad6ddf60, 0x7a4fd794, 0x647fbb75, 0x2aad2ddf,
-       0x199952e2, 0x40eb4ade, 0x917bd8d6, 0x8ef9afc9, 0xd52f7542, 0x4eb70921,
-       0x263907b7, 0x74198eff, 0x28d4d537, 0x1d064bdf, 0x384afbe5, 0x4edd87f2,
-       0x7e601fd8, 0x315e5320, 0xfba9cc7d, 0x8bc00d81, 0x711defe3, 0x3cf6473e,
-       0xbca67917, 0x9633b305, 0xcefc57ff, 0x6138a319, 0x14e4bfbe, 0xe10b3f8b,
-       0xec979cfa, 0x4c9fceac, 0xbfc86b17, 0xb2afbd3b, 0xa0a6ebbc, 0x40e4c032,
-       0x8c7e2849, 0xdbee751e, 0x2a4dfcc9, 0x7ffe9d5a, 0x103b677d, 0xa68c7564,
-       0x3bc691e7, 0x8b77299b, 0x7b9338f0, 0x4813977a, 0xe37b89ce, 0xbbd8854f,
-       0x7c445492, 0xdf3af28e, 0x7ca6bf26, 0x7dc91ca6, 0xcd6edcbe, 0x7be4a2f7,
-       0xf212f6d6, 0x7f51c403, 0x3bb813c7, 0xfeb2cf57, 0x9aabe90c, 0xa09da7bd,
-       0xa231b638, 0xf525a7bf, 0x3bc0ffde, 0x0f61b7a4, 0x5ad7638b, 0xcece533f,
-       0x0f0cc313, 0x2487f394, 0xa79c8a5f, 0x7eef2983, 0x3ecfc713, 0xbebf1215,
-       0x38c2897c, 0x3c4cdf7b, 0xc448b177, 0x5ec79df5, 0xd276473f, 0x33ffd469,
-       0x739da9df, 0x9acc7eb0, 0x6f1a7ded, 0xc97c9485, 0x6f9fae69, 0x04c7aeb3,
-       0x886cfc99, 0x0af291fc, 0x5e2927bc, 0x8be4f79b, 0x69c19d46, 0x4d78b1af,
-       0x6efd91e7, 0x5f7654e3, 0x7d05ef99, 0x5447de1c, 0x2cdd2b97, 0x79d70b8e,
-       0x17cfb224, 0x74e306d1, 0x34e4d8ff, 0xa33c2ef6, 0x54e79d8e, 0xd93b253e,
-       0x1e5356f2, 0x6f83b9d5, 0x27ea32ac, 0x36a91efd, 0xce9ab2ec, 0x1943fe27,
-       0x32a93eec, 0x4571abf8, 0x0cbade58, 0x177f4154, 0x1e19de30, 0x7752cd7b,
-       0xa2bf07fd, 0x17f0846b, 0x000017f0
+       0x424e4cce, 0x4c22f212, 0x21a08812, 0x8a80af0c, 0x2201277f, 0x282039f5,
+       0x4201d458, 0xd4837908, 0xcdedaf4b, 0x11102484, 0x0547f435, 0x5088768b,
+       0x340da2d1, 0x0ec160d2, 0x6d7b1420, 0xc0faf06f, 0x480bf5ea, 0xb12f3141,
+       0xcbc57e20, 0xe7dad6bf, 0x264ce664, 0xafdbd880, 0xb4fdffff, 0xece7d9b8,
+       0xebdaf7b3, 0x7b5ad7b5, 0x75923ded, 0xc7bf9302, 0x03fc45d8, 0x8c4d4fe5,
+       0xf2c109b1, 0x80f66667, 0xc9b18727, 0x473afebd, 0x6d55633c, 0x9da23b19,
+       0x99ec258c, 0x50281421, 0x2c23d5fe, 0xbfdf8250, 0xf097c365, 0x4219b6ff,
+       0xd0977c3e, 0xc3e611e9, 0x02d5e4fb, 0x933a876b, 0xea0c319c, 0x4b19b98c,
+       0x126b2c64, 0x4b223fa3, 0xe0ff828d, 0x8f392573, 0x27fc34b1, 0x61467574,
+       0xc678c0ae, 0x5c531e32, 0x38a9d0d4, 0x843f7815, 0xbcd2c67f, 0x0731b725,
+       0xbc03cf63, 0xbcf071c9, 0x61de3a5a, 0xc22eefe5, 0x3af3a1df, 0xae58cd6a,
+       0x32773e30, 0x416589a7, 0xf3e33ebf, 0x3d6346ac, 0x4fe3d99b, 0xec3fc346,
+       0x8c517ecc, 0xb1138f30, 0xcb3c018c, 0x632f0e54, 0x5467b2bd, 0x6a9b1f10,
+       0x2c32a258, 0x852f0f58, 0x56338765, 0xed975e03, 0xf8165c16, 0x2f6c39fe,
+       0xbed7e631, 0x15ead66b, 0xa362593e, 0xb50404a1, 0x67eff4e4, 0x11bfcb11,
+       0x2b30fef1, 0xea4ab2a0, 0xaf805595, 0xfb765aaa, 0x67edfe95, 0x54e88933,
+       0x5bf6b929, 0x5adefc61, 0xf1866ae6, 0x02d59997, 0x91fb2fac, 0x7a83e5d3,
+       0x21476366, 0x36d0fa83, 0xc1198981, 0x9e00afef, 0x007f91db, 0xa52b2a1e,
+       0x740642de, 0xb02bddec, 0x871c0ce6, 0x776cbbf7, 0x0c65f306, 0x6658e70c,
+       0x32e73826, 0x74893a41, 0xd2073071, 0xf324bcc1, 0xcea84289, 0xb0f3dc54,
+       0x9de29f7f, 0xe7f4ed87, 0x38e60b49, 0xf25700bd, 0x57a06650, 0x9d3ab5b1,
+       0xea563265, 0xbe442969, 0x8decb538, 0x9e025855, 0xf7c02413, 0x08a78b7c,
+       0x5798a9fb, 0xa780cd9d, 0x8d1859e6, 0xff2db43f, 0x0cf80933, 0xc4c5f3ba,
+       0x76313f21, 0xf04f843c, 0x5a11f1cf, 0xde981c5d, 0xb08b2b97, 0x05f1091f,
+       0x1f011772, 0x26a0423f, 0x544d28e0, 0x29fc573a, 0xd0a0d86b, 0xc3595bfa,
+       0xe50069c6, 0x3f0cbc11, 0x0843ac61, 0x1cbd4be5, 0xb0ff3bba, 0x3c303b94,
+       0x04f3d3ff, 0xab7e1274, 0x1fc8b700, 0xbfd97615, 0xca61f812, 0xf7c0e6ab,
+       0x362a3f80, 0xd40b7e0b, 0xe8dbaf4d, 0x5e26f77d, 0x3765d80f, 0x16d74ff2,
+       0xbdf00ba8, 0x1bf1fda5, 0x155ebf91, 0x3b763359, 0xfa84ca22, 0x3b06a4e5,
+       0xc0750f1b, 0x578db147, 0xbbef362b, 0x692fbf1f, 0xf41b30b3, 0xf17bb157,
+       0x7d42371d, 0xc33361f1, 0x6b5b1526, 0x2fa814e5, 0x582d0bf1, 0xf0e029ef,
+       0xfe8976f9, 0xc7bed0ad, 0x1b389ed1, 0xc6ba73e8, 0x63329cca, 0xc4f6f675,
+       0xa567c059, 0xf8851dfe, 0xc176e95d, 0xf29f6885, 0xc943d6ea, 0xb917af38,
+       0x8b6d977c, 0x7f1d4e66, 0xab64f7f0, 0xbc1ef818, 0x64f3065f, 0xd662efd0,
+       0xb07a8854, 0xd93aeb62, 0xebe20f69, 0xe34a8d74, 0x8bdfc9f4, 0x577c0e30,
+       0xc2e08af9, 0x989a5629, 0x7bb0e517, 0xf3ce6db7, 0x56afce0a, 0xbce3b6ce,
+       0x6ed8cb56, 0x2efe7fb1, 0xfea5cd54, 0xbc2172cd, 0x59b4dd2f, 0xdb910e2e,
+       0x8c836db2, 0x1ac86d70, 0xd7208dec, 0xd7807841, 0x52f583b2, 0x0fa803d4,
+       0x233cbf25, 0x852acf84, 0xb2cbe258, 0x1a73226d, 0xddd388f8, 0x13fc2ef7,
+       0x6bdbe5f0, 0x74eabc27, 0x1aa7d3eb, 0x1aa8cedd, 0xbcdea51d, 0xf8f81119,
+       0xc003a471, 0x827884d3, 0x9f06ad72, 0x97cb3263, 0x9b877fa0, 0x3cbb02a9,
+       0xd999365f, 0xf563067c, 0xd2dd07b0, 0xd99750f5, 0xf582e652, 0x7bb1fa50,
+       0x0493d42a, 0x9f3867ef, 0xc25bc17a, 0x2496abd7, 0x9579e00f, 0xfce0e6c0,
+       0x30d0218f, 0xc0c955af, 0xa6f7809f, 0x8bcf7969, 0x3c7b0682, 0xb17f8bd6,
+       0x39fa8326, 0xa198fd43, 0xf7cbac9f, 0x324e16a3, 0x9616a3f4, 0x8dfcfde8,
+       0x595db1fa, 0x37854d3f, 0x2c29e118, 0x0491fbd5, 0xbf6f5768, 0x37a979b2,
+       0x73c2364f, 0x13f53973, 0xbcc5d53b, 0x1ae7ae0a, 0xb776b03f, 0xed95ef08,
+       0xb0d763b1, 0x5028be50, 0x0edb8005, 0x17ca1252, 0x0ca29331, 0x8eeb187c,
+       0x27a1d433, 0x4175e4f5, 0x958813fd, 0x45397c69, 0x9f90bd26, 0x43faa562,
+       0x85e90a29, 0x5ef06e87, 0x8e20eb83, 0x2ea192cd, 0x11ab477b, 0x14e01af8,
+       0x60961258, 0x7ff52417, 0xf1ccdabf, 0x217a9050, 0x5f7c18fb, 0x8ecdea65,
+       0xa635fa85, 0x6f116bfc, 0xe5eb812e, 0x63559128, 0x230b28bb, 0x233ab4fd,
+       0x085f79ef, 0x00871a9e, 0xbf6085fd, 0x126f668d, 0xdaf8d7f2, 0xc0127c67,
+       0xcc086ab7, 0x12ba0527, 0x60f8099e, 0xa43d5a3d, 0x69f10938, 0x43be4191,
+       0xfc6197c7, 0x06ff1a1c, 0xc71ba3c4, 0xbe3fe84f, 0x61927325, 0x897a6b7c,
+       0x0cab7c61, 0x4fbf03e3, 0xc6d66dad, 0xc0ddfc07, 0x99a134d8, 0x97a4b7c6,
+       0x65abf8d0, 0x3f186256, 0x5bfc6faa, 0x819efe70, 0x83799fe6, 0xa5e9fe71,
+       0x7ccbf9c6, 0x5f6ab3fe, 0xa28fc6d2, 0x5e16cff9, 0x2f4ff3e2, 0xf0b7f3e5,
+       0x77c6fb7e, 0x5effe1f4, 0x8077bf9c, 0x93592df1, 0x5a1ff38d, 0x85bf9c6e,
+       0xbb545f8f, 0xa15f1b53, 0x3b0917f1, 0x9687fcf9, 0xc5b2f8d3, 0x923e42eb,
+       0xfdaaa353, 0x81a44f68, 0x1d260c40, 0x0472a6e5, 0x1fa00518, 0x04990a86,
+       0x9c5143c7, 0x0145ceef, 0x7d4129bf, 0x5120fcc7, 0x352acfa0, 0x9edb2f9e,
+       0xa59ea32f, 0x376889f7, 0x6d453ff1, 0x6c37ad22, 0x1c3fc5bd, 0x136eede0,
+       0x5a2f587d, 0xa45f937f, 0xe5db8ef5, 0xf005c660, 0x1c9e5ff9, 0xaf3a1cd5,
+       0x935172f0, 0x418764f9, 0xbe3c388e, 0x1aa23602, 0x26476be0, 0x9fac1098,
+       0xc60a3d04, 0x7a0e3b2f, 0x6653cb14, 0x009c8f6e, 0x50e4cb3d, 0xf6e5a9b9,
+       0x93bd8f88, 0x5bbaf303, 0xc4a4ff83, 0xb9727df1, 0x9ffc47e0, 0x4654b75b,
+       0x09a8b4fd, 0x7910e98c, 0xd4e8d2af, 0x6fe2dbbb, 0x4e9f0816, 0x243dcfc4,
+       0x97fd8c8a, 0xde2fd766, 0xddf0c830, 0x486fe63c, 0xd70bf682, 0xc2a21fce,
+       0xc7307ffc, 0x53ed1632, 0x13548490, 0x354b31c9, 0xa7316f81, 0x15399d75,
+       0x31ccf72a, 0xb9faec1b, 0x07fd635e, 0xb77ac625, 0xa1366fd9, 0x6044b1bd,
+       0xfbdfa19b, 0xf5ef8daa, 0x71093671, 0x78daae9c, 0x78722777, 0x2c72c3ef,
+       0xae89563e, 0x5bfcabf7, 0x87aa9e1d, 0xeb402ccd, 0x43024765, 0xc812fa3a,
+       0x7caaf35e, 0xdef0e1de, 0x3dbab66f, 0x3ffdcf00, 0xe19f0912, 0x1ebc77f0,
+       0x1d8136ed, 0x4be1b1d7, 0xe1b7da33, 0xff8709f3, 0xf3e11581, 0xf7d46551,
+       0xcfe17df3, 0xf3849f39, 0xfe5b5553, 0xed2113a0, 0x3fbe5a2a, 0x7f0844e8,
+       0x619b6d95, 0xcff12fa8, 0xbc5fb435, 0xfde1be61, 0x8625a6a2, 0x971b0bf7,
+       0x7df3ea1a, 0x7fb4323f, 0xe1ad4560, 0x8fd57dfd, 0xa0ffde18, 0x3ea19d64,
+       0xd0d1bbd7, 0x9b399efe, 0xaf4def0d, 0xe513bc8f, 0x915deea8, 0x5671bae1,
+       0xda38f939, 0xc9156783, 0xb4f8f485, 0xe0e48926, 0xca938d74, 0x5671b6ee,
+       0xc583d72f, 0x5e9c4c0c, 0x71af9ce1, 0x4665ea32, 0xc2aff3fa, 0xea0f9f05,
+       0x849c137f, 0xcc83713f, 0x02c2c002, 0xe3e3eb8b, 0x7de4315e, 0x6fde65c7,
+       0xd71f4100, 0x11d8bdff, 0xf35579f9, 0x046aa1fc, 0xb72821ff, 0xb9d7152c,
+       0x0f7d6d1e, 0x302e5f7f, 0xc673e84f, 0xd79c9256, 0xb94ceb69, 0xf941f5cc,
+       0xf402e4ce, 0x40e5cbbf, 0xc6a5f576, 0xa2a4016b, 0x3ceb449e, 0xa401f901,
+       0x592fc0c0, 0xdceef906, 0x955c1227, 0xaf4013a8, 0xc19e63ae, 0x8133d426,
+       0x8d77e903, 0x49dc3842, 0xa04b6f54, 0x66b3bd75, 0x1213a0fa, 0xe543c7d2,
+       0xa87335a7, 0xa5e3593c, 0x094d44f2, 0xaa6bc795, 0x59a8eca9, 0x35c7e541,
+       0xaa3f2a3e, 0xcff2a469, 0x1e544d35, 0xe540d9ad, 0x2a7e357b, 0x54dc6bbb,
+       0xba2bf9f6, 0xecd78dfe, 0x80afcd55, 0x67ea8795, 0x43d4b9b4, 0x739276db,
+       0xf9ca1257, 0x365ce519, 0x8e67e3da, 0x31996382, 0xf9c2be30, 0xba3a606d,
+       0xf6295ec9, 0xf5c7fd03, 0xe28b6f7f, 0xd899b274, 0xd9a67074, 0xe17fc323,
+       0x7543905a, 0x16065909, 0x7b0cd724, 0xed617e84, 0x8e5d7a43, 0x9bddcc4e,
+       0x71e8133b, 0xe5bf99f2, 0xda75bf61, 0x407517fa, 0x059875a4, 0xbd21779e,
+       0xeb46f042, 0x9aabef5a, 0xfe0cbfbe, 0xd7f0faba, 0xfbfe8e9e, 0xfea54141,
+       0x985ab4cf, 0x13dc7884, 0x67e607ed, 0xef3f0e67, 0x965c7940, 0x444f5264,
+       0x565e83c0, 0x4aa864b4, 0x66d3fae8, 0x12699fac, 0x7ad0b7a6, 0x35998cec,
+       0x554af90a, 0xfa430c4f, 0xf7a95127, 0x56492cb3, 0x9ebc804f, 0xc31596de,
+       0x5f3f6fd7, 0x12c7b707, 0x485f82bf, 0xf0deffed, 0x0e8fd40c, 0xecad630f,
+       0x03ea2b13, 0xedf59778, 0xfd2672fd, 0x6c57e295, 0xda1cf98f, 0x7bf8160b,
+       0x1207e291, 0xab7ef5d5, 0x659f445a, 0x6edf3e34, 0x73be0f18, 0xc5f73eea,
+       0xadf14bcc, 0xc4864ec4, 0xf169d611, 0x366db2c6, 0xc4aeb8d5, 0x6d55ea1a,
+       0x9d61aac9, 0xfc807fc1, 0x42416ab3, 0xb8d729be, 0x1a5247a8, 0xdcaf8005,
+       0xab7ea4e4, 0xc2aede04, 0xe17b21da, 0xa72b5751, 0x9df040db, 0x94ec39ae,
+       0xac4bde40, 0x7c0201e0, 0xa7232d25, 0x6aeb9ea2, 0x7b444bad, 0xf33c4cb0,
+       0xf7c22790, 0x8d024d3b, 0xee6fc4b7, 0x1aa3ae35, 0x57e8307f, 0x167e4e7f,
+       0xd4864e53, 0xcedc4d3b, 0x80f7ef0e, 0xf0e5efd6, 0x48fdb953, 0xfece8de1,
+       0xfb6caa78, 0x1c92f642, 0x82f2ffc1, 0x57f1d278, 0x401cf26e, 0xedba5a7d,
+       0x9fa3d918, 0x0fd97d9a, 0xf53f425f, 0x44929f9f, 0x5e7d5271, 0x6129303e,
+       0x7c5a059c, 0x9ef7f817, 0xfd3d610f, 0x6ccddfec, 0x2ec7c00d, 0x6f782b40,
+       0x13335fd6, 0xa17d4133, 0x5ad05b56, 0xcfdd7146, 0x2a8edc4c, 0xd1071e62,
+       0xa1e53581, 0x4cc5d91d, 0x5d4f11d3, 0xb8c76dec, 0x329c3a10, 0x1667a4c9,
+       0x18ed1a36, 0xf50d7fb0, 0xf58c1bc5, 0x11333662, 0x7af149f5, 0x340bf333,
+       0xf7fbc33f, 0x7fe12a4d, 0x855eab31, 0xf9a4aaeb, 0x26540b23, 0x157c02a5,
+       0x6f3679bf, 0x4c5fc63e, 0xe3d10fdc, 0x38e24b23, 0x7ef1a5fc, 0x3fef0dd9,
+       0xf7771d69, 0x8b06488d, 0x89c6157f, 0x6d730c58, 0xfbf1fd65, 0x870fe16d,
+       0xfbaf5f57, 0x383469c5, 0xdb826dc4, 0x2f7f811f, 0xeba67c68, 0xd5445beb,
+       0x8ddc17e0, 0x21bf10f5, 0xb2e2d446, 0xee911322, 0x67d5aa5d, 0x14f7a18a,
+       0xb4edf7b7, 0xde80eab8, 0x0679373f, 0x4ec81389, 0xed2165c8, 0xd2f26e7e,
+       0xade14ef3, 0x995bb462, 0x3b45c814, 0xe218d614, 0x07e35953, 0x8b91ca31,
+       0x833b66f1, 0x6fe81475, 0x9fa0f841, 0xdb92f655, 0xbbc62e58, 0xbfa1de41,
+       0x87851cc7, 0x94dba805, 0x59fd8656, 0x7cf18c92, 0xaf58d39b, 0x1d207fc2,
+       0x3f8a3046, 0xc2908f45, 0xa86018f0, 0xe32eed0f, 0x84e851f3, 0x201fdd91,
+       0x8b10763e, 0x02556943, 0x26cf8c22, 0xfe7d9d49, 0x7bfa2656, 0x2f8a7e1c,
+       0x2ae5fb40, 0xc5a95f6f, 0x507f97cf, 0x12ee3830, 0x3ceaa8fa, 0x21419068,
+       0x7fbe3d75, 0x71fe625e, 0x3a6f41df, 0xd10d5561, 0xde4d739b, 0xd40f4869,
+       0x009f0893, 0x760d78e3, 0x2a1a9a60, 0xf8c20be7, 0x88e1aae3, 0x5dfd0667,
+       0x2ddef26e, 0xe387f426, 0xea4ffbaa, 0x4882ffd7, 0xfeeabcf3, 0xbfebf587,
+       0x15ff5232, 0x977979bf, 0xf4a9f80f, 0x803a4f57, 0x5267d999, 0xe80ba253,
+       0xc1b5be5e, 0xa9f97281, 0x5d2073e4, 0xd38bf33f, 0x16e7c923, 0xb74f9751,
+       0xff11e422, 0x7e9d1f10, 0xd03bd1e9, 0xd5b73aae, 0x607c52ac, 0x0160259b,
+       0x5d6caca6, 0x9b63e5c2, 0xafaf18e5, 0xb3f902fe, 0x2fa8cdaa, 0x32785f4a,
+       0x40cde311, 0x0e7fcd49, 0xb9507f90, 0x68852fe5, 0x5eb15577, 0xdfe17bd2,
+       0xe3e7f8e1, 0x2f981ec8, 0xaf7ff4c7, 0x6955f3ef, 0x7d6aa978, 0x84910bf4,
+       0xcdfc83a5, 0x9a25f6f0, 0x68a4ffbd, 0xdf38a78f, 0xf9113644, 0xf307c74c,
+       0xeebf7b73, 0x8f73a7c5, 0x5b9d3c01, 0xe421ddfe, 0xd727f284, 0x165a677b,
+       0xe735fcfe, 0x0dd4f2c0, 0xaed4317a, 0x6767d7d6, 0xeca7e69b, 0x39b965e1,
+       0xb03f40e0, 0xe5d9b37c, 0xfcbeba43, 0xc19e2ffc, 0x1607ccb8, 0xbfe870d7,
+       0xef83e5ec, 0xb2f500dd, 0xdbf8e61d, 0x211434f8, 0x2a974831, 0x6c62bbf8,
+       0xbfa50e90, 0x473b283e, 0x8e3fe7f1, 0x6ca3d20b, 0x8d993ec7, 0x298f8fea,
+       0x0ee4fb2d, 0x5a5d0225, 0x3fa2158e, 0x57e2f751, 0xcfafea32, 0xe0d8175e,
+       0xdcf8088c, 0x62ec907c, 0x51d113c4, 0xdd1f53a3, 0x0157dac2, 0xeabf505d,
+       0xff7f0a74, 0xc7fe9a2f, 0xc4399cfe, 0x86bcafcf, 0xb67f28fb, 0x25fe70b8,
+       0xc0e83caf, 0xaa929c79, 0xdb3f5f39, 0x7186e890, 0x44becc4b, 0xbcfe4a95,
+       0x121fb9e4, 0xf23e2dbf, 0x7f8a44c3, 0x89b27730, 0x325f056c, 0xa6d16fce,
+       0x62bf34d9, 0x2bbe25e6, 0xe0f45679, 0x8959e0fe, 0x4111df4d, 0xae24522e,
+       0x5b354f8f, 0xa7654d70, 0x7dc0e170, 0xff45b785, 0x2dff8a56, 0x0fcaf8a5,
+       0xb620fdf5, 0xad67ea8c, 0x885f4e9c, 0xac1abefa, 0xbafca13c, 0xd23b7565,
+       0xf710f4e7, 0x571b8c60, 0xe1a7c931, 0xfd08b843, 0x0da6478a, 0x4e61f4e6,
+       0x0efb4f29, 0x7c14fdf4, 0xcddbed8e, 0xe1ae5b6e, 0x2331763b, 0x6d72fe38,
+       0x0a3b807c, 0x8953d5ed, 0x9845ff60, 0xafa4a15f, 0x85576037, 0x7c8857f0,
+       0xf2df7973, 0x5d6f9708, 0xa633fdde, 0xbebffbe3, 0xbf07e5c3, 0xe0057b43,
+       0xf7a60c0a, 0xa40966fb, 0x102c2c0f, 0x98b7ae49, 0xbe36b935, 0xe004f9d7,
+       0xeddd7096, 0x3fec17e3, 0x764ff08e, 0xf87af16c, 0x565f442e, 0xfe8e78e1,
+       0xbb72e9fd, 0x04ff9358, 0x6cff28c9, 0x81fb9713, 0x8f1f09fd, 0xbffd984b,
+       0x15e50678, 0xaff713e4, 0x7b365fcb, 0x6f9fde70, 0xbddef03f, 0xb79fa720,
+       0xd46a72e8, 0x5a72e19f, 0x8b0273b2, 0x639fa724, 0x3924421a, 0xe511e785,
+       0x3e20e954, 0x4fe947fe, 0x85377f1d, 0x87d74fe1, 0x5c31e103, 0x7459fe1f,
+       0xf087d446, 0xd7961de7, 0xbe74ff9f, 0xf4adf9d3, 0x29431597, 0xa5f3a63e,
+       0x7c7d77ce, 0xbf5df3a9, 0x7f01a378, 0x182defe1, 0x3cb80183, 0x4714cdbb,
+       0xf7c3df28, 0x43bbe17f, 0x4f09e3a9, 0x58c65a6e, 0xf8d4a1d3, 0xac3fbad0,
+       0xded612de, 0x84f7561d, 0xd586f7b5, 0xcbed0dab, 0x3cc80edb, 0x686025af,
+       0x8678ae27, 0x1228327d, 0x5fb9fabf, 0xec85fada, 0x7a50be43, 0x4af37be9,
+       0x3c63b3e6, 0xf148af7c, 0xf1c01e91, 0x67a7182a, 0xf31f867b, 0x3c6c1a24,
+       0xf6a3d4ee, 0x6c5ed03a, 0xdef5e588, 0xea157904, 0xaf79fd3d, 0x7af5c78d,
+       0xd88ebd3c, 0xd8edfb10, 0x76f4911e, 0x8f4d9f87, 0x8ac267e4, 0xc1d47242,
+       0xe3cf7a06, 0x2544d3fd, 0x5fc6057d, 0x8617449a, 0xef6a8a74, 0x419e6071,
+       0x3bac9ecf, 0x45f3c0e7, 0x8db48a6f, 0x7b7683d8, 0x2dc7920c, 0x77f88725,
+       0x53df329f, 0xbf7e3193, 0x4579fb87, 0x11ecc36b, 0xa9f896b6, 0xa32e5958,
+       0xecbf053e, 0x82ff71b8, 0xd6a945cb, 0xe326c95f, 0xdc7bfd7b, 0xbdfb45c1,
+       0xbdf18b74, 0x34078b57, 0x863272eb, 0x71fcd18d, 0xf4d28f1e, 0xe73134f2,
+       0x8f4039ce, 0xc322c39e, 0x7b33fbfd, 0x99c7a244, 0x9ebf7ced, 0x23d7f6e2,
+       0x3e92f77f, 0x89d4f1d4, 0xac0f24f2, 0xfd5f3aaf, 0x9187bcaf, 0x987d766f,
+       0x3b2833fb, 0xfd907d77, 0xe6ffac5b, 0x590ff4fd, 0x5e53f6ff, 0x493ed1b7,
+       0xe276ebcf, 0x7fbd9ef7, 0xeb187f4c, 0x9f142dbb, 0xabfd79ee, 0x9e9fe45c,
+       0xd4129695, 0x80433d77, 0xec1f68fe, 0x83b72afd, 0xa27ad7d6, 0x99251fdb,
+       0xfe7b47db, 0x8f10b1f6, 0xed0acc25, 0x49a3d786, 0xb35eaa9e, 0x67ad3c51,
+       0xa17957ef, 0x9d77ff76, 0x7fb6a54f, 0x736763d9, 0xb17c2276, 0xeaa7df7c,
+       0x5f3fd7b7, 0xad17f98b, 0xf085e4fb, 0xbeefca7e, 0xda3d45c9, 0x43db93b3,
+       0xe78ee6dd, 0x68ee7f70, 0x6695dcfd, 0x0a3773c0, 0x9bac0a55, 0xa014cf0d,
+       0xcbc7f4dc, 0xbc271437, 0xfcf47c52, 0xc10f835f, 0xdd9df5cd, 0xde70156f,
+       0x21fc7f5f, 0x2dd785ea, 0x7cfa97c4, 0x25a96f3f, 0xf372e57b, 0x9c799876,
+       0x799dffe4, 0x992b810b, 0x3ff328f7, 0x2d7fbd37, 0xe12e8939, 0xcf9fd072,
+       0xf5443ef7, 0x822eed97, 0xfdf90af7, 0xf9f27ff6, 0xefba6b7f, 0x2e3bba04,
+       0x7ff2ef3f, 0x4c0f79f2, 0xd7ef37f7, 0x7e62aee8, 0xbeefd54b, 0xadbef821,
+       0x4ffb5b9e, 0xcd03ef2e, 0xd7ebb75f, 0x994d5c98, 0xaf439f18, 0xc569d601,
+       0xc311b33e, 0xcc466b85, 0x14ced154, 0xf52bf6c3, 0xfb99af72, 0x5bee224d,
+       0x086f9c62, 0xcd31f38f, 0x3d2da28f, 0x8a525a18, 0x94958ec9, 0x96bedc55,
+       0xc06eed5c, 0x176b9acb, 0x887728b8, 0xc5ea3d8d, 0x1764da7a, 0xfcc3afc5,
+       0xb9817ac9, 0xa56fb005, 0x8c396f6b, 0x84798dfe, 0xa5c96029, 0xab9618f2,
+       0x59a4b8b5, 0x8f7e0d95, 0xdbac6392, 0x45bac69c, 0x38cacfeb, 0xe624d6fc,
+       0x38b4f8c7, 0x798abf72, 0x8918e26d, 0xb1b75009, 0x17fa1f26, 0xf7e32496,
+       0x1ec0311b, 0x5abdcf12, 0xe1f6f63c, 0x1bbb6c71, 0x44d238f1, 0x2e4a6b71,
+       0xfcb8bc25, 0x8d9e786b, 0x55d788d5, 0x094f88ed, 0x7f6e5ffd, 0x34ccdf91,
+       0xbad2597f, 0xdc984690, 0xcd3b6336, 0x9d2cbe4f, 0xcbd25d38, 0x332d3a35,
+       0x43a745d0, 0xe818fa04, 0xdbf9e3a2, 0x2e9c27d2, 0x6fdff8e1, 0x07fe1276,
+       0x974e97a2, 0x50cdc534, 0xbf9acd5e, 0x49fd1530, 0x1879a7ac, 0xfe6b33ed,
+       0x66ef1482, 0xea93a43e, 0xf42f4862, 0xb7e002db, 0xf3fb7efd, 0x7aea2714,
+       0x081dd8e9, 0x456fd94f, 0x75fc0566, 0x00b3b76f, 0x65f92f7e, 0x5b4b43f4,
+       0x33fb8a45, 0x57779029, 0x6eafbec8, 0xcafd97f7, 0xdd29f34e, 0x06dff169,
+       0xfaee97df, 0xb0ec9724, 0xd7e4bd95, 0x38125ef8, 0xb91d7ddd, 0x2a5bafb8,
+       0x9c23ff71, 0x9e65625f, 0x3bb9d027, 0x6dc60e7a, 0xdf3c6d84, 0x1ee5b4b6,
+       0x7f90c5b3, 0x91dbd666, 0x28bdf05e, 0xc213be50, 0xa9e79a17, 0x2f9d1dfb,
+       0x36be1c0a, 0x76f31fb3, 0xe8edb74b, 0xe953f8c6, 0xc30b8b51, 0xbedb55d2,
+       0x298dfda0, 0xd1d97abf, 0x68b6fe41, 0xf3f43f88, 0xc489b7fb, 0x15ad951f,
+       0x9d4087e4, 0x25b2a2f8, 0x72ebfc72, 0xafd969fe, 0x01f2eef6, 0xfd7ecb0a,
+       0x5be30382, 0x3ab7dba7, 0x76dfffc8, 0x3f5bb8e9, 0x91e5bf3f, 0xa7f9fa4b,
+       0xbfe01ff1, 0xc58720dc, 0x220db649, 0xcbe0047f, 0xadef948b, 0xcbd95bf3,
+       0x38c39f67, 0xcfcee774, 0xcb78439f, 0xe7cbfbff, 0xaf609fd0, 0x88add4db,
+       0xa5de9797, 0xddfe9e38, 0x9dc7992c, 0x817c5fbb, 0x1fdd9fe2, 0x7f01df80,
+       0x4a9ef7ba, 0x7bb27f47, 0x1889d7c7, 0x77be592f, 0xef9c60da, 0x0ca757f2,
+       0x88f41166, 0xfadf225e, 0x1afe20af, 0xad03af4e, 0xe9efc807, 0xdfa37a02,
+       0x69b717d9, 0x3071e0a9, 0xd9af16a7, 0xddce391e, 0x7ad33e2f, 0x8d379dd7,
+       0x72ecd2c7, 0xd3882bb2, 0x1c7403bc, 0xdbf4057d, 0x7fe688fe, 0x175fa646,
+       0xb4e803fe, 0x677e8c2c, 0xfcfd175b, 0x3ad77c19, 0x4d38c068, 0xa6f00ae0,
+       0x27bfd1c7, 0xa3227fbb, 0x25fced7c, 0x6e90c5c5, 0xbb44c1b7, 0x8e9b3e5f,
+       0x9a9f0ffb, 0xe7e7ef7b, 0xc62a2c32, 0xbef74a1b, 0xfdd3f24f, 0x538a11ea,
+       0xdd9e2d33, 0xf0fefacd, 0x5396a3f8, 0xcec5b559, 0xfe1a3be3, 0x74e3fe31,
+       0xce2d73d0, 0x8f58f9c3, 0xf7140cff, 0xde799569, 0xafdf1e88, 0x16a1f2d8,
+       0x4bd2094f, 0x3a748498, 0x08fdc976, 0xe22a0f1d, 0x1c686261, 0xad7c7233,
+       0xd1adde2f, 0xf187e90b, 0x2538becb, 0x6e30d3d4, 0x67de17e5, 0xf741f411,
+       0xecff1e66, 0xa3ce4736, 0xbf9ae3d2, 0xff53970a, 0x2f33c595, 0xc5b7ff07,
+       0x52765f8f, 0xea78e1bf, 0x8f5910bc, 0x75f32dbf, 0xc5f7aaff, 0xbe4305ca,
+       0x7bc9b941, 0xa2b1f904, 0xcfcc98f5, 0x52f3f0a5, 0xb53b7cfa, 0x97ced1bc,
+       0xad778a44, 0x7a40396a, 0xe85f5c3c, 0xf0e1a6fb, 0xade0d09e, 0x44ebe36c,
+       0x5fbb4ee7, 0xf73a7e81, 0xae7e26ef, 0xe28c7edc, 0xfdb6876d, 0x5908ee5a,
+       0xf09d7157, 0xf9dfc087, 0x1e5cbeca, 0xec79e5b7, 0xd19ce3e1, 0x9ed561f4,
+       0x6d54e3c8, 0x4e30c2ff, 0xe645af99, 0xc7a5fdeb, 0xefb92d3b, 0xb74efec1,
+       0x79e6199b, 0xa7116e9e, 0xf5173a47, 0xea6eb6ae, 0xbd707ee7, 0x23fd7ca4,
+       0xf8cc5cfc, 0x1f28a3b7, 0xe991f97e, 0x63c4c61f, 0xfe878409, 0x9f396b5a,
+       0x9dc4feb6, 0x3d6ef48a, 0xeb88af72, 0x6fc42ed4, 0xf79f9d88, 0x3b14f54e,
+       0x8fbc85e8, 0x5d91e33c, 0xc4cdf5c3, 0xfc0326a3, 0x5c60ce30, 0x1fa1ea07,
+       0xf982a73c, 0xe88f086e, 0xf08e9c28, 0xb549aa88, 0x61e7fd09, 0x5e743c56,
+       0xacd7ef40, 0xb003cf1a, 0xd89ce30b, 0x1e4cd24f, 0x8bbe4c47, 0x3cfd3e97,
+       0xbf94714e, 0xa059e60e, 0xf02cd378, 0x7d7d927d, 0xe78641c6, 0xde5126bf,
+       0x78c59676, 0x554bac6e, 0xdfd0267c, 0x596ce4cf, 0xf949d937, 0x4258d707,
+       0x20580ff3, 0x6f51f917, 0x587defd7, 0x7e1a427e, 0x1a88fd02, 0x7e5a597c,
+       0x21d610c2, 0xc9bd7da0, 0x0e27cfce, 0xf84de255, 0xbd9af3fd, 0xec3f9fa9,
+       0xec315e77, 0xcee5e29c, 0xc94fc627, 0x05d43a5f, 0xcf7ab4fc, 0x8f5fcc14,
+       0x477f27bf, 0x12798aaa, 0xe7829e7f, 0xc85fe257, 0xf50c931f, 0x9c1fab13,
+       0xc8fff54a, 0xf50e931f, 0x8dff1a6f, 0xca04cbd7, 0x3d582d57, 0xebf22a7a,
+       0x2cf9cb55, 0xce5188c0, 0x75bc40ef, 0x7bba3e79, 0x1ff31391, 0x5f8e657a,
+       0x4376c1e6, 0xa5bc7126, 0x40ed1f29, 0x75350d3c, 0xfe7f22d4, 0xb157ef7c,
+       0x4c9c17a8, 0xaca8fc25, 0xc1fa455e, 0x2f1749a3, 0x9e174791, 0x93eba64f,
+       0x01f78acd, 0xf991e384, 0xe05ce823, 0xad332533, 0x98cf5f3c, 0x78d4c0c7,
+       0x469167a2, 0x1ad3844f, 0x58bf8f92, 0x5cfcc9f4, 0xafa6934c, 0x9e38aaa6,
+       0x2f172be0, 0xe1edf75e, 0x4be7507a, 0xc8695ced, 0x1087c679, 0x7de29f5e,
+       0xffd092c8, 0x161de33c, 0x9f7c0acf, 0x1d3e7c5c, 0x9f3f5bf9, 0x91ce7e18,
+       0x48a6bd49, 0x76b35ff6, 0x782071ce, 0x2aef563d, 0x77f3371c, 0x41879dce,
+       0xc91746be, 0x1ccd4c2e, 0x827c62bd, 0x5215cfc4, 0x4695439e, 0x971324bf,
+       0xa310f643, 0x8b1ed67d, 0xb9bf46e0, 0xf49541e7, 0x6dd15a77, 0x44f557e4,
+       0x3e60b467, 0xfcc3cf50, 0x4c66295c, 0xd90d1ca3, 0xbf401313, 0x5ce0e40f,
+       0x339c1c98, 0x71c673ae, 0xdb3a2e7b, 0x553fa83a, 0xb00c0feb, 0xe0b9e0c4,
+       0xe5eb911e, 0xc1271a9e, 0xf6f98431, 0xa57efae1, 0x18b56de3, 0xde02fdcf,
+       0xe8bc405f, 0xc0e5ff78, 0xa3457bf4, 0xe8912bdf, 0x74fe7e17, 0x6bfbc5be,
+       0xf8aa7f6c, 0x15742ad0, 0x869dcfc3, 0x6a4ab5d3, 0x78ae88da, 0x682f9ee2,
+       0x36e9d19d, 0x412b857a, 0xe3a0641a, 0xe8efd8eb, 0x10985f3d, 0x4f7e9d5e,
+       0xfdef900f, 0xcf5f0b07, 0x9c4bc7c2, 0x8de291d3, 0x1060feb4, 0xcf58212e,
+       0xf8d1e6b5, 0xde3c4d83, 0x10bdbfd3, 0x7fd03e71, 0x30f2a5e6, 0x2fde5573,
+       0x50fdffe0, 0xf110ffbe, 0xfe22223f, 0x03bc463f, 0xf6c63ffe, 0x4fff8057,
+       0xdd7f852e, 0xf4d32fae, 0x2bee1942, 0xc5fcff01, 0x13313339, 0x15142dc6,
+       0x5b25ffe2, 0xd21f6d45, 0x62725b7d, 0xb92c8f50, 0x199f7abe, 0xb3c970f8,
+       0x9169f102, 0x73fd5e76, 0x784b5ced, 0x1cf15f5e, 0xcbc9e91f, 0x49f9f7e7,
+       0x336d950f, 0xe410bf3e, 0xc7ca74db, 0x93f3f1f5, 0xe11726a2, 0x68a33ff8,
+       0xd628a2fa, 0x0e9c2ed0, 0x864daa43, 0x29e4f03c, 0x9f90fd7d, 0xbe726497,
+       0x3fb5f14f, 0x07c61998, 0xf8fc52dc, 0xbc63e200, 0xcdfb1530, 0xef56e4d7,
+       0xe30ae86f, 0x33e19f3a, 0x6acbfb9e, 0x1bfb9e34, 0x686294de, 0x4c86cd7f,
+       0xfe91fbc3, 0xafef0d6b, 0x50d636db, 0x8372d51f, 0xb6e8fda1, 0x4c7d4302,
+       0xfb4316e0, 0x1a678771, 0xefda13ea, 0x789fb435, 0xfde18174, 0x86a51df5,
+       0xba7e37f7, 0xa9bf50cc, 0xed0d5ff7, 0x5eb88b03, 0x94935fdc, 0x740ae786,
+       0x2a5fecbc, 0xbe7c549b, 0xe6a4db34, 0x744f3e86, 0xccb1733b, 0x357fa373,
+       0xb14cbc90, 0xae85a726, 0x6cccf9cf, 0xac536bd0, 0x55817ac6, 0xe07497e3,
+       0xcdfe2017, 0xa55ca356, 0x026bcf56, 0x2ca59bb3, 0xd2f94619, 0x58b75f20,
+       0xc5bb7eb9, 0xedfa657a, 0xaa7f6c4e, 0xece74032, 0x444be5c3, 0xd2a2caf9,
+       0xcca9fb47, 0x1b96f945, 0x4d3e466d, 0xccaf401a, 0xc3cf1ab3, 0x9b61ea8b,
+       0xfd139064, 0xd0a8f9f9, 0xdbe2c2e7, 0xa0676f28, 0x05a4e57e, 0x7d016eb7,
+       0xa97b2729, 0x9aaf9fd4, 0x97988a63, 0x3bf590f7, 0xfa1b49fa, 0x210f4fd9,
+       0xde92bb7e, 0xccf30a7e, 0x92f5e72a, 0x316c94bf, 0x775825e2, 0x5479e60d,
+       0x508e7e4e, 0x54dcffe5, 0xae2b78d3, 0x173cfaf7, 0x1133307d, 0x06d203f3,
+       0xd55e9ff0, 0x4d5cf1e6, 0xc345adc9, 0x14d53fb0, 0x7a45bf7a, 0xfd10aaa0,
+       0x1e5aa198, 0xc8a653f4, 0xd53f4af9, 0x0a8c19fa, 0x5503ed14, 0xaba0fb21,
+       0x048723f8, 0x9377f8f3, 0x17c8a7f7, 0xe7b7460b, 0x6ecb73f1, 0xabb24cd7,
+       0xd75f8254, 0xe78ae943, 0xe92bd429, 0x66731249, 0xf06787f4, 0x06636f3c,
+       0x338fafbc, 0xf7aa14b9, 0xe59e380a, 0x820d8cc7, 0x5bffeaf1, 0xf7eaf824,
+       0x3cf94f5f, 0xe29aa516, 0x993cfaa7, 0xc7afdfb6, 0xcd26cf8b, 0xd63c418a,
+       0x6e77db5f, 0xacfd6187, 0x7ec76de2, 0xd337aecf, 0x8205f5b8, 0x6f3ebde1,
+       0x741dc369, 0xe15d2b1e, 0x79862ef3, 0x3496dc23, 0x73fd570e, 0xb8234b02,
+       0x43d2f7fe, 0x8aecbfe8, 0x0dbc6176, 0xe889b1f0, 0x6738ceed, 0xf30f27d2,
+       0x34a418aa, 0x25fb21af, 0x96fa1fb2, 0x4cdbaf95, 0xf688959d, 0x4635f254,
+       0x66f5c5b8, 0xc51707f2, 0xe0af942a, 0xd1a159af, 0x55ef38d5, 0x9cef3349,
+       0xbdd4f00b, 0xfd4c3223, 0x2d347671, 0x15df043d, 0xfcbb46b7, 0xef78fece,
+       0x01387272, 0x6e10b7ee, 0xcd214371, 0xdc21da9b, 0x33d8173f, 0xde77c819,
+       0x14ff44e9, 0x977dc313, 0xd3fff870, 0xefc4e3ca, 0x879a5558, 0xeb7c549c,
+       0x16584196, 0xb51ddc91, 0x7fceb80e, 0xfcebe568, 0xeb08d687, 0xfdeee5fc,
+       0x7ed39f28, 0x6dd14b08, 0xeadaecd2, 0x197b50ec, 0xec49d6f4, 0x318baf57,
+       0x7ec5ce3f, 0x3ccbb607, 0x9719d94d, 0x1ed0cbb7, 0xedd3fe43, 0x8d5abfb1,
+       0x9e886476, 0xb3d34afd, 0x9ea15d5f, 0x4eed80bd, 0x68881bdd, 0x91c824c7,
+       0x1b38dcf5, 0x2a957fc7, 0x1be3ca33, 0x6d9f9e20, 0x0e1f6c8b, 0xce5d0eb4,
+       0xd68cc8cf, 0xefd754f9, 0xc560dfdc, 0x9c2fed32, 0x247fe0d9, 0xe329f71b,
+       0xedde5187, 0xaea4fd40, 0xf10d83f8, 0x886de3ab, 0xc04f88cd, 0xf9c6d3a3,
+       0x648b69c4, 0x1e03960f, 0x0e3c064d, 0xd903f6c7, 0xdfad5783, 0x6ee78c4b,
+       0x837c35ba, 0xbc71979e, 0xce3ebbae, 0xe545b8c3, 0xe7a473ec, 0x399c7aaf,
+       0xf74475c6, 0x011c61bf, 0xd77ddfe7, 0xb7716b7f, 0xd5178a0e, 0x0c4d7abd,
+       0x0a2aa7c6, 0x9586f4fa, 0xa49985db, 0x5976bb07, 0x576708dc, 0xece7cf1c,
+       0x10f135da, 0xaf3e39c6, 0x85299c39, 0xaf5d2dd8, 0x4333c91c, 0x8f3b5d7f,
+       0x209449e4, 0xd17e27e7, 0xfc5c57df, 0x128f3ccf, 0xc7d0273c, 0x0ebe566f,
+       0xf8f1b7ad, 0xc798d3c9, 0xf7b19a36, 0xfaf963a3, 0x1c7a6891, 0xe3bf479f,
+       0x7f7ea1f3, 0xc7e57054, 0xdd262b00, 0xab664c55, 0x00a68de5, 0x6e0a8f96,
+       0xbe55e311, 0x4d3cfc91, 0x911b1652, 0x4728fd01, 0x8e0803db, 0x8dd7a3a3,
+       0xa7ea29db, 0x0b2c3eea, 0xc402ef14, 0x2baf5c7b, 0x37fc7d09, 0xa1b38d87,
+       0xe14d215f, 0x7e77b77a, 0x29ef1f94, 0x8fb9344a, 0x6767aa80, 0xc58c2f0e,
+       0xe68b7ff7, 0xd258f2f2, 0x8e5c2689, 0x38a03970, 0x5a669bd4, 0x710d96df,
+       0xef822f27, 0xe7884d97, 0x9805e97e, 0x9639c87d, 0x0967e3c7, 0x00b90714,
+       0x14e78178, 0xb53e02fa, 0x3317cc4b, 0x89b0f416, 0x0bf055b9, 0xee4293ec,
+       0x68ffc1d9, 0x4d60fc76, 0x4d38f6ff, 0x45e0333e, 0xd5db1976, 0x5c0cee09,
+       0xfc81774f, 0xb4fa030d, 0x7ca958d5, 0x184d46ad, 0xa7b8f206, 0xafea8926,
+       0x0ca938d7, 0xe7a08cd4, 0x545c6bfb, 0xa7b5368f, 0x552c7ad3, 0xfe879baf,
+       0x0b12fdf5, 0xbc23b7bd, 0x8e567bc4, 0x97f9c887, 0x0093e62e, 0x3d352fae,
+       0x38d6fb52, 0xc6a7afe2, 0xfd31d400, 0x8ad9ffbf, 0x054d643f, 0xa3fa983d,
+       0x415359c3, 0x78129f8e, 0x181e02fe, 0x552e748e, 0xb7329f2f, 0xf0a9a2c4,
+       0x4df31b6b, 0xc8bcc24d, 0x8e153fde, 0xe8f6cc61, 0x1d4ea69f, 0xfdc7f309,
+       0xf6c614fe, 0xc7abdeda, 0xfba9d873, 0x818bab3f, 0xfc6dc8f9, 0x82899f3e,
+       0x7d4056a7, 0x0bf39b33, 0x98b53c93, 0x3773d9cf, 0xbefee273, 0x1b5ece3e,
+       0xdb7613b7, 0x51399db8, 0xe6c1fce0, 0x411e5aca, 0xbae86e6f, 0xef3ede11,
+       0x8f74d7c0, 0x2fb78c0f, 0x2f5e30d5, 0xfa0711c5, 0xd7ff752e, 0xe95c8eb4,
+       0x491f3d77, 0xc4847cfc, 0xe6ba2bf3, 0xfda66e26, 0xba1f6878, 0x4723da8f,
+       0xd2ded7b6, 0xed0681d6, 0x659fb7be, 0xa68372f0, 0xf5c62457, 0x05d16bff,
+       0x61b947bf, 0x5fda38de, 0x09e2d3aa, 0xe57a3a93, 0x2f7e76f9, 0x13d43e5c,
+       0x3c04784e, 0xd1a5d70f, 0x1e605533, 0x6048ffcc, 0x28028433, 0xdbcf36dd,
+       0xc2d24fd8, 0xd197be4d, 0x7165d85e, 0xe3a3d9a2, 0xd903eeab, 0x6121fa8a,
+       0x8fda31cf, 0x643a13aa, 0x8f97f7a4, 0xcb714d7c, 0x3275733a, 0x1b176dd5,
+       0xbdb4feb0, 0x99d6237a, 0x6fa9ebef, 0xd60c3f00, 0x13e3e1ce, 0x90bb63d4,
+       0x3b5829e8, 0x7e06ef57, 0xf5e665d8, 0x4b391f2f, 0x5ccbb1fc, 0xe18d9f3d,
+       0xef987af5, 0xaa6f58ae, 0x52905409, 0xe1fd65fb, 0xb7aeb09b, 0x77da92ff,
+       0x3f6e54db, 0xa40cde2a, 0x855d5f7f, 0x2ea43dba, 0xf2b33af1, 0xc55f9f52,
+       0x7f29af81, 0xe70f72b8, 0xce1bc447, 0xc3cdef13, 0x7a8ce975, 0xa4eb51d4,
+       0xd73673b8, 0x9f0301d7, 0xb753e7e9, 0x2a2cbc98, 0x085ecf44, 0xce42ff5b,
+       0x84a8b1d9, 0x38b4fe90, 0xbb033a76, 0x6f182b34, 0x2a2e64cd, 0x950f3187,
+       0xee96dbd9, 0xbb2db447, 0x7a89d5af, 0xfad73e2b, 0x68e89780, 0xd09e1ff4,
+       0xe8fae2f4, 0x01a31bfc, 0x7782f59e, 0xf17a888d, 0xe74ab365, 0xb2243a2f,
+       0x35b53b37, 0x5330ad8c, 0xf73b5cbd, 0x5de95e6d, 0xeef51233, 0x19ab9322,
+       0x4f0cb3d7, 0x2fbe19be, 0xaae19ddb, 0xe7bcc165, 0xc496d8b2, 0xef304ab1,
+       0xaa3faf59, 0xb546d9f1, 0xd2f786c9, 0x9543fbe8, 0x71d2eb6d, 0x7db3fb7f,
+       0xbd3c901f, 0x7c41951f, 0x447ad15c, 0xbf69daf6, 0x29f3c64c, 0xd6fad99f,
+       0xbef75a3f, 0x0b74196c, 0xeb2ff5ea, 0x79b8744d, 0x06f43d20, 0x38373fe8,
+       0xac6a87c8, 0x5dc2fe54, 0xde9a2d7d, 0xd3295105, 0xbfb4606c, 0x9156e990,
+       0xb9ade68f, 0x7c0ac1a6, 0x8eac82f4, 0x179b3e44, 0x5b7c4b95, 0xbe722b16,
+       0xdd07b964, 0x0dcfb692, 0x6535d4f5, 0x3c53bed3, 0x6f68c8be, 0x88526d54,
+       0xc80ec00f, 0xdca83e47, 0x7ee1f260, 0x4edac9a2, 0x45e77de7, 0x368fcd31,
+       0xaf5c4f9e, 0x6cdf3be9, 0xdcbddf1e, 0xf392c539, 0x511e7451, 0xe51fbfaf,
+       0x9128be24, 0x55ffb47c, 0xe741de72, 0x38fbbf18, 0xc879c356, 0x0428e3fe,
+       0x794e3e87, 0x57d21c70, 0x27ec1fe5, 0x6b8df83f, 0x4dd67b75, 0x3be5ac71,
+       0x9b05fcb4, 0xf3f6307b, 0x1827a6b4, 0x7780b1fa, 0xeeafa329, 0x1ccf4093,
+       0xf933d3ec, 0x90d3530d, 0x6cf7c1be, 0xb90f4192, 0xc1d3a025, 0xfbeead28,
+       0x51f6e47e, 0xf533ed61, 0xa986ccfa, 0xf3c3fb93, 0xb7582db4, 0x1be97b42,
+       0xe11d5f4b, 0xa1f573a3, 0xe3e9c5fd, 0xe9fd4bdf, 0xb51a97fc, 0xf80fa0f0,
+       0x27ac60ef, 0x7a7cf31f, 0xca273367, 0x8d4966e1, 0x21d08572, 0x37af8a35,
+       0x35afe725, 0xf7883fe0, 0x4ffd035c, 0xfb0d38d5, 0x968b8b8a, 0x549879d1,
+       0xc7cc5e9d, 0xca6d77cf, 0xfe27ec32, 0x16ae387f, 0x7000f70e, 0xc307fd4c,
+       0x5e30c231, 0x031c8e10, 0x870b577c, 0x7a6b3b18, 0x8f6bda06, 0x280f2898,
+       0x66b3e4d1, 0x6ff65da2, 0x0ca78a26, 0x880f3c67, 0xfb0de329, 0x2c7b99b4,
+       0x9efe31f3, 0xd2c3b129, 0xb7279458, 0xa9d716b3, 0x5f64489f, 0x39ab73c1,
+       0x726e870e, 0x204ffde3, 0x665fd495, 0x1f82b7b9, 0x82fbe6f2, 0x70d33efa,
+       0xbde3e595, 0xe7a39ba0, 0xfb8d18df, 0xaa1e7366, 0xe7983cc2, 0x352ff195,
+       0x92bc8330, 0x2c20d21d, 0xabe33b25, 0x701b87a8, 0x147076bf, 0xf6045bb7,
+       0xe4e1c370, 0xbcb9ef48, 0xf0f35b9e, 0x341b8c34, 0x8b5e74af, 0xcdb353fe,
+       0xf31fb2df, 0xe8531e76, 0x47acd6de, 0x50998dfd, 0x6899d717, 0xfd6314bd,
+       0xdf719adb, 0x176cc9fd, 0x68cd11da, 0x47fb60bf, 0x566bf214, 0xf0d338d5,
+       0x6d3a927e, 0x76b2d81d, 0xc1798ab2, 0x87148af5, 0x732addeb, 0x773c5cf5,
+       0x8dd1ee31, 0x51ebd60d, 0x071ab98f, 0x949ebca9, 0x339aeb8c, 0x7b463ad3,
+       0xae68c80f, 0xb1a8a675, 0x6ff0fac1, 0x3d20fac0, 0x9dc1b1b3, 0x2b2efd86,
+       0x883bfad5, 0xe2178a71, 0xef68bc34, 0xd2f4fb33, 0xcbcc06c6, 0xf5836b12,
+       0xaddf30a9, 0x353d72cf, 0xfb47fa18, 0xc3e3e60b, 0x877b057b, 0xca4e744b,
+       0x603b6306, 0x9991b67e, 0x0cd7dfb4, 0x2bef117a, 0xdfc91dee, 0xf234fbeb,
+       0xd3ed1370, 0x6f5c7b60, 0xbdbcc96c, 0x57df833c, 0x8a15db20, 0x307ac037,
+       0x149ef315, 0xf371ffa6, 0x8fb6a4b8, 0x01f78511, 0x75a3f084, 0xf73a32ed,
+       0xdc661d69, 0x8cd3979f, 0x16798975, 0xaa27bfa0, 0x4637e7c6, 0x8341f96b,
+       0x6dda0a58, 0x133e4dc3, 0xfcc91bb6, 0x02c75e54, 0x628d8f64, 0x8d1f541d,
+       0x1e16635e, 0x41d2725b, 0x2dcc71ab, 0x47aa38f2, 0x71313b44, 0xf2471eae,
+       0x74be414e, 0x61766b47, 0x7e3fef0a, 0xf7ca2cc6, 0xcdef69f5, 0x313d8633,
+       0x7eb5e60d, 0x50ceddc6, 0x2f5f4efb, 0x48adfb75, 0x68cbf983, 0xa0bda221,
+       0x364575db, 0xe5984f5e, 0xc6147a7e, 0x26cddb11, 0x58ad9fbc, 0x6f16638b,
+       0xbb444fc8, 0x5cdf68ac, 0x44d787b2, 0xd16cbb73, 0x77b219fa, 0x9af79e14,
+       0xfe7f764f, 0x183109ba, 0xb9b06fa7, 0xfe47ae62, 0xdfbf23fd, 0xb1ed4af5,
+       0x0a6bc4e6, 0xc19b1e50, 0x8ffbc6af, 0xcadd9a0e, 0x758be418, 0x6ccec8c3,
+       0xc7d6f28e, 0xffcdbf42, 0x41d574ea, 0xf73667fd, 0x4e3823f8, 0x8f7f1443,
+       0x6f2126f7, 0x3ff7edf6, 0x1e8c5c2f, 0xfdf0fc78, 0x91b183fe, 0x43bdf1ef,
+       0xfed05fc3, 0xd9dd90f0, 0xdcc4f660, 0xcbbdf087, 0xead679e7, 0x112f5189,
+       0x86b4fb67, 0xd67603e7, 0xe64058b8, 0xbd62d1f7, 0xdd3f68a4, 0x22d25caf,
+       0x097cdc50, 0x3a3d226b, 0xeed5894c, 0xc5e631a7, 0x4dbd1696, 0x795b4bed,
+       0x42d632fb, 0xe17a75ed, 0x8301b5bd, 0xf0ce3a1d, 0xdcd11dfd, 0x78acdd6f,
+       0xfffb431f, 0xc4d91991, 0x1167c04f, 0x07e22df3, 0x31b977d8, 0x371faf9a,
+       0xf6c8db62, 0xb863f128, 0xe05cb87d, 0xc207b3e7, 0x9379d553, 0xde0a3d61,
+       0x7ad3219f, 0x49f9add4, 0xeb7c9387, 0x7ff9846f, 0x244af59f, 0x23bddaa7,
+       0x425f8275, 0x33befaf9, 0x2d1bdeec, 0xa6ba680f, 0xcb43fe25, 0x6b3ef9ef,
+       0xfd0dc379, 0xf402cedc, 0x9eed61dd, 0x48a41412, 0xafd01979, 0x3adc1f41,
+       0xddbf58c2, 0x39dfac65, 0x7d3df229, 0xb4d46b6b, 0xd6aa7bd0, 0xf38e700e,
+       0x575e8d2d, 0x0b12df7f, 0x0b7bebcf, 0xf9815ee9, 0xc17fb494, 0x1b14faf3,
+       0xd91ea0f3, 0xfb46cfbf, 0xbc8a5521, 0x55164319, 0xbde2efe0, 0x9f9d8af0,
+       0x17ff4037, 0x998a05e3, 0x97de0fb7, 0x1251f7c4, 0x3c5a493c, 0x633495c3,
+       0x1b87b7d4, 0x0bca2afd, 0xdc46d896, 0x27e60d77, 0xe8edef1a, 0x0f38fe8a,
+       0xcf9863fd, 0xe84f8c6c, 0x3e7d5a71, 0x2c7f28ff, 0x39cfbb5a, 0x346b6e9c,
+       0xa30ba8f9, 0x39d23d73, 0xb973df07, 0x87bb52f9, 0x43c129ff, 0x26896879,
+       0xb3ac171e, 0x9c528eb9, 0xea0ff344, 0xf306b8b4, 0x56ef5d7d, 0x1095ecc2,
+       0xed7d22ff, 0x39f5f5d7, 0x38f377e4, 0x156a2d88, 0x360dc3ae, 0xfaa66ebd,
+       0x00a6e6d3, 0x5aaffdf9, 0x831f189c, 0x6718ddef, 0x411dcdf3, 0x065d5d7e,
+       0x0e7bc14b, 0xb4cbb0de, 0x6abdd6fe, 0xd8f5c669, 0xdb76f36d, 0xba49f242,
+       0xf9d1efec, 0xf9fd08a6, 0xf90dfd0c, 0xf8c1fd76, 0xfd7788ad, 0xa7f61bfd,
+       0xceff2202, 0x691bf949, 0xa17b1fed, 0x42cbb89e, 0xf7fd4f71, 0xe7cfca0f,
+       0x7a8cfdd1, 0x4e14137f, 0xd51ace87, 0x8e5d8f90, 0xe507377a, 0x67f49da0,
+       0x8320cb45, 0x69f5d4de, 0x681bf9c5, 0x57482cbf, 0xb5212e2d, 0x38aa5e93,
+       0xbc68bfff, 0x349e903b, 0xf7e9124e, 0x3549c781, 0x38e0e3e8, 0xf7700c93,
+       0xc132671f, 0xdac38fa1, 0x9fe70ca2, 0xae3ccceb, 0x33986672, 0x1e823626,
+       0x83714bd1, 0x60ff70c9, 0x62b2e49d, 0x4eca75ff, 0x287f3435, 0xef005f7c,
+       0xf02164c5, 0x867ac1d5, 0xf30b72c1, 0x3d405e52, 0x072213f6, 0x62a5d9a2,
+       0xf8c262bf, 0xc62ef9e9, 0xbdb945fe, 0x33727d10, 0x8bd82df2, 0x7e3b583f,
+       0x49ec0f95, 0x4769ecc9, 0x93764aba, 0x6b68f313, 0x45c51315, 0x64ac92eb,
+       0xca12adff, 0xbd739455, 0x2243a95f, 0x8f7df438, 0x9f29e681, 0xc33cd077,
+       0x9ffb3bef, 0x76a14f1b, 0x3b57eefd, 0x0f93d730, 0x93545bfd, 0x4e5d450b,
+       0x2127d853, 0x47ef0ff4, 0xec4520da, 0x8e9dbc27, 0x6ce901ff, 0x3d2070ee,
+       0x88a5e3ba, 0x951b1079, 0x310798ef, 0x271f4c2f, 0xe00ecd1c, 0x238742f7,
+       0xe5f48323, 0xa5f50546, 0xdc9fccfd, 0xb4cbd24e, 0x7fafadef, 0x56a984e6,
+       0xbc6c4f9e, 0xfe206f57, 0x7d62f1d3, 0xf3c641f3, 0x7f94bd53, 0x483c3972,
+       0xfb43cb82, 0xe2297600, 0x425836be, 0x4938fc86, 0x354fe631, 0x63e21e48,
+       0x56d54df3, 0x5b4927da, 0x927dc569, 0x063392d5, 0x37ded8fd, 0xf983fec1,
+       0xbe793a35, 0x6bff786a, 0xb4661ef0, 0xc4531573, 0x06a379fb, 0x34baafb0,
+       0x77d9acfa, 0xf501fe69, 0x3775c1e1, 0x71524e2a, 0x399b35dd, 0x4bad03bc,
+       0xe103bf7a, 0xfc7dd1eb, 0x392c1bf7, 0xffae3f56, 0x4a35e3e1, 0xbc3e4f1e,
+       0x7078046f, 0xcd31acdf, 0x546df84d, 0xd5fd1525, 0xcc5111e8, 0x656fea1a,
+       0x67f7a2cc, 0xccf1e3e2, 0x8f8c6b22, 0xe3a3979c, 0x1df2b769, 0x186f1ded,
+       0x8f7f0e5f, 0x7c21e8e2, 0xe84ca9d9, 0x91bb97cf, 0xfc381317, 0x5aa6f7a1,
+       0xbc458633, 0x7f1fb27f, 0xde4df186, 0xf7e74664, 0x19b94306, 0xeed56efa,
+       0xb5c0aa43, 0xf2f4fc0b, 0xc2a6147b, 0xe477e6fa, 0xc939405f, 0xcfcfdf6b,
+       0xf026b4d1, 0xefb51e7b, 0x625dc7c3, 0x12c8fee7, 0xcc654abb, 0xf12ff751,
+       0xdb5a37f7, 0x5e789ca3, 0xb22e35b1, 0xd763931f, 0xb49a68f3, 0xb41d0873,
+       0xcfb7a14f, 0xcddcc79b, 0x1b3dc50a, 0x257fe0ad, 0xa9ffb5f4, 0x82023fb6,
+       0xf9dce30b, 0xf99aebdb, 0x7f3e51f9, 0xfb62ab8c, 0x5c8ec4c4, 0x740efc41,
+       0xf70cc6db, 0x3b5855db, 0xe7ce51b2, 0x7699bc9a, 0x68eaa718, 0x5bd62247,
+       0x4e9d3edf, 0xb71d6f7e, 0x47777b37, 0x3fa0dc53, 0x79f96a7d, 0xcc29f3f2,
+       0xdd3fa837, 0xad00a5ca, 0xd3e7e5ab, 0xcd1c6f99, 0x0b8d67db, 0xc2d3bfbe,
+       0xc8b1a4d8, 0x884f1c00, 0x30f4489f, 0x7a064ddb, 0x675e3c80, 0x7881e8d7,
+       0x76b7a3ea, 0x76a74bef, 0xcd71e0bf, 0xf72a615f, 0xa5fbf5d7, 0xe5f7678e,
+       0x5b7dd05b, 0x13f736e5, 0x3b0b4f78, 0xe6be5222, 0xfefc29c2, 0x771685c4,
+       0x0b57da0c, 0x6a1453ff, 0xf3937f69, 0x7f0d22fd, 0xf745cc9d, 0xdad6f80e,
+       0x984ebef8, 0x54f1967f, 0xc23fb8fe, 0x44da8bf7, 0x305f1bca, 0xbf61f145,
+       0xbf05ed79, 0xe2f9fdc4, 0x773a68c6, 0xae7bf0be, 0x2dd76893, 0xc4e6c27c,
+       0xfe597bdf, 0x327e6641, 0xc9fcbbf4, 0xdf07d50c, 0x24f0af45, 0x27a05d59,
+       0x8853db1f, 0x3083457e, 0x0630be7f, 0x0ec7cafc, 0x98b8c2ac, 0xcf94cdf4,
+       0xf47f506d, 0x615677b1, 0x18b7e9bc, 0xf63b26e7, 0x63b442dd, 0xf4d0425f,
+       0xc1c03ffd, 0x5a4d874b, 0xa9aac4fd, 0x4daff2a0, 0x2a293568, 0x562765fa,
+       0xc4d939e1, 0x1318f738, 0xfd8ef78c, 0x6fec42b3, 0xcea313c1, 0xe7f7806d,
+       0xbec817ed, 0xdf693a00, 0x014f370b, 0xb278bbbb, 0x582d975e, 0x86668f8f,
+       0x3339be38, 0xd9da3e38, 0x8b7c7aad, 0x718cdd45, 0xd505e3f7, 0x3fe82453,
+       0xceaea1c3, 0xc4d8c919, 0x1baaf9f5, 0xc476cfc6, 0x98f18cdd, 0x837dbed6,
+       0x1f18d5f8, 0x03de656b, 0xd37f7866, 0xb66e43e3, 0x07e36202, 0x30a8c679,
+       0x29d641ff, 0xf4dfa7ab, 0x4463e41d, 0x0d59f3bf, 0x939204f6, 0xf4d28843,
+       0xc2defc15, 0xe34ef93e, 0x1f57db7c, 0xc3cfc1d1, 0x5e24f5e8, 0x59195d6f,
+       0xc312dc5f, 0x2a35baf9, 0x4d66fbf2, 0x03be003f, 0x8b6d7f14, 0x08cf0ff6,
+       0x1f900fea, 0xa79224eb, 0x807f5c75, 0x93b4cd1c, 0xefec46dc, 0xab6bcadb,
+       0xab79af76, 0xf8c68ee4, 0x30c7ae82, 0xcce38682, 0xfa0d3bb5, 0x017daf39,
+       0x3151d7e9, 0xc9c7872a, 0xc53093f1, 0xb59847a8, 0xdf743b3d, 0x3cda77fe,
+       0xe3d3ae33, 0x7439013f, 0x8ef969df, 0x9f9e4bfc, 0x7f38c72d, 0x9c1dbd88,
+       0x678a54c7, 0xfa17ebf4, 0xbbfd6a73, 0x5f04ae72, 0x15f065ea, 0xdcbaf84f,
+       0x19fd833c, 0xfbfd2fe3, 0xc17db593, 0x223ae326, 0xa4f38647, 0x7f8027ce,
+       0x2cfe8853, 0x9ea9f4d6, 0x6bbdd107, 0x064fe524, 0x31e7e5c7, 0xc4bfbe81,
+       0x81f25ddf, 0x963d453e, 0xc56fb927, 0x71ed79f6, 0xc0efda2a, 0xbf1af56f,
+       0x3a6fc849, 0xaae35b9d, 0xebbe69f3, 0xfa4bb204, 0x3ada41d9, 0xd024d79a,
+       0x9e0d99ef, 0x87e715e7, 0x7beba7c0, 0xeb55bfe8, 0xe7e73c7f, 0xf9f8fb67,
+       0xcd1f943e, 0x0eae679f, 0x1c3d5fba, 0x732885fe, 0xd5eb2109, 0xeb8a36ab,
+       0x5abb78eb, 0x85edd7fe, 0x25d701f2, 0xf8377d07, 0x84e1c068, 0x1e518b76,
+       0x7cb55f50, 0xb664f742, 0x7f0c89b6, 0x8de700b2, 0xd74f237a, 0x8795be93,
+       0x5bb2240a, 0x49d97a82, 0x37ae8bf6, 0xb06b5603, 0x2bb5b9fd, 0xaf51eb0b,
+       0xc7ecf76a, 0xc7c5a08b, 0x7348e106, 0x9277bb70, 0xddfc4597, 0x5dbb1cb8,
+       0x8f3423d7, 0xe80a2b8d, 0x6d2a855e, 0xe1d49d3d, 0x345378a3, 0x104271e2,
+       0x7d7afa1f, 0x15e3a5a7, 0x8197bced, 0xd83af51f, 0xaca69525, 0x7ef8ff60,
+       0xe7df0866, 0x841f3839, 0xeabbe7d3, 0x0f83c027, 0x0d43f0f1, 0xc75009ef,
+       0x04982d7b, 0xfde617eb, 0x6b5c50cc, 0x56e04232, 0x104e3eb8, 0x5d8f5c4d,
+       0x07e22e46, 0x58f7ed31, 0x41cf24ec, 0xe5bb707c, 0xe7168701, 0x3f29eed5,
+       0xa1390268, 0xcf3e367d, 0xd4c95dee, 0xddad6cef, 0x6f2f4bdf, 0x7496f2d6,
+       0xb5e2b17b, 0xf846cdd4, 0x1cbb7f79, 0x47792f1c, 0x8ed063dd, 0x5c51ee19,
+       0xb5e41fe8, 0xf98fdccf, 0xf07bd924, 0x7c820407, 0xe5c2dd9e, 0xc34bb814,
+       0x43db9bcb, 0xd874adfb, 0xbbfb3975, 0x28fb23cc, 0xcba457e7, 0x5a72217d,
+       0xbe3850e3, 0xc4167e60, 0xa3d464a7, 0x83f7f97a, 0xcf1fb3c3, 0x3e039525,
+       0x78eb6d50, 0xbf996d6b, 0x7c7286d2, 0x8e50b994, 0x9be65bbb, 0x315d2146,
+       0xa219cc11, 0x79f3d61f, 0xf02876e8, 0xe5f20b65, 0x1a10c73a, 0x7751f86f,
+       0x1fbc0e74, 0xc613768e, 0x7eec5b7d, 0x0efc23f4, 0xe2072eef, 0x14ef5673,
+       0x8cad4fdc, 0x85b5aeae, 0xdf6bef3c, 0x8f89ed06, 0x1fee22bd, 0xf8c03f95,
+       0x7cdaf1bd, 0x02cfa9a0, 0x20c855e3, 0x0f5459a7, 0x655ade20, 0x3ef7bede,
+       0x5611a5fa, 0xf97bf229, 0x95befd60, 0x536df3f8, 0xfd17d21c, 0xcb93b424,
+       0xee1a4f45, 0x16c1b27b, 0xe003ae17, 0x1fbf1077, 0x06c931b4, 0x4a1efffd,
+       0xc4d3d3d4, 0x6b8e74a5, 0xfb40965a, 0x8f7fba44, 0xa4fd0b7a, 0x4d17bf3b,
+       0x3c2ec8fc, 0xd3e30c38, 0x4e9cd109, 0xeb558fd0, 0x1b1d6ac7, 0x48ffbf94,
+       0x8efe491f, 0x141dbebe, 0xe0e7ea04, 0xd735d74d, 0xd841f885, 0x83ffea1f,
+       0xa5b48cc2, 0x1f9affc8, 0x7c61f647, 0x7b45dd70, 0xce21ac65, 0xebe0d3e6,
+       0x0a3e4748, 0x3ed147b5, 0x7d67b3ed, 0x0cdf57f3, 0xf4e2767a, 0x715e0096,
+       0x6e8acb5f, 0x6fe817fe, 0x36b3d81a, 0x8d3ec3c0, 0xf8660e2f, 0x3d4fdc44,
+       0xfba05c38, 0x79450fdc, 0xe095aa73, 0x5c5a8938, 0x33cb5120, 0xe5e28c4f,
+       0x1eb8620f, 0xaf863cfc, 0xbca837d7, 0x1c88e89e, 0xbdad9847, 0xeb89a9ff,
+       0x91f935f7, 0x684fd1f3, 0xedaaf5fa, 0xfc211cde, 0x8e13eebe, 0xdd7dda09,
+       0xe3c76f94, 0xfe340bfd, 0xe8873b06, 0xf8abb414, 0x876e9d7e, 0x4d9f6d9e,
+       0xf78213f5, 0x2c047bbd, 0x9f904f3d, 0xf148aef4, 0x6f58e2a1, 0x55a5e622,
+       0xcb8e4544, 0xf4f0d20c, 0x38a30d59, 0xcfdc29ef, 0xb7bfe6cb, 0x1b25f585,
+       0x1d7ba49e, 0xe29f994a, 0x1a1b45bd, 0xc8aebf68, 0x80a7302f, 0xc78799fe,
+       0x943a3581, 0x710d116e, 0xb552c5e7, 0xe4139b1c, 0xae1dfc5b, 0x9b25f7d0,
+       0x57ea19c6, 0x1816976f, 0x7a823bf2, 0xbfec90a7, 0x3e757ef0, 0x8f4fb70f,
+       0xf10d38d7, 0x861b05ee, 0x78cdf217, 0x73217ede, 0x36177cd1, 0x11ef1966,
+       0xb2b84c6e, 0x1ec1827b, 0x538445f5, 0x3fa8fd26, 0xf7f80e3f, 0x17f7c485,
+       0xe08c3a7c, 0x7bc38bf8, 0x8e018c5d, 0xc433e668, 0xdff326cf, 0xf8f1b429,
+       0xef8ff023, 0x7e407652, 0x07f577cc, 0x1fc01dae, 0xfa87fdc8, 0xb9937903,
+       0x024d65fe, 0x9c4ce0e5, 0x66cfb46a, 0x6e75f0c7, 0xc1b44c76, 0x679a2b3e,
+       0x6b57376c, 0x776b5737, 0xa84a38b9, 0xa164265d, 0xe9fde33e, 0x71951fbf,
+       0xffca6dfa, 0xedc310dc, 0x6eaa9fd7, 0xbbf40c6f, 0xd0773b56, 0xefdade6f,
+       0xf735ad4a, 0x5e5285e5, 0x1e6fe6e0, 0x09dfc3ac, 0xf601dde9, 0xfcc1e83f,
+       0x7ba0df67, 0x6eeff4ba, 0xb432d15f, 0xa954f008, 0x8bb973c9, 0x15dcafcf,
+       0x3f418790, 0xae1ce529, 0x827d96b4, 0x5a5df214, 0x22b76f09, 0x2ff06cc6,
+       0xffd5a27f, 0x6549c635, 0x1840495a, 0x3652ed06, 0xec24116d, 0x0b577f0f,
+       0x66a949e0, 0x93dfd0fe, 0xedcf194a, 0x6fc7db9a, 0x04e61616, 0x9a68d0f1,
+       0x5c62a391, 0x85da3135, 0xaa47cceb, 0x50f10eb7, 0xce8051fe, 0xa8fc4c49,
+       0xbdbb425d, 0x23d7755b, 0x7078eb7f, 0xae0a6a8a, 0x711fd1a3, 0xfcfa9b38,
+       0x30bebe62, 0x4766a8f6, 0xe976eb37, 0x42edc661, 0x5712a75a, 0x3efc308e,
+       0xb69c6261, 0xef32244e, 0x37da854e, 0xa327a232, 0xccae24f9, 0x2c76e66e,
+       0x2cb4f7a7, 0x3e7c16cf, 0xb1c8f06d, 0xd647df78, 0xbf8480da, 0x26dafe3b,
+       0x51fbc453, 0xc3fc359a, 0xf9c59e3c, 0x9cb8f3e9, 0x99dbd05e, 0xe84f8807,
+       0x3d3d10f2, 0xd8c1dfb2, 0xff3ef4e3, 0xe97bf8d9, 0x997acafe, 0xc74e4f7e,
+       0x69eab77f, 0xb4a6bc41, 0x3708166c, 0xdc7a78da, 0x5ca39f0e, 0xe78d971e,
+       0xfb94073a, 0x16873b15, 0xbd7dca85, 0x1cd9f44c, 0xdbafe796, 0xe1887ff7,
+       0x5890eaeb, 0x4bc43ecf, 0x8a3adb65, 0xc2d92cef, 0x4067f77f, 0xfe215cfc,
+       0x07ee1284, 0xfbe1cf94, 0x4acff95e, 0x7ab2ff44, 0xe5acfbfe, 0xb8f077db,
+       0x0b998fce, 0xcb7943f5, 0x0728a10e, 0x8773077f, 0x9f0428b0, 0xca7ee5a9,
+       0xaec6bf83, 0x5bd71fcb, 0x718efce1, 0x0e53b462, 0xe87eb8d9, 0xb87c57cc,
+       0xf669dc1f, 0xcebb6396, 0xe61768e4, 0xfff8e977, 0xe99b8efd, 0xa77db5dc,
+       0xa3658025, 0x8ac939a9, 0xcad70efb, 0x6eabe42e, 0xe9127bd5, 0x5a792713,
+       0x78d8fbf1, 0xbe16abbb, 0x58d85a75, 0x3c72b955, 0x8fe30c4c, 0x72e63f89,
+       0xf43aa493, 0x24b186bc, 0xeb9daa37, 0x67d7132d, 0x1e7ccc87, 0xf787193b,
+       0xb3ee3107, 0xe3878724, 0xf294dc68, 0xca1f9d00, 0x70d3bd38, 0x5fc830ce,
+       0x1b7dbfee, 0x2c3fff7e, 0x00284ba1, 0x0000284b, 0x00088b1f, 0x00000000,
+       0x7dd5ff00, 0xc5547c7b, 0xbddcf8f5, 0x0dd90afb, 0xdc3bf79b, 0x24280c10,
+       0x01049e6c, 0x878424d9, 0x28026e20, 0x47796bc8, 0xd2026c92, 0x6dfad0fe,
+       0xe5318316, 0x16d46b6b, 0x882ea945, 0x835ab696, 0xb80d06a2, 0x47d62228,
+       0x2d8aa523, 0x2220a5da, 0xfb1b6484, 0x6fcb56c0, 0xec9999ce, 0x0f0d9bde,
+       0x7cf9fb6b, 0xdcc98fe1, 0xe6739f79, 0x9ce7339c, 0xb5331d99, 0x228ca8cd,
+       0x389aa6a4, 0xfd2d34bc, 0x84e90ee9, 0xf00b9085, 0x8321226f, 0xf121326c,
+       0xbd3ca484, 0x582c524d, 0x1c5a7fbe, 0x052627d6, 0xaed84bbe, 0xa0af9686,
+       0x84225ba9, 0xa0e4258c, 0x31cc7881, 0x2ae8b484, 0xfd68d947, 0x7b488496,
+       0x663b2d13, 0x68db4573, 0x9d63967f, 0xeab4ac07, 0xa33e6398, 0xda4bf68b,
+       0x4264c7e9, 0x121230de, 0x8c1ddb41, 0x6dd3ed60, 0x42229074, 0x07891b26,
+       0x233d1bbf, 0xc1dfda14, 0xbfb083a1, 0xa6eab797, 0xc37b697a, 0x19d8b220,
+       0x9b74ef32, 0x6ca5db0e, 0xe8e921dd, 0x5a48b8f7, 0x513f321e, 0x595b01ef,
+       0xcc67cc26, 0x43844ed4, 0xae3d56dd, 0x1ce8c2a7, 0xb05466b6, 0x8fe868de,
+       0xe6ed7bd6, 0xfa7e8c4f, 0xbd2fc7fd, 0xbf50246f, 0xc1b47255, 0x37df5bfc,
+       0xa9a1c9ce, 0x4932e7e7, 0x613a6420, 0xf0bf36ff, 0xdfa151be, 0x70a6efa7,
+       0x76eaf5a2, 0xa32fd2ef, 0xc5a95769, 0x24268d23, 0x8b6bccf3, 0xdefd2148,
+       0x74112266, 0x5736dd6e, 0xfbce8d91, 0x0e535dcd, 0x58845149, 0x20f9339f,
+       0xc421f015, 0x06b4e19f, 0x3a5225e7, 0x722fce30, 0x10b3fd2a, 0x55ef46b2,
+       0x95ddf099, 0xb7eb4559, 0xccf830c6, 0x42e0cc1f, 0x157bec2c, 0x0b80975f,
+       0x8c0a7f1d, 0xdce5915f, 0x2454fd01, 0x329bd846, 0xaff99e61, 0xebdc2999,
+       0x823d92ec, 0x672b8d56, 0x579d0cf0, 0x79b84e65, 0xe2f1c06d, 0x44f8d963,
+       0x7180cfef, 0xefb2f109, 0xf9216932, 0x3873f6c1, 0x1f77e9be, 0x3a864efb,
+       0xd7f38273, 0x4d836fe2, 0xe861fac2, 0xa3ac116c, 0xc7cf98f6, 0x0f53ace8,
+       0xe6799674, 0xd043e230, 0xeab6cfcd, 0xd5fd1531, 0x5fd88cd9, 0x708f4d9d,
+       0x1a780cd9, 0x2c03534c, 0xcc1ba69a, 0xc7850f5e, 0x1f26f39b, 0x7e297292,
+       0x20fa316e, 0xb4b7437d, 0x48dfca16, 0xe8b7e361, 0xdf216b74, 0x34859772,
+       0x6e1d5e21, 0x376bcf98, 0x6a7e2147, 0x26bd1ae7, 0x9f8fcfda, 0x63de5897,
+       0x67fa12f1, 0x72f66bad, 0x22e24768, 0xfe024fec, 0x738c075c, 0x4ae9fdac,
+       0x51bf6e79, 0xb7a7dfa1, 0xf027fdb1, 0xe8c6db50, 0x0107ec4b, 0xbd3c20d7,
+       0xf024fdaa, 0x8db07f31, 0x17a505d1, 0xcecd7780, 0x3349db08, 0x0102eb1b,
+       0xe5568cfa, 0x6d93dbeb, 0xf3044727, 0xd007f035, 0x81620ec1, 0x79f2d679,
+       0xeeb9d3ce, 0x6755fd83, 0x50341ff6, 0x0d1f16d4, 0x881f7ee0, 0xffd66b7e,
+       0x0164fb3a, 0x0e93ab21, 0xadf62a61, 0x7f7aa861, 0x6f78e56f, 0x7bb69482,
+       0x4d4dd382, 0xcbee1b61, 0xb80d939a, 0x19532d9f, 0x231cb35f, 0x133c508e,
+       0xdebe43f2, 0x457db17b, 0x9964db64, 0x71e2bdc2, 0xfa44d6c9, 0xaba44fcf,
+       0xa36ce224, 0xf5b67dfd, 0x0025a8f5, 0xc82eafdf, 0x37ae98a4, 0x3777ad82,
+       0x3b5d3be7, 0xde91c029, 0xcc248c1b, 0x3fb72f7a, 0x01223be2, 0xec386b3c,
+       0x1f2e9ebb, 0x17a529fb, 0xf6c1cecf, 0xcf92e8ab, 0xf6eb3d3e, 0xbbbce94f,
+       0xcbb44c76, 0x4e4d3640, 0x7c409fa4, 0xa53b7d84, 0x4c99389f, 0x37de2895,
+       0x351ebdb4, 0xfcfbb68e, 0x81f3a397, 0xf7cdbf6f, 0xe5e799fd, 0xbb9700f5,
+       0x75ecf67e, 0x95e35e50, 0xce304d62, 0x95ffc7ce, 0xdea9fb42, 0x26100f51,
+       0xd57cbf4d, 0x74f5a7e8, 0xfbec6dde, 0xa836c1ce, 0xf713f9f7, 0x6ef0075f,
+       0xf2c26b6a, 0xc36c4f33, 0x7b3f6bfc, 0x683fdf76, 0x94675abd, 0x799dea1d,
+       0xa5e23f7e, 0xc077a5d6, 0xeba2077a, 0x33f6bbcd, 0xe126d97e, 0x1973237e,
+       0x2d74131f, 0x9ff3f7e8, 0x2a1b1e2d, 0x16f7c437, 0x833b9723, 0xcb391c98,
+       0x994d6ff7, 0xb3d205a5, 0x85cc44cf, 0xfe8dbaf5, 0xcf9868ec, 0x1f174628,
+       0xb6d47871, 0x2db831ad, 0xf9fb1ed8, 0x487bee80, 0x9e7d2873, 0x6b4ef4a2,
+       0x0050b8ed, 0xeb0afde3, 0x11257ad3, 0x2f37be14, 0x7cc12e38, 0x18354722,
+       0xbf9e706a, 0xd574e564, 0xebc5e5a1, 0xe96a3d18, 0x059b0be0, 0x907d8beb,
+       0x4d32bbb2, 0xb2603e41, 0xd6ce3e33, 0x6aed5297, 0xd7efd2b2, 0x65d973af,
+       0x4f97c78a, 0x4a9c9e1f, 0x211b3ff3, 0x65fe2015, 0x8f39c989, 0x5ba9c705,
+       0xd04e465f, 0xd9a2eaf9, 0x11b0497e, 0x07c8b5fd, 0xd7ba31b6, 0xf205bd13,
+       0x89f200fa, 0x072e16ba, 0x1279b077, 0x96632073, 0xae59db15, 0x83ce098d,
+       0x3058b3b6, 0x29b8c81f, 0x678ee407, 0xc51dca2e, 0x233df388, 0xe4f101f8,
+       0xee09cc2e, 0x711d04b7, 0x8c13fe01, 0x7e30b534, 0x4ffb4953, 0x8a4d2e8f,
+       0x09a60a2e, 0x16b95883, 0xf2f0b74e, 0x923b451f, 0x3b5e01a2, 0x60f25563,
+       0xdaf2be20, 0x6e4cddcd, 0xe91c72bf, 0x08740dd0, 0xaa4ebbe3, 0x6472f6e4,
+       0xf70e94ae, 0x5c3a471c, 0xabf8cede, 0xb8d4bdbb, 0x259ba68c, 0xefe61732,
+       0x7404f4e6, 0x9bf9a764, 0x7d71a3a2, 0xd9fcebee, 0x39baa7c0, 0x61ef75dd,
+       0x4e86f6f4, 0xbcf801e7, 0x36e47db1, 0xf95a0790, 0x113b5528, 0x6f8a6edf,
+       0xd67a0493, 0x67a0c3ba, 0x3b1355d5, 0x6ef757ec, 0x081a1fbe, 0x7b7707ee,
+       0x2fe872e5, 0x5d9a6e35, 0x992f5096, 0xeef34a9c, 0xfb04525a, 0xd96b652d,
+       0xd20ba01e, 0x20ab912e, 0x0ddced5f, 0xab8fafed, 0x2099cbb3, 0x9927b6f7,
+       0x47ebfd69, 0xcdfb6314, 0xf4294ae9, 0xb620a9e7, 0x706f2127, 0x9cdb3ca1,
+       0xf20ed23c, 0x88daedce, 0x0651177a, 0xb89ca1d9, 0xbea16bf4, 0x6c80b3db,
+       0xe3ecc292, 0xcb03923d, 0x08de91bd, 0x3b7a7eda, 0xeddc7fd3, 0x139f1f6c,
+       0xa1a911f0, 0xd78c1173, 0x788982fd, 0xbd9d20a4, 0x930a67b9, 0x509a2fb3,
+       0x746d9ece, 0x34541390, 0x10568c8f, 0x358e02af, 0xa03a99ad, 0x9966425b,
+       0xf8cb1e60, 0x4c0d5a3c, 0x3973446e, 0x9b2f7590, 0x1fbe72c7, 0x78eb4796,
+       0xaffbe46a, 0x9b05c995, 0xe0e41727, 0x921e3e39, 0x73970245, 0xe5bae874,
+       0xb527dc3e, 0xe2feb34f, 0xdbbc8e4c, 0xe855e842, 0x6c7a5a47, 0x6ca6e3e2,
+       0x3301203d, 0xa55ad949, 0x57d7e7da, 0x5d3d5f13, 0x755bf5e7, 0xa8b989be,
+       0xfc82dd37, 0x6c91837c, 0x77f7fa97, 0x5be3344f, 0x3cceb115, 0xcdd7e409,
+       0xfa3fd416, 0x8720e9f6, 0xb8f4022e, 0x84dec97c, 0xea1670ab, 0x09d3bd68,
+       0xede03b56, 0x5a8e1c47, 0xbdafab7d, 0xd19c0f46, 0x4325c9ea, 0x4186e969,
+       0x549e0173, 0xa198b75f, 0xa7b68d9d, 0x8fb612f5, 0xf213627b, 0xf7ec26ab,
+       0xeb1b68f6, 0xd859d627, 0xcb2e2c00, 0x27c98eb9, 0x7adc3dab, 0x9e85a3d2,
+       0x074f28bd, 0x82db33f4, 0xafc7e1fb, 0xbd194b48, 0x01284151, 0x41fdb23d,
+       0x5278fee8, 0x3d447a41, 0xf4e0ddca, 0xb647a786, 0xaf54dc5f, 0xd29b3d02,
+       0x27a65ae3, 0x4fdb085b, 0xa7232e8c, 0x7c007932, 0x159f542b, 0xefbb54fb,
+       0xedf6fd05, 0xefdccbfb, 0x1fb606dd, 0x801c29bb, 0xfce8fbde, 0x9be74665,
+       0x48fdd036, 0xfdd137cb, 0xffc214d8, 0x981fe7b5, 0x04079c27, 0x73663dbf,
+       0x745f0076, 0x19ab7f6f, 0x47f396c9, 0xc83fcbf7, 0x65de98be, 0x5fb4ca86,
+       0xa1afdd33, 0xe0a663f4, 0xea63e6b6, 0xb9113901, 0x8947ad5e, 0x266883f4,
+       0xdeb1bebf, 0xa3d24238, 0x55f1c3de, 0x007d73ab, 0x46f41e7c, 0x6324114a,
+       0x131bd33d, 0xde00e640, 0x417a47b6, 0x20484e3f, 0xccc2e7ae, 0x67df3f67,
+       0xfce29f02, 0xeac51090, 0xff7df2f7, 0x4ff7af29, 0x4b9c869e, 0x3a283f70,
+       0x0f2271d7, 0x3b448f2c, 0x172c2f3a, 0xd73be9f3, 0x137cd998, 0xbedecaee,
+       0xc18f0429, 0x3e75757d, 0x5eeb37e0, 0x25a97e9f, 0x8b908e38, 0xf981ba5a,
+       0xf581fc83, 0xb81a8e54, 0x7e7eeb5e, 0x71d0d33e, 0x7b5fdf04, 0xb482b8a8,
+       0x2bfbe0d5, 0x5635c7ee, 0x2522fa02, 0x9d2c4707, 0xe1befd57, 0x088d1f6c,
+       0xeafb4364, 0x314dd758, 0x9331dfb4, 0xdfa0fef8, 0xa09ce0ab, 0x0c531e27,
+       0xf5e0dde0, 0xd3f9e087, 0x8f7fd618, 0xe991ecd5, 0xd623b8fe, 0x3ded0d15,
+       0x03eec465, 0xe5077339, 0x896fb027, 0x4df808af, 0x0147f13d, 0x5d58c79c,
+       0xbf4031f1, 0xc9366772, 0xf257fca2, 0x63f7c2e7, 0x84b95111, 0xfb71f3f6,
+       0x85799f6f, 0xcaf85ab6, 0x03df85b9, 0x22317afa, 0x18e2e803, 0x513b97d5,
+       0x830656df, 0x944bddbe, 0xfc30b6c1, 0xcc0ba457, 0x20beb33a, 0x55663f98,
+       0x7a442f9f, 0x6fc30c4d, 0xe214f9fd, 0x09fe8589, 0x627bbf9e, 0x1f5df614,
+       0x56ea8230, 0x78833e7f, 0xeb1f7f68, 0x985b7548, 0x30c53771, 0xc84ddb7a,
+       0xf7e570d4, 0x0f7671f1, 0xb030fb65, 0x7f02f24d, 0xe1bf5eac, 0x07e532cf,
+       0x3eacebd5, 0xe831694c, 0x8f36d56f, 0xc7f3474f, 0xd11f8c0c, 0xc5cdb37f,
+       0xeb47b941, 0x0e03c7e9, 0x4b20f43c, 0x2e52e0f9, 0xbc3596b7, 0x13d825f9,
+       0x3cc4f5aa, 0xdcb3f69e, 0x4a983cec, 0x2cb33e8b, 0xbfb6028f, 0x25b73bf2,
+       0x5c4a5c80, 0x32eccad0, 0xf40d9264, 0x4331c95e, 0x317910be, 0xfa8f4b3d,
+       0xe29fe231, 0xe7188beb, 0x82f7c04c, 0x80f504c1, 0x7a45b705, 0xd07c213d,
+       0xa5a1e1cc, 0x7eb84f9b, 0x767feda5, 0xfe81196c, 0x739ca23a, 0xdc163e81,
+       0xcfc54e76, 0x53ff25ba, 0xad5d028f, 0x649fdab1, 0x433865dd, 0x623bfee8,
+       0xc43af3bc, 0x675e4f53, 0xa04cfaf6, 0x87c640df, 0x30eacf60, 0x940a3cd9,
+       0xa2cf111b, 0x291a9fdd, 0xe60ecbe3, 0x361e9e97, 0x196be819, 0xde0337b1,
+       0x1244b597, 0x033f084f, 0xc3e81805, 0x3f609e7d, 0x3cde3b4b, 0xaddcfc0a,
+       0x2c9d23f7, 0x8f105b35, 0x9c7af3ee, 0x74316907, 0x8a7b45f9, 0x8e5123fb,
+       0x9e7d60db, 0x9f47c67b, 0x263f491a, 0x7eb8efd2, 0xfdf0edd7, 0xe228c8a1,
+       0x4b78fa00, 0xf3a70ef6, 0x832b35ef, 0xeabc2863, 0x460e948d, 0x734e3763,
+       0xd243fe88, 0x77fc6aac, 0xcc25f5bc, 0x65d9b967, 0xc2be3904, 0x32a7cf41,
+       0x6457c9e0, 0xef8a151b, 0x9185f2f1, 0x45ef8f97, 0x6c7fbf7c, 0x661ff4a4,
+       0xe1c7dd1f, 0xa5ea23df, 0x71f27db0, 0x0e7ea906, 0x4a686bd2, 0x943c7ddb,
+       0x3e79f3e7, 0x604bd79b, 0x9f7c1df9, 0xeacb9c7c, 0xc5f1c769, 0x3b36fe30,
+       0xe015b1d6, 0x8cf9db45, 0x22fb1740, 0x16b7a8bc, 0xfc077e52, 0xea3a6d6d,
+       0xedaf94ad, 0xc4d97ac0, 0x4cf58d17, 0x03485728, 0xcfb07be5, 0xcf84148b,
+       0x274a52a6, 0xd7b03cb4, 0x04aedb64, 0xa9f02af1, 0x8c7b63c5, 0xc3c9eff4,
+       0xd43e9251, 0x61e5428e, 0xa3b30c7b, 0xd27f6118, 0x9e991899, 0x85f10c36,
+       0x3e5f2274, 0x608c6ebe, 0xf4fba078, 0x7bd418b5, 0xfba1397d, 0x97c704e5,
+       0x0f1f67e0, 0x8ab5e352, 0x5e6de1e3, 0x8d8c516f, 0x007b4fc9, 0x31c7ddf7,
+       0x165c7eac, 0x0f424393, 0xcb8703ff, 0xc8549a4d, 0xd5533195, 0x1c4dc5fa,
+       0x44c5379f, 0x087ebc09, 0x88f215f3, 0x345f17f2, 0x5e0b0fdd, 0x217f2135,
+       0xb0d9031b, 0x63bd68ff, 0x2c0a6e58, 0xe472a58a, 0x18dfaa26, 0x22ddb1f3,
+       0x3cefdf68, 0x85d04a3f, 0x3e9c8095, 0x1853d625, 0xe54f7e40, 0x296bae1d,
+       0xba437ca1, 0xd037fe34, 0xd694c93a, 0xd8560c87, 0x03a64ef9, 0x208fed02,
+       0xe147f40a, 0xb850e7fe, 0xc63bc76b, 0x319fe0e9, 0x96f11e92, 0x9f70f247,
+       0x7585ffbd, 0x9cf2ed21, 0x51d1eccd, 0xceb8ffbe, 0xe9fa0175, 0xd42dfdba,
+       0x7d198fcb, 0x3096add9, 0x63df46e5, 0xf2c1490f, 0x3d973fc5, 0x762fca46,
+       0xe4fd7677, 0xa5eeba66, 0x861db29d, 0x5fe77a5c, 0x7a031ddf, 0x0ec1a775,
+       0xdf2a46e7, 0xbcc3d5ef, 0x791e981b, 0x83a6a74c, 0x9f55dfb3, 0x1962d273,
+       0x83dea8be, 0x3be09cfa, 0x4adf7e42, 0x5c81577c, 0x461c465f, 0x66b4ff48,
+       0xe1420cd5, 0x0eb2c2b7, 0x6be7d1f9, 0xbc1ea1a7, 0x7cb07892, 0x4fe18b59,
+       0x4561f2a1, 0xeabf3aab, 0x56fe7561, 0x67df3aaf, 0x2f0f2e7f, 0x32c7a7df,
+       0xd94b3e3a, 0xb03fe03e, 0x3d05e4c1, 0x98af5b48, 0x3ca4cbd7, 0x24f813b1,
+       0x4760fb95, 0x48e11758, 0x6ebebe04, 0xc5e2696f, 0xe7f57cec, 0x10de21af,
+       0x37a8237d, 0x6c6f12e4, 0x63cb7eff, 0xf4238415, 0xe071f0ab, 0x2cb671bc,
+       0xc6263afc, 0x10653d0a, 0x8bbe27f6, 0x45e3827e, 0xcfea3ce1, 0x8f98079b,
+       0x5d9fdb05, 0x1b9c7e19, 0xa9b1c6fa, 0x7db064e4, 0xfc6b931c, 0xa3e82d1c,
+       0x7e127cfe, 0x07a17917, 0x31a5db07, 0xd9a48afd, 0xf906454e, 0x8b63b094,
+       0x224270fd, 0x3bb464e6, 0xebcfcfdd, 0x5fb05cf6, 0x083d009f, 0x6514e3f6,
+       0x714e9f9f, 0x66c6f7d9, 0xf70687eb, 0x941d768b, 0x43f8ceae, 0x58b2eef8,
+       0x6b8e1c6b, 0x57187627, 0xdba2fbd0, 0xe8bb062b, 0x6778ff7c, 0x546ba279,
+       0x30f53f28, 0xe85189bf, 0x9c95165f, 0xbc391a25, 0xd42dfdac, 0x95bea8bb,
+       0xd3e74c0d, 0xbd23b7bd, 0x04ce24af, 0xbd9ef3a0, 0xff5c33c3, 0xf315fc86,
+       0x6259e599, 0x9ba79820, 0x2abfee98, 0x1d599f3e, 0x99d3ef4c, 0xc71c061d,
+       0x025b1441, 0x7cd9a51e, 0xd3d4f329, 0xf9be84fc, 0x908e9183, 0x12fe7cf1,
+       0x9df0a7b4, 0xd4b253c0, 0x36f30495, 0xbc74b8c1, 0x824de208, 0x5dac69b4,
+       0xe4a27481, 0x3079b3d4, 0x0d264f3c, 0x675f5069, 0x9d6ccbf6, 0xd0090674,
+       0x985e0fbe, 0xc6fcf2b7, 0x568bbdd9, 0x158b77c0, 0xcf9188f9, 0xe52c4763,
+       0x2fe46687, 0xc9b75866, 0xfd1cfbe2, 0x94f53c64, 0x3d8fb829, 0x3bda0943,
+       0x02369106, 0xe72c5ae3, 0x1b58b03c, 0x8f9049b1, 0xe0faf5b0, 0x66ce70fc,
+       0x2346e8f1, 0x0b19dc9f, 0x677a527c, 0xf285e025, 0x19ff6665, 0xc3ef5ca8,
+       0x73e0b773, 0x4d7e7c31, 0x1325cf9c, 0xe2588706, 0xb01ef1c0, 0x40419cae,
+       0x49d65984, 0xd44b7ed0, 0x25eff454, 0x7969e000, 0x8abd54ec, 0xd53bc56f,
+       0xeab9c4f9, 0x9d4bb27c, 0x3f93d337, 0xcf928be8, 0x16217499, 0xc02359cf,
+       0xfce062de, 0xebcf99a2, 0x3d74a408, 0xfd3e71ef, 0xbb13f58d, 0x8eeebcfa,
+       0xe3b41231, 0xd0cd9825, 0xde57d53f, 0xcafa658b, 0x97281e27, 0xf3cfc803,
+       0xc0f9b626, 0x837cd3ae, 0x7e8bbf64, 0x1b2ab66f, 0x3d5494f4, 0xc76624d3,
+       0xf54adbd1, 0x865b7cb4, 0xe689becd, 0x1d7ec1eb, 0xd5b7f30b, 0x49f68d3c,
+       0x0247ab13, 0xdc8fe0cd, 0x8366c9b6, 0x81e5717a, 0x8bd046c9, 0x76db1057,
+       0xbfbe8612, 0xce86fba2, 0x53c809f7, 0x5e9c48bc, 0xf3290f22, 0x7cbc0d71,
+       0xc59dfc07, 0xe18b13f2, 0x65feca5c, 0x3a75e475, 0x90e0eec0, 0x77d62e51,
+       0xa16ebde4, 0xcecd65e3, 0xb3bc3b43, 0x0973f99c, 0x3463f7df, 0x905c6afb,
+       0x8f3cb1ce, 0x707587e7, 0x899c6ebb, 0x746d6bf9, 0x36666288, 0x8c71fac0,
+       0xfc44edfe, 0x5af2fb63, 0xfd07fc12, 0x47fb0795, 0x5829343e, 0x7467dc1c,
+       0xbdb37ca8, 0x1bd696a9, 0x87edf7a3, 0xa78e3c7d, 0xa37d3c79, 0xbf9406f4,
+       0x628b3a9d, 0x6d7db1d4, 0x861302ce, 0x14b80653, 0x04d07edb, 0x7c904cfd,
+       0xbd4c6698, 0x5fa609bf, 0xd147edc5, 0x06ef4649, 0x12a68eba, 0x77b4678a,
+       0xd820f9fc, 0x4907e5a5, 0x88e9e001, 0x0739c841, 0x7a15d39e, 0x3a1afb1c,
+       0xfd406c98, 0x2a932ffc, 0xd5013bf0, 0xd2bbce8c, 0xbe2116c6, 0x755f2c0f,
+       0xe36a3f28, 0xb337e464, 0x6abf32a6, 0x57b35cfd, 0x10ce4092, 0xbbd277e6,
+       0xb10a6f32, 0xc43f0897, 0x773206fb, 0x44f39857, 0x4fd31c6d, 0x3b3066ab,
+       0xa346fd6f, 0x1d537fca, 0x335eecc7, 0x8c8f26e3, 0xfcc47943, 0x5c7179a7,
+       0x46411b6f, 0xe10a9f00, 0xaf504523, 0x81edf4ab, 0x9cba8cf8, 0x8e3999f3,
+       0xfdea0302, 0xbe08df9c, 0xf6c41cee, 0xd2423cf3, 0x9367ae81, 0x87ffe406,
+       0x7e456f4b, 0x18f11373, 0x951f6f00, 0x310278b1, 0xd55359ef, 0xa71cd27a,
+       0x5cf37f3a, 0xf0c51ead, 0xe79dc621, 0x09579752, 0x5aaa783d, 0xfff05e0f,
+       0xb9468abe, 0xdd54f89a, 0xe7e02185, 0xc000f660, 0xe873f30b, 0x1bdc6e91,
+       0xbebc3f99, 0x388def3d, 0x127767d8, 0x4976cfbe, 0xb2ffd1cb, 0x82115a4b,
+       0xaf5ad4ff, 0xb8647204, 0x987dd855, 0x7934e4de, 0xc3df83f7, 0x91128359,
+       0x49e3cebc, 0x493c400e, 0xadbe907e, 0x57165665, 0x30b51c41, 0xa45b349f,
+       0x16fef41d, 0x65da3e5d, 0x2aaca25b, 0x0da6fa3b, 0x13d4054a, 0x44c558f6,
+       0x6e9c6df2, 0xd7779dc2, 0xbafe31c5, 0x71766259, 0x9e333ccf, 0x9cb3e32b,
+       0xbc413f2a, 0x9d828e4c, 0x229c6470, 0x63fda3ea, 0x5c95c1b3, 0x44af5340,
+       0xd2171197, 0xd11b265e, 0x4fe1a8ae, 0xb476b1f1, 0xce0fc7eb, 0x9cfd3b41,
+       0x2fb43c8e, 0xfd844b12, 0xffd8292a, 0xf4dbd99c, 0xdf53a710, 0xdcbf4db1,
+       0x7bbba412, 0x8d5cb8e2, 0xaf409124, 0xe7ba767d, 0x7ba7684c, 0x5ffce75c,
+       0xa35acba0, 0x2171ed0f, 0x07df8af4, 0x38ab8b92, 0x9cca18bd, 0xf9d056f3,
+       0xb46bbcf5, 0x1d19f9c3, 0xe7ffb46d, 0x9da344f7, 0x50455f51, 0x652c6d3e,
+       0xec07a47c, 0x9f1d745f, 0xf9e35745, 0x8ad4a360, 0x663ba3f2, 0x6af1d232,
+       0x073c01cb, 0x74a56f57, 0x569f2218, 0x6be750ef, 0xdf9e2748, 0x47ee9f6b,
+       0x0517c8cf, 0x56ef761f, 0xd4c323b7, 0xcb8f377c, 0x7da77c8b, 0x7d4c0556,
+       0x9d8b3dae, 0x8641e9c3, 0x1de8a3ae, 0x2eefb723, 0x008a9db0, 0x7494fb56,
+       0xc7adfd31, 0xfb665a7a, 0x2283c99f, 0x6e568e3e, 0xedbd7115, 0xe0bfca3a,
+       0xb0f42afc, 0x07f2c222, 0x92721d74, 0x42df382e, 0x7fe84ede, 0x7c084e42,
+       0x52109695, 0xa743f742, 0xc9434fe0, 0xed37c050, 0x0489f71f, 0xd8314391,
+       0x7dce07bf, 0x9478f8e3, 0xb7203c1e, 0x17b33a3d, 0x6a59abe8, 0x06693940,
+       0x9ba69f3d, 0x83ca1724, 0x323daa97, 0x692c7bc0, 0xd6833598, 0x8cee6f1b,
+       0x3a513804, 0x3f4a1239, 0xb197c44d, 0x11d1524b, 0xbf457796, 0x848e961d,
+       0xc47df33c, 0x74e998f4, 0x054fd0c5, 0x7a687e38, 0xc8e76240, 0xeb1f9629,
+       0xbadbfda1, 0x53274869, 0xf30f5789, 0xf1a9b0ab, 0x9d49253f, 0xa3f4a69f,
+       0x70c38c0f, 0x1f4e7870, 0x08772ea1, 0xfcd4477e, 0x857c932e, 0xc1f9187a,
+       0x5d80efc1, 0x193d7221, 0xd50dfa01, 0x6a1f7144, 0xb8ebe0e9, 0xf26fdd6f,
+       0xbf185c75, 0x13b70f49, 0x2bfc4b5f, 0xd3fa969f, 0xeb1bf759, 0x7a10a4e5,
+       0x65e2fb14, 0x907f8b03, 0xa9fe655e, 0xe5193312, 0x642afa03, 0x3fb14576,
+       0x8cfa05ae, 0x315dd209, 0xcf119eff, 0x19086ce9, 0xa1367402, 0x5327c23d,
+       0xfef1e4bc, 0xcbba05ae, 0xe223ea0f, 0xd254d15c, 0xa532be8f, 0x705fd42c,
+       0xa47d09df, 0xd26b6a40, 0xb91f0267, 0x1be609a7, 0xe3434f42, 0x512f808b,
+       0xda7dc27a, 0xcbaace4f, 0xf026f435, 0x52e5f42e, 0x367480d2, 0xea60a75b,
+       0xf2855cab, 0x5b32dcb5, 0xacdfed0f, 0x0936f462, 0xea0b31e8, 0xdca5e9ab,
+       0xe96bceac, 0x0ba88e91, 0x9f4b571d, 0x10dbd103, 0x5f2137a0, 0x6f4d2f63,
+       0x75bfe3d3, 0x7f1e9b7a, 0xd2d37a11, 0xbb5fe099, 0xa0e56c22, 0x4b57d73f,
+       0xde0a0f28, 0xf904d61d, 0xa89975e1, 0xb68aef4f, 0xdf5d7ea3, 0x3b0bcac0,
+       0xbdc4321d, 0xe5e3ad64, 0xc872ce99, 0xe5a7afd7, 0x23a2ebb4, 0xd8662e2c,
+       0xef3cac9d, 0xadd786ae, 0x587867a0, 0x6f3f97fb, 0xb968a396, 0x2fb799b7,
+       0x7c872d6d, 0xff6b0b7d, 0x46a9f819, 0xb79a7c43, 0x7d5fbe09, 0x1d9da66f,
+       0x3efe99ab, 0x9777af91, 0xd8ebdcf4, 0x5bb595ae, 0x883cd075, 0xe99ff9e0,
+       0x75f1d7e5, 0xd6cadc4e, 0xfae27719, 0x8ba50aa9, 0xea0f0115, 0xb574a76f,
+       0x06dfc8c5, 0x4a973f38, 0x4e9069ad, 0x5217eca1, 0x22ded987, 0xcc7e650f,
+       0x7b8874ed, 0x45fd99e2, 0xce20fff8, 0x9f4432a0, 0xd99e27b8, 0x84bd4563,
+       0xa0018a18, 0xa8ac4787, 0xa4ff0b5f, 0x812221ef, 0x723587bc, 0xbfac243d,
+       0x03564a72, 0x865311ea, 0x5fa53f08, 0x9b8e94bf, 0xc98be177, 0x3f43ece1,
+       0xe69ee3e2, 0x7a7d1371, 0x075337b2, 0x880bb174, 0xf4800524, 0x7f41afde,
+       0x487e05db, 0xa43ca426, 0xf2caf004, 0xbd7fe35b, 0x853c65a9, 0xef41aeaf,
+       0x2196a101, 0xccc9dc61, 0x1c1be24e, 0x53fe7fd5, 0xc467c4f4, 0xff362638,
+       0x1e544d95, 0x7e31d123, 0x8fe38736, 0xe90abf8c, 0xd3c73677, 0x2a7f05cf,
+       0x9fc00520, 0xddbc70e6, 0x347aa664, 0x8356c3f2, 0x133c6f86, 0xcb6a720f,
+       0xbabbfa80, 0xaa57c35c, 0xb92bb8f9, 0x092b7ede, 0x4a727ea0, 0x7a7a62f2,
+       0x6bdbd30b, 0xbf50472c, 0xe98479e9, 0x8fc4b5ed, 0xbed68ffa, 0x9d53b359,
+       0xe7536baf, 0xf9d5dbeb, 0x8e0f1c9e, 0xaea5b3d3, 0xd58aec18, 0x768bbf0f,
+       0x5fc16aec, 0x42fe6abc, 0x5fc67115, 0xed06ba1e, 0x6f98df51, 0x6f4f4d3c,
+       0xd0b8aac5, 0xfa9c02df, 0xb22f35ec, 0x613714f8, 0xeb1e8276, 0x4e70f988,
+       0xa4791a25, 0x9c7927e5, 0x86fb089f, 0x84792fe0, 0x8e7a23c9, 0x8241d77d,
+       0xd7ab5c7c, 0xbd73c4f5, 0x84d39f97, 0xfa0793fe, 0x35d3d00f, 0x4164480d,
+       0xdb7f6439, 0x9fc88724, 0xc0668579, 0xee99be73, 0x6c978067, 0x545971c9,
+       0xca05f0f4, 0x7bcf8199, 0xbd0d72ea, 0x2dd6f388, 0x81665e9c, 0xff8e8527,
+       0xe781c97b, 0x32b7c3ba, 0x5963997a, 0xd1faf487, 0xe22f466a, 0xe7e577dc,
+       0x4dfc873c, 0x747d79ce, 0x5ef54112, 0x17491e9a, 0x8fe67ce7, 0x1d1897af,
+       0xf87d55d4, 0x82cfe818, 0x246e1c2f, 0x3e10faf1, 0x64cd34d1, 0x934a3b06,
+       0xaa839d81, 0xbc5c7fa6, 0x38cf8434, 0x13134a22, 0x88ee5940, 0x5d6cfb47,
+       0x669c7aa4, 0x7fbbf3a9, 0x4fd2f380, 0xd44ed123, 0x954130fb, 0x70eb77a4,
+       0x6b3edb8c, 0x31527e60, 0x7707559f, 0x7ec3f3ee, 0x08ebff5c, 0x359f953d,
+       0x5ac5f792, 0xe4c4b65a, 0x6a7186ca, 0xb3233e74, 0x5fa27663, 0xb03b8c57,
+       0xf283d65d, 0x931af8d5, 0x106901c3, 0xefd2e1c6, 0xb5fea1d9, 0x4f8c89d1,
+       0x2aeb11df, 0xca0f8848, 0xa43f614b, 0xc6a49652, 0xc126fd04, 0x376606f8,
+       0x5c710bf9, 0x6361be32, 0xb69e7d88, 0x568f1b0f, 0xf5f8c096, 0x61ce29f7,
+       0x1da307de, 0xd39f30e5, 0x9a7b8fdc, 0x474efdfb, 0xcce03f31, 0x752cfabe,
+       0xf734f4f1, 0x518e9e13, 0xbd4487fb, 0x8ecc09a5, 0x6cd1b272, 0xbf07a8de,
+       0x1c6f313a, 0x21ec4946, 0x93c60353, 0xea78602c, 0x6dbd13d9, 0xa5ff8853,
+       0xfbf4a12e, 0xd87f9f30, 0xba43379c, 0x31b8f5bc, 0x23df0ed4, 0x0f77f3b1,
+       0x089e97a7, 0xeb718a96, 0x0fbf2a12, 0xe799ec78, 0xe5f63c47, 0x13bc8ac7,
+       0xc099effb, 0xfe5f6bf8, 0xb84f2c3b, 0xf5d843dd, 0x69f7f207, 0xd0547bfd,
+       0x044073b0, 0xfd6bcfb3, 0x3f050bf3, 0x05f9fee3, 0xec2d1f9c, 0x45827e60,
+       0x4a9cd266, 0x247717cb, 0x946e73b2, 0x9fe55b27, 0x515e44f7, 0xcba0863c,
+       0x3ecef49e, 0x2123f67f, 0xee3aecfe, 0xeb13accf, 0xdf5eaddb, 0xbadf0903,
+       0x8481fb3f, 0x6d6cfe30, 0xa08bc3dc, 0xe20b0c47, 0xc18dad61, 0x2dae42ad,
+       0xef6f7b07, 0xe8718272, 0xd65adf6b, 0xb5e0f604, 0x2a0b003f, 0xa7d431f2,
+       0x079c38eb, 0x53bc575a, 0x9d951447, 0x4251107d, 0x8aec9fe6, 0x4351e551,
+       0x4d03890f, 0xb5514ead, 0xaa186f4f, 0xfd643faa, 0x4cf2aa35, 0x9f2abe4f,
+       0xaaad72d5, 0x65ad55fe, 0x87f0fcaa, 0xcfd557af, 0xa3074323, 0x0c90ecfd,
+       0xb57221b6, 0x3e554ab7, 0xaa2de772, 0x86919ff6, 0xbd69e3cd, 0x79fe42dd,
+       0x8aa39d1c, 0x39ce7183, 0xed554b6d, 0x62b6a49b, 0x9f46f01f, 0xbd6893e4,
+       0xcb5f1c15, 0x62ff993b, 0x556afb74, 0xd8a367ff, 0x5fad183d, 0xa32e7696,
+       0x912ed61e, 0x7efea447, 0xfb8eeada, 0xa8ee219b, 0xf296bfbf, 0x356eda4d,
+       0xfe80bf3d, 0x8e6fd5a6, 0x5d3f7026, 0x7461490a, 0x0b0ba5ad, 0x5bbd7fea,
+       0xe627b465, 0xc687ec91, 0xc40cbc23, 0x5fc7f4ab, 0xae76612f, 0x76ada7de,
+       0xf559ff88, 0x47a432d6, 0x2e9a9253, 0x5d351422, 0xd3508e44, 0xa6aed585,
+       0x6a25c183, 0x3dc2d03a, 0x0ba6a1da, 0x43ffa7e2, 0x2ae02de0, 0x553b1ee0,
+       0x785a374d, 0xda0093e7, 0xc95eddd9, 0xfc6123ee, 0x70dbede2, 0x1fd2975d,
+       0xf86a89f5, 0x34701c16, 0x2c6e1059, 0x61e84cbe, 0x68ffae26, 0xaf4213fd,
+       0x7ae44b89, 0xf847ef15, 0x0f259a17, 0xfe7d51ea, 0x865f12c2, 0xa7f4132f,
+       0x44ecc206, 0xf0c4a4ce, 0x3efc4676, 0xc0519d90, 0x2620f675, 0x03886b2f,
+       0x882be1ed, 0xc9ddf90b, 0x3ed15bca, 0x63f2cab4, 0xad9ebbf4, 0x35527a62,
+       0xbf9f22f1, 0xaa02b8e2, 0xfb109287, 0x528e16ab, 0x02b3e487, 0x20f2e1bf,
+       0x79087485, 0x1378c2e0, 0x62e6864a, 0xad471f95, 0x30df82e7, 0xbd097f84,
+       0xe0278c57, 0x189af829, 0xe41a44cf, 0x1a17d824, 0x6846473e, 0x3b6a48fd,
+       0xe0f3b08d, 0x22fe2160, 0x44265dad, 0xe9916e0f, 0xcc90f238, 0x57f14226,
+       0xdda07360, 0xce7488af, 0xe625ef87, 0xc2bd26b6, 0x935713ed, 0x80c4fb3e,
+       0xfe12eaf2, 0xc91e59e8, 0x7f6668ff, 0x6bf0b43f, 0xf89fe5d3, 0x5e3c6d03,
+       0x55ef1052, 0x078f0f2f, 0xa76fea7a, 0x857d1fb4, 0x02eb23f6, 0xc3f6a1b1,
+       0x9206fbbe, 0x1373d71f, 0x424ddc71, 0x693710f4, 0x133f3c9b, 0x4e54c4ec,
+       0xecca4146, 0xab5da458, 0x8ed1eb07, 0x012ba3ac, 0x2121afba, 0x60ccda7e,
+       0xfee5e639, 0x74371179, 0x42e27d29, 0x3fc78da2, 0xc22778b0, 0x5f38a0f9,
+       0x139e740e, 0xcf701471, 0x2221fc16, 0x9139a84e, 0x4973839f, 0xf74ff42e,
+       0xb444a6db, 0x29fdd01f, 0xbec7ee85, 0xef2c22b8, 0xeb351fb7, 0xb2147117,
+       0x42ed10b5, 0x7bd742cb, 0x7a10f019, 0x3ea86fcb, 0x1234f780, 0x0dd7a615,
+       0x0381f63a, 0x553b0b8a, 0x46f59e71, 0x7b01807a, 0x8e3c8bc1, 0xafad4daf,
+       0xe3c89b3f, 0xe739f893, 0x181af052, 0x4eee3c1f, 0xf532e3e0, 0x27771130,
+       0x7f42f8e0, 0xc151efb8, 0xd8bcefb5, 0xe13df707, 0x72e02ee0, 0x29f3a8ae,
+       0x3d6c97c0, 0xeef00092, 0x83ee7288, 0xfd47e9fa, 0x705d24a7, 0x1772155e,
+       0xb6f6cbc6, 0xcf3f78cb, 0x5bc5813d, 0xc8c8f7b9, 0x4c3bba1a, 0x6ead37e8,
+       0xc2f51d7f, 0x68ca46ae, 0xa6761ea9, 0xbfa90e91, 0x0340bd88, 0x47ce81ef,
+       0x681f3d62, 0x75e22fd6, 0x7f7f3ae8, 0x3efc3809, 0xe42a1c1c, 0x9ee18351,
+       0x919c5f57, 0x1551903e, 0x75da1f42, 0xb0f4e66c, 0x013cef56, 0x4cef1dfd,
+       0x55fd0cdb, 0x53071dc8, 0x24eb3e00, 0xd1357fbc, 0x26cbeec4, 0x2574fbf3,
+       0xdc3b06fe, 0xb34a4e37, 0xe1a9fde0, 0xe09d91df, 0xdd78fe17, 0x4f70316d,
+       0x5c3ff44c, 0x4efde1d2, 0xe4fb9e42, 0x57f0428e, 0xa26fb02e, 0x162685b9,
+       0xddf99197, 0xe5165f48, 0x891aaf23, 0x61a3f619, 0x6bde0368, 0x68cb4409,
+       0xc9938cb7, 0x313ba024, 0x561f716f, 0xfafb877c, 0x7c52ef70, 0x2814d89f,
+       0x0ed34b58, 0xdd620f4e, 0x0503cb13, 0xfc20960d, 0x16a65c45, 0x3c385b3e,
+       0x66c6f1dc, 0xcdbb17d0, 0x52c9fce2, 0x9f23d362, 0xfb666759, 0xe255d8e6,
+       0xc2b3edfc, 0xe11dd4b9, 0xf6063c18, 0x7932fbdf, 0xb17f2692, 0xe3470639,
+       0xc7d415fa, 0xbb58d9d7, 0xbf071e6e, 0x44b2a3ee, 0x6f8e5f88, 0xa66f1f0a,
+       0x5c73b124, 0x8beff72d, 0x1f7ab5ef, 0x42d58dc6, 0xf04176bc, 0x6bc695fb,
+       0x01fc788b, 0x27ad10e1, 0xef78d1fa, 0x7ab179dc, 0x0e4bfcaf, 0x3ebebe7b,
+       0x0fe22749, 0xcf4defd1, 0x0be3615b, 0xf9d8934b, 0xe807182a, 0x7dc37bc7,
+       0x4a7b85f1, 0xce45c913, 0x0ef3eefb, 0x889fdc55, 0x9f9f7737, 0xfd7e7184,
+       0x29fda5fa, 0xe15c6096, 0x92dff040, 0x86e5e6c8, 0xd082bf78, 0xdefb0aef,
+       0x8f1c4e37, 0xc147f3df, 0xbb45fd3e, 0x7feaf78c, 0x75374871, 0xd779987b,
+       0x5db83127, 0x7dc7af13, 0x1c47d233, 0x2f8cc2db, 0x35fb89ea, 0x76aa9ee2,
+       0xfccbbb7e, 0x10fe608b, 0xbc6e1c47, 0xc48e9ca5, 0x30c777bc, 0x99f7b87c,
+       0xed059ef0, 0x77bde317, 0xe257f8c7, 0xf1a9b0be, 0xd7b73b7c, 0x9fdebeec,
+       0xa6bcf781, 0x40c33b31, 0x728de0f4, 0xd8f504fd, 0x4a65699b, 0x06fac53f,
+       0xffb216c9, 0x410f452e, 0x7854ebb8, 0x23770fed, 0xfbf457e2, 0x4fbe61f9,
+       0xe702c389, 0xbe5c25b7, 0x8351d92d, 0x1f38affa, 0x8cb0fe7d, 0x139f17f1,
+       0xbcf927e6, 0xcff3c255, 0xeb211752, 0xf95a1f29, 0x88334164, 0x844925b9,
+       0xbec3175c, 0x46e909df, 0xf97c9fb5, 0x87ecfdbd, 0xaeae5424, 0x57280d20,
+       0xdd58fe56, 0xfbdc9aae, 0xb49fd067, 0xdce1fbfe, 0xb1d6272e, 0x479e8939,
+       0x2629ef40, 0xd61f20c5, 0x3185f93e, 0x1f78194a, 0x777ca69c, 0xaff81e98,
+       0x46aed319, 0x48bfa61b, 0x44963c72, 0xc927b7f1, 0x9ed20db5, 0xbdff59f7,
+       0x7e4cbdb5, 0xb9438d6c, 0x2efd64d5, 0x087975f2, 0xc0f7ebe3, 0x1e14093b,
+       0x97d31326, 0x720d7412, 0x5e2dea14, 0xf1e387a4, 0x6266aa6b, 0x74049ede,
+       0x29cbf71f, 0xefce3153, 0x800e9197, 0x4752a6f7, 0x3625d81e, 0x997bb255,
+       0xb3f31366, 0xf6317f7b, 0x0c837035, 0x0cbfbb6b, 0x8eb6c1ce, 0xf7b03efd,
+       0x7cfee8b4, 0x5a57e210, 0x8bf163ae, 0xfeff3a09, 0xe2f190d4, 0xe049bd23,
+       0x691f8f87, 0x388f38c4, 0x21af34b9, 0xcdca5e24, 0x9edbd171, 0x1ec27685,
+       0xb61bb083, 0xa8bde045, 0x8183a1da, 0x18435c8f, 0x1bdc459e, 0xdf5421cc,
+       0x8470a2ed, 0xbf914ba0, 0x19f24da6, 0x12fdf0a2, 0xded4e3f4, 0x0f984be5,
+       0x7ae7ea72, 0xf98983f4, 0x5c9abdc5, 0x212efe06, 0x364be69f, 0xfae34766,
+       0xfe223cfc, 0x5cd97f31, 0xb8f3274e, 0x923f3f1e, 0xb1297bc1, 0x5bbb4067,
+       0x474a24cc, 0xf2fcd4b7, 0x675c22b6, 0xf41a218d, 0x19f7e105, 0x6f08cf58,
+       0x653f72ff, 0xa58df765, 0x72743640, 0x62e7c286, 0xf9c030fb, 0xdd9b3bb2,
+       0x88c323bb, 0xee8cfc03, 0x81b7c37d, 0x8834c27d, 0x7f29aff9, 0xa3e49732,
+       0x73866d5e, 0x44afadd4, 0x2f22f8f0, 0xc8ec4fbf, 0xfa9cf883, 0x8c7cb4aa,
+       0xc01a3913, 0x0dba3777, 0xc7dc0cfe, 0x5448ef94, 0xf2da0e36, 0xb87a19fd,
+       0xf54299af, 0xd92f9a35, 0x0fcb2f72, 0xd1d4aff5, 0x4f2d92fc, 0xfdd3d0cd,
+       0x7fc6bee1, 0x5b35f20a, 0xbe7cb176, 0xf34ca57f, 0x655e5bcd, 0x4960e1f5,
+       0x2dc1ec09, 0x68786707, 0xb9a267ff, 0xf1fbb7bc, 0xe5fbb59e, 0x3b50bae1,
+       0xe332636b, 0x9db8675b, 0x59264cf8, 0x1ef0055c, 0xb2febe11, 0x5a0f1d64,
+       0xac54c569, 0x4927b457, 0xf325dbe1, 0xf7e56e71, 0x924627a3, 0xb7e60896,
+       0x3c5144f3, 0x8e18e81c, 0x93afc77e, 0x6e9e9862, 0x38fbe3f3, 0x4f011fa2,
+       0x77189fd1, 0xe067c835, 0xac789acb, 0x3f8664ec, 0x1c46ce3a, 0xdd839867,
+       0xcb4aae2b, 0xbc51fc03, 0xf4de39e9, 0x8dbbfcec, 0x1bf68fcd, 0xa0728b9d,
+       0x07f8ec00, 0x33f5a2be, 0xd2d6f383, 0x93324149, 0x3136b72f, 0x3a206b7f,
+       0x6269e90b, 0xa5677f24, 0x668ebd50, 0xe4c6870e, 0x466f7e68, 0xc2512bc0,
+       0x1c389a71, 0xcf78fcd3, 0x5dd74af2, 0x775a1ff1, 0xf01cbe08, 0xf681ca5e,
+       0xf5b3b7ab, 0xcd7bf0c4, 0xd4188cfe, 0xf557eef7, 0xa6836677, 0xb8c1097d,
+       0x164c7736, 0x8227bfb6, 0xd93bf198, 0x332ed7de, 0xa0ade997, 0x2c778acf,
+       0x123ae788, 0x7bec47ea, 0xc58da2af, 0x39d70667, 0xd3af90a3, 0x6369d7c6,
+       0xe8aaf4eb, 0x64091c95, 0xa7f6b6cc, 0xf7f83ee3, 0x9f2a37f5, 0xe7daa7f7,
+       0x7d83fae1, 0xd65e103d, 0xd6f93a73, 0xa9e622f0, 0x9c1f6781, 0xf013f335,
+       0xed8dfd84, 0x52e9a946, 0x5926b3cc, 0xfb35939c, 0x8e1bf33b, 0xd5daca57,
+       0xb9e2cedd, 0xeba6a289, 0x3a99ddba, 0xed102b88, 0x1027c16a, 0x3dffb41f,
+       0x89edcc9a, 0x806d2469, 0x93c7c4f8, 0x0ddac28b, 0x9cf6bbf1, 0xe2cd13d8,
+       0x8af6b5d5, 0x277b789e, 0x9cf4afdc, 0x8c0aef63, 0xc06fd8d3, 0x259cf4cf,
+       0x5f282ed8, 0x9c73f9d4, 0x3fb7f63f, 0x7e603205, 0xe7b2a685, 0x47d53b15,
+       0x7e431cb6, 0xecb8385d, 0x7f9a4cb6, 0xc88ff935, 0xcb530bcf, 0xfca4c8be,
+       0x9fb27f7c, 0x7d9647e5, 0x5bf21431, 0x44feacfc, 0xefc0f3c7, 0x633fc789,
+       0xaf507252, 0x41592d78, 0x3ae5c9b8, 0x02647402, 0xc7ae8625, 0xe309aaf4,
+       0x075c04f6, 0xba4d0b4a, 0x6ff77086, 0x07a3eedf, 0x812957e6, 0xf3b0153f,
+       0x5f803b71, 0xf403b2af, 0xdf7bb144, 0x8eff7b3d, 0x483e5df7, 0x1e027576,
+       0x16bb23ea, 0x5dfcd265, 0x1fa09f91, 0x3dd0724f, 0xc515f601, 0xf9d01646,
+       0x9c9b5d4a, 0xd5913fa0, 0xe11eb376, 0x745eedca, 0xfc28178d, 0xf3f7d95e,
+       0x61b2a5ef, 0xb18f309c, 0xefd40f9c, 0xe06ff2fb, 0x633fadf7, 0x7af983b1,
+       0xdb96c76c, 0xdb1aff40, 0x4c97f6f1, 0x39fbb30e, 0xc163de62, 0x97bf49ae,
+       0xfe709bb4, 0x5eae3b63, 0xfdc7f501, 0xe80b23b6, 0x5f31c264, 0x9e85b013,
+       0xaaa52fbd, 0xcf90e5ee, 0x39d71a2e, 0xc04ddfa0, 0x54aa53e3, 0xf478460d,
+       0x857c7832, 0xf1dd67f1, 0x68fd9b87, 0x7fdf54fc, 0xfa3afaa2, 0x20c97b91,
+       0xc433f83b, 0xbdad7a7d, 0x5d2568f4, 0x213efd1f, 0xa2106740, 0x6f3c4f4f,
+       0x98248ca6, 0xaad1252f, 0x5939b97c, 0x96c2bf55, 0x929f2aa9, 0x7caab574,
+       0xcaa7929a, 0x56311f4f, 0x7b06ff55, 0x637f2aa9, 0xfd5534c9, 0x2aa5474a,
+       0x536be79f, 0xd4382fd5, 0x423f2eae, 0xfe43c064, 0x90ebfb51, 0xa0749d16,
+       0x74f8b5d9, 0x8e90ebc3, 0x87030bfd, 0xed7c5ed6, 0xe1d7b6f9, 0x6b17b0bb,
+       0xfb0933ef, 0xc5b2cdf1, 0x276f0c6b, 0x0567d24e, 0x75901fdf, 0x18d33eec,
+       0x94eaebab, 0xa67de0a2, 0xa62f6089, 0x7c58a848, 0x00e347ee, 0x3d980b4f,
+       0x062028ed, 0x68adbee3, 0x686a3c87, 0x2c0fe678, 0xf81d200e, 0x5cc084de,
+       0x9e27bad5, 0x5dd6a977, 0xe0d56e4a, 0x5f2a8d69, 0x555dbb61, 0x06d24a7f,
+       0xe534f955, 0xdd3c1a07, 0x60dfcaaf, 0xd3c1a2df, 0x7e9e0d36, 0xf4172aae,
+       0x5aedc1dd, 0x451ec0fb, 0xcefef1d3, 0x75c3c072, 0x8f8803a7, 0x72d6ce92,
+       0x47b5d3c0, 0x855f10db, 0xb039673e, 0x0d43e2cb, 0xa3ea43af, 0xf76831e7,
+       0xa612635a, 0xb4151a07, 0x1c6c1d6b, 0x46a1e981, 0x75ff7e3b, 0xefa60963,
+       0x7d303a34, 0xa62a71af, 0x4c4e8d9d, 0xb0db1adb, 0xed8d73fe, 0xdb162ecc,
+       0x3a45def7, 0x75ba07d8, 0x8278377e, 0x77923f17, 0xeecbf003, 0xc86efe41,
+       0x37ec45df, 0x25f9a24c, 0xbee844c0, 0x374f29fc, 0x80023aa4, 0xca1c3757,
+       0x18f1828a, 0x1e473a6d, 0xa477e1e8, 0x3ea1f84c, 0x37bb909d, 0xd16c9338,
+       0x79a66f2c, 0xb3c63644, 0x83a1f84d, 0x2033d712, 0x33a9d04a, 0xf7c806e1,
+       0x7772b044, 0x401b84ca, 0xfec6ff0f, 0xff3f4773, 0x61291df9, 0x9ccfe7fc,
+       0xd760ac56, 0x70d5fc39, 0x30e3c02b, 0x48396fb7, 0x4d09619e, 0x0679f54b,
+       0x0747b390, 0x80f0b7b8, 0xe009b4ae, 0xcfb3a6d0, 0xebef78c1, 0xb7e8040d,
+       0x5fe7624a, 0xca95cf51, 0x0dcf41e4, 0x1d4f3c26, 0x605639d1, 0x7814995c,
+       0x3dbce00c, 0xdee112a5, 0x00640d63, 0x4e29bcfc, 0x3c0f8f96, 0xf243d926,
+       0x079f0606, 0xb6fc6e52, 0x3858f3e1, 0x62913cf8, 0xcfb6fa63, 0x807a0e91,
+       0x74a91fc8, 0x3e7ec1d4, 0x0ab8ea52, 0x4d38cfef, 0xad3aff6c, 0x3ed0abde,
+       0x139a28e4, 0x9219e762, 0xd1f7606a, 0xd82262e1, 0x71916f3b, 0x39e16b9f,
+       0x7be99521, 0xce702748, 0xe789179c, 0xf63a2382, 0xfeb6819e, 0xb3d70e02,
+       0xe3dbc283, 0xbd32a616, 0xdd566ca2, 0xfed02f33, 0x6045d67a, 0xe1ce3dd7,
+       0x34f58fa8, 0x342ae850, 0x8e70dd3d, 0x1cec9b95, 0x9dbfe824, 0xf2d17f0f,
+       0xfb6e3a67, 0xfd68efeb, 0xda45d64f, 0xaed88651, 0xc2ddf841, 0x358c2f2b,
+       0xb0b4fea3, 0xe40cbd2a, 0x07ee7ce2, 0x27d5645c, 0x1f503ba0, 0x1727846d,
+       0x9af25b97, 0xcac90429, 0x3c234ab8, 0xb69d5525, 0xd5d219a6, 0xc237eec3,
+       0xa3b52913, 0x1a833576, 0x70b7475b, 0xff3ff211, 0x5e748dbb, 0x0acbd78b,
+       0xfb89cf3b, 0x145735ae, 0xf7e822cf, 0xa23b8f08, 0xeaf3c040, 0xd16f0e22,
+       0xd787116e, 0x3fae1489, 0x0b9c90e6, 0x67d63f6a, 0x0b5def40, 0xc01ecddf,
+       0xe72ea0cf, 0x4607e3fa, 0xfdf6ae36, 0xe2ee3112, 0x3afe7654, 0x0994a462,
+       0x4c2de4fa, 0xfdcee40e, 0xba22aee2, 0x9b0edcfe, 0x1615e30e, 0x7800bdd7,
+       0x78e76de8, 0xd8769034, 0x4b3cb34f, 0x221df93e, 0x8f754e26, 0xd2f252f7,
+       0x0f2b69de, 0x7e859795, 0xbca87967, 0x96b4092c, 0xf2145c83, 0x7d4ff851,
+       0x2f9cd58d, 0x3d3f2037, 0xf31eb8d0, 0x983d1b07, 0xe16c6a1e, 0xcb15b97c,
+       0x987c69df, 0xe72f65f3, 0x7bf13bcb, 0x4c5ce347, 0x58ba35f7, 0x9519ca3e,
+       0xecc4fb0a, 0x37c4f8c2, 0xf80898b6, 0x4c3b7ae7, 0x77419f18, 0xc68f63c4,
+       0x0991fc41, 0xe36a71ef, 0xbe7cb490, 0xf7761e8f, 0x0525377b, 0x1f8be9c6,
+       0xc8717d02, 0x9874f4c0, 0x4be05628, 0xe4fe8ff9, 0x0fafd006, 0xf4158a2b,
+       0xcdd482e9, 0xac50ef2c, 0x7c2f9a06, 0x8a5de794, 0x22ac04d5, 0x5be421f5,
+       0x358a3d87, 0x1f8be682, 0x7b95887d, 0xc7f33a09, 0x06f5ba3d, 0x2259f00f,
+       0x51fd801d, 0x449cce6e, 0xd79505c5, 0x5f6007a5, 0x325a494c, 0xcec5f609,
+       0x63e90514, 0x00e1b29a, 0xd88fa7e4, 0xfaab87a6, 0x46de4b0e, 0x57165768,
+       0x937687a9, 0x846cd6d2, 0xdd879376, 0x376d0faf, 0x8daed475, 0xdf619f90,
+       0x74fd07a6, 0xf8b1f027, 0x2f223f60, 0x169f05ca, 0x3ba37271, 0x720f289c,
+       0x0f289ddb, 0x66ca5c04, 0xf60dde57, 0xc976facf, 0x663cc126, 0x0a417d4b,
+       0x86e89310, 0xbf2949f7, 0x97f53ebe, 0x5db40dd6, 0xc5afe43d, 0x7c370ffc,
+       0xa6fbfcbb, 0xfbfc30d4, 0x41dfbe43, 0xfbdc43de, 0x0ef64687, 0x2e1c33cc,
+       0xac4b1df5, 0x712a8ef8, 0x7acf4159, 0x97f3cb9e, 0x9fe5a520, 0x7f8bb4f1,
+       0x70e7407f, 0x52ab38c1, 0x3fb21fb9, 0x6549a87f, 0x8f735ffb, 0xce728064,
+       0x6d52ea1f, 0xea3cf7aa, 0x76bfbb08, 0x6d3b38a9, 0xee36b89c, 0x3b693564,
+       0x1fecc8e8, 0xf70b526f, 0xc7fab2dc, 0x6a788b7f, 0xdf781c6d, 0xe3106ab9,
+       0xd78173a7, 0x496eba50, 0xde4f901d, 0xdc38097b, 0xfd0e0e1b, 0x9c5843d6,
+       0x2438bf7b, 0x5daeef1e, 0xb3c57117, 0xfc798d77, 0x827d76bb, 0xafaffa2e,
+       0xcf5fc195, 0xbbf54fe0, 0x157e60c7, 0xec04ad8b, 0xe7fca156, 0x3fe11777,
+       0x6df67e5a, 0x179bc9f1, 0x65bbe1d7, 0xf3d8f861, 0xb898f8e1, 0x854dafcf,
+       0xf3f70a9e, 0xde121e20, 0x7e738239, 0x1f6ba265, 0x1653d3f4, 0xce0e9bf8,
+       0xddec71a1, 0xaed183f0, 0x325df0fd, 0x1106b8b2, 0xe75a7c97, 0x6de815f9,
+       0x19fa3def, 0x106eb3f2, 0xbc8f7416, 0x97a0f341, 0x7ce6c3fd, 0x4647e013,
+       0xefa18df8, 0x7f140f8f, 0xff2e1bfb, 0xdf6ca7fa, 0x9ed43889, 0xa0665f6d,
+       0xfb12eefd, 0x54782062, 0x70fde3c8, 0x24b7a43f, 0x9767e512, 0xdef07c44,
+       0x02695771, 0xe95d2dea, 0xdfa43d46, 0x2bb8b9f6, 0xd7fb1b3d, 0x92bb8f9e,
+       0xdc6ccc4b, 0x7d2153c9, 0x2154f92f, 0xf0dfbdc8, 0xa376cbf8, 0xb03de0a7,
+       0x408d8f0f, 0x928dfeff, 0xa0e010bf, 0xbd77573d, 0xc94ca0b5, 0xa6be7fed,
+       0xeb049beb, 0xbbae3dab, 0xe95dbe1b, 0xfd76bb79, 0xb9c408df, 0x15ff5b8f,
+       0xaeeff781, 0x19ddfcfc, 0x5e80ab93, 0x12026ae1, 0xf545d319, 0x54bf9a09,
+       0x8939d6fc, 0x4333d39e, 0x6f25e5ce, 0x9e2e38b3, 0xfde7cf6a, 0xed5c09de,
+       0x960dc751, 0x5e308afa, 0xe147f645, 0x7b1d60bd, 0x73c4436f, 0xf3cfc9bd,
+       0x243ebcf4, 0x9d70ed0d, 0xfaf3aa19, 0xfa2d1f1d, 0x0881f21e, 0xa678ef8c,
+       0xcc3c44fd, 0xf19d8ff5, 0x0945793f, 0xedbd77d2, 0x9df4246f, 0xbdf5dac0,
+       0x86d77caa, 0x7056fbe0, 0x5ff6ab1f, 0x2a25ca32, 0x4f105ac7, 0xdae335e4,
+       0xda4af910, 0xef07dcfe, 0x55df94d1, 0xbe50c002, 0xd074cf36, 0x3cfc9576,
+       0x8de44844, 0x92aeda0e, 0x67891f9f, 0xe78f2b25, 0xb09f3df5, 0xff28ba7c,
+       0x7fac4ce3, 0x1c6fe895, 0x79164f2b, 0x22d5dfde, 0x9623789f, 0x25f68a67,
+       0xc6239f2c, 0xaded64af, 0xade4feac, 0x7a099cff, 0x33f7e08d, 0xe09cb8d2,
+       0xfe5152ef, 0xba2b4cef, 0xba8ebc68, 0xf107cb9c, 0x1dc5550e, 0x85df22d3,
+       0x6126dc7d, 0x9ded61ec, 0x9fe7b406, 0x0dcb698d, 0xe22f2fbd, 0x56e59c7a,
+       0x7baaf38c, 0x9976f871, 0x1e813bc7, 0xe9fb9cb3, 0xfa0b642b, 0x65ef7a61,
+       0x3d207e7c, 0x97fae570, 0x57ecf855, 0x46d3dfce, 0xef1d2547, 0xf1130fdc,
+       0xd619027e, 0xee02f189, 0x27c44934, 0x116abde0, 0x45971757, 0x8e7e701c,
+       0xbd82297b, 0x13b27aa7, 0x97caeff9, 0x6ebb7d98, 0xef28ebcb, 0xda0aca96,
+       0xea1ebe97, 0xe9f0075a, 0x2f77b2b6, 0x87dfae57, 0xc531f4fb, 0x8160fdc6,
+       0xbcf0a151, 0x3dfc3fb3, 0x8517f169, 0x3ffcbabf, 0x5dad7f0c, 0x5fd7dc5d,
+       0x7ff1857d, 0x07e656dd, 0xfd3c73b6, 0x7314a749, 0xf0023d78, 0x33a2b73a,
+       0x20865a3b, 0x778c4eee, 0x29df90ab, 0x6f56f382, 0xde009583, 0xdccea5bb,
+       0x5fe0c30f, 0x9f38ae7b, 0x69715441, 0xf7c3fb3b, 0xf7d04be9, 0xfa4dffd3,
+       0x8dfbd44e, 0x1f1bf076, 0x15e5ef65, 0x18c9fe77, 0x4ef41f1a, 0x0f073b1a,
+       0x317e676e, 0x2c171711, 0x713c32b7, 0xd55d53ff, 0xffc1e33b, 0xc4c3f624,
+       0xfe06d248, 0x76d74a04, 0xa076d74e, 0x41bf416b, 0x176d143f, 0xfa41be06,
+       0x912e2c25, 0xfdb7e9c3, 0x25e1fae1, 0x7fe1fae0, 0xa9bbae13, 0xdbfe8c3e,
+       0x4ed02217, 0x3ff385a3, 0xbc055c38, 0x0e2fd323, 0xfff4c8e7, 0xd3239c0c,
+       0x439d9515, 0xf9207bc0, 0x988fc5a4, 0x5a7d9877, 0xe9f64df4, 0x4f9c1923,
+       0x8f18fde9, 0x4c7bc5ab, 0x27bc3f7a, 0xef1c5fa4, 0x30fff2ea, 0xd370b5de,
+       0x9fdcb5a6, 0x985efdab, 0xfbbf203e, 0x7ff8e056, 0xb0b04fcd, 0x7caabf61,
+       0x54b7faf1, 0xef3c4be5, 0x415f965f, 0x5bfffbd8, 0x57e105fe, 0x2afcf998,
+       0xb51ff81d, 0xc43741f2, 0xc7a023f9, 0x7afe5f1b, 0xf93087d4, 0xb78c6cea,
+       0xe5af8dba, 0xff7ff18b, 0xbe947be4, 0xf66068be, 0x3ffb63d6, 0xfd392837,
+       0x79e165e9, 0xd084711d, 0xeff5c2d9, 0x5acf401b, 0x54fbd848, 0xa60ffada,
+       0xc6307b33, 0x30be5149, 0x710c4cd7, 0x9dcc1f94, 0xcf4beecb, 0x0c630705,
+       0x2d173ea6, 0x3e27a99f, 0xd2bb8f78, 0xd099f7a2, 0xffbea9ef, 0x75efe26e,
+       0xd558b893, 0x21d9783d, 0x9cdf9c63, 0xbd2fe612, 0xf786d2c5, 0xba1de787,
+       0x60f7dceb, 0x14f46f2f, 0x7177b8b1, 0xbaf7f0ff, 0x3e83f12b, 0x9c2a7a08,
+       0x5fee24fb, 0xff40635f, 0x2addb6ba, 0xca669fbe, 0xd9a38b12, 0xc533e2c3,
+       0x3beba4fe, 0xf767ca64, 0x48f7e060, 0xbe0c1b2a, 0x67a0b9e1, 0xbb3d47ef,
+       0x2e4364be, 0x927eafe0, 0x1b94dc74, 0xafd4ef3c, 0xd7b60bff, 0x7a6d67f2,
+       0x4fd5f6b9, 0xbd210f1a, 0xb1d17388, 0xb5e61f46, 0x1305d6f6, 0x93fd17ff,
+       0x6de2ff63, 0x57dc7482, 0xd0c70f8e, 0x3b1bfb75, 0x827b2dff, 0xbb0823b0,
+       0x214ed682, 0xbf7888f8, 0xe36e97d2, 0xa296b2ef, 0x59e883df, 0xc1edf82a,
+       0xd7f9fcfe, 0x27d717e9, 0x61ffe5d5, 0xf4b97cfe, 0xe4c49b5f, 0x8fee96aa,
+       0xed0cfd56, 0xb5be82cf, 0x6200bff4, 0x0bf8e852, 0x27bc25ea, 0xab55773e,
+       0xcdf49c61, 0xe5b57de9, 0x9b830664, 0xb15c2e46, 0x3c78503c, 0x0be78c87,
+       0x0ec6bc93, 0x87810f76, 0xefd5d3af, 0x48bc5303, 0xab971719, 0xfafff2ea,
+       0xa2e4e039, 0x8917266f, 0xcb489f4a, 0xe56eb7e8, 0xfe56eb12, 0xb90eeb9b,
+       0xd648b4a7, 0x40e3ef05, 0x81c435fc, 0xfdd978f6, 0x56ccead4, 0x5203ddfc,
+       0x7e028812, 0x995eeb77, 0xde8e9efd, 0x790e4fa1, 0xf88bad3f, 0x5c7a003e,
+       0x3bbd9e35, 0x769b8da4, 0xd5ea78f3, 0xbf78dd96, 0x9a0efb51, 0xf376cb88,
+       0xa1efb4fe, 0x9de2f689, 0x687bed03, 0x1c783253, 0x67c93e76, 0xe7172971,
+       0xcf20dda3, 0xdd35fc43, 0x5da2355f, 0x4ac7c6e1, 0x05a4f3ee, 0xa32732f1,
+       0x9799df1f, 0xa3be7171, 0xd32fff2e, 0x81dd6caf, 0x94aed8f7, 0x3a64477e,
+       0x827f40dc, 0x9bf1f72f, 0x6fc84c57, 0x3df33bc4, 0xf7c19e6b, 0x24be7a87,
+       0xd4bd97e8, 0xbb13e33b, 0x09c435d8, 0x564dbd27, 0xc771d78a, 0x1baf683c,
+       0xf785c47b, 0xe3bcc776, 0x927f8880, 0xc329c077, 0x233e85bc, 0xff209bf4,
+       0x78d9f7e2, 0xf2e5d59c, 0x37f52bb9, 0x8cfca7fe, 0xb75d5ee2, 0xbf0457c1,
+       0x13d9e0e7, 0xa103bf81, 0x1993ff9d, 0x93be8bba, 0x7ae511dc, 0x8b34f012,
+       0x5ef109cb, 0xdecc8572, 0x94edef49, 0xeeb85ed1, 0xabfb7e7f, 0xdb4b9547,
+       0xbd6dea15, 0x2265cf61, 0x7bb1d7ad, 0x0ae5f92d, 0x79c249c6, 0xc287ec0d,
+       0x7fada89e, 0x297b294a, 0xe35bed03, 0xdeda3df1, 0x067cd987, 0xfafd57c2,
+       0x603f8e00, 0x7ebf1f39, 0xf42d916f, 0x19f3959d, 0xdb43e77d, 0xdf107329,
+       0xff174b97, 0x332dced7, 0xa891e265, 0xbc91cd7c, 0x4c25ef4c, 0x3a405dff,
+       0x02445d31, 0xbb08ba98, 0xd894b0cf, 0x9c4e5d31, 0x5c55ae98, 0x3718195d,
+       0xf8c04814, 0x39ff17d3, 0xdce6e80a, 0x215ae375, 0xf2dbf146, 0xbef56923,
+       0xbd853c9e, 0x3fc2f497, 0xd9f4077f, 0xcb863ff3, 0xa2471be2, 0x1848641c,
+       0xa57bd33f, 0x54d7bb32, 0x17dc5df2, 0x325dfde2, 0x96e1f989, 0xfee26627,
+       0xc4cdf209, 0x826f826d, 0xb8e7393f, 0xdcc3c58e, 0xc67be12a, 0x6e1d7eed,
+       0x99159cb1, 0xb9ddf85e, 0x3cacddf6, 0x2bda2ea7, 0xd8ce7cd1, 0x26be5608,
+       0x4ff70bda, 0xee3f1216, 0xfb70c5cb, 0x4bfb8644, 0xdf8a2f8c, 0x8227a00b,
+       0xbf6d12a1, 0xeeccc3a2, 0x30ff1051, 0x70b9ffe0, 0x4f170a7e, 0xf1f18433,
+       0xbf1943d1, 0xb6a65d1f, 0xe5e50c87, 0xdf6529f7, 0x0cb47807, 0x810d6471,
+       0x9b9d31fa, 0x3b042c1e, 0x9f808e90, 0xb7b1b3e6, 0xb4535fa3, 0x1b29517b,
+       0x959ff501, 0x67bfbc58, 0x4c6fbf2f, 0xfea10902, 0x794ab5b1, 0x1a2bd42e,
+       0x40d3f8c2, 0x51df8570, 0x2f398674, 0xd1d1f88a, 0xbb436670, 0xd277c13c,
+       0x7e58959e, 0x6f5be3f2, 0x5f4168dc, 0xe3f40782, 0x44d71517, 0x91b46f18,
+       0xffcc0b10, 0x1b7efca7, 0xbb00c869, 0x4cc7aae8, 0x3e2fd03a, 0xee18e2a2,
+       0x9e81fcf7, 0x98fd21b7, 0xfd219b9e, 0x43373d23, 0x9b9e9c7a, 0xcf413d21,
+       0x38ae90cd, 0xccc7876f, 0x8e2189c9, 0xf0bfd0b9, 0x5be769f7, 0xd7f18439,
+       0x1af7f1be, 0x14fbfc71, 0x0fb7c217, 0xfe087bdf, 0xd1b3edde, 0x8b989481,
+       0xdecf5bd0, 0x749fa3bf, 0xff08b820, 0x0a7cb6a3, 0x6eee6bc7, 0xdcffca3d,
+       0xcad47f76, 0x872b7a90, 0xce7db118, 0xa0a3270b, 0x1f5b6eff, 0x5d121d7c,
+       0xcb1d4cf2, 0xb9fc7caf, 0x828e371b, 0x0fbe3bf9, 0xf9f74174, 0xdb73486a,
+       0xfc00fb7f, 0x1fed2a5e, 0xa47a24e3, 0x2f3c66c0, 0x85a1d668, 0xb3d75883,
+       0xa09b9dd1, 0x0c2fb3fd, 0xbe509585, 0x01bed843, 0xadc2923a, 0xe7ae0377,
+       0x10a05346, 0x78dd0bee, 0xa71b0e41, 0x8a529f7d, 0x7a064e70, 0xcaddfe43,
+       0x025f4653, 0x7f74df6f, 0xe223fb6b, 0xa5e015fd, 0xafa5c80a, 0xac2f40a2,
+       0xed04f1e4, 0x06fd87bb, 0x2439e9d6, 0xdabdf813, 0xfdea31d1, 0x49e38bb7,
+       0x8d7b39a4, 0xb3d7c04e, 0x830d4f7b, 0x7e2989f7, 0xc57bc186, 0x455c86db,
+       0x31ef7f42, 0x8f97ec67, 0xf587183c, 0xe769f7f1, 0x10156d91, 0xbcdf3337,
+       0xd2580dff, 0x0af1db42, 0x9c599b88, 0x74841d24, 0x19399289, 0x7dc465e2,
+       0x4a236583, 0x9a96c20f, 0x7d44af61, 0x4c9814ae, 0x37287c88, 0xd847f247,
+       0x558a3c85, 0xa524a7e5, 0x534feaaa, 0xd3e554b2, 0x95548c47, 0xd867718b,
+       0x46f5540b, 0xc28604c7, 0x83ae8e79, 0xa4ff03bd, 0x3986f18c, 0x7eb91c2f,
+       0x7ccfcd24, 0x43be0e6a, 0x9f2f2cf9, 0x17b95cf9, 0xe143d1f0, 0xd50aa469,
+       0x6c1f92e9, 0xd33a107e, 0xf76a179c, 0xa1d0713e, 0xe179c65c, 0x8184e712,
+       0xed164fde, 0xca04e7b5, 0xbe001f37, 0xd9c5fa39, 0x3edbf036, 0x14cbf63b,
+       0xcdfd4788, 0x0caefe10, 0x440c3f3f, 0x43fb7d37, 0xbcdd1852, 0xc3279325,
+       0xf2440dd0, 0xe9643a32, 0x7eecc3cc, 0xb5f295de, 0xa1af814f, 0x4243c0bd,
+       0x6b577f7f, 0xb46d1bdf, 0xb036e6ff, 0xc32bbd47, 0x7bbea50d, 0x6fe12b93,
+       0x64ef4839, 0x93bbb6f9, 0x07bbf0e3, 0xb73761f4, 0xb8520df7, 0xffbb553e,
+       0x60c2e4ee, 0x5c775939, 0x29dc9f55, 0x1bf2ab35, 0x7bf9d533, 0xdb439b4b,
+       0xad8fa40f, 0xd189787c, 0x6ef70395, 0x37bfb0a5, 0xfff3e62c, 0xd5800901,
+       0x00800020, 0x00000000, 0x00088b1f, 0x00000000, 0x19b5ff00, 0x6554540b,
+       0xcef7bbfa, 0x7860190b, 0x77421028, 0x840a4498, 0xb0285789, 0xd71ea08d,
+       0x8f4c1ada, 0xe5935654, 0xe04d7903, 0xe3d8f4b6, 0xb68fad18, 0x695b6d07,
+       0x9656356b, 0xb139e4e7, 0x36254644, 0xeb495bae, 0x66a254d6, 0x42d899e4,
+       0x7a26704c, 0xf75a9d6d, 0x5efffefb, 0x5b602e67, 0xe74ed69d, 0xffffef9f,
+       0x27ef7ffb, 0x70ca1490, 0xf60800ce, 0x9970ccac, 0xd6f70601, 0x8018e41a,
+       0xe2eff4d3, 0xf9b8daf0, 0xcf03837a, 0x3a380057, 0x01cfe3cc, 0x031401d6,
+       0x7b81295c, 0x5914f3a2, 0xff60e760, 0x2fbdf165, 0x00490801, 0xde8d179e,
+       0xe38456ed, 0x6e67065c, 0xf08d9ef8, 0xd918064e, 0xbfefff72, 0x25f5c22a,
+       0x8c0ee3b0, 0xbd0d43c4, 0x5c75d79b, 0x9fcd7114, 0x77d1d704, 0x98809679,
+       0x55706b80, 0x00e207b4, 0x3c636a9a, 0x679e3e62, 0x2e990e86, 0xa6f1c804,
+       0x01529bb5, 0xc0228a8e, 0x78074439, 0xe3ef14a0, 0x245f041b, 0xa4ef39a7,
+       0x67c8b9df, 0xe7c72fcc, 0x35b03245, 0xe99432bf, 0x7ed77bc6, 0xbf1ce787,
+       0xce91a203, 0x8f4a803f, 0x2e5c4c03, 0x19bdbb04, 0x3f233ffe, 0x1812bd4d,
+       0xf0619f90, 0x605aba1d, 0x25a9ccd7, 0xa7e92b00, 0x061dfb4c, 0x196fd890,
+       0xb2957f70, 0xe57cb2bf, 0xf08b10a5, 0x2040fd56, 0xa70fbd9b, 0x7fd5fff1,
+       0xf198376f, 0xda53f57c, 0x530f427d, 0xfbe52f90, 0x77b3f03a, 0x3de277eb,
+       0x235ef853, 0x8499fddc, 0x697636ef, 0xc7245fbf, 0xe0e60d24, 0x3828028f,
+       0x916db12d, 0xf1366bde, 0xdf4ae6f7, 0xea097bbd, 0xc925e9b1, 0xd1adc46e,
+       0x00e2d3dd, 0xa83983f9, 0xf2f1d4e4, 0x7a8cda6b, 0xa7c30c2a, 0xbdf34b76,
+       0xca175f74, 0x5e319ea8, 0xe2c960ce, 0x5f1c2cf8, 0x0bd7c573, 0xf735f101,
+       0x7ed0d0e8, 0x1146cf00, 0xcf3c08e4, 0xf2ae31ed, 0x07f4c39a, 0xfcc79c2d,
+       0x66132f9e, 0x1d75f2e7, 0x1ced01d1, 0x98bf702f, 0x093e8021, 0x60b541f1,
+       0x5f4b8edf, 0xc925724f, 0x9f004fbf, 0x589ec05c, 0x5cfd4264, 0x7da39fc1,
+       0x8fe02433, 0xe11d6c94, 0xfdc8a859, 0x7c7fd28a, 0x8b77e023, 0x434f167b,
+       0xd750e00a, 0x0cd43eb2, 0x0c6d906c, 0xe8f012df, 0xf17d2f49, 0xa416f4ce,
+       0x604932f3, 0x1f17dff6, 0x7f10161a, 0xd0b4455f, 0xeff7b026, 0xbe55f7a4,
+       0x74cef4fa, 0x8e6be337, 0x26f51065, 0x4e902e38, 0x47978f47, 0x183aae58,
+       0x712bf554, 0x9c7f2177, 0xfb3edd2b, 0xd1dbf412, 0x223160a5, 0x684b97bd,
+       0xabc30838, 0x49ab8fdc, 0xae5133d6, 0xe8813f82, 0x6e17966c, 0xe4bbf191,
+       0x97417bd6, 0x1d372118, 0x2f5533f7, 0xd3c71caa, 0xf72de2a1, 0xd1bf903b,
+       0x9fb3021d, 0xecccbb46, 0xe4fcb1b3, 0x7f104b83, 0x0bb25fa3, 0xeeb2cf48,
+       0x7e4847bd, 0x403b6b1d, 0xe7401e77, 0x2eb66eda, 0x527d9933, 0xd98be31e,
+       0x414688ad, 0x6056ad7c, 0x7c35a7c6, 0x0c7be61e, 0x7c3f51bc, 0x3804ce06,
+       0x9e7ceb18, 0xfbf35bf8, 0x1096fbcf, 0xe3ca1bb5, 0xad901f99, 0x3fa61b9d,
+       0x466000df, 0xa3db43fa, 0x3c304fbd, 0x6125af68, 0x27b13d7b, 0x9e0b70eb,
+       0xcf53789f, 0xc55f75cc, 0x416ea7c3, 0x68f6cd78, 0x0913e726, 0xf3a549e0,
+       0x3d7ba627, 0x18a56178, 0xb9216fea, 0xb7d8c677, 0x47f1f9e3, 0x13bb3fa7,
+       0xa767dae1, 0xf24c89d9, 0x7de5191f, 0xda011d3c, 0x7d953e7f, 0xef1c2907,
+       0xa52fc50a, 0x57dc6667, 0x24cfe74e, 0xaa8f09da, 0xa347a1bf, 0xfaf2801c,
+       0x16797c12, 0x8293bd34, 0x87c45067, 0xc79dc4eb, 0xdbcbb404, 0xc483ae0c,
+       0xfe47eaf7, 0xf90ca87a, 0x37e67aa9, 0xfa44cf0f, 0x0c9bdf6a, 0xaf584ef4,
+       0x6c40e2e3, 0xdffc9720, 0x915ffdc6, 0x288edd4f, 0x7111c7cb, 0x5e23a1a6,
+       0xa7753703, 0x888e3e5a, 0x65c07537, 0x8e82f50c, 0xfc57a9f8, 0x1d745eaa,
+       0x201aba25, 0x8422e3c0, 0x0557640c, 0x78a0e092, 0xc8c7ba10, 0xced63fe4,
+       0xd1916546, 0x8b822f51, 0x224179e2, 0x6fc85298, 0xc17e5c5d, 0x713fa67b,
+       0x9266ca17, 0xfbf54135, 0x223385ac, 0xf1bfb3ed, 0xcdcfb215, 0xc39f6646,
+       0x8d2f3c51, 0x391ff3c5, 0xc2bf7d9e, 0x87f305f4, 0xf5a4f933, 0x17385adf,
+       0x0aef141c, 0x9bc2e4da, 0xf4516d70, 0x29c52c72, 0x1dee4958, 0xc03aeff7,
+       0xe6f5b9e4, 0xbf7784a3, 0x0e0fe999, 0x0507b970, 0xf7d5279e, 0xa0429856,
+       0xb77a242b, 0xfdd57a31, 0xf3872dc1, 0xe0fef85c, 0x8079390b, 0xf24cbcf6,
+       0xe505fe0f, 0x7fc62a73, 0x3b5c36ec, 0x853bbff7, 0x7a58e0f2, 0xd9475beb,
+       0x2c3c2a7b, 0x4f5438f0, 0xf7fee07c, 0xa264ce99, 0x8b08c313, 0xcd77030f,
+       0x2b9bf260, 0xfe91c6e5, 0xf4b42783, 0x7d53a58d, 0x7d4fa55f, 0xcd37bd5f,
+       0x8e39322a, 0x9479fc18, 0x90cc5ff7, 0xc48d7c35, 0xcde2f3fa, 0x75e16fb4,
+       0x11c20244, 0x3f4356f6, 0x2635bf51, 0x5f48db8c, 0x6f608d4d, 0xa1efb603,
+       0xcfab89b8, 0x29f5e785, 0x03722b2f, 0x78ed09a7, 0x906762b1, 0x6eecc894,
+       0x5ebb7011, 0xabedc4ac, 0xe80f43a0, 0x75c4472f, 0xfda035bf, 0xa03c770d,
+       0x5dc64577, 0x74f151cf, 0xbb8f4fce, 0xa6c84a9e, 0x31623df8, 0x9e66bab3,
+       0x7bb1d055, 0xf74e90e9, 0x43eedcf0, 0x1a74f03b, 0xcf486ded, 0x8173a2e3,
+       0x6f53e515, 0x1f91e5f0, 0x2e3ddfa8, 0xb0fed8ba, 0xe9056070, 0x3cbe741b,
+       0x1bc4ef56, 0x233ac040, 0x77eed938, 0x25f65d50, 0xd412b8b0, 0xe2274d43,
+       0xdd12aa2d, 0x3c70e69d, 0x5167e354, 0x5ca3ee0e, 0xf55f682b, 0xa29bb457,
+       0x30fded7c, 0xb8f85a3f, 0x515dfb95, 0x98eee8a2, 0x576e5fc0, 0x1d06dcf4,
+       0x9e67f712, 0xb914cb47, 0x4522dd63, 0x4a8d2dd6, 0x9ac60f9c, 0x53f2123c,
+       0x82f51bb6, 0xb7ce9970, 0x028c5697, 0x9dfa8ad0, 0x5efe3e05, 0x539e36b7,
+       0xf2ca590e, 0xcbcb0e72, 0xaf7514b3, 0x7a40dc17, 0xc2fe5135, 0x2fc12ef5,
+       0x082bfad1, 0x1601d5b1, 0x06a8ad1d, 0x2701ceb6, 0x9b81e75b, 0x9da1f3ad,
+       0x83a00bad, 0x9f8297ad, 0xaf8170ad, 0xb83e580d, 0xf98832dd, 0x52bd7e18,
+       0xb45cbca4, 0xfc7ae264, 0x675e4571, 0xf9460797, 0x8f2f9f92, 0x614ae079,
+       0x2e4d9d74, 0xdd99b353, 0x923172ab, 0x5177e27d, 0xb5a14de0, 0x9dec0202,
+       0xf190c98b, 0xeb20d99d, 0x0702ae08, 0x48fee783, 0x5c069479, 0x04ee573a,
+       0xd89aa972, 0x7628764e, 0x5d364c52, 0x87d7d61c, 0x54171e56, 0x49d201bd,
+       0x3ebc60f9, 0x2ce88321, 0x5cfcae8a, 0xdaf190c6, 0x3a9df7b6, 0x8545a38c,
+       0x84362d95, 0xe53f590f, 0xf3e55970, 0xd91f0899, 0x9ba9d276, 0x595e7649,
+       0x1563b7a8, 0x39d86eba, 0x184dcf07, 0x4e50a3fc, 0x52824d92, 0xb1515d5c,
+       0x677e8079, 0x74ebac94, 0xdbc657e8, 0x5719c580, 0xd59f8014, 0xe46568b3,
+       0x7ebc3527, 0x7ae1635d, 0xbd706bdb, 0x60da7e4a, 0xc8cac5f2, 0x73759ad3,
+       0x6e5f2993, 0x3ff7f030, 0xbce72c9a, 0x22327282, 0x9841533e, 0x44f73c4f,
+       0xe4101c21, 0x186b5696, 0xf7c08fff, 0x77c21fcf, 0x5deb8a6b, 0x594dcf16,
+       0x534ffa40, 0x676779f2, 0x245d8a59, 0x3f8616fc, 0xd2d59310, 0x5207478a,
+       0x7bd21f9c, 0x776e18c1, 0x5eb95a1f, 0x329ab6ce, 0x27581f1d, 0xfbae0fd8,
+       0xe28f977a, 0x084827d0, 0xd599f3be, 0x34744035, 0x428c8189, 0xd11dd7d4,
+       0x27640cc7, 0xa80b1daa, 0x7fc8a5bc, 0x06bc039b, 0x96e51fe6, 0x2d98f533,
+       0xe5c107ec, 0xa5ca1ef8, 0xd2ace9c8, 0x8d4971e3, 0xa5ad1f7b, 0x3c2af6ae,
+       0xa2413c21, 0xad0a49a7, 0x1538bb20, 0x13e19eff, 0xb953a7e6, 0xabf12a3d,
+       0x6def4f67, 0x42741c69, 0xed361f84, 0x0fabe6f9, 0xa34ddf50, 0x0f5d3b66,
+       0x1696dffb, 0x1ab00bea, 0xd517c4d4, 0x1b75672f, 0x955fd47d, 0x397f3eed,
+       0xaf78abdd, 0xfa7146df, 0x1b40fee2, 0x9ec1cb95, 0x2fdc69c3, 0x6bfe3ad4,
+       0x93e4e7e1, 0x750512b9, 0x905ecbac, 0xabe446bc, 0x050bea99, 0xdc7c20f6,
+       0x47137684, 0xa9bf79f7, 0xbd0d95f6, 0x2fa819af, 0xc43c67c1, 0xff42ad6f,
+       0x5c37adaa, 0xad62f54a, 0xd62fdb57, 0x13d77bf5, 0xb43b75dd, 0xd9bf6afb,
+       0x4f5f7ca4, 0xea8d9af5, 0x26bded3e, 0xa8f337ea, 0x67eed3fe, 0xa6fd2a66,
+       0xa940ff92, 0x772a5733, 0xeb333f88, 0x235e0cff, 0x68fcd6f2, 0x7042dd8b,
+       0xe2ced9ba, 0x6606fd6d, 0xd87deac7, 0x446cc89a, 0x8ddadbf5, 0x5567eac0,
+       0x1b4ff98e, 0xfc8fa41d, 0x5d5993a7, 0xab3cf58c, 0xf09e3047, 0x22651efe,
+       0x173ddda0, 0x1114ca1f, 0xd93d73cf, 0x5fb7aa76, 0x7f80eb5e, 0x4fa6179d,
+       0x4ae7f7ad, 0xd40cab3b, 0x7d88dd47, 0xf7356e14, 0x4266d93e, 0xd01379b8,
+       0x3b2d240d, 0xe2a6ea8e, 0xe97812fd, 0x503ef01d, 0x1a976b8e, 0xbeb0524f,
+       0x9447908f, 0x09e4093c, 0xa2a379fa, 0x04ece8b7, 0xfd8c79cd, 0x71f7cd1c,
+       0xefda99a5, 0x6e7f0e3d, 0xfe73c509, 0x02e3bc7d, 0xc136fdcd, 0xcd91f76d,
+       0xbc3ff004, 0xb188ae57, 0xcd82bfc2, 0x17e7121d, 0x886fee68, 0xec9fb79d,
+       0xdd0bfcbb, 0x4b703b18, 0x01657764, 0x2f504780, 0xe7b586b3, 0x21db07c5,
+       0x1d47f116, 0x57998dd4, 0x16ea8078, 0x5fddaca3, 0x54c5daae, 0x4399aa98,
+       0xb73b919c, 0x9121d1fb, 0x9c0945d9, 0x117970f7, 0x5e0f59c9, 0x46dcbc79,
+       0x66fba569, 0x598bf303, 0x8a762dbd, 0x5a9d9347, 0x68d727f9, 0xd2ea9fe5,
+       0x956d3bca, 0x6ee9de56, 0x6dcfbcad, 0xead7cad5, 0xb6cfcad1, 0xfee69671,
+       0x0d4af6b4, 0x02f37d3c, 0xbdf3fdcd, 0xce70350b, 0xf734ab8e, 0xd32c7467,
+       0xaf77e79c, 0x76ab9cd6, 0x2e0ed636, 0xb18f35f4, 0x08c41133, 0x567aabfd,
+       0xff70a0ed, 0xff3c1aad, 0x1f6ffd6f, 0xc8a7ffa3, 0xbdde31d7, 0x37743b15,
+       0xd165ebb9, 0x999dae3c, 0x59eb9427, 0x9cb6f6bf, 0x77431558, 0x54e6fc95,
+       0xff941bf2, 0x0e16c391, 0x7df6fddb, 0x8e0acf14, 0xae88ab38, 0x1f7b80a2,
+       0xa192f385, 0xba38aaf6, 0x32d900ef, 0xe89c8f85, 0x02a5e5fe, 0x857e34e8,
+       0x3cb094f0, 0x93acf0af, 0xd972f0e2, 0x1636de77, 0x4be9c96e, 0xa120f3c2,
+       0x6a85e794, 0x22e81447, 0xeca152e4, 0x29e92503, 0xf3abf961, 0xc007ec23,
+       0x6880fd40, 0x2759b6f2, 0x9bec77aa, 0xb98f5625, 0x86f67d58, 0xa57362e0,
+       0x067f2645, 0x25dff7c5, 0xc4cedebb, 0xb44a76b8, 0x139eaccb, 0x54c46d02,
+       0xa4a31890, 0x76afa9e5, 0xed871f50, 0xff2bcd2c, 0xb56d4774, 0x6f919727,
+       0xb6f09409, 0x67f5fe99, 0xa2648eba, 0xcb0407fc, 0xf6fc42fa, 0x332759ad,
+       0x25197f28, 0xcd014494, 0xe9471c4f, 0x24dcccfc, 0x78c3f919, 0x0f65101b,
+       0xab73c289, 0x9390fac0, 0x08ccd8f4, 0x67a8ddff, 0xbe940b79, 0x5e451aec,
+       0x54b65f6a, 0x4f803fc1, 0x7e78c2ac, 0x4c1bf74d, 0xc329752e, 0x6dca1cca,
+       0x37fbe0b7, 0x5017354c, 0x428e0a5f, 0xd5e7ef3b, 0xfa4d2d3e, 0xed557929,
+       0xbf76cf6b, 0xd348652e, 0xc4cec32f, 0x6391e709, 0xbe615ee7, 0x9b03fbf9,
+       0x1a1e59a2, 0xe6ce94d8, 0x4ff7e18b, 0x71aff7b1, 0x93b1a3bf, 0xd7df5aeb,
+       0x9ef5dfd8, 0x81e7348f, 0x0d3e90a4, 0x4aec0ff9, 0xca35779d, 0x6305e46f,
+       0xa8abf509, 0x715b38b7, 0x3dc0fdf8, 0xbe10e7d3, 0xa7e7cdff, 0x6bfdbe4c,
+       0xa6ee6cfd, 0xed6c79f2, 0xd6070611, 0x963ad806, 0x55bfb54f, 0x20dfc357,
+       0x90e5ea9b, 0xd13ec930, 0x1b31e6bc, 0x67fa83ef, 0x7ca4a94f, 0xd06e9fdc,
+       0xc38b35f1, 0x0e26a5a9, 0x6b4f9bcf, 0x48de6f50, 0x00bf6dfd, 0x61ed010e,
+       0xec7ce0a9, 0x3abbe47a, 0xa36b95d9, 0x2875727a, 0xd0fe874f, 0x56b81f94,
+       0x1ebe7d40, 0xfe27caef, 0x53062c05, 0x599d1813, 0x890c37d4, 0x63013c9e,
+       0x764f4dc1, 0x3ffd5357, 0x8a73c934, 0xadad7632, 0x83fa9aab, 0x8ff70321,
+       0x847c9e5b, 0x16b7c3f9, 0xe77a4cd7, 0x31f24113, 0xf0497e7b, 0x16f6676e,
+       0xf88c2c30, 0xaf3a82bb, 0xfa9b7ea1, 0x5f14609b, 0xdff8db67, 0xacc72a5f,
+       0xae3c6d4b, 0x316b42dd, 0x2ceee5e9, 0xe8ca7bfa, 0x5f902366, 0x48873e20,
+       0x5cf87af8, 0x40f20a76, 0x6f560d75, 0x78285fac, 0xf8a3e8d5, 0x1675cea1,
+       0xbdecacdb, 0xd79f1b24, 0xf467dd24, 0xeefcb1b6, 0x3a46a8cf, 0xef58f5db,
+       0x1070df50, 0x846d1cd8, 0x7a1161e6, 0xfde36c59, 0xc008dc17, 0xd1b793cf,
+       0xc0ef4379, 0xdf278a31, 0x24aeba67, 0x72880c39, 0x8693c509, 0xdeacbdd8,
+       0xecc9b66b, 0xf197a43b, 0x4ee1718f, 0x382fcfd2, 0xfa455c0f, 0x7805306d,
+       0x03ccaadd, 0x91b726cf, 0x7287fee5, 0x9ecbfcd9, 0xf4a9f441, 0xb6cdfd22,
+       0x4a9db988, 0x1f9df87f, 0xae750bf6, 0x5b83c2a5, 0x9f916436, 0xbcf85ea1,
+       0x5bae1251, 0x0ff7c138, 0x963efa2a, 0xfe10f4e2, 0xf73e6ed5, 0xfb4ddb0b,
+       0xcf4947cd, 0x271666bd, 0x58fdf6cf, 0xf4f61b3e, 0x9f207932, 0x117f12d7,
+       0xc91bde7c, 0xe1cf48e7, 0x9fe57287, 0x9d305fcf, 0xb8291dff, 0x190c9bed,
+       0xfdd86fbf, 0xbbb211c6, 0xdf1e7506, 0x18339da5, 0x9aff6127, 0x1d1cd130,
+       0x5d444fb3, 0x9fbf5466, 0x8f7ed3aa, 0xa9cd3905, 0xa9dfc9bb, 0xbff0717e,
+       0xb8f9a98b, 0x846be94b, 0x1f2cebc0, 0x87f23e10, 0xe58782f5, 0xd18e7545,
+       0x23de6026, 0x585abadd, 0x35ce909e, 0xbb9ec9db, 0xe4fd06d0, 0x34473a07,
+       0xe98f5f9b, 0xb835bfa3, 0xd6fc9176, 0x4c9953bc, 0x9be7767d, 0x8d7e940b,
+       0xc562a9e7, 0x3f098b2e, 0xc71b9fd1, 0xa148b5ec, 0xf584c4af, 0x7c852650,
+       0x15e7c48f, 0xd363fcca, 0xef3e9aeb, 0x685932bf, 0x001e0053, 0x00000000
 };
 
 static const u32 usem_int_table_data_e1[] = {
-       0x00088b1f, 0x00000000, 0x51fbff00, 0x03f0c0cf, 0x33ab678a, 0x32ea7830,
-       0x31e9c830, 0x43d24c30, 0xb712d388, 0x9fa65173, 0x8181859d, 0x81b98813,
-       0x5f881798, 0xbc303231, 0xff5e2466, 0x3b046147, 0xe181804b, 0x0b6f9013,
-       0x32089fa4, 0xb2075c30, 0x0371033f, 0x88073f90, 0x35b10057, 0x480fbf90,
-       0xa3e204df, 0x1845fc40, 0x095ff9bf, 0x42156fc8, 0xe3443fe5, 0xafc4159f,
-       0xf980825f, 0xb1e40472, 0xe42269e1, 0x0a6dc7c7, 0xde040ef4, 0x67ca86a6,
-       0xe0606553, 0xaac58a07, 0x91dbf843, 0x6281f3e4, 0xf610aaec, 0x8606396b,
-       0x1db9405f, 0x7dcdd86a, 0x0dff9403, 0x9a86ab94, 0xf1b90003, 0x03685054,
-       0x00000368
+       0x00088b1f, 0x00000000, 0x51fbff00, 0x03f0c0cf, 0x1915c58a, 0x19d44418,
+       0x18344c18, 0x20685618, 0xb58969c4, 0x9fd329b8, 0x90c0c2c9, 0x40b9c40d,
+       0x7cc40f9c, 0xfc0c0c4c, 0x17ebc44c, 0xf5b04514, 0x84181904, 0x026ffc80,
+       0x85d70c0c, 0x8bbe1818, 0x03083030, 0xf1402ef9, 0x01ce2004, 0x58a06f62,
+       0x045e900b, 0x2c40ddc4, 0x7cdf8a22, 0x6bf20251, 0x37f95185, 0x847bf8d1,
+       0x1057ebf0, 0x47af2fc1, 0x161b1e40, 0x3e3f22d1, 0x3bd02922, 0x015f5810,
+       0xc7265f95, 0x0f27d0c0, 0xb8a87f8c, 0x4bfc9201, 0x0e5cbb20, 0x6096f6c2,
+       0xf2062860, 0x9bb0150d, 0x2f9403eb, 0x857dca01, 0xcc0003ca, 0x688cbacc,
+       0x00688cba
 };
 
 static const u32 usem_pram_data_e1[] = {
-       0x00088b1f, 0x00000000, 0x7dedff00, 0x45547809, 0xbedd70b6, 0xe9d3bb7d,
-       0x84849d25, 0x1674b090, 0x26c43510, 0x630a0840, 0x944c2127, 0x615151a8,
-       0x8408ec44, 0xf9707d90, 0x37d7d470, 0xdf95012c, 0x3e30eb89, 0x0e0c1a74,
-       0x1036a0c3, 0xc6c06a30, 0x680e8300, 0x8cc08378, 0x364584cb, 0x5c710921,
-       0x7f9e6466, 0xbb75539d, 0x48e9bdef, 0x9bdffc74, 0x3f6fef37, 0x556ea2bf,
-       0x5b3aaa9d, 0xaa753a9d, 0x42049462, 0x1be426ae, 0x71f4d1f8, 0x10921091,
-       0x69f2bb4e, 0xb910963a, 0x96bfca27, 0xff6e0d56, 0x401904fa, 0x5be6b9c8,
-       0x4254e65c, 0xc1513d3c, 0x39f969ab, 0x4cdf9e7f, 0xbcb60bcb, 0x7cd230ef,
-       0x08d116f5, 0x16ed86e5, 0x4ab9df6c, 0xd6be43f0, 0x55d8fedc, 0x45bddf34,
-       0x68286b24, 0x2066ceb2, 0x889c8439, 0xb467ec22, 0x2122481b, 0xad961665,
-       0x1663bd5e, 0x62de57f4, 0xfeda1626, 0x81e8b344, 0x82b582fc, 0xaafed09f,
-       0x4a665b5f, 0xf9e6f0a6, 0x45c58085, 0x371f6bf3, 0x2c84ecb9, 0xa381feda,
-       0x19c846c3, 0x9971145f, 0x81e51e70, 0xfc2a424c, 0xd324a71b, 0x041b15f6,
-       0xafc281b7, 0x13be7558, 0x2cd157c6, 0xbc29170d, 0xe25675ca, 0xfefac91a,
-       0x6d7f4086, 0x2dbfb0c7, 0x57f40652, 0x136ee17e, 0x929e6111, 0xd355da07,
-       0x95bcc071, 0x1af8cf7e, 0x18446b89, 0xa1bfd59f, 0x357ad1fd, 0x986e0b2f,
-       0x78818d62, 0xaf9d1c61, 0x60bfa659, 0x9bd5f983, 0xf3d5d846, 0xf30add28,
-       0x36aff0a8, 0xf8c1b14d, 0x32ca9b56, 0xd72af0c3, 0x515c493d, 0x4cadf1aa,
-       0x9555e81f, 0x3e33d3eb, 0x054f19a2, 0x06c05925, 0x6e9bf678, 0x7efe151c,
-       0x7a458858, 0x3513ae57, 0xf1e529f0, 0xfd3efcbb, 0xbc83c527, 0x9b5feecd,
-       0x02dba61a, 0x2bb7fd27, 0xa71eb74c, 0x1ceec742, 0x7d257c35, 0xc741e80c,
-       0x6273e8d3, 0x092f84fa, 0x2e7ca7d3, 0xbe33d3a4, 0xf4ae9891, 0xb3fbf1b9,
-       0x574c5cbe, 0x3e983cf9, 0xd4c22bef, 0x7ac12bef, 0x31d37c6b, 0xf179f26d,
-       0x72be8bfb, 0xeaf9d74c, 0xdf7afbf0, 0xf8374c42, 0xb2fefc64, 0x01a6396f,
-       0xbe4da74e, 0xfb369895, 0xab6f58fc, 0x2da61d6f, 0x5f7e00be, 0x98e7f1c1,
-       0x748cf248, 0x710f0efe, 0xb8937252, 0x449e4f62, 0x2c2571f3, 0xce53389f,
-       0xa27cd133, 0x3e29e697, 0x7982ab92, 0xae4f9a66, 0x1f43e563, 0x3451f924,
-       0xe566543f, 0xf93c2b69, 0x6b4f9a16, 0x5623e564, 0x34d1f9c9, 0xcacfc23f,
-       0xcc10db2f, 0x65fcd2b7, 0xd59e5601, 0x346c0a4a, 0xf964159f, 0x029ebdec,
-       0xb767cd3b, 0x87ce7cb3, 0xe6838172, 0x7b583a73, 0x1203de3d, 0x6d284d99,
-       0x3c8b959e, 0x6f3441c6, 0x37137722, 0xa37c8bc5, 0xe28138c7, 0xf9617241,
-       0x5827f976, 0xc2e4c9be, 0x367976f2, 0x1e4b3796, 0x572a3f2c, 0xc9b37961,
-       0x917fe583, 0x56fcc5ef, 0xa6e58bc9, 0xfac37ffa, 0x2c5e4d5b, 0x865faa4f,
-       0xc64916f9, 0x1beacbf2, 0x498b7eb1, 0x9627f2c6, 0x9933d2fc, 0xef04fb96,
-       0x8b67c053, 0x49396f05, 0x2409fe07, 0x69fe5095, 0xe074c810, 0xc98107d7,
-       0x20fcd1c6, 0x605dca13, 0x200bce57, 0x001bf8af, 0x1f17b2f9, 0xcf384549,
-       0xc2891c21, 0xc70e2f11, 0x03573bbd, 0x5cbbbdc7, 0xd422f381, 0x1fe96c5b,
-       0x2beec09c, 0x5dd9e3b5, 0x0579c0a1, 0x37fbd8e1, 0x26eff72f, 0xbbf3c76a,
-       0x0b4e052a, 0xdfed89c2, 0xd3ed3678, 0xbed367e2, 0x20767e10, 0x37fa127e,
-       0xb577ec9e, 0x377ec9f8, 0x70779f84, 0x07fa833c, 0x5abbd367, 0x377a6cfc,
-       0xe03f9f84, 0x6ff48678, 0x69efd95e, 0x5efd93f1, 0x221f3f08, 0xc1fed49c,
-       0x8b5f7e69, 0x43f7e69f, 0xe104f9f8, 0xbcdfef0c, 0xe2d41ec6, 0x10c1ec67,
-       0x3f113a7e, 0x4e0ff697, 0x7e2d41f3, 0xf0860f9a, 0x678e25f3, 0x35e6ff54,
-       0x3f1690f6, 0xf0850f63, 0x33800443, 0xd9e37fba, 0x3f1691fa, 0xe10a3f5b,
-       0xc67082c7, 0x393c6ff5, 0x93f16b1f, 0x3f0871f3, 0x42670871, 0xfd6ce0ff,
-       0xad9f8b58, 0x93f0871f, 0xf5267082, 0x7f395e6f, 0xe727e2d6, 0x64fc21cf,
-       0x3e3c9c20, 0xd8e1421e, 0xf2d386fb, 0x2d3f1689, 0x33f0849f, 0xf214e10a,
-       0x4e045cf1, 0x7e2d09ee, 0xf0844f72, 0xae708393, 0x969c1fe9, 0xb4fc5a13,
-       0xe7e1089c, 0x5d73846a, 0x7b95e6ff, 0xdc9f8b52, 0xa33f0c93, 0xc1b496f7,
-       0x40d7437a, 0x4c9b48b7, 0x08f1ee38, 0x64e8beb4, 0x26e9d179, 0x8a888760,
-       0x3dda417d, 0xdb6fad22, 0x08fd9b10, 0xf919db51, 0xec78c037, 0xdb52fad4,
-       0xd1b93119, 0xd62bbb1a, 0xc7c9a713, 0xea6b2517, 0x69a49427, 0xbf4e07ca,
-       0xc83e534c, 0xa7c9ad9b, 0xa9a95f94, 0x5f2ea43f, 0xf0b61f93, 0x54fd4d5a,
-       0x3e4d26f9, 0x344ff97d, 0xde3787f5, 0x64bf29a5, 0xfca68565, 0x4d02ff52,
-       0x3f75f2fe, 0x151fd4d3, 0xbf29a458, 0x4d11e5a2, 0x13e0e8f9, 0x3d98fc9a,
-       0x8fea6acf, 0x29a35f6b, 0xbd787f1f, 0xc7427ca6, 0x529e4d26, 0x72e279c2,
-       0xcf81179e, 0x07ebb309, 0x0b9ed099, 0x37984dda, 0x4ed0db25, 0x5ccbda0f,
-       0x4d1d29c7, 0x006baf06, 0x8486814d, 0xc979dbae, 0x507497e5, 0xa577df3a,
-       0xfd2712f7, 0x7bc99f7e, 0xfd823385, 0x902fe949, 0x065d4824, 0xcbe5f548,
-       0xf97fc624, 0x1c461729, 0x0d6beda1, 0x696223dd, 0xf790cbbe, 0xf1f94094,
-       0x7c80c159, 0x3a922d19, 0x266d17a8, 0x4b2ff768, 0x564179cd, 0x21f2e7f1,
-       0x3084ee54, 0x3792e5dc, 0xe78aec09, 0xc193dfeb, 0x421868ce, 0xc84c95e7,
-       0x82f784af, 0x3f6d0672, 0x4bc92ca4, 0xd44d99e1, 0x6ff7570e, 0x6267fda2,
-       0xffd04dff, 0x37fa3efa, 0xfa6ae5a7, 0xae5a1a8f, 0x44ca3fe9, 0x3b5277fb,
-       0xef10feb3, 0x4ae9129f, 0x0e115e42, 0xa1e6ff61, 0x32ffd8e5, 0xa88fdd13,
-       0xf50e8ffb, 0xf1f20cdf, 0x109ff43a, 0x5769fe61, 0xb43fe76a, 0x137f3b42,
-       0xfaf6ff9b, 0xa3fef33f, 0x0a6ffe71, 0x1ff3667f, 0x6fe6c15a, 0xfd437066,
-       0xdff8423b, 0xa77ff309, 0x4fa7f9af, 0x587fced4, 0x66fe7695, 0xf5bbffd6,
-       0x36ff7927, 0xe13dffec, 0xb0ff9b24, 0x64dfec2a, 0x7f81baf6, 0x75d1294c,
-       0x193fda7e, 0x40d1154c, 0x0fda1760, 0x28e323a4, 0xb0f21313, 0xb8e38690,
-       0xdbf19a2f, 0xdf94d117, 0x88c8bf50, 0x9aa7e21f, 0x6a43ee8c, 0x6e542cb8,
-       0x1e8133c8, 0x1fba72c2, 0x3a87cb99, 0xfe4445a7, 0xfd994f26, 0x3b78e9c3,
-       0xf219445b, 0xe49a9e73, 0x6b577d07, 0x40967726, 0xc209233b, 0x1e9e4ff7,
-       0x2f3d46b5, 0x51b73a7d, 0x91a1d13a, 0x391e362f, 0xa3ac8c9f, 0x26042be3,
-       0x9fce1718, 0x421dfba0, 0xe94711f7, 0x93d2027e, 0x7e8fed12, 0x43f74e3f,
-       0x9b96a4c4, 0x64476c7a, 0x7419fbcf, 0xe512b7fc, 0xde79c1e7, 0xe1452281,
-       0x4ffe1919, 0xd0357dd0, 0x95a36e63, 0x1e3c3f22, 0x6f9c1f3a, 0x5fe0a977,
-       0xd2bc7023, 0xf6f1b7f6, 0xe147c604, 0x36b272cf, 0x0f72511f, 0xb79f28a2,
-       0x67035e32, 0x4d2ff106, 0x5f6feda2, 0xb42243b1, 0x74a141ce, 0x97e002c8,
-       0xc4122407, 0x0247647d, 0x40cce4c9, 0x0c9d7be1, 0xa5d36dfe, 0x382a1de3,
-       0x4f28a4b3, 0xaccf1d09, 0xef1c45fb, 0xbcb6af0c, 0x63d5bb63, 0xcae9a2c8,
-       0x494224cf, 0xb6b97b7e, 0x6d3a8efc, 0xda85cefe, 0x098f9d3c, 0x5952b5d6,
-       0x874e9dff, 0xd0aef3ce, 0x69c4e9bc, 0x9b2f367e, 0x35925cbd, 0x686d8474,
-       0x034f2f0e, 0x13c413b4, 0x5def4fb6, 0x2681f29f, 0x0ea56f3f, 0xff8be71e,
-       0xddffff4f, 0xc96daff4, 0x1aae3f8b, 0x9ae07557, 0x7aaae3f8, 0xd46eeb95,
-       0x67fbe7e4, 0x5bcfea68, 0x9f29aa59, 0x535f38db, 0x4ff97b3e, 0xf952f935,
-       0x3bfd4d7e, 0xca6bd617, 0x587ba8ef, 0xf97b7e53, 0x0cfc9ae3, 0xf5352fef,
-       0x5abe9b6f, 0x9f6c2e53, 0xd703ac3f, 0x41b0ef4d, 0xa3fc0fe0, 0x299f0099,
-       0xfbf0acfc, 0xa6125f29, 0x4c2e7c67, 0x530f41eb, 0x8d786efd, 0x4a6bb5a5,
-       0x573e8187, 0x54a4fff8, 0xa5f41437, 0xfaf59f9e, 0xf4a7cf57, 0xcec91297,
-       0x812ad250, 0xd63ac094, 0xe55eedc5, 0xcebe39fb, 0xd308b211, 0xcb93132a,
-       0xf2834daa, 0xc1f20389, 0xbeb67511, 0x808092e1, 0xcde020f3, 0xa5ba004c,
-       0x4d4bb5d0, 0x38cd74d7, 0xb110eecf, 0xc9901aff, 0x94dcb009, 0xff40326c,
-       0x37a1b6c1, 0x78f1828f, 0x25be6336, 0xb3aded01, 0xe3f8a2be, 0x095fc046,
-       0xd37ca7a6, 0xf3e13d31, 0x57dc7a62, 0x5f51e98e, 0xbe1da61d, 0xec7e9885,
-       0xd0fd3193, 0x3fd31cb7, 0x3d311af9, 0xe9895bec, 0xd31f9f41, 0x53079f4e,
-       0x55ff4f85, 0xf0ca3ae8, 0x73d74edf, 0x328eba6a, 0x3878d938, 0xf1851f5d,
-       0x939bb046, 0xa71918c1, 0x563c47b2, 0xe02eabf4, 0x896a70fe, 0xef2b3f31,
-       0xd705317b, 0x7f8b768e, 0x9ee1e824, 0x011b7f91, 0xc39ee47e, 0xed480174,
-       0xfa7a7e7b, 0xe20789f5, 0xccbdfb41, 0x3187174f, 0xd12dcbbd, 0x0316af0c,
-       0xd4d92229, 0xa2fe1b5e, 0xcc4caefb, 0xb41c491b, 0xb46fbbf7, 0x6d4b8047,
-       0xc5efc041, 0xfed8baf0, 0x3bc01645, 0x39d7ecf1, 0xa4328e90, 0x4db8bb31,
-       0x0494bb44, 0x7e03705f, 0xecd67a43, 0x6d3f024e, 0x139370f7, 0xb8a7bdd7,
-       0x9fc15a9f, 0xfe0af2cc, 0xafe10e1e, 0x97f10931, 0x14bfc5f1, 0x3ba788fe,
-       0x6151a6eb, 0xbe139dfc, 0x39ca7f1d, 0x1bbfbe89, 0xe277e344, 0x0544aecb,
-       0x0943edaf, 0xe02de7ed, 0xa7bf0a7f, 0xc01892f9, 0xd93ec873, 0x87f7f662,
-       0x4e80e74e, 0x6abc30b6, 0x3d9ebc1d, 0xeec0382f, 0x7064905f, 0x67808f1e,
-       0xa40ead25, 0x3b6a6d3a, 0xef9b45a9, 0x028a1469, 0x62b8cf68, 0xfd028da6,
-       0xcf1e74eb, 0x84993d00, 0x416702a9, 0x3c79c992, 0xe4c3e91e, 0xca2c437a,
-       0x145f19fd, 0xc7a1fbd6, 0xf09c17d1, 0x31c99a38, 0xf9501eda, 0xf5df7a4d,
-       0xe353e4fb, 0x37e04c5f, 0x17d2ad23, 0xd144bf60, 0x0381bfff, 0xbcc46232,
-       0x2036b702, 0xe02be6ca, 0x7f4d06fb, 0x394b9db4, 0xed26fbc3, 0x48c1e4db,
-       0x4afc284e, 0xf0468a97, 0xbe038d49, 0xf6b538b5, 0x5f26ac51, 0xa9c832db,
-       0x1fe097b1, 0x72928f54, 0x577c08c1, 0xcba6d9c5, 0xd02e5b68, 0x538255f1,
-       0x6055f80a, 0x3aa3aaf5, 0xf0175e4c, 0xaf5be2cb, 0x46cd4172, 0x7c7eaf9c,
-       0x1a377e94, 0xbf8f7d8d, 0xafb9ec52, 0x6c7c8224, 0xcabb7ae1, 0x240afcc0,
-       0xf9c0764a, 0x1d924917, 0x6871d937, 0xd07e10b6, 0x51fb470f, 0xf33815e5,
-       0xd6b752fd, 0xcf91957e, 0xbf981acf, 0x6eefdf40, 0xe2e137e8, 0xb0d9abf8,
-       0x5bcc0a7f, 0x969ac78f, 0xca2f26f3, 0x272ffd15, 0xbf05478c, 0x6ec96295,
-       0x58afc291, 0xd5f70477, 0xc47924a7, 0x17a2df03, 0x96df8f7b, 0x9aaac274,
-       0xa1da4cb7, 0x7972bb9f, 0xdb75c447, 0x9f5f5407, 0x1e44bdfe, 0xa05cba01,
-       0xa0e354b5, 0xe4310516, 0xbbf5ed84, 0x618b2b9a, 0xfb0d3efd, 0xe72faa15,
-       0x38071290, 0x6349cb1d, 0xe7e7d80e, 0xf008a188, 0x87fc8e74, 0x4e8a8c63,
-       0xe2134467, 0x47efda89, 0xf6a3e3d5, 0xed4f26bb, 0x8cbe4d77, 0xe70894dc,
-       0x494f65d9, 0xfce02fc4, 0x127fe534, 0x79f7489d, 0xec01aea4, 0x5b12c59d,
-       0x1272efd7, 0x5f1d0a63, 0xe5cfabf5, 0x79fcd294, 0xca23d991, 0x38fcec79,
-       0xc08afe36, 0x9687936a, 0x731e6b1f, 0xda0455eb, 0xfd601bfb, 0xee08b791,
-       0xf8deaeb5, 0xd7e3aefd, 0x87b1578f, 0xf30b9d7a, 0x13af5471, 0x7648fe3c,
-       0x8533e711, 0x4e8c631f, 0x45237f8d, 0x9744bf97, 0x7fcba31f, 0x401f796f,
-       0x295ef234, 0xe38c537a, 0xfec37c98, 0x2376304e, 0xf86f7f3f, 0x5fe0bd49,
-       0x1fc283f2, 0xd13393ac, 0x8507e63b, 0xfc6bd19f, 0x5f824757, 0x5b4beafd,
-       0x2a9faa65, 0x41da795e, 0x6d3a7ea8, 0x53744c6c, 0x5dad57fa, 0x383e00ea,
-       0xc01d9465, 0x62fda7cf, 0xbe823f91, 0xf0a8d7bb, 0x8026c783, 0x49fe0dff,
-       0xff599fe1, 0xaeb0f5e8, 0x7256b17f, 0x9d6d5fa2, 0xf2a66839, 0xbf3cd35a,
-       0xfe616498, 0x3b2fcb08, 0x45be422f, 0xbf159fcb, 0x85d13a7e, 0x314e52fa,
-       0x8838ffa0, 0xd34d7ff6, 0xdd605327, 0x28dd25af, 0xd076fa67, 0xb87157ff,
-       0x629a953e, 0x46e3977a, 0xb3da113e, 0xa3f36d5f, 0xfc0745e7, 0x06fd03ab,
-       0xdce5fafa, 0xda332f8e, 0x1afea007, 0xfe83c64f, 0xfc41f052, 0x5f178ecc,
-       0xfc0b2e7d, 0x7e9b67a7, 0x785410ef, 0x27ace452, 0xaf57fb30, 0x97d6fabb,
-       0xd50e549d, 0x4f62a3f6, 0xfef85ab8, 0x55a595a3, 0x1571d052, 0xab5593d5,
-       0x3f4cb725, 0xc2f4bd57, 0x3f82cf8b, 0xf7668ff3, 0xf2bf0a70, 0xaf075da5,
-       0x8dcaf9a4, 0x366280d2, 0x18909b0d, 0xfd2d4ba6, 0x9876617f, 0x779b150e,
-       0xd8a35c99, 0xc2e307f7, 0xb8dca8f4, 0xf54644c3, 0x604147c6, 0x16c3a987,
-       0x23812e81, 0x12fec053, 0x09bbfd5f, 0xbb7a7ee8, 0x46a60640, 0x5deae7c0,
-       0x9e019f68, 0x4e9c8e90, 0xeae9ba21, 0x80ba52d7, 0xa4e8573e, 0xfae22f2f,
-       0x32b9e004, 0x7e5f9f91, 0xfe84e21d, 0xfcc37664, 0xdbbe5fcb, 0x6938f301,
-       0xfd7c63ac, 0x0f44d2dc, 0x925cb7ed, 0xb2989d13, 0xdfcfe5ef, 0x6f36fc8b,
-       0xcc89bdff, 0x6419e58f, 0x1e49b5c0, 0xbb9bf304, 0x5f9c16ea, 0xdf22f119,
-       0x96273f95, 0xdcfc7e80, 0x46368a48, 0x8d4f8b90, 0xb9380ecc, 0x74b81a86,
-       0xb2e9277e, 0xff337183, 0x14fc6221, 0x3f453f21, 0x2e7cbdd9, 0xfcc382d4,
-       0x4e8c51e7, 0x5c0d196f, 0xaf15a8ae, 0x65a6d7e6, 0x339f40ed, 0xe1033c43,
-       0x1896a5bc, 0xe10f8e65, 0xdc570a1b, 0xd190385f, 0x398cb887, 0xc3b51dbc,
-       0xd43be00a, 0x963c976f, 0xf23b4d2c, 0xffb86a4d, 0x74ff787b, 0x3f60d1dc,
-       0xbc8c4c9d, 0x2928180f, 0x71d74f72, 0xe4a97f15, 0xd37bc99b, 0x15be4cc3,
-       0x58dff779, 0x397fe504, 0xda07e4c0, 0xc748fac1, 0xe5881c15, 0xa809a63b,
-       0x1824cc0f, 0x249bae49, 0x72dad72e, 0xb8e84f85, 0x8a8c428d, 0x1c7e005f,
-       0xa6ed1fe2, 0x3b68a7b2, 0x85acbe95, 0xe1bd1cfe, 0x8f3b7229, 0x9009ffcb,
-       0xf2c3cbff, 0xb931564f, 0x95bedbef, 0x92553f11, 0x4167c5ff, 0xca7ca95e,
-       0xa957902e, 0xe9fde604, 0x3f83b686, 0x69f272a1, 0xad539140, 0x69cbd4fe,
-       0x097ba6f9, 0x4e5ea7f0, 0x475c1d3f, 0xfd29ca22, 0x074e511e, 0xea97fc77,
-       0x0e7f054f, 0x153fab49, 0x1e17d87d, 0xb7f0faf5, 0x53e21746, 0xefe90faf,
-       0xcde9c900, 0x29df0a7f, 0xdbf156fc, 0x77a061ea, 0xf0a97c42, 0x152f885d,
-       0x57cfd3be, 0xf97d3f8b, 0xd199f061, 0xf6bc9571, 0x4a1494fe, 0xc156aacf,
-       0xbb61766d, 0x78a790dd, 0xbfb330f2, 0x00ca7771, 0xcbafde75, 0x3df57407,
-       0xae897cba, 0xaf9757be, 0xb3f7d5d3, 0x9b4b487d, 0x041f2089, 0x45a5f535,
-       0xfc738644, 0xee226dee, 0x98e8bbbb, 0xaefb681b, 0x997ea90d, 0x16a583ea,
-       0x4eefbfb6, 0xfe803530, 0x3b7672ea, 0x616f20e2, 0x92aeb5fe, 0xcaac476e,
-       0x2ad23c3e, 0xf0edfea2, 0xfb48a293, 0x22d16a13, 0x5f483a9e, 0xa3bcece5,
-       0x5d0db450, 0x46977e08, 0x81ae0dd1, 0x39b7f539, 0xaba1bce0, 0xe986fd35,
-       0xb7dcfbf4, 0xe85f0c45, 0xc164768a, 0x31ec88b8, 0x0bed520e, 0x99f9114e,
-       0xb33e7489, 0x60fed95b, 0x5d9d0ace, 0x5f205641, 0x31eed994, 0xf6a45e81,
-       0x9fad51fc, 0x0577f19e, 0x4abe5787, 0x57b4ae5b, 0x4d158df6, 0xdf2f72da,
-       0x5c495667, 0xa3268c5f, 0x308f3ed9, 0xafd7093f, 0x0de66285, 0xbbfe29d3,
-       0xf80488f6, 0x4455a7a5, 0x106cf7fc, 0x226fe0fc, 0x4dca0272, 0xbd46e90d,
-       0x2ce9e0a6, 0x6fa985c8, 0xcb7673bd, 0xd00f3947, 0x3f5b552a, 0x9a77fac8,
-       0xc7fadd9e, 0xfe406f11, 0x3f4343d5, 0x17ebbd20, 0x79e0b76c, 0x3b76d76e,
-       0x6d76afc6, 0x01f437db, 0x7666bfc8, 0xb6bb38c3, 0xfc05997f, 0x5cc8b5d3,
-       0x6bab7a0e, 0x2cd7db08, 0x5665f6de, 0x4b93ae07, 0x90bf6e90, 0xa7aabed8,
-       0x858febf5, 0x59d29001, 0xddbffac1, 0xda9dfe8a, 0xa7182dd7, 0xcbedb5db,
-       0x87edaf1c, 0x3f0d4f9b, 0x93b2efbf, 0x7c609be9, 0xba7cecb1, 0x2f098df6,
-       0xabfed3d4, 0x6698779b, 0x3782f2d3, 0xfa059eff, 0xb3136bb0, 0x8ea53a6b,
-       0x7a7ce1e7, 0x8bedd2cd, 0x4ee78a24, 0x42648a10, 0x4df0d47e, 0x09199cbe,
-       0x7f477f2f, 0xf1f17f53, 0x7c18ffda, 0x53ef1808, 0x47f76ad5, 0xbfef3009,
-       0xe801fc7e, 0xe466ed81, 0x9fbe654b, 0xeed1ea06, 0x0fbcd8b8, 0xfdc7bcc3,
-       0x085bcd2b, 0x5fde67f6, 0xfbd393fe, 0xe385c921, 0x6f41cbd3, 0x1f76df3e,
-       0xbbb25fe6, 0xe4fdbc71, 0x7fa681f7, 0xa26fba31, 0x7c5c7774, 0xe4ff39de,
-       0xee9beef3, 0x74e2cf6f, 0x8c7de277, 0xe38eff37, 0xee7aaefb, 0xf3a1ffd6,
-       0xb373ec57, 0x8f3da4a1, 0x693a6f8e, 0x316183b4, 0x2f67a123, 0x8799c484,
-       0x8c0065fc, 0x8ae7e257, 0x332df1fa, 0x048ffdb1, 0x5fb4c6e7, 0xf7c08b72,
-       0x743f6c75, 0xae1fb73d, 0xf6865c1f, 0x661ef5e8, 0x496313af, 0x8858de49,
-       0x46e39aff, 0x3ec9273f, 0x2dfc85ec, 0xbb5e7893, 0x20577c2f, 0xe3da811e,
-       0xda2d0fd7, 0x0de9f603, 0x33418d83, 0xfa408f4b, 0xcf7f83be, 0x665feed5,
-       0xdbf9b578, 0xb7f36ba6, 0x82b77870, 0xbffb4571, 0x83f044b5, 0xf21a535f,
-       0x39f80254, 0x1112b9a5, 0xa9138804, 0x84fb0a5b, 0xedb44a5b, 0x767ec367,
-       0xf38f185c, 0xe153bca3, 0xa46a21fc, 0x61b8f880, 0x24fa8885, 0xf840532a,
-       0xc612b925, 0x28627e13, 0x173c01c9, 0xf35f198f, 0x0dce0633, 0xf1cf9df3,
-       0xd0ea4655, 0xbe1721de, 0x0e6266f9, 0xda0973f8, 0x843df34b, 0xf5ed475c,
-       0x304289b2, 0x3ce5ca9a, 0xb2639123, 0x9029cfc1, 0xa73f1aa3, 0x1fbf0f36,
-       0x5ce18625, 0xfc5f7eac, 0x7fa743f8, 0x347ffca6, 0x90cdda83, 0xf33bb9e2,
-       0xaafb29d7, 0x1e195b3b, 0x7f04ab6b, 0x5055f21a, 0x7c539f52, 0x85fe626d,
-       0x06383f3f, 0xe7ef2ae5, 0x7ed862a3, 0xcced032f, 0xf6676e5a, 0xf018aec8,
-       0xa6b4f46f, 0x02b1f3f3, 0x3f023787, 0xadfbe7ef, 0x3ef9c03f, 0x0b26bb4d,
-       0xfdd8228d, 0x78fd1ba4, 0x590b64f2, 0xee0e211b, 0xa7e29303, 0x1ffdc3a8,
-       0xa01cc4fc, 0xa3cdfb23, 0x54e2634d, 0xdd715b74, 0x6f566369, 0xa8efc03a,
-       0x1fe83cea, 0xefec2fc5, 0x2dfbaf00, 0x224a531d, 0x971cf7cc, 0xfeb7e2df,
-       0x6eb5f78a, 0x00954d6a, 0x164d372f, 0x9fa6e735, 0x75bef898, 0xe303190c,
-       0x1aeb7e2a, 0xcba004c7, 0xf70dd11e, 0xcf5b6ab3, 0xce11bc9b, 0x04f8f48f,
-       0x97dfe8f8, 0xcf8065dc, 0x42c7ff63, 0x8fb59f60, 0x4264e79f, 0x6e2674bc,
-       0x4fe03de5, 0x75e382fa, 0x7489d9aa, 0x4f38b9be, 0x66fda04a, 0xc3473b36,
-       0xaf325691, 0xad16153f, 0xc11c1071, 0x92f529da, 0x23bd58ab, 0xa44d6726,
-       0x128a2ff9, 0xfb8579f8, 0x9fe15cbe, 0x3f796e8f, 0x61f307b7, 0xeecc993d,
-       0x6be6f5d5, 0x53d1f282, 0xdf41f824, 0xf309fec3, 0xe03eecc5, 0x972b033e,
-       0x597a626f, 0x9e3d7be1, 0xcf0ccdd3, 0x3c05ff4a, 0xf0ccd23f, 0xc159e0a3,
-       0x4abc7eaf, 0xaeafaa7d, 0x6e21fb56, 0x32fd1968, 0xad3587ac, 0x4140d382,
-       0x4c3b18d5, 0x2db58720, 0x67e04b8f, 0x7062e19f, 0xa5907ae9, 0x6a9dd73e,
-       0x6debe766, 0x02cd57d9, 0x056cf93e, 0x7b684bb5, 0x0ef39ccf, 0x19f77758,
-       0xbdc1efdc, 0x915df949, 0x7d16fdac, 0x79cf81f5, 0x1aa364ed, 0xf38e2a6e,
-       0x093caae6, 0x57b726dc, 0xaa0690ed, 0x39aa69f8, 0xef95cb0e, 0x6cae55c9,
-       0xc3fb4ef8, 0x998fc871, 0x6787c409, 0x3ef1da06, 0xb175edda, 0x03cb0f8c,
-       0x4f984c3b, 0x7f4afac5, 0x797a3f4a, 0x8dac569a, 0xd05d99fb, 0x52f01831,
-       0xe3de0e6c, 0x9da7c08e, 0xbbe40e9c, 0xca1e13ae, 0x8bff59b7, 0x947b89d6,
-       0x2a43a275, 0x6c89c551, 0xa73d3335, 0x4606275a, 0xd416275a, 0x1d0206bb,
-       0x1f4b6c16, 0xe0b24208, 0x48c4c2ed, 0x3efbc4eb, 0x88785e76, 0x9aecdfdf,
-       0x2b89d746, 0x34c4eb54, 0xbe89f20b, 0xc4acdf9d, 0x9d645d61, 0x5ff6e850,
-       0x87de6fac, 0x7c822275, 0xd76b366f, 0x4b5b5b89, 0x75b89d71, 0x57b9a89a,
-       0xb17cdeb1, 0x712f2275, 0xb725e606, 0xbcff0235, 0x43e1edcf, 0xfa0ebe3c,
-       0x34e2f581, 0xde84ffe8, 0x7a5f46eb, 0xeafeb1fd, 0x3c26fff5, 0xc17d7a2b,
-       0x781eec2d, 0xc8243e6f, 0x50660bcf, 0x3f002ebd, 0xe0bebd32, 0xd317ee0e,
-       0xd012d9e9, 0x7ad563b3, 0xf1afb596, 0xb6a175b2, 0x3317f525, 0x1a4ff969,
-       0xad147725, 0xdeb093ff, 0xddeb51cd, 0x1377a0d3, 0x72dde822, 0x6b3f77a6,
-       0x53f6831d, 0x88fbf35f, 0xcfaa5beb, 0xf811dc32, 0xab4cfa63, 0xb1ce9ee6,
-       0xdccbbfd1, 0x4fb2f20c, 0x4fbb73c4, 0x77b01db8, 0x82c6eff4, 0x144a7a9f,
-       0xa71c4f1b, 0x5c8fa767, 0x81ea993b, 0x9ecc3982, 0x2220deae, 0x999a6afe,
-       0x4464d7fc, 0x3f345dfb, 0x26affb25, 0x636e57c8, 0x06746fe7, 0xfa2a79c5,
-       0x68ebee57, 0xe5703f00, 0x0fcf016a, 0xf019ce21, 0xb3e38f39, 0xfb895dcc,
-       0x80fc7d15, 0xe6ad17e2, 0xaeb7e6f5, 0x3ea9ff46, 0xe33aa0ae, 0xafb0d3da,
-       0x3a333628, 0xfc166f14, 0x1ce153ab, 0xfdcf575b, 0x541b9e30, 0xc7dfb407,
-       0x15cef9f0, 0x619b9983, 0xe89ef55f, 0x8dceb48e, 0xfca5e3d1, 0x7ecbc41f,
-       0xffb1978a, 0x17d2f1ef, 0x8f7da81e, 0x3e3d64fe, 0xbd7145c6, 0x82c64d92,
-       0xf0627e1c, 0xdf915ea0, 0x642e3111, 0x35c3e3ce, 0xa20bfef7, 0x67dabe98,
-       0xdc4036f0, 0xe2c35cae, 0xdaade647, 0xe6912bb8, 0x68c80667, 0x5bcf4770,
-       0x43875da9, 0x0bb37eeb, 0x7599f5d7, 0x1388051b, 0xfdefcb9c, 0xc71ffb94,
-       0x58ee12f7, 0x5a79d748, 0xd9b6767f, 0xfb9fe70b, 0x37a8dd2d, 0x105dbe15,
-       0x3a97ecc5, 0xc9638e3e, 0x7d7193dd, 0x289c116a, 0x5b0b418f, 0xe09d28af,
-       0x09b6871d, 0x74e14e5f, 0x16887e61, 0x4a5ac746, 0x29e79037, 0x8ebf3cad,
-       0x2bb781d9, 0x77e080f9, 0x7757a009, 0x085dec48, 0x9c0bc481, 0x11f5aa08,
-       0x12f2d5ce, 0x76de7455, 0x5afff184, 0xfc1f8dc1, 0x43efbff4, 0x9ef93ee7,
-       0xe5fd31d9, 0x0b4f0577, 0x6fde7474, 0x831e2f69, 0x1b8233e7, 0x8d68c7df,
-       0xe38573c5, 0x079dec8d, 0xcbd3b799, 0x5c3bec05, 0x8dcabf2a, 0x1f887030,
-       0x9c60b22d, 0xc69bf61e, 0xbded32ec, 0xd7135940, 0x4ee35df3, 0xda3b496a,
-       0x3178e163, 0x802637ef, 0xb5182457, 0xc8dd5c71, 0xfc003fe7, 0x02dfcdd7,
-       0x3139249f, 0xa76ef46e, 0xeec9ddf2, 0xdb7cf06f, 0x33439c90, 0x5b3f7e29,
-       0xdd79e22e, 0xc1d7066d, 0x1e6fa089, 0xcbc80891, 0x0f257b67, 0xb8ac075b,
-       0x3bee94ee, 0x4a5ef786, 0x2911ec59, 0x2fad887d, 0xfe78f8c7, 0x0f6dd744,
-       0x604844f8, 0x4dfbc41c, 0x7428ef73, 0xec64df81, 0x2e70a5fe, 0xf3817376,
-       0xe7a041e0, 0x93bdecc3, 0x700bcba3, 0x4ff7769f, 0xc3b79405, 0xfed06e94,
-       0x07a96996, 0xef7ed20f, 0xe7809e58, 0x093d335c, 0xd7b9c2b7, 0xdba2bdcc,
-       0xbecdeb45, 0x73836ec1, 0x4523a9af, 0xe7e155e2, 0x7e8ed20e, 0x3f75999a,
-       0x5dc605bd, 0x3143d74e, 0x85fdd215, 0x4abf2103, 0xb2b5f6c0, 0xb29034d7,
-       0xf3cafb4e, 0xffb4b1a6, 0xd00f5a32, 0xd58abb5e, 0xdc126dab, 0xd65b7a10,
-       0xcbea38fa, 0x1f0126b2, 0xf6a76896, 0xeb83146f, 0xdb70a28f, 0x34f6d157,
-       0x03da0f3f, 0x5bd8a6dc, 0x96ab3ce1, 0xe7db138e, 0x6479e3d6, 0x8b476d19,
-       0x4fd37b49, 0x55fcde11, 0x447b8102, 0x8fa9b9e5, 0xbdbc02e5, 0x0fca1b92,
-       0xc625f8ed, 0xfda2cc8d, 0x67f0a20d, 0xe8851d8b, 0x70407b57, 0x83233be2,
-       0x5d7e9033, 0x70686130, 0x64fd0d3c, 0x42e9d718, 0x71d51834, 0x1616c908,
-       0xb0b65cdf, 0xd5e601be, 0x1aa42721, 0x9bceaf90, 0x4e3f1d60, 0xf6a5edf1,
-       0x8b1331eb, 0x8f93686f, 0x7a543a99, 0x1d25bc74, 0x969cd8f5, 0x9f2f3c3c,
-       0xbcf04a4b, 0xeccf5bdc, 0x2d4b2391, 0x30ec017e, 0xbe1439c9, 0xe3352db7,
-       0xd897cef7, 0xa439d3fa, 0x27a1fd03, 0xee044957, 0x955e2d39, 0xf1d00cfe,
-       0xf90906e4, 0x424e7c4d, 0x25ef363d, 0x5b6b27e6, 0xbc9ee0c5, 0xcfdec4c7,
-       0x9f9a7281, 0xff651bf7, 0x6563d5ab, 0x53d40aae, 0x2bd4bd7a, 0x7aa9efee,
-       0x2f6cb013, 0x14cf757d, 0x741557d4, 0xeb4601dd, 0x3706afa5, 0xaf52bfa0,
-       0x4d896aaf, 0x10d953d1, 0x3d5a5237, 0xe04ad664, 0xc0583be3, 0xb5f07b76,
-       0x75869fcf, 0xe04ecab7, 0xf9d18d4b, 0x82f8c08c, 0x6cccbc80, 0xc839f8dd,
-       0x0b4cf941, 0x0273bbbe, 0xb37200e8, 0x59c59e22, 0xdf114bf9, 0xbce51c4a,
-       0x573e5a95, 0x7867b5ce, 0xaf51e245, 0xe256e55f, 0xf43bd551, 0xda57e510,
-       0x822d9dcf, 0xfe4022df, 0xc77beec8, 0xe389de62, 0x83edc85a, 0xe7e47615,
-       0x5f9ff743, 0xeb3afc0a, 0xbd808141, 0x036f644e, 0x2b3587ac, 0x65f81705,
-       0xdac83de7, 0x61eda3cf, 0xc97e87dc, 0xb7f28af8, 0x66bff80b, 0xb1bbe3d5,
-       0x02e0937e, 0x975687f8, 0x2e513da2, 0x9bcb048b, 0x81fee08e, 0x5f1853ae,
-       0x898b26d4, 0x4b35ffc0, 0x95304ecc, 0xf8523e14, 0x17bf08f2, 0x59dca24d,
-       0x9f76d337, 0xde849000, 0x174e28fc, 0xf029eb42, 0xf8ccad49, 0x924bc8ec,
-       0xe2e6d81b, 0xc3eec97c, 0xabebe49e, 0x532ddcf8, 0xd73cc106, 0xb68638b2,
-       0xb0260555, 0x05fa4e23, 0xcdef8f3c, 0xb6a6c497, 0x7cbe14a3, 0xfafa604e,
-       0xbda87162, 0xa5f38ef8, 0xa9947fc2, 0xb5595f71, 0x0f702257, 0x5e8fcf57,
-       0xc42b7029, 0x4cbe940b, 0x5bc743e7, 0xda3f70d0, 0x691e0aeb, 0x65f2113e,
-       0xa1ef1646, 0x91b543c8, 0xe77d05c5, 0x37fae9f1, 0x7961ec5b, 0x4adc5910,
-       0xbbfbf690, 0x9c602f0d, 0x47f5b9dc, 0xe6fb47ae, 0x8007ca0d, 0x12760dff,
-       0x1f87fdc4, 0xb34550f5, 0x4238c1e8, 0x66e73063, 0x895dbed5, 0xc57ca897,
-       0xd8aef88e, 0xd317f664, 0x8f5b15f6, 0xf5f9e165, 0xe78c6ea2, 0x680bd790,
-       0x23b9131f, 0x546fee0b, 0x86dc5918, 0x64582ede, 0xb3aa7e61, 0x83a759af,
-       0x63ac26dd, 0x045569ef, 0x2acc936e, 0x16fdeebf, 0xe787a949, 0x33a53229,
-       0xf18693dc, 0x5271dfa9, 0xfece35e2, 0x455ff186, 0x5cf6848b, 0x9d8dbac5,
-       0x71577f10, 0xdcfb8cd8, 0x31e775da, 0x95e0b89e, 0xae1df097, 0x135116da,
-       0xee2bd57f, 0xe7889d69, 0xd5cd351b, 0xf341bf18, 0x1351ce78, 0x77ff1c88,
-       0xca9cf8b1, 0x956db657, 0x372b0a29, 0xef81daff, 0x75afb572, 0x7593bde0,
-       0xd8771edf, 0xf029ce2b, 0x39c6b7f0, 0x507f819d, 0x45adfac6, 0xd644e71b,
-       0xc746bd31, 0x9ee91397, 0x7adec841, 0x21e7f3e9, 0xa6ecf70e, 0xf1879f4f,
-       0x67e7fd56, 0x061c43cf, 0x82716ed9, 0xfebb523d, 0x54638c7d, 0x30b2edda,
-       0x37f3affb, 0xcff8c6bf, 0xdd9a3fce, 0xdb73ad00, 0x6f60a1c9, 0x6bfc6e74,
-       0xde75c422, 0xfd10adb3, 0x296cf739, 0xf8224818, 0xf814940b, 0xf88fdfd6,
-       0xdabd3d53, 0x5e30db9a, 0x37a51ce4, 0xdc5087e8, 0xc59aa05a, 0xbc78ba01,
-       0x71c886da, 0xd3e2bdbe, 0x61be6f9a, 0x66c5e812, 0x345c1766, 0xa500ed4e,
-       0xa0fd15e3, 0xb98786df, 0xbf4c893e, 0x4a0ff073, 0xfa3a63a7, 0xf73cde7d,
-       0x5942cf57, 0x719f7c73, 0xe07ec16a, 0x0e23894d, 0x169d3c58, 0xbf4d9b90,
-       0xa040b8c5, 0xf40bb15b, 0xc143e7f3, 0xea4a7c2f, 0xf743ff46, 0x5bde3336,
-       0x0876d8ab, 0xcb73a7e5, 0x25d38c7e, 0x93b79e3c, 0xfe2c7e84, 0x6a7afb92,
-       0xbe2cec9b, 0xe21fe38d, 0xfc0e5cdf, 0x18dce3ce, 0x6ff12b1f, 0x0dbdc57d,
-       0xefe34e8f, 0xbcf8b02a, 0x780fa6ea, 0x5e98591c, 0xe9d02e42, 0x13c6b7c8,
-       0x0270782a, 0xe3abc61e, 0x17c72338, 0x397de286, 0xa07e80bd, 0x9a7143a7,
-       0xe2183f34, 0x21c2fcf6, 0x741f4112, 0x9ff166ae, 0x1ef6929d, 0x2c3e9868,
-       0xad15d3ae, 0xff7f5393, 0x362f39e2, 0x9f8aeffe, 0x269768d8, 0xd3c151ae,
-       0xf5910bd9, 0xf0b44178, 0x9a93dd8f, 0x05efe823, 0xc02747e4, 0x1311f979,
-       0x7c5e7bc1, 0x37dca4ff, 0xb3b4fee2, 0x0b8c45eb, 0xa1b4086c, 0x8bebd71e,
-       0xa24e7e1a, 0xd12def1f, 0xb4d54f4c, 0xece275b0, 0x46dfbb26, 0xeb7d9ce1,
-       0x9ae7e435, 0x324c470d, 0xdd7bb785, 0x2b8b1366, 0xeb03f260, 0xfe355f84,
-       0xc8ef2fb3, 0xdfcdbd42, 0x33f7d215, 0xdb53f79b, 0xda9fb91a, 0xfd35e70d,
-       0x9301ca54, 0xfef176d3, 0xb73d18ce, 0xed33bc01, 0x133a5ecc, 0xdd228b10,
-       0x2d12998b, 0x2373fdf1, 0xf5d373f3, 0xb257df12, 0x4494f7b3, 0x5fda3447,
-       0x0f73d8f7, 0xd4800cc7, 0x8b127184, 0xc55c79eb, 0xa024ee43, 0xb5fb62f7,
-       0x14bbc604, 0xc7daabf0, 0x012f4e4b, 0x2a4a4dbb, 0x673eab19, 0x1a6fc651,
-       0x157e2060, 0x17b1effd, 0x27fd840d, 0x6183ca31, 0x7da7d71c, 0xaff58469,
-       0xf7fcc7dd, 0x0cb1c2e4, 0x746edef8, 0x70a78aee, 0x6e0b27db, 0xe6f6bd70,
-       0xe43f067b, 0xdf68f04f, 0x7a588485, 0xdb8f5f98, 0xdda0f680, 0x2ad27410,
-       0x4f696ec4, 0x8bac0dc2, 0x18898cb8, 0xe8718f02, 0xa6a2f88f, 0x073abdc1,
-       0xd429e6a1, 0xef351b73, 0x1ae4c424, 0x9026ef75, 0xbd741903, 0x557e71b1,
-       0xf67672fc, 0x03b70a6f, 0xcd8863df, 0xbec0f524, 0xb45eec2b, 0xefe49e1b,
-       0x48dfd058, 0x23886788, 0x3bf56ed1, 0xcd5fb42e, 0x5fb410fb, 0xa3d63e4d,
-       0x1917c7cd, 0x5f5a478f, 0xa638f9e2, 0x43c43688, 0xd941a16c, 0x4f0f15af,
-       0x363b8f0c, 0x5083b881, 0xe30d9d7e, 0xc978a9c0, 0x6cd879ea, 0xf1d371da,
-       0x4c44f469, 0x606c8766, 0x777cd4e3, 0xf3809712, 0xd3bf68f7, 0xdbf26af1,
-       0xaa3c79a3, 0xdf411891, 0x09daa2d9, 0x068f7fc7, 0x7b8c4bdf, 0x7d022487,
-       0xcb57df08, 0xc411ee04, 0xfed079f0, 0xe09df535, 0x6bfd601d, 0x4ec190e1,
-       0x2bbf7df5, 0xccb7faf8, 0xe81ef25a, 0x75619c9b, 0x313bc818, 0xbde26489,
-       0xa801d6d5, 0xe616d29f, 0x2f346393, 0xcabe3234, 0x6e504158, 0x9c59ba32,
-       0x8d12590a, 0x8a39a8f6, 0xb86c96c8, 0x296444c7, 0xf3f17a1b, 0x22d725f3,
-       0x5c650503, 0xb68d794e, 0x37ceed6b, 0x0844a5cc, 0xbf851140, 0x31f3da37,
-       0xa370dff4, 0x1a30c937, 0x74b7de3e, 0xda9460e7, 0x6823c14b, 0xb5ddee10,
-       0xe90b0867, 0x089af781, 0xf01777b9, 0x4f286378, 0xbacf7082, 0xf7943a31,
-       0xdf7d5144, 0x67f2c698, 0xba5defa3, 0x3fbbc29c, 0x346ce4a6, 0x79ca278c,
-       0x05779e19, 0x17fe70e3, 0x71945f5b, 0x98ea6c8e, 0xf9963d12, 0xcf1de14d,
-       0x3dd0f6e1, 0xd7875c6a, 0x107c94da, 0xcd2511f7, 0x55af51fb, 0xb963f607,
-       0x1d34f201, 0x2531df16, 0xeb109625, 0x930b4ba3, 0xfd78852e, 0x9d0324d2,
-       0x974780e7, 0x60fb82ee, 0xa23c3c61, 0xb0d183c1, 0x499ed77c, 0xdf2c3c6a,
-       0x7f487605, 0xbac030f1, 0x89f2e97c, 0xe5379ffd, 0xc42b788b, 0xf019e43b,
-       0x87f1a5dd, 0xa15fe86d, 0x47ae0b3f, 0x3eeace1c, 0xfb2abfee, 0xc5270a11,
-       0x5fcc2e3a, 0xaf853b4a, 0x749be2fa, 0xbd8cbce2, 0x9fe5a7af, 0x0327ab62,
-       0x7ab70de0, 0xe1c6d9f6, 0xf63ef1fc, 0x3dd7af54, 0xaf984c79, 0x063bcd89,
-       0xb32ef7ee, 0xaaca35de, 0xcd4ecbf2, 0xd1a6205b, 0x2c8166f1, 0x93e78424,
-       0x8cb650b0, 0xf04cf3a0, 0x7ace3018, 0x063bd599, 0xef4c71fa, 0x8495d20e,
-       0x31de009a, 0x0b961882, 0x6d86bfa5, 0x50debf6c, 0x622ff06a, 0xc002bde7,
-       0x8747f30b, 0x19ba3f8e, 0x411cb47f, 0x3d69a8fe, 0xa5a3f8c2, 0x0bf81f3e,
-       0x9f60cdce, 0x47ba48df, 0x79afdd03, 0x48d0a9b4, 0xb5987ff9, 0xf28521bb,
-       0x14d64485, 0x788a5f16, 0xaf8c31fd, 0xf8f87d17, 0x45f57994, 0x693dc6df,
-       0x7ec2668f, 0xcf01af72, 0x85bc14bb, 0x8b2b07ec, 0xf7641c23, 0x6a7e834e,
-       0xc3763b73, 0xf9ed37f4, 0x70db8c0f, 0x0769bdec, 0xa34c77b4, 0xfb857214,
-       0x08bbdc6d, 0xa46dcbdf, 0x319000f3, 0x75865ba4, 0x307c6fbd, 0x03e109f9,
-       0xc04c9eec, 0x979411c7, 0x109efcf5, 0xffbc3b95, 0xdecacc3a, 0x65679865,
-       0xac07e7fb, 0x1d994f22, 0xc7b7b096, 0xdaadfb04, 0x9fac0625, 0x7aa66900,
-       0xdeb04bfe, 0x26a35603, 0xa7a14e5e, 0x93544fc2, 0x877de15a, 0x3def588c,
-       0xb389fe5a, 0x29e0a9a6, 0x11f31eed, 0x4a0c9cf7, 0xdd779d87, 0xe52aeb0d,
-       0xed351b9f, 0xc0164946, 0xf81f529b, 0x687d1233, 0xae8c45bb, 0x17b05671,
-       0x205cee36, 0x7f42f9c2, 0xef039ae9, 0x39fad1c7, 0x89b75256, 0xa189cfb6,
-       0x79e3e429, 0xa7cf207e, 0x43fd34b0, 0xdfa041b7, 0xebbf7357, 0x171e56b3,
-       0x065e7460, 0xcb3c53ef, 0x29313af1, 0x4505d71a, 0x8066c16e, 0x3f236b73,
-       0x4eeb4ebf, 0x14dd0033, 0x1b763639, 0x68ba7682, 0x065d19a5, 0xc7786388,
-       0xec6de747, 0x7b5cef5b, 0xa7bfbb29, 0xa732feff, 0xafb6f7f3, 0xaf75eabf,
-       0x4ba065f7, 0x63c75475, 0xcd7cd137, 0xf9e19fa5, 0xcd6b22e0, 0x3b73ea55,
-       0xff1faa7d, 0x3a4e173b, 0xfcec3ec0, 0xc9145cca, 0x32b0eece, 0x6f8f77fb,
-       0xec53b63a, 0xe815242e, 0x413df564, 0x5768a633, 0x1e5508fd, 0xc63651d0,
-       0x656afac1, 0x75aba4fe, 0x147f03f7, 0x42bd7e64, 0xf41238d2, 0x5fd58e64,
-       0xe5c38b8c, 0x481718e9, 0x51f662be, 0xce0ffd14, 0x79f90a97, 0x73b0e798,
-       0x397f2c27, 0xe3938d31, 0x2a4c7ea0, 0xda23cfc2, 0xe272b9f7, 0x5de82365,
-       0xf08a9e92, 0xe574a20a, 0xd1da0903, 0x30cb92e4, 0xa890ab9e, 0xbe3a31ec,
-       0x6fc6749c, 0xba964753, 0x9feff327, 0x6cfaf301, 0xd61319c4, 0x66b8d7f3,
-       0xec6b27b8, 0xe8374694, 0x5dffdfed, 0x3c5233bc, 0xe31b78c5, 0x12be3dc7,
-       0xeb339c37, 0x12ef9af1, 0xbd5dd896, 0x9fc7abf1, 0x3e0adf1e, 0xfbcb78f5,
-       0xce393dd0, 0x7a3f1bd5, 0x5074287c, 0xc7c7acf0, 0x8a6ff03b, 0xcd3277af,
-       0x3bdacef8, 0x77df8646, 0xdec8b9a8, 0xfda0f46d, 0x43c7c85a, 0x4fb457ed,
-       0x6eec120b, 0xe29e1ec6, 0x78f0c4c2, 0xe3d578f5, 0xe3bf8731, 0x7c446242,
-       0xe0377447, 0x0161f28b, 0x7ed04c1c, 0x7099b60b, 0x578248ff, 0x06fc7513,
-       0x47be061d, 0x17973577, 0xd6392f05, 0x00b19dba, 0xe78a9ccf, 0xa57f57d7,
-       0x5b0b67b5, 0x7f069ca7, 0x778c4e40, 0x8941f809, 0x5f384a98, 0x15f2d51d,
-       0xd535971f, 0xa8eaf9cf, 0x9198af8e, 0x0bcacf13, 0x74f2ba9d, 0x85507e82,
-       0x56f3f4ef, 0xf815ebf8, 0x9e37a130, 0xb2cafe14, 0x993bfb71, 0x387b060c,
-       0x31b1b5eb, 0x6b499fa0, 0xc3bf445c, 0x2125c3f8, 0x914f9c38, 0x0de2050f,
-       0xffa6777d, 0x9daa7a03, 0x3f2a82ae, 0x5bd10cc0, 0xa7a08b60, 0xc4993e14,
-       0xc88935e9, 0x347fc03b, 0x12ff1889, 0x5553f7b2, 0x99e657f3, 0x9e605242,
-       0x4c5d58af, 0x8679f3bf, 0x47cd4de6, 0xde44fba0, 0x1b28c4ff, 0xdd20b7de,
-       0xfc21b3c6, 0x32bbe1a7, 0x3c2e29b2, 0x27d7890e, 0xb308eb43, 0x7be266d7,
-       0xe42f14b6, 0x1c786b1b, 0xc4609b5e, 0x38f85677, 0x928badce, 0x79ed4e21,
-       0xec073bd1, 0xdec2b3b8, 0x319f9c2c, 0x37d60238, 0x2d67f97d, 0x9ca06b3b,
-       0x7ac32bd6, 0x2295fc7c, 0x6f742ff3, 0xa4d7fb33, 0x52876df6, 0x4075c671,
-       0x70899f91, 0x900af15f, 0x8c0a60b7, 0xca586afb, 0x7cfdba68, 0xf2fbee39,
-       0xd08db25a, 0x299eaecf, 0x4f9f9718, 0x5fb0463c, 0xe7af7cf5, 0xeb3f3d6f,
-       0x8fec37f9, 0xfb0a1ee8, 0x2fcaef90, 0xe2169d8a, 0x6f94c39b, 0xc29beb54,
-       0x1e7f942f, 0x8d75bc05, 0x3019e4fd, 0xfd8df7ab, 0x37d6112c, 0xdb0f0ec5,
-       0xa0c79e1b, 0xb8f65f5e, 0xbbff8762, 0xf034fbcd, 0xcf7491a3, 0x2369f682,
-       0xefb8065d, 0xf3cdb6fe, 0xec577c0c, 0x2bed8b93, 0xe1ba4ec8, 0x8b337ca5,
-       0x206021d3, 0xbcabdef8, 0x753d4040, 0xa096e907, 0x24ea3bbf, 0x9675fecd,
-       0x07e3fba5, 0xfeb03ce0, 0xf2078c12, 0x889a9442, 0x715c59ed, 0x31efbf03,
-       0xe0047bb2, 0xda85cef5, 0x64d8f8f6, 0xcd5df84e, 0xafb6058f, 0x48e9659f,
-       0xa5b47b80, 0xbebeb6b2, 0x7a1e657f, 0xb576fab8, 0x78219dfc, 0xb2add8b7,
-       0x31b55e0b, 0xde34263b, 0x03bbf877, 0xf006df14, 0xea5eb4d7, 0xff02247f,
-       0x2a37a92a, 0xaf18d32e, 0x99b62fb2, 0xff7a47a7, 0xc147e943, 0xaed24cf7,
-       0x916ff3e0, 0xe89a2fde, 0xc37dfb65, 0x79cd4153, 0x746692bb, 0x2ebb464f,
-       0x1da02023, 0x33c8155d, 0xf3d8d6cc, 0xcbdbbf6c, 0x2977879e, 0x0ef37ea0,
-       0xea07cf66, 0xd5505f71, 0xab37f6cc, 0x99398ce1, 0xed13240f, 0x15bed0fc,
-       0xe1aaa0e2, 0x1e563f9d, 0xe9e6ab84, 0xd7feac8d, 0x87a685b6, 0xe9df6033,
-       0x34dc924d, 0x86a1e2bf, 0x6a3fba28, 0x42162548, 0x5d7f47f7, 0x1594d0f1,
-       0xe2ca54b9, 0xc589023c, 0x426d837c, 0x5fc9f7ff, 0x01b078af, 0x7f74c9f6,
-       0xed5363d5, 0x8f92fb5b, 0xe21736e3, 0xeafdafb1, 0x5f2531fd, 0x077e54db,
-       0xa27bfd3d, 0x7fc0315c, 0xf47df30f, 0xc2ef0bb5, 0x92e581fd, 0xde21430b,
-       0xbba7226b, 0xa9fdced9, 0x3acf7656, 0xed9af45f, 0x5d6fdf20, 0xe27e0118,
-       0xc31e4677, 0x7f2b597d, 0xafaf716f, 0x8523ed1c, 0x6676718e, 0x697b5fd7,
-       0x15f6039b, 0x03fb8dd7, 0x673f0fde, 0x9d99ef64, 0xec6935cd, 0x856c87d8,
-       0x495f0071, 0xd044da29, 0xeec713cb, 0x7ceb0c3c, 0x5843eb5f, 0xd0047bff,
-       0xfec2e4ff, 0x69df3c44, 0xbf00e5de, 0xdf7e59cd, 0x5b735cfc, 0xad345de2,
-       0x0707f8de, 0xf9d2a7ec, 0xdb19cefc, 0xaa9b7df1, 0xcbbe222d, 0xbc4dfb40,
-       0xcdc7fc1d, 0x611e73b3, 0xd7a944dd, 0xd5dfc23f, 0x49bfec50, 0xaf9fb251,
-       0x12df8a87, 0xbab8e1df, 0x1c58f459, 0x73c0edbd, 0x2c9ed27b, 0xc9107a06,
-       0x1a3e1c3d, 0x0bb44ec9, 0xfd0df9f9, 0x7ef784ed, 0x9bccf3b7, 0x7cdd9fcd,
-       0x73913215, 0xd802e5c9, 0xcc01de47, 0xb0f4c739, 0xfd5dbf62, 0xa93fd695,
-       0x5bf31fb7, 0x21492f47, 0xdef60f88, 0x1fc9b77b, 0xec2ecec9, 0x9ed1129e,
-       0xc471e424, 0xf496f657, 0x4cfef0a9, 0x2706dbf6, 0xcec83bf4, 0xf9b6b1f8,
-       0xa51f7c33, 0x856f0486, 0xd1669af2, 0xa6df2419, 0x1efc979f, 0x57545efe,
-       0xbe02e4ab, 0x15dd6aed, 0x16f90595, 0xb55dfd11, 0x0e5e26fb, 0x2ad9d67c,
-       0xb5213be1, 0x80713edb, 0xf7d6501e, 0x7ef656ce, 0x31eb5748, 0xedc0aefc,
-       0x1cbf896c, 0x068d9dd6, 0xb9dcbfb6, 0xd0566ffb, 0xe85e6f0b, 0xad7dc789,
-       0xb6f73eb2, 0x052f117f, 0xbfe43176, 0x44bfdb55, 0xe200789c, 0x24630a9f,
-       0x3b610a22, 0xfcfad7b5, 0x27625921, 0x7ce9d7bd, 0x08c5f758, 0x37c735eb,
-       0xfc08cfed, 0xefbf5fae, 0x6a7b73b5, 0xf786c908, 0xc42e5af5, 0xcdbde257,
-       0x1173ab56, 0x5d985ffa, 0xccf3b5d2, 0xfbe15313, 0xdbdd915e, 0xdf2220bf,
-       0x72bdb5bf, 0x8d4d8758, 0xd7a406f7, 0x77ce8317, 0x7feb41be, 0xf99a2bb1,
-       0xcbee8da3, 0xc206f7d5, 0x5f1cfdf5, 0xae7664c1, 0xbbc32725, 0xeedbdf38,
-       0x2ef5eeec, 0xb47613d5, 0x80a7bb3b, 0xeab11dfa, 0xc5f40988, 0x53c97b20,
-       0xac040f4c, 0xe4991780, 0x6fda10a7, 0x07c93479, 0x27aeeafe, 0xdba3884e,
-       0x0060c7b2, 0x9b5d8cba, 0xeb2ef18a, 0xfcdfb9f9, 0x5529a340, 0xf3e65fa5,
-       0x9253a373, 0xf54e343c, 0xf4c1d93d, 0x155da9c0, 0xf93d42bf, 0x1e193347,
-       0x1bfc5d61, 0x4d9b67d7, 0x500dd4f2, 0xf701a8ef, 0xbf773b1b, 0x69de1bbe,
-       0x35d87f9b, 0x0399d61a, 0x5eb40f20, 0x0df5decb, 0xf2db2f10, 0x6aef4121,
-       0x68a9534e, 0x41befda0, 0x760fcc5c, 0xe0fb80c0, 0x7890ff90, 0xfb9e61e2,
-       0xf9bf6ced, 0xe6831ec6, 0xfe0de99c, 0x765be83e, 0x33b7c189, 0x3da6d43f,
-       0xb7a0f1f9, 0x6fbdd907, 0x8f6b1e00, 0x5c383477, 0x6299bf61, 0xb0384d27,
-       0xfa28ea69, 0x0d6709cf, 0xebb7204e, 0xe6111ac0, 0x48453aeb, 0xd97a40ac,
-       0x2ede144d, 0xce37bc35, 0x1c747832, 0x2a9c816f, 0xef2ba7f8, 0xff3499a3,
-       0x0e31bb46, 0xfc14a4e2, 0xfa50f32b, 0x67880577, 0xc9450db5, 0xfc5be9b3,
-       0xe69c4ab7, 0xde512718, 0x9cbe4727, 0xcfbcf76a, 0x3b4641f8, 0x68aed4f6,
-       0xf33647b4, 0x95248c75, 0x29fc030e, 0xa782fa74, 0xeafa78ca, 0x075f3cff,
-       0xf2bbf494, 0x25c97af5, 0x77f0df23, 0x30725cfa, 0xb1e21d2a, 0xeff1d25a,
-       0x55e2a8a1, 0xa93e03cf, 0x87f8d602, 0x060c3a5a, 0xb3554fb8, 0x67c5884d,
-       0xd769fa42, 0x18ccf886, 0x396bfe40, 0x2b8e504c, 0xf994fdd6, 0xe1bea8ef,
-       0x79e157ef, 0x3f0fc834, 0xd0241e97, 0xeaeb4274, 0xdf8829c5, 0x2ae403a0,
-       0x372a278c, 0x9a35d690, 0xdfe75f80, 0xfc79d2c3, 0x4afe777c, 0xd967ca2f,
-       0x67a7162a, 0x38e2a475, 0x257e71ce, 0x8864e886, 0x1bb068e3, 0x4fc9f134,
-       0xdd3dbe70, 0xf41b64fc, 0xd62bf94b, 0x6cafcb41, 0x1819fc79, 0xa7afc2ae,
-       0x5384249b, 0xff3dad1e, 0x7830744e, 0x7e300e5b, 0xe524d09f, 0x1349fbc3,
-       0x7f04e264, 0x6b4d1bf0, 0x6fdfd045, 0x32a73f00, 0xfd758739, 0xac47aed4,
-       0xeef5833f, 0xdf808188, 0x9489b379, 0xc5c9546f, 0x6aafd5ce, 0x5d62b7e4,
-       0x6ff454fd, 0xa009c477, 0x55b915e7, 0xe4d9bef0, 0xffe506be, 0x4ffc9d7a,
-       0x418bed66, 0x27bd6858, 0x593ffcb9, 0x7e9fe544, 0x158a6d8a, 0x5366ce00,
-       0x26b4f7e4, 0xff1fbe39, 0xf1eaf485, 0x92757a5e, 0x1de7ed83, 0x9affb4e9,
-       0x3f707aeb, 0xe71f1a1f, 0x2b27279b, 0x002a937c, 0x05291bfe, 0x145f0033,
-       0x68cfc0af, 0xcdbe82b7, 0x8277c34b, 0x22e3f37a, 0x234ddce5, 0xa6bd61b7,
-       0x06f7afc8, 0xe4ce4f18, 0x5f60c5ba, 0xc8cb17c7, 0xef05a7a7, 0xaeba38b0,
-       0x8e79069d, 0x394617a0, 0x42f91e98, 0x11de6af2, 0x920e3def, 0x4e5d7c0c,
-       0x2f306a77, 0x02704ab2, 0xd772947d, 0xe09fbe2a, 0x4aef94f0, 0xfde37bfe,
-       0xbdfcbd2f, 0xb8718e55, 0x6420999e, 0xad9f8473, 0x47c84467, 0x6b8620b9,
-       0xe6de4193, 0x27ec75d3, 0xb4ec75aa, 0xaafc88d4, 0xce3ee1e0, 0xb2c45fef,
-       0xfce70f79, 0x3f6c0d31, 0x173f37c4, 0x81468c13, 0x3028b5c9, 0xfe011779,
-       0x5e575de9, 0x5d7f7c83, 0xdcafbe64, 0x33f91ab0, 0xf789c8b6, 0xba349e41,
-       0x9199b12d, 0xd31fb1f4, 0x817f6b9d, 0x63e02bfb, 0xe4befb90, 0x80e41ca0,
-       0x3f7fe044, 0xfd157fe5, 0x7ca03e14, 0xa54384f1, 0xa17cf427, 0x7829df9c,
-       0xff3bacd9, 0xf5c1c8fb, 0x7d5d4f3c, 0xf328a1c4, 0x3e74def9, 0xbfce8bdb,
-       0xcb0e7461, 0xd15bd017, 0x9c818f13, 0xce5beb8d, 0xac4e316c, 0x6cd1f0d7,
-       0xe468fb8c, 0xde0140e7, 0xe7dd685f, 0x39d7d9fc, 0xf7ab32ce, 0xe0fe3575,
-       0x1995d1bc, 0x6e428fe6, 0x6b582ed7, 0x8df473c6, 0xbcb3c984, 0xbeafda33,
-       0x5234e9a7, 0xfaa29403, 0x09e7d01d, 0x21070ab8, 0x22685aef, 0xf83f7419,
-       0x4ee96a45, 0x71f9a788, 0x8a3c5cbb, 0x49a363ce, 0xee1d769e, 0x00d7dc0b,
-       0x0d8a6bfc, 0x88af884e, 0xf00538f5, 0x004ba043, 0xeb2f70e4, 0xfbba4c67,
-       0xbaafdc72, 0x1f4063dc, 0x52f4e01c, 0xa1e0abe8, 0x2faef5af, 0x9862daba,
-       0x72f0245c, 0x99791ebd, 0x4f034dcb, 0x6447ae2f, 0x41c9e411, 0x18448bbc,
-       0x07a644ff, 0x22647a43, 0xcfbe73c1, 0xf3e47a75, 0x7c8f5e1f, 0xb923d1ae,
-       0x08f5111d, 0xff9445fd, 0x68b9a684, 0x91c392cf, 0x862959ed, 0xb009c7ad,
-       0x097ad28e, 0xa1fbfb32, 0x52df3807, 0xc438c48e, 0xc63326c6, 0xc87a2b5d,
-       0xc3e48d31, 0xc0753bdf, 0xa6b50bba, 0x824f0f79, 0x9324d7f3, 0x4f83ce0b,
-       0xf748dd4b, 0xdcc374d3, 0x2251fc88, 0xe823bd00, 0x0b7e0223, 0x99834ff9,
-       0x456c5ddf, 0x48505939, 0xb9dd1d70, 0x55f23c76, 0x009a7179, 0x2eb15b7c,
-       0xb8f28056, 0xe8034ec9, 0xe31e652b, 0xc6481a17, 0x94839418, 0x8c1c9518,
-       0xc044eb97, 0x6f78b0d7, 0xc84b1492, 0xff4f3165, 0xb9b7ed58, 0x7ed5e684,
-       0xf65f9a1b, 0x9736fc5d, 0x65c9fcfd, 0x73c9b7e0, 0x8cc64678, 0x65cdff43,
-       0xac0ce690, 0x6f4a8913, 0xfb8ecc5d, 0xcb52fcbe, 0x40e443fd, 0xacec7f2f,
-       0xc7f42e75, 0xd47c024e, 0x06789f24, 0x153be1c0, 0x366eed11, 0x2f5c018e,
-       0xd2090f90, 0x9d494063, 0x4512fe08, 0x87035cef, 0x1ed428ae, 0x1433ce01,
-       0x85bd0379, 0xce3c6ee7, 0x7655fc01, 0x91fbd7f4, 0x931f208f, 0x2b47d61d,
-       0xdf110d8a, 0xc633be11, 0x67ea83f6, 0xd6f5fad2, 0xf8f0e59f, 0xe9e5115f,
-       0x3d9518ce, 0xd1f164f4, 0xc10e7644, 0x9bbbe5de, 0x45abf1f7, 0x192ef7ee,
-       0x615f7e10, 0x4324d9b4, 0x10f1293c, 0x4f155397, 0x410ab42c, 0xfea7c43b,
-       0x746e760d, 0x0337fdbf, 0xb7fabfa6, 0xb054a292, 0x6e0c5be7, 0x7c41196a,
-       0x7b83ca05, 0x267bc118, 0x616efe01, 0x23cd9b5e, 0x8843bf81, 0x3da0f7e2,
-       0xdc8df3da, 0x681ba1ee, 0x3356e2f9, 0xaebdcdfe, 0x1eefe53c, 0xb21ef1b8,
-       0x7dacdf82, 0xb8c48e4f, 0x1ba3634d, 0x858d6ce4, 0x51635fc1, 0x6062bbea,
-       0x1cebeebd, 0x64c2e27d, 0xfe29f7f4, 0x41dd89c5, 0xd692f011, 0xe0b032ed,
-       0xb18fd635, 0x957ce09b, 0xc700f5f3, 0x9b3de6fb, 0x73c75844, 0x862e3726,
-       0x764bcefd, 0xf3c00aef, 0x76b51395, 0x0ea158de, 0xb9246eff, 0x493ee086,
-       0x0ef88f91, 0x9a4c03b2, 0x1e1dc3d8, 0x9e573d50, 0xfd80ecf2, 0x11094c64,
-       0xae2a9e00, 0x5f2017e7, 0xb8478064, 0xbdfc006e, 0x08b7fe4e, 0x7bcd9c39,
-       0xf79005f2, 0x0593ed01, 0xfe6f6657, 0xeefb095e, 0x04fe2cb1, 0x07ecaae8,
-       0xb2f6fd87, 0x534fe0c9, 0x618d6fea, 0xaf2afc7a, 0xc45c00b7, 0x422f3e74,
-       0xfba613bf, 0xa929e0db, 0x9b72e5f1, 0xcf9aa5c9, 0x52f0827c, 0xc79c643a,
-       0x3cdec3a0, 0x62d9f748, 0x4f2bdfb1, 0x656e3105, 0x70c11d60, 0x07ed219e,
-       0x521a7ed0, 0x1d002ed7, 0x0b79ef37, 0x7db83bc7, 0x5cb94b27, 0x80f6e26d,
-       0x367dae32, 0xe3ee5eb6, 0xe70dd1e7, 0x7af97ad8, 0x92e3178c, 0xe4347994,
-       0x28ea9379, 0x6f1095fc, 0x78efb633, 0x4263b79b, 0x016f36f1, 0x77a76abd,
-       0xd3de06ec, 0xf7120dfb, 0x247a451e, 0xf1db642e, 0x08177b95, 0xce5627a0,
-       0x5037ec8c, 0xee4ac5f4, 0xb5c55577, 0x5aa317bc, 0xc696a72f, 0xfa54d359,
-       0x4cf76948, 0x3365ae38, 0x53796b8f, 0x52d46ed3, 0x0cd3f00b, 0x8c10e79b,
-       0x3f7bf95b, 0xd1dff9eb, 0x0ab1f651, 0x0c9d52be, 0xdcc7af5f, 0x8dce0fb8,
-       0xca4e4f00, 0x912debc7, 0x9c13c3e3, 0x306f6e06, 0x8ced217e, 0x6a1e605f,
-       0xb702ebbb, 0x78f2ae3b, 0x4f8c8c0b, 0xc93e453e, 0xdf01b7f5, 0xdb922f8e,
-       0x1087ff80, 0x8c4527ce, 0x1efcf44f, 0x7ce38ced, 0xef004dd2, 0xb1bde163,
-       0x3ff1fa08, 0x067cd863, 0xff23e7b4, 0x0af87950, 0x3a949bd7, 0x4923c251,
-       0xc38c54e7, 0x7e995584, 0x69eb931f, 0x7a737e03, 0xd39e504a, 0x07664ead,
-       0xa0fe32a5, 0x426705ed, 0x2ffe9e58, 0x4f842ce7, 0x00008000, 0x00088b1f,
-       0x00000000, 0x7dedff00, 0xd554780b, 0xb3dae8b9, 0x64932667, 0x6f264c92,
-       0x80849af2, 0x3c870108, 0x4e3d2878, 0x0f78601e, 0x02483508, 0x48042bc3,
-       0xd2d04132, 0x20196f1e, 0x83548086, 0xa96a1ea5, 0x5af11e0e, 0xd528368a,
-       0xf09d8360, 0x41d0582a, 0x396b42d1, 0x0a8a2341, 0xf41ea009, 0xfffde3d0,
-       0xcccdad7f, 0x228899de, 0xb9eefbf6, 0x62ecfd37, 0xdaf6bded, 0x8fdffaff,
-       0xfb0cd7b5, 0x33d6c60f, 0x2a1d76c6, 0x8cb96c96, 0x794bfbc5, 0xc5a398cb,
-       0x8cf3d8cc, 0xff40b595, 0x9dbbfc2b, 0x7463cfb1, 0x1630258c, 0x2b18916b,
-       0xa46fac64, 0x598dfa85, 0x187ae4ae, 0x15d236bf, 0x79c0496d, 0x26090e74,
-       0xecc27e19, 0xf8743065, 0x99997af2, 0xc4bf5e71, 0xd5acc664, 0xbc232296,
-       0x2ec6b537, 0x7efe60b9, 0x0b78ce91, 0x0b1703cd, 0x79d22da0, 0x2d73c0d7,
-       0x66a38ed1, 0x6792cf78, 0x269d2dc2, 0xc15f7f46, 0xb12db57f, 0x35bbbeaa,
-       0x2039d2c5, 0xff825fd0, 0x0eff8148, 0xc61b1331, 0xc5bf0d58, 0x2caec896,
-       0x6b57cc0b, 0x0e6878ea, 0xf37eebf4, 0x92c191b9, 0x805eb86c, 0x7943f9e3,
-       0x81cd7391, 0xd62adef5, 0x55c39b79, 0xcff187a2, 0xc66eb946, 0xf08e47e7,
-       0xa1e193ee, 0x7d9e65e1, 0xa40b687a, 0xb0517dfa, 0xd996365e, 0xae3f41b7,
-       0x4347b583, 0x8744f637, 0x47fa1a23, 0xa784b1cd, 0xb4743f5b, 0x62fac2e7,
-       0xe7c24c9c, 0x38f95f01, 0xe5778b1f, 0xde23073b, 0xe00ccb96, 0x61e90178,
-       0x8e3d36be, 0xdf04759a, 0x53873351, 0x4884c3a1, 0x5d0b28c7, 0x4f5ef467,
-       0xd7801b31, 0x95d04c37, 0x579e8379, 0x4cc5a75a, 0xcf1baee3, 0x307d309f,
-       0x7fdb599e, 0xe813f8bd, 0x32dff1bb, 0xf029dde1, 0xd617dd1e, 0xef09f3fd,
-       0x95e0ba26, 0x61f7533a, 0xdb51f009, 0x5864db26, 0x9664a0c2, 0xd8c719db,
-       0x0eadfb9a, 0x5a2783e4, 0x8c187b24, 0xb3660e67, 0x25643224, 0xdff9d622,
-       0xb7610cc7, 0xac170b40, 0x6293ce30, 0xde436ef4, 0x43337fd9, 0x02b1dc38,
-       0xc3e8068e, 0x05165d73, 0x0df50730, 0x459feaec, 0xf861f182, 0x6a4b982f,
-       0x80976f69, 0x30466b70, 0xdee00197, 0x3f1326d7, 0xe118d13e, 0x7ff9830d,
-       0xe1e2e3bb, 0xb9cfd099, 0x82cb875f, 0x339609bf, 0x43a8f891, 0x395a0afa,
-       0x0f4034da, 0x8472edf7, 0x2df1865d, 0x5843d111, 0xfb45630c, 0x9ad9f988,
-       0xbc0f307e, 0x047b4d67, 0x3f4d6fad, 0xe22c8f90, 0xff917b83, 0x591947f7,
-       0x04bf5c0a, 0x86e38372, 0x46378eb3, 0x74e80565, 0x59d3f5a9, 0xeefd617b,
-       0xd76f3e48, 0x91fd2bde, 0xe3fb957f, 0x97b5cc56, 0x2c5633e6, 0xf38a7ebb,
-       0x1d5fd729, 0xe2345ef0, 0x8234b19b, 0x0727e897, 0x378abbe0, 0x1cafc70b,
-       0x7475a7a5, 0xae3b08b1, 0x60e8c5bb, 0x29cf2748, 0x5e0adfce, 0x746f04eb,
-       0x709e15b5, 0x389efac1, 0xe7c76691, 0x852f5abb, 0xb37de0eb, 0x230f5c63,
-       0xeef4e5dd, 0xe22e6768, 0x1dcdd2f3, 0xe75eb8b9, 0xd2ef8446, 0xaeacf791,
-       0xdf5aebdc, 0x7d64df63, 0x49b9bd6e, 0x3fc9e98a, 0xda903e5a, 0x8690bfda,
-       0xd4309c90, 0xe60c9e5b, 0x6eeb035d, 0x49b43c1c, 0x634f4246, 0xc64f9436,
-       0x06672c2a, 0x313de805, 0x12ddb9c6, 0x188e5f24, 0x2f5c0ee7, 0x8f3527be,
-       0xde1cf9d6, 0x5e74721f, 0x5d7741be, 0xf4297ceb, 0xaf447d3a, 0x5a9eb15a,
-       0x0327d993, 0xe1976cfc, 0x3e450e93, 0x0bc27bb3, 0xf08bd8f4, 0x27ed8a79,
-       0xbfcf485c, 0x106bed9a, 0xc5bf7a1f, 0xeff04519, 0x11b1f7c7, 0xbd719273,
-       0xff1d236b, 0xf6fe8665, 0x83f38c55, 0x127f6114, 0xbf73b716, 0xe4f50235,
-       0x9fd718c4, 0xba81be71, 0xd09cb38b, 0x753bf02f, 0x781db973, 0x92fbac4d,
-       0x97a8e09e, 0x58ebfe71, 0xaf425fff, 0xfe1d07bf, 0x05074c16, 0x7d04a33f,
-       0x507e2147, 0x3feb7721, 0xf00530e9, 0x4f528123, 0x8f9cf6b5, 0x840c8eb1,
-       0x07f77db7, 0xbe603bfd, 0x983e57ba, 0xf75bf285, 0xb7111872, 0x639be5f4,
-       0x17cf8f90, 0x7316f2b1, 0xc9fa7d4f, 0x3ebb7aca, 0x4b4eb187, 0x1ad5e936,
-       0xbeb237e6, 0xda974fa8, 0x14fa41f5, 0x47fba620, 0x3809fe0c, 0x994291ff,
-       0xbbbe02ad, 0xc49e1f64, 0xa569e842, 0xb3256d7d, 0x7fd807cf, 0xf00e7a8e,
-       0x4177643f, 0xcda5e10c, 0x3b58fa4a, 0x6acac8fe, 0xef4e697b, 0x1a191df3,
-       0xbb45ee5e, 0xb0673121, 0xe588497d, 0xb4572576, 0x081d28a0, 0xa317b9e7,
-       0x74b81ebc, 0x68adef2e, 0xb73a7806, 0x0f7ccdeb, 0xe639cbf0, 0x9407f65f,
-       0x6ccd4f9f, 0xa1c76a1b, 0x8aafe56f, 0x0fdbc80a, 0xffb5f046, 0xd1a3a5e0,
-       0x613f1836, 0x4f78bee7, 0xc07efe10, 0xe55e9ff4, 0x2f7c2cdf, 0x7d30fc23,
-       0x07a47f47, 0x44d9c3fb, 0x7613b41b, 0x7ce7881f, 0x3a43a890, 0xeb7a172f,
-       0x64697877, 0x2b09be60, 0x948f88ea, 0x1365ed7e, 0xf505c6f3, 0x9a237ef5,
-       0x66cbdabe, 0x5f7185e6, 0x49e2a258, 0x7d61f47f, 0x537c7f50, 0x2baf69bc,
-       0xf4323b78, 0xefda066c, 0xf9a1e1f3, 0x77188464, 0x09323ec9, 0x4609a3fd,
-       0xc4258e5f, 0x34bcc638, 0x57aebb4e, 0xa5ecba57, 0x1be1defa, 0x96ae646f,
-       0xf4347c10, 0x99c37bea, 0xd97ae407, 0xa1d90356, 0x32fe57a3, 0xf7e81f2d,
-       0x658316c1, 0xfab3e035, 0x7ed2fbd7, 0x87abf70e, 0xe8245986, 0xe5f3607f,
-       0xfc2f1f20, 0x75c4ecb5, 0x5965b07f, 0x3f683ce2, 0x01ac7e06, 0x356e1638,
-       0xadeaf5d0, 0xb3f5d2f7, 0xfe174f82, 0xea10613a, 0xd7fba3f9, 0xab3ae227,
-       0x87f6b1ff, 0x1a762fa8, 0x4286832d, 0xb243b35b, 0xc5c90697, 0x55c2a7e2,
-       0x563a9dfd, 0xd650eb8d, 0xd5d724cd, 0xa78036fb, 0xddf7562a, 0x6afd97fc,
-       0x95fc05ff, 0xf204d8aa, 0x09dd2657, 0xbc2baeeb, 0xbee27e44, 0xc7641183,
-       0xc99668ff, 0xfd0df01f, 0x02df3fcf, 0xe87f92fd, 0x0843e4ed, 0xf42d1f3e,
-       0xa4c96332, 0xbc4caa87, 0x4f5bb25f, 0x944944fe, 0xf186f84c, 0xff70d1e6,
-       0x1f78c45f, 0x37e40de8, 0x34da8f26, 0x8e8dc612, 0x13f43031, 0x78b7c5ff,
-       0x7efd0302, 0xbbfd65fb, 0x29eb411d, 0xd003cd66, 0x06622911, 0x1e8775cd,
-       0xd49897af, 0x8ce747d7, 0x6e768b3b, 0x5d7d45b4, 0x58869b91, 0x0141ffe0,
-       0xf077dffe, 0xc3c647a3, 0xc88eaafa, 0x86bb0fdc, 0xe10d797e, 0x5f9d23d7,
-       0xcf01d8ad, 0x3958151d, 0x8683e57a, 0x11abe414, 0xfd0d5b12, 0x9584ae0f,
-       0x0b879285, 0xbca36fe8, 0x80efa033, 0xda277d00, 0xa3ed5d17, 0xb11e4c38,
-       0xe11f6af4, 0xee7ae6ff, 0x11d1e5eb, 0x6bf7a46b, 0x6e56a0f5, 0x383d2fbe,
-       0x0c81e861, 0x4fb5144f, 0x4ec9fb63, 0x7ab45fae, 0x14f7ab51, 0xd6f0b4b8,
-       0xf4a9d65e, 0x1b58d0dd, 0x3de80b8d, 0x1bbde923, 0x8d1d5f18, 0x815f110d,
-       0x797c265d, 0xae29e986, 0x0de1bf03, 0xb66b971c, 0x480115c5, 0x48ec960d,
-       0xcc33e7d4, 0xee50b7ae, 0xb03b7f32, 0x1ebd8194, 0x8759a3b4, 0xe24ba37a,
-       0x106edaf4, 0x0373f62d, 0x623bcff1, 0xbcb1edfd, 0xc50ff10f, 0x8a2bd98d,
-       0xfeb07bd9, 0x84f31330, 0xf7bd91e7, 0xf302f218, 0xa2e31cbf, 0x8c458d71,
-       0xdcb19dc7, 0x601ecbef, 0x7e6059d3, 0x87592036, 0x70265af4, 0x25a576b1,
-       0x7bf813b7, 0x6a64cadd, 0xe7c45fd1, 0x68237b3c, 0xce4bef5d, 0x6b772821,
-       0x7a5a7c05, 0xfe155b64, 0xf60ff676, 0x87141687, 0x56d1d3d6, 0xe8a7ad3d,
-       0xe81919d1, 0x7edfbc6f, 0xcfea0677, 0x3f5e01f7, 0x3dbd3fda, 0x84fcebe6,
-       0x3e3c8587, 0x8c44ec28, 0x267f2388, 0xc7d804e4, 0xb5fd13b1, 0xbfba4e95,
-       0xb539656e, 0xa0ae571b, 0x59b1ddfb, 0x91e8fef4, 0x81b3fbcf, 0x641b9d7e,
-       0x8c0b03b2, 0xf0b1fece, 0x8e934ede, 0xeaf7d1e2, 0xccbb65cd, 0x5c519d78,
-       0xf1d1e0b3, 0x142e50db, 0xf563ba38, 0xd6deeeb4, 0x3ebd6d99, 0x3acb5dfd,
-       0x5d1ed1a2, 0x0077c7e5, 0x7e01893b, 0x32bb219c, 0xc71809ad, 0x38e22474,
-       0xbfefe4b7, 0xee808283, 0x956ff40c, 0xeccafff7, 0x6216b6c8, 0xa106c39c,
-       0x7044b45c, 0x7385a37b, 0xd9f395a0, 0xc13695da, 0xfda80307, 0xef61f858,
-       0xa10a9da3, 0xcf116e57, 0x6e3b361d, 0x6630f7c1, 0xd6937f26, 0xda3bfa81,
-       0x42708791, 0xf78050bc, 0xcbd52587, 0xdbf90906, 0xf80df5c2, 0x771fdca5,
-       0x2c71c48e, 0x044d21de, 0xf9130c7a, 0x05f2de9b, 0xb4de385a, 0xe6d0f972,
-       0xc9569411, 0xf95a9423, 0x6b16fe7a, 0x6c77e551, 0x2a11cc2d, 0xcad5b07f,
-       0xc3b266f5, 0x7ada4721, 0xd702bb97, 0xf3191ebb, 0xdecce524, 0x51a49a0f,
-       0x3f98ed2d, 0xaef52949, 0x634afcc2, 0x3d0e56ac, 0xc95798e1, 0x3d12e976,
-       0xefd12e30, 0x1c02322a, 0xe912625b, 0x7eac497d, 0xc0abd215, 0x1745a3a5,
-       0x4af08fec, 0x4307904a, 0x047e85f2, 0x79470d09, 0x9ae51f1b, 0x5f9df843,
-       0xc368c6bf, 0x464793fc, 0x025672fd, 0x38fe013e, 0xa422207b, 0x228f773f,
-       0x1f7152b7, 0x4f05e934, 0x050f0819, 0x1662fd4f, 0xd4f05bc2, 0x28297a1d,
-       0x6ac87f4e, 0x3d9dfc20, 0xe29338b0, 0xac6193e6, 0x79cf565f, 0x545f051b,
-       0x60bf7c09, 0xab77cd0c, 0x5baffbc5, 0x7f82774f, 0xd3d2a893, 0x8109adab,
-       0xed5d4c7c, 0xb3d3d245, 0xfc3edcac, 0xb072df4a, 0x57f3e00f, 0xf11d99f3,
-       0xad99f8be, 0xc17ba794, 0x077632d8, 0xc74ea7ae, 0xffb00f30, 0xfb07cbe0,
-       0xdf387fa0, 0x83fd1436, 0xd91fcfab, 0x7fd788de, 0x2286cd55, 0x1bbc53fe,
-       0x7c07cc25, 0xf84cde1e, 0x185b7cfa, 0x5a4b055b, 0xec65ac74, 0xb9bfa04f,
-       0xaf50c746, 0x6f0dd768, 0xb192e832, 0x237419f5, 0xff51fd38, 0xc6077429,
-       0x143d2232, 0x50fe21ba, 0xf6dfed9f, 0xc0afc112, 0x46c625b5, 0xccfc5bf8,
-       0x27c8b1ce, 0x12ac6a7d, 0xb81467e6, 0xb89dabbe, 0xf7f3f681, 0x3f666fd6,
-       0x69fa465f, 0x6ed6a7ed, 0xf63b30ce, 0x86bbfe90, 0xf8231cfd, 0x0f4237f0,
-       0x41ed98db, 0x23b253cc, 0x68f7ca3a, 0xf82a52e9, 0x7a2f2831, 0x791d7ac4,
-       0x2b5661d1, 0x179b57bd, 0x7ae46edd, 0x66cad9b4, 0x87e5094f, 0x9b757809,
-       0x17688dba, 0x90a4dbe3, 0x99a8e97a, 0x9bd025eb, 0x9f7241ff, 0x86af5a1a,
-       0xc419efc0, 0x7c3bcddb, 0x5e54717b, 0xba244e6c, 0x0fcf805d, 0x7814f854,
-       0xe0aaf054, 0x88a631b3, 0xf0bb65f8, 0x70c4b733, 0x9970297c, 0x8e7194e3,
-       0x7a5f380b, 0x0bfafa2f, 0xff806781, 0xbf1fc232, 0xeaf2a99c, 0xbe3d3e4a,
-       0x0b1923de, 0xca302cd0, 0xb9c665bf, 0x5c601956, 0x7f6648f7, 0x1531fa12,
-       0x77d42296, 0x3b7b6ad6, 0xcf1bdde6, 0xe366bcf1, 0x4d5de652, 0x7ffe30f3,
-       0xa3ca6cae, 0xe69dde22, 0x5941769e, 0x532bd81f, 0x15c1215c, 0xf635f711,
-       0x45ca06ea, 0x9337dc72, 0x10b8f48b, 0x731b7b74, 0xc7210980, 0x4379c5f7,
-       0xaf0739d0, 0xb7ce8b5f, 0xe5e57889, 0xcd472998, 0x0cb56fc2, 0x4b5dd009,
-       0xdf91becf, 0xc4f78f51, 0x09716dcb, 0x61b2f13d, 0x1e806e82, 0xec22c9d7,
-       0xa4ceeca1, 0xdf3defb8, 0x442e293f, 0x54fe1fbe, 0xab13f4fe, 0x84dfafed,
-       0x5326be70, 0x4fc4f49c, 0x27988c3b, 0x0ad2f256, 0x812feebc, 0x773f40a3,
-       0x56a3a97d, 0x26d75eb9, 0x55dc63e5, 0xf90aefb4, 0x5fed5dc7, 0xa5dc7f92,
-       0xf7958ff1, 0x89ec03de, 0x365a31f2, 0xdc5fff13, 0x9978e3c2, 0x146dfed9,
-       0x643ee1c0, 0xf11b5e60, 0xb40ff92f, 0xc45fe85e, 0x633fc716, 0xe16f78a4,
-       0xf98617e1, 0x08cc52e0, 0xe105b31d, 0xc111d62b, 0x8af8416c, 0xfaaab32b,
-       0xaa3ece09, 0xd9e549f1, 0xae29fbaa, 0xa9fbaa81, 0x7eaa79d5, 0xaaadfd7a,
-       0xb76099f1, 0x9e59fb82, 0x7df1aa71, 0xfaaaa69b, 0x56ef9afd, 0x871e678d,
-       0x39d6073f, 0xa6f3ac5f, 0xe35573cd, 0x61f24f99, 0x2081647d, 0xc7dbc7f3,
-       0xc8fac21c, 0xb88f917c, 0x3558bbd9, 0x756682df, 0x08f0815e, 0x956aab78,
-       0xb78863d8, 0xd5fbeacd, 0x531b1b6d, 0x55e45da1, 0x758c5f5f, 0x53f9090f,
-       0x3af7fd7d, 0xe3f432e7, 0xcea7197f, 0xbe935dd3, 0x45ae9b9e, 0xc70fbb5f,
-       0x7f2288ef, 0x79e1e167, 0xc9614724, 0xdb86fa6a, 0x7f16be22, 0x9aac0391,
-       0xafbff0fb, 0x5d945fc1, 0xfc5a0fcd, 0xc1f759e9, 0xceab8054, 0xac7dd92b,
-       0xb516fe27, 0xb538256e, 0xede2d3f8, 0xbcea718f, 0xd748dace, 0x971bd45e,
-       0x0ccb975a, 0xbc65f3f3, 0xf5a978fe, 0x6c4721d3, 0x7ef97941, 0x5fe5e6bd,
-       0x97910b8d, 0xcb7ac2ef, 0xd41bec2d, 0x817df65b, 0x8b030878, 0xb27a0063,
-       0xd5d37611, 0x20784afa, 0x5bd5af0f, 0xfb7a0b4a, 0xcfa4716f, 0x35a97503,
-       0x98b0f4f0, 0xaf089db7, 0xef18b752, 0xb7bc1172, 0xe1232020, 0xa75f333f,
-       0xe1e00f32, 0x7c679c3d, 0xe3123591, 0xeffb9da7, 0xb58078a1, 0x073d73c5,
-       0x1f1e0f24, 0xfe9297e4, 0xa67fc16c, 0x48fc3d90, 0x704fc3d8, 0x321ec53e,
-       0x57bf959f, 0xe6dec3d8, 0xbd16ea51, 0x995ed2b5, 0x58dd2fea, 0xcfa1097f,
-       0xd1dff18d, 0x23d27cae, 0x0f8c69ff, 0xbdee0f8e, 0x3af51074, 0x1e3c3de0,
-       0x051519d6, 0xd80a52f6, 0x8c8b7fcb, 0x3eeb7926, 0x826f7b2c, 0xb64d170b,
-       0xa06e6b18, 0x7785a2be, 0xab9ac994, 0x6de3d20f, 0x365eda92, 0x23ff71e6,
-       0x1dfb9e31, 0x2fdccc93, 0xe9d62c1d, 0xeeebf8d6, 0x82971e26, 0x05b75434,
-       0xe38381f9, 0x3bfc68a3, 0x71834511, 0x5c455b3d, 0xd12598df, 0x89251afb,
-       0x312dfaec, 0x9dff74c5, 0x6c5ca2b8, 0x0ef789fb, 0xda089f46, 0x8f0e6ce6,
-       0x5013ec4d, 0xc710ffe6, 0x4c5b6217, 0x8b78e0ed, 0x0658efc8, 0x448fbd22,
-       0xa35e6838, 0x29fcab2c, 0xe78bcda5, 0x99a7447e, 0x2a937e29, 0xe8463c7f,
-       0x8717cc31, 0x26393091, 0xe40c4e8c, 0xea3c998b, 0xe45e31b8, 0xdc7a2589,
-       0x5dbc7481, 0xbcb7b1d0, 0x658063b1, 0x4439bc3f, 0x1c97d8de, 0x1f6c6f32,
-       0x78637943, 0xd2eb8f52, 0x0e918fe6, 0x3c80d691, 0xaabf8c4c, 0xdf50d26f,
-       0x3c756634, 0xe3f91e32, 0x127f6ca8, 0x13c77f41, 0xb6e00439, 0x7c7675d9,
-       0xb616e464, 0x0bfa1c3a, 0x2fca363d, 0x8afe2019, 0xefc80bca, 0x4e2cf892,
-       0xd33e13ff, 0xfc3fb810, 0xe63b671d, 0x634ffb93, 0xcdff5456, 0x1a24b9ac,
-       0x2c2d88fd, 0x2552bc64, 0xd17c66f8, 0x3ce5195e, 0x25f81ba1, 0xe2aa3d04,
-       0xbdbf8a75, 0xbc36e900, 0xf50975db, 0x4807a289, 0xb45c6195, 0xb27e475f,
-       0xe896f9f6, 0x07c42592, 0x9279d0de, 0xe387334e, 0x29738442, 0x57783fce,
-       0xcdf51187, 0xce6f4542, 0xd03d31d7, 0xbf414ef7, 0xbaf0b73b, 0xd5f2bb34,
-       0x5fe2b257, 0xa19f9a31, 0x2d38583e, 0x87798bca, 0x1e596d85, 0x5129cb82,
-       0x76ddc55e, 0x85fd89cc, 0x8c160505, 0x657f1d73, 0xe40199d2, 0x77ae319a,
-       0xa28cecf4, 0xc67ec807, 0xaa629d53, 0xb34eabe0, 0xfd04e08d, 0xe81221bc,
-       0xaacb70b0, 0xe12fb8bd, 0x54677fad, 0x7721388f, 0xa6c9c30f, 0xe4567203,
-       0x1567ab61, 0xaf30f879, 0xf3134c77, 0xf784be78, 0x9def029a, 0xd69876de,
-       0x3cc0c273, 0xae97e026, 0xd0d9773d, 0x304c6d4f, 0x457f89d9, 0xec94eb9d,
-       0x878c807a, 0x410ebbbe, 0x6916d19b, 0x58eb0f59, 0xafdc6463, 0x11d845d5,
-       0x1dcd13ff, 0xf897e27a, 0xf1e23d6e, 0xf467410d, 0x4fcfc9ed, 0x39274460,
-       0x96e9c755, 0x44fbe369, 0xbff9d472, 0xc1dd0497, 0xebc34c6b, 0x58df2313,
-       0x7cce036e, 0xc70fd376, 0xdea247e9, 0x1679637b, 0xdd365bf4, 0xfc8f4e35,
-       0xa7c6fa9d, 0xcfea2059, 0xf7e72a6f, 0x69f1bd07, 0x6d77f436, 0xdfefc19a,
-       0x5ecfbc46, 0x38f774dc, 0x74bfebcc, 0xf9f02f55, 0x12422097, 0xc395bfae,
-       0xe2a1f574, 0x92bc5f0b, 0x7c06665f, 0x4fedb38f, 0x3aced027, 0xc3b7fa95,
-       0x237faaa0, 0xdf8098c7, 0x62be0bc6, 0x0764d1f1, 0x8dfa09c6, 0x3f68fbd7,
-       0x23e4ce8c, 0x1ac4defc, 0x8037c82c, 0xe55f4dad, 0xc07f7cf7, 0x4bf9a9ae,
-       0x02b63072, 0x2cd92de8, 0x566b27c4, 0xda385730, 0x5ddd40fd, 0xcceeebc7,
-       0xe057ef89, 0x03dfde51, 0xdead202e, 0x16d70c1a, 0xab81479a, 0x0798686b,
-       0x9fb149e5, 0x525d5c0a, 0xf498e3f7, 0x0f2fd9fe, 0x75ba404e, 0x48677545,
-       0x7090dfd0, 0x95d8e890, 0x64b8fdd0, 0x381bea0f, 0x5a6ccf1d, 0xef03ce36,
-       0xce3b28d9, 0x1986dca0, 0x2692bef9, 0x3de0538c, 0x3cb8260f, 0xbe03cf58,
-       0xef90fbb3, 0x87a48dd2, 0x79d40b4a, 0x67c16e89, 0xdeb813cb, 0x5cd61d1f,
-       0xd2f80c7f, 0xab624bbd, 0xcafbbc60, 0x89da2325, 0x8da76d89, 0x76eb680e,
-       0xbea2369d, 0xcc3ec3aa, 0x18c5b753, 0x12796f52, 0xd43f6164, 0xf481f07e,
-       0xe3c40ffe, 0x12f985be, 0xd9eee255, 0xfb1a3b1d, 0x55c1ccf7, 0xa8f77632,
-       0x5d91a39d, 0x0fed9d2a, 0x759b3b60, 0x9a16401c, 0x7e5592e1, 0x48eacce9,
-       0x595b5f95, 0xcfeaa71f, 0x80ea066e, 0x915ecf5c, 0x181f8eaa, 0xcf00abc4,
-       0x43f8160c, 0xe82e56fd, 0x83792338, 0xccadf71f, 0x1d3c1970, 0x6c4df341,
-       0x22b7a55b, 0x9d92f5dc, 0xd987afd4, 0x7c99b9f0, 0x3dead085, 0xd1b0f5c1,
-       0x51893cad, 0x7f226e57, 0x80fb02bf, 0xd91a8ad7, 0x0f10936b, 0x6eefba46,
-       0x5bbee895, 0x4b5777dc, 0xec961d4a, 0xe3016cee, 0x46c73dcc, 0xe110b6d3,
-       0xcef02bdf, 0x4b3b2f2e, 0x7afc28fc, 0x36e55d65, 0x7d70b3b0, 0x06dbfa6d,
-       0x8ff6779c, 0x45971624, 0x50eceaeb, 0xafdd51e1, 0x19f757ac, 0x9e6030eb,
-       0xf50af67a, 0xc209e1f5, 0x83620e9e, 0x25469e50, 0x2f927a48, 0xfd24ffd1,
-       0x007cd7ed, 0xf3b2e3df, 0x83e004f6, 0xea8fa31a, 0x2ecb8f50, 0xe1f72bea,
-       0xb9231d7a, 0xe4807f03, 0x5cf92258, 0x8a587063, 0x95ae8fd0, 0xb2676f88,
-       0x2b217f20, 0x72fa9e30, 0x093dfecf, 0x135a5fdc, 0xf54e5cee, 0x65923db0,
-       0xd52a5c1b, 0x07e8f43b, 0xe74291ae, 0x70259643, 0x418d7879, 0xf5700ef4,
-       0xbb452647, 0xd78c677e, 0xffedef03, 0xf41e39c7, 0x03e7fbef, 0xee50d81f,
-       0x2f19bdb9, 0xf024cdec, 0xebffd12f, 0x9394b72f, 0x68c5bf7e, 0xec2efd21,
-       0x1c2fa290, 0xa1db51bf, 0x288769f1, 0x79b498fe, 0x8bd405c3, 0x791d7d39,
-       0x07be011b, 0x1ffbf9c3, 0x71792ddc, 0xee5d4e1f, 0x499fd241, 0xdef81ec0,
-       0x47a164ba, 0xacfbd55b, 0x21af5092, 0xa5c84cc3, 0x1498a6f7, 0x1e90776e,
-       0xbac57c94, 0x497e80af, 0x69a9bde2, 0xe257c236, 0xd70916e2, 0xab3cce9d,
-       0x45cf8ed0, 0xb40c2c21, 0x97cfedd7, 0xbe7f5a4a, 0xe4f9fc9b, 0x7bc5230e,
-       0x9df8dbac, 0xe73d73f2, 0xfcd432ff, 0x53aa7cb0, 0x2bf2e207, 0xb9a798d1,
-       0xafdf4f67, 0x9b24dfdd, 0xc1b771d4, 0xc7bb8ea2, 0x9feb500f, 0xdeb57689,
-       0xafa23c99, 0xc714feea, 0x3bfdd520, 0xfd55f2cb, 0x54dbcee9, 0x2f2aefe3,
-       0x92c3f551, 0x00f269c7, 0xe44abcea, 0x255e7500, 0xa3ceaeca, 0x7dfe1d84,
-       0x317804b9, 0x2e1d3c9a, 0xc81343c0, 0xc06b08c6, 0x368a0c8e, 0x22367151,
-       0x6d8cdc3f, 0x1f30d0d3, 0x1f5349f2, 0x1d87871e, 0x07d937be, 0x766298f3,
-       0xf104b098, 0x1c5bc95b, 0x9a007307, 0xf03a9ea8, 0x39bfb57e, 0x17db8532,
-       0xb825f5a5, 0x36844f5e, 0x2a5b19f7, 0x14fd67f7, 0x1822989f, 0x345e8bf7,
-       0xc4a45f91, 0xe93ccac9, 0x50074569, 0xefdee47f, 0x6b09baa0, 0x27cc1665,
-       0x7914693e, 0xbef917d4, 0x0ed6dcdb, 0xbe48239d, 0xfae44cef, 0xe2ce17e0,
-       0x5d7f38b1, 0x9459581b, 0x1aefcda7, 0xd7593eb1, 0xf68d1ed6, 0x5df3886c,
-       0x02ebe623, 0xd39d85d7, 0x5d604777, 0x722d77e5, 0x72cafdc8, 0x1febcf22,
-       0xf2bd7a14, 0x547c40de, 0xafa02c34, 0xf5f2772b, 0x92374e55, 0x46c2c13e,
-       0x7a0dbd28, 0x2ade67ba, 0xf28c1ed8, 0x03ba803e, 0xdc6ab7f4, 0x2e3c69ec,
-       0x8dbd00aa, 0x5cfa0c72, 0x91ad3f7d, 0x73e80bf4, 0x010bf5d5, 0x15fb9e7d,
-       0x19c2773c, 0xe8f65f7a, 0x3f375e14, 0xfc212ae1, 0x88f002ff, 0x7a2ff27e,
-       0xf3e38de0, 0x167af85a, 0x37441f69, 0x2929b8ed, 0xb67c7fdc, 0x433d7d17,
-       0xc949f5d0, 0xd4ca879f, 0xbe208ced, 0x8d72699d, 0x7a47ccef, 0xf588de7c,
-       0x4bdfca89, 0xdfeced0c, 0x7ed30fda, 0x03cee33d, 0xd28fb889, 0x912072dd,
-       0x18d5df01, 0x8fd0ab6c, 0xa3b0be07, 0xead753df, 0x5b6bf823, 0x7af1dbf2,
-       0x4764ab6d, 0x75deec55, 0x93ad0c61, 0xbd623475, 0xe05ec9ef, 0x76e44cca,
-       0x8da26064, 0x985c07e7, 0xc3e7c113, 0xf9095ebc, 0xc212f400, 0xcd625bb5,
-       0x9d727fd0, 0xb79d6429, 0xff7be052, 0x57c5233a, 0xae3cf035, 0x41fa60e3,
-       0x68f909a3, 0xc24bac27, 0x1e9b1c75, 0x372ff389, 0x142ff430, 0xfba5cef8,
-       0x4ffae14f, 0x070087ce, 0x2f99afae, 0x2e4fbe13, 0x05c87917, 0x58cfea06,
-       0xdd7e2464, 0x46bdff37, 0xac9defcc, 0x4bdcfbe1, 0xf9467c16, 0x248b19be,
-       0x8a993f65, 0xd57e159f, 0x7f96a7f2, 0xf569f07b, 0x98e9f1f5, 0x3a7cabc4,
-       0xd03ced04, 0xf212747d, 0xce218fcf, 0xb2b9f946, 0xf00490cf, 0xec5a3766,
-       0xb06bafb8, 0x11207dec, 0x7e3ec4f5, 0x56cd687f, 0xdb1beb89, 0xa98728dd,
-       0x1eb6464d, 0xae44cbfd, 0xbd206697, 0xdd69710a, 0x7bc52452, 0x4bd46cfe,
-       0x0ef7ca59, 0x13be5606, 0xae7a71f3, 0x94bf066f, 0x107d75bc, 0x39129adf,
-       0x707a2abf, 0x76b99190, 0xa5bfde52, 0xe79814cf, 0xdbaf0359, 0xfaf98864,
-       0x331eedf5, 0x089fda05, 0xe027997e, 0x0af7fa50, 0xcd4f67fe, 0x344efc20,
-       0x5b8fbc71, 0x75c0abe1, 0x8b5d1934, 0x84fee112, 0xd06bb78c, 0xbf6535ce,
-       0x42f94b9a, 0xa73b2366, 0x46fbe7c4, 0x1965b07e, 0xe6fc37ac, 0xf863a208,
-       0xe4168d9e, 0x057ef0e3, 0x7c10ae49, 0xcbeeb4a7, 0x3902e636, 0x4d9cbbaa,
-       0xb29fd2ad, 0xf691acf7, 0x185db721, 0x39727243, 0xcf2bae99, 0xf9114a2d,
-       0x53dfb12a, 0x9e825fc9, 0x0bc88fd6, 0xc0f0538c, 0x215e1770, 0xd114f3c2,
-       0x3652d96b, 0x37d1a794, 0xd667fad2, 0xc0e6931c, 0x1c19773c, 0xd6167306,
-       0x77c7cacf, 0x537ee0e6, 0x71fd5cc6, 0xb9899d9f, 0xcfdfb88c, 0xcaff7d42,
-       0xb1bfea64, 0x63ed46d2, 0xd0cfe726, 0x5fdf4cde, 0x4df68fdf, 0x2cea3fa6,
-       0x1d74f786, 0xb6be0831, 0x3a94be10, 0x9936a5d0, 0xa5fee099, 0x35d5125d,
-       0x5d67f815, 0x715cc3ee, 0xdf15fd8c, 0x5da9ef07, 0x3be926f1, 0x3185f57b,
-       0xad0d1718, 0x7d88dd39, 0xc6cf8af7, 0x0a713fa0, 0xf5f907ec, 0x4b27dfe0,
-       0x198e47a8, 0xc55d7f71, 0xf3cd2b65, 0x0c7baeac, 0x15e797ca, 0xa74dea89,
-       0x93182f5a, 0x08627db8, 0x9f5816ca, 0x1895d703, 0xb771f84b, 0xfa71d50d,
-       0x4ab8f0e6, 0xc0fb43f0, 0x1e91a32f, 0xd7b615a6, 0x0fe7c36f, 0x77e50cc9,
-       0xb477717d, 0x3dfe8425, 0xfeb2f301, 0x6ad81d7c, 0x3d1b97ef, 0x5cf0ecfd,
-       0xfef42eb9, 0x9f0557a8, 0x3e29a602, 0x11293fc0, 0x55ff99e5, 0xac6292c2,
-       0x22f8f714, 0xdb2b8e40, 0xb1eace4a, 0xbbd897ad, 0xbd8c78ea, 0xf7b7e41b,
-       0xb4df87c6, 0xf4f9c3ad, 0xe201f641, 0x07e41646, 0x54c8dc61, 0xbcf0f7ef,
-       0x924e7a52, 0xaf3ac42b, 0x1f4741ca, 0xd57a0366, 0xf3ba0135, 0x5207df91,
-       0x5af77e7b, 0x298fca1b, 0xb451fba2, 0x8ebfac13, 0x8f5a8ce2, 0x93d9ffda,
-       0x4f78e5cc, 0x77eb9732, 0x12f1d513, 0xa3ef45c4, 0x145c431c, 0xa0df858d,
-       0x9d7b4978, 0xca1325e2, 0x1077bc15, 0x10f9e7d0, 0x2e4e1f70, 0x3df908fe,
-       0x9f133583, 0xe473e033, 0x3f3aed2f, 0x9153f613, 0xd72819eb, 0x5cadbfc8,
-       0x1ef3b5ae, 0x0cfa2e4f, 0xfb8759e1, 0x8de842b5, 0x6b3ac557, 0x97c23337,
-       0xf095b37b, 0x766d8e74, 0x9e5f0316, 0xfeb03803, 0x4674e5df, 0xc67d62c6,
-       0x9ab48ce5, 0x6ea07a03, 0xb73d0473, 0xdc6a672e, 0x2447e81c, 0xdf3fbe71,
-       0x3c42625a, 0xe5ccdacf, 0x29df794f, 0x94388cdf, 0xb74342a7, 0xd3f70ed1,
-       0xa3474eda, 0xfbb857df, 0xc39438ce, 0x47fce0de, 0xed775f12, 0xe3c67b8a,
-       0x87f85df7, 0xfea54cf9, 0x33ed5ee6, 0x0578dd52, 0x7f6dfe23, 0x28756ff1,
-       0x22dbe7c7, 0xcf37682d, 0xa0f489ed, 0x257aeffe, 0x2893abcc, 0x80c4f0ee,
-       0xe8673b5e, 0xe5fe4498, 0xfe82d96e, 0x8f95fb9d, 0x7479451f, 0x9e8618bf,
-       0xb6d25b1e, 0xbdda02f6, 0x67b1b69a, 0x9f6843f5, 0x1e553ff9, 0x47dc576a,
-       0xffd2917e, 0x89c9a578, 0x9ebcf47a, 0xad2589eb, 0xbbbf902f, 0x21a5cae4,
-       0xb73ef758, 0xa186bfe7, 0xf1ff735e, 0x67d430d2, 0x1a5c3fee, 0x2fddf786,
-       0xf287d645, 0xc8a55657, 0x5ec57f44, 0xabd71d66, 0x0b1f43f2, 0x686ac8fe,
-       0x9bfdc32e, 0xd9a6c785, 0xdcab7f31, 0xa3a7ec2f, 0x6f85fafd, 0x082dc695,
-       0xafc1ae7a, 0x05ebc32f, 0xe7234ac7, 0x4765f107, 0x2fc941b2, 0x075e575e,
-       0x0587eaef, 0x3afc71e5, 0x5b8c3847, 0x7df3d7e7, 0x1792d5b4, 0x5ff00be3,
-       0xdf91cfb4, 0xce28b5d4, 0x04fc9ebb, 0x05c1f8e7, 0x5f67efd8, 0x62b5436f,
-       0xe413903a, 0xebf0cd27, 0x47c0617c, 0x3e616de5, 0xfafdeff2, 0xfe17d4d3,
-       0x1f0bacd3, 0x21496544, 0xde0333f2, 0x5c7a8d18, 0xbf81a79b, 0xf15b8428,
-       0x5dea2ab7, 0x36bf08e9, 0xfcbb337f, 0x690fca0e, 0x7e5937f3, 0x01626ebd,
-       0x4d79e7d6, 0x937f9d74, 0xf145e509, 0xbb7e9143, 0x67ffc842, 0x8a7e9c49,
-       0x75f8355c, 0x7f069744, 0xda0729b1, 0x2efee2f3, 0x1df8a730, 0x9ddb4347,
-       0xd08f30db, 0x48aee570, 0x1c355dac, 0x3bf0ca9f, 0xb14b2e8e, 0x773e1fa9,
-       0xf4d30ee5, 0x68bf00dc, 0x8927b7df, 0x9f80cbeb, 0x3deeda10, 0x9ff9e427,
-       0x27b6ff65, 0xffcfcd5d, 0x20ff6d5f, 0x9499df0e, 0x4cf87140, 0x71e1279e,
-       0x286ed6b8, 0xf79958fa, 0x9ee7415d, 0xf92cf8fa, 0x932f1037, 0xc9377e3e,
-       0xdad2e346, 0x1c51c4a6, 0x9c5a7c7d, 0xfe73dccd, 0xcebb7abe, 0x7e73db9a,
-       0x7b738fc5, 0x184c071c, 0x3ef838e7, 0x8934f731, 0x7e2ad5f6, 0x9129db9f,
-       0x30aeee3f, 0x029c7178, 0xcf1a7f97, 0x18774eab, 0xc052e1bc, 0xc7fc543f,
-       0x12edf7ab, 0x49fc57dd, 0x3bf46fc5, 0x5a771e79, 0x98ffbf01, 0x093275c9,
-       0x70be41eb, 0x92385eba, 0x79cc675f, 0x77fa1520, 0x246250fd, 0x549fc2ff,
-       0x6feb54f8, 0xfbeb6c5e, 0xb7e4fbb5, 0xe454fe08, 0x1f23432c, 0x108afd8a,
-       0xfb43aa78, 0xfbf6871d, 0xae5f950b, 0xf7ec179d, 0x8e7a24b9, 0x6f05f3d1,
-       0xe2a19de9, 0xfe6295f3, 0xa0fd207f, 0x2feff34d, 0x99d37842, 0xf6b9f69f,
-       0x85bb5766, 0xfddbd37f, 0xcf286f88, 0xf89d8403, 0x4e73c967, 0x790cfff2,
-       0xf617eabe, 0xe1dd9df2, 0xc9c1a2e4, 0xdeb97f48, 0xf7f2845f, 0xfac84367,
-       0x7f8115f4, 0x7c557388, 0xa8dd207c, 0x5dc8b8c3, 0x4d03f3cd, 0x29d7b6b1,
-       0xd32c397e, 0x1025ebfe, 0xb6ffa207, 0xda85b2f8, 0xa193f41a, 0x31ccf99d,
-       0x9997ea03, 0x9bf86ad5, 0xcf8b7730, 0xa2f2cd2f, 0x4ac95cdf, 0xd954af29,
-       0xfdc16b16, 0x2d094dcc, 0x3cae5107, 0xb6db64db, 0x06ebf1e0, 0x9e26f18a,
-       0xa58eab6f, 0xe34c93fd, 0x6bd65407, 0x5fb57dfd, 0x13c89b70, 0xfc1fe6f5,
-       0xeb9c3da1, 0xc9324395, 0x97e61d79, 0xd8cc616e, 0x7b82f5c6, 0x4de53845,
-       0xb8435e30, 0x79215c3e, 0xad77004d, 0xdea1f718, 0xaa27f94f, 0xb390c1a7,
-       0x51131b6d, 0x5d43992e, 0xea7daa3f, 0xda9bd22d, 0x9775923a, 0xad5d0ba8,
-       0xb0930d1b, 0x64f10b5f, 0x3697fa12, 0x3fc464db, 0x47daa7c0, 0x1705f8a6,
-       0xf147bd0f, 0xbcddcce7, 0x7ea3d3fe, 0xd78e34d4, 0x0d3ec48f, 0x76721e6d,
-       0xa903c1e6, 0x8dd76bb6, 0x198f5aea, 0xe1e8ae30, 0x8efc687f, 0xf3ab269f,
-       0x9e7a998c, 0x936ccdc7, 0xca9f982c, 0xbe1c7814, 0xeafc822e, 0x1f9f7f31,
-       0xa140fa87, 0x1c29f9d3, 0x7e4fe7af, 0x045b445a, 0x84b7aefe, 0x70febac3,
-       0xa99bf972, 0xd9336fbc, 0x91e5b9f0, 0xdff43df4, 0xbc4489ef, 0xdc5a01fe,
-       0x09d2f997, 0xa47cc87d, 0x1fe5c294, 0x93cfe1ec, 0x2fde1ed1, 0xb07ad2f2,
-       0x7c815187, 0x9b39f68e, 0xc209ae78, 0xee63ca14, 0xa6fdf5e6, 0xea38d714,
-       0x6d9b32ff, 0x41d0ff23, 0x8017e779, 0x345f31af, 0xf58b1608, 0x5822e7e7,
-       0x9a8bd603, 0x92af5c12, 0x6752fd1c, 0xe7823943, 0xd9e4cea9, 0x88fb2369,
-       0xce7ac328, 0x2649b010, 0xf7c0d7da, 0x74140c47, 0x1638814c, 0xcd0049eb,
-       0x0f37ac34, 0x219d7512, 0xf38f4c11, 0xad70683f, 0x48eb19bf, 0x2afb7aed,
-       0xdc7b0212, 0xf59ea894, 0xebc1c925, 0x499d4ae2, 0x56f78fa9, 0x3df09267,
-       0xaf0e1f7c, 0x727d892b, 0xfd893d4a, 0xae4549d0, 0x19ea2335, 0x6949adc6,
-       0x0bedbbec, 0xf9e759eb, 0xdab9c63b, 0xc047cf3a, 0xa13f3ce3, 0x1fae2bae,
-       0xe9f13cf0, 0x0e27adb7, 0xb8376648, 0xa3f1c5fe, 0xf620bb85, 0x5bc52262,
-       0x68cff8ff, 0x976db3b2, 0x75761ec8, 0xe53f3187, 0x9e783b1d, 0xef7f8dbd,
-       0x5b7105d3, 0xbd9d9042, 0x7b5bf843, 0xff884adb, 0x234bf977, 0xb0bd7c71,
-       0x4f8eebe3, 0xd3bf13bb, 0xb4f5f8f2, 0x1e31872f, 0xebf2ed87, 0xb96fd10b,
-       0x22f97481, 0xcdfd4429, 0x93edc114, 0x4b9e8e56, 0xe7a4f9e6, 0x947f3992,
-       0x97f1e49c, 0xa3af397b, 0x705e8458, 0x0f491997, 0x944f4c1e, 0x5279fc94,
-       0xeecb3aa8, 0x951bb26e, 0x3fda248b, 0x9675dd7b, 0xb76176d6, 0xb2e9f934,
-       0x7b37a431, 0xd5075bcb, 0x33f755cd, 0xe13ec452, 0xdd7f3cc1, 0xf5a16c9c,
-       0x1687eb5a, 0xaca64ba1, 0xe1d206ff, 0x5bf7ca68, 0xf3eaed67, 0x27bfcefd,
-       0xdc9c8421, 0xfb3ff9c0, 0x4397e79e, 0x381ba7e9, 0xefc4df7f, 0xf93fff17,
-       0xf79fe79e, 0x6467e33d, 0xfff43d28, 0x6d003eea, 0x2fbb5f9d, 0x0fef5b40,
-       0x83c0bc3b, 0x1b4ad6f7, 0x9ad07dba, 0x972c5fa2, 0x63eb5540, 0x1da1329f,
-       0xd792309d, 0x9a95d6c1, 0xc0a55bbc, 0x5f0500fe, 0x1c7953a7, 0xe0bdc961,
-       0x673c0389, 0x71a5fc38, 0xc91b2798, 0x0aee0e28, 0xa630f5e7, 0xa14ca4b7,
-       0x9496f6fd, 0x9b37a0a9, 0xe95ef97a, 0x6f5f3141, 0xad3d2476, 0x214a70e8,
-       0x943c8eff, 0xea2596bf, 0xbe569652, 0x6de996df, 0xbde95329, 0x87f414b6,
-       0xebf3f662, 0xd8e63ed1, 0xb2d9704a, 0x683c52a6, 0x1ef842cb, 0xeb5ef511,
-       0x9859feb8, 0x5f82b68f, 0x8dc0f588, 0x78a41758, 0x94e342d6, 0xc3eccdf7,
-       0xc0c47de1, 0x7adfac24, 0x99fbe66e, 0x5542f358, 0xc188ef3d, 0xa24739d7,
-       0xea275e7a, 0x5f3aa3eb, 0x825993ee, 0xb9bf0189, 0x67542cbb, 0xffe46d7c,
-       0x5bbfc01e, 0x65bdf5e2, 0x1f643e16, 0xc700cdc6, 0xc4f93db2, 0x8ef733bf,
-       0xc6054bfc, 0x1cfc391d, 0xa5711e90, 0x109c17c8, 0x5f250ef9, 0xdeb5d4a0,
-       0x53927911, 0xb6817f98, 0xd021f303, 0x37747d4a, 0xa1493eda, 0x1223c7ec,
-       0x8e790fcf, 0xbe50fcf2, 0x7837ded1, 0xc0b464df, 0xaf1f1ceb, 0x9ef9285b,
-       0xf93d62ed, 0x617d963f, 0x37e697e0, 0x9da2360e, 0x8f4c6fcf, 0xc38876c0,
-       0xef12c3ab, 0x753bf98c, 0xf142fd0a, 0xee1f7251, 0xd43bac8f, 0x17bd754d,
-       0x99fe7534, 0xff748c7d, 0x99c7e0b8, 0x97f5187d, 0x41afd3f5, 0x946631f7,
-       0x4f550e45, 0x18b884aa, 0xc4d39ce1, 0x5df056e1, 0xe095b3e9, 0xe81f4e7b,
-       0xaf36c46e, 0xf284ab3a, 0x1a1735ed, 0x5f737fd1, 0x76f074b9, 0x6d1997ca,
-       0xeacc4f18, 0x2edde750, 0x96fdf2a5, 0x7bfc482f, 0x3d58cf4c, 0x63f9c7c5,
-       0xd63fc4f5, 0x5f8a70ca, 0x9b2606ad, 0xfb853fb1, 0xf1657945, 0xd367d825,
-       0xcc1fc962, 0x5d8b643b, 0x83c81b90, 0x4f2ec759, 0xab5d3c40, 0xd3e4aabe,
-       0x4639331e, 0x6dbf3d22, 0xc8f6b57d, 0xaa57da71, 0x8bc14bac, 0xaded2752,
-       0x73ecaabe, 0xaa7d9770, 0xd6e197da, 0xfcc18f77, 0xd39efe63, 0xd2cfb146,
-       0xa8159c92, 0xbeefe6bf, 0xa5577540, 0xbfaeeace, 0x3c357e40, 0xe490e747,
-       0x4053f903, 0xc95aee4f, 0x022fafeb, 0xc2b6d83c, 0xd7001dfa, 0x6c7eb0cb,
-       0x78fd60db, 0x039595fd, 0xb4adf5a8, 0xe577bb53, 0x6ddd6a08, 0xeb5ea817,
-       0x7f63d3ea, 0x1ef3d524, 0xfaf39d97, 0x5247f7a8, 0x93ef5b5f, 0xc6be7823,
-       0xdf40c87d, 0x988fb82b, 0xb5177f48, 0xf8c4c9cd, 0xae63f3e0, 0x0ebb844c,
-       0x7c416deb, 0x0f61de71, 0xce3173c7, 0x58e1ed3b, 0x3f6fcb67, 0x2ffdc46b,
-       0x11bf7a75, 0x710061f3, 0x744d6e2a, 0xf7c0baef, 0x8515b6f7, 0x59af7e23,
-       0xfffd6b17, 0x536fb175, 0x202afb17, 0xf247a49f, 0x56c73a9c, 0xc2390f6c,
-       0x89e90417, 0x4f5e4e75, 0x4d939759, 0x99c9b872, 0x683f3b1d, 0x9e3286be,
-       0xcd8eb0bf, 0x3ebe0f09, 0xf340cd35, 0xa09cf15b, 0x156fef10, 0xea06ecfa,
-       0x213ed6ed, 0x47f3b6fc, 0x48ddf44d, 0x9985eefb, 0xea5fc41d, 0xb2badc7c,
-       0xfdf899f9, 0x1844e7bd, 0x75f3c7eb, 0xd31c7caa, 0xcb7ae3d4, 0xd32ccdcb,
-       0xce29c239, 0xbb40ceea, 0x319bcdad, 0xb706777d, 0x7e548eeb, 0x9527835e,
-       0xea3d608d, 0xde657f72, 0xfc6072b7, 0xd91d328c, 0x973ea50b, 0x2b67a657,
-       0x56f33f81, 0x9754bc18, 0xa69fd32b, 0x6c6e22fb, 0x22a5e4b0, 0x623a9f9f,
-       0x57da84b4, 0xaa7b2f6d, 0xb79e1b29, 0x5c7648d7, 0x77eab5d6, 0xa3edad95,
-       0x16fd6953, 0xf124e519, 0x53efa320, 0xf8f3d67b, 0xd63cef7e, 0xe30a54dc,
-       0x82ce8e58, 0x679b51f6, 0xbf433e43, 0xef879b44, 0x4bbbf612, 0x48c1cfd8,
-       0x8f9c04db, 0x73ca4bfb, 0x4d29fe5a, 0xaf36be95, 0xfdca905f, 0xbcb286aa,
-       0xdf483975, 0xf6863a09, 0xd8aca1a4, 0x9f341394, 0xe34f552e, 0x60fac11e,
-       0x907d707c, 0x75b501d7, 0xe5cf4541, 0x06317fb7, 0xf409bdf1, 0x7731da35,
-       0xe41faf32, 0x087452bf, 0x4e0046f5, 0xc94dbebe, 0x8eb7bf57, 0x0c5d7c65,
-       0xf679cbf7, 0xcb9f9448, 0xdee9f09b, 0x139fc448, 0xb5ea1eec, 0xcc6b3923,
-       0xe8268fa8, 0x1dfbf10b, 0x5aba53b7, 0xd27ac267, 0x8f57af9d, 0xf209efc3,
-       0x863d0fa7, 0x615e9f78, 0x7780fda0, 0x063e5ebe, 0x2ff62baf, 0xd5d6fa7f,
-       0x807f7811, 0xe1b70f64, 0xbc62b2fd, 0x0f877e3f, 0x226ce933, 0xdcfa0742,
-       0x8f53a47f, 0xc998f372, 0xf00a9d95, 0x75114fe6, 0xa76e0aa6, 0x314db7a7,
-       0xaa4fee30, 0xf4bee6ec, 0x741f29cf, 0xea9f2da9, 0xefb87147, 0xaf603721,
-       0x1d80f7f2, 0xb1d80a8b, 0x4abf6aef, 0xcf842d53, 0x218ec05b, 0xbc29d63c,
-       0xbfa5af3e, 0x37bfd04e, 0x1e9bd4bb, 0xe783fb46, 0x4a7ca0a8, 0xb8ed3dc9,
-       0xc33ef30d, 0xf0975fd1, 0xf95e9590, 0x6fd0a96f, 0x73f8bdb1, 0x7af80af7,
-       0xfad537dd, 0x2d33a9cf, 0x521ffd4d, 0x97f11267, 0xe2526f52, 0x9e04d7b5,
-       0xa175f695, 0x77f3be37, 0x435c680c, 0x0d60c77e, 0xacc31dfd, 0x44873a16,
-       0x80e18ef9, 0x8ced1591, 0xe2b3fdc7, 0x93af26bb, 0x8f03a4fc, 0x37f1b5fd,
-       0x935df8f1, 0x80672784, 0x76463c3d, 0xae8f395e, 0x9e63edae, 0xfbe16d6f,
-       0x435b6bc0, 0x9912eb9f, 0x297bedc6, 0x33ea87ac, 0x98ed7f62, 0xe44ea25d,
-       0x596d7a30, 0x4fbcb798, 0x74b79c1f, 0xca09fcdb, 0xc52f5dbe, 0x663cea7b,
-       0x3acb796f, 0x6afc3be5, 0xd1df8ec9, 0xd31e775c, 0x7ee1f7c1, 0x4be63cdb,
-       0xce3aeaa9, 0xad0b1481, 0xd125dcbf, 0x9d264cb9, 0xe7f686b3, 0x425922bf,
-       0x9a3eebed, 0xbc75e5ca, 0x6d3c83a8, 0xf4f1fce4, 0x8bed12ad, 0x90edefc7,
-       0xc2bf4fee, 0x3a79b7bf, 0xa36f7f8f, 0xef943dd4, 0xd40e6e68, 0x3b3be83d,
-       0xe51bfbe5, 0xfbe51a7b, 0x239b29cd, 0x07e23ce8, 0xdcc92d0d, 0x5f10f5ef,
-       0xf61e2bfe, 0x30d0f580, 0x5e4a1f56, 0xfd16a777, 0xbb8d2a6b, 0x476f71e1,
-       0x29ff086a, 0x7848e309, 0x5ed499cf, 0xa9b385e3, 0xfa8178ea, 0x46e178da,
-       0x4bee3dd5, 0xdd7a3765, 0x8df94203, 0x2dfe7037, 0x9bfcf3df, 0x4d6dd143,
-       0x15f3e878, 0x1d44d32b, 0x380e735d, 0x245df1eb, 0x924debb7, 0x51b72fed,
-       0xf540dd3d, 0x36af4574, 0x73f9f145, 0x7b4a7cc5, 0xb3d71a47, 0xf9d0864d,
-       0xdc62a9b2, 0x2831d946, 0xcf41da0d, 0x8397f3a8, 0xcbf9d45b, 0xe7d55a5b,
-       0xa9f50c85, 0x3fc903cf, 0xa61f3ea4, 0x1f3eafd0, 0xf509f866, 0x3b2330f9,
-       0xdcc3e7d4, 0x7cfaa1f6, 0xab741f98, 0x5fb797f3, 0x5ef9aa9e, 0x77cfcbd3,
-       0x7e0dce02, 0x4f34c4ae, 0x4e8d2e73, 0x844d2e73, 0xcd1a5ce6, 0xde622839,
-       0xcd1f4f2c, 0xf5ea34f9, 0x971eb159, 0xb8f5fd7b, 0x44d8fa67, 0x386fae3d,
-       0x5948f73e, 0x6dfa384e, 0xffd377ca, 0x97ccf821, 0xf48b9ae6, 0x5b1ead71,
-       0xb1d57c87, 0xf3032c2a, 0x29d5ae2e, 0x83f03c72, 0xbe8921eb, 0x9d5e2f9b,
-       0xe67bfb42, 0x3f250c35, 0xc8398f29, 0x638caa4f, 0x5873cf21, 0xd6f5c69f,
-       0x33037adc, 0x6ccbe0c6, 0xd0a81d46, 0x5b124d73, 0x798dedcf, 0x3561f022,
-       0xbb587ce3, 0xd53458ee, 0x59dd85bd, 0xaac151c4, 0xb9d217eb, 0x5d73da0d,
-       0x318b586a, 0xbc59e605, 0x41e49da1, 0x628bce7b, 0x9e62dc87, 0x7df516da,
-       0x8170db37, 0x1d6789ce, 0xee33b446, 0x86fdf556, 0xb32f5134, 0x8dca3b33,
-       0x1328beeb, 0x02c597fa, 0x4836732f, 0xce0fac16, 0xb84f686b, 0x0ef3fa0b,
-       0x296f14c9, 0xce3d6178, 0x73a5c9e1, 0xea1e2fd2, 0x45f3fe47, 0xc7092d9b,
-       0xbc79a2b9, 0xc35de920, 0x9c657af1, 0x5f9e386b, 0x0a327dd6, 0xa761f1bf,
-       0x5fc8eb2f, 0x08681f00, 0x36166df9, 0x3bcf3824, 0xc44960c7, 0xdd878b3c,
-       0xa6714c93, 0x75957b88, 0xc7104dbb, 0xe21f6346, 0xe93ebe54, 0x46e8892b,
-       0xfc1bad26, 0xf80f7c22, 0x9ac7143f, 0xfa156998, 0xcd6d673f, 0x3afae889,
-       0x5f90301f, 0x2c477731, 0x1b7315f9, 0xfe788c4a, 0xb15ddcc1, 0x79967fb4,
-       0xae31c71c, 0xba78e855, 0x3260ff21, 0x25b73bcc, 0xe9ab2ecb, 0x17138aa7,
-       0xe8569d37, 0xba0d79d6, 0x1ba28675, 0xfd754bd0, 0x17e134e5, 0xfbb17a08,
-       0xbdfbe8e3, 0xfa07a58a, 0x62efbe61, 0x0efd387d, 0xc038cf45, 0x5a64f5c3,
-       0x29de2abc, 0x8e3573eb, 0x2fba73a3, 0xba24286d, 0xf655e969, 0xe386f3df,
-       0xafec55f7, 0x8dfd0c51, 0xf66cbeca, 0x5b3eb854, 0xb955f2e2, 0xfa196c66,
-       0x7d0a6f39, 0x8b88baf8, 0x045c618e, 0x189bfc7e, 0x2dff4117, 0x05fd1711,
-       0x4f6822e3, 0x6d045c62, 0x4fff38a7, 0x00603391, 0x4293d7e2, 0xd55e4ebe,
-       0x3193cbf3, 0xdff6569f, 0x80ea166f, 0xb53c12e7, 0x33a74693, 0xf6a1d936,
-       0xa9a7cba7, 0x830ee9fd, 0xed324c65, 0x81f5e26b, 0x54dbceb9, 0x66de99e3,
-       0x1b073cc4, 0x4eb81f90, 0xc466c7f6, 0x098cc73c, 0x3ff1aa71, 0xf5554a6c,
-       0x0c5fa02f, 0xeb294df0, 0x777ebaab, 0x7f5520c5, 0x424065ce, 0x95af723e,
-       0xe22ce79f, 0x2794ca24, 0x9f0dea06, 0xfa4f0fd6, 0xe9fbc011, 0xd7dd0311,
-       0xeba143d2, 0xca3acdfc, 0x0cdbcedf, 0x3b79836b, 0x5c91e79b, 0x8a227c7d,
-       0xdc6987ce, 0x08daff91, 0x61de9fe8, 0xa764fda0, 0xc21ee21b, 0xef4faaf3,
-       0xefc68848, 0x328d5cf2, 0xb59e91f3, 0xe6559e90, 0x4558692d, 0xc7307fbf,
-       0xf947661b, 0xf3dfb39f, 0xfdc7d2b8, 0x0645b401, 0xecb8e3e5, 0x3f4449f5,
-       0x7b77e107, 0x3fc5e538, 0x058f3034, 0x1d79cbfc, 0x250fae1c, 0xb3fd80d6,
-       0xfff4efe1, 0x6e71c011, 0x0e957362, 0x48f928fd, 0xe7cbe902, 0x5b7c8665,
-       0xe740d4b1, 0x4b7a2f09, 0x267d8ade, 0x7a72a5e5, 0x1d3bf4cb, 0xcd187b6c,
-       0x4381bacf, 0xdff2dc60, 0x5eb93d84, 0xffa8b9e4, 0xf5dec1fb, 0x8f913f82,
-       0x8e658c3e, 0xe7960258, 0x963a3e1b, 0x009e7540, 0x7043bd3e, 0x3bd4bfdd,
-       0xbd83a5fb, 0x3bcaa8fa, 0xfddaf484, 0x5a572409, 0xb91a77bc, 0x1ca0f2de,
-       0x197d0148, 0x9dfe3390, 0x3d833cd5, 0xaafa4ed1, 0x55f50520, 0xe50306e7,
-       0x11de9915, 0xcf70ebcd, 0xef2b1f13, 0xc6dbd4e9, 0x4d9d7c20, 0xe11df459,
-       0xd9320ddc, 0x3e3fe43b, 0xebe3cbde, 0xe30bb28d, 0xe4934f75, 0xcb5d78c2,
-       0x0e96cb37, 0x9815dfa7, 0xd9193885, 0x4f9c0f53, 0xa50775e1, 0x3f0f78bf,
-       0x74159fd7, 0x0e0da7e8, 0x7f03475e, 0x5f9f325f, 0x26bc7739, 0xf0a74ffb,
-       0x878ba668, 0xf7e0c6fa, 0xcb8f6738, 0xb36767c4, 0x0325879b, 0xedd13f3d,
-       0xe823f61d, 0x73d13c7f, 0x70fd8f46, 0xebc454d7, 0x0c86dd12, 0xabba1efc,
-       0x6e87bded, 0x7a3ee783, 0x312760d6, 0xfa40915f, 0x45f6f163, 0x7df75f99,
-       0x3ef05810, 0x48e8cf3c, 0x4b9f0091, 0x30632d6c, 0x3980b07f, 0xf8e21d85,
-       0x79e0edb1, 0x9e26cb0c, 0x30af78d7, 0x67ee3d6a, 0x5bc9a79b, 0x13be27bc,
-       0xa92e905c, 0xa2ed84fc, 0xf9c74f3f, 0xf3c73d9b, 0xd2a7f059, 0xfbf16eff,
-       0x57de8a1e, 0x6b0d75f4, 0x7fa9f3a6, 0xf04d9e94, 0x34bc922c, 0x9a4f0eae,
-       0x65551506, 0xcd6af1e1, 0x8a5e6133, 0xe9606d47, 0xdd80fc82, 0x6e7a36e9,
-       0x47d9f1b1, 0x32176d91, 0x669f5f3f, 0x6f0647dc, 0xa7ab3f95, 0x6cb2a9bd,
-       0xfcd2b06d, 0x57ee3b06, 0xb4e4285c, 0xfaf259b6, 0x6ec83af8, 0x2cf3102e,
-       0x6b537610, 0x23d87a9f, 0xa05a1d8d, 0x59acb3b1, 0x5e01576d, 0x815b973a,
-       0x33a70b57, 0xb0f08a32, 0xcf9f99b8, 0x1ef2e551, 0x4b70449c, 0x0f64a076,
-       0x67321678, 0xe3ae2c69, 0x6b8f1e19, 0xabaed3e1, 0x9d62bc07, 0xecabb85a,
-       0x01727c17, 0xda0a3dff, 0x8759a9df, 0xbfad0f42, 0xcaa5d0a6, 0xd55bf1c3,
-       0xdf3d1126, 0x3207eabf, 0xf0aa07da, 0xff816b0b, 0x4e779ea9, 0x70b67d42,
-       0xacdfe813, 0xfc28ff00, 0x44b598b4, 0x31d4bf23, 0xd496235f, 0x7e5afacf,
-       0xcf0b3238, 0xe7463a65, 0x7d585547, 0x80b174fd, 0x1fdfcf42, 0x8041fb2a,
-       0xbe78b5af, 0x17af5d16, 0x11d44c6f, 0xd3c039e8, 0xfa64a782, 0x9c6827ae,
-       0x243d7f88, 0x8f1ed54f, 0xd5cbeb11, 0xdc3e7e7a, 0xeb74e0b5, 0x5d29eff9,
-       0xfc5ede13, 0xf70aefa4, 0xf9bde907, 0x4262fd59, 0x9d6529e9, 0x72bd08ef,
-       0xb7aefb4d, 0xbec8c5df, 0x8f984827, 0x575f4de9, 0x00bebb09, 0x67b43ced,
-       0xe740bf36, 0xe9bfbe2e, 0xd55f3a05, 0xda02ecf8, 0xf3667097, 0xf7f087bc,
-       0x98ecce23, 0xe17d7647, 0x775d8a63, 0x85fd8319, 0x9e73cd92, 0xafc85ff8,
-       0xdd5384cf, 0x4bbf6ab8, 0x47a039c4, 0x336d9c61, 0x136c9bd7, 0xd10ba3d7,
-       0xfd92e5fe, 0xddc709bb, 0x09bae557, 0x3ae83ef9, 0xe6fbc5d9, 0x07b77eb9,
-       0xb7efbde6, 0x2d0f7691, 0x79e3e2d9, 0xed0f8b67, 0x7f3ded5f, 0x0bbf4539,
-       0xeb791f25, 0x87bd8ac7, 0x577aedee, 0x97ca0642, 0xf2b5f3b0, 0xfa0b0cd6,
-       0xfc2ec205, 0x173df1b3, 0x14fe4df1, 0x4dbbf7c7, 0x6defcf1c, 0xdc6f78e0,
-       0xd3e297d1, 0x92fa9b77, 0x8eeef51f, 0xf9ef847e, 0xe4df01eb, 0x7ed4db47,
-       0x1be01354, 0x37c404e3, 0xbf7735c0, 0xcedbe04d, 0xf1c4ddf1, 0x76f036cc,
-       0x7abc0f7e, 0xfbf4fce8, 0x8ecc3dfe, 0xe187c17e, 0x3e97f23e, 0x99d329dc,
-       0xa59f8a67, 0xb19f39f8, 0x1fd1c7e6, 0xa8bdf053, 0xea087fbf, 0x7f8d8a97,
-       0x2fbc468a, 0x2393c9da, 0x1ccdf03d, 0x076fe849, 0x2fd57fde, 0x0848cb2a,
-       0x21be8bf2, 0x9398ea5d, 0xe1d723f6, 0x82436479, 0xbf2b3df6, 0xe7dda65b,
-       0xc8f9e36c, 0x99376630, 0xed349e10, 0x18b9afef, 0xbcfe7bee, 0xf75985df,
-       0xab771c90, 0x12634f7e, 0x9cf019f3, 0xd122d602, 0xe5da967e, 0x188ba34b,
-       0x4f5a3f9e, 0xe0cdac70, 0xbc2bbd76, 0xb2fc833b, 0xef1c613d, 0xf3aaf19d,
-       0x6fdd2789, 0xb457f98f, 0xf9f847fb, 0x763c93c4, 0x1a4e67ca, 0x2ab93431,
-       0x2e0bae88, 0xab8973f3, 0xf2e6032e, 0xc6fdf7f1, 0x0587bed2, 0xcea853cd,
-       0x496d055f, 0xbe5ef8f0, 0xc19b5bbf, 0xb8539be3, 0x973c3ca6, 0x9d7efc49,
-       0xea8d1738, 0x539b80b4, 0x373a4ee1, 0xc98254ef, 0x8bbacfce, 0xeffdf3a1,
-       0xa6707a16, 0x13ed20f9, 0xcc3c7987, 0xbfd6e78a, 0xab014069, 0x8b3c7530,
-       0xe4ecf021, 0xe935eef7, 0x837f6b70, 0x7773e445, 0x13d7157d, 0xd51d009e,
-       0x23b9b9e7, 0x9a3fe742, 0x87255e05, 0x610cea83, 0xbc047730, 0x3619e7ff,
-       0x6fec5d7e, 0x9e805b67, 0x85cf3d51, 0x0f33ae53, 0xa6b60f3f, 0x2b7dfe18,
-       0x7a848ce3, 0xfaa9d643, 0x7f7e4635, 0xc9c4c67b, 0xf631469b, 0xf7ac0306,
-       0xf194bf45, 0x8c4e7f38, 0x4d75f717, 0xaca373c6, 0xaf89ead8, 0x4799eaa6,
-       0x3326dbc7, 0x79c43bd6, 0xfe049351, 0xbe608fa6, 0xdf7de018, 0x89b9f561,
-       0xbe74f977, 0x93af009b, 0x21ba5cf1, 0xcd9cfe78, 0x38f78160, 0x8c3ca4cb,
-       0x7f566a4f, 0x64f77833, 0x94de4f94, 0x8e9d7d06, 0x9e63f9c3, 0xf989988f,
-       0x2cc3c079, 0xe72fdb3d, 0x5e237a71, 0xed1b56dc, 0x2a5ee8f3, 0x25147ed1,
-       0x7bd0af2f, 0x4f2f2068, 0xe0299c74, 0xa29a7983, 0x686379f1, 0x50ce1d7a,
-       0x8a16e8e2, 0xf90897af, 0xe5c8a25c, 0x9e5cb50e, 0x7e823a45, 0xc8893dc6,
-       0x0b453357, 0x6bf9a4eb, 0x73947bc4, 0xf064cfd3, 0x0c99e97c, 0xfe387f5e,
-       0xccc7df2d, 0x45469cfc, 0xf8c36b3e, 0x27fbcafc, 0xc333b68b, 0xf02bf34a,
-       0x1ff1f368, 0x7e43596c, 0xccb7f552, 0x1be907c7, 0xc6497baa, 0x7a88f9ee,
-       0x49c25fe9, 0x5b1a66ee, 0x7b9bd5fa, 0x1dce538e, 0x037e60ac, 0x55300faf,
-       0x6cb4741d, 0x2b2c73a6, 0x9afbfe24, 0x1e51455d, 0x6be60c5d, 0x8ada440c,
-       0xe973f31f, 0xfbe709de, 0xee632b3b, 0x607e849b, 0x4f51b445, 0x7f31ece7,
-       0x40565654, 0xc91636ef, 0x04214e74, 0x6eb19382, 0x7feb06b6, 0x23b0ffbc,
-       0xa24bb28d, 0x51d7b3ff, 0x02bb4d1f, 0x43fea7f4, 0x0f101d93, 0xf7101d75,
-       0x7cf4c3d9, 0x8f8203d7, 0xfde73f3d, 0x37f7285f, 0xe53afef3, 0xffde16fe,
-       0xe8bf3299, 0x5fdcd46f, 0x4bffb9a5, 0x627c4fde, 0xfa0f64cb, 0xa59cc5af,
-       0xe8956e2b, 0x05ca3577, 0xf6ac559f, 0x742b7e11, 0xcc5b797b, 0x6b82ba7c,
-       0x74ce2b8f, 0x211fa396, 0xa1467547, 0xe5909e9d, 0x75bb4728, 0x2b2bba6b,
-       0x53c5da13, 0xd6118f24, 0xc97b8ecd, 0x45ea4c6e, 0xbe0b971f, 0xf9f1b22d,
-       0x3cc37c14, 0xbf0b3303, 0x847e3cfd, 0x4f35412b, 0xf3c0f5fe, 0x798f5b6b,
-       0x3ccf5d46, 0xbaf52cba, 0x89e83f14, 0x385dc76c, 0x2e1ed69f, 0x063da9f9,
-       0x35ec50f3, 0xeae1fdf1, 0x987c8c96, 0xbb73c97f, 0xefd0aa33, 0x1d40fe12,
-       0x3c7cc3da, 0xc3db82e7, 0xf24fdb8f, 0xdabb707d, 0xbf30638d, 0x3db06d0f,
-       0xce05e9ac, 0xd89d4c8a, 0xd791b047, 0xab3b9ec5, 0xd12e7a47, 0x0c799cb5,
-       0x52adfbed, 0x1127dfe8, 0xe5ea9dcf, 0x66e68e77, 0x90d43d72, 0xeb8398e3,
-       0x3464c92c, 0xe84d64be, 0x9b7f9a73, 0x8572edc9, 0x86f37bb0, 0x806c9945,
-       0xaee3c2e7, 0xaabfb835, 0x1e564b6a, 0xa56785e6, 0xfcc92f17, 0x376abcda,
-       0xf1b6abcf, 0xd5856abc, 0x37941cbf, 0xedb33a7b, 0x633a5361, 0x914dffe3,
-       0x78591033, 0xe94c2cb6, 0x74b939bf, 0x617bcf14, 0x4713dd7f, 0x39b9461e,
-       0xfe60f084, 0x08e0f87c, 0x591d0bd4, 0xe80b3a91, 0x7369598b, 0xacfe469e,
-       0xda03fe1c, 0x1614532f, 0xcf0e7fd5, 0xcc5f13cf, 0x42ae734a, 0xe63c7138,
-       0x5f465c43, 0x0eb05dc2, 0xed32abd7, 0x890d7553, 0x4efc8574, 0xe9e1e059,
-       0xebe10b4c, 0xfd199010, 0xe50e0514, 0x2fe7e0fd, 0x9d7cc3f7, 0xe28653ab,
-       0xb4be4e77, 0x85996da2, 0xd2fbf781, 0xbf048f5c, 0xfac753bf, 0x4df1a863,
-       0xc05878e1, 0x06e90db1, 0xcc9473ad, 0xdef1411c, 0x5548d2d4, 0x3884da7f,
-       0xd7ce08e6, 0xf5554b4e, 0xaafa2bcb, 0x7f3ddfc6, 0xc4feea90, 0x7d417f30,
-       0xbbdbbf90, 0xe7e1e49f, 0x4545458f, 0xbfbcbee0, 0x36f67db7, 0xd7745efe,
-       0x7d1db253, 0xb67b45da, 0x03478dbd, 0xb39fc45f, 0x8da43ca0, 0x1d1f66f2,
-       0xd73f1992, 0xae0fa1c2, 0xfe639d0f, 0x1077f147, 0x2907ab7a, 0xcb12eef1,
-       0x801dfa7e, 0x3a0f5d1b, 0x41ea2998, 0xed0f2c79, 0xb7fac5e1, 0x67576f28,
-       0xb73bebe6, 0x8b4f9f9b, 0x057f53e7, 0x3e077efc, 0x65e1fe88, 0x4bb5e50f,
-       0xfd534f5a, 0xeb932aac, 0xa5b4bae9, 0xdd8bf47a, 0x181da2d0, 0x062afa03,
-       0xcedfc5f8, 0x7dc2ef06, 0xdc51596c, 0x953cbf5f, 0x2be438b1, 0x9439e79e,
-       0x53bf4b18, 0x8ca9a4bc, 0x8e5dd7ae, 0x975ff9a0, 0xcd4fb4fd, 0x754492f3,
-       0x95a98988, 0xc6bf71ab, 0xee4f08a1, 0xc4ef7832, 0x8651dddf, 0xc5dbab78,
-       0x944c91f7, 0x0a5828df, 0x19734d6d, 0x66513f3d, 0x17f02487, 0xfb7097c6,
-       0xbe6d113b, 0x46e0f715, 0x2bbb47ad, 0x7ffd7d1b, 0x18c67a85, 0xe6267a45,
-       0x7ef4ddf2, 0x3d1365f7, 0x88f425df, 0x35c383a1, 0xae93b2fa, 0x59f0fc2b,
-       0x77eab666, 0x4f090c7f, 0x91f7f1e9, 0xc68c1d0d, 0x903cbb8f, 0xafbd655a,
-       0xfa77f80e, 0xc2435b5d, 0xfa5fb4a7, 0x42c978d5, 0x0f46886e, 0x1e1faa5f,
-       0xa9e842c3, 0xf111efab, 0x5fea1848, 0x72ccbf68, 0x3012da44, 0x63d0e99e,
-       0x4d99885d, 0xffe44fb4, 0x0538cd00, 0x00800076, 0x00000000, 0x00088b1f,
-       0x00000000, 0x7dc5ff00, 0xd554780b, 0x399ef0b5, 0x66491e67, 0x99212726,
-       0x4ce21024, 0xe010245e, 0x0f080424, 0x860240cb, 0x084013a7, 0xbc80e834,
-       0x2b101025, 0x0337e95e, 0x60d22049, 0x45405283, 0x68b0503b, 0xaaf8ff6d,
-       0x0131f5a9, 0xe94a0fe4, 0x7ab7bd60, 0x52036b6f, 0xe08d4504, 0xb16dcfed,
-       0xbdad6bfe, 0x3267324f, 0xfdeded41, 0xbe3ef9ff, 0x3ef6759d, 0x7af6b1fb,
-       0xb30fb5ef, 0xcb5d8aca, 0x0afb188b, 0x9318137f, 0xbb302e8e, 0xda663286,
-       0xb1ecc67d, 0xb2816631, 0x96bea23c, 0x046b4f31, 0x2e4995ac, 0x19236323,
-       0x3950b6fc, 0xfbc1db0b, 0x631f77cc, 0x576ec64e, 0x4a6dff18, 0xb1832c65,
-       0xed04dfbf, 0x0fde7b53, 0x852ea01b, 0x968bc0b1, 0xbbf861e0, 0xc72fb65f,
-       0x89e1f505, 0xec39faac, 0x55670e47, 0xcddfa1d9, 0xda15b29d, 0x39559b31,
-       0x9ff806ec, 0x6f82ff34, 0x8ba77f39, 0x12b7ffcf, 0xfdfd84db, 0xb084c276,
-       0x7ed5e607, 0x921188ff, 0x31dfa7ab, 0x63b5332e, 0x5675d74a, 0xd7bad8ca,
-       0x603b5c12, 0xc1fb337d, 0x5ebb8033, 0xba0f04b5, 0xa43339e9, 0x68396960,
-       0x8e75fa80, 0x8c2f7cae, 0x5c7afe5f, 0x7e830d88, 0x19938f5f, 0xae52f38c,
-       0xa5e20c6f, 0x1541f5fc, 0xf24c0706, 0xa0cc8b15, 0x3c9ba4dd, 0x5f79f163,
-       0xaf5e8df3, 0xf9c60256, 0x18a7cefc, 0xadbbbdf1, 0x5529b5fc, 0x22624086,
-       0xc954d774, 0x16c608d8, 0x9b0d9b5f, 0x6b92d8c2, 0x5afb04f1, 0x75abf3f8,
-       0xdf705369, 0x49866eae, 0x6c963ac3, 0x017d0c36, 0x765cc5d6, 0x30f00f35,
-       0xada2c073, 0x5339e60c, 0x677ad232, 0xd60a490e, 0x71dbd343, 0x73e0c7bf,
-       0x664861d6, 0x3db97a6c, 0xd6f18460, 0xdfa8535c, 0x1a2e6bda, 0x64b5ed6f,
-       0xb35dd782, 0xdae4b952, 0xb96e7a60, 0x801e6466, 0x1c035e97, 0xdb273c00,
-       0x3fd70ab7, 0x4a96feb3, 0x35b7cf1c, 0x8b67d4a3, 0x82b317a4, 0x92f40574,
-       0xb3d6dcbe, 0x05f6fafe, 0x2fe85530, 0xb2f44bc5, 0x88f2ca14, 0x0e8265fa,
-       0x56b6f1a2, 0xa537ffec, 0x5f411a97, 0x3ca16c4b, 0x54c1e023, 0x856ea717,
-       0x71495cf9, 0x6cbc414d, 0x6fe38078, 0x6e5bc983, 0x786ef987, 0xcec2a0c4,
-       0xd9473bb0, 0x32f00cad, 0xb33addea, 0x176e822f, 0x5cc61b5c, 0xd739feb0,
-       0x7dbca972, 0xae336fa0, 0x79b5f17f, 0xa8c34f02, 0x2364d664, 0x46d8c51b,
-       0x4e1757dc, 0xb3ef9928, 0x7517df98, 0x85eed3a3, 0x6538bff1, 0xb88bfaa2,
-       0x5530252f, 0x9c09e04f, 0x51682997, 0x2ebcc00f, 0x8140589a, 0x9f73b8ad,
-       0xdf000591, 0x41f4a14b, 0xb07b5d09, 0x291de59d, 0x92ed8ed8, 0x04a92798,
-       0x2deb09f1, 0x057c63e0, 0xc2192eff, 0xfd42f7f9, 0x965b3327, 0x81e0731b,
-       0x86552a74, 0x9cf27e75, 0xbe7824c4, 0x4e1bfd6a, 0x95ab1e58, 0x5029640e,
-       0xcc10d1bf, 0x3d8c4937, 0xe2f6fb22, 0xd85a3eba, 0xd0656ffa, 0xf3cb7cee,
-       0x0d57dc0e, 0x2872adaf, 0x0569fb0f, 0xee60067c, 0x6552cdad, 0x26c346d0,
-       0xa1ed0d54, 0xa39e8d6f, 0xb5f57ce9, 0xaba7a26c, 0x2fa19675, 0xdd031d20,
-       0x415af3e2, 0xfd2177ef, 0xacea6943, 0xe9c8f414, 0x5aeba35f, 0x5aadcb99,
-       0x0030625b, 0xbff99bf3, 0xf500fe80, 0xf2a85f6b, 0x2bba444e, 0x5079a830,
-       0x32fc11ac, 0xe0f83a53, 0xcf83e458, 0x787ad452, 0x579af93e, 0xc1f3d73c,
-       0xc674fe4b, 0xbc4b19f2, 0xd5c690b6, 0xe822dfe8, 0xdff484dd, 0x2d83de8f,
-       0xd9fffe05, 0x77ff9edf, 0xdb90f3f8, 0x6be216f7, 0x7fca1c9a, 0x3b4b052c,
-       0x94e4d1d1, 0xe7e9192a, 0xb3cfcb9b, 0xd59e7e42, 0x7db5cfc9, 0xb7f0cfc8,
-       0x04d787e4, 0xd85a543f, 0x2e22de1d, 0x7bdb67df, 0x3d97ebfa, 0xea0b9ce9,
-       0x7819743f, 0xf343ff7f, 0xca5bf0fe, 0x86fd7ffd, 0x42afff72, 0x79cb47ee,
-       0x9ca1fd06, 0xc2d5ecff, 0xf781ea20, 0xd405e819, 0xb824af7b, 0x403d0b0e,
-       0x313e227a, 0xd03d2378, 0x5fe77b90, 0x7f03d0fb, 0xa3fdbc43, 0x3fa3407a,
-       0xfe345f8d, 0x9a21f8d0, 0x987e347f, 0xf13503fe, 0x401fdc5e, 0x1fe461cc,
-       0xae0cf039, 0x5095d6a3, 0xf1a97c8c, 0x0c17dad1, 0xf4bd67c4, 0x1e9be083,
-       0x0bebd13e, 0x3e341f8d, 0x56a6f8d1, 0x28b2c3f0, 0xb526387e, 0xde163c3e,
-       0x15f6eedb, 0xf87b53b9, 0xd173cd63, 0x7a4fa17a, 0xcb4f4862, 0xd218ea52,
-       0x91942d53, 0x83e964f4, 0xdfdd8a9e, 0x126e9e8e, 0x9e8ebfed, 0x6a66dc2a,
-       0x4f483ff7, 0x3191ee15, 0xfbb269e9, 0x5c57689f, 0xa97dfbad, 0xb573e60b,
-       0xbbace414, 0xbfa6de87, 0x90ddb8c5, 0x7e915763, 0x3af9e23a, 0x8303cc3b,
-       0x2beed8f5, 0xd4788756, 0x67db52e8, 0x86580ecd, 0xb6e50074, 0x9c2aef6c,
-       0xa07c476f, 0x9337fd68, 0x96cfb477, 0x53d9b094, 0xd61dfb84, 0xecbeffe9,
-       0x72dfb5c5, 0xdfdc6b9f, 0xddf86e4c, 0xd17b74ff, 0x272d8eef, 0x7d9dff02,
-       0x7f0e599d, 0x94f047f6, 0xf61e33d7, 0x660287e7, 0xcbf22f61, 0xfead32bc,
-       0x191e2d37, 0x3dfc03e5, 0x30f04696, 0xc381e12b, 0x0ae1d381, 0x87f4e798,
-       0x5803ebbb, 0xa27c793f, 0x0c798fe8, 0x8ffda7ac, 0x6e15bc0f, 0xc2defd26,
-       0x94ebeff1, 0xe02343bd, 0x11ed8052, 0xbc145970, 0xc877b79f, 0x7ea14c9d,
-       0xa0af9c82, 0xc209437f, 0x7e827f5a, 0x55f8e799, 0xc52cf3c0, 0x3ec076c0,
-       0xf0394bad, 0x6b9455c6, 0x7066066d, 0xfd81e045, 0x04c9ebde, 0x20c578ba,
-       0x7b08ffe0, 0xf85b1972, 0xb84f8702, 0xc812d4ff, 0xbe02fd15, 0x9b7408d7,
-       0x091e0d5a, 0x66535bfa, 0x7bbb6608, 0x5b84fbe3, 0x7cdaabd3, 0xdfea5540,
-       0x6f94e667, 0x6d1a3ef7, 0xbd367ef4, 0x8b7cb21f, 0x678fe7f1, 0x7b0c609e,
-       0x1f820ff8, 0x63134a2a, 0x4b779fd6, 0x01d7ff1c, 0x4787c6d6, 0xc1fd6073,
-       0x5975fc18, 0x1a3617f4, 0xd6ff3e05, 0x36167482, 0x6bfef86b, 0x327be20b,
-       0x8274dd63, 0x13e30374, 0x7fdc7ffc, 0x7cc936f5, 0x7c289eb9, 0x6fbd68dd,
-       0x2057c0c6, 0x372cbf6a, 0x6ee9f7c0, 0xbef3d0b9, 0xe87eff4b, 0x4ef5fb46,
-       0xdd05f1af, 0xd8e8d4ae, 0x44f7a3a3, 0x99f44bd9, 0x02506298, 0xbd6b8f40,
-       0x2fe8cd71, 0xa9a7f0f4, 0x8e14f10a, 0x87a9e3d3, 0x1555ccff, 0x448fb236,
-       0xe42eeb7b, 0xbbb1af5f, 0x6ec7e73d, 0x029e66ba, 0xd29a2bc0, 0x41d27ef8,
-       0x8d80aecb, 0x09ea82e8, 0x77988dce, 0x46b63f34, 0xf8a3e3c1, 0xc91ff057,
-       0x8007d40f, 0x6f943ca7, 0xaecd6729, 0xb3513a08, 0x313e9e39, 0xa7946ab0,
-       0x8edc49e1, 0xd2f3670c, 0xfaa06d9b, 0x1fbe6cb2, 0xe386511e, 0xa7a0f023,
-       0x2bfa109f, 0x3c26eb11, 0xd6d1482d, 0x0335505d, 0xe64e15d6, 0x73b2d3f5,
-       0x7b320577, 0x66fee8e0, 0x05541764, 0xcffb228a, 0x5d78833f, 0xcde6f020,
-       0xeb06741e, 0x4b507935, 0x11f44284, 0x8b507940, 0x4de861f4, 0xbdd9e91f,
-       0xf51033e8, 0x8374c7be, 0xbf7ab3f7, 0x9f7a89ef, 0xcdbe5299, 0x66df62fb,
-       0x656bed44, 0x4456bed4, 0x1c1a35c1, 0x4d5fc9d4, 0xdb692f2e, 0x7984e8d5,
-       0xe40475dc, 0xe7a48b2c, 0x77cf4451, 0x8efd1a29, 0xbb7a833e, 0x08cb9e87,
-       0xf62add9e, 0x1766302d, 0x942a9fea, 0xe07b63c3, 0x08872839, 0x19e55b1e,
-       0xc6afa91e, 0x3db942ed, 0x3f6b49bf, 0x6c2fda9e, 0x99bbfad0, 0x647db5ea,
-       0xd154ef81, 0xc3b90abe, 0x60ce1302, 0xf857eafd, 0x3d07f5fb, 0x0fc86e67,
-       0xd978512d, 0xa207051f, 0x1afeefda, 0xf510d6fd, 0xfaa8e6fe, 0x5f7828e6,
-       0x7fa4dc14, 0x0352f17f, 0xa062e1f1, 0x6888dc07, 0x8fa68cbe, 0xedbbb387,
-       0x6e7d6e9c, 0xa77d91b0, 0xf5e9abe3, 0xe0fc7e1c, 0xa2a6aacc, 0xd6fb3808,
-       0xdff700aa, 0x2697480d, 0x73207fc6, 0x83d01203, 0xf9b90fa9, 0xb2e8be83,
-       0xf3df5a20, 0x9fe13ffa, 0x332f6819, 0x4c725d9d, 0x92edc3d2, 0x6745ef36,
-       0x43e11636, 0x42a9ae0d, 0x5efa7a7f, 0x9fc0bafd, 0xaac2f015, 0xbb08cc8a,
-       0xcaa0b028, 0xad4eb113, 0xbf2f94fd, 0xe7bc7092, 0x1d5417b3, 0x499afa82,
-       0x983abca1, 0x2f324d67, 0xa84a5f41, 0xf889d7af, 0x255794cd, 0x9acbea2f,
-       0x86de50f8, 0xb27588a2, 0x675c7cd6, 0xed12fdfb, 0xf61ea04f, 0x98b4f007,
-       0x8f0a2381, 0x331e64ee, 0xc4fa81cb, 0xc24f4dc4, 0x97eec77b, 0x7e9ea136,
-       0x273f537f, 0x39c943fa, 0x963ceedc, 0x19739378, 0x7709edc0, 0xdf6dbc90,
-       0xa3ca993e, 0x975b6792, 0xd9dbd8c2, 0x856caaab, 0x78489f58, 0x69707d3a,
-       0xefa016d5, 0x7a2ed933, 0x38ac97df, 0xdeded0db, 0x5d876261, 0xe2952f38,
-       0x5a778b48, 0x7ce0778a, 0xa2710cb6, 0x47e4b9fd, 0xa0325355, 0x934692dd,
-       0xa754768a, 0xf9c2c951, 0x364c76f9, 0x06d2fd63, 0xa16e0651, 0xffbff5f2,
-       0xed01dea4, 0xa8371ebb, 0xcdfda107, 0x35beb45f, 0x4d15e00c, 0xd16e2a39,
-       0x2807e06b, 0x7db9ce30, 0xd0128283, 0x757107e5, 0xf6f16627, 0xb8afdb0c,
-       0xab3d3aee, 0xca4bdb14, 0x017f6856, 0x7cfda39e, 0xa0e901e1, 0xb0e5e701,
-       0x49601bc7, 0x1464be17, 0x68d0b9cf, 0xee7c6209, 0xfb77cd9c, 0x9f671c3e,
-       0x767d2d09, 0x1872e0c1, 0x1d9f0f00, 0x3d2ab7bc, 0xc45b9f03, 0xb49bdefe,
-       0xd8b0f018, 0xa43f4dd8, 0x7127964f, 0x7becb3f8, 0x3ac30eab, 0x88323c2e,
-       0x722b57e2, 0x80d95d3c, 0xcf5cc2af, 0x107e58e7, 0xebd6f5c7, 0x40ee977f,
-       0x97d7fe3b, 0xbe913897, 0xd6f426fe, 0x3896d76b, 0x55d84497, 0x89913fcb,
-       0xbb375e0e, 0x5f7ce236, 0x40681f8f, 0xa0e81b3f, 0x97c9c61f, 0xe805bf0a,
-       0x31f3d379, 0xcd7fabec, 0xdabf6896, 0xde3a907f, 0x6deba3a5, 0xdfc8a7a4,
-       0x93f6d800, 0xa002bbad, 0x365bcfdb, 0x8e500fb1, 0x7147ee6d, 0xc84ca5db,
-       0x82e26781, 0xf4b157e8, 0xf8c8fcd6, 0x8a1f374d, 0xd80c7ff6, 0x847faf09,
-       0xfdf7e8f6, 0x761ff031, 0x7eddeb66, 0x401ec385, 0xbb43e2e3, 0x78fdc65d,
-       0xb85ff65f, 0xfe5bde0f, 0xc0f489b8, 0x3753c7f2, 0x40b8e177, 0x8b571837,
-       0x1c82d75e, 0xf4638f13, 0x878197c5, 0xfe742aab, 0xbf24c3ca, 0xfccbe2fb,
-       0x75543c9f, 0x5f37d6c8, 0x7cb850ae, 0xc9b8f29a, 0x62b4fc8b, 0xa0665da4,
-       0xfe3d264f, 0xcfc461c6, 0x2571f58a, 0x8af89816, 0x5fb42dc7, 0x407b769d,
-       0xc39f7a81, 0x5941272e, 0xd6e5c39a, 0xed171cbc, 0x64c4b973, 0x0d95096b,
-       0x82bd6f18, 0x2f800de1, 0xcf787a6d, 0x23e71868, 0x1a379c16, 0xc3c577f0,
-       0x0bcaf4e9, 0x991dc512, 0x826791ec, 0xb8c95cbc, 0xf93da89c, 0xfc2279bc,
-       0xc56eb2b9, 0x5707f40c, 0x3ae74d05, 0xf18e0f85, 0xf9ac75d8, 0xea186973,
-       0xa273fd57, 0xf3d62704, 0x49d61adf, 0x35b6a372, 0xdaebfbf6, 0xe467cff4,
-       0x0c2e53d8, 0x2e431861, 0x2bb10c01, 0x067ca675, 0x03615c4b, 0x96f582fe,
-       0xbcd037ef, 0x82926c57, 0x79779816, 0x3e2f1e3f, 0x37fd87ef, 0x0a03bad3,
-       0x73762bc0, 0x1982b3bd, 0xf3f85682, 0x29ebfd96, 0xc84c797e, 0xe606c599,
-       0x20fefa45, 0x3f42cd4e, 0x71e3f97f, 0x4f15df84, 0x47b7faac, 0x2dcebde0,
-       0xfd225333, 0x174825ea, 0x9accbf1c, 0x87cfd3dc, 0x859fbe5b, 0x63fe5ff4,
-       0x3d618ff0, 0x2fd8922b, 0xbf71b816, 0xb65cb232, 0xb62b769e, 0xdbcf9fde,
-       0x7e0d7f81, 0x2407e2f4, 0xd17b075a, 0x78107a42, 0xdbc4895d, 0x669386d2,
-       0x5bff1173, 0xdafb0a71, 0x39bc7285, 0xe7fbc12c, 0x11b25ea0, 0x119d02fe,
-       0xb03bf271, 0x23920caf, 0x8d5f5c3e, 0x6cc770d1, 0x8ccba7ea, 0x8733bd7c,
-       0x441b43c7, 0xbd4b38b9, 0x0fcfe29d, 0x6eadd45a, 0x4a348fde, 0xbbfc03cc,
-       0x3978635a, 0x2fd981c6, 0x5957142d, 0x89e710d7, 0xe23f9073, 0x5dfa0e79,
-       0x9cd93327, 0xfa72fd8c, 0x72e2e35b, 0x2bbf9e03, 0x3b5af3c3, 0x49b58b97,
-       0x97ae6f80, 0xffe8463d, 0x872bfc33, 0xac3197f7, 0xf1eefde7, 0x85f53d0d,
-       0xfd5f10c3, 0x3ce355e6, 0xdf112e7e, 0x2c1e3202, 0xe7eefb43, 0xabf408d2,
-       0x6c703f17, 0xbbd9ca0a, 0xf0562d9e, 0xf8bfc5d5, 0xbb89e91d, 0xa2773ec4,
-       0x037a8f9d, 0x7ca167e0, 0x45cb8732, 0x42e3c49f, 0x687c0a4f, 0xd7d5adfb,
-       0xf1e2603e, 0x28e79079, 0xfcb76a40, 0xb5adfa9e, 0x67289d87, 0x8d345f6b,
-       0x94fc7942, 0x2d92ff98, 0x0bbfc703, 0x94c4b3f4, 0x5a5ea0a8, 0x46699813,
-       0x818b4d78, 0x52f79ee0, 0x3f1e90b3, 0x81c9786e, 0x5c41f274, 0x4ff50f28,
-       0xf538fad7, 0xe1402e20, 0x1b8fb971, 0xfc620ef2, 0xb612a966, 0xe97ea01b,
-       0x94649cc6, 0x212befd3, 0xdfbfd633, 0xec2236ea, 0x08f19451, 0x04e1e47b,
-       0xab220c7f, 0xca0fd055, 0xbe06b599, 0x399e6b9f, 0xf186ce66, 0xfdc3937e,
-       0xfe7e4f9b, 0xf38c7cbb, 0xf38566d4, 0x7ec07f51, 0x3c400fe7, 0xfd206d3f,
-       0xc919f6bb, 0x67ac3713, 0x7ee2d7bf, 0x16ad7f03, 0x85f6bcfb, 0xba45ee97,
-       0x5dfb8b5f, 0x805e9bd2, 0xf3d38f6e, 0x614c0ee7, 0x48e3fdfc, 0x02be9a17,
-       0x8c94c1b8, 0x9f0e3a71, 0x02fce1ce, 0xf3f82bcf, 0x4bc91140, 0x67682390,
-       0x5f7bd346, 0xd8b1fbfb, 0x2c5b25bf, 0x163f5724, 0xc0f9dbfb, 0xbfdc0e8b,
-       0xec7e7e4f, 0xd4a39e04, 0xd8da073e, 0x05ee8315, 0xfae1d63e, 0xb27f341d,
-       0x7ae1d623, 0xefeb3d1d, 0x6fc173a6, 0x9f5f18eb, 0xb275deb6, 0x2f56bf58,
-       0xd62cbfde, 0x7c0986b9, 0xf38830bd, 0xe427e097, 0xb4c7b457, 0xf992f9f5,
-       0x267d1afb, 0xffb972e7, 0x99ff2137, 0xfc40ead2, 0x9ca2fee0, 0x98f1fa01,
-       0x01b90947, 0x16793e4d, 0x5fb11fe6, 0x73b3fcda, 0xae403cf9, 0x7b929279,
-       0xc8d3b1f6, 0xb73ac656, 0x78e5c84c, 0x9698db3c, 0xfbf806d5, 0x892bfc18,
-       0x23957a71, 0x46e8d3c6, 0x67fcaf1b, 0xdd70d355, 0xfb087fd0, 0x3f7dc6d7,
-       0x3f632090, 0x1fce33ef, 0xbe35fcda, 0x345faf2c, 0xed81d8ad, 0x14e7b13e,
-       0xdd39bae1, 0x542ae766, 0x802ed07a, 0x066d3df7, 0x159f4f8a, 0xc6d9fcfe,
-       0x8a4b1c97, 0x25dde87a, 0xd93f8de6, 0x1a9e7bd9, 0x33d045fd, 0xfb7cb3cd,
-       0x6b0869fc, 0x4ba68df3, 0x7d1a6f0d, 0x64a9cdb2, 0xe9d344af, 0x66b3ccba,
-       0xb9fa2f1c, 0x807cb766, 0xffe415f1, 0xf2e3c654, 0x6e78ec0d, 0x9f863e84,
-       0xd1ea8d8d, 0xd79c9a0f, 0x14baf3f4, 0x2fc225cf, 0x43703a0b, 0x5366e736,
-       0xc72977bf, 0xfde039b7, 0x74c3e731, 0x87d9abfe, 0x92117f37, 0xf48e3112,
-       0x5224bb82, 0x7cb9adcf, 0x96b6e89c, 0xbfa1b785, 0xdf81f8b3, 0xf48d1ccd,
-       0xce8994f9, 0x4e37165b, 0xbddda336, 0xa39df0ea, 0x35cfdf70, 0xa9763d71,
-       0x6893e461, 0x7a6b9f37, 0x116779d8, 0x653e57be, 0xbc5f3c2c, 0xf5f698ab,
-       0x4cf0b883, 0x91eebb84, 0x6f7841d8, 0x9b91e1dc, 0xce3c0217, 0xae12537e,
-       0x5243fdef, 0x3a08d8c5, 0xcd94ca58, 0x934ed10b, 0x8be41513, 0xab3c85f7,
-       0x5a7df137, 0x517fe82e, 0x45f3e72e, 0xebcb7f62, 0x7cf1f3eb, 0xc800ebbc,
-       0x8d63c051, 0xc21ad5d9, 0x234d5f71, 0xd81d7fbb, 0x74c9e908, 0xd2764d4e,
-       0x66b3334a, 0x6b73d094, 0x693f3c06, 0xeb83df0a, 0xbd8f7939, 0x58e20b78,
-       0x096a3eba, 0x5f896fb7, 0xf1a5aec0, 0x3168edbb, 0x2e82658f, 0xded3fba3,
-       0x1ebb40ef, 0xff989ee5, 0xe6a786a5, 0x74babea1, 0xd7192f24, 0x71abe1ff,
-       0x7cdf684d, 0x4c72e268, 0xaeec1feb, 0x11f691f3, 0x183a5bd8, 0x0c1d2aec,
-       0x6f5e75f4, 0xbc256d8f, 0xb7ab9bdc, 0xad3a34ab, 0x18979f59, 0xcbd01799,
-       0x0a43fefe, 0x9cf7ff9d, 0x644e8cbf, 0x7742e431, 0x880fd5dc, 0x3c6c67ca,
-       0xcf18fada, 0xf9f2f84d, 0x2ddfda30, 0xeb02c516, 0x8e748f3c, 0x4a2f4be7,
-       0x72b7eedc, 0xe2ff3fba, 0x77fa2088, 0xe1c0ffcb, 0x2086ade5, 0xdf1edd1e,
-       0xf6c25db5, 0x4beec0cb, 0xb3d84433, 0x03cd77bb, 0x545767f2, 0x680cb6df,
-       0xcf08e57f, 0x5b6a8077, 0x227b1d94, 0x1db7d5c3, 0x5fb6cffb, 0x61c0b8b5,
-       0x532adf0d, 0x9e1adf11, 0x75e67f35, 0x92b287a0, 0xea7dbc1e, 0xebf6495f,
-       0xca8fbf65, 0x1f670ccf, 0x6c74871c, 0x5f91544f, 0xb0f6dd7e, 0xfbf70034,
-       0xe8ebe285, 0x25b58e97, 0x9fb7c82a, 0xb9d137fa, 0x1d7f65e6, 0x6b7eda95,
-       0x5f9bb171, 0x3ef7a768, 0xcaf11b6d, 0x35ef7838, 0xd790a25b, 0x35f731c9,
-       0xeee3bf3a, 0xf0d3a3f5, 0x8faeb6b9, 0xabfbe3ee, 0x23a3fbcd, 0x5d703a77,
-       0x7bf58fed, 0x6bee0c65, 0xf682a242, 0xdf910ad9, 0x971f6171, 0x89ad170f,
-       0xfd80ce4f, 0x8e7fb8bd, 0x5c9c8193, 0x1e773ed6, 0xaafe5f3e, 0x5cfb4141,
-       0x81cab57d, 0xcb3f8df1, 0x4b050e9d, 0xf3842f78, 0xca128391, 0x6c95b1a3,
-       0x1b1fb60e, 0xfa0b9992, 0xd3833319, 0x72cb98c9, 0x3e780f10, 0xb714e786,
-       0x714f1eb8, 0xc3f5f80b, 0xbf658dfc, 0x0d0ef1e2, 0x35df9aef, 0x04dbac4e,
-       0x2e7447ec, 0xf197979e, 0x7fee1fe7, 0x77f6167e, 0xc14990e9, 0xc87a7f79,
-       0x06affd44, 0xe308c97f, 0xfdc23c5d, 0xdce38410, 0xdfdcc7c8, 0xfdcadd58,
-       0x26f5da8d, 0x37b1398f, 0xb447963d, 0x9e0ebf43, 0x55dc70b9, 0x3a34de82,
-       0xebe1ed5d, 0x0d7a0d5b, 0xb74d1bd7, 0x1b75ac49, 0xe8ebe9e2, 0xedd29bf7,
-       0x135e90df, 0xe87cb758, 0xe8bed7a6, 0xf913e044, 0xa355e91d, 0xf8fbd587,
-       0x6b727a39, 0x3ba444f1, 0x79343e8d, 0x0ac49812, 0x9bd66f50, 0xdde60159,
-       0x2af18c04, 0x9b2a81ca, 0x7f7284cb, 0x05674a4e, 0x1e4965a2, 0xb952a797,
-       0xfd4463d1, 0x79216f53, 0x526f2d11, 0xdffcb8f2, 0xed074483, 0x2a14f28b,
-       0xfc8eac4d, 0x8584ad07, 0x5cfd440c, 0x9ffc9095, 0x5372682e, 0x65b383de,
-       0xb8d57f98, 0x54727be4, 0xede506c6, 0xe488f0e6, 0x97a82691, 0x5d9a1feb,
-       0x9e457001, 0x445e6067, 0xa70e97bf, 0xc0f5c40d, 0x8c1e5773, 0x97c53dbb,
-       0xb33ae583, 0x67f7e48d, 0x9b61ae86, 0xcfed3ddc, 0xff7f6abc, 0xb81eaed7,
-       0xd4b2c4d3, 0xcd198422, 0xcaef2b5b, 0xe3e60cf3, 0x612f9fe8, 0xe2f291ac,
-       0x5dfbff02, 0xe7e043b4, 0xdefec2b5, 0x8969e82a, 0xfdc216d5, 0xcba64d64,
-       0xa80576dd, 0xca26a67e, 0x04b30748, 0x872adc1d, 0x42fdf1da, 0xb05ca0d6,
-       0xffb3e992, 0x3a377eab, 0x05d995a7, 0x87a03fad, 0x3eb04ccf, 0x900367a0,
-       0x196026d7, 0x06b12003, 0x95e197e4, 0xd85ffdff, 0x75807d6f, 0x6b9e11c6,
-       0x067b9414, 0x057e33e6, 0x63826d65, 0x3c33c618, 0x3643d92f, 0x3f0dc7d8,
-       0x5fba204f, 0x5217ec25, 0xa65f98c6, 0x74b0f5f0, 0x8f7fde7e, 0xfd0fb7a0,
-       0x5817372c, 0xf47613fb, 0xb1e61953, 0x1b37ce2a, 0x78c6bdf1, 0x0b836b2a,
-       0x81deb4f9, 0xbf27c576, 0x09145490, 0xc8dd846b, 0x7e0aa50e, 0xa0134297,
-       0x785dc3be, 0x8d4bf510, 0x6ecb97a0, 0x606f7e46, 0xfaf2858b, 0x5963f5d8,
-       0x995c03f7, 0xfe8a8b7d, 0xb767e5e4, 0x7d832ee7, 0x0ed8c0b2, 0xe854e758,
-       0x6aa60cb3, 0x73a25802, 0x03f520de, 0x3c0701f5, 0x387ee6df, 0xf319d38b,
-       0xfdb47ae2, 0x6bdef0d1, 0xb468603f, 0x66568d2f, 0x90b1ff42, 0xff9057ed,
-       0x8c997db4, 0xfff03dce, 0x9c791786, 0x75818363, 0xf9af18c3, 0x8d780ad0,
-       0x4f6a5f21, 0x267641be, 0x27405bb0, 0x19dff657, 0x1d95ff5b, 0xffd76330,
-       0x98d83d6c, 0x315ff427, 0x037b262b, 0xadfd0697, 0x4b266d10, 0xd7192e35,
-       0x91556a93, 0x9e3c361e, 0x1d867a43, 0xa0f44dd9, 0xfbfb63b5, 0x736c9d11,
-       0x55ff844b, 0xcc4cb06d, 0x4feb69d3, 0xda338b79, 0x5c74a992, 0x97e7a74b,
-       0x94ab7c9e, 0x3fbe1bcb, 0x369a7f33, 0x7e83f289, 0x6d4a883a, 0xbd041b1e,
-       0xe2be7869, 0xc93e7815, 0xbb06d5f5, 0x397dfc99, 0x79489850, 0x0b121d8c,
-       0xe4f73c02, 0x57e2131c, 0x6d74e78a, 0x57323749, 0xc459bc0c, 0xe2b9c47e,
-       0xded22b99, 0x68c2780f, 0xf517cfd7, 0x51c90509, 0xe6df7cf5, 0xb7cfe589,
-       0xf3819cad, 0x75fdabb6, 0x4c776ce3, 0x92ba20e9, 0x5f38cb2e, 0xeb0304cb,
-       0x352be787, 0x3b987dfa, 0xc69b0f57, 0xd5f24e7f, 0xbf7a3e34, 0x4dfd0999,
-       0xfcff478b, 0x17a13cb5, 0xe461590a, 0x9fc2f63e, 0x0d7c4acd, 0x78ef79da,
-       0x9875e780, 0xedc5d058, 0xafc7b435, 0xb7442c78, 0xde04e3db, 0x21e9a50c,
-       0xa6589f68, 0x47925fc7, 0x957eaf8f, 0x7aa4fc7a, 0xab4878f5, 0x67d5d6ce,
-       0xeaeb06f8, 0xd12cac07, 0xc6eb03c1, 0xb4dfdaea, 0x760e9269, 0xdae9a607,
-       0xd6cd34e7, 0x0b2d79c1, 0xed07ed75, 0x2faba25b, 0xd5d6ae0c, 0x41b2390f,
-       0xfd6d0f07, 0xe1fb5d17, 0xf5755b6d, 0xba1da1c5, 0x0f1d11fa, 0xe191e0e9,
-       0x47ed7547, 0x57507bbf, 0x69f3a63f, 0x8bb8fd5d, 0x9be0e9cf, 0xb5d65ebb,
-       0xa8ed709f, 0xdec89e0e, 0xb72fb5d2, 0x4f074efe, 0xd743fe56, 0x0ff496fe,
-       0x5d53f574, 0xa7eaeb1f, 0xc1d55c17, 0x097d9877, 0xea97c8f9, 0xcdef74df,
-       0x8e1fae62, 0x9f9e3a07, 0x00435462, 0xfc85f3db, 0x8c977410, 0xdaed13fa,
-       0x7485965c, 0x1f1a593a, 0x336bba22, 0x4457e8a8, 0x63f927eb, 0x65e307af,
-       0x8a8325ec, 0xb044ac71, 0xf188e4eb, 0x70563c92, 0x7ee07b00, 0x4e0e8a95,
-       0xdaeba6f5, 0x74bb55a7, 0x02be19f5, 0x9580fd5d, 0x581e0eaa, 0x7f6ba657,
-       0x0e8f26d3, 0x752a0776, 0xbc9a73ed, 0xa5af383a, 0xd07ed75a, 0xbeae9f3e,
-       0x5752b830, 0x9d48e43f, 0xbada1e0e, 0x787ed749, 0x5f57405b, 0xd5d26a1c,
-       0xd168e88f, 0xfbc323c1, 0xbf47ed74, 0x8fd5d41b, 0xaba23ce9, 0x55b1771f,
-       0xd5dcdf07, 0xe13f6ba6, 0x4f07485a, 0xed752764, 0x7467adcb, 0x3de564f0,
-       0xd25bfb5d, 0xa7eaeacf, 0xeae92eba, 0x7a647b35, 0xe7fae7c1, 0xa9993ec2,
-       0xfdee97fe, 0x430f24c0, 0x673c08fa, 0xa05deb50, 0xb9b3f2ff, 0x2d13073e,
-       0xc67b424e, 0xc945f94b, 0x7207a098, 0x2060312b, 0x5b9542ba, 0x149ef143,
-       0x52a453d2, 0x0347985c, 0xde81de7a, 0xf68ddb93, 0x9d8f426d, 0x88d5f995,
-       0x7d676e6f, 0x30387d1f, 0x944db65d, 0x0de563aa, 0xc79f3f7e, 0xfbe50e39,
-       0xa2a7e436, 0x14ecf11f, 0xb157b3b4, 0xe79c36c0, 0xb128a964, 0x71a8e313,
-       0x568538fa, 0x645eb54e, 0x77dd8472, 0xb325ae32, 0xfcfe06e4, 0x2665eb54,
-       0x57e8888f, 0xb00c2fc4, 0xfd110dfe, 0x807e083f, 0x8b7f3e0c, 0x6c0af81f,
-       0x0afc87a4, 0xe9fdbbc1, 0xbbf1ef04, 0x2fe7dca8, 0xbf51f2a0, 0xfdfbf54a,
-       0xe13f0465, 0xf41c10f7, 0xd0795257, 0x87e7a5ef, 0x3f04d5fc, 0x96317e09,
-       0xc64fc047, 0x77f069f2, 0xf019feb1, 0x85fe117f, 0xab65403f, 0x3f9e89bf,
-       0xf8216fe7, 0x823eff05, 0x520fe97f, 0x423fe6d9, 0x56fecbe5, 0xdfc57faa,
-       0xfe6bf046, 0x7f21c110, 0xfd47c107, 0xfb8f8261, 0x84f825df, 0x0eca93bf,
-       0xdf2a45ff, 0xfd5177f4, 0x8235ff29, 0x6f53f67b, 0xf3e346ff, 0x65571123,
-       0x215c4ec2, 0x70a587e8, 0x273970fb, 0xd042b605, 0xa81269ad, 0xfa3fb457,
-       0x3cc41fe7, 0x574891d6, 0xa7574405, 0x1efd8dbe, 0x25697fed, 0x9bf719d0,
-       0x3c781bd7, 0x22efd346, 0xefd3405f, 0x7f70f735, 0xbbd81175, 0x43ffff18,
-       0xaf3fb71c, 0xd00a99d4, 0xc431ab8e, 0x5d2f68ab, 0xd933fba9, 0xafcf0c47,
-       0x78ee4581, 0x476072c5, 0x0356df84, 0xfde11bef, 0x18b45999, 0x4c3ac356,
-       0x332a2e74, 0x357c048f, 0x37efa076, 0x0f561fa8, 0x7fc80634, 0xd1f305b6,
-       0xa07dbb6f, 0x7ef48c2f, 0x09d96ea5, 0xd2a28fc2, 0x4b4ce0b9, 0xc63e7528,
-       0x144a4e49, 0x1f0bebdf, 0x785e44eb, 0x5daff59f, 0xbc3b44ca, 0x0f92eff2,
-       0xc9b4e7f7, 0x83718d5e, 0x1fb9f20f, 0x51be41fa, 0xe81e5e57, 0xfcf3873b,
-       0x76eebd8b, 0x2ff0a023, 0xe4ff59df, 0xbf1eeedd, 0x3d7456f9, 0x62ae5ec1,
-       0x29e5132e, 0x6e1bcf32, 0xe636eae8, 0x0b3e7823, 0xa67b7950, 0xd75c63ef,
-       0xd8241602, 0x1592d637, 0xf3d15d6b, 0x03908bfa, 0xea37c97f, 0xbe59feca,
-       0xf2f3e4ff, 0x8f4ebcd0, 0xd71f25b9, 0x616bcda5, 0x3fe68b96, 0x813d758b,
-       0xabcbfbf3, 0xe4305f9f, 0xff8fa6f4, 0x61b0ba01, 0x31da0598, 0xc7a8df3c,
-       0xafa81cc4, 0xf940cfbf, 0xd45d1ad9, 0xdf104060, 0xbca06cdb, 0x013a1efd,
-       0x2bbf40fa, 0xf1ee8ba5, 0x0f249d01, 0x23193a42, 0x4f60cc05, 0xf306369e,
-       0xbc5e740d, 0x84718ccc, 0x1f402915, 0xc1d37dd9, 0x409f715a, 0x95f40e7b,
-       0xfa7dfd89, 0x8805d1ab, 0x8daf75af, 0xeabe2171, 0xe80fb08d, 0xa929be27,
-       0x8b851f3c, 0x50dc697e, 0x5932578a, 0x34ce3155, 0xde5b12d3, 0xe9c41f8e,
-       0xa9ba74e7, 0xe9fd4832, 0x074a55cf, 0x1d2b7df1, 0xc373f7c4, 0x48d70ffa,
-       0x47d3ef30, 0x947dd12f, 0xf4dff35e, 0xc46e6166, 0x9db5d7bc, 0x2189e29d,
-       0xfe8be7bf, 0xcc91ba34, 0x5b01df76, 0xe9babce4, 0xfbae1c78, 0xc740492f,
-       0x17c74439, 0x9670fcf0, 0x1f3895c5, 0x09404eca, 0x1fbee9da, 0x2dffe42b,
-       0x4b952a61, 0x15ca9799, 0xb748edb0, 0x332ec0de, 0x6b357be2, 0xcb6be7a5,
-       0x1d2274ee, 0xc8fa372f, 0x99835e2f, 0xcb9e78b7, 0x01d22aba, 0x6d35b76f,
-       0xd01d2379, 0xd765a737, 0xcecf8c64, 0x037e2e0e, 0x8643aacb, 0x0a87980b,
-       0xe70b317c, 0x6ba869d5, 0x2fe30fec, 0xe362667c, 0x4b3e7800, 0xdec1fbe2,
-       0xc9a1fbe2, 0x0375e88d, 0x941bcc1f, 0xd0f2eb8a, 0xa54724ba, 0xb66a0f8e,
-       0xa5218f32, 0x9bbe1f27, 0xfaeeca2f, 0x5f9400d3, 0x07c51772, 0x4966bdd6,
-       0xcd5e7dc6, 0xf0603db8, 0xcd0ff168, 0xe744600e, 0x1578b177, 0xe8247ddb,
-       0x8c81a3fa, 0x0323fae8, 0x3d258438, 0xf2cb29f6, 0xf4e497a5, 0xc675ebe8,
-       0x9e218667, 0xe2d79f40, 0xd07f577c, 0x8dd8adba, 0x85983f72, 0x69e989f6,
-       0xd6ef5a8b, 0x55f615e9, 0xeb5c4f42, 0x3b8f1341, 0x50cbcf45, 0xd0bfe276,
-       0x5998b11e, 0x8039cf00, 0xe428d9af, 0xe266fee7, 0x2d447aab, 0x7926c7c6,
-       0x557cfc5d, 0x3169ffdf, 0xb92f8edf, 0xf5801c3f, 0xf7a49c60, 0x594f5c38,
-       0x21c67be2, 0x3464e1b9, 0x9c41cece, 0x98f1b57f, 0xed1333ad, 0x7de3fbf7,
-       0xd5fdc03f, 0x3f9a3de2, 0x30fee1d9, 0x8d99ee97, 0xf74354bd, 0xe858c637,
-       0x22addf7e, 0x196b760e, 0xaadd838f, 0x47c6bdc5, 0xe2a2bdc5, 0xec7c6c2f,
-       0x97269838, 0xefc95319, 0xd07f642d, 0x17f14fd6, 0xd2f60e4d, 0x3090b0ab,
-       0x145da5c5, 0xcb8ee8af, 0x1e799b14, 0xad306b8d, 0xe4e42cc7, 0x4f972f4e,
-       0xd569fbda, 0xfce8c2e0, 0xd5cb2b08, 0x0e8a11f9, 0xae97581e, 0x26d37f6b,
-       0x1ddeae97, 0xe7d5d028, 0x383aa934, 0xd74ca5af, 0x8f3ed07e, 0x560c2e0e,
-       0x390fdaea, 0x43c1d5e2, 0xed75ab5b, 0x74f9b787, 0x95a1c5f5, 0x1d11faba,
-       0x64783a75, 0xfdae9378, 0xba0377e8, 0x4d9d31fa, 0x1771faba, 0xcdf0745b,
-       0xed74fb5d, 0xea0b5c27, 0xa7b227ea, 0xd6e5f574, 0x64f07567, 0xf6ba57e5,
-       0x74fd0b8f, 0xeebb7a4b, 0x49d754f9, 0x0bd37bdd, 0xc7e0e8ce, 0x0f919f71,
-       0x0f899816, 0xe9efaa66, 0x10f267de, 0xe39b938a, 0x1dfdb3f8, 0x3ca3146f,
-       0x170c6fdc, 0x6e3e9f23, 0xf96374ec, 0xb5b5c184, 0xce49d01f, 0xd61489f8,
-       0xbc58abce, 0x3341cb15, 0x5d5318b6, 0x0f731fb0, 0x393d456c, 0xe8dda6a4,
-       0xd2e87804, 0x889d5bb3, 0x290635f7, 0xd1bdf10d, 0x88e58f5d, 0x74a513cd,
-       0xb0d91fa8, 0xe8e51eb8, 0x8b33e6e8, 0x007496d1, 0xfe3187cf, 0x3e887b25,
-       0x69186637, 0xc6471bde, 0xcedcde53, 0x9d1936b1, 0x9c3b9d96, 0xdc0f180d,
-       0x09a4a3b9, 0xbf606dcb, 0x358ccd07, 0xe58efd81, 0x83dfb00e, 0x3c6c8be0,
-       0xe424e7f3, 0x53a6e547, 0xbf2e78e9, 0xaa47d27d, 0x4a15c551, 0xbf438f73,
-       0x22f1a9cd, 0x3b9a515f, 0x4efb7411, 0xdf8049e4, 0x1730923f, 0xe1a370f3,
-       0xad788717, 0x72f7c805, 0xbaed1b8b, 0xac06fd5e, 0xfe017efa, 0x927afd66,
-       0x1e785fb1, 0xad216f33, 0xf7e1eb80, 0xde5a8c0b, 0x715be53a, 0xb04a1c53,
-       0x9e41123f, 0xf0e98f35, 0xcabc00ad, 0xee819d4a, 0x26fb8b09, 0xf8a6aa18,
-       0x26aff5ee, 0x2e9c03c4, 0xe451dbde, 0xfe802bcb, 0x9ca0606c, 0xf497a08b,
-       0xd04700a5, 0xefc05ec7, 0xf99edcb9, 0x0630ee98, 0xa60b9064, 0x1555789f,
-       0x516c79c6, 0x7b97393c, 0x223b7acd, 0xdc8de44f, 0xf7146057, 0x68a8e65f,
-       0xc057dcff, 0xfe23dcf5, 0xe7cff38b, 0xf35dff62, 0x329e03cf, 0x0f988696,
-       0xf54d99e4, 0x611a98aa, 0xb17567aa, 0xf19bc8fc, 0x6fbc0612, 0xee92763a,
-       0x702aafaf, 0xd4325e11, 0xff775a16, 0x646fd0a5, 0x33ae4d9c, 0xda403e60,
-       0xce033ae6, 0xaaf14d2f, 0xacc78e78, 0xbcfddd4e, 0x997f4db4, 0xa7e41e7f,
-       0xb155efc9, 0x46ba699d, 0x222b218f, 0x925aaafb, 0x47cc62c8, 0xfc9d6d2b,
-       0x7aafa8fc, 0x759bc947, 0x625a3794, 0xd111e173, 0xeab6c5e3, 0x7bf63103,
-       0x66efd895, 0x9b7c7e87, 0xe4203e76, 0x718555f4, 0xf7f8213d, 0x6b0e24ee,
-       0x5c5ddcfd, 0xf9c37692, 0xce7463ee, 0x30cdc1a9, 0xf9a9e20e, 0xd715bb7a,
-       0x0b798cdf, 0xe9182fa4, 0x547e2789, 0xa1876070, 0xa2f63ef7, 0xc4fca047,
-       0xce8fa412, 0x83f03d60, 0xa2acd8bd, 0xdefb645d, 0xdeea0372, 0x89475674,
-       0x1591b637, 0x1bb0f21d, 0x4f5aafcc, 0x3d3e6987, 0x97d9329d, 0x62faf941,
-       0x1c3d351f, 0xafa66fbd, 0xc872d272, 0xd979e2ee, 0x67fe4e1b, 0xef022f9c,
-       0x557c123f, 0xe4245ac6, 0x95acb193, 0x4c2cf1ca, 0x175877e5, 0xc8a61e95,
-       0x2a624e58, 0x4bcc1595, 0x475614e5, 0xa16b2565, 0xa56b1a72, 0x530b0672,
-       0x950afe09, 0x5f90a65e, 0x36f41b35, 0x97997396, 0x8eac79ca, 0x1d229fca,
-       0x59ab3e03, 0x590bc10b, 0xc06d952b, 0xfaa5787f, 0x586f9065, 0x0df202be,
-       0xe9fcd7cb, 0x2efc8654, 0xbf47cae6, 0xe3ca80bf, 0x13ca957e, 0x3b2a32fe,
-       0xf76a1efc, 0xca92bfa6, 0x952f7e53, 0x54d5fda7, 0x6a3efd86, 0x257fb6f7,
-       0xebf8ef95, 0xff37fca8, 0xf5df2a26, 0x77fca807, 0x7995137f, 0x39764666,
-       0xcf15082b, 0x7e67fc06, 0x60b8f660, 0x3c0aaf1f, 0x5318f31e, 0xff70530b,
-       0x4df18664, 0x2231c55b, 0x48cb9b0a, 0x5c9addf7, 0x289dd947, 0x3b734f07,
-       0x27669ecd, 0x72d6d03b, 0x613e619c, 0x4a53a19b, 0x793cbd80, 0xd6b98ee4,
-       0xaf93d042, 0x150486b0, 0xadbba5e1, 0x309e07a0, 0x027eeb85, 0x960bc7f5,
-       0xce82b5cc, 0xfb7f6b1a, 0x4c39a7e3, 0xb38e63f5, 0xdfe0057a, 0x1bb1591e,
-       0x3ce130af, 0x57bede50, 0xe62e7ab0, 0xf2155feb, 0x00c37c02, 0xb7ad2de5,
-       0xb16f3105, 0x3168e5b8, 0x7531b62a, 0x37d412b6, 0x1e28ed11, 0xe8bb57d0,
-       0xc7bded7a, 0xe2129d6a, 0x64cff9a1, 0x9cccb37e, 0x9dc63150, 0x7e35fb22,
-       0x7499f1b3, 0xdb23f183, 0xdfd06e19, 0x9fcf228e, 0xfffccf50, 0xfa68f3a6,
-       0xec757d36, 0x062efa59, 0x7e438aeb, 0xe5c4983e, 0xa5d8174d, 0x0b34dfe8,
-       0x364b79b8, 0xb507a9d9, 0xcbefb37c, 0x5e307f54, 0xf081d2bd, 0x378a5c96,
-       0xe2792734, 0x637db10b, 0xcc9dc936, 0x63794604, 0x8a13d53b, 0xe3ef822b,
-       0xb2fcb90b, 0x7285fcdd, 0xefe5ca27, 0xae8f0ccb, 0x3bfefa6f, 0xde00b71d,
-       0x05468d5c, 0xe6f12df7, 0x7e512a77, 0xa3cb3704, 0x18e32124, 0x12792fd5,
-       0xaa9da6fd, 0xf61f3e39, 0x0ea200f5, 0x1b26aced, 0xfd9959d9, 0xc377c542,
-       0xcf328d78, 0x6f968aff, 0x9cb90bb3, 0xc34bda37, 0xc0b76e74, 0x4478c2ea,
-       0xd9b0f25f, 0xf3c2caef, 0x6fbc6764, 0x287e0331, 0x4a676a7c, 0xa7732823,
-       0xa313db83, 0xf6483a9f, 0x27c8b344, 0xd2314c6d, 0x256c49f7, 0x445203ce,
-       0xc87336bf, 0x36f8e785, 0xb163e0a3, 0x3207e69e, 0xf7b75f29, 0xefba5d3c,
-       0x9855d915, 0x6e1c8447, 0xee817116, 0x3ff446f1, 0xcdc44520, 0x4a90966c,
-       0x4bfa69e3, 0x3fc76f1b, 0x914ede36, 0x678da927, 0x9f5fa51f, 0xf5a61cdd,
-       0xa1fd85d9, 0xd713b78d, 0xe30f2317, 0xf5c3c76b, 0x5a378e45, 0x25bb3ebf,
-       0x4bb3eb4c, 0x1ee95edc, 0xf1ec476f, 0x4f671afa, 0x569cfe54, 0x72e42fce,
-       0x7632cc15, 0xd33ff60e, 0x09f9e9c2, 0xd9c5d313, 0x7e7a0937, 0xa69788b2,
-       0x992e5c09, 0xcfba669c, 0x7179d133, 0x6db5d217, 0x9dce91b7, 0xc827296c,
-       0x4ed3927e, 0x40fc8931, 0x9fcf8ad6, 0x02f7f030, 0x7998e6a9, 0xe1fc7b2b,
-       0x7111b9f9, 0xceb534e3, 0x134ff980, 0xe30c1d9d, 0x3314b6ec, 0x6296dfad,
-       0xfca1c60d, 0xcd809955, 0xdb8004c1, 0x0b1b7c8b, 0x954e3d61, 0xc5338bf3,
-       0x92f3007c, 0xdfa1aad2, 0x84ff7d08, 0x772663a0, 0xee22abba, 0xc45b3cd7,
-       0xaf8d49ed, 0x7237e7a3, 0x41ff5f30, 0x4f31e7f0, 0x8f0c6ba7, 0xdc3e9c93,
-       0x5987fc9f, 0xd07bc60f, 0xc0fd3e8f, 0x77820ae0, 0xf5f3a58c, 0x4ec787d3,
-       0xd6627f41, 0x8246698e, 0xe303ac0d, 0x2c76b31f, 0xccf3e234, 0xdffb461c,
-       0xf24cd675, 0xd58ed675, 0x4cbffda2, 0xc665f6c1, 0x6e30cfc0, 0x91ef7650,
-       0x8c8b8c04, 0x00373fb5, 0xcec6d3cb, 0xa07df88d, 0x1bf6155b, 0x5bbcd734,
-       0xb228ed92, 0x36c81eab, 0x44f59fa1, 0x99bf3f21, 0x9e263cc3, 0xbf25e187,
-       0xf091fc7e, 0xfbb2bc31, 0x72aed69d, 0xb4f6c63c, 0x9cb1c729, 0xdaf15214,
-       0xf0e8ab32, 0x4a72c71e, 0xcd02aeb8, 0x5b77cad9, 0x3159638e, 0xe204f7dc,
-       0x46f7f0f7, 0xc614fc95, 0x6e6fbac9, 0xd93bda3c, 0x0f27435b, 0x44d65c50,
-       0x94f6c2f7, 0x18249b79, 0x6bcb8f6f, 0x27b43d45, 0xf248db25, 0x256ea935,
-       0x3c6073ad, 0x51ee75c3, 0x45c9717c, 0xbec97724, 0x11ec137f, 0xe7eeffdc,
-       0x33f9fcf1, 0x151afe82, 0xf88935af, 0x027ca140, 0x9acbb09b, 0x151d2799,
-       0x04f76ca1, 0xc7b72e31, 0xc078e5c3, 0x6c52fdc6, 0x58ec0dbe, 0xec6992ba,
-       0x95594fd9, 0x60c779f5, 0xb2bf60de, 0x10b28768, 0xa6bc5fed, 0x0fe8308a,
-       0xc61d5dfe, 0xe6dda1f5, 0x36be38a4, 0xfa14b97f, 0x9c33a08b, 0xcf5b6cff,
-       0x67b8da7b, 0x237e7ac4, 0x1f1ef4e4, 0xef9b4fef, 0x463728db, 0x465dbcd2,
-       0xe6248f9c, 0x4630eb03, 0x1da227cc, 0xde7bafad, 0xf7e74d4c, 0xdf8c3d4d,
-       0x392e6543, 0x8b0efd62, 0x1e912ad7, 0xbf482a34, 0xf948d576, 0x2fdb76fc,
-       0x7a3f0f29, 0x790a171d, 0x7287eabc, 0x365fa188, 0xe430f54d, 0x1e2a1fcb,
-       0x0164abb2, 0x0edc29cb, 0x624fc793, 0xcaf588a6, 0xdda89329, 0xf18f6834,
-       0x096569c5, 0x74ebd22a, 0x70a0dad6, 0x2e78e03f, 0x318f2fcc, 0x2cb75e5d,
-       0x9faac7e0, 0xf0bb72ab, 0x7b4b592a, 0xf745da01, 0x9dbca72c, 0x3ad30d86,
-       0x05e9be70, 0xa193dbeb, 0xdf39fbde, 0xe3cc5677, 0xcb760372, 0x8cdfbcba,
-       0x9e470095, 0x30f4fb5f, 0xbdae83d0, 0x43365746, 0x847682a5, 0xaefae131,
-       0xecbf983c, 0x2c1bfae0, 0x4637365c, 0x5d17ba3c, 0xfb6bfc09, 0x4b9c1f63,
-       0x1c6d94f8, 0xb54bacef, 0x89f7c6de, 0x84fe8de8, 0x6d81eaf1, 0xbebd1f31,
-       0x7de20a42, 0x7b777b4a, 0x1afb8a96, 0x96d94fbd, 0xb8795dae, 0xca4675fe,
-       0x2bc68f0f, 0xb9b711d8, 0xa4d6ce91, 0xa73c3d50, 0xe8cc6f7c, 0x8a47eee9,
-       0xe3f7eb05, 0xca3fdaeb, 0xbe78bb82, 0x7a79fea9, 0x059bc94a, 0x500714a5,
-       0xebeb36f9, 0xf7ea36f3, 0x283a6315, 0x1654d3c7, 0xfdbfb90c, 0x394b4e7e,
-       0xbd6cc158, 0xbba355f7, 0xe5b17ecc, 0xce421bfc, 0xd3282667, 0xa7ce500a,
-       0xf3fec91a, 0x23531aa6, 0x8329defd, 0xf09cfeb9, 0x37e48d92, 0xf74ac0fb,
-       0x3850d4d6, 0x49c4ed01, 0x3ec9185f, 0xd1d4e37f, 0x3941a787, 0x9b4b37f9,
-       0x0ce4ddb0, 0x86ed0e78, 0xc47d74be, 0x84b7649d, 0x5f5f910b, 0xed93a166,
-       0x4c3b1fa8, 0x2da7bdf4, 0x26536c9f, 0x4cabfee1, 0x6d29dcc5, 0xdc6215dc,
-       0x5e029b5f, 0x996ea792, 0x51e7e41d, 0xf6d2bfd7, 0x2865c789, 0xf036577f,
-       0xbad57bb5, 0x9997d23a, 0xf142cc45, 0xd22af0ee, 0x19e31bc7, 0xa56ccbf2,
-       0xcf08bbf5, 0x4664ecbe, 0xeab66fe8, 0xf3c62d32, 0xce676119, 0x44d35451,
-       0x3f95552c, 0x73e7f2b7, 0x9f3d0f15, 0x73f87aab, 0x6feff71b, 0x3f610253,
-       0x2d9b77f4, 0xddfd85d9, 0xfd797aa6, 0x9fd50b35, 0x172fff02, 0x171ac158,
-       0xb7ae5050, 0xf3f2345c, 0xd13c5f2f, 0xa4ada37b, 0x2bf385c3, 0x36fdd235,
-       0x3ee893b0, 0x4bc54ef2, 0x32f791f7, 0xf822065f, 0x64d9d2e5, 0x629cbf47,
-       0x2f4b7ba4, 0xbf0c8c7b, 0x91a81403, 0x41423df9, 0x67572f47, 0x3654f9d2,
-       0xebf71322, 0x43b256bb, 0x0fa0f11a, 0xe7f757db, 0xf6e642fa, 0x2951bec3,
-       0x6161ded4, 0x074895c9, 0x3bca6587, 0x1e78e1ff, 0x650f943f, 0x735ed107,
-       0x5df9e8d6, 0xe9c49d2e, 0xf20a6541, 0x25550cc1, 0xcddfafba, 0xf88ba354,
-       0x7d87de9e, 0x2cee75a5, 0x1fa2bb7d, 0x55546bc2, 0x93a18ce2, 0x6fa5f517,
-       0x8cf83c73, 0xb3be4794, 0x9befbc54, 0xd7c70874, 0xe0b07cf8, 0xf4ae4d4f,
-       0xf52a4396, 0xa49a4f63, 0x306800ee, 0xbffc800c, 0x51cf0ccf, 0x74cb242e,
-       0xa9706adf, 0xf586521c, 0xe8867df0, 0x4fe0b077, 0xcf9e88f9, 0xe1e90ef2,
-       0xeeff0447, 0x1fb92163, 0xe8c2dbf6, 0x8b406a5c, 0x3e781dbe, 0xd1639406,
-       0x22abfc7c, 0xd48f1683, 0x9e17a1e1, 0xd9d7b17d, 0x5c40aeb3, 0xc8cbad3e,
-       0x5de425d7, 0x3d2b6dae, 0xd56455cf, 0x2d62f385, 0x07fae36f, 0x40c1921c,
-       0x352afd85, 0x7801cece, 0x71264046, 0x49859337, 0xbadd7c5e, 0x2b5c451b,
-       0xebd19d7a, 0x44b065bb, 0xf1cccbeb, 0xca6ec979, 0x326ec990, 0x18c2006d,
-       0xbdb0d78e, 0xa3716e3b, 0xd4fb3b3d, 0xe6439060, 0x182b567b, 0xe4233e0f,
-       0x892be992, 0x56fdd7d3, 0xda5357a2, 0xfbc8828c, 0x4f86972a, 0xf318333a,
-       0x7ababfbd, 0x4f8f1072, 0xe5a3fe11, 0x7f455fdc, 0xf9f53a63, 0xc62ee386,
-       0xe9c7e547, 0x5c270df3, 0x1f951feb, 0x1f951397, 0x3f574437, 0x95111959,
-       0x2a2e371f, 0x075cae3f, 0xae982f4f, 0x9d533f6b, 0x2d6f83a3, 0x7daeaefb,
-       0x5d4ee795, 0xbbca9cfd, 0x79b7f574, 0xf3c1d6ef, 0xb5d7efab, 0xd7abe05f,
-       0xe5777fd5, 0x20f5740f, 0x8bc6622f, 0xf74a3c31, 0x613dd386, 0x3016a0fa,
-       0x3d8637bc, 0x57722920, 0xf471fea4, 0x1e4c5fe1, 0x71e3f7c2, 0x3b093fcd,
-       0xc4591c78, 0x838b595f, 0x7c5ab1e2, 0x9a763436, 0xb722fd15, 0xbd434d45,
-       0xf5cb7ece, 0x74380b06, 0xdf89cb71, 0x1b76a4ab, 0xfce9b292, 0xb3b051e3,
-       0xef30f97d, 0xe927cf20, 0x1c6b001f, 0x500ddbe3, 0xd7febb42, 0x2237cccc,
-       0x9e2c1e62, 0x3cb585c7, 0xe64f3107, 0x8bf3e049, 0x61f7cfe3, 0xfd1f313c,
-       0x0f952b38, 0x4173b53a, 0xf6bf6195, 0xf2807332, 0xed834b11, 0x036f9866,
-       0xc51447c8, 0xc74e5e12, 0xbd4db838, 0x7aaa3de1, 0xb3dd3a7f, 0x050d2db1,
-       0x3aa5d04c, 0x3d1fd1e4, 0x7cdbef02, 0xe314e28c, 0x11ffec87, 0x433ce1c6,
-       0xbb3f345c, 0xf7bcf1cc, 0x74b97ff6, 0x9265e518, 0x45f5ee93, 0xb1dda7d7,
-       0x6e37f3f9, 0xd177bf50, 0x765bdef7, 0xdf6ff7a3, 0xa231b674, 0xcbf9afbe,
-       0x13ccfeb6, 0x66590741, 0xad55fdfd, 0xfae10ef4, 0x3358dd7d, 0x49272fc5,
-       0x604399be, 0xfec6cfbc, 0xe1db7bf5, 0xbe2b4fbd, 0x3bfd1db8, 0xe7c5ee78,
-       0xfaf08ed0, 0x2c95e669, 0x04399e7c, 0xb3d47fec, 0xbe662c71, 0xadd05f9c,
-       0x45d3569c, 0x99aa79fe, 0x6b4e43e2, 0xb0f3fce7, 0xf1516def, 0xcbf46682,
-       0x447baf01, 0x8f8b447c, 0x59fa2ddf, 0xe9494a21, 0x660e73a4, 0x527dd00d,
-       0xc5ec5ecd, 0x86328e0f, 0x936ca37e, 0xc5ca442f, 0xc53354f6, 0x4cc52407,
-       0x3292e779, 0x2823be8a, 0xe78fa381, 0x985b7637, 0xd4f68cfc, 0x900f1451,
-       0xce286342, 0xa885b360, 0x2fb6bf3f, 0x77dfdeaa, 0xbcd3cf5a, 0x759feefa,
-       0xc7704f3f, 0x1e6a2718, 0x47d61e38, 0xccc0738f, 0xdcb9dfb8, 0xf1be331a,
-       0x0d8990e2, 0x5f915243, 0x82dd773b, 0xd8bbfafc, 0x312b5972, 0x81183e8f,
-       0x6486879f, 0xfe605d13, 0x5c62307c, 0x848f97cc, 0xdee80281, 0x6aa0c104,
-       0x71425a06, 0xa13c7083, 0x6acd9a07, 0xa087d93a, 0xf71f70fe, 0x0a7e7e09,
-       0x51fc8d68, 0x03ef87e1, 0x51f2c63e, 0xda7642bf, 0x843fe07e, 0xa8bbf09f,
-       0xa80bfa0c, 0xa957e83c, 0x8cbf90fe, 0x1efd27e0, 0x2bf88f82, 0xefda7ca9,
-       0xf8cfe7a5, 0x85fe09ab, 0xab6547df, 0x7f3d257f, 0xf0475fce, 0x044dfe0b,
-       0x42ed12ff, 0x9a27cf19, 0xdfd97ca8, 0xf8aff542, 0x9afc11f7, 0xc865483f,
-       0x1f9e847f, 0x7c12b7f5, 0xf046dfdc, 0xe0887f09, 0x95077f0e, 0xf4c3fa6f,
-       0x5dff94fc, 0x2758afde, 0xfc672278, 0x45b49780, 0x79da1746, 0xcc968b69,
-       0x6f7800ae, 0x6df74cb5, 0x4be40b9d, 0x1e2e8007, 0xf7f26555, 0x5234aef6,
-       0x2bb347dc, 0x486cd6f7, 0xb9faa72a, 0x1592df54, 0xbed9764f, 0x77ba66a5,
-       0xedc55b6d, 0x46ccb659, 0x32c56ded, 0x72ba3fd5, 0xcd8dd92e, 0xae300538,
-       0x07818c32, 0x25bb6326, 0xfbdf9246, 0xefbae2a2, 0x6f79fd89, 0x45efcc88,
-       0x2253891d, 0x5b6b21cf, 0xbaf07493, 0x7ce50cb6, 0x25dcdd04, 0x989b61c6,
-       0xc49df91c, 0x33bdf64f, 0x79d602af, 0x0f7be497, 0xfba7c8e5, 0x3403cdcf,
-       0xcbb5a331, 0xc8e4fc8c, 0xbea7ad89, 0x4b3fe4d4, 0xdbf8893f, 0xbf84caab,
-       0x69c6eabd, 0x2c5fe8b9, 0x137be992, 0xcfe48b69, 0xbfe99fd1, 0x997ba640,
-       0xc53255b6, 0xa322d903, 0x5a46c7c0, 0x7305ff77, 0xe9b95ea9, 0x9dd1c514,
-       0x27878eab, 0xf802dda3, 0x387da3ca, 0x4fdf8494, 0xd77110ca, 0x94f1297d,
-       0x9f3d1637, 0xf8bbff2f, 0x19f80cd9, 0x5f3f1315, 0xa3cfc2c6, 0x7f75fee2,
-       0x68857df1, 0x31df693c, 0xcf7c547d, 0xc791b03b, 0xa5dba3ef, 0xe62ab888,
-       0x4ff7d174, 0x1f92656a, 0x81f059fb, 0xc59d807c, 0x7de3dd32, 0xb3ead264,
-       0x733e6007, 0x114a7c8a, 0xc855039e, 0x26c65147, 0x6ffef257, 0x893f235a,
-       0xbaf40574, 0xb76849ea, 0x99fa617d, 0x05fb287c, 0x7f18ed5c, 0x9fde8fb5,
-       0x8df313e1, 0xc5b217a5, 0x447bf63c, 0x81e614fc, 0xaadb3b71, 0xf9c785dd,
-       0x504559b8, 0x657accef, 0x77fd5e2a, 0x9832edcd, 0x2c5feca0, 0x2cf1c7af,
-       0x893f4ddf, 0x3c06a5e3, 0x38c578da, 0x53c537de, 0x69157dd6, 0xf75deeb1,
-       0x4ebf0f25, 0x12288e0e, 0xb00674f7, 0x1f072801, 0x9c527531, 0xcb86703a,
-       0xd326a641, 0x71e8b87d, 0x98fbcafa, 0x6193f028, 0xd10de7e1, 0xf6eb4def,
-       0xee54025b, 0xa2aff4f7, 0xb2c9a83c, 0x233d0ef8, 0xc4c37b7f, 0x0dcb6578,
-       0x421e63ce, 0x36840bf9, 0x7e8988be, 0x7ef2a732, 0x9b9fbc8c, 0x27827ad9,
-       0x0dc094da, 0x8b7601ce, 0x5157507e, 0x95c2c45e, 0x3de11abb, 0xca265bfb,
-       0xbe4bb355, 0x7e77245d, 0xe47f912b, 0x3aacb634, 0x62dfd116, 0x1ced1eb1,
-       0x8a35f302, 0x88f39ee4, 0x91f01af4, 0xbdadf022, 0xd1c450b7, 0x6f7ebb1f,
-       0x1445e512, 0xfb438c6f, 0x12b32f6f, 0x214cd81d, 0x7f0238a5, 0x0eff0336,
-       0xebfcf44e, 0x1e5acc8b, 0x28e26d80, 0xfc64473c, 0x51ca30be, 0x3eabf798,
-       0xd1deff07, 0x0fa677a2, 0x17fc7807, 0x383f9d32, 0x7bf3c597, 0x52367fd0,
-       0x226bcf7e, 0xb59df85e, 0x2c3f7415, 0x4ff44b1d, 0x78054fd1, 0x86a666fc,
-       0x8d9f7df0, 0xaf9bc1fc, 0xed22e7c9, 0xec152412, 0x4645dc6f, 0x5d71e5f1,
-       0xd83eeeb2, 0xf6fa8b98, 0xfa12ffb0, 0xfa9de9b5, 0xfe426976, 0xe8da473b,
-       0x1f769d1e, 0xdee5f9cf, 0x13d272c2, 0x1fff24f1, 0xe7e26553, 0x076d4ac7,
-       0x2b76ddb0, 0xa27e84bb, 0x4155817d, 0x8ceed039, 0x1b6ab927, 0xf3f64f11,
-       0xd6a3ccf6, 0x659fc04e, 0xda0a3be4, 0xbe2d032b, 0x7ebb1803, 0xbcc668b4,
-       0xc72431f4, 0x5c03be7b, 0x2f077a06, 0x733c1037, 0xbda6920f, 0xe9df48d8,
-       0x63345fda, 0xb68c804f, 0x5b979a16, 0x7cf30652, 0x35786ec0, 0x9c760dda,
-       0x63b418fb, 0xd0e01ea0, 0x9401df70, 0x7529e947, 0xcd5748ed, 0x292ba3b6,
-       0x429a5d0e, 0xabe4d572, 0x689ca10b, 0x91ac4b56, 0xc9f1adfc, 0x1afbe5b7,
-       0x3afef711, 0x7ebafffe, 0x4df3e2fb, 0xfaef9c85, 0x7e68038a, 0x9a7f747e,
-       0x60c6ff5f, 0x90a37efe, 0xe6b381e7, 0x70bf7298, 0x65279728, 0x5661ef22,
-       0xaf7d254a, 0x53a0567d, 0xa1d3fca6, 0x9bd80fdc, 0x867ca76a, 0xc2166ebd,
-       0x016079f8, 0x2ba40fd7, 0x29b29e88, 0x086cd54e, 0x3c1c812b, 0x70b90d0f,
-       0x97e09c5f, 0xd17bffe1, 0xa418d0bc, 0x7d05d8ef, 0x393df871, 0x17e747e8,
-       0xc57b4ad8, 0xd77ec9ab, 0x1f78d0e2, 0x439bbf1f, 0xa09820ae, 0x7d236af6,
-       0xbdfa261f, 0xf0f4bb9b, 0x787a6b84, 0xe77fd322, 0x87aadca5, 0xf87a2b27,
-       0x6e472153, 0x9f3fd749, 0xfdc3d2ea, 0x338c1c17, 0x1415fbf2, 0x828ed2af,
-       0xc60ef7e1, 0x200806c5, 0xfca16a47, 0x6b9d01a0, 0x3f341e48, 0xbff88338,
-       0x7c7d1aff, 0x6dd59d38, 0x9c603649, 0x59dcff5a, 0xefd68674, 0x073fd1ac,
-       0xfc60e83c, 0x7dd209ec, 0x3c9f70c5, 0x387fe614, 0xe657e79f, 0x7869de48,
-       0x5a0263e4, 0xfdf915bb, 0xdb8fbe76, 0xfe0b5f64, 0x4adb16bf, 0xa0af2853,
-       0xb5f7c2cc, 0xf77c58ab, 0xdf8525a6, 0xbcb35edb, 0xa67f0dc9, 0xfba6cc8d,
-       0xfedd6dd8, 0x2be48fb5, 0xe291be3b, 0x646b7bff, 0x8676aefa, 0x85eb4035,
-       0xc5d15c75, 0x5cba34a9, 0x6049cfc0, 0x587aba3d, 0x3d3d15cf, 0xa874443c,
-       0x31f90bad, 0xe45eb110, 0xfb4440c3, 0x72fb86f7, 0x8fc8dd71, 0x72e3cf91,
-       0x0f744d3b, 0x2fa7ac59, 0x42e4d4be, 0xd68f3899, 0x10bed2f2, 0x69796a63,
-       0x695e451b, 0x878f439b, 0x5127aa2f, 0xf08be11c, 0x0c5f789c, 0x0fbe453e,
-       0xc7be73e4, 0x87bc3b72, 0xfae7bd7c, 0x1e38a9e2, 0xc44081ca, 0x084e1bf7,
-       0xed87fc3a, 0xbb2896ca, 0x3fbfecfb, 0xaec8cf59, 0xeb0a1cac, 0x8e781dac,
-       0xdf174fdf, 0xf4213ab7, 0xe9c094be, 0xebbcafa6, 0x56bc9efa, 0x8a5bae2b,
-       0x12bbe3ca, 0x020daf85, 0x57fbda5f, 0xd3c26c94, 0x6b728e95, 0x4262785f,
-       0x1f21323e, 0xb32a7bf1, 0x4c6ecfca, 0x3a5b1955, 0xf879b9f4, 0x7759887d,
-       0x02cd2d9d, 0xd7d0f378, 0xb3d3fc38, 0xa6800c2f, 0x2dfcfd1f, 0xf67c3f0e,
-       0xf9154c8b, 0xe1e73ff2, 0xe21c23f7, 0xaf9b45dc, 0xa1fade36, 0xb758dedc,
-       0x238f1ce9, 0xbf3a5ec8, 0xc97a77ac, 0xa52cffcf, 0x07e781cb, 0x9cbb52eb,
-       0xd7206e4b, 0x40ba6dd7, 0xe9860c71, 0x5f30a351, 0x9f129188, 0x57c7e5ad,
-       0x1de3f3ea, 0xd7c4d58e, 0x50501616, 0x3d59c5de, 0x7d7e7e74, 0x73e68ba8,
-       0xf9ab531b, 0x0f2bb9f9, 0x5dd667f7, 0x5ff69886, 0x8f9150e3, 0x68df42ca,
-       0xf2f2265c, 0x768994e7, 0x7117f8ca, 0x9e8cdb9c, 0xfffbd446, 0x2a51663a,
-       0xbf2d098a, 0x3dcf4869, 0xe6df43b7, 0x0face4fe, 0x24575c0c, 0x53f178f2,
-       0xcf345dc3, 0xea0038c8, 0xe5f6be85, 0x3d53d088, 0x38a1e2fb, 0x87b27d67,
-       0xe5d28bef, 0x92fb82d8, 0x5adce5d4, 0x7bfaf7d4, 0x3e144fed, 0xcd32875a,
-       0x7e90967e, 0xda7f0ebf, 0x607968fe, 0x1e5706f5, 0x87172bd9, 0x609fe2e8,
-       0xf6bcbbe8, 0x718df4d8, 0xa7360d4a, 0x648e297b, 0x300b514a, 0xeffeb84f,
-       0xe9bccc52, 0xb74e8273, 0xbee9e238, 0x4cc3bd75, 0x1ddabdf7, 0x61da183b,
-       0xc236db56, 0x89a3854b, 0x835c9e61, 0xb7d2b59b, 0x82f2a20f, 0x790bec1b,
-       0x659f2a7d, 0x8e4d54c3, 0xc6d67e71, 0xdc94aabb, 0x772a2e30, 0xa3affff2,
-       0xf2477aaf, 0xec1f9e34, 0xb07e5330, 0x8bae6894, 0x26dc1f95, 0x5c768dec,
-       0x83ae0a57, 0xf5b4c9c7, 0xaf3c5d58, 0x9c639f11, 0xd1f2eccc, 0xada2e3ff,
-       0x87ec4dbb, 0xaae2ded6, 0x25ef2863, 0xf942eab3, 0xff73c52a, 0x4147f51d,
-       0xc6d49c84, 0x89a87e7f, 0xae1b0bdf, 0x2b35fcf0, 0x7eb317d7, 0x7f19886b,
-       0xf3543abf, 0xbf19beb7, 0xdb32f469, 0x3461f3c8, 0x336b9ebe, 0x981ed07b,
-       0x7ca74b6b, 0x8040b99d, 0xda239317, 0xbf3e677f, 0xe9ab29bf, 0x1bbf4748,
-       0xdfc5e137, 0x4c36f801, 0xf6f4f117, 0x6bdd1354, 0x3cc0db7a, 0xe74652e8,
-       0x49bd7a23, 0xb79a7193, 0x80db38ce, 0x31d8786c, 0xcbe504be, 0x13728ee1,
-       0x3b0067de, 0xca186e21, 0x46eea599, 0xbf30efbc, 0x7fbe98a6, 0xd77fc5a2,
-       0x49303d09, 0xddb039f2, 0x9a3f6367, 0xde6c4155, 0x7fdf4595, 0x88dff114,
-       0xbb44fd76, 0xaca26ed3, 0xc03efa2e, 0x45e8e515, 0x83f68b9f, 0xf1a21af2,
-       0xf912fb89, 0x72698bff, 0x8b3bf502, 0xe123b3b2, 0x949d89ed, 0xa9e9af6f,
-       0xcdf23ea6, 0xf2130db6, 0x714fe351, 0x7cc7109e, 0x6493c456, 0xf37b72f0,
-       0x3f4fd3c8, 0x37b1eced, 0xa43d0877, 0xd05093f5, 0x2209954a, 0x78a0c4ef,
-       0x2564fe88, 0x75801e90, 0xfb197d36, 0x61dcf89e, 0x716d8e5c, 0xf6c74b6f,
-       0x3a6ab915, 0x79d14bfa, 0x51eef5de, 0xf57fc8e9, 0xaafd3553, 0xaff9235a,
-       0x7bff9ddd, 0x75b42f3c, 0xb9e45898, 0xc669747c, 0xe41bb573, 0xfdc59bed,
-       0xc7476dc8, 0xbcbe3158, 0xc61256cd, 0xb66dd9f3, 0xbb721294, 0x478f3c6c,
-       0xf1b36f6b, 0xca9b3abc, 0x1b36d5e3, 0xf2d37bcf, 0x27ddda6f, 0xbb5a0f08,
-       0xfef8c3e1, 0xff7e54d9, 0x520d5e21, 0x1bd938bb, 0xb8acbcc0, 0x66f64614,
-       0xc77f959c, 0xc8c0a12f, 0xf9fc31ac, 0xea266182, 0x49665b67, 0x9b54ec98,
-       0xd87642ec, 0x4e925e96, 0x0df11272, 0xbbdbd6e3, 0x19f745f1, 0x6b7c0856,
-       0xf3b7d4fd, 0xa9bede75, 0x08c56e72, 0x8bbd13b4, 0xd9b74e90, 0xbf315896,
-       0xde97b254, 0xc3f5bfb0, 0xca7cba0c, 0x7994fe9e, 0xd815bfa2, 0x512f649f,
-       0x8b133fb0, 0xfa0cfffd, 0xbbfebcc5, 0x819815e7, 0x60e3df46, 0x9e4fbb4c,
-       0x68cf4b1e, 0x439c55a5, 0x0ff7bf44, 0xfacd95db, 0x93d82578, 0x75830d0f,
-       0x3b9e66d5, 0x709e9131, 0x5e31b27b, 0xd849177c, 0xdbc2b285, 0x3df91a37,
-       0x637bed4d, 0x27289d9a, 0x73d0f1e9, 0xc3ef8a7f, 0x31c78555, 0xc518daae,
-       0xf9f9a257, 0xba63a9ea, 0x67a8107b, 0xc6dec23d, 0x8f48ed12, 0x3895cf19,
-       0x8efc6b5f, 0x3f28ba77, 0xf77f9aaa, 0x2918a6c4, 0xf400c25f, 0xddad744b,
-       0x8a4af9df, 0x115d7f69, 0xab486afb, 0x6dbf8951, 0xa32c42a1, 0xf3bf7bf9,
-       0xf3f22154, 0xfadd69fe, 0x6d75c156, 0xf7e5ca48, 0x564e4f17, 0x5fc3d962,
-       0x71c25f77, 0xa4ddc76e, 0xcf5c9d67, 0x3fbebffe, 0xaf34e8d1, 0x66debd44,
-       0x97f7fbd0, 0x50fddc85, 0x9afd8ff0, 0xdbbcf74c, 0x22ef7c8b, 0xde8c98bd,
-       0xfb07d46a, 0xbf9366eb, 0x501e0324, 0x30dfeeef, 0xc0af2a2d, 0x08b0fef7,
-       0x326b2e7e, 0x1aa677d3, 0xbf208fc0, 0xa31f6a2e, 0xb7eda7f1, 0xf9abdb06,
-       0xbfb69a39, 0x216cd313, 0x764bb791, 0xb9653387, 0xb398e501, 0xd9f067da,
-       0xec987db1, 0xfddabe8d, 0xad3bc84c, 0xb7fb0dbd, 0x3c4afce1, 0x8c4c7bfc,
-       0x6b24aef2, 0xec7fffec, 0x810f0a30, 0xcbac2b1f, 0x82aa7471, 0xeec24afd,
-       0xe8f9146d, 0xd5a94af5, 0x94bef113, 0x149d6a54, 0x7df52f41, 0x874a87c4,
-       0x942bdb77, 0xfce5a7e7, 0x60af684b, 0xbe4d9f5e, 0x20471ddc, 0x675e20ff,
-       0x47e36a2f, 0x9cf7bb9f, 0xbe3a73b3, 0xbd9294aa, 0xbb018f28, 0x4307ec00,
-       0x489bd2d2, 0x3f7c9a3f, 0x743c034e, 0xfca167bd, 0x3f05f7db, 0xec7e0a76,
-       0xd8056e4b, 0xb7dcba51, 0x4bc71d95, 0x2527401e, 0xf5274889, 0x39dd4699,
-       0x8b16568c, 0x5fb0c675, 0xfc8f87f2, 0x90cbf646, 0x17ec31e1, 0xcf224fb4,
-       0xf12ed1cf, 0xb445c844, 0xec313c4b, 0xf0a36697, 0xe779c4df, 0xadab9369,
-       0xfa70f013, 0xcefa44e6, 0xdbb469cd, 0xfb3ec04a, 0xdc5cd9e9, 0xee865994,
-       0x3b0853ef, 0x760c1191, 0x5e7077da, 0x1abbcc55, 0x1cd6ffff, 0x883f1bc9,
-       0xffd197e7, 0xfb75f2ab, 0x40b80719, 0xfbc76cbc, 0x1f744570, 0xf9d632ae,
-       0xe9baf7da, 0x88974504, 0x601e11c3, 0x5be22217, 0x5176e2bd, 0xa30c3a71,
-       0xe6fde774, 0xfdbf6ef4, 0xdae281ba, 0x882c7d3b, 0xb5bfb9df, 0x7b571f4c,
-       0xed99e443, 0xcf88ca5c, 0x86b41676, 0x53495fd0, 0xabc9c519, 0x73f6fa3c,
-       0xe3bfa32a, 0xddbf8fac, 0xcf4535e6, 0xd6ebbe97, 0xc06fac5f, 0x9714d5ee,
-       0x8b8f15eb, 0xfad1c38a, 0xf2943f50, 0x46adbc78, 0x6f655f9f, 0x7ddf419e,
-       0x12aeac66, 0x34cce7d7, 0xda8f8c32, 0xcff3a3ab, 0x1ecf0202, 0x9e1a5a12,
-       0xd878efb5, 0x7bfc8d8a, 0x540981a4, 0xe1c1e5af, 0x3a2705f7, 0x5b65d67b,
-       0x2c53e62f, 0xd881ace2, 0xf189daeb, 0x2e57cc46, 0x83c4830a, 0x302e70fe,
-       0xa30d464e, 0xbac299ef, 0x8705e775, 0xd0356f77, 0x03e147ff, 0x3c26ed71,
-       0x9813cfe8, 0x5afb40cf, 0x807f3fa3, 0x68e0ea75, 0xecebfebb, 0xb3bbc3f9,
-       0x58ff7e63, 0x5038b52b, 0x7610f8af, 0x383a4800, 0x6ca77c5c, 0xf68a1b28,
-       0x2378ad8d, 0x4c95c3ed, 0x0acaf79e, 0xa1bb9f62, 0x0ddf8f9d, 0x327c8a9a,
-       0xa679fd12, 0xf302cefb, 0x6f9f94c8, 0x3573e328, 0xa672f3f4, 0xd7c4622b,
-       0xb1307896, 0xbcfff04a, 0x1fa0f78a, 0x8c00b167, 0xdf1063df, 0xbdc4969f,
-       0x26062da4, 0xd514cc23, 0xb5e4f3ca, 0xe9043cef, 0x8d7d0f3b, 0x8b077da3,
-       0xda7bf805, 0x37dfd138, 0x74fbd1ba, 0x7e894d1f, 0x3ae282bf, 0xe17df8da,
-       0x17efafbd, 0x9dfcb1fd, 0x953e3c91, 0xc35a7449, 0xeba71fb4, 0x2b74ddc5,
-       0x53b83c93, 0x0f0f4eab, 0x773e7e45, 0xf74a824f, 0x0475b56f, 0x8eb44ba6,
-       0xf75fd96f, 0x595dd23c, 0x5881defc, 0xdbefe897, 0x117e8bae, 0x9301acf2,
-       0x1a8e816f, 0xcf91ef81, 0x2e93296c, 0xa10e74c9, 0xbf8bcfbf, 0x35fd1173,
-       0xf9493d1c, 0xbdc47b3b, 0xa75c6d70, 0x8a0433ea, 0x3c107ef0, 0xd08f118f,
-       0xdf8ca5ca, 0xf5e6d28f, 0x3504017f, 0x7fe05f6a, 0x00007fe0
+       0x00088b1f, 0x00000000, 0x7de5ff00, 0x4514780b, 0x74f570b6, 0x9924ccf7,
+       0xf2124c99, 0x00493de0, 0x210e0311, 0x9970c044, 0x46a2c024, 0x141a020d,
+       0x84920275, 0x7e889790, 0x33feaeec, 0xa8a08901, 0x17acb9f1, 0x376141dd,
+       0x0c06e8b2, 0x60e03518, 0xba2eb300, 0xe7c045c1, 0x36bc8026, 0xb9f04324,
+       0x9d6f5ecb, 0xdd33d553, 0xc7c4099d, 0xffef7fde, 0xa55f9f8f, 0x71ebaaba,
+       0xe9d4e7de, 0x278f3242, 0xdf210a64, 0x9f968fc1, 0xf890848b, 0x206f5950,
+       0x8841922e, 0x6df466d7, 0x88cfa64c, 0x68e67a23, 0xd11d985a, 0xef435837,
+       0x9ed5cbe9, 0x186934a4, 0x1c790f21, 0x23e21258, 0x5ab54e84, 0x16f50520,
+       0xe0933ba8, 0x213e3a7d, 0x0ff8e8fd, 0x30f8e246, 0x1a18992d, 0xe0311067,
+       0xf9ad537b, 0x421eb089, 0xc3e6476a, 0x213b16fc, 0x9f9f7bfd, 0xa7eb888e,
+       0xf7c10def, 0xb59efa24, 0x6529efef, 0x13fd0e57, 0xf66ddff6, 0xf108146d,
+       0x71c7fcef, 0x8699ef58, 0x5d130e39, 0xd9b7766f, 0xbeea053f, 0xb6899f6c,
+       0xc0fb6ee7, 0xe5fed126, 0xda0944db, 0xf0233b0d, 0x8275cefd, 0xa695ea0f,
+       0xa4ae47d6, 0x9136c0f5, 0xf8d30f3c, 0x4092062d, 0x613371c8, 0xeb15873f,
+       0x5aac1145, 0x6dd77ebe, 0xa3495f30, 0xf7d04489, 0x2e88378f, 0x28d92fa8,
+       0xaf9d08f8, 0x8c07b5fc, 0xc578e803, 0xc23ea13e, 0x1f1beb41, 0x3ee83a33,
+       0xd8fcef97, 0x7ce146d6, 0x0e2663da, 0xa4a3ee23, 0x52908d3e, 0x03e996df,
+       0x9ba5fbe8, 0xbe802705, 0x4ed9dd74, 0x83695f58, 0xe3a45c3c, 0x228bae2d,
+       0xee6c918e, 0xd7cc08ef, 0xdbe7147c, 0xf9830f26, 0x65dfce4a, 0x6ee52404,
+       0xca2e9193, 0xdf603ae9, 0x3da7bcca, 0x053e716b, 0xd22fe59e, 0x8abf68f9,
+       0x6c270597, 0xdc40c2b1, 0xd7ce8eb0, 0xb05e0a22, 0x8daafec0, 0x7deaac23,
+       0x7d876e14, 0x1bd6fa94, 0x7d605ba7, 0x69458deb, 0xd716f1a1, 0x7d76a7fd,
+       0xdd13536b, 0xf3e3bd69, 0x748287b4, 0x4a5ea844, 0x4fe90b88, 0x8e8119f2,
+       0x85e7e795, 0xe2f7c418, 0xcc38913a, 0x3a15f1a1, 0xe9c07ef0, 0xf1958774,
+       0x12dbc701, 0x842ce03b, 0xc73b6eb7, 0x54c814a3, 0x8f94af8f, 0x7ae83e00,
+       0x2c763d6a, 0x6124f71f, 0x81c7a4f9, 0x33da7b70, 0x1eb5cb12, 0xc67f3e27,
+       0x75cb0133, 0xcf96171e, 0xe9606679, 0xbf63e4f3, 0x58053de7, 0xf1b8f06e,
+       0x253d6ff9, 0xaa79d658, 0xcf26f9f0, 0x7b372c32, 0x65fcf8bc, 0xeb2c2acf,
+       0x6e58b53d, 0xb2d17c05, 0x7ec3e3c1, 0x58753ddb, 0xf1ea7a36, 0x469eebf9,
+       0x3870d72c, 0xb648b2da, 0x7360e144, 0x3b453b11, 0x6573cd89, 0x9b1eb4cb,
+       0xf309eacf, 0x5a46d9bc, 0x3ad3704f, 0x3280cb85, 0xd689b67f, 0xf6b15407,
+       0x1c92f721, 0xf10fad33, 0x3594f6b2, 0x5a089cae, 0xed65a94f, 0x7379d623,
+       0x847d6922, 0xda8fb58f, 0xa289cfec, 0xacf551f5, 0xc9134c7d, 0x18fad0b5,
+       0xefa7ab3f, 0x695ae573, 0xd595bd3d, 0xe6f13f33, 0xb33d68da, 0xa93fbd8d,
+       0x2c3a27c3, 0x55b0f13d, 0x14202c76, 0xb9de4d57, 0x9bca892e, 0x5dc746ad,
+       0x7bc849c4, 0x892ef9de, 0xd90687ca, 0xde6ded85, 0x746eacc5, 0x77b77b61,
+       0x2edff629, 0xaa5db1bb, 0xb7db0fbe, 0x9ed8dd1b, 0xed835d50, 0xdb17b28d,
+       0x8a3f5647, 0x2f468ded, 0x5eaa4fb6, 0x65d7f58b, 0x55e7b61f, 0xaffec7af,
+       0xfed87d1b, 0x5c9bfdf8, 0x05fd6953, 0xe41dbdc1, 0x5dc10ade, 0x9e815242,
+       0xee4093ea, 0xf9f970d5, 0x6d1d101c, 0x446fe9af, 0x6efadc3e, 0xbfc00be6,
+       0xf507ebf8, 0x983edfa2, 0x89bce38c, 0x1c74c8e3, 0xa4e3e2f1, 0x334137bf,
+       0x257bfa4e, 0x382d38ca, 0xc6df444e, 0x24defad9, 0x2bde7aed, 0x0fd9c655,
+       0xdac2b4fc, 0xffa57db7, 0x9ebb4b39, 0xe329973f, 0x89eb847c, 0x1a7adbe9,
+       0xa7c2d03e, 0x7c2083e1, 0xf138e28e, 0xc64f5b7d, 0x327c2d41, 0xd3e1060e,
+       0xeff4e381, 0x070d38db, 0x3869f0b5, 0x97cf8418, 0x7dc19f08, 0x21c657db,
+       0x0e327c2d, 0x5ff3e105, 0xbee49eb8, 0x53fdb38d, 0x7fb67c2d, 0x498f841a,
+       0xef0cf580, 0x3f32bedb, 0xf327c2d3, 0xec7c20b3, 0x7da5ce38, 0x67fb671b,
+       0xff6cf85a, 0xfe9f082c, 0xbee8ce38, 0xaff32bed, 0xfe64f85a, 0x149f0835,
+       0xb633e001, 0xfc69eb6f, 0xc69f0b5c, 0xb9f083cf, 0xdf19c70c, 0x384cf5b7,
+       0x84cf85ae, 0x64f841e3, 0xf626bee0, 0xe3c69c6d, 0x1e34f85a, 0x3267c20f,
+       0x6fb9338e, 0x42709afb, 0x27099f0b, 0x8e99f082, 0xebbb64e3, 0xc7465198,
+       0xce3ef6b1, 0xf0b467eb, 0x104cfd79, 0x38e3d73e, 0xa938e8d3, 0x52671f17,
+       0x933e16a7, 0x29f0833a, 0xeaae71c0, 0x77af38db, 0x7af3e16a, 0x853e1067,
+       0x7db5ce38, 0x2ea4d7db, 0x75267c2d, 0x3b8cf831, 0xa36b9550, 0x3a1754ed,
+       0x95cafa45, 0x40972e1d, 0xd59da2eb, 0x8093bb45, 0xf62a225d, 0x89756906,
+       0xe6cb7df4, 0x8907f498, 0xb9c8eeda, 0x4ac7e813, 0xddb531ad, 0x52213d11,
+       0xb8c4e763, 0xb8f53562, 0xfd340319, 0x3453f3e3, 0xa30589ed, 0xddfded34,
+       0xc0fa9ae9, 0xfe9a4992, 0x3472ab83, 0xaecba1f5, 0xf64ff4d6, 0xa7a9a0de,
+       0xd359baae, 0x7ced787f, 0x6b25fb4d, 0x97ed354b, 0xea6896fa, 0x42fdd597,
+       0xfd747fd3, 0xe5fb4d72, 0xda6a0f8d, 0xd71ffac7, 0x3cb5c7d4, 0xbe3fe9a3,
+       0xfb4d79f5, 0x69378715, 0x6db627da, 0x3cafd4d5, 0xcecebaf9, 0x5f8fd8b3,
+       0xd022ebc6, 0x7f76613d, 0xf8f7e67f, 0x1bac46ad, 0x8ed05807, 0x722d65df,
+       0x35f8a31c, 0xd1c0b5be, 0x7017e28f, 0xf6457e0a, 0xda4b9280, 0x267bf3e8,
+       0xd3b12fb9, 0xdd18f7e7, 0xd8c3db97, 0x041e94a7, 0xc3a50492, 0xfdbea500,
+       0x63d19901, 0x23f3c0ce, 0x95fbe9da, 0x1888c086, 0xb312cf5a, 0x777e811b,
+       0x8a2fcc0a, 0xf4154914, 0xf411348b, 0xce481e0b, 0xa2abc17c, 0x298355d7,
+       0x71a10a1f, 0x24eec957, 0xaade33b0, 0x1d82f76e, 0xee983352, 0xcd21006b,
+       0x4bdfbb42, 0x0607b4fd, 0xe9b92517, 0xb5232678, 0x1bf3d5d3, 0x3869fce9,
+       0xebd00b7f, 0x7c7f307b, 0x294df9cf, 0x9bf33413, 0xe6689487, 0xfce91b37,
+       0xafde4276, 0xa7e7c53e, 0xc8449848, 0x3853845f, 0x094869bf, 0x9180ffce,
+       0xf9ea2bfa, 0x1ff38323, 0xd67ffd86, 0x2653fedb, 0xa43ff769, 0x237fbb54,
+       0xea91ffdb, 0x48fe7cb3, 0xe151ffdc, 0x90ffdb2c, 0x137fb652, 0xbf38371b,
+       0x93ff082d, 0x2f677f30, 0xb3529bf3, 0x5a1ffbb4, 0x89bfdda6, 0xfd5ddfcd,
+       0x82df9f2d, 0xbe139ff3, 0x5a1ffb65, 0x4d1bf386, 0x8fd0276e, 0x95646071,
+       0x1d4fce8f, 0x04490761, 0x40f3a172, 0xfd163239, 0x148497e4, 0x913dc75c,
+       0x8abede8c, 0xf286f4a4, 0x58fccbc6, 0x996c951f, 0xb4e2efd4, 0xb67378be,
+       0xb612e411, 0x21657f53, 0x8d1dea5f, 0x7937d222, 0x4e1be4d2, 0x28d9dbd7,
+       0xc77ea17a, 0x207d9393, 0xe44d2aff, 0x4f787cf6, 0xfe787e22, 0x9fa353f9,
+       0x5f4bef57, 0x8f95ac2e, 0x2df8a9b7, 0x90e547e8, 0x98165591, 0x1fa9aed7,
+       0xa1107ea1, 0xd427c5fe, 0x249420cf, 0xbe6cca8f, 0x04bfa8cf, 0x2fea36f5,
+       0xd5213b41, 0x75e25fb8, 0xae8c307d, 0x3f289f3f, 0x26f3ee17, 0x9e3a2964,
+       0xc8f7f8c4, 0xf807c11a, 0x14597db8, 0x3d687e05, 0x4d38de85, 0xfb0fee9d,
+       0x7c12ae07, 0x86380bcf, 0x9333e01b, 0xbd60478f, 0x67605eb4, 0xe8a21cef,
+       0xb0514fef, 0x8a40d560, 0xb338d08b, 0xa44e4b88, 0x5a59cfef, 0xa2e84328,
+       0x2f061055, 0x2059fa01, 0xe0119753, 0x69278de7, 0x7ae8389c, 0xf1b3b66f,
+       0x63e4ba67, 0x14f5aa6d, 0x3e5766c8, 0xa1414f5d, 0x359feb88, 0xd1fedb43,
+       0x619728ce, 0x3d572d0c, 0xc9ccf381, 0x54dfb6d7, 0x75cfada0, 0xef54eb6b,
+       0x6ef7a0c9, 0xa73fd129, 0x9cfba160, 0x5d2b8417, 0xade75d28, 0x56b70e1c,
+       0x5e0d5ec9, 0xda556dc1, 0x26e0a021, 0x5f7c2fb8, 0xf6ffd9ec, 0xa17ada65,
+       0xb05f5b57, 0xa73e374a, 0xff1ce39b, 0x683e8047, 0x83e80279, 0xa718f3c2,
+       0xd55c908f, 0xc18dc7d2, 0x50fa306d, 0x625c71f6, 0x8ebe3828, 0xdac2c7d1,
+       0x50f4f0a8, 0x9707a418, 0x7a14be9a, 0xc3d38db8, 0x8a1e9ca7, 0x6ae96ad7,
+       0x4cadf12e, 0xb2dfefa2, 0xe9e21766, 0xe8c850a0, 0x3d0a97e1, 0xc1e869b4,
+       0x8f41e9cd, 0x3d38dbbf, 0x4673f6dc, 0xb67c7a0f, 0x5b687a71, 0x29264e7b,
+       0xf14af13d, 0x3c53a9a0, 0x376ef0e8, 0x7c503d02, 0xf987a584, 0x8dd37dc1,
+       0xde02fad3, 0x9c5f03d6, 0x053db01e, 0x4e104ec0, 0xcf6a7ef8, 0x684e54fe,
+       0xc36bc5ea, 0x31b2bfe3, 0x6a98ee3b, 0x57f5e55d, 0xf5531dc5, 0x53375c5b,
+       0x9be45f53, 0xbc5fe9ab, 0xbed350b6, 0xa69176b0, 0x3baac17d, 0xef42f535,
+       0x6ffd35cf, 0x69ad565f, 0xb56ab5bf, 0x9296fda6, 0xb9f534c7, 0xfa6b5fee,
+       0x5eb054df, 0xff273ed3, 0xacfb4d45, 0xf5345b19, 0x34d7ae99, 0x2f3b0dfd,
+       0x31e81ebd, 0xc048a0eb, 0x71e638fe, 0xf71fdd20, 0xa4f2c48c, 0x717c89c7,
+       0xcb0133da, 0x4fcd8d7d, 0x7cbb495c, 0x26882819, 0x91167f4c, 0x2cf64218,
+       0xcaaf5777, 0x504e7d02, 0x7971feef, 0x1077b551, 0x07065395, 0xad6f39c2,
+       0x11c7f891, 0xe2528022, 0x50c407f3, 0x6d1b567b, 0x3dbdeb8f, 0xb614ad6f,
+       0x0a4dab3d, 0xe3e56e3b, 0x61ed4385, 0x7e2133e2, 0x3ec10326, 0xb9f6e2ea,
+       0x204cbdbe, 0x84e7eaf9, 0x8ffe472c, 0x5cfd3031, 0xa2726466, 0x1cff6b6c,
+       0x7fba8362, 0xe685d544, 0x95cca7ab, 0xaa91f408, 0xb5e2e3e1, 0x3ce46997,
+       0x3c6de881, 0xcd38d9d0, 0x5775c5f3, 0xd8ebde6a, 0x2bbae225, 0x7d508640,
+       0x07e48c3d, 0xfd97a00c, 0x8d6643cd, 0xceba7586, 0x355e401a, 0xd8fda3c6,
+       0x771199e1, 0xe63c024c, 0x53d27963, 0x8f71e580, 0x9e63cb1b, 0x788f2c12,
+       0xf36cb0aa, 0x33f2c32c, 0x4fcb178f, 0xfcb0ab3c, 0xe58b53c8, 0x2c5acf61,
+       0x587c7a0f, 0x61d4f01e, 0x1ea7bef9, 0x234f56cb, 0x171e9d96, 0x29bf0a96,
+       0xddd3d0f0, 0x4fa7ae49, 0x805dfd03, 0x07c4e2ce, 0x0a0d57aa, 0x8ae259d1,
+       0x59bdab87, 0xd6f371a1, 0x249d389a, 0x0861e868, 0x81e364f8, 0x5e9c4c5e,
+       0xade7b7c2, 0x9ed82f95, 0x1d8726d5, 0x7ff9f2bf, 0xf9cdbd0d, 0xa216f491,
+       0x7a3a81a7, 0x3d18bd4a, 0x87c7124d, 0xc18e69e8, 0xa71ff4ce, 0x1f6087a7,
+       0x628ffc61, 0xabc6ea30, 0x14573aec, 0x73f3678b, 0xb2d16a07, 0x7b9f3678,
+       0x15ae1d05, 0x48df3fed, 0xc8f773c0, 0x78808fbf, 0xaa61f77d, 0xdf7b9328,
+       0x7a5e9e9f, 0xfd0bbb87, 0x551f22a0, 0xb67ae3a2, 0xb8324447, 0x0cc81846,
+       0xeac84e92, 0xce75bfe1, 0x44bac34f, 0x9f7de162, 0xf3986673, 0x4f670228,
+       0xeb871789, 0x6357eb0a, 0xcfe3bc60, 0xca1323fc, 0xe6148639, 0x688b34df,
+       0x0bff13df, 0x506f804e, 0x499c991f, 0x0c0f0710, 0x3ed1da37, 0xf0b459f0,
+       0x667ad2f3, 0x29ab7e08, 0xdf515a8c, 0xfc2126d7, 0xa2357d86, 0x77e01f7f,
+       0x317f3931, 0x0df7ce78, 0xf3c097f8, 0x62f1f262, 0x1cb89172, 0xfdd2372f,
+       0x9d1ced77, 0xe403a0fe, 0xade185e0, 0xd7e95f9c, 0x7d28bcf3, 0x4aee3a2f,
+       0x75b8e850, 0x88f3a108, 0xefc71da2, 0xc984b86e, 0xdbeec52f, 0x05f5f266,
+       0xb59267af, 0xf9c53de3, 0xbbaf194f, 0xf81b05e5, 0x0c924b5b, 0xf06163f6,
+       0xf5e594a0, 0xda8b76c9, 0xd6d46cfe, 0x19856bbb, 0x3a2768f5, 0x068f67a2,
+       0x1fb7613d, 0x3b72061b, 0x9c654b09, 0xfb464925, 0x4ef72a31, 0x3346a5d7,
+       0xe4c7cf3f, 0x9418e6c1, 0x663da717, 0xaf53ffec, 0x9471b7a7, 0x40d210f5,
+       0x1e419a8e, 0xded4b6d3, 0xcf4af7fb, 0x3c4617d2, 0xbf926df7, 0x4cd0fb02,
+       0xfc0effff, 0x5d61220d, 0x5eb2b719, 0x872e9af4, 0xf3359be7, 0xca1cf7d1,
+       0x2977eb19, 0x891be217, 0x96e8571c, 0x5c638bea, 0x8bae2c9f, 0xcfed6bb0,
+       0xb2bd4d18, 0x635dbfb1, 0x541fc28f, 0x412a92fe, 0xe329fa02, 0x5925d3e4,
+       0x7d740956, 0x1090426f, 0xfd6056e8, 0x466dcdca, 0x95ce03b7, 0x5b7ade19,
+       0x4cdfc51f, 0x897c9289, 0x61cf16b9, 0x9d2fea4b, 0x4ce67a0a, 0x88048ac3,
+       0xbb162c1b, 0xf30fc9ef, 0x79312cbe, 0x0727c8bf, 0xa73df6b4, 0x55c7420f,
+       0x945c639e, 0xeaab8e58, 0x8f16061d, 0x009b8fd1, 0x1c5fc6e3, 0xf79b153e,
+       0x413b074f, 0xc68aa70f, 0xca3746b3, 0x665ffa45, 0xfc0a4e08, 0x13f314de,
+       0x697e3a24, 0x2dc63b5d, 0x11deca4e, 0xbc80bcbf, 0x4b3fb9ec, 0xd528f1d2,
+       0x15a4bcbe, 0x813f99e6, 0x371c444f, 0xf8e54c7d, 0x04c93fa9, 0x4f3910e4,
+       0x4862657b, 0x063bfb86, 0xf90cc862, 0x161bf33b, 0x4fbc01e7, 0xe547bf81,
+       0xdf241de6, 0xb5207886, 0x9cdfe099, 0x00198621, 0x7de433a7, 0x1e1538db,
+       0x87232572, 0x94829533, 0xf1c14c1e, 0xefc1fddd, 0xb4d41532, 0xb9e0638a,
+       0xc23ff8a4, 0x72471877, 0x50b7980b, 0x897b9ec0, 0x97e81ab9, 0x3f1a51fa,
+       0x9a51fa8d, 0x34a3f53a, 0x437222f5, 0x1425e402, 0x9f13293d, 0xb4d27080,
+       0x88ec928f, 0x555262c7, 0xafd1f603, 0xbe6dfc79, 0xe903489d, 0x7d5fcb3e,
+       0xee90b336, 0xc5896ae7, 0xf57394fd, 0x0e0cb145, 0xa33e25a5, 0x7f73d2cb,
+       0xddc61b47, 0x8c3f2548, 0x6fcfcec7, 0x051e6236, 0xdc994ab4, 0x7de949f4,
+       0xa20d89ff, 0xfd06c22b, 0xbd6573e8, 0xff7fdfc9, 0xf212fdfa, 0xb4a3ee38,
+       0xfa01266e, 0xc02791eb, 0x09d723f7, 0x7e185f2e, 0xaf74e42a, 0x013ba7e8,
+       0xf143e37e, 0xf574fbac, 0x4abe1cd5, 0xfb5d29fd, 0xfd2f960f, 0xbcbe4688,
+       0x93efba29, 0x027933c6, 0x00a417f0, 0x1e0fd7f2, 0xf8c7a93f, 0x7f1f81ab,
+       0x6907f1b2, 0xff8e9ef9, 0xfeba4fd4, 0xbfd63d61, 0xcbfadc3e, 0xbb697d5f,
+       0xd297ea97, 0x23653c3f, 0x494edf94, 0x8a4e09b5, 0x2b8db2f7, 0x3b902e6d,
+       0x7c06d792, 0xce27ca71, 0x870f4708, 0x06a57cb8, 0x78804588, 0xc749fc2b,
+       0xa1e9bd3f, 0xf89ec0eb, 0xc76ca36a, 0xc99d6a38, 0x5cf4a26f, 0x8f28b0d1,
+       0x3b7ac18c, 0x16703fab, 0x51b2bfe8, 0xd3a6a23e, 0x953ddfd2, 0x94357900,
+       0x921a0652, 0x7fa3f4a0, 0xf3e1b152, 0x546f60e9, 0xabf20092, 0xff983dfe,
+       0x87d4589b, 0x9ee8c685, 0x499818ed, 0xafd9f780, 0xb3a1e1b2, 0x6afe0da2,
+       0xbe9038c3, 0x37f7097f, 0x3f6b245a, 0x82b9273c, 0x54f2015c, 0x31f10781,
+       0x8bc5637f, 0x4ed31abf, 0xe1b1d3d7, 0x0541364f, 0xea4fc527, 0x9bf05fae,
+       0xcbbd1dd7, 0x87ca4eef, 0xd156bb6a, 0xee468e4f, 0xb2b13527, 0xaedbf64c,
+       0x6ca4f2a4, 0xd2f4ecbd, 0xbd2f65c7, 0x2067dbf0, 0xc9a1fd7e, 0xbf8e9c39,
+       0x073da5f8, 0xe2fad127, 0x3cbf722d, 0x908b0db6, 0x254bc210, 0x7a597ffd,
+       0xafa50f08, 0x463a31ec, 0xc6f7e7b3, 0x78b1f086, 0x19232ecb, 0xb91e13dd,
+       0x6d8cbbf5, 0xa9783096, 0x760e9f6f, 0xbf178adf, 0x3bbc8236, 0x892053b5,
+       0xb9e061c9, 0x85da0f7e, 0x23c42700, 0x6f1053c7, 0x1495feba, 0x145fa02f,
+       0x37dbe93c, 0xe3027971, 0x9e90d239, 0xce9d7e5f, 0xc991f25f, 0x792ffb09,
+       0xec1b2ef9, 0xc55484e3, 0x95d9fae8, 0x4adf2009, 0x1d826f64, 0xe4bcf64b,
+       0xde91bbb9, 0x9ddff78a, 0xae92e2c0, 0x95d406fe, 0xbfb0fede, 0xe0e6eb85,
+       0x1b888afe, 0x59e4aee9, 0xcb47df31, 0x6332252f, 0xb8be184b, 0xf2726656,
+       0x2354f3c4, 0x509dfdd0, 0x22fbc0f4, 0x627703d7, 0xbe6ef3dc, 0x62316a17,
+       0xc3334bfd, 0xc0d930d3, 0x2bd32ce5, 0xf0dd7a41, 0xd38bea00, 0x70895d83,
+       0xd21956be, 0xc437a80f, 0x1912d3fd, 0xc19e987e, 0xc99ea8f7, 0xbfd0e785,
+       0x8c457655, 0x7a87bcd1, 0x297f9945, 0x3bae9f9f, 0x13b5ec12, 0x8ffde109,
+       0xdf0acb9f, 0x4542bb53, 0x66fe2a5f, 0x3561befc, 0xdf856fe3, 0x4067337d,
+       0x180717fb, 0xa07bc0ff, 0xfcbae967, 0x6bbed889, 0xc0f280b6, 0xf8e1fc44,
+       0xf9cc837a, 0xd0aedb5a, 0x24b75d09, 0x05e8ab44, 0xf8458fc6, 0x7a2f5ea3,
+       0x92a7be92, 0x9f309597, 0x0a78e7ad, 0xfe7316df, 0xf96b219f, 0xef8bac9f,
+       0x99653e53, 0x33edfbec, 0x3f94afc0, 0x57e00ebd, 0xfdf61f39, 0x07cdcdb7,
+       0xfa7ca66f, 0x4f857ab7, 0xcf53f2b5, 0xef5b25a7, 0x7a9f4026, 0xa0dbfd3e,
+       0x4f96122a, 0x7cb0f3e9, 0x7feda83a, 0xf02a7e54, 0x45f802ab, 0xc8a7e085,
+       0xa8e0dec3, 0xd9568797, 0xd21e5611, 0xd99201df, 0xba14fe93, 0xf4ade853,
+       0x4143e5f7, 0x52e904ee, 0x5d20bba1, 0xdfa7742a, 0xfa7e16af, 0xc13249f6,
+       0x26bfe575, 0xd65cffa3, 0xe942f2c4, 0x66077b7b, 0xa85c9c20, 0xdeed48c6,
+       0x75d4fd81, 0xaf5eae9f, 0xd5d2efeb, 0xddfd75f3, 0xa6957aba, 0xb363597f,
+       0xfdfe2091, 0xb2e27e9a, 0xb8d1c867, 0x63eaf470, 0x59c3597e, 0xc2e817a3,
+       0xe5f7c012, 0x790bc4e5, 0x221d8186, 0x28ba05c6, 0x7e206b8c, 0xe7d939b1,
+       0x656372a5, 0x743f8b04, 0x58b603d9, 0x618cae5a, 0xb1bc40f5, 0xf29ee406,
+       0xe2c1103c, 0x01f95d8a, 0x9fca8c5b, 0x51126f6a, 0xc8f9b76e, 0x167e708c,
+       0x47c828d5, 0x76b7a46d, 0x4d35ee76, 0x06590cb4, 0xd15aa571, 0x1df83609,
+       0xe0d937d5, 0x29aba9dc, 0xfa02faf5, 0x451fe17c, 0x8ae97b4c, 0x75818db4,
+       0xea4baf11, 0x4e6ff2af, 0x59d3ef12, 0x9a0b7f74, 0xc7739f98, 0x423d9d1a,
+       0x153d20d6, 0x411a9659, 0xe27f529e, 0x86bcf688, 0x1f2945f1, 0xb69d64af,
+       0xd29f795d, 0xa5f3fa01, 0x6eedb41b, 0xa07f0fee, 0x3258c9f0, 0x2ca3fb96,
+       0xf2e5c30e, 0xfaed3134, 0xae8f8a02, 0x68989116, 0x4449bbbd, 0x166f747c,
+       0x234f107c, 0xb7e478de, 0x7940120a, 0x03a9c0a8, 0xbbd8c9f8, 0xf6d8eabc,
+       0x812fe669, 0x3c7fb66e, 0xd9693fe6, 0x11c3fdb1, 0xd5fd406f, 0x263e4343,
+       0xeee7fb3d, 0xff73c08c, 0xa4569dae, 0xef1daef7, 0xd425f90e, 0x6139335f,
+       0xbf3b5d9d, 0xd3f4031e, 0x0254dcb5, 0x306baef2, 0xd8aec78b, 0x3698f5f1,
+       0x33f7afd4, 0xfe6461fd, 0x3fd37761, 0x41fa133e, 0x76057749, 0xe428cec3,
+       0x23d7caa7, 0x6bbbdf30, 0x6e99d7c7, 0x9fb74fcb, 0xd1e79e0a, 0x5b052565,
+       0x2c317d61, 0x8df2a18f, 0xd3542f89, 0x761bcbf9, 0xf6d01719, 0x39ff37dc,
+       0xd768e406, 0x750f6656, 0x41cf6dca, 0xf194431e, 0xe29972dc, 0x8a9813ab,
+       0x33bfcd3a, 0xdf02e466, 0x3fcb84f4, 0x57d63e31, 0xaffca478, 0x62e08781,
+       0x33eacef2, 0x6fefb00b, 0xe318fb3f, 0x4ba4269a, 0xab7fbf65, 0xe57b46af,
+       0xfecefb62, 0x82df6e7f, 0x76fb2fbf, 0xfbef9bff, 0x7abbd738, 0xe749e83e,
+       0xfac1ee3b, 0xae27564b, 0xeef48fb7, 0xffc7fd85, 0x7bffeefb, 0xc52b7de3,
+       0xfbe2edbb, 0x5affcdfe, 0x36f1ffbc, 0x7e3b778e, 0x3fe6f3d7, 0x57df7d71,
+       0x6ff9bdce, 0xf6def78e, 0xadf5d8af, 0x067b2a86, 0xa9015f5d, 0x316182b5,
+       0x92dbbe37, 0xd76c80e1, 0x8f30fd73, 0xc34bce0e, 0x23014df8, 0x904d0bf3,
+       0xfb7e0747, 0x0b89411c, 0x1d751fa2, 0x1bae1fb7, 0xc8768254, 0x9987ae75,
+       0xb55520dd, 0xadfed366, 0x989c0b39, 0x0fd24973, 0x7b3ea1bb, 0xfd6baf32,
+       0xe204f7c9, 0x7f1da812, 0x2d35ce5d, 0xef5ed760, 0xa5eed112, 0x1fbbda25,
+       0x9ece990c, 0x3dfad04f, 0xfadadd73, 0xfada054d, 0x8dde3e1c, 0xc6ffad84,
+       0x7107c17c, 0x13f65355, 0x356710f1, 0x9089942d, 0x5542f90c, 0x98bfc12b,
+       0x7f7daf93, 0xe3c1f81f, 0x531c3c7f, 0x971c0a4d, 0xb6485c20, 0xfa48dce8,
+       0xeebe4700, 0x7d63d9d6, 0x244ccf90, 0x8de38327, 0x838c4ee5, 0xe65b7f73,
+       0x5596cbef, 0xb2cfc0ad, 0xfc56cfce, 0x4de0dee5, 0xe38dffb8, 0x2fe084a4,
+       0xbff444bb, 0xadff9d65, 0xe2fbe5e0, 0x8fe3c143, 0x3a97cbc5, 0xb8b20cbc,
+       0xccabf008, 0x16a985fd, 0xca0fab27, 0xc8de7827, 0x9fa905fd, 0x42d3788b,
+       0xcc8bdf79, 0x5f386ce6, 0x30148f33, 0x1afd71de, 0x3983f511, 0xe575c04d,
+       0x8f31904f, 0x7e4373f8, 0x6f3be026, 0xbf1515dc, 0x0270cb60, 0xb871173c,
+       0xb42a9117, 0xeff9c95f, 0x84cacbbe, 0xf6820673, 0x211722ef, 0xadbf52d7,
+       0x47f04b28, 0x4b157852, 0x0e9d1bc4, 0x1c816f71, 0xb5bdc4d1, 0x47fdf875,
+       0x8b9c6842, 0xbe4deff5, 0x5fe5d4fc, 0x323b3ca9, 0x1e41fa8c, 0x5849bb9e,
+       0xaff156dc, 0x70626f6f, 0x7c132cac, 0x7e774829, 0xee755f39, 0x83e71cf8,
+       0x0e3bdebf, 0xa3f664e5, 0xefd1a3a3, 0x6fd03977, 0x437ee4a8, 0x0d11d7b7,
+       0xa6eeae71, 0x9b3e7e54, 0x55cb536b, 0xfdcfdca5, 0x7e40bfee, 0xa6bb2d21,
+       0xf822b50a, 0xf1802471, 0x08d4ef5c, 0xfe4c31b2, 0x1931ffeb, 0x6154fd38,
+       0x627e001c, 0xfd91e026, 0xd1abe98a, 0xadbc2ab1, 0x3494f6b9, 0xe01e27a6,
+       0x0e754477, 0x0be163f9, 0x75c03e7e, 0xf4db447f, 0xadfb30fc, 0x5638b135,
+       0xe2df5bde, 0x34379c77, 0x9700cb25, 0x9a8aa61b, 0x2655fb73, 0x238d97ee,
+       0x795d60e3, 0x9b655d6f, 0x11697808, 0x66ddf09d, 0xa359d365, 0xb079cc3b,
+       0x3e309e1e, 0xca8fd5c4, 0xe78022ce, 0x082387d1, 0xf2efd1f8, 0xf834c673,
+       0x430d226e, 0x2b882e3a, 0xb5c39afe, 0x72c764d3, 0x1cb65e56, 0x6b4de74f,
+       0xa3858fb0, 0x7fbc01d4, 0xe3211827, 0xbd878921, 0x501bf4a7, 0x1bb5fac6,
+       0xf6e115ed, 0xed823c3f, 0xef3898bf, 0xfbfc2099, 0x51fb2de1, 0xec073fab,
+       0xae3ca983, 0x09ae83d2, 0x0cf747f2, 0x1bfa07c1, 0xe7ac61fc, 0xdf84efb1,
+       0xbeb3be55, 0x8559e981, 0xde70f5ee, 0xccace1cb, 0xe2c4dc7f, 0xfce27faf,
+       0x8159c0a5, 0x4abd7eaf, 0xa6af2a7f, 0xd751e3a8, 0x197d8e37, 0x268a9bec,
+       0x43a06ec1, 0x466d4855, 0xc6cac3e0, 0x6f3864c7, 0xe360eb99, 0x8c7f2912,
+       0xd3a09f3a, 0x9a3bf2c4, 0x0dbcafd3, 0x1adce4e8, 0xe242e813, 0x0dace3ba,
+       0x06bbf0e4, 0x7be19fe7, 0x227bef6a, 0x790178d9, 0xcea7b1f5, 0x8f525535,
+       0x9ceb8c9b, 0x432d9655, 0xb296ecf8, 0x8aa2725d, 0xb14d3a9e, 0x1f3caed8,
+       0x8748e650, 0x5c3e74e7, 0x1311f787, 0xd242ef81, 0xfbf15bea, 0x62aa5bd4,
+       0xd4961d18, 0x3d6232ef, 0xf32bfb19, 0xf9e8f329, 0x369e7669, 0x6e4178ef,
+       0x4b8020db, 0xd4bfc99e, 0x1f4e8619, 0x8ee72b33, 0xb84f53df, 0xf98edd28,
+       0x2c4f48ff, 0x1b44f455, 0xef2bb9e6, 0x3e3335cf, 0xc489e957, 0x49627a70,
+       0xf01123b5, 0x6a4764b0, 0x92c93022, 0x084b4e3f, 0xf03e27a7, 0x43e373b0,
+       0xaeeebbfc, 0x5c4f54d9, 0xb313d2ae, 0xf44e9023, 0x959ae5ef, 0xe88b8d73,
+       0xff6f0509, 0x03e6f2c3, 0xf86113d0, 0x56b346fb, 0x54d8dc4f, 0xc6e27a88,
+       0xfbe6a2d9, 0x17cd6baa, 0x09d913d3, 0x3b2eb173, 0xcfd0c2a3, 0x39bfdc07,
+       0x61fbf3c4, 0x6b17d01e, 0x9b8476cc, 0x26f46f5e, 0x55f6c7d7, 0x825fffae,
+       0x97d722b3, 0x43f761cc, 0x8243a4f4, 0x2e64bcf4, 0xd002eb95, 0x4beb9323,
+       0x4e71e56e, 0x07cd9c9d, 0x96a19b39, 0x0afdecb3, 0x950bd337, 0x9abfc98d,
+       0xae6fdb47, 0xda669d95, 0xdc90e6ff, 0xddcb54cd, 0xe1096635, 0x96ee43dc,
+       0xae7bb930, 0x4fda1c69, 0x53efedbd, 0x3ca96f2e, 0x430ce61b, 0xa2f3051f,
+       0x1ddfdf34, 0xda76fb1d, 0xef2fc02b, 0xfb7e788a, 0xf603b739, 0x033b7d8d,
+       0x7c53e9ec, 0xfcb8db3d, 0x5cf8f4eb, 0xc81ca953, 0xd3d983bd, 0x84459be5,
+       0xe303455f, 0x91618aff, 0x4fad073e, 0xcf16ff4f, 0x60ef1761, 0x0774b0e7,
+       0xfc2ad979, 0xadb77e2f, 0x1605ce06, 0x1cf017af, 0x005fbe19, 0x78731678,
+       0xe3173916, 0xdaf14a39, 0xe53fe7f0, 0xa6a2dfbc, 0x5f0f18f5, 0x2bf6d3e4,
+       0x29f5761f, 0x4cf247f0, 0xaf790f0c, 0xc9f5be08, 0xeba0cf90, 0xe78d5ce7,
+       0xdaf5e547, 0x7ef907e7, 0xb4fe8a17, 0xe4fbe857, 0xd3bfcccf, 0x1ea0fbc3,
+       0x123f252e, 0x5c29fb2e, 0x70f5fe32, 0xd40e0de9, 0x01f3c7be, 0x2b0e3c3d,
+       0x649d2572, 0x6e7e1f00, 0xf15ca170, 0x42e143be, 0xb1e3bbe7, 0x40fb9ae1,
+       0xbcb8738e, 0xf4d7706b, 0x02157e87, 0xb75e2bf6, 0xad024f65, 0x6327abcf,
+       0x78a178e1, 0x070f56ad, 0x03837ef5, 0xaabcfaf5, 0xc7e4022d, 0xfbdfe42e,
+       0xc31ef895, 0x5d6e547b, 0xed3cf546, 0xe4dd20bf, 0xfdf07386, 0x9b940111,
+       0x47c6dd0a, 0x8e25fb30, 0x03a3a1cb, 0x3f515302, 0xe4760a35, 0xd3047f47,
+       0x704f1457, 0xc4f34bbf, 0xbc73a7af, 0x2352b8b0, 0xc52563c3, 0xf4f3f01b,
+       0x63af5e26, 0x4a2de076, 0x39f05ebd, 0xbbab9004, 0x8c5f7664, 0x8e04e240,
+       0x847e9504, 0x04ecd5f3, 0xb4779e15, 0x28dffa33, 0x8f81f138, 0xf043f7fe,
+       0x33dd2bdc, 0xf4afa63b, 0x3e29c0ae, 0xfde78b42, 0xe379ad11, 0x9bf9c1fa,
+       0x737bc4e0, 0x9cf0629a, 0xbb2d58e8, 0xbf9525ff, 0xf00be7a7, 0xd1f7d43b,
+       0x438584cc, 0x088cf37e, 0x79c50fcc, 0xa65d9853, 0x7bfa4f96, 0xfe6fbe80,
+       0x45692551, 0xc7942c7b, 0x04de7ee8, 0x3410cde3, 0x09104ef9, 0x09ff3a03,
+       0x7cd5bfc6, 0x9249f181, 0xef96f31d, 0xedcf2bb2, 0x5e2cbbec, 0x799c1e6f,
+       0xef851e68, 0x13a255b9, 0x0c9ba85c, 0x2059838e, 0x09941e6f, 0x7db9cbf0,
+       0x81e98bb2, 0x853bd428, 0xefc51eef, 0x0e590ad9, 0x8fbc291a, 0x7ca397e9,
+       0xbd511f3d, 0x0a5882ed, 0xf70f1fa9, 0xee76cce0, 0x7880e69a, 0x95fec64b,
+       0x2b39ce70, 0x20f07ed7, 0xbb3573e0, 0xaac8e907, 0xeed3f45c, 0x7e4053ba,
+       0x06f14c3b, 0x9d99cfef, 0x9d20f07c, 0xf155d6f7, 0xcf396e78, 0x9c237f15,
+       0x27dbce63, 0xdfb41d3a, 0x16adeb82, 0x66bcc738, 0x2adc48a4, 0x5a4adcf8,
+       0xaf33be31, 0xb039ceea, 0x0faa12ee, 0xf72864c5, 0xfa844b4f, 0xafdf013a,
+       0xf08dbaf4, 0xdaeb66bd, 0x3a0cc6b3, 0x07ed117f, 0xc75caf60, 0x106e55fa,
+       0x5dfa909c, 0xca18f4d4, 0x020da2cb, 0x4ad3345e, 0x1b335fed, 0xe3a667d7,
+       0xefa3aeb6, 0xbc317ad3, 0x886ee30f, 0x27ce11b9, 0xf13ae92b, 0x78d509fd,
+       0xdf445d2e, 0x75a4cda3, 0xde389dc3, 0x810275a2, 0x264b03ef, 0x01323f24,
+       0x3b27dbc6, 0xaed0fda1, 0xdd611b5f, 0xfaf9d1b7, 0x8817f1d3, 0x3fa0d36d,
+       0xc760a5f9, 0x46ea87fb, 0x0baddc60, 0x542f0c36, 0xe63ac70d, 0x0c103b13,
+       0x651f3a92, 0x4efb0447, 0x755968b8, 0xcdabec0d, 0x406c9f1b, 0x046b3aba,
+       0xc28c7e3d, 0x3c874ddb, 0x2e79646a, 0xc6a3decd, 0xfd1c9536, 0xdf152228,
+       0x1b31a3bf, 0x921626f3, 0x709bcc7c, 0xa47b3357, 0x0f84657d, 0xb2ed6ae2,
+       0x6f3c087d, 0xe7c2695e, 0xfd312f9d, 0x0db839d3, 0xd627dbe3, 0x5fbe04c9,
+       0xf52eb15c, 0x89e3c069, 0x9bd232cd, 0x1bcb2cf8, 0xc5897e28, 0xb1d79ac9,
+       0x352c4f71, 0xa0b57bb2, 0x5f8bd69d, 0xb40af254, 0x51c8ac72, 0x2f4a728a,
+       0x6b72f497, 0x46d593d1, 0xf21ed920, 0x9474e96a, 0xef54a557, 0x90f5a100,
+       0x306a8357, 0x5797aa6e, 0xc8a2c495, 0x5f8874a9, 0xbe0f9616, 0xf1d02d6d,
+       0x8183ecad, 0x5f6bff56, 0xb77a053e, 0x49e04acc, 0x5a7f6485, 0x80417460,
+       0x6d35e65f, 0xa0f812f9, 0xde045e64, 0xf01c75c7, 0x26b37c00, 0x8bafcf0e,
+       0x6f08857c, 0x78b72f25, 0x95ce96ad, 0xb75ce3f8, 0xfd6a5c48, 0x5c451255,
+       0xee877eaa, 0xe74af4a3, 0xf051bdb9, 0x743ca881, 0xbbdefb5f, 0xc76eb033,
+       0xf6e32d75, 0xd22b1ac1, 0x9f9fa1f3, 0x7af4095d, 0x0102bddb, 0xdd789d7b,
+       0x2b0fa035, 0x880e0ad6, 0xcbdf170f, 0xefa62fde, 0xfd0fbac3, 0xa515d19a,
+       0x7fd0076f, 0xf6c7bac5, 0x820dff62, 0xb43fc603, 0x89ed10be, 0xb048af12,
+       0xfa3b437d, 0x614f540f, 0x57b3599e, 0xaffa004c, 0x0764dfb8, 0x23a14953,
+       0xf9db2e85, 0xecc4087d, 0xbe8b331c, 0x15160ab7, 0xc51e93df, 0x4fa82102,
+       0xbd2a4e81, 0x5fdace8c, 0x36409d92, 0xf64ba717, 0xae09fc1d, 0xe767c55f,
+       0x74ef874c, 0x047ea98a, 0x975e6d3a, 0xe23b046b, 0xfcc04f84, 0x49749e8a,
+       0x4a3b6a2c, 0x0567cba1, 0xd07baf26, 0x7b0e8ea3, 0x4ba71dd0, 0x5128fe85,
+       0xb6595fa3, 0xfdf0264f, 0xdd1e9ebd, 0x908dfd72, 0x32f851ff, 0x6f5d0fdd,
+       0xd1cfcd6e, 0x48e0575e, 0x2f5009eb, 0x8fde5892, 0x12e50fc2, 0xdefb0fcb,
+       0xbfcdd3eb, 0x87e78229, 0x2c883f01, 0xe74fc97f, 0x0bf37b7d, 0x66792f98,
+       0x6875fb53, 0xe941bcdf, 0xd9bfe000, 0x7fe8fc4a, 0x950e50f8, 0x6f988836,
+       0xe67f244d, 0xaedf952c, 0xfe2cbfe4, 0x5de11583, 0xcbe4d5ba, 0x6e97efa3,
+       0xf3063a3f, 0x30079611, 0x49bbc7bf, 0xde1fe760, 0xfdf031b6, 0xf2c4a950,
+       0xc176f470, 0xe71648f0, 0xaa2d78ea, 0xa136ec00, 0x57b3dd8e, 0x6c937f5a,
+       0x0775c552, 0x2f38ca45, 0x63e787ed, 0xb8678a5e, 0xa7d6011f, 0xc94ddfbe,
+       0x9178e9bf, 0xa3695fd1, 0x695cf68c, 0xc84e96dd, 0x6c3d2cc3, 0xb2b73f42,
+       0xfc11acee, 0xbc3fdcd8, 0x55f3f784, 0x3c9a8a36, 0x6ff91ebc, 0x04dfa275,
+       0xe50d5bf9, 0xeb437e78, 0x0faf58ed, 0xb17a079f, 0x7fc5ad3c, 0x4bddb1d8,
+       0x95f8b841, 0xbef0d9df, 0x368dd6be, 0xeea9eefc, 0x3da7f9c2, 0x57eaddf2,
+       0xeddf305f, 0x0941fc34, 0x5d48baeb, 0x931d60be, 0x997d746b, 0xc4e261f9,
+       0xa5eb7b41, 0x7c839f2f, 0x7fad8eec, 0x5bd60e7b, 0x9ee75ff6, 0xb21abc83,
+       0xf60ec233, 0x0fa6e548, 0x79559f30, 0xd99224af, 0xfe2f9d7f, 0x3b80f30e,
+       0x6139343f, 0x271dceb4, 0xd1bd8086, 0x04dbe5b9, 0xba5defc8, 0x73c61a63,
+       0x4dcb6e96, 0x05e26124, 0xeb74094a, 0xb21e43eb, 0x0dcd5f1e, 0x73ff98cd,
+       0xe41be286, 0xb17f3043, 0x83e59cbe, 0xe2de783a, 0xdef9f0e6, 0x1b14f23d,
+       0x193f5d66, 0xb30362e4, 0xaf9a2e0b, 0xf1e28078, 0x6fe03ef2, 0x4f2e6af3,
+       0x0cefe3c2, 0x54f141fc, 0x57cda913, 0xe161b2fc, 0xb6819e6f, 0xf35eb886,
+       0x807dfd15, 0x3e4f929b, 0x58f5d22b, 0xd6cdf024, 0x287e63df, 0x01cf2de0,
+       0x21cbf9f2, 0x293e1710, 0x10fe3007, 0xefc261d8, 0x1c774b2c, 0xdce9fe42,
+       0xb5f31fb6, 0xeeebcf09, 0xcb1fc124, 0x9eb1e5c3, 0x96560dca, 0x0fe1c8e7,
+       0x1b0e9079, 0x8ef9e73e, 0x3c958e8c, 0x1ff2dec8, 0xf853225b, 0x4f2c2a7d,
+       0xc7c37cb3, 0x8430af3c, 0xe002612f, 0x7982fda9, 0xec1c0aa5, 0xd42b8700,
+       0xf3e1bcf9, 0xdf79834c, 0x3f805f1c, 0x7cc1d390, 0x041f5a5d, 0xe13e9bf9,
+       0x0f230910, 0x3cb3d73a, 0xfc394ee0, 0x7e4accf7, 0x4f9eb36f, 0xebcb7d7d,
+       0xbffad8bd, 0x221a7c2f, 0x1eae381d, 0xc3e71d4e, 0x9ce3f1cb, 0xf7f07fef,
+       0xfe826521, 0x81cf93fb, 0xda1bcb1e, 0x899f788d, 0xfdf13fe2, 0x5a78f076,
+       0xf31126c7, 0x9bea6b3e, 0xe5eb8e51, 0x273f0545, 0x1bf7afd1, 0x468adebe,
+       0xb63a27a6, 0x3a167d5a, 0xaf5bc74e, 0x6c573d21, 0xd3bcc76e, 0x18af75bd,
+       0xcbe754db, 0xaa7c27a0, 0xbcbc77f5, 0x6dca0c6b, 0x7e98bf7e, 0x9b14631e,
+       0xfc29b2a7, 0xcf9b953c, 0xec59e66a, 0x2dda37ad, 0xb4ef9f17, 0xc609bae4,
+       0xeccadd3b, 0xe2f5d3a5, 0xf9985f0c, 0x49bd714f, 0x0f3b2d48, 0xef12faa5,
+       0x7bb2b359, 0x245b44d5, 0xad4b5fda, 0xf7470e13, 0x7988d283, 0x79aa2b2f,
+       0xce7dcc9e, 0x0af7c024, 0xd604d5eb, 0xabe012bb, 0xbb65e3f2, 0x26dd809b,
+       0xa867e527, 0xf59459cf, 0x8819fb1b, 0xa5ff854f, 0xe08919d6, 0x3bc9127f,
+       0x5d71d608, 0xe812d7ca, 0x8b0f56bf, 0x47f393df, 0x56f3c187, 0x8e27bec9,
+       0x553adb8e, 0xb5e84270, 0x34fbdd27, 0x2e998671, 0xf8b17ded, 0x5fdd1c0d,
+       0xf680d3b7, 0xb7e0d5a0, 0x1ac42ed3, 0x0e849ad1, 0xa43883ac, 0x0214fc04,
+       0xf41e21f3, 0xfdc16798, 0xcd4236c8, 0x94e7e853, 0x449ff734, 0xf774904f,
+       0xc30390a1, 0x385abd28, 0x39712abd, 0x8e9bfb2b, 0xacf786db, 0x6a91a4c4,
+       0x5635df20, 0x4f0dda37, 0xe869fbf0, 0x41e4246f, 0xa74892c4, 0x3a26fefa,
+       0x38fbe6af, 0x1ea6af3a, 0xe3d6d2e3, 0xc2c74866, 0xbe3897e9, 0x05a2e98e,
+       0xcd3310e1, 0x796bf8a0, 0xeb4213c3, 0x4e27898e, 0x6b5fb43f, 0x2801efc1,
+       0xfbd5797b, 0xebb458b0, 0xc8d3eba6, 0x36b4e889, 0x53ad81af, 0x1c4edcf3,
+       0xa5dfee02, 0xabd74e7d, 0x714617a9, 0x09112779, 0xdcc59de4, 0xbbfc384a,
+       0x5fbef035, 0x013837da, 0x5fb843f0, 0xcf9025ed, 0x41f7cd12, 0xb7f4d7e7,
+       0xcd807443, 0x0c871daf, 0x43bfabb2, 0xbfeb9cbd, 0x25fc9651, 0x329e9451,
+       0x62615687, 0x49125676, 0x9ba5efc3, 0x4a7ca1fa, 0x79839659, 0xa32d4227,
+       0x086b61ab, 0x00b0cdf2, 0x3fba9bcf, 0x9351ed12, 0xd2237899, 0xe2367be1,
+       0x1661d395, 0x7043cf1f, 0xa1d0372c, 0xd69455a4, 0x814d7be8, 0x8a42c31c,
+       0xa2687a84, 0xb94657e3, 0x9f28a3aa, 0x2774ccd6, 0xf6c2c619, 0x3bb95ede,
+       0x52f6b90b, 0xaa1a0888, 0x1969eef7, 0xef04228c, 0xbdde20f1, 0x6bc6807b,
+       0xec153a95, 0x6d7f9df0, 0x32eeb064, 0x9b5f7953, 0x3e8feac2, 0xdc2577b4,
+       0xcf6e9337, 0x49f6147f, 0x7851f6cc, 0xd58fe5de, 0x9bddf3dc, 0x39d6517e,
+       0x173f8372, 0x3abe05ee, 0x1df5eec0, 0x777e0d6e, 0xa3787a8f, 0xd1fba945,
+       0xd86fc88f, 0xbcad728f, 0x1bb63f7e, 0xa1cb4ea0, 0x81dcfe71, 0x472f9f74,
+       0x74969a1d, 0xa1af1d29, 0xd93e0930, 0xd0ea357f, 0x30eef81e, 0x578f8704,
+       0x82141eee, 0xc3fcb483, 0xd5932d3d, 0x0f70f870, 0x857d21d8, 0x7d0fabc3,
+       0xebe87088, 0x6c5d29be, 0x935cbc07, 0xd6fbc06d, 0xc16c38ae, 0x45fd0af8,
+       0xe3e23ea0, 0xbbe5efac, 0xa11fc56c, 0xd354ece3, 0x429ef297, 0x4dd1bd57,
+       0x628fb12a, 0xe96a6cf7, 0xf5ca2ba7, 0x25abac36, 0x358f75ca, 0xf78ff71e,
+       0x76e35c00, 0x0b8ea73b, 0xb8b135d1, 0xeefdc1c7, 0x5bf32ca3, 0xf2f254a3,
+       0x6225ec9a, 0x81c9c40a, 0xfb43e217, 0x8de65f89, 0x19f74118, 0xde6032ef,
+       0xfb8b28fc, 0x2b63cc20, 0x7721f808, 0x1ee20aec, 0xbe218827, 0xd9abe650,
+       0x9af5fcc1, 0x396f8342, 0x6015ef3b, 0xb47d10bc, 0xc023e8e9, 0x1db1a3e8,
+       0xa9a2a3e9, 0x6347d19d, 0x06644e75, 0x3f03373b, 0xc60496bf, 0xa23bde02,
+       0x51269abe, 0x151a1ffa, 0x91ba01a8, 0xe5a6e7bd, 0x3d708a5d, 0x7c3f161d,
+       0x7abeca7d, 0x4b6d6fc3, 0xe06943ca, 0xe033ee4f, 0x37029779, 0x858c5fa5,
+       0x58b6c5e5, 0xfc035fdd, 0xedb4272a, 0x6d6fed85, 0x36f31f79, 0xd86efb6c,
+       0x66dbef05, 0x42390c53, 0x5beed6f3, 0xd767f78e, 0xd87dd806, 0x05e024d1,
+       0x3c3bdebd, 0xe104ff18, 0x1a4f7601, 0xf91da3c0, 0x5eff1365, 0x7051ab2c,
+       0x1a1f9e81, 0x890deec5, 0xebf3b0b4, 0xd7111621, 0xcec2c439, 0xbdf7e259,
+       0x95bf8225, 0xfb01bf75, 0xa69943c7, 0xbcfdffde, 0xaf89a4bf, 0xe854f82b,
+       0x28d24a89, 0x4ce47fb8, 0xa2d13b8c, 0xa8d89fa1, 0xca78d514, 0x88788f7b,
+       0x47aa0ef3, 0xff3dd8af, 0x94abd02e, 0xfc00be7e, 0x968dfb04, 0x4a6e0023,
+       0x70cfa07f, 0x0defa1f8, 0x1e60f987, 0xecb617b0, 0x3de2225e, 0x6bc47d1a,
+       0x491bdc26, 0x914667fb, 0xfdf4adaa, 0x425a68cc, 0x13d78e3d, 0x2b207d79,
+       0x1a713f53, 0x3d7cfa04, 0xb64ebb8f, 0xc931fcf0, 0xd186ea3e, 0x5c766750,
+       0xea245256, 0xe16f8505, 0xb738080e, 0x75f9f896, 0x00c5204a, 0x58f85378,
+       0x56fc180a, 0x2452b4aa, 0x18f20187, 0x7dd0f1de, 0x9dcbbd4b, 0xdf652fab,
+       0xcf9fea71, 0xc1f9ebe4, 0x3d17f5f6, 0x099eefbe, 0xb7372df0, 0xad03723d,
+       0x0e7a5c57, 0x479707cf, 0xa1795c55, 0xebf42f7b, 0xdbfce77f, 0x4d874051,
+       0x7ec298df, 0xe1c3550f, 0xc029e2d6, 0xbdf932f7, 0xc951242e, 0xb1e55633,
+       0xcbb71b42, 0xf8299510, 0xffaced1c, 0xf8081140, 0xf0b14af4, 0x9e32547e,
+       0xe5d14e1f, 0x9f87fead, 0xc132f9c5, 0x71250030, 0xcf3628c9, 0x324ecc37,
+       0x9ce0ffd3, 0x173f1a69, 0xaf72477b, 0xdef1d2b0, 0x357cec21, 0x19aaae33,
+       0xc6c4c4ea, 0xfbda26cf, 0x6b13320a, 0xb8c2c6a7, 0xdf18c9d1, 0xdaeb35ca,
+       0xc812bd53, 0x8c9a9269, 0x88d38979, 0x7a633eca, 0x08eeed03, 0xe3902eba,
+       0x742c8cd7, 0xe7ede54e, 0x4d43ffe8, 0x2a99f6e4, 0xc72ae37f, 0x8d54e75c,
+       0xf78b52fd, 0x9fe9fd01, 0xf2e1ede2, 0xfce33e2c, 0x77c9e2df, 0x1eb3f9c2,
+       0xe10e399e, 0x27a3ab7e, 0xd470f5dc, 0xab815dc3, 0x9fd98e1e, 0x86c6a738,
+       0x2e1e9381, 0x48ed48d3, 0xdc0a63d0, 0xc77970f5, 0x9de2e8cc, 0xabde1334,
+       0xe0c48ef8, 0x23350ef8, 0x9ba41ea1, 0x01ef1168, 0xf5e28cce, 0xbab04737,
+       0x64a8ef82, 0xae1eb7c4, 0xc666387a, 0x58e3f7f1, 0x2f00bdff, 0xe202e509,
+       0xcc9ba147, 0x31ddaad4, 0xec507a2a, 0x2e1c69eb, 0xfb46bed4, 0x8ade3739,
+       0xafb02671, 0xe08425a7, 0xd6ce5b96, 0xf2dc3b95, 0xf4a9f83c, 0x72bfbc75,
+       0xff3fe10a, 0xca2f3c14, 0xce0555e4, 0xdad1be53, 0xa69ad3c9, 0xc338829f,
+       0x7efb9350, 0x1080cfa0, 0x1475e783, 0x707447ee, 0xd767bed7, 0xf870f5d6,
+       0xb131fc03, 0x3a14bc27, 0xe3c2c0fb, 0x20c8034e, 0xbcc797b0, 0xf20d1196,
+       0x86c5349b, 0x715c4b8d, 0x0e383f38, 0x63a457a7, 0xcf83b881, 0x423fa9ed,
+       0x5aa3ed8e, 0x36c72552, 0x96d3ee8b, 0x4c729ef8, 0x8e64d3c1, 0xbbc4c987,
+       0x934be20b, 0xd045f489, 0xed0e481f, 0xe7d95bbf, 0xf6103240, 0xc1c58379,
+       0x67df3fe4, 0xbcd4df70, 0xf8b3f984, 0x0b6659fc, 0x02435f7e, 0xce104752,
+       0x91df7829, 0x5a1b18d7, 0x4fbf9287, 0x66115486, 0x7bc3cdcf, 0xc85c29ae,
+       0x75a15177, 0x8482ac98, 0x75f0fdf7, 0x7b33a99c, 0x5bad8f21, 0x9d814774,
+       0x1bec21d7, 0xfc93fb83, 0xe9ff4023, 0xee35cfdb, 0xda7680ae, 0xf1fb08af,
+       0x59162ff5, 0xc3b021fc, 0xb93e7be4, 0xb2953b77, 0x8509ea35, 0xfbe0b37e,
+       0xde81cbd4, 0xdd6103fd, 0xd1d54053, 0xf659e772, 0x6376431d, 0xecf304ba,
+       0xff7966e9, 0x8125c439, 0xdfa7ab7d, 0xa1a74bef, 0x08604578, 0x5d8a29f8,
+       0x1eead536, 0x57cfa569, 0x9b66eff3, 0x05188ece, 0xf4c1f978, 0x4f4b4074,
+       0xba511d0a, 0xecf00f1a, 0x69fcf8ca, 0xcddfc730, 0x7a009738, 0x43dfb151,
+       0x026b8a76, 0x3b37a7ac, 0x3dd5897e, 0x3b017ac5, 0x2e67b15e, 0xdd9087e6,
+       0x74a641d4, 0xcbc71b74, 0xccab733c, 0x600fcdee, 0x48eafdfe, 0x473b5ee5,
+       0xb791d824, 0x54d94ead, 0xd586e707, 0x6b7efe2c, 0x83f1ac95, 0x86dd90dd,
+       0x66fbb3ef, 0x6da65f6f, 0xfe604cff, 0xfb57a17e, 0x3412589c, 0x9cf6edf7,
+       0xc035e0d7, 0x3123c3bc, 0xaf3f413f, 0x79fa7f7e, 0xe6adf3f5, 0x636ad57e,
+       0xcaa748ed, 0x6560592e, 0xaaf750f6, 0xcae0ebc7, 0xe7e0deba, 0x93480f36,
+       0xb5abf754, 0x082c8ead, 0x328c6f77, 0x79ef029e, 0x00e2cfc4, 0xc3dff255,
+       0xe59b83dd, 0xde81f166, 0x98161de6, 0xe1a0768a, 0xf608bf49, 0x4100b0fc,
+       0xe02b3bfb, 0xf8d02c32, 0xee4fcc01, 0xbdc007e1, 0xd65eb426, 0x01f98bb0,
+       0x4fe8d5f5, 0x027f5194, 0x387accf4, 0x17c01e9b, 0x41fe8694, 0xfc85dfd0,
+       0xcfb82ca9, 0x12c3fb92, 0x5ad497a5, 0xf5a37fd6, 0x096ae35d, 0x927755fc,
+       0xe363294c, 0x98d7efc3, 0x93555fa9, 0xf508224c, 0xf8785eab, 0xc06be9fd,
+       0x09758e5f, 0xad287f70, 0xf7fa58d7, 0xf8debfdd, 0xb81afef0, 0x65fa946f,
+       0x7f2aaceb, 0x78fe37b7, 0x0b918c04, 0x3dba47f0, 0xa1f0237f, 0x8a68af12,
+       0x111f7ce0, 0x8068bba4, 0x57274297, 0x7e8f9b2f, 0xe725c445, 0x589e4087,
+       0x16ffc716, 0x46c38f2b, 0x129ff7b1, 0xbf905bdd, 0x023f3adf, 0x8cefcbe2,
+       0x5cfe8a3c, 0xe7c59593, 0xd04a79f7, 0xb9f0527e, 0x3f702acb, 0xf8103fc9,
+       0xcdf1daed, 0x6497e071, 0x43de02c9, 0x9efb24da, 0x7900cf4c, 0x82bedb34,
+       0xa26b296e, 0x6b13bf11, 0xbc0ff08a, 0x35a7655b, 0x9b4cfbf1, 0xa81deece,
+       0x661e63ce, 0x4565ddcd, 0x308bf3fa, 0xeec6567e, 0x7befa0c3, 0xfd212fd3,
+       0x7f4012e1, 0x13fbf390, 0x61a8fcf0, 0x42e20d8f, 0x827efc1d, 0x09cd0d33,
+       0xbe5969f3, 0xf0362fe5, 0x70e7ded7, 0xe2b52338, 0xdb654a3d, 0x83ffbc44,
+       0x0b709bce, 0x161ba7c4, 0xf7efb264, 0x8a6777d8, 0x67ff4cfe, 0x167cc0f3,
+       0xc8efc434, 0xb2727b14, 0xf583ebd9, 0x188b5535, 0xbbac9e2f, 0xbf0a6c37,
+       0x5f6f4c37, 0x712ab49e, 0x87cc04e9, 0xf3676a5a, 0x594fc6f4, 0x9f12c4df,
+       0x24b2df8a, 0xcfeb08bf, 0xc08126fa, 0x5a679715, 0x03c89e52, 0xcec89e3f,
+       0x44ac30e1, 0xcafda376, 0x6fe89fcf, 0xbe43dc37, 0x6cde5793, 0x4aeb3738,
+       0xfdfb6624, 0x77600997, 0xe0b1fbb9, 0x8a07d322, 0x1be5377d, 0x6f557c6d,
+       0x8d34e6e7, 0x41207fbd, 0xa77fb378, 0x55eec022, 0x06ff61eb, 0x7bb587a6,
+       0xe10c7909, 0xf52dbe90, 0x2947b81a, 0x3b068ffd, 0x7c02dbcc, 0x3cf80f11,
+       0x54fcf787, 0xd08dff10, 0xda20d15e, 0x927eb0fd, 0x95f01971, 0x70283762,
+       0x6cdf3c69, 0x91d7431e, 0x5f60d675, 0x3378874e, 0xcffa05f0, 0x2fbcfee3,
+       0x5357f40e, 0x8273c240, 0xa3bbb3ac, 0x60e4a816, 0x3e0379d3, 0x5bfcf37f,
+       0xd881e7da, 0x2dbde0cb, 0xef17e606, 0x28f7fbde, 0x9e6f4b90, 0x82f1c6ef,
+       0xbb4f4376, 0x6b91e118, 0x67718315, 0xc44c5db5, 0xb79003ac, 0xaa9a2d35,
+       0xbb77a131, 0x7213fb37, 0xb4f495bf, 0x1ec0721f, 0x11d8c311, 0x3e74ce1c,
+       0x6f48f809, 0xe36e5c57, 0x24c1e6f1, 0x6ca3ee1d, 0x18b71f3c, 0x8a6e1fbf,
+       0x7d472fb2, 0xaea5eccc, 0xbf1fa7dd, 0x13ef9e06, 0xe711fdd9, 0xb7a7e445,
+       0xda1e2e76, 0x2a5be2a6, 0x5f4f1139, 0xf9db3ff5, 0xd5ffed06, 0x4716489e,
+       0xa9979c97, 0xf50877bf, 0xf97871f7, 0x38f3b007, 0xd7b800ef, 0x2fdb07e9,
+       0xfafc3d1d, 0xc3da1b3c, 0x1ea0e981, 0x376bac46, 0xac5bfe02, 0x90d9d7f9,
+       0x00a3eadf, 0x33925e2e, 0xf3804c90, 0x7403927a, 0x7626a815, 0xb5b627f0,
+       0x97800c18, 0x98c98d8c, 0x9f89b3a7, 0xafaa2e57, 0xe8ab2635, 0xef3f1162,
+       0x877b293a, 0x1f9eaac4, 0x72f931b0, 0x6fe94f72, 0x43e34f30, 0xc61e1913,
+       0x31b06cde, 0xd18afb7d, 0xe866cd7b, 0xdf80c477, 0xfbdeed0d, 0xcfb85efa,
+       0xc761d178, 0x3dff8858, 0xbf607362, 0x6a9b7dc6, 0xf1b7cf20, 0x5452d013,
+       0x14286caf, 0x37de740d, 0xefc58388, 0x1fd0180e, 0x893dc60f, 0xf9f60e2b,
+       0x1bcf5f10, 0xf9cd062d, 0xdefc1bd8, 0x326d7bdd, 0x89b12fb6, 0x2dadc788,
+       0x37a07139, 0xbbeeac5a, 0x8e2fa06d, 0x12c0d5b5, 0x629f7894, 0xb03c4daf,
+       0xf4d19af5, 0x061d89cf, 0x71dba03b, 0xf61179e0, 0x484938eb, 0xd87a408c,
+       0x8f3c746f, 0x3a37bc7a, 0x1d7478d8, 0x2abf016f, 0xff9aa7f0, 0x7f5a34a1,
+       0x858a55a3, 0xfe052efc, 0xf9943eca, 0xb5c4f51d, 0xe4ac82de, 0xb8817ada,
+       0x3a5f92b3, 0x7f944ece, 0xd2e9012f, 0x6a3d7368, 0xda0ef663, 0x30f727d7,
+       0xae15e8bb, 0xe1524947, 0x829f8050, 0x8b1b7aa7, 0xe9eb2a33, 0xdbdffe6d,
+       0xca549e98, 0x9bd74bef, 0xe9178764, 0x0fcb1b66, 0xe6fd7877, 0x6b23c854,
+       0xcf7fc54c, 0xfb679549, 0x93e7a47b, 0x1b057bda, 0xf8060cdb, 0x8762ac0e,
+       0x6de68310, 0x20ebed1f, 0x48f5499d, 0x09878d7f, 0xdd6971f2, 0x48ee2c9d,
+       0x7fbf0de5, 0x81d1cf0d, 0x7a79f87f, 0x1396817f, 0x18afd69b, 0xdbf5f088,
+       0x7042af80, 0x65037ca2, 0xe811ad55, 0x5652d175, 0xe973f316, 0xc8dd6b45,
+       0x58eb459f, 0x5b1ee17e, 0x0ce7ae32, 0x886257a7, 0x27f9001c, 0x657f0e2e,
+       0x6e9c79dd, 0xd13c354f, 0xfa52f30c, 0x73e013fa, 0x4f63e352, 0x7a1572c3,
+       0xc641b53d, 0xb5224a71, 0x7cadf6e7, 0x18076dbc, 0x20dc4fbd, 0x5ffdc0e7,
+       0x0ec4bd13, 0x3637ec71, 0x7e41146c, 0x9cf401bf, 0xf41cf8cc, 0x0f3dc9ed,
+       0xf402fd46, 0x4081bb5c, 0x2315fcbc, 0xe2a2d929, 0x5febdd8b, 0x696ff0d5,
+       0x1835f55d, 0x158b6f97, 0x7c2bce40, 0x15fdc0ab, 0xe42af3a3, 0xfc74ebff,
+       0x2fbd953f, 0xdfb03b47, 0x9fff9c13, 0x9ff94198, 0x10d98a3e, 0xaf38c023,
+       0x07dfc318, 0xa40ff5f7, 0x6d5ca0bf, 0xbf5721eb, 0xcdb57266, 0xafe74a96,
+       0xe31bb6b8, 0x71f5c10c, 0xaa6279ba, 0x02c93742, 0x6296bfc0, 0x8bc01870,
+       0x99e815c2, 0xdfb7cdda, 0xd95c8690, 0x0f39e122, 0xf9e2473f, 0x0277ca1f,
+       0xe486bf0a, 0x6eb7c299, 0xd5d83473, 0x8056ab53, 0xe7971f5d, 0x253cfa45,
+       0x52c687b8, 0xf80a767d, 0x383c8c38, 0x57c7e5c1, 0xf762fbb2, 0x7a000fee,
+       0x221ea12e, 0x13ac87ec, 0xa51780ec, 0xdd8eb1dd, 0x5a3c3ac3, 0x2bbf9cd0,
+       0xef0c1ff5, 0x41fb8f40, 0x7c634787, 0x3c84603a, 0xa63e11d5, 0x839088c7,
+       0x570c40fc, 0x5b3e000f, 0xcdd7f544, 0x4a75fd2a, 0x553a45ae, 0x347970e0,
+       0xc55f5f93, 0x95ff7db0, 0xe21585d3, 0x2f73aa85, 0x024890ea, 0x605167e3,
+       0xf8c22e7c, 0xba4cf6a7, 0xdafde90a, 0x076ef4f0, 0xfe162aff, 0x48f5a73d,
+       0xec33319f, 0x13cb1df8, 0x46223392, 0xb0f91f63, 0x57f1bddc, 0xfd01d7e8,
+       0x46f7bf02, 0xff4025ff, 0xfbdd0c24, 0xf0abdd28, 0xa501d0a7, 0x55a26b8b,
+       0x174f41f2, 0x02a379ca, 0xe7745797, 0x33474f95, 0x9780b079, 0x66f25e8e,
+       0x60fcfd94, 0x81ec9f3c, 0xcf0cf9e7, 0x7c02be21, 0x67e1f22b, 0x3dafe117,
+       0xaf6c76d1, 0xe60174f9, 0x73f2d4a9, 0x9f3e7aab, 0xd1a5eeb2, 0x4b7ce682,
+       0xca34ee7f, 0x5a2bbee2, 0x48ea3e77, 0x34c7d10b, 0xd92ecf6e, 0xff73c268,
+       0x7802d02d, 0xbdfecddb, 0xbb3de56c, 0x0a4f0d44, 0x4cd115ea, 0xe1f42b8e,
+       0xc3246658, 0x55f2ffa8, 0xc86ee172, 0xab59f9ff, 0xdd346f37, 0x77a316c7,
+       0x07e8b5f6, 0xf182af38, 0xd833caaf, 0xc6241f21, 0xde201765, 0x7c0a2481,
+       0x33cd8fb8, 0x1979d52e, 0xe70ec9fa, 0x0f079038, 0xf8297c73, 0x9bd0e055,
+       0xaf0deb9e, 0xe27c387b, 0x8e5ebb79, 0x9efe7314, 0x5c5dfbc2, 0xe045788e,
+       0x2f711b27, 0x59fd6117, 0xe505fe4c, 0x73c11648, 0x727597c9, 0x5e9fe5e4,
+       0x91acbc8e, 0xc2da1323, 0x0bfa11ca, 0x1bf1ffcb, 0x4b1da216, 0x63b7870e,
+       0x3d334677, 0x93fa0f1c, 0xb2f78bf6, 0x3987def3, 0xc48a52dd, 0x0ddac9bc,
+       0x5713cc26, 0x366d90e4, 0xaf7f81c9, 0x16fa06d9, 0x1f76cd7a, 0xc5e70c9e,
+       0x9c074649, 0x03929f5f, 0xd453f788, 0xfa45af01, 0xc7fbc7c8, 0x0223c8c3,
+       0x47ef12f1, 0x9cefd083, 0x9f213626, 0x5046992c, 0x78deee7f, 0x4955d205,
+       0x74008a5e, 0x23175a5b, 0x54ec7b40, 0x94e401bb, 0x962b8fb2, 0x71b0c819,
+       0xd40707c8, 0x6f0ae472, 0xcdbbfe15, 0x49dce343, 0x47210c72, 0x33fb3d1f,
+       0x8da8bc75, 0x22f1d5d6, 0xfbe07f5a, 0x468e8bc4, 0x78801e07, 0xae6c3fd1,
+       0x94779876, 0xea28ff25, 0x912ac4b7, 0xc5d6e4a8, 0x4a1fb7ec, 0x2e3c952f,
+       0x34a95a45, 0x81c4d04e, 0x6073ab6f, 0x582bf81c, 0xe380c54f, 0x7870c34f,
+       0x7b5846af, 0x1fa3ad9b, 0x13e40b97, 0x97e8f882, 0xfc42255f, 0x063b9145,
+       0x2fe2ac7b, 0xa197900b, 0x037fdbf0, 0xd7b57d1c, 0x00008000, 0x00088b1f,
+       0x00000000, 0x7dcdff00, 0xd5947809, 0xe77df0d5, 0x24cb2d9d, 0x7642c993,
+       0x03bbec26, 0x4eb1ab09, 0x04906008, 0x8d441007, 0xb0900938, 0xd2910364,
+       0x208196d6, 0x2b188a06, 0x0eb154b5, 0x4551fa14, 0xdb1ab61b, 0x1a4013a0,
+       0xad563414, 0x61a5afd8, 0x80891d91, 0xe58ad3fd, 0x7bdce73b, 0x264ef333,
+       0xe79f6a02, 0xcdcf0f0f, 0xcf7bde5d, 0x773dfb3d, 0x79632d49, 0x9b19223b,
+       0xed50b390, 0xccc9a906, 0x831b163c, 0x43632f1f, 0x087a3e79, 0x6b9859e6,
+       0xf26b6320, 0x01de7975, 0x9fc75d8c, 0xa269fd3b, 0x678e3e15, 0x30d6fe6c,
+       0xb53349eb, 0x7fe1d767, 0x268c5d79, 0x649f595f, 0x9fc7d93d, 0x24bf8f9f,
+       0x4c33ffc1, 0x2b1812cf, 0xe1a7e263, 0x70ffdfcb, 0xdfc7b418, 0x54dec655,
+       0x805689dd, 0x12dcdca7, 0xd8ceddd5, 0x13c7f933, 0x52d491dc, 0x223ddf87,
+       0xb97178c6, 0x71debde3, 0x55de798c, 0x0fc816d9, 0x4a3d1936, 0x64e2fc34,
+       0xe8826b76, 0x06947e0f, 0x041967c5, 0x55437ff9, 0xfe97632c, 0xc5f4a3ad,
+       0x32f2b89f, 0x7a8afbe0, 0xb439639d, 0x185068ab, 0xd1cc62cb, 0x19cd7995,
+       0x4785d58c, 0x5fd0620d, 0xa748bece, 0x292fca01, 0x8329af66, 0x870800d1,
+       0xa23fc241, 0xd41b7d35, 0xd8983757, 0xca5ec86a, 0xe119ac61, 0xd9a23bd5,
+       0x077e3f00, 0x0fa67e1d, 0x6bca00cc, 0x630b2e1d, 0xff78c29b, 0x7b64c29b,
+       0xb483347b, 0xecd192db, 0xd7a7c004, 0xf40d1633, 0x6983c481, 0x036e92f6,
+       0x1f3099f4, 0x8018f33d, 0x3eadd94e, 0xadd2f115, 0x9163aed5, 0xadf471fe,
+       0x4ddbe68c, 0x6039d76f, 0xf7813afc, 0x543b4d9d, 0xd873e03d, 0x156ada98,
+       0xf728d2d2, 0xa8f3c458, 0x2c6aaaec, 0xa8f7cd8f, 0xa59f686e, 0x00b3ed54,
+       0xe678d85e, 0xcce502d8, 0x848f8307, 0x18d616fa, 0x2398d905, 0x2828ce2d,
+       0xd9c6751f, 0x1de60038, 0xf60a62ed, 0x1a32d8c7, 0xcba45fbf, 0x38b2fd85,
+       0xfd0052a7, 0x2307fb0c, 0x767ec8bc, 0xec568d36, 0xf35c6f00, 0xc01ec518,
+       0xe24d305f, 0xfeccf5ab, 0x73d7ec53, 0xba40e748, 0x7398ebda, 0xfaefb423,
+       0x2c31bf72, 0xd2bedfca, 0xb778d0aa, 0x46b9ddbb, 0xd879f346, 0x9c8fdf0a,
+       0x0067ddee, 0xf1cf8678, 0x03da33ec, 0x519733e6, 0x1e2d297f, 0x11d2479a,
+       0x8ba60e77, 0xcfd4312d, 0xc6be33a8, 0x4baed001, 0xca07cc15, 0x543f9ad3,
+       0x5569af10, 0x71d20acd, 0x825ed367, 0x3f79b537, 0xea11814f, 0x7201dd20,
+       0x8f301755, 0xcd1d16c5, 0xa145b163, 0x99c5e574, 0x7fa82e89, 0x6c5eeac4,
+       0xc79fea19, 0x62771cca, 0xbebff415, 0x7cfb5ba9, 0xb7bc027b, 0x278867c1,
+       0xab72dfd9, 0xb269fa91, 0xf3847fb8, 0x72de9cab, 0x476f7900, 0x48a39fd3,
+       0x88e21a2e, 0x8e8709be, 0x96123d13, 0x78a0ce00, 0x0a85a1fd, 0x85f5aa83,
+       0x23a53340, 0xddb8279e, 0x8899318e, 0xf89f806f, 0x09311ac7, 0x8c62f2f8,
+       0x91c706bb, 0xd91427ed, 0xb45f5022, 0xcf77c5e7, 0x598e652e, 0xfbcf003d,
+       0x6eb2778b, 0x12f77748, 0xbb7b7ba4, 0x21878f81, 0xb38b313f, 0xa4bbfb16,
+       0xce38e9b0, 0xf942984b, 0x979e064b, 0x95abfaf8, 0xeb11ebe3, 0x7896c5a4,
+       0xf02b278e, 0xbc614bf1, 0x7a1eb05d, 0xb3bfcad7, 0xcd617e0b, 0x1e705f9c,
+       0xbb64bfa8, 0xdbdfa2dd, 0x3d5cee9d, 0x08cd93e7, 0xde11c8e7, 0xc3b7c87d,
+       0x90fb3cf3, 0xe098d3ff, 0x27ce3c93, 0xcfbefcc1, 0x467ea36a, 0x8865699d,
+       0xb9852cf7, 0xd32ee902, 0xa1ae10d7, 0x89a3dfc8, 0xb61e407f, 0x52c378e3,
+       0x800354aa, 0x13acc712, 0xdec67758, 0x5da9dab6, 0x3ee708e6, 0xd3ab37e4,
+       0x207cf245, 0x2be54ac2, 0xc07f3833, 0xfc407ff7, 0x2ed3cb05, 0x7e01a394,
+       0x7e438a39, 0x8fc8ec8c, 0xbcf013bf, 0x63a5e42d, 0x613feeff, 0x3acd71ff,
+       0x0c9d02a7, 0x65e9123f, 0xa2f874d0, 0x8fe1152a, 0x00ffc063, 0x358e6da0,
+       0xa52ce507, 0x5d20a1cc, 0x875c229b, 0x230fd4ad, 0x4732b9bd, 0xef86ade7,
+       0x893b46e6, 0x3ed8df7e, 0x366667ec, 0xc01f6fcc, 0xe115fc1e, 0xb6b07b03,
+       0x6ff4f508, 0x3d4469ff, 0xd7f2976a, 0x38a22434, 0x48ae3f80, 0xf7a7e0bd,
+       0x410bd271, 0x73d60ef4, 0xebf6f4c1, 0x039ead05, 0xf4e05d7c, 0x9f226770,
+       0x522f35c5, 0xead07eb9, 0xd1e8ceb5, 0x3a083f41, 0x7e708a5c, 0x0c5cf881,
+       0x7ae38832, 0x583eb346, 0x0e1d99de, 0x76a4898b, 0x1c3b45ff, 0xd1df1316,
+       0xadcceb0e, 0x47c01507, 0x576a8379, 0x8fd50a61, 0xff489cd9, 0x8714eb17,
+       0x41a4e509, 0x71787e25, 0x4bd93865, 0xbb67ef09, 0xdbb107a3, 0xcff21520,
+       0x8ec9dddc, 0xf188c656, 0xf18790ed, 0xd679592f, 0xc5277568, 0x1793e804,
+       0x4308be1b, 0x644ff73c, 0x62c64e03, 0x0ed6a70b, 0xf0290883, 0x537f09bd,
+       0x6b83af10, 0x69ac1454, 0x95269dee, 0xfb1dd6e8, 0xfe5ace1b, 0xbd700d9c,
+       0xceb46dbc, 0xf537c81d, 0x05ec6757, 0xb8232bf8, 0xf7b4be5d, 0x33e42f5a,
+       0x92f77f59, 0x3f7bd262, 0x13192b07, 0xeedf1fa0, 0x61eb8273, 0xd53d6856,
+       0x2a76871f, 0x850023d7, 0x7a3ee651, 0x70d427f4, 0x27f5aa87, 0x7baa3988,
+       0x7f107e02, 0xbf84e18d, 0x77209eea, 0x48e70419, 0xc5bf7fec, 0xfca092c8,
+       0xb623c80a, 0x037f7093, 0xe2074778, 0xaa6f0fd1, 0xe08454f5, 0x5f0fd50b,
+       0x0e905d3b, 0xd16abfd0, 0xb12e3cd3, 0xb3d20770, 0x4864e8ce, 0xe151cf7f,
+       0x55ba081f, 0xd4bb9e08, 0x1b88f430, 0x91e2f7e6, 0x7f7e0754, 0x984afea9,
+       0x46fd122e, 0x979c14f7, 0x851ad69a, 0xc35f70f6, 0x032dbe95, 0xc54dbf48,
+       0x4e872bf2, 0xbe03dcd8, 0x8466fcd1, 0x7e7687a6, 0x9ac8fa95, 0x6150ff40,
+       0x7cc17e7c, 0xfe3434a4, 0xf244194b, 0x7a1f50c7, 0x1ab799d2, 0xa072bde6,
+       0x997ba7e0, 0x983ee51d, 0xabab46de, 0x6e402622, 0xaaed15ff, 0x9c70b842,
+       0xcf342194, 0x741f9885, 0x41a66678, 0xc31bf387, 0x7f4a6ed0, 0xb0effd0f,
+       0x4eff7e21, 0xfe7dafce, 0x3a0daf3d, 0x3fbe68c4, 0xf80071c6, 0xaf803ae5,
+       0xeac18c12, 0xfb79c08c, 0x62e51e88, 0x48e6e57e, 0x61f30a9f, 0x5a170cbb,
+       0xd6e81ea4, 0x4fa07e11, 0x19e7c20d, 0x46e238ed, 0xd235fefa, 0xd1f88d51,
+       0x5fd15b37, 0xc6acf985, 0x28a2367a, 0x2fdfe711, 0xf505b9d2, 0x18cb4bfc,
+       0x57a5f3f1, 0x4c137798, 0x1d7efb76, 0xd646cbf1, 0x9fbef88f, 0x570cf2ee,
+       0x3af3c924, 0xb9ab3b84, 0xb77a8756, 0x43aed7a7, 0xb9b7da7d, 0x3e23a74e,
+       0x8622ff70, 0x5799e4fc, 0xff5f00f4, 0x37ea556d, 0x686f07e4, 0xaf40ef7e,
+       0x92f481cd, 0x7c16cb78, 0x43788d90, 0xbfaad083, 0xe3f662d0, 0x52c3e80d,
+       0x63fb1d6c, 0xf11d25ac, 0xe9faf8d4, 0x5fd02d5e, 0x67a71bc5, 0xfe2a5e20,
+       0x18262260, 0xd1be87f3, 0xe59fefc8, 0x2e67f684, 0xe872ad2c, 0x257a9fc1,
+       0x85d91ba6, 0x446cd632, 0x6ebca13f, 0xa01f4381, 0x76ffa5cf, 0x8f9cd0c8,
+       0xaa1a1ffd, 0xe78065b2, 0x5de18e2b, 0xd13b0858, 0xbfa12fee, 0x472fb006,
+       0xafcf11d8, 0xff734567, 0x20f646d1, 0xa5a1fdb8, 0x7a631c73, 0xa1dfde74,
+       0xbdd361c1, 0x907e7df0, 0x8634741f, 0x18b6b5db, 0x2141876e, 0x8bce113b,
+       0x3d78b7bf, 0xc8717450, 0xfd0c5147, 0x641f5dcc, 0x2e8f807a, 0xfe47e6b2,
+       0x35767288, 0xf971d692, 0x5cca3f83, 0xe5cbf166, 0xdcf8231d, 0x70ed78ef,
+       0xe7da1d94, 0xe717df6f, 0x1ddfc009, 0x9db57f4c, 0x5c7033af, 0x7d33e346,
+       0x07a42f4b, 0x04d9e3fb, 0xaff9a43b, 0xf9c715bf, 0x74874120, 0xdbf4245e,
+       0xc028b0ef, 0x525fcedf, 0xf3247c41, 0xe6666de5, 0xebc80d8d, 0x04b88d9b,
+       0x648b6f2e, 0x37b7685e, 0x7a4712c6, 0xa3259926, 0x5f14e99e, 0xe0cf8937,
+       0x43cf8972, 0xa3a6cf83, 0x2759f15f, 0x1b6f70fe, 0xf7ced76f, 0xd74fc14b,
+       0x7ceff3fb, 0x0aec3ea5, 0x8d845df1, 0x638ae9d3, 0xf7f41764, 0x1ebe8df2,
+       0xe4ed10d6, 0x4f1832fa, 0x8d2b5f6f, 0xdf7f7ec0, 0x050bca66, 0xfba6de97,
+       0x21ca7e76, 0x1fc02a80, 0x53baa6dc, 0x9c1fc26d, 0xbe8af90c, 0xbad1c657,
+       0xd08bf25a, 0x4f30777b, 0x306fca23, 0xf77a487f, 0xfadd01b0, 0x296672a3,
+       0x318bb748, 0x4237ce76, 0x047ca41e, 0x9d3831e3, 0x50ee6460, 0x62af80eb,
+       0x98c35e24, 0x23e1f407, 0xdf640d1b, 0xf8fb5f0f, 0xf7e04cde, 0xd60c1bd3,
+       0x9ce430e5, 0x3ea5f617, 0x0673f503, 0xe40aac9b, 0x3d7ddb4f, 0x5f4bee50,
+       0x0fc85d50, 0x923c37a7, 0xf3d21330, 0x0065bf20, 0x0346e947, 0xf8d9cf95,
+       0x159f9528, 0x42fa5d72, 0x97d47f7c, 0x4eaff787, 0xf9ce3a40, 0x486989ea,
+       0x6b46ed97, 0x9690c1ff, 0x631c536d, 0x6f3df002, 0xbf269873, 0xe0e6c75d,
+       0x995d243c, 0x47af6ee2, 0xa6d53f13, 0x1f7176fb, 0x04dfd69f, 0xa0aa72ff,
+       0x3029c4e3, 0x57a18aef, 0x77dfafc8, 0xc9ec9c20, 0xf92a919b, 0xffc1be8f,
+       0x20db9def, 0xde95fb9f, 0xa09dbe41, 0x674158f3, 0xb7a45cb0, 0x9f3ccc4b,
+       0xfc9ebafb, 0x4a8b5ccf, 0x91f686f8, 0x7bfea163, 0xf40fbda2, 0x5321ca2c,
+       0x848dd7b3, 0x0da36376, 0xf7d0ed0c, 0x19f2f37c, 0xdb3bc9d8, 0x025bc7f4,
+       0xd59a33e6, 0x387f41f6, 0xca821987, 0xcf2c7a9d, 0xc7cb6b35, 0x2cfbb8f6,
+       0xad630ffa, 0x77c972da, 0xfab4d88f, 0x7381df62, 0xf3009b3f, 0x92a4392b,
+       0x7d237cff, 0xafc22efc, 0x5dbf3a47, 0x3bbe0db8, 0xf872b02c, 0x4915e9da,
+       0x142357c8, 0xd3acf186, 0xe3cb42d7, 0x665ea41f, 0x7e3edf40, 0xe63816fa,
+       0xdc51e7b6, 0xa0b119ef, 0xdff08f3d, 0x7afb1ebc, 0x8d9b753d, 0xed8233c7,
+       0xfcdcb046, 0xfe46ecb7, 0x3dd2b7e0, 0x837f4a16, 0x5ced85e9, 0x89eb06ef,
+       0xe1213b60, 0xbcb7860a, 0x0fb1a74d, 0x191ea15f, 0x8c27681a, 0xc3be2764,
+       0x6d8370f5, 0x30f5c768, 0x2f8431f8, 0xad3d30cf, 0x6adfc1c3, 0x220376c4,
+       0x0039b1ed, 0xb76b0ad2, 0x167fb208, 0x405b7ef7, 0xb6ffaa1c, 0x8dea1d5a,
+       0x418cf8f6, 0xeb91a71b, 0x9d8477d5, 0x1cfa13a8, 0xceb4abd6, 0x4eee18df,
+       0xc9b8e3d4, 0x8c96c746, 0x48f9f88e, 0xcfccefb4, 0xbeac7e95, 0x8fb1fb86,
+       0x389a5d58, 0xa893eb19, 0x5fa2fb89, 0xd9edf28e, 0xfcf34e1b, 0x420d7154,
+       0xe733d439, 0xf4016ddf, 0xf87036a9, 0x8f89e183, 0x319276e5, 0xb207f917,
+       0xd0e8f67c, 0xd5895c7a, 0x679cfb53, 0xff474fef, 0x07c6d3ed, 0x7ebf51d2,
+       0xede7141a, 0x169e1e4c, 0xb0a4faf2, 0x2e223123, 0x11ca14f0, 0x9dda41e4,
+       0x55fbe1db, 0x57245d4b, 0x9d3a5d3f, 0x2e9667d2, 0xb613faa1, 0x9adf1a0c,
+       0x775767f3, 0x35c9d3c0, 0xd989d92a, 0x18af5746, 0x59a4eef8, 0x1385f147,
+       0xbb799155, 0xd19cb122, 0xb3f6727a, 0x0278b613, 0x6c277ee2, 0x6743a27a,
+       0xfd8f8cf3, 0x9cbdfa66, 0xbda144b5, 0x23d7e76a, 0x2db5ec1d, 0xac7fe316,
+       0x55db0125, 0xb6bdcd2a, 0xb7c71d29, 0x2c7c6732, 0xf59197f2, 0x0ba9b947,
+       0xb828f6e7, 0xe72c4a5d, 0x1fa1bfc3, 0x8a7efd0b, 0x9e842b76, 0x2f3a0bb1,
+       0xb1ed38b4, 0xc922efa4, 0x81b8275f, 0x728cbe5f, 0x60b84776, 0xd313d65d,
+       0x7c785d61, 0x2ac5b16e, 0xf0a9c3f8, 0x5fab8e75, 0x5bf8886c, 0x609ef167,
+       0x7811de38, 0xc9038e0d, 0x8681c654, 0xbcf9f2c6, 0xe26ab36d, 0x0eff1842,
+       0x79f9ff15, 0x1ba3d72c, 0x2a3c5bc3, 0x7c03c3ca, 0xdb25de3d, 0x2b7c60a3,
+       0x0736bf25, 0xc5775fe3, 0x2da5b8f2, 0xeb889dcf, 0xa344e4f6, 0x3736e303,
+       0xea038f2b, 0xc05f7c9c, 0xd63823ad, 0x7ac27b37, 0xcd095c01, 0xa4231cee,
+       0x0d317153, 0xaac2edf8, 0xa0dd2196, 0x6b23211d, 0x9157b87f, 0x92686c8b,
+       0x4028f429, 0x6772861a, 0x454f728c, 0x559b0cba, 0xfa718d55, 0xffbe3294,
+       0x77715670, 0x9c9f01b5, 0xa43c2b7d, 0xe8225c3f, 0xc9d194cf, 0x36b3fa68,
+       0xacae081b, 0x819f3fcd, 0xf9b59f7c, 0xa012bd2e, 0x1ac79687, 0xdf67fe68,
+       0xe295d79a, 0x58989f16, 0xea7a10cf, 0x1e5f8287, 0x69d87410, 0x8b7fcd0c,
+       0xac6fbb45, 0x55405bcf, 0xe2f9f569, 0x5b3880d8, 0xd265f945, 0xed6393e7,
+       0xfaf3ce34, 0x80c903ba, 0x3167e7cf, 0xe68a0787, 0xf148dd6d, 0xbac69dd7,
+       0xe4efb8f1, 0xa431d0a9, 0x7f03fefb, 0x7e8c9038, 0x60fb2ce4, 0xbfda23f4,
+       0x4ad2f43f, 0x0e7e7f2c, 0x4ff88c1b, 0x60ad3ef2, 0x619fe63c, 0x7faf84b5,
+       0x65b1316e, 0xbf7db718, 0x210ffc6e, 0xc74cbebf, 0xcf04bf50, 0xe832461b,
+       0x19f53112, 0xfd382374, 0xba4a0f51, 0x91190303, 0x886e921e, 0xee90edbf,
+       0xc11af2df, 0x2a9ae12f, 0xb6f3dee2, 0x7c8f1f6e, 0x53665c92, 0xe1204e30,
+       0x793d91ba, 0xd9dbf631, 0x0ed0ef93, 0x221b12bf, 0x0ec21d2e, 0x610d88ef,
+       0x2fed8387, 0x637738b3, 0xe1d91bbb, 0x36ff82e1, 0x7fed06c6, 0x08597ee0,
+       0xed8d0dba, 0x1fdf0f10, 0xe3ff621b, 0xdef0f146, 0x43ff72b1, 0xc97f0f1b,
+       0xad6ff5c8, 0x293c3d8d, 0x1374bc84, 0xb5d6ebe3, 0xc67ed11a, 0xf5212835,
+       0x518b62d9, 0x1c7e1fee, 0x125fb01b, 0xe0438fac, 0xefb628f7, 0x17b7cdbb,
+       0xe9890d5b, 0x5bee8111, 0xdeb0ebbf, 0x29ce310d, 0x22fb3f81, 0xf6a6fb46,
+       0x0afa462a, 0x141e5ef2, 0x371429f4, 0x934f38b0, 0xbec1badd, 0x1cd69dd5,
+       0x3ee483f2, 0xd6ab54d5, 0x938b8c4f, 0x239f9ced, 0xd89d699c, 0x3c097f89,
+       0x70dbfcc1, 0x4c45b8dc, 0xf7231fb3, 0x3caae261, 0xcd0b318a, 0x6af8a311,
+       0x32f758d7, 0x1d6bb403, 0x209b1cc9, 0xcd685d1f, 0x9b6a7d41, 0xfdc468e3,
+       0x7917959a, 0x02e57e3c, 0xfd4e5de6, 0x7732f9f0, 0x17ca2f37, 0x2e302dd2,
+       0xe1c71110, 0x72e38888, 0x1cd27606, 0x8f0ae1c7, 0x9293b00b, 0x3e75ba1e,
+       0x1adae895, 0xd0054eda, 0x77df46d5, 0x50efd742, 0x3771ed2e, 0x8cf71fe7,
+       0x19be05bb, 0x7c737718, 0x4b4c14f3, 0x8f04dfec, 0x0ff38997, 0x2cf80f1e,
+       0xf826ee2b, 0xee2deaec, 0x50881e8f, 0xa5dc5dbe, 0xc4275e23, 0x6b77d085,
+       0x487d75f2, 0x4770b35f, 0x233abb28, 0x7dbff22e, 0xa086645e, 0x179d2df7,
+       0x2d27f179, 0xdcb3a446, 0x06f090f7, 0xe591139f, 0x264a0d15, 0xf6733fae,
+       0xc075a35d, 0xd37fc6a5, 0x79e3a03a, 0x42ee3e0f, 0x678003e4, 0xcea03aac,
+       0x7977f207, 0xea56919b, 0x22ffb32a, 0x4df6e31b, 0x53b5e606, 0xefb6337b,
+       0x7efb78c7, 0x633656db, 0xd31faadc, 0x547ac47b, 0xa8fdceb9, 0x7ee39468,
+       0x8d5b2a4d, 0xbebcadf9, 0x6197998a, 0x847a3a5c, 0xf003d98e, 0x670ce319,
+       0xc67c00f6, 0x7934d9e6, 0x2f9e4eb9, 0x25778dc6, 0x32efbe6b, 0x7da69bbd,
+       0xa69fbb92, 0x10ce653e, 0x6aad3e4d, 0x577da694, 0xf981cfb0, 0x9addcf0c,
+       0x266bddf6, 0x6b3df26b, 0x3fb4d01f, 0xcd9eaacd, 0x9c7a79c6, 0xce003dcd,
+       0xdece0259, 0xdf358beb, 0x0dd5d7f5, 0xf920a1f3, 0xffee1f14, 0x326c16cd,
+       0xfa73c44b, 0xfa69e77a, 0x5e6aff3d, 0x9df80293, 0x19386b5d, 0x7c219f18,
+       0xea4b7e00, 0x8c1cf615, 0x5b5eba5b, 0xe9e1a73f, 0xce902995, 0xe7cb6af5,
+       0x829cbee1, 0xdf2dadfc, 0x823d73ad, 0x71ed9deb, 0xe228ce22, 0x7f03ac3d,
+       0x97b8d244, 0x9778f037, 0xc41de9ea, 0xb13a5a1f, 0x762fc96f, 0x44a62fc1,
+       0xd984bf2d, 0x7a52fcb5, 0x1f30e770, 0x88ff88eb, 0xe47c413e, 0x78017f81,
+       0xf895f897, 0x7cb438b7, 0x9de15df5, 0xdb91af31, 0x3ff96d0d, 0xb5f1b4e2,
+       0xe3ee917e, 0xd4aeb7a8, 0xbf71522f, 0x7df1e58d, 0x57f52bfb, 0x6bb21d07,
+       0xdb3ad7f6, 0x17173a4f, 0xfb175718, 0x3f709749, 0x137636f1, 0xfefb89fb,
+       0xd900f885, 0x1f801b77, 0xb98708d8, 0xcc30ff7d, 0xac147fbf, 0x760a6537,
+       0xb238cbe3, 0xd77dfe27, 0x587af86a, 0x085c5ff4, 0x9387dcaf, 0xf9e472e7,
+       0xe7c91621, 0x3c01fb29, 0xf143f1a8, 0x022d9ffc, 0xf7dbadd7, 0x96f5a42f,
+       0xc4c43f3c, 0x7e10bfb9, 0x3aefe93f, 0xfc8935fc, 0x6e78f081, 0x6d3123cf,
+       0xf9c407f7, 0x3bcf692e, 0xb7ee47eb, 0x7b2a9675, 0x6c3fda55, 0x9b1dc255,
+       0x5e93d842, 0xfd72dff1, 0x1c43a675, 0xe07c57ba, 0x2bd1ebfa, 0x00aed007,
+       0xb962fbde, 0x5af602c5, 0x5febdbf1, 0xbf114444, 0xbd541eb6, 0xb2e0a1bd,
+       0x036d1ed9, 0x6984363c, 0xab4c88ed, 0xf403c9cc, 0x3daf58b1, 0x11f727e7,
+       0x6367db83, 0x27fd80fb, 0x8fe34ef8, 0xfdc21cac, 0x6e78ecb5, 0xe488bfdf,
+       0x9114c1fe, 0x175a0caf, 0xbf70d655, 0xe9f8236c, 0x4cfd010d, 0xfb50b789,
+       0x533911a5, 0xc08e29e2, 0x332bbbd7, 0x5627f214, 0x21f90a2a, 0x5347a267,
+       0x9cb8b5fd, 0x623fc4c9, 0xbbe8299c, 0x6edaffc1, 0x38bb1e1c, 0x37fb238f,
+       0xe6f6f3c7, 0x4e94d1f8, 0xb88ab789, 0xf21fb5b3, 0x93846547, 0xa1aa35fa,
+       0xc7a6a5f7, 0xb5ad79f3, 0x6a27e930, 0x84e3fee2, 0xbf38c4de, 0xf9a3fb89,
+       0x71fc1363, 0x7f66a67e, 0xf1138c68, 0x773e857d, 0x53ba9ea2, 0x78b3bdd0,
+       0x758fb3bf, 0x75276e3f, 0x12fbf78c, 0x1dfbc643, 0x0fde28e3, 0x5e71ea5f,
+       0xa47f71c1, 0x2fcd8443, 0xb7c48f3f, 0xd45483db, 0x7746f54f, 0x5abbae35,
+       0x0eff8377, 0x2dbc7dc5, 0xf0301fb4, 0xae077750, 0xb06656af, 0xb7e416bd,
+       0x7fa18c65, 0x5ba2df5f, 0x6bf5061e, 0xf58acc3c, 0x75f03723, 0xbb7ae95b,
+       0x8069a703, 0x8865b075, 0x8bac1f5f, 0xd7bc218f, 0xc46e4cb7, 0xf73581fd,
+       0xa19a1b32, 0x1b9b565a, 0x06d0fe85, 0xf8dd7216, 0x09b39094, 0xd4557b39,
+       0xdfe8f117, 0x53d3a087, 0x0fa04e82, 0x879d22d6, 0xf0afbab7, 0x4fae38fd,
+       0xfae22548, 0x1bcebf74, 0x373f3d6a, 0xf21d773a, 0xe86f40c1, 0x0b5ac3f5,
+       0x1175b7e7, 0xdda8e7ae, 0xb5ee7e2e, 0x59dfea54, 0xba07a63a, 0x9d74114f,
+       0xdf9f81b2, 0x5faed760, 0xc89fa557, 0x7a867fa8, 0x8b5ef4a5, 0xa543e317,
+       0x821e190d, 0x7a38a5cb, 0x7868bea2, 0xd2f985df, 0xc62b2cac, 0x657f9c23,
+       0xe43ea9ca, 0xbfae3262, 0xd494ecf4, 0xe3c76427, 0xb269df68, 0x16b5b7e0,
+       0x0d473f3b, 0xfc008e28, 0xb6586e97, 0x7cefcf17, 0xfb466bf4, 0xd6d4474b,
+       0x54d9d861, 0x2192ce40, 0x2159ea98, 0xfef82bc5, 0x1fa2bdd5, 0x5c61bfcf,
+       0xa9dc7fb3, 0x3e69070d, 0x63cc0c47, 0xb4ba3e06, 0xfa3b3ee7, 0xcde32bdb,
+       0xfb93c714, 0xf75547b2, 0xf48464e3, 0xda0815ad, 0x56110dfd, 0x43fc7f8c,
+       0x82465df0, 0xc7d21f7b, 0x057c7cbd, 0x6596c1da, 0xa3c474a6, 0x1a92797b,
+       0xd7ba7007, 0xd1ef342a, 0x788c93cb, 0x8ae6617e, 0x4f50e3c1, 0x95ce610d,
+       0x2879df18, 0xd3948596, 0x9d7cf1f3, 0x60655c58, 0x849a68c6, 0x172fe311,
+       0xbf8a146b, 0x015bfee0, 0x988e67d0, 0xf7aaf95f, 0xec3f88a3, 0x1e186ff0,
+       0x733fe5cb, 0x1e494aaa, 0xe46bcec1, 0x19d58ca7, 0x799fa093, 0xdb39606b,
+       0xf1fdec8d, 0xc043fe0e, 0x3af2ef79, 0x5b257d6d, 0x7f9d39f3, 0x5befe061,
+       0xeb682ed0, 0xe8f2953f, 0xaba40e60, 0x8cc5b17b, 0x0b4684e7, 0x51ad14bc,
+       0x665fa8ac, 0xbf8c68ae, 0x9b33f20f, 0xb4f20754, 0xe8eb0bc4, 0x8f39d3ef,
+       0x693d4dcb, 0x6ed9703d, 0xdced82ef, 0x2bff5c51, 0x2c70f77a, 0x3dd6287f,
+       0xadf1d71c, 0x9e18589f, 0x06d6399b, 0x1ec618fe, 0xc5106ccd, 0xd06cac1f,
+       0x5a3b00a4, 0x6026b064, 0x16c3dfbc, 0xb7be3226, 0x779c0e65, 0xf90d79a5,
+       0x07e89581, 0x1f91f9f2, 0x672c50f8, 0x15d7d6d5, 0xeac39f3a, 0x9a07e40d,
+       0xd6781f85, 0xae009b5e, 0x6e3d7317, 0xde2d3920, 0x687e4316, 0x235c8af1,
+       0xaef16ff2, 0xe043d218, 0x63d87e07, 0xc78e9f98, 0x481e6456, 0xeb8b7e84,
+       0x96aa1c32, 0xb8ff5a7e, 0x5ba498e6, 0x4b4fbf47, 0xe8a193b7, 0x94d2f406,
+       0xff0824a7, 0x3d8bd04e, 0x477e4b16, 0x7ab782e1, 0xcb9e019a, 0xee746155,
+       0x83ff33a8, 0xbed1c6a5, 0xe6175c9e, 0xdfafb725, 0xcafcdf68, 0xb744a19a,
+       0xfde57a60, 0xb470e667, 0x16afec27, 0xa1ec7a86, 0xc9e1ecee, 0xc2b0fe50,
+       0xeaa1ebe5, 0xa72879f1, 0x6f5c0959, 0x6614b7be, 0xfdec6468, 0xece666a5,
+       0x4b07d8c5, 0x68ff94ad, 0x3fe52269, 0xf4a76a5e, 0x287da593, 0x68e2293d,
+       0x0180ce52, 0x25475f88, 0x951af970, 0x6cdee220, 0x8caa2251, 0x307cffbc,
+       0xa1c56754, 0x4d8c27d2, 0x271eec63, 0xdfc02320, 0x046f7e99, 0xdf3db912,
+       0x4b8eb062, 0x9571ff44, 0xd8befa42, 0x3da6bb75, 0x3c4625f8, 0x64facdff,
+       0x9ce9cbfa, 0x1938dd98, 0xfcfef0f8, 0x69fb4d58, 0xfc9a2935, 0xcd3b04e4,
+       0x775e527b, 0x8503f94d, 0xa2f935fd, 0x9e024036, 0xf8db302f, 0xb7d8aafe,
+       0xd7c6cc67, 0xf6de56eb, 0x2ef0d56a, 0xaf7807df, 0x7d50321e, 0x5d243d30,
+       0x31d7ad67, 0x73368037, 0xfa0dcc3d, 0x933b593d, 0x11fceae4, 0x95fdd90b,
+       0x1ddf32db, 0xdb63f901, 0x7ebfb40c, 0x5aec456c, 0xb63e3fdc, 0x418a3e2d,
+       0x32a95eea, 0x7ac1fa1f, 0xe80591ab, 0xcb15dcb7, 0x9156fce8, 0xf940e4d7,
+       0xf9efda2f, 0xd1dbcc95, 0x5120441f, 0xbd543e3e, 0xe7e8853e, 0x14befc24,
+       0xf902dde6, 0xf1afa033, 0x16ccf8c8, 0x8519d70e, 0xd9fcc0ad, 0xfaf5bfb0,
+       0xb171c03e, 0x8744b6a0, 0x50f501eb, 0x1dcbe93c, 0x2dbe432a, 0xfda0605c,
+       0xa91fb9bb, 0x94cf311b, 0xde9c2921, 0x64479d2a, 0x7fa8992f, 0x021c0ad6,
+       0xd6fd16ed, 0x77d689b4, 0x0f77e44c, 0xfc16aef4, 0x26747c89, 0x08633986,
+       0x3de08558, 0x46fc7ef7, 0xd3e3f7ac, 0xfde7083b, 0x32b5dea5, 0x5cebf801,
+       0xe9107789, 0x49e2c7b5, 0x7ef182ae, 0x96f5c8d2, 0xf140e507, 0x9cbf4beb,
+       0x9d3e272d, 0x38247069, 0x25655f48, 0xb93abea1, 0x98e740c6, 0x3519de99,
+       0x3b3fd689, 0x38e58f88, 0x71f6f527, 0x9ac9df08, 0x96fb860c, 0xf2546bc5,
+       0x78ff9007, 0xffe72f7b, 0x1b3755a7, 0x28d6fd0e, 0x23a5d66e, 0x60b23cdf,
+       0x9a639d38, 0xc141d621, 0x9033e07a, 0x7f2f7755, 0x7e1ede7e, 0xb56586ce,
+       0x181defe8, 0x7c158f38, 0xbfde44bc, 0xd650073c, 0xd1474fed, 0xd4dcbee5,
+       0xf0ed1a3d, 0xe2550fd9, 0x6addb3b3, 0x3d022587, 0x0ef6e82f, 0xcfe43efb,
+       0xe94e7817, 0xb854ff21, 0xae02677b, 0xd26b7457, 0x3e786e95, 0xdbdac4f6,
+       0xaf73bbe1, 0xe6241c18, 0x7f49e24b, 0x6e697bcc, 0x8ef3c0d7, 0x2f97f51d,
+       0x38bfef99, 0xe7c01493, 0x38dd7b7c, 0x775c00eb, 0xe21d84bb, 0xe6e3b1f8,
+       0xbac5e02a, 0xc343c14e, 0xcb50c4ec, 0x3d773c6a, 0x3024c413, 0xec42784e,
+       0x7a101f8f, 0x1109fa45, 0xa67e785d, 0x7b37f38e, 0x0dbf2155, 0xbffa347e,
+       0x944f9c52, 0xebea5f7a, 0xfb4b5632, 0xf81247c1, 0x8ab9c639, 0xe055da97,
+       0xa8a82ece, 0x420f2b12, 0x79356d97, 0x97d419bd, 0x480fd035, 0xfbe762ee,
+       0x9e57c643, 0x652db645, 0x417e7ccd, 0xbc19ceed, 0x1d19cd25, 0x75894ded,
+       0xf51b0ae3, 0xfc60706f, 0x69c854a4, 0xf5e2ad79, 0xdd9079f1, 0xd98af194,
+       0xdb066ec2, 0x28f60ea7, 0x0ecd0ec8, 0x56acb3b2, 0xde01576b, 0xc2471c48,
+       0x2ba70c1b, 0x987842c2, 0xbda17007, 0x0f7b712d, 0x15b8244c, 0x03b25007,
+       0x35cca53c, 0x01e70626, 0x477b3ef5, 0xd5e782f8, 0xcf315e01, 0x1c4bb860,
+       0xff70fb9f, 0x5187cf18, 0x1e6829bc, 0xfec11e92, 0x894ba49a, 0xa4b7e387,
+       0x7e7a2141, 0x3207eeda, 0x7e491b8a, 0x9d500581, 0x44d77bf6, 0xeba567d4,
+       0xf866ff40, 0xd3f247f9, 0x8517563c, 0x7cc152fc, 0xbe50932b, 0x46d3757c,
+       0xe1bedfa2, 0x49ca237d, 0x53d7cda1, 0x5c288317, 0xb4bcd3fb, 0x1044f580,
+       0xd7446f9e, 0x9c378a6f, 0xbdc65e95, 0x37b34f00, 0x41b0ceab, 0x1ce2769a,
+       0x60e48791, 0xc463c78e, 0xb11cc6f8, 0x9c11bfee, 0x6e7e7a95, 0x76f086fc,
+       0x5b7d27e2, 0x68baf3b8, 0x9fbf62fd, 0x943a33d5, 0xaff76a9e, 0xdffaec82,
+       0x217e3c0c, 0xbd55f1f5, 0x5025e293, 0x2aaefc2e, 0x079b8f2b, 0x2cb4f1e9,
+       0xc225e3d2, 0x4e71cbae, 0xf149dfad, 0xf768d9b7, 0x5d3fca03, 0xfee293b7,
+       0x476657c6, 0x6a7dffa1, 0x78b5ccfd, 0xb6d4ebbe, 0x4be76499, 0xde76939f,
+       0x1ff40c6d, 0xbd17d772, 0xdfe463f8, 0x9f1461ad, 0x16efd92f, 0xabd01eeb,
+       0x9ebeced0, 0x8eb651eb, 0xb452d5eb, 0x1ec80387, 0x8b76c6f6, 0x51bddc4b,
+       0xc9ca020e, 0xe99e2e4e, 0xe81eddfe, 0x11cbf177, 0xc2a10f0e, 0xdf91d3ea,
+       0x3da1f56e, 0xf1f85f2c, 0x0ee73c51, 0x1fa3fff6, 0xd90ffb48, 0x92f77a8d,
+       0xc26f282e, 0x1bab97ee, 0x27e8add3, 0x5ff13b08, 0x3439bfc0, 0xfe1087fe,
+       0x01ff118b, 0x6bc720fb, 0x06679e38, 0x1ac4ffe1, 0xdb95974e, 0xfae147ba,
+       0x774d78f1, 0x6f8eb3f2, 0x9ff849eb, 0xcff01ab5, 0x3f5a5fe3, 0x8ff006ab,
+       0x3fc408eb, 0xdfbc5bc0, 0xe0eff02e, 0x78e1aff8, 0x3a786b67, 0x3d9e03ab,
+       0xf1618e74, 0xf40e4daf, 0xf984ce1b, 0xb33a9fc8, 0x01d5655d, 0x83f4987e,
+       0xbfb560be, 0xe24d7f42, 0xe6af6e7f, 0x0a7fa841, 0x1453fe9f, 0x76ee61d2,
+       0x80efa41e, 0x82ece67f, 0xfc7fb8fe, 0x95e9bf76, 0x7e01f12e, 0xa9d24dd3,
+       0xd918b982, 0x1d3f86c5, 0xe28375c1, 0x786d4f84, 0xd7dc468f, 0xd7ded7a8,
+       0x851933c0, 0x382f8c36, 0x278466cc, 0x8a1ef835, 0xf91c619b, 0x9f3f3d9f,
+       0xbce490b1, 0x6dbe7355, 0xba19f322, 0xa758ffa0, 0xf2c6fdd0, 0x39513945,
+       0x55d4e30c, 0x2ee9c704, 0x78fce68a, 0xff23aab9, 0xfdc8ccb1, 0xf93fb948,
+       0xde0ff0ae, 0x25d7c2ed, 0xd2b175ef, 0x18c29777, 0x164b81d9, 0x23ef17a3,
+       0x112a7ac0, 0x31ecf7c7, 0x228edd11, 0xd57f804c, 0x6036e228, 0x1f4f9102,
+       0x1f4f9c64, 0x38a26c8c, 0x5e54ac39, 0xd0f8bb40, 0xfc839312, 0x8a68b8da,
+       0xf4203ed7, 0x2b9183dd, 0x1e1f685d, 0x313a348a, 0x783d7e85, 0x1a30ce88,
+       0x0df18786, 0xafba46c9, 0x796e6853, 0x0fbe9705, 0xd4789e27, 0x06dea00c,
+       0x55c637ee, 0xd75dd7e0, 0xc5d23b63, 0x9c6d1f4f, 0x743c32a7, 0xe055a3dc,
+       0x293a714b, 0xbe82639e, 0x2b8e01c3, 0xdcb12f68, 0x9df1e56e, 0x8b27400d,
+       0xe5c1be9f, 0x03f7c3cc, 0xe35cf0ca, 0x6419c628, 0x935fe104, 0xfaf2332f,
+       0x26afc4f0, 0xec66cbac, 0x103ecccf, 0x3a8656e9, 0x45f7d704, 0x978c5ed1,
+       0x25f183df, 0xe27aa61b, 0xe67ac997, 0x26b4f1d1, 0x89cccf12, 0x8144d378,
+       0x9823a9cf, 0xeef01a2f, 0x778da83b, 0xf9d3e7dd, 0xef7e037a, 0x911afbd1,
+       0xbb66753f, 0xb8e30ac1, 0xb82194f2, 0x7e5b292e, 0x25a6f073, 0xa5d7f39a,
+       0xcfc75e42, 0x80feb585, 0x041e21c7, 0xcdbc4561, 0xeafdb3d0, 0x8807ce10,
+       0xdd9b4a97, 0x2816ed43, 0x71950f14, 0xc1ff4936, 0x1d207dd0, 0x41f0141f,
+       0xf851353f, 0xbd3431bd, 0xf5ca26fa, 0xabad1d73, 0x9bb90be7, 0x9b6de52f,
+       0x27c6de56, 0x82bda9da, 0xede0307e, 0x26769141, 0xff44e317, 0x5cb912e3,
+       0x78e2dd64, 0x9d35b22c, 0x7908b7ce, 0xfef13729, 0x88f7f8e5, 0x8da24c74,
+       0x00f095fa, 0x7ec71ebf, 0x9001a074, 0x56d64f5f, 0x87347f93, 0x33b5c405,
+       0x5f24edfc, 0xebb7cc77, 0x4c75dd11, 0x10b3ad8d, 0xc2f7caf5, 0x1f47a81c,
+       0xacf5d634, 0x4ed8ec8a, 0xb214dbee, 0x3d230366, 0xc261e229, 0x23558cfe,
+       0xa1407ce9, 0x5e0fefc2, 0x7478b1ca, 0x31a718d1, 0x630b6910, 0xf13f3a14,
+       0xf27fb137, 0x89e2f450, 0x5185d728, 0x33a63d46, 0xfbf52b58, 0xe8b76b77,
+       0x33de18fb, 0x0e763156, 0x77c88f03, 0xa8d5b8c2, 0x8d7e7877, 0x4aa29b33,
+       0x21c77f22, 0xdee1e027, 0xca7f406b, 0x09df2f7f, 0x4b7a5ffd, 0xe93bb3d4,
+       0x0b8f4bfb, 0xf2e4f63e, 0x7d65cffc, 0x92afcf1e, 0xff3cf9f5, 0xe45feca4,
+       0x5faa0e9f, 0x4bff5416, 0x3ebc5f9e, 0x7e83df3f, 0xd2ce68eb, 0xd214a385,
+       0xbe847b53, 0x23ee5c28, 0xf6ea16fc, 0xf33474f2, 0xdc6eb2e9, 0x6ba2536e,
+       0xd51fda0f, 0xf682d272, 0x2764d5f7, 0x704f9fe5, 0x75c44b2f, 0x63c524d4,
+       0xa1fb7d44, 0xc4c1ec97, 0xed1fce4e, 0xf8e3c2e9, 0xbfa0929b, 0x05fb7ea1,
+       0x8c4eacfd, 0x1c7ef5bf, 0x80ae1c49, 0x26f99e7e, 0x23a7fcf0, 0x49be1b3c,
+       0xb592b33f, 0x487f48fd, 0x86be7549, 0xe32763f3, 0xe645e734, 0x8d11c4ff,
+       0xe78627f1, 0xf3f50045, 0x67a5d797, 0x5ff3ff42, 0x04bd3d7d, 0xe76125fd,
+       0xcc74da2b, 0xdb34f789, 0x1be7a518, 0x7de2313f, 0x8d5d8ab3, 0xaed071c6,
+       0x00dcd212, 0x9c04cab8, 0x93f4e760, 0x8373ec03, 0x3d8c1bd0, 0x5f37f7cd,
+       0x7a47ab3d, 0x9dd5d7ce, 0xf6ed0e7a, 0x3ee42528, 0xddf166cd, 0x17ce4ed1,
+       0xe87a15ef, 0x11b39a6a, 0x8c6bf9e7, 0xb73e4021, 0x60fb93ba, 0x855f1c49,
+       0x1ccdeec2, 0x01db3166, 0xe43f43cf, 0x1b2554fb, 0x3c608632, 0xd184cdf8,
+       0x6d7e24ef, 0xc795b53c, 0x3c781b53, 0xbcd6d0b5, 0x33379408, 0x31ad9526,
+       0x84d8c1df, 0x0339485f, 0xf36f8591, 0x9d5f324c, 0xc79b263f, 0x767f30bb,
+       0x506b63fd, 0xb9c29a6e, 0xf0d0fb1f, 0x17a8e181, 0x7422325a, 0x37e79056,
+       0x498c8be3, 0x8efcb143, 0x639e5871, 0x222af4b2, 0x8be232fc, 0xc75de337,
+       0x3db05f90, 0x46dc41c6, 0x307dfc5f, 0x2adbf70f, 0x0f75a79d, 0xda87708a,
+       0xc087fa77, 0x4ac931ab, 0x19901369, 0x870917fd, 0xf9fc1f1c, 0xdfd0cd45,
+       0x8349e5c9, 0x9f71db57, 0x3490c725, 0x467e3fd4, 0xe072fb82, 0xac7527f8,
+       0x6e292e17, 0x024b8e16, 0x5dee030e, 0xd95dbe03, 0xac06732a, 0x898f26f3,
+       0xcdefe4d0, 0xc0ce658f, 0x29bded38, 0xc2f4fc9a, 0x0ff69aee, 0xa9afeacc,
+       0x6735302f, 0xb1f80555, 0x1e49fb9d, 0x62d2a782, 0xee7f4709, 0xfc5f0def,
+       0xfff441e5, 0xf40eab36, 0xd9eee755, 0xa1db97f2, 0x4e3c65d5, 0x3b47f145,
+       0xc9cecbc5, 0xa77a28f3, 0xe85f703e, 0xf3a66b22, 0x03ed9d3e, 0x7cee75c9,
+       0x773a7eeb, 0x03ef5df6, 0xeb124af5, 0x086c21dd, 0x55cbc3da, 0xaebc511f,
+       0xefcf9222, 0x8cc7ebe2, 0xfb8a0fb8, 0xdf81d78a, 0xd10fc2ef, 0x50f36c3f,
+       0xfeb73b3c, 0x1d9bed18, 0xba7ae448, 0x1e817522, 0x42551def, 0x1c68768a,
+       0xe068abe8, 0x3646e697, 0xbbee1770, 0x1fb85866, 0xb19936de, 0x1e2be458,
+       0x884a69df, 0xf3d77ba1, 0xbca8f26b, 0xfa9c2da2, 0x1e6d4f7f, 0x5f09e747,
+       0xa1ff6853, 0xe5a1e520, 0x29b87e78, 0x11e033dc, 0x77e0b718, 0xde21e577,
+       0xf3f1762a, 0x9fea05b5, 0x5a4016b3, 0xdf479b56, 0x49aca817, 0x42617f01,
+       0x05bfb72e, 0xaf21f368, 0x46acb30e, 0x7d1aabbb, 0x3d479ebd, 0x9e90b463,
+       0x807b6e89, 0x336cafc6, 0x24f7f7d3, 0xd0d77f71, 0xdb1ae1c2, 0xc972a2e6,
+       0xba93530f, 0x860fd669, 0x7c7acdf8, 0xc2d0c397, 0x6dddfda8, 0xf39528fd,
+       0xafcfbb7d, 0x21ae3ee9, 0x14b8eafe, 0x71dbf798, 0x90dc958a, 0xa57c3d20,
+       0x0b34786a, 0xc7daa7a1, 0xf4e7e369, 0xdcfc6d4c, 0x738a615e, 0x31c0127e,
+       0x3d16b1f1, 0x48b107ee, 0x35f115b3, 0x7b60c471, 0xa97c8049, 0x2237ef7b,
+       0xdeeb0c7d, 0x369da237, 0x501b9a41, 0x33ce2e5f, 0x05e9eb04, 0x2f4f5249,
+       0x1dda54a3, 0xf9067576, 0x82ac33a9, 0xccfc8501, 0x7e54fa10, 0x1a6b4cdf,
+       0x1e6ee3a0, 0xc5347fc7, 0x45f502bd, 0xbe9b0e73, 0x7366f483, 0x7cc3ee3a,
+       0x9d03f057, 0x89f90acd, 0x751e742d, 0x0ebb08e2, 0x04abffe3, 0x6f8e525c,
+       0xa2c58f34, 0x5b2a7bfd, 0x77befd82, 0x4ecd9de7, 0x47f1afe8, 0x0f689999,
+       0x25cfb8e4, 0xcc297bf1, 0xd70d7ada, 0x446f9583, 0x0bde51d8, 0xfb863170,
+       0xb44c7b9d, 0xda72814e, 0xc37ca8cf, 0x89ef09b4, 0x7ac14654, 0x7dcfc615,
+       0x7c87cc33, 0x9866f8dc, 0xef46ed1e, 0x4873f774, 0x7b37dccf, 0xa1f5c18f,
+       0x67a4c1b3, 0x9f38f7e4, 0x09db3d27, 0x5bd237bc, 0xe5267cc1, 0xe5c35dd3,
+       0x69f048a5, 0xb73f90b1, 0x552ba390, 0xaf0e485d, 0xe340063c, 0xca63e93e,
+       0x27e85dc0, 0x7ef42dd8, 0x02cb9493, 0x79410f5c, 0x3a18ff41, 0x8dfd2bff,
+       0x6b2c3960, 0xe5bf52b3, 0xef21766d, 0xb94bca36, 0x6372162b, 0x2cc67e12,
+       0x53bbe7c1, 0x5e20efdc, 0xee41aa0a, 0x3f1f68a3, 0xcfc9e50b, 0xf22b4637,
+       0x624df017, 0x54fc8049, 0xd0cfde37, 0xb9c5313f, 0x41666f88, 0xcc9fe81a,
+       0xac4ff76e, 0xfe0012e3, 0x74322b89, 0x9da9df78, 0xe6f9db7f, 0x8f7ff8e6,
+       0x48e29790, 0x67f44f5f, 0x0e61550d, 0x397e873c, 0x2cf7ef8e, 0xb8f1c55c,
+       0x45cae0d0, 0x2fe162ff, 0xa1978a15, 0x697a81df, 0x632a91d8, 0xfee51c60,
+       0x0ecc41b6, 0xd6d29878, 0x1337d283, 0x0f1147dc, 0x04d36d45, 0xa37d06be,
+       0x4ea1c5fd, 0x7832471e, 0x198d8e4d, 0xab724718, 0x6933e748, 0xe04cfacc,
+       0x1d7ade7e, 0xbee4c3c5, 0x992b8ca3, 0x807cbcf0, 0x5f42fd1d, 0x37ef4e9b,
+       0x7299c704, 0xb0bfddb8, 0xbf7640d9, 0xc3cff1ac, 0x2e7f5074, 0xed05d9c3,
+       0x777a97c9, 0xbcf5f21b, 0x0d57dec9, 0xe4ff9f90, 0x7691a8ce, 0xf4eb3e3f,
+       0x47689ebe, 0x188f00eb, 0xa35baaef, 0xbfb979e6, 0xc9f7c113, 0x7e4b7f38,
+       0x79f3e60e, 0x9f88dd6d, 0xc89954ae, 0xbe015d0e, 0x48760165, 0xe7a91dda,
+       0x7c91fda5, 0xfae7ae5d, 0xda323cab, 0xb408c9eb, 0x395c933b, 0xf87d77c8,
+       0xddbf1a79, 0x1476b4d9, 0x38a5c1ca, 0xed28b73a, 0xbc1cb046, 0xd31c14b6,
+       0x8eed1d5e, 0xcf52ebd4, 0xfa35bb4b, 0xfe772fe5, 0x8a55cd15, 0xe032407b,
+       0xb73d6eeb, 0x2deb775f, 0xe3633fc4, 0x6f91e926, 0x1e8f5e6e, 0x98f47a13,
+       0x74568f46, 0x27060762, 0x741c9adf, 0x4cf3ed15, 0x3d447fdc, 0xa3dfd81f,
+       0xe0c7a329, 0x7327c63c, 0xc15dfb3b, 0x1ffe99dd, 0xfa6b7c9f, 0x88b2587f,
+       0xff40ddf7, 0xfd732617, 0x99efac1f, 0x73a7bf95, 0x2f5f4f69, 0x0ca383da,
+       0xc1da03ec, 0x16fb0886, 0x5ec80f61, 0xbf7b4784, 0x4d5c1ece, 0x7888599b,
+       0x1e0f610a, 0xf616fe4a, 0x94a1f240, 0x5227291b, 0x48e5822e, 0x9f84c5ca,
+       0xe9113ac2, 0x57bf1ef4, 0x6cf7ae50, 0x7b46fda3, 0xcf9460c4, 0x976e3f76,
+       0xc1d6f242, 0xf1f9084e, 0x6ed68bcb, 0xf290b948, 0x5ca7e522, 0x20ecc5c8,
+       0xd6a7d8b9, 0xf70a333d, 0x6bdd92cb, 0x72fde393, 0xd823b652, 0x57ca743e,
+       0xb3645918, 0xf218aae3, 0x81a43955, 0x44ea657c, 0xbe499e1e, 0xd968bf35,
+       0x6fd3f24d, 0xf4fcfbfe, 0xe9f84e9b, 0x3f0dbe7f, 0x3f63f475, 0x3c03b2ce,
+       0xdf40b257, 0x6df9f866, 0xfb8c3bc2, 0x7af9dd0f, 0x0497d600, 0x8d319377,
+       0xae133ee2, 0x2f8a2ab3, 0x7494be0a, 0x6cc0fe96, 0x93387711, 0xe1077ae2,
+       0x82c0f5c5, 0x447bd39b, 0xb35c5367, 0xb327d711, 0x03f40d21, 0x9b7ff33a,
+       0xbdef516f, 0x3e749371, 0xfb9dfc96, 0x4392c78d, 0xb1c78dfb, 0xb5d29bfc,
+       0xf8899720, 0x300b8fde, 0x29e138de, 0x0acb6791, 0x46d38f10, 0x3c9ffac8,
+       0xfa81ece9, 0x38b8c981, 0x53de39c5, 0xf4b3de45, 0x3f6818f0, 0x8fe619e1,
+       0xd8fd439b, 0xb8f6e8ec, 0xedfcc288, 0x3b1fe795, 0x51e886bc, 0xddcce5cb,
+       0x3ffbe7a2, 0x79059f22, 0x447e404b, 0x6f037e50, 0x616fa51f, 0x9045e781,
+       0x9c21949f, 0xff00aece, 0x7fdf8601, 0x5585ed05, 0xa8d71861, 0xd6f8db8c,
+       0xf56bd415, 0xb545ed0a, 0x14d581e3, 0xfbc55338, 0x735f94b9, 0xc23e09d8,
+       0xbe78bb03, 0x93ed4a4f, 0x37e8bd1e, 0xa1bddce0, 0xb9d2714e, 0xb78a1183,
+       0x7c47465b, 0xdad149f7, 0x6bd1fc27, 0x1e7867bf, 0x6fbe56ef, 0x8dd6cfbf,
+       0x6e99f7be, 0xb2fbfc61, 0xfe7f9f43, 0xefe70a5e, 0x21d15931, 0xa8a5c7eb,
+       0x37111fbc, 0x68a1f1a0, 0x7be85d4a, 0xb8c513b0, 0x425fb8cd, 0x24f6dcf8,
+       0x28d9b7e2, 0x93f2fdf1, 0x196377c8, 0x60cfc4d3, 0x9fdfca7c, 0x8d4172f2,
+       0x19d74f9e, 0x9bafaf84, 0xa91480ef, 0xf2f8fdbf, 0xf4cbd104, 0x8476f835,
+       0xfb5db7c0, 0xe8ebefbd, 0xf7c3ac35, 0x48e76f82, 0xf86a763e, 0x22ef5a3d,
+       0x538e8cfe, 0x5747e8ac, 0xe0d6c2b8, 0x9f2fc17a, 0x6cbe27bf, 0x1d03fb96,
+       0x02b5efe4, 0x890abf94, 0x4febcf47, 0x74bafca2, 0x3cb9eded, 0x7335f3b6,
+       0x52bc01f6, 0x7fbe0fc8, 0x27faf9e4, 0x7c092e31, 0xd794f541, 0x2c1dc007,
+       0xf941758f, 0x15f920ec, 0x03fa47f2, 0xa9e001ed, 0xb8b7ea27, 0x007b4663,
+       0xd04cfc9f, 0x27b8a2e9, 0xfb9a3cda, 0x78ddcd93, 0xfb8523ba, 0x7c09cf8f,
+       0x9bed126e, 0x90f003c3, 0x1f1fe1aa, 0xe6025bae, 0x3fba784d, 0x93fbce4e,
+       0x63d07c82, 0xbf5e36cd, 0x27a3e52d, 0x7cfed93d, 0xa6af7f70, 0x7880527c,
+       0xf1fff7f1, 0xee23f461, 0x91db7817, 0x27b0e472, 0xc139d052, 0xf0214eff,
+       0x5163bd07, 0x74a1fc8e, 0x761f8fe4, 0xd04f4fe4, 0x774ef4f7, 0x3a7bdf67,
+       0xfa0cef7e, 0xea3de19e, 0xd05eff9b, 0xae883f2d, 0x1d744179, 0x942f9413,
+       0xff46af79, 0x5c5cbd4a, 0x09e3f4ff, 0x54df1871, 0x9fbf38e8, 0xbd934f9f,
+       0xfc956f99, 0xf230e67b, 0xcf9f9fab, 0xd7279e12, 0xce79ba09, 0x787a893d,
+       0x51e1ea12, 0xd414fcfe, 0x5f3f9443, 0x7e61fb80, 0xea81757b, 0xed91abef,
+       0x7afd922f, 0xefec8560, 0x3a4bca33, 0xb225cf32, 0xbd0bf777, 0xa4ad3cc3,
+       0xf035e7f7, 0xfe7d3fef, 0x2b5fc3f3, 0x7841b50f, 0xf79410d9, 0x775fb504,
+       0x22b6fb03, 0x82c7fbe8, 0xe504d7ea, 0x6be507d7, 0xcd17dfb4, 0x8b0e4852,
+       0xc9fdf046, 0xe60cb960, 0xda522f8f, 0xf6ed63e3, 0xff24895c, 0x1357234e,
+       0xfafe79aa, 0xa829fff3, 0xa7c80c89, 0xb21e89b0, 0xc05a30ef, 0xb9d041fd,
+       0xc1f8151e, 0xbcde89d0, 0xecde99d8, 0x79ef6c13, 0xd7f03ffd, 0xd22fda24,
+       0x54fb25f8, 0x9551be6d, 0xbbbd4770, 0x5f603228, 0xe2265995, 0xfdf3baba,
+       0x6389889b, 0x22fc0352, 0x6744f84f, 0xfb653cc0, 0x575d5f71, 0xd4f8bc71,
+       0x719b89f0, 0xd8b4687f, 0x14f1b4d7, 0xf68aa5ec, 0x6fc452ba, 0x5d39e1c6,
+       0xebee176c, 0x0fd030b9, 0x70bd7562, 0x523f8d9e, 0xd550bbf9, 0x53c01f40,
+       0x79d3b311, 0xea7899d3, 0x47d43bbe, 0x0df92f47, 0x47efb77c, 0xd3b412ea,
+       0xd2c49747, 0xa945a639, 0x17dcefdc, 0x366135dd, 0x1e231be4, 0xf8db7d26,
+       0xf74a58c4, 0xad95ceaa, 0x353ae856, 0x5f646279, 0x3c268fac, 0x4fc43639,
+       0x9dfc065c, 0x38276a99, 0x426b36dc, 0xabdbfa3d, 0x085fb40d, 0xfc457e2d,
+       0x3069a4f3, 0x968bb7ae, 0xb0fda7f5, 0x1a4f9fe2, 0x8ab0f787, 0x3ed0371f,
+       0x4ace8b49, 0xeaf72271, 0x6a2e74b1, 0x7a910ad6, 0xcdf4a2ee, 0x1abafcff,
+       0xbeb569ef, 0x0efbd0a0, 0x7bad5c77, 0x9b9e1067, 0xf74ee9ac, 0x7580de2e,
+       0x3efb9e00, 0x17b7bebe, 0x089f21cf, 0xa473a2ab, 0x8bee9ed0, 0xbfb35e95,
+       0xdb0b313b, 0xd0e5d6ab, 0xa39414fe, 0x956a7cff, 0x41ef09ba, 0xc2594515,
+       0xa9f6fcf1, 0x75c518af, 0xa26e3d4e, 0x478e2277, 0x8fac67ba, 0xe8b8fba3,
+       0x8a53b3e9, 0x3c014a3d, 0x67d0da4c, 0x96126262, 0xfb7d049b, 0x1e011544,
+       0xfced748a, 0x24a4f643, 0xa527e786, 0x05b899f6, 0x97ea71e6, 0xd87ce9bd,
+       0xe4e754c1, 0x2fd7c054, 0x52539cd2, 0x6e5e11e3, 0x0ffcdeb7, 0xe3fc8fdf,
+       0xe404e285, 0x395287af, 0x56d1bf5f, 0xbef8109c, 0x3d45c977, 0x469bc1f1,
+       0x277a22fb, 0xc14d3c30, 0x41f03675, 0x67cdc62c, 0xf00b7589, 0x219d92f3,
+       0xa9e1abfc, 0xf1abd12a, 0x48d9f1a7, 0x0f5f3f5f, 0x19f5177f, 0x5f2037ad,
+       0x2d7321b1, 0xa693b9da, 0x0f44ec25, 0x91fe7ed6, 0x3c230bed, 0x7985b619,
+       0x7e3032c3, 0xfc871cea, 0x7aeb12cd, 0xc804b64d, 0x77ff68a1, 0xfbe73f0f,
+       0xeb8f6877, 0xfe7bbfbe, 0x9fb812d7, 0x4697db21, 0x5ce83c59, 0xf458b69c,
+       0xfaa38f48, 0x3cf0a7a5, 0x060bc95a, 0x2f2503b2, 0x8ad63fc4, 0x06f807fa,
+       0xf3c16be3, 0x81aa63fa, 0x933a31c7, 0xad18cf4b, 0x1331b25c, 0xc99dbe71,
+       0xdc86cd65, 0x3b239b89, 0x2b52cb97, 0x5ee34fd7, 0x9651efe0, 0x71e8b50e,
+       0x0bf4737f, 0x7ba16d6f, 0x86c20b74, 0xd289bde0, 0xaf444c17, 0x63c58b16,
+       0x13ef0dbd, 0x9031f458, 0xedca9b3e, 0x9f90bd69, 0xcde9955c, 0x7ba52843,
+       0xf0df7212, 0x9e6792ec, 0xe797e3c5, 0x70da7798, 0x2765dfc0, 0xbbcbd3e7,
+       0x063f8a54, 0x1f9623ef, 0x61cc69dc, 0x788fb137, 0x32c3fd83, 0xdfde22d6,
+       0xf07dfd0d, 0xa9abe1fe, 0x0687fbc1, 0x2a5e4fba, 0x37730ff6, 0xe9770428,
+       0x3fcf7e12, 0x8dc79637, 0xfa052e4f, 0x1ede691b, 0x0f3c10eb, 0x294eedcd,
+       0xf866bc53, 0x0b0daef5, 0x13d98e28, 0x6e7184f1, 0x89e26ef1, 0xae3a4730,
+       0x085e4bf3, 0xfe96fc23, 0x7e5fee6a, 0xfaf78599, 0xd702e20a, 0x2f91fbd5,
+       0xde197e38, 0x9cfd941f, 0x7a63f65e, 0x45f731a7, 0x7cc31f58, 0xabd8634a,
+       0xbd2067f7, 0x9f71d292, 0x5d2bb653, 0xbc5ea3fe, 0x61afac1d, 0x4ab45d1d,
+       0xecc7efe5, 0x041d9136, 0x01644f59, 0xad672cf7, 0x72346838, 0x8712c63b,
+       0xeedaff09, 0x1c769fbf, 0x6eeaf1ea, 0x2687b8a5, 0x51ef27f1, 0xfbf8e915,
+       0x853a8574, 0x268157ee, 0x97497ba3, 0x7b5fb953, 0x679f953a, 0xd0774a28,
+       0xb5f29cfd, 0x0cf2c726, 0x7dfb4fde, 0x95df584f, 0x684b9aeb, 0x26f7f33f,
+       0xae54ab8a, 0x45867308, 0x3b17f3f1, 0x6af9d006, 0x51f011bd, 0xe2fae766,
+       0xa56f98b2, 0x745dd27d, 0x8ecf419f, 0xdcbea1e8, 0x7963f5c2, 0x923de00c,
+       0x186e8a33, 0xe8c767be, 0x9bf624dc, 0x7c602834, 0x3f439445, 0xbf7f28f6,
+       0x83563a4d, 0xdf6c1b71, 0x31e21077, 0x8474da76, 0xe49515ef, 0x76b49019,
+       0xaf7dfa04, 0xdeb899a8, 0x6fb55a2e, 0xf9dfea1c, 0x8de307db, 0xeaf45609,
+       0xe63f6407, 0x88b7fa0b, 0x90c56773, 0x22b677c7, 0xb93cb8d2, 0x8a2f1e55,
+       0xef345348, 0xf2fac910, 0xbf1e0655, 0x8a8f3d07, 0xc7d97ca5, 0xa5b96fd4,
+       0x6ff50139, 0x30c36ef9, 0x6951d3d4, 0x978b2e5c, 0x011f65a5, 0x44362abe,
+       0x6583bbd3, 0xe623029e, 0xca156acb, 0x4f8bbffb, 0xbf3d3e47, 0xe428b5e2,
+       0xbe61139f, 0x5a97689e, 0xe8398417, 0xc795a1de, 0xe8afceeb, 0x6695f749,
+       0xf82d9b59, 0x45acc19e, 0xbfa86ddd, 0x467d5a8f, 0x975a3fac, 0xd3bcc3a1,
+       0xbcc6cd6a, 0xe51b7f53, 0x2df38bcf, 0xa57c83f4, 0x6d973a70, 0xbfc467db,
+       0xcc44324f, 0x1f2be2f7, 0x4ff8c2f4, 0x2f737a79, 0x07c02bb4, 0xcf1052bd,
+       0x9764292f, 0xf3f1b62b, 0x2a0f92ee, 0xee400f90, 0xa83e09e6, 0xf7daf5d8,
+       0x902a1e51, 0xf23a43fe, 0x7ef3f011, 0x71b1df2a, 0xefdfe31c, 0x76913e47,
+       0x0c2bf20c, 0xf1df8c36, 0xa71a667c, 0xe18f943f, 0xfc019ee5, 0x39fb5d1c,
+       0x741c8d04, 0x1a575f46, 0xcbc587b7, 0x5d6fa44c, 0x5a1e5c69, 0x428eed56,
+       0x657c5dfa, 0x67dc01df, 0x5601df29, 0x1e421eda, 0x712a3e04, 0x3f0451fe,
+       0x389517f9, 0xfcff28df, 0xc85ef9db, 0xf3e32561, 0xd4adf393, 0x7acbf98b,
+       0xc124fdf1, 0xe04c652f, 0x2e6f576b, 0x50ce4277, 0x0ebde98e, 0x4db73f31,
+       0xf7e50efb, 0x22dcfcc5, 0x28bad665, 0x17d20fc4, 0x103e0ff5, 0x04fa9469,
+       0xbedc5c9a, 0x4bf1ce91, 0x57f8497a, 0xdf403809, 0x7e6c6339, 0xf274b63a,
+       0xe095644e, 0x778f639b, 0xfc07af49, 0xcf4adf9d, 0xeabf116c, 0x7c93c603,
+       0x7dcbc723, 0x38ddd279, 0x87dfe86f, 0x8f71cbfd, 0xd8f4227a, 0xe5c651cf,
+       0xe52fc243, 0xa1fab732, 0x614707bb, 0xee968bbb, 0x9cde7003, 0xacd2ab8e,
+       0xfd13bdf4, 0x59def805, 0xfadc50af, 0x1fe75898, 0xa8b5fc7b, 0x7e7e01e2,
+       0x277c427f, 0x307f0cf9, 0x6de1263e, 0x7038f1b2, 0x0f52dc30, 0x9f73b849,
+       0x2c6eefb8, 0xbee3f097, 0x4a9f2051, 0x957e4a3c, 0xf982f5f7, 0xda4e7896,
+       0xfe73b54f, 0x463d4cae, 0x943a77e7, 0xfc27f707, 0x5ce213a2, 0xe33c6b79,
+       0x8915ff71, 0x8af735fb, 0xb40c8b18, 0xc08ed23f, 0x807d1acf, 0xa7bf69fd,
+       0x8b3ce716, 0xd690bb74, 0xc73ffa8d, 0xd0398cea, 0xe699d96f, 0x9dcef871,
+       0xb8ef43f4, 0x31a353ea, 0x9f8bb55e, 0x52fc9377, 0xc93f6176, 0xffb8b941,
+       0x83eab454, 0xefc8e182, 0xbed035bf, 0x63e3d14e, 0xcfdfe88d, 0x187332dd,
+       0x41ef01a2, 0xbb3f5ea0, 0xbf266879, 0x984d6059, 0x3621f786, 0x01ed333f,
+       0xaf559f28, 0xd80dbbd2, 0xd16fca0f, 0x5f1499a3, 0x52d6113d, 0xf8fd0a30,
+       0xf456a81f, 0x32df6fe3, 0x7f6c31f4, 0x0c6ba5bb, 0x39b1b63d, 0x7d4ef296,
+       0xe907d934, 0x8073caf7, 0xc7dee2d5, 0x3fde845f, 0xe22a9edc, 0x2f755ffc,
+       0xdd6f8fdc, 0xacef4618, 0x75ed1a14, 0x4f6f1c3e, 0x54675a17, 0x23eaf11a,
+       0xbf255bdd, 0x99918e6c, 0xb9508693, 0x0fca0939, 0x451f9a1a, 0x51f0723b,
+       0x3f7c60cb, 0x86d7a992, 0x9a7f7315, 0x6ac63bef, 0x70912ddf, 0x0fc6247c,
+       0xdf7e4fee, 0x1b08eb84, 0xefa44fdd, 0xedf8aecf, 0x6783b434, 0xe1b4f6b7,
+       0x09ef4fbc, 0xa703fba3, 0xcf77da0d, 0x57def56e, 0x79297df0, 0x9a74f56f,
+       0xfc938fd6, 0x377bc37e, 0x839ed37f, 0xa5b9d1bc, 0xdd194b0b, 0x8d397efb,
+       0x2263f7d1, 0xe789dabe, 0x4d6a4b08, 0x7307bc56, 0xf71ef912, 0xfcab76b3,
+       0xcb99a5fe, 0x99ddc9c1, 0xe4b7bf74, 0x525f3c6f, 0x3ef178a7, 0x9fa7fef2,
+       0xb30af3a0, 0xabc4cfc1, 0xf3feed09, 0xa1a7a7ba, 0xb8765c38, 0xfe7de257,
+       0xf9f95bcb, 0x32ef0e8a, 0x2079dc1c, 0xdfb9dec9, 0xcbfb5dfc, 0x9f110e32,
+       0x2fcfbdae, 0x4fd72cf1, 0x8c3f026f, 0xdbc7e218, 0x90e74b67, 0xa9617cbf,
+       0xca4bd29b, 0x23b7b5b1, 0xe9a25b1f, 0xeb1fc0be, 0xbdf1519f, 0x835df2a8,
+       0x783ae1af, 0xbd346454, 0xd2d9f293, 0x7a8fb425, 0xa5156961, 0x0e32de92,
+       0x46aec777, 0xfab3eefa, 0x9fbc06cc, 0xb46446fb, 0x90b603b0, 0xdeeced74,
+       0xb9d79cb1, 0x4afa701f, 0x9d6dcfb8, 0x6af38519, 0x61b63e7c, 0x2235d224,
+       0x5f7e8ada, 0x724738a9, 0xabf73d6a, 0x7fa398cf, 0x3df40f93, 0x024a61b3,
+       0xbb3737be, 0x5869def1, 0xb147b25e, 0xb1c07ae2, 0xae145267, 0xb7d53edb,
+       0xa8fde144, 0x7bcbd74f, 0x3bfa5e55, 0xd8f2a354, 0xca3f6c14, 0x0cf667a7,
+       0x7c8d75be, 0x9e82f232, 0x879ebfee, 0x5c938a72, 0x0938a70b, 0xb9e2c4fc,
+       0xf3afd991, 0x3afb4af8, 0x6ef3ac57, 0x347ef317, 0x31f726dd, 0x04773ca8,
+       0x61bd3f2f, 0xefec44e7, 0x158366ec, 0xb36cfee1, 0x079ffa81, 0xc01d33eb,
+       0x5f2b667b, 0xd71e60f7, 0xf2b767cb, 0x3abccdf5, 0x5f29bebe, 0xfbf27060,
+       0xcc7e5aa2, 0xef47680d, 0x5ef274fb, 0x9f273cc8, 0x97b03cdf, 0xbe60df38,
+       0x7475618d, 0x9e9bec8f, 0xdbe60d17, 0x855f92f9, 0xd7e7687e, 0xe044f8ce,
+       0xf91de513, 0xbcc3f255, 0xdedf7cf5, 0x07383756, 0x47f24ef9, 0xd5593bf0,
+       0x57dfc646, 0x7bd385d4, 0xed2293b8, 0x530fb406, 0x20c65ae2, 0xe74e3e5a,
+       0xab9a807e, 0x37bde273, 0xf90a6d56, 0x748acece, 0x744557ee, 0xdeefc465,
+       0xcf3f2b74, 0xc97fee29, 0x86922614, 0x84527b76, 0x343b0bed, 0xaefd3a79,
+       0xcfc0f47b, 0x3db76e93, 0xd8c1ddda, 0xee0bd32f, 0x267cc3d1, 0x7776da65,
+       0xbff3fc83, 0xb7f3c09a, 0x201a86d9, 0x78994cbf, 0xd7c818cf, 0x4a9f3ba7,
+       0xece7180f, 0x38692e96, 0x19ff283f, 0xbbc5d796, 0xa5698e7f, 0x49760fb8,
+       0x24b41d69, 0xfdfedfc3, 0x7fa3963d, 0x2df3fbb4, 0x18ee9606, 0x7f097980,
+       0xdd25b4e8, 0xf8f4abf9, 0x8cc5e58e, 0xf5e74e3d, 0x0e1efc3c, 0x09ccb8fc,
+       0xf38a4f78, 0x97bcb15b, 0x2f741353, 0x9fefc1c7, 0xf252fbc9, 0xff5f543e,
+       0xb70db27d, 0x92ec9f72, 0x2a1dff81, 0x0fbda9c5, 0x89fc34a6, 0xf6a9f9de,
+       0xa23096b0, 0x4d9ef683, 0x7753be39, 0xa20bdd1b, 0x6f4c87fb, 0x57337d27,
+       0xac683bfa, 0x29dff987, 0xfcfc8960, 0x1f82a3c1, 0x3d652f4f, 0x9fe8807a,
+       0xca39b77f, 0x985c700e, 0xfa85ebe8, 0xfddc3220, 0xe9d7c427, 0x0ba9d50d,
+       0xaa1ef0e3, 0xed0f91c9, 0x7df978cf, 0xb7e132ce, 0x42f1cdb2, 0x3bbea82f,
+       0x46535da1, 0x87684ddf, 0x757c17de, 0xfe97c321, 0x192bd423, 0xed049d7c,
+       0xde5d3ce8, 0xb1e2bbf2, 0x4fed85dd, 0x700d98f4, 0xbc06009b, 0xfa1e35a7,
+       0xf7a3611c, 0xfb4a98aa, 0x7efe5ecf, 0xa2799e92, 0xd5eef86c, 0x3ee2e933,
+       0x9413dd11, 0xeff89274, 0x1a181740, 0x999d59fd, 0xbeee1019, 0xfdfd036c,
+       0xf91f492f, 0xddc2e2ce, 0x7742fe3c, 0xe31e4524, 0xe2cda748, 0xb0759fef,
+       0xbf916f8b, 0xd1e9620a, 0x330d9fe8, 0x11c9db43, 0xf5d88d1b, 0xff2f6d77,
+       0x92fc2e9d, 0xe0706cc1, 0xa2a5923b, 0xd0b558cd, 0x2d5bef8e, 0x7bd3378c,
+       0xe85f0b25, 0x96c1fc4e, 0xb60590fc, 0x89621b63, 0xa866565f, 0xf5b9ff84,
+       0x2a1dde8c, 0xf3a64fa8, 0x36f5f994, 0x12daa34a, 0x6fecfca9, 0x7ae2c9de,
+       0xe0a7d389, 0xa68cba7f, 0xd3ff4b73, 0xd9d6529b, 0x6691a77b, 0xf0bbcfba,
+       0x0b6bb720, 0xc7bfcaa7, 0xbbafefc2, 0xc8ae3804, 0xb90b8a1a, 0xe753dc3a,
+       0xf0ba57ef, 0xe77e00be, 0x677d5034, 0xfc4a57ef, 0x82dd049a, 0x7a9cb3df,
+       0xde913330, 0x59ef147f, 0x9aed174e, 0xceb3bdc5, 0x4fbcb5de, 0x6a227bb4,
+       0xddf2135c, 0xc8696774, 0x9ef52d77, 0xcffa0730, 0x7a48d486, 0x373ee147,
+       0xf59a97f8, 0xf11e8b4c, 0xbf9b2d30, 0xba753973, 0xfd90deb6, 0x4373e939,
+       0x92778776, 0x4d8fa80c, 0xecfb6d2e, 0xf50ec2ae, 0xf6bf7d65, 0x2354d15d,
+       0xbe3d4fd9, 0x69f90b3b, 0xf4515de2, 0xbfffd10f, 0xff10b4ec, 0xb83bc49b,
+       0x112b2ccd, 0xbeadc2f5, 0xdbfffb27, 0xefc1b1fb, 0x03bf06c4, 0x42eb7fdb,
+       0xdd607e4d, 0x6fed350f, 0xa9ae5fab, 0xad5bec1f, 0xfa6ccfa9, 0xb43f2699,
+       0xfb4d39f9, 0x693647e1, 0xbcb647ea, 0xfdbfa9a4, 0xfe4d0ecc, 0x683fd68e,
+       0xb6d9dfda, 0x61cf9357, 0xe7da68ef, 0xe4d03f9a, 0x57ff5ac7, 0xc4aefed3,
+       0xf1fa9a13, 0xfa9af3f6, 0x68ae7d09, 0x2f8e05f2, 0x373fed35, 0x457757ba,
+       0x0cea22bf, 0x433aadf1, 0xf944f861, 0x6629a6e5, 0xba6b07d4, 0xf8247d0a,
+       0xd3b0b96f, 0x7ba307ac, 0x6cd563ac, 0x3d5ff11f, 0xc1a0bbff, 0xde7f4f76,
+       0x1ff8c4e5, 0x6bdf8d7b, 0x527f068b, 0x8c7e301f, 0xff02ccd3, 0x9e6c5dee,
+       0x778f9355, 0x77da6a25, 0xd4d76e99, 0x68fbb927, 0x38e653ea, 0xaab4f934,
+       0x5df69a11, 0xf9353897, 0xa69e4f0c, 0x971af77d, 0x76b3df26, 0xef7da6ba,
+       0x7d4d6ef5, 0x4d1cef5f, 0x55adff7d, 0xbac0fc9a, 0xb7f69a25, 0xf5347bd5,
+       0x9a357d83, 0x5aa6ccfa, 0xf3687e4d, 0xe1fb4d7a, 0xfa9abc47, 0x355b2d91,
+       0xa99fb7f5, 0x68efe4d3, 0xbfb4d7ad, 0xc9a7cdb3, 0x9a83b0e7, 0xf7e6b9f6,
+       0xd6b1f935, 0xefed344f, 0xa9a63c4a, 0xab3f6f1f, 0xce7e97a9, 0x6b9f3e84,
+       0x53df85cb, 0xe697f8e0, 0x6ef7f6fb, 0x1f742877, 0x6ed75cea, 0x96c57df2,
+       0x24fd1530, 0x6c99c517, 0xf5111078, 0xb727de15, 0x8539f3f1, 0x238aaf14,
+       0x944c887f, 0x810bcf1d, 0xab8510df, 0xf40c8cb6, 0xfefc23ab, 0xccf5ea5b,
+       0xdadff79b, 0xd5dcff84, 0xf288beee, 0xfb6eaf31, 0x989f7a38, 0x1c225679,
+       0x77bffdf2, 0x956dde83, 0x19f378e9, 0x17f00fa6, 0xa6d5860f, 0x389af90e,
+       0x05f378c1, 0xb6c1ef86, 0x22e22bf7, 0x17bdc7f8, 0x16bff406, 0xf7f817d6,
+       0x9a976b23, 0xffc76fe9, 0xf295a96c, 0x522696eb, 0x3a00fffe, 0x0047bf29,
+       0x000047bf, 0x00088b1f, 0x00000000, 0x7dedff00, 0x4554780b, 0xeedd7096,
+       0x9d248fdb, 0x777579d0, 0x493cdc9e, 0xf09d0848, 0x3a3e00d8, 0xc0406021,
+       0x490435e6, 0x41a8c1a4, 0xf881ba43, 0xbb75744f, 0xb2021031, 0x10d191b3,
+       0x0186c195, 0x099d1964, 0x09d1a32e, 0xe09af09a, 0x1c604c3a, 0x3719d9c5,
+       0x8ee2a3a0, 0xcfe31e10, 0x7fc38fee, 0x937ba9ce, 0x380e9dbe, 0xf7ff3afe,
+       0xb4fbfa3f, 0xab755538, 0x739d554e, 0x2aaa3cea, 0x89895ead, 0xde6d6322,
+       0xf39f4a1c, 0xc99899da, 0x316f36d8, 0x0ebddbc1, 0x72defd82, 0x9d7a774a,
+       0x5bcbbf94, 0xaf1ef041, 0xdebdd28b, 0x79f74a1a, 0x92fe543d, 0x9fe081b7,
+       0xb6947d7a, 0xff299b7b, 0xc10b6f15, 0x046dbc07, 0x53f5eabf, 0x4bdde1da,
+       0x76de1be9, 0x76f4ef2a, 0xb7a6fc10, 0x6f2ee08b, 0xbc87c10f, 0xf11f04bd,
+       0x98f8269e, 0x1ed28fb7, 0xbe9467ef, 0xf2a7eded, 0x0957bc77, 0xdbbf8ebe,
+       0xcd2afc19, 0x2631e49f, 0x7ae69730, 0xc9ccc21e, 0x00f63226, 0xff824bfe,
+       0xcc8846e2, 0x8cfdd8c2, 0xb0d73eff, 0x9413769a, 0x3ff2fe77, 0x74c60285,
+       0x1f8d8ca5, 0xf662690f, 0xc634c6ce, 0xe675b026, 0xd318724f, 0x63d75740,
+       0x4e09fb07, 0xd6191319, 0x2d75dfc3, 0x58c7dffe, 0x94bffc3c, 0x834c78e5,
+       0x14095369, 0x55befb42, 0x1a777f82, 0x3e20d755, 0xbf1c8dab, 0x95135a69,
+       0xf82c3e57, 0x5563020d, 0x8be9f322, 0x587dfb18, 0xc11b0154, 0x2e8f25d8,
+       0x2172c447, 0x04830edc, 0x443a8ff8, 0x2c5d7e0e, 0x9da5b18e, 0xd29b1d86,
+       0x84aaf106, 0xfdf035ef, 0x0c1a562b, 0x3a3d64ab, 0x1df203c4, 0x9ec618da,
+       0x4ba6b8b7, 0x8a60ff90, 0xf687a7c6, 0xed9fc999, 0x2dec648c, 0xe6066b8b,
+       0x77dcf25f, 0xc07f1b0c, 0x7ec6cf6c, 0xe2ba1b66, 0xfdff4117, 0x9df6b5c7,
+       0xe1f3f0d2, 0x6c67296e, 0xdfca0ddc, 0x02ec973c, 0xa2ffca3c, 0x9ffce175,
+       0xf85645d0, 0x492f01f3, 0x1a4a78e0, 0xeadb3a55, 0x7cf8825a, 0x47b9e919,
+       0xe5f85303, 0xacf6ab6d, 0xae552181, 0x82e11aca, 0x2582eeef, 0xcd8c1963,
+       0x418e9265, 0x38e67cf9, 0x2d4d069a, 0x17822e64, 0x6fa51f31, 0xb1aabbc5,
+       0x4fccc59d, 0x21b26bb0, 0x82b8d435, 0x78cb72f1, 0x947c65b9, 0xabab71f4,
+       0x20e5e38e, 0xba4c4ebc, 0xa5c71b23, 0x5596f5e0, 0x58737aa2, 0xefc476ff,
+       0x3f1783cb, 0xd2863211, 0x174077c7, 0xeb1e6826, 0x73ac3d31, 0xf7d18ea3,
+       0x7e088f8d, 0x2e856ba4, 0xb791992a, 0x0be418fb, 0xf4027481, 0xd2fc8451,
+       0x92373a9f, 0x0949e4e8, 0x92707c1a, 0x0b1fa7d6, 0xb3f8d4e3, 0x87d12d05,
+       0x1efc005e, 0x48fa0388, 0xea0e9e1f, 0xe00d219a, 0x67afa01f, 0xaff3bdb0,
+       0xce0e5dff, 0x49cdfb97, 0xa357ce12, 0xe801d606, 0xd6b6f7d8, 0x99925bbe,
+       0x94ed6014, 0x6ba47e31, 0x73edda26, 0xb17ae0c7, 0xdfa84ea5, 0xfb0d65ad,
+       0xfbf687f3, 0xb417ae2a, 0x2ba6c27f, 0x9cbb53f7, 0x9ff295cf, 0x63c5fae2,
+       0x5eadebca, 0x16ad69f5, 0xe8713ff0, 0x131a5e9c, 0x6f0d1c62, 0xe00666e7,
+       0x3338eeef, 0xe44261dd, 0x45e7f2fa, 0x949fe60e, 0x1fa144e9, 0xb5d23ead,
+       0x178814c3, 0xf9e817ef, 0xd13744e7, 0x4419cf40, 0xe0f89fcf, 0x690639d3,
+       0xfb4822c4, 0x20ba6a60, 0xd660bd75, 0x672cdd23, 0x99ab4a76, 0x6007d293,
+       0x9d7e91f9, 0x38f4a7be, 0x76b20fef, 0xbe2bafca, 0x7cf482d7, 0x8a95c6bf,
+       0xa5eb2d70, 0x2feb377c, 0x2dfcc1b3, 0xd47b5e6c, 0x6fcf5806, 0x025a6a79,
+       0xff3cefcc, 0xce98a3b2, 0xe27c25dd, 0x7a3f8893, 0xc13eaf10, 0xfa113eb3,
+       0x92a5fbbf, 0x3f9049f5, 0x85d7cb47, 0x175f2bfd, 0x8f047e45, 0x97a1f81b,
+       0xe341cb8f, 0xab9546d2, 0x09f2a1f8, 0x9da010e6, 0xff0683fe, 0xfe00b4ce,
+       0xdfe87e28, 0x898e5093, 0x7ae0f7fd, 0xc434dfbb, 0x083f7ae0, 0x29c71be2,
+       0x806b1838, 0x2ad690fe, 0x882a8863, 0xe1621fde, 0xb9f7ac76, 0xa79fdf4c,
+       0xcfefa230, 0x4060e605, 0xa67417bf, 0x5ae50166, 0x0456cbaa, 0xbe60acf8,
+       0x6ee50626, 0x38054bcd, 0xd725234f, 0x1fd744a7, 0xa61537b5, 0xa7f7fca1,
+       0xf7ff280a, 0x698dec19, 0x5d84fdaa, 0xe321408f, 0x3f9f3861, 0x0ec776c0,
+       0x3e284bc5, 0x14429ff6, 0xf33d0663, 0xbf888b19, 0xebe444d9, 0x57f13d44,
+       0x066d4e23, 0x3c94e3f6, 0x9feda1a6, 0xf9edf190, 0xef744b4a, 0x16ecf183,
+       0xf7c3f542, 0x60f8432b, 0x2c3f243f, 0xa7d1fa8c, 0xfa563e71, 0x64bea663,
+       0x6a75d027, 0x86974b84, 0xc716c182, 0xcb998be5, 0x4fb49e97, 0xe67d7133,
+       0xc8a8de4c, 0xdd8f6a65, 0x09d1e5c6, 0xf843e49d, 0x1d9a4944, 0x9c80d724,
+       0x97f8abbd, 0xbb8f11a7, 0x2d2ea68c, 0xdd16eca4, 0x7d94fa9f, 0xff707d30,
+       0x7fd94bbd, 0xeffbe16f, 0xefb5991c, 0xf1babb12, 0x3aecc67b, 0xfd972fc4,
+       0x6d8f995e, 0xf22adfb8, 0x0b7ec871, 0xf9c5eb03, 0x832b2513, 0xc7c0b574,
+       0xdc253abf, 0x36c47c8f, 0xf4f8d2e7, 0xfe0cfcb2, 0x58c15ade, 0x13c651a6,
+       0x19704bfe, 0x20ce6659, 0x5663549c, 0x9b1e29c1, 0x06c8feaa, 0xe69e5549,
+       0x679551cb, 0x7055db34, 0xaab14b56, 0x8736a8fe, 0x97f5ce0a, 0xede7eaab,
+       0x31e0aa75, 0xfaaa15ed, 0xaa5c3b63, 0x1aaec2f2, 0x1eb8f955, 0xd09e0a8f,
+       0xffaaa0db, 0xaa7da777, 0xcd7d49f2, 0x9f29f2aa, 0x5be0a8b5, 0xf554dbfb,
+       0x57eabf6f, 0x7fb09795, 0x354f9556, 0xd3c157ee, 0xeaabafcc, 0x16fb80bf,
+       0xb61dcff0, 0x0cfe556e, 0xbbeab8e9, 0xaa4e733b, 0x75e417e0, 0x270e2df6,
+       0xe72d68be, 0xfb6cd1fb, 0x5876aa07, 0xfebe68e7, 0x7b6f3c61, 0x510b1fcf,
+       0xf4d76e4e, 0x4add21a7, 0xf222735a, 0xdcf16671, 0x2c664043, 0x14aab1db,
+       0xf94e5bc5, 0x1d308753, 0x8a5fdced, 0x715f926c, 0x05a610f2, 0xd0a58bae,
+       0x44d7b31c, 0xc8b4c61f, 0x8ad53853, 0x3dcc34a8, 0xdf44e98c, 0x5728a9aa,
+       0x3f5c785f, 0x2a28f91a, 0x074fa146, 0x827d67d1, 0x7eb9f886, 0xf28fc9b1,
+       0x24c532c7, 0x96139032, 0xb1d65a1f, 0x9a8b4c02, 0x1af66d31, 0xfa0f5f99,
+       0xba519780, 0xfe666bc9, 0xaf67206c, 0x93fae08d, 0x43a795f7, 0x44ab233b,
+       0xe699aa33, 0x48258f51, 0xe5f5bed0, 0x765d9c96, 0xb0edd6c6, 0x42e5d7cf,
+       0xc59e19ff, 0x4e01a23b, 0x30058e63, 0x2398167f, 0x25b19936, 0xfa76df3b,
+       0x97c287f2, 0x244d9d33, 0x5cf6c417, 0x7694ffd4, 0x6e7e9637, 0xdf2198d7,
+       0x11e74bf7, 0xf1adf798, 0xc21df4e1, 0xa75f9925, 0xb60b475d, 0xf69ef90b,
+       0x4cfc7c10, 0x977fdf1a, 0x0a7d73a4, 0x66eb8487, 0xacc6cbe5, 0x808ca7a0,
+       0xa93adcb9, 0xf0ea0ce1, 0xa027d9a2, 0xe0d7627c, 0x892b907b, 0xe0832958,
+       0x4e01c3db, 0x6c625840, 0xc7eb967f, 0xc5d5afd8, 0xfa00d9d8, 0xc351a849,
+       0xcf9e615b, 0xa3e20e66, 0x89f1aa5b, 0x8fdd0630, 0xf43b769d, 0xc60aadb3,
+       0x3d56f00b, 0x7a9437d7, 0xf68c34a3, 0xf8d32ff7, 0xcdaece7e, 0xf49ea3b7,
+       0xe79e3ca5, 0x3e8bfdbc, 0xeb7b44ce, 0x3589a52a, 0xf205c11e, 0xb4e95acd,
+       0xae9ea0fb, 0x8423e611, 0x348bf2de, 0x1dd7be91, 0xa090447e, 0x1269a7de,
+       0x7e9589c1, 0x0d52771a, 0xbf801bb4, 0x6609f44d, 0xe63db7c8, 0x9b3f1013,
+       0xf06769d9, 0x885a331d, 0x3cc8d7fe, 0xcbf86b61, 0x0f418fa2, 0x769d79d3,
+       0x13bba7ac, 0x271f33e8, 0xb86663d4, 0x47e3c94e, 0xa3eb10b0, 0x0d3e86a4,
+       0x9f40dc73, 0xd47d4a8f, 0xddc5fb43, 0xe80b2926, 0xa6c585fb, 0xda211d8a,
+       0x9f9e54fb, 0xfeea310d, 0x1f3e5a2d, 0x6cbedc8a, 0xf0a8ebe6, 0xa6689af1,
+       0x526be392, 0x846f5bc6, 0xc8cdb5af, 0x6ef8015c, 0xd0cc7e85, 0x55abe1be,
+       0xe83f1c66, 0x4fea4ed0, 0xc764f2e4, 0x6ec8728f, 0x21c75e0a, 0x3f9408f4,
+       0xa3e908a2, 0x7c08dfcf, 0xdbd2a868, 0xfeb26f51, 0x7b809343, 0x116b2273,
+       0x5358be50, 0xdc447aca, 0xae5744d7, 0x793e8433, 0xd654ba33, 0x839fd94f,
+       0x3d774bd7, 0x9c12fde3, 0x31d57fef, 0x1f56c7d4, 0x05718f8f, 0x3a4c53d0,
+       0xd662cba7, 0x98fe45a2, 0xbd29dacc, 0x7a52f585, 0xd4a7eb1b, 0xa622ccc1,
+       0x694ecca5, 0x3a527319, 0x2d28799d, 0xce942d67, 0xce94ed64, 0x8294bd62,
+       0x93a9433d, 0x9aeec999, 0xa637fb07, 0xd293980b, 0xa50f31ef, 0x7e9ce999,
+       0xc10b582b, 0x4a76b377, 0x24ef803b, 0x8c01fa3d, 0x9c827694, 0x904df4c3,
+       0x79769873, 0xa3652625, 0xd287201f, 0xa53b5e23, 0x94c5bcc7, 0x541d78f6,
+       0x396f6def, 0x9d78efa5, 0x56f09e94, 0x75ebda50, 0xde53bd51, 0xf5df4a1a,
+       0xcf7d287a, 0x69e940db, 0xdfd28faf, 0x1d299b79, 0xc67e07a5, 0x2be9cdf9,
+       0xf53e7d44, 0x0243bd23, 0xe591ecf9, 0xe68761d2, 0xb8f1dc99, 0x40661a6e,
+       0x235b283a, 0x7359fd20, 0xa43f0e34, 0x0b56729b, 0xe1ba42f7, 0x0cdfd704,
+       0x0fd248d6, 0x82f56dad, 0x0876ed04, 0x5808da7d, 0xa9e9e9cb, 0x9f208d73,
+       0xbad93a4b, 0x19c23b08, 0xee81194f, 0xfd3ce876, 0x64bca03b, 0x08d734a7,
+       0xc8e4d67b, 0x8fb1ff53, 0xe93e54c3, 0x03346b08, 0xfb3d2b3c, 0xe38138a9,
+       0x7befc281, 0xaee6733b, 0x253c44cd, 0x34c5f3c2, 0xbf512c30, 0xfa44c47e,
+       0xd9db6175, 0x93c00d42, 0x68454c1a, 0xebd40617, 0xae1fba42, 0xf2b9705e,
+       0x9655b6dd, 0x0d879c46, 0x0e5a809f, 0x7d19a959, 0xd5f3ab85, 0x5ebe6aed,
+       0x837b4cff, 0x09eb03fe, 0x7f6f6837, 0x7d32a396, 0x3a7effc2, 0xdd6fa60f,
+       0x6bf68ff5, 0x8e640fc8, 0x5774fdc1, 0xfd339734, 0x04ee9fa0, 0xc8c577bc,
+       0x1a4cc6f0, 0x5c43ca17, 0xd29b0db7, 0x77803efd, 0x1f573985, 0xd47ff2c7,
+       0xd14277d8, 0xa6d770ae, 0xc933825c, 0xc621b13f, 0x8f931393, 0x97df3cfa,
+       0x0d1f935a, 0xbff80293, 0xafcb9d39, 0xe95cb7ad, 0x447681dd, 0xc16586b3,
+       0x979b3b77, 0x7681cc6f, 0xf419bc7e, 0xdc478007, 0x0b31bd5a, 0x6a37d3ca,
+       0x19656a26, 0x78fc7887, 0x4d9ef573, 0x8f255fa8, 0x7686c98e, 0x99796433,
+       0xb857db1a, 0x55bce806, 0x95a7b6af, 0x7e649ff4, 0xce6686a9, 0x954d6c82,
+       0x3a1df4ed, 0xdfb81156, 0xefc64cfd, 0xd53c5957, 0x57fdcedd, 0xfee19186,
+       0x25fc6027, 0xc3bfb923, 0xfe48ceb2, 0x7ff24b0e, 0xca03bc9d, 0x7634db2d,
+       0x6b44e954, 0xea1d5aed, 0x3b598bfb, 0x810ee3f2, 0xe14bef7f, 0x0a28217a,
+       0xec0373e9, 0xd3deadf2, 0xfc03328b, 0x9f0ab684, 0xc97bf680, 0x0fa15ac8,
+       0x07e49ff7, 0x2dfbb405, 0x15c12e15, 0x8781f689, 0xb965cfca, 0xf80e927e,
+       0xfbe12ad9, 0xb992fd40, 0xa15d7012, 0xd2768adf, 0x605158f3, 0xf8b3a77f,
+       0x3b07ac3c, 0x75d5f499, 0x782bc27a, 0x97654ebe, 0x95f6c01e, 0xff2e0c75,
+       0xabb7067e, 0x5d013d77, 0xe24c1f20, 0xdd89f376, 0xce3fa489, 0xa0770d69,
+       0xa9e274fd, 0x6f0465d1, 0x3d40ec99, 0xc9eec4f2, 0xb39d31d3, 0x3bd52665,
+       0xb41eb021, 0xb96ce787, 0xd4fcc45b, 0xdb0bc00c, 0x7a27a33b, 0x41e5b39c,
+       0xcb47fbf9, 0xe358bcb0, 0x91da09fb, 0x22fb8dc5, 0x1c9e4ed0, 0xa6124af9,
+       0xf57d3427, 0x5dffd0dd, 0xdc2bf666, 0xe31b9d9e, 0xfe1cb1fe, 0x74a9f731,
+       0xbfd7ea1d, 0xf5a74f4b, 0xc41ccf9c, 0xec835007, 0xf6f65bba, 0x8a4d061e,
+       0x3fded6dd, 0xe65ccc15, 0xc11f30e8, 0x5ecbb4b4, 0xd657d386, 0xe9823ce3,
+       0x194f5ef4, 0xa7e52faa, 0xba608e5b, 0x3bf5d724, 0xff179f9c, 0xbcaf7be1,
+       0xc7c8f008, 0x07a8cdeb, 0x37d13e65, 0xebf92763, 0x21f90c74, 0x45a7926b,
+       0x746c048b, 0x787ca0c6, 0x835169f6, 0xad21b9fb, 0xc3610c25, 0xb41ae97d,
+       0xb745770b, 0xb3b8d0d4, 0xe3ce19c2, 0x210fb0db, 0x3b45645d, 0x809f9063,
+       0x3e1d692f, 0x10d3e993, 0x634731ed, 0x1fcf187e, 0xe1ce17a8, 0x5af503f3,
+       0x27ea04c2, 0x13fb2046, 0xbfdc06d4, 0xddfef26d, 0x38093cc6, 0xcf48d61f,
+       0x64ebf40e, 0x67fe7095, 0xb02e9c91, 0xfa44d37a, 0x96cd9c84, 0xb89dcf16,
+       0xe897560e, 0x3ba40beb, 0xf40706d8, 0x19827491, 0x055bd7da, 0x219c830e,
+       0x7e87f0bc, 0x42c98b0c, 0xbf828d7a, 0x0bda02b5, 0x1c7033d0, 0xdf834cf3,
+       0x9b177429, 0x4235c7c1, 0x65acbfa6, 0xdf053dbc, 0x9f2e0cb8, 0x83496f01,
+       0x7c6568f8, 0x009a1c60, 0xd1ea027c, 0x66f006f8, 0x05d21b76, 0xa7817a48,
+       0xc703124c, 0x8471ad5f, 0x7a645da1, 0x4fe8fbf5, 0x02394289, 0xf753fe78,
+       0x69f22324, 0x327238f0, 0x46df08d2, 0x6f5187d0, 0xfce2e99f, 0x11e958db,
+       0x18423ec8, 0x3a2c9fc7, 0x35681fd0, 0x017416ad, 0xf326b5e3, 0xa5667a7d,
+       0xcae51ba7, 0x3b08e2cc, 0xac9df7d2, 0xf3999d7d, 0xc04c91f7, 0xf81b146f,
+       0x41c4d899, 0x4f47f0bd, 0x97127bbf, 0x97b59934, 0xf9fee2e4, 0x70b3fdf8,
+       0x3a3eb6fd, 0x4ff107b3, 0x3baa79cc, 0x5e741a06, 0x197dd794, 0x6ca4ebf7,
+       0x1c0e3f13, 0xe0079247, 0x8d44bf40, 0x41e81cba, 0x65742b05, 0x71a21a13,
+       0xe444d1bf, 0x7a819ccf, 0xe486944a, 0x6129c83b, 0x33fd4841, 0xf9e4ae88,
+       0xaee7d657, 0x375a4c8c, 0x03af89ab, 0x171bb7eb, 0x5583ca46, 0x6dfa09d6,
+       0x011f3604, 0xa658df74, 0xd7680bf5, 0xac28fd62, 0x919de2cf, 0x8769d743,
+       0x03399a4e, 0x1ac3f4e5, 0x74366ef3, 0x7edc815e, 0xc3ed7a4b, 0xf90e5471,
+       0x7dfc91a2, 0x436af801, 0xb8f5eac1, 0xac6dfd59, 0xb48cee6b, 0xc989f9a1,
+       0x3ee2660b, 0x68cb589b, 0x47cb83fd, 0x575ea63d, 0xa3c737b2, 0xbbf988ff,
+       0xce7ac1be, 0x8655de4c, 0xbaf07cfa, 0x1a97742a, 0x105f7a1b, 0xa65f3933,
+       0x954fd846, 0x92215e93, 0x114ce09e, 0xa2ed03e3, 0x1f7c190d, 0x1335fdba,
+       0x23ec43ed, 0x5cb71fa3, 0x93ef577b, 0xa50eb0b9, 0xae683457, 0x1cefa3b0,
+       0x484ce1fa, 0xddeafda7, 0xf50affd5, 0x1a657da6, 0xb06ff987, 0x10e819be,
+       0x9d80f5f1, 0x2fdaf001, 0xa3a0b4f6, 0xd992b1a4, 0xfa55df71, 0xf3f723d9,
+       0x49df9d0b, 0x645735f2, 0x820e493b, 0x2f401e65, 0x7e896900, 0x56731978,
+       0x68dd90b6, 0x5907cccd, 0xf6bd6e8d, 0xfe5fb425, 0xefd0cf49, 0xd242af38,
+       0xe7f8c095, 0x65ba4a55, 0x5917c7e8, 0xf311ea39, 0x3f94ec2b, 0xf3ced2bf,
+       0x417f3c8d, 0x17f28385, 0xbe783a54, 0x3e61f209, 0x7bf85616, 0x42eed0bd,
+       0x41a48c53, 0x93a5783f, 0x50355f97, 0x0f603bf9, 0x87c90264, 0xde49f987,
+       0xe1a67cb7, 0xb84f12f1, 0x0d5c005f, 0x123d4591, 0x1a7ddfce, 0x8624167b,
+       0x01999114, 0xe9c2b67e, 0xf3f942d7, 0x13809fcc, 0x6af546f9, 0xbfe43667,
+       0x719a2c91, 0xc0386f7c, 0xabf9c66e, 0xe9de6915, 0x351bf007, 0xd8cf14c9,
+       0x7dadfb21, 0x67e48c2b, 0xfc875d05, 0xa2456cac, 0xf2f0c7ac, 0x7ecdcb6d,
+       0x0e40c7d4, 0xdff63ad2, 0x001e9227, 0x1cedf0f2, 0xca5e8bd4, 0x484987b4,
+       0xb37e6ab7, 0xa12f2f54, 0x19992af6, 0x9559f2ed, 0x97c6bdbc, 0xea0d7e34,
+       0x3379a655, 0xf71a0e91, 0xafda3b32, 0x2a9f56cf, 0x9b78458b, 0x87e5cedd,
+       0x56342e5a, 0xe12e396f, 0x731a3c78, 0x7ee7d516, 0xe94f46ad, 0xc830ad2e,
+       0xd2deb4cf, 0x2a18fca0, 0xd83dec6f, 0xa955424e, 0xb3d4137d, 0x8fd138c0,
+       0xf3cf4dbd, 0x1488f77d, 0x8b54b067, 0x4182e65d, 0xa7914efe, 0x187c82d0,
+       0xc545f245, 0x525fa35f, 0xf9923fc3, 0xc45df814, 0x3176f971, 0x5d95c93b,
+       0x27207aea, 0x52af2835, 0x67f9d4da, 0x2fc504b2, 0xe0879aa5, 0xb87ab679,
+       0xe71e0bdc, 0xc2bab8e0, 0x34b8d146, 0xd7285c7c, 0x74d73f20, 0x2b73f288,
+       0xa124bb45, 0x853f6bbc, 0x92f51fe3, 0x9e00bac8, 0x13345d55, 0x66d669e9,
+       0x6643b90d, 0x0b925eb3, 0xe2b71b37, 0x671e08df, 0x6436f8f0, 0x1cdf6968,
+       0x1bd707d0, 0x7d6c1f49, 0xb8c1a4c4, 0xe15be822, 0x973857e8, 0x099e1a55,
+       0x532230f3, 0x6bafd7d6, 0x34693cb9, 0xacea9d11, 0xfa04e58f, 0xa5d1841f,
+       0xeebeb023, 0x72bcec7a, 0x68e91b8a, 0xac72c1dc, 0x93639658, 0x2a7c60fa,
+       0x933873ff, 0xd6f7e602, 0x7c1518fe, 0x5544d5fb, 0x2e1012fd, 0x8d53e581,
+       0x69f2aa79, 0xf82a71e6, 0x5514db0e, 0x54d219fd, 0xce677c15, 0xb3faaa9d,
+       0xf055f3ed, 0x544bc55d, 0xee3ae7f5, 0x2fcf9555, 0xbe55487f, 0x0546b9d0,
+       0x7bf8aa2f, 0xaec5fd55, 0x92f95546, 0xe555279a, 0x9293f6c1, 0x3f726696,
+       0xe79b56cf, 0x8be483a4, 0x0e46704b, 0x14a967ad, 0x3dd703fb, 0x53eb822a,
+       0xe51af5c1, 0xe04178f5, 0x48feb1fd, 0xe29df20d, 0x91ed637f, 0xd75cff2a,
+       0x3ec6c9e4, 0xec72fa13, 0xb2dd23ef, 0xc51fdc13, 0xc53bfcfc, 0x04fdd57f,
+       0x56f683d4, 0x715ba647, 0xabbf43bf, 0xf9fd0f4b, 0xb7bfe435, 0xb40bd736,
+       0xe7ae6e0f, 0x7aab957e, 0xc00d8ae6, 0x7ef38583, 0x828e78e5, 0x70447327,
+       0xcf1860ff, 0x95fb26df, 0x52bf439e, 0xb03f6336, 0x17787e28, 0xac509bb5,
+       0x467fa1f7, 0x7a08f6a8, 0x662e5b94, 0x07284836, 0x97ff5397, 0x5823ec2b,
+       0xd2567988, 0x398daf56, 0xbd5b7da0, 0xc61ead6f, 0x69399756, 0xbcd0b3cb,
+       0x1fc8c3cd, 0x94e668f3, 0xe7816b2d, 0xa25321ff, 0xf9104975, 0xf75f3f3c,
+       0xd03db9c6, 0xa5956b5f, 0x706ae508, 0xf3bb9279, 0x941bb1e2, 0xd5f2bf3f,
+       0xd1bfee0f, 0x671d75f7, 0x87ca029a, 0x24568bf5, 0x1d004732, 0x7ed08648,
+       0x74c81ff9, 0x27ac9ee5, 0x5a33d63f, 0xcfc893d7, 0xd7ff2617, 0xddf0bdc4,
+       0x3dcae979, 0xfe43a7a8, 0xea1f300f, 0xcf9ebcd1, 0x29e744bc, 0xbf40f352,
+       0x2c3bfd47, 0x941edd34, 0x95ad17db, 0x5a07e8fd, 0xd097a91d, 0x7e324fce,
+       0x0eea7e46, 0x83abb71d, 0x07e7f7ed, 0xb276edec, 0xedcbf7bf, 0xad5396ec,
+       0x8ccf7f99, 0xe45a263e, 0xf98840f8, 0x09b546d0, 0xab12af28, 0xf9024fc5,
+       0x4f523ba2, 0x498b047e, 0x6a983bf6, 0xc5017e54, 0x791dd06f, 0x6f7480bf,
+       0x7e415ae9, 0x6017f47a, 0x75e5077b, 0x2417f609, 0xe8b4ff19, 0xb51bd8e3,
+       0x23f206cf, 0x04fd1084, 0x27f8a1e1, 0xa3f1fb82, 0xccfb813e, 0x27d270ca,
+       0x397dc782, 0x6650e4b3, 0xff48f23c, 0x7e503bc9, 0x7ed1d29f, 0x84bd1c38,
+       0x1fcce149, 0x266f7ed0, 0x7223efb7, 0x91f95462, 0x0fe644f6, 0x64b35ff4,
+       0x321127f3, 0x48cc5b0c, 0x51c6df7d, 0xbcdbdfd8, 0xbb3a13bf, 0xd841f48d,
+       0x7bfed0f6, 0xeee7e64f, 0xab69465c, 0x01b7976c, 0x9cfa631f, 0xd9fa4cd7,
+       0x843fe036, 0x4a257bb7, 0x4a1cdefd, 0x54ed7a77, 0x4c5bcbbe, 0x83af1ef0,
+       0x72debde0, 0x9d79f74a, 0xb792ff94, 0x7a9fe082, 0x7bb6945d, 0x15ff286b,
+       0x03e087af, 0x5f8206de, 0x44507d45, 0xa533753f, 0xa85b786f, 0x46dbd3bc,
+       0x3f5e9bf0, 0xbdde5da5, 0xdbc87f94, 0x6f11f04e, 0xbcc7c107, 0x78f7045d,
+       0xdb7d287b, 0xeff94bdb, 0xdc134f78, 0xb1938f2b, 0xfa2f5ee6, 0x84a25c2b,
+       0xaeb3ddfa, 0xd7ea336a, 0x331a65b6, 0x9736f38a, 0x39fa0566, 0x78f255b6,
+       0x86956d9f, 0x87a040fc, 0xb39f51fa, 0xf8fa7b2d, 0x405f2a34, 0x49b15be5,
+       0xabac4a30, 0x56cafeb8, 0x159ea9ea, 0x77c1020f, 0xfd2b6adb, 0xb25b805a,
+       0xbadca9c3, 0xedbb244a, 0x3a278d79, 0x245deb9b, 0xae3aadbf, 0x1074283f,
+       0x22e9fb21, 0x974a44b2, 0xa3fc7365, 0x23ef4232, 0xfc4a5919, 0xc707b9a4,
+       0xf182ab67, 0xf555be21, 0x5a5f8c46, 0x49f183ef, 0x3aae3fa4, 0xc3247804,
+       0xc07f1178, 0x6cc2fc87, 0xad97d719, 0xaf08eb55, 0x94f365e4, 0xda346778,
+       0xfa9e6de9, 0xa56f84b9, 0x36cd7e48, 0xfbe8a1d7, 0xe7ca4e50, 0xe1f1ac7c,
+       0x50fe7f4e, 0xf082327c, 0xddb8c6df, 0xd2fa0c90, 0x00e310fe, 0xc7a9478b,
+       0x198f78fd, 0x26f1fa43, 0xb2627acb, 0x3d8ff9c0, 0x6dff122c, 0xc1f7a067,
+       0x7e81cf77, 0x503943e7, 0xfa156fba, 0x72cd1eab, 0x3c02cc4d, 0x3f8d247e,
+       0x531c0224, 0xaf4fdbce, 0x1ea0f717, 0xae7deb0d, 0x3e37f209, 0xb689d9b8,
+       0x6966ec71, 0xdb5bb22d, 0xd01357b2, 0xa82c95ff, 0xcb4947d7, 0x3bb63c65,
+       0xd5cf7b78, 0xb64fe48b, 0x76903aae, 0x865bf784, 0xfa8e26fd, 0x61ba187d,
+       0x1a481632, 0x55c91914, 0x2fec45e2, 0xe5cda1ec, 0x66fc5fd8, 0x215fd287,
+       0xe775f7f6, 0x65e3e469, 0xbc085756, 0x37279386, 0xb38b2393, 0x8e48e322,
+       0x9424b124, 0xb8ebcf23, 0xe49df2dc, 0x861d24fa, 0x1fb43499, 0xc4ae7e25,
+       0xe8e383d3, 0x243d3235, 0x61c74219, 0xfde80d57, 0xddb7aa3e, 0xe749c9b1,
+       0x0b3e304b, 0x6c75ab45, 0xeaf3ae05, 0xdaf37092, 0xa4a0f410, 0x018e505b,
+       0x468bdfdf, 0xb9b3b523, 0xe1a3b79c, 0x56cadced, 0x32625c11, 0x6bc842fb,
+       0x6e5a7d25, 0x4e2c81e7, 0xbe0f49b7, 0xae18f1b4, 0x3a3adbef, 0xc69cf413,
+       0x04ed11bf, 0xc92d09df, 0xfb6d44d7, 0x78013d8e, 0x79e3cb35, 0xb5cfef4e,
+       0x7b40ff23, 0x915728f9, 0x7fc9f25f, 0xcc0566c1, 0x5addf2bb, 0xa3fd8fd9,
+       0x29a21b6b, 0x2eb55cbe, 0x36a3f50c, 0xb07a2466, 0x85d13cea, 0x4560f401,
+       0x1f410cba, 0x4af4b2fb, 0x3254d53c, 0x7c32e311, 0x728a9e5f, 0x583ef009,
+       0xe1fb451d, 0xdeef65d4, 0x5be01639, 0xd47688ae, 0xe5ab9ecb, 0xfd2713e7,
+       0x26e74351, 0xdb9c7cde, 0xb7fdb77d, 0x7bf41eb2, 0xb3e9c827, 0x7a41e768,
+       0x77b3334b, 0x52dcbac1, 0xcdff226d, 0xb3c557ad, 0xb91a7681, 0x7da3c7a4,
+       0x5335fdc1, 0x803ca1fa, 0xa67d26fe, 0xaa330fae, 0xa1233d45, 0xab6f9d4f,
+       0x1a66703a, 0xcb56d3f4, 0xf6bb6e3f, 0x7d8471fe, 0x93f21af5, 0xf429f500,
+       0x4dfe4093, 0xe78097d1, 0x191a3716, 0x32eb73c9, 0x41e519a3, 0xe49c25b7,
+       0x1362db5f, 0x321ba1e9, 0x9ea18757, 0x8faaa86c, 0xdea474c6, 0xa77d03b7,
+       0x7dffbbdd, 0xe4812d9e, 0x817f3f2d, 0xfa0c5984, 0xae7abdc0, 0xb6faf8e4,
+       0x7944cb4c, 0xc3f2a1a9, 0x8b7dffbb, 0xac077d0f, 0x3490f085, 0x7e0f912c,
+       0xe29bbe00, 0x2fdf02d4, 0x444e6740, 0xabae74f8, 0x4243e507, 0x8b1baf9c,
+       0x56ce9ab6, 0xcae2f9d2, 0x5d33e238, 0x31e987b5, 0x18c8b2bf, 0x9f0ae7c8,
+       0xfffcb5fc, 0xbbe71cb4, 0x59b81c99, 0xf7e337bb, 0xbe73a59f, 0x369ece19,
+       0x154f230c, 0x9acf18fb, 0x4b6c8a63, 0x7d59eafb, 0xf6eafd48, 0xc567ce6c,
+       0x643e7e7a, 0x72f4c54e, 0xfaf8c38a, 0x96c73c44, 0xa9f9cd93, 0x714912cd,
+       0xd674b6e2, 0xdf037185, 0xf7f70d72, 0xdafff1c4, 0x3fc9d32a, 0xa2782ad4,
+       0x3e78197d, 0xeb8695c2, 0x147306d7, 0xa6b7fd09, 0xfcceb972, 0xabc6331e,
+       0x409a9da1, 0xf3dec1fc, 0x9198e9a9, 0x0bfe4c3e, 0xa49ef12d, 0xa3b7f00f,
+       0x17fd1c5f, 0xdadddfc1, 0xbf6f86af, 0x984b86aa, 0x354f054e, 0x6669e1aa,
+       0xe6c96c35, 0x361dfa7a, 0x490cfe75, 0x1ca7270d, 0x73f0d309, 0x7f01a6ed,
+       0xbbf044b3, 0xa07e0199, 0x01769a0d, 0xafa525e7, 0xadb2fc96, 0x93dfdca9,
+       0x73f6af5c, 0xb596b224, 0x6df90231, 0xfcb6f954, 0x73fa0255, 0x7cead56c,
+       0x8c150798, 0xbff48acb, 0x9f95d724, 0x02e9718d, 0x4b3aee7e, 0xc5cde9eb,
+       0x238b6875, 0xcf934a3e, 0x1fdd0d05, 0x95b8d0b7, 0x7c0f9076, 0xfa45e301,
+       0xe62f840f, 0xc76726ba, 0x05f03e73, 0x7df997ee, 0xa503e43a, 0x41f8e1bf,
+       0x3962c7e1, 0xab9ca26e, 0xa5b722b9, 0x97a9ab9c, 0x0475c7cf, 0x92b9c79d,
+       0x81e7465c, 0x09aef4ae, 0xc877c50f, 0xce6cbe67, 0x946e9877, 0xdf20d7cf,
+       0xef9cf4f9, 0xd5f0df30, 0xfd28672a, 0xafbcbcf0, 0xcc37b43c, 0xf8c071fc,
+       0xab47b656, 0x82477760, 0xd3bcf039, 0x740ff843, 0x3a3337ba, 0x0f2b5a47,
+       0xbf338be7, 0xe908d3db, 0x0b975a5b, 0xd66567d7, 0x338f3d59, 0xfe51ebf5,
+       0xdff7979e, 0x38dd820d, 0xdb94c05a, 0xbb668da5, 0xccbdfd11, 0x57f2a19f,
+       0xd5877e28, 0x31acd22b, 0x0188ff80, 0x4cd3823f, 0x33e34de7, 0x35118fc9,
+       0x2b3771d5, 0xccf73c04, 0xa2046f98, 0x554e85dc, 0x658fc790, 0x97d0fd97,
+       0x035e383c, 0xce02abfa, 0x0f441923, 0x3573b923, 0xe7014995, 0xff655bca,
+       0x9b1f00c5, 0x7f609796, 0x7896cc3f, 0xd679863c, 0xda9fff72, 0x6ab8665f,
+       0xd833b553, 0xdfaab27e, 0x722fd956, 0xfed5f6f3, 0xf4d5c337, 0x0ecfda61,
+       0xb21cdf6a, 0xd576c1fd, 0x11afbc7e, 0x3e436f1f, 0xb5ffce18, 0x1ba7965f,
+       0xf45e9e6c, 0xd818e97f, 0x06071495, 0x6a8898fa, 0xc369ff23, 0x5d5379f9,
+       0xa60fdab2, 0x1f927e63, 0x90d647cf, 0x3e6048fc, 0x9859df8a, 0x47d7f287,
+       0xbbf1e74d, 0x1371b960, 0x8798c179, 0xfd00dea1, 0x3f57f2a9, 0x46d3f7c2,
+       0x3c42eec1, 0xfff3c783, 0x89abdd8a, 0xfa4bdf1c, 0x64b84a73, 0xdbde81b8,
+       0xe32575ea, 0x3dc21bf7, 0xfeeb1835, 0x762ebb3c, 0x1b3de83d, 0x7c08c630,
+       0x71bb3576, 0xfb84cfbe, 0xf58fa724, 0x27a21a71, 0x1d96ddcb, 0xb27a00da,
+       0xa8695de8, 0xf2345af7, 0xa1fc2f39, 0x65bd6cbf, 0xfd10a6e7, 0x029bfa2b,
+       0x8f002b5b, 0x956dba00, 0xfe81e6f5, 0xd0ee2496, 0x3163b406, 0x3fa90ab8,
+       0xd2a35ce5, 0xeb37d35f, 0xf7ecab6f, 0xdeb3fa52, 0x559f1ea3, 0x59f1a1ef,
+       0xe947fde5, 0x2f8e2b6f, 0xb4dd5f04, 0x1e8ed93f, 0x7aa96fe8, 0x8783567c,
+       0x72d567c6, 0x7f40e1ff, 0xbfacdf4d, 0x931ef936, 0xe1d3e64d, 0x0e37fdce,
+       0x1a76ab9c, 0x29b4ae51, 0x7f7940fe, 0xbfb414bb, 0x37f796ad, 0x714bfbe5,
+       0xbddfe4e9, 0x18df33d4, 0xfdc35f6a, 0x247ac98c, 0x2648f593, 0xcf0891eb,
+       0x3ea67a99, 0xf0b0e81e, 0x22f9b6c5, 0x1e73e3ec, 0x153e333a, 0xf62f19e0,
+       0x5f6117cf, 0x99e2f39a, 0xc9f04903, 0xccbe2fcb, 0xe6787fcb, 0x9b94324a,
+       0x2fcdef7c, 0x962a3803, 0xde0ac7ef, 0x8db7bf4a, 0xbba37ae2, 0xbfee73e1,
+       0xfb8af904, 0x87aa6356, 0x42f17fa1, 0x32d47f72, 0xe94eefa8, 0x310f2cb7,
+       0x6eea4a2f, 0x467e4f38, 0xff287914, 0x40bfe1e6, 0xee53cfb4, 0xefab9467,
+       0x6d454467, 0x8c2ffd22, 0xef28cdf9, 0xba0e8c22, 0x28d6f84f, 0x642c1fbe,
+       0x376e0af6, 0x39f25948, 0x31cfba0d, 0xd76e58bf, 0xb1cfcb7c, 0xb1c6a17c,
+       0xdfd9ed1e, 0x478aaa4e, 0x173958f5, 0x7f783797, 0x1bf5d772, 0xbe0e1f9c,
+       0x23e7393f, 0x23c2eb81, 0x3ba5bfb8, 0xb9f7e257, 0xa886fc02, 0x9f370ef7,
+       0x7db8a3b5, 0x0e9f383f, 0x0e319f3e, 0xfee69f3e, 0xfeb0b5a8, 0xcb7ee8ee,
+       0x5d9fc413, 0xc86be721, 0x5fcd06bc, 0xd8a628fd, 0xb7a45a79, 0x32b7cd9b,
+       0xc1f9caaf, 0xa2ca4146, 0x794feafd, 0x3183fd2a, 0x8e2a14bb, 0xb819f483,
+       0x4e6deabf, 0x5d19fe86, 0xcf073d9c, 0x45fe3795, 0xde5cf21b, 0xd63e796e,
+       0xb9d38546, 0x3d28c6ce, 0x51dddbd9, 0x97fa1933, 0x9a74d345, 0x72a8b297,
+       0x8da96f3a, 0x8f68ed65, 0xd7239f06, 0xce9bb88e, 0x68ad6901, 0x703a4041,
+       0xa461d92e, 0xe8b989f8, 0xc5c8e786, 0x8f239d9b, 0x91cfc999, 0x7425e947,
+       0xea45b459, 0x7f239e43, 0xf7df146c, 0x713c71bb, 0x278c3f88, 0xa21c706d,
+       0x31d1c799, 0xf5f2023f, 0x7f231766, 0xc7de3cba, 0xea5075e4, 0x861ecc1b,
+       0xb7ab40f2, 0x68a7a84b, 0x613ef9c3, 0x4e5869b0, 0xf7c8bf08, 0xfbe8e947,
+       0x34cd724f, 0xd7231aaf, 0x5afce7cb, 0x7a4fe908, 0x4fe29475, 0xc3674d0a,
+       0x0d3cc9d1, 0xf0a7473f, 0x9e9302e1, 0x302df7ce, 0x0fd14ad9, 0xef0800b2,
+       0xfa8098b3, 0xf7e22db7, 0x0dbb4581, 0x5337e7e9, 0x6ff9ff6e, 0xb9f9ba18,
+       0x43353e7c, 0x4ee3f747, 0x8f61cc09, 0xd57e7a19, 0x869e8ce9, 0x66bb9a6e,
+       0xec87599d, 0xeff2e2f7, 0x867b6115, 0x167553e3, 0x779fec89, 0xa85ca146,
+       0x0f1f5b4e, 0x42caa2f0, 0x94dfdd1d, 0x08ee44e3, 0xd19fc72e, 0xa28e4eba,
+       0x51e7d178, 0x624748a5, 0xa3e22a7f, 0xea0289c4, 0x9e2a37bd, 0xd7e1cdea,
+       0x18dea0c5, 0x7f67d394, 0x1eb462ef, 0x127a50b6, 0x302c4fda, 0x07cb236e,
+       0xf302a3b4, 0x01627ed1, 0x2f2c27eb, 0x9085f6b6, 0x609a4a17, 0x0d5292db,
+       0xd0909e7c, 0xff92a942, 0xee5b43ac, 0x57aeb10f, 0xc6fd75e5, 0x601b4c76,
+       0x8ed0713b, 0x2ae5fb01, 0xd517dbce, 0x61e32ca7, 0x17657548, 0xe9b18ec9,
+       0x88933e15, 0x1e6106bf, 0x45fb04af, 0xd5b0de75, 0xfba14beb, 0x6d38f2fe,
+       0xa346d62b, 0x1c55031d, 0xbcdb9f48, 0x9965296d, 0xcec8e383, 0x8d13e991,
+       0x17a889b6, 0x5c725ff3, 0x97f40ccb, 0x74349b24, 0x5326013e, 0x6e612f75,
+       0x38b4f459, 0xccdd4534, 0x2ed0926e, 0x3f3d25ef, 0xf896bae1, 0x62f0e120,
+       0xa4ab7186, 0xef0176b8, 0x23f40d03, 0x97ae6fdf, 0x5c57b9e3, 0x048e3465,
+       0xcefec0eb, 0xf38d0ec8, 0x747945cd, 0x518e69e5, 0xe5d58fc2, 0xdcfc71c9,
+       0xe1d5fdc2, 0x3ae8097e, 0x4057b6a9, 0x380c0138, 0x5c27c5f4, 0x426b4c6f,
+       0x045af279, 0x6db58bf9, 0xf207cc99, 0x45745527, 0xfb3ce0e5, 0xc9a6ffa5,
+       0xdf0b0790, 0x9c207cad, 0xa136b3f4, 0x25d90665, 0x285869f7, 0x1c98cf3f,
+       0xc828c7ee, 0x609ffce1, 0x1ea94d6b, 0x44d3e987, 0xcf975f37, 0x1db39067,
+       0x9f11d9f4, 0x1c58fa2d, 0x759a7bd4, 0x9b73e9a1, 0x7ec0efdc, 0x185fcf21,
+       0x7f911973, 0x3b9382b5, 0xdbeef739, 0xce82cfb7, 0x55e74613, 0x8d7ac936,
+       0x4e444ed2, 0xd846153b, 0x45cf0c1d, 0xdf07660a, 0x9b3ecc07, 0xf9abd60f,
+       0x7b486d2b, 0x791cc1eb, 0xb26b491f, 0x4cb2fd61, 0x94fd0dbb, 0x1a55f7c1,
+       0x70da26d3, 0x0c671a7d, 0x7031a9d0, 0xcb4ee85f, 0x53cf1f7e, 0x2c747a99,
+       0x70591cf0, 0x2173c7aa, 0x972837b1, 0x1d3797cf, 0x9b42e7e2, 0x78bd454c,
+       0x14c9a10e, 0xfec74457, 0xa99cfc4c, 0x3a64df52, 0x64def246, 0x1356f1e7,
+       0xa2020fee, 0x3ba1e7c7, 0x83cd18ed, 0x0e5a6f52, 0x7b26ab97, 0x5bfbc317,
+       0xd53f76e1, 0x3e9d130b, 0x161fe00d, 0x4ffee8c7, 0x55f39198, 0x318fac04,
+       0x7e95ef80, 0xd1d1cb6f, 0x172535bc, 0x7e1096f5, 0x6704de22, 0x1b22b64d,
+       0xdf38dbed, 0xb4636fd0, 0xaf9cdf42, 0x5be7971f, 0x3e51a769, 0x434f7aff,
+       0x58b2fcce, 0xd73913f4, 0xa6bb60e4, 0x83b446e5, 0x6fe391b4, 0x6186ded8,
+       0x285e6bdb, 0xf238f7b7, 0xc8b23685, 0x50e9ed8c, 0xc3a0845e, 0xfe76e467,
+       0x30ede357, 0x97df74b3, 0x9f305a60, 0xa3de942d, 0xa38c46a4, 0xddfa1b8f,
+       0xebbf9637, 0x90247ed4, 0xfc717bbf, 0x1ecf932b, 0xee1ca12b, 0xdb2eda3f,
+       0x619d8a27, 0x2ededb91, 0x3ee87bf0, 0xef4edc21, 0x8776c836, 0x0f3d4c25,
+       0xf941f783, 0xe0ae5c3a, 0xc72ee6e7, 0x046b8a31, 0x77e5f3f3, 0xb40e8a3e,
+       0x73ef504f, 0x04bb7364, 0x1c4bb453, 0x610d9fb2, 0x9da01bf4, 0x80fdf0a2,
+       0xfa42b75f, 0x3f005ba7, 0x0d6fc803, 0x7b242bb4, 0xc90dbe88, 0xe7c8697d,
+       0x053bf2a9, 0x5cd7f643, 0x4785a72e, 0xfe434b3f, 0x4feb8b2e, 0xf982efc0,
+       0xae4785fc, 0x5e78e026, 0xce703198, 0xab43e286, 0x7bf3a717, 0x1cffc7d9,
+       0xfed10aed, 0x457feecd, 0x86b4dd9d, 0x5ce5c0f4, 0xdf5bfc0f, 0x8cbedb07,
+       0x821d9deb, 0xcda4efda, 0x5fe77ae5, 0x7acc7de4, 0x2df7a455, 0x2eb965ce,
+       0x0ab61f20, 0x7f28e5e6, 0xe7e11f53, 0x5e3f56e6, 0x2103d9ff, 0xed1841f8,
+       0x804e73fa, 0xacdc5c3d, 0xa35a3f27, 0x8dc47d29, 0xafc31ce2, 0x71cb87b3,
+       0x1e4b7d79, 0x24f3f235, 0x5b17ae2e, 0x39d3f75c, 0x23f3e095, 0x243bd5c3,
+       0xbea53dcb, 0x7947db01, 0xfe479a62, 0x23684b80, 0x964dbfa0, 0x7678c17b,
+       0xf3c864e2, 0x12b90463, 0x18456875, 0xed93abb6, 0x3f8aedb1, 0xe8c8a2a3,
+       0xb75ef808, 0x1a58c8b8, 0x8c8d2f40, 0x6e0ddf9f, 0x01dcceff, 0xafa55a7d,
+       0x459f70e8, 0xf89c50df, 0x433901a7, 0xcab8658a, 0x0ffa518e, 0x70163f3e,
+       0xf38c2c5e, 0x5a67b729, 0xe818dcf1, 0x962b6bb7, 0x6df9c48f, 0x582f5d15,
+       0x3ffa1e61, 0xe739d030, 0xecbe650f, 0xb872f993, 0x43b1f3f5, 0xf6318ca0,
+       0x97823b04, 0xc64e80d6, 0x68fe408f, 0xfb94d4cc, 0x5cb38c43, 0xfd08671e,
+       0xafdcd6fa, 0xe6975fa7, 0x51afd086, 0xc504767f, 0xd461021f, 0xf4211d9b,
+       0xec8213eb, 0xedcf900f, 0x1d49d09c, 0x270f307d, 0x6f611d6e, 0x919ee894,
+       0xf6045ec3, 0x32678bc3, 0x239f6f51, 0x23c7bc0c, 0x608c31db, 0x221623b0,
+       0x6799735e, 0xc50203df, 0x48ee5a51, 0x5c04eea3, 0xa7ad9b8f, 0x3711fb24,
+       0xdc613ac2, 0xb2daf5a1, 0x0ce2a119, 0x274038ff, 0xef02ba28, 0x042ac007,
+       0xc48695c4, 0x63e282cb, 0x38194e18, 0x5a1dabff, 0x7562aeff, 0x35e36afc,
+       0xac30bfee, 0x0427fe60, 0x2eaa1f3c, 0x0bae5f9f, 0xe2a9cf8e, 0xba9d0b5a,
+       0x887c7c60, 0x6f8cb26f, 0x2907b6ca, 0x452d3e0e, 0x64acfde4, 0xc707cf64,
+       0xbd850cbd, 0xc3ea2d0e, 0xf7f48c15, 0x9e363f60, 0x5eff2517, 0x09cf6305,
+       0x7d5ade74, 0x59e9e4df, 0x1cfbf8e7, 0x8fd8e52d, 0x50c3532d, 0xafbe0e3f,
+       0xf09bc4a0, 0x7de04c98, 0x22dde569, 0xe10d62cb, 0x53b77cc7, 0x8797e2b9,
+       0x4b12a6fa, 0x55eeb9c0, 0xdd3ea06c, 0x1e85f2a3, 0x59d6d6f7, 0x1c4fef14,
+       0x82ec29ef, 0xa33b24a2, 0x66aa4879, 0x3cc00764, 0x86fae2a8, 0xce345d94,
+       0xc58c354b, 0xaaa038f2, 0x7076013c, 0xbf184fa4, 0xe30fce2a, 0x76c1c154,
+       0x4deccde7, 0x0de64a43, 0xfccdf9e5, 0x5e39068d, 0x646e46f8, 0x633be91c,
+       0x77d418d8, 0xa69f8b2c, 0xeb04b8f5, 0x34597e81, 0x03c54284, 0x68fb4337,
+       0x5f90ba07, 0xc4dfd1e2, 0x30caef54, 0xc9f74887, 0xb38e6284, 0xf1e4eb10,
+       0xfc467ce1, 0x9507086d, 0x9859f80b, 0xbce0706c, 0xc3000c1b, 0x333d0590,
+       0x56be4026, 0x15af37f6, 0x33308898, 0x4fdc8ddb, 0xe36bbca8, 0x866d77a7,
+       0xff7407eb, 0xcfec30be, 0xfa53bfc7, 0xdb8ef219, 0xfb27be0d, 0x7dfc1ccd,
+       0x951df919, 0xff9b87fe, 0xfb6ddee1, 0x2777d4c3, 0x3267bf70, 0x20e56bd1,
+       0x4cbc12bd, 0x1efc47a6, 0x4abdc2e5, 0x0c77adb1, 0xfb3c37de, 0xfd1d8470,
+       0xf0e303e0, 0xefe5a9dd, 0xed75fdd1, 0x9361e00d, 0x8c0fbe48, 0xafef6e4b,
+       0x02fd171d, 0xbc06dae4, 0x4fe78434, 0x279d192a, 0xcf4ab8b0, 0x000e7489,
+       0x1392a0c6, 0x4013ef01, 0xf10e1b7b, 0xf15baf73, 0xb0710b9d, 0xd02bd45f,
+       0x4255b06e, 0x483b087e, 0xbf19ab49, 0xd5e0ac1f, 0x1a3d07a8, 0xf5c352e9,
+       0x3ea6d9e8, 0xe935cf11, 0xe445fae2, 0x2e68e71f, 0x37e807c7, 0x0bf9d19e,
+       0xce7c926d, 0xdfc4a471, 0xfbe4cb4d, 0x84cfd29b, 0xfe591ad1, 0x47fbd2f7,
+       0xd54e23b3, 0xf2c6764b, 0x442fc5f6, 0x11ecfcff, 0x00d3eaa7, 0xe167d82e,
+       0x2ba9d270, 0xecc66669, 0xd10bacfb, 0xef3b3f9f, 0x807495d4, 0x78d9f68b,
+       0x464614f9, 0x097df8ce, 0x319fd10b, 0xd559b461, 0xd7385bfe, 0xd53cdff1,
+       0xcf21341a, 0x5a36df63, 0xe8c94f39, 0xf3b3ad3e, 0x2e31a797, 0x47f654e9,
+       0xdf482e87, 0xde0b2281, 0x717f9323, 0x9d0f1451, 0x9dd9d329, 0x1452eef8,
+       0x68bb2dfa, 0xfa0d477e, 0x6bfe9fe9, 0x4382f4fc, 0xccca9779, 0x1bff812a,
+       0x2c2b981b, 0x99ee8023, 0x9f9d7343, 0x81b8a603, 0xffd28f82, 0x6960bc10,
+       0xbc4098c5, 0x0a3b51b6, 0x0d0a175e, 0xc70587a4, 0xfd082e87, 0x549cf1db,
+       0x2fd6cfc4, 0x10ba75c2, 0x002a9fd9, 0x9eb79e1c, 0x7c42edd6, 0x1ec176ff,
+       0x3af8eb00, 0xa22bef56, 0xd6a3fc75, 0x027a3d51, 0xdfc5dbbe, 0xe396686f,
+       0xbbc64f50, 0x019f687c, 0x32b9d1dd, 0xfc9e8a5f, 0x05e36548, 0xb03fa047,
+       0xcbf7346e, 0x69d3925c, 0x49cf1686, 0x01f74ba0, 0xfa85ad81, 0xf5976bee,
+       0xeecc9fa8, 0x3d47a33c, 0x19c0eeba, 0xad4bde3d, 0xa9da1843, 0x8477a6db,
+       0x32feffd2, 0x97f2ab5a, 0xd1d77629, 0xe8f5ec94, 0x16abab77, 0xeade1ee8,
+       0x6e1fb9d7, 0x251c32f5, 0xb2df7763, 0x55b8fc9f, 0x98f5eece, 0x477d652e,
+       0xc588ddf1, 0xdceaad2e, 0x089a92c0, 0xcabe3c55, 0x9782ab13, 0xc0eac0b6,
+       0x21b4bb3e, 0xc31df549, 0xef82cf5d, 0xd0fe0e28, 0xd790affe, 0x736db171,
+       0x16bbfa2f, 0xcc7ad4bb, 0x62b5ceec, 0x11ede20c, 0xfece1aec, 0x84b77e12,
+       0x00d2108f, 0x7de60abd, 0xa3d7075a, 0x648c2aea, 0x0c22549f, 0xab595af3,
+       0x7393e3f5, 0x54f45347, 0xa810eeee, 0xbb972ddc, 0x576e046b, 0xa975f2cb,
+       0x8392e38c, 0x75d1a727, 0x37a39f52, 0xa5df0033, 0x88e7e515, 0x437d651e,
+       0xc4855719, 0x290d8df5, 0xddb0e9ef, 0x5817dfa5, 0x4b8d1a6c, 0xa92d47a5,
+       0x1e55c351, 0xd59e905d, 0xbdf943a7, 0xff9d41b4, 0xbef2d1f3, 0x90f2c79e,
+       0x2d18de9f, 0x07189f88, 0xbca53fe1, 0x81ef0277, 0x0f3ad25d, 0xead67d22,
+       0xdf700abb, 0x1175a4bb, 0x7e4394ac, 0xb8afdf1d, 0xce01a2be, 0x751befc3,
+       0xa7de330e, 0x8814adf5, 0x00b0976e, 0xb06d27bd, 0xa1dac13e, 0x7722bf70,
+       0xe4f59cc3, 0x98283d0f, 0x13286f51, 0x83de221d, 0x8fc61c6f, 0x83e6517e,
+       0x1f2fac13, 0x2246caf1, 0x9eca7585, 0x99f6823f, 0xf996b7ec, 0x3d948e30,
+       0xc4bf204e, 0x4371809d, 0xc922a611, 0x37b03991, 0xad9a4184, 0xf920af6d,
+       0xe66f563e, 0x58da62ef, 0xfc70bca0, 0xbe701333, 0x0bb27510, 0xfde87b93,
+       0x9b6d39bd, 0xcc5ca22f, 0x3d1470cc, 0x193df805, 0xf27ffbc6, 0x16bfc175,
+       0x3fcba9da, 0x0ad3f246, 0xd6fd81e4, 0xda3964d9, 0x5acff6a1, 0xc121ae51,
+       0x7ea7cacc, 0x32f89413, 0xc3ed15d0, 0x9fa4a55d, 0x9f7ee558, 0xddb8942d,
+       0x2e7ca0fc, 0xe2d6f98d, 0xd1befaf9, 0xf495f28c, 0xcaabfb1b, 0x5e283104,
+       0xe61a3750, 0x4fada579, 0x5be9de75, 0xe901bf6c, 0x187db82c, 0x395e2abe,
+       0x8a2d7b4d, 0xcc1d77ee, 0xfee8deb0, 0x3ea8d694, 0x8733a4b7, 0x53bbdd07,
+       0xf6d99fcb, 0x777ba0a4, 0xeef74119, 0xddee82f2, 0x2df9efa9, 0xba094e74,
+       0xe7bea777, 0x54cdb067, 0xe6930fd5, 0x9c88e0a9, 0x23f555bb, 0xe7d5cbed,
+       0xbcff8eae, 0x77c74842, 0x2e7d7d06, 0xe0668798, 0xc198e28d, 0x0a2f247d,
+       0x3e1a432a, 0x6984cc2e, 0x0ba1a173, 0x9139a4e9, 0xe386e7db, 0xa0badb0f,
+       0x9788e31d, 0xfc6fe88c, 0x452fe089, 0x9f28c4fb, 0x18fd1953, 0xaf33ed53,
+       0x52be7015, 0x5cf2dbd2, 0x7d61f3b3, 0x494af7f2, 0xdee01dfc, 0x463eb8d1,
+       0xf9036c7c, 0xaf7e55e6, 0x476cac78, 0x5f3ced28, 0x0f353258, 0xcc7fcfbe,
+       0xece28331, 0xf07efc1d, 0xa78f3d4e, 0xe7e55ef8, 0xfa3bf35b, 0xfe008e34,
+       0xf5c7993e, 0xa59c6790, 0xeba91f14, 0xf9165d84, 0x1eaceda9, 0x75d465ef,
+       0x7ee14776, 0xab3ce056, 0x60c9bf47, 0x89cfbcbe, 0xaf68e1fd, 0x743dacff,
+       0x9e6d6d3c, 0x98e3f89e, 0x1eabd72c, 0x91bb72d6, 0xb9e16639, 0x575e4571,
+       0xabe3e7ed, 0xe7e7a85a, 0x1d1a3160, 0x9c836e42, 0xc396ab3e, 0x707ef50e,
+       0xca3d7f8b, 0xaadf900e, 0x4c174b7a, 0x12b7bb27, 0x31f236e4, 0x797573c8,
+       0x17c91372, 0x7caae790, 0x3c80de77, 0xdf0ebfcf, 0x426a769d, 0x8170f38e,
+       0xda78f348, 0xffe69535, 0xf4479819, 0x64333da7, 0xde7cf8de, 0xc65ebe6c,
+       0xb7580fb5, 0x2ebf7ae0, 0xf2f6ebe0, 0x7dfaf230, 0x0a775d79, 0x4c2845bd,
+       0xa270cedd, 0x634625db, 0x387b9e09, 0x1365f296, 0x7eaae1c6, 0xfd3dd02e,
+       0x6e3eeb7f, 0xbf5ffd41, 0xfd05a8ff, 0xa3f6ee61, 0x594db016, 0x8b5a4ead,
+       0x85d03c7a, 0xba9ef51d, 0x7fc22e8e, 0x6eb8fb65, 0x21d95fcc, 0xee3dfbd0,
+       0xd3a71703, 0x135f5938, 0x0e770bc6, 0xf28fd783, 0x37befeb8, 0x307ee24f,
+       0xfb89f417, 0xdf8301fd, 0x801d202f, 0x5ebc425c, 0x35e5f017, 0xb1a373b6,
+       0xf51e9422, 0x1f7cf26f, 0xe867a8d9, 0xef85afaf, 0x52c71c71, 0x488de98e,
+       0xb205fb47, 0x27edddb5, 0xfb604617, 0xfa863af5, 0x17df8285, 0xe21fbd29,
+       0xd6a83ff8, 0x3580a7a1, 0xbe696b56, 0x52d7a83f, 0x74fbda3b, 0xc15e2f04,
+       0xae1c55cf, 0x0929a8fe, 0x56a0fdda, 0x530c7ba0, 0x31f3fbef, 0xe0af1784,
+       0x3d305afa, 0x4c1af42b, 0x3bf4c19f, 0xbe6b4e84, 0xc91e9d19, 0xe4d5ef93,
+       0xe7dc02b1, 0x59a7dd61, 0xe11e7e91, 0xae2be3f7, 0x7fa1d61d, 0x6cc9bd33,
+       0x31e0027f, 0x0b7aff5a, 0xbcc389ca, 0x8776b0bc, 0x748de5c0, 0x5261f237,
+       0xbda19eb3, 0x971e7efb, 0x7ae3ef4b, 0xfad0e3c5, 0x31af8c05, 0xe51d37b1,
+       0x4f1c9a52, 0x2ac7457a, 0x905c53f6, 0xaf319bcb, 0x96ef54d9, 0xbd71e537,
+       0x40839143, 0xe4fdaee6, 0xc44f6d97, 0xcb2f147b, 0xe55341e7, 0xfa32b2f6,
+       0xf485cfa7, 0x672f4caa, 0xf8143c64, 0x6cff4cb2, 0x1f68cfdb, 0x59c72d9f,
+       0xd1743666, 0x833ccc79, 0x879453eb, 0xabdf52b3, 0x39ae7dc5, 0x3a7cedfd,
+       0x25378d67, 0xc9fbe226, 0xd27877fc, 0x60d6dba7, 0x9c372fdc, 0xe0ec31d6,
+       0x381e7453, 0x35bc6b2c, 0x49439c54, 0x7a2557dd, 0x6aeeb08f, 0x3c0aa53a,
+       0x7d39d0f7, 0x1701d91f, 0x5c9f13a7, 0x2ddea9b5, 0x7bc654fc, 0x5d3ef28c,
+       0x80f3f727, 0x8b8b169c, 0xf329eb06, 0x1c659e80, 0x2ed6586f, 0xab35af5a,
+       0x75a92158, 0xcefe29ec, 0x0149ed66, 0xa458bddf, 0x304ce873, 0x608defdf,
+       0xfc8b1f25, 0x3657241d, 0x748c4dc6, 0xd784fb2f, 0xd7af704c, 0xaf29f046,
+       0x61ade944, 0x687c88ce, 0x4f11e167, 0xe1dbce16, 0xde275694, 0x8ef0bc57,
+       0x336ba64e, 0xd32e2fbf, 0x2d4ee5da, 0xeb9c6233, 0xc2e3e800, 0x5cf7fe20,
+       0xddfba44d, 0xa0fec3bf, 0xbf0d959f, 0xaf677921, 0xed1d38b9, 0x33dac2a2,
+       0x1bbb084d, 0xf51d3cfe, 0xff610f89, 0xf41ebd20, 0x72809b7b, 0xd3bd24e4,
+       0x8635795d, 0xd35979da, 0xcbf91d3f, 0xf740a6f7, 0xb8ec3e6f, 0xfdf2b7a8,
+       0x7873dc89, 0xf2fd1c2f, 0xb9a3f2b3, 0xd42ce91c, 0x243afad0, 0xddeb3bd5,
+       0x0a2bffa3, 0x20d8c3d7, 0x7e0a7afd, 0xc865a3df, 0xfb4a9bbf, 0xe421cca3,
+       0xdff469ef, 0xb071f365, 0x15e5a1ec, 0x9e165f7a, 0xe990ac93, 0x3cbcb838,
+       0xa13fc07f, 0xebefca73, 0xa1fe0108, 0x3fdfc62a, 0x2ba7bb05, 0xaab8f81c,
+       0x67f92a73, 0x0dc23caa, 0xd1c333fd, 0xeb4dd7e1, 0x28cff718, 0x818dda30,
+       0x1bb44d7e, 0x1f7faa99, 0x252b077f, 0x74f786f3, 0x14897ddc, 0x666bafcf,
+       0x795aef14, 0xe7a53475, 0x2120df5f, 0xfbc318ff, 0x6b7ee95b, 0x8cec86b6,
+       0xfeb53e95, 0xcb80a533, 0x7c052985, 0x60f95cde, 0x01b0e52f, 0xa2ec097b,
+       0x5db9f37b, 0xa9887514, 0x7ce0a5ec, 0xf28c97b2, 0x13101d3d, 0xe04257ae,
+       0x6941477d, 0xca977e0d, 0xd9ce885a, 0x72fefc3b, 0xe4d738f0, 0xf8553e73,
+       0x35f2317a, 0xe7076fd2, 0xe776e0eb, 0x41ac9415, 0x4c38da3e, 0xe65cab7c,
+       0x8c6d95fb, 0x16ddcbe6, 0x05f4f343, 0x0296736b, 0x78017e5d, 0x0bd23de0,
+       0x3444674e, 0xe5c17f7c, 0x3df3c08c, 0x6ba81c8a, 0x36efa70b, 0xc58bce66,
+       0x48cda373, 0xf9ded0f7, 0x9c46a98e, 0x38da7be7, 0x7dfd29ff, 0x1638b5d8,
+       0xae8269f9, 0xf2876f5f, 0x5133cee4, 0x784df7a8, 0xf22c7e7d, 0xfe7870e1,
+       0xcf1918fd, 0x1e12c486, 0x70bd8797, 0x004f6ca2, 0xba27ee7e, 0x87fa9de8,
+       0x6fd1181a, 0x56ffabf7, 0xbe7c7c87, 0xfb8cc233, 0x230717e6, 0x0bcabde8,
+       0x3de81a6f, 0x7df95a9a, 0x7d742fd5, 0x7cbf4873, 0x22f74b5d, 0x47fe6fdd,
+       0xfba3f22b, 0x3b9d0355, 0xc373a87c, 0x6af7dc45, 0xc39c673b, 0x5f6b5677,
+       0xc3f2dbfa, 0xd25486ca, 0x3ff8148b, 0xbe2746bc, 0xe45e7bf3, 0x8ea1e272,
+       0xf77d217f, 0x0b976ba1, 0x17ca7cf0, 0x44c7ff07, 0xb7ee6b94, 0x79444f2e,
+       0xe5c5fee6, 0x7eee5889, 0x4a13c22d, 0xc05eb95f, 0x7eca3efd, 0xa8aef699,
+       0x90ad0ff2, 0x5d6d23e9, 0x3d07bd0b, 0x7b02e4e1, 0x130fbbe0, 0xac4e34b2,
+       0x65b7e13f, 0x7c05f7b1, 0xa457aeb7, 0x93f8e338, 0x01d51165, 0x814f7974,
+       0x7e2ff14e, 0x930ebf23, 0xf019c7df, 0x77f2f4e3, 0x8af6367f, 0x1aa37dfc,
+       0x83a1ee81, 0x5ee432fe, 0x8affad1a, 0x88df7a58, 0xc73bce89, 0x8b38478c,
+       0x3e6205de, 0x00ccd1e3, 0xaf71693d, 0x7400cba6, 0xe869d154, 0x57befd22,
+       0xacb0433c, 0xf173dd3f, 0x2134c8d3, 0xe7267f84, 0xe39434d4, 0xf81a7ec1,
+       0x8ade2245, 0x71e955be, 0xc1fe20a5, 0x15a59bfe, 0x287f9077, 0xd6937fd8,
+       0x8f666a2b, 0xe9dff7c7, 0xf78c2f3a, 0x8bf22369, 0xfae287a2, 0xffc1081d,
+       0x3970c66b, 0xbad5f0a6, 0x5dff1e5e, 0xcc6a5bd7, 0xe656b484, 0x9db003ab,
+       0x75fda0fa, 0xa377f39d, 0xb5dd611f, 0x60631145, 0x3bbdd6be, 0xfc813d8f,
+       0x66352e6f, 0xeed777e1, 0x1fcc2e30, 0xfee097a4, 0xf2e18ca6, 0x184f4072,
+       0x97cbdf66, 0xed5bfaf1, 0xe463397f, 0x87ff6cf3, 0x87607fef, 0xedc31d8f,
+       0x4fdc25f0, 0xe0f0edc2, 0xc791437d, 0x792ebb4a, 0x63ca879d, 0xc04877fe,
+       0xec79265e, 0xbd51231a, 0xb1b9cee4, 0xbbbf4764, 0x0d325620, 0xb4433f6d,
+       0x87f2626b, 0x71e8afb6, 0xa8e39f6e, 0x871ced11, 0x1749fb96, 0x99bef408,
+       0x9db9f7a2, 0xeee3e902, 0xeb1f9d4a, 0x2ef57829, 0x85d57ee0, 0x4c3f9d0e,
+       0x150fd418, 0xdca071fd, 0xa2b9502e, 0x637a2a4f, 0x71fb93af, 0xe5e78c17,
+       0x16b986b7, 0xd87d7ce1, 0x13f94615, 0xc67cf126, 0x0093479c, 0x813df45e,
+       0xfacbff11, 0xc1a742a4, 0xcea5e6fa, 0xd7be1b8c, 0x4fa64db3, 0x8352cf85,
+       0xbfd943f8, 0xdd39f39a, 0x1dfee1d7, 0x7ff7fb8b, 0xe0f2f4aa, 0x7eff6176,
+       0x466ff108, 0x1fbe121d, 0x19d15bff, 0x4aff3eca, 0x5efe0bd6, 0x23debf59,
+       0x72af8825, 0x7db8764e, 0x6fd64eb5, 0xce6f2b86, 0xbcfc7aff, 0xdfdf1e47,
+       0x8e779f8a, 0x9f43bff9, 0xf50bd01d, 0x4779c7a1, 0xc64fc941, 0x6b86bcc0,
+       0x739e743d, 0x1ecdf7b8, 0xb055f595, 0x7c745573, 0x41af4534, 0xc35dc8bb,
+       0xd1cd03fd, 0x7ec9afd2, 0xf7a5ae39, 0xef921e57, 0xd5783e73, 0xea2d694c,
+       0xd92e90c9, 0xd9de927b, 0xc6a3525d, 0xb77d19bf, 0x34aafdf8, 0xb157eb8a,
+       0x552bf232, 0xf19b4675, 0x7c737fbc, 0x2be431fb, 0xb4ad6edf, 0xc6feb03b,
+       0x237d72d1, 0x44d5b7f7, 0x618fdfd3, 0x95407a41, 0x57df5827, 0x645305eb,
+       0xfa70d13f, 0xc3ba2fc1, 0xd1e95cb8, 0x39d79f12, 0xd055dff9, 0xe0b97277,
+       0xbf23086e, 0x886bda09, 0x820d67d7, 0x5f3ddf1f, 0x4cfbd729, 0x13ff25ec,
+       0xcaa0d3c5, 0x2ca7ceb9, 0xd4dfb20e, 0xbb95a3f1, 0x33724b7e, 0x73148e38,
+       0x0d0b8e40, 0xd2268dc4, 0x60959079, 0xbc9fe24f, 0x5dd24b72, 0x1f80ff38,
+       0x71dc93f3, 0x9730fca8, 0xfb223e7a, 0x3cebc973, 0x7e2433fe, 0xc7933cd4,
+       0x95ddf08f, 0xa5c87e10, 0xc51d8f23, 0xb374a3bf, 0xc75d51b8, 0x3247ba49,
+       0xd208ff44, 0x518dae3b, 0x8a4719fb, 0xb23b8fdc, 0x7fa33053, 0x8f3ca46a,
+       0x9c31b77f, 0x7fe9eaf4, 0x79458ea8, 0xf9d3aca0, 0xcf5e7cb9, 0x04a5707f,
+       0x07f89bbf, 0xe3061cd1, 0xf507c5fa, 0xb0e249bf, 0xbbf09464, 0x63b408fa,
+       0x7561ffce, 0x2febce04, 0x2fbfc520, 0x3169daf1, 0x2bd23fa4, 0x0fd82dcb,
+       0xbfc80ba3, 0x45a5fb2c, 0x07230fd8, 0xdfc139fd, 0x6bbf976d, 0xfc853306,
+       0xf8f3af98, 0x6b82737e, 0xa6cfc126, 0xa61efe33, 0xffcefc83, 0xfe8d7402,
+       0x2c183ca2, 0x1a7f9fc6, 0xbc61d6ce, 0xf5de39a8, 0xb3d1f136, 0x08f9091a,
+       0x9338a7be, 0xfb44bf6f, 0xc6194e23, 0xfcf40a73, 0x0cea465d, 0xbcb46bd6,
+       0xc760098e, 0xb0093c62, 0xe6f18059, 0x53ae393c, 0x6c44ce10, 0x6b9d49ff,
+       0xf997be13, 0x5f68b764, 0x8f604c4b, 0x83bf77c5, 0x83824be3, 0x3895c5c7,
+       0x1f1f1293, 0x6024ce2e, 0xee9c053f, 0x8715b9f8, 0x25737180, 0xe7bec49e,
+       0x635720a4, 0xf7ce87b1, 0x48c8533f, 0x718b7fae, 0x21f9259e, 0xc83548e2,
+       0xd5cf2463, 0x394dc571, 0xfe9d10af, 0x3dc4f1b5, 0x1cb7d863, 0x13f3e2ff,
+       0xe8f8f78c, 0xb7b2164b, 0x51effabe, 0x5e76cfb4, 0x42f0fda6, 0x8fbe41bf,
+       0xecfdc7d0, 0x2ff23a9d, 0x2dbb005c, 0x3d9f603e, 0x3ddbcf9a, 0xe89539d4,
+       0x596f40ff, 0x2f3fd604, 0x777c6fe7, 0x48d9fcc1, 0xbd22bd97, 0xe3e78b07,
+       0xd03b0ed0, 0xbd404e2b, 0x975c5be5, 0xb1098fef, 0xd0f0c62e, 0xcbe44cef,
+       0xc05f947c, 0x07ea63e9, 0xd772fedc, 0x598a38f3, 0x72ee0b96, 0x63c1c93d,
+       0xf1411629, 0xc5435b9f, 0xa7ef5e59, 0x856aa37d, 0xbe1cf740, 0xa3a59c71,
+       0x82b7de5b, 0xd3e5d3fc, 0xe70e6e49, 0x9b880eb7, 0x15b7caab, 0x23879c0c,
+       0x815475ff, 0xe31dc699, 0xb3c12c29, 0xbff8ca87, 0x73b875c5, 0xfb3a086c,
+       0x695fdb16, 0x9fdb6eff, 0xb6ddf792, 0x6e3be6bf, 0x77de6d7f, 0xf1dee71b,
+       0xf57fe31d, 0xccff6e3b, 0xaf3f3c77, 0x73ffffe5, 0x70700300, 0x5cf83f9c,
+       0xdfbc7040, 0x1f3efc70, 0x36106d96, 0x6a4177f7, 0x42b57a8c, 0x462d5100,
+       0x0877a2ef, 0x71e24d66, 0x46658db0, 0xf0610eff, 0x5f32807c, 0x1db90b4b,
+       0xe8bfce61, 0x4e79858b, 0xc596f475, 0x126c9fa2, 0x82fd877f, 0x132acefc,
+       0x18cef4cd, 0xfbc04cd4, 0xa161cdf1, 0x7261aae3, 0x23edc37b, 0xdc9617cf,
+       0xfe9e3631, 0xfbc8436c, 0xfec82f1d, 0x23077347, 0xa51324bf, 0xafd47984,
+       0xd0fa8094, 0x3f3c2388, 0x76398baa, 0xda525e10, 0xa507b23c, 0x8b6fc434,
+       0x998def1c, 0xfe869d99, 0x0bd018e8, 0x14f81e31, 0x8e2905c6, 0x4a7aa665,
+       0xe58c1f7f, 0x31d16dfd, 0xe55bee81, 0xac4cf3f2, 0x9e2aa0f9, 0xebae8ef7,
+       0xc50265e3, 0xfe2396f3, 0xe574d2bf, 0x89934cef, 0xff37e618, 0x8ce29980,
+       0x48bd2627, 0x8956777f, 0xf331adef, 0x6ed1872a, 0x1cd63c06, 0xbbf4471c,
+       0xf7a4d0e4, 0x7733e9f1, 0x750f68a6, 0x17f1514f, 0x1dfd969c, 0x8940bf8a,
+       0xf65efd6b, 0xfe887c93, 0x221fba17, 0xab1dea51, 0x27f7b6f9, 0xfc10d8ef,
+       0xfee045bf, 0xb8afdf21, 0xde9c687f, 0x6e78119e, 0xaf3cb372, 0xdc78bacb,
+       0xecf7f142, 0xee33c793, 0x01976d11, 0x4d71d2f6, 0xcfb8f463, 0x094a6b8f,
+       0xe1c0b4c7, 0xf07de0d7, 0x35fbd5c5, 0xa285faca, 0xb2b1d6a3, 0x9fa7a31f,
+       0x12ff7ae2, 0x60ffe714, 0x30bf3f2c, 0xf1e390af, 0x0824d801, 0x1b12c9af,
+       0x711c7d51, 0x2a1b598b, 0x7605549e, 0xacb9e231, 0xccade399, 0x34975577,
+       0x7339fb15, 0xd309bfb4, 0xa9b49aa2, 0xbdaf6fe4, 0x9bfa84d8, 0x63e5dafb,
+       0x4cbf93b7, 0x713da12f, 0xefda9f4f, 0xa5a30ab6, 0xfd2784f1, 0x0cdf5a9d,
+       0x71e3ec91, 0x9fa24433, 0xb230aa98, 0x4c74635f, 0x2e78426b, 0xca8a8bd7,
+       0xcc22a6e3, 0x3e934416, 0x4523d458, 0xe83f97df, 0x51998b07, 0x74f38f1f,
+       0xe2aaf8b3, 0xcc35bb4f, 0xe7ae1af1, 0x5d5f1b5f, 0x74bbcef9, 0x971954ae,
+       0x9c4a2f32, 0xaaf8b874, 0x5dc1ce72, 0x2e75457e, 0x4ff62dc3, 0xb8e3ff47,
+       0xf2f46783, 0xfe334b39, 0xfe25611d, 0x8bf5ee3a, 0xe2557714, 0x45cf6eac,
+       0x3be1abd2, 0x0e3f7e3d, 0x06213f96, 0xf1e217df, 0x9ef157d7, 0xffef1e94,
+       0xd4bee999, 0xc5fdf21b, 0xe63f184e, 0xa1cde9bf, 0xa76bcbb4, 0x98b790f4,
+       0x45e77752, 0x387ed78a, 0x53ef1d56, 0xb49779e2, 0xd56333ce, 0x0e0923e7,
+       0xc369f78e, 0xddc6bfb9, 0x97bfa3a3, 0x48c77ee1, 0x73a4bbf2, 0xfaebdd19,
+       0x246ba4f2, 0xf1875de2, 0x38ba00b6, 0xe187b0ef, 0x9de7613b, 0xb38c30f6,
+       0xa73eeb8d, 0x752ff3c7, 0xfd1eaf62, 0x12718061, 0x1f744d1e, 0xf7cfc8b8,
+       0xdfd09676, 0x5c69bae3, 0x136fe3ac, 0xe59ffb17, 0x00210141, 0x00002101,
+       0x00088b1f, 0x00000000, 0x17b5ff00, 0x67534c5d, 0xb7b77cf4, 0x0bdf96e5,
+       0x72223f2a, 0xa29862c1, 0xa740c2dc, 0xac741631, 0x4a8a5c13, 0x66b50102,
+       0x2d09922e, 0xcbc2ccd9, 0x01893ad2, 0xb8b2c3dd, 0x26a9f364, 0x87b6e883,
+       0x6ead93fa, 0x840b0b55, 0xc3e22e25, 0x52c9719c, 0xba33330d, 0xd8dc6281,
+       0xdf39d85c, 0xd8bdb5bd, 0xa4da2cbd, 0xdf3f3d39, 0xfff9df39, 0x0730000a,
+       0xb956e7da, 0xf84ce706, 0xffc6cfa5, 0x4fa43d0f, 0xbddde38c, 0x1726eb4b,
+       0x3ebbf1c4, 0x036935c9, 0xce9c5df8, 0xf6002b94, 0x1c5ace87, 0xaccf1f04,
+       0xedfc2176, 0x4ab5dfc2, 0xd2f7803a, 0xee202d4c, 0x96a666fd, 0xd2afdef8,
+       0x4fe9027a, 0x8ed77bdb, 0x70045e97, 0x106b4196, 0xc12e55f9, 0xb8e08271,
+       0x4546fac3, 0x25c06e5c, 0x80fce938, 0xe89b34ad, 0xd9a55cc7, 0xf5f4137b,
+       0x00674539, 0xdaaf39e9, 0x09f489ac, 0x06a019bb, 0xc15c0ce9, 0x556bf624,
+       0x7fdfdb81, 0x4a4f2ad2, 0xdbf11c7a, 0xe036cc1d, 0x3c8150de, 0xf7c71e59,
+       0xfc028fd3, 0xd422666e, 0xb9e97402, 0xd77264b8, 0x3bafa8aa, 0x52816a3f,
+       0x5c5b4ca2, 0xdf5e30ab, 0x12acfd4b, 0xbefcf860, 0x170568e2, 0xa0172095,
+       0xe0373f4d, 0xb19c5bdc, 0x3d7fc010, 0x4698ca05, 0x4adf9113, 0x2a8e143f,
+       0xa769da22, 0xb6e5785f, 0x4c27f7fc, 0xcdba11ab, 0xbdc268fe, 0xc3829dda,
+       0x2eedc99a, 0x7920ce6d, 0x212fce31, 0xb74bd3a5, 0x51cc22ad, 0xf413e428,
+       0x025ac217, 0x36ada8d2, 0x0406ef6e, 0x7ca1b07e, 0xa488539b, 0x70d69da0,
+       0x6f50044a, 0xdf045395, 0xcd7b088b, 0x7c461281, 0x2be726f1, 0xbf11366f,
+       0x042aae4f, 0xcbe7e3f4, 0x09417916, 0x3464dfbf, 0xf3aa8e21, 0x3c52fed3,
+       0x953176af, 0x34ef6adc, 0x4193f1f2, 0xe3d6ee7e, 0xfc3433b2, 0x5ff72172,
+       0xcb9e0136, 0x8e38031d, 0x18f67776, 0x756eedcf, 0x3f7461de, 0x337fa0f8,
+       0x904d81ca, 0x6bde8907, 0x3b3aa394, 0x001ff18d, 0x43d62670, 0x0d41d537,
+       0xe7e1c641, 0x45d513e8, 0x582a0615, 0xbf373f11, 0xf974467e, 0xf062faf9,
+       0x5117f10c, 0xd80d567d, 0x024dbf28, 0xf5e10194, 0x9f412d92, 0x9eb9155f,
+       0xfc01650f, 0xde17d728, 0x7e30c83e, 0x915f8f7d, 0x4a6e505a, 0xd2ca97ae,
+       0x32f7b8e3, 0x401653d6, 0x036cf0f5, 0x9858fbc5, 0x794d1581, 0x28bef1f3,
+       0x6eb17d57, 0xbc4ead9c, 0x31dfe6a7, 0x3a44f9cc, 0x0d9a81d5, 0x61205f9a,
+       0x5817fcbc, 0x55ed1060, 0x491c3d35, 0xb2b9f8a3, 0xec8532d5, 0x23a50ed8,
+       0x6b126dee, 0x3c2ee118, 0x160ef840, 0xf6e7f090, 0x005b9d2b, 0xd8b754ed,
+       0x5bdc52af, 0x15aacc3a, 0x40dade88, 0x50596bf4, 0xff122937, 0xc4a97bc4,
+       0x55aa672f, 0x9eb3be21, 0x445f8df8, 0xade7aa44, 0x7865a514, 0x8d28cbb7,
+       0xeac1b37d, 0x551f500e, 0xf411a337, 0x3587476f, 0x84b5fe40, 0xce90cd9b,
+       0xbea041eb, 0xedcf5b7b, 0x328f45b7, 0x099f48a3, 0x5f916757, 0x16d3cc0b,
+       0xea356115, 0x7841c82e, 0xb005bee1, 0xb4e2bc1f, 0x73b94645, 0x05ac4c3e,
+       0xc49f4be0, 0x8327c861, 0xd7c03963, 0xc30e7cbe, 0x2fd3853e, 0x8c39cafa,
+       0x470e54f8, 0xa8356b7c, 0x959e3cca, 0xdd02fbe1, 0x7059a727, 0x7e6f9b25,
+       0xf9623ebd, 0x29ef0baa, 0xba3e7ba6, 0x93962eea, 0x5a20c7c8, 0x6ad6142c,
+       0x6730c9fd, 0x06c3e75e, 0xe881e3b2, 0x60a73a61, 0x460d61be, 0xef308421,
+       0xaa6febbf, 0xd96f9b52, 0xf193b802, 0x04faf467, 0x3cd02287, 0xfad24b7a,
+       0x5fc5787f, 0x48529e3c, 0xf31eb2b9, 0x413719e6, 0xd48fd20a, 0xbe7f736b,
+       0x4f18eb9e, 0xc0ddb8c0, 0xcf9c1278, 0xcbf8b56f, 0x74ad1f28, 0xa7e7248f,
+       0x0ac4faf4, 0xb432bb30, 0x4fbc329c, 0x600e6c47, 0x8f30b220, 0x4916211d,
+       0x19df3ec5, 0x244774de, 0x96e0c3d8, 0xd73c7e71, 0x46e6d87d, 0xb6f389a5,
+       0xf9268d33, 0xd54a5c13, 0x34592ce2, 0xf6d56fd8, 0x8b5d935a, 0xb56e0c73,
+       0x9471756b, 0xfbeb059a, 0x381679e8, 0xa9e7fd88, 0x734ebb18, 0xd001cf2c,
+       0x93c7c38b, 0xd1311e9f, 0xef990f3c, 0xd8e3993d, 0x0c8a791f, 0x3794391d,
+       0x41f6260c, 0x24077e81, 0x63946dc0, 0x6e611c91, 0x192dca25, 0x9f7d259f,
+       0x2f6e15d8, 0x01905777, 0xfe0450ba, 0x465f3483, 0x1a77502d, 0x639d77ed,
+       0x3bfa9070, 0xf70502e0, 0x1bf1e8fd, 0xdd214f87, 0xb4c98e73, 0x5783ba8e,
+       0x16ef9ef9, 0x78ff7827, 0xbc2d77c2, 0x3537831e, 0x0239887a, 0x403af249,
+       0x6eed1dfb, 0x6e687f46, 0x05301f74, 0xc36ed052, 0xbdafad39, 0x41404b0e,
+       0x1de8ac7c, 0xe79df091, 0x1cd1e419, 0xa5162653, 0x1980ff11, 0xafdc2502,
+       0xfd84baa6, 0xfc855f84, 0xd8cfed8e, 0xf4c0f1fe, 0x6bd52158, 0x0a235327,
+       0x8cb73fdf, 0x922f05fb, 0xed2fdf1b, 0xcd3361a1, 0x0643dc1b, 0x868eddb9,
+       0x713f343b, 0x4be918cf, 0xf9e7df0e, 0x53af2880, 0x7e062fdc, 0xe1633d8d,
+       0x58092c6d, 0x38731509, 0xca5536cf, 0x6eaddf3c, 0x1f18dcc6, 0x91757049,
+       0xc991709f, 0xc7e76f34, 0xf5aed1ab, 0x419fa341, 0xc877e62f, 0xd0c7d5a2,
+       0xa3f0163a, 0x94a2237c, 0x7b8ba1f7, 0x1cfd0cfc, 0x40aa62aa, 0x8c2120f1,
+       0x3e3d16c7, 0x6e1f802f, 0x70a9fc4b, 0xe01aae6c, 0x2b61ac35, 0x5ea353d6,
+       0x6e01000f, 0xd4e3f9a7, 0x8e23bd08, 0x2af9839a, 0xf9f8977f, 0xe055677d,
+       0xe814d4fc, 0x6bafd649, 0x6ab375ec, 0xf33dc90d, 0x7b2ed3f7, 0x47d3f792,
+       0x3b2276f8, 0x244ced7b, 0x2bbe30bf, 0x15efbfa9, 0x411ccb5d, 0xb5c981f4,
+       0x5975ce8f, 0xbea9ab22, 0x1cdc981f, 0xee91f18f, 0x8b82fda1, 0x91f516ef,
+       0x87cf8c00, 0xcc67e523, 0xa2769794, 0x125beec7, 0xe9b8e397, 0x0aa1fc69,
+       0xa1efdacf, 0xfda79aca, 0x17fa867e, 0x7f57cfab, 0x1dbcb26e, 0xa497f9a2,
+       0xe7d27e7e, 0x9912c01f, 0x3893cbf7, 0x6487b683, 0xaa3c75e0, 0xa67ef5ef,
+       0xc87b48fc, 0x06199dff, 0xed5cf895, 0x7ff4d0cf, 0xc18beba6, 0x9bf61d51,
+       0xf6f9b935, 0xfc39f427, 0x8a71c98b, 0xa4f2bdee, 0xdf824a00, 0xa0a982ab,
+       0x195df824, 0xf6e031ca, 0x7c8362c8, 0x81a978f5, 0xc2b1335f, 0xbd735fc0,
+       0x14bf80ca, 0x5f90675d, 0x01bd6bff, 0xc5bd30df, 0xcff1bf20, 0xd63c066d,
+       0xb95875bf, 0x4936e789, 0x0ae41baf, 0x157e8d3b, 0x2afd18f5, 0x15fa35ee,
+       0x37e25bd3, 0xdfacb7fa, 0xf64e5fe8, 0xde855c83, 0x91fcffa1, 0x2060fb49,
+       0x34f3c33c, 0x13029d35, 0xa8c44734, 0x66c21fb6, 0xf0a617be, 0x84a2e2ff,
+       0xd7a72c3c, 0x0919da3f, 0xb9d2b32f, 0x2b369d0f, 0x512edbbd, 0xfe3e600d,
+       0x2e76d705, 0x000ee017, 0x00000000
 };
 
 static const u32 csem_int_table_data_e1[] = {
-       0x00088b1f, 0x00000000, 0xe733ff00, 0x51f86062, 0x39fbc10f, 0x716e1819,
-       0x0143f822, 0xd9433117, 0x1017fa40, 0x606463bf, 0xbc48cf78, 0x040e357e,
-       0x033b2f7b, 0x3e200ac3, 0xfef03ec0, 0xc95c481a, 0x4ebb3f4d, 0x622ed1d0,
-       0x067e2ef0, 0x0c023d86, 0x1082590c, 0x54417ffe, 0x08fcddf9, 0x651898b6,
-       0xf5012976, 0x93320003, 0x038009d3, 0x00000380
+       0x00088b1f, 0x00000000, 0xe3e3ff00, 0x51f86066, 0xb8d3c10f, 0x72361818,
+       0x0143f821, 0x684333b7, 0x0606163e, 0xc77e2001, 0x9ef0c0c8, 0x38330491,
+       0x207eec10, 0x27880abb, 0x7dcf5071, 0xe52f1143, 0x5f5d9fa1, 0x153d76a0,
+       0x837f7818, 0x031083b0, 0x03309b83, 0x8408b483, 0x55045fbf, 0xc10851de,
+       0x99412e7e, 0xfa819f5d, 0xbbeb8d01, 0x00038031, 0x00000000
 };
 
 static const u32 csem_pram_data_e1[] = {
-       0x00088b1f, 0x00000000, 0x7dd5ff00, 0xc5547c0b, 0xbddcf8d5, 0xeecddd8f,
-       0x21079b26, 0x086e3c21, 0x4bc60a22, 0x9bade102, 0x88b46204, 0x7d608a89,
-       0x8420182d, 0x96d22247, 0xedf7ed7e, 0x5ab11062, 0x68db151b, 0x34105db1,
-       0x060b28da, 0x2df0980c, 0xaa5694a0, 0xd1f58df1, 0x90cbc8a0, 0xf87e8784,
-       0xce7feb69, 0x7bbbb999, 0x7c486eef, 0xfefdfbf4, 0x730ecfe9, 0x3399dee7,
-       0x9ce735e7, 0xc92b3339, 0x210cb102, 0xbbf81be4, 0x22ad909c, 0xa46c6421,
-       0xe5a22aec, 0x79fc4218, 0x8126c08e, 0xafaed090, 0x4234908e, 0x54cd364e,
-       0xec84d9ad, 0x2e8473ce, 0x0327eda7, 0x6d2b0185, 0x76f6de2f, 0x4beb44a2,
-       0xb41289b6, 0xf1d9765b, 0x4275cefb, 0xd6d5ea00, 0xd12607b6, 0x9136f77a,
-       0x935da06c, 0xd242d390, 0x23623909, 0x61754fec, 0x559dbe7d, 0x7ddfac97,
-       0xd9578c2b, 0xfa76256c, 0xd12691fd, 0x9b65f503, 0xe3a10084, 0x8f71d92d,
-       0xb7f68032, 0xed042020, 0x7a6fad2a, 0x845d5150, 0xfdebb5dc, 0x212776c4,
-       0xa2367c27, 0xca8f382a, 0xaa4228e0, 0x064a5b02, 0x1aabefd0, 0xfb42cd05,
-       0xaa775aaf, 0x6aabe013, 0x69102f92, 0x1c1a8b7f, 0xc6c11d44, 0x78c086fe,
-       0xbc703b7b, 0x1830f26d, 0x3bebf2af, 0x3cc22215, 0xb77c0f65, 0xf301c284,
-       0xe13dc7d6, 0x74f1c7ab, 0x9a792e7c, 0x5bdf478e, 0xc1a09cfa, 0x885a9714,
-       0xdce8e017, 0x84fd9f61, 0x52b7e613, 0x9e8aee19, 0x30ed9cc7, 0x7ac0aa8f,
-       0xf009c4a5, 0x8fe657ad, 0xa8b7f48a, 0xf846f7e1, 0x7bfa73ea, 0xe5cddaa3,
-       0xe9451f09, 0x8abd48f0, 0xf6904f10, 0x5280a44b, 0xf9e4497e, 0xd2324207,
-       0x4883517b, 0x7fa45b54, 0xfa42794a, 0x9b7fffd1, 0xc1e293fe, 0x6c0aeadf,
-       0x6dd08eca, 0x16681b99, 0x3769dba1, 0x5dd4a3a7, 0x5ebfdd10, 0xa0f4003e,
-       0xdcf9d4f0, 0xcbe43e58, 0x4fad72c0, 0xd6fdbc45, 0x7acb0237, 0x1fcf869f,
-       0x72c78df3, 0xe583cf9d, 0x58a57c1f, 0xf8657c06, 0x6cdf06de, 0xbcfa372c,
-       0x5f49fcf8, 0xbe0d9625, 0x8cfe7c1a, 0x8d96056f, 0x7f3e3f3e, 0xcb06b7ce,
-       0xcb0eafa0, 0x5a2f40ad, 0xf802f936, 0x035f76de, 0x20becd96, 0x6be9df3e,
-       0x8e7ef2c6, 0xa4c9c4c7, 0x4878a250, 0x253710f4, 0xee99493b, 0x3d699429,
-       0xd3d58ca5, 0x2a17f66f, 0xa5ee9eb4, 0x01978a75, 0x5685438b, 0xc3501f5a,
-       0x92ff07da, 0x7d68d914, 0x0fb59fb0, 0x6453dfbd, 0x75a1f5a7, 0x3af87dac,
-       0xad02517f, 0xf6b00f0f, 0x45431b8b, 0x38bf5a0e, 0x5b73dac8, 0xd693b148,
-       0x9eac4373, 0xec53c077, 0x36bcf5a2, 0xc0f82f56, 0xeb489c5f, 0xfbeced05,
-       0x51011d89, 0x61d2c675, 0x4edeacab, 0xf9d6ad28, 0x1348f4af, 0xef515d68,
-       0x8fc51a24, 0x948f5aff, 0x7b21f149, 0xbfe43db0, 0x149bdb09, 0xe1bfb60f,
-       0x76fac0af, 0x87ed8bd9, 0x5d584bfd, 0x17fb62f1, 0xbd629ffe, 0xbb63f659,
-       0xd58fa56d, 0x0fb63f15, 0xfb06b958, 0xb00729df, 0x07cad47d, 0x12a77db1,
-       0x5687f6c0, 0x4a99e63d, 0xf782b5eb, 0xb48fc0b7, 0xc03924ac, 0x328cc14f,
-       0x05ab4fca, 0xf7f81b32, 0x28e980bf, 0x54ceae5f, 0xfeb70e50, 0x9009e0ad,
-       0x834bfc5f, 0x7f27fcfa, 0xffdf8d95, 0x6991fb11, 0xfdef623f, 0xde3abde4,
-       0xabde4fd0, 0x0d3f7a95, 0xbdad5ef0, 0x7d6cfd6f, 0x9e11a275, 0x7ef4ab57,
-       0xae3c20b6, 0xef2bcdbe, 0x7846c9b5, 0xf7ac5b5e, 0x49e113b3, 0x4d3c1bee,
-       0xd3f11b6f, 0x3f1876f4, 0x7e9e117b, 0xcc67837d, 0x8cfc463b, 0x9f8c2779,
-       0x664fd803, 0x7a69fadf, 0xa69f88c7, 0x79f8c277, 0xa835e71b, 0xf31af36f,
-       0x633f11ae, 0xe7e30dde, 0xbb278423, 0xff6cfd6f, 0xed9f88d0, 0x73f1861f,
-       0xa0b9fb14, 0xf82af36f, 0x829f88c8, 0xe9f8c28f, 0xea2e7ec6, 0x3fdb3f5b,
-       0xfb67e232, 0x7cfc6147, 0xd25cfd89, 0xfc1579b7, 0x829f88c3, 0x63f1847f,
-       0xd19fa011, 0xf9a7837d, 0x9a7e2353, 0xc7e30d3f, 0xed8cfd81, 0x8fe33c1b,
-       0xfe33f118, 0x693f1848, 0x427dd002, 0x3e69fadf, 0xf34fc462, 0x067e3091,
-       0xfa533f61, 0x47f1af36, 0x7f19f88d, 0xe19f8c34, 0x2a42af38, 0xa10f00f7,
-       0xee7ab8fd, 0x2349e767, 0x0c9e767e, 0xec52e7e3, 0x27ed1a67, 0x267ef7a7,
-       0x33f11a76, 0x9f8c33b1, 0x95cfd8f1, 0x6767eb7d, 0x3b3f11a7, 0x29f8c33b,
-       0xdd5cfc44, 0xec4d79b7, 0x6267e232, 0xfe4fc317, 0x89c5355b, 0x85ae9db4,
-       0x993f489a, 0x08f1e1d4, 0x59ba2eb4, 0x046b745d, 0xb75112ec, 0x479b4837,
-       0x1b3bdfa4, 0x457ef393, 0xa28eeda2, 0x8b979872, 0x76d1635a, 0x04f8d247,
-       0xec939d83, 0x53d43149, 0xde18074b, 0xd43657ef, 0xf67fded0, 0x4cf686c5,
-       0x9ea19e6f, 0xf0d13955, 0x229aa0fe, 0x8ac87d43, 0x67ef0cab, 0xd435affb,
-       0xd8fcd673, 0x7505fef0, 0x17ed0d73, 0xda1957d6, 0x332c0a2f, 0xfc3647d4,
-       0x4bfde187, 0xda197782, 0x95fe6d2f, 0xe8747da1, 0x7f3d4321, 0xf78663ff,
-       0x306db6c7, 0xf83b8fb4, 0x427da18c, 0x7d4356fb, 0x269db1d2, 0x3ee9cf3b,
-       0x45d79232, 0xecc27be0, 0xed054cfe, 0xc14b90bd, 0x89c032ba, 0xd76efc76,
-       0xa530f57c, 0x76e7b2af, 0x17d28d35, 0xbae84a68, 0xf2a0385e, 0xfcfa76c2,
-       0x17bd13a7, 0x9ff3e9ba, 0xdd4bde2a, 0xca53ec71, 0x80c9020f, 0x6940b552,
-       0x6647bf6e, 0xf59458fc, 0xf443f0f5, 0xf74b6afb, 0xb75a64f0, 0xc0f58588,
-       0x2c107fbf, 0x2209a7c8, 0x12f781a9, 0x82fd04ac, 0x9e0bb27b, 0xebf147f0,
-       0x0e54419a, 0x6bbf4885, 0xd8066f64, 0xbe561b19, 0x643b07ee, 0xaf3a20f5,
-       0x213c8401, 0x0ff21ebc, 0x9a0fdfa3, 0xfda5e19f, 0xa76a1559, 0xd0af8f47,
-       0xf8e147f1, 0x73fe300d, 0x1d6f8c3d, 0xbe30de3a, 0x61a5706d, 0xc7429b7c,
-       0x607b5377, 0x7c7c7be5, 0x8489844a, 0x87bc2f3c, 0x57075be3, 0x28f7f8e2,
-       0x1e895fd4, 0x7e3c213f, 0x2ecbc833, 0x9c6c7f18, 0x689d0ff9, 0x2ae0ff9c,
-       0x3615fce3, 0x0f2b3dff, 0x7013f1f1, 0x43857bfe, 0xab83fe6c, 0xacadfcd8,
-       0x89f8f0df, 0x87effc61, 0xd3dabff9, 0x1b2673fc, 0xb1643fe7, 0x3656fe71,
-       0x8f2b1bfe, 0x389df1f3, 0x71c29bfe, 0x8b21ff36, 0xeac57c71, 0x947f80d5,
-       0x009a84ac, 0xa40c9f1d, 0xb03fa98a, 0xca071d0b, 0xa9942911, 0x30b5f909,
-       0x69f8e114, 0x2fb7e302, 0xa1bf2812, 0x73e3f1be, 0xad9aa012, 0x9c5dfa80,
-       0x163517d7, 0xb097a02a, 0xf32bfa9d, 0xcd15a838, 0x5937f222, 0x405c0d6b,
-       0x166cede1, 0x58af50fd, 0xfa00253b, 0x6e4adaaf, 0x24ef832b, 0x9fe78212,
-       0x86c9723e, 0xcb9979e8, 0x91f27579, 0x0b7928f6, 0x644551fb, 0x6f850d44,
-       0xd8c1301a, 0xea63fd48, 0x5fea1107, 0x0cfd407c, 0x13f25942, 0x11f78d99,
-       0xdea097f5, 0x6825fd4e, 0x7e256427, 0x2b7bbb47, 0xc65fc283, 0x6258ffe1,
-       0xcdf1faf2, 0xe54fc042, 0x8f9f8bf3, 0xb6f53f46, 0xf48a0e15, 0xfc731c08,
-       0x9d3a86a9, 0xd4e81f97, 0xd81ac3bd, 0x557e2020, 0x8a3957c0, 0xafb72126,
-       0x8eb8a2c9, 0x252effbc, 0xfd45267b, 0xf723c40d, 0xb2dfefa7, 0xa6e4185c,
-       0x58f4cee3, 0xe13ad8f3, 0x5ca0b2c9, 0x78cb2c93, 0x1a6dae42, 0x481ed32d,
-       0xb8fe47b9, 0xebdc6a3d, 0x99f58d4a, 0xa77ac665, 0x142d91ec, 0x8172ceae,
-       0xcefda7ac, 0xd76c6d9a, 0x525a71c7, 0x78f99d18, 0xbe0ce965, 0xc1e65059,
-       0x79d23763, 0xab7d9bb6, 0xbb7d53c3, 0xa0585d4c, 0x011fbfa7, 0xf0d3faba,
-       0xd9bb1fbd, 0xcef0cdbc, 0x329e6d96, 0x73d9cf3a, 0xb7f000c4, 0xefbffe19,
-       0xb92c7872, 0xb0f35cb4, 0xf3b12c4c, 0xa37fc331, 0xa09f3cd7, 0x4df0eb0c,
-       0x8ce7e695, 0xfa708e6f, 0x41fc0c7f, 0x1fc0a3cb, 0x9cc3fe14, 0x957a223f,
-       0xd5b547f1, 0xa1f8033b, 0x209151fb, 0xdcbf395d, 0x5e65f9c0, 0x082f919d,
-       0xc740caf1, 0xbc85b305, 0xc1f1455f, 0x0b07ce2c, 0x737c8dea, 0x99cbf10b,
-       0xe372e871, 0x6777f5da, 0xfbf3b1a8, 0x4dcdf390, 0xfc46eff7, 0xd193cec4,
-       0xa74e56e9, 0xed8c6a5b, 0xdeba7037, 0xbb3ae9c2, 0xa997c1fe, 0x563f20fa,
-       0x7bc83203, 0x7a742ff5, 0xe9e81bb6, 0xc334f4e5, 0xe7a72b79, 0xf4673fad,
-       0xcedbc334, 0x7f5ed9e9, 0x63432646, 0x77c335e1, 0xf9988adb, 0x39cf4028,
-       0xacf4f8fe, 0x3d4c2e6e, 0x497cf51c, 0xc3d4caf0, 0xa8b67251, 0x5f50dca1,
-       0xf0d1b818, 0x39fa82fe, 0x7579f686, 0xb7ed0d0b, 0x50c3b9af, 0xb9ffe39f,
-       0x56dbfde1, 0xdfb434ac, 0xa1af7352, 0x07caa6fd, 0xbd1bf50d, 0x9fde1a8f,
-       0xa1bd7b35, 0xd3d9667d, 0x4aebf686, 0xe5ea18b7, 0xf7861d9e, 0x870b5d85,
-       0xeabae3b4, 0x887f63fd, 0x4567be27, 0x3beb353e, 0xf61e2f5d, 0x88fcf8a9,
-       0xc796046f, 0x3f3e1a7c, 0xe58f1be1, 0x74dfd04a, 0x60ecb05d, 0x7343f565,
-       0xe2a3b886, 0xdac89f1e, 0xbdb3d060, 0x7dfd43e9, 0x7fa3deb3, 0x14ecf159,
-       0x902c5cbd, 0xbb075832, 0x3fad1db8, 0x49d7c53f, 0xb942ee42, 0xb930ac5c,
-       0xb335bc5d, 0x3d422488, 0x4e26bc34, 0xcf2c267c, 0x33e70141, 0x00c72eaf,
-       0x91fa82e7, 0xe036f826, 0xf9030b38, 0x1a8be786, 0xebbe1926, 0x7c222dd8,
-       0x27c6414b, 0xb65672c0, 0x85f002c7, 0xeebe0ef6, 0xb3d78012, 0x4beb02d7,
-       0xe7b43f73, 0xa9a57c3a, 0x73c02587, 0x7cc79619, 0xe23cb1b3, 0xd87962f3,
-       0xc7e58957, 0xdb2c1abe, 0xfcb02b7d, 0xf2c7e7c8, 0x2c1adf03, 0xc3abeeff,
-       0x1eafa0f2, 0x017c77cb, 0x35f2df2c, 0x2f86f960, 0xaf9b6588, 0x9f4ecb19,
-       0x5e5d4b07, 0x4865f8a2, 0xe8bf1466, 0x8fd74ffa, 0x9cbf38c7, 0xc7897e00,
-       0x7c8c1b17, 0x41ae5471, 0x43eb30be, 0xfacc1d33, 0xc3f2bbef, 0xdbb30b58,
-       0x443f2fbe, 0xa2659de8, 0xf46f4e77, 0xbd146226, 0x0cdc5ac7, 0xfbef4e1e,
-       0xf638de00, 0xb8b025fa, 0x83b28bf7, 0xff160e3c, 0x6a7a71e5, 0x2ff8b201,
-       0xbe96bb1f, 0x52f686db, 0xe3e80460, 0x77fe23d3, 0x4fb7c438, 0x6752b41f,
-       0x99f9e7aa, 0x1e23d7e9, 0x86fd0788, 0x28ba01f9, 0xdbb6c7e4, 0xed5e1813,
-       0xe84a5216, 0x05ef717a, 0x47736a4f, 0x29225d61, 0x2b407df0, 0x97e9c577,
-       0xdf80a0da, 0xeb5af0de, 0xfa1722fa, 0x57d8f23b, 0xb58e5005, 0x61343b30,
-       0x30f688af, 0x01a13d09, 0xdefac37e, 0xdc4065aa, 0xc502fbb8, 0xc071eb8d,
-       0x9f9fc469, 0xf8220bd6, 0xa8e297bb, 0xbab3d70d, 0xb0dfc40c, 0xf667862f,
-       0xe9bd7f01, 0x39f0dec9, 0xdfe03037, 0xf4decf82, 0x8b7a6f57, 0x9ae7d478,
-       0x76bbfce9, 0x2bf7925d, 0x50d4f415, 0x80f4ffe6, 0xc7bf7d6f, 0xf0254f0c,
-       0xf3bed8f1, 0xceba5771, 0x09836dc7, 0x906de71d, 0xe9ffda17, 0x80930ba6,
-       0xb41fb42e, 0x71b7bbbb, 0xba17b9fb, 0xf636cc9e, 0x2fe5cd57, 0x42925fdc,
-       0xb8e94b84, 0x4921452e, 0xbd161d74, 0x1bf4442b, 0xf83f76b4, 0x5a1cbbe3,
-       0xd8fe0aad, 0x2a435789, 0xdbf468f4, 0x227fef4f, 0x659bfc11, 0xe1f71619,
-       0xcbd47438, 0xb76cc125, 0x680fda33, 0xd74fd636, 0xf441a509, 0xeba4d493,
-       0xc075812f, 0x0c3c3eed, 0x960672f4, 0x32cb3f7a, 0x54e1f714, 0x23d33fa4,
-       0x67a8c98d, 0xf86cf84e, 0x470d0fde, 0xe044fd4f, 0xd09f2268, 0xdf1481ef,
-       0x7efcf4e4, 0x9d20728f, 0x485e2055, 0xc02fe45a, 0xffd3b37f, 0xfd0a19be,
-       0xfbd7584a, 0x7e8a0ead, 0xbcf0a5eb, 0xfd1e30d1, 0x32f7d54e, 0xe59ebbe1,
-       0x7447224d, 0xdb74a77e, 0x175bf7c2, 0x46ddd835, 0x50d930bb, 0x74ce6eaf,
-       0xf844ec1b, 0x95c21807, 0xb77c0482, 0x975db398, 0x7c035ce4, 0xe3043f74,
-       0xf605df80, 0xbb5b12de, 0x4c5155e2, 0xe72f80da, 0x5ef9d78e, 0xd53ef59d,
-       0x915fc74f, 0xf917c809, 0x1055429a, 0xa0ae8fe9, 0xb7eb42c4, 0xa6dcdaf3,
-       0xbd61d345, 0xf6616e3a, 0x4b290578, 0x92b37f04, 0x7c4015d4, 0x94b124f2,
-       0x249e5c82, 0x47e6246f, 0xa2fbe1c9, 0xbedcf082, 0x531768c6, 0x5f50d97f,
-       0xcfac6f50, 0xc3a6d727, 0xb5fcf2be, 0xa0080932, 0xafed8c2f, 0x168e4c88,
-       0xb0d59a90, 0xd995afbe, 0x4dd7363a, 0xdf0a2ca4, 0x2f1e1792, 0x1feb4398,
-       0xd31ecc8b, 0xa61745f7, 0x82abf830, 0x6d0f15eb, 0xff29a4ff, 0xe879aa06,
-       0xb0d581f7, 0x09b7f95e, 0x963526da, 0x7e16df7e, 0xfafabc33, 0xcb3fb31f,
-       0x20d258e1, 0xec710278, 0x0ebe6e80, 0x4d2e7aeb, 0x08e21b72, 0xe2a3d42a,
-       0x9f99df0c, 0x9f8188d2, 0x36bd17ee, 0x1fe31fa9, 0xa904a7f0, 0x9f7ef15b,
-       0xfa6233fe, 0xfec6934f, 0xa40ffd80, 0xfa1817fd, 0xf8507f57, 0x3fc0c587,
-       0x4bff5e2a, 0xbb76785e, 0xaa93ea9f, 0x12248fcd, 0x971e3eba, 0x4a35d2ea,
-       0xee9bc5df, 0x1f3a044e, 0xc089fc93, 0x6203c7af, 0x7ace2069, 0xe9d25735,
-       0x100a71ed, 0xd27f82c7, 0x733c4ffe, 0x5ff7fa1f, 0x18dd926c, 0x86b06a9f,
-       0x971e54ac, 0x4e9c2d36, 0x887eb172, 0x2539efd5, 0xc8d9bd42, 0x3d4f557f,
-       0x0af90e92, 0xbc785394, 0xecf68426, 0x969f8dd2, 0xba44bae0, 0xdfcc8e51,
-       0x52e7f8c1, 0x51cdff50, 0x29db6292, 0x5777e89c, 0x3754bc73, 0x4c4a77dd,
-       0xa3b57f84, 0xbf7e6c3f, 0xd7a5db92, 0x23b4ae49, 0xe32704d4, 0x87d038c8,
-       0x80483e3a, 0x0be2a5d9, 0x1c42e78f, 0x2be363b2, 0x9e144289, 0x1d3a3974,
-       0x3b8ffdbc, 0x6df59ed5, 0x68b39527, 0xaf5f47fb, 0x4f6e66d4, 0xb172b0b7,
-       0x449c4a1c, 0xf5e2e0f5, 0x8fa7e6b2, 0xc4fb3f17, 0x5c418f93, 0x76ab3df0,
-       0xd17fed01, 0x33bf2fb3, 0x6d17d691, 0xb3a6d391, 0xf4853869, 0xe9aa5d08,
-       0x22f22b7f, 0xfe7aa874, 0x84bd4565, 0x4a65ff3d, 0xb68b1e84, 0x25c856ec,
-       0x0e28f8b1, 0x9dda56ee, 0x3c12e871, 0x81f60254, 0x153fc2f8, 0x5df1fba0,
-       0x1d9fe902, 0x5feb9f07, 0xf01ff5c6, 0x74e47484, 0xf4cdd30a, 0x0ba5357e,
-       0x4e9d6be8, 0x5cb1f6e6, 0xea7f40bf, 0xe7e7e428, 0x54fc5276, 0xc1aaddfe,
-       0xbb9f2bfc, 0x71e61133, 0x7c61aa54, 0xe9ddf8fd, 0xa56e3a1e, 0x63774fec,
-       0xfe579ec9, 0x6fc827e1, 0x49ff5e0b, 0x8867c63a, 0x6b82d327, 0xe6133f8f,
-       0x4cdd6f37, 0xe27cdf9c, 0x7cabbe45, 0xfd032c5c, 0x4a44b9f7, 0x8b91c4b7,
-       0xe3b31283, 0x06a06e8e, 0x51df9d18, 0x7e60acba, 0xe6221bca, 0x07721129,
-       0x09fff901, 0x10b50b9f, 0x8db9feb0, 0xa4b369d1, 0xcad461fb, 0x8dd7e68c,
-       0x7d01b4f7, 0xf4f20c4e, 0x6a8b7d87, 0x3e39f922, 0xbf686f84, 0xfad3ebe2,
-       0x5550fa33, 0xa3bfc05b, 0x3c317ceb, 0x64dbf787, 0xf0d73d8f, 0x3b26f91d,
-       0x3e72fe32, 0x013b853e, 0xe9a3e7d6, 0x4954edf1, 0xdaf87416, 0x457f1448,
-       0xf79337c9, 0xf932f78d, 0x503de5d6, 0x67ed0a5e, 0x03f262df, 0x47fac1df,
-       0xc7f50ae1, 0x0bd7ddf6, 0x24ac0fa8, 0x37ae4f14, 0x8dae5cca, 0x509f3aed,
-       0x292125b8, 0xffa05f8a, 0xee3fc414, 0x4b5fcc57, 0x97d28bbf, 0x625e30d5,
-       0xdcba7f6c, 0xfff2e02e, 0xc8ffc826, 0x7593fc88, 0xb67bee4c, 0x17a8fc9f,
-       0x2781cb17, 0xa579031f, 0x4157e9f2, 0x9832e55e, 0x7b8d67f7, 0x9531f9df,
-       0xba82cf93, 0xa7f51a9c, 0xb72b4e59, 0xe4f1258e, 0x46a733f4, 0x7d29cae2,
-       0x9d4e571e, 0xffc7c8ed, 0xc753fa57, 0xfc2657df, 0x27b0fae9, 0x61f59a3c,
-       0x3e22a4bd, 0xfe90facd, 0x620a45bd, 0x3be74ff9, 0xfeaadf9d, 0xe80864b4,
-       0xea5f309d, 0x4be6177c, 0xe262ef9d, 0x99fc06a1, 0x18865fdb, 0x816b8510,
-       0xf032fead, 0x809a6c23, 0x87617e72, 0x6ceef305, 0xbff40463, 0x584bd446,
-       0x1ee2dd7f, 0x8ce8760b, 0xf67c2f49, 0xededf273, 0xbe5aefff, 0x307b63e0,
-       0x861ca03b, 0x74d14be0, 0xe0c2d71c, 0x02403eac, 0x781f5143, 0x7f28b2c4,
-       0xf7970e79, 0x9ad83e17, 0xec2c780f, 0x8ed4951a, 0xfa30727a, 0x6f5cd593,
-       0x49abf69c, 0xb74f4fa0, 0x78bfa0e4, 0x8ae8bf7a, 0x34f7ff97, 0x209fefa7,
-       0xaecb463e, 0xa44ea48d, 0xba45d6fc, 0x6ff06ed1, 0x714d91b4, 0xcba6aff6,
-       0x5f7e2f4c, 0x01fd007c, 0xdbdb4f1f, 0xd8e2ca4b, 0xf9f2b7b1, 0x25f3d8ce,
-       0xb7178fae, 0xbd80b7ac, 0x8b46f174, 0x41bfefc1, 0x479d7ce6, 0x67af80f2,
-       0xc6bbb1ec, 0x8bf71e00, 0x5649e41a, 0xbc529cb7, 0xf342fc71, 0xb07fa1fc,
-       0xdd93eeb7, 0xca2f4fc8, 0x0f01dbc1, 0x11b49e2f, 0xa1db2fd8, 0x078a2dd4,
-       0x830a9de7, 0x4661c773, 0x2f0a1f97, 0x50ce5d85, 0x3673c411, 0x58dbe412,
-       0xf3e4133a, 0xb0240dd3, 0x2de81b32, 0xc1237ab2, 0xca0a57bc, 0x77c327af,
-       0xa35ed35f, 0xe6c2f3e4, 0xe8127f2d, 0x045b4b7b, 0x2fb685b7, 0xe015da95,
-       0x64e6ea97, 0x68d8f411, 0x74ffcf55, 0x147d725f, 0x4b27ddff, 0x13bd9788,
-       0xf009bc5f, 0x2143a672, 0x79efcfb0, 0x68f31ba9, 0x23e4b4cf, 0xaf34f5bf,
-       0xb2e47de7, 0x43f412a9, 0x3a665f10, 0x304c6a8e, 0x7b1527d4, 0x335c0007,
-       0xb5cbedac, 0x2bb77838, 0xa1fdeecc, 0xb2b7b3e4, 0x96fbf2cf, 0xb15ebf2e,
-       0xfeef8a2c, 0xfdbf2b1e, 0xb2efc9e3, 0x987f6a95, 0x9cd6b2f7, 0x65cf80fe,
-       0xc5fb917f, 0x7d67abe3, 0xccdc2fcc, 0x9abb65f3, 0x1a5efca8, 0x544dbf25,
-       0x01c4e37e, 0xe581fa5f, 0xdf9059f7, 0x2bbdf038, 0xf2e8fa33, 0x0872db9b,
-       0xc9b737e5, 0x7933c862, 0x7d76e655, 0xf42bf28f, 0xea0d3ebb, 0xa388e6b2,
-       0x100f01af, 0xe3ccdcc7, 0xc80e30fc, 0x71b8a4b1, 0x63957d9e, 0x8e59bfdf,
-       0x98236d97, 0x6f4b1317, 0x76cbc726, 0x80163950, 0x978e4cee, 0xce3952b5,
-       0x11df958e, 0xbecbf231, 0xdf621a5f, 0xff673757, 0x5e3a66ee, 0x6cd6479e,
-       0x88bcfdf4, 0x968d8f3c, 0x70914967, 0xbcf231be, 0xbcf26fbf, 0x9533cb8d,
-       0x1c5aa1d3, 0xc62d6aba, 0x2717acfc, 0x1e7c6d1c, 0x226ff2f8, 0x5baf49fa,
-       0xeafb5d98, 0x8063a384, 0x7870a62f, 0x743a7086, 0x7fd8fcfa, 0xd347c4c9,
-       0x5f8a4e41, 0xe42dfbaa, 0x28d92f35, 0x4b87d013, 0x1fa10e9b, 0xe8ab8e6a,
-       0xbe399576, 0x7311eba2, 0x8351659c, 0xc7c79eb1, 0x11db172f, 0xa89af25e,
-       0x77c38a6d, 0xb9c13d79, 0xe71deebf, 0xbd9c0898, 0x79f47dc5, 0x3e9706f4,
-       0x970a31af, 0x1f24d197, 0x8f1489e2, 0xbffe2f28, 0x2a87188a, 0x90c0bc2b,
-       0xeb913fef, 0xc2bafcc9, 0x944b0862, 0xf80e3e43, 0xec77f551, 0xb1b27d83,
-       0x303cd507, 0xb44d27a7, 0x7a9fc17a, 0xf28ddeda, 0x0965d3ac, 0xbc0dcba7,
-       0xd407179f, 0x55bf0114, 0x586e0b37, 0x5f43aa77, 0xbd86b9e2, 0x02517e8f,
-       0x55b0b47c, 0x0f915b70, 0xe7e0294f, 0x17f5d095, 0xe5bf29f8, 0x0bbdda14,
-       0xf8450b5b, 0x010ee17e, 0xc37bd213, 0xb6e95f4f, 0x59e3d388, 0x7009df80,
-       0x8d75b376, 0x57b7a7c3, 0xfc037e4b, 0x5b9d8fc5, 0x56e0c59d, 0xde046aad,
-       0xe77861b1, 0x3eaf3888, 0xbde3abc2, 0x98977837, 0xe4daf8e8, 0x220f1833,
-       0xf27dc92d, 0x5c6dbe6b, 0xa1b49aaa, 0xa7c7a67f, 0xf3bd17ee, 0x951b8864,
-       0x8e31920a, 0xedf18ddb, 0x8fffa01f, 0xf83fd7ce, 0x6eba2117, 0x09f1b9fd,
-       0x67c9f7c4, 0xba00cd0e, 0x24517a2c, 0xce974a36, 0xe1091746, 0x0140483e,
-       0x8935543a, 0x48f78c1e, 0x5ceb82a1, 0x65a8f8d1, 0x42ecd8f8, 0xd5b5583d,
-       0xbf4e981a, 0x49fedaaf, 0x9d33d82e, 0xcbef7577, 0x19ffbf02, 0xf898e501,
-       0x1f6173db, 0xfb624aa8, 0x6efc663b, 0xd8fad854, 0x1b31c3b1, 0x606841e4,
-       0x82aa8be7, 0x946b64b3, 0x457bfc3d, 0x7be971c6, 0x7fe6d798, 0x30bcc05a,
-       0x5cfa2f80, 0xd36f9e8b, 0x4bf334f1, 0x00e59aaa, 0x6aaa539c, 0x7109d2d8,
-       0x5683aa92, 0x1baad75c, 0xb75c614e, 0xa8b3f378, 0x459bab7f, 0xe31c9f83,
-       0x2188369f, 0x4d57f82b, 0x4ece304b, 0x1eb087eb, 0xe9a71f8c, 0xb45a8fcd,
-       0x1fbb75b9, 0xa7f9e4e4, 0x529cf112, 0xf444a6db, 0x1fce1b53, 0x47f18a1f,
-       0xd79ef783, 0xf9c13d1f, 0x318a6fe3, 0x521a479e, 0xf0a54fd1, 0xb1c59415,
-       0xff7cc3d7, 0x807fe7ec, 0xd6c76978, 0xf000fecf, 0x99d7fe2e, 0xe282fc3f,
-       0xbbb2ec91, 0x3f55ff41, 0x9bc636f3, 0x728eeff4, 0xf4f9d5bd, 0xeba71853,
-       0x41aacf7c, 0x47ad9d6f, 0xaabc4307, 0xe997cb73, 0x6f2c9f60, 0xd6f6869d,
-       0xfdc56df2, 0x40fb1c49, 0x036f812f, 0x9a13887d, 0x69b7b5e9, 0xf38060ef,
-       0x6c37a524, 0x0be38609, 0x5e2c25c1, 0x42b8f2a3, 0x6c78fc63, 0xe9a11c4c,
-       0x8ca66bba, 0x54d65281, 0xc27887d2, 0x978e945b, 0x8d7e81f6, 0x89ef6fcc,
-       0x1fe1277e, 0xd5b24e94, 0x9bcfbf48, 0x31f1fde6, 0xed4a6b68, 0xea109e31,
-       0x78f4de03, 0xc78a1bef, 0xdaf9056d, 0xdf8c27fa, 0xd3a6dd00, 0xfb3e7689,
-       0x938860f9, 0x6fbb931f, 0x56d57dc5, 0x5797ee2b, 0xf28bbeb5, 0x75edb9d3,
-       0x8f0937b4, 0xf09276bb, 0xf1938b1f, 0x8dead3dc, 0xe087162e, 0x853887f8,
-       0x79cf889a, 0xb1f1823c, 0x29e8a71e, 0x7585713e, 0x6523cf28, 0x1b259471,
-       0x298857df, 0x8f8c23ee, 0xd13df3ac, 0x1b83c749, 0x3a2e30f0, 0x0e3f16de,
-       0x72cb8e14, 0x20fd017a, 0xa78e16ce, 0x8840fad1, 0x778404af, 0xd07d1c49,
-       0xe9c59eb9, 0xfe63653a, 0x2c3e8449, 0xa26456fe, 0xdecf3eb3, 0xe0dea7d6,
-       0xc9f8b6ff, 0x6c79c587, 0xbe3a9e2c, 0xe7c7af8e, 0xb7ef8559, 0x98215a5f,
-       0x802a6ff7, 0x1d34971f, 0x513f2052, 0xf9f4c75f, 0xbc3b7076, 0xf31119e3,
-       0xf707576b, 0xeb371ea2, 0xde70a58b, 0x3fbc0e21, 0x6d2ef0e3, 0xc744eb66,
-       0x49c05756, 0xb3d8e9fb, 0x6979f903, 0x4fc521e3, 0xf0d7dbfb, 0x46fcc2bc,
-       0x4eb03f26, 0xefe0a204, 0x2e776e78, 0xbb322f8b, 0xddce3cdf, 0xd3a79e56,
-       0xea9c7f12, 0x718653c6, 0x0a83f916, 0xff3e97cb, 0xcf242778, 0x44efe82c,
-       0x5f204c9b, 0x2c5044f2, 0x593fb78d, 0xdc799569, 0x74958eba, 0x25f3c4bd,
-       0x449e762e, 0xde30514c, 0xfe35dcb1, 0x941a5260, 0x507e0a8a, 0x5fb64aed,
-       0x5a9ffb5b, 0x36bbd006, 0xc78c06f9, 0xebf099d6, 0xc217734e, 0xd4f71339,
-       0xaec031b2, 0xec937d66, 0x5fe018b1, 0xafed2aee, 0xd1573852, 0x275ce07e,
-       0xef3c3491, 0x94962622, 0xb7447cc2, 0x138f6dc5, 0x659d9307, 0x17851bc4,
-       0x9f3c6dd9, 0x57cebe42, 0x9f7d1fa1, 0x6dadb175, 0x3dba361f, 0xc495f002,
-       0xaf0bd5f7, 0xbbbce377, 0x580d051a, 0xd563aa9c, 0x05f2ce9d, 0xdae8dd60,
-       0x2e4b949a, 0x87890fc5, 0xfe0e27ae, 0xbddc685c, 0xaad1f41b, 0xa649e244,
-       0xaab14672, 0x4e70398a, 0xc84db467, 0xf53d3e01, 0x5fb48bea, 0x60488b7b,
-       0xa9cbbf8b, 0x92790be7, 0xe41cce41, 0x010bcc7e, 0x3526fe56, 0x5f39a702,
-       0xe92bc084, 0xd3bc7391, 0x39c62744, 0xd113af4e, 0xc5c9159f, 0xfccc9bbf,
-       0xf8001273, 0x88b27af9, 0x4a1a79c3, 0xc142bf78, 0x7f05da3c, 0x4420be79,
-       0xf1a21d18, 0xf46a5a95, 0x89edeb17, 0x436fb0b9, 0xc8369efc, 0xfde0ae4b,
-       0x9e332bf5, 0xe7e2a1f3, 0xcf52fb07, 0x7e6cffd3, 0x7fd07ec9, 0xa8f9de15,
-       0x36cffbd7, 0xdb32039e, 0xe42f08ef, 0x7bb9500d, 0xe7b5884c, 0x5c1e5b2b,
-       0xb1e0f90d, 0x0464f3fb, 0x91541be4, 0xa1f20d04, 0x077df6cd, 0xf1c84de8,
-       0xe0271271, 0xd97d67b1, 0x87db7e0b, 0x98f26eff, 0x0b57e2f3, 0x2e8dfbc1,
-       0xf058dfdc, 0x3f51db97, 0xf88c3359, 0xfc46abb5, 0xf198463a, 0x4bb3c468,
-       0xb28de233, 0x787ce079, 0x3c6f1a4e, 0xb3c6655f, 0x0e1da844, 0xd0404af6,
-       0xf931fe80, 0x11ebcd0f, 0xa6fcdeee, 0x8f5f1b34, 0x5fe95e38, 0xa99d2d99,
-       0x533b806c, 0x985ca10a, 0x19cb28e5, 0x83dfe012, 0xf12b02d2, 0x7e85cd2b,
-       0x8f9f0649, 0x73bec150, 0x00891c80, 0x047286af, 0xcf402827, 0x6e07c83b,
-       0x7c85a7a0, 0xd919be42, 0x2cef3d33, 0x5cd0e97f, 0xe03ad5fa, 0xae514bdf,
-       0x14a939d8, 0x06cda812, 0xb0dcd539, 0x367d076e, 0xf38242b5, 0x18ad44e6,
-       0xddcce706, 0xc7903e58, 0x451aefde, 0x182c5f30, 0xfa0e9b3a, 0x291e7aa9,
-       0x80f7fd03, 0xfc033dd2, 0xccedfbdb, 0xaec8b94f, 0xa5ff3ea0, 0x9cafdf5d,
-       0xa9cb97fa, 0xc8b5763c, 0xebc39c2a, 0xbb64d96a, 0x22cdea00, 0x4eaef79e,
-       0xc608bbae, 0x19916cef, 0xc0b6155c, 0xb7c7e005, 0x741eb8ca, 0xf3c64c56,
-       0xadbb612c, 0x7613ed85, 0x78927cb5, 0xef3e947b, 0x22f87e6c, 0x6a3c3388,
-       0x793fbf89, 0x9df2cdbd, 0xfaf0d4fc, 0x3f9314db, 0xe58dbd71, 0x94303c4f,
-       0xf96963ce, 0x330ebe69, 0xe9c49879, 0xabfcd2fc, 0x5adbfe70, 0xe74f3fa8,
-       0xfcde2251, 0x3ce84ba3, 0x312dbc27, 0xd33c4afd, 0xa3b3a4e7, 0x0efef03c,
-       0x3e0065a2, 0x02214c26, 0xf784f3c8, 0x8febee08, 0x7e8f99a9, 0x94898bd5,
-       0x4c5f29cf, 0x0b7ca16d, 0x89c3ae7a, 0x36d8fbf6, 0xc997c0c9, 0xc17bbd53,
-       0x90771ccf, 0x771dbea0, 0x9e3ed8d0, 0xa71c4404, 0xd27cf8dd, 0xc6bd6331,
-       0x1233f7c6, 0xf7f03a49, 0x8445afda, 0x689babab, 0xbb7ed177, 0xfde0062a,
-       0xe1675d02, 0xbf2d1494, 0xade34b16, 0x8c6d2bf3, 0x08551e2f, 0xce8f2fae,
-       0xc13ee277, 0x9855f99e, 0xcfc5fd27, 0x9de243bd, 0x4bd28bbb, 0xddff6c49,
-       0xa7814493, 0x604abd7c, 0x8ccbaef8, 0x4bd297de, 0xbe758f9d, 0x7339f9d6,
-       0x5e37827e, 0xcec38ade, 0xf9a29dec, 0xfc050423, 0x01025db2, 0xe5de76bc,
-       0x9b5fe435, 0x2bb93f4b, 0x6ea9e00b, 0xb676833e, 0x1e7e25ad, 0x225b06d4,
-       0xf2eefbf3, 0x8d7c84af, 0x04a1529f, 0xbf73d8fd, 0x5aafd16b, 0x88534103,
-       0xe6ead9eb, 0x79a7b9e0, 0xe201b236, 0xe65d52b0, 0xfbe02eb5, 0x53572be2,
-       0xb32b1f78, 0x951f9d20, 0xbfdf8435, 0x2f8c1084, 0x077e4c48, 0xa3eb20ce,
-       0xda357fcf, 0xb46d9b0a, 0x1b9b66df, 0x6af54ffb, 0xfdafc002, 0xc1127ff3,
-       0x673ae99e, 0xe00e3a45, 0xddfe8ffe, 0xaf66369b, 0x6cf762dd, 0x9527fe05,
-       0x9a1f2869, 0x48ad5137, 0x14a07385, 0x4fe271ef, 0xe29a5dba, 0xc28dbaa5,
-       0xe0b4e293, 0x78f110be, 0x979eb754, 0x517bf840, 0x024240f2, 0x5d05bc81,
-       0x422d0a9f, 0x7ff945c8, 0x0219cd8c, 0x92a5233f, 0x60829bce, 0x5fd63627,
-       0x3e11d49b, 0x907986c7, 0x200b2f94, 0xde609df9, 0x415a2403, 0xd59ebaff,
-       0x64aaf3f5, 0xd566fa82, 0x96a05283, 0x6a4eb3f6, 0x24fc43b7, 0xc116a3db,
-       0xa48a7356, 0x41baf9e2, 0x1d1e4c95, 0x87278f39, 0xec2a15ed, 0xde25ffa3,
-       0xef8e2f16, 0x8b757ce6, 0xe03efbdd, 0xf77f773b, 0x346b301e, 0x7b4f1b3b,
-       0x79f686d9, 0x3b706f58, 0xbbaf84ac, 0xfb653e13, 0x397424c6, 0x71e863e6,
-       0xa0deb37a, 0x08a6f072, 0x44a9f572, 0x87943cf0, 0x4f40affe, 0x1fd288c9,
-       0x682c9d7c, 0xb68bd9ae, 0x2f6a389b, 0x57a4e3f0, 0x8c73ecf0, 0xc077191e,
-       0x7ef00b5b, 0xe661fd57, 0x2a21d187, 0xa33e9c8f, 0xec173854, 0xfda1d70e,
-       0x937d265f, 0x3fa63e56, 0xcf9cb5da, 0xe5d5f8cc, 0x79ef2cda, 0x56bdb42b,
-       0x488035ec, 0x84438f30, 0x0e6a1c08, 0x2203a3e8, 0x855df7d8, 0x5c285f94,
-       0x28ee411b, 0x0d9f26bf, 0xb37c095c, 0x3b0ae5b6, 0x5e77c7c8, 0xebf4423f,
-       0x7fe3b8a8, 0x7681de88, 0x08983f96, 0xfbba5878, 0x423f5f2c, 0x5d30e748,
-       0xc7447ca9, 0x37be7443, 0x172eb9f3, 0x394070b5, 0x009b9d87, 0x104288fa,
-       0xeb256b09, 0xe8a760dc, 0xd86d75f6, 0x7cc64d9e, 0x366ee5ef, 0xdbacad5e,
-       0xe60d9ae5, 0xd455dcbb, 0x2efb7cff, 0xffa8e7d5, 0x5d2f9512, 0x7fa3752d,
-       0x214e7d56, 0x81efd481, 0x7a3a16af, 0x455f01ba, 0xf8b17ef6, 0xd472081a,
-       0xf9cbffef, 0xcf9e6cdc, 0x3e646a3d, 0xc5f78893, 0x0a17aa76, 0x64cfacee,
-       0xcade417c, 0x7e0be688, 0xf927b1de, 0x1be54f1e, 0x7918c7dc, 0x84f1c936,
-       0x96c72a16, 0xe4d63958, 0x4827bc32, 0xbea0756b, 0x59f5cb33, 0x076aaf3e,
-       0xa24dfbc3, 0x9f3067f7, 0x60f74b6a, 0x955cbbe0, 0xc0a74ea4, 0xe88b36e6,
-       0x54b69007, 0xbb123ac3, 0xdc59fbbe, 0x7a07af8a, 0xa668529c, 0xb3e74d7c,
-       0x0bbdeec9, 0xcdd6a5e4, 0x58384afc, 0xa3707604, 0x3c377bcd, 0x12d85077,
-       0x88c75ce0, 0x838b3650, 0xd4720c84, 0x4c38dc93, 0x490c1172, 0xe9f93eb8,
-       0xd08174fa, 0xf6c53c33, 0xd52f0664, 0x0c7f6016, 0xb06c202c, 0xf9f304a5,
-       0xf3b2e606, 0xd8f303f8, 0xd84f59fd, 0x91b9bad9, 0xd97a07af, 0x075b2b68,
-       0xe2259378, 0x777de6b7, 0x885401b8, 0x7bb26e0b, 0x6cfe831e, 0x479c1ea5,
-       0x02689b96, 0x292ca3e5, 0x53fec028, 0x605562ca, 0xd6c240f1, 0x7f692813,
-       0x42d5d359, 0x20b28f58, 0x07de0097, 0x9c8e263b, 0xefe5dab4, 0x8e6ac717,
-       0xb95ba3b1, 0xe853ec1c, 0xb3a7537c, 0x3c70e43c, 0xf80f8286, 0x80dd74ed,
-       0x9cfced93, 0x93f835e5, 0x7ecd9e19, 0xe60c1015, 0xddfaf125, 0x29ec910a,
-       0x2df8f7e8, 0x86c59df0, 0x68838f7e, 0x078bd041, 0xce5ceced, 0x035b416a,
-       0xdd48dff5, 0x40b7b836, 0x2607ebe7, 0xf449ab5f, 0xa729c495, 0xa517c173,
-       0xf026fe7c, 0xd3e4e75b, 0x0ce157c3, 0x7e3307ba, 0xbc8688f3, 0xcd6e9d47,
-       0x766e81b2, 0xeb447388, 0x7e829761, 0xa090a77b, 0xb9d39f81, 0x0a706050,
-       0x2a179e36, 0x5c2fe319, 0xfdfae9cf, 0xe9bcd82b, 0x8ff1f307, 0x6c567bc6,
-       0xd1e00d9a, 0x1b9f0fe1, 0x31eb9d32, 0xc8c9fb9f, 0x3263c709, 0x4cab4f31,
-       0xc852bb81, 0xda0716e9, 0x4c89d555, 0xd0fccdae, 0x79c2941f, 0x7c50cbce,
-       0xedf4097d, 0x8324d72f, 0xcb7fed1e, 0xafa044e1, 0x825d0f19, 0xd83ef47f,
-       0x1c9bfab7, 0x2f5b7f77, 0x94063233, 0x91999d83, 0xfea58199, 0xc529debc,
-       0x26a5ef8d, 0x6bb8cf7c, 0x46dbe580, 0x026a6bf1, 0xf7a4efed, 0x283c778d,
-       0xf718ddee, 0xf8604fae, 0x3c7457ae, 0x672049aa, 0xc496ba91, 0xb32779ce,
-       0x8cdc1c7b, 0xb67d6b9e, 0x7e8a4972, 0x467683cf, 0xf2b9e23f, 0x6b025046,
-       0xf909b265, 0xf465c59a, 0xe8aa5c7c, 0x1992fd18, 0x8df5bf5c, 0xff7d872e,
-       0x9c6484dc, 0xd3b5d9ef, 0x7274bc70, 0xc5387d97, 0x8b32fceb, 0x939af106,
-       0x089eff73, 0x66e6ff47, 0x3c1015b5, 0x1ab35a62, 0x16ffaefc, 0x9409b9bd,
-       0x54f5694e, 0x3e32a511, 0x74a3b900, 0x13f712b9, 0xe6e258e7, 0x604d8ddf,
-       0x76a7f57e, 0x919b8e37, 0x22bcb831, 0x103eba3f, 0x23f3a4e9, 0x8accc395,
-       0x61739131, 0x24a63f94, 0x2ea791c4, 0x7ec33499, 0xd30fae80, 0x7d75fe38,
-       0x1a43cbac, 0xefec19c8, 0xa8fd5195, 0x7f2873d3, 0x90e31d35, 0xfcb427f8,
-       0xf3b04bf9, 0xa114a713, 0xbff2a3be, 0x0465e506, 0xd076dfd3, 0xc7f151a7,
-       0x0777d6ae, 0x87debec1, 0x05c679ff, 0x90ff3bfb, 0x3fa05dba, 0x4df2fd8f,
-       0x7c11e417, 0x87164bf8, 0x1fe4d5b8, 0x9e981379, 0xcd94260f, 0xe6dd7982,
-       0x378167fb, 0x0ac92f8a, 0x90b15fb6, 0xf3c6bb2e, 0xbcf3c683, 0xf3e6824b,
-       0x77ec7ebb, 0x8e3f1489, 0xc3a708fe, 0x4af5c6c2, 0x7be30a96, 0x8f3d0217,
-       0x58efff71, 0x4367bb13, 0xe36e6787, 0xa27c0568, 0xf958b47f, 0xcc9b76be,
-       0x74cf05d6, 0x72f2a7d8, 0xdce199bc, 0xfd81cbb7, 0x44447bcd, 0x1d0e64bf,
-       0xafd5056b, 0x679616de, 0xbcc79e6b, 0x3812d50f, 0x5eef3f2f, 0x785dfd01,
-       0x9d7497ff, 0x07b8aef2, 0xf3ccb3f7, 0x603fdf34, 0xfba4b73e, 0xfd380b49,
-       0xe517882b, 0xa20f262f, 0x9b3bed85, 0xf7a77ae3, 0xfe6038e7, 0x3f7025f7,
-       0x838c80a3, 0xfbad877c, 0x2f9d2687, 0x9f83aacf, 0xf3c13ed7, 0x08f98f33,
-       0x5412b396, 0xe5ba2e76, 0xabe012f5, 0xf05bcda5, 0xab6f96be, 0x1cb4966f,
-       0x8931fc4f, 0x1f6a1de8, 0x21fe07ae, 0x3760c15e, 0x467f5d2e, 0xc32c7e61,
-       0xf9fccdc3, 0xdc5f30cd, 0x72f76527, 0x3e58bcdc, 0xcb9f7d1b, 0x7cc609d3,
-       0xf9f08eeb, 0x258f3673, 0x9f481f7c, 0x679f999f, 0x5e78b025, 0xd5f2c6c5,
-       0x6b94e803, 0xe60e8f5b, 0xdf300ae7, 0x3317e75a, 0x65202c3f, 0x14429925,
-       0x8d7e5bdd, 0xa9f4ea70, 0xe7c39ba8, 0xfbe0cfe3, 0xe710196f, 0xcc0f8de9,
-       0xdb94eef4, 0x9a7c8307, 0xc3d9dde9, 0x09adf0f9, 0x50afdd6c, 0xffa0253d,
-       0xd5b291e6, 0xe3bb28ee, 0xefb75498, 0x1b372017, 0xad46df19, 0x7b38cca7,
-       0x79f5c645, 0x0fed4b99, 0x1d210cf7, 0xbdfec026, 0xe9ef0fd5, 0x79f11ce3,
-       0xe01261b4, 0x13cb14b9, 0xd86d32be, 0xfcfb48b0, 0x4224cf47, 0x046bb53c,
-       0xa74b78c1, 0xc7ef08cb, 0xf3c22209, 0x62c3a731, 0xef5feda9, 0xd8d9ce83,
-       0x47097986, 0x9af1e6be, 0xf1a5adaf, 0xbe4ff9e6, 0x9f7e11fe, 0x6e5cadca,
-       0x36e1ff74, 0x5b5bb74e, 0xdcf3bed8, 0x0f48e575, 0x0720fdf3, 0x16497704,
-       0x1c1bcaed, 0xcdfd00ad, 0x5da799f4, 0x6bf41c71, 0xfdc89d0c, 0x98bd2f9c,
-       0x2f51534f, 0x4cc27c62, 0x9b870abf, 0x35abcde5, 0xea2d6fe8, 0xe55dcf41,
-       0xafae7a60, 0x63cf31f3, 0x7a80934e, 0x82ff0ccf, 0x0f572b8d, 0x367f3020,
-       0x8479d8bf, 0xe19ea206, 0x55e7d4f3, 0x473c3441, 0xd38fb31a, 0xce89397e,
-       0x72d85cab, 0x2ec1e63b, 0x2c27f3a5, 0x1bf183de, 0x5e1d7e1d, 0xc44a3cf3,
-       0xf106d90e, 0x068215d6, 0xdef636fa, 0x5ee18f16, 0xbb0d39a8, 0x8efd0207,
-       0x21abed48, 0x2fc47bfe, 0xf5d6ffa0, 0xb445c101, 0xfb808d6b, 0xafd23d5e,
-       0xf4ede585, 0x051ac74c, 0x58aa39ee, 0xe3a5c427, 0x6d42fa82, 0x59de9458,
-       0x1b52b818, 0x88378066, 0x1a8b1c79, 0xa7cf0dca, 0xb8fa8c38, 0x35237937,
-       0x74d2f3f1, 0x4de5d2f9, 0x870abf97, 0x52ffe2ca, 0x36565f60, 0xd107e9e8,
-       0xf67aa0cf, 0xc38b076a, 0x7d23703c, 0x67a3e965, 0x79fc710c, 0xe67d19e3,
-       0x79f1d389, 0xc503eb4f, 0xcedf4183, 0xedf51872, 0x3e8f9df7, 0xf42e5d0f,
-       0xc2e599f9, 0xfe3d7f8c, 0x1983a665, 0xd81700ff, 0x1d5a07fb, 0x9004bb81,
-       0xbfa70677, 0x76708ed5, 0x70691466, 0x7c00e59e, 0xd2dcf540, 0xfd631fcc,
-       0xb96cb126, 0xee34fd03, 0xf3f16907, 0x0ff6c26d, 0xfec463b7, 0x1e301196,
-       0xc8341311, 0x2cb3170b, 0xbce95b35, 0x1cb421c4, 0x9ac1e905, 0xeb9fe708,
-       0xe1132f8a, 0x7e5a86de, 0xc2d6ba3e, 0xfde96dce, 0x75b071ad, 0x39772f49,
-       0x683b56ca, 0x6b5f27ff, 0x78b0702b, 0x3819fa2f, 0x93ee114f, 0xd8317ea4,
-       0xcc132fb3, 0x234bcd4f, 0x0ebe817b, 0xf20f19e2, 0x85238cfd, 0xfb655f9f,
-       0x0b2ff46c, 0x796acd4a, 0xf908d55e, 0xa6077dfd, 0x5a703dc1, 0x6ccee592,
-       0xf1c27f5a, 0x5967ab3a, 0xa9bb64ce, 0x8378edff, 0xce5a47d5, 0xa7f5a50c,
-       0x3ab26f1c, 0x0551086c, 0xade3b4f3, 0x3051fe69, 0x3fdf9b8e, 0xf20919e0,
-       0x5f985920, 0x3051ed2b, 0xa3efacfe, 0x2c06a2af, 0x00cfaff8, 0xba9f82ff,
-       0x0e4fe8b2, 0x7915ef88, 0xbf1fd854, 0xfdb6821f, 0xe3a97bbe, 0xf0587455,
-       0x01280a5e, 0x3e385bff, 0x2690ba75, 0x23c848cf, 0x48cf4124, 0xe5d877d8,
-       0xdd0136f0, 0x5db40ff3, 0xf4d47206, 0xf00bdfc6, 0xac21ccfe, 0x28ca7c9f,
-       0xc9e6df70, 0x8fad0617, 0xe5dbbfde, 0xf401dc28, 0x3b4064a1, 0xe4dd5041,
-       0xd4176a66, 0xc95e3f52, 0x68c47f01, 0x7e713787, 0x6ca12d7b, 0xc0d9f237,
-       0x8e1fd310, 0x8fd0bdb2, 0x2da4572e, 0xa77c4fa5, 0x4110aee4, 0x3564a63f,
-       0x720b9c1f, 0x9cecdff8, 0x60f1e0ac, 0xf0e6dbfe, 0x3f6c20fd, 0xe9fb01dd,
-       0x9235afa0, 0x71e74fe1, 0x238f1605, 0xfe510569, 0xfd079f05, 0x37dc2a7e,
-       0xf6c1ce32, 0x44bce95b, 0x13461f58, 0x887ccb15, 0x6a00e413, 0x49df58bd,
-       0x417f0782, 0xcec87ffb, 0x035b74fc, 0x2c5dc431, 0x5f7eb64e, 0x7dd992e8,
-       0x5af0722d, 0xa709e3d0, 0x78f41b88, 0x848ae3d7, 0xfb9218f9, 0xb09fb847,
-       0xde0042cf, 0x1b80e4a7, 0x17ddd9e2, 0x1206ea49, 0xd38bafe9, 0x21f7ef5b,
-       0xe208bd45, 0xcc5ca31d, 0x90aa78be, 0xf768fe60, 0xfb002571, 0xb659294c,
-       0xfabf689a, 0xef7b072b, 0xcfa2a4d6, 0xd6c11e81, 0x8fe30204, 0x440d45db,
-       0x353f874a, 0x1f81d9e6, 0x288e0336, 0xeeac521e, 0x94bfa03b, 0x6cde1433,
-       0xfc41ee7c, 0x24e8ea4a, 0x5789df8a, 0xbfb85539, 0xf07b29e1, 0x7b9fcc2a,
-       0x24f782d6, 0x72b4566d, 0xad3e6fa8, 0xf35e21ba, 0x01307654, 0x05acf3e7,
-       0xa139b3e7, 0x1465e2fb, 0x608d5fee, 0x20e4bf7e, 0xe4052d92, 0x83bd48a8,
-       0x32704f3e, 0xc2cab87d, 0x938a68e4, 0x0243cfc9, 0xde0f3f1d, 0xd1f9442b,
-       0xbaba1bf3, 0x7e8879d9, 0xc089b7d7, 0xbae509c7, 0xc1121e3f, 0x465c9e8f,
-       0xec9cfd70, 0x3a2a0394, 0x1ce71e9f, 0x08cbff4a, 0xfb2e1f5b, 0x5fc63160,
-       0x82de0529, 0xebd80bdf, 0xf052f7e4, 0x39cb987d, 0xed214c9f, 0x53e7ac22,
-       0x442d11ce, 0x9cfcbbc7, 0x9f3d7714, 0x527dfbc6, 0x7d125220, 0x2aacf0af,
-       0x1215df01, 0xad3b7ae3, 0xc438e4be, 0xa66d8b7b, 0x235eb0e7, 0xf4091e3c,
-       0xb1b734d7, 0xaf93a47d, 0xe0c9834f, 0x3d1abce8, 0x1c4d3e6e, 0x0bda28f5,
-       0x78068aa5, 0xbcf4e2d9, 0x7e44fb0b, 0x2f9e26ea, 0x8fa4f33e, 0x388d3fe5,
-       0x72f18097, 0xe04e9fca, 0xebeb8b8b, 0xef3a76fc, 0xfeb1878b, 0xaf410f81,
-       0x5a78f85c, 0xf7f9e82a, 0x4bd1beb9, 0xbf80ef9d, 0xbf8c49dc, 0xe44697dc,
-       0xc49214b3, 0x0de446c6, 0xd9fa0ef8, 0x8a6e0729, 0xa92f7e7b, 0x0fd9d4a8,
-       0x4ed041e6, 0x36d32fbe, 0x1f4ce41b, 0xe32701e7, 0x7ab9736b, 0x10ddb2e5,
-       0xce7ff707, 0x03a98bd6, 0x5a1e61ce, 0x62488fd8, 0xd6ad567c, 0xf203375d,
-       0xc6329c62, 0xf9f9d3bb, 0xc97e68ab, 0x9d17e28c, 0xcc9d3aef, 0xa7f9d68f,
-       0x989bc778, 0x39fc5fdf, 0x126cee21, 0xfe7507b6, 0xf8cfccb9, 0x6cfdb2f0,
-       0x7f8de89d, 0xa9eedd3c, 0xf8631ea0, 0x9be33f66, 0xf81fca22, 0xf03d10fb,
-       0x966f998f, 0x5f37caf5, 0x967e0227, 0x779f16b7, 0x67d9a59f, 0x973393cc,
-       0xf3f11c13, 0x624d9f28, 0xa943b1fc, 0xe82e51fb, 0x1a2dab8b, 0x15ca03e8,
-       0x3e52d759, 0xdfa091df, 0x03935a7b, 0xd3122df5, 0xac5a5b3f, 0x38b67fa8,
-       0x678c5ebd, 0x68f3b065, 0x43b6f244, 0xc036b41e, 0xf3df46a6, 0x8d93a57c,
-       0x13439413, 0xf41d828e, 0xf1ff4617, 0x8dc1e757, 0x82b32430, 0x31cc61d1,
-       0x0d98bd65, 0x8f853be9, 0x00bd7f00, 0x577e833a, 0x73c1587d, 0x2b0f4bfe,
-       0xd85f17a8, 0xc4097af5, 0xcb7cf48d, 0x2f5f3b71, 0xef051a29, 0x9c7b3e33,
-       0x8ebd63eb, 0x27a0e7a9, 0x4ea6f74d, 0x997f4c20, 0x032d3def, 0xb48dc9fe,
-       0x9d03ef9b, 0xd61e4545, 0xb5db6b9d, 0xcc16a069, 0x0ace81f7, 0xfff6855d,
-       0x699e83cc, 0x7dce352e, 0x6e1f9ca0, 0xc1db6d20, 0x4fdf3525, 0x6de7d749,
-       0xaf93ff30, 0x2f881484, 0x919a9506, 0x9aeebeec, 0xba3fd01c, 0xc51fe1dc,
-       0x11c3f05b, 0xbf68fb86, 0x5fbef3e4, 0x08bdd893, 0xbfee0aed, 0xefb09afc,
-       0x7add7c82, 0xdde2c9d3, 0xbb9fcb79, 0x7e61f409, 0xb9f707a5, 0x9f98934a,
-       0xb2121bfc, 0x34bd00e5, 0x41c8e309, 0x2a3e2d59, 0x5223de44, 0x0f3808d9,
-       0x425fb3b5, 0xb9af8c3e, 0xc138efbc, 0xf7ba90ae, 0x26e377c3, 0xde83e5e6,
-       0x955e8e76, 0x0e98eb0a, 0x74ab8537, 0x87023393, 0xbe5ed70e, 0x39ae68ce,
-       0xe1fcc0ef, 0xcd43d03b, 0xe0d88e87, 0x820f9d7b, 0xfd18a7ad, 0xe801f8a3,
-       0xe107e11f, 0x78eba836, 0x87e707f8, 0xfc6dff2f, 0xf159fd40, 0xfe00fc3c,
-       0xe2f7e260, 0xe689ff87, 0xfdaf6a07, 0xaf6519d3, 0xa7961505, 0x3e75d7a5,
-       0xc428e458, 0x608534f7, 0x65d905be, 0xe2dfbf67, 0xf038c64d, 0x46366ef3,
-       0x064787d7, 0x76e22f83, 0xe37930a5, 0x0e8f5df7, 0x8e576809, 0x66e10aa6,
-       0xa206e3b4, 0xbe38d43e, 0x804111c8, 0x1730ac7b, 0xcbec0b37, 0xc5c82a50,
-       0x10f4eb68, 0xc756fff0, 0x1f605965, 0xe72639e6, 0x1f6d7f00, 0x5815fcb1,
-       0xa80fb6b2, 0x1aa37e7c, 0xbd749fb1, 0xab7797b7, 0xc5c43f8f, 0x0f72e1f8,
-       0x7a014f3b, 0x5d0e1a3b, 0x005903ff, 0xcb34210e, 0xf5038df2, 0xe83b4b75,
-       0xe2838073, 0x9a40b775, 0xb4283ec0, 0xc18ad278, 0x9217ebce, 0xd6aece00,
-       0xbc43072f, 0x9fcb7a68, 0xd3bc020f, 0xcd267df5, 0xb664cfb8, 0x477b75a3,
-       0x7b742bf7, 0xd088a248, 0xb76826ed, 0xb86ee7f0, 0xafd61b1f, 0x71cf0d90,
-       0xbd5a743e, 0x57e5c3c8, 0xce98f3a2, 0x690d71e7, 0xd7c8b843, 0x99337cdf,
-       0xc70667d2, 0x24fdf4c7, 0xed0b9094, 0xf14d5c84, 0xfc44b570, 0xab9c7449,
-       0x1c7c8135, 0x8cd727c5, 0xefe1d637, 0x3f48f4b2, 0x5e6fbdbd, 0xe299261f,
-       0xdcb7dff1, 0xabe763ef, 0xe763eaff, 0x150e2767, 0xa82c12fd, 0xb9d933e3,
-       0xc3c33759, 0x7afe257e, 0xc98b88f5, 0x7b4b44f1, 0xdc1b9c2e, 0x5c2bf3bd,
-       0xfcecf71f, 0x13b01dea, 0x08971c27, 0x3c4e01e4, 0xf709263e, 0xe067c73d,
-       0x6fde9d3e, 0x0e4da7f5, 0xff239ec2, 0xef82f7e8, 0x1478f0a3, 0xe586cf80,
-       0x3d0f1d8b, 0x3d9dfd0c, 0x3ce8912c, 0x3bc512f3, 0x2569e20c, 0x7df87efc,
-       0xf497b302, 0x5efc7df6, 0x5972ffe6, 0x9b6b7ef8, 0x625efdc4, 0xd5f3a28d,
-       0xe524f354, 0xf57ae845, 0x52e3d2b1, 0xe07d2c6e, 0x0f9d63ef, 0xdc6793cf,
-       0x579fa95b, 0x23f8e3ae, 0xf3c3df7b, 0xdd345700, 0x7e7d8121, 0x3c488645,
-       0xa95ee351, 0x2a3e0f52, 0x8b8f71ee, 0x76eae5e7, 0x1fa7deca, 0xf706919e,
-       0x7a988859, 0xe5b2dd55, 0xb7a85c95, 0x71cf7189, 0x457bf19b, 0xf0121dcb,
-       0x262e17ff, 0x3f8dbd1f, 0x27ca62f1, 0x09dd0297, 0x040af3b3, 0x7d332394,
-       0x7dfcecf7, 0x9ea8fb6a, 0xfd13ddf1, 0xb17874cd, 0x2ff708a3, 0x9987a37a,
-       0x79d1776f, 0x42fce9fa, 0x6a7e9e74, 0xb9f1ed8f, 0x2f92feb1, 0xbf3aeb03,
-       0x913eb756, 0xce9cf60a, 0x1952d3a7, 0xf1d84cdf, 0x46712a70, 0xdbc665e8,
-       0x66fd395f, 0x0ce66d11, 0x826dcffa, 0xe17d42e6, 0xcf906d27, 0x9c61c652,
-       0xda0956f5, 0xcfe7841f, 0x59b1d79b, 0xd7bc28e2, 0xd97bd7ba, 0xa0ca1587,
-       0x15ebcd6e, 0x7c0e17dc, 0x4aa75e6d, 0x7049d40f, 0xb48958ad, 0x6e31e99c,
-       0x9970eba7, 0x2936fce9, 0x04f479c3, 0xcc0f99a7, 0xb9f6eaf0, 0xc5394f7e,
-       0xda14b4c7, 0x216ab5df, 0x1d662fce, 0x69e978e6, 0x5e69edfd, 0x7ffc4d47,
-       0xd7d4d8e6, 0xc93dbd00, 0xe66e999b, 0x947f5d76, 0x587900c0, 0xf91ec1fa,
-       0xf48e95c2, 0x10a7392d, 0x0f1bec0f, 0xa24f93b4, 0x7d3221d6, 0x9ddbf208,
-       0x27acf66e, 0xce7a5b7e, 0x11a9bc42, 0x1f9b93be, 0xeddf0074, 0xb01cea90,
-       0x59c533af, 0xf1449b5e, 0xa2d3f535, 0x74bcf1eb, 0xc84085bb, 0xa9cb5a6c,
-       0xa84710bd, 0x9f30483e, 0x7765a8ba, 0x4be9f031, 0x51fa1b52, 0x7909675d,
-       0x6cceca30, 0x8075a96e, 0xc69cd61d, 0x4bed03ce, 0xcdbc8626, 0xbf191247,
-       0x3d3e1f36, 0xfda713c3, 0x8ebf6f00, 0x7172d278, 0xfc61765d, 0x058d64a3,
-       0xd0553fe7, 0xbb034e5e, 0x0f7646e5, 0xb8eb5763, 0xbc28d397, 0xa324b79d,
-       0x7cd6999e, 0x4a6e1dcf, 0xf33fe088, 0x1cf779f1, 0xdf40db41, 0xac35512b,
-       0xe3645497, 0x7fb8f8be, 0x1d375ea5, 0xd194afda, 0x2e2699bf, 0x751e2096,
-       0x03c84332, 0xd0a7717f, 0xa77e12be, 0xc6ce5fcd, 0x2a7f6e21, 0x4c6f9ff8,
-       0xbf8d1d4f, 0xf5eaa26d, 0x6bf7f00b, 0x5b4fc988, 0x6eccedbe, 0x3e5f6d2b,
-       0xc77cc053, 0xe22cee69, 0x929fe28f, 0xf99e9435, 0xfa5b2f94, 0x5f5f0117,
-       0x673c6a57, 0x41ccb335, 0x63f1d102, 0xc2c32dc1, 0xb5e78fb3, 0x7efc0b76,
-       0x57e72e59, 0x359f7e71, 0x5df0d53b, 0x66766139, 0xdd9136f5, 0x7ec85257,
-       0xaf975127, 0xbc39711f, 0x37c7fb8a, 0x700cb37a, 0x0d28874c, 0x693334fd,
-       0xd75dda28, 0xe5c76d9c, 0xe0fc5cb9, 0x78e89bad, 0xf2611a3f, 0xabc5c56b,
-       0xd8322f90, 0xc84cca7e, 0x6f41122e, 0x66bbdf1a, 0x471eb1bc, 0x27abcf8e,
-       0xb3307d74, 0x9bfdc455, 0xcf148599, 0xd3b18902, 0x18beadbf, 0x865ed167,
-       0xe7b5d078, 0x04bbf83c, 0x83e2fa31, 0x2fa4efd2, 0x3832a05e, 0xd2f5ca9e,
-       0x0fdfee44, 0x6f408322, 0x1f1b134c, 0xa2ea3e06, 0x0e35a6eb, 0x8eebe91f,
-       0x5097efee, 0x21be0639, 0x8f18691d, 0x032e769d, 0x7f7449f3, 0xa847ac3f,
-       0xb1c5a25d, 0xcc4bee97, 0x1307dc31, 0x76512bd6, 0xfdf05c89, 0xd46992ed,
-       0x00f2551e, 0x9fc481be, 0xe30cfa8f, 0x70902592, 0x8cc1f102, 0xa9e71853,
-       0x8affa896, 0x4c13f3eb, 0x097fd1cf, 0x30f91129, 0x9c7a2bdb, 0xdba49ad9,
-       0x093e4653, 0x97af1bc7, 0xf3a3ee31, 0x13e00949, 0x117affe4, 0xf1bd3ae3,
-       0x6f7e3e8d, 0xfaa212fc, 0x0f384928, 0xfbf970bf, 0xbcf2fcb6, 0xc8c327ce,
-       0x89f0beb0, 0xbf3a1fce, 0xa609d8c4, 0xeb4f5078, 0xe9894bcd, 0xd69edf88,
-       0xc847979b, 0xb37bd7a8, 0x3126766b, 0x744aee3d, 0x5d577f63, 0x7609d334,
-       0x11eb958d, 0xc70add7d, 0x9f19eab5, 0x573edcbc, 0x6aa3fd82, 0x11d91fd0,
-       0x60f1e83a, 0xae972f9d, 0x9cff1821, 0x6756f5ce, 0x56078b2b, 0x7003154f,
-       0xe5b8a284, 0x9d5987c1, 0xd3a2cbdd, 0x27ce6af7, 0x096ed285, 0x1af3777e,
-       0xbe20d04d, 0xc4f1e1e4, 0x8094e719, 0xafab1d9a, 0xc75fba74, 0x0bbf07bf,
-       0x23c6bfde, 0x1c4ba804, 0x3baecfa3, 0x188aecc7, 0xcfbc2a7b, 0x891e62ab,
-       0xeb4e5f99, 0x86421f74, 0x0aed3bfc, 0x76fce921, 0x6f7dfe85, 0x1e064e74,
-       0x65ee7a06, 0x1d80aef7, 0xe2be740f, 0x3afd849c, 0xccf18c93, 0xbf791db3,
-       0xbf93df41, 0xcdafbe6f, 0xc6de9f3c, 0x17f746ff, 0x8fa0ffb8, 0xcec4957b,
-       0x27d79bc7, 0xd75e9c7d, 0x99bdfe23, 0xe293c37e, 0x3eba7ddb, 0xd73fc18e,
-       0xafd13dd7, 0xebad7d37, 0xbeb77fc5, 0xd7d7fbd6, 0xb35c7d13, 0x8fc9ef1e,
-       0xeaf2f5d4, 0xdf8c16f5, 0xfafee14c, 0x9e2f1e14, 0x6ce2c499, 0xeedeb8b3,
-       0x0166dcfa, 0xb3282ebb, 0x6eff30fd, 0x36a1c627, 0xd0f662ef, 0x724e3c9b,
-       0x9c6220b7, 0x16b1eee4, 0x17d4dbd4, 0x4b7987ca, 0x808c8445, 0x2c01dcfd,
-       0x8528df4e, 0x6bef50ca, 0x6f738112, 0xefdfeaaf, 0xfd04dff1, 0x70f1fddf,
-       0xa3c62d4b, 0xc7e06d43, 0x7093cb8f, 0xaad92c5f, 0xb3bafc62, 0x03f78ad5,
-       0xd9f8ed75, 0xf9fa196e, 0x5ae0689c, 0x0d6ad4be, 0x1e814bef, 0x101e2699,
-       0xaba33f21, 0x59fde09b, 0x8a876793, 0x429b3fc1, 0x0e216ada, 0xf9615130,
-       0x3d3c66e8, 0xcc31f7ca, 0x7de114fb, 0x9f665689, 0x7644bb15, 0xfb4f580f,
-       0xe60acd12, 0x2fb6f757, 0xa0967851, 0x2fb3169d, 0xd2f4ccd1, 0x9897ddb7,
-       0xdf87b808, 0x9ff9d367, 0xc3d227eb, 0x8566c4fe, 0xbf7567ed, 0xbfb0132e,
-       0xb8b4b1c9, 0xf6dea371, 0x4aec7629, 0x1d3dc0f0, 0x4deff99b, 0xc035d8ec,
-       0xfcf6e6a3, 0x777b6e7e, 0xcda4a811, 0x984ad78d, 0xb9e3c6f7, 0x19a0b8e1,
-       0x66ff1caf, 0xc8156e7c, 0x07c4072a, 0xe0a9b45b, 0xbfb8f517, 0x71c1edd3,
-       0x5d478afa, 0x491f364e, 0x6f9f00f0, 0x03c0323e, 0xfc003fe3, 0xab59710a,
-       0x93f015fb, 0x9d3e1c77, 0x8abcfb80, 0xa4bf0547, 0xb1a6d93b, 0xef8c8973,
-       0x03c39983, 0x9abd0fb0, 0x84e6f9f3, 0x4c8ebfee, 0x61afde8b, 0x39fa33fb,
-       0x60855aff, 0xc2df883e, 0x78cc41f2, 0xeb66e41b, 0xebc4e6b5, 0xa69c89c3,
-       0x35f2f18a, 0x7f9662b5, 0x807e7e60, 0xf03977f3, 0x7147ed01, 0x8956b833,
-       0xaeff8465, 0xcef58128, 0xbfe5af5c, 0xc67b4387, 0x1cd565df, 0xed2a3396,
-       0x67d278e3, 0x40efc057, 0x3b96f96b, 0x2f70dc73, 0xf2ca5083, 0xb2f92c3c,
-       0xc493c846, 0xd6953a52, 0x0ecb922b, 0xb883f526, 0xe40d73b1, 0x479e4333,
-       0x2f445a5e, 0x0ad747dc, 0x2e245e5b, 0xbf12b0eb, 0x3d70ec1d, 0x79e79fcf,
-       0xfbebb52c, 0x3eecedd1, 0x86fe8aea, 0x850e4e73, 0xbfbf477e, 0x9a3deade,
-       0xa14cf984, 0x7dd29544, 0x78698ef9, 0x76e2907f, 0x3e477ce3, 0xf803293f,
-       0xd9f5c281, 0xff5c31ff, 0xc82e0f1b, 0x3a71816f, 0x062c8eb6, 0x087231fd,
-       0xd08b599c, 0x7c41aa87, 0xbc120f6e, 0x01fff12f, 0x512809c2, 0x00008000,
-       0x00088b1f, 0x00000000, 0x5bb5ff00, 0xd554740d, 0x79bfff9d, 0xbe4cdef3,
-       0x21264cdf, 0x012f0842, 0x1c424242, 0x61f08062, 0xc4443e1d, 0x602a0320,
-       0x43e196eb, 0x9a1af909, 0x7ab76eba, 0x2904930e, 0xb693db02, 0xb654e56e,
-       0x28bb560e, 0x82609d89, 0x04ec2681, 0x6eb50314, 0x5b604040, 0x6a445477,
-       0xbb8d3243, 0xb29eec54, 0xf7bdffff, 0x60c33325, 0x392dd9e9, 0xddf73739,
-       0x7ffdeefb, 0xf75ffefc, 0x595c003e, 0xc9a00392, 0xe7b73aa6, 0x001aa802,
-       0x6dbcdc64, 0xa0556052, 0x324e4018, 0x63240a6d, 0xd4da669b, 0x668a6d86,
-       0x9aa9e362, 0x70805ace, 0x6c14b2ce, 0xf2ce70b4, 0xc6efbc29, 0xc34b9656,
-       0xfdec32c1, 0x45f38a5d, 0xe1d90a9c, 0xfec49e0f, 0x39148ffb, 0x42ff63b7,
-       0xa4096a62, 0xe7f2ac01, 0x3fb08535, 0x1b1fe2d5, 0x69ceba44, 0x1a6d2c9e,
-       0xfe2dd7c0, 0x7be32089, 0x68529bc9, 0xf005c97d, 0xbab63b1d, 0x22948f06,
-       0xd5d02e7d, 0x60a300f1, 0x08a976b7, 0xeb82a900, 0x05f6f1e9, 0x58074c2b,
-       0x8eff1339, 0xf19217d8, 0x53d22679, 0x741b9fce, 0xb405fee0, 0x30cf41bf,
-       0x5dad901d, 0xeff6024a, 0x96eff63a, 0x8fb81851, 0xdf9313f7, 0xbf8b6122,
-       0xa2fd7fd4, 0xbfc3efc9, 0xdb9f6807, 0x792bb669, 0xc43674cd, 0xebf999f6,
-       0xeb119946, 0x3e7c1fc3, 0x65092f8d, 0x9015d59d, 0xf33efd8a, 0xd8ab2147,
-       0xf4677f07, 0xe327e67a, 0x45ce337b, 0x8175c73f, 0xd62d9fe8, 0x0cbf072d,
-       0xa1998f28, 0x61b379e8, 0x5c641fe7, 0xe8e5f677, 0x14b40be7, 0x3467e307,
-       0xf8cebe8c, 0xbd70aa43, 0x6f5f2b7a, 0x34bc9de8, 0xcd9bfd40, 0xbb945328,
-       0x8e50cbaa, 0x77fa75ed, 0x66fb4017, 0x700f979c, 0xb595b360, 0xeb6b4e53,
-       0xcdcefe88, 0xe0152008, 0xd62ce6d0, 0x98c69aaa, 0x561a729c, 0x3ec44943,
-       0x90c7df1a, 0x2e39d0e3, 0x82a1a9c7, 0x5f60e6e7, 0xafc055e9, 0x4b39f08f,
-       0xb80869c8, 0x9534879c, 0xf1fa79c9, 0xc411dd9f, 0x132c9647, 0x25fc11e8,
-       0x17a089e8, 0x0a93f48c, 0xd97d51ec, 0xd5cf8fd0, 0xdfeb8597, 0x714fd621,
-       0x075a8e8e, 0xa113f8fc, 0x85f643bf, 0x71f212bd, 0x05657247, 0x9e5693f1,
-       0xd96eb517, 0x427ab13b, 0xd3cbe1c1, 0x209fc890, 0xc69fa69e, 0x33f988f1,
-       0x00923e1c, 0xfa26ff94, 0x4cb34039, 0x62eb3476, 0x6f27f3f4, 0xc99bb7a6,
-       0x9b9e4a13, 0xe5ebf8e3, 0xcb457369, 0xb4517d33, 0xd1dc333c, 0x2ab51cf2,
-       0x79b76e5a, 0xa632e5a2, 0xf8d47272, 0x51a54dd8, 0x99df71fd, 0xd73f3515,
-       0x3faa2f37, 0xa8e2db7e, 0x979b13f9, 0xed27f547, 0xfcd47afa, 0xa8daff42,
-       0x55bda2f1, 0x29ffa4b7, 0x79a8fa81, 0x57d35e24, 0xcef6ffe8, 0xf3ed46ef,
-       0x2fffd6b7, 0x9c7ff463, 0xd234d97c, 0xf447fa17, 0xf24a838b, 0xd99f0936,
-       0x93f25690, 0xafb7aeb6, 0xbe976849, 0xe88fba79, 0x67062df0, 0x2b3d8e13,
-       0x6bf225bb, 0x26d45063, 0x4c5b1bf4, 0xfefe4950, 0x6ad326fb, 0x9d88f277,
-       0xb624d71f, 0x982af3fe, 0xf3d1ec13, 0xcc8f1796, 0x14d3da33, 0xf88da61f,
-       0xf45bafd9, 0x3df210a6, 0x147ee655, 0xf269ebfd, 0xa7a417af, 0x8a997214,
-       0x8a78a7c3, 0xed59bc59, 0x0e06d6c6, 0xb4db1ea9, 0x5faebf11, 0x505ce547,
-       0x98ff2ffd, 0x3b213fe8, 0xdffa465f, 0x86dc8125, 0x89bb56bf, 0xc361f3ec,
-       0x9a7ae96f, 0x21ae822d, 0x048fa5e4, 0xd0d3d66c, 0xfad0c3e7, 0x9dafccf1,
-       0x4805a6ff, 0xce55e7ff, 0xb2ff318f, 0x099f6bf0, 0xfe4fd6bf, 0xbc647f2c,
-       0x528fcf72, 0x7ce75c74, 0x440a2c01, 0xe42c29c8, 0x58d06604, 0x75cd99bc,
-       0x876aa176, 0xbfae18f2, 0x44d87df2, 0x13fcacfb, 0xef7c8a6c, 0xdec29acf,
-       0xb326b3fb, 0x59360576, 0x1815e728, 0xaca56ccb, 0x5db0941f, 0xe40a0bda,
-       0xe4f32c01, 0xf794242a, 0x03a679c0, 0xa292b4b7, 0xc107bdf1, 0x3fff90ad,
-       0x14dacdfb, 0xcebc379a, 0x4fdd4fdb, 0x8a815d38, 0x7dff61b6, 0x44c94f9b,
-       0x53be107f, 0xf711f162, 0xf773d2b1, 0xa69e6323, 0x3c167338, 0xbea0ce57,
-       0xad938396, 0x600bac67, 0x1733f28f, 0xe3a60854, 0x160bbe3a, 0x4748cbff,
-       0x4561b23d, 0x8f77d4fd, 0xb0647e62, 0x3fad8fea, 0xc7ab79c6, 0x9c52c684,
-       0xa7f550be, 0xc3f3d27c, 0x20afd0bb, 0x3d124b6f, 0x118cb619, 0xff5f9c39,
-       0x638d0a79, 0x867a65bc, 0xcbe7167d, 0xd8fb7e4c, 0x71bcc67b, 0x6da3b9b6,
-       0x5c72e724, 0xf88de664, 0xb00a5a33, 0xa9549f94, 0x177e9ffe, 0x0a1384e9,
-       0xcbc0cf5b, 0xfa978146, 0x24547d5c, 0x8653ea5e, 0xf08a32f1, 0xccb2ff52,
-       0x3bbea6ec, 0x97280fc1, 0xde770233, 0xfb5ed77d, 0x9e1d4eae, 0xb88c7cef,
-       0x9f2711d1, 0x8c746e20, 0x6e229f7b, 0xd90dffa8, 0xfde8953d, 0xa9c7e778,
-       0xc1f75a1e, 0x507ba35b, 0x06fd9f0a, 0xc738f7c9, 0x9d0c10fb, 0xbdba7e65,
-       0x1d21f750, 0x3b5c0ff3, 0x5d5cf94b, 0x60b745bb, 0x742d8aff, 0x7f9a79ec,
-       0x5f9a0250, 0x4e604c17, 0xf25daeab, 0x5578e027, 0x31d6db67, 0x596aafd8,
-       0xc3614656, 0xbbc10a9b, 0xe4bf7c68, 0x4bf1c46f, 0x1725839b, 0x87bae027,
-       0x75a25dae, 0x75f10e07, 0xe60e6f2f, 0xb0300e53, 0xb407cd7f, 0x05bb4d5e,
-       0xb1bf2812, 0xb431d505, 0xa0149b5f, 0x3f032afd, 0xcafd6950, 0xa04d9697,
-       0x6f7aa6f4, 0x1109c4cf, 0xc0e06b7e, 0x39475549, 0x60ffb655, 0xc65798a1,
-       0xe19f97c3, 0xa37fe0d7, 0x1cdf27bf, 0x6ff13fe9, 0xf093d91f, 0xf216bfbf,
-       0xbe35d55f, 0x7e89c489, 0x8979e3a5, 0x84d595f9, 0x5b870ba7, 0xda4bfb7f,
-       0x4ebfe0ef, 0xd940dc24, 0xdc1bc9ad, 0xeb17163e, 0xf9703ec4, 0x429dd53d,
-       0x452e53f2, 0xff3e73fb, 0x435dcd90, 0x2a9861fb, 0xc48444d8, 0xd0db87e4,
-       0x93e4801e, 0x43ecc89b, 0x6bab0e4e, 0xd1ef9e90, 0xacc7a404, 0xd8b5d585,
-       0xf31766df, 0x97feacf2, 0xafa46f73, 0xf26666c3, 0x2781e6b1, 0xed186fd2,
-       0x3a471a7e, 0xa67de68e, 0x4ebc7086, 0x6e12acbf, 0x53bf82eb, 0xdbdfa475,
-       0x5742e1f9, 0x3602f79c, 0x9314afee, 0xd94f72bb, 0x4bd47d88, 0xf089218d,
-       0xce92707e, 0x2f9b58f2, 0x48ebe8c4, 0xf98f89d0, 0x3d377e07, 0xefdeb114,
-       0x26131f11, 0x7eebf48c, 0x428961f1, 0xc3fd7b72, 0xc8ca7312, 0xe4cc81f3,
-       0x3a5c7f4a, 0x3a78bc78, 0xf6997dd5, 0xd1603dad, 0x13be191b, 0x77c2419c,
-       0x3d139257, 0x6d5be135, 0xf7c48b2c, 0xbaee8cc3, 0x4889d92e, 0x65ceba87,
-       0x3f36069e, 0x906a49c5, 0x08fae73b, 0x66e6b267, 0xc1ff8478, 0xa54710fd,
-       0xa3fa37f4, 0xcfcf3695, 0xe4e67f49, 0xbc48c4e0, 0x394299d5, 0xcfe9128d,
-       0xc2373cd3, 0x9f64e4fe, 0x7920e8de, 0x7d653ba6, 0x898a7f44, 0x0f4065eb,
-       0x8e29daa5, 0x50f5c66d, 0xdfc1031e, 0xb7fc92a5, 0x92b3ae76, 0xa6c77fdd,
-       0x55593d31, 0xff61ae9f, 0xbe47d4db, 0x4aeea9b7, 0x996dabb2, 0x0d764089,
-       0xef8676d9, 0x01d784bf, 0xbd5457b2, 0xb8a01e02, 0x36f0203a, 0xff981630,
-       0x708fdca5, 0x37be5326, 0xa3c8cc9e, 0x676f3cd1, 0x08c5c94f, 0xae0e077e,
-       0x4a7d1274, 0x321f7f22, 0xf7635e39, 0xc3814ffd, 0x9b6b4da7, 0xe1c446e7,
-       0x15bf79d8, 0x00e43478, 0xab165f66, 0x8cf13107, 0xdb3adf87, 0x1fe433bc,
-       0x0bbbb69f, 0x899b0fc8, 0xaea3c230, 0xe703a5c6, 0xcde907ff, 0xc85c7f98,
-       0x1a3c5555, 0x214df5c9, 0x33754557, 0xeb61a339, 0xfcc3c764, 0xed71a9e5,
-       0xdfc10bec, 0xbd68dcb6, 0x2abbcec7, 0xbe4c53f8, 0xe744b5ac, 0xcdd99961,
-       0xfa661ea0, 0x060de637, 0x77fd71af, 0x8bbf7e7d, 0x05773cec, 0xaf67e7c3,
-       0x11ca9614, 0xcdb38eeb, 0xffe22ffb, 0x8a0f0313, 0x0ee88b2f, 0xdeb1f0c5,
-       0xf892fee6, 0xc83bf236, 0x4e12dc76, 0x4e07d440, 0x3eb0ef11, 0xabe33028,
-       0x24e89083, 0xf226deff, 0x19b83360, 0xa9c0924e, 0x05d77ab3, 0xfc8d9abf,
-       0x6098f535, 0x9b53763b, 0x8139ca24, 0x9ccd608d, 0x228c9b2a, 0x52c565c2,
-       0x0c8c88af, 0xf6ed53c7, 0xbd20b77b, 0xf327c107, 0xfeba39ba, 0x92e49705,
-       0x37deeb22, 0xbdd7e2ab, 0x644d3dbb, 0xeea97fd7, 0xad34199d, 0xfafed351,
-       0x1d8277fa, 0x1822e8f3, 0xdb27a3ce, 0xa0544675, 0x102fe380, 0x7b33f44c,
-       0xf09f54c4, 0x1a7e4fdb, 0x922bf9e5, 0xa553ce29, 0x0dab0281, 0x78eec4a0,
-       0xda365b66, 0x3fce04d7, 0xefe89bf5, 0x0c679e5e, 0x4e6fd3d7, 0xfa277966,
-       0x93d59921, 0x4625a09a, 0x1f98656f, 0xd88d3a41, 0xe0f1eaa3, 0xc9532fb1,
-       0xf5dab6ef, 0x84bd277f, 0xf940cb8f, 0xa439825b, 0xd5d8e2da, 0x3163ca01,
-       0xcedc790f, 0x9dac6bcf, 0xfb8fcb92, 0x5017755b, 0xb4d04f7c, 0x7d8472a9,
-       0x3625d815, 0x85d8f6af, 0xc7f3151c, 0x5277a62b, 0x9afd718b, 0x74a9fd8e,
-       0xfe7d53ac, 0xed4a74d4, 0x0a9ecd8b, 0x4cfbce3b, 0xa56f93da, 0xbf9b70bc,
-       0x0813e484, 0xbc51a5e6, 0x9f06629d, 0x7a46f4b9, 0x594abbbc, 0xcbb75591,
-       0x5d29dace, 0xbca06c77, 0xfce41bd4, 0x0e0a1ed2, 0xeb027615, 0xd936740f,
-       0xbfef3d69, 0xff268f75, 0x56032fb4, 0xf578ff91, 0x7dfcc98b, 0xfe699833,
-       0xe04dbb1a, 0xf3a26fdc, 0xdce27da7, 0x130be06a, 0x3fec679b, 0xacae73a5,
-       0x838a0e21, 0x0fc847cd, 0x58597424, 0x12f0951e, 0x61747970, 0x38e7477e,
-       0x8a01ef87, 0x70368343, 0x9ade384a, 0x4f796618, 0xbfa2dbb8, 0x9adc9128,
-       0x55bcec81, 0x214af5e5, 0xf27f7202, 0xbf6373c8, 0xe8e7ae84, 0xe170898c,
-       0x6097b8a2, 0x933b866e, 0xc29de523, 0x73b46ee8, 0x0626b53c, 0x9794c94d,
-       0x9178044f, 0x274235d1, 0x3a0d7db0, 0x6f7f990b, 0x9e97c355, 0x34ba3074,
-       0x702141c2, 0x926ba13a, 0x412dfe4e, 0x123e3173, 0x93e9dd34, 0x5bcba46e,
-       0xda178982, 0x611bf7cd, 0xaec98ed8, 0x7d2389bd, 0x6b42da2b, 0xf835c71e,
-       0x20b33e16, 0x0e4fa23b, 0xfde47ca6, 0x3ef7ece7, 0x9d9b25b3, 0x5464f917,
-       0x29b61275, 0x6753e276, 0x74d7a27c, 0x39729465, 0x494e5138, 0x3c3e3e56,
-       0x4c9e711f, 0xcf3e64fd, 0x1692d169, 0x017b32e7, 0x2f2317b2, 0x5e0a5c7b,
-       0xb5ed0bba, 0xb4ee07ff, 0xdfabe462, 0x1689e474, 0x35fbf79c, 0xf620fc81,
-       0x179ea94f, 0xfc6f9f09, 0x298eed66, 0x155b6fe4, 0x9df90567, 0x2c87ef90,
-       0xd1557dff, 0x1dd847b7, 0x09338764, 0x78fbb1bf, 0x90fe37cf, 0x83c1dbf2,
-       0xc9d56e92, 0x887386ef, 0x4faebaee, 0xdee7f255, 0x7cb21f83, 0xe7ba6e76,
-       0xafea3b35, 0x3e61b3bc, 0x342675c9, 0x2ebf9137, 0x20417912, 0xa193fb8b,
-       0x362ff9d3, 0xb4e1e844, 0x7b0837b0, 0xea7c51c6, 0x987af612, 0x3b6c4eea,
-       0x4f1e1e7a, 0xba8877eb, 0x01af78d8, 0xb9218c8e, 0xac9bc237, 0x7e378e1d,
-       0x59c222f3, 0x6aeb59d1, 0x77fcc457, 0x7abf3ced, 0xbdf3ced7, 0x379ee9f5,
-       0x3dd53e49, 0xc4a9a91f, 0x0e40c5e7, 0xac0193d5, 0x7e38b58f, 0x637ed864,
-       0x0e6bc9ec, 0x7bdf34ab, 0x415f9819, 0x43496f7d, 0xdb3bedfd, 0x3e0d7939,
-       0xa49d40ef, 0x9e709e51, 0x8a1d87d7, 0x6fcd0c7b, 0x84b57338, 0x2201d8fc,
-       0xdab9e902, 0xe48e3d5d, 0x979ff886, 0x06d67648, 0x7619afcc, 0x8a764c5a,
-       0xfe1317ef, 0xc85fa8cb, 0xdaab72fc, 0x65d998b7, 0x2ec80987, 0x1eccff11,
-       0xc51aff10, 0xed0d62e3, 0x893fbd81, 0x9f6b79d9, 0x58f2c5c9, 0x5913ebf4,
-       0xd403de7f, 0xa05bed6f, 0x21373b31, 0x5ec94b9e, 0x3ad84783, 0xa4898001,
-       0x91dc093a, 0xf60503e7, 0xc337a654, 0xf6174e5f, 0xd3d0281b, 0x9247c89c,
-       0x47d9472c, 0x7de49c44, 0x3f5d4711, 0x9e67c7fa, 0xfb4f839d, 0x44d09c44,
-       0xfdc73c7c, 0xac45b7fe, 0xd66b7faa, 0xc7ca16d2, 0xf1b32d7f, 0x227ce2c3,
-       0x44727028, 0xdc504f9c, 0x6f3f51d0, 0x69d7738a, 0x1fa177d8, 0x34daee9d,
-       0xf2aa729f, 0xa947cd45, 0xcc0ee59d, 0xce7154a7, 0x0aa3beaa, 0xc222f337,
-       0x7b91fb5f, 0xf7e4cc8b, 0xaefaf3ce, 0x07f0cbfd, 0x9e1ca2af, 0x8ff28c38,
-       0x1d90a713, 0xafcc3f86, 0x8dd640c6, 0xe19283e3, 0x4bde7647, 0x97681c78,
-       0x4848fa47, 0xfa9b021d, 0x9fdbe919, 0x9fdf61f1, 0x474acaee, 0x78711e79,
-       0x9e51d2b2, 0xccbf2783, 0x38ecb324, 0x9bab11fd, 0x115755db, 0x0f3da7e1,
-       0x3838cd4b, 0x73f3a735, 0xf44b3294, 0xced18af9, 0x3071e74e, 0x243b07df,
-       0x9acb1756, 0x76e6ea9f, 0xfe62a5d9, 0x2b7c1973, 0x11bf9366, 0x828f81e7,
-       0x1fc2e7f8, 0xa263cfd4, 0x2be528fb, 0x7b1eb718, 0xaf398956, 0x3c2264db,
-       0xe092e86d, 0xe57bc827, 0x1771d8ee, 0xc46a5bcb, 0xf73b1b3a, 0xfa831b1c,
-       0x7a297aac, 0x2be50d5e, 0xc03c9cec, 0x169acfea, 0x499f3a25, 0x78cb7917,
-       0x0b794f18, 0x07f989e2, 0x16bd0cc5, 0x8745efc4, 0x6b4c90a7, 0x09cb899f,
-       0xcbb32afd, 0xb4bf9142, 0x28fee3ce, 0xccfc057c, 0x8e06f66e, 0xb3dd22a6,
-       0xb49d725a, 0x1f332cc7, 0xcb99d59f, 0xfd980ce2, 0x445432f2, 0x90b3cbb9,
-       0xd73ed3e5, 0x47942ce9, 0xa093f0a5, 0x8daef3f1, 0x914aaf82, 0x47f46dcf,
-       0xfc133dd3, 0x86cfb44d, 0xa83392bd, 0x1280f9d3, 0x8af3af37, 0x9d766a75,
-       0x7bc7463c, 0x79e881b5, 0x6f1f215e, 0xfdf3f467, 0xd58136c0, 0x347ce2e9,
-       0xf9d87207, 0xd5adef78, 0x7857bf53, 0xac4a717e, 0x166f8c63, 0xf243a9b8,
-       0x7e35bf48, 0xa9b84fd9, 0x3ca97c94, 0x35e485bf, 0x033af748, 0xa0fe3a2f,
-       0xf90bd63c, 0x617813ac, 0xb5fbe17c, 0xdd3f25bb, 0x19dfad2b, 0x81a3ff4d,
-       0x0f090b35, 0x6caab8b1, 0x5b7e5851, 0xca549b05, 0x5571636f, 0x66978c35,
-       0x2c58e295, 0xd23cea9e, 0x79e6e84d, 0xee95fff9, 0xcec8256a, 0x59ffaa7d,
-       0xfe88fa72, 0x74a96ff6, 0x7da378fe, 0x1956fd70, 0xfd7c1138, 0x6f3cfcb5,
-       0x4c327fe0, 0x945dfa66, 0x50758b7e, 0xa6dd3e74, 0x3218fb72, 0x0362f3f3,
-       0x2fefb13f, 0x3df8f914, 0x57b580bb, 0xa54f3f3a, 0xbec1dff3, 0xad6054a1,
-       0x3fc51169, 0xf0884fea, 0x79d2fb3b, 0xeb35b89d, 0xbe53efe3, 0xe29b4f7e,
-       0x6a0e4cc4, 0x8a6e2ac6, 0xdf6335d3, 0x11109cca, 0x79d2da57, 0xdb4f79fd,
-       0x74098da3, 0xe48af0ce, 0xec1bf324, 0xd423fbfa, 0xce48b5f7, 0xb1fef889,
-       0x6777a1be, 0x92b23e93, 0xde7ad3a6, 0x5a8bbbee, 0xc5ec7fb1, 0x75919c3b,
-       0xe73b31e5, 0x0ab19eef, 0xa3fd9b8b, 0x41567e93, 0x3dae80e7, 0x0ffb8ecc,
-       0x9d92aebd, 0x904ab60f, 0xcb1d1b85, 0x8f9afa3a, 0x27039cea, 0xe7c64a55,
-       0x43549fb7, 0x5c0f915f, 0xc82b72c1, 0x559b49ce, 0x1ddc6baa, 0xca21a89f,
-       0x90fa5e8f, 0x75553f9d, 0x548fcc4a, 0x3afd96ed, 0xfbb479fe, 0x5470950d,
-       0xa8c122d7, 0x8571c8dc, 0xa3bf938d, 0xdc2da7fe, 0x5cf81a7f, 0xe068f02b,
-       0x5aebc0d3, 0x6dd667e1, 0x63e3c68b, 0x1a3adae0, 0x65b47fdf, 0xcd794a8d,
-       0xfdf1cda3, 0x36afe18c, 0xfe88fd50, 0xe8aec37f, 0x71871b79, 0x387e63e8,
-       0x1bf59fd6, 0x42842c38, 0x7050e1c2, 0xe23338ed, 0xaac9eafe, 0x5ee71071,
-       0xb7111de4, 0x3379b88d, 0x7e740eb9, 0xf3bc52ae, 0x6eac2b66, 0xb7ff66f0,
-       0xab93891a, 0xbb0b2702, 0x53f4c0fe, 0x80b3d5d1, 0x9e025bf6, 0x92ef921a,
-       0xf28d24ae, 0xb7108ae0, 0x165dc5db, 0xfa225fbf, 0x2dce2c4c, 0xd216c081,
-       0x0b61e0ff, 0x243c773f, 0x84087cb1, 0xe420db1f, 0x77c841bd, 0x6359d603,
-       0xe62f294a, 0x82c6f475, 0xa528c73d, 0x6bcf13af, 0x254d1f8e, 0xee062f39,
-       0xb8071667, 0x65f4319f, 0xe31b89c4, 0xa49bf861, 0x0b2eeaef, 0xf708f7d0,
-       0x5f733f09, 0xe919fa0b, 0xbc1fbb46, 0xc5e1892d, 0x8de9c1d7, 0xed758b8d,
-       0x0e4df3d1, 0x890e5f9e, 0x11cf36bc, 0x308aafad, 0x7ae31524, 0xe9d9758b,
-       0x99f56f67, 0x12deff69, 0xf5d3dd89, 0x3cd3e3ea, 0x9c38f471, 0xdd7c8b57,
-       0xf3a52fe8, 0xd01f9c2d, 0xeb23939a, 0x9e0e9df1, 0x94cd577f, 0x88ff247d,
-       0x696965fa, 0x65fadc6e, 0xbfe703a6, 0xe76ebd9d, 0xc5fac8d4, 0x709f27b5,
-       0x1facbdf8, 0x7f929455, 0x64fee168, 0x4dd71ca0, 0x581c7ca3, 0xb16deb7e,
-       0xf0cea9f8, 0xef288e22, 0x427087ba, 0xdd25d9f6, 0xfcc1384d, 0xcd126eff,
-       0x437aba32, 0x627597fe, 0x97e5c63c, 0xc303f82d, 0x9c09f1dd, 0xa8db946f,
-       0x5180f578, 0xc17dd407, 0x79e34df3, 0xeac4399d, 0x892eba81, 0xc8fdb6e1,
-       0xa45c9cb5, 0x8ffbb077, 0xfdb06b39, 0xa38f0707, 0x1f02f3ed, 0x572077d1,
-       0xf371ad5b, 0x2dbf61ca, 0x5276616d, 0x593284a7, 0xf31071de, 0x3f5819bb,
-       0xd58cfa9c, 0x1247ed0f, 0xf6b9d356, 0x38cf5ac0, 0xd4f42bed, 0x3f2c8d00,
-       0xac2d846d, 0x3225fca5, 0xf1a0db9f, 0x131e4aef, 0x4ffa8ef1, 0xc31fae21,
-       0x8d2b5fb9, 0x5b7c17e7, 0xfa374b67, 0xd4afc303, 0x1757bc0a, 0x294ad9ef,
-       0x539e6c57, 0x3308ec2b, 0x62df1678, 0x0e9d9bf3, 0x9c08bf91, 0x644a9c36,
-       0x71e0eaf9, 0x5d33a359, 0x474feb94, 0x7986fe53, 0x739c5e7a, 0x2e04cfcc,
-       0x65fdc5fb, 0xe4ccb943, 0x5bc99a66, 0xf9421f23, 0x9e0cbc31, 0xbe53f64c,
-       0x8df8745f, 0xf57fd23c, 0x69179c5e, 0x0f3fa877, 0xcfc7aefb, 0x481b5c70,
-       0xc6327762, 0x6fc3bef8, 0x359c264c, 0x9f32fa9c, 0xbe5ae5eb, 0x7d39b8ea,
-       0xbc492b46, 0xbc49358e, 0x8730ed8e, 0xf27ea952, 0xfedd941e, 0x7a1a7d08,
-       0x476117fe, 0xfaf5e660, 0xface871e, 0x171c5d0d, 0xe2de6ea6, 0x79f82bfe,
-       0xbff6c28d, 0xe21e7c61, 0x1ae22be5, 0x7ba85d10, 0xb86612af, 0x31349ef3,
-       0x8727bc7a, 0xbbe32332, 0x451dd68f, 0x06a1af7e, 0x02491f98, 0xc7e8b3f2,
-       0xdef7547c, 0xe5812e77, 0x76f2c74b, 0x95bf3054, 0xadf90327, 0x4d554e27,
-       0xf90f8c8a, 0x27e7990e, 0xca2c8724, 0xfbe59e56, 0xc234390b, 0x73ef5172,
-       0xce92bf1c, 0x527580e5, 0x6c71d937, 0xf9ab749d, 0x05b7436e, 0x7bd81ce8,
-       0x13bec2c1, 0x81bddab9, 0x85f0e1d5, 0x19f91267, 0xa76e78f0, 0x1bc389f6,
-       0xabf3d126, 0xcede3787, 0xc6a52fce, 0x23e5f8a8, 0x2f28b2fa, 0xe3a9933a,
-       0x99f76d78, 0xc2ad604c, 0x647ea7e8, 0xc1d77afc, 0x4f60d7e3, 0x90a73b02,
-       0x00e38f20, 0x5bad4426, 0xcb16fed3, 0x653a6a23, 0x8c1e2457, 0xf0703ef7,
-       0xc223eafc, 0x9013f101, 0x6dcf4c5c, 0x7ce9adbc, 0xad53d19d, 0x1b1e9804,
-       0xde3e145a, 0x2fcc5bca, 0xb03e1d19, 0x36fe88fb, 0xf7e6bf3a, 0x02bcec1a,
-       0x18fb3267, 0x6ff4282a, 0xe8affec7, 0xc875ca11, 0xdcfe026f, 0x9b83eec2,
-       0x11a7c77a, 0x5f7a87ee, 0x178bc477, 0x083dd0ef, 0x97227a92, 0xe3b117d7,
-       0x39f8327b, 0xdcf389c2, 0xeb989d8f, 0x9fcf1499, 0xaf1e60f9, 0xef2125b7,
-       0xbc516576, 0x3217b4fb, 0xdecf39f8, 0xe209df6c, 0x812dbfa7, 0xdbf5a7dd,
-       0xfce8b9f8, 0xe9cdc7fd, 0xa5db7714, 0xaa3f1469, 0x405fde0b, 0x2fd8f8f7,
-       0x782b7e63, 0xd61bdd90, 0x742db4b6, 0x2ea3a1c5, 0xc5f1fb83, 0xc8fbfc6a,
-       0x7bf8c5db, 0xf510cce0, 0xee130ed1, 0xa2855ef7, 0x8679676d, 0xf436f92b,
-       0xff0bf7bf, 0x8512c0fb, 0x81ef25e5, 0x077bf0ae, 0x54b03f7e, 0x85fbd1f8,
-       0x1e5a5e5f, 0xed9727ed, 0x7ee9a786, 0xbe2b9960, 0xac487e1f, 0x6c5c1cbf,
-       0x451607dd, 0xe4487bcf, 0xa3b90f77, 0x10ca4f9f, 0xf21f37fe, 0x3006ffc9,
-       0xebbe901e, 0x5c58130b, 0xc4ca6fbd, 0xb1c179b8, 0xfdeec0cd, 0xbffdc57b,
-       0xc286f7a1, 0x3abc59f7, 0x35fe73d1, 0x09dbf31b, 0x5ee71790, 0x195e246b,
-       0xd720fef6, 0xa82fb8b7, 0x868d38d5, 0xe560afde, 0x652e7913, 0x90b17de8,
-       0x04def57f, 0xaf9ef22d, 0xea8b6036, 0xd36f3b7b, 0xf9f8462e, 0xf46f816a,
-       0x73c8e6fd, 0x67b29d8a, 0x0bdd0671, 0x3e59fb58, 0xb8b01c8d, 0x08e57c85,
-       0x112c72be, 0x6dcae8f1, 0x77e2e26b, 0x8fbb3f84, 0x6b077dfb, 0xcc2d0a7b,
-       0x92036aee, 0x6aa3ee9f, 0xac9ebc83, 0xc9ebc05d, 0x579e76fc, 0xf25078ae,
-       0xbee624bb, 0x067d134e, 0x795a967e, 0x327036fc, 0x1f812f2c, 0x7e78a71a,
-       0xb1e788bf, 0x7d049a38, 0x779ce90b, 0xd2724ba5, 0x78b171f7, 0xea6abe5a,
-       0x6f9ee45b, 0x9bc41f86, 0x16327e42, 0xf0cf3f47, 0x1a632b7c, 0x4c570bab,
-       0x144f75c1, 0xb8439a7e, 0xdd89bba9, 0xdb7a14ec, 0x413bec9b, 0xbf66bef1,
-       0x5fdf07b8, 0x792219d8, 0xf7cb02f4, 0x5b7d6dfa, 0xcc1e79eb, 0x836bc1ee,
-       0xdefa4e09, 0xc92bb6b5, 0xf6fd4099, 0x54c9c486, 0xcec9761f, 0xb457ec24,
-       0xf2405c9f, 0xdfe328ac, 0x61a9d465, 0xb4ae6f96, 0x5e92b679, 0xa27b3897,
-       0x3a0dbfee, 0x58f3866f, 0x0902f6bf, 0xe76fe327, 0xe0c85e6f, 0xf8feaef1,
-       0x719399e7, 0xcf36e9ab, 0xf07ba26e, 0xba5557ad, 0x7e4ef326, 0x4eba6163,
-       0x6f3674f3, 0x16cf4b49, 0xe8357e3a, 0xee343b0f, 0x367f155f, 0x6f8b23cb,
-       0x86907bed, 0x50976f83, 0x73d03cde, 0xc08d44bc, 0xfa3d7f77, 0x6bfa38e7,
-       0x5bb09300, 0x69256b33, 0xb86fc8b9, 0x8fbb7b1d, 0x41b9d266, 0x316fd93f,
-       0x295267b5, 0xbdb6d62e, 0xf2913a97, 0x1ade0e8c, 0x92e95deb, 0x87303cd9,
-       0x894a1ff2, 0x4669efa4, 0x5f0095df, 0xff942007, 0xf1c894c0, 0xfb6fffa6,
-       0xae38413f, 0xeca286b5, 0x561390df, 0x47563eed, 0x7bb0b61e, 0x8927ba75,
-       0x92ea9efc, 0x2c0cf5c0, 0x674ec86e, 0x78f0bdd2, 0xf0ccc54a, 0x10cdf508,
-       0x9ee9db34, 0xeff32836, 0xff99b2cc, 0x9ff62e9e, 0xd0f60e61, 0xc53396f7,
-       0xe82ce2bd, 0x06bef363, 0x40bad661, 0x0f3b5333, 0xb72dac9c, 0x32a3ef06,
-       0x901038af, 0x4cc1ff49, 0x9592edb3, 0xf1007f7d, 0x37223df4, 0xe4325c33,
-       0x13fdd321, 0x962f5eff, 0x8f02eb9f, 0xefdc5c33, 0xdf412a50, 0x80439659,
-       0x09df77dd, 0x1def7121, 0x58d98f9f, 0xd77dd1a7, 0x893b689d, 0x367e1e4c,
-       0x23f10e7f, 0x7427e3c7, 0x2c33531f, 0x293e88d0, 0x9eba6998, 0x0c7ceb74,
-       0x375b0266, 0xe0785d75, 0xfb91b2c9, 0xdbd76742, 0x50bbe8e7, 0xdf62e5c9,
-       0xc9ad3a8d, 0x04975641, 0x7ec3fdcd, 0x39200f2c, 0x66626d73, 0xf777c8c6,
-       0x3df601e0, 0xf777ec45, 0xcce5eec4, 0x8cb4ef91, 0xfaf73fef, 0xc426eb97,
-       0xd5872ac7, 0x4a3e2329, 0xd07739ad, 0xcd39e0f9, 0x8d399893, 0x996d03be,
-       0xfb3116c8, 0x53bcb1a7, 0x5c092ae0, 0xe4bfc4e5, 0x07fbbe32, 0x389f1786,
-       0x8265f6bf, 0x9252ae9f, 0x91587c30, 0x43881dae, 0x5fa19dab, 0xe159efa7,
-       0xe53af9a9, 0x566d5bb7, 0x166fe527, 0x846937a2, 0xff2b26de, 0x7ef8c1ee,
-       0x4d8e562b, 0x663e8328, 0xcb2b4e7f, 0x628fd78b, 0x6b8f34f7, 0xb27fbf9c,
-       0xfd10a678, 0x1bcca78f, 0xd16ef945, 0xb164e62f, 0x30e51bfc, 0xe98390c7,
-       0x80e7ffc6, 0x3c91977c, 0x817fff63, 0x802a2fc1, 0x72134681, 0x48d7f834,
-       0x5c6f143f, 0xbf431fa8, 0xd9722379, 0x57f9c891, 0xf18f4be8, 0xec9d5dec,
-       0x836f9634, 0xcf05ffbf, 0x10785073, 0x00107850
+       0x00088b1f, 0x00000000, 0x7de5ff00, 0xd5547c0b, 0x733ef7b5, 0x9993331e,
+       0x420f264c, 0x084f0042, 0x21842a20, 0x38880840, 0x8d069009, 0x8808089a,
+       0x420100ca, 0xa9113248, 0x676d5e97, 0x6ad11422, 0xa36d2d1b, 0x4101da97,
+       0x180d45a3, 0x1d0340e8, 0x5abc414c, 0x5b4a0a8d, 0x3c3141b5, 0xe878490a,
+       0xef5bd6c5, 0x33ef6b5e, 0x42667399, 0xfddfb6a2, 0x7f17dfbe, 0xecfb36fe,
+       0x7b5ef673, 0x7b5affad, 0x231fb5ed, 0xd313c659, 0x057c8415, 0x7213d77f,
+       0xf4842448, 0x0b3b4eeb, 0x108e3a68, 0xb0398e7f, 0xb4242055, 0x24edefef,
+       0x4db39085, 0x267355b3, 0x98c7fb21, 0xf2d3d743, 0x80fc81b3, 0xdd4f9699,
+       0xd121c479, 0x514ed57c, 0x3ed37282, 0xb1df7e2b, 0xde400851, 0xf1fd6e6b,
+       0xb5df34b5, 0x699b2453, 0x376424d5, 0xda425491, 0xa9fd842d, 0x6a5f98f1,
+       0x4daad965, 0xf682effb, 0x626683ca, 0x37b7dfa5, 0xafc86e89, 0x08042adc,
+       0xf76aaf6d, 0x5a00ca83, 0xd080b2df, 0x7e695568, 0x1a8a63eb, 0xfb03c84f,
+       0xb368ecfe, 0x67da7213, 0xfd82aa21, 0x491c6f28, 0x7b604548, 0x7dfa00e1,
+       0x65c136c5, 0x6c57f5a2, 0xf401d73c, 0xc3c93455, 0x8adf5a44, 0x47511b06,
+       0x22bfb6b0, 0x07cb5ed0, 0x794eded8, 0xfe57b428, 0x110a3de5, 0x1bb29fa1,
+       0x74a2abbe, 0x76b5bf40, 0xb1eafb4f, 0x559f8d3d, 0xe8f6d1cf, 0x0a2fd57b,
+       0xb562e82e, 0x8e807889, 0xb9d6dd8e, 0x7fa1db4f, 0xf8f0cab5, 0xdc2c7ec8,
+       0x08a8fd05, 0xed0a526c, 0x6526df40, 0xfaeec8e9, 0x87fc3456, 0xacfabe9e,
+       0x72889efe, 0x47da7a63, 0x3bbc3a59, 0xbb88415f, 0xa44bd691, 0xaa3a5280,
+       0x4207f9fb, 0xa1e32122, 0x96a8917e, 0xe4a9faee, 0x23fe0711, 0x0f949ff4,
+       0x81f1bdfe, 0x72dd99ad, 0x9904e95b, 0xbcedcb75, 0xea51cb93, 0x5fac8dca,
+       0xf20c7f4b, 0xf9d4f4a0, 0xee3e989c, 0x8374c34b, 0xfdbe454f, 0xd30237dc,
+       0x9f0b9f7a, 0xc3cbe93f, 0x8dcfa374, 0x22be53e9, 0x12be034c, 0x6fb36f7c,
+       0x7c5ba62e, 0x8cfe7c1e, 0x06d31caf, 0x7f3e0d5f, 0xd31ab7de, 0x3e3f3e6d,
+       0x1eb7d17f, 0x1d5f46d3, 0x5e403ba6, 0x05f26d34, 0xbe5dbdf0, 0xbe834c06,
+       0xc7be7c46, 0x11f4c417, 0x64c747ce, 0x3e512f92, 0x49c4dc38, 0x8a924ec5,
+       0xcd32f9dd, 0x7cb09527, 0x7cfe1dea, 0x3d53e685, 0x32f94f34, 0x6f9432a0,
+       0x3501f9a6, 0xfdf07cac, 0xf342c0a4, 0x7cacfd83, 0x02ee23c8, 0xa90fcd2b,
+       0x37c3e563, 0x68e20bfa, 0x9580787e, 0x542dbd5f, 0xabf9a360, 0x7679591b,
+       0xa76a9933, 0xcb10ecf9, 0x9ee1bce7, 0x39f34f1a, 0xfb9f2cad, 0x83aa7f81,
+       0xd8db73e6, 0x04ce93f7, 0x2d1ed544, 0xbab21d87, 0x6d595098, 0x4b70cff4,
+       0x515e6913, 0xca2e21ef, 0x6eadff1f, 0x43f29d29, 0xc8796376, 0x9bcb1f3f,
+       0xbf963714, 0xfcc32fe3, 0xe583d92e, 0x2c55fdc7, 0xfcb078af, 0x98bdff73,
+       0x2c7eca0f, 0x58fad4b7, 0xf963f15e, 0x58f5da80, 0x80391eff, 0x1f6b23e5,
+       0x4a3df2c3, 0x5f1fcb00, 0x1a7ba4fb, 0x3c11afcd, 0xd23c073f, 0x01649cb4,
+       0x4ad31a9e, 0x09d69e28, 0xf7e02e64, 0x8a3a0007, 0x0ae975cb, 0x3f8ee1ea,
+       0xfa0d3ee4, 0x90297f8b, 0xc3ccfa5f, 0xaffdf899, 0xd6991eb0, 0x4f5ef623,
+       0xba799bce, 0x2cde727a, 0x8069ead7, 0xfb58d6f7, 0x378ecf56, 0x79e9e927,
+       0x67ab42b3, 0xdf13d23b, 0xbce57eb7, 0xcf4f5935, 0x3d5a955b, 0xc49e907b,
+       0x74d3d1be, 0xa69fcf44, 0xb4fe6123, 0xfafd3d20, 0xf7b8cf46, 0xf719fcf4,
+       0x6f3f985e, 0x7de93d60, 0x3de9a7ab, 0xde9a7f3d, 0x08e7f30b, 0xdf506bf6,
+       0x7dee35fa, 0xbdc67f3d, 0x47cfe61f, 0xdf664f48, 0xa1f5d9ea, 0x3ebb3f9e,
+       0x04e7f30c, 0x6fac33d6, 0x48fdcafd, 0x8fdc9fcf, 0xc2e9fcc2, 0x5beaae7a,
+       0xd23ebb3d, 0x47d767f3, 0x817cfe61, 0x5bea8cf5, 0xa2ff72bf, 0x5fee4fe7,
+       0x0931fcc2, 0xbe98cf50, 0x54fc13d1, 0xa7e09fcf, 0xb0d8fe61, 0xa37df19e,
+       0xcf5daf27, 0x30f6bc9f, 0x9004527f, 0xd5bec4fb, 0xf3d76c13, 0xe61ed827,
+       0xe7ac20cf, 0x2bf5beba, 0x3f9e84ef, 0xfcc22779, 0xcafd8e19, 0xf40f7aa7,
+       0x7c4f5a10, 0x39ecf5cf, 0x9ecfe7ab, 0x8cfe61b3, 0xd3a67ac6, 0xaf7ab27a,
+       0x9e875267, 0xc23a933f, 0x7ac3c9fc, 0x9eadf466, 0xfe7a1d3d, 0xf308e9ec,
+       0x73f91f27, 0x35fadf53, 0x9fcf53a9, 0x3f8c9d49, 0x4cd70f63, 0x3a72d075,
+       0xfa44ba16, 0xdc67b5c9, 0x45e6816e, 0x4e8bcb27, 0x44bf0117, 0xd20dfcd4,
+       0xf7e916ea, 0x39896df6, 0xbf48930f, 0xfa14a0a3, 0xb1bd4f15, 0x2123bf48,
+       0xe7e74e2f, 0x7493ba24, 0x01a2e4f9, 0x95fbf7ba, 0xf795d10c, 0xaeb57b9f,
+       0xa393dd3c, 0x4f9467cb, 0xa83fbdd2, 0xbf9740a6, 0xba0df562, 0xb7fd33f7,
+       0xeb59f2ea, 0x3fbdd76f, 0xae916eac, 0x0afacafc, 0x8155f95d, 0x35fcba95,
+       0x7baeff0d, 0x03e3547f, 0xc1d1f2ba, 0x63e57587, 0xf2eb8f42, 0xa93d0f63,
+       0xeb7c7f7b, 0x84f95d66, 0xcaebcfa3, 0xd0edb627, 0xb93dafe5, 0xd9e7e0c7,
+       0xf0d7ed9d, 0x27b808bc, 0x574fefcc, 0xc50bdfd0, 0x0657982b, 0xdf8fd1d8,
+       0x3d54bf1f, 0xbcabe54e, 0xa14d58b2, 0x129905f2, 0x0fe7ae3a, 0x8db2bf28,
+       0x9277bf3e, 0x7d274ae7, 0x19e2af7e, 0x9fe18ced, 0x24083c52, 0x04d5520d,
+       0x41fcb1a9, 0x20b1e199, 0xc7e1cbe3, 0x535ef7e8, 0x9a44f0d7, 0xd7e62fef,
+       0x129e5e03, 0x38d3884c, 0x7bc0d491, 0xf3826671, 0x73330782, 0xe047f69f,
+       0xaa20fd75, 0xbd774287, 0x1a4f65eb, 0x6b9b19f8, 0x1f83f6df, 0xed106eb2,
+       0x9e4200d7, 0xf90ede16, 0x07efd287, 0xd0f34d2d, 0xf50accfa, 0x57db23d3,
+       0xb123fb68, 0xff6806fd, 0x37da1ec5, 0xb5d3c90f, 0xae5c196f, 0xd0a2df6b,
+       0x1fd49df6, 0x6f23fda8, 0x12610a9f, 0x7f0b2f21, 0x83cdf6c4, 0x07fdb1cb,
+       0x895f3a15, 0xdc2e3f6c, 0x77f4107e, 0x3e3fb41f, 0x4c87ff46, 0x707ff7d2,
+       0x0affbe85, 0xb52bffeb, 0x71fb78c7, 0xe116ffd8, 0xe0ffeb18, 0x337fd60a,
+       0xbedc37ab, 0x43ffcc23, 0x7b37ffd0, 0x64d67fea, 0xa8afff7d, 0xccdff7d4,
+       0xf6a77fda, 0x8edf6f14, 0x9c2bbfed, 0xa2bffd62, 0xcc57db12, 0x47e0171e,
+       0x09ab88c9, 0x40c9f6d0, 0x03fa986a, 0x903b685c, 0xa0a2488e, 0x6151e426,
+       0x6f71d208, 0xe7dbc31c, 0x686f1471, 0x9cf8fc6f, 0xcb65a804, 0x8e2ef3a5,
+       0xf2db15f5, 0x584bb015, 0x4b2be74e, 0x4165a938, 0x364df111, 0x28c30398,
+       0xd1411dbd, 0x0db2f90f, 0xfec005d7, 0x4164cd79, 0x91277c09, 0xf4ff3c10,
+       0x4736a367, 0x2e98cbf6, 0xdbdb93a9, 0x3c2df422, 0x23202a8f, 0xd37d286a,
+       0xbbe30401, 0x79d31ff3, 0x8bf3a110, 0x833ce80f, 0x227e4850, 0xa23ef6b3,
+       0xb7c825f3, 0x9412f9d1, 0xdf8b5213, 0xa70eead1, 0x384bfa51, 0x4c4b1ffd,
+       0x43be3f5f, 0x7ea9f808, 0x31bdfe7e, 0xb05d4f38, 0xde9946da, 0x7f42c74d,
+       0xfb4f2eb2, 0x753907e5, 0x360736ed, 0x155fc80b, 0xaa8a55f8, 0xf5e2c849,
+       0xddd79419, 0xc54fbfef, 0x7f594e9e, 0xfdcb711b, 0xae77fbe9, 0x69390612,
+       0xe6ddb3bb, 0xb84e361c, 0xd7a84c33, 0x4794c324, 0x634dadc8, 0x29035a64,
+       0xb71fcb75, 0xb33bb445, 0x5d9f9f48, 0xc877cfa2, 0xe944d96e, 0xc81528ea,
+       0x9cef5a26, 0xad72fab9, 0x8929bb1d, 0x57b799c9, 0x9be8ca92, 0x3c0e6903,
+       0xe79ca276, 0x1ab7d93a, 0x32c5de3d, 0x3c82c29d, 0xc808fdfd, 0xef829fd5,
+       0xfd64eedd, 0x573bd236, 0x684bb8b6, 0x142ee73f, 0x236f8003, 0x67da7ffd,
+       0x69b29b73, 0x32a7feba, 0xc7f74531, 0x8f3cff48, 0x328d3fb1, 0xcbf3c38c,
+       0x6e19cf8d, 0x3ffcb9da, 0xf4d07c06, 0xd283e004, 0xa3e39c7f, 0x7c32aedb,
+       0x9b9ecd78, 0x4f5d0f01, 0xcae50488, 0xc71b72f1, 0x3d3a92cb, 0xc8f1082e,
+       0x7365c720, 0x23879c85, 0xe3873070, 0x1ebd5960, 0xbf127737, 0x2e431e9c,
+       0xfa6c36f3, 0xdd1a9a61, 0x6e390fbf, 0x1fb23fe6, 0x4fdd13f9, 0xb8bba726,
+       0xd1acee9c, 0xe5c6df97, 0xeb97277a, 0x0ec7fadc, 0x6e41f350, 0xe8320357,
+       0x4d3ef7bb, 0x793a6d9e, 0x8d3cb87a, 0xe5c5de74, 0x98f7d779, 0xb6f48d3c,
+       0xd5b67971, 0x90c9905f, 0xf48d7a68, 0xd51d582d, 0xb9e4051f, 0x9e5b1fd0,
+       0xf27e60de, 0x55e788f1, 0x8f92338d, 0x8ad9e847, 0x7e5d5286, 0xee9e6079,
+       0x0bf565fd, 0xea4be575, 0x17caeb96, 0x975bbfaf, 0x9effe85f, 0xab05fdee,
+       0x77e5756b, 0x2ba43cd6, 0x98fe5f9f, 0xf3cf3f2e, 0x39fdee84, 0xcae93773,
+       0xa73c9767, 0xb4599f2b, 0x752f975d, 0x6fbdd6ef, 0x2dd577da, 0x8e37cf80,
+       0x89fc0488, 0x30275ccf, 0x4b99f82e, 0xc73bc176, 0xbae22a7d, 0xd30237dd,
+       0xe2173e93, 0x0f2fb4fe, 0x8b608ed3, 0x3a09c61d, 0x89252e2e, 0x6e9bccd4,
+       0x103f5dae, 0xe38269c6, 0xacd316e9, 0x4264ff5a, 0x91526d7e, 0x0af5c5df,
+       0x44258d09, 0xd386c180, 0x944625d1, 0x5e52f5b7, 0x727f0d4f, 0x5b717974,
+       0xc7dee7ec, 0x8ce15e17, 0xd6e97711, 0x7e019253, 0xbbf7274f, 0x0295e58d,
+       0x4e7c8929, 0xd7a803c8, 0x5bb8f8e7, 0xaffd30a9, 0x405e91dc, 0x0d0f901c,
+       0x7b5cb9af, 0xfde4148d, 0x3a592701, 0x7f565e3d, 0x13bece8d, 0x03f6ca88,
+       0x3dd58dbc, 0xad70d15f, 0xfb33bbee, 0x1abba445, 0x1844c56c, 0x375e4b16,
+       0xb50e1d81, 0x0a399e0c, 0x61bf74e8, 0xd82a7182, 0x33c2fd0f, 0xe3e4a2be,
+       0x04afc812, 0xb9be93d3, 0x3cfbb698, 0x95f71e98, 0xafb1fa63, 0xdf36d306,
+       0xf23f4c6a, 0xc0fd31f9, 0x3fd31eb7, 0x3d30eaf9, 0xf4c7abea, 0xd3005f3d,
+       0x4c06bec3, 0x6235f1df, 0x620beada, 0x6373e1da, 0x6f5de9aa, 0xc7c93bb8,
+       0xbf80d3e1, 0x78eb3818, 0xfaed5560, 0x3b38ddc9, 0xd6afba6f, 0xcf9bb03f,
+       0x8e66f5c5, 0x1e1d5487, 0x336080be, 0xf297ace2, 0xb0e3997a, 0x9763efa7,
+       0x6bff377b, 0xc4de36f0, 0x8a6fccfc, 0x653c6eb7, 0xd594f018, 0x89fa9e1b,
+       0x34f1bbe3, 0x7e64e4de, 0x8fd3c70f, 0xe6311fa0, 0x84e00515, 0xd7f08bf4,
+       0xa71636dc, 0xd409ebe6, 0x6a716553, 0xfa1af6de, 0x75fa2b6e, 0x6e301181,
+       0xb7f11f9c, 0x3f8710e1, 0x274cd47f, 0xcff73d7d, 0xf99e9388, 0xcdf9c6ee,
+       0xbc1d00d2, 0x5b9746c6, 0xad5f18e3, 0xe8445226, 0xb0d0f6b8, 0x468b5c67,
+       0x49225e62, 0x55c07df0, 0x5ea31f1a, 0x7f032bea, 0x9aebe37b, 0xa1b3cff8,
+       0xff27f6be, 0x78e90b9e, 0xe397f313, 0xdbf4445a, 0x1769e849, 0x2e3c37f0,
+       0x10695d99, 0xa61aeedf, 0x086fd138, 0xf3fcf5d8, 0x376e7cd3, 0x3ca21eff,
+       0xb771c56a, 0x37f90d2e, 0xe9e1f3f4, 0x6f5fe07d, 0x7e37bdf6, 0xf80c0a2e,
+       0x37b3f097, 0x5d9bd8fb, 0xc5f56e24, 0xe77fed20, 0x0f3951be, 0x870760ab,
+       0x0f5a79b0, 0xa5d6d6fc, 0xff7cf48c, 0x33b8e26b, 0xeb71c355, 0xf9db4260,
+       0xf9cbeb88, 0x40132ba6, 0x9c1eb42e, 0xe4ed741f, 0x722f7e7e, 0xafa99b3d,
+       0x2fac6bcf, 0x68c22141, 0xa2bc6eda, 0x6a420490, 0x22a3cf44, 0x6d5c6fce,
+       0xec1b887e, 0xa8d6b9b3, 0xfd3c6f30, 0x1a854866, 0xf385f1f5, 0xc0769e87,
+       0x9a656c3c, 0x863c79c9, 0xaab4b51c, 0x8f69d331, 0xf504af9c, 0x4275f3f9,
+       0xe7ce2351, 0xa35984d4, 0x3a719c60, 0xbb050f8f, 0x56a9869f, 0xc534cacf,
+       0xddda9c79, 0x09590dd3, 0x6017fe6c, 0x225b64f6, 0x3ed39bda, 0xcfffbe0b,
+       0x7aa7a7a6, 0x69087a34, 0xc0589f22, 0xacb2d39e, 0x51efdf9e, 0x0a8ba41f,
+       0xb34937c4, 0x37cc39fc, 0xaffff4ad, 0x12bd4086, 0xbd7ab5e6, 0x3cdfa28d,
+       0xd36f9e1a, 0x53bf47b5, 0xf857b5b5, 0x93bd67ae, 0x7b86bb48, 0xf957bf2a,
+       0x068af0fa, 0xc7ef53ab, 0xdef2ea26, 0xe753ba60, 0xc03fc2d7, 0x2411af71,
+       0x87255fc0, 0x5f64a75f, 0x0cda780f, 0xbf9843c1, 0x2abdec08, 0x51e29b4b,
+       0x015a5d51, 0x34f28b9f, 0xfe73abfc, 0xa9d4ed4c, 0x7a0265d7, 0x54a4be46,
+       0x20a9f2e5, 0x4c44cde2, 0xbf98bf34, 0x4569a8bd, 0xa75b8c31, 0x50fe6c4c,
+       0x301c4a46, 0x75272e3f, 0x3d4f10b9, 0xa0454c4b, 0x3bc9679f, 0xfa11b18e,
+       0xb0544e78, 0xf5ebc5d2, 0xdf9d3c7e, 0xeacbf2eb, 0xe4a5f9f5, 0x075854d6,
+       0x2641ba5f, 0x86ec0101, 0xe898fcbe, 0x91977ac4, 0x6e30759a, 0xbbc79cff,
+       0x94893916, 0xfaabe941, 0x17732fcd, 0x892e3a52, 0xd6d5fc6c, 0x31279771,
+       0x05662bfa, 0xff7d3714, 0xb7b1a693, 0xbf440b51, 0x7583ac0f, 0x71297f6d,
+       0xf2d1256d, 0x1bf4bafb, 0x81fcd5e9, 0x4e64f5a8, 0xe0834a47, 0x63b0c40e,
+       0x3d30248a, 0x6aeef6e3, 0x838ba9c9, 0x223e42e4, 0xf18df20e, 0x78744294,
+       0x067a2cda, 0x7e19e34b, 0xd4820f00, 0x4dbe78a5, 0xf55169fd, 0xfbf52d5f,
+       0x903fd627, 0xabab9fd6, 0x4a9ff73f, 0xfa28d0ff, 0x5fd5620b, 0x76179bf5,
+       0xa93da9f9, 0x0e67e978, 0x53c9c742, 0x8baa5d52, 0xeb72b5ca, 0x9a6e1d0f,
+       0x0efc949e, 0x80a9ebc0, 0xde4b1458, 0x76f2c3ab, 0xbb8805db, 0xfd693fc1,
+       0x11ff9fa7, 0xdf3e23c6, 0x9e313b2a, 0x990e60d6, 0x37563ea9, 0xd9262f2d,
+       0xf2c63f98, 0x21139e0f, 0xafe3d41f, 0xa59fd9e2, 0x8a0afec2, 0x0a5f1e14,
+       0xbd5b3fa1, 0x1c42d3e5, 0xea17489f, 0x683bf191, 0xda1252ff, 0x424a85bf,
+       0x13a53974, 0xce5e04e3, 0x8fd36f17, 0xf80e89ce, 0xdfce1b57, 0x7397ef8d,
+       0x14b974ff, 0xa36ed29f, 0x26409eff, 0xf8d43d80, 0x3fcc0241, 0x2fdcf35d,
+       0x7a518fb2, 0xdd796cce, 0x49f04421, 0x8df3a3d3, 0x47b57f8b, 0x76ded9ed,
+       0xf48b3d50, 0x4af1b483, 0xbabf720d, 0x7295a599, 0xd52d71c8, 0xb24dcafb,
+       0x571f4fcb, 0x33f4f0be, 0xf31c424f, 0x30d7668f, 0x178aff5a, 0x8937bc0e,
+       0x976c57e6, 0x37598a53, 0xb76a42ec, 0xfff4bc5c, 0x72dd39d5, 0x80f978a8,
+       0xcf628ea2, 0x96ea4fef, 0xfbed8ac7, 0x9a2a3215, 0xf71b531f, 0x18f66d2b,
+       0x563c6972, 0x9ac27e08, 0x814bfee7, 0x7da9e2f8, 0x199fe902, 0x0e9b9f83,
+       0x7c001fa0, 0x39723942, 0x7866e585, 0x02e54bdf, 0x93935af6, 0x6e46fcb1,
+       0x753ea04f, 0xc5f9e224, 0xf2fdb43d, 0xd05d993f, 0xef17f2ff, 0x4e3f4071,
+       0xd70c3548, 0x2a61fcbf, 0xd972afd8, 0x94c4ea9f, 0xea7f2f3d, 0x65b788bb,
+       0x15377f6f, 0x9dc449e3, 0xc7b1c26e, 0x5bfd0e9f, 0xf63671b2, 0x20f1296f,
+       0x297fcaee, 0xfa680496, 0xb68a4499, 0x0e8bd0c7, 0x362717ae, 0xf68c4753,
+       0x1fcc04ef, 0x23bf5ec1, 0x422abee2, 0xffa026ee, 0xa17de5df, 0x3fe6021e,
+       0x1d3930b3, 0xaf5c4c90, 0x8919b7a8, 0xb60f2dd7, 0x0f4e7c82, 0x7587f772,
+       0xfc912f16, 0x57c21f9c, 0xedf15eb4, 0x7c99fde9, 0xf2e52a88, 0x3f38e8ef,
+       0xfbc39e15, 0x9adbb2ad, 0x7c8efbad, 0xfeddd995, 0xa53ede2a, 0xe7c60e3b,
+       0xfdb1a913, 0xa6b201d5, 0x8e9c74f7, 0x7e8457c0, 0xf2df7d33, 0x4d6fd310,
+       0x45a503df, 0x30f17e50, 0x0ef81fd3, 0x574a3fc6, 0xef963fa8, 0x3da0259f,
+       0x58e6f3a0, 0xe645bd7a, 0xd72fad7a, 0x96e94270, 0xbc088484, 0xc849fd40,
+       0x595f5c7f, 0x177e81ba, 0xd0bd2f61, 0x3eba239e, 0x71976f4d, 0xfa053ffd,
+       0xfeb74d7f, 0xef4c8d93, 0xfc9ff67b, 0x07236e2c, 0xf412799e, 0x5fa7ea95,
+       0x4b957d05, 0xdd7fdfa0, 0xeddef2d6, 0xdaff4f54, 0xdea9e9a8, 0xb4f51a7e,
+       0x1278c77c, 0x6aff4f4b, 0x7a989177, 0xd4c79f4a, 0xe21b7b53, 0xfd94fff8,
+       0x2897f8d4, 0xd9a7f9eb, 0x68f89ec3, 0x4a2f87b4, 0x68d3f22a, 0x61dfe90f,
+       0x3f8d1b92, 0xde1a770d, 0x755d7e2a, 0x309dd805, 0x85dc352e, 0x2ee1a971,
+       0xe3ab7e2a, 0xcffcb19f, 0x74a26b10, 0x4fd4b7cd, 0xa5847981, 0x2bbce08b,
+       0xeb88967f, 0x048b96a6, 0xc880bef5, 0x7df06fb8, 0xf078cd53, 0xfdfca743,
+       0x52f7b3b6, 0xbf13e77a, 0xebe5d6cc, 0xbfebf464, 0xc9abeafc, 0x73b73fb4,
+       0xeca7cefe, 0x63ca89be, 0xe28424ae, 0x24f39d28, 0x82484fe2, 0x3e40acf8,
+       0x7e63a08e, 0x7f0f3eb9, 0xebbb5253, 0xaffdede9, 0xa6f90f3b, 0xb63edbe9,
+       0xa42ef576, 0x2979b143, 0x20a54f12, 0xef3fca57, 0x04302138, 0x549b52ed,
+       0x7aaf3112, 0xb79ddb9c, 0x0f1ccda7, 0x9cfe4bfe, 0xe70c0951, 0xeb7e7183,
+       0xbcebf6e5, 0xbb004d5f, 0x0b39be7e, 0x0fe7afe7, 0xb58f8e2d, 0xe385b26f,
+       0x575f00ec, 0x750bb4e9, 0x277dc522, 0xc5ff42e9, 0xad92b76f, 0xbefdd631,
+       0xe4f89b2f, 0xfe8dcb83, 0x736e5489, 0xd1e70e39, 0x2272134f, 0xa6eb36e4,
+       0x5a239253, 0x71f7f00e, 0xdbeb3cc4, 0x0d7017f2, 0xb6b16dfc, 0x88c49615,
+       0xf384fdd7, 0x5f2bca6f, 0x69d5fee0, 0xf012f9cd, 0xd45d9a71, 0xd41e39c5,
+       0x192475f4, 0x794d7409, 0xe3a3f965, 0x87bd8e29, 0x57ec1744, 0x539f36f5,
+       0xbbe6313c, 0xfd427e46, 0x901e47e0, 0x23afc89d, 0xe012c972, 0x56d991eb,
+       0xef96eb02, 0x58aaae2a, 0xb3374e74, 0x523cc878, 0xe138d9f2, 0xe6fe3eff,
+       0x150f89cf, 0xb79c7e50, 0xd1c0fdb3, 0x7f7a63f8, 0x6a0429de, 0xc8a1c005,
+       0x004229f2, 0xc48564e2, 0x0164e8f3, 0x48fafdf5, 0x2c1f95fb, 0xd5f6017d,
+       0x4e0b3754, 0x96af2d13, 0xb1c014da, 0x025db837, 0x9546fcff, 0x20de31b8,
+       0x159a8cd5, 0x203ad711, 0x96afc84b, 0x277eddbf, 0x2cc2f7f0, 0xdcba0133,
+       0x6039cf23, 0x3cd0bfdc, 0xa7a0f516, 0x47c1fd7e, 0xa0934ca6, 0x30f8821e,
+       0xc530a1e2, 0x9ecfcba6, 0xa8ba064a, 0xdb98a6dc, 0x90c571ee, 0xe18532df,
+       0xcdf6cfac, 0x7d99fff2, 0x1bed4c9b, 0x691cb5c3, 0x512b46df, 0x2c7fadf6,
+       0x56b2b6fb, 0x58b80fed, 0x3fab37b9, 0x6be575c8, 0xb2c5fa4b, 0xd8faaf6f,
+       0xbe35fdfc, 0x2073bb0f, 0x23a36fb5, 0x6a40dbec, 0x6dc462df, 0xffcd15d3,
+       0x59bec5ec, 0xeff477fe, 0x316fb055, 0xd1523bfa, 0xe6a2b7db, 0x456fb45a,
+       0x7edd4503, 0xcf852ca8, 0x6fb47ae7, 0x1b367f0b, 0x16cbb2f3, 0x57c03f03,
+       0x71af6fb0, 0x80ed073b, 0x38a45b9d, 0xdabefdb1, 0xdabed2b9, 0x3e25ffb9,
+       0xe56e766b, 0x239e7620, 0xcecc871a, 0x7664ccad, 0x665ee56e, 0x630e56e7,
+       0xdf68ce76, 0x1beca20a, 0x047abefb, 0x8be71efd, 0x83b8bf99, 0x95cf1796,
+       0x7efa165d, 0x5f9daab1, 0x691f19a8, 0x122916ef, 0xdeca39f2, 0x39e1ceb9,
+       0xddecde90, 0x86ef605b, 0x0a1b1da2, 0xc7c4647a, 0xba6d430d, 0xbe4772fd,
+       0x4bf5ff68, 0x107f2fa0, 0xbefd9e71, 0xf68bcd89, 0x163ed17d, 0xa7376ef4,
+       0xc98551e7, 0x47e7c3b3, 0x24753a7b, 0x43aaf7d3, 0x544e3871, 0xbfac0937,
+       0x15010bf7, 0x5dbf81c6, 0x9df2f9c2, 0x797cd97b, 0x83f1998e, 0xcec89bfc,
+       0x2c16505d, 0xdcc3c08c, 0xd718154b, 0x0b112b9c, 0x0e0baff8, 0xfc0a70dd,
+       0xd69705d6, 0x00bbbfa3, 0x89bec39e, 0x32eb6ded, 0x2e77bb68, 0xa1de7017,
+       0x1798efed, 0x3f7a97b6, 0xec737e76, 0x38531a7d, 0x13ee533d, 0xa72fb002,
+       0x2f107db7, 0x239bfd72, 0xc8bf21b6, 0xf8cc625b, 0x985ef6a4, 0x97c62e4f,
+       0x6fcc55aa, 0xf289f30e, 0xf9a2154d, 0xbc5d2544, 0x2f9bb530, 0xfda4ee77,
+       0xbfb9e94d, 0xf7a2df1a, 0x3e71b8e1, 0xd7bf80b3, 0x3e341f13, 0xf39ff547,
+       0xb8a9fa9d, 0x8fc8c79f, 0x5ccecd46, 0x5e814643, 0x3cf26fbe, 0xf4701e3a,
+       0x942f949f, 0x0de6dbce, 0xd9e79dd3, 0x9372f9c5, 0x54b4d8e7, 0x6a48f815,
+       0x97b76700, 0x4a903f6f, 0x3b8b77fb, 0xe6420733, 0x78a6ffb3, 0x62d0fe20,
+       0xa83b42ed, 0xcccd30e1, 0x8e57f870, 0x9c0323c3, 0x09bc70d3, 0xafd44e0a,
+       0xf1cec190, 0xca5e647d, 0x6f5fd067, 0x144f8f90, 0x859fa09f, 0x720578da,
+       0xa9bcffa1, 0x5bc5c999, 0x6e5ca023, 0x81075d26, 0x8229d5ef, 0x2aab442b,
+       0x21ff6e0c, 0xd57ab7ec, 0x9e839f4a, 0xcdae0b97, 0xf4f61d8c, 0x963898d4,
+       0x3718e162, 0x9b8c4609, 0x24bde00b, 0xc668b7d8, 0x1efceff6, 0x3f4647b3,
+       0xf5b98a65, 0xe533d008, 0x09b264df, 0x7fe8061e, 0xfa303811, 0xf07a5131,
+       0xa4fdf735, 0x2afdfb72, 0xfc0ec1c8, 0x1fc052ee, 0xf8d886f2, 0x257b95a3,
+       0x4df21a75, 0x8e904393, 0x1c98e32f, 0xc8dfa960, 0x3cb45be7, 0x6fde1fe0,
+       0x7ef86416, 0x324f9506, 0xfa6a9a2d, 0x7786a0e2, 0x2fcd1ab3, 0x47a42788,
+       0x6fb00dd8, 0xd596eb91, 0x4f91b7c1, 0xeea2ac37, 0x27cd1a99, 0x07603e4d,
+       0x28afc72f, 0x8fee09fd, 0x9bea7fb9, 0x599a4fea, 0xacfb3faf, 0x868faf5d,
+       0x015eda38, 0x4e690aed, 0xf20fc5d4, 0xd65e6ccc, 0xce20f562, 0x5d935ebb,
+       0xfb68d59b, 0x0b971573, 0xcf2257cc, 0x0e854def, 0xd3b1bac1, 0xfad13e4a,
+       0x2ce1843d, 0xd5783c72, 0xf5f941ea, 0x5e04ff54, 0x98fe4f7f, 0xb40eff96,
+       0x5516fb07, 0xf1c67b7d, 0xf5278b48, 0x6669afd6, 0x69be3f66, 0xbe76b4bf,
+       0x9783baee, 0x4dfc62b4, 0x2cd87f5b, 0xc32e7e7a, 0xd048b8fc, 0xca5073ad,
+       0x9ff2fd71, 0xe558ff50, 0xfc43f532, 0xfcf94428, 0x31a7b6ea, 0xf9f67d5e,
+       0xfe833763, 0x48adf8ac, 0x3a9f542c, 0x1093c5b6, 0x80a207db, 0x24d1509f,
+       0x91167ae2, 0x2333b942, 0xd6420cfc, 0x14bc7e30, 0x62a7768f, 0x4c503987,
+       0xf5d8afbf, 0xddc43649, 0xf6601e3a, 0xc73cffcf, 0x1b2dbfa3, 0x242bfbd6,
+       0x946f8eb6, 0x9f1cbdcf, 0xe6db7667, 0x1a16fd82, 0x8ad779d8, 0x39b239c6,
+       0x6550ce22, 0x7b5c5996, 0x59f70db7, 0x70139ffb, 0x17d0329f, 0xdb52ce79,
+       0x39e679ff, 0x822b9766, 0xcdce0072, 0xef6c3456, 0xc5783880, 0xaffa3351,
+       0x0a7386de, 0x5f53a7f8, 0x23fd017a, 0xc5d4506f, 0x8fe2a341, 0x0cc8620d,
+       0x2aa6b3f1, 0x7f3403b4, 0xb18df30c, 0xc5bdf0e3, 0xb4bc56c9, 0xb29f9777,
+       0xcfcbc570, 0x6cdcf03a, 0xc60756eb, 0x1f2e1b21, 0x378a8fff, 0xd9743e36,
+       0x8e69e378, 0xf5995f8f, 0x21a435eb, 0x9490e319, 0x1892dcbe, 0xee308b71,
+       0x29ecf85f, 0xb33b0f58, 0x014fafe3, 0xb8ff95bd, 0xe07dd4f0, 0x3ab3ed8f,
+       0x3ef6bc61, 0x13d7047f, 0x7376efb4, 0xee78ef3d, 0xe9875c59, 0x05d9a3f8,
+       0x3dec75b5, 0x23d61831, 0x917fb63a, 0x55db710a, 0x3ce3a77b, 0xa9ced56d,
+       0x798c49fd, 0x6e029680, 0x07587d03, 0xa5abca32, 0xd03065a9, 0x1bca9679,
+       0xfc70b65c, 0xc58ab1b8, 0x371e55e3, 0xbd7b16de, 0xdc4e2a2d, 0xeb96f334,
+       0x926efc60, 0x43e92a5d, 0x9530f8bc, 0xc83ee8e3, 0x9a43db6f, 0xbf298fbd,
+       0x2a0ff0b3, 0xf20df7a7, 0xc969acfb, 0xb2849eaf, 0xe31ee4a6, 0xf03ea1c5,
+       0xdbcf5b4d, 0x6c7f7662, 0xf1d9bd06, 0x83cf8c6b, 0x835ce8dc, 0xd9f0bc74,
+       0x9cb38860, 0xc2eebb94, 0xcd7b33fd, 0x62aa2fb8, 0x3fa8fbef, 0xc6df3b1d,
+       0xd7c232f5, 0xf8483ad5, 0xf083ad8f, 0x4b779c39, 0x73338b3c, 0x5a1c43fe,
+       0x1e73e075, 0xd638666f, 0xc53dd0e2, 0x6c2dd39f, 0xceb6913f, 0xcfe5b558,
+       0xf5c4310a, 0xd3903c85, 0x8baecbb1, 0x02707c6a, 0xae44261f, 0xf38ec4a7,
+       0xb8ddd787, 0xe07e40bc, 0x4bd7857f, 0xc4207e68, 0xfbc203cf, 0xe83d8624,
+       0x61d6c4d8, 0xfbd8e43a, 0x95f5b50f, 0x4f418b14, 0x575b7d03, 0xaffe8de9,
+       0x26191fcb, 0xf9a3e39b, 0xd8cbe674, 0x45827c76, 0x61fb76f8, 0xf5a8852a,
+       0xcfac0b7f, 0x60531d37, 0x638da1fe, 0xf0cf7f5a, 0xe799f279, 0xb1ef3c45,
+       0xed05b1ae, 0x545ed1b8, 0x341f1613, 0xd3833bd2, 0xe3641d5b, 0xf11d99c4,
+       0xe7ad3b01, 0x11bb2bcc, 0x8edbd5cf, 0xdf5a7e29, 0x959786c1, 0x52fd88b6,
+       0x22044e30, 0xe2f33fe8, 0x7eb66cfe, 0xc6e5e6c4, 0x76f0e676, 0xdbb1cdbc,
+       0xa73b6ef1, 0xbf85676b, 0x77e76151, 0x69dedf2e, 0xea073dc9, 0x132add3b,
+       0xba7fbfd8, 0xc40a2c51, 0x45927f68, 0x4cf2e2d6, 0x8978e86f, 0xd9e31de7,
+       0x493146f9, 0x557aff41, 0x84d1de7c, 0x15154814, 0x6a6b14e2, 0x35d2fed9,
+       0x81a577df, 0xde24d7bc, 0x756deb86, 0x533afe06, 0xbf10f99c, 0x192b4e70,
+       0xda357007, 0x49b7449b, 0xf8aaff47, 0x1e70fea2, 0xc7f72d7f, 0xf3c2e488,
+       0xb0a3a297, 0x3a23fa08, 0x8c6b4e4d, 0x5ed905f5, 0x7c113c42, 0xf3fa9d91,
+       0xb1cbe492, 0xeda3d42a, 0xb4b4a9a3, 0xa742c41e, 0x4b0ab71b, 0xfcddec79,
+       0x77ec4e59, 0x4f3e36e7, 0x99d51370, 0xc183f6ca, 0x23b9d1b8, 0xc68c9b21,
+       0xe29b890f, 0x0b9fc6d1, 0x07eff6db, 0x41d6b47b, 0xcf5489dc, 0x31555728,
+       0x8e8dce0b, 0x805908b1, 0xfe6f73d3, 0x6d6bd696, 0xd0fe7116, 0x85f6d769,
+       0xcf4113ba, 0xdc11e46c, 0xfe5007ff, 0x4e9bb92a, 0x0240bee3, 0xdf76a4af,
+       0xb45d312b, 0xfce7bce3, 0x10071646, 0x98bfd5c9, 0x2470e2cc, 0xf1f3f400,
+       0xf3a70564, 0x7ef0a43c, 0x3ae78299, 0x72f6bd96, 0x3930886e, 0xb92bf244,
+       0xb4be7f48, 0x86c8eade, 0x77e27975, 0x9939c2b7, 0xbf5f5e32, 0x53b9fd12,
+       0xd07e7eaa, 0x4f5c25d3, 0xf0b4baff, 0x32bfd810, 0xebb452cf, 0xcfeae7fd,
+       0x59f71aa5, 0x2fb0bd21, 0x93ddea8c, 0xabbef442, 0xd6c7e6f2, 0x7a397cc1,
+       0x011915ff, 0x482ac9fb, 0xe7ce0b9c, 0x97d068ac, 0x79bb03ef, 0xd893b015,
+       0xebef172f, 0xc36dbf95, 0xdc79317f, 0x0aebf965, 0xe2dbfbc1, 0xecb2ae31,
+       0x9f68c5b5, 0xfe7a69cc, 0x7f3d555a, 0x7c8c236d, 0xde39f3d4, 0x369be7a5,
+       0xcf89ecff, 0xf3fa7909, 0x4b3e46be, 0x021bc784, 0xb5110e2c, 0x09b82dbf,
+       0xd9f236e9, 0x0b76d7c8, 0x7ce2f75f, 0x96257fa5, 0x81b26654, 0x842974ee,
+       0xa3d4617a, 0x80487b0c, 0x094a0f7f, 0xae57e2d4, 0x69efb478, 0x19423fbc,
+       0x7a06cefb, 0x2ebd0224, 0xd13823d4, 0x46de7607, 0x5bb6703e, 0x909f5841,
+       0x59e9aeaf, 0xfe94f79e, 0xfa22d8fe, 0xefc046d5, 0x762bd468, 0x0489376e,
+       0x9e8264d6, 0x6e309cba, 0x6a2cfa37, 0x9ff70499, 0x286cb510, 0xc4e27bdc,
+       0x1f7cc7f4, 0x8248e74a, 0x431b82fb, 0x3ec15317, 0xeba738fd, 0xde7bb066,
+       0xec04a425, 0x6c71cde0, 0xa798b29e, 0xdc2ab77f, 0xed7b4eae, 0x59bef87a,
+       0x785ce156, 0xcb56f367, 0x4507c830, 0x9bc47fbc, 0xb4157758, 0x332cd1df,
+       0x812ccaba, 0xd8bf1061, 0x1dbb632b, 0x7cf19365, 0x6b6fd865, 0x3a40fb66,
+       0x2c713f9b, 0x1de7b08e, 0x055e9fc1, 0x4c27acf1, 0x0c9ff7b1, 0xfdf89ab7,
+       0xfc70df35, 0x7fda8c6d, 0xf6cadc37, 0x0878fdc7, 0xe97547ed, 0x330e3e79,
+       0xcb96b87d, 0x6f4bf7f9, 0x6ceffec0, 0x47185416, 0x6e3bc50a, 0x39fb451c,
+       0xe3c488f1, 0x392e2c30, 0x9bbfbf8e, 0x1f80d2b8, 0x0223af13, 0x3fc4f3e8,
+       0x35b7dc12, 0xce2966ae, 0xa0eb7eab, 0x7586cf38, 0xb05b8a52, 0xe8ec6773,
+       0x956f8fbf, 0x9c4cb874, 0x798169e6, 0x04a384e6, 0xa384eded, 0x123cf2fa,
+       0x369db110, 0x4f6bf3fd, 0x5605f3ea, 0x49076f8e, 0xf86f7c05, 0x3aba4452,
+       0x01eb88bb, 0xd9676f5a, 0xa6efbc00, 0xda9c22f3, 0x6297e9a5, 0x7e71ac51,
+       0xf281e026, 0xe08509eb, 0x52c4f2f8, 0x5fefc63b, 0x05715a59, 0x7f9feb8c,
+       0xac4573cf, 0x7611e073, 0xafed8129, 0xe2502772, 0x0ad7ae29, 0xe975df8c,
+       0xebf63125, 0x70d6386b, 0x7d39e1ad, 0xd6279c69, 0xad0fc4be, 0x58290fcc,
+       0x6050423a, 0x204fb65e, 0x078ed7c0, 0x373d973c, 0x640f27e3, 0xe0de3d00,
+       0x2db3f405, 0x963b82cd, 0xeacab19f, 0x07bef360, 0x1fb0b5fc, 0x94aa5eef,
+       0xae7b1f60, 0xabce0377, 0x2ba0876e, 0x5ba9677c, 0x9770e788, 0x8866c858,
+       0xe9754b67, 0xee03c6b7, 0x4758cea7, 0xc4b27de9, 0x427e7284, 0xfefd2176,
+       0xbe30422a, 0x03b5e3c0, 0x229b266f, 0xc0ff23cf, 0x95b0ff9a, 0xd5b0fbd6,
+       0xf6497289, 0xdfa004b8, 0xe5ffdff5, 0xbceebd00, 0x0e394664, 0xed1ff3e0,
+       0x4f9cadbb, 0x6bdce3a3, 0x3ca4ff01, 0xe5c3f505, 0xc965a871, 0xe5012f70,
+       0x54758c7b, 0xf24d2fcd, 0xe946db50, 0xf09bb249, 0x76e22e7e, 0xdf6d4eab,
+       0x45efe119, 0x090903e8, 0x69a5f604, 0x166854f6, 0xff14f142, 0x10f62ce3,
+       0xca9233cc, 0x0929bf69, 0xf5616256, 0xc2674ab5, 0x9f71aae7, 0x2e65c53b,
+       0xb8226e1c, 0xd2360daf, 0x9d9afd42, 0xdaf3ecd5, 0x66f68244, 0x605263ed,
+       0xa367ad0d, 0xf88566d4, 0x2d5ba649, 0x4944ad80, 0xbde78a92, 0x7d339507,
+       0x32fd65b4, 0x50afec31, 0x0ff31f65, 0xf5ac4171, 0xfcc38fba, 0xfc00bcf2,
+       0xf5d43eca, 0x2e35b80a, 0x75cf6b2b, 0x79fe82c0, 0x3f706ed8, 0xbb8f90ac,
+       0xb1353f13, 0xeba102fd, 0xb69dbf71, 0x1bb4668e, 0x15de0f54, 0x953eaf41,
+       0x75cf9e08, 0xb572ffd3, 0xf611772d, 0xb9938f83, 0xf4169ac1, 0x2d91c4dd,
+       0x5f6bc780, 0xa238bbc7, 0x3784c8ec, 0xde806b3c, 0x8c3f6a6f, 0xa2131878,
+       0x33e5c8fa, 0x2a7b8552, 0x943ce19c, 0xfcf95ab7, 0x949bdb8e, 0xd1fd71d2,
+       0x3338e5af, 0x6bd357f2, 0xace7bea3, 0xb198b576, 0xc13200d6, 0xba110ed8,
+       0xc0b350e9, 0x8221bd1e, 0x4f99df7f, 0xbae942f1, 0xfc0ef417, 0x19818bf3,
+       0xcd0d9b80, 0x7e82b1df, 0xa3f1e37c, 0xb11d7e99, 0xa227fabf, 0xf6cac3a7,
+       0x0f803b87, 0xf22ffbd5, 0x728423f1, 0xea95cb0e, 0x443c6447, 0xe711bdc3,
+       0x81ac5e9a, 0xf0b2330b, 0xf9011c7c, 0x0a234288, 0x3a364cd6, 0x7f9aaf81,
+       0xcfec26bd, 0x9eb9e226, 0xded64e55, 0xcbf3591a, 0xefe8165d, 0xfe82f8aa,
+       0xf5175b97, 0x97f3a25e, 0x5e30f388, 0x67e70ba9, 0x090a4bde, 0x7e0b7f24,
+       0xb9eb6905, 0xc4a57e3a, 0x0757e0c5, 0xfff8d1e8, 0x6d93fb27, 0x6a83cfec,
+       0x25ae7f77, 0x51b6df9e, 0x4f7b90bb, 0x05c33a7d, 0x89169c39, 0xd95ebe0b,
+       0x51e77e93, 0x2dd706fd, 0x7a0d9f4a, 0xea99b13c, 0x8f5a29b1, 0xde09725d,
+       0x6bdae75b, 0xd4677b43, 0x5fbc8beb, 0x7be31b5e, 0x1199e88d, 0x5371f307,
+       0x5dc060d7, 0x8b924ab6, 0x41d9b129, 0xb6afad91, 0x91c6eb26, 0x8fddf1e8,
+       0x2ff35276, 0xf8d2bf35, 0xe4afd85e, 0xcf1686e3, 0xff148214, 0xc7f7dfb4,
+       0x5f01e679, 0xfcd938d7, 0x829a0e13, 0xab03fcbf, 0xcfa00ee7, 0x0710fb46,
+       0x42231aeb, 0x125e2c99, 0x4f5be9d2, 0xe83365fa, 0xc248634f, 0xc74fcc71,
+       0xcf4261b1, 0x4b8bf4f4, 0xab52f464, 0xc0ca7e02, 0xab1ac25c, 0x7bafb826,
+       0x47bb3660, 0xbb0e6066, 0xe3dff1f7, 0x7dcc7ad8, 0xd0dc6c71, 0x4b581fd2,
+       0xc97e81ee, 0x739bf112, 0x40dd39be, 0xef0fc42a, 0x0ddf738f, 0xb914b0fc,
+       0x4e191fb1, 0xde2812e2, 0x0146a432, 0x552437f6, 0x1b8b02aa, 0x40ee3612,
+       0x28cbeb4a, 0xdc61f356, 0x16b6a0ca, 0xcd1920e2, 0x6cf5cfb1, 0x5dbf9388,
+       0xea29abbc, 0x3886ca3c, 0x541f6fe6, 0x8b937f68, 0x709479d9, 0x0f9286dc,
+       0xbf88edfc, 0xf1db3b0d, 0xf50f5b19, 0x1b3e3227, 0x30205fe7, 0xf3c497e8,
+       0x6488543f, 0x91f9c24d, 0x99df04df, 0xb23f382c, 0xd8235711, 0x58e297cf,
+       0xe09d755c, 0x9ff90f5a, 0xb8165d48, 0xffc3476f, 0xeadf278f, 0x8e2be892,
+       0xc367ceeb, 0xc3ea959c, 0x8eaf20f3, 0xaf87e7c9, 0x0d741ec5, 0x8b737866,
+       0x9aeffdba, 0x4eb282dc, 0x8788566e, 0x78ebda44, 0x1df7e705, 0xe60b9c42,
+       0x05cb1d43, 0xe160a746, 0x7d2403e7, 0x43db869c, 0x27781c6d, 0xb7e9132e,
+       0xbc18ff11, 0xb2e2cc1f, 0xfd1a3d00, 0x86a473e1, 0x73c69e73, 0xe15969a0,
+       0xee3a4db8, 0xe0512d93, 0xbe722f8e, 0x97fe86d9, 0xdff4c1d7, 0x60fe8788,
+       0x6e732e3c, 0x15abf292, 0xae5fdbe4, 0xdb7b0449, 0x0ee3ceff, 0x0f91af90,
+       0xcc7f829d, 0xfadf5841, 0x9f731c83, 0xa5a69688, 0x7f05280d, 0x0d3d2d34,
+       0xbd79ed53, 0x07198a5d, 0xeef5cd3c, 0x9eb5e31b, 0xc3f30c58, 0xb39fd0d3,
+       0x73de779e, 0x6177baa3, 0x8e3ebc7c, 0xd15ebbf1, 0x8026a8f8, 0x5de7759e,
+       0x927eec09, 0x90ff7644, 0x8373c993, 0x492a52cf, 0xd1b9ef91, 0xdc47e91f,
+       0x1181e633, 0xad9320d8, 0xbf166b88, 0x5065ced1, 0x97e4c743, 0xb9fae8c8,
+       0xec294c6f, 0xcc6d919f, 0x30dc5d2e, 0x254bdb1d, 0x5387580f, 0x312d2ebe,
+       0x73ae20b9, 0x1c9fd176, 0x517c1470, 0xe02e6b46, 0x91e888fd, 0xd431e36d,
+       0x65b7f38d, 0x88409573, 0x9ea52a42, 0x9726241a, 0xb8eeb819, 0xff7314d0,
+       0xe6c6ddb3, 0x4e71cddf, 0x06d2d34c, 0x8d8d9697, 0x39440fcc, 0x7aa47869,
+       0xae365e98, 0xc5309cfb, 0x6fb40a47, 0x994ea7d4, 0x40dd6104, 0x9c2987b3,
+       0xd63d9aff, 0xf40521f4, 0x4b01d60c, 0xe4d47da8, 0x9abf8439, 0xfc4af18a,
+       0xfd5f9a13, 0x8e03e602, 0xded00aeb, 0x8f5ffd51, 0xd98232fa, 0xd3d82b6f,
+       0xe7653888, 0xc107f7de, 0xdf87dffa, 0xeb0f10bf, 0xba917f40, 0x9e7ec1e2,
+       0x78ddffbc, 0xe1f43738, 0x715e2cfd, 0x351e6197, 0xfaecc6c1, 0x6c92b6a3,
+       0xdf02d7e8, 0x227ae77f, 0xb3564970, 0x01e58d75, 0x5c9e70d1, 0x554f2f7f,
+       0x9ee1b263, 0x5bd63f1e, 0x32e7efc5, 0xcb92a1ca, 0x4db6f961, 0xed0a864a,
+       0x7eb6dc7b, 0xa08f6e70, 0x14d93cbd, 0x8d11f38f, 0xc6db459e, 0xfa773028,
+       0xaf99b34b, 0x6ccab77f, 0xc317705c, 0xf387967a, 0xc1e748cd, 0x6fac367d,
+       0xfed8cfc9, 0xadb48594, 0x7abed4d5, 0x0b79d99a, 0x7c963f63, 0xa7f616a8,
+       0x90f25bc2, 0x7862f380, 0x4e3a7eff, 0x883f5679, 0x7ec65eeb, 0x31cdef1a,
+       0xe6d55f9e, 0xfcb8cb53, 0xf50788cb, 0x6b5cea2f, 0x369f5b33, 0x1fceffc6,
+       0xff61b2ca, 0x91fe3c6d, 0x79c0264b, 0x86871de8, 0x3eee5c24, 0x1efc33e5,
+       0x1a57b826, 0x823e93d2, 0x654db669, 0xbf3464f7, 0xaae02f7d, 0xef1db83a,
+       0xf6bafb19, 0x94f9aaa6, 0x6b30f603, 0x91fa8776, 0xa43f01ab, 0x97f9d04c,
+       0x282e9bd5, 0xf8cbbe6c, 0x7e7f0770, 0x1b37f407, 0x3fab59f6, 0x7ce54c9a,
+       0x317ca547, 0xbf321ef2, 0xa6ee7f4d, 0xfad5fdaf, 0x2b5bf5a9, 0xd1fbe2af,
+       0xf869df8c, 0x2c78e6cf, 0x6eba52db, 0x9ad16500, 0xf30627bd, 0x4e7868f3,
+       0x1197c347, 0x4948cb3f, 0x8110ba61, 0xb147e693, 0xcb3c9a5f, 0xfef216ea,
+       0xbaf8d3fb, 0x8fc41a5e, 0x118dc37a, 0xdb721d1f, 0x2367d060, 0xb87a3a3e,
+       0x3627e45f, 0xa99427e6, 0x678842ee, 0x9d763751, 0x394fc233, 0xbc1dd529,
+       0x0b6cf40f, 0xf8c479c3, 0xd7b99ccb, 0x57cf1c65, 0xe1fdabc6, 0xdb943d3e,
+       0x6017d844, 0x5a7bc3f6, 0xb73eed3b, 0x7c04a86b, 0xb4f4c22f, 0x7435c4af,
+       0xd2f97768, 0xc0382e27, 0x411cee8f, 0x11d38e30, 0x77f7a7af, 0xf9e91136,
+       0xa543971d, 0x3f8ffad4, 0xd2da8d83, 0xda1dfb8a, 0xa071e4bf, 0xb145cd2f,
+       0xfe27f9fa, 0x86f7e11d, 0x4cf5c5dd, 0xe02c979b, 0x99abbb72, 0xda2f67ad,
+       0x30f28a58, 0x437ad7ee, 0xd0661670, 0x638d3caa, 0x51bf9014, 0xdf5c4b3e,
+       0x51607dc1, 0xf08f2272, 0xdc1e017d, 0x2f5653a7, 0x28c3dc62, 0x93bb7cbf,
+       0x6b57a39d, 0x42b71e70, 0x790ebd8a, 0xb5f4dda5, 0xc7ec63fa, 0xed0126c2,
+       0x65fe91a4, 0x0dd76a5b, 0xd67fd020, 0x847ee8bf, 0xe25da206, 0x55fad4fd,
+       0xff785c46, 0x50fad440, 0x7224f5db, 0xe6f2f53f, 0xbf2fb8c5, 0xb09ff69a,
+       0x85c61238, 0x7a35fa34, 0x1428fd8d, 0x8816c8cf, 0x5c16aee3, 0xefa39f60,
+       0xeeeb7327, 0xb0d85c3f, 0xafc8207f, 0x66fb625d, 0xce02fddb, 0x203f3b0b,
+       0xbd607d6c, 0x3d69eb80, 0xed99afca, 0x8e59ea07, 0xe7dc0a35, 0x8851b657,
+       0xf565c729, 0x11a1aef9, 0x60796a76, 0x8ea86b86, 0x1fdc46de, 0x54a1a2b2,
+       0x9d807cf7, 0xfdb893c7, 0x48df4dee, 0x38cc624d, 0x9a5fa693, 0x97fa69be,
+       0x3cd9576f, 0xcc1c0a47, 0xfebb04c8, 0xa84bce18, 0xcedabe5d, 0xd1e607d7,
+       0xb89faa57, 0x581f5ba0, 0xb3e4c792, 0xe7c62c44, 0xca57d93d, 0x1e7d9d07,
+       0x7fefd767, 0xd1fdb6f8, 0x85e9a1fa, 0x5ea33fd6, 0xc5aff918, 0x30728cd5,
+       0x82e81ff2, 0x7b1bc1f9, 0x0407816d, 0xa74677d0, 0xe915af7f, 0x702b48ec,
+       0x3fc839c1, 0xce9407c0, 0x31dbf4ea, 0x9496235f, 0xc75e71da, 0xfae34de7,
+       0xe1c83f16, 0xab4ed67e, 0x473b2c7b, 0xb80c9254, 0x36db5298, 0xf8a4e2d3,
+       0x2174647c, 0xe53a2bdc, 0x1099b6b1, 0xc8f25efa, 0x5fb84298, 0xb6d6ca7e,
+       0xea2e2d77, 0x2d8ed5d7, 0x57e5fb84, 0xf680dd80, 0x10db9607, 0x89e53d57,
+       0x9579f2e7, 0x5cce3fbd, 0xcbdd9f32, 0x292bcacc, 0x3c742d8f, 0xfc3c3cab,
+       0x959fa0f7, 0x1045c5ad, 0x8884a9b7, 0xaacf1d37, 0x2d908edc, 0x93e78d9b,
+       0x6cdb7be8, 0xf076559e, 0xc5ad2eeb, 0xb0f2adf1, 0x0e44fa84, 0x44a8b8b1,
+       0xdfa56afb, 0x7ea38dad, 0xdaefe52f, 0xe60b8b24, 0x1fb9f4af, 0x936bb5e6,
+       0xf11aaadc, 0x7c1f935c, 0x35ac7407, 0xfdfb75b1, 0x684f0daf, 0xbf78ccbb,
+       0xc32647df, 0x67c5a43c, 0x9e58d4c1, 0x7cf138af, 0xc589be44, 0xbfe58c35,
+       0x512cecd2, 0xd5170033, 0xaf161487, 0x4fe07fa6, 0x17a61156, 0xeb9d84d5,
+       0xf04c3aaa, 0xa1f54b1c, 0x02c73c42, 0xd63ffcfb, 0x735ff0e1, 0x571ba58e,
+       0x92054f8c, 0xc08a5930, 0x55bb34f5, 0x9bfb1797, 0x887f4046, 0x7382e718,
+       0xa9866218, 0xbfed0766, 0x294d0578, 0x4ba7243f, 0xea5afb84, 0xe1114ea6,
+       0x3235a9be, 0x62623fdf, 0xf6b5cce7, 0xb47f389a, 0x64bdb4f4, 0xecfdc807,
+       0x36b9ad5b, 0xf3817eb6, 0x6bbfad61, 0x60113704, 0xe08075de, 0x149c80f9,
+       0xb3fc02d2, 0xe01e7711, 0x127b3ded, 0x375b37e7, 0x90197fa6, 0x97a6ccba,
+       0x57f78a55, 0xfa84591f, 0xdd304ae0, 0x6ff34993, 0x7cb197d9, 0x2642e986,
+       0xf6dbf085, 0xc6bf9672, 0xcd086174, 0xce5f6bbf, 0x49c0b0f2, 0xf623b607,
+       0x48ff428a, 0x7de38768, 0xc01afb9b, 0xf16264b7, 0x0515e917, 0x7db453d7,
+       0x44e96b21, 0x1ef8f00b, 0xa7884dd8, 0xdafc16d4, 0x02eaf106, 0x3dfb0ab7,
+       0x837bf336, 0xf1aa69be, 0x7099b455, 0xf02903fe, 0x4fce43ff, 0xc9a42e4d,
+       0x8bec0d7d, 0x6bee8d25, 0xb4ed1d60, 0xf606d3dd, 0xad1bec66, 0x377ec053,
+       0x5ca7f3bd, 0x0afc9fbc, 0x37d8cf56, 0xf6909ce8, 0x066fece7, 0x8f5c8a6d,
+       0xffcf6d3e, 0x62a3be14, 0x5054ff40, 0xaa0ee49d, 0x44dc6b87, 0xbe60b255,
+       0x362f9fac, 0xb69f6611, 0x82ce4ad9, 0x10c0c95c, 0xf6455b8e, 0x6bc84e92,
+       0x26b49cf6, 0x9b5f69f5, 0x845abd92, 0x23293971, 0xd8117478, 0x7bb1dfff,
+       0x1bb7043d, 0x14be73f7, 0xed8cd7be, 0xfec1b10f, 0x177fd010, 0xf2a7f349,
+       0x2f8b17f8, 0x88dc9493, 0x07ef3079, 0xec1a7efd, 0x63609f37, 0xbf6807fb,
+       0x63abb044, 0x58e98a88, 0x81656788, 0xdf983d28, 0xde8f1a43, 0xdc7feb47,
+       0x9649e2ca, 0x0f8ba206, 0x38b3c766, 0x8b074ccb, 0x8dc9c60f, 0x10ff82b7,
+       0xc1388e77, 0xa5fce87f, 0x22fee122, 0xae2379c9, 0x11341d8f, 0x3959f7a0,
+       0x99f584e0, 0x7524abae, 0xafaee933, 0xab5bcb93, 0xbd4571f7, 0x7372e20a,
+       0x7d3fcc1d, 0x7ee09f36, 0x4a53aee8, 0x934dd600, 0x91352c32, 0xf92b9ff1,
+       0x0b390f77, 0xfe21e332, 0x408e37bc, 0xc5f613fb, 0xbf0e4099, 0x056396de,
+       0x3c04bc3c, 0x32487ca2, 0xfa86ef3b, 0x7a502e92, 0xdb39f133, 0x63a92f27,
+       0x277f2812, 0xe15760dd, 0xad67a9be, 0x7ee0378d, 0x784c17d0, 0x8a4beebf,
+       0x2ff214ab, 0x609d579d, 0x6ccd9f7f, 0xbcfec38c, 0xbcfec260, 0xf575d714,
+       0xc3f74a4a, 0x4a7c5823, 0xec0911b2, 0x502a64b2, 0x73cfa6ef, 0x493cd9e3,
+       0xe3cbd3b3, 0x2e3cfe99, 0x200f3c10, 0x7f51f299, 0x9d3afdb4, 0xebf7045d,
+       0x2ad59bf4, 0x4ae38e02, 0x4851b8b5, 0xe4cf7884, 0xdb7e8212, 0xe78cbb64,
+       0x307f6072, 0xc29b1b9c, 0x0f94efed, 0x813d712a, 0xdc30e04a, 0xe762d97f,
+       0x75f168f7, 0x4e39ebc5, 0x226d23ae, 0x5dd791f8, 0x07882e22, 0x8a497f5d,
+       0xe74e47e9, 0x10233ef5, 0x97be8129, 0x0095517f, 0xef44f977, 0x2faf4de7,
+       0xe0e3053c, 0x39e18b54, 0x8f4889f8, 0x4ff7cf1b, 0x4fee1a77, 0xd6f3e78e,
+       0xe47064c1, 0x1d6d313e, 0xf238ba68, 0x8b53f409, 0x65f01714, 0x3efdddbb,
+       0x5bfa7bac, 0x38b97265, 0xb63e33e2, 0xa5c46f9f, 0xa1ff5c38, 0x2e03b4f8,
+       0xf3afaeae, 0xafbf695b, 0x07eaca1e, 0xb95d821c, 0xc92997f2, 0xf1cde760,
+       0xa968decc, 0x97c03b86, 0xcbe18133, 0x3f5bba39, 0xe267c557, 0x01be9a7b,
+       0x3d9ea0ee, 0xac7e6072, 0xd78a6575, 0xedd78055, 0xb3f38276, 0xe65ba51f,
+       0xed699e82, 0xf86789ec, 0x6aeba637, 0x7587ee57, 0x6c67ff1d, 0xe03698bc,
+       0xde391292, 0x3864e87f, 0x3375aaf3, 0xf3fda66f, 0xbf5c65da, 0x8be7e549,
+       0x1e92f122, 0x770d1781, 0xef16761d, 0x7533f0d1, 0x3c22bbf7, 0x2119fa9f,
+       0x9e124cce, 0x99f86887, 0x9c3867e2, 0x138d8872, 0xddc7e1bd, 0xe6069ce5,
+       0x87370a31, 0x280a6e18, 0xb7f7f03e, 0x118fc07a, 0x8af54f37, 0x3cf12f9b,
+       0x53bdaafc, 0x186ebb2f, 0x7df7e9f4, 0xb689d31a, 0x8f82fbd8, 0x56ef7e72,
+       0x06cc6eea, 0x8993717b, 0x48937f9d, 0xe714adc6, 0x7bb4e3bb, 0x20b26be5,
+       0xf6625dbf, 0x19b37b67, 0xbb76cfed, 0xd77183c7, 0xcb9e0b34, 0x0da79226,
+       0x06bbf5f6, 0xdfc8d458, 0xc72ef8d1, 0x9a1ca361, 0xeffc0278, 0xf3fc98d7,
+       0x1b81ca6e, 0x197a48ec, 0x93b8c393, 0xe21126ca, 0xfdfc8e42, 0xe04faf80,
+       0xc3c02d4e, 0x25ef0571, 0xa0ae3eaa, 0xbecdfc5d, 0xbe210bb7, 0x9e1feda9,
+       0xc2ede7b0, 0x3ef09182, 0xdc6bd9c3, 0x3c796aae, 0xd276014a, 0xc4fd2f70,
+       0xfd2679f0, 0x8025f2bd, 0x72eeec9f, 0x73eb7de3, 0x1d1784e0, 0x736d6e77,
+       0x60b3074d, 0x4e7d6fbc, 0x9b1f9d88, 0x1d3dd47d, 0x7dd4654c, 0xb70f1ceb,
+       0x715dd691, 0xdffdf462, 0x163e7c74, 0xd7fbf10f, 0xc1c40a43, 0x6b9a951b,
+       0x26a27cd8, 0xa68fec0b, 0xf947f877, 0x08e1f8d6, 0xc3ff7ddd, 0x88f3f8f8,
+       0x38f7624b, 0x4eb829b5, 0xdf6128f8, 0xeb71f235, 0x39f7ae2b, 0x0f9c5eab,
+       0xb96c70f6, 0x576dd71b, 0xfe7c4539, 0x64b21213, 0x125cbc81, 0xca3477ae,
+       0x4213d4ea, 0x2a447bf7, 0xe5a76119, 0x8dc5fa7b, 0x70eff685, 0xf00e4c78,
+       0x43aea42b, 0x4984ddf0, 0x6ec16339, 0x4dacc7db, 0xa34c7186, 0xb455d29b,
+       0x874dded5, 0xc7275746, 0x858e1dc9, 0xf678c726, 0xe0a1d81d, 0x7c0b76b1,
+       0x71a0e1af, 0xff2639ef, 0xfc803c08, 0x2c20f1bb, 0x07c6bc80, 0xfcb54f1b,
+       0xa10f1f3f, 0x1e9f2081, 0x087100f1, 0x43c2b7c7, 0xc355f016, 0xaed7f503,
+       0xfe68fe02, 0xf6c2a35a, 0x0d796a1d, 0x7cf64507, 0x10a5cf7c, 0xf6443fdc,
+       0x6d39d959, 0x57ae224f, 0x6d64ecbc, 0x3ed87e74, 0x6498ba98, 0xebf983b2,
+       0x8c89efda, 0x57e80909, 0xe106a18e, 0x06e3f40e, 0x71743da2, 0x4176917e,
+       0x71377b80, 0xf806796f, 0xd064a197, 0xe2e6318b, 0x877fe010, 0xf8064a6d,
+       0xc9b63987, 0x5daf8059, 0x0ebd5623, 0x01aed643, 0x516f2fe5, 0xcd27fdbb,
+       0x6af0b5ee, 0x746ff6b5, 0xbd74fb30, 0x020f9d9b, 0x87491dbb, 0x2c41ff66,
+       0x9a108740, 0x86cafa63, 0x0db9baf6, 0x41d039ec, 0x205fbaf9, 0xe41fe04d,
+       0x5329dc9b, 0x17ebcfc1, 0xcece8092, 0x860c5fbd, 0xf3716538, 0xde8147ab,
+       0xd43d6d62, 0x350f5fa5, 0xbf9ad1fa, 0x342bcda3, 0xcf9b487f, 0xe504df82,
+       0xd3b9fcd9, 0x26add6cc, 0x6e782c87, 0xeaf3f1f9, 0xbfae6e55, 0x3147ed12,
+       0xa42dc7ef, 0xeed2e915, 0xf399b91d, 0x9d10f8a3, 0x39436687, 0x3e513721,
+       0x1defc4dc, 0xbfa5c9b9, 0xbc96e157, 0x688ef7d8, 0xbef6f4f5, 0xd6b87c71,
+       0x6df46eb0, 0x763e43d3, 0xfa7fc8cf, 0xd2773cd8, 0xc12fd110, 0xce979a80,
+       0x327069ee, 0x62521c3e, 0xb9fb578f, 0xb5324efe, 0xe5b9c365, 0x8efe7bfd,
+       0x7b2be3e3, 0xf81efefe, 0x494f1389, 0x4eb5f604, 0x012e353a, 0xd2f3e7d7,
+       0xab593d70, 0x9369fbd7, 0x88e7b08d, 0x5777ed1f, 0xdc7a520e, 0xc167d00a,
+       0x1e67b7f4, 0x77d429ff, 0x2244b8f1, 0x2a144dcf, 0xc710a19e, 0xbfbfe42d,
+       0xfe605073, 0x907e5692, 0xf3c5eeff, 0x21b0b71c, 0xc48fbb42, 0x9be7211c,
+       0x9a193df8, 0x593a6f5c, 0x8eca4a74, 0xfdfc0f96, 0x5a0be233, 0xf399a15c,
+       0x11fcb48f, 0xa77cb7cf, 0xfc096ee9, 0x89a4eff3, 0xeed11dc4, 0xe0ce950c,
+       0x2f1ce223, 0x4a7e0c3b, 0xbd3f73cb, 0xde2b8e99, 0x4adc4437, 0xfede6de8,
+       0x5be4367a, 0x8ff798c5, 0x9dfbf918, 0xfef1bbe6, 0x2a092191, 0xfb5bd3d2,
+       0x38a6ae93, 0x27720d19, 0x65cbcfcc, 0xe51877f7, 0xff9ecafb, 0xd91b6e48,
+       0x927bbf33, 0xbf0e51bf, 0xeb80533d, 0xc3c9bd4e, 0xb47ddb88, 0xbfda7e9f,
+       0x9fa7ed10, 0xf8af63fa, 0xbdff989c, 0x1af30d2f, 0x9f7bbd5e, 0x4e7f064e,
+       0x64f4e9c3, 0xbb899b86, 0xec4c9a7f, 0xf232f2dd, 0xf30773ed, 0xd710e66b,
+       0x3fe99bec, 0x78ae0a77, 0xd27e17b4, 0x4ab3fb0a, 0x0e738d38, 0x41ffa217,
+       0xe31079f8, 0x1c473638, 0x7bdee789, 0xa19bddfd, 0x5b9832f9, 0xbf0578e3,
+       0x36b802c7, 0x6f45538e, 0xb2e049d4, 0x98ab4a15, 0xba7ee31d, 0xce519746,
+       0xf6094847, 0x8d3a27a3, 0xabd23038, 0xefdae7f9, 0x4c7e50c0, 0xddf5a24f,
+       0xff63e6aa, 0xce61c6a2, 0xdfc69e97, 0x9c95fa9e, 0x1cdee3c0, 0x4e4e17ff,
+       0xdbd80b7b, 0xe519be93, 0xecd72c66, 0x90342147, 0xfc1fa983, 0xa9092191,
+       0x97850fa8, 0xe3a6e214, 0x3fa8190c, 0xaf8a4eff, 0xe3ddbc40, 0xc27acf64,
+       0x1325f55b, 0xe37724f1, 0x663e0e4e, 0x96eddc03, 0x1f106cea, 0xba5ecebd,
+       0xda6f5406, 0xf0b305a7, 0x1336879e, 0xf4d99081, 0x102d73e6, 0x251ef047,
+       0xa0a03e78, 0xc054ff79, 0x56a5efe9, 0x5e75479c, 0x08b1e424, 0xbcd8333f,
+       0x587e06c6, 0x6f9d8530, 0x7448983b, 0x27f790fb, 0x8f06bc30, 0x1dd9bf9f,
+       0x2f12fca3, 0x29dc499f, 0xc72e38d9, 0x70a3fc63, 0x3ffb09bd, 0x481d704d,
+       0x9e65bf01, 0xce85f380, 0xa40e13bd, 0xee3b7a50, 0x333b444c, 0xdde0f83d,
+       0xc6882a4e, 0xcf8b1eff, 0x780a16bb, 0xeaa140cf, 0x59617cc2, 0x98dfee26,
+       0x99e48ff0, 0x433e50c5, 0x74cdf9c6, 0x788252b1, 0x2134d9d4, 0x7b8be607,
+       0xf85ab684, 0x297f5c1d, 0xfd38876b, 0x7cff30c9, 0x0c7938a7, 0xaa9c76fe,
+       0xefe187e5, 0x3cc31203, 0x0bced56d, 0x7cb4cdfb, 0xf7016cd5, 0x66774eef,
+       0x7e047f10, 0x7953d70a, 0x6cb8a58e, 0xb8005fee, 0x3fa4599e, 0xc4bb3837,
+       0xeb910246, 0xef138216, 0xf7c83b21, 0xfc097769, 0xe7ae7c5e, 0xcfbc7037,
+       0xfbac9b99, 0x3f3094ae, 0x6453bbd3, 0xb3e471f7, 0xf4d6a1df, 0x87ae46eb,
+       0xf1f9f037, 0x8e864f3c, 0xd288628e, 0x5b3f4088, 0x62e5be47, 0xa5cf0e1b,
+       0xe78707e2, 0x1c6ef6d3, 0x8ad79861, 0x17116b95, 0x6f1d6c69, 0x1382ec36,
+       0xdfea6ec1, 0x9f4f25bb, 0x97c7a18f, 0x3d9a13b5, 0xc457bd98, 0xf9d9c375,
+       0x8902cf94, 0xaebfd3f2, 0x726098bd, 0xd078801d, 0x78dc97ad, 0xbd944e8f,
+       0x1be8a0f8, 0x50df8bd9, 0x7aa3cc1d, 0x1f0264fd, 0x41910737, 0x8ba63760,
+       0x380a7edb, 0xa6e3a4ea, 0xb48e0639, 0xef9b4771, 0x063d5217, 0x6c3390dc,
+       0xa5fa659d, 0xa4efdc34, 0x76c3f7cd, 0xae25fa84, 0x6fd2fe18, 0xf774b212,
+       0x4aed847a, 0xe7225f84, 0x64bf7b7e, 0x9547f53a, 0x206fa01c, 0x7b458ff1,
+       0x42c97186, 0xf10518d8, 0x1873b4c1, 0x744af1e7, 0xf3e38afe, 0xb02f88d3,
+       0xb752427f, 0x15fd187e, 0xd63cce2d, 0x7a53f9a9, 0x8de3849c, 0xa57dd8b3,
+       0x810a4e1a, 0xb3ffa09f, 0xf4eb8c44, 0xfdad1b86, 0xa212f0de, 0x564c08f6,
+       0xfae1788f, 0xf2f175f7, 0x197c6d17, 0x05f6864a, 0x343e1a27, 0x9bc718bc,
+       0x83c434ff, 0xba6f1a7a, 0x0e6f197a, 0xaed1908c, 0x7cd7e6f7, 0xeaf3e4ea,
+       0x37a62704, 0x7f1b355c, 0xd82c6897, 0xf937f011, 0x6b8e15b8, 0x1c9c33d5,
+       0xc1245b68, 0xec1791fa, 0x1cb76647, 0xfff078b4, 0x81c4c600, 0x008000d5,
+       0x00000000, 0x00088b1f, 0x00000000, 0x7cbdff00, 0xd5547c0b, 0x67b7efb9,
+       0x332479ef, 0x49926649, 0x1d843c32, 0x09212108, 0x11bc210e, 0x11084937,
+       0x88a80ca2, 0x1f01d68f, 0x4d092060, 0x6f53d5ad, 0x52812133, 0xbd583d6c,
+       0xf4f47bd6, 0x41ed5837, 0x0108750d, 0x26702783, 0xd0f098a0, 0x7ac0f820,
+       0x452968da, 0x5a18921b, 0xf5cf6a0f, 0xf6b7df7c, 0x8326664e, 0x73def7a5,
+       0xd62e9f87, 0xf5af6b5e, 0x5ff9efad, 0x4a9b5adf, 0x500a9fc0, 0x982015b3,
+       0xe1f95006, 0x06484a86, 0x01203be8, 0x96d40314, 0xfe1b41c9, 0xb1fdb4b5,
+       0x0cdd45c7, 0x51df8956, 0xf5c02661, 0x950b7e20, 0x06e6c50e, 0xbc95e658,
+       0xd6801672, 0xe1bfde2e, 0x62a82592, 0xf9af7afd, 0xe89b1ee3, 0x5fff35fb,
+       0xb800c803, 0x197f7f51, 0x2ffb0ffd, 0x1860a4d3, 0x3b365d5f, 0x978dffba,
+       0xa6913fca, 0x62d72c02, 0x3e4fc39e, 0x22f2a793, 0xac24becc, 0x8fb74457,
+       0xcfb92673, 0xe32ff1d9, 0x32d7fc61, 0x65f3c5c0, 0xaff7516f, 0xc8ed77e9,
+       0x523d48f2, 0xace80166, 0xdb1971b7, 0x7f016e5e, 0x4d2581c8, 0x0065c450,
+       0x9d0a0152, 0x581998b8, 0x0d0164bf, 0x136308f9, 0x3ab9f7e0, 0xdf86131d,
+       0x07e3883f, 0x8e30dc70, 0x3801c81f, 0xfae4ef54, 0xae1ef56b, 0x2f82935f,
+       0x877fe3a4, 0xb8a8b0bf, 0xdfedc59e, 0xdf38fc51, 0x8f0a4be2, 0x93d69b3b,
+       0x71830b4f, 0xf73f9eb4, 0x0de3fd16, 0xb6bfdc30, 0xbf8b33fd, 0xf9ebf2f0,
+       0xa7e7f35b, 0xcd3f3ca8, 0xcf0c15ab, 0x180144bb, 0x9a5ceb83, 0x635fcd1b,
+       0xc6f9589e, 0xfeb96fca, 0x56fcac7e, 0x90c7acc4, 0x32a2f40f, 0xffc38a8d,
+       0xa6d0264b, 0x437e5e5f, 0xb3f8b1f2, 0xdb2305bd, 0x72c97e01, 0x974f1e1a,
+       0xbe2b7417, 0x19974142, 0xb752baf5, 0x40efd40b, 0xb2b9ca0a, 0x4889c213,
+       0x2be7f5d8, 0xf4a8513e, 0x9471f04a, 0x6c7c033e, 0x1e1e5bc8, 0xe425d17f,
+       0xbcf0da6b, 0x7764148b, 0x0b1f3d11, 0xa8eb3881, 0xea1471a1, 0x6c39601f,
+       0x155a61d9, 0x635c75c2, 0x547d3b81, 0xe0328a26, 0x937db894, 0xf6e3c4d3,
+       0x8266c5ff, 0x3e5e01ab, 0x48025998, 0x3cead79f, 0x42011306, 0xbff7e066,
+       0xdfb9524e, 0x240824e6, 0x74a0fce0, 0x945ec8db, 0xb45c8012, 0x25b4653b,
+       0x364388d8, 0xd91f612b, 0x8157bf61, 0x2fdbb406, 0x050ef78d, 0xc914076e,
+       0x4c738fe6, 0x7ef4598d, 0xf61e7bb8, 0xa8a4559b, 0xcb8bb0db, 0xda877eaa,
+       0x9d580efb, 0xfeff5ef4, 0x699877ef, 0x1780bf9c, 0x0ed78429, 0xe7da8158,
+       0xf241cc3b, 0xe3e48b1f, 0xfdeb09b2, 0xec560003, 0xb8557f3f, 0xd76e5014,
+       0x13a37740, 0xc724b9cb, 0x8d7bf238, 0xfece9bd6, 0xe50a31c3, 0xd39740b4,
+       0x956fdd02, 0x8fd9901e, 0x41c92694, 0x53f61ac8, 0x5a32ead7, 0x3a256c80,
+       0x7ae1b416, 0x4bdafdb1, 0xb4bf5c4a, 0xe1771f48, 0x9321419f, 0x7ad1085c,
+       0xf84da8bb, 0x14d012a3, 0x6d4b29c0, 0x97e4ed31, 0xce459e90, 0xc973e7e8,
+       0xef5ea277, 0xf84bf18e, 0xf7bcd133, 0x8bbcc53b, 0xf726bfe4, 0xb65ffae0,
+       0x43cdef68, 0x9a4e077a, 0x0e7c59e1, 0x6732b1e7, 0xd0da5f24, 0x973983ae,
+       0x07fd8bb7, 0xe9153513, 0xc7f49979, 0x9ad1f541, 0xfdf2f53a, 0x940cf6a7,
+       0xb9787760, 0x13028579, 0x7b4f1d58, 0x3df98632, 0xff3aaf82, 0x22d9f963,
+       0xf91d9341, 0x5bddb0bc, 0x0465ae46, 0x8f913b1f, 0x80c95ef8, 0x295cf3c6,
+       0x78fb0d1f, 0x46a25cf9, 0xb9f2fefa, 0xffcd1ad1, 0xfa6be92a, 0x3feffeb0,
+       0xfe48983b, 0x2aa8f913, 0x2e0317a8, 0xd659f79b, 0xa1f7a15f, 0x6dc13951,
+       0xf5d16f58, 0x81c4e5fc, 0xefc4f9a3, 0x67de4deb, 0xe3651a69, 0xe48515c4,
+       0x9c96b737, 0x0d2477c5, 0x7ed107a4, 0x7709d524, 0xfb401960, 0xa40b7d21,
+       0x1993eb02, 0x36f34042, 0x9534f06a, 0x29abe60b, 0x1c41efc4, 0xe341dbb3,
+       0xe7a429a9, 0x338bd7f0, 0xf923857d, 0x0a8f52de, 0xd6b4f385, 0x1b2534db,
+       0x93bd5f60, 0x1ef56deb, 0x57ad5f2e, 0x2c74dcb9, 0x8e20c1f9, 0x3459ab53,
+       0x7df86d25, 0x8fb0aa57, 0x8867e805, 0x052005ae, 0x0b73a803, 0x5ef5d61e,
+       0x249b8291, 0x27ae1392, 0x97289f82, 0x08dc9ec1, 0x4d2936fe, 0x35b26693,
+       0xf28bbcb0, 0x063efc4d, 0x59f3e0ff, 0xdca3fb23, 0x4baaeaa3, 0xbae67e62,
+       0x961724b4, 0x52f8743f, 0x6e916ca8, 0xb8017c39, 0x5bf512ee, 0xfe380be5,
+       0x7842f0f4, 0x74c3e310, 0x15f10c14, 0xfd13b77f, 0x402c3a33, 0xca80c1f2,
+       0xd3a45976, 0x492e7da3, 0x323e70e7, 0xe0c7af9d, 0x30cad67b, 0xe83ed1e9,
+       0x17be2349, 0xb4767cdb, 0xc843a428, 0xf66e9355, 0x9cde3848, 0x26578b74,
+       0xa6fa26d2, 0x75fe446f, 0xd884e3a4, 0x6323a3bf, 0xa6f68aac, 0x4fbc6f29,
+       0x1cd9ad76, 0xcc2b8161, 0x71113dbd, 0x719e133c, 0x9f22bc52, 0xbdf235f6,
+       0x01c977f3, 0x73886bf6, 0x9e758fc8, 0x7186f64a, 0xd92e6b9e, 0x7fd256bc,
+       0xf5ed117a, 0x54f26260, 0x5dd0cff2, 0xd6b8ebc6, 0x6f91d626, 0xd8bb17f6,
+       0x9f0f859f, 0x6dfef7c0, 0xe9fc8010, 0xca1fdd35, 0x9a94f480, 0x907b32f2,
+       0xe4d2c3ce, 0xfc9f2a14, 0x9701725d, 0x897b92a7, 0x764d073f, 0xa77de695,
+       0x46ce2d5e, 0x72ded17d, 0xd61d0098, 0x0a1cb782, 0xa1ea2795, 0xe5f51b38,
+       0x971b7aad, 0x5c9deb27, 0x70f7aa9e, 0x49db1879, 0x76c75e9f, 0xb037b7d2,
+       0xd85dea9d, 0x1c31e54e, 0xdba2ca97, 0x96bc7893, 0xb42c92db, 0xd0c9838e,
+       0xfa4fcc6c, 0xb70c4e14, 0x3fe01782, 0xab6afb1e, 0x978c2aed, 0x34a17f56,
+       0xb3f4f90d, 0xac142aaf, 0xee3c5b1f, 0xbb60bfa1, 0x1fa667f9, 0x9bde90db,
+       0x8f5a394e, 0xaa9edd63, 0xfa41d8fc, 0x9d112c79, 0xb9b59923, 0xa63a434b,
+       0xcd1c6f93, 0x3660d76c, 0x7af4d3d6, 0xd95d7cc0, 0xa595807c, 0x42e0f93d,
+       0xaf597125, 0x577f21b3, 0xa3dffdda, 0xabb025ba, 0xaa2aeca2, 0x7b248863,
+       0xb641cc97, 0x7b92b1f7, 0x95bbc605, 0x127fff0e, 0xd17b0dbf, 0x91a43fa4,
+       0x49a9987f, 0xbcb372e0, 0xe1a49383, 0x95bf46e7, 0x49ff458e, 0x25debafa,
+       0x98cd7db3, 0xc741692f, 0xfa35fb48, 0x96ab38cd, 0x9e66fc91, 0x72a26f2f,
+       0xeb8b8559, 0x9ab355be, 0x1ccbfec8, 0x94bf7b97, 0x65d07fdf, 0x512dbd66,
+       0x389c5fb0, 0x8e9bf468, 0x7bb8464a, 0xf8312ba0, 0x69f5e92c, 0xd612637f,
+       0x8ab27917, 0x0337dd64, 0xb63b5dd7, 0xebe57b51, 0xde576cad, 0xf2e12f24,
+       0x6990a899, 0x21d0bed8, 0x2a64c379, 0x4a6a3ff3, 0xe4a776a3, 0xd42db625,
+       0xa6289da6, 0xbbd96cf6, 0xd5a7ea90, 0xa7510a32, 0x2ef38594, 0xb9c5bf60,
+       0xbe1b5e29, 0xd0fc2a77, 0x85dfd245, 0x04de49b9, 0xf04af3f2, 0x7baa1ae9,
+       0x9506dead, 0x6958f1d6, 0x4aa38d32, 0x5bd6135e, 0x1ffd286e, 0x2f894744,
+       0xda892405, 0xd7e10a5d, 0xc3f77f27, 0x6bf62732, 0xd9012719, 0xde70a9cf,
+       0x85fe889f, 0x026a899d, 0xb38b69f9, 0xb16bde8c, 0x5c4dce48, 0xff5295f7,
+       0x7d598e40, 0x7e3dc71e, 0x41e39d9b, 0x8c055be5, 0x36df8e83, 0xe542e386,
+       0xa84bf35b, 0x78126e3c, 0xcaadf2bd, 0x41376e0a, 0xe54a9c98, 0xf7e2dfed,
+       0xb0fe97b6, 0x1fe38dcc, 0xdf62ef1b, 0x562a7282, 0xf624fc22, 0xbfde8907,
+       0x77fb9abd, 0x9d0f9948, 0x0b17fec5, 0x38ac8a52, 0x213bb97f, 0x58c57faa,
+       0x497d5457, 0x2562a8f6, 0x16564fc2, 0x6fd54564, 0xb38a9628, 0xe6fbfa23,
+       0x57d54427, 0xb38ab994, 0x54dffa23, 0xbeaa2a39, 0xa8aca6f2, 0x1cd342fa,
+       0x61ea3fe1, 0xf3b0997e, 0x20d965f9, 0xa9fc898c, 0x037df453, 0x3b26efdb,
+       0xa9f812ef, 0x09f885c8, 0x55d652e5, 0xd8b971cc, 0x00affbae, 0x92667b74,
+       0x2ebf17ff, 0x83de8f1c, 0x4999fe20, 0x16fc4878, 0x201e2376, 0xdc60a47c,
+       0xcca7a08e, 0x2bc71d11, 0xff27cd40, 0x84b9d15b, 0x67b954f1, 0x319a1979,
+       0xbdfa31f2, 0x8161f90a, 0x2ee86243, 0xa5c732ea, 0xf46c62b7, 0xabae06fb,
+       0x316be9d0, 0x09529bf9, 0x6eb4058b, 0x7ac635c2, 0xb72e3a0c, 0x8ef90a9e,
+       0xdfff1432, 0xfd2c575c, 0x7f791b00, 0xa0d74b11, 0x8881c74b, 0x760718a7,
+       0xc43e32a6, 0x3e1e3b9f, 0x254f7030, 0xa45737fa, 0xee48737f, 0xf79785e5,
+       0x97b8c66f, 0xb8c67bc3, 0x2cd0fbc6, 0xfbc6fcf3, 0x2955cf43, 0xd89df3fe,
+       0x73ce293f, 0xf9ff14b7, 0x17fdd173, 0x03a36a28, 0x4828f8ed, 0xfbf100de,
+       0x2410aab8, 0x35ad3d2b, 0x43e8b951, 0x747842bf, 0x1340d9f1, 0x837af395,
+       0xfeb8adc7, 0x956572eb, 0x1e060df2, 0x8cd75d8a, 0x3a4fb154, 0xabb5497a,
+       0x5012ded8, 0x68bfb4ed, 0xd3b55879, 0x8345aa3e, 0x6a2fda0a, 0x691b4d13,
+       0x63e5a1bf, 0x549cf589, 0x52f3e7e1, 0xca318e05, 0x5e7f6567, 0xb6d5962a,
+       0x8b09479e, 0x60317cd4, 0x94703021, 0x48c15e70, 0x0954779c, 0xa3be683a,
+       0xbe1d070f, 0xa57e3f08, 0x29146f38, 0xa7e93a5b, 0x91fa45a4, 0x16825b52,
+       0x391637e9, 0xaff5515d, 0xc7d8aa9c, 0xbd45467b, 0x159a9d77, 0x6bf10fd5,
+       0x46a0e12e, 0xe42ae40b, 0x5e894d47, 0x7cb177c2, 0xfd7d17fc, 0xe093875e,
+       0xaadd9813, 0x97138fec, 0x7f82a5bc, 0xa457cfb1, 0x6fea7d8a, 0x6e583d68,
+       0x35f4154f, 0xe2013ec9, 0x3e933710, 0x4f71d6c4, 0xc3c68aba, 0x77a43d91,
+       0x22e9bb5e, 0x4ef86f42, 0x29d7d5ea, 0xe9decfa8, 0xc44eefa6, 0x8ba923fa,
+       0x699e7d44, 0xffac04cf, 0xd45cb534, 0x374d36af, 0x057e017b, 0xc32baf8b,
+       0xe7dbba7a, 0xfb79c54f, 0x12ad8ecd, 0x24c519e2, 0x787b9141, 0x0588fbff,
+       0x160a29e3, 0x21734c95, 0xd8ab76ad, 0xa024d72f, 0x25fea3ff, 0xaafc4a9a,
+       0xdce43049, 0x1d714193, 0x9134ceee, 0x6ff630bf, 0x87be0b76, 0xfcd8e7ef,
+       0xc25f42b5, 0xa5fa2ac9, 0xca2ff7fb, 0x9ed8bd24, 0xe7f5e4ea, 0x21e799ef,
+       0x7d74857f, 0x7ffdfa97, 0x3c536ba4, 0x62cc9aba, 0xfc96de9e, 0xf9bb8a52,
+       0xd21c51e3, 0xbb70bcb0, 0x4213cfcf, 0xcb8c2ba8, 0xf5848f35, 0x4bc59746,
+       0x90fb7d38, 0x6cacaf7c, 0xb213f3d4, 0x9c8de85d, 0x1bb8da62, 0xfaeb9fcb,
+       0x3bcd14f2, 0x1819e683, 0x01f51cb7, 0x56e3039c, 0xe93a8a14, 0x0d172c83,
+       0xf81ede10, 0xf7979256, 0x7e0763c7, 0xbfac03fb, 0x97be4777, 0x8907f470,
+       0x82ab3f82, 0xb07b1a13, 0xbc1acd3e, 0x3e748c2a, 0x967fe694, 0x6b36e0f4,
+       0x9beb1270, 0x8d126363, 0xfbc0692f, 0x877f6310, 0x32d538fb, 0x1fee2471,
+       0x88d82f39, 0x11ccb7cf, 0x45e6367c, 0xee28da9e, 0x3c5b37bc, 0xf9c0e837,
+       0x06ff885b, 0xc074433d, 0x03c72758, 0x45a47910, 0x61e443b2, 0xbce260ff,
+       0x1f192d49, 0x359cf7d6, 0xcfaebef1, 0xe68057d8, 0x9b933d58, 0x27399e78,
+       0x6c4cc936, 0xd4ccff00, 0xb6af4859, 0xfa7de7ad, 0x7de8ee8c, 0x7f4eacfa,
+       0x9bdf03a9, 0x7cfc7ef5, 0xdc7d3cc8, 0x299410d9, 0x89e9cf5e, 0xdf4f37ee,
+       0x1f3bcfa7, 0x54cdfcfd, 0x868dbe3d, 0x8e7991d1, 0x33ff7d3a, 0x0a427c78,
+       0x3af929e9, 0x516ef919, 0x3a9d9865, 0xeb5a37ec, 0xf90e5fb1, 0x85971b47,
+       0x11779da7, 0xa8f56dfd, 0x93f216d0, 0x7b0d2e1e, 0x770d3c2a, 0x7988d4c2,
+       0xf837bd74, 0xe0bef838, 0xdc9eb4e3, 0xbac7cf9f, 0x410cd3b9, 0x739d7875,
+       0x820d3e75, 0xd3a0f3e0, 0xd99e7cc2, 0x61e9cbf5, 0x98f5647c, 0x5f588d40,
+       0x6a089a82, 0xe7b53f84, 0x65d546a6, 0xce3a3e43, 0x9f8fae98, 0x351d1de4,
+       0x0c37818e, 0x5a9abdf9, 0x643849de, 0xe31d63ba, 0x13d9948e, 0x3e2dc6a2,
+       0x64272b1e, 0x2476e11c, 0xd7089ff2, 0x70a2569f, 0x80772cc6, 0x3fb30038,
+       0xc9706254, 0x68ec9976, 0xe7e8d9ee, 0xc8cbb4e6, 0x84fc72ed, 0xef9f3fa9,
+       0xe9f9fbfe, 0x99f9a2d2, 0xcfcd1156, 0x3f345f74, 0xf3455733, 0x9a3f946d,
+       0x4dd6632f, 0x6abf6a89, 0x7d545163, 0xa37383fc, 0x006167fa, 0xdc4fac8c,
+       0xffaa24ba, 0xa22beda4, 0xba9f93ea, 0x5e7faa2d, 0x7b544d70, 0x2baacefe,
+       0xa8617f92, 0xb11faa2e, 0xf20df4d7, 0x1fedbabf, 0xeff9e6a2, 0x34a2ff96,
+       0xcbaf2f3d, 0x438e997f, 0xc7fa1a5c, 0x4538e1a2, 0x93f215e9, 0xbe37f6ae,
+       0xa04bfca0, 0x53bce544, 0x1b780960, 0xd909edb1, 0x1b5f9127, 0xa136ac83,
+       0xc13268df, 0x8ff7f23a, 0x879c4c9a, 0x2abcec34, 0xaa8be04d, 0x9ff7e134,
+       0xf8a69b46, 0xeccff066, 0x78449ede, 0xa0993643, 0xe29ae29b, 0xc671bf65,
+       0x716be101, 0x7034793e, 0x7934ab5e, 0xa899b2f6, 0x329bf287, 0xd1e51fef,
+       0x7d71507e, 0x3f1fc78d, 0x8b9ff941, 0xfa4a9b0e, 0x03faa72a, 0x7d70b714,
+       0x2461e7a1, 0x3eaf795e, 0x49f6893c, 0x67957d46, 0xbfea66e3, 0x93858eea,
+       0xf43aff68, 0x498e8efc, 0x88721165, 0x388adf5c, 0x697be8f8, 0xc4673f22,
+       0x6aacdb87, 0x6bca0f63, 0x3ffc2c9a, 0xa5ef85c6, 0x903ffae1, 0x9c0b361e,
+       0xbad33015, 0xde724e31, 0xba8085df, 0xe194cb0e, 0x8d7ea478, 0x84c1f54a,
+       0x26f9dc68, 0x08fb4411, 0xffc72a5b, 0xbb7f0d5b, 0x36f98f2e, 0x3fee88e8,
+       0xc144f778, 0xd7236fcf, 0x2c67df90, 0xdd061d62, 0xfc3f75e7, 0x7b87eea9,
+       0xe446ffc9, 0x78edd79b, 0xf5f0893c, 0xa7815c99, 0xe8cfe78d, 0x4d267d72,
+       0x3bf5e9e0, 0x79919c13, 0x2b90eac7, 0x36db5eaa, 0x423679ca, 0xeb1bd70f,
+       0xad0a4bf0, 0x3f6e8363, 0xc93d9dd5, 0xf1e301b7, 0xdc70d3a7, 0xbf171d9a,
+       0x37de8fbd, 0x3888640d, 0x6ef9e01a, 0xd7180f79, 0x4415f2df, 0xd297d2e1,
+       0x25e57e44, 0x95cb0ba2, 0xdf513858, 0x776c6256, 0xfcc6f951, 0x7c3bb272,
+       0xbeb0961e, 0x84cc13ac, 0xb3fb96d3, 0x53f4c4cc, 0x2f677de0, 0x9a5f6d2e,
+       0x04dcf3ca, 0xc5c5333e, 0x9d5dbf77, 0xc686fd44, 0x4319c633, 0x2bd459b9,
+       0x419cc057, 0x246b9af9, 0x9f380dc6, 0xeefb9e8d, 0xe299b318, 0xbbdf31af,
+       0x0ef0bfe0, 0xf00ac5ea, 0xf8c6b8f2, 0x7e51a900, 0x90cb03f8, 0xbf24ed1c,
+       0x98532eba, 0x677539f2, 0xd1fe7cac, 0xebf030df, 0xdfce9007, 0x57b17d55,
+       0xbb7fba42, 0xfb57e07a, 0x4fadf9f0, 0xb5c5dfa1, 0x87fddb66, 0xc3ce22d3,
+       0x917ddcce, 0xc8f10ced, 0x33924ff3, 0x25eac97a, 0xeaa0f8fb, 0xbc489ca5,
+       0x616d227f, 0xb307bd27, 0x479ee2d3, 0xab2beec4, 0x6ed93f48, 0x8699c655,
+       0xeba7de5e, 0x930bdd65, 0xd25d79f9, 0xfd447ad0, 0x57f39979, 0xbcac0775,
+       0xd7477fbf, 0xbf17aa87, 0x9f991998, 0x54bd416b, 0x7274a873, 0x2a9ce749,
+       0xf1cf66f2, 0x6fd4a9c1, 0x21efeca3, 0xe978393d, 0xefaa64e3, 0x5e4bf379,
+       0x6574dc0f, 0xf323f7f4, 0x9b5cf922, 0xf92ef034, 0x567dea93, 0xa550f295,
+       0xdd8ef2fb, 0x4e9af58e, 0x9eb83bf4, 0x239eae0b, 0x6a7ed34f, 0x979404bf,
+       0xb02709aa, 0x9569af73, 0xaac79482, 0x65bddb6a, 0x9aabd60c, 0xba931797,
+       0x3f0b26d6, 0x0522d356, 0xa7f03c69, 0x748a7f31, 0x357d28db, 0xb00b1fef,
+       0x18a8efbd, 0x787d5cff, 0x4ff459ea, 0x9d9f2d7d, 0xb4363a23, 0x763f3959,
+       0x196c292e, 0xd85ef383, 0xea02852d, 0xb9f6ddb0, 0x5d6a3ec4, 0xcd0b31e8,
+       0xe5b9eebb, 0xfb0f04d9, 0x90b49df6, 0xfad75c7f, 0xbcfeb958, 0x20fb8458,
+       0x9dfac5db, 0xf322931d, 0xfc21f749, 0x81f8c883, 0xf70805f4, 0x09e39082,
+       0xdaab3e5d, 0xbb123627, 0x7dedafd0, 0xe6bf625a, 0x3bdf9374, 0xffdfebb8,
+       0xffdde695, 0xff98932f, 0x7fc657c5, 0x4f1805f0, 0xc0f3e8d4, 0xda1653f9,
+       0x9ab4d61f, 0x173bc5cf, 0x77dbbefa, 0xf0c67b95, 0x571636fe, 0x3880b16f,
+       0xc10099b7, 0x381e29e7, 0x91ab2c06, 0x07511f9e, 0x0e7147a4, 0xdd60d658,
+       0x71467646, 0xc608e3c2, 0xb9d717db, 0xf70f9e15, 0x9de31b08, 0xedead657,
+       0x858f6aa5, 0x9e3570f2, 0x75e90b5e, 0x7113f84d, 0x51f6df5e, 0xbf6716b9,
+       0x7e16ed5c, 0xc303d0d3, 0xa7d2ebde, 0x87985db0, 0xc6c860e2, 0x66b85f76,
+       0xdd53e280, 0xda0ed47e, 0x03fcb817, 0x6f607744, 0x2beb4a82, 0xccc9f7dd,
+       0xfe79889e, 0x5187dba4, 0xa3f979af, 0xe7e266a9, 0x2aa68f9e, 0xfbcfc349,
+       0xe2eb1c32, 0xddaa55e5, 0x4e6f4e22, 0xb68f9df6, 0x186f0483, 0xb769ade7,
+       0xda07f9f3, 0xe28e96c1, 0x75b83b48, 0xf3d20edd, 0x168bd976, 0xcb6d3501,
+       0x3fdc0dfd, 0x91e24bc9, 0x480616db, 0x8fa7650f, 0x8afe13f5, 0xcfd4cdf3,
+       0xae52267d, 0xe91b7fdb, 0x4f08e291, 0xd46bcc8a, 0xd17e7a98, 0xb75c9121,
+       0xaf9a266b, 0xc96fd808, 0xef0f5f0e, 0x54338a9f, 0x9e1ec7da, 0xa7c40e51,
+       0x38901e9f, 0xf54e6b5f, 0xf922cd6f, 0xbfb9951e, 0x010bf0e5, 0x9bee973a,
+       0x9f44c506, 0x4e9fdeb1, 0xe38c830b, 0x2f042e6c, 0xff79bb4d, 0xdfd21e2d,
+       0x611fa69f, 0x86f7617c, 0x234afc80, 0xe7ca06e2, 0x61420bd8, 0xd721271a,
+       0x3ce32c57, 0xf3276e79, 0x7bf562cb, 0x4d941f29, 0x4d875c75, 0xfa23adf1,
+       0xb144ee6c, 0x657b1e9f, 0xb23eba79, 0x1bce857f, 0xe92f9cfd, 0xed3d0b33,
+       0x5f180abb, 0x399d1df3, 0xbe09a4d4, 0x6b2e76c1, 0x46a63adb, 0xf044dbc6,
+       0xdf79e8db, 0x44bc5bfe, 0xd75139bf, 0xb6448cf7, 0xfff9d88b, 0xe499f499,
+       0x35b35a6e, 0x7c4cf88b, 0x7bf64753, 0xf067ef5a, 0x2e7f1403, 0xaa922bd9,
+       0x8d0fcbc5, 0x4e3c9777, 0xea9cdd72, 0xf01575cb, 0xc300acf1, 0x76b8c49e,
+       0x57fffd87, 0xe91fff64, 0xf8a2dcfc, 0x4ddfc46d, 0xf16cdd7a, 0x7fb64ea9,
+       0x0ff34a9f, 0xfc746fad, 0xf6e9b5f5, 0xff8265ba, 0x4fb7d71b, 0x15399f5f,
+       0x4bc68df5, 0x4e67ee06, 0xff48060e, 0x78a0929a, 0xec3e3e13, 0xdd90f72a,
+       0xc5f4396d, 0xa6f7b238, 0x2807af24, 0xd66075af, 0x2dfbb22a, 0xfd636fa3,
+       0xbc85f4ff, 0x9e623922, 0xad256913, 0x697ebfe4, 0xcfe2cbac, 0x42fc75a5,
+       0x5d6323d7, 0xabdf6ee9, 0x11bc88ee, 0x915f758c, 0x9fbe80fe, 0x17f1eaf3,
+       0xff9c73f7, 0x2f4487eb, 0xd6ee279d, 0x3e02b771, 0x783b1bd6, 0x1a55c655,
+       0x1f7ba31c, 0xd8261d8d, 0xe4a6cb46, 0x5d39c454, 0x36326cb2, 0xb70d9a7d,
+       0x4c6c74e6, 0xebba6fed, 0xbd213496, 0x0b2021fb, 0xaf9d167c, 0xa4d24d00,
+       0x6bc53cc8, 0x14f3f155, 0xc91bf8cf, 0x9e56ff2e, 0xb4d84e62, 0xf7f292da,
+       0xbace2be7, 0x9f3df7a3, 0x2a2655ba, 0x31f42b94, 0x8a0c4e14, 0xa74c17bc,
+       0xf133537d, 0x067bff12, 0x2df6cad7, 0x5cdae5f5, 0xfbee4f68, 0x8b1d6db7,
+       0xd62d9776, 0xfa46f54f, 0x3dc0a77b, 0xd78ff943, 0x46ee30a6, 0xfef3273f,
+       0x12d3a9df, 0xc462b723, 0x88f7c06b, 0x27f2a352, 0x265f23e1, 0x4aed7e93,
+       0xb922df55, 0x7cc9740c, 0xe941244f, 0xd8e2b8b1, 0x03c23ed9, 0xd38bf7e8,
+       0xd6c43ec5, 0x6d17ce26, 0x317ec6aa, 0x269ce9c1, 0x79c5d847, 0x579fc8b7,
+       0x9c60f91f, 0x05dc3105, 0x02e4f1d3, 0xdec37f1c, 0xc34a6496, 0xf6f33fad,
+       0x5392ba4c, 0xe91df8a2, 0xa54ffeb8, 0xc236391d, 0x53835ba9, 0xf0a13f89,
+       0x93f21484, 0x94040a85, 0xf1f138a2, 0x14de22a9, 0x87c53cd7, 0x3ed850ff,
+       0xe5e12d7d, 0x2f58b0da, 0xa6c661cd, 0x7ae036bc, 0x2a635b5f, 0x6ffb578d,
+       0xbf934607, 0xe05d297a, 0x4d2f179a, 0xa02bef11, 0x74acff50, 0x41e7ae97,
+       0x5f0be513, 0x7d8cf3d2, 0xcfdc4c97, 0x6db0bf98, 0x3d44eca1, 0x3f6f0828,
+       0x76cd79c4, 0x4df24aab, 0x3f040e78, 0x771813da, 0x0c5c1ed6, 0x5dfae714,
+       0x7db095e0, 0x6fc0e257, 0x0e061f49, 0x773a5558, 0x876e704d, 0x977f1c54,
+       0x0f2b4f7e, 0x31c5b215, 0x2f98dcfc, 0x94e7fda1, 0xe0bd2413, 0x6504dff3,
+       0x88e35c3b, 0xd31277e4, 0xd5eba25d, 0x89b0c4ae, 0x260645ce, 0xe9875ee1,
+       0x7813a61a, 0x3cce835e, 0x2cbbfbf6, 0xe07ee703, 0xa49cba66, 0xe8207907,
+       0x2ac9f684, 0xa704d1f9, 0x7048ebc6, 0x3480deaa, 0xa9daae92, 0x6ed0fc08,
+       0x35e7251e, 0x6baed877, 0x36eb8713, 0x135d85b4, 0xff8f3f40, 0x8f3a36d5,
+       0x8393aa1f, 0xfefc3d99, 0x6c2fe92d, 0xf9cb1a6b, 0xa28c80bd, 0x949963b6,
+       0x7954eb4a, 0xb545e87d, 0x07c122f4, 0xb767afba, 0xfea1f689, 0xaa0ee7a8,
+       0xaf3f443b, 0x925f69d5, 0x8742f6c5, 0xf07843d7, 0xee7c297e, 0xded7b45a,
+       0x05297cc7, 0xd35eaeb8, 0xb19a07a1, 0x87569fdf, 0xe93ee872, 0x1aff5673,
+       0x3e57cfd2, 0x2148f35c, 0x665ddbf9, 0x9df9256f, 0x18cfc09e, 0x5668bf87,
+       0x1dd845b7, 0xe0c81d8c, 0xf33180fb, 0xf4d99ed4, 0xfdd7c233, 0xce9525fb,
+       0x03cdfbbd, 0x9aee88e3, 0xe85a3ff6, 0xfeed64be, 0x4b4f188f, 0x9a1afe19,
+       0x035b766f, 0x039b6bdf, 0x1b5ef9db, 0x9fbe43fa, 0x7f08f218, 0xe73a7832,
+       0x390886d9, 0xec2e913c, 0xe3fc060d, 0xebb55e29, 0xf6907af6, 0xedee58dd,
+       0x8d2275b8, 0x07cf57bf, 0xc035ef18, 0xf7c431a1, 0x971af04d, 0xa0fef3c6,
+       0x967a4152, 0x4eedaeff, 0xa3ffa22d, 0x3dbf02e9, 0x66702e9a, 0x89bf8676,
+       0xf1df5de8, 0xd69925b1, 0x8e343679, 0x4521b9f6, 0xf1c6714d, 0x1bf64323,
+       0xcab54f63, 0xd7fa8580, 0x2bf6079e, 0x14a6ef28, 0xef4bdf94, 0x8d594db6,
+       0x4ca2f7cf, 0xe2ae2852, 0xefe294fe, 0x0c6fb35e, 0xe7786ff5, 0xc7e4a9f3,
+       0xe74f481e, 0x607e7ff5, 0x1be278fd, 0x22497fea, 0x606ed9d9, 0x69d866bf,
+       0xbe29d901, 0x5ffa405f, 0xf63cf54c, 0xdd2cbbcb, 0xf72ed84b, 0x12ec809a,
+       0x01ed9ff5, 0xf849dff5, 0xf689c0ae, 0x664fefc0, 0x6dd5df3b, 0xa32718d2,
+       0xf5c49f5f, 0xbea91b92, 0xc9ccbbab, 0x05f74e76, 0xc35ec88a, 0x109c7887,
+       0x9d1224c0, 0xfca8be04, 0xe9993b88, 0xe7e5fc36, 0x86e3d06e, 0x75c5e29a,
+       0xca3965d8, 0xa4e2223e, 0xf4711ba8, 0x9edb33c9, 0xee817b40, 0x0fdc28d4,
+       0xffbf0bef, 0xd5563d5d, 0x59773ebd, 0xeeb3ae33, 0x07edcc84, 0x585e7df5,
+       0x7a4393d7, 0x86e2867e, 0xefdc5d3a, 0xb033e7a5, 0x675df74e, 0x094b1b6a,
+       0xd8aecd63, 0xb9ca987e, 0x412950be, 0xbaabf9c8, 0x99859b0f, 0xb5fe93e7,
+       0x9f2eba1e, 0x9ff5cdee, 0x920242b1, 0xc0e5fad8, 0xb5c45f6f, 0xf910703d,
+       0xe14e271f, 0x10ff5872, 0xcf018d6f, 0xc97ef6c8, 0x4bbd23f0, 0x5afb1f48,
+       0x123ae1e5, 0x4d8a8352, 0x3fd277f5, 0xbac016dd, 0x9f7b433f, 0x99c7e254,
+       0x3f49f7fe, 0x997e4ffb, 0xf7b96641, 0xb7c7d8b4, 0xd27cb45a, 0xb809d69f,
+       0xa7a38db5, 0x3c8ba5af, 0xe215b14f, 0xa57e4b9e, 0x009cc1c7, 0xfef1223c,
+       0x5106765c, 0x655a17ee, 0xe7f882cd, 0xce56043c, 0xe7a37f23, 0xfd01ef6f,
+       0x941fe1a7, 0xf57abdcf, 0x182bc21e, 0x627deeb7, 0x89bfb9c4, 0xbb6d69f4,
+       0x6b84ff04, 0xfc4cf75f, 0x5e46097b, 0x1db6beeb, 0x3ca0c647, 0xee8b9eab,
+       0x9ee861b7, 0xbdf7887b, 0xefa39a1b, 0xae957c1b, 0x308996e3, 0xea0b7091,
+       0xb307fb13, 0xd4569d02, 0xfd3257df, 0x7e5e109f, 0x84f824c9, 0xf2ed957e,
+       0x671eb713, 0x1a3f844a, 0x8f7c00b8, 0xe8676f28, 0x99d7dd30, 0xa5e59cdb,
+       0xa22ae639, 0x165b6e7d, 0x825019c7, 0x9837dd32, 0x19cbf9ad, 0xd3b4075f,
+       0x9d642f74, 0x89c127ee, 0xa3bf287f, 0x8e9d6baf, 0x460beee7, 0x82073dd3,
+       0xdacf348d, 0xd1fee29d, 0xbff19dfa, 0xc7d5a813, 0xc9d4f0d9, 0xac0e9423,
+       0xabf7450e, 0xdb53f9d5, 0x05bcfd16, 0x9f181278, 0xfccf7d11, 0xfc43ef4a,
+       0xc5f02cc9, 0x4638fadb, 0xc219b5fb, 0x7920d67f, 0x410ddf24, 0xb37a4839,
+       0x0b240a4e, 0xd58e0b7c, 0x865df748, 0x65f7e8be, 0x73f9d6ef, 0xbc2fae97,
+       0xfabf7c2e, 0xe7482919, 0x24ff7780, 0x427bfe9a, 0x1f49cbab, 0x5d6af562,
+       0x6df199b3, 0x10b46c15, 0xabd58dbe, 0xd97d21aa, 0x1638a16e, 0x7e354fab,
+       0x0b7432e9, 0x4b7ffe5c, 0x98737af7, 0xffeb4cf3, 0x3ca5e4a7, 0xdfadbdd4,
+       0x745e50b1, 0xf9087da4, 0xa27a1956, 0x5defebaf, 0x7c86edcf, 0x9614c0a7,
+       0x15da456f, 0xf1a283ee, 0x50cb6ef4, 0x7cf3929e, 0x38139d83, 0x51e86e3f,
+       0x3ae538ec, 0x14fc5f2e, 0xada17970, 0xa2f84ed4, 0x2bc9b8ff, 0x4c7f9ca9,
+       0x4c3e442e, 0xe103203f, 0x89f6fe8d, 0xfe90078f, 0x37c513a2, 0xfa7cbe52,
+       0xd83f8c09, 0xf8b3a7be, 0x115fe457, 0x7d91a4e1, 0x4ecaec2f, 0xc783bdfb,
+       0x7fddf8e1, 0x4af1e8bc, 0xcbc7c3f2, 0x095c698a, 0x787ee9db, 0x1a871e91,
+       0x7bd9178e, 0xfdd1e222, 0xbedf2219, 0x47fbf3c5, 0x78b05f69, 0xf94bd9b7,
+       0xff66c58e, 0xafa404a6, 0xdbc905e8, 0xe91db380, 0x8d24f43e, 0x52a4f68b,
+       0xeef166be, 0xf6a21def, 0xd3125dda, 0x28bedfdf, 0xc7c5177f, 0xb8a5eca0,
+       0x577edfd7, 0x7384bdc1, 0x7053dc0e, 0x477cc457, 0x595f8552, 0xe399957c,
+       0xfb68ef71, 0xcf292b2f, 0xff60eda9, 0x1eeafbd0, 0xb0577f0b, 0xae0f024b,
+       0xf0e788f3, 0xbd0f89af, 0x085a4efb, 0x9eb697e4, 0xf1c4f4b4, 0x017946cf,
+       0xce6171b7, 0xf0b76ebf, 0x7fbdca3d, 0x6b7ad0b0, 0xf388fb9e, 0x126d5569,
+       0x67aaa7fb, 0x794aa0e4, 0x58af039e, 0x9a6b3f48, 0x8accc825, 0x3b73376c,
+       0xffaa51f9, 0x65f859b1, 0xe8d7ef43, 0xbde86e7a, 0x746b0761, 0xd6d775ff,
+       0x17bf3d68, 0xf1a32db4, 0x579a7bfd, 0x7ba03df3, 0x5ff7c7b6, 0x4b5c1f86,
+       0x2b8c52fb, 0xee8a9f6b, 0x7e90df77, 0xc7bfd807, 0x3257c9fa, 0x3cd8f3f4,
+       0x1efd23c8, 0xaf19af0c, 0x7e7d3da0, 0xc43c6ab2, 0xd71e3bc9, 0x8f1180f1,
+       0x8e26c307, 0xfafdb167, 0x285a2eda, 0xfe76d68e, 0x796bf199, 0x872c67fb,
+       0xbe0ef6ca, 0xf83d7aaf, 0xaf1f1037, 0x093bb76f, 0x08f65747, 0x6ed25fbb,
+       0x6a25060d, 0x7c91350f, 0xef8a0ffb, 0x4aaf023b, 0xf740a38c, 0x7e756b7f,
+       0xb7f9d5ae, 0x6367f716, 0xbe8adee8, 0x772fbeff, 0xe2ba11c7, 0xdf3fa351,
+       0x993875d0, 0x8404b8f8, 0x12125a7f, 0x8790c9fe, 0xc6465f11, 0x936f81d1,
+       0x5bb7d73c, 0x52f8bef9, 0x6d2d3fdd, 0xc593df16, 0x51fe8bfa, 0xddff9176,
+       0x8d8de82b, 0xd1ad35a7, 0xd232bbfd, 0xea0fdfd9, 0xc313f878, 0xa8f2e8df,
+       0xe53b001c, 0xb2a897e7, 0x756fc837, 0xe77f342b, 0x63cf8954, 0x2989d53b,
+       0x194beef1, 0xce3a9be5, 0x28cbea37, 0x43fd864f, 0xc88eedce, 0x998dfc7d,
+       0xcd54af02, 0xcf240391, 0xb2cf7d88, 0xfbb8aca2, 0xba44c81e, 0xd77b18df,
+       0xee45a64f, 0x391db47b, 0xf23f67a4, 0xf7495e3c, 0x859b6a8c, 0x8d9be87f,
+       0x8e10a6e3, 0xb5c5c607, 0xed20d6cd, 0x4f516a4f, 0xd2307bf8, 0x76bfb20f,
+       0x07e91169, 0x991c1bee, 0x3a72cf48, 0x2ff5c4aa, 0x8e38c36f, 0xfb2f2fc3,
+       0x2baaf58c, 0xf91bac5b, 0x1f6f1996, 0x6a1fec61, 0x6a9c092e, 0x7a51af3c,
+       0xd3511f78, 0xb749ee2e, 0x5c62fa1e, 0x7fdbd216, 0xadc63fe0, 0xa64172c6,
+       0x25adbf88, 0xbee98fa1, 0x6cbbe7cf, 0x90e8f171, 0xd89a97bf, 0x3dcc6a0e,
+       0xf6578c19, 0x859c2e23, 0x4fedf37e, 0x7ad1df79, 0xca4ee128, 0xf1adf5c7,
+       0x837e778f, 0x13601a9c, 0xd04ddae3, 0x9ee125c4, 0xd6b81c48, 0xdd0fee29,
+       0xaa49c7ab, 0x7d7a8c3f, 0x505df62f, 0x03eecf14, 0x2349e65b, 0x1bf0dded,
+       0xafbebad5, 0x85b1d82f, 0xf163e08e, 0x476eb551, 0x2e39fc88, 0x1ba2e2c6,
+       0xb4f5a333, 0xc644ede1, 0xb25dfdb9, 0xc8c47293, 0x268c5fd7, 0x7ef887dc,
+       0xeb3c9c42, 0xf65ebaa7, 0x0dbee7ea, 0x9be665b3, 0x0d288e69, 0x63fc851c,
+       0xe93fe97d, 0xcb1c5208, 0x04caf83f, 0x9dfaff92, 0x2445e7d1, 0xdfdf3f3f,
+       0xaafcb20a, 0x433e7643, 0x3a5fda32, 0xd214caf8, 0xbfb786b3, 0xf97211cc,
+       0xbee2c722, 0x29467d3c, 0x6bff6249, 0x77fec492, 0x4c93d2af, 0xfddaaefb,
+       0xfef22fb2, 0xbbe721bc, 0x4501fd75, 0x65d7f3ec, 0x686f5caa, 0x3a617a17,
+       0x7f9c4a20, 0x98f3c8a5, 0xed11fe79, 0xdf2fa825, 0xe880b710, 0x9ad7d942,
+       0x6aef5807, 0x9e989a4f, 0x198393da, 0x05ef11d9, 0xf24cdc68, 0x801b0d7b,
+       0xc81d88fd, 0xefa52ebf, 0xf4beb10f, 0x59c604fd, 0x523c2647, 0x64adce29,
+       0xc0f5bf20, 0x239355db, 0x3d05fffd, 0xc1f103ee, 0x09e72843, 0x87cebf31,
+       0xcf42b04d, 0xae3d0813, 0xee2c71d2, 0x8ec89aaf, 0x5757f763, 0x0e1b938a,
+       0xc7f28158, 0xf9581fb5, 0x07e7d03e, 0x1dfef2d6, 0x9327f92e, 0xffbf019f,
+       0x381f2a6a, 0x3d3276b8, 0x7de0fcff, 0x53de7357, 0xaf9514da, 0x1e7d1008,
+       0x797f51c2, 0x97c276f7, 0x90e30a5d, 0xefd3aea2, 0x9eeaf9d2, 0x9b7f3356,
+       0xc677bd59, 0xc22481e3, 0xe94b454f, 0x9d3d9dbb, 0xe21feb0a, 0xd947032a,
+       0x289d4719, 0xe3851c66, 0x165c82f8, 0x71a4ab1f, 0x5314944f, 0xc9db0937,
+       0x1c274d9f, 0x55c618e5, 0x9cff3d06, 0xdfd9f829, 0x13f9c091, 0x3d082609,
+       0xba28ec83, 0xcebeb437, 0x9b436438, 0x86bdf51c, 0x4ceedef1, 0xd7b0ae71,
+       0xa490b3d0, 0x16ed1eb1, 0x3db686e5, 0xf58eb419, 0x49eb10e6, 0xb459b343,
+       0xd02512ef, 0xfe0ccdf9, 0xfc4038d8, 0x508f4639, 0xc12c4b2e, 0x77db84b1,
+       0xea079d0f, 0xe28239f7, 0xe7635d5e, 0x686efe44, 0x3b8f73b0, 0x4e39fc5e,
+       0xda4833e7, 0xcfb12cd1, 0xf3af6d89, 0xd1c67c88, 0x1e2fc233, 0x1c9fe85d,
+       0xa0063fcf, 0x25fbec44, 0xe6ad7e5d, 0x86e7788a, 0xdf223d1b, 0xe06c73b4,
+       0xef71e928, 0x373e04ee, 0xfc8975ec, 0x974b696c, 0xac9fdf42, 0x5066956f,
+       0xfb9f5a3c, 0x829f7f1e, 0x83f662f5, 0x6e7cfde1, 0xbbbcdd5a, 0xc7438b5c,
+       0x1f111eb5, 0x01dfe897, 0xbd57d08f, 0xd37814fd, 0x23da7df5, 0xaa735e74,
+       0xdf14ecd2, 0x4aef8999, 0xf9fdd06f, 0x199bd78d, 0xd5029d37, 0xc43fce2c,
+       0xdd32c539, 0xfba0df2f, 0x3bdf11f9, 0xe99b033f, 0x7bf6229c, 0xdfafc367,
+       0x02bf8fac, 0xf6371e34, 0x759bf5bb, 0x2fb3783c, 0x4ca5f9fa, 0x40e6071d,
+       0x10f3f90e, 0x1fbe17c6, 0x71c09791, 0xa4e1697a, 0xbe8338b8, 0xeff55703,
+       0xe434a9c0, 0x1ef790de, 0x1da3bfc7, 0xdfcd7e67, 0x80499c13, 0xc5ce7109,
+       0xe19fe386, 0xf2126e3f, 0xaa2dcfd6, 0x4346829d, 0x077017ee, 0x331f9916,
+       0xe7463ee4, 0x3df1ffff, 0x22505ca0, 0xcacf25f3, 0x3a1e31fe, 0x32f5b09f,
+       0x7015c6fe, 0x8d75c41c, 0xce35d7d3, 0x2edf111a, 0x571d5a8c, 0x97d7877f,
+       0xc471101a, 0x9e4765cd, 0x75627195, 0xfbefe248, 0x5f62c3aa, 0xf6265d5b,
+       0x02ad39b5, 0x49bcaea7, 0xbb126a0a, 0x9f44d3c3, 0x6ccb3fa1, 0x7a180f02,
+       0x5d2fc432, 0xf09da87f, 0x3e3a0dc1, 0xc9a3d588, 0xf94e5dd0, 0xc9345be6,
+       0x472af74b, 0x6abf3f7c, 0xeee4ebda, 0xa83fa72f, 0x22effc6f, 0xf7d1eac4,
+       0x0f12fe3d, 0x07bad3e5, 0xb8e21657, 0x38fef347, 0xe6a6f48e, 0x2df37632,
+       0x3b13888f, 0x7ca3811d, 0x3f45a4df, 0x6bc96fef, 0x747e21eb, 0x5ec7e302,
+       0x3a96f757, 0xbcf9ab81, 0xc09c3abf, 0xb75643df, 0xb0bbf9db, 0xc486d6ea,
+       0xdb7fe429, 0xeb1daf65, 0xcb27ad95, 0xc5959f88, 0xad4a3ee2, 0xb38bdc5d,
+       0x10b7fdb9, 0x3b7bd77d, 0x2df9cfa2, 0xfba8bf3d, 0xf58f3d06, 0xa3091b6b,
+       0xf9f7ffa5, 0x5f3a8d9b, 0x662ebaea, 0xfea9c14c, 0x26afe690, 0xfd7fec7d,
+       0xd71d0b45, 0xa5794ed5, 0x6d88ae9c, 0xefdca8f4, 0x268ee6fa, 0xf41af34a,
+       0xf93a6477, 0x707351f9, 0x82d2e32c, 0xd30fbb2b, 0xa98dffb0, 0x3afaa714,
+       0x225aa6ba, 0x0eb7bbf4, 0xf91c73fd, 0xb7498035, 0x494b855b, 0x25e3a15a,
+       0x07b5c761, 0x3e50670e, 0xb7ec97a2, 0x9277ca80, 0xdeacb1b3, 0x12792a7d,
+       0xa2bd96e1, 0xed19c21c, 0xa503f732, 0xa4e6e727, 0x3336fa48, 0x6242177d,
+       0x9c9e801c, 0xdb230b1b, 0xdb5fff1b, 0x27a4d3ff, 0x289eb6d5, 0x84f837fb,
+       0x3efe7cbb, 0xcad07037, 0xbce808f7, 0xc72115c6, 0x347f7457, 0x644b370b,
+       0x7ce873a7, 0x3b41227a, 0xbaa0ee05, 0x95256102, 0xb2c38bce, 0x96377fb8,
+       0x7d4cf7fd, 0xb84a59fe, 0xcee9ee83, 0xe737cfd1, 0x5bf73742, 0x6a5c0300,
+       0x8befe4e0, 0xe5cbc04b, 0x29785b6c, 0x5082f1c1, 0x099fbf88, 0x73ae2867,
+       0xe63bfd36, 0xe61ef238, 0x0ce7029b, 0x0e74c87e, 0xc51bee26, 0xd75ba7ae,
+       0xf09a59c7, 0xe81d043b, 0x086cee7e, 0x35fbb9f1, 0xbf9fa3d0, 0x3cc75fc7,
+       0xb9d1f7dc, 0x3b6835db, 0x208fcc89, 0xeb4f9ff7, 0xa7ade391, 0x198b2967,
+       0x9f449cca, 0x7d30ce14, 0x75f2bf6d, 0x4d6dd3f4, 0x35df57ca, 0xe283f7d0,
+       0x6f4b73e1, 0xd3ef1bfb, 0xd349627d, 0x97b1bef8, 0x7da6c7be, 0x1de9584e,
+       0x001363f2, 0xe6b3ddfe, 0xc66f6437, 0x07e01af7, 0xfb11e7be, 0xf72d06bd,
+       0x3df0c67c, 0xedfee335, 0x950ae0ce, 0x72ac6fee, 0xaddff8db, 0x9b8db229,
+       0x87ca794e, 0x21bffcd2, 0x6a40fabd, 0x2883c49e, 0x638c19c1, 0x83b2bd75,
+       0x2fd69b36, 0x22f7c669, 0xf432fac0, 0x006401ef, 0xb763b77f, 0x1e69ef8a,
+       0xa5b43d41, 0x74abf6b2, 0x2e1e1a0f, 0x6f2f0955, 0xf4bcd971, 0xe895ae5d,
+       0xdbd30fb5, 0x2ff71368, 0xb16bfb8c, 0x19b46c7c, 0x8daf4a79, 0x77cc7671,
+       0xfcda773e, 0xbfe89bff, 0x9324a93f, 0xcbfe6070, 0x3f7c3df3, 0x7758c129,
+       0xc3eb8d89, 0x37191af7, 0x6a7dd136, 0x1d31aba4, 0xe1e21ef8, 0xba149ca4,
+       0x25d8d51f, 0xa63753ee, 0x9b7fd807, 0xf3fb12fd, 0x4ed2cec6, 0x0e83078a,
+       0x6eabdf0b, 0xaa34f974, 0x4421d207, 0x3ef89ffe, 0x69bbe0df, 0xfd21ef98,
+       0xed91505e, 0xde5157d7, 0x4a1b9a7f, 0x6169bde9, 0xc0f1126d, 0xe5061ef8,
+       0x4e9519e0, 0x7befa3cf, 0xfbe4e281, 0x501c8617, 0x9d995831, 0xb90d7cba,
+       0xf8ef8d38, 0x3bea2535, 0x8f5e437e, 0x98b90a24, 0x44cc26e9, 0x71a5577e,
+       0xf061e563, 0x8f00bffd, 0x30b1ae40, 0x0030b1ae
 };
 
 static const u32 xsem_int_table_data_e1[] = {
-       0x00088b1f, 0x00000000, 0x94f3ff00, 0x51f86066, 0x257bc08f, 0x799c1819,
-       0x8968c550, 0x1819390b, 0x0bf1030e, 0xda005620, 0xc0c5caeb, 0xfdc406e0,
-       0x88013c40, 0x3eb100bf, 0x01830337, 0xd902a710, 0x736e6852, 0x17ba0264,
-       0xd8815d88, 0x32bf881d, 0x637c3030, 0x767ede20, 0x623da021, 0x2039fe08,
-       0xfd04b2fb, 0xf0d83ffc, 0xdafa655d, 0xc0c2a817, 0x2a83a310, 0x8fc68b16,
-       0x466fc1d3, 0x027c9a3c, 0x8f113f1a, 0x5473717e, 0x2a019d7e, 0x8188c93f,
-       0x9a920f61, 0x6efc037a, 0x81afc741, 0x3100df7a, 0x74769a00, 0x0003685d,
-       0x00000000
+       0x00088b1f, 0x00000000, 0x243bff00, 0xa3f0c0c3, 0x4aef811e, 0xf1303031,
+       0x12d18aa2, 0x6064e3ef, 0x6062e010, 0xfbe20530, 0x330c0c3c, 0x204cf480,
+       0x6066e516, 0x1ae20310, 0xc40dde20, 0x19f8807b, 0x1039fc50, 0x1be200ef,
+       0xbefd103c, 0xfe0c0c4c, 0xc4081c40, 0x95fc40c1, 0x1be18181, 0x73f6f103,
+       0x4c30330a, 0x2ff04715, 0x249fd903, 0xc1ffe7e9, 0xe90c4386, 0xa071df6b,
+       0x10acf37d, 0x7b20467c, 0x9aaa15be, 0xcdf85605, 0xbf268858, 0x18bf8d08,
+       0x0372fe8f, 0x4d5afe54, 0x81b5b334, 0xcd4909e9, 0x6efc4d3a, 0x40aac741,
+       0x3101a9ff, 0x5ff1ad00, 0x000368ca, 0x00000000
 };
 
 static const u32 xsem_pram_data_e1[] = {
-       0x00088b1f, 0x00000000, 0x7de5ff00, 0x45547809, 0xbedd70b6, 0x4e9def4b,
-       0x62585908, 0x81511007, 0x05e42ce9, 0x62d9b1c4, 0x970621f4, 0x66854611,
-       0x44749ecb, 0xf9d1c1c6, 0x153610d3, 0xc713309d, 0x60ec44e0, 0x81a0d050,
-       0x60241009, 0x3cc0ea03, 0x64ffe31d, 0xb83066dc, 0xc5a4c6b0, 0xfcb8df0d,
-       0x4dd54e75, 0x11d37bdf, 0x7fef999c, 0xca3fbff3, 0xfb5ba957, 0x539cead9,
-       0x2c922aa7, 0x4222e910, 0xab9f83be, 0x409bf908, 0x4d171908, 0x69e5a909,
-       0x24e05295, 0xbfa2e024, 0xe1521366, 0xd3cb4254, 0x43b29909, 0x48955f0e,
-       0xc8428df3, 0x7da6f34c, 0x6eef2c56, 0x53b0f960, 0xfe5a11f1, 0xd3cd1371,
-       0x8ee6033e, 0xe5a0ae87, 0xd9221d91, 0xb28edd08, 0x21124899, 0xfd842dc7,
-       0x0e7cd364, 0x96568521, 0x3fdc68ad, 0xb717da07, 0xf6958999, 0x68bbb157,
-       0x5f3415c6, 0x50264874, 0x32d362a5, 0x97cd1065, 0xc8168484, 0xf3664cf7,
-       0x4314ee0b, 0x1efd689b, 0xcdd24757, 0x574e420e, 0x2147885b, 0x91d9c6a4,
-       0x4268d374, 0xf2db434a, 0xb3695da0, 0x581135e0, 0x5397a6c7, 0x045b5d61,
-       0x4843d9af, 0xf13b66d9, 0xf873628c, 0xde3bfe8e, 0xa2af862a, 0x3ae98be5,
-       0x88b7ed09, 0x1111e6d4, 0x78a75fc6, 0x9df8519c, 0x38e376ae, 0x0b62be6a,
-       0xabb6871d, 0xc2f0567c, 0xc44d2b12, 0xefc742df, 0xf59d6dde, 0xb7d60384,
-       0x84e9194c, 0xa056ad75, 0xde68515e, 0xe607ab4e, 0xd1e4a8d7, 0x4686d2f2,
-       0xb47470a5, 0x03cdb2bf, 0x1faaf3f4, 0x94d7ec9e, 0xd5d3d31b, 0x46467884,
-       0xf884a5f3, 0x44bf685a, 0xc733290a, 0x407fbf44, 0x081909e2, 0x63c48bfd,
-       0x214ff689, 0x4783df89, 0x5e14afe8, 0x844ebdc1, 0xc5b78aab, 0x27bbfa6e,
-       0x6eb3b78a, 0x9229478e, 0x4d5feda3, 0xd03c021f, 0x9c02d4f9, 0xcf96ba68,
-       0x4c9135cf, 0x2eff6892, 0xe903711f, 0x351eb7f5, 0x3cc995ad, 0x185ac742,
-       0xc693e31c, 0xee42bcd3, 0x7e425e20, 0x37c722bd, 0x241fe695, 0x6f3039fe,
-       0x062fe4d1, 0x92d2113c, 0x4abbf402, 0xfd60b320, 0xd349813f, 0x94a955f2,
-       0x6bdc293e, 0x213ce5a7, 0x89ee7c0a, 0xf27c2f90, 0xa7ec74fe, 0x6851fb08,
-       0xdfcfc33f, 0x572f3b8f, 0xaf3b8fd7, 0x0aa7ed58, 0x585db1fb, 0x1379b53f,
-       0x2bc9f3f4, 0x1bb9fb55, 0xd85d71fb, 0x4f57dcba, 0xeae7cfd4, 0x7e27ec72,
-       0x69f897aa, 0x07a5517d, 0x6913e1d2, 0x3e39a3b9, 0xa5a27ef3, 0x812bc98b,
-       0x4b949dff, 0x971174b4, 0x61d1d36b, 0x97412fbc, 0x8fb93da7, 0x30f3ce5f,
-       0x7c82cb88, 0x50520ca9, 0x641a4c2e, 0x35dcf9c1, 0xe17281c8, 0x4bfe09ae,
-       0x301e74dc, 0x79a54936, 0x7723ffc5, 0xf3a6ba0c, 0xa40a4814, 0xc6a4131e,
-       0x8332d5f2, 0x5fc1e4c3, 0xdb463c8f, 0x91914c07, 0x4ebf34f1, 0xac38f498,
-       0x21311363, 0xa9226c7c, 0x33367a82, 0x3ab4f941, 0xa089e73d, 0x866b4e06,
-       0xd10bfc52, 0xfec8d77e, 0x2dafa014, 0xd020e6e4, 0x94a1aadb, 0xf21107c9,
-       0x70a6f074, 0x87eda250, 0x3c00a616, 0x6fe50acd, 0x1d0af8ed, 0xff8e347f,
-       0x03bf8c1c, 0x77d71fc6, 0x5cb0f37c, 0xb496f8dd, 0x16f8dd62, 0xe94f8e85,
-       0x9db9377d, 0x37e14f8f, 0x83e79081, 0xe6f8e1b7, 0x7f1c62b4, 0x758a42b5,
-       0xc77adbe3, 0xfdd6017f, 0x1feb7f52, 0xfebf4136, 0xfafd52b4, 0xc3feb615,
-       0xdf1f1164, 0x63ffeb86, 0x7f5b2170, 0xbf5b295a, 0x3bdbf599, 0xfe17abbe,
-       0x8fbac1af, 0xe1feb7f4, 0xbfebf513, 0x7ebf5ca8, 0x6dff1b33, 0x77c7c152,
-       0x04eff8e0, 0x2ffad9cb, 0x15f1c72a, 0x740bdfb3, 0x55b60ca4, 0x64f8e885,
-       0x64886508, 0x4c3e5194, 0x42102547, 0x6191d7db, 0x6cbb8708, 0xb0beee8c,
-       0x44737a51, 0x51091de5, 0xacf2a28e, 0x597cd392, 0xe40524f3, 0xb953962c,
-       0x754f88b7, 0x74889b61, 0xa1ccea4d, 0xbb7ce98b, 0xe420c4db, 0x195dd617,
-       0x23bf7112, 0x9da00b73, 0xfdf0c244, 0x6cc787a3, 0x98cbaed4, 0x8f95aa2e,
-       0x88f8ea77, 0x993827cd, 0xf3a2aa8c, 0x3044069b, 0x4e3f9a2e, 0xf2a128e5,
-       0x472a7df3, 0xd3213d21, 0x0ff7e8f1, 0x8a259ca9, 0xb1966f96, 0xde483c7d,
-       0x72049518, 0x971cfd82, 0x2f8fbc18, 0xff004211, 0xa1ddd62f, 0x545a7c80,
-       0x8f40a76b, 0xf1c023ce, 0x0e6dd914, 0x9e10146d, 0x2dcf801e, 0xfc848ac8,
-       0x9535a295, 0x7ea8b682, 0x6dddae80, 0x8532b424, 0x76b05fd6, 0x5d3750de,
-       0xccb3adff, 0x1fec2299, 0x84d837c4, 0x9b064c7c, 0xd5990972, 0x4c1e4eba,
-       0x92ccb733, 0xb4d4efdf, 0xe7d7ed9f, 0xe7d62d6f, 0x6c90e5bb, 0x44a37d02,
-       0xdfb48d20, 0xe5f4abdb, 0x42f138ea, 0x1f2bc302, 0x6c4927ef, 0x9a43b7be,
-       0x88dd9f09, 0xd66e39d7, 0xe04f9d56, 0x7184991e, 0x481cecbf, 0xb103ff10,
-       0xd6cddf9e, 0x1cef9c6d, 0xa02be2d9, 0xb77399f3, 0xce34f088, 0xdd9f73bf,
-       0xd34b1a67, 0x20654ffa, 0x8c7ae341, 0xd4bb9ff3, 0xea371eb8, 0xc682f361,
-       0x8c4e8cef, 0x9b6814f4, 0x4d43e034, 0x6b968abd, 0xa1a87c06, 0x33cdb2af,
-       0xd092f975, 0xa2fd5d6c, 0xf2ba79fa, 0xba25b545, 0xee6b05f2, 0x05e7e5d0,
-       0x9fd5d6ef, 0xae9974bb, 0xfbaaf6fc, 0x16b7e574, 0x67e5d3af, 0xeaebd7fb,
-       0x51ab32df, 0x2bec2e57, 0xe513a8b9, 0x54a2ffaa, 0x36df2bd0, 0x9547a013,
-       0x387e55de, 0xe9829d59, 0xa60f6ae9, 0x294f80cb, 0xb3769bff, 0xde71b034,
-       0x2aefc045, 0x55c84e9c, 0x464fc069, 0xd3c237ba, 0x67f4df48, 0x487dac70,
-       0x5205cb4d, 0x87ae7200, 0xf7eacfef, 0x120e5c73, 0x72d31cb2, 0xf96df185,
-       0xc4c9d4f6, 0xc8f0f905, 0xfdff472a, 0xd7011692, 0x1e8b4041, 0xd4a37808,
-       0x70ebc3aa, 0xf6bb3cdd, 0x257e388b, 0x0078eef0, 0x0132c155, 0x307c21f8,
-       0x3031c6ed, 0xcc72df1f, 0xfdc40db7, 0x7f3aabb7, 0xc01287c0, 0x93d300af,
-       0x3d30b3d5, 0xf4c7ed5e, 0x4c62eac3, 0xc2aeafdf, 0x297ab3b4, 0x83ab47a6,
-       0x7aa5fe98, 0x54efa60d, 0x56fa62d7, 0x7fa63d75, 0xda610eae, 0x54c3ed5d,
-       0x395edba5, 0x4af5c899, 0x1dd3ffae, 0xf967f302, 0x7bfa445a, 0x37a3f207,
-       0xacf1f805, 0xa0918be3, 0xcb7d9f37, 0xef2f404c, 0x7a465e0f, 0xc4ae17e8,
-       0x61457a87, 0xac870a88, 0x1b56e5be, 0x44d593c3, 0x1b9509f2, 0xa4fc5df7,
-       0xcc68fe77, 0xda01244b, 0x9d33bc87, 0x411dfa31, 0xc3e75f10, 0xc645f113,
-       0x71f140de, 0xe5bfd1fc, 0xf8e7bf40, 0x283b653e, 0xc2497ee2, 0x5f01784f,
-       0xfee1b81a, 0xe5c1d913, 0xf7e079f2, 0x7e1540f1, 0xa684691d, 0xd2370413,
-       0x3356d9df, 0xed8e0091, 0xfda110f6, 0x84f43d9c, 0xc5bbf60b, 0x87f72629,
-       0xa6a0e031, 0x6ee92d15, 0x689f7687, 0xd6cfe7d3, 0x282df90a, 0x37713d37,
-       0x72ba018d, 0x011c3fbb, 0x54c14ff8, 0x8a7167ed, 0x0070fee2, 0x45f18fc2,
-       0x29d23c73, 0xdeb0dbb5, 0xfd1e7b3f, 0x479d13f5, 0xb680f92b, 0xf8645b47,
-       0x3e91edf9, 0x533e96f8, 0xed4f000a, 0x9fb017f2, 0xefbfe8db, 0x12bf4186,
-       0x037ed5e6, 0xfcd0622d, 0xacdef823, 0xf3b68f1b, 0xb43136a8, 0x255e9feb,
-       0x27a55c72, 0x0bfeda2a, 0xce3b403a, 0xfdcbd6ea, 0xd03e5d78, 0xedd6ea96,
-       0xe50bf003, 0x482c527b, 0x9ce52f40, 0xc7247a7a, 0xefce811a, 0xf461e088,
-       0x157ab026, 0xefc54e96, 0x00ec3241, 0xae7e603d, 0x5b9e6f4a, 0xf972a5de,
-       0xe4c87fd4, 0x9aff287e, 0xda272ace, 0xc4c0951f, 0x780bf344, 0xd96b7e6e,
-       0xa7779074, 0x5e1f6c4c, 0x605c0a48, 0xda931494, 0x3e43d01c, 0xa07ca626,
-       0xffc98ffb, 0xec696576, 0x05261181, 0x8d60b3e7, 0xfaa41f7e, 0x545f2e93,
-       0x9217cfaf, 0xce80921b, 0x1264eb0b, 0xf51f8012, 0xc62689e5, 0x6aa4450f,
-       0x2b0fec15, 0xdf313db8, 0x74c1a44d, 0x1ebb157e, 0xe74799cb, 0xc989b971,
-       0x2ebed56f, 0x2ff36049, 0x7c54696d, 0xd683fcb4, 0x415c9fac, 0x15687da0,
-       0x3b8219f8, 0x4f26ef04, 0xd0fdfc5f, 0xabe71bf9, 0xec7d1fee, 0x8a8f3e7c,
-       0x142f82cd, 0x6f191f63, 0x13fef812, 0x035e3844, 0x99e8d6eb, 0xa8387337,
-       0xf28679f9, 0xeffe430a, 0xa244b7a6, 0x8223b7a3, 0x40d366ff, 0x5fa05f46,
-       0xf1445209, 0xa7fd23ff, 0x9e7fe9f4, 0xb13fdc69, 0xffb421ff, 0x15ff5d1c,
-       0x47fed4ff, 0xddff99f4, 0xd8affab1, 0x906775b5, 0xe7d29bca, 0xba11761e,
-       0x6a929cff, 0xff14bc93, 0xba569be5, 0x4a4e0e80, 0xf3d01741, 0x1f9890a9,
-       0x3f57618a, 0x3e0f4bd7, 0x0f760087, 0x3ffb4afc, 0x3303f4fd, 0x62f97f60,
-       0x7b46ec93, 0x6c39b366, 0xd95afca6, 0x8c9d325a, 0x9631fcc5, 0x0889fd5f,
-       0x7d3d36f9, 0x70f53e96, 0x28c7f812, 0x3f7d70a5, 0x6552fa8c, 0xb07947d3,
-       0x044804ff, 0x0ed8ccf9, 0x80973fc6, 0x129e71f2, 0xce9cb7d7, 0x00f0f513,
-       0xf5a04b87, 0xf0444f81, 0xe64e924d, 0x2fd434a7, 0xc84f7ae6, 0x4e3c4ce4,
-       0x6ff23c55, 0x5e40dfe4, 0x2120f0aa, 0xbb88f7a6, 0x760b1b1e, 0x7fd3576b,
-       0x9c0d04b8, 0xdb3b3e54, 0xe7f1e0b2, 0xe3cbfd3d, 0x45876e6e, 0x9db085db,
-       0x6beb8da7, 0x972d2ced, 0x63f02ec3, 0xdeca3796, 0xbe5cfd20, 0x1f2789f5,
-       0x6df23b05, 0xda62f7b3, 0x97d6d97f, 0xe6813cfe, 0x89c9b6cb, 0x1c32d9d3,
-       0x2f145242, 0x696ffa01, 0xa50f1466, 0xf1497fbf, 0xefdf618c, 0xa3e2884d,
-       0x857edb6c, 0x8f0be98c, 0x95fb2d29, 0xbc0c474e, 0x03cb1cb4, 0xf5dc4abd,
-       0x3f78028d, 0xc9204fb5, 0xd9e031e9, 0x07ea12f8, 0x23c42700, 0xde2f53c7,
-       0x1403f50c, 0x55cf202f, 0x97cb193c, 0xfd037973, 0x3d234679, 0xf83cfb3f,
-       0x7b31df7d, 0xcfc5fd61, 0x7582e9de, 0x18aa909c, 0x32b63f5d, 0x2dc747c9,
-       0x6e498396, 0xe2f7d94c, 0x7a433f0d, 0x67fd7a2b, 0xf35ecc49, 0x6f709aa5,
-       0xfac2a60a, 0x8cdc3516, 0x7e242beb, 0xc7e2bba4, 0x8f9002c4, 0x7f244b9f,
-       0xb8be0c5b, 0x717c6458, 0xb4552362, 0xd04efae8, 0xa0fd076d, 0x6d0c5bff,
-       0x1dc57f42, 0x67fff804, 0x2c9affaa, 0x16e7fcc6, 0x4dafa786, 0xb54f9eaa,
-       0x36bd2d3c, 0xfc00eead, 0x4bea1e9c, 0x80573f06, 0x0f0e4148, 0xafda3be1,
-       0x64b4faf8, 0x91e21f86, 0xaa3b7872, 0xef814c07, 0xf643bf50, 0xdaeac759,
-       0xa3d2ef91, 0xe3e12fe3, 0x60db79d3, 0x44913eff, 0xac625b8a, 0xf2a8a66f,
-       0x35c7dd3d, 0x6fe1a5f4, 0xf74defc6, 0xf956fe31, 0x1f33343d, 0x837b3fca,
-       0x83b40ff1, 0x2bce91fd, 0xfbe58c9c, 0x1e50126f, 0x16384998, 0x9cc9375f,
-       0x2ae5f5af, 0x4b79d09d, 0x5e869c42, 0x8404ffa0, 0x0ab7fa3f, 0x8d3b68eb,
-       0x78c00cbc, 0xa9fdbeae, 0xf9c45b7c, 0xf9ea23df, 0xbe30349f, 0x0abf5fef,
-       0x2e573ee2, 0x147c9e87, 0x67f295f8, 0x2afc03d0, 0xcfbac017, 0xf3fc1f34,
-       0x9c9f294f, 0x54f95169, 0x7c8d3f2f, 0x5c7dbc5a, 0xb33d3e4c, 0x9f362336,
-       0xf931efd2, 0xd3e32d74, 0x53f25bff, 0xc03e5f85, 0xfc28f2ef, 0x1fd87954,
-       0xf0f28d1c, 0xe1079323, 0xf4879469, 0xd3920de7, 0xba54fe97, 0xf4ade953,
-       0x408b8a99, 0xa5d2f4ee, 0x74bd774a, 0x1f5dd2a9, 0x7e0e88ff, 0xa004f2c6,
-       0x05274a05, 0x0de48fbb, 0x6f2cf8a6, 0xb440e767, 0xa790cbdd, 0x36e1f270,
-       0x1e5f6a46, 0x87cda89c, 0x4316f90c, 0x5f219f7d, 0x37efa860, 0xf50cabe4,
-       0xd03fcc43, 0x48215076, 0x7d5d6107, 0x3a093979, 0x57b72fc1, 0x87affb44,
-       0x6d1579ce, 0x1e9cd3df, 0xb079520a, 0xeaeccad2, 0x156540c8, 0x771eafc8,
-       0x790095c4, 0x7b6bd32b, 0x78ae220a, 0xac787e8d, 0xdbf9445d, 0x5af92219,
-       0x1f94457f, 0x9d7f106a, 0xe672bfa4, 0x3a269c67, 0x3d8296d2, 0xc17a2b59,
-       0xecb85d44, 0x3cb81716, 0x5f87da7a, 0x5f7e8b3f, 0xe3c45874, 0x6b9b1e8b,
-       0x048bcc2c, 0xc6aa527d, 0x8249382e, 0x7e089dbf, 0x1f6676c3, 0xd06b5c2c,
-       0xa45ac82b, 0x12c7428b, 0xd522e405, 0xfbd7dfe7, 0x977d194d, 0x1b8afef2,
-       0x7b6ae5f4, 0x3b023938, 0x5f49b4ad, 0xce76e7ee, 0x67bd2a93, 0x17940c90,
-       0x7d80c060, 0x34ebe5cd, 0xb3f5f471, 0x0e7bfc28, 0xe5e80489, 0xf088bb6c,
-       0xceccdb3f, 0x20704909, 0x89254df2, 0xe1535ca0, 0xa17c05d4, 0xba772ff4,
-       0xe735fc76, 0x7ca55a1e, 0x7f63bbe7, 0x9daed347, 0x03dc8f6f, 0xa66f5df9,
-       0xd6fa4bbd, 0x8acfb29f, 0x7d9ed9fe, 0xe94f3c4e, 0xda6afbd9, 0x6ddf903d,
-       0x7b3cc2f6, 0x16397df6, 0xb967a7e8, 0x56e418b9, 0x7f8a50cf, 0xfdecd69a,
-       0xee276c72, 0x6f102b93, 0xd30a8baf, 0x76ffda73, 0x94844854, 0xfff60aae,
-       0x33f4767d, 0xa2b79e04, 0xef67a07f, 0xc77e3997, 0x953d6f3f, 0xc7a4dcfc,
-       0x876d6649, 0x7f33c5f9, 0xf8cf6073, 0xb9c19627, 0x657eeb6f, 0xf29f2d01,
-       0x416337c2, 0x676cf61e, 0xdcb74d7a, 0x05ce01b9, 0xeef352fe, 0xb9c29932,
-       0x1062981b, 0x862bb995, 0x623a0e4c, 0xf41be5c1, 0x3c285c7b, 0x067ffd3e,
-       0xf79e021e, 0x433bb795, 0xfdd60116, 0x4177d1d5, 0x2333ec0e, 0x3debaa5d,
-       0xf50cb2d3, 0x3badf38e, 0xf5f66241, 0x0b759cff, 0x77590be1, 0x8daff486,
-       0x07a25def, 0x83e462f1, 0xf7be74be, 0x756fcc2e, 0x17be717a, 0xff33ef48,
-       0x83ffd7c5, 0xe29dbef1, 0x75fe75dd, 0xaf8bfd57, 0x1fbc7fbb, 0xeef1c39e,
-       0xc0f57386, 0xfce0df0b, 0xab9ca87e, 0xf7e717fd, 0xeaafd6fe, 0x79307fe7,
-       0xf5a0c8de, 0x03ad49f3, 0x2a6b8b14, 0xa0ce1c0e, 0x72187fa5, 0x3be61e30,
-       0x18c39f99, 0x125fb7e7, 0xc164fdb0, 0x891d7684, 0xc75db817, 0x5cc1a1ec,
-       0xa4bc187f, 0xc190f510, 0x7a641e43, 0x83a9e483, 0xa43fbe73, 0xcc62f02d,
-       0xcb7cc902, 0x95f7790f, 0x0bb7af3c, 0x1f10277f, 0x4e0e411c, 0xa043f7fb,
-       0x22190e9f, 0x534afea2, 0x745f5bd4, 0xe5efb3e5, 0xb97ece8a, 0x67b7a3c6,
-       0x76f512f2, 0xdfde54cf, 0x3fe6c234, 0x428421cd, 0x87930e14, 0xfc1126fe,
-       0x962f939c, 0x79f34089, 0xec02bfc4, 0x7d0ea984, 0x19c18f7f, 0x580fc68c,
-       0x16bb6964, 0xaf16dffc, 0xd25dfd80, 0x62794265, 0x0e9016c9, 0x984bd546,
-       0x1ee4dd7f, 0x719e7007, 0x7733aec5, 0xfa97f013, 0x528f1614, 0x5fdefcc0,
-       0x44ddf77f, 0xf0e2e388, 0xaeffa22b, 0x036eff03, 0x7ae8db09, 0x18244917,
-       0x4efe0097, 0xf3afbc81, 0xf0f3ea77, 0x68a4e3f3, 0xdfabe73f, 0xb3fe1d1f,
-       0xee945dd3, 0xdbb0a7df, 0x1c08e90d, 0x53dad25e, 0xe0ced6ff, 0x84857815,
-       0x6ef3b186, 0x2e7340b1, 0xeccca974, 0xd97f5dee, 0xccf6059e, 0x71d19ea4,
-       0xa0471f8c, 0xfae0197e, 0x89e259e5, 0x1f803af3, 0x79e1c787, 0x19d121d7,
-       0x0b6bde2b, 0x819eb3b7, 0xf69a5073, 0x115a9134, 0x41127df4, 0xc9b05dff,
-       0x88c53642, 0x4d94483b, 0xe39c5cfc, 0x3988fe8d, 0xe36787e0, 0xe34da22f,
-       0x9aeb78b4, 0xdb1a4a7e, 0xf3f00f17, 0xe21ce6be, 0xd82f851f, 0x2ddf0075,
-       0x82bcced6, 0x923b7c18, 0x81c66fc3, 0xbe9ed0af, 0x04d1bdac, 0x93597e7c,
-       0x969e7749, 0x3dfd7326, 0xbcc26493, 0x3ab01c66, 0x872f01b3, 0xd9c42f44,
-       0x513fda05, 0x83ce31fc, 0xfe84f08c, 0x9b7a8fc1, 0xed7846ec, 0x00165b91,
-       0x6c7cf75c, 0xed676021, 0x62cb6a56, 0x0a4ff3cd, 0xd222e79b, 0xf4d8e772,
-       0x4ef83d7f, 0x278471ea, 0x44d2bd83, 0xd2fbaf90, 0x3e3a411f, 0x408499bb,
-       0x037d831e, 0x336ce172, 0x8280fdc1, 0xd3b041e4, 0xa55fbf28, 0x692fdfb5,
-       0xec0cf6db, 0x82ed9523, 0x95cb5c1b, 0xfe02a752, 0xbc5b40b9, 0xc33b7208,
-       0xba21c6a3, 0xe1a4dcc7, 0x0964db8b, 0xc2707be1, 0xdc615b9e, 0x0214bb4f,
-       0xc5ef9afb, 0xfee40b88, 0xc859eda7, 0xebadfd07, 0xdae4d5f7, 0xc3f412a9,
-       0x1e919ae4, 0x74db3746, 0xff442bf9, 0x19afe020, 0xde25cee6, 0x96fbf818,
-       0xcb05d9d3, 0x67ffd0b7, 0x550dedf2, 0x02c5f9be, 0x2cbd1f0d, 0x23557db3,
-       0xc96392df, 0x2782c5b7, 0x78bee019, 0xc064f0ef, 0xf2c3e2eb, 0x6df258c0,
-       0xdf3b356b, 0x8fc78e7a, 0xf952b4f6, 0x7c8d23f6, 0x2df2a56b, 0x8b7ff9c6,
-       0xcf5ffaac, 0xff42df23, 0x15b7fc3d, 0xf58c5be4, 0x53f0e41e, 0xf6d8dbe5,
-       0xc6df2863, 0x71749ab6, 0xdccbcf96, 0x7cafd99f, 0x04de0613, 0xd921d4fa,
-       0x3f418f6b, 0xf6feb95b, 0x819f8f1c, 0x7dce4071, 0xdce503f5, 0xe72a173b,
-       0xace09bfe, 0x3bc5b9ca, 0xf69fc608, 0xe72643a5, 0x72a6ef16, 0x647a004e,
-       0x5ef16e72, 0x0638fcc2, 0x8faa36f9, 0xbf58237c, 0x07dacc32, 0xb91fd2da,
-       0xe997f68d, 0x5a16bd93, 0xef2a333f, 0xdde569c6, 0xbbc9fd57, 0xef261743,
-       0x47797076, 0x9030d8e5, 0xf0fa46af, 0x74e3ebb6, 0xd13f8cf7, 0x97e07bfc,
-       0x673c4557, 0xcec4dd7a, 0xfe34fe05, 0x57d03644, 0x33e6c281, 0xd7f46142,
-       0xfec41d5d, 0xd6c8bca7, 0xf160e157, 0x4cad95bb, 0x166cac3f, 0x6bfa1e42,
-       0xf0af84de, 0xaf64a8bc, 0x7e699240, 0x27d599a6, 0x24e7a94f, 0x86867a64,
-       0x96e6161e, 0xa1777fa1, 0xbfe02c44, 0x9de4732d, 0x2cb63d02, 0xcb7bf997,
-       0xc392f7f8, 0xdfc0ab9d, 0xc05eb259, 0xee353273, 0xecbf8d50, 0xbede5e73,
-       0xc681fd0c, 0x3c19f373, 0x33c6664e, 0xc631a842, 0x66d97fb9, 0xa71a7e7d,
-       0x276299e7, 0x26bc8bc2, 0xe0c5377a, 0x2f5eb51f, 0x38710e9c, 0x9fb88935,
-       0xc289c2f6, 0x17de93cd, 0xd3d3144e, 0x70a29233, 0xae957929, 0xf5ffbb37,
-       0xae3370aa, 0x9677f55b, 0x83fa7ef1, 0x3ee70a83, 0x2770e7eb, 0xd2728424,
-       0x95ab8f08, 0x16683f5e, 0xba50a7c4, 0xfc133941, 0x0d7188a3, 0xd62e9305,
-       0x8eb843dd, 0xed564fd3, 0x8c7029a4, 0x7de2133d, 0xfeaddce1, 0x6e21978e,
-       0x9e5bdc6f, 0xaf4ed84c, 0xc3f66098, 0x6b16dbf9, 0x4aa0e504, 0x87408d87,
-       0xf0f7ae14, 0xaa0cf67e, 0x61768c9a, 0x3d06e09b, 0x22b61024, 0xae14035c,
-       0x20242f70, 0x2806fc31, 0x1dff023d, 0x8305ff5c, 0x03c15ee3, 0x753c80fe,
-       0xd0bc02bf, 0x0ced59fa, 0x8090812f, 0x1126c978, 0xd657bbf4, 0xc030de0b,
-       0xe111adaf, 0xfa67caa7, 0x49e2d0e3, 0x2c52bf43, 0x9a4ac5fa, 0xd78cb2fd,
-       0xfdae619b, 0x8cf3d033, 0x88d264a7, 0x7dffa6e0, 0x279f3d1f, 0xa788c3fe,
-       0xb6bc39c7, 0x001d3c02, 0xbbd308b7, 0x3de15fc2, 0x203cb515, 0x9cf07505,
-       0xefb9e8f2, 0x1538d785, 0x20c7405e, 0x89e7dadf, 0x136c2f90, 0xbef480c8,
-       0x307385eb, 0xec97bf2d, 0x7ffac63d, 0x1892f04c, 0xba60beeb, 0x8b9e87ee,
-       0x7f82dd29, 0x36ba3fbd, 0xe151a9c2, 0xe7a726fb, 0xaf23593f, 0xef3d0164,
-       0x49cf9015, 0x3ceebc7b, 0xf4c2bf6b, 0x4a562d88, 0x91dd74f7, 0xa377b2c3,
-       0xd83cafa7, 0xf60be1ce, 0xd01ef683, 0x8810b0a5, 0xc16cdc0f, 0xc79c2f38,
-       0x6a9fa630, 0x2b56f3e5, 0x76537819, 0x7987fdff, 0x47e9fdff, 0x8c0c7e6a,
-       0x6dcd7107, 0xd151bc74, 0x83fb8cf1, 0x6f9ff76a, 0x3972af5d, 0x4baef7f7,
-       0xc687e71d, 0x074804c1, 0x878d55e2, 0xc7f82239, 0xe5cfa0c8, 0xae3e920b,
-       0xd6e5c22c, 0x1fffdc3f, 0x927fafbf, 0x4e7bc6e2, 0xefd5ba77, 0x02cfa46e,
-       0x41e7e137, 0x7d84df13, 0x3b1f53ff, 0x9136caf7, 0xff611323, 0xa0132c98,
-       0x915f4fab, 0xe9f96fd1, 0x79671654, 0x2507abfd, 0xcf5cdd70, 0xf5c8a162,
-       0xb3b404e3, 0xc7ae875e, 0x216e1e83, 0xbf0891be, 0x954fb82c, 0xc53b54d1,
-       0x733af943, 0x5206a873, 0xe24894ef, 0x936f009f, 0xeb780244, 0xe2980df0,
-       0x3f3bf9a0, 0x32e01922, 0xb601faa3, 0x06443ccf, 0xbe09bd42, 0x8cc66881,
-       0x8decfd6f, 0xc63ce91b, 0x3d7a22bf, 0x83ccdeb4, 0xfaa1070e, 0x1306a8f4,
-       0x35e06bf1, 0xc06a8481, 0x43fe346f, 0xef308ddf, 0x40efaa62, 0x7b717efc,
-       0xf20b8d63, 0x0fb6020d, 0x2e79fd04, 0xf5ad9eba, 0x0e5de49f, 0x83d68172,
-       0xac0d026e, 0xf049a05e, 0x616a4842, 0xe5053afb, 0x17809346, 0x0486b6bd,
-       0x86fd6162, 0xaddfb42c, 0x367db40d, 0x3db45fec, 0xc9f4dbf4, 0xdc82371b,
-       0xf6c4f3a1, 0xb63ceccd, 0x00f3b690, 0x81dd34bf, 0x083495fd, 0x1419ee04,
-       0xa97db337, 0x0bd915f8, 0xd7fbade5, 0x9d3b7ee3, 0x0e9a978e, 0x2a7850fb,
-       0x12c8d7de, 0x6d8f78dc, 0x5fc450fa, 0x23f8610f, 0x1c984389, 0xdb9e7813,
-       0xf7deaa3d, 0xe430f32b, 0x32ef4283, 0xe7ed0065, 0xd303b94f, 0x9f57484d,
-       0x7da7a028, 0xa7ede148, 0xc79d7ef0, 0xfdcc1c29, 0xecd4e940, 0xe1e6cd8b,
-       0xdb617ed8, 0x5a7f8c24, 0xfcf00a44, 0xa678c67e, 0xa576be6f, 0xbafe0435,
-       0x10c8e4d7, 0x4af07ef8, 0xdeef7e33, 0xf770e4ca, 0xcff44ed0, 0x0990689e,
-       0x69a82fdc, 0x9c5e5110, 0xbcf19668, 0x464c7c5a, 0x95b45db9, 0x1b071fe9,
-       0x4027bf58, 0x393f036f, 0xd17cd394, 0xfbdb8116, 0xf6ab4e4c, 0x9d9ba167,
-       0xb772abbb, 0xcfbbaf82, 0x4cb7543e, 0xca359201, 0x8f2e0adb, 0x02a4a94b,
-       0xddca3342, 0x7577380a, 0xe31a5f01, 0x3b511c83, 0xfc20e806, 0xe575d215,
-       0x3b01322b, 0x2ba0f846, 0x6a7de60f, 0xee7e80af, 0x0f82edf1, 0xdf8bbdce,
-       0xff508732, 0xfb9bcd0e, 0xde5fd80b, 0x55081336, 0xa0780e3d, 0x1cd72a72,
-       0xe86fcbf9, 0x5baf53f7, 0xd2841220, 0xbb843ccd, 0xbd99df1a, 0x6471c589,
-       0x04975ebf, 0xd4c92cf7, 0x8a072801, 0xd7e245ea, 0x825389c8, 0xb29fc6ef,
-       0x8dadc1fd, 0x6a56cce3, 0x3d7f610b, 0xd1f2666a, 0xd88649b3, 0xccd2b208,
-       0x0fb534e4, 0x64b2fe30, 0x4524baf7, 0x7b250743, 0xf48925d7, 0x071e2afb,
-       0x2bfb0351, 0xb0a2576d, 0x09f64a71, 0x38cd46ee, 0xbf6a3f6a, 0x6ed66eca,
-       0xf6965ef8, 0xcc097fd7, 0xb9f9d70f, 0xd8c2f202, 0xfbf19f4f, 0x3ff727e9,
-       0x7409d5cf, 0x89afb95e, 0xfb9ca418, 0xdae1f4c1, 0x55350073, 0xde7215e3,
-       0x069f1130, 0xb17fb97e, 0xdf069f11, 0xdf28e3ad, 0xd75dfc53, 0x02ac8426,
-       0x15298fe4, 0x037798d9, 0xff72579f, 0x7654e573, 0xf19ad3be, 0xfbe00afa,
-       0xd202d9e9, 0x95fa0903, 0xafa88901, 0xb8ce2079, 0x2fb59b28, 0x1f81eda2,
-       0xfe33d75b, 0x03c272a4, 0x61b2a472, 0x6fd61e5d, 0x7fd03c12, 0xd43ce36b,
-       0x45738a47, 0xc74de582, 0x6e2a3f50, 0x7c08963b, 0x0eb6f94c, 0x89ca81f4,
-       0x71c83766, 0xfe551f95, 0x05c78d7e, 0x0c7b8b13, 0x0067e3c4, 0xcbec0df3,
-       0x4c2be2d7, 0x199a07ae, 0x1972063f, 0x55b6bebf, 0x085e1586, 0x9f3f237f,
-       0x55f8ccd8, 0x3ce6ec7c, 0xb45ca7b8, 0x1ca7c589, 0x80a2986c, 0x24227d3e,
-       0x97d37ee0, 0x6ade99bf, 0x811aefe4, 0x543f7bed, 0x5bf954bf, 0x73fa63e5,
-       0x4e578c1d, 0xb5ee14f9, 0x867af919, 0x3be7f2dc, 0x7faf7ce9, 0xce87ae96,
-       0xef8fca77, 0xe46a7576, 0x4127cd24, 0x716250be, 0xa95caa3c, 0xd7bc5890,
-       0x619f9e0f, 0x7acd1bfc, 0x734ac8ff, 0x6e6b8b3c, 0xcfee9192, 0xf87d9fc7,
-       0xf3f902ec, 0x7ceaf942, 0x2f8ea9fc, 0xb3f7d5ee, 0xb19bd392, 0xd70a6ebf,
-       0x1feb8530, 0xb8c09f9a, 0x3e9f8fb1, 0x53f00336, 0x39d287b6, 0x93b357d0,
-       0x49ce4184, 0x4aafdc21, 0xc61f455b, 0x9ce14abf, 0x3e5a9d1b, 0x653e7166,
-       0x9e9139cf, 0x439bb74a, 0xd2fb69d3, 0xc58c1f9d, 0x11e58bb8, 0x3e0a438c,
-       0x60e5f5cd, 0x83e058e7, 0x1bc58952, 0x00c2e519, 0xe8673b0b, 0x059f6dda,
-       0xb33613eb, 0x2da5fd7b, 0xcd66c8b7, 0x22cd84b9, 0x1cf0f5ab, 0x18e94830,
-       0xfcc255ee, 0xd5c9f7b4, 0x2daea338, 0xb6944e4c, 0x960768c9, 0x0dd6de6e,
-       0x6fa5a371, 0x15dfd199, 0xc609fcd8, 0x6e794fc1, 0x0253fa2b, 0xfceea26d,
-       0xdebc4fac, 0x866c3166, 0x0ad6b378, 0xf9a3ef3c, 0x896f9863, 0xbe7ab71d,
-       0xe7b2b2b8, 0x520ceef6, 0xfefd9610, 0x97c81729, 0x5c9b1dd3, 0xf9b7b718,
-       0xfb65e3fb, 0xdcb5e7c4, 0x79f1bdf7, 0xca17e1a7, 0x862d1338, 0x03cdc6f8,
-       0xf3a48f50, 0x718829cb, 0x97abd1ce, 0x037cfd6f, 0x6d778fc4, 0xe601b33f,
-       0xa7edfe5b, 0x887e201b, 0x7ee2b3ec, 0x08fa7817, 0xedaadfc6, 0x7ee1627e,
-       0x614f2d8f, 0xdbf772dc, 0xd6f42f66, 0x1a44f7bd, 0x6f758fc4, 0xfc092afb,
-       0x4ef64b96, 0x92eebf43, 0x4992531d, 0x4d42fd8c, 0x17436e81, 0xc46d3710,
-       0x83d6c1d7, 0x31f4e718, 0xbfc837c5, 0x96cb78de, 0xeabf160a, 0xcd9671e1,
-       0xfbd3e3b1, 0xdeb655c4, 0x2095fd78, 0xfe995bf7, 0xcaf8de78, 0x7f1e2837,
-       0x6bf80174, 0xb102fd56, 0xfc31f7f1, 0x76e21e32, 0xbcfbf8f5, 0x8fe3d175,
-       0x80eb5942, 0xc32be37e, 0x35370017, 0xc5927dfe, 0xbe016d57, 0xc60cfed9,
-       0xa6de02b3, 0xf9ff607b, 0x0dee0d3c, 0x7323949c, 0x5ed93ef0, 0x09e21bb3,
-       0x89bef74b, 0xe3bdd3fc, 0x1343f475, 0x4dde871e, 0xdc587f7a, 0xd9d7c0b0,
-       0x997164e4, 0xb710fe1c, 0x77e171e9, 0xe8c99f1e, 0xecdb8d58, 0xa7735e2f,
-       0x6ad9e985, 0xd3457e5c, 0x31fe3cbb, 0x17212f8a, 0x7bec74f0, 0x70a811ef,
-       0x1c397370, 0x1d8e3f8d, 0xa71bdb17, 0xf805f1ce, 0x37a87d83, 0x87e698be,
-       0xe8dfa264, 0x1e43124d, 0xb8b23774, 0x7f596ee5, 0x1f8a33df, 0xcdbc8f16,
-       0x0ba1a7c8, 0xdf3e438b, 0x7c287ffc, 0x33f28236, 0xba9c2fb0, 0xc72d8ebe,
-       0xff7ce0df, 0x5967df77, 0xb3ef1828, 0x63d027fc, 0x0531eb45, 0x3b5ee0ec,
-       0x8bb7af9b, 0x9ebbd5fb, 0x759e3116, 0x9441cb55, 0x517946e3, 0xc458ef09,
-       0x0b71ef98, 0xd8dbc3d7, 0xddb5d13e, 0x7ed07219, 0x46ec0eba, 0x3e6cae7a,
-       0xe09c40a6, 0xaf7f9bcb, 0xc629f3b0, 0x844fb03f, 0x7aeff334, 0x1658ff76,
-       0xf8fccd6f, 0xe33e71c6, 0x63da04e3, 0xfe68138f, 0x594e3744, 0x3b7145b0,
-       0x69de3fce, 0xf40b77c9, 0xe983ba77, 0xc45ba783, 0xb9f758fc, 0x66fbe4de,
-       0x743d7bef, 0x4177c4bf, 0x101dec9c, 0xfd4365d1, 0xf7338972, 0x4844b8ad,
-       0xa9ef8c15, 0x81e3c659, 0x014de97e, 0xaf38d77c, 0x95df3025, 0x9f8d5f00,
-       0x09fb7647, 0x4a72a5e8, 0x15f83641, 0x4946f28c, 0x06909134, 0xf99c4bff,
-       0xef3c1ec9, 0x7c010f08, 0x2138cd1e, 0x19efbf43, 0x49ef54fc, 0x9d325564,
-       0xc1417bdf, 0x4bf68cbb, 0x6860febe, 0xff6fb381, 0xaf7fde6a, 0x552bf3a8,
-       0xc147239a, 0x582f212e, 0xdc41be31, 0x17f7c567, 0xb8ac1b02, 0xbe3b83de,
-       0xebf5127c, 0x9d84cdc7, 0x85eb50fb, 0x9b915fd2, 0xc76271f5, 0x06fe1b97,
-       0xa63433fa, 0xa06d17e3, 0x686ec1f5, 0xd39da3b6, 0x2c6e3db3, 0x5e8a45f8,
-       0xc80667b8, 0xa33b22b3, 0x92e7a2c7, 0xbfb43543, 0xfe5903e3, 0x78a1d6f8,
-       0xbb6cbfdf, 0x0f0ce313, 0x0955d8ee, 0x73f752fb, 0x52fb0276, 0xcf5c0bf7,
-       0x1fbf867f, 0xb47b2f54, 0x4425c6f1, 0x71ef68f2, 0x959e4194, 0xfc107de3,
-       0x047ce1c9, 0x38b6aafe, 0xf541ffbc, 0x1f3f5d5f, 0xbcbb91cb, 0x41c1c748,
-       0x784bdeec, 0x6303c810, 0x4afcb53d, 0x8f7e30eb, 0x4473b698, 0x489407eb,
-       0x0ed7cb21, 0x03a4f262, 0x656b5feb, 0xf796affc, 0xcfd597ed, 0xd5d30eb7,
-       0xf257db53, 0xf48c41f7, 0xe055b37b, 0x2e6fc1fe, 0x45fef589, 0xf7e3f98c,
-       0x6824099f, 0x9b653d02, 0x8225df15, 0xdf10f37b, 0xe76153be, 0x30aee55a,
-       0x87b23fbe, 0x5b72e3cb, 0x1943df18, 0xf501e7c4, 0x9d2c4f21, 0x56bbe2cf,
-       0xde04acbb, 0xc178a9c7, 0x577c03e9, 0xf8f2fcec, 0x8e21b2ef, 0xd4718ecd,
-       0x1cfc2f15, 0x1cc2a0e9, 0x10fc039e, 0x1b2666d9, 0x1db7cf81, 0xed7e034e,
-       0x0969c392, 0x575e73df, 0xbc3662d1, 0x71d6c01f, 0x0afebaba, 0xdeace7b8,
-       0x47ed2ca7, 0x656b3cce, 0x585fe87e, 0x78ad4b7d, 0x677fadae, 0xacf574e7,
-       0xaf57b82c, 0xc4b52fd6, 0xad6b8b96, 0x4f763ff2, 0x5ee7d1d8, 0x40eb5ae2,
-       0x923a63d0, 0x4953efc0, 0xe7906ef5, 0x87d39ba5, 0x80e09f80, 0xee77bd55,
-       0xe8fd8389, 0x7b41ec80, 0x3eed521a, 0x9bdab273, 0xff008d25, 0x892ca8cd,
-       0xf1a7a3ae, 0x0441c293, 0xb3ad0ee2, 0x0dbdc962, 0xa3c23b56, 0xc5f662d4,
-       0x0cf8d7ba, 0xc107d7a7, 0xc6c71fe8, 0xc750fe03, 0x5087203d, 0x79b70f0e,
-       0x2ed43f58, 0x9b65ef82, 0xdee96767, 0xb16a90c5, 0x8453e51e, 0x53a90967,
-       0x5bf235b2, 0x6964af1d, 0x05949676, 0xeaffa5df, 0x8a3157a5, 0x444c1267,
-       0x30e250bd, 0xbaa97526, 0x5c9204fb, 0x29f80160, 0x892dc0a4, 0xc8b52a40,
-       0x82d236ef, 0x5baa83a9, 0x2aa8fdec, 0x64f27202, 0x0417bbef, 0xeebc28d3,
-       0x1c1fb946, 0xe9c5c84a, 0x13dfff70, 0xafc0d6e7, 0xf9c2eacd, 0xc22aa598,
-       0x3774c5e4, 0xd04223e8, 0xf4a3be4f, 0x9f9d5354, 0x7f48f405, 0x0cff707c,
-       0x3f3a0f4d, 0xafe5fb97, 0x74a20f40, 0xfb59deca, 0x50d50931, 0x28f84310,
-       0x132755fa, 0x9ad83ef6, 0xded688b7, 0x6fe72bf8, 0x728fdc12, 0x3fa241cc,
-       0xb1079a11, 0x26b6f20a, 0x385cdbee, 0x49b87447, 0xbb42f418, 0x34ed8483,
-       0x4e968c75, 0x95dff96b, 0x3a1af34d, 0x97d44f75, 0xca82f91b, 0x2db8c335,
-       0xefda3f08, 0x3f7e8667, 0xd9fbf433, 0xc2abf5f7, 0xe8d96029, 0x5609f785,
-       0xb8701756, 0x1c2cf1b1, 0xa33e146e, 0x62337de0, 0x79f979b2, 0xc6d5c238,
-       0xfa866367, 0x6c83af14, 0x07a708e9, 0x2045f6e2, 0xd624966e, 0x577bb013,
-       0xa69f6c08, 0x4d0e053f, 0x20b6e23b, 0xc7c7de1f, 0xf4636419, 0xef5bdeae,
-       0xe78adf5b, 0x5bea7d1a, 0x8b6fabfb, 0xdfd9df5d, 0xe731ec7c, 0x4ce543f3,
-       0xfe6f0be5, 0x7b61ce09, 0x829b8de5, 0x6f274732, 0x9c28d906, 0x7f8fe22a,
-       0x985f89db, 0xa21968de, 0xe80d9fc7, 0x6d8fd295, 0x11bbfe84, 0xcbd1fdef,
-       0x9a0ebe3c, 0x75d2a477, 0x3f8f94fd, 0x639d89b5, 0xf984b6df, 0xe7b9a8dd,
-       0xf2b7fa83, 0x14b53ffa, 0x18e0ffa1, 0xb6e9177f, 0xde17a67a, 0xe788af76,
-       0xfdde7dcd, 0xff285f81, 0x0854bedc, 0xbd63d385, 0xe09a4463, 0x3e5cd47e,
-       0x205df1be, 0xade4f13f, 0x0bbd6311, 0xbd4ce8c4, 0x6f7c6557, 0xe0292160,
-       0xbfe93def, 0x91bab26f, 0xd61e410e, 0x4bee8e8e, 0x8e9475c1, 0x74a49f41,
-       0x70ece70c, 0x3ce3063d, 0xf38b0a5c, 0xe78a18e8, 0x3b3caa63, 0xe1c4f1eb,
-       0xd34deafe, 0x78b817bd, 0x5e3927bc, 0x73a5af23, 0x2b7bdd36, 0x0537b235,
-       0xee7c95e4, 0xa6a1e232, 0x1e8d42af, 0xea9ca68f, 0x10ccc8a1, 0x277284a6,
-       0x9c810a45, 0xa405dc93, 0x9958f408, 0x5f5aa7d1, 0x57acbc49, 0xfe8d7c6f,
-       0x878801bb, 0x3be2e5d2, 0xd728c93c, 0xe00b05ed, 0xf5cae893, 0xe97d1dfa,
-       0xad95b821, 0x9dd606bb, 0x353d77de, 0xfa8bd78a, 0xf7de84f3, 0x3f302c69,
-       0xd379ecd1, 0x0ffbf303, 0xa51f8099, 0x27bc7c2f, 0x677e1443, 0xde318343,
-       0x3e9b8c43, 0xdf57c612, 0x9d535c45, 0x2bade782, 0x2b897bf8, 0xfe6147aa,
-       0xe59efe7e, 0xa60f6aaa, 0xde2cfc2a, 0xcfc77c5a, 0x6ff58232, 0x24fc7371,
-       0xfc7c389a, 0x52592fa8, 0xd01cf0aa, 0xc30aaeea, 0x086459fb, 0xda6027dd,
-       0x9f845aee, 0x87e826e2, 0x6f31f5a4, 0xe54d3c86, 0x0f88d1fa, 0x8a455dc9,
-       0xddbe7968, 0xcdc020ff, 0x7ba419ea, 0x329cd01f, 0x03df7bec, 0xf5a7a5ec,
-       0x72262e4c, 0x27c2327a, 0x65ef6151, 0x9fd474aa, 0xe3c3555e, 0xf6ae1f74,
-       0xdfc35a62, 0x7781aa81, 0x3d48147f, 0xedc81f98, 0x470a1ac4, 0xdf08fef8,
-       0x73aa6b37, 0x972cfcb1, 0xaaa68957, 0x25c032fd, 0x66ff3081, 0xc90c9062,
-       0x14042c21, 0xc482527e, 0x9cf57903, 0xe6c69dd0, 0x7441e9cd, 0xdc77864b,
-       0x5e008f3c, 0x26cb0eea, 0x4b8b93f0, 0x681f25af, 0xe59c59e8, 0x99bf078b,
-       0xb00bf0e8, 0x78003dff, 0x4759f3a5, 0x96ef85e7, 0xc9587a72, 0xd39abef1,
-       0x1f407dc3, 0xd3907d34, 0xfae8afc5, 0x65e35f21, 0xe6d601f7, 0xc4b778b3,
-       0xc77f130c, 0xf1b44c2c, 0x16def164, 0x2275d0a2, 0xc5307a8f, 0x5bc8ea77,
-       0xfb17a466, 0xa113e268, 0x43bbadfc, 0x82c91dec, 0xe337d854, 0x272377d5,
-       0xe367e27a, 0xc4b0d545, 0x991373df, 0xf311d1dd, 0xef1ac67d, 0xefd80b01,
-       0xeec7cdfd, 0xa4afa5f5, 0xd9ebd9e3, 0xfe01c5bd, 0x688bd982, 0xf54f51de,
-       0x8ce5026f, 0xde741d2e, 0xc67d1a45, 0xbffd8fde, 0x51cd7ed4, 0x7be7c51b,
-       0xe45141b0, 0xb87ebaff, 0x614be015, 0xc73f01ed, 0x2a4172c3, 0xf1c3fff0,
-       0x8735fdb1, 0x83d2326d, 0x1d32fb2b, 0x3ec9d73d, 0x989ee76c, 0x3afba3a9,
-       0xa612772e, 0x577dd04e, 0x6defcce5, 0xb12eef4c, 0xbcc2cffb, 0xc5d1ce92,
-       0xbc4a7e51, 0xa9dcb621, 0xdc209591, 0xc319afdf, 0xa6705ce4, 0x3eabf4c2,
-       0xa7c98472, 0x6f32e4b3, 0x645f4350, 0xf03d4114, 0xee8a998b, 0xc035c1dd,
-       0x7e5e941f, 0x057ee9cd, 0xc54d01f0, 0x4dd20a11, 0xda1374c2, 0x5f38aba9,
-       0x68f9cfdd, 0x87a3e72d, 0xc2467f80, 0xdf8cae3b, 0x051de224, 0x8b8d48fb,
-       0xc0258fbd, 0x8d49b4ff, 0xe85cfe6d, 0xb32de6af, 0x350fe700, 0x11752f92,
-       0x977e29e4, 0xef8f307b, 0xedeb06ea, 0xbbf1589e, 0x9293ed4b, 0xc95e14ec,
-       0xdfbf8676, 0xfe2167d4, 0x316f6e2c, 0xd8724bac, 0x19afaed0, 0x658e2969,
-       0xbdecd81f, 0x53b74ef0, 0x9fc80f78, 0x817f6bd0, 0x666ea17b, 0x37fdc20e,
-       0x06399f70, 0x33b18cfd, 0x04864079, 0xff0d08c9, 0xdcf7f1d7, 0x46482788,
-       0xf2c0e469, 0xf808f38b, 0x7ff2fa77, 0x136ff23f, 0x02357f93, 0x780c57df,
-       0x5531f755, 0xd78049fe, 0xb9e77d01, 0xdd5ca2f2, 0xcb997b3d, 0x3cbd636f,
-       0x4f9d9dbb, 0x2fc46f11, 0x70a72df4, 0xce6bb3ca, 0x09c49495, 0x5d95efbd,
-       0x461d6315, 0xf61277b9, 0x9225903f, 0x5905df1f, 0x191e78a8, 0x8fe4f20f,
-       0x3fa5fe2c, 0xaf1d40fd, 0xee315ce8, 0x72e785f3, 0xae299f71, 0x20fe45cf,
-       0xd8d78de0, 0x7e1a2749, 0x9dbc02e6, 0xa3e7e7a8, 0xe208720d, 0xbc6ff652,
-       0x14d9a1e7, 0x88370b9e, 0xd7fefeec, 0x6a277ddf, 0xb6481be2, 0xf53af507,
-       0xa113b43d, 0x73da5d3b, 0x58dfc2ec, 0xf62fa07d, 0x3614cfb7, 0x6bdfb6c4,
-       0x53d057e0, 0x1e801f29, 0x4881f54a, 0x5f85f418, 0x08bdf15b, 0x68dc1f35,
-       0x540ef98f, 0x195a7dbe, 0xddbe67d0, 0xc4a42777, 0xfafe8091, 0x8ea1e6fe,
-       0xa67c1c7b, 0x28f64e70, 0x70a5b38f, 0x9ff3a99f, 0xe3b273b1, 0x2c421fdc,
-       0x78db94fd, 0x729fa7b9, 0x21678b17, 0xeae5d8ee, 0x3b714e7c, 0x7b46e170,
-       0xfd8c7968, 0xefbf217c, 0x479f90b7, 0xd53ff8a8, 0xba3137ab, 0x3f2ffb51,
-       0xdfe18a37, 0x53c26740, 0x3eae9063, 0x7fa3243d, 0x4aea784d, 0xf2a52f7c,
-       0x97eb059c, 0x415fde8b, 0x4d79161c, 0xf3bbba44, 0x873c38f0, 0xc3bc32ea,
-       0xb7f387b8, 0x2b9e169a, 0x8599e9d5, 0xec0a05a1, 0x2ae785cb, 0xde211e91,
-       0x1397ee11, 0x934bf6f2, 0x13574e24, 0x6991fda0, 0xa2bd69cb, 0x64bf464e,
-       0xfd12b062, 0xef768d84, 0xdae431fd, 0xe747bb1e, 0x2cea2837, 0x2389fec7,
-       0xe7351248, 0x7bf90bf5, 0xd8e745e1, 0x1dc4847b, 0xcf402924, 0xe944de5c,
-       0x6c6eff52, 0xcbe18997, 0xf857deb8, 0x5de95f3a, 0xd67e84ef, 0x5eb663fb,
-       0x7517cfbe, 0xf5d61ae6, 0xd6b1f1bb, 0x44cf5d15, 0xdfce5f6c, 0x31372df9,
-       0x9fe5abbc, 0xf4d5f1f3, 0xb82cf578, 0xf84a4361, 0xa185903b, 0xff78153b,
-       0x3e21b0a8, 0xb3acd041, 0x5d56fea8, 0xfd61495c, 0xaaff7c3c, 0x329e61a8,
-       0x7a47235f, 0xecfc14f1, 0xa22349a5, 0x81fcfa78, 0x1dcb699e, 0x1c14afb0,
-       0xfe3b3e03, 0xe79cc564, 0xf0cbf409, 0x8e095276, 0x72b942ad, 0x3dd62ba7,
-       0x788dcf94, 0x1b78e7ab, 0x35a32411, 0x97c54672, 0x4df1fdb1, 0xf9c17765,
-       0xecf5f1f4, 0xe5fe8f75, 0x1a7c6c4c, 0x3076e8e1, 0x71e9a9f8, 0x2ffb2fba,
-       0xeb978e08, 0x85fa9be2, 0x0abfc723, 0xd53bf527, 0x1c0eacab, 0xa37bb097,
-       0x0417b9f5, 0x8cf8e8bf, 0xbe2a4e3e, 0x7e41eb91, 0x7c093951, 0x07c9ea7a,
-       0xe5db6ac6, 0x840d27db, 0x85ed4871, 0x6fdd8f9d, 0xfd41a7f7, 0x21ef64e0,
-       0xd15bca0f, 0x5dd7435b, 0x7768f712, 0xdfab5718, 0x935656bf, 0x4a5fc12b,
-       0xc12b87ed, 0x05b5436f, 0xe6a8a3d4, 0x847d05e0, 0x7ac5f156, 0x83926a17,
-       0x5656b3f9, 0x95bfa157, 0x0dc48258, 0xf8c23d7e, 0x42cc9c92, 0xd0e497ff,
-       0xec8a01eb, 0x4dbf8377, 0x6591f7e1, 0x3d26bfc9, 0xc4d9ec1b, 0xbe06a08c,
-       0xbc583957, 0xc594dac4, 0xb7438841, 0x38719f80, 0xeace37fa, 0xa517fbec,
-       0xdd280385, 0xda7dcfa9, 0xe5cbe846, 0xfe8216c4, 0xbbf4d1b4, 0x74891e76,
-       0x4c7dbade, 0xe2c9170f, 0x890f73c2, 0x8715bf70, 0x7282fd07, 0xc3973578,
-       0xdc2eedcb, 0x645d567f, 0x8ea0fb42, 0x0b7ec3fb, 0x8b84307e, 0x84327684,
-       0x257d40dd, 0xb0eb882e, 0xd0447ac2, 0x7798c3db, 0x22328bc2, 0x4025b13e,
-       0x04789e3e, 0xe1200fc8, 0xf687a055, 0x0bbcea4c, 0xfd58a7be, 0x5fbf01b3,
-       0x151c76a4, 0xe05a0fc0, 0x5ce004bf, 0x3c33062f, 0x62e3feb4, 0xa5ea0324,
-       0x12b7a2d1, 0xc4117a58, 0xe735fb41, 0xce1dec2b, 0x9bec5e68, 0x64a968bf,
-       0xfaf86f38, 0x2ff96d12, 0x0762beac, 0xf656fbec, 0x07e24d7e, 0x9ab9ca02,
-       0x01773f5e, 0x71a9dbde, 0xd23d7f30, 0x21d5d005, 0x959f4fb6, 0xe809713c,
-       0xf5951b3f, 0x5e1e6ea2, 0x76e25e5d, 0x53a5134d, 0xf4ab8bf0, 0x99f24231,
-       0xae2e8e80, 0x78b5dfa5, 0xc15fa18c, 0x39fa2338, 0x47e7504f, 0x157a45c7,
-       0xfdb0e5cf, 0x7b0f40d6, 0xa0ff3604, 0x0fecced5, 0xaf011412, 0x93c255b3,
-       0x3c7cb056, 0xddf07f51, 0x3f55b7cf, 0xf2c15937, 0xcc0b966e, 0xc66ae767,
-       0x5f6eccf9, 0xe5fe01dd, 0x0ba9edd9, 0xb6659ce0, 0x208ff2e5, 0x0e4723dd,
-       0xfc4e41d8, 0xf9a3bd8c, 0xca2f23d3, 0xbc778a20, 0x43ef11b1, 0x71f9ce3f,
-       0x80c8890e, 0x2b713f7f, 0xc21e4fcc, 0x5e27cdf5, 0xc1916f9e, 0x1c2dbd7e,
-       0x9a3af9ba, 0xd0c5fdbb, 0xcd5a6075, 0x09791439, 0x716fe6d0, 0x5a2fa1e7,
-       0x7de6d76d, 0xbb59e599, 0xdff81c28, 0xb82c90c1, 0x2dbae8ae, 0x9d750708,
-       0xa3e226b4, 0xfdfc4e17, 0xbd2e1520, 0x7adfb6eb, 0xfb0bf82d, 0x2db36f93,
-       0x71623e63, 0x465e6cb9, 0x45067d38, 0xc3915ef0, 0xf2e807b7, 0x1daf8761,
-       0x12dca4f8, 0x21869349, 0x5f2184df, 0x4a2ffa29, 0x78f870a2, 0x8192ffa8,
-       0x018e8f00, 0xbe67a417, 0xd5fce9ca, 0x83f7def4, 0xbe99d113, 0x66c1f986,
-       0xb55b7a70, 0x9b8c4de3, 0x7b30f8fc, 0xf442a90f, 0xfa0f7f5c, 0x4b1244bf,
-       0x57d355ef, 0x2de61fb9, 0x9d1f7a87, 0xc48673ad, 0xd5a33de0, 0x667af78e,
-       0xfd3a8b64, 0xc0b6467b, 0xc63ad7e3, 0x4bd3a4de, 0xeeba7057, 0x11c40fdb,
-       0xb059fb18, 0x55da3274, 0x24f7153b, 0x0dc1ff90, 0x4c16ce8c, 0x671089f5,
-       0x808d613c, 0x1ff188fe, 0x87901276, 0x09e2ea0b, 0xb82f839c, 0xbc16717b,
-       0xe1d95097, 0x3904eb69, 0xe0bc1219, 0xef164b47, 0x9d25f8c8, 0xd807c3d7,
-       0x3bf90c3e, 0x9f0e9e60, 0x2bf1a1c7, 0x1955c977, 0xdbeba06e, 0x0b903e1d,
-       0xbdf26ef3, 0x922d780d, 0x76b5fbc2, 0x3cdbbcc8, 0xf31f40b9, 0x4c3eac5a,
-       0x51b2442d, 0x224f36b9, 0x15934816, 0xdf215922, 0xece7d4fe, 0x3bad86b0,
-       0xec2c46d9, 0x80afe1fb, 0xacdf2e4e, 0xa63dd6e8, 0x51ff9f45, 0x119f3e9b,
-       0x0eb3e7d6, 0x80b7f3e9, 0x87d1a31a, 0xe765ec0e, 0xd86765dc, 0x05e7c13d,
-       0x7fc083d8, 0x37b9466a, 0x073daca5, 0x3ccf4dce, 0xf94134eb, 0xfd986f9e,
-       0xc562d916, 0xbff6cbf7, 0x44b62363, 0xbad4c778, 0xd8cfca11, 0xffc0725a,
-       0xfc63eb44, 0x4735dd03, 0xf3b1fd82, 0x0cced532, 0xcec49c61, 0x7b9c596f,
-       0x04398b64, 0x7667b1e7, 0xd02cf53f, 0x832d99dd, 0x5e79ef51, 0xdfa09a08,
-       0xaf0c7de0, 0x9d2e6c13, 0xacdb29fc, 0x3846ebb7, 0x73d53e99, 0xf10b994a,
-       0xebd4974f, 0x48697dd7, 0x64ed1f9f, 0xd13e67f2, 0x73874f7c, 0x14aacf66,
-       0x48278ba0, 0x5983fbcc, 0x9f7f264e, 0xed515a7e, 0x33bf916c, 0xd1493c46,
-       0xa27b4f7b, 0x064b3fe7, 0xc0001c43, 0x7bf45862, 0xb55c6199, 0x7cb96fff,
-       0xfa7ee44f, 0xc222abc8, 0xb17574e7, 0x57b89cee, 0xa6f6ad3f, 0x33ecd54c,
-       0x93fbf585, 0xb85ea1e6, 0xd6be693f, 0x3072db2e, 0x738856e9, 0xdfe12cd9,
-       0xfd9f2a4f, 0x121343e4, 0x02d8bbe1, 0x1f7285f3, 0x2f2d1fd8, 0xd51ea0b9,
-       0x71b5333f, 0xe3f54523, 0xf66aa652, 0x974a1fd7, 0xbb4aefbd, 0xe5767c19,
-       0x1d78dc16, 0x835977c5, 0x656a85e8, 0xfbff372d, 0x837b8018, 0xcb5cf78c,
-       0xbef8c9b7, 0x0af1a079, 0x359413f4, 0xef879ebf, 0xe79fade8, 0x48e57985,
-       0x44cc40a4, 0x904dc0d7, 0x81df6c9e, 0xfd95d5ef, 0x3c914eb5, 0x7d3d5f30,
-       0x3f437a50, 0x7280d517, 0xf01e006e, 0x54f8c32d, 0xae11bbf5, 0x7b7d2125,
-       0x17febe23, 0x33fa37a7, 0x63778b4a, 0x83d301bd, 0xca4877f8, 0xa3b95297,
-       0x3fca2fb1, 0x38f8c5ac, 0x542838e3, 0xb0d0e735, 0x1f90797f, 0x271f7cad,
-       0xc7872582, 0x79670e8f, 0xe80f377c, 0x197fd60b, 0xfb81ea99, 0x7c90378d,
-       0xc2179f48, 0xe322890f, 0x6c3bf46b, 0x775f23b5, 0xfc9f3bb9, 0xf343d01d,
-       0x18c73c18, 0x767befc4, 0xdef8c279, 0x0ff7faa0, 0x5f2cdcba, 0xf8c56eda,
-       0x2b1f338a, 0x4196cf28, 0x7fd4175c, 0xd1326ad6, 0xb6cce67d, 0x4e219301,
-       0xbd85abb0, 0x65ba7b2f, 0x7be564c0, 0xff2347f6, 0x31d6fbaa, 0x6fee95f8,
-       0x1b7d384f, 0x15df009c, 0x79328e2c, 0x55465540, 0xeda93c0c, 0x0caa9512,
-       0xb7221fb0, 0x991bbc3b, 0x720e93be, 0x053facff, 0xdc79f9ed, 0xae37b17f,
-       0xd7e819e0, 0xe8faeb49, 0xe24384bf, 0x0fafa046, 0xee5def44, 0xb5f3d1e1,
-       0xbc7ed985, 0x30564a4f, 0x4481663b, 0x4fd512c2, 0x1fbc8017, 0x8394798b,
-       0x8c041a0b, 0x56b85a2b, 0xef781ebf, 0x0377fb54, 0x5e2fe18a, 0x9138870d,
-       0x1b8b4c16, 0xb025e5f4, 0xfe30b87f, 0x4bcfcf03, 0x70e5f49b, 0xbdf41093,
-       0xccefe6f2, 0x39f6e0b1, 0x7be7d751, 0x1f93a9c9, 0x8f8fca32, 0x5f5c02c4,
-       0x909b5819, 0x702afdf2, 0x42ca6e77, 0xa59ee20a, 0x66165213, 0x04183be1,
-       0x1645a7f6, 0xb2657412, 0x8003bc3c, 0xc9fc83ac, 0xf5825bde, 0x9487ef69,
-       0xa1e1254d, 0x613ae8ae, 0xf272da7d, 0x5963c306, 0xe31e10bb, 0x8237de8a,
-       0x95eb6a75, 0x3797f5f3, 0x837e759b, 0x84f3880a, 0xefd69538, 0x797ebacc,
-       0x37dd1cfc, 0xe7e29589, 0x1bb95ee1, 0xfc5634ba, 0xa70e51f9, 0x4c2e6f87,
-       0x15fcbe05, 0x388381e8, 0x3da97320, 0x0271c20a, 0x8e85b803, 0xcdeacb63,
-       0x72ce7963, 0xf9d4ff96, 0x10fd5e55, 0x7ec9376a, 0x2058573c, 0xf70cbc16,
-       0xfdba669a, 0x17fc025f, 0x12697c98, 0x246fa7f2, 0x652e47c6, 0xb3247feb,
-       0x18aad2ea, 0xc78aa9f6, 0x782d0adf, 0xcddc17be, 0x76673df6, 0x3bfad644,
-       0xee4c5de3, 0xc4e81dc4, 0x0ec8fe78, 0xae11ef01, 0x3de18e17, 0x78d7f5bb,
-       0x29cfd808, 0x17206f14, 0x05640bd7, 0xdd9563bc, 0x978ef33a, 0x36d97f00,
-       0x5a2a77d4, 0x0e158927, 0x77d33f5c, 0x708d55ec, 0x773c98ce, 0x33d02654,
-       0x1bdcf75d, 0x83cbbbe0, 0x183aa5e3, 0x0f2ca41d, 0x0d1e2fa6, 0xf1dc17e3,
-       0x18dbf012, 0x4d3fde1b, 0x2672b0a6, 0xf406ba60, 0xb1921497, 0xca77e41f,
-       0xf8264f74, 0xb1761f5a, 0xc49a0671, 0xcf4133b9, 0x84f964ca, 0x46df057b,
-       0xb875ae24, 0xc93364fe, 0x77c2f987, 0x602d13d0, 0x887963cf, 0x554a79e1,
-       0x3c9f8c06, 0x4a89a59c, 0x5e82e318, 0xcedef151, 0xb89673e2, 0x25e3ca09,
-       0x4e4a4d5f, 0xe95feda0, 0x952d86a2, 0x510caf53, 0x03b0e1f5, 0x623210f4,
-       0xf5cfab14, 0x2c1925e1, 0x4d313dee, 0xbd5857d5, 0x9717d91e, 0x75f3f205,
-       0xe67f17a6, 0x9c41c5f0, 0xec4a15da, 0x1c49dbb8, 0x3673814f, 0xfff8d212,
-       0xc0beb303, 0x73811c7b, 0xecd2122e, 0x9b2ef007, 0xbcb37e36, 0x17be00f8,
-       0x303a415c, 0x45a2b80e, 0x857a6f1f, 0x2ab8f62d, 0x99ce079d, 0x42ed1048,
-       0xc0271f0a, 0xce0ab227, 0x057b8271, 0xce06aff4, 0x19a82429, 0x412e703f,
-       0x679def9f, 0xad13f612, 0xdaf5f447, 0x247ac4be, 0xe305d3b7, 0x713bbb74,
-       0x939c08bf, 0xafba9db0, 0x414c84f4, 0xdd6fea99, 0xc3de561e, 0xeb55a3df,
-       0xcf75fdab, 0x977df852, 0x55dbf608, 0x8511054d, 0x9feda3cb, 0xbcb39fa0,
-       0x45c23f7d, 0x7c2887a5, 0x81a824ec, 0x474d524f, 0xfb7944d8, 0x584d0fe7,
-       0x4a52fa3d, 0x1f38075a, 0xf6ae2707, 0xa2e5a44d, 0xf6d7c749, 0x473e5eec,
-       0x49b0f2f1, 0x2bc8fee4, 0xa89d4f57, 0xbdfaf3c9, 0xbe3f83ed, 0x47b3ca1a,
-       0x1ecbf6b3, 0xcb0feaba, 0xa25ca8a5, 0x702b48eb, 0x4316f26a, 0x63f341de,
-       0xa1b77934, 0x9e50d13c, 0x610fc862, 0xe19cbbf5, 0xc84bd134, 0x5ca687da,
-       0x03dfc12d, 0x81cf0d4a, 0xc56bfb9b, 0xefe1abbc, 0xb364562b, 0xd95817bf,
-       0x3859782e, 0x655f8313, 0xa76cf9ef, 0xc03460b2, 0x9065e3a1, 0x826de503,
-       0x4770f41b, 0xe630b6cb, 0xd3479da1, 0x7bdd85ae, 0x86396f2a, 0x7fedfaed,
-       0xf8f90994, 0x63ef51fe, 0x15c5f3bd, 0x78fae991, 0x19e2fef3, 0x26fe088f,
-       0x3be8b8d7, 0xdedb5dbd, 0x37bdfe8c, 0x53ba472a, 0x8e51077d, 0x067fee1a,
-       0x288e3e60, 0xbc70a89f, 0x7c59d47f, 0x31ddf0b7, 0xdb6047ed, 0x64f92fb7,
-       0x7f91e819, 0x0e3138ad, 0xfb782af4, 0xdf8df610, 0x614ba10a, 0xf8947a1f,
-       0x6f71852f, 0x3f78b8af, 0x547d913c, 0xde0c7cee, 0x87cffdb5, 0x7f0d5ee6,
-       0xb3a8eeef, 0xa9fc2873, 0x52ae239e, 0x81d1c7c4, 0x4292f89d, 0xcb195c66,
-       0x6a1ced0f, 0x5db7f9a2, 0xe2fe59eb, 0x2f20c7ce, 0xed632dc4, 0x150e74c7,
-       0x2c3260dd, 0x726dfc47, 0x3ff7e6c7, 0xcea33972, 0xbee1eeef, 0xa42e0097,
-       0x7037ed9c, 0xe542d0bd, 0xd3d29ce9, 0x7851375b, 0x1d85f9cc, 0xaea6dce5,
-       0xfa65af1b, 0xe200b070, 0xbc39928d, 0xb9443f71, 0x90dea12e, 0x42607b0a,
-       0xb4ce9f14, 0x17ee0f0e, 0x036d5597, 0xce79207d, 0x1a2fdc68, 0xb8acbe9c,
-       0x4374d171, 0xe2b34b22, 0x8bae4cdc, 0x961fbc26, 0xf5138f7c, 0x77f15fa5,
-       0x21df29ae, 0x5e38387d, 0xbb3173de, 0xf3173dec, 0x4e741c2b, 0x11de7ec3,
-       0x222deb7c, 0x056824a4, 0x50d896bc, 0x91b5b90f, 0xd72a15ca, 0xebbcf8eb,
-       0xfe8a5dd6, 0x5fc15b82, 0xfbbe1a3b, 0x47461352, 0x0cbafcf5, 0xed44779a,
-       0xbe99bab0, 0xda7bed54, 0x5cac8d75, 0xe9755b95, 0x5fbabdac, 0x71b0d725,
-       0xe9757f92, 0x5d875846, 0x8bf5e762, 0xb8dc8d66, 0x1bfff70c, 0x1fc0e2b2,
-       0x82a5f3e2, 0xc961fcdd, 0x9fe81330, 0x861a7e2a, 0xd172befb, 0x73f29ff2,
-       0xbd4f1516, 0x5b1c65f6, 0xea9102f7, 0x3fbd740f, 0xfd71fb72, 0xcb189f54,
-       0x3e99b30e, 0x4cd74591, 0x5225f034, 0xfef838e7, 0x694e083f, 0x147feeb0,
-       0xbc777f4e, 0xf73ef4f4, 0xbe61325e, 0xe84f4b15, 0xb870bdef, 0xcb0856ff,
-       0xf79ad9c9, 0xb077e848, 0xfa76bf33, 0xce69c7c7, 0x53dce7e7, 0xbaa77a81,
-       0x77cffb1e, 0x64dfc3e5, 0x51a7f234, 0x8efa3c2f, 0x3ff82d65, 0x282d2a8e,
-       0x4b5e8f8f, 0x51c5fef0, 0xaa941efe, 0xa2fce6d7, 0xd3b015ec, 0x4889c536,
-       0xbe09f71f, 0x7dc78054, 0xfee01e94, 0xa28f1ab6, 0xf175c7ee, 0x4085f5a1,
-       0xc68f370f, 0x881eef73, 0x4b7a848c, 0x2eb8df99, 0xf0ed13be, 0x371ef1ba,
-       0x07d0099d, 0x5b3231e2, 0x5d4fff41, 0xbab3a306, 0x3ef0cb92, 0x2097a505,
-       0xe8cd9fb6, 0x41266eae, 0x766ea1bb, 0x959bd20a, 0x9f30ac84, 0xa927e8fe,
-       0x10a3c586, 0x7b5637c9, 0x638c1d6e, 0x767b117e, 0x41378ee7, 0x456b5d8f,
-       0x8950163d, 0xc9b51de7, 0x074a5f38, 0xaa5748c5, 0xd49bf67d, 0x0f68fdd0,
-       0x5feed17a, 0xc3cdf4ed, 0xeed2fff9, 0x5837f981, 0x264b1ac9, 0x05643598,
-       0x1f3e49ca, 0xc608fb52, 0x7ae5cc2f, 0x67c57be1, 0xfc7fa09d, 0xff504e3c,
-       0xec0fa52e, 0x9584f9f0, 0x7ed7bfcf, 0xf9a9ec0c, 0x6277b2f7, 0x3e699ac9,
-       0x9d05f9fd, 0xb9f8126b, 0xc47d4ff9, 0x87e37409, 0xffe82e76, 0xff709cbf,
-       0xbb2f7fc6, 0xb4824acf, 0xfb68a8fd, 0xc1df81fb, 0xf9b22e5f, 0x27bb6a93,
-       0xf7a0fbd6, 0x44bf71c7, 0xed3e23ed, 0xc638ea78, 0xf8bda97e, 0xc28bc000,
-       0x8cf70c3d, 0x7f64bf22, 0xdf38c097, 0xa0f22544, 0xa9cf9695, 0xefe1e316,
-       0x3a97fb88, 0x7ceabd71, 0xae4726e7, 0xa1847f44, 0xcaf6e3ff, 0xab67f01c,
-       0x57b90ff6, 0x5c21ef63, 0x845e6894, 0xb411f87b, 0xe77cfaa3, 0xeed1b1f6,
-       0xb35be424, 0xdc6f5eb6, 0xcc3047be, 0x4795d39f, 0x7e6f0090, 0x28af1e7e,
-       0x5ef83991, 0x2ade6194, 0xba73773c, 0x08c2e953, 0xc0fdddef, 0x1ce9513b,
-       0x97fafd0a, 0xc64e119a, 0xf4fdd5fe, 0x1fe52b11, 0x82f5774a, 0x7f5af480,
-       0xc7f71db7, 0x49e46b1e, 0xefb8d7bc, 0x7777c46a, 0x4103cd89, 0xb5528f5a,
-       0xf633cf1d, 0x9e8cf3b1, 0x81239d91, 0x9ae9ba9f, 0xdd3f147d, 0x418d8aaf,
-       0xd5049d41, 0x37155e8f, 0xef77fd02, 0xb3f586be, 0x89dececc, 0xbdc30806,
-       0xaadfe0c4, 0x81f39fc1, 0x002fbd89, 0x6b458f7f, 0xd1bdc377, 0xbca8cce2,
-       0x180281e8, 0x573d4dbf, 0x38e097f2, 0x3df0dab7, 0xe0934a81, 0xb2abbd03,
-       0x67bc32f4, 0xd1dff840, 0xa568e551, 0x99a3da89, 0x34afbe51, 0x31723fbd,
-       0x491293f3, 0xf5a347e3, 0xb03b045e, 0x03b6b2dc, 0x49bb51ef, 0x6843eff4,
-       0x6b95a5fc, 0xf3037ccf, 0xf8356caf, 0x83fe0c11, 0xa53d2d52, 0xf504e947,
-       0x531f907e, 0x775bde09, 0xbf3dbcf2, 0x018efd03, 0xf030ce7e, 0xd6d77b00,
-       0xc042dd99, 0xc9381aaf, 0xed0996f4, 0x0ec1078d, 0x18efcf8f, 0x700dcb0a,
-       0x9ef19f3f, 0x75f6f8c9, 0xaa95d822, 0x6bb1a3be, 0x8c61bd2f, 0x4df76536,
-       0xf1864ec1, 0xf013e13a, 0xc9f6c48d, 0xf74803ff, 0x800023ad, 0x00008000,
-       0x00088b1f, 0x00000000, 0x7dc5ff00, 0xd554780b, 0x733ef0b5, 0x9992bcce,
-       0x9264cce4, 0x0927de4c, 0x27010084, 0xd4500421, 0xe6a2bc21, 0xa2d101da,
-       0x3c2438b5, 0xa0992112, 0xf7ad8b95, 0x24844032, 0x111a0804, 0xa284e028,
-       0x17edaf62, 0x04c0622c, 0x16c45407, 0x6b5ec5fb, 0x46f7f6d5, 0x485ca008,
-       0x6c5cb046, 0xad7bfcb5, 0x67324fbd, 0xde952892, 0x1e9f7cde, 0xecfbd9f6,
-       0xaf6b5ac7, 0xa5b3def7, 0x90d74b32, 0x44b44849, 0xc8485488, 0xbb11a6c2,
-       0xfe840957, 0x5b6673b9, 0x862a7909, 0x83c9e03c, 0x33c8abb2, 0x72599086,
-       0x9e3c8c71, 0xb1722390, 0xf7878e59, 0xda1e9181, 0x08e3f88e, 0x55c84499,
-       0xe075bbf8, 0x24203693, 0x625dbfbe, 0x8d7e4d76, 0x0e76e865, 0x83a7fd03,
-       0xd8b6d090, 0x8f986ec0, 0xd1796024, 0x0d2df46f, 0x613a3f38, 0x7687df3a,
-       0xfe600666, 0x40c9a415, 0x4a5909b2, 0xd2220602, 0x8fe22676, 0xda4fa029,
-       0x173e962c, 0x2512356f, 0x55dfe097, 0x40655ffa, 0x6ccd265b, 0xe0a54b5e,
-       0x90862111, 0xfb13a425, 0xdb57b259, 0x1234e96e, 0x2afad2b4, 0xc3460913,
-       0x5f5b55b3, 0x0f38424d, 0xa355db5f, 0x44d27fa6, 0x36db8508, 0x3b662133,
-       0xf99dc9cc, 0xe87f9d38, 0xb76bbd6d, 0x6869c842, 0x870fd492, 0x38e2d88e,
-       0xa8947380, 0x568675c3, 0xd3760745, 0x48eb7675, 0xb70a3ec5, 0xc0f2364d,
-       0x59ecfa6c, 0x0d8738a9, 0x9d8c7043, 0x3c20663d, 0x2b990e1b, 0x6e7f1402,
-       0x55708759, 0xd5895fdf, 0x40cbb963, 0x7d695a2a, 0x5fda6ad1, 0xf57d7f5e,
-       0x7c2f163d, 0x70165337, 0xbbe780de, 0x0d64cf00, 0x3ded077e, 0x71a8fc74,
-       0x777ea9ec, 0xcdfb5f67, 0xfe14df0c, 0x952dff30, 0x27802d51, 0x0493b922,
-       0x04759407, 0x63cf2ee9, 0x0fefd2f0, 0xfd7e7405, 0x5849f40d, 0x31ad7f7b,
-       0x97b62cf0, 0xe5a0ade7, 0xb9e69f43, 0x489c281a, 0xd03e7bae, 0x5173d2c1,
-       0xf1c1d00a, 0xff5f3f73, 0xf17f5a5b, 0xa4628353, 0x36800bf5, 0x090f1e28,
-       0xe7684ade, 0x3c8a37bf, 0x352ddf4b, 0xbb8c3710, 0x8088c0f4, 0x807bf69f,
-       0xb0feb196, 0x1a59c715, 0x90b6dde3, 0xa5f4b3f6, 0x40a51778, 0xf03eaaf2,
-       0xdf5073c2, 0x4b3d7661, 0xc51a5dfb, 0xa1e971e8, 0xbe7efc14, 0xf014bbd9,
-       0xfc0c6c93, 0x7be92fc7, 0xf5d19af2, 0x245c7d2c, 0xff3045c1, 0x0166ad8b,
-       0x75849dda, 0xad27d2c5, 0xed5d6013, 0xbfb63c74, 0xefd21692, 0xb227d54e,
-       0x9d387175, 0xe91a30da, 0x8d9e8b79, 0x60283fe7, 0xcf7a93fb, 0x3e5a248c,
-       0x6bbe72f9, 0xf5eaad15, 0x4a068218, 0x4b4dbe7f, 0x84b1904e, 0x5d94eb94,
-       0x38722700, 0xe2abe71a, 0x7171b7c3, 0x1efbd429, 0x124eec7c, 0xf4fef433,
-       0x310919b5, 0x0f6bd3f5, 0xfd03a509, 0x6ac8af6f, 0x7b71d20d, 0x44ba47da,
-       0xe45275ac, 0x5990fa53, 0x833d6edb, 0x8f43a86b, 0xfb5af4fb, 0xb44af587,
-       0x5bfc1f1f, 0xf0dd2784, 0xbc017eea, 0xc1c59787, 0x747f14ca, 0x8943bebd,
-       0x7ac8af08, 0x0bbbd5b3, 0x13f553f8, 0x0af1f3ff, 0xf9086f84, 0xc78a6919,
-       0x1de7467d, 0xbbefd134, 0x5f7159b7, 0xb4a63c65, 0xf77e0175, 0xb69d70db,
-       0x0ad16e69, 0x58991de5, 0x314571be, 0x86c71539, 0xaf940925, 0xa4ffa44c,
-       0x49122efd, 0xdf00a9ad, 0xeda36ce7, 0x869cbccf, 0x24645cf8, 0xcfba2675,
-       0xebc32349, 0xa7ca1699, 0x8dca7c28, 0xc967c85d, 0xe804087f, 0x85abb685,
-       0x20e94b76, 0xe1030549, 0x034b7c06, 0x395840b7, 0xb5abce8b, 0xff742445,
-       0xfaa7ca10, 0xcfd59fd6, 0x693f80c7, 0x337f27be, 0x57e8e16a, 0x63ee2df9,
-       0x59c4a8ba, 0x51f9fa63, 0x18e7ac47, 0x12c3f3e3, 0x44677e01, 0xf29972ef,
-       0x8fc4c5b7, 0x0492b1fc, 0x478ea9f1, 0xbbe32df9, 0xe177c626, 0xfc0d7519,
-       0x8ad241f7, 0x380ab37c, 0xf77c60d2, 0xc777ca31, 0x0977cd0e, 0xb807c9a9,
-       0xb8b7eefa, 0xf803ce00, 0x2aefe72f, 0x8c0d131e, 0x58f8df0f, 0xfd792440,
-       0xeadd7870, 0xcfa0e73e, 0x06e242e8, 0xc0fbe7fe, 0x806e5264, 0x516487b2,
-       0x4eb0ecf8, 0xad027ef9, 0x0dc449f7, 0x93ba337c, 0xfbe85bb8, 0x87e2669d,
-       0x2826a6fe, 0xc0d38fd8, 0x792f42e8, 0x2fad3e48, 0xea0cee2a, 0x13c49f60,
-       0xb5bdf819, 0xd3bff593, 0x802bbf4a, 0xaefc04ef, 0xa9137bef, 0xbefb0a8d,
-       0xe91990f8, 0x6b41f2e8, 0xd0f288c0, 0xfda3619b, 0x48d1fc25, 0x873dbd60,
-       0x7be7c8ac, 0x2b6e64f4, 0x4910ef6d, 0x73e22b4d, 0xd827f62d, 0x27e9f132,
-       0x680429c5, 0x053db857, 0xab2132b6, 0x65575f91, 0xf283de76, 0x81519f76,
-       0xd6d97c7d, 0x74ca1cb5, 0xe5a7e23c, 0xdb05652f, 0xcd4ff6f9, 0xef7d09ff,
-       0x0c5c58f3, 0xa07cdeba, 0xa3f8a317, 0x6f144c7b, 0x42c7c433, 0x5679d28f,
-       0xe06459a5, 0xfe32d3c7, 0xb4bdfef4, 0x3d7ed9fc, 0x9fde0231, 0x64973a9d,
-       0x2a27cd0d, 0x5d93fa03, 0x64baf461, 0xd55cb6af, 0xdafb2daa, 0x9b54e5b4,
-       0x1a2671d5, 0x2aeba6f7, 0xb1a327a5, 0x3a16d3e6, 0x46abe35f, 0x967f9be4,
-       0xe03699bd, 0x31d0ba0b, 0xe331a380, 0xe02f58fc, 0x0173fdb9, 0x1b4a469e,
-       0xbe0c799d, 0x9b2eafb0, 0x79c867e7, 0xfe97cf43, 0x47087499, 0x93c189b7,
-       0x9b1f07f1, 0xee57dd12, 0xf5d08ecf, 0x251d9a2f, 0xee37c6af, 0xa045f1d2,
-       0x891ce0af, 0x9f6deb6f, 0x5db16309, 0x5989f225, 0x579d1db4, 0xb7c656c5,
-       0x18ce9297, 0x54d50fd8, 0x145131af, 0x78636c3e, 0x2a1b5258, 0x367fd20a,
-       0xc2464bdb, 0x25afa53c, 0x1d7fe00f, 0x87a61bf4, 0xb1d366dd, 0x72cd7bf6,
-       0x368e06b7, 0x96d7d94d, 0xed877724, 0xff7c2597, 0x60904513, 0x7af94b3d,
-       0x6f782f7e, 0x9955f803, 0xe8530cba, 0xfd7eb7f8, 0xc5efca05, 0x75c6ca2b,
-       0xdbd70b8f, 0x1757c88c, 0xf7c5ea3f, 0x399b6faf, 0xcdb7d71f, 0xcfdc00ac,
-       0x9e9014ec, 0x025aa717, 0x5bcffa26, 0x5b9f4c6d, 0x8413bf4c, 0x848c7081,
-       0x331dd9db, 0x6747409d, 0xdfcf1b09, 0x59e4e4ca, 0x9b2bc299, 0xcefe81b5,
-       0xebbe31b6, 0x33f33adb, 0x778b4fe0, 0x67902e8a, 0x1aeac3a4, 0x7d3ca04e,
-       0xf40b42e4, 0x0a6e2977, 0x6bbcdf6d, 0x7be22cba, 0xfd8013d1, 0x6f3bb923,
-       0x5da5efa5, 0x78df5013, 0xcd91a763, 0x0e7a66d3, 0xd7eb71d6, 0x92c7ea22,
-       0x2f41788e, 0x47b8366b, 0x76557ec2, 0xf0033b3c, 0xb2567672, 0x42ffdb0e,
-       0xc3c03220, 0xde0122b6, 0x0f24162f, 0xad8acfec, 0x72e1a595, 0x11136cd9,
-       0x1e32535f, 0xe0b2e84b, 0xe407ba7e, 0xba4ed554, 0xd9fc607f, 0xaf7fbd1f,
-       0x3d3f7c23, 0x6174445c, 0xbfc77672, 0x5fc13d20, 0x34f808b0, 0xeef5c583,
-       0xbab4632b, 0x80726a2f, 0x5d5e2e5f, 0xa20f2393, 0x8bedf7bf, 0x8e1f741d,
-       0x4d836426, 0xb0755720, 0xfd1aed31, 0xdfbd2876, 0x0373ab92, 0xe22e4ddc,
-       0x133e967e, 0xa0bf548d, 0xa025f07c, 0x1a78788f, 0x97d23e10, 0x877ded0f,
-       0xcd926bae, 0xc7a053fb, 0x07cee20c, 0xb9212bbc, 0x005baa98, 0xc80fd462,
-       0xb7d3230e, 0x6defa624, 0x81cf2789, 0xfb8ea0be, 0x1e2fe84b, 0x1b1ec2f9,
-       0xc3e7b7ed, 0x5c018eaf, 0x8fcfd3ab, 0xbbecf905, 0xa14185f2, 0x0bb4b5eb,
-       0x2e2dafc8, 0xf17a010f, 0x0b22cfb5, 0xacf9faf2, 0x40e4c5cf, 0x6afebae4,
-       0xcfb67a63, 0x4e7ec211, 0x6dfed9db, 0xdcfa31b6, 0x002a22be, 0x23bb75fc,
-       0xff498660, 0x7c94fbbd, 0xc538a545, 0xe189a573, 0x57e7b4d9, 0x3be8116e,
-       0xa1c3c820, 0xd1fdb0ac, 0x202f315b, 0xdb3e71d2, 0xf2c7ed93, 0x912e29fe,
-       0xfcf659d6, 0xe00b2eac, 0x4177a6d4, 0x2bab8b7b, 0xd9f7d606, 0xb031539e,
-       0x223d8abe, 0xf022bbae, 0xbcc2c279, 0xbaf0be7e, 0xc00dfde0, 0x4b04388b,
-       0x6cf87f38, 0x0584a5cf, 0x98395416, 0x1c1c2c7c, 0x29e4472e, 0x5bb7809d,
-       0x3978616f, 0x00630bf7, 0x3339def8, 0xfc615f95, 0xc9959cf6, 0x263693b3,
-       0x4d69091f, 0x57d37907, 0x07573fbe, 0x6648ffe3, 0x5a1877eb, 0xfe3f61d3,
-       0xe7eda0b7, 0x091d3ac1, 0x595ede50, 0xf9434147, 0x5e17b9d1, 0xff7e0749,
-       0xa4afb3d9, 0x2fcd8597, 0x79f53bf2, 0x9aedc6de, 0x26dda7a6, 0x51195e3a,
-       0xc2a60bc7, 0xe32e6578, 0x485fc027, 0xdf7774dd, 0xcf62c9be, 0xab64f6f0,
-       0xaf60f91b, 0x1d00a8cb, 0x56f5dfaa, 0x804db944, 0xfe426217, 0x062ed657,
-       0xdb9fd08d, 0xfa01cc3d, 0x447dfab6, 0x4638aeff, 0x809b424f, 0x5e746976,
-       0x77f1f908, 0x2d4ef7e6, 0x7f9e293e, 0x32ae7801, 0x10a58e85, 0xc0030fa4,
-       0x916d50cd, 0xac253e40, 0x7a15f461, 0xbffa8744, 0x0169d921, 0x4e6b767e,
-       0x6e8ead54, 0xcc544744, 0xa7f54258, 0x6c5ce4b4, 0x74662fef, 0x81204fef,
-       0x590c0235, 0x96bf2023, 0x3a9c5e99, 0xb40dc891, 0xd33b3df8, 0xb5c49c57,
-       0xbc46cc55, 0x507fe00b, 0x05caa1e1, 0x8fe01fa0, 0xd21304e7, 0xa02ed08f,
-       0x5aea289e, 0x43bf41e7, 0x5d9e53d1, 0x3d1953b5, 0x49ff95f5, 0xe76454f4,
-       0x9e803bf4, 0x93d20abc, 0x3d3834d3, 0xbbf90229, 0x07bf13da, 0x0e44acec,
-       0xef9c4daf, 0x31311e84, 0x19050abf, 0xf794b7ac, 0x04b26a57, 0x2e1f9045,
-       0x30aef9fd, 0xd507627b, 0x494ec16f, 0x3e9e7d02, 0x57ccd653, 0xb3a46f10,
-       0xe8daec0b, 0x8f942609, 0x999d75eb, 0x8e24afa0, 0x7407d9aa, 0xaf2f3891,
-       0x67da0d60, 0x079036a9, 0xbfd15b20, 0xd3d8a2b0, 0x2fa6171d, 0x2fa80874,
-       0xc6ea3f54, 0x99db53f7, 0x661be07e, 0xd7d77d40, 0xcf01f826, 0x00431ed5,
-       0x817aa0f4, 0x1bfc01f9, 0xefd80acc, 0x156536cd, 0xbff34fd0, 0x5d3f2e29,
-       0xf9806f47, 0xd7497a13, 0xbd009fae, 0x3ed05855, 0xb605b66f, 0x7776822d,
-       0x03bb61e7, 0xf8d9137f, 0xdf8e09c3, 0x7a8adf9c, 0x0a6df37a, 0xfc7003f3,
-       0x2772cf35, 0xa81f40d9, 0xe6e7eed3, 0x9d927716, 0x52b5efbe, 0xcaf1d0c0,
-       0x8788cd1a, 0x99c19164, 0xfc989ac4, 0x4c17c819, 0x8984f700, 0x4f4d311c,
-       0xb7d3bea3, 0x80a729cf, 0x6faf3272, 0xd0e3a4ce, 0x3cf35879, 0x9f79a099,
-       0x3c7e5a6a, 0x024fd28a, 0xc46e87f8, 0xebd07e26, 0x564c61a3, 0x4f70c376,
-       0x9244e8e9, 0x86cef6a1, 0xcac39369, 0xf7ff7dbc, 0x69f6efff, 0xfb7728a9,
-       0x54da61ea, 0xb765ab1e, 0x9d6bce99, 0xa25ebfb5, 0x4da9aefa, 0xd7fbdf60,
-       0x8a9d3edf, 0x1d415ee8, 0x377aceff, 0x44cca9f8, 0xfcf85e33, 0xf5fe88a4,
-       0xa28b7fb4, 0x02565fb6, 0xa0553dfd, 0x73aedf96, 0xd26df9d3, 0x9043fb6b,
-       0xa0a1eff2, 0x4f8be78e, 0xdc9c686a, 0x3d5017af, 0xdf1f6021, 0xfbac1faf,
-       0x06e9b4a8, 0x7cb4563a, 0x577200c9, 0x873ef395, 0xe447fa80, 0xef897d7e,
-       0x57ccefd7, 0xba3d5187, 0xbf47a348, 0xdabe4764, 0x24b60335, 0x6f903fb5,
-       0x10f31efb, 0x3ea8e7d0, 0xfa8ec072, 0x4733f9c8, 0xeccf7d68, 0x514b1cbf,
-       0x79b2dda0, 0xaefaf7a0, 0xbeb74848, 0xa04062bd, 0xfbe26b74, 0xc0f1ca85,
-       0x9e9fa170, 0x9d39941e, 0x0744fcda, 0x8c21df74, 0xd57d23f7, 0x714ddfa4,
-       0x3ee71299, 0xb7ef8f62, 0xfdd7231b, 0x0fd99d91, 0x6de2dcbe, 0x1effd039,
-       0xd09e8081, 0x61327b90, 0x9f4dda01, 0xfb0c2c24, 0x29edb2ae, 0x5ee56784,
-       0xfc70a0fd, 0x1c222ec8, 0xecbe0fab, 0x2e71be06, 0xa84f2020, 0x37f50290,
-       0x854572d2, 0x5241340e, 0x2f7f9818, 0x35cc8fac, 0x7d74e190, 0x409bd041,
-       0x977bda8f, 0x375846ff, 0xafa04ffd, 0xa1167bb6, 0xd73edd3c, 0x30992164,
-       0x0865b2cf, 0x0dca3907, 0x2dc86870, 0xaa71824e, 0x4590cd67, 0x1c7aa7a8,
-       0x7a3f57d4, 0xd30c405f, 0xf4da1b03, 0x14e7a025, 0x57ee7d51, 0xf669de74,
-       0x745c4bdb, 0xfb88a71f, 0xe5a61ff2, 0xf1f0432d, 0x6e4c1c47, 0xff1e0ad4,
-       0x5fd10af7, 0x6ffdc247, 0x6f4c6d19, 0x683768bc, 0xed17affc, 0xd9377e12,
-       0xc81539df, 0x15d4b0e7, 0x8fb4fa0d, 0xfb073fb8, 0xca2c7899, 0xc62788b3,
-       0x152b1c8f, 0x1c992bf4, 0x806feb5d, 0xda12c9fa, 0x7aea442f, 0xa9edc612,
-       0x081ab877, 0x7e5007df, 0x9eed0f34, 0xabde71f9, 0x5c454740, 0x3839ed4f,
-       0xaf2cbf33, 0x7faaef5f, 0x0d581ad6, 0x3caad4fc, 0xf4fc0251, 0x24f9094b,
-       0xa73a8531, 0xff2a7ed2, 0x1b7ec76a, 0x7151bda2, 0xe6f5fe74, 0x81d03d40,
-       0x76c445bf, 0x20a6d98e, 0x73d9f3f4, 0x2fd016d6, 0x02268ef5, 0x15cd4c74,
-       0x1c9887f4, 0xf2d0a21e, 0x497cff54, 0xa1117900, 0xbf054ccf, 0x0e2bda11,
-       0xf3162bf4, 0x529c31fd, 0x6e1319c1, 0x71abda85, 0xf1cdfafd, 0xf048e6af,
-       0x747bd552, 0x9de7e626, 0xc08a3736, 0xe86d64f8, 0xcafc0e98, 0x7a024e8e,
-       0x80ab5570, 0xbee554e3, 0x65bb0064, 0xdfdb2b49, 0x50676e3e, 0x5e83a5f8,
-       0xcd171d91, 0x465acbf5, 0x58f3a4ef, 0x45f9c00a, 0x68424f86, 0xbdb86b3b,
-       0xd5d98ab2, 0xf7033fbc, 0xbf715787, 0x58849511, 0xd54e363f, 0x67f35633,
-       0x71f27b13, 0x6e9d08b7, 0x2f99e011, 0xeab6fc68, 0xe31c7a73, 0x4347b13b,
-       0x86ff6033, 0xff817d28, 0x6b309b68, 0x7d749bd9, 0x728fc6db, 0xa4e60a81,
-       0xc01624e4, 0x148a4a7b, 0x9f6d85ee, 0x21ba00cf, 0x6bf70425, 0xb114db75,
-       0x400dc78a, 0xae8c485f, 0xc4fa8169, 0x3e517207, 0xfc1f1f83, 0xb87077ff,
-       0xff985926, 0x9fdab9ce, 0x8c1e50f9, 0x26f659ef, 0x0a263f8c, 0x148915e3,
-       0x3e3b5637, 0xe57fc0eb, 0x4047f924, 0x954b3afe, 0x1a8f9802, 0x89d78a37,
-       0x43cacc0f, 0xbb658e3e, 0xa6ef704b, 0x6ce3bbcf, 0xdf6a2eb8, 0xe17cc095,
-       0x0ddb807d, 0x4e274760, 0x7187c9ad, 0xcf044e21, 0x84a0a49e, 0xcf2a68fe,
-       0x6d3a059f, 0xaf00ca33, 0x3eb7b6d2, 0x6a5b7900, 0xe822ad22, 0x4b7a113f,
-       0xf35dcc56, 0x2f7b6e80, 0x38f5d99c, 0x03eeebcc, 0x47e22f2e, 0x7adc8fab,
-       0xcfcbd30b, 0x80ad1b3d, 0xf39bb91e, 0xb23faa6d, 0x982fc138, 0x47a9191d,
-       0xb5a7123e, 0xffcafa4b, 0xcd923d70, 0xf7e74fcf, 0xf77f186c, 0xb7afbb71,
-       0xc80c62e2, 0xf47d55af, 0x517fe546, 0xb6529ebf, 0xd813fa27, 0x45767d67,
-       0xb5223e84, 0x840538b0, 0xdaef90d9, 0xe2fe3c0c, 0xff07ce76, 0xf9072d87,
-       0xa2e7f1cf, 0x173740fd, 0x97a8cd5b, 0x10433649, 0xb2fb55e6, 0x8013a031,
-       0x7578720f, 0x818ab8f0, 0x39ec6bc7, 0x0714280a, 0xfbe41e0c, 0x2cf497fe,
-       0x781312ae, 0x5e5a39e1, 0xc789387a, 0xeff6085d, 0xf08d183f, 0xc4a51a5e,
-       0x7f4bff42, 0x9e20471d, 0x03c74bd2, 0x7b37cf3c, 0x4d780a7f, 0xc9feb236,
-       0xc585466b, 0x36398279, 0x0096870a, 0xe54effd3, 0xba0682ea, 0x17d016ee,
-       0x3546dfa0, 0xd9d6c2fe, 0xc58521bb, 0x0119400f, 0xfb9eacbb, 0xcab8d5e9,
-       0x2b87e661, 0x5393f1e7, 0x033d17b3, 0xa15ab4a1, 0xb4ec04a6, 0xd0530dcb,
-       0x89fcbd6f, 0xaf2cf859, 0x17dbfad3, 0xaf7c1a91, 0x3f5527c6, 0x19711977,
-       0xefdcfe98, 0x7d51d43f, 0x8a93a946, 0x12667e41, 0x03c83579, 0x37b14fc5,
-       0xe96b3e81, 0x81789413, 0x93b69942, 0x80511dea, 0x3ab575ef, 0x5afe5b94,
-       0xa9da1b9d, 0x1c56f2f4, 0x57fd23f3, 0x5097f31c, 0x1c600750, 0xe7ab59f5,
-       0xdfde7efe, 0xc20ba22a, 0xe7b02753, 0x192a593a, 0xfdab7e4c, 0x4c6bead5,
-       0x4e6f4053, 0xfb3fa1d3, 0x173dc1b2, 0x1cf6c5fd, 0xb5ad53c4, 0xd584aea6,
-       0x6cba5ee3, 0xfeb0790e, 0x96298966, 0x3f03b144, 0xfa6388ed, 0x16dc2445,
-       0x91cb6936, 0x80ca9071, 0xbc4e5cb6, 0x59b29223, 0x7dfc20dc, 0x9767e707,
-       0xbc39321b, 0xbbe0065d, 0xa557faea, 0xd2e9b832, 0xad2b33d8, 0x41d02e78,
-       0x3285f816, 0xaafcc9e1, 0xff382574, 0x021d9bac, 0x7cc447d2, 0x9e8c6d6b,
-       0x0fccf5fc, 0x3fcef7f9, 0xe367de72, 0x763ef812, 0x56be213b, 0x5e301b2e,
-       0x12fead7a, 0xdf6b4393, 0xf1ff95f6, 0xe7b32df6, 0x2fc645eb, 0xa97c8c88,
-       0x396b664c, 0x0b9eb825, 0xd50b7bc2, 0xf51d601b, 0x91f00162, 0x705977a9,
-       0x2987d51d, 0x55f5a11f, 0x83a5758f, 0xee2eaf5c, 0x80bc81ca, 0x6cc2f848,
-       0xd19f9525, 0x6a0e6576, 0x50de808f, 0x0d878da7, 0xd3ba038c, 0xeec1e31c,
-       0x2defb539, 0xccfb5f90, 0xbfe8bf28, 0xff61188e, 0xbe44cc1f, 0x3bc589f6,
-       0xbe3ee21c, 0xe7aee0a8, 0x618f4133, 0xbb55547a, 0xc4f405b1, 0xf8b0dab2,
-       0x51affc1a, 0x75236f1b, 0x93bbf476, 0x8afbed66, 0x0ddf111d, 0x2135bf88,
-       0xbc18b65e, 0x53bf6123, 0xf1f18439, 0x023a950b, 0x5d172df8, 0x5d48408b,
-       0xf3f56b30, 0xaf86560b, 0xfe550e69, 0xcf0072b8, 0x7801e57d, 0x9e00e576,
-       0x1bc475cb, 0xe0154fde, 0x2977e299, 0x9785f3c7, 0x9e00e427, 0x909befcf,
-       0xa2de7803, 0xbec3726f, 0x4b7b2599, 0xd3dd8e00, 0x415fa83d, 0xd1f613bc,
-       0x7de3d2b5, 0xf464f37d, 0xf390df78, 0x5bf8c7fc, 0x8b8f9286, 0x95a1e6fa,
-       0x92830e8f, 0xcca0fc0a, 0x3946fc64, 0xfa837f09, 0xf4464cf3, 0xeafe1c7f,
-       0x1bcc46d2, 0x3f511768, 0x2c3bfb51, 0x3f41b379, 0xd381fc3a, 0xee8617e5,
-       0x8afc0adf, 0xe0fcffc5, 0x02ed5167, 0xe48cbf55, 0xfbe63fc7, 0xfdc3b37a,
-       0xd83bfd99, 0xb8ffaaa7, 0x0531b782, 0x77bd312e, 0xfe62e08f, 0x27f456e3,
-       0x97cc7757, 0x69fc5fc1, 0xab8ff980, 0xff47ce5f, 0xf5e06571, 0xdfc80a60,
-       0x7b064176, 0x27cf72a4, 0xfd2c8b31, 0x73b52f76, 0x886e809b, 0xfa471b49,
-       0xa62a7034, 0x3ef382dc, 0x768ef30d, 0xf7400c84, 0x23fed4d5, 0x52d54974,
-       0x5bf418e8, 0x17a820ed, 0xed69b614, 0xb8054a41, 0x031eedee, 0xededddf2,
-       0x75f80042, 0x999bc182, 0xa48d720a, 0xe40718ca, 0xc3976cfb, 0xe8f301dd,
-       0x03bb6b8f, 0xa33cb08e, 0x48b16dae, 0xe27a5dbf, 0x6d9f8196, 0x267e72b3,
-       0xf3fb7f21, 0x21a05b0e, 0x73f86f4c, 0x9509e980, 0x4491be6a, 0xd7c51282,
-       0x0fee39a2, 0xefc0df01, 0x3efc1183, 0xa3c6acbc, 0x3cfc4097, 0xde1dee22,
-       0x1f8e2fae, 0xf4d6f716, 0x95f26a43, 0x5bdc6d42, 0x7667ef5b, 0x2b0fdd33,
-       0x57e9fa0a, 0xbf4a83c5, 0xed1fdcd5, 0x16b938ab, 0x26d7d7e8, 0x2f5f60c8,
-       0x5dfa3175, 0xe32fed4a, 0x9dfb81d8, 0x0dfa52b4, 0xed4377e3, 0xe4228fff,
-       0x7bff47d1, 0x3b5068f2, 0xf8df74fd, 0xebabdf6c, 0x7df7fd57, 0xd8176ceb,
-       0x57588cbe, 0xe91adda4, 0xceed5777, 0x5f87e56b, 0xafc3f045, 0xa1f88ffe,
-       0x7e287e29, 0xfc6b8da8, 0x7ff0fcdd, 0x4cf1be39, 0x3a31d3c7, 0x332a2aca,
-       0xd7a64efd, 0xe2f135b9, 0xcdc5a219, 0xcb22a6e2, 0xbb8c8897, 0xdc78332b,
-       0xd7e7ed9d, 0x5f11165f, 0x5c3e3c55, 0x417561d5, 0x62cb0ad3, 0xc646cf8c,
-       0xfb241f4f, 0x228a0066, 0x614ba8e3, 0x7b7f671f, 0x9e3f353c, 0x5ce947c5,
-       0xa14f2132, 0xdfcb58a8, 0x8a5cb75f, 0xbbe186f3, 0x021a8f38, 0x49b5d083,
-       0xd87b13f2, 0x99e35bfb, 0xcf3afd3e, 0x481a71e7, 0x6ca1e41d, 0xc1bb46b2,
-       0x58ea718e, 0x9c4a51be, 0x78fc4a67, 0x9e1cefe0, 0x744fbf07, 0xe8cf2e14,
-       0xf89f915b, 0xe02e2cab, 0x471faa7f, 0xf7077fed, 0x9d2b5e83, 0xddaf1bdf,
-       0x7fe57df7, 0x572fbed2, 0xe37bfbc7, 0x6c295b76, 0x2081fb34, 0x38809efd,
-       0xba40e653, 0xa19faa1d, 0xbc7977e8, 0xee3c5967, 0xcc58f73b, 0xfe46bd9f,
-       0x3a185d12, 0xb222fe05, 0x7f80a8df, 0x2825fc13, 0xb8931b17, 0x022aeebd,
-       0x2ebe4338, 0x0c7d6be4, 0xb4349cff, 0xb7d8d8fe, 0xd8fe99ff, 0xe907fe57,
-       0x9ec8378f, 0xeeceb08d, 0x901cee29, 0x74aceb6f, 0xbe1760fe, 0x768cf2c0,
-       0xee7d1998, 0x925d1810, 0xe4d77115, 0xaf13d977, 0x867b9fe5, 0x2efff79c,
-       0xa7fd6cff, 0xc4bfcff1, 0xe8751f80, 0x2f2cfc7e, 0xcdd3b8b7, 0x776469e3,
-       0x07db7f98, 0xfbf466f9, 0xeabe7c23, 0x2e5c9dfb, 0x47dc125a, 0xff9c1f81,
-       0xb12264d0, 0x6429e554, 0x63dab17c, 0x7542f8c1, 0xa97bcb2b, 0xff208c7e,
-       0x69ff06ae, 0x6715f81e, 0x26f7d011, 0x0027bcd9, 0xb23eebcf, 0xf058c5f8,
-       0xa026cfbb, 0xc87cf5df, 0xbd967fca, 0x7bef509d, 0x19e30bac, 0x61cfb3cd,
-       0xd5d155de, 0x0a4b6b4b, 0x47e8be71, 0x4d491870, 0x1afe9e38, 0xd596f2cf,
-       0x783e95e7, 0x7fafd1bb, 0x11e582be, 0x196e1cfb, 0x5faa11fc, 0x44e95a3c,
-       0x7ef5533f, 0x8915b4a6, 0x27e43d6c, 0xd54f48a9, 0x83e4a7fb, 0x9ab494ff,
-       0x2dcf41f3, 0xed05a3fa, 0x268ff3bd, 0xfcc49e63, 0x9859ef38, 0x7030b5af,
-       0x19a5e81b, 0x77d01c74, 0x2dbbefcf, 0xf2ade61f, 0x3fe02dbf, 0x58b7eda7,
-       0x62717eb5, 0x95ddf962, 0xfea8a7cf, 0xb7f410f3, 0x6243ef85, 0x359a2a69,
-       0xf757bec8, 0xc3a8a27b, 0x607f13fe, 0xcab938c2, 0x89e8b60f, 0xcfdd94d7,
-       0xcf10fe47, 0x3c1cfbde, 0x167db15f, 0x65e14fcb, 0xf0aa7f0b, 0xfe98ecdc,
-       0x1fc79807, 0xcbeba5e2, 0x4b05930b, 0x75eb3c78, 0x7887fbc1, 0x8032cf16,
-       0x8a314e7d, 0x2be8967e, 0x92ce7f4c, 0x5647480d, 0x3e30dfba, 0xf408e943,
-       0xcea1c9f8, 0x9d74b1a9, 0x93839ac3, 0xaf87be01, 0xd24f10e8, 0x9f1813ac,
-       0x78d81589, 0xf55d8dd9, 0x22ffc023, 0xa03377bf, 0x8b926952, 0xc937d421,
-       0x404e49e6, 0x2e4d7a7f, 0x7bfc578c, 0xec93cb3d, 0x42bf4688, 0xcc52fa73,
-       0xc8f9ec93, 0x489cfe88, 0xfd3ea0f9, 0x45e63564, 0x27fdb566, 0xfbac09c6,
-       0xd4dc0d05, 0x0b04f8e7, 0x3bf95f8b, 0xcd6e6067, 0x57f20764, 0x188fe3a9,
-       0x25ea969f, 0x56a43ce0, 0x8199d6ef, 0xe822ad7f, 0x2cde1ce7, 0x195f00eb,
-       0xf7a62f3c, 0x7ac75ff0, 0xe3514ed1, 0xd7960102, 0x0b5aefa4, 0xaab497f6,
-       0xe03f16eb, 0x574dbf63, 0x85fd079d, 0xd2cfd1aa, 0xcf804d11, 0xaf65b467,
-       0x339689be, 0x838c64ea, 0x925a1ef5, 0xba557e81, 0xac83e1ce, 0xe5813d33,
-       0x18133921, 0xd11d48bd, 0xd267903a, 0xd182e266, 0x32dd6b33, 0xcb8779f8,
-       0x25b9d212, 0x70025bc1, 0x807ce68d, 0xb8c288ac, 0x7e6255a2, 0x8f8aeb11,
-       0x44e7017e, 0x03f3f176, 0x9e8f0f47, 0x7abdfe8d, 0x5fb80049, 0xc9bcb1b6,
-       0x73da0939, 0x3ef0fd07, 0x59a7f98a, 0xe4c9ff1d, 0xfa0b1d17, 0x3e8cf497,
-       0x0b477aa4, 0x587711f8, 0x7b6f98bd, 0xc4506d73, 0xfddc9938, 0x66128964,
-       0xf2656ccf, 0xb32f7aa4, 0x97ed23bf, 0x5523936f, 0xd2395a09, 0xe927fe57,
-       0xae122b27, 0x5a212ed3, 0x4f522e7b, 0x06dfb489, 0xfd11dbe8, 0xa8afa50d,
-       0xfdc52779, 0xd9bd30e3, 0x7e43eaaa, 0xb14e5e4d, 0x4c4b8d85, 0xdb27feda,
-       0xcc8f9665, 0xd61274f3, 0x9024ab28, 0xd046ff57, 0x0be6a72f, 0x5e598bf9,
-       0xf9475f8f, 0x97c4265f, 0x284f309a, 0x01050485, 0x045d66fd, 0x7c844bbe,
-       0xe3ddfa21, 0xef385909, 0x2755c49d, 0x04547f22, 0xf219b798, 0x352f304c,
-       0x8c116db0, 0xc705b773, 0xc99e4331, 0x70154838, 0x3a7e036f, 0x11c582b5,
-       0x05dca992, 0xc61e4dfa, 0x973cd0e8, 0xf9a89be5, 0x87fe6a24, 0x0e62870a,
-       0x8b11e4df, 0xd5ef8132, 0x4017de0b, 0x1817a9cf, 0x981bfc7c, 0x46d9a11f,
-       0x6e5a68f5, 0xf9851cae, 0xf584bd7e, 0x21d0afef, 0x80f9aa5d, 0x7615c3cd,
-       0x226fe53e, 0xf9cdefea, 0x4064bf2c, 0x5c044a1e, 0x6e943cd5, 0xf603b7ab,
-       0xe4c8b26d, 0xa2379aa8, 0xfe1849d2, 0xde3a66fc, 0xbfa60ef6, 0x70185717,
-       0xb795bd1d, 0xb7b1ffa3, 0xce404752, 0x191bb717, 0xb78c45dd, 0x0481ae7d,
-       0x60295fa1, 0x8e79fcc6, 0x5fd36fff, 0xc1735e29, 0x65747bbf, 0x0a6eb8c9,
-       0x7a5637e3, 0x166bd9f0, 0xd7c8455a, 0x01e68731, 0xf89cda47, 0x49a43ba3,
-       0x4a135790, 0xecc92817, 0x54a0fe70, 0x37a072a2, 0x9431f43e, 0x9c7c4c5f,
-       0x76878795, 0xd1fdb409, 0xd8a51da7, 0x9931681e, 0x98253f90, 0xeb96fd4b,
-       0x40646f90, 0xc0a7c6be, 0xd748aa87, 0x0bf44eda, 0xc856f971, 0x669921f8,
-       0x94bf300c, 0x77b1fe82, 0xee513293, 0xf6b3725b, 0xaa7d4277, 0xb469fd11,
-       0xddfde91e, 0xbd5853e1, 0x524ef0c2, 0x836f2cad, 0x9f81f974, 0x05399bbd,
-       0xb055d2fd, 0xf4fea81f, 0x057bc5a6, 0xe8417af0, 0xe0fb0e5c, 0x9affe9dd,
-       0xe17df407, 0x01864fc0, 0xa06999bf, 0xfc20f97a, 0xe32771e5, 0x4b7abd2f,
-       0x79fb409d, 0x1215e2dc, 0xe883f969, 0x95203379, 0x14dc6e7c, 0x200d1c03,
-       0xe04417fe, 0x7f1cf177, 0x5f4c39b6, 0x08f34db4, 0xc6b9f790, 0xef11e6cc,
-       0xbfa8dc95, 0x7708e778, 0x11aff5d3, 0x94433eb8, 0x143bb458, 0x8eec1625,
-       0xc21e2ba5, 0xef916fbc, 0x9bad49e7, 0x7f97d045, 0x4df8f2b7, 0xe5a1b0d2,
-       0xf6115df0, 0x1254fa85, 0x8b663ad9, 0x8fa018ca, 0x6fe342b5, 0x3de0934a,
-       0x31e9b3a3, 0x5f210a2b, 0x4d74667a, 0x22cdc621, 0xf7d2c7df, 0x23656179,
-       0x14d4b76b, 0x3d28974a, 0x61decd3b, 0xf3cb9700, 0xfb0e593f, 0xbbf27977,
-       0xc2be431f, 0xd6e27abb, 0xe24d3ec3, 0x1f2a4371, 0x32c7bf01, 0x286e2c6c,
-       0x031a9d6f, 0xef866ce5, 0xe30048db, 0xd873a5d4, 0x483bc139, 0x6d176d67,
-       0x57a9d337, 0xece8c2ba, 0xbe5b4536, 0x2e5b5723, 0xff1179e5, 0xbfbed2e2,
-       0xc0248493, 0x7e26f7ff, 0xfdfc223d, 0x1beecd8f, 0x0aaffe61, 0x3fd28f2c,
-       0x87a8c889, 0xe83f043a, 0x495fa305, 0x5926e7e6, 0xb9cfdfbe, 0x44caf31d,
-       0x7b09f582, 0x0f21bb4d, 0x8b07f55f, 0x93b47ebc, 0xc8ec3298, 0x84ae508f,
-       0xe8379e04, 0x390918c0, 0x7e664cb0, 0x40d6da51, 0x5f3039fb, 0x5824b841,
-       0xa016e474, 0xd21342eb, 0x298a5175, 0x28e0e80a, 0x3f1f23a7, 0x55d2a387,
-       0x903c4491, 0x9e8740bf, 0xf577cf03, 0xfff011f2, 0x78233ffa, 0x29908a4e,
-       0xf231e612, 0x855908b1, 0xbd39a7e5, 0xedf9551e, 0x6fc849bf, 0x701ab4df,
-       0x16bf895f, 0x439f805b, 0x5fd6991b, 0xf3851c6c, 0xdd03f753, 0x091cc3bd,
-       0xfde672e8, 0x44983a4a, 0x2acaccae, 0x38f862bd, 0x410fe401, 0x738d523d,
-       0xbefa99a5, 0x4977c373, 0x74bb9fbc, 0x8a4cde2c, 0xdc9d1c78, 0x3f7cc465,
-       0xbfb42f5e, 0xf7e025f5, 0xdc4cc4f1, 0xb7887b74, 0x3446e80b, 0x4ba014b8,
-       0xdae5ce95, 0x9d29bf43, 0x79c9eb04, 0xbb73d704, 0xe4f58655, 0x6b9c3252,
-       0xae3ba7c7, 0xf461fa00, 0xefb1462e, 0xfb792aef, 0x3e8c2926, 0xec55f7e8,
-       0xf7ed68fb, 0x3dbdfa4e, 0xfa18fbec, 0xefc0de7d, 0x72220909, 0xbff3e76e,
-       0xee89e79d, 0xba829ab1, 0x917fd0b1, 0x13bf45d2, 0xc3f7d813, 0xe07be862,
-       0x7cdab9fb, 0x65d1320c, 0x88de3cc2, 0xc2998bfc, 0xd7404963, 0xdaaa99b7,
-       0x6fff68bb, 0xd4ccfc71, 0xf380bf79, 0xcbcd6f66, 0x57fc0379, 0xbfba2625,
-       0x055f60b2, 0x7ad202d7, 0xb19f78a7, 0xddfee365, 0x2d5ff401, 0x69d8477a,
-       0x69be82f9, 0xdc4cb2d8, 0xe3133b17, 0xc55fce07, 0xa00ebabf, 0x3ea7a003,
-       0xb798883a, 0x67722f8a, 0xedac262b, 0x3c087aa4, 0x9084bd55, 0xac9f961a,
-       0x8baff5a4, 0x530ccb12, 0x0bd030cd, 0xe3f4aade, 0x7b699dbe, 0x9e97f312,
-       0x04bef24f, 0xc37b9df3, 0x3412e9e7, 0x011fce76, 0xdf3a207e, 0xce5ffd5f,
-       0x06bfd557, 0x667ee7e4, 0x0ee7e4d0, 0x71d47fb5, 0x8957a07d, 0x82dbc790,
-       0x39beb6f9, 0xab9c1716, 0x68be41f0, 0x5079c621, 0x30243aaf, 0x982fd57d,
-       0xad741eb8, 0xe984bc79, 0xfa7d554b, 0xbd0f2692, 0xbbcd9f39, 0xfa829979,
-       0x6b02abd6, 0x984f9fef, 0xd78b363e, 0x5eb1942f, 0x6e6f57cd, 0xe6b5fe61,
-       0xd0284797, 0x50a3d52f, 0xae58931e, 0xfe3265a7, 0x91493cda, 0x44dc0cfd,
-       0xafcfe848, 0xfa67a2de, 0xab9d76df, 0x0c41f308, 0xf1623f54, 0x869fc65b,
-       0xfd23f1b3, 0xaa275f70, 0xc3f30076, 0x41ff95f5, 0xb259b87e, 0x7f693897,
-       0xe9dcf30b, 0x17982cfa, 0xfa51c7f3, 0x2049d1dc, 0x1866ac4d, 0x91b7cde8,
-       0xd974f79a, 0x68069f48, 0xa534773f, 0x7d0d6ccf, 0x8cf19d1a, 0x22bcc21f,
-       0x1d2441f9, 0x6578c566, 0xd6d9a7e8, 0xd06ac7fa, 0x2e8ddb37, 0xf2ca7f96,
-       0x40f922e9, 0x48167cd8, 0x510e3e6c, 0x0738f9c4, 0xecb5cf9b, 0x4cfa7093,
-       0x0c3f6c24, 0x25125fb5, 0xf416b7e2, 0x9b1f97ef, 0xbd6023bd, 0x2d66fb7d,
-       0xcc062fb3, 0x7d20b45b, 0x8b2f73dd, 0x99a2f837, 0x43b8835c, 0x167f1d12,
-       0x7a9eff1f, 0xfcf78746, 0x4b7480d0, 0xf9841fa7, 0xb3f5e6cf, 0xdf30abda,
-       0xfd34f668, 0xff0d2ec9, 0xe7bc2375, 0x1c7376f2, 0x02d87af9, 0x71b54a73,
-       0xb3f7b985, 0xa4ddc6b8, 0xbdf30f46, 0x9fb68e67, 0x73f1a4b9, 0x7b9a9fc8,
-       0x54fdf6bf, 0xc9b9df67, 0x788f1011, 0xbde1db83, 0x7ec0bf74, 0xf17e337a,
-       0x7e94658e, 0xaf34fc47, 0xd303fc00, 0x6cf72a13, 0xb7e7e5a6, 0x9bf2c28f,
-       0xd1f83f09, 0x2bbf50bb, 0x20d3cb07, 0x08ec0c19, 0x6f208fd8, 0x3dbdee8a,
-       0x86fb8e93, 0x8cbbf799, 0xa33bdbe5, 0x68b3cdbc, 0x2cd8e73b, 0xc69c1bcc,
-       0x42ef4df9, 0x0dc77f56, 0xfa1a9656, 0xb97e8280, 0x79a15169, 0xf227ff40,
-       0x790050ff, 0x78b2d3ac, 0x51d5e0b9, 0xf8437e50, 0x4dd81e7c, 0x0916553d,
-       0xcc9d5fe0, 0x73a399fc, 0x0a48e085, 0xde766997, 0x575b157f, 0xc90bc169,
-       0x15a63fb0, 0xbb467eb3, 0x4367d4a6, 0x2c45dd3b, 0x629b24f7, 0xfbaa1f80,
-       0xfb93996c, 0xe49eb807, 0x15fefbe1, 0x71b527f7, 0x498f5fb4, 0x3d12c170,
-       0xfb413f13, 0x39d85894, 0x533b8f2c, 0x54e87f02, 0xdc73cb37, 0x02ac8aba,
-       0xcdeb647d, 0xad0d696e, 0x7a226a9f, 0xce946b90, 0x9b7a011f, 0xf4f3e13b,
-       0x8b2e2018, 0x3a55ce96, 0xf7d2a59a, 0xd31d2d34, 0xe713f9fd, 0xcfe76ff8,
-       0xf7363a1a, 0x7a50f1d3, 0x1d579d39, 0xb49bbfee, 0x9c6faaf2, 0x39187d88,
-       0x01fc50ee, 0x67f9c2fe, 0x715afcff, 0xb642a5bf, 0xc7ec3658, 0x6e3f7526,
-       0x7418f803, 0x24fe789d, 0xc28d7043, 0xe8439b03, 0xd2fcea15, 0x305927c0,
-       0x27f05e70, 0xfb1d7aa9, 0x9b1d8073, 0x77e9ebca, 0x9fef626e, 0x05ff1d17,
-       0xd96b7fe4, 0x350a767c, 0xbd709f8c, 0xab7fb55a, 0x69b6f5d5, 0xc5145bd7,
-       0xc13b7bce, 0xe93e814f, 0xf37d51fc, 0xa83c06be, 0x3971f1eb, 0xb1e4c73d,
-       0xeedae81a, 0xfd2395b6, 0x5ff89f7c, 0xa0e87d06, 0xe6187bc5, 0xefe75479,
-       0x2163fb00, 0x925c6371, 0xce6bc7d2, 0x9d42fd30, 0xaa9c246f, 0x919fe087,
-       0x4f8489eb, 0x513ade3f, 0x77cf539f, 0x1af7adf5, 0x21eaa9d7, 0x3fd6830e,
-       0x1cfee764, 0x00dff73b, 0x2e3c8145, 0xd02e5125, 0x04baa7eb, 0x894a27d4,
-       0x6970f909, 0x76df9309, 0x5437d30b, 0xfed43f39, 0x8216f5b8, 0x2974a9fc,
-       0xd8c9e7e1, 0x30e922ba, 0x823d7491, 0xd9499e76, 0x39f600b6, 0xff4a25e8,
-       0xcc2d4bfc, 0xa9c57bcf, 0xf1aef5ca, 0xcafbd720, 0xd77ae403, 0xf337e078,
-       0xa3fc6d44, 0x2ff30af4, 0x7c10afda, 0x193eba96, 0x5edd720f, 0xf81e35d2,
-       0xeeb1add6, 0x1f9f012f, 0x361f98eb, 0x24fa8e12, 0xbc5fea9d, 0xdc8cfa26,
-       0xe95c6a3f, 0x94d78b4d, 0x1fdfbe34, 0x2ce84171, 0x38ae4682, 0xcdeff799,
-       0xf4a63a04, 0xf2897288, 0xc157abc7, 0x837f8398, 0x532c721c, 0x092d9bf9,
-       0x2e08dbf8, 0x8f8c3dc7, 0xdb758b9c, 0x0d1c5893, 0x8710f2e1, 0x572e74cb,
-       0xd110ee2f, 0x9dcd3f9f, 0xdcb834fb, 0x24f5c77d, 0x8dd7fb80, 0x5f097172,
-       0xa53a45d7, 0xd17fb420, 0xe2c67a8a, 0x1e31cbb7, 0x8eab6231, 0x72726128,
-       0x734a2064, 0xbde8c47f, 0x4c794d76, 0xfda6b26b, 0x9a596d0d, 0x28e0fcfa,
-       0xe3b8fd4d, 0xf8f29a05, 0xed351bce, 0xac507c27, 0xbaea4f29, 0xa6fed35d,
-       0xca6b674f, 0xac123014, 0x0283b9fb, 0x7dd74ed9, 0xcd3ee873, 0x7dbdfff7,
-       0x0b8871c6, 0x33f6e29e, 0x733bbbf1, 0xa8161c29, 0x4ca57c74, 0x08505fdb,
-       0x07c0450a, 0x4682dfd8, 0x853cd796, 0xdfbc2e42, 0x7d5a4d85, 0x6d56f162,
-       0xf37da2b9, 0x0395e05a, 0x8a6a21f3, 0x646c88e1, 0x7934c43e, 0x75e80ebe,
-       0x2fd51276, 0x91c63040, 0x1ac7c838, 0x1b7fdf6a, 0xb0c873fe, 0x6b3fc36f,
-       0x7a80d5bf, 0x7fb7e2fd, 0xafa41455, 0xfe2d4e8c, 0xff168acd, 0xfc5ab9d1,
-       0xfc5a5d5b, 0xe2d44ec7, 0xe2d6e6df, 0x8b44ae3f, 0x168f78ff, 0xb57389ff,
-       0x6af24ff8, 0xa1529ff1, 0x8d5a7fc5, 0x2b19df16, 0xf4ccf8b4, 0xffbda83f,
-       0x2aff0224, 0x7baeccff, 0x149ee228, 0xd185d11d, 0x0b474a81, 0xe798153c,
-       0xc7e9bc32, 0xe922719a, 0x3a8dda81, 0xda8b87bc, 0x6b85db71, 0xbdca0fa7,
-       0x491a5fd0, 0xf1244f1f, 0xb13b183c, 0xeef9455f, 0x40f8127e, 0xf2a15ea4,
-       0x1e3970ad, 0xc50eff6e, 0x27c806cf, 0x290f0f6e, 0x361ec09f, 0x43c3dbf7,
-       0x9087e9d1, 0x53fa838d, 0xee8bfa23, 0x2e3cd995, 0xe049abc1, 0xf225fd5f,
-       0x04e90fbb, 0x7ef9d227, 0xe3a1eb08, 0x1a35187f, 0x203f18fd, 0x7fcfd441,
-       0x74871908, 0x712007b0, 0x13e73e99, 0x5ce59f05, 0x7ee42f5e, 0xdbd9a70e,
-       0x16a97006, 0x300919bd, 0x9e276a6e, 0xe227221f, 0x855ee9ae, 0x976fe093,
-       0x7f06e908, 0x98f67d3b, 0x519c7d19, 0x289b87f9, 0x9678308e, 0x5172154d,
-       0x30a3157f, 0xfbeca80f, 0xb2a5ca02, 0xcecf61ff, 0x4707a624, 0x50acd73e,
-       0xf5c4d9e1, 0xfc0fa600, 0xe3c29277, 0x416bc433, 0xe064b9b8, 0xe63fb4fb,
-       0xf319feff, 0x4925d193, 0xec78ec57, 0xf80cf10a, 0xa241f386, 0x8c73cd89,
-       0xe8574c44, 0x8bc4d1fb, 0x49c7dffa, 0x7aee3859, 0xd632b289, 0xb7e828ef,
-       0xefa3c60b, 0x045c5ba7, 0xd3a2bdfc, 0xabffd045, 0xc32b0996, 0xf55bac1f,
-       0x7a72a5eb, 0xcc2563d8, 0xe7e1157f, 0x2729114b, 0x3d157c85, 0x94ed0f3b,
-       0xf0bb32b6, 0x18ceab98, 0x792a2eb6, 0xed7e706d, 0xc81cf4db, 0x96133d2f,
-       0x5ee14e0f, 0x3f1c9833, 0xa8e2cc9e, 0x6e9a566b, 0x0f497886, 0xbe3d078f,
-       0xf80cdc92, 0xe6172514, 0x417dc181, 0x0defb0b6, 0xb61f5a0e, 0x498b24df,
-       0x3c5bd653, 0xdac65978, 0x17483595, 0xd1af7e7a, 0x6487d4ba, 0x217f986f,
-       0x4c4f8f9a, 0x1027227e, 0xbfd2f2ae, 0x5812a74f, 0x674b28af, 0x9feaf634,
-       0xdc0146ae, 0xa93d38aa, 0xe93a35f3, 0xdeed6138, 0x2557f4e1, 0xfe601a77,
-       0x741c50ef, 0xea413c42, 0x56bde074, 0xffb8e975, 0x37f0e4ef, 0x908217ee,
-       0xe0946ff7, 0xd2f4268c, 0xd28e3cd9, 0xf477dae9, 0x6b25e204, 0x7e44cfc7,
-       0xb8d7b066, 0x1e4f05a8, 0xeca1677e, 0xea9e041d, 0x2e94e8d3, 0x61a3f387,
-       0x9e0edcc9, 0x3e002640, 0xca0f9906, 0xf66587a7, 0x59e3c3cd, 0x3fc3c1be,
-       0x4c7f9824, 0xa2bfd056, 0x13c4f87e, 0x1b1bf217, 0xc6cbe109, 0x50037495,
-       0xa561b71b, 0xa8737889, 0xa835221c, 0x3710251f, 0xfe6351d2, 0xfd395709,
-       0xebf052ce, 0x3787b05c, 0x0d53ff8c, 0x1f45ad94, 0x61b94055, 0x90ad8be4,
-       0xb981642b, 0x23bf3038, 0xa2b66700, 0xef7cfd46, 0xef07686a, 0x425f3e21,
-       0xacf9d3df, 0x821ed31f, 0x0f63d1f6, 0x51f50a7d, 0x9b29a096, 0x3f75177e,
-       0x45b04971, 0xb253855c, 0x4856d3e9, 0x8e28a17b, 0x4f47dfe6, 0xc646fd64,
-       0xbb2d1203, 0x93217dd9, 0xb1678f09, 0x1faaec73, 0xbbb2de3e, 0xc6f818a9,
-       0x53fd6d30, 0x96711e1c, 0x41678e97, 0xe7612a7d, 0x93fd7957, 0x7966debc,
-       0xe598b3a9, 0xdfbe681c, 0xb58ffbcc, 0x50bf18e8, 0xb1b78f08, 0xdebc4dfa,
-       0x093bd6ac, 0xfab1a78f, 0xb46f5e7a, 0xba12fcb0, 0xafdf35ad, 0xdc27e3e3,
-       0x30de23af, 0x89cc74fa, 0xfa30de22, 0x35da97b0, 0x9d85bd65, 0x25a79523,
-       0xfb53be6b, 0x1b8f9c7d, 0xf34b3933, 0x28d8699d, 0x34cefb6d, 0x710f2394,
-       0x0b521b38, 0xf9eaf534, 0xb3a7226c, 0x276b3276, 0xf4d46e39, 0x6251517b,
-       0x999fff61, 0xcbadd2a4, 0x90fb7404, 0xe2112b35, 0xb99581b4, 0x1f0144a0,
-       0x3f994fe1, 0x6674789d, 0xcb054acd, 0xb8bfdc99, 0x2c44e566, 0x0b74a6ef,
-       0x74accff5, 0x2d277961, 0x53f9f42b, 0x58950fda, 0x07ed1b64, 0x7ed34fca,
-       0xed14f9e0, 0xd24f9e07, 0x337ea0f1, 0x9bca0efd, 0xde507f68, 0xe58dd2b0,
-       0xb04b2bf5, 0x83d2bf5c, 0xe72b75e5, 0x95f1f3e2, 0x59ae7c5e, 0xbbf58159,
-       0x3beb8593, 0x22485f7f, 0x93bbb9e3, 0xdde7f7c7, 0x16dcf1ab, 0xd476e0c3,
-       0x32ffce01, 0x8988e788, 0xa5c63fd1, 0x8f5b1ad2, 0xe719bd80, 0x6a48f861,
-       0x5b7ac1ac, 0xfd471b09, 0x24fc388e, 0x331d88b5, 0x5950fc64, 0x230df98d,
-       0x7317cb09, 0xc45289fa, 0x9fc25fcf, 0xbcff4214, 0xabe5ab94, 0x71f91199,
-       0x9923b3ea, 0xb0e279d9, 0xc72c371a, 0x8413d134, 0xcb8b5e7c, 0x33b1e78b,
-       0xa9ced0ae, 0xe57b1cbd, 0x5f80a216, 0xbfab54bf, 0x6815a7da, 0x4af144f4,
-       0xa533b635, 0x6769a7de, 0xda699470, 0x5cc92d95, 0xa47804eb, 0x1b1875b0,
-       0xbd101157, 0xe3379b0b, 0x999367b8, 0xebd74bbd, 0x3efbff47, 0xeb97ad81,
-       0x7ccbcf4d, 0xe446a6bd, 0xac6c23ab, 0xd7eb1398, 0xff3c3f01, 0xafdc58ab,
-       0x43a33dcf, 0x1248dfff, 0x46be01d0, 0xf50cf153, 0x96174863, 0x4aee006f,
-       0x1144f9cb, 0x848e3ca1, 0x7aa4bed0, 0xb3257fd3, 0x6633d0b8, 0x79a50b88,
-       0x23f9679f, 0x392b9441, 0xaa391f1c, 0x8a55b8fe, 0x4e9da7f4, 0x7b56fb46,
-       0x5b8d449e, 0x2516b2ae, 0x33d13e82, 0xb44f7e44, 0x169bbef3, 0x27463850,
-       0xfaa7c5cd, 0x1ba2bd7e, 0x55e57cf4, 0x4cefaf0e, 0x77c601e7, 0x6afce8c2,
-       0x0bbfa532, 0x0c83bf79, 0x2c3d5219, 0x1af0f684, 0x941fcabd, 0xfd0fe058,
-       0xe62c5765, 0x2127b473, 0xc199447c, 0xde95b9e7, 0x7fa9249b, 0xf997e29d,
-       0xe49be432, 0xbdb67cf0, 0x34dd972b, 0xc75fea4d, 0x5fb614e8, 0xf22b4973,
-       0xce875cfb, 0xa735ecc5, 0x0f33bec6, 0x79c3726b, 0x7114715f, 0x48c42e41,
-       0x5ee784d2, 0xc889bfc5, 0xb7a3c47f, 0x17ea8511, 0x40807251, 0x2fda873e,
-       0x8fe276e1, 0xc2fcbf38, 0x2de70d32, 0x94f7aba6, 0xf9af51b9, 0x90c97642,
-       0xb345f2cf, 0x4f123f1e, 0x6573eb6a, 0x4a5e07d7, 0x47f68b97, 0x517a60bb,
-       0x5f784db9, 0x204bb89b, 0x83ce02a9, 0x99d9a7e5, 0x5adfaa7e, 0xe0e3fc44,
-       0x2e37aed0, 0xa5dae005, 0xc2a9d01c, 0x8aabb69e, 0x3f06ec33, 0x0b8008d4,
-       0x2e5873c0, 0x5f2171c2, 0xab95deef, 0x14ee4e10, 0x6935e786, 0x7cf9dc2a,
-       0xf70ddb88, 0x566a2dbb, 0x3aed5bed, 0x7f15e7d7, 0x3b6bea0f, 0x8bd3cc45,
-       0x9885e784, 0x286263f7, 0x3346cba2, 0xa79d0cff, 0xc129e61b, 0xbe00e3bc,
-       0x58b3d704, 0x5ce00436, 0x5ad08f66, 0x31a97182, 0x971e123a, 0x53339f52,
-       0x277aff18, 0xb467c659, 0x0b4dde73, 0xef9785c6, 0xc31eba47, 0x122c4fd7,
-       0xbb7093cb, 0x5abf7095, 0xf0676a83, 0x3e28ea3c, 0xa0fbbedf, 0x2f3cb146,
-       0x0adce90b, 0xd9431779, 0x614c3f11, 0x3b7ef2f1, 0xe806a282, 0xf309bc67,
-       0x7cd41a1b, 0x055de514, 0x13e96bf3, 0x9c4c51f2, 0xd959d74e, 0xfaea043d,
-       0xbe30a656, 0xa3e392b9, 0x22ecc4d7, 0x27e4db88, 0x6f9f9d84, 0x58fb472f,
-       0xb6f4f38d, 0xd552fcb3, 0x49c950ff, 0x060df7a0, 0x221dde87, 0xdb2a77c6,
-       0x0ef760ef, 0xf7893c76, 0x14bed235, 0xde7287a0, 0x6b4ebcbe, 0xe3d82f0f,
-       0x0ca51b59, 0xc117bbb4, 0x03d9ab7d, 0x3b48eded, 0xae14b1fb, 0x3e48babf,
-       0x354e71c4, 0xa28b1f66, 0x126435f3, 0x2297bf3c, 0x6ef784be, 0x09b3ed53,
-       0x79243bee, 0x488fbeec, 0x6a92bfbc, 0x15ef3840, 0x5a5b8f08, 0x8ef7fe90,
-       0xef7ffb67, 0x0e778b91, 0x93dcfda7, 0x7ea6e0c1, 0xcb064f77, 0x0607dd33,
-       0x4adf7d15, 0xf960c948, 0xdc38bb3c, 0x9b9f33bf, 0x5573e5ac, 0xa2c75d6d,
-       0x3b77e415, 0x8f7bde81, 0x0f2625fd, 0xef0847f7, 0x833f7f2d, 0x0de607cd,
-       0x74fbf479, 0xa70bcf9f, 0x12297d83, 0xfaeeb79f, 0xda698cf4, 0x7bc85d79,
-       0x3676e12f, 0x579856af, 0x4264f04f, 0x3ab47e78, 0x83c57daf, 0xfd7cef9f,
-       0x9133e77a, 0x5068a7ce, 0x26fd1d38, 0x0c33ed38, 0xf80f9f3e, 0x0de3fe7c,
-       0xc0c0ef76, 0xd3d4ebfa, 0xefc04476, 0x807bcec5, 0x7ef9d35d, 0x847a0290,
-       0x63013bb3, 0xad7e1c4c, 0x0b3e9c85, 0xa171df39, 0x1f7c444d, 0xa4bcc04d,
-       0xfbd58956, 0xab028bec, 0x8ebafd28, 0x7900c82c, 0x88d0fd60, 0x86f8c5f7,
-       0x4b8b37c8, 0x97d8eb65, 0x870a0c2c, 0xe47f5e18, 0xb7f61944, 0x012303fe,
-       0xf5cb507e, 0xab72f5f4, 0x5501ee09, 0x02e508e1, 0x4219f4fa, 0x2e505c8b,
-       0x58a4c2fc, 0xc74f1906, 0xb114dbc6, 0xd4f1d46f, 0x973529a7, 0x3785ddf9,
-       0xdea3c844, 0xbc3df934, 0xa15367af, 0x3bf73c84, 0x4b59bfc3, 0xef82172f,
-       0xe8c9dc25, 0x7a0a94c5, 0xe63a7094, 0x13ecb47b, 0x03cdbf42, 0xb8bc19f8,
-       0x4647df7e, 0x840c22d2, 0x2f4e25d3, 0xf5d4faea, 0xdeb6f3ab, 0xd6f300bc,
-       0xf1301f01, 0x7a9d5498, 0xd5f21e2f, 0x60f72e58, 0x2627285d, 0x7d0f2c4b,
-       0xdd7884bc, 0x3c46f134, 0xc78fb027, 0x0c93439b, 0x7e43de83, 0xfd7f1f0b,
-       0x04ecff95, 0xaedfd5fb, 0x44d9f3c7, 0x45de72ea, 0x8ef7c8e9, 0x52bdf784,
-       0xfb812a7a, 0xb89c8e67, 0xdd7a0318, 0x847aa94d, 0x0fc04df3, 0x115c3e41,
-       0xff7f304b, 0x18b217c4, 0x5393ff46, 0x7497ae45, 0xfe5e4276, 0x979602c6,
-       0x807ae16c, 0x057744e5, 0xf132dfcc, 0x4c2146c7, 0x1aa5e6ce, 0x868dbbf1,
-       0xf68b8250, 0x4910ebe7, 0x2e81f510, 0xefab47bc, 0xe0cc91dc, 0x05485d50,
-       0x47dc1e4c, 0x9ad7eeca, 0x3e30aa9c, 0x807de74b, 0xf91a8fbe, 0xf50e5c85,
-       0xacbc7485, 0x32adeffe, 0x78d467c3, 0xa6c59f76, 0xe193bfc9, 0x8158aefe,
-       0xafb43de0, 0x7935eaa4, 0xe8649ffa, 0x9d9dbf78, 0x65f9bfa0, 0x5b09f309,
-       0x40990f83, 0xc5f757af, 0x86dd54d3, 0xfdf8eb76, 0xe626ebaa, 0x805ce006,
-       0x4a7fc74a, 0x61527af5, 0xbc5f747d, 0xa7577a84, 0x47c22a67, 0xc97c87ce,
-       0xef13a431, 0x0685210d, 0xae4be419, 0x6fd9a74e, 0xea6f1c2d, 0xa8a5ea93,
-       0x69c23cef, 0x62f79559, 0x39e0898b, 0x62b32ba3, 0xd3152f41, 0x25cf3d54,
-       0x6cff1c03, 0xe1fa8399, 0x8d2d37d9, 0xf57cf1e1, 0xb3da9a79, 0x797f4341,
-       0x0333cba1, 0xde222fda, 0x2e8fa0b5, 0xe735166a, 0x7df2cfae, 0x144af0be,
-       0xf5e98609, 0x87de270b, 0x5e1647e7, 0xaa412189, 0xe7e59d27, 0x3cf2ce7d,
-       0x654f7f9f, 0xaf81b2f2, 0x75ea4b67, 0x08aefbea, 0x0ff3b97e, 0x7e3195cf,
-       0xf700eff9, 0x00cba12a, 0x8de36e7c, 0xfe3cc17f, 0x0f4ed4d3, 0x3ad37ce6,
-       0x6c3048e3, 0x5776be9c, 0x7e9eb84c, 0xff3828bc, 0x105af5fe, 0xfda9a70e,
-       0x4c70cdff, 0xbfb1c0d1, 0x1c0d2cff, 0x839ff607, 0x995e9fe3, 0x8ffd2dfb,
-       0x457fa21e, 0x7efeff33, 0x3db8e187, 0x8f9ecb47, 0x68e5fba6, 0x57f6f570,
-       0xb0ed5f21, 0x272fef11, 0x78c5ad6d, 0x0417e89e, 0x3f2d99cf, 0x90c7e5fc,
-       0xb77cb687, 0xf46305c1, 0x5cf343ea, 0x6187c883, 0x7dc3f644, 0x6f73ea3e,
-       0x27ae366a, 0x0a49bdf2, 0x666f90c8, 0x55e495ca, 0x9d65e80a, 0x1fb8d581,
-       0x549fc84c, 0x6fdab83f, 0x9ea88a6d, 0xad7dc567, 0x10d0dbde, 0x7c00eded,
-       0xe6a5167f, 0x8237f91d, 0x67f2ad1f, 0x85eecca2, 0xa21da1b3, 0xe225b1fa,
-       0x91a3bf45, 0xe5e40878, 0xdf7865e7, 0x53fefe00, 0xafc006ca, 0xe3d98e2d,
-       0xb723ff45, 0x3b9836f7, 0x7e30ae9d, 0xe954fbf7, 0xd6fce4fa, 0xfe333908,
-       0x4c82e7fd, 0xe61efcce, 0xfe762551, 0xf2132cb2, 0xbdf8bb08, 0xe3018a3d,
-       0xf0c78505, 0xd532afbe, 0x8c8baf5e, 0x40d9a75f, 0xeefd55ff, 0x044f9031,
-       0x9646c23a, 0xcd1e5dbf, 0x89bfe5ca, 0x907573c3, 0xf0079fc2, 0xec5d156e,
-       0xe119379e, 0xa1af917a, 0x1d31b4d7, 0xe1cbd9e0, 0x75fdb17a, 0x62ee57bc,
-       0x7fc470dd, 0xc13f6bf9, 0x25f6a17b, 0x0ea77cf3, 0x729fca2b, 0xee08aba3,
-       0xcc97db2d, 0x2956ccf4, 0xa6105318, 0x2d4bae77, 0xbe7abe46, 0xf40eb86e,
-       0x7fae1572, 0xa360fce6, 0x4293efea, 0x2ebbf045, 0xbf830be7, 0xdfb7f945,
-       0xa267bf8c, 0x1165f03b, 0xd1b76fde, 0x1782f788, 0x65b9181f, 0xcaafad2e,
-       0xa59e61d1, 0xe71980ee, 0xdd81a173, 0x82df03af, 0x903aae9c, 0x52c3bf82,
-       0x3cc21d1e, 0x5728aaa9, 0xca41c40e, 0xf784dc0f, 0x30da9f7a, 0xe5f81d32,
-       0x1d2578c9, 0x40dd35ef, 0x7dd74e81, 0x7b0463b2, 0xcf013f5f, 0x463759ad,
-       0x5ff3077b, 0xf22472a8, 0xc97d9efe, 0x006d3df9, 0xd726919f, 0x2d3e5a6e,
-       0xeb9c58b8, 0x82b66878, 0x9e171671, 0x9cb72bdf, 0xdbef1afb, 0x7ee4fe6a,
-       0x481def82, 0x161daab7, 0x97395e39, 0xa10cfb33, 0x387bf079, 0xdc386be5,
-       0xab9f2c0d, 0x839f975c, 0x8df70e65, 0xe65cf711, 0xab7831a5, 0x242753cf,
-       0xca8c2fbc, 0x67c874ff, 0x88d8753e, 0xe36a7674, 0xaaaf3c68, 0x614e578e,
-       0x797dd322, 0x058caed2, 0x634b8ebc, 0x0d7caafc, 0xf7d52fb3, 0x25cdbae5,
-       0x8750e780, 0xbd2bf988, 0xe2062872, 0xb53b6a1c, 0x769eb7dc, 0x65d77f11,
-       0xc411f25f, 0x0227a537, 0xcd7ba4f4, 0xf7d5f28a, 0xe037719a, 0xf1217cf3,
-       0xfe5c8347, 0xce4efd80, 0xea230ed1, 0x321fbdbd, 0xfdc074bb, 0x3a509649,
-       0x7be81fdc, 0x58f9052d, 0x17685a6f, 0xeccd93d3, 0xbd77b55e, 0x2c3c7813,
-       0x9647df89, 0xe5d9fa04, 0xf410730e, 0xf8c4fa33, 0x71ec9f86, 0xd1c3fbe2,
-       0xf436fc04, 0x53854019, 0xdfc4efd8, 0xfc4d2095, 0x7efc4efb, 0x0477ba79,
-       0xd9e5e5f0, 0x7c0b7fb4, 0x2eed8ddf, 0x806f7967, 0xe64bfd32, 0xbf6325e3,
-       0x7c0cde69, 0x64e17c2f, 0xc4d0a7bf, 0xdeb13beb, 0xc04ef467, 0x4ad1fc75,
-       0xe759065a, 0x55bbdef5, 0x7887169c, 0xe14de754, 0x245efa8c, 0x98d26a5c,
-       0x23c2a47e, 0xf0fb2e92, 0x03f32df9, 0x97c009bf, 0x363c33b4, 0x3e30348c,
-       0xf51a3f52, 0xa51b525a, 0xd55a13c9, 0xf761cec1, 0x9e22b06c, 0xa7eef57b,
-       0xde851e41, 0xaf7613d5, 0xc008d515, 0xf07130bf, 0xe78e72fd, 0xb3d65709,
-       0x2f73a27c, 0x6f9f4d9c, 0x678af381, 0x5515e735, 0x24ed1f3f, 0x1628fc06,
-       0x96531297, 0x116cf4c7, 0x377ec7e7, 0xc15ea367, 0x6ff207df, 0x847e8918,
-       0x00e50653, 0xc3518efe, 0x55d01d18, 0x1ef18bbd, 0x9f5b137f, 0x7a8e5f7a,
-       0x7c244def, 0xd9b2d35a, 0xef1091ef, 0xf2877003, 0xf024a249, 0xffde1a60,
-       0xa2ff0155, 0xa618afa0, 0x3f919b73, 0x185ca0d4, 0xe196cf78, 0xe83f7e5b,
-       0x3fbcb6ff, 0xeb3ae09d, 0x9018fe5d, 0xccca9fab, 0x53d8a3de, 0x6c8bae50,
-       0x69a7789d, 0x4f6bc812, 0xd63c5a5b, 0x54fc3f23, 0x9f2af560, 0xa07eb01b,
-       0xda07e817, 0xa78ebed1, 0x3219bf31, 0x8ca7b809, 0x8f900df8, 0x9f27caa6,
-       0x3ce0e920, 0x894db76d, 0xaeec7a01, 0xbd83b6cf, 0x1253665c, 0xc2e8c20a,
-       0x73c106f7, 0x37dc0aa4, 0x5f7e013c, 0xfc163dc2, 0x5aecfb75, 0x7ce4417f,
-       0x35d29a5e, 0x77febc2f, 0xedff4c69, 0x8a28fbe2, 0xdf9063c3, 0x2fbc4279,
-       0x77af78e6, 0xfb416f79, 0xe2dda231, 0x1e9cb1ad, 0xbd37de22, 0xf798affa,
-       0x4f7b43b1, 0x78f8cfdc, 0xf8371e9f, 0x19e01b85, 0x15baf985, 0xab9f199b,
-       0xe734bb78, 0xf3c65651, 0x1e5a53d5, 0x58e3dfc7, 0x0e7a7bb0, 0xf10b7c61,
-       0x82e3d2a0, 0xe80e7774, 0xa26da171, 0x62a2fb0c, 0xa9f388ab, 0xdb4c9a97,
-       0x5b33fbe8, 0x55dfa8f5, 0x499cf9f0, 0xde20c6f5, 0x28192224, 0xde48cfdc,
-       0xb75fd418, 0x891ddff1, 0xf76d0758, 0x0830549e, 0xcf0c4c7c, 0x41ec9f08,
-       0x1d5de0e8, 0xfc0169e2, 0xa3cc197e, 0xe4bf4045, 0x03ef3499, 0x76a6ee50,
-       0xdbffde3b, 0x59f78954, 0x8cfbc244, 0xb9f48bc9, 0x8547af98, 0x2a38e467,
-       0x9e017b3c, 0xdf1d2fa0, 0xf7cf728e, 0x4b140894, 0x425fb48e, 0xc74a7a7b,
-       0x826f8ff4, 0xdea99bf7, 0xcd9c80a2, 0x400fedfa, 0xf889d5ce, 0x1d65267b,
-       0x422409d9, 0x58dd835e, 0x189ccef6, 0xac9c985d, 0x7e31166f, 0x766c3f52,
-       0x7f6c42cc, 0xafa04ef1, 0xa12b8a93, 0xe8ddac20, 0x8178bef4, 0x9be55f06,
-       0xe3031aff, 0x71ea3454, 0x7a5e2a5d, 0xff909ce9, 0xbfa34536, 0x843537a8,
-       0xea78aafd, 0x83c06fa3, 0xddb44f4a, 0x1f32e95d, 0xa8fc8fc7, 0xe45bd33b,
-       0x164e841a, 0x85c7493d, 0xf15ab6fe, 0x1d6bc2fe, 0x1f478557, 0xc6bef9be,
-       0x5771e032, 0x75bffa26, 0x4c984aef, 0x6669b27d, 0x72e3ec3a, 0xdfc02f2a,
-       0x3e842e50, 0x3b247bc6, 0x6b0f788c, 0x0f25e6f9, 0x1fe578c0, 0xdf50751a,
-       0x58e6787d, 0x5e04579c, 0x07d29c29, 0xccdef7a3, 0x0c2bba50, 0xc09f547e,
-       0x27aeadfd, 0x0f38de6c, 0x7de14f6a, 0x1499bd24, 0x607c619f, 0xbbd33a76,
-       0x80d97b68, 0xc3eecdf4, 0x1caf5be9, 0x62395eb1, 0xa411efbd, 0xe2f2e26f,
-       0x647c167a, 0x05fbc1d4, 0x0391dc4f, 0x86eeb5fe, 0x6eaeb8a9, 0xec2c7bbb,
-       0xda74eeaf, 0x72fc20ff, 0x9d7413c1, 0xceb0df79, 0x6be23326, 0x43da75c8,
-       0xac37c8bb, 0x50e9c7d3, 0x4969e75d, 0x2bdfc189, 0xf012283b, 0x3cd2f897,
-       0x65626f1b, 0x9f289dfc, 0x6f83d19e, 0x31e63473, 0xfbb3b4f6, 0x403e55c9,
-       0x7a46bbc7, 0x743d21d0, 0x265b2b17, 0x106d7d02, 0xed8bc865, 0x5bf7186e,
-       0xeeaf1df8, 0x7a0ca28d, 0x83317742, 0x2807e51f, 0x3dd3bbb7, 0xb0f96277,
-       0xea8f7f1e, 0xdf5fd354, 0x1de173c7, 0xfae0857a, 0x42e71b3c, 0xf817ce99,
-       0x3dcb851a, 0xe3d55f4c, 0x9eebebfa, 0xff7a83aa, 0xfcf01bd6, 0xacf940c3,
-       0xa3457385, 0x4487d9a8, 0xdf3c7052, 0xaf782913, 0xca670a83, 0x1ec07361,
-       0xe501e152, 0xe1fa6339, 0xa0e7e3e2, 0xf7602f41, 0x067e7120, 0x7262c9f0,
-       0x0081ce02, 0x28f3831f, 0x48abc943, 0x47a913fe, 0xaf8fbcfd, 0x6571f968,
-       0x3e18efc4, 0x125e5118, 0x469637c1, 0xd44557d4, 0xe77cf953, 0xe4e7fe60,
-       0x2b5f2d0c, 0xfd5470e3, 0x041bbda0, 0x24cb43b4, 0xcff600c5, 0x7c98534b,
-       0xe988972e, 0xec97dc16, 0x44994b7c, 0xf0058d6a, 0xb70865de, 0xb57f6893,
-       0x472d3b46, 0xdb443e31, 0xcac21895, 0xe755bf2a, 0x878701f3, 0x7ecefcfa,
-       0xe321d281, 0x8fa41f15, 0x28af181f, 0x757eb310, 0x83abec02, 0xbe95da22,
-       0x21fc99b7, 0xf2da5d5f, 0x97ee03a2, 0x30bcc6cd, 0x7091fd75, 0x14bb6dec,
-       0xd7ebbf03, 0xe780dc73, 0xe3dacb93, 0xb2fed18a, 0x7b850687, 0xda9f5f0f,
-       0x15d48f5f, 0x6f5c2b33, 0xe1315d26, 0xd65aa3bf, 0xd8256976, 0x7e7e14b3,
-       0x9f8f8c31, 0x062f88ea, 0xd7fcb2bb, 0x7e70c5c9, 0xdaa196d6, 0x1acfcafd,
-       0x341cdf61, 0xe7a23fa2, 0xf83ab9ed, 0x0aede7be, 0xf78e5cfe, 0x3e9cf5b8,
-       0xc7e30e95, 0xfee7b4e8, 0x5b6fdc0d, 0xd764fbae, 0x0fffc0cd, 0x09ae6625,
-       0xeb9737f3, 0x7e1ed00a, 0x079a1f51, 0x7e7aa6f3, 0xaa57e41d, 0x1432d8fd,
-       0xf071af96, 0x0fe02eec, 0x15a636a7, 0x39e95b00, 0xdfed0238, 0xe5c70f9e,
-       0x247f68c8, 0xbc2f80b9, 0x339657a8, 0xdaeac57b, 0x1fdfd99d, 0xc671038c,
-       0x8a13839e, 0xf3d05fc0, 0x2d2f9b21, 0xb680ffa3, 0xa51e43f3, 0x4e8c6fda,
-       0xdd7904d9, 0xb47ad7e4, 0x3afa1e23, 0xb9ee113b, 0x1e0c3188, 0x41bb019f,
-       0x1abcd79b, 0xabdeade7, 0x2c57691d, 0x4f961e20, 0xa97f611b, 0xda4773f7,
-       0x69a41589, 0xd030976d, 0xb88aa45e, 0xfb009fc9, 0x456bfd5a, 0xef64bf79,
-       0xbef6a355, 0x9fdf3f62, 0x65c7e426, 0xa0363f74, 0xfcc029bf, 0xa0e2757b,
-       0x65efd771, 0x9e3ae264, 0xbcdbfe8e, 0x9ebc30ae, 0x49c911d4, 0x40d27ae1,
-       0xc182ce4c, 0xe9cbc6ec, 0xb40d9f60, 0x1fa2cf17, 0xbefc3ca3, 0x6ed03230,
-       0xc01c593c, 0x0d93bdbc, 0xc09efe22, 0x918ddaf5, 0x97bfabdf, 0x2c20c9e0,
-       0x6772191f, 0x3764dfed, 0xc2abe76b, 0xc77fccd3, 0xe2fdb222, 0xca37160c,
-       0x6e245afd, 0x7a1df7d8, 0xdd13bf3c, 0x1f96c5f2, 0xebb67d00, 0xe3054ce5,
-       0x0b7bf82b, 0xf988a0e4, 0xa7edbd7f, 0x39041e62, 0x1e1c7073, 0xd793eb23,
-       0x938c4507, 0x4a5db4f4, 0xed0a7880, 0xbec6e307, 0x405ca78e, 0xe3cd43bf,
-       0xfaf10cd1, 0x08eef9fc, 0x1f8f28bf, 0xc99cb4f7, 0xf94efe01, 0xb019a3e0,
-       0xe2be733f, 0x15756cf7, 0xf9d1fd01, 0x1bdefea1, 0xa5fa8cb8, 0xf41c5da9,
-       0x19f5aafe, 0xcfe3eb86, 0x8bf20325, 0xf7c467d6, 0x095ab3cf, 0x7ece4019,
-       0xb4c51e5b, 0xc3570b83, 0x4dbd33fd, 0xb77f0b82, 0xb9445db9, 0x3a3da0b5,
-       0x4cbc50a0, 0x72c1611b, 0xee764ef9, 0xf9388663, 0x2e6ff07d, 0x7fa220de,
-       0xf2cb48f3, 0x6798f5f7, 0xe58327a1, 0x5de7f461, 0xc6147c3c, 0xdc14fc59,
-       0xc4ff4312, 0x6fd00dfb, 0x8102d3e5, 0xcc884a9f, 0x779818bf, 0x144f35d1,
-       0xc05de607, 0x6907e5f9, 0x466d15bf, 0x3c0faff4, 0x1bc840ef, 0x21f7fd09,
-       0xbc6f0ee5, 0x9f6d28ef, 0xf96062db, 0x3e35667f, 0x0ef685d5, 0xd0f3b209,
-       0xa74f073d, 0x877d1e03, 0xb1fd07fe, 0xd20fed43, 0x0e3cf2ce, 0x57dfb066,
-       0xd2fafdcc, 0xda419e9d, 0x8b3cf237, 0x327f7abd, 0x5b47b1e8, 0xe83f232e,
-       0x6cfcc83d, 0xfc4ff643, 0x0aefe666, 0x570fd19a, 0x0edf2ad8, 0x83ea84fb,
-       0xeedf5eb0, 0xd377b3b5, 0xbd55f9b2, 0x6f95aa02, 0x0bf705b8, 0xdff08fec,
-       0xc9f75203, 0x53a71e5e, 0x791a47f3, 0x3f9a8dbe, 0x4493e6a2, 0x27cd43ce,
-       0x7c614c69, 0xf3c32f23, 0x945bd001, 0xe77ecfce, 0x68cf2233, 0xc8a1bca8,
-       0x71910773, 0x8ae24182, 0x46c0af2c, 0xc6a06e30, 0xbe540d17, 0x31d647c3,
-       0xd06537b3, 0x227bfd7a, 0xc5434fda, 0x1c75d51b, 0x79865139, 0x8b2f5556,
-       0xb0bfafe8, 0xbce3cf5f, 0xe9438c21, 0xc8617c4f, 0x7ece7e44, 0xcb47c95f,
-       0x5937def0, 0xd28efcd2, 0xe71e1c57, 0xd9f07233, 0x978fb923, 0xe47b7ed2,
-       0xf5e80332, 0x4a0b13fa, 0x9de8de40, 0xd7980665, 0xa6c51391, 0x4d9bc04c,
-       0xb6b37dc2, 0x53b71d5d, 0x3ffffe86, 0x1f012a80, 0x00008000, 0x00088b1f,
-       0x00000000, 0x7db5ff00, 0x55945c0b, 0xe779f8da, 0x380c2b9d, 0xa5117280,
-       0x380a0ee1, 0xdb95902a, 0x9784268e, 0x4d32d45a, 0xe5450757, 0xdb698032,
-       0xcbbaeee7, 0x5acd4d78, 0xb5aca8dd, 0xbcc0c1be, 0x1a163b60, 0x25a3b614,
-       0xb68b9599, 0x3f9b5b99, 0x0286f328, 0xffb9f562, 0xcffebf6d, 0x3af39cf3,
-       0x7e988ef3, 0xbf67dfbb, 0xde73877e, 0x73ce7d73, 0x9339cf3f, 0x196e39a6,
-       0x9eb19fd3, 0xcadb2d1c, 0xc87b3b18, 0x630d81bc, 0xf7fc07ec, 0xacf2c653,
-       0x18036312, 0x319abafb, 0x3e57deaf, 0x7c81fb3f, 0x02d8c196, 0x316358e6,
-       0x33235a43, 0xbfd191af, 0x1d1fb01f, 0xf281ee9b, 0x988357f9, 0x5dafc237,
-       0xb63d14f4, 0x94357f9b, 0x3d424779, 0x3677af13, 0x4f285204, 0x1872f1c0,
-       0x9de912cb, 0x6edf2d22, 0xebf69cb2, 0xa613c2bf, 0xc53557ca, 0xf9a74e58,
-       0x47f8e5f2, 0x636ffc0c, 0x98c91646, 0x97627f93, 0xdb74fc5e, 0x913f485c,
-       0x5856091c, 0x9ed48557, 0xb10c0f7f, 0xef57ba26, 0x2d3ae330, 0x63f29bcc,
-       0x5e608ceb, 0xd5ae71bf, 0xf5a46abb, 0x2566e0f8, 0x6bd6f9b8, 0x5d7c3826,
-       0x38137d1d, 0xe8e0aac6, 0x05413feb, 0x4ffbebc7, 0xaebff1a1, 0xff49bb4e,
-       0xbfd06f43, 0x5f7f3555, 0xee3449bf, 0x0b0d0caa, 0xa4f486cd, 0x5e00cdc1,
-       0xcb235500, 0x1d80cc65, 0x795654c1, 0x66ad19c7, 0x75257b5f, 0x6cb171b1,
-       0x946f7c14, 0xfdf0dc0b, 0x25ae6592, 0x985d5219, 0xa1dbb186, 0x705ecebd,
-       0x086bf417, 0x41708f0b, 0x89ac133f, 0xc2efaeb4, 0x28301516, 0x08f06eff,
-       0x838f15d9, 0xfcc42a2c, 0xf2c541aa, 0xe37f1c7a, 0xb5f70c73, 0x0fc7c8ca,
-       0xfc332fd9, 0xba30eece, 0x777ea193, 0x7996c7cb, 0x06dfce30, 0x3ee0e639,
-       0xc909f32b, 0x3ee19779, 0x6dc726b3, 0x3d8c2185, 0x0dac616e, 0x50f6daf3,
-       0x725eaf5c, 0x405de7fc, 0x06afec0f, 0x77c90f56, 0x25aa4726, 0xcabed7c3,
-       0x01f9a7aa, 0x68b2c435, 0xa50d5f5c, 0x08574d55, 0x8916d6ce, 0xaf7ca5d6,
-       0x77043d62, 0x8851e586, 0x7d2b5a93, 0x16a4726f, 0x71e6fa66, 0xccf7ffad,
-       0x9fd00d2e, 0x433fff61, 0xdadd9e11, 0x906dfb9e, 0x60e45a7a, 0x11aef87f,
-       0xf0763974, 0x50ed5937, 0xfaed895e, 0xdbd8f631, 0xf30ca9e5, 0x9c2c9e86,
-       0xffb7c1f7, 0xe90ed591, 0x6fcbfb77, 0x50edf2c3, 0x6ef90adf, 0xcda54f7d,
-       0x6624bfaf, 0xf9466971, 0x0fb16ad2, 0xf7dbe581, 0xf3881caf, 0xdcc1d068,
-       0xa59c61c3, 0x474f2365, 0x9fd83a20, 0xb5b8478e, 0xec3d58e8, 0x54d35747,
-       0xe54af919, 0x43058c27, 0xf619bb3e, 0x83d9f207, 0xfb035b99, 0x93ffb953,
-       0x955fb8e9, 0x068b7a39, 0xbc341296, 0xbe02bdcd, 0x2d18e507, 0x2c53e212,
-       0xeccf5f1f, 0xfb62258c, 0xb7dc08bc, 0x2a310637, 0x41f997ff, 0x6bdbc71d,
-       0xbc7bc0fc, 0xabc601b2, 0x47efdb90, 0xa17c003e, 0xf2a5f11e, 0x668e6fa3,
-       0x4f46b158, 0x78cfee24, 0xd0f8171c, 0x369fa2c7, 0xac0ee16b, 0xfbe0fdd7,
-       0x2de8b06b, 0xf5c0e1c9, 0xb68c62b8, 0x68cfc47a, 0xbf14c277, 0xaacd7d7d,
-       0x4ff0f6a1, 0x221dbc42, 0xa07bbae6, 0x22587167, 0x470ee5fe, 0x30d2a87c,
-       0x3643f207, 0x077a8009, 0xe66165e2, 0xe9ebcc94, 0xd415b18a, 0x7b56dbdf,
-       0x57c735b3, 0x336993ff, 0xd07d1d33, 0xc12a6221, 0x0479ef53, 0x6153d9e7,
-       0x7d856db6, 0x827e0bf8, 0x334f2f76, 0x5850e578, 0x56bcce8f, 0x193a3c02,
-       0x0075bb3c, 0xd9b57fac, 0x73ae1ef1, 0xd7e343fa, 0x183a5e60, 0x788c5d61,
-       0x8b9ed459, 0x726d12fb, 0x3be3807c, 0x22db8e8d, 0x06978961, 0xc1fb523b,
-       0x08c2b356, 0x98566f0e, 0xfce7d859, 0x797c7cf9, 0x54b841a6, 0x36f4b808,
-       0x7c43f626, 0x5fad7aed, 0x74f98316, 0xca095869, 0xdf312e87, 0x988f2073,
-       0x712e9f1f, 0x4117d31f, 0x63bad2fd, 0xeb7eb9fa, 0xeecc60af, 0xfc7eb8c9,
-       0x301fb88b, 0xffd785fe, 0xa1afddf8, 0xf76fceab, 0xc004b0a5, 0xad22e913,
-       0xc71dbbeb, 0x9df58b66, 0xd63ff5c5, 0x87a713db, 0x073d3975, 0x887f9cf4,
-       0x527b69f5, 0x5d7d6c7e, 0xc27cb69a, 0xa5927d8b, 0xaed7de3e, 0x7e58f1a2,
-       0x497be02c, 0x9908d85d, 0xe20a59e3, 0x061ba959, 0xa55bc3f1, 0x8b3e051f,
-       0x5debbf05, 0x1413e02a, 0x5af2859a, 0xfe328f81, 0xccf800a9, 0xe1e4f6d6,
-       0x0b2f663c, 0xea7e70d3, 0xbe51fc26, 0x1eaa59cf, 0x30e22577, 0x1bf5cfcc,
-       0x66f34dc9, 0x2b86ff3c, 0xf21ebdcc, 0xbf95cd06, 0x21bd454c, 0xbd436353,
-       0xf0104b61, 0xfd8c1180, 0x8bcfec59, 0xe18c1fc0, 0xcb16be54, 0xfb7883a3,
-       0xee3567e8, 0x70bed095, 0xe1e1336c, 0x9b6695cb, 0x3115630c, 0x8530ac60,
-       0x47aecc79, 0xe63d7fb8, 0x61dbfb1f, 0x1de2839d, 0xfeb0f151, 0xb89a1139,
-       0x1c3cd0bf, 0x9c032743, 0xc70e68d8, 0xc207b840, 0xe8b30a7f, 0x36c65fb0,
-       0xa7ee9068, 0xe652f858, 0xa78e9c4b, 0xc70ebb32, 0xa839907b, 0xbd2ef1de,
-       0x1c1d019d, 0x3060f407, 0x8b9887ef, 0x373067ca, 0x979933a5, 0xb59cffea,
-       0x03a15e53, 0xfd39ffc0, 0x8d9ffe39, 0xb26f0992, 0xc7be01e2, 0x2f06b382,
-       0x7e4c7585, 0x6199352e, 0x0803359f, 0xf79b373e, 0xb1c38964, 0x1db8eacd,
-       0xf05bdfd7, 0xd0354bed, 0x25e8c68f, 0x27c6bbfc, 0x78100dc6, 0xa27ce3f8,
-       0x09e397ad, 0x06398390, 0xd8af70e0, 0xe5ed7bd2, 0x8cbd7093, 0xfe9e4859,
-       0x9e5fd04c, 0xb3fd666c, 0x6dd97c71, 0xa5d8b9c0, 0xbe42468f, 0xd6cc8c60,
-       0x5bde3cc3, 0xbede48ce, 0x13765c37, 0x869f20ae, 0x7e8bf7f6, 0xba998d27,
-       0xcbd41faa, 0xdb3dbeff, 0x20c1690b, 0x7eed97dd, 0x7fbe35f8, 0x4830aaed,
-       0xcba92427, 0x2d36b227, 0x065275c2, 0xf3f1fb94, 0xf5d5b3fb, 0xe198e00e,
-       0x2328db98, 0x0f8ccdfd, 0x18267fe9, 0x90d843b2, 0xbd1f641f, 0x9de9eb28,
-       0x0ddf4574, 0xef10d8f3, 0xb2fb8b98, 0x67afbef8, 0x2d33bd23, 0xca2468fb,
-       0x5d7ca3a9, 0x00dd025f, 0xd5d3b206, 0x7e80d120, 0x883e80ce, 0xb7a073f9,
-       0xdaa17a61, 0xd045e94a, 0x577bf0b3, 0x9ef28db5, 0xec72c2f8, 0xcbdaee77,
-       0x4e06475a, 0x6df0852b, 0x36b7c089, 0x8c13578d, 0xb255b4f4, 0x625c7ca1,
-       0x0c1b1b6a, 0x1f525bf0, 0x671d836f, 0x569e4d65, 0xb7b17e9c, 0x75b71f30,
-       0xad45e1c1, 0x055c5698, 0x6cbd078c, 0x1ff85cae, 0x7f5d0788, 0x7dda72f9,
-       0x7ab67e50, 0xbe7f8d14, 0x77e34eda, 0xfa501756, 0x37e3bc7e, 0x4b7b0f38,
-       0x15846b47, 0xe132e577, 0x1d0d7dcb, 0xe7c858da, 0xd23b25d9, 0xe676dde1,
-       0x6d3d0376, 0xb5b971d6, 0xd216e419, 0x29cc98e5, 0x50ca3e2f, 0xc71e38ae,
-       0x509c1ef1, 0xdcfd879a, 0x8b48aa3f, 0x9efa1ef5, 0x1f7888b1, 0x8f0cddde,
-       0xbf5f0059, 0x7844b6f4, 0xfd634978, 0xae59ea19, 0x0be93223, 0x2a985abd,
-       0x727bdff4, 0x7b05db88, 0x626f78bb, 0xc5b7f214, 0xb8546b3a, 0x0ceb5f1f,
-       0xbb9d6be0, 0x97f68f6f, 0x9ee19d77, 0xbe433eef, 0x4be705f4, 0x5e6733b0,
-       0x8e65be40, 0x76fee1b6, 0xf404bb09, 0xcf9460c9, 0x47417a95, 0xdf3057c0,
-       0x14e6c419, 0xd5f73e42, 0x1748b1d8, 0x7caa1e38, 0x7949df0a, 0x5f84b9f5,
-       0x6de37d5b, 0xecffccf7, 0x725fc805, 0x903a5c6b, 0xa7989753, 0x575c4deb,
-       0xfa86d99d, 0x0da49a63, 0xea784a5a, 0x934c3a26, 0xc0a5daac, 0xfabc7657,
-       0x303fc0e2, 0x1b181bd4, 0xdadfdf05, 0xe77c4c14, 0xd4ed9d2d, 0x22ff6c52,
-       0x53caff6f, 0x09b2fcbf, 0x462b27d3, 0x3ef112fc, 0x5ae09c3e, 0x21d2fbfc,
-       0x63436788, 0xbfa01b61, 0x5e486f5d, 0x99631653, 0xc4560735, 0x6d867cc0,
-       0x840cd0e9, 0xb49d7874, 0x21a1d312, 0xf8658705, 0x95bc5efe, 0x21b231e6,
-       0x72458e5e, 0xecfee819, 0xa87fa4a7, 0x9a8c92f5, 0x320763cb, 0x44327e9f,
-       0x7dc05cf2, 0x62721959, 0xb63fc904, 0xdbd9fa91, 0x99e3f532, 0x7cd00eb4,
-       0x7a45de70, 0xb70bc91b, 0xecf116ab, 0x46cd2392, 0xeba17afa, 0x4bdfdc79,
-       0xca1b488e, 0x571a7d8f, 0xff589de8, 0xf9d69694, 0x50b1dd46, 0x35fbe41d,
-       0xbe0998ea, 0x21ef0c57, 0xd83159b9, 0xc1dc70ca, 0x805bdd2f, 0xdc6ca9f0,
-       0x38fd4b5b, 0xea09368d, 0xd2bdec95, 0x8d94728a, 0xc464b667, 0x7f9e46af,
-       0x86dd9c62, 0xf6a4b572, 0x2b6f9e5b, 0x58217ca4, 0x3fac5a13, 0xcf69eb8f,
-       0xdac53909, 0x117f88b3, 0xfb7d5aca, 0xc67c04f5, 0x5de39bef, 0x3ecc8b31,
-       0xe97206f9, 0x8c59d202, 0x1b6fb79e, 0xe08e333b, 0x49728b72, 0x3d39e7e9,
-       0x4e509973, 0xacfcb9ea, 0xf8817e07, 0x17fffd01, 0xd1c8aff6, 0x6cca5958,
-       0x3ec77584, 0xb4adb067, 0xd338fade, 0x3921adfb, 0x5575e8aa, 0x89585f42,
-       0x36fda055, 0x804e43b3, 0xb90be671, 0x0cd6b4cb, 0x319e43d4, 0xa409b5db,
-       0xa3de81d7, 0x4c667921, 0x0658bd40, 0x4fd12f3d, 0xdf8733cf, 0x366b3c92,
-       0xfdb143db, 0x2fefd6ad, 0x3157f9e6, 0x444b424f, 0x31c85748, 0xf23de03b,
-       0xa127764e, 0xeb0357aa, 0xe790701b, 0x6dfa1213, 0x7aba055a, 0xfa958252,
-       0x7c11f801, 0xca19e761, 0x243ca509, 0xb841e39b, 0x47fa48c3, 0xe1a2c454,
-       0x9af0fc8b, 0x1123bd69, 0x5bffeb0e, 0xbfa84af6, 0x1bb33ffd, 0xbe7025f1,
-       0x3fdc0945, 0xb9890bf1, 0x97578834, 0x45af54f5, 0x8febbed7, 0x34a5aed0,
-       0xed7686c3, 0xd821e43e, 0xf49ea84f, 0xe61096a9, 0x99697a42, 0x7d46e91c,
-       0xa7b42dec, 0x88661e90, 0x7c4626f6, 0x40c665ba, 0x0d0387e2, 0xf35c1800,
-       0xaf6f034a, 0x2641f45b, 0x963cbff6, 0xc94ac7e4, 0xf48136bd, 0xcbe49935,
-       0x6a8fc149, 0x6533bcc2, 0x9cb9af28, 0x939c70c2, 0x61569760, 0xa22092bd,
-       0x7b309abb, 0x7dd7f20c, 0xdf132dff, 0x790e19ab, 0xf225f133, 0xb64cd4c7,
-       0xfe4184c7, 0x351fb161, 0x67faeeb5, 0x69c9bfb1, 0x3281aeb4, 0xe2f5445b,
-       0xe99f3f79, 0xfdc73b78, 0xdbd45ac1, 0x20c50241, 0x4e285efc, 0x2a07c866,
-       0x44cec613, 0xf7ec52bc, 0x28df82e9, 0x630363fd, 0xfc63ea2e, 0xf5f98cdf,
-       0x07aba426, 0x201d4c4b, 0x92c9d839, 0xbf682115, 0xbd90e83e, 0x1e5bd406,
-       0xd35fb3c8, 0x7fb0120b, 0xb3c24cfb, 0xf27ec562, 0xbdb843ce, 0xeb6463dd,
-       0x7d847f49, 0xdf1ebccd, 0x22633c2a, 0x52c7edfc, 0xf397a703, 0xd7482f38,
-       0x714a3b07, 0xe34d55de, 0xcaedfc23, 0x8757f319, 0xf18bdd12, 0x23db562e,
-       0x5ea1274e, 0x32a94050, 0xc14e329e, 0xea5da314, 0x818df68f, 0x4239aaf4,
-       0x7832ad0f, 0x4dfd21a7, 0xa31e3937, 0x642eca71, 0x7fd8bea1, 0x9c3f5a4a,
-       0x32fbf77f, 0x253d3c43, 0x3214f5f6, 0x45a7c46c, 0x4c2f8421, 0x8ebf1de4,
-       0xf41cfd20, 0xc737c21a, 0xde5286ef, 0xccc7b7a1, 0x1c5cfc47, 0xca71f84c,
-       0x729fbfc2, 0xcd7e1186, 0x87f95dfa, 0xaa7be00c, 0x78784f50, 0x3f2645aa,
-       0xca96dfcf, 0xb9c03d5e, 0x67d5ca6b, 0xd75da053, 0x3772afb2, 0xe2beda43,
-       0x3f9438f3, 0x4c5456b3, 0xcab376c2, 0xfc8fdd96, 0x3d7446f9, 0x441069cb,
-       0x35b6e1cc, 0xd711bec1, 0xd5ca7fd9, 0x03cbe47c, 0xcfcf9dcb, 0x0983f287,
-       0xcf88678e, 0x112bdbe8, 0x7d6f951e, 0x73fa8711, 0x7b2bf377, 0x6dfd215a,
-       0xfa79e388, 0xf8dee2be, 0xb099d8d5, 0xb0b52abf, 0xb73f805f, 0xc45e3a27,
-       0xbce355ef, 0xa2eed829, 0xe11f2dae, 0x9add96c6, 0xa5a17dde, 0x76849f7e,
-       0x254b5060, 0x0b3bb2a5, 0x7929d1e7, 0x8444a543, 0xb00be823, 0x6f168bee,
-       0xb9e21868, 0xb7cbc3d0, 0x5347d7ab, 0x077e148b, 0x91ee5768, 0xb3d226ed,
-       0x6f9c7add, 0x2872fd60, 0x58b77aa7, 0xbc3cc65e, 0xa9e9ac3c, 0x7b7ef8bb,
-       0x179fb0bd, 0xc56f2476, 0xf7b4befd, 0x3b7f1495, 0x7ebd3038, 0x17fd7cbe,
-       0x8e00bf11, 0x8744a117, 0x5060d5f8, 0x3b5d7fd9, 0xd5f85462, 0xbdd523b5,
-       0x762f8fde, 0x6cc1be09, 0x88c9dc9e, 0x2e4f76f7, 0x9f0a55ea, 0x164f4660,
-       0x9e696fd9, 0x1457b42c, 0x3d0ac33e, 0xf6ee5429, 0x7dfd60a4, 0x7d9acf68,
-       0x8aed96e3, 0xfdcf5dad, 0x364d2e8e, 0xc56e87e6, 0xcdefd2bc, 0x59ba97d6,
-       0xbba7caaf, 0x09d3f9d5, 0x73b69fdc, 0x83b15ea7, 0x30476165, 0x568fb2ab,
-       0x5c11afae, 0xe057aafe, 0x2e6c68f2, 0xafe00dfa, 0xe7379a04, 0xddb93be3,
-       0x23b86fbc, 0x62a9f916, 0x830bef9f, 0x51ca067c, 0xaf256f3e, 0xde7021c0,
-       0x20bafe2b, 0x967bfd16, 0x4e508d44, 0x3f88516c, 0x2f9c4d2b, 0xbe81d4ad,
-       0x4976819a, 0x5ad3c8c9, 0xd16c57b4, 0x1c1f5ac5, 0x6e1e6c16, 0xb85d3a44,
-       0x1fd1b865, 0x1f6e561f, 0xf30ad879, 0x6b5db8bc, 0xd4af29c3, 0x7d429fba,
-       0xd976e56c, 0xddf462e3, 0x17fa8768, 0x628f07cd, 0xb85b05bd, 0xbf69429f,
-       0x744e7370, 0x873cdfb1, 0x33c3576e, 0x0fcea3d3, 0x07e7526b, 0xf391aea2,
-       0xdc376f3f, 0x3c8fceab, 0xfd9fceac, 0x10d3a3cb, 0xd7644aed, 0x87ea3253,
-       0x461fe79f, 0xdf6e71b9, 0xdfe4a11b, 0x15b8a2f9, 0x9b85def5, 0x7d8670d5,
-       0x701f5093, 0x2e48936d, 0xe903ba96, 0x65ba6fa3, 0xd7e2b96c, 0x93c7f34b,
-       0xd56ae632, 0xbf5f5fc6, 0xd9a67993, 0x74b48fd1, 0x23d3c8f1, 0xe1defd7d,
-       0x7b47a4d9, 0x1bdc7027, 0xdb3329d1, 0x165f68ad, 0xeedfe28d, 0x7d963a5c,
-       0x6d882205, 0xf88f9638, 0x4484f457, 0xf5e8b6f2, 0x2f9177d4, 0x3199ec77,
-       0x0569d281, 0xcfc50f04, 0xf245b0b2, 0x32de4086, 0xfcede38a, 0xc19b92cd,
-       0x32aee7bc, 0xc541fca8, 0x58f3d41b, 0xbefea350, 0xdfc0e9b0, 0xc4bfe825,
-       0xe51e92f8, 0x4316c956, 0xfdcb1f80, 0x65e1ea0e, 0xd9d918e7, 0x183f7565,
-       0xcd73f2fa, 0xbae1d657, 0xb8fae19b, 0x07d3e78a, 0xf806634f, 0x857efef8,
-       0xfea11233, 0x32b5359d, 0x3982adc2, 0x9224b31e, 0x860de99d, 0x7d002c79,
-       0x9069f509, 0x2baeb4b7, 0x0db9fb9b, 0x4cce54f1, 0xb5857e50, 0xbe1ca2e5,
-       0xe36218d2, 0x5cb6b0fe, 0x4217e40b, 0xc256e11e, 0x9c7c1236, 0x8e657fc8,
-       0xf9bf762f, 0xe7f93ee2, 0x8fae46d9, 0x03deb53b, 0xd6728708, 0xff70ed4e,
-       0x6139ebfc, 0x51c3275d, 0xcf6808df, 0xaf0fe46c, 0xdf69eb32, 0x307e9aaa,
-       0xec577ff8, 0x512ec500, 0x59ff6dfc, 0xe21070f6, 0xfec96af5, 0xd4c651bc,
-       0xf115a7bd, 0x724cd4b8, 0xce5ae1fe, 0xd9d06bcf, 0x6cd7fd02, 0xf37d274a,
-       0x829ec961, 0x4c9b65eb, 0x1e810764, 0xdb3abf18, 0x3e81d7a7, 0x9fa132e8,
-       0xbdc834b8, 0xe70fbf15, 0x8ccd79f6, 0xde17d214, 0xe45e3c92, 0x3867aec3,
-       0xe64cd4bd, 0x64f353f8, 0x0cff7d0c, 0xfa831aa7, 0x6a4bd722, 0x3d72a536,
-       0x60f3e656, 0xfe210bbf, 0xe62f1358, 0xf34ac035, 0xc9f5f452, 0x8973c716,
-       0x5e2ceb7e, 0xf4247a01, 0x995bfc5f, 0x95829fa1, 0x3c92dc44, 0xaa7217af,
-       0x8dc99367, 0x52d3eefe, 0x3f9e2b61, 0x13dfb35c, 0x1dcfdf39, 0xea26df6b,
-       0x58bc5f91, 0x4ffd7933, 0x3567bc71, 0x7ef195d6, 0x53dbb7f0, 0xbd3fcf50,
-       0xf70234c9, 0xce70d4e9, 0x72c773b7, 0x25d801bf, 0xee90adf6, 0xfca8d449,
-       0xb9127bab, 0xd13fb09d, 0x3ce9e94a, 0xc90c47ee, 0x0cff242e, 0xf1f115ec,
-       0x17ec75c0, 0x85f58aed, 0xc7d27e47, 0xb0f8147c, 0x4e7f7c71, 0x5c91223f,
-       0x58a4f584, 0x7bfb9f20, 0x4e75f913, 0xeca2f90b, 0x0e51e00b, 0xbfc15bc9,
-       0x49fc459e, 0x27f014c4, 0x51fc2fbb, 0x60c3c7e3, 0x7f1098ef, 0x1f683f00,
-       0x327afc15, 0xf011f693, 0xe7a1f087, 0xf00dd349, 0x285f6d47, 0xe5a9adeb,
-       0x5da047f6, 0x3270f801, 0xa0bcefd1, 0x0427ac26, 0x3c14b7cf, 0x8e775a60,
-       0x205a39ff, 0xe6c9e41e, 0x4befe434, 0xea1b20a4, 0x7f844bdd, 0x467cc97b,
-       0x8b658df3, 0x68d7a424, 0x0ec895e6, 0xec266d66, 0x003d27ef, 0xfc3a3f73,
-       0xf32355e9, 0x58637b97, 0x8f7f2a98, 0x3f554631, 0xfaaf12cf, 0xba746f7e,
-       0xeb78fbea, 0x627e5570, 0xfaaa1dda, 0xa8c6d9f7, 0x351b3ff2, 0xb27f555e,
-       0x6f2ab27d, 0xce2d1667, 0x60baa5bf, 0x6f1fda24, 0x5e921757, 0xd1970810,
-       0x5baf8386, 0xea46206d, 0x00b453b4, 0x0efdd1bf, 0x7c87892e, 0x14d33aff,
-       0xe8c7e02d, 0xe25783d8, 0xd5a2602d, 0x43eff105, 0x80495e0f, 0x305d747c,
-       0xc8c5dfcf, 0x67581f1e, 0x9332e29e, 0x093630bf, 0xeaed3ce0, 0xf66843a2,
-       0xca7cb27d, 0x75a478fc, 0x3ff33267, 0x7566d8b7, 0xe53d6184, 0x547f52bb,
-       0xefb52152, 0xfcf9ccbe, 0x393fb827, 0x760a7aff, 0xb18fc917, 0xac6c341c,
-       0x5be74cd1, 0x78bba8cc, 0x7c0cafcd, 0x8633b253, 0x6a96b9fe, 0xc22d67d8,
-       0xb7a948cb, 0xc1e942da, 0xdf4a68ea, 0x62b2b6ad, 0x756b6780, 0xab87a51a,
-       0xa47e546d, 0x1fa5147a, 0x3d29db56, 0x69405d5a, 0xa521755b, 0xb34f2812,
-       0xb36c6f90, 0x3c21d5ad, 0x33b0da5c, 0xd9fe3e30, 0xe1f2df17, 0x519d96ad,
-       0xff2a15f6, 0x4dcf64ca, 0xb20d75a2, 0x945b9f90, 0xa9ffda1f, 0xe8d1f915,
-       0xf5e1236c, 0xd59b7368, 0x48f3cd98, 0x99977567, 0xebca1357, 0xf5ebfd69,
-       0xfe470cf7, 0xa669da30, 0x50bd497a, 0xbdeb0b2f, 0xf2c5a317, 0xca1b7a45,
-       0x3f04e7cb, 0x901cd10e, 0x5e909c71, 0xc834367e, 0x144ef9c0, 0x5df85fa8,
-       0xf5d5a3f1, 0x8706f1f2, 0x9df3a22f, 0xc4cdb3c1, 0x15b9147f, 0xc18de11b,
-       0xd12ec5f9, 0xe6887953, 0x2efd15b8, 0x09ded55d, 0x84e3af88, 0x67a71f9c,
-       0xa60f3869, 0x94f92209, 0x1adf7f27, 0xcdc5f90b, 0x398c70d2, 0xdc286718,
-       0x96a1f642, 0x6feb31d3, 0xb6b8fae2, 0xa815f4ad, 0xd6323c77, 0x15a11eb6,
-       0x81258fbd, 0x5557959e, 0xf2728190, 0xf448db38, 0x31d43f3d, 0x6a6df10f,
-       0x46bdd006, 0x13f40920, 0xfc4c105d, 0x6a7f7bb3, 0x53cdea0e, 0x0cbdd60c,
-       0x292ca2e8, 0x4a7ef087, 0x648e6b3f, 0x445dfcc1, 0xaca25327, 0x9e1b257b,
-       0x194ce49e, 0x71bfc777, 0xd2493d2e, 0x7ca9c7fa, 0xc31e3922, 0x5c1455f9,
-       0xf5f9f3d2, 0xebf89e90, 0xb3f12b24, 0xc9190701, 0x21f19edf, 0x7fd15fc4,
-       0x61f918b5, 0xeb073586, 0x427ae9c5, 0xfba0ee31, 0x5dc52d7b, 0x07d0cd40,
-       0x2f1efcfc, 0x8c78f0b5, 0x9a1bbc40, 0x554de5cc, 0xaa038f12, 0x291a368c,
-       0xcf9cb96d, 0x30a24e28, 0xd036ed09, 0x5794fb1e, 0xdcb99383, 0xe7a35f8b,
-       0x49643afe, 0x107b6530, 0x8c2ef253, 0x2c7da907, 0xecee5148, 0xc7a64e00,
-       0xe87f9476, 0x5492e3f7, 0xdf58edf5, 0x11d99df7, 0x9dfb4a9c, 0xbf7e9375,
-       0x43c62b4a, 0xdcc0597c, 0x7e4084b8, 0xb87245fe, 0xfb411e72, 0x137f62fc,
-       0x324993d9, 0x71e037e0, 0xfc87b06c, 0x8e26757f, 0x9e1a49ef, 0x77f869d6,
-       0x93e8107d, 0x790c1f90, 0x3efa773c, 0x1e49e1d9, 0x0599ed40, 0xa87bcbdb,
-       0xd0f30c7d, 0x28f7ca78, 0x9d435ef4, 0x304f2041, 0xfa6b2d1d, 0xe498db84,
-       0x7d211f31, 0xf91f0177, 0x775f8fda, 0xf52e8705, 0x6c4aa7df, 0x376ff66f,
-       0xed29da96, 0xd86a962b, 0xffc411d7, 0x922a5f08, 0xb7377634, 0x5095df37,
-       0x7a6d604f, 0xbb4a6b94, 0xbeefc013, 0x05ff7806, 0x27a61ff8, 0xf8e1ef81,
-       0xc3df019f, 0xf7c06ff4, 0xf014fcb0, 0x81db4c3d, 0x97f961ef, 0x9d30f7c0,
-       0x1b243336, 0x69aaa4e9, 0x855afb0c, 0xff873af7, 0x3189ddf9, 0xd9cbe37d,
-       0x9ed76e24, 0xfbfbef88, 0x7c71277f, 0xdf37713a, 0xd7906eb7, 0xfe019fa8,
-       0xdf84b2ad, 0x87776e58, 0xef9e73f0, 0xd77eb8d2, 0x5ff3c31d, 0x3fa8e926,
-       0xc66d86bb, 0xe9a5dff6, 0xe649ef29, 0xf85ba372, 0xa8ff012f, 0xc31e657f,
-       0x7aaa4a86, 0x814d24ee, 0xdef98fbb, 0x23c7cc9d, 0x1c3d44fc, 0x0fde31f1,
-       0x84ad2b3f, 0xf178819f, 0x249ba085, 0x58bbc703, 0x27c8f1e4, 0xbe744ca3,
-       0xe3b5f30a, 0xc49d7479, 0xfc3af1f1, 0xe77b70d4, 0x7e84fc3a, 0xe7804e08,
-       0x093fa412, 0x35251fc0, 0x45b77988, 0xe082fc86, 0xa0b3a2dc, 0x3227efff,
-       0x6bdb1600, 0x84ce8f7a, 0x10c8d8f2, 0xe41d9e2b, 0xd45e6e3d, 0xebb8ff17,
-       0x35ff5ddf, 0xffaf547a, 0x738b75ba, 0x375d5b93, 0x97e413f1, 0xf07d3f88,
-       0x1fc82187, 0x33f87c72, 0x849ed926, 0x264b74fd, 0xbb81fa2d, 0x022f1c4d,
-       0x1a5dfbd7, 0x3f055fc7, 0x18fc40be, 0xbac3fd80, 0xb9eb7d12, 0x80a0ff36,
-       0x14642df5, 0x8fb8110f, 0x5bf15f0a, 0x39c91dd7, 0x2601b83e, 0x041efc92,
-       0x71fd1bf2, 0xc70b649e, 0x676701f3, 0x81f9426f, 0xffea0272, 0xfafdc341,
-       0x56bedf0a, 0x2673c92e, 0x39f8a867, 0x67b07b43, 0xcbe881bf, 0xaf2561ab,
-       0x43825da1, 0x8f59d9f9, 0xf6f5f325, 0xa0d64f4e, 0x9df5d4de, 0x27f145d9,
-       0xa14e7b03, 0x59b5d67d, 0x6d3db8c7, 0x3c81249f, 0x057e8f9b, 0x8dc5fa2b,
-       0xa17b6e74, 0xd43d991a, 0x853e5cf3, 0xf3d56176, 0xe8023332, 0x9dbfe7e4,
-       0x60b2f886, 0x7a82cebf, 0x4fcdcac7, 0x3b7c461f, 0x515928d3, 0xc23577de,
-       0x457ea1b2, 0x04db884d, 0x8f21f3f5, 0xf59a17f5, 0x8f1f2b6e, 0x18a74cf4,
-       0x65536bef, 0xefa5fa02, 0x70475e79, 0xc783b05e, 0x79b3bc31, 0x9f639d09,
-       0x0a2c4b71, 0xcbcbe5da, 0x9fd0635a, 0x3364a2f8, 0x39a73b40, 0xefda3cff,
-       0xcd983b65, 0x3d8afe8b, 0xb2be7421, 0x7f1d46a0, 0xa4dee250, 0x64a27d47,
-       0xacbcba8b, 0x9d879d4e, 0x6ceb7e21, 0x3c33c750, 0x15e22c92, 0xf270d9d2,
-       0x9384d633, 0xd3f0a01e, 0xf631d91b, 0x324f9cc5, 0xfa244df6, 0xdffde549,
-       0xe6697dc6, 0xdf22c9f9, 0xdf4bf901, 0xe0517df2, 0xbf9ca952, 0x4f6cb0c7,
-       0x99dfc636, 0x55c7682c, 0xca157f36, 0xa82cee30, 0xcfa27efd, 0x538a6537,
-       0xbb24d75a, 0x2d15be10, 0x3e3197a6, 0x31ef72af, 0xe10435bd, 0x01e908fe,
-       0x1ad732f7, 0x1abcbfb4, 0x3c236b0d, 0x15ff236a, 0x202cf7b3, 0xc9b370bf,
-       0x6f3de742, 0x133ada7e, 0x66257bf3, 0xdc1c7dc2, 0xe0b2784e, 0x75ce9979,
-       0xb93e6a19, 0x71913c3e, 0x3d9f715f, 0x16bf68fd, 0x3ee3bee2, 0x3ee3bec3,
-       0xd89fb8cb, 0xe6ef443e, 0xccedc278, 0xfef9db33, 0x2f9efb2a, 0xdf93d06f,
-       0xf3ef96b8, 0x3fd7cf3d, 0xa078441b, 0x680f0263, 0xe16ccfdf, 0xbfdfaefb,
-       0xf1103f5a, 0x0f0036b7, 0xf0d70d9a, 0x1d77e700, 0x7fec041e, 0x07cbf0a9,
-       0xfee041e2, 0x44f82bdf, 0x10fa3c9e, 0xfe2cd9c6, 0xf1571f05, 0xef0ecd73,
-       0xaa0478ac, 0x11ff1a9c, 0x392cdd9a, 0x049635fa, 0xb421bd72, 0xc0f909b0,
-       0x86bb09f1, 0xfc099c53, 0x9c524633, 0xddefc11b, 0x053dfd5f, 0x7e3bbfe9,
-       0xe23796f2, 0x703aff69, 0xc161dd1d, 0x96ee7e5c, 0x1b9512dc, 0x538006bc,
-       0xa451f01e, 0x81b6f643, 0x07ba91ce, 0x31e8f43c, 0x693f77c8, 0x48f6e1b6,
-       0x951f6e76, 0x1277bcb7, 0x31ac86fd, 0x9fb2aecf, 0x8e537d84, 0x6f7e15f6,
-       0xefcafb00, 0x7cb24e3c, 0x4f3eed44, 0xcaf5a04e, 0xb266db1a, 0x9598ea83,
-       0xe3af63ce, 0xbdf88cf7, 0xa1ba07e2, 0xf7c0163e, 0xeb9efc7d, 0x2835cc61,
-       0xb14be90c, 0xb47e14b3, 0x0f4bf850, 0x1b44763d, 0x03aceb81, 0xb5bee3b8,
-       0x8fea1f00, 0xdb9d3d7e, 0x8dd1f92a, 0xf1167fa8, 0xce78e00a, 0x469f68b5,
-       0xd332fc46, 0x0f029d7c, 0x605f112b, 0x07d9659d, 0x775f5142, 0x6ce1fe0a,
-       0x497f210e, 0x8f98db19, 0xe30655f8, 0x9bc0fb79, 0x487bedb2, 0xde19bfcf,
-       0x655bfa28, 0x3fdebaa3, 0x250c9f90, 0x03f9927e, 0xfc69dfe0, 0x37c7c73b,
-       0x7e8ce4f2, 0xcbdc0718, 0x6e90fdac, 0x52d7246f, 0xfb290337, 0x36ee9bf5,
-       0xcfcaad32, 0x33e5516f, 0xfaaad13d, 0xaaac9ac3, 0x69bdc3ef, 0x0f23efaa,
-       0x9cf954db, 0xfaaa51b6, 0xabb49fb7, 0x17b477f2, 0x75dfeaa8, 0xef9550ae,
-       0xfcf580cd, 0xbdd739c8, 0xfeaa92d1, 0xd549ab78, 0x042a683f, 0x6169899f,
-       0x335ef2aa, 0xfa8dd387, 0xeea6cfbd, 0x7f6fb157, 0xffdd4a36, 0xdfbabb64,
-       0x6d87dd5b, 0xa0b52720, 0xb9076f6f, 0xd04ee989, 0x6fa0b5cb, 0x8e5e8037,
-       0x2f4157f9, 0x7a03d4c7, 0x06bf9639, 0x1be6397a, 0xfcc72f41, 0x3023b03e,
-       0x405d54df, 0x85d59be9, 0x78337e54, 0x0f718ab5, 0x888f718b, 0xc4db1971,
-       0xe04dfee5, 0x7f68a1f2, 0xc36fb454, 0x3c3e49f6, 0xd64828ac, 0x1d3a055c,
-       0x8f5e7e13, 0xc5f65ae7, 0xd768f9ed, 0xb32fbcf7, 0xcc2740ad, 0xdd5c3ee1,
-       0x0452e51f, 0xec2faf3f, 0x0efd00f9, 0x2d137b95, 0xaeb06e78, 0xf8a3e3e9,
-       0xb651abbd, 0x6c1ddd22, 0xfb142afa, 0x141578b9, 0x9e4291bc, 0x77f9de41,
-       0xf0f5f946, 0xc7d5e31d, 0x964501ef, 0xe48794e4, 0x2524c5d4, 0x0e7ba6ef,
-       0xf47b0d85, 0xb6fe74ed, 0xefbfbe87, 0x6fbfa9d1, 0xb77d55af, 0xf73c7d60,
-       0xcec9bad5, 0xf4a4d0be, 0xcefaa5e7, 0xfa8ec924, 0xefed85f1, 0xb738c1ac,
-       0x11453d8a, 0xde567e78, 0xde722c70, 0xd2ffc08f, 0xc8195dbe, 0xa19a2bd7,
-       0xbfafb33f, 0xc89d668a, 0x933bf9f3, 0x2387e4f6, 0x18906edf, 0x6c8b928a,
-       0x950dc523, 0x913bd537, 0xcda7952f, 0x4e39e1d4, 0xf61647b7, 0x73c38f3f,
-       0xc7d7185a, 0xe742573c, 0xf27fbf41, 0xe31fba1c, 0xde5bba69, 0xbb71c509,
-       0xdf869ef1, 0xc2913efe, 0x5227daf5, 0x8b87bdf8, 0x6284ef8d, 0xcf3ac5fc,
-       0x5aee1c3b, 0xa0ffad2f, 0x4a4377c8, 0x69926ef0, 0x3557a5fd, 0x7f4a0fb4,
-       0xd4c8a6cf, 0xe4a6f8cf, 0x71d75c10, 0x8dcf1f0f, 0xce3005c1, 0x62a2a4f8,
-       0xe891ff9c, 0xe9323919, 0xdc6fdc75, 0x3d62643d, 0x8e7813ea, 0xf5dd97de,
-       0x55b7e89a, 0x9fbdf7c4, 0xf22b7af4, 0x110523db, 0x880649c3, 0xb8533b7a,
-       0x77af919d, 0x389ca124, 0x1f92b66e, 0x62414579, 0x41efee08, 0xe0bcb14c,
-       0x97cbf265, 0x8ef1f235, 0x1142da5b, 0x8e378eef, 0x516f5194, 0x71c3abfa,
-       0x6facf8fd, 0x4fb45cdf, 0x335aee25, 0x3fdbe3f6, 0xb14eee5e, 0xee23bb50,
-       0x3f50d363, 0x4c169e3a, 0x9eab45fa, 0x37977b9f, 0x78f6fd70, 0xecad6c4b,
-       0x16e15e77, 0xa69dd1fb, 0x6aed7da1, 0x337a89d2, 0x9eaa99eb, 0x9d57ef8e,
-       0x77163e7a, 0x57a853c7, 0xe9945f3b, 0xb7538eee, 0x7fd71228, 0x7e7a8b76,
-       0x4ece0225, 0xd232379d, 0xcd9d5f0f, 0x4cc6e8d7, 0xd0acde78, 0x53f69589,
-       0x69e3c7d9, 0x1e3b2f5c, 0x390befcd, 0x5e13d4f7, 0x5b7de4fb, 0xb11dea3c,
-       0x4ee3c1ff, 0x2ad7666f, 0x5d9f80fa, 0xd3aed0c4, 0x68e62415, 0x3f727c12,
-       0x79fec52b, 0x97b400ca, 0x040ec90a, 0x3f210f64, 0xfdc3ea08, 0xedfeff90,
-       0xb7b71c59, 0xd440f411, 0x134d8c83, 0xaf4afef0, 0xe604080d, 0xe745bbdb,
-       0x198bf616, 0x4205d2f5, 0x756b3d2f, 0xbe78cae4, 0xeb435cb8, 0x81dd8272,
-       0x825d8a71, 0x13da5ddf, 0x07d233ff, 0xb416cb0e, 0x70f1ee67, 0xc0d9d63d,
-       0x4f4ad2f5, 0xa346effc, 0xb3a0ddde, 0x535a0559, 0x2fd0ac5c, 0xf5bd08ce,
-       0x3d1ef2cc, 0x25fb27d9, 0x5ff434f6, 0xce89b4d2, 0x7e842bab, 0x90372151,
-       0xb370b09e, 0xbd002f5a, 0xdf2f9545, 0x0837a81e, 0x5d47907f, 0x7277d8ae,
-       0x21fd35ea, 0xd011ed1d, 0x0e90a34b, 0xdcad53a2, 0x93ec266f, 0x28b69925,
-       0x5a75f7a4, 0x4fc504eb, 0xdaaaf080, 0xce297aff, 0xb20ceddb, 0xf4b0bd91,
-       0xf76b824d, 0xe90edc37, 0x8f04668e, 0xdbe1c66e, 0xbbf1c4dd, 0x8db9274a,
-       0x95d01ed8, 0xee4a33fa, 0xba87a8e5, 0x2f89437a, 0xf4805631, 0xb70678b0,
-       0x0be8ed37, 0x850bf485, 0x29f9140e, 0x5bbfba71, 0xf9872edb, 0x54e487f1,
-       0x138e77ae, 0x424b3b71, 0x06bf246c, 0x9d9eb91a, 0x8e19e257, 0xec1030f8,
-       0x9f9f8368, 0x2dd9a07a, 0x52babd61, 0xe45717ee, 0x45ad64f3, 0x7e2bfd87,
-       0x4cfce522, 0xb7895fe9, 0x16ff69bf, 0xebecdfe8, 0x0fdde01f, 0xdb257de1,
-       0x6e39f246, 0x6d2f72b2, 0xb2a3d111, 0x6f808b9e, 0x1f451fe8, 0x739bee0a,
-       0x7e7c81cb, 0xf746ddfe, 0xf943f2cc, 0x5c45f23c, 0x4f107e73, 0xbf72a4c7,
-       0x0e54cacc, 0x2a9166b7, 0x549beb7c, 0xc854d8fb, 0xf23aa7b7, 0x42dca953,
-       0xdae4b9f8, 0xa88c807d, 0xeef83ef6, 0xbdf88fe2, 0x0f402bbb, 0xbe7e7fc8,
-       0xa926b248, 0xe78e22f4, 0xe308bc55, 0x468c4e1f, 0x6decb838, 0xce789169,
-       0xce6be9ce, 0xc9359352, 0xec2e4fdf, 0xc4db0c2f, 0xd1529c73, 0x4a52c4be,
-       0x4b1c15f7, 0xd7e8ad23, 0x487a42af, 0x07fe39b8, 0xdbfc3de2, 0xc956f882,
-       0xde7e360c, 0xa6ddf81e, 0x417b3d45, 0x09c45d00, 0x4875ad3c, 0xfb598e74,
-       0xb9fb96bd, 0xd7e44966, 0x790a107a, 0x57a8b7bc, 0xa3e28632, 0x9d2c841e,
-       0x17f4d503, 0xe9fdafe7, 0xb101ea7c, 0xdc4507fe, 0x279d21c0, 0x8730fd1e,
-       0xcdf9f82a, 0x73a1e60c, 0x8dac59e2, 0x95c113d2, 0xb9d4bd7b, 0xd1da306b,
-       0xe40c3a9f, 0xb55da9ff, 0x6bf90435, 0xc1655b16, 0x93202373, 0xbc8c3fed,
-       0x78119eb1, 0xbdc4a4be, 0x9edcfb2a, 0xf11ab85a, 0x51ec1ce0, 0xdbeb88f4,
-       0x97b27f97, 0x1f3a69e2, 0x43da7d7d, 0x1e9bed0c, 0x5b28778a, 0xee9a3c34,
-       0x5b58b855, 0x7f6fae5a, 0xf654fd95, 0xaaacca0f, 0x0cb5857d, 0x674cf802,
-       0xe95eb93d, 0xc0a9fbe6, 0x33d74e39, 0xf2094115, 0xe050f88b, 0xaf702b3e,
-       0x3dc48b64, 0x674745a0, 0x5787fd40, 0x4fa8ac69, 0x37efb75e, 0x89af1fd9,
-       0x4886f27f, 0x68dea764, 0xfa7d94bf, 0x742fb8b9, 0x3bb78c32, 0xfc9973f9,
-       0xfbdbff7d, 0x63aa4df5, 0x3bc92a7f, 0x1b749f4b, 0xa237a748, 0x034b39cb,
-       0x4e8037e8, 0x0da5d1af, 0x3fdbf3fe, 0xa250d2c7, 0x9d7f6547, 0x517fb056,
-       0xd884b5fe, 0xfdfaecdc, 0xe7163b44, 0xb128d653, 0xa15ba417, 0x7bb276d7,
-       0x700bf703, 0xe0f28ec5, 0x553a00f3, 0x7c46f1f6, 0x277be14b, 0xbb9e5cf4,
-       0xfce9931e, 0x7bc90bf0, 0x2c7c82c8, 0xd7dd38fd, 0xb17fea52, 0x23f06dbc,
-       0x6317cfd0, 0xcf427a78, 0xbc94f9e3, 0xe5fb883d, 0xb83188be, 0x485ffd70,
-       0x9e5163e9, 0xc7fd217f, 0xa51f3cfd, 0x467e62b7, 0xe40b58d4, 0x3f14e84f,
-       0x87c10ade, 0x3c7fdcdd, 0x5471f6e3, 0x32ef624f, 0x2ff5bf7f, 0xcf5bf225,
-       0xf38e9601, 0x5cfb1f8b, 0x9f940241, 0x70e255fa, 0xac5b5f3a, 0x62e50fee,
-       0xb8fff93c, 0xd5f776dd, 0x86515d1e, 0xf26b9c6f, 0x5e65dc6c, 0xf64c9c5e,
-       0xad808941, 0xdb9d3c3d, 0xcf7e6ea9, 0xbd379150, 0xfb375f87, 0x0bcf27fb,
-       0x7cb5ee7f, 0xfe7193fa, 0xb6c0eaf2, 0x9fb05227, 0x0b2bbd12, 0xab9f1bef,
-       0xca1c43fd, 0x8f6d92f5, 0xb99e90a7, 0xda0a5d6d, 0x9f5b250b, 0x3e53b148,
-       0x8af641d8, 0x73bbaf96, 0xaf2f1df7, 0xeb6bd3f7, 0x3f9eb9d3, 0x0f2078cb,
-       0x4309cdf5, 0x3f46ad2f, 0x24aff278, 0xd6f44c8b, 0xe0e51ab6, 0xef8e34ec,
-       0x7c48c6ac, 0xa2fde199, 0xbefed8fe, 0x47c7e43a, 0x15d2bed2, 0x34ecbd43,
-       0x3663c12d, 0x82886f73, 0x64ad6cef, 0xf5fe67a9, 0x6139d307, 0x1f492ad1,
-       0x5be51fdd, 0xe3b470d8, 0x68c2d3b2, 0x0ed7731e, 0xd9f2c56f, 0x04f978cb,
-       0x38f1bb83, 0x9e9cf3f6, 0x804067e2, 0x9bc7f825, 0x3b71a767, 0x8906ce6a,
-       0x9c656bf4, 0x6b2367e4, 0x9d99d7fd, 0x39f3e426, 0xe521f137, 0x65a4db1e,
-       0x868ddec7, 0x1d6a0f7e, 0xf7c1a677, 0x499ccfa3, 0x2e333e42, 0xda067cfc,
-       0xc77ac919, 0xeeb8a50b, 0xcb8a06ad, 0x958aceca, 0x88fea0a3, 0x8d3cc747,
-       0x45659ce9, 0x3fa2942f, 0x3871b375, 0xf3e56f0f, 0x35592c5b, 0x53be3f68,
-       0x845cd0fb, 0x8c67b9db, 0xae2f1fa4, 0x3f628d4d, 0x02bfef62, 0x614d6ffb,
-       0xfbd8076c, 0x7b02ee98, 0xed4bef1f, 0xfca68eae, 0x94adab1f, 0xbf1ce9b2,
-       0x1f385b16, 0x237f51b9, 0x02b78ec1, 0x0b5ec91f, 0x78fe81fd, 0x107f6f46,
-       0xa43c99d7, 0xb13aeb62, 0x3f6864ae, 0x0f7f15dc, 0xdd7b21c2, 0x5aa8ad23,
-       0xe7e3498e, 0x5f1c1f7a, 0xf1fa471b, 0x4a978eb2, 0xb486fbe1, 0xded8d9c2,
-       0xd932e5b8, 0x3f34efef, 0x5de11b3e, 0xd7c0d5b2, 0xee7dd627, 0x17a89499,
-       0xfbd77fa0, 0xaba7b23a, 0xb4bc74b6, 0x1b79d20e, 0xe3fbd11e, 0x77aeadfb,
-       0xcdcf9896, 0x7046eae8, 0xd5d39ff8, 0x3f447113, 0x32ae815b, 0xaaba75fe,
-       0xe09cb65a, 0xe15a5af7, 0x9fc834ea, 0x90e2b9d3, 0xffa5ce9e, 0xb5dcf084,
-       0x2bf8225f, 0xbf6955fc, 0x9bdb8d32, 0x06cf1ae5, 0x7f04efd2, 0x3a2c16fd,
-       0xe681ef84, 0xdfa829b3, 0xe334db7e, 0xafbdd747, 0xd233bf9a, 0x7ff5f004,
-       0x734942c7, 0x1b448ef5, 0xc4572fac, 0xdf7e07dd, 0xce51a69d, 0xe05e48f1,
-       0xae2fc93f, 0xd62602a2, 0x92e51c2f, 0x7b420de4, 0xf3dee9aa, 0x379450da,
-       0xad52fb12, 0xfd2fb21f, 0xe68dede4, 0x12b4b37b, 0xf8fad1fb, 0x3527edee,
-       0xee43f7aa, 0xbd520f68, 0x8ecd71c7, 0x9d3d3280, 0x2ad4c4a3, 0xbf18f6f1,
-       0x4e9cd5d3, 0xc5e7fdf1, 0x7daea27d, 0x3f712f60, 0xdefd9309, 0xdcdf3835,
-       0x367c8599, 0x6f95bd70, 0x387e1276, 0x4cbf1e9b, 0xf8d364f6, 0x9bacdaf3,
-       0xb6c0ffaf, 0xe2677a4e, 0x173daebc, 0x7d2ea2ed, 0x43ee167b, 0x9f9c5be5,
-       0xa0e14fff, 0xd5ae9794, 0x649dbf73, 0x4f2efb21, 0x79f648be, 0x9f6e61d7,
-       0x4cbf3657, 0x85b7b4fc, 0x34aa47fb, 0xe851f96d, 0xd1d4584f, 0x37acfc8a,
-       0x954bdb9a, 0xe8ff9ee2, 0xb5072144, 0xff78713d, 0x9f3892e0, 0x7c34ec55,
-       0xb5e90037, 0x5271e34a, 0x305650dc, 0x0b8f73c3, 0x3e50cf48, 0x1afc697b,
-       0xee73f3c4, 0x3f902301, 0x8ff5907e, 0xfda7f24a, 0x9322d829, 0xe2ab297e,
-       0xc3adaf9a, 0x14c0f32d, 0xc1abe8a6, 0x2adef8aa, 0x6467f5bd, 0xe7e11eef,
-       0x3843555e, 0x3937b13d, 0x3aac553d, 0xebf68fa0, 0x9e82afef, 0xc26f3d14,
-       0x7441fe9f, 0xfb64cff9, 0xa33f217f, 0x5fd86ffb, 0x24b73f74, 0xbeb97a89,
-       0x8b733e73, 0x640bafb0, 0x24d55efa, 0x62ef3c33, 0x1e7421d1, 0x5236c05f,
-       0xe604e09c, 0xb17a4d19, 0x7c29fdb6, 0x9fe26587, 0x371891e4, 0x9d2e7a05,
-       0x3907e71b, 0xe8ae3092, 0x70124684, 0xf64f64f5, 0xe9396793, 0x968d4e5c,
-       0x3d639225, 0xa7a4c131, 0x315e9f8c, 0xfa7f5fcb, 0x4fedc487, 0x26f487e8,
-       0xf7e1eee6, 0x593dbc40, 0x4c64effe, 0x22f053fb, 0x93cc8b92, 0x9c6fcd3d,
-       0xa71e74fc, 0x9dcf0571, 0x89549f81, 0xf93ccdf3, 0x0ed167fb, 0x9f9fbc5a,
-       0xc4d09deb, 0xc9714a7f, 0xc258af78, 0x1efcbbfb, 0xbb307337, 0x7327e91d,
-       0xa95fdd00, 0x8c312dda, 0x366cab2f, 0x4d7f456c, 0x123daea5, 0xd35d79f1,
-       0xe7c47a27, 0xccef3c2a, 0xb97ff7e4, 0xf742daff, 0x8c2cabb9, 0x534557e4,
-       0x47e8a7ea, 0xa5cc38ab, 0x18f68568, 0xb7c8e9d9, 0xc6f2bc71, 0x3b97643d,
-       0x72ec9799, 0x6f1a8367, 0xf6fba37a, 0x5ba7e7a3, 0x8c62ef55, 0x63e9ccdf,
-       0x9ac3c61a, 0x43f939a9, 0xd54747c7, 0xc9bbdffa, 0xb5f0e74f, 0x51ab9dcb,
-       0x904ee98f, 0x4a8ef86c, 0x156b9077, 0x14ae47ea, 0xbf74d7ae, 0x017b2bbd,
-       0xf67717f1, 0x077c4cd4, 0xe3b1eb86, 0xcad26ed7, 0xdf19f37e, 0xdd7ffdc2,
-       0x1f64ac41, 0x1063bbed, 0x29fdc7ee, 0x39e90585, 0xd1cc7ef4, 0x234fd0bb,
-       0xae04e9ee, 0x9f0a68e3, 0xdff411cf, 0x3de6f864, 0xf3963631, 0x3c26e633,
-       0x62f7156a, 0xa516f894, 0x578116fd, 0x8917ecd7, 0xc46e9dfb, 0x04bcf05f,
-       0xbcf132e3, 0x229dd304, 0x4bcf137e, 0x88aaff30, 0x12f3c4df, 0x12f3c72c,
-       0xf88a37cc, 0xc12f3c4d, 0x60979e3c, 0xdf88a6fa, 0xa553823c, 0x1ae6b3b8,
-       0xa4568bc4, 0xfcbe81b5, 0xfc80f089, 0x13fd7540, 0x3f3a92e1, 0x8bfaa250,
-       0x5c6b9bd2, 0xb4a7e819, 0xfdc57908, 0x1d83eb94, 0x2af840bf, 0x15cf0ef7,
-       0xe90fbd3c, 0x8cf85c68, 0xbd5f4859, 0xf90c0dfd, 0xc774aed0, 0xf877ac32,
-       0x9b493df0, 0xe89a3f88, 0xc3c4f8fc, 0x05f75543, 0x5c8da4c7, 0x31f90d95,
-       0x6bdc4966, 0x50ac38de, 0x5cf0fbb1, 0x5b28a5bc, 0x0582f9cb, 0xd93ce4f5,
-       0x2ce38c59, 0x448d318e, 0xd53c3bfe, 0x1fba78f1, 0xb81fcebf, 0xa1f50930,
-       0x53f59d56, 0x3eba97f4, 0x9bb431d2, 0x529abf14, 0xe63a90cf, 0x3e376c19,
-       0x08d5712d, 0x0c881fec, 0xcf5d9cf9, 0x767e701a, 0xdfc4b04d, 0x916ab08d,
-       0xf6233c0f, 0xeb95ac7b, 0x55bd5ec5, 0x76768e1b, 0x78fe98d0, 0xf62ada7e,
-       0xdfd8b0f7, 0xf17f6223, 0x969c69bc, 0x8a61379f, 0x2a984de7, 0xd2c75a71,
-       0x274a5f0a, 0x21c4f6f8, 0xddbf157c, 0x1a3ee504, 0x9ea1c4f3, 0xd7c099f0,
-       0x919f0407, 0x79eb0ad2, 0x2fdd0f3b, 0xb4fe172c, 0xa0be714e, 0xe76953ac,
-       0x9dc7cf6b, 0x67f38c32, 0x13dc4fd6, 0x185cc41b, 0x8de53af7, 0x7507f218,
-       0xce3df9b9, 0xc8db4029, 0xfc1bd8bf, 0x73459dfc, 0x7af2993a, 0x295bd514,
-       0xe1159afc, 0x0718296d, 0x49e825df, 0x76f72bc9, 0xde40462b, 0xafab8bec,
-       0x8296d298, 0x925df571, 0x54788349, 0x3f7f95b1, 0x22ade82e, 0xbca7f441,
-       0xc4f46087, 0xef743ee1, 0xef0e237f, 0x7b37ad89, 0xef7e7017, 0x98f2f7e5,
-       0x84e30537, 0x29cf253a, 0xdfad878c, 0x8c41f939, 0x79d4ed87, 0x8efcc25e,
-       0xc41f539d, 0x694ed878, 0xff8b29cf, 0x389e01f7, 0xdfad978c, 0xf7e44539,
-       0xf36614bc, 0x3b5eebcb, 0x2bf5df85, 0xf1883ea6, 0xee0d13b3, 0x2f88d5c3,
-       0x6578e47f, 0x0cf7bdda, 0x99bca7c2, 0x7763ebeb, 0x1af8bdef, 0x21bde3ca,
-       0x55ff6e74, 0x7bc13c7a, 0x1b2bf365, 0xf6bacf10, 0xd60e88e8, 0xd2f27c37,
-       0x819ea9af, 0x689b2b9e, 0x6ba364f0, 0x979dd5e4, 0x2771c01f, 0xc1be7b06,
-       0xcc869ffc, 0x8c4c79a6, 0xeefc74e0, 0x3107a290, 0xef6bbd9e, 0xee90c7ee,
-       0xfc63f626, 0x132ef5de, 0xebd94fed, 0xaed0e3e9, 0x9b690aef, 0xee57fd8d,
-       0xfdf3f034, 0xbde8a3d7, 0xee749e88, 0xb21d2e6f, 0xabe50e31, 0xdb1dcde6,
-       0xc67e8d7e, 0x6f3a269d, 0xfae70aa9, 0x9b5c995d, 0xdfed08fb, 0x80fedbcb,
-       0xa261def3, 0xf452cff3, 0x74be40ad, 0x17bf325b, 0x66afcffe, 0xc9e43ee3,
-       0xca7ee85b, 0x0d267537, 0xdeb8e1c2, 0x83ef0fde, 0xc8eb8eb8, 0xf9152cce,
-       0x7c1113d2, 0xf9edc13e, 0x37fd7fb4, 0x2d7ca1c6, 0xfde5f88b, 0xf289ef38,
-       0xced097c6, 0xf7f0af61, 0x00efcecd, 0xf3bb41b8, 0x0e8a3af5, 0x4211daed,
-       0xa53bb6f7, 0xddf1b38d, 0xaf3d570c, 0x48da69d7, 0xa7d574f0, 0x76bdf7f2,
-       0xb0c3a740, 0xf95526de, 0xb257faf9, 0xb0bd0ed0, 0xa3d92273, 0xf42b9e0a,
-       0x78175652, 0xafdf8c2f, 0x337f132c, 0xfd998b8b, 0xf6174afc, 0x02f5df3d,
-       0xd0bfb5f3, 0xc8fba3a0, 0x0ab606a5, 0x7a1571e3, 0xb7bd8b28, 0xa657d700,
-       0x7d414da9, 0xfb6474a5, 0xf38ba46c, 0x868c6626, 0x39081f7a, 0x7cb8d655,
-       0x37bdea32, 0x431dcf9a, 0x56fa1f38, 0x4db7e1d0, 0x79ffb726, 0xb7fa605f,
-       0x50fd666a, 0x7cffcbeb, 0xdc9efa91, 0x138f7a07, 0x70cab3ed, 0x414e3fce,
-       0x5fe006fd, 0xfce10fb7, 0x7552ce62, 0x3c218cfd, 0xdf52b10e, 0x4ef2829e,
-       0x887d3fe9, 0xda83eb85, 0x2a277a76, 0x5944ddb0, 0xfc5d9bf0, 0xa35969de,
-       0x1df741d4, 0x3e91a410, 0x5d199678, 0xe9d38c6e, 0x73a21f6b, 0xbde03ec5,
-       0x34f12182, 0x8983595e, 0x07972dee, 0x7ea287b5, 0x0f690ce4, 0xeba7bd45,
-       0x8bde994d, 0xafebedc4, 0x1be09ff4, 0x9617f14f, 0x5376747a, 0x72c1e35f,
-       0x885e2ed0, 0x3e28037f, 0xeb40921b, 0xe60a692e, 0xed2da4f7, 0xf0386f74,
-       0xd3ae211e, 0x5d8f47e2, 0xfa472f4d, 0x87b3e7db, 0x57ff0bc4, 0xf74dd107,
-       0x438cbf3f, 0xb0d3283c, 0x785e7855, 0x15f7e241, 0x15f74f20, 0xc773882e,
-       0x41ccefb2, 0xbe173f88, 0x771d1275, 0xe7c4ed49, 0x88aabbcc, 0xdae9743f,
-       0x4349cf89, 0xae7c417f, 0x367dac2b, 0xd0f32df2, 0x4c7bfc35, 0x4fbc6cfb,
-       0xc8886173, 0xf724660f, 0x40daee07, 0xcca264fc, 0xcbd818e3, 0x0bf70b3a,
-       0x142f7871, 0xed6c6270, 0x3bb26a89, 0x8fd45674, 0x424a8762, 0xd6fbd7ff,
-       0xa9e8fb2f, 0x3777598b, 0xf0967d22, 0x9f406277, 0xf50d786a, 0xf49119be,
-       0xdc204dce, 0xfebe7394, 0x805f7fe1, 0x710a64fb, 0xe7821cac, 0x64ed19d5,
-       0x93b60057, 0xb6f95efe, 0x6ecbec81, 0xe436cf5d, 0xc7661d5f, 0xa9cf58e3,
-       0x2d935b6f, 0xf6fa7de1, 0x9bdf3c56, 0x7be3dca0, 0x575be385, 0x9efccbc6,
-       0x7c273882, 0xbe03ec4e, 0xf88b5881, 0x7e7df121, 0x0ff5e9a7, 0xb574df91,
-       0x0e9f1225, 0x4df3a7a4, 0x0a7bd34f, 0xbbae4127, 0x93ffecfc, 0x79d0af45,
-       0xc38c74fc, 0x3f7f5f30, 0xa9fbf7b5, 0x0db20764, 0x8f88e57e, 0x207cea35,
-       0xbd2f105c, 0x11703a2a, 0x5ba78fdc, 0x63a3bbf8, 0x821de8db, 0x9029f96b,
-       0x07f2fd97, 0xf501f203, 0xea3b5ef1, 0x2f51c70f, 0xf60e3840, 0x7dbb209e,
-       0x5d938f37, 0xf28d7209, 0x9ce9837b, 0xe41bb358, 0xb72e7f56, 0x87945e50,
-       0xaabf91b6, 0xce81af6b, 0x9f345637, 0x03f5c38d, 0xa65f923e, 0x488df9bc,
-       0x12bfe7b4, 0xc7c80376, 0xd94b8a48, 0xf6891cdb, 0xd4ee5287, 0x7c445278,
-       0x0ff2167c, 0xf642bca5, 0x553dd0a6, 0x39de8da9, 0x4de70af8, 0x632f21f5,
-       0x9c3ad19e, 0xd67ba712, 0x0a6bdfcc, 0x8213b7dc, 0xa07f019f, 0xbc572777,
-       0x0a05fdc9, 0x7c15283f, 0x679620e5, 0x28b7fa70, 0xde7843e7, 0x07df7483,
-       0xe140789f, 0xf9116c7b, 0xb10f8e73, 0xf68ab872, 0x37f72fd4, 0xb7b8b8f1,
-       0x3212b33a, 0xdaf59db0, 0xfc6b8f7d, 0x5fc7d128, 0x13440f90, 0x8ba1581f,
-       0xbd957584, 0x3abbd124, 0xe796b3a5, 0x50b67543, 0xe7bd08fb, 0xae718259,
-       0x15e7ebe6, 0x43154788, 0x34ca9c38, 0xdb2eeedc, 0xcf39d126, 0x3f3f1d05,
-       0x71437e03, 0x2dc70bf4, 0x9bfa47cf, 0xef42bfdf, 0xacdf1f6f, 0x5beeebff,
-       0x1f9e5a2f, 0x979d07d5, 0x3ad4dd2d, 0x5fdf5d80, 0x3f36a3a9, 0xb97d7ad2,
-       0x260bef32, 0x75639e65, 0x31e1fc03, 0xbe3e797d, 0xf8d0b8fb, 0xaf83c2af,
-       0xc1b342fb, 0xe017728b, 0x77b5e74b, 0xf2a45d5f, 0xbfacdeab, 0x73a6e652,
-       0x3fcd1b8f, 0xde4a7530, 0x0ad71413, 0x744f55f4, 0x37e37406, 0x024363de,
-       0x452511fc, 0x157bd1b7, 0xfcdba28e, 0x298111fd, 0x1a81ca30, 0x5170d98a,
-       0xdb38740a, 0x943c07d6, 0xb94389fa, 0x8131f55f, 0x962703c7, 0x231aff3f,
-       0xe86d8e3f, 0xc7df1b80, 0xfff043b8, 0x718fbe5b, 0xb7af304f, 0x574164df,
-       0xbffef74b, 0x7bb83f93, 0x3f3a79b5, 0x18b33067, 0x9d1adef8, 0xefdfd5b9,
-       0xb7b889fb, 0xe996f780, 0xee9a79fe, 0x1949fdc7, 0x49fcd721, 0x04646fa4,
-       0x574af9d3, 0x6f9215d3, 0x16392ddd, 0x6ae9073c, 0xde919b73, 0x5ff9feaa,
-       0xbb872891, 0xb8a6be5a, 0xcfefaeb0, 0x3ad8bc52, 0xb077b711, 0xb55bc449,
-       0xbcb04359, 0x7cabe0bb, 0xa45eb7ac, 0xf7027f3e, 0xe2a92ba7, 0x9f7bf02f,
-       0x1cd0d667, 0xdd6b3f7c, 0x3e30d953, 0x45cc6e33, 0x7376007e, 0x9f0dca38,
-       0xf51ac11f, 0xe88bf163, 0x72d24847, 0xe8a6023f, 0xe24a4847, 0xa3cc047e,
-       0xf453011f, 0xfa396023, 0x7e8f3011, 0x1fa3cc04, 0x47e8f301, 0x08fd14c0,
-       0xb88dfe58, 0x8c0dd12f, 0xcd39fb8b, 0x6097f7c4, 0x6fc030fc, 0x78bf7889,
-       0x777f3d49, 0xa04bef07, 0x7e2ebbfc, 0xcfc451a6, 0xf9d13678, 0xd95ed55f,
-       0xf7845b86, 0x18295c2a, 0x0873d347, 0x7b553ffd, 0x2b72db24, 0x79a74f96,
-       0xf9c96bac, 0xd7961674, 0x5ef86ceb, 0xdf13e016, 0xe2895acf, 0xea5aca98,
-       0x2e355fc9, 0xcdc53f6a, 0x0c483557, 0x0cd3acfd, 0x90ae4edc, 0x9d0474a1,
-       0x5d1e9297, 0xfb236861, 0x64bb7ca5, 0x5c9fbff5, 0xf132ea35, 0x78dce509,
-       0x2ac4ff01, 0xb16b263c, 0x79dace4a, 0x69fe13fc, 0x9137c5f5, 0x17a7e21e,
-       0x64f3c02d, 0xa7bf972c, 0x60151b7b, 0x374846e0, 0x6b2a7f8f, 0xe306b3d9,
-       0x0e356ea6, 0xe2a1e5ea, 0xbf3878fc, 0x4cf0518f, 0x30bdeef1, 0x0346ef5e,
-       0xd2bb29e9, 0xbf113b1d, 0xe4ece90e, 0xdfb4396f, 0xe9d67644, 0x7f2aa94d,
-       0x883c9e4b, 0x758b1dfc, 0xe1efc912, 0xb60f0ea9, 0x1e60a7bb, 0x89ee59f9,
-       0x563a210e, 0x5a90d0f0, 0x81f21af8, 0xf25699c5, 0xd819e56f, 0x113fa82f,
-       0x53eca557, 0xde894ade, 0x36622e4d, 0xc7305fba, 0x5389dfce, 0xc39b75de,
-       0x82839c78, 0x49378b57, 0x364eddfc, 0x5b3ce088, 0xcb4e73c0, 0xc74ef47b,
-       0x5778833c, 0xbfcfc34e, 0x78f3d763, 0xc2f8f986, 0x8177be11, 0x7c9327d8,
-       0xca1dbb7d, 0xe283c11d, 0x8d6f7eb8, 0x8e8bfec2, 0x373e28e8, 0x14beea2f,
-       0x71f9c907, 0x7920c714, 0x0c3fca67, 0xa9fe31fd, 0xa438638e, 0xeb841c2b,
-       0x253c456e, 0xd2838eff, 0x9425d523, 0x251c7e2a, 0xff7bb06e, 0xfc707b1b,
-       0x6efe2abc, 0xc5ef0dec, 0x3f7df505, 0xf027b94c, 0x0e29c619, 0x1f1ff5c0,
-       0xc4dbef89, 0xe1b6677e, 0xf6a2f3fa, 0x44aabdd3, 0x933fffd1, 0xfee0cf0b,
-       0x0b9943d8, 0xcc39e1db, 0x3e678046, 0x3f42402e, 0xf78ec7b9, 0x4bf67a53,
-       0xbe5f8a16, 0x5a6e6f8e, 0x5521f18d, 0x6bbd1249, 0x31b41f9d, 0xcffa122f,
-       0x21b7884f, 0xe26aaedf, 0x482ed67e, 0xe5dfbef9, 0x18aaf7a6, 0x826a3f7f,
-       0x53fbb7d8, 0x3a1f7f1c, 0x513e57c0, 0xcb7755d0, 0x7bb71e15, 0x1d6c3f73,
-       0xf8c73fbd, 0x0ff41f7b, 0xe87135e6, 0x2ac7f260, 0x10dbd378, 0x26f115b5,
-       0x9bb78324, 0x0e98eb35, 0xcd2906f5, 0xfc80cc61, 0xabcbe2ec, 0x7d9d6923,
-       0xf894c5fb, 0x98bf40f6, 0xbffd7f3f, 0xb0ff6b88, 0x47a5117a, 0xda5297ab,
-       0xefa2ed56, 0xcb6e1720, 0x6a7f35b8, 0xfe1f464a, 0xf6b46654, 0xf40ab923,
-       0x01d6fdcd, 0x6ba053fe, 0xdf5d1f8d, 0x773612d3, 0x351dea2d, 0x128f7a7a,
-       0x98978ce3, 0x32d80f89, 0x2aa3f4fa, 0xdf933370, 0x469997b5, 0xa6c7fc20,
-       0xf0356a25, 0x490ccefd, 0x74865e75, 0x3a43eb82, 0x44e914c1, 0x7cefe7eb,
-       0x9c240f51, 0x1700f5cd, 0xda2601e9, 0x81cb35d7, 0xeef8487f, 0x3fc5458f,
-       0x0ff0062e, 0xa61e5830, 0x062d55fb, 0x8946877a, 0xc90b1cb7, 0xf07d11d5,
-       0x27e70f13, 0x3b3c8383, 0x657fbee8, 0x1ef3c510, 0x3afc71d2, 0xc9c78eb4,
-       0xfe42b315, 0x7cf5d0de, 0xcccbee85, 0xf539e88b, 0xef3fa807, 0x33e93309,
-       0xe416626b, 0x257c3bfe, 0xe0106507, 0x4b2c6b9d, 0x9be0b8c3, 0x03bbcaa5,
-       0xd021ded7, 0x271cf78b, 0xaa6a77f0, 0x5953fe84, 0x54fa216c, 0x6a5661ee,
-       0xb06b1d3d, 0x1e10ff5e, 0xf465a1ef, 0xcd71c8ce, 0xa9eefe40, 0x13e3b3a0,
-       0x1b9fc912, 0xc5e3d2b9, 0x93ee7b7e, 0x71da7de8, 0x831dfcc1, 0xf3a14d3c,
-       0xaefef815, 0x7d47df86, 0x9029df11, 0x5fb95f71, 0x93ef77c4, 0x05b169eb,
-       0x7fb95b21, 0xb3fbbf98, 0x00fe1252, 0xb74b6ef1, 0x1fdde03b, 0x374aeef1,
-       0x08f59c2b, 0xcae981f2, 0x27d68ffb, 0xa6a07cf1, 0xf7788874, 0xcf7fe387,
-       0xf90da364, 0x3e70cd59, 0x04d29aff, 0xac948fee, 0xb98e51cb, 0x1c68c37e,
-       0x833fbbdf, 0x1fb2bbe9, 0xa72e3bca, 0x43bf1c43, 0x9ef811be, 0xe152b3cb,
-       0x4fd8f98c, 0x27af9f26, 0x43e3f399, 0xb93c8633, 0xc838e10d, 0xf87a839a,
-       0xb96151dc, 0xac47e012, 0x800cb996, 0xa69be87f, 0x69d66e77, 0xbc602bdd,
-       0x2f715a41, 0x3df82b5f, 0x82341974, 0x90f5dbea, 0x217a7a2f, 0x8abca3b3,
-       0x6c5ef465, 0x879f9192, 0x29863b43, 0x946469ba, 0x85fb8c83, 0xfef1fa8a,
-       0x7b98a28b, 0xd9fd4485, 0x673c4a35, 0x020efe2e, 0xb6173f23, 0xed411d0f,
-       0xdede1a5d, 0xb6f485ae, 0x51defe44, 0x9d036acf, 0x3e3d1683, 0xa4e3e498,
-       0xedfbeab1, 0x38f067df, 0x985d2505, 0xf9d15569, 0x74e955dc, 0xd577389e,
-       0x43d40a8c, 0x74c10d1c, 0x81f3af1f, 0x9df0bb97, 0xbdd972f1, 0x6bb413e0,
-       0x216f1d32, 0x5920b95f, 0x0a85ef67, 0x477c1f73, 0x0e31718f, 0x6f4be4cf,
-       0xed70dca2, 0xbaef8a39, 0x4c80ffdd, 0xfc67efed, 0x8ab6647d, 0x9f7903bf,
-       0x1a36b2eb, 0xb46fbffa, 0x0ef27e44, 0xf50e2593, 0x5fb122ba, 0x14ff82ad,
-       0x829c19ad, 0x787df576, 0x9c87dece, 0x3d793291, 0xf76dfbe5, 0x635d9530,
-       0x990ddf10, 0x25b7bd7c, 0x6bc5eff2, 0xa1891d0d, 0xa9bcea98, 0x8d86da90,
-       0x65f118fd, 0xdfcb0252, 0x25fc708c, 0x987633f7, 0x97ce9798, 0xae0933eb,
-       0xf1d3d60e, 0x6ea3ae38, 0x63a3ad28, 0xde8e258c, 0x8aef10bf, 0xfe70b7ce,
-       0x8f8631d4, 0x1ed2ca73, 0xe9c19e12, 0x9d17df07, 0xebf4b627, 0xba9f2ba5,
-       0x5bcdea1d, 0x927ba466, 0x4a999ff3, 0x1abcca76, 0xb247ee99, 0x45f7ea0d,
-       0xe2749e41, 0x0bdf02fc, 0x14177c0d, 0xa0f11cf7, 0x78448378, 0x9b4adb74,
-       0x7bdfcf1e, 0x009e8136, 0xdecd8bdf, 0x8a0bd424, 0x0adb266d, 0x43778fa9,
-       0xe5b807bf, 0x8ccbbbe2, 0x592126fc, 0x6e38ab8e, 0x7a22c6d1, 0xc33833a7,
-       0xdbb0fe41, 0xfd441ec0, 0x4e4c8ee7, 0xbc00933f, 0xb683cef4, 0x9fed063d,
-       0xaf1c193d, 0x525b8526, 0x269784cc, 0x3bbbf786, 0x9c149674, 0x936ac75f,
-       0x499ef506, 0x027e382b, 0x23b518dd, 0x059fbe30, 0x111efd21, 0xd72d67ed,
-       0x7e42d616, 0x90ed8810, 0xe19bc470, 0x0e8f9f84, 0xf119fc73, 0xd86fdcef,
-       0xf39fe428, 0xf3e26c36, 0xb4cffb12, 0x9ef0e36d, 0xf8fab9e5, 0xa0571811,
-       0xc3a3c3e0, 0xfd325ac6, 0x8901e0f1, 0x73d61ff6, 0x6d8de518, 0xccc8dcd8,
-       0x007e5401, 0x58d263f1, 0xe421c52f, 0xe7864ec9, 0x8cd1bdf8, 0x197be9e2,
-       0xb5ded7a7, 0x0a6fe25a, 0x01f8509f, 0xef1d83e0, 0xadfb2ac7, 0x2bff85f0,
-       0x43e0043d, 0x1be1457c, 0xf0517f0a, 0x8133e14b, 0xc01b3578, 0x6a08f77c,
-       0xe14cfc4f, 0xcd0eb863, 0x517f1f08, 0x76b759f6, 0xadfc868c, 0xe4f39f62,
-       0x40dfbb8b, 0x49989438, 0x1706b96f, 0x12e091b3, 0xf84d67a7, 0x47caea3e,
-       0x402cf70a, 0x416dfc7c, 0x331fea3c, 0x18f7d44b, 0x7d48be7f, 0x52ce717f,
-       0x59c5fdf5, 0x843e3f4b, 0x5086a77e, 0xbfdc04c7, 0xf33dbf53, 0xfe50a7e2,
-       0x90bdbf9f, 0x8becedcc, 0xb8e1cff5, 0x3cc482cb, 0x96bcf9da, 0xdcbe49e9,
-       0xfc30f426, 0x9732fb87, 0x8a2d3a71, 0xf28a3b0f, 0x29c22e6f, 0x611fdf0b,
-       0x89bfcf04, 0xf62539fd, 0xf73568a7, 0x24b8743b, 0x5dcc43f2, 0xad74e825,
-       0x97f25efa, 0x383dac31, 0xf97f77d1, 0xc4a4dfcb, 0xf72b5d21, 0xf96b1d95,
-       0xe969667d, 0x1c5fd261, 0xae50fbca, 0x96a1f780, 0xcf7bf2b6, 0xc4fbeaed,
-       0x3d76d9c1, 0xb71829f9, 0x1da6e6a3, 0x1b35f1e4, 0xb28a0b25, 0xbc5e5162,
-       0x57dd5256, 0xdf93247b, 0xd0cc6b17, 0xfa0bbf72, 0x1f38949c, 0x7c04be3f,
-       0x15cfee83, 0x5fae1c6f, 0xe747c7e0, 0x6979f28a, 0xf2954a1a, 0x571e0cc6,
-       0x03448c1a, 0x4b4faefd, 0x7e27cfd0, 0xa8bf2567, 0xda6e7f52, 0x37e83588,
-       0x7f01bb98, 0xfed7c79d, 0x6a5a9937, 0x26f428df, 0xfcf80de7, 0xfc2a38b5,
-       0x379a0ef3, 0xaf65d3d9, 0xdf157aee, 0xdcfb2fbd, 0x6ca67240, 0xcf5f3898,
-       0xa54ee770, 0x9f7e63f3, 0xf7ec52aa, 0x845f5db8, 0xd5509da2, 0x8671dfc8,
-       0xcad303b4, 0xef642565, 0x1e80da57, 0xf78fafc2, 0xcfd5f77e, 0xd95fb943,
-       0x9f41ab15, 0xa59df888, 0xc8afc6ca, 0xdefca0ef, 0x2abb6052, 0x6e50fbe9,
-       0xff985abf, 0xede411ef, 0x549d11d7, 0xb97b7335, 0xf215ef6a, 0x5fed579b,
-       0x63e8e91d, 0x13dfd7fd, 0xe8e2abb1, 0xcb86d8ab, 0x06fe0f74, 0x4c9eeaf1,
-       0xedc3eef1, 0x538a76ec, 0x2b8a32d7, 0x2ebbf6ba, 0x8d1fe4ee, 0xacdaac8f,
-       0x5ea078a1, 0x9e1fb5ad, 0xfb8b75c7, 0xbef58151, 0xd776e4cd, 0x7c23a025,
-       0x41bba377, 0xee9df3a6, 0xabbfee06, 0x15ba786c, 0x8256a5ef, 0x5ec30ce1,
-       0xd9543fbb, 0x7fa33328, 0x1fc61adc, 0x9e78dc45, 0xe842bbe5, 0x8f52981d,
-       0xf987af64, 0x34bd82f4, 0xc73e6fc0, 0x1b955e05, 0x2fb4b93c, 0x0387fe62,
-       0x96d29df4, 0x2b9ee9a7, 0xfd22ebd4, 0x8cc18fe4, 0x1cf5939f, 0x6e7679c5,
-       0x5ae74919, 0x953d9ea5, 0x086c77e4, 0x0b9578a6, 0xe9bdf53a, 0x53bc6253,
-       0xafee3c99, 0xb124e313, 0xe932abfd, 0xa44f38a7, 0x3a920bc7, 0x68b4e38e,
-       0x6dc05a77, 0xa54ba09d, 0x23a7a97e, 0x9fea0934, 0xd298fa6d, 0xd4bf512e,
-       0x728596dc, 0x30636cf3, 0xdb3d63dd, 0xb7fc87f8, 0x9e4bbc60, 0x3f25fd31,
-       0x74b292fa, 0x88b63f7c, 0x08eeb8fb, 0x43c4cf71, 0x886ce9eb, 0xacbed095,
-       0x9d5ef110, 0x6a87af8d, 0xff5d7e88, 0x4d5defde, 0xb15deebf, 0xfea046ef,
-       0xbd576c62, 0xd5bff62b, 0xff28a57f, 0xe3142a44, 0xb9c5e8f4, 0x101dff30,
-       0xe13ba08b, 0xcc3d9d8f, 0x7fde10fa, 0xdff01f65, 0xffbd030d, 0x668fb439,
-       0xec8239ff, 0x0ffdfc4f, 0x21f37fcc, 0x3d9b2f3f, 0xe895f052, 0xd7f41cf6,
-       0xfd73c477, 0x2816b9c1, 0x0e5a4011, 0xf802e5f8, 0xe61add39, 0x2cd0fc80,
-       0x02753f6e, 0xe187ebfe, 0xe58e3cc8, 0xf877d814, 0x35eb8c9e, 0x4cec8e7e,
-       0xbde0a6f0, 0x4f114ebe, 0xa6f70ce0, 0x17bf4044, 0xa7389e05, 0xdffc5378,
-       0xf56e74a9, 0x45cd3c52, 0xdf873f11, 0x1ce79fd1, 0xc475ebc1, 0xdee8ba5b,
-       0x8610dec6, 0x8de6aafa, 0x8ac3c210, 0x0d5b4c57, 0xa8d2767e, 0x5f0fae2c,
-       0xad77f3d4, 0x7cf8db5d, 0x5237434a, 0x7e05173f, 0xa46d0697, 0xf7129df9,
-       0x3cf54b83, 0xf463a1df, 0x0ecf7c9e, 0x85cf6efe, 0x387db698, 0xe91d85ce,
-       0x11da6714, 0x44d05eef, 0x497c79df, 0x17834ed9, 0x477e75e7, 0x2a03dd08,
-       0x3a66edf8, 0x33adec5f, 0xceffc848, 0xcf74600f, 0x00fd7ce1, 0x25e7d792,
-       0xcf37f92b, 0xfd411fbf, 0xa52f5595, 0xc0652cfb, 0x84ef5026, 0xb5f500b4,
-       0xc7cff5f3, 0x7e42fd21, 0x6c1de62d, 0x215fece3, 0x260f6e9d, 0xcec2f33b,
-       0x9ffba47f, 0xe06928f7, 0x9fb289b9, 0x59e9f7ca, 0x2e986edc, 0xcb2b34e0,
-       0x832dcfc2, 0xd026cf3d, 0x037d38fa, 0x002ec99c, 0x7177a27a, 0x239a794e,
-       0xeca7e825, 0xca3b108d, 0x379d0ef7, 0x87040fe5, 0x30bbf160, 0xf3c2ec8c,
-       0x2ec822db, 0xfa9a2d07, 0x932dbf39, 0x389543e2, 0xaba84993, 0x12663ed1,
-       0x2de4f37c, 0x706ef459, 0xe1c5305d, 0xbb7e3d94, 0x644ee286, 0xbd9777ae,
-       0xc8926f3a, 0xa69cf1db, 0x56bf57ec, 0x49fe45e0, 0x29d48e25, 0xe3c568f8,
-       0xb8c3f577, 0x9967f65b, 0x68aee3e2, 0x20639c79, 0x0964765c, 0x45efba3e,
-       0xe0275ba2, 0x502efe39, 0x2f0388b9, 0x2cfdc9df, 0x7aee6be5, 0x51e3f88e,
-       0xdf38c31d, 0x43a79e8b, 0xb4fee1fd, 0xded7c7e8, 0xa1cbf546, 0x41ff6f3e,
-       0x9b67cd28, 0x0392e28e, 0xdb96ebf7, 0xa5ff94ef, 0xd01e65f6, 0x0738fa03,
-       0x1edac2be, 0x40f91cfb, 0xa2e6c983, 0xd7b71e52, 0xe02cf3a9, 0xc44c19f7,
-       0xc4c33a1f, 0xf35689ef, 0x35f281f8, 0x71477f13, 0xd2a7c70a, 0xee85a61d,
-       0x36e9cfbe, 0x115cfe0b, 0x7487eb61, 0x41fb0158, 0xbf1f09f7, 0xb375ee8b,
-       0x7da8eb3f, 0x131e7ae0, 0xe1d1aeed, 0xdcff1e6e, 0x4bef9039, 0x24a9abe7,
-       0x38c23a77, 0xc97cc35e, 0xe30ced4e, 0x60480529, 0xe3858ddc, 0x0f18e743,
-       0xd29ddfd9, 0x743b4a1e, 0x52d95dbc, 0x5e177bf1, 0x44e2371e, 0x77c44d9c,
-       0xa1b43677, 0x38fc81be, 0x5ea50477, 0xeff5f843, 0x931e0386, 0xc593d77d,
-       0x7f129be5, 0x93d6ef43, 0x47a3d35f, 0x7a10ea7e, 0xfae1b39f, 0x7ba033df,
-       0xc5120def, 0xe959ff1d, 0x94ffc447, 0xcacf0e73, 0xe39d125d, 0xa47aaf97,
-       0x7cbef114, 0x4899a6d1, 0xca3aca0f, 0xed00acb5, 0xa6490eaf, 0x3f5d80f9,
-       0xf5c64a67, 0xfdf029e3, 0x513fd04c, 0x8067228e, 0x59654ed6, 0x6d953d15,
-       0xab9cfe84, 0x4e340da4, 0xf27762bc, 0xc27029f5, 0x638c1f73, 0x3701fc54,
-       0xcf32bf5a, 0x57a7cd1b, 0x788ea1f0, 0xe346efeb, 0x13247f7e, 0xfdf2b93f,
-       0x3fe17ec8, 0x2fd1b7a2, 0xe1fd2a59, 0x11d4127d, 0xc8839fa1, 0x046e30cf,
-       0x3cc0bb6f, 0x8087e853, 0xd5a6e37c, 0x1a43f3a9, 0x468cf9d4, 0x45ab3e75,
-       0xabbdb79d, 0xe3159fce, 0x3b42702a, 0x6c3def18, 0xd01ff717, 0x4bfbc60e,
-       0x1e630768, 0xd14c60ed, 0xb472c60e, 0x768f3183, 0x0ed1e630, 0x1db9eab6,
-       0xc1da298c, 0x8c359e58, 0xcb59c9c3, 0x0fb090fd, 0x9f8f3a76, 0x026efca1,
-       0x8fa885d8, 0xbd220e96, 0xa8be7d0e, 0xedfff437, 0x478805d5, 0xd44710a6,
-       0xc38c1cb0, 0x83135b6a, 0x93e203f5, 0x664c239c, 0xafb437f4, 0xd506bb3e,
-       0x63b30e90, 0xe257d610, 0xbe962a96, 0xd6efbf43, 0xe7fadcbe, 0x227df29f,
-       0xfbf287bf, 0xbef86543, 0x2e7e4cbb, 0x391dff23, 0xf7afb19b, 0x8ce303a3,
-       0x22f895fe, 0x368e8abb, 0x53fe5c12, 0x7c8313d7, 0x461dabfe, 0x2bf5677a,
-       0x4d931f71, 0xe77ea8b7, 0xde79daf1, 0xcb9d1293, 0x9c2c3ddc, 0x061ef7da,
-       0x790fbbfd, 0xd0f3a4aa, 0x9f77ef59, 0x4906de78, 0xa6dce383, 0x276470e7,
-       0x1c6f1164, 0x4ea77fca, 0xf51531cc, 0xa7f9bf73, 0xf85483bb, 0x787b7433,
-       0x0c35efc0, 0xd61fd554, 0x7bf01094, 0xbfd4430d, 0xf2c0f023, 0x4f676803,
-       0x555230dd, 0x6bd20aef, 0x28d5ca36, 0x85c597e2, 0x27c40577, 0x4f7eaa86,
-       0xa7ae896f, 0xbfa871e3, 0xc90c6f64, 0xb7986283, 0xf388a47d, 0x49c7a581,
-       0xb7c435ae, 0x3dfa256b, 0xde4279b2, 0xf96aa5b0, 0xe7e5a25b, 0x3646f87a,
-       0xbdce83ea, 0x84fef451, 0x16258f82, 0x811b0f66, 0x596dbcf1, 0xde1fb45e,
-       0xf117397f, 0x8dae42aa, 0x781bdfc3, 0xc36f7254, 0xc217a78b, 0x01de44f7,
-       0x38d63fdf, 0x2f0f112a, 0x3a39ce1e, 0xb17ce00a, 0x4b7ba641, 0xe46f3a71,
-       0xff0fb308, 0x209674e2, 0x8ddaffdc, 0xf41bfdfc, 0x3ee1c95b, 0x18dda8fc,
-       0xf6649411, 0x87c15bad, 0x41def4db, 0xaf5d704b, 0x02af4899, 0xd3e49a3d,
-       0xe932c395, 0x2463256f, 0x62b9e917, 0x4b7dca9d, 0x85a73d65, 0x78d2c83d,
-       0xef8a8fbf, 0x640fd317, 0xce1d6159, 0x1938a6ea, 0x61a6b8f9, 0x63a40c5b,
-       0xc3758e8c, 0xa8efe006, 0xef8a7f25, 0x227d9497, 0xf8ef8c33, 0xd09ee6ba,
-       0xdccf503b, 0x824db3ad, 0x5f1be3fc, 0x6595fba6, 0xed1eb75a, 0xb51d92d2,
-       0x5ee68f74, 0x82d26ef1, 0x9f6445ed, 0xc88b642f, 0xc4a73cce, 0x94780b9d,
-       0x58b6958c, 0x823dde60, 0x7788946f, 0xf1f7942b, 0xefe76cae, 0xb8503f3e,
-       0xf5e77e87, 0x902f5165, 0x9c3f7a5e, 0xfd00379a, 0xf6c91e4d, 0x1f4cf763,
-       0xc03fa0c4, 0xad57a987, 0x75703e94, 0x9fb9d908, 0xa184afe0, 0xb008c8bc,
-       0xf1e43f77, 0xbbf8bd19, 0xef78f148, 0x2a7fdbd2, 0x3adbc3ee, 0xc00a87da,
-       0x7823519f, 0x909dc33c, 0xdf568e16, 0x171aa9f7, 0xe9f7c2ac, 0xa08e8fcc,
-       0x7c1869bf, 0x607f97ee, 0xfeaaa252, 0x0d0c0f43, 0xbe1187a0, 0x742e74ef,
-       0xb44e2aa7, 0x4acb9962, 0xe4f1f4f7, 0xd21cbfce, 0x13678465, 0xd82bed54,
-       0x78bd5f14, 0x45ba3bfe, 0x7a6d7f84, 0x344a97b4, 0xba7d6e3c, 0xb79443a3,
-       0x442c3953, 0x25b79745, 0x72e53eda, 0x83e3c751, 0x3a7b1f85, 0x97d89dfe,
-       0x168d845c, 0xc9efe2e3, 0xa1c1ffa1, 0x54da3bd6, 0x3fc22271, 0xfdc69154,
-       0x36ae1543, 0x01df9e3d, 0x00b1b5fc, 0xfc8dca92, 0x6fa8085d, 0xf9e70d8c,
-       0x7fae2365, 0xc3fb0f2f, 0x0f2ac877, 0x2f4845cb, 0xf12bdf81, 0x0f9c027d,
-       0xe94273fa, 0xbfde719d, 0xcfc157e8, 0xc09438c0, 0xb5f1b27e, 0xdf7a1c9f,
-       0x9aa3de8f, 0x89efc85a, 0xf9933d3b, 0x3c00fbbd, 0x15fdf853, 0xfd12cf7c,
-       0x43be1fdb, 0x5dbbd678, 0x00b76367, 0xf73b4a8f, 0xdfe20677, 0xbe0f5802,
-       0x51a0b86f, 0x5e25b9b2, 0xfff2e10f, 0xf482dc01, 0x00800036, 0x00000000,
-       0x00088b1f, 0x00000000, 0x5bcdff00, 0x6595580d, 0xf3be7e9a, 0x700e01c7,
-       0x0427e540, 0x094a880f, 0x44101df6, 0x18293b53, 0x54da1595, 0x021f44a2,
-       0x9a2824fe, 0x2edb52ed, 0x4c7350c7, 0x4a976867, 0x57a3ab1b, 0xb5accd39,
-       0x8cce9a98, 0x7e927bbb, 0xa772b268, 0xa9aeae69, 0x66b663b5, 0x3b448dae,
-       0xb5b4d45d, 0xdfbefdcf, 0x23bef9c7, 0xb5cced4c, 0xd7175c3f, 0xfff79e73,
-       0xe7defe7d, 0xbbf79e7d, 0xc89132a3, 0x1befe24d, 0xffe56ffe, 0xd5a212ec,
-       0x441f9d07, 0xabe5a30a, 0xae0decfb, 0x60fd65cb, 0xcbf5c5da, 0xc32a63f1,
-       0x9c284a23, 0xd70770c7, 0x4d5dc69b, 0x27b53edb, 0x97f1ca03, 0x3463fc69,
-       0x284a83c3, 0x1e3c5ca4, 0xca8d9055, 0x0c61d689, 0xf1c0d11f, 0x3f685d3b,
-       0xaf214bb0, 0xa09d9a22, 0xd41eb974, 0x62bbdeb7, 0xc8614d3e, 0xf5e6cc63,
-       0x11741c2d, 0x1b8d1295, 0xe6e5c27f, 0x1487fd7e, 0xbbf70f75, 0xca21d065,
-       0x10e41d5b, 0x6a21acfb, 0xf9bdf867, 0x9dc1d117, 0xefeb269d, 0x60f37865,
-       0xbb17e8ba, 0xe87a21ce, 0x6e88b9f4, 0x7645c274, 0x798dfed3, 0xa22ff1f5,
-       0x71ff4c53, 0x1af6e9e3, 0x0a27510f, 0x7f0cb8b2, 0x8fb90257, 0x86688ca8,
-       0xccfa349a, 0xb2efc264, 0xf21e786f, 0xa3d3a0f0, 0x512162ed, 0x8f0c6890,
-       0xc7ad22eb, 0xd2593c03, 0xb8e92bd9, 0x48cbe9ce, 0x99dfe22d, 0x3bfa56c9,
-       0x3728297c, 0x61d869c6, 0xa3d31f23, 0x3d363eca, 0x8c68e3c2, 0xc8b43e83,
-       0x345f036b, 0x1bcdbc7d, 0x4c46e7c7, 0xce4db4fd, 0xb9f6e274, 0xd809461b,
-       0x574def10, 0x8361beb9, 0xf0c426bd, 0xa467ef83, 0x7d1cb057, 0x7a39c9b0,
-       0xc1f10f3e, 0xa97353dd, 0x80957818, 0x5b8c1fa7, 0xbc5cf214, 0x26d506af,
-       0x37fad1e8, 0xf9dae4ef, 0xe3b627e7, 0xfe788bc9, 0x92874d96, 0x559c782b,
-       0xf72ade9b, 0x6ddd13e6, 0xde54dad3, 0xf76539ff, 0xe5e82f5e, 0x86a53ddd,
-       0x52015dc7, 0xd8ee5f30, 0xdc419554, 0xdeebe5ae, 0x79e3bdc7, 0xe99c1bbd,
-       0x8f9f9636, 0x3b276d7f, 0x2759cfcb, 0xe24cbd05, 0x7e52f1b3, 0x18953ecf,
-       0x3f7964ea, 0x9e2050ab, 0x5fda57cb, 0x5b718298, 0x75888e3a, 0xbd1db2ac,
-       0xb5fff305, 0xc32de79b, 0x99bda1bc, 0x4e0d5798, 0x86dabcc4, 0xd15a2909,
-       0xb35afcc8, 0x75d044a3, 0x99f7076f, 0xa8817448, 0xba7b7c1a, 0x9ff02dc3,
-       0x59a13076, 0x6475f7d4, 0x0ed9fc0a, 0x1d3d809f, 0xbbbca285, 0xddf92bc8,
-       0xc75fefd9, 0x50e704f3, 0x7c079b61, 0x783a14f3, 0x092a77fd, 0xa8029c6a,
-       0xf7c17866, 0xff04b327, 0x5d88790c, 0xa27eaccf, 0x5e7c9326, 0x26a6e839,
-       0x455efc93, 0xae7c16a9, 0xbed2cb3b, 0xa9679bca, 0x52f33abf, 0x3e35fd4b,
-       0xaebf05bf, 0xfda5ba70, 0x1655eaf5, 0x6b8ac6fc, 0x0417ed2c, 0x9bf05816,
-       0xed2d6baa, 0xb069ae6f, 0x68badfd4, 0x56bea5a5, 0x97c16b5b, 0xd2dbb8ac,
-       0x0db6b6fe, 0x7900fa96, 0x7272c41d, 0x63e3f994, 0xf313ffba, 0xd7cef005,
-       0x7ccc7827, 0xd6d7399d, 0xdc8c33d6, 0x32dc861e, 0x07f5de7f, 0xe47c839e,
-       0x321ca4d8, 0x53cb100c, 0xf513eaaf, 0x305614d9, 0x2cbd9b0f, 0xbb6c4dc8,
-       0x8999fad8, 0x31f33ec7, 0x7ffd730f, 0xf6c1c8b1, 0x63b4e660, 0xbf19e3a5,
-       0x916fbfc9, 0xccc8ed83, 0x067d8e2b, 0x19ff0dfc, 0x5dc4df89, 0xf6fef067,
-       0xf20a2c37, 0x995e673a, 0x3d654dbf, 0xea9d37a4, 0x7cb23453, 0x0e4ddf62,
-       0x30c06fb9, 0x31e023cb, 0x17c04796, 0x0a9b1e59, 0x79665e88, 0x50ebec04,
-       0x3b2ff945, 0xde3c042a, 0x8df01011, 0x4f016a8e, 0xf808d474, 0x02458eab,
-       0x1343bafe, 0xb1d37efd, 0x3a77c042, 0x6ff944da, 0x7c05da3b, 0xca2823af,
-       0xa11557df, 0x8202bcff, 0x0339c2dd, 0xf6ed5df9, 0x2e7ced84, 0xf9e711d0,
-       0xfacabb21, 0xeed804ad, 0xdf14dd33, 0xd863aa68, 0x449146d9, 0x91c465e8,
-       0x8bf9867a, 0x37edc39f, 0x741d476a, 0x1b8f18c6, 0x381f13df, 0x3442bb07,
-       0x31267bd6, 0x1fc07e5a, 0x03e504f8, 0x2539f505, 0x3ebd9fcc, 0xf9f053ed,
-       0x4dc692e6, 0xae376c29, 0x09cdaafc, 0x46db7939, 0x8f93862b, 0xb23e5d5e,
-       0x638c141d, 0x29b8177e, 0xf0269298, 0x0e618b80, 0x88eec397, 0x0177de3f,
-       0x81e43e60, 0xb963e508, 0xb670cdde, 0xf10a793b, 0xe5c394f9, 0x142f2176,
-       0xc27ac870, 0xb41e5c78, 0xa9e745a5, 0xdf61241a, 0x84716d66, 0x1c921f60,
-       0xc895b614, 0x7225c9f6, 0xdcb3e05e, 0xe5857e3d, 0x478b5664, 0x327ef20d,
-       0x2255deb8, 0x0cec07da, 0xf73dfc9f, 0x514c229b, 0xd444a130, 0xbd72f58b,
-       0xa0d54758, 0xcff40146, 0xef4e3524, 0x41f596ef, 0x6bc59ff4, 0x30c15f80,
-       0x9c79f184, 0x7689d600, 0x185db289, 0xce7c14e3, 0xf49b24f3, 0x9642fec5,
-       0xdf65fb83, 0x9f6152e9, 0xe44ed273, 0x3f31eec1, 0xfeb9f9c6, 0xdbd9d4a6,
-       0x9a9fcc23, 0x26bfef38, 0xf34a5f32, 0xff9402b4, 0xc13f194a, 0x4c17e60f,
-       0xc4935319, 0xe7c6c4f6, 0x39f630e4, 0x3f062f96, 0xf41bba0c, 0x48dbe58d,
-       0x4f891afc, 0x1aa9fcb1, 0xf41bd28c, 0x512f991a, 0xff9505fe, 0x754cbe7b,
-       0x7ac6ecf4, 0x2adc5ae2, 0x7c6df3d6, 0xe69fbdba, 0x869370a5, 0x80cbdf41,
-       0x5eb4f267, 0x5d2351e8, 0x9a0bcf35, 0xe0c5ed79, 0x0bbb6c4f, 0x03e3b423,
-       0x779c56f7, 0x6d273e7d, 0x8b5ff9e5, 0xa0a73a67, 0x33f1e03c, 0xf6eae61f,
-       0x84da8fa2, 0x2937673d, 0xea54fe08, 0xb45b9aac, 0x9597f85c, 0x36bfab1e,
-       0x8d9aabef, 0xe8de7798, 0xcd95ff18, 0x6bd1ce32, 0xa6af71f5, 0xf56e312e,
-       0x6bbb6b58, 0xdaf0bf75, 0x5df96b02, 0xcbafdd7e, 0x91d83ca3, 0xbae5524a,
-       0xcbf09b68, 0xdc72bd2a, 0xe3af9d6c, 0x099a767d, 0x80e691be, 0x77f17af1,
-       0x7bd600ae, 0x7e050535, 0xbc04850d, 0x9c62c28e, 0x01d0d9eb, 0x09c891bf,
-       0x9fddc5bc, 0x5e9162eb, 0x87ded76d, 0x8e49f3df, 0xeb852936, 0xfbb5e333,
-       0x89bd17a1, 0xe1add437, 0xce96e6f9, 0x63bf402d, 0x2fe13e95, 0x178f731c,
-       0xdfe40bfe, 0x8fd51699, 0x17fed957, 0xf97adaf0, 0x897c007c, 0x160287cf,
-       0x7cf857f6, 0xe16d7e00, 0x79bf4206, 0xa61c853e, 0xaffd1b7d, 0x4721cef3,
-       0xf7f6c8e9, 0x1b3f29ba, 0xbc9cb1ab, 0x92a93a96, 0x55a70192, 0xa5afbf62,
-       0x8c24d866, 0x7c580973, 0xff3860b8, 0xe8bf90ca, 0x31c8f37c, 0x1b3a646a,
-       0xa7a58d74, 0x813fe741, 0x470dcfae, 0xc4955ed7, 0x3ee03639, 0x313d9ab0,
-       0xf6944d6a, 0x89387020, 0xd77e5932, 0xa087b21d, 0x89631f8f, 0xd25f1859,
-       0xbfa50a89, 0xef5f5ebe, 0x16341d47, 0x53a7a6f4, 0xba5df944, 0xcfb736cc,
-       0xd65cfb10, 0x7dfa215e, 0x88bda719, 0x092f9c75, 0x820f644f, 0x99d5da3e,
-       0xf9e7833c, 0x0abb59e4, 0xeec5bbff, 0xd742a6db, 0x4fabb35f, 0x55f4b8f1,
-       0xe842ee6f, 0x86a393d3, 0xb8b467bd, 0x7b8d1d25, 0x357957c6, 0xc8ef38bd,
-       0xf5299a5b, 0x85e81490, 0x8d8f3e71, 0xf2c2bb63, 0xe125cbbb, 0x7975e748,
-       0x12a7db02, 0x49d85ed1, 0x4fdc7f83, 0x4e3cd9e0, 0x0fc8ec39, 0x7e3f8413,
-       0x9ef0252e, 0x9256f31f, 0xbf659fc5, 0x81add857, 0xb38e92d1, 0x3323e269,
-       0x73ecaf19, 0x07eb8852, 0x1b5da52a, 0xdd85b8f0, 0xd1b57aac, 0xa9dcfb01,
-       0x4cb88bdb, 0xf498f7be, 0x4097de3f, 0x26fc933e, 0xf059a616, 0x4b12f524,
-       0x7c8a94fb, 0xe06a7d4b, 0xa8fd4b32, 0x3e0b12ea, 0xa58666a6, 0x39a2c67d,
-       0xbb4b3c16, 0x7b3ed2d6, 0x6e0b42c5, 0x596ca1d8, 0x8b6d3944, 0xb5c7fd2d,
-       0xcfb4b52f, 0xa961de0b, 0x44e060a7, 0xd6aff721, 0xb2df8ffb, 0xe4cf5ace,
-       0x2f4395b5, 0x928fdfe4, 0xe614fbab, 0xd967b55f, 0x84e5e87c, 0xebac7bae,
-       0xc7657fb1, 0xa29d9039, 0xffa628d0, 0xddab3ed5, 0xe2b4caab, 0x8bff5e95,
-       0xaf5cdd60, 0x9fb2eed5, 0xb29e40a7, 0xf2961cdb, 0xddba25b1, 0xc453429c,
-       0xf8dbf87d, 0xe1665daf, 0x2ebd2c7f, 0xfe038796, 0xb49bb730, 0x97072ac3,
-       0x3072ac86, 0x1cab69f9, 0xe558f714, 0x5623f2e0, 0xad87f039, 0x67da5072,
-       0x13b28395, 0xf6983956, 0x0c0e558e, 0xd7e58cf9, 0x3e5588f4, 0xe5345348,
-       0x8aebf08f, 0x89f956b3, 0xbf510fe5, 0x8f3cdfe0, 0xfde68f42, 0x185afcf9,
-       0xfe21afc3, 0x77e1bd30, 0x4e4f0ece, 0x67d55e01, 0xf7cf10a7, 0xabcfbe98,
-       0xf279b727, 0x74ee9ed9, 0xd0257568, 0x3aae5d73, 0x0d5ca4b3, 0x87881df4,
-       0x198fafdd, 0x5a59c7ff, 0x1a2fda03, 0x0bae59f5, 0x4dafd1f2, 0x39e97dc2,
-       0x1ddd8495, 0xe7c72097, 0x4758b27b, 0xa87b1ef0, 0xd271d793, 0x3ec0a5d6,
-       0x2b6b2737, 0xa2f6ffd1, 0x07708536, 0xfe82a0a3, 0x971cfff5, 0x1c7ebc0b,
-       0x151e7b89, 0x2416ca45, 0x7d62ed45, 0x7af39736, 0xf7e896d6, 0xb9eb9514,
-       0x1912fadf, 0xbd5248b7, 0x290f112e, 0x20e200a2, 0xadc8bd7c, 0x8e3d062f,
-       0x3d024fc7, 0x9b2a6dba, 0x7d388a38, 0xf067d829, 0xa53d3b55, 0xfe113f48,
-       0x7fee8e5e, 0x4eff5365, 0x0ed273ac, 0x97ab9cb2, 0x30e4dc86, 0xd3f27dd1,
-       0xdc5e0b5e, 0x7f696993, 0xa59f11f9, 0xb42e1fde, 0xa9f697d4, 0x44ecbc16,
-       0xb4fda585, 0x7c160277, 0xd2daa47a, 0x35b38afe, 0x229c7c16, 0x5f7fafef,
-       0xe3e92f92, 0x7de44563, 0xba9fdfd6, 0xf788ab7b, 0xe1ad7bc9, 0x23d7534f,
-       0x4ce23701, 0xdec71cba, 0x404c5c87, 0xfec5cff0, 0xb183ce2f, 0x6b47e96e,
-       0x294fbaf7, 0xdd3f51c9, 0xff0db3f0, 0x01558295, 0xfdc3b9f3, 0xfba2f9e4,
-       0x6d7f86f3, 0x8bd3cdf8, 0x721ce27d, 0x26cabc6e, 0xc911c1e4, 0xc7d79c82,
-       0xfdf7b0d1, 0xbde44be7, 0xc6fd7621, 0x9fe762ba, 0xed95ec5e, 0x729f71f5,
-       0xc335edd3, 0x5cba33f9, 0x735f1c2d, 0xb8f9f214, 0x79677d53, 0x9e7f7fde,
-       0xb3cfa4ce, 0x2e5cde84, 0xb3675fd7, 0x31a3f889, 0x52a991cf, 0x7f380d5e,
-       0x7e3bfb0e, 0xe37deea2, 0x1fd87876, 0x21ddbc79, 0x9fc708e2, 0x2c1b515b,
-       0x01443f80, 0xef8e338c, 0x7c0fe003, 0xae1fdc0a, 0xfd176a99, 0xbd4897cf,
-       0x1265da8b, 0x24807976, 0x5dda07ff, 0x0c317ee2, 0x181c85bf, 0xcc7c41fb,
-       0x62e32051, 0x398b8880, 0x062e321c, 0x4031711c, 0xfe50c5c4, 0xf02a875c,
-       0x02151d83, 0x2023be7f, 0xd51d23f0, 0xa3bcfe02, 0x721b9446, 0xe32f4b13,
-       0x1ff0663e, 0xa373886a, 0xe71e4620, 0xe5f927df, 0xd9aceb5b, 0x6f9c5bc3,
-       0x24a56aa3, 0xa6dbcf4a, 0x2dc8794a, 0x3b407495, 0xed48ffe8, 0x2945ecaa,
-       0x900ea788, 0x47fbc52f, 0x53ff86e2, 0x6ee830f4, 0xfaa357dc, 0x2461f526,
-       0xbfee34bd, 0xd0acfba6, 0x8c7d58bb, 0xba58dbd5, 0xbdeb3f8b, 0x8d7bde59,
-       0xa7ae85f8, 0xbd0c5f06, 0x16a45276, 0x605425f6, 0xef7d06ab, 0xd1eab24f,
-       0xbe92a5f5, 0x8623d003, 0x74de7ca7, 0x7687ce1b, 0x5607f0af, 0x90ccb6e8,
-       0xec87e6d3, 0xf3e27ce2, 0xed37e3d6, 0x7db779b7, 0x6eef9ea8, 0xe215bfbc,
-       0x201d9d5c, 0xda5f1f71, 0x737684a5, 0xf5a086bf, 0x2521147c, 0xfae46fae,
-       0xe35fb817, 0x33f3d896, 0xf221d620, 0xe6b5bc2c, 0x72fd6b2e, 0x33c91efd,
-       0x632760ba, 0x96570af3, 0x4aa0e7ea, 0x5f7237ea, 0xdd105ee2, 0xa1572e97,
-       0x873829f1, 0xcbb4af70, 0xce3846b8, 0x21f3af74, 0x8a2a3fce, 0x0a133d33,
-       0x746e4e71, 0x177c13a8, 0xcf41a1cb, 0x9e833ca1, 0xeae7184f, 0xe23f753f,
-       0x8bc7cf8b, 0x7fcf057b, 0xbe76e823, 0xff40aecf, 0x7a08f287, 0x3b41f3fb,
-       0xe73e99d9, 0xba09c60f, 0x7e3b627e, 0x94cfbe4b, 0x5f28b877, 0xb015c941,
-       0xa8c6fb1f, 0x65d661c1, 0xfb222d40, 0xe1bf588f, 0x99ee3250, 0xfcc8cf2d,
-       0xbd33cb44, 0x7b2605e9, 0x10ea5cd8, 0xa6dbbbfb, 0xff2294b5, 0x8b9ddf60,
-       0x5f1dde7b, 0xce00a686, 0xb12de3d7, 0x77b219fb, 0x47211533, 0x613fbc03,
-       0xb115aaef, 0x0497b63f, 0x989b7b3d, 0x02ce3c9b, 0x34068f0a, 0x96da00f2,
-       0x2307c10a, 0xae10d00f, 0xb9b8fb10, 0x8133b973, 0xde76449b, 0x8be0955b,
-       0x392207e6, 0xc7fe08b4, 0x9b827948, 0xde315506, 0x886706f7, 0xcd281e71,
-       0xc6d0fe93, 0x1fe16bed, 0x3934f65e, 0x53888741, 0xa74b138e, 0xf3ca943f,
-       0x1d3c1320, 0xbadfdd13, 0xe7b08a0d, 0xc02ba0eb, 0x9ec22bb7, 0x5d67f81b,
-       0xf1255e3a, 0x3c49373b, 0x516cf4e2, 0x117ee452, 0x013ec02f, 0x6bdc1fb1,
-       0x05f1e9f7, 0xfb1003ec, 0x18ec3940, 0xe031d870, 0x61c063b0, 0xc76100c7,
-       0x6a94be50, 0x43e71172, 0xacd2a33e, 0xaa6e8327, 0xc825f934, 0xe4719867,
-       0x91edcc33, 0x23d730cf, 0x47ae619f, 0x238cc33e, 0x8f6e619f, 0x4719867c,
-       0x1edcc33e, 0x8e330cf9, 0x3db9867c, 0x7ae619f2, 0xf5cc33e4, 0x719867c8,
-       0xedcc33e4, 0xd730cf91, 0x58aededf, 0xb3b71df2, 0x35dc86f9, 0xf21348ee,
-       0xa6af3631, 0x7efe720f, 0x3977d7e2, 0xa3e7c1f3, 0xebb7212b, 0xc954135a,
-       0xc96aaee7, 0x3e491b77, 0x3e0ad7f7, 0x7892ebdf, 0x1de19a95, 0x1e422fc6,
-       0xe640b2a1, 0x47910011, 0x011e4400, 0x4a847910, 0x0023cc87, 0x72808f22,
-       0x910011e4, 0x1e440047, 0x04791001, 0x0011e440, 0x3f404791, 0x910011e4,
-       0xf2394047, 0x23c88008, 0xaf24fca0, 0x6304f903, 0x0ba3f05d, 0x963cf72c,
-       0xcf3dcb43, 0x47e1c16b, 0x8fc3db9b, 0x8fc3d736, 0x8fc3d736, 0xa3f0e336,
-       0x47e1edcd, 0xa957719b, 0xfc17e84f, 0xf83f7369, 0xb8bc66d3, 0x6212f82b,
-       0xfaefd744, 0x91808bdd, 0xc571e524, 0x41ec67cb, 0x4f7c8c5a, 0x4dc95e24,
-       0x545cf955, 0x192b8b5c, 0x844b06d7, 0x7ea14fde, 0xf22df81b, 0x2d37ccb7,
-       0xcde4214c, 0x14c8bf8b, 0x513e46f5, 0xfddf31fc, 0xe7f84907, 0x5d7245dd,
-       0xbc957f46, 0x7da34076, 0x5dbe1f14, 0x3b46fcec, 0xeb4d2f61, 0x1f9b0be0,
-       0xbdff7cf9, 0x2cad929e, 0x8a6d7b4f, 0xb2f74ff0, 0x1870b59f, 0xf74b34bb,
-       0xf6daf69b, 0x7ee04b1f, 0xba8a0dfd, 0xe89e8787, 0x09673ea0, 0x0256d4e8,
-       0xd4c2623f, 0xd47f3d54, 0x71616336, 0x3c46dd74, 0x0044ed8f, 0xfd99e779,
-       0x79e26ae4, 0xb907fd66, 0xb9cfe19a, 0x7e811fa4, 0x0e4dcfb8, 0x263d812a,
-       0xaa7cbef9, 0xe0b4ff3c, 0x5c4d19da, 0xdb5f793e, 0x77f8668c, 0x8fdfb209,
-       0x7416489f, 0xb2a361bc, 0x99fbcec7, 0xbb028fb9, 0xbe855db9, 0xbcfbc9ee,
-       0xaf3126ae, 0xce6cd5d7, 0x75caefbf, 0xa45f70f9, 0x88a66548, 0x3c842bc5,
-       0xde37419d, 0x1fd88bdf, 0xc43ef89b, 0x1d3d5765, 0x24d0fdef, 0xa93dad1f,
-       0x91cd7c16, 0x2687ef2c, 0x1f855b39, 0xeec4172c, 0x16adce21, 0xf5abe59d,
-       0x9a95b7f2, 0x9e784bcf, 0x0bbf7756, 0x35359bf4, 0x6c346ab5, 0x275251ff,
-       0x36a6ee40, 0xebc31a6c, 0xd50142d2, 0xdabd03ee, 0x93f8125e, 0xe2170235,
-       0x27d62e53, 0x4149c3ce, 0xa4c89c25, 0xdbb821b8, 0xebf19a36, 0xe99c1b83,
-       0x548fbf68, 0xf89303b8, 0x7449767f, 0xc274455f, 0x5e40af16, 0x499477a8,
-       0x7c72d8fe, 0x57e2f20f, 0x58f9049d, 0x613af0e0, 0x8dfd626f, 0xec0f77d8,
-       0xec2adc7f, 0x21d39f54, 0x3fdd3afc, 0xb5caf06a, 0x29d1b67e, 0x43868ffc,
-       0x3ea07fec, 0xde30dfc6, 0xa1dfb043, 0x1f8e7186, 0x720d4ebc, 0xb7dacb55,
-       0x7383bbc5, 0xa9bda179, 0xf2e7d72c, 0x0152dff7, 0x0aed90bf, 0x0dfb29ec,
-       0xb9654e77, 0x52f4d86b, 0x915dee32, 0x6fe101e0, 0xa1f1b67c, 0x905f1964,
-       0x9d2689f9, 0xa6fc464e, 0x9347e759, 0x03e5eefe, 0xa96c5bb6, 0xf186ee71,
-       0x2bd7815e, 0x3f588afc, 0x9bfbc891, 0x82bf5c99, 0xb195b3f7, 0x361adbe5,
-       0xfec5d267, 0xae6fe1a2, 0xb95de7d2, 0xb7de29d1, 0x3890a0ac, 0xac86560f,
-       0xfee957ed, 0xada7aae7, 0xca983fe5, 0xa1f2277e, 0xdfa9df86, 0xdbd4ee93,
-       0x7bdebc34, 0xda7bf0b3, 0x5075c89c, 0x07e906dd, 0x4d0a7ed1, 0xb5cf8050,
-       0x775e33c5, 0xc32aa028, 0xba9bcdc8, 0x931f343f, 0x0c173d32, 0xb23b0826,
-       0x8112f070, 0x299832df, 0x8583ade0, 0x19b11cb2, 0x4aa473e6, 0xe3c7dd09,
-       0x41fba5bf, 0x265e0f37, 0x198207ea, 0x58078e42, 0x14c5318e, 0x165d3edd,
-       0xd6117a50, 0x36d4ef9e, 0xf9fae18d, 0x95f849bb, 0xe25fc3d7, 0x9ff0458a,
-       0x7907a14a, 0x6f9f1855, 0x0f21346f, 0x9756b07a, 0x1203d67b, 0xec202376,
-       0x1082e559, 0xd22c93de, 0x6fc0dbf6, 0xe0b5fe43, 0xebf00729, 0x57cb8a83,
-       0xe215ee24, 0x77c86cfe, 0x27d41eac, 0x8f26f1ea, 0xc50d278c, 0x5e58b09b,
-       0xc5b5051a, 0x47afae01, 0x9d12f06c, 0xa4aa4cb1, 0x77df5922, 0x91bc5b50,
-       0x353fbdcf, 0xb367511e, 0xb3f57e09, 0x8a07b79f, 0x32aa274a, 0x94db27a0,
-       0xe8bead92, 0x9f289e7a, 0xba665033, 0xf5d52f27, 0x032ef58a, 0xdf758ef7,
-       0xc341909f, 0x6c0605f8, 0xbf433a64, 0x772253ea, 0xfeea4c29, 0x64a814a9,
-       0xbe92d6d6, 0x79fe244f, 0x3c758b9d, 0xdff6d0f7, 0xfa08f16e, 0xd4fcfc08,
-       0x45838b35, 0xac1d867f, 0x77d01c53, 0xadbe0ec3, 0xb7a0e768, 0x3cc8eead,
-       0xa8b135f0, 0xc5be05df, 0x6db6e7d2, 0x3127db3d, 0x24cb721d, 0x5d5ceaff,
-       0x80b8f14e, 0xd3dc4e42, 0xb9e48b1a, 0xee5f0e42, 0xf11f9112, 0xb19fb889,
-       0x6fe00fef, 0xf497430f, 0xc36fe932, 0xa4b9f63f, 0xff080c7f, 0xe04fef18,
-       0x7f87031f, 0x18ff080c, 0x818ff0e5, 0x0e063fc3, 0xfc3818ff, 0xc7f84063,
-       0x16d87f28, 0xf33f7538, 0x685b51f3, 0xd39661ff, 0xee6b47c7, 0x51ef9e32,
-       0x238f92ea, 0x63fb1348, 0x627611b9, 0x7cb13ec8, 0x72a3cbb9, 0xf4fdb4b4,
-       0x547e5b21, 0x7cb69a9e, 0xdc29f3ba, 0x841fd983, 0x945b6b3e, 0x9194dc70,
-       0x3b89ece5, 0x3cbe8412, 0xd84b8f71, 0x89d73add, 0x5179dc97, 0xfedbbe7a,
-       0x27694eb7, 0x3c7c13c3, 0x78b6e2ee, 0x89ff7615, 0xac1c9af2, 0x1548b137,
-       0xd9c0197c, 0xb256f88e, 0xa5f28796, 0x4ce5e274, 0x57ff576e, 0x7ea2e7af,
-       0x173cd1cd, 0x11c36fec, 0x1f4ce6ff, 0x21136bfa, 0xaf1e0daf, 0xeac5fe0b,
-       0xbce2a98d, 0x7190cfad, 0x9140965c, 0x31f83307, 0xdfc64cbb, 0x80ef79fa,
-       0x127bf417, 0xc0b9c813, 0x2df24ed2, 0xb88cdf56, 0x2b5c6c62, 0x72795f1a,
-       0x22e23e4b, 0xf4ed49a3, 0xc42f4c5d, 0xd1255c3d, 0xfc6c4ab8, 0x5d5f4863,
-       0x19e78964, 0x7e994d70, 0xa9efd74f, 0xd4f743cd, 0xf01979a2, 0xbc541fe7,
-       0x79373f88, 0x674eb77c, 0x89cfa9bc, 0x3f348817, 0x62cae7cd, 0x8afbffbc,
-       0xbdf80f77, 0x56ec2fde, 0xebc2781d, 0x2151da69, 0xc429b6f4, 0xfac8d470,
-       0xdec1e4bd, 0x5f619f9c, 0xeb0b80e1, 0x5c06f26c, 0xa77f2669, 0x98094bb1,
-       0xf819fddf, 0x8e3265ed, 0x07d7c758, 0xf5b6efd0, 0x88a5ae79, 0x83dbb25b,
-       0x746b6ef7, 0x71fa3139, 0x625ef13b, 0x0cbd3e7e, 0x7de7eab9, 0xbe616ec1,
-       0x4bf8d312, 0x7e69be31, 0xb5fc2f6e, 0x62496595, 0xef2f06bc, 0x2bd00f3b,
-       0x1074c9d6, 0xcedfea74, 0x3cc4f9e3, 0xe18dee82, 0x7ac55390, 0xf1834ef0,
-       0x1390dec5, 0xe8dd2cf3, 0x6d7ef117, 0xdb479c9b, 0x862aea92, 0xbaf0e73f,
-       0x1e7ecc72, 0xb2e41dcb, 0xd1fa970e, 0x0fc2bd62, 0xa53a626e, 0x634cffc1,
-       0x3173d7bf, 0xf5f41abd, 0x5aa57537, 0x07aec6fd, 0xad4fe09d, 0xf2c4ae7e,
-       0x8e5d31e1, 0xcabc6e97, 0x08efe845, 0x533ef0b8, 0x6ffde9d3, 0x22b7e36b,
-       0xfddb523f, 0xf18f3388, 0x4fd265ed, 0x46740c7d, 0x3c3f383c, 0xfa53ef01,
-       0xf78bc6d7, 0x2edeb5b6, 0x7a21dfb1, 0x81f4c43f, 0x11ade25f, 0x093966f4,
-       0x535afde2, 0xd1bf95b7, 0x718924f5, 0x841bba9b, 0x68732dfe, 0x1d79af2e,
-       0xa0985e3b, 0x596a5d30, 0x3f9c15ef, 0xf2172d5e, 0x5ba1e673, 0x793ec573,
-       0x9273a09d, 0xd8879bea, 0x908dcb04, 0xea7e436b, 0x1b3ea54b, 0x932c1df3,
-       0x65839cf1, 0xbfe9c7c3, 0xb69b4f4d, 0x71005035, 0x15524cbc, 0xd4f5dbe5,
-       0x5f434fd0, 0x6538f56b, 0xa405b6e3, 0x9f0dec99, 0x0dcf6ddf, 0xdd019f43,
-       0xf9d62c9e, 0x917cf4c9, 0xf7baf14c, 0xe5d67e74, 0xe31ef55b, 0x7557dc61,
-       0x139bafbd, 0x28b6b09e, 0xb798deda, 0x83f64d2e, 0x5ece43fc, 0xf682e9d5,
-       0xdd7b44eb, 0xa376e99e, 0xec6ec871, 0xbb0e94db, 0x79115fb1, 0xa5db75ab,
-       0x99eeb75f, 0xfadf1124, 0xdf8775f7, 0x9ddb85b8, 0x3d77787b, 0xabac6bf6,
-       0x44ed2c29, 0xb053fb33, 0x73f4cb1b, 0x7b58b3bf, 0xc7a4cca7, 0xccf77f4d,
-       0xe2c5e844, 0xdf99ff1e, 0x1877d892, 0x67bde6f6, 0x0cf6f17e, 0x357cf45f,
-       0xcb74b1f6, 0x3c1b38bf, 0x7dc9ba66, 0x2a5c2d6e, 0x5f8139de, 0x6e357fb8,
-       0x81de4454, 0xffc25dda, 0x2b1df834, 0xbfac0d07, 0x1ca89e8d, 0xc91ffc18,
-       0xe50d726f, 0x0dff24e7, 0x60721b7e, 0x13e0dbf0, 0xf9359ce1, 0xffbac6fd,
-       0xb17bafa0, 0xeb5fbf2e, 0x4578b77a, 0xd0996b9e, 0x23573cf7, 0xafaf5ee4,
-       0x0f96b26d, 0x643bc9f1, 0x2f4337df, 0x9f247a06, 0x6539b606, 0x45df721c,
-       0xb9c5ca7c, 0xb963ac6f, 0xd66c6f1e, 0x74cb86e3, 0x94f9983f, 0x6a665e54,
-       0x53e484f7, 0xffafb3e3, 0x627dcfeb, 0x6d8ed27f, 0xe2fe138f, 0x82fd9ed2,
-       0x1e5bb55f, 0xbb71e674, 0x7719729c, 0x6df3b21c, 0xe7e22f7e, 0x76ecb78b,
-       0xca73ff42, 0xe562dd25, 0x077f4ebd, 0xe715d06b, 0xf73a628f, 0x7bb0f68c,
-       0xf59e79fb, 0xf193e36b, 0x6798c6ae, 0xe394b95e, 0x34d4b6c6, 0xd6d8d7cc,
-       0xabdc03f0, 0xab1fbb0c, 0xa5e3a777, 0xf1e52c3e, 0xafa797a0, 0x15d77352,
-       0x332f9c5d, 0xc972ace0, 0x79311fb7, 0x3b258ef1, 0xe227e7b1, 0x049ac41d,
-       0x82e5f915, 0xf3084882, 0x6eb18e42, 0xbc45db17, 0x89682987, 0x14758a7c,
-       0x02ff7c90, 0xf3269498, 0xef8ce91f, 0x305765e1, 0xd84bb7cc, 0x2107d3a8,
-       0xe8d3d434, 0x1ff61948, 0xf246b76b, 0x34f90c2b, 0x53b589c6, 0xc96fed23,
-       0xe9dfdc77, 0x525e3d3c, 0x79bae6a8, 0x4e1ffade, 0xfa3f1152, 0x12ba7db6,
-       0x6869be64, 0x15ac2cbf, 0xb7ecc369, 0x4683de40, 0x55776fde, 0xbdfb30fa,
-       0xebac0f28, 0x7bd6f189, 0x25d23f28, 0x15a723f3, 0xdfb8b73e, 0xe2f1b5e9,
-       0x2fb199bd, 0x5dff3e23, 0x9477e7df, 0x8b71e9a7, 0xc9fc1248, 0xff5d04ba,
-       0xf94712c3, 0x71b95302, 0x46f49fde, 0xf64cd292, 0xfd36c3f9, 0x76c8a43c,
-       0x1f6f8311, 0x9c73884f, 0x649d3aec, 0xca7c822b, 0xd6fd19f5, 0xed93d53b,
-       0xe29b73b0, 0xf66efbc4, 0x8e23369b, 0x154c1cd4, 0xdadb99f1, 0xe0eccf4b,
-       0x98db6e71, 0x5ebf0aad, 0xe997f3f7, 0x7d712ff6, 0x6869e6c3, 0x0bcf23bf,
-       0x53d9be3f, 0x2dfc42e3, 0x2b817bb1, 0xf2bdf85f, 0xabe4601e, 0x03542bd6,
-       0xfb0e5bfd, 0xbdb2bd08, 0x66f38050, 0xffe90ef9, 0x16d1b7cf, 0x75c73be4,
-       0x82cbccd6, 0xa8a9d87d, 0x176927f0, 0x7ee351db, 0x6923b6c6, 0x72cecd4a,
-       0x962bebd0, 0x32ff1e3b, 0xec76b19c, 0x7b8027a7, 0x817fb127, 0xa03d60fd,
-       0xb4b9564b, 0x4fbb278f, 0xa28af925, 0xbf53fcf4, 0xc2e4317f, 0x23359bc8,
-       0xf20a33ee, 0xf90e9751, 0x63f3d268, 0x0ae7bb9b, 0x4df779bc, 0x4e973be2,
-       0x647be634, 0x0f5583d3, 0x733e5907, 0xb5347a75, 0x7e01bdce, 0x713d8ad1,
-       0xe35ee2a9, 0xfd9ae60c, 0xf7dda6d0, 0xce5eef8b, 0xdf178eee, 0x177a54bd,
-       0x3ef2a654, 0xf54aed97, 0xc2e74ddb, 0xddfeba2b, 0xf2d73ad1, 0x8f334afd,
-       0x7ff1e5e9, 0xde2893df, 0xa5df192f, 0x8ed6e55c, 0xfbe34ec1, 0xf93ee994,
-       0x68964a5d, 0x3e361bef, 0x1d33c06f, 0xd3073bf2, 0xd4373677, 0xd696ff72,
-       0x6718c903, 0x956f43d5, 0xd7108533, 0x1a7c037a, 0x8766cefa, 0xf9a6cefc,
-       0x77bfe1a1, 0x3e435c81, 0x4b211c57, 0x50b6f17e, 0xb543f08a, 0xef90b930,
-       0xfc24bcd6, 0x6a76b3dc, 0xf86eb9c7, 0x44794625, 0x94d9c3a7, 0x7ff05cae,
-       0x7247dee5, 0x9c7c6e71, 0xbdbaf124, 0x7612feb7, 0x4e327b48, 0x120edffa,
-       0x50636dfe, 0xf7c6cbfa, 0x1baa4453, 0xe573f0f7, 0x95bc6289, 0xc63877fa,
-       0x10bfd8ba, 0xa83b1fe5, 0xf7c0eb1a, 0x77e79035, 0xf066e11d, 0x47f65df3,
-       0x4578ef91, 0xbb77bf97, 0x7bc4f3ec, 0xf8045622, 0x1d76ef15, 0xd11e4248,
-       0xecaac3f0, 0xf0ec05ef, 0x7e290e97, 0x4589c39c, 0x863dc427, 0x6ac978f4,
-       0x75b794af, 0xcbce733f, 0x2afc2d1e, 0x08e2d251, 0xd7e386bb, 0x34dfba1d,
-       0x2fdc1f84, 0xfb2d65ee, 0xd2d05fa4, 0x05f84a73, 0x7c619f86, 0xdf6ab747,
-       0x1827e129, 0x941f56fd, 0x283d6974, 0x6d0a1bcb, 0xa025bc46, 0xacbee014,
-       0xd9727c08, 0x38364bfd, 0x25e6f8cc, 0xbd000a1b, 0x5fa43c7a, 0x0b5be5f8,
-       0x33ee257f, 0x71f51bad, 0xe69a7719, 0x4636994b, 0xe5c5c77e, 0xefe83de3,
-       0x5adfdcb3, 0x50fbca0f, 0x8b6135b8, 0xdabb1778, 0x6cec00e3, 0x7cf388f5,
-       0x10ad9b57, 0x4a03c9ef, 0x8ee7f082, 0xc6b9efea, 0x3c4dfaac, 0xd45904e2,
-       0x13cb6bdf, 0xa7f2b8ef, 0x14193cf1, 0x8cbaef14, 0xfc2e67ef, 0x18a547e3,
-       0xe45c767f, 0x97802200, 0x096c7b4e, 0x53b325f2, 0xf8a0a522, 0x951f87a5,
-       0x00e44678, 0x60de50e2, 0xe9ca92f7, 0x695c467f, 0xaf8962be, 0x6568adbf,
-       0xe0eb4120, 0x6b8c9779, 0xfe7c8bf4, 0x8e52698c, 0x7be31cc6, 0x5f51ee24,
-       0x303dc478, 0xf89b5463, 0x228a8bae, 0x147768a5, 0x823e587d, 0xf084265f,
-       0xc93c8c3e, 0x983ccf32, 0xa8ef121f, 0x30df32dc, 0xf02e9fd0, 0xb431ce30,
-       0xda2dd4ff, 0x5dd1cac7, 0xa0fde4d3, 0x63e64e26, 0x399c546f, 0x9b9300ff,
-       0xfa0b5da7, 0x8bdbe4d5, 0xdef1e3fd, 0xbf03be4e, 0x0d6de7a0, 0xbe8e797f,
-       0x9efd1caf, 0xd324bae7, 0x0253fd03, 0xe5ddf101, 0x1ac7457d, 0xfd03ff31,
-       0xd0fe426e, 0xa738c778, 0xabde413f, 0xe716a92e, 0x5073e2ab, 0x563fb71d,
-       0x1de30b64, 0x16e403ff, 0xc7726579, 0x78b6d9f8, 0x395b1ef1, 0x3817cafa,
-       0x9fedb267, 0xfef0a6f6, 0x5152ffb3, 0x07eb8361, 0x26f63cce, 0x3dc1bac3,
-       0x7d8fb1fb, 0xf6235ac9, 0xfaa07271, 0x7e24c694, 0x56e3dbc0, 0xe645f9e5,
-       0xfbbd1ff5, 0x5b34e48b, 0xfa175d74, 0x78733ccf, 0xc45ba02a, 0xb51ce7a5,
-       0xcc5638cb, 0xfa642e7a, 0x6e70bbc4, 0xc17ee827, 0x5ee10b63, 0xef68e738,
-       0x1cdf583b, 0x7dc677bc, 0x6f3cedc1, 0x97c8e73e, 0x1af78a93, 0x64df9d30,
-       0x1ac0ed47, 0xef4a3cfd, 0x0579bdf4, 0xed57c9ce, 0x73037884, 0x963ff052,
-       0x1fc16f7f, 0x699ce3c1, 0x2a36def2, 0x4d3826bf, 0x072863e8, 0x3ed338fa,
-       0xd0b53bfc, 0x638f4534, 0xfc1a7e49, 0xf063f832, 0xdd33a0c3, 0x14a5e270,
-       0xf8b7d045, 0x3fae9287, 0xe2fd7410, 0x4b5626f8, 0xd70fe4ba, 0x7ffefa0a,
-       0xfbc8eba3, 0x0d85df93, 0xde1eefed, 0x7f659e5f, 0xda5ffd3f, 0xeff7d09f,
-       0xd613bfbc, 0x8677a5fd, 0x4e4127e3, 0x7f09b21e, 0x28bdf62a, 0x97b09215,
-       0x1104f6f5, 0xe412d537, 0x276c06f7, 0x349d825f, 0xeab8e3ec, 0x8afc3148,
-       0x638f4493, 0x8f5b115d, 0x5a78ff28, 0xb19390be, 0x7c4b2274, 0x9488e137,
-       0x54ed6fc1, 0x76dd3b02, 0x8733c8c0, 0x7a565f61, 0x42edde44, 0xf27416c8,
-       0xa1a9ddf8, 0xde78cb9d, 0x448b9bee, 0xd102e51e, 0x1f382394, 0x7f082457,
-       0x84953bb4, 0x9daeeadd, 0xe796fc28, 0xc2e7b6bf, 0x4dafed5f, 0x6edbf910,
-       0xfc3b647f, 0x3e09eecf, 0x7f4dc835, 0xf844d0a1, 0x6e05c1ab, 0x02f74f31,
-       0xb7bb0769, 0x83f7c8e7, 0xf209fa14, 0x48ae8f48, 0xeec17910, 0xc42c81dd,
-       0xd24c3ecf, 0x2e1f434e, 0xb873cbb1, 0x19cb8f3b, 0xd4d4ac3e, 0x62bc6336,
-       0x6d48eeb9, 0x797bb3c2, 0x3602f894, 0xb27e5c99, 0x6be4493d, 0xe2317d0d,
-       0xa782e3d5, 0xc64e8276, 0xebefb677, 0x5dd065f2, 0x0eefc809, 0x721bfa0d,
-       0xbba75a36, 0xb794af72, 0xabc7f7a1, 0x1e3fbc49, 0x77c04bcb, 0xaa71f56a,
-       0x32be740f, 0xeb12fb45, 0x7ccb5cee, 0x92fd63b1, 0x1df127fe, 0x95fe30e1,
-       0xd38f42b3, 0xd45fdfe8, 0xf523b493, 0xed16f7c6, 0x282defd6, 0x79153632,
-       0xdc47213b, 0x9abef7ff, 0x8dd80ab8, 0xc125df82, 0x4fff1c6e, 0x80efb0fb,
-       0xbcf215bc, 0x296bc4f0, 0xfdfebda2, 0x1f5fe189, 0x83947ff7, 0xdde4e273,
-       0xfc058caf, 0xad26a92a, 0x70f5d782, 0x70f3e7ed, 0x159fbd74, 0xbccddf11,
-       0x8e65fb5f, 0xfbdfb788, 0xeff7908a, 0x02ffceba, 0xb38b7a5f, 0x000040d0
+       0x00088b1f, 0x00000000, 0x7de5ff00, 0xd5947809, 0xe77df0d5, 0x9926665d,
+       0x6c81bc99, 0x44d84eac, 0x4242740b, 0x61db101a, 0x8311688b, 0x9817054b,
+       0x264f6408, 0xdac7f520, 0x0040cfef, 0x8b435151, 0x03b45a35, 0x341b0504,
+       0x024180d8, 0x2d82e00e, 0x5d6ad8d5, 0xc8a0d2da, 0x1b80931a, 0xcefc5dfe,
+       0xc9bef739, 0x82264efb, 0xf5ffffb5, 0xf8f8fefb, 0xf77bee5c, 0xce73ddb3,
+       0xe28ef73d, 0x8b94c718, 0xff12fb18, 0xdd98c7be, 0xd71b18c6, 0x2356329d,
+       0xcf2d4ad2, 0x03d058cd, 0xac62ccff, 0x9785addc, 0x653633a7, 0x5ef91a87,
+       0x4837e412, 0x6de43b61, 0xde549d7b, 0x23e79ebe, 0xa0cfcd6e, 0xc83aa3fc,
+       0xdeded04b, 0x5065c0f2, 0x6643b9de, 0x91dbb11b, 0xc2963671, 0xe30731d8,
+       0xcf90597f, 0xc9c0ac66, 0xf61be5b3, 0x45f6c5cd, 0x84e6764d, 0x1577cafe,
+       0xf20cbcce, 0x86550785, 0x2f37ca55, 0xbe43fad3, 0x60352c38, 0x9f3263be,
+       0x1ca7685f, 0x3bf50cde, 0x37292d3c, 0x553b18b8, 0x8d5e60e5, 0x4b776ab1,
+       0x18a3f5ca, 0xcf6f092b, 0xf52576c5, 0x3a970f92, 0x97e6c765, 0xb6bae1fb,
+       0x97bb3e4a, 0xf12dd2b1, 0xcf923bcc, 0xfff84be1, 0xf91ca358, 0x862f941e,
+       0xb7e83275, 0x32e4d590, 0xab5fc719, 0xf0dddd79, 0xd3a5553b, 0x7cbe4638,
+       0xed038c2b, 0x7c969e2a, 0x1b0ac4b8, 0xf8c0340b, 0xb39cbbed, 0x7d70b937,
+       0x6e11b4cb, 0x1addd75c, 0xe70c2bd6, 0x717a74ef, 0x5cb41b7e, 0xbf592f28,
+       0xd5182b41, 0x96e95fdd, 0xd579d6be, 0x980d4d0e, 0x53d3a3ca, 0x47798c55,
+       0x184be774, 0xbf4037f3, 0xb36b094c, 0xff7f7746, 0x96322580, 0xcccbfd8c,
+       0x1feee8eb, 0x43df4920, 0x013fc16f, 0x6e3da15e, 0xb781ab82, 0xdbfc3ac5,
+       0xb3b78ddb, 0xd2a3c0ba, 0xdfee6d99, 0x3c401f48, 0x106a7cc0, 0x11ae904e,
+       0x644cf3f3, 0xdfe81493, 0xc4ba67e3, 0x918f5f7a, 0x9f2ca8d6, 0x420b58c1,
+       0x78cafda3, 0x116c6bc8, 0x93f631f3, 0xa9fed915, 0x059fbf90, 0x57bce2e6,
+       0xc4228148, 0x690d6313, 0x24abbf48, 0xffd71b36, 0x94349c03, 0xf407eaaf,
+       0x99af7009, 0x9649bd96, 0x3093dcc4, 0xbdc4f05f, 0x214fd4e9, 0x3f42a3f5,
+       0x8fdfcf43, 0xe9639b9e, 0x322dcf47, 0x7ea4a9fa, 0x4fd6179c, 0xeb04ee4d,
+       0x8c4b727c, 0x7ea4ee7e, 0x2eb617dc, 0xd6898afd, 0x46515cf9, 0xf54e24fd,
+       0x97d400b1, 0x2d607a0d, 0x5dca197e, 0xef6389f5, 0x98ba6665, 0xdff912bc,
+       0xa6625c0d, 0x389c848b, 0xfa261d0b, 0xd0f258fb, 0x5bec7e93, 0x44830f22,
+       0x5f1a3512, 0x5c91afeb, 0x41dfd498, 0xbbfa3bf9, 0x31dc2e48, 0x0eb17021,
+       0x59b1c0f3, 0x816bc83f, 0xe831eb6f, 0xb129e61a, 0x36bd4c34, 0xefcba34c,
+       0x261c3956, 0x88dbf80f, 0x683ed023, 0x08911ceb, 0xa4d2f5f9, 0x365c205f,
+       0x27c11b33, 0x5895664e, 0x48cece2f, 0x9e9ddd3e, 0x826429bd, 0x8041ead3,
+       0xdfbba97f, 0x0d206ad5, 0xbb2b6be9, 0xb6f48421, 0xa7ac106a, 0x854f633f,
+       0x14848fae, 0x20a83f68, 0xd769e10d, 0xe3cdbf80, 0x28fe306b, 0x1c19ff1a,
+       0x3f8e0777, 0xf6f8e7ae, 0xf1963921, 0x2c8b831d, 0x18343be3, 0x177de81f,
+       0x0f8c55bb, 0xd8c09bf0, 0x685ba1f3, 0x22e0fb7c, 0x8d6eff1a, 0x8fc65915,
+       0x05ff1aeb, 0xdea5f71c, 0x82643fd6, 0x4b83fd75, 0xf8d7ebac, 0x0b655ffa,
+       0xb471f8c5, 0x16875ffe, 0x2e0ff5f0, 0xf3b7ebe1, 0xf7c6bb7e, 0x75ffc174,
+       0xdeadf71c, 0xa2743fd6, 0x9517fd75, 0xe76fd759, 0xcacbbfe3, 0x1a2ef8c5,
+       0x1950bdff, 0x6545ff5f, 0x0f66be34, 0xb48e90f8, 0x61957101, 0x040d9f18,
+       0x19254886, 0x6474a7e5, 0xfda0c61f, 0xe084363a, 0xa71c4770, 0x80e2cfbb,
+       0xf2dd5cde, 0xa381858e, 0x08559e40, 0x9fad2f9a, 0xa59ca1a4, 0x0b7b9072,
+       0x341754c5, 0xb0dfb4c9, 0x70f0f675, 0x937b6f98, 0x82fcc21c, 0x65879775,
+       0xbcd8efda, 0xb0a76c3c, 0xf0ff7e08, 0xcd1bd1a1, 0x174e8aeb, 0x5ac7a8d6,
+       0xe7c47c2d, 0x46cc9a13, 0xa6fcc256, 0xeb8c1121, 0x39031fce, 0xbe7e40ca,
+       0xd314720f, 0x078c2ae3, 0x9c828fdf, 0x6f999a65, 0x3c7df196, 0x991cdec4,
+       0xff827282, 0xbc38531d, 0xc2912d8f, 0xd6cfff08, 0x3e50d22e, 0x0789ac2d,
+       0x23cf77a0, 0xb9d4f028, 0x28de1ecb, 0x08bd3c11, 0x15891b9f, 0xa033fb19,
+       0xb6801fb5, 0xa5afb6b0, 0xbc2c2ddd, 0xcfea0d32, 0x483f935f, 0x3cdff587,
+       0xc6563edb, 0x07f983fd, 0xd98f88d8, 0x630e5b00, 0xaad71bb3, 0xe3732003,
+       0x56fdf56c, 0x0139fb53, 0x22e6fe6b, 0x0d5dbe6b, 0x37d436ab, 0x01b6258a,
+       0xd2b5bdfa, 0x938c6e5a, 0x78e1f528, 0x20fde315, 0x56f7cf85, 0x67e2c74c,
+       0x573af09d, 0xf98d6de7, 0x5952ef04, 0xd6cbf684, 0x4ff84664, 0x9d017aa6,
+       0xbe7a3baf, 0x3f875573, 0xf733e60f, 0x19e0994e, 0xbdd6ff3d, 0x18db7ef1,
+       0x563f6b48, 0xd7a30491, 0x79ff3d13, 0xa3d7a34b, 0x1f961e93, 0xe9cefe8a,
+       0x829e9a24, 0x1efa934d, 0x6f2bd535, 0x51efb2b8, 0x6e957d13, 0x17c96599,
+       0xea58e787, 0x5be6d617, 0x14d617ca, 0xafe7ca5b, 0xe7c9645e, 0xd4b4ee87,
+       0x9974b79f, 0xcad6fca5, 0x37e52c7b, 0xe4b5ad17, 0xb11e04e7, 0xf671bfd4,
+       0x6db94b06, 0x20d725ef, 0x25bf551f, 0x3e37dc33, 0x007b1d75, 0x5d4fc1f5,
+       0x71f10f8a, 0xf88d2aa2, 0x979554e0, 0x4ca6f6d2, 0xc1cb8047, 0x16715402,
+       0xad086b2e, 0x9972889e, 0x5e2cfc91, 0x1a1433b6, 0xe4adda08, 0xb5c9f825,
+       0x09008b1a, 0x174fac4b, 0xa6ca771d, 0x94f3d6f2, 0x67a302d7, 0x5b972cf6,
+       0x6e0f7f63, 0xe508bfcc, 0x00f26f4e, 0x3ee006fe, 0xf7f621d7, 0x8932f2e8,
+       0x33bf99e5, 0xfcf89cb6, 0x65b3909c, 0x6507971a, 0xcc9bf6cf, 0x8c8f983c,
+       0xf1aafca8, 0x28a8001a, 0x4f3b5127, 0x2e007a46, 0x50cbd0b0, 0xedb77f0b,
+       0x155e6993, 0xa3c61328, 0x235bc9c8, 0x1c899ca1, 0x68dd7c18, 0x7eff879c,
+       0x29aef909, 0xb6f5f699, 0x8f7de9aa, 0x3c9f882a, 0xcd544f4a, 0x5558f4a6,
+       0x55a3d280, 0x5fbe9445, 0x6b694955, 0x0f4a52d5, 0xfd288557, 0x4a6ad553,
+       0xa1aaabdf, 0x5aaa9df4, 0x1550ff4a, 0xcabdb4a6, 0x0fc1a94f, 0x4937f25d,
+       0xaec2abe8, 0xf2879d80, 0x565ac567, 0xe216dd40, 0xf21a5f73, 0x67d759f9,
+       0x3f1f5023, 0xa19d8efb, 0xbc1bdfbe, 0x77ade9a2, 0x5f49fa3c, 0xfe030829,
+       0x3b967b33, 0x9c9e38e3, 0x819d3636, 0xf867ba3c, 0x46dbbe13, 0x92415e51,
+       0x37c90d81, 0xdfa31dcb, 0x75f08c61, 0x7f313c3e, 0x016b98e7, 0xfd1ec71f,
+       0x7bf6366b, 0x717fec4e, 0x87da6407, 0x0f936459, 0x1b8265f1, 0x3b9d6bed,
+       0x0f3fbc84, 0x82ea3efc, 0x0660cb5f, 0x274904e9, 0x68db3bfa, 0xb1c20a67,
+       0xc40c3e39, 0xdc1ececf, 0x5c7e41e4, 0x8fd3669c, 0x918380c6, 0xeba43796,
+       0xd3fef32e, 0xad9fcd64, 0x9037a691, 0x5c26f63c, 0x4ae91a3f, 0x430e8fd7,
+       0x6a51a7fc, 0x4d38b3f4, 0xbf028fd3, 0x3432da9e, 0x61dfef81, 0x27d60fbe,
+       0x5d82bd12, 0xd5fff548, 0x1fade9f3, 0x358c3e63, 0x281c0fb2, 0xe86ca00f,
+       0x1e9dedf9, 0xd13e5778, 0xcd5f10f2, 0x2fa867ea, 0x5fffc1c4, 0x157ec10e,
+       0x06fd1bca, 0xfd90e41b, 0xdebdf8db, 0xf3b41e32, 0xb637361a, 0x156e9deb,
+       0x2ba0cc76, 0x1a1a5790, 0x3a2764cb, 0x92beeb75, 0x9b07c968, 0x7d96e9fa,
+       0xfc01ff06, 0x4152820f, 0x541329ba, 0x56b8a1d4, 0x23bf304b, 0x2f013f28,
+       0x2bd78941, 0x016ab477, 0x0b63912f, 0xe5b719ea, 0xbde77418, 0xef208ff1,
+       0x6546fe4f, 0xdff962f7, 0xae505660, 0xf720c51a, 0x2f9f906c, 0x9635b772,
+       0x77b940ce, 0xf9f7c6d2, 0x83cf2c05, 0xab114f46, 0xe73d46c9, 0x8e9b6623,
+       0xfb11fff4, 0x64d3279d, 0x1a6cf86f, 0x6afe73ad, 0xfa0b3eeb, 0x585f2599,
+       0xb017cd6b, 0xde90536b, 0x2ca9d60b, 0x5a5f212c, 0x9d36bdcb, 0x95642dfa,
+       0x41dec8ab, 0xbdc6057b, 0x00ca674d, 0x73f95f98, 0x43e7658f, 0xae363bfe,
+       0x7bf61ba7, 0xff3e1f71, 0xe6b0a492, 0x1a0ff287, 0x19707f33, 0x55e1f6c3,
+       0x6e42a728, 0x7accdbe6, 0xceebefe2, 0xc6be7a3f, 0x8fc3d27e, 0x6f21e620,
+       0x18e1fc91, 0x9b34da76, 0x10adf424, 0xbae037a5, 0xbe6b7a4d, 0x2f918380,
+       0x19dfca8f, 0xe9a7ff95, 0xe859892d, 0xc81488ed, 0xfa7325b7, 0x52417d42,
+       0x37c0b53a, 0x47ad3fe9, 0xd2ffe5ff, 0xff4207fe, 0xeffe96d9, 0x3ff697fc,
+       0x57fcc7ac, 0xfcbfeac6, 0x433b6db9, 0x9e4a6f20, 0x60c3c879, 0xd4a93a1f,
+       0xef00f8a4, 0x7a579b65, 0x284e0e90, 0xf3d20f21, 0x3d3cb0c9, 0x46ec3d16,
+       0xa23f207a, 0x5da125df, 0xfe84ff85, 0xdf753d4f, 0x3e67dc4c, 0x64eaacdb,
+       0x47b16d2f, 0x15afc0ec, 0xd833c58d, 0xe11fca18, 0xc8cfbbf9, 0xd2b26f98,
+       0x0f93c967, 0x0dffa0a5, 0x13d84528, 0x2a97d211, 0xc5cc3eea, 0x3ac8287d,
+       0xdba2cf89, 0xfae7f8e1, 0xd7cc7c90, 0xc3967a12, 0x0fcf493c, 0x1b04b80a,
+       0xa3233bef, 0x72b593ef, 0xfd54683f, 0xd4ffa122, 0xc749dcdb, 0xdf6274c0,
+       0x7941df61, 0x8583c069, 0xbd53feb9, 0x4731e1f5, 0x756d3e60, 0x2648f1bf,
+       0x767c1938, 0x2ffe61b6, 0x2ef6f79e, 0x9d85db8f, 0x4c2eddd7, 0x424dbced,
+       0x69e66b6f, 0xa0f11a99, 0x41b65c5e, 0x73e085f5, 0x4f4db6d9, 0xea768a3c,
+       0x70df76bb, 0xdb74bfe8, 0x00987f4b, 0x6aedd2f9, 0x0cbe0cd2, 0x8dd29497,
+       0xbffc2097, 0x1e376c74, 0x92f57e4a, 0xbfcd1de6, 0x374fb8ff, 0xefb74a3e,
+       0x9ee8d8d3, 0xb0d298f0, 0xc5756b4f, 0x91c34bc0, 0xaaafd45c, 0xa1ae7eb7,
+       0xaf72793d, 0x63d352c4, 0x4bc373c0, 0x9c2027a4, 0x4f028f08, 0xaa8b785d,
+       0xa0bc041f, 0x14f0373c, 0x9080fe5d, 0x779fd83f, 0xd3f3d114, 0xf95fa3cf,
+       0xd70fbb3d, 0xedf4f45f, 0x71c75c1e, 0xf5d392a5, 0xfc532b63, 0x1a916e30,
+       0xe529d14a, 0xff1e8bdf, 0xe15bd121, 0xe14c3f1b, 0x9fbfa0f6, 0x50a6f68d,
+       0xc2df5c3f, 0xfad037f5, 0xe880580a, 0x3931e8ae, 0xa7e90c2f, 0x3dbe9b0a,
+       0xc8645f06, 0x6f8e2f9c, 0xd60b8504, 0x12ed1c77, 0x4efeb3f4, 0x7f266f0e,
+       0xfc8622c8, 0x3fc343ff, 0xfe5316ce, 0x93c70753, 0xbe09b643, 0x4ccf6d02,
+       0xb77775af, 0x0d4e7e20, 0x1fa2a7f2, 0x9094c82d, 0x25f48780, 0x31bf2bf4,
+       0x87e3952d, 0xd16c9579, 0x2980f40e, 0xb7eb1df8, 0x18e77ea8, 0x65f63b4b,
+       0x4bf8f77a, 0xef30f8c4, 0x8fbfdc38, 0x86a2b0a7, 0x55bbeb18, 0xf61ef836,
+       0x997d1371, 0x7bf39bf8, 0xbf9c3ddd, 0xcf0f7e0d, 0x9fe58e9a, 0x07f9c9bc,
+       0x08fee1db, 0x52a48af3, 0x25ebbef9, 0x16760792, 0x75d7c589, 0x6b6be0aa,
+       0x302741b9, 0x304a456f, 0xdff60bd1, 0xfe4fe087, 0xd07582b3, 0x832f24ce,
+       0x67a79e38, 0x16df067f, 0x251ffe0a, 0xad9ff95b, 0xbbdf7ce7, 0x7da2157e,
+       0x3f0d4cae, 0x2bf228f1, 0x8bc867f0, 0xe1e6aafc, 0x1fd74fba, 0xc04dc3f8,
+       0x0c1ba7a7, 0xcfcab53e, 0x7a2d3e68, 0xf484b376, 0xa7a7cd19, 0x891b408b,
+       0x3df0a7c5, 0xb5169f26, 0x9f953ffe, 0x8faefc06, 0x0f219f82, 0xb463837b,
+       0xf3633c3c, 0xe5a33c12, 0xc9bdfc21, 0x9fd27bb2, 0xbd067741, 0xfcb2fc95,
+       0x1817f222, 0x5dd06974, 0x741a5d17, 0x62ffc3d7, 0xf9745f81, 0xa005a460,
+       0x2a5dbc93, 0xcd6555d9, 0xda0c3cfc, 0x8b203cbd, 0x6da7e4e0, 0x3cbcd58c,
+       0x0f9cc920, 0xa21be547, 0xf2a3fbea, 0x03f55179, 0x4b4af951, 0x03a6b2fd,
+       0x47fc231a, 0x4becf52c, 0xc41f651f, 0xfd8c87b0, 0x4678d826, 0x0c5d210b,
+       0xde50d4ec, 0x0541cba9, 0x1ee0ff45, 0x0ec5ec99, 0x182af180, 0x3d3ea3a7,
+       0xb1b9021c, 0xf0edc9d2, 0xd3d3bd0e, 0x8995d207, 0xac99df3c, 0x67b942ad,
+       0x7274ef7c, 0x5e47473f, 0xe4d127a7, 0x2cd238a7, 0x0d6edc93, 0xfcb1e9b3,
+       0x10a3b020, 0x6f595bde, 0x39ffdce5, 0x5e0d764d, 0x8d68f68a, 0x771343ec,
+       0x3d1bb2c1, 0x68e92ae8, 0x6ccd7a1e, 0x55f0bef8, 0x3a558e99, 0x70633ce2,
+       0x57e42c5e, 0x89ec99fa, 0xb3f42c13, 0x6ccfe889, 0x82c576e6, 0x08fa5135,
+       0x54f4435b, 0xa1a25ae0, 0xe03b053c, 0x973fab7d, 0xe88945f3, 0xb5bd68af,
+       0x278f68dc, 0x95df685a, 0x03cb59d4, 0x65da3ec2, 0xcb0649f0, 0x86833920,
+       0x42e7da0f, 0x47934f2e, 0xf01b335d, 0x665071d1, 0xb6799e78, 0x9c7c2659,
+       0x97e7e7ad, 0xfc4c942c, 0x493ac156, 0x6a701a1e, 0x7ad27e43, 0x3b6d5797,
+       0x177d9cfe, 0x3fcecdd2, 0xa439f98e, 0x1ddf3b6d, 0xcff31bb1, 0x8ff83dbd,
+       0x29fd67ac, 0x37e49d7b, 0x26ebd8ee, 0xf3d8ef7a, 0x6177c1db, 0xfc9d977e,
+       0x3f7b1d75, 0xd7f4831f, 0x845edcb1, 0x1063aef2, 0xf7aa87b7, 0x95a63e7c,
+       0x8415d7f6, 0xc6b2a3b7, 0xbfe6a3f5, 0x3092961e, 0xdea15585, 0xf89e37b0,
+       0x93bcf829, 0x7b1d0bfc, 0xb80ecf3e, 0xa9eb75fe, 0x1d39e710, 0x59fb366e,
+       0xf7225f9c, 0x8f770783, 0xcf0cb4df, 0x69f71ba3, 0xca7ca1f3, 0x831f7f0b,
+       0x59e3b472, 0xabb50fae, 0x79e38fad, 0xe1fc8745, 0xdce01532, 0x9fd54c8e,
+       0x1194fbb1, 0x62a34393, 0xe4efe5c1, 0x7850b937, 0x4fb70a68, 0x21e1fdff,
+       0x73bcb9f9, 0xae121d87, 0x7fc38bfb, 0xd7b0b944, 0xac69744e, 0x32c374f7,
+       0xb7ce57d2, 0x7fcae1ee, 0xd0b83a17, 0x0b914b75, 0x7fd4f759, 0x5aff7c73,
+       0xa2fcd2f6, 0x9d27a0f9, 0xf283b9ef, 0x9a3edcdb, 0xfbd205ef, 0x7869ff82,
+       0xeef0167f, 0xabbaff39, 0xddd7cdff, 0x9d5fde3b, 0xe3aef02b, 0x85f07f79,
+       0xbefcd3bf, 0xf4db9cae, 0x0dee94df, 0x9b15febd, 0xa80ccdf7, 0xb8d59d3f,
+       0xb2b8b150, 0x19abff7c, 0xc0cafa50, 0xdf388903, 0x37e751c9, 0xc2a6fa46,
+       0x92c9a6ed, 0x9641ec8d, 0x907b0928, 0x840351db, 0x496030fe, 0x0321e901,
+       0xf5cfde06, 0x0ebbc506, 0x195f1fcf, 0xb147df3c, 0x3bec6c14, 0x97ebcc01,
+       0x9ed5bc8b, 0xfcc4b9fc, 0x603a3478, 0xa20ff7f0, 0xa0703b5e, 0xa42f7a4c,
+       0xe8beefa4, 0x97bfce99, 0xe7bb1669, 0x0ed5af4a, 0xdab24dca, 0x7f45534b,
+       0xff9f18d3, 0x0e149734, 0x0f261c03, 0xfa1269fa, 0x570f2747, 0x5cf90499,
+       0xf6815816, 0xb59754c5, 0xc33c06bf, 0xe1cdf719, 0x380d5768, 0x8797590e,
+       0x93241c70, 0x70bcf49f, 0xdc1379c4, 0x2f18c232, 0x871f14c3, 0x1f729f63,
+       0xbd859df9, 0x904d474d, 0x5aab5c57, 0xb4159f90, 0xc81c3997, 0xe5ec36ce,
+       0x84cde0de, 0x2188adfd, 0x032bf80d, 0xdad3bf65, 0x06dfd91f, 0x3e2ebe5e,
+       0x537e3c0c, 0x851bbcbc, 0x45ae8197, 0x74ebf20a, 0x62fa17b4, 0x1f9e0cfd,
+       0xdce85218, 0x570bd84d, 0xa4291778, 0x50cc0cf7, 0x8e855f10, 0x1cf0aba6,
+       0x6893e1c4, 0xd9b7171e, 0x64707f68, 0x91f70449, 0xdfe50ab5, 0x10e3e9b0,
+       0x7b2f33df, 0x0c9df4ee, 0x8d7ee6fd, 0xf1e53dc7, 0x7dbf8ff3, 0x8c44e5f9,
+       0x2c781417, 0x46afff84, 0x167aff3f, 0x2d380389, 0xa1285854, 0x25bdfa0f,
+       0xefc5bef6, 0xdfe3cd6d, 0xfbba5377, 0xdefd5f39, 0x3abfcae4, 0xd8e40e7d,
+       0x5df300fb, 0xe1a30e98, 0xfd5db315, 0xaf0e669d, 0x1e1621e0, 0xe42ae3c2,
+       0xe139d33c, 0x9ffe821d, 0x99b3d3fb, 0xea4ed768, 0xe5c09518, 0x17b230eb,
+       0x385ec282, 0x3e09bccb, 0xa1d7ca17, 0x79fe7409, 0x8ac77650, 0xec2adc2b,
+       0x7c625fed, 0x751da409, 0xfb4646ac, 0x1f92758d, 0x60e75437, 0xb7c4639b,
+       0x9f86abe4, 0xfe0de04a, 0x8f3c6ce4, 0x842fe3e1, 0xbc6609a6, 0xa938cdb5,
+       0x0789e98c, 0x74df7bfc, 0xe14df51e, 0xc23df68b, 0x35b3ab77, 0xfc862f37,
+       0x6fc05db8, 0xc82ffee6, 0xf36979ff, 0xefd21b06, 0xcb3675a5, 0x2aa96af9,
+       0x6cb1b1ec, 0xe66bce2c, 0x0b3ba77e, 0xf65072f1, 0xb0673c61, 0x88168cf9,
+       0x0d182e71, 0xfd1fec4f, 0x9d555be9, 0xdab76bf8, 0xbae11f30, 0x430723fb,
+       0x56977a3b, 0x9e6b1a53, 0x9e7cec03, 0xedc3590b, 0xfdffd263, 0xc3a93be0,
+       0xf68c9915, 0x7e131d67, 0x63fa688f, 0xb767c744, 0xafee30b0, 0x5ca2af68,
+       0x68cf5b38, 0xdc90077f, 0xf037768f, 0x7eccf7fb, 0xb69b8b9c, 0x82f512ff,
+       0xc749668a, 0xa50a8623, 0x6d3f4355, 0xc65129b0, 0x6bc3387d, 0xa3eabbc4,
+       0xc5f137af, 0xf8215556, 0xfbb0981e, 0xe3f71c66, 0x9ea18d36, 0xd3b17fe2,
+       0xc7f8fb83, 0x07c499cd, 0x57ebadbd, 0xa9aaec55, 0x972a3748, 0x30f4d187,
+       0x92ce3eaa, 0xf40e4cbf, 0x699afe47, 0x8be25d6f, 0x6befbf81, 0xbc173892,
+       0xfe16f940, 0xbdbe4cff, 0x80b7c869, 0xa3e2679c, 0xf90f5abe, 0xbe4b1a96,
+       0xa9bc962d, 0x7bc5f708, 0x5e22a686, 0x26aabf17, 0xdb6f92c7, 0xe739f8aa,
+       0xb94e2233, 0xdbe411a3, 0xadf24db7, 0x8c5be411, 0x5fbf9078, 0xff0b7ca8,
+       0x36dff0d7, 0xd6316f94, 0xf9566bab, 0x08f9a636, 0x8d31b7c9, 0xaf3c4b36,
+       0x7c9f3b5d, 0x47af9293, 0xeaa0f8fd, 0x3f418f8b, 0xfe3e84db, 0xc44b888c,
+       0xe5ce5071, 0x7f8d3a6a, 0xe2ee72a1, 0xff73950b, 0xe4367045, 0x8c1de2dc,
+       0xd27b9ce2, 0x8b739721, 0x939c8177, 0x9cb91e90, 0x7187bc5b, 0x7c945cbf,
+       0xbe43d91b, 0x115faa31, 0x4d83ede1, 0x02df0fe9, 0xabf58dfd, 0x1fd4073e,
+       0xc6ef2ddb, 0xae5de599, 0x7adc10a6, 0x1783bbc8, 0x0876ef26, 0x6c720779,
+       0x68d7ca08, 0x5b35f0fa, 0x8f77c1e3, 0x2bff5e3f, 0xcadf97e4, 0x86f8de74,
+       0xbd0f9f8d, 0x1678fe36, 0x6263d7d2, 0xdc848b3e, 0x510aaf6b, 0xe45e53ff,
+       0xf1772beb, 0x468af138, 0xd4561fae, 0xfc2f614b, 0x17c27733, 0x78bfce1a,
+       0x2152c48f, 0xebcecb3f, 0xf38d27b3, 0xc3233632, 0x720b0f44, 0xbfcfc94a,
+       0xf40e6140, 0x72ba97e3, 0x5bfea24f, 0xfefdc39a, 0xf17be2a5, 0xd0abadab,
+       0x88fc5dff, 0x46a5e744, 0xe711ab7c, 0xa26e23db, 0x77f91979, 0x6627e3a3,
+       0x99a9b88a, 0x1bc294bf, 0x947fc462, 0x7fe6b16e, 0x966ff822, 0x62f04adc,
+       0xe331cbaf, 0x5d7a8c38, 0xe0283a70, 0x7ed32754, 0x802705da, 0x27bd379b,
+       0x33d3009c, 0xe1ba5232, 0x585bfc52, 0xebef566f, 0xbd16e035, 0x5d7fc36e,
+       0x0de9fa2a, 0x7b9c060e, 0x1dc05fac, 0x939202ec, 0xa758f0d1, 0x33b5f975,
+       0xe8094e31, 0xe84ce486, 0x181700d7, 0x70d26f2f, 0x47977dcb, 0xd664fd05,
+       0xe1829a4c, 0xae30b30c, 0x6a0bca1c, 0x0fdcbd17, 0x1dee31e0, 0x4edc58ef,
+       0x0f609b2f, 0x56ec39e0, 0x41c92767, 0x35db0e83, 0x141c07ae, 0xbfddddf0,
+       0xf9d93272, 0x7a8e924d, 0x24e23048, 0xae0106b8, 0xa828ff78, 0x8106fc70,
+       0x0eff911e, 0x8719f23c, 0x8bc91ee3, 0x635c9dfe, 0x40bc42bf, 0x8e66ccfd,
+       0x22586097, 0x4eb164bc, 0xa8a97f3a, 0x84117c95, 0x8206d35f, 0xe19f219f,
+       0x93c665cf, 0x58957e89, 0x4c954bf4, 0xa8a965fb, 0xf35ed337, 0x99e7a407,
+       0x036caa4f, 0xfbfe1b81, 0x4f3e7a2a, 0x9e34501c, 0xb6bc04da, 0x085d3c21,
+       0x77ae4eb7, 0xfba0be45, 0x50794650, 0x39e05909, 0x5f73d1e5, 0x0671af09,
+       0x518e90bc, 0xcbe735be, 0x92682f98, 0x9ef4df58, 0x50f3c5eb, 0xef17bf33,
+       0x7ffbc239, 0x18b1f24c, 0xba60beeb, 0x8b9e85ee, 0xbcf16e80, 0x8eba37a4,
+       0xd23b5386, 0xe9bab7f3, 0xe76735f9, 0xe7a44ca1, 0x43f7123d, 0xce5a2734,
+       0x1e763d35, 0x09d5b5f7, 0xeeeb0f74, 0x6df5557c, 0xcb90c6f4, 0x7ed1ee82,
+       0xbb37df30, 0xf1821704, 0x141c5ba2, 0x18f347ef, 0xb353f5c2, 0x64e6de7c,
+       0xf567d7c9, 0x2edbbfde, 0x37278cc5, 0x3f2323f4, 0xf8c3c71a, 0x6f1826f9,
+       0xd178f764, 0x2fe183fb, 0xfabadf38, 0xbad9bfdb, 0x6ebe718c, 0xb590543c,
+       0xb88d5e10, 0xe05223a8, 0x73ea2a47, 0xfc4b25d3, 0xc85ccc15, 0x7fdc6fad,
+       0x7bdc96aa, 0xa74d2cff, 0xebb774fb, 0xe89d77c6, 0xe2674f33, 0xdbe26f7c,
+       0xec7fefb8, 0x5998e7e7, 0x44d6f636, 0xab263fdc, 0xe3eae90c, 0xa1f92a43,
+       0xe3ca9e3f, 0xedf9af6e, 0x3e5d0501, 0x3898f0d7, 0x8938cd76, 0xb037acec,
+       0x87a8f1eb, 0x047f983b, 0xef132fc1, 0xd5d465ed, 0x5f02f14c, 0xae12dd8f,
+       0xa537d4c6, 0xc435e933, 0x219924db, 0x7dfc5ade, 0x7f20b8a7, 0x032c87fb,
+       0x1fa0a05d, 0x07b1fb50, 0x9bd63259, 0x33264fe0, 0x27e37c66, 0xf3075e6f,
+       0xf6487f18, 0xacdea179, 0x03172e03, 0x7ae47a7d, 0xe0980b1b, 0xab858135,
+       0xfe34dfd1, 0x9c3affa8, 0x3be81177, 0xa8a44f78, 0x07b54379, 0x6a25ebf3,
+       0x72050c1f, 0x6d9eb03d, 0xbf7267b5, 0xea017285, 0xf5c13761, 0x4eb05ebc,
+       0x728861f2, 0x8a5af341, 0x93a82a2f, 0xb6e142e8, 0xbc1cc4b0, 0xfa03b0df,
+       0xda1eb6dd, 0x05fee167, 0xbadfb1ed, 0x875e6f33, 0x49e60772, 0xb9f9ebed,
+       0xf3b4017c, 0x2dd4bf22, 0xd78afea2, 0xb3ef0c4b, 0x7df3d514, 0xea90e8a9,
+       0x7dc6f2c3, 0x3b7ed08f, 0x97ebc603, 0x6450fb8e, 0xca0bdd2a, 0x2fba7494,
+       0xf84c1a19, 0x7f1c60eb, 0xf220fa6c, 0xabbc520b, 0x98a0c097, 0x64fe63e3,
+       0xb3f2421f, 0xeb4cb7c0, 0x96bcfd0b, 0x236e9c93, 0xe7433aba, 0xde0147ed,
+       0x1bf78001, 0x40e55e22, 0xab5a07ce, 0xc2fc5f69, 0x9b9f943e, 0x38a24d34,
+       0x8f2c858e, 0x8e6638e2, 0xebe6fae7, 0xe8c33b97, 0xed5d7be7, 0x0fdf881c,
+       0xefa76e5c, 0x1cb8dbed, 0x4ad41f6e, 0xebe3f6fe, 0x58f78655, 0x24cbd7aa,
+       0xabd78e2f, 0x7e563f74, 0x1431c78c, 0xc7fae36e, 0xdfbcf581, 0xe1b7a8e3,
+       0x439607b9, 0x11ab70be, 0xb4e5c0e7, 0xe8167f61, 0x90c2fe3c, 0xdd62e5bb,
+       0x75a1f63d, 0xd92434cb, 0x2e5b7968, 0x8b0971e4, 0x2d1cbd90, 0x1cf1cb77,
+       0x197c83dd, 0xeae6271d, 0x0e9063b6, 0x5d105f22, 0x19521c57, 0x07d231da,
+       0x9714b96d, 0x73a247b6, 0x92cdf18b, 0x8a1ae31f, 0x4987b1de, 0xcfe70eff,
+       0x2fee11fb, 0x8619daef, 0x3c431f2c, 0xb1ca9c80, 0xa7e9fe77, 0x1be4fdf0,
+       0x02088c0e, 0xb827c9ba, 0x59be711b, 0x4f3c799b, 0x52eb1bd6, 0x9b2f3ef0,
+       0x40e497da, 0x02ccad61, 0x52713926, 0x13775ff2, 0xd4741fdf, 0x667c0c77,
+       0xb8053569, 0xc1cb7ebf, 0x66ef55f7, 0xd8646315, 0x043d84ef, 0xf51f81f6,
+       0x6b5de29b, 0x1d133453, 0x9b59ef14, 0x55f7c322, 0x1aa61e22, 0x576857f7,
+       0x8a71f1ac, 0x06fa4af7, 0x3f4638d3, 0x2edabf46, 0x1ee86ede, 0x7fd6f69e,
+       0xd68fce31, 0xf286a9f9, 0x1e9fba22, 0x4fd2f7e3, 0xadcfefce, 0x395e6093,
+       0xac14cbaf, 0x8cc1f39e, 0x1d73e6a1, 0xcafc3523, 0x98da6fd9, 0x9cbf04df,
+       0xbf31c53f, 0xe38ddf09, 0x7f01ef80, 0x61493757, 0x23f984a7, 0xe516795a,
+       0x0af3e475, 0x98ae7fe1, 0x1aebcfca, 0x8158de33, 0x4b233f7c, 0xa1607a22,
+       0x8937d680, 0xfa2f35f4, 0x78b30bfd, 0x8f6842fb, 0x08f8d8fc, 0x13904fe7,
+       0x1523945e, 0x52e6d7eb, 0x8bc93afd, 0xc86e37fd, 0x28a47d27, 0x5e546647,
+       0xa3f48477, 0x4923a6a2, 0xb7c0c7c8, 0xa81f50eb, 0x51d76898, 0x68fc1b8e,
+       0xe2ebf7f0, 0xe8732b3e, 0xc67ef1a3, 0x8be646ff, 0x21f2d7c1, 0xf583d72e,
+       0x39831f9c, 0xdf5f5f9c, 0x2f0ae2a6, 0x9f89bf84, 0xfce16f8f, 0x43763f2a,
+       0x2f87de2e, 0xc3efccdc, 0x453f581f, 0x78fa7d43, 0xa6fda258, 0xbd737f27,
+       0xabbf9a35, 0x7defbe25, 0xe0d2fd5d, 0xe18f836f, 0xaf1c6aef, 0xef14f80c,
+       0xf5f3464f, 0x0fe1b54c, 0xaf7cc3b7, 0x03d61a79, 0xddf29df3, 0x26ad3d3b,
+       0x14f90939, 0x3c2817cc, 0x2b90cb9e, 0xfb8f0ae5, 0x8bf3dafb, 0xb76c3f1a,
+       0x677e47fa, 0xebf1e44f, 0xfdd12a75, 0x07b3f8f9, 0x7f205d9f, 0x9d5f285e,
+       0xf18d3f8f, 0x7ed63de5, 0x2de8277e, 0x8076bfba, 0xfae0046b, 0x8a26fd4a,
+       0xa9e8fdf3, 0x3f113323, 0xce81bba5, 0xddeabe91, 0x4e72822c, 0x557ed309,
+       0x3dd328d2, 0xb244a601, 0xf99b73af, 0x956dc798, 0x7a26e33e, 0x1ed6792a,
+       0x4bed019e, 0x86307e76, 0x779668e2, 0xe85a5c52, 0x872fa129, 0x1f20c75a,
+       0x7e3c2894, 0x042e5a2c, 0xd70fdc1c, 0x367e2bb6, 0xc2da4fae, 0x69288fdf,
+       0x9bb551b8, 0x746e25ce, 0x3a3d46a8, 0x1d010dd7, 0x9c5dfde3, 0x02ddf99f,
+       0x6dac6e23, 0x2513972b, 0x81d92a4d, 0xb7b65b25, 0xc970fc63, 0x77f2763b,
+       0xa19cb705, 0x9e5310fb, 0x94fe46d9, 0x396c9360, 0xb711eb7f, 0xd88e45b9,
+       0xb1b0ee31, 0x211dce9c, 0x0df2847f, 0xcf97e3b1, 0xfa585f17, 0x219d9ecc,
+       0xafe96100, 0x7ca0f49e, 0xd9b2d539, 0x7e877083, 0xba6e32bf, 0xc3669c47,
+       0xa7195f3d, 0x01ff0a79, 0x438f738c, 0x9c4635d8, 0xa4be96eb, 0xb2fcc247,
+       0x739c62f3, 0xdbe5e974, 0xef1c7d3e, 0x7b3db411, 0x6f9c71fa, 0x7e3e3fd9,
+       0xd8c1e31c, 0x77ed275e, 0xa2dea7c1, 0xdda36c38, 0xb5dfb126, 0xe2927d6f,
+       0xb5dfdbd7, 0xf6b7b0fb, 0x6307c73d, 0xf6fb603c, 0x6fd0522f, 0x34cf64b9,
+       0xd92eebf2, 0xc5952531, 0x148c2fd8, 0x017c36e9, 0xf8d1f3f1, 0x8078d03a,
+       0x023ed6e2, 0xebfca37c, 0x286dbb8a, 0x5ecc71e7, 0x1f5b6f11, 0x8f429efb,
+       0xebc6daf8, 0xe51cb9ae, 0x1fd7237e, 0xfb671bcf, 0xdbf1e026, 0x7abf8017,
+       0x1b102fc3, 0x3fe11f7f, 0xa2fb4f00, 0xe369f7f0, 0x8a3c5fc2, 0x7b7d8d65,
+       0x5c8db38d, 0x7b8cdc00, 0xfc380f10, 0x88c91c87, 0x5c525fe7, 0x866de233,
+       0x4f9ff717, 0x91fde307, 0x5ce76a13, 0xc7b85fba, 0x68bc63ae, 0x89b79ec9,
+       0xbc77da7f, 0x26687e41, 0xb3b423ee, 0x3f1e3fae, 0xd675892e, 0xae7c79b9,
+       0xefc63f80, 0x5df43d7a, 0x3a72e9c4, 0x7b77e236, 0x9d95db8b, 0xee36cf5c,
+       0xfdd79467, 0x76c3c451, 0x41ca4be3, 0xcaf91d3c, 0x0e036878, 0xddc390ba,
+       0xe3b1e871, 0x2beebba3, 0xfe217c08, 0x8aea1f70, 0xc0fc8733, 0x7a37e4b1,
+       0x0790c59b, 0xfc781bed, 0xfb1abb7a, 0x9711b05e, 0x3e688ffe, 0x3c585f0d,
+       0xffe6f9fa, 0x81d3e175, 0x4f724fca, 0x2dfdb538, 0x774f1cb6, 0x9eecdf4a,
+       0x7d149961, 0x1cebca6f, 0x473b7187, 0xbb83b434, 0xdeb16cec, 0x6f57e136,
+       0x78a64a7b, 0x070d55e5, 0xcb478e48, 0x2f7c0a8b, 0x337cc625, 0x9a2b7cc5,
+       0xf6d13ef8, 0x82ec3bac, 0xeff6da7e, 0xa8ae7a22, 0xd2f1423f, 0x95f96f2f,
+       0x8b8a6ad6, 0x6c227dc0, 0xd3db7f9a, 0xdc90c6fb, 0x44b2ef16, 0x8c49338f,
+       0x3d8e6c13, 0x8cfeb04e, 0x50d29c65, 0xcebba683, 0xc529de3f, 0x77f6237f,
+       0x83eb85aa, 0xe9e41aa7, 0x0fe318e1, 0x77d6aa73, 0xa4bf60a1, 0xfcdc67f7,
+       0x13d919bd, 0x12e5fa47, 0x093bce77, 0x146a9849, 0x4cbd55af, 0x87fd77c4,
+       0x5df10d2f, 0xe18abeed, 0x7c22577c, 0x551e7e4d, 0x4bd4300f, 0x2cbcb4d5,
+       0xcb442bf4, 0xc6c92d1b, 0x2ffc26c2, 0xf54f4f71, 0x644779d2, 0x70f3e220,
+       0xfb1571c6, 0x9f944bfd, 0x5b0a2fea, 0xfbf30a95, 0x2df2484b, 0xdfd97e83,
+       0xe794183e, 0x977fd9ee, 0xd963f11e, 0xb0aa57e2, 0xbb461e77, 0xa4e0bd84,
+       0xaf7906f8, 0x08f9de93, 0xf5a4ee3e, 0xf9f1d81e, 0xff5fa413, 0xb9f8cec2,
+       0x202f580f, 0xde750aaf, 0x9f1df1c7, 0xd457fe3f, 0x8c31b19f, 0xd438f85f,
+       0x3ea1bb47, 0x8e9cec9e, 0xa0c61367, 0x85f0a45f, 0x3ca266bb, 0xf4e78c2b,
+       0x6a4cf858, 0x3bfa1ab8, 0xc7f3cc96, 0x77a20db6, 0x759f4a25, 0x81e8dc53,
+       0xe055cf1d, 0x4cfed4be, 0xa97dc33c, 0xe7a105fd, 0x53bc52ff, 0xcd7aab55,
+       0x4cc5e3f1, 0xf3ef9af1, 0x12de6294, 0x2fc8c4af, 0xfe847c41, 0xba04a6aa,
+       0xaffa0407, 0xd48f9fa5, 0x447c3bce, 0xfcfea1c7, 0x3fa453fe, 0x7ae883ca,
+       0xcebdf946, 0x395ee221, 0xd77573b4, 0x059d6a0f, 0x9fd35f3c, 0xaa1693cb,
+       0xf853b0ff, 0xcf79458f, 0x87fd797e, 0xeeeefc84, 0x10afb787, 0xd344d0ef,
+       0x6fd146ef, 0x5fbf96e9, 0x959deb1c, 0xefa7f318, 0xc858943f, 0x76ca7a86,
+       0x857fbd27, 0x7de028ef, 0x3f1a9d85, 0x44f32ad7, 0xdd9b9de8, 0xc5971e42,
+       0x9ddde845, 0x581e62fe, 0xd1ccf31f, 0x9fbd34fa, 0x61939cf6, 0x0bf9595c,
+       0xbbe23f6e, 0xc7e7e77c, 0x71859e7e, 0x1714f189, 0xffc2fe5f, 0xb7283a22,
+       0x3f22e647, 0xb3b76e74, 0xdbe7c88d, 0xfc8c1d5f, 0x0646a6da, 0xf38af9f7,
+       0xbb06f2ba, 0x58bffef5, 0xdaaaa9c7, 0xbbbef0cb, 0xa4b6af71, 0x57f33917,
+       0x5fa3d727, 0x725ffa71, 0xdf5bbf12, 0x35553a73, 0x59df133b, 0x3897ea30,
+       0x77c5cb62, 0x137c5e51, 0x71eaee39, 0x9c5df53f, 0x25ac47cf, 0x153efd05,
+       0x3ca377a0, 0x3e92d92f, 0xfb04fd10, 0x043bc69d, 0x8fdc04de, 0xb25eabf6,
+       0xef3531a7, 0x7caa2733, 0xf430ca99, 0x54cc8cdf, 0x1b1d1d60, 0x67f414ce,
+       0x9cea4718, 0x9dee4b1d, 0x3ad3c676, 0x98f61c4a, 0x09cf9df7, 0x8d0f7aba,
+       0x1e3e64fe, 0xee3187f2, 0x724c357e, 0x2f388ef8, 0xbb012bd5, 0x6e97bf08,
+       0x79699399, 0xa1a9457f, 0x04a7c07a, 0x4eb662cf, 0x6fc932cb, 0xa5e2bc63,
+       0x264a9959, 0x4ffe577e, 0xddcabd17, 0x24a16678, 0x01150bd2, 0x9faeb663,
+       0xa2887ee5, 0x7e1039e6, 0x15d3cb1a, 0x86a54919, 0x358e3df8, 0x7502ea50,
+       0x5653bf8b, 0x9e4e50c9, 0xe8f6e710, 0x1bb4c2ef, 0xdc92775e, 0x6c620d0f,
+       0x07be3a78, 0x4dd04de1, 0x10f153f0, 0x5763e61e, 0x1797192a, 0x93b47433,
+       0x7d8050a5, 0x5d54f409, 0xe9133d35, 0x18fcfe11, 0x07a64907, 0xbfa3cfcc,
+       0x41ea05fc, 0x3dfca740, 0x70b2efbf, 0xc3188035, 0x3aafc981, 0xe877f199,
+       0xccc3bf56, 0x71a5c6f6, 0x68e77892, 0x1731c91f, 0x84ebfeeb, 0x94558a3c,
+       0xff09d5b7, 0x4473c1c8, 0xa822ce97, 0x58bbc617, 0xd7521e24, 0x9994e528,
+       0x90593dff, 0x3ea9d137, 0xcd1e5ad1, 0xa2d72017, 0xf8206dc6, 0x449fbf41,
+       0x5449fbf5, 0x557c9fbf, 0x829c06bf, 0x7c3e8d8e, 0x556562a7, 0x1f1b809e,
+       0x06e021cf, 0xef8919f0, 0x9c5b31e8, 0x13879c4f, 0x6cc4e35c, 0xf01f58ec,
+       0x4e971e5a, 0x612fb978, 0x41c6276f, 0x865aa4b3, 0x890aef76, 0x97f0d3ef,
+       0x63b532e7, 0xf0f883ba, 0xb94e311e, 0xc30af380, 0xbea3d53f, 0x1eaff493,
+       0xd5bd9df5, 0xdf5d8b8f, 0xe27cdbdd, 0xb127cf63, 0xe26bfe97, 0x75fff663,
+       0x0bc552e5, 0xe786bf6f, 0x49f25db6, 0xf55bd007, 0xd438f2cc, 0xfd8f1333,
+       0x70be95a3, 0xd031d33d, 0xa438ef8a, 0xb8b7a06f, 0xd1efd661, 0x7d1bd274,
+       0x40758be5, 0xe00fd5de, 0x7f189370, 0xf73f1d6a, 0xf70965be, 0xe87981d3,
+       0x8b37fac7, 0x0a3937fa, 0xc470dfc9, 0xbabfdfc6, 0x91eb96a5, 0xa658fcb7,
+       0xef1ee9f3, 0x803fe151, 0x2a5d6edf, 0xb1e92385, 0x7562d7de, 0x9e6e3f78,
+       0xbdfa3f18, 0xe6f300aa, 0xbd6396ae, 0xd2e9c557, 0xfd1757b8, 0x9602c54e,
+       0xb321de27, 0xd4eb3f7e, 0xcd67e4bb, 0x2c7deea8, 0x1ee816b4, 0x7ba04ff5,
+       0xebc7973c, 0xe2171462, 0x485c78d1, 0x4f3a20cb, 0xd9dfe433, 0xdc04de91,
+       0x307f99af, 0xeff3aeff, 0xa6f4af8b, 0x2a1def9a, 0xef2ce2e7, 0xbeab54f5,
+       0xea6f9434, 0xc15fd039, 0x0dced654, 0x39535e61, 0xfcc4ade8, 0x7249be18,
+       0xa3094d2a, 0x3cf4545c, 0xaf7a8856, 0xa8c3ef78, 0xd55d25af, 0x0ebe67a5,
+       0x4b8e6fff, 0xbc5cbe26, 0xb6f74bd6, 0xdbcf8b3f, 0x7b24f489, 0x57017c72,
+       0xed087a4f, 0xc6aeebe0, 0x5cf7a775, 0xf3e6b54f, 0x157dbe91, 0x6ffc8080,
+       0x4fce073e, 0xf6df7bb6, 0xa37efce2, 0xf4bbf432, 0x44ef8f84, 0x86cfca18,
+       0x887c5007, 0x0463309c, 0xbc46bf8e, 0x6ababa6f, 0xaa2ba524, 0xbc794898,
+       0xaf2a8adc, 0xea447348, 0xaa74e917, 0x1a556f77, 0xf95557e5, 0xebe03528,
+       0xfbd0d5f0, 0x7c618e93, 0xf02e877c, 0xf0136497, 0xe5fe900b, 0x73a4ab48,
+       0x195ea745, 0xd8df77c1, 0x7077d840, 0xc10d7a59, 0xf919d357, 0xe53ea135,
+       0x548798ed, 0xf8419dad, 0x564af452, 0xc56fe508, 0x5c228e07, 0x2d4bde9d,
+       0xd3da5aef, 0x7fbd46c6, 0x836f051a, 0xb871b6de, 0x7a712fdf, 0xfdfb868b,
+       0xe3178b6a, 0xb2bfee22, 0x82295deb, 0x1c43983b, 0xe7e6bfee, 0xdee13db4,
+       0x09be7b32, 0xe9eceeee, 0x04fbf704, 0x7016ef9c, 0xa87816ad, 0x46acf016,
+       0xa47e53b8, 0x3a44fbc8, 0xc47bd29d, 0x112bb7fb, 0x08ca901f, 0x7d878077,
+       0x30c98854, 0xf179ba1e, 0x7412eecf, 0x1fc8dbab, 0xfcf2bb2a, 0x127b7708,
+       0x05c3bb87, 0x06ba2078, 0x3cb17bb8, 0x5d54f044, 0x9f50ce1c, 0x15e441e3,
+       0x7e267b84, 0xb800f8e7, 0x871f8df7, 0x058270f2, 0xe4d25ace, 0x23fb830b,
+       0x124b7f7c, 0xbf0d1e7c, 0xafbf8d24, 0x6f77f06b, 0x88b571fa, 0xef16aeb7,
+       0x511c2227, 0xe00879af, 0x4f0e34c3, 0xc8a47dfe, 0x164d28fb, 0xe0357ff6,
+       0x161fcb01, 0x19c210fa, 0x73c51fd3, 0x56c93cfb, 0x38454fb9, 0xf2efe1f5,
+       0x1b10a4b0, 0x6878cd98, 0x85a5fe2f, 0xc6f31798, 0x4ad7aff9, 0x44aeb23f,
+       0x7de903bd, 0xdd6de918, 0xcf0daaab, 0x57a5e43f, 0xcb67ee59, 0x5e89fdb3,
+       0x42407f82, 0xc13ee6bd, 0x5e916b87, 0x1edc7e68, 0xe0e8295e, 0xeefef16e,
+       0xee7e823d, 0xa0fcfc17, 0x7e3e3741, 0x74cd643f, 0x9498c71e, 0x20ef1361,
+       0x4e399846, 0xc0d7d130, 0xd9179834, 0xe94a5e36, 0x8ef64b9d, 0x7e36f89d,
+       0x7d23f314, 0x6773be25, 0x9b43bf98, 0xa1f50fd7, 0xd9dde344, 0x39c4de89,
+       0xa23d3174, 0x6520f788, 0xc4b64f6e, 0xdab5df7c, 0x7e81dfb7, 0x13e6de99,
+       0xafa7f3ef, 0x6be2f184, 0xf54764dd, 0x59cde40d, 0x2d577908, 0xcb0c55d8,
+       0xc1707cb9, 0xf44d0bbc, 0x5f8bdf11, 0x595d7547, 0xf64af480, 0xa93fa438,
+       0xf844ea1d, 0xe8bdac02, 0xcd487abf, 0xc1fb87eb, 0xfdb18943, 0xb9e2b370,
+       0x7593c4bf, 0xb09fc5a9, 0x3b53f54e, 0xde55a27d, 0x43fb13ac, 0xfe56a99f,
+       0xcb83f630, 0xc59f7f44, 0x0f147e07, 0x6e729674, 0xa4cfc92a, 0x0fef636b,
+       0xc216aad5, 0x47aa39f7, 0xe50ebe73, 0xee6f5c6b, 0x9d187721, 0x8c0d9c83,
+       0x2ffe88d8, 0x3396be83, 0x8c42e72e, 0xbac693eb, 0x3ef4867e, 0x9d01f702,
+       0x01f71ee8, 0x34c3cbcc, 0x5b949ba2, 0x587fe46c, 0x5eecf825, 0x046b5fc1,
+       0x7c803d5f, 0x81df0235, 0x13fa51f6, 0x90eb4fc1, 0x12dd20ff, 0x78f5ce9f,
+       0x6197bef1, 0x8c772cc7, 0xab1cf7a5, 0x0fda365d, 0x61ed7794, 0xfb05da17,
+       0xf7e8ebc6, 0x7a59dd91, 0x59e58dc0, 0x43c03f0e, 0x91d2cc4a, 0x2f733e5e,
+       0xe2abe8b8, 0xf4fd015b, 0x72a2b0ae, 0x949ea47f, 0x451fdec7, 0x9ef453a7,
+       0xcb5faa80, 0x70fd3fd0, 0xe113a552, 0x8f3c70fc, 0xcfcdaad3, 0x3e03b826,
+       0xe29bc5b6, 0x5f6752a5, 0x1f1ef5d5, 0x2f70ff76, 0x12ec12ef, 0x0c0d82f2,
+       0xf92661b1, 0x7bde2b50, 0x1b10de64, 0xcb139269, 0xf432e787, 0x0f94f5eb,
+       0xcdcbc8bd, 0x90ae5e5c, 0x434bcb62, 0x65e4377f, 0xd2315cb4, 0xb74d1795,
+       0x5d54a7dc, 0x66f2463e, 0xc1ff6c64, 0xfcede3ef, 0xf3e66a1d, 0x2cf7a7e5,
+       0xdefd7807, 0x83d42f0c, 0xf7c57f0c, 0x5a27ac62, 0xcab89e3e, 0xf40357d8,
+       0xcd02d03e, 0xaff8f0fb, 0xfbad57dc, 0xd5b9e141, 0x9c140fa4, 0xa8b4a1cb,
+       0x11f13a76, 0x9318d3c3, 0xfd7c7c9d, 0xdf883d0f, 0x7ce2b5e3, 0xc61abd7c,
+       0x1b7da4b8, 0x0e607aef, 0xe3c175c0, 0xe38f9d32, 0x14d90d3d, 0xbcb2c2df,
+       0xef1ba7a4, 0xdf0f1e23, 0x31c731ee, 0xe9d4fc14, 0x37bffd47, 0x1f582c7a,
+       0x8d537fdb, 0x83bb44ff, 0x5da246f9, 0x675dfa01, 0x9fbff504, 0x18dde938,
+       0x18da1f23, 0x8fc733ef, 0xf15be918, 0xdc21ced3, 0x33f78adf, 0xab9dd217,
+       0xf4d79d0f, 0xdc7c17ce, 0xc733e863, 0x4547d273, 0x7dc0359c, 0xca7fc596,
+       0x098f49cf, 0xf473187f, 0xca271e52, 0x7b94bdbd, 0xd3133c78, 0xd3ff9763,
+       0x3d51a47e, 0xb821b4ec, 0xd3daf2fe, 0x2fa5deab, 0x6280f3d6, 0x60bdc711,
+       0x79787c63, 0x2059be0c, 0x102f07ee, 0x7d065de7, 0xd0df7f15, 0x465d39b3,
+       0xd4f4add3, 0x1fa74425, 0x5fc9541f, 0x87f4015b, 0xd4f4987a, 0x698f7a78,
+       0x3d9713d9, 0xf9c00b78, 0x95324393, 0x10739d97, 0x87ffb65d, 0x3bfce28f,
+       0xefd2ab7f, 0x70727c26, 0xb7ebc51a, 0xbb9ef78b, 0xedc5cef8, 0x5c5c1bda,
+       0xbb9c14ae, 0x8bbbe897, 0x35f3c2ae, 0x7382dbe4, 0x565e900f, 0x4ebdef80,
+       0x788f75c0, 0xe8229279, 0x1fb60277, 0xea1cbb92, 0x3e72b615, 0x15431361,
+       0x10de8fe4, 0x0637bbef, 0xf2e0df3f, 0x0b45e25a, 0xff50d75b, 0x24c3f40c,
+       0x02c85c53, 0x8507fbf1, 0xe584b878, 0x21a5887a, 0xd6f908df, 0x77d6ff4d,
+       0xd69ddbb0, 0xc2e91a75, 0xb04e75ae, 0xebdd61d8, 0x73e72efc, 0xb6146fa1,
+       0x7579f0e6, 0xe3e7e7ad, 0x7ba7ad63, 0x7da9131d, 0xf1ec627b, 0x1fe317ef,
+       0x9bc22aab, 0xbc44ac5b, 0xbe105bb7, 0xd5f7c35d, 0xf627d60a, 0x2aeb4c91,
+       0xc4b52dac, 0xe6d4152b, 0x857afbd3, 0xdbb5f3eb, 0x1753fb4c, 0x97fe425e,
+       0xc6eb0d27, 0x2e6bfdcb, 0xaea8bc23, 0x7e913bbc, 0x7c553d8f, 0xec5e7bc7,
+       0x84e9e397, 0x49531a16, 0x4f76eaf2, 0xf74dfbac, 0x56a9e347, 0x80ec09e0,
+       0x0c9e132c, 0x3fb744fc, 0x8efcb9b6, 0xe21cf0f7, 0x509afe11, 0x0a2bf2ef,
+       0xe1b1e97f, 0xd7a0a4f7, 0x040fa063, 0xdf7e082e, 0xf5cbc4b2, 0x6f813f0a,
+       0x77c63e03, 0x08c2e7d0, 0x379127b7, 0x4e3fb193, 0x5b83e70f, 0x1e82f8f7,
+       0xcf5ec526, 0x59eb5d6b, 0xc7a042ca, 0x3eb8d49c, 0xee7afbd1, 0x05c72162,
+       0x4f8ba7ac, 0xfa7c2df3, 0x385b9ada, 0x9ffc0a9f, 0xd10f7fdc, 0xbc70b1f5,
+       0x7a54e30f, 0x486bcf5b, 0xd062e307, 0x1b10b0c1, 0x8f7ffd95, 0xfe684e0e,
+       0x3ee08f11, 0xee15fb02, 0xde4fc5d3, 0xbf3cc63f, 0xfd27e2b7, 0x9aa5f69e,
+       0x0ea73b0b, 0xf41df64d, 0xfb277ed2, 0x434961aa, 0x633f815d, 0xa3cf12fb,
+       0x6e9fa19f, 0xc6cfe245, 0x578bd2c4, 0xc72e0556, 0xaaea8bf3, 0x8fd1cba2,
+       0x973d0aaa, 0xce9b9ea1, 0xd623177f, 0xcdcc7d7b, 0xaab2bbf1, 0x983fce92,
+       0x94f4c423, 0xd80077ee, 0x47f24c89, 0x7eab2e2b, 0x1d01a9a6, 0x789adffd,
+       0x025540a7, 0xd0b3d3ab, 0x1194945f, 0x1fefc132, 0xb2ee7e2e, 0x8ebf6d26,
+       0xe8761ae7, 0x8e60fd1f, 0x8b59ca81, 0x6545ecff, 0x93c05f41, 0x1c731cf1,
+       0x124bf06b, 0x46cf13f9, 0x5acf13f9, 0xf30491e6, 0x5b3b0afe, 0x1ce87871,
+       0x8fc26152, 0x5f01e02c, 0x5bbb1f68, 0x1e5cebe7, 0x607d21ef, 0xb23645d5,
+       0xff09d6eb, 0x2fd0cff4, 0xe851704d, 0xe0c301bc, 0xc096beb0, 0x73c4e1d7,
+       0xaded190c, 0xf8dde508, 0x4f4c9762, 0x4f984a1f, 0xf3095e64, 0x1564597d,
+       0x931d0fda, 0x3f20ef5a, 0xe69033a0, 0xd67ebc06, 0x84b0e5af, 0x817912e7,
+       0xb5ce118b, 0x0bc32872, 0x77217ff5, 0xc1bd6066, 0x1f4ef450, 0xf7845e9e,
+       0xf3a60212, 0x8eb421ce, 0x33dcbcee, 0x2552d17f, 0x6feffcea, 0x5fcb9b17,
+       0xc62ffa71, 0xf93b5479, 0x1f4960fb, 0x57be7448, 0x94ee75dd, 0x64f2fb47,
+       0xd123c737, 0x41d5d205, 0x559d37ae, 0xc87d09bc, 0xf3323d9f, 0x7c3ccb45,
+       0xec22bc96, 0x53a03ad1, 0xe832a73c, 0xb7e29863, 0xaf0d1d21, 0x3c66ef81,
+       0xfb77d0c6, 0xf079e8b8, 0x31b9fa98, 0xe897183f, 0xcb973e55, 0x7a28e3f7,
+       0xf9f12dd8, 0xdced8a87, 0x1921646e, 0x20c73af1, 0xcf05653c, 0x8fe33227,
+       0x8d77b5ec, 0x82b62773, 0x0b9e75e7, 0xb9cfc6de, 0xa733e7a3, 0x3c16eef9,
+       0xdcd399ef, 0x7b9e3e6f, 0xf8ba29ce, 0xab774c43, 0x51e3fb9d, 0x2250fc5e,
+       0xb7a6f67d, 0x21e3545e, 0x46e6f1dd, 0xae609f7a, 0x73bfef9b, 0xf88aa759,
+       0xe35d300f, 0x5a6156e7, 0x27cc6ddf, 0xfa2a0df2, 0x84896e1d, 0x721ab86f,
+       0xbe18beb7, 0xb9bdd51a, 0x425f3b07, 0xf41a05b4, 0x321b3a5c, 0x5ef935da,
+       0xaede79e6, 0xf14e0e0b, 0x838a47fb, 0x6ebdd5d6, 0x58c1c107, 0x7c24d427,
+       0xbc49c174, 0xa5c066cf, 0x37f1dd6b, 0xf8fe855f, 0x1cdce4de, 0x790fe8c7,
+       0x579f3c9c, 0xc13e9c34, 0x0b939022, 0xb91ffedd, 0xb77afca1, 0xcb4c2eff,
+       0x95839d1c, 0x5537c421, 0x0390af98, 0x1c00a517, 0xb8141a3e, 0xd1e11938,
+       0xf482f7d2, 0x2e4ec3fe, 0x1ba70e0f, 0x1bab6d7a, 0xc8bd9be9, 0xf7e35af5,
+       0x38ed5632, 0x008dff7e, 0xe55e8f9f, 0xcb95cdef, 0x22ee6bde, 0x62ccb2ff,
+       0x7a4621d9, 0x1e0df858, 0x7bc4db76, 0xf39d7cd1, 0x79ef0e14, 0xcf74f18d,
+       0xd952de6e, 0xbcfdbef2, 0x957e3ca5, 0xae632d29, 0x2b09d8b7, 0xecf75d04,
+       0xd11afd07, 0x3a5fccfd, 0xd92dde99, 0xc893e9a9, 0xa738f1cf, 0xfd53f9b3,
+       0x4ffdc632, 0x1f912d58, 0x6f51fc69, 0xe7e42b53, 0xc87d1387, 0x5ceff3ae,
+       0x97ef899c, 0x3f70b454, 0x28bcaa67, 0x7d203fe3, 0xefdf3f68, 0xe108bf31,
+       0x5d7bf2e4, 0x369af3a6, 0x474332b5, 0xe5d5be7a, 0x7f907947, 0xc45dffbd,
+       0x30e7e1a7, 0x40e7ddf6, 0xce38c00f, 0x39bc5bfc, 0x0df91f48, 0x0ea53f4e,
+       0x5c81c4a6, 0x039857cb, 0x298d54d3, 0x98e34c4e, 0xe5ecd303, 0x9daa7f42,
+       0x2783fa45, 0xf7c34f27, 0x9f9bf3c4, 0x17db14fc, 0x927d912a, 0x9bf29e89,
+       0xee82fd5f, 0x28f3f9c3, 0x5b5bf74e, 0x39dd8b34, 0xff9ac1ba, 0x9f359376,
+       0x33e6b111, 0x03f35a0f, 0x7d266d70, 0x1e1eff73, 0x9a7a529f, 0x1e7defdf,
+       0x3c22a060, 0x3e49d9b6, 0xce6d294e, 0xd38778c6, 0x586dbb4f, 0xdceffbbe,
+       0xeadceeee, 0xf72577a4, 0xe2c717bd, 0x6a1df092, 0x3f2c46e7, 0x8d90d71d,
+       0x4fa845fe, 0xbbb04b71, 0x71bb408e, 0xbd06a5e7, 0x69be2986, 0xfdf83fe7,
+       0xf6adce94, 0x9c51c630, 0xd3e4f5de, 0xb7a79f48, 0xec7d200e, 0xc3642979,
+       0x70f7437e, 0xf3884ffc, 0xe954e458, 0x7e3dab16, 0x1d01e842, 0xe879b527,
+       0xd6b8ba17, 0xc24beeba, 0xa8a77cd6, 0x7d331b7f, 0x10f8c74f, 0xdc34aaef,
+       0x7ec53767, 0xc173fdbf, 0xa53d4f17, 0x8b2b7419, 0x37991ef7, 0xe2befba5,
+       0xdb73eeee, 0x8e800325, 0x4316114a, 0x4697bfba, 0x0f85db8d, 0x38927fd1,
+       0xadfceb2f, 0x5539f04c, 0xef896455, 0xaafbd2e8, 0x4d53697c, 0xed4151fb,
+       0xd27c94be, 0xdca5f757, 0xca67da66, 0xb9481eb6, 0xdb6bfa19, 0xebefd0a2,
+       0xe279cd95, 0xf8490981, 0xf9c06e5d, 0xe7fa3962, 0xf25e1ada, 0x8bd03d60,
+       0xbde39ac7, 0xa5c76b0a, 0xe9f1354d, 0x834ba5d7, 0x0e74ca9f, 0x5a72e79f,
+       0x461ef172, 0x1dff2d69, 0x1b86d2be, 0xe11abbae, 0x4fdf9ebe, 0x9e5856cf,
+       0xb653fc0c, 0x8fef86fd, 0xc7c1ef86, 0x3e70f9c6, 0x2d24f8d9, 0x3fadbbde,
+       0xee76f743, 0x44ff71b5, 0x7b465c34, 0xfdef7e38, 0xe508ab81, 0xa2f7f412,
+       0x3fb52c6d, 0xe47d0368, 0x6bd0e4c4, 0xd3954337, 0x570fe1ac, 0x95965c53,
+       0x253e809e, 0x373ab7d4, 0xf48dbe4b, 0xb5f67975, 0x97fb5aa8, 0x943a3c51,
+       0x8a37b4c7, 0xa27ed6c3, 0x47a57cf1, 0x68f77e32, 0xa25e99a4, 0x119df5eb,
+       0x2ab7dfa2, 0xcd720a5b, 0x1d97efa4, 0xd878a1ad, 0x19c871e8, 0xc13b8a68,
+       0x7c4bd1fd, 0x027a14ec, 0x22d91c93, 0xcf287c5e, 0x48a7bbd3, 0xa5104097,
+       0x5ea9b297, 0x6cb5eb84, 0x4bcfa63a, 0x99640791, 0x33f203cb, 0x79278b6d,
+       0x3eb7a6d0, 0xa3a473f1, 0x1e74d1fa, 0xefdc5fd6, 0xe846f36e, 0x77e358bd,
+       0x9e74da71, 0x5276692f, 0x8fe9d53c, 0xcb979234, 0xeb138e30, 0xd9b4ed3f,
+       0xbd3b5f40, 0x8c64efbd, 0xe06b6e0b, 0x6a9f8aef, 0xfb593be8, 0x9a37fd8a,
+       0xf17d8def, 0xdf13fe08, 0x8bf8f54f, 0xacdfb83d, 0xa9d371e0, 0x2a332b7d,
+       0x68c9e063, 0x6655a497, 0x79d2bda0, 0x91b7cbab, 0x0ae953eb, 0xc8d3ddf9,
+       0xfc2f92af, 0x79e9f749, 0xbea07877, 0xe1faea1b, 0xe5073eff, 0xfc77e88d,
+       0xa1ddf640, 0x1f3eed0f, 0xa015905f, 0x03f4e3fb, 0x7cfe3036, 0xa0144585,
+       0xafb8f9b7, 0xc93ca18c, 0x25ebf9cf, 0xb05c238a, 0x7c1ebac6, 0x1fbcdae7,
+       0x292fe116, 0xb0b8c50e, 0xd68b4a06, 0x718bcb5b, 0xbc50f0ff, 0x94cbc517,
+       0x19cb59d4, 0xad1f908b, 0x7b4bfeac, 0xca7db82c, 0x6bf9f58c, 0xa3b9163c,
+       0x50f9dc92, 0x95f5a3ce, 0xd20037a2, 0x1cfec49b, 0x6d2733bc, 0x4b1da401,
+       0xc82da427, 0x7cee7bc4, 0x8ed3231f, 0x8fbf98f8, 0x45953a57, 0x7177f106,
+       0xa58fee18, 0x346452cd, 0xe42c1de6, 0xe3bfcb19, 0x6eb820fb, 0x63313df3,
+       0xf35eb8dd, 0xc726f677, 0x10cf71ab, 0x2f2e6bd7, 0xab287013, 0x3afc5bb7,
+       0x90a5ea13, 0x7f78dbfb, 0x55da95a9, 0xb7697e34, 0x5ff62bf4, 0x1399b7d8,
+       0x68a135f0, 0x798b8c83, 0x878e4ba8, 0x0f75892f, 0xdf80b0e5, 0xf4143743,
+       0x107d7e43, 0x02fecff5, 0x9f2439c0, 0x45809f84, 0x5c5e301c, 0xca9e5766,
+       0xfcf397b3, 0x8ae04f3e, 0xaf6081da, 0x873a01a9, 0xbde72f9a, 0x471bf78c,
+       0x425e0626, 0xf9b7ccbc, 0xb7c42b07, 0x17e411fe, 0xf0e1ca5d, 0x4bcad8f0,
+       0xc5d9632a, 0x933fbf02, 0x3e5ce81a, 0xa3ef8bb4, 0xd54eacee, 0x8bfef7ec,
+       0xfb094790, 0x4f5ee95b, 0xee890ee7, 0x1d223f13, 0x8fb6fba1, 0x6865e95c,
+       0x9e01a7c7, 0x223eee50, 0x5ef815b1, 0xace3565e, 0x9e212f45, 0x787ce2b3,
+       0x38de5fde, 0xd1772e49, 0x15beb9fa, 0xcf01b95f, 0x8de75283, 0x0e748b1c,
+       0x2d779eeb, 0xe3d0ff7c, 0xb9faf1a5, 0x96d3de38, 0x8f17d287, 0x16f3f1c2,
+       0x387c84bd, 0xa1ee8e3a, 0xdcac02a7, 0x8d5d287d, 0xcb1a547a, 0x60fa87d8,
+       0x58ef0cda, 0xe43fb9f4, 0xdb24e3e1, 0x50b379e4, 0xf3cb1bcf, 0xf92c7e7d,
+       0xae111237, 0xed5271a5, 0x17ce3a6c, 0xe85ea3bf, 0xcb823f40, 0x9529ef84,
+       0xea7e3819, 0x69269e50, 0x3c0f8a11, 0x99bde064, 0xd12de9c7, 0x25e9c919,
+       0x454a4c5f, 0x1b50ee3b, 0xbf20d418, 0xec340d0e, 0xf48b88cc, 0x792361f0,
+       0x2df7617d, 0x5ff7e0c9, 0xfa1b0692, 0xa1d7af0f, 0x513213fa, 0xf5c1beae,
+       0x7e5c4ff1, 0xa65f57f2, 0x4fbf8ec5, 0x0a78e048, 0x61638b9e, 0x3838ff93,
+       0x13d233fb, 0x2c3ce783, 0xf027da6c, 0x1c734dbd, 0x7ed15977, 0x72841dfa,
+       0x01f742d6, 0x71ac1bca, 0xc5c597e7, 0xf3a0d71e, 0x0b1b39e0, 0x1e3225f5,
+       0x21d7f688, 0xc2d573a9, 0x4b17ba24, 0x73c13be7, 0xc6990b1a, 0x63eb9e0f,
+       0x33cd77cd, 0xaee9fa85, 0x9af5acc7, 0x2c7aa73e, 0xe383d5a7, 0xb4adebb4,
+       0x29cf048f, 0x6fd8ced4, 0x90b6c23a, 0xeedcfc0a, 0xe21de5e5, 0x6fa8cf3c,
+       0x5b3ed7f4, 0xf8def713, 0x556de8bb, 0x2e007820, 0x219f368f, 0xf359747f,
+       0x418b823e, 0x89f0dd0f, 0x7c132167, 0x225baa52, 0x69ede036, 0x7bb86e0f,
+       0xc990d814, 0x871f05fb, 0x9feddd36, 0xbbf8e508, 0x8ebe260f, 0x73e2eacf,
+       0xd90f3312, 0x42172e64, 0x9d4f7775, 0xfa8bca68, 0x9b43ed5d, 0x340a98af,
+       0xb78a3595, 0x27c1e6bf, 0x4e4e595e, 0xdf111a8b, 0xcf3839df, 0xa23bca6d,
+       0x8fc82ef2, 0xa8f5e536, 0xf2a8a4f2, 0x40fca8b4, 0x1dcdbf5e, 0x40fb2c19,
+       0xd4f83fde, 0x9efbf815, 0x7322fd6d, 0x358f05f1, 0xf02bb6f2, 0xb3cb7cf7,
+       0x56d3eff8, 0xc93e4b34, 0xba2b3f24, 0xb55bf3ce, 0x0e10a3f9, 0x1ca32f2d,
+       0x74926b28, 0x0d5debd4, 0xc79423db, 0xbb535e76, 0x963f6e06, 0x76a11c35,
+       0xd23ff6bd, 0xef7c7c46, 0xdea9f7c8, 0xd89fcef9, 0x5befeb0c, 0x751e76f5,
+       0x4e2c0a44, 0x7f7eee48, 0xdbfb6dbd, 0x0a2fbfdd, 0xf9fbdbdf, 0x8d1c900f,
+       0xc41e07ba, 0xf9bab8f9, 0xbde380c4, 0x7bd2cf23, 0xdd1c7fb4, 0x03aa16fc,
+       0x2cce4bf1, 0x9fdda053, 0x438f8fcb, 0xb4df0b7d, 0x67e37dc5, 0xdc12f852,
+       0x81651e8f, 0x5bdc704b, 0xc3ef87cb, 0xac384c9f, 0xef863eb6, 0xf0786f95,
+       0x98142be5, 0xeb7761df, 0xb709fc20, 0xf06f094d, 0x7f2b727c, 0x1dff4551,
+       0xa0f0e7e1, 0xc83641d6, 0xa6c0993f, 0xeb787e53, 0x3d7f9863, 0x3faf04e1,
+       0xac9075ba, 0xf27209a3, 0xdf90a98a, 0xf7e6c7ac, 0x37ae04da, 0x369bf31b,
+       0x8453ffdc, 0xfbe32b0b, 0x76335e0d, 0x5b9d3c80, 0x66db6a72, 0x1fdcc780,
+       0xdb9c93c5, 0x55dd76dc, 0x50870479, 0xa611c61e, 0x7ed3780a, 0x215d7248,
+       0xee1fa27d, 0xf1ba7d81, 0xe2dc1ee9, 0xd2e2fda5, 0x37a8edca, 0x451dcea4,
+       0xc7a145fb, 0xddc9e92f, 0x52193869, 0x3ae92fa8, 0x8db2eb97, 0xef5223e2,
+       0xf51e9372, 0x033df8a0, 0x0fa23be0, 0x36cbc097, 0x096d9eb1, 0x80f6bfdc,
+       0xf3f51a67, 0xc47fe49e, 0x42ca6321, 0xc5a7f24e, 0xf372be91, 0x202b9006,
+       0x7989d7d7, 0x097b5baf, 0x466e29f9, 0xfc28f13f, 0x67d7efee, 0xbffeb754,
+       0xaef2032e, 0xdd6ebb6e, 0xf33f7f2c, 0x0dbaf6b9, 0x5b90dcbc, 0x7b79d2eb,
+       0xad4abf63, 0x3ea4e3e6, 0x5c46c978, 0x28c2bc47, 0xece17b7e, 0xd1971b11,
+       0xad2d7ffe, 0xfdfdf99f, 0x5a3f0ed0, 0x7a86c43c, 0xc29f81a9, 0x1257fee1,
+       0x89373d60, 0xf035efdf, 0xb74f8c64, 0x907f51e2, 0x3b407f41, 0xeb403135,
+       0x0c627d07, 0xfae06e0f, 0x3316d204, 0xad2997c1, 0xfffbf0e3, 0xfdb53820,
+       0x4ff4e02b, 0xc947779f, 0x0c379021, 0x7a5f2ffb, 0xedff72dc, 0x23d1013f,
+       0x8000702a, 0x00008000, 0x00088b1f, 0x00000000, 0x7dc5ff00, 0xd554780b,
+       0x733ef0b5, 0x9992bcce, 0x924c2664, 0x84e3c849, 0x71100840, 0xf0444312,
+       0x51888431, 0xd4503b69, 0x20717ad8, 0x9926023c, 0x4b62d5a8, 0x79120cff,
+       0x22341809, 0x0281c150, 0x06f55bc5, 0x701a8c45, 0xaf7a8a44, 0xb7ad8ef6,
+       0xff7f6c57, 0x4a8f8808, 0xd2f5a232, 0x5ad7fd97, 0xce64ef7b, 0xb6b4a924,
+       0xdc3ef9bd, 0xd9cfb3ee, 0xd7b5ed7b, 0xf6b5af6b, 0x4cf5a61e, 0xd8c05c0a,
+       0xce6a2566, 0x7c2c64ae, 0x61edf148, 0x67cf07f0, 0xf7fb193b, 0x95d5a0b4,
+       0xf19fd8c9, 0xe6c60aef, 0x2729bf7e, 0x8ded0658, 0x61cb1823, 0xcfbbf52c,
+       0xd500ded4, 0x7a3f4bb9, 0x3f7c0f7c, 0x8ca97bf7, 0x43ef03e9, 0xf7c18c8f,
+       0x5b6dbcef, 0xd2842ecf, 0x793519d2, 0xf986bca0, 0xef7bc056, 0x27435898,
+       0xbe0ef7f4, 0x5563097a, 0x35e5bbdf, 0xdbb19136, 0x93632a5d, 0xf8ab5b18,
+       0x258a9873, 0xbbe0db0b, 0x644b2cf0, 0x7d63114f, 0x0cd85311, 0x23b875fd,
+       0xb8c1175b, 0xf995d71d, 0x1f5fd0c2, 0xef867e63, 0xf7a54b2d, 0x4c3ddc3a,
+       0x744bf6c3, 0x0ec24017, 0x19faa17e, 0x5a37e3d4, 0x7814bb22, 0x76c2ce5e,
+       0x3e325f6c, 0xf3fa8612, 0x7f7d0e30, 0x0f644a63, 0x8f82cfb6, 0xa371dea0,
+       0xfe861237, 0x47622cec, 0xfa763a78, 0x8c1c3273, 0x05acaae5, 0x8228efe1,
+       0x2b59943a, 0x0701cdd9, 0x713fcfe2, 0x0f007396, 0x6899775f, 0x3d95a93e,
+       0xf437ff4f, 0x7ddbd6c7, 0xe1b0a063, 0xcf6f58ab, 0x3b997826, 0x66f88558,
+       0xb803fc1a, 0x89c81fea, 0xcce7c3ac, 0xb1eb8557, 0x479fe9da, 0x5520fff0,
+       0xb61ff847, 0x0ab635b3, 0x66d61528, 0x0bfc00cb, 0x43fb5878, 0x37630c00,
+       0x978000e3, 0xd670d7ff, 0x2bf3c3a9, 0x07ad0a5d, 0x556df9fc, 0xbc67cd8c,
+       0xd4f2fe7d, 0x58899577, 0x1a6b51aa, 0xa5735b3c, 0xef46c7bf, 0xe28f3fb1,
+       0x0bfa0da5, 0x25b7f132, 0x09ba44ee, 0xd86977e2, 0xba9defff, 0xfdf0eb03,
+       0xf8765c44, 0xfbe074be, 0xf9a3173a, 0xfc3955cf, 0x475535ac, 0xc8fc4afc,
+       0xd7c24eb2, 0x713f90fe, 0x724e393c, 0xfcbaf7bf, 0x00be2237, 0x0f74d1ef,
+       0x75a545e2, 0x63d7864d, 0x43b06f89, 0xd556dcfb, 0x33e0377d, 0xf349ccb8,
+       0x9cdef095, 0x158cbf1d, 0x74ffee0f, 0x8695736a, 0xe9c65ff3, 0x02b72d9d,
+       0x62f112e2, 0x5d03a819, 0x63f1642c, 0xe7886526, 0x8445f45a, 0xc247517f,
+       0x2fdff4f7, 0x49ef89ac, 0x92ba617e, 0x2ba0bf04, 0xdd70d15d, 0x375f0a82,
+       0x373e258b, 0x6e183650, 0x82d5cf89, 0x245d24ee, 0xe2357be3, 0x7c60d27b,
+       0xf93d2c7b, 0x99706fd8, 0xdc94f095, 0xfa11633f, 0xf03b21ee, 0x16ddd00f,
+       0xdd7a2145, 0x646a5772, 0x3da7f225, 0x19f117be, 0xad157c3a, 0x1492ef77,
+       0xdb2bc19d, 0x9441302c, 0x9c9d8733, 0x4a7a4b8f, 0x617a9f90, 0x9f587ece,
+       0x9dd5d7de, 0xc1024561, 0xeaebf358, 0xdeffa42e, 0xfde6af67, 0x19d548ac,
+       0x618843d4, 0xfe143718, 0xbc032b43, 0x2cc5349e, 0xe0175e34, 0xff09c257,
+       0x435fe17a, 0xe8bc80c5, 0xbf1c06c3, 0x9807cb8b, 0xe71a12e1, 0x1d6c29db,
+       0x526cdb8c, 0x6f6826fc, 0xb23e3a5e, 0x4361c392, 0x20146a3e, 0x9b589b35,
+       0xf7c03152, 0x2513a6cd, 0x36f195b7, 0x85bbde0d, 0xf78175f1, 0x5f002a8e,
+       0x4c7d6da3, 0xfa45ba45, 0xd8a5f687, 0xff80345e, 0xf9bff5e6, 0x7cdfc213,
+       0x8d1748c0, 0xb1e7198f, 0x8a9e9134, 0xb524e806, 0xd589e392, 0x8018c8b0,
+       0xa9ea29d7, 0x8a88b1b5, 0xcd565a78, 0x66e9024e, 0x8199e91e, 0xecace3f4,
+       0x0ca1f364, 0x11fcc07d, 0xf74a7b80, 0xc24697ce, 0x58daeefb, 0xb4374e3e,
+       0x4e8bb6ec, 0xbeb0345d, 0xba4bce12, 0x41cca937, 0x0077d1e3, 0x83bf7f8a,
+       0xfb371bde, 0x6ef2c482, 0xa4d32efa, 0xe0f6bd12, 0xcd1be423, 0x38c0a39f,
+       0x328c979b, 0x82a67ae1, 0xbcb9437c, 0xaeec7db0, 0x7f678415, 0x07b7ca09,
+       0x09ce80d3, 0x942abe9f, 0xeaeea52f, 0xbfa0bb5f, 0xffd5dca7, 0x138e258d,
+       0x47f4e270, 0xa648be90, 0x23bd64e7, 0x6e2ecbdf, 0x0c716f29, 0x17f01eff,
+       0x35be2de1, 0x4d0fcb9d, 0xffa2faa1, 0x475cef30, 0x374469f0, 0x222f6db7,
+       0xdac0dc79, 0x591ade89, 0xbbf482c4, 0x69c2c6c8, 0xe08b1740, 0x172874b5,
+       0x3d32b16f, 0x4496fd61, 0x2146f58c, 0x31616e0f, 0x7d96fefa, 0x2c35ed49,
+       0x26f684ea, 0x62a68b1b, 0x6f6c69d9, 0xef417166, 0x3e26b67f, 0xbe7c1d67,
+       0x77758b37, 0x20d444d7, 0x1dab7bcc, 0xbe065774, 0x33eb4ed0, 0x5a4ef965,
+       0x7f0af4cf, 0x4fa83dd1, 0x76fb355e, 0x27bedd01, 0xe7e24bd6, 0xbbf5575e,
+       0xd514f788, 0xdf8ff344, 0x9cfc2563, 0xeb8dbd02, 0xdd9b9f7f, 0xdeca1b3c,
+       0x7a3bdd56, 0x55c9a234, 0x1839db30, 0xb39eebcf, 0xb8dd2037, 0xb7c226dd,
+       0x65cc7e7c, 0xddd57aa6, 0x522bff02, 0x088abb23, 0x9e9113dd, 0x7d4946aa,
+       0x82ce26ca, 0x5666bbfa, 0xe6f509d7, 0xec411deb, 0x07ed07af, 0xb9b817a8,
+       0x5b7028de, 0x2eb27e68, 0x06e92be7, 0x52fea1c6, 0x84a5e22e, 0xc85b8c63,
+       0x7f89b641, 0xe6eff427, 0x493b2925, 0xafd3f6ff, 0x96fd1189, 0xd7882c05,
+       0x795c84e7, 0x3695ca4e, 0x9a2b972b, 0xa832ee6b, 0x9941f73f, 0x95e01d6f,
+       0x83de8295, 0x4a3f1bef, 0x5e9e91d1, 0xef5fe8f9, 0x9fb419fd, 0x5ba2c0fd,
+       0xd2017da1, 0x73dbac18, 0x6047970a, 0x8fd4307f, 0x38f6c08d, 0xb1c1e36e,
+       0xb41c7f64, 0xc846fb08, 0xe0b4c6cf, 0x4fd085d6, 0x3e9993e3, 0xbcf664a0,
+       0x5ee8f239, 0xf7643f6c, 0x1b7e81ed, 0x1b5e3853, 0xdf491b9f, 0x4e0f613f,
+       0x733cc377, 0x3c9f91ad, 0x05e37281, 0x677bd92b, 0xc2117459, 0xaed3b67f,
+       0x70277be0, 0x4250e95e, 0xeaf3829b, 0x043d9276, 0x10b39a7c, 0x36b93bbe,
+       0xe04bcf9b, 0x0986e4e9, 0xcd9b17c4, 0xb3f0bc7c, 0xc27fbd0a, 0x0391981c,
+       0x974f13f5, 0x534056fb, 0xb512c05f, 0xee873d00, 0xbd5e76e3, 0x7881df49,
+       0x09538762, 0xa11eb95e, 0x62678b8d, 0xf2e9687b, 0x1c7ca3af, 0xde51cf8e,
+       0xd9b904b3, 0xc805e2cb, 0x461adb4f, 0x9f514675, 0x91f38f74, 0x585e655a,
+       0x171ba07c, 0x9994f77f, 0xc87e35e3, 0xbe7cf44c, 0xb57ce3fd, 0x707fae2a,
+       0x65c8109c, 0xe48ff926, 0x1d5d4272, 0xfec8ceaa, 0x2d973d0c, 0xfb633aec,
+       0x1de0ceeb, 0xe6bfa06e, 0x9de7fffb, 0x38df8465, 0x9ed645c9, 0xca797c49,
+       0x748b9fec, 0x5a89aeeb, 0xf3e827e6, 0xeaaf820d, 0x63fec2ad, 0x1f224b51,
+       0x6aaaf6ca, 0x72cbdd23, 0x677fa0bd, 0xc1f7cb8c, 0x1fc126ed, 0x1ea2b4df,
+       0x6641c29b, 0x1c47a885, 0xfd4ebfd8, 0x6a20f94f, 0xe17a87a9, 0x9165a8f2,
+       0x004f9128, 0xcc1b51df, 0x2756d4fb, 0x03406fe7, 0x3268b3f6, 0x48b97d23,
+       0x02b5fb05, 0x3d5deb9f, 0x9fa72eb0, 0xfafa7376, 0xf0056023, 0xf7898f3d,
+       0x82ef60ac, 0x4da67b1c, 0x607ee289, 0x2eeb16de, 0xb5f2117b, 0x7ae2755f,
+       0x8e48576e, 0x569b6bcd, 0x4bea15b2, 0xeb405c0f, 0xd399369f, 0x9b88d2e5,
+       0x2114e2f4, 0x11adeb1f, 0x3fdfd90b, 0x01f21851, 0x74764ff4, 0x53947c23,
+       0x280f1831, 0x10f40dd7, 0x5d83a849, 0xcb93a534, 0x9cf20655, 0x524bd825,
+       0x671ca3de, 0x919ff649, 0x1f52c23e, 0xf4c7b971, 0x527b946c, 0x0aebdf2e,
+       0xae49b974, 0xf5c6ce8d, 0x72e4f585, 0x7842bf73, 0xa42d626d, 0xe81ea44f,
+       0x91e8571f, 0xeb986ad3, 0x2a26eb2b, 0xd117775f, 0x27594b78, 0x57a913e9,
+       0xd783a386, 0x7e0e84bf, 0xed007486, 0xe8b01f8d, 0xe35e3065, 0x9a6d1672,
+       0x44e74bc8, 0x4f5c8fd2, 0xc49eb8da, 0xf43ce532, 0x4c7eb265, 0x7ac987d6,
+       0xf5c2db30, 0x69675c9d, 0xe74f64cf, 0xe594c076, 0xfcc19511, 0x3ff9a636,
+       0x60349cce, 0xb2de84d7, 0xb10bf4d9, 0xe0a3601e, 0xd369c5bd, 0xf686ca6e,
+       0xc8fcc690, 0x9780a957, 0xbb7cf09d, 0xb36b7bb0, 0x2d7bdd39, 0x5acd7e9c,
+       0x703b9580, 0xcfb4625d, 0x1732678d, 0xe7c4a3d2, 0x577c2776, 0xfd71df81,
+       0x8dbdffd4, 0x7c24a5b5, 0x9d9cfd5f, 0xcfe7eae4, 0xb256233a, 0x6e858247,
+       0x57eb2fe8, 0x7b53b256, 0x3e92739f, 0xd0fa15ed, 0xd128f683, 0x5fae2acb,
+       0x21275d71, 0x648f5535, 0x35cafb48, 0x4a045123, 0xcdc9acfb, 0xf6c1aced,
+       0x8a2f6890, 0xcae9cf5d, 0xcfccfb4a, 0x62773ddd, 0x6861e01d, 0x588fff9f,
+       0xe981d0e7, 0xe787dfe5, 0xc7c380a1, 0x472c1fb1, 0xdfaab57a, 0xf406deb9,
+       0x1e5d4335, 0xd1e60bbf, 0xa170ef94, 0xfc29ab9e, 0x846f2ff5, 0xcc0787fa,
+       0xbceb8acc, 0x1b1d7a67, 0x5dfcbc35, 0xe89f3112, 0x5b97e049, 0x4deb19f6,
+       0xa87ac69d, 0xc82f58cb, 0x4f4e7a70, 0xfbe1d920, 0xd5b5d033, 0x4ec1f2da,
+       0xbcfad780, 0xa7d1f495, 0x067160ee, 0xfc535bca, 0x5ad9e218, 0xf444f1f8,
+       0x3fba846f, 0x02b4b051, 0x38cac4ed, 0x3faf91fe, 0x742bcfb7, 0x01b7810d,
+       0x899b31fc, 0x3ad60cf0, 0x85ce492f, 0x2c789f04, 0x845f0ffe, 0x9d9a2ff9,
+       0x9e9bbae2, 0xaa4e67f8, 0x60927b42, 0x572da164, 0x2dfb887f, 0xae096f78,
+       0xf059e9ff, 0xb0d5c01e, 0x46c3eb85, 0xbe434b16, 0xd3bb066d, 0x477c4b06,
+       0x5b875f06, 0x5155e2da, 0x8c8edff8, 0xa70871da, 0x802d27f6, 0xfb1ab1f4,
+       0xaf93b04d, 0xe07ae0cd, 0xd7767d96, 0xdd1e0329, 0x2ba87a86, 0x912a75c7,
+       0x61fc84ff, 0xb8968a79, 0x09577a1f, 0x6bf88b5e, 0xa658f5b2, 0xfc57f8c1,
+       0xf79233e9, 0xa7cd978b, 0x5d80c47d, 0xb4f9256d, 0x3d20aef8, 0xdf2b697f,
+       0x6ade9e17, 0xa7ef11d7, 0xe3fdf3b7, 0xc4473ce2, 0x857bff06, 0x8bdbdb9b,
+       0x19453be1, 0xbc64c78c, 0x55f0ffbd, 0xf7a3a45e, 0xdc2f1f19, 0xf78fedc9,
+       0x62af805d, 0xf7f60efe, 0xefd8177e, 0xaaf9e20a, 0x2e2e510f, 0xd0faaede,
+       0x9c87604e, 0xbc598fe4, 0x0b71cafd, 0xa7dfd81d, 0x5fa1a623, 0xe895c768,
+       0x02f7c289, 0x89d7ee11, 0xb5cf015d, 0x1d93171d, 0x95bb7477, 0xedb6e9c3,
+       0xf15c79c5, 0x4af89527, 0xda20b133, 0xff161dc7, 0xfd67e438, 0x70333de1,
+       0x959fde5d, 0x1ff7a26b, 0xf10b9857, 0x85965ee1, 0x5a2b17cf, 0x61b7f900,
+       0x899992cb, 0x866a4ef6, 0xad35eb4a, 0x8f567970, 0x7ae9f883, 0xdb4da3d4,
+       0xfc707f81, 0xf2ff6fd9, 0x3f224f46, 0x4cc55edd, 0xc3cbf609, 0xc27a235f,
+       0x6be028bf, 0x57d7c0b1, 0xaa6b2be5, 0x12968be4, 0xef8ba394, 0x0d71296e,
+       0xf3f45761, 0x0f9cc3c5, 0xb850cbef, 0xc32f20ff, 0x6e18cfb0, 0x3528e65f,
+       0xf9b15e91, 0x940f7f98, 0xc62db0d9, 0x0c81f7fd, 0x640fda8d, 0xfb5f7b70,
+       0x5efb6ddd, 0xcd4d7987, 0x80cf6e08, 0x97f3217a, 0x71ebbae3, 0xb1983557,
+       0xbbb26288, 0x6e56c3d8, 0x8edc6ac7, 0xf6c99cde, 0x8fd84bae, 0x997f6277,
+       0x62f61724, 0xffc7bd3f, 0xdaf10c78, 0x44f1f05c, 0xe7420fb4, 0x1fa0b33e,
+       0x90add1cd, 0x02f8773c, 0xd425e90c, 0x282d8b3d, 0x21c3901b, 0xc913d71f,
+       0x0653faf3, 0x3c84efdf, 0xfde7ea71, 0x3b7f9c11, 0xb73e9cdc, 0x3f214b2d,
+       0xc44f36e4, 0xb5ff408e, 0xa5ed2a7c, 0x67efc225, 0x5f94fddb, 0x288efa45,
+       0xd75831ae, 0x35f47f39, 0x30a88dcc, 0x8bbb87ce, 0x77d9dfc9, 0x854f9a60,
+       0x1feec736, 0x788519ad, 0xf0fb32ea, 0x27af877d, 0xe1f7e70d, 0x386993ee,
+       0x2add86bf, 0xf221bbcd, 0xb2c2d649, 0x33f0b901, 0xca3af825, 0x1c52e601,
+       0x0f94be38, 0x34feee1f, 0xfb83816b, 0x567f480b, 0xa7978d0e, 0x8e7ed3dc,
+       0x39715fdf, 0x1e8f975f, 0xee5046b7, 0xfd07647d, 0x3f6f2096, 0x777d7272,
+       0xefee432a, 0xdf500b3a, 0x2a6fd7f4, 0xf89ca135, 0xdfcf8b8e, 0x402ce963,
+       0x628dfc7e, 0x1ae967ec, 0x6c808b13, 0x5006b25f, 0xa3e8f203, 0x40299f47,
+       0x9ee1ff79, 0x27e60a67, 0x9dfc97c0, 0x78e57b2c, 0xfd266fc2, 0x344b1ea8,
+       0xef9bc70f, 0xe57f72b3, 0xf9547e30, 0xfdc2db3e, 0xab3e7da1, 0xbf28748e,
+       0xf1486beb, 0xc7db7da3, 0xe6ff246c, 0xacbf0b77, 0x83da3fdf, 0x7df918fb,
+       0x1e15ff52, 0x974a4f4e, 0xd483fe42, 0xe3c938b2, 0x7bde59bf, 0xe4133d60,
+       0xbff3ac3d, 0xd9345f21, 0x3246c7e2, 0xe20b0fa2, 0xd0ecd2cd, 0xad653f50,
+       0xbf15f4e4, 0x2afb44c3, 0x81d7ae4b, 0x928aecf2, 0x30133694, 0x6d2527a2,
+       0xf201c622, 0xfde94b73, 0xfba73570, 0x7f231670, 0x516b0e5b, 0xb8bb5e48,
+       0x326f3edf, 0xea83ad73, 0x9edc11ac, 0x16df32f1, 0x5dd698b5, 0xc490ff41,
+       0x480bd487, 0x3f1f283f, 0x3f446c52, 0x7642b74a, 0x9cea6aa7, 0x470efd8b,
+       0xc847134f, 0xa7a73ffd, 0x893ffafe, 0x188f269e, 0x3a829e8e, 0x36d793d1,
+       0x3f093d34, 0xcfbf79f1, 0xbfdc01c2, 0xdd7c0b66, 0xfc4ee427, 0x9bf49b0e,
+       0x99df382b, 0x3699bfa2, 0xfd455447, 0x9c7f33e1, 0x187dffe8, 0x27dc5fec,
+       0x0efda0e5, 0xf395c8e5, 0x16375a74, 0x417f41eb, 0xd236c5ea, 0x629af78f,
+       0x64af6845, 0x8fd96f8f, 0xb73d9174, 0xed2562ac, 0xa8dcf2ff, 0x92b7500f,
+       0x7559741f, 0x0488d4e0, 0xdf10e17b, 0xe5df34cf, 0xbbd3e7a7, 0x1a107db9,
+       0x387b216d, 0x7184a5d4, 0x96039b9d, 0x6b41da08, 0x095fee15, 0x3cebb06f,
+       0xa0afa3ee, 0x740fcfb8, 0x488a171e, 0x8ecf6fff, 0x35bd23ef, 0x91efc838,
+       0xf83a3f1c, 0x1fc7ca85, 0x8efc68c3, 0xeaaf1e72, 0xfee75ab8, 0x1d7eb115,
+       0x6e39fcb3, 0x18d607b4, 0x85c659f9, 0x18809cfa, 0x7afe6f18, 0xae43ad3b,
+       0xd2ccf1ca, 0x0cff5c6d, 0x67e40b96, 0x162c9ace, 0xfa6fc446, 0x05241cf9,
+       0xbb4573d6, 0xcb39378c, 0x79684502, 0xb7e9bbbf, 0xbd00a4af, 0x8e9fa166,
+       0x68c2ca6f, 0x987f93f7, 0xfc7dc9d7, 0xc90009a0, 0x5cffd6c5, 0x42697357,
+       0xf03fbc5d, 0x6b6bdcfd, 0xf6ef48f2, 0xa0d823b7, 0x6fdd658f, 0x351e31d7,
+       0xbd81aed0, 0xf852eb6b, 0xb5c761f7, 0x3c068e57, 0xfffc7228, 0x7f47eb5c,
+       0xc6199da1, 0x4b4f844b, 0xfd0cdfea, 0x7ef9743b, 0x784af6bc, 0x590ac1e1,
+       0x1fad66bf, 0x6ccfbbe0, 0x2a508fec, 0x1c8ac7be, 0x6dacd6ef, 0x0de7d6eb,
+       0x276005d8, 0x39911aec, 0x7eac1f60, 0x85fb667b, 0xebaa5630, 0x5dea0b53,
+       0x1e43e7a9, 0x648fec85, 0xe4203d7e, 0x572cdfc3, 0xf47641f5, 0x57241181,
+       0x4b20667b, 0xe483fec2, 0x80796876, 0xf6073da1, 0xdbc21748, 0xd3e3fc7b,
+       0xef7b422f, 0x1b1fdfec, 0xb77be3a9, 0x37bb45ce, 0xba234e74, 0x2353ed0d,
+       0x4dadd00a, 0x71e80bf0, 0x7a480b8a, 0x7412ea5a, 0x8c330eea, 0x521c7473,
+       0xbe898526, 0x83ae0a5a, 0xf8f7ccb5, 0xe438425f, 0xde7932be, 0xf7c11ebf,
+       0xead2a10f, 0xffd825ad, 0x9da1856e, 0x44f4aeb0, 0x37da02d6, 0x30b59bbd,
+       0x5d25bbe1, 0x973e120f, 0x890f33ec, 0xe08f5fc7, 0x67e6de71, 0xdca3f69f,
+       0x90a228f8, 0x22d0684c, 0xbd40a76b, 0x9684c1a1, 0xcc8cab20, 0x1ce291bb,
+       0x06361675, 0xed0477e6, 0xdf638426, 0x7053c337, 0x814ff0de, 0x8b02db47,
+       0xab6e9f48, 0x4e2839b3, 0x56ff3a54, 0xc52b83c2, 0x5758788f, 0xe3839d5a,
+       0xe19acf34, 0xd808f8a2, 0x7cded871, 0x2fc8b7d7, 0xd75ae124, 0x3b45ae65,
+       0xb9ec0aa7, 0xfcee00a7, 0x7d6a6b8c, 0xd523c7c0, 0x3bb7e5fd, 0xb43e5e30,
+       0x266eff1c, 0x25368ba7, 0x2546fe10, 0xa25941f9, 0x8bb0b35f, 0x8d9f8ddb,
+       0x2be218b0, 0xf6e08d9f, 0xd8e1a5ec, 0xc39f2474, 0xda2a4f5a, 0xffe621d3,
+       0x2ccff704, 0xd0f7d0e0, 0xe479713a, 0x3fc9d569, 0xdcf4f366, 0x5fb6217b,
+       0x85fed1aa, 0xe00f3d69, 0x3d6bbdb8, 0xf04c75be, 0x2aefd601, 0xbd4f7da3,
+       0x3278a827, 0x7d70bcf9, 0xaabd9f7b, 0xd288fd1c, 0xa8fb5aee, 0x5ae6f49d,
+       0x2d7f7ea7, 0x69dfd3ca, 0x16c01f3c, 0x7e874d8f, 0x833efe96, 0x8f6b5dc6,
+       0x0ff5c5ac, 0xbda954ef, 0x607411d8, 0xb9be4bbf, 0x2bd22265, 0x504a4473,
+       0xed3d9a8f, 0xb618e90c, 0xb12fe42b, 0xe30c0279, 0xf3c3d3c4, 0x45f50534,
+       0x1d333d92, 0x5fb455fd, 0xb6bf90f1, 0x18c7f05a, 0x36d382a0, 0x3fb68562,
+       0x6fb0188f, 0x1ce3f95e, 0xbb4a1f0d, 0xfee364c7, 0x14ba9af3, 0x5b2df686,
+       0x42663f15, 0xc627bd7f, 0xea6e0ed0, 0xa69c6854, 0xb82d27d2, 0x93a5b96f,
+       0xec4877f3, 0x057f0033, 0xf18c5768, 0xa07b0aa4, 0x5839fb8d, 0xc448d8ec,
+       0x3d7c63f3, 0x12f78319, 0xad8cabfc, 0xf440f2e0, 0x86711167, 0x0257e126,
+       0x3eed484d, 0xef5bb48f, 0xf3b7fd16, 0x59bb8c52, 0xc455f989, 0xf062b96b,
+       0x2af2cb87, 0x91fa7df1, 0xdfe40cf8, 0xfa17d038, 0xb32ab697, 0xcc29fd6e,
+       0xf1a4eb6f, 0xbcc1343e, 0x056a4e40, 0x0452073e, 0x7d7657bc, 0x86e90332,
+       0xd7e232d5, 0x6a69aee6, 0x6fc78393, 0x4ec85ed0, 0xed89d96d, 0x929737d9,
+       0xc8f8c67e, 0x35fe786c, 0x1cb3e70f, 0x79d7f707, 0x61170eef, 0x48fd33bc,
+       0xe29fd6e0, 0x90a417f8, 0xd61b35bf, 0xe54199c6, 0x796ff41a, 0xa88bf959,
+       0xf533bd7f, 0xc647840a, 0x382e30f5, 0x38e48cab, 0x8a7c33d5, 0x3794177f,
+       0x0e34dc78, 0x116aefec, 0x711e7c5e, 0xd119c40c, 0x62e3876f, 0xdecb0f1c,
+       0x7e46a89c, 0x7be7d07e, 0xacbb4e90, 0xccd7c42e, 0x42df97ae, 0xc6d33b7d,
+       0x9aee293a, 0xd3c4b764, 0x3a4419be, 0x7a733bed, 0xd7083dc7, 0x947d0775,
+       0x8f6492cf, 0xb739715c, 0x93da3fcb, 0xec3f23aa, 0xec1b7212, 0x797f1e47,
+       0x9323ef9c, 0xf6efc8ed, 0x23b72faf, 0x777febfb, 0x17c3923b, 0x28f3c3de,
+       0x890f7ca4, 0xc35f5f7d, 0x5fd434d9, 0xaed23d2b, 0xd8f7ca4d, 0xba3df22d,
+       0xd0f7ce87, 0x0ff8f276, 0xee494186, 0xae222dba, 0x43cef7e5, 0x84bb87ff,
+       0x7b2bc0e4, 0x3748c353, 0x64ed3b67, 0x4b6e6997, 0x7b6ae114, 0x3cc11ada,
+       0xe0453688, 0x578890eb, 0x2c1c4459, 0x834744a3, 0x4025a0e2, 0xa4fc3f72,
+       0xd2abc799, 0x85ee8f22, 0x1ce1e37a, 0xd462cf11, 0x54d9f87f, 0x8a6377c2,
+       0x37fd8e9e, 0x8608fbfe, 0x183eaa71, 0x09f9d70f, 0x87bb707b, 0x7fbc5ae2,
+       0xe75582f6, 0x8968b3f1, 0x33b0f01b, 0x93bfedc2, 0x05a8a6a5, 0x8993bde6,
+       0x32f59f3c, 0xd9e7c5ae, 0x8f2461b7, 0x8231a0cb, 0xdcb5b2fb, 0xe32f545f,
+       0x1fb98755, 0xa5c45eae, 0xf45ece4e, 0xb458a608, 0xb8b52d29, 0xdd7cfb4f,
+       0xdf9ff234, 0x2a2cff79, 0xfd18d7eb, 0x3fd08bfd, 0x3f103c5f, 0xf9f77e96,
+       0xf6e167cc, 0xd0ff80f3, 0xbe8cf604, 0xfd46ab46, 0x775cc459, 0xc3d03ea3,
+       0x43177ab0, 0x1a2506d9, 0x19600af1, 0x7ad6d3de, 0x57bd7052, 0x6f4899b7,
+       0x7e4cdb85, 0xcbd24f7c, 0x67ae1eab, 0xbd70f5df, 0xe08ea803, 0x336cb238,
+       0xe883788b, 0x4533056f, 0xbc2934b1, 0x6ad2ed5c, 0xb2dfd287, 0x8b7336bf,
+       0xcdda1a6d, 0x77f226f9, 0xd7f16e7f, 0xa338bf91, 0xcda9d684, 0x96a6b2d9,
+       0x7d2f13b7, 0xa8078f6e, 0x1b8d32fd, 0x40cf4c96, 0x8782fa79, 0xf19217c7,
+       0x58ddb0b6, 0x2cc38e4f, 0xf5eb1889, 0xa736382c, 0x120dc798, 0xf420bf9f,
+       0x8aebe7c4, 0x167dbe04, 0xfe72bb94, 0xde38f22b, 0x1cbcf94c, 0x875d5f95,
+       0xe30a3074, 0x725845ca, 0x84cc2abf, 0x99751fe0, 0x48fa2147, 0xcdcdb782,
+       0x96bc29e9, 0x5aff21fb, 0xfee193f8, 0xf82593d0, 0xb8c5efd8, 0x42cbbd65,
+       0xf5f3e871, 0x1a64a497, 0xf5fdb7f7, 0x96feffbf, 0xaad7e7ef, 0x45c6bf22,
+       0x8bbe6972, 0xe2a4e5cf, 0xe7c51bdb, 0x701fb00e, 0x0ad56b1e, 0xbfd32394,
+       0x3479a0e9, 0x8239061f, 0x3de5ac71, 0x9bd7a805, 0x304a7bab, 0x5f8c935e,
+       0xf2935684, 0xef9bde0c, 0xda08fd81, 0xf18c6b0d, 0x55f1c1b8, 0x2666617f,
+       0xee4e7bee, 0xd7f5197f, 0x2fe93b7e, 0xad17bff8, 0x16cfffc8, 0x388b5c91,
+       0x2e316383, 0xee894a14, 0xda1171f8, 0x6a8edc31, 0x44eeb6ea, 0x5b7e713b,
+       0xff0f7c42, 0xef18deb3, 0xc8326b63, 0x8c3aceef, 0x4e1e1bcf, 0xfc506efa,
+       0x65d69daf, 0x0e3825b3, 0x10f41df9, 0x599c1de5, 0xbeb86262, 0x116faaf5,
+       0x7633a92a, 0xc67e7da3, 0x466bd7c9, 0x3e3fd4a6, 0xebfabfb2, 0x57d9d683,
+       0x6f5ceb82, 0x7ec4c162, 0x619d709a, 0x3ac51b7d, 0xe2fa799f, 0x8fe75c12,
+       0x825c5ff7, 0xdcd9bceb, 0x29be47ee, 0x41af0775, 0x32ba9cfc, 0xe615f640,
+       0x9d1f20ef, 0x94de3d2f, 0xfd378f44, 0x2eb1e8e3, 0x59321f31, 0xe3f4363f,
+       0x3d1fa8cb, 0xe50f3d16, 0xf59b7cc1, 0xfc49ea2f, 0x679fd21b, 0xe3ff92b3,
+       0xdd3f1ff0, 0xdd18f948, 0xb227d92a, 0xb05ac3bf, 0xc3a3ed18, 0x617d796f,
+       0xd3fef865, 0xb5e5fd85, 0x59fa30b1, 0xda40bee4, 0x78f2c997, 0x03cf98b9,
+       0x8cdffe99, 0x3ce21bf8, 0x20dc7fd2, 0x3e45b1de, 0x6eef76e5, 0xc7fdc7c5,
+       0x6e4fe49d, 0x85cf343e, 0x220fe2fe, 0xfcdc7fdc, 0x8ff93974, 0x8a5e4497,
+       0xeb193e62, 0x1fb85c56, 0xddfbb259, 0x9003cc34, 0xe7d85efb, 0xf9499fde,
+       0xeffdc635, 0x69939107, 0x70003798, 0xa7708fbf, 0xa416e27a, 0xffd866fb,
+       0xb360de61, 0xfd863f16, 0xd9187b36, 0xc65d9505, 0xef8ca0fd, 0x48580b6e,
+       0x56eb6eee, 0xb3af2822, 0x3ca2c12c, 0xcf2c6bd4, 0x80753a75, 0xfe9922cf,
+       0x077e9017, 0x5dfeeae2, 0xa7fe9758, 0x44e9ad9e, 0xe6663dbf, 0xdb3ca177,
+       0x4cf214ea, 0xdbf6f923, 0x7591dd87, 0x6fc37609, 0x584edc23, 0x34c1f322,
+       0xbd60d516, 0x1ff1cd16, 0x7946f5c7, 0xf7924d1f, 0xaf197589, 0x494585bf,
+       0x9eb1352f, 0xc4b0bcfe, 0xf9e392f7, 0xf4370718, 0x75ca5ac3, 0xe4dd93f4,
+       0xab9c51f0, 0x6356cfeb, 0x9bef987b, 0x55961f81, 0x5cafd00c, 0xcdbf4907,
+       0x6a1d1fc2, 0xe90ab138, 0xb8a5d437, 0xe8dd7f70, 0x08dbf4e3, 0x9bcc2ffb,
+       0xd677e64d, 0x1d13cc69, 0xdd7fff8e, 0xff9c77cf, 0x9cac3d7f, 0x5bf8c7fa,
+       0x3f97efdf, 0xfce5ef9c, 0x7fbeffa5, 0xe70add9e, 0x2579a4cb, 0xfd935bef,
+       0x79df72ee, 0x8bf0f2be, 0xf17c7c24, 0x70c7c60f, 0x6b2530f2, 0x7242fde8,
+       0x96afe35c, 0xf8e0ff87, 0x1e8723c6, 0xa881334a, 0xf6145258, 0x6fcebb72,
+       0x50cf1788, 0x371e7e1d, 0x453e7955, 0x9f5ddc72, 0x9ceee221, 0x5a7a5f9f,
+       0x126af5a5, 0x43a6e1f1, 0xdabe1f4e, 0xf14c58e0, 0xe9f8e4d9, 0x067fb652,
+       0x1c72512e, 0xb8f911b5, 0xa9e3cbf8, 0x3d396517, 0x56749f24, 0xc90a7984,
+       0x392f5a79, 0x4c111d3e, 0x32eaef58, 0x410c08d8, 0xcc2d36d7, 0x4f9e1232,
+       0xf4f6e2cb, 0xc89f224b, 0x05e7e16b, 0xfaa673ee, 0x35e31f71, 0x7ca77cf1,
+       0xd67a604f, 0x02ef9424, 0xc0decf9f, 0x4797804c, 0x4f249dcc, 0x1f0e4dc2,
+       0xc7e93fca, 0x10effd91, 0xa5f38b71, 0x19676ff3, 0xfebfbce9, 0x85fbe24f,
+       0xdaffbe92, 0xc016ddb8, 0x181f818d, 0x186befd1, 0x4c1a2a67, 0x33f5c3b7,
+       0xcb2efd1c, 0x459edc0a, 0xa44ff178, 0x94f3e6fc, 0xf195a92f, 0x622fe893,
+       0xfa3aac07, 0xfce26d37, 0x239f5b0b, 0xaabeebf6, 0xcd979459, 0x73c88fcf,
+       0x8fd9c336, 0x9ff9fb1b, 0xf5fd8fdb, 0xc8fd93bf, 0x9c7681dc, 0x7e69a9e7,
+       0xed5ffbca, 0x5f71f804, 0xc875a8f8, 0xdcf22cf3, 0x5df997c5, 0xcdc3f6f6,
+       0xb0ef6ae9, 0xe563ff70, 0x34ff93e7, 0x34fbf9f9, 0xdf0ea3f4, 0x7be4584f,
+       0x9e22fcc6, 0xf82576c6, 0x9e3143b7, 0x8092f7af, 0x447f3e57, 0x6cf4c5e8,
+       0xa75c51ff, 0x6cdb8f8f, 0x9e4c1d2c, 0x9b172e4a, 0x2f8a0e03, 0xbcf27734,
+       0x8ce5e697, 0xfa3377e4, 0xafd0cb4f, 0xbda18b38, 0xf8233537, 0xf57efc33,
+       0x9ab08edb, 0xd9f77e8e, 0xdebbed0c, 0xa9febce3, 0x6c73f83b, 0xa1ef2d0f,
+       0xecc74678, 0xaaef288f, 0xae9fcfea, 0x7824adaa, 0xb1e08fc9, 0x7cadcf1a,
+       0x0fe3c591, 0xbf43fcb2, 0x5f93f13c, 0x9e06e3ff, 0xf8f21d9f, 0x908fe85d,
+       0x3d54f17e, 0xe6a67e46, 0xab68dc03, 0xd87cf952, 0x9e88f3f7, 0x2b4c0f9a,
+       0xeb29ff47, 0x9da397b4, 0x072bf55b, 0xbe3ef7ed, 0x24f2972b, 0x0fc13dea,
+       0x2b3a3e51, 0x5da35723, 0xa0e3085a, 0xfef1fbbd, 0x6e11cbab, 0xa336ff29,
+       0xdfc61cff, 0xc7fa34ec, 0xd9e78d99, 0x4f9bdd2f, 0x4762cbfb, 0x6fec53f0,
+       0x11c39db3, 0xa3ce23de, 0x3279bf08, 0xcfbe4bff, 0x4e344d56, 0x146db7f6,
+       0x6172972f, 0x6d0599b3, 0xe4f203c5, 0xf22e9678, 0x635e444c, 0xa79e2cf7,
+       0x8f0eea22, 0x81f3bf31, 0x238f2bcc, 0xb4b3c73c, 0xe61f96af, 0x402f9418,
+       0x187e62fd, 0x9c5805c5, 0xe7a92dfc, 0xca3d1db8, 0x727a2165, 0x9c51df02,
+       0xed09e806, 0xb1e34bf9, 0x6b9e78e9, 0x52f44774, 0x73e1f3c4, 0x3693c226,
+       0xd38a35eb, 0xbc7c2ba4, 0x6b3df5e2, 0xc61fa2c7, 0xb865e6f5, 0xabbb7aa4,
+       0x353a511a, 0x4d9f9023, 0x52968cfb, 0xbffaaf1c, 0xf29f3ccc, 0x17f92a50,
+       0x291a0a3a, 0x6df7b29f, 0x4e3ce1ab, 0x77661972, 0xa8e4fe53, 0xbc505fae,
+       0x194079c0, 0x72762f32, 0xd6f083b6, 0xa0cd8e1c, 0x3d4b9b1c, 0x43b56724,
+       0xb538a2bf, 0x094356b6, 0x7eccdac4, 0x0b439e13, 0xefe460af, 0x32e1d31c,
+       0x8a157ae1, 0xc3be98fc, 0xa418987f, 0x0f8c8afd, 0x937e7844, 0xee1567b9,
+       0x3d15b4c3, 0x3d718797, 0xcd4db80e, 0xbc5fd865, 0x872dfc99, 0x4fd21952,
+       0xddf15761, 0xb85ea153, 0xb0f145c6, 0x296ee7be, 0xcc2aff24, 0xf310cc73,
+       0xf336ca2c, 0x9aa50ffe, 0x9b699f50, 0xd5470f98, 0x04d559dc, 0x875083f7,
+       0x3c8a467e, 0x453f1955, 0xa9ea143f, 0xd7e0ecf4, 0xffb63f30, 0x14b2d21c,
+       0xe3490e7e, 0xb2e712fe, 0xf3c71fb7, 0xfc2c3b3d, 0xc391e79c, 0xdf936613,
+       0xe0a6ad6f, 0xe6ee7c3a, 0x663794f9, 0x42e70c9b, 0x847ff006, 0x1d4756f2,
+       0x6bd705fa, 0xaff61630, 0x68bd3999, 0xd13b3d6b, 0x2d38b8bf, 0x97ba7948,
+       0x8a5545b5, 0x3d4eb99f, 0xec27ab50, 0x3d70b673, 0xef8fbcd3, 0x35f793cb,
+       0x6e5fa65f, 0x2dda36cb, 0x927ff5fd, 0xfe83f2dd, 0xfdc6fff1, 0xf3ee330a,
+       0xe497ed92, 0x3b20dd7d, 0xe1bfa93c, 0x8f9918ec, 0x0e303d52, 0xd29da7b7,
+       0xf21b0a4e, 0xe21daa75, 0xd8cda17c, 0x5c23e5ff, 0xbf995f34, 0x5f52b593,
+       0xf1fa7981, 0xd7f2301f, 0x70a23cc9, 0x09f7cf35, 0xee746c9b, 0x29dacbd0,
+       0x8b24687f, 0xd3f90a2a, 0x6d7ce87a, 0xc111e636, 0x47b2eb77, 0x99dbbf51,
+       0xf24a8d6f, 0x6e105752, 0x509fe63b, 0xeb646abe, 0x3ae71c22, 0xc7638d07,
+       0x308b93fc, 0x15bfc085, 0x06f4ebe5, 0x05c85f1e, 0x9bf48c7d, 0xa1d39a3b,
+       0xa1e78ebd, 0x99133cc8, 0x50f12217, 0x3b9bf02d, 0xca115176, 0xf04ab5c1,
+       0x99ae7151, 0x4e0dffcb, 0xec195e71, 0x79c0cf6b, 0xfbc63ee4, 0xf898370f,
+       0xaf376479, 0xf9d18c77, 0xf82fa079, 0x728ebb39, 0x2832779e, 0xaf09253f,
+       0xc9e53f32, 0xe411e0b4, 0xcbf3e497, 0xd6124e92, 0x6f47ce8f, 0xfaedc43b,
+       0xcd0b06ea, 0x35c96fa3, 0x5bec97e4, 0xffa86262, 0x9cadbbab, 0xdbc692ee,
+       0x51616756, 0xd88b57ec, 0xf5ca7e51, 0x16bb32ff, 0xfd14b5d6, 0x6b5a47be,
+       0x38053a2f, 0xa01ada3e, 0x74aecfb2, 0xf9d217aa, 0xa928b9d2, 0xf9f2d89e,
+       0xe60e5ab5, 0x140bc4db, 0xb7e79920, 0xea93347e, 0xb077f199, 0xcf16eafe,
+       0xc39034d7, 0x3be2637d, 0xffff7814, 0xdbc47f79, 0x19731691, 0x87a1f77b,
+       0x5f1d8666, 0x91fddf41, 0x9c71e725, 0xc4d3bd41, 0xc8c5567a, 0x5df4245f,
+       0x5e879725, 0x25ec8587, 0x653fc8af, 0x151f2235, 0x5f503b23, 0x714e5399,
+       0x0fd3077b, 0x8f3db0c4, 0x7682cf9f, 0x6395ffa2, 0x26da7fb8, 0x49e582e8,
+       0x184f54bf, 0x22cadbe5, 0x2fdf7d37, 0x23580f8f, 0xc7c63fdc, 0x0be9e37f,
+       0xf325be28, 0xe573196a, 0xf280b9cf, 0xfbf50c6c, 0xa61ce2ec, 0x73c7cae6,
+       0xc2cd2bec, 0x36f515ee, 0x8bc53067, 0x043e44f3, 0x2b8dee7b, 0x7c865bbf,
+       0xf7e0e674, 0xbb5ca347, 0x82fb02ca, 0xeed8e421, 0xfac72e1c, 0x0a358ecc,
+       0x0ce3577c, 0xfac2f08e, 0x773a95bf, 0xa8291e06, 0x82cd311b, 0xf8581747,
+       0x9af11551, 0x3dc4e829, 0xaee7c387, 0x77982809, 0xc7ced2ba, 0x7e6a0ccd,
+       0x9c10f73a, 0x70075ca3, 0xbcb854af, 0xc9d28f86, 0xd3d52a8e, 0xa3611cf1,
+       0x0aaad738, 0xe74971b9, 0xf5ed1526, 0x35beb79f, 0xe006d355, 0x878885fb,
+       0x78c8a2ff, 0xcbdca23e, 0xce5962ed, 0x900bf556, 0xf0ad56fe, 0x12f336bc,
+       0xf8e9ce7c, 0x9565b4ca, 0x557da798, 0xfa254b6a, 0x4f3d0769, 0x0965e787,
+       0xaf7f2b75, 0xc02f16d1, 0xed0be673, 0x8f8849c1, 0x7bbde7cf, 0x3b87ca27,
+       0x0778df73, 0x30de24f3, 0xaf91390b, 0x98eef588, 0x79eb069e, 0xf22dd8ac,
+       0x0f446c3c, 0x3f72c6c7, 0xdb1e7f64, 0xfaf28538, 0xe7e1ce66, 0xb165af49,
+       0x9ef81eb6, 0x3ed0159c, 0xd9117263, 0xde453391, 0x02b78cc5, 0x9817e869,
+       0x435c4371, 0x5d9c3a39, 0xacd79574, 0xc3f024f7, 0x7eb1bad5, 0xfeb1a96d,
+       0xfeb19f35, 0x1a7fc98d, 0xd97f589b, 0xf48d9fee, 0xf3c2bcf4, 0x3097c33e,
+       0x47bdd117, 0x32fda309, 0x715c99e1, 0x27e7970e, 0x77d8abfe, 0x5199333d,
+       0xdb3ed67b, 0x20373c2e, 0x68aad7fd, 0xb665e09f, 0xef7e0cc2, 0xb8bbea03,
+       0x3d1cf222, 0x0761d314, 0x3f71756f, 0x816bbc2e, 0xd3ce0e7e, 0x46aa3f89,
+       0x4e9052da, 0x76261cb2, 0xa552f239, 0x239aec8d, 0xb9e4ee82, 0x058d2aea,
+       0x8602cf30, 0x1be5839c, 0xe88bd766, 0xc87f0ea7, 0x69dbe718, 0x8a5be51a,
+       0x415b1831, 0x5d0487f5, 0xfff2911f, 0x57589a07, 0xef1840e0, 0x1e5cfaec,
+       0x74652e87, 0x656cfe5e, 0xdd25d509, 0xae01fe4b, 0x41a18d1e, 0xe927f445,
+       0x0b4ea7f9, 0xbf7a83d1, 0x34bbf849, 0xea590213, 0xb8807092, 0xc93d42c9,
+       0x7195fec8, 0x6c9b7cba, 0x7ef8fcd7, 0x7e75930e, 0xd44b2bde, 0xaa6a29a1,
+       0xf2fcfd40, 0x3b7f48ef, 0x879c417c, 0xe746cd25, 0xa3e38693, 0x767f825d,
+       0x4b91f125, 0xe8f89abb, 0x3b92cea7, 0x9c6bee08, 0xa5afd42e, 0x0cba9730,
+       0x2a23fd2a, 0x4fce3bf0, 0x474f8a6a, 0xed66f9be, 0x825aa9f1, 0x9bef869c,
+       0xc6a9f7f8, 0x7df0bdef, 0x69f7c246, 0xe0d97df0, 0x6d3b77ef, 0xec44d351,
+       0x21ef4aa7, 0xc9a5187d, 0xade6235e, 0xaeeff166, 0xa3b17911, 0xd47de0d3,
+       0x3cc6a55b, 0x67d93613, 0xa4e4fca3, 0x94ab92bc, 0x57c839e5, 0xba9adb57,
+       0x97bfa07b, 0x655e3ac5, 0x82e67e0a, 0x2dcf2fe7, 0x57fc8a39, 0x98688b6b,
+       0x8b2d77d7, 0xedc5c2ae, 0xc47c169b, 0xe1f24c5d, 0x6693e459, 0x03363835,
+       0xedcc67ea, 0x222d6fa3, 0x9bce79fe, 0x495e1839, 0xa45e1227, 0x493fa417,
+       0xf770c92f, 0x3bd7e7af, 0x3b6f1129, 0x4a5851d8, 0x16b18abb, 0xe7ad779e,
+       0x880bcc0f, 0x65ad8668, 0x2f35da34, 0xdc93092f, 0x00fdcab8, 0x9cbd65e5,
+       0x944ffc1b, 0x7e177567, 0xcbe1a052, 0x716379de, 0xc6f000df, 0x95e137fe,
+       0xbca0e3f6, 0x862d0fe3, 0xf8e1e3bc, 0x421b8e4c, 0xfcc550bb, 0x47949de4,
+       0xf0e39a1c, 0x109179e1, 0x5256c1e6, 0xc2ec8afc, 0x6f6e14e7, 0xb09b1587,
+       0x3f37cee3, 0xaf7b7199, 0x33dedfa9, 0x9477d7e4, 0x6e3bb873, 0x35fde5d5,
+       0xc79c5edc, 0x4b393db8, 0x51742fb4, 0xefc3ccbb, 0x86fdc9d8, 0xd58f4f1d,
+       0x03b05fb1, 0xe9607ec9, 0x322ccec2, 0x7f839bde, 0xde40d64a, 0xb73366f8,
+       0x7c99b75f, 0x62e79455, 0x9ce2f7e1, 0x318cfe91, 0xff64fc7c, 0x628e6e62,
+       0xd7f74f88, 0xc5fe4eff, 0x3f307752, 0x585bfa07, 0x4c502fe6, 0x33f71708,
+       0x1c3e7d02, 0xd6fe9863, 0xfeed1a32, 0x9bcb59ab, 0xcfa262a6, 0xcfa41ce2,
+       0xc59f4009, 0x9d1cfa06, 0x24e5c993, 0xb3e925c2, 0x934b2e9f, 0x1782caf3,
+       0xee1d3f60, 0xa3355fce, 0xf56ddcbd, 0x9e5abcf1, 0x072c9827, 0xa059e012,
+       0xaa3c7871, 0xc24cf04a, 0x39e19371, 0xa4493e1f, 0xf9c66ccf, 0xc97e3861,
+       0x59d858d6, 0x2f2fc031, 0x083583db, 0xacdf3f7f, 0x41a3fbe2, 0xa20eab70,
+       0xe46febaf, 0x2a509471, 0x4f1847d7, 0x67f181c9, 0x5faff189, 0xfaf0e9cb,
+       0xdd10b17f, 0x8451f802, 0x9f68b67f, 0x7944ddd5, 0xcc6bb354, 0x00ed1227,
+       0x13a9b719, 0x94f1cdef, 0xe605919b, 0x4bc634cc, 0xf1e26eea, 0x8b58eb9a,
+       0x7ebde119, 0x3a9fb18e, 0xcc13feb6, 0xc9bbab0b, 0xd3983cf8, 0x8b19671f,
+       0xc2a39671, 0xfc07d08f, 0xd3f4fc82, 0xdf0fc5cc, 0xf63bf40a, 0xe8156587,
+       0x6b32ba77, 0x504deec9, 0xf1b6f1ff, 0xd669ff54, 0x06f3bfb7, 0xa128efb6,
+       0xb9260d7a, 0xf9083ee1, 0xd54df511, 0xc114d78d, 0xa2ed47b8, 0x39f95bdf,
+       0xb04a6f02, 0xe7bc1663, 0xf28a389d, 0xbc846b21, 0xdbc85be9, 0xc9d0bdaf,
+       0xd66f5e53, 0x9358dfc9, 0x79f5efc2, 0x2bbffcad, 0x66b73f30, 0x3c57a894,
+       0x47eb1e3f, 0x1ee84f95, 0x8726de80, 0xce6ff886, 0x09da7ee5, 0x1c744aa5,
+       0x4326a5e0, 0xe7c4dff4, 0xd1e2b335, 0x9a8fe45c, 0x04cfde6a, 0xc5b5b4df,
+       0x2ce99ef8, 0x6d737bd5, 0x250f2869, 0x70e7b59f, 0xa9ed2cfd, 0x67fbe080,
+       0x8db6effc, 0x36037e80, 0x0c5387c5, 0xdf977e4c, 0xe7e0e55f, 0x22fe02cb,
+       0xd3bcfd0d, 0xb37f3cfd, 0x0722b6da, 0x0f5fe7f7, 0x5e712a5a, 0x51f95b2e,
+       0x27d26fb4, 0xf9449b4f, 0x466636be, 0xdf74073d, 0xf1787c41, 0x48690527,
+       0xdd230e6c, 0x259aba4b, 0x48c6bde9, 0xdbafc0d7, 0x5cbf3272, 0xdae81b5e,
+       0xc3d7403e, 0xd700b9d9, 0xa9ae098f, 0x3fd5fd46, 0x265f124e, 0xbc9c3b8f,
+       0x7944bfc0, 0x275f003a, 0x661e5ff1, 0x7f2315c5, 0xecfe4bb6, 0xa62c3842,
+       0x29b39d18, 0xe9e37c54, 0x7630ea60, 0x1f2f8486, 0x8315ae7d, 0x4d3fc2e1,
+       0xcffc7fda, 0x3cf2fb83, 0xf9df0ed1, 0x5c00c659, 0x242bfe30, 0x7871570f,
+       0x5c2d2bb6, 0x5c7b08be, 0xe59be7ee, 0xf38cbb7c, 0xe7e14aad, 0x77e8bdde,
+       0xf97bdf21, 0xcfb87ef8, 0x7ce41d63, 0xcf6f4242, 0x169c05b1, 0xee75db98,
+       0x1b9fa27a, 0xb469f858, 0x8339968f, 0x74f117ff, 0x843e14c4, 0xcc859cfb,
+       0xa057f14f, 0x1272778f, 0x6f090dec, 0x879a9e32, 0xf3c9a791, 0xc0cfc649,
+       0xbec8c5ba, 0xfad8e793, 0xf39e7be7, 0xc7897694, 0x6577f462, 0x8654ff08,
+       0x452147f0, 0xc99e7ea1, 0x2fb87c52, 0xc853ee98, 0x6cc998be, 0xd6679724,
+       0xe19e7d72, 0xd487f6e0, 0xc7f1c3fb, 0x92339715, 0x991b3357, 0xe7c73738,
+       0xd9874c95, 0x2c0ee7ac, 0xadf4da67, 0xd1ef900b, 0xe007d14e, 0x7ee0e99f,
+       0x215cecec, 0x24cf583f, 0xf5fdf3d4, 0x67be7a41, 0xe49fca12, 0x9e66c9fb,
+       0x8cd2fee3, 0x99ca8c73, 0xa12777be, 0xeda8cf9e, 0xcc728499, 0x737bf2e9,
+       0x1fdc0d27, 0xd1c78c98, 0x871926b9, 0x4cfa2f3b, 0x3f191fe6, 0xc706736b,
+       0xcfd238e2, 0x55894671, 0x1e154be1, 0x583fe897, 0x76ec7484, 0xff434d15,
+       0xe81b1cc5, 0xcbba1823, 0x1730bc15, 0x008fede9, 0xf10e6e0f, 0x75e3c055,
+       0x347bc135, 0xe1e12c3e, 0x2b878136, 0xfb3d5e85, 0x89f14ab0, 0x43e97f1a,
+       0xbd084218, 0xe2116662, 0x45e93f57, 0x59d8bf79, 0xf8a2a030, 0xb24e63fe,
+       0x5abf1633, 0xb195f14f, 0x4f4c4c5b, 0x22e393d0, 0x327b8629, 0x30cbec26,
+       0xcce82fd4, 0x617fbc35, 0x7b4328d7, 0xa1bc7479, 0x2a57a2fd, 0xb149f50c,
+       0x2ff78629, 0x50daab7e, 0x1ae7a4bf, 0x3f53fbc3, 0x83a86d98, 0xde70d0c6,
+       0xd8559f7b, 0x65f79836, 0xbe196ff1, 0x19b6cdff, 0xf3bc60af, 0xb2f7d8a4,
+       0x0a563fb0, 0xe9205878, 0x637cdcf6, 0xaa25517f, 0xf3df2154, 0x79eb05bf,
+       0xc034f6be, 0x0bbf625c, 0xc4f68ddb, 0x7ac62de2, 0x55a6f743, 0xe7071b28,
+       0xe354b479, 0x79c93955, 0x79ae351e, 0x50cfa426, 0xe317d82e, 0x62ec1110,
+       0x8e1b33cc, 0xfd6cbfcf, 0x2fe8d84b, 0xfefe7f5b, 0xf5d90b16, 0xaa7d5f8b,
+       0xac8f0a2a, 0xdbfae35e, 0xa7fae375, 0xdfd71a96, 0x7fae33e9, 0xfae364fa,
+       0xf5c6fdbb, 0x5c6b511f, 0x7180ccff, 0x8cebb3fd, 0x34139feb, 0x06c8ffae,
+       0xb7e7fae3, 0x70bbd718, 0x8b3d7199, 0xed0d4bc2, 0xe52febc9, 0xdb9af165,
+       0x7a01ef8c, 0x2074094d, 0xa04168e9, 0xc677f281, 0x30cf7fb4, 0xc03d324e,
+       0xf744d1be, 0x6e3ec1bf, 0xf4fe729b, 0xfc8ad201, 0xf1f4c9bd, 0xeec2b96f,
+       0xfa017414, 0x0ae513a8, 0x614f17d8, 0xd8563759, 0xeda181fb, 0x12bf290b,
+       0xbee279f5, 0x36b93878, 0x7d894f48, 0x0a7ab0f2, 0x81f6c9f7, 0xf470f27d,
+       0x8fb31c7b, 0x4f5a8ec8, 0x5d1ba57e, 0xf14f8e1c, 0xcfe825d1, 0xf2f4827d,
+       0x32700071, 0xe71c7bc0, 0x4f1fe303, 0x8dfe4099, 0xd928b36f, 0x1982ffed,
+       0xcdd83096, 0xe2ada898, 0x953a4f3d, 0x2f6f42f5, 0x858ffe14, 0xb95be0f6,
+       0x9851efdc, 0xc5e6e385, 0x7b14bce8, 0xdd79c46d, 0xe3027123, 0x4f782008,
+       0xca011c61, 0x9ba73b5e, 0xf8ae52d3, 0xc049ee99, 0x4ae9fce7, 0x6ab5d929,
+       0xcd3de50a, 0xfd2141bf, 0x787fff34, 0x2cfa1719, 0x4cb95cb9, 0xd85db3e2,
+       0x482edc03, 0x149ac3c7, 0x07416277, 0xc2e7cde1, 0xb8fe8675, 0xfc47ff1f,
+       0x0ae3cd7c, 0xd06726d3, 0x675a3331, 0x0f3c6f5c, 0x9c38daa5, 0x0d999b8f,
+       0x058139f1, 0x57bc0ec9, 0xfbc6d103, 0x7bfbcf1b, 0xd3fa1463, 0x7cfff554,
+       0xcfe306ad, 0x9ffa2e38, 0xfe863e1d, 0x63ebd566, 0xf41abfe8, 0xba14c0fc,
+       0xcebfa324, 0x87f87bf8, 0xc27e9178, 0xbb2f413c, 0xbdfb8c9d, 0x2386fc92,
+       0x98c09055, 0xe7e663bf, 0x16dabdc3, 0xe63c9fbe, 0x984d635b, 0x37666337,
+       0x32fbe79e, 0x6df3087b, 0xc7e4274f, 0x790cbac3, 0x3cb4e98f, 0xb657efae,
+       0x71865c36, 0x07115ea2, 0x7835a7bb, 0xaab7ae19, 0x0e2f28f9, 0x277257ef,
+       0x40f16f7c, 0x6a9f027b, 0xdd43068e, 0x5e1008ec, 0x10b6b556, 0x3dc598dd,
+       0x6ef3ab50, 0xfc130573, 0x148e1712, 0xcc2d86f6, 0x984c595c, 0xc1f7f0c6,
+       0x55f38674, 0xc4e9da5d, 0x0bd5a87d, 0x2bca25fd, 0xfa2590ad, 0xb6b4d7ad,
+       0x94abdc10, 0xb33b1060, 0x3b51668e, 0xe1aadbe0, 0xbe785459, 0x67922af5,
+       0x3e6de716, 0x3867f7bc, 0xdabd59fc, 0xc87289e7, 0x8728d23f, 0x5db56fee,
+       0xd95af88e, 0x93c68cba, 0x756f6b78, 0x8df58e5d, 0xbed15ead, 0xb54dda82,
+       0x71f482ba, 0x8621681a, 0xc7ad1671, 0xb03d7189, 0x03c61933, 0x045b5ecd,
+       0xe1eac899, 0x05a3b2f0, 0x5d731f44, 0x8df4061c, 0xbc7d03e5, 0xfb4cccb3,
+       0x1df3dbd3, 0xafedfef4, 0x0fd1798f, 0x1e01607c, 0xf98aff51, 0xf0238ff4,
+       0x88721167, 0xf200c169, 0x23572595, 0x6b86747f, 0xdfe3ad36, 0xbbc49fda,
+       0x1f28cec5, 0x20ef92d4, 0xe17cebbb, 0xf7148d0c, 0x27bc0950, 0x44f00fe3,
+       0x8176f472, 0xe2efdba7, 0xefdbbe7e, 0xcec79460, 0xd55fc196, 0x148d5d00,
+       0x059b25f2, 0x056f6ca8, 0xeb8252c1, 0x0b416365, 0x49d675e8, 0xbfd1db2f,
+       0xcd7eed83, 0x4deaa18d, 0x58599e35, 0xaa7c9c6e, 0xbef1d91d, 0x618b3f4b,
+       0xc474be89, 0x4581ab97, 0xc51fccf0, 0x1d783d8e, 0x89a7af35, 0x5e3ab4f6,
+       0xe9ed174f, 0xf7cf5e01, 0x20d4a93f, 0x97f14960, 0xd5c6477c, 0x2dbe51a3,
+       0xb27cfc60, 0x3b60e7b8, 0x91c2f213, 0xdb06ab31, 0xbe74626f, 0x50ffb640,
+       0x4e38e7b4, 0x394629ac, 0xfdf8c73c, 0x6c878156, 0xe9f689c7, 0xb6319f14,
+       0xa64af8cb, 0xf42bece3, 0xfdb1997d, 0xd3bdf141, 0x1d363671, 0xc71b47db,
+       0x53da20df, 0x08ef3c1d, 0x473f21c4, 0x15efda2f, 0xc76c76ed, 0xed8d4bf1,
+       0x2bf8c56b, 0x43ad0095, 0xf8899f3f, 0x9d568ee4, 0xf67cc9ea, 0x7e0cc8ea,
+       0x99f0598e, 0xf21b196b, 0x23abfcdc, 0x9a4cbe79, 0x0ff7e3de, 0x7b650f21,
+       0xb8a34b86, 0x10b5eaaf, 0x421d591d, 0xec3e088e, 0x8b4a2397, 0xf717138f,
+       0x3d197f97, 0x8e7ee103, 0xfe00acf2, 0xbef39e90, 0x04c16263, 0x98db9679,
+       0xef0982c2, 0x1864177b, 0xe53759ea, 0xccf7de1a, 0x77686519, 0xb4378e54,
+       0xf13e58b3, 0xae826dc7, 0x0c2aca52, 0x02bef2ed, 0x923e73a6, 0xf479b576,
+       0x677bc314, 0xa474f54b, 0xcb57d3ed, 0x367cabfb, 0x39b70b94, 0x1f236547,
+       0x3275a4fe, 0xef20df1a, 0x8974a26c, 0xc9474bd2, 0xa2eab656, 0xc7f54a5e,
+       0x7aaf3cdc, 0xd78fab65, 0x6f9d188b, 0x4b5ad95e, 0x2f81c7f5, 0x56d7fcb1,
+       0xa07b953f, 0xfb0e160e, 0x43aff411, 0x7fa13b3f, 0xfd023fac, 0xfa1db963,
+       0xd087f2c7, 0x856fb63f, 0x10feb17e, 0x83e585c0, 0x7f3e0fd0, 0xfac7fa00,
+       0xd500d6a6, 0xa3ad6bef, 0x20d686fa, 0x36b6f795, 0xadb5f3d0, 0xdd5f542d,
+       0x7bca8cba, 0xae54c35a, 0xed435d6c, 0x1f37a116, 0x1f1fe713, 0x7dcfc69b,
+       0x467faf27, 0xeed5f29e, 0x4504a8bb, 0x93c8655e, 0x7dc3c8c8, 0x2f31a775,
+       0x7047f110, 0x931e39d8, 0xe02b18e1, 0x2b62cf18, 0xa0dcb952, 0x2e98eb38,
+       0xc0a9dddf, 0xf85b23a7, 0xc57517ba, 0x81a73da9, 0xcc56378f, 0x2cc27993,
+       0xef1f8aaf, 0x957af7c5, 0x8f2a7558, 0x831f9337, 0x553f0179, 0x9133dce2,
+       0x7084c479, 0x7f419369, 0x1fb3cc27, 0x270e6e5f, 0x78286de2, 0x7c78f22b,
+       0xe4ecad43, 0xb6d49bf7, 0x52cd9147, 0xbf742dfc, 0x102ead89, 0x04f4a0d5,
+       0xc24f7482, 0x603373f8, 0xed720593, 0x874ce5dc, 0xb8d1af32, 0x505dcaff,
+       0xa8e7d861, 0xfd3236e7, 0xccb7e822, 0x194a4fb8, 0x3be19b7d, 0x0cf7de5b,
+       0xddcf16ed, 0xb7f9f686, 0x22f2ad14, 0x8a32473e, 0xafd7593b, 0xd7003960,
+       0x044d8ec2, 0xbde05057, 0xfdf9d157, 0xefc5fbed, 0xfffb0844, 0x2f812ec7,
+       0xd7da7adb, 0x6af3758e, 0x84d87a49, 0xa7e3e7fa, 0xee8e49d2, 0xfe44c47d,
+       0x622c71ed, 0x01337942, 0xbf6c48cc, 0x56726f00, 0x151ccae9, 0x574ce5eb,
+       0x8b117eb1, 0xec08bed3, 0x17a43aff, 0xb11fffb0, 0x7e4cfd43, 0xbf3cc7f0,
+       0xba7a4a2b, 0x8967ac44, 0xd16d07dc, 0x73c3fd92, 0x635fc8f3, 0x26d6073c,
+       0xdc2b01f6, 0xef18d955, 0xff261ded, 0xd6fde9ce, 0x1eb005d4, 0x2a3a9cce,
+       0xba0df3e5, 0xd173c869, 0xbf2abecb, 0x623d016c, 0x086597e4, 0x9fca99ff,
+       0xaabba167, 0xf89c7479, 0xe52ccda6, 0x728e9e98, 0x4beea06c, 0x3ba2bb27,
+       0x89a3f087, 0x1adbd9f5, 0x3900fca4, 0xd377ed4f, 0x560f985c, 0xf74ff222,
+       0xb53adeb5, 0x661f2126, 0x52dfa0b7, 0x3d45ab16, 0xf2665a5a, 0xaf27a845,
+       0x1f617fc1, 0x73c7eedd, 0xf3055afa, 0xc71e18a1, 0xbabce9da, 0x794a85f6,
+       0x4b91da40, 0xb0760e98, 0xe16511c3, 0x997e81b2, 0x477c83f0, 0x5ccff5c8,
+       0xad0f3435, 0x3e47da40, 0x33ecddd4, 0x74863f87, 0x998759f7, 0x6309e5b3,
+       0x9183a97b, 0x6a545b9e, 0xa60ae889, 0x3dd3b423, 0x850eda8b, 0x1c2115e5,
+       0x50f3bdd3, 0x254c1f8f, 0x52dd4dba, 0x7bc35745, 0x79f5c14c, 0x1e99c700,
+       0x1a49a0fd, 0xd35ef057, 0xb42ecb04, 0x5e22c71b, 0xa5d19c70, 0x6285c784,
+       0x575afbbe, 0x159e9e10, 0xefcb68f3, 0x87873bc7, 0xcf78fcf9, 0xe90ea2e9,
+       0x73ce31bf, 0x37f56543, 0x95c6def0, 0x74d85531, 0x33ae7c46, 0x53ce26c7,
+       0x3802e006, 0x5538459f, 0xbffc9b84, 0x8f4d7e7c, 0xc819bf70, 0xbb8a5ab1,
+       0xc4b1324e, 0xa32cabb8, 0xc8cdfe42, 0x4ebc1173, 0x0ba9dcef, 0xdfac4a2e,
+       0xb8fd7444, 0x761fe7c2, 0xcd2f3c6a, 0xfd13d7ef, 0x7ee4ebc4, 0x487f9c59,
+       0xdff6f011, 0xe79e36e3, 0x6c583a61, 0x0d2de60b, 0x25fe1fb7, 0xc4a4ca2e,
+       0x18e830fd, 0x649d5718, 0x759f3ca3, 0x7f4b8f32, 0x337cc743, 0x8afcf12c,
+       0x6ae9d04d, 0xe4af31a7, 0x77b71e5c, 0xe8f589ce, 0xc6be71b3, 0x567964b8,
+       0xdd17bdc2, 0x91ffe4f5, 0x6ebecc71, 0xfd2e0f9e, 0x09044b6b, 0x78e51df4,
+       0xa5587be8, 0xee92e5f8, 0xa17df96b, 0x7ba01e87, 0x1d2fa156, 0xbc5ea1e9,
+       0xe8c6bf5f, 0x3bb059ef, 0x1f452ab0, 0xc45a57ec, 0x48d7e4c2, 0xfb2527f6,
+       0x279b7e91, 0x563e69f6, 0x93ca718e, 0xa58f8beb, 0x88a67ee0, 0x91dbb9d1,
+       0x8f7493ea, 0xedfb5831, 0x2b294f78, 0x24f4f7e3, 0x0525fbaf, 0x3ef3c216,
+       0x1c63aeb9, 0x37d867e4, 0xbefff389, 0x7d7ecf17, 0x96f3f40c, 0x81ce18ae,
+       0x099ba5bc, 0xae81e38f, 0xac64ecb1, 0xa0fba876, 0x5f4df3b2, 0xa5c0bced,
+       0x68d7dfc6, 0x9639eaea, 0xcbbc93aa, 0xfa7807ca, 0xad3efd8e, 0x4e27f88c,
+       0x575107bf, 0xb841e1c4, 0x7ecbfcf1, 0x137327d3, 0xbe7c60e9, 0x7c83edc6,
+       0xbf9357d3, 0xceb84635, 0x7599bd94, 0x1c6b870d, 0x3d1bd5c2, 0xb7689591,
+       0x0ff6b848, 0xa5fabf73, 0x934f155f, 0x0120fa8d, 0x12ff534f, 0x865bf69e,
+       0xc0966786, 0xf28e4fcf, 0xb70642fb, 0xd5fd457f, 0xccf78461, 0x51ebb163,
+       0xb3bc023c, 0x53de7f08, 0x15331459, 0x14acebf8, 0xe42959f4, 0xa8ce8f8e,
+       0x17dbd0b0, 0xa75e7e53, 0x7743dbc6, 0x79e08a2e, 0x0b8bdf02, 0xe0dfd10a,
+       0x7ba56e3c, 0x7949429e, 0x2f5cb222, 0x573fb1e6, 0xab0f1219, 0x78bcb9f3,
+       0xd4f9b5f1, 0x596fbddf, 0xed83ca19, 0x5ef5df22, 0xef0da757, 0xc47895ef,
+       0x2194057a, 0x2a117c4b, 0x3f2b7bba, 0x218ee9b3, 0xf1f133c6, 0x1be24bee,
+       0x572c9e39, 0xbb7297e4, 0xe2aa3954, 0x2efb8739, 0xd9ee937d, 0x2352afba,
+       0xe337fb99, 0xfe127d7f, 0x7d666fa3, 0x8acbd39d, 0x2aa3f47c, 0x037da5ef,
+       0xfe2521ea, 0x9fc432b3, 0x0ff34825, 0x3b656dbd, 0x6a78c195, 0xe72bf414,
+       0xe12fe727, 0x80b65e76, 0x7ae099ce, 0xc5abe020, 0xa44f52fb, 0xf387bd0b,
+       0xa9713d22, 0x4c89cfc6, 0xef5d68d2, 0xce853c9b, 0xf917ecf5, 0x2c4bf114,
+       0xc32efe43, 0xf76f0233, 0x0c45fb9e, 0x770da9ef, 0x055ee99b, 0xbf78f5a6,
+       0x7a147409, 0x9a7ba35d, 0xf16a9e81, 0x5f17a8de, 0xfb869b3b, 0x66f903e8,
+       0x3e40fb82, 0xe77d8797, 0x6f3a5ad4, 0x2e67daf3, 0x9ffe8135, 0x5d8557ce,
+       0x39e18b12, 0xfc158d9a, 0xd84380dc, 0x4ed78e01, 0x8efc2035, 0x2ab3dfc9,
+       0x4f767a09, 0xdbbe95be, 0xf9678968, 0x48740e30, 0xdfee5165, 0xfaeffba1,
+       0x38ba0bcf, 0x8f2b9a1e, 0xe8e09d92, 0x3de2f7e6, 0x5c13af9d, 0x7841f708,
+       0x33ee329e, 0x57b63d57, 0x06a378c2, 0xf8ba77be, 0xe24ca67a, 0x77dcd0f7,
+       0x785dcfe9, 0xc2ba5eef, 0x4be8fee8, 0x3906cc0a, 0xd7c45f5e, 0x1632b3a1,
+       0xe5fc851b, 0xb6af28d2, 0x0d9b7a33, 0x17c97aed, 0xf4a947a3, 0x97916add,
+       0x29727abe, 0xe3a499f1, 0x57c105b9, 0x02366e91, 0x76493c5f, 0x9d302c4e,
+       0xc72ae3f0, 0x95c7e3fc, 0x3fb71d58, 0x2fd42e2c, 0x819326a5, 0x380b8adf,
+       0xec12c8dd, 0xee77b252, 0xf52cb410, 0xc6c45b7d, 0xb7ffbf30, 0xa3a566e7,
+       0x2796da5d, 0x0dbf3ced, 0x095db5f1, 0x38e117a4, 0xbed2a5ff, 0x4ed7c5ef,
+       0x6db8e034, 0xdbe42f30, 0x58ea7e7b, 0x9b49f68f, 0x2a7c4fcb, 0x26dcd7c7,
+       0x9fbc1eb1, 0x2bff16fd, 0xbb8c6fe8, 0x47447df9, 0x43635ca6, 0x4cf787fa,
+       0xad7bcfd8, 0xd81a0bf8, 0x07f90d4f, 0xcf66ba16, 0xb116efc0, 0x6bb42ae0,
+       0x86a87517, 0x11ee177b, 0xb9e162f2, 0xd84d1614, 0xfc9c2c1f, 0xb6373a2d,
+       0x8b1a5cf0, 0x8f75bd82, 0x8f7d1738, 0x0ac45738, 0x443b3d38, 0xdfe515e9,
+       0x24bef7cc, 0xcbf995bd, 0xdf39f3bd, 0xb7e802b3, 0x14b1e949, 0xa71b10c1,
+       0xebce9efc, 0x62ead7bc, 0x780492d1, 0x0473cd07, 0xd38c268b, 0x1b39deff,
+       0x7d6067cd, 0xcc0efd39, 0x787841d7, 0x784bd5af, 0x91ffbe1c, 0xf40e3c06,
+       0xc780ca3f, 0xd097fdc1, 0x96b5eff8, 0x13ff497e, 0x375fe986, 0xefd03fc0,
+       0xf7b71a68, 0xa71ffcc8, 0x891ddf02, 0xf9edbdde, 0x331dfc4a, 0x017efd2b,
+       0xa6aceaeb, 0x338f8473, 0xe77a673a, 0x83bddfe1, 0xee779af9, 0x8c70f8b2,
+       0xae7c733e, 0x333d086f, 0x78c2b99a, 0xc72c979f, 0x7cd31417, 0xb4db9f92,
+       0x32f30b88, 0x0b9aa56d, 0xc6d11f7f, 0x71bb9162, 0x236952df, 0x42e32739,
+       0xe53fdfb2, 0x3b3cf2a9, 0x6f7907c9, 0x979112cb, 0x5e08ec57, 0xd4beeb81,
+       0x13fcded4, 0xd283f6f8, 0xcc373a36, 0x33f69b98, 0xe1a36e32, 0xa315bf2f,
+       0xf0c0305f, 0x7a13cdfc, 0xf77e0670, 0x18271043, 0xd82f51c7, 0xb5bcc41d,
+       0xb8df620d, 0xfaf31ec1, 0x0de6e412, 0xb357da05, 0xe893da17, 0xf72fd276,
+       0xdedd3946, 0x227e8050, 0xfcc4f635, 0xedb7cc22, 0xe976f711, 0x55778a16,
+       0xfefba31e, 0xff7dcbe6, 0x8ebce49a, 0xd1da377c, 0x8694ce32, 0x6b687779,
+       0xbef7e46c, 0x7af2a7d5, 0xa08c7ffd, 0xffb01073, 0xf9432d49, 0xfee55fb2,
+       0x3adf1120, 0x67d0e62b, 0xf94058db, 0xe41f22f7, 0x744bf76c, 0x35d9e4af,
+       0xebfd6863, 0xdd3ef85f, 0x973fb70b, 0x43beb1eb, 0xf563d24e, 0xde155f56,
+       0x973fb85b, 0x5a9dabdb, 0xc122ad34, 0x579d5d7e, 0xe3f9f24d, 0x894c6335,
+       0x0aef8ff1, 0xfa51b079, 0x1578b537, 0xb8f9679e, 0xd233fa32, 0xf4ec07a3,
+       0x83a6513b, 0xfba2abbf, 0xe95a372d, 0x0faa0177, 0x875cdb8e, 0x8d34c3fb,
+       0x074d91f2, 0x99cf04ed, 0x2d7efc75, 0x5de516fc, 0xf491c1d3, 0xa9f556fb,
+       0x6c27ca71, 0x6095f14a, 0xe0feafdc, 0xffd7ba54, 0x057186e4, 0x644eff28,
+       0xaf7405ea, 0xf43c06f1, 0x6343f509, 0x17b5f3f9, 0xe75579d3, 0x50e0d4c6,
+       0x8fa9107e, 0xdaefef92, 0xdbde5b9f, 0x6719f885, 0x7dfca1f3, 0xb8f1f14f,
+       0xd9f12bef, 0xf915c53a, 0xd77ad2f9, 0xbc7dfa69, 0x6f778efa, 0x43dcf462,
+       0x73f72b74, 0x0bd5e3c9, 0x12dfb57d, 0x4bbf8b9f, 0xe052bf56, 0x624efc5d,
+       0x7e9ca9bd, 0x7de24faf, 0xb73dd263, 0x24fd084f, 0x69af93cb, 0xd8205f74,
+       0x1fe80511, 0x4ad8793a, 0xe3727674, 0x2eaf3a04, 0x9c07abc7, 0x4f2f80b8,
+       0x7113e864, 0xf2169f5d, 0xdf257eaa, 0x30e7caa7, 0xe77f0c7e, 0xa5487e30,
+       0x573eaebc, 0x92e30d3c, 0xef593df2, 0x4ab74f9f, 0x3fb597bf, 0x6f5a45f7,
+       0xf48627a0, 0x49c17a64, 0x82f43a7a, 0xe7ae1775, 0x8c2c95c7, 0x5bf0cffe,
+       0x8ec7f7fc, 0xfd92b21c, 0xef9c77dc, 0x9fdd076f, 0xe01788e6, 0x17a1a1fd,
+       0xeb1c9246, 0xe0ef8fcb, 0xdf9db6f6, 0xf046f8ab, 0xcdff1162, 0xe611f711,
+       0xf9f79da0, 0xed147b21, 0x9e29283c, 0xbdbb6610, 0x2a70fcf4, 0x940fff43,
+       0xca63cf14, 0xeefd2f01, 0xdf176b0c, 0x3bfbe8c7, 0x5163820b, 0x0c59df2e,
+       0xfbf03bfd, 0xe7def453, 0x521782a3, 0x5cb18a0c, 0xf52e5e31, 0xa42c1f9b,
+       0x5e67cae7, 0xed2a7bfe, 0xed463da2, 0x62f06b21, 0x9cafc79a, 0xf310e76c,
+       0xeef7aafc, 0x41182d1d, 0x06e128eb, 0x98dd933c, 0x05b3978c, 0x3b7bf126,
+       0x74c91f1c, 0x5f9ebfd9, 0x5ffa1f02, 0x21f6bce8, 0xc6eb8ebe, 0x591cb859,
+       0x63ec813b, 0xc86296d6, 0x88715b9f, 0xbbd0c3df, 0xdceb49c1, 0x843ff667,
+       0x86fe28fa, 0xed7bf199, 0x3f4022c0, 0xf9a1e4c5, 0x4f9123e5, 0xcf2d64bf,
+       0xd1e8fbb3, 0x39e60bf7, 0xfbf25cf0, 0xd2c97386, 0xa49d085f, 0xe1c63fa1,
+       0x97e6d3d3, 0x255d7b71, 0x7aeff8f8, 0xf4eb346d, 0x0de16bbb, 0x711fc8e3,
+       0xa41fa2d2, 0x775b87df, 0x4ae90981, 0x77f2172d, 0xbc9f9f13, 0x7bde4b2f,
+       0x8a9f8c95, 0x7f9262c2, 0x33782c4d, 0x827ea1de, 0x61c259e9, 0x91fff746,
+       0x6984df7b, 0xe29f9a88, 0xf485acb6, 0xf67be0c2, 0xbbf25f2c, 0xf5bbff6c,
+       0xf42b5c2a, 0xd38795ef, 0xe07eaf50, 0x3a46fbe2, 0x5d7a8f7d, 0xc36cf3e5,
+       0x83af300f, 0x4e14a605, 0x879276a2, 0x5dbc281f, 0xf341b9ca, 0x7ec17a47,
+       0xebe83df0, 0x7fee429a, 0x710cae63, 0xc16c2bc8, 0x9fa94d3c, 0xc2668a42,
+       0xdca7f373, 0xe3d21a7a, 0x19c5b5a9, 0xc60f302b, 0xda2567ad, 0x8ca3a1d5,
+       0x78eb8bce, 0xf8c5f8df, 0x89fe32fb, 0x9fdbf7e8, 0x243bf461, 0xb4e4f3c3,
+       0xed89b99e, 0x9eb90a73, 0xf6285f9b, 0xe44c8599, 0x8de32657, 0xb162fbaf,
+       0xf0796aee, 0x2687da72, 0x4b78b7bd, 0xa487a0ba, 0x7fcfede7, 0x1ea0f297,
+       0x4913de36, 0xef185fb1, 0x612c5783, 0x532c42e5, 0x61bdaf28, 0x0d739713,
+       0xb92cceaf, 0x5ee9d78b, 0xef3b6985, 0x59e3dfa1, 0x12caebb0, 0xad16e5c6,
+       0x05c7a483, 0xb412fe05, 0x555be2e3, 0xc345f217, 0x51e09516, 0x56d73ecd,
+       0x8b7a7e78, 0x06bbec99, 0xbce9cf01, 0x9bad1a60, 0xe00b34c6, 0x4c16b4fd,
+       0xab75fb23, 0xa4a1ddf8, 0x6f7bc079, 0xe043156a, 0x99d7c6c7, 0x043c53f0,
+       0xa261bc1d, 0xbf805a75, 0xec70890b, 0x79bfc854, 0x33783f3a, 0xfec14fd6,
+       0xabe9cf1f, 0x7dd0969b, 0x3ef8c936, 0x7d120b6d, 0x91f3162e, 0x471e4cf8,
+       0xf10fb3e2, 0x2bd2f689, 0x85ef4853, 0x6291541e, 0x9fdd8bd9, 0xda7cbed2,
+       0x99df2ba1, 0x8137cf8a, 0x9ea3a2dd, 0x6fb3f51d, 0xa35b9ea3, 0xfe7a8c52,
+       0x962ce2a1, 0xff71afa4, 0x39f5ff39, 0x3d04a669, 0xf1c83ea9, 0xa4e73aa4,
+       0xcff7a42d, 0xebe91d7e, 0xaacbee84, 0xf1ef7848, 0x83b8fec2, 0x37eabd61,
+       0xc70d21fd, 0xa66f5869, 0xe975c979, 0x7ca079c3, 0x208d4f6b, 0xc5e5f7fd,
+       0x4eb95fa9, 0xeb8df4fd, 0xde09e920, 0x9742affb, 0xf24c2718, 0xb05154e8,
+       0x9d0437ca, 0xc6007a2c, 0x38b6fec5, 0xf3d2fee9, 0xa3e2571d, 0x5f05bd7f,
+       0x71d71d53, 0xd1f91147, 0x74686f4d, 0xfb44e0c8, 0xc7c80555, 0xd02fa0f5,
+       0xc4af516f, 0x647ba1df, 0x1ee9590f, 0xb74dfae6, 0xd5e38cdc, 0xb09ab71f,
+       0xabe1d4fd, 0x495c1226, 0x2a780aeb, 0xfbde8a18, 0xbe05e28a, 0x3d81fc04,
+       0xe72dfc41, 0xc1370093, 0xba29fb01, 0x08afa88f, 0x0e4133d6, 0xedc859bc,
+       0x65df782e, 0xf7e6fa21, 0xd7cff561, 0x575f3495, 0x64df7cd2, 0x17ccdf44,
+       0x782cf9a4, 0xe7c26adb, 0xb6bfee0b, 0xa73df704, 0x79a74dd6, 0x4ff0ca9d,
+       0x553afe44, 0x210ffd00, 0x0fdc172f, 0x0bfb2cf3, 0xd3b76cf3, 0xcf3b0d7a,
+       0xf60ef88c, 0x89f9e617, 0xcf3943a0, 0x0d3d34f7, 0xcf43f9f3, 0x2efd0caa,
+       0xc6c0fca1, 0xbf4ebca9, 0x73321713, 0x4a6d087a, 0xdedf7ca5, 0x04fbfe6e,
+       0x78c00e52, 0x260f49e7, 0xd55387a2, 0xd0c9e6fa, 0x3f07ffdf, 0x00b71737,
+       0x0000b717, 0x00088b1f, 0x00000000, 0x7dcdff00, 0xd554780b, 0x733effb5,
+       0x64932666, 0x08124c92, 0x3c984081, 0x49849009, 0x768a8802, 0x02d10478,
+       0x89794f0d, 0x42100793, 0x69b5a05e, 0x0240cd6b, 0x350d45a2, 0x01d45a2a,
+       0x0da2a281, 0xbc150a0a, 0x45622a03, 0xb68b57c5, 0x514026e5, 0x5ea0c679,
+       0xffd7b5ae, 0x4e7dadfa, 0x5490ce72, 0x7dfbdedb, 0xdf1f7cff, 0x5afd9f66,
+       0xd7b5ed7b, 0xe7bdaf5e, 0xcbaa3dc2, 0xe4e216ef, 0xff6f05dd, 0xf7a517bc,
+       0xfc812eaa, 0x02cddf58, 0x2cc38ff9, 0x934a14fe, 0xfe70a68b, 0xa56b9b65,
+       0xa689c422, 0xa141fdbf, 0x367d85fc, 0x0bf2a0b7, 0xcef74529, 0xea8f7e46,
+       0x2fed415a, 0x259f680c, 0xd8b97386, 0x5deae544, 0x2e509a23, 0xcae61e1e,
+       0x0df2f2a0, 0x09644261, 0x6856fbfe, 0x3be9237f, 0x6ba50b52, 0x34786f55,
+       0xfd2f4da5, 0x6fa5c944, 0x578f3756, 0xf724abf3, 0xb97e34dd, 0xf9ed5855,
+       0x399edca8, 0xf388472d, 0x03136d7b, 0x233f32d9, 0xb03fcb87, 0x5d8d7952,
+       0x7bf85af8, 0x0e6a7dad, 0xd2b6e28f, 0x0fa98b38, 0xfae94a91, 0xea60ef18,
+       0x938d317f, 0x8b7de342, 0x0e5c1fbf, 0xe7cb0edf, 0x9fa88a0b, 0xf6626d7b,
+       0xf55dd973, 0x4ddb34f4, 0x6d46f61d, 0x553b577b, 0x3cc62588, 0x2422a1e1,
+       0x477914bf, 0xa432be57, 0x7ca42abc, 0xa7cfbf47, 0x1f2f3914, 0x1fc6037f,
+       0x12c785d1, 0x2c3b8f0d, 0x72eb1df4, 0x44d8128f, 0xbab12dff, 0xfe09cbed,
+       0x9b88c6e7, 0x55a94fd1, 0x47cdae38, 0x5f9e0ebd, 0x86345589, 0x87bbe3e5,
+       0xa6f3e9eb, 0xe2c31afe, 0xced11f28, 0x89bd53e3, 0xda9e4376, 0xab9ae09b,
+       0x4ba7a3c1, 0x4ebb85b7, 0x7fa0f3ea, 0xa6b12d55, 0xbeeecd7c, 0x7c0693ae,
+       0xfa7fc52f, 0x3449bfd2, 0x8bc091fb, 0xdddaabfc, 0xe892307a, 0xcdf14da7,
+       0x17bf5375, 0x9d1d7e0e, 0x1f75e6ed, 0x9beb4459, 0x7f3ea6af, 0xbedbe698,
+       0x426cf547, 0xfdd86fbf, 0xe7fd0c4a, 0x6e0f8b9b, 0x2fd5efa7, 0xddbb89a7,
+       0xc50ff35d, 0x17dd85e3, 0xfbe953a3, 0x08f643f9, 0xb9e68c31, 0x9dac7e37,
+       0x5c4762e8, 0xaf78b77b, 0xef5dd6d5, 0x35b5bcef, 0xdea1aa7a, 0x3d1ad179,
+       0x252f40cd, 0x8bd62fbb, 0x5f9fc65c, 0xefc2efcd, 0xc7bd7d89, 0xf4bdf4aa,
+       0x5ac6fdf7, 0xc35fbd28, 0xf736bddb, 0x6e096b13, 0xcf309eff, 0xfcfb8216,
+       0x682db31b, 0x728dfe7f, 0xcbcdbd2d, 0x244f5fe9, 0x8b68fc63, 0xbc7d77a4,
+       0xf70b6e35, 0x7b696a53, 0x8fda1aec, 0x93ebbfa5, 0x55d290d2, 0xcfc96a5e,
+       0xb76f3ac4, 0xdc002fb5, 0x46b115e7, 0xe7eaeb89, 0xdb9bb77e, 0xc9f3df9f,
+       0x270fe063, 0x4f901dee, 0x41f94d64, 0x3f2a3eb9, 0xa64151ff, 0x7f3dfa8b,
+       0xf80f5f4f, 0xfb9b76c2, 0xbbb7a636, 0xf7d83ca2, 0xa7187f7a, 0xb9effd16,
+       0xe90fa462, 0xca5e1247, 0xb8e4fae7, 0xabbf257e, 0xfb8b68df, 0x17e0d1be,
+       0xb679b7bf, 0xeffcb250, 0x31627d69, 0x6ee7ec3f, 0x4d74a1d6, 0xf89b7098,
+       0xbb864ac9, 0x22ec7844, 0x030b964d, 0x228995bd, 0xc9b0befe, 0xf1117dfc,
+       0xbc5f7c09, 0x5cbdfcde, 0xa56ead34, 0x98092df9, 0x3fda0bbf, 0x6bec04fe,
+       0x5ec5affd, 0xff7a0514, 0x4f54cc36, 0x40fe35f8, 0x255f091f, 0xc7c11fb4,
+       0x8102519e, 0xbbdf5895, 0xe8679e54, 0xa775debc, 0x2287bb70, 0xab4167ff,
+       0x5b8f5d61, 0xf0913584, 0x1c2edc7a, 0x47e8f989, 0xf5fa8508, 0x6c0b0bef,
+       0x0f7726a1, 0x04b92afe, 0xc231af7c, 0x5bbe0822, 0x427ce05d, 0x49f7d8ac,
+       0x5d29fa32, 0x356de853, 0xe6c177c0, 0xd4e7e87d, 0xe25dfdbe, 0xf8ef54d7,
+       0x58d340d8, 0xddf8eb82, 0x1ba1a7aa, 0xb1af4eb8, 0xe1014088, 0x02212ee3,
+       0xf27f94f1, 0x5a62e493, 0x7cb6cf97, 0xa4625c92, 0x36cc457f, 0x129ea3d2,
+       0xef3ebc24, 0xfcd2ef61, 0x305cd38e, 0x5d7ad09f, 0x57866beb, 0x2ab867c7,
+       0x87a3bb6a, 0x54f740cf, 0x5577f59e, 0xf7efb178, 0xcfa002d9, 0x3c5f8dc8,
+       0xb9f40f38, 0xa14ae6d7, 0xa9f66bb1, 0x2de6955e, 0x0c81a8f6, 0x4f7b639c,
+       0x9ce05744, 0x52e053d9, 0xd9aef30d, 0x7ce116a3, 0x62fbbf39, 0xf7366942,
+       0x44edc533, 0xa03c07fb, 0xf8e09edf, 0xf7fd5b9b, 0xccd79ff8, 0x7f65ceff,
+       0xf8037090, 0x9953c6c0, 0x07c4efe0, 0x79a6e6ff, 0xc6fccf9e, 0xad10bc8e,
+       0x047f4123, 0xe09bb45f, 0x2af810bc, 0x8e5c105a, 0xd037aabd, 0xa5443acd,
+       0xff4f19d8, 0x09137c32, 0xf82e84be, 0x94a89e08, 0x56705d11, 0x38eddbbb,
+       0xa2382f67, 0x694fc173, 0x12f29342, 0x0dc9f3b4, 0x493a5afe, 0xbf1d7f10,
+       0x70cae167, 0x8a4d0bc8, 0x97be8c27, 0xdcf955ed, 0x191bdb2a, 0x3f1816c0,
+       0xd2f9c9c8, 0x1840d547, 0xa3a827e5, 0xea9b30ff, 0xf547be2f, 0xfb148ed0,
+       0x07f6de37, 0x8375d61b, 0x881ca04d, 0x344b5c03, 0xfdec96b8, 0x8d0a67e1,
+       0x2ddf78b3, 0xe2ce3007, 0x170f1407, 0xe8edf3a8, 0x8a43c977, 0x67405788,
+       0x3a46e3b6, 0xce64d85b, 0x0bad122f, 0xc1fc1554, 0x9ef09dfc, 0x96fd415c,
+       0xdd730eef, 0xa102f18d, 0x4abc42e5, 0xff68d4f0, 0x3b58cacf, 0xcfd500f7,
+       0x3c6768da, 0xe2170f9c, 0xb5abf608, 0x0d204135, 0x1d6326b6, 0x6bf9efcf,
+       0xe6b1d632, 0x2995ff77, 0xcebf59ba, 0xaa37b4fd, 0x2148a9d7, 0xc4514eae,
+       0xfba0a9b7, 0xba8a538b, 0x201b6fa9, 0x9b36c5f7, 0xca879fbf, 0x8afc6c0f,
+       0x3d85c1f9, 0x6eae81be, 0xbf6bb7e8, 0x892dc3fa, 0x02e18348, 0xd716f0e9,
+       0x2427d80d, 0x35be620f, 0xdb4f569b, 0x97f0f944, 0x44b9386c, 0xf793864d,
+       0x42c7f60b, 0x3efabf43, 0x80be06d9, 0x0fe48474, 0x1cf201b6, 0x7b9daa3d,
+       0x4c77f6db, 0x9e06e8c9, 0xd71b6ea3, 0x5c100db3, 0xd17759ef, 0x845bd05c,
+       0xbe0d1fc5, 0x775ebc2d, 0xa2b3c22f, 0x5d4357d1, 0x89ef82ad, 0xfed389a2,
+       0x47d385a2, 0x5139f085, 0xc05c785f, 0x620310b3, 0xf3de3f81, 0xccbecf8c,
+       0xadac7f37, 0xe8357821, 0x022b1fc4, 0xeaffe85b, 0x63508746, 0x46b5ed20,
+       0xce5451a3, 0x5206fbb4, 0xd503edb9, 0x1dde40a2, 0xc7a7afa0, 0xa5f7fd85,
+       0x718c4673, 0x2e1ff6fd, 0xaafe8899, 0x8c22a976, 0xd3b73bfa, 0xd44e8226,
+       0x7c02fda7, 0x9ec2fe1c, 0x57b4be02, 0x6b979011, 0x35ef8f28, 0x80deada3,
+       0xa4772f01, 0xd50f18d8, 0x9cf29929, 0x4d0f7ab6, 0xbbcf7ea2, 0xeb90ec4a,
+       0x26cb876d, 0x25b1bce2, 0xd701d896, 0x1d63c3fe, 0x58b75829, 0xd59bef2b,
+       0x8f71f57b, 0x547fd0b8, 0x6f0c07ec, 0x4445b663, 0xa3c6bb53, 0xa6460161,
+       0x30a1f243, 0xc18daf0d, 0x37770ef1, 0xe317e3eb, 0x2a28c493, 0x044ea9df,
+       0x255ce79c, 0x2da3ac2e, 0x0aeee896, 0x4ef36f6a, 0x0dfa9abc, 0x078b8d8b,
+       0xd2526b7c, 0x8abf3d78, 0xbf3865ad, 0xcfc2f122, 0x08b6b7fb, 0x65fec6f9,
+       0xe9bee32a, 0x35cfde21, 0xd47e390e, 0x51cf953e, 0xe343a571, 0x4abbefdb,
+       0xc9059c69, 0x0f4147be, 0xc46dfc9d, 0x39fc02ab, 0xf96162cb, 0xe735f1ac,
+       0xbd21f05a, 0xa48a6cfc, 0x563d7d37, 0xc0bab2f5, 0xe8d51e3f, 0xc8ab9573,
+       0xa7986f91, 0xc345b7ad, 0x78039157, 0x3a2f61da, 0x9da5f384, 0x3cdce3be,
+       0x01cd3890, 0x59ea853d, 0x7aa9cfd0, 0xf47631da, 0xfc01c33b, 0x3255ea2e,
+       0x8b16ed01, 0x6fd8d5da, 0x22abd78b, 0x8dabe068, 0xa2ee3936, 0x1822114b,
+       0x22ee35df, 0x7f6e3f5a, 0xe9045a29, 0x970c6ddc, 0xe4a31af5, 0x452379fe,
+       0xb50f9fee, 0xf969b4f9, 0x7baf997f, 0x5cfd7ccc, 0x96b61fec, 0x46fefe48,
+       0xa55bf50a, 0xa1484eb4, 0xec4eadf9, 0xa7bf03b0, 0x98225dea, 0xb2f78069,
+       0xa08bc679, 0x7acedc61, 0x9f3c1c97, 0x3370f5ae, 0x75f35dfc, 0xd54e1e32,
+       0x7b1e3227, 0x84c93fee, 0x53feaec7, 0xbcbc784d, 0xff1e4cff, 0x77d67d54,
+       0x87b43ff4, 0xf826ddfe, 0xe74dfabb, 0xdf6ec571, 0x3b97f040, 0x980fc45d,
+       0x505f886e, 0x3df15db9, 0xdbe4357e, 0xe404c28f, 0x7dc2afbe, 0xfe065c83,
+       0x65ce0df0, 0x4982e7d6, 0xd17eb7e0, 0xeecd69cc, 0xded0138b, 0xfb017c4d,
+       0x11af2f49, 0xf8270ced, 0x3583e885, 0x7cb9bab4, 0xf4106fb7, 0x4e8e1d22,
+       0xa775e679, 0x20fb42df, 0xa3dfdf6c, 0x582f8fb1, 0x2878a7db, 0x46abd96d,
+       0x7c75f71a, 0xb1a7a4aa, 0x6dc8be03, 0x68d5efa5, 0xb6ef7c47, 0x020e9797,
+       0xdac3aa7e, 0x81f70173, 0x8b96ff97, 0x7dabe473, 0xfbe2074b, 0xf2cfaa36,
+       0xdabdbd87, 0x5d2fe863, 0x5196fcb8, 0x5533a95d, 0xefd0ffee, 0xf435f6db,
+       0x89db1c03, 0x0b9209bd, 0x0a2aebab, 0x0d83c64e, 0xff07ef79, 0x58b7c412,
+       0x5d3dda1f, 0xeef9031d, 0x28799243, 0x948f7c3f, 0x100f861b, 0xe40a4b01,
+       0x83670fbe, 0xb08f544f, 0x470aa0bb, 0x79611de4, 0xc384623b, 0xbffd50a5,
+       0xdbe397f7, 0xa1a42f21, 0xe83c617d, 0xf164caf9, 0x1b6dc9ef, 0xf04ff642,
+       0x34edeabd, 0x3ada955e, 0xfbc29c65, 0x7c153f28, 0xde2fadfb, 0x04d7f4d6,
+       0x9c01cfac, 0xfbcf046b, 0xa9653f5a, 0xcf502bbe, 0xe7bd68e7, 0x7337aa0a,
+       0xe864df56, 0x7e9ac547, 0x52112626, 0x947e64ae, 0xe5c83b03, 0x83d4b6e7,
+       0x3e7c525e, 0xd7dfc1e0, 0x35f9c1e1, 0xfa384934, 0x62455e12, 0x8d1a7520,
+       0xa2d5213b, 0xc0140fdb, 0xe39b443d, 0x965afd33, 0x1939f2c7, 0xfd1d0388,
+       0x4b4ee3b3, 0xfc064ef5, 0x670ffd7a, 0x75f1cbcd, 0xf2e86e73, 0xb2deddbc,
+       0x57b6700c, 0xfc7f5939, 0xeed44500, 0x41615989, 0x8a7a1a35, 0xf9f40d73,
+       0x0e0b91a3, 0x8c7c26f6, 0x43cdf28f, 0xbc6fb3ff, 0xcaf2357e, 0x72f77881,
+       0xeb7173d0, 0xc2efd648, 0xbca3377d, 0x981be1d2, 0x373c5340, 0x062837c0,
+       0xbc517c87, 0x9451275c, 0xfc2dd453, 0x45629e12, 0xe518df8e, 0xc53f472b,
+       0x5d8f2396, 0x23d66f81, 0x8d106f6c, 0x739fb9bd, 0x9dde5176, 0xe1e3affc,
+       0xfd8f3698, 0x25ed7136, 0x75fedf9a, 0x82069e31, 0x1bceecb7, 0xba50d417,
+       0x109452d0, 0xdf704d54, 0x575d4a96, 0xf6078bfa, 0x9cee7925, 0x4ebb834d,
+       0xcaeadb83, 0x50e7ee34, 0x79741bb8, 0xeb0a17e5, 0xf947fc83, 0x81b1fd17,
+       0x661f29bb, 0x74c1f8b9, 0x16395b9c, 0x886c93b6, 0x7a45bda0, 0x9c1a3be4,
+       0x73bed28f, 0x35f7f1c4, 0x21189ef8, 0x683e27db, 0x507ec009, 0xaf0f7634,
+       0x4ed513d3, 0x15634a8f, 0x721db70b, 0xb2f0a950, 0x31d7fcfe, 0x4ad7db7f,
+       0xf54e6af3, 0xddbc07dd, 0xfe496f1c, 0x0df0e180, 0x6b790a9d, 0x3fc79cb4,
+       0x1e793790, 0xc6cb84d3, 0x6b589942, 0xcd31fc81, 0x50b2a725, 0xba63fb91,
+       0xde30daf0, 0x7ae3e14c, 0x7bb79def, 0x07bc4fa1, 0xbee0885d, 0xfbf9f851,
+       0x74e0111c, 0xfd72089e, 0xe72b449b, 0x7d137c75, 0xd24bdcdc, 0x547d27c7,
+       0xc056ffc6, 0xee646efd, 0xc79a3a80, 0x650687d4, 0xdcd57eb0, 0x5df3f19b,
+       0xe8d54f70, 0x6feff686, 0xbfd88eb1, 0x699fa833, 0xdfec8437, 0xf5f5bdf1,
+       0xfb47f8cc, 0xa74748e8, 0x4bece4fe, 0x5b4eb878, 0x4bbcebd2, 0xc2127f59,
+       0x8fd1f2c5, 0xa85b7db4, 0x5a2f453a, 0xd26e239f, 0x89960897, 0x62259663,
+       0x10afafbe, 0x3ad0156f, 0x15463ebe, 0xcbd35c0d, 0xfd68a6ed, 0xe13fe94d,
+       0x0f5bd833, 0xe1af608b, 0x92f0aed4, 0x8218d5ef, 0xbdba8a7b, 0x27ca9631,
+       0xc6bd27f6, 0xefaeefc0, 0xfd0ac3b5, 0xf37486ee, 0x66d949f7, 0x68b267fd,
+       0x94fe3152, 0xfb7ae6e1, 0xb3a22781, 0xfea553f7, 0x21888622, 0x0b7af2df,
+       0x1d3e718b, 0x2fda2e93, 0x69111c10, 0x2eb18fbe, 0x75ff27cb, 0x5615c601,
+       0xb7ea9f39, 0x1debb655, 0x288b7927, 0xa7ac9c50, 0xca532293, 0x4a7fc825,
+       0xd3d203f2, 0xcf4e6ef5, 0xf28f79d2, 0xce1ef5f3, 0x9d15a417, 0x6b25bf40,
+       0x7d62b73e, 0xf8970cee, 0x9a696f2e, 0x762ab000, 0x5a441cb7, 0x809a2c16,
+       0xa1d17663, 0xef4883da, 0x6adbd4ec, 0xe1d3be59, 0xd3a345be, 0xfda6a25b,
+       0xe1d68730, 0x87aa3d96, 0x4da603f3, 0x790bdc9f, 0xa27be71b, 0x444baaa3,
+       0x54572433, 0x012fdeab, 0xdb6f7797, 0xdf9a78c1, 0x18a3f527, 0xbdeacfee,
+       0xfa99f70c, 0x4a4e9c89, 0xe81bfa2b, 0x673e2bcc, 0xf6f26c79, 0xd5126b36,
+       0x5e2af42f, 0xbd6bdbec, 0xfda01022, 0xcf26deb7, 0x0e74f581, 0xc98f1f60,
+       0xade8f699, 0x67da7c02, 0x6671a34b, 0x10a4b0de, 0x55194ce3, 0x1bbd456c,
+       0x201921bf, 0xbf4e8ba5, 0xf9f5ee8b, 0x76eb6957, 0xf18565ee, 0x2d33b1d8,
+       0xf2c17206, 0x907d695d, 0xf5d4bf12, 0xade048dd, 0xe18592e3, 0xc11a38ec,
+       0x6ede86fa, 0xe648aef9, 0xd807cb3b, 0xb760c203, 0x2ceb433c, 0x99e6f20c,
+       0x36e27e67, 0xe2672b9e, 0x18fabe5a, 0x922fedfc, 0x736491bf, 0xbff011ea,
+       0xa03cfdfe, 0x9c9af393, 0x24467a4d, 0xcd6abfce, 0x84fe08ae, 0x690899fc,
+       0x6cf91dcf, 0x2fec58d2, 0x4e1c478c, 0xf32bfce8, 0x7f5287d9, 0x6f1aeeee,
+       0x8fc2cb5b, 0xb9fca11f, 0xa36fc580, 0x689ce9f3, 0xf03bff39, 0xb64ecddf,
+       0x10a9ddeb, 0xb77f383c, 0x967ce3f4, 0xc3a88d62, 0xbc022bf9, 0xb714b3bf,
+       0x55f88eb5, 0xf70f73e5, 0x44bdfd03, 0xe5451838, 0x648bad2f, 0xcd92f67e,
+       0xfd0eac73, 0xfbfb2a3d, 0x3d3fbdcd, 0x3de91bbe, 0xc53ff955, 0x31c5a4f2,
+       0xb57ecbfe, 0xd3da0864, 0x52fa2ef9, 0xa8bf4f7f, 0x3f69c304, 0x5fef34e7,
+       0x1be097d9, 0xd2cda1b6, 0xcdbcd28f, 0xa1d2034a, 0x04386e03, 0x690df3bb,
+       0xb05f6e6e, 0xc24d453d, 0xf817ec36, 0xee7c07f8, 0xec81e59b, 0xf6c7cfe6,
+       0xc1725d13, 0xf4e5a510, 0x2c358246, 0x8fbe68f9, 0xf3c4d7f1, 0xfa77b5d9,
+       0xe604f3fb, 0xe0071241, 0xf87bb62e, 0x37f80a1c, 0xf9cf3d62, 0xd7ac3cb2,
+       0x061ff915, 0x25f39d9d, 0xbd2e7078, 0x55fc7a40, 0xcacc7fa8, 0xf3717cf3,
+       0xebb0d1bb, 0x1c7e90c4, 0x5e487f0e, 0xafd404fb, 0x7e16e01a, 0xb1e03f6a,
+       0x3f0226eb, 0x6d773bd5, 0x1d2a7ee4, 0xe5b9e81e, 0x4c1e2ebb, 0xbd789c82,
+       0x0e8064f0, 0x2ffcca77, 0x2a3d7bc7, 0xe37cb54d, 0xa47f3297, 0xa445f388,
+       0xbf515a75, 0x0f47ca54, 0x689fe769, 0xc8fe65cd, 0x5aeeeda4, 0x31525faf,
+       0xf8a7d7ca, 0xadaec2fb, 0xde749b9f, 0xab61a555, 0x23fb65d8, 0x3325e763,
+       0x79e7be5e, 0x2dced767, 0xec87bfbd, 0xfd4e1fc2, 0x3b036cc0, 0x3cbb06fa,
+       0x7f10b7a7, 0xe7e8bd01, 0x0bfb8d34, 0xef6a5fec, 0x524d3f05, 0x849d9c95,
+       0xc287a48f, 0xbef8ce58, 0x598ecfe3, 0x2eb6e7cd, 0x4844d567, 0x0567c83e,
+       0xe5185fb5, 0x5bf30bbb, 0xc2f39da8, 0x1c86ceea, 0x7bca2332, 0x3a57be37,
+       0x073193da, 0x45ef3f3a, 0xb9255abe, 0x7720cd2b, 0xd7bee339, 0xe51759f9,
+       0xbe7cc66d, 0x91b1fd6f, 0x520c6704, 0xad22cf5d, 0x9c7e5ba3, 0xfc05bdba,
+       0xc93081f8, 0x980aa38f, 0x0bf3e91f, 0xda15ffed, 0x33e23ef7, 0xe279d1af,
+       0x738fdc23, 0x7af2b18e, 0x3ca96abe, 0xa170e748, 0x6c84011c, 0x79ce1d8d,
+       0x6fe1146f, 0xbe1553bc, 0x3d45f46e, 0x1e7af5a5, 0x2bd099f8, 0xb0af54d2,
+       0xfb1dac57, 0x5bcefbf7, 0x8d47d6d5, 0xbba9f9d0, 0x37767097, 0x5bcf396f,
+       0x01f447c2, 0xdf2ac65e, 0x5b0ebe6f, 0xc3ac41d1, 0x9f1e6738, 0x539ce38b,
+       0xc304f98f, 0x43df187f, 0x1f3a19e7, 0xf27ef8e1, 0xe1158fd2, 0x7dff60b7,
+       0xdafb676e, 0xd3eb5b5e, 0xee7c25bf, 0x81ed925d, 0xf005e89d, 0x68cff05e,
+       0x7bb3cb3b, 0x7c1f84a3, 0x84d4ef65, 0x2f45ec00, 0xdf044f41, 0x79642de8,
+       0x77bfacb8, 0x7f53950e, 0x5f68c2fd, 0x2f345ec0, 0x069feb42, 0x7d15fb46,
+       0x52837db8, 0xda0e66fb, 0xbe6488af, 0xf9203473, 0x706c7378, 0x9bdf4a9e,
+       0xa814cf3f, 0xd6045477, 0xeddea2a4, 0xe5435fd2, 0x6fd43549, 0x122192f3,
+       0xf951ffce, 0xf3ce68dc, 0x32738df6, 0x4cfb671f, 0x5f6f54f3, 0x697aaff8,
+       0x51bcd5eb, 0x3d83f796, 0x9429e514, 0x9b63f4a7, 0xab573fac, 0x974691f7,
+       0x0f99cfb4, 0x5a44a6f8, 0xd2fde741, 0x99d2c24b, 0xc2fb7929, 0x5948f3ef,
+       0xe728db06, 0xc29f5c56, 0xcbd9a3f4, 0x5b7c6b66, 0x1c0d0fef, 0xcb2f2123,
+       0xb70b39bf, 0x679e8384, 0x41b78796, 0xbe5a3bee, 0xfb7a0a32, 0x0c1a9f4c,
+       0xa3395c83, 0xaf29dbd0, 0xaf5c62a5, 0xd74cb71c, 0xc0a582ff, 0x0eedcbeb,
+       0xf7cb3771, 0x3ea302c1, 0x556fafa5, 0xa37898cb, 0x27615cde, 0x2cf042fe,
+       0x9a6df6d1, 0x7d3bd7d3, 0xebe9f404, 0xf4fa8de3, 0xe40f65a7, 0xc6d2fef2,
+       0x8def5b3b, 0xb90e993f, 0xfaa7226d, 0x0f7a9d78, 0x57e74dd6, 0x25db97a0,
+       0xfb6b08bd, 0xdf298b47, 0x07887b30, 0xd389eaf6, 0x1d6f4c1c, 0x1f2ce12d,
+       0xf08ecc37, 0xb0d76ec2, 0x06ed8c2b, 0x83fb6b37, 0x1ba628f4, 0xee28beff,
+       0xf32ed2a7, 0x3065cf95, 0x0f60bcdd, 0xe515b93c, 0x7fb3872f, 0x8e5a32b6,
+       0x24bbf95b, 0x29bd2e8d, 0x5fb17aab, 0x32a5e98e, 0xe5c31dc2, 0x7a678fbf,
+       0x57dc367a, 0x7d127c00, 0xd2bc5db2, 0x258ccc1e, 0xe8d31ffc, 0xfb237a0f,
+       0x98a36af5, 0xf796856e, 0xf59e3cfd, 0x797f9238, 0x437ddf3c, 0x7bb3ef39,
+       0x3ec42efb, 0xf0c91e5a, 0xf2c9731c, 0xbcb19563, 0xb7dfe60f, 0xc5fc30f4,
+       0xbcec8ac7, 0x55ed8e5f, 0x73fade59, 0x9f841a9d, 0x9acfa75b, 0x86dfc725,
+       0xe1baa8f9, 0xd4dde4a3, 0x5595fccf, 0x7e6ed093, 0x7053edc5, 0xf69af6de,
+       0x4369fb29, 0x4afcf3f7, 0x97d47fb3, 0xf98c9dee, 0x760764d5, 0x1e7ea41c,
+       0x116a739c, 0xee9fd3d6, 0x3ef5869b, 0xe17d6f6f, 0xeb77044f, 0x5eb23f8a,
+       0x6fb47d74, 0xd85fbe26, 0x5fae1bf3, 0x16bff2bd, 0xb6afce41, 0xcfd17a4a,
+       0x7e8d1ae3, 0x1e6f8645, 0x7cae57ea, 0xc881f59d, 0x7f9223ec, 0xf8fdfede,
+       0x5bbde9ce, 0xdda8505e, 0xd5bd88d2, 0x5c81aa9c, 0x94676b9c, 0x0692b460,
+       0xed3d4a7c, 0x8d182bac, 0xa459f175, 0x5b74b89c, 0x4b181f88, 0x7fd9a091,
+       0x16d2dda8, 0xf242bf19, 0x19f41d82, 0x7d297f5a, 0xf3df7ae7, 0x9168857b,
+       0xdf7763df, 0xf75cb57b, 0xfc387060, 0xb09b19ae, 0xfd76e7ee, 0x77e8d326,
+       0x872f4d0d, 0xacffce57, 0xeace5fb6, 0xbdb665fb, 0xb9005ed3, 0x7d33fceb,
+       0xfe76744c, 0x3f9cc1c9, 0x112bb4ad, 0x577f974a, 0x72465a78, 0x65b78d7c,
+       0x07e7e424, 0xe34befb5, 0xaf82465b, 0x384e7ce9, 0xff59725a, 0x85c96acf,
+       0x47f3abbe, 0xc992d451, 0x992d03df, 0x4582ff68, 0x8ff853da, 0x3a78a8e0,
+       0xd2dde369, 0x0cb7e10f, 0x26e87e47, 0x1a71f5e4, 0xe91f25c2, 0xa58fbe69,
+       0xf9e63b4b, 0xbd9bf639, 0x7ad07f54, 0x707ca9bb, 0x9adf9cc0, 0x03e7ed2e,
+       0xfa6fe243, 0xc3fbeda9, 0x213c8e70, 0x3fd7f5ba, 0xd4f38da3, 0x3c719d53,
+       0x0acfa6aa, 0x6e1f4eb7, 0x80dbdf29, 0xf13a8fef, 0xf1126b7d, 0x6398a5e5,
+       0x9e5fcf2a, 0xfb494f67, 0xbe790bcd, 0xe7179c24, 0xff821781, 0x67ca5885,
+       0x7892be43, 0x3e3af3d5, 0xf2bfe743, 0xb04945a3, 0xae947edf, 0x7d3cf9db,
+       0xde3a9740, 0xefa46c1a, 0x2e3f4364, 0x8569382f, 0x2c49ecde, 0xdaec1ab3,
+       0xd81cf3eb, 0xe4378b57, 0xd6748c39, 0x10e0adb0, 0xece21c49, 0x2007ab36,
+       0xf7035837, 0xd86f7e42, 0x05f8b6a6, 0x54bc3b97, 0xc0f3acff, 0x68b7a8db,
+       0xe43e6c43, 0xe2fdbd6d, 0xcb1223f5, 0xdd0e700c, 0x9c875e66, 0xd87e7316,
+       0x04fe736e, 0xffde80ce, 0xa0bcbb7c, 0xc8705f39, 0x83e4ff9c, 0x9c81675b,
+       0xbdff55cb, 0x3f89f42a, 0xf384384d, 0x5e17d3f1, 0x2cfac68c, 0x41d94bfd,
+       0x71a149e8, 0x0a6eb422, 0x56ff08f4, 0xb2e3e985, 0xf81e9178, 0x810f1e81,
+       0x93a4619d, 0x683fe10a, 0xfebcb94d, 0xcb32d119, 0x5955744b, 0x64e0bcb7,
+       0x57bf5741, 0x43b3acb6, 0xb71d0bce, 0x9c2ffda7, 0x6aec375e, 0xd964a3c5,
+       0xc5637555, 0xd62df809, 0xf4013bbe, 0x854bfc57, 0xe7e28ae5, 0xbe0abd07,
+       0xce63b6df, 0x9ace9c0d, 0xedd0f8c8, 0x2af78b7d, 0xbbca28c1, 0x5dba4946,
+       0x7d615eb8, 0x1cd1a4bd, 0x36b65747, 0xd9a6de24, 0xf778be5c, 0x9f86fffe,
+       0x18f1dcbe, 0x1e5c33c7, 0x05781827, 0xa7c55b7a, 0x153ded82, 0x330dbf9b,
+       0x2d79cb97, 0xbfe1e7d4, 0xaee1e396, 0xcf3a5592, 0xd0c893b7, 0x574bf0f9,
+       0xe1066a51, 0x8de6aafd, 0xbd9b94aa, 0x7597ecc5, 0xb0ce39da, 0x918221ca,
+       0x28a1cf04, 0xdf45d7bb, 0x628fae2f, 0x18516179, 0x9cf99fc9, 0x438e708a,
+       0xdda0c4f4, 0x965477a9, 0x25e2aa83, 0x571eaa1e, 0x56c5b002, 0xfc8a48c1,
+       0x04bf3213, 0xd25526de, 0x3f00d78f, 0x1798cdd6, 0xab6f524d, 0x03f706b4,
+       0xc0e79d2f, 0x4abd7336, 0x38d1e79a, 0xefe659c8, 0xeb9da2d5, 0x36feecd7,
+       0x60ddf8cc, 0x527d65df, 0xc8556bd7, 0x7aa70433, 0xb3cb0447, 0x402398c4,
+       0xef14ab57, 0x29150ec3, 0xefa0e39d, 0x2f964e25, 0xe7946ee6, 0x838c3347,
+       0x0dd78390, 0xae67b966, 0xbe04cde2, 0xd670bac4, 0x1fdca9a7, 0x64e58bde,
+       0x4e484396, 0x7daa3966, 0x12e39d8e, 0x825af39b, 0x1f9ac790, 0x0ad0f148,
+       0xf3e47f32, 0x96709ee8, 0x4aa79a7b, 0x5d79a7b9, 0x31ff6e1f, 0x390beb40,
+       0xf9b9e25a, 0xb71e1c9e, 0x89db2a9f, 0x200f523e, 0x7a133ab9, 0x41e5c102,
+       0x67472eb9, 0xb04afac5, 0x9bfcfaee, 0xe0a3db63, 0xf1e512c7, 0xd86e4bdf,
+       0xed879da2, 0xf003c2eb, 0x8a549c53, 0xf60c5a0e, 0xe4325ba9, 0xac7231f9,
+       0x8f56ab77, 0x966519fd, 0x80ff77a9, 0xd07b29e0, 0xe9486ee2, 0xf5e1075a,
+       0x27fe6266, 0x83e785d7, 0x958e46ee, 0x7963a7f6, 0x0e479f92, 0x73bf1c17,
+       0xedefd6bb, 0x9a531619, 0x48f44118, 0x942c9cfd, 0xe1a8edf6, 0xa4076c45,
+       0xbbb9ba35, 0x19359038, 0xb32a9cf2, 0x9afefd17, 0xa4e9e06e, 0xde52f18b,
+       0xd94cb93d, 0x72f2e124, 0x5fc8dfbc, 0xf0fdb385, 0xe8de76a4, 0x347441eb,
+       0x8d71cf82, 0xe8d3ad9f, 0x74cf5d66, 0xb98ba263, 0x3741b790, 0xd8b9e473,
+       0xfada5749, 0x7af0dd12, 0x485d13b7, 0x6be211ba, 0x4b742fb4, 0xdf443b79,
+       0x7bb7d4ea, 0x0e88b7d0, 0x6de8c89e, 0x074217a8, 0xf1181ac2, 0x252cfc8f,
+       0x2a4762a3, 0x564904b4, 0x2cdc47e1, 0xd7c646ce, 0x4ac0d65d, 0x55bfa782,
+       0xab00cbae, 0x653a3ba4, 0x5cf911fc, 0xd9f88bdf, 0x0b17fbe2, 0x4e2fd52f,
+       0x4ab76c12, 0x2626f927, 0xa409db8e, 0xb0aa0770, 0xf68a50e7, 0xffb231c5,
+       0xc46fa262, 0x5e7f51b3, 0xdcc69c4b, 0x2a7fc246, 0xfb407e58, 0xef6e7ce8,
+       0x5ef6c8b7, 0xd303a52b, 0x5f6a3ee4, 0x2bf8c615, 0x264073be, 0x58d264e8,
+       0x66249d33, 0x4f41394a, 0xbadd331b, 0x7e0890dc, 0x9838d250, 0xf08699cf,
+       0xd85daaa2, 0x7d48cfa7, 0x4df578a3, 0xbe004793, 0xd83de367, 0xeca7a7c2,
+       0x494aff60, 0x7f1f9ce3, 0x5b653d08, 0x98df7f38, 0x780f7be9, 0x17b8ad3f,
+       0x250fa2ec, 0x27b15f33, 0xcb5f7b52, 0xa3bf73d4, 0xc77f8a74, 0xa62390db,
+       0xfeb950cc, 0xb9ed2114, 0x338e51a2, 0x35b9ffd9, 0x3c9bfa91, 0x94f0e15a,
+       0xf25770b6, 0xb455f832, 0xd1a63df5, 0x98b84377, 0x70139cfd, 0xcd4cc80d,
+       0x24821f86, 0xe4e46ed4, 0xfd5a9901, 0xc806ca31, 0xc9c70343, 0x47d7a7fd,
+       0x2d37e83f, 0xcfb7ee53, 0xe7a77db4, 0xbf5caf09, 0x5b584d6c, 0x5b52345a,
+       0xf3a51070, 0x039ec6b2, 0x2a94999f, 0xde07ac26, 0x4d8aaa7f, 0x317b6f0c,
+       0x4ca885f3, 0x8f82f837, 0xfba65914, 0xee99836d, 0xb7b4c6db, 0xb6f949dd,
+       0x7ed2392d, 0x0bf3e9a7, 0x82e5825d, 0xef9231b6, 0x64896fb5, 0xd5cc73fe,
+       0xed27151a, 0x97dfac5d, 0xd7f1246a, 0xe17b86ba, 0xda752e37, 0x2c7e70db,
+       0xfb3a607c, 0x499b4bfb, 0xfd5c47bf, 0x4f7eb35a, 0x6658787a, 0xa87afa37,
+       0x019a0e5e, 0x55ad951d, 0x36070e98, 0x997dec78, 0xcc2e29cf, 0x4c19ccaf,
+       0xf32fff07, 0xf05c7384, 0x37fb7a65, 0xb091f784, 0xba0e0b1f, 0xd7c83a1a,
+       0x3716e30b, 0x1a7eb315, 0xfe63ed99, 0xbc255035, 0xd4cf1d10, 0xec126fe8,
+       0xd64be0a0, 0x97d8bed6, 0xdf6865af, 0x4e995ce3, 0xbe70eba6, 0x7366d06f,
+       0xb6be0265, 0x9c16e155, 0x4a5693b7, 0xe77da6fa, 0xbb80bdc0, 0xfc0222ac,
+       0x7ed6b8e0, 0xd16b0afe, 0x77f7ca46, 0x1c546b08, 0xe98f2be8, 0xfbe5903b,
+       0xe9f7eb0c, 0xc828c42f, 0xd76ba50d, 0xfa34b849, 0xe323d610, 0x4f9c69e3,
+       0xc3e4a4b7, 0x53d3a0ae, 0x766c6b20, 0x5d0308e6, 0x1e9850cc, 0x60873e68,
+       0x55979d9f, 0xfa728f92, 0x32f41fbe, 0x1d306c69, 0x6a85d871, 0x76abc725,
+       0xe20f0a24, 0x3b443a87, 0x241d23cb, 0xea3f808f, 0x27e7467c, 0x475e1744,
+       0xeb7ad742, 0x3d6b657c, 0xde784681, 0xf4e0ef56, 0xb0977aa9, 0x5ed84f12,
+       0x67f9c89f, 0xb69cddeb, 0xf7f167d4, 0x9c3deae7, 0x8a3f59df, 0x7bd42ff3,
+       0x7ebbbf39, 0xabbfa722, 0x84efe22f, 0x3a4be61f, 0x93f9d1df, 0x9f3a5f4e,
+       0x05aba50a, 0x33dc6684, 0x0fccf6a0, 0x79883e75, 0xf8bbf258, 0xa9cebe93,
+       0x113f914a, 0xceb450fc, 0x5428ff01, 0x22f33ecf, 0xdca3b9e1, 0x1da1f1c9,
+       0x0ec1f242, 0x8dcf83a7, 0x0dd8bb64, 0x32c340fb, 0x869ddb6f, 0xb95e7873,
+       0xba06ac22, 0x5c36a9bd, 0x7d740d58, 0x29ac5d73, 0xfdeebf3f, 0xff50fad7,
+       0x2df18b3f, 0xbb1cfac2, 0x7fa3d4e3, 0xdf8fefa4, 0xeb033a71, 0x796c704e,
+       0x1edee308, 0x2ad1c1a1, 0xceddbae1, 0x08c0d2f2, 0xcfe14fa9, 0x2d738861,
+       0xfb7d894e, 0x31e70437, 0xda061d6d, 0xc146b35d, 0x754ab32e, 0x1f2aa4ad,
+       0xfbe8bd63, 0x2af5b59f, 0x7c630ba9, 0xfb6a3496, 0x4cff18d4, 0x57de3cf8,
+       0x78a75cb0, 0xe91f8085, 0x41ec2ff8, 0x71c41192, 0x685011c5, 0xad94851c,
+       0xae17b0f9, 0xe428fd79, 0x10eea574, 0x873ed5cb, 0x8428e393, 0xd8d676df,
+       0x9077529f, 0xfed689eb, 0xc8c838a6, 0xf83b5ee1, 0xeb1b6805, 0x40759256,
+       0x268b9f60, 0x94f1ef85, 0xd6cbdf69, 0xe2f8a628, 0xe655337b, 0xac32878b,
+       0x14ca0e9c, 0x89a5139a, 0x5e9d29cf, 0x3c707f89, 0x9e535963, 0x2f81917d,
+       0x4bdf6897, 0x78a62cb3, 0x321943c7, 0x98106a2e, 0x6777a505, 0x3217daa5,
+       0xdc7373df, 0x24bf5ebd, 0xea757f2b, 0xe883f470, 0x8ff6aea0, 0xddb95a64,
+       0x84970ca1, 0x59e741c7, 0x74e9c714, 0x72e82e7b, 0xeff8a7cc, 0xeb3f0c95,
+       0x3ecf1559, 0x7bfc2cfd, 0xe30a7f15, 0x9862a9f3, 0x0ec8df66, 0xf2ce9c8c,
+       0x8ca9d78f, 0xd72dfc84, 0x7fd3fc7f, 0x547c4689, 0x57694ecd, 0x690db4a5,
+       0x6ce5edf5, 0xd0f6ab57, 0x9f0388fe, 0x5fcdfb35, 0xd14ff67d, 0xf897acad,
+       0x5bf8b493, 0xdeaaf78e, 0xc0e38279, 0xd0afb8f4, 0x37ca3576, 0x71eaa7ac,
+       0xb63fba01, 0xf78d9f70, 0x851ecd4d, 0x5d9a98f5, 0xe7c01317, 0x4aadf66a,
+       0x272e2ee8, 0x5e3d5fb4, 0xd5bfb740, 0xc39fb588, 0xc384487f, 0xffad0ff8,
+       0xaf546676, 0x62054353, 0x3b60aed5, 0x1c705588, 0x8e2d72c7, 0xc19023b3,
+       0xe49ee17e, 0xc4f59aed, 0xedbf49f0, 0x1063bab0, 0x88417caf, 0x53addd89,
+       0x7e7920fc, 0x047da39f, 0xed85f0bf, 0x1791cb2a, 0x7ef147b6, 0xff7edea8,
+       0x55dbc441, 0x8dd8566f, 0x308e2557, 0xaa77aade, 0x0fe061c2, 0xc50bb035,
+       0xd2e70cf7, 0x416aa3a7, 0x145a4b5f, 0xadf816ef, 0xde98ee1d, 0x35da7806,
+       0xd61a5afa, 0x45d79232, 0xf814ff83, 0x5cce419a, 0x8e7ef7b2, 0xe77aa413,
+       0x6df9ae59, 0x51b3c724, 0xce036f0f, 0xd80a1b33, 0x65a4bd4f, 0x05cb3547,
+       0x105d23db, 0xccdb4e69, 0xd1be29f7, 0x9346fbc6, 0x4fc0ced3, 0xaacff682,
+       0x4e030f2c, 0x5ad3cbec, 0xcedeab3c, 0xb3b64832, 0x0dfb7868, 0xae88e7f6,
+       0xda5a4bfa, 0xfea9d3a2, 0xe7dfbb27, 0xee4839d4, 0x23ce25e3, 0x3f4738b9,
+       0xf7c919d9, 0xf9d93eed, 0xd12f09eb, 0xc65ae778, 0xfb0c52f4, 0x1b20e06c,
+       0x41b73fd7, 0x25f301c6, 0x5a0fd611, 0xb6673e78, 0x27ac2927, 0x9f84df03,
+       0x8f9f3b33, 0xf63ef0b6, 0xab717bff, 0xc86b15b3, 0xb2eb847d, 0x5bfe8047,
+       0xed11fbb5, 0x7fe5fd9a, 0xed6affa7, 0xa4529b7b, 0x3bef238d, 0xc20e3d08,
+       0xd53beda5, 0x796efbc9, 0x2fef9d94, 0xbee6182c, 0xe8f81e71, 0x518e329b,
+       0x043f77f4, 0x3bc16ffd, 0x596f6cf1, 0x41f7736e, 0x36c38bfe, 0x282c13f6,
+       0xa1f51cf0, 0xed9d8c7e, 0x75b1224a, 0x6dadec04, 0xa8be5229, 0x933b435c,
+       0xe88fdc50, 0xacf84fcd, 0x8f84580c, 0xa50793f2, 0x523ebaf2, 0xd9daf16e,
+       0xfbe413ff, 0xc2ecc792, 0xfe2f7b8f, 0x5d7ea4e7, 0x0efd2a99, 0x517f608f,
+       0xcc17195a, 0x4edd878c, 0x69ca9ba3, 0x9fa06e54, 0x4cc14dca, 0xed674fc8,
+       0x72891ed2, 0xf9954de8, 0x46835eb2, 0xfd07e8a7, 0xceb8a5b6, 0x2bbbbcb3,
+       0xb0ef404a, 0xed2518bc, 0xdf09bf21, 0xaf386614, 0xe9241a6f, 0x07f341b8,
+       0xf848b7fa, 0xf8e41700, 0x4ca6f625, 0xb8fab9c8, 0x789ba24b, 0x78dab3bc,
+       0xa49a224b, 0xc78b44ff, 0xdf1e7d43, 0xd3bfd826, 0xcb1864fe, 0x1efba7cb,
+       0x9fe30179, 0xc730727e, 0x04a5b411, 0xf2e6ed16, 0xaee38e70, 0x082c2a78,
+       0x327b3f78, 0x9f58ed8a, 0xf61ca4d9, 0xcb025459, 0x1ea28761, 0x3afe805c,
+       0xe0298736, 0xc2299fa3, 0x2df2889e, 0xa80e59bd, 0x3f63afa8, 0x17b10549,
+       0x4e94afc8, 0xd9f7dc84, 0x276cc196, 0x950decfa, 0xf7d0292f, 0x13eef835,
+       0xc67e0b4d, 0x3ff4bff2, 0x6fea7e9e, 0xaff3bb83, 0xdb366c54, 0xd7f5f4c3,
+       0x2418efcb, 0x0c7703ed, 0xcac97a92, 0x7fe92e41, 0x30796c8b, 0xf929e795,
+       0xeb03ad03, 0x131fb47f, 0xd63f6f60, 0x714127b2, 0xccc1cf02, 0xdbef035f,
+       0x7a759ea4, 0x42fd8dbb, 0x79462f15, 0xe774fed9, 0xb0ef7c15, 0x78729542,
+       0xdbde4585, 0x99eed0ab, 0xb2674456, 0xcdf08b7d, 0x16fb6d7a, 0x8e471b55,
+       0x01d6d9fb, 0xd4109fd2, 0xf0e42ff2, 0x7149b83d, 0x2c69e6e2, 0x05c86d5f,
+       0x8e6e2f5e, 0x1a79f8e4, 0x87b88bc7, 0x5cfd9f8a, 0x116633e2, 0xae7407eb,
+       0xd4ae7f31, 0x9dd573f8, 0x5ee0c757, 0xe5477881, 0xad1712fb, 0xbfe03e9e,
+       0x4f7af8a1, 0x5f4b63e3, 0x41f99478, 0xc417ed25, 0xfcd52d59, 0x529f4bcb,
+       0xba5c9e58, 0x9887eafa, 0x136dbeef, 0xb6705fb8, 0xe368fee5, 0xf8d5ec7a,
+       0x0f7b5767, 0xf54a5fd7, 0xa337fb65, 0x36ad9e19, 0x5d09e00f, 0xfeddefc7,
+       0x6a5ff529, 0xf242d15f, 0xf3e5ee45, 0xdc8e28bf, 0x95f027f6, 0x676ce1ed,
+       0x7be7f5a3, 0x2d6c6746, 0x33ff308b, 0xbf3384cf, 0xf72b1339, 0x9e7427fd,
+       0xe780edfa, 0x5db1f787, 0x02e9bded, 0x80e2d0e7, 0xae1d5fb9, 0xafdf1afd,
+       0xc0c4f78a, 0xeb45534f, 0x7d68fe81, 0xdfedc47e, 0xd0fb71b1, 0x768e3cf9,
+       0xf4fb0c23, 0x9ba64899, 0xbae4fd33, 0x1076799c, 0xb16d679f, 0xde09de92,
+       0x674be864, 0x1b8a6562, 0x0a87a03e, 0x3387a497, 0x1ed85a63, 0xc1d94670,
+       0xb64d9b69, 0xfcd3a8ab, 0x897f44da, 0x26d01fa0, 0xb58ea9ec, 0x80c72047,
+       0xe7cc8fcf, 0xcefb8834, 0xd07376a1, 0xbebfce29, 0x84dcf259, 0xcf3e0578,
+       0xe3f61b7e, 0x733df0b4, 0x564f269f, 0x4fdcbf6e, 0xdcaa7588, 0xeb3fb0ae,
+       0x02fe7692, 0xddba5eea, 0xa972e89f, 0x6e22f15f, 0xb2e3696b, 0xa5fba025,
+       0x81e6ebb5, 0x2c79f5ee, 0xb75feed5, 0xd3c32a29, 0x27fb4e16, 0x74f1f2fb,
+       0x8a59aafc, 0x5c279f1e, 0x7b45f9fa, 0x2dcb2c38, 0x4db288e9, 0xa3655fd4,
+       0x49c796b2, 0x395bf5d1, 0xb84f1d3f, 0x5efb02cd, 0xb9df769b, 0x70ebf9a7,
+       0x524f04f6, 0x6d4fe496, 0x6f9ef229, 0xbef25bfb, 0x0a6fc5f6, 0x81fee262,
+       0xfa91c83c, 0x7f047f7a, 0x72106816, 0x96e7c68f, 0x704eaec2, 0xfb306e66,
+       0x9b36b273, 0x9bb643f3, 0xcd3bd9f3, 0xe6bddcf9, 0x7355e7bc, 0x7b7185de,
+       0xfa09e177, 0xa103e236, 0xbe85236f, 0xfa94ceed, 0xb7d0f236, 0xc6df4291,
+       0xc8dbe877, 0x1e46df43, 0xd0f236fa, 0xdf4291b7, 0x1a39f7c6, 0x7b352a9e,
+       0xe381d629, 0xeb84f6d4, 0x5fbc00f1, 0x6049cc2e, 0x52ac2a3e, 0x24b0bd1f,
+       0x4ec7e59b, 0x0754d33b, 0x38f499db, 0x7ca2b7a7, 0xc37ab2e3, 0x75647b7f,
+       0xc76e14df, 0xdf9ae7f6, 0x6573fb49, 0xf613b87e, 0x9f55d68e, 0x13d886ac,
+       0x444df288, 0xf6b60bfd, 0x556fc0ad, 0x6fec2bdd, 0x7ee15d6f, 0xfd7207e7,
+       0xc7a2eed8, 0xdce3152d, 0x7d26df03, 0x7b6fc649, 0x6a3b461c, 0xac485fa8,
+       0x3f21e435, 0xa1f39b35, 0x35f0207e, 0x355f69af, 0x6e3c1d31, 0xbe0bef6b,
+       0x0749e27f, 0xa13af3df, 0x6cc4edd9, 0xba63cb17, 0x8f29df3c, 0xc26ca3dd,
+       0x2b24bdf9, 0x1c77db8e, 0xd3dd30ca, 0x2f4b4d0b, 0xdabcb3e5, 0x58ab5f99,
+       0x8cd94e30, 0xaf59fb15, 0x73e68c4e, 0xb60d16e9, 0x0dff9041, 0x440e0f70,
+       0xe868e898, 0xbf10b8b6, 0xfd533f65, 0x4353bb61, 0x4c4396fc, 0x16d7d3e5,
+       0x17b5ef98, 0x1f2a6d5d, 0x878cef68, 0x96ff4873, 0xd64b9f06, 0xe7cce8b9,
+       0x4bd686f9, 0x847f3c56, 0x25bc56bf, 0x9a32d3e5, 0x7b40b787, 0xfe1f239f,
+       0xe014ef39, 0x16c5bcaf, 0x54bef38b, 0x9d44873b, 0xb72e5cf9, 0xae2bbf0a,
+       0x5dcaee8b, 0xed4b1bc2, 0x2536b4bf, 0x71dd1d33, 0x14255934, 0x2472192d,
+       0xe57d0837, 0x8246278d, 0x8dd4aaae, 0xbf2a2ec9, 0xc56c0955, 0x71d3ec45,
+       0xa4ae123b, 0xf8b4fff2, 0x75a2c91e, 0xef05b64a, 0xba3e0f9d, 0xbde04d23,
+       0x9f6b1391, 0x3cb8e68f, 0x6d92fe8d, 0xc1d008ae, 0xf59526c6, 0xd4cdd814,
+       0xd93a2eb8, 0x011f14d8, 0x8c7ca6bd, 0x717297e2, 0x0bdf49b4, 0x9aa147c5,
+       0xe69b8efd, 0x2a90f17b, 0xf36a40ef, 0xf592ee5c, 0xaf6cba45, 0xe7d7b3df,
+       0x47d3527b, 0x96be362b, 0x3f7d0b79, 0x2e7f783b, 0xd65784ae, 0x2f79e6ef,
+       0xdadf6cb5, 0x1d7bd297, 0xd7985dbe, 0x45c6b7f2, 0x7ce3495f, 0x87c65db9,
+       0x89f9b5ff, 0x4fc4fcc7, 0xc27a6cef, 0x8541fb0e, 0x1e876035, 0x46e4fe5c,
+       0xae18e23b, 0xbf91b6db, 0xcc56da2f, 0xbefd00f6, 0x7c7aa7da, 0xf28f86b3,
+       0x1706cab1, 0x60ffb3cd, 0x23ca4fc9, 0xa14b1c64, 0xdc35fa3a, 0x4db8b813,
+       0x66bcc3c9, 0xe3b0ed14, 0x1a3bff1e, 0x37dd09df, 0x17a7871d, 0xabbd86f6,
+       0xdf20f145, 0x89993ed3, 0x0f4472cb, 0x39b92fd3, 0x0869719d, 0x0a1fd5eb,
+       0x8e70bed2, 0xd7e88764, 0xcf695587, 0xad123c43, 0xd83db973, 0x85e43a6b,
+       0x0ffbe597, 0x8d0e7455, 0x2ede87ca, 0x169455c4, 0x744d568d, 0xd23e335e,
+       0x0b660fb4, 0xfea2bec3, 0xa67e8966, 0x69498cfc, 0xce37faa6, 0x67e21a18,
+       0x672aefce, 0xe99575fe, 0xdbaa975d, 0xe3856efd, 0xbf9ac67b, 0xd33b7a53,
+       0xf6a60dd9, 0xe99a6255, 0x9b25975d, 0x133c65df, 0x8fa1d995, 0x41f76b95,
+       0xb4dafb66, 0x9dfcadef, 0xafda6226, 0x7f3cd303, 0x8da5e794, 0x1dba08fd,
+       0x9ffe367d, 0x1979ddd6, 0x898f19d1, 0x3bd85bf8, 0xe479667c, 0x42a9eb08,
+       0x669543ae, 0x92caaa8f, 0xff2aa8f6, 0x9be23b11, 0x24d6ff09, 0x93754942,
+       0xaa46f6c2, 0x938a48ef, 0x7df1dbf9, 0x075ef9a7, 0xf284bbfa, 0xf6316a43,
+       0x35796857, 0x42e71bcd, 0xb047ec35, 0x6bfde983, 0x19f4eafd, 0xb43ecf7a,
+       0x3760df1f, 0x6d8ae7ef, 0x23f60e3b, 0x8a2f4cbc, 0x497c43cd, 0x5b54cb65,
+       0x74e5f671, 0x8bfdf3a6, 0x7fb616e5, 0x857e1c75, 0xdca3ace9, 0xddf191ea,
+       0xd51f18ff, 0x0d6f695e, 0x3445bfa5, 0x1799f81f, 0x013c54ed, 0x5e03d645,
+       0x432e81fa, 0x0dd492f0, 0x753c74be, 0x7ca42de2, 0x1c33fe31, 0x004a11f1,
+       0xbc32f27c, 0xfad478e8, 0x2c13e45f, 0x013c1267, 0x3fa42786, 0xff742a31,
+       0x20efc2dd, 0x84506c74, 0x3c6ef94b, 0xed24bb4c, 0xe4d30336, 0x2977dbbc,
+       0xb3ebc81e, 0x7bf9592e, 0xc914bd27, 0x9319f538, 0x93b3fbcc, 0x7ee48a7e,
+       0x81297999, 0xd36ffddb, 0x8fd177d1, 0x8d099fee, 0x5defd6ff, 0xddac1a2d,
+       0x46211a4b, 0xc44ffb7c, 0x4072ebaf, 0xe749e74f, 0xf0d2e379, 0xf6ed4cef,
+       0x951e5e1c, 0x3edaf1ca, 0xf3a88ecd, 0x4ed69f63, 0xca98b71f, 0xefa005dd,
+       0x17b009fe, 0x4b4c6eaf, 0xe317be36, 0x3b63655b, 0x788af26f, 0x5dc38b4e,
+       0x8a473809, 0x4d77c857, 0x27d5df8e, 0xe388fe01, 0x26bd6cab, 0x7fc7d751,
+       0xe4593c3a, 0xe9c85f20, 0xb3617589, 0x3d78768d, 0xed2c1a6d, 0x7e39fa35,
+       0x7a3872ce, 0xaadff636, 0x0508d15d, 0xfdeaba5a, 0xcf3a2e91, 0x8f7c5957,
+       0xef7f660f, 0x85cf3e46, 0xec2e636b, 0x513cba70, 0x0fb0aab1, 0xffcafdce,
+       0x9c31e579, 0xb615befb, 0x9fa3c804, 0x840aa07d, 0xc679d0ce, 0xe1a7c472,
+       0xdd3fae92, 0x10f7c912, 0x1784553f, 0xea25a6fe, 0xe9975cfe, 0x0b3bdd5c,
+       0x41deffe3, 0xb8c08ee3, 0x1889ad81, 0xc4cfe3d7, 0x1915beb8, 0x57d9dd31,
+       0xbd66b4f4, 0xeab6f394, 0xeecd64f6, 0x791ef90c, 0x6270f7c8, 0x1e47be41,
+       0xc8523df2, 0x4dbef8f7, 0x6c0c2ff3, 0x7e83cf68, 0xb22b1fea, 0x75bcf96a,
+       0xbf7e4166, 0x80f08945, 0x78a2dcff, 0xc1bc70fa, 0xc4def966, 0xd57590f2,
+       0x49da6bd3, 0xedd03306, 0x84392e0f, 0x8c6e6e31, 0xc7e53588, 0xea9afa39,
+       0x4c52ba17, 0x0e25d7e5, 0xef5f9536, 0x7fe533ce, 0xa9a57598, 0x18cf64fe,
+       0xa347fe53, 0x9fd537ae, 0xca6a9dea, 0xc7389f4f, 0x51667f54, 0xc6fca9b1,
+       0xe54c4bd9, 0x4ccb7c73, 0x3fe579f9, 0xa9bfd535, 0xdca98576, 0x9c565c2b,
+       0x77a17b77, 0x865fde11, 0x2de945de, 0x8d38656f, 0x9c7a3aeb, 0x7977dba5,
+       0x5072694e, 0x36dea1bf, 0xd7ee25d0, 0x68070e80, 0xc0be67f7, 0x7e1bd2b9,
+       0xf522a0c9, 0x417d23de, 0x42f5a137, 0x1e4747cb, 0x35a6e8b8, 0x7a2a7a2c,
+       0xc4f895a6, 0x140e2be8, 0xf57e51a4, 0xad338553, 0x5f465fc4, 0x54f9e07d,
+       0xb53d37ca, 0x3b0f964a, 0x51e51170, 0xf320df4f, 0x1a8b05d3, 0x7af90c8f,
+       0x31e69f86, 0x6ba907fa, 0xd26ed23d, 0xa769bc6d, 0x80f0883d, 0x01e04d78,
+       0x13e89069, 0x4fa201e9, 0x7d12afa4, 0x710ba596, 0xe913e890, 0xf13fd221,
+       0x7fa4f7fd, 0xfa4c3d22, 0x49b7d227, 0x847a44ff, 0xefa44ff4, 0xf4e6cfd5,
+       0xb71f7a83, 0x397d43fb, 0x6beb47a7, 0xf5c7fbf9, 0xb9fe9c75, 0x5ddfcfde,
+       0x433b7443, 0xba31ed90, 0x7e1aabff, 0x76edd847, 0xfd1acedb, 0x9e578ac2,
+       0xb2bfbaa7, 0x46b456a1, 0x5ab69f62, 0xba394f63, 0xf33d90fc, 0x6538ab5b,
+       0x0f5ebf90, 0xe10d26f7, 0x98bbfbf1, 0x8fdf6b6f, 0xf203e989, 0x520a9d69,
+       0x9f28297d, 0x2aba5f99, 0x0fc7f886, 0x81b5a9be, 0x74b43e5e, 0x0bfb7f7f,
+       0x87da4e8d, 0x8c873378, 0xebbbf2e8, 0xf8ceef7e, 0x1e5f831a, 0x8e3d6cfe,
+       0xf3c7f747, 0x473e219f, 0xf1eb93f7, 0xef6ad741, 0x707ee923, 0xef47fe3d,
+       0x6092f0b7, 0x1acd77be, 0x512dcb2b, 0x38c41156, 0x35cf9c7a, 0xc43c968e,
+       0xe9535c3b, 0x3eb738e4, 0x23ef1df4, 0xde2f3d52, 0x25fcdb99, 0xf2edcfd5,
+       0xe6d1f7bb, 0x8f3ce541, 0xb63e4bc2, 0xc5a35ed7, 0x43bda01d, 0x753bf396,
+       0xfc831188, 0xe1db2941, 0x7da8551e, 0x001c577e, 0xfaca47ea, 0xfe97f441,
+       0xdd178d15, 0xc4068fb5, 0x6e21e4b5, 0x93b5406c, 0x8c36c6e3, 0xb9bdf209,
+       0xded7b1e9, 0x4e22aad3, 0xd8c7e638, 0xfaa74f47, 0xefcf0266, 0xf00f73ee,
+       0x5c5a7e50, 0x53a46f5a, 0xebb5de43, 0x62e67d66, 0xe97c755d, 0x4bd7d778,
+       0x9e21b7c7, 0x5dfcf18a, 0x6eba17eb, 0xafa5eba1, 0x2ea5e153, 0x977f03fc,
+       0xfad74faf, 0xfffb3ec1, 0xb70cfacb, 0xcc7df0b6, 0x07874ab0, 0x7ad77d70,
+       0x262edcdd, 0xf1783ee0, 0xa441f725, 0x5f7cd24b, 0x8a967f80, 0xc05c1331,
+       0x81cd4b91, 0xdeb4279d, 0xef59eff2, 0x077a90e1, 0x7cd60ae2, 0xbd79769d,
+       0x1af521dd, 0x7ed60b62, 0x374ced2d, 0xe43d7ce2, 0xed1fb1b6, 0x1e3d70cd,
+       0xa3ccebc3, 0xf1a71c75, 0x96a243a3, 0xd7120fcf, 0xf1df58fc, 0xcb8f52da,
+       0xee72cc5e, 0x6e59a778, 0x514df09c, 0xd09dc623, 0xd68e442b, 0x6837e1fc,
+       0x9a275efd, 0x7bd0dfb8, 0xf26837f2, 0xf93de869, 0xf26886e7, 0x01488a65,
+       0x3c2f1a9f, 0xbded2e12, 0xd92ef183, 0x2f46926f, 0x8c556e69, 0x9f083d06,
+       0x55f1cc15, 0x8b9077bc, 0xbf9cfd71, 0xfd38045e, 0x3f7208a1, 0x22918993,
+       0x6c2123ff, 0x79039df2, 0xf55ab33f, 0x2ce427fd, 0xc2e65efd, 0xd8abdf70,
+       0x4e44af77, 0x28f78f99, 0x4b8c15c6, 0xe303bb47, 0x1c9f2cdd, 0xbcb1a470,
+       0x8b657d84, 0x6f7fdaeb, 0x6e92f9d0, 0x9106f795, 0x3a60dee2, 0xe9d7966d,
+       0x86fe41fc, 0xed0215ac, 0x71cdb826, 0x1ffb7a38, 0x6b0ac6ba, 0xfdfccf41,
+       0xfa7bb987, 0x66f3aec3, 0xb0f1a0ec, 0x7b19bf83, 0xf7cc78c5, 0x163ed8cd,
+       0x39d98699, 0xbd3179cd, 0xa74e793b, 0x26f1aee7, 0xcf7c6b08, 0x1af1d678,
+       0xcf1d4f8a, 0x2f5e02ff, 0x2fd78774, 0x37290b06, 0xa23e4a47, 0xac2ab7e3,
+       0x1f671ef3, 0xa5445c63, 0x33e9e243, 0xb87b8c80, 0x3cf15775, 0xfd17a93e,
+       0x7545ef81, 0xd43cb8a3, 0xc736250e, 0xc77f5e70, 0xef83ccec, 0x7c122746,
+       0xea7c39d7, 0xd9cbc250, 0x492660fc, 0x0d93e230, 0xfaef7c0d, 0x07aab3dc,
+       0xeaa57ff2, 0x4f01eb5e, 0x3f655379, 0x95e6f8a0, 0xc509f864, 0xa3e3eee6,
+       0xaf121d2b, 0x32b3feba, 0xa7f788ad, 0xca241570, 0x3de4d5f7, 0xe81e5d72,
+       0x8be3261f, 0x3dccfbf5, 0x232307c9, 0x1feb1f24, 0xbeaef926, 0xf38ed49e,
+       0x48cfd449, 0xf74953e2, 0xb03eb045, 0x1a4de5db, 0x78ca7f0a, 0x75a79261,
+       0x97a3bfbd, 0x5af03f7c, 0x68d0f991, 0x643f8fca, 0xef2a0113, 0xf14c2f18,
+       0x946f8564, 0xfa16bbf2, 0x44b098fd, 0xfc0cafd2, 0x611ddc20, 0x32346f7a,
+       0x8f94ce2b, 0xd533f4f2, 0x6a95198f, 0x0ef58f2a, 0x4fc79531, 0x7be537cc,
+       0xaa655d17, 0x58f667df, 0xefafbe53, 0xa4fd5306, 0xbca669f2, 0xe49297ce,
+       0x76a03127, 0xc0fda9ae, 0xfd5312ba, 0xf9857f14, 0xf7bf54fd, 0x9e025648,
+       0x697f9477, 0xbc87966b, 0x96116aaf, 0x90ef5d91, 0xde5a3afc, 0x5ce89907,
+       0x6491efc4, 0x0cccfd34, 0x8a8dfa8f, 0x46292673, 0xae24f7e1, 0x60f99b73,
+       0x3f39a261, 0x2af795de, 0x2b9c6e96, 0xa828fe34, 0x6a929e80, 0xf3efa6ad,
+       0x347c6a86, 0x9eb2e457, 0xefeb5dfe, 0xff5a621b, 0x4e5d7c50, 0x05e7cf0f,
+       0x6f9ed2dd, 0xf9ec179c, 0x9ec0bc46, 0x9ec3cc6f, 0x7b0fac6f, 0xf61cb1be,
+       0xc179637c, 0x8c1d3321, 0x83a66238, 0xe99a8e2b, 0xd0cfa740, 0xd5b2baf5,
+       0xa7c21f4c, 0xb07f94f8, 0x6a7f575e, 0xf5d09fa6, 0xd78b0921, 0x1153826f,
+       0xfbfca48f, 0x642eb5eb, 0x87d73abd, 0xf6f90df0, 0xbe50e0da, 0x48785b27,
+       0xe4b77815, 0xd79e6d51, 0x27e5ad0d, 0x7d5bb6c3, 0xae7de6bf, 0x5f4355d1,
+       0x871d5749, 0x1f070f9e, 0xffa4347d, 0x02f9fbd7, 0xfe3b3fa8, 0xf41db262,
+       0x45df2ed1, 0xee1f036b, 0x49b715dd, 0x77bcba7a, 0xe39533f2, 0x9a598e18,
+       0x82ebf014, 0xf036df18, 0x6bb39bcb, 0x1367f815, 0x458ed145, 0x8ff9cb88,
+       0x17e464b0, 0x77f7940c, 0xdf2b7645, 0xe2f9d07f, 0x17192482, 0xf35432d8,
+       0xdc647af3, 0xa543f3ce, 0xe3ca24dd, 0xe2e338e2, 0x83bf796c, 0x05e499d4,
+       0xe1c7c039, 0x47c041f0, 0x69df85b3, 0x39b9b56c, 0x86ffc46e, 0x83f7e02a,
+       0x72f90b1c, 0x35df2680, 0x0070e47c, 0x85eb41fe, 0x1c1d9ce9, 0x5be29870,
+       0x99736e87, 0x892d39f2, 0x76c3faa6, 0x79e54dbb, 0x79532cc1, 0x298f21c1,
+       0x28c8e23f, 0x8e2bfd53, 0x2bf94d7a, 0xea9a275b, 0x9169fd5f, 0xda249f29,
+       0x077e061f, 0x3e8f522a, 0xe2553433, 0x7e382dc9, 0xb19dc16f, 0xa6a7def2,
+       0xba72eb5f, 0xd3ecf71e, 0xde5439e8, 0x71f7681f, 0x5f43751c, 0x187be1e1,
+       0x129f4d0e, 0xa7c03d66, 0xde772dc5, 0xe39bf0a3, 0xe578f596, 0xd3417d4e,
+       0xdd39740f, 0x35ecaf10, 0x082f2bc6, 0xe03dfeeb, 0x3dd6d2ff, 0x7681fe14,
+       0x9f86df39, 0x88def9da, 0x3c28570e, 0xda38b533, 0xefee8e2d, 0x25b2d8f5,
+       0x1465259d, 0xfef41dfd, 0xcad3cd98, 0x365fdd6f, 0x4fd5a79e, 0x0bf0d5f4,
+       0xfba567bb, 0x305bc7bb, 0xbe67ce4c, 0xd4f372c5, 0x32cf8e6c, 0x3bdf83bd,
+       0x51fdea5b, 0xf3b74ab9, 0xe323105b, 0xdd8c44a7, 0x79edfa0d, 0x44cf893c,
+       0xfbe468bb, 0xff9c5a47, 0xee5b6b4d, 0xf3454419, 0x7bda4ded, 0xe81b0160,
+       0x9258d261, 0xd884f2c3, 0xb35765b6, 0xc7a2e493, 0x3f6cacea, 0x35ddbfe9,
+       0xceb8248b, 0x49031bfb, 0x407d01ef, 0xb4be81b6, 0x71e54721, 0x1b9ec1ae,
+       0x4df6fd81, 0xfb3d9c67, 0xced08405, 0x754fa90b, 0x874c6f43, 0xaffe3cfa,
+       0xf143ede3, 0x42adeba4, 0xd74c338b, 0xd7f1d2e0, 0xf0d07769, 0x707fdfa7,
+       0x6d15b32f, 0x8a3df272, 0xd2db8889, 0x4725afd7, 0x86ad65d2, 0x3f03d40f,
+       0xa15ea9ea, 0xfb031d9a, 0xc7708772, 0x43a1bab8, 0xc2bffd3d, 0x9eff8e8b,
+       0xc4f557ee, 0xc2f9421f, 0xeab7dd77, 0xd9ff4e89, 0x3e06577b, 0xb468e321,
+       0x5ba40975, 0x677d3fd8, 0x6f3f7994, 0x8d7696cc, 0xa2beda71, 0x6799ddf3,
+       0xf60217e6, 0xaa5586f1, 0x39e42fc6, 0xc4529c5e, 0x3a8b11ef, 0xe533cb17,
+       0xcfd62f1a, 0xc80f85d7, 0xf5aee0f7, 0x455c2516, 0x9b6692f9, 0x15a048d8,
+       0xf38fbbfb, 0x1b93bf66, 0x449efe71, 0x3726cdc0, 0x49b4b71a, 0xb94fec09,
+       0xc5ecbdfc, 0x5c7ef94e, 0x8bd9bbe8, 0x2f17fd35, 0x86df602a, 0xcfee65fa,
+       0x8f6bced6, 0xe12b7cf0, 0x0ba5bd67, 0x02de8d7e, 0xe8311df2, 0xf3b4aac3,
+       0x8e969c70, 0x24fc3737, 0xc2795df1, 0xce16446f, 0xb76b46f3, 0xf89d7471,
+       0x9d2afdd5, 0x1cc3c27e, 0x171a1faf, 0x4affd670, 0x1a7e7774, 0xd3d37fdd,
+       0xdff4e83e, 0xa85f877c, 0x1e8969c3, 0xff043e05, 0x57e8dbbf, 0x8248f3f9,
+       0x3127fd90, 0x6ab48ff0, 0xb98d89fd, 0xf44fdddd, 0xf1c5d8ad, 0xbe2cab10,
+       0xf25c40ff, 0xef1fea19, 0x3ce5deb0, 0xf8fb8090, 0xd3bb3493, 0xe4d6f3e5,
+       0x7ef2d1b0, 0xe55f8740, 0x2898eef5, 0x1f1373ef, 0xba77d815, 0x08aa7f1f,
+       0xfbaa42f6, 0x466b7c49, 0x3f75fe31, 0x14707149, 0x61b339c3, 0x484f0db1,
+       0x7b7c3eb6, 0xcbbb8461, 0x403ad27f, 0xe4f4e7c6, 0xc97e9947, 0xb8cdfdc3,
+       0x73f71574, 0xca453b2c, 0x2cf78d6b, 0xd90d9d03, 0x67986c26, 0xdffbadab,
+       0x23929819, 0xf852d1f7, 0xe21b7bd2, 0xac28567e, 0x84572c07, 0x7cc4071e,
+       0x6c5fcf5e, 0x3285f2d2, 0x992acb7f, 0xc5ded56f, 0x3bd9aada, 0x98a44f30,
+       0xedf0f40f, 0xf3043d9a, 0xe0798a40, 0xf21af83b, 0x83c86be0, 0xbe0f21af,
+       0x0d7c1486, 0x51444bdf, 0xfd2a9e72, 0xfb0de33d, 0xf19efe03, 0xfe09b906,
+       0xfe1e631e, 0xf87d631e, 0xf0e58c7b, 0xe1cb18f7, 0xe1e631ef, 0x87d631ef,
+       0x8798c7bf, 0x1f58c7bf, 0x1e631efe, 0x7d631efe, 0xe58c7bf8, 0xcb18f7f0,
+       0xe631efe1, 0xd631efe1, 0x58c7bf87, 0x629d737e, 0xacdd07f2, 0xba503bbd,
+       0xa3e98e3e, 0x2928b539, 0x3ff7d687, 0xc7e7ff23, 0xf3ac54b6, 0x6efc25de,
+       0x47845560, 0x44d373ae, 0x2116eeb9, 0x0e7db9d7, 0x76edf3af, 0xf1942f99,
+       0x03f4a1c2, 0x74f8cabf, 0x0a4157e9, 0xf8520abf, 0xafc29055, 0xfd2ade32,
+       0x57e1482a, 0x55f877c1, 0x82afc290, 0xa4157e14, 0x8520abf0, 0xfc29055f,
+       0xbf07682a, 0x55f8520a, 0x157e1df0, 0xe0abf0a4, 0x038231fb, 0x2e1d15fe,
+       0x26e9f9c8, 0xd0e8943d, 0x4cba87a4, 0xc6f9c879, 0x8df390fa, 0x8df390e5,
+       0x8df390e5, 0xc6f9c879, 0x8df390fa, 0x88f11bf9, 0xef296f71, 0xde41db1b,
+       0x9a73e637, 0x86c1affc, 0xf9c37935, 0x46b69157, 0x2e298f29, 0x9e72eb92,
+       0x58ff059a, 0x1c92b86b, 0x763921eb, 0x8d676fc5, 0x89f892bf, 0x2b976f16,
+       0x6f582dda, 0xbad37bf6, 0xe38282f9, 0x3bfe7383, 0x7f75cb91, 0xbad1ff2b,
+       0xac14ede7, 0x90cb6c37, 0x3dede970, 0xd522a5c2, 0xbbe577eb, 0xbe3a17af,
+       0xa5f98f5e, 0x28520e01, 0x910710f3, 0x1f33bb77, 0x2d5bedf1, 0x5d0b8c8a,
+       0x4372e329, 0xe349aae9, 0x3b2d5b4b, 0xbb50440e, 0x83c562f6, 0x5699077b,
+       0x0f96c871, 0x43e6d53c, 0x89cba89e, 0x6b83e2d5, 0x903c42af, 0x7f6eb70e,
+       0xf7c13e24, 0x0bb746dd, 0x738d197b, 0x8ec217cd, 0x64985bdf, 0xda04f297,
+       0xea1cdf41, 0x0c9bbc57, 0x4732bdf4, 0xff3e7b9e, 0xe8caabb2, 0xb5edd0fb,
+       0xdd1ee157, 0xeed908a4, 0x33478f37, 0x2a34a71e, 0xc9fef09b, 0x8bc2ede8,
+       0xd4bfb1fb, 0xddba1ee0, 0x71e32f65, 0x4eff7c5d, 0x4378b7ef, 0x2c17df32,
+       0x13e3ad16, 0xf0a127d9, 0xde3ae6fb, 0x62af7e68, 0x0fe2c47e, 0x2ffc8ec1,
+       0x7121c3df, 0xc3dcfbf1, 0x6c7866b9, 0xc4dbe221, 0xe40ef95e, 0xabc5e1e4,
+       0xbe5c137a, 0xf2077c80, 0x5f6a2f9a, 0xf966fce3, 0xcf93240e, 0xcf8f8648,
+       0x857e41c3, 0xe298ffdf, 0xe5e968df, 0x15e0bdc6, 0xdfd404b6, 0x0b503c2e,
+       0xaf790906, 0xb6579f55, 0x57096238, 0x95e22f40, 0x11fd0378, 0x7a0198e7,
+       0xf8d8f3c9, 0x56a9907d, 0x46fc0d97, 0x5d8a7397, 0x7542ec72, 0xf7df0c74,
+       0x2e13910b, 0xb8e6f636, 0x8e3d7f8d, 0x93ef83a4, 0xce15df2f, 0xf88f8572,
+       0xb9e6f807, 0x5977193c, 0x91c3ecb9, 0x38aed496, 0x8129d392, 0xf3df78ad,
+       0xe88eea74, 0x11cb0a51, 0xdb5fc087, 0x7be79f1a, 0x5eabc582, 0x1710fbe3,
+       0x96881f1b, 0x7fa4aaf7, 0x9bc34ca5, 0xa85a6f6e, 0x16994fad, 0x5ebc743f,
+       0xe74bcfbe, 0x71f7bf30, 0x72c6d1b1, 0x28bca846, 0x880feb84, 0xb46f2b73,
+       0xc5d3ddf1, 0x27578b6b, 0x777eee8a, 0xcfe32bc5, 0x349771b5, 0xa84e38da,
+       0x2b477b5c, 0x965877f4, 0xd2e8726a, 0x27efe66d, 0x4fe44272, 0xad44fdfd,
+       0xaf5bf14e, 0xa83964cc, 0xee71c6d6, 0xb94857f3, 0x0110ec48, 0xbf9867dc,
+       0xef059c62, 0xe5dfcc58, 0xd0dd28f5, 0x7c9a3bd1, 0x12830934, 0x8a5ea7de,
+       0xed32be60, 0xcfce3f52, 0xe9c894ba, 0xe4b2978d, 0xd11dac77, 0xbca16b4b,
+       0x26beff5f, 0x1c44cd17, 0xb2e40165, 0x1dd74c3e, 0x2218d744, 0x4357e357,
+       0x302bcabc, 0xf9b24fc3, 0x734e2156, 0xf7c146d2, 0x7e432691, 0x90d982a2,
+       0x2fb00aa7, 0x3ef90a52, 0xef8544c6, 0xbe1e4cb7, 0xb407db4c, 0x11f3042f,
+       0x37c3f77e, 0xf1006a7e, 0x3b7db337, 0x7d77582c, 0x6dfcf83f, 0x64e60efc,
+       0x7bc762bf, 0xcf4d3e81, 0x743de9d6, 0xd4882c5f, 0x694e63ec, 0x8fb4eaff,
+       0x9c7e5801, 0xc446f227, 0x2d802eb3, 0xb0b69fb3, 0x6ca8aa84, 0x1b9c9e59,
+       0x94236379, 0x6ed37fac, 0x9162df32, 0xfe489ff7, 0x717578e3, 0xe50fb0a4,
+       0xf92ad78b, 0xe1d79788, 0xd8d87afa, 0x777ac349, 0xe74941d1, 0x03eeccfe,
+       0x5df960bd, 0x4cff2619, 0xf84a5a68, 0x105a3ec6, 0xfc63fad3, 0x5c84d0d2,
+       0x889f1de1, 0xf9f5c877, 0x02e2208a, 0xdbf96ae7, 0x8ff2bd9e, 0x278c9c6b,
+       0xedcd8fce, 0x3fe22377, 0x38fe65fe, 0x7f1ab15f, 0xf14daa37, 0x3de57379,
+       0xdf5809c8, 0x7e76ecc8, 0xa66660c7, 0x212f9e4b, 0x72db9676, 0x845df2dd,
+       0x694b7b10, 0x846f3cb6, 0x8f3c9dd5, 0xb66e3afd, 0x3ef3ea57, 0x33df336e,
+       0x5cead3d5, 0xbff83769, 0xa0f127ba, 0x7ffbde45, 0xf1d812c4, 0xa06bd122,
+       0xe6016fb7, 0xbde208fb, 0xcf1f7e19, 0xa3477f4f, 0xef694f93, 0x74f4e865,
+       0xdf22eeac, 0xda712897, 0x9e81aadd, 0x7c28d6ca, 0x4ea4b11f, 0xadf627de,
+       0xfcbde451, 0x8f57ec1e, 0xdf9af9cf, 0x17fc7a51, 0xc350b211, 0x91fb7cef,
+       0x5d291cd7, 0xdd53fdf8, 0x7f926caf, 0x6f103306, 0x9c36b73f, 0x7afe41df,
+       0x018fd158, 0x87b6647f, 0xf11269d7, 0x1a9fd434, 0xbe29fbe3, 0x07238897,
+       0xf05c6f61, 0x7df8b7f3, 0x29bd9ae1, 0xf161eefc, 0x78d5bcee, 0x61ebe547,
+       0x89723bbe, 0x2e9d8b7e, 0xea90e43b, 0x973e58c6, 0xeed1f417, 0xf6768ba9,
+       0xf3ebe9e7, 0x0794ae60, 0x9c723c8a, 0x453e9a0b, 0x354db308, 0x7fe793d5,
+       0xedd43ee8, 0x95f6a1a2, 0xbe2af7d0, 0x7b029ecb, 0x5760dd89, 0xb631edd5,
+       0x7073e3ac, 0x77b7cf9e, 0xaf8dbbff, 0x4d4776eb, 0xa9d85d9f, 0xe84f66cf,
+       0x9d7fb903, 0xbd1d82e2, 0x11bee9cc, 0x8765f5f1, 0x14f0886c, 0xf2dce293,
+       0xe4bb92dd, 0xb72525bb, 0x9b3f31e6, 0xc7c9358f, 0xbc5187bd, 0x9402cb8f,
+       0xdfbcf7c6, 0x657bade7, 0x53d01ec0, 0xe0f7cbd0, 0x7b5e5ccb, 0x2a2e419c,
+       0xef4c526d, 0x17f9e818, 0x721da573, 0xc019a93e, 0xa6b74ddf, 0xd086f1d8,
+       0x108f127c, 0x46baf837, 0xaa3b7a27, 0x932571c7, 0xf941c552, 0x9dc114ae,
+       0xfe33c722, 0x9349514e, 0xaa063df9, 0xfedd72cf, 0xafee28dc, 0x4ef345d8,
+       0x3862ea41, 0xa78c0f09, 0x3fa87bf6, 0xebc38f37, 0xd80c1a51, 0x8f983760,
+       0xcfca1678, 0x186c0575, 0xbe51a4a7, 0x2b5be28f, 0x89adf1c7, 0x2e40e7b5,
+       0x03ecbab0, 0xa360f28c, 0xbe78cf7c, 0x0411fbf6, 0x65cbcb2f, 0xf3dc2784,
+       0x867defd2, 0x8358abe2, 0xd629acbf, 0xad365f2c, 0xe67d61b3, 0xc35ef0f4,
+       0x971d1a97, 0xfbe18e34, 0x2f5665f5, 0x69f097df, 0xb2ebfef8, 0x27e1bbf0,
+       0x90fcd399, 0x8d79052d, 0x3c097d2f, 0x829e06f7, 0xd23efc19, 0x678e70b2,
+       0xe26ae39e, 0xfbe276f9, 0xe40fc201, 0xe3115715, 0x8fc4e89b, 0x66b2c038,
+       0xc176faf3, 0x65df2513, 0xfde62e6f, 0xb3eac8b7, 0xac708cbb, 0xfb819fdf,
+       0xdf68735b, 0xe127fde3, 0xcc7df1f2, 0xc8dc0f53, 0x3806fbbf, 0x8f28e781,
+       0x3bde027b, 0xba61ba22, 0x4167e9d6, 0xfacfdc81, 0xacc35178, 0xec3f0ed2,
+       0xf7a9f6bb, 0x06f3e420, 0xffd86f5a, 0x76a7da7b, 0x71a4005c, 0xddf265ed,
+       0xab7dd0ba, 0x9f7d57ef, 0xdf56fbea, 0x8ad98fcf, 0x174a8982, 0xbdf3a1df,
+       0xf06eb9f6, 0x77834934, 0x84aeb6ae, 0xc18557d7, 0x986237ae, 0x53f3dfdc,
+       0xfd1ffbcd, 0xbd54dfa1, 0x03306c7c, 0xfaf53df7, 0xe3f3b8fa, 0x03ec3b64,
+       0x30ea5bd0, 0xe5fd674b, 0xe262df5c, 0xfc9da51f, 0x04aafb63, 0x0a1d8ff0,
+       0xdf96e1fb, 0xe5bee523, 0xe17bc8cf, 0xf8bf9667, 0x77aa2cf6, 0x0b8dc1fa,
+       0xca2ff78c, 0x2c5f9282, 0xfc0b7924, 0x0f269163, 0xe5f4cc6c, 0xe7ec330d,
+       0xc99ffbb2, 0xdb98fec4, 0x6f0a7792, 0xf9bcd1a8, 0x3f3fa3bd, 0x5787d2f3,
+       0x5dcebbb9, 0x6b251e7d, 0x3b15b5de, 0xf493788d, 0x0756777e, 0x38a55b9f,
+       0x6953e8b7, 0x61f33163, 0x8f7a4891, 0xa1eeb5d2, 0xa8dc50f4, 0x5a579cb0,
+       0xfea03237, 0xd2ebf22f, 0x8df953b5, 0xf4bd7d28, 0x73f45f77, 0xa67f8757,
+       0x35734eb6, 0x4c3d9e7a, 0xe5b9c3ee, 0xbc45f629, 0xf8ec53ff, 0x5a39cdbd,
+       0xf3329cf9, 0x72f5cef7, 0xd5fbf275, 0x9fb827d8, 0x58eaf584, 0xcbf6936b,
+       0x57ad97ed, 0x1d02e432, 0x9d9ac58e, 0x6f66a172, 0xcbc9a45c, 0x8d8b5eb4,
+       0x71f8b5eb, 0xcfa55eb9, 0xbc17f5be, 0xd3f34653, 0xef93a3de, 0xecb4940a,
+       0xb39b75e0, 0x852d9d66, 0x5864fdea, 0xa8fe298a, 0x05cf36b4, 0x35dcfd3b,
+       0x07e06d1b, 0xf126193f, 0xf3f74a16, 0x1d62f8b5, 0x148f38af, 0xaf473f83,
+       0x83b83e0f, 0x5975b9c6, 0x77f1b478, 0x3d1a02ed, 0xc6c6d697, 0xdad2bc61,
+       0x7fa17be2, 0xe840e7e9, 0x2e113bfe, 0xf50945f7, 0x6279fd87, 0x55ef878c,
+       0x377ed7cf, 0x43feb42f, 0xdafddd1a, 0x4cbfdf26, 0x92796c8a, 0x226a3be3,
+       0xe913e03c, 0x8c01ade9, 0xdc067a0b, 0x2f7c8b76, 0xf5b2bd33, 0xa241c073,
+       0x20f5c73c, 0x105b7bc5, 0xbf2813ed, 0x79ef22c9, 0xdd32aaa5, 0xa607e1a7,
+       0x5e8b9437, 0x5f1efcad, 0x2151bbe7, 0x9b176af4, 0x1fdde0d7, 0xefc12f7b,
+       0xa9f4e9a6, 0xa7d3a3f7, 0xcd3dbf4e, 0x9cf7d76f, 0xcd1489df, 0x49e592ce,
+       0x0bb8d076, 0xbfc41bee, 0xf35df16b, 0x35ef6bb4, 0x4c37ce76, 0x65c7defe,
+       0xfa974df3, 0x6df3cf52, 0x66e84c2e, 0xd4f3a1be, 0x431e89f7, 0x694fe9df,
+       0x1394fe92, 0xd4639d0a, 0x70b2c4ee, 0xe7d3ab8e, 0xbff5dba5, 0x8f87bdef,
+       0xf669c586, 0xc828d6aa, 0xdfb5f397, 0x99411151, 0x86a9f7c7, 0xaff9faef,
+       0xf3a75fbf, 0xdab593e9, 0xef5a28f9, 0x75167ec1, 0xf50f7c69, 0x2889d358,
+       0x627313bc, 0x6f4f848c, 0xde4dab77, 0x76511673, 0xbbcfde37, 0xfe3cd6e9,
+       0x8d8594bd, 0xbd9f587d, 0xf98d2ea9, 0x587e4dc2, 0x1ea74517, 0x83e348b0,
+       0xaf16b791, 0xd7f502be, 0xc2eff0a7, 0x4e7a742d, 0x43f6e7ad, 0x2313903d,
+       0x53daa79b, 0xfa961e59, 0xbb17ee82, 0x7c451155, 0x127c0d4f, 0x3fb2cbfb,
+       0xe2cfe71d, 0x983f52f5, 0xe06b1164, 0x50d81d3f, 0xf82fa134, 0xfc8ac3c4,
+       0xe60d9a3d, 0x0e86bcf7, 0x7c02fa2a, 0xbc5df426, 0x5e2d6d5b, 0xe482a7e8,
+       0x16d1d80e, 0x9e588b3a, 0x93e345bf, 0xf8db9ac7, 0xaf1d7ebd, 0x78bfe08f,
+       0x7ec42aa7, 0x1a276a14, 0xff07d9a8, 0x7b8faf1f, 0x0080003d, 0x00000000,
+       0x00088b1f, 0x00000000, 0x7cb5ff00, 0x65545c0b, 0xce7bf8da, 0xc0cc2b99,
+       0x1245c880, 0x85848b87, 0xd780c034, 0x508151da, 0xb9bba0bb, 0x658e21ba,
+       0x500665ca, 0xd7775ddb, 0xa6a18cfe, 0x45fa7d66, 0x80ed65a6, 0x76c36a97,
+       0xa8283448, 0x59990bc9, 0x6a37627f, 0x5b63b92f, 0xba402de6, 0x6dbfedfc,
+       0xbcf3cf7d, 0x511730e7, 0x6fbefddb, 0x797bf9fc, 0x9f5ef3df, 0xcfbcf3fb,
+       0x8c346339, 0x63181b75, 0x418e8b2a, 0x89486839, 0x8d8c9964, 0x615f6909,
+       0xf6c3894c, 0xc645db25, 0x7cfb4046, 0x1962c893, 0xfa31d72b, 0x1fbf8f7d,
+       0x3c1f7631, 0x42f3c337, 0x07d634a9, 0xcc37d7fd, 0xd6c972a0, 0xf1ae6dc2,
+       0x2509258c, 0x606393b1, 0xb66ae3c0, 0xce258a07, 0x2b307719, 0x8da4d3cc,
+       0x73c325d2, 0xc7292bb5, 0x496f9fe0, 0x0c4943e3, 0xd4699dc6, 0x7b4377cf,
+       0x414e6981, 0xba5f8c14, 0x325b2a33, 0x6f5dfbfb, 0xc91b1811, 0x4673a558,
+       0xcc614b1c, 0x67e1ddf1, 0x1fb0a94c, 0xf304d398, 0x7709e57f, 0xa38ba0bb,
+       0x82492dae, 0xb3aa3c23, 0x7fa058a7, 0x6f31d895, 0x4e73cc12, 0xa04def70,
+       0x5338e6fe, 0xe5a1fac0, 0xccc63ae9, 0xff398ce9, 0xcf3487cf, 0x3b89e2e7,
+       0x8778c016, 0xce047f73, 0x1ff8f553, 0x6c3201f2, 0xb2cf689d, 0x8dbce1e4,
+       0x1c124d7b, 0x56637b74, 0xbee39c09, 0xda46c7c7, 0xf79f2f33, 0xa8b668b6,
+       0xdbcbda04, 0x6957c118, 0xd48ee85f, 0x5eeddc20, 0x696131a6, 0x28689a62,
+       0x956c48cf, 0x52dbca07, 0x06b9a2d8, 0xe10dbb7f, 0x899eeb00, 0x025492dc,
+       0x9f7b15ed, 0x79433248, 0xa5ebc8d6, 0x9c7a7f7b, 0xddff4045, 0xd5e20d5a,
+       0x0b1a62ae, 0x25d7bb8c, 0xb250dcd8, 0x12c668f2, 0x7d6ea310, 0x59b19199,
+       0xaf9a7096, 0x630e7b62, 0xc17dfeb9, 0xab3f6a73, 0x8fb8c562, 0xd903f531,
+       0x8bfca1cb, 0xe21f7bca, 0x7ab52ff3, 0xf1192b8b, 0xfcbc2662, 0x84548b65,
+       0x05fbaeed, 0xfac05636, 0xac1a637e, 0x6ac9165f, 0xf4a17c71, 0xcf049b57,
+       0xb2101c57, 0x787b30b5, 0x1ee6b766, 0xd1169103, 0xd389b559, 0x75768ad9,
+       0x7fe02251, 0x2d408b45, 0x3357950e, 0x2f2abe1c, 0x80e6664d, 0xb6b656fd,
+       0x8eb0cc68, 0x09ce19a3, 0x539e1dfd, 0x5e78a59a, 0x7cb185b6, 0x89fe27c0,
+       0xa53e6bf8, 0x3f0037b9, 0x2e1cadd5, 0xbede56ce, 0x3b900338, 0x1362b699,
+       0x26dea0d2, 0x6b3ebd50, 0xaa35fcc2, 0xfcfe7ac0, 0x9a586935, 0x354c4e08,
+       0xf0025490, 0xa3d194dc, 0xd73bfc41, 0x5d42f3ca, 0x0d5eb01d, 0xde48e512,
+       0xf1c06a9e, 0x3caf1a66, 0xd146b677, 0x6c33af78, 0x3609bb03, 0x61506d51,
+       0x4434ef59, 0x56b3b960, 0x715950cc, 0x09166173, 0x1611dfe0, 0x6122c591,
+       0x3d5eaaca, 0x3b501240, 0xf6845870, 0x83fb48dc, 0x0c719f48, 0x33e802b8,
+       0x06057991, 0xf9dfdff4, 0x7fce2e59, 0x17df18cb, 0x5eaeb60c, 0x017e7d33,
+       0x8b26c3d0, 0x5f4c8e7c, 0xc8f1d22e, 0xb0af4043, 0x6cd5a7bf, 0xcf073e83,
+       0x42e6c257, 0x08c2cc3b, 0xb984dfcf, 0xafdfc0f7, 0xce226f31, 0x54de74cf,
+       0xcc9af71c, 0xc35a25a7, 0xf5f60106, 0x63fb149b, 0x053b8fb8, 0x116cf8f5,
+       0xc58d2071, 0xfe6afd7e, 0xc2796d9c, 0x4ffc03a6, 0xa367e8e7, 0x4062e645,
+       0xf1519aa2, 0xc163a406, 0x60ab6366, 0x0f3307fd, 0x2e80cbdd, 0x31d01e1e,
+       0x5eaf9c2d, 0x7d3dcfcf, 0x0094ec20, 0x2a8f46fd, 0xf4165916, 0x2958ab37,
+       0x29943ff4, 0x9fd8557a, 0x9fd8dce9, 0xbe6d0ae9, 0x8196590c, 0x7a88d0fc,
+       0x78eff51b, 0xca011bf3, 0xe1e2e944, 0xe2573848, 0x3d4b052f, 0x3c1b29f4,
+       0x85fff4fd, 0x5352f4b2, 0xfca1efcb, 0x19bda475, 0xb0727751, 0x501d94f8,
+       0xa3c9b0f6, 0xf9f264b3, 0xf1dff702, 0xa2226fab, 0xfabeff45, 0x7bef4e07,
+       0xcea58ad9, 0xe9b8c022, 0x9b57921d, 0xfa7ef975, 0xa9e361e3, 0x39e18fd4,
+       0x5ba20dfb, 0xe1ffb010, 0xd37f710f, 0x14af0675, 0x17d4e381, 0x38ff3a7c,
+       0x751d1e66, 0x284646fa, 0xb1913ef8, 0x8c3cdc58, 0x7068b81f, 0x6fb9c137,
+       0xa14ff991, 0x488b1eaf, 0xf191e9f8, 0xe991c0a4, 0x7e9122b2, 0x5e8ad5eb,
+       0x4cb385f0, 0xe8d67f3f, 0x5e0cff38, 0xff386d12, 0xcdd6b960, 0x8ec18a60,
+       0x5727d254, 0x007fa792, 0xd740ca79, 0xfb6a97bc, 0xf90fc233, 0x78fc074a,
+       0xc02f0c97, 0x25f9c33f, 0x64bbfe79, 0x1065ddb8, 0x127e9c39, 0x6e992702,
+       0xf650ba14, 0x5863982f, 0x9f1fb469, 0x47ddd7ec, 0x8f099323, 0xe383ffe3,
+       0xdfc213ef, 0x01d62737, 0xff51b11b, 0xfc784598, 0x579fc05f, 0xf80bfeb4,
+       0x9fc50eeb, 0xe23d7f57, 0xd2d171ef, 0x0880fc84, 0x26d2a1c8, 0x0658f9c2,
+       0x932ffe23, 0xe09b2cc2, 0xffe4767c, 0x8fef889b, 0xfc2bdf22, 0x37d8a63e,
+       0x49e4f51e, 0x7dc19ec6, 0xb50f44f9, 0x10a766a7, 0xbac75f9f, 0xf01db013,
+       0xf117379c, 0xe876d82e, 0xfb7d2c24, 0x5df5865e, 0x1ecb0615, 0x5bbf6f38,
+       0xfe61a974, 0x8ef72886, 0xc36eb0a5, 0x1716995d, 0xd59633b6, 0x3ca07286,
+       0xbe7a82cc, 0x85cb8a21, 0xa4e90586, 0x277e0f87, 0x73c2ad25, 0x34b3082c,
+       0x6c86ff41, 0xa01323df, 0x6cd630de, 0x57d74171, 0x1dbe9605, 0xd1d1cfc7,
+       0x38730d3a, 0x323c36dd, 0x057a8dda, 0x7af3cff4, 0x1e593fa8, 0x0d9cf0c6,
+       0x6884b68d, 0x2297cba0, 0x61b3a3ec, 0x4e24a3ff, 0xd0c90dd7, 0xa136e50e,
+       0x387dc164, 0x6fbe78df, 0x17b082df, 0xfa2cc2f7, 0xd0591034, 0xb195727e,
+       0x42a5e509, 0x73a57797, 0x75c63779, 0xc9c2076a, 0xd4659d35, 0x937ffcc2,
+       0xbb814be9, 0x556c6360, 0x0afe1fb4, 0x70c8c59d, 0x7a735617, 0xe5974d73,
+       0xd7733562, 0xe65f080b, 0x96f8070b, 0x42414169, 0xadd93469, 0xe5faefb8,
+       0xf7091780, 0x527fe1cf, 0x619ee564, 0x2847e7f8, 0x4c88f32c, 0x328fe404,
+       0x0ca3f9c6, 0x6fe908e9, 0x0051d015, 0x75df31fd, 0x65c3a751, 0x6bf1823a,
+       0x70d3258d, 0x3f85cfbd, 0x89e363e4, 0x87f34a7f, 0x3656675b, 0xf40b0397,
+       0x9fd899f6, 0x51148eed, 0xf130ae5f, 0x7f644ef5, 0xc5f51a36, 0x79bd5fc9,
+       0x23c7961d, 0x86cb6e4a, 0x7c16dbfe, 0xfce2845d, 0x353e096f, 0x0b6fe39e,
+       0xb468fffe, 0xbf56ca43, 0x43fef449, 0x192859f7, 0xaf4e5032, 0x15a67d04,
+       0xb074e4b0, 0x74463ef2, 0x896ac890, 0xfd65e36e, 0x47a30c05, 0x00f37539,
+       0xbcca8ed8, 0x9747fff0, 0xce896c74, 0xa2c69f5f, 0x7433ea82, 0x0bfd4109,
+       0xcf41c94d, 0x171f8d6f, 0x39a67cf4, 0x3b3ea83b, 0xff505263, 0x82d32ddb,
+       0x9c4e77ea, 0x8e7fd419, 0xdd504e6d, 0x1f244cc6, 0x738aea3a, 0xe1bb013f,
+       0xdc92bab5, 0xe397544f, 0xd0f6aa63, 0xe805b37e, 0x5f3bdb24, 0x91ea0935,
+       0x43265687, 0x11cb537d, 0xf43c4f5e, 0x66e03245, 0xf9d1cb73, 0x53dbd02a,
+       0x45f43c6f, 0x6d1fd40a, 0xa7cfe2e9, 0x40a362c0, 0x39bcb6ac, 0x9af805df,
+       0x8adf629b, 0xa9779af8, 0xf98a28f6, 0xbdccd7f7, 0xb942592f, 0x06746730,
+       0xc53727ec, 0xbf3e10fe, 0x759ef62b, 0x1ffb0091, 0x46ab5b7d, 0x5d98bf3c,
+       0xa1e915b2, 0xf3a722ff, 0x91978853, 0x96097eff, 0x8a61d903, 0x3c92bd9c,
+       0x03adf854, 0x1512c6f4, 0xa54749c2, 0xe544ceb7, 0x2a78baa1, 0xd999d48f,
+       0x57638012, 0xc795065d, 0x7ed42cea, 0x95226ebc, 0x546cea27, 0x4c575bbe,
+       0x095d7765, 0xb2ff0a95, 0x6a0d96bd, 0x2a974224, 0x4fceb4ea, 0x63d2578f,
+       0x69d92820, 0xf9d09f05, 0x39adbd4d, 0x9d75ce9b, 0x6959e909, 0x81f9da3f,
+       0x9dfa0459, 0x3d11d56a, 0x9b74354f, 0x475e5675, 0x22fbb8b9, 0xbc118af3,
+       0x5fb02a9f, 0xfd1b278c, 0x030ea998, 0x841b4bf5, 0xefd8597e, 0xf79404cd,
+       0x16356b53, 0x509e63b4, 0xf61e9733, 0x90df146f, 0x20e31d70, 0x05d86cca,
+       0x903ad518, 0x6ba07157, 0x63f439f1, 0x0f77283a, 0x4746f5f2, 0xf9472ed7,
+       0x60ccba34, 0x95f2e7a9, 0x08e24be4, 0x2fee026f, 0xda86a571, 0x198f628d,
+       0x9d5f60e5, 0x69d21677, 0x0ae72c81, 0x30ef5c34, 0x80bde411, 0x576dfb7c,
+       0xedf3da22, 0xd02f9edc, 0xfa44ec96, 0xfe7156ae, 0xf77a3165, 0xd5475c1e,
+       0xf42cf15d, 0xb44d89eb, 0xc568426c, 0x6069641f, 0x14d617b7, 0xeddca267,
+       0xaf885b61, 0x13fd5ec1, 0x338fdbd2, 0x9945df81, 0xf89e6048, 0x4da6f0e2,
+       0xd7adda02, 0xce5d21e7, 0x300f9ad5, 0xf65f07e0, 0xdcfbd100, 0x7a1e7348,
+       0xafecbe0a, 0x7cce3d79, 0x26e78040, 0x00bf3036, 0xe9cf55ea, 0xf0049f4d,
+       0x1513d3a9, 0x4b69af54, 0xc0127d30, 0x07f855a7, 0x09b747fa, 0x0ebb942a,
+       0x04a72b79, 0xb7c405fb, 0x0d73f8b3, 0x0680dfdf, 0xd98bd8ed, 0xb06fa266,
+       0x0fef4997, 0x9bba34cc, 0x2371bf60, 0xa057b36a, 0xce6994fd, 0xea497ec3,
+       0x63f40881, 0x1555bffa, 0x19efc9bb, 0x78c9f888, 0xd33d7d3f, 0x287b5121,
+       0x70e6b5dd, 0xcd26af7f, 0x50f119b0, 0x51d3af1d, 0x88b171d9, 0x92569d91,
+       0x4db97686, 0xd0cbfdc3, 0xb8737bf1, 0xaf5e491e, 0xa240b921, 0x0b6cb608,
+       0xc5dd4a63, 0xf8d63226, 0xbf21b08b, 0x34c9c007, 0xc83f6563, 0x41476235,
+       0x1b7f505a, 0x8e7a1ff6, 0x8ff31cf6, 0xbb49794f, 0x5e4aad63, 0x2965e90f,
+       0x183fa373, 0x72abc72a, 0xc0b965a3, 0x8c74fcf1, 0x9cf111be, 0xe77d0126,
+       0x504cc950, 0xb2338626, 0xd75f1337, 0x773e91bb, 0xa7fd39eb, 0x2ddcbc89,
+       0x309afef2, 0x577a42e6, 0xb94d87fc, 0x79b929f6, 0xe6978f34, 0x91b25a91,
+       0x879813ae, 0x24ec57d6, 0x43d81fa5, 0xaa02127a, 0xd7c47481, 0x161c4954,
+       0xa672279e, 0x448ce515, 0x4fb1b0fe, 0x5f77e403, 0x40aac478, 0x78e355fc,
+       0xe9b8e043, 0xef194e34, 0x4fb2255c, 0x245c9047, 0x89a6723a, 0x4b562fe4,
+       0xfe8088ec, 0xa0d6eb16, 0xf5c6539e, 0x14fc1c82, 0x9047f0f0, 0x087e588b,
+       0xffd710f2, 0x2c43c833, 0x10f20aff, 0x3c824fdb, 0xf207d2c4, 0x063fdb10,
+       0xbce58879, 0xe4568dbb, 0x69b69a9f, 0x7e20d3ec, 0x017ddb50, 0xc369def5,
+       0xa64391d3, 0xe1e4dea3, 0xe1cbaf9f, 0x2def457e, 0xa0fd9f1c, 0x00ffd1bf,
+       0x8a6b5cba, 0xef1eb2be, 0x1ef9b237, 0x7cb6d380, 0x27f4876e, 0x1cd2faf0,
+       0x226dd535, 0xb7e38edb, 0xfaf86be5, 0x3e396229, 0x79f345b7, 0xb245d37b,
+       0x9e4ea69f, 0x9e0724b6, 0x3da162db, 0xbdef5fc7, 0x8db73f81, 0x7a43ede2,
+       0x253e7e56, 0xeff8a4d7, 0x652fdce9, 0xbd012764, 0xff4afcd3, 0x3e7226f7,
+       0x4eefed0c, 0xc3dd8b13, 0x992de3c0, 0xd02f896f, 0x483e469e, 0x6a8be00e,
+       0x4285f133, 0x55fd0a87, 0xa73872e5, 0x073a6569, 0x43f042dd, 0x3a72831d,
+       0x25f64f4e, 0xe0c6c5c0, 0x9905bb3c, 0x01f9425f, 0x0a07d44a, 0xa07c283f,
+       0xf0227bd0, 0x3fed1099, 0xf421cdc7, 0xca8f94aa, 0x358ee8e7, 0xdaf09cfe,
+       0xdfa136a1, 0x87cc3377, 0xc1c513e3, 0xfe46ef77, 0xd19a358c, 0xc87c2cf5,
+       0x1c9c3b50, 0xc2effaeb, 0x570b9143, 0x7065c780, 0x5ff2f0d0, 0x39c90385,
+       0xbf48e394, 0xfdadc8c3, 0x5db2d139, 0x44f7e9ce, 0xd21f6d8e, 0x57a0bf51,
+       0xafd0dfa1, 0xd9dac367, 0x7f39f2db, 0x05547428, 0x89eb103a, 0xcbd4ce78,
+       0x9e729ee5, 0x632e73a1, 0xc2d2ff24, 0x9e287b78, 0xc8057395, 0x0139c3bf,
+       0xb8c61ff1, 0xd81d717d, 0x4d4fe817, 0x3ed335c9, 0x567e47fa, 0xcff995b6,
+       0x6f0e477f, 0x88944a7f, 0x32fd141e, 0x8b482ed4, 0xe90664e6, 0x3f42661d,
+       0xfc4b53af, 0xe67f05ee, 0x3e871825, 0x3fe49b21, 0x71e320bf, 0x1158fe70,
+       0xafbebbed, 0x63d42e0d, 0x4e06a37d, 0x6fbe300a, 0x6436183b, 0x136ed897,
+       0x07deef40, 0xd4f5063a, 0x2c7b9005, 0x7273b19d, 0x73cfa11c, 0x73fa24f1,
+       0xa6243b35, 0x3b4a5003, 0xf4879abe, 0x6d53b4b4, 0xf6d0b8a2, 0x3d218ec7,
+       0xcc156e9e, 0xb5f49768, 0xbfa1f1c2, 0xd6e8c1b3, 0xa822ff43, 0x0665ff63,
+       0xd7ccdb8d, 0x4383f8a3, 0x7d53ef5e, 0x85c60a75, 0x1350ec66, 0x2f3e97dc,
+       0x3b3ed1b9, 0x0aa57dbc, 0x02dda7eb, 0x4571838b, 0x04aeead2, 0x2d3e57a8,
+       0xce30b458, 0x8b3a2861, 0xe7ca82f1, 0xf30bc599, 0xc918b657, 0xa0da5dcf,
+       0x6017d8fe, 0xb7bb945f, 0x29eed06a, 0x5edc19df, 0x0eb83bb9, 0xeff922f8,
+       0x00f68668, 0x8e6dfcf9, 0xcdec8631, 0xed1b2c71, 0xe3c0d64d, 0xbf7c8ab9,
+       0x71756edc, 0xcb82ba39, 0x8cbec66d, 0xea5f7f45, 0x63e92afc, 0x91cfaf03,
+       0xfea0a7eb, 0x2f1c57f9, 0xe5aa5c0a, 0x604f3fb5, 0xb79c0f56, 0x426f53ba,
+       0xfdbabfff, 0xb71811ef, 0x51f309af, 0x22bd9f7c, 0xdbded099, 0x10b926d8,
+       0xfd0ecebe, 0x56e0112e, 0x8d3de07d, 0x5f7088d9, 0xadcaf64e, 0xe31eb5cc,
+       0x64515edc, 0xdd4744dd, 0xb666a714, 0x4f38a581, 0x84debb5f, 0x2bf54076,
+       0x8ddd741f, 0xd30203f5, 0xfb471e23, 0xee964e88, 0x2da58640, 0xfbe426dd,
+       0xbc4244e9, 0x913d9e22, 0x8865af84, 0xe033c477, 0x212cf11d, 0x51bc713e,
+       0x2274e6e3, 0x73f4fd51, 0xde0abf1c, 0x1acda48b, 0xe46caf6c, 0x63b19e78,
+       0xa230b6cf, 0xe9933503, 0x7a7ef080, 0xa6bbc727, 0x14669d73, 0x08636fd2,
+       0x876bb41d, 0x77f700e8, 0xe0841d19, 0x8df002bf, 0x0e942072, 0x93dff142,
+       0xd806e5c3, 0x429fa7df, 0x7e08dbfb, 0x23c7f301, 0x1ef55646, 0xcaf5818d,
+       0x973bcfa2, 0xf8d8fb43, 0x08da5897, 0xe4157f8a, 0xe66bfc62, 0x5d10eb3b,
+       0xc85eb33d, 0x57a97a46, 0x813cf6fb, 0x70a88b71, 0x27f4e38a, 0x32f9d9cf,
+       0xfa20bb9c, 0xd816a49b, 0x5a6bcd7f, 0xc928deba, 0x35ec8715, 0xf129978c,
+       0xc533c074, 0x5a1d9cc9, 0x2d6b171e, 0x73fa05b4, 0x5cfc09fd, 0xb2819a85,
+       0xc017e8e5, 0x608eb87c, 0x555e7ee3, 0x28178f07, 0x1295597e, 0x8e0e6837,
+       0x77a6081b, 0x2e455fa8, 0xc6a55f8f, 0x3b466cdd, 0xb3017ebc, 0x4d5ea587,
+       0xcc78f03f, 0x74dfb2d3, 0x0af1fb45, 0x1bb1427a, 0x6e382b99, 0x65a9c8a1,
+       0x8f1ef913, 0x6ab8e2fe, 0x76fdc604, 0x8a8f840b, 0x704f900e, 0xdab70ade,
+       0xf802166d, 0x19ffee49, 0xedc01bd2, 0xa0f6ab8c, 0x19dd2128, 0x990ebf68,
+       0x8e91ab3e, 0xd695bce0, 0x9cf02237, 0x38ae590e, 0x7f148dda, 0x8a5b64ab,
+       0x612aee90, 0xf430ef3d, 0x0b5cf954, 0xa2d729f9, 0xaccec527, 0xb7ee0d6e,
+       0xce487731, 0xe01eff8c, 0x396401bb, 0x992e7bd7, 0xf12332fe, 0x99906fde,
+       0x879f9123, 0xedc09ff4, 0x5cfe4537, 0x3c581dbf, 0x6e71de60, 0xac05531d,
+       0xa673e37f, 0x4f78faa0, 0x9bff507c, 0xcf41ccda, 0x4119bdb3, 0x598f73cf,
+       0xdd79ea82, 0x4ffa8313, 0x5416d0f8, 0x0e2be49f, 0x4ce53fea, 0x307d5049,
+       0x9573ce13, 0xe35bc1fb, 0x33fea085, 0xf9a0facd, 0x05446767, 0x320d07d5,
+       0x52bb647c, 0xce5f77b1, 0x686ef6e5, 0x76f7c0a9, 0x8a3af04b, 0xc4e77ebf,
+       0xd8e6f5e0, 0xa1fbd782, 0xfa0bd978, 0xc27e0554, 0xb15fa073, 0x13f81dfc,
+       0x9a13f02a, 0xfac09fc1, 0x604fe08b, 0x027f01e9, 0x7f025fdb, 0xe0adeb02,
+       0x20fd604f, 0x6f583ff8, 0xf2a62bab, 0x6a12ba95, 0xbafc16bf, 0xc98f75e4,
+       0xd7971eeb, 0x74e177fd, 0x5def9e42, 0x9c6ebe79, 0xdcffcd2f, 0xbc563c59,
+       0x2d3cfc04, 0x87c6acfa, 0x5f0ac37e, 0x062dc611, 0xc61892de, 0x7ddd99a5,
+       0xf5062eac, 0x338a08d9, 0xb78192b3, 0x7d52ae31, 0xc9b4d520, 0x0fecfa8c,
+       0xbef3e2ef, 0x7c8cc956, 0xefeda879, 0x85cf3811, 0x5f74614b, 0xef107a4a,
+       0x5461bf1b, 0x31cf04df, 0x05b33a0e, 0x37e90804, 0x0bb7e90f, 0x4ddd4a69,
+       0xcd25bdf7, 0x53c41a2d, 0x3c29f215, 0x0ea3cb7f, 0x635cfe7e, 0xf61373d0,
+       0xe54ab287, 0xb9c238a6, 0x2f3e6536, 0xf1a477f5, 0xcf73cf7b, 0x053f5e1d,
+       0xe2cb6ff5, 0x5e7f7811, 0xec5efcd5, 0xc7c157bd, 0xc85f07e7, 0x76cafba4,
+       0x9fe0cf98, 0x96aed9cf, 0x8eff7ceb, 0x68a296b4, 0x02cd1c54, 0x05c50b1b,
+       0x5fee85b6, 0x38f6daaa, 0x65556e50, 0x0066addc, 0x248f7e9f, 0xbdf837c7,
+       0xb8c4c391, 0x22f9e71d, 0x5f57ef02, 0xc3bd1cf7, 0x38edf886, 0xf6eb811c,
+       0xfe414ab7, 0xb72b68d3, 0x355b478f, 0xad0bbf84, 0x5ef02387, 0x30e7a377,
+       0x4bcabb87, 0xd7243fe7, 0x7824a1fb, 0xfe7449b7, 0xd0624b8a, 0x5586763d,
+       0xb66679a2, 0xb9e2358d, 0xbd7c3c7a, 0xb799ab1c, 0x825e2da7, 0xbf1e3ffb,
+       0x7b224f20, 0xca350410, 0xef661bf1, 0xcaa43b41, 0xf386d923, 0x79e40aef,
+       0x4e9cd4bb, 0xdfdb4adf, 0x78f8f285, 0xd26c88f1, 0x699f8a11, 0x916f76e5,
+       0x7a869ec6, 0x3660c7a4, 0x583f9d22, 0xfc446a9c, 0xdb12c21e, 0xec69778b,
+       0xe6c7bc06, 0xba98f5eb, 0x7aee9023, 0xb425735a, 0xf2f99477, 0xe88775e5,
+       0x2e6f087b, 0xbbb953c2, 0xf8f380d1, 0x73dbc7f1, 0x7fea26ac, 0x3cdefddc,
+       0x327aabb4, 0xe92ec9c2, 0xa7f230d2, 0x5db99aab, 0xd891d3dc, 0x924f7818,
+       0xf2fd9563, 0xdaf0910c, 0xfb96a6d7, 0x0587bddd, 0x39d353f5, 0xde0eec2f,
+       0xea7dc98f, 0x1dc7b451, 0xf50c4b4f, 0x1b5d43a2, 0x6cffe78b, 0xcafef067,
+       0xd43b3865, 0x00d8d8de, 0x0fb4757a, 0xe8818df1, 0x13e15dbc, 0xc153e133,
+       0xb7064f63, 0xf9e27ae7, 0x65a3a4bd, 0xe5f5d10f, 0x64eea4f1, 0x7f121ff4,
+       0xe778a3a9, 0xc567fcb5, 0xaff0086e, 0xea8bfa18, 0x313cd4e2, 0xbc1f6fc5,
+       0xb6ab6b96, 0xabbf448e, 0x1ecafc84, 0xac2cf606, 0x3a7b44e9, 0xb61ff292,
+       0xad83bae1, 0x76bfba6a, 0x7d66daea, 0xa0d97602, 0xf6051805, 0x2d53b83d,
+       0x0cd97bdf, 0x952ed768, 0xcccfdaed, 0xf4097cf6, 0x488d73af, 0x866473e7,
+       0x27d31f91, 0x5bcfbdcb, 0xbb24ef92, 0x426498e1, 0x8786687f, 0x668ec1db,
+       0x7b56d76e, 0x2a63ff92, 0x6acdedda, 0x8a60d4cc, 0xed94e21d, 0xddb2d390,
+       0x80cd7a7b, 0x4e9bfc86, 0x8c963d81, 0xbb5b2a79, 0x33b9e112, 0xb3d91673,
+       0xec99a94e, 0x83db6589, 0x6fb007ed, 0xcf55ea82, 0x7217da85, 0xdc13cb7c,
+       0xdb87f8ae, 0xc67643ac, 0x0a67f438, 0xc871a9a5, 0x78c82f0f, 0x959bfc55,
+       0xb7942de3, 0x9e6551b3, 0x1021c4a5, 0xfb9d355e, 0x6edf702b, 0xfc859847,
+       0x10af558d, 0xe4bffb5c, 0x3c7f4c7e, 0x33f47823, 0x36fedf0e, 0x6a35e74e,
+       0x48f98dc1, 0x34b64035, 0xaf704e9f, 0x6bb338c1, 0x13e48230, 0x17c8c563,
+       0x7f70162b, 0x5f3186d5, 0x7e156b28, 0xb7abd108, 0x54527ca8, 0xb3689c80,
+       0x02bf50a6, 0x3ea3b30d, 0x90b4695b, 0xe3a31b7e, 0x6ae17a76, 0xc3d2364f,
+       0xb5c7f018, 0x31f8f101, 0xfb010186, 0xc7807eed, 0xc27895ff, 0x1d49951c,
+       0x191fa015, 0x95fd435b, 0xf0a241f9, 0xdf9ad7f1, 0xfc1bf304, 0x23bc03f3,
+       0x585fde11, 0x93b7a42d, 0xfff728e6, 0xca97c4b5, 0xbd002e79, 0x63181c61,
+       0xc7378834, 0x9fc837ce, 0xf5eeb273, 0x8228ae38, 0xf708a3ef, 0x5e30f583,
+       0xe79651fe, 0xbcbc79b1, 0xf9152e4d, 0x7b6790d5, 0x95f50adf, 0x593ff679,
+       0x8899ae49, 0xb4ca573e, 0x9c4cf602, 0xbbf9186f, 0xf0891de2, 0x03f005fa,
+       0x5ac2fbf2, 0x64169cc1, 0xaf3a712f, 0x3cec4de1, 0x454ef4f3, 0xdd6cb838,
+       0xc6d79819, 0x5a2d7f38, 0x05a737a5, 0xbd2007de, 0x0251ffa3, 0x2fd1f2ff,
+       0x5372bfe3, 0x57946dc5, 0x8cd62ab5, 0xc83517f7, 0xa6d7290f, 0x87ba50ff,
+       0xb7a44edf, 0xa0b5a66a, 0x0b69a97e, 0xa1516e7d, 0x084dfe3d, 0x74c9245f,
+       0xe81768da, 0x5bf1bd7e, 0x95a38f15, 0xbb37140a, 0x4e911a0b, 0xcafd87e9,
+       0x7e71b9a7, 0xfba0b3cc, 0x391886ae, 0xee862bef, 0x9f227ee1, 0xf7952eff,
+       0xa3efe40d, 0xc6324f6a, 0xf93a8e71, 0xe602d53d, 0x52dd7ba1, 0x6f654dd6,
+       0x2f01f578, 0x8d1aee4d, 0x7607f87e, 0x1a91c52d, 0x511936d7, 0xb5b166ce,
+       0x031fbc26, 0xfbee7936, 0x1bdb2bdc, 0x9468f7a1, 0xc7e7959f, 0x92bccaf3,
+       0x83a03cf8, 0xf8a38033, 0x57c7cb9c, 0x02207fbd, 0xfefe7ee1, 0xca7ef3fd,
+       0xb9020fd0, 0xd654f305, 0xbdd064b6, 0x67758b8c, 0xabf1fbe4, 0x1fc153e0,
+       0xf08399b4, 0x0eb9670a, 0x0d9f33e0, 0xd36e63e4, 0xc0a9f0b5, 0xf03d4939,
+       0xe8250463, 0xa1439231, 0x5ee05678, 0x3cd56acd, 0xeefb56fe, 0xb3ffe802,
+       0xed19a2b5, 0x7ef0cbca, 0xf578fc0d, 0x28d791fc, 0x257b3f90, 0x5a78297c,
+       0xff54bcc8, 0xfb8f8a30, 0xf144a170, 0x7c69ffc3, 0x4bd9e435, 0xb7c2aef2,
+       0x257a7ca1, 0x2ab45cbe, 0xf8437f84, 0x2d2f8874, 0x7f002ff0, 0xc41155f6,
+       0x1d7e0a8f, 0x5193f066, 0x2d1875ff, 0x3e39766e, 0xfdc5dfd1, 0xec0ab654,
+       0xf087e149, 0xe3fc8fab, 0xad017c50, 0x541f50d8, 0xa9f305e7, 0xc92bc782,
+       0x7dee452d, 0x4d47bcc4, 0x7067dd02, 0x9685fe3e, 0xfb94e9f2, 0xe2dee50c,
+       0x6fae3cd1, 0xc08fcb42, 0xa27bc16e, 0x233d194d, 0xd5ebded1, 0x7bf0f328,
+       0x74d68fd7, 0xcd7cc68f, 0xb2f1a68f, 0x4cf3c357, 0x8c2dba94, 0x4a3f03c7,
+       0x6e10bad0, 0xa6e3091f, 0x91f01da3, 0x783bcbf0, 0xc6634e3d, 0xe9b882fa,
+       0xaaf7a826, 0x83e1f895, 0x5376fcb2, 0x0982d1f9, 0x604fd405, 0x661e1047,
+       0x3ad09581, 0x0c5d1082, 0xe7e8f9fb, 0x5ef07363, 0x03ff3940, 0xf48e3c79,
+       0x431cf91b, 0x095ff6f1, 0x045f6f14, 0xf784c3aa, 0x289fd302, 0x93f6814e,
+       0xa6cd4ebf, 0xc115cafb, 0x4dfea3eb, 0x56e538a6, 0x4b96e79a, 0x99c5ea03,
+       0xe90d7dfe, 0xbc8b82cd, 0xa0d8c97d, 0xf45b667c, 0xbb27ee38, 0x8f512353,
+       0xf06d7a29, 0x60437ed8, 0x1cacf51c, 0x8faa1e77, 0x5029247b, 0xf7b1be2f,
+       0xa79c74e1, 0xb2cae35c, 0xf98f3018, 0x1fb424a9, 0x943ef7ca, 0xdeed764e,
+       0x9fe8e98d, 0x9c3d3794, 0xb87aa36e, 0x1523fc9d, 0x7df9f73f, 0x0a6d7693,
+       0x9d6fa3b0, 0x52fbedc0, 0x68851bdd, 0xf1bacedf, 0xb71875f3, 0x816bfb1f,
+       0x590b70e2, 0xb7d43af7, 0xaf9c1965, 0xe48e8358, 0xf747cc3f, 0xddc67ba4,
+       0xfee51bbe, 0xabbf8cf1, 0xcdfea097, 0x657cd153, 0x0e39bdcc, 0x041b6fe3,
+       0xfbf9bf8a, 0xd77ba68f, 0x4d056bc5, 0x51ea0c7c, 0xc7fd779e, 0xe38228bc,
+       0xbbb21b3d, 0x356cbdb0, 0x75a59f6f, 0x3ce0f6b7, 0xcf28684f, 0x4a65140a,
+       0xf63dc049, 0x3df8f31f, 0x72cda2dd, 0xcebcb1be, 0x8db16dd8, 0xa3fce781,
+       0xfe567f8c, 0x3b83c901, 0xb6dcbc65, 0xf123bdfa, 0xdaa46f30, 0x2b9467fe,
+       0x3a7e3eef, 0x4159e50d, 0xa44cd9f4, 0xfb1ab1f3, 0xee781593, 0x2bc52d26,
+       0x528959ad, 0xb9cff41c, 0x5863da7f, 0xf8bd5a2e, 0xfb8c0ac9, 0x1f91d76e,
+       0x856feca6, 0x5fd11660, 0xd3f8dc3d, 0x676e107b, 0xa479e71e, 0x8faf1a2b,
+       0xe2fe5abb, 0x1f3c75b3, 0x1d3af9fc, 0x99d42f95, 0xb88e1998, 0xea9e2eaf,
+       0x5333afbf, 0xfa73e6c9, 0xaea6f252, 0xa5ee5f34, 0xb65bca30, 0x1e51d06e,
+       0xf6d6ae7d, 0x6bc01e55, 0xa6ce0dec, 0xc6b9f28d, 0x576cf8c2, 0x83840cf2,
+       0x2ef2e375, 0xe54f6134, 0xedeaff71, 0x64490d9e, 0xf53eaf87, 0xcf3c054c,
+       0x0ef92fcc, 0x5e76ebc7, 0xe1c178a4, 0x10ca87f6, 0x5a4de5de, 0xdcf93e7e,
+       0x8f4f1e67, 0xbce3127b, 0x7fc9a96f, 0xea79d9af, 0xde508d99, 0x26b979bb,
+       0xe87fde90, 0xf795bf79, 0xbabe2d73, 0x75fe1c12, 0x89387abe, 0xf809a7f8,
+       0xe7dff32a, 0x6bd59aab, 0xf3737e08, 0xc3e6c64b, 0x5da8cffe, 0x674fc849,
+       0x744cddc6, 0x0814eaee, 0x571c8afe, 0xf3e6a7c6, 0xd12ae8fb, 0x48ec99b3,
+       0x057f8e59, 0xf7c2239e, 0xd2cff68d, 0xaafe8ed1, 0xcf55c16d, 0x3d0eb07d,
+       0xe99b8c22, 0x9e7d0ca8, 0x62a7b1af, 0xc8be715e, 0xe7d0e7ed, 0x712be7b7,
+       0xc5b71e78, 0xa790109f, 0x458d84e2, 0x13fea346, 0x972061bc, 0x9eb76d9d,
+       0x06ffa155, 0xc1c7e17e, 0x38fb2876, 0x695faf40, 0xab2ad7bf, 0x5f951e71,
+       0x50f84eee, 0x3d00de64, 0xc617c93e, 0x0eeb01bc, 0xa6d02bf9, 0x049efba1,
+       0x37880b92, 0x6bea87cc, 0xf584d71f, 0xc78e1ab3, 0x97e083be, 0x930cb8f1,
+       0x3ce7fdf2, 0x0b3e7edb, 0x79e86ce5, 0x4f395fab, 0x7b68e1f4, 0xe740a2e8,
+       0x9556799f, 0xbff3ed75, 0x167cf7b1, 0xdaacefe2, 0x57fe8f97, 0x8597c69f,
+       0x957ea878, 0x157ff3cb, 0xc57b4a0e, 0x138f0d06, 0x23f2260a, 0x140ba50b,
+       0xc63be807, 0xedd500e3, 0x0e9e48bb, 0x4c78f076, 0x145dd88d, 0xda8bf187,
+       0xcf285d53, 0x5fb9e306, 0x28dbf306, 0xd65521cf, 0xa481aa83, 0x1ed72039,
+       0xee07a219, 0xfe419e0f, 0x1e3ce0d5, 0x6561e507, 0x2bb43385, 0x433f21ce,
+       0xe4aad97b, 0x67e748f5, 0x507323dc, 0xf59dbe3e, 0xdf8a6a8f, 0x926e1ebd,
+       0x30958ec8, 0x4e0878c7, 0x4b70e743, 0x2987d13c, 0xb3387176, 0xd1abf405,
+       0xbf24ef98, 0x9fbf38fa, 0xf381b9ab, 0xf3857b13, 0x1bed7393, 0xf980f89a,
+       0x93f3257e, 0x7ace4f62, 0x97c41ffd, 0x9edae70f, 0x470cbe40, 0xc5f38859,
+       0xb51e5247, 0x72871ef2, 0x90e8691f, 0x8962f8fd, 0x49b4d79e, 0x58e5ef0c,
+       0x0af291bc, 0xca16d98a, 0x3cc59cb7, 0x8f5e7953, 0xf029d1ef, 0x52ebf67c,
+       0x81a1e62e, 0xdbf74d3d, 0x34f66145, 0x15ead3cc, 0x1eae1905, 0x7d009ceb,
+       0xf73e7ef6, 0x024aa757, 0x8481b1e9, 0x6653b270, 0xe29677ce, 0x5a7e957e,
+       0x9833eb91, 0xe62cec87, 0x7bc2c81e, 0xc81de655, 0xa556fbc2, 0xc3d7bcdf,
+       0x322f496b, 0xc05e758f, 0x79f3a73a, 0xbc0bf3bc, 0x5279071f, 0x16c3df23,
+       0x436edf4a, 0x27456b7f, 0x15ec7fbf, 0x3cc03f93, 0x19c01733, 0xf01e7af1,
+       0x63fd436a, 0xf21b3667, 0x6e91f8cf, 0x7d9a9fe4, 0xbd7cc302, 0x136d76ea,
+       0xd5aa85c6, 0xe7a458be, 0x6bef6d8d, 0xf06b9e90, 0x8e3c765e, 0xdcbc7267,
+       0x35bf7944, 0xf5efc626, 0x00ffaeda, 0x63ce76e3, 0x553a8b5c, 0x003c51ef,
+       0x57ae36e5, 0xfe42dad5, 0xc97983bf, 0x073477ff, 0x3c60cdd3, 0xf287e78f,
+       0x737ce9c9, 0xdccc7f10, 0x1e63f9ce, 0x681b73e6, 0x675fc538, 0x5d91c7c6,
+       0xf1c71fe2, 0xafce9360, 0x3fa63b43, 0xfc7ca045, 0x5ad730fe, 0xe95c8fb4,
+       0x7fe9aedc, 0xbd2b05ed, 0x5b73a3f7, 0x3cf98c7f, 0x733bddb2, 0x149556c3,
+       0x1d999fb0, 0x1fd8de3c, 0x120fcac6, 0x21d7edde, 0x25b97c3e, 0xbe31f267,
+       0x777819a3, 0x4483c60a, 0x3d0d1f1e, 0x6b8e5d87, 0xfdfc671c, 0xb3df6528,
+       0x3cb91313, 0xa3a26e63, 0x5bbf392e, 0xc651d7c9, 0x504132df, 0x9fb8d1ee,
+       0xfaae5824, 0xd7de1a5e, 0xde2b9e60, 0x3bf960d7, 0xef161f39, 0xa2feb06b,
+       0xf78b0f9c, 0xf78ed835, 0x956f5835, 0xbef161f3, 0x5f78eb06, 0x722be583,
+       0xdc71ec3e, 0x6df1e52a, 0xa2e90a7c, 0x946d790b, 0x1d1bdebf, 0xdc151f52,
+       0x085a37bf, 0xa8128fae, 0xc6c269bf, 0x78ff30a7, 0xc52f9293, 0xc3b446cc,
+       0xfbf9c22a, 0x7b06a91a, 0xf3f404ec, 0x45ed778b, 0x9bf81e7f, 0x882b9fde,
+       0xef4a505e, 0x1968c497, 0x27dba3ca, 0x804f47d8, 0xcd8ec7f1, 0x724adb48,
+       0xecf74f52, 0x31bb3fbd, 0x6f7ae292, 0x25824c49, 0xaee465a7, 0x9a7d42b5,
+       0x85fa2041, 0x512a6ef9, 0x67984cfc, 0xab62c746, 0x1307cb8a, 0x9285cbda,
+       0xb3ae0963, 0x8b9f4122, 0xd588f872, 0x51fb819e, 0x6a345de0, 0x45da1a59,
+       0x07f36a5d, 0xbd759f18, 0x57e866a3, 0xa53c7129, 0x69d693df, 0x99bfb8f9,
+       0x736ba919, 0x36607e70, 0x0d367794, 0xd9fdc66b, 0x9ea170c4, 0x855997e4,
+       0x027f20f2, 0x66e99ba7, 0x357b1f6e, 0xfa345566, 0x62d361f5, 0x4bb75ef0,
+       0x1931f3c6, 0x3c65c7cf, 0x81573de3, 0x6173df8a, 0x585cf789, 0x2da3e686,
+       0x4db12fcf, 0x240f7820, 0xcdb3e605, 0x0097df92, 0xd4f7a10a, 0xf31c729c,
+       0x34ee594b, 0xcadc95e6, 0x9e6879c7, 0x778e392a, 0x6f7c1d5e, 0x8ff38ca8,
+       0xbdce5467, 0x166bcb89, 0xbf79e1a9, 0xe61731d7, 0x397dcf15, 0x7d50e281,
+       0x06a5d16e, 0x5e05cfbc, 0x5ec67947, 0x8b2efee6, 0x77337ce7, 0xabf51c7f,
+       0xcea9e397, 0x7c74eee8, 0xe64fa3af, 0xf07ea52f, 0xe4979e3b, 0x81ba81cc,
+       0xf3a123de, 0xa776e739, 0x4fbd4147, 0x5f488bd0, 0xbcfe26ce, 0x673fe647,
+       0x7c9f3c8a, 0x24f3a61e, 0x3bfa3e21, 0xf7c24e5f, 0xbc193710, 0xf7fcb94b,
+       0x66dc93a6, 0x6fcc74de, 0x4e782f3a, 0xadf1be62, 0x98a5296d, 0xed5e7f6f,
+       0xb3eb0679, 0x5d78d2db, 0x0a693968, 0x93d23e7c, 0xb7c8f984, 0x6296a5b6,
+       0x91f9f23e, 0x5944cf2d, 0x97eaea02, 0xcd73e24e, 0x98a56983, 0xeb5b3c9f,
+       0x7487563e, 0x5f4e7bf3, 0x4e077dfa, 0xdaaa7c23, 0x7d3efdb9, 0x2f0b81df,
+       0x603e7ea1, 0x7582bca4, 0xdf099213, 0x6ecfedf5, 0x6beb7a46, 0x6c3f1351,
+       0x99ff7e6a, 0x2d3f50df, 0x6b665985, 0xc90c563d, 0xba1db494, 0x3b35f71b,
+       0xd625f3dc, 0x89bc4f17, 0x047b31f6, 0x13a5ebe7, 0x4f914a73, 0xfbec0efb,
+       0xd9b3ea05, 0xe2d86091, 0x13d05e7e, 0x8ff72a7e, 0x40b8c02b, 0x0cbbb19f,
+       0x9dfeafe7, 0xec1fe796, 0x718e9b8f, 0xc09cff82, 0x6e2a31f3, 0xfa8492d8,
+       0xf9e57c56, 0xf8c1bfbd, 0x74f4efe6, 0xcd1353df, 0xa94abded, 0xe1397f31,
+       0xcc5ed76f, 0x5e7be95b, 0x15aff74f, 0xe2b39318, 0x2963ac7b, 0x3feaff3e,
+       0x78865eff, 0xee769428, 0x772ff6c5, 0x438445eb, 0x7916c68f, 0x8f61f233,
+       0x0acefc9a, 0x3bd15eb9, 0xdc27ef82, 0x8bf84457, 0xfa8492d9, 0xafc472b6,
+       0xcf7dc0ee, 0x833cb696, 0x567b0f7e, 0x670e774b, 0xc1b8079f, 0xd47bb3b8,
+       0xfb034998, 0x5e90aa30, 0xca5b0bce, 0xf7f9c49e, 0xf5e77ef0, 0xae9e085b,
+       0x5c33d73d, 0xd431fa0f, 0xad85e7c7, 0xf767ed41, 0x7e859b3c, 0xcddfb9e9,
+       0xa154ff26, 0x2a5f8573, 0xf4836b77, 0x58824922, 0x3fca5b8c, 0x02198b93,
+       0x0ee759e2, 0x927be8ee, 0x6b9fc7f9, 0x00357b56, 0x5b2d0aa3, 0x0acdf98b,
+       0xde26543f, 0xabe78c5a, 0xd1d31b14, 0xf5c8a97e, 0x9c5f2195, 0x3c5d33d5,
+       0xd65b7bf4, 0x6bad955b, 0x7c1da0e6, 0x45fcfda5, 0xc95f4796, 0x9b55f87c,
+       0xdf781dde, 0xb5fe5a18, 0xa84f998e, 0xb585f5fc, 0x95e5b25a, 0x78d6def9,
+       0x55afe81c, 0x71f97347, 0x8337fa12, 0xac93fb1c, 0x0aad16ef, 0x04eeffee,
+       0xad594f9e, 0xfea3a5f1, 0x7b7fe653, 0x87db8982, 0xca3a5f2a, 0xb371d0ab,
+       0xbcde5925, 0xa9bc9020, 0xd14e156c, 0xd20824fb, 0x2b3c3f58, 0xe6372e75,
+       0x87870d13, 0x0f197cf8, 0x70f1e612, 0xd66caabe, 0x4f30f4db, 0x022f9855,
+       0xd18725ed, 0x50768117, 0x6b122bdf, 0xa317d192, 0x5fe29fcc, 0x5653894f,
+       0xfd36d478, 0x71c1eb70, 0x865e4fd0, 0x5628037f, 0x537ce44f, 0xeb4e16de,
+       0x1f2f9331, 0x677cb6e9, 0xa73c38f0, 0xfb1f8029, 0x06c576da, 0xf70cebfa,
+       0xa751f74d, 0xfffa6f88, 0x07bd31f9, 0xb5b2295e, 0x4e794f78, 0x4083efe0,
+       0x3907de9d, 0x5677df27, 0x43086d7e, 0x95f739fa, 0x4fb8f883, 0x7b9c91f0,
+       0x7246cdb1, 0x23ed4fac, 0x626bb739, 0xf947af11, 0xbd6e50ca, 0x24a7f138,
+       0x7c12fa3f, 0xd29ef865, 0x2f8ea566, 0xd01d81cc, 0xe490b6d1, 0xe7896cc9,
+       0x6a5db051, 0x71138f13, 0xe1932f78, 0xde86d8c4, 0xd443f23a, 0x3a97b466,
+       0x42f72a27, 0x25f9ff1a, 0x31f53f3f, 0xe456bef3, 0xc50372cf, 0x6abec07d,
+       0xc0ed097e, 0x8c16b105, 0x4dc287a7, 0x898c5fb9, 0xe22966fe, 0x7da31de9,
+       0xbc3cc4ec, 0x9f91f4cf, 0xf64ed401, 0x5a6bf57c, 0xd5fb37f2, 0x7e517b03,
+       0x71f68db9, 0x0e9e0113, 0x547af74d, 0xbed41771, 0x67ed342e, 0x1c91bd21,
+       0x97d6f4e1, 0x07bf8bb9, 0x4e4fdf22, 0xfa00f192, 0x7d22358c, 0x87cf1c08,
+       0x409ff6db, 0x9dd7d379, 0x943a724a, 0x3db6ce9f, 0xe3728116, 0xaeefd043,
+       0x87c07880, 0x7ca59f8b, 0x0798f980, 0x6b3de502, 0xf837cf83, 0x2fc98fed,
+       0xda039b64, 0x821b1e91, 0x4170a1eb, 0xf106f4ba, 0x7df68b81, 0xc01bf23f,
+       0x777a6aa7, 0xa861c235, 0x52ea173e, 0x4850fd40, 0x2b3fa43d, 0xfdc3f6e1,
+       0xebcd1813, 0x25eded18, 0xcf1f7e3f, 0xbd07adef, 0xe103f546, 0xee2d3f74,
+       0xc315bd03, 0x8bea16f5, 0x8a6e88aa, 0xd01df55f, 0x83cabdd2, 0xe1259fed,
+       0x291e81f9, 0xfed5534e, 0xf7fa2c72, 0x699826eb, 0xb18fd07e, 0xa0731794,
+       0x11fd163d, 0x7a21dda5, 0x0cf7e5d2, 0x287e50b2, 0x9bc94eed, 0x42e5794e,
+       0x5f3e1677, 0x8719cb27, 0xeb097508, 0x10e1ce8c, 0x76b3df38, 0x287ce489,
+       0xf4c956de, 0x8b21f20a, 0xe15e39f2, 0x1e4503f1, 0xe572c854, 0x7267b610,
+       0xf72937fe, 0x84cf7852, 0x9c8c3f7c, 0x23815af8, 0xcef8a5ab, 0xbccd13fd,
+       0x79a78f2e, 0xe789fc79, 0x3e7abded, 0xc713252b, 0x45f79599, 0xd528f2fd,
+       0x0e505f2f, 0x781c93c4, 0xe70b1d50, 0xb0467caa, 0x8a90c3d4, 0xd04535d2,
+       0x2d532d9d, 0x1ab8a22f, 0x2e1ae7e6, 0x1d2857df, 0xf8e44e45, 0x1fb914ad,
+       0xa057b95e, 0x6a73a5fb, 0xf2076f7e, 0x580fde86, 0x08a6b056, 0x18beeff9,
+       0x5fd026a7, 0x4bfcd6be, 0xcbeb821b, 0xc514d76a, 0x95e7c30d, 0x8d76b6ab,
+       0x57cf9764, 0x8a2c6f61, 0xaede5f35, 0x5e9cfbec, 0xf574e7d9, 0xcc7840c8,
+       0x1234535f, 0x7fba65ca, 0xdcfc1e17, 0x5eb5dae7, 0x5d2d57ca, 0xb7c4f743,
+       0x8a0daa5c, 0xbe6b5eb3, 0x7ba6e60a, 0x3fed2b90, 0xde0874b4, 0x312b8c5e,
+       0xc43dafe0, 0x0137c067, 0xf4cbc5eb, 0x289f143a, 0xfd063c5f, 0x3c5f6653,
+       0x113e3026, 0x339be25a, 0xb88ae522, 0x2c3e04a8, 0x0f030cb3, 0x89d1ffa5,
+       0x3f1ace3c, 0xa8f1d391, 0x5e3b55d9, 0xe9d71462, 0xa57bf941, 0x22fe4cf7,
+       0xbf07efef, 0x9c233267, 0x9bd4ebf7, 0xdfd3fe30, 0x87c50df9, 0xe619d7fb,
+       0x03077bf3, 0x5de7804b, 0x029be3f1, 0x26abc0e3, 0xdc243b71, 0x9a9dedca,
+       0xe3d5f50c, 0xa1c6994b, 0x1bd912f8, 0xdf74e199, 0x05f6d7d2, 0x8efeb7e9,
+       0x8bde133c, 0x0dbb75f4, 0xff356fc8, 0xa8b17ffc, 0x3e3afb87, 0xbeb4bca5,
+       0x7ca33f6f, 0xde728db5, 0x3936a1e0, 0x6cdbabdf, 0xe2fef6c4, 0xbf6117bf,
+       0x8fe9724d, 0x98f8f02f, 0x83f12a52, 0x3bf9ff00, 0x4c7b53d4, 0x54c51f1b,
+       0x2db0ca99, 0x7fc0bf24, 0xe1bd468e, 0xe3982b8f, 0x04c38b86, 0x54d215c6,
+       0x2580ae3c, 0xd2d215c6, 0xeb015c78, 0x12c05718, 0x8ed80ae3, 0x63ac0571,
+       0x18eb015c, 0xc63ac057, 0xb8c4b015, 0x297fb602, 0x0fd1e7bf, 0x3dc78b82,
+       0x57f7240d, 0xc0337e62, 0xbf27656f, 0x47b95abf, 0x7c617ba2, 0xdff503cf,
+       0xad3b7965, 0x678ede72, 0xd607dd2b, 0x882c901c, 0xc41f7c22, 0x3bf98e95,
+       0x1e314703, 0x5822d354, 0x7db198d6, 0x6363ed3e, 0xa507de47, 0x6d47bed8,
+       0x4f44cd11, 0x828d9f1c, 0xd57c8f5b, 0x57e287b1, 0x949d7105, 0x2cd35fef,
+       0xcebb8c30, 0xd93f72d3, 0x0e6b4129, 0x1d92abdd, 0x9376d4ed, 0x9cf552ff,
+       0xef7c0e60, 0x45e266bb, 0x7dca1392, 0x88fe52f5, 0xf37a3d39, 0x6b3d2092,
+       0xf85779e3, 0x29c7ec27, 0x1d9377e7, 0x2d176012, 0x6c6c7bc5, 0xf7a5be97,
+       0xe0e09c4d, 0x9dae108e, 0xd1d95577, 0xb5f31eb2, 0x55fe687e, 0xdef924e1,
+       0x47bf9b3a, 0x92f8fc52, 0xbd60077d, 0xb25a2dc1, 0x609f6e53, 0x1e526dbf,
+       0x28d819e6, 0x53b472ee, 0x27d67e4f, 0x8a0faf5b, 0xd74a14bb, 0x8563dc51,
+       0x7dfd205a, 0x3b9f6ac4, 0x4672e809, 0x6f14bdf1, 0x246f1199, 0xf0e8563e,
+       0x4fc96b49, 0xe315de70, 0x0a9877f9, 0x34e7ecb5, 0xa5cf9c9f, 0x5eb0a9e0,
+       0x2cf7e370, 0xbd0b3316, 0xc008b03f, 0xe5517187, 0x188b1ffb, 0xe850afcf,
+       0x8156c56a, 0xbcbe8ae8, 0x84bdf010, 0x103df845, 0x6af77fd0, 0x289bfdb9,
+       0xc4f27bf2, 0xe28f3c4d, 0xfca7663e, 0x7d486591, 0xd7d7e912, 0x0f6ed07c,
+       0xdb892ebf, 0x9c38e6f7, 0x3571f17f, 0xc61707e5, 0x276e9edd, 0xf9405f3d,
+       0x6ef78213, 0xaf1bfbe9, 0xf3833f26, 0xb9aa8e27, 0x927801dc, 0xf485d59f,
+       0x3b1ef14a, 0xcaebc795, 0xbf229ca9, 0x5efa161f, 0xcbe77f43, 0xb0be382d,
+       0xf84160c6, 0xc03df15f, 0xffbfabb0, 0xebf394e6, 0x5c9ec512, 0x6be3c233,
+       0x51e10583, 0xef49d718, 0xf3caa589, 0xb25b9c3f, 0x8b69f109, 0x1f5c2e60,
+       0x00b669ef, 0x40f08b7c, 0x3dd1c602, 0x66cf7c36, 0x513053a0, 0x7265f53e,
+       0xcc3aeb74, 0x1349a953, 0x2daf184c, 0x1852db0a, 0xa517f30b, 0x7677d324,
+       0x1c78da6a, 0x4e4a0fb6, 0x92dc5307, 0x62aac7c0, 0xf1cf7e31, 0x3fb5cbe8,
+       0xdfcf293d, 0xb3e65b3e, 0x782f8efe, 0xe3b5f11e, 0xfbe9bbb4, 0xef4f4c1c,
+       0xf60fd3af, 0xd1c6fb35, 0xe855af14, 0xae39b068, 0x45a8e909, 0xa5a513d6,
+       0x8ed1a9ef, 0x37b3cc68, 0x96ca1c23, 0x4b175c5c, 0x4e3e1ce7, 0x87dfe4a6,
+       0xe502c9c6, 0xde46ffed, 0x5aba89fd, 0x5baddf2a, 0x9d776545, 0xe8079e8b,
+       0xbf08238b, 0x7d6f101f, 0xf130d27b, 0x4733a656, 0xbe05be92, 0x90edf1e7,
+       0xbbf02af8, 0x33efc018, 0xd9eea23a, 0x8348f680, 0xcdf782c6, 0xd2bcff98,
+       0xfde1f240, 0x59c6c349, 0x2819f815, 0xf4c83b2e, 0xe9878839, 0x112aa919,
+       0x926dff9e, 0x44e71410, 0x2273c1be, 0x7c8960df, 0xf9f952a3, 0xa30d69e6,
+       0x7da194ef, 0x40fb22e0, 0xbf5df84f, 0xd40ae406, 0x20a665ef, 0x442172b9,
+       0xf32380ae, 0xac5f7a33, 0x0936cb43, 0xe9cffcfe, 0x19ca5c50, 0xb878ce46,
+       0xe61d199c, 0xb3be9e79, 0xf9461d50, 0x44efc0c5, 0xf2374767, 0xac25bdbc,
+       0x461dd684, 0x3e7bd0de, 0x38188ef7, 0xbff414f9, 0xd90361f7, 0x9613eb39,
+       0xe477ffe6, 0x71279fcd, 0xdf813c78, 0xed5d5073, 0x059b0e7b, 0xb15d8fbc,
+       0xbe236590, 0xc439ef95, 0x7bf218c1, 0x39eff5ff, 0x123c988c, 0x0ae0e7bf,
+       0xdc439efa, 0x30e7be15, 0x6171b26a, 0x461cf7e0, 0x30b11e4d, 0xc60e7bf8,
+       0xb29df885, 0x39efc1ff, 0xbbce4fa4, 0x370e7bfc, 0xa0ff364e, 0x3d8039ef,
+       0x4fe3899b, 0x63c6d8e4, 0x3b9f2899, 0xe3e5fdf4, 0x97643df2, 0xb2c52f68,
+       0xa2a5c228, 0xc56dd176, 0x73d16df2, 0x5f03b63f, 0x1578444c, 0x037d963d,
+       0x5125977e, 0xf2bca1eb, 0x49b6ad27, 0xb96bff38, 0x3cf8c9b6, 0x2f5fde34,
+       0x73f60f9f, 0xcd0bf60b, 0xe2e8531f, 0x0e5cc9ae, 0xa9cb93cd, 0xc7bfc3f5,
+       0xbf326f3f, 0xbed6be4f, 0xe077bf61, 0xd9feca7a, 0xdc56c596, 0x4ef7ec0f,
+       0xb7ec27dc, 0x88664b04, 0xf80f7a0e, 0xc9757a72, 0x2e7462fb, 0x3fb38f90,
+       0x9528f6e1, 0x14772ae9, 0x1ea30dda, 0x7ee14770, 0xe80e3547, 0xdf907df1,
+       0x68f406ba, 0xf576fc3f, 0x7fdb1e80, 0xdaf9e36b, 0x9f6ff3a1, 0xf491fdcc,
+       0x7e3403a9, 0x4dddfc0c, 0x1440c1fe, 0xe5e96dda, 0x14ae3447, 0xf66d4f7a,
+       0x93764127, 0x8c7bf899, 0x01e636dc, 0x8c3d2191, 0x1e78c1d9, 0xe90c4163,
+       0xef1d4ab9, 0xfdc0f95a, 0x38d1d222, 0x803bec37, 0xaedfaefe, 0xaf7e0c1a,
+       0xaae34bd7, 0x5ec025e4, 0x64ee7a0b, 0x9474bf3c, 0x5ed08f2c, 0x39d9efc4,
+       0x77d08fcb, 0x0b8ec0a6, 0x79be8f99, 0x594f9430, 0xe6bfb3ad, 0x62be5333,
+       0x77a5bf50, 0xfa3d66ff, 0x5ba5e5b5, 0x2f17e435, 0xa58f5969, 0x269ef1c3,
+       0x197d918e, 0xcbec1fd4, 0xfb65faa0, 0xf547d90c, 0xc7d717fd, 0xd02eb30d,
+       0x13a456c1, 0xaa8e0e85, 0x4fd0e33d, 0xb30cea3d, 0x3c1df7f0, 0x269a5df4,
+       0x5df4bdf9, 0xcadd39ff, 0x5d3965f3, 0x3f1df8c0, 0xa9ea8e8c, 0xaf1df2bf,
+       0x1c8a956b, 0x8dcefa1c, 0x5e28b986, 0x7248cb39, 0xfff646ae, 0xc89897aa,
+       0xbaf8511e, 0xb539e55a, 0x18c5fb1e, 0x8a9bfe79, 0x7aabf7d1, 0xcf9451c4,
+       0xcfac3f4d, 0xacfba54a, 0x178f7ad8, 0x5db81de7, 0x15b9efa0, 0x5ab97384,
+       0x9e389628, 0x4447e785, 0xa7815dfe, 0x98487e51, 0x37bfc147, 0xbf972530,
+       0xf8cf103f, 0xca98db77, 0x369df21c, 0xed7a1e39, 0xeff1b4ef, 0xf7e7cd92,
+       0x25510d72, 0xf9f1cba5, 0xf9e81b82, 0x1f52efc1, 0x2afee2b1, 0x71b4ef94,
+       0x4e61bf7b, 0x557f3d06, 0x3d41af30, 0x5d807ae1, 0x7a6d3be9, 0xef80fbe4,
+       0xf887bdb3, 0xd9f7d6ba, 0x1c0fef94, 0x23c3705d, 0xbd1c397b, 0x3355ef78,
+       0xafe418cb, 0x3c3117ff, 0x56c0d29e, 0x000056c0
 };
 
 static const u32 tsem_int_table_data_e1h[] = {
-       0x00088b1f, 0x00000000, 0x51fbff00, 0x03f0c0cf, 0x33b3af8a, 0x21716830,
-       0x9f0143f8, 0x38606664, 0x8167c40d, 0x81859798, 0x818997c1, 0x78898fc1,
-       0x10c533fd, 0x0611416c, 0x5e203b06, 0xf0c0c42e, 0xce21044e, 0x10c0ce28,
-       0x20c0ca2d, 0xafe10a2b, 0x6266d204, 0x40ff71d4, 0x4c194663, 0x089207b1,
-       0x79161336, 0x268ccc64, 0xca8520ef, 0x7fa02167, 0x2517f1a0, 0x22acbe54,
-       0x8a846e84, 0x9793457f, 0x432bca83, 0x094df5fd, 0x502ab9bb, 0x1aa00079,
-       0x03605f82, 0x00000360
+       0x00088b1f, 0x00000000, 0x51fbff00, 0x03f0c0cf, 0x3370278a, 0x45e39c30,
+       0x8381e9f0, 0x5fd32918, 0x50c0cec6, 0x4055c401, 0x3f880bbc, 0x7c3032b1,
+       0xff5e2566, 0xdb042935, 0x21818248, 0x88d7881e, 0x49a83031, 0xa41dc422,
+       0x03261819, 0xb150a1f9, 0x5f3a4047, 0x0f77328a, 0x80a69c16, 0x872ae629,
+       0x9163a760, 0x6819c647, 0x50e54bf2, 0xf40499f9, 0xa2be340f, 0xa2ffca8e,
+       0xa013a10a, 0xe4d157e2, 0x3be542bf, 0xa6bafea0, 0x4edcdd8e, 0xc35dfd32,
+       0xfc01a102, 0x9847b099, 0x009847b0
 };
 
 static const u32 tsem_pram_data_e1h[] = {
-       0x00088b1f, 0x00000000, 0x7dedff00, 0xd554780d, 0x733ee8b5, 0x49999cce,
-       0x21264cce, 0x61021309, 0x40a02092, 0x200c7e18, 0xf7f09d78, 0x803aa568,
-       0x07515a56, 0x43f21081, 0xbd1f5202, 0x24266bed, 0x1bd568c1, 0xab45a8fa,
-       0x68a90076, 0x62348ed1, 0xa80740a8, 0x0db6a85c, 0xc7f42ad6, 0xc405ad1b,
-       0x96aa4490, 0x6bb94abe, 0xe64fbdad, 0x4019939c, 0x6f5fb7bd, 0x6fd697bf,
-       0x67d9cfb3, 0xdfd7b5ef, 0xb5ed6b5e, 0x897628f7, 0xec650ee5, 0xc75dfe02,
-       0x319902d8, 0xf4a27576, 0x0d0ebbc1, 0x07f8adfe, 0xccdd2832, 0x2862b12f,
-       0x2f6e2cfd, 0xfc707281, 0xd65e9618, 0xf37e18c9, 0x959905f1, 0x3271e632,
-       0xb09417f1, 0xdaf2f5ee, 0x6d87b2b7, 0xd5b28428, 0x6cc653f7, 0x67aaed8c,
-       0x44f66181, 0xff57873b, 0x91c17e2e, 0xfa4870cb, 0x877560cb, 0xbb87c187,
-       0xb6e2e7a4, 0x8ef58c89, 0x7e2d8161, 0x5dde0718, 0xcffd059b, 0x316dec61,
-       0x704605e6, 0x8a50b85c, 0x4b8231df, 0xe73af8fb, 0x0ee76842, 0x00c55fad,
-       0x7334cf5e, 0xb9a26d7b, 0xf50d18ee, 0xa5fa8991, 0x6ca603da, 0x881de00c,
-       0xed5c03f0, 0xd79a4ef5, 0x81bdeb8f, 0xb6305761, 0xf547dea7, 0x2a7ef57d,
-       0xe923f5e3, 0x00fa81f9, 0xb05873d5, 0xeac7f090, 0x66ca2c36, 0x8536f1ac,
-       0x7412c7dd, 0x8c3d66f9, 0xfea24577, 0x222cd1a7, 0xa4fee4c3, 0x00423bb0,
-       0x132bc36b, 0xbca13a32, 0x7f41db1f, 0x28018d0f, 0x3fda26c6, 0xdce5f6bc,
-       0xcb181399, 0xdc91eafb, 0xbde00399, 0x46c616c4, 0xd2ad78e3, 0x9df031bc,
-       0xdbd1fbca, 0xeb6325eb, 0xed9a0f88, 0x65afdfc9, 0xf2cf0212, 0x7e60ac0e,
-       0x0f6bf437, 0x07013be7, 0x04c644b7, 0xb8c3065b, 0x186bec48, 0x111b32fb,
-       0x370e0089, 0x8c799761, 0xf342d0ed, 0x5f1cbbf0, 0x91230a48, 0x299c40c3,
-       0x2cab658c, 0x470a4b1c, 0x2b71c103, 0x4b0733fe, 0x0f4bd53f, 0x7ef571f2,
-       0xe711b2f4, 0xcee4e507, 0xde2c5b30, 0x77fbe197, 0xe862d242, 0xe7c5d9bf,
-       0x736302f3, 0x1249bc70, 0x12b9610b, 0x2dfa1299, 0x312732c7, 0xe5c60aee,
-       0x6173bae1, 0x547e8416, 0xc785985f, 0xfc837ef0, 0x6c8ca6fb, 0x1b7f9b9a,
-       0xda9443f1, 0x474ddb1b, 0x88b6fcb8, 0xedc7033d, 0x23ed883d, 0xf6c3163e,
-       0x39b6682f, 0x3b44b45b, 0x6e499e1d, 0x968b685b, 0x16c82fe8, 0xe5d3fa9b,
-       0xbe72764d, 0x81def9d3, 0xda9c809f, 0xc228fbe1, 0x3705983b, 0xbdebc127,
-       0x07a5be62, 0x3c06415d, 0xa3542ead, 0xafa9242e, 0x39eb0cb5, 0x0640594b,
-       0xe5eb4e1a, 0x0703b8f3, 0x3bcc49c9, 0x37c003e7, 0xfec01d94, 0x08e3e60c,
-       0xda03a8b0, 0x826b79ab, 0x1f4f5065, 0x1b02d5cc, 0x3672631c, 0xcdc473c9,
-       0x97a1c3fa, 0xfc13c7da, 0x00df1748, 0x0604ef5d, 0x41dba832, 0x78020ca1,
-       0xa83b8f1a, 0xe5dc8fff, 0xfd33b143, 0xf1f553bb, 0x3e414b71, 0xa61fd74e,
-       0x83beabb2, 0x63faeeca, 0x0f1aa654, 0x26c6d124, 0x60df8c03, 0x5dca2741,
-       0x075d12a1, 0xffee37fd, 0x218ff32a, 0x878823f8, 0x2d16cd74, 0x4e665e42,
-       0xf815cd59, 0xe12b7c45, 0x8e6ef9bc, 0xbdb3c45f, 0x866d0950, 0x2ad9cf32,
-       0x786d1aad, 0xfc40740e, 0xb87c1e97, 0x2ea4f101, 0x855ce365, 0x4f9c2f28,
-       0x97c89f11, 0x5f381abb, 0x284efd62, 0x029539af, 0xef1c5def, 0x53a9dada,
-       0xc06099df, 0x5c82c29f, 0x28bf39ae, 0x78c77ff0, 0x7b343a80, 0xbde82645,
-       0xbc077fbc, 0x9e7d268e, 0x906b95c1, 0x9e2adea1, 0x30ddebac, 0xabd27e23,
-       0x5079edc0, 0x97cfac1f, 0xf8897ff9, 0xfa04dcd8, 0xd57eeb09, 0x21fbc2af,
-       0x70e0f5a2, 0xca545cc5, 0x1ee7cb5b, 0x62bc6092, 0xa8fde3f9, 0x29d487de,
-       0xf41a776f, 0x6042c165, 0x86c622bc, 0x2f3f35ae, 0x30eb988c, 0xf3042d80,
-       0x3f316e2f, 0xd9dcce3f, 0x2e19d227, 0x80906e48, 0xbd5af37e, 0x849a45ec,
-       0xf58dde95, 0x0dd9ae2c, 0xf427a175, 0xdc99e4ba, 0xadf98119, 0x900592be,
-       0x449269c6, 0xefc56c78, 0x141e8f80, 0x7e96fde5, 0xac9952f4, 0x02ef50d9,
-       0xf4c983de, 0xd654be58, 0x56bc748b, 0xfd8bde9a, 0xe6312ba6, 0x54bf90d5,
-       0xfb6b13e2, 0xf1a14934, 0xa08e94d3, 0x14deeb8c, 0xb6adeebe, 0x9e51c6f7,
-       0x03f99756, 0x028f5c11, 0x4cdf9251, 0x5e50b358, 0x363c013f, 0x9363c389,
-       0xf5189c68, 0xdb2beb03, 0xbc38e122, 0xfa57d5df, 0x0d4a4459, 0x2d191fe7,
-       0x1698ec62, 0x3cfec4ce, 0x709ca492, 0x58d3e826, 0xb36ff451, 0xc372eaa1,
-       0x7513abfb, 0x7c739ddf, 0x4379c7c8, 0x772bf4cd, 0x7f2015d6, 0xb3628654,
-       0x7a4e7f91, 0x0edeba7e, 0xf602def3, 0x9ff80282, 0x61e50ce4, 0xea8b353f,
-       0xf30aa386, 0xe303a2e3, 0x1eb7b26e, 0x39824b07, 0x5ff48859, 0x0175cccb,
-       0x67dbde05, 0xf03b712a, 0x01f27da5, 0xac5c57b2, 0xc9c7eb8e, 0x07b43291,
-       0xef83239c, 0x455ef0ca, 0xdee78079, 0x75c32b60, 0xbccc39c4, 0x9b3c83ce,
-       0xb9b64aea, 0x5ccf4a9e, 0xf8ca5caa, 0x84069efa, 0xb267fc22, 0x995fe228,
-       0xf841281c, 0xf3e6bc1e, 0xaa67847e, 0x84a5d7c4, 0xde72e2fe, 0xbfb5ef47,
-       0x00361dc8, 0xf972b79f, 0xee4afb5f, 0x8f8809b0, 0x73979a56, 0x0b926ac6,
-       0x7323f115, 0x13b90ff9, 0xf878ebdf, 0x961bcf7b, 0xf4979a05, 0x5027f393,
-       0x6f3e363f, 0x9f9ea3f7, 0x7e3dbcf1, 0x366bd41d, 0x6df7a44b, 0x9f845cfb,
-       0x3d7947ee, 0xd88356ee, 0x5013ccfe, 0x3ad57c07, 0x8a9c1e3a, 0x665e7bf8,
-       0x0b3d085b, 0x4ecfa86d, 0x3b68f6e8, 0x78bb97af, 0xfef366b5, 0x8afbf1db,
-       0x7d430776, 0xf97bb35c, 0xbea1530d, 0x619db0fc, 0x0d6d9a93, 0xafa820ea,
-       0xac314a88, 0xf4e74cf7, 0xa392ec89, 0x8f7da0db, 0x66f723a7, 0x271dd70d,
-       0xb8008ff3, 0x37b91ddd, 0x46571f01, 0xdf8d9b9f, 0x0290ee55, 0xc7983140,
-       0xf07943b6, 0x5253cd5d, 0x5c7c01c0, 0xf99d3db5, 0x89e5f60d, 0x1d7e3936,
-       0x93cc19ca, 0x59cbbf41, 0x4fa46ceb, 0xaa0db6cd, 0xd39f40df, 0xdf9923f5,
-       0x3cd7a891, 0x77c0e305, 0x02959f2b, 0x3695c538, 0xef753f6e, 0xaadc2d76,
-       0xd41afce1, 0xd79c6ee1, 0x5bb62a3d, 0xcbbc5d1e, 0x36f847e5, 0x7de1b3ab,
-       0xd59ba3e5, 0xa85e8372, 0x640a3eda, 0xa6d700c9, 0x24e181e2, 0x0f01237a,
-       0x8953c133, 0xedd6867a, 0xa5768aa8, 0x2daa7cfe, 0x6ab1f893, 0x5fea6cbb,
-       0xd7e47ba7, 0xc887ec8c, 0x55e1375e, 0x2f6adba7, 0xa08eebe3, 0xa0af59db,
-       0x6a5bd2a3, 0x1f2f5fec, 0x50383a44, 0xfca97b5f, 0xca8fbd56, 0xa27ef58d,
-       0xbf8843cf, 0xc64edc11, 0x97d760e7, 0x827b2f21, 0xc3ec0bcc, 0xcb06e6b2,
-       0x0acf50ec, 0xa2ee7af1, 0xc8bfe4b0, 0xec12f5fc, 0x04e0c5de, 0x7afdfac1,
-       0xf63b0150, 0x8abc3521, 0xa6fc6005, 0x04ce08ff, 0x528ff77b, 0x4afa8638,
-       0xb82b85b6, 0x287cc5dc, 0xfac5eb77, 0x13f25db3, 0xa9e7d61e, 0xba1f6fa4,
-       0x2cab74ad, 0x6366b989, 0xf7fbfcbd, 0xbb3f5215, 0xfa151fa9, 0x3f74be29,
-       0x364fb7b9, 0x7b7b93f5, 0x01cfde85, 0xf2ed27ea, 0xf6e879fa, 0xdcf0cc6b,
-       0xf3f7a95e, 0xb9e3f532, 0xdee579bc, 0xcf0ccd31, 0xcfd4d51d, 0xd20145c0,
-       0x3fceb2b7, 0xb43bd60c, 0x8e647717, 0x5341fa37, 0xc0dfd36d, 0x520dc5f5,
-       0x8ca3e465, 0x792669c9, 0x99660cca, 0x0ce603ea, 0x09cfb532, 0x0fde9915,
-       0x8595785c, 0x89ef352f, 0x408ea251, 0xf68b43a1, 0xf49520f1, 0x2720d94e,
-       0x20f77fc1, 0xddcef48d, 0xe04784d7, 0xa2b08e3a, 0x1ab7737f, 0xea4deb1e,
-       0xcc4874c7, 0x86dfa587, 0x3dfdf5a5, 0x9e9c1ec2, 0xb7f0f1ff, 0x5b5afbe0,
-       0xa84cf0ef, 0xfb2b6bbf, 0xbcf9e233, 0x3269ffd0, 0x6976c3ab, 0xeffa460e,
-       0xadd2c29e, 0x5b5e0311, 0x48bf0086, 0xec5b7e89, 0xa3f21f61, 0x901a9364,
-       0x510fd73f, 0xfa041b19, 0x1fdb1d74, 0x9ee73581, 0xc43ee521, 0x2ffd03bf,
-       0x8c2af8e3, 0x77c69a3f, 0xb77c60d8, 0x8ef8f92d, 0xf1a6c9a2, 0xa615059d,
-       0x8c2a9df1, 0x6991f20f, 0x9df18973, 0xad6617e4, 0x8ef8d273, 0xff1a0a82,
-       0x9855951e, 0x1beb4fc6, 0xc60da07f, 0xfee3621d, 0x17f9bf4a, 0x7f9e635d,
-       0xfe79a541, 0xa17f9f2a, 0x9f8c532d, 0x5a2ff346, 0x2ff3e5e7, 0x77f3e4a8,
-       0xc6fb7ef0, 0x7fe1f4f7, 0x263f8e04, 0xe28ef8c5, 0x0ff9e669, 0xdfcf36ad,
-       0x671fc7c1, 0x6be313cb, 0x75f8fe34, 0xa1ff3e3e, 0xeabe34d5, 0x8f900708,
-       0xbab4fcd4, 0x8343da28, 0x240dfb41, 0x72a4181d, 0xbb93f724, 0xe38222a4,
-       0x77ce34ee, 0xbf01a51f, 0xca7d0969, 0x9e29eba2, 0x74f052b2, 0x35328ed5,
-       0x07bc5a3c, 0x00997f7b, 0x4cbb6975, 0x3a36cd7c, 0xbc0057a2, 0xf932eddd,
-       0x5e374b3b, 0x3d69951b, 0x1808fee5, 0xfe7c7190, 0xd98f6fc7, 0xb5979c62,
-       0x3f6ad65c, 0xab9069d1, 0x9d3efd3e, 0xf803ac8d, 0x535e4836, 0x69e804fd,
-       0x06dea674, 0x49e58c7d, 0xf3c0338c, 0xb38f4077, 0x7ffdfd11, 0xd1b5eee8,
-       0x0a2faf30, 0x1c284ff8, 0x48d627df, 0x47ffc451, 0xa8a9561b, 0xa6b596cf,
-       0x07d3d1a3, 0x53a0ad47, 0xd9076eef, 0x3f4f8055, 0x1216e7e2, 0xbf7ec645,
-       0x24870bef, 0x6f967bb0, 0x6efa601a, 0xfb368b11, 0xfb92fda0, 0xc2f10f17,
-       0xe85d6ffc, 0x1f932f18, 0x91b7cc18, 0x1b7cb31c, 0xdb0b4ef8, 0xa1f3d836,
-       0xbb42cb72, 0x52f94fc9, 0xb5bf5cd8, 0xb6ef5cc2, 0xcf18ed47, 0xb1215eea,
-       0x6defd0cd, 0xff8b7675, 0x6159c7c3, 0x08f112cb, 0x8117de3e, 0xe8f07986,
-       0xe3c72c36, 0xf5d12f63, 0x56ff2f76, 0x6bf6a787, 0x90547076, 0xe8399d7e,
-       0x0e48b347, 0x2f6177f9, 0xde15b79f, 0x60ceeddb, 0xfdb9e008, 0xd3e132ab,
-       0xbee77f0a, 0xec0da0f4, 0x7f4dced1, 0x6e7da3b2, 0xfe158f9d, 0xe75ad63b,
-       0x7d7155e3, 0x3eb11c58, 0x5aec988f, 0x2f6dacbd, 0x818efadb, 0x9f626a9f,
-       0xe18efadb, 0xf3edaabb, 0xd115f54c, 0x2fda992f, 0xf4d8b4df, 0x0aeb597e,
-       0x2d25fbd3, 0xc5f54cab, 0xda9aaf91, 0xc1b6b1df, 0xbab6fef4, 0x6fef4d7b,
-       0xaa60d8ad, 0xb0fc297f, 0x0b2dfda9, 0x4bde9b37, 0xed0c56fb, 0x1e1abd24,
-       0xeb76879a, 0x59f90771, 0xf2ebbf3a, 0x16ec0a70, 0xdd834f2c, 0xca036582,
-       0x6dbfc829, 0xb76b2f37, 0x35ea1e2c, 0xed2761f8, 0x4f280575, 0xe2b7be56,
-       0xf0dfcad3, 0x1d6c9f97, 0x8c6acbd2, 0x3dbf4143, 0x24393f16, 0x1f1ea0f4,
-       0xdcb956ac, 0x9bccef56, 0xb57ffe8e, 0x975e1f1a, 0x93ec4fc4, 0xf34498e7,
-       0xe7a56860, 0x5b80dd20, 0xdaab780d, 0xb3826c5e, 0xe34cbf6b, 0x05d944af,
-       0x0a5f37fd, 0x88f5c71d, 0x2c160fc5, 0x04f08318, 0xf6f5437f, 0xbb7f5a1c,
-       0x7d6ce7ea, 0x0bf88ec7, 0x7eaa7951, 0xea279521, 0x53be54c3, 0xdbe5415f,
-       0x765475f5, 0xf2a5afd6, 0x9508facd, 0xa16fabbf, 0xadf537f2, 0xdfab1e54,
-       0xf5ebe544, 0xebbb2a51, 0x7cea5483, 0x4327a7db, 0xfe156ec2, 0xb7224805,
-       0xe45cc55b, 0x96b8bedc, 0xacf1e50f, 0xb470d1f6, 0x031ecfcb, 0xc6a61722,
-       0x521f9597, 0xc90595e2, 0x028f28ae, 0x7ff4079d, 0x74e34aef, 0x1cd8d972,
-       0xdee37a06, 0xc01fbe2b, 0x15d41338, 0x47df8596, 0x49dcf303, 0x107f05fa,
-       0x3a2975e9, 0xc96f60b1, 0x89c7a07c, 0x8a5afe47, 0x456c86fd, 0x28385edc,
-       0xe2c97ad3, 0xaf48035b, 0xe9378a4f, 0x402fbf27, 0xa39339b9, 0x00a3afe3,
-       0xb2df04e3, 0xb39fa979, 0x20a60e6d, 0x47a4f71e, 0xf67d2431, 0xae0f56f0,
-       0x727dab77, 0xb31f18d4, 0xc2b13596, 0x4f9866a8, 0x7eb9bb6d, 0xc39a55b6,
-       0x8cfe69e3, 0x5f20c69b, 0x50efa379, 0xa547d15c, 0x9f6acfde, 0xfee8e34a,
-       0x4991db38, 0x217e0a7c, 0x86affbb5, 0x093f5523, 0x1fd8da38, 0x2e287700,
-       0xb93f8a17, 0x0f94ce5f, 0xb1bb8c54, 0x708ff63d, 0x7fc0773d, 0x6591d017,
-       0x7ef5d50a, 0xc472636b, 0xef9f1631, 0xdf078d30, 0xfb9f75f9, 0xf8c5d142,
-       0xf4276155, 0x9b6a8279, 0x0e443e8f, 0x6a2b95f2, 0xa699fbd6, 0x5e7b6d7a,
-       0xe00eb4d4, 0x59ee403f, 0x3ae0a485, 0xa8b82d58, 0x245ad147, 0xec8c6f80,
-       0xf126fce7, 0x4ece3576, 0xbe47ec35, 0x54e2fc69, 0xa56cb63f, 0x3be15af9,
-       0xabd87f5d, 0x5c7e245c, 0x3bbd9f25, 0xffc8bed9, 0x48bef996, 0xd3db8db5,
-       0xa0f119cc, 0x117ccabf, 0xe18bc60f, 0x0fc3eb4f, 0x8e304df9, 0xb3f7aea1,
-       0x4def6a22, 0xd9764eb6, 0x1d6c9db8, 0x7b8c45b7, 0xdcadfc29, 0xce367471,
-       0x95c78adb, 0xb4abefed, 0xffc0a31f, 0xd478134a, 0x0e463bf1, 0xdfc0c8b5,
-       0x22dfdb95, 0x3d94f27b, 0x176bfc32, 0xe1fd5bd1, 0xb7147cd7, 0x611de7d5,
-       0x9dce381d, 0xff67f17d, 0x7585bf2d, 0xed97ddf1, 0xf62cbe3c, 0x70387437,
-       0xf506d0d3, 0x6776a225, 0x9bc5155b, 0x3d75dddf, 0x594b6fd9, 0x644e83c8,
-       0x452d6b05, 0xb30cf03b, 0x9d3c41cd, 0x267aaf61, 0x43b4e818, 0x974e4956,
-       0x10ed98b4, 0xf54d5fb0, 0xf5cc9be5, 0x173f3672, 0x46f94cf5, 0x344a8b3b,
-       0x47fbd33f, 0x7fe12f65, 0x8f5bab39, 0x9da373eb, 0xe9ddb3ef, 0xe83e4a65,
-       0x1e179adb, 0xff38c52b, 0x7ebe648f, 0x1593f1ea, 0xab8edc59, 0x31566d8c,
-       0xb687ffbe, 0xca9c5f09, 0x7ae8fbf0, 0xcf221f5c, 0xfe6d814b, 0xa4fdf8fe,
-       0xd5e15bf0, 0x717eefd7, 0xcd47011c, 0xbc692976, 0x892cbf77, 0x63f39ff5,
-       0xbaa5e286, 0x5be7d76e, 0x22c9afea, 0x19332c1e, 0xebc67ee9, 0xe832d88c,
-       0xf38e207d, 0x3408e9db, 0x72c2fcc2, 0xf64c98e8, 0x1984bc44, 0x30e585da,
-       0x5e92ef3d, 0x93bb4729, 0xb412f129, 0x21ed6123, 0x3f05553e, 0x129e69c8,
-       0x31bb778c, 0x67718bbe, 0xd60b6797, 0xe62bbbd7, 0x16b51c62, 0xf7f401f5,
-       0x61f66780, 0xb2709fdc, 0xf81078d6, 0xef33e1d7, 0xe6fcb82f, 0x75ea3a7a,
-       0x00f877d4, 0x8c02f9f7, 0x23e954e2, 0x01dcedcd, 0x1f6cfd73, 0x5f7ce29e,
-       0xf71c589c, 0x0cb8b5c7, 0x4ac9b3e3, 0x54bf9f57, 0x871afe84, 0x5a64ec1f,
-       0x7978d6ff, 0x7e2295fb, 0xf4f8e6bf, 0x89175981, 0x939ed547, 0xceb0d458,
-       0x2abd2ad4, 0x39ed61f2, 0x6a7f9e85, 0xd587eabd, 0xf357a0d6, 0x929a70e5,
-       0xc228f5c3, 0x6138c127, 0xe3809f03, 0xf9ca35ea, 0x7c3f0b08, 0x99b2386a,
-       0x918fbf49, 0xe0c9f9c3, 0xfbfdd4f8, 0xe23ff5fa, 0x61ffb4bf, 0x909ffafd,
-       0x179affac, 0x8115d99e, 0x87f2a2f5, 0x3300f6df, 0xd69577b3, 0xbdd000dc,
-       0x07b35b7a, 0x1294f2e5, 0xdf5d20f1, 0xa273ca8d, 0x52a1f849, 0xa82ef9d1,
-       0x3fc4a549, 0x9fa747c4, 0xe80de6fe, 0xcdb47fc7, 0x7eff25ee, 0x00ee23bb,
-       0xb6d95ca6, 0x76c7cb82, 0x7ebc5bc7, 0x9fc8fbcf, 0x7d66edb5, 0xb7e4f951,
-       0x7eb4fd73, 0x1bff8445, 0xe561ff27, 0x8d9c7f13, 0xeb2d58f6, 0xfd67bd25,
-       0x973fc70e, 0x62c2f645, 0x7bffa335, 0x56b21f7d, 0xedb6a5e0, 0x3ee3ef9b,
-       0xe7db6d44, 0xe9a1724e, 0xfad1bf24, 0x07f0855d, 0xd9dc556e, 0xc49baf14,
-       0xe9bf2126, 0xee516178, 0x3c2fc80f, 0x9cf18256, 0xf65e27ae, 0x7c8da348,
-       0xd9dff5ca, 0xfdef92d8, 0xae5a9fd8, 0x1a3f41ba, 0xcedd6eed, 0x3f0bb7f3,
-       0xab2f0f66, 0xee0f71ed, 0xb66f541f, 0xf55cbed3, 0xffbf5b33, 0x8e57c608,
-       0x4057023b, 0xbccf55ff, 0x5035faf4, 0x9ece7aaf, 0x434f973d, 0xf4137293,
-       0xd6ff85a9, 0xa3d04f8e, 0xa92f47f2, 0xcf8d0fb8, 0xa0959ebf, 0xfb73d54b,
-       0x3fa63655, 0xf6c4663e, 0x125a9dab, 0x9adec4fa, 0xfc86fe8d, 0xe91579c2,
-       0x893eeeff, 0x824c2c0d, 0x912fcdcf, 0x22788cdd, 0xf57a0a7a, 0xbed2cfd1,
-       0x7a42e816, 0x6b2f42d1, 0xfe4269bb, 0xa78c5fb1, 0xfb3f7f03, 0xf977dc63,
-       0x7880238d, 0x2ef678a8, 0xa4e7ce0f, 0xfcf9c752, 0xcc5ce6b1, 0x47b0a8b3,
-       0xf254bd72, 0x7f8f15e7, 0xf96ff885, 0x52e4afd1, 0xf305833c, 0x443b646c,
-       0xcb9e70f2, 0xe699bd1e, 0xc4c2ce59, 0xc98f1587, 0xa1f0ff94, 0x973ce6c2,
-       0x16de4e44, 0x8b727272, 0x4e859283, 0xfb8242e2, 0xd1caaf10, 0x5bcf146d,
-       0xaf92f145, 0x6c47fbe8, 0x743fd535, 0x2bb57a72, 0x4b0c1fba, 0x9f7f9189,
-       0xe903a7b8, 0x70487a74, 0x6b81c620, 0xf8111299, 0xbf402e90, 0x0359d1f2,
-       0x5f989d39, 0x81df1529, 0xcf819ffe, 0x3d877db1, 0x7d312ae8, 0x26142ec7,
-       0xc6235fc6, 0xd0d3b807, 0x0b993dbe, 0xf99260f6, 0x3d25d865, 0x0cc1d46e,
-       0x7790667c, 0xdc4fff2e, 0x975de5cb, 0x39bce8ff, 0xd783fef8, 0x77e11cb8,
-       0x5c00bf68, 0x7ef481f1, 0xe9124dff, 0x278b0707, 0xec27f393, 0xefcdce42,
-       0xf002fcad, 0xf71eb82b, 0x938e0df1, 0xfb207445, 0x7c237cb6, 0x38abd46f,
-       0xbf7fa7ae, 0x172f1cba, 0x8af7e0fa, 0xfa100fc8, 0xf5ca3d80, 0x243f6a40,
-       0x7b75edc2, 0xa08ffbf4, 0x46bc82fc, 0xf6bf28fc, 0xbdffce10, 0xff5f071d,
-       0x7bcdc832, 0xcd6e5d31, 0xb72ad57a, 0x66af3b15, 0x3df6e4c9, 0xca92c02d,
-       0x2a4f3c2d, 0xf1275ab7, 0xaf5bdff3, 0xed5478ea, 0xebaabd66, 0xb4f854c9,
-       0x8acdc9ea, 0xd56af09f, 0x1af7f093, 0x8fcfed2b, 0xfcea1f3a, 0x9a83f957,
-       0xfa8fa8a1, 0xc3e754f8, 0xf9d53e3e, 0xd13c5fb0, 0xfbeb4784, 0x18dc605f,
-       0xfbb425f8, 0x81f3b3d7, 0xf87bd5ae, 0x777c2cbe, 0xaf80eb08, 0x5ad37720,
-       0x1b67e50f, 0x3d4b51eb, 0xb41f6966, 0xf69643d4, 0xcebd4b61, 0xe3ca3ed2,
-       0x5507ed69, 0x37139f9e, 0x63afb7b5, 0xb1c63711, 0xc714caf7, 0xd79801ee,
-       0x3b3df7c3, 0xc291a30a, 0x6f5b5e44, 0xf51eba8e, 0xd7b78f59, 0xaf62f683,
-       0x7aefc78b, 0x4c9ebd42, 0xd6f69d83, 0x71f4991e, 0x49cd9467, 0x05824fe6,
-       0x64ebf44d, 0xb8f3dea9, 0xddda0f7c, 0x592cde30, 0x718b582b, 0xf2995698,
-       0xdc369667, 0x8cfcc1e2, 0x37c53d9e, 0xcbe7842e, 0x9b7cc88e, 0xf2541230,
-       0x29dc7e0c, 0x9a687916, 0xf7c7fb84, 0xec97fd13, 0xd2dd7ee1, 0x73f393fb,
-       0x5caef8a5, 0xdea2a35b, 0x6dec7f04, 0xde83bee3, 0x96a3c54f, 0x17ae7be7,
-       0xfdfdcf7c, 0xefcc27ca, 0xb03e22c3, 0x71fbe74c, 0xcff71c6c, 0xae77e519,
-       0x96777a16, 0x85c6fa3c, 0xc39e8740, 0x39be4332, 0x3a2647bb, 0xf7c1dd9c,
-       0x3ece29ef, 0x97b5f905, 0xaf8e9df4, 0x118f942e, 0xd750f5a9, 0xfd2fbff3,
-       0xdea9341a, 0xef92dbf5, 0xebb5d942, 0xb117f0f8, 0x051bc2fe, 0xdbfd65bf,
-       0xa2e7d8cf, 0x7d9e8d7d, 0xec87da6e, 0x82f3fbd9, 0xb77d61af, 0xf6708023,
-       0x0973fbec, 0x3acf51f2, 0xb1ea0547, 0x1fdc219e, 0xe7fbdc6d, 0x3f5a4e92,
-       0x937e789b, 0x67c3fb9d, 0x4df5fcf7, 0x984b1b29, 0xfb07da15, 0xa87f69d2,
-       0x8a2ec7f6, 0xfdecf5ab, 0xced1a973, 0x59f3acff, 0x7b1bf629, 0x4ee16cdc,
-       0xef932f84, 0x38bed4d3, 0xe6036b65, 0x57edb463, 0x19fbc097, 0x825f393f,
-       0x2767b1fa, 0xedba7bb7, 0x7ee38f9d, 0x2fed77da, 0xbd03b3ae, 0x063851ba,
-       0x3f529a81, 0x92d11e9e, 0xc53ce5e1, 0x1f172f0b, 0xe0c7ff3b, 0xf57da243,
-       0xa8ee3dea, 0xff79c253, 0xa2dfcde5, 0x20e7d83e, 0xfbe7d4be, 0xec81ac5e,
-       0xfbcd4b91, 0xbcdd3fe8, 0xcce5f8a5, 0x7c1ff7bb, 0xf26377de, 0xe5fdd5db,
-       0xef9f3fa0, 0xcfea9bbd, 0xef0403b8, 0x57bbf265, 0xfd1c7955, 0x9ffe741f,
-       0x813bee98, 0xcf4b9eee, 0xf83fec7b, 0xfdd353bc, 0xee82edc8, 0xa947cc5e,
-       0x8279c9fd, 0xb9ea93ef, 0xce87ff1b, 0xefd7b75f, 0x315a05b3, 0xbd1d3b2f,
-       0xe1e73c01, 0xe182df9e, 0xce46fbc1, 0x28dda2f7, 0x2b4bfd8b, 0xfb95117c,
-       0xf3c4b27d, 0x1e10d9d6, 0x4fc263cf, 0xd710f342, 0x272b454f, 0xd6d154bb,
-       0x94ccdd93, 0xf0104740, 0x7755df72, 0x87d72806, 0xc6163f8d, 0x0169e0fa,
-       0xfc5b578a, 0x058926c5, 0x9557b025, 0x187f3eab, 0x48fb16fd, 0x4251dc5b,
-       0xde585be5, 0x7690e223, 0x67f26aaf, 0xbae6d1b4, 0x3bae6fcb, 0xc64e7f44,
-       0x58fa77e1, 0xf2d1e314, 0x98bc0795, 0x538f26cf, 0xbb2ea618, 0xfd046b58,
-       0xfccf8706, 0x73f422fd, 0xb45bf10d, 0xb060e3db, 0xad8efbfd, 0xf3383f14,
-       0x60375bf4, 0xca2f55bf, 0xe97809cc, 0x7166e1de, 0xaa251be4, 0xd9523fa2,
-       0xbe290726, 0x174bc4a2, 0x750bf618, 0x87eab17b, 0x72ab826e, 0x173a23a7,
-       0xf5dcafbe, 0xb75a1287, 0x3d92f5d7, 0x0a5a791b, 0x3be1a36c, 0xb03f704b,
-       0xbe7e4952, 0xe79511e4, 0x4eed751b, 0xbc7e885f, 0x6be79db4, 0xb16ec656,
-       0x28790c3b, 0xdebb541b, 0xf228f88e, 0x2cf94494, 0x4f319f08, 0xbb57b750,
-       0x7c38929e, 0xe628f6ed, 0x7f6e567d, 0x11e31bae, 0x011cc795, 0xb76b1b74,
-       0xeff14fbf, 0xc67c3f19, 0x977e49d3, 0xfb43f26c, 0x65db7ff9, 0xb6caeba2,
-       0xa15bb21a, 0x195df44e, 0x27d6fe13, 0x7eaa4ff4, 0x1e1777b8, 0xd1faa894,
-       0x778c1e93, 0xe6d8ee9c, 0xfb703f21, 0xfd31e3c5, 0xbdd8bdfc, 0xc2fbdfc2,
-       0x54e3e449, 0xfc69defe, 0x3f51d807, 0xf37e2d55, 0xc76401f6, 0xc9a59c02,
-       0xfe74c7f6, 0xc3e67aa9, 0xd95e31c7, 0xc7bdf3b5, 0xbfeaee11, 0xb471e9fd,
-       0x973ed943, 0x6a2df717, 0xc535fe9f, 0xdeeff477, 0xa25c7954, 0x2927a9fb,
-       0xfe0dd63e, 0xbdd6f636, 0xfa0164f7, 0xfdcfdd23, 0xe7fd1725, 0xd1677b35,
-       0xcf358ff9, 0x92c818cf, 0x225eb1c8, 0x232f46ff, 0xdba5673e, 0x6483b6c1,
-       0xba019f2f, 0xe7d2bfa3, 0x786ac7c7, 0xfc2fc47c, 0xe3c91df7, 0xf5fcfda1,
-       0x5e3705b6, 0x6db8f98b, 0x83aa00f6, 0xafedfa4b, 0x5ec73d01, 0x88771d06,
-       0x0bec4cf8, 0xcfdbf517, 0x5e803fe0, 0xfc742de7, 0xf7d96db0, 0x6d77c11e,
-       0xedfa5203, 0x9fc0cbf1, 0xa23d6f1e, 0x940e9d06, 0xa03f9db7, 0x6fd20978,
-       0xfbb84c2e, 0x300b0f99, 0xdeca7d5e, 0xb1e53b7b, 0xd17875ef, 0xfbdcad4f,
-       0xf753c906, 0x9e2947f3, 0xb3dc44c9, 0xf1fdf59b, 0xa1c894f8, 0xcdc27dab,
-       0x07417dfd, 0x3df8078c, 0xfdf85cf4, 0x78f5af9c, 0x4038aa40, 0xe4f3c1d0,
-       0xcd7038f4, 0x7e15bf13, 0xd26e8275, 0x5bd7a464, 0xeb5f8d17, 0x1e22f078,
-       0x5ce31926, 0x7d2ee3c9, 0xdd0b2e71, 0x5f56f8f4, 0x83ea0b1c, 0x95119e31,
-       0x371648de, 0xe3ccdeed, 0x7376dd63, 0x4e824dfe, 0xd535ee3c, 0xe8d38e61,
-       0x2f254df3, 0x6a5edcba, 0x4f149f1e, 0xbb08d0a3, 0xbabe3fba, 0xdfae4e3e,
-       0xde5c776f, 0xfdca757e, 0x7592a594, 0xc736e53f, 0xbc3f68d5, 0x57ca32a5,
-       0x0c79e5e8, 0xc8b9befa, 0x5a7aec17, 0xfac978a6, 0xefd241d8, 0xefa1fd56,
-       0xade159b7, 0x6caef013, 0xd747ebe7, 0x8354774e, 0xec0eba7e, 0xb95ebe26,
-       0xfd152de3, 0x7fdb43cf, 0x8b3b72a4, 0x1fae11cb, 0xba7cc351, 0xc25fdd9e,
-       0xdf3c7ae3, 0x37ce3ad9, 0xa93edc1c, 0x9c7c93dd, 0x9bef1dda, 0xc48aa9c6,
-       0x79ff9e54, 0x2b4ef1f1, 0xbfb05bc1, 0x3a761dd3, 0x263a73cf, 0xbfb649cf,
-       0x1761d8bb, 0x2f2b41f6, 0xbca51d61, 0xbcfca3ee, 0xd357c4c5, 0xcd7a0f28,
-       0xc5bf39d1, 0x406b8c73, 0x6c4ed1ac, 0xda7ce06b, 0xf9827ff6, 0xa3b6ef48,
-       0xfd71965f, 0x35f885da, 0xafa58bd8, 0x8370cdd5, 0x5dfd287e, 0xabb22268,
-       0x3a4cef55, 0x0fc13366, 0x75c40ce3, 0xc1fa09a1, 0x9fcc7dfc, 0xcf647842,
-       0x8f0839ec, 0x5d79b5ec, 0xed52f249, 0xcaf2885a, 0x5eed7ef5, 0xc338de73,
-       0x4fd086f3, 0x5e7a95f7, 0xf1032851, 0xcdc761f4, 0x328674bc, 0x775917bc,
-       0xd9bd094e, 0xf1601f55, 0x081cfc11, 0x7e456bd6, 0x839ec570, 0x560f51b3,
-       0x2fe624c4, 0xada473c4, 0x763f3724, 0xa573f264, 0x515db351, 0xd457e7b9,
-       0xb78db2be, 0x6a3162af, 0x8c45e78f, 0x6c4d5bf6, 0xe11ec582, 0xf223ddfc,
-       0x95cfaa42, 0xff21b8b2, 0x9f8267eb, 0x26bdeaba, 0xf08d5f3d, 0xd61afb41,
-       0xc4d4e341, 0xd1c69806, 0x9b9cd5db, 0x46afea6a, 0xab7e20e9, 0xf42ff739,
-       0xeabe4fbc, 0xd487847d, 0xe09be7fd, 0x853ff44e, 0xeb2427c5, 0xb73d1a7f,
-       0xe6fa87e6, 0xde6378f3, 0x882cbd02, 0xe88cfea2, 0xd3ca73e7, 0xbf808da2,
-       0x3ff85a23, 0xdcf81f50, 0x625f0b1b, 0x326cde78, 0x709f59e5, 0x0f047c88,
-       0x047cf0f3, 0x7583622d, 0xcb6d11f8, 0xf28c6986, 0x8c3b4e0d, 0x5e2c06f9,
-       0x6f447a82, 0x25bdefd7, 0x7e30611f, 0x1650aa02, 0xde631670, 0x8d07ac3f,
-       0xb05b3cf3, 0x9f9ba8fe, 0xbd602c93, 0x60ff31fb, 0x0a03f0ab, 0xdc58ce31,
-       0xa7e4bcff, 0x3d99273d, 0xd0d56ca3, 0x9cb36300, 0xa02a6723, 0x296fb32f,
-       0x0bdf2e7b, 0x3d9b1966, 0xb3d0f313, 0x971b2c9f, 0x4b58f507, 0xcbff7f27,
-       0x500571b2, 0xe2eae63f, 0xca24abef, 0xbe5b57d3, 0x7da2333b, 0x137d3d06,
-       0xa4d4a660, 0x409cb3a7, 0xdfa133cf, 0x1f99717d, 0x557a1ef3, 0xc216678e,
-       0x73264376, 0x7ed60dfc, 0x75fa1cf7, 0x0d9d6d43, 0xb7be5fa8, 0x7499cff7,
-       0x23f30fde, 0x6b1e9cf0, 0xe11d22f2, 0x170be4d1, 0xe6b3afc9, 0x74fce999,
-       0xec5c3b95, 0xdf363a04, 0x23ce9239, 0xde31523e, 0x26e37e89, 0x70f3b791,
-       0x3f21be5f, 0x93b57897, 0x44f9f7ef, 0x0fd9d75e, 0x2eb2330a, 0x7d6a1fa2,
-       0x0628278b, 0x5e947ab8, 0xf9efb7da, 0x31dbadf8, 0x99eb130f, 0xc499d649,
-       0x7be94bf7, 0xf3053e6b, 0x2d9f1366, 0x78867c15, 0xfaf21a73, 0x9511cb97,
-       0xc55bda07, 0x8bd337fa, 0xd52297f3, 0x9f5185f2, 0xb4c74f1c, 0xd3c45cf0,
-       0xcf299ce7, 0x7a45ce75, 0x6675cf5a, 0xe0374339, 0xe7e57977, 0xfaee500a,
-       0xad4a69ce, 0xeb3f4879, 0xf4a64fb9, 0x19f992da, 0xcfb9c45b, 0x710f7054,
-       0x71c36f85, 0xdfe27e8a, 0x7fe41879, 0x803552ec, 0xd763a4a9, 0xa4280c4e,
-       0x45de789f, 0x3c2be0ad, 0x1ee74eae, 0xcfb466ee, 0x8290e3db, 0xdcf7d7e8,
-       0x60bb25e5, 0xe4b9d2f0, 0x17a4f75f, 0xa93f30c6, 0xda7e6be7, 0x427b040f,
-       0xb21f3942, 0xf2ee2327, 0x647e9c90, 0xcc8fd391, 0xb71e6972, 0xbdbf82e7,
-       0x8af3fa93, 0xcfd0c0fe, 0xee9f9c4d, 0xdf7af991, 0x3827ef53, 0x7ec8b086,
-       0x772f1fb4, 0x853bafbc, 0x03e8281d, 0x1186fff8, 0x66c740ff, 0x3a43afac,
-       0xc74a4c8e, 0xb47464e6, 0xe49dc79e, 0xfd87df0c, 0x443f2c9c, 0xe7ad72e7,
-       0xc9129970, 0xe9593c43, 0x3eb4ab5b, 0xb9d25b8c, 0x3b27de7b, 0xd8dfa746,
-       0x4e88e3b5, 0x843e7a06, 0xf3dd8c70, 0xd6e10dbe, 0x291df8e9, 0xc14c1db9,
-       0x8ffbabc0, 0xd3b0bb97, 0xbed24e16, 0xf5296d64, 0x82d9f807, 0xf3f018e3,
-       0x9fbfd614, 0xe14f3f1a, 0x3f032fbc, 0x7e0e5ecf, 0x4aaf3f74, 0xee1571c8,
-       0xff9d015b, 0x5b9f9fe8, 0x96cee304, 0x15d3e235, 0xef8a64db, 0x79b9fb42,
-       0x5fb909b9, 0x3f6ea531, 0xf15c579e, 0xb4fc4498, 0x7fbf9c54, 0xb7bf9c4f,
-       0x2f9603e6, 0xbd9e908c, 0x94605e74, 0x76d546f4, 0x09c3f3f3, 0x3ca02afe,
-       0x89ef715f, 0x15805f7e, 0x213567ff, 0x365d4bd7, 0xfd02bde3, 0x66ceb7e4,
-       0x9bcf2bca, 0xf90fd7d1, 0xff9b3efd, 0xfdd38a0d, 0x6e30cecc, 0x27b25414,
-       0x131f11c6, 0x6fd899a5, 0xbd2f9099, 0xcd6ba1bf, 0xc4615e76, 0xb8b03e7c,
-       0xf03e7cc5, 0xf9f3568a, 0xcc9b11c0, 0x8caf03e7, 0x8e07cf9a, 0x54de3eda,
-       0xc6bb131f, 0xfb6c7ed4, 0x5c7d5374, 0xf6a6f3fc, 0x37cf0e13, 0xf8eeafd5,
-       0xa4fda9b2, 0xde9a7763, 0x34ace94f, 0x6a7a9fbd, 0x6d7ea9b5, 0xda9abfef,
-       0xfd7197c7, 0xe47ea075, 0xfa9e6354, 0xcdaa5581, 0x0d57cf8b, 0x8c4b79b7,
-       0xfe8373cf, 0x834b2c12, 0xd2a767e8, 0x579c33b3, 0xf7ae354e, 0xd26ecc65,
-       0xe69c333f, 0xe225c7ba, 0x2fc00510, 0x2e01fc40, 0xbc815cb3, 0x1e40bae5,
-       0xb5a6ebf2, 0x83c7870c, 0x40cb0c56, 0xcb390279, 0x9c9e5d75, 0x93bb63e5,
-       0xb1ebe32b, 0x003eec9e, 0x2ef910b5, 0xb29bf942, 0xe32ff738, 0xfe32173d,
-       0xc2a5443f, 0x5e4a1122, 0x7c860167, 0xf5f75d6f, 0x8f8adef5, 0x27c78b80,
-       0x04f0fe1d, 0xdc3f2cc5, 0x4c55f0df, 0x92f80c50, 0x76a675bd, 0x499cff0e,
-       0xef89f7c6, 0xdfcc9342, 0xa5d5342d, 0x7f2973e5, 0x765c1528, 0x4f5192df,
-       0xe7b37e80, 0x7f52a62d, 0x96d0bcde, 0x06f05f34, 0xc3f467d7, 0xc9ff3ca3,
-       0x80dddf60, 0xfd933974, 0xf79843ea, 0x2f5172b6, 0x0e79e3f9, 0xd4487eb3,
-       0x3a2f3df9, 0xb3d68f3c, 0xebdeb8d1, 0x4196dae7, 0x9a6dd621, 0xf3e3b2ef,
-       0x61af3173, 0xfd3f0a70, 0xc79f3101, 0x96a323eb, 0xa7306322, 0x41793ce9,
-       0xda3676bc, 0x9e454361, 0xe4b643f6, 0x2e5553f9, 0x440caebe, 0x82f68d45,
-       0xc13ed2a6, 0x79dff299, 0x55abf530, 0xff21570e, 0xa3b639de, 0x0ea39f94,
-       0x3f7e78f8, 0x77d75b87, 0x21e85a05, 0x60055fd4, 0xfb0bf9b6, 0x517033c3,
-       0xbc214e68, 0x05b2ca6f, 0x4af7aa34, 0xebf8de74, 0xbed03320, 0xc1326fe9,
-       0x0a6074d7, 0x5aa915e5, 0x27464598, 0x7e44c9e6, 0xf0efbe82, 0xe44df661,
-       0xd55d36bf, 0x9188de77, 0x3a85ab3f, 0x370fdfb0, 0xa6dc69da, 0x7de992e9,
-       0xeabad681, 0xde51c010, 0x4bf14e96, 0xe40dd365, 0x0e3ea97f, 0x12e3d34f,
-       0x3c112c1b, 0xe1eece3c, 0x7c3c00f8, 0x2670f105, 0x4d91f858, 0xafbc349f,
-       0xbce950c9, 0x711490e8, 0xfc3a6d8e, 0x3a2691c1, 0xc3308de7, 0xf6fc6f2d,
-       0x3f9843aa, 0x807a7cf2, 0x2e3ea4a4, 0x779e6ae8, 0x1bfcf673, 0x1aed04bf,
-       0x1e19935f, 0xc277f0f9, 0x91f34f1a, 0x7824d1a3, 0xf006e9d7, 0x957e436f,
-       0xf9a6cd37, 0x2f7a0a16, 0x3ae37a07, 0xe685b3e3, 0x6d73fd10, 0x9d6be70c,
-       0x07a10ec7, 0x8579719e, 0xf97396fc, 0xf51d2df3, 0x73d204c4, 0x73ffd86d,
-       0x73f694ae, 0xdd892b9b, 0x517ba975, 0x1c7617aa, 0xca0e52c2, 0xd427ee01,
-       0xcfda370d, 0xe27f1fa0, 0x72cdf832, 0xb04bd7c6, 0xe1d94bdf, 0x65a04ab5,
-       0xeda5e178, 0x90cfb434, 0x0cfb750f, 0xe71479e6, 0x9e8b0bf9, 0xa3f5e837,
-       0x4499e6c9, 0xed8ebfaf, 0x9e397e4e, 0xbd027ed4, 0x8e64764e, 0x65ff5c9a,
-       0xd47a71a4, 0xf946557a, 0x97f62985, 0xedc9696c, 0xdfeb54c6, 0xa290fca5,
-       0xc07ee681, 0x847f216e, 0xdfb4ab95, 0xcd83f675, 0x3cc70ef7, 0xf288ad21,
-       0x93f55383, 0x04c976bf, 0x22bfcf81, 0x9dfc741e, 0xf015e0b3, 0xeba4d7f9,
-       0xd3e03564, 0x4b27c266, 0xf47b0cbb, 0x32bb9fd3, 0x16ea179f, 0xe0758778,
-       0x16075a2d, 0xf18a59bc, 0x7f379597, 0xa7c0eb44, 0x39a1671e, 0x0fc7a08e,
-       0x21df9c60, 0xfc17ba9e, 0x3b7dc44d, 0xf8d95e29, 0x17ba08fc, 0xaeba66af,
-       0x749cea4f, 0x117072ee, 0x2ecce7d1, 0x3ce11047, 0x66e3c593, 0x3a4d7667,
-       0xf799f184, 0x19670fea, 0xd9e67ce9, 0xe876a5a3, 0xa3ceccef, 0xf7e90aa5,
-       0x9ddee9a8, 0x2abf0b9a, 0x3f5e7f45, 0x77c7d0df, 0xd3ebe4ce, 0x3f3f8275,
-       0x5e301e29, 0x0a51fb4f, 0xbbed187b, 0x9b54bc3e, 0x499c15cf, 0xf114b37f,
-       0x0eb97800, 0x43d3aee9, 0x332b878f, 0xdc60663a, 0xfc0bf7b6, 0x2e8da93e,
-       0xe352a71e, 0xcd769875, 0xe35b879c, 0xc475a658, 0x3b50ef28, 0xd2c711d6,
-       0xc41bd9d3, 0x7676a7ed, 0x5fb1e7e7, 0x7eef29ef, 0x06f567ac, 0xd0c7873e,
-       0x06afe765, 0xbb7c03bd, 0x71fade71, 0xf7e94fe8, 0xd98af96b, 0xe0b1c2c8,
-       0xe25e61bf, 0x2dcb8a58, 0xe607efc0, 0x71c41eda, 0xf37325a5, 0x6c5c8196,
-       0x8794a8f2, 0x1c08cca9, 0xf37c23f6, 0xecef8214, 0x17df9961, 0x85b9cf32,
-       0xfc67bf9f, 0xfd9b921e, 0xa7d4beb4, 0xc3e3e7e9, 0x2afeb885, 0x1a516cac,
-       0x85a707d4, 0xd732c0ef, 0x10fc31d6, 0xf63ae77c, 0x609c029b, 0xd0bfc1e9,
-       0xcabb3abd, 0x3f71fb42, 0xe4b777ba, 0xc7fac2df, 0x7e85ebfd, 0x48efcbd0,
-       0xef31c775, 0xebbefeac, 0xec7c6166, 0xba3aae3b, 0x82fe05f7, 0xe7f41f4e,
-       0x32cadf0a, 0x6a691c61, 0xa16b9cf3, 0xe3f7876e, 0xcd69fbf0, 0x577ed04d,
-       0xaf1f3866, 0x534b71c2, 0xc10f0f9a, 0xb5bca33a, 0xcd29b4fa, 0xfe663011,
-       0xe3cbcd35, 0x10b85aed, 0xf757d4e9, 0xa86ddd42, 0x85752d3b, 0xd579f5d7,
-       0xe50bfc1c, 0xc3dcae95, 0xd9ca2def, 0x1bdf8f33, 0xee8f3ed7, 0x134e6b8d,
-       0x9a63447a, 0x58563cf1, 0xf88bdf0e, 0x195e92ea, 0x8f48e5ce, 0x2f78a67b,
-       0x59c39ee2, 0x06e3c51d, 0x62eec1e1, 0xbc78cbb4, 0x52f580b3, 0x8aebc7a9,
-       0x61ca8058, 0x48e5442c, 0x55e54ad6, 0x68e5462c, 0x096541d6, 0xc032a5eb,
-       0xe39632bc, 0x6cca8059, 0x59d1dd5b, 0x667f4fa8, 0x7c3a7d27, 0x8303aafb,
-       0x44de9118, 0xc78d66b7, 0x656bd6e9, 0xdcbc1ad9, 0x3f50f828, 0x348d5557,
-       0xdb62be03, 0xe87ec8f3, 0xdef63212, 0xf7045b26, 0xf9a3d963, 0x9c5abcf4,
-       0x7e3eae47, 0xf7cdec80, 0x60f3c982, 0xbb8bc05f, 0x963ed33e, 0x3ed67f59,
-       0x41be11aa, 0x39405f7e, 0x41708959, 0xa0ece6dd, 0x75f69773, 0x3ee907b1,
-       0xb4ec67b8, 0x18555abf, 0xbd43b32a, 0xa061776a, 0x7a8720c1, 0x6655703e,
-       0x96bc772c, 0xf5888f38, 0xdf825a71, 0x286fb657, 0x77fb7dc0, 0xf5a71ff7,
-       0x85e987fe, 0xb69a9f34, 0x4dd86aa3, 0xca2a7efb, 0x7d39bbcd, 0x97d93af6,
-       0x0640aecd, 0xfde9779e, 0x4b6fbf39, 0x94f7dfc7, 0xdf71975e, 0x283d70e4,
-       0x5ee9b042, 0xf951f7a9, 0x953f7a8b, 0xb2f7ab3f, 0x4700f820, 0x04da9dec,
-       0x30ce4f9c, 0x7bfbca2f, 0x432bd8de, 0x7cbe6227, 0xe601bf91, 0xcefd98d7,
-       0xded013fd, 0x7401c80c, 0x75eeec0b, 0xf3b42513, 0xcf29f37c, 0xbc6d1ee5,
-       0x4f008ff3, 0xe67012a3, 0x6b2fb8c0, 0xa02bb53b, 0x24fcfebc, 0xe5ffce27,
-       0x0fcd36ec, 0xddc61bf5, 0x247dc5ec, 0x02e36fe8, 0xfa2ecfea, 0xf6c4ef1b,
-       0x5a3f62f7, 0xa2fd9fa2, 0x677bbd7e, 0x543fbe36, 0xebee08cf, 0xb1b2da73,
-       0xbd1f7fbf, 0x13f195ec, 0xba477ee9, 0x17caca2f, 0x66cb9fd7, 0xe6cbb041,
-       0x41602b9e, 0xd393c7a0, 0xf942aeeb, 0xd1bfd357, 0xa0fd04ec, 0xa255d614,
-       0xb7a6f0be, 0x1f413b34, 0x9d01b06c, 0xa59f54bc, 0xcc70095d, 0xb181fae4,
-       0xa432e696, 0xc62bb03b, 0xae8fe1e3, 0xfa82399b, 0x7efe1ae3, 0xd79160e6,
-       0xf7e3ed00, 0xed0b31bd, 0x918a6ab2, 0x66e6b630, 0xa479f746, 0xce2a37b2,
-       0xc1a8b3a5, 0xba61fbae, 0x42a7e49f, 0x4c3ed089, 0xbd0f39c5, 0x5cfefcbf,
-       0xfd8873a6, 0xfde8d3fb, 0x7e74abe1, 0x679c520a, 0xdf2273cd, 0x881c15c3,
-       0xd763beed, 0xb8f60fe7, 0x57d5f113, 0xcc3e288f, 0xffe7d043, 0x49ffcd28,
-       0xef1ef135, 0xf7d81cf5, 0x7fd1059e, 0xea26923e, 0xb7922791, 0x2fb4b34f,
-       0x34cfebd2, 0x1fd69ccf, 0x12b8ef9e, 0x57b42775, 0xeafa3bce, 0x9b06df08,
-       0x7d2cbfa5, 0xfc69e7fc, 0xb45942aa, 0x5052f7df, 0x723bd031, 0xabef19a8,
-       0x78ef454d, 0x9b9b2fda, 0xae23fbe0, 0x5fad1950, 0xbf5a3337, 0x0602ee50,
-       0xe34f183d, 0xb9c555fe, 0x247a2651, 0x7a6250e8, 0xd2e4127e, 0x7cbb4fb8,
-       0xfe745dc7, 0xe7e69e24, 0x3f08b0fd, 0xb168f557, 0xfff67f69, 0xe169f1c3,
-       0xc7014b28, 0x1c33bfcc, 0x3fe49a57, 0xd368c701, 0x387efff3, 0x6380a466,
-       0x1c153ff6, 0x2f457b56, 0x2bda2fff, 0xcabda357, 0x9d6c41e3, 0xf7fdce8d,
-       0xe52a2a64, 0xc99369ef, 0xe195204e, 0xdf68eea7, 0xcd779f2f, 0x8b1c7bfc,
-       0x615f9db1, 0xd478ca2d, 0x11671157, 0x857f87ee, 0x0fcf03f7, 0x8683a02b,
-       0x1f693a64, 0x5434bfdb, 0xfe05fb85, 0x5435e585, 0x546eeb7a, 0x587a5f70,
-       0xefb438ef, 0x4fd96b36, 0xde933337, 0x2fbad08b, 0xb6bb22ad, 0x9b279be3,
-       0x6078df71, 0x68c3dd5a, 0x93914b07, 0x24a787cd, 0xd6f5cf7b, 0xd14fd32f,
-       0xce9d14ba, 0x293f42ae, 0x0ec68aea, 0xb59a3d20, 0xf0a3d200, 0x2296d19b,
-       0xdaf72ba8, 0xaf000d02, 0xbedd1992, 0x1e57e005, 0x4d764e18, 0xb61ff514,
-       0x6e89407f, 0xfa9dfcc1, 0x1bb7c500, 0xa5b47d85, 0xf317ae69, 0x3099ed98,
-       0x7ae5204b, 0xd097dd7b, 0x7534d75e, 0xae0a73bd, 0x01968107, 0x01f75e5e,
-       0xb1164f5c, 0x78a66722, 0xb46feb0f, 0x1af20d81, 0x6fe97eea, 0xbab79f32,
-       0xd70d383e, 0x8c95d5f9, 0xf7087f7f, 0xd2cc9e89, 0xfbdfc2f1, 0x4f5c750d,
-       0x7d448694, 0xeb7bcc26, 0xf7df5c63, 0xd1ebaba6, 0x44f987de, 0xc31b8ec8,
-       0x630e93e7, 0xf4fe007b, 0xbeb44571, 0xf17d6146, 0x0a71fbe0, 0xf7d2f79d,
-       0x6c639c83, 0xed841fb4, 0xc2ea7ee9, 0x742fda22, 0x388163ce, 0x69e703e6,
-       0x09517f7c, 0x3b3cc4ce, 0x04bf1f77, 0x8aa6ce29, 0xa26d12fd, 0xad205f39,
-       0x99b45be9, 0xfcda369e, 0x5ccc39dc, 0x9dc0b077, 0x60ec8f74, 0x2681be4b,
-       0xb00687f6, 0x1457e841, 0x6c3622db, 0xca85da07, 0x76df7851, 0xec811e31,
-       0x0c58faa4, 0x31e31691, 0x0c1d3f2b, 0x3282c09b, 0x6486a38f, 0x698e3bf4,
-       0x07947ce1, 0x66e2269f, 0x8dbf7883, 0x36ff61a1, 0x8ff14fcb, 0xf5efb47c,
-       0xb379c6fa, 0x4a91fe29, 0x889a22be, 0xec36dee7, 0xce9af7a2, 0x19100738,
-       0xc68e6ff4, 0x6f6b81f3, 0xd779f7e2, 0x947ee1ee, 0xe8b27efe, 0x9c4536b7,
-       0x327ae413, 0xd63df9c2, 0x485edb39, 0x0e7cacf7, 0x75f356e9, 0x6b4fc31b,
-       0xdfb9c7e2, 0x53b7b166, 0x158da1e5, 0x5f9f4dfe, 0xf218fc23, 0xc2ce902d,
-       0xd2ea597f, 0x4fbe6ee9, 0xa247bf42, 0x4f4dc847, 0xa8c44ab9, 0xea098345,
-       0xe9853739, 0x3172821e, 0x654df29f, 0x2c1fe8b9, 0x8225ffdd, 0x79c6d973,
-       0x5e4bde2a, 0xe13171be, 0x52ebc745, 0xa7f07f8b, 0x8d1709d6, 0xb4f6e9a7,
-       0xfee81fee, 0x484fd580, 0x47e7fdf5, 0xcc3a27ee, 0x3ed195f6, 0x3c1affef,
-       0xe07586cf, 0x67de20b6, 0x473ffba5, 0xf98eecec, 0x73655cf8, 0x2ec3f9f0,
-       0x54560f7e, 0xd87583dc, 0xdf859c5f, 0x7f3e29cd, 0x3b2f9625, 0xedea1a63,
-       0x7a3e3f97, 0x4a0ff903, 0x8d3cc34c, 0xfff70a33, 0xe7633af4, 0x0bf38a64,
-       0x7eef5fbc, 0xb867ee95, 0x74f7f0be, 0xfdc6bd3e, 0x3f639d2a, 0x3ca766d3,
-       0xb15debbb, 0x1dfde36c, 0xcdee17d7, 0x747e18be, 0x8088e1ff, 0x7bd170f7,
-       0x571a6105, 0xb70473e4, 0x53d2174a, 0xe7cd6f7f, 0x3e98ecd8, 0xa669e513,
-       0x2ff9e926, 0xcd97c88d, 0xfc9387f3, 0xe89bcf64, 0xf39bfde4, 0xc791b24d,
-       0x47cfeeae, 0xef59ff3a, 0xf1235925, 0xe0a9ef73, 0x19b405aa, 0x3dc4d1d7,
-       0xef3d2a25, 0x0e86f116, 0x54f6fb1f, 0xac799790, 0x75fb4ece, 0xfd177ee2,
-       0x4179975e, 0x2242fdcb, 0xd6242aff, 0x5e4437c3, 0xa7e63cd5, 0x376817ef,
-       0x75bf51d9, 0x6e60fb88, 0xf1bb6162, 0x425ea67c, 0xb6bd26bf, 0x7eb98e60,
-       0xb75cc873, 0xe7a8a3de, 0xdeb4fccd, 0x89ef153f, 0x999dfbd3, 0xd3ec3f42,
-       0xb03c5d3e, 0x67507e2f, 0x71e81f8e, 0x43cc1abf, 0x1e18fda6, 0xe4e59bf7,
-       0xbb8f4fe3, 0x56a37f68, 0x16e33753, 0xc5b3ea0c, 0xc6967cf0, 0x8bc60df5,
-       0x59a29ef0, 0x6f1f7e8a, 0x80e7bf54, 0xf909cbbe, 0x0ddc6336, 0x5ee930f3,
-       0xdf1e70ab, 0xa0721157, 0x0ece19c7, 0x5e6467f3, 0x4db5bf84, 0xba9ee9b2,
-       0x13b895fb, 0x00fee0f9, 0xf04ac3cf, 0x6f14d471, 0x49a936d5, 0xebebb7ef,
-       0x9e0af407, 0x3ee0724f, 0x01f7d02f, 0xc635e825, 0x887b3423, 0xf4f776ea,
-       0xf2f23f0e, 0xe3661b03, 0x988d1055, 0xca760c1f, 0x6957da3b, 0x03db767d,
-       0x621ef187, 0xc7e6dbb7, 0xb341b8f5, 0xa357bed1, 0xefeb49cf, 0x8bdaa97a,
-       0xebf7a4fc, 0xae0854ee, 0x06515ab3, 0xabff08bb, 0xda334fe0, 0x87df31af,
-       0x9e37dff5, 0xddfaed46, 0x0a7075bf, 0x131d59c5, 0x17bc016d, 0xb1ac1d5c,
-       0xcfc9243f, 0x936f1bec, 0x549fb492, 0x77494ff8, 0xf507a77b, 0x7c96b743,
-       0x2dc8ba3f, 0x3fc2fb89, 0xb22c3ca5, 0x5f33c3c4, 0xefc71e1f, 0x8a1bcea5,
-       0x8a3e490b, 0x2b6f20dc, 0xccf59dc7, 0xe47c93f0, 0x2e1c7cf2, 0xabda8db7,
-       0x6c379e4e, 0x152da7be, 0x4978ea3f, 0xc8e50785, 0x37e78c5d, 0x7f719986,
-       0x43c52dce, 0x4e32d794, 0xb8afba49, 0x51a1e056, 0xcabf1009, 0xb89c86d7,
-       0x4f64340e, 0x7ffee277, 0x28cfe2b3, 0x88f0fb44, 0xd66e30cc, 0x8dcb35e4,
-       0xfb88b65e, 0x6dbae745, 0x7559ef49, 0xeeff92da, 0xbe6e5dce, 0x9fecb44e,
-       0x52dee742, 0xd46809f1, 0xa5a5d910, 0xf3ef178a, 0x5e1ced96, 0x04fc8a57,
-       0xfc54dfbd, 0x177eef71, 0x61993dff, 0x659f3a4e, 0x9c49af1d, 0x78026bc3,
-       0x1a6dced0, 0x6c7841dc, 0xd178a89a, 0xd3f9768e, 0x5ed0d398, 0xef489cc9,
-       0x78d96acf, 0xa5359026, 0x4f1d3be0, 0x9f6db9d7, 0x16c2ff8d, 0x0df9cbfe,
-       0xfc0dcbc5, 0xff193ab7, 0x983c875d, 0xde37e1c3, 0xf264a9ab, 0xbc2b3ffd,
-       0xde3e7e7a, 0x9fcc6e87, 0x845f052a, 0x1c8e8dc7, 0xec0c3e9a, 0x303abedd,
-       0x86d78c38, 0x73fb8e7a, 0xd133a771, 0x647dd1be, 0x75429376, 0xdf07df3a,
-       0x6cf7f105, 0x39fdc4da, 0xc1f3a835, 0x45beaa8f, 0x9f585e63, 0xbb2ccaef,
-       0xda51e717, 0xab9f8071, 0xf9a1cb69, 0xadef8b57, 0x9c3dc6f0, 0x2f1ee39f,
-       0x82c71995, 0x77dfc03f, 0xf348eb68, 0x2db71c63, 0xd639db8b, 0xf5bbceef,
-       0xb156873c, 0xfb49d1df, 0xf8333912, 0x3bbbd47a, 0xfea3fc9d, 0xf7e069f8,
-       0x8dec5869, 0x94367bbe, 0xd51dd938, 0xc7d0eec2, 0x82c45d2f, 0x2f4bbbf8,
-       0x2716b1a5, 0x843b87d8, 0x2df6321c, 0x780a5fb1, 0x7c6fb804, 0x3fed1471,
-       0x04bdfde9, 0xcfb612cb, 0x912cedcd, 0x3fc0cfe4, 0x6fba6631, 0x39d9c6ad,
-       0xbe47f51c, 0x46edde1c, 0x6758e33f, 0x5edbd62e, 0xe0f64d3d, 0x73f0f0a5,
-       0x51c2bf81, 0x571e7dba, 0x35d6718d, 0xf45d95cf, 0xc6355d7c, 0x50fe0c43,
-       0xe9b36f02, 0xa17ebf79, 0x1fe8bf3f, 0x8d392be3, 0xa09ae9c9, 0x4c8b3e4f,
-       0x0a7d18b8, 0x25d23de8, 0x1fd39a3a, 0xde60f9f7, 0x607fd764, 0x09ef27d1,
-       0x9f4ffd7a, 0xae26366f, 0x40e53f01, 0xf188e789, 0x9fbc5bde, 0x6fc794f7,
-       0x15b27f5a, 0xcb3553f6, 0x2c6987c0, 0x8dfa84e2, 0xd167ce8e, 0xfaebd3fe,
-       0xc7c11bfb, 0x39fd8c9a, 0xf2e91cb9, 0xb928bd5b, 0xedcb7edc, 0x3c0efc21,
-       0xbee0f716, 0xfc628bc7, 0xe81fd8b6, 0x76b6b3be, 0x3d4fe199, 0x96145c0c,
-       0x4e825ac3, 0xebe1fbfd, 0x60ff2e8f, 0x0b728e4e, 0x4a3947f9, 0x6bfdcb5f,
-       0xdfe8cf5d, 0xcfb47915, 0xee8f1f66, 0xc8ac4e77, 0x75724393, 0x05f44308,
-       0x7bbdf96b, 0xa2ff0b6f, 0xd39fdc5a, 0x18c7dfa5, 0xde33691c, 0x5a76f5bb,
-       0x87fd1441, 0xe5f787b7, 0xed1ae609, 0xf0576aaf, 0x1bbef0df, 0x7ca65476,
-       0xc1bc0fd5, 0x9a2fee0c, 0x712ea7fd, 0x3fee8eaf, 0xffdf8b35, 0x7f398362,
-       0x1dd24b37, 0x91ffb0f3, 0x72af749d, 0xa75f2e6e, 0xcc7f73f5, 0xf64259d7,
-       0x54abe0b7, 0x0f39f77c, 0x83d40f97, 0xad7ca491, 0x0dbf9e9a, 0x70c460eb,
-       0x53cee84e, 0xcf1ce8c3, 0x78a01612, 0x749692e6, 0xbde03116, 0xf9e4f1ed,
-       0xbe848b35, 0x4ef7136f, 0x5e7cd1b3, 0xf3e7be09, 0x1c975b68, 0xbe0c9eee,
-       0xfb89b70e, 0x6094dbc5, 0xd529e23a, 0x078fa13a, 0x3ca74b04, 0x6f07f387,
-       0xe6fd71a0, 0xfa257f71, 0xb26ff17d, 0xc0037df8, 0xd827d0a3, 0x9b1e1bfe,
-       0xe2bebe49, 0xb3faacf9, 0x24feb4cc, 0x9e933ef0, 0x927d767f, 0x927d0979,
-       0xf251ef4d, 0x3a78ced0, 0x7b75efc6, 0xce6db0fa, 0xdb742496, 0xaaf4e424,
-       0x3fee851c, 0x76e7151b, 0xb976aa40, 0x639ee259, 0x7c2b4781, 0xf9c9c5d9,
-       0xfe0ca5e3, 0x7e74f57d, 0x1bde334f, 0xb285f38f, 0x75fd0020, 0xf422d74d,
-       0x6fe25ffc, 0x7ab49c62, 0xbf8fc3a7, 0xd3b5d7cf, 0xa27a8155, 0x62a3a76b,
-       0x7e9fd68b, 0x3b663cbb, 0x4ccf99f7, 0xf58c7fbf, 0x705174a0, 0x5fd1cfc2,
-       0x3ee99768, 0x927f6b49, 0xecf34dc7, 0xec29e7d3, 0xb9b9afb0, 0xe74ecd3e,
-       0xf117b174, 0x572ad475, 0x1d3c8547, 0x2d90f215, 0x75876bee, 0x92eb89c9,
-       0x0217eede, 0x2cc393df, 0xe7c17de9, 0xb12e02dd, 0x76bc3c2e, 0x04c3fb06,
-       0x08ce7dfc, 0x7eda19c5, 0x7ec02f13, 0xdc78cabb, 0x16fdfac0, 0x998c67c1,
-       0x3349eaed, 0xb9e612fd, 0xc5e498b0, 0xfdbd7c7d, 0xb7bf18a4, 0xd3b9fff8,
-       0xdbc5ecfb, 0x807bbfc8, 0xf49a2eff, 0x81eb8a53, 0x61b4170d, 0xc18fd15e,
-       0x5ff8338e, 0x1de8b2bf, 0x0baf3c2b, 0xefc4da78, 0xeb8d3287, 0xf55d2b61,
-       0x779f4c75, 0x1cb300f6, 0xd7ff82c8, 0x9647328a, 0xb9743c68, 0x7d7c591c,
-       0x5cc4f9e6, 0x49d2e24f, 0x1e5859cf, 0xbcaf7003, 0x90e6fc43, 0x95dcef88,
-       0x31ef3e19, 0xe9da3df0, 0xbb097eb4, 0x6fdc4dbc, 0xa889dba9, 0x466bc74f,
-       0x0e0223b8, 0x4ad7d71b, 0xf30d7d72, 0xe2a7bf10, 0xf6127ea6, 0x262bb706,
-       0x166dfc0a, 0xb25f51e7, 0x3fb226b1, 0x39749e04, 0x9661951d, 0x7f8ca2d3,
-       0xacdd390e, 0xa4727cf2, 0x787d325f, 0x9427ed1e, 0x71c16387, 0x4572c798,
-       0x5fa00b48, 0xff31da5a, 0x0cf1e600, 0x943f83df, 0xe1e39093, 0xbfb19f82,
-       0x2dfc0645, 0xf09b70c8, 0x7f8cf9f7, 0xf877bb0e, 0xdf37d631, 0x7d7a0cdb,
-       0xe5c68655, 0x942ffc00, 0x9a7f8a83, 0xe00e86f9, 0xa06aae39, 0x9d0caa3b,
-       0x8b62da3f, 0x3ed0b9d7, 0x6802c63e, 0x16c7775f, 0x7f00c6db, 0xf6e26f74,
-       0xdf9e9f63, 0x7a05f1c8, 0xf97a8639, 0xf4c1638a, 0x275f50d1, 0x458ae3f8,
-       0x14e7df8c, 0xcfd14773, 0xce44f5d6, 0x7033bd4d, 0x7a6577df, 0xf0cb835d,
-       0x3b7dafbc, 0xe84c2fb4, 0x37d46a9b, 0x7df6d4fe, 0x8d3a466b, 0xe209eb87,
-       0x733a5665, 0x979e00ba, 0xee32230a, 0x4574be6b, 0xe7bc78e1, 0x785a50fd,
-       0x7ef86af4, 0x0e3e1cd2, 0xaf44776b, 0xd2ff1248, 0x88ae75f5, 0x7c8ae54f,
-       0x5e34dcef, 0x45f42c7e, 0xc1f39783, 0x9ebcbdaf, 0xcf1e49eb, 0x17ef11ea,
-       0xdcef5cc8, 0x2edc9657, 0xc67c6589, 0xb24063f8, 0x1963e3c6, 0x6f9ee239,
-       0xeb5f425b, 0x7c4273fc, 0x2edf8fa7, 0x9cfcb5e6, 0xe59fe264, 0xcdf11d4a,
-       0x3d0a73f2, 0x1522e5d7, 0x79fbe9ff, 0x78e11d9b, 0xbe7bd406, 0xc60961fe,
-       0xe9ef0a0d, 0xf848fbe2, 0x5253407b, 0x1ebe87cb, 0x3d06f4e8, 0x0df186df,
-       0x2713f3d0, 0x18f43ad3, 0x9c85975f, 0x1ff4ec1a, 0xb659efe0, 0xd4555c75,
-       0xdf6ba060, 0xfee0197a, 0xd95d758c, 0x57c4c980, 0x89d79ea7, 0xa3ef2ccf,
-       0x25e1d852, 0xbc3b577f, 0xc93c63b4, 0x578112ed, 0xc7a6de3d, 0x507b18b5,
-       0x13f731f8, 0xe4cd277e, 0xdff80df2, 0x9a3ff021, 0x7dbbffe3, 0xec95bff8,
-       0x2f2e5684, 0xa52b9db9, 0xfa2f9262, 0xa4ddff4e, 0x52afd3c2, 0x2f78e77e,
-       0x13ffe7f7, 0xc9555084, 0x00008000, 0x00088b1f, 0x00000000, 0x7dd5ff00,
-       0xd5d47c79, 0xcefdf8b5, 0x3324b677, 0x5f64ccc9, 0x25849308, 0x2126126a,
-       0x26504109, 0xc5116109, 0xfb094049, 0x515983b0, 0x2fb5696c, 0x4a444103,
-       0x505d8bdf, 0xd101da94, 0x101ac55a, 0x83b06034, 0x6795622c, 0x05b054a4,
-       0x2108ee3b, 0xf16b43c9, 0x3dde5a57, 0x999bdee7, 0x006677ef, 0x7e7ebe7d,
-       0xdeb8ff0f, 0xdef7cbb9, 0xfb3dce73, 0x3ab3c9bd, 0x21094b25, 0x0b62a21b,
-       0x99941c48, 0xc84b125e, 0xbd3e0988, 0xe90844dd, 0x95242448, 0xa423aefe,
-       0x475aea0b, 0x2423c932, 0xbd389ead, 0xbed19eb4, 0xfad2d25f, 0x8637f865,
-       0xc94ad310, 0xfe9e30b9, 0xd3b694be, 0x3a166ddf, 0x9ed03130, 0x1609ebcc,
-       0xd025213b, 0x820d27cf, 0x936f36f9, 0xb4be74b4, 0x62908976, 0x2f13365a,
-       0x4b8c0ac9, 0x99efb073, 0x01695e1c, 0xbb48dfed, 0xac849191, 0x59e754d3,
-       0x14996812, 0xbfa568e3, 0x07bab06d, 0x4fea7ec0, 0xda667cf9, 0x2ea9c465,
-       0x7b8e9bad, 0xb4cceac2, 0x63f60624, 0x24692d97, 0x53989087, 0x366d9d6c,
-       0xfb05d732, 0x174cfe23, 0xc63f240c, 0x15b211f5, 0x93289bd7, 0xab46c423,
-       0x2f7e87d0, 0xd6ee7569, 0x7d6052f5, 0x6ee23649, 0x49496da7, 0x84d3bdc4,
-       0x2291d7fd, 0x7048d7da, 0x87ab493f, 0x059f5d6c, 0xde7179f3, 0x36d71caa,
-       0xf92abdf8, 0xfa56a2ba, 0x9f06ce7b, 0xb71d3e76, 0x0266b377, 0x2bcc53ec,
-       0x0916d1ca, 0x8c7dd1c7, 0x7d89fd80, 0x9289fba8, 0x5bae0f10, 0xb345d3f4,
-       0x5bf685fd, 0x4cc6f385, 0x6d0df060, 0x2f6c77ff, 0x0cc265ff, 0x1afd6f58,
-       0x0148313d, 0x75613ff8, 0x4d7002dd, 0x0122df6b, 0xa68c3e6c, 0xf02c3474,
-       0x29a30fdd, 0x76b0153d, 0x87f3853b, 0x79474a7a, 0xb48a3a01, 0xb295fafe,
-       0xa0f0e173, 0xe23d1afa, 0x2c9e8b69, 0x5e0bcf6d, 0xdf5c6adf, 0xcb068b22,
-       0x2cd756a3, 0xc7634f80, 0xfbc07ac3, 0xe81f6db2, 0xcef857dd, 0xee91c2b5,
-       0xe296957f, 0xb25daebd, 0x4ae92818, 0xe81392ed, 0xe8d6bea0, 0x6fd47805,
-       0xd64b7467, 0xa183bde8, 0xa7c3bede, 0xf7e9eda1, 0xfd321d3b, 0x0efb6eb9,
-       0x7c105169, 0x12bdebd3, 0x59a86bac, 0x1e9f2b9c, 0xfe8a95cf, 0x4578510f,
-       0x1c3bba51, 0x5a463c45, 0x3c9b9776, 0xb76f8512, 0xfd0f5dce, 0x1c6353ba,
-       0xf5efda1e, 0x488fe31d, 0x779adcf4, 0xae507c1a, 0x314d6cd3, 0xd775f6d2,
-       0x41ad1deb, 0xbad36774, 0x6b38c176, 0x8ab1d982, 0x206eca7e, 0x9c131645,
-       0x47fe2577, 0xc5cecfdc, 0xa32c4b6e, 0xe08a4223, 0x316e3c5c, 0x82893d63,
-       0xf7d28cbb, 0xd75b1d61, 0xe1e8c24e, 0x836b9c52, 0x23e3bf05, 0x3ade3a0e,
-       0x3a979d81, 0x7e891fba, 0x2ef36eaf, 0x623927dc, 0x6fa7b843, 0x75bbf097,
-       0xb9e0b7db, 0x73bb3ace, 0x2ffa1ebf, 0x2451a525, 0x1b9cce98, 0xd5efcf83,
-       0x426235f0, 0xade81ebb, 0xf2a1f38e, 0x3e936e5f, 0xafdfda0a, 0xa3c2322d,
-       0xfdb6f36e, 0x647bf469, 0xb60cb129, 0x13fdbf63, 0x06b5f7d9, 0x607fc412,
-       0x9d6c799d, 0x8ff8828b, 0x3e187fd8, 0xaf585bf4, 0x41d754e9, 0x487c87c6,
-       0x6afd628f, 0x7e7076bc, 0x3c4f4e38, 0x93debbf8, 0x1df3a76b, 0xf9c68ece,
-       0x73805f04, 0xa5f9c35c, 0x6213d686, 0x5a0eb9e8, 0x9e6f588f, 0x82d3a2b5,
-       0x3842e870, 0xe2d66c34, 0xaef4abfa, 0xce83cb41, 0xb9f9efc3, 0xfbda6d79,
-       0xfdfd3f7a, 0x83bf2fe7, 0x936869f8, 0x48cfc09c, 0x3bfa3bdb, 0xbfac01f2,
-       0x21124991, 0xb7fb0893, 0x7a3bf771, 0xd27dfd3b, 0x86bf862e, 0x0bb43b5d,
-       0xccfa014c, 0x1cdafb3a, 0x7686b3a0, 0x00928903, 0x582eee7f, 0x054e9a8f,
-       0x8ddf043c, 0x0998cf84, 0x0f128f8c, 0xcf485f3d, 0x731aacee, 0x8a5f6f80,
-       0x353a30d3, 0x2dbbdfb1, 0x1fa01eac, 0x974007f7, 0xd78ed155, 0x15545ce0,
-       0x02568e49, 0xfb863ceb, 0x7064a848, 0x754f5e0c, 0x997e647e, 0x85e5cf18,
-       0x63599fd6, 0x7eaf9c0e, 0xf7c7cfbe, 0xfc995e02, 0x49dfb1f0, 0xb03f2bb6,
-       0xd2de356e, 0x0ff612ad, 0x01174f43, 0x26b96a7e, 0xe3e82fd6, 0x0ab59bd7,
-       0xeab061f9, 0x55833e71, 0x08dbeb8b, 0x7e72a1f8, 0xcb9d8ea3, 0x5e8cab8d,
-       0xc7d31fe4, 0x9f28911d, 0xfbd0cf36, 0x99a43ca0, 0x87ed0f5f, 0xd7f7d8d2,
-       0x43773469, 0x136add7d, 0x3a7c4569, 0xa044d68d, 0x4bc4589b, 0x6bdead7d,
-       0xfcfcf3a0, 0xeabfc645, 0x012f263d, 0xba9ee83e, 0x8491c610, 0x8053c728,
-       0xfd41f737, 0x7a50e61d, 0x6f63d3b2, 0x6a4fbfa7, 0xe04ce767, 0xa451f281,
-       0x04bf212b, 0xf4f0035c, 0xc08dce2a, 0x0b38a5c7, 0x2cee5be7, 0x33dd7780,
-       0x738fde51, 0x132eb7d9, 0xa2ab4ba0, 0xea91d4de, 0xa818d8fd, 0x00ffc1d7,
-       0x52a76c1d, 0x83ae94ad, 0x765d33af, 0x6efb075f, 0xeb0ffa30, 0x4f4b6a28,
-       0x8eb9e1f6, 0x2b75b744, 0x98fb4cdf, 0xa57743ea, 0x38a581bc, 0xa56cbaaf,
-       0x78e52e3c, 0x9bcbc01f, 0xd41f8cac, 0x79e3b715, 0x19b8fbac, 0x0269b1cf,
-       0x53a667e3, 0xc84d7e4a, 0xb2beb84f, 0xc557c701, 0x29938fb4, 0x257eabdc,
-       0x64495a59, 0x2244b97e, 0x9fa7902e, 0x3b103e6d, 0xe97be00f, 0x8dfb8cb2,
-       0x6c9dfb62, 0xfba8e765, 0xa4700a19, 0x093d66f7, 0x9d6bdfb3, 0x4b8ef88f,
-       0x0e3af780, 0x95edeeeb, 0xf4a13f23, 0xce2679e2, 0xdcf7fc01, 0xf83f29f6,
-       0x7bbbae84, 0x9b9418db, 0xa42ead09, 0x28c4be9f, 0x3f4a56c7, 0x20993209,
-       0x6aafbc51, 0x8a3b103f, 0xb9fcfb8e, 0x8f204561, 0x9e75f117, 0x095e517d,
-       0xebfd5970, 0xf6866e17, 0x0f14af3a, 0x99fbbc7c, 0xf813fd5f, 0x4d6dd2fc,
-       0xd69149a0, 0xf7a77ee7, 0xef1a7ed3, 0x33fbf616, 0xf7e81671, 0xdf0f93f9,
-       0x6d6ef00c, 0xb3f6c56f, 0xfac16e4f, 0xe17ebf6b, 0xf207ffd5, 0x80eb15de,
-       0xdc5f677e, 0x77a9788f, 0xdfb09d6b, 0x71bd7448, 0x27c67ec7, 0x39c3ae41,
-       0x4bfc65a8, 0xdfa0b5d0, 0x773d7fcf, 0xa87cb064, 0x12195d97, 0x38364ff4,
-       0x5e50929e, 0x14389ca0, 0x7451b445, 0xd2d3afff, 0x792acb48, 0xe01d7ef9,
-       0x33f18739, 0x790921aa, 0x7f431bed, 0xcc4c7dbf, 0x2f3bd416, 0xcf0833dd,
-       0x3ba30c4d, 0xcf918f3a, 0x88798463, 0xf33ea096, 0xa875e676, 0xcd2952d7,
-       0xce1249fa, 0x1ba6e873, 0x17b9c2b6, 0x6af985eb, 0x3abda1f2, 0xf889e403,
-       0xe75f1d7d, 0xdf2668ba, 0x537e71ce, 0x075a6157, 0xa3e7b9e5, 0x8d3f016a,
-       0x2b10ff7a, 0xd18f2fc0, 0x265643f1, 0x97dbea87, 0x384d1aeb, 0x9779e71e,
-       0xf32829f2, 0x94fa79e9, 0x6bda579e, 0xf0e1e5db, 0x3e32dfbd, 0x60ca4d19,
-       0x7d66d31f, 0x62fc0120, 0x75759af2, 0x58e7d708, 0x7052c53b, 0x760ae97b,
-       0xfb74d47e, 0xcfc4d5a4, 0x69b73b0f, 0xec33aabb, 0x8e0cb7c8, 0x53fa41c1,
-       0xab7752da, 0xcb7efe99, 0xa643b70a, 0xccf7b774, 0xb4e971b1, 0x695cebfe,
-       0x2cabd238, 0x31ec7931, 0x561a77e1, 0xe88f9256, 0xcfc9dfb9, 0x68859275,
-       0xe00a2c6f, 0xb44b4aa9, 0x1f7f8426, 0x7586b5f2, 0x636f5e5c, 0xbec624eb,
-       0x1c6629cc, 0x16d1ba67, 0x671d0758, 0x2fbd6132, 0x907ccef3, 0x945a9e8f,
-       0xae3d768f, 0x5fe0acf7, 0x3b3053c4, 0xa81fc03f, 0x7a06e6de, 0x7b33d24d,
-       0xb563f805, 0xf2e6f419, 0x4092d623, 0xdacd1499, 0x6d9270d5, 0x3bae9db4,
-       0x7ec4e6df, 0x857899e4, 0x07c48afc, 0x37fe391b, 0x40c5fe4a, 0x513d9e67,
-       0xc6eba016, 0x1443fd9b, 0x53870976, 0x9e9ba70f, 0x0e5e8c3d, 0xd81e3469,
-       0x37ada1df, 0x4295696c, 0xae50f1e5, 0x4875a79f, 0xda4bc016, 0xfe051ae6,
-       0x0ab75ea8, 0x5c86caf4, 0xf7f514a9, 0xbfbfe58e, 0x291bd68e, 0xb8dea0de,
-       0xaa4f9f8b, 0xc6ff42a7, 0xf085ea8e, 0x8984f4bd, 0xfd42590e, 0xad3a5c68,
-       0x1293d637, 0x071bff38, 0xe3a4f738, 0x94f2243e, 0xd529e41d, 0x269e41ab,
-       0xde3ea3e6, 0xfa86dee8, 0x73d5c937, 0xf510b7b9, 0x9994c6f5, 0x215f380e,
-       0x2acf627c, 0xed1af7d4, 0xda288ed1, 0x7487527f, 0x4c77d337, 0x7247ad84,
-       0x77927d42, 0x73d61794, 0x9447c05e, 0xf039aeba, 0x06dd9efd, 0xafeda1e2,
-       0xf28f19ef, 0xf98bd05c, 0x75ca0325, 0x8122d69b, 0xc5ae7e5e, 0x4c1a3e49,
-       0x9cb81fc8, 0xdbacf011, 0x7381a59e, 0xc3b79e72, 0x97127b3f, 0xc36bb487,
-       0x67d21f42, 0x13dbd73d, 0x7bc2ce0c, 0xf427f082, 0x641d3528, 0xd35e18db,
-       0xe0941f36, 0x73f1ab10, 0x6be252cb, 0x65bbeba2, 0xa637c6b3, 0x19abf500,
-       0xe957f7c8, 0x742956c9, 0xc63621be, 0x5de2aa2f, 0xab27c085, 0xc11c99a6,
-       0xda2aa9fc, 0xd20a89a9, 0x157108f3, 0x26763d83, 0xcff08cc9, 0xeac3d9b7,
-       0x79f6a165, 0xb74fda14, 0x480a79b6, 0x155d6d36, 0x92e70b5d, 0xf21363f2,
-       0x0f1d0b4d, 0x51d6fdf6, 0xbefb324f, 0xb14de715, 0x8ef9d859, 0x83371577,
-       0xb5c7203f, 0xb331c982, 0x8e7edc23, 0x3e1e855a, 0x740350a7, 0x00e4d532,
-       0xafe7f2bb, 0x6e91f348, 0xc260543c, 0x38af7179, 0x2bd99136, 0xe23ba00e,
-       0xd5bea2d6, 0x86f2ecd8, 0xc7462ba7, 0x02ff548d, 0x15d29c3d, 0x83b1ade2,
-       0xf7611fc9, 0xd6089f03, 0x12b9c577, 0x35f816e7, 0x37a08dd0, 0xf5af6e71,
-       0xf3f0f67c, 0x1ff743d1, 0xbde69f4c, 0xafd72e8c, 0xfb4397b2, 0x09622afa,
-       0x76d557b6, 0x1f0e1d90, 0x8c9fdbad, 0x823cc2f1, 0xbab06dcf, 0xbd60da66,
-       0xab58df5b, 0xd4be0125, 0x21a1f7b8, 0x8ccfd257, 0xd19f365a, 0xa60de31b,
-       0xb705231f, 0x0f4b08b9, 0x9598e7f0, 0xf723fde1, 0xcf4c4cda, 0x65fab6fb,
-       0x7c05a49e, 0x5f32fd09, 0xe36bdf76, 0x08a525fa, 0xe992b992, 0xebc04997,
-       0x8d6c1f81, 0x113f02f1, 0x7af5267e, 0x099cfcdc, 0x233b0abc, 0x7ff59629,
-       0x359b9f98, 0xbc63dfbc, 0xf05fb20c, 0xee35d83c, 0x591c880f, 0xdf71880e,
-       0x7c4bdf95, 0x3523c847, 0x41fac0fd, 0xaa7ec16e, 0x6bf722f3, 0x38edcfdb,
-       0xe1ef3d15, 0xe016abe7, 0xbc627a08, 0xe700effb, 0x19c47159, 0xeb3ff14f,
-       0x27a40677, 0x0437db92, 0x2d3ad0ec, 0x806c18f1, 0x1fd79d57, 0x78a6b784,
-       0x6cd7be36, 0x1cf4c8f4, 0x6f778a5c, 0x153c7987, 0x3d03e1c4, 0x5f9487f6,
-       0xbe24b9c0, 0x4d27e012, 0x700b1fc4, 0xdbbac5b4, 0xaee53e91, 0x3b53a84c,
-       0xf3be00a6, 0x9fb30c48, 0xbd90defa, 0x2e3c2943, 0x3efffd18, 0xc2e7ae8a,
-       0x87871c8a, 0xef7a73ce, 0x99ff779f, 0xfbbf3ef6, 0x7ec101b3, 0xeca346ac,
-       0xea07c6d2, 0x6da9123d, 0xbb77c30f, 0x986fcc6c, 0xbbf08375, 0xbadea1f5,
-       0x0c99ca22, 0xfb159f7e, 0xa4af93ca, 0xac5d37cf, 0x3f20de24, 0x0f1d135c,
-       0x8e2e9ae3, 0xe643dfc3, 0x7c81f3a5, 0x4e98ba68, 0x77d9c33c, 0x30fc6f80,
-       0xc0dbf19e, 0x3f6c4cf8, 0xf3fa51ad, 0x3c45e5fa, 0x422ed7c3, 0x1f6b8426,
-       0xb5f6cf1a, 0xdf9d9b2b, 0x17924dbe, 0x2bc583ec, 0x82993ecc, 0x19fd3174,
-       0x16c5a5f4, 0x0b134f8f, 0xb1f287fc, 0xa9c68861, 0xcc8f6a46, 0xf68cf2e3,
-       0x7a068ed3, 0x1cf058f5, 0x9c39f9ba, 0xd7faf1d7, 0xac589fe0, 0x74d1c625,
-       0xc746f99e, 0xfbfa74e1, 0xb1b1a627, 0xde162620, 0xe409253b, 0x66acf258,
-       0x32122ff4, 0xa9fa02d6, 0x97cb4644, 0x0fa4ae63, 0x458f5169, 0xf074a27a,
-       0x2faef16f, 0x1d021d04, 0xf187bacc, 0x49ffd135, 0x17f3869b, 0x1fbe1d25,
-       0xc6efdf01, 0xe80afc57, 0xd738c1ec, 0x7bde703f, 0x5ff82bce, 0xfa7fe48f,
-       0xe5d3a071, 0x2453c766, 0xc389bc74, 0x4bb0b7bd, 0xdef1fe0f, 0x44c8ffe5,
-       0xf5f3b47d, 0x1ba7c093, 0x0c9f268c, 0x5d2ec57a, 0x03ec5fb7, 0x339c62e4,
-       0xf38e9e3a, 0xfada383c, 0x9209a529, 0xfdc77f4c, 0xde144ed2, 0xbc191b77,
-       0x5b778ddf, 0xee9113e3, 0x757d82e7, 0xb38f68c1, 0xfbe8bd01, 0x2632e3f1,
-       0x3243f005, 0x74bc4acc, 0x997881be, 0x01ea746f, 0x2e9c0bfe, 0x38ace75c,
-       0x8145895f, 0xf2f93c87, 0x078ed70d, 0xd3eb9f99, 0x730e5fe0, 0xb872861e,
-       0xd1fa10fc, 0xa31a74f2, 0x6499d3db, 0xaf284ee9, 0x771d25a7, 0x8bd79b3a,
-       0xef087d78, 0x37eac497, 0x5d3dba72, 0xbfa9fac0, 0xceff2773, 0x62cef1bb,
-       0xe71d1380, 0x5ebe03d3, 0xbe82f28d, 0x8dd6f94c, 0x7c5e8cf1, 0x55be60d6,
-       0xf80437dc, 0xc5096f61, 0xfacfdd1b, 0x13ccbef2, 0x19f657c0, 0x57ed5b2c,
-       0xbe64dfc7, 0xc72d6fae, 0x958e541c, 0xe4d8e42a, 0x10c72678, 0x7a25744f,
-       0x420d5fa6, 0xc87d20fc, 0x1b9f8ed7, 0xe9dc19a2, 0x478da979, 0x77cbe579,
-       0x86f7f105, 0x044e7678, 0xad1d393f, 0x38dfe3c4, 0xfbc79c1f, 0x6616f1c9,
-       0x32fa39ef, 0xb6d39e61, 0xbbff78f0, 0x8b1f1fad, 0x1967be81, 0x53c4e6fa,
-       0xea93bb7a, 0xc422fa0d, 0x09eb0c87, 0x7cf34fb1, 0xdcf3857f, 0x8099b774,
-       0xef866bfc, 0x589e2225, 0x7d97297c, 0x3d4f7297, 0x1f86afd4, 0x52a7d5f0,
-       0xf4c9243e, 0x563c3643, 0x1aa71676, 0x16f3c16d, 0xee4fcfd5, 0xfa8f860f,
-       0xbe38a7bb, 0xda4bc6d6, 0x0e8f014f, 0x737180e2, 0x3cc2f9de, 0x79c9d29b,
-       0xa1a3d18b, 0xbb2dcd72, 0xbb7ec3d7, 0xea06f07f, 0xbef4a7bd, 0x30a66d21,
-       0x13df7aed, 0xf681488f, 0x3d91bfb9, 0x778e7a7a, 0x62ff7575, 0xbbbfdd1a,
-       0x39c0764b, 0xd7ffdf76, 0x7f4023a3, 0xc039d2e9, 0x75f2a0ac, 0xd1f61683,
-       0x53b4f4cc, 0xcffc251a, 0x47694f7d, 0x46f1c33c, 0x33a40af5, 0xf14e0fc1,
-       0x6212e5b8, 0x159fba41, 0xea15bb1d, 0x6e4be5fe, 0x7ce63885, 0xa4ec38e2,
-       0xeeecfff0, 0x5e77e889, 0x2fc89c44, 0x1f7479e6, 0x05d3f306, 0x45f594eb,
-       0xfd3aca6d, 0x92efd222, 0x73bfd547, 0xf865707f, 0x78d1daf8, 0xd39d27a6,
-       0xcfdf6f87, 0x7cbdbfdb, 0x837881be, 0x7c8080f4, 0xd5dfc02d, 0x39021ef3,
-       0xd390125c, 0x5d373e42, 0x8f308a8c, 0xb73f7f09, 0xdffafc38, 0xe9a37ce6,
-       0x79e515a2, 0xfc04f8e8, 0xd8666a9d, 0xe9b5e04f, 0xc4f12a62, 0x3f42ea07,
-       0xc0cb8c0c, 0x2c002a76, 0xf804c69f, 0x0b03f080, 0x2240fe3a, 0xdfb454c6,
-       0xac7ae61e, 0x52fc00a5, 0xa7bc801f, 0x278f76f8, 0x12e9faaf, 0x3a97dde7,
-       0xa01d9b44, 0x283ef573, 0x07f59c3d, 0xe24fb9f1, 0xae7809cd, 0xf0619186,
-       0x73a7415d, 0x0715507e, 0xf72ffef2, 0xeb072657, 0x0e7efd63, 0xa897b33d,
-       0x2dc85524, 0xf36b92a2, 0x2b1ca83a, 0x0862bd40, 0xf68f8d30, 0xb93e474d,
-       0x80923890, 0x19f77b8e, 0xf81fd132, 0x5899e52d, 0x3ccf14cf, 0x1337d31d,
-       0xf0d70e50, 0x64e94fef, 0xe8c68dfa, 0xe2fea1d4, 0x124b7624, 0xee4c989a,
-       0xa5a2a152, 0x1d449bf5, 0x47d68788, 0x3048cdf3, 0x26ffae9e, 0xeef9925e,
-       0x06573814, 0xec0caef8, 0x65029bc8, 0x1d8748eb, 0x4b9231ca, 0xf0c1d6cb,
-       0x67348e3c, 0xd18d7f40, 0x89fd332f, 0xc60920ae, 0xbab1ef8b, 0x4cd7d799,
-       0x116730bd, 0xe3326efc, 0x75f3d7f9, 0x7ca0490c, 0x246df60c, 0xc1b7d846,
-       0xe31cfbe4, 0x54f4bc4b, 0xf52ed1d8, 0x03f41364, 0x02769344, 0xce9935df,
-       0x16b3607b, 0x1ea09162, 0xbbe0b965, 0x337f008f, 0x90c33479, 0x009f5dbf,
-       0xade96f7e, 0x28ffc0c5, 0xf3802d3f, 0xeb5db11f, 0xf05e7d43, 0x5f5f1b27,
-       0xa94fe72b, 0xfec24054, 0x7e9fce65, 0xfc8c5e6a, 0xf6b88129, 0x14da7f03,
-       0x53f9013b, 0x7ae37132, 0x156827e2, 0xa5d1267c, 0x6ad727ac, 0x23c87c55,
-       0xdd52fac1, 0xe48ddfca, 0xc907ca14, 0x1cb94ae7, 0x2e4a768f, 0x157423f8,
-       0x44f51cec, 0xb4fd78b1, 0x9aceb668, 0xbff31b04, 0xfdb8b145, 0x2101f4d5,
-       0x017ad5ff, 0xb5da5629, 0x413d368d, 0xb512553f, 0x7ea187a8, 0xf4c09350,
-       0xd03df783, 0x5f21f72e, 0x0bfdc13e, 0xaab82753, 0x77df14b4, 0x4ea391e6,
-       0x724b2e5a, 0xba5026d7, 0xb9a47e99, 0x6bd69ea1, 0x3ef922df, 0xb18e165a,
-       0xf8a76dd4, 0xecdb3b5d, 0x6beb4d58, 0x3dd48ccd, 0x97d40689, 0xda69c808,
-       0x829345be, 0xf02691fe, 0xb47e52c7, 0x4011e216, 0xda098317, 0x593f54d3,
-       0xb6e3a46b, 0xd658b7ac, 0xd58fc1db, 0x85fc0e37, 0x65888b7d, 0x3e73092b,
-       0x4773d12e, 0xd424fcf1, 0x4e255e29, 0x6df7e26f, 0xab0e7bf0, 0x3b05298f,
-       0xe9cbfd90, 0xfc0b0ca4, 0x4f2cb937, 0x5cb3a9a0, 0x39eb4897, 0x4fe81d63,
-       0x8c4f9c26, 0xe7e1df10, 0x5ce05470, 0xaf217b60, 0xb87cea0f, 0xcbe6092a,
-       0xaeee0e23, 0x58239c0b, 0x50fe85ac, 0xe0f1ccca, 0x09237c73, 0x2af983fc,
-       0xde23f303, 0x43b6f2c6, 0x76bc59b3, 0x1fb7d684, 0x5e28f9ce, 0xd332f216,
-       0x43be5525, 0xe8c8bfe9, 0x0edbb038, 0xb0c97520, 0x43cb52ef, 0x91fdf0ad,
-       0x81e277ae, 0x52368daf, 0xd6cb40fe, 0x92c38732, 0x80d6fb83, 0x2747a9ff,
-       0x0e3393e4, 0x11606b73, 0x9cd5fbf4, 0x96d6a696, 0xfb0c5edf, 0xec0992eb,
-       0x5c1ca22f, 0xc1359329, 0x8be787f2, 0x09fbfa88, 0x207fbfcc, 0x21379c61,
-       0x74f82e28, 0x7283d702, 0x8ff02e49, 0x2cfdf3a0, 0xf9775bd0, 0xbfce919b,
-       0xff9f9db2, 0x75c39c3b, 0x3e72efa8, 0x8badf820, 0x274cc5e7, 0xa7c01d4e,
-       0x01f28a2b, 0xbe563f5a, 0x34c0f90c, 0xdfdfc6e2, 0xa6f060ab, 0x7cc1d788,
-       0xf5282653, 0xca5c3b8d, 0xb55ab4fa, 0x9ebf423e, 0x74eef814, 0x46bdb2b7,
-       0x941397e8, 0xeface5fa, 0x9ca2b25f, 0xe1ba7e4d, 0x97f040f2, 0x8225d54f,
-       0xe793b0df, 0x184a74bb, 0xf9e26a1f, 0x921d4d2e, 0xa9a5df22, 0x8903de73,
-       0x8d2ef941, 0x77cb571d, 0x09c8fa61, 0xf83f779d, 0xa32c4fd5, 0x39dfa63b,
-       0x0e22f3c0, 0x51445e42, 0x73ccfe80, 0x52909f98, 0x33d1fa33, 0xd00e312c,
-       0x8a69d7ab, 0x2eb8afd0, 0xfff0acd6, 0xace55fae, 0x9fc27e82, 0xa65cf228,
-       0x3b734819, 0x641d53f3, 0x8fcc5cf9, 0xb4f6e5e4, 0x7e124137, 0xc7e835e1,
-       0xc4df9d52, 0x24f28278, 0xfa2e6671, 0x0b3b6b0b, 0x4b5fc18b, 0xb1fa12e5,
-       0x1c7609bd, 0x442eeb5f, 0xa62dd73f, 0x683f18e9, 0x5da2dcea, 0xcfd00a68,
-       0xc5dd055f, 0xbba01890, 0x4ed1ff7e, 0xdc8ffa03, 0xa06bebb2, 0xafbd7aaf,
-       0x12e92880, 0x77248f7f, 0xebbc7096, 0x17d35c2a, 0x1ef4b851, 0xfec03bd5,
-       0xe2058aa3, 0x563dc5eb, 0x1ada83e4, 0x4d7efc82, 0xd97e4139, 0x4ff985bb,
-       0xbd2eb33e, 0x9afef815, 0xaa72826a, 0xe10e36c7, 0x0f788cbf, 0xa5b8e93b,
-       0x053d299b, 0xb6bbfff1, 0xa4f5eb29, 0xfd78f91d, 0x44ba10f6, 0x56f824be,
-       0x3acbb103, 0x52ec6b88, 0x9883278e, 0x7870777c, 0x3abe7217, 0xadb18efc,
-       0xae1f6f10, 0x2c85fc61, 0xa0d7a474, 0xf2cb34fd, 0xbab01469, 0xe92ba5a7,
-       0x33e6bd47, 0x8cc73b32, 0xf9f0967f, 0x84bd7cd5, 0x6b3745eb, 0x1450a1a9,
-       0x7f6873d0, 0x74d41fac, 0xc09a29ca, 0x38f98b3a, 0xbe095fa1, 0x5e55f02a,
-       0xa5194846, 0x39139bb3, 0x3649b3be, 0x8fce9be0, 0x46412e74, 0xf7e70d8b,
-       0x8a343d80, 0x83d28f7f, 0xa3cae807, 0x7e817a31, 0x28cd4ad7, 0x47a08c4f,
-       0xe4bd72d3, 0xf2fafe46, 0xf40c8f52, 0x4f349231, 0xf80b35b9, 0xf00c576c,
-       0x15274a1f, 0xfa018989, 0xccbe2569, 0x8e82921d, 0xfadbbdb0, 0x123a5866,
-       0x1ef7dffc, 0x11260bd3, 0xefd1bfaa, 0xf4c4ff3a, 0x12d28397, 0xc7aa13a4,
-       0xe5fd041d, 0xafb30d4d, 0x406dd226, 0x128b2abf, 0x9453e3ff, 0x10f689f5,
-       0x013cc0fa, 0xbd3c3f67, 0xa4cf585a, 0xa73f655c, 0xc9445fe0, 0x25c8b2bf,
-       0x743f0766, 0xbfb05ef8, 0x5c925663, 0x8d520788, 0x4c3831cf, 0xf13ea5bc,
-       0xd7dbf73b, 0xdbf18627, 0x3db8eaf7, 0xc6b3a2a0, 0x6ce767c3, 0x147a0120,
-       0xd246e2e7, 0xf850a72c, 0xf163bf49, 0x0e811b91, 0x19945d29, 0x3be81e49,
-       0xc3f998a4, 0x7410f9c4, 0x1b6bca57, 0x240d9d04, 0x6ece8103, 0x7f4288ea,
-       0x6f408de8, 0xf90b7e94, 0x0b9e42bc, 0x2cb5bdbd, 0xa4b2be84, 0x39eb941c,
-       0xae424f40, 0x8f1c970f, 0x7a0597df, 0xf6f507bb, 0x436a7a20, 0x3d28927a,
-       0x4427bfa1, 0x55db2a5e, 0x7ef026f4, 0xe5a3eb9c, 0x85ed19a4, 0x4e4cd1a9,
-       0x3d99aafa, 0xd224d94f, 0x8c35ebdb, 0x1388aade, 0x289cade9, 0xa8d2a4e9,
-       0x91e9abac, 0xa4a3517e, 0x9bd23737, 0xd1234e9a, 0x37a040db, 0xafe32f21,
-       0x137b6f4e, 0xff33ff4d, 0xedbd285a, 0x76b92c4d, 0x6c7c137a, 0xd2a59447,
-       0xa97c7204, 0xf8617284, 0x50ad41d1, 0x8590da1f, 0xab0ee7fa, 0x37b600e3,
-       0x2ee2f6b3, 0x0ef90ca7, 0x7b782b39, 0xea12ab96, 0x3b692b4d, 0x38e4ba9d,
-       0x741887cb, 0x5c2f6b3f, 0x0cc07cdd, 0x1b0f2f7e, 0xb5f3f7bf, 0xf76d2c72,
-       0xcbe3e5ae, 0xdea12adb, 0xff8d8eb4, 0xc328e20c, 0xdbca8f20, 0xb75fbf0a,
-       0xccc1cb21, 0x8ef7a657, 0x21ddfbe1, 0xe3803ced, 0x25b8d8da, 0x04d18d87,
-       0xcfa66ced, 0x39f7ccde, 0x67db3366, 0x4cb747c2, 0xa7bf83b0, 0xd8fa83cf,
-       0x52fa9aa7, 0xec1173e4, 0x2da972d4, 0xc0f1ca03, 0xbbc064bf, 0xcd9c9d63,
-       0xe95b68e2, 0x644abe27, 0x7f110e7e, 0x75773882, 0x55f37e90, 0x8a13f322,
-       0x8236497e, 0xcc7912fa, 0x8888768c, 0x211ef98f, 0xd84f9c12, 0x148b8c23,
-       0xd39f1b2f, 0xf8c3fa8c, 0xe64e2281, 0xdfa7ced7, 0xc5fcbc2d, 0x987e70b8,
-       0xbd32247f, 0xdb8f0ce5, 0x7a97df8b, 0x077f3c59, 0xc01a4910, 0xd626f755,
-       0x2b0844ad, 0xbc03290f, 0x46cc7ab2, 0xa8ebc7e9, 0xd344bf91, 0x7080f5ac,
-       0xff3094cb, 0xf1177268, 0xae86c5c5, 0xf896bc7f, 0x087f2cf4, 0x55b8bfd7,
-       0x8443f98f, 0x383bb5f3, 0xc1e8c8fe, 0x72a7ce78, 0x7124a53c, 0x19387dbb,
-       0x0eea7c0e, 0x8d3bb78e, 0xa7263acd, 0xfe2a74db, 0x7a049191, 0xfa88a6cf,
-       0xc55db2b8, 0xeff2965f, 0xf87ae62e, 0xfe87d232, 0x1eb94fc2, 0xd313667e,
-       0xed22efc3, 0x7dec2fe8, 0x0d9de98c, 0x2f407b74, 0xbe4abccb, 0xb28cf750,
-       0xacaed0de, 0x0eb15237, 0xa87537f3, 0xf31e4ef8, 0x6a6ef6c3, 0xdbff0528,
-       0xa28f47d2, 0xe0a977df, 0x9f255e33, 0xc67ee421, 0x1eb91e67, 0x7b6a3ffd,
-       0xd4e9d85d, 0x0929be3e, 0x999690e3, 0xcc37a0f5, 0x0f796189, 0xf91f29b2,
-       0xf688d982, 0xa0be2472, 0x5e8483b6, 0x7f0fae42, 0x3204a85e, 0xe0823ec2,
-       0x5fef82ef, 0xb6525ec1, 0xec23f0ab, 0x3f1c1995, 0xe1fe2853, 0x76127f3b,
-       0x9f8632d2, 0x0875c4a9, 0x5ddef3f0, 0x6ec23f0c, 0x9276e6fa, 0x93b60e53,
-       0xad75bd84, 0xefda92f6, 0xcf5bce2e, 0xdacf6100, 0x026d9ed1, 0xddfe5340,
-       0x13c4f7b0, 0xefd02455, 0x68710b58, 0x72f54175, 0x66b57fa5, 0xc852e9d2,
-       0xae88cc9f, 0x46e017b8, 0xffd1133a, 0xec2c90d8, 0x34ff3627, 0xe175cf9e,
-       0xdb38accb, 0x29c4fc95, 0x836b86f3, 0x6d5ee3ec, 0x43d82c5f, 0xfc2497bd,
-       0x61add42e, 0xf18151e2, 0xe87c710b, 0xf7bebbf7, 0x4f73e067, 0xf13c60c4,
-       0x2ecc97c2, 0x2879b0bc, 0xe39f15e6, 0x87015771, 0x799f8725, 0x70e70fd5,
-       0x10e182e5, 0xbc93aebf, 0x6da6ed5f, 0x9fee8c23, 0xd3adf9c3, 0xbe8cf4f8,
-       0xec445c58, 0xd3dfb23b, 0xff4f7c83, 0x7dbf931a, 0x89e63452, 0x0487dfd2,
-       0x273687c7, 0xf081f8b3, 0xf93909c7, 0xe56f5e47, 0xa35a9ef7, 0x3f98fec4,
-       0xf3bc52e2, 0x1fff8029, 0x57e0fd61, 0xfc87477a, 0x10e6fc1c, 0x9952a4b7,
-       0xd742dba4, 0x6df9f105, 0xdf9f10d7, 0xc5e4c499, 0xb08b4a39, 0xe73645be,
-       0x33bdf08b, 0x86790e3c, 0xc4ceb1c7, 0xbed6b8b2, 0x7cacfefe, 0x2267979b,
-       0xbf45d1c4, 0xae8c5b8f, 0x3ede9435, 0x35ae216c, 0x1fd83e54, 0xde633431,
-       0xafb62ccf, 0xcc563dde, 0xfee31513, 0x0e7e5494, 0xd5acf1d6, 0x85ca1875,
-       0x347bca6d, 0xd41fb0bd, 0x7abed837, 0xbe2958a3, 0xeaa4a7f7, 0xdecf8073,
-       0x67c47ee9, 0xa8a47d7f, 0xdefe70bb, 0x5fc8fc9b, 0x345bf709, 0x2918f3f0,
-       0xf8b5760e, 0x3c8e3a97, 0x1e6f9c5b, 0xa6c59e47, 0x1c79b322, 0xac918e79,
-       0x73eda74d, 0xffd1933b, 0x33d634be, 0xf6471144, 0x78a37cc4, 0xdec7a0be,
-       0xec388101, 0x0e20df63, 0x3be9397b, 0x4e5ec38f, 0x5587130a, 0x025fe9c7,
-       0xc01741bd, 0x0616ddc3, 0xbeb92ab7, 0x17a0fc12, 0x8fcc1216, 0x8fd9242e,
-       0xec3d068c, 0x91788e88, 0xfa3d326f, 0x744b786a, 0xe15d8869, 0xf6268ebf,
-       0xbaa4fda0, 0x6a3a8a6d, 0x877941e6, 0x14d34be9, 0x673407e3, 0x5c0ffa2b,
-       0x3da2bd79, 0xa8a453cb, 0x51bbace7, 0x5b707fd1, 0xf43ea285, 0xfd145bd1,
-       0x28d6f3af, 0x7fe017ea, 0xc8c9af90, 0x66786ed7, 0x92fc6286, 0xf52c5e37,
-       0x7cb9b6c1, 0x8b72e56e, 0x795d9c78, 0x02fdcca5, 0x9f6fc8fb, 0xf89798af,
-       0x0a549f24, 0xeff64971, 0x87bb2c5c, 0xc58bb0b1, 0xdc758607, 0x684ef8a5,
-       0xa32ed25c, 0x9121d5de, 0xf8d0a4c7, 0x87ced2e4, 0x8ade42d7, 0xffa17f5a,
-       0xa0c5b572, 0x3e6344ef, 0xa99f5aa4, 0xa027364a, 0xd24691de, 0xe9ab5d18,
-       0x0f0fd4c2, 0x4851f7b8, 0xba323c86, 0x0a174158, 0xa1f851fc, 0x76c2eb7f,
-       0x2d35e633, 0xd2016379, 0x494521a3, 0x25765117, 0x2ae4c45d, 0x50ecc2e9,
-       0x995c41d2, 0xf0d40e92, 0x74953ab6, 0xbff4fc41, 0x7e3bc02b, 0xd46e9282,
-       0x7d222ef0, 0xd80f3187, 0xdf00392b, 0xeb2f786a, 0xbafb82d8, 0x3cb8be9a,
-       0x3917c799, 0x741f877c, 0x6e109ab6, 0xf8493f2c, 0xeedc0c03, 0xbf4a0926,
-       0x56abd098, 0x8dbd7325, 0xf2fc23cf, 0xda0f256b, 0xb871fdf1, 0x2fa65f32,
-       0x66f9ec0b, 0xae43fcc2, 0xc3139207, 0xf7f117fa, 0x0145fe48, 0xff5ca9d7,
-       0xff2c23ac, 0xf31478e6, 0xbd5c7d0b, 0x8b42fd0c, 0xd1ea3349, 0x73c66ae7,
-       0xfb07a1ff, 0x0219e1a9, 0x529d353f, 0xf904957d, 0x1aa2ef5f, 0x142726b2,
-       0xe4a7529e, 0x533dc333, 0x81e429d2, 0x5013dd9b, 0x84e857fa, 0x12bf3052,
-       0x5f98b0fa, 0x31f04fc0, 0xfc01af31, 0x540e7032, 0x2ae48d7c, 0xc7f6a2f1,
-       0x963031c0, 0xec5bc706, 0xa33e3824, 0xfc04c3f6, 0x84fed42f, 0xacc0e178,
-       0x3a07b856, 0x3f44e2dc, 0x9ae9095f, 0xff0bbf09, 0xae21fa0b, 0x887efd23,
-       0x2aea7288, 0x1e29ddf1, 0x5678ffc9, 0xc4575c68, 0x3e182989, 0x3c1d33fa,
-       0x800fb25a, 0x1decd475, 0x1474089a, 0x9c7497ea, 0x23ce857c, 0xa1e2fa6b,
-       0x2824155f, 0x5f7dc507, 0x9fb8fc97, 0x81f3893b, 0x8dddfbe0, 0x4cdc7da4,
-       0xf95307f4, 0xf3250b18, 0xb50e915b, 0x7f45adde, 0x04ee86b1, 0x048ebde8,
-       0x02b33bc5, 0x439758ed, 0x479ad7eb, 0xc2c53933, 0x3e5809f3, 0x4ffce128,
-       0xed9191d8, 0x16fae535, 0x49661698, 0xc105f7f4, 0x7586b8eb, 0xb8097c8a,
-       0x90710a27, 0xd7042981, 0xc76c95d3, 0x4fa21bdf, 0x6e84ebbd, 0xc1995dc5,
-       0x9e936e7a, 0xb760361a, 0x716064bf, 0xfea576cd, 0xf4c29d1c, 0xe070c8e0,
-       0xbb2a59f9, 0x8f7a6ae6, 0x4aeacfc8, 0xf7d628b6, 0x362b9c60, 0xc06f7e85,
-       0x92a7ff49, 0x4abe3026, 0xc43cc6ee, 0xde321d0b, 0x89bc6aa7, 0x3dc687f1,
-       0x9ea11e32, 0x17de034e, 0x0071da5e, 0x16eea5f5, 0x7ea880ca, 0x7e85b672,
-       0xe015f079, 0x246fdaaf, 0x31e4417b, 0x7ee1490d, 0x10520288, 0xf105079c,
-       0xf1b094fd, 0x27fcfeff, 0x93e73b65, 0x1c5e7255, 0xcfeda3dc, 0x65f6d16b,
-       0x47e104d6, 0xb8af8fbd, 0x73aa525d, 0x70a14f0d, 0x632ba0fb, 0x2557cc23,
-       0x034e1e77, 0x1c90acf8, 0x631b7f10, 0x0d1bf760, 0x734772f2, 0xf4379d90,
-       0x7105d95e, 0xee2bd3ce, 0x69fdc1b1, 0x4950ef31, 0xa8f0f783, 0x0ffef185,
-       0x36ee218b, 0xd69eb1cb, 0x9d981b66, 0x18bdf599, 0x5f3d0e5f, 0xfbb3d3bf,
-       0x66ecba5f, 0x67d057bc, 0x976fd195, 0x40b19320, 0xe2bd6217, 0x1df8a2de,
-       0xfe4353ee, 0x4c7df8a6, 0xbbf0df6b, 0xb14a6969, 0x187bde2b, 0xbc37d953,
-       0xbb8014d9, 0x4c6ad7c8, 0xfd05afd4, 0xeac8c7a8, 0x7a8b99c4, 0x3b230ae4,
-       0x3db8a75f, 0xb0b06a76, 0xe0e67da7, 0x28c6a83c, 0x93e61c67, 0xb01323bd,
-       0x38b4bf3b, 0x5fb8ace3, 0xc2c79b0b, 0xf9e1e9e6, 0xabde2bc3, 0xb12d7b40,
-       0x531e7c35, 0xbbd30a43, 0x8aca2feb, 0xad7aa63c, 0xea91f30f, 0xbf15ea2f,
-       0xe2e1487f, 0xf3ea0431, 0x071a0ccf, 0x1c405beb, 0x82ffa16b, 0x13c43175,
-       0x3c8897a4, 0x7c3d3566, 0x68dff1cd, 0x30ed12d5, 0xbaec0fbc, 0xfe57bf52,
-       0x5fbd8729, 0x468a48f3, 0x1e61a1e4, 0x3037b531, 0xf7eea79e, 0x7cea29ef,
-       0xe7de3f33, 0xdb37cfec, 0x77c57e53, 0x962f1a19, 0x1bc1f22b, 0xd71878e9,
-       0x2aac7178, 0x4bcf9c1f, 0x029bb3e7, 0xe0916679, 0x5b3275ff, 0x91e42357,
-       0xceff07c5, 0x9df029e8, 0xe6179e04, 0xf8f3858f, 0xf78c876c, 0xa23d9f9d,
-       0xcc35b099, 0x5c393bba, 0xe2d44fae, 0x47c1b939, 0x7cc25b9c, 0xf713f45f,
-       0x3c7dc419, 0x5576faf5, 0xfac0e7f8, 0x7e658c47, 0x2f3cf561, 0x758af870,
-       0x7c31b2ef, 0xf14abe34, 0x2c28f981, 0xcd97774f, 0x83f918bf, 0x4fe78945,
-       0x763ad992, 0xc4cfe2dd, 0xcc899cfc, 0x0f448eae, 0x7fdd58f7, 0x9a6e3d45,
-       0x48d57209, 0xb259b6a9, 0xabb79d04, 0xee0043d1, 0xa1af02b2, 0xbb63d770,
-       0x63f3f798, 0x7e7edcec, 0x61539d8c, 0xa8fe7c0f, 0xf401f98c, 0xa0a49b40,
-       0x09cffb3c, 0xde7c0b8b, 0x3ffea126, 0x4ac84ddf, 0x6de677ca, 0xe2fa63ab,
-       0x7531c353, 0x9fbf7e07, 0x547997f2, 0xcb4cddde, 0xf1546bf9, 0x08576e61,
-       0x8370bc39, 0x1b21deca, 0x3cc64bfe, 0x279466cf, 0x1cae7f8b, 0xa4db74bf,
-       0xea7be0cf, 0x4afa3638, 0x71fcfda9, 0x4bcbd70a, 0x83c82949, 0x42fa9fbb,
-       0x7c8f6b1f, 0x7e50ce1e, 0xf030683b, 0xdd96235d, 0x2f2c162d, 0x41bb38a6,
-       0xdd53e83e, 0x7bd7c0bd, 0xbaf061df, 0xc9817f50, 0x39bcb80b, 0x84b9f812,
-       0x9330cef2, 0x841f79c5, 0x2e14ec7b, 0xfb930306, 0x35fddc72, 0x5e957193,
-       0x7e118ba4, 0xca2b1ccb, 0xd00a4723, 0xe373c27f, 0x13fc0027, 0xc2718b9f,
-       0x7b97d6be, 0xc37f069f, 0xe8d155fa, 0x581a35ff, 0x7b67399c, 0xc0ec06b9,
-       0xfb4976eb, 0xd4d1dfc1, 0xde172ab9, 0xa3d93017, 0xae213f31, 0x93165e73,
-       0x093bec73, 0x801daead, 0x57b804cf, 0x3eb5d747, 0xf8c29bcb, 0x1a83d338,
-       0x257bcc39, 0x3dc07ffb, 0x321bcf6b, 0xa0bc83de, 0xd7fcf965, 0x915f8613,
-       0x0edf050f, 0x29baf7d6, 0x40d0c8dc, 0xc976fafd, 0x77c58ba7, 0x515e3024,
-       0x3497dabf, 0x6fd1e413, 0xe9ef18b4, 0x52efd75f, 0x23ae202b, 0xc94cd0e4,
-       0x5c47fcc2, 0xc44e9d9f, 0xaa17163f, 0x9d3274e5, 0x6333b1eb, 0x13e77c18,
-       0x9b8c2647, 0x1ab12461, 0x5666947a, 0xfee097b6, 0xd05674ea, 0x237c4407,
-       0xde111eb2, 0xb4f8d3ef, 0x94c7dd99, 0x24c086fa, 0x72a7c167, 0x3a37f385,
-       0xc69dc995, 0x4b8fcc21, 0xc4271106, 0x1d5f1ad3, 0x72ec05ba, 0xdb8b3443,
-       0x8464be52, 0x810e56f7, 0x5efba6bc, 0x7b144af6, 0xc7dc433f, 0xe10b38b6,
-       0x4d53637e, 0xb7de1146, 0xef87d93a, 0xfce8f420, 0x297e7899, 0x4ca891bf,
-       0xb6d373bc, 0xce94b55b, 0x3ea8d31b, 0x366beb46, 0x0b55bced, 0xfdb2e4f7,
-       0xfeb4358b, 0x58b7a6fc, 0x4ffef5fb, 0xa6f2fea1, 0xc8bdac13, 0xf5a658bf,
-       0x613e9b63, 0xa4d060ed, 0x4d97f211, 0xe87ab7dd, 0x5cad67fc, 0xf1f871df,
-       0xdee36a1e, 0x7f609aa1, 0x8ca99be2, 0x628d9d5f, 0x9166cefd, 0xef0035b9,
-       0x5ffdf0dc, 0x24f0d548, 0xc52c368d, 0x9278c57e, 0x22dc7e12, 0xbf196e3e,
-       0x86263a87, 0xf1628bac, 0xc52c4f29, 0xa1cec1c3, 0x989b5f18, 0xf370e36a,
-       0x62253be3, 0x314f011e, 0x5deef89f, 0xbe599720, 0x9e706d5a, 0x7f1cddfa,
-       0xf06b3bf4, 0xec9c833b, 0x464d66fe, 0xe28fe021, 0xa6f1cb4d, 0x7b89bc05,
-       0xb5af30df, 0x70fff900, 0xbc1f5bf0, 0x0567fb44, 0x93a6add6, 0xa7c65496,
-       0xb8b2b597, 0x07359f62, 0x0c4c69e9, 0x58a2f77f, 0x1c638fb9, 0x5aa66f0e,
-       0x01073df9, 0xbf0964af, 0x98e1cad3, 0x93521fe1, 0xfdf7cdff, 0x77cf5f30,
-       0x7c20efbd, 0x8afde139, 0x6dd71d83, 0xb1b1fb65, 0xcf4a54bc, 0x1ef3d436,
-       0x7677cc56, 0x197c6a95, 0x5fb0903d, 0x7f8e0e5b, 0x2077bf90, 0x7182f3de,
-       0x3f4c0559, 0xdc55bd05, 0x9b9e27d3, 0xb4ffb049, 0x3b7e3eff, 0xd81b37bb,
-       0x7cc5ade7, 0x4fbe169f, 0x57a7db0b, 0x78e4af41, 0x7354e65f, 0xc3f71d28,
-       0xbcbe7fbf, 0xe29f3e22, 0x0f9b879c, 0xbc2475ce, 0xf1aefc1c, 0x82a9d622,
-       0x559c3f67, 0x84f013eb, 0xf2e38df3, 0xd6297494, 0xf3a472f9, 0xbf2df59d,
-       0x35c6ce57, 0xf7e580fc, 0xae92bb12, 0x6965761b, 0xc62e7e20, 0x2ecf03e5,
-       0x3ebdf809, 0x6076e54b, 0x9088c906, 0x352e778f, 0x7f0cbfbc, 0xbd81db57,
-       0xacef9656, 0x26f407f6, 0x109cba3a, 0xeecf3a47, 0xf9528f6f, 0xb29e202f,
-       0x171814d3, 0xfaca2f90, 0xbf0634c8, 0x1f4bff50, 0x362d2fde, 0x7768bc54,
-       0x31eebb50, 0xbfc06dcd, 0xee2ae38b, 0x98f5a2c9, 0xc06ddd34, 0x2bd38bbf,
-       0xfca2c8be, 0x67a69cdc, 0xbe2a1bf5, 0x63fa86c8, 0x8c7fd67a, 0xf7e045f3,
-       0x6dbfa3c4, 0x8f406a6c, 0xb3b34d88, 0x1a9553fb, 0x5fabff7c, 0x019df97f,
-       0xd70117f5, 0x41b16548, 0x4e2e1cd3, 0xe8269c95, 0xca13c581, 0x90ed7fe0,
-       0x7cedc4f7, 0xe76156bf, 0xfbb2c6f7, 0xfefbbdb7, 0xb227f786, 0x6919dcd3,
-       0x314d5d74, 0x68b273dd, 0xfbcc757d, 0x9c92af18, 0x3f010f54, 0x6642dd87,
-       0xdd4af5d1, 0x2fa05deb, 0x461cbb91, 0xfb95c22d, 0x314de07d, 0x5e57bf0a,
-       0xe97dcdfd, 0x582e33ec, 0x07ce48c7, 0xfafd5e9a, 0x3673882b, 0xc039359d,
-       0x73b23e2d, 0x6fa03dd3, 0xf37cec8d, 0xd987266b, 0xeeb10f7d, 0xa3d7e091,
-       0x187597bf, 0x3b23fd70, 0xfd045baf, 0x33a1fd47, 0xa6e4e807, 0x6056be53,
-       0x5efbbd0b, 0x1fde574e, 0x798aecfd, 0x4de3118c, 0xe89f1e02, 0x1499e809,
-       0x7833371e, 0xab7cc25c, 0x6b63c49e, 0x2b97a8fd, 0xbd50d3ef, 0x17a6e31d,
-       0xfc03b448, 0xb35ee2f8, 0xb2785fda, 0xfe8fee9a, 0x5d1f537e, 0x3cde9041,
-       0x3291a2e6, 0x9cbd4092, 0x4af51558, 0x7fa2aa63, 0xd14b2595, 0x3ae53e3e,
-       0x7b44fb45, 0x293ea2a1, 0xffa2a477, 0x45728e6d, 0x89b2f6fd, 0xced5fe8a,
-       0xd0bd456a, 0x3fe8aed7, 0xb28748fc, 0x019138fd, 0x1d27450f, 0xf92ca007,
-       0xc76e89d8, 0x07cd33d2, 0x25f91ca0, 0x5fda8703, 0xf6c5e37a, 0xf0bbf003,
-       0xc7efaa97, 0x34e9ff08, 0x87d5e4d9, 0x68a693f7, 0xf25e7969, 0x35913f23,
-       0x2d8c7eec, 0xe02f7dd6, 0x198fdc4d, 0x8a52fe03, 0xe7b9aa84, 0x59f0bdd9,
-       0x12765fcc, 0x69fc0310, 0x7cfd19ba, 0xcfcd7527, 0xbdc599ff, 0xbbdf0007,
-       0xb156afa9, 0xdd1731ef, 0x93977d8a, 0x2d3c2a65, 0x2cabd457, 0x1ff4503f,
-       0xd14ab29f, 0x90fed13e, 0x2b0f4f0a, 0x3639b7ea, 0x45b4f0a9, 0x28dfa785,
-       0x70edfbda, 0x157abfee, 0x1cb44efc, 0x04aaefed, 0xa67cdc3c, 0xd651f10f,
-       0x780956d5, 0x3b64f1ba, 0xe7d8abe2, 0x597604aa, 0x00f9a47a, 0x7f6a3e94,
-       0x5ad7b8c1, 0xd83cb052, 0xd5ff4762, 0x2c5c96e1, 0xf038b48f, 0x94b7dff7,
-       0x8b56f961, 0x6cffcb13, 0x57658099, 0xf6cb0b8b, 0xbfec7696, 0xf983a5b3,
-       0xdffbe2bf, 0x7e001815, 0xbf8d1e81, 0x3c56ee11, 0xe434d8f7, 0xfed13d9f,
-       0x26afa81e, 0x9636de77, 0x81e78d32, 0xcc9d8089, 0xcee9a3cb, 0xbf94e9d1,
-       0xac1c85ed, 0x41fe4092, 0x0859c6bb, 0xb4e1f87a, 0x0ed13f05, 0x5581e420,
-       0x958b14ae, 0x8eb48dd5, 0x643186c8, 0x199c4fc1, 0x25105e74, 0x70584c18,
-       0xa37bd41b, 0xb4defb58, 0xf279b705, 0x637107fe, 0xe17e4867, 0x7130b4e1,
-       0xd8cfe7e3, 0x39cfe0cd, 0x19a86976, 0xfb8c71e0, 0x50a49cb5, 0xe5968f37,
-       0xc81d42da, 0xbd2a93d9, 0xe4539444, 0xde61b7f2, 0x0ee38d76, 0x45be6fcc,
-       0x6b7e8047, 0x8aef6624, 0x99d3db7e, 0x9b7bd0bd, 0xe3a9ed01, 0xbc22e71a,
-       0x3df52717, 0x49ee7001, 0xa9ca3efb, 0x265f735e, 0xed3bafc0, 0xd89eac7b,
-       0x08e484f7, 0x7c18ebaa, 0xf7bb4fde, 0xd9cf86bb, 0xf85092b4, 0x5859a6f4,
-       0x1ce7c0dc, 0xaf007a80, 0x3676af1f, 0xdcac9c60, 0x71f61839, 0xe76065cc,
-       0xfbc665d7, 0x2ceb4413, 0xbfc823b9, 0xc3ae9753, 0xa2e15371, 0x6739f81b,
-       0xd5ce78c8, 0x9d287cf0, 0x27481fd9, 0x8f4e6760, 0xb8e0bb41, 0x5737dd86,
-       0x9d267ff7, 0x1173d9c9, 0x0dfd83de, 0x94c57b87, 0xd377e786, 0x44577af9,
-       0xaebdd4e1, 0xf58fa8a1, 0x9f784b36, 0xf34cf7b7, 0x706ed679, 0xdc609070,
-       0x1ffc2672, 0xf3be7f6d, 0x91febf9e, 0x457f7ff6, 0x8865038c, 0xdf847ae5,
-       0x7679de0c, 0xa7f511bc, 0x2a0335d9, 0xe4ce2e40, 0x6639b071, 0xc386126d,
-       0x3c3d56b4, 0x54d0b89d, 0x904296b8, 0xd6a84e2c, 0x4b4553c3, 0x85af9633,
-       0x0f41aef2, 0x9f09e1eb, 0x6b1dbcfa, 0xa06d8d41, 0xf904b847, 0x0b68ff9f,
-       0x95dcd75d, 0x73d99db2, 0xeb3aae5c, 0x871e51be, 0x3ce3dfa0, 0x010286af,
-       0xd367d5ed, 0xfb7f8525, 0x61af0e59, 0xcc7f5ce9, 0x1eecf927, 0x609c7f51,
-       0xeefb9c38, 0x448747d9, 0xdb282388, 0x2ef8feb9, 0xfd56e77f, 0xeef883ee,
-       0xc7ef1c73, 0x413294f5, 0xe4c19c9f, 0x17ed4140, 0xfee84bab, 0x1a2d3a0b,
-       0x6dcfd38c, 0xb8780dd8, 0xa8f1c1d0, 0x9e701d23, 0xbde678a6, 0xaa4d398f,
-       0x9357a17b, 0x4b2e8e97, 0x2cbcb065, 0x832abbf6, 0x5f5965e5, 0x45c8255b,
-       0x2d7d1f21, 0x6e3f394b, 0xb07a3e46, 0x0fd62565, 0x3cb078b7, 0xf38eb2d2,
-       0x7f6c36e3, 0xce51e5ab, 0x1f9cbd8f, 0x77bf833f, 0xf962d4b6, 0xcb1b8b6a,
-       0x33dce307, 0x3e226e00, 0xc6e8d539, 0x9b43d1bc, 0x5fe2040c, 0x980d3a17,
-       0xc44f4097, 0x40278f13, 0xef018dde, 0x6ff3a9f5, 0x9fbe7cd4, 0xb7df421e,
-       0x189e9c58, 0xfa033794, 0xf4c8c0e2, 0xcdd88c74, 0xedfe97c0, 0x0f9057f1,
-       0xcddbb31d, 0xa4b74fa0, 0x38bca277, 0x759bb4e6, 0xbc79eeb4, 0xedbbb593,
-       0xafad0366, 0xdac7df4a, 0x1473763d, 0x7c7eafad, 0x12f76b1f, 0xf83f220c,
-       0xc7c86bf8, 0x107489ca, 0x31a547ce, 0x17152c6b, 0x1f975e54, 0x3e317384,
-       0x3858de65, 0x3d725f17, 0xd57da27d, 0xca4fa841, 0xab85a2dd, 0xe1534edf,
-       0x9157181a, 0x7185ad50, 0xaf963363, 0x06e37181, 0x1e0dac3d, 0xc76f2137,
-       0xeadfa81a, 0xfd05a2d8, 0xc7ce4bf4, 0x2ea23cc4, 0x169f05da, 0x3ac360f9,
-       0x0a0f285d, 0x0f285c3a, 0xa62a5c04, 0x7e003f56, 0xc90ea6c7, 0xa63ac122,
-       0x71c1fd4a, 0x846ba5c8, 0xbf2922f7, 0x8efe98de, 0xd71d1579, 0xb11bf504,
-       0xa65593fe, 0x6f7f94ef, 0xdf230f4d, 0x0ef3f04e, 0xbbf21ef2, 0x3bd9e84f,
-       0x5c035f1d, 0x9b9ef04a, 0x24b5df19, 0xe3fa336e, 0x3d833641, 0xb69e7204,
-       0x1965e70f, 0x6453fb97, 0xcef876e7, 0xc3f9918b, 0xabfcfccb, 0x68444dee,
-       0x4f61fce7, 0x4bd985ba, 0x06875dfc, 0xd07e86d2, 0xa997e5ab, 0xf9d5a1f3,
-       0x59ff2216, 0x4f515f9d, 0xa1307bd8, 0xdeecce79, 0xb39e486e, 0x19a2abb0,
-       0x5e05ad3f, 0x78f8e943, 0x0957cf3a, 0xabc9c385, 0x3864e1c0, 0x87ec8438,
-       0x2eef3178, 0x74c6ff24, 0xdeacf11c, 0xb2277117, 0x3f8936f7, 0x5d04feec,
-       0x8dafee84, 0xe0cb5fc1, 0xb3bbf54f, 0xb9aae780, 0xab7e0266, 0xc7f3fe60,
-       0x351ff02b, 0xf8aefb5f, 0x0db9b4e5, 0x5080fdec, 0x1c39763e, 0xc2f7131f,
-       0x53d0a5d5, 0xe41a3ee1, 0x343bc201, 0x4befe760, 0x80674776, 0xf7d1567e,
-       0xd0ec0695, 0xf37ef604, 0x9cdb9b22, 0xe922e141, 0xc8817e59, 0xf1a33dc3,
-       0xb6f416fc, 0xc9e6cdb4, 0xb0832fa8, 0x4ac767a0, 0x7e3fe0eb, 0x878aead6,
-       0xafd72471, 0x3a077e0f, 0x7a699e52, 0xa17f9306, 0x5fe45125, 0xfaf96ef6,
-       0x8a2fde9a, 0x792a8f04, 0x41ee1fb4, 0x418b285c, 0x112dd9f9, 0xdb3fbc1f,
-       0x7a849e5d, 0xbd00f74b, 0xdaefca16, 0x301eee2e, 0xdb57e704, 0x65a9ddc7,
-       0x71ddf646, 0xd0eca013, 0x079d1fbb, 0x0691e0fe, 0xcdbc938c, 0xc7270ff3,
-       0xb7c3fcb0, 0xc980fdf9, 0x004a5e1f, 0xf65938f9, 0xa1481525, 0x1bf77676,
-       0x05ec2ab3, 0xdd36f6a1, 0xefd858ef, 0x976eecd5, 0x6006cbb1, 0xf5dfdb55,
-       0x9022bf2b, 0xe56a3de7, 0xe3f90225, 0xbc7b73ff, 0xa4f5132b, 0x9533e4ab,
-       0x415b79f5, 0x897318ff, 0x228e39e5, 0x9525ce2c, 0x9bf2c9bd, 0xdbb6a978,
-       0xbda868e7, 0xa76a1d9e, 0xa5fd92cf, 0xd421ef50, 0xd809cf5e, 0x374ec2eb,
-       0x45bf9610, 0x3806f7ed, 0xddb9e717, 0x8f13314e, 0x7c3f2179, 0xc87dce6f,
-       0x9f30a217, 0x8f8ef9e3, 0x7fad6112, 0xc5fc4ae9, 0xbd00f62b, 0x22be5937,
-       0xf5fa79c1, 0xc120bf2b, 0x7375bcef, 0x8e9b773f, 0xffaa43dd, 0x8a728ca7,
-       0x8075b5ca, 0x9af27aa7, 0x7920eefe, 0xabffda4b, 0x28c3de1f, 0x3586abff,
-       0xb4f5bc81, 0x7ed2764c, 0x223edcd5, 0xac76f91e, 0x32927b73, 0x289ed646,
-       0xeacbbffa, 0x13ff4403, 0xbbf49d93, 0x9da2a9d5, 0xd78ebf8f, 0x6c76ee89,
-       0x0df312cf, 0x6b337565, 0x72f8cb6f, 0x8231e832, 0xe0cc6fbf, 0x47bf91f2,
-       0x63fdf944, 0xcc578919, 0x73b651bf, 0x1fde2079, 0xc4e1faaa, 0x6e70a398,
-       0xb5cc25db, 0x875fbfab, 0xb673fbfe, 0xf7e082f6, 0x8e9e454a, 0x798cd2ab,
-       0x0d2f0d53, 0x22740add, 0x81278f9b, 0xe3c5d2de, 0x09b255f1, 0x36172ee3,
-       0x491ebe30, 0xf2bc5bef, 0x42be0515, 0xc0fbf9da, 0xdfa49818, 0x6493ff3b,
-       0xa0f33ef6, 0xe80bcc2e, 0xde0c7ce0, 0xc37b847b, 0x212bff22, 0x5ec13887,
-       0x8a39784e, 0x71f953bd, 0xc5dbf217, 0x767f332f, 0x2803a6c3, 0x76cbe6df,
-       0xc89d27f4, 0xf00abf76, 0x0d7731e9, 0xcaf838c1, 0x3f5d7157, 0xdc785bb2,
-       0x182f2fab, 0xe143879e, 0xc0abfbff, 0x4afff7ff, 0xfc82eff8, 0xbb73e032,
-       0x4dbed0a3, 0x0ef5fad6, 0x649e6b88, 0xe79e5cef, 0xfaed2b70, 0xf815df10,
-       0xd3b30667, 0xdc583ae2, 0x8965e446, 0xc333feef, 0x1e74eccc, 0x79a8691f,
-       0x47c4346b, 0xc4c6fe04, 0x77f07690, 0x38383c53, 0x07801c1e, 0x9c40ef01,
-       0x0acb8e84, 0xb0aed79e, 0x23dc050f, 0x7d35639d, 0xe3ab7588, 0x0e997706,
-       0xef7e0096, 0x847986fa, 0xb0b4cfdf, 0xcc7eb4f9, 0xf011fc13, 0x1e00c4ca,
-       0xef940375, 0x46bc5180, 0x22b9280d, 0xffed95de, 0xc35778cb, 0xf3d65d4d,
-       0xf7fa9838, 0xff3403a1, 0xbffc70ab, 0xdd9d5fe6, 0x3ed15fbc, 0xd71be577,
-       0x7e157fe4, 0x1f957fd1, 0xf5ff9236, 0x16ee992f, 0x2fc9bba0, 0xfc40d12e,
-       0xffbdf6e6, 0x8b013bc8, 0x5e303bf7, 0xcbdf0f74, 0xf6ffa317, 0x9e947dfe,
-       0x7e6668be, 0x3ffb53a9, 0x43f3d9d7, 0x45f663e9, 0xe8833899, 0x77caf66a,
-       0x669f2074, 0x5c22cd53, 0xa70d6a7c, 0xa127cc27, 0x48d6a07c, 0xfcf40974,
-       0xf7b2d6d7, 0x10216ba5, 0xe7d2c363, 0xb593eda6, 0xc7ef07c4, 0x3eb49b56,
-       0x9487c603, 0xfc0d61f7, 0x686a597d, 0xcac5ee2a, 0x9ef3194e, 0x716328ee,
-       0x76a619a5, 0xfd38dfbc, 0xf7f3eac8, 0xe35dd9c1, 0xba796129, 0x9fd27ee2,
-       0x5e24df34, 0x37e406b4, 0x1e259ff8, 0xc3ae5c87, 0x5c7aa438, 0xfe7600ed,
-       0xcb12cb26, 0xf2c3d837, 0xa479c4d7, 0x28623bfb, 0xf0f37962, 0xb3756ace,
-       0x00b437ce, 0xa8fd8ff4, 0xad95347f, 0x353c002a, 0x303e958d, 0xc0f40414,
-       0xa25f95a6, 0xc7e6a37e, 0xfd5af2ea, 0x1cb7ef50, 0xfa117a41, 0x1f16a9e2,
-       0xa97ed5d6, 0x8c7e6359, 0x5f919c71, 0xd470bd32, 0x1189e725, 0x6f6f6ff6,
-       0xd84b3b09, 0x4e3b6a5d, 0x5ef10bf0, 0x0b00fb5c, 0x77c6bb93, 0x5a8ffbd8,
-       0x4034be56, 0x5f057729, 0xef767ca5, 0x4a5fe400, 0x87c41bfe, 0xc55ffdb1,
-       0xdf740387, 0x4dff00ec, 0x6f7b066d, 0xf5f74d5d, 0xaa7e4c29, 0x94ae5de9,
-       0xd3519f51, 0x3bf3a0bb, 0x7fd05b9d, 0xd2c60b37, 0x926acc75, 0xc9d59ef0,
-       0xd7bc1e97, 0xddd09748, 0xe29d33fe, 0x486fbc3d, 0xe072a1f7, 0xbe23b463,
-       0x5d201cb5, 0x33feecd1, 0xa84f47c3, 0xc0a0bd1c, 0xbd1ca84f, 0x5fc4aff0,
-       0xf9cffd98, 0xf0907276, 0xc8bb7f3c, 0x6b239ff3, 0x26dcf7d8, 0x790a0796,
-       0x765ebd68, 0x56696c2f, 0x4d7fbe1b, 0xe058b20d, 0xc9f6cb23, 0x778b3d64,
-       0xde835368, 0xbe26ea2b, 0xe0494777, 0x9bf9624f, 0xf7b3464b, 0x9a79d43e,
-       0x91b3ff22, 0xb4cbbb8f, 0x54788f4b, 0xe62443bd, 0xd443bf51, 0x67fc7a38,
-       0xf7e7ff18, 0x0fefd58b, 0xf9e4ca0d, 0x88a4459f, 0xccafc7c5, 0x5e407aa7,
-       0x7b8df906, 0xbda0b52e, 0xf4399793, 0x01193c3f, 0x8665177c, 0x99a5d7e8,
-       0x94b3d657, 0xfa62ffed, 0xf0dbcd90, 0x4a6f913d, 0xe72c861f, 0x38b75824,
-       0xf9e7fd27, 0x679e0315, 0xef713ef1, 0xbdf1e7f2, 0x09afde8f, 0xe6ae87c6,
-       0xcdd3199f, 0xf4dd03ae, 0x4cd5b7b1, 0x94ea3ef1, 0x2304fd07, 0xdef1bb8f,
-       0x9cb788dc, 0x0a4c8190, 0x5864ba0f, 0x841bd0b7, 0x0be0111e, 0xcf0b7efc,
-       0xfe56b8f7, 0xdc4bfff1, 0xe9b3dc43, 0x4e4af9d1, 0x13defc80, 0xef1df615,
-       0x2b9a99d5, 0x60f9ffbe, 0xe0357b9c, 0xbfe70a69, 0x2ad01de2, 0x7bdbbd99,
-       0x3f464ba1, 0xfd1f8ac5, 0xdb8fb7e1, 0xeb57e743, 0x2f964d67, 0xd247ae50,
-       0x2c349bd7, 0xd2a8beaf, 0x605af98e, 0x42df80ff, 0xfdd431f8, 0x7e2bd90f,
-       0xf776899e, 0xac272ee8, 0x9eb651e7, 0x5a6af848, 0xbf0a5ff9, 0x37efa449,
-       0xccb12bed, 0x7f1f3a0f, 0xfd0494cc, 0x06353e5b, 0x74ad7df0, 0x0ecd7ff1,
-       0x8f132c98, 0xbe70e544, 0x257a65e4, 0x2ce5fa61, 0x1ce585d2, 0x9ba587d2,
-       0xf9eabcb0, 0x42e581c4, 0x65d3cf7e, 0x0991bf77, 0x1f5d55fe, 0xfe7b53be,
-       0xe1e7bfa5, 0x8f37503b, 0xa95c836a, 0xad9fcaef, 0x0b7aafd6, 0x0d38fefb,
-       0xbfeec7f8, 0x0f51da67, 0xb377b6b8, 0xd3ce71bd, 0xddfc6199, 0xb32e59ff,
-       0xee97157b, 0x5a4def65, 0x363218d8, 0x2574fb11, 0x09f9e167, 0x2de4cdf0,
-       0x5c426f82, 0x0d03ff2b, 0x932fcb8b, 0x7505eff0, 0xc47835f8, 0x796517f2,
-       0x62efa865, 0x560df9ed, 0x717904af, 0xfb58a323, 0x5dfe2b72, 0x8fc4d9cf,
-       0x3c2e72e7, 0x3dc32b65, 0x0b963b09, 0x54d4fbf8, 0xe896cee3, 0x469d45f8,
-       0xfc4dcf96, 0x05bf6083, 0xb1849f60, 0xf206cb77, 0xe3367438, 0x542ac3f7,
-       0x0fce05fe, 0x3315ec1a, 0xe172d206, 0x48192740, 0xad987ee9, 0x20cffd6b,
-       0x86b7606f, 0xcfafbdc0, 0xe300fe46, 0x2fdc622b, 0xe83a15ec, 0xf2c482f7,
-       0x0cfb3d8e, 0xa4d4bde2, 0xcbbd3f60, 0xfd03195e, 0xa8b6146c, 0x2b80451f,
-       0x572abdfc, 0xe44c7b18, 0x1d030db1, 0x0485fd11, 0x417a25df, 0x819cf562,
-       0x4d7dbe3f, 0x3d30fa1e, 0xc2fe87a0, 0x7d80ceee, 0x6213d30c, 0x92fff582,
-       0xcd21afdf, 0x5f0f1099, 0x034184f2, 0x547bc67a, 0x833dc31c, 0x167b533f,
-       0x2ed4d3ca, 0xd42ff285, 0x03f2852e, 0xf942976a, 0xa14bb511, 0x10b1745c,
-       0xbe2224de, 0xd862ce81, 0xa83b888f, 0x903f9bd7, 0xbb06cdc9, 0x1d62867b,
-       0x8eb8f4fb, 0x3f5dac17, 0xc75d19fd, 0x6907bb0b, 0x244bbee0, 0xfbeef478,
-       0xfe95e65b, 0x7f888d3e, 0xf107dba8, 0xd2ec17ef, 0xe82fdca2, 0x0e2ec7f0,
-       0x503157ea, 0x77f3e38f, 0xf30b1c7f, 0xe1fa58f7, 0x56e894ea, 0xbd586b27,
-       0x845e57e2, 0x39dd836b, 0xcf4bf603, 0x4fd838f7, 0x7e1fc741, 0xe83af70a,
-       0xeda718fc, 0x8236fa95, 0x87dea67e, 0x5f62df7a, 0x61ebff74, 0xb3bb0bfc,
-       0xdf942761, 0xf65e7610, 0x437977b1, 0xf70abbf7, 0xafa1bb73, 0xdc2bee18,
-       0x9b0e597e, 0x2f60da27, 0xc57f7847, 0x38fed0f5, 0x812ba71c, 0xae7b6faf,
-       0xf111f3d5, 0x50f001ee, 0x4ba3c83b, 0x560fa0b1, 0xc76678f3, 0xe36f41ae,
-       0x322397fd, 0x385fbf81, 0x773ca6cc, 0x1278e13f, 0xbd3efe65, 0xc2f5f00b,
-       0xc1074fbe, 0x3f14a07b, 0xc9efe083, 0x60e068fe, 0xfe7dfe45, 0x031fafc8,
-       0xf1fda1fa, 0x274e15ef, 0x6e20aa5b, 0xffb8d33f, 0xb6696c10, 0x882a83e5,
-       0x914dcfdb, 0xcf39430e, 0xe20e359e, 0x79df22f5, 0x61f96e41, 0x3ab74a38,
-       0x2b8f51aa, 0x2412e607, 0x318d2a17, 0x216051fc, 0xf515e287, 0x8ae929f1,
-       0x39ed13fe, 0xb949f68a, 0xfbda2837, 0x8638a1ef, 0x06cf7e07, 0x4365f478,
-       0x83ee8d1c, 0xa7b57dfd, 0xca77cc64, 0x96fc7ddf, 0xf27d681b, 0x7be077d3,
-       0xf6f02f6f, 0xf12b3bc9, 0x52f59bef, 0x22a9ea78, 0xa1eca675, 0xc9833f8d,
-       0xfd42f654, 0xc30f27be, 0xd8dfd0bb, 0x2760885e, 0x97a611d4, 0xd417b246,
-       0x9be50276, 0x39be053f, 0x16a9a5ec, 0x617f0fc8, 0x2069d7e4, 0xe40fb697,
-       0xfb7066ef, 0xf4fd1221, 0xfec9139f, 0x29fdf076, 0xbf88fd35, 0xc9ca2d6f,
-       0xa13dd8c7, 0x3ed7ca6f, 0x7686be01, 0xafdb87b9, 0xcff954bc, 0x6f1de986,
-       0x9efe03df, 0x94dc32a3, 0xb5bfbfe8, 0x0e5ffe18, 0xb8593dd0, 0x04d481e5,
-       0xfa03ddfc, 0xa7f72370, 0xeb90367d, 0x1ffbf553, 0xb40e2d48, 0x281f1593,
-       0xa5fb93fa, 0x9afa8ab5, 0x437d652c, 0xf1e0daf9, 0xc5b1f491, 0xbbd3ce8f,
-       0x9f9ee1f3, 0x3aeff614, 0x8127aff6, 0x4b7d87f3, 0xba7edf90, 0xbdfe197f,
-       0x46ff7559, 0x01f81f3a, 0xb3904717, 0x974d4f82, 0xeac23bd9, 0xef8abff6,
-       0xefdbbe39, 0x8f6147bd, 0x332f5e79, 0x9c5efbf9, 0x13a0af5b, 0xf9eefb3b,
-       0xe8ff0f4d, 0xed2b882b, 0x79d57661, 0x051f932b, 0xc0d33ebb, 0x161e8bdf,
-       0xc0abe8cd, 0x3dc0d7e2, 0x7e06ff9a, 0x00334c2b, 0x0000334c, 0x00088b1f,
-       0x00000000, 0x18adff00, 0xf514707b, 0x7bdbdbf9, 0x79724b92, 0x71211240,
-       0xc220572f, 0x4849ac91, 0x92ea4903, 0xf03ea410, 0xa2a21900, 0x799e0fae,
-       0x2a93a84a, 0x028d361d, 0xd6d36d52, 0x4f4e2a2a, 0xd1954a2c, 0x2562bc34,
-       0x40569478, 0x2f2a7b1d, 0x419cca69, 0xee421923, 0x8cc38a8c, 0xbf7dfa1d,
-       0x5eddcddd, 0xc9a75502, 0xf6fbbf1f, 0xcfdef8f7, 0x05048af0, 0x571a0192,
-       0x02a62a26, 0xc8dc8280, 0x00b5fb71, 0xbb4c6176, 0x94e00b3d, 0x157004c9,
-       0xa5029fd0, 0x30276100, 0xf0efdd38, 0xbdbf423d, 0x225f1c91, 0x9e5eef7e,
-       0x77dc2323, 0x4055a560, 0x5dfd12f8, 0x361b5d17, 0x709563df, 0xd480197f,
-       0x0fb91ce1, 0x1d300ad0, 0xe7f015df, 0x32a3a458, 0xe784db92, 0xf716faee,
-       0x2412fc55, 0x828f9d20, 0x76048f4e, 0x15798f80, 0x0624279e, 0x8df3c49f,
-       0x22b07847, 0x3810033f, 0x8ec7077e, 0x004ab339, 0x814fd396, 0x815877be,
-       0xc005bf67, 0xefb42bef, 0xdf97cbcb, 0x6f084904, 0xf286f4b1, 0x4970fbd8,
-       0x90e30343, 0xaadced7e, 0x9d5bb7bf, 0x78c9feb4, 0xff1e01ae, 0xb5fbc782,
-       0xd7ef6410, 0x7b7dc0ed, 0xf5f97ecc, 0x0dfbd39f, 0x0af78cbb, 0xbef4c485,
-       0x0a03f4a9, 0xb3ecf12f, 0xb6adf089, 0xf9aaf8ab, 0xb1bc3f6f, 0x837af918,
-       0x69f86d17, 0x64c4df68, 0xd98fe2f0, 0x91aca428, 0x8cdc6c72, 0xe145a48f,
-       0x5cfc7dc1, 0x47379d3f, 0x1b4fe672, 0x44906f29, 0xb561c913, 0xbab7c54b,
-       0x80059be2, 0x9b7756f8, 0xe02bb801, 0x1083c8d9, 0xdba0a783, 0xa33bf3e6,
-       0x2a5d87f4, 0x5fdd058f, 0xaaf2cea7, 0x01d12b6b, 0x405e2aed, 0xa67a41bb,
-       0x47496071, 0x139f307c, 0xac72e1b7, 0xe492a33b, 0x80838c74, 0xb89ec850,
-       0x2df48ed5, 0xefa39f54, 0x1fc5484e, 0xc2667999, 0xcbd340b3, 0x2f77d2c2,
-       0x516f7872, 0x4889a2f7, 0x75df1c01, 0x1cd431ef, 0x0c3c152c, 0x2c5062df,
-       0x296397a4, 0xa466ecbe, 0xddcf1e73, 0x1c12f3ed, 0xff10e019, 0xae048ab1,
-       0x3fef638d, 0x7cebef42, 0xb2f8b31d, 0xb35f189b, 0x37a87d5d, 0x5fc29a4e,
-       0x8f29184a, 0xd0cd5ca8, 0x5797eba7, 0x59ec86dd, 0xd7e6afdf, 0x1d31bace,
-       0x5c04b8f5, 0x16fba436, 0x610c0d1e, 0xdfe6cb78, 0xe03126e6, 0x5f2819ef,
-       0xf44a982e, 0x2d0584fa, 0x68cfde02, 0xd39835f9, 0x5667e462, 0x8fd74efd,
-       0xf491cf2e, 0xf9abf8a8, 0x7c84a0f2, 0x98e76d0e, 0xaa88351d, 0x9f94369d,
-       0xc462c3fb, 0x45e410df, 0xefa9e90e, 0xe492703a, 0x03aeb1d8, 0xce8016cc,
-       0xad6c5d75, 0x7c033bb7, 0xd98fe33e, 0x838d09af, 0xc1a55bf8, 0x74775f8c,
-       0x1c7fca3f, 0x3032cbbc, 0xf802e70c, 0x13bf7d93, 0xbf359f90, 0x62d8f2f8,
-       0x794376a2, 0xb207f30a, 0xf4a3abb9, 0x9c015817, 0x5b647f48, 0xc32b7f82,
-       0xa27eaa23, 0xfeff6dd9, 0x719a2749, 0x0b1dffbf, 0x1583db33, 0x1cfe0f4f,
-       0x12db35e1, 0x53fb9c98, 0xfda2c941, 0x0afd93ad, 0x8a6e581e, 0xdc9334f4,
-       0x6dc5133b, 0xf3f9ffb8, 0x81dd5f93, 0x2757caf0, 0xf926448a, 0xdf845091,
-       0xefa011b3, 0x3dd8b33b, 0xcbbc5590, 0x5fe4ff34, 0x729bf69e, 0x4d397fda,
-       0xfeba3c24, 0x90ef3ece, 0x35f5e500, 0x685df204, 0xa538e782, 0xd70f84cf,
-       0xe69c769a, 0x36ad3ed0, 0x75e92779, 0x397fb3d5, 0x54fc865e, 0xd3f37cbd,
-       0x95be9033, 0x7a058d1f, 0x11d7aa27, 0xe42920f1, 0x51e038a5, 0x9f2680e3,
-       0xff0eedda, 0xa57131a7, 0x00c523be, 0xf9657637, 0x47898d3f, 0x18caa0b5,
-       0x1f98e7ee, 0x35fe69d5, 0x20df978d, 0x4843d47d, 0xb110938d, 0xf2155d92,
-       0x2171449c, 0xc98d84f2, 0x3ecede3f, 0x2ecc4c10, 0x53204ceb, 0x034c2f7c,
-       0xaff9267b, 0xfc2fcaac, 0x9bade4c4, 0x42fd3650, 0x93ffeeaa, 0xb58b4c16,
-       0x37869ecf, 0xdb373ec9, 0x380e7d98, 0x3c67f980, 0x290b7f9e, 0xfb32fcec,
-       0x861fcc57, 0x45cb4bf3, 0xc0c51730, 0xee28905e, 0x4509b615, 0xacdae00f,
-       0x964a65e9, 0xadfc442f, 0x9eedf8ea, 0xb73c98f7, 0xf08a783c, 0xfd32761e,
-       0xdcaa7bc1, 0xc4d41cc3, 0xf665a9e6, 0x7bff342f, 0x7dcfe0c1, 0x97c89ccf,
-       0xddbefdf1, 0xed01f353, 0xd83e5ef9, 0x67ca1cf7, 0xfa783130, 0x0f3b5c61,
-       0xf28e387f, 0x75bd3c62, 0xe01a5f2d, 0x478d4e01, 0x7e07c475, 0xbbeb913f,
-       0xe181f640, 0xde87c584, 0xfc98d34d, 0x326f79aa, 0x6fdc3fe9, 0x4e9e2fa4,
-       0x3e9d7dfd, 0x9cfd7dfd, 0xebeaadd9, 0x9f9835bc, 0xcc9fdf8a, 0xefac1811,
-       0xe60a4f9f, 0xbbe938a7, 0x8a973d4b, 0xd5bd8c70, 0x6fd44fd0, 0x37e31d8d,
-       0xc35357d2, 0xbec06d89, 0x713f142b, 0x5fb8c80d, 0x26a6f997, 0xd1d9f037,
-       0x766916ce, 0x6669e906, 0x82b73bca, 0xb48bd76a, 0x743b7df8, 0xe5fd0058,
-       0x67f5a9a4, 0x3a075c76, 0x63916f7e, 0xca72afe3, 0xf7ea6974, 0x254abf8f,
-       0x3f1c51e4, 0x3ab272ef, 0x339ba267, 0x90d973b3, 0x5f70e74d, 0x281da00c,
-       0x0db1369d, 0xdf7991e9, 0x57bc6e35, 0x93e40d67, 0x64f7e81f, 0x07df665e,
-       0x9196f7b8, 0xc81cc1be, 0x8a4ff567, 0x3bac3815, 0xa0c563c2, 0xbe50f284,
-       0xe2571606, 0x02d865e3, 0x47489d35, 0xfdd77d05, 0xb8a4ed11, 0xe9d4d4ca,
-       0xc65e251c, 0xbd3407c1, 0x9a99a715, 0x8ff1463a, 0xe91f68db, 0x5e0e836b,
-       0x7f355ff5, 0xc6726996, 0xd6c7cf84, 0x5c5a0d33, 0x15d9270f, 0xdb2fe91e,
-       0xb8407a87, 0x40381ccc, 0xb43d7a2b, 0x42673ea0, 0xcbaf7d40, 0x6729bf18,
-       0x78f9612c, 0x33238b2a, 0xe7aef535, 0x68f4809a, 0xeb857ca7, 0xd3c82e26,
-       0xb08813fa, 0x99970255, 0x5b3b1456, 0xad8f8367, 0xad89a073, 0xad9da173,
-       0x5b074037, 0x5b20826f, 0x0da04a61, 0xeb5ffc58, 0x0c3cc3ea, 0xa26e5d3f,
-       0x18bc5c7c, 0x87f3469a, 0x2ebc9ab5, 0xea8c0f2f, 0x1e5c3f25, 0x64ce4073,
-       0x2e4e5d74, 0x9d98f213, 0x91b172eb, 0x073de23d, 0xad6933f8, 0x877b1080,
-       0x99de925c, 0xe0998205, 0x5c18902a, 0x51e51dfd, 0xb2cd921a, 0x54b91477,
-       0x8f276e8d, 0x9171726a, 0xea8d8f0d, 0x605baf6b, 0xcc37aeb0, 0xff1499d0,
-       0x7213ea47, 0x84e2ce88, 0x0c052fca, 0x21f77e11, 0x6be3199f, 0xb3655171,
-       0xf74ee107, 0xe3199f49, 0x65597168, 0x6ac44591, 0xdf63f5b3, 0x4765846c,
-       0x1fa03e52, 0x3bc831d9, 0x87bc3e50, 0xfa54d287, 0x7ca7e39e, 0x101fe369,
-       0x07654fc9, 0xadd59040, 0x17e45568, 0xaeef357e, 0xba7aa971, 0x4b3f26d9,
-       0x0f6f587e, 0xc3c80924, 0x0cead69a, 0xac1b87ca, 0x8c9fbbea, 0x89bea615,
-       0x1e21b172, 0x2f94617b, 0x081c57dc, 0xb9a13887, 0x47a51dc5, 0xf01dffc7,
-       0x784af9fe, 0xafca650f, 0x09bf29b9, 0xc61beb22, 0xb3bb796b, 0x97c44cb3,
-       0xa3170e90, 0xa9389423, 0x26dc85b9, 0xde97b7cb, 0xf6aa270b, 0x7b6c97b6,
-       0x75ed747a, 0xd3ddbb4b, 0xb70f7e47, 0x8027b37e, 0x433f86ef, 0x5def78c4,
-       0xce8fbcb7, 0x39429a35, 0x5f97a845, 0x92b69c26, 0xcaf6e83d, 0x209692a1,
-       0xf8126ddf, 0xca0fccad, 0x9675c35d, 0xe1ef6a27, 0xca1ef8a5, 0xabe7d8a3,
-       0x4a0fb2c2, 0xd20e9a6a, 0x57b72a5a, 0x39e10ee1, 0xf236f442, 0xffa46591,
-       0xac8f94c1, 0x9c7f319f, 0x169ddaa0, 0x1ff7baa7, 0x0abc7879, 0xdfc620fa,
-       0xbc5ff71a, 0x8f8c2ff0, 0x914e438d, 0x7bed978e, 0x7dea99a6, 0xcab0cfdd,
-       0xdd11c433, 0xd97666ef, 0x773b3c02, 0x5f3a52cd, 0x878f51f1, 0x3d75efe2,
-       0x832a36a1, 0xc627ddc3, 0xd7aff6ab, 0x3f70dfe9, 0x6e7c4f24, 0xa6487b47,
-       0xa7ca8b3c, 0xef37683e, 0xab7f21b7, 0x60d07ea9, 0xf6abf185, 0x58ff7a95,
-       0x561fe47f, 0x19f03bea, 0xa95df885, 0xcb62bfd1, 0x5d91377d, 0xfb1bf4ad,
-       0x6cafbd41, 0xf6d5ced4, 0x1f13d7f8, 0xe78ddbb5, 0xccafa91a, 0xeb0cfaa7,
-       0x75d50f31, 0xaa5bfb71, 0xd8d95f58, 0x1ffefc65, 0x2495f637, 0x81bf2d60,
-       0xd72e4756, 0x4e7f10ce, 0xfd59e7d6, 0xf56de436, 0x8ba2cdf3, 0xc8a76ce0,
-       0xf5d1ebe2, 0xb61e7b10, 0xd15b31a4, 0x46e575fd, 0xc3c7d58e, 0x364bdffd,
-       0x7828e889, 0xbdd58329, 0x7ab3af58, 0xd9881d03, 0x86ca016b, 0x3d7bfb43,
-       0x426b9225, 0xe777af3c, 0xff4f5489, 0x67049d75, 0xf4fa512c, 0xdf9abe7a,
-       0x3ea56551, 0x93ec7ee9, 0xef210ec8, 0x37bc72e9, 0xfc05b0fd, 0xaa043fb8,
-       0x9ace863e, 0xf33e5d58, 0xe49e4ec8, 0xfd518fcf, 0x026996d9, 0x0e1e4621,
-       0xa3080c61, 0x4d36f5f4, 0xa979097f, 0xf144fd86, 0xe4fdc32a, 0x7ec35cd2,
-       0x2b69239b, 0x0a4501e1, 0x8e284b7a, 0x48a4efab, 0x20f70c53, 0x5fb8ff84,
-       0x437189ae, 0x64c39cd2, 0x15ce15cf, 0x3690de6c, 0x9e78d0b7, 0x5f13cb5f,
-       0x87b833b6, 0x657f957c, 0xe675e836, 0x7e9e1180, 0x10921db4, 0x39a8e3af,
-       0x00a16e6e, 0xc13625d5, 0xd5ca5df8, 0x4c0262ec, 0x861bcc30, 0x961ceee5,
-       0x0945d92b, 0xf720c8fc, 0x1ea1b978, 0x3434dd58, 0x422a29c1, 0x7d630f54,
-       0xd467f946, 0x259fe518, 0x7e3de51b, 0xd9de5185, 0x5f79464d, 0xab9462dd,
-       0xcdca315b, 0xe1a671b3, 0x4af6c4fc, 0xf3793c03, 0xd7f3860d, 0xe01817f8,
-       0x376fdba9, 0x71d69f9c, 0xa0bf61af, 0x5f61956b, 0xd9cbb3b7, 0xd581b5c1,
-       0x0266f671, 0xa0ec15d3, 0x0643f0e8, 0xff7af17c, 0x12aaf831, 0x47a5ce51,
-       0x48c2de51, 0x1484703b, 0x6f1878a0, 0x57faf107, 0xaadff4e2, 0x93f793e5,
-       0xee4e3ece, 0x8f412f3a, 0xa0bcda7f, 0xb1fac2dc, 0x55690a7f, 0xcb567489,
-       0xaf2d3e6b, 0x644df6c1, 0xa973e024, 0x0f1418b0, 0x3c2b1c52, 0xbb22abe9,
-       0x1d350e2c, 0xe4a0f644, 0x32557b6c, 0x7040979d, 0x4b47538d, 0x5296fe74,
-       0x72b1cc0e, 0x8f366742, 0xa171ca8b, 0xe327cad2, 0xfd6fb2e1, 0x54ecc96d,
-       0xcfa7c33a, 0x3552b87d, 0x1c97cc6f, 0x47918e60, 0x4f9ea945, 0x5d5e8cbc,
-       0x089cfaee, 0x52b07deb, 0xfbb26fbd, 0xd5a3dcdb, 0x9e66e237, 0xab325fd5,
-       0x32710ec7, 0x6add1f9b, 0x7d90e60f, 0x5f90c99f, 0x317cc5c9, 0x56051268,
-       0x36a171bf, 0x8c4c2a62, 0x6e52f251, 0x9f512f9b, 0xcd2aed86, 0x8bf21727,
-       0x465e2be7, 0xa2542bbe, 0xb7f4c5b6, 0x99de5727, 0x739e794b, 0xbbc22fad,
-       0x973ccfef, 0x9fcc7943, 0xf7a2ed2c, 0x1921e787, 0xd9c617c8, 0x48504990,
-       0x1c43ca04, 0xd1ce2feb, 0xfc623323, 0xe585a376, 0xadfad02b, 0xe939353b,
-       0x0d12d6fd, 0xb13e2f6f, 0x9df8e302, 0x3c98875d, 0xb407336a, 0x7449ad3e,
-       0x4df7fbe1, 0xbf521670, 0xa8915209, 0xff7ae9f6, 0x3eff9e35, 0x57ef5579,
-       0x36be772f, 0x07d0dfb3, 0x51b48ec3, 0xf3f18de7, 0xeadf28ac, 0x258fbdfb,
-       0xfbd3fcb0, 0x1f9b3658, 0x641fdf46, 0x9b3b8173, 0xc7d8303e, 0x1b1f2ddd,
-       0xe51eeeec, 0x287ec313, 0x8f19623d, 0x64f687fc, 0xe503b9cd, 0xadb77e77,
-       0xd450fa84, 0x4c6e7f57, 0x627a1c9f, 0xf7c26cf2, 0xc73cf9bf, 0x1759e8e8,
-       0x9d34f364, 0x4eebd3cf, 0x2eb43832, 0x3e78d6c4, 0x5f55bef5, 0x3c837fad,
-       0xc227ea33, 0x9b47118d, 0xd479d4c3, 0xd667beba, 0xc3ca4ab8, 0xb356d93d,
-       0xe1524eba, 0x0abb52ac, 0x6b4b99cf, 0x48dce2d8, 0x070f6b7d, 0xd0f68712,
-       0x9785d57b, 0x7744f8ac, 0x50f56c86, 0xb9195a5d, 0x482b7340, 0xe379b10f,
-       0x41d954d2, 0x062c39df, 0x9d1952b3, 0x383fa893, 0x035e526b, 0x2f25018c,
-       0xf53e71fe, 0xaa498301, 0xf8be27dd, 0xe9057cdc, 0x97c5257e, 0x0a40f74c,
-       0x94e76359, 0xfa859cfa, 0xc253ea62, 0xf0cd750e, 0xcc8f8c70, 0x478a75b8,
-       0xd3d7578d, 0x9af5ef8a, 0xe47126da, 0x80dacf0f, 0x07e8a7e6, 0x4317d512,
-       0x1faa6cfb, 0x70920198, 0xdb6eccff, 0xe3cf640b, 0x5faa6690, 0x7d635ab0,
-       0xb65be141, 0x7d09c500, 0x11ee933e, 0xfbc5e57e, 0x6c2d7be9, 0x2898300e,
-       0xd77f9094, 0xf5601d27, 0x595c89d7, 0x15f9b0f2, 0x7a3f1448, 0x6eb6d8f7,
-       0x3991e752, 0xafff120b, 0x0f12b873, 0x6a4233eb, 0xe1cda95d, 0xf9abbe74,
-       0x43df19c7, 0x7c406d9b, 0x7c1a5f9e, 0x4ee6cbca, 0xd9d10e62, 0xd6e9526b,
-       0xd3f9d5e9, 0x73be88f9, 0xe7d5bb65, 0xd779d149, 0x07e44986, 0xce754728,
-       0x2f7773c7, 0x7dfee518, 0x7cb2beba, 0x558f88f3, 0x2dbcea4d, 0x07f6f7aa,
-       0x8ede914f, 0xbb1c5938, 0x3e78fddc, 0x611ff7eb, 0xef3e40f2, 0xf862fe22,
-       0x9989e25c, 0x3eef9e0b, 0xf85794f1, 0xb385fce1, 0xf878f9d5, 0x02398b85,
-       0x77dfafde, 0xc9d924e8, 0x6e3c1cf0, 0x831b6d8e, 0x68ea657d, 0x0acc6bf3,
-       0x4d92f531, 0x6cc13fbf, 0x9f218fbc, 0xfc8bacfc, 0x5d89eb11, 0xf9421f5a,
-       0x9eb6e292, 0xb1d9772f, 0xe2df454f, 0xb8b36f42, 0x8ec9784d, 0xcb0a73d7,
-       0xa15cfa5b, 0x44bcc38d, 0x599b963a, 0x76afe73c, 0xbba7648a, 0xd482f6d0,
-       0x04a59ad7, 0xeb8e3f36, 0xe4dbd76f, 0xd65ec947, 0x4199507c, 0x3be76ffd,
-       0x957d6837, 0x6ba64f9a, 0xf09d39f6, 0x64de1f13, 0x358a5796, 0x4dec4afa,
-       0x3321d53c, 0xf9d5e140, 0x788f3681, 0x8fd66dec, 0x775717fd, 0x1c70ea99,
-       0x00001c70
+       0x00088b1f, 0x00000000, 0x7dedff00, 0xd554780b, 0x733ef0b5, 0x7993331e,
+       0x31e424e4, 0x1e4e1081, 0x03086820, 0xb78a8884, 0xf6301027, 0xd57876d2,
+       0xaf0e2d58, 0x6b86f210, 0x7fb6bd2d, 0x78490806, 0x111fc1a8, 0x29e1d5ad,
+       0x311d82f6, 0x0388b622, 0xbdabd228, 0x557c5837, 0x0bd11feb, 0x2a44908a,
+       0xe5b5ef6a, 0x3ef6b5ee, 0x09939cc9, 0xafdb7b04, 0x7cfdffff, 0xc7ecee9f,
+       0xf5ed7bd9, 0xfdad6bda, 0x8131c918, 0xe4230da4, 0x06fbfc22, 0x109d9221,
+       0x9d37a132, 0xd72120e3, 0x66924218, 0x92ddfd2f, 0xbadc4214, 0xa349bfe2,
+       0xe4febba9, 0x5f5f9a1a, 0xa4aff0ec, 0x4d1f5b4d, 0x2d096a78, 0x2fa1efbf,
+       0x7cd04fc3, 0xad79ecfa, 0xce7eb4c5, 0x5d0fc924, 0x10ab1a1d, 0xd8e7ed02,
+       0x520176c2, 0x9097e581, 0x927fa130, 0x45f8e8af, 0x9fe8b884, 0x37fe9724,
+       0xa5b21c89, 0xd1e43e60, 0x99029ea0, 0x31364846, 0x7e6055fe, 0xf509fc36,
+       0xd0677744, 0x779e75ef, 0x7fec13e5, 0xdb0a5f8e, 0xf27347e9, 0x4dc87203,
+       0x6d08c6d3, 0xfb1dc749, 0xf908395d, 0xe4990cc0, 0xd8b68763, 0x0fca6ffe,
+       0xd214754c, 0x080b67fe, 0x49d9f9ff, 0xcc82da36, 0x3be1eda6, 0x1a1f4e22,
+       0xd99f67cc, 0xe0dfb8e8, 0x40dfdddf, 0x5fc0a7ff, 0xe5a1094b, 0x9e0c1ccb,
+       0xc5d9d9e4, 0x1989ce30, 0xbf4316d7, 0x3213a673, 0x9d4d5688, 0x4490f63d,
+       0x891aebf3, 0xcddb4edf, 0xcf1c0d29, 0xcbf8d981, 0xe80293a7, 0x60ee8e97,
+       0xffc45f7d, 0x64ef38eb, 0xcc3fde3e, 0xfa102b1e, 0x8a97f641, 0xa0725da9,
+       0x4bd153f9, 0x2d056a48, 0xee53191f, 0xd09a769f, 0xe6e9e4f2, 0x721340f6,
+       0xc425211d, 0x1aea7293, 0xc91677fa, 0xad4228ba, 0xee8c0b6a, 0x4a6b0fe5,
+       0x22f9fdff, 0x12fa01d0, 0x6a1fd6fb, 0xa0e9e99c, 0x7b375af8, 0xf4d08796,
+       0x0f2cc0f5, 0xd9f5efe0, 0xd68f10b3, 0x676673f6, 0xfb5e0227, 0x06feef1b,
+       0xfa08d03a, 0xb5b3c73d, 0xea48907e, 0x39fbf423, 0x31c3d13a, 0x9301dffd,
+       0x0964254d, 0xb34d1b30, 0xd2a6d525, 0xe88d6cfa, 0x95e33891, 0x3b69b102,
+       0x28994992, 0x0ff352e3, 0x2637bb61, 0x71c34ad9, 0xef0773e6, 0xb81a55c7,
+       0x6fa50e67, 0x751274d6, 0x2912ba51, 0x75e2c6aa, 0x1a548a5d, 0xddc7038e,
+       0x68425e1c, 0xe1c0cf7b, 0x02d86571, 0x47329fd0, 0xf5c2c40c, 0x42678003,
+       0x4ca24a6f, 0x18f8e6ee, 0xfbbf72fd, 0x338f506c, 0x8e00bb8f, 0xecaa9009,
+       0x0c8f0e3b, 0xb201937c, 0x43fc8296, 0xe02463c2, 0xb91eccfb, 0xe5070124,
+       0x17f0a18f, 0xa42dae15, 0x1412d47b, 0x47ec56b2, 0x0324a4f4, 0xde1157bd,
+       0x4f51290f, 0x42157e51, 0xd78b84ab, 0x129e6a5c, 0x35f06539, 0x193ba9f0,
+       0x5e1cbfc7, 0xe518a048, 0x88d43152, 0xe307c078, 0xed4df92b, 0xbacba502,
+       0x947ee5d1, 0x90218a6f, 0xe17e4333, 0x3bf457df, 0xbdccff37, 0xca91d29c,
+       0xd3396b91, 0x2cdf8a8f, 0x8e92eb67, 0xc82008b5, 0x0f49b964, 0x40241210,
+       0xeb6f0377, 0xbc78a2be, 0xfb5bbf04, 0xe7c86fdd, 0xc9983260, 0x053f9327,
+       0x79bd07fa, 0xf0077ed3, 0x5edf3af5, 0x5d6bcc07, 0x7a825efe, 0xe8c7d38a,
+       0x5daf95d7, 0x81d6ce52, 0xee808d7c, 0x9ea748c3, 0xc6a7d1f2, 0xa6767e02,
+       0x748bf72a, 0x08933b7e, 0x6b75d9ea, 0xd02b7848, 0xb5e594b5, 0xb5e1696f,
+       0x9d3b8e74, 0xd698bebc, 0xed06bcd3, 0x3adbbea9, 0x68870b49, 0x8d8b6b7e,
+       0x85ab1fb5, 0x311f9a45, 0x8a148491, 0xc2c56d4f, 0xbe5a4e95, 0x17eaa375,
+       0x34fd5eb5, 0x2d6725a2, 0xdeb2dfb4, 0xbdf00aa6, 0x3b23ad8f, 0x443849f3,
+       0x39b1dfc7, 0x69239bf9, 0xf9b2143e, 0xf24fd387, 0xd945faf8, 0x022844a5,
+       0x9c3a31b4, 0xae5c7921, 0xa9e50204, 0x7ecb7cbc, 0xa48ebfff, 0x5d363df0,
+       0x45a0aff2, 0x4ccfd63b, 0x769e28d0, 0x3f048168, 0xc0f07f4d, 0xccefcc7c,
+       0xdd00260c, 0x9f9c6e76, 0xc0f14c00, 0x461b99e6, 0xd2617b41, 0x6ce91d61,
+       0x1f47ffd6, 0x00ec3a28, 0x9e994b38, 0x7e0d6a4f, 0xbcf9a253, 0x89b91249,
+       0xadcf214e, 0x1fdbdc21, 0x4f5811b2, 0x8b6de8fb, 0xcdd44ebe, 0xb4eb5779,
+       0x5d7f818f, 0x2009160f, 0x86353bda, 0x923741e7, 0xbeec8af0, 0xc85cefe3,
+       0x5d2913ea, 0xbf2e0e80, 0x96675962, 0x4756f85a, 0x3c717079, 0x1c755ab9,
+       0x897a488f, 0x578bd690, 0x62469ffa, 0xf07ae9f0, 0xe9f58128, 0x8163e78a,
+       0x7ca05d27, 0x9cab830f, 0x1c1eb9ef, 0x6357caf7, 0x21b1f1e3, 0x7fa01eef,
+       0x6177c522, 0x50eb0424, 0x0a24617a, 0x57c9e2fc, 0x9a0bb034, 0xc5c93109,
+       0x7cfbd1a1, 0x1337201d, 0xaf583e22, 0x837e8dd7, 0x81568fc9, 0x6fe630f8,
+       0xb7e4f7b4, 0xc1fb5893, 0xf87287a8, 0x697853ce, 0xcb87bb39, 0x847f4f59,
+       0x732447ad, 0x4f75c21c, 0x5e7561e1, 0xc84c7d1c, 0x97cb940a, 0x817ae049,
+       0xedcddea6, 0x6c06a751, 0x7900dfae, 0x910240b7, 0x134ddf38, 0x42d27ad8,
+       0xe9a05d74, 0x162f44a3, 0x664b9d70, 0x2eb2d7fa, 0xbc9fd1f5, 0x16e9165d,
+       0xd468df40, 0x8734803e, 0x23cd31f8, 0x92474c01, 0x26af4c56, 0x49f34c11,
+       0xa405a63b, 0xaf43531b, 0x422a89f8, 0xfac4c47e, 0xa4e720c9, 0xe58b63da,
+       0x3264d0bb, 0x3cce3eb2, 0x73782d9a, 0xf8ebf890, 0xe75f021d, 0xfc8aa648,
+       0xf17af843, 0xe818b06e, 0xfc2854c5, 0xefccdbbb, 0x0ebe24e2, 0x693dea38,
+       0xdd335780, 0xcd54548d, 0xf06d5a7c, 0x1c2444a9, 0xc41f32c7, 0xd6b8cc63,
+       0xfb7356fe, 0x9c9f98c6, 0x491f23a2, 0x50cf666e, 0x71bdf438, 0x0828d1f0,
+       0xab419e7c, 0x29b23adc, 0xb6494bbf, 0x6b9a5ac8, 0xe8764f74, 0x893f2f38,
+       0x7ceb6747, 0xbe2af0ac, 0xa9b3c181, 0xcb0a9e07, 0xc297fa3a, 0xfea64ff3,
+       0x1db24ca4, 0x86a20bd6, 0xbc56de70, 0x42def9f6, 0xd2e4fe8f, 0x57d66991,
+       0x02d78a4a, 0x069f8587, 0xe37c7f68, 0xe47fea4b, 0x211bfac3, 0xa9ec2a41,
+       0xe60101f9, 0x1a40ad7f, 0xc85e2913, 0xa0eda268, 0x6af5cd70, 0x698b8ecc,
+       0x91f41937, 0x74c90b66, 0xee92cfbe, 0xe43ed023, 0xf41d9127, 0x6df367b3,
+       0x7d695ba5, 0x63b69faa, 0x1e4005fd, 0x0b6d1dae, 0x9fd1b940, 0xf5329e4e,
+       0x112efd47, 0xe836e1f0, 0xe4c3f163, 0x1fb436b1, 0x6fa27c95, 0xc75f2389,
+       0x1d157cb9, 0x9eb0ea71, 0xb094cab8, 0x8ffa1b33, 0xb53e4314, 0x5d61f89a,
+       0xe6cdd49f, 0x30e1c651, 0x59fa9de6, 0x6a7e0040, 0xc03b31f7, 0x3fd04855,
+       0x74da3254, 0xb4dd1ff0, 0x7e42f50e, 0x50531754, 0xd83fa23f, 0x5f3d9e1f,
+       0xd00bed3d, 0xb9d47d7e, 0x92be076a, 0x9fa0e9fc, 0xc8568f57, 0xf8bdfa60,
+       0xfff63b3b, 0x1862a7b9, 0x47cf9989, 0x0bb1d10d, 0xa670c1a9, 0x67a618e1,
+       0xed31da1b, 0xd30b786c, 0x594ae9fe, 0xebceda8e, 0xc0d7e27e, 0x3f0f101e,
+       0xc00f3447, 0x5c75d51d, 0x12a21c17, 0x82802eb3, 0xd36fff06, 0xdaf0bcd8,
+       0x086bc46c, 0x67d54de6, 0xe0367878, 0x9e000a5b, 0xc2223887, 0x77867cd2,
+       0x01d03fc0, 0x3c8e8bca, 0x5cf102b7, 0x9e02c64d, 0x0ca4c937, 0x13e03cf4,
+       0x827d89d6, 0x03800eed, 0xfe69f3f2, 0xc1fa8ffa, 0xf78659fb, 0x9e29978c,
+       0x4b494e00, 0x8eadc664, 0x913b95f2, 0x27d7120b, 0xf9927abd, 0xbdf6bdd9,
+       0xcf00eff6, 0xac894696, 0x68a6bc85, 0xf7b7114a, 0x15824a41, 0xdcdfc1d3,
+       0x28fd3e56, 0xe2b90bd8, 0x5a648757, 0x3a5eb43e, 0x4f2311d9, 0xfd746559,
+       0xb0c276a4, 0xecf2e6e5, 0x074f3990, 0xb7347f40, 0xc43e5cc5, 0x87aef5c6,
+       0xad1e4078, 0xe8b65af3, 0xd3fd7157, 0xea240d55, 0x02f26396, 0x1791a7c3,
+       0x423b13bc, 0x46cb7e74, 0x4c038c11, 0xb3f5b1b7, 0x7ca3be15, 0xd74f2f71,
+       0x5231fa5b, 0x46dba269, 0x193d30c6, 0xddba7d6f, 0x46ce3c56, 0x4db06bfb,
+       0x72a3671e, 0x042292e4, 0x5b9777ec, 0x93f9e3d1, 0x8e126dd3, 0xebb5209f,
+       0xfbab8522, 0x4adfe23a, 0xee4cbef1, 0x2c7c828e, 0x21fcd62b, 0x30fe4750,
+       0xd51263ca, 0x15f66261, 0x700253c1, 0x6c4a7850, 0xfb044e38, 0x0738a6e9,
+       0xcc997dfb, 0x4a365dfa, 0xf6376823, 0x3655e703, 0xd80ce119, 0x34fd0904,
+       0x1555974e, 0xa34df739, 0x9f554ed9, 0x2667fd05, 0x78c16705, 0x7e6fb946,
+       0x1963fa29, 0x2bf4ccc3, 0x0167d477, 0x2206547f, 0x4e7f80d3, 0x926c5f7b,
+       0x36b7bce9, 0xf144bf10, 0x702b9eff, 0x7357f41b, 0xb008fd7b, 0x5e06df7f,
+       0x3b2a0098, 0xa5ac7a80, 0xa25fa564, 0x148972e5, 0xca3f2995, 0x25bf0f13,
+       0x2a1a4017, 0x938b3886, 0x477d33d4, 0x35224bf5, 0xf5231cbd, 0xa27e218f,
+       0x72d03c80, 0x60256f55, 0xdba8380f, 0xef863270, 0x1e734c94, 0x7cd8fa6c,
+       0x72e37a7f, 0x27e79829, 0x09fe0387, 0x49dde9da, 0x26927fcc, 0xde000bfa,
+       0xa6ffaf7b, 0xc4fcf006, 0x67f93366, 0x5a4d7f56, 0x79696ffe, 0xfee26810,
+       0xd5fcb4b6, 0x80f1bcb4, 0x979c5697, 0x9432ca63, 0x24f0050b, 0xbf07f932,
+       0xe41d67be, 0xcf5bf878, 0x572f58db, 0xf835bc37, 0xa720e1c3, 0xa43f831d,
+       0x052d59c4, 0x3e42ff91, 0x1c28b5f0, 0x098f9992, 0x62134f78, 0x18176e52,
+       0x5a9c9bf6, 0xdc947488, 0x988ea9d2, 0x8fc0ddf5, 0xc1ddfcb2, 0xf4878e1f,
+       0x78ad4c6d, 0x0120a455, 0xd768d03f, 0xe018b713, 0xe234effa, 0x1fc479a9,
+       0xa47338a5, 0x7a6a78b0, 0xf30a285e, 0x09fd5272, 0x233dd3eb, 0xf0c56b5f,
+       0x3b0fc581, 0x3f20ad94, 0x61b68cb4, 0x7865b35c, 0xf90290e4, 0xd1406a0c,
+       0x5dca677a, 0x4c6d8821, 0xe37c63cd, 0xd4f5b3f4, 0x7e8c3c35, 0xbdbfa198,
+       0xad5e1f1c, 0x67b3f51c, 0x31ded9a2, 0x2b2701d6, 0xdb36f4a2, 0xa694ce51,
+       0xbe82c54f, 0x9b539a7e, 0x69e51a76, 0x233fb9a4, 0xe36ed1de, 0xc96b8bf1,
+       0x593768b5, 0xe1fd12e2, 0x71f86bcd, 0xdcbcd913, 0xfc1849d3, 0x5189f4e6,
+       0xcfd79bc4, 0x9bd866f0, 0x9bbf3e1e, 0xfc04234a, 0xf3f89ebe, 0xeb6f0ccd,
+       0x7fa28baf, 0x29ec7eb7, 0x85bd67b4, 0xce3f261d, 0xa1ca1ef8, 0x76c4fcfe,
+       0x18f6a1a8, 0x23711bcb, 0x19e9a78a, 0x61ebbd69, 0xaddbb72b, 0x92275374,
+       0x4763d062, 0x8315a747, 0x84b7bede, 0x3cab4ec2, 0x6297587a, 0x7ef2adf0,
+       0xdf867cd4, 0x7cd8cb7b, 0xd3f47b69, 0x93989def, 0xf266e304, 0x7f11b0f8,
+       0xebcbf1ee, 0x284f78cd, 0x2d85c4b4, 0x67eab77e, 0xcc4b52f4, 0x5f39abe5,
+       0x57a7222b, 0xe8ce192a, 0x4f3e3035, 0x84bcf832, 0xdf3279f1, 0xd12f4837,
+       0x921d010e, 0x4dff994a, 0x4df37e2c, 0x5e8c1d29, 0x00c88f37, 0xa9fefc3f,
+       0x97663edd, 0x7126ba30, 0xc6efbc7e, 0x71c80211, 0x40268972, 0xc33e727d,
+       0x13c53253, 0xa5c977ac, 0x4ef6efcc, 0x525db0d4, 0x0b5ba309, 0x5fe14c7c,
+       0x898a7403, 0x5b4b3b1f, 0x6b7fa075, 0x741d4ef1, 0xe1c53259, 0xd4cf0a20,
+       0xd81b0a52, 0x805fb49d, 0xc51853d7, 0x49525ab8, 0xfca5d870, 0x82a2427a,
+       0x10f887cd, 0xe94b686c, 0x7e58253c, 0x20b26268, 0xa7ef7ed0, 0x80f1c07c,
+       0x8f173c71, 0x785fdfa3, 0xfddcf512, 0xc8364df0, 0x1cebf6a9, 0x36a5279a,
+       0xf707f83f, 0xf108e697, 0xbcc6e7e2, 0x2acb83fb, 0x35f812c7, 0x9572fc31,
+       0x16dee3c8, 0x22475dfe, 0x57c82e6a, 0xa5f76f48, 0x830feaf5, 0x65e47aff,
+       0xfecbe312, 0x87a189f4, 0xb21824dd, 0x1fd5f765, 0xdef8ce92, 0x7940179e,
+       0x24ef03eb, 0x8a52afc6, 0x9136fcb9, 0x5e867fdb, 0x140792d1, 0x00a12727,
+       0xd72277ae, 0x02da4f4f, 0xf054c50b, 0x4eb8c3bb, 0xae74c8b8, 0xca9f1937,
+       0xe6a6ff9c, 0x4ae2bd33, 0x9776b089, 0x903aa78d, 0xa834d6df, 0xc65a1fa8,
+       0x439ed5de, 0x7866b0f1, 0x73be1f93, 0xb9196b8c, 0x3cdbf68d, 0x2b70797c,
+       0x30fdc00c, 0xac22bfd4, 0x8d5f8c83, 0x0e03307d, 0x61d21992, 0x7e09cc9f,
+       0x2467e011, 0x24905fdb, 0xeb8fb512, 0x4795df1d, 0x6967cde1, 0x0dc19f28,
+       0xb6ebc9fe, 0x6f9c2ae0, 0xa2946b7e, 0xc99bce9b, 0x42216acb, 0xebcc225c,
+       0xb21e7c72, 0x9f8ebe31, 0x025df7f6, 0xe1c4d3ec, 0xdb22dddf, 0x472d59a7,
+       0x7e085088, 0xf289ed1b, 0x6a6ceac9, 0xa381c797, 0xd56bf391, 0xc3f8672e,
+       0x89ab7e18, 0x75f29924, 0x1fc233fb, 0x7711fac6, 0x514fb80a, 0x4358d1cd,
+       0xcf00b23a, 0xf61a29ef, 0x48eb6b57, 0xe9177c83, 0x78025b4e, 0x8b8f0310,
+       0x5277fd74, 0x90b8c4be, 0xd6eb607b, 0x81a7f0e5, 0x4085d10c, 0x0fa9e4cb,
+       0x178e9879, 0x69e307dc, 0xd2bf2b2a, 0xf5f0e371, 0x4d7cb10b, 0x6a5957c4,
+       0x147f6be5, 0x129ddaf9, 0x9fb77ac5, 0x8fc1b5f1, 0xad1f9c89, 0xbf8c687c,
+       0xd6afc79e, 0x335f3e72, 0x708549a1, 0x9b51dadf, 0x2ce69e30, 0x7c015cda,
+       0x25aa32de, 0x64de7c0c, 0x17df35f0, 0xdb2efea1, 0xa35ad31f, 0x72264eb0,
+       0xeed456be, 0xeb7b9006, 0x38935d7c, 0xbe0534bc, 0x5f39b806, 0x93f807bf,
+       0xae08ddfd, 0x076bd7c1, 0x45bad7cc, 0xfed39b6f, 0xc2d927fc, 0xf1891ed7,
+       0xd7c067e7, 0xb30a4f00, 0x963edc63, 0xdfea7eca, 0x06e7e9c7, 0x6b99f989,
+       0xe5ac1cb9, 0x1fb6b072, 0x223ff839, 0x9afe03f3, 0xc98b3072, 0xe5a24381,
+       0x8cae9389, 0xd3b0251f, 0x9e7bc8e3, 0xe1b5fc24, 0xbc4334de, 0x27fe3c72,
+       0xbe84cd30, 0xcfd234f4, 0xe4c0e744, 0x73c98f3b, 0x76be727f, 0xfe387c68,
+       0xa7f46453, 0x26922ef8, 0xffbe395c, 0x7215705a, 0x43f0367e, 0xb728c582,
+       0x3a667a31, 0x86a92bc0, 0xd304799e, 0x28ad79a9, 0x81be86a7, 0x2bfa0a58,
+       0x3bc62b6a, 0x68ad999c, 0x98f3399f, 0x24fc31be, 0xb88d7ceb, 0x33d71378,
+       0x02217949, 0x853d9feb, 0x9eaa3f70, 0xcc9951f9, 0xd5e2301f, 0x18a8fd86,
+       0xbbd0d47e, 0x79a79f70, 0x97da3d78, 0x3bd637cd, 0x36c3ede2, 0xf077eefb,
+       0x3ed35f4d, 0x0e5a1aeb, 0xbbc9aefd, 0xc3b3c49f, 0xfb18798c, 0x6e3e4e46,
+       0xa8b51e73, 0x32df5c60, 0xc76adefc, 0xfeb26734, 0x7ae7be7a, 0xbbd1ee57,
+       0x54768f2c, 0x6f9f8c6e, 0x03e0c7e9, 0xa343e885, 0xe4183710, 0x4ce7091e,
+       0x3f04849a, 0x924dc7d8, 0x90729d20, 0x5aa97b1e, 0xff401689, 0x9cbc6627,
+       0x3db2f685, 0xbce406b8, 0x0380abe9, 0x53aba9e2, 0x96c6f35e, 0xe6f19d9f,
+       0xa56cc1b7, 0x7ee2d5df, 0xb148838e, 0xdc2763fb, 0x4b7ed1db, 0xe9c737c8,
+       0x09ae149c, 0xcc13c402, 0xbf8f0ae5, 0x72e69928, 0xa45fc799, 0xe7394b14,
+       0xbe34b90f, 0xeb93795e, 0x7602df15, 0x1cc4e74e, 0x713bd716, 0x30674f2b,
+       0xdbc73efe, 0xc234f375, 0x535feef5, 0xf6e5251f, 0xe29befc2, 0x9922f8c7,
+       0x3ebb4765, 0x2b9d852b, 0x26e7b120, 0xa26b5fe0, 0xccfc6244, 0xff9781a1,
+       0x61d4f108, 0x06cabe0b, 0xea156b3c, 0xdb465861, 0xc79c6ca5, 0x28f74263,
+       0x3ae6cf18, 0x02f5fb8b, 0x6a72e345, 0xdbf40b12, 0xef8521db, 0x3a52c0bd,
+       0x91057b8f, 0x37c0ecbf, 0x8c29d022, 0xb1448ba9, 0x303a43de, 0xe61b089f,
+       0x5187e0b9, 0x33c44bbf, 0xc61b614c, 0xf6cc7e8d, 0x7888d643, 0x03a8836e,
+       0xedc9bfb4, 0x4297f82a, 0x1ae77e88, 0x40be77f8, 0xc4c8316b, 0xc608b2e0,
+       0x7cedad93, 0xa039d853, 0xaffb7a3e, 0x5237df4f, 0x548f8173, 0x1ce8372c,
+       0x694ef514, 0x5ff2df42, 0x12f38189, 0xdc58abc6, 0x2a5f5acd, 0xde4017e9,
+       0x0bc2e5ac, 0x7e053a7f, 0x6467aaf4, 0x3ca7a3f4, 0x41bf4723, 0x045b35f3,
+       0x076d53f4, 0x770fe89d, 0x51f2c23e, 0xfb43a28f, 0x8c05db73, 0xdbd9d507,
+       0xe201bdef, 0x0488cf8a, 0x19708dfd, 0xe29d8bee, 0x59fb2673, 0x80079cbe,
+       0x9a1cb66a, 0xec57df0b, 0x77d813b7, 0xf16e79a8, 0xf9a06fb7, 0xf464c7c5,
+       0xac766a51, 0x657f6050, 0x40885849, 0xc1326bbe, 0xc4fb43f1, 0xbeda0ef0,
+       0x369edbcb, 0x2bfb0dc7, 0x455da20e, 0xa7b4f6e1, 0xa9f4a6cd, 0x0d353f0c,
+       0x2ddcabbe, 0x98ffc1f8, 0xa38eccf2, 0x9abbf419, 0xa73c0427, 0x45cbb550,
+       0x9cba18b4, 0xdfa3136a, 0x9d33f880, 0x8bc5f827, 0xc034eb49, 0x0d8ecd7b,
+       0xb713168a, 0x9230d33c, 0x7cdef668, 0x1c7413cd, 0x93ed5dfa, 0x58a61f82,
+       0xe041236b, 0x9ce7ce8f, 0x30dcdb65, 0x08ca15bf, 0x59abcc0f, 0xc38b7681,
+       0x7ec1f6f3, 0x8b78657a, 0x57d68d32, 0x2945b23e, 0xaaa7e18f, 0x2d10d75d,
+       0x6d4e3f86, 0xd4bf4dce, 0xae867b7a, 0x54f0b15b, 0x88b7a612, 0xc4665614,
+       0xc8767bec, 0x453f9c49, 0xdf06ff53, 0x18275e87, 0xef3d0ac7, 0x741abc41,
+       0xbd32a65b, 0xbcedd060, 0x7528e9ca, 0xb388cd17, 0xd02f7aaf, 0x2af10ec1,
+       0x1bfbd315, 0x6c6e987c, 0x9b3e90d0, 0xe1577f00, 0x7b9606be, 0x88629127,
+       0xa275788b, 0x3c9f52c2, 0x21962f5d, 0xf960124e, 0x8283dbb4, 0x1bf98976,
+       0x383926e9, 0xb75c820f, 0x964c4fc9, 0x49bebae8, 0x7e252e09, 0x77b4be3a,
+       0x6075c972, 0xc8e705a7, 0x1d9fb0a9, 0xe8f160ac, 0xa2e40f88, 0x7ccbef89,
+       0xd6f2664b, 0x7c60a194, 0x8bf7d364, 0x41eda1b6, 0x7d365e18, 0xec277cbf,
+       0xe67ed1ab, 0x1aae54ca, 0xee4fda65, 0x9b49fbe5, 0x4fd4d13b, 0xa30adcda,
+       0x8fd8c59f, 0x6cfd6073, 0x19bd7b9a, 0x4695b99e, 0x8fd8f53f, 0x4af36067,
+       0x199263bb, 0xb1aa3b9e, 0xfddbf49f, 0x06881f68, 0xdc7690ff, 0x4eef7517,
+       0xc496b71a, 0x1fe4d1f2, 0x2a1e78c3, 0x947cb155, 0x24c13138, 0xb27a494f,
+       0x74a83f29, 0x6a7da9b0, 0x9f54c720, 0x85b5765e, 0xbfa8dd2f, 0x8a814f31,
+       0xab38b126, 0xbd415832, 0x81d83c53, 0xbb06bbf9, 0x75dcef51, 0xb02af07d,
+       0xd05600f7, 0xc12977f3, 0xbe1c6a31, 0x0812f3a1, 0x1b34cfc6, 0x32ec7da4,
+       0x7939efbe, 0xde2357c8, 0xd9d7dfa7, 0xd12447ba, 0xf14a43fc, 0xadef3023,
+       0x8de3b332, 0x9d824338, 0xce6bfea0, 0x8a16da2e, 0x50cb6bc1, 0x6f422fca,
+       0xd0722dbf, 0x73b8fc07, 0x4a576ff5, 0xa1a6be14, 0x7a6e1e0a, 0xe1edfe5c,
+       0x9b99b510, 0x00fb9687, 0xea8576ff, 0x15f1d88f, 0x8e3e7e3a, 0xdfc61bbf,
+       0xd93b332b, 0x673dbe3a, 0x477c69a2, 0x7c698556, 0xa7c74287, 0xf56fb1f2,
+       0x8a7c7c3b, 0x7909ebbf, 0xc7077e56, 0xe05567b7, 0xa90acdf8, 0xd09f8d30,
+       0x9001fe33, 0xcdfdc39f, 0xf37ae73f, 0xcd2ab3fc, 0xfcd857f3, 0x80feae8f,
+       0xf3809f8f, 0x80fe597f, 0x92ab3fcd, 0xfacedfcd, 0xdbdf19ed, 0x6157ff83,
+       0x37f5affe, 0xe649dcff, 0x36ab0ff9, 0xc6cedfcf, 0x27f5637f, 0x8e377c7c,
+       0x09fca6ff, 0x6ab0ff9b, 0x07b15f1c, 0xca47c0fd, 0xf07a8490, 0xa461a99f,
+       0xa35d4061, 0x923a40e3, 0xc837a9c5, 0x5dc70839, 0x3eef8c09, 0xe6fca04f,
+       0x24a7d5ee, 0xea90254c, 0xd3ce5acb, 0x158bbb55, 0xd0842fe6, 0x41c4585f,
+       0xc45fb85d, 0xb46c8cf5, 0x78538787, 0x218bf73b, 0x78dc2fc8, 0xac5b9e23,
+       0x77dc13b3, 0xfa3056a7, 0xc0f1ff1f, 0xf3b1ade8, 0x5a8ba6b2, 0x13fecb65,
+       0xef38c783, 0xa6ab2454, 0xa78829fc, 0x127c3d50, 0x9e9a1ffc, 0xb478e996,
+       0x83f043fc, 0x1b958aae, 0x768c2e76, 0xce9f2277, 0xfe1cbbeb, 0xf7c31253,
+       0xdc053ba9, 0xc37cf847, 0xd9f40552, 0xc99756a2, 0x74e3a86f, 0x8ece7eea,
+       0x79c68dfb, 0x14505bbe, 0xc1fdf909, 0xbb051d6f, 0x41e6f171, 0x276eefa6,
+       0x1470d5e1, 0x79fac173, 0xff3a5543, 0xe3eccadb, 0xeb6b8c44, 0x9c1c5843,
+       0x49b8810c, 0x7906db59, 0x52dccd08, 0xf9ec9b26, 0xfce6835b, 0x7ce6156d,
+       0x6d961ca7, 0x112ccf60, 0xefda16c8, 0xcb65ebf7, 0x8e3600b9, 0x76e64957,
+       0xbbef1b25, 0xb4198694, 0x8e90fbe8, 0xe9156283, 0xdf65573a, 0xddd4f01a,
+       0xae28932d, 0xb8a91dc7, 0x454a140f, 0xb2a82dbf, 0x9de15b79, 0x00f43b2b,
+       0x8fee6785, 0x15a7c444, 0x2e838efe, 0xf3ed46dd, 0x907fcd8e, 0x9d6c7e21,
+       0x3bfe158f, 0xa3e75b96, 0xcc3eb02a, 0x19cb590b, 0xa9f9589f, 0x36f17f6e,
+       0xf37b3db3, 0xb5fb58b6, 0x530cd76a, 0x56f8497e, 0x9bc5fb53, 0x17ea99e7,
+       0xd5312eb5, 0x6a59682f, 0xfd0bcfca, 0x8efed4c8, 0xf54c2be5, 0x635fafdf,
+       0x62adbfaa, 0x6b7f2983, 0xfb5321f0, 0x98b6ca5b, 0x47076dea, 0x68e4077d,
+       0x9e22ebd5, 0x3ee0bdfd, 0x9bd82f75, 0xee12dc17, 0xed447e73, 0x33839015,
+       0xb4815ed4, 0xf478ff73, 0x2c1ea9a7, 0xf9a24d87, 0x2d5598ca, 0x0997a099,
+       0x6572cfea, 0x24d0aac2, 0xd7b0178a, 0x9b887ca9, 0x041d1215, 0x0f724cce,
+       0x318b771f, 0xa9971df5, 0x7d054cdf, 0xb17adf7c, 0xdd797e23, 0xd4c379d6,
+       0xaf6a7e38, 0xb02192dc, 0xce5975ce, 0xb569189f, 0xb1a73ce5, 0xeb817dbf,
+       0xe9856ad9, 0x19bdea83, 0x86736193, 0xe223e5fa, 0xf9ec9b9d, 0x0db0223e,
+       0x53feb048, 0x98861f81, 0x76aa6bf6, 0xfbe49ae5, 0xe11121ec, 0x409d05aa,
+       0x5217eaf5, 0x72028d60, 0x35923d16, 0xa1c0346b, 0xef4055af, 0x75c54fec,
+       0xe9436cfd, 0x3fafd836, 0xf4c010d3, 0x4c3286a3, 0x3104354f, 0x02a1b0fd,
+       0xf50d93d3, 0x2c347698, 0x86bdf4c7, 0x36efa610, 0xbbfa60b4, 0xdf4c5686,
+       0xe98cd86a, 0x4c610d1b, 0x4c741b3b, 0xd1e8790d, 0x0f6e01bf, 0x84d71b1b,
+       0x2e7cc3db, 0xe73da98d, 0xf7ff70c2, 0x11f3fbbc, 0x7f9fef60, 0x6cfb8ecb,
+       0xcacbe1fd, 0x51d3fd6f, 0x3ca57b47, 0x639d083c, 0x8133bd6b, 0x2369c9d1,
+       0xec1c64a5, 0xcff4ecff, 0xc4bcc7cf, 0xfd84f52e, 0xfa713c33, 0xfa5d7885,
+       0xf444e9e5, 0x949982ee, 0xfe1ea71e, 0xf7e822af, 0x607fac02, 0x71111c07,
+       0x6dd1261d, 0x95d7a07e, 0xe1784de2, 0x2f1059f7, 0xbf83d73b, 0x8b882cf6,
+       0xd8a8ab5d, 0x3b36f9ff, 0xf9d2f881, 0xcfbc2e03, 0x36d8fe75, 0x32e3c82f,
+       0x3d8e189f, 0x6b4d6147, 0xb761d922, 0xe736efc9, 0xa50ab7cf, 0x689a1e78,
+       0x0347b389, 0x3861a95f, 0xe0d9d20f, 0x67e8d4c3, 0x71c14f99, 0x65caecce,
+       0x5e7e3371, 0x424eec83, 0x277ea57e, 0x869fffb6, 0x0c7ebfa7, 0x23690878,
+       0x5e08381f, 0xdb98bb71, 0xf97efb7f, 0x814cfa49, 0x20392af8, 0x82f60e7f,
+       0x1177fe9d, 0x6122651c, 0x2eb7e8de, 0x63ec8622, 0x69b77ca0, 0x669dfa3c,
+       0x7317f4f8, 0xe6b7c52e, 0x042234fb, 0x9c46bf68, 0x80fe0aa4, 0x02f530f3,
+       0x788cabc6, 0x6ee49749, 0xc6f4c611, 0xbc78ea4b, 0xa1d1c6b8, 0xb9d16904,
+       0xee4bdcb6, 0x38699e9f, 0xaf39c2a6, 0x02ab470a, 0x64454fce, 0xb9e80954,
+       0xd2ab6d73, 0x12ac1ec0, 0x2f15dfcf, 0x67679b7e, 0x6125bd71, 0x8ebcdbb9,
+       0xb420fe72, 0x1d9ca35f, 0x8a9f7472, 0x31b59fc9, 0xefdadb3b, 0xf6c0fb04,
+       0x1f776a2d, 0xd683769f, 0xfbb54f17, 0x3e30553f, 0x5c53112e, 0x7bdfc0c9,
+       0x9d82604a, 0xd772a9e2, 0x7e8f68fb, 0xdc468724, 0xd4fd097d, 0x9f6e7e77,
+       0x88727ce9, 0xf338c3b4, 0x8881f227, 0x743bcb76, 0x15f8fd3d, 0xe4db9d99,
+       0xf67b80e7, 0xfebef995, 0xdf9b9e02, 0x84e78556, 0x8ff7de3e, 0x242dff68,
+       0x81d22f01, 0x1d8116b4, 0x4ad88e79, 0xc8e74f01, 0x31f1de6b, 0x3a95b874,
+       0x05ef404a, 0x863b662d, 0xfca6bfda, 0x7ce6cde2, 0x06999939, 0xa37ca4fa,
+       0xce02c24c, 0xb37f54cf, 0x177ec55d, 0x5826fa93, 0x8fee2557, 0x348957cc,
+       0x9ad5ea84, 0x34567f67, 0xb411c28f, 0x88c83f33, 0x66492cbf, 0x4a656076,
+       0xc27d8158, 0x7fc6da0f, 0x832006f7, 0x7104dc3d, 0xfc489228, 0xfc5f483b,
+       0x56fc295e, 0xbaf58d78, 0xc3881c4f, 0xe212ee21, 0xdad603ee, 0x86cf6e05,
+       0xe7c03d30, 0xc705f86d, 0x7615f92c, 0x2452de7e, 0x9cfdd022, 0x12d908ea,
+       0x851fdeb1, 0xbb5edc78, 0x7106957f, 0x7b6ac0fc, 0xdfdc6f6a, 0x0f649768,
+       0xe159f962, 0xf73c72d5, 0xf00b4520, 0xef8f21de, 0xc41f9c2b, 0x9c016f04,
+       0xdc40f523, 0x3a75ce1e, 0xdf215bbd, 0xf3c0a9e4, 0xef20751f, 0xbc7bbfb4,
+       0x9c418ed3, 0xa35a41da, 0xbb5fe53a, 0xa01fb2cf, 0x902ef399, 0x5067d04b,
+       0x09a2e780, 0x235cb9c6, 0x7e3cedcd, 0x2e31fe73, 0x4381748f, 0xdf39ee3e,
+       0xe14770e6, 0x2899093c, 0xb7f1ed9d, 0x63dfc072, 0x56fdc3f0, 0xcaa77f68,
+       0x7df2d7da, 0x9edf3bdd, 0x097c9e9c, 0xa5f7547d, 0xeb31c240, 0xadd49d48,
+       0x7dd61f00, 0xd7f96129, 0x5d1a9bd6, 0xe6f46355, 0x59f04a2b, 0x27a604fb,
+       0x8e813e01, 0x64dfbb13, 0x027087bd, 0x2f4261f8, 0x386d7c3f, 0x7f498852,
+       0x8f04a7bf, 0x6be383c5, 0xd3ebeff7, 0xbbe009ff, 0xf3feb1ff, 0x11dff4fa,
+       0x679afe0f, 0xd10becf7, 0x17f2b5f5, 0x10e1780f, 0x6b52c7d3, 0xacef9c1a,
+       0x0bdab1de, 0x1491f972, 0x3f5d02f2, 0xef718b0e, 0x0c3ba6e7, 0x70ddd3be,
+       0xf396b08f, 0xaf9f99dd, 0x2ff836fb, 0x5590ef9f, 0xb2ec0f8c, 0x2994ed47,
+       0x3096db6b, 0x7f65d8f9, 0xf19be59f, 0x7edd53bc, 0x7ca8beb3, 0x0d3481fc,
+       0xb885550f, 0xff451cff, 0x7ffb76a0, 0xabbb034c, 0xdea3748e, 0xe3077eb3,
+       0xf68c997f, 0xb1253cc0, 0x0e71bd6f, 0xa5e38eab, 0xde1d6dae, 0xbb6baf13,
+       0x9a1334f9, 0xad3bf40e, 0xbb7055df, 0x9f30e1df, 0x42f034df, 0x5feeccc2,
+       0x0583c4f5, 0xceb853ef, 0x2bc57f6e, 0x29f2c7e4, 0x23e77fd3, 0xa5fb1e0b,
+       0x755cbfd6, 0x6b18fd52, 0xb4eb1b5f, 0x2bfb9fb6, 0x2d5a5807, 0x0fe0bd47,
+       0xf1916f56, 0x9ef57bbc, 0x861f3b6d, 0x76dbccf8, 0x7fda70ff, 0xde979ed5,
+       0xabe69eb8, 0xa653929e, 0xe1b869b3, 0x9f41a29e, 0xf2dffa3a, 0xa8f4bd71,
+       0x4525fa7c, 0x7fcacd1b, 0x974bdc9c, 0x290ea7aa, 0x7c5f7464, 0x521c894c,
+       0x85b67ed8, 0xa7f7913e, 0xeab15f81, 0xd0142f89, 0x141f1f5f, 0x1c767a48,
+       0x09796e7c, 0x13c063ed, 0xabd393d2, 0xf6967e87, 0xa82e9475, 0xb2f42d17,
+       0xaf98fbb6, 0xc42fd007, 0x3f7f29e3, 0xb7d84bf9, 0x0fdd9df9, 0xf278a878,
+       0x9f30bc9f, 0xe33d52d3, 0x4ead9ff3, 0x1520fb83, 0xc54d2872, 0x3c579594,
+       0xbfe403fa, 0x907fc7c5, 0xeac5cec6, 0x575cfc19, 0xd173cc06, 0x9e707323,
+       0x7c8824e5, 0x7633f158, 0x4482fccf, 0x238a9f4a, 0xd839f727, 0xab7a763a,
+       0x4f11371d, 0xfb0242c3, 0xe189af18, 0x640f181d, 0x607f0de7, 0x65913fec,
+       0x60e0bf98, 0x30e45af4, 0xa5d1f1ee, 0xb77f9624, 0x9d03b737, 0xd3d50cce,
+       0x475c8e21, 0x87c710a4, 0x2bf69170, 0xce9a9f1e, 0x52681dcf, 0xea8eff11,
+       0x0e5029ff, 0xdd65dbed, 0x8efa6059, 0x1deecc5c, 0x3e3e4eff, 0xec013b85,
+       0xd469d3d7, 0xbf338c1e, 0x9d630e03, 0x0c5676a6, 0x3bc8c59f, 0x6bedff93,
+       0xf21bbc98, 0x0a519e1f, 0x609d9ff5, 0x81df0472, 0x8ae142fd, 0xa1fd63a6,
+       0x07ea02d9, 0x93c6893b, 0x9732edf3, 0x95bd7373, 0x12fc285f, 0x7c3dc7ac,
+       0x2324e303, 0x2dbed01d, 0x8fbf48df, 0xae30abd5, 0x86bf6fb7, 0xfae62f1c,
+       0x1f45ad60, 0x07524790, 0x2d5b7fb4, 0x0c3e7787, 0x35e54bf2, 0xcafc81a4,
+       0x27c15ef8, 0xf1bc8fbb, 0x9fb72a3d, 0x35b90c44, 0xdcab55eb, 0x409dec56,
+       0x27edc9e2, 0x2b893f6e, 0xae3cb4b7, 0x903bbadc, 0x7ad6ff9f, 0xd3e3c0d5,
+       0x7a1a3c16, 0x5a7c3fb2, 0x1db7e4f5, 0x493d5c5a, 0x45209dff, 0xe0d1f97d,
+       0x2aff8343, 0xcf06a5ff, 0xa9f0f50b, 0x7c3d87c1, 0x9f61f06a, 0x8f09a478,
+       0xe1bbfad6, 0xc0853a6f, 0xcfc63273, 0xfdb00fab, 0xd1ddfa67, 0x2f888521,
+       0xd239971d, 0x4a48747a, 0xc96c3e6c, 0x75ed2c47, 0x69603e4b, 0xebe4b41f,
+       0xf7abed4d, 0xb9d8511f, 0x9da9a89e, 0xe4a7fcb8, 0x01f13883, 0x6baa1d63,
+       0x010954fb, 0xf1bbb87f, 0x0925797b, 0xfe5e2079, 0xf2f188bc, 0x26e38a2e,
+       0xeed74e3a, 0x608f7c6c, 0x57c593b5, 0x2f6ed4ba, 0x93ab93d8, 0x553bbe58,
+       0x683d0269, 0x593b7794, 0xd02bafdc, 0xb18a4ded, 0x203fdeef, 0x08ef1ea2,
+       0x7e78d293, 0xa140de28, 0xfd20edf8, 0x80fdb3d5, 0x61d7b02e, 0x30ac84bc,
+       0xd154e3f0, 0xe21cb59d, 0xde22ad35, 0xe2b85b6b, 0x239c2f16, 0xfb903ae9,
+       0xbe5a329d, 0xdb22d7e8, 0x52e90ca6, 0xf81f8c46, 0x9a6d0911, 0xf5fec024,
+       0x059fe47a, 0xb85f9807, 0x797c7d70, 0x95dfe4a8, 0x4054efbb, 0xee7f52ef,
+       0x87beec64, 0x23c54fd1, 0xff03f296, 0x15a6e5c8, 0xdb951fe3, 0x1e41f5cd,
+       0xe4ec183f, 0x92c7bee7, 0xb77fdcb1, 0x9e0fdec5, 0xa77fe62a, 0xeba7d28c,
+       0x3ce04898, 0x2203f9c1, 0x6efce7d2, 0xe3007e76, 0xbf01d7fc, 0xe7b12b77,
+       0x7c82cea9, 0x1ebfd55d, 0xefccfb3b, 0x3e06ee8b, 0xc14ef7da, 0x767a694f,
+       0x7e23dbdf, 0xdf67f905, 0xf4877acc, 0xa0e53f6d, 0xba55f713, 0xff907a0e,
+       0x4dff9ebb, 0x7f90ddd6, 0xecf18ece, 0x145f83ae, 0xad753f00, 0x1e8057b4,
+       0xefe7e2ec, 0x45ff3d56, 0xbfae0741, 0xa9c7488d, 0x9f4fe64e, 0xef5ff03f,
+       0xf381fdc1, 0xc0ace807, 0x42e838be, 0xa5fbaaf9, 0x5d6fe313, 0x14517fcf,
+       0xa5fc27eb, 0xfbe5a9f3, 0x521e5d9d, 0x4be017b6, 0x7544fb62, 0x1b6ebabf,
+       0xd3512fbc, 0x40594876, 0xf0bca7eb, 0xafd002a7, 0xdd997b5d, 0x3c7729d4,
+       0x8179fb0a, 0xca340f35, 0x209d5e94, 0xff698364, 0x0128de6b, 0x978bea39,
+       0x715c613f, 0xfc58f8a0, 0x043e0d7f, 0x4f3fe99d, 0x29854c18, 0xdef8ff07,
+       0x0e27a03b, 0x8d2f91da, 0x59127ef9, 0xe5ccf681, 0xfff4dde6, 0xe885bcdc,
+       0x03bde640, 0xefe13de6, 0xc0d7de77, 0xbed4a1a1, 0xcf97d072, 0xf30bbf9f,
+       0x847e3c7b, 0xfefc8077, 0xfcf9dfd2, 0x7bee98af, 0x97bddd29, 0x7f87f79f,
+       0x9feef3e7, 0xcb9ebfee, 0x79c2aee9, 0xfe17ba98, 0xa95df084, 0xfe12939e,
+       0xbfbde5be, 0xfef61bf9, 0x35bf9b5a, 0x93cf1b27, 0x70b0c03a, 0x40b6667b,
+       0xc8ed7178, 0x9dd82a99, 0xd5ef3f62, 0x7e60484c, 0xf7b02895, 0x1650c821,
+       0xcfdc240f, 0xf80d6382, 0xdd9b880e, 0x4ddc933b, 0xc9137768, 0xbc53aedf,
+       0xbe7abdac, 0x911acf1f, 0x21056f71, 0x8fc9399f, 0xbf8b6ef1, 0x5d1028d9,
+       0x74aef6a0, 0x818f37f5, 0xb48f23df, 0x9805ed45, 0x33690fbe, 0xaaca638f,
+       0xdc87f262, 0x53bce6f9, 0xbcede733, 0xf061073f, 0x0c247c3b, 0xd4716cf1,
+       0xd3ce1561, 0x02256389, 0x4938a54f, 0x0efc086b, 0x7dfccfbb, 0x7ee10252,
+       0xc7865fef, 0xa716048a, 0xed718512, 0x9471e03a, 0x78dce30d, 0xe2f11b48,
+       0x08baf7c7, 0xf17baff7, 0xf80ed4da, 0x663fc094, 0xd5fa17f6, 0x12d3fb84,
+       0x691a42ef, 0x76e69dd3, 0x2cbe8fdc, 0xb25d189d, 0x969d39aa, 0xd062e899,
+       0x4c7d0e21, 0x7cf03174, 0xd2b1f4a5, 0xebff8ac5, 0xf75f1813, 0x2e832f47,
+       0xef1d6e99, 0x7fdcc9d7, 0x133f0128, 0x820199f2, 0x7fdcabfb, 0xbc745290,
+       0x7eaa24a7, 0x7e0097bc, 0xe01a945c, 0x86deef2f, 0x3f73a4f1, 0x00dbff7f,
+       0x44afd54f, 0xebf8a0e2, 0x5121eddc, 0x2b0a5ef8, 0xb6569fe0, 0x404fb889,
+       0xacd168a4, 0xc3627d98, 0x85faa80f, 0xb953e707, 0x4e9e1ed7, 0xf7dcafbf,
+       0x61da0141, 0xcfd1bb2b, 0x605cfd09, 0x14750f74, 0xa5703ec0, 0x2b11fcc4,
+       0x6049acbf, 0xcfb396f1, 0xae20cab9, 0xe762ec23, 0xb7232b7f, 0x7398f6c8,
+       0x9904a14d, 0x739e9bc5, 0x3d085ea1, 0x28f9e021, 0xdcf62f80, 0x9c87e1a9,
+       0xf060427d, 0x9df197ed, 0x4f5dca98, 0xaa7c4275, 0x1fbb2df2, 0x5dbaf8cc,
+       0xc87ee29f, 0xf1ec5f94, 0x2e1fa076, 0x7d12e29a, 0x44bb01e2, 0xb6da8fe4,
+       0x6843f41a, 0x36a2f91e, 0x2beffdc2, 0x7eab57f4, 0xb83efcf1, 0xf4f55670,
+       0x7f885ee3, 0xe1df699d, 0xaec0b8c5, 0xfae7c74b, 0x3591fff8, 0xd6ffffdc,
+       0x3b4f7669, 0x067fffbe, 0xf176a0fe, 0xfb9609d3, 0xb106bbab, 0xb44914f7,
+       0x71ef52e8, 0xf0b9ed55, 0xcfafc428, 0x51e4fdee, 0xcffabb80, 0xfc14787f,
+       0xa9d0720a, 0xba827dc2, 0xf18ebf9f, 0xdfbbe33e, 0xf9d03d70, 0x2f18e3c4,
+       0xfa9b7ced, 0xe75ff41f, 0xc0b3a7f3, 0xea7ceccf, 0x4f10698f, 0xa9f9f3b9,
+       0x9dce6ef8, 0x27494ccf, 0x9189f471, 0x0786ff02, 0xd2b5af10, 0x11db48ed,
+       0x51ce7ff4, 0xd9ff83ba, 0xd489d713, 0xc69978b0, 0xe3bb39e3, 0xc4fbc7c7,
+       0x7d66da6f, 0x4842c6e7, 0x0646bf65, 0x4139c710, 0x006639e9, 0xe3cddc74,
+       0x5d6f9175, 0x0e738e32, 0x3af4a0fe, 0x85e3a16b, 0x3d8f45b6, 0x836d750c,
+       0x44e38dfa, 0x233f8007, 0x413fbefe, 0xe40122ff, 0x60bfef68, 0x37e80cfc,
+       0x73b84e9d, 0xd82c85cf, 0xee48f8bf, 0x85ef8b9e, 0x21576f3c, 0xfcf9511e,
+       0x9d4f289b, 0xf8c71ccf, 0xf071e136, 0x8ff3d24e, 0x99f92bc5, 0x1eedbacc,
+       0x74e1ff16, 0xe690f880, 0x071e72c5, 0xc46d7c62, 0x0b8bfa87, 0x73b1718d,
+       0x40bec627, 0x7877f6cd, 0x6e97a5bc, 0xd7a044c2, 0xcfdc97fb, 0x02a0f030,
+       0x8d8dae1e, 0xc38fc67b, 0x2d3dc4f5, 0x427a0374, 0xae27b3bc, 0x7b13d849,
+       0xcde16175, 0xcef47178, 0xda5e2c2d, 0x8f3fc729, 0xaf41c465, 0x9fe25976,
+       0x3fc581e1, 0x2b8f372f, 0x9760d3c5, 0xf15afd86, 0xf8abf675, 0xae5bfdfa,
+       0xe85f9d81, 0xdaad7f77, 0x3de61f7c, 0x05dd3825, 0xef6d6bfb, 0xa7cf042b,
+       0x2b73b374, 0xf967be7c, 0x3fb3d3f9, 0xd62e3117, 0xfa823914, 0x8c3faadd,
+       0xbc2b57fd, 0x6b787077, 0xe3f5b3f7, 0xd84f5eec, 0x7b39fb4d, 0xebe439f8,
+       0x63efddda, 0xaee8ee5c, 0x988e95a7, 0x8fd616f5, 0xce7ccc70, 0x80a8793e,
+       0xdfe379c5, 0x3171ab1b, 0x40eeb37b, 0x76ea71fc, 0xa71a6a7f, 0x9851142a,
+       0xf1e9701d, 0x2dfa48ce, 0x7699dfd0, 0x3a4ddf19, 0xbee31113, 0xc9701c17,
+       0x95a11f7c, 0x475d0fc9, 0x71c09ef1, 0xf0a77f76, 0x573c04b5, 0xd2f1e77f,
+       0xb7fde077, 0x8358a93b, 0x82b6dfdd, 0x4fdb69f1, 0xef4021f4, 0x13dfe3b6,
+       0x07dafd61, 0xffb18df8, 0x4fd44e8b, 0x50fd50f1, 0x10a06ef4, 0x77aad5d8,
+       0x66cb7dae, 0x938e9f82, 0x2342eb0e, 0x83ee07ed, 0xbc39b9c0, 0x569dee57,
+       0xaa88f00a, 0x7d0a754d, 0xf9bb21e7, 0xafde557d, 0x21ef9aac, 0x6bc6af90,
+       0x266f8fd0, 0xcc664b8b, 0x9f165232, 0x87f7190c, 0xabc213ca, 0xaf7f7ce8,
+       0x28bb3706, 0x8d9e7c5e, 0x78112fd9, 0x06a26a27, 0x2e63d3f6, 0x4bc1de7e,
+       0x83bcecbc, 0x7aa3643b, 0xf6ff61fd, 0x9e08930d, 0x7c06d867, 0x819e73d9,
+       0x2f800b44, 0xea7d768d, 0x321de72d, 0x5a2a13e1, 0x17338722, 0xfd5025ee,
+       0x77866ab2, 0xf11fe42b, 0xb2cdf7b0, 0x3821f748, 0xdb8db0df, 0x1560d9a3,
+       0xe77df6e7, 0x6fbeebec, 0x78a53296, 0x853f30e9, 0x535ff5d3, 0xca7c5ce1,
+       0x0d4fc52d, 0x2d856951, 0xa3dc1a63, 0x78bc7949, 0xcfcd066c, 0x34f4ff5f,
+       0xe2f7ffac, 0xff3459b1, 0xb20e7b93, 0xcf012afa, 0xaeb0bec1, 0xeff01a76,
+       0xd9fb96d7, 0xb9663314, 0x77f0057f, 0x77eef02e, 0xae706917, 0xefe15ba2,
+       0xdda00465, 0x7f0c89d0, 0x9f77ee99, 0x98657f02, 0xf00563ad, 0x7fcf63eb,
+       0x16f78491, 0x2aa1fbf9, 0xdce15469, 0x789a2d15, 0xf3e712f1, 0xccfbbcfa,
+       0x498dcbf5, 0x3f8177c1, 0xbc8de79a, 0xef1d1a6f, 0x0e718ae1, 0xf2d00e76,
+       0x829aa34e, 0xe9c85d74, 0xcb3df84a, 0x8b3e7c45, 0x02c290c5, 0x7f5caddf,
+       0x5751ef19, 0x1ef4578b, 0xdbab8735, 0x67fbefd5, 0x3378007f, 0x007f8293,
+       0x3fdf59fc, 0xb815c57b, 0xe519f500, 0x5c7de25f, 0xeb333de3, 0xea4468bb,
+       0xfb3efb8e, 0x5a2efe56, 0x9bfef07f, 0x69ba283b, 0x682f39ff, 0x39518f7b,
+       0xf150b31b, 0x31cfd1c3, 0xd2fd0bcb, 0x0426c220, 0x1fa71076, 0xf788cf3c,
+       0xb822ee1f, 0x1765db5f, 0xbbaff074, 0x7d4549fe, 0x3a70b99e, 0xae5d5ffa,
+       0x339c08ec, 0xc35bbaea, 0x018a3d7d, 0xe869e401, 0xf828c481, 0x3e1e5487,
+       0xe7c3c8b7, 0x8f37fe66, 0xdb5175db, 0xa9fd81df, 0xa06a3fbc, 0xed8bdcc5,
+       0xee9e9912, 0x8e10d06a, 0x087424a1, 0x8e81fdd6, 0xebe6e397, 0x46cfa737,
+       0x9eeb9e9b, 0xee1ff880, 0x28ffc18e, 0xcc74bf77, 0xe63a3377, 0xd1d0e3bb,
+       0x7bdd6efa, 0x6858e0ae, 0x28fcba77, 0x7d675fbe, 0xdf4aceaf, 0x21f5a93a,
+       0xed2b3b78, 0xfeb8a7c0, 0xb31bf418, 0x29d22c7c, 0x00939e86, 0x3e07318e,
+       0x06bc01b5, 0xe7ec1f1d, 0x9ba9793c, 0xf1d673ad, 0x063acad2, 0x9fb4e307,
+       0xf74cd6e5, 0x451c0a0e, 0x69ca897e, 0x87c58dba, 0xb7efb6fa, 0x9d4b9cff,
+       0x59502cf3, 0x73ff14bf, 0xfe064f00, 0xfbf3756f, 0x7ff17dea, 0xf8a3b43b,
+       0x3fe61dbf, 0xbbcffc00, 0xfb0dfe14, 0x87eb8abf, 0xa29fd82a, 0xda1ff47c,
+       0x3a1cb4cc, 0x8dd134ee, 0x8764b072, 0xd931f7c8, 0x3e865ffb, 0xfd5d7259,
+       0xb917b821, 0xf20267e4, 0xfefe42eb, 0xfdfc27e5, 0xc1b9eb4b, 0xea10b2f2,
+       0x1f9fcbcb, 0xaa3ea30c, 0xff2e65da, 0xbbcf7767, 0xde785997, 0xad352417,
+       0x2b4ebdf7, 0xb9bbcffe, 0xb4e858de, 0xd72f7bc5, 0xdbd68748, 0x33cce74c,
+       0x83f4f4a6, 0xa6cfa0fe, 0xb8f189bd, 0xc409957f, 0xa5297413, 0x2019de10,
+       0xf4094285, 0xd7e5cc5b, 0x72d86fe8, 0x1d9ffaf3, 0xcc43df32, 0x43df316d,
+       0xbe6ade1c, 0x66d57887, 0x51c43df3, 0xc43df361, 0x338d766b, 0xae4747e5,
+       0xb31fb537, 0x3f29b27f, 0x534dfa36, 0x66c7f1fb, 0xda13f29a, 0x7f6a67bf,
+       0x4df35bed, 0x5475d7f5, 0xf86fea9a, 0x7f299968, 0x9b3ff763, 0x311747da,
+       0x61b878fd, 0x5bdc1179, 0x7872f030, 0xa15362a9, 0x9b08e97c, 0x9e5b105a,
+       0x90056ba6, 0x7fe0e916, 0x532f27f5, 0x8a2a3f1c, 0x898ba75d, 0x536fd26c,
+       0xd47ce61c, 0x8f7dfe6d, 0x35722c97, 0xcb527ea4, 0xbc1d9a08, 0x63cf0f24,
+       0xc63af953, 0x01b1dbf5, 0xa0dfb7ea, 0x9b46d57c, 0x2f956f20, 0x9a01bde3,
+       0xad8fd886, 0x1f9f77b0, 0xd4f99a72, 0xf95e8fd7, 0x0738db9d, 0x53facad4,
+       0x264bc6cb, 0x3fca3139, 0x172d8c2a, 0x73c74f16, 0xabf5fd40, 0xb35c16f8,
+       0x3bbc107d, 0xa3530f3c, 0x16cca9bc, 0x67dfdcf7, 0x7fd0bfee, 0x8ec7dcda,
+       0x7cf00cfa, 0x26daf7ce, 0x7b56bf38, 0x51fa377b, 0x5e337619, 0x5decf37a,
+       0x479e0363, 0xac3e481a, 0xb6fdc6f7, 0xebe13445, 0xd177ce36, 0xe0d333db,
+       0x3f66419c, 0x87a155fe, 0x1b47ebe9, 0x042cd742, 0xe98711c2, 0xb456795e,
+       0x39f81a6e, 0xeb79f8c3, 0xe7f8b64d, 0x0c3c92a0, 0x48a0e92f, 0xdd505ec1,
+       0x2b9c2f68, 0x4f0bd77f, 0x0f68dcc7, 0x38e87926, 0x17b4c7f3, 0xbad4fbb1,
+       0x5ee8e67f, 0x947d0db8, 0x026c0ee5, 0x93e592fd, 0x17dd9688, 0x83dbf49e,
+       0x788ef02d, 0xefcdb263, 0x00b77cc6, 0x4c7fd9e3, 0x5e3a20c8, 0x84459fe3,
+       0x75f0f1af, 0xeec83e78, 0xabb8c7ae, 0xcfc24f31, 0xe6711809, 0x89d9be0b,
+       0xabc6cf80, 0xe107ee7b, 0xdc17907b, 0xf7e876c1, 0xc71946c2, 0x982c9c6d,
+       0x4b798dea, 0xf78dbf9b, 0x6cdcb2be, 0xde74e5de, 0x933db700, 0xa8f8d5c1,
+       0xae113240, 0x28f4bdff, 0x5cfb35f8, 0xc507def8, 0xc7c010c7, 0x73fb3d39,
+       0x3a79319b, 0xee419aaf, 0x9ed16bad, 0x4ea7ef89, 0x8fa1e637, 0xe33bd134,
+       0xe2fc332a, 0xc6fd1946, 0x3c6e4945, 0x886e10ef, 0xe79afa72, 0xf99be4df,
+       0x5c295b9d, 0xf8884eab, 0xd1d6b6de, 0xfd28f4ba, 0xe5cdbcae, 0xf17d6b0f,
+       0xf0634e7f, 0x7ba7f852, 0x4f36de40, 0x79e3f9c3, 0x31ff806a, 0x0d9c3c81,
+       0x452c17fc, 0x236c183e, 0xc7d36fb0, 0x7930f04e, 0xd951ed9e, 0x72be357b,
+       0x85be8726, 0xfda76cd7, 0x5dfa7995, 0xb0f36ff7, 0x4f36ff75, 0x72ff759c,
+       0x975707ef, 0x54851fb5, 0x37b445d4, 0x111fa908, 0x3d53476b, 0x1bfd0e56,
+       0xc7f13179, 0xff6fd005, 0x65bf9a76, 0xede5f644, 0x80cfb034, 0xecfb0d0f,
+       0xaed98f4e, 0x3fbbd18c, 0xfbbd30f4, 0xf4c0cf43, 0xfda18fee, 0xe345efe9,
+       0x4aa935da, 0xb4f7bd7c, 0xac1fdd87, 0xe7821553, 0x0fd9fb03, 0xdae5c9d8,
+       0xd6feef3a, 0x1ff9cba5, 0x4f832e39, 0xfcfefacd, 0xf4112d31, 0x4207ca54,
+       0x86b777dc, 0x3c6dbf2c, 0xad9b6bd0, 0xf7cc3378, 0x78fe1667, 0xf59f4d68,
+       0x18f1cc2b, 0x6ac78b8e, 0x099b478a, 0x973c3b8f, 0xb6bf0fb0, 0xdf30afbe,
+       0xf8e4e9f3, 0x09bf7aa6, 0xeb373bc6, 0x6b8822bd, 0x1cf9ced4, 0x1ed7fef5,
+       0xaebccca7, 0x1d397e18, 0xa1e00567, 0x799fd673, 0xe303ae7c, 0xb99eab4a,
+       0x58e2112a, 0x7a0d9335, 0xaa7df044, 0x4839f9f3, 0xecfb7397, 0x2e79c03a,
+       0x3d139d99, 0xa3daefb7, 0xa4f8f710, 0x2c7258e1, 0x793dcf7d, 0xfda648bc,
+       0xbc7bdb9d, 0x7703c248, 0xd43bd361, 0x5b7f1735, 0xdef77014, 0x37e1e84b,
+       0x368f5b07, 0xe57c593a, 0x37173841, 0x6abfda86, 0x7a65f212, 0x285eed9a,
+       0x1dbf1d17, 0x395c21fc, 0xa62fe63f, 0xd04ab259, 0x7ec11633, 0xee373cd3,
+       0xc972f967, 0x9dfa6cc8, 0xe387ad12, 0x6af9c4cc, 0x04efc098, 0xf1444eb8,
+       0xef3c02f7, 0x3ef86076, 0x02b243f1, 0xbdffc29e, 0x78093c1a, 0x09ab3a4f,
+       0x77c41a89, 0x471e6e8a, 0xd30a6953, 0x3ab7ddbf, 0x848cf7f0, 0x53aaaf05,
+       0x3cdafea8, 0xdd8efd93, 0x920b63f9, 0x55691fc0, 0x0df2de99, 0xb463e1eb,
+       0x6be7078b, 0xe6231737, 0x40577c75, 0x921d1955, 0x8a6b6c33, 0xf9c78c35,
+       0x25fe98f3, 0x3dff1a52, 0x1eb7ca29, 0x1c43a6cd, 0xc5cef8d8, 0xfc522bbf,
+       0x7803cebf, 0xf0fcdb46, 0xabfb8f4e, 0x92ca386f, 0x28ccfb69, 0x945e5fbe,
+       0xc39de1c0, 0xfbef07de, 0xd345e34e, 0xd4b5187d, 0x27b74efc, 0xe214b4d0,
+       0x6defd0fc, 0x8bcef8c9, 0x38a29eb9, 0x0bbb9691, 0x0aaee5cd, 0x47e18f9a,
+       0xf6d677eb, 0xae925f86, 0x37f63832, 0xbf0f1038, 0x79fd506c, 0x340e8f94,
+       0xb07f30f8, 0xda34c341, 0x0fcb1230, 0x2f31f837, 0x986cf4da, 0x7faffa4f,
+       0xeebb1490, 0x9d54efc2, 0x75c3e18c, 0xf9ade472, 0x88df8f80, 0xaf15af88,
+       0xdefe478e, 0x3a8e9a34, 0x7367bd86, 0xfefec632, 0xd257f2e9, 0x0d5f284a,
+       0xd3afd1f9, 0xefc3c64a, 0x17f3b096, 0xf63a4170, 0x257aee1e, 0xe093f9a0,
+       0x34c63477, 0xfbc2863b, 0xc95bc1a4, 0xfd239458, 0xbbf089c5, 0x6c337b0b,
+       0x949a7eb4, 0x07f8ecd7, 0x64deab80, 0xe7e7afe7, 0x6c9f1f33, 0xbce3afd6,
+       0x0a66ff4c, 0x71bce3c5, 0x537e09f8, 0x39acfd00, 0x3307b9c6, 0xbf54891e,
+       0xeb8a76e1, 0xdfb3efe6, 0xc754485f, 0xf7bde1fb, 0xcec35ecd, 0xbec5f7a9,
+       0xff99bee7, 0xe1e2440e, 0x29176825, 0x103bf63e, 0x0f7b0a29, 0x4d930489,
+       0xe5cdedef, 0x0606ccfd, 0x1f57d09a, 0x15fde6cf, 0xfb0e791d, 0x8897df83,
+       0xf087eff5, 0xccd8c3df, 0x3574d3f5, 0xed4dec50, 0x5bd4676d, 0x7759ebbf,
+       0x0bd1216d, 0x890143f6, 0xed04bd80, 0xd4bb698a, 0xdc02030f, 0xd7ce33ef,
+       0xcdf80b3e, 0x93ddfdef, 0xebc3027d, 0x8a7d3c93, 0xd4494eff, 0xe3079813,
+       0x123c16fb, 0xca7603da, 0x6206bb3e, 0x8fe47452, 0xf8947ef8, 0xe701c53b,
+       0xbc0f53fc, 0xd9e5eecf, 0xbf38143a, 0x7c5bd2b8, 0x4551c413, 0xf3033ea5,
+       0x816f4ef7, 0xfa9e83fc, 0xdda3d887, 0x1f0137c5, 0x06f7f3a4, 0x01000408,
+       0xe1aa080e, 0x43fd638f, 0x64654eb3, 0x2bf2cc9f, 0x873637bd, 0x3f5f2132,
+       0xf208f80f, 0x7dbfb48d, 0xc021c149, 0x86e16e47, 0x423763e6, 0x037f68de,
+       0x5789ffb6, 0x3b8ffe65, 0x4af60d98, 0x79a55e4f, 0x625e4c4f, 0xa960e279,
+       0x239abf31, 0xd073c47f, 0x3bd807b5, 0x6607a95d, 0xd4cf3008, 0xff1033fd,
+       0xbcb7d5e7, 0x878c342b, 0x04eb608f, 0xf41b978b, 0xa6e1ee30, 0x79f783d9,
+       0x9d61f863, 0xc4c76cd7, 0x0fbc27dc, 0x1fd3ddf0, 0x36cbaf8f, 0xf74a9ef6,
+       0xc6efd88f, 0x547b030d, 0x86b9b884, 0xa3dc2e69, 0x70c1fea7, 0x98395c12,
+       0xcde35fd6, 0xb55e3a41, 0xa9cdfb3b, 0xa75f2f5a, 0x80772964, 0xf8b54e3e,
+       0x3f5cd935, 0x7f8b508f, 0x372b4893, 0xf0b5c10a, 0x8f686c9e, 0x937de2ac,
+       0x4728195d, 0x228eb967, 0x5f3183f5, 0xcbbfefcd, 0x476b832b, 0xc4591e81,
+       0x76556ef4, 0xdfa658a0, 0x8d973d57, 0xf0670bbf, 0x2452555d, 0xf7bb9c6d,
+       0x3791b75c, 0x21e4477e, 0xef09d5b5, 0x5afb18f2, 0x6437fbb5, 0xc7fd3ec1,
+       0x3b46de87, 0x36624971, 0x76d359c2, 0x69df815c, 0x7ca36da9, 0xd8fbbf47,
+       0xa3c763d9, 0xc887f25f, 0xbe026fa0, 0xc368d0fe, 0xd9fdddcb, 0xfd522f55,
+       0xea85d3a6, 0xd3038368, 0xd5fd7a9d, 0xf09c0ae0, 0x49c9b82e, 0x1cf1e9f9,
+       0xeafe055d, 0xf51eb7bc, 0x3a8ae3d8, 0xd3aff80a, 0xe066c3fb, 0x9124aae7,
+       0x5f0febf3, 0x7ef8f3d6, 0xb9efcd3d, 0xbfa6edb7, 0xa160df68, 0x7ba9fed9,
+       0x41fc8dc4, 0x02df92ed, 0xb66ed51f, 0xb3fd6085, 0xbef1da39, 0x1be82773,
+       0xfbe65fd4, 0xa6051b99, 0x5873430f, 0xf772fa1c, 0x74be2b34, 0xfd8c7091,
+       0xe99124bd, 0x84290aab, 0x5f1576fb, 0x2ffeb17a, 0xba69c71f, 0x1c77da0f,
+       0xe31bd637, 0x838ef754, 0xf6fd527c, 0x5fcff461, 0xafb0dabc, 0x77ffd475,
+       0x61cfc53e, 0xe874f538, 0xd0d941e7, 0xa4cfd427, 0x1ee78678, 0xf9243e79,
+       0x47a97908, 0x2e6dacff, 0xf6fa04c9, 0x7eb313d6, 0xb74a25d2, 0x3e781297,
+       0xc9737f74, 0x13ed38a4, 0x8c73ed2c, 0x7fb14ffc, 0x3a0f3c2b, 0xda0ef37b,
+       0xbd93fa5e, 0x6df00f27, 0x4bfa59b0, 0x86dfc636, 0xb7fc19fd, 0x65fbbbc7,
+       0xa5e9ef78, 0x10f140a4, 0x2068df66, 0x15245b87, 0xc0d1877f, 0x3ebe1ef3,
+       0x8d797c55, 0x78bdff09, 0x9f95302f, 0xfb4cd06e, 0x2e178ba1, 0x7b3f7bc3,
+       0x41563af8, 0xdb3eec42, 0x7da6b923, 0xc70fffd0, 0xb8a385d7, 0xfe4a381f,
+       0x328c70c6, 0x385e81e9, 0x5fe54df2, 0x69310e17, 0xec366976, 0xa1b1ad53,
+       0x0b66909f, 0x6ec07239, 0xf7ec5ffb, 0x0734201a, 0x61a899e7, 0xce57da6c,
+       0x079f6039, 0x448e79c6, 0x40e3498e, 0x056d749e, 0x913f53ac, 0xe5a1afd0,
+       0x8619390e, 0xfde1d56e, 0xd8952a2b, 0xb0754e5f, 0xe6f51986, 0xab876277,
+       0xe5a258a4, 0xb879d5e3, 0xdd94e5ee, 0xfdf60755, 0xcfe17736, 0xbc931357,
+       0x5ab27da2, 0xc7f68a58, 0x9b17c49a, 0x3d38df61, 0x0233d981, 0x58f9b179,
+       0x267abc46, 0xbdf72daf, 0x31c41378, 0xaed4aeb6, 0xab6e7f06, 0x0c391c33,
+       0x6e3df9eb, 0xdcaa3dfc, 0xf816e175, 0x83710abd, 0x314bd70d, 0x2b6bbc29,
+       0x6078179c, 0x8bec1f84, 0x40d760ad, 0x5c6e35fb, 0x421a5bff, 0xe2af2f68,
+       0xf5f6c0eb, 0xe7385493, 0x9296e8dc, 0x916bbd61, 0xb8056feb, 0x64efba5e,
+       0xd03ae3b3, 0x4196fe63, 0x80cbef3c, 0x71cb4d75, 0x14f5e58c, 0x68575b19,
+       0x3485c183, 0x44ffc3f2, 0x33d412ad, 0x6b0ed127, 0x04ab2f74, 0xbfd68e3b,
+       0x7a78a0ec, 0x85e3993c, 0xe8f4e7d7, 0xa0cd93a5, 0xbd15c507, 0xef3a12f9,
+       0x7a633f1d, 0x3fda09ea, 0xe7452bbc, 0x18778213, 0xe84947bb, 0xc1242587,
+       0x74d0c76f, 0x9dfb0e74, 0xbd17aa5b, 0x3849c7e8, 0x491f635f, 0x0f7ec519,
+       0x7ac3da1d, 0x83919093, 0x0cca98fb, 0xe2835ef6, 0x66fde371, 0xdd5677e3,
+       0xb3a7f8c4, 0x67df2978, 0x43de5971, 0x895fae70, 0x784ee99b, 0x4f862137,
+       0x0b7bcb15, 0x07cc0912, 0xcd544b7b, 0xe449bfe5, 0xd8834afb, 0xb70eadef,
+       0xa32ed085, 0x35e98452, 0xd9f68a24, 0xf981d268, 0xe66de031, 0x0d2c35c2,
+       0x278d8e2f, 0xbbe2c8ba, 0xc7ec1101, 0x788d5bb4, 0x44f5f04c, 0x96bfdeba,
+       0xfc36e3c8, 0x66538c77, 0x7d7ee214, 0x5fab1266, 0x0fbbc815, 0x338dbcec,
+       0xc69c61a6, 0xf58cefb0, 0x16dfb0d2, 0xab579872, 0xc17b5c42, 0x3a16ebb0,
+       0xb6753e59, 0x8868e0fe, 0x0b53b66b, 0x2fee1b34, 0xf96af8b3, 0xb034e2e6,
+       0xba1e16cb, 0x4ce4ed15, 0x8b65d995, 0x8250ce36, 0xdadee1a3, 0x8a07f43c,
+       0x84484c37, 0x4ed5847d, 0x8575e27f, 0xfbe267e8, 0xc7b503b9, 0x355da6b6,
+       0xab71e419, 0xca90128d, 0xeeb24bfb, 0xb17c0b1e, 0xcced0f21, 0xc6c109ad,
+       0xd6efda24, 0xabfcd67f, 0x4ea7fe68, 0x8c38f0bd, 0xd5813ab3, 0xc051bbc3,
+       0x12e73d9b, 0xc9bbe1b6, 0x3d6f8dfd, 0x1252f097, 0xa8ca7f7b, 0x7e536fff,
+       0x80007d7c, 0x00008000, 0x00088b1f, 0x00000000, 0x7dbdff00, 0xd5947c0b,
+       0x66fdf895, 0x666579be, 0xf263c992, 0xc2130922, 0x9e4e5e4b, 0x124c2280,
+       0x4cb443c2, 0xe8202a10, 0xa79034f0, 0xbadc5d48, 0x30040cff, 0x5706b650,
+       0x84ea2b11, 0xbbaac562, 0x351ba341, 0xb88080ea, 0xda446dd6, 0x8ffd16d2,
+       0x4810154a, 0xfed2b58a, 0x39cf65dd, 0x7cccdef7, 0xb5f01993, 0x3efeb4ff,
+       0xe7ddf7ee, 0xce73df79, 0x12e973bd, 0x2c614dfc, 0x5630a494, 0x51c1d8ca,
+       0x618cf58c, 0x24dea98c, 0x064dcf06, 0x34e2d26f, 0xa37efac6, 0xf5e1bb67,
+       0x926f6617, 0x25d8c6c3, 0x79fa2ed1, 0xa0b199aa, 0xcdb3b189, 0xc11c166e,
+       0x336699d8, 0x1f966b95, 0x9fa0c698, 0xb9850e9a, 0xc55b19f2, 0x3f6336da,
+       0x69923baf, 0x3d0155dc, 0xf4648e0b, 0x5bfe0977, 0xd528fcbd, 0xebc9dd5f,
+       0xaa0eb2d7, 0x4f3192bf, 0xf76b3c07, 0x1cd0595a, 0x51df5fae, 0x4a1f69ac,
+       0xd7bf51d2, 0x3b06fb25, 0x5bdd8c9c, 0x2abefc3d, 0x5d569f78, 0xfae1f662,
+       0x13e38e58, 0x87afa8ab, 0xebe63af7, 0x77aeb188, 0x49de5c04, 0xac4e8a82,
+       0x32b1d0ed, 0xe03ad6c6, 0x1ec62e9f, 0x6c7cd850, 0x15f7f6b7, 0xc2632919,
+       0x9e2ad6ed, 0xf898c70c, 0xa8bc6a70, 0x88d48167, 0xc467dab2, 0x345e35f5,
+       0x0ef3fbd2, 0x63075fb3, 0x3ff4c91e, 0x7fac2d70, 0x1953eb26, 0x909f53cc,
+       0xcd5d8e38, 0x71258b58, 0xba673e37, 0x08a17d0c, 0x53333038, 0xf8337e71,
+       0xc4ebf62b, 0x71944769, 0xed403ed8, 0xa98ed967, 0xc473400c, 0x8303735e,
+       0x90b037f7, 0xce060aca, 0x28fdfa0f, 0x2359dfb2, 0xdd1be5b5, 0x09ecf2da,
+       0x7e6332da, 0x9a4fd782, 0x1a4eca9b, 0x04fefdc2, 0x0311d6a6, 0x5802b72e,
+       0x5eed7eb1, 0x0464e04b, 0x923beb1e, 0xaec6e535, 0x88c9c0ac, 0x1ff16a71,
+       0x135ff059, 0x589d775f, 0xdf4607f7, 0x5bc00ead, 0x71190b3d, 0x46c140dd,
+       0xacc658ef, 0x7c45e616, 0xf16fd81d, 0xcfe812b0, 0x00b76e66, 0xabbb1b7c,
+       0xdef02595, 0x30ef876a, 0xe196273f, 0xfaf03569, 0x0e88058c, 0x39da8fe0,
+       0x5bed99bd, 0xb713e415, 0xcdfedaab, 0xff00dde7, 0x4f0293dd, 0x24ac3d95,
+       0x0ea3ac46, 0x5e1e91d6, 0x07eb39c7, 0x582f8865, 0xa5ec6fcf, 0xa6461748,
+       0xf3d78524, 0x5cb5e1ad, 0x5dc6af0b, 0x1837a236, 0x1844bde7, 0xcea761a7,
+       0xceb2846f, 0x7e4463dc, 0x3ce917b9, 0x1c72de06, 0x6f3c4c4a, 0xe0c73c43,
+       0xfcaceda7, 0x1cc7e43e, 0xc7181fe4, 0x6527eeb6, 0x8f818b27, 0xfa1737aa,
+       0x054dbea0, 0x547186fe, 0x08a9bff8, 0x6d3bd9c8, 0xe9d03255, 0xc3e73b29,
+       0x7a2e890d, 0x0abc50ee, 0xe75d35e2, 0xd5fa47c9, 0xcc43b827, 0x66a3f1c1,
+       0xcb601942, 0xf962c1ae, 0xefe81ebd, 0xcb1b9821, 0xf0098416, 0xcbc2c878,
+       0xefca392f, 0x6ee308dd, 0x0de5e64a, 0xd5b9bd3f, 0x16ca093f, 0xe5439e59,
+       0x416d0c87, 0xffdde03d, 0x44f5c982, 0x28f7b53e, 0x32305e58, 0x4d4c04f0,
+       0x2365843f, 0x4226a65e, 0xf4b720e7, 0x9b769a2f, 0xeed05ea0, 0xa78427fb,
+       0xfb39ff5c, 0x26363cf1, 0x4d7e7f66, 0xacdf797f, 0x53bf183f, 0xfbf87577,
+       0x419dc4d4, 0xc2e76f3d, 0xe7a72c76, 0x9ff43f03, 0x6d89a2fe, 0x0623e285,
+       0xda179b76, 0x632c5dd5, 0xd43908c1, 0xb679f023, 0x5b7241d9, 0xf943afbe,
+       0xa9f9063d, 0x7d70e487, 0xfe46aa47, 0x7f5cb94a, 0x7f4d5af1, 0xc27c8e39,
+       0x43dabd57, 0xe2feadf2, 0x121efa64, 0x736cf4f2, 0xf889e926, 0xc8d20ce3,
+       0x1338f0f5, 0x72f8b059, 0xefa24ce3, 0xcbe61c72, 0x06bdb922, 0xa4240ce7,
+       0x87bc8237, 0x750c2e71, 0x465f2525, 0x0276d99f, 0x67ac4591, 0x63341a9b,
+       0x07dcdbff, 0xfc18be1c, 0xb844e520, 0x1edb51bd, 0x811b23f4, 0x4863edf4,
+       0x7aacffb7, 0xd4fa91cc, 0x5038f066, 0x8af6a86f, 0x34372e23, 0x86647e4d,
+       0x5169280a, 0xd97f3d39, 0xd1e881b6, 0x411f706e, 0x3aeddafc, 0xafbe1f97,
+       0x483ce9b7, 0x730e2d27, 0x51bdf100, 0x7281c1b9, 0x076bf643, 0xb8f38f31,
+       0x7a421b60, 0xd57ade3d, 0x0f54898b, 0xa9199266, 0xc6f7ff1f, 0x0f17c583,
+       0x31bd8f1c, 0xfa0b88f1, 0x6e744b57, 0x910be00b, 0x1d0471fa, 0xdf63f744,
+       0x779cc6a9, 0xff093d74, 0x8436f8b8, 0xe7fe1112, 0x8119ba6d, 0x4d2ef318,
+       0x9e9bbe56, 0xdf25145a, 0x3c3b7f93, 0xd095ed88, 0x49f20a0f, 0xa32696fe,
+       0x90bc2dfc, 0x3922e958, 0x73b5ee9f, 0xb6e385b1, 0x7d9a8ed8, 0xed988fa4,
+       0x3ebfd913, 0xb849fd3e, 0x64aade18, 0x04601f88, 0x4ae37a86, 0x412bb070,
+       0x1597e22f, 0xd3e50caa, 0xa76f3a40, 0x77d7f4f9, 0xeb11e743, 0x0edd516f,
+       0x75fd6ba4, 0x99ca331e, 0xe6398ef5, 0xaa379410, 0x20f9d9ae, 0x02defa87,
+       0xb7d6127b, 0x1cc8ad29, 0xc15a8f8b, 0x2df9c46e, 0xd669d64d, 0x1d669f23,
+       0xf7e8dfe7, 0x9eb9925b, 0xb13fdd68, 0x9f1253c7, 0x79d2407e, 0xcb9b8f51,
+       0x5856c754, 0xe7c0de9f, 0x0763896b, 0xc1e37eca, 0x0b7ecb6b, 0xa87569c9,
+       0x44f68039, 0x549b78f4, 0xbe078f77, 0xf8f9826f, 0xc7c39cb1, 0x3aa254df,
+       0x16d74376, 0x47330257, 0x4b3837d4, 0x6c17fe08, 0xdf0f4c69, 0xc63d2137,
+       0xd3849798, 0x68efe4bc, 0xe8a2f93f, 0xc3b7f732, 0x5d0d10d9, 0xcba2c6b6,
+       0x4b37a879, 0x3999fcf9, 0x9343fe72, 0x8c7c8ebe, 0x49b29ba6, 0x977c83cc,
+       0x5876cf01, 0x66caa76f, 0x807d43ec, 0x9844d6b6, 0xe636cddf, 0x393e9900,
+       0x32677cb5, 0xe7acb7ac, 0x3f219180, 0x1d693a74, 0xf47da275, 0x8e14a6b8,
+       0x838a533f, 0x3dc7499e, 0xf8014f4f, 0xb824f676, 0x99d4f814, 0x0630fa02,
+       0xbc088f7c, 0x9fc6d633, 0xf21c686a, 0xb65fac8f, 0xc3767988, 0x6b0250f3,
+       0xb2bd8335, 0xc607c84f, 0x154fe7ee, 0x99c61718, 0xdde8cafd, 0xf58a2f64,
+       0x80b5021f, 0x43d3d3f5, 0x77fd14e3, 0x585edbc0, 0xeade047d, 0xdbc221cd,
+       0x6bdf46db, 0xe3c69f08, 0x772c74a1, 0x87933d1e, 0x70b670f8, 0x25efb5fb,
+       0x6ee9006b, 0xd3d67e20, 0x0e2eeafc, 0x81e2fe62, 0x8353ab78, 0x2eeb5fa4,
+       0x5877d1e6, 0x129cdfb7, 0x6c1b3efe, 0x2eb00986, 0x4270e666, 0x47c2c4f8,
+       0x896be0bb, 0xa3eb500f, 0x081f02ed, 0x3ec48fa7, 0x4eef1fa7, 0x780666e3,
+       0xefe66b3f, 0xdf246799, 0xfe7d0987, 0x005e4251, 0x0d1f33f7, 0x7a46ce07,
+       0x91e95d50, 0xe2cea77a, 0xac3e6fb9, 0x67abbd9b, 0x5963c04f, 0xed15ada5,
+       0x4f2665ab, 0xcb5dda12, 0xeb2bd3de, 0xc48409f3, 0x3c042b07, 0x5df732cf,
+       0x36ff3f88, 0xc209e38b, 0x97ff769f, 0xf8bca3bf, 0xa2bf681d, 0x9346ef4b,
+       0xcda56971, 0xf596fd8f, 0x876d3c54, 0xad5b2bf7, 0x2efd062e, 0x04fee29b,
+       0xf765bded, 0xf21b5c59, 0xa438bf71, 0x5dfa0b3c, 0x03be60fb, 0x9d7581e5,
+       0x06ecd337, 0xeb7ee093, 0x6de02b4c, 0x8964b293, 0x7dac0852, 0x1516ca7f,
+       0x57feacf0, 0x281667e5, 0xc17f755f, 0x8c75f316, 0x1cb282bd, 0xd0ff59ed,
+       0xfedf6899, 0xf646a712, 0x7f6fb72e, 0xca274479, 0x82a65bc5, 0xece5180a,
+       0xce60d9d4, 0xb78a532b, 0xf4fc6198, 0x0ea14f14, 0x32935bc6, 0xb7f62661,
+       0x7fb1bef4, 0x77df09dd, 0xa99acca4, 0x44de13e6, 0xcaccef7b, 0x926ed0a1,
+       0x54b3cf2c, 0x56697f42, 0x27a7b616, 0x090fbf00, 0x77f68f8f, 0xbdfdbf67,
+       0x1cd4e660, 0x53454bc0, 0xbffd0aa5, 0x96db729e, 0x36315731, 0x877281fe,
+       0x983fc607, 0x15a664b2, 0x9469dff0, 0xf16d97f5, 0xcc9d58c0, 0xbe0186f7,
+       0xbafef1ff, 0x9fa86699, 0x742dea96, 0xcd53fac0, 0x91996ff7, 0x65f81dfb,
+       0x4fbd12a4, 0x1271482c, 0x90461cdf, 0x33ebade6, 0xf82afd72, 0x71d3873d,
+       0x9424797f, 0x4ce511ed, 0x10dcee5e, 0x4e9c7e5b, 0x33b972e5, 0x8f77f621,
+       0xef004b90, 0xb3e90ea0, 0x96181acb, 0xc027961f, 0xc409e64f, 0x3cb9db5f,
+       0x639abe01, 0xd98e3e27, 0x5fe537df, 0xd3f53b80, 0xe8ac7aa9, 0x0d7290bf,
+       0x71c56666, 0x69764cbe, 0xcf5975e4, 0xbfb79252, 0xeb7c154a, 0x5671f0e2,
+       0x330ae56a, 0xb8470cf7, 0xc58b76c8, 0x4b47f33a, 0x88d052ff, 0xe2d6b9fc,
+       0xacf9c0c9, 0xc19e57dd, 0xd787632e, 0xf8d72c5d, 0x98ebc24b, 0xf407ef4a,
+       0x44b9fd0b, 0x5f31eeff, 0x57c95e07, 0x7d1a5780, 0xc33ad2bf, 0x3bfd69fd,
+       0x7ee3fb03, 0xc57a019e, 0x1b9e7b18, 0x415eb853, 0xe422ebf8, 0x5f214ada,
+       0x3d916a41, 0xabc5fe7e, 0x8fcd6f76, 0xf503771c, 0x7a7df80f, 0x412fee0a,
+       0x2b1ca2be, 0xb0b33d53, 0x8a4f597e, 0xa079ed03, 0xde828db7, 0x8937a454,
+       0xa694cee7, 0x76ef5a72, 0x863bb1c5, 0x3913f81d, 0x83c536af, 0x22c649f6,
+       0xc4497e9f, 0x87fca4fc, 0xff453bfe, 0x1f9e9c25, 0xc5e7a7ed, 0x2fc23fc8,
+       0xdf40dcc4, 0x5fce0763, 0x08ce36c1, 0x2582f5fd, 0x7091f380, 0x2ff4b6fb,
+       0xb8ba87ed, 0xda912a7a, 0x260f1c65, 0x219ea0ba, 0xb9f9c5c5, 0x6bc4e3e3,
+       0xe9755f51, 0xebe2e299, 0x2651b946, 0xe7bfa4e5, 0x764a8548, 0xbb2e584c,
+       0x72919ec8, 0x87366833, 0xbdbfdfeb, 0x9446c667, 0x2fbe26ab, 0x1483d34f,
+       0xe3cf0a2f, 0x2fae14e5, 0x2798f827, 0x24781d96, 0x08e52ed9, 0x75e1e3ad,
+       0x5863ec95, 0xd7e85d9f, 0xf93f2109, 0x664c9eb3, 0xf0e13ec2, 0xb67bfa90,
+       0xdcaff429, 0x47a5a64f, 0xa53b0659, 0xee105741, 0x89cfbf1f, 0x8263fba0,
+       0xf3f1a20e, 0xc013e55d, 0x48708fc1, 0xc872e14d, 0xed056509, 0x17f4150b,
+       0xb55cffc0, 0x3f35bdcd, 0x2e36de62, 0x1d7a9d8f, 0xe0576397, 0xfe54b48b,
+       0x3b25efbd, 0x1e1873f1, 0x2ff98edc, 0x1d76f701, 0xc17dc1ab, 0x09f01d21,
+       0xaf8da2d2, 0x598bfcf3, 0x29e7efd4, 0xeffeb93a, 0x1bb72e45, 0xd7ce3c61,
+       0xbfd63f64, 0x3b5da83c, 0xdcdfde7f, 0x658f4e54, 0x68853dc7, 0xdaf30cc7,
+       0x285fb8dc, 0xc07399eb, 0xdde1e500, 0x4b6b038a, 0xc1de1f3a, 0x4ba814f9,
+       0x67ade5c0, 0xa5b5fb22, 0xbefa3a72, 0x38fc31d6, 0xcbc457a7, 0xcd3e08e2,
+       0x7871b54d, 0x084cfac1, 0x472b554f, 0x9bfbf3e5, 0x0180f787, 0xf0075bd6,
+       0xe12db140, 0x64b1d9d6, 0xf8f90583, 0x1f237338, 0xa258ef9f, 0xdd788b1b,
+       0xebbec8c9, 0xf00f0f97, 0x147b4875, 0xe903b2e8, 0x5cd4eaf2, 0x71d86f1a,
+       0x7c0c758f, 0x1376861f, 0xec3b95fa, 0x4c57dc01, 0x4dcdf54e, 0xedce7845,
+       0x4a2064ab, 0xeb4dac1a, 0xfbef112d, 0x7d4177eb, 0x7e9f63a2, 0x36f3ce2c,
+       0xc2bab6c6, 0xfaa981eb, 0x6f5a1fd1, 0xa02d3e04, 0xd6e11072, 0xfbf5e469,
+       0xcf8a3316, 0x8cfbe834, 0xf7f41df8, 0xa3cfa22c, 0x2fc414ba, 0x6ed09bee,
+       0x737bd3ae, 0x67d7dc14, 0x07a8dc98, 0xf4421f60, 0x54c2c87e, 0x26fff40b,
+       0x574e513c, 0x8fd8efe9, 0x502aaaf0, 0xae242ddc, 0x60dc85da, 0xcd37dc41,
+       0x7a25629e, 0x39dd5f64, 0xbff51ab4, 0xfa09e395, 0xcc7e8b31, 0xff30a2e6,
+       0x2aef3afd, 0xfd48ffda, 0xa8514876, 0x8dd7439f, 0xb112ddde, 0x50fec22f,
+       0xaa521ffe, 0xfa40ee73, 0xb23afb17, 0x7ac2d30f, 0x2295ed17, 0xfdde245b,
+       0x3ca17e62, 0x7b48a3a4, 0x7ed3ed14, 0xb1dfd67b, 0xd9c83a65, 0x823a33f1,
+       0xd152073a, 0x01ff33f3, 0xf60551d6, 0x70e005ac, 0x33972a5b, 0xfafdf287,
+       0x30df9c44, 0x3abc3f58, 0xd31be09c, 0x938f0b64, 0xe90ffc2e, 0x482fee46,
+       0xbfcfe04f, 0xe73b72a7, 0x1e5c6927, 0x978d21fe, 0xfb6313d3, 0xf510be2b,
+       0x1f971354, 0xfcb9cb5b, 0x41b7ae8f, 0xedadfbf4, 0x668a31de, 0xef760f7f,
+       0xf76e5486, 0x885fb91a, 0x0a9613c7, 0x873b06fa, 0xabb614f0, 0xda503c78,
+       0xccf45fa1, 0xf372f2a3, 0xbfe8d97b, 0xe69fedbf, 0xb6f487dd, 0xf27a37f2,
+       0xf1149c57, 0xbec99582, 0xbfdc64f4, 0xabf6c427, 0x75d6273c, 0x1f9199ba,
+       0x1b8c53f8, 0x893dec82, 0xaf284371, 0x34e0f9da, 0x2cd5bfe4, 0xe5e0fe40,
+       0x5c51373b, 0x61407970, 0x69f7052e, 0x1627ee5e, 0x47bd58f8, 0xdf4bf1af,
+       0x931936ae, 0x77e984c7, 0x6e369b45, 0x58abb358, 0xf6f6fe53, 0x440b2569,
+       0xfcb0a1c8, 0xa3ef4699, 0x1ef495fb, 0xd47ea76d, 0xc3f8d2ec, 0x461cee97,
+       0x97f597eb, 0x77ad3731, 0x66816b59, 0xf395acde, 0x49f9bc49, 0xd4bb45ba,
+       0x469e731f, 0x008ffbcd, 0xff08fefe, 0x4353d2ff, 0xa92d1e69, 0xba40ffbe,
+       0xcac3cf09, 0xdabf1afc, 0xb027c724, 0x7ee16656, 0xff23a049, 0x5081ece5,
+       0x6fffa72a, 0x71d1f70f, 0xfee305f6, 0xca0beebf, 0xcc397126, 0x0c3614da,
+       0x6aa7e31e, 0xa0bfb4ed, 0xa7c52bbe, 0x616beb95, 0xa45f2d47, 0xd45177ad,
+       0x5dea28bb, 0x6912bfc9, 0x2805299f, 0x0d7f78d7, 0xcff38f82, 0xa0ba351c,
+       0x6e34f8de, 0x3d3916c7, 0x6cef5097, 0x438e24b3, 0x4b36ca7f, 0x52f5005e,
+       0x38bafaff, 0x48336d1d, 0x033b8a3f, 0x5ffed6e1, 0x88a8b677, 0x0fb07dc7,
+       0xfe587900, 0x8a1641e8, 0xae375390, 0x01cb3c53, 0xef2176de, 0x7d7cdcea,
+       0x71a0ee75, 0x5d93f428, 0xd395e7c7, 0x23515fb1, 0x08d4e5da, 0x419a5f7f,
+       0xc1cccfb3, 0x8d254e32, 0x9a9ce3cb, 0xea1432a0, 0xa3daef65, 0x875fd8a8,
+       0xbb337a42, 0x41130009, 0xdc25d957, 0xa4b1b9be, 0x2636595d, 0x5d56870c,
+       0xe00718f5, 0xeadd35a7, 0x8f737d46, 0x0d2437d3, 0x182279e7, 0xf8fcedc4,
+       0xda2a3d13, 0x7a753fef, 0x619cd20a, 0x8ef4b838, 0xd6a7d46c, 0x6d9e7c13,
+       0xae63fbfd, 0x4da22867, 0xdcddabfe, 0x23b3d19e, 0xa487db8c, 0x8c37d2af,
+       0xe727bd24, 0xf4229e97, 0x3df33a45, 0xadfaa367, 0x68c9f08c, 0x861be93d,
+       0x2cf6e6ef, 0x815577c7, 0xafbe0f77, 0xa8aab8ca, 0x6c17de05, 0xa14baa0b,
+       0x62bbcbdd, 0x85cb83fb, 0x4c75813e, 0x75c9f5c2, 0xc82e495c, 0x7e38867a,
+       0xd60fc90a, 0x1ff7b119, 0x2f7d2230, 0x216d347f, 0xa36eb7ce, 0x30949991,
+       0xf4ea7ffc, 0x64f9c6ce, 0x082bb477, 0x93dfe91b, 0x1dff4ae3, 0xfcfe477e,
+       0x96f928c8, 0xfe5c5fd3, 0x2cf7a75f, 0x1b67948f, 0x6927848d, 0xc7e7873f,
+       0x69d5fded, 0xeabecf5c, 0xf9c12ef4, 0x276d7434, 0x3daacf7f, 0xf9631a1f,
+       0xe2f9a3ab, 0x6a54704a, 0x6ea0bef8, 0xeb8039be, 0x25547f2f, 0x68dda83a,
+       0xdd5938a4, 0x9fb8fb33, 0x46e61ee7, 0xb1d75139, 0xe30e594f, 0x4fb33ed6,
+       0xd7011159, 0x05017541, 0x2ec233e7, 0xafcb90f9, 0x3f47ba68, 0x872dda32,
+       0x9c4e5c2d, 0x15f9b72d, 0x8359eb80, 0x9deb0eaf, 0xfdbab2cd, 0xbc3c61f9,
+       0x11fa6fb9, 0x3fb037cc, 0xb3e20a67, 0xd33bb755, 0x475af50c, 0x5f48dd19,
+       0x36fa753f, 0x54525c23, 0x4fb6276f, 0xd7bbb34e, 0x89975b43, 0xfbbca115,
+       0x1f1870ba, 0xefe32745, 0x85d3fce1, 0x91db8872, 0x813fc845, 0xa7b4bb34,
+       0x361dae48, 0xc73c75f0, 0x9eff7cf8, 0xe89079ea, 0x8d0a48f8, 0x54175d9b,
+       0x7f9d9fd0, 0x6b9239e6, 0x9d30ffb2, 0xe4891e79, 0xb3cf2bdf, 0x56f488c3,
+       0xf950e42b, 0x8f947ba3, 0x4bfde623, 0x6e91f430, 0xba019fb2, 0xfdf7d1b4,
+       0x3ea8d333, 0xbdf0b933, 0xe16aed42, 0x79088afb, 0x4311d723, 0xf5c3ecee,
+       0x1cf44ed8, 0xc82772e4, 0xbe628dfd, 0x157cf8d1, 0x9a7c1fe5, 0xde99ea06,
+       0x3123fd1b, 0x48787a2e, 0xe527f502, 0xbedf3440, 0xe51ce82a, 0xfe46cea5,
+       0xe52bb25a, 0x22bd64fc, 0x34fec567, 0xc10f4382, 0x4a977ea1, 0x7a32a9eb,
+       0xc111de87, 0xfd16bf0f, 0x03f9b81d, 0x07fdca23, 0xa25dfdfe, 0x8536fac7,
+       0xedacf1e2, 0xd43ce35d, 0xf4a7fe47, 0xe2ce6768, 0xf1db0126, 0xa784bbc2,
+       0x2e5c9d59, 0x53ee77d7, 0x74c2d997, 0xc0e67f9a, 0xf56748ad, 0xfb86261d,
+       0xdfbfa022, 0xe9a27c20, 0xca47c254, 0xb4f878dd, 0x9472e0ce, 0x47e48df9,
+       0x3e54fd85, 0xdca429fa, 0x4eaa7bfe, 0xfbf809f8, 0x1cbc690b, 0xa7df1fa6,
+       0xdcb08f08, 0xe45f10b5, 0x603a299f, 0x5bb87dc6, 0x5a7f3f21, 0xe4678725,
+       0xc6c7aabc, 0x54ce9b97, 0x50d437a1, 0x587b1cde, 0x7fcbf7be, 0x810bfed1,
+       0xe41f786f, 0xd410d9ef, 0xd1fe72f3, 0x7277cbf8, 0xce831b7d, 0x11d71bfe,
+       0x3da4dfad, 0xc9e6e920, 0x8f46aa5d, 0xea469dd8, 0x731b0ecf, 0x728ec79c,
+       0x61d8cf1e, 0xc76cfae0, 0xe500737a, 0x780b9bc9, 0xa17d995e, 0x43cf8831,
+       0xf875a5ba, 0x1f3650fd, 0x5ba755bf, 0x0dd6e583, 0x7842d636, 0x4b3a24f5,
+       0x19127e91, 0x1e5c8f97, 0x973cf03e, 0x5b7e7567, 0xeb3fc180, 0x5397737c,
+       0xe2cd39dc, 0xf333b8c6, 0xb3ce341d, 0xd72ba40f, 0x2e8dfb73, 0x83ab3f78,
+       0x03c49ff3, 0x2fa253c8, 0xae120fc9, 0xb8727861, 0xf8927e4b, 0x67f4bbf8,
+       0xa77cbd03, 0xda3daabc, 0x46dbdc78, 0xbe4ed5df, 0x706c3acf, 0xc7869fa1,
+       0x6fd1e217, 0xb3b7baed, 0xb51d824f, 0x7a2df33a, 0xfd85be4a, 0x27bf86ac,
+       0x3817bc09, 0x74afbeb9, 0x2da9ba72, 0xacbe20e9, 0xfc44d93d, 0xe5c19b6c,
+       0x5684ed9a, 0xcff6331e, 0xa8dbbd62, 0x63b5955d, 0x5477e61a, 0x7038ae3d,
+       0x6e4f1fbf, 0xfcf0aede, 0xbd774fb8, 0x72f98891, 0xf2b02bec, 0xe1629e31,
+       0xe4eb9deb, 0x5eece272, 0x7bd13800, 0xf672f193, 0x63fa95fb, 0xc20a63c1,
+       0xfac056b3, 0x139533ec, 0xec7e84ff, 0x61ee49bd, 0x9ecfe4b0, 0x3feee9b9,
+       0xeecfbcc1, 0xf746e299, 0x978b5a65, 0x69cfa7e8, 0x037ee371, 0xf40cf7c4,
+       0x78efae17, 0x685af123, 0xabe9fa77, 0xd76e508b, 0x799e798a, 0xe10ebf5e,
+       0x7fc9e1b2, 0x6bdf8c9b, 0x09aa4a03, 0xf8fbd9c7, 0xbe63677f, 0xf2469eea,
+       0xfd3cb517, 0x17f311ba, 0xfe768174, 0x03926f7e, 0xf9fe9deb, 0xef08c9f6,
+       0xfa168e96, 0xede7e67e, 0xe4f03e54, 0x77f6bdbf, 0x1378e3f4, 0xccef58dd,
+       0x2f09fbf3, 0xf2953e75, 0xf5d1e2db, 0xb9fb7d8e, 0x8f3d44bc, 0xcb9f307c,
+       0x92d74931, 0x793f4f7e, 0xbd48c4db, 0x0ab7df21, 0x026b4e7f, 0x099f23d7,
+       0xe0adadfe, 0x9ecfcef1, 0xfda7ccb5, 0x1c343181, 0x6375c5f7, 0x2ddc5d38,
+       0x71d751e0, 0x46c1a187, 0xdf9fa9ed, 0x73e3df02, 0x27e7d02c, 0x64852923,
+       0xd7ca25cf, 0x0faa57f9, 0xbfa026f5, 0x1f45e6e7, 0xeb1f382a, 0x2d432698,
+       0xfe69f3cd, 0xf91d561d, 0x6c6d6cbd, 0x38bffb3f, 0xe02ec26d, 0x59dd907c,
+       0x3922e39d, 0x8b0f7260, 0x6bb387b0, 0x27182d7c, 0xcfad7ebe, 0xbe3c07ad,
+       0xb4e8ea7c, 0x727e5041, 0xf84c52a4, 0xcf5c2bd7, 0x4e346df9, 0x81c1fa3d,
+       0x3e0b768f, 0xf5307749, 0xdc03921a, 0x32a5501f, 0xaa7e46d5, 0xf513923e,
+       0xee0f42ad, 0x736e7e11, 0x764dde5f, 0x26bb676a, 0xed061f62, 0xf72a366c,
+       0xf310fde5, 0xe7f8674a, 0x1971de93, 0xa467be69, 0xf27e603c, 0x8b7e4a7b,
+       0xbca11bf6, 0x57d1fcc1, 0x285de59d, 0x3d33e51f, 0xefe4bf8e, 0x74b8fbe2,
+       0x15ca174f, 0xa35537b6, 0x95c9e20f, 0xe79f3703, 0x0f95fb7a, 0x901b0e89,
+       0xdf7c710e, 0x5ede8d49, 0xe815c24e, 0x890fa5f0, 0x7177970e, 0x55d0daf9,
+       0xd4fdc46e, 0x69d7e10e, 0x7484f410, 0xbfe8fb84, 0x9c69933a, 0xe1a1c986,
+       0x0bcea728, 0x12ff3bba, 0x3a43b7a7, 0x0e01f91d, 0xdedd1eed, 0x8fd40ca2,
+       0xf0978d4a, 0xe6f800dd, 0xa3daf376, 0xd7d56768, 0x6bf23730, 0x07e0a743,
+       0xbe117bb0, 0xcbd55d0d, 0x6941bfb1, 0x0ddfc933, 0x41b4c976, 0x63a86e50,
+       0xd96fc8a5, 0x425e2abb, 0x7c5d60ba, 0x035d9e3f, 0x4dd22cf6, 0x9f5bbd5a,
+       0xdb8f7a8f, 0x2c8fd7bd, 0x723bf6a3, 0xf2e7145d, 0xf38a3157, 0x19fb40ef,
+       0x68d65df5, 0x36fb3f6e, 0x5cc5dd92, 0x6537e409, 0xd60d753e, 0x622ff06f,
+       0xcd11d794, 0xb4292fc7, 0x5808680f, 0x56681f29, 0x1a7fb717, 0x9f1f38ba,
+       0x4f91f093, 0xe4adcf43, 0xc4c17f8f, 0xd0fe11fc, 0xce9a5f37, 0x268becf5,
+       0x359fb3d2, 0xb0c7d87b, 0xbc85b7a0, 0x6dac7097, 0xdd21d7cb, 0x09937632,
+       0xcc4cb1e7, 0xf5c0cda3, 0x03d0b246, 0x3cf8db05, 0x77e174d4, 0xa789d74c,
+       0xe2e79b51, 0xe17f93f0, 0xc88f189c, 0x39e85d22, 0x797eba18, 0xeea4f890,
+       0x9a5fde19, 0x677853c9, 0xfb4abd04, 0x0b1e9a28, 0xbbd9b8c4, 0x4c282a0e,
+       0xd1cd77b2, 0x35f5f9f0, 0xeb08d82c, 0x2e977ebc, 0xd91c6538, 0x9e490b4d,
+       0x58b237af, 0xd2232af9, 0x9556fdb9, 0xbf442dea, 0x36cdd576, 0xb93fa477,
+       0xb3a3c12a, 0x24571da0, 0x12ded8fd, 0x4a9d1b8c, 0x6f11bbb7, 0xd25dd2e3,
+       0x5bd8d30e, 0xdcdff703, 0xcda1bc0e, 0x1ff70e3f, 0xf309f581, 0xda09ae29,
+       0x0edcfc8d, 0xf7fb8f68, 0x9cfed7dd, 0xb85bdfef, 0x070402ff, 0x6f5499c9,
+       0x9d8ffa09, 0x5cb5de05, 0xb1ddd93f, 0x93aaf3d6, 0xcdc0e7af, 0x3ee216b7,
+       0x8dae61b1, 0x5781e1f8, 0xde9ca594, 0xbee21140, 0x83f9c7da, 0xe13c7f01,
+       0x3b247a22, 0x1bc9a1aa, 0x9c8f4d88, 0xaec01a5f, 0xe81b3b42, 0x93b70d71,
+       0x13f38c6d, 0xbfb94ba7, 0x6915b947, 0x8d3e4acf, 0xbf497be6, 0x35ff7cfd,
+       0x81bcfdf9, 0x8079e3f3, 0x3f7bd203, 0xe9ccbf9d, 0xe07aeb7c, 0x15bef847,
+       0x4225b1f8, 0x7fef47fe, 0x1fb89e70, 0x1ef6f290, 0x3a5177a7, 0x6fdda1ca,
+       0xab50c66d, 0x2f0d8f94, 0x397e196f, 0x958ccbbb, 0xf0335fa1, 0x60fd246b,
+       0x445ed68c, 0x09ea3f4f, 0xfed8baeb, 0x6dd2bb8f, 0x3f3fcddf, 0xaee52f30,
+       0x7981d2f4, 0x73a8e929, 0xadbb6f10, 0xa58fb401, 0x3e7a291f, 0x499f044b,
+       0x03fdca7c, 0xfeb021c6, 0x37ef82fd, 0x888f7a89, 0x84bec467, 0xf3a5c1f8,
+       0xf679487d, 0x6c91f471, 0xb5f97df7, 0x2f5238e4, 0x8c8dd346, 0xaa7ae0a3,
+       0xd7afc4c7, 0xcfec5fb6, 0x29f8e8a2, 0x800b5fc1, 0x6dde7037, 0xc417e086,
+       0x19d8778f, 0x99f813e5, 0x71e31527, 0x7ce08daf, 0x386fb234, 0xfa66b7b6,
+       0x92ba44be, 0x8f7c5d7e, 0x115aaa71, 0x6bddacbf, 0x7f9e4408, 0xd18337b9,
+       0xb376bd38, 0x91fc0f5f, 0x87dbe99b, 0xcc15fded, 0xf33d441d, 0x2b8a168f,
+       0x8a5b8181, 0x8591a6f2, 0xefce1112, 0x205efb25, 0x0cf7d5fa, 0x39e3bf47,
+       0xdf0e3425, 0xdafe109f, 0xfb5fc213, 0xcf7bd77e, 0x17ad02be, 0xf16e72bf,
+       0x5ece918f, 0x7d21e4b4, 0xe7f4b09c, 0xdda125bf, 0x92b9817d, 0x690e772e,
+       0x55ef5991, 0x2767fc23, 0x7ffdb1ec, 0x373c0b6f, 0x532b788a, 0xb7c3ed19,
+       0x19f97067, 0xe3c4bf3e, 0xb4ebefad, 0x1cf937fe, 0xdfe1c193, 0x501ce719,
+       0xd7df0661, 0xfce10e74, 0x50aed7d8, 0xdd66afbc, 0x41eb3ffa, 0xb5acd42e,
+       0x9f09e907, 0x71ab8ed1, 0x283a83f8, 0xb970309f, 0xcd737f04, 0x07fd6165,
+       0xc849d4f5, 0xc5077e33, 0xfd0a96bf, 0xcde9acb5, 0xa15fa1bf, 0x49e66546,
+       0xf2c71845, 0x9f041e1e, 0x4f2db53e, 0xf2bff144, 0xa3a67747, 0xd458ca7e,
+       0xa6c1f226, 0x55fed03a, 0x2fe8373c, 0x6f672f59, 0x132764a9, 0x1ede001d,
+       0x22f6f0cc, 0xe24a2f1f, 0x7745c17e, 0x08fe035a, 0xf057b879, 0x7cfd3461,
+       0xcdbce710, 0x01151997, 0xaa616fec, 0xefd46ff7, 0x7234e79d, 0xfa12bced,
+       0x5f4823c5, 0x4fddd877, 0x22f2eef0, 0x05d263f3, 0x0e316bfc, 0xb7b1a204,
+       0xbaf867b0, 0xbee3a47c, 0x5fa1dfbc, 0xf0e4dbab, 0x91bbf0bb, 0xf176cbbe,
+       0xe3f141e2, 0xd2232e40, 0x8545c347, 0xf76961e8, 0xae51c79b, 0xa221a837,
+       0x1b66a593, 0xa2e1b1e1, 0xd5a9e9ca, 0xdb243670, 0xa4d7ee03, 0x6032d27a,
+       0x277bfe9e, 0x093c5325, 0x17c389f8, 0xe39c452a, 0x37c332f8, 0xf7e00328,
+       0x36f13590, 0x305d7fdc, 0x8f3092bb, 0xf408d1ad, 0xe7753570, 0x43d84735,
+       0xa5aec72c, 0xfeb7ee83, 0x6e5af386, 0xaf5119f6, 0xd134f0af, 0x4945b179,
+       0x98c752c1, 0xd24fbc48, 0xf5fd1a5f, 0xc8497ef1, 0x3c8df797, 0x9d20646f,
+       0xcf6c3c73, 0x39b2f510, 0xc79fbcbf, 0xe7c39e6a, 0xbb427828, 0x728887f7,
+       0x170f2891, 0x7979d2f5, 0xf797e09a, 0xd17af1c7, 0xe3152ce3, 0x99e1997c,
+       0x7682708c, 0xc7d22341, 0x673a166b, 0xfe404ac4, 0x935bbca1, 0xc82c764b,
+       0x770869b9, 0x4c982718, 0x67a44cf5, 0x41c81358, 0xa96f67c0, 0xb5b3e08b,
+       0xe305e81c, 0x289aaf41, 0x2bf1241e, 0xcf8d1af1, 0x77ca1985, 0x181f4fcb,
+       0x51985ebf, 0xcd7e303a, 0x17c250d8, 0xf38c4bd1, 0xf5f0f11f, 0x03c73b6b,
+       0x0cf2ebf0, 0xb1c183d2, 0x49b37c91, 0xb5ca51c0, 0x78b413f7, 0xe39d3cfd,
+       0xbbd45ea1, 0xda1f7684, 0xe23eeed1, 0x7853f7bf, 0xae02b4fd, 0xfe5da497,
+       0x5f2e024f, 0x529f6ba6, 0xd1fb44cf, 0xe2f214bf, 0x47ee74cb, 0x8ddebc07,
+       0x09fa95f3, 0x19304ce4, 0xebd178f8, 0x6c339226, 0xd5e51f63, 0x83ffbd40,
+       0xea645af0, 0xf41535bb, 0xdec10fca, 0xbb511631, 0x0647284b, 0x48c7efec,
+       0xd433b0ba, 0x0e19addb, 0xf4941f6e, 0x48d7b8f1, 0x0ca5aebe, 0x657287e4,
+       0x210c63fc, 0x6bf0e40b, 0xc142bf22, 0x6214aebc, 0x07f61767, 0x8c97ff70,
+       0xa3dc30d2, 0xe8213bc7, 0x450cd1e0, 0xb215bc25, 0xaddbc442, 0x5f6e7eef,
+       0x139e5d0c, 0x4d9365e7, 0xe7ec76be, 0x916fddec, 0x18c27e9d, 0x8b66de1c,
+       0x7c18ddf1, 0xfc2521ec, 0xf4a7b6fd, 0x98d5e37e, 0xc1f67e7f, 0x4bdd619b,
+       0x1c6ef47b, 0x5f3de972, 0xed1e33bc, 0xc5031eec, 0x6fdf406b, 0x4dde7153,
+       0xa13caedc, 0x67c1d2d3, 0x3df76977, 0x907a0baf, 0xdca572e7, 0x157cfa91,
+       0x93797373, 0xcb1bb890, 0x3b71dd1f, 0xce5dcb9d, 0x003d87bc, 0x666bd3f7,
+       0x3b7c5d92, 0xcf5e51f3, 0x39ed56b2, 0xda6d15db, 0x073bedf2, 0x3925c39c,
+       0xfd102abc, 0x2ba5f85e, 0xf3fbeb63, 0x333f2e82, 0x7afdf88a, 0xfdf8cc53,
+       0x09fc85ef, 0xb4fbd9c7, 0x2f57fbf1, 0x8c6fbf1f, 0xed87df8a, 0x3df8e888,
+       0x6113f7ef, 0x91bf606f, 0x2acffc71, 0xa3e3af62, 0x58b7690c, 0x9f19f935,
+       0x125bb00c, 0x45e37be9, 0xd8f99c4b, 0x2b67fde8, 0xd7d38f63, 0x5f368e3f,
+       0xe79edc20, 0xb5fdc809, 0x8bc693a4, 0x6567a459, 0xe1c7da59, 0x3df43976,
+       0xf4babcfa, 0xf8be4b6f, 0x2ce66158, 0x176d47f2, 0xf29bbc76, 0xbb463f33,
+       0xba72f908, 0x4c10b5eb, 0x278fd971, 0x8487570e, 0x1d7a26f9, 0x42675f40,
+       0x98d8f211, 0xfd234f69, 0x3a6e66eb, 0xfee82797, 0xe8abbbd6, 0xbdffcf7c,
+       0x322332a7, 0x53f72a6e, 0x8f69460d, 0x96fa34d9, 0x65e3e945, 0x1d916f5d,
+       0x70d7f606, 0x7a7f3e14, 0xc3d26ef5, 0x1d37992b, 0xd5f7bde9, 0xe56e7411,
+       0x3961eadb, 0x4bfc9b9f, 0x35bf3c0c, 0x3987ec8d, 0x75373e62, 0x67503b73,
+       0x1c6818f6, 0xd239730f, 0xe7cd8b69, 0x8554420b, 0xf3fd75f2, 0x631de747,
+       0x15fcc493, 0xbdf00f6c, 0x52d93c4e, 0xdbce265f, 0x31eae384, 0x8990260d,
+       0x6e8996cf, 0x28a73e17, 0x83cf955e, 0x6b1a79e3, 0x3afac1ca, 0xd7cf4873,
+       0xc7483309, 0xa2f0fdf6, 0x37945db2, 0xeb70bdce, 0xb36f7c0a, 0x8a313c93,
+       0x04cf4c79, 0x6dfc88b9, 0xb75c6666, 0x4d3c16c9, 0xf4f133f1, 0x8f88b857,
+       0xf91843fd, 0x07581241, 0xd9b53f9d, 0xb171f9ce, 0xb050e60e, 0x085c716c,
+       0x9ce27ee2, 0xf3c7e6c3, 0x672f20c4, 0x5f3fa265, 0xc44ad5f9, 0xee67c80b,
+       0x5df78a17, 0x11f3f20d, 0x88a5de42, 0x7908b5f9, 0x8adcc597, 0xe480c7b8,
+       0x95f6fddd, 0x267ee037, 0xa3f7798d, 0x71387bbc, 0x32fdc506, 0x93e68f98,
+       0xc8d5433a, 0x5b57a72d, 0x46af98ce, 0xe7053bcb, 0xbed3e597, 0x9413b337,
+       0xbd04a497, 0x69529799, 0xfd12361f, 0x37210631, 0x3e78598e, 0xcf3166c2,
+       0x8853333b, 0x78598e6e, 0xb6b7c25e, 0x7ddadc5b, 0x3f0a437d, 0xdd3e7fbf,
+       0xc0f1c66c, 0xe113b98e, 0x07cc7607, 0xdfce167e, 0x41d29c2c, 0x6f9b0279,
+       0xe01bdc54, 0x6bbb66fd, 0xeba40abd, 0x7f70a99f, 0xc728ea8f, 0x3cf69c7c,
+       0x44f31b87, 0xf7be451b, 0xf6a38b66, 0x9a63f219, 0xb7d63d78, 0xed96e319,
+       0xac0e1d5b, 0x37d95697, 0xaafb88cd, 0x9bb1cc15, 0xaff7a0c5, 0xbe608f80,
+       0xe032c73f, 0x63f41149, 0x85bae23d, 0xefbe20d6, 0xf0177fc1, 0xdc3294f2,
+       0x82bff2bf, 0x773a42ee, 0xd27a3cc9, 0x85dd8d97, 0xbc60d86f, 0xe485b982,
+       0xf256f7af, 0x72132fb8, 0x571cbc60, 0x61b5d9f0, 0x85efa7ba, 0x5bb43ca2,
+       0x4cd37ff8, 0x80ebae3c, 0x91c4ca21, 0xc69fac43, 0xe4cdc1f9, 0x6bd3e71f,
+       0xfb0ff858, 0x4ff70cab, 0xf86a6972, 0x60ef9873, 0xbbb322a8, 0x8dea0ea5,
+       0x91fb8357, 0xcf15afaf, 0x543cf142, 0xe5e9237e, 0x65cd9d1e, 0x373e71d4,
+       0xc3aba017, 0x94b847ab, 0x60b4b639, 0x4129d73f, 0xd8cde67a, 0x9fd382de,
+       0xc94cfc23, 0x9e00c699, 0x00996b37, 0xc8bf2678, 0xffa30f9f, 0xac2fff5a,
+       0xcc74f118, 0x279ef520, 0xb9ffe789, 0x0ed53d68, 0xce97593e, 0xc22e7b33,
+       0xcf3f28f9, 0x8b74d0c6, 0xa997fef8, 0xd7974955, 0x300f3cbb, 0xe5cf4b25,
+       0x871e0ce3, 0xa66f9c6d, 0x7146e5bc, 0x7d53030f, 0xf08c3ff9, 0xc5b8c8af,
+       0x7f3606bb, 0x46fd8c5f, 0x07b7164a, 0xfdc0dce6, 0x1f228dc2, 0xcc4f7e47,
+       0xbfb27ee2, 0x377b4e64, 0x1e3dec93, 0x949dfd6f, 0x48d9235f, 0xf2115f94,
+       0x5f248fe5, 0x278edfca, 0x85dfb47f, 0x29e799fc, 0x40bed036, 0xef2921c8,
+       0x68ef22bd, 0x1018f301, 0x1ee23d4f, 0xabe5a395, 0xccdd0e48, 0xf7fef47c,
+       0x00ff3c15, 0xfd80d308, 0x6b4334dd, 0x6af3cd3f, 0x8fcf37cb, 0x3e38afb6,
+       0x7c0bb8e4, 0xa473efda, 0x6b433c9d, 0x87fa2f27, 0xcf4992af, 0xfea2fc67,
+       0x3e70e0d2, 0x3e546351, 0x27c88351, 0x3c2aec6a, 0x4f911694, 0xf3cdd8d4,
+       0xaeba1a89, 0xedc44f94, 0xb029af29, 0xde24e31f, 0xec94d25a, 0x727f910d,
+       0x8a4ff310, 0xaf6e74c2, 0x0c3cf3b0, 0xa2bca1e6, 0xce95871c, 0x8aeab45d,
+       0x9adb8fc8, 0xddf8d768, 0x5577aeb7, 0xbfe93d61, 0x4843f995, 0xc3f6b137,
+       0x5f7c59d9, 0x7ee143b3, 0x3302ff74, 0x059d3bed, 0xc15c4d5e, 0xd1c767a9,
+       0xa66ef8af, 0x3f27d64b, 0x2f830ec9, 0x019e18ab, 0x8979d185, 0xb67af6fe,
+       0x5190fc91, 0xea99ca72, 0x338038a6, 0xf5f92c69, 0x921775e7, 0x2cd9923f,
+       0xb84a61ee, 0xdb7379ff, 0x69ebcc55, 0x97576eec, 0x3774c2db, 0x43ec4b36,
+       0xf48accac, 0x7bd7efda, 0xbd7e44ce, 0x30b79364, 0x19d7da0b, 0x8bbfe483,
+       0x1f7a57a0, 0x2ede5f4f, 0xe150c5e8, 0xe602b05d, 0xd18efbd7, 0x0a6bfb8d,
+       0xcfff41cc, 0x7e4c94bf, 0x230e7549, 0x9cb1b53d, 0xf45e93cb, 0x3e3ac193,
+       0xfaf7e64d, 0xa466ac6c, 0x4ca7cf5f, 0xc55e3a23, 0xe83d8702, 0x7405db47,
+       0xd2cf7918, 0x8eb96d1e, 0xa9fe9075, 0x3d00667b, 0xf2947c93, 0xf4b99eb8,
+       0x741b8c06, 0xa1b3db6a, 0x285c395a, 0xbcf147f4, 0xff982da9, 0xf2e3ac50,
+       0x0f772d91, 0xf5fb439a, 0x2c4f8e45, 0xa17f7228, 0xebaece5c, 0x73d29fb5,
+       0xa17ae7fe, 0xad1ff454, 0x3d854abf, 0x17e41937, 0x7da56fee, 0x7ca9f506,
+       0xcfadd750, 0x59e785d4, 0xbb49da22, 0x890bea50, 0x8c09f2af, 0xbbb579e1,
+       0x1a7c84b2, 0xbe2086c2, 0x13e27fa1, 0x29583705, 0xf71fbfd4, 0xf18ad785,
+       0xa8fc1e80, 0x733afdbf, 0xb36be900, 0xd2fa44d2, 0x3c3ff68c, 0xd23e2ab7,
+       0xe35eff0b, 0x4c7d23d7, 0xdd374d64, 0x9926f500, 0xb728ac7b, 0x31fe4e80,
+       0x585a7e92, 0xa29f6f30, 0x7efa23a1, 0x98edf936, 0x5af52474, 0x9edcf7f0,
+       0x74bcc599, 0x0fe793cf, 0xa83aeedc, 0xd8267df0, 0xeed1079f, 0x93375b7a,
+       0x2c2664e8, 0x3955eb03, 0x9e9ff8b4, 0xdf472da9, 0x5ad0c50f, 0x48744328,
+       0x9c540678, 0x51bdf44f, 0x98f7291e, 0xb3e5ee56, 0xf8de78af, 0x423fc396,
+       0x1d7583ff, 0x0ef6891b, 0x8fc4aa58, 0x27b0f4d1, 0xb78f7beb, 0x118ac9ec,
+       0x7e15e96f, 0x68586be5, 0x40ca33e5, 0x687f3b7a, 0x82333e9d, 0xbc7f252e,
+       0x1379e06c, 0xae3cebca, 0xc6ccc135, 0x252e1104, 0xf928ffdc, 0xd3a41ae3,
+       0x95fd3094, 0xa487f789, 0x06cc197c, 0xd75dbd23, 0x01ea0965, 0xbfa2853f,
+       0x8afe906b, 0xdc89f6c2, 0x184cb477, 0x98f96740, 0x4cf60e17, 0xb495d201,
+       0x8e958a4f, 0xfde73c16, 0xb6f74bfc, 0xe8237ce0, 0xc3842dea, 0x8ae80559,
+       0xf4036afc, 0x147bf6ad, 0x4bfc49dd, 0x359cba7b, 0x6e677ed1, 0xc1b3d702,
+       0xcf49dbea, 0xba24b882, 0xa70e737b, 0x21e62abb, 0x5a672bba, 0x6b34a97a,
+       0x0974d1cb, 0x74b4ea23, 0x8bba23e7, 0x7478d7a6, 0x4ee91837, 0x2bd4dbea,
+       0x48e7ddd3, 0x8fc5df77, 0x3eee9039, 0xa7c672cf, 0x937a68bb, 0xc59f6cf2,
+       0x75768951, 0xfa428d63, 0xa19df8a1, 0x511e582d, 0xf6764f9f, 0xd93764be,
+       0xfc4d8ddd, 0x478f497b, 0x0533798f, 0x7cf7c56b, 0x1b96256f, 0xe877c1d7,
+       0xcf18f4ba, 0x0f7a19ab, 0xa1b85eff, 0xbfbc0de9, 0xdbcfd1a0, 0x337a7cbf,
+       0x6c0a879d, 0xdbcbed16, 0xd8dcb12a, 0x8a7fdbca, 0x31abae71, 0x82d02dbf,
+       0x96daafef, 0x6fdbe6ef, 0x114fd76e, 0x3ca7ddeb, 0x6bb506f7, 0x3f6eede3,
+       0xe4604e6c, 0xfaf6e027, 0x29ceb164, 0xd33af8bb, 0x867ebe3e, 0x4563e80b,
+       0xb9ec9f9f, 0x6575744f, 0xece2ef24, 0xb695cbb3, 0x474e7c1c, 0xbc47a639,
+       0x43f55bbb, 0x37741c78, 0x3675710c, 0xf8c8d3f7, 0x5429e621, 0x5717d847,
+       0x443b7367, 0x614f4bd6, 0xfd8d7e74, 0x72fe4ecc, 0x3e0cdf19, 0x07d414c4,
+       0x976146b8, 0x4e778cc4, 0xbb22682f, 0x1960fa62, 0x4ba90ce7, 0x4bc2dc61,
+       0xe58b4f9f, 0xe6cb2a47, 0x9129f3f6, 0xd7df2177, 0x4875f204, 0x4890fb17,
+       0x90f0fce8, 0xdb9ed077, 0xe734cc97, 0xf3e5f6dc, 0xbcecd4f2, 0x01cd6e7f,
+       0x549aeaf8, 0xe58bf7bc, 0xf2b79429, 0x4c161e83, 0xff381c4a, 0x1a0b2ae9,
+       0xcf8a0f29, 0x518b657f, 0xe5c257dc, 0x3f813cda, 0xd1186936, 0xa7815cef,
+       0x17a16cea, 0xca31598b, 0x6f0279a9, 0x1937343f, 0x336ebeb8, 0x798fc944,
+       0x1e3f28d9, 0x6bcf6b8e, 0x97c947bf, 0x4aee311a, 0x62afc761, 0xfd3fe47d,
+       0xa7f1d844, 0xfc76e61e, 0xfe41d66a, 0x719fded3, 0x961ebe3b, 0xed12f487,
+       0xabddad07, 0x6877d72d, 0xdea00dcb, 0xaec6ffb1, 0x8633b928, 0x1f7ba5fb,
+       0x3f432fae, 0x77cecd64, 0x235dffc8, 0x2b404ce5, 0xe740c067, 0x51a1e672,
+       0xd6fabfe4, 0xd819e3f2, 0xf26995d5, 0x76c9ef4b, 0x5e77f846, 0x0d2e79e4,
+       0x7a11fb8c, 0xc16f23ed, 0xd28b2c7d, 0xa572d14f, 0xe915c850, 0x5bf290ff,
+       0xc6429bca, 0x77ec14f5, 0x9b60f1df, 0xe1ef3b28, 0xc4afa16c, 0x4dfa4dfe,
+       0x88547da4, 0xd7d211f6, 0xba2226a8, 0xbf727eb0, 0xe847d26d, 0x662505a5,
+       0x19917bc4, 0xa6e11bf8, 0xd9f58db7, 0x68f1f434, 0x83f7e5f6, 0xf451efda,
+       0x0b63f723, 0x84dcfd05, 0xff181891, 0xb81f720f, 0x5ccfd38a, 0xf4843de6,
+       0x9cd5fbf3, 0xf0bee47e, 0x3d03ef9b, 0xa07dc8fa, 0xdd7e4fdc, 0xdd3f60fd,
+       0x863ec058, 0xe95cb1e7, 0xfdf1e017, 0x45d38546, 0x3ddf9cfd, 0xf2c2c556,
+       0x733368e2, 0xb97086ab, 0x8cc9a665, 0x0316977e, 0x99cd2fdf, 0xd2d97ef5,
+       0xb413f908, 0xb8401f97, 0xf9276eb1, 0xdaadeb77, 0x3d2b3671, 0xf711fd77,
+       0xc95a8f55, 0x08e174af, 0xc2e59323, 0x0f9411ae, 0xc78199fe, 0x6e7ce55b,
+       0xb5f7bc3f, 0xb95bd410, 0xcc6296ee, 0x0255a82f, 0xb7c1d62f, 0x77beac0f,
+       0x756bbf91, 0x672f7141, 0xe427c50f, 0xbafdf1b8, 0xc6c7927e, 0xf73f5c03,
+       0xdf940929, 0x4787ef0b, 0x38fee9c6, 0xdcefcb88, 0xb807df4c, 0x5b47a91e,
+       0xf827f3fa, 0x1b30b413, 0xa7ce1294, 0x704de708, 0x985fcb7f, 0x13798ae7,
+       0x04e2231b, 0xbe663ed0, 0xcf2179db, 0x01726147, 0xba6567cc, 0x7fd717a7,
+       0x4f85c44a, 0xa9e23889, 0xfc571e44, 0xfe7d7f7b, 0x7ae20db4, 0x3b8894e8,
+       0xc6d14a9e, 0x44bd649b, 0x6cd93cf1, 0x60346ef6, 0x37799ebc, 0x3d70fe82,
+       0x7ca26a64, 0x5f1c4595, 0x6b252fbd, 0x1ac811ee, 0x106a3e54, 0xd399fbb4,
+       0xe3041fab, 0x9ed36f2c, 0xf715ea83, 0xba0af6db, 0xa7f0b5e9, 0x506b371c,
+       0xd76c28f5, 0xb3df80bb, 0x289e5fda, 0xbfea5ecb, 0xc910baf7, 0x8ff2fea3,
+       0x3a9ce242, 0xf8c893f7, 0x61f8bc40, 0xfa30bc74, 0xbc74699c, 0x37e4b17f,
+       0x245fef11, 0x6ee2d4e4, 0xd5b86f1e, 0x820f36cc, 0x6775b7ef, 0x26b8fc50,
+       0x135c3fd1, 0xbf5bf7ef, 0xa4879e51, 0x9edcdecf, 0xcff8f8fe, 0xf5e3e222,
+       0x2f5a3e22, 0x5da9d7d7, 0xcf0164df, 0x3e3e31ef, 0x60739079, 0x9f3a3c7c,
+       0x33b445e2, 0xac3c610c, 0x55b87071, 0xd12aebe9, 0x39617c4f, 0x35f73ca3,
+       0x416b2d6f, 0x2d9af23f, 0x615596e2, 0x380bd777, 0xd3975bc7, 0x8d2e63ab,
+       0xb9813ebf, 0xe593d622, 0xc994d14b, 0x33c88f92, 0xad93541d, 0x34db9f69,
+       0xf07f5344, 0xef9a51ba, 0x4d22fef9, 0x1af5a0b9, 0x6d61fd4d, 0x88f29a15,
+       0xea6bd79d, 0x4921b217, 0xa23b6fe4, 0xbb125f47, 0xf347302a, 0x85def47d,
+       0xb29ff69a, 0xa0931da6, 0x7b45a75e, 0x7bf3332f, 0x8594c67a, 0x76c7a9f3,
+       0xc3f4d52c, 0x29504a82, 0xf633df0b, 0x79a7b899, 0x878f0f79, 0x5ab5dd5c,
+       0xbead4e33, 0x1d18f08e, 0x7d622def, 0x086e37e4, 0x1b20ee28, 0xd55dff18,
+       0xaeed4ed5, 0x78c8f764, 0x2241c6c8, 0xb2cd97de, 0xd3475d39, 0xc3ec8d85,
+       0xe4f4bb0b, 0xc3642c7f, 0xf0449a1f, 0x6b80b032, 0x302efe20, 0xf0bb17ee,
+       0x798ddd8c, 0xb5bfb745, 0xca63e68c, 0xde05d2d4, 0x5eb9181f, 0x5d2d48eb,
+       0x3a5addd8, 0xa5a09a48, 0x27786883, 0xc174b47b, 0xcbbff042, 0x86753bc0,
+       0xb7fe6e96, 0xf081dce0, 0x5be186b5, 0x62d3d07c, 0xbcf1b823, 0x999f6935,
+       0x1d143d84, 0x4e7690d7, 0xbbb09070, 0x2e323f45, 0x93f159b1, 0x771fd55d,
+       0x0bcc109c, 0xd53da3e6, 0xc95fb8c4, 0x6fe5107b, 0xbd24bf0c, 0x9497e78f,
+       0xc09b9d70, 0xf32d67f5, 0x663efc92, 0x93a4fee1, 0x9fc8abd5, 0x913592b4,
+       0x9cd9fddd, 0xe8efc2e9, 0xca577aa7, 0x9f901853, 0x8b29f600, 0x06aed7f0,
+       0x1fef1a8b, 0xd2a7868a, 0x78ed04ad, 0x4b75986e, 0xfca3e07d, 0xedde0f15,
+       0x68ff89a9, 0x51e65fed, 0xb497e522, 0x1278e587, 0xc9ae529e, 0x49ac4c71,
+       0x117c899f, 0xc8d8e725, 0xd693f8e8, 0x41fd239f, 0xe3238e32, 0x9bfed14c,
+       0x55b8bb08, 0xc1d2718f, 0xce782df9, 0x21e1d8b7, 0xeb29613f, 0x4fdf05b9,
+       0xa8b47730, 0xb8bfe12e, 0x2ffbf58a, 0x2babeae2, 0xf26fb5c4, 0xf247a12b,
+       0x65b3c607, 0xff961c7c, 0xf1a11ff1, 0x8b95c524, 0xf2f398f3, 0xd3d22708,
+       0xfba6bf40, 0x8fd02bf8, 0x8a97d75e, 0x3130aaf5, 0xfdde223d, 0xf5a212a6,
+       0x367990fc, 0x6fdb9e45, 0x6ed31d60, 0xe8327f21, 0xa727bc49, 0x58bbfb93,
+       0xac3db457, 0x0759bf92, 0xafba412b, 0xde711165, 0x2a77f0fc, 0x659607eb,
+       0xec95d21e, 0x82f1a789, 0xe0a3ca72, 0xc84c53f9, 0x8cffb941, 0xf993cfb7,
+       0x4f7ef218, 0x94547799, 0x1c75f823, 0x03fd871b, 0x94e595bf, 0xf8017fa2,
+       0xc7e48953, 0xfa253cfe, 0xa31f803e, 0x31f32fd6, 0xf212f6f4, 0x5c8b2d1b,
+       0x8780d7ef, 0x9c7e5bb4, 0xc8e9e8c3, 0x3eb3d171, 0x3d6fc4e1, 0x47a4b9f8,
+       0x68da3f93, 0xfa0d0d84, 0x79145e13, 0xbb5a1d81, 0x9d1c96fd, 0xf7df1b80,
+       0xf15e095c, 0xf8f221f1, 0xaebe3e04, 0xf8f3261d, 0x0c971c24, 0x0d0afb84,
+       0x8ff7fb5c, 0x115f70fd, 0x2e12ee0b, 0x7e7b4ae7, 0xdbd2f881, 0xbc23a58f,
+       0x577aa617, 0xe3dcfd63, 0x5d144fa1, 0xfa555e78, 0x7b8794b3, 0xe74f4ba1,
+       0xe3ae1aff, 0x25e1b072, 0xf386893d, 0xb38a26dd, 0x41bd74d6, 0x66d9e176,
+       0xfc06b410, 0x72180cbd, 0x08fc65d8, 0xb78ef051, 0xd9eb924f, 0xe5f62390,
+       0xef32fd62, 0x39b9d607, 0x475e6627, 0xdfb41c3f, 0xf4aa1c05, 0x1cf09263,
+       0x92be7f59, 0x791797da, 0x3af45f5f, 0xfe78722a, 0xf7b329db, 0xc3efec3e,
+       0xd81d9c9e, 0xfbbe955f, 0x67c23670, 0xbbe742ad, 0x79f898a6, 0x5e712cdc,
+       0xc9a8426f, 0x3399e78d, 0x667df873, 0xf7a47e23, 0xfdf91c62, 0xe0a677b5,
+       0xffd93439, 0xe7474508, 0xee7b1947, 0xc12c7f83, 0x3722e6f8, 0xd8bf6fde,
+       0xba2fee24, 0x002c1acb, 0x91baf239, 0x186547df, 0x66e744d2, 0xe4f592fa,
+       0xb3d34cd7, 0x727748a9, 0xadbcf2de, 0x01f78f7c, 0x7cb15e60, 0xafa5a53f,
+       0x7bfa0d78, 0x75c83d04, 0x2beca94f, 0xe185b26e, 0xa33cf32f, 0xf82553e1,
+       0x1b43ee43, 0xd05b5ef0, 0xbccde7bf, 0x6daf7d1c, 0x5874feff, 0xf6363dff,
+       0x837eb8c8, 0x1e3493c5, 0x6bdc51f9, 0x278717fb, 0xa477df89, 0xbcf6a7bd,
+       0xbf97b7c8, 0xdeef1253, 0x51ccff9b, 0x827b97be, 0xcb85e5e2, 0x7078ffbc,
+       0x99564869, 0x739d357a, 0xdeae5ef7, 0x8fadff2b, 0x28bedfb9, 0xd3dff7be,
+       0xbcec6af9, 0xceb15ec5, 0x88617e70, 0xe7f729ce, 0x7e54be2d, 0x1a477bd9,
+       0x08d23ef0, 0xf6bcc838, 0xb48fbc06, 0xd0bf4638, 0xe576cb9f, 0xc4aa877b,
+       0x8f301abc, 0x3df23530, 0x38f0b7a7, 0x302f2269, 0xfb7c8894, 0x9d3d2ecb,
+       0x11e5ffe3, 0x31dd8cdd, 0xcb9b9de6, 0xa9ca32e1, 0x0e8d1f12, 0xe3b5fbf2,
+       0x79e793d5, 0xe8d8b9e4, 0x845675f9, 0x63f9c56e, 0xf1ac729e, 0x3f7cb91c,
+       0x99dde72b, 0xf0d1f1c2, 0x9bdf899a, 0xf27cf2aa, 0x4ad094ce, 0x168713e2,
+       0x1e04c3cf, 0xe50faf3b, 0x99b2b9d1, 0x8f10efdc, 0xfaa7261e, 0xc8be51ca,
+       0xd4caee7b, 0xc111c526, 0x87a2578f, 0x1af5dc30, 0xbb840ebc, 0x7ecbbe91,
+       0x7c151f4f, 0xdc363ccb, 0xfa112dcf, 0x5a9ec96e, 0x7ee587b2, 0x3d4ef4e9,
+       0x669c6fe5, 0xba72ae3c, 0xd0fda14d, 0xeb631f52, 0x7cad2e40, 0xaa3378a2,
+       0xb09925ae, 0x1efe1496, 0xe9661f7f, 0xbaf8a8c6, 0xbd495fd8, 0xbe5fc72a,
+       0xd7176b4d, 0x467f6db0, 0x51f4e9fb, 0xb0563f2e, 0x2b3fd226, 0x57f6d01f,
+       0xa7d667b3, 0xbce8cf38, 0x8fc21180, 0xec572d37, 0x1958ca57, 0x4f358fea,
+       0x9fc46e7c, 0x17c78960, 0x434ffbf8, 0x7ddff187, 0x8efe27c2, 0xc96f3e08,
+       0x1720fcf5, 0xf2ef3efd, 0xf5ceaef9, 0x7f45c9cd, 0x7e7cbbc9, 0x702eea17,
+       0x8d2bb33d, 0xfd8b5bf4, 0xfaff922e, 0xdffe5cc1, 0x0035f78b, 0x71264c9c,
+       0x49aeba6f, 0x4df6489f, 0x43ece880, 0x7e731de7, 0x26776540, 0xd3da43f2,
+       0xbf6067d3, 0x1eada7ce, 0x72d6df5c, 0x2ffa214f, 0xf3f356b6, 0x8f1366a1,
+       0x397e07df, 0x538600f1, 0xaf6c7686, 0xa39d1740, 0xfd107f7b, 0x3fbaad42,
+       0x98bcc61f, 0x5f3cc9d6, 0xda175d32, 0x3c62283f, 0x899035a7, 0x68e77df1,
+       0x9a4e6f7e, 0xcb90bcbe, 0x36276e7f, 0xe85c5c08, 0x627f202a, 0x17fa41af,
+       0x2e742c3b, 0x2eff8eab, 0xf1c628c6, 0x70eaf32f, 0xf176910e, 0xf9a666d9,
+       0x1d51869d, 0x4890d04a, 0x3c50a8f7, 0x30436ea8, 0x67d416fd, 0x4f14a94f,
+       0x7b4bf393, 0xe302ab3d, 0xdd8f5266, 0xbfb838a2, 0x0bfdd84d, 0x71e3fc98,
+       0x9e82f9b7, 0xff7b0816, 0xf7872b16, 0xc3cee652, 0x2ccd0b76, 0x76ac0751,
+       0x2947654b, 0x90d6b3ad, 0x8c85768c, 0x47b7c51f, 0x1ac9fb62, 0xe7e7617e,
+       0xe1be959e, 0xf419c9d8, 0x3f865d41, 0x693c85db, 0xffcfce18, 0x83cca1b1,
+       0xd786caf1, 0x30efd046, 0x3c781299, 0x1996e41c, 0x843a11ef, 0xbdd61efa,
+       0xc88b15ea, 0x73880a5b, 0xd8defccd, 0x453939c6, 0x78f11e74, 0x71ffdd1f,
+       0x23ca10de, 0x847906fe, 0x92bea637, 0xe01fbbfb, 0xd90debbd, 0xf941d760,
+       0x789fee74, 0x25684879, 0x92991bde, 0x47978977, 0x72c13e85, 0x6cc25e4e,
+       0x5685172a, 0x3e3ca1ea, 0x7197932f, 0x36040a03, 0x6cf06f35, 0xc92dda3f,
+       0x87702ec2, 0xc377bce8, 0x917423cb, 0x1e7758fe, 0x84676797, 0x3e4cf93f,
+       0xc20e6dbb, 0xfaec647b, 0xded27969, 0xc9f5a36e, 0x2cf6caf5, 0xffbb7633,
+       0x957e7210, 0xc53da738, 0x3c2d5aca, 0x044fe7fe, 0x1eec1c3c, 0x7fcbf141,
+       0xfde14dcd, 0x4f74423b, 0xfa27ec8f, 0xb8e41c77, 0x7bfe15ab, 0xf2a3e759,
+       0xcb977ebc, 0xb38c2be5, 0xea19c691, 0xe79be7e1, 0xfe2214e4, 0xc0aa6f00,
+       0xc9f7ca9b, 0xd07e7ced, 0x13fefe2f, 0xf46287e8, 0x0afc1ffb, 0xe787e7ea,
+       0x27274d1d, 0x5aab38c5, 0x2fb6dc78, 0x69e880b9, 0xf7dc558a, 0xc75da252,
+       0x9f6e3cf8, 0xc592f3ba, 0xaf091d79, 0x69c6850c, 0x09cc7011, 0xf6339f0d,
+       0xaffbaf9b, 0x8eeb4bff, 0xef0797c0, 0xc5d8396d, 0x9f1e37ef, 0xf485f1c7,
+       0xe076429c, 0x677f4d76, 0x9fb547d6, 0xae5f28c0, 0xda80a521, 0x6fee2bdf,
+       0x61d9f795, 0xdc71fcbb, 0x57bb45be, 0xfcc1a7de, 0x1c645993, 0x8cdeffb2,
+       0x70bf710e, 0x286f3aff, 0x8874eb11, 0xef223a75, 0xcfe7ec33, 0x73797d63,
+       0xb8e903ed, 0xfdfdfe1f, 0xfd12298d, 0x563cf869, 0xf1d7c87f, 0x1e5572f0,
+       0x1bdf2797, 0xa33ce45e, 0xe70fd9e0, 0x7849f9a8, 0xbb537f22, 0x94ba5a31,
+       0xf411ccf3, 0xf3bf8039, 0xe278e5bf, 0xbbfad97e, 0x7338be79, 0xbebae969,
+       0xf9875f33, 0x07ddb209, 0x34a0c078, 0x21bc27ec, 0x7327ec4f, 0xbc9c4e58,
+       0x339e6f47, 0xde917fa6, 0x7b27ef47, 0xd9efe593, 0xbd1afd69, 0x397bfe4e,
+       0x7efc73fe, 0xfca36b83, 0x7a8f183c, 0x176e16ce, 0xf2da2fd6, 0x037e0263,
+       0x797d54fd, 0x5312bf38, 0x3bf8f3c5, 0x4af3ab5b, 0x7760ab67, 0xdc552494,
+       0xa6e50f99, 0xfc93c6c7, 0xf154192e, 0xf3c83e79, 0xe04d8f35, 0x7c5747df,
+       0x79cb043e, 0x8a797913, 0xf79479e7, 0x9eccb460, 0x2bb6159a, 0xd173ccee,
+       0x1d4afab8, 0x42676bdd, 0x63d60623, 0xf944dd7a, 0xf1ae1280, 0x5d26259e,
+       0xbff3ac53, 0x03d3f4f7, 0xc04cbf8f, 0x1fd0ba7f, 0x2105fc28, 0xe82fe355,
+       0xcfe7e44d, 0x92fd5f7b, 0x9bdcd7ce, 0x079f5be7, 0x67ad1bed, 0xf287cd6f,
+       0x1407eb06, 0x603c53ef, 0xc61fa087, 0x608b60e5, 0xadd9cabe, 0xd89fb45e,
+       0x2559b76a, 0x18ff0ab8, 0xf007a9de, 0xa7b5e57b, 0x0f883c7e, 0x4c79c5e3,
+       0xf1a07214, 0x15fdbfb5, 0x678dc4e3, 0x1b346e6c, 0x7c3f7627, 0x135fda27,
+       0x1bfedfbb, 0x3cfcc3d7, 0x44f79c90, 0xfbc27ff4, 0x9a265d09, 0xabeec4ff,
+       0x6bfd6056, 0x402eebdf, 0x44eeb93a, 0x42c505b0, 0x3effabef, 0x880e7348,
+       0x7cd97a7d, 0x39f1b8d1, 0x013f8f09, 0x1e0893a0, 0xf8f0e73f, 0xced9f28a,
+       0x0e6e8f3b, 0x7b549391, 0x78ec0ade, 0x605f3b8a, 0x7b8c6e09, 0xd1fd73c8,
+       0xd5e3d57e, 0x7f783eb0, 0x20cc1f5d, 0x729e9ec2, 0x24820cd1, 0xc9672e5c,
+       0x39a5729a, 0xcabf534b, 0x3ef9af91, 0xcd2af33d, 0x42ae99f7, 0xc8d6794d,
+       0x37fa9a89, 0xe535cbba, 0x6a6613d9, 0xaa7b57ea, 0x60c2e535, 0xf17ea687,
+       0xf7ed2e91, 0x788f4c63, 0x7eee3a28, 0x27a59f03, 0x2d9ee43d, 0x06f4d53b,
+       0x85fe273e, 0xafda2383, 0x8ec5cd7c, 0xf4bdf037, 0x9f9f472b, 0x9be67e92,
+       0x3180b6f5, 0x53393fb6, 0x83df082d, 0xf3f1d7a0, 0xfb25ef53, 0x937880fe,
+       0xa0a6a7e7, 0x5090195f, 0x9fb9db75, 0x5c32efe2, 0x6efdc458, 0x943111c7,
+       0x7f276e4f, 0xd34371e5, 0x79e47fb3, 0xf728b903, 0xaf9bebae, 0x8b94f759,
+       0xcbbacd3e, 0x3c28aad9, 0x5729a1dd, 0xd4d6ee39, 0x5eb99e9f, 0x6ba67df3,
+       0xb69e144b, 0xba37ca6b, 0x53c28e1f, 0x9e9e147b, 0xf4977cd2, 0x5ffc2ddd,
+       0x0adfa1af, 0x3d42939e, 0xc9878895, 0x1f08faa7, 0x2ada7a13, 0x1cd74f11,
+       0x957c20ef, 0x2895bd04, 0x348ecb2e, 0x20cf81bd, 0xddb0cbec, 0x7a4ce681,
+       0x91766c1e, 0xf370ebff, 0x691e7a48, 0xfffbd376, 0xcf409e68, 0xe87b355f,
+       0x33cd9ff9, 0xecd3d9e8, 0x734767a5, 0xae7fd507, 0xcffb8bb9, 0xddeffb52,
+       0xc1bf45c8, 0x01a85d79, 0xc18ec623, 0x9e9e495b, 0xc79d084f, 0xeb7f06f2,
+       0x3420a9ec, 0x901d67f0, 0x9e207f2f, 0xfb4f2e45, 0x1e0e7860, 0x19fdf8cc,
+       0x43a37f22, 0x3b4429e7, 0x0fe3f47c, 0x32e6a7de, 0x37bd69b6, 0x183a7f13,
+       0x132866cb, 0x90f7e9b2, 0x93cfbc1e, 0xa8b3d8c3, 0xf7bee84a, 0xb9636707,
+       0xe79efc57, 0x241fc7e0, 0xc75bfc3b, 0xe2033dd9, 0xc707a3ec, 0x7b3fb388,
+       0x7f4765ca, 0x46afd1cf, 0x471e11d8, 0xc3cbdf85, 0x3bf80d0a, 0xa16ae51c,
+       0xf1ecf501, 0x5421e738, 0xe0c97953, 0x7bb75c52, 0x5f91e51e, 0xe1dfa06f,
+       0xfdf0a39b, 0xec97acaf, 0xf7a0fae2, 0xa7ed1346, 0x2b3ce98e, 0x957a3f90,
+       0xce10c7be, 0x14fe3d37, 0x7b5ea9e9, 0xafc21e5f, 0xbcbdf1fa, 0x4c7becec,
+       0x0d944771, 0x8f953e1c, 0x6fdb393f, 0x33e15efb, 0x0d11d71b, 0x1d83b99f,
+       0xf4115f7c, 0x201da2e4, 0x3daac7cb, 0x2c5714f5, 0x75c30cf7, 0x389af51c,
+       0x81ed7aff, 0xf237e461, 0xf08bce94, 0x360cf4ff, 0xa2e7fad0, 0xe83f44de,
+       0xd6207d42, 0x1f9e15ef, 0xa23dedcc, 0x2e67dc13, 0xe0bed2b0, 0xa3df8e98,
+       0xeedf5d10, 0xcfa3fbe2, 0x9c87dce2, 0xdc57be28, 0x0becff54, 0x5aef5fd0,
+       0xebdd750b, 0x58f6411d, 0x1740136f, 0x54f7ba68, 0xddfe39d3, 0xa12016e4,
+       0xf82def38, 0x6cfef82f, 0xfc5f9df7, 0xb07fea06, 0x1d26ead6, 0xf04518e2,
+       0x2f2a285b, 0xfd93354e, 0x6e4e78b4, 0x5bc5ea05, 0x56f0bc44, 0x614e9abb,
+       0xe8d93543, 0xdb967e80, 0x0403370a, 0x6ab4cad9, 0x5364fe23, 0x9b1dce4d,
+       0xe87ab9f1, 0x58f22376, 0x9b7d98dd, 0x07ad8cd1, 0xf9252e16, 0x19a77a17,
+       0x3adb75e6, 0xe7ef8bbd, 0xdadaf9e4, 0x22f7946f, 0xc898f7e9, 0xd020024f,
+       0xa5c9357e, 0x4949f668, 0x181f4e82, 0x6331e22c, 0xda4bd8d9, 0xe44ed778,
+       0xdf8bb3a3, 0x1e271e19, 0xec2efda1, 0x7b8adfc7, 0x4fefa39e, 0x5c3ae391,
+       0xcc75ff7c, 0xf6899408, 0x07ae42e4, 0x7cffcdc6, 0x7fac2943, 0x4743b75c,
+       0xd5b70d79, 0xb87880bf, 0x68f025d0, 0x4fc85d60, 0x7c97f937, 0x4c421bf0,
+       0xf0dce69a, 0xbba5f495, 0xa91951c7, 0xde424b2f, 0x397d48ca, 0x12adafa1,
+       0x8fd4a2f5, 0x211ae6c1, 0x8e489b8f, 0x475e6c1e, 0x7ecdc3e5, 0x6e691e7a,
+       0x8db8f215, 0x79aaffbe, 0x01c790a7, 0xd2f78f21, 0xf9e6eefb, 0xd9ad7cf4,
+       0xa985cf47, 0x6e11d7be, 0xd73b8e32, 0xdcbca3ec, 0x189b0f43, 0x742ef1c6,
+       0x038f289b, 0x47b1e238, 0xc94f30d2, 0xa344e744, 0xe5a295f3, 0x743d3f7c,
+       0xe5b7b80e, 0xfef7e46d, 0x17b4233c, 0xa7a7c707, 0x4765cca3, 0xe0f1f4b9,
+       0x8e8724f3, 0xb4765cba, 0x2e3e4fa7, 0xdd971eca, 0x0d3fe500, 0x71fd25ee,
+       0x9bb2e7d4, 0xe3c9fca0, 0xdfbbfcbd, 0xf940b765, 0xfc7dc1d3, 0xd051807b,
+       0x2fe0ecff, 0x33958e48, 0x47f220e5, 0x2a7f39a5, 0xd7d00ba8, 0x2f9107e5,
+       0x992e67a6, 0x60b17c8a, 0x72e88bb0, 0x41fd6ba6, 0xd91acf2c, 0x1515e2ae,
+       0x46e15b1e, 0x5691576c, 0xa9bb62ad, 0xc46c7739, 0x6e86d376, 0xcddb2357,
+       0x236fb318, 0xb7706f96, 0x2e9f68ab, 0x1a563940, 0xe59647ee, 0x65a72977,
+       0xddd5dd3e, 0xe307d25e, 0x0fa4bcba, 0xe62a5c24, 0xff426f56, 0xe2976367,
+       0xa9a5dfc0, 0x27f4ab98, 0x62ee6033, 0x0a93de03, 0x3dfffaf2, 0x87ac77ae,
+       0xf9623675, 0xadb72a1a, 0xedfa06ff, 0xe2f6007f, 0x8000e831, 0x00008000,
+       0x00088b1f, 0x00000000, 0x3cd5ff00, 0xe5547809, 0x9dcee7b5, 0x4c92642d,
+       0xe2420836, 0x96249964, 0x26b6432c, 0x0c486410, 0xf90130ee, 0x10196544,
+       0x044816c2, 0x7eab17eb, 0xe0171a19, 0xd16b8d69, 0xb5c46faa, 0x61e4b6af,
+       0x1d0958d4, 0x87d252aa, 0xb410553a, 0x88a47479, 0x119099f0, 0xc7d278dc,
+       0xf7fce73b, 0x24cee666, 0xbefd1480, 0xff938607, 0xcfd9fbfe, 0x005ffff9,
+       0xb3f85380, 0x34607f02, 0x3d2538fe, 0x0468048c, 0xd1bf67f1, 0x0395b26d,
+       0x8c0734ac, 0x412fa3a0, 0x6010aba3, 0x76960eaf, 0x24a40014, 0x0b7afcc3,
+       0x74b08d96, 0x5de7960b, 0x05480368, 0x20bada68, 0xda85816e, 0x6066e3bb,
+       0xe21745fb, 0x52ce38af, 0xe0546e05, 0x9bd40a93, 0x4f34899c, 0x1fd24d9a,
+       0x856fc7ca, 0x064a7850, 0x3d9ab7e8, 0x448004ba, 0x0dac7b93, 0xfb9bedc7,
+       0x8758834e, 0x31d688af, 0xeb1ebd6c, 0x6c3200e3, 0xca1f1e56, 0x5e541982,
+       0xc846ed09, 0xcff5b846, 0xda22a4fb, 0x2327c597, 0x5f434e84, 0xf9ec5f20,
+       0x63fe1654, 0xe0543d06, 0x6e03e97a, 0x70d79969, 0xea566020, 0x743967f1,
+       0x226670ec, 0x7ed45ede, 0x18bf046f, 0x7dfb43bf, 0xbe8de215, 0xbf697537,
+       0x0f5b5403, 0x0230438d, 0xd9dfb8cb, 0x855efe12, 0x878f0dff, 0xc3c06749,
+       0x10f0a1a4, 0x1af01fb5, 0xd7de8e41, 0xa66ecb0a, 0xc0bee473, 0xd1fcca9d,
+       0xf7218108, 0xf445f2a7, 0xfe05dafe, 0x25ff02f5, 0x5a74e736, 0x38fcdd5f,
+       0x8e005390, 0x4d79356d, 0xa9ffdc99, 0x1744293d, 0x2d837593, 0x5b5b3e9a,
+       0x00de8367, 0xcdd5adb0, 0x14bad7d0, 0x3f8076f4, 0xf97336b5, 0x2e16d6ad,
+       0x30f568ef, 0x8ebad9dc, 0xdb5a5fe1, 0xeb577eb9, 0xdbbf2e46, 0x6fe865ea,
+       0x5fbf917d, 0x86657f3b, 0xff4d12db, 0x45cec9d5, 0x7b9e8fc4, 0x3e9913aa,
+       0xc853f7b8, 0xc81a9eab, 0xc344b66f, 0x9d658301, 0x8f65c094, 0xd9e1f711,
+       0xc36de316, 0x8c73fd7d, 0x19c689bb, 0xad7e09a8, 0x4a437c43, 0x30d0f180,
+       0xbe9abdd2, 0x3a1c464b, 0xe4f56689, 0xeb0efe12, 0x6407bf3c, 0xd39b56d9,
+       0x383e47a5, 0x17558f1a, 0x6582dc00, 0x78f3ce0f, 0xfa85abaa, 0x48c07e41,
+       0x3fa29ce3, 0x097c7193, 0x3af07766, 0x0e1ca210, 0xb1e808c4, 0xd18f2c49,
+       0x40ddc850, 0x60f99fba, 0x1913e9e0, 0xcb3382b6, 0xa8f870c5, 0x9e03ab93,
+       0x6567a432, 0xd584c3ac, 0xa4f8127d, 0x46538412, 0xd38e00d6, 0x13d46e97,
+       0x5644149c, 0x9fc3c750, 0x6322dfc9, 0x14cbf186, 0x6b94d448, 0xed35a3cd,
+       0x9a99aceb, 0x5cf4befa, 0xb4d2ff1e, 0xfaed348b, 0xc59a5746, 0x232f53bc,
+       0x6f7465d8, 0x0974805c, 0x9b1c9956, 0x98bdfeb0, 0x062822f8, 0xbf1b1698,
+       0x317be089, 0x376a5e19, 0x14c9c0ed, 0x934e7dc0, 0x108b237d, 0xc6db9755,
+       0x99edc76b, 0x76c36353, 0x6957e657, 0x25c121d7, 0x1dabdfb4, 0xa7df3453,
+       0xe9ae5e57, 0x93fb32ef, 0xcef5ad08, 0xc6f7cd7a, 0x9f41af96, 0xe5b1300c,
+       0x014be824, 0x343afbc6, 0xecee94e3, 0xbf1fb4d2, 0xeb12641b, 0x378e7d92,
+       0x741f9609, 0x152ac4ca, 0x24df9b87, 0x3fa5f558, 0x4e01f683, 0x9f5159b0,
+       0x83dc8a4b, 0x963d0247, 0xcae52927, 0x812db7a0, 0xf21270e8, 0x89bf48f5,
+       0x6321c230, 0xbff2a963, 0x4c1f104e, 0x32002052, 0x16abf607, 0x3a79804b,
+       0x4598d78b, 0x1be5056a, 0xc906c1f5, 0x3847a691, 0x50540e47, 0x8a0428f9,
+       0x973aca08, 0x2a6bf89e, 0xb2a58f34, 0x0469dc09, 0xbf74483f, 0x2fdc7c4f,
+       0xe2c4da05, 0xcfc4c982, 0x68ff3f75, 0x17ac6dde, 0x5c261c62, 0xfebaefdf,
+       0xfd6b4a91, 0x91f53fbb, 0x7e216c37, 0xcd7eb26f, 0x8dcb5278, 0x7f19c72d,
+       0x2d6fb96a, 0x92e177cc, 0x9f680ddb, 0xaffe3610, 0xed0a76cc, 0x53a23ada,
+       0xb8c9fc23, 0x1ed420ba, 0xc418be3a, 0xbfea3177, 0x04d35a7a, 0x5ddfd7c2,
+       0x6f576c4e, 0x9e087210, 0x1c4ef545, 0x29463ea7, 0xa7d44f83, 0xb2a1ed2a,
+       0x6ae9cb9e, 0x6f68957d, 0x587bc757, 0x96ad1fb4, 0x522ef195, 0x9ca2cdcb,
+       0xa0f7cea9, 0xe5aa1728, 0x397170ff, 0x613fb44e, 0x29ef559b, 0x53ffe908,
+       0x0f18ddaa, 0xa06ec9e3, 0xc933903d, 0x1abb481e, 0xeda21f98, 0xb15eb685,
+       0x237ff317, 0x44c58c7b, 0xdf63cb8f, 0x90eeb921, 0xf1bae480, 0x8bd38376,
+       0xd49e7ff3, 0x12c6b451, 0xb7e7dfc2, 0x6abb7c08, 0xb6329ce3, 0xde6af95f,
+       0x3923e226, 0x85c8f76e, 0x563addf8, 0x4ea77ac7, 0xe88138b6, 0xfbd0af7b,
+       0xd848ff6a, 0x8686f2d0, 0xb2f5519e, 0x6cc1f3c4, 0xfaf9c1fc, 0xf4f51bef,
+       0x8e59c206, 0x9370973f, 0xdcf42999, 0x95add448, 0xea36f3f8, 0x3dd23359,
+       0x3a9c1b25, 0x1af29f6c, 0xf1a267ea, 0xc7d0bf41, 0x24f8c5af, 0x8f959c14,
+       0x6ff6c9bd, 0x8e528ca1, 0xcf2d7bf8, 0x7c89979d, 0x9fce347a, 0xd0db7c4b,
+       0x75d78db2, 0xe3cadd8d, 0x10583583, 0xcce2cf8e, 0x9e97fc28, 0x3fa5ff01,
+       0x8271fe26, 0x75cfa403, 0xbeb47428, 0x78b796e5, 0xef95cbbf, 0x43325fac,
+       0x472cb8ed, 0x39c68f97, 0x0e1f0832, 0x74074e85, 0x5f050ab6, 0xfabe1357,
+       0x1373fb17, 0xf9f0ecb1, 0x3ed9ba47, 0x88972aec, 0x4071cdee, 0xf92a3f74,
+       0x410ef68b, 0x0ed68eff, 0x5a5bcbb6, 0x84be18bb, 0x55bad073, 0x8d10dd7c,
+       0xc067f9df, 0x131ffcef, 0x01f4a3bf, 0xadfb03a3, 0x4e3c07da, 0x1180ff85,
+       0x2b4cf4c2, 0x27e225f1, 0xfae24ba1, 0x2120b93a, 0x138fa9a0, 0x738e52fe,
+       0xcae9f13c, 0x37aabb19, 0x98792148, 0x311d0b1c, 0x0ed7cc49, 0xc41daf85,
+       0x22ff2ad7, 0x11ea963f, 0xc49d6fcf, 0x37e0437e, 0xf3c0bfc4, 0x3bba78a8,
+       0x881baf1a, 0xabc1a78e, 0xc607feb6, 0xc7fa276b, 0xaf8237a4, 0x653778c4,
+       0x77f9e346, 0x7c555e0a, 0x7fe4536f, 0x236f3c38, 0x7f9ea73c, 0xb4cb6f3c,
+       0xf891b8f1, 0x453ece1e, 0xf75d47d2, 0x7e5a7210, 0x2d3a722e, 0xdff8aadb,
+       0x461677e8, 0xa26dfdd3, 0xf74359bb, 0x53c8339e, 0x4f298fcf, 0x848b7891,
+       0x3ab8128d, 0x3fdfd12c, 0xdf561ccb, 0x4e3c179d, 0xf8d6ce0a, 0x75bf9367,
+       0x29b3fc6b, 0xfd696118, 0xe5349bd8, 0x9aadeb3a, 0xada697f6, 0x6e5fd4d5,
+       0xbfa9af5b, 0x4d01ff32, 0x63c76af9, 0xd3e67e11, 0xe77afa9a, 0x73f5346f,
+       0xea6bb79b, 0x68f4b7e7, 0xfe7817ea, 0x78ab29aa, 0x1c0adadc, 0x356b6d2f,
+       0x65d3f12b, 0xfe03ab0c, 0x8b83125a, 0xdfd9070f, 0xd7b7f4ac, 0xafb24bb2,
+       0x32d1fd83, 0xc296ab9f, 0xcd9d8aaa, 0xb5f4126f, 0x2d78955a, 0xad5be18d,
+       0x3befd636, 0xee19f35a, 0xf128756c, 0x5dc3255a, 0x4e254ead, 0xb48c3173,
+       0xbb66af0b, 0x3d2164a7, 0x44bcbda6, 0xe980b807, 0xc167f87f, 0x77bc5a5e,
+       0xdce28ebc, 0x8e5eca35, 0xffb37f57, 0xe3afe436, 0x950726cd, 0x311fb77b,
+       0xf9a30ad8, 0x32b7ee65, 0x6cf8c338, 0x0d5fcb6e, 0x45cd67e4, 0x0863ba0f,
+       0xa59a9d39, 0xf7207e63, 0xcc2f5003, 0x05218336, 0xd9ecc1f5, 0xf80da392,
+       0x189207bb, 0x3f58dcfa, 0x133e0f4d, 0x7a2deb96, 0x979e299f, 0x3fa332e6,
+       0x132c4b3d, 0x50f07a4c, 0x7324a43d, 0x7d0d7e9c, 0x383ca1b4, 0xbf18b865,
+       0x1c3f22cf, 0xe96f5dfb, 0xbddd9030, 0xfa2fe76e, 0xb87ac36f, 0xf1ce53d3,
+       0x25625c3d, 0x3e792dfd, 0x371a9dd6, 0x3520bcbc, 0x5f1850e1, 0x4e19254f,
+       0xe1d1f8a5, 0x7adc5277, 0x9cf1c193, 0x05dfba2d, 0xc9a77eca, 0xc16ffb12,
+       0x4dde4dd7, 0x713e4852, 0xb84d3b7f, 0x01e226cf, 0xc1b367da, 0x7e445797,
+       0xb3f676f6, 0x16d72a9b, 0x2e9a9d11, 0x15313e91, 0xa69de285, 0x8fd92f96,
+       0x91cfd48f, 0x90f14cf0, 0xfe656fc3, 0x93badfdb, 0x8b8d45f9, 0x5c7d5b7a,
+       0x6ab80b2e, 0x39a3e3c3, 0xa64dff93, 0x4beaa7b8, 0x3c4cff11, 0x53fbdce9,
+       0xd5a077dc, 0x17e52fff, 0x9a82bcd4, 0x5bcc8867, 0xde647aa8, 0x6e0975ad,
+       0x2c9aefdc, 0x94f30651, 0x5ea3a674, 0xdedf5540, 0x9765159a, 0xbd3ac8ef,
+       0xffd6d67e, 0x6cf9fac0, 0x4d31bff9, 0xbe48d5d8, 0x05e337df, 0xe553ad03,
+       0x9ffe48ef, 0xfe707d43, 0xd7924d39, 0xf67a7a83, 0x44c37692, 0x7df9dce9,
+       0x88a0e5b9, 0xc2ed238b, 0x3607b6f7, 0x2b5c9ba6, 0x92617c73, 0x1e50726f,
+       0x4743a544, 0xcf3add34, 0x1fceb740, 0x76d16e93, 0x73bce0f1, 0xf1a08bb3,
+       0x8acbdfcf, 0xc83e27f2, 0xa91fbd3a, 0xf781ffad, 0x636b1d6d, 0xef4472b8,
+       0xea27593c, 0x01627c45, 0x80eff21d, 0x74b8e657, 0x3c7b6669, 0x195033c5,
+       0xb77d278c, 0xf2065bac, 0xd4ef410f, 0x5cfe468f, 0x1f67f0a2, 0x7e243ef8,
+       0x7ef7055c, 0x25980941, 0x22ae4bd5, 0x09f4b73d, 0xfc4f0843, 0x27f393af,
+       0xcb7e94ab, 0xda469d2d, 0xb567f2ef, 0x1a71d4ed, 0x1fc88a5f, 0x19fa5f57,
+       0x73f0ddb0, 0xa7556fde, 0x5977dfb6, 0x62872971, 0x084b1659, 0xa7d267ef,
+       0x1baec947, 0x5b27cac2, 0x3f20bf39, 0x9e03e0f3, 0xc4fa21b1, 0x71f14764,
+       0xf9e9f65c, 0x23ff5b58, 0xf71cb1f3, 0xf9e891ac, 0xbf78f97d, 0xeb4599dd,
+       0xa0f3f556, 0xc4c379de, 0xdca0677a, 0x37a4f226, 0x9e2daefd, 0x3804e4f8,
+       0x2a161d88, 0x6a85d2f9, 0x369d74be, 0xcfb93a5f, 0x49b979c7, 0x716dbd07,
+       0xbd89f748, 0x55dbce1e, 0x59b776ed, 0x5dd3fcb0, 0xa3fc994e, 0x64b96ff1,
+       0xdfeab75a, 0x484efea8, 0xbeb0e58f, 0xf66bbce3, 0xd53bebd9, 0x30f6aa2e,
+       0x06560ed2, 0xfec96bdb, 0xe3b6f84d, 0x2be7824d, 0xf7691eaf, 0x7a138bde,
+       0x57c1a8e2, 0x8cfc97be, 0xcf1c63d7, 0xaffaf441, 0xc67e16cb, 0x0302cf4c,
+       0x1f091fcb, 0x450cdbca, 0x764fae6e, 0xf54d975f, 0x99d0bd8a, 0xa3b2069d,
+       0x23df7275, 0xf95f12d7, 0xde1bce65, 0xbf07c77c, 0xccedb5ff, 0xeb2685f9,
+       0x863ff671, 0x749a338b, 0xa2f8a6e0, 0x4a56d6a4, 0x6dc50c7e, 0xf3544794,
+       0x9fed918a, 0xc8acd7b0, 0xb5573ce6, 0xd9eb49df, 0x1c33d628, 0xbe5a9abd,
+       0x8731e4d0, 0xbba9bf9b, 0x4c30badc, 0x16ca5e3e, 0xdbd22ef1, 0xa21cc87a,
+       0xc5f2d9f7, 0x65f8b7ff, 0x091e0c9a, 0xe4a16ced, 0x082ffe15, 0xf80e783f,
+       0x2083ce19, 0xf9583743, 0x38216a7c, 0x17022e18, 0xdbbb7cc3, 0x60337c4b,
+       0xbe248e08, 0xbbf57fea, 0xfe9be202, 0x57b6278b, 0x5f3bf9c1, 0x06fff48a,
+       0xfe78dbc6, 0xdbbe5781, 0x7039fc43, 0xf4ace187, 0x6764eac6, 0xe451f127,
+       0x53bbcb79, 0x01d73e64, 0x8b967afd, 0x03e8ab7a, 0x1b72a497, 0xe64cd8eb,
+       0x1cde908b, 0x37aab4f5, 0xc2bf6017, 0xd7ac744f, 0xb5e49960, 0x80aed363,
+       0x70ac458e, 0xa657a671, 0x2fa8a772, 0x95e8995c, 0x15585cb0, 0x4a6fea23,
+       0xc52642f4, 0xcb960143, 0x0fac00f9, 0x8bd08017, 0xf7938237, 0x96419189,
+       0x6f17fd84, 0x3e709735, 0xa4390216, 0x8e288bff, 0xb74e221a, 0x2f7908e6,
+       0xbefa12ce, 0x179b46b8, 0xc95b30f9, 0x4a6bdb1b, 0xe7561072, 0x1d12f738,
+       0x1bfc938b, 0x7ca32a1e, 0xa1360e90, 0x75567d7c, 0xaa779f2b, 0x35ed1afd,
+       0xcdbf84bd, 0xe2bc7012, 0x9f7936e9, 0x238ce713, 0xf2cdcfc3, 0xa807b5ed,
+       0x7b5a11dd, 0xc578f0f9, 0x47f71c7e, 0xd78795cb, 0x1bb14c57, 0x43f1fbe7,
+       0xe5cbcf25, 0xebe679ff, 0xf80b3bfa, 0x7e43c14c, 0x7ddda372, 0x046fd79c,
+       0x9ffad0b0, 0x40147114, 0x47e50673, 0xd2653c97, 0x11f19f91, 0x03c8639a,
+       0xddc61bf8, 0xe31bff04, 0xc77f8267, 0x27e099f8, 0xfc133f18, 0x04cfc607,
+       0x1e3b7f17, 0x8d802283, 0x4e4b4e39, 0x301ce879, 0x1c86bd72, 0xf9c1cf81,
+       0x7f3c8dbb, 0xf8cddd9d, 0xebf7a41d, 0x9973a5e0, 0x0bc189cd, 0x6fc34e92,
+       0xf0dfdd03, 0x7870e9f9, 0x2325cf51, 0xe853bfeb, 0x67a9d45a, 0x15d45ffb,
+       0x6b086f88, 0x918e4177, 0x395f0beb, 0x1fe34f18, 0xd7e20eb5, 0xa796e129,
+       0x82f944e9, 0x08332d67, 0x677675bf, 0xe51bed09, 0x51f6833c, 0x83c1f5d4,
+       0x7c78cb13, 0x75a364ab, 0xb8e51f04, 0x911f6221, 0xb5f75078, 0x81bfd139,
+       0x257e6ffa, 0x7a82768b, 0x10dc8407, 0xed43491f, 0xcff32d77, 0xccb05374,
+       0x7e9deb8a, 0x0a1e6e4a, 0x29f675ff, 0x5477e78c, 0xc7cf537e, 0xe952fe15,
+       0x1df2ae76, 0x6b901e39, 0x6ae77e84, 0xb236a5d2, 0xc9e3274b, 0xee57ac2f,
+       0xe6757419, 0xf4fb47bc, 0x6ec194ec, 0xc8d63e63, 0x5f8562df, 0x6dd85854,
+       0x36bd1174, 0x59ca1f77, 0xe4fa6164, 0xb3f6c62c, 0xbc9aec72, 0x89d56167,
+       0xe14a1fc7, 0xea9a56f6, 0xceba783a, 0x60dfe38a, 0x6d36fede, 0x93f5ae69,
+       0xcf2c44ba, 0x1076934f, 0x9ccb605c, 0xe5a3649a, 0x37fd797a, 0x41d94fe6,
+       0xa3957522, 0x29b9fd9e, 0xecc264a4, 0x9639ad43, 0xcb071f0e, 0x4d64d675,
+       0x31b4d2f9, 0xdb97f69a, 0x57f535b2, 0xd4d38fe6, 0xe55ef3ab, 0x2bb4d528,
+       0x51660a4e, 0x60fb875c, 0x64e780b9, 0x7da25daf, 0x1c62beef, 0x3f3da796,
+       0xca6e41cb, 0xda7ea566, 0xd12f5a96, 0x69f10063, 0x70ea8744, 0x1f47fae5,
+       0xe222c1a2, 0x67eec686, 0xe76d3876, 0x130c3710, 0x7100ac2f, 0xdc5c3f8e,
+       0xa02f1910, 0xf4907cfe, 0xd7abf167, 0xdc70db58, 0x2e2755cd, 0xef3ee1b0,
+       0x8238c1cc, 0x47128dec, 0x833fc70c, 0x04d92272, 0xf0c8f4ff, 0x03fc10dc,
+       0x1f850bf0, 0x3ef69c05, 0xdf0533fa, 0x4a7dbf5f, 0x07f38dfa, 0x57efc51e,
+       0xafbe4460, 0x6f78e8d8, 0xdea7e50d, 0xf9ce8191, 0x03ae24e1, 0x77e81beb,
+       0xb0f7c439, 0x46bbe9e8, 0x0f77f0a7, 0x94aba6b9, 0x731fdffc, 0x71aabf14,
+       0xcba35dfb, 0xf370f542, 0x70f69a27, 0xa6b774bb, 0xb6a6677c, 0xbb94ef7c,
+       0xe70ffbc3, 0x5c6c3597, 0x9ca37460, 0x392c3c36, 0x8be843bd, 0x28a4f5c1,
+       0x097ba1fa, 0xdb43dbeb, 0x716d1997, 0xe157edd1, 0x6cb79478, 0xaadec618,
+       0x193aea7a, 0x7faa879a, 0x71cf9d47, 0x08fbe77e, 0xcdf64f71, 0xc3b09af3,
+       0x8db8251f, 0x2fb27ce1, 0xf47b9c47, 0x1dc0f63f, 0xee79d35f, 0xeabe22eb,
+       0xa3f6144f, 0x9d33f3a8, 0x08f1610e, 0xd6455fc1, 0xd2ec8e80, 0x0f58d2c0,
+       0x2d359ca0, 0x8ae8f38b, 0x7e088fc9, 0x5e4f1e68, 0x9a0f2dc7, 0xeb1fce91,
+       0x3cbb1a74, 0x9616c140, 0xd9fd9efb, 0xf7e93b8c, 0xe92f7102, 0x2fb3ed7c,
+       0xad7d8407, 0x1e637a11, 0xb7629ff1, 0xd3565500, 0xc768305d, 0x5e10cf48,
+       0xbf6b9ca8, 0xc987fdf5, 0x7a11efcf, 0x370af283, 0xb4e05fb0, 0x1d0df368,
+       0xbbf8e72c, 0xd73efc2d, 0xb78feb59, 0xf3968dda, 0xd84647a8, 0x218779b5,
+       0x57fbc5f4, 0x5e9b3d22, 0xd05ef997, 0x04f6adb1, 0x911fd308, 0x28da6c78,
+       0xe5ab9cb3, 0xcbe55ba3, 0x830f6cbc, 0xd185f519, 0x83a706f8, 0x55b57fe5,
+       0xd27ab7cc, 0x4ec83337, 0x8bd6eeaf, 0xcdc32f4b, 0x5b064eb3, 0xb79b3cd8,
+       0x5d929699, 0x603fd753, 0xf749f455, 0x0a534957, 0x843b5c04, 0xc0bf457d,
+       0x417e4290, 0xecf1c4bd, 0x3551ee9e, 0x123da784, 0x3c256cf8, 0x5c6635c4,
+       0x1c314cdf, 0x5e50b77d, 0xf9f2d214, 0xd71aa59e, 0xacecf1aa, 0xf27659ee,
+       0x5cec3f63, 0x072907b8, 0xccd9ec93, 0x8782d74f, 0x893deefd, 0x93ca74ae,
+       0x3fee534c, 0xf60c49ec, 0x67bdbf91, 0xf744ac52, 0x3bfc7019, 0x5f757c69,
+       0xf4ae0c7b, 0x9297de66, 0x44fe752f, 0xf67b153e, 0x67aaa271, 0xa7dbe4eb,
+       0xf7e7495c, 0xf14ac073, 0xf85974ec, 0x2147f0d5, 0x6d5eaacf, 0x6c49fc92,
+       0xa633edaa, 0xa34f11db, 0xe4a97e5a, 0xf735db7d, 0xafd6cf00, 0x5fa38c1e,
+       0x567f9894, 0xb1bc4439, 0x47f3faaa, 0x57f9c5ae, 0xfe4fbc61, 0xedaec2dd,
+       0x917f08fb, 0x7c60fdf1, 0x7be62ff5, 0xd733e3a3, 0xcddfda32, 0x73df1c77,
+       0x69c7442d, 0xea817183, 0xcb173e5f, 0x58a8d6e7, 0xfc287c85, 0xee5b647a,
+       0x7f5835de, 0x66062fe4, 0xfd2737d7, 0x58ade8ea, 0x58b9f9be, 0x2491f3c6,
+       0x391d90f0, 0xebcf29b2, 0x744b06c1, 0x6fb25ec1, 0xcf8e25b0, 0x327b3e69,
+       0x512fb7ef, 0x76b7f27e, 0x7e4843f6, 0x7cc2e86c, 0xe88ff746, 0xb9a3cbfb,
+       0xbcc5b81f, 0xca5c8a0d, 0x5fde142f, 0x242ff54d, 0xa5427e73, 0x6327e1df,
+       0x7dac149c, 0x2b22be05, 0x92e7deb2, 0x5bdd10e7, 0x697ba15c, 0xf97c84bf,
+       0x06f708d5, 0xc7f2f7da, 0x89c3f3ff, 0x17da9fb8, 0x1555feae, 0x07d96fae,
+       0x84e340a9, 0xdfb43ae8, 0xb66b6c70, 0x3f057f90, 0xf18c5e2b, 0x27d30c1e,
+       0x35123b2b, 0xd1aea6e5, 0x7a6183de, 0x729ef068, 0x04e7c4a3, 0xed5c8a8d,
+       0xeddbba37, 0xfba5d794, 0x713f4ca9, 0xce84b51f, 0xf7ff08ab, 0x91ff1899,
+       0x5da2f67c, 0xf3566739, 0x4e60c93c, 0x0b75b923, 0x97dc0dfc, 0x31e289b7,
+       0xf1493d9f, 0x33b9823b, 0xb3f9c30a, 0x9c1bd577, 0x7b8931e7, 0x9f43318f,
+       0x13da77eb, 0xf9837db9, 0x699e4d4b, 0x4d09cb55, 0x015567fe, 0xd2501fb0,
+       0x89bd2b66, 0xba1487ce, 0x7aee9fdc, 0xf1def18d, 0x18bbabc0, 0xf2dc4f9f,
+       0xd3bbcd31, 0x5d83f4c2, 0x11163c4a, 0xbf98356f, 0x69efe450, 0xe87e7f8d,
+       0x9445bdb1, 0xcaf438ff, 0xd3ca22b8, 0x87fd942e, 0xf7c99d7e, 0x86dff69c,
+       0xf7cecb70, 0xb91e2f39, 0x0c7ba8de, 0x8d43d092, 0xba648fb4, 0xc77ae3ff,
+       0xf42e72ce, 0x850d81c3, 0x1f353f8c, 0xe864703d, 0xa75d5078, 0x3ebabe3a,
+       0xddb57c75, 0x5f22ecdf, 0x17f46fd0, 0x415ffd91, 0xfb6130e7, 0x17f78fea,
+       0xbbe85a25, 0x4913f855, 0xb7e30e58, 0x2abcf57f, 0xf06a7cf2, 0x47c9565c,
+       0xfdadd3ed, 0xaff91199, 0x8321e3af, 0x7eef5c3b, 0x752a73cf, 0xdafdeabd,
+       0xfd85ab7e, 0x2576939b, 0xe90e9f1f, 0x1deb0ed4, 0xb7bff23e, 0xc7e41c98,
+       0x905c9a27, 0x3469f88b, 0x9afef8fa, 0xe4d12fda, 0x7991efe6, 0x234481f9,
+       0x81e5bdd0, 0xf7fce554, 0x42bd602b, 0x9c16e871, 0xd756acb7, 0xd212c5bc,
+       0x2cfeaa87, 0x0bdf871b, 0x3ea91ee8, 0xdf2027e4, 0xdb6b1594, 0x2da3f687,
+       0xa0ae7bff, 0x6eb25963, 0x24b938c8, 0x1b65c857, 0x9e42c874, 0xa89d1d85,
+       0xbf0d1de0, 0xacd7ee1c, 0x40fcf452, 0x0743d9bc, 0x8ab713bb, 0xf513ab7b,
+       0x5104edbe, 0x124b400b, 0x89f4995d, 0xfab4baf1, 0x1cc86c9c, 0xd8e3cbb6,
+       0xc8504f2e, 0xccd4b77d, 0xf7435bf7, 0xc132fd5c, 0xd0c8218b, 0x413d5609,
+       0x4bc30324, 0x2a70c5c0, 0x0cbc3334, 0x015e19da, 0x02af0c1d, 0x89f8433f,
+       0x1ed80daf, 0xff656edc, 0x3a25f2e9, 0xd765cbb2, 0xcf97ed0e, 0x3c35f052,
+       0x57cb503e, 0xa63e3b9c, 0x8772f72a, 0x7cd8cbc5, 0x2f157be6, 0xec4fe226,
+       0x34de0317, 0xc0209382, 0x46264ce3, 0xdd78a6ce, 0x6b7ef7c6, 0xbae5c9c1,
+       0x6547c4b3, 0x1777adc0, 0xda97810c, 0x9e64f9a1, 0xb90327c2, 0xe951f8c0,
+       0x8dae48f5, 0x30dd2acb, 0x7b234c50, 0xc84f4d10, 0xc59675a0, 0xa7a71cd6,
+       0x5f3fb722, 0x7a8f5336, 0x66b4acb4, 0x5f90a90d, 0xe5154ee6, 0xd32f3589,
+       0xf3fb7d51, 0x71728a97, 0x81c1a94d, 0xcbdae85e, 0xfa825e66, 0x27dcadd9,
+       0xa011a337, 0xb672637b, 0x2b761738, 0x724dcaf7, 0x2fba5ae6, 0x580dba66,
+       0x0063b8df, 0x22d7ecfc, 0xb8bc91b7, 0xb37b1c45, 0x3aafd055, 0x2e4b7dd6,
+       0x2fb333d9, 0xb87486de, 0x28dd6d79, 0x18f79bb2, 0xa49ff8c5, 0x81bdc6da,
+       0xc49932f8, 0xbf7556bd, 0xc189ef58, 0xadb24072, 0xad0cc969, 0x59c75d4b,
+       0xe9d77bcc, 0x774fcde6, 0x023d206f, 0x15c70736, 0xbefb1463, 0x34c4cb65,
+       0x1d7030f4, 0x20475e56, 0x0b4d772e, 0xee91dd56, 0x1bc6847a, 0xf87c1388,
+       0x7529d108, 0x75cbe878, 0xc43b943e, 0xdfb581f7, 0xbd23eabc, 0x042e29f4,
+       0xae4df9c7, 0x475a71fb, 0x51902e93, 0x45fbf48a, 0x05007a2c, 0x9096be21,
+       0x0f107398, 0x1af04e6d, 0x77945e59, 0x99f9ca36, 0x8b03172a, 0x4fc43c71,
+       0x8b55cb99, 0xcc5422ee, 0x60937e6e, 0x16bdbba5, 0x179e686b, 0x724d3d68,
+       0xe4f881b0, 0xc607e268, 0xc76e594f, 0xf454fe0a, 0x9eb6f759, 0xa288c6db,
+       0xb2e4c20b, 0xaf89db69, 0x6f7486ff, 0x5071663a, 0x3e3c90f3, 0xe79c46b6,
+       0x46fa345a, 0x5d09d395, 0x9c383e26, 0xc5a2f5b8, 0x07d26ed4, 0xb7a4d9bd,
+       0xda06f727, 0xe81e7dc8, 0xc8463bde, 0x7fd7ea89, 0x7d8b9d23, 0xfc8cccf9,
+       0xf9104091, 0x839c5e23, 0x8af4fc73, 0xad5f0738, 0xeca93de4, 0x788b7de1,
+       0x573b8d54, 0xde2dbcf6, 0x6ff07985, 0x122bbd05, 0x713e967f, 0x6fc455e3,
+       0xd48bef91, 0x6949b478, 0x7bd7a2b7, 0xf227ed37, 0xc51351bd, 0xbfc345a3,
+       0xa27a6a37, 0xc8d1e396, 0xb9bd46f7, 0xb14afe4a, 0xa1f8a08f, 0xb436944b,
+       0x87c70b3f, 0xf709af46, 0x35c9fab6, 0xd3952b0e, 0xc7d60e2d, 0xe10e3d57,
+       0x6489e1ed, 0x9e5519e6, 0xd893ad97, 0x5af156bf, 0x49c9bcfc, 0x7e7e28eb,
+       0xe8cdfb14, 0xe97b8bef, 0xde913e4a, 0x837bd012, 0x2cc189cd, 0xb9ba67ba,
+       0xfe41df3b, 0x9d5a1ff8, 0x68430ff0, 0x503c6a7d, 0x4b54bf27, 0x2d8e87ef,
+       0x3f0b38c2, 0xa679eead, 0xd5e58ccd, 0x1055e9eb, 0x13f384a5, 0xdf2aafc8,
+       0xc6978329, 0xd543ef01, 0x39153b08, 0xc0e9a537, 0x188f8616, 0x0db008db,
+       0x29300f91, 0x4fcd8bf4, 0x39c7d4d2, 0x4ff4d02e, 0xd4d2cca8, 0xf788c5b7,
+       0xfa71e032, 0xef422a0b, 0x3f9d1248, 0x0083f4d1, 0xbd08adfe, 0x7e27b917,
+       0x4f7e4eea, 0x3ce06fe2, 0x2565f245, 0x7926f69a, 0x5dfc4cab, 0x435ea5fd,
+       0xa6529fcf, 0xb956f11b, 0x9c1cfd1b, 0xb69f4267, 0x01e0263e, 0x5bb317ea,
+       0x984bc9af, 0x85f2da6c, 0x629e4a79, 0xe4d58c2c, 0x2ef10629, 0x61d8fef8,
+       0x0545f31d, 0xbaaafce4, 0x006cf08c, 0x6f1a2daf, 0x5df840c7, 0x1c5ac6c7,
+       0x426a96f4, 0xc932cbcf, 0x8b4baa41, 0xb5b351ff, 0xd6ed1ff8, 0x52cc7be2,
+       0x9bd3be2d, 0xb0bef8b5, 0x4cd78b45, 0xd96f168f, 0xda6826eb, 0x346bdbdb,
+       0x578dbce5, 0xe45fda68, 0x8f29a19d, 0x4d7af17b, 0x858ec2fb, 0xaee2fa9a,
+       0x957a9ae5, 0x83e386cf, 0x11d5bef1, 0xdd03a6fc, 0x74a0f869, 0xf335cfe7,
+       0x9ff450fd, 0x05e8a79f, 0x2bd7fe85, 0xf8dde576, 0xb892f7c3, 0x7a158b4e,
+       0x50df3070, 0xee78e06d, 0x6d725b3d, 0xc505e91c, 0x7b14b9de, 0x894f3907,
+       0x1d9455b2, 0xa2bf717e, 0x36ab9f64, 0x2cf746de, 0x8a8afdc4, 0x09b5edc3,
+       0x1de23ed4, 0x494af4d6, 0xf91dde73, 0x67a66b2e, 0xd1209cad, 0x3f7144bd,
+       0x841ef231, 0xdeab3efa, 0x2739a319, 0x96bdee1f, 0x78c25f9a, 0x2f148c01,
+       0x3efccce8, 0x721fda31, 0x5fd9946c, 0xf6ffb373, 0x79cdc967, 0xfecc6ba7,
+       0xecefe20c, 0x79f5eeb1, 0x3aa3b788, 0x3dfd8d87, 0x00d6fde5, 0x2fdf8c6d,
+       0x3ca4ccf5, 0xbb8600e9, 0xdfd4d794, 0xbd2663b3, 0x5be5c45b, 0xac221503,
+       0xe68f3fa6, 0x71a41fb9, 0xbbd6480e, 0xbbefb14b, 0x20cf3e13, 0x73a2667b,
+       0xff3e12fe, 0xfc2f387e, 0xee147bfc, 0x406df50f, 0x79f0f367, 0x8e25cfee,
+       0xc1a73e53, 0x77e4c2aa, 0x4f79419d, 0xb9b6e22a, 0xb8d4be0a, 0xff328e6d,
+       0x29621c01, 0x5db9f3ea, 0xacbc667f, 0xe253eb48, 0x158766bd, 0xac71bfc7,
+       0x7bef84a5, 0x221d4b39, 0xb8e357de, 0xb1f7f231, 0x87ba67b3, 0x88ed22b5,
+       0x97869e26, 0x57cc8792, 0x42c5e646, 0x1fe316fb, 0x76cb1f58, 0x74fac0e8,
+       0xc6863fce, 0x85f9ca3f, 0xfbdacdb9, 0x3e5bf3dd, 0x02dff0d2, 0xfa9a27cf,
+       0x30d04a40, 0x781ff706, 0x1bd4f475, 0xaffd7f10, 0x9e282a98, 0xe4f5ba45,
+       0x0fc68795, 0x897797dc, 0xb4ce1bf0, 0x1d79cfcf, 0x5afdcabd, 0x5bfb9f75,
+       0xd03971f7, 0xefb8881a, 0xbfc4d1e4, 0x09fe342a, 0x0e8fc9f2, 0x431c234a,
+       0xe76673e5, 0x57a9388b, 0xabda7779, 0x55ed3bbc, 0x2af689de, 0x957b42ef,
+       0xbbeaa177, 0x9c095edd, 0x8e64bf74, 0x816a7ae4, 0x0f76efc4, 0x969b3ed1,
+       0x5de88b07, 0x60715363, 0xbbf3249e, 0x7df423dd, 0x45bb7788, 0x69f49592,
+       0x6ef435ea, 0xcf08f0f7, 0xd9d8b251, 0x50d789f9, 0x28d870bc, 0xc5f4a3e4,
+       0x7bd2666f, 0xdd53c7bd, 0x3fbf89c7, 0xf31f6495, 0x9f12ebf3, 0x6033832b,
+       0xef16719c, 0x13cbbf7a, 0xf32734e7, 0x0a89b9c4, 0xbd0be647, 0x9cb04a56,
+       0x2e6f72e8, 0x68dabbbf, 0x385777e2, 0x7617539f, 0x7df2221f, 0x4d1fc95c,
+       0x6a1fd23e, 0x5f2127de, 0xbbd3379c, 0xca675a39, 0x6ef126fd, 0xa0cfe02e,
+       0x0f747677, 0xbdf245ca, 0x1de29c1b, 0xf0a6de5e, 0xf90930f7, 0x45bd3dca,
+       0xb7a779a0, 0x7ec0e7b2, 0xe5af27d2, 0x53f393b9, 0x56c7ef43, 0x7f676fc6,
+       0xc6df20af, 0x797ae2f3, 0xee17a8ff, 0xc79cfa24, 0x7e56617c, 0xd7fff479,
+       0xf5bc3860, 0x5a3ff62f, 0xf77a1990, 0xaddef616, 0xaf2c3f20, 0x343faea7,
+       0x42e5e9ce, 0xe5a97bcd, 0x93dd8f43, 0x7486724b, 0x5948f911, 0x88633f9a,
+       0x05f3d3fe, 0x774feffd, 0x97f9a04d, 0x60bc8b37, 0x6fda6f88, 0xdce898f9,
+       0x3ef21963, 0x723fdabf, 0xf5b72b9f, 0x9f703e30, 0x617f68f3, 0xf08cbcfb,
+       0xbfb3eea5, 0x05a3ef7b, 0xdfdf73b6, 0x6e777df7, 0x6d71811a, 0x767950d2,
+       0x7e613eb4, 0x3fed4999, 0x8fedaf56, 0xb1e5390e, 0xd1de48bb, 0xe254e96f,
+       0xc4cbb21e, 0xee5daa17, 0x2920e254, 0x02ed83b0, 0x71724bcd, 0xfb61e4b7,
+       0xda3be6a8, 0x947fb424, 0x61af7057, 0x685f217b, 0x775f1071, 0x49f9ef22,
+       0x58cef41e, 0xc44773ce, 0x758b3fd7, 0xbc7844df, 0xa335aff9, 0xf2defe28,
+       0x38942b97, 0x72abd84e, 0x69cb3f85, 0x4147da7e, 0x996df302, 0x730abeb2,
+       0x55c9fb33, 0x5e4591e0, 0xac93c943, 0xdff1c1df, 0x141a01ff, 0x43d0aaaf,
+       0x000043d0
 };
 
 static const u32 usem_int_table_data_e1h[] = {
-       0x00088b1f, 0x00000000, 0x51fbff00, 0x03f0c0cf, 0x33a98f8a, 0x32e8f430,
-       0x31e8a430, 0x43d4dc30, 0xcf12d388, 0xbf4ca2e1, 0x83030b30, 0x038b1028,
-       0x7f1024b1, 0xf8606463, 0x7ebc48ce, 0xbb04115e, 0x81818045, 0x070fc80f,
-       0x1905ffd2, 0x330b3e18, 0xf903f030, 0x6dfc80b3, 0x88087c40, 0x376280c3,
-       0x2067f480, 0x02c40fbe, 0x17cdf822, 0x417f2024, 0x07ff9508, 0x1042ff8d,
-       0x61637ebf, 0x0496f2fc, 0x4de1b1e4, 0x0f8cdc04, 0xef40a77f, 0x6a87e040,
-       0x557d7ca8, 0xa02b0606, 0x843a8758, 0x7e4908ff, 0x40cc5016, 0x93e6c215,
-       0x05506067, 0x61ab1ff2, 0x281f9737, 0x5f9406af, 0x00073506, 0x15e5ac6f,
-       0x00000368
+       0x00088b1f, 0x00000000, 0x51fbff00, 0x03f0c0cf, 0x1894738a, 0x18357a18,
+       0x326b3618, 0x31686830, 0x20318830, 0xaf8568e4, 0x9fa65371, 0x8181959b,
+       0x81f98817, 0xd7881058, 0x6c303133, 0xff5e2260, 0xfb045111, 0xc303209e,
+       0x197f2051, 0x6614ee90, 0x64055860, 0x2fe2031f, 0x1080be40, 0x100c8303,
+       0x606115ff, 0xc1d20530, 0xc4036c40, 0x9bf145c7, 0x7c80827f, 0xbf2a08bc,
+       0x279f8d1b, 0x25ff5f8c, 0x0ff2fc11, 0xc363c808, 0xc7e41632, 0x7a052247,
+       0x29370207, 0xca8ff2a2, 0x543c3033, 0x51d06060, 0x919bf082, 0x6280ede4,
+       0xec21e4c7, 0xb8c09229, 0x28b5ca07, 0x2a773762, 0x5004fe50, 0x34894bce,
+       0x41d3dcf7, 0x8434afe5, 0x3ebc00d0, 0x03a8e414, 0x000003a8
 };
 
 static const u32 usem_pram_data_e1h[] = {
-       0x00088b1f, 0x00000000, 0x7dedff00, 0x45147809, 0xf4f570da, 0x73264cf4,
-       0x10909264, 0xa70930ae, 0xe15c380a, 0x1084ca30, 0xa8ea2416, 0x1388a888,
-       0x2e421081, 0xf57175d1, 0x11c3a7fb, 0x9e375941, 0x1d47facb, 0xa22cdc10,
-       0x60188806, 0xb200c1c0, 0x1761bb8a, 0xc363d715, 0x01921a0d, 0xe5c58f15,
-       0xeaadf7ab, 0x44ceee99, 0xeff3eba2, 0xe3fdfb7e, 0x575453e3, 0xef555bf5,
-       0x5dbd6f5d, 0x71024a31, 0x02e426f6, 0xf211c6fc, 0x4908488c, 0xe36d9689,
-       0x1749c7c3, 0x92cde442, 0x8840ad6b, 0x343dbaf0, 0xfb21046e, 0x33010956,
-       0x587687ad, 0xd3f5a109, 0xcc07d735, 0xd43eb419, 0x9afac1ec, 0xbee7ac1c,
-       0x48c3aefa, 0x8aafa5eb, 0x761ba846, 0xdb34729c, 0x37372908, 0x7d05723d,
-       0x24557e1e, 0xc450e9ab, 0xb240c535, 0x471e3908, 0xad196fd8, 0x685212a7,
-       0x55d2d561, 0x3cc2673b, 0xc4cc1a8a, 0x6e94e142, 0x15ed7b99, 0xaf773eb4,
-       0xe94ba044, 0x77534ada, 0x10179f5a, 0x68bea0ea, 0x4e3887c7, 0x545278db,
-       0x4f908837, 0x35c471fd, 0x4d1dd680, 0xe7d137a9, 0x130d81c5, 0x7af17fa1,
-       0xfda06dc1, 0x7e766b8b, 0xeb8bf004, 0x8522bea5, 0x4ad6bf3f, 0xd8d9035c,
-       0x63ac0817, 0xdf30b5ce, 0xc4483fd2, 0xe745eb4c, 0xc01136ef, 0xe4dab191,
-       0x8ff8c3b5, 0x18765c9a, 0x51c716a7, 0x7bfa59f0, 0xaf7d0e3a, 0x0dc165ec,
-       0x10332b4b, 0x75a7cc1f, 0xf3fa658b, 0xa5575836, 0xbfbc3fa9, 0xf41341e5,
-       0xd8281b9b, 0xfcc1716c, 0xc2269956, 0x99566b3c, 0xe145070a, 0x517dafcd,
-       0x2be3af33, 0xa9f574fb, 0xa7e5f5da, 0x735a8a7e, 0x884c5eb4, 0xf306cea7,
-       0x1fae980e, 0x547e7d1c, 0xcf7a4448, 0x2b8915af, 0x529f0a2e, 0xefcb9f1e,
-       0x1f027fd2, 0xd607b76c, 0xb5e94466, 0x8eff09c0, 0x93acebd2, 0xce18cfd3,
-       0xca57c352, 0x740e8047, 0x277ed53e, 0xd3f98f96, 0xefc27cb0, 0xe53dbc42,
-       0x4ae5881f, 0x3f9f1bbf, 0x658d1fed, 0xe583df8d, 0x5849feb3, 0xec5efc06,
-       0x1d3fdab7, 0x1f7e35cb, 0x5fc17f3e, 0xbfad6584, 0xf3af9f02, 0xbd72c42f,
-       0x2fe7c65f, 0x596197fb, 0x72c6afe7, 0x96257fa3, 0xf600fef5, 0xd7e9ccdb,
-       0xe7c3afe0, 0x580dfd5b, 0x2c21fd06, 0x62f7f877, 0xd5e382b9, 0x8c724d91,
-       0x0f0e2f14, 0x20715271, 0x1c9ef949, 0xbc93d689, 0x433a9eac, 0x7ad131ce,
-       0x29d68faa, 0x8497ba9e, 0xdeb4cc72, 0xa7b582bd, 0xc7c6403f, 0xccba7ad1,
-       0x785733da, 0x3d685bc6, 0xf7b59ab3, 0xc7c791af, 0x00ff7ad3, 0x7d74bf6b,
-       0xd695bc68, 0xed63ad2f, 0xd7248243, 0x4243eb46, 0x9f6c3eac, 0xeb4ed727,
-       0x3d589ac3, 0xd73923eb, 0xcd59eb41, 0x2db1fdec, 0x5a04dca1, 0xed661b1f,
-       0x166f9d57, 0x67f8315d, 0x459be4b3, 0xf2032d28, 0x1bb18f14, 0x777c9bad,
-       0x97c53713, 0x1c63d53c, 0xc923f143, 0xbe4bbed8, 0x4c1bdb1d, 0x27bfb632,
-       0x56fb6217, 0x27ed8029, 0xdf6c72e5, 0xfb600a6a, 0xac42f2b7, 0xb610a507,
-       0xb12b2adb, 0xc214d07f, 0x87caf4f6, 0xd4877db0, 0xcaeeed8c, 0x877db1c7,
-       0x1fdb19a9, 0x99e3525b, 0x0b0feb40, 0x2f81a7be, 0x22be0b17, 0xadf807d2,
-       0xf94bcd2e, 0xd3204aad, 0x0117bf81, 0xaaf6d253, 0x47d4266e, 0x7ace3f9b,
-       0x6f38145e, 0xe17a8176, 0x20650f0b, 0x8e11e79c, 0x1788e144, 0xc9f59387,
-       0xac9c0d68, 0x38148a4f, 0xa58e11eb, 0x7f367073, 0x9f3b5632, 0x38158a4f,
-       0x149192af, 0xeb73bd8e, 0xb65bfaca, 0x2b7f3e76, 0xc0ece051, 0x6e7624f9,
-       0xb4c70d3e, 0x163869f8, 0x389bcfc1, 0xcdce949f, 0x2d71f467, 0x8f1f467e,
-       0xe109a7e0, 0x9c1ceb74, 0xfc5ae386, 0xe08f1c34, 0xd38403e7, 0x1aeb73ab,
-       0x9f8b427d, 0xf82227d1, 0xc9f88c39, 0xad9c1ce8, 0xd9f8b5a7, 0x9f823a7a,
-       0xbf4e10cf, 0x6c6badce, 0x633f16ab, 0xf9f8235b, 0x4975d702, 0x6d6ce0e7,
-       0x6b67e2d5, 0xdf3f046b, 0x9dc19c21, 0x36d8d75b, 0xb6c67e2d, 0x1263f045,
-       0xced0ce00, 0xa5f827cd, 0x2fc13f16, 0x4049f823, 0x373b2338, 0x5a73ec9f,
-       0x8b9f64fc, 0xe10d27e0, 0x9c1ce98c, 0x7e2d39e0, 0xf822e782, 0x573840c9,
-       0xd95d6e76, 0x93f1695f, 0x3f0455fd, 0xf7400a97, 0x421f3e1c, 0x863bd8e1,
-       0x2d3be3b3, 0x177c767e, 0x9c70cfc1, 0xcf9f1e4f, 0xf55ce045, 0xae7e2d0f,
-       0x3f0447fa, 0x726708d9, 0xf8ece0e7, 0x3b3f1687, 0x4fc111fe, 0x9aebae1e,
-       0xaaebadce, 0x5cfc5a0b, 0x67e18175, 0xdcbad1d4, 0x6d4eda04, 0xafa45ba3,
-       0xf1ef3b8c, 0x3a2eb408, 0xba745d59, 0xa22df809, 0x26908fe2, 0xb7df488f,
-       0xf61c4fad, 0x25fb5110, 0x75826fe3, 0xa697a9d9, 0x46124bf6, 0xa0fc6bc7,
-       0xa6924f44, 0xbba93c9e, 0x378a7fa6, 0x75ded353, 0xf69aa5fa, 0x9a61be6e,
-       0xb1a28f7a, 0x2abdfe9a, 0xbdea6bc6, 0xe9ad5e17, 0xa0df219f, 0x7659f7a9,
-       0xbf7fa6ab, 0xed353bea, 0x6b165603, 0x2c092fda, 0xab2fd4d0, 0xffa6a5fd,
-       0x9a45bae0, 0x1e1bcbf6, 0x0d0fb4d2, 0x0fa9a63d, 0xa6b4fbdf, 0xd5a6c8ff,
-       0x0751f69a, 0xc7da69d7, 0xd4d46f34, 0x55b938af, 0xf0caffd3, 0xb8fa9a1b,
-       0xf4d2dfaf, 0x1e7394a7, 0x45d78cbf, 0xfb820b90, 0x099bb902, 0xdd90c5fd,
-       0x77537584, 0xd827db1b, 0x29475d0b, 0x9f064ddd, 0x812d0bab, 0xfdda84e6,
-       0x0345ee9c, 0xdc5f299a, 0xc037d63b, 0x6bdf9f49, 0x8cee5df2, 0x7e509fe1,
-       0x941a4811, 0xfa94032e, 0xc62507f6, 0x9c7be3af, 0xbe887fef, 0xf7086e5f,
-       0xbff5a44f, 0xc002721b, 0xd4082fdf, 0x157ca7eb, 0xe80a922f, 0x1e266f17,
-       0x3307dfe0, 0x55979eb2, 0x17acbcfc, 0x0a215395, 0x4be49977, 0x5d643f03,
-       0xf832bbe5, 0xe8bd5529, 0xf213baba, 0x486ef0a2, 0xefdf4bee, 0xa3e69855,
-       0xea26ccf0, 0x37c7abe7, 0xe107f1d1, 0xcfc075f8, 0x94fc619b, 0x339be3f6,
-       0x8fc66b47, 0x8cd22f4b, 0xe3a2671f, 0xafbea93b, 0x4f8f98fc, 0x90963289,
-       0x38c7c26d, 0x08bd39be, 0x44d07fc7, 0xf1ea3df7, 0x87e323e3, 0x3a7bfd60,
-       0x58e67f5a, 0x8bd3faed, 0xb137ebb5, 0x7955bff5, 0x8f1f8f8c, 0x385b7feb,
-       0x5e9fd6c6, 0x666fd6cc, 0x3be32370, 0x826ff822, 0xd1d7bff5, 0x6b64fbfa,
-       0x44bbdfd7, 0x1b337ebb, 0xa795afff, 0x1c36f8f9, 0x34e143ff, 0x12ef7f5b,
-       0xf664df1c, 0x4c7f81b9, 0x022be23d, 0x93d27c74, 0xc0aeae2a, 0x281c742e,
-       0xa6512607, 0x2149e427, 0x6f71e713, 0x73b7e33c, 0x50df94f1, 0x9cf8c91f,
-       0xa3e6a804, 0xce329cfb, 0xe7d7f3fb, 0x616f4098, 0xccefdd3b, 0xdd9d53e1,
-       0x937f2220, 0x7e81cc27, 0x0dadbe74, 0xd9f50ca2, 0x00195c4f, 0x266e58fd,
-       0x3de17877, 0xf3c10923, 0x5e0e4f63, 0xbe975ead, 0x1d2d539c, 0x17c8d66f,
-       0x9e3c8f9b, 0xf3a0ac0c, 0x182603cb, 0xa71fad19, 0x98d829fb, 0x12fba61e,
-       0x74484f28, 0x28fcfa3c, 0x01916fdd, 0xc4a9b96a, 0x79ec88f7, 0xff9d2fb7,
-       0x3cfca234, 0x51dbceb8, 0x233c28a4, 0x1af1ffc3, 0x98f40021, 0xf9f74d53,
-       0x372ff92a, 0x170ef933, 0x02d58108, 0xff7d2bc7, 0x813efe66, 0x33f851f9,
-       0x8f9dec9d, 0x47b35c77, 0xedfdd070, 0x9c0d64ca, 0x6960485b, 0xb6ff7d1a,
-       0x62253b15, 0xe828be00, 0xe5f800b5, 0x7084897e, 0x429cda9f, 0xa0667106,
-       0x064e7df0, 0xd2e9e6ff, 0x9c1566d1, 0xc79c5299, 0xf333e74b, 0x7be7113e,
-       0xdedb4f8b, 0x31eac3bc, 0xcae5a10c, 0x494225cf, 0xb6915b7e, 0x6d0af6fd,
-       0xda858efd, 0xee0f5d3a, 0xfd640bf3, 0xba1cba73, 0xeb233bce, 0xf5a70ba6,
-       0xd66dbc59, 0xd0d64932, 0x4d736e91, 0x133dbc59, 0x4f104ed0, 0xf69f7ef8,
-       0x681f29fd, 0xea5773ea, 0xf8be71e0, 0xdffff4ff, 0x86f2ff4d, 0x5547c59c,
-       0x9bad2af3, 0xaaa8f8bc, 0xebdafcdf, 0x8179f535, 0xe7fd345b, 0xb4d02cae,
-       0xa79ea9cf, 0xecb59f69, 0x40bd4d2e, 0xffd34fbe, 0x9a95858e, 0x962bdbf6,
-       0x2b6fda6b, 0xbf53547a, 0x4d5bf7c5, 0xafa79bff, 0x3b0bb4d2, 0x466ef5e6,
-       0xddebe9bb, 0xf4fe928d, 0x7c026607, 0xc2b3f0a6, 0x69fd27ef, 0x77ea7e58,
-       0x7a095961, 0xc377ea98, 0xaf965616, 0xfa0de82e, 0x13ffe15c, 0xe83a4552,
-       0xeb3f3d4b, 0x4f9eaff5, 0x2c47afe9, 0x4b29433f, 0x3b05e204, 0x64fdc6d6,
-       0xdc37f9e5, 0x0ce782ce, 0xc9898965, 0x6ec6c965, 0xea0389e3, 0xb615fea1,
-       0x3a92e18e, 0x2041d701, 0x74029a4a, 0x976d41eb, 0x347dae9a, 0x29d96cf3,
-       0x2065f8e2, 0xdcc06393, 0x60187778, 0xfa6350fc, 0x3e61838d, 0xdeb1d79e,
-       0x56fe8290, 0xe2d27f8b, 0x7f00fda3, 0xfa4f2c5e, 0xdc7963a7, 0xa8f2c3ef,
-       0xc3cb08bf, 0x9b2c0afe, 0xfcb10bfd, 0xf9632fc4, 0x96197f91, 0x6357f57f,
-       0x12bfd079, 0x01fcf7cb, 0x1efd5b2c, 0xfd3e152c, 0x18eba14f, 0xae9cbfc3,
-       0x3ae9a8df, 0xf364e0c6, 0x187d74e1, 0x6fc31be6, 0xc8ce0fee, 0xe23f9548,
-       0xdb718c99, 0x4ece3c05, 0xc71624c8, 0xa62f63e5, 0x6fd09ae0, 0x3d040c09,
-       0xb7e0767c, 0x7d4e21fd, 0x4a2520f6, 0xd3ebc746, 0x3c43afd3, 0xeffa0f10,
-       0x974a0185, 0x96edf6e4, 0x8b578678, 0xc3224c81, 0xefde5908, 0x839df705,
-       0x49246eb0, 0x7dc07ef0, 0x5c063dbd, 0x7e020bea, 0xc5d7862f, 0x004373f6,
-       0xffa7f1de, 0x18e5059e, 0xe307f303, 0x4bf4451b, 0x3779e849, 0x67a237e0,
-       0x8834eecd, 0x99fb86f7, 0x9af7689c, 0x4fe2d6ae, 0xbf835abe, 0x55fc11e5,
-       0xfafe21a7, 0xc28ffb9e, 0x8784f11f, 0x8a3830dc, 0xef846fbf, 0x1e729fc7,
-       0x36ef1fa3, 0xf883f8d1, 0xc1552db2, 0xa13a536b, 0xf811fce3, 0x5b3fc29f,
-       0xf001203f, 0x1173811c, 0x7faf08fa, 0xe8fa0e9c, 0x16c9d034, 0x0e9f7785,
-       0xcfbdd9de, 0x5fefc03b, 0x47ca2690, 0x2959e063, 0x6432eb4b, 0x6a4fda9b,
-       0x56cfd6d0, 0xd0ea930b, 0x4c25719f, 0xd7fa0c1d, 0x40951f29, 0xa961a64f,
-       0x669059c0, 0x7d2871c2, 0x4faf5c98, 0xd4ffb944, 0x7efd871f, 0x047479ea,
-       0x7a8f3a27, 0x0fbe8472, 0x4fa17f2c, 0xe43bfdc7, 0x2617e353, 0xa091b388,
-       0x97fc0e74, 0x05fffa38, 0x46237838, 0xcb702bac, 0x7cd944eb, 0xaf5f3c39,
-       0xe7be8f19, 0x2f06ce52, 0x3c9f7e64, 0x8571c918, 0xa8a9a95f, 0x48d61881,
-       0xac8b5be0, 0x35128ff5, 0x6e86f2f5, 0x825fc6b2, 0x4a3d507f, 0xf023048a,
-       0x9f67094b, 0x996da336, 0x0bf7e740, 0x3e816208, 0xd2bf5810, 0xcf9366b8,
-       0x78b2fc05, 0xe82e15da, 0xd5eb8d59, 0x2fd28fcf, 0x3c7528c3, 0xd9e2f9ff,
-       0xe431bd7b, 0xdbd72763, 0x57160625, 0x03b27120, 0x9a48d7ce, 0x8ec1b8ec,
-       0xf045b353, 0x3a3b7183, 0x0a0f0a8e, 0x2901799c, 0x995ff5ac, 0x5818b65c,
-       0xee3f40bc, 0x94dc619f, 0x6cafe38b, 0xb089fefd, 0xcb1e3d6e, 0x7c98ce1a,
-       0xbff45728, 0x151e28ac, 0xf442fefc, 0xeba459fe, 0x843dae2a, 0x9293eafb,
-       0xeffeffdc, 0xe7ed8bd1, 0x6e3b4b6f, 0x265bad55, 0x9dce304d, 0xc440f9a3,
-       0x5487f375, 0x5b7a9f5f, 0x5d010f22, 0xaa5ed3ce, 0x828f5079, 0xfea2b218,
-       0xf3f59dfa, 0x9f7ec1f3, 0xf7053cda, 0xd789b32b, 0x22ca4101, 0xfe059d52,
-       0x986269f9, 0x4d3a7804, 0xae18ecfe, 0xd139d3a2, 0xfea1f484, 0xfcf561fb,
-       0xa9aeffa8, 0x535dff53, 0xa437242f, 0xe178f9c2, 0x08091213, 0xfb4d3eb8,
-       0x7089d171, 0x2a8a92e7, 0x4b1677f0, 0xe9dfaecc, 0x541ec624, 0xf6be979f,
-       0xad01564c, 0x7f32277f, 0x9def3944, 0x377b7547, 0xb75c5eda, 0xeda1e4ca,
-       0x4f87ea47, 0xfbc082bb, 0x3fb02a81, 0x7b82abf2, 0x7e3dabad, 0xf5fce87f,
-       0xa1fc55f3, 0x7ccee776, 0x82b5a51e, 0xcf831027, 0x67c646ac, 0x30f63f0a,
-       0x8df1353a, 0x70faba01, 0xae9c7d5d, 0xbde5a3fe, 0xfbc8d10b, 0x00df442f,
-       0x6f930a63, 0xc609dfd8, 0x8ff3f230, 0x0ed69f86, 0x149ff0fe, 0x9cad4f7e,
-       0x7ee3f851, 0xdb7df852, 0x2c4a7fcd, 0xbdafa5f8, 0xfaa659b4, 0x2795f8a9,
-       0xa7ea841d, 0x54eac653, 0xc97fa537, 0xe00ea5da, 0xd9469383, 0x2a7cfc01,
-       0xc40a4e20, 0x8c8b77d0, 0x3daff702, 0x6fe20136, 0xff0a4ff0, 0x5f0f75d3,
-       0x7387710b, 0xc627256b, 0x21cd6ad5, 0xb2d39533, 0x64f979fa, 0xb10fd608,
-       0x446783fa, 0xf96837a8, 0x4f77f8b3, 0x5f50baa6, 0x180c3dca, 0xffa10e3f,
-       0xd8e6b65f, 0xe5fbb044, 0xa6728c24, 0xffc60f7f, 0x53ed093a, 0x7da12981,
-       0x53e46e3b, 0x2bf67de1, 0x8cf87faf, 0xf27280e8, 0x7427d009, 0x03f184e7,
-       0xdc457bfd, 0x68dbbf9f, 0xf3f182ef, 0xe8146451, 0x242f0531, 0xf179fcc0,
-       0x408667b5, 0xcd65b51c, 0x85410edb, 0xcede452f, 0x6e7acdd6, 0xbd63abab,
-       0x51e54ad9, 0x7e2a47ed, 0xef81ab85, 0x2cac8243, 0xc80e4291, 0x255929ab,
-       0xb8fa65b9, 0x5fe7a5e4, 0x9ae21a78, 0xfddd981f, 0x2ff9fc28, 0x2c6f7eed,
-       0x20dfcfad, 0xcb67c975, 0x51a909b0, 0xffd394fa, 0xd28b0e17, 0x6ed378a3,
-       0x7b306b93, 0x945240fe, 0xec37f32e, 0xedc19134, 0xb75b91f1, 0x8b6cd4d3,
-       0x43ba9f41, 0x130fc113, 0x04cefb5f, 0x43b53ff4, 0x62335d20, 0x6ed573e0,
-       0x4f00d3f4, 0xaf4e4f48, 0xfd74fd08, 0x405d29cb, 0xa5e9ebaf, 0xf41537ef,
-       0x0b830a4b, 0xbf9412f9, 0xf90ade5f, 0xbb357f48, 0x2f450f01, 0xf580eddf,
-       0x3056309c, 0x69667f3e, 0x5f8e87aa, 0x4ea9c924, 0xa2f3d92c, 0xfc8e7f67,
-       0xcfff7737, 0xcb5c5953, 0xb680cdd3, 0xeb06ee4a, 0x1373539c, 0xf890b3ae,
-       0x9e8b0f90, 0x2fa0bd11, 0x499234bf, 0xc9c8621b, 0x4e4e5cb7, 0xa5c4a6ac,
-       0xcd413ceb, 0xfce9e610, 0xc5ac0c59, 0x185dfa38, 0x5f39fb37, 0xb0e8f50b,
-       0xa31c65fe, 0xc0d19357, 0xeaf52ef5, 0xe6bbfcd5, 0xd3a026c1, 0x5d3cbda7,
-       0x9ca5fce1, 0x0f8e6518, 0x2b8502e1, 0xcaebcfee, 0xc65c44e8, 0xf51efe2c,
-       0x39e172cb, 0x3c926ff4, 0xf79a2196, 0xe88c85c8, 0xf1f0f7f8, 0xc1e3bce9,
-       0x1a913a9f, 0x40305f7b, 0xb502ec52, 0x533e2aeb, 0xff933bc9, 0xbc99cb35,
-       0xb81ff22b, 0x7fb4127e, 0x11c98071, 0x92f607bc, 0x15d42bce, 0x154e77db,
-       0x49983f50, 0xaf9c9628, 0x6b9cb891, 0x42fcf5db, 0x12146fe7, 0xe3037c54,
-       0xd01d2124, 0x827c2a9f, 0xa3d2afbe, 0xa3ae30e5, 0x8e455c3d, 0xf07d72e7,
-       0x6b03e825, 0x1a901f54, 0xf63a07a6, 0x53c4657b, 0xe1781489, 0x2a5f9069,
-       0xe40bb2af, 0xfac2f257, 0xf8df5b3f, 0x6e54adde, 0xe453ab3e, 0xf557ab56,
-       0xf1b45b72, 0x54f804e7, 0xf59fb72f, 0xe53120ac, 0x298f3e96, 0xff9b3db7,
-       0xc1557a25, 0xd5a4ba63, 0xec9e8aab, 0x3d7a9f08, 0x42e8c5b9, 0x24f5eabc,
-       0x59201dfd, 0xe151f9ed, 0x8aff8543, 0x0ded2c5f, 0xa7c228fa, 0xf8461f0a,
-       0xfd43e154, 0xd478b5ba, 0x9e7c63b7, 0xcb778bf2, 0x507b13bb, 0x050496ba,
-       0xef85d9b7, 0xc53a81ed, 0x0b6d8797, 0xe8f4f7aa, 0x7407aea2, 0x7f5d3af5,
-       0xd5eeae8f, 0xeae9f7f5, 0x01feba15, 0x68694fb6, 0x87e41134, 0xb4bfa690,
-       0x9f90c888, 0xe22ede16, 0x9d1b41b9, 0xbf7d1573, 0x40467d6d, 0xa961faa6,
-       0xc3dbed85, 0xd02aa629, 0xb0ce6d67, 0x16ea0923, 0xf36b7f16, 0x2a891d86,
-       0x5050f1ff, 0x1cdc7d44, 0xed629320, 0x8bc7a85f, 0x1d266bf4, 0x90f3b3b5,
-       0x10c778b6, 0xb44f2f18, 0xf8842fa5, 0x86e8b54c, 0x95d98e23, 0x5ce03b37,
-       0xe7d82da2, 0xf9f4e9ba, 0x2c883f9c, 0x18f6422d, 0x0df6a9bb, 0x54fc8927,
-       0x95f900b6, 0xb3fe902b, 0x311f6c82, 0x7e6c457b, 0x15efe62e, 0x8131eeda,
-       0xfffea4de, 0x5f5c7561, 0xa3545381, 0xc29c1e7b, 0x2fed9ef9, 0xdb68d78b,
-       0xfa3f7c7d, 0x0fdf0a5f, 0x7ed94325, 0x0838b090, 0xe279bbd7, 0x53a6eba0,
-       0x15edb43a, 0xd9cdf009, 0x387488a0, 0x40085ebb, 0x29c88a5c, 0x24653f28,
-       0xc14efa8c, 0xc7c80b57, 0x50f58e80, 0x671fabcb, 0x94bb4fdd, 0xc870fe6c,
-       0xcb65a5ff, 0x6ffa0fe6, 0xef6bfa83, 0xda487fa7, 0x61ddcff7, 0xb6df73c1,
-       0x27cc761d, 0x4efedb6e, 0xdf50fdfa, 0x3cc37662, 0x357c76db, 0x6da8f804,
-       0xf408b991, 0xb62f5b58, 0xfdbc59ff, 0x68cd21ab, 0xfd20973f, 0x8b13256a,
-       0xfeff04d7, 0x4a05d089, 0x0ff02aba, 0xf9727e78, 0x20804b56, 0x7cb2affc,
-       0x3d6e9fb6, 0xbf9cfc65, 0x6fa64ecd, 0xb225f984, 0x6df2ec73, 0xa4af9e63,
-       0xefd697e3, 0xeda2cd34, 0x377fafb9, 0x3791f304, 0x55a7bf32, 0xce167e6a,
-       0x6f4937b1, 0x9e28922e, 0xba38415b, 0x299d7213, 0xc5b6572e, 0x1877cbc2,
-       0x3e2cea97, 0x7ed892de, 0x1f1fdff4, 0x9511e602, 0x3881ed04, 0xcdfdd601,
-       0x3e821f27, 0xbe4661d8, 0x59fbd654, 0x23fa255d, 0xa9f75b17, 0xd07c31ff,
-       0xa10b75d9, 0xce3bacce, 0xeebdeff4, 0xce172447, 0xed072f4f, 0xbdfb7cf9,
-       0xeec97f58, 0x9276f9c6, 0xfe9a07df, 0x237df8c3, 0xe2e3bba5, 0xbfd9feeb,
-       0xa63bbaf9, 0x72661ffb, 0x1f213bba, 0xeff5fcac, 0x543f7e70, 0x1ffdcdcf,
-       0xbf8af7ca, 0x9b78366e, 0xa6fce872, 0x383b6a93, 0x9ca4b716, 0x73a907dd,
-       0x745f5ee6, 0xfc4af981, 0xbf3f51fc, 0xefb62695, 0x997ce093, 0x126e4b8e,
-       0xed8f7ef8, 0xfee5ae93, 0x0b3db5c5, 0xd6bd2fd1, 0x6277fcc3, 0x46737af4,
-       0x6cd89e40, 0xc943c637, 0xa83e83b0, 0xaf2574df, 0x7f8bf76b, 0xa0478814,
-       0xe9b5f9fe, 0x9f82f693, 0x634f5d7a, 0x43caccc8, 0xe0ebbe50, 0xf76b47cf,
-       0xb4f8b733, 0x6ba79bf5, 0x787137eb, 0xa2b9c0d3, 0x0af34fe3, 0x4a7f8801,
-       0x81489ebd, 0x4734a878, 0xf9008222, 0x614b1524, 0x579370df, 0xb03dfefb,
-       0xc5191dcf, 0x82b8bce3, 0x114e70f9, 0x7c405037, 0x4442b75c, 0x4837127d,
-       0xd1def840, 0x1e1de612, 0x00b37833, 0x47c3f9cf, 0x8192fd95, 0xe77ac373,
-       0x92157c71, 0xc877f40a, 0xb2170bf9, 0x4bee20b3, 0xe79a5fd0, 0xea1ae421,
-       0x0b6617b7, 0x63c878a1, 0x61391231, 0x0543c418, 0x0f135872, 0x77e1d6d5,
-       0xce146a55, 0xc477fac5, 0xf9753f8f, 0x87ffca37, 0x433fea25, 0x2cf3e789,
-       0xb3eca7ae, 0x3c3208ee, 0x81089796, 0x90abe44c, 0xb0cf3ea4, 0xfdff1999,
-       0x28e181ed, 0x1ebf3957, 0x7ff6c09c, 0xa0bbf023, 0x9e67ee72, 0x10095d95,
-       0xec1b38f7, 0x72d1cfc3, 0xfc18be1d, 0xbbef9fbc, 0x007902fe, 0x209b6cb4,
-       0xffe08b54, 0xfbc63093, 0xb21609e4, 0x5cbe4636, 0x8739498b, 0x207dc0af,
-       0xa02cc4fc, 0xa5cdfb23, 0xa92426af, 0x9ae2b6e8, 0xed21c653, 0xc3bf00e9,
-       0x7e4bce31, 0x3cfb096c, 0x4b7eebc0, 0x8c6f44f3, 0xcb83fef5, 0xdf1bfe6f,
-       0x376377e0, 0xc0243304, 0x44130dcb, 0x39eaf9cd, 0x87e3f713, 0xaf30e193,
-       0x3b2637fc, 0xf65d00c6, 0x4ef86e8a, 0xc6783cac, 0xce718be4, 0xc027c7a4,
-       0xc90073c7, 0x3cf8085d, 0x810b2bf2, 0xfc3bd6fd, 0xe41067dc, 0xadc20f61,
-       0x4ce207bd, 0x0b8b3366, 0x713b30cd, 0xe7e6379e, 0xdc742948, 0xa1cef541,
-       0x9dd5f470, 0x46019ff7, 0x5124246b, 0x7e94f7b0, 0xbf584bdd, 0x59672643,
-       0x113ff5ac, 0x733ae2c7, 0xd1defb89, 0xdd1fbfc2, 0x0f6d7e72, 0x327b078d,
-       0xd8e77d81, 0xca09af9e, 0x4249d9c7, 0xec3df400, 0x2f9eb09f, 0xc779bda0,
-       0x1be5dac0, 0xf8565e98, 0x11e78f5e, 0xf8cacf1c, 0x0c7d7953, 0xcf052f97,
-       0xf3f57e0a, 0x7d53fa55, 0x8f1d4e35, 0xe861aeb8, 0xcb0f60cb, 0x40d38282,
-       0x9b199541, 0xe587204d, 0x104a8f0d, 0xc5c5bf8f, 0x307b52e0, 0x3bfe7d44,
-       0xe1ceccc3, 0x315d871b, 0xf3e4f813, 0xa12fd415, 0x9f667bef, 0x7ddd8071,
-       0x13fee0c7, 0xff29077c, 0xbf6b2451, 0xe87d5f47, 0x904f1677, 0x703370d4,
-       0xe496379e, 0xb93e1048, 0xd4a764ad, 0x334fc555, 0xaed849cc, 0xe25eef3c,
-       0xe9cf061a, 0xf90f3878, 0x3c813311, 0x4d7541f2, 0x6ddbfdf8, 0x0f8c8915,
-       0x9a76ea8b, 0xfd819eb0, 0x7194f195, 0x3534f2f4, 0x341f9b5f, 0x27b9b72b,
-       0x1cdf25e0, 0x831dc7ba, 0x95982f4f, 0x681f8873, 0x6f943c27, 0xb22ffc87,
-       0x7628f713, 0xaaf259a2, 0x34de49f2, 0xd9573933, 0xecb1ae89, 0x574a82c4,
-       0x82c3a057, 0x82ba7ded, 0x43f82c90, 0x3b2c6a5e, 0x9d9faef1, 0xbfcfbe2b,
-       0x4a9b6d23, 0x2ae5c4ed, 0x82d5313b, 0x6f7fa27c, 0x7693b983, 0xffdba142,
-       0x2ef37d63, 0xf21889d8, 0x4fe38bbd, 0x82d313b1, 0xa6276805, 0xdf35154d,
-       0xf3336c5f, 0x76877178, 0x16f52722, 0x6b6e4bac, 0x9779fe0c, 0xf3efc3fb,
-       0x07183c3c, 0x5cb7c5ec, 0x46edebff, 0x371d7a47, 0xa13b2335, 0x7845ffd7,
-       0x02faf456, 0x339b2fea, 0x4121f162, 0x0b705e7e, 0xf002ebd5, 0x0bebd323,
-       0x3171e76e, 0x82f59e9d, 0xd6a11d9e, 0x32fdecb3, 0xe50bb31f, 0x99bf190d,
-       0xad6fdb41, 0xb471dc96, 0xbd51adff, 0xbbd6a59b, 0x77a476df, 0xfdde988b,
-       0xfd1c383c, 0xf7d68ea7, 0x54b7d731, 0xc775f59f, 0x33e98fe0, 0x77ef9aac,
-       0x737d0c8e, 0x979026d0, 0xd73c4477, 0x80fdc63b, 0x1cdf437d, 0xe9eaf101,
-       0xbbe44671, 0xad9e9cbe, 0x813c527e, 0x36772fe2, 0xd74ba7f3, 0xb2bf888b,
-       0x65ff267a, 0x45c042b5, 0x7d8713eb, 0xfcfa8263, 0x8e7ceced, 0x473f20ae,
-       0xeff9ff45, 0x3c415734, 0x012afe78, 0x1f2117cf, 0x9739f01a, 0x3dd0b3e3,
-       0xfa2bf71f, 0xf1e5833c, 0x72e4d58e, 0xd3f18784, 0xdf3fde52, 0x72f8c61c,
-       0xf704effe, 0x1f3ed22a, 0xd5efb4a1, 0x319f60a7, 0xdcf756bf, 0x11cf1cbd,
-       0x718b5fa8, 0x6d3ad2d4, 0x4ff71e7b, 0x41a188e6, 0xf57f609b, 0xcb1dd127,
-       0x22fd29de, 0x27fa29f8, 0xe29fb3f1, 0x874fc467, 0x9dc1799f, 0xa1fe5f18,
-       0xe3e3d178, 0xbf5c7167, 0x4023230c, 0x3c198f1e, 0xb7e45fa8, 0x9923cc44,
-       0xcd3f68fd, 0x7137043d, 0xe0c779be, 0x5f3c82ab, 0x9be58cb9, 0xb0d9adcc,
-       0x67d6953b, 0x10a191d4, 0x52bb9e96, 0xf6238f6b, 0xfcc5debf, 0x020d8a82,
-       0xe1ce15e4, 0x051509df, 0x1b7bc51e, 0xed485f6e, 0x6b3fed3d, 0xe707d998,
-       0x612dfba3, 0xff0a9fd4, 0xf263892e, 0xe3cf88b4, 0x04f0f748, 0x820d53b4,
-       0x6432e513, 0xd28b7661, 0x6893ee09, 0x44d5f31c, 0x8f16174e, 0x2c746068,
-       0xb90374a7, 0xf5e4189e, 0xde0fe63a, 0xcec33c16, 0x253b82b5, 0x40852f76,
-       0xb9df5192, 0xd8acff71, 0xcb673847, 0x77d15549, 0xffc621fb, 0x3e37056b,
-       0xfeffd008, 0x4076fa19, 0xe99fc557, 0x3c157d2c, 0x79d1d12d, 0x7f29a5bf,
-       0x08d79e38, 0x23a7bc6e, 0x0be78898, 0xbdd9ab47, 0xfe718f13, 0xec05cbd7,
-       0x60f7d43f, 0x87130f5c, 0x1649d37c, 0x71c3ebcc, 0xa67f9933, 0xd6508efd,
-       0xd0fd01e4, 0xd272953c, 0x34597e84, 0x34e7ccbf, 0x249fdd83, 0x5f79b518,
-       0x9ffb9461, 0xdfdbfe00, 0xc5a49f07, 0xdbb97da1, 0xf6369ec9, 0xf4191132,
-       0xf90932fb, 0xeb8366e8, 0x2fd06cbd, 0xe404490f, 0x237df3e3, 0x05d19fdf,
-       0x8fe445da, 0x97867782, 0x80a48841, 0x829126e5, 0x3a5d98fb, 0x2bffc7c2,
-       0x019ed7b5, 0x83f0487c, 0xf80189fd, 0x7baa6cae, 0xe20b9e67, 0x2ff62326,
-       0x1bb1f385, 0xbdef9d73, 0xce5c7407, 0xbc395bee, 0x69f7172c, 0xa025df77,
-       0xf4a41d9c, 0x4d373802, 0x3def78cd, 0x97dbbf3a, 0xd739e0a5, 0x34ca4f0c,
-       0xb19af738, 0x68bb744f, 0xd9d759bf, 0x364e706d, 0x7c48a065, 0x4edcbc2a,
-       0x334e309a, 0x9baee2a3, 0xa88a4e40, 0x547b843d, 0xf3fb828a, 0x46bd42ba,
-       0x65cbf7c0, 0x9d2ba99f, 0x33cad35f, 0xfc7411a6, 0xd00fda42, 0xfac35e5d,
-       0xdc11af95, 0x185baa90, 0x64f5147c, 0x2f011ae1, 0xfea268aa, 0x1b831c6f,
-       0x9b70a388, 0xb4fbe86a, 0x07de173e, 0xa7126bb8, 0x395679c1, 0x3fbe279d,
-       0x25cf12ba, 0xb47be90b, 0xb9ad3499, 0xabcde10b, 0x6f7c0811, 0xe33a3454,
-       0x6f00d191, 0xf686e49f, 0x16fe77f7, 0xd2664af3, 0xf851baf1, 0x3ce6c4b3,
-       0x2fddab8c, 0x93bef138, 0xee517dd9, 0x91dcb8da, 0xb9d87d81, 0xef9440b4,
-       0xfcea8c7e, 0x96164184, 0xb0b85d07, 0xd5d60ab2, 0x1864a72c, 0x98ce9f90,
-       0xa51f8ec0, 0xff51f6f8, 0xe58988f5, 0x47ca343d, 0xfd2acd4c, 0x07d2d939,
-       0x437671e5, 0x3999ea0e, 0xe7e78bc4, 0x8fe64abe, 0x096a5a1c, 0x4987e008,
-       0xde7874ce, 0xcf8cd4b8, 0x76625f5b, 0x3357b5a7, 0xd44f43c6, 0x87be0448,
-       0xe7d35c5a, 0x89e3a029, 0x139e12f5, 0xa848cf8b, 0xc4bee6cf, 0x358d64e2,
-       0x5a89ee0c, 0x9f72dfa6, 0xe82269b9, 0x956bb9ed, 0x1ead6573, 0xa315742b,
-       0xc2c67a9e, 0x5f5e92f4, 0x5154f5e9, 0x76d8aaf5, 0xb1899ee8, 0x2acf50ed,
-       0xc0ecaf16, 0x9b13973e, 0x4186a7a2, 0x6941495e, 0x812b99af, 0x89676f9f,
-       0x2da14dde, 0x76093e5f, 0xf78ec4b7, 0x9d199503, 0x3f8c094f, 0x19ffe808,
-       0x825f0dc1, 0xb0cd143c, 0xc73ffde0, 0x47201e81, 0xdcf1922b, 0x805030b3,
-       0x2ef25778, 0xf2d4aee7, 0x7dce72bb, 0x1e244f8b, 0xb22afdb5, 0xdfaa8f12,
-       0xf945fffb, 0x47738e96, 0x08b01083, 0xe7b43f50, 0xeeb023e7, 0xe42d79c4,
-       0x3b0ac1fe, 0xf7fbf5f2, 0x7c0a599d, 0x8101f33b, 0x644edf80, 0xc3d8155f,
-       0x0b8295b2, 0x1f73b3e2, 0xa5cfef60, 0xdfbcc3ef, 0x2fe32dff, 0x902ee7ca,
-       0x479ab283, 0x35ff60f7, 0xbfe00b82, 0xfd00aabf, 0x24592289, 0x10e6bed8,
-       0xbda823ee, 0x46a3fcc2, 0x39054c59, 0x76625b28, 0xc2b779c2, 0x1e7f0a4f,
-       0x9351dfe2, 0x1b90f738, 0x00e77be9, 0x14be0c48, 0x7b110ba7, 0x2e53fc0a,
-       0xf43b7e33, 0x1106e492, 0xb27f38b9, 0xfe1567ef, 0x46ff8113, 0xb1aff944,
-       0xfc04d726, 0xe0202278, 0xf02e7cb9, 0xefe7f02f, 0xb10cf895, 0x8ba8fda9,
-       0x0f9ea7f1, 0xe51ff1db, 0x0af3d03b, 0xa8fc2a7f, 0x46c3c3e7, 0x7de60d32,
-       0xae0b52f7, 0xcb6ab723, 0xce4c85b4, 0xb7273cf0, 0x9054beea, 0xcb2342eb,
-       0x5af050fb, 0x4279646a, 0x44f5e6ed, 0x675ba9a5, 0x479ba7e6, 0x2a3d8b37,
-       0x63cb220f, 0xde71d109, 0xe63cff5c, 0x775e9dd3, 0x6ff45ae8, 0x003e51b6,
-       0x93b7affc, 0x0243ee10, 0xeb8a8fa8, 0x1be60f45, 0x3759431a, 0x4aeff6aa,
-       0x57fcc4fe, 0xe2ef88ec, 0x3e40e68d, 0xf378bf7d, 0x8e782191, 0xdff988bd,
-       0xfd013af2, 0x0f372263, 0x8a3def81, 0x438f2c8d, 0x613c17ef, 0x96f0fb61,
-       0xe0e9d62d, 0xecb509b7, 0xbae2af5e, 0x2ab3259b, 0x45b0fbbe, 0xb9e1fa52,
-       0x0ce94c8a, 0xfcc355df, 0x294af7d4, 0xbf2d1bf9, 0xdc57fc67, 0x573fa120,
-       0x15a1bb5c, 0x0f8af3f2, 0x5bbf719a, 0xf3067b5e, 0x795f738f, 0xd63fdd89,
-       0xb2f26a20, 0xd543e5da, 0x51ce788a, 0x798a5f56, 0xe78eb41c, 0x3c75651d,
-       0xe607e8ff, 0x657fcceb, 0xa29966fb, 0xdfa6fe70, 0xb09ef039, 0xfc0eb5a6,
-       0xfbf6a54e, 0xe5db13f3, 0xe72dd53f, 0x9cd74ff9, 0x631fa820, 0x0a7d3fe7,
-       0x947b80ff, 0x27fcda2c, 0x1bf4cb52, 0xac56679d, 0x7e2213ef, 0x3e5f4bd7,
-       0x2dbbf90b, 0x167b3f1b, 0x8ff25de6, 0xbc859fcf, 0x09d00a0c, 0xbaf94a7e,
-       0x51df3177, 0x85a0ef79, 0xff7e83ef, 0x6d17cc3b, 0x06ecc0fd, 0x4fdbad68,
-       0xd1ff83a4, 0x549be1ba, 0x67bd03c8, 0x77c61e7b, 0xb73579ee, 0x6f15892b,
-       0x6ff025e3, 0xaaf913a0, 0xd635ba7a, 0xc8fe6237, 0xd0774a69, 0xb6bc9113,
-       0x2f9652ba, 0x6cf9e2e8, 0x07e763eb, 0xab5fcbb7, 0x2bbaf1bf, 0x33d63f41,
-       0x79a2e13f, 0x3d28076c, 0x1d04ef2f, 0xc57cf3d7, 0x37be6bba, 0xfc34ed8f,
-       0x2bebd283, 0xf01f368b, 0xcf39facb, 0xf56d0d3d, 0xb1e61dc9, 0x3f813a85,
-       0xd1b8ff25, 0x83c431e2, 0x117c6d1c, 0x7e8107f3, 0xd7d02ef9, 0xbc43a65f,
-       0xc614a4f8, 0xbb7844b8, 0x2b7bbf19, 0xca3efede, 0xfbabeb53, 0xf097bf31,
-       0x1256e03c, 0x4d7cb1f9, 0x5f2a031e, 0x6ff96763, 0x1f900e9c, 0x73e072e7,
-       0xf8c7079e, 0xeb8fc95a, 0x6c6e2f28, 0xe38b267c, 0xd2e8bcf1, 0x3cf21f35,
-       0x84dd28b3, 0x43af40d1, 0xa8779bdf, 0x7809c1e0, 0xfbcea518, 0x18879d8c,
-       0xd1d4fbc9, 0x7a09e80d, 0x49d7923c, 0xbf213deb, 0x1fbc202f, 0x75b88f2b,
-       0x6d17cb15, 0x93dfb495, 0xf2c4e946, 0xebc64740, 0xb9d036e4, 0xad8bcffc,
-       0xa9e287e3, 0xc34bbc5f, 0x5abe0a37, 0xefd6c7ce, 0x7f85e3d3, 0xd9ab7bee,
-       0x82fbfe82, 0xfbe1e39b, 0x2643fa82, 0xf18bdf82, 0xddf2957d, 0xb5b78f12,
-       0x7f3113ac, 0x11aeaab0, 0x7f5ebbf5, 0x1473f194, 0xe38b7cfd, 0x6b2ade99,
-       0x65a3f660, 0xa3603da3, 0xd8de5a70, 0xb65d7c82, 0xf20990fe, 0x6ed4f6b1,
-       0x03bcb132, 0x3f604726, 0xb7f9aa02, 0x0873bcbc, 0x9f7e73ea, 0x859c7e91,
-       0x60f29c7c, 0xd7ca71ec, 0x338cd19f, 0x3933ae5f, 0xef1f176d, 0x66e7a353,
-       0x1369f780, 0xad3ea3f3, 0xfac52713, 0x78b6e6be, 0xababef89, 0x3b50fc99,
-       0xd93af78a, 0xa24e3dd9, 0xb2fd1e23, 0x0fa3ec7b, 0xf780fdc2, 0x47984dd8,
-       0xe792b8b1, 0x3b97fc5d, 0xd8bde80d, 0xf981357e, 0xaafc052e, 0xd392f7f6,
-       0x939fc047, 0xd423bcd2, 0xfcca30e7, 0x240c5d4d, 0xb7bf3ea0, 0xfb0aea4f,
-       0x7b946253, 0xcdae3cc2, 0x7608cafc, 0xe2cfc9b1, 0x91fce4fb, 0xc9bcf0be,
-       0x4c9ddce8, 0x104d36e1, 0x6d9a10dc, 0x7e0cf7cf, 0xd1e0ce24, 0x39095fde,
-       0xb3beb0f8, 0x89fa036e, 0x49c84376, 0xa5bb10bb, 0xb8370d29, 0xa632e22e,
-       0xe63cea62, 0x8fe43faf, 0xe7df0beb, 0x5b750839, 0xa8db9fa1, 0x61216fb9,
-       0xff7751b4, 0x97d03902, 0xe71b1fda, 0x675e2557, 0x70a6ff67, 0x875ef19b,
-       0x12a441c4, 0xdd8577d8, 0xe3c4fe87, 0x5f7e0f0e, 0x21037f46, 0xc48921df,
-       0xc1f7d5bb, 0xf73571d0, 0x3571d04c, 0xb68f44f5, 0x78c93c9e, 0x49bd9634,
-       0x2898f3e6, 0x890f10da, 0x2fee0679, 0xa5fbf27b, 0x989de746, 0x6821dc42,
-       0x7986c6bf, 0x64bc54e3, 0x366c3af5, 0xfce9bced, 0x61227a34, 0x606cb350,
-       0x773cd4f3, 0xeb809712, 0xd39f68f7, 0x7fea6af9, 0xcdf6e789, 0xefa08c48,
-       0x844d716c, 0x06acffe3, 0xde8c4bdf, 0x4cc254a4, 0x4e93cc26, 0x483fbe13,
-       0xe3a0ebe0, 0x213bfa6b, 0xd7c6c07a, 0x9d3d21c2, 0x2f06efea, 0xc6b076e7,
-       0xfa0a3dea, 0x0577ab26, 0xa766fa26, 0xc3a39e09, 0x0bb05b69, 0x85cca7ea,
-       0xad08e4b9, 0xaf8cd50b, 0x2820aefa, 0x2cc37d37, 0x892c858f, 0x1cd53f47,
-       0x30cb6447, 0xc88a1ef8, 0x251830d2, 0x5c9fcfc0, 0x94140c8b, 0x35e51971,
-       0x3c305efa, 0x128730de, 0x289a0ea1, 0x9ef143fc, 0xaafc61cf, 0x86697deb,
-       0x793cb0a1, 0x946caee9, 0x62204bda, 0xeff4a868, 0x4b257bde, 0x9f7b81f9,
-       0x0ddfec88, 0xa95ab876, 0xdf0ec553, 0x47c7576b, 0xaa389eea, 0x5933abef,
-       0xbfd8785d, 0x424f5974, 0x0af04b1e, 0x7107d056, 0x3cf14bce, 0xeb84942c,
-       0x517d98bf, 0x4d7039e6, 0x11f8c4f3, 0xf70a9e2c, 0x47b3f68a, 0x7b46c7be,
-       0xd4a6d6bc, 0xf0bfb843, 0xbd47efd6, 0x1fb75a56, 0xa7500ddb, 0xe6e4ef65,
-       0x29123d89, 0x79d5ac56, 0x5f809769, 0xa066905b, 0x5ac4bceb, 0xc1a8dbbd,
-       0x3c1a13c3, 0xa63d1718, 0x3f63c3c3, 0x3c970f08, 0xa1e218fc, 0x7ca6ebb3,
-       0xe94ad031, 0x80c72537, 0x3a8d37f7, 0x0bf8c368, 0x1ed059fd, 0x3aab3871,
-       0xd9568ef8, 0x6e3850a7, 0x97f0a380, 0x57c29ef2, 0x1f4df11d, 0xdd94bce2,
-       0x9fe5a7eb, 0x0c67ab02, 0xf56b1bc0, 0xe0a5b31c, 0xeebbf1fa, 0xef02be29,
-       0x5f28e484, 0x386f9b13, 0x635c277c, 0x55bc73bd, 0x929daf15, 0xa4cc40b3,
-       0x5905cdf3, 0x4f5d1918, 0xd2d942ca, 0xc533ae9f, 0xec3cc063, 0x126fab1a,
-       0x1e98e38c, 0x48f5510e, 0x70df005d, 0xa38e8c41, 0x76d547c8, 0x2aaf8fb6,
-       0xb1160430, 0xe00160f3, 0x59a3f945, 0xc6611fc7, 0x90870d1f, 0x8782ca3f,
-       0x54347f18, 0xe7e78f8e, 0xae8fb06a, 0x40a1e126, 0x57d699f7, 0x28bd8cf2,
-       0x55c358df, 0x485f283d, 0xfcbcfaf2, 0x33af104b, 0xcf87d262, 0x4757594b,
-       0x9bdeadf4, 0xd820f0f9, 0xe033ee67, 0x37829879, 0x2b62dfa5, 0x661cb3cb,
-       0xfc03cdf7, 0xde6e8f95, 0xb8dbe403, 0xd798cff7, 0xc377d8e1, 0x31df784e,
-       0x15c85295, 0xdf7ab71d, 0xb7bfbc22, 0x4003ae9a, 0x0cb09026, 0x7c63bd76,
-       0xe089f930, 0x419efc03, 0x28438f80, 0x77f8eb2f, 0xf0ee5445, 0x56deda3b,
-       0x03c3bf76, 0x52079656, 0xc979156d, 0x7d94b0fc, 0xffb04d67, 0xc0625f2a,
-       0x0e5029fe, 0x097faf52, 0x1ab6abf6, 0x0a74f935, 0xa27e155d, 0xf70ad49a,
-       0xe8955c44, 0x9fe5ae5b, 0x0aa66b24, 0x23def29e, 0x4d9de27e, 0xaed46519,
-       0xbb06ef3b, 0xd0a7f94a, 0x53d3b2aa, 0xc0164b06, 0x287f845b, 0x0fa2c67f,
-       0x3037ef7d, 0xfe038c1e, 0x0b5d86c2, 0xe8773844, 0xe0b35d2c, 0x3fda3a1e,
-       0x362a4acb, 0x12b3f7d2, 0x64f50968, 0xebcaef5e, 0xe7d9583d, 0xa041b723,
-       0xb8f157cf, 0x9e562bec, 0x5e746037, 0xbc5cf70a, 0x9d9af1c2, 0xa0bb4566,
-       0xa291adc8, 0x8db5ce0f, 0x333b7cfc, 0xba00699c, 0x0c6c7229, 0x6a76421b,
-       0x2e8d32b4, 0xbc39e403, 0xe179f7e5, 0xbd23b0bc, 0xec25f573, 0xf3fd3fbb,
-       0x1f9f3e46, 0xdd7f5fed, 0x46e0fbee, 0x5c696fc0, 0xd03723f3, 0x9f25d97a,
-       0x91769c63, 0xf50aecb5, 0xd4be9e79, 0xf3adffcf, 0x1fe01c27, 0x9e6d7eb6,
-       0xfecfcb14, 0xdffccaca, 0xf8e9febd, 0x2177e29e, 0xab2740a9, 0x63342fbf,
-       0x55d57e89, 0x8e80f2a8, 0xec0931b2, 0x99c595ab, 0x2bbee9c6, 0xaec7ce54,
-       0x5fb8b10a, 0xe833e816, 0xdd8335df, 0xf335fe57, 0x7fe8e28f, 0xc794ee70,
-       0x32dec9cf, 0x69db16fa, 0x3b08b7bf, 0xa84acd6f, 0x93ef8468, 0xcf033988,
-       0xf688732b, 0xe4acafbe, 0x8f3809ea, 0x479c0c84, 0xbdae9c6e, 0x40346cab,
-       0xcc0c9f7b, 0x2a23cc57, 0x23ce8cbf, 0x78c10fab, 0x29701916, 0x194d85e6,
-       0xb79ff948, 0xeccc0e7f, 0x426711b7, 0x764fef54, 0xa09de2dd, 0xddaa5bf1,
-       0xfedfc7a0, 0x5623bc4e, 0x3675c5fe, 0xfd7b9fc6, 0x03e42f5e, 0xde3cf1e8,
-       0xbbb12c25, 0x8f5be3da, 0x15fe3d4f, 0x98f1eabc, 0x427b91f3, 0xe93c0c52,
-       0xbf3d12f1, 0xba00ac0c, 0xd1140de4, 0xd074297e, 0xcbf689e3, 0x5f6f7e87,
-       0xf9c1fb42, 0x08c2b8ab, 0x43372f76, 0x457fdc20, 0xc22f36ff, 0x257fcc1f,
-       0x3748ed5d, 0xe3db5e3d, 0x979f93d1, 0x1edf5d1a, 0x37e617c0, 0x3e400fb9,
-       0xc24da359, 0x1c684971, 0xbc7be751, 0x04e4f102, 0xbbef1e1c, 0xaa40c71b,
-       0x5762aef8, 0xff2888e2, 0xeb5afb8c, 0x2705e6e7, 0x39ff029e, 0x04b7c12b,
-       0xcc44a6e2, 0x8a3a3cc0, 0x3e5ac3bf, 0xcd6bfce3, 0xf8a13e40, 0x0c43b6d4,
-       0x664fde07, 0x5d4e79ed, 0xf4cf8ebb, 0xecf857eb, 0xa6307815, 0x3e14be3d,
-       0x7ee3689b, 0x13d27779, 0x5b21e4fc, 0xde802446, 0x98a4c126, 0x075188f1,
-       0x9c3811bd, 0x051f915f, 0x773c8be2, 0xf427f9f6, 0x8eb51357, 0x1cc0f8aa,
-       0x2d9b77d1, 0xf852fe86, 0xb74e4ae3, 0x13bc892b, 0x12574be2, 0x7d9117e3,
-       0xfd744640, 0xde3c6cb3, 0x80f483d2, 0xbab2ee75, 0xaf997ed8, 0xea6eb233,
-       0xb3dd0256, 0x71d9f8f9, 0x834efc36, 0x112d8d84, 0xbde267fc, 0x2929b235,
-       0xf7890f3a, 0x8415e927, 0xf03371f9, 0x178a5cbe, 0x9d1ac172, 0x609b42c7,
-       0xf85c7bc4, 0xc6d74e3c, 0xb6df90c9, 0x003df44e, 0xf6116ceb, 0x19f5c10d,
-       0xeec1fd43, 0x6f3fdbe9, 0xed0655d8, 0xf6215fb4, 0x2f9ff3e3, 0x7843b8b2,
-       0x3ab039bb, 0x94ff63a3, 0x07da358a, 0xe1b22e45, 0x41cbc8bb, 0xcc22c2ce,
-       0x53cfc83b, 0xc2299c76, 0x3887a0fd, 0xe1465c97, 0x113b3eed, 0xa973f9f3,
-       0x7a7e81ba, 0xb7f3d7be, 0x90279f9e, 0x4f784cf0, 0x363fc7cf, 0xdff1400f,
-       0x90737c22, 0xeeca8df2, 0xf942fc29, 0x5d1b79e7, 0x6388db77, 0xfdbb814f,
-       0x53cf88ce, 0xfe29eec1, 0xf10fd479, 0x3afd00bc, 0xff15d3f2, 0xf7cd937c,
-       0xc233f412, 0x99fbe87a, 0xf8065d03, 0xcd90fe7e, 0x573c32f3, 0xed8b96fc,
-       0x232ec837, 0x3be74819, 0xcea1d393, 0x593ef040, 0xf6808179, 0x961276ec,
-       0x2bdbbc60, 0x76becd24, 0xc9fc25a6, 0x587e70fd, 0x99ed0039, 0x14fabe0f,
-       0x8f967df1, 0x13bfc55c, 0x0fee1819, 0x163bbefb, 0x43c7df6a, 0xbde8acc2,
-       0xbed09f9d, 0x6e0092dd, 0x877c0a73, 0xfb6b205b, 0xd657c7eb, 0x7fab87a1,
-       0x63df9caf, 0xbb22f704, 0x9fc2fe55, 0x8d8fcc6c, 0x7e2df7cc, 0x37c5018f,
-       0xc1b3d5d8, 0xc50f024b, 0xf4a55fe0, 0x8c7b25c5, 0xe6f5a3c3, 0xb1e9e6ed,
-       0xc65117ee, 0x833df051, 0xfcf82934, 0x65ff1636, 0xc01c58fb, 0x734844f0,
-       0x7d94af4e, 0xdfd013c3, 0xa0275beb, 0x97525d7f, 0xf1a59863, 0xb83ed9f3,
-       0xf70f9f9d, 0xfaff405d, 0xafcfcc9d, 0x42fdc4ab, 0xf7db3d49, 0x5cef82ac,
-       0x0c89f3ba, 0xb23fff42, 0xa9bc859f, 0x9047b852, 0x53e087b5, 0xacd53ef5,
-       0x897db27f, 0xf611b969, 0xc934bea3, 0x5abfeb4d, 0xf747155e, 0xc419554d,
-       0x29bee842, 0x27cb57f1, 0xb54d18ae, 0x20479273, 0xb2af5889, 0xfefce98d,
-       0xcb57f939, 0xe36596aa, 0xaede2bbe, 0x2476cfda, 0x2e6de71f, 0xfb4763c4,
-       0xbc12c7d8, 0x3c5576c9, 0xb3ff4f42, 0xe004ae71, 0x7f7ce5bf, 0x59c2f57d,
-       0x0cb06fb8, 0xf90e9f38, 0xee9cd961, 0xb38f3b2e, 0xdcf7d95a, 0x00f4d6e5,
-       0x456ba9e8, 0xd9e60b9f, 0xfef9c6f6, 0x6b7e4710, 0xb7dc11e0, 0x8ebdf905,
-       0x5e45fcfb, 0x65fabe75, 0x5f67e676, 0x03a3497d, 0x8cd71df6, 0x677e0bfc,
-       0xeec8da7e, 0x6d196b4d, 0x4fb9f8d2, 0x032ef2da, 0xd1494af8, 0xce7e8227,
-       0x20ebb11e, 0xec8efbd8, 0x780ed444, 0xe403b004, 0x3c54fefc, 0xeddfaa07,
-       0x0b65d880, 0x74fd6eff, 0x9dea637d, 0xf0dd2cb4, 0xb7ec0717, 0xcfccedb2,
-       0xc26c6d3b, 0x5e4a747b, 0x079ef115, 0x6dea6e3a, 0x9fae5f10, 0x1b10f595,
-       0x076d4e26, 0x43afbf09, 0x8caf07f1, 0x2edc0393, 0xbc4d712a, 0xbd5c63df,
-       0xda38b1e8, 0xf7a785fb, 0x0f9e3e66, 0x1b922174, 0xd92325dd, 0x3f227e85,
-       0x5dbfa1e7, 0x0ef0af70, 0xfebd795e, 0x40af1bf3, 0x4276a266, 0xd7c93f00,
-       0x98ef0585, 0xb7fc563e, 0xe36b5f71, 0x527f7a97, 0x83e33bb1, 0x20f49743,
-       0x8dd71780, 0x5ec21df8, 0xe94de623, 0xf0bccdfd, 0xcafc0ec4, 0x363f9147,
-       0x02b1f7d6, 0x19d9873d, 0x7fd7965f, 0x94aef78e, 0xb834d091, 0x5eaca6ff,
-       0xf7c88674, 0x6f25e9e9, 0x6ac1dfc3, 0xe02e4a0b, 0xeee0b6df, 0x6f5021b8,
-       0x561e3110, 0x65f64efe, 0x41ad67c0, 0x291fef09, 0x01cc7edf, 0xf3b140fa,
-       0x2f7641ad, 0x08f05b49, 0xb6e0573e, 0x065f2436, 0x818367f6, 0xed773fed,
-       0xfa0ad6f9, 0x67f3f5e1, 0xabdf7193, 0xff9d69d8, 0x7377c4ab, 0xbe2462ed,
-       0x896ff6ab, 0xf2007d98, 0x2412f2a7, 0x7f510a22, 0xfe9d9db5, 0x93b12c88,
-       0x823af6f6, 0x8231e27f, 0x77edeb9c, 0xfb3adf04, 0xfb9d88fd, 0x30c8bd8f,
-       0xe1afc7b8, 0xfc7cf27c, 0x756833ee, 0x0cf8c22e, 0x76da4ff3, 0x14d8fa7d,
-       0x644fbe78, 0x179ffddf, 0xd8dfef91, 0xb377bf31, 0x2af78d4d, 0x6eb9d7a4,
-       0xd1b75a67, 0xc776e7fe, 0xd1b578b3, 0xbbfa997d, 0x00ff6883, 0x3ba857c7,
-       0xbb92f73b, 0x3f3b7dc3, 0xb70cffda, 0x45eaffbb, 0xb8d2f790, 0xc35044f0,
-       0x990e6bfd, 0xb30c5f40, 0x7a625f7b, 0x7a0acea0, 0x7be32640, 0x516e3a10,
-       0xfc0f193c, 0x4e24ae15, 0x757bc3c8, 0x7400c1af, 0x0336b119, 0xf1d664f3,
-       0x7579c173, 0x950ca6d5, 0xcfc7997e, 0x724a4e95, 0xf9ea927a, 0x03d30770,
-       0x3f177727, 0x03f2fa87, 0xc317e933, 0x983b263e, 0x9264dbbd, 0x7e87aca7,
-       0xefb80d87, 0xeb67b5d8, 0x6e0fb81e, 0x50d741de, 0x41a737b0, 0x86bc281e,
-       0x20aaeb7d, 0x23e1b6cf, 0xbf5416b0, 0x0d1029af, 0xc46ddc74, 0x0764e2c5,
-       0x8dffb80c, 0x278917c4, 0x29f9d619, 0xf6dbbfd7, 0x50e7341a, 0xa43df8db,
-       0x39d9da1f, 0x8b3b7ed4, 0x3bdc6d53, 0x944ef93e, 0xd001df43, 0x9b47e5ff,
-       0x68ae1cab, 0x97f14d5c, 0x38d81cc6, 0xe7fd3065, 0x13831698, 0xb03aedc8,
-       0xbaf5845a, 0x25db524e, 0x13fe7690, 0x1a89f785, 0x0616b6de, 0x0de3ce8f,
-       0xff055390, 0x3c3f02d4, 0x35b7d688, 0xbf209319, 0xb2bfc14a, 0x577c650e,
-       0xb2acf11d, 0x367928a1, 0x577c4f7e, 0xb87cf7b9, 0xa0f72893, 0xb6ce5f23,
-       0x3f195a7b, 0x3f50e9c8, 0xfd1e3bb9, 0x9edc4d92, 0xde82b491, 0x4e853f80,
-       0x7f660e09, 0x3474f994, 0xbfa73c7e, 0xbe50fe52, 0x64b9275e, 0x1f7e1be4,
-       0xc50e4ba0, 0xae3c81f5, 0x77f83e86, 0xae79545a, 0x47c00ef1, 0xd47e368b,
-       0xc0306cd0, 0xdb6558f7, 0x66bc4485, 0x6dfe93a4, 0x758ccf84, 0x070d7fc8,
-       0x7171ca09, 0xbe2c5ded, 0xf83d4247, 0x5e7858bd, 0xcfc3f20d, 0xb409bbad,
-       0xb55c131c, 0x37e207b8, 0x8ab900e4, 0x0dca89e2, 0x26d51594, 0xf779d7e0,
-       0x3f2e72b0, 0xd2b79dff, 0x5859f287, 0xfafbf2c3, 0x7cd8323a, 0x4312bf38,
-       0xfbc8777c, 0x7fdb8e78, 0x022fde65, 0xa9fad2df, 0x611bc7fa, 0x975fca5c,
-       0xdeee203a, 0x3053e8f0, 0x4f5f855d, 0x4e1091ad, 0x7cf6bc51, 0xd74e72fc,
-       0x7e300f57, 0x1a46b31f, 0x8d31f70f, 0xe2138991, 0xacd6dbc5, 0x6f7f4115,
-       0x60ce7e03, 0xfd760e72, 0xac87eee4, 0x773b04bf, 0x2e2040c8, 0x8a44c9bd,
-       0x62e4a836, 0x34d7aad7, 0x5b5c5bf2, 0xdfe30539, 0xe80249cd, 0x156e4579,
-       0xb9326fbc, 0x5ffca327, 0x09ff93ab, 0x0e39fdec, 0xb9c79746, 0x893e3ffc,
-       0x947d3fca, 0x005126b8, 0xb14c9b38, 0xf69ae9ef, 0xa22ff923, 0xd3b68f57,
-       0x6c1cd3ab, 0x43e8ef5f, 0xe6bb2fc7, 0x23ebee2c, 0xf37ce3f3, 0x6f8504f8,
-       0x7fc00432, 0x5f60a535, 0x2bc517c0, 0xaffa33f0, 0x32736fa0, 0xf6a1bef1,
-       0x3948b8fc, 0x6dc8d397, 0xf229af54, 0x7a022beb, 0x58a84d67, 0x72767e0c,
-       0x7a7c8cbe, 0x4ef5f04a, 0x14ed76a2, 0xbd0c73c8, 0xf4c1d130, 0xa7c939c8,
-       0xfdbcafb9, 0xe077483c, 0x63ba22eb, 0x1a917583, 0x51f409c1, 0x6c355dda,
-       0xc394b15f, 0xf52b9e53, 0x2ff78d1f, 0x9783c5da, 0x333d983a, 0x7fb056c1,
-       0x2233d980, 0x20b9478c, 0x83bbab86, 0x76a3cdbc, 0x1d9556ec, 0x2355253b,
-       0xf8782abf, 0x73f7e735, 0x57dd6c89, 0x829679f1, 0x673aa7ef, 0xa3041ba2,
-       0x145ae4c0, 0x008bbc98, 0xb1eed4ff, 0xafef9193, 0xf3f7cd89, 0xfe42afd7,
-       0xc4e49c4c, 0x371e48ef, 0x83892dba, 0x00e3e962, 0xfed6bb96, 0xc059f706,
-       0x1df720c7, 0xc81141c9, 0xffc18901, 0x2affca01, 0x407c29fa, 0x8745e2f9,
-       0xf9e84f4a, 0x53df3942, 0x7749b2f0, 0xeb8e783e, 0xba5e46f9, 0x5153c83a,
-       0xe9a3f3d6, 0xce8ed2dc, 0x473a306f, 0xade80be5, 0x81df89e8, 0x2c74a59c,
-       0x9c12fd67, 0x8faa9f38, 0x485e6167, 0xaa273f35, 0xf329e3e3, 0x42f5c03e,
-       0x353ce747, 0x1c5fdf56, 0xd748f3ba, 0xe47f28a0, 0xc176bf71, 0xb39e335a,
-       0x9e4c206f, 0x01f15de5, 0x4e9e77f5, 0x294c7523, 0x3e808faa, 0x3856891f,
-       0x42d77504, 0xc74be913, 0xb051973d, 0x7e6df20b, 0x0fe724d6, 0x60d8eba6,
-       0x835ea792, 0x64f701fb, 0xdf393f80, 0x6f7884e0, 0x4029c7a2, 0x0343023c,
-       0xd8fb8720, 0xb8fbc338, 0xab7dc32f, 0xf41c3dcb, 0x2f4e69c1, 0x1e0abe85,
-       0x1d77b23a, 0x025fb5d1, 0xede3a73f, 0x26f23d7a, 0x38e79b97, 0x47ae2f1e,
-       0xc9e41164, 0x448b7c41, 0xd3367f98, 0x923d1183, 0xd01cf04d, 0x9e55c7c1,
-       0x509ff52b, 0x5212388f, 0x74647a54, 0x423d4c73, 0x3fe5317f, 0xf41ccd65,
-       0xd8c1c967, 0x027a6cfe, 0x6029c7b3, 0x14bf6947, 0xd33dfd99, 0x503edcd3,
-       0xc57cc48e, 0x8c6635ea, 0xc87a2be3, 0x878c9531, 0x00eacfbf, 0xa6bd0bbb,
-       0x095e0efa, 0x2669b3e7, 0x9f179c17, 0xf748c292, 0x5cc37453, 0x15e1fc8d,
-       0xf431de80, 0x85f88111, 0x2c9ed7fc, 0x51062efe, 0x11e4164e, 0xd6bba3b4,
-       0x2abe428e, 0x8014cfca, 0x136b8b6f, 0x9a4f6805, 0xbe8034e0, 0x6a31d652,
-       0x49fc88a1, 0x824460e5, 0xe4a31e8a, 0xd5f0110a, 0x2697d93b, 0xd6fdd225,
-       0x4cfd57af, 0xd0f1bf1d, 0x68b48afa, 0x1fd686fc, 0x7ceb75b4, 0x213726fc,
-       0x3fe420f0, 0xe4f0eadc, 0x5635b8c0, 0x59942e6f, 0xce302b5d, 0x88bcd9db,
-       0xe52fcb1f, 0x0e444e3c, 0xcecb8bb4, 0x5c6175ac, 0xa7cc1a76, 0xa7f1fbac,
-       0x73de1c00, 0x66efd311, 0xf5c2e8f3, 0x2088f902, 0x2b78ba3d, 0x28978844,
-       0x384ee77a, 0xf6a14594, 0xa1ae7008, 0x2de81bc8, 0x3c95a7f0, 0xd95b8808,
-       0x401f6e31, 0xc27a823e, 0x5a3ea8b0, 0x79886f91, 0x04c2f15f, 0x9faa4fdb,
-       0x9beff049, 0x477ca97f, 0x2d3ca228, 0xebe9504c, 0xa70ff3c7, 0x7608f3b2,
-       0x7cdddfaf, 0xb916e78c, 0x4ba034ff, 0xa1867ef4, 0xf90c9366, 0x5c43c4a6,
-       0xb1fe554e, 0x76421410, 0x56fd63c8, 0x874a1e20, 0x2c456fb6, 0xde3ffb9f,
-       0xcfe01949, 0xd4dc1837, 0x0bfc8233, 0x6f770794, 0xd4a7df82, 0x73127bf1,
-       0x091e6d1a, 0x1c421de2, 0xa3da8eff, 0x1d18e73d, 0xdb4f5f4e, 0xf8cd0717,
-       0x72dafdb7, 0xe0afbf94, 0x1598efc6, 0xe7790efc, 0xd79881f1, 0x8376ac69,
-       0x30b6ad9c, 0x2c2dabf8, 0xa2dab76e, 0x004ae7bc, 0x79d1ddbb, 0x1ec2f67b,
-       0xe253ff18, 0x90e1d98d, 0x0cc9f808, 0xc92c0cbb, 0x0c678d8d, 0x72b75c13,
-       0xf1c75f0e, 0x46ef69bf, 0xd679ec11, 0xb0c5ea84, 0xf763d9ef, 0x6bfa00bd,
-       0xdfd6b66c, 0xf3f0211b, 0xf704c9e1, 0x249c8a4b, 0xe09d9337, 0x6c1e24da,
-       0x1a0a80f6, 0x13b3d27b, 0x5e0995f6, 0x553c0022, 0x8006cffe, 0x8478ba4b,
-       0xdfc0ba6b, 0xfb7fe5eb, 0xb4d9c390, 0x7200bc77, 0x8269a5df, 0x9ed41ae0,
-       0xfec257cf, 0x53cb047b, 0xfb2afa01, 0x5e2fdec2, 0xa5f0013a, 0xfae26ff4,
-       0x2f9f0afc, 0x74c64217, 0x7718213d, 0x2340f4cc, 0xaa35495c, 0xb9346e48,
-       0x4799eb54, 0x668f5e10, 0xedd1d719, 0xca072fa0, 0x1c44b663, 0x10c9ec77,
-       0xad74b7e6, 0x43f69020, 0x401d357a, 0x4557aa3f, 0xdcf40093, 0x9c0df7b4,
-       0x5da6cf6f, 0xb5f2e4ac, 0xca05fb91, 0x98d98ebc, 0xcfc63cdd, 0x334eaba9,
-       0xc12079bb, 0xca4bf987, 0x7c72aa3a, 0xfe141569, 0x19cbc84a, 0xce5e71d1,
-       0xb2930491, 0xd608ffdf, 0x79bd3e57, 0x3ea0f00f, 0xefba907e, 0x7523d230,
-       0xaf96db21, 0x0040b7dc, 0x4672b17d, 0xa281f8ec, 0xf8f25637, 0xe5ff2aab,
-       0x4f4f5a94, 0x66b24829, 0xf292f4aa, 0xfcd153de, 0xff3c4d97, 0x7bcd03e5,
-       0x805a9783, 0x79b2ee9f, 0xe573c0ce, 0xe3ad0bef, 0xd947b77f, 0xbaf82acf,
-       0x80fcc9c2, 0x1fd70903, 0xc0247383, 0xf1f29393, 0x3cec4b3a, 0x069dcbf2,
-       0x7e3077ee, 0x5f8c4d21, 0xff6a1d60, 0xb001bfeb, 0x00d7432f, 0x0000d743,
-       0x00088b1f, 0x00000000, 0x7dedff00, 0xd554780b, 0x733ef0b5, 0xc9332666,
-       0xe4cc9924, 0x40275e49, 0x21c40a30, 0xeb141021, 0xef0c0124, 0x02415041,
-       0x8042120c, 0x2a941324, 0x8065bd6d, 0x8d520318, 0x8bd4b45e, 0xd7a5783a,
-       0x2941b622, 0x84ec1a86, 0x3a0bc157, 0x94b62a28, 0xaa54141b, 0xa5ac4090,
-       0xd7f97b96, 0x661f7b5a, 0x962264ce, 0xbfefbf62, 0x767e9fff, 0x67d9cfb3,
-       0xfbd7b59f, 0x649ecfb1, 0x1258c4ab, 0xdd3b3763, 0xd8c67a65, 0xc1b758be,
-       0x88d8c45a, 0x596edf62, 0xb9786c61, 0xda1eb777, 0x3bbf564c, 0x94061136,
-       0x6826c733, 0x3dac1dec, 0xa384da0e, 0xb838ce1d, 0xa36adfdf, 0xacfa6e79,
-       0x8c2db98b, 0xab98950d, 0x97631065, 0x60d6eff0, 0x31d56a9b, 0x0627f306,
-       0xe306254a, 0x6cb8c436, 0xe961bef8, 0x4001b2f5, 0xf1d66449, 0x03631fac,
-       0x2b8d0aad, 0x96ee762c, 0xa7563de1, 0x8b79c64b, 0x9ef4ac63, 0x6a771cc6,
-       0x1d3e7f3d, 0x4e89679f, 0x37c02269, 0x5b18bfec, 0xfb6ddd03, 0x1065254b,
-       0x6f1467be, 0xc0b67319, 0x056057f8, 0x115970a1, 0x9f7c249e, 0x39ebef44,
-       0x4acf3bbf, 0x129ceaf0, 0xa8fc324c, 0xe860c7c5, 0x32f5a5f0, 0x02c89fc2,
-       0x6d000312, 0x2312d6d5, 0xc6bd37bc, 0xfe61b921, 0xf95c629b, 0x0e635cf8,
-       0x6d0a1c5c, 0x0ab7ce89, 0xe7103b9e, 0xf981653c, 0xf668bf17, 0xfa31349e,
-       0xd5ff04bb, 0xfa6824b6, 0xef34d69e, 0x7f60bcc9, 0x0d23fe31, 0x4ccfdbfe,
-       0x3563186c, 0x407b16fc, 0xef8cdf76, 0x3c7535a9, 0x75fa173a, 0xc8caf8bf,
-       0xae0a4960, 0x6578e017, 0x3dcc417f, 0xa77ae096, 0x9977a4f5, 0xbd27a935,
-       0xde824a87, 0x4ade8163, 0xb29f7a4f, 0x3b7a0824, 0xfac107db, 0xc24c5de2,
-       0x135f01e7, 0x85dc3d39, 0xb788c1ae, 0x380332a5, 0x587a455e, 0x538f4cae,
-       0xa71fce16, 0x2a1e9c2c, 0x38c6e61d, 0x75d2b4ef, 0x96f5ef46, 0xbebc3cb2,
-       0xdcae8276, 0x16cf8117, 0xee342d59, 0x05fcf1aa, 0x99e287d3, 0xfb6dfdb5,
-       0xc1efa10f, 0xf784cb7f, 0xc0378845, 0x583f5c7b, 0xf84ebff7, 0x53f91928,
-       0x203aea67, 0xdb6a3e01, 0x25864564, 0x9c954c0c, 0x5b190b27, 0x89cda0f5,
-       0x8b5cf07c, 0xf18288e4, 0x6b14c9cc, 0x22564332, 0x75fd9d62, 0x11bb3e7c,
-       0x8360b85a, 0xa334de71, 0xcef2136f, 0x8c33c01e, 0x380824f3, 0x001fe01a,
-       0x0555a747, 0x0df749cc, 0x559ff2ec, 0xf851fb82, 0x6a4b982f, 0x80976f69,
-       0x998aab70, 0xef7000db, 0x1f89936e, 0xf68c6b9f, 0x2ffcc145, 0x607f396d,
-       0x3ffbf426, 0xc165c3a8, 0x27eb04df, 0x53a8f831, 0x1cad04ba, 0xc3d3ca67,
-       0xed1c877d, 0x4b7c6190, 0x8b3e5c74, 0x3764ac67, 0x955b3f31, 0x7bc0f30b,
-       0xd347b556, 0x82e556fa, 0x1f10e47c, 0xd9f8863c, 0x69646b13, 0xe41bbd70,
-       0x670dc706, 0xcc8cef1d, 0xbba9d209, 0xbbd9cbf5, 0x189efd60, 0x2627af3e,
-       0xde00c7cb, 0x07175dce, 0x5b8f1f20, 0xca35cf36, 0xd924d8ce, 0xafe91ebd,
-       0xde66f73e, 0x6f8871c7, 0x5e0832c6, 0x841c9fa2, 0xacde32ef, 0xac72bf1c,
-       0xc9d1d69e, 0xeeb81da2, 0x2193a316, 0x39c7bc9d, 0xad78ab7f, 0xd9d1bc13,
-       0x0dd47456, 0x68ee7beb, 0xef9f0386, 0xeb36ed6c, 0xe2cb7de0, 0x75c0bfdd,
-       0x715d99c9, 0xcf8841ae, 0x063bebee, 0x097a1e91, 0xfc1f77af, 0x741ee6d8,
-       0x86dbeb55, 0x7d695fcf, 0x49a5bd1e, 0x3fc9ef8a, 0xb5207ce1, 0xca55ffb5,
-       0xa8613927, 0xcc59bcb7, 0xddd60ab7, 0x93487838, 0xc69e848c, 0xc64f9414,
-       0x0c9fac2a, 0x2abbd20c, 0xf107b5de, 0x8cd7caac, 0x843ed778, 0x5e93df0b,
-       0x8fdceb40, 0xf343fcfd, 0xabba0d0a, 0xc8e1e75a, 0xfe13f4eb, 0x6a7ac56b,
-       0x0cbf164d, 0x866db3f0, 0xf9543a2f, 0x5e13dbec, 0x0e31c7a0, 0x1ba8e3af,
-       0x8b7bf9e9, 0x43e21563, 0x62bab01f, 0xf8e3fe09, 0x373c563e, 0x21bbd715,
-       0x858f69c6, 0x30579bf1, 0xb4520fce, 0xdc5879e3, 0x68b63dd6, 0xf15593d4,
-       0xdf3853ee, 0xb3f3ba0d, 0x02c7685d, 0xdc3ddd2e, 0xd7867c0e, 0x7adddd61,
-       0xc65ea382, 0xfd62aff9, 0x71f322e7, 0xd9fc3a0f, 0x54e7a21a, 0xf4148cfc,
-       0x41f8891d, 0xffa5dc85, 0xc414c3a2, 0x3d4a048f, 0x3e73d6dd, 0x10b23ac6,
-       0x9f1df6de, 0xf980e80e, 0x74f8deea, 0xdd6fca36, 0xb888a26f, 0x7d737ea3,
-       0xd9f1f23c, 0xc5bd3612, 0x7e9f53d2, 0xa5debcb1, 0x1ffae607, 0xcbd25f6b,
-       0x44602c35, 0xb2db5d3b, 0xd10fa5c4, 0xe93100a7, 0xc08683dd, 0x60ff9c04,
-       0x0056cc91, 0x863b75df, 0x7a08b0a7, 0x5adf6d5a, 0xb9955cce, 0xf512fd8c,
-       0x8ed7f21c, 0x9784f1a1, 0xe3e91b36, 0x9707f1f0, 0x1946bb57, 0xe0ef9f7a,
-       0x1f74f310, 0xcc213f3c, 0x8131b90f, 0xa23195db, 0x44e94505, 0x8f6ccf38,
-       0xd2e179f5, 0xe2f78299, 0xcce9e018, 0xbd0b77b6, 0x58672fc0, 0x51d7bee0,
-       0x30b4be7e, 0x0c267bf4, 0x4570af79, 0x6ede506c, 0xbf6be629, 0x7143b5e5,
-       0xb09f8c0a, 0x37a27775, 0x30b77f04, 0xf99797fd, 0xcbdf0737, 0x1df4c7d7,
-       0xec1e9003, 0x0ac9d3f5, 0xec7613b4, 0xa07ce44d, 0x4bce90e8, 0x15fade85,
-       0x9c111a5e, 0x3ab2c26f, 0x60c2a8d7, 0x9982f6bf, 0xfafb42f9, 0x5f4d1180,
-       0x5d0b05ed, 0x26c427b7, 0xc3e8fe92, 0xf8fea0fa, 0xbf0b78b6, 0xe0ede2ae,
-       0x6859d390, 0x239acfbf, 0x62edc9f3, 0x4463b75c, 0x1347fa0a, 0xd6fefe8c,
-       0xf318e308, 0x75f0b8d1, 0xeddcb9bd, 0x3bdb951a, 0xcc8de37c, 0x1cafc91d,
-       0x9afdc09f, 0x7999876e, 0xdbefae41, 0x743b2068, 0xd307e2e8, 0x9f7e810a,
-       0x5758306e, 0x9fab3e02, 0xaff19dd9, 0x487abf70, 0xfe825594, 0x3fbf8aa7,
-       0x6782f1f2, 0xfbae1764, 0x25f70dd3, 0x73f683cf, 0x801ac7e0, 0x0346c163,
-       0xf8deaf5d, 0x5a7eba7d, 0x6782e9f0, 0x9ea20692, 0x4d67b43f, 0xfab3ae32,
-       0x13be1fbf, 0xa356c5f5, 0x6810e075, 0xae48b66b, 0xb1722151, 0xa6b305e8,
-       0xaac755bf, 0xbaea1d71, 0x7cbee499, 0xbc78015f, 0xba0fdc09, 0x8f65ff6a,
-       0x7f017fd6, 0xfdc09bc5, 0x61534995, 0xdd4575dd, 0xdeee27e4, 0xfc764d17,
-       0xfc9916b7, 0xbf90ff01, 0xd08de7fc, 0xbd6ffb2f, 0xc1087c83, 0x5e85a3e7,
-       0xf48f2c66, 0xf7899550, 0xc9e876cb, 0x958b289f, 0xd07edf09, 0x08c8a313,
-       0x61a32d39, 0xe7d4f7dc, 0x46eb91e4, 0xf1d1b8c0, 0xe27e8606, 0x268bfcf7,
-       0xb7efd030, 0xd47fd05e, 0x529eb211, 0x23a3d4e6, 0x9a0cc252, 0xe3a3abeb,
-       0x08ff479e, 0x1ea3d326, 0xef69332f, 0xee3fee8f, 0xd1bbda34, 0x5575ed56,
-       0x39439e7e, 0x83941818, 0xf4fefbdd, 0x675878c4, 0xfb9941d5, 0x33d05763,
-       0x72bae16f, 0x566fde91, 0x0ee7816c, 0xba1cec09, 0x1a4369f8, 0xc4b157f2,
-       0xd3ff4256, 0x91e5518b, 0xd54622e4, 0x9ce80c37, 0x44f3a417, 0x7dcbc2c7,
-       0xc5c98b14, 0x11f72e4b, 0xefaf6ffe, 0xef2e59be, 0xfbd2304e, 0xb861f5c3,
-       0xfa577cfc, 0xbd90c270, 0x6a58de59, 0x17ed8e7f, 0x099eb95b, 0xfae18fd7,
-       0x1c2b854f, 0xb20bdade, 0x4f8def46, 0x505c6850, 0xfee919ff, 0x3eb38c35,
-       0x6710884b, 0x7c267d81, 0x29e98779, 0xe1ff03be, 0x641b8e0c, 0x0025ec51,
-       0x6fb58352, 0x25f5ea0c, 0x5e177716, 0x86e97ecf, 0x0c17e851, 0x43acd2dc,
-       0x7129d1fd, 0x88366d7a, 0x8283fb16, 0x045fd071, 0xfa131cdf, 0x53a0e200,
-       0x2efb6816, 0xc31f632b, 0xcc4ca2fa, 0xbb202e6b, 0x041435ef, 0x7e023fe7,
-       0x8d99c60c, 0x9fc78c25, 0xebffdc09, 0xace8a79b, 0xcbc3ff30, 0xc093cead,
-       0xa797abcf, 0xf2f2cb52, 0xfbbf4874, 0x6fd06e04, 0xbbbce7c4, 0xa75d69a2,
-       0xca3e5724, 0xbe02c3e5, 0x62dc7a70, 0x35dbf953, 0x9a2fd420, 0x5f591a5f,
-       0xd3d36f5f, 0x66a792f8, 0x71dfa164, 0x2ceefdaa, 0x00a7a3d4, 0x41da00de,
-       0x9bfe23bd, 0x84c785fc, 0xec223e3c, 0x2788bc45, 0x04e4227f, 0xd5b9c7d8,
-       0xd174eb82, 0xa7cbd5fd, 0xf2f8fb53, 0xc63f7465, 0x12fc4396, 0x4095e237,
-       0xc9dfa05f, 0x83d932b5, 0x80d746f9, 0x49ef7804, 0xd2e28e93, 0xe52deb8f,
-       0x9d782cdb, 0xff337c51, 0x509bf1a9, 0xb5cb2e2e, 0xeb6f4758, 0x7576c5bc,
-       0x7596bc7a, 0xba5da1c4, 0x00c78fcc, 0x7e41c93b, 0x6fbb2f9c, 0x3c6115b2,
-       0xe38c91d3, 0xc060523c, 0xba060a16, 0xaa3f50b2, 0xe2d57fef, 0x8496c5bc,
-       0x881b0ef1, 0xcd12d172, 0x9c384eed, 0x1efd05a3, 0xbe08ae5e, 0x88d6a3c8,
-       0xddc624be, 0xe822af68, 0xb9e27195, 0x38e71613, 0x42dfd11b, 0x03ad277e,
-       0x38eee5f8, 0x0ebc44e7, 0x6c64c371, 0x3cf0a587, 0x558b29cf, 0xe2538bf0,
-       0x9a6bb97e, 0xa71e422d, 0x3841bcb7, 0x3c6d671c, 0x4f9e138f, 0x9f355b50,
-       0xe7ac4730, 0x26ab04ab, 0x30b4a3cf, 0x423ca467, 0xe348cd9b, 0x394e9d52,
-       0xee5de946, 0xf23fba86, 0x992f98ca, 0x4e281cce, 0xda5b2329, 0x36928f31,
-       0xf302b7ca, 0xe1098d2c, 0x6335e872, 0x5bafa57e, 0x7185ec97, 0x897701c9,
-       0x1ed8e011, 0xa5f04c9f, 0x4815fab0, 0x1d6ea1af, 0x9ee87a2d, 0x06a49f68,
-       0x50a4307b, 0x509047e8, 0x655bca33, 0xa441fbac, 0xfacab0f3, 0xf3054655,
-       0xf5195e50, 0x9dc969cb, 0x38fe036d, 0xa23a37bd, 0x9b13f75f, 0x6952fbd0,
-       0xef0a961f, 0x7840c179, 0x93c2fa18, 0xa1de11b3, 0x97a6dc2f, 0x5ff5e242,
-       0xdf040cd8, 0xb28bbde9, 0x30fe7e29, 0xf4e6e58a, 0xe0a3779c, 0xdf02158b,
-       0xf3231aaf, 0xdc6233dd, 0x93e9eb55, 0x6b24e7e0, 0xb633f4f4, 0x5d4cbc90,
-       0xd3d279ed, 0xf429b03f, 0xb7d37f9e, 0xf803ebec, 0xe64ab7fc, 0x7a2fbc40,
-       0xebe52371, 0x8cb6355e, 0xa9eb82dd, 0x07cc31d3, 0x9bf7d9ec, 0x4fd07d7d,
-       0xa08654ac, 0xf9f9707f, 0xf11b9b83, 0xb355bffa, 0x34ff8821, 0xe612e3df,
-       0x3732be05, 0xdabebe13, 0xc056c514, 0x6e1e1692, 0xe843fb19, 0x31d1afaf,
-       0xebe12bd4, 0x74193786, 0x0dfad8a9, 0x7f4e62ba, 0xdd2a7fd4, 0x488cb181,
-       0x886e950f, 0x7b67d43f, 0xf046bd36, 0x8f6d70ab, 0x7a2d70e7, 0xe458eb71,
-       0x36353e93, 0x2a34f309, 0x9da8ff5c, 0x33f686b8, 0x2572e820, 0x8e1ef9fb,
-       0xe19fb70b, 0xc5897376, 0x5dc71479, 0x15ce7ec9, 0xe847b5fc, 0x8f298561,
-       0x1d92be60, 0x27de51d4, 0x6c732e9c, 0x9fa3f23d, 0x3f22aeda, 0x8b66c53a,
-       0x6cdd1f98, 0xd9b47ae4, 0x894ce6c6, 0x04130f20, 0x5d75babc, 0x898bb446,
-       0xbd44526d, 0xf5c2ca74, 0xafcde812, 0x23d3ee49, 0xf808d5eb, 0xff70ec95,
-       0x5dfe2dfa, 0xa120aa38, 0x5dba0c7f, 0x3d9d4f80, 0x8f029f14, 0x7c555e2a,
-       0x884be2fa, 0x3f0b365f, 0xa4bc7b73, 0xb3aee389, 0x169ce3ab, 0x2f664f7c,
-       0xced13afa, 0xedf8039f, 0xa5c4def8, 0x575f934c, 0xf589eaf3, 0x1438c95e,
-       0x3ca302cd, 0xbdddb65c, 0xbae300c2, 0xf3c73046, 0xb0af8fd0, 0xb3bea096,
-       0x31da3b55, 0x8678deff, 0x971b37e7, 0x9a4adf30, 0x73fff187, 0x2a7ca5f7,
-       0xe965dde2, 0xf5d41769, 0x67eabd81, 0x22e570e7, 0xabd9bd5c, 0x8517286b,
-       0x17276ff6, 0xd6e891c5, 0x6bf5cf15, 0xebdff184, 0xe2b7ce85, 0xf9d12bf5,
-       0x390f510e, 0xfc853f12, 0x6b3f944d, 0xe1ee907e, 0x918e2cf4, 0x7b7cb1fe,
-       0x19dcbc4f, 0x276b2f09, 0xb8f4f2e8, 0x88ed164e, 0xda167764, 0xffbcf3bf,
-       0xcf527b42, 0x69fc3fbc, 0x56e7e7fc, 0x0ebede3a, 0xa64b7ce1, 0x1fb9e938,
-       0x5f311877, 0x55a7e6ac, 0x4b5f3d78, 0xb9fa09cc, 0x5a996bf3, 0x9b5d7af5,
-       0x57718854, 0xe48beec9, 0x7fb6771f, 0x6771fe4d, 0xbeac7f98, 0x4f605ef7,
-       0xb2d18f94, 0xfcfff885, 0xcbcf1e06, 0x48e9f94c, 0xdfb3c380, 0xf10a7cc0,
-       0xb40ff92f, 0x679fe85e, 0xf1c7e1cc, 0x1ec9625b, 0x8f30382e, 0xac5f1cf0,
-       0xbe084a63, 0x4cd19c12, 0xbd97c109, 0x27e9a6dc, 0xc668fab9, 0xabef4ca7,
-       0xbee69fb9, 0xbd3f7341, 0xcfd340ba, 0x3349bfac, 0xa9597b3e, 0x1de39fa6,
-       0xafdf19a7, 0x3f4d76e9, 0xcd6ef9b7, 0xb8e6cdf8, 0xe00ea9e7, 0xc3fa0675,
-       0x7ac52b7a, 0x8f7f5baf, 0x97e639e6, 0x992f58fc, 0xf9fdc82f, 0xb1fb31e6,
-       0xf229525e, 0x16fbd713, 0xdf9de669, 0xe82fcdac, 0x74bed759, 0x4f9d5fc0,
-       0xbfa1f872, 0xfef6bd60, 0x848dd6c2, 0xed3e85cf, 0x6a2fc5f5, 0xa687f9fb,
-       0x4c71c40e, 0x7f442aef, 0x6d76d7ee, 0x748ae2be, 0x55775ef6, 0xd54a8e74,
-       0x68acd9d2, 0xbf8e1ce9, 0xd85b3c98, 0x37dff87d, 0xa1d62fe0, 0x0aef8be5,
-       0x6bb07f7f, 0x621b9cf3, 0xcf51c7dc, 0x952eb775, 0xcbebe619, 0xbbb23d79,
-       0x83fccbf5, 0x7d3c844a, 0xfd3c8f6e, 0xbb10f627, 0x3be9e6a6, 0x2372feb1,
-       0x97f516fb, 0x3c457fdd, 0x31e58144, 0x8acdff80, 0xf5cba61d, 0x2f307316,
-       0xd4bfae1f, 0x5ff7f416, 0x83d7a4ec, 0xf055aa75, 0xf7f8b0f4, 0x5aa7085d,
-       0x9eef18c7, 0x88def04b, 0xff808c80, 0xea9d7c2c, 0x4b87803c, 0x12f8cf38,
-       0x51c60c5b, 0x4bdcf75b, 0x4b6b0171, 0x480efae4, 0xc43e3a1e, 0xda3d253f,
-       0x234cff82, 0xe44c68bb, 0x1894d176, 0xbf31c712, 0xd857bf8d, 0x51e6dec5,
-       0xb5bd18eb, 0xea992ed2, 0x8f585d31, 0xfbd7a089, 0xf683fe26, 0xf91e8be5,
-       0x4589bed0, 0xf7c27121, 0x7ea1f7bb, 0x26e7bc07, 0x63627bc2, 0x414a6ec1,
-       0x98d3f9bb, 0xaeb79238, 0x3aefb203, 0xa4de70b8, 0x0506dbc4, 0xf0e12deb,
-       0x9dd9348e, 0xde7d10fa, 0x66ed6926, 0x43f70163, 0x9db9120a, 0xf8f0b2ad,
-       0x7be8ac75, 0x4f76fcc2, 0x414f8f13, 0x42dbaa1a, 0x89b1c1fc, 0x5cfe34b1,
-       0x5c58c974, 0xdf1146cf, 0xf448e637, 0x224946be, 0x5f1e5efb, 0x75d7163a,
-       0x8e525ec1, 0x3e044ae3, 0x046fa2c7, 0x0e5f736d, 0x0df6228f, 0x13ebf3a8,
-       0xb6127c61, 0x4d8ed4a5, 0xc83f0ab4, 0xfbd2037a, 0xde93b444, 0x8d65946b,
-       0x93b6a55f, 0x2ebaf912, 0x0a2acda2, 0x2168c9ca, 0x1e846337, 0x1471fcc3,
-       0xc2739309, 0xde4d64e8, 0x513188f8, 0x7a258de4, 0xbc7489dc, 0xb7b1d055,
-       0xcf33b23c, 0x69d507ba, 0xad791e78, 0xd591e799, 0x3c8f733c, 0xc44c63b2,
-       0x21d2323c, 0x879416c6, 0xf5978985, 0x9bea0673, 0x278e9cc6, 0x1c7f23c6,
-       0x23cf1d92, 0x31bcc7e8, 0xe2b700f9, 0x91f039d0, 0x4ad81b11, 0x7817f433,
-       0x1933ca15, 0x2d8b0e20, 0xc3efca08, 0x9f843989, 0xa6fd47c1, 0xfc3fb87c,
-       0xf31dab98, 0x31a603ca, 0x66ffaa1b, 0x87165cd6, 0x1606c4fe, 0x29596e31,
-       0x64be39e8, 0x9e728c97, 0x12fc05d4, 0x052b1e81, 0x578e403d, 0x77873d20,
-       0xeec9bbb9, 0xaa403d08, 0x3da3e30c, 0xc397f23a, 0x57103f9f, 0x7bd230f6,
-       0xbe722fb0, 0xc385a2e4, 0xfd718c61, 0xbc1fe704, 0xfa88c3ad, 0x37aa8166,
-       0x0f4c752b, 0xe82a9df4, 0xaf037537, 0x978bb353, 0x9faac92e, 0x867e68c5,
-       0xb4c160fa, 0x1fe61f58, 0x78e5b416, 0x44972e09, 0xdb4f15f9, 0x17f61761,
-       0xc56a1d0c, 0x7bf9d778, 0x47927d26, 0x7ae31a2e, 0x513ecf47, 0xcfd900f5,
-       0xdc5baa44, 0xa2eaf82e, 0x41382145, 0x018daf3f, 0xb0d82c3a, 0x53ee1762,
-       0x19dfef78, 0xca8e27d5, 0xb270c35d, 0xcb39003b, 0xb3d5b00a, 0x387c028a,
-       0x2699e695, 0x0d7ef1e6, 0xdf0535ef, 0x01db477b, 0x0351cf5a, 0x5f809af3,
-       0xa5de773a, 0x98dabfa0, 0xff107264, 0x71d7ba8a, 0x1910fdd9, 0x1d577d0f,
-       0x2da33682, 0xd606bac6, 0xb8c8cab1, 0x768bab7f, 0x5a27fe20, 0x2fc4f43a,
-       0xc47a5d89, 0x674159e3, 0xdfc9f1f4, 0x2744624f, 0xe9c75d39, 0x7df0ad96,
-       0x79b5fd23, 0x751377c0, 0x1902fe42, 0xcc627d78, 0xe0154b3b, 0x2aeb03cc,
-       0x7f41e9c7, 0x677f8c4f, 0x0ff40e69, 0x4e3f9bae, 0x313dfc0f, 0x732f9dfd,
-       0x5adfd440, 0x0fefc557, 0xbecbe77c, 0x5bac0fd0, 0x4cdfefc0, 0x59decfbc,
-       0xf30e3d57, 0xd65eeffb, 0x07fe7c0b, 0x57ef2e64, 0xba51cadb, 0xc67148fa,
-       0xcf3544b1, 0x1ef80ccc, 0x8eefdb57, 0xa9759da2, 0x41a770f5, 0x8e470f53,
-       0x8dbf0131, 0x12c57c17, 0x8c0ec8e3, 0xaf1bf413, 0x18fed3f7, 0xf84fc99d,
-       0x58358ebd, 0x5b006f91, 0xf6152eeb, 0xaed07f7c, 0x724bf969, 0xe80cb632,
-       0xe256292d, 0x98cb5593, 0x3f768cdb, 0xf1d78758, 0xe1733c3a, 0xd47855fb,
-       0x0b80f7f7, 0x85b7ab48, 0xe681b5c2, 0x1ceae151, 0x7945e512, 0x0aa7ed52,
-       0xf5d4a757, 0xb7bf262c, 0x013fbda4, 0xdb19d6e9, 0xff412595, 0x4423a4c5,
-       0xaea4cec7, 0x48472567, 0xa8e9c0df, 0x38c5727b, 0x19e7bc2f, 0x024ba9d9,
-       0xf91946fc, 0x8c26933e, 0x8f3de057, 0x58bdb924, 0x73be03df, 0x32ef91f8,
-       0x4687a48d, 0x27e6d50d, 0xcf9c492c, 0x3a3b459a, 0x30feb9aa, 0x9b67a5f0,
-       0x78c056c4, 0x236ec5cf, 0x6d8989da, 0x684e8c27, 0x309db6eb, 0xc3aabea2,
-       0xb753cc3e, 0x6f5118c1, 0x7992486d, 0x0fcc329e, 0xe0399bde, 0xc7dc44a1,
-       0x45512950, 0x091ddeee, 0xef7fb1a3, 0xf8255c5c, 0x8eb7232d, 0xb966c7c6,
-       0x76c21fda, 0x8bd8eb0e, 0x2dc3342c, 0x99d2fc6b, 0xbf1a31d5, 0x5dbd5676,
-       0x0cd39fd3, 0x9eb901d4, 0x1b5d2cb3, 0x5b88303f, 0x2c199e01, 0x6dfa87f8,
-       0x8ce3a0ba, 0xdc01b5d4, 0x6dc332c7, 0xcc8476f0, 0x856db137, 0xd77086de,
-       0xbf520e4b, 0x73e0a65e, 0xa10af933, 0xeb437bd5, 0x795ba362, 0x86aea332,
-       0xd815fbfb, 0x5456bc07, 0x42453e4b, 0xbee9183c, 0xfba255a7, 0x47c7d69e,
-       0xcf323ee1, 0x26f28952, 0x3c447dc9, 0x1cefec24, 0x51e82b01, 0xf333ce03,
-       0xa3b312fb, 0xbefe10de, 0xe99cff0a, 0x3f89a7e5, 0xaeaf9f85, 0x7602ba73,
-       0xc9cfae17, 0xfe80c4fe, 0x64efac35, 0xda9f0687, 0x6d7aacfe, 0x6d32ce7f,
-       0xf0926a7f, 0x81b207df, 0x93d34f28, 0x55ea3d24, 0xe645ffb5, 0x01f96ffb,
-       0x6bb2cd9e, 0x8d67f226, 0xa8f54fd1, 0xfa9bb2cd, 0x5eb87dea, 0xc0ee48c7,
-       0x9639201f, 0x19573e48, 0xf412d69c, 0xe2256ba3, 0xc42c99db, 0x8e09c85f,
-       0xb3dcbea7, 0xd71268ff, 0xaeccab3b, 0xdb1754a5, 0xc1375929, 0xa77a51a5,
-       0x55c0fd1e, 0xc8bce452, 0xdedc4963, 0x8a20c5be, 0x2006b807, 0x9f5da293,
-       0xc2f3ef1a, 0x76fc077b, 0xfbfd17ae, 0x07c08501, 0xb73dca0a, 0xbd85e337,
-       0x25fe0499, 0xe4037ffa, 0xdfa4e996, 0x495a346f, 0xa43b0bbf, 0x2fe70bea,
-       0x7c6876b4, 0x3f8a7ec6, 0x7b5fad26, 0xff62f50e, 0xc782ce7e, 0xcc47be01,
-       0xec8ffdfc, 0x2fb87c90, 0x3ed06ea7, 0xc0299fd2, 0xbadef816, 0x5b47a154,
-       0x52aefbb5, 0x2e61af50, 0x7a20c27f, 0xe5499a6f, 0x41e92776, 0xbbaa5fc9,
-       0x4529fa04, 0x0ca6f7bc, 0xbc95f085, 0x75c245a8, 0x0aef3267, 0x463fe3b4,
-       0xb60a4c21, 0x8fcfed57, 0x79fdc292, 0x65e6124b, 0x148c3b52, 0xe32eb1ef,
-       0xeba7943f, 0xf2327f39, 0xb0fcf859, 0x0757aa7c, 0x718bf2e3, 0x77b9af98,
-       0xdc6fbf67, 0xb49b24ef, 0xaac1b771, 0xe7c7bb8d, 0x44cff569, 0x4cef5687,
-       0xb9a7ee2e, 0x5039c53f, 0x796a7f73, 0x877fa6a1, 0xf8cd66eb, 0x6997a6bb,
-       0xe3a951fa, 0xda00f2c2, 0x9e4c4afc, 0xeb12bf36, 0xa251e6d0, 0xba7afc0e,
-       0x9a317804, 0xc06e1dbc, 0x46c81343, 0x47682db1, 0xa899c606, 0x685d1b48,
-       0x34db60b6, 0x7c8fca24, 0xc787d4d2, 0xbe0751e1, 0x7987ea9f, 0x4c5bf14c,
-       0x49788a58, 0x8a6295f2, 0x7544d018, 0xd41e1bd5, 0xd3d39bfa, 0xeda95cb8,
-       0x99f724b1, 0xbc1bac64, 0x7f73a4a8, 0x89f14036, 0xbf719a29, 0xfc89bb68,
-       0xbe4e3522, 0x9465a71c, 0x0eba409c, 0xf549d07a, 0xaccad613, 0xde7c5798,
-       0xdba9f228, 0x41dc3ef9, 0x673a1dad, 0x492f7c88, 0x49e0fae6, 0x9c58e957,
-       0xac0daebf, 0xfad3ca2c, 0xa7588c8f, 0x8f6b6bac, 0xef967b43, 0x7988c8fa,
-       0x6175e0bb, 0xd15df4e7, 0x55f95f58, 0xff711c8b, 0xf7cc92b2, 0x7a13ec6b,
-       0x83f7d67d, 0xb0c951f1, 0xb59e7ea0, 0xc32fcbb5, 0x5e8167fb, 0x4a6bf2f3,
-       0xfa0d3d24, 0x3ccf1359, 0xa7eea699, 0xc1ec6a71, 0x037ec5dd, 0xed6a9fd9,
-       0x78d339f8, 0x5c7a045c, 0x91a33d7b, 0x1d630bf4, 0x815bcc06, 0x8fdcd75e,
-       0xd271164b, 0x12e83640, 0xaea381e8, 0x2bb5fbc8, 0xc744f4d3, 0xa232eea3,
-       0x4f8093c3, 0xec9f97f4, 0xd78e3f81, 0x65ede12b, 0xfa1081e4, 0x4fab8f85,
-       0xcbf47ee3, 0x07ede8bd, 0x979f7d04, 0x54a80502, 0xe268ae3d, 0xb9a699df,
-       0xf73f718b, 0x1aafccbe, 0xeb315eb1, 0x7b4312d7, 0x03f687fb, 0xb8cf8fb4,
-       0xee326f75, 0xecb4f4af, 0x7fc0664d, 0x05650635, 0x1fc0f3fa, 0xea7ff40e,
-       0x7f04fd5a, 0x3b614b6d, 0x956daf5e, 0x3d92a81c, 0xa18dcedb, 0x468eb275,
-       0xdf3dffac, 0x93235c0b, 0x5b755fb9, 0x04f3c2b2, 0xda27786e, 0x3e516dfd,
-       0x00fc849f, 0xdae109fa, 0xe866b121, 0x14dabf3f, 0xa0fbeeb1, 0xd59ef7c0,
-       0x6ab38a46, 0xc75c79e0, 0x467dccbe, 0x56d3f213, 0xeb849758, 0x0c477c38,
-       0xc0d4bfce, 0xe150cfd0, 0x3819933b, 0xb0ffeb8e, 0xb81d0212, 0x2652aabe,
-       0x54b87f7c, 0x9fe723e4, 0xb8c74c6a, 0x77ef96a6, 0x4dd95ddf, 0xab0fbe79,
-       0x36569fb9, 0x397240df, 0x57f70963, 0xe55af9c2, 0x9f05a7db, 0x386ff386,
-       0xd7e0f6df, 0xd7e3abea, 0xe6bf20ca, 0xfa07dda3, 0x3e414e8f, 0xeeff01fa,
-       0xddc5fa65, 0xbb801486, 0x81d5a36f, 0xcb06bdfb, 0x519287be, 0xf7e6ec6f,
-       0x946cd487, 0xee51feb8, 0x37a5f5c6, 0x091ad919, 0xedd389f9, 0x85374101,
-       0x14314975, 0xa2fa05ff, 0xbf51ca9e, 0xe9b03087, 0xa73f315b, 0xf067fae7,
-       0xd71ba96b, 0x6e6ff084, 0x555be732, 0x32340e2f, 0x07aa56f7, 0x0299f4b4,
-       0xe06cbcf3, 0x312c9cf5, 0xaebf6e5f, 0x5da05331, 0xe4f5cc9f, 0xda87010a,
-       0x80e4275f, 0xf84ddc65, 0xf8e2689c, 0x5fccb71f, 0x99f8eb81, 0xea30fdd1,
-       0xef5909d5, 0x6bdda0d7, 0x20e6fbea, 0x07321fca, 0xbc6ae1f9, 0xa7c47bbe,
-       0xf583ee1b, 0x268faf9a, 0x3e779afa, 0x367e456e, 0x714d0ee7, 0xb53fe047,
-       0x61c85cf5, 0xd5f03b6e, 0xaad47e85, 0x4ebb29fd, 0x729f691b, 0x2431b9db,
-       0xe8d2172f, 0x535cfaba, 0xc1cf971a, 0x9aa83f62, 0xadbd04cf, 0x8e082e2f,
-       0x70c0f153, 0xc2115e77, 0xebd102f3, 0x086c25be, 0x4e3fab4f, 0x73599feb,
-       0xf30b9a58, 0x1a7065dc, 0xf7ef802c, 0xc62fa7e3, 0x2e6f2ffd, 0x851dcc67,
-       0xcc4ceffb, 0x03ee1d7d, 0xb03f52b4, 0xeffa953c, 0xdda8572c, 0x84bd7262,
-       0x4f63ba78, 0xabed2e7d, 0x55ca7ccc, 0x3ce9ef0a, 0x053b1068, 0xa827e44d,
-       0x36eea1f5, 0x7ee09999, 0xea8936f7, 0xb3fc2a9d, 0x3733a42f, 0xe3df97e8,
-       0xdac1e0fb, 0xde92ef65, 0x1b9f5473, 0x90d27183, 0xd88d139a, 0xf3fb2cf7,
-       0x8e2ff418, 0x3e413d83, 0xa59fbf03, 0x0e4fa84a, 0x5ddf711b, 0xcd3b05c5,
-       0x6baeb2f3, 0xf79dca0c, 0x50ea890d, 0x19cf5bc7, 0x62bdb853, 0x5806ca08,
-       0xffe0139f, 0xeb813922, 0x3a21b693, 0xdca1df4e, 0xd0fc11af, 0x71d7c37e,
-       0x32d30f48, 0xf19bede5, 0x4332fdf9, 0xda535eb9, 0xa08d6715, 0xbcc28f87,
-       0x75c15c98, 0x7f7e1b60, 0xeb9bd1ba, 0xeba6e780, 0xfa9bef22, 0xbe72f92c,
-       0xff14e482, 0x0ab7e024, 0x60b36fc1, 0x8a36f149, 0x20d1fc83, 0xcadab3cf,
-       0xadb1eb4e, 0xda47d897, 0x147d8cf8, 0xc6f7c7e2, 0xadb6df87, 0x8372f9c3,
-       0x59238c7d, 0x71845f88, 0xdfbcd324, 0x994cf3cb, 0x11dc53fd, 0x0e5979d6,
-       0x03bfc03a, 0xe381d57a, 0xdf91d8a4, 0x767b5207, 0xca0ac3c7, 0xebba298f,
-       0x6c17b429, 0x8ee28e80, 0x1fd6af5a, 0xe5ca963a, 0xc0aa58e1, 0x7e368a5b,
-       0x4e493882, 0x1c5271e1, 0xe2438416, 0x14ebf0a7, 0xae50993f, 0x8103bde0,
-       0xa244af3e, 0x29a96a4f, 0xabe50925, 0x019cf899, 0x857f239f, 0x229ed3af,
-       0xae42d9f2, 0x235ca067, 0xb972b6ff, 0x3bb79f0e, 0xf38ec4b5, 0x5c7dc6ae,
-       0x69c6f411, 0xf5daceb1, 0xb3cbe112, 0x3a784ede, 0x4abbd6c3, 0x00cf2f81,
-       0xa02fb81c, 0x498ae5d3, 0xdb8d7ac0, 0x04b36315, 0xfadd40f5, 0x756e7a18,
-       0x73eddbff, 0xc2979fa1, 0x6b6cfef9, 0x3cf10999, 0x3f973d7b, 0xfdc77df5,
-       0x4f28ec33, 0xa32e8645, 0xb467ee03, 0x3f43889d, 0x54c768b0, 0x6f61ca3b,
-       0x70a86670, 0xf16fbb2e, 0x07e73b49, 0xf5aa6fcc, 0xbf4acf38, 0x78bff111,
-       0x6dfe2319, 0x3a87fedf, 0x6db3e394, 0x87b45631, 0x78c67667, 0xbe77ff51,
-       0x49d3e511, 0xe3788714, 0x319daf41, 0x7f224c74, 0xc56c8773, 0xc6f3d1f8,
-       0x3ca14fe7, 0xa147b67a, 0xb716c7e7, 0xed0e7c3d, 0xd8db4d5e, 0xda7cfad3,
-       0x954ffe87, 0xf765da87, 0xfed57ad3, 0x0a4dcbe7, 0x7ab3d1ea, 0xb71627ae,
-       0xeffe4abe, 0xf9dd8be2, 0xb33f0f58, 0x50c36ff3, 0xdb7e79af, 0x99f50c3d,
-       0x61eef5e7, 0x5af3df78, 0xbf247d4c, 0xf3c697c5, 0xccbdaa40, 0xe4d7a239,
-       0x5d85a28b, 0x2e6869c8, 0x459d7dc7, 0x3039a787, 0x2fdeab9f, 0x7ed1d5ca,
-       0x46f7a2fe, 0x3c87e7d9, 0x97d010d7, 0x87a1f5e3, 0x8654c547, 0x41aa65f2,
-       0x555e37cd, 0xeaef079e, 0x75e48587, 0x19a73a02, 0xe80eadc6, 0x6adafef9,
-       0x06f187c9, 0xcfe12ff8, 0xb9d53f91, 0x435beed0, 0xfc6b827e, 0xcfd8a1e0,
-       0x5051ac75, 0xf6f698ad, 0x6697f10f, 0x28fe7404, 0x6de9a3e0, 0xf7f27e51,
-       0xd413fa03, 0xecd47e17, 0xe6c69f73, 0x34f21148, 0x468cef79, 0xaf9e1e3d,
-       0x8458bf81, 0xdeaff55b, 0xa3f9e34f, 0x0eab7a8c, 0x345667f7, 0xb5e22b30,
-       0xfa675e47, 0x0a2f946d, 0x8128efcf, 0x4e7c2675, 0x22b3afe9, 0x8a5faabc,
-       0x4116dc74, 0x72a6240f, 0xaf9544bf, 0xe88e8086, 0x352810d3, 0x563687f5,
-       0xab36d7c8, 0x68f7be8e, 0x09ba9b68, 0x170d0bf3, 0x0c198aef, 0x723869ef,
-       0x3defc33b, 0xa6a5ad3a, 0xe2ee7c5c, 0x063ba66d, 0xfc26f905, 0xb852c77d,
-       0x0bfa0cde, 0x21dfed91, 0x59fecfa1, 0x8a40f076, 0xff3de44e, 0x1083b6ef,
-       0x7852079f, 0xe7933e7c, 0x1e7c784f, 0xbd543f6e, 0x092bceac, 0xcbd4f73a,
-       0x81cfc9a7, 0xb2f49a38, 0xb8d0aa94, 0x7629b68c, 0x4c8faf8a, 0x9e962bb3,
-       0x3bd3f7f3, 0x3d41b674, 0x39fd57e7, 0xd7b9d78f, 0x938f7184, 0x4cf323ef,
-       0xaddf6893, 0x5c79ffea, 0x9ee5f912, 0xc70f830a, 0xa60570a9, 0x1dec7cf1,
-       0x2ccf834e, 0xd544fd05, 0xdf7cbc8f, 0xd57dd121, 0xc7fd54af, 0x77e78b80,
-       0xf7e50da7, 0x17dc98b7, 0xf71f2ed0, 0xd17ae99b, 0x319d7e08, 0xab8c5ed7,
-       0x6253baee, 0x5f8407a4, 0xb869f2a9, 0xadbe79df, 0xa3ee37df, 0x53f820df,
-       0x30acb395, 0x58ed50f9, 0xc7970a5e, 0x85e3b43a, 0xaaffc768, 0xe7c3cff1,
-       0x496e3b05, 0x3d18e7a5, 0xbd3df43f, 0xfebc522b, 0x0ca790ac, 0x3d817e95,
-       0x266f0825, 0xd83ed00b, 0x7c6becde, 0xded7971a, 0xb909e7ee, 0xdf3c92b9,
-       0x3fccf426, 0x52cb9e4b, 0xb5f877ff, 0x5ec3fd97, 0x2cfbc7be, 0x2a4264b5,
-       0xae5a35e0, 0xfca0940f, 0x6221a7fd, 0xd85d3add, 0x3577886b, 0x699bd9f4,
-       0xe47c61d4, 0x83f9e6a9, 0x6de504a6, 0xc80e638a, 0x317b3fb4, 0xc7e883c4,
-       0x4090ba2d, 0xcbfa0d6d, 0xf17cced0, 0x6623d530, 0x6fe16b56, 0x3e2e9cc2,
-       0x87c724bf, 0x362cf3fe, 0xb34cf28a, 0xb8ac12da, 0xa929b9df, 0x95ca1f65,
-       0x6cac9377, 0x50bf1d0a, 0x79e26f1d, 0xb46965b8, 0xf98592bf, 0xc3eab303,
-       0x7fad7efd, 0x1bc8b370, 0xbc27e6f5, 0x7ae66ede, 0x724cbf65, 0xa6f9875e,
-       0xb633191b, 0x59e0bd71, 0x7524f3c6, 0x7be82b6d, 0xff715aac, 0xf2807d33,
-       0x835f5450, 0x1edba7a1, 0x6479464f, 0xa93d6d4e, 0x48f785f6, 0x95d7865f,
-       0x5eb8db6c, 0xa2c8d4f2, 0xc24c348e, 0x93c42d7e, 0x2a5fe829, 0x3bc464ca,
-       0x57d9a5c0, 0xcf05faa6, 0xf9d2ba8b, 0x1c531ffd, 0x2f47733a, 0x71a6a475,
-       0xf6248ebc, 0x23acf46f, 0xae9bdbed, 0x548eb95c, 0x80d87ad7, 0xea95c5f1,
-       0x5ea4cf49, 0xde5127ae, 0xf3cf5b31, 0x926dd9bb, 0xd955f315, 0xc3dd7c6d,
-       0x7f934757, 0x958fe63d, 0x2a07d476, 0xe14ece9d, 0xe1fb3df8, 0x75b42597,
-       0xab7a8fe0, 0xfaf5d619, 0x4ddf4b87, 0xa4c57de7, 0x634b73e0, 0x3fe9bbe8,
-       0xf8831bde, 0xa45a1d7d, 0xf5476bcf, 0xc193f391, 0xa92bf57c, 0xf9167794,
-       0xc3d83d6a, 0x275e60d8, 0x855bb9fc, 0x70826bbe, 0x3b9af285, 0x29bfdd78,
-       0xfa8e3dcd, 0x36cbeb3f, 0xa4e89f91, 0xc0abf47c, 0x1a3798d7, 0xbac58b08,
-       0x59a32ff4, 0x9a91d603, 0x926fdc92, 0xa74cfd1c, 0xf3c11ca0, 0x6ef27f54,
-       0x623ec855, 0x3ceb0bea, 0x858046f9, 0x7df03bf6, 0x3a083713, 0x8b3c41a6,
-       0x33402571, 0x03d0eb0d, 0x3f27bd45, 0xfe71e99a, 0x35ee0c47, 0xa97d63d7,
-       0x4158ef5d, 0x4fb0e042, 0x7759ed89, 0x5ebc9c92, 0xd49fd6ae, 0xf56f79ba,
-       0x93df0927, 0xea8ff9cf, 0x9cff624d, 0x7762675a, 0xb5f8a8ba, 0x619eb8aa,
-       0x832c3afc, 0xd2faeb5d, 0xd42392df, 0x4c294c7f, 0x7ada67f8, 0x57bc9ae3,
-       0xdeff4f88, 0xa96de33a, 0x1efb1fec, 0x0adc07a6, 0x0c322eff, 0xe709a1ee,
-       0xfaee2993, 0x91c4bfef, 0x26eb6d9d, 0x15d9d87b, 0x7f9402c5, 0xf779e0ec,
-       0x503dfe36, 0x496fc427, 0x7e767621, 0x57779f0a, 0xfff1195b, 0x18a8c0b6,
-       0x0a58ff1c, 0x23eac7a7, 0xbfa2a6d3, 0x69e80def, 0x3c630ebf, 0xd016db1e,
-       0x72dfa117, 0x9a92e90d, 0xd12e891a, 0xcb853edc, 0x7f6121d1, 0xba72a50f,
-       0xe3c87d95, 0x5e52cf30, 0xbd0ab15f, 0x75e7a9e0, 0xc9997df5, 0x4f4f9a92,
-       0xd97f5489, 0x637645d1, 0xf68942d6, 0xfadb7ed5, 0x916913cb, 0x5b33f1eb,
-       0xbfae444f, 0xfd218f94, 0x3b3e5bd9, 0x4b7d8f3c, 0x0f63c89a, 0x5fec79e6,
-       0xbd695aa5, 0x2521fab6, 0xfaeab2c8, 0xbe1d21af, 0x87408b48, 0x5c7f386b,
-       0xdf5b77fa, 0x7d5230fd, 0x6fce1af7, 0xe16efe4b, 0xa7e92257, 0xf3bf386b,
-       0xfd7f9e3b, 0x8aff3c77, 0x77ff18ef, 0xff9844a5, 0x01fdd5ff, 0xf0fff5e1,
-       0xfbe102fd, 0xcc0ea200, 0x87bde2f7, 0x7e5db5a5, 0xdb714d68, 0x07a04ba7,
-       0x982f09f5, 0x184e8ed0, 0xab61ebc1, 0x1b7c9947, 0x01bee0a5, 0x832c5f15,
-       0x41d611c7, 0xc076bce7, 0x30339673, 0xb2f98eca, 0xe0e28c11, 0x8baf334e,
-       0x6d35bd31, 0xb7c3ed0a, 0x7e0edda6, 0xdf2f5349, 0x174e6d33, 0x762f6171,
-       0xc9466464, 0xacefa867, 0xd5a5fb61, 0x6aea29d6, 0x0fbe56d6, 0xb495e997,
-       0x4abde9db, 0xf143fa1a, 0x38f5f87b, 0x246e733f, 0xdb9c94b8, 0x72541e29,
-       0x4427be10, 0x6e36d7fd, 0xa5e60e40, 0x6217e06d, 0xac71f05d, 0x6b3c520f,
-       0xfbea71a5, 0xbf87d87e, 0x930309ef, 0xbdeb9eb0, 0x6273ef9e, 0x5d4d6a96,
-       0x7fc1a0ef, 0x7544ae72, 0x8c0fb93d, 0x0ff3a43f, 0x30473e7a, 0xd077e031,
-       0x1bd52b36, 0x1ff11adf, 0x26bbfc79, 0xcfbbe75e, 0xc6ec87ca, 0xb8e019b8,
-       0xf121676f, 0x235dccef, 0xf8c0a83e, 0x2f3f3fa3, 0x295c47a4, 0x454705f2,
-       0x17cd43be, 0x63adf5a8, 0x1c724f22, 0x76d02ff3, 0x5a043e60, 0x5aee8fa5,
-       0x4fa527db, 0x84f2fd04, 0xde43f3c4, 0x543f3c43, 0x0bf47468, 0xb8394fdd,
-       0xb9abe70f, 0x50bf5e7e, 0xc59b3df3, 0x207f0a7a, 0x2fc0a3fb, 0x6c1c6c2d,
-       0xd85f3b44, 0x6d8d1998, 0xc3a7d3be, 0xca8cef52, 0x7e953aad, 0xb868f891,
-       0xfdeae758, 0x7bdf545d, 0xffeeac35, 0x3f7c3ec3, 0xc7e0b743, 0xd461f61f,
-       0xbf572fbf, 0xf8c7dd0a, 0x52395691, 0xc416695d, 0xdce708c5, 0x8ab70e26,
-       0xa57e59ef, 0x6273df0c, 0xb623576f, 0x6539d505, 0x39af7794, 0x9bfe88d7,
-       0xbef762e7, 0x665f295b, 0x989e3054, 0xbbcda1dd, 0xfe7832d9, 0x7f8955fd,
-       0xab1de9af, 0x70b8f8a7, 0xc7f89eac, 0xf14ccb36, 0x64c0cdab, 0x70a7f60b,
-       0x3ca0a8bf, 0x6cfb0cb1, 0x83f9025a, 0x8495fb05, 0x798283f9, 0xa5d8db30,
-       0x2ba78849, 0x7cd559d5, 0x739316da, 0xeff3d23a, 0x1ed6b3ad, 0x4dfb423c,
-       0x78a975d5, 0xbda5eb51, 0x7dd559d5, 0x2ff29e0f, 0x3c34fb35, 0x9831aefa,
-       0x79dc2c7f, 0x5ff628c2, 0x8273535a, 0x1dc2d875, 0xaafea8e7, 0xf53d5bd6,
-       0x86afc8e7, 0x929ce8e7, 0xfd79cb6d, 0x81c03b75, 0xdbac2b6d, 0x06fcf009,
-       0x1b6d8dd6, 0xbfaf1bac, 0x5a8f3cb1, 0xb50772ff, 0x531796bb, 0x93ec085b,
-       0xedbac366, 0x2edbaa39, 0xdf63d3ef, 0x36f5d524, 0x2895aecb, 0x3f7521ef,
-       0xfdd787ea, 0xaf9e68e4, 0xd037ecf1, 0x839e0c77, 0x25dfd226, 0x31b3736d,
-       0xb0eaf83e, 0xaee11b3b, 0x085bbac3, 0x3a759c5f, 0xc66e78cc, 0x8cc39759,
-       0xf6c2b6f5, 0x0fdc46d3, 0x180fa753, 0x90061f31, 0x4596e3a7, 0x7c73b6cf,
-       0x895b6fdf, 0xc57bf119, 0xffeb58fa, 0x3dfd8faf, 0xa0acb1f5, 0x291e927c,
-       0x1b9ce970, 0x34efddb1, 0x13d10fcf, 0x9ebc5dab, 0x5f7fbab2, 0xae75c392,
-       0x219509be, 0xf39435f3, 0x6c6d85fc, 0xf5e8737f, 0x1e061925, 0x4239e047,
-       0x41ffde11, 0x8e35dd1f, 0xf41fdd5f, 0x9d57e089, 0xefa2643d, 0x2c77da49,
-       0xc418eec8, 0x1f343f05, 0x32bcbab7, 0xf7cfbf1b, 0xb9628d1e, 0xc9a75f3c,
-       0xbab0b1c7, 0xb9796f5c, 0xa73ae599, 0x750bf699, 0x0edda165, 0x7d319fcf,
-       0xebb71657, 0x9e7e74ce, 0x159d3783, 0xb9f51eb3, 0x7bdf33df, 0x8cfc61fd,
-       0x0bd91d72, 0x50574eb5, 0x81cb67ae, 0x19960b3f, 0x2b9f547c, 0xfba09fd7,
-       0xb06c6e22, 0x9f23a416, 0xb4683f1f, 0x3c2d5e62, 0x7f28e63f, 0x3c2fa9a1,
-       0x1c91a8ef, 0xd52bacb8, 0xe07dd4f1, 0x47db5ab3, 0x086dbe63, 0x051a6e6b,
-       0xafe90fcf, 0xe9fee2b3, 0xbe3cf59e, 0xf840bbff, 0x3679e139, 0x4bf433e4,
-       0x71f0f3c2, 0xe20f9ce9, 0x9cfdb9d2, 0x0a2db480, 0x173ea3ce, 0xd2f33fce,
-       0xf0bf75b5, 0xfdc553fb, 0xd582f286, 0x13be91fd, 0x49ed0c74, 0xa9a97943,
-       0x397cc87f, 0xdb7f7ce9, 0x4c1f5813, 0xf20fad0c, 0x5d78603a, 0x8573d550,
-       0x831d7fed, 0xfa075ef8, 0x2798ed1a, 0x0a0fd795, 0x8fd928df, 0xa708237a,
-       0x7a953fd8, 0x04ec7bf9, 0x70c5d7c6, 0xa7779cff, 0x82b9f944, 0x8aee5f09,
-       0x81733e81, 0x76bd43dd, 0x0b2affb0, 0xfa09a3ea, 0xc7aefc22, 0xd72e92e3,
-       0x349eb099, 0x71eaedf5, 0xe1419df8, 0x230e431d, 0x30a8ee5d, 0xd540fed0,
-       0x7b7d4dee, 0x7f7e18fa, 0xbc68cae3, 0xcc39279f, 0x2f2f5e0a, 0xb7e3ebc5,
-       0xce9331f8, 0xa0742226, 0x4f0703cf, 0xb66e51ea, 0x1825dc98, 0x114e173f,
-       0x6e0aa675, 0x9b68efa7, 0xe7e46062, 0xeee6ed69, 0x1f28afcc, 0x4856ddd4,
-       0xee3b23f5, 0xb414187f, 0xc13b8537, 0x3b5ec58e, 0xdd2f363b, 0x11bcf84a,
-       0x63c218ec, 0xf4ebc29b, 0x11cff4e1, 0x2ecdeff4, 0xd187a6f5, 0x2b39e0fe,
-       0x6a529f28, 0x60ae3b4f, 0xfa3867de, 0xc21e12eb, 0x35ff2bd2, 0xd096fd0b,
-       0x4eb73f8b, 0xfbaf7bf0, 0x39ff5aa7, 0xf4e6a675, 0x63751dff, 0xeb52fe35,
-       0x76bc6a4d, 0xda81f046, 0x3fed159e, 0x1a037dfc, 0x37df88d7, 0xdf7f22d8,
-       0xce85bb30, 0x6fbf5129, 0x25646bd8, 0x3f71135b, 0xc9def8ad, 0xa4fc8537,
-       0xbeff4fbd, 0xf88917f1, 0x278493bd, 0x3c3d806b, 0x3d5e764c, 0xedaeaeaf,
-       0x6d6f9e73, 0x6bc3fbe1, 0xfb9f235b, 0x77da0372, 0x2728ef78, 0x2b51bd23,
-       0xd98edbf6, 0x9744ea26, 0xebf796f3, 0x1e96f343, 0xeea49025, 0xbc51f5e3,
-       0xf663cda7, 0x53acb796, 0x96afcfbf, 0xae1f681c, 0x59b70fb4, 0x35edd7ec,
-       0xe6fce98f, 0x79e1b97d, 0xb5d3f7cc, 0x69939c75, 0x74ff5a56, 0x36e744b7,
-       0x1aae7499, 0x86ffb7da, 0xcfb48d64, 0x87610bfb, 0xc83a8bc6, 0x3f9c8dcf,
-       0x44937e7e, 0x77e0dfdf, 0x9ff74878, 0xc3bfc1bf, 0xff0179f9, 0x7bad470e,
-       0x5cd7dfa8, 0xd07bac1f, 0x77ea77f7, 0x3677ea39, 0x539d77ea, 0xb9d347d6,
-       0x5a188fc5, 0xebdfb952, 0x3a7cbe25, 0xe8fdd19d, 0x491f5628, 0x97a68f5e,
-       0x845e9d3c, 0xdc79aee3, 0x423d297b, 0xe30c3bdc, 0x218f7848, 0x3c85e203,
-       0x305e2916, 0xe2691465, 0xc787ea05, 0xeeaad70b, 0xcfc0a4f1, 0x6df75c35,
-       0x6bc6fc91, 0xdfebff38, 0x45affcf1, 0x732adba2, 0x1f17f3e4, 0xbe8490cc,
-       0xce179ed7, 0xc92f7c7a, 0xa4937aed, 0xd533707c, 0x4f540dd3, 0x536af557,
-       0xbc7f9f2c, 0x6da9a7c8, 0x0c9b6895, 0x4b65f391, 0x6467fdc4, 0x93e438e7,
-       0xf36a2f81, 0xb45b8397, 0x5b1bcbf9, 0x0c88e7b5, 0x09cf6bf1, 0x3dafdc29,
-       0xa028a63f, 0xf8663f3d, 0x31f9ed51, 0xe7b43a23, 0x99fcdcc7, 0x5b98fcf6,
-       0xcbf9b4ba, 0x1edc2f5b, 0x8fa71df6, 0x9c09479f, 0x995cfa1b, 0xb9d85e69,
-       0x73b0ba35, 0xcec3a26b, 0x1f3b09ad, 0xe39bcc45, 0x7e7613ed, 0x367d768d,
-       0xba0dc7ac, 0xefdc7afa, 0x1ea228fa, 0xcf8ccfd7, 0xdfde513d, 0xfa9b7e8c,
-       0x097ff53d, 0xe1913b3e, 0x71f4815e, 0x875b1caf, 0x22b1d57c, 0x2ef30b2a,
-       0x726995ee, 0xfb83f022, 0xa7be8951, 0x46995d2f, 0x35e67bfb, 0xa93f210c,
-       0x4fc93980, 0x1167659a, 0x9cd879cf, 0x3decf5c1, 0x8c6606f5, 0x462997c7,
-       0x33d0a81d, 0xc35b124d, 0x22658ded, 0xe33561f0, 0xfabb587c, 0xbdd51c70,
-       0xc859dd85, 0xebaac151, 0x0e79d017, 0xa8bde7e1, 0xc623c676, 0x6316b0d5,
-       0x68bbcc1a, 0x47c93b6d, 0x1e3079f8, 0xea1cf6b6, 0xb096dae1, 0x7db7f5eb,
-       0x1ff7f8ca, 0x3c8bf446, 0x2ffbdaad, 0x99ba8864, 0x7e503983, 0x9ac7f7dc,
-       0x152ccfd0, 0x56bb99f8, 0x709d62b2, 0xd27b435e, 0xb79fd05d, 0x4bb8a65f,
-       0x71eb0fc5, 0x3a20cf4e, 0xfefcfd57, 0xcfa3f25c, 0x8e0a4a2b, 0xb8f1c773,
-       0x87bbd241, 0x7659f5e3, 0xe73c70f7, 0x58c3ebac, 0x9d87f6fc, 0xdf9320b8,
-       0x3e50be00, 0x96566ff9, 0x9def9a1f, 0x6326b06b, 0xeecbc5be, 0x5378a54d,
-       0x7e2abfc4, 0x6788263c, 0xf10fb0e3, 0x749f5f2a, 0x91fa2249, 0xff02eb69,
-       0x7e03df08, 0x26b3c510, 0x7e815a66, 0x39a569d0, 0xd7605d19, 0x2ff20643,
-       0x4092d9ee, 0x0d3dc5fe, 0x1f3c4665, 0x096d9ee1, 0x79969fb4, 0xbe30479d,
-       0xa279e955, 0x2a5f70a1, 0x4b4f7bcc, 0xd2d6438e, 0xd137e4f1, 0x09d35171,
-       0x7b277e95, 0x48c9dfa1, 0x69ba03f4, 0x4321ffae, 0x6e8209f8, 0x7d3b41ec,
-       0x64b157e7, 0xffe62e6f, 0xe99bd7ce, 0xc67a2bf7, 0x37ae5e05, 0xc4d26f2b,
-       0x2e7de53f, 0xbe7475c7, 0x22daf777, 0xdd385fa2, 0xde67ffca, 0x8afefc70,
-       0xa1963efd, 0x1fab31ff, 0xc63b739b, 0xb79712c9, 0x96c6ab59, 0xa5f3bfa3,
-       0x8b6fcfd0, 0xc630e938, 0xbfd7e049, 0xf412718b, 0xd27113df, 0x41271807,
-       0x49c621fb, 0xe7149ed0, 0x0772aa05, 0xfb7c408c, 0xafb790b5, 0x6378d433,
-       0xd7e62a69, 0xdde7ffca, 0x5f159d22, 0xa349e3f5, 0xec9b1933, 0xd3d7fad4,
-       0xebfd69a7, 0x4c75830e, 0xd581da2a, 0x8f705ebc, 0x78cd66eb, 0x988c57a6,
-       0x857960f7, 0x8f64ebc1, 0x3de62314, 0x6bb04c66, 0x94d9dfc6, 0x32dbe9ae,
-       0x94f75a15, 0xeb9a7ef2, 0xd40c5777, 0x005ee7f4, 0x5df90cc7, 0x59f92629,
-       0xc626e22a, 0xac5d398a, 0xf597ec7c, 0x001e53c3, 0x683cbf78, 0xf4e1fba0,
-       0xb95ae950, 0xee7ca65e, 0xf312f5bc, 0x9b278802, 0x7d7c91e7, 0xce96347e,
-       0x52dc6991, 0xf43156f8, 0xd0316c4f, 0x0d13b2fe, 0x7cf147f6, 0x925b13eb,
-       0x3dbbf0e2, 0xfccca377, 0xa4ad77a4, 0xcb79d577, 0xefd0561a, 0x45f5cc26,
-       0xcc0f5039, 0x567de3dd, 0x4ddfa3ed, 0x4e50665b, 0xbf3ec88e, 0x1273f444,
-       0x299b377e, 0x8199fe4f, 0x92a7f179, 0xb87075e6, 0x0358933e, 0x8f9b4ff6,
-       0xe000780d, 0xb9b13338, 0x957e874a, 0xf489307c, 0x43322be7, 0x6258adbe,
-       0x1787f3a0, 0xc46f27be, 0xd20a933e, 0xfa65bd39, 0x39b60f7d, 0x5d67e68a,
-       0x6e3021c0, 0x9ea22fe9, 0x5ef2235f, 0x60f5ffd4, 0x9fc11adf, 0x259f47c8,
-       0x01026730, 0x7f0ff3cb, 0x75449c3a, 0x7d3e209f, 0xffeeb8f9, 0x64c6bbd0,
-       0x54fefd02, 0xfd27cbe5, 0xc91260f6, 0x4fde3855, 0xf2feb91a, 0x41481ca2,
-       0x339419bd, 0x3cd5fdfe, 0x41d92383, 0x1a686b7a, 0x6b93adea, 0x6467940d,
-       0xaf1c677a, 0x7c42bdcb, 0xa4e7beac, 0xf083195e, 0xa1ca6c9d, 0x59ef0cef,
-       0x43fd932b, 0x7de3e3fe, 0x971fff9c, 0x7bbf18dd, 0xc637249b, 0x737ce1ef,
-       0xf4e192df, 0x11b3047b, 0xea7a2327, 0xbc69b381, 0x17f6a10e, 0x07bfe4ed,
-       0xe87686c0, 0x5d0e0da7, 0x9f7f0347, 0x4e7358bb, 0xdfdf4d79, 0x9c23c71d,
-       0x17efefce, 0x9ce9df8f, 0x9f13223e, 0x3cdbee9d, 0xf9e8152c, 0xb0d76e85,
-       0xf9ffa007, 0x7a27ef44, 0xfbb46fa4, 0x62ebc43e, 0xfc2cdadd, 0xedb3ba6e,
-       0x866f47e3, 0xb2f4fee7, 0xbe6241c1, 0xc7f4892c, 0xb30bcda2, 0x21bbe9bf,
-       0x787dfcc6, 0x2699d1de, 0x2b173e01, 0x9f30632d, 0x84b99f30, 0x51f8e23d,
-       0x86bcf0b6, 0x73cf1d75, 0xbb145c7c, 0x79b4e306, 0x8f8c7961, 0x8d83f7c5,
-       0x6fc69299, 0xf5c99838, 0xe71d3cd7, 0x38b7886f, 0xb1a631bf, 0x5edeaa03,
-       0x220fbf8c, 0xaa80ed07, 0x33586bb7, 0xb3fd6b9d, 0xff34becc, 0xbf47c942,
-       0x27875223, 0x2af8c354, 0x6b638f2b, 0x51f28c5e, 0xe580aa9c, 0x8e0ff10b,
-       0xe7813ea1, 0x7e5f1916, 0x0177d90a, 0x8675f00b, 0xc193fb8d, 0xe9c81557,
-       0xacaa7f69, 0x346c1b1b, 0xfb81c1bf, 0x79081719, 0x7c966dad, 0x25075e7e,
-       0xcc5f3a3b, 0xd1d85f33, 0xc3d4fb70, 0xa3d9852e, 0x977661f9, 0x2ced6b35,
-       0x79e74bc0, 0xc386f0ab, 0x25898ae9, 0xe66a2c3c, 0xdcab3efb, 0x08937dbe,
-       0x1401c96e, 0x02cf01ed, 0x80951ae6, 0xc79178eb, 0x85f0e1e9, 0xbc07abaf,
-       0x70e19d62, 0xd1ce3957, 0x5b35e5f7, 0xf857c224, 0x847a543a, 0x5d2a71fb,
-       0xbf1cbcaa, 0xd1126d55, 0xff65d4f3, 0x50fed190, 0x0b586f95, 0x79e42ffc,
-       0x5d608f95, 0x2dbf5093, 0x38fa0758, 0x2d3f27a7, 0xc8712d62, 0xdfcc7537,
-       0xd3f72588, 0x473b96fe, 0x4e79e0e4, 0xa9dce987, 0x573f9b0a, 0xeca88097,
-       0x96fcb47c, 0xe3879f20, 0xbdf44afb, 0x5131fc5a, 0x00e7a067, 0x905ff35f,
-       0x909ffbe9, 0xf63e2271, 0x7b557c92, 0x3fac46bd, 0xb9f9eb57, 0xd3825772,
-       0xcbbfe7a3, 0x05784574, 0xdc35af3e, 0x7f5a59d1, 0xe577e839, 0x5bd247c6,
-       0x098f3aea, 0x7b45733d, 0xc5dc77af, 0x4927dec8, 0x4de9af98, 0x3b09577f,
-       0x3eed1f3f, 0x7fac9fb4, 0x3c6bce95, 0x3a55eeb5, 0xf2f8d59f, 0xf0b7da7c,
-       0x8f79fac9, 0x7c4fefe2, 0xd91e65b2, 0xab4f05f9, 0x0c6dde76, 0xd6ca1ff5,
-       0x5fee7dcf, 0x345f6f90, 0x6ab95d53, 0x41c45b8f, 0x9c6157a0, 0x51eb9eb2,
-       0xd5eb8eb6, 0x070f6805, 0x0ebc3d91, 0xe55fddc7, 0x3ff90ebe, 0xc9d93ae4,
-       0x7fb9e7fb, 0xbde613b5, 0x8718a5ff, 0xf56c9697, 0xd5b4bcf3, 0xf6b0f68f,
-       0xd38e0fde, 0x07c94bef, 0x6a81fbdf, 0x139e19ff, 0x42ce2ee5, 0xbf761339,
-       0x6598de56, 0xec223b45, 0xdf1b3fc4, 0xc9be20f7, 0xfef8e2bf, 0xf9e389a8,
-       0xef1cb5e3, 0x51fa5b8d, 0x5351fafc, 0x3eabf23f, 0xf84b92da, 0xf8035cae,
-       0xd15abf26, 0x804d55fa, 0x101f8c6f, 0x3dd700df, 0x6f81147b, 0x1377c707,
-       0xcb5b33c7, 0x781ecadb, 0xebf9d2f5, 0x947bfff7, 0xcf84fd03, 0x9ff27ecc,
-       0xd32adb3e, 0xdfaa6959, 0x7f3dfaa5, 0xa2cfcd66, 0x7be2a67f, 0x3e4080e1,
-       0xc78a97ea, 0x7887177f, 0x2795b85f, 0x9be07a4f, 0xbce85339, 0xbfefcbfd,
-       0xce2d27ec, 0xbe93f50a, 0x98ea5d25, 0xd72bf68b, 0xf96639e1, 0xd5a2fb21,
-       0xdf0b3fdf, 0x7cf0ad07, 0x98731465, 0x464f084c, 0xb9b8eff8, 0xfe8bee19,
-       0xecdcf72a, 0xbb8e497b, 0x31c7bf34, 0x780df989, 0x916b019e, 0xed4bbf68,
-       0x257125d2, 0xad2dcf0c, 0x67363827, 0x69df3b71, 0x3f22caee, 0xc714676d,
-       0x359ba8fb, 0x07a4d1f1, 0x423ff11d, 0x3f20e03f, 0xd79278df, 0x49cef941,
-       0xab5243c5, 0xff3ae842, 0xb8d73f02, 0x9cc482ea, 0xc09dfc76, 0x622fb4b1,
-       0xda14f37e, 0x6d055007, 0x5ef8e859, 0x9cdbcfbe, 0xc7a2f3c5, 0x78054d71,
-       0x1df8939e, 0x1a9e713c, 0x370171d5, 0x3a2ecdc7, 0x9278ef6f, 0xc8cfc1c9,
-       0x07dfa78b, 0xc1e85bb8, 0xb47d9699, 0xf1e61c8f, 0x7b9e1b32, 0x0501aeff,
-       0xf1d4c2ac, 0x73c68632, 0xbefe3f52, 0xff5b8749, 0xdf22ac1b, 0xbd92edbb,
-       0x3a413c27, 0xf381cf6a, 0x8fce4744, 0xfdc59abc, 0xa4e9c929, 0xcc14443a,
-       0xdfef0d1d, 0xebf0a59e, 0xdb3bff62, 0xed8cf400, 0x7a9c9e79, 0x39f9799d,
-       0xf0a535b2, 0x67189bef, 0xb21bd424, 0x31afd34e, 0x9e87fbf2, 0x5d793d9d,
-       0x30ef6306, 0xf43f7ac0, 0xff8f1953, 0x70fbc6e7, 0x3c64d7df, 0xad86ca6f,
-       0x76eaf89e, 0x78eaf33d, 0x7ac164db, 0x6a673888, 0x1ddfc092, 0x0f1fccc5,
-       0xa03fefbc, 0x2ef16f3d, 0x1d7fcebf, 0x9e3275e0, 0xe78f9767, 0x2b0629d6,
-       0x2e55c7bc, 0x52bc6015, 0xc1dbf2b3, 0xc2ecf1db, 0x4246ebc9, 0x70e3a75f,
-       0x29e780fe, 0x1efe6266, 0xcf5b30f0, 0x9c05c8f6, 0x8f1788de, 0x207da14d,
-       0xda244b5d, 0xede6a2af, 0x090f7a55, 0x8e89ede6, 0x307c0533, 0x3e1c534f,
-       0xaf4c8c6f, 0xb8d4b22f, 0xede285ba, 0x173e42c5, 0x45b972ab, 0x6c96972b,
-       0x8ff44741, 0x45336f01, 0xf9a4eb0b, 0xd47bc46b, 0xd9cdd773, 0x36737e7c,
-       0xf2ffe38f, 0x598fbe77, 0xaa8ef9f8, 0xf146d67c, 0x4ff7d5f9, 0xb6546d16,
-       0xe155e68d, 0x7fd7cf09, 0xf91561ba, 0x677fd549, 0xdf443ebe, 0x324c5d50,
-       0xea225576, 0x4999efa5, 0x5b1a66ee, 0x3d2deb72, 0x15e7a9c7, 0x8180b056,
-       0xbe440fd7, 0xd1a3d84c, 0xbfce85b2, 0xeff890ac, 0xc4967674, 0xe720757a,
-       0xbf7cccc7, 0x1ff079e7, 0xc0153df1, 0xef31f817, 0x27fbf8ac, 0x11583fa1,
-       0x7b63d467, 0x73cfcccc, 0xb102c39e, 0xfd413939, 0xd32258db, 0xfbcc8739,
-       0xafac64f4, 0x213ac2ad, 0xcce63fef, 0xe894aca0, 0xea36f73f, 0x811769a5,
-       0x9befa80f, 0xa93884ec, 0xcfb8af73, 0x9df3d236, 0xf67e090f, 0x27fde26e,
-       0x279bfbd5, 0xab9df3e3, 0xe4bffbd5, 0xf3a89ffd, 0x61e3fe8b, 0xdd8457f7,
-       0xdfef19ff, 0x272fdcf4, 0x2d8fd17b, 0x715dace5, 0xcfbf4493, 0x1bd423f1,
-       0x562b0fa0, 0x15cf09fa, 0x2dbc5dba, 0xd0dd7e65, 0xcaab8f2b, 0xed08fd76,
-       0x327b1c95, 0x92f5ed16, 0x67f5271c, 0x6747ba66, 0x8a68bb43, 0xbac235e4,
-       0xd91f11d9, 0xe8bd498f, 0xbd091fe5, 0xf9f0a55c, 0x3cc37c54, 0xfe8bb293,
-       0x9cfe79fe, 0xbb9e63dd, 0x5d9e06ae, 0x66914f08, 0xc0d5f71e, 0x768e5d73,
-       0xda1fd51e, 0x23f9d7d3, 0x2edc2b84, 0x23b1fe2e, 0xec53f31e, 0xe29df12d,
-       0x42ac96ca, 0x2ff17f98, 0xa1556477, 0x82fc25ff, 0x768bb43a, 0xdb83173c,
-       0x3fdbcfc5, 0xb6e5fbe4, 0x60c71bb5, 0x50da001d, 0x0bd358bb, 0xb56cde9c,
-       0xaf38ffce, 0xb4f2fe1b, 0x58b9e91e, 0xd3c9f2d7, 0x926fe768, 0x59777e22,
-       0xde3b9e2d, 0x3525efcb, 0xe03f7366, 0x87cefea5, 0xb20b6f10, 0xb291e919,
-       0x79cf9155, 0xb1e85b7e, 0xe6ff610a, 0x29358b0d, 0x23a2e780, 0x0fb855ee,
-       0x4e436aab, 0x978de601, 0x963e9667, 0xd6f98dfd, 0x6d6f9e2e, 0x0ad6f9e3,
-       0x2829605b, 0xf666f671, 0x32998f5b, 0xa9fe0fc1, 0xb220672a, 0x94796cf0,
-       0x79353fda, 0x0f9e48d4, 0xcfcbfec3, 0xe50c7f1d, 0x83c23f66, 0x83e1f5f9,
-       0x743f51a3, 0xace8c4e4, 0x25fe47a0, 0x089bee63, 0xb7e1acc7, 0x929a7ed0,
-       0x7301d8a8, 0xf89efe79, 0x5c325fe2, 0x38dd709b, 0x6e24f31e, 0x2ee93fa3,
-       0x4dfb8758, 0xbab3f699, 0x91dc63f3, 0x2efff3ea, 0xb666f0f0, 0x3afdda95,
-       0x0820b380, 0xf07efa87, 0x600697f7, 0xd32b93be, 0x50f7e086, 0x0e4a3227,
-       0xdf051764, 0xbdc3227f, 0xdf53e11d, 0x06c7527f, 0x6df1c860, 0xd05578e1,
-       0x0dd200f7, 0xe048d75a, 0xefb890b7, 0x9a3151f6, 0x7609b4fe, 0xe3cd0ce6,
-       0xf4d74b4e, 0xd3f457a7, 0x72bbbf8c, 0xc4fee6a0, 0xfad0c0a8, 0x77b7bf10,
-       0xf7cbc97f, 0x46c6c4ef, 0x3fbdfee3, 0x7df9fdb6, 0xcee9fdfc, 0xfa076417,
-       0x6e770bb6, 0x168f1f7a, 0xb5f40f3e, 0xa1527e53, 0xf69fda7c, 0x839f8ccb,
-       0xd687d4e1, 0xc0b0ce91, 0x60a52353, 0xeb6dfb7c, 0x7bad8b47, 0xae0577e8,
-       0xf3e8dd55, 0x287f516c, 0x1f680560, 0x47bfd7cf, 0x0b3abd79, 0x1d99e75f,
-       0x3c5b9cfc, 0xf012fae7, 0x20f86dfd, 0x40178bfa, 0x97fc83f1, 0x7aa09eb5,
-       0xae6c9adb, 0x9632ebaf, 0xf64fd1e8, 0x65f68b40, 0x78ade80c, 0x3b409be0,
-       0xf70dbc1b, 0x72c4e5bd, 0x54c2fdff, 0x8fef9bca, 0xfd9ff9e6, 0xfbf409c9,
-       0xc69b8bc7, 0x0bbaf5d2, 0xdbff3431, 0xb5f68072, 0xa8935f79, 0x7d31314e,
-       0xcf5c4ad6, 0xdf4401ff, 0x80006da0, 0x00008000, 0x00088b1f, 0x00000000,
-       0x7dcdff00, 0xd554780b, 0x399ef0b5, 0x67091e67, 0x99212726, 0xe4c21024,
-       0x4e010249, 0xaaf08042, 0x9e180903, 0x6831004e, 0x0cfde1d0, 0xaf4a8809,
-       0x04819bf4, 0xa86c1808, 0x3bd15014, 0x6ad480a4, 0xa6a3ea6f, 0xd004c7d6,
-       0xa0d2941b, 0xdef6b7fe, 0x22c01b5b, 0xda046a28, 0xfad2de9f, 0x3ef6b5af,
-       0x82499cc9, 0xbf7b7b72, 0xdbe3ef9f, 0xb3ef6759, 0xd7bdeb1f, 0x6b4cfb5e,
-       0x7eef2074, 0xff99b185, 0x1b297b72, 0x97dad8c6, 0x1e609e4c, 0x857bd2c0,
-       0xd35ca0eb, 0xbeb19530, 0x5356b308, 0xd731631c, 0x046c61ef, 0x2c018cc1,
-       0x64ec728d, 0x435a5031, 0xc3c64fd9, 0x3b43ab33, 0xeaac66ec, 0x37bd147a,
-       0x3011d8bd, 0xdbbc7d43, 0xc648d8c4, 0xe953ed2c, 0xcbd7c9fd, 0xfc6bfea8,
-       0xfd631b77, 0xaf54e9dc, 0x438496c3, 0xdb0522f2, 0xb4fda89b, 0xaca843eb,
-       0xca873ebc, 0x147e7277, 0x84fac3ef, 0x17fa536b, 0x526f1c02, 0x64ac4a71,
-       0x628d999c, 0xa33b7eec, 0x47ab577f, 0xaba530c7, 0x72d2c8df, 0xe81e625d,
-       0x44dd76cf, 0x8f74c0e5, 0x6c604ee6, 0xd976a6d6, 0xec51eb8e, 0x8034e1ea,
-       0xcbddf28b, 0x93debaf2, 0xbab7cd8e, 0x7bfbc287, 0xd03d58ce, 0xe2ca0dbf,
-       0xc64afab0, 0xdd794d3c, 0x36e51bc7, 0xdb193ad3, 0x6c2ce54c, 0xcbb3ef07,
-       0xef3865df, 0x6f3e557b, 0x912611b6, 0xb60658cc, 0xbf7ae84f, 0x60c1d00d,
-       0x6d97815e, 0x77f0c3c1, 0xd4afba51, 0x4db4fd0d, 0x602fe564, 0x6a5b723f,
-       0x371fe399, 0x38b799ff, 0xfe6271ff, 0x46d896bf, 0xb7d7efec, 0x81e6d6dd,
-       0x3c3cb579, 0xeee48462, 0xb75ef7ea, 0x76abf795, 0xcf4060dc, 0xb8fa37aa,
-       0x66fac277, 0xdc208f02, 0xd82dbaf1, 0x99cf4698, 0x5b4b1e29, 0xabea09a3,
-       0x5ed91d9c, 0xcdf8bf18, 0x6ff210a8, 0x32519bcb, 0x9f7e7183, 0xe917bbe9,
-       0xa0e6fc58, 0x26139312, 0x464d9af9, 0xd036583e, 0xef3e1f73, 0xf1bdbe6d,
-       0xd69c6009, 0x535fc911, 0x18814cca, 0x1d5f6fe0, 0x82859397, 0xef5d173f,
-       0xc84fb043, 0xc4ead5cf, 0xabb74829, 0xb0d2609b, 0x4c9b458e, 0x75825f43,
-       0xcb43b731, 0xeccc3c02, 0x730b60bf, 0x69995ca2, 0xc48733bd, 0xe9a06b06,
-       0x06b1eb9a, 0x9ebcabf9, 0xbdaffd46, 0xeb9e97de, 0xc848b672, 0x19f90d87,
-       0x9f8225e0, 0x197e45ef, 0x1b8725d3, 0xe28f7dd3, 0x80d667fa, 0xbe78c3bc,
-       0x2885c92d, 0x62fc5d47, 0x80af9155, 0x8596925f, 0xcb4d4dc9, 0xf42a987c,
-       0x7e25ef1f, 0x71650259, 0xc152fd58, 0x7b789107, 0x65f916ec, 0x48bf68b3,
-       0x01996509, 0x28ea960f, 0xe7cc0b6d, 0x0a7bbc4a, 0x0efd65e2, 0x16f5bf8e,
-       0xe603b16f, 0x9371febb, 0x8b619406, 0xa8ec3947, 0x587d4687, 0xf185f56d,
-       0xc3ebfced, 0x30f01b98, 0x95267ae7, 0x83be01fe, 0xd785feb8, 0x0d3a09e7,
-       0x8bb992a3, 0xd8c5cccc, 0x1baba406, 0xe9c45427, 0xad77e62c, 0x43e2747a,
-       0x53b5fe30, 0x88bfaa16, 0xa9802d78, 0xe34f027a, 0x9b412cbc, 0x75e61076,
-       0x2a02c2d1, 0x7ef169d0, 0xdfa00589, 0x46fa5025, 0xd83d52d0, 0x1481f6ce,
-       0xb176c16c, 0x805b13cc, 0xe6f584f8, 0x86be31f0, 0x6d4c97ff, 0xfd410fd9,
-       0x961b33e7, 0x81e03399, 0x86412a74, 0x82fe7e75, 0xbe7824c4, 0x2e5bdd72,
-       0x94ab1e58, 0x50aaa60e, 0xcc14c1bf, 0x7be280b6, 0x86bdf646, 0xbbd3e07a,
-       0x08adfe9b, 0xf0dc7dda, 0xaae913a2, 0x0e49b5e3, 0x4d3f6165, 0xcc00cf80,
-       0x2a5ea9bd, 0x6c342a0d, 0x5da1b29f, 0x73f3adfc, 0xbaaf9f24, 0xba78419e,
-       0xfa1b6d5a, 0xf031f212, 0xf5d73e2d, 0xae3aeaf1, 0xbefd75d7, 0xcebff056,
-       0xd73295d7, 0x4c4a955b, 0x6e169030, 0x13bcca6f, 0x4c72ef91, 0xb70b165a,
-       0x8e8f8d37, 0x32f83945, 0x5d61ab5e, 0x839742f6, 0x8049fc57, 0xa47b2ebc,
-       0xc7ae81cb, 0xf3aebd75, 0x26af6ebd, 0x2f2fe4fd, 0x79fc3bfe, 0x81d7cd32,
-       0xe64d307c, 0xec9a6b76, 0x1c9a3e20, 0xff23265f, 0x79fd7b7c, 0xb3cfe856,
-       0xb6b9fd06, 0xc7f9fd17, 0xf387945b, 0xda967f42, 0x3cde7dd8, 0x3b67dfae,
-       0x4a2bfaba, 0x834b649f, 0x1334947e, 0xcd47fbb5, 0xf3e3495b, 0xfef3b6f8,
-       0x6fceb12f, 0xd303fbd2, 0xa46fd4ac, 0x1fd0679e, 0x5f2ff9ea, 0x1da20dcf,
-       0x5d8188f8, 0x5af7bb40, 0x6161f71f, 0x444ec807, 0x666f04c7, 0xb9927e07,
-       0xa7e22078, 0x4ee03b07, 0x80ec3bfb, 0xbcba57ce, 0xcba1f2e8, 0xe8fca443,
-       0x11fd30f2, 0xa421e62d, 0x30e6200f, 0x781c8fca, 0xe951d70e, 0x728f93ee,
-       0xf811cba9, 0xdd672461, 0x9b9083ec, 0xda31392e, 0x742e5d0b, 0xa6e5d139,
-       0x52c5c852, 0x3cba1721, 0x1e9a971c, 0x3def0b1b, 0x432be697, 0xb1f2e87c,
-       0xbb4885e6, 0x313f2bd0, 0xf1a5a7e4, 0xa9f90cd5, 0x7e70ca12, 0x4fc2f5b2,
-       0x9f916ef3, 0x9dbed24a, 0x8d32b11f, 0x40ff11fb, 0xd6995a7e, 0x0ab15fb3,
-       0xca7fecf9, 0xfd5ab8af, 0xcc37429b, 0xe8216ae7, 0x7e2eb4d9, 0xe32efe9b,
-       0xf806437e, 0x46b450d9, 0x5ab675f3, 0xb06b0407, 0x1aacd7dd, 0x01fba8f1,
-       0x7dee914b, 0x27f4f8bb, 0xfe71ff60, 0xc15bfd3a, 0xedf75fff, 0xd9d11df4,
-       0xf566df16, 0xdbbd21e4, 0x37bff60c, 0x5bb1f17f, 0x6fe6f3a4, 0x4243e749,
-       0xfa0ffc6f, 0xd17a878b, 0x1eff8713, 0x862cceba, 0xfc21fb3f, 0x3c67af7b,
-       0x02fbe7d0, 0xa2f39c0e, 0xd22bccbc, 0x3c1bdbeb, 0xe01fa899, 0x8234b1cf,
-       0x0f09d987, 0x56db3e02, 0xfe9cf302, 0x007d6758, 0x8f8f27eb, 0x8f33ef11,
-       0x3fb57589, 0x5b51f691, 0xd60bda3d, 0xaf8dedc0, 0x0d0ef65d, 0x76010b83,
-       0x1145c184, 0xdede01f0, 0x9533b729, 0x972084fc, 0x54dfe82b, 0xfd15f340,
-       0x9e65fe09, 0xcf015713, 0xdb1354b3, 0x8aaa7409, 0x55d6f83f, 0x26cd6bd4,
-       0xe1877266, 0xebc97021, 0xf6fd0149, 0x9fc0499a, 0x37c079b7, 0x0e25fbb8,
-       0xabf0767f, 0xfa2c8086, 0x8d6c7f05, 0xc9a5b740, 0xbfa091e4, 0x60a64535,
-       0x7c775a7a, 0x67c9d67f, 0x54c07cfa, 0xd667df1a, 0x1f7b5bf8, 0xa7ef4de9,
-       0xdb21fbd3, 0xd77f8c2d, 0xf609e678, 0xd29b0fe0, 0x292c5db9, 0x3eb1e98c,
-       0xf8e25d2a, 0x3eb001bf, 0xd39a3c3e, 0x91e5f7c4, 0xf9d363ed, 0xb3666db8,
-       0x3763a7c0, 0x559b59f2, 0x1bb2b7c7, 0xb1993df1, 0xbe413e4e, 0x4e09f181,
-       0xeaca5469, 0x4f5cbe64, 0xb66ebe04, 0x74d32fde, 0x5f0ba63f, 0xd97a0881,
-       0xabef826e, 0x6ddbe03d, 0x33743f7c, 0xdbb9fd7a, 0x576f82fb, 0x31ec7ce8,
-       0xec8c7bf0, 0x898cfe25, 0xe001a937, 0xa8deb5c7, 0x742fdc7a, 0x195267c9,
-       0x88ca2de1, 0x4bf92ea7, 0xc8512b2e, 0xfdf5123f, 0x7afca377, 0xb9ed9dcd,
-       0x0d7cea3c, 0x5e00e7ef, 0xf7c695d1, 0xdbf7a547, 0xbe23c81d, 0xe5827aa0,
-       0xca4779b0, 0x3c045363, 0x857e423e, 0x40fe91fc, 0xca78007b, 0x7f16fd42,
-       0xe30eead6, 0x7f053b93, 0xe5626e7c, 0x26db4fa8, 0x2db23f71, 0xa40f979d,
-       0x02ccb8f3, 0x754b97c1, 0xc30e8a7e, 0x427f9183, 0x5b095fb8, 0x7e69e137,
-       0x63cf2ebc, 0xbac066cb, 0x7d78e2da, 0xdda8e355, 0x382e9481, 0x8d75bfb2,
-       0x2f10cb63, 0x8a07fd9d, 0x997da0ce, 0x40f6f02f, 0x813398e3, 0x1767413c,
-       0x7fda19d9, 0x50047f01, 0x7f22541f, 0xc7f3ba98, 0xfc6ef484, 0xdf788819,
-       0xfbc9b963, 0xf7dfddc5, 0x2ccfbc44, 0xbef2b7f1, 0x088cdba0, 0xd04696ba,
-       0xae0224b5, 0x41a0e1d0, 0x797aeaff, 0xadeef351, 0xeac7982e, 0x5967a0a3,
-       0x2d4f3f38, 0xad5fb943, 0xed3bfcea, 0x176bf20c, 0x3c274f3f, 0xf9d26ecf,
-       0xd46ec675, 0x87a865c3, 0x73c176c7, 0x3c110f50, 0x1313ccb3, 0xed66af6e,
-       0x57757b46, 0x0efede9d, 0xad777f6a, 0xea979fde, 0xcf423a75, 0x42d74465,
-       0x3ecd5edd, 0x5eabf583, 0x4d1fefe3, 0x9026739f, 0x68791379, 0x81cbc088,
-       0xd1103808, 0xd837cf7e, 0xf788dab7, 0xd7d44537, 0x23fbc047, 0xfbe33ae0,
-       0x4898970b, 0x3f02170e, 0xe5222120, 0x9a3f9232, 0x9cfd3bd3, 0x526e7b4e,
-       0xc833bfc8, 0x0e1af4d5, 0x95f74b1f, 0x706129d5, 0x2e32c2e3, 0xf01a3017,
-       0x7ff185a5, 0x120373a0, 0x17a583f0, 0x1bd4d9bd, 0xda44e65f, 0x7bff5e7b,
-       0xfd1933fc, 0x4bf06665, 0xb8464b8e, 0x0ef31245, 0x90d99d54, 0x78750f87,
-       0xa7ee196d, 0xae33efa7, 0xa2b3f60b, 0x49594d7e, 0xd6c45fb8, 0xd6c27994,
-       0xf29fb7a9, 0x1c25afd7, 0xd5c6c3ef, 0xbea08765, 0xab285262, 0x5e38cb1a,
-       0xd094bd82, 0xf889575e, 0x25d794cd, 0x8acbda2f, 0xfad650e8, 0x35883f70,
-       0x5b3ae365, 0x3e88961e, 0x0fa01a81, 0x732169e0, 0x2eced15b, 0x832b1e66,
-       0x4c4b5cad, 0xf023c6cc, 0xa587f1de, 0x3fa7688d, 0x85d7d8da, 0x19d1a1fb,
-       0x3c717f7c, 0x296ba066, 0xee7d2dc0, 0xb2db7d23, 0xc795327d, 0x0eb6cf24,
-       0xdbffb195, 0x929970f8, 0x8431f58b, 0x0fe9aba7, 0xf9066d95, 0x9bba53f8,
-       0x538beaf0, 0x6fe8cd5d, 0x8c30b4ef, 0x51a63397, 0x2ee1691c, 0x9c4efe5b,
-       0x2e21e6cf, 0xfd173ff4, 0x324a6cb0, 0xd5b45bb4, 0xd51fa1a2, 0x7153566e,
-       0x939dbe7e, 0xa4bf58ad, 0xdb819456, 0x6ff37ca9, 0x4271aa3f, 0x4ca78efb,
-       0x9fb4235a, 0xdde9ad70, 0xaf2f0061, 0x4490d0cb, 0x33375c6f, 0xb739c615,
-       0x0250507f, 0x551f3cbe, 0xde2cf6fd, 0xe5fb619e, 0x67a7dc37, 0x497b6215,
-       0x2fed02dd, 0x9ff473c0, 0x1a90ec2f, 0xa72f384d, 0x4b04da23, 0x4657f0ba,
-       0x5b0b9cf1, 0xcf8c416d, 0xf77c539d, 0xf671c7ee, 0x67d3d05b, 0xa76e4c17,
-       0x9f10f009, 0x292cb3b1, 0x04db9f19, 0x2ec6773d, 0x685f3904, 0xb21fe4ee,
-       0x3962cb27, 0x1da3ff1c, 0x1d618765, 0x441f1e17, 0x195dabf1, 0xc00c849e,
-       0x1e991df7, 0xa3e79617, 0xf37addb8, 0xe87dd26f, 0xf2f2ffc7, 0x97f21722,
-       0xd3cb833b, 0xb917d71b, 0x55f98516, 0x89973ecb, 0xbab4de0f, 0xdf7ce037,
-       0xc2601e8c, 0x41f0367d, 0x2f938c5f, 0xe016fb11, 0xf62f8de7, 0x97fd5fe0,
-       0x1e5ac7f0, 0x36ef1849, 0xd27ef5f0, 0x00dfb49f, 0x87e33f38, 0xc7c003bb,
-       0xb236db1f, 0x9b8c28f3, 0x75dc52fa, 0xe07a1309, 0xee20a8b9, 0x535258ab,
-       0xa6fc7876, 0xfb450e53, 0x841c05df, 0x7b41dfd7, 0x2efdf7dc, 0xf08e1ff0,
-       0xfdbd0bf3, 0x8023a772, 0x0e27c5ce, 0xf8f48c87, 0xf85ff648, 0xecb7bc2e,
-       0x81d90b29, 0x6c254f65, 0x8171c0ea, 0x16ae306f, 0x867f2eb9, 0xabd5d685,
-       0x6523b25c, 0xfbe12925, 0xbfa4c395, 0xe9cb937b, 0x0ecb8719, 0x972ef5e5,
-       0x9fae55cb, 0xf1653ca6, 0x1f2d3ca2, 0x70d990e9, 0xf53d26c6, 0xcfc461d6,
-       0x055175f2, 0xf2f89836, 0xaf446ca7, 0xa0238776, 0xe9cfbd42, 0x9ca16390,
-       0xd6f5c19f, 0x3f2e0ca6, 0xed9312c5, 0x62d65405, 0xcc0af5bc, 0x97c02fa7,
-       0x77b63e36, 0x29f38c34, 0x0d1bce0b, 0xe1e2bbf8, 0x25e57a7c, 0x4c8ee289,
-       0x4133c8f6, 0x5c60ae5f, 0x7c9e544f, 0xfe113ad1, 0x5ff562ac, 0x5c1fb049,
-       0x067cbd51, 0x06570bee, 0xc5dae72d, 0xb16bfc5e, 0x55b3d45c, 0x5bd811fc,
-       0xfefebd63, 0xfa4ed61a, 0xa229b2a3, 0x4ff6fabe, 0xd5537e30, 0x3ebe7c6c,
-       0xa17f11c3, 0x7258c30f, 0x5d8a6001, 0x3364b6a9, 0x0572ea58, 0x5dd60ce4,
-       0xf344c07c, 0x0a51be5f, 0xc5fe60da, 0xf8dc797d, 0xc1f03f63, 0x407f5a20,
-       0x1ef97805, 0x33967f6e, 0x7f0ed053, 0x1d607ede, 0x0a2f31c5, 0xc4d0b37d,
-       0xe7e7c8bc, 0xdc54b4a3, 0x2a7b2fef, 0xfcbcf08a, 0xf6ff95e9, 0xbed7bc38,
-       0xf87c6679, 0xf90ebafe, 0xd999e383, 0xf9fabae3, 0x52f7f364, 0xff8a0e51,
-       0xb0c9f619, 0xecb1e5de, 0x90d3f3a7, 0x6ea9c96e, 0xf2ddaba5, 0xf3670f2d,
-       0x86cfb076, 0x21dc2f75, 0xcbd83ad1, 0x2087b236, 0x3e386af3, 0xb49ed497,
-       0x633db95a, 0xd9f84baa, 0xf5e7d46e, 0x7fbc126d, 0x8525ea0e, 0x0f6817f0,
-       0x87df978b, 0x3e93257d, 0x2afae1f1, 0x66fba6cc, 0x561d3f53, 0x3317ef94,
-       0xd9f45c78, 0x2ee7ee0c, 0xa5eed54c, 0x36a3f438, 0xef1a4b6d, 0xe6251a47,
-       0x4abcfb01, 0x3a32db73, 0x8db9fcc7, 0xb5552be2, 0x27289e51, 0x2f3c4bed,
-       0x3255bf40, 0xd871ad93, 0x1ae75f2f, 0xf01fd737, 0xcf1943fc, 0x3f5c1c67,
-       0xbe02c656, 0x6638ce15, 0xfc4bffe8, 0x97f7832b, 0xfdebac3c, 0x5d4df1ce,
-       0x10c3b9f5, 0x95e77d5f, 0x979e3ce3, 0x19017e48, 0x9fa1168f, 0x0234bcf7,
-       0x770bd7f7, 0xfa829f1c, 0xf2cff576, 0xe1757c55, 0x7b27df4f, 0xb9d05ab1,
-       0xb47dfd1d, 0x0cff001f, 0x7e4253ca, 0x0f8f127c, 0xd0f8129d, 0x57d7ade9,
-       0x38f0b0ee, 0x5475e83d, 0x7f9b9524, 0x3a56fd43, 0x6fa85cda, 0x8cb65f2b,
-       0x6bfcbd42, 0x5fb43f9c, 0xf8c079b4, 0x167f810f, 0xb4546259, 0x33026b4f,
-       0x69af08ad, 0xf5dc1130, 0xf22a425e, 0xafb567e3, 0xce4f9138, 0xd0b28547,
-       0x8bac750e, 0x01711ad2, 0x7dcf8f2a, 0x88d59b56, 0x6a259c71, 0xf504c39b,
-       0xc464364b, 0x48febea1, 0xfeb1590d, 0x3334a6a3, 0x1d551ec2, 0x1e47b08f,
-       0xa067f04e, 0xff049aba, 0x6b59bea0, 0xf35cf4e2, 0x3a6b71dc, 0xac55778c,
-       0xdfe7f3f7, 0x4f78c6cf, 0x365b6a65, 0x77a011da, 0xf3c47f76, 0xc3b226b3,
-       0x3c939f6b, 0xe8bac351, 0x0de916bd, 0xd04ab5f2, 0xaf4bed79, 0xbf7c843c,
-       0xd05de916, 0x6f805f9d, 0x17f3d04f, 0xfc614e0e, 0x17c813fd, 0xb802ddba,
-       0x377182d6, 0x09af872b, 0x25e7803e, 0x8f2079fc, 0x11e826f4, 0xf92337f4,
-       0xc6fa37bd, 0xb7fb7266, 0xf48db368, 0xe7266c6b, 0x2f1df6fb, 0x9f7e913b,
-       0x6dfc7f3f, 0x7ca94f3c, 0xbbb2ac01, 0xf817be07, 0x3bf5c2a8, 0x4fe4fe69,
-       0x9d7ae154, 0xe4efeb5d, 0x556f2173, 0x5f4faf8c, 0xd62c956f, 0xf78bd7af,
-       0xbc8532e3, 0x97af8130, 0x12f97106, 0x8af284f2, 0x3ebe997e, 0x5f7f1c5f,
-       0x4ca2cfe7, 0x62699fce, 0x726d4c9d, 0xbe907e22, 0x7f8067a8, 0x4251d63c,
-       0xcf93406f, 0x0ff3067f, 0xff3e97a3, 0xd00f3152, 0xb8d89e6b, 0x9bb63a2e,
-       0xce9e8ad9, 0x3933f32f, 0x9add9cdf, 0xf80cda98, 0x59f60cfb, 0xfc006794,
-       0xa78d872a, 0x5e3e8df3, 0xa6ca4ff1, 0xffa1bae1, 0x8faff610, 0x8fa051fb,
-       0xc47cfd8c, 0xf3e87cb8, 0xb8b2e5d7, 0x7cb4c166, 0xdcfbb627, 0xeb879191,
-       0x6697e3e6, 0x07bef4aa, 0xdf7803fd, 0x38a26cd3, 0xafb159f5, 0x15f5bb3f,
-       0x2ebca2e7, 0xde229f7e, 0xabb27fc3, 0xfe753cfb, 0x9a67e30b, 0xbbf6f167,
-       0xcfac21a6, 0x752f9237, 0xc9fce9bc, 0xdf902536, 0x55a7c912, 0x38ad6729,
-       0xdd73e45e, 0x718f397f, 0x5fff9416, 0xff248298, 0x6644ecb5, 0x7f865d98,
-       0x65d51b0a, 0xb3af361f, 0x51cb7b51, 0xbd75076e, 0xaaebdbaf, 0xc425cf78,
-       0x79328ff7, 0xf56ac91e, 0xf42736c4, 0x36e3e633, 0xfdd60f3a, 0x42d709c5,
-       0x95c60c52, 0x082b4a5e, 0x2e6b77b7, 0xadfe209f, 0x70db6d64, 0xc770b3ff,
-       0x234733fb, 0x42d8fe9f, 0xb70b2fe7, 0x1fa2b64e, 0xe2f0f2be, 0x73ff4851,
-       0x5d9edc75, 0x04791daa, 0x7573e8fd, 0xe716b98f, 0x53c57be1, 0x85f3c2c6,
-       0xbe89f3bb, 0x66daa3e7, 0x80f1dc22, 0xbde11ac4, 0x6e478771, 0x71e01bba,
-       0xb8b1818e, 0x490e8fce, 0xf8c36325, 0x37530961, 0x9b7e8ddd, 0x7ca2a31c,
-       0x5af4247c, 0x6bd3858d, 0xdaffe097, 0x79cb92ce, 0x364d4d71, 0x1c77979e,
-       0xf80a7d04, 0x9bbab0a9, 0xebee3842, 0xa80fb489, 0x524b6d82, 0x935b9d1c,
-       0xcac2b4df, 0xf405c9ec, 0xcf0c9edc, 0x1eda5a4f, 0x7c9cf5c0, 0x19bf91c0,
-       0x18dd2b71, 0xbbfb88b5, 0xe7e03724, 0xbe3af8d2, 0x0bd479f4, 0x4fec8b3e,
-       0xfd15bf7f, 0x627fd47c, 0x7f6a97fe, 0xd6ed0f3c, 0x7159a3a5, 0x5e4ffeb8,
-       0x3f43aa8f, 0xd70b13e7, 0xe0ff7a67, 0xee1c7d7f, 0x65bf8127, 0x32bfc180,
-       0x1f67c0c0, 0x2db5fd1b, 0x33a7af34, 0xce95fe8d, 0xb2eb15af, 0x04f3c262,
-       0x99e3f9ba, 0x744796b7, 0x02880fd9, 0x318c5d16, 0xf6ef8c0c, 0x6d8bebf9,
-       0xd8378fe8, 0xf3ac1b54, 0x3c77e463, 0xe2597a6f, 0xe73b00fb, 0x1e5f8fff,
-       0xdefdc411, 0xf0e4ffb2, 0x105326b2, 0xec4ea553, 0xfb612ede, 0x25ffe0a5,
-       0xdbfcc29a, 0x01e7bb3d, 0x9a2bb3db, 0xb4325b6f, 0xe79472bf, 0x12b5403f,
-       0x9dbed7e1, 0xf7dffeec, 0xc178f567, 0x6bbc74af, 0xebbc434c, 0x39f7d6f8,
-       0x145f026f, 0xefe17415, 0xf20aff0b, 0x7dfb2f67, 0x3a697e54, 0xe438e8fb,
-       0x868c4767, 0xe6cbf372, 0x48fea4c7, 0x6ff297f7, 0xac757ee0, 0xfca2a312,
-       0x48dfe17e, 0xfd978c87, 0x74ea54d5, 0x1365e3d7, 0xf7a16a5e, 0xf11e68be,
-       0xef7838da, 0xeb86250d, 0xf7cf0f6f, 0x646fa488, 0xebfdc7de, 0x73e22746,
-       0x7e9f5d7d, 0x9f59d397, 0x1747a7f7, 0x2d5d713b, 0x6d7df64f, 0x4fb7d20c,
-       0xdafe8a8c, 0x71f79172, 0x13d73f61, 0x4731ed17, 0x2f9d0066, 0x62e3981e,
-       0xb69737a0, 0xcf879dcc, 0x526ebd97, 0x5ed75fd1, 0xfee2732f, 0xbb720fea,
-       0xde12c553, 0xe47ce10b, 0x697a84a0, 0x839b296c, 0x6486c7ed, 0xc67e86e6,
-       0x32fce0cc, 0xc41cb2e6, 0xe0cf9f83, 0x6e33c539, 0x033c5344, 0xbcc5f5fe,
-       0xe0bfa58e, 0xef1d1071, 0x9c6c7efa, 0x1030f758, 0xf177e243, 0x3f88b8bc,
-       0x8bc0e4ff, 0x4bbfb0b3, 0xce2a2c87, 0x16438bfb, 0xec157fea, 0xde30cca3,
-       0x5f7ca3c5, 0x1a547082, 0x7fdf33ca, 0xfbe26aac, 0x1675ca8f, 0x3ba6358f,
-       0xb587165f, 0x3c1efdc3, 0x2bb8e373, 0xfcea1f05, 0xd7c3caba, 0x1cec0ab7,
-       0xf89bf7ae, 0x6d359637, 0xc6f5bc43, 0x7f96dfc7, 0xfa8cb333, 0x7b6f93a2,
-       0x578117e3, 0x5be47f94, 0xed562f9d, 0x71ece7e7, 0x9113f94d, 0xd13e74ff,
-       0x12604bf5, 0x5a7b41cb, 0x98396563, 0x47301397, 0xca17a86b, 0xed05b714,
-       0xf6f89cc0, 0x23cf4412, 0x4abf5c59, 0x198f66c5, 0x8d8d51ed, 0x78b747f4,
-       0xc7d71677, 0x283e6421, 0x7952ccef, 0xa6ab25be, 0x825e857d, 0xed0032e3,
-       0xb89f5976, 0x49a1ba3f, 0xd9c6e1e9, 0xd975f032, 0x3207b8b8, 0x87bcc634,
-       0x4478728f, 0xd40b48dc, 0xb333d2cb, 0xccae004b, 0x0ac94cf2, 0xe1d2f7eb,
-       0x1eb801c4, 0x9f153e78, 0x37de28ff, 0xea246b23, 0xf9f4857f, 0x618ea697,
-       0xdabad31b, 0xf1dd799f, 0x5ddd2fd1, 0xa585bb70, 0xeb08796a, 0x9ee5e5f3,
-       0xec1ccf2c, 0x22f9f227, 0xde52b6c6, 0x3f5fe05c, 0xfe04ff44, 0x8f40ed79,
-       0x2d5f043b, 0xa4212bb2, 0x5cb3ab33, 0xc037f4ee, 0x8c5a6015, 0x259b748c,
-       0x390ee4f8, 0xe7ef82d4, 0x82f55ab2, 0x03a25c9d, 0x5dedf75f, 0xd80603af,
-       0xe03fbd05, 0xb02d2f87, 0x136be03e, 0x1046dfb0, 0xb120131d, 0xe998f402,
-       0x33fd7fb5, 0x60135bf6, 0xe78451ed, 0x10c2f50a, 0xccface0c, 0xd959435f,
-       0xe30c39c7, 0x1c579e1d, 0xb8e80521, 0xc43ef9fe, 0x1f852bff, 0xc4457cc3,
-       0xbe541bcf, 0x4b1be61e, 0xe080f6fc, 0xacfc4fb7, 0xf044133a, 0x0bec7673,
-       0x70f1e619, 0xc461ef94, 0xa9f31afb, 0x946ef5d4, 0xfa271ad7, 0x54ff9f19,
-       0xac3550d2, 0x3b24fe11, 0x5ee42094, 0xf506dd0a, 0x8db969ad, 0x0ab66f68,
-       0xc69cb97e, 0xd81c3f68, 0x3fbca36c, 0xea78e376, 0xa69700c3, 0x3ee1aedf,
-       0xb6cff2f3, 0x3a052e67, 0x38bd40d9, 0xa1539d61, 0xb75822cf, 0xce896005,
-       0x4f448381, 0xe1380fa8, 0xc7b4b6f9, 0x319f3952, 0x4eb5ca2f, 0xddef1d1f,
-       0xa34301e8, 0x33b669df, 0x732bee0b, 0xe51501d9, 0x27cba74f, 0xe01bc076,
-       0xfe6e327b, 0x7fac1f41, 0xeb7ffb99, 0xa613ac4d, 0xfb374eb8, 0x9ff916f7,
-       0x83016e20, 0xf8b0397e, 0xa2c3d9db, 0xe21c5683, 0x81e2ed96, 0xcaf51ee2,
-       0x257ae8bf, 0x1f93e59f, 0xf1844b82, 0x93368b96, 0x8cb70aa5, 0x6bb049eb,
-       0x9feb17c8, 0xc3bb20ca, 0x8590fc66, 0xfa0763b7, 0x4b6cbf12, 0x2b0e8893,
-       0xd7944d9b, 0x3fb9b338, 0x8cd54373, 0x3a54bee6, 0xf3d327af, 0x2dde474b,
-       0xd3877ae4, 0x8933e669, 0xe88f2893, 0xea544199, 0xf82f58f3, 0x15f3c74e,
-       0x1cb3c72f, 0x1e37ddc8, 0x2d5a13cf, 0x3f26e82c, 0x35cfd784, 0xb4afde11,
-       0x7f91979e, 0xb1304ee6, 0xd14b00be, 0x496dcf9c, 0x01eee666, 0x9f4136bf,
-       0x73347728, 0x6a0bed87, 0xf88d9ca2, 0xda780b1e, 0x97701f70, 0x2727d768,
-       0xa74ed0ce, 0x8e813ce7, 0x331594bb, 0x9ddb1d70, 0xbf915a53, 0xc33f5a1c,
-       0xb14936b8, 0xabcc1f20, 0xee63d230, 0x196c235c, 0x5be915ff, 0x73e378cb,
-       0x5f08c79b, 0xcb98e9d4, 0x18e9c372, 0xfa0f3f86, 0x363c57e1, 0xdee63f8e,
-       0x79e01e37, 0x7cc3f861, 0x32292b96, 0x147b6fe1, 0xade017c7, 0xa63cf911,
-       0x58b788c8, 0x7d4f118f, 0x48f88d4b, 0x9bd71af0, 0xa86e9e58, 0x360df64f,
-       0x515ff7d4, 0x54078060, 0x1fb4358f, 0x019271b8, 0x334c0b4e, 0x9ba8cfb4,
-       0x1ab3806d, 0x1fb436ee, 0xa1917fb4, 0xcab8373e, 0xe8e43f50, 0xb43c037a,
-       0xed0c9fe9, 0x316f3787, 0x7687e7d4, 0xb447ea1a, 0x8f00c0fe, 0xd0c27b6c,
-       0x8d87f47e, 0xed31fa86, 0xc7ea1acf, 0x00c17c5d, 0xd578e84f, 0xebb6fed0,
-       0x44f00cc7, 0x7da1aef6, 0x037dfdb1, 0x0ffd593c, 0x93dbfb43, 0xa7ea1bce,
-       0xd4333fba, 0x6ab9cf4f, 0x7f6a6780, 0xb6afb431, 0xa36546fa, 0x265d2aff,
-       0xc059aab9, 0xeb4aeae5, 0x71ca3b1c, 0xdff03651, 0x7fc9d610, 0xd29ed0e3,
-       0x62a5857e, 0x34b264fc, 0xd9f2443e, 0xdf70d26c, 0xe4af6911, 0x8c1ebccf,
-       0x4c57b1ab, 0x06234f74, 0x361c8ecc, 0x0ec7ac7e, 0xb82ec41b, 0x806aa96f,
-       0x8649bc13, 0x6ee589f6, 0x2fb27d43, 0x7fdf50c7, 0x07806685, 0xda191754,
-       0x31e8dc0f, 0x528169c0, 0x3a8cfb43, 0x6ace01af, 0x1fb43728, 0xa867dfb4,
-       0x30ae0dcf, 0x5a390fd4, 0x3687806d, 0x1fb4346d, 0xd4301cde, 0x0cea87e7,
-       0x1b5a23f5, 0xb6c8f00c, 0xa3f686fd, 0xea1a0c3f, 0x351fb4c7, 0xd8bb8fd4,
-       0x74278064, 0xdfda1b34, 0x80643d76, 0x8693b227, 0x33f6c5f6, 0xfab27806,
-       0xdbfb435b, 0xea1ace93, 0x192fbaa7, 0x64ff75ea, 0xc657ce7a, 0x995fc2e7,
-       0xf0d9fda9, 0x8792607e, 0x5e047f21, 0x6e356930, 0xa766f6c6, 0xde817f13,
-       0xd0928f6e, 0x3e52f1bf, 0xf4261c52, 0x04c65f01, 0xe857c44c, 0x5c5057ea,
-       0xafe29e28, 0x98dc5a64, 0x1f760377, 0xb4e67fe3, 0xfb77f434, 0x295df974,
-       0xf6f88f5f, 0x6cd1d77e, 0xdb6bf646, 0xa7bca944, 0xd9a3c33c, 0xebf20e3c,
-       0xd953df6c, 0xf8bfb809, 0xbbf414d9, 0x36c0b257, 0x2964e79c, 0xde1da62f,
-       0x8c651d3b, 0x54e5e863, 0x6c2de03b, 0x1aa3273e, 0xb26e0a52, 0xbf6a9fdf,
-       0xfb3bed4c, 0x130df115, 0x587d7fac, 0xbec28fff, 0xadbf0640, 0x05720fc1,
-       0xfc0fecbe, 0xfc7bc12a, 0xf5ef0449, 0xefdca9bb, 0x09f2a1cf, 0x07f546bf,
-       0x3f0445fc, 0x1c10f7ed, 0xd95297f4, 0xf3d2f7e8, 0x8272fe43, 0x197ec08f,
-       0x7fb0a3cb, 0xd859f2c6, 0x73fd6307, 0xf8462fb0, 0x9500fea7, 0x7a3afe4d,
-       0x81bf82fe, 0xfbfc97e0, 0x3fb9fe09, 0xffb36548, 0xfaaf9528, 0x35fea89b,
-       0x6fc1337f, 0x870443f8, 0x1f04adfc, 0x7c11b7f3, 0xc121ffc2, 0xa9dbfb6f,
-       0xa45ff56c, 0x077f1df2, 0x5ff29fd5, 0x9e8bb827, 0x12387f46, 0xf88a9f9f,
-       0xe37e132b, 0x2c3fc172, 0xcb8bfb9e, 0xe5b02b38, 0x932d6f82, 0x78c10dc0,
-       0x46ecbf60, 0x891d7bcc, 0x7c43957c, 0xfc56ea75, 0x98fdc8f9, 0xf19f025e,
-       0x133af4fd, 0x76e8d78f, 0xe817e45e, 0x03c5527e, 0x00bb1f7c, 0x273c5ffc,
-       0xee28cff8, 0xb6a95eaf, 0x573fa0e4, 0xf0d68a61, 0xf54ae51c, 0x610fc81f,
-       0x220dde78, 0xb66bdf72, 0xf6c33b83, 0xbef01571, 0x4eafde19, 0x54f9a34d,
-       0x9d0b56b0, 0x23cccaa3, 0x33dd5c81, 0xf89d77c0, 0x4039807a, 0x98256afb,
-       0xff38fb8d, 0xf05fdf00, 0xa5ea95f9, 0x547e136f, 0x670fce8d, 0x770942da,
-       0xa4e4fc61, 0xdebff144, 0xf22551f0, 0x7fad7bc8, 0xfa0a52e3, 0x937fa5e5,
-       0xd39f487c, 0xc6394716, 0xf8839c13, 0xc839d4be, 0x5263286c, 0x30418e7d,
-       0xaa393f9f, 0x0a0335ef, 0x759df4ff, 0xeb4fee47, 0x81df47da, 0x9bf0515b,
-       0x42db98cb, 0xf3cc8d79, 0xb85d5e16, 0xbe08f993, 0xfca8058b, 0x35cf8a5e,
-       0x0fe62468, 0x8df60905, 0xb4f6a5b5, 0xa579c8ae, 0x207ae20d, 0x50d9906d,
-       0xb9f5484e, 0x393fbfb1, 0xd3af343c, 0xc6cf6e63, 0xfaf3e975, 0xdf9baa5e,
-       0x4f1d609f, 0xf4fefce3, 0x4c1757fa, 0xe3f9dd19, 0x0a17c01f, 0xc7686f9a,
-       0x06a41cf0, 0xafdf0764, 0xf289aef9, 0xa8be75b9, 0xbe2180c0, 0x7944c9b7,
-       0x027c5dfe, 0xb0fb81fc, 0xf7ba0ef8, 0x01327c07, 0x8c6ab9d7, 0x5f82b014,
-       0xcc1cda79, 0xf2b9d136, 0x15c62b52, 0x7f03c796, 0x07cef7a4, 0x03fdc56b,
-       0xd7f039fd, 0x2fcf48ed, 0x073a317e, 0xc6f555f1, 0xabe23718, 0xc0740cc6,
-       0x923be37d, 0xb857f3c6, 0x0dc697ea, 0x932678a5, 0x4fe30d35, 0xeb3d6d33,
-       0x7f82e5db, 0x4a59274e, 0xf19fd483, 0x413ee5fc, 0x3d04fbb7, 0x64fbafd7,
-       0x3ef3048d, 0xdd12ec7d, 0xff36e95f, 0x983c8f8d, 0x55c7c619, 0x78a767cd,
-       0x5bdfd07a, 0xdf3a7f44, 0xef875648, 0xaf3e12a0, 0x465e3e4e, 0x7c0b12fc,
-       0x7c7c419c, 0x6719cf01, 0x7731dcd9, 0x280ed941, 0xfbe94109, 0x81f69567,
-       0xe546988b, 0x72a5e612, 0xf91d9039, 0x6dd81bd6, 0x62af7c45, 0x6d7cf44d,
-       0xf21762d1, 0x8fb332f1, 0x306bc9f6, 0x7dcf1753, 0x12494759, 0x36ea4bc6,
-       0xe80495bf, 0x7bb0d39b, 0x676fc632, 0x85be1707, 0xd321d965, 0x055bcc05,
-       0xce2ef8b9, 0xbd54ddab, 0x7f8c1fb5, 0xb71373f7, 0xb3e787f6, 0xf60f4e24,
-       0xae87a72e, 0x0dd72237, 0xe499b072, 0xeb43d633, 0x06a59c92, 0xc2d8a839,
-       0xaef8a63c, 0xb94ef9fc, 0xfbfd5a28, 0xe4bfa8fe, 0x54178a0e, 0x438b61bd,
-       0xdc62af3a, 0xf479301f, 0x07ee8878, 0xd5f3e230, 0x76c35a2c, 0xfebe0a9f,
-       0xbe230074, 0x1b04d4fe, 0xff2e82c2, 0x92faa594, 0xecba320a, 0xb9f99575,
-       0xb0278861, 0x9f89fbe7, 0xcb6d37cf, 0x1fbd434f, 0xc4ff454c, 0xab4dacf2,
-       0x15d83349, 0xae9f75f6, 0x16a3d738, 0x9c8a871e, 0xede8a997, 0x623fa33f,
-       0x9e00b2b3, 0xb35c8083, 0xfdcf2851, 0x355724ac, 0x978c5a88, 0xf9baf24d,
-       0xffb1ac39, 0xadbe62d3, 0xdd71e57f, 0xe307ac00, 0xe1c7dd26, 0xdd16ca76,
-       0x0de90e35, 0x9a71a317, 0xead19107, 0xed298f1c, 0x37bfe829, 0x8e7efb44,
-       0x3fe3d1f4, 0x35b2befa, 0xba4c93ed, 0x52f63697, 0x18f7dd05, 0x80fba363,
-       0xd8b88877, 0x2e3c451d, 0x071e8776, 0x07111f1b, 0xb0c7888b, 0xc5c73df1,
-       0x98ccbd74, 0xe4f9c166, 0xd7d4ffb2, 0x5d18f14f, 0xabb3760f, 0x8a3690b0,
-       0x6e29bb57, 0xc99f19d1, 0x4cf8f2b7, 0xd5c53249, 0xee4f42ad, 0xa4fd72f2,
-       0x0e589fbf, 0x3ec3185b, 0x0d32cec2, 0x00d508fb, 0x324ea80f, 0xd1b81fb4,
-       0x0b4fa86d, 0x33ea18e4, 0x9c0334ea, 0x686450d5, 0xc7bf683f, 0x4b06e700,
-       0x1c87ed0d, 0xa1e01af5, 0xf686e54d, 0x867d9bc3, 0x0ad0fcfa, 0xd688fd43,
-       0xb23c036a, 0xfda1a36d, 0x86030fe8, 0x75ed31fa, 0x1771fa86, 0x84f00c1b,
-       0xf686fd8e, 0x1a0f5db7, 0x1fb227ea, 0xed8bea1b, 0x93c0333f, 0xda185fd5,
-       0xd3ec253f, 0x862d49ed, 0x5c4407e7, 0xa4fbaa62, 0x39e9fde1, 0x53f00c67,
-       0x87946f48, 0x879256f9, 0xf783f596, 0x07fd0055, 0x186b37ac, 0xfda999f3,
-       0xab2fd0d6, 0x6dfc47ee, 0x52cfe28d, 0x947cb6a4, 0xedcca7db, 0x6d3e5869,
-       0x7dc16f72, 0x89f8c66f, 0x2acef614, 0xcb05b859, 0x9b363341, 0x9f40dc13,
-       0xa0b707b9, 0x68a90c98, 0x1e00bb31, 0x16ece4ba, 0x8d61d217, 0xfc444a49,
-       0xc1ab486f, 0x89a6c472, 0x8fd41252, 0x83585dac, 0xfd71757a, 0x61cb8599,
-       0xd837a35e, 0xa09dcd89, 0x3e30da0b, 0x6f887b26, 0xe29b0037, 0x8c8c363a,
-       0x5dbbfca6, 0x37191563, 0xba76bb33, 0xb86e316a, 0x1d41676b, 0xafc0db96,
-       0xac620e0f, 0x2c7afc0e, 0x1f5f8277, 0x386e8584, 0x945887f3, 0xa9e07553,
-       0xdfd73c24, 0xcd53e93e, 0xfb0ae1ac, 0xe3013dcd, 0x8b4427d6, 0x737ec7bc,
-       0x7f426627, 0x0f00ab28, 0xdcfa71f8, 0xbe1dd280, 0x2a3bc436, 0x372a1707,
-       0xd7bfa1a4, 0xc0c0dfad, 0xc3e227b9, 0xa27805fa, 0xf5fa6dfc, 0x785fb078,
-       0xc3de63de, 0x9f6e1ce4, 0xf59ae407, 0xd7ca023c, 0x943a2ee2, 0x80c497e0,
-       0xd31fab9e, 0xf80e5bea, 0x136ad595, 0xf71637dd, 0x4da43056, 0x5f1be071,
-       0x700f16df, 0x64ef7892, 0x8e0e6f9e, 0x72e380ab, 0x927f8c2e, 0xc61c0096,
-       0xbf00fb1f, 0xf35d2ce7, 0x0e67dcb1, 0x2c2fa0c8, 0x069a65c5, 0x20b93ce3,
-       0xfb9d369a, 0x22ff46ac, 0xfc9de44b, 0xfbcc473c, 0xfd0d1cc6, 0xf58b9fa2,
-       0x8df7ee3c, 0xfd82d8fe, 0x7932a0af, 0x40f98849, 0x579a29cf, 0xcb0ad4c3,
-       0x8cda3fd7, 0x07c04ef7, 0x8a3b426a, 0xf98737cf, 0xb8732b1b, 0x5af9625f,
-       0xa5baf8a2, 0x85c5abc6, 0x4c916f8d, 0x4fed3dd5, 0x1065e237, 0x5186af7c,
-       0x49f8e5bd, 0xac9f4fba, 0x52969835, 0xe786213f, 0x3f884a21, 0x4d05a7ef,
-       0x923e004b, 0xff7c36e3, 0x9812dfa1, 0x4fbc787f, 0xbe6136ae, 0x6aa6e242,
-       0x5121e213, 0xbe786af5, 0xc35edcc8, 0xc6e275f9, 0x1e3fa3b5, 0x6af6f381,
-       0x99610798, 0xc87df3ae, 0x9cb5448e, 0x703262d7, 0xea5ee2dd, 0x1316b755,
-       0xf43ac3df, 0xe7e76952, 0x3bd5bd5b, 0xa6a9de0b, 0xc502d7bc, 0x4f58478d,
-       0x07e52be5, 0x23b3e07b, 0xa92fdc39, 0xa3e71a77, 0xc217e7e8, 0x19555c6e,
-       0x6f425bb7, 0x61cb1fdc, 0xf3fb9fbd, 0xcdd9120b, 0x44dfbbe6, 0x5c3ab1e7,
-       0xde20e30f, 0xd8b46fea, 0x98f56f11, 0x8bf64167, 0xfa7add91, 0x77073987,
-       0x4ff3ba9a, 0x89003937, 0xbe40298b, 0x01ac1b3c, 0xadf239fc, 0xca69fa1a,
-       0xe84ccb83, 0x6ab1240b, 0x4652184a, 0xc3cab496, 0x72bf326e, 0xfa27ff23,
-       0x64c1f28c, 0x37dd325f, 0xfdd57410, 0x7474ee82, 0xde206627, 0xe579e5df,
-       0x89dcd3eb, 0x5f9d4748, 0x63fc9fd7, 0x0e8c2f94, 0x2e7e081f, 0xca120d62,
-       0x44d658eb, 0x46d678e5, 0x075877e5, 0xcaa61e95, 0x1a624e58, 0x4bcc2595,
-       0x4d5614e5, 0xa06b2965, 0xa26b1a72, 0xa36b0672, 0x5453f612, 0xfb4a997a,
-       0x57e0d9be, 0x79973960, 0xaac79ca9, 0x7c80bca9, 0x672df80e, 0xcddf040d,
-       0x066ca89a, 0x841ee03d, 0x953b0971, 0xc59e81af, 0x127f0df2, 0x9bbf2195,
-       0x97186db9, 0x84f2a1c8, 0x6df2a35f, 0xad95117f, 0x7bb50f7e, 0xe54a5fc7,
-       0xca97bf29, 0x2a72fed3, 0x6a3efcdb, 0x057f9ef7, 0xabf81f95, 0xff37fca9,
-       0xf43f2a46, 0x77fca807, 0x59951d7f, 0x06fb4656, 0x9fca1396, 0x3948f40d,
-       0x81b8f56f, 0x1cb905ae, 0xe63dc78f, 0xa478dc84, 0xfe30cca7, 0x271c94aa,
-       0x66dc5126, 0xe757bfba, 0xa316c63e, 0xfdcd3e3e, 0x83a24748, 0xe1a554fc,
-       0xc8bcc304, 0xd4bb5366, 0xcf6b6807, 0xe7b5cff5, 0x8d7f1d82, 0x10d1f6d5,
-       0x0763ddae, 0xa5b4f47b, 0x5047faad, 0xf378fd2f, 0xced83b5c, 0x3ef78eb1,
-       0x54c3967b, 0xab04e63f, 0xe6760151, 0x5783df6e, 0xa81e70b2, 0xbc7e93f7,
-       0x4ce6ee63, 0x27d7279c, 0x500d77b0, 0x853ad5fe, 0x1bf2aff2, 0xa1a3e58e,
-       0x14ad531d, 0x6b0bdda0, 0xde8af147, 0xebd645da, 0xe9593def, 0xf50f1092,
-       0x01eda07f, 0xe508c94b, 0xbc2c5c63, 0x1bb7f35f, 0x1937499f, 0xe99dbc3f,
-       0xcc9dfd26, 0xfee6a4f3, 0x91e7c07f, 0xfaf96dfc, 0x3be8cff8, 0x0a23ac1f,
-       0x9631bbe5, 0xf00e9feb, 0x55ff719b, 0xcdfae02f, 0x3747e4e9, 0xdf7379ea,
-       0x31bea993, 0x8ad2bb5a, 0x8a4ce6f0, 0x7ac7d487, 0xfdb173a2, 0x43d274d6,
-       0xe5187d29, 0xded2edbd, 0x7261dd56, 0xeb97353f, 0x35c2655d, 0x8bea3175,
-       0x8f0cc9ef, 0xef7e07da, 0x01dbd683, 0x66adee6f, 0xcc529efa, 0xd14a0f84,
-       0xc937042e, 0xf3a124a3, 0x3a2fd518, 0x5dbafb82, 0x1b3a359a, 0x51107ae8,
-       0x9d5ffe87, 0x4a5ffe42, 0x7e3e50df, 0xccab6a57, 0xf522d7f3, 0xbe316edd,
-       0x86d851d9, 0x6f9fadef, 0xa4bc6377, 0xef58fd37, 0xf9e3e40f, 0xb7da2bb7,
-       0xac3c8190, 0x7e3e7dc8, 0x2e15382b, 0x1e6bf727, 0x17363dcc, 0x8bd543ef,
-       0xf1add8bc, 0x8adefa66, 0x283ae052, 0x58abf585, 0xb3b26e43, 0x62c72166,
-       0x523bf53d, 0xfbb8ef28, 0xd7f68d3c, 0xc23cc1a1, 0x88bd74f4, 0x378e745b,
-       0x2941dfa2, 0xd8a7ae2c, 0xa78d1a42, 0xbc7d33db, 0xf1bdff9d, 0x4f7c8976,
-       0x28c73c7d, 0xd61cfae3, 0x439f5a36, 0x78fa41f8, 0x3d7d70bb, 0xe37c8de4,
-       0xf0beb878, 0xd71b46f1, 0xd1b5b0e7, 0xf7121cfa, 0xdbc73a6b, 0xbd78f3d9,
-       0x2237b38d, 0xf72f4fff, 0xdc13ff0a, 0x180e7643, 0xf9c6c534, 0x330b69f9,
-       0x92bc039c, 0x1ff3edcb, 0x595f38f2, 0xc97ae36e, 0xfdd2b2e2, 0x8bae89a4,
-       0x95af91bb, 0x173a663d, 0x26dfe253, 0x3c4e4b3f, 0xa7da24c5, 0xfe7c26b2,
-       0x17bf89b4, 0x98f6b048, 0x5fd7b367, 0x2c333a34, 0x55a89dae, 0x6b6f309b,
-       0xe195aba2, 0x6f128039, 0xf12bf5a5, 0xea1460f6, 0xd8098d5f, 0xfe83ec1a,
-       0x8bdf50c4, 0x974f30b9, 0x15c5e5c6, 0xf9883d6f, 0xd0e58954, 0x9e3e186f,
-       0xe4cc7c16, 0xb0b2b4f6, 0x791d42fb, 0x5cba1f1c, 0xc36fce47, 0xc6878e60,
-       0xea2af049, 0x8e3c31cd, 0x3f70fa73, 0x7accc7da, 0xfb83da34, 0x063bd3fc,
-       0x73bc1097, 0x9c01e52c, 0x0a763c3e, 0xed666bee, 0xd826669c, 0x3e315ac4,
-       0xdde76b33, 0x929e7c66, 0x1dfe88c1, 0x5fa4ad67, 0x255ced67, 0x14d3ffda,
-       0x0e645f6c, 0x1ae304fc, 0xed1d0f45, 0xb19b7183, 0x63fa178e, 0xbedcda79,
-       0x7477bf01, 0x857eca87, 0x73779bee, 0x7d4d039c, 0x0b748ed9, 0x977ec5c6,
-       0xe697cfcb, 0xe7858f30, 0xee29788d, 0xdb68fe30, 0xfc82bc71, 0x628ea69d,
-       0x34f76e3c, 0x9cb027ab, 0xc84ad214, 0x9ef56c2d, 0x5b4a72c0, 0xbbba0975,
-       0x9c361fa5, 0xb861b2c0, 0xdf8877ef, 0x2a8e0fc3, 0x49c60678, 0x68dceefd,
-       0xb7d277f4, 0xa41e4e84, 0xee85b1b8, 0xf22dedb9, 0xde3049d6, 0x8ed7b75e,
-       0x7c6f6876, 0x6bf499ba, 0x5a0af56c, 0x866880e7, 0xfaabdceb, 0x6fbfd0a2,
-       0xef46e714, 0x2c4731f8, 0x7f3479ec, 0xbfe099fe, 0x1ed7aaad, 0x52a0724b,
-       0xfc2283be, 0x49e67ab4, 0x3b284342, 0x1b8c413c, 0x3d70f5ee, 0x7ef8501e,
-       0x036f9b19, 0x98ae8ebf, 0x29e8bb9a, 0x7f31b26b, 0xec1bdc1a, 0x50ed1657,
-       0x883fa217, 0x06116ed7, 0x13bfc1fb, 0x743db8c4, 0x673a2e28, 0x172fe7d0,
-       0x7c617f42, 0xad9ff386, 0x8fa7bd74, 0xf6160eab, 0x5ed3f041, 0x9f4fef1f,
-       0xb760ec6f, 0x731b5ef8, 0x923e719b, 0xc3ac0f98, 0xb09f361c, 0xcebeb476,
-       0x892d3379, 0x30f59fdf, 0xb996af7e, 0x3bf5b0e5, 0x44bb5e6d, 0x22acd076,
-       0x33343aff, 0x28704bdd, 0x04fba73f, 0x1ac8eb91, 0xdf69e3cc, 0x051f6197,
-       0x79a699eb, 0xf7e5ca18, 0x55f90f55, 0x78e580b2, 0xe3c987ee, 0xd84b3127,
-       0x49f8e57a, 0xb41a6ed4, 0xb4e7f8c7, 0xf21a3ea2, 0x54d674eb, 0xc17df2ab,
-       0x5f984c89, 0xfc866316, 0x4fc05974, 0x9650bf96, 0x71abc6e6, 0xe8392d0d,
-       0x8cb03d17, 0xd76a8cf2, 0xf9c56b4f, 0x6bace526, 0xef7a8389, 0x2cee9c57,
-       0xfb0dc79f, 0x790d91ef, 0x002bc9cb, 0xf75f3f0e, 0x07e06119, 0xaf9d7b43,
-       0x8aa95314, 0xcfb9847e, 0x3059dd8d, 0xedc9d97f, 0x6cb87837, 0xf2f10f6e,
-       0xf0257c6e, 0xc667d3af, 0xa7c24ce0, 0xb3bc70ac, 0x277ecd0e, 0x1bf113a7,
-       0xd5e309fd, 0x3e62d880, 0x14894d7d, 0x8ea1fbc4, 0x012cf6ce, 0xa7491ae9,
-       0xeec75b74, 0x957f5c2c, 0x23dbf299, 0xc47e0af1, 0x67c8699d, 0x1ea9e26b,
-       0x3abe539e, 0xf6752266, 0x1b04f523, 0xed4df1e9, 0xddc1609f, 0xf8d64f3c,
-       0xe0be293c, 0x8a429c9d, 0xcc9c6847, 0x0dacfac6, 0x8c62ba46, 0xa278f509,
-       0xb4a182c6, 0xb4e7a75b, 0xa612c6f8, 0xceaba774, 0x7b7d2977, 0x10f2f3d6,
-       0xea03b093, 0xf3d41cb4, 0xfff26609, 0x84e609bc, 0xd6f07df0, 0x725f7cc1,
-       0xe90a2bdb, 0x4ede766f, 0x50b4eff7, 0x13f41f5b, 0x93335d27, 0xa9d6fe7f,
-       0x834d8f63, 0x96aff272, 0xc9bb61d4, 0xbf46edb0, 0x372be862, 0xbf262c46,
-       0xe5172da5, 0x3a1655f5, 0xb1f682d9, 0x827142d5, 0x536f9fcd, 0x35fd2127,
-       0x7d3e7146, 0xb98323dc, 0x25a5fa9d, 0x9a7d25e0, 0x7e46b326, 0x6be3765e,
-       0x3e3c4e9d, 0xb2c77944, 0xabddaf89, 0xbd935755, 0x3663c94c, 0xadb7c78a,
-       0x21bc7b24, 0xccbca19a, 0x41ee9b56, 0x1765f678, 0xb37f4333, 0x2165b735,
-       0x3f091f9e, 0x59aa8e73, 0x69a96226, 0x3f9db9fc, 0xe87aab9f, 0xc3cd5cf9,
-       0xbf7c2b9f, 0x681aa77f, 0x777f43f3, 0xec6e712a, 0xcbcd4eef, 0xa8dbafeb,
-       0xffec14fe, 0x47b4efd0, 0xebd45405, 0xfccd170d, 0x4d17ce7c, 0x2955befc,
-       0xfce37568, 0x4f74cd0a, 0xba24fc0f, 0xf54bbd5f, 0x7deafdd2, 0x088c97cc,
-       0x3670b57e, 0xc6afd1f9, 0xd5fee99b, 0xe5331eab, 0x642a0581, 0xf0521f7e,
-       0x29e5abd1, 0x8e967e74, 0xdd7a44c8, 0x643f2763, 0x62441e2b, 0xdc7ef2fb,
-       0x7fdcc85e, 0x9e2a3fd8, 0x2c6d3bda, 0xe0f914ae, 0xf2f94cb0, 0xe3cf1fdf,
-       0xf4a1f298, 0xae6bfa20, 0xcbbca30a, 0x3f389385, 0x39454c68, 0xc469a198,
-       0x987b35f7, 0xdc937666, 0x5740fbd3, 0xc2aee75a, 0x22fa4af7, 0x24d346bc,
-       0x7d06182e, 0x1ef85351, 0x4ccf83c7, 0x0abbeff9, 0x49befbc5, 0x5d7c7087,
-       0xf90b07ce, 0x774af5d4, 0x3f51a43d, 0xda49d88e, 0xc306804e, 0xfbff2800,
-       0xf51cf0ad, 0xf74c9c42, 0xca1706c6, 0x97587521, 0x7e8b27dc, 0x94f90b07,
-       0x2ce51a8f, 0x7e1190eb, 0x7eefc85c, 0x62fb9216, 0xce8c0dbf, 0x1837facd,
-       0xc7cec1db, 0x522c7a84, 0x3f0baf8e, 0xdd0f1233, 0x79ebecf0, 0x0aeb5d9d,
-       0xbad36544, 0x425d7ccc, 0x5b2a65df, 0x2aa679e8, 0x179c6e6b, 0xd70f786b,
-       0x0c90ffdf, 0xabd02a0e, 0xe31b3cd0, 0x3202333c, 0xac99bba9, 0x37c5f48d,
-       0x88ab7bad, 0x33ae4573, 0x06db7d72, 0x64bf5c4b, 0x37e4bcf8, 0x37e4cb25,
-       0x6303d659, 0xe56bc70c, 0x23b79dde, 0xeece875d, 0x59da0433, 0x62a5581f,
-       0x7a155a5c, 0xc4b5f2c9, 0x3b61ebf9, 0x7125abf1, 0x7df84e46, 0x24da919b,
-       0x51c50875, 0x841c9eaf, 0x2d77c771, 0x3d48ff84, 0xc7086637, 0x637698f3,
-       0x8bb8e45e, 0x7c7911d1, 0xdbc8bcc6, 0xc88bf7ae, 0xc888cbe3, 0xa8621be3,
-       0x888eac9f, 0x171be3c8, 0x6c57c791, 0x4ce7a780, 0x9be3c88f, 0x28ef8063,
-       0xbed0c7ba, 0x50d8b3cc, 0xb574a73f, 0xef4efea1, 0xaef806fd, 0xed0d87f2,
-       0x0c6afbe7, 0x78acf7f5, 0xfa0f50c4, 0x73b8c7a2, 0x87ae10f1, 0x6d3c936b,
-       0x103081f4, 0xfe0f6f78, 0x1dcaa480, 0xd9c7f6e1, 0x56a2fecb, 0x7d29e3d0,
-       0xe248127f, 0x8f116671, 0x10c47705, 0x9d8d0daf, 0x517dc766, 0x444b4d9a,
-       0xcd7ecebb, 0x585806ed, 0xc4e6f9c3, 0xdda94b07, 0x3a74d8fa, 0xfc027987,
-       0xc0e81f6c, 0x77cf20da, 0x6f0017e9, 0xabf79e1c, 0xf5da1285, 0x78a56ebb,
-       0x583ce76e, 0x5577f529, 0xf3ea2f9c, 0x43f18fdc, 0xecdbee1b, 0x54cf3254,
-       0xe28e3f1e, 0xe9751eed, 0xc31a96e7, 0xd6451d7e, 0x164be500, 0x30ac5b06,
-       0x8fd05adf, 0x97849af8, 0x55dda1ec, 0x3de9bb45, 0x127f1ab0, 0x96520fdd,
-       0xe8160284, 0xbf27eab2, 0xf0e3e1f8, 0x1463e2be, 0x27f878a7, 0x7e21fcbf,
-       0xc43fc407, 0xc871744d, 0xeefbcf1c, 0x874ba7fd, 0xbac65f51, 0x64625ee8,
-       0x9b7de27d, 0x26eb7abe, 0x3c16fbf5, 0x37a5dbf8, 0x8ddeff7b, 0xd586b767,
-       0x597f36f7, 0x613cc7e9, 0x356a907c, 0xcbd5c3de, 0xaabe0bef, 0xf8a56b1a,
-       0x57c92ce5, 0xe5fcf28f, 0x707affd8, 0x45f7bc3b, 0x717bb5c9, 0xbfcf077f,
-       0x1da1cf8f, 0x948bf5e1, 0x3cf8a92b, 0xfff80865, 0x58a36768, 0x6f7cf98f,
-       0x8b7ee10c, 0x41d1589c, 0x2b04f3fb, 0xf65c87c5, 0xee3fa3f9, 0x447358cb,
-       0xf71ea0bc, 0xf7a760e5, 0x1e88f88a, 0xf4417f2f, 0x92944473, 0x41ce9f3a,
-       0xf7403d98, 0xb17f7562, 0x8b383c9b, 0x651bee18, 0xae10be45, 0xac125b17,
-       0x54901f14, 0x4b77e52b, 0x2efa28ea, 0x7d1b04a2, 0x2872473c, 0x68cfb46d,
-       0xf1451849, 0x86342900, 0x128a0ce2, 0x40defea2, 0x7ee024ba, 0x77dfb8c6,
-       0x5d682bd9, 0x3acff7bd, 0xeb49f79f, 0x79889c61, 0x1f5878e0, 0xfc41ce39,
-       0x9bda1c2e, 0xe31ef665, 0x4c86d71b, 0x4af48e3c, 0xbeefb5b3, 0xfdf5e51d,
-       0x5eb2f59e, 0x307f9e62, 0x86673f0c, 0x605f13a4, 0x6c307f7e, 0x0fe3cc5c,
-       0xe8038187, 0x60c1079e, 0x42d8066a, 0xb9f88351, 0x6f578d05, 0x3fc892d5,
-       0x7487f304, 0xe7908dfc, 0x61af023f, 0xc3ec57b9, 0x635c83f7, 0x255f84f9,
-       0xc800ed3f, 0xfb4fc21f, 0xfd0654dd, 0xfa365439, 0xe43faa35, 0x88f8222f,
-       0x51f043df, 0xcf95297f, 0xfcf4bdfa, 0xc1397f39, 0xa8fbf53f, 0xa0aff26c,
-       0xabf82fe7, 0xbfc97e09, 0xa39fe091, 0xe785985f, 0xbe547513, 0xfaa06fea,
-       0x09fbfcd7, 0xa41fc37e, 0x4a3fe432, 0x9bf98fcf, 0x6fe13e08, 0x7f6df826,
-       0x7f56e088, 0xf8ef952b, 0x29f9e8db, 0xa30487ff, 0x45fee23a, 0xe03f19d2,
-       0xd9817125, 0xe25e7e8d, 0x4bb34582, 0x2e57de00, 0xd7617dd3, 0x41d2f97c,
-       0x34278be0, 0xfb7bf699, 0xee299856, 0xfb95fba3, 0x16c7d62a, 0xaa5cfd53,
-       0x268d486f, 0x12ff6cbf, 0x571fdd2b, 0x967f7256, 0xbda8552d, 0xfd532f92,
-       0x92e62b13, 0x538f58df, 0xd92ae700, 0x1931d81c, 0x93322ddb, 0x111fdefe,
-       0xe3ca4dd7, 0x4f293f76, 0x8faff7e6, 0xcfc20546, 0x629b2b29, 0x7355700d,
-       0x30e3e072, 0xc62d59be, 0x1c991b61, 0xcfc7ddfe, 0xaf307ff7, 0x90f9d604,
-       0x03ca4be4, 0xe0717c7c, 0x99d83cdc, 0xc3bdb332, 0xcce4f28a, 0x8d4ed9e8,
-       0xebcfd3cf, 0xfe224e92, 0xe13269f6, 0x61b69f6f, 0x2fee265a, 0xddf4c816,
-       0xf205c48c, 0xe99fb857, 0xfba65f37, 0x994acaa4, 0x816c81e2, 0x0363e059,
-       0xfcdfbbad, 0x0eaf54b9, 0x7471453c, 0x6d13cad7, 0x016fd193, 0x1d11657c,
-       0x39e2c50e, 0xbb88b26e, 0xa68f8fee, 0xf9c8b6bc, 0xf17bff8c, 0x33f009b3,
-       0x8cfc47aa, 0x4f3f09ef, 0xfde3fb88, 0x222277c4, 0x977fa4f1, 0x7df109f5,
-       0x1e06c0f2, 0x376c8fbf, 0x731fcc47, 0x2e3be8ce, 0x8fe93295, 0x23b82c03,
-       0xf998e31b, 0x7e43dd32, 0xb3aad27c, 0x3f3e6107, 0x91ddf3c8, 0x2c9fed07,
-       0x8ea18f91, 0xfde52b8d, 0x1f235c0f, 0x7e02be41, 0xda04795d, 0xe93bbf6d,
-       0x7d94364c, 0x8c16ee03, 0x1f463abf, 0xf989f648, 0x161764f6, 0x80fbbf0a,
-       0x2b4fc447, 0x651a3df9, 0x13dc9ee5, 0x3805dc7c, 0xb5f52bae, 0x0309f8a9,
-       0x930edcf7, 0xf97eca05, 0xcf1c3af2, 0x49d24f76, 0xe0212f1c, 0xc7cbc7d1,
-       0x9e2dbef1, 0x925bbf52, 0xf1bdd3d8, 0x37e1f4de, 0x79f5c1e9, 0x7f513ee2,
-       0xe0f51fd6, 0x8a7696e3, 0x70ce0753, 0x38b4c83d, 0x3917bfba, 0x27f96f4e,
-       0x649f8101, 0x886f3f1b, 0xe7476f7c, 0xf02025be, 0xf28cafd8, 0xe2cb26b4,
-       0xf68cfabb, 0x4627ebdb, 0x726f9bab, 0xd403f31e, 0x1eafa0bf, 0x9fa263ce,
-       0x1fbca994, 0x0267ef33, 0x44f0475b, 0xe4dc0d45, 0xe88f601c, 0x00fd8fc7,
-       0x7bbf1f7e, 0x18adeec5, 0x42d77cb7, 0xc90e74b9, 0xcef49bb7, 0x1fda25af,
-       0x2b0dccb9, 0x17f5878f, 0x9fa97c14, 0x48de6043, 0x79d7565e, 0xec055244,
-       0xadf0c291, 0x88b8f7bf, 0xe3793fa3, 0x9bca58a1, 0x8510dfc8, 0x663edffe,
-       0x2c503e27, 0x0c3f3521, 0x7f898a7f, 0xfe7227cf, 0x7aacf2c7, 0x7132805e,
-       0x32239e14, 0xf519cf7e, 0x75fbcc28, 0xb77f939f, 0xd307c169, 0xfe3c0387,
-       0x0fe74c9a, 0xfcd1a5ae, 0xcc1ff6fe, 0x86f46794, 0x677e1788, 0x63dd096d,
-       0xf712c24b, 0x054fb8a7, 0xa626fc78, 0x9f7df085, 0x09c1fb42, 0xe173e5d7,
-       0x0ab2097e, 0x22ee37f6, 0xb8f2f8a3, 0x6f70d90e, 0x6345cc6d, 0x84bfa07b,
-       0x76a4dafb, 0xa144bb63, 0x15235dff, 0x7e8ffefa, 0xd7f5d06f, 0x64c5b97d,
-       0xff49a227, 0x24c9a93f, 0x2a164fcf, 0x76ddb107, 0xfb84bb3b, 0xbb7cc744,
-       0xc5a07a8a, 0x557a4d15, 0xfe4d1119, 0x6394f6f3, 0x9fc076f6, 0x2a07e46d,
-       0x6c032bfa, 0xbb1883be, 0xab73edfe, 0x218d25e7, 0x5df5de3d, 0x3bb022e3,
-       0xf282f978, 0x9decd699, 0x1579899c, 0xd8eefa66, 0x7ab73c7f, 0x2277f86f,
-       0x307524d3, 0x84ec57cf, 0xe0dfa157, 0x418fb9c0, 0x33ea063f, 0xd7c61cf0,
-       0x29217a8e, 0xf905babe, 0xb6395eaa, 0x85d0e282, 0x2d57a4f1, 0xea10eabe,
-       0xc0ad7a89, 0xbadf2e1e, 0xdcaadc9c, 0xd5ce293f, 0xbffe49be, 0xe4dedfa9,
-       0x2e5c95fc, 0x01c5bd77, 0xb77e7df4, 0x5ebec4fe, 0xdfdfc21e, 0xe079f42a,
-       0xbd47b5ac, 0xd72866bf, 0xef224517, 0x297c5661, 0x567e7f7d, 0x3cc65da0,
-       0x2e50cf50, 0x1c12fb47, 0x2fb0cf94, 0x7e30858d, 0xedcf981e, 0xe20ad903,
-       0x538a74a7, 0xd4da9bd5, 0x0a43d200, 0x2e2e91b9, 0xefe187d8, 0x6ddfd478,
-       0xf977d20e, 0xfc28be82, 0x63f41e3e, 0x852817d8, 0xe4d5e2dd, 0x6871ebbf,
-       0x7e008efc, 0x82b687ff, 0xca3a82e0, 0x9b9df4cd, 0x7426f7c8, 0xaedbe118,
-       0xcc89e11b, 0x629abdf8, 0xac9e11bb, 0x43a1e11a, 0xf6e2bef9, 0xa9f3e324,
-       0x6fdc236e, 0x9994637e, 0x78a0ffdf, 0x0c147e95, 0xb8c03eff, 0x64017f58,
-       0x60f7e20c, 0x21afb7fb, 0xe8ff507d, 0x7eff920c, 0xcae2226b, 0x8195b00c,
-       0xf3e36a71, 0x2d859cc4, 0xaaed7e98, 0x87be2390, 0x2ce746d2, 0x73c30f80,
-       0xf20b7cfc, 0x9e6ce1ff, 0xdc30d9ff, 0xc8e87937, 0xde1c79ae, 0xcfce9b33,
-       0x035f562c, 0x28c74efd, 0x36d2ec99, 0x9b75d399, 0x35ba72a6, 0x5779d327,
-       0x60b44aa2, 0x5d5f3645, 0x4723c61a, 0xc91e299a, 0x3df9e21a, 0xd3fae7f4,
-       0x2c6241f9, 0xe773439f, 0xfa47dbfe, 0x40d89d97, 0x2afb03e7, 0x788efa64,
-       0xf9403db2, 0x2bceb053, 0xce963886, 0x39f9f3b7, 0x50d7ac0a, 0x62bceb0f,
-       0x101f97e4, 0xa2f5f49d, 0xf0c206bc, 0x081a7280, 0xbe699b8f, 0x940788e5,
-       0x51e7f0d7, 0xba16ed99, 0xd3d62d4f, 0x7aeadc9b, 0x579c48a3, 0xd76c79eb,
-       0x1e7a98c4, 0xff9106db, 0xe234ecda, 0x24f95ae1, 0x6b5c338a, 0xebed139b,
-       0x2f418e49, 0x2f5c6c04, 0xde1db960, 0x7bdfb943, 0x1c54e163, 0x2044f50f,
-       0x16147bec, 0x6dffa7c1, 0xc221b3bf, 0xeffb3f2f, 0xf9186a47, 0x9e208f9d,
-       0xe39c072a, 0x77c5edf7, 0xb6782cbc, 0x3ea5cf07, 0xcb7aaf9c, 0xcae9af1b,
-       0xbae3b5bf, 0xbfbc88a5, 0x5af8112b, 0xbfa5f02f, 0x274d457f, 0x2d695d3c,
-       0x2786f7b6, 0x1327f426, 0x332f13fa, 0xbb3e2ace, 0xec634121, 0x9fdfe799,
-       0x671d0327, 0x985b3ead, 0xcf9bf00a, 0xcfc39eff, 0x3fa97d9c, 0xec361d34,
-       0x3df879f3, 0x9d8f598c, 0xa1a296bd, 0x85de26dc, 0x8a70c3df, 0xbe7d1973,
-       0x092f78fa, 0xf1b5597d, 0x90671e1e, 0x357724bd, 0x01c52f2e, 0x70ef8cbe,
-       0x5542f9e2, 0xd16b8742, 0xd57ef44d, 0xfbf97bc6, 0x0a353e98, 0x5cb889f3,
-       0xfbf3d6cd, 0xfdf98d4b, 0xd22ae74e, 0x5016367b, 0xd9442f51, 0xeebe743d,
-       0x3a26e619, 0x72b4c9dc, 0xceeebe7e, 0x5accfa42, 0x3fd1ea6d, 0xe7aa1d6c,
-       0xd5be86fb, 0x2bdc4cb8, 0xda245398, 0xc65fe3a9, 0x7b34ee71, 0xf05fa2b6,
-       0x482cc67f, 0xcf41b740, 0x75d21a7f, 0xadd0ef4f, 0x759cffdc, 0x496dc4de,
-       0xff278f0c, 0x575f3871, 0xed009c78, 0xf9746f46, 0x3c5d1bac, 0x89ad0714,
-       0xa8ba70f3, 0x48cdce1d, 0xd70ed897, 0xd7debc96, 0x113e8ddf, 0xf82ab8f8,
-       0xe42bfd1e, 0x9fc26fd7, 0x4f3d1f4e, 0xcee4c6ac, 0x40e67f22, 0x147c437f,
-       0xaf6e0236, 0x76fe67a3, 0xc88f7d87, 0x38a5e49a, 0xcb5e2593, 0x9ae67cc1,
-       0xe63d49bf, 0xe30f6777, 0x6766f37e, 0xaf17dd34, 0xbee95a71, 0x27738b5a,
-       0xaecd3f43, 0x94bc236c, 0xe618eb38, 0xb3a6d5d1, 0x06edfe26, 0xad715e63,
-       0xef5e6ef3, 0x9dacb3e2, 0x2e31eba6, 0xb4e7b5cf, 0x8103b418, 0xaf2edfd3,
-       0xbfe76e58, 0xbd5bd25b, 0xcf1a6e33, 0x295a762b, 0xb18a58af, 0x5794f756,
-       0xc7c117fc, 0x78beb82d, 0xa78f0f5c, 0xbbb2ebe9, 0x3e23fe79, 0xd59a78c7,
-       0xafdfa3ed, 0x97ffd7d1, 0x7a2e9ca1, 0x9abb9b7b, 0xac97dea1, 0xacf51b9a,
-       0x884fbe24, 0x4c272476, 0xffe3ea5f, 0xef85a869, 0x4a953597, 0x8ddb9db3,
-       0x39eebf59, 0x30f47c3f, 0x9dc92dd3, 0xcdb337ce, 0x97466f3c, 0xd58ab9ef,
-       0x5cc37e83, 0x7af28925, 0x2fea02e6, 0xffb585c6, 0x1efc5dce, 0x2125acaa,
-       0xee3fbd3f, 0x07df97b6, 0x2e983df0, 0xa9bde9e2, 0xf59fba16, 0x7079899e,
-       0xb79919eb, 0x4ec6f5e8, 0x1de3edc6, 0xa2d6ce33, 0x620c6638, 0xb0e43f74,
-       0x78e762b3, 0xccc3fe46, 0xae60d061, 0xde326caf, 0x9e5d98c7, 0xafb616ff,
-       0x8f407612, 0x49f55717, 0x91fe520d, 0x6c339be4, 0x3f8dc624, 0x6242559d,
-       0xdf4a91df, 0x4f6aecbd, 0xf6b0e371, 0xd3fb45f3, 0x1d71c469, 0x2b83ddf4,
-       0x3e8bb1ea, 0xf287d137, 0x8bf12221, 0x9dff0a74, 0xa07f5d35, 0xfe1167dd,
-       0x48fc3879, 0x13dd394c, 0xbd57edd0, 0xf578e7a5, 0xbd0986af, 0x38adcba9,
-       0x1f33b087, 0x4c91345d, 0x1ea7ee5e, 0x67d9f67d, 0xea7e5d5d, 0xf49f610e,
-       0x8333a27e, 0xf98d1954, 0x549a502a, 0xaca3f10f, 0x60052756, 0xdaffdb9d,
-       0x27f7fdf3, 0xf01e7975, 0x2fb61260, 0xb072fb71, 0xdf17cc8c, 0x072cba96,
-       0x34db72e5, 0x946aeedd, 0x9cedbe37, 0xbe7437fb, 0x1bcf0efa, 0x9d90196f,
-       0x4a517988, 0x59be45ab, 0xe415a65e, 0x3d137dd5, 0x3ff7156e, 0x631b1db7,
-       0x36f4f8c7, 0xcf0da0a5, 0xf129b777, 0x536db405, 0xde901e78, 0x5e78515e,
-       0x78f1a29e, 0xbcf0a2b7, 0xa77f3d39, 0x84dbc065, 0x03ddbd0f, 0x8d15af82,
-       0xd288e3df, 0x5d9da81a, 0xb2f7d2f6, 0xe28cf1ec, 0xff957652, 0xa67450ee,
-       0x907bd999, 0x2cc3b5d7, 0xe5b61f64, 0xa24db415, 0x146ec9f9, 0x05496d93,
-       0x1147a449, 0x8d7ef0ef, 0x316f13a3, 0x0a9fc788, 0xd4fdebbc, 0xde75f0b4,
-       0x417771bb, 0x23f45f49, 0x5f9087bd, 0xec8b29b7, 0x7246ef78, 0xbfb4de14,
-       0x432661e6, 0x7f57663e, 0x7f450a97, 0x24fec53f, 0xfd8a8147, 0xbfcf5859,
-       0xe8b6f8bb, 0xef3defe7, 0xfa360cc0, 0x226308de, 0xd494268f, 0x2761f9d3,
-       0x631cf0fd, 0xfef7f744, 0xbd677edb, 0xfe09de31, 0xbf516fe6, 0x7b9de654,
-       0xe13d127b, 0x68d6e6fe, 0xbf742fae, 0xfb795651, 0x0f7e66ad, 0x9abeff55,
-       0xb1ca47ee, 0xdd743c46, 0xb874e303, 0xc838f2aa, 0x7c518555, 0xafae5226,
-       0xb86e3a9e, 0xd8768147, 0x2c71fc23, 0x0cf4cfd1, 0x2e2973c2, 0xa3dcbadf,
-       0xebfd444e, 0x1f7f7728, 0xa8a4abbf, 0x30b7ca66, 0x5f12ff01, 0x9243de77,
-       0xc6cff47a, 0x3574e70d, 0x24685625, 0xb7284ae7, 0xe03f3927, 0x728b953a,
-       0x1ecba07d, 0x03aeb8ab, 0x1389dce7, 0xbf5ce4c3, 0xbff7a21f, 0x3564e4fe,
-       0x74df5d7c, 0x6e79c2ff, 0x8f64fde7, 0xff1edc5d, 0xd8c7df6f, 0x40aeb2ea,
-       0x326cdffb, 0xc391e5ea, 0x86d63eb9, 0x75e0f88b, 0xb3b7ee99, 0xe1b4bea1,
-       0xd98b3f80, 0xf97a8e5b, 0xdfdf3540, 0x1499b1ca, 0x7eb03987, 0x829e445a,
-       0x30f0d06f, 0xb3aa2c79, 0x85abbe92, 0x03ed077d, 0x491ae823, 0x3afe9d2f,
-       0xe7e728ec, 0x27bd3a72, 0x91212a26, 0x89fe4c07, 0x09997e2b, 0xdcab9af5,
-       0xb039f267, 0x81d91b7d, 0x115ddade, 0xaf6f4ffa, 0xce0aff60, 0x73e280af,
-       0xa0e75057, 0xfcf6a49f, 0x51976cfb, 0xec7e0498, 0xb1e72eb0, 0x2bf62aa9,
-       0xab793f09, 0x51af6fc8, 0xb09eed0b, 0x42d8a5f7, 0x3e30a4fb, 0xde25e9a9,
-       0xc7ae1fe4, 0xefb4439b, 0x4810efd7, 0x9e60d7e8, 0xee5f22a0, 0x7ed0478c,
-       0x9df0d4a2, 0xdefc7d45, 0x5f39edcf, 0x690b555f, 0x018f281f, 0x0bfc017f,
-       0x8192ec53, 0xbe2d3764, 0xfcc44e7f, 0x28dadf95, 0x2123f79f, 0x3e42ed9f,
-       0x0163d37b, 0x2d2e8c76, 0xf027616e, 0x49f008d2, 0x49f20c41, 0x70d98a4d,
-       0x9b97a3ae, 0xe26f3ac4, 0xbf0f54e7, 0xc1e73f35, 0x39f83de1, 0x9f84c7e8,
-       0xe2ffa3cf, 0xe89bd309, 0xf07a78bf, 0x62cdea73, 0x53ce27ff, 0xcddc5b4f,
-       0xd39780ed, 0x3be86213, 0xf87d193f, 0xe8d3df3d, 0x7f8015f7, 0x4cd9ccf7,
-       0x532cd624, 0x843a77e7, 0x0608c99f, 0xca276f3f, 0xaef31945, 0xd5bddfc2,
-       0xdf8988e5, 0x3a26f9a3, 0xe0dc06cf, 0x3de3b6bc, 0x87ba3cbc, 0x39d3da57,
-       0xfe4eb1de, 0xc7a61301, 0x401f08fb, 0x5a38b09d, 0x4460f8b7, 0x31c3103c,
-       0x19c5f99d, 0xbf6fdbdd, 0xf9f8a261, 0xe20b1f2e, 0x51dc02ef, 0xbddf8c64,
-       0x76d9f225, 0x7f24612d, 0x429a72bb, 0x6a245fe8, 0x65f1e28c, 0x39fb631e,
-       0xbddf91a5, 0xeef9c636, 0xe7225af4, 0xebb5df4b, 0x7fd7d627, 0xff8a2acf,
-       0x22fdc645, 0x3eb47de3, 0x3c8523b4, 0x1854afee, 0xf51cb8f3, 0xd8bbe833,
-       0x714af860, 0x3314ae7d, 0xa3ac38c3, 0x2dcf323c, 0x21ecf020, 0x59e3a665,
-       0x92899eff, 0x6bdfe66f, 0xf546dc0d, 0x7e1dbe7a, 0xaba27177, 0x3aca5d6b,
-       0x117c9f31, 0xbcf40dcf, 0xd7185dae, 0xbce8bcc4, 0xd084d036, 0xc605ce1f,
-       0xf460ae49, 0xb75857bd, 0xf0e25ce1, 0xfa262d9e, 0xa31f0f1d, 0x1e01a1ef,
-       0xcc16e78c, 0x5850f147, 0x039ce1bf, 0x238069d6, 0xe4df01f7, 0x93de1fff,
-       0xa277e3de, 0x278f52f5, 0x61338b75, 0x2fa48007, 0xbdf38b86, 0xfa286ca1,
-       0x06fe4a41, 0x1495c3a2, 0x72cb5f9e, 0xdbdf3e7a, 0xf7e1fd09, 0x72887e93,
-       0x01718092, 0x04def866, 0x0f74c8f3, 0xe7c454c0, 0xe5ebea6a, 0x48c79742,
-       0xccd16dbe, 0xa684798e, 0xea0f6882, 0x600d9b13, 0xf8852efc, 0xee24b74e,
-       0x283ffd3f, 0x00812bd4, 0x0000812b, 0x00088b1f, 0x00000000, 0x9095ff00,
-       0x50c34b31, 0x97bf8514, 0x4a36ac46, 0x1056dac1, 0xa8508a09, 0x755a5095,
-       0x97375433, 0x221d0e8c, 0x38ba383a, 0xfc5d251b, 0x09f9ce01, 0xe6e284fe,
-       0x482ae0e6, 0x22bf8290, 0x26a697de, 0xcbbd0820, 0x77dde779, 0xddf73dce,
-       0x2e8dcc2b, 0x5eca7550, 0x75619047, 0x444506d2, 0x9aea1152, 0x47e17536,
-       0x3cd6a5a4, 0x7c22c128, 0x4c12092e, 0xecbbaa75, 0xfbd45ab2, 0x5ffed246,
-       0x73e4ec6f, 0x7569fd73, 0x27e7cad2, 0x22ff8eba, 0xba77e898, 0x00839d12,
-       0xe4e3e1d6, 0x65f68fbd, 0xc8773d13, 0x5f94dcac, 0xd53da3e8, 0x3970079b,
-       0x3adf376b, 0xdbe20d46, 0x0aa8f38a, 0xa567047b, 0xfd398f74, 0xed34737e,
-       0xb0a56f2d, 0xef37e657, 0xbf89695e, 0xc21b71a5, 0xc1ec8481, 0xc81447a8,
-       0xbe0daad1, 0xb9417dcd, 0x3e99cb8b, 0xbf05c593, 0x67eb81f0, 0xf3ba7931,
-       0x8416bf0f, 0xcb62bcbf, 0x5f1dd7ff, 0x7f74f68d, 0x6b7d238c, 0xbb92f72c,
-       0x50a8dce1, 0xd9f695f8, 0xf4112ed5, 0x738dbcf3, 0xf3e569f1, 0x742b007e,
-       0x02505747, 0x00000250
+       0x00088b1f, 0x00000000, 0x7de5ff00, 0xc5547c0b, 0x3d9cf8b9, 0x926eece7,
+       0x2126cddd, 0x26c2bc21, 0xb80d4401, 0x41a00c40, 0x94520f37, 0xa2a1e1a8,
+       0x24786c22, 0xf622ef21, 0xddbf1f62, 0x52c488f0, 0xd4c51f1b, 0xb051768b,
+       0x40368bd1, 0x5c1758d0, 0x6d8b459e, 0xd5a045e8, 0x5e40137a, 0xa540b206,
+       0xcffd45b6, 0xdd9ccdf7, 0x26364e73, 0xf6ffef6a, 0x9fdbfffe, 0xcccce61d,
+       0x7cdf3337, 0x9be6bdf3, 0x91be6489, 0xf21387d8, 0x256efc25, 0x108951e4,
+       0x9b4e1892, 0x9fc6933c, 0xedb10994, 0x3bea247e, 0x9e0c8499, 0xd146706b,
+       0x64085fa2, 0x21064b4e, 0x758d65c9, 0x793dfa46, 0xe8bc7d91, 0x9819c308,
+       0xbdbae47c, 0x720c8409, 0x8266f6d3, 0x7fe92fbf, 0xc637b73f, 0x79c87491,
+       0xe131a285, 0xbc9a4afa, 0x877bfa48, 0x149bbeaa, 0x48dda675, 0xfd51fbfb,
+       0x9085b720, 0x4678c31f, 0x40cba942, 0x78b8e8b2, 0xfd2e6f5d, 0xaf0e3a3f,
+       0x295be8cd, 0x1c1a2210, 0x242444b1, 0xa0482326, 0x679fbe9d, 0x49d7ed3c,
+       0xaa36a708, 0x49e74ac8, 0x0896b4c8, 0x808972f5, 0x76cd8878, 0x78e97b25,
+       0xe22e7d57, 0x220d57bc, 0x27d69da4, 0x684ed392, 0x61c4953a, 0x232dc7bd,
+       0xd57e4206, 0x07123fae, 0x199b1b85, 0xdc155e24, 0x0e210f06, 0xc7afc513,
+       0x8f2ae98c, 0xc4c9a79d, 0xab210d71, 0x574c0e3d, 0xfa634679, 0xdb27d0d8,
+       0xf9d00673, 0xe9d8320c, 0x63834848, 0x1191dda6, 0x2dc72786, 0x0938e730,
+       0xae2926c9, 0x2f5a54c4, 0x4dc840d1, 0xf342dc84, 0x19082375, 0x5084ec49,
+       0xbc933dfc, 0x019dca2c, 0x45e60779, 0x7cc37103, 0x2e033263, 0xc62de291,
+       0x1c95cf69, 0x1bf8efe1, 0x785fdf80, 0xc1d6152c, 0xefcc1b7d, 0xf0ece219,
+       0x46dd9e02, 0x7f5a26e7, 0x5e4ceca5, 0x468ae14a, 0xad832eda, 0x1e1094bb,
+       0x1fc04cdf, 0xc9cc8fed, 0x30d7acd5, 0xb4224718, 0xeb05dc73, 0x75b27164,
+       0x1574095a, 0xf2e61d61, 0x77655875, 0x38fd19d9, 0x11fa2449, 0xb1fa5aed,
+       0x8fe96864, 0xba9fb17e, 0xbf69e79e, 0x3bed424d, 0xbd3ce953, 0x4dce0c4b,
+       0xa160dbf4, 0x0af80051, 0x80c425bc, 0x41f92afd, 0x63a05265, 0x179e1ab4,
+       0xf6f7e9cb, 0xefcf730e, 0x52e2062d, 0x2a5372e8, 0xcec4777c, 0x6626e3a0,
+       0x6b4cec47, 0xe987f1cf, 0xc925d924, 0x4c0eef40, 0xac47041b, 0x477ce300,
+       0x9c049b24, 0xf6a4727f, 0x08edd3ff, 0x377ae1f1, 0xda5475f0, 0x3d203c51,
+       0x468b1f79, 0x3450883c, 0x17e70c39, 0xad17cf1c, 0x4a434f45, 0x5868e348,
+       0x875f9a5f, 0x79a663f4, 0xb09be62b, 0x3fca1edc, 0xacc9e58b, 0xba5e5d3e,
+       0x55e3bd18, 0x6eda1759, 0x4291c203, 0x38445e70, 0x9bbf5096, 0x94203f30,
+       0x1fd625ff, 0xb7f7eaca, 0xceed251f, 0xf9c29e0d, 0x003b2ebf, 0xd6dbc29f,
+       0x2e94adc0, 0x7c106e0e, 0xec0f9a26, 0x75fe418c, 0x9f0cfd7e, 0xd767e289,
+       0xea0b9338, 0x8398df9f, 0xefedbcf9, 0x5e5a24db, 0x20945db5, 0xd679d86f,
+       0x5bf141d6, 0xfc7f6a63, 0xb83dfa66, 0x602f245d, 0x9f71d377, 0x48b4e29d,
+       0x92f9633e, 0xdaad9628, 0xc01e6bb0, 0x91336b2d, 0xeaa70a28, 0x6f3bd2cd,
+       0x03d2f9a6, 0x552a8132, 0x838cea9b, 0x4f897e69, 0x8afc8168, 0x3f601f9d,
+       0x0ca4b9dd, 0xe039f7f6, 0x752f945b, 0xee93dadb, 0x7dcbdfa6, 0x7ea00a5b,
+       0x09c166f9, 0x7ebe5c4b, 0xbf0087d7, 0x211e55bc, 0xcd15f852, 0xdaa1c431,
+       0x17db792f, 0xade309df, 0x9426477a, 0xabb291ed, 0x1891190f, 0xe02346a4,
+       0x13d36ab5, 0xe79be046, 0x1fb0073c, 0x2f559f05, 0xbb687ed3, 0x2704d7ea,
+       0xc0daad4c, 0x3785cdf8, 0x68bce6a3, 0x19d57981, 0x37fb4147, 0xbd42351f,
+       0xebf15f52, 0xdf180e51, 0x8c016306, 0x6306fd73, 0x566f8a89, 0x3356ff34,
+       0xe94d53ae, 0xbd19dd03, 0xce39e7af, 0x397c95b7, 0xdf484015, 0x4338cf92,
+       0x339e87c5, 0x57fd21c4, 0x11c48b34, 0xdf781f81, 0x8760fbe7, 0xbe03f195,
+       0xc0ed4b5e, 0x75ebc21a, 0x4fd7cec9, 0x88cd660a, 0xe71ee7c0, 0xcb91a3f2,
+       0x7e41278f, 0x2e69f4d0, 0xf971d63f, 0xe271e4d1, 0x933d67f7, 0x71ef5d30,
+       0x67bcfa61, 0x4f3ea61a, 0xc17bd611, 0x8dd30733, 0x7f7e371e, 0x698653c9,
+       0xbf16a7b3, 0x8e59e2bf, 0x178f66e9, 0x59e6bfbf, 0xa78b6983, 0x9eadd311,
+       0x3d5b4c26, 0xbaf7ac3e, 0x36d319a7, 0xff7e0b4f, 0x530da7b5, 0xe98027bf,
+       0x9a5f584e, 0x98ed3c06, 0xc31cf6ee, 0x03a7af74, 0x9cf7eddb, 0xc72d74c1,
+       0xe49b2dbb, 0x366f1448, 0x18394117, 0x91cae85f, 0x88be3e69, 0x7ae693e5,
+       0x9f348c73, 0x8a79a6e4, 0x8195c1c7, 0x0fcd131c, 0x29e565ae, 0x66b9243f,
+       0xb2f14f9a, 0xaeb5b4f2, 0x4f9a28dc, 0xa3e5646b, 0xa3737bd6, 0x8f947e69,
+       0x39b75f95, 0xf3431b90, 0xf2b0b5d7, 0x67927eb1, 0x01b1f9a1, 0xd07f1f96,
+       0xf9a56795, 0x9f2cedf1, 0xcf37a1f5, 0x1d59f346, 0x5d4dfdac, 0x9a58bc81,
+       0xcac829bf, 0xf24ab96f, 0x2e4003ed, 0xb5cf980b, 0xd1c7e4e4, 0xe59dae7c,
+       0x4b16860b, 0xb7f4088e, 0x0858ee53, 0xb0867c22, 0x7e5125d1, 0xf1d8d3b3,
+       0x647d1510, 0x4baaf0a1, 0x2033fca2, 0xfe504593, 0x963af0b0, 0x19648c07,
+       0xbc2a3f94, 0x65bbe58d, 0x5cff9607, 0x46f2c038, 0x87ff9607, 0x7bf30870,
+       0xef961765, 0xf2c4fe10, 0xff961746, 0xf981385e, 0xcb1bb2fd, 0x962e853b,
+       0xfcb1ba37, 0x5753e949, 0xdf2fed3e, 0xdc2e9ee0, 0x5ddb7208, 0x6a597286,
+       0x597e0649, 0x04fff9cf, 0xaf2d0640, 0x3944641f, 0xacf3f3b8, 0xd3814517,
+       0x97c800f6, 0x05fa04bc, 0x485b3385, 0xc2827d04, 0x7386fb11, 0x349317cb,
+       0xa2f96e70, 0x20f3814c, 0x1fea89c2, 0xdc5f9d9c, 0x17cf1da4, 0x129c0ae5,
+       0x7fb5979c, 0xcbe5baf3, 0xbe78ed6c, 0xd4e054ac, 0xfeb89c20, 0x4f20278d,
+       0xc809c0d4, 0xe59c0aa5, 0x7fb12708, 0x271971e3, 0x8cb8e06b, 0x7538144b,
+       0xff506708, 0x378c04e0, 0xac63c76b, 0x863ce050, 0xbfd61e78, 0x534cb979,
+       0x5531e3b4, 0xc29e7029, 0x0ff6a4f1, 0x16ab6ece, 0x21adbb3f, 0x3847acfc,
+       0xaf37fb23, 0x3f169b5c, 0x7e10b6b9, 0x6b9c2136, 0xb76707fb, 0xdd9f8b4d,
+       0x5e7e10b6, 0xe98cfc43, 0x6372bcdf, 0x8dc9f8b5, 0x0de7e10d, 0xfeb8cf1c,
+       0xa26f678d, 0x137b3f16, 0x2009f843, 0x37fb1b9c, 0x2d24fc9e, 0x4293f27e,
+       0xe10779f8, 0x9c1fee4c, 0xfc5a49bd, 0xe10a4dec, 0x67080fe7, 0x95e6ff4a,
+       0x9f8b503f, 0xfc2181fc, 0x7270807c, 0xa94ccddc, 0xbdac70a4, 0x4c3fd9c3,
+       0xc3fd9f8b, 0x8939f842, 0x3852a670, 0x29c37de9, 0xa7e2d148, 0x9f842520,
+       0xb6e708f3, 0x9fd9c1fe, 0xfecfc5a2, 0xae7e1094, 0xfa3b9c20, 0xe182af37,
+       0x0c14fc5a, 0x55b9f867, 0x8672871a, 0xd8274eca, 0x9a19dfe7, 0xc13212e3,
+       0xd179624e, 0xf7a024ee, 0x433e8a88, 0xad225dda, 0x371cd96f, 0xd6a231fe,
+       0x068d726b, 0xaa56cf4a, 0x9af5a9e5, 0x1ad149d8, 0x15ce2a3d, 0x4c27c9af,
+       0x9fa9ac1b, 0x29a69458, 0x3ae7381f, 0xf720f94d, 0x487e4d78, 0xfa9a4dd9,
+       0x35736ac3, 0x6fcbe1f9, 0xf54fd4d7, 0xd3e4d4ce, 0xa9afdcd7, 0x8171b23f,
+       0xa69afca6, 0xb5f94d72, 0xfc9aa5be, 0xd7dfcdf5, 0xb2d31fd4, 0x437e5342,
+       0xf29a63db, 0x35278171, 0x9e0709f9, 0xb1bfd4d5, 0xf94d05fd, 0x68af63c4,
+       0x6c7727ca, 0x3e6fe4d5, 0xfd4d6bf3, 0x9addc129, 0xbd9fadfc, 0x439fa9ab,
+       0x6fab53fe, 0xd4d03f9b, 0xa13f6a9f, 0xf24eff29, 0x553d3a27, 0xccaf1f6b,
+       0x32afcc21, 0x01afd988, 0xc6f311ab, 0xa76616c1, 0x271c4b58, 0x7718fd29,
+       0xa00c742f, 0x033403f4, 0xe0ce5176, 0xe83a6bb2, 0xe4ddeff7, 0xbf4ec6be,
+       0xbee8cf7f, 0xbf411ec1, 0x9026f4a1, 0x061d4864, 0x8fe5f548, 0x73de8cca,
+       0xd51d5c87, 0x18d7db49, 0x68e2a382, 0xe73123fe, 0xf9c7a03e, 0x83ee0306,
+       0x42d49168, 0x411368bd, 0xd4d1e9bb, 0xaabd17ac, 0x1866b0fd, 0x308433d5,
+       0x3bb235dc, 0xc328f519, 0x9bd03af8, 0x79d187ea, 0xd164260d, 0xbcbb718a,
+       0x61fb6823, 0x8fe0c925, 0x3f991930, 0x91bfd424, 0xfd819ff6, 0x6bfe812f,
+       0x94dfe97a, 0xbfd34936, 0xd34ca539, 0xfb48d9bf, 0x90f213b7, 0xbfde26e1,
+       0xcb36fd19, 0xfec64c56, 0xd865294d, 0x6a46a3ff, 0x8ffba977, 0x88fff50e,
+       0x31ebf681, 0xc7b9bb30, 0xd26ed3fc, 0x5ca53fce, 0x9b237f3b, 0x2e434aff,
+       0xe71a3fef, 0x0e456abf, 0x394a7f9b, 0xc189bf9b, 0x0b6ff50d, 0xfa01bfe1,
+       0xfd2f69ff, 0xb5b3d29b, 0xa95e1ff3, 0xf589bf9d, 0x76e194ff, 0xfb05bfde,
+       0x6dc57a7f, 0x2bc3fe6c, 0xc9a37fb1, 0x31fa04ed, 0xf5ae890e, 0x50c9fed1,
+       0x040d256a, 0x40fda172, 0xfd1e3a3a, 0xd21a7708, 0x8bdf1c70, 0x2576f466,
+       0xf21bd29a, 0xc3b32f33, 0x5273947d, 0xd39aaabb, 0x1ce6c57a, 0x2c3df023,
+       0x3164224f, 0x36a2ea1f, 0x3c9be911, 0xa48df26d, 0x26d0bde3, 0xe8bf217a,
+       0xe03e29e9, 0x322635af, 0x49da08bf, 0x3fdf0024, 0x1798d9fe, 0xa7d2f3d4,
+       0x53e51b8b, 0xde45fc91, 0x96ba325c, 0x1002ef8e, 0x9c7f2a81, 0x186071da,
+       0x1eed487f, 0x139fed42, 0x23efeb32, 0xbe41ef6a, 0x687bda83, 0xe63a9338,
+       0xdebaf357, 0x5fc7411f, 0x0b9f9444, 0x6e2f79e7, 0x624f0a29, 0x5af8f7fb,
+       0x31eb07c1, 0x450c797f, 0xc53c787e, 0xbe4d04de, 0x07eac4c6, 0x2f7c136f,
+       0x0dc30808, 0xe1c199f8, 0xcd2f1811, 0x36b3b1cf, 0xb1de7747, 0x7dd1b05f,
+       0x5d0866b4, 0x599c308b, 0xa40f25c4, 0x565eefed, 0xa76b832c, 0x8186105d,
+       0xa166b09f, 0x3768024c, 0x0649137b, 0xde3a0e27, 0xfe0cedfb, 0x527c970c,
+       0x239b47ed, 0x74455d9b, 0x458a733c, 0x69acff1c, 0xed3ff2da, 0xc619718c,
+       0x53cd74d2, 0x45ddcfd8, 0xe77bf2da, 0xb9f7f368, 0x572a79b5, 0x0fab9065,
+       0x53bfe994, 0xdf8124b4, 0x001bf431, 0xe3907ce3, 0xd95ac1e1, 0x6a5759ab,
+       0x72951b76, 0x09b88470, 0x8bdb0bce, 0x5fcfeb3d, 0x7b17cdae, 0x6b85f9b5,
+       0xdd39f074, 0x7febe29c, 0xa683e81c, 0x283e81a7, 0xfa724f3e, 0x2d55f308,
+       0x9a13dc7d, 0x650fa306, 0xb624a71e, 0x33d6a704, 0x18dc58fa, 0x8a1e9913,
+       0x52e0f443, 0x0f4297d3, 0xfc3d38f3, 0x6943d399, 0xeeae9693, 0xc9d5be23,
+       0x6b03fdb4, 0x1d3ae177, 0x3d198a11, 0x87a140fc, 0xb83d0d0e, 0xd7e83d39,
+       0x87a71e6f, 0x7a308f79, 0x0767afd0, 0xa68e87a7, 0xeb4932cb, 0x1d74aeb9,
+       0x0eba7934, 0xa3b775ba, 0x47ae8a1f, 0x10587a44, 0x389d379a, 0x65e42fcd,
+       0xd38bd63d, 0x01a79603, 0x09e209da, 0xacf7a7db, 0x2684f94f, 0x7914da5f,
+       0x36da6bfd, 0xfaa93dac, 0xf2f2d55e, 0xbb7fb55a, 0x268b79a2, 0xa6f7c4bf,
+       0xd3697ea6, 0x717e4d2e, 0xfa9a3be3, 0xd21cd70b, 0x7fbd8be4, 0xbf9fd4d4,
+       0xfe5353bc, 0x4d59ed60, 0x176503f9, 0xdcfbf935, 0xbfd4d37f, 0x13f08e77,
+       0xa2eefe75, 0xeba89fa8, 0xa7169acf, 0x0d70cfc9, 0xec37d4d2, 0xa02ef6bc,
+       0x8bef83c7, 0x4f8ff404, 0xffd1a79d, 0x7653a9f9, 0x1e939d42, 0x5383ee07,
+       0x9e98d19e, 0x9f7138f1, 0xc24cf39c, 0x1edb42f4, 0x2a15c80b, 0xc8e04b47,
+       0x96e574a6, 0x20d935ba, 0xdfca09d7, 0xd46f958a, 0xb2128779, 0x8a639414,
+       0x2326c2ef, 0x44204c09, 0xc7c4e100, 0xe5551415, 0x37947d1d, 0xd0914151,
+       0x23b0bcb3, 0x279af7f2, 0x23db878b, 0xf7847f9c, 0x7a021935, 0xe72f7752,
+       0x29029524, 0x64277f52, 0xad81f205, 0x34a94f5c, 0xb9517e32, 0xb12e5075,
+       0xaa303e41, 0x6bfaabf6, 0x206c9ba1, 0x66ba49d0, 0x5d36973f, 0x04f7e1af,
+       0x4089cfbc, 0xdf34136f, 0xd66f9a2b, 0x25daebb4, 0x81abb8e2, 0xfdb95097,
+       0x527a292a, 0xd8153e04, 0x0c6b3293, 0x14f5d38c, 0x5112dbe6, 0x34f2ec8f,
+       0xc7f385af, 0x4c169e73, 0x30da78cf, 0xac09e53d, 0x93c07385, 0x1e98039e,
+       0xda63b4f7, 0xe98639e1, 0x4c0e9e47, 0xc19cf43f, 0x209e4ff4, 0x9f3cc7a6,
+       0x43c47a61, 0x0e70027e, 0xfe98cc7b, 0xb4c763c1, 0xe98c93dd, 0xfb0f8f05,
+       0x5f5df651, 0xcb867774, 0x7f4073ed, 0xbb6ce811, 0xcd6eac78, 0xbd9d30d0,
+       0xa423f2b9, 0x85cf0533, 0x0f4e264d, 0x087a1a49, 0x2377ed80, 0xe51f4bd0,
+       0xc3a7324d, 0x2e47dade, 0xbfe179af, 0x7caede87, 0xd30b7a4b, 0x3d1d10d3,
+       0x4f45f7a5, 0xe9e9aa1f, 0xe4cec18a, 0x1fa7a720, 0x7d6b73f3, 0x3b1251bf,
+       0x77e90ca7, 0x800cdbae, 0xdcfca5aa, 0x98699084, 0x5efbc4bf, 0xa3b5c149,
+       0x0d1be81e, 0xe8d2eb72, 0x73828fbf, 0xe8c74b87, 0x3ef6a7e2, 0xf49d3d3f,
+       0xda17778e, 0xba3e2543, 0xc61109e8, 0x1af0cd1b, 0xc8d32065, 0x461a4278,
+       0x905ce4be, 0xc4897981, 0x739f7b43, 0x3af38446, 0xc06b7542, 0x5d785f6f,
+       0x1632bd69, 0xf67a9de0, 0x5e90591f, 0xf475fae1, 0x7cf5111e, 0x09d17812,
+       0x25c90df8, 0xfc193393, 0x4691c1f3, 0x6409ea3b, 0xde7f16ba, 0x6bf835db,
+       0xcfce5548, 0x7f11931b, 0x1a8cae23, 0xf5fc0fd4, 0xc2fbdfc5, 0xf79802e7,
+       0xfb3e037f, 0xf17d8fe2, 0xbc72e245, 0xdfe746d6, 0xf8cc73bd, 0x07c01cc7,
+       0xcadf1abf, 0x3c7e9c79, 0xb5f492f9, 0x493bb8e8, 0x14f6e3a1, 0x24d85b88,
+       0xa5fe11da, 0x61626bd6, 0xfa70425d, 0xede14f58, 0xbd80a73f, 0x0b553e7f,
+       0xef074b2f, 0x6d1781d2, 0x4d2d7760, 0x3270d85e, 0x69283ac2, 0x835d4b55,
+       0xb687ad45, 0x1a97f369, 0x382d6985, 0xecec472e, 0x6a272031, 0x5edf181b,
+       0x6702a98e, 0xf6097269, 0x3d39ae73, 0x3e7bd996, 0xc7360fc6, 0xe738bf21,
+       0xfffac329, 0x06f4f1ec, 0x210f1947, 0x1984e4ad, 0x4b2d31f8, 0xaf7ebdef,
+       0xc5fd2cf4, 0x7edde788, 0x89e80af9, 0x97dffa66, 0x09107760, 0x9adc0af3,
+       0xba6bd116, 0xd66fbe01, 0x39db47f4, 0x2fe23394, 0xdf6abed3, 0x4294e448,
+       0xd45e54b7, 0xe780bd83, 0xd41a4b9b, 0xcb55597a, 0x9af93577, 0xd41a47b6,
+       0xfc055c7a, 0x525ff283, 0x3740482b, 0xba8c9c95, 0x811acb25, 0x8218af8e,
+       0x088f804f, 0xb9955eac, 0x9fa6e8c3, 0x75b2b7ce, 0xe77c6deb, 0x8854e63c,
+       0x3733283b, 0x597239e2, 0x20f9b5cb, 0xaeb7ce67, 0x5bf9024c, 0x5efa5e21,
+       0xbff68451, 0x5f2e0494, 0xcf56a0e4, 0x2841f4e7, 0xe9bcd55c, 0x17c212cf,
+       0x981977cd, 0xb70f465f, 0xbe91cb8d, 0xf9bd53f0, 0x8ecdc150, 0x6eaa789e,
+       0x237468bb, 0xcbffa45f, 0xc149e30a, 0xd454b15f, 0x9771d126, 0xffa27737,
+       0x1dec8ce2, 0xe0af83f5, 0x67e73d97, 0xa3153e49, 0xb497979a, 0x260b3f43,
+       0xe3888ef1, 0x1f280fde, 0x995bfb3f, 0x57221f00, 0x742cad69, 0xc7bb70cd,
+       0x61590c40, 0x6b4167bb, 0xfbe02145, 0xd1d3ebec, 0x8a445bee, 0xa40eb86c,
+       0x9cec0b31, 0x7180c4f3, 0x1fc9e755, 0xeb54136c, 0xe464b1f0, 0x305ca678,
+       0x1034bb89, 0xd8107bbe, 0xf539a65f, 0xf858e2ed, 0x9076292e, 0x15ca25f0,
+       0x17f180b7, 0x2f77d873, 0xfd01d731, 0x634a7b52, 0x4a7b51af, 0x94f6a793,
+       0x66425f26, 0x453c4126, 0xf132d3c9, 0x4d278809, 0x8ec941f9, 0xb5252be3,
+       0xfd1fa0f5, 0x16e1fb9c, 0x843489d8, 0x37aa87ca, 0xa62acb9e, 0x9892e9f3,
+       0x0f894bff, 0xc5654258, 0x5e5e5a20, 0x2cba33e6, 0xa277e73d, 0x943dc275,
+       0x163c03f3, 0xd1bf7007, 0x886be2c7, 0xaae2ca43, 0xf3ef5a4f, 0xba2ad81f,
+       0x8f506ca2, 0x9bc6577e, 0xafe7f5fa, 0x4f212f9f, 0x9bca3ce2, 0x561c6067,
+       0x3e07788f, 0x7059b91f, 0x27ec22f9, 0xf1341651, 0xc332092e, 0x1ad7e29f,
+       0x0f5fcbae, 0x6bdf9579, 0x1bfcaea2, 0x440197f3, 0x258a5fc3, 0x913970f7,
+       0xbfc013f1, 0x7f710520, 0xc9f8637d, 0x2f5fe03d, 0x844ff8df, 0xefbb543f,
+       0xff89fc29, 0xe88ff1d4, 0x48bcfe31, 0x78deabf0, 0x778875f5, 0xcfd5ff2c,
+       0xb7ee846c, 0x926352b3, 0xe57bae93, 0x1736d5a6, 0x6bc91df0, 0xd6717d83,
+       0x448b4e27, 0x7997df0f, 0x59711fdc, 0xc2bbf004, 0x73fc293f, 0x4ef8fcaf,
+       0x6caea3b0, 0x4fe8ed92, 0x4c05366d, 0x5bab9e94, 0xb1921497, 0xf964ef98,
+       0xfd022f47, 0xc7c9b4d7, 0xfe5a74d5, 0x41259fcb, 0x94a5107c, 0x48648621,
+       0x549f6803, 0x00b8fc6f, 0x121a8df4, 0x6faafdc4, 0x167ffd07, 0xd8b0f28f,
+       0x1cb3db18, 0xd049341d, 0x5a6afd9e, 0xb4517c7f, 0x69db7a41, 0xb2d46fe0,
+       0xbe90bf44, 0x3bb7195d, 0x00eb642a, 0xc913abe4, 0x0aabe044, 0xd98f885e,
+       0x7e5f2b1d, 0x1d276c66, 0xdfc6d757, 0xbe1504da, 0x52e97b14, 0xfc5fc2cb,
+       0x1f3bd1da, 0xa3f740bf, 0xe455bf5a, 0xdb8da394, 0x56967e4b, 0xc41b01ca,
+       0x906e5573, 0xb9fa5e9d, 0x5f17d5f2, 0xd9fc167a, 0x4739347f, 0xaf15f852,
+       0x13723bee, 0x916c57cd, 0x69b21407, 0xf0a48458, 0xffd0d4fa, 0xaf0f8f96,
+       0x7db6f947, 0xf618c746, 0xe1f187fd, 0xb2d8a975, 0xf4c648cb, 0xcb5e47c4,
+       0x2587632e, 0x74b4fac2, 0xb7fe8016, 0x1abfe5f2, 0xdd9def81, 0xa9819029,
+       0x61b9f011, 0x8087ea1f, 0xbe4f5c27, 0xd3f5a15e, 0xeba1afd5, 0xbf467202,
+       0x857afa5e, 0x5c00bf9c, 0xf4a1b388, 0x21afdafd, 0x264fee0e, 0xeca1e027,
+       0x306c87b5, 0x2d52d39f, 0x56e7f3a3, 0x2bbf0127, 0x7649bd93, 0xb2f7d94c,
+       0xfa461fe7, 0x70f43d2b, 0xba57f312, 0x76501906, 0x3cc1077a, 0x1bbfaf17,
+       0xdc4259e7, 0xcf658748, 0x9a3e4589, 0x69912a7e, 0x93ec225b, 0x9c9f7c4b,
+       0x2e2e817e, 0x4569e79d, 0xe441fc2e, 0xe8bbe172, 0xcf987d0f, 0x98906a85,
+       0xd6ccd4ff, 0xd06c80eb, 0xfd10d1c8, 0xe5147c6e, 0xae61b9c7, 0x56ee7081,
+       0x28179613, 0x5343c447, 0x6275b207, 0x51db0772, 0xdf0793b9, 0xecbb7ea1,
+       0x69ab1a8a, 0xe9467287, 0x9fef197f, 0xf41a3b8e, 0x9149d3b7, 0x46e191ed,
+       0x3d500f85, 0xaa674543, 0xfff6cefd, 0xdfb606c6, 0x9beffd95, 0xffca0d31,
+       0x23ed9872, 0x97720768, 0x10302b8e, 0x16cd77cb, 0x48983f90, 0xdf3ed220,
+       0xae7df328, 0x0bd3d72d, 0xc424bf1d, 0xfa06e8aa, 0x4075c789, 0x34f25f79,
+       0xa3e2af6d, 0xadafd035, 0x1f655c27, 0x707e7297, 0xf5c1f81e, 0xd6407e61,
+       0x5e2bf627, 0xbdf652b4, 0x5fec2cf4, 0x0ebd5fba, 0x1172bfd8, 0xcd93ffcc,
+       0x4fdc8e7b, 0x2d27edf7, 0xf2d5beca, 0x2dbefd55, 0xc630fadb, 0xedf7eb9f,
+       0x496b4327, 0xbf4b7dc4, 0x43b7dc47, 0xf847fe3b, 0x24c782aa, 0x2aaf96a3,
+       0x7c37b27c, 0x16e4f9ea, 0xd57881d9, 0x3bfa49f3, 0xd27ab24c, 0x0a8742a3,
+       0x47ff95fd, 0x47e070d5, 0xe8553a21, 0x0aa74430, 0xade7ea1d, 0xfcbea3c5,
+       0x522df023, 0x537a297a, 0x4a95f3c6, 0xa6038b3f, 0xc90ff6ed, 0x50b97c44,
+       0xfdc691cc, 0xf3a80643, 0x45be5d3e, 0xcba5df57, 0xbbeae917, 0x4d5af975,
+       0x3db6cafd, 0x10748246, 0x9713d4d0, 0x31393bff, 0xfadd1221, 0xf5a1bf98,
+       0x39ee11a2, 0xd88258d4, 0xbc415e5e, 0xdc191f10, 0x51b9e221, 0x3d71c537,
+       0xa73637f8, 0x8f94bcfa, 0x7e628eac, 0xd07b6e85, 0xd5d34f16, 0x4c1f2c71,
+       0x1f03d634, 0xa307be54, 0xbbb1df98, 0x538b6828, 0x7e9d5bd9, 0x8778f911,
+       0x0dbdf22f, 0xdd70692a, 0xd7b97a3b, 0x758f9ca1, 0x62c6db47, 0x3e29d17f,
+       0xa2a9c7a0, 0xf8396525, 0x27451aa1, 0xea8bece8, 0x79c1b5ee, 0xfd3fb755,
+       0xfbf439ae, 0x164477e2, 0x4975e38e, 0xd0765483, 0x975de219, 0xf05c402d,
+       0x859fa45a, 0x2d17667e, 0x3f791b5a, 0x2576f394, 0xe0466596, 0x390ed4bb,
+       0x51ef3eae, 0xd7ad94e0, 0xe74ff77d, 0xed11a6fb, 0xda8df2ff, 0x9fb73772,
+       0xfce4647f, 0xc7191c67, 0xbfe657ed, 0xaa7b7ce1, 0x1cd77198, 0x07dd3eba,
+       0xf9a26244, 0xd7117e4b, 0xc166d2e7, 0xe237fe07, 0x57fdc44d, 0xf546824d,
+       0xd82e887d, 0xcef4d75f, 0xffb6bac7, 0x4007eb39, 0x307faf47, 0xda69dff6,
+       0x471ffaf5, 0x37f905bd, 0x407ca68e, 0xdbcfd67a, 0x02f18519, 0x48ad3bdd,
+       0xde3bddff, 0xe401f94b, 0x613934df, 0xff3bdd9c, 0xa9e8163a, 0x0ca9857b,
+       0x30f760f8, 0xb95dbfe6, 0x3b63afe3, 0xc2aefe50, 0x1a366c75, 0xffc99f99,
+       0xdee08f8f, 0x9d3f25c2, 0x3c17e815, 0xd7e6beae, 0xf0823e51, 0xbea59aff,
+       0xe76df40f, 0x43e3cd53, 0xce64adba, 0x1c5f1856, 0x79a87f8b, 0x758bf26b,
+       0xd6aaffb4, 0xb485c65d, 0xcfedef3c, 0xfd1c62c7, 0x5d37a656, 0x879e3b90,
+       0xc66d87f8, 0x2994acef, 0x26c02f9e, 0x5df646a3, 0xb07935a6, 0xe5e27a8f,
+       0xf5a7f473, 0x1aef1f17, 0xaffd7d99, 0xc5c10f8f, 0x67d59ff8, 0x7fde6016,
+       0xf403e8fb, 0x2e909a83, 0xd27ef995, 0x4cfa8752, 0xfb3ef35f, 0xfa0e86bf,
+       0xd0216f3b, 0x4d9b799f, 0xfdebdaff, 0xeb81d1b8, 0x3d07dfa2, 0xf7c77ce9,
+       0xd5aaff30, 0x27ede389, 0xfd368fbd, 0x5beeb63f, 0xfadbbae9, 0xfe77f79e,
+       0xfbdde7c5, 0x8f33bfba, 0xce1dbbaf, 0xfede6b53, 0x75f7c71c, 0xffe95cf9,
+       0xf457ba52, 0xad4376fd, 0x6f8e933d, 0x82b4690e, 0xe25f7162, 0x03a64b25,
+       0x0f2f70a2, 0x383bf8c0, 0x57608d5f, 0xbf989935, 0x581824cd, 0x82dddabc,
+       0x3b4447e2, 0x5fae4eeb, 0x0cb439dc, 0x5d3b90f5, 0x827d413f, 0x39edb548,
+       0xee7b7eb4, 0x6ac62742, 0xdcc7f192, 0x853d9f90, 0xe6f6b5e7, 0x12e204ef,
+       0x677f7ea8, 0xa003f4ee, 0x12e5dee7, 0x29a60f51, 0xa7efbfea, 0x93efb014,
+       0x7dd0f6b4, 0xdefe6d6e, 0xddfcda39, 0x843dde1c, 0x229eff8d, 0x587e07c1,
+       0x8953ce53, 0x2d3597e0, 0x0a908996, 0xabb54671, 0xbbb8eec1, 0x197edb48,
+       0x7f2a6728, 0xe3c537e3, 0x5c78436f, 0x3921788a, 0xed03de22, 0xdc7c8f13,
+       0xf9c7b3ed, 0x489ace20, 0x7bc7864e, 0x37e89caa, 0xccb8f6e7, 0x3596cbdb,
+       0x659fb0ed, 0xd8ae1d9d, 0x9be1bdd3, 0xe11cfb70, 0x2ff185a4, 0xcfb444bb,
+       0xae7d9d65, 0x5dd7cbac, 0xbf1d650f, 0x073cbaed, 0x786372eb, 0x5c5a865d,
+       0xccabf604, 0x8b7c87ed, 0x1687e593, 0xe8ae7611, 0x00d2fac3, 0x8466f117,
+       0x9897d1e3, 0x9ce02b8b, 0x405a3ccc, 0x6b5dc87f, 0xe60f9445, 0x55c7010c,
+       0xf8c64934, 0x450d8fe3, 0x85deb059, 0x7f562613, 0x09c30d9f, 0xf1c25cf8,
+       0x516a425e, 0xbf57257f, 0x0b3b32fc, 0xea0825ce, 0x845c4bbf, 0xb8ed41dc,
+       0x10216c92, 0x126af10d, 0x078ec6f1, 0x8e40b93f, 0xdae4fc6b, 0x496efc3c,
+       0xabe9c30a, 0xe5fc6f7e, 0x17fe9d9f, 0x29c767e5, 0x3a427491, 0xd497bb12,
+       0x3f7cf776, 0xa54d63c3, 0xba434be0, 0xfbeac80b, 0xb66605d3, 0x87ebfe0f,
+       0xe64f9013, 0x2c4c74fc, 0xe26407f3, 0x6e1ac47d, 0x3af25c37, 0x760fc162,
+       0xcfce9fc9, 0x6a6cf373, 0x87a4aabe, 0x9ffe1db8, 0xd3489710, 0x51a17cee,
+       0x048b3b04, 0xcdebffd1, 0xc57bc28f, 0xcca376fa, 0x6bafbe06, 0x3f002fd1,
+       0xf2afee11, 0xa6d29479, 0x75aaf1b1, 0x59c77b5b, 0x75cf6c69, 0xd571df80,
+       0xc5b7ddf9, 0x80fdd82f, 0x1d5143d7, 0xe6114505, 0xafe3893b, 0xf0dff770,
+       0x7f4ceafe, 0x99780caa, 0xce6a2f99, 0xee669df9, 0x264098cf, 0x770ab8c0,
+       0x0c9b66df, 0x744072eb, 0x1ad57dc2, 0x3ba345ff, 0x1eb1f9c2, 0xfc1f009f,
+       0x676427f0, 0xc4f3e009, 0xd808a24f, 0x73f1efd5, 0xcfb80cc9, 0x1eae8191,
+       0x731df817, 0xb84fcccc, 0x74c76cce, 0x9c8e6156, 0x68cdfb48, 0x50838fb5,
+       0xfebcc1b5, 0xcb03b33a, 0x4a76f087, 0xac95c1bd, 0x5ed1a75e, 0xbffe691d,
+       0x79f8128b, 0x937bf399, 0x75bd7f84, 0x35a9f9cb, 0x41fa0b90, 0xd167e2be,
+       0xfdc135d3, 0xe09a6971, 0xf60df903, 0x050be630, 0x53de1fd4, 0x64cfafee,
+       0x7ba15672, 0xcdab9e3d, 0x1e02f7da, 0x887f78e7, 0x678287d3, 0xf1fabf05,
+       0xbf29f52a, 0x9fed55ba, 0xdc6dabba, 0x54dfa06b, 0x81bb05fb, 0x3a96aa82,
+       0x6b0fb08c, 0xe1909eda, 0x073ee67c, 0xa2a44b83, 0x83f8eab1, 0x0f166675,
+       0xcdfc67b2, 0x2e4e80f3, 0x2c8135af, 0x1745ae24, 0xdf87c06d, 0x0f7f3833,
+       0xdfde6c71, 0x57d36489, 0x3c0fabf0, 0x597cf2f6, 0xe715370d, 0x4732ab33,
+       0x03da7706, 0x81e4bb95, 0x675a7a2a, 0xe572c78e, 0x074ae0fb, 0xfb420fbe,
+       0x1f7871c3, 0x4fb81137, 0x8ed2d192, 0xa81f6cf7, 0x5874638d, 0x88cbb2d6,
+       0x7bcd54f9, 0xfa3f4a22, 0x50bb34fd, 0x30bcaf1b, 0xe02863af, 0x5814d0a5,
+       0xa7408ce6, 0x7394a393, 0x2729afca, 0xc76e945c, 0x27247ffe, 0xa2722996,
+       0x95e3e303, 0xe7df02f6, 0x3031392a, 0x5a589c92, 0xeb0818e7, 0xfa4774b0,
+       0x4b24d840, 0x149a99df, 0xefbc4e49, 0x47cce761, 0xeef67df9, 0xdc4e54d9,
+       0xb31392a0, 0xf44e90a3, 0xf6513eed, 0x42725f49, 0xcbffb759, 0x907de6fc,
+       0xf7f61113, 0x71393a17, 0xe518bf8f, 0x45b33dc4, 0x4facbdcd, 0x391394fb,
+       0x5e61f749, 0xa044c676, 0x7db9f79f, 0x0bdf9473, 0x5e407e80, 0x11d94664,
+       0xd1b97a6f, 0x53ff5f1b, 0xfffaf97f, 0xbe159e10, 0x3fda94be, 0x7448d4a6,
+       0x979e9048, 0xbaf947de, 0xf8c8f400, 0xb907d2fa, 0x67c7539f, 0x66cf808b,
+       0x6b2cf9aa, 0x7266ed5f, 0xf52da6a1, 0xfcb4b999, 0x09d946fe, 0x30fef2a2,
+       0xf352cddf, 0x5ea8ccdd, 0xe3196ef8, 0x13fd97bb, 0x6dea7f50, 0xfce67f7e,
+       0x11b3f296, 0x31f408ce, 0xe68c6e67, 0x7189dede, 0x06d8c9bf, 0x113de5fb,
+       0xe63f79cf, 0x71c1c07a, 0x7d04c9bf, 0x9e3e49fa, 0x2f3d7c79, 0x3e794878,
+       0x22de5fc5, 0x6d574fa6, 0xd57f1116, 0x57ff6cad, 0x073e0b37, 0xff8c17cd,
+       0x56d79e1b, 0xb5e760ec, 0x39850674, 0x78aff5aa, 0xce1ea3af, 0x08362a09,
+       0xf70cde78, 0xa59f001e, 0xce259f1c, 0x29573c0a, 0xc1fad26d, 0x2f6da21b,
+       0x1e101b90, 0x78abc3fa, 0x105342fd, 0x7f0a1dcf, 0x20373829, 0xabb6d49f,
+       0x59fb711a, 0x9a2a4fb0, 0x0d9ddf75, 0x3704ae78, 0xadaf41d4, 0x7b96d16a,
+       0x8b17bcf8, 0x146d8c81, 0xb33df93e, 0xf778f4f3, 0xf653f1e8, 0x8873f12d,
+       0x9ff327e2, 0xfe259f87, 0xf05e785d, 0xc7a2f175, 0x3f145d47, 0x324f181f,
+       0x6c7e3f61, 0xf17f2170, 0xbbe22bbe, 0x189e8b4e, 0xe50f79a9, 0xef2f1ca7,
+       0x83f5dc19, 0x80b55ea0, 0x6fd74af5, 0xf34497d9, 0x38c85b73, 0x6d286638,
+       0x90e3cad2, 0xa0756ffc, 0xbb5b9f7c, 0xdab88045, 0x60befcc5, 0x7c09ef99,
+       0xe5c1e63f, 0xfad3de54, 0xdc9bc70b, 0x287e5e70, 0x53fc882a, 0x409ddfa1,
+       0xfa6f94bf, 0x0c4e38f9, 0x9ca3e60e, 0xb8ec136a, 0x4c51032f, 0x8275d16e,
+       0x4cf66d77, 0x5f016bfe, 0x6a5fe617, 0x4358eb63, 0x75f60dd7, 0x5be79f81,
+       0x80f83e98, 0xe73b22ff, 0xd992eff4, 0x490238fb, 0x44e77e40, 0x8f915cfb,
+       0x939aee70, 0x1ddf5aa4, 0x37fe8c9d, 0xe0fc4e09, 0x36fbffa3, 0xbacbdbeb,
+       0x7f4cfa2a, 0xd3c157d7, 0x1f3add4e, 0x9c2f6a8a, 0x8272e780, 0xf20bdf13,
+       0xd179e1c7, 0xfef646c9, 0x1fae41cd, 0xd805f7e9, 0x78f7ea1f, 0x21c0c066,
+       0x145a7a2e, 0xbf6295c6, 0x533f4c69, 0x3bfd29f3, 0x6e375f48, 0xa3b486a9,
+       0x7f8e165e, 0x066edf74, 0xd04d3fb9, 0x19d149c4, 0x27ffbee1, 0xbea397c0,
+       0x36493e02, 0xc8797ca3, 0x19eebece, 0x1ef02466, 0x3235e5da, 0x06bdd1d2,
+       0xe06c91c7, 0x04c98f2f, 0x83e5c7f6, 0x3b9d1e37, 0xa445ca00, 0x26f7e28f,
+       0xa56b8354, 0x91aac598, 0x5c9847e2, 0xfffbc13a, 0xaed79513, 0xa097786b,
+       0x7ce27b07, 0xb674bf70, 0x0754d773, 0x0f325bf8, 0xcf7386ad, 0x23f67959,
+       0x1b1d6047, 0xc74fbbd8, 0x9da1e4d7, 0x0577d0f6, 0xe8c767dc, 0xbb9c017a,
+       0x391ea767, 0xe0f7c742, 0xb73c449a, 0xbc4aeb9c, 0xe731ce07, 0x0e9d141e,
+       0x5de16f5a, 0x7f9c0b56, 0x122d1f4e, 0x0f2f0ab7, 0xeff47692, 0xeefdadcc,
+       0xca4fb0dd, 0xf7843ca8, 0x87fcca9c, 0xfc840ea6, 0xd7db017a, 0xb846dd78,
+       0x74ded9e7, 0xfb4998d1, 0x00f5a12f, 0x59eb35dd, 0x028d9abd, 0xe25817be,
+       0x64f9027f, 0x1f0146c9, 0xfaa769c4, 0xf5c199af, 0xbed12981, 0xf9a7b69e,
+       0x700f6852, 0x03ddc637, 0x743593e7, 0x527ed89c, 0x97539e1d, 0x98b476d0,
+       0x2efc6fb4, 0x5eb25bc2, 0xb0af7020, 0xe3ea526c, 0x41de0093, 0x47e509d9,
+       0x08dcfd77, 0xfb479ee3, 0x2fe1441b, 0x42a63b14, 0xc103f27d, 0x152eef8e,
+       0xbafb8b5e, 0x623bef9b, 0x14e2cd1f, 0xefdca204, 0x2af1d493, 0xb869d125,
+       0xd7964a9f, 0x3abcc3d5, 0x06a989bc, 0x468ba7a4, 0x2927e390, 0x7f54ddbe,
+       0x7164613d, 0x27bc7b30, 0xfe2a1d8c, 0x1d3a32b9, 0xcb6a2fdb, 0x98b33e41,
+       0x853c6114, 0x23e98ebb, 0x7ca3ab9d, 0x94eb57e0, 0x7df029ed, 0x7e136acf,
+       0x932af0bf, 0x7586173b, 0xf4fb7fa0, 0xbdc0997a, 0xd3eb95c7, 0x9e3ac1d7,
+       0xe13b2cde, 0x8e7c40dc, 0xbe9411c5, 0x7b64fcca, 0xa7b833d6, 0xcb7f199b,
+       0x02eeee7b, 0x94a5dbe0, 0x7e70994f, 0xe2563e5a, 0xf53e4728, 0x4be3145c,
+       0xe7a57e7a, 0x1b8d6553, 0x65a1cb22, 0xd0e59105, 0x37ee7ad0, 0x6b9f2c8d,
+       0xbbe98588, 0xf078c9e3, 0x0d571663, 0xf404d79b, 0x70bb20fc, 0xf3781ed0,
+       0xdc819fd3, 0x3be2b4ad, 0x7d92d565, 0x83e8c09d, 0xeb9fff00, 0xec29f2df,
+       0x51b9b287, 0x29d90ef8, 0x47d80f58, 0x1cf0136b, 0x8c57c4bb, 0x79e25778,
+       0xf4b49b4b, 0xef21f8ae, 0xa5c48b73, 0x31655f96, 0x77aaa5c4, 0x6e9447f4,
+       0xdbf33f69, 0xcab01f04, 0xdcea3fa3, 0xe62670ff, 0xe5ae38ed, 0x6b583f5c,
+       0xfa3eba45, 0x40d5c5c8, 0x287ef3b7, 0x89dbd010, 0xf20f5dd7, 0x7049bab0,
+       0xf4b89f80, 0x297dac87, 0x3ee30f6d, 0x5f4673fa, 0xb01dce94, 0x3fd7aa0f,
+       0x6feb1fb1, 0xff001c14, 0xd46286e8, 0x22bcca27, 0x9d8df2c1, 0x79504768,
+       0x7b68f185, 0xec1262bc, 0x2655ea83, 0x1562b83b, 0xb3e8527a, 0x40a7bf93,
+       0xb3b1cecc, 0xb4673b68, 0x9eb2f903, 0x4239c52e, 0xfd029e48, 0xbd1978d4,
+       0x3b2abe75, 0x4df48b61, 0xbd1eec9f, 0xd0227f42, 0xfe98665f, 0x33cfacf6,
+       0xf69e3d02, 0x91671809, 0xf40bf407, 0x9fe2b2f9, 0x1eb51621, 0xea7d17d5,
+       0xfd07b0e9, 0xe958cbc1, 0xe854fa61, 0xc7874f51, 0x8c0f7225, 0x51d5a1fb,
+       0xfabc8f38, 0xce59ef37, 0xcf9e19f6, 0x923fd5e5, 0x44bafb04, 0x0a407162,
+       0x1624ab5e, 0x5c63d637, 0x0719d74f, 0xba7c67f5, 0x0e8acc71, 0x20f1edc9,
+       0x4a3ea9b7, 0xdf9fb402, 0xe3117e6c, 0xd2bfcf2b, 0x37ea2779, 0x003a516f,
+       0x92b66ffc, 0x3e21da00, 0xade547e4, 0x1369c622, 0x4b359029, 0x712bbf65,
+       0xb2bf1531, 0xb7cbbe22, 0xb4857c9a, 0x27ebf97d, 0xc25c62c6, 0x7b7fa60a,
+       0x39d8115f, 0x2c63b788, 0x972a3bdc, 0x5e8e7c58, 0x345df82f, 0xdebbc3b3,
+       0x7a03998c, 0xdeccd09b, 0xb96f2c17, 0xfca93657, 0x65a2fbbb, 0x939e1ea5,
+       0xc33ae979, 0x3e300afb, 0x4a76fbf5, 0xcbd74e5c, 0xdbcafe8c, 0xcae7d464,
+       0x805cb79b, 0x63f2cd78, 0x6b77b426, 0xc11a2f9a, 0xd5fbcd9e, 0xc41decab,
+       0xa7135136, 0xae3e23d7, 0x20980c59, 0x0ab5abae, 0xbe6871cf, 0x3c2df313,
+       0xc66bed1e, 0x6afc556f, 0x8a5eebc7, 0xbf6d8ac2, 0x857be1b4, 0x786c9bed,
+       0xabf9aa5f, 0xc47b55e3, 0xf034b5c3, 0x4e3bb878, 0x918fe413, 0xc1cee1e3,
+       0x7d21283f, 0x878dad16, 0xbf8ccd23, 0x456671d1, 0xa4350f7a, 0xe9fabd77,
+       0xddcf10f3, 0xe793f5b5, 0x5f95dc61, 0xe21e7e5c, 0x6882a86c, 0xe6a53d07,
+       0xfe31f795, 0x1f176955, 0x97a0edc3, 0xc3f1897f, 0x7268fe17, 0x3b0bb402,
+       0xfe80a74e, 0xdfcb6171, 0x782e2092, 0xe8a98ed9, 0x3db659df, 0xedbddf0f,
+       0xfa059ecd, 0x7e23f5f5, 0x7b6ebf59, 0x3c60f75a, 0xeeba79d0, 0x714227c0,
+       0x2c552d8e, 0xe3c1d47e, 0x8e47371b, 0xcf11ef17, 0xaeeb3ad8, 0x5b1fc029,
+       0x67d09e99, 0xba61e35c, 0x63f4379e, 0xf8f3371d, 0xbe3b96d5, 0x3cf1ae32,
+       0xd7ae83fc, 0x7c6d18b8, 0x8bada7e8, 0x942cf17f, 0x1af426b5, 0x07e818d7,
+       0xf47894fe, 0xd95da3cf, 0xdeb08931, 0xa4f181ff, 0x0e857eb0, 0xa69fd7e0,
+       0x8cf8bf80, 0x44bf441c, 0xef098770, 0x38ef966b, 0xc2e9fb8a, 0xef1843f6,
+       0xf85c784d, 0xb1fa1205, 0x03ee5df8, 0x6568d9aa, 0x1d7c90f1, 0x61d25e20,
+       0x2e3cefc3, 0x12b5d192, 0x9c5bd92f, 0x3498b2e4, 0x8b0b3efe, 0xf8daace7,
+       0x0c3f8f01, 0x09309baf, 0x2bf3abd6, 0x3c1550e3, 0x130f01d8, 0x91c071d5,
+       0x714352e3, 0x8375bac0, 0x1e3e04f5, 0xf9a5f38a, 0xe9ef10a1, 0x8a468e13,
+       0x81b0bf2b, 0x905f0fc5, 0x568fdf23, 0x626b82e2, 0xd7d6fb74, 0xbee078bf,
+       0xf175f1e6, 0xa1c63f34, 0x5f051ba1, 0xf323575d, 0x846327f7, 0x85b7646f,
+       0x0a549bee, 0x4f2cfbfa, 0x997dc0c4, 0xbe234ed6, 0x55d8a293, 0xdc5dbe7c,
+       0x8af5d6df, 0xf5a27188, 0xbf907b2d, 0x3547f9eb, 0x8fd1473f, 0x6f1f2377,
+       0x1f931b75, 0x3ead5b5d, 0xb5d3850b, 0xeba44dfb, 0x189dcdea, 0x79bfbaa7,
+       0x7543b19b, 0xc3f20cfe, 0xd77f1aa7, 0x22c6bb6b, 0xa2efe73f, 0xcad9fbe9,
+       0x3f8d63f9, 0x9b353f72, 0xa9fa6a2f, 0xed18b6f0, 0x3bfbbe96, 0x05eeb927,
+       0x99dae778, 0x45ae751e, 0xd08be69c, 0x6462cfff, 0x3237576e, 0xa395383f,
+       0x959c3ef8, 0xda2707bd, 0x5b2f51a2, 0x0c749d66, 0x665d21de, 0xcc5c6235,
+       0x471e3aca, 0x326723f3, 0xeb4af7ac, 0xbbc604ed, 0xb2abf01a, 0x9bbb65ef,
+       0x27273e80, 0xcfaa6517, 0x1bf19461, 0x4f881807, 0xd3ad8fbd, 0x4a7d8206,
+       0x1850ef24, 0x7f699dc7, 0xb62e4095, 0x9f7f987b, 0x02313d5c, 0xf64bb7be,
+       0x6e14097d, 0x04e0be7b, 0xba4f6cd7, 0x7e43f067, 0x1df69706, 0x4753bc5d,
+       0x69c977e7, 0x6ad13d40, 0x1569d808, 0x4f6a8d62, 0x41d70346, 0x5e12521c,
+       0x8978c0a5, 0x11e63cc7, 0x46d43f70, 0xf50adaa8, 0x5de6929c, 0x9249d895,
+       0x72159dee, 0x57a50478, 0xc557a70b, 0xff65675f, 0xf03b70a6, 0x0cb896fd,
+       0xbbe40752, 0x7d46ead6, 0x0b9b29e2, 0xdfd23fef, 0x88938868, 0xf54ed127,
+       0x5fb450bb, 0xda3b7dcd, 0xe71f26af, 0xa613e6d2, 0xc9232749, 0x8e3e049b,
+       0x7882d102, 0xe06a9b88, 0x70abb2fa, 0xdc785264, 0x19c48971, 0x2c3bf280,
+       0x6e808f78, 0x1e7aaf2f, 0xdc768b16, 0x3e1a7c74, 0xe1d19b11, 0x6a71b035,
+       0x0389dbbe, 0xe3a747df, 0xaf1bae3d, 0x70b56f26, 0x0911277e, 0xdcc59df8,
+       0x2ffe384e, 0x4abdf069, 0x224f8a2a, 0x38c2644c, 0xde2130e9, 0x83cf9625,
+       0x6fa9aff6, 0xeb01ef07, 0x0c870b5f, 0xb5efabb5, 0xe0e5c0de, 0x8a514b11,
+       0xac93ee85, 0xb818b5e1, 0xb82c9d9d, 0x65a04e4e, 0x9fc801fe, 0x61e796d2,
+       0xc8d08a5c, 0x5ac46ae8, 0x4466fb82, 0xad55c790, 0xd53d468a, 0xa8de2664,
+       0x8e3f70f1, 0xd0f1e578, 0x3f9f8f8b, 0x28185639, 0xa50d6928, 0x1fceda35,
+       0xa62c35cc, 0x4502d08b, 0x8b10fe14, 0x5ff40c6b, 0x6c9dc33f, 0x1bd30718,
+       0x2877bf56, 0xc16bdaee, 0x1ba86863, 0x14c0ffba, 0x2ef82164, 0xdd0ef108,
+       0x51b8720f, 0x0ec653c9, 0x463406ef, 0x332ef287, 0x698df7e5, 0xdaf37f2c,
+       0x7ef0f5a1, 0xe8bda74d, 0xc78c0b66, 0xcf0ebf6c, 0x9af102c3, 0x937bd5f7,
+       0x4738ca2f, 0xc1e40c6f, 0x07b7c7fb, 0x23c5fbd9, 0xfc7ba1ad, 0x59378f28,
+       0xed007c94, 0x43d6a28b, 0x5aaad7c8, 0x01b9610e, 0x9e1d34f2, 0x421bc810,
+       0x65bf79e7, 0xb5f2414c, 0x716b5e14, 0xb1c13c32, 0xbf6632d0, 0xb8c3c1a4,
+       0x61d9bdfa, 0x6e2b483c, 0x86e1e1d0, 0x858785af, 0x87a86f6b, 0x3bfa55f7,
+       0x0b174a6f, 0x73d35f00, 0xdb8ef80c, 0xf41663c4, 0x145fd0bf, 0x670e23ca,
+       0xbcf72f43, 0xc2853b15, 0x97d35729, 0xaba14ed2, 0x9d26e8de, 0xef63afd8,
+       0xe7e96a83, 0x87ae2ddf, 0x8b32de00, 0x8896dd2b, 0x0577c7f3, 0x8b8bbba6,
+       0x74c213f2, 0x09ee2c4d, 0x11feaef0, 0x5a1f82cb, 0xe9dafe54, 0x34c54b39,
+       0x011fde3a, 0x3c31b823, 0xdee5c49f, 0x9e7451a8, 0xc6032e89, 0xb8b11fd5,
+       0xdb3b4057, 0x6200609c, 0xf71226cb, 0xf70c4104, 0xfa8feca3, 0xaf8ecc1d,
+       0x56f8362f, 0xfc60f3b0, 0xfa611dbb, 0x47d1d0e8, 0x5b47d190, 0xb547d227,
+       0x47d193bf, 0x346e5d5b, 0x3b03573f, 0xc70491ba, 0x5937bac1, 0x61a40b0a,
+       0x82626e94, 0xb23740f5, 0xc282b6f7, 0x3aebc428, 0xf58f5f18, 0xe652e3e1,
+       0x36fadbd5, 0x71fb481e, 0x0799d806, 0xa61e780d, 0xb7a94de0, 0x46e2c2c3,
+       0x7ee6cdff, 0x99a9fa11, 0x961fb1d4, 0x3f81eb6f, 0xed875c60, 0xd05dcce0,
+       0xae9b36de, 0x6fdc2390, 0xf815c1e3, 0x7f23784e, 0x04963bd7, 0x7bd720bd,
+       0x3fdb07c7, 0xde807c21, 0xe8f80193, 0x0af2fdc4, 0xdd9667bf, 0xce40b826,
+       0xef618f0f, 0x616ebc90, 0x16bbf576, 0xaf4ca791, 0x5bb83c49, 0x7b2bfb04,
+       0x27eb0195, 0x9ea19a42, 0x5f5e2aff, 0x95ddf8d2, 0x89e85575, 0x7818d272,
+       0x78f9e4cf, 0xfd2d1ef7, 0xa9a4c7c4, 0x1eed29e0, 0x45a290f7, 0xee265094,
+       0xc810f05d, 0x3e3f4a55, 0x7231bb4d, 0x442de014, 0x233e943f, 0x776d0fad,
+       0x7c6bad88, 0x5b0be80c, 0xf1152ef6, 0xae7e8e5d, 0x47bc166b, 0xc567eb49,
+       0xb4adda90, 0x4d2c567d, 0xf3c09f21, 0x087e7903, 0x743fd34b, 0x7dfa041a,
+       0x9ecbf703, 0x922578e5, 0x6399bafd, 0xb8f4cf20, 0x9418e4ec, 0x85beca0b,
+       0x5ce05467, 0xdbe7e25b, 0x0334c169, 0x8fb29bac, 0x6021a0a5, 0x4d2b42a5,
+       0xce201872, 0xbb8f5de1, 0x7b0bce08, 0x5fb73be3, 0xea81eecb, 0xc7ce7fbf,
+       0xebf58df3, 0x2fb8f4bf, 0xb7e039fe, 0xf8f1dcca, 0xbeaf9a4c, 0x69fa32f6,
+       0xdf54c457, 0x68ef55fc, 0xeeffc7e8, 0x00c4dfd5, 0x333ffa1d, 0x353fbc45,
+       0xf1e8cace, 0xb60e6780, 0x04efe2cb, 0x1c4a8192, 0x15ce2ab2, 0x865eb8ca,
+       0xdf86994b, 0x05bacf51, 0xa7ac2059, 0xf6878a57, 0xae78a931, 0xae2eab78,
+       0xbb2f3955, 0x80fcc025, 0x42beb159, 0x74faefec, 0x3e49f7f6, 0x9992fa63,
+       0xa1ce0ffe, 0x3373f2a6, 0x5efb31d7, 0x09598710, 0x3f08f98d, 0x5afd1536,
+       0xfefb4439, 0xaf40d641, 0xf4f28064, 0x67978454, 0x13a795d6, 0x6b915bf4,
+       0x4df9c3ae, 0x0cfd2a25, 0x13a346e5, 0xd1f4f1f8, 0xf7f9fe94, 0xe1bff4cb,
+       0x867f3226, 0xcdb8ceca, 0xbe515f71, 0xc4696f46, 0xfb7e8577, 0x523f38b9,
+       0x2163c5fc, 0x4115173c, 0x8f1e803c, 0x95610eb9, 0xdf13d1d5, 0xf1e9fc7a,
+       0x8f51e0ad, 0x9d0f9cb7, 0x9e8ef1f9, 0x23e3d1f8, 0x5be97e7c, 0x7530eb0b,
+       0x4bf288b4, 0xfc4f7bc1, 0xedfaf5b0, 0x009eb4b5, 0x0df142f4, 0x30174cf8,
+       0x862b27be, 0x3a6c4fd3, 0x140b37e2, 0x0f4801c0, 0x55e3d798, 0x04acc78f,
+       0xd5813ede, 0x1af80fdf, 0xed00fc89, 0xb2dd6521, 0xc6f76bd2, 0xe8c4de41,
+       0xa7abd14c, 0xbd50bc72, 0xbce6f51a, 0x9bfa2b44, 0x9a9eaf40, 0x5e5bc614,
+       0xde571b15, 0x600bcb48, 0xfc0afe9f, 0x0608b1d1, 0x95bcc5df, 0x56e05ff0,
+       0xe2ca5f3c, 0xb7df0559, 0x93d5a67e, 0xce0bfaa7, 0xdc3dfe82, 0x05655ee4,
+       0x87108c7f, 0xff1479e7, 0xd7f875c7, 0xf36bb3b6, 0x0afc7c7a, 0x27b931fe,
+       0xab7a14de, 0x7cfd72b3, 0xfa0a1930, 0x3337d8f2, 0x137f8163, 0xbf447c7f,
+       0x4563c4c4, 0x6e9c3821, 0xe2059e91, 0xa7b77d0e, 0x763e0b7f, 0x15494a90,
+       0x7253bb1f, 0xd8deb3af, 0xeb298f93, 0xc7af8535, 0x05dde214, 0x4429a67e,
+       0x1ec84bfa, 0xffcf0d48, 0xb3f72b79, 0x6043210d, 0x1c585f9e, 0x79f3ff8c,
+       0xd54de686, 0x9b3fe84b, 0xb66d9ff7, 0x121bfde0, 0x7842ba94, 0x93f7c34e,
+       0xf0f8c6bc, 0xbd656438, 0xd3096a53, 0xfbe2e6e7, 0xe42f14d9, 0x38f098cb,
+       0x090559b6, 0xe3e20fdf, 0xf66cdf38, 0xd3db9c42, 0x2b0dfb92, 0x83843df8,
+       0x527e7163, 0x3fc81460, 0xb6e5f97d, 0x4e50d5bd, 0x3d6095eb, 0x910afe3e,
+       0x3b821ff9, 0x5217be4c, 0xe953d77b, 0xa13946f6, 0xdc3671d0, 0xe801bd7b,
+       0xb8c2283e, 0x655cfcfd, 0xcf7645e7, 0xabec45c1, 0xf6f0a7ae, 0x02f7625d,
+       0x81db28f2, 0xedfa7a7a, 0x49f34e8b, 0xd3b41e70, 0xcf22abd3, 0x5bfdf81b,
+       0x68bb3f45, 0xeb0fbf75, 0xe3efc0de, 0xba8e2ffa, 0x1be7d60e, 0x2d61d5d3,
+       0x44f4295d, 0xf438ebe9, 0xf1f99dd3, 0xdfcb503a, 0x049cbccb, 0xe3d151f2,
+       0xeb8afac3, 0x9bd7a863, 0xe6dc3f3e, 0x857eb2ee, 0x35e8af3e, 0x6423d97d,
+       0xd34644af, 0xebe3ce71, 0x2edcd733, 0x41c68bb3, 0x886fd38c, 0x73cbde56,
+       0x393e8344, 0x95ed21af, 0xac573866, 0x07f97e63, 0x3d8d656b, 0xbedb86ec,
+       0x67bd9ed8, 0xb6b97f3b, 0xef8a23fc, 0xcef8f141, 0x868ed6ad, 0x7e1491fd,
+       0xbf67b7cf, 0xc9c82f06, 0x31a32379, 0xafdf4e7e, 0x7efa7e7e, 0x7035fdf5,
+       0xd8c1aafb, 0xd2a9da38, 0x1636ec4f, 0xcd697d47, 0x14f0cd93, 0x73f86f5e,
+       0xd4b8879b, 0xa3ae6f7f, 0xa44e7a21, 0x781468f7, 0xc2e7be0a, 0x0fe098cb,
+       0x1eff95a8, 0x6cdd9de9, 0xf413f337, 0x6088efd6, 0x8683ea3e, 0xe82203a7,
+       0x048223f5, 0xa0ecf0f5, 0x6350b0cb, 0xb97b300f, 0xef003d87, 0x657cd0a4,
+       0x0f662eeb, 0x5da1d4b4, 0x0aed4951, 0xe01b3b90, 0x7cc1901d, 0x27681940,
+       0x885eec84, 0x7786caaf, 0x0c5db932, 0x37a5a74f, 0x1f33fab2, 0x8c35374f,
+       0x9dd5bb00, 0xce932f0c, 0xa8fb5db4, 0xf557da99, 0x508a24a9, 0x76c8aafb,
+       0x4ed677ed, 0xde3bdca2, 0xa4bbc025, 0x65a8ff34, 0xecedff72, 0x8fd1b699,
+       0xda81bf82, 0x54d9b767, 0xfb6f6f76, 0x039b66e3, 0xfedbd9f1, 0xcd17b4e8,
+       0xdf8a3804, 0xe421f282, 0xbe28fe07, 0xf442a3ff, 0x53780b17, 0xe5f6e5e8,
+       0x88ced10b, 0x0a6ae6ba, 0x736593c4, 0xb8db703a, 0xc186365f, 0x706189a9,
+       0x376e4a26, 0xfbbdd3f4, 0x3bf028ea, 0x04fa3bbf, 0x2b7e79da, 0xf41fdbf3,
+       0xe3a91594, 0x026d6bdb, 0x10c097a7, 0xdc777fd8, 0xec0127b8, 0xc0596c95,
+       0xb2fd4ef7, 0x99f1e9ef, 0xdb669fc0, 0x6629d257, 0xfde2364f, 0x60547f32,
+       0x3d2ac3c8, 0x4ddfcfce, 0x3fdc5ff5, 0xdcff1d44, 0xb5abcd6e, 0xc022f831,
+       0x7bdccecf, 0xde80f40c, 0xae584ee4, 0x2b9004b8, 0x24a1eae4, 0xdd6a5f3c,
+       0x689f0367, 0xe0e77f17, 0xa49eeb7c, 0xdaad3405, 0xb0369ff2, 0x3e38eae3,
+       0xf8ed4bce, 0x76e5535e, 0xa113df11, 0x003d26fd, 0x85d6eb7e, 0x1fdeec59,
+       0xc8a6afbb, 0xef9ff1d5, 0x9cc45219, 0x4cff7889, 0x98a737d1, 0x9f183ebd,
+       0x1dfd8ebf, 0xf7ba29cc, 0xefe56ec9, 0xcff5e993, 0xe2b26c67, 0xa9f8c32f,
+       0x4fd67665, 0xfb2bfb6f, 0x53e204b3, 0x296cbfed, 0xb3f8c220, 0xefc24b3f,
+       0x3da40fe7, 0x3df60855, 0x01239d91, 0xa2f644ac, 0xa7cfcb7e, 0xbc2f6fe8,
+       0x6793be7b, 0x3cbd6ede, 0x6e2466eb, 0xd004d72a, 0x9803dcc7, 0x07c991d3,
+       0xf5bbff45, 0x55dfad33, 0x722b07af, 0x6e3fd732, 0x780210d5, 0xfbc2cc77,
+       0x8c240713, 0xc9ebd2f7, 0xbd058353, 0x204fc3e8, 0x4d6d6d7d, 0xfe7b018f,
+       0x009f60df, 0xc65eb6dd, 0x49aa83f7, 0xc7781ee0, 0xb455baa9, 0x24fc6007,
+       0x67d87af3, 0xe0a13e8a, 0x1eeaeda5, 0x7fda58f3, 0x7d8345f6, 0x76f10505,
+       0x57682ff0, 0xc1fdf84f, 0xfe679004, 0x07e784a0, 0xc6f717d9, 0x45f1542c,
+       0x7e0355ff, 0x6eeafb7f, 0xfc60f7ed, 0x8b6ed0f5, 0x7bcbd981, 0x063dfff7,
+       0x57dbd4f8, 0x90bc212f, 0x6f53d13e, 0xcf3bfd46, 0xd1fc862a, 0x8899bd6a,
+       0xde2187d9, 0x152c6a6b, 0xfaef426b, 0x6487ce70, 0xd4f49595, 0x2778422b,
+       0xd0f0092e, 0xf0561f43, 0x3e33d3ac, 0x773d71b2, 0xef0f1918, 0x4d5db65e,
+       0xc77bc0a8, 0x0afb18fe, 0x8f4ccf94, 0xee7bdeea, 0xfdf0e9c9, 0x9ddec8a0,
+       0x7ee22ab8, 0x62b3bdda, 0xdf6a8778, 0xeb8a4e52, 0xc5d06576, 0xfad16f0b,
+       0x3345f657, 0xbce4baff, 0x224f7d5e, 0xf1c7df5c, 0xcecc1815, 0xe183bce9,
+       0xac6fa8bd, 0xb0f574cf, 0x4361fff7, 0x0058393d, 0xfad462e2, 0xffac234e,
+       0x3e8ad9bf, 0x25a5fc67, 0x978bf806, 0xb4210ee4, 0x9268b2df, 0xac15740b,
+       0x33b07623, 0x18301fb6, 0x37325d60, 0xcf5c62a5, 0x731cfc2b, 0x31a34b49,
+       0x4b174555, 0x19d839f8, 0xaf129bd9, 0x9632befa, 0xfb3397f1, 0x71817fca,
+       0x91347f1d, 0xd0f41191, 0xfe4cb185, 0xa77a336e, 0xc77a866f, 0x68df780d,
+       0xef5ffeef, 0x97937787, 0x038c731c, 0x5894e0bf, 0x0eda0fb6, 0x710f52be,
+       0x821f6dc1, 0x6672a2d4, 0xa068b163, 0x1c45befd, 0x9877afcc, 0x90d6bdfd,
+       0x12b8943f, 0xc5379e60, 0xd6fdbe32, 0xdce68301, 0xbefe2dec, 0x8cb1f5ef,
+       0x32c6a50f, 0x03d6dabf, 0x700b09b9, 0xc447b9ff, 0x64f01f82, 0x456c3d47,
+       0xe8a80fc5, 0x6f0f936f, 0xfe863e9d, 0xc1977273, 0x38edcb0e, 0xf30882fc,
+       0x24219c75, 0xf43d204e, 0xac6f0a39, 0x5d5bde1a, 0xc71d1e0c, 0x0aafd86e,
+       0xfe04a9fe, 0xbfcd0671, 0x43c52ed5, 0x7f82983c, 0xff4a1e65, 0xdae2168e,
+       0xe4adc160, 0xfe15fada, 0x31efe568, 0xe513b04c, 0x5d2033ef, 0x6eb9b76e,
+       0x6f72c589, 0xeccfe40a, 0x36d27a63, 0x72494f2e, 0x9fc070f1, 0x79f34eb2,
+       0xb7a78caa, 0xe3e7effe, 0x4bafd254, 0x0ec8afd7, 0x76cdd22f, 0xf0ee4f16,
+       0x10e9cc06, 0x8e96d677, 0x154a9f7f, 0x8e3f7b97, 0xfdf68cff, 0x830eb6c2,
+       0x558fee01, 0x50e210ef, 0xbea7eddd, 0xa933a21d, 0xedafe905, 0x5c7dc118,
+       0xe65dfcde, 0x9f72a48f, 0xe786ebbf, 0xf87fb0eb, 0x8120fb39, 0x1bfd93a6,
+       0xfc410e56, 0xafb06c06, 0xfba278c2, 0x46dad206, 0x92ebd023, 0xe52d2c65,
+       0x9a4bd5e7, 0x4b3fb8dc, 0xc478b3d6, 0x4ca9b165, 0x257a733e, 0xf8c1e886,
+       0x7b4dbade, 0x5c1ff08f, 0x7d6d9e7e, 0x4bf40f6a, 0x80fbebe9, 0x9eda9b8f,
+       0x55c30758, 0x46ecf5e8, 0x4594e119, 0x3df3cf6b, 0xb8cfccb1, 0xf7a330fd,
+       0x5ce51bc9, 0xb26c4f78, 0xbfc1d897, 0x4dc6d6fd, 0xb7eff022, 0xd9539e80,
+       0x7b79073e, 0x3163df66, 0xd6f907df, 0x47e02069, 0x652466df, 0x62fb545b,
+       0x343786ef, 0xb9bcb7fb, 0xebfa3a6e, 0xe005e23b, 0x55becaf3, 0xe8cdbef0,
+       0xfff70dbc, 0x9ffdba9d, 0xc2b7dacf, 0x4f7ad0ba, 0xd4fffdf1, 0xe9ffba34,
+       0x718db8a7, 0x66d9c002, 0xdccefc8c, 0xfe90df4b, 0xa3b57c42, 0x297d5f07,
+       0x6c1ff996, 0xeaffb4e9, 0xffa12e3b, 0x4e3e3421, 0x2be54f37, 0x002a9374,
+       0x0ae91bfe, 0x517c008e, 0x533d02bc, 0xccfe7a3d, 0x0795dc0c, 0xe1ff3c24,
+       0x2e3c4be7, 0x6a947704, 0x99f986bf, 0x6fdd6fb2, 0xf2b238c0, 0x9e82576b,
+       0x45e8509f, 0xb82b3cfa, 0x7953c787, 0x71f61676, 0x8eb07e04, 0xec8ae3e3,
+       0xff7debee, 0x65cf40c1, 0xf98462d4, 0x1d82f590, 0x772945d6, 0xbdef67ac,
+       0x94f0e61e, 0x2dbf87ef, 0xde3d83be, 0xf0cc3d21, 0x5c42341d, 0x931f28eb,
+       0xc5c84463, 0xb70c40fd, 0xb67d860f, 0xfbafca84, 0xacebf255, 0xaa7488dc,
+       0xce23e1e0, 0xb1c4aeb7, 0xc7ce3f79, 0x5d1f07e9, 0x82ff0aa2, 0x3f6c0924,
+       0xe7db028b, 0xbb3fc022, 0x90dba6ef, 0x4c88efde, 0xb7b076ef, 0x47efe1e2,
+       0x8cfa406d, 0x7bc7669b, 0xce494f2f, 0x7e8d38a8, 0xef74c3e4, 0xced067a6,
+       0xfd85fa03, 0x97fd1bde, 0x0893fd01, 0x74a3ef74, 0x853f5aaf, 0xfc5d280e,
+       0x7ca5f01d, 0x7285d3d7, 0x65e0a90e, 0x731cee9b, 0xe9e19daa, 0x8d5200ff,
+       0x8000b56e, 0x00008000, 0x00088b1f, 0x00000000, 0x7dbdff00, 0xd5547c09,
+       0xf37df8d5, 0x3332c966, 0xb2764c99, 0xa00c4930, 0x80490e2c, 0x084ed8b0,
+       0xc3884a20, 0x93a0d752, 0x364b0900, 0x94569510, 0x8b062081, 0xb62d1518,
+       0xef858320, 0x106d1b43, 0x268358a8, 0x622d1110, 0xa57fb1dc, 0x41459041,
+       0xed1fa822, 0xe73bf587, 0x33337bdc, 0x6a02266f, 0xefc7e1ff, 0xdf77dee6,
+       0xcf7ece5d, 0x6ec5f739, 0x843631d3, 0xae630731, 0x7d8c01e6, 0xf4bf3f8f,
+       0xa12d8c97, 0xcf3773e7, 0x8224715e, 0xf0f7cfd1, 0x5e79babf, 0xc776bd50,
+       0xe91c57af, 0xc5cfafe7, 0xffe0525f, 0x8967a671, 0x47f1558c, 0x89ef4cac,
+       0xfbc025b5, 0x6cd69d11, 0xe266b498, 0x03846319, 0x8319789f, 0x1c636ff6,
+       0x6faa3e54, 0x1f2bd3de, 0xe9cc31ca, 0x9b39a685, 0x998f1533, 0x1b3605b1,
+       0x27f967ad, 0xb0dd93d3, 0xc6c646de, 0xc59bbae3, 0xd9dd727c, 0x99c68536,
+       0x8f7329e0, 0x66678389, 0xa07b9e4f, 0x6607f9ff, 0x886d964f, 0x70a13ebf,
+       0x4018eabe, 0x7ec48c4b, 0x0c985563, 0xc9bf9fe6, 0x326533e4, 0xc49f05b6,
+       0xa3db2ac3, 0xfd329b7c, 0xccf4d9ef, 0x9633b7a5, 0x75a4cb6b, 0xb15aeac1,
+       0x646858ee, 0xdfbcc197, 0x9bb59666, 0x1dd5d1e1, 0xb081e2de, 0xef462d8f,
+       0x389989d4, 0x1c1af398, 0x9d629aff, 0x6a5801ed, 0x38a6cbac, 0x6992d007,
+       0xcf8fb65e, 0xeced9793, 0xeea1b2cf, 0x2db9e670, 0xf8128d8c, 0xc930ad62,
+       0x421c3f70, 0xd9e1c6f1, 0x20175e13, 0x1750867c, 0xd5e27e7a, 0x667d1ba8,
+       0x0144f3ff, 0x78632fbf, 0xd3c1adf9, 0x1d0e66db, 0x553e6027, 0xcacc6649,
+       0x5c554b3c, 0xdb6628ff, 0x773ff0e4, 0x1c2e628c, 0x57189a7f, 0x8ffacbb6,
+       0x10aeafa6, 0x78869afa, 0x22e88ead, 0xd053eaba, 0xbcc07469, 0x8bdd194c,
+       0xee98fac1, 0x80ac5eda, 0xbd71eaba, 0x29554800, 0xf6c7ebe0, 0xd7338d84,
+       0x01d99e23, 0x0cc9cb13, 0xcdb567dd, 0xd1b6e1c0, 0xe866fa30, 0xb865e097,
+       0x838bc003, 0xde3585e3, 0xdc6bf88a, 0xd7886268, 0xdc39636f, 0x68d953ac,
+       0x42b7f403, 0xc6f7247f, 0x57039ea9, 0xd931bd41, 0x9e6050e8, 0xc22e8613,
+       0xa0ab89fb, 0xadc3e88d, 0xbc4fbe20, 0xdf9ae23a, 0xa277bb40, 0x8bc0e58e,
+       0x05b08d5b, 0xa7bfc3a4, 0x482936f9, 0x27c42da7, 0xc1b2c7f3, 0xbede7826,
+       0xd5d11869, 0x052ce2ac, 0xe6ce76e9, 0xdb9f0558, 0x2a74d8c7, 0xd863eff3,
+       0x13e89542, 0x16dea0f8, 0xde618f80, 0xd5e1153a, 0x6c93ce3b, 0x11ec6588,
+       0x23e335db, 0x32ce81d2, 0xcc1b2459, 0x5f5043d8, 0xb46b7009, 0x4b1614bb,
+       0x0a7306f5, 0x236321f1, 0x0cadae08, 0xd518d4f0, 0x6045775d, 0x7f5e2cff,
+       0x86eaf1a4, 0x9ec63486, 0x22357189, 0xbb303e9e, 0x87f9c11f, 0x44a9d526,
+       0x7fae82e7, 0x127ece80, 0x2c2ed4bd, 0xe0f38762, 0x0e660ef7, 0x47901ba4,
+       0xf8066eb7, 0x9b3de895, 0xbd355d70, 0xc38e3e8e, 0x657cb6d5, 0x7ba184f4,
+       0x21788eb9, 0x8cc7d817, 0xaeef11f0, 0x7ecdcb53, 0x66c5b3b9, 0x52ed4c17,
+       0xfcfc5b26, 0x79eb7286, 0x593b9733, 0x98229a50, 0x7ec762d7, 0xac23a23e,
+       0xe5fae4c7, 0xdd62cad1, 0x3e185f78, 0xeb890d7e, 0xaccf9467, 0xf2ff7fe5,
+       0x1fd0a19b, 0x9f89577f, 0xc4fce35e, 0xc5a3f5e5, 0x3c22269f, 0xbdf09390,
+       0xeb1cc5db, 0xeadf3a97, 0x5fb9748b, 0x3ea09b65, 0x2af464d8, 0xe66db831,
+       0xf18a25b0, 0x945b0d90, 0xa820cb56, 0x2e614bff, 0x7fe9c3c0, 0xbfae54a9,
+       0x133e3dd7, 0xa1d9afde, 0x7e852e73, 0xf10a2d35, 0xf337b383, 0x371d0045,
+       0x31075947, 0xb770af18, 0xf68065d9, 0xc9044ad3, 0xd7009c65, 0x2feb9061,
+       0x8268cae8, 0xc02df5e7, 0x5d3d507f, 0xf5c6a808, 0x6c319dea, 0x83be1f80,
+       0x1fb47cde, 0x1bda00ec, 0x4f67c89d, 0x9ff1f245, 0x81f0cc8a, 0xbe528310,
+       0x4a0188e7, 0x6e825961, 0x62c67af4, 0x78504f00, 0x30b51cb1, 0x3c07a5db,
+       0x35e67a2b, 0x7546be00, 0x9f08aab5, 0x8e872eac, 0xe9f3fd99, 0x3bed18bb,
+       0x39d0ef4b, 0xd6d5f403, 0x7aabcfbd, 0x31d0eb80, 0x942af58d, 0x6f9e3189,
+       0x4623de10, 0x7b63d5d5, 0xf557b15c, 0xa57cff40, 0xe905b76e, 0x44e61aec,
+       0x24f92ab9, 0xc1b593ae, 0x81ec5972, 0xda15974e, 0xb5771c47, 0xc7fd800d,
+       0xe38299b8, 0x7c0dfd49, 0x0e9162c6, 0x44ca5de3, 0x3fe86718, 0x8e47c118,
+       0x68ef75b3, 0xbe3ef905, 0x18e28c63, 0x6be74a10, 0x38b7e398, 0xce9f77ae,
+       0x3475f889, 0x9406d733, 0x62ba7f13, 0xf64bc20c, 0xf5cb1def, 0xa78f48ca,
+       0xee154408, 0x1de70627, 0xb76fa37e, 0x6c33d601, 0xd1b77796, 0xd99fb011,
+       0xed4bc68c, 0x523ed2f4, 0xb10a780e, 0xd2c6b6cc, 0xb78e2338, 0x7e800db6,
+       0x1fb07549, 0x78ef4f68, 0xa6b8414f, 0x882875d7, 0x777badcf, 0x3ad37ad1,
+       0xf82979da, 0x176179eb, 0x5603db74, 0xdb23ed1d, 0xf2cdf5ca, 0x666f5c53,
+       0xadb27ac7, 0x2c7dfe09, 0xd724f42f, 0xf66bf8c1, 0x17ef7566, 0x2895eee5,
+       0x52e403e4, 0xc691ac6e, 0xe9eacbb9, 0xbdabfb8f, 0xd20f73b1, 0xdf7bf3e0,
+       0xb47f12b1, 0x137e13c4, 0xf84a7df7, 0xba485c48, 0x37d9ad98, 0xb179415f,
+       0xa67014a6, 0xca59c284, 0x7eb8358d, 0xf45b1fa2, 0x27cfa024, 0xd8829eed,
+       0xcca57b40, 0x20159d1e, 0x8f7be497, 0x19ee662f, 0xed6190b0, 0x16595be5,
+       0xb17ef7c9, 0xc27df201, 0x9122fbc0, 0x2e2c9a9e, 0x569fb617, 0xcf388dd8,
+       0xfb425833, 0x975e0633, 0xe0407af0, 0x52763b33, 0x870875b6, 0xf8e80d93,
+       0x4fde4899, 0x8dee8f2b, 0x83bb09d5, 0xe0eb0bd3, 0x08fb82f4, 0xc666bfb4,
+       0x748c3c72, 0x9cf48a79, 0xfee2a64e, 0x76f81786, 0x1b0edd23, 0xf48dddef,
+       0x9d04ce9f, 0xa274e78c, 0x63dbf7a5, 0x711d7cb9, 0xdc218bbc, 0x0ee615f3,
+       0xc654ef67, 0xbe29bb72, 0x0fd13463, 0xce1943f0, 0x4eb53437, 0x66dca035,
+       0x7fa809b6, 0xa0eb137e, 0xae05797e, 0x366f48dd, 0x79f89b97, 0xe9c6d9be,
+       0x07d39326, 0x1c273fbc, 0x3e436d3f, 0xa3e7e01a, 0x7347a478, 0x26de3d28,
+       0x011bf4e0, 0x3df1d0df, 0xf1f8e177, 0x02973a1d, 0x603b0c83, 0x3ae831f6,
+       0x49e8016c, 0xf40653e4, 0xcfb40b0f, 0x9f2215b2, 0x153956a5, 0xb302ebc4,
+       0xd7dc1efb, 0xf98d9472, 0x5f3acf48, 0x6c97bc3d, 0x7efe1173, 0x67689eb4,
+       0x90686c11, 0x2c40f59d, 0x9557e3b7, 0xfa7ebca1, 0x53ca235b, 0xbdbfe487,
+       0x01e5d1b9, 0x50c7f1f4, 0x0e123f7c, 0xa7395adf, 0x2e5fb7c5, 0x8039cb04,
+       0x0f8e5ad7, 0x77c7e76e, 0x7cb9502c, 0x3d6b9608, 0x3e4423e1, 0xc1fc3c08,
+       0xeb84daec, 0x4045c6cc, 0xfacd1de9, 0xfa4f7b61, 0xf358c5f8, 0x2f67b34f,
+       0x8c5f8fac, 0xc7d5084d, 0xd7ae88ba, 0x75478015, 0x6150ea8b, 0xec8bf50b,
+       0xfaffc42e, 0x7689c566, 0x9516eee1, 0xf2fd61e8, 0x729bd228, 0x8f6e5fbd,
+       0x84aec419, 0x6b3ff052, 0x5a7d258f, 0x5fe62b1b, 0xfcc0bf06, 0xbabc6da7,
+       0x3d79e6dd, 0x6fad0e50, 0xe11226f9, 0x71593fdc, 0x4abb411d, 0x85818fab,
+       0x84df7814, 0xd70829bf, 0x322a0dc1, 0xad9ef5d6, 0xf6f09526, 0x8c378e2e,
+       0x0a33be75, 0xa6a7f5d6, 0x7b40bad1, 0xaf8eeceb, 0xeb05dd6f, 0xfae68daf,
+       0xeb9a36b9, 0xcebbd3e7, 0xbb7a41f7, 0x9274e176, 0x9ef4c37b, 0xdce5038f,
+       0x730efd1b, 0x6d4acc39, 0xd4e3fb47, 0x68fbe52e, 0xa235a100, 0x0aed1e9f,
+       0x06a9ca35, 0x1c4415db, 0x1f0039f5, 0x145b5f84, 0x073eafc1, 0xd6932ef8,
+       0xd9d70279, 0x14b2316e, 0xfc0b3f68, 0xbae4fd88, 0xcf7ac47f, 0x9a6f5f84,
+       0xa0b468ed, 0xbebfd50b, 0x1e20bc6e, 0xa2d57c60, 0x669c7da7, 0x67c44e51,
+       0x10c5d1b3, 0xc283deff, 0xab78103e, 0xba773411, 0x0f01c865, 0x81fd6fec,
+       0x7fbe2734, 0x48d9c77a, 0x47ed199d, 0x7d876a8f, 0x565de9a9, 0x5bbb87d4,
+       0x39de5ece, 0xc19be480, 0xbb3beb0e, 0x33ddb0ef, 0xcfed47e0, 0xfd88bf6a,
+       0x0dcdead5, 0xaa227681, 0x1a945259, 0xda5a523a, 0x220ca9fe, 0x0f2863fe,
+       0x57cc19bd, 0x3e5efb0f, 0x54d3d050, 0xd7be40e6, 0xcdbb7be2, 0xe00f619d,
+       0xb736cddb, 0xf385d703, 0x3ed2e6a4, 0xe83eb0b3, 0x0679e9cd, 0x0c6fee1d,
+       0xed29bd43, 0xb44fb93d, 0xfd7323c7, 0x5ef693fb, 0xce73fef7, 0x68c7da0f,
+       0x74ec83df, 0xc52c740e, 0x282d5a73, 0x03320785, 0x784adff7, 0xacfb16a9,
+       0xaab7308e, 0xcdb62fb0, 0xca53b270, 0x7dd0ac83, 0xf3869e00, 0x780f387d,
+       0x377fcf10, 0x4e11eb3b, 0xda1b0efa, 0x91afb0af, 0x50560fb8, 0xf8708c96,
+       0x8c9aecc0, 0x2599fef2, 0xf4fae88c, 0x14f7ccb3, 0xbb4b7a6c, 0x0366e88e,
+       0xffe882bb, 0x5b99dd0a, 0xebe266dd, 0x7e7ef8b1, 0xe50ea347, 0xa1cf8e6f,
+       0x797ab943, 0x474eb347, 0x2f19e0f4, 0x0f5674e0, 0x54dfebeb, 0xba48fea7,
+       0x2e9e1498, 0xabf6f042, 0xb849bc40, 0x30f4128d, 0x3286e10a, 0xb27f4bb9,
+       0x370fc233, 0xb54b0bc0, 0x58c78e87, 0xa9c20667, 0x7d63c5ed, 0x9abc613a,
+       0x8add8f97, 0xabf9a970, 0xcc618889, 0x418f2f5f, 0x30b2ffba, 0x72735dbc,
+       0x0f5b9d71, 0x3dab78c4, 0x157be48b, 0xbda230eb, 0xaddd7200, 0xd2eb900f,
+       0xe867db8e, 0xf7f1c628, 0x12d9510d, 0xe759f380, 0x461624b0, 0x3f72c85f,
+       0x00396dda, 0xe155f47f, 0xfcc5e4f9, 0xda476e18, 0xb25afc83, 0x9678b7dc,
+       0xe7a18c7b, 0x8e0df6f1, 0xb14e7f24, 0xc87a1ec6, 0xa78dedce, 0x81cf5ced,
+       0x3ae17660, 0xe2c5fd4f, 0xa9d342f3, 0x0cadf7dc, 0xdb6a74e0, 0xa05e79bb,
+       0xe3ac53a3, 0xdf9097f6, 0xb9d336be, 0xfbf078ae, 0x7e2c4b79, 0xfb8abcfe,
+       0x2f55d852, 0x407569bc, 0xbb2de2ff, 0xf001bde3, 0xbfe98abb, 0x4ceba6ee,
+       0x8fef979c, 0x20fb3be9, 0x274bd83e, 0x16501d12, 0x3c6af8bf, 0x373803a7,
+       0x14ff450d, 0x633f8fe7, 0x5ddd8053, 0x3dc6b0bc, 0x1fc02f26, 0xf9922e73,
+       0x0efaeb02, 0xab891e23, 0xfda999cf, 0x9e25bb76, 0xd62f4de4, 0x8f4de50b,
+       0x7848baf0, 0x3c25db6a, 0x913e0df7, 0x97c5f681, 0x07c5d83d, 0xaf7ec1ec,
+       0xdc7b1637, 0xf5fc7263, 0xdea77dbf, 0x5ef30ee6, 0xacff188b, 0xda127873,
+       0xd6c6c57d, 0xe1f9c2cb, 0x0b5339e4, 0x57ce37a7, 0x7fb8e346, 0x1f1a6739,
+       0xeddb5d6e, 0x3fe69fba, 0x0aab07d8, 0xf44b0bb0, 0xdced379e, 0x326ab05f,
+       0x3f2e6bd4, 0xd9ce8e3b, 0xdc845e92, 0xdb798abb, 0xf4b57f90, 0xbefdf121,
+       0x4b2a5bc4, 0x693dbc45, 0x11ba7077, 0x43f920fc, 0x396d470b, 0xe13cc8c1,
+       0x75cf03ce, 0x799235c3, 0xbede1e41, 0xfe7a40c1, 0x4e1ff3cd, 0x3f7a03cd,
+       0x5b60d6b6, 0x5ace530a, 0x51ed3bb7, 0x360da7f4, 0x1fa814d9, 0x865eb473,
+       0x4eb95f7c, 0x1c3d2375, 0xe27b7b5b, 0x00bf2874, 0x7582adfe, 0x50306e54,
+       0x770dacfb, 0xc109fb50, 0x12eb95d7, 0x7cbca3fa, 0x4481fdb3, 0xeface3c4,
+       0xf11ebfee, 0xeb68c5b2, 0xaaca183f, 0x263dc526, 0x3673de00, 0xb7d50646,
+       0xdc2cd8e8, 0x532bc487, 0x1dcfdd3c, 0xdc631eb0, 0x6b63c44f, 0x18d51f88,
+       0x92ccedc7, 0x9aefb029, 0xbec96721, 0x8a27bddf, 0x662bc9f4, 0xd6c8ec95,
+       0xb7f3ffc1, 0xf45ea12b, 0x3649de9d, 0x58f3c09e, 0xce866781, 0x8a8fa040,
+       0x7a2f5e08, 0x68764f51, 0x78254591, 0x1d5c82b7, 0x65de4a43, 0x7efd0b1e,
+       0x4753df21, 0xfd0e1ead, 0x1818c6c6, 0xb45fa1ea, 0xa06629ce, 0x4e797f27,
+       0xc06769ff, 0x9733467e, 0x42e2ed1e, 0x5f6a0866, 0x0a7d6511, 0x4c185aed,
+       0x28b0fa8f, 0xd8f9f822, 0x813daecb, 0x5b58c4f6, 0xbfa4bb70, 0xbfa0389c,
+       0xb1b97efe, 0x8fe7cf7b, 0x567d804c, 0x9ec953ec, 0xde5c90be, 0x41cafb8f,
+       0xda51bf7c, 0x29bdef04, 0xf9e6f3a0, 0x9052cb63, 0x86140abe, 0xe763ae7e,
+       0x5ce5f3c3, 0x018c9f41, 0xf1f9fb9e, 0xbb39d13c, 0x7f6c8ebb, 0xeebcc15d,
+       0xe2ffae3a, 0xcb0fd9e5, 0xf73b4eab, 0x87f5686f, 0x53fe7f96, 0xf078a3fa,
+       0x0b5e19ab, 0xe585ff95, 0xfe5c2dc9, 0x5685e56a, 0x6975c85f, 0x4e7d5bd7,
+       0xcf13d20d, 0xd7e27909, 0xfe7a4617, 0x6b8f9e33, 0x9e8486e2, 0x219ec18f,
+       0xea877978, 0x760e5ce9, 0x6fd8edd7, 0x5711d980, 0x665a4b08, 0xb9468acb,
+       0xdcf164d6, 0x97e01719, 0xa8d4dfea, 0xedd1f943, 0xfb0431af, 0xf5f9e46d,
+       0xffbe389e, 0x875e38f2, 0xfb9d2bf3, 0x92794437, 0x2f6f38f5, 0x7e3033a3,
+       0x85fbcb25, 0xaf7690fc, 0x9da577b4, 0x7d59ed2b, 0xb367b703, 0x7e41dd63,
+       0x5fafd633, 0xed183f90, 0xef73e474, 0xe7da28ae, 0x107b8a67, 0x731569f2,
+       0xa017143d, 0x7c0deb07, 0xbcf5dafd, 0x13ec2716, 0x413b26e6, 0x1d1ccfb6,
+       0x8d6f9e5e, 0xc2ff53d3, 0x40ca6fc7, 0xb6b3ee3b, 0xce50339b, 0xfff1a67e,
+       0x0f0fc4f6, 0x507d7e0b, 0xe15893e8, 0xf9087827, 0xedc0ea08, 0xfef02dae,
+       0xe26ec58a, 0xbe2edfab, 0x1747ca91, 0x8fe7a42f, 0xfcd265c5, 0xdc77c2b6,
+       0x23a700d9, 0x17d2552b, 0x3eee8d33, 0x91def0b1, 0x1bf91d08, 0xc799d70e,
+       0x3b63336f, 0xcce5f3a3, 0xf26c27c7, 0x1f01f806, 0xe90c7dc3, 0x09af9f79,
+       0x9d2a5ebc, 0x2b4eb356, 0x7a6eadea, 0xb7a2103d, 0xa72f11db, 0xf6226759,
+       0xfa3a55ab, 0xf3a12934, 0xaf5cc83f, 0x2366bf61, 0xd37c8feb, 0x92f5c51c,
+       0x029bdfb6, 0x9ed0ab7f, 0xd433f285, 0xcce4615f, 0x7b5e823b, 0xc4ef5d5b,
+       0x9333bc91, 0x56eb4edd, 0x3ef44e29, 0xb4e707ce, 0xc639f10f, 0x975fd089,
+       0xc775b56d, 0xc779f855, 0x185c71fd, 0xfe4f5c7f, 0xee3aed1f, 0xd570e789,
+       0x296485fa, 0xc4c742fd, 0xd9c5167e, 0xe844fc82, 0x0fe70f0f, 0x48de3aba,
+       0xd510dbfb, 0xa8b8c5e9, 0x3e7e66f7, 0x55e51a4f, 0x5a95dfd0, 0xfe8858dc,
+       0x71c67fb0, 0xbc7da63f, 0xf1cf1927, 0x4e8d92bd, 0x2c5ce3f4, 0x76680e3f,
+       0x478138f1, 0xd358eb47, 0x03ec8de1, 0xf0ec4aeb, 0x34a11a14, 0xf8d226c4,
+       0x096eac49, 0x11fa0de2, 0xa3dbf230, 0x743c8a7c, 0x213c9743, 0x91a56147,
+       0xaddb77c8, 0xbc3c531e, 0x5d467437, 0x53edfa3d, 0xe23c78ab, 0x6de9e284,
+       0x1b8d0ecf, 0x5e3932cb, 0xbb88aff0, 0xd0346fe6, 0x3e37f2ba, 0xfcd1f146,
+       0x95eb578d, 0x1f943900, 0x27fea06f, 0x9bd39d5e, 0x851f18fc, 0x880ebf8f,
+       0x4662f4e7, 0x8a10e11f, 0xbfa58687, 0x313ff17e, 0xf609dcae, 0xef3cb050,
+       0x20243f17, 0x0cfaa16f, 0x3c7d73c9, 0xc07f23d7, 0xd358057c, 0x7cc8661f,
+       0x8fe40d85, 0xbe6c6add, 0xde51e306, 0xbc431d1a, 0x2bf9efb7, 0xcd676bc5,
+       0xb6bc5070, 0xcf7dfdfb, 0x3ff6c72c, 0x118362cc, 0x87be29fe, 0x7ccff415,
+       0xc9e3c91b, 0xb1326edf, 0xd9a5b025, 0x3c53376f, 0x8e954d78, 0xeed17ca1,
+       0xe832661b, 0xa0db5c78, 0x47f8e02b, 0x0ef12839, 0x7c446404, 0xfc21bc48,
+       0x6e3198b6, 0x5fad02fc, 0x7e80cbae, 0xc7dc04f0, 0x4e906b96, 0x15d9557a,
+       0x75c817f4, 0x4c9f485d, 0xfa69ff8a, 0xc3d467e4, 0x9c5fc5b7, 0x74819e1e,
+       0x5ac3d5ae, 0x7164dbfd, 0x0bbf6255, 0x4213e1e9, 0xd7894dfe, 0x7e3043c4,
+       0xc76f0616, 0xf00c1c84, 0xff19df8f, 0x1fe3fc23, 0xe3091ca1, 0xc8c67f1f,
+       0x9da36fe5, 0x0c2936dd, 0xe627bcbf, 0x32eeadd7, 0x6f8cfea2, 0xb3cac251,
+       0xc651ab6c, 0xfae05713, 0x2b44fc64, 0xb7c0c38f, 0xde5ffb11, 0x7b0bbad4,
+       0x165ec6e5, 0x15dbe68d, 0x37b9c3df, 0x046b3ccc, 0x30163b9f, 0xea3aa38a,
+       0xa82bc918, 0xb093b8fb, 0x0023f295, 0xb8e04f1f, 0x9d638a17, 0x1d9215b6,
+       0x8656e324, 0xf8f3e0d8, 0xcfd9789e, 0x6fc447f5, 0xe27a0f7a, 0xb05d624f,
+       0x5fb067ff, 0x141602fc, 0x9971919f, 0x62af3af8, 0xc47547cc, 0x3bdadfc8,
+       0xf304b3ce, 0x3386ba3f, 0x8f5053e7, 0xa215b529, 0x72cfb53c, 0x66fc61b6,
+       0x9fee29f9, 0xf98f3e5f, 0x79012a96, 0xca2c9e05, 0x05bc4203, 0x0a7607fa,
+       0xac53b6f9, 0x5fe4f41b, 0x5abaf9e3, 0xa4f403e2, 0x756e87c4, 0xed784aab,
+       0x02a7af0a, 0x43fedaf0, 0xf919fd78, 0xe48b9df2, 0x852f0fcb, 0x9171fe6e,
+       0x8c4bf374, 0x3b090c6f, 0x578867df, 0x67407ced, 0xbef88347, 0x78db3a07,
+       0xf9d2f189, 0xa7a89fe6, 0x5dfae142, 0x5c28427c, 0xfaeb1657, 0x5166bc91,
+       0xd57a70ce, 0x4ffe6096, 0x12d891e7, 0x1e7a5c86, 0x3b7bfac9, 0x1967888d,
+       0xd5eb9107, 0xf6c88fe6, 0x0f25169a, 0xbb859fcf, 0xe039d3cf, 0xe8bfdb74,
+       0x079a101c, 0x0f9de7c2, 0x39fc8de4, 0xdcd01d56, 0xa677fc0a, 0x752748c9,
+       0x377e3995, 0x7bf7fd0a, 0xa0e7cc0d, 0xffd811fe, 0x5ffbc60a, 0x03bcb4d1,
+       0x305757fd, 0x479c57bd, 0x1db9ef95, 0x7c7c8315, 0xf2955ec5, 0xfe66d8bf,
+       0x2c458ebc, 0x4c74ff41, 0x02398e81, 0x8aeb19e0, 0x78008e62, 0x07b78dc6,
+       0x7939e5d5, 0xc13798ae, 0xfde82bdd, 0x82b31ba4, 0xae78a7fa, 0x3a9e7a08,
+       0x9ea8372b, 0xa822375e, 0xa385ef7f, 0xde99ea83, 0x67fa836b, 0xaa0e4c37,
+       0x1cde34e7, 0xab18ffd4, 0xec147c7b, 0x5bfa3fb3, 0xebcc3f00, 0xd60cb8ea,
+       0xb7ac433b, 0xa0f29aef, 0x5afd81f7, 0x53381e31, 0xcf17c990, 0x00abdf8d,
+       0xff08671c, 0x39bee5ce, 0x55cfe341, 0x677e88ab, 0x048e1a36, 0xacf469fa,
+       0xc02a4f6b, 0x38a7c6b9, 0xb95ea15b, 0xecf9f826, 0xbde81b1d, 0xf6e0bed9,
+       0xeb839bb9, 0xd29cde83, 0xb901e79f, 0x4672bf29, 0x87dfb042, 0x9989d085,
+       0xb599f4e4, 0x7aa5ffdc, 0x24e86afb, 0x27ec5f18, 0xd0438dd2, 0x9839298d,
+       0xc11d226e, 0xfaf95374, 0x0708a1d6, 0xfba3fc2d, 0x0bc9e869, 0xfe007eff,
+       0x7d306716, 0xfb4ee169, 0xec567583, 0x95efd850, 0x6acfb850, 0x2a797879,
+       0x633b850b, 0x1fd7233e, 0x688fedc1, 0xd981fde0, 0x89ca18f3, 0xa8163bb3,
+       0xe3638718, 0xecff3c79, 0xed07af8e, 0x2f898473, 0x97c484e5, 0xf80425d6,
+       0xe97c647f, 0xaf19c634, 0x67111764, 0x844ffddc, 0x8f00c807, 0x0b11f301,
+       0x71dd119c, 0x3c7f48c5, 0x653f2b49, 0xb9e3fa09, 0xfe2bd204, 0xbc3d6c78,
+       0x03e6343d, 0xc653ae37, 0x8ebe64e5, 0x930a2bcc, 0x8497fc9f, 0xb40fcc04,
+       0x75f9e347, 0x3a7cfb4b, 0x22bcc977, 0xc302f226, 0x4fa4ffd8, 0x14d7f19a,
+       0x26760bb2, 0x0afebd70, 0x176dd78e, 0xa92fbc88, 0x471a7bd7, 0x2a7adfc6,
+       0xc52a5d95, 0x2894bb13, 0xf46153e7, 0x3f0947ca, 0xe685bf51, 0xa8147f8f,
+       0x38ee6a47, 0x0bf507bb, 0x6c63fdc0, 0x6f4058b7, 0xfdbd7e2b, 0xd12b68bb,
+       0xaaebd76b, 0x9c342faf, 0xd8c47089, 0x222d8e01, 0xe445afdf, 0xd6f5c9fb,
+       0xf4baa445, 0x9c1ed879, 0x8ae327ff, 0xc28dfdda, 0x3afe71fe, 0x976417bc,
+       0x76e5cf2c, 0x870169db, 0x276e160d, 0x9db91318, 0x1f39ab50, 0xfb7036d5,
+       0xacd7a40c, 0x8c718096, 0xdfea1689, 0x4c685cdf, 0xdf8471c4, 0x42a67965,
+       0x4572c576, 0x77e47b21, 0xfcf4d1b6, 0x868509cf, 0x6fffe844, 0x6011af31,
+       0x16636588, 0x93438f5f, 0xe892fe17, 0x68c252ff, 0x36898d2a, 0x5db67fe1,
+       0x6a91f481, 0x5da91976, 0x8aa71f0d, 0x1afbe44e, 0xb464f229, 0x42718071,
+       0xdfdfa26e, 0xe2d2edc4, 0xfe4189b1, 0xf18cf7fe, 0xd0afdfc2, 0x53942eeb,
+       0xef7814bf, 0xeaefffc9, 0xf1476b67, 0xaffff5ad, 0x7ffee48c, 0xf1081f19,
+       0x85c73bff, 0x1e23fff5, 0xfe7eeda2, 0x2dd893e9, 0x3e50d29f, 0xea7a30ed,
+       0xb5d5fcf1, 0x6878ec1d, 0xa4ebe7ee, 0x7dc0c0b8, 0x673c4ed9, 0xbb64cf2d,
+       0x4b6f482c, 0x7f3b4318, 0x696ea747, 0xe95f3c24, 0x3e7c3665, 0xbf3f2d7c,
+       0x3871ae55, 0x0e529b71, 0xfdc89d5c, 0x1f380687, 0xbdf1725b, 0x27186dc9,
+       0xd9953958, 0xb2350d51, 0xda2b22c6, 0xd8596b45, 0x4168e3f3, 0x770a134f,
+       0x4276fe51, 0x0fb7cf17, 0x7693a7ed, 0x73e2217e, 0x2ce79758, 0x7971cf8f,
+       0xcf112242, 0x5f3aeda9, 0xb27d73b8, 0xa46ae8ad, 0xf0be81af, 0xc29188e7,
+       0xbb32e64f, 0x03f8e227, 0xd87cf1b7, 0x677f294a, 0xf01e98e8, 0x75e0453e,
+       0xd79e5aca, 0xff7fcec1, 0x45ed2abd, 0x9433e346, 0x2d53952b, 0x5513f43e,
+       0x697a64b6, 0x99c56e5d, 0xe5a2f283, 0x2bd6376d, 0xe86df3f3, 0x9dfd7097,
+       0x91fb4729, 0xfcb8c9a9, 0x52a3b3d2, 0x8f1e909e, 0x64d438a7, 0xf1236f41,
+       0x72409cb0, 0xc034657e, 0x92ed72bb, 0xf3d7985d, 0xc5191ffe, 0x5da80e9b,
+       0x5fb07143, 0xe6167001, 0xa567a962, 0xa648b7e4, 0x718aa671, 0x7982ffbc,
+       0xfef3fc23, 0xda75e5aa, 0xf30301cf, 0x9d1d0046, 0x038379de, 0x09e5eeed,
+       0x93cfe411, 0xaa83da71, 0x42523ee7, 0x5c1aaefa, 0xd12d4dda, 0x9c83f436,
+       0x3a61f9de, 0xb93e4dc6, 0xed05ace7, 0xbbe87fd8, 0x7c2f982c, 0x16bbd17c,
+       0x93f1c017, 0x9de52a45, 0x86f42add, 0x897dfb84, 0x271fee1c, 0xdc2117ba,
+       0xddfc5b6f, 0x2a3cc0d0, 0xe88130b6, 0xa54fb679, 0x9cb75c90, 0x168d1cdd,
+       0xbabd774a, 0x2ea82e39, 0x89b540f5, 0xbf3b85d5, 0x69e824bc, 0x6306d376,
+       0xf7e703aa, 0x38fa42ac, 0x7474e7ae, 0xe7c59b7c, 0xa7aff4cd, 0x11b069bc,
+       0xb47f83ed, 0xea2b5898, 0x81877d33, 0x8abb49e7, 0x8f0ba015, 0x9d76bfc0,
+       0xa68e5e7b, 0xc63e66f1, 0xcc1947e5, 0xebe010b5, 0x724d9969, 0x998fbb41,
+       0x25c6389f, 0xae675c01, 0xe3fa1850, 0xc022ffb0, 0xfde1679f, 0xa5fda15f,
+       0x379967dd, 0xf9480e58, 0x3cf02955, 0x79f821bd, 0x696fcb65, 0x43cc199c,
+       0x27602079, 0x735f9e69, 0xd80af50c, 0x67ed4147, 0x519b66f6, 0x14496f8f,
+       0x6ca1edf1, 0xfef0f7d8, 0x18ec88ae, 0x927e184f, 0x36c5c9e5, 0x17cfd622,
+       0x7c795047, 0x5172a331, 0xaae3a722, 0x44efb796, 0xc766a97b, 0x738e2316,
+       0x9681f1c9, 0x999bd613, 0xe896ef5f, 0x1e21af3d, 0x28252cd9, 0xe1b3504e,
+       0x32ec91ac, 0xd1529f01, 0x00f08a5e, 0x1cc2dc3c, 0x503cf1ab, 0xc7f0655a,
+       0x5bffe0e9, 0x60c3bf72, 0xd1da80bf, 0xb5173991, 0xb94fb95f, 0x5abcf96f,
+       0xf30c7a05, 0x4583e4be, 0xd8cd1f42, 0x2f796938, 0xcefd5100, 0xfc9d1963,
+       0x78f649bc, 0x516bc091, 0x8f64fdc4, 0xe3d88517, 0xb7dc3dec, 0xe64ac7a4,
+       0xa5a23d24, 0xcc07493b, 0x23f7a06c, 0x4ddebd84, 0x120f2d6f, 0xcc3d245c,
+       0xe4685d5c, 0xc8c79be6, 0xb26f4aed, 0xa326d7f0, 0x30e816bf, 0xba063ec8,
+       0xed6baa0b, 0x9d0d2ff1, 0xb41f2819, 0xe7ccb876, 0x60e7c2d4, 0x9a5fcf22,
+       0xb38d70e1, 0x8073c00d, 0x85f9397b, 0x10ca46f1, 0x3dc6dbe4, 0x6edf2377,
+       0x0ff37ce4, 0x92b30f41, 0xf049113c, 0x9af4b3dc, 0xe77fc41a, 0xf2065312,
+       0x8a6967b3, 0x3dfd0f1a, 0xc39214ab, 0x18a697a3, 0x97d3ce11, 0x7c871e0d,
+       0x345ccb9d, 0x1638b4fe, 0x9c186ed6, 0x7947e5c4, 0x6319819d, 0xf4462908,
+       0x506a9f0b, 0x9a8c2fc8, 0x6be02264, 0xf557c096, 0xa4adb78a, 0x6ff01caf,
+       0xe01f5e28, 0x2aeab33f, 0xee701f09, 0x52c7cb08, 0x66b154af, 0x3b8c0a63,
+       0xd11b6567, 0x82479c31, 0x95b2d7fa, 0x66eaaf84, 0xd5dd7b4d, 0xb9d83f84,
+       0xb589cf11, 0xf79f823b, 0x8276124f, 0xbe913993, 0x225a773d, 0xb471af30,
+       0x4ad94f80, 0x6b7286c5, 0x84b6b2fa, 0x7d3ea01b, 0xed84eaaf, 0x8587c374,
+       0x1f2823fa, 0x1cdecced, 0x719c57f2, 0x9fb09238, 0x52edcac7, 0x8619ef45,
+       0x3ce2d3ed, 0xd8cfd0c3, 0x618591f5, 0x73a1df7e, 0x11e4732a, 0xfca20f95,
+       0x341b1b2a, 0x2fbec029, 0x3112d833, 0xf365e91e, 0xb83dc593, 0xd4f84088,
+       0x7e24ac46, 0x887e45a8, 0x34c3f3f0, 0xdda17b8c, 0x7942a2f3, 0x30476c84,
+       0x34709fbd, 0x9091c226, 0x9033efb9, 0x8a6f2e9c, 0xf971f3a5, 0xea2322b2,
+       0xb16df2d5, 0xf9c11f64, 0x86cbbdf4, 0x6879f1fa, 0x649ede59, 0x39bcb718,
+       0xe306a9d3, 0x19dcf431, 0x0d39ceb0, 0x8efe2487, 0x23bf80f4, 0x7807f0e1,
+       0x4f2f6a0b, 0xe0497212, 0x238a2d8d, 0xef3a5abd, 0x58089cd5, 0x48ba99d7,
+       0xe9ec93ca, 0x8c66c47c, 0xe903fca0, 0xabdf1abf, 0x7944cfdb, 0x0e57673e,
+       0xf169fc21, 0xd3dffe36, 0xcbbda187, 0x68616efe, 0x66cb4d67, 0xf6864db7,
+       0x6fce14db, 0x19afead3, 0xddc4768f, 0xbd9e5c49, 0xd5d07205, 0x41b7b197,
+       0x0e40ba0e, 0x11f20bbe, 0x4e2fefeb, 0x8b87faa6, 0xb47e541d, 0x47951fb8,
+       0xf25fbf84, 0xd102101d, 0x2e2492ed, 0xc9249717, 0x6482faf8, 0xffc66934,
+       0x3a21ddfb, 0x6c67de1b, 0x9d36309b, 0xc15cebb1, 0xa9c6f7fa, 0xd3b5fac1,
+       0x8c971b60, 0x0a15dbe7, 0xeee5a3d9, 0xe1fd4191, 0x7bc464dc, 0x9e5fac2b,
+       0x86f49dbf, 0xe81938c3, 0xb8e2a6f1, 0x37d7fea0, 0x9fd506a4, 0xfad07248,
+       0x0ecf8d26, 0xb4b9bf6a, 0xecbd507f, 0xa431919c, 0xf1014777, 0x679102cf,
+       0x8e770704, 0xfbef1b17, 0xa4b0dd75, 0x5fbd60bb, 0x73d033ef, 0x5e243e2d,
+       0x9951ac67, 0xbe9bc607, 0x2c1fe406, 0x74e348f1, 0x0e2fafe2, 0xb25ce858,
+       0x7f6f29bc, 0x350fd401, 0xe80f2819, 0x55b8b2d0, 0x6a1daf68, 0x2832b04a,
+       0x6155cb3d, 0x2c8cd8d7, 0x2d15de40, 0xa6f9425b, 0x93933e65, 0xef7697ec,
+       0xc0eeb293, 0x122e2af3, 0xd53de4f9, 0xfe10aad7, 0x67df045c, 0xe15ee922,
+       0xf127b071, 0x4ef4e12a, 0x0ae3aebe, 0x13f5865b, 0xb9f71f91, 0x6a71d60b,
+       0x0e856362, 0xbeea15fd, 0xcf9f9204, 0xb6e90cab, 0xf2819e74, 0xafbf660c,
+       0x533ac06e, 0xbe395372, 0x66a3ca55, 0x7c6898cf, 0x021405d6, 0x6d3c16fd,
+       0xae01ea7a, 0xfb7d78ff, 0x8203df40, 0x8e8e913e, 0x2c5732c7, 0xf5a1562d,
+       0xc276fe7e, 0x87ee7c06, 0xee106fa7, 0xfdc1bd7b, 0xefe01266, 0x20df0af3,
+       0x128b6f92, 0x70b4af88, 0xf2e4623f, 0xa07c8bcb, 0x9fa6e5f8, 0x7e9296cf,
+       0x26706e98, 0xe56e493a, 0x3adca0a7, 0x7640d2b2, 0xacbbd330, 0x3e8f4893,
+       0xe72c744f, 0x8c77a239, 0x691df5c3, 0x5f9864c8, 0xa552be51, 0x1fd20af3,
+       0xe7e3efef, 0x0f5587d4, 0xdbcc24d8, 0x525878a0, 0x3edcdd28, 0x5de5186f,
+       0x596ded6a, 0xeabc097e, 0xe64bb009, 0x8179e4ec, 0x3f53bf2c, 0x3ee06075,
+       0x3cf9f196, 0x4af94105, 0x1daf5955, 0x2ec8eb34, 0xc273c18c, 0xa254f789,
+       0x8d5913b3, 0x9f019343, 0x86bb7527, 0x2ff505de, 0xea8f7a26, 0xda223ea1,
+       0xeb842ff3, 0x0ccadd5c, 0xfaf30b25, 0x091aaf0f, 0xacfe7def, 0x2e6c49c1,
+       0xcf39fcec, 0x43fdeecc, 0x1bd815f6, 0xe1ddb8bd, 0xcffbc14a, 0x1acd1d73,
+       0xc7c3807b, 0x00204981, 0x056adb17, 0x7876376d, 0x3c01e588, 0x31d74f57,
+       0xe079e04f, 0xb1e3c8b0, 0xa873f324, 0x24a61bb4, 0x5d333973, 0xbd9be9c7,
+       0x037a70ac, 0x0f502afb, 0x173db948, 0xbf55aaf3, 0xbb72901e, 0xfe52358a,
+       0xdb99238a, 0x1f15b32f, 0x9835ddd9, 0x2bfd0289, 0x56683c6c, 0xf3e4d9b5,
+       0xb698d265, 0x7a60fb40, 0x73279732, 0x8e3ecf8c, 0x3ac95be4, 0xfd353ef8,
+       0x2af8373e, 0xf543323a, 0xc36d854f, 0x6f8d3b32, 0xb79fa270, 0x756bf052,
+       0x256be2a3, 0x51eb853b, 0x299d57e9, 0x3f56a8f4, 0x8d25e885, 0xd1a99a3e,
+       0x5831acbb, 0xe97ac2cf, 0xaf5cb2de, 0x68ee9d76, 0x0e61c10b, 0x6ff50bac,
+       0xa7b7c785, 0x38add684, 0xeb21a301, 0x31ee64a9, 0x780fb8b1, 0x5d08eade,
+       0x215f769f, 0xd4fb15eb, 0xf9c2bbae, 0xbbe62b55, 0x04293554, 0x243eed2f,
+       0x9c76b43e, 0x97854bc4, 0x45a2b7c3, 0xd67e7c21, 0xf2321f6d, 0x61ba4b6f,
+       0xe02ff0cd, 0xb047497d, 0x6f9412af, 0x1e41ab95, 0xd3d28667, 0x456cd61c,
+       0xad61a9ba, 0xdf9053cb, 0x1faf9b5a, 0xb5867e8e, 0xa9f9d36f, 0xa39aded4,
+       0x7a50058b, 0xbf8e5773, 0x17e74fca, 0x5cfc278a, 0xe9ddc3f0, 0xe01e9fa5,
+       0xeaa37335, 0xd4141c8a, 0x7a3fe44f, 0xbcb38e09, 0x63fa235e, 0xe53f0967,
+       0xab59d685, 0x2e5ff7e7, 0xcf015eb8, 0x0fdd7b9f, 0x7764f727, 0x76173f85,
+       0x3d1a5bdb, 0xfb81b1ff, 0xfe7ca55b, 0xff22ef5a, 0x3b0bb42e, 0xe3c6ceac,
+       0x9eb91a7d, 0xbd724f9e, 0x3979e842, 0x5b35d1cf, 0x13305e29, 0xf68080ed,
+       0xa56f56cf, 0xd9f1a578, 0xcbb45699, 0xbe99ae8f, 0x8f52f30a, 0xbd274d36,
+       0xa97bf95f, 0x40c63df7, 0x4d68a27b, 0x907bfad9, 0x5247378e, 0xdda2b15c,
+       0x2045ce23, 0x639fa167, 0x6cab970d, 0x95b39735, 0x90071fa8, 0xfd8bec7e,
+       0xf4f0acee, 0x68087e45, 0xe779bd27, 0x779fcf74, 0xfe77b8c2, 0x25e9da29,
+       0x755ad850, 0x5adbcf64, 0xcf563f51, 0xde20f0ff, 0xe07b01d3, 0x7b4b5ffd,
+       0x0645aa00, 0xea325b4f, 0x54076121, 0x6c321bab, 0xbd083768, 0x7f801ff1,
+       0xe7f87844, 0x11cbfc12, 0xdbf101fe, 0x9c381b4f, 0x7fe06ba7, 0xcbc72578,
+       0x2b6ca6f2, 0x6d3f2f9e, 0xebbb26c8, 0x821ca6d3, 0x00078cff, 0x1f5fdcfe,
+       0x0035776c, 0x817cf1fc, 0x96f587f0, 0xfc043bb7, 0x0dfe1c9d, 0x256cee1c,
+       0xc084672f, 0x57f94bd9, 0xe4d1fe77, 0x78e23b44, 0x57d92b64, 0xaca8b7c7,
+       0x932ec03e, 0xac37d176, 0xdfb449f1, 0xf767fc24, 0xf28418e9, 0xd7e1f4a7,
+       0xd98788ac, 0x3150785b, 0x95ccfe04, 0xeec7f144, 0xa8edbbf9, 0xdd5f116f,
+       0xe245d476, 0x19b986a9, 0xd796c7e9, 0x4239e00e, 0x45bf7171, 0xb66fbc8d,
+       0x19bef823, 0xda9592e6, 0x8ce2c5d1, 0xa4f5c088, 0x79d3ef69, 0xbebdc618,
+       0xd6eaf9cd, 0x5de7c4f9, 0x25b97941, 0xfe80d5ac, 0xd0acd636, 0x05eaed3d,
+       0x8642d685, 0x5a3ab571, 0x09453387, 0x56aecbca, 0x564f6475, 0x447c4519,
+       0x892455e4, 0xdc29497e, 0x629c902f, 0x2474f2a3, 0xda707d23, 0x7de1f462,
+       0x255f382a, 0x9ddefce3, 0x41dbc226, 0x5fc0135c, 0x333f0a35, 0xb7a442a8,
+       0xd3a7185b, 0x297bcc5b, 0x972707ae, 0xa71fa875, 0xc939342d, 0xa18f8dce,
+       0x42cdd2f8, 0x5e62ddde, 0x313d46ee, 0x61746ccd, 0x317ae309, 0x1a30d7f9,
+       0x0df987a6, 0xef748cbd, 0xf3a234b0, 0xdf123c59, 0x8ef87c96, 0x95ea5808,
+       0x1fa38e60, 0xf6dd7e18, 0x5e285c7d, 0xf609f8fc, 0x8546d74b, 0x170c8bf7,
+       0x2e5c5070, 0x609b3ff2, 0xc75828ec, 0x6f0714a8, 0x3fb8d877, 0xc9e02d7a,
+       0xb6afc7e2, 0xfc79799d, 0xb1f30ab2, 0xbc58f7f9, 0x5d541f24, 0xc8cabd50,
+       0x62794f9f, 0x34eaf143, 0x8e61dec6, 0x2ab78881, 0xee782194, 0x61f18b2f,
+       0xf43aef7c, 0xd4b1db87, 0xd64cbd13, 0x978eaf33, 0x0e3b660d, 0x25e3fdc7,
+       0x2abf9e02, 0x0031ad60, 0x83d7d6f7, 0xb437f3fd, 0x02fb5aea, 0xb7d3af7c,
+       0xea7d21b6, 0x1b061c22, 0xaf1ee3cc, 0xa539e2e4, 0xadc5e96a, 0xa689e2b7,
+       0xa0a3d5e2, 0xacf9e3ae, 0xfee6bf5d, 0x59805b89, 0xeab76e11, 0xcb9abb59,
+       0x52e100e9, 0xa978776b, 0xe2853cdf, 0x202e3237, 0x86183ff1, 0x2de3c40f,
+       0x4e307d62, 0x37df1583, 0x7cd7c786, 0x8ccc2f81, 0x15cfb846, 0xf257377c,
+       0xbf30535b, 0x0478823d, 0x2ed0553e, 0x22ddb806, 0xe2f89eca, 0x476e14a1,
+       0xcfc2943f, 0xe25cf7ef, 0x95dccc7c, 0x82797941, 0x7c4daa5f, 0x75ff397c,
+       0xc5307ca2, 0xf5cbe34e, 0x8a7ebd00, 0x0240e8e3, 0x691ebd20, 0x68fb27ac,
+       0xc3880b16, 0x49fbfa65, 0x77ad0eba, 0xf7dd11cb, 0x66bb1a58, 0x5f95e820,
+       0x8e513a44, 0xce6c62de, 0xf68733a9, 0x52e67193, 0xefa061d6, 0x993f4903,
+       0x55633fd0, 0x9535e533, 0xf41efc2a, 0x578b42e9, 0xc7e27607, 0x067bbe22,
+       0xa79c46ec, 0xfca15634, 0x773169af, 0x975f2096, 0x2c7a8d5a, 0xdff1163f,
+       0x8d17595b, 0x2b2d89ff, 0xdf8606e6, 0xe631504d, 0xa4f80b07, 0xadfb05d8,
+       0xebc3f947, 0xe4695d2b, 0x4ff5128d, 0x665c61f7, 0x03a079ea, 0x762e1faa,
+       0x5fa7bcc1, 0x91d9cf15, 0xfa7e7c62, 0xdecf413e, 0xe9de34e3, 0x53f3e4c7,
+       0xf90af9fc, 0x7f5e2bfc, 0xea2f8e50, 0x2f9e6b0f, 0x827f3cd1, 0xf89f5bd7,
+       0xf68bd8aa, 0xda4e68eb, 0x921423a5, 0x37214657, 0x12b6974a, 0xbb754b9c,
+       0xb59a3978, 0xdc2ff2ea, 0xdb8a64ef, 0xf7809298, 0x50588fce, 0xd533ff0f,
+       0x7e814c65, 0xfe79269f, 0x499ce586, 0x7288d78a, 0xe91f3df7, 0xf21e9285,
+       0xae428d27, 0xa6e5ea9f, 0x831ea5f7, 0xf1c3de71, 0xbb9c752f, 0xe4f9c743,
+       0x4d738cc7, 0x4738c86a, 0xfebecc7f, 0x24e1ca9c, 0x517691c7, 0xe94bba71,
+       0x663afc85, 0x70bf9064, 0x18cebdee, 0xcc314bf4, 0xcfd00377, 0x919cda5d,
+       0x7dcfe307, 0x0a8cc5ee, 0xbe849bb4, 0x32a739af, 0xdaa3c817, 0x5f950a73,
+       0xc4647db4, 0xdb35b37b, 0xa0e38cda, 0x45942d5f, 0x12aaeb01, 0xa77d04eb,
+       0xa7a01c9f, 0x4274bd8d, 0xf3cc3c6e, 0xa13b9e32, 0xd5ce7c47, 0x3dfd1f35,
+       0x4a11efea, 0x97f2f8d8, 0x7b077f62, 0xee611fb8, 0x6151e5c5, 0xee34576f,
+       0x390614f3, 0xfaa2fc60, 0xbf02f9f0, 0x1528eb12, 0x50fa6ffa, 0xe003844b,
+       0x1e3de43c, 0x9b58af5f, 0x62fe8b99, 0x04e8f263, 0x7e8f5b82, 0x67ee2ed6,
+       0xd67ee16d, 0x02c77b52, 0xbb994efc, 0xf883ec57, 0xbf09b2dd, 0x2c067c93,
+       0x378eef0b, 0x89bf7ac9, 0x3f714663, 0x7ef3d618, 0xf220f99f, 0x6e28decd,
+       0x361b4ecf, 0x43e50a30, 0xceb46667, 0x4facfc06, 0x4af7732a, 0xc6abf6c0,
+       0xc9a17b61, 0xe08ca7d2, 0xf42e88cb, 0xb8feee49, 0xfe8fec4e, 0x35b18f11,
+       0x87d806e1, 0xee950de7, 0x45067803, 0xcbc5c27b, 0xe5c5ef2f, 0x8d97bbb9,
+       0x0757b1e0, 0xaff5cceb, 0x760fce43, 0x180e82fd, 0x94d2c8ef, 0x30380fc1,
+       0x5d78531e, 0xfcff04af, 0xa33c92b3, 0xa23fe702, 0x68f07d63, 0x18ebb171,
+       0x1d71f02e, 0xf74a06c2, 0x80b7a028, 0x31e4def3, 0xa9f541d1, 0x15cc71c5,
+       0x9a9dbfe8, 0xb1bf541a, 0xffa83b34, 0x07fa33cd, 0xea689f3d, 0xb00bafc8,
+       0x97b67b67, 0x5a9f04bc, 0xed0a258b, 0xbe5a4fba, 0xb416e0f9, 0x4eaa3703,
+       0xef6759b4, 0x48c1f4dc, 0xf00675e8, 0x497e471b, 0x3ed1f907, 0x7a747997,
+       0x7e303e97, 0x50758a74, 0xd73ca2be, 0x68dc6c5e, 0xf29dadae, 0x78ae7f09,
+       0xe25ebcd1, 0x72cb9bfc, 0xa99e3f51, 0x79fc9f7b, 0xcfbe6635, 0xe21e2f53,
+       0xbd442ddf, 0x357f7402, 0xe2f688be, 0xc0fc1039, 0x0e3b45ff, 0x86cd9c51,
+       0xf7b44dc1, 0xf1e9e6d3, 0x942d64fe, 0x81c65fa8, 0xba018adc, 0x036368e9,
+       0x48de61b7, 0xe5db85a6, 0xbf90a6e7, 0xf7146f7c, 0x8c4decfb, 0xcc48efa5,
+       0xda86b86d, 0xd345ce6b, 0x1da96ff8, 0xfa2f28e3, 0x13e28505, 0x2da75313,
+       0x8decfdc5, 0x1db80ef2, 0xe7f89de6, 0xdc23c7ab, 0x7bf1b66a, 0x77d51302,
+       0x5941e7f2, 0xbd0d78d5, 0x7b65513f, 0x621fb015, 0xe342ddce, 0x001b444e,
+       0xcb50eaea, 0x5597a803, 0x3f9f6b63, 0x5a31bca0, 0x9ed4de48, 0x26f7a48b,
+       0xfdfd7114, 0x0c4f217b, 0x635d7c9d, 0xe7a24dcf, 0xbd7c2e92, 0xf7f282b2,
+       0xf51b090d, 0x4321bdf8, 0xaffd42a7, 0x4a9fd73d, 0xfa37dfb9, 0x2fbe91fd,
+       0x7af84860, 0xbe8de61c, 0xc8d8af11, 0xe3c8d12c, 0x62c375b3, 0xd5791858,
+       0x9e39cf3d, 0xc73a6c6f, 0x3bff8ff3, 0xe417f5cd, 0x9d4592c3, 0x31178c7a,
+       0xe10d8473, 0xd8305255, 0x67c01151, 0x8c9baeea, 0xeac31f88, 0xafa88db7,
+       0x0516504d, 0xf916af3c, 0xdd795a58, 0xfc83e422, 0x3fd49b8e, 0xd106792c,
+       0x4136ade7, 0x9e8f82a0, 0xdf2c7c16, 0x0e33a0ef, 0xf73b71e0, 0x79a6b7f3,
+       0xd13942de, 0x7c6ec851, 0x4767e49e, 0x7e69c606, 0x9e03f5ae, 0x1bb21423,
+       0xbeaf293b, 0xc3a1c0a4, 0xdd7bc0f8, 0xf3f3877a, 0x26d1f685, 0xca96fdf6,
+       0x6fb8e216, 0x1d97f2fd, 0xedaf182e, 0xd43cbcee, 0xcfde720b, 0x0b7bf17a,
+       0x1e75d6cc, 0x2fb587cf, 0xef903b47, 0x0ce1e227, 0x4d3ba2e3, 0x76816e74,
+       0xbed4778a, 0xef0a7a6c, 0xe15ad5bb, 0x17f30afc, 0x8ad912bd, 0x4af6dc74,
+       0xc7f51ea4, 0x9f3dbd1d, 0x5e8a7c21, 0xcf063be9, 0x9316ae8b, 0xe3fd919e,
+       0xb6f24a3a, 0x485ef587, 0x4ce9697e, 0x81a7a7f2, 0xa0994bf3, 0x7fc172d3,
+       0x6747c11e, 0x0f8892eb, 0x45822ecf, 0x91753c63, 0xda1b7032, 0x7d0b0e0b,
+       0xe5f24e97, 0x411f3c44, 0xb1fec4fb, 0xeaa18f74, 0x1f106c5c, 0x14cb9f56,
+       0xed471dfc, 0x05cadf92, 0x7d84989f, 0xb5d04331, 0x3f245bb4, 0x624f74b2,
+       0x6263ec2a, 0x95bdf03d, 0xc8f9fee2, 0x31ba7e4f, 0x80be90da, 0x022b926e,
+       0xedbea7f8, 0x8a768626, 0x744dde29, 0x40ca0333, 0xb766653b, 0x971b629d,
+       0x592feb08, 0x7bc3a996, 0x6a79f29b, 0x7fd1a5ea, 0x27c8aa44, 0xa0e6b730,
+       0x8ba86b5d, 0x9a7de274, 0x1e3cf133, 0x87057f34, 0xbb837ce3, 0xf98ced08,
+       0x3fe4284f, 0xe503fb43, 0x7503d0d2, 0xcabf40c6, 0x5106e74d, 0xb9ca7d3c,
+       0x2634a8cb, 0x38472e7b, 0x5ebb9d94, 0x8fd06be0, 0x710e3f8a, 0xc192bf71,
+       0xc86e7267, 0x4792bf44, 0x4f1f3c45, 0x0347b667, 0x546b7de3, 0xb8c98ff2,
+       0x9933f4a4, 0x804fdef0, 0xdf46fd3e, 0xa3df4198, 0x0a9dfad1, 0xb93ffeb9,
+       0xbffa40d1, 0xa19dedaa, 0x79fe783a, 0xf5092ba6, 0xa7837ac9, 0x6733f708,
+       0x0339efb2, 0xb83ee7d4, 0xe1dc3ad5, 0xbeb36787, 0x69f50735, 0xfd11c033,
+       0xd52bcd5f, 0xf76e3ef1, 0x1a38f344, 0xcf496fa7, 0x739f3a5a, 0x73e09b2e,
+       0x7a44ceb6, 0x2dd02ce8, 0x5243d00b, 0x2f3948ef, 0xeba48ff5, 0x5f973d6a,
+       0xca18e6d5, 0x9debf323, 0xa442ee49, 0x1f3c7ebb, 0x9e77afd0, 0xf902355a,
+       0xe53c74e0, 0x21bd4b5d, 0xc585e0f9, 0x244794c9, 0x03e492f5, 0x7ca5cf29,
+       0xf52f7497, 0xfd3fe8d6, 0xc3bfd6ef, 0x3cd293af, 0x7d02a577, 0xfae7ab5d,
+       0x85bd5aeb, 0xfc6c67e8, 0xcdd23d24, 0x43d1cbc5, 0x0a1e8e42, 0x3d35a392,
+       0xa94581e8, 0x1c5e7e52, 0x7c11cc1f, 0xedc4de33, 0x81f39448, 0x8da6b5e3,
+       0xb1f7087e, 0xd9eb953a, 0x3ddd6b9f, 0xa9d5ffc9, 0x97ff2697, 0xfc9c5ea4,
+       0xfe54efff, 0xbcad0a9d, 0xa3710fc7, 0xf3bd3fbc, 0x83ea1f72, 0x03f40c83,
+       0x6896c1ea, 0x0fa126c7, 0xc5445f48, 0x1f487ef8, 0xfe9ef614, 0xf5e1a9df,
+       0xff6c66c1, 0xd240fab1, 0xc91be497, 0xb42f9227, 0x62f9247c, 0xbce16fc2,
+       0x8b7a7888, 0xd6aa8fdf, 0x0e289b7b, 0x8c1e88e9, 0xc76dd9fc, 0xdf88536d,
+       0xe084f442, 0x04bf3f1f, 0x1fc90deb, 0xff245f92, 0x98fe0b54, 0xf243f829,
+       0xf9b56ec5, 0x0a9811d1, 0x08f9e690, 0x93e488e5, 0xfab5e7aa, 0x42ba47a1,
+       0x199b234f, 0xae90c75f, 0xa40ca1aa, 0xfc0f532b, 0xf512f070, 0xa48bbec2,
+       0xf3feafa7, 0x0f55f4f4, 0xa7e674f4, 0x1da853d0, 0x03be61fb, 0x1f3673d6,
+       0x9fa66de4, 0x8dfc26de, 0x9b21fb71, 0x46f6079f, 0x35ee7df1, 0x67ff93a6,
+       0xcf3cf7c2, 0x3303da57, 0xd241bf85, 0x01d81e69, 0xf8fc4369, 0xbcc0f3c7,
+       0x847b938b, 0x877c5367, 0x3327cf11, 0x03b40ca1, 0x537fb27a, 0xee4d2ed3,
+       0x17fe8a45, 0xb480f3c2, 0x1c6edd9f, 0xaf1e1690, 0x027ed303, 0xa262275e,
+       0xb22bf92a, 0x00a35c4b, 0xba890f3f, 0xc2094fb7, 0xf902faf1, 0x2e55b2fc,
+       0xd607ca3d, 0xf475ddfd, 0xcaa5bc77, 0x31fece7a, 0x8f099eb0, 0x1d1fbf32,
+       0x151d8f9e, 0x511fedd3, 0x717fbf98, 0x95fed65a, 0x451be7a4, 0x9ea74ade,
+       0x3d4483c7, 0x8096ea1f, 0xbea6817a, 0xeab7f796, 0x3e60593b, 0x928dd209,
+       0x0eecf1cb, 0xfa601fb0, 0x2fa8b3f6, 0xff430a6c, 0x86fc6d46, 0x5ca2cf57,
+       0x6c50a1db, 0xde0e1baa, 0xfa070481, 0x07d5383e, 0xc65d77ef, 0x78dbcdd8,
+       0x43b5f6fd, 0x132f7956, 0x1bdc06e3, 0x2e2b3432, 0x502847ca, 0xa199597c,
+       0x4d3dbef0, 0x1eb913ca, 0x0214f746, 0xaf9867de, 0x77ef2977, 0xd1674de7,
+       0x4ba6adfb, 0x5186ff98, 0xac6fefe1, 0xe4c6fd10, 0xfe7d84c7, 0xe1ca9a70,
+       0x3406fc2f, 0x694d343f, 0xff9f7f0e, 0x1d2fc109, 0x78213f18, 0xfe855a4e,
+       0x84a30eed, 0xc2157bb7, 0x41632c7b, 0x9f98347e, 0xbad71bea, 0x7cf41a4b,
+       0xbc0d2ebb, 0x77bf687e, 0x03db05a5, 0x5f069bf4, 0xf7801fa6, 0x77de61dd,
+       0xfadfbf04, 0x125af843, 0xdba0bef2, 0x5d8e9259, 0xa31ef441, 0xc67d1377,
+       0xb4362bc4, 0x91dc6ba3, 0xe0bcf12b, 0x12d2cfe7, 0x138c9b82, 0xb4dff084,
+       0xc8033192, 0x6fcf124e, 0xebfc855b, 0xe7f775d6, 0x1ae928fc, 0x5c0136af,
+       0xef07f5c9, 0xeb769cbf, 0x024ff42a, 0xaa73d05d, 0xadd603eb, 0x4d66c7e5,
+       0x7f86947d, 0xfc91ff05, 0x70007d40, 0x16f941ca, 0x08e8c87f, 0x044f93a0,
+       0x7c894e9c, 0xdcd18ef2, 0xe2c8ec9e, 0x3c6977e5, 0xa099f52e, 0x9e9253cb,
+       0x90e002a2, 0xf43f4416, 0xf60221f7, 0x29ba704d, 0xbdf3f25e, 0xbfc0c525,
+       0xfcfe761d, 0x66fed67f, 0x5fcd3795, 0xcff78ed7, 0x2096f7b5, 0xf7c7ba5c,
+       0x768fda2e, 0x6e024dc4, 0x67bdaddf, 0xc08077bf, 0xbbffa273, 0xf41f40ab,
+       0xa46a9e3d, 0x3e94250f, 0x2fa50d5e, 0xfa7de6af, 0xbd3d043b, 0x7950b7ff,
+       0xcfbcd2e0, 0x17107bf0, 0x5bc0beff, 0xe3af06b1, 0xa31d7835, 0xbaca97a9,
+       0x4afe482f, 0xe3be5cb9, 0xe312fbe1, 0xd0a9afd1, 0x3d3f2475, 0x3cf4483f,
+       0x77e926d7, 0x4fd5c115, 0x47ed0fcf, 0x2cdc9dfa, 0xf491b5e9, 0xc39424cf,
+       0x29f5fc23, 0xfea88728, 0xc5c60970, 0x91eafafc, 0x6fb72855, 0x1ffd9068,
+       0x2f37fea5, 0xa6ade393, 0x8c8f12e7, 0xeefa463d, 0xafa97ca6, 0x3fb9271e,
+       0xefbf85a7, 0xfeddff4c, 0x4687e41f, 0x6ad65c0d, 0xff4d5eea, 0x6fd017d5,
+       0x2fef34cb, 0xa95f3cd2, 0xd4d1afa9, 0x2fdf821b, 0x1f10a19b, 0x38f01596,
+       0xb52f96a5, 0xef4ae1f4, 0xf5ba73b6, 0xfb2662b9, 0x26af882e, 0xb5faf3d4,
+       0x1a4b1be9, 0x75f501cc, 0x5f384a9b, 0xf7016cc0, 0x7ae6419f, 0x4307a055,
+       0x20b3720f, 0xd9b907bd, 0xf9efab4f, 0xafe07ff3, 0x0a371429, 0xab764bb2,
+       0x5536f5c1, 0x75bbdbac, 0x810182ff, 0x4be7d5f1, 0x63dd5cf0, 0x5cdbc71c,
+       0x2ed02632, 0xae25cd62, 0xfeca7d80, 0x5efbbee3, 0xeb3cf9c5, 0xd1b25cfe,
+       0x114f718c, 0x12f3b4df, 0xfa8aa5f4, 0x6ff856ba, 0x2f1e61c6, 0x5aa293c6,
+       0x080fe673, 0xee6b27d8, 0xbb6cfb83, 0xb7dfe55b, 0x00fc07ab, 0x8398ca9c,
+       0x33a750f2, 0xb6a5e517, 0xfc2cc4c5, 0xf76f782f, 0xd442eadd, 0xc61707d3,
+       0x2bd35e51, 0xb17cfce9, 0xe277a63b, 0x45b7a84c, 0xb6f246df, 0x54b1feed,
+       0xcb5d52ee, 0x2d8c6cbb, 0x894af75e, 0x1e7c72f9, 0x3bba7043, 0x2592a5fd,
+       0xa6f7ef40, 0x8f7de83b, 0x03b896dd, 0x0c07eded, 0x0e043714, 0xe7e89278,
+       0x3c60d341, 0xe92d976f, 0xf2b1714f, 0xc38d26c7, 0xf7e5a47b, 0xd25e2819,
+       0x9f91b3a9, 0x58c0f3c8, 0xb19a93ca, 0xabde944c, 0xdfe57ca9, 0x7bc7ac7f,
+       0x14eb5da6, 0x55cd4efa, 0x6dff375f, 0x1b2bd410, 0xc67ee9b2, 0x9474e7cb,
+       0x9ae9fe17, 0x53cc3ebe, 0x47591c3e, 0x9fd0a5f9, 0x9e56bbee, 0xc92fec77,
+       0x0daafec7, 0x428e3853, 0x47cfda3b, 0xe14fa857, 0xab32ce3d, 0xbbf30a25,
+       0xc8c77e8f, 0x3ef473af, 0xe6ef7d13, 0xd6e7b353, 0x8f74f135, 0x767d2d09,
+       0x15587154, 0xf4dac380, 0x29c925fd, 0xf8126ed8, 0x032d6fdc, 0x75d32f3e,
+       0x93e90fd3, 0x5f5e588a, 0x92cdeebb, 0xa38fb04d, 0x7ca5f44f, 0xd70c84b1,
+       0xd78074ba, 0x93d70ce1, 0xd9fb8a54, 0xc79bfcaf, 0x593a5f25, 0xb5f4889e,
+       0xcbf5d059, 0x0313cae7, 0xc5416eff, 0xc1d13d29, 0x02c7462b, 0x5469eefa,
+       0x6ce782ba, 0xf43883a0, 0xe710cf9b, 0x85e7a016, 0x57d8c35b, 0x3db9d34b,
+       0x84dbf6d6, 0xba208e51, 0x29e498fe, 0xfea0379d, 0xa447fa62, 0x16988ee7,
+       0x77752e62, 0x1ddb243e, 0x34327049, 0x3322fa45, 0x1aea7fd1, 0x4ff3a2e7,
+       0x96c99f73, 0xfd143e00, 0xfcf2f13f, 0x3fa04fdf, 0xf13efb9e, 0x604b3ffe,
+       0xaff6433c, 0x68bc5ab4, 0x58b31c5c, 0x838f88f4, 0x3147c5fa, 0x9d62ad3f,
+       0xc540f481, 0x5d4584ba, 0x6e807f28, 0xdda6bfd0, 0xc0c32997, 0xc63d18fd,
+       0x192f3f57, 0x5e781693, 0xbbf24139, 0x377cbe27, 0xc6c944fd, 0x65f33d01,
+       0xa7cb8da5, 0xf7f8eb71, 0x58872b75, 0x7bbf74f4, 0xe89babdd, 0xc8bcf01e,
+       0x5157bc5c, 0xf844ceb9, 0xbc58b4ea, 0xbef12bb6, 0x0b1f4581, 0xae74a1e5,
+       0x0e19f54f, 0xca9147c2, 0x54b911f4, 0x190a3dd2, 0xf0b13c3f, 0x1d31c7d1,
+       0xbbe673f3, 0xefc0187e, 0xe9d38b8c, 0xf92a6d99, 0xc4f1b51f, 0x1ab7d7ea,
+       0x888fd90b, 0x4710f627, 0xe29d62ac, 0xe3e1e2bb, 0xe238da89, 0xbdc5d2bf,
+       0xa238eeb3, 0x5187be81, 0x4588e229, 0x7f5a156b, 0xbdfe42e5, 0xee38a292,
+       0x18b23e3f, 0xed2fa0e8, 0xc5cb6bdf, 0x7fae693c, 0x8be2992a, 0x5eaf5f80,
+       0x99fc8f3b, 0x5e1ce975, 0xb03be265, 0x199d2387, 0x58afde78, 0xae704917,
+       0x07f6727c, 0x7de3e44f, 0x81f189c0, 0xa09b6be7, 0xe19f180f, 0xce39683d,
+       0xd0f725b1, 0xd68b6777, 0xf31939c3, 0x73d963b4, 0xde226537, 0xde303252,
+       0x2e55fb29, 0xef0fbbbd, 0xd86ce707, 0x950ad977, 0xbb6b0f7f, 0xf021f489,
+       0xb80b327c, 0xd9633e2f, 0xd72346eb, 0xa8792c67, 0xfe1db3b0, 0xc29f6cfb,
+       0x4104fc73, 0x26b7b8ad, 0x5bef27e1, 0xf7f8e995, 0x0a754b36, 0x8902c3dd,
+       0x7e97f746, 0xa3fdc191, 0xcedc1979, 0xd270cb2d, 0x55ea9e3d, 0x4cd2e726,
+       0xbdf74e3e, 0x55e73875, 0x282a3aeb, 0x1317f9ae, 0x976a57f9, 0xad22ba45,
+       0xf9e31f3c, 0xad779401, 0xaa3c0237, 0xfc6e5c1c, 0xad63d042, 0x94d5d263,
+       0x0767ae9f, 0x5607eff0, 0xac9cb85b, 0x9bb8058e, 0x86e90139, 0x1939f7e2,
+       0xb8e253e5, 0xe6028329, 0x8c3b4457, 0xc7fab0e3, 0x0d63abdd, 0xfec1a7e8,
+       0x38420f97, 0x237f5dc6, 0x9559efae, 0xb4801af8, 0xbfed00aa, 0x3c3cd567,
+       0xd8ad9777, 0xf0e50e3d, 0xf1832ddc, 0x7b2b0546, 0x23d25dee, 0x3bfe0573,
+       0x395a3e45, 0x81bbf1d4, 0xb9706437, 0xdfb951e9, 0x2f0106e8, 0x79f20749,
+       0xf7030af5, 0x47bc83e3, 0xe4bd5301, 0xdab71a43, 0x728891d2, 0x81bb7ab8,
+       0x8cdf87ee, 0x973806eb, 0x751f492f, 0xdcaae800, 0x51df4310, 0x344ef2ad,
+       0x51aabd62, 0xbdffbaa1, 0xd3a40c84, 0x60bd962f, 0x1c39fa45, 0xfa839ad9,
+       0xa45e6ba9, 0xda29ee93, 0x8beedfb8, 0xaf743965, 0xc3ad8669, 0x9965df82,
+       0x8edb20b1, 0xada0fc72, 0x0fcf88d5, 0xb0ea6736, 0x46d9b2ee, 0xbfa5dd61,
+       0x885fea92, 0x41fa177c, 0x9e3852ba, 0x1b769aab, 0xdd2feff1, 0xd4e2e82b,
+       0x41f6efb3, 0x4675503f, 0x2fd41f47, 0x527d0740, 0x28cfce11, 0x9a6b9fa4,
+       0xa4bc1e78, 0x03a41a83, 0x8239bbe0, 0xbdb66a0e, 0x43f21770, 0x373fe20d,
+       0x9e808e94, 0xf9fda9db, 0x7f18e30d, 0x44e91dbf, 0x2fa833ea, 0xce3fa033,
+       0x058bebc8, 0x0c7da1fe, 0xe00ef76f, 0xf9dd75f9, 0xd07c4108, 0x66d77e13,
+       0x4c3e04e8, 0x8ad77724, 0xd8ae76fd, 0x9dfc456e, 0x1ef7767a, 0x3f54b78c,
+       0x11dada0f, 0x3c041f86, 0x56ff716a, 0x19d93f5a, 0xab5fb8b5, 0x74ddff7f,
+       0x96b0f82f, 0xfdc9fdf1, 0xfec5ead6, 0xfef173e5, 0x2acfb13a, 0xadb5e026,
+       0xc13be72f, 0xf4c7c867, 0x3fb121dd, 0xbbf83d8f, 0xfec5bbba, 0x6cc9449a,
+       0x0f8456cd, 0x0fe517e2, 0x28cb8fd0, 0x397409e5, 0xe50365b5, 0xc97c4bf7,
+       0xd7efbff5, 0x93fc2e2b, 0x9d8f1254, 0xb6f77c3d, 0xa1c9f045, 0x763292fb,
+       0xd8befc00, 0x240d9f4c, 0xcc07d57a, 0xce46e927, 0x49a7f457, 0x61bee2d7,
+       0x5f1c56fc, 0x1bd07bce, 0x0e71c7ad, 0x721fce32, 0x8b2f92fd, 0x3b5da7ea,
+       0x4efd8ad8, 0x5ed1b259, 0x3f7c7811, 0xbbef46c3, 0xf7806ed0, 0xf2143b5d,
+       0xe7121f5f, 0xbdf743fd, 0xe01f2d60, 0xc577f7a7, 0xe19d25ba, 0xe4c9fa0f,
+       0xb9daf77a, 0x6ebb583f, 0xbae48729, 0xe1bfee8b, 0xeb976c5a, 0x2051f8c7,
+       0x4a384a9d, 0xfaf7957a, 0x344b74b4, 0xdaaaf527, 0xa6d77d33, 0x9dfca21d,
+       0x78ed7690, 0x2c3a3ec2, 0x9ebbcdf2, 0xe77df956, 0x41edc965, 0x33188ef7,
+       0x259fea07, 0x15b6aef3, 0x49b73c62, 0x521e7ba1, 0x4acfc0af, 0x923e807d,
+       0xdef0c1f6, 0x36a57f3c, 0xf10275de, 0x63bc7559, 0x44927e1c, 0x7d57a5da,
+       0xa0c6aadd, 0xcf1b6aff, 0x53749383, 0xf89db275, 0x93dc5aa1, 0xeef15b2a,
+       0xf74861c4, 0xce281b4f, 0x58df7653, 0xb3fbda23, 0x8a1f4d37, 0x127bc0e0,
+       0x6c4fdf28, 0xe047921c, 0xebc4b661, 0xc6c4bef1, 0xbfc7af47, 0x87633a5f,
+       0xc1a1df4a, 0xcb8f9071, 0x7f23c8ee, 0xcec8e1eb, 0xaed02389, 0x436ab5ff,
+       0xa6e47ebb, 0xffb08b21, 0x58ef4b48, 0xc6d078fa, 0xf4bbaa38, 0xa427a431,
+       0x03f32c1d, 0x90bdc5eb, 0xaf9cdeec, 0x8a97757a, 0xefac0bc8, 0xaef9f183,
+       0xddf4910d, 0xa3a352a8, 0xdbe715b9, 0x8ee74499, 0x2526385a, 0x2b9ee9db,
+       0x8cb369d9, 0x9725222c, 0x453023da, 0xc74375f9, 0x5e4fa81d, 0x1832c3bf,
+       0xd4cb8bbf, 0xb9cb43f3, 0x90e3cd7d, 0x61dfc171, 0xeac8eb92, 0x3b57e9cd,
+       0x2f7f7c9e, 0x74ec2b9e, 0x3fde919f, 0xebe9ecb1, 0xd89e1f51, 0x7dc7639c,
+       0x4919db1f, 0x198e0bf7, 0x78e7bf82, 0xb4c2f7a9, 0x3de4a9f7, 0xc1defcd7,
+       0xfba49cf6, 0xb9cbde0b, 0x98f2d2ec, 0x74662e4e, 0x065cfc4f, 0xe8e4fee3,
+       0x7e62b6ef, 0xc9a34561, 0x8e64f786, 0x7c63fd20, 0xdf4abb6b, 0xdfbba201,
+       0xdb23af80, 0x703ee8f3, 0x5ebcc7c5, 0xf0f8acd1, 0xc3fb72fe, 0xc2fe53f7,
+       0xf137b04c, 0x3db7796a, 0xebe1fabd, 0x38ce0d91, 0x3bf1cb3d, 0xf3366700,
+       0xef908b7c, 0x75bebc3a, 0xffe38a4f, 0xfd2cfdbf, 0x077bd313, 0xf09347df,
+       0x57aae796, 0x720a2e80, 0x72fbf0fd, 0x9fb22cf1, 0x50f62e4f, 0xb4395a79,
+       0xb3d2246a, 0x15ee8625, 0x51e3b4bc, 0x5373bf15, 0x79f06dbd, 0x308f1f3c,
+       0x9ff7d0c7, 0x90bc5cbe, 0x17279a82, 0x8a3f89d7, 0x15f854b6, 0xb55e547c,
+       0xfbde8dad, 0x0b5e4772, 0xd97debde, 0x9ac5c31c, 0x3be820ab, 0x3dbf1299,
+       0xfb9657dd, 0x1cd7fcfa, 0x9fdd72cf, 0xc56e9e6f, 0x21fdb57d, 0xe23865ae,
+       0x86c63a37, 0xc8a56076, 0x86ba392f, 0x23c7d9db, 0x18abfe62, 0xed7c7cf0,
+       0x0efc4494, 0xa9b6ccd1, 0xc57b63d7, 0xe786c54e, 0x49cee703, 0x7dcf3c56,
+       0xe2b4efa6, 0xd6cfaa3d, 0x3e57fbc8, 0x237bbbfa, 0xd829b3c6, 0x9eab447f,
+       0x84293239, 0xfc32f44c, 0xcbee9ea4, 0xe4ed017e, 0x451f393f, 0x89f813fe,
+       0x99927cc3, 0x4bbf722f, 0x9c57f9f7, 0x7d8a46ff, 0xcbb6f7b7, 0x17b506f8,
+       0x63f6f015, 0xd096b76b, 0x68de4fdf, 0xbfbae1b0, 0xf1a068dc, 0x4db9c0e7,
+       0xbe3deb07, 0xb0839f99, 0x13e8e78e, 0x6779f99b, 0xef3f334e, 0xb833cf54,
+       0x60d2fdf8, 0xe80a2cba, 0xeb2ddf47, 0x7323bbe1, 0x737f7c5c, 0x7ee27f40,
+       0xb1bf442f, 0x9fee99ac, 0xa93e6a5d, 0xaaff7e96, 0x74dd1791, 0x08bd13db,
+       0x23ff22b8, 0x98ba4add, 0xf5c786b3, 0x0b83cded, 0x9d24fe91, 0x5803bf68,
+       0x3bfc646f, 0xfa28bab2, 0xb324f7ee, 0x62fa80c3, 0x18e77c4a, 0x075f4f04,
+       0x916aaf97, 0xe4f785ce, 0xec29bd58, 0x15dec477, 0xbc1a78f2, 0x7abbf74b,
+       0xcff7f8db, 0x59317dc4, 0x474abe82, 0xda293e7d, 0xba038dfe, 0xf2ffae74,
+       0xf5d03d3a, 0x3bf691a4, 0xd7809db2, 0x7af35ff5, 0x167b7d9e, 0x7def3fd4,
+       0xec3d3af6, 0xf695d26f, 0x2fa80621, 0x75cdf259, 0xc9b9e063, 0x3bd83ae1,
+       0x9b139e60, 0x7f71d292, 0xdb087ed0, 0x8e7a27a7, 0xee2b5960, 0xba569d8f,
+       0xf4cc2d06, 0xa77b7ff7, 0x0e4be0e5, 0xc0d3bd7f, 0xa73bbbe8, 0x87f5cb7b,
+       0xd70e9d2f, 0xa109dea9, 0xdd8ce5ed, 0x5e7cf947, 0x7e076f7e, 0x788911dc,
+       0x5dd38aaf, 0xd3c7bcb9, 0xe3c7b9a0, 0xe4d5f7e4, 0x7f792afd, 0xfdff72ea,
+       0x7297b5b3, 0x00ffecff, 0x4fb2f369, 0x00008000, 0x00088b1f, 0x00000000,
+       0x7de5ff00, 0x5554740b, 0x55b9e896, 0x2a493eb7, 0x54842549, 0xaa84a925,
+       0xc0902b7c, 0x310c7c25, 0x0403e548, 0x6a285888, 0xa205a0d4, 0x01148280,
+       0x55f4741d, 0x9a7c3061, 0x179f8ee9, 0x102d4622, 0xdd787195, 0x866db1d1,
+       0x3220538f, 0xb40e9afc, 0xd38ceb63, 0x68d1d01d, 0x38311b63, 0x6f360cf4,
+       0x4dce7def, 0x802a56ea, 0x6f7be7be, 0xf65e97ad, 0xee739f61, 0xffb3ecf9,
+       0x5f5bdf67, 0xa5eb2c19, 0x0f24c664, 0xa153ab63, 0x63595a74, 0xff7b9419,
+       0x68d2cfe9, 0xac839ac6, 0xc18f2e3b, 0xd3f5a35f, 0x7ccf5051, 0x2e504bba,
+       0xcd1a484b, 0x139960c6, 0x996fd062, 0x12aeb189, 0x6d3b26e8, 0x12d8c2cc,
+       0x019dfe09, 0x19caf9ff, 0x956c674b, 0x44edfe15, 0xf08742b8, 0x7f466683,
+       0x3f98059f, 0x1fd8c0df, 0x3925744f, 0x9d9d8cf5, 0xbb0c2e1d, 0xbc65fb18,
+       0x009ce6cf, 0x8ecd1ded, 0xbec634a6, 0xd4a4c37c, 0xd09eff43, 0x60f927df,
+       0xe67aa5fc, 0x6d9284ef, 0x24d8ce1f, 0xc3ea2f28, 0x61dfa053, 0x8db6f157,
+       0xa9cbbcf0, 0x3f9e0c63, 0xfce70aeb, 0x82c678f5, 0x32f2932e, 0x32777ea3,
+       0x9f1eeb80, 0x9dfb1c3e, 0xfe5d7d7d, 0x936eb03d, 0xec1258cc, 0x598c067b,
+       0x0030780e, 0x07c32fac, 0xb40e3442, 0xbea09307, 0x0e74f5c5, 0x2f307c23,
+       0x0dd8c89b, 0x06ebef8c, 0xf11fbc39, 0x196494c5, 0x6f9b37f7, 0x3283db0f,
+       0x3333a38c, 0x98bbae03, 0x4d3f5875, 0x8eb19800, 0x7f60c34b, 0x3263c066,
+       0x24c78096, 0xa1eaa6c6, 0xe9afac13, 0x0990fa97, 0x7884d7d6, 0x85d07014,
+       0xd72c7a23, 0xc58bf8c3, 0xbc8ecbbc, 0x58c1c46b, 0xeb07fe10, 0x5de62259,
+       0x3d7771dc, 0x9092cb9e, 0xc0b74ce1, 0x7ffa25f5, 0x72c79d0f, 0xf2feefd1,
+       0xe29c46ad, 0x7eda1dfe, 0xafa6d9cb, 0x52fcf0f5, 0xfdc46dd6, 0x6a8ceb2e,
+       0x0cf9a8ef, 0x977cbbd7, 0x99debeb6, 0xc2748698, 0x97b1b2c6, 0xe74d54f4,
+       0x99f448bd, 0xca746faa, 0x66e19fb8, 0x371304c5, 0xf4479f3d, 0xb00cdec2,
+       0x63ac7ec8, 0x8b4fd118, 0xb1e74f4b, 0x9cc49764, 0x7ebb18e3, 0x42731657,
+       0x61aefd53, 0xc85d2654, 0x5fcffaa0, 0x57de3639, 0xd75e7032, 0xc6ab6abf,
+       0x6aff5df5, 0x3aea9511, 0x4e1d049a, 0x867497d5, 0x2ce71d61, 0x9b800eb0,
+       0x8162c08e, 0xd66e9a7e, 0x99e11887, 0x57bfb199, 0x596bc72c, 0x424fa5df,
+       0xfd8a0e58, 0x3a24974a, 0x1f3c6484, 0x433d61ef, 0x031e627a, 0x79993bb5,
+       0xa05ca5cd, 0x398ebb1b, 0x24dfe063, 0x19ce2fce, 0x81ee9ccf, 0xfc583976,
+       0x87584ab3, 0x0941ae61, 0x5c737b41, 0x33e436d2, 0xe574f416, 0xe20d73c3,
+       0x4e38aeb9, 0x54ee0937, 0x1d2af3cd, 0xadfa2adc, 0x18769a4b, 0xb3c1b2e9,
+       0x5121e888, 0xc7acd4c9, 0x406a5fa4, 0x67d5b9fa, 0x623ba4f8, 0x585fa21c,
+       0x295e0dc7, 0x7378fc84, 0x50ddb683, 0x44ad75f9, 0x8e47d425, 0xfbf6d5e7,
+       0xd003d229, 0x717e103b, 0x9c0c3d24, 0xc3a3c583, 0x1224f073, 0xb9cccbbd,
+       0x5be012b9, 0xee181b0e, 0xf7cf14df, 0x97310e79, 0x0f80fd86, 0x8875e260,
+       0x2e4fa817, 0xc537e2d7, 0xb0e7c5a3, 0x867e2d3a, 0xb7fbb57b, 0xda6ae435,
+       0x35237c33, 0xcb8b59ed, 0xbfb67034, 0xc47fd342, 0xec0d6aea, 0xf4d4ce0a,
+       0xa37f5bcf, 0xbd682e06, 0xa8bfd35d, 0xbda6817d, 0xa69f7438, 0x268ed47d,
+       0xf9da5c0d, 0x98ffa688, 0xda6b8f5d, 0x6a3786c7, 0x7e1dc7da, 0xe84f034a,
+       0x7fe9a2da, 0x34db07cd, 0x5fba93ed, 0xdb5fb4d3, 0x9e0686f3, 0xd35bbbdc,
+       0x0385ca7f, 0x1d8ab81a, 0x31aff4d3, 0x4f0356ff, 0xa6abfeb5, 0xc7fb74ff,
+       0xce19f69a, 0x67da6a3f, 0xd2d1bfb9, 0x93973c6b, 0xa5ff2bd7, 0x9359ee79,
+       0x5f50dfef, 0xdd954b34, 0xebf48641, 0x35ba3e24, 0x0184a74d, 0x972a83fe,
+       0x1c9e1d04, 0xc1392561, 0xb78e59f2, 0x32b0e914, 0x6e7c7c8c, 0xe0f24497,
+       0x28bd28ab, 0x91ebd1ff, 0x4afd9da0, 0x22765e52, 0xc45d41dd, 0x331e29fc,
+       0x39d62393, 0x81aaceac, 0x9aed7b87, 0xa706b6fe, 0xe7c33da6, 0x2d67b4d6,
+       0xb6703456, 0x7fd35cbf, 0x068f6ac4, 0x34eb0576, 0x7bd6f3fd, 0x6b417035,
+       0x517fa683, 0x5ed34fbb, 0x69ac5a1c, 0xafc3b51f, 0x573b4b81, 0xd98ffa6b,
+       0x8fb4d415, 0xb4d7af0d, 0xaadc3b8f, 0xb5742781, 0xf35ffa6b, 0x3ed34841,
+       0xa6877ba9, 0x4e9edafd, 0x77b93c0d, 0x94ffa697, 0x5c0d610b, 0xfa688ec5,
+       0x6a4f98d7, 0x0fd6a9e0, 0xdba7fd35, 0x67da6b4f, 0xb4d73f38, 0x2cd076ab,
+       0x7adad7f7, 0xaf5d1761, 0x7cf359fc, 0x90c3dab0, 0x486f823e, 0xd613b34a,
+       0x3fe102eb, 0x777ce49c, 0x28ed1e9c, 0x8c14182f, 0x41ad2901, 0x420c92fd,
+       0x480ae90c, 0xe2a6358c, 0x20ac4028, 0xc15549b7, 0x4f68c9f3, 0x73aa9000,
+       0x1fa0fcb9, 0xeb5ad813, 0x1bb266a7, 0xdf40971c, 0x29bfc25d, 0xa0944b83,
+       0x85ebaa9f, 0x4ea166f9, 0x726f3a02, 0x582e3cf9, 0xaf9d7dcf, 0x6862cb4f,
+       0x705b0427, 0x9307a01d, 0x9e6f41bb, 0x79776388, 0x378f064b, 0x89780cc3,
+       0x5c48ef98, 0x32cca3ab, 0xcc33fcf4, 0xff7fa967, 0xae3e06b8, 0x8a6bfb04,
+       0xa0a7ff18, 0xfbb065ee, 0x37c0035a, 0x153d8c05, 0x4cfc12b0, 0x5b704ec0,
+       0x7b6549c0, 0x96e54dc0, 0x1ded4280, 0x5f827281, 0x0e087808, 0xdca8ea05,
+       0xfd52f016, 0xc10340f6, 0x547c04af, 0xa62c08ee, 0x9f80b5f2, 0x560677da,
+       0x40f3fc13, 0xc0ceca90, 0x237faa7a, 0x9bf04ad0, 0xdf827681, 0xdca8840a,
+       0xe541d815, 0xb52740ee, 0x22ec0def, 0x9840edf8, 0x30e070e0, 0x5d0207c1,
+       0x7c0c1f04, 0x40a1f040, 0x03879537, 0x0d1e543d, 0xf1fb52f4, 0x078205c0,
+       0x576b4bce, 0x2e576133, 0xd2c07412, 0x2f793db8, 0x85f6523f, 0xbb462d8e,
+       0x43a09177, 0x87983543, 0xcc867740, 0x2ecd6dc2, 0x13a06a3c, 0x71c9d137,
+       0x96af2fb4, 0x4070d04e, 0x33560d7a, 0x5a9bd237, 0xc9e954b6, 0x90ae0cfe,
+       0xbb732f42, 0x336feb88, 0xb537f553, 0x85283e37, 0x079b9ed0, 0xf811b276,
+       0x9f6123e6, 0xe5c7147c, 0xc1bf39f5, 0xa35f768d, 0x66c0af14, 0xb277fe01,
+       0x8c2fe03b, 0x5ed77fa4, 0x9fb456d3, 0xc235f5d4, 0xe7183a38, 0x5a2eecbf,
+       0x6c3b2357, 0xbd40f5c0, 0x72fc0f47, 0xe2dbe6c6, 0x2fbeba02, 0x2234175b,
+       0x85425913, 0x8cc644de, 0x48f3df76, 0xf7fce7e7, 0x17c1c21c, 0x9c429559,
+       0x78537ae7, 0x7f30adf8, 0xb2bd11ef, 0x5e3439cd, 0x00ceb796, 0xf6997de1,
+       0xa0773fb7, 0x17f75f1d, 0xe1cf0fbd, 0x21b12184, 0xe9dd7404, 0x3acf8892,
+       0xd94d3a5d, 0x02fdf766, 0xa26df9d7, 0xa01d4eff, 0x56ebdbf2, 0xb612b2bc,
+       0x20a2b8d4, 0xf055ed19, 0x5f680c0f, 0x034e61cf, 0x989b87ca, 0xea1c5de7,
+       0xf823e666, 0x52a41656, 0xe176f9b6, 0x21636ebe, 0xa6157d82, 0x8afb589c,
+       0x383bd75e, 0x752c70d8, 0xdd90f29a, 0xfbc70077, 0xeb43d136, 0x7a69313a,
+       0x5d4bee21, 0x49c33997, 0xdeb366fd, 0xdf7d7017, 0x53fafbee, 0x9d306f29,
+       0x61f488fc, 0x3fb06981, 0x3779c233, 0x38e0ef03, 0x214b0fcd, 0x3e9573a4,
+       0xa74cc11a, 0x7a851ff1, 0x805e9229, 0x4b7fd04e, 0x9399cdeb, 0x4dd2f448,
+       0x3e926ff2, 0xfa7b0468, 0x28542e84, 0x8c4e89e9, 0x5173ac12, 0xee49d01a,
+       0xc0f0f4d0, 0xe423287a, 0x17d9d020, 0xfe9fde38, 0xe2371ae1, 0x93dbf96d,
+       0x66b7889c, 0xd0079c1d, 0x9ea8f073, 0x442604ec, 0xd2dafebb, 0xb207f910,
+       0xc529cca2, 0x7172e373, 0x7ead9ebf, 0x4ddc863d, 0x74f4e5c8, 0x0ba86ec2,
+       0xef9cb8d1, 0x2e7d76d5, 0x2e7d473f, 0x15a6df3f, 0xc3d52d9f, 0xf81c4ffa,
+       0x8d2ce8dc, 0x3fd58fb1, 0x823f2879, 0x3aef97ae, 0x7e83cd3d, 0xb92eeb17,
+       0xbea07131, 0xd2abcc50, 0xe898de91, 0x5c896adb, 0xc75d3f57, 0xa75d22e7,
+       0x11e75d00, 0x768a7f5d, 0x33936cf9, 0xbb2856f9, 0x28613501, 0xc95a2f7d,
+       0x14c05c7f, 0x2f32172a, 0x0c808b95, 0xc1bd8e90, 0xf7888d27, 0xd52758fb,
+       0x777e503f, 0xbdf5d23a, 0xd9f91f3a, 0xd517594b, 0xb5bd672f, 0xaf37b478,
+       0x1daef35f, 0xeb537d56, 0x44915393, 0x7fcd0c6f, 0xdb39cb17, 0x4e834fa5,
+       0x5cec93e2, 0xe4b747c0, 0xe613227f, 0xd5677dbf, 0x3f505913, 0x85cfcf5b,
+       0xa2e7e31d, 0x7de891ca, 0xe0145f03, 0x78a6dff3, 0xa4fa5f68, 0x345f0d3a,
+       0x123cce3e, 0xcfbbd38c, 0x8ae6da14, 0xfbf293e0, 0xf28590ff, 0x13bdee4c,
+       0xdbf97bcf, 0xef3c54a6, 0xfbd718fb, 0xaf8d4792, 0x119efaa8, 0xe2cfdfbd,
+       0x85f7ec15, 0xb22fefa0, 0x17f7d119, 0x658a3812, 0xcb287603, 0xf2cbd9f1,
+       0x72f6f406, 0x88d1cedd, 0x95ebd027, 0x7df70e78, 0xd632d9dc, 0x9420fa85,
+       0xe1887683, 0xecd29335, 0x7617e8d2, 0x8d850129, 0x7f3e219f, 0x198ee38a,
+       0xfca92ebc, 0xeed19fd0, 0xd0591930, 0xce7c465c, 0x677f2226, 0x9abf891a,
+       0x3879b511, 0xb7e9d78f, 0x84ff1e0c, 0xefe1ef58, 0x841d3fb8, 0xc52cbcfd,
+       0x2feb879a, 0x3cc0fc53, 0x19d24724, 0x2e4773cd, 0x3e7563e7, 0xa076e966,
+       0xc1347e9d, 0x8f9e3b77, 0xfd52471a, 0xcfaec3c8, 0x667cf1f2, 0xe5506c57,
+       0xaec78d33, 0x84e972e3, 0xf84419c1, 0x014b9544, 0x6f2fd609, 0xa7ff286f,
+       0x371d700f, 0x8c612d98, 0xc34ab077, 0x35ff7ed9, 0xdf1f4077, 0xcae3eaa0,
+       0x1a8ef8a8, 0x018a61f7, 0x3ecc57d7, 0xf141f152, 0x0e4e551d, 0xb1b0bfd2,
+       0x889fc42e, 0x79c7f597, 0xce3fb9fe, 0x8d79c3a3, 0xe6328e42, 0xf8237b77,
+       0xae00d6d4, 0x307fc68b, 0xff8d7cb3, 0xd9c0d560, 0xffa6bb7e, 0x4d4ed588,
+       0xd6e82bbb, 0x57ade7b4, 0x6b417034, 0x517fa6b9, 0x170347bb, 0xfd34ea87,
+       0x6af0ed47, 0x06ced2e0, 0xbb31ff4d, 0xb1f69a7c, 0xf69ac5e1, 0x1afd8771,
+       0x6ad74278, 0x3e6bff4d, 0x27da6a08, 0xb4d7af75, 0xaad3db5f, 0xb6f72781,
+       0xb94ffa6b, 0x57b4d210, 0xb4d5bfb1, 0xd75f98d7, 0xf1c62fc0, 0xeb54e778,
+       0x9b9e683f, 0x81afdf6e, 0xf1e7885f, 0x23ce199a, 0xf9c5e7da, 0x278b6f06,
+       0x3ee5987e, 0xffdf69a9, 0x8dcdc8c8, 0x47a12fc0, 0xb67fe474, 0xc53d71d5,
+       0x1d39aa1a, 0xd7bef1c4, 0xe66a1f2b, 0xbaf7d1cb, 0x7a9d8e90, 0x75f2266b,
+       0x039cf97e, 0xd0ac7640, 0xc51aa2b3, 0xc9eebb9d, 0xf48e5803, 0x6c8d5ebe,
+       0xf270d253, 0x7da39600, 0x1903575f, 0xca716533, 0xf996583b, 0x70d8d6c7,
+       0xbce7ab89, 0xe0c4e583, 0xb3941a8a, 0xb17e2660, 0x3e7dd608, 0x846d9238,
+       0xaa652575, 0xd10f5e71, 0x1d0caaed, 0xdbaaf9f1, 0x4b37142c, 0xa322d6bf,
+       0xe81cdf3e, 0xec10791a, 0xd3a7f4dc, 0x69dc62d7, 0xa1f9d83d, 0xc017b022,
+       0x59f2c7ee, 0xe043ebb0, 0xbb046d1c, 0x604dcb1f, 0x73fd63f7, 0x9c23f760,
+       0x7ad974fe, 0xc9d56e7c, 0x6172ea7b, 0xca0f11fc, 0xd7533456, 0x0e2b7539,
+       0x0fec7ac0, 0x4b28ad1a, 0xe267ae8c, 0xec8eb09c, 0x0a8eb065, 0x51078b42,
+       0x3052ecfd, 0x1c39321c, 0x2becfd07, 0x1db81a74, 0x2eb045ff, 0x97cf8b58,
+       0xaedee93e, 0xb6f9f630, 0x8a1937b3, 0x5d799f61, 0x014d6db7, 0xe6799738,
+       0xf1d3be02, 0x93fc602c, 0x09cd8f79, 0x97860c96, 0x48ff7a14, 0x2cee4972,
+       0x16b53e46, 0xeb81947d, 0x85fd50da, 0x3ce2b3a2, 0x0839cc8f, 0x787e7eeb,
+       0x23e758bc, 0xaff2aa73, 0x79cf5c66, 0xef50ef94, 0x47218cef, 0xffe853fe,
+       0x2f5c7993, 0xe5159fc3, 0x08938d93, 0x949d81b3, 0xf376f20c, 0xd1a7d5a4,
+       0x41ad90a7, 0xbb23e509, 0x144fcf08, 0x7823c828, 0x1e44fc4a, 0x537947b2,
+       0xe733e454, 0x1f3678c1, 0xf1914ed8, 0x785ac5b1, 0x19e79c33, 0x0c7ac0c3,
+       0x3282e977, 0x92f0c1ec, 0x9e605157, 0x5fb0798e, 0xb51b3780, 0x8e9165fe,
+       0x9f717d91, 0x378beeba, 0xdda76829, 0xf0f5c797, 0xecbb8096, 0x7ffa0313,
+       0x4027d94a, 0xfd8b9947, 0xabe40f92, 0x04abd1ad, 0xd2e19fa1, 0x2237efdf,
+       0x3ac5df61, 0xfd639f51, 0x27bb089a, 0xb86b8c47, 0x19bc27a4, 0x6a4abd9a,
+       0xbd06fcc4, 0x618cefe4, 0xc9e69577, 0x4666b9fc, 0x1e7786ed, 0x5f309c96,
+       0xba486366, 0x4bf1c687, 0xc2dbd40a, 0xb1ab3ebc, 0xf0085a53, 0x3a4e791d,
+       0xac9c7507, 0x08feb0c5, 0xa0e5d93c, 0xede78564, 0xc425068f, 0x55eadd83,
+       0xdae22258, 0x52bdfc4b, 0xf57db4f0, 0x864fb2c4, 0x8abdbae1, 0xa59be717,
+       0xcadf9bf2, 0x2b1f3d70, 0xbd42a9bf, 0xc33d1bf6, 0x9c6f8cfb, 0x8c5a724a,
+       0xa9a5a87d, 0x973ccf5b, 0x729267f1, 0x9e93f11e, 0x2ce2ddbc, 0xf17dfe00,
+       0xd6c34b36, 0x47767418, 0x75b3a71e, 0xe2deaa99, 0x73d749eb, 0xeafaa93c,
+       0x1fa72b1b, 0x4cad6e55, 0xce3ab0e1, 0x24f1ecca, 0x8f5a8637, 0xf98e3dad,
+       0x19bbd622, 0xfde2b1e6, 0xac2b77cc, 0x21f03788, 0xcc9f34bc, 0xe7d6e9e5,
+       0x4637e4dd, 0x3e20cfd3, 0x5c9bd100, 0x1dd97486, 0x31ba066a, 0x682a33cd,
+       0x5bfeda2f, 0x2472848b, 0x284ab593, 0xb5d96d47, 0xe7d46587, 0x1bd8afb2,
+       0x12be8ec3, 0xa9e7a83f, 0xcf8325da, 0x2abbf9cf, 0x0c0d43b2, 0xe5c9b6e9,
+       0xa9f9e1b4, 0x6474da74, 0xe22faa78, 0x3a0bd73c, 0x7aad672e, 0xd60ad3e4,
+       0xeb256549, 0xd63af2a2, 0x5987a54b, 0x99ab2c65, 0xf32d6542, 0xf98d3952,
+       0xad63aca9, 0x9d64ce54, 0x2eb3d654, 0xa3bfc12a, 0xe4accbd2, 0x7608de87,
+       0x9973960c, 0x985bca97, 0x482dca9f, 0xfef013df, 0xdbe095a1, 0xbb952759,
+       0x459dff80, 0x53311f18, 0x39e417b9, 0x3c836f96, 0xf20c32c7, 0xf8c269dc,
+       0x83ca9b88, 0x43ca8501, 0x0f2a7281, 0xefd43c07, 0xca8ea068, 0x952f01e3,
+       0x540d0227, 0xd47c0576, 0x316054ef, 0xfc05ef95, 0x581fbe54, 0x8107e54d,
+       0x12ff9520, 0x91654f58, 0xe20ae411, 0x163ddddb, 0x8f9c9afd, 0xe8271e8d,
+       0x84f34fa3, 0xfdd1ebff, 0x78f1e2f7, 0x83ba3a8e, 0x94aed5b1, 0x6e6d1e90,
+       0xe504279d, 0x74937746, 0x4eeb9437, 0x64d63b70, 0xd93b244b, 0x724abed6,
+       0xa4bbb8c2, 0x9c027d6e, 0x0fbcdeed, 0x4f4198e7, 0x6b65ed54, 0x7f841413,
+       0xe819a4ff, 0xdfc1ab70, 0x7fda15bb, 0xcebfd2f5, 0xaece8331, 0xc7f53c48,
+       0xed4c38d7, 0x66b20e93, 0xf207c02b, 0x26993f4e, 0x10a075f1, 0xc7d2fe3e,
+       0xe3e4d673, 0x791cb93a, 0x368e05d5, 0x5b0f19fa, 0xdb18cfc8, 0x0eac667e,
+       0x2dab49e0, 0x471fe865, 0xf5b8a3f4, 0xdba2fd50, 0x563ae7d5, 0x1e2337a4,
+       0xee0a7dd6, 0x65e51389, 0xcf8c58f7, 0xbbab8e45, 0xfe99f9ba, 0xf647f332,
+       0x5e332e93, 0x54e79151, 0x7403ffde, 0x86df4d1e, 0xaebf1f4b, 0x3598f8a3,
+       0xf6faf515, 0x7a772e14, 0xdb43e3b3, 0x53dbdd60, 0x9f21bc05, 0x610eb5f6,
+       0x8dbad7d8, 0x6fc764b9, 0x1d36f38f, 0xd1bff6c1, 0x69a0db29, 0x636fbc7b,
+       0x14f9c131, 0xea9759af, 0xca5ea377, 0xb1fae049, 0x9c48f1cd, 0xffff8233,
+       0xe6eee422, 0xadaebeca, 0xd7ad4fe8, 0x6e7802b1, 0x1b05fadb, 0x4bce30dc,
+       0x022ec09b, 0xc2f27938, 0x9ed0050d, 0x513741bb, 0xae1e642f, 0x0b4da5e3,
+       0xe128d95f, 0x0b5323b8, 0x213cdc61, 0x7586733f, 0x74095d8f, 0xc6d466de,
+       0x63f5fa15, 0x8597e73e, 0xd019cc30, 0x5e2239bf, 0x1ac0d5b1, 0x4166f522,
+       0x35b7973e, 0x4c34bc45, 0xd33cf1e1, 0xe3d0f888, 0x11aaffb0, 0xbe93fe3c,
+       0x9ff14cd6, 0x9e7fc774, 0xe9ed0e9c, 0x4d053a1d, 0x74b6d95a, 0x9efd018d,
+       0xf22758db, 0x3f8956e3, 0x76e6cc1f, 0xb92c1832, 0x1efc2273, 0xf2ca37b0,
+       0xf6a7e223, 0x7184a086, 0x4b11aa8c, 0xa7378c25, 0x3093ee3b, 0xe0de91fe,
+       0xe8897c93, 0xfda9f927, 0x2b9f22ae, 0x6f67d61f, 0xf735e784, 0x3c0cbeb1,
+       0x81b79857, 0x566409f2, 0xecdf3916, 0x27878e22, 0xb43d2064, 0x691ad7df,
+       0x9af8d15d, 0x991eaee5, 0x1ce07c3f, 0xccbfdba3, 0xfdb8e7e7, 0xf9029871,
+       0x1f8f1260, 0x9339789c, 0x6dd9e5ec, 0x23f41ef1, 0xb2393c4f, 0x2aa7e096,
+       0x9eff683c, 0x1a62b978, 0x9a9fb396, 0x484efd49, 0x05c630ec, 0xbb753f66,
+       0x7939f58c, 0xef1c2eb0, 0x71e891b4, 0x89f753f6, 0xc5a91fe7, 0xf05d72f6,
+       0x2e9fd0ef, 0x012d7e6f, 0x891505e3, 0x7961646f, 0x6abdd742, 0x837fcc3f,
+       0xd51afd95, 0xda4377b5, 0x3fc1d4df, 0x6b993ce6, 0x378c78c0, 0xf3ce973f,
+       0xf031e626, 0xf92f077c, 0xba3b95b7, 0x8e8b01de, 0x5bd9d75d, 0x9ebad783,
+       0x5883d65d, 0x34158756, 0x61ed59a3, 0xa72c41ef, 0xd16bf975, 0xa0fba9bc,
+       0xdd9620f5, 0xc45e7d23, 0xedffabff, 0x055e3796, 0xab63c478, 0xe68768ac,
+       0x633dde3f, 0x0d2fc51b, 0x60a1f90c, 0x8f55bf92, 0xa6f66c04, 0xf6787ca2,
+       0xfa875919, 0x8d6ae4dd, 0x4f74d843, 0x4ce30eae, 0x175a53db, 0xe20bbed3,
+       0x28f1e219, 0x8ba421e8, 0x2a6f1482, 0x25f013f2, 0x829dc39d, 0x7e294d3e,
+       0x8bd60a6b, 0x7efe8e7b, 0xd85e1cf1, 0x4e35afdf, 0xa55279a2, 0x08cdc4a0,
+       0x42ec23b4, 0x7f33b79f, 0x96c3e206, 0xf18adfe8, 0xce2a82ad, 0xd3912cff,
+       0x996f7605, 0x10508f48, 0x3fd5bd3e, 0xe6c1cf0b, 0xe01bcfeb, 0xb06a0774,
+       0x25c93edf, 0x367fee98, 0x39061c4b, 0x3fc2eb43, 0x5ba4e78c, 0x51cec9d2,
+       0x806b6fd7, 0x0eec22f1, 0x968dc7dc, 0xba54e781, 0xf5f620db, 0xe60b2884,
+       0xf5d4f1f3, 0x7ae7cc6e, 0xd4edd61d, 0x62f47ae1, 0x5d0fb03d, 0xfa227ac4,
+       0xd7fafed1, 0xd23b14cd, 0x897e6305, 0x4729cc97, 0xcea17fee, 0xd71a3713,
+       0x615fd6ff, 0xe509295c, 0x67f3ac08, 0x919927fb, 0xf1f7a34f, 0xfb88be42,
+       0xfe8cbd80, 0xe71f4cc3, 0xbf46e6df, 0x0d94fe84, 0x43bfdc61, 0xd45c60f6,
+       0x0c926966, 0x39b5fb11, 0xd99e9eb8, 0x728fdfe8, 0x82796665, 0x8b3df482,
+       0x72b5ae75, 0x0f983efe, 0xfd622beb, 0x7136167f, 0xfe7c4ec0, 0xe24ef799,
+       0x67583a91, 0xcfea3155, 0xbca5eec7, 0xcc8fcd89, 0xcfeb8c3c, 0x3fb93f74,
+       0x7ef40615, 0x3e7dce2d, 0x77656f8f, 0x87bc9ac8, 0xc9acbf2c, 0xac58c88b,
+       0xd07a076d, 0xd95d2ac0, 0xa829d5a5, 0x2509746f, 0x9da06733, 0xf923a492,
+       0x9a4a720e, 0x8d1ed31b, 0x7f812ba2, 0xcdde7cf5, 0xb373a7cf, 0xb039f859,
+       0x737cc55e, 0x7aacd8a2, 0x336f304e, 0xd03279b0, 0x3ead737d, 0x8f1fa124,
+       0xb232f1fd, 0x26f70d97, 0xada73e0e, 0x19cce706, 0xd41fa728, 0x2aaf2959,
+       0x67a0af0a, 0x94fc99fe, 0x1da8d307, 0xc53365ea, 0xabd6233d, 0xcf6b058f,
+       0x3bfd4ae3, 0x0cce7858, 0x4cfae0d7, 0xa899dcc7, 0x32973367, 0xf6e8ff3a,
+       0xe7b547a2, 0x78ef7e4a, 0x50b1a38c, 0xe79c07f8, 0x5af6c74c, 0xcfa3efb4,
+       0x9cbba555, 0xc2f5b161, 0x2f5c0523, 0xa72824e4, 0x90aec8ea, 0x66f04ec9,
+       0xfd23c3cb, 0xb9f2efa4, 0x57e5301f, 0xec43d216, 0x1f087363, 0x3f5dc255,
+       0xa8738629, 0xfba1d3ee, 0x7e3ddec2, 0x5099e9e0, 0x7bf5fd4e, 0xdfa0c74d,
+       0xe32cefd4, 0xeb377eb0, 0xa081819e, 0xf90361e0, 0x7cbe6b8d, 0x440315a5,
+       0x414c8dcd, 0xe3ceabbd, 0x6efae028, 0x25e4218f, 0xb32c5af9, 0xd907246d,
+       0xf4114bc5, 0xe89e9002, 0x6f31b787, 0x91f92b63, 0x8612fcb6, 0xaccd3c79,
+       0x97d20ef3, 0xe30c8d67, 0x383637af, 0xffb0550d, 0x869d1b1b, 0x219f78f9,
+       0x23b43ab3, 0xa8506a6e, 0x8546a6fe, 0xfd799bd7, 0xd50f06dc, 0xf0f46dcf,
+       0x5bd40b7a, 0xd4290f30, 0x6f718015, 0x753aa4b6, 0xe8d01f78, 0x4c17ede5,
+       0xfc1c7ed4, 0x8c27cc01, 0xbc910b8f, 0xf1d1ed6f, 0x7c7f237b, 0x9ab58248,
+       0x3b0ecb12, 0xe8f77f11, 0xcc175014, 0x2b332d94, 0x7836cfc0, 0x7f687a43,
+       0x1032858e, 0x3617bb91, 0x7ea10b79, 0xe2b643b7, 0x7b8376fe, 0xc147f98b,
+       0x9de132a5, 0xbdde00fe, 0x3af741d8, 0x3efc455b, 0xf14cc4b8, 0x2875b066,
+       0x6496ccde, 0xb7863b0a, 0x86b02c77, 0x39031ed0, 0x7bd8e748, 0x00764c8f,
+       0x6ea3c3c8, 0xe6768bb4, 0xca9f182b, 0xb7e5aa5c, 0xaa0b85f4, 0x6646bc68,
+       0xbebd3f45, 0xbcd78f91, 0xa1d21753, 0x71b9655d, 0xf341d226, 0x3fa0a60e,
+       0x53c2ecfb, 0xee10c3b5, 0x3f2e1450, 0x79a172b4, 0x9c4753e1, 0xcebf1fb8,
+       0x79fd405a, 0x5fd9af1c, 0x0d2f5dbd, 0xb79d33f0, 0x0c7e4073, 0x61ca3796,
+       0x5e63271c, 0xc1f182b5, 0xc627d874, 0xbc8c3bf3, 0x4ca7783e, 0x0be92df7,
+       0xf475b0e5, 0x0b677f00, 0x1f23a614, 0xd17c9126, 0x9dc8d7f0, 0xc179f85a,
+       0x32efc0a7, 0x9db82bee, 0xd1673e51, 0x903f6d76, 0x57943a93, 0xfadaedd9,
+       0xe3fa8b5b, 0x443c1a02, 0xe7e6d9e3, 0x9f7a2f72, 0xc70afb03, 0x74bed115,
+       0xd7285f7c, 0x72d8bea0, 0x1b8bea80, 0x44e9c565, 0x0a79d779, 0x53b45ff7,
+       0xeb806166, 0x44cd9617, 0xa4dfaa7a, 0xf5c8f0a3, 0xc2e48bac, 0xc6adf695,
+       0x19f7a23b, 0xf2efbfbd, 0xa88e5cf5, 0x6613e0f6, 0x1edb07b2, 0x9ef0e8b6,
+       0x78adec15, 0x55dc2b8c, 0x402c1d54, 0x1dc8407b, 0x973d25c3, 0xa216cd27,
+       0x51ed8353, 0xa1fc6477, 0x13f55465, 0xd86fd405, 0x6e3c758d, 0x968efb41,
+       0xe3173f63, 0xe6d6ea4d, 0x13db5de3, 0xa63f951f, 0x729bc7cd, 0x7f2a3321,
+       0x7f2a2f2c, 0x7da6946c, 0x545c75aa, 0x51b5d8fe, 0x1a3563f9, 0x967b9678,
+       0xcaf5ffa6, 0x86f81a4d, 0xfd343bf2, 0xd6ee78e7, 0x7754dfb4, 0x66fda6bf,
+       0x7c0d4aef, 0x6b5fc36b, 0x6be6dffa, 0xb1dfb4d6, 0xf69a27f8, 0x2d49ff68,
+       0xf9701577, 0x3feed9be, 0xd06c0149, 0x3df791f7, 0x28de996a, 0x7b9e46f7,
+       0xa7b70252, 0xb9fdfba2, 0x8bfbd380, 0x058f9f12, 0x1c789aed, 0xf135d8f3,
+       0x854570ba, 0x71c61bb9, 0x21df951a, 0x0ee262dd, 0x6bb6bfbf, 0x3ff6d9ee,
+       0xbc60fd0e, 0x1b5cc4a6, 0xff8c3bea, 0x37b940fa, 0x5f747487, 0x4abf5b61,
+       0x69b83d22, 0x5cab8f15, 0xaf3c5230, 0x8eac1d7f, 0xdc46fbc6, 0xeceba96b,
+       0x2da47110, 0x85424718, 0xfd4199e4, 0x7ef1c656, 0xe3574d3f, 0x371a3e8e,
+       0xa418dca3, 0x7e85bcfc, 0xcdc0e309, 0x7bc5663e, 0x02cb7493, 0x069bff9a,
+       0x265d9925, 0xb016da2e, 0x67cc0f33, 0x635c155f, 0x527dbd84, 0xb3d4f7d0,
+       0xcfddbcf0, 0x5bd31e28, 0x1853edf0, 0xe143e98f, 0x219d7408, 0xf73f3c73,
+       0x5fcfeec0, 0xe6daf981, 0x5ca197a5, 0x5acf6e8d, 0x43ebf7be, 0x6e7f6997,
+       0xde1f5bd9, 0x1fe7b97b, 0x25ba75d8, 0x38c87da2, 0xf3264369, 0xe001d044,
+       0x80fde62c, 0xf9f5c85c, 0xc5230af2, 0xfc01aeb1, 0xbfbe0215, 0x89cff8aa,
+       0x3fb9e03b, 0x44eefb39, 0x65ea1d3b, 0x847e87ac, 0x9fe53fd7, 0x9c92fca3,
+       0xa3df6051, 0x9b171dfd, 0x7215c76e, 0x8d6d95ba, 0x6a0718bd, 0xd13a344a,
+       0xbb32cfcf, 0x07193eca, 0x7ee06d74, 0xfeffb475, 0xddbfbf5c, 0x9177fe49,
+       0x944b2718, 0x9e7f2b7a, 0x4e4c8399, 0x3114f717, 0x6a4fa1f0, 0x655e5097,
+       0x8d3f942e, 0x89fd8be4, 0xa4238a46, 0xc1dc445b, 0x171358b2, 0xfb06e350,
+       0x9095ef13, 0x4bc3d3ee, 0xf18f9e28, 0x5c6f1c02, 0x11d693a1, 0x32c82f1d,
+       0x86bad3e7, 0xd7f59f1e, 0xe6314827, 0x1a875a89, 0x279e889f, 0xea04f684,
+       0x64f16599, 0x7bef444f, 0x79556149, 0xd7e470e1, 0x51d393de, 0x90329f7e,
+       0x5e8a1c3e, 0x143ccf30, 0x42b4fe31, 0xfe63dfee, 0xe63d6478, 0xe3228787,
+       0xef41ccd9, 0x2a0c102b, 0x7bb18466, 0x77ce1143, 0xc277cf94, 0x1ec9d8a0,
+       0xfe87b504, 0xd7217d5f, 0x9730d303, 0x19f2386d, 0x81dbcbf7, 0x12dcb1af,
+       0xd67d92b0, 0xf087fc01, 0x9527010b, 0xca9b80a1, 0xda85016d, 0x09ca07b7,
+       0x21e0257e, 0x8ea04778, 0x5e02d7ca, 0x6819dfaa, 0x01e7f820, 0x819d951f,
+       0x46ff54c5, 0x9bf04fc0, 0xbf04d581, 0x0160f685, 0x53d7a9c6, 0x4ad03bb9,
+       0xed037bed, 0x081dbf04, 0xec0e1951, 0x8103faa0, 0x060f824e, 0x287c1176,
+       0x70f82610, 0x479530e0, 0x7f545d03, 0xc101f03c, 0xc93ee337, 0x15df58ae,
+       0x4f8578c0, 0xf77da276, 0x15a16fac, 0x7cfb6bed, 0x79c5159d, 0x04b74fbb,
+       0x8d1d1ce3, 0xef131efc, 0x040e3123, 0xed086876, 0x67fcfb39, 0xf6a54c8e,
+       0x19bed4b9, 0xc4a70487, 0xafdb82b6, 0xfa91996c, 0x0a2130d9, 0xda58eb9e,
+       0xdc03d218, 0xed4f185a, 0xf93215b6, 0xfce9cf6d, 0xeedc8529, 0x336df922,
+       0xa541fb70, 0x5c853583, 0xe429aede, 0x161f5cf7, 0xca4a73f1, 0x9e47ad8b,
+       0xa6ed542d, 0x7f7187f5, 0x3fb079f6, 0x55bcef5c, 0xb597bc66, 0x72b3a3dd,
+       0xcbdf937b, 0xb8bf603a, 0xc50f587e, 0x6e7cd985, 0xade6db2f, 0xe63975a5,
+       0xd6ed48df, 0xd05347a2, 0xaff76f4f, 0x6deb439a, 0xd9ae2994, 0x82903bee,
+       0x89cf6cf7, 0xf0db277c, 0x64a86f78, 0x8d9e7af0, 0xe3077f5a, 0xec03837e,
+       0xec63d7a5, 0x496ed303, 0xc71130cf, 0x331cd47b, 0xe829d78e, 0xfe7121d7,
+       0xc4ca0f63, 0xb0302f7f, 0x2db9e0fb, 0x5105df60, 0xb6bf540e, 0xbd55e302,
+       0x289dbe85, 0x8e779f37, 0x9c03203f, 0xcfc7c75a, 0x82bf255d, 0xf79c3476,
+       0xbf502de7, 0x5e4dbee1, 0x4db0ea5c, 0x6ec835ce, 0xcadff3ed, 0x4397f8c0,
+       0x5a8f9ed2, 0xf9f62dbe, 0xb78f8782, 0xf14c9565, 0x378adb64, 0xbcf9075d,
+       0x33ff91bb, 0xc38a3e8b, 0x5cde4c30, 0x86450ea7, 0x35fc9e63, 0xff7717ce,
+       0xcd423aa6, 0xdf3a8f26, 0x6aef9c58, 0xb1e234f1, 0xc62f9b5a, 0x279286ba,
+       0xbf239257, 0x81ef1429, 0x942cb164, 0xb819cf23, 0xe49e0adc, 0x052524f6,
+       0x8f3c1a4d, 0xe6a02f9a, 0x0be7440f, 0x29e05efc, 0xde62c4cb, 0x4fd67ee7,
+       0xd73a41bf, 0xbd1b3c17, 0x92e36794, 0x35874931, 0x7a12d819, 0xde2aa7ef,
+       0x3d0626ba, 0x2853e5a8, 0x1fc100c7, 0x2e713216, 0x38f8ea9b, 0x64ce3e3a,
+       0x2ae082b6, 0x4318358b, 0x33e5ab5e, 0x2b7f9c62, 0x759b74e4, 0x870dcedf,
+       0x1a8f7cf0, 0x8b6a3728, 0xfd01b42e, 0x3d09e084, 0x7d4cd7c9, 0x2257d6e7,
+       0x4117f5d6, 0xa18c5b9f, 0x6e87bc62, 0x504af187, 0x94bf22ae, 0xd582fc50,
+       0x7d5de047, 0x1d843fee, 0x75c5fcf0, 0x3cff7429, 0xda1c6d6f, 0x4ccced47,
+       0xf83360f4, 0xd046c653, 0x32e90d83, 0x8b387d06, 0xfc0e348c, 0xe226aa59,
+       0xcbd70cbd, 0x60972835, 0x2616fbdd, 0x99ac3e91, 0x31acdeff, 0xc9f65700,
+       0x65b2cf94, 0x9cd3cf29, 0xca3aeff4, 0x31fb7913, 0xf75df7ee, 0x9fbd2d50,
+       0x67ca2194, 0xb283cfd1, 0xc2533d72, 0x0b952e70, 0x99bf142d, 0x133e417c,
+       0x4851a7e9, 0x17fa3c7a, 0x6d735e3c, 0x0f79acaf, 0xb68f526d, 0x8f54603f,
+       0xb7464676, 0xef3edeb6, 0x6153d3cd, 0xfca5f69e, 0xbf8bf6e1, 0x7070823b,
+       0x24e28e95, 0x5064fbea, 0x4df14193, 0xf9819839, 0x8ccc1b9b, 0xbe6db9e4,
+       0x60f28ad9, 0xc93c7a7f, 0x2cdbf6bf, 0xcbae8764, 0x3b438a6f, 0x556f34d9,
+       0x8c23960a, 0x3b18adc1, 0x2dd5e6bd, 0x9127d937, 0x55f355bc, 0xec1cac82,
+       0xdc8dbb81, 0xf73e09c8, 0xe51954f4, 0x9967cf25, 0xa796eaf4, 0xadd8f983,
+       0xd4e1d695, 0xf9be4cb1, 0xba76f87e, 0xbeb896b7, 0x1da11a70, 0x7ca379e0,
+       0x7b4115d7, 0x3f705a46, 0x9cb66d36, 0x6b7ca469, 0xf982324c, 0xccfd0b0d,
+       0x658df588, 0x573e48e6, 0xf2fbe4f9, 0x87c63c7f, 0x0e595f87, 0x2bdc695c,
+       0x3e417bf1, 0xfca19be7, 0xf210d369, 0x1f8ff554, 0x8bfce029, 0xf57a4b6c,
+       0x7da6318c, 0xce22abf5, 0x9e46e567, 0x61bb32a7, 0xc3dd1d5a, 0xcc65bb04,
+       0xdc517be7, 0x27a7b50b, 0x7b713dd2, 0xbde30b2e, 0x8e817041, 0xf8d27bc7,
+       0xb98ded7f, 0x936a1f14, 0x3cc129fc, 0xb9f097cc, 0x01dafcf0, 0x7f308947,
+       0xeb970e5b, 0xe2b7e42c, 0xb38c357d, 0xe0fd7238, 0x74b505ef, 0xa61ec8cc,
+       0x789e85f8, 0x888c69cf, 0x1c5c63b7, 0xcfd117e3, 0xc2d5ee4d, 0xe1682e53,
+       0xc0d0662a, 0x3c2d6635, 0x3785aad5, 0x7d3b7115, 0x3f5b5dba, 0x1d85a9c3,
+       0x74e307d9, 0xc2dfcf3c, 0xf049e222, 0x447e5ef7, 0x68dd681c, 0x765f3efe,
+       0xcb8a52f7, 0x78f0e5b6, 0x3695638f, 0x42c591ce, 0x732fe212, 0xd63c5469,
+       0x863f66bd, 0xa30bed97, 0x5efc41e3, 0xa9a1f002, 0x7c8a3147, 0x9e68eaf0,
+       0xd23dde87, 0xce08bdb7, 0x5f0c60b3, 0x4d1dabc7, 0xdac53f74, 0x5caf88d3,
+       0xb0695f22, 0xe88a7cbe, 0xf90f1d40, 0x7fb11822, 0xf84887e4, 0x37be51a1,
+       0x8be41e70, 0x2cfea460, 0xfbd036e9, 0xa1be62ab, 0xcfe543f8, 0xa28f7172,
+       0x89f4dde6, 0x9bbcd4b1, 0x705f2255, 0x4ebe5457, 0x1936a39f, 0xaebee7fd,
+       0xf8b1f195, 0x682ef910, 0xe5887ce2, 0x837f9106, 0xe22c187c, 0xa6f5887c,
+       0x637856ef, 0x050b8bd9, 0x63bfdc5d, 0x224f86c9, 0x73acb7f6, 0xbe5e0685,
+       0x910de1eb, 0xe3f751f9, 0xbf08303f, 0xed7e519e, 0x2f9db152, 0x2bcbff4f,
+       0x48cd0ccd, 0xcf2807df, 0x319c1596, 0x5ea77bf2, 0x42eb9e23, 0xcc99ff61,
+       0x2fd1f2b3, 0xf2e211db, 0x37889d6c, 0x33155b34, 0x3b9981c6, 0x50c71355,
+       0x4b4d11e3, 0xd854b65c, 0x7c7f7247, 0x7ca56bc1, 0x14f9e1dc, 0xf1aa48df,
+       0x32c6cedc, 0x9c6453d6, 0xdd62066b, 0xc056c18e, 0xd957f9e9, 0xc0c74133,
+       0xf8174dbe, 0xb0fdc97b, 0x8f2467ec, 0xea68e42e, 0xa39c44db, 0x0b2dbf9f,
+       0x8b3e70aa, 0xb0fb49db, 0x1e1aff31, 0xd1c6d417, 0xe73de24c, 0x343be3c1,
+       0x7e226df5, 0xb5f1e572, 0x85d33971, 0x2fc621bc, 0x1adf1a8c, 0x7181fc73,
+       0xabbdf1b5, 0x714f37b8, 0x2e3a184f, 0xe9cdd236, 0xdfdd9d69, 0x83317185,
+       0x06667fe0, 0xf288993a, 0xe3e9ff80, 0xc1ae7e79, 0x198f8da1, 0xfa0baf30,
+       0x98b8973f, 0x3efa8ae4, 0x0599fdb5, 0x27cbca12, 0xa4e8fdf0, 0x5a24f2c1,
+       0xde44d88e, 0x811cb47c, 0xd37034f9, 0x36cf5cc3, 0xe50f8a4b, 0xfe7ef473,
+       0x7587f17f, 0xc8bbe389, 0x778eceae, 0x0f632e9a, 0x638205b7, 0xf175b9f1,
+       0x0778c5fe, 0x918ef77e, 0xe3944f69, 0xf88ceb7b, 0x298ec56c, 0xb60f3173,
+       0x13ebf04d, 0xa7a23a69, 0xb7d3dbf4, 0x29e823ea, 0xa173e8dd, 0x13ae9c3d,
+       0x87f85ff9, 0xd227b471, 0x318c6db7, 0xa9d76abf, 0xd601adb0, 0x6d8e7111,
+       0x9fee9ec2, 0xadcc8eef, 0xd27188fa, 0x34b1be4d, 0xa3fe7f5f, 0x87e5af98,
+       0xc459b7cd, 0x6cf9d4c3, 0x67f76a77, 0x7f69fa33, 0xd487a136, 0xfee336f9,
+       0x15d5f062, 0x75fe13e7, 0x69777cff, 0xf93367f7, 0xf5367f69, 0x7cea1b3b,
+       0x3e6c3f2d, 0x76cfe0bb, 0x3d97def1, 0x64377f9e, 0x9a23f7a8, 0xbdccf3fb,
+       0xed2f9466, 0xe850bc6a, 0xfa5173bb, 0x3be849ae, 0x6973f9f5, 0x3dff14b9,
+       0x7326f877, 0xfa873d2c, 0x933b098d, 0x09933b09, 0xd9e1133b, 0x0d57a735,
+       0xbbfc7a07, 0x95cf371d, 0xbecfaf41, 0x1cf8f4ff, 0xf1d9df80, 0xe832b98b,
+       0x9eafd9a9, 0x1e0b337e, 0xfbdbfe29, 0xe9f4fc38, 0x5bb4073e, 0xadcccf82,
+       0x18693805, 0xbaeacfd7, 0xb97779d5, 0x7cb95db9, 0x6f8f1e75, 0x3d459c82,
+       0x67e39cd6, 0xcafc7f18, 0x1f349bd1, 0xeecf2ffa, 0x03105f4d, 0x7cb96a2f,
+       0x1e7f2175, 0x9889c0ad, 0xaf48c6cf, 0xc7bea8dd, 0x8f7da752, 0x23692925,
+       0x2c7187d9, 0x96394564, 0xfbd0f660, 0x7316d797, 0x533370bd, 0xe15fb81a,
+       0x1c79102c, 0x4dcbdef4, 0x6b5c62e5, 0xfdb12fe5, 0x09e79d66, 0x79ff77f4,
+       0x68e1bcd2, 0x7379ab3e, 0x3bde06a3, 0xde7dfedd, 0xb1fd9e4f, 0x64e56dc4,
+       0x36998f1e, 0x7bdfc9ca, 0xa22b888b, 0x3e143c5d, 0xff73753f, 0x1e9f007e,
+       0x0f54cf8e, 0x37b5a7c7, 0xff9c0d69, 0xf4de94f2, 0xc34f89c7, 0x0835f131,
+       0xfbf851af, 0x7ea99b93, 0x88ed1ea0, 0xc55be12b, 0xd85f9aab, 0xc80b392c,
+       0x9a19675e, 0x14c660fc, 0x1e7bac67, 0x3d48cfa4, 0x197bb46b, 0x3486a3da,
+       0xeff98dc5, 0xc7d17fcd, 0x1573dbcc, 0x525ef88b, 0x367de53c, 0x1fc91927,
+       0x93349fdf, 0xb659fc61, 0xd4bc234c, 0x3e51d526, 0xeb187ea6, 0x3a357f44,
+       0x7c9f5d0f, 0xe909e53b, 0x4061e86d, 0xecc79fd9, 0xe95f2331, 0x5d92563f,
+       0x99570048, 0x295f2e87, 0x26753d0f, 0x324f43cf, 0xd85e313a, 0x998c689e,
+       0x9badfe87, 0x71fb5dfb, 0x1fb8697f, 0x886eff23, 0xe56c97d8, 0x9f58eef7,
+       0xab46f500, 0x5dfc518f, 0x615bffec, 0x4dfda907, 0xf9433f56, 0x4e2a37a0,
+       0xa9f45fb4, 0x77e07f5c, 0xe231dc5b, 0x0dbb5f28, 0xa3fdfcf4, 0x99cf5cac,
+       0xfb3eddb9, 0x27dfb137, 0x44962b28, 0xdd3624bc, 0x3737450d, 0x9dde78ea,
+       0x2d7397ca, 0x9c07ca46, 0xf7d3b16b, 0x2102e66c, 0xf446a4f6, 0xfe56eebf,
+       0xd8acb53e, 0x7b7e9e91, 0xfe5f94ed, 0x00b5e196, 0x66a7db97, 0xc2bde818,
+       0x28f31253, 0x5df383a9, 0xa994debd, 0xea1bccb8, 0x7645af4f, 0xc8c3182c,
+       0xc1757a4e, 0x4e95ad43, 0x8aea8ff2, 0x737d9e91, 0x770fa2a6, 0x77d8c363,
+       0x04f2ffb1, 0xfbd5cf2e, 0xfc09e5a5, 0x646bde7d, 0xffec6cdf, 0x4917c555,
+       0x725f48d5, 0x2bae0e6f, 0x33dd3fa2, 0x5b9ff445, 0xcffa813c, 0xf5ddafe6,
+       0xce3977d2, 0xc8f99da5, 0xec7ce8c7, 0xf429ecb1, 0xbde458b7, 0xe81f9086,
+       0xa3d64577, 0xce22c5bf, 0x6e505a53, 0x4f218eeb, 0x3ec332d4, 0xa042e46e,
+       0xb18c8cd7, 0xcff5aa54, 0xa175f47a, 0x90fce718, 0xec1fe738, 0x6ac3b4f7,
+       0x3df80e27, 0x843cefe0, 0xe172f8f8, 0xb0f1f4a9, 0xbf6a07a5, 0x6ec7bf26,
+       0x16ceffec, 0xb00371f9, 0x2db3bef6, 0xdf8c5bd0, 0x87886019, 0x8bf91189,
+       0x25f6bf62, 0xefd0526b, 0x20f4b381, 0xbc0476dd, 0x030d6b23, 0xe42cbfcf,
+       0xd2160b08, 0x2eb106f3, 0x0ceb5a47, 0x2c38bb8c, 0x6073ca3a, 0x6791aacc,
+       0xa6536a73, 0xbb0ba1a6, 0x2716299c, 0xe45df7fa, 0xfbe06417, 0x7c9f180d,
+       0xf78636e7, 0x9d69595f, 0xfd75da12, 0xc6f788f3, 0xe17b8957, 0xed2d5f3e,
+       0xefd6c327, 0x5ff23197, 0x507382d3, 0xc33df56e, 0x92f19457, 0xc691ddb6,
+       0x5dee1ff3, 0x02721f18, 0xed2d67bd, 0xb04f4fc2, 0x30f8700c, 0xa9719fa6,
+       0x7282d5d9, 0x140957e6, 0xe7b7d677, 0xfbc820b3, 0x1bfbecb0, 0xf9c877c2,
+       0x6c4f2e90, 0xb65b9e16, 0xb9ec9e28, 0x0675a976, 0xe8f731f9, 0xd178ac58,
+       0xa7ee62ce, 0x2b628ffc, 0x4fb5cfbf, 0x1f63f4e4, 0xb8e1723f, 0x77ffe7ab,
+       0x49f99e84, 0x7fde93b2, 0x4da3ed52, 0x8e47f843, 0x5f213a91, 0xf8115e84,
+       0x199f3333, 0x792f45f9, 0xc774b079, 0x96bdaf6b, 0x5b53e8ce, 0x841b4748,
+       0x138ea3fd, 0xc6a21f9f, 0xf243c578, 0xb87ab252, 0xedfab0be, 0x75af3841,
+       0xce63e9df, 0xfba085ff, 0xd90fd935, 0xd3ad7fb1, 0xfa32c6e7, 0x9c96983d,
+       0x3e78dd7b, 0xe9fb332d, 0x96baec95, 0x61dfce33, 0x28f0563e, 0x9fd837cf,
+       0xefc3685d, 0x1b0e5941, 0xe265d364, 0x27d046f1, 0x19d8cbce, 0xdeaf9146,
+       0x99e78072, 0xbaca58b6, 0xc5a1af30, 0x6a465692, 0x56f3c2d8, 0xcb16fed5,
+       0x1607d221, 0x5adfdf85, 0xb8487f50, 0x0947c04c, 0xe110ebae, 0x5077ed43,
+       0x128b5dc8, 0x5a5ef866, 0xfd4ad29c, 0x83d7b2cc, 0x34e6ca79, 0x6644f746,
+       0xe217f02b, 0xccc75f35, 0xbec9f431, 0x5a4fae62, 0xaabaca4a, 0x7e327d69,
+       0xd8b58eb9, 0xe7a4eccb, 0x7cf0ef11, 0xcf968673, 0x577813bf, 0xf91669c7,
+       0x4eae77b4, 0xc38ed609, 0x1bf79338, 0xcb16e7a4, 0xf5107302, 0xcbf8e25a,
+       0x391a678e, 0xd7fb78d4, 0x43bef18a, 0x2c4fae79, 0x0678e2b3, 0x8d15f7c6,
+       0x9c62e1f7, 0x7bfbd5ff, 0x47bd2cc0, 0x581d304d, 0x7deb1ed8, 0x13f3feac,
+       0xcfd1f2f7, 0xbc7960fd, 0x02871b56, 0x091eec79, 0x72565afb, 0xd53550e6,
+       0x0bd3f8f0, 0xfd519fc2, 0xf6317492, 0xbf7f120b, 0x2bc5283f, 0xe10c5df4,
+       0x69c7a4a7, 0x3ef030f1, 0x6f873f2d, 0xde1e781a, 0x7c4c6937, 0xd7cb4e87,
+       0x38ff1cdf, 0x059f9345, 0x7131ec7c, 0xde23c63f, 0x3888f5a7, 0x6f18c21d,
+       0x049d17a0, 0x89c7f7ff, 0xc33f9c1b, 0x4099acef, 0x5c60eb8e, 0xfa27e1c9,
+       0x5dba3936, 0xe239efc8, 0x78d10ffb, 0x2e48c9fe, 0x7a47a5af, 0x51af785c,
+       0x119bd69b, 0x7c5fdf8b, 0xee0642f8, 0xfd19c5e7, 0xdf743b79, 0xe769e2f4,
+       0xcbc402e6, 0x6ffbed11, 0x474df8ea, 0x22f8a7ce, 0xe5c0a5fd, 0x3a4b2fdf,
+       0xd92571b3, 0xddb80b8d, 0x7dfa7ff8, 0x73e617b3, 0xa497753b, 0x084fcf95,
+       0xfc141cb9, 0xd320bb60, 0x2aee43f7, 0x3a40adf2, 0x0bac936a, 0x3ce72e50,
+       0x9af2f3cc, 0xb3d55b1e, 0xb47f0628, 0xd5fdf28c, 0xbabf08c8, 0xe491bd7c,
+       0x3725b35e, 0x28f772f9, 0x9fbb9f43, 0xde7a94e4, 0x79988f55, 0xdb8f8abe,
+       0x7bbee9d1, 0x3a260f29, 0x7ea8653f, 0x449d23d5, 0x137f6a0f, 0xc5f28f8e,
+       0x15c52372, 0x818fa1ce, 0xb72b3b71, 0x59d7a233, 0xc098c889, 0x7d0663f1,
+       0x49607499, 0x106b8e1c, 0x6a0bdcfe, 0xcca1a45c, 0xde7889ec, 0xb9995b70,
+       0x9a4e823a, 0x8e0fcf19, 0x2337ff1e, 0xac22fb55, 0xa80c63b1, 0x94c6317f,
+       0x97ed9f26, 0xf278643b, 0x0395b4fc, 0x0ee3cc7c, 0xc5a3e743, 0x232dbe71,
+       0xf30dac7b, 0x5e0ec0d2, 0x0460b0d3, 0xf64db7e2, 0x3c0368bd, 0xa2687ef4,
+       0x0bdfea3c, 0x7c16ed3e, 0x05f9d43a, 0xd23001d9, 0x1d9c7b18, 0x80e297c4,
+       0x2327c64e, 0xebe7345f, 0xf63142ea, 0xf3ec5c79, 0x7878f632, 0xc7b3f7e4,
+       0x1afe890f, 0x6ded1c7b, 0x46fdd44f, 0xb6768c24, 0x7e3d8627, 0x05f11242,
+       0xc2742791, 0x0dd5dce0, 0x39313978, 0x5697be99, 0x5defc090, 0x527fa04e,
+       0xabc87e06, 0x7ed1f3a7, 0x7ff52d99, 0x43f84917, 0x47f0608c, 0x62f905fe,
+       0xb6bff30e, 0xe23e2248, 0x1b7835f7, 0x73e57e9f, 0xd19236de, 0xf9c036ba,
+       0xdb46fde1, 0x6233f9c5, 0x8ea467dd, 0x5037fd52, 0x13ef1165, 0x889d3c33,
+       0xf741acfb, 0x72f75174, 0x9fd36d78, 0xdc1fac77, 0xed7286ff, 0x8b86d9bd,
+       0x5a622e3c, 0x4b8f42c2, 0x6daa9798, 0x10cea9bf, 0xb9a82f7d, 0x6bd9bb4f,
+       0x7d0f5e88, 0xd621d417, 0x1f71dd9b, 0xcd4fbfdd, 0xa644f9e6, 0x04e28c65,
+       0xa66df7d1, 0x3d1e5db1, 0x8c0dcfda, 0x38e8fdec, 0x52a9e639, 0xb181b0fc,
+       0x79e5122d, 0x7973df6b, 0xfe73fea6, 0x3ad6947d, 0x760ec79c, 0xd1d3da10,
+       0xf7a849ef, 0x51f7ea5a, 0xdfab3c55, 0x4dbf4a8f, 0xc163eb47, 0xc6aed429,
+       0xb87bf1fd, 0xf911e955, 0x7f582be4, 0x2b7f7a7f, 0x9bdf7b18, 0xcf29eadb,
+       0x7fbc7320, 0xb29a186c, 0xc8784614, 0x6fc8c85a, 0xf2683c00, 0xdbd94c09,
+       0x16e79f69, 0x224c3633, 0x33da683c, 0xfdd3d340, 0x7e6d42c0, 0x0353ec01,
+       0x57abfb47, 0xd94d53f2, 0xf39597f9, 0x9a638a57, 0x94e4bdc4, 0x97fbe251,
+       0xed14aca5, 0x9edbf4a2, 0x0738f3a1, 0x5f7181e7, 0xdd629c74, 0xf1826e3b,
+       0x77fc8fd1, 0xe2cd2fc1, 0xaefd5b6e, 0xf4c8f30f, 0xce549b1e, 0xf30d2cd7,
+       0x12e97bf2, 0x8a6e7c46, 0x8fcc6667, 0x1e4c2a97, 0x04c9bbc4, 0x32596c30,
+       0xd4067332, 0x7b3c45eb, 0x8464c48d, 0xf3315599, 0x5dfaa3f8, 0x577d10a1,
+       0xd479a868, 0x20b22bef, 0x679d4e7f, 0x2ef577d0, 0x7bf93cf3, 0x6be7e8d6,
+       0xcea99e29, 0x87fe143f, 0xbfde8efa, 0x8137bcd5, 0x441d53c7, 0xf4038daf,
+       0x417cf04a, 0xca3cf88f, 0x66d5bb85, 0xfa29577b, 0x4c1e670f, 0x114a3650,
+       0xd2ce08fb, 0x7e03eff3, 0xd7faf1bf, 0xbc927761, 0x1897dfef, 0x8beefbef,
+       0xdae422fe, 0x09597c3a, 0x191a5ef3, 0xfba431e5, 0x29973faa, 0xa0f600ff,
+       0xdf111391, 0xd6f18049, 0x1fefce3d, 0x3e77e336, 0xc0e7fef0, 0x13edfe40,
+       0xd1f76c16, 0xbcd43677, 0x5da3cc5c, 0x3ef0325b, 0x837df472, 0x89c611bd,
+       0x99b26f98, 0x9f401305, 0x0531f4a4, 0xb9ecf3bf, 0x03a65468, 0xa07d6c7e,
+       0x93bf0150, 0xa5ee8999, 0x337ead2a, 0x0ae10eff, 0xef676916, 0xefa56e97,
+       0x64bf86bd, 0x3e14bf94, 0xc3ee88cf, 0x70c4c39f, 0xddf8ff2e, 0xcbe47afb,
+       0x7a5d7da9, 0xfb93f3d4, 0xf67fa4fc, 0xed3d4fd9, 0x9962e7e2, 0x751f9111,
+       0xcf545b1d, 0x979f8ae9, 0x5f27ea2c, 0xfdf86a30, 0x46a35eda, 0x5b17c81e,
+       0x65fd46be, 0x67aa89ea, 0xe3e33fd3, 0x2dde28f9, 0x53edb5db, 0xdbd03e44,
+       0xc35fdf2a, 0xbc73a1ae, 0xcf331698, 0xd5dce06e, 0x71e26e73, 0x79c7c674,
+       0x9ff7946e, 0xff404d46, 0xe87147c0, 0xd82fc464, 0xdd952917, 0x58798ecc,
+       0x8e994ce5, 0xf3b2bd72, 0xe487a41d, 0x3c0f3cb3, 0x5ffdfc7a, 0x7e8595be,
+       0x9dc99ec3, 0xed2f6859, 0x3d15f2f9, 0xd3d5578e, 0x193eb0cb, 0x58a41e4a,
+       0x10aa784c, 0xcf5033b4, 0xf59144e3, 0xe74a9eb4, 0xcfe4e565, 0x871a4e50,
+       0xd933df6e, 0x87e4c2c2, 0x3da02675, 0xfe7c7cc7, 0x57cab364, 0x70972fec,
+       0x9f81845e, 0x52ea54f6, 0x7b9f616a, 0x6c15919e, 0x46f3d3dc, 0xe7bfce02,
+       0x7acd39ec, 0xf322fe98, 0x5afbac45, 0x2b53ee71, 0x7efec97b, 0xf92bac4a,
+       0xa1c52f6c, 0x30de9553, 0xc3d4dbea, 0x37fefa7a, 0xc8bcf0b3, 0x38a14c61,
+       0xfc5eba9a, 0xd73e2a6e, 0x88de7282, 0x5632b3fb, 0x287eec28, 0x55832a33,
+       0xcc9a8f98, 0x6b484a76, 0x417d2b53, 0xa5e4e7a4, 0xad939e9c, 0xbf18c3fe,
+       0xa3af5e4f, 0x59f24538, 0xcbf406df, 0x0565cb92, 0xf84ae4c9, 0xb7f310ec,
+       0xf9d4f98a, 0xa88cf5d5, 0x7ee84bf4, 0x62e3b324, 0x132aaefe, 0xcc5abf8e,
+       0x59eb14ef, 0x2c3be8c5, 0x55ad67c9, 0x83272fe8, 0x33df419d, 0x9a79e2b8,
+       0xb745f335, 0x99d94f27, 0xb1e0e745, 0xe30ad91e, 0x365b64a5, 0xceb94154,
+       0x32ff23a1, 0x3c5187a9, 0x9d27a93d, 0x4f527de4, 0x8a2728a1, 0x0f4269fa,
+       0xd4933970, 0xaf2d50f3, 0xa4d2a16f, 0x3f8717ca, 0xda98fb8c, 0x717cb8cb,
+       0x98be4978, 0x517cb8d2, 0x9556b8e9, 0x325acc2b, 0x0ff7ea1f, 0x06b5acff,
+       0x73f77b9e, 0xbbe5fefe, 0xbcbe5cd9, 0xfbf725fb, 0xd3bf694d, 0x42aa5ca3,
+       0x4dfa05c3, 0x33edc0bb, 0xbaab1f95, 0x48113625, 0xe7839a63, 0xc8ba1f87,
+       0xd9843b9f, 0x63af00d5, 0x9529c912, 0xdd056b6e, 0x83eab3ae, 0x81fed849,
+       0x3477de89, 0x98e5ce39, 0x83fe1ec1, 0x7c41f7ae, 0x33f7f8ef, 0x415def7a,
+       0x437e82f5, 0x9a2e494b, 0xe4396c84, 0x3e416058, 0xae487984, 0xe918721e,
+       0x3a080ebc, 0xe9af673e, 0x5b3fc308, 0x69fcdfcc, 0xc1ffd43e, 0x9340eb9e,
+       0x1e973d4c, 0x885f2f41, 0xe82b3bf3, 0x7bdd29a6, 0xfc04c953, 0xcd1e62fe,
+       0x0dfece7b, 0xdcb27fbd, 0xc69f1ff6, 0x3aa72efa, 0x4f7cfa8e, 0xcf19a568,
+       0x1f9bd0f5, 0xabb4409f, 0x7b235fe3, 0x7ee3e4ef, 0xd0f89a33, 0x78cf3b12,
+       0xadf3fc90, 0x8b7f9688, 0xc80f864a, 0x91667abf, 0xe7121e79, 0x1e4259eb,
+       0xddb8554d, 0xe7e56f5e, 0x5fb25f55, 0x8b8afea6, 0xd2af55f6, 0x5ae4f28d,
+       0xf29b7fe4, 0x7d4bd124, 0xbd97a73e, 0x0a0f9e82, 0x63ecce7c, 0xed97e89d,
+       0x196e982f, 0xe23ef80b, 0x1cff13d2, 0x52c6bb19, 0x291dcf06, 0x024bf095,
+       0xd6c97a6c, 0xcf00a9b5, 0xa7a22452, 0x1dad92fa, 0x967fd04d, 0x03a94135,
+       0xb3f9e8f8, 0x0eaf3416, 0x9784bc05, 0xe3f872e9, 0x1b9e1754, 0xcaccd3c7,
+       0x4ffe8cb0, 0x8cbf63bd, 0xc46df6fa, 0x2ee311ab, 0x7567c11e, 0x6a571f04,
+       0x238fb82c, 0x2f2126a5, 0x5e51e33d, 0xd537cace, 0x7c75a18f, 0x1a4c6c7d,
+       0x506f77be, 0xa73c95f8, 0x7e82c9ff, 0x6b27ccea, 0xccdfa053, 0xd7196692,
+       0x912cd47b, 0xd7da3cfc, 0xc793f944, 0xd2ac393b, 0x74073d2d, 0x5b6fbc79,
+       0x6fb61273, 0xd53e4897, 0xe21d2f2b, 0xa7d38fea, 0x0b0f7e3a, 0x3077e1b6,
+       0xb7af29cf, 0xb1f53e60, 0xcccf05be, 0x7f1c3c01, 0xb8c43f53, 0xc0ad1f4d,
+       0x244cdf71, 0x356d9e3a, 0x8cb1f469, 0x5e84694e, 0xd36f1ead, 0x0d4af5c0,
+       0x29cfd3c5, 0x7806e592, 0xad5df3de, 0xd191397b, 0xbd77da52, 0xe14c7be8,
+       0xa1cc797c, 0xd63cbe23, 0x8a9cb8f7, 0xfb4659f0, 0xde769991, 0xb21a92fa,
+       0x5b29ceaf, 0x826744f5, 0x54f1d50f, 0x4f8a3e3a, 0x9ced1e23, 0x6df68fff,
+       0x1dbd20b3, 0xe323bf75, 0x89675d39, 0xa1d0571a, 0x5df0dfaa, 0xda9fa471,
+       0x7ef3fb51, 0x3851eb86, 0xd7946bfe, 0xd57d238f, 0xa7a2643b, 0x9afecaa3,
+       0x27bf8614, 0xffecd262, 0x9ac91dfe, 0xda7597f1, 0x5db47034, 0xdbfdcfb5,
+       0x0ec4cba7, 0xd847a466, 0x3ec2f947, 0xe0771fd2, 0x1768aefa, 0xf7e8eb29,
+       0x45d90649, 0x8a2edcf9, 0xbe5487b6, 0xb889d66e, 0x65c78eac, 0x58dff9a3,
+       0xf1eec3fa, 0x8e492ad8, 0xc65bbfbc, 0xbe9073ba, 0x8612a3e6, 0x75d01ef1,
+       0x15fc23a7, 0x078b6deb, 0xccad7c39, 0xbfbf6976, 0x3f37bfca, 0x1e77d4be,
+       0x367495e5, 0x6561df4c, 0x07e518ab, 0x9e786be8, 0xad665e11, 0x258bd488,
+       0x8d2df1fd, 0xd84ba45d, 0xac78859b, 0xf1e46b38, 0x38e89e8f, 0x851fea97,
+       0xae2bf225, 0x93ea2e52, 0xe67bb8f9, 0x7f6778f0, 0x938f3379, 0xe5fc0915,
+       0x5d691a94, 0xdcf7808a, 0xb59efb16, 0x41fa54a4, 0x07dfa2f9, 0xef8029df,
+       0x61e690af, 0xb1553d9e, 0xca5291d7, 0x9777b5e3, 0xa14af278, 0x15f12a2c,
+       0x3d5e2296, 0x77d35f60, 0x9f643dc5, 0x33bce3a9, 0xfd16e3ca, 0xbcc96146,
+       0xee8f0edc, 0x6863ed07, 0xe3d8869c, 0x7a38fb40, 0xf6ec6e7e, 0xfc39b843,
+       0x30fb237d, 0x0c0643d2, 0x52f2a664, 0x16e5e32a, 0x8846aefa, 0x1e0de7fb,
+       0x9146f3d2, 0x103788af, 0xf4c7fc91, 0x1cbe34f5, 0x58f7419e, 0x8325d82d,
+       0x7691f9fb, 0x6a84ac94, 0x6aade322, 0xdf94a8b9, 0x1528ce73, 0x604cf3ef,
+       0xa8afc813, 0xea3cfcbc, 0xc3cd43f3, 0xc85765ec, 0x63f35e7b, 0xc3fa49d3,
+       0xa55f27e4, 0x4a0e607d, 0x1f39df91, 0x4a89bf6a, 0xc28a1c94, 0x5cf350d3,
+       0x22dc79ed, 0xd76af6e8, 0xcc7a655d, 0x2ed1f94e, 0x056b07ce, 0xd5dbf57d,
+       0xbe3f1e3f, 0xfe861f3f, 0xfefbd9ca, 0x4a7ef893, 0x37a56842, 0x145e7ec6,
+       0xe531f9fb, 0xce70d3c1, 0xfba18c1b, 0x0799ded1, 0xd20263a7, 0xf1f2c77b,
+       0x9eb005f0, 0x2dfcc537, 0x6feb9596, 0x1c5b4785, 0x1ef998ba, 0x7a78fe6f,
+       0xd93f0da2, 0xdce395ff, 0xa7206dfb, 0xd07d1e5b, 0x7581b0ac, 0x15d96b30,
+       0xe347f9ce, 0x6d5d7513, 0x625e305b, 0xf7aabd4d, 0xaf5c5a14, 0x697de024,
+       0x764de7ed, 0xb4460efc, 0x43c6a03d, 0xc6a5bd54, 0xa4bb544d, 0x1fe3c1c2,
+       0x7bfced33, 0x69f6153d, 0xb20fdfa4, 0xaff21aae, 0x226d3b30, 0x19fd0ab1,
+       0xe4fb5add, 0x4657bf3a, 0x9eda2a3b, 0x45334da8, 0x7abd07d9, 0x1715df94,
+       0xfe54fdb5, 0xc454acf8, 0x17795451, 0xcf9a4765, 0xbb40499f, 0x670bedeb,
+       0x8d142e28, 0x5c2eeb9f, 0xaebd9fde, 0x83f74f5d, 0xb7ad71d1, 0xfdd2e42f,
+       0x1baf11a0, 0xcccad4c1, 0x808cc43f, 0x6b7b4c97, 0x18ec1195, 0xf82983a3,
+       0x58fc36dd, 0x8d0dc633, 0x7c9c7817, 0xd7fb9d84, 0x2fc18b89, 0x95335185,
+       0x78c17da0, 0xef48ce7c, 0xef5d99d3, 0x09bdbd91, 0x9e2186ea, 0xa6199ec7,
+       0x5307118b, 0xc08a63cf, 0xb7e66eef, 0x4d81efe3, 0xf7f78bb1, 0x59db462e,
+       0xa22d3cfc, 0x2d62e27f, 0x3ce22d3e, 0x435b8327, 0xd3ec79df, 0xe7116f3e,
+       0xfb1a596b, 0x63a3ec1c, 0x7aa2439f, 0xc5b6130e, 0x596c39e1, 0x758a4dbc,
+       0x2f8b990e, 0x845b0e7f, 0xefd2a95f, 0xb204acb4, 0xe8a6f7af, 0x7b41fbe8,
+       0xcb59c313, 0xb2fdfe31, 0xaccfde99, 0xb4367110, 0x6b9f10a4, 0x84bf97b7,
+       0xa371db71, 0x7b8e74f5, 0xbcffd125, 0x60feff8e, 0x1fea78cf, 0xf883b327,
+       0xfb0780bb, 0x1bbbe9aa, 0xd3bbfcd1, 0x33dd007a, 0x3db9ceb6, 0x839c016b,
+       0x9980fb25, 0xcf839bfb, 0x4a3fef07, 0x7b4bbe05, 0xa654b9f8, 0xbda3d49d,
+       0xec66f25e, 0x8fe351f3, 0x3a9da47b, 0xaa362b20, 0x98fc8baf, 0xeca33b91,
+       0x642db3e9, 0x47c65b67, 0x39c0f7d5, 0x9f8ebdd1, 0xa1d916ec, 0x87ebaf3d,
+       0x114aa738, 0x7d7f3087, 0xfb65e28a, 0x7e714efa, 0x25c6d1e9, 0xfe5df727,
+       0xe7135e9c, 0xa1c453b4, 0x00e22e7e, 0x7e7fc29d, 0xf2a4e023, 0xea9b80cd,
+       0x04280adf, 0x0b940aef, 0x77cfc161, 0x47cb3e56, 0x84aaaf17, 0xcf47edfb,
+       0x7f7dbf73, 0xbe83a862, 0x42de74ef, 0xbda417df, 0xdbbf144d, 0x2c727c07,
+       0x1fbf49ce, 0x4cdb3478, 0xa5a3b3f1, 0x8a7bfbbf, 0xd16b7cbb, 0xc70bb8f1,
+       0xeb4e7ab3, 0x6f184e70, 0xee8b855d, 0x47e036a5, 0xeeffa114, 0xffbe8932,
+       0x040e1b34, 0x3a5445ef, 0xf169f537, 0x65ff0f59, 0x1ddff195, 0x617f42c8,
+       0xa4e88b8c, 0x2273ef42, 0x4fba373e, 0x571e5f91, 0x871beed8, 0x7af18071,
+       0x14fbbe26, 0x3bac4534, 0xe0426f0e, 0x44895379, 0x0a1a73df, 0x86e5d1bf,
+       0xa32fae54, 0x3475ffeb, 0xdd1b83d7, 0x773ce8db, 0x50b2ba3b, 0xf913efaf,
+       0x2964b310, 0x285fbf48, 0x1cb1dd77, 0x65915bf6, 0xc011bb1f, 0x6853a32d,
+       0x4f4afbfd, 0xd8f81c53, 0x21c65785, 0x76b31dfd, 0x79ce305a, 0x53dfc9cc,
+       0xf9951387, 0xf29db77b, 0xa4f2312d, 0xe958f2d5, 0x95fdfa22, 0xef7cfc7f,
+       0xdf7cd1da, 0x0af5524c, 0xfb815b8c, 0xdef9424d, 0xc3f902b2, 0xfc83b998,
+       0xaa73e8cc, 0x88b35f70, 0xfc64f3de, 0xb6bf4f7b, 0x3f782c86, 0x0267ed1c,
+       0xff426c7d, 0x3d04f778, 0x5eadaf7d, 0xe782e7e6, 0x1fa4e788, 0x997e13a3,
+       0x65667c76, 0xc0fa633e, 0xde1d6079, 0xf13ad0d7, 0xadefaa3e, 0xf86292bf,
+       0xc9d683b5, 0xf9589efc, 0xcdcfd1b0, 0x9a20b276, 0x1615b386, 0x709fa176,
+       0x99c69f30, 0xcce3e56d, 0x9b7c7112, 0x1759ffa0, 0x81df9475, 0xcf80d6f4,
+       0x7927cc95, 0x50f5cc72, 0xb7ac1d57, 0x41c6ce1e, 0x569346fe, 0x5b39090e,
+       0xf745525f, 0x07dcc7bd, 0xbfbea3c6, 0xe1e574be, 0x9fc22732, 0xb74154d4,
+       0xd52fa529, 0x945a5d20, 0x4c2f8a2e, 0x5d74cb76, 0x36b97d78, 0x17afd14e,
+       0xb44bf4a3, 0x928fa8be, 0x54f7113b, 0xf9c4434e, 0x4b9f72cf, 0xab83a488,
+       0x2f1ccbc7, 0xd67baf7e, 0x1da71e05, 0xe9f7978c, 0x7803a573, 0xd8ef3e89,
+       0xa73e8978, 0xeaad3c01, 0x8c1dcbaa, 0xbf6f155f, 0x1ac9792e, 0x8d1be799,
+       0xaf8a1fb7, 0x4156d1e6, 0x579e5caf, 0x3b7dbe08, 0xb771443b, 0xeff94bb7,
+       0xff731d4b, 0xb3bfe296, 0x0d63a858, 0xcbe045ca, 0xe8f94239, 0x344ce423,
+       0xf4f8061e, 0xbf2e283f, 0x28b7f3fb, 0x21caaa2e, 0xea25f213, 0xea1fc113,
+       0x1f9099b9, 0xf02f6f91, 0x2d5e87ef, 0x457ca87f, 0x383f21eb, 0x1fcc8fa4,
+       0x5fc5dffc, 0x18cd717b, 0x52167617, 0xd1cab83c, 0xac7bc7a5, 0x3dd250c9,
+       0xd27f8892, 0xf5919c3a, 0x591c6e3c, 0xa12f714f, 0xa6b8d4f7, 0xbb3ebeda,
+       0x5518412b, 0xc24d47a4, 0xc4fd51de, 0x64538e7d, 0x54faaa7f, 0x57fef716,
+       0x08f74fab, 0xfb543a7d, 0x79bb73de, 0x43cbe7dc, 0x1c800f3d, 0xa46f9c9f,
+       0x0e4cb8ef, 0xa3dfcc3f, 0xfe498470, 0x9137746f, 0x69fb0c1f, 0xe604a346,
+       0xf3e64475, 0xf3bee5a9, 0xefd60a6d, 0x0af4bb95, 0x16ff07f5, 0x568603e0,
+       0x0d869dfa, 0x137d738f, 0xd651f457, 0xba83dee5, 0xe6994fb3, 0x61efc24a,
+       0xdf835f6f, 0x8c2a0b01, 0xb598ebbe, 0xee458bb4, 0xdc31a5f7, 0xff9c9daf,
+       0x68071dd6, 0x69ea1fdd, 0x035768dd, 0x9d964f9d, 0xcfe7050e, 0xfd23dbf6,
+       0xf7d97dec, 0xb7009dda, 0x086c697c, 0xa3c37ad1, 0xecf3017e, 0x078d5733,
+       0x73ed8d4b, 0x0bf5181f, 0x7346c7c0, 0xa3cc04d5, 0xdbdfb6ac, 0xdae51f3e,
+       0x60265bd9, 0xbcec1bfc, 0x83b7d456, 0xcdb7dff6, 0x5d3bbf8c, 0xd69f78ed,
+       0xabafa231, 0x5abfbf06, 0x48f7e0ed, 0x87bed1be, 0x7b404cc6, 0x73c1ec39,
+       0x0c9f344f, 0x164cdd22, 0x2f1765eb, 0xbd41fc51, 0x9e73d997, 0xf8ff47d3,
+       0x8fb80f40, 0x455cbf6b, 0x7db922f7, 0xa026f9ba, 0x3c7d75d5, 0xf1db0c7f,
+       0xbf58e07b, 0x001d8628, 0x4be75cf3, 0xcaebf3c6, 0xde8637ba, 0x36fbedcd,
+       0xf6e783e0, 0x44bc7064, 0xc31e6fb7, 0xafb882ed, 0x9272cfde, 0x7ff5c03d,
+       0xf312c0b0, 0xa9b7553b, 0x3b1ad2fa, 0x552d450f, 0x23daa579, 0x21b35f80,
+       0xc69bbf02, 0x7cfdff70, 0xf103a7a9, 0x7fe77df7, 0xe50b710a, 0xf6cf52f1,
+       0xae91c331, 0x97ad5f04, 0xee01c663, 0xc5a3f31c, 0x13416e2b, 0x73beabef,
+       0x86e96fe9, 0x7441dba6, 0xf8e95065, 0xffe3a221, 0xe27bf48b, 0x20efd0fb,
+       0x14fe7479, 0xd347c3dd, 0x03bf4ab1, 0x9be6c874, 0x79e80692, 0x7ec1ba28,
+       0xe806928b, 0xfb7ea87a, 0x931fbfce, 0xe9c607de, 0xabdd2cbd, 0xd059b7f4,
+       0x540f7a91, 0xfd79ce29, 0xfeec8cd7, 0xf5463da3, 0x7e35c677, 0xca3fe811,
+       0x72b0aea3, 0x37b47fb9, 0x3d19fb97, 0x9a9fba66, 0xbe295ee9, 0x235d0dbb,
+       0xf211adc6, 0x75dba67e, 0xeaaf3959, 0xfddf550b, 0x43777c4f, 0x00800098,
+       0x00000000, 0x00088b1f, 0x00000000, 0x7dedff00, 0xc754740b, 0xeebd6095,
+       0x91a93fd7, 0x16883e9e, 0xc085a092, 0xeb404616, 0x7d3d05ff, 0xa71f3210,
+       0x900b18c1, 0x04e08b4c, 0x60dd491b, 0x9e3d90e2, 0x123231a1, 0x1f62cd9f,
+       0xbd6678cc, 0x8c030d39, 0xc077b19d, 0x0b611c56, 0x3837e2dc, 0x71c6ec4b,
+       0x3c4c9c18, 0x6c0843c2, 0xc718d36c, 0xbc4ab243, 0x0f7adef7, 0x0b756bf5,
+       0xcceb43db, 0x40e75764, 0xaabd5ea9, 0xfeeb75ba, 0x7ad3d56f, 0xcecc6333,
+       0x53f817d8, 0x08acbc3d, 0x65cb191a, 0xfc05f3f4, 0xebf2e2db, 0xdf632b25,
+       0xb4cbeeb9, 0x2c93f943, 0x1e670adf, 0x355faf63, 0xb188acca, 0xf6e3a9ae,
+       0xfa87b3ea, 0x8c08758f, 0x127b4315, 0xef768674, 0x0077c154, 0x27d1311e,
+       0x7d1e9d2e, 0xfd4c9fde, 0x8795cdae, 0x9d32fab3, 0xaf7a6863, 0x59b18d3e,
+       0xca0e9bf8, 0x332d9320, 0x5aedcca0, 0xcca012c7, 0x9636f92c, 0xb12e624c,
+       0xf2933184, 0x6bcae99e, 0x39f015df, 0xfe831993, 0x56f595eb, 0x0d5d7f30,
+       0xcccf31c0, 0x3889f1bc, 0xc9c9d37a, 0x97cd5ed0, 0xd769e30a, 0xfe9fde1d,
+       0xe4f329a5, 0x572e3630, 0xfbcdf5a0, 0xf04cf98c, 0xeb6e756b, 0xe7033602,
+       0xd1cc7187, 0x1e60a9c7, 0x1d01e999, 0x2adb5ee5, 0xaa6b3fe8, 0xafe5e1c9,
+       0x6cdef84b, 0x3e1bdfc6, 0x4ac67ace, 0xe2d9c686, 0x54fac809, 0x4c498ec6,
+       0x6f5b2fe9, 0xf8e767c1, 0xb2857ac3, 0xcd6e533e, 0xebcbc455, 0x07e1c792,
+       0x860f6778, 0xcb1d6f8d, 0x55633a58, 0x8b9f699f, 0x387d6d0e, 0x58fb305c,
+       0x5f4fe5fa, 0x33467cc0, 0x5d398fc7, 0x5d79f847, 0x3e90fa32, 0xeed4ae2a,
+       0x4b189362, 0xfc87ec96, 0x992adcf0, 0x36053e1d, 0x7e53f633, 0x0402b8af,
+       0xc29fed04, 0x738014bf, 0x5aef6e9b, 0x16ddd027, 0xa21f4c6c, 0x4c0b2597,
+       0x2e96381a, 0x9bd4d449, 0xea69c79a, 0xd44f57cb, 0xdb736fec, 0x43fa9add,
+       0xea6a661b, 0x354a27ae, 0xd59d55f5, 0xef56f19a, 0xff69ab9c, 0x686feed6,
+       0x7f9e6bea, 0x747f5350, 0xe911caff, 0x885f1a22, 0x89e991b6, 0xd23b0579,
+       0x3a4d88bf, 0x9cc5cffc, 0xf7f7a3d3, 0x7ec27f21, 0xb7af6ebd, 0xd5fe82ad,
+       0xe78d3f57, 0xc5f4b4fd, 0xf90072bc, 0x17d956a3, 0x402bc798, 0xad528d7b,
+       0xf445be95, 0x4536635e, 0xee951be4, 0x11560ab6, 0xda66afc7, 0x6db0aafd,
+       0x7e47aebd, 0xebd01a2e, 0x3759be61, 0x2157fcb5, 0xc706fc35, 0xc7afcc67,
+       0xa5cb84f5, 0x9318eeff, 0x609e397a, 0xfc017fb5, 0x8cc9acc4, 0xa3c74795,
+       0x5db7a74a, 0x6f5f6337, 0xeafccadd, 0xa0582b7a, 0xda3ee90e, 0xfc3b67ba,
+       0x516b927a, 0x5ebe1dd6, 0x6feffe15, 0xef815f86, 0xf323ff5f, 0xdb1013ed,
+       0xe6fc88b2, 0xcfeb5ddf, 0x02402bb5, 0x7a1527bc, 0x278291a8, 0x0e908b12,
+       0x83650398, 0x51f99071, 0xc133d40e, 0x9652846f, 0x38af041c, 0x3034ef68,
+       0x7e71eb2a, 0xa6861071, 0x35eb45d2, 0x288dca0e, 0xa92c456f, 0xebc79cee,
+       0x875e068e, 0xd52ea8f7, 0x3ee7baf2, 0xea92875e, 0x43af275e, 0x5aefaa3f,
+       0xb8cef58c, 0x014489c0, 0x5825beeb, 0x5a1e0e37, 0x05ff4bca, 0xe4994a81,
+       0x5de83896, 0xec7ea7a7, 0x3707af22, 0xf2d0fa71, 0xf65e3183, 0x5f19b3f9,
+       0x813f3c3d, 0xfdc24dbf, 0x006fd75c, 0x828ad43c, 0xd5ef0ec3, 0x3f87320c,
+       0xe4d5f715, 0xe097d990, 0x3133a033, 0x8ccf886d, 0x4ab1982c, 0x0f793e20,
+       0xedcaadf1, 0xe968e3e1, 0x5af51eab, 0xfc3bec01, 0xe51931be, 0xfaa7a730,
+       0x2c12e0b2, 0xd013f9f1, 0xfc327b3e, 0x1f4e1e4b, 0x32a25c2a, 0x5fb5a55f,
+       0x32b6aa8f, 0x59b72618, 0x8559d117, 0xd92c9d79, 0x716dcb87, 0x2e2fe550,
+       0x56e1c22f, 0x1f39ade5, 0xfb1a6cf8, 0xb9967c3a, 0xaeb36a0a, 0xd9f0abbe,
+       0x933e30ba, 0x8496f7ad, 0x321019f0, 0xb7d9f0d3, 0x276e9e89, 0x83094e5f,
+       0x4f182675, 0x23e80cf6, 0xc05499ca, 0x3e244243, 0xb21bfb9b, 0x97c8a21f,
+       0x5817f037, 0x987e6e67, 0x5cf4519c, 0xfee7aab5, 0xdda2b3a8, 0x117a67e2,
+       0xc87c70cb, 0xd2313b2c, 0xbe3cb573, 0x6bba0609, 0x90f80ea8, 0x63be810f,
+       0x06dc151f, 0xcec99bcf, 0x805ab862, 0x31e2aac7, 0x71ad6e8c, 0xec909d2f,
+       0xecf505bc, 0x4e6e8518, 0xdf11a766, 0xc7bd76c3, 0xb59de442, 0x01f1cbe8,
+       0xc70937cd, 0xbf226673, 0xc6db40d5, 0x33fde182, 0x99f00fb1, 0x3e7cc835,
+       0x08eacf78, 0x46af5808, 0xf48d9efd, 0xfe51eacf, 0xe8095f57, 0xe5a5ea25,
+       0x00745b97, 0xa4013fbf, 0x517c8b57, 0x642e9c30, 0x7ee3d3e6, 0xaffdd57c,
+       0x90341fb6, 0xffdb0ebc, 0xcfb0419a, 0xd5394e00, 0x1afa20e4, 0xc8cf6464,
+       0x48c7c14e, 0xbc21acbe, 0xade3f6a8, 0x176826f6, 0x622e91e8, 0xf640b37b,
+       0xb36ca7d0, 0xf305f381, 0x867a55fa, 0x30afcbe7, 0x34ed1139, 0x7ed4f3cb,
+       0xfa23136c, 0x3c97b6a8, 0xb8476755, 0x44cc7606, 0x0abd24b8, 0xc7153f97,
+       0x70e260bd, 0x7f08daf9, 0xe4fe0ad5, 0x43331d41, 0x694fbfbb, 0xff5fa30f,
+       0xfcd3b720, 0x702bc44f, 0x43f0c8dd, 0x4ed007bf, 0xe5689306, 0x43ff03dd,
+       0x69dcf784, 0x01df3f77, 0xf028ae5d, 0x6e856ffc, 0x5124da3f, 0xf5cd3eb9,
+       0xc7a07cfd, 0x7c6e917f, 0x0fc866e2, 0xd5f74439, 0x9027cff6, 0xd9f1521e,
+       0x10f48637, 0xe8f84dc2, 0xdb8344b3, 0x387510aa, 0xe5bf0abc, 0x2a57c88c,
+       0x577c2a9c, 0x0bab7a7c, 0xe7b37bc6, 0xf61c135f, 0x454bf821, 0xfb847ee7,
+       0x674fc1cd, 0x92ef88b8, 0x34667635, 0xfc5266f9, 0x964ca488, 0x3ea2a62b,
+       0x85cc7388, 0x74cb8c75, 0x364cbad1, 0x02fd1da3, 0xf393274b, 0x82734860,
+       0xf7f08ccf, 0xd2ec37a7, 0xa9d6fb43, 0xfbc13322, 0x36bcb35b, 0x09fea75a,
+       0x9399eb86, 0xd60361e9, 0x6577f3e8, 0x9c11293e, 0xbf475083, 0xa2f1c6c7,
+       0xf8f4689f, 0xc75fb9e0, 0xc10a1cd6, 0xee02c1cb, 0xe7cd9d8f, 0x1e17dae5,
+       0x842976d9, 0xad0fda3f, 0xbdddd4d3, 0x2976dbdf, 0x106ede54, 0x3697dc44,
+       0xd9db8e85, 0x5ff404c0, 0xe13b455a, 0x903743a1, 0x2c6bf586, 0xae0a7e78,
+       0x008fe70f, 0x5be73fff, 0xd2ff3d62, 0x8ff650a9, 0xff69fee1, 0x0df91f24,
+       0x2b1ffcea, 0x5f38ffeb, 0xa6387317, 0xb3ba1e01, 0x9f70c5bf, 0x3f7c6c6a,
+       0x7a72504d, 0xf54372e6, 0x739e8677, 0x3ea55179, 0x73de3a0f, 0x1ce91d12,
+       0x994c76a8, 0x7de911f6, 0x71bbd227, 0x48b5bea8, 0xf08be8d7, 0x220573fe,
+       0x16c07bc1, 0xa15b3db9, 0x5c139d97, 0xdfe8d9dd, 0x6c73ab3f, 0xcbce2586,
+       0xe51e3adc, 0x7adb56fd, 0xe2e653a2, 0x38c058eb, 0xf4cbcebf, 0xd1e81978,
+       0x82b7fe79, 0x8dd62a42, 0xf886c2cc, 0xe70bf557, 0x01d13e89, 0xd7f2bbfd,
+       0x5ddd7199, 0x1c66f5b6, 0x82d684cf, 0xea3c386e, 0xe6ec0fba, 0xf4cbcef3,
+       0xb2e9e089, 0xc57bb9b9, 0xa33fa801, 0xee5e7bac, 0x6aaf6a3a, 0x09149ff4,
+       0x4367e07f, 0xf568e8dd, 0x87263ce2, 0x3ac246bd, 0xb2c66c73, 0xec89784f,
+       0x0dbf5513, 0x9dad4fe9, 0x91bafa72, 0x15d763e4, 0xf244cf9d, 0x07305e53,
+       0xbcaf9fde, 0x7b720d6d, 0xa3bf6bbe, 0x1cf7c45f, 0xf3e3f902, 0x764dbf73,
+       0x2e77359d, 0x56b3e7b7, 0x98549179, 0x3fa1f04f, 0x5bc54f31, 0x195f569e,
+       0xa0b7171d, 0xd4de30fa, 0x2c59d1ea, 0x2abe90c0, 0x70f3fcc2, 0x40bb3b7d,
+       0x5972d7b1, 0x2d2bda31, 0xc863df26, 0x420d960f, 0xe2a1c23a, 0x8e814575,
+       0x7c8620e8, 0x942667b0, 0xb465d95d, 0xd3ccfaaf, 0x5f980417, 0x4366df17,
+       0x8cdbd0be, 0xb31bc47e, 0xa80d1f8a, 0xffc24df3, 0xb7b22533, 0x2f848eb0,
+       0xfc79397d, 0x86c7966e, 0xb032eceb, 0xa7f248a6, 0xfdf380b6, 0x927e5907,
+       0x8ddad10f, 0x7bd2041b, 0x66377caa, 0xc237d932, 0x5c8cdb78, 0xd25f80ce,
+       0x3ebf402b, 0xffa017a4, 0xf7b35a17, 0x7ba205e9, 0xadf1e519, 0x12efb152,
+       0xfe1fb90b, 0xca898166, 0x547eca93, 0xc336717f, 0xaffc8235, 0x8430f2aa,
+       0xc7ca94df, 0xf1f26533, 0x732f224c, 0x2e3f7195, 0x5cdc7ce2, 0x5fb97b14,
+       0xfb7a339a, 0x8d7a4b1c, 0x90285287, 0x98dd79e8, 0xc52e4987, 0xa3396f12,
+       0x5da33788, 0xa7073fa1, 0x73fdb513, 0xaaffde45, 0xb274e620, 0xe51472b4,
+       0xa4e92c41, 0xde83cfe2, 0x79ff97cf, 0x68da47ec, 0x99a3e3ae, 0xe042d4f2,
+       0x2e9cbf93, 0x96e583df, 0xbbdb23d7, 0x772f63f3, 0x72801ed3, 0x37df04f1,
+       0x79b3e923, 0xfb97b185, 0x48bed14b, 0xf845f6e1, 0x3d15cbfc, 0xd2794b14,
+       0x11b36504, 0xff011fd6, 0xfcc28e8f, 0xef5073cb, 0xe5817b72, 0x0fa4b99e,
+       0x67e1dfb1, 0x3ec42eb2, 0x1c147b06, 0x0543b441, 0xeddd9239, 0x2d7efd8d,
+       0x643f487d, 0x5c61ccaf, 0x2ff3a81f, 0x7af8e12c, 0xb0e0147a, 0x25eade00,
+       0xc29baf6e, 0xbfcb50e0, 0x7dbd8c2d, 0xe043e92a, 0x1fbb0548, 0x444205cb,
+       0xd0a7af7b, 0x1a7e7318, 0xe2d9780b, 0xe4918d60, 0xefd8c9c9, 0xca0d9a4b,
+       0xd3cee9aa, 0x4b96d728, 0x5c60e787, 0x1ff8fbf9, 0x79d21be6, 0xc1a561be,
+       0xaeff45e5, 0xbc3bb24b, 0xac478c76, 0x7ccafaa2, 0x52af43bb, 0x94dfb63e,
+       0x6c05db7c, 0xe57d51d7, 0xda1f24ef, 0xd617dfc3, 0xf1c6c99d, 0xfb1deb36,
+       0x959dc618, 0xe78d837c, 0x9e36ac1b, 0x3c6d109f, 0x29b560ef, 0xcf1b0779,
+       0x4a6d583b, 0xf3c6c1de, 0x929b560e, 0xbcf1b077, 0xe4a6d583, 0xef3c6c1d,
+       0x7929b560, 0x3bcf1b07, 0xde6a6d58, 0x1538d3c1, 0x9e3691e3, 0x78dab077,
+       0xe36ac1de, 0x97980779, 0x3c6c1de7, 0xf17000ef, 0x722d83bc, 0x943ac1de,
+       0xf1ff2077, 0x67a49618, 0x547f5fb8, 0x7b06cfa9, 0x786334dd, 0xe76ab55e,
+       0x17182dfe, 0xfc7209ab, 0x5e783955, 0x77b414d9, 0x457e300a, 0x04dfb066,
+       0x114565fe, 0xb0d5f0c3, 0x13f3c3f9, 0xbde7d9dd, 0xb0a3fa02, 0x03bc2997,
+       0x18ea29e5, 0xfe7c3f7f, 0x3b577161, 0x65d6e78f, 0x3bf08b7e, 0x78482cbb,
+       0x8718e7c3, 0x13f253ad, 0xffad56b5, 0xb2e67f2a, 0x995f71f9, 0xf80899d4,
+       0xbb6d4590, 0x8c2ff988, 0xd7f15ebb, 0x6ab7dc61, 0x15771b50, 0xb8d41b33,
+       0x844bcf3c, 0xe1df39c1, 0x6b045f1c, 0x2a7f016a, 0xc1cfe601, 0x53ae15a4,
+       0xa45e7c12, 0x881bddb7, 0x453bbcbe, 0xaa6814c7, 0x9e606404, 0x6a2012a5,
+       0xc654d286, 0xf24cd2ac, 0xfe9d389b, 0xf1bdd4d7, 0x030f28d9, 0x6c04467a,
+       0xf9a83c23, 0xbf580485, 0x2bfc8334, 0x332aeff2, 0x3a47bffd, 0xcc82eb50,
+       0x5d8238f3, 0x2f80cd62, 0x5c266ef9, 0xceab9336, 0x45eb6f90, 0x73c335e6,
+       0x9b37e941, 0x2d4e2905, 0x76f28933, 0x6541ccb5, 0x695774d1, 0xcea3f011,
+       0x7ae175ec, 0x0966ecaa, 0xee3d85f9, 0xf148db3c, 0x32e97ae4, 0xf60049e0,
+       0x48da62f8, 0x2ec88a76, 0x451cf8ab, 0x2f1f48bb, 0xadc92278, 0x61ebd88a,
+       0x0a2a83b2, 0x2dc7c919, 0x7cfcb22c, 0xcfcb84ac, 0xdf5d4b37, 0xfbd73c44,
+       0x878fd516, 0xd0be8f2e, 0x6d9b794a, 0x5bc2f161, 0x6f628afd, 0x90e72447,
+       0xe901b93d, 0x8f04f17a, 0x1688e10d, 0xf62a78c7, 0x1b49ecf0, 0x767baec1,
+       0xd45aec14, 0x2aecb743, 0xfa9399fb, 0xb1ca3b50, 0xd0ba4f0e, 0x9092baef,
+       0xc3ddaa38, 0x8d67143c, 0x6979af1c, 0x9920e214, 0xfe13bfa8, 0xea639d0b,
+       0x87fb023a, 0x54bcfbe5, 0x428ef8e1, 0x634be387, 0xa0d317cf, 0x613e27d4,
+       0x771b8d0b, 0x970e0459, 0xf5c0d041, 0xfdff62b9, 0x78f624a0, 0x7d72812a,
+       0xf22efca9, 0xf974d561, 0x7caa5867, 0xbae1df3b, 0x2d29fc40, 0xf9024faa,
+       0x767f66bc, 0x0689ea01, 0x2ae35edb, 0x52d5f780, 0x3a22fdf9, 0x5b1ff46f,
+       0x1eb16e1e, 0xf7bc478f, 0xa3cb22b9, 0xc50911bb, 0x28de4fe4, 0x67e4fee2,
+       0xfe288784, 0x638bafe4, 0xea7b2fbe, 0xc9fc8673, 0x5b1ffe70, 0x639de3cc,
+       0x068e0147, 0xf1465728, 0xc28ca6eb, 0xbf5a8dfc, 0x443ebf6e, 0x854110ce,
+       0xdc6c69e6, 0xfc1163af, 0xba35973d, 0x147b37bf, 0xf310b1d6, 0xf591b571,
+       0x31c57dda, 0x7e96aff7, 0x3307ca03, 0xd0a9fd5b, 0x6f30bcc4, 0xb2be50da,
+       0x0fafd5c9, 0x383f738d, 0xe537e0e1, 0xb37e7008, 0xf272e638, 0xf91e9c7c,
+       0xe119bd75, 0x7e066ae9, 0x255fb08d, 0x9bffdc25, 0x9611e13b, 0x3a637688,
+       0xe411f743, 0x3637cf09, 0x83637e29, 0x2a767fa2, 0x2c53d472, 0xe52ce952,
+       0xe851b9f5, 0xfbcad7fa, 0xb69c4a8d, 0x2bf26251, 0xec7ff491, 0x38fce6e9,
+       0x71c6e728, 0xf30def38, 0xf453dfcf, 0xd3d89ec4, 0xa00c9ecf, 0x91b5b993,
+       0xf63075f1, 0x0274b174, 0xf6d4bfcc, 0xf8901cf4, 0x0d9b2fb0, 0x2e9c5f94,
+       0xef0c58bf, 0x57c28b6d, 0x69782b9f, 0xb03a3e86, 0x34a05bfb, 0x9010f942,
+       0xfa405481, 0x6fec55ed, 0x14308e01, 0xf1de0420, 0x3af4e7e8, 0xce7c1ee4,
+       0x7fe46d5c, 0xca1bc884, 0x3999569f, 0x83a774df, 0x0efe88ff, 0x9339d333,
+       0x9fcf20ae, 0xfcf26576, 0x6a3c3868, 0x456ff4fe, 0x71cf198f, 0xc4166577,
+       0xebddf285, 0x6f26989b, 0xe78575dc, 0x8a4fc185, 0xc949fad3, 0x8f8527e4,
+       0x74b9909f, 0x247fa85e, 0x021fdcc8, 0x5c50267f, 0xa917e43c, 0x7c98cffe,
+       0x7ff15cf9, 0xcd1dfd02, 0x4947119f, 0x07308b0f, 0x74ddff3e, 0x8f10dff9,
+       0x1fd3d023, 0x9fd3d0a3, 0x347fdfb0, 0x11cc627a, 0xf0cc68b7, 0x1eb2bb71,
+       0x708eb5b7, 0xd321203f, 0x54ce9119, 0x9b7a02fa, 0xe8763250, 0xb4f3217d,
+       0x4b136f4a, 0xbd3ebf8a, 0xf0bec05d, 0xafe1acef, 0xd149d6ec, 0x7ab59dfb,
+       0xfa0f28cc, 0xf19bd732, 0x99d4c49e, 0x6bce072e, 0x006c9911, 0x3e5cbb38,
+       0x007b9e33, 0x64bf2f3b, 0xcdc1bc84, 0x7e3f2e22, 0xdcffecad, 0x2aff9c09,
+       0x7dbe0b96, 0x6c4d7fc0, 0x4df70197, 0x4958ff7d, 0x7b88fdec, 0x35ee4872,
+       0xf7208c96, 0xe2f8565e, 0x2b5f0573, 0xe729d6da, 0xfb445899, 0xfdec5567,
+       0x942b348c, 0x45d75273, 0x745be3a4, 0x2285e787, 0xe21467ac, 0xe4c7e7e0,
+       0xcd4c3ce0, 0xfc406d2b, 0xf1c4563e, 0x7dfecd17, 0xb3fc146a, 0x4ad70089,
+       0xfd0199f6, 0xc7ff5969, 0x11e748ac, 0x39d9158e, 0x0390069c, 0x5995df80,
+       0xfc31b7ba, 0xb5a495d9, 0x67f7d487, 0x67aefe2b, 0x5267e414, 0xf1c3ce0e,
+       0x4c0e7e1a, 0x3ec5cf2d, 0x88b4b01e, 0x80ffb9fb, 0x73fc0efc, 0xe358a4a8,
+       0x64a8fee7, 0xb5f73f64, 0x1adc8f7f, 0xcba8e850, 0x7d9ed911, 0x40fbf621,
+       0xdd60e0e7, 0xb9157cef, 0xaa6f6e11, 0xdbd89ee5, 0x7a59697b, 0xd1c3879c,
+       0x24e7b4c8, 0x28dff16e, 0x8f5d2de0, 0x77e968f3, 0x5ffae325, 0x1a58c385,
+       0xe78c73f3, 0xff31e867, 0x7d79f9c3, 0x94be2ba9, 0x198f36ec, 0x07d837f5,
+       0xb95f6714, 0xcd1f2539, 0x6b67d82a, 0x93be96a9, 0xefa6474a, 0x403bd2e4,
+       0xfc9caadf, 0x534c6117, 0xa899bca8, 0xa5699bc8, 0x29afdfb1, 0x8e48af18,
+       0x632baf2c, 0x73dbe71f, 0x79744e77, 0xfb379eac, 0x4f1b4147, 0x8f25bd6e,
+       0x69474e63, 0x7921faa9, 0x7087eaac, 0x5e868d3c, 0x0bd10c48, 0xcce4510d,
+       0x3631c068, 0x9db51f04, 0x98afe502, 0xc0a6f98d, 0x39d89daf, 0x96c7dee4,
+       0x4f138851, 0xc87f8d0f, 0xa047af60, 0xb1a5dde3, 0xbca37fcf, 0xdb7c37e9,
+       0x47f9d236, 0x28c5d5a3, 0x3173623f, 0xb19fec3b, 0xf6f295b3, 0x94ad05c6,
+       0x029d6687, 0xf498fde5, 0xab79f92e, 0x30a7de6c, 0x9e5c367d, 0x5e398d6c,
+       0x97d8728b, 0x28c537f6, 0xf8ebcd7e, 0x37f93a4a, 0x153ca3af, 0xb347ee24,
+       0xf74ecc0d, 0xb97cafa4, 0x202f58fb, 0x9a2f3012, 0x763ee8c4, 0x7ac7e1a7,
+       0x051b47cc, 0xe65cfe3e, 0x974ff9e7, 0xf0a3fc77, 0x31a0e59e, 0x7f543b7f,
+       0xfb4d9a51, 0xcfe569de, 0xf39bf6bb, 0x9ea5849f, 0xc19e15b6, 0xa753e1f3,
+       0xec1c5327, 0x6b8f03c5, 0xbc5aecec, 0xdf7e80c7, 0x7e861e0b, 0x35d329a2,
+       0x9c3b2471, 0xae927f31, 0xa89a508c, 0xfa5e7a94, 0xf86d9d05, 0xf7f73bfb,
+       0xbd67e848, 0x724cc078, 0x9e81ea7f, 0xe32155f8, 0x3e719627, 0xfe3d06b6,
+       0x35af0019, 0x093273d3, 0xf92b1def, 0xce799173, 0x632bc2d4, 0x0f9d00a4,
+       0x6b5791df, 0x2ebba50e, 0x794cd6a9, 0x639d5ce4, 0xfceb1d8a, 0xf4fc431c,
+       0x4082fdda, 0x112edd7e, 0xe19aef50, 0xec7a86ba, 0xc3eb890d, 0x496b53a9,
+       0xe72a75ab, 0x2de4761e, 0xc7ef8039, 0xf1a7af4f, 0x7b64593b, 0xe5c658cc,
+       0x99068bf0, 0x80f17de6, 0x55c8e748, 0x7c69debc, 0x0f30cbd6, 0xa6dea3e0,
+       0xa7d87ba7, 0xe5114e8d, 0x8134e9d0, 0xdf2d82ed, 0xee8578e9, 0x0288ec99,
+       0xb94a2fef, 0xa96cca9f, 0xf7a77f44, 0x748f2e77, 0xbfa55f7e, 0xa96433c9,
+       0x49c0ed0c, 0xff94269e, 0x36e4b6cc, 0xdf24f17c, 0xe68743bf, 0xcffc03cf,
+       0x227fc17d, 0x6b21f70e, 0xf75c78cf, 0x6a76a507, 0x1f0f45bf, 0xb0f442bd,
+       0xe3efc8c5, 0x8e717578, 0x858eb003, 0xcf1101d6, 0x8352184f, 0x2a6de794,
+       0x8b74f2e3, 0x81630fca, 0x7d3de01f, 0xc507bf06, 0xcea9da26, 0x84270726,
+       0x559ea3de, 0x0597aca6, 0xc2f9f132, 0xd83777f8, 0xf6158c1d, 0xb08b37a6,
+       0xef8985fe, 0x7a86c86e, 0x5e78ef49, 0xb3f778cf, 0xb2b1896c, 0x9f5e0cde,
+       0x9367eef6, 0x9bd15ea0, 0x3095ebc9, 0x9bb078d4, 0xbd9ab37a, 0xa4be3879,
+       0x0f15bf19, 0xfd7f1472, 0x45d26f52, 0x28355f8c, 0x031f87eb, 0xfbece3ce,
+       0xe2ef3a47, 0x78fd5b34, 0x86c9832e, 0x3419f8b0, 0x6077dc85, 0xff2409a9,
+       0xf30bfbd4, 0xf63f7f45, 0x84fd99d7, 0x2759bbdf, 0xad8073d9, 0x7e145fdd,
+       0x5c2e7b79, 0xc8d96dee, 0x8c4e785c, 0xef0966b1, 0xd64c0833, 0x78e3c17d,
+       0x855f9c4e, 0x187f9d47, 0xc8b5b05c, 0x3d70439f, 0x70a8e34f, 0x7937cb5d,
+       0x6b7ade51, 0x0427ae59, 0xe084d74f, 0x456c180f, 0x0f1dacda, 0x1b5d3ee1,
+       0x40209c13, 0x1b7cb93d, 0xb1b5dbed, 0x8e081fc1, 0xef81ba90, 0x096f5b63,
+       0x289763ed, 0x9b9d21b7, 0x216ed68c, 0xb8eeb191, 0xe60c1984, 0xe5d631d9,
+       0x406e7bc5, 0xd8ef7477, 0x1c74659b, 0x8beb3800, 0xc7a1f9b4, 0x83fb3a15,
+       0x98e60f22, 0x01ce7976, 0x047bba5d, 0xdc70f786, 0xa88c3783, 0x5df616ff,
+       0xa4be6234, 0x11a2e7a3, 0xeb03bee9, 0xf3c74e30, 0x6ff988c6, 0xbd5eb963,
+       0x91e74a2f, 0x4f1c4bd6, 0x7aeeb2a7, 0xe9e0152a, 0xbdd02d58, 0x9247f5bc,
+       0x7d7d60e6, 0xb192ae2b, 0xe78755e5, 0x38b4b920, 0x72c29ffb, 0x95381b25,
+       0xccb4240a, 0x10f667a5, 0x4d62b93d, 0xe887b33c, 0x8a4f16c9, 0x1772bea6,
+       0x280cceec, 0xfa686637, 0xeafee531, 0x83f43632, 0x949a98e7, 0xdb665c7d,
+       0xeeb8c019, 0x3bc19732, 0xc2de3210, 0x3262cdbe, 0x1c11edc2, 0xcbd28d74,
+       0xe0ad3fcf, 0x1c52842b, 0xf7cf1f7a, 0xefc40af4, 0xba7a6d1d, 0xcbdcd3c7,
+       0x35e6aeed, 0x202ecf82, 0x0dbdf81e, 0xed40af77, 0xeba7deee, 0x1bef1193,
+       0x47000f00, 0x7d84f8da, 0x9347112c, 0x4ad5dce9, 0xdf775605, 0xb38e0339,
+       0xdd023be2, 0x9bbf5567, 0xb2bfc2a0, 0x91ce91a9, 0xa45e7c01, 0x4d9d754f,
+       0x5ce947f6, 0x9789cad5, 0x6187a80d, 0x3406977d, 0x5bd6d4f8, 0xcafada3c,
+       0xd1fada8d, 0xf29ee532, 0xf90d3634, 0x209978e9, 0xb52439e2, 0xf9d651fe,
+       0xe75ef1b7, 0x0a79d16e, 0xe8cdb3e9, 0x7efa819f, 0xbaa2e8b7, 0x3bcf0eda,
+       0xf89df118, 0xb1f100e1, 0xc5b9fc40, 0xf8354b20, 0x8176973d, 0xb60576e8,
+       0x0f67f3ab, 0xfd754fbd, 0x554dfaf0, 0x1b9c5aee, 0x4730bbe8, 0x90ed0905,
+       0x9316517a, 0x222f88f3, 0xbdf9779e, 0xa36f07c2, 0xeeb803f6, 0x7d852242,
+       0x44feebba, 0xbde6179f, 0x3a56cdeb, 0x215776e7, 0xf91d81d0, 0xd6e7475e,
+       0x2f79e3e6, 0x7903ef28, 0x2ef28168, 0x9226a1fd, 0x128d33ef, 0x9ce577c9,
+       0xe42f2a97, 0xb6e7b517, 0x219e67e6, 0xe7beeb3b, 0xb579d276, 0xc17239c9,
+       0x2d0fa8d3, 0x471dfe7c, 0x1866df04, 0x34ef23a7, 0x3271cfc9, 0x61d72f3f,
+       0x2f68e453, 0xfd7551c8, 0x50e3bfb0, 0x692261ae, 0x9bcd1e41, 0x5da9566e,
+       0xf8283926, 0xffe8756b, 0xdde6538e, 0x75a76d5f, 0x487a3da7, 0x316775c0,
+       0xe60166ef, 0x7c3a82bb, 0x55f950ec, 0xf8b5d7ed, 0x565de80b, 0x5b63b5af,
+       0x65e3d745, 0x6dbb5f30, 0x2dcfc8c0, 0x1fa88d06, 0xdef8e0ee, 0xf2c3e348,
+       0x50ee7475, 0x4730fbe2, 0x7680983f, 0x39a3face, 0xf608d8e3, 0xd3acde8d,
+       0x148311c8, 0xf33791a7, 0x67f2b573, 0x772b43a1, 0xa39651be, 0x4f245f69,
+       0xdfdfb4d3, 0x3fa9a858, 0xbcd4ace0, 0x9d5360ff, 0xcdb26ea6, 0xb16fbcd3,
+       0xe3d4d62f, 0xde6b9773, 0xa558e31f, 0xf5bd3769, 0xed0126a3, 0xc077b371,
+       0x06e87805, 0x1e4b28de, 0x12d323d2, 0xe32865e0, 0x2c562d0a, 0x744df3bb,
+       0x3c7bb64e, 0xec4497e8, 0x773a1dff, 0xc97c4e69, 0xdfe5035c, 0xfc5abe0b,
+       0xc9a00e7e, 0x3ddbf685, 0xf0e3684f, 0x5f38abc7, 0xb94365a9, 0x280ac1eb,
+       0x67b05ef3, 0x81e97bf0, 0xcc7f707b, 0x45db8c71, 0x2ec999af, 0x5376899a,
+       0xb071bf88, 0x397e66ba, 0xbe427bf6, 0xf582f917, 0xbc0a6932, 0x3b08cfb7,
+       0x35ee7a8b, 0xebcbf523, 0xe685d01d, 0xce597ff7, 0xceb3c1e5, 0xfc717bda,
+       0xb2d03e8e, 0x7dcf4fc8, 0xaebf4468, 0x013fafa3, 0xe70cd9f5, 0xcfb44687,
+       0x7a2b9e87, 0x61c60c4e, 0x0e1fe39c, 0x63de23e9, 0xa46e5edd, 0x722b4ff1,
+       0x7a3be5bd, 0xf78b4f3a, 0x864a6b37, 0xe1cb73e4, 0x63ef1fa0, 0x7bf3b4b7,
+       0x368e789b, 0xf9069c92, 0xbca861fc, 0xf41d367d, 0x4f1a4cc1, 0x97960fa3,
+       0x3edee9f9, 0xfbcd6fc8, 0x5c34972b, 0xc8257cc5, 0x4cf3ed71, 0xb1961e7e,
+       0x73fa0301, 0xed35d720, 0xfb95cb1b, 0xde58d39c, 0x2e072017, 0xdbdf2338,
+       0x9f8abb7d, 0xaae0b833, 0x16787da3, 0x47e789f0, 0x3f861d9f, 0xe1dbd78e,
+       0x81a465ed, 0x661bfd90, 0xff7157ff, 0x7228e5ea, 0xbfb2a2fb, 0x014084fb,
+       0x33b7550a, 0x8577e88e, 0xa5ed75b9, 0xcf97dc42, 0xdebfa2b7, 0xee8123f2,
+       0xffb2ffc1, 0xac3b34ad, 0x54f878df, 0x7697de1a, 0x86953a1f, 0x0cdb89f7,
+       0xcf68cdf6, 0x3dd07d03, 0x3f5e8ee4, 0xa87edfc1, 0xb79f1fb0, 0x140e0af7,
+       0xeb9eeec9, 0x364eb40d, 0xa3fd15b0, 0x3ae0517d, 0xabedce58, 0x2a76e5c3,
+       0x13982edd, 0xc98f7ef5, 0x1e9013e7, 0x5c213e40, 0x820fc047, 0xe66dbefa,
+       0xd4f648a6, 0x27df0565, 0xde1919b7, 0xfe836dfb, 0x59d38eb8, 0xbdf88da7,
+       0xb0c39685, 0x71d7012e, 0x1c7881ee, 0xa181837f, 0xf7c2a19d, 0x03e05671,
+       0xabfbff5c, 0x2dcf0c0d, 0x27ad596f, 0x81bfbf7c, 0x87fa27db, 0x0335bd7f,
+       0x2e80cbea, 0x270f3bf1, 0x9d38df56, 0xbfbee301, 0x7569db86, 0x2f881b0f,
+       0x6e13ad97, 0xa50e4bdd, 0xff6e956b, 0x70d3a146, 0xdba70dfa, 0xe6baf461,
+       0xdbebd1eb, 0x90ecb7e5, 0x61f7a819, 0x438ce7ff, 0x731efa3a, 0x1a7e401c,
+       0x0718613c, 0x2ada4f70, 0x63c3c039, 0xa7bef5d3, 0x9c6e50d2, 0x6df9ede0,
+       0x7f2e057b, 0x7d71cbec, 0x8646dd19, 0x2a2e08f7, 0xd95176fb, 0x0a0b3b37,
+       0x62cfc8f1, 0xa9ca1260, 0xf9ce256c, 0x1d35818a, 0xe452ff46, 0x8ffa67f2,
+       0x87b77b6d, 0x2b7fefd0, 0xcaab74e7, 0xe64669c5, 0xf7c56c3a, 0x045f8d0f,
+       0xe06cbce3, 0x282735e7, 0x09c94de3, 0x52822c36, 0xe4e5c157, 0xd438156f,
+       0x3e149ffa, 0x437f2760, 0xe6685cf8, 0xd1b79ff8, 0xf8eb8cdf, 0xbd75c999,
+       0x305fde1c, 0xea1b7ce1, 0x3f49eebd, 0xb9dfe3c9, 0xee1d9073, 0xa27ff056,
+       0x63cf37fc, 0x3532cfee, 0x72d7f68e, 0xe90969f4, 0x68a532d9, 0x30f148dc,
+       0xe66ccdf7, 0xbaba014a, 0x5aa54399, 0xaafc745f, 0x82fc8071, 0x2fc40deb,
+       0xb9e9d337, 0x0553efda, 0x8e46e9ee, 0x4a97d607, 0xb6e41b7a, 0x67921658,
+       0xfaa0f150, 0xfb2996e3, 0x5b1ebf69, 0xcfee28c7, 0x8f84d3d8, 0x84e76d15,
+       0x41e71856, 0x02b06c83, 0x3627cfbe, 0x8534bdad, 0x626c9fb1, 0x3a0b05cc,
+       0x5cccc9bb, 0x6c7d0377, 0xd81ea892, 0xbbfaa364, 0x5e54ec9b, 0xa2c738b6,
+       0xa4e079fe, 0xede20a67, 0x671ed644, 0xed73cc2d, 0x41f081ac, 0xfdf4063b,
+       0x376b4298, 0x0cccf4fa, 0x947a37ed, 0xf028adef, 0x8333743f, 0xfcbe40b9,
+       0x8e83e702, 0x467f1bed, 0xe6b1cf72, 0x49fa037a, 0xb7176df9, 0xf1bddd62,
+       0x5f680d77, 0x04fa007c, 0x7eec0ce9, 0x9e501366, 0x81da339c, 0xa66f9a0e,
+       0xeb2f38d0, 0x77c80d82, 0x430263de, 0xf7a0fcfa, 0xd71c71ba, 0xe12d7457,
+       0xe6744df9, 0x48ad2d9f, 0xfbb8fc22, 0x7f7c75f2, 0xf7a1748b, 0xf9effa29,
+       0x87ee0243, 0x9dfda379, 0x467fec4a, 0xb7af90cf, 0xa41306d7, 0x02f87208,
+       0xa3978b8c, 0x86581d70, 0xbd1937b7, 0x413cf053, 0xe1c74293, 0xfa158bed,
+       0x941b4c04, 0x213229ef, 0xc1239f8d, 0x5258169f, 0x41f93262, 0xe7e038fe,
+       0xabbabe96, 0x811e9622, 0xcff5a87d, 0x762187d8, 0xfc3a347c, 0x437e25b2,
+       0x4329c3e6, 0x4323f475, 0x1fa07fef, 0x82fbe919, 0xe3c9aca6, 0xb9778a46,
+       0x83bec007, 0xc300eafd, 0xf4829ec9, 0x4fca8d3e, 0x91d9748e, 0xc171cc7f,
+       0xd82fa83d, 0x3bf23a5d, 0x7b5abdda, 0x87e141a8, 0x7a1ec506, 0x3feb42b4,
+       0x5ed49f81, 0x84a4fdc1, 0x3fe34ce3, 0xff273f85, 0x057c8cc9, 0xfd834ef3,
+       0xfed22579, 0xc7aed554, 0x2ed8137e, 0x740673a2, 0xbe15f48e, 0xe0a8bfce,
+       0xebe5547a, 0x48d7c865, 0xaf9cbdbf, 0xa96dc7c3, 0x1c0bf9aa, 0x7b945b77,
+       0xf157f710, 0x139fdaf1, 0xe7ee5f08, 0x1f4f0852, 0xb59ce7b3, 0x031f9740,
+       0x2e80fb1c, 0xf19d39af, 0x9affd049, 0x6c9f19cb, 0x1d03921d, 0xbf53c5cf,
+       0xa717936d, 0x19fd42b4, 0xef187ba4, 0x8a3ade93, 0x1cf43e6f, 0xbe753fe7,
+       0x52cbfc0f, 0x0d8a9f90, 0xda03a341, 0x262efb33, 0x7c581da0, 0xe414fee4,
+       0x6e7068c3, 0xdce054ad, 0x4bdad8f8, 0xf01e9c29, 0x455aee1c, 0xf49fb9bf,
+       0x6bff111b, 0xdfa23237, 0xd97ed7fe, 0x49fc7c81, 0xfa84bc5f, 0xf1a3e3f0,
+       0xd7ff945e, 0x3a7c998e, 0x6f10fc81, 0x8fb5c822, 0x91f7030d, 0x2f4479bd,
+       0x3ee8ffa1, 0xc83ddbf6, 0x4cd7ee8f, 0xb5b1f968, 0x51d75d7d, 0xddf5b5ef,
+       0xf2c4557b, 0x87e5d1a5, 0xd38f8df6, 0x6ffad57a, 0x28ed9937, 0xb9113f47,
+       0xfbdb589c, 0x6bbfd92a, 0xc0cc6f07, 0x47c7ea38, 0xca094fff, 0x379bf735,
+       0xb99e504a, 0x8251b8df, 0xc71feeed, 0x2dd9227b, 0x84f4b371, 0x665f5557,
+       0xe26a27bf, 0xfa141b45, 0xd5dceec8, 0x57f00938, 0x03896e7c, 0x7b6ab6f3,
+       0x139d14f1, 0x79fe2fdf, 0x21c3ca7d, 0x22033afd, 0xce8a8de5, 0x0eafc7d5,
+       0xaa47cba1, 0x94ef9a0c, 0x0f38d57d, 0x2df7e2b6, 0x0275c56f, 0xec0efa3a,
+       0xbfc880b6, 0xf046bb2f, 0xf601bfa1, 0xb23f784b, 0x923daea7, 0x9910f742,
+       0xbd3f9ce8, 0x1c53eb08, 0x5628eddb, 0x8726a7cc, 0x02cb4bd8, 0xe809bf3a,
+       0xe4cfa9a8, 0x203f7b27, 0x62baa45e, 0xfd743d47, 0x85b26337, 0xdc9a7108,
+       0x1ca0e777, 0xc0d78f0f, 0x5b8418cf, 0xa7ceafb5, 0xa651f8f3, 0x042dd247,
+       0x993b9ab8, 0x161d7884, 0x4b9a69d7, 0xf8f0a2f1, 0xdbb03d8e, 0x93ecfd8c,
+       0xabc21275, 0x8fb8a5da, 0xc0e4113d, 0x7972565f, 0x6757f2a6, 0x3af5e780,
+       0xc9e6b503, 0x69577e50, 0xcc7491ef, 0xece9780b, 0xc600ffbb, 0x1f073a17,
+       0xf30e9f8c, 0x98b7be74, 0x9ae79e61, 0x829e6b54, 0x9ae706fd, 0xa21bc81f,
+       0x1af9f09b, 0x345db92a, 0xd6442f64, 0x5f0aa57f, 0x2c1e968f, 0xd0f3fcac,
+       0x579fe083, 0x7cff7254, 0x709f8f05, 0x7f5c3cff, 0x1d5972a8, 0xef82ad77,
+       0x2af972e1, 0x47e039d9, 0x5b5e5c93, 0x32f7a769, 0x90a516fb, 0x92defd7f,
+       0xf875bb14, 0x43a239f8, 0x7c379c97, 0x739ed57c, 0x6653e57b, 0x3d647bf4,
+       0x897ba7f1, 0x97fcc3e0, 0x9db9ff6a, 0xeee5d902, 0xdf0f8366, 0x2c0ae153,
+       0x07d8f1e1, 0x22cf8364, 0xaa89d90c, 0xddab791d, 0x6abb5021, 0x63f6aa57,
+       0xbbe3c9c0, 0xfb788a4b, 0x556b8b65, 0xa75c58e5, 0x97179e85, 0x398ce7f3,
+       0xf55fa14f, 0x918152e0, 0x4aec501c, 0xedc34e95, 0x72fb4fce, 0x438a4712,
+       0xa7d0af3d, 0xc21367ca, 0x63d543f8, 0x7e7054cf, 0x5e3d40eb, 0xf7fc7a88,
+       0x7c3cfb1a, 0x8fe3d05c, 0x463f5257, 0x2e7e8bfd, 0xebf9233a, 0xadfc6566,
+       0x4e05feea, 0x59bc20d6, 0xfd19b02c, 0xf5fa68cc, 0x139d8a7b, 0xc519fdad,
+       0x3f1dbc7e, 0xc8e4561f, 0xcbf3f168, 0x70f2b795, 0xf9f9a9ff, 0x8c687d96,
+       0xd557bf62, 0x1ffb86bc, 0x6a04f7a7, 0x97feff90, 0xe1eee281, 0xfaa53def,
+       0xecd3229f, 0xa32ca9cf, 0xf723fd0e, 0xe83f1e1a, 0x43bfb24e, 0x7a5bcc7e,
+       0x05ace386, 0xb8ed107f, 0x51266f47, 0x32f686d9, 0x385e2b94, 0x1588f947,
+       0x77f0b46b, 0xfb174c63, 0xf3a6cbaf, 0x9eac2d03, 0x7d2d4ce2, 0x5016d249,
+       0x0f63dd0a, 0xf2be469d, 0x0fdbd01e, 0x88ffbe84, 0xc799befa, 0xfba636e1,
+       0x661af728, 0xc278b40f, 0x7dad7eed, 0x8dc4a950, 0x6f09d9a2, 0x5cb85bf4,
+       0x3e27a339, 0xd378c0ef, 0x7d8cc64c, 0x37b82e5c, 0x474938f2, 0xfc04e6df,
+       0xd2bb6a08, 0x500c457e, 0x6bf28a1c, 0xbed5eaf0, 0x3ee8d3a7, 0x27cdac97,
+       0x39ffefb5, 0xbcf0cbc9, 0x970f7252, 0xbd36ee4b, 0xa12a4792, 0x83b797ef,
+       0xed0e393f, 0x1bfdbb4b, 0x8b807788, 0xc8de48f9, 0x3ecbb89a, 0xe9f4af25,
+       0x3f257f99, 0x2891c574, 0x79eea479, 0x7ca48f3c, 0x1e787727, 0x0ca9f4e9,
+       0x48f3edfb, 0xe8e7bd1d, 0xf2edcb1e, 0x5baaa649, 0x3b8a1c71, 0x7c79144e,
+       0x209f6277, 0x626abc61, 0xe9775f1f, 0xafb238b6, 0x3ab57e1b, 0xba81e505,
+       0xe22c9f4f, 0xfde4fdf8, 0x5fb06acf, 0xc944afc9, 0xe37aeb02, 0xcb3f0dfd,
+       0xd9bb75e0, 0xc436fd8e, 0xc9f33fa3, 0x23c7d6af, 0x1280df7e, 0x17c7e7f7,
+       0xc9f1c8c4, 0x667578a1, 0x959dc515, 0xfa08b578, 0x5c50cc70, 0x8bdfbc27,
+       0x746e5c55, 0x7142bb83, 0xef3c23cd, 0x9aee9ddf, 0x9ebff547, 0x29dff8c4,
+       0xfd1e2990, 0xc635d02a, 0x62c1a68d, 0x3ffd2f31, 0xe62758e3, 0xbac7ba91,
+       0xf47c427e, 0xf23b3ad7, 0xfca7f411, 0x9db0f793, 0x6a8623f4, 0x0333cf31,
+       0xf7405b3f, 0xdf295231, 0x8fb28f73, 0xa2cfe0e9, 0x2cd0095f, 0x34f43cc1,
+       0x2333df25, 0xfe38898e, 0xfb6b830e, 0xf52fcc54, 0xc4cd8e8b, 0x3c148e04,
+       0x779e196f, 0x2f9e6412, 0x6a4ff357, 0xfe5a3cde, 0x9479c049, 0xf3f056ef,
+       0xf980b296, 0xc4cf3574, 0xf9293a96, 0x43cca5b5, 0x807c42f7, 0xde73afb3,
+       0xcffc846b, 0xf21115c3, 0x982beb3f, 0xf3699f62, 0x5f73db8d, 0xaafd3a21,
+       0x78c3c679, 0xe68ee2ae, 0x0fdcecc5, 0x28bb830d, 0xf234d3e9, 0x6ff8febb,
+       0xfb67a409, 0xbc3e906e, 0x00b13416, 0x78071fc5, 0x40cfbddc, 0xe06b8671,
+       0xd10d8dbf, 0xf054efb3, 0xd5f78f71, 0x04f7fd11, 0xfdf1e3ea, 0xb7cf2bdf,
+       0x7ee4b7bd, 0x01bdf7b4, 0xc60b1dfe, 0x13d63fb8, 0x6ed18b10, 0xf2fb83b9,
+       0xf5846564, 0x7eb8e399, 0x52a3e70a, 0xab4aff85, 0xdeeb9e38, 0x7b987ee7,
+       0x48afcf03, 0x7b705c8a, 0x74fd5e78, 0xc6a09a56, 0xca45c7d3, 0x92091cbf,
+       0x447968de, 0x7cc9efa0, 0x33cbfcd9, 0xf1f391e9, 0x462f7a2b, 0x3634bfce,
+       0x168cfc90, 0x638f0ecf, 0xff2a9dff, 0x7638f3a6, 0xeb44957a, 0xd7e4f64e,
+       0xeb43638c, 0xb0fb83bf, 0x7d845674, 0x6fe383b8, 0xf1db1d9c, 0x3b63caeb,
+       0x1e3113fe, 0xc78c7b7f, 0x6c7961ff, 0x8abaebf3, 0xdbffc2d8, 0x1fdfc318,
+       0x57fffe09, 0xe78407cf, 0x0bcfc3ff, 0x30039f84, 0x17b0f5bd, 0x9d84badb,
+       0xefc33f41, 0x24d6bf8d, 0x93141c80, 0xce7dd3f6, 0x1f3ce505, 0xecdeadb6,
+       0x9d0c2bdb, 0xf5f1501b, 0x23f73568, 0x5eebbca5, 0x04d45efc, 0x829f5039,
+       0xfe72b2f1, 0x59ae4377, 0x898c5e78, 0xc9e63a52, 0xc5f4cde0, 0x5b749760,
+       0x5359e722, 0xe9a2f195, 0x35d58391, 0xe315678b, 0x7c8a3d1f, 0x4a87ff0e,
+       0xe5ea521c, 0x6899e9f7, 0xf34c5f4f, 0x1ed1d3da, 0x9fc93c4a, 0xbc99f827,
+       0x67b2e097, 0xdc7fe62f, 0x7be11b20, 0x26ffc946, 0x1b2bbbcf, 0x60c9d2e3,
+       0xf05e6217, 0x920fcc69, 0x7bd12b3f, 0x66977cea, 0x19ea3f71, 0x9f301303,
+       0xcfca9deb, 0xdf9eb139, 0xe6a6fd91, 0xfc1acef5, 0xca055a97, 0xfc23b5eb,
+       0xf3f9d53f, 0x442b65f6, 0xebcdf80c, 0xf8df2891, 0xe5dff976, 0x9e1e68ba,
+       0xe24c7be7, 0xbf409caf, 0xec78e019, 0xefd12168, 0xffe5e38a, 0xc7fe8cd4,
+       0x3cf09164, 0xe254afcc, 0x78941705, 0x502f1a87, 0xacff5bf3, 0xc03e49c4,
+       0x03940bf8, 0x72810f18, 0x9ddd2cfb, 0x67db4fd6, 0x67ffe045, 0xf21f1e04,
+       0x87c794fe, 0x9c8e8d0a, 0x7f94f3d0, 0x63ef8b35, 0x2fe79fab, 0x0fcf78d4,
+       0x7e14f595, 0xefc7ef4f, 0x9d6e15a1, 0x5f3d446e, 0x0e2b35b8, 0x4fb219cb,
+       0x5ef80697, 0x4eb0fab6, 0x7448bfdd, 0xe75957b4, 0xca4133b6, 0x961abdef,
+       0x8b34bff7, 0xa968679f, 0x097bfbe6, 0xd418a0ff, 0x6e229b1f, 0xb131f341,
+       0xca47d24a, 0x5f80b52b, 0x76b6708c, 0x7c55b873, 0x75edf8b7, 0x53c5cf38,
+       0x1658adc1, 0xa3aec9ac, 0xf5db7bb8, 0xb9bf68ad, 0xae9c6f07, 0xd19978a6,
+       0x43c4fe8e, 0xdbb8da03, 0xfe3cd513, 0xe01a2afe, 0x457bb788, 0xef0b8ff2,
+       0x927e8915, 0xbfe42c5b, 0xde981b26, 0xdc45f58a, 0x4c682a2e, 0x5b3ac3ad,
+       0x60f64492, 0xd27b19c1, 0x714379c3, 0x377be4b0, 0xdd3c458c, 0xc6aacf2e,
+       0xe45b2ed3, 0x5f9fb8e3, 0x7edacf35, 0x6f3a3df6, 0xc54baeaa, 0x8d2f9a8b,
+       0xcf556796, 0x3f1bb83d, 0x70d39cd3, 0x8c06c18b, 0xbd1e163f, 0x5fce5468,
+       0xa1ecb64a, 0x91e16c3c, 0x557f94eb, 0xcf6eadf3, 0xa1abb275, 0xf7fb119f,
+       0xd7f9e26c, 0x2c0e00d7, 0xb2dd617b, 0xdba1ef09, 0x7583eca8, 0x9b63f3e3,
+       0x6ff4a972, 0x7c795072, 0xf8951953, 0x64f4c999, 0xa75edbcc, 0x59d5edbc,
+       0x524dcec3, 0xe8b76f5e, 0x15f108fc, 0x7aa3f792, 0x1f4fde78, 0xee35e3c7,
+       0xbefa0633, 0x99acfba1, 0x5f4d77e4, 0x0ff444eb, 0x9ae73f3e, 0x60777088,
+       0x2e842dde, 0x961d913e, 0x9d83f424, 0xdbe60b0e, 0x1aaffb0a, 0x874c3cf1,
+       0x3c623018, 0xc0cf200c, 0x9eee8b23, 0x6fdcfceb, 0xf1058d5f, 0x58fcdb7b,
+       0x8fcfffef, 0x58fc957d, 0x273f3577, 0x0291caad, 0x8bde4ea7, 0xf2d919e5,
+       0xd89c8870, 0x94f9e4e6, 0x1127936d, 0x4e76ee1f, 0x321d5a4a, 0x8f23675e,
+       0x3bdf245f, 0xfcfa12d9, 0x1f3cd597, 0x67302c96, 0x33567924, 0xc7ddebfb,
+       0xd76e411b, 0x3ffbb244, 0xe5d029f9, 0x238ba04c, 0x90389edf, 0x343f19c7,
+       0x71adb71e, 0x2831c4f5, 0xd8982e9f, 0xd3af1e14, 0x5858e3c4, 0x5c5a2e5e,
+       0x4ea3456e, 0xa179d0b6, 0xdbd404e0, 0x2633f1e1, 0xbd702706, 0xbde0672e,
+       0x83319814, 0xf961b195, 0xdf305fb9, 0xfbc327cf, 0xa4751acb, 0x5d3cd42f,
+       0x36c8a341, 0x6c167d01, 0x3f28f834, 0xa45e28d7, 0xec6fc576, 0x90320a94,
+       0x6b383fce, 0x16ae3094, 0x34731f1e, 0x049eefee, 0x026d1dfd, 0x5dba0bdd,
+       0x073d4f1e, 0x3fdbd2de, 0xf96de307, 0x3d77576c, 0xac9fcff4, 0xf4fcf093,
+       0x3f1e7cf0, 0xd8a05dff, 0x3671e139, 0x4bb433a4, 0x1bf0e3c2, 0x38d83a15,
+       0xd7adeb9b, 0x1d537f14, 0x4e17ed47, 0xcd9d3f3f, 0xb8b46df5, 0xbc6551fe,
+       0x6d82c6ce, 0x177f7193, 0x93ea18e8, 0xf35ac6ce, 0x76f190e4, 0xdbe7e6cc,
+       0x60fcc19e, 0x907e686a, 0xf3c301e7, 0x2b9caa82, 0x037dffec, 0xc8377be2,
+       0x6e63d46b, 0x141fcf1b, 0x8339ab1e, 0x4e086372, 0xc377b7ae, 0xbec8079e,
+       0xbe312473, 0x457bfa2e, 0xc502a3de, 0x7c160ae7, 0xea1e3c76, 0xf74499cc,
+       0x2767dcb0, 0x3ca2b16f, 0xe316205a, 0x53b71ebd, 0xc26795b8, 0xeffdd27c,
+       0xbcefa1ac, 0x7f903e16, 0x81e5f70e, 0x0f9d0366, 0xfddef554, 0xf03534ef,
+       0xc64fbdf6, 0xe0ae7b61, 0x79f1d8b0, 0x763f7d23, 0xfa7e4bfe, 0x110b58bb,
+       0x81e7903a, 0xe44497b3, 0xd716cb9b, 0x151f23df, 0x4cf2522e, 0x3f4f5ccd,
+       0xc0c8b7d0, 0xead3cec8, 0x9f5913cd, 0x46e83c53, 0x8fe5215f, 0x43fcf052,
+       0x29be90de, 0x6c7a0a3c, 0x63d39dcc, 0x112d9d3f, 0x1e82673e, 0x17927843,
+       0xf87d3cf1, 0xf650effe, 0x8a5e9a3f, 0xff518726, 0xde63fbf0, 0x5c36c10c,
+       0xee31db8f, 0x3af68a53, 0xd3a2e394, 0x71661fdf, 0x628a4eba, 0xa149fdcf,
+       0xa7e7a8df, 0xcf27477a, 0x7fd987f4, 0xd563791e, 0x4df352ff, 0xa0f6bfaa,
+       0x65ab0f62, 0xbbfe5293, 0x72a037ef, 0x21bf788d, 0x86fdf239, 0x68090e87,
+       0x1bf7a8a7, 0xcd59194e, 0x4f3c54e1, 0xf277dcab, 0xe93b222d, 0x62fcdfd4,
+       0x78a98beb, 0x509049df, 0x3a1fb51d, 0x1dbe7a47, 0xa7b223ec, 0xe3cb7efa,
+       0xf9f887ad, 0xc8def6f0, 0xaddbdddf, 0x32f5dfd8, 0xaed1b923, 0xe86db79c,
+       0xb744f251, 0x8b8f96e2, 0xb74b71a1, 0x3d56303d, 0x7f23ebc7, 0x8cc71b4f,
+       0x60ecb716, 0xdbb73a41, 0xa07046b1, 0x39ddb87e, 0x79ca5ddc, 0x4c71a8dd,
+       0xb973e479, 0xb94c71e1, 0xb9c79b5a, 0xf7c4966f, 0x680825db, 0xce759aef,
+       0x7fb73a36, 0x9d22904c, 0xcd5a5ef3, 0x257cf4e5, 0xc8d0720f, 0x8560e3e9,
+       0xf06ff740, 0xfbee1e1e, 0x1efc63c1, 0x7e02c1ce, 0x7bcd470f, 0xa66bf7a8,
+       0xe83de50e, 0x2f7a9dfe, 0xc367bd47, 0x5ae08f98, 0x7d1c5cf4, 0xe1876bc7,
+       0xbddb8d90, 0x1a3f7e5e, 0x43e61065, 0x8913cc4d, 0x6bab6b5f, 0xef7a6ac4,
+       0x8f4fdb8e, 0x7bf04754, 0xe91f8a7d, 0x2fea8eae, 0xfad6afac, 0xf70f540b,
+       0xde54ee17, 0xecd98be3, 0x87fbfb4e, 0x9e8f1c63, 0xf1b63b32, 0xfb48ecc4,
+       0xfda2c5b6, 0x5e5aaf1e, 0xb0dfe456, 0xbb0dc5ef, 0x7af5c92f, 0xa7ff60b7,
+       0x1ba7ca4a, 0xcaae9f28, 0x7c31eed5, 0xe3291ffc, 0x294065a9, 0xd77ca3bb,
+       0xbc4a97f9, 0x7b944bac, 0x2f69ee10, 0xd397e368, 0x97e3690f, 0x35937b33,
+       0x78ff7cf5, 0x6785fbcd, 0x8bda6926, 0xda68f703, 0x68142f4b, 0x1503e5ea,
+       0xaf2bf79a, 0xb3ea6ad4, 0x65f8da82, 0x61c5cdf5, 0xb47d38f7, 0xdca01abe,
+       0xe6757ed0, 0xcbde6a6f, 0x575da358, 0xaebb4796, 0xebb51b89, 0xf6cdc752,
+       0xd397d76a, 0x325f5dad, 0xbef2e3e6, 0x7f2e3e7e, 0xc7c95db6, 0xdfb058e5,
+       0x2d938d33, 0xf7a9b768, 0xfef7d5a9, 0x5866372f, 0x007f40df, 0x00000000
 };
 
 static const u32 csem_int_table_data_e1h[] = {
-       0x00088b1f, 0x00000000, 0xe24bff00, 0x51f86062, 0x38cfc10f, 0x90981819,
-       0x770143f8, 0x01684331, 0x21060616, 0x62636620, 0x22676060, 0x072bbf5e,
-       0x9d877d82, 0x1038e181, 0x781f67df, 0x5e240d7f, 0xbb3f4dcd, 0x2ed1d37e,
-       0x7e27f062, 0x02af8606, 0x058b0c0c, 0x210b7c21, 0xfccff954, 0x18a47608,
-       0x02a57665, 0x150003f5, 0x8051b77b, 0x008051b7
+       0x00088b1f, 0x00000000, 0xe4b3ff00, 0x51f86066, 0xb97bc10f, 0x726e1818,
+       0x0143f821, 0xd08667cf, 0x0c0c2c6a, 0xc6cc401a, 0xcec0c0c4, 0x717ebc44,
+       0x1d7b044e, 0x4cc30307, 0x31c8de20, 0x481afef0, 0x7e879d7c, 0x42f3a976,
+       0x81c15968, 0x570837f7, 0xb430310a, 0xc430330a, 0x0cf84088, 0x55f2a8a2,
+       0xa9b60842, 0x39766524, 0x0003f502, 0x3471cc24, 0x00000380
 };
 
 static const u32 csem_pram_data_e1h[] = {
-       0x00088b1f, 0x00000000, 0x7dddff00, 0x45547c79, 0xbedd70b6, 0x97a7774b,
-       0x42c84274, 0x4010dc20, 0x804d8854, 0x024de3b0, 0x10602a31, 0x66b71c11,
-       0x04484b0f, 0xd3ce7cde, 0x0831baf9, 0x544e38e8, 0x387c0666, 0xa8d041af,
-       0x1a0c1a51, 0x166bc3b0, 0x26665419, 0xb8c38e3a, 0x6c8a89bc, 0xfd011242,
-       0x5f283798, 0x3b75539d, 0x4dba6f7d, 0xe3fbe65c, 0x45a7efcb, 0xeab7badd,
-       0x9cead9d4, 0x25aaa753, 0xd7a92059, 0xfe197212, 0x48a6f968, 0x51d11908,
-       0x1fb715b6, 0x04846927, 0x6dd5915e, 0x7fc22102, 0x0ed722b9, 0x16c8e427,
-       0xf5a56821, 0x21075ec8, 0xd3767eb4, 0x9735a0b4, 0x0e057d90, 0xbb3fde0d,
-       0x25eb08b5, 0x96e2febb, 0x2ee57b68, 0x65ba8251, 0x8b7729ef, 0x6b2a9093,
-       0xe963a3f3, 0x225df6f3, 0x228742d9, 0x490b1281, 0x8db8e427, 0xac8bbfb0,
-       0xaacec0be, 0xddf79b95, 0x3456fd05, 0xf69d895a, 0xe17bb953, 0xbeb4b1d4,
-       0xe04cb0f0, 0xab6dca95, 0xbeb45e94, 0xa0842828, 0x0fdec0fe, 0x62b69c70,
-       0x4c1a1152, 0x8dbf69c8, 0xbad057a8, 0x067d39bb, 0xb838be7d, 0x5fde14a3,
-       0x2d782f5c, 0x9bc5fdf4, 0xfe819df6, 0xfdc83717, 0x92ffda45, 0x0751073a,
-       0x132fb1b1, 0xa9fcc798, 0x1be56f00, 0x7ad2b132, 0x0a15a5c5, 0xb5491c01,
-       0xc60bb94a, 0x5d514c7f, 0x1c61ce30, 0xe567c747, 0xfa1c7473, 0x0497b2dd,
-       0x996d4c2f, 0x9e00f885, 0x59f6ddd6, 0x5e613b4f, 0xf08194ab, 0x0ab5eefd,
-       0x3830b7bc, 0x0abb15fb, 0x4a566df0, 0x9b4dce01, 0x3b830595, 0xf7525bfa,
-       0xe3ae0196, 0x7c32f21b, 0xf2e6ed31, 0xd5109fb4, 0x4c5f51da, 0x02721688,
-       0xda6541dc, 0x17e78e90, 0xf7a41484, 0xa8913a92, 0x29fe8eb6, 0x49e90861,
-       0xfa17ffff, 0x2683e04f, 0x6e5b7057, 0x7b96bd07, 0x0ed5bfe8, 0x70f39d7a,
-       0x85ed49fa, 0xe5ebfdb1, 0x0a0740a3, 0x83dfad4f, 0x4cfee3e5, 0x55fbd72c,
-       0xfc6fdbc4, 0xe0dcb083, 0x27f3e2f7, 0xdcb0a3fd, 0xfcb0d7e4, 0xcb0cbf9d,
-       0xdf1cbfa0, 0x859fe2db, 0x0fbf56e5, 0xafe33f9f, 0x5fceb2c0, 0xf79fcf8d,
-       0xbd658bdf, 0x5fcf803f, 0x32c3aff2, 0x72c5afe4, 0x96037fa7, 0xbe20fe0d,
-       0x0ebf8af7, 0x087f46cb, 0x37f1ef9f, 0x47f61962, 0xf40bdcb0, 0xdfc465a5,
-       0xff7ee58c, 0xfa0f2c51, 0x43bbf05b, 0x3e5893fe, 0x1eeef1c2, 0x8a248a47,
-       0x3c46b737, 0xea485c54, 0xa648ad64, 0x5672d4f5, 0x5023bf4f, 0xba7ad0a4,
-       0x1e29d68f, 0x148d2d7b, 0x57bd6959, 0xb9cf6b35, 0x68db149f, 0xdac0273d,
-       0x15a23dfb, 0x5fbd69db, 0xb81f6b2d, 0x449c5029, 0xac8303eb, 0x48faaafd,
-       0xafd683b1, 0xfcf6b10a, 0xd2712930, 0xd5847e7a, 0x25688e0b, 0x682f5a2e,
-       0x0fc2f566, 0x5a6e2503, 0xdf616c2f, 0x2913398f, 0x31f5a649, 0xc27daced,
-       0x43d13225, 0x808813eb, 0xd16762f5, 0x2f5a14c4, 0x697ab0f6, 0x1a92d9ef,
-       0xcaf6ff87, 0xe509732d, 0x4dc0ba85, 0xeb45949a, 0xe20acb4a, 0xcc0cf8a5,
-       0x26447ac2, 0x48fda0f3, 0x8d26b660, 0xac8575a6, 0x0efff684, 0xfdf6c62c,
-       0xeded8ab2, 0xbed81581, 0xddb1515f, 0xac7eeab2, 0x6c35941f, 0x20f55b4f,
-       0xd1507fbe, 0xaae07db0, 0x487eb147, 0xa8fb61f6, 0xf7c5bf55, 0x6c3e290f,
-       0x50757c7f, 0xffeb489b, 0x00b6f821, 0xbe08d75f, 0xfc07920a, 0xa72cca1a,
-       0x2046bafc, 0x1e3e40b3, 0xf2a6a606, 0xd14b26b0, 0xfdedbf40, 0x5169f0ba,
-       0x069dbce0, 0x3ccf05f5, 0xbcfd8b9c, 0xb4c8fd80, 0x7eebb11f, 0xca337c26,
-       0x6f84cfd0, 0x1a7ef42a, 0x7b1abde0, 0xfbd9faf7, 0x3c2318cd, 0xfbd62cdf,
-       0x5c7ec269, 0x84d79bdd, 0xf08ce3cb, 0xf7aa5e5c, 0x49fb0873, 0x113c1ee9,
-       0x9fa1a479, 0xef50bc88, 0x4fd84fe7, 0xa3c1eecf, 0xfd0da329, 0xbd22ca68,
-       0x4fd8a39f, 0x89faf756, 0xf08d6328, 0x7ef44b28, 0xfa7ec63e, 0x9a5e6f74,
-       0x1e11bc75, 0xcfdea56b, 0x6e7ba469, 0xefd9faf7, 0xbf67e232, 0xf39f8a2b,
-       0xee80cf08, 0x6dd8abcd, 0x3bb14fc4, 0xd84b9f8a, 0xebdd95cf, 0x88dbbf67,
-       0x28eefd9f, 0xe601647e, 0xf37ba435, 0xe2364e2a, 0x8a3938a7, 0xf000b71f,
-       0x3c1eed0c, 0xf11a7b07, 0x1467b073, 0xcf08193f, 0x33c1ee88, 0x9f88dd31,
-       0xfc51e989, 0xe8cf08a8, 0x3073f5ee, 0x839f88dd, 0x5cfc51e9, 0xef8cfd89,
-       0x6626bcde, 0x3133f118, 0x029f8a23, 0x57c8a7ec, 0xda10f087, 0x3f712b8f,
-       0xf118fa87, 0x144fa873, 0x9fb1633f, 0xbc9fb449, 0xcd29fbae, 0x34a7e231,
-       0x899f8a27, 0xbbebe788, 0x1ca1cfd7, 0xe50e7e23, 0x0533f144, 0xbdd299fb,
-       0x35f69579, 0x2fb4a7e2, 0xd2b5cfc3, 0xe8675c50, 0xe915e9da, 0x2ef5d727,
-       0xbefa04d2, 0xd17561e8, 0xf76025e3, 0x433dba88, 0xbe91359a, 0x294facef,
-       0xdac49878, 0x0277c535, 0xcad45c7e, 0x926bb58b, 0xec192547, 0xd52d14a8,
-       0xd651ef50, 0xcf7ef0cb, 0xf6867ef2, 0x1957598c, 0x057cb3da, 0xc5767a86,
-       0x7dfbc318, 0xf50d8baa, 0x60def7be, 0x70373f78, 0xb79ea1b3, 0xf78627ee,
-       0x31ced407, 0x61b15fb4, 0xcafda1b1, 0xfd4372e0, 0x377fbaea, 0xf4243fbc,
-       0x9afda180, 0xed0d87c6, 0x1b8f2343, 0x3f0ec3ea, 0x447f7869, 0xfb4316f3,
-       0x1bcfa3c8, 0xecb747da, 0x9ec7d434, 0x7f7863dc, 0x437efb7c, 0x6f8bdafd,
-       0x222fde1a, 0xdbda367f, 0xef0c0fb6, 0x6a7cf24f, 0xf32ebf68, 0xea9d9373,
-       0x9abf1cf4, 0x2b9045d7, 0x20497e82, 0x357b414b, 0xaeb052e2, 0x3f3272f4,
-       0x3d40b5c5, 0xd947f946, 0x434d573f, 0xd47fa4be, 0x55ea286e, 0x7d0b4571,
-       0xbe31d3fe, 0xf9f43c2b, 0x35df154f, 0x0df6389e, 0x648137e5, 0xa05aa942,
-       0x95afb734, 0x6717bf19, 0x31f81a5f, 0xd2cabefd, 0xd685303e, 0x2145897b,
-       0x04578f90, 0x49d5da0b, 0xf786a922, 0xfd04ac92, 0x85b9b5a6, 0xe462074f,
-       0x6a1f5d61, 0xfd1d0867, 0x997d93ae, 0xfaad4768, 0xce760028, 0x5e743e9a,
-       0x4d7908bd, 0xe81228f8, 0xb3efbf4f, 0xfb47d320, 0xcfd42ab3, 0xa15f1d88,
-       0xf1c60fe3, 0x870f2023, 0x9d11fc60, 0x1bf6b7c7, 0x96df1865, 0xdf186153,
-       0x3df1d0a6, 0xf55c3fd4, 0x129f1f19, 0x6f210c61, 0xf8e19f09, 0x1c0a9cd6,
-       0xfd42ad7f, 0x93f1d8ae, 0xc337e3a2, 0x344bdffc, 0x8c637eff, 0x6c59cff3,
-       0xe6c2bf9c, 0xb3aafeff, 0x9c24fc7c, 0x59c207ff, 0xc59cff36, 0xd656fe6c,
-       0x777c746f, 0x302dff14, 0xe304f1fe, 0x19c6f35b, 0xa977dfe7, 0x3656fe71,
-       0x5f55e9fe, 0x389df1f2, 0x97c2e7fe, 0x977dfe6c, 0xd58af8e2, 0x51fe05e7,
-       0x83aa93b2, 0x9bd27c74, 0x600cbe2a, 0x940e3a17, 0xd0a95283, 0xe84db210,
-       0x34fc7087, 0x57dbf189, 0x50df9449, 0x39f0059f, 0x59cd5209, 0xce46fd48,
-       0x8bea4beb, 0xd87bd014, 0xf9adfd4e, 0x8d79d41c, 0x5937f222, 0xa00e0d6f,
-       0x8a36b6f0, 0x5bcfa801, 0xfa083e3f, 0xee4acab5, 0x24ef872e, 0x9fe78112,
-       0x96c87afd, 0xcb9979d8, 0xf1f2b5f9, 0x8b791896, 0x64c581fa, 0x6f853550,
-       0x88c13012, 0xd427fa8e, 0xf8c7038f, 0x10f7ea43, 0x2a7cffea, 0x9bfef1b3,
-       0x6f507bfa, 0x3a1efea1, 0x7e1564ce, 0x377bbb47, 0xce5fc293, 0x6244ffe1,
-       0x1dc9faf2, 0xe5403042, 0x0d9fabf3, 0xeefaff45, 0xe9141d7b, 0x0ecc701d,
-       0xe9d430f4, 0xa74002bc, 0xe0d6ddf6, 0xabf10116, 0xa1a6be02, 0x77321268,
-       0x75c5365d, 0xdd7ffbc7, 0xe090e53b, 0xa256e426, 0xfdf419c9, 0x7d0a573b,
-       0x19dc743c, 0xad80b59a, 0x05b65a43, 0x5b649ae5, 0x73721146, 0xf69950c3,
-       0xf269a640, 0xe3312d27, 0xd6332f4e, 0xeb1b9467, 0x5b26b2ad, 0xd3ad5c28,
-       0xf699b204, 0xb196733b, 0xbfa71f5d, 0x99d19525, 0x714e578f, 0xcd1f4592,
-       0x1e00b284, 0xb3ce907b, 0x1d5bec3c, 0x32b9aa9e, 0x1f1fa089, 0xae8049e8,
-       0xef7c3481, 0x6f361e27, 0x64b3bc33, 0xe74e569b, 0x18b66b39, 0xc336fe04,
-       0x875efeff, 0xe5a7c966, 0x626427ba, 0x331f3ce9, 0xccf9b7fc, 0xb0c909f3,
-       0x615edfce, 0xe6f8ce7e, 0x27ffa738, 0x3cb41fc0, 0xe141fc01, 0xa3f9c63f,
-       0xfe32af43, 0xa6fab2a8, 0x6fb43f02, 0x95d20914, 0x9cadcbf3, 0x1ad7e65f,
-       0x9f1082f9, 0x385c740c, 0x3878284b, 0x72660f86, 0xc1b8583e, 0x927737c8,
-       0x87159c80, 0xdfadb72e, 0xdaa660fc, 0x711f7e79, 0x91fdb9be, 0xce9f887d,
-       0xba7464f3, 0xcee9d38b, 0xadfb636a, 0x7277ae9c, 0xf0daceba, 0x7d54ebd8,
-       0x41a89f90, 0xeabde419, 0x2d9e9d3e, 0x38fa7a06, 0xde70cd3d, 0xd779e9c5,
-       0xcd3d18cf, 0x7a70b6f0, 0x2f386cb6, 0xe19d7e93, 0xf777c335, 0x83e69dbd,
-       0x81d9ad71, 0x6aacf4f8, 0x2c715a2c, 0xe86579e6, 0x62c715fa, 0xdd496ce4,
-       0x517d4334, 0xfbc336f0, 0x36cc370b, 0x5dafcfb4, 0xbb9f6864, 0x7d431eee,
-       0x8667e076, 0x77beeff7, 0xcefda195, 0xed0c87ea, 0x663c57b7, 0xdbe6dfa8,
-       0xe67f7868, 0xf686cdac, 0x19cfe519, 0xed97a7da, 0x69a7d430, 0x0bef0dbb,
-       0x6df5177b, 0xf7d575c1, 0xef10199f, 0xf9159bfc, 0x74efacd4, 0xafcc78bd,
-       0xfee3f3e2, 0xf49e5841, 0x69f9f17b, 0x572c28ff, 0xeba6fe81, 0x2b376582,
-       0xdd9f1eab, 0x9742f817, 0x6f654f8b, 0xaed9e80e, 0xbefea1f4, 0xbfd1ef59,
-       0x8a7678ec, 0x48152e5e, 0x6d83ac39, 0x9fd74edc, 0x4ecc2ddb, 0x2c01e420,
-       0x6e4c2a97, 0x2accee97, 0x47a86e26, 0x133b5606, 0x02424bf7, 0x6d7e67ce,
-       0x85ce019e, 0xc136ae1b, 0x6af905b7, 0xe1987051, 0xb1ba92f9, 0xecceef86,
-       0x65be1113, 0x61a3e320, 0xdf7f2b39, 0x7233fa02, 0x10fa6720, 0x00fb5780,
-       0xd13d8deb, 0x2fe33b9e, 0x006c715b, 0xcb1cb9e0, 0x5859fe93, 0xb0fbf71e,
-       0xc0afe63c, 0x357f13f2, 0x7bfe2d96, 0x7f6ffcb1, 0xfd0fcb00, 0xdf7cb0eb,
-       0x51e58b5f, 0xdf2c06ff, 0x7cb107f3, 0xe5875fd7, 0x9610fe3b, 0x2c46fecd,
-       0x961afd5b, 0xf0c4bcba, 0x18acdf4b, 0x9ff5d17e, 0x724f1fae, 0xfc0d397e,
-       0xb62f8f12, 0x84e2f918, 0x617c8d5c, 0x3a6687d6, 0xf7dff598, 0x3f2987e5,
-       0xd0743f12, 0xef44db3b, 0x9de8aebc, 0x7bd0c629, 0xe0c3c58a, 0x05fef4e1,
-       0x5ec71bc0, 0xfb8b049f, 0x483b1888, 0xfac0b22b, 0x2fef9cb0, 0x3f5807d0,
-       0xa1aec7c7, 0xbda335dd, 0xfa041c14, 0xffa0dcf8, 0xf9f10819, 0x51294773,
-       0xcfcf1372, 0x7884bf4c, 0xabe8f180, 0x2e94820b, 0xdbb73a3d, 0xed5e1893,
-       0xe8465216, 0x80d0f17a, 0x0673bc67, 0xa9225d63, 0x3bd07df0, 0x5fa715cd,
-       0x7e02836a, 0x8d6bc2bb, 0xe87cabeb, 0xff93f8ef, 0x8a72842c, 0x49a1d985,
-       0x87b44407, 0x2f69e449, 0xefaa37e0, 0x884cdead, 0x500fb763, 0x931eb83c,
-       0x02fe2312, 0x3dfc06c5, 0x8cd47144, 0x266d59eb, 0x57ffafe2, 0x81bab303,
-       0x64f4aebf, 0x039cf857, 0xe017fef3, 0xd5fd2bb3, 0x9a22de95, 0x9d2352fa,
-       0x21dedb7f, 0x30ab0f05, 0x5be3b7ee, 0xc332b7df, 0x7c8ef813, 0xf3ae96dc,
-       0xa10e7371, 0xf2e59ce3, 0x8ae1ae72, 0xb44ba064, 0x29e82e9f, 0x3947d7fc,
-       0xe6cebfa0, 0x6b5bfb1a, 0x21592fee, 0x5c7435c2, 0x6490a297, 0xbe885642,
-       0x06fd115a, 0xfc004b6f, 0x6f0ebdf1, 0xd8fe0a8d, 0x54463fe9, 0xb7e8d9e8,
-       0xb4fc3b9f, 0xe59bfc1b, 0xb1f56299, 0xcbd47438, 0xb56e50ca, 0x680fd633,
-       0xd5cfd634, 0x9c21650a, 0xcb7c9a97, 0x3c075810, 0xd064c7d5, 0xea5899cb,
-       0x54cf2cfd, 0x7f4a1c70, 0x53ea47a6, 0xf69ccf50, 0x1fbdf0db, 0xfd448e1b,
-       0x40d1c074, 0x83dfa53e, 0x4bce5d88, 0x39427efc, 0x10282e90, 0xf961248f,
-       0xecdff02b, 0xfdcbbff4, 0xeb095fa0, 0x2155bf7a, 0x06bd6031, 0xc61bd79e,
-       0xfaa9dfa3, 0x977c2c1e, 0x7224de58, 0x4a77e75c, 0x7ef837b7, 0x7b3a92f1,
-       0x4c2ed1b5, 0x1aabd431, 0x760daab3, 0x0c03fc22, 0x02410ae1, 0x6729777b,
-       0xb9c936bf, 0x2b68f80e, 0xdf80fb04, 0xa55ef605, 0xa9f145ad, 0xc0cd2628,
-       0xe946739f, 0xfcceaf7c, 0x53a7ea80, 0xe404c96f, 0x50a25c8b, 0x47f47615,
-       0xa1625057, 0x36bcb9f5, 0x64c961a7, 0xbd4eaf58, 0xf5da2372, 0x1bb948f3,
-       0x520acdfc, 0xcff1085b, 0x0652c4b3, 0xbc967972, 0x23161ee3, 0x0545e787,
-       0xcebb99e1, 0x7f531768, 0xb85f50d9, 0x405f58c1, 0x7d874e6e, 0x65eb05f0,
-       0x5f401412, 0x153fdb18, 0x242d1c99, 0x7d606bd5, 0x75b32f5f, 0x48878e6c,
-       0x555f54d9, 0xe154fabe, 0x1fff5a6c, 0xf42dc591, 0xa945dd7d, 0x1c589fcc,
-       0xb468acda, 0x6186d3fd, 0x43cd52b7, 0x81ae0fbf, 0x4bb02af5, 0x3b536ef0,
-       0xc2bbefd3, 0x5f57866f, 0x2fed3bff, 0xeb2a3873, 0xc7182d04, 0x0249b00e,
-       0x580377f7, 0x863c960e, 0x5328c2b8, 0x53f37bfd, 0xd3f0311a, 0x4aa7d156,
-       0x80ff193d, 0xed48253f, 0xf487ef8a, 0xffa9d99f, 0xff6a3fc1, 0x85ff69bd,
-       0xfd47fe86, 0xeff7fda8, 0x6944ff04, 0x2bfee744, 0x95f17d5f, 0x8b27d500,
-       0x4ddaffb7, 0x4a78fae8, 0x52f74daa, 0xf6dd2efa, 0x7ce81ba0, 0x81b80a52,
-       0xc5054f5f, 0xf59c60b2, 0xe0493eea, 0x14e6a2f6, 0xff058e20, 0x7e9ffda4,
-       0xdfe817fe, 0xf64db57f, 0xceaa7c60, 0x3952b11a, 0x68b0d65c, 0xfac7c932,
-       0xf6beacc7, 0x8dea110b, 0xfc5bfe46, 0x21d3afec, 0x0a7282df, 0xd044d78f,
-       0xf5b65d9e, 0x975852b3, 0xca3b48aa, 0x183bf991, 0xea2a62ff, 0x724ad9bf,
-       0x270a76e7, 0x1c55ddfa, 0xbf0d552f, 0x437442f8, 0xd009fd79, 0x4043d417,
-       0x5dfcd8bf, 0x974fb705, 0xe3b4ae4a, 0x232714d4, 0x8bd048c9, 0x90485e3a,
-       0xabe2a7d9, 0x3c43e54f, 0xb7d6ccf2, 0xbe0c42dc, 0x173a7974, 0x7b9ffb9a,
-       0xb77ac4d4, 0xac5bca95, 0x5bafa41d, 0xabb7236a, 0x2a5cacc3, 0x1f90dc47,
-       0xecb374b3, 0x4bc7d00d, 0x99fa7c5f, 0xf83e2127, 0x0077ab37, 0x8bc97fed,
-       0x8637bfaf, 0x90ec97d6, 0x69b326d3, 0x0ef48538, 0xffd154fa, 0xa0e82dee,
-       0x5f97e2c7, 0xec21d457, 0x1da9fdf9, 0x63b25974, 0x7486429f, 0x684947c6,
-       0x8ce2d29f, 0xc7d09f43, 0x882760a5, 0x00ad7eaf, 0x15ed4ffd, 0x1c6e4648,
-       0x1d7e6e7c, 0x13c000ed, 0x2bd393d2, 0xfbd33f4a, 0xa02e9455, 0x32f4cdb7,
-       0xf40537bf, 0x2fd608cb, 0xfe502de4, 0xe40f697e, 0xf56fbd15, 0x5e2a1e02,
-       0xf986e15a, 0x19aa909c, 0x60f53f9f, 0xafc746ba, 0x1ee90390, 0x8af3d92c,
-       0xf21bfddf, 0xffb7c2df, 0x35e31d2d, 0xe0b2cb44, 0x82c8145a, 0x34dfce79,
-       0x80b9e703, 0x2b0f90f8, 0x41cb129e, 0x91297e1f, 0xe4711db2, 0x93973ce4,
-       0x71285b13, 0xd04f3ce9, 0x6df30665, 0xdb8311de, 0x87beded0, 0x37f83e80,
-       0x316a173e, 0x1b4bfd60, 0x921bd7a3, 0xab5197ee, 0xb77f9633, 0x3a066dae,
-       0x65a3ee9d, 0x15463ec0, 0x1f1c0291, 0xafda65c2, 0x0ca4f6f8, 0x4aa22746,
-       0xba3bfc85, 0x73c097ee, 0xd659bf78, 0xef86f9ec, 0x8edce5c8, 0xf1f257f1,
-       0xb049dc29, 0x8f489f5e, 0xb2aab76f, 0xbae807ae, 0x3167c31d, 0x7fe4cef2,
-       0xde4c43eb, 0x4e0ff975, 0x0bf6832b, 0x823932ef, 0xa43d60ef, 0xb0324570,
-       0x022ddf7d, 0x892b07ea, 0xadf393c4, 0x63739732, 0x285f99bb, 0x1c9092fc,
-       0x4e3037c3, 0xf701d22a, 0xa7ac1631, 0xd1e8c7df, 0xddd7182a, 0x8e5d5fb9,
-       0xd07d7217, 0x6407d26a, 0x8903d313, 0xae00aaed, 0xe0e54b7f, 0xfc824f33,
-       0xa80d7952, 0x3972bf20, 0xfaf3ffcc, 0x84fdef03, 0x21e7cdca, 0x7a8d6e5d,
-       0x15b72cd5, 0x7890473b, 0xd3b9fb72, 0x2dcae24b, 0x6e571e7d, 0xcfc82d9d,
-       0xaaf5afff, 0x990cc78e, 0x0eeaf1e2, 0x327aea3c, 0x7acd3e11, 0xc6a4a772,
-       0xeff493d5, 0x99d8525d, 0xd43e751f, 0x0bf16ff9, 0x1f417d95, 0xe754f945,
-       0xea9f28c3, 0x5e29d87c, 0xb9a3c06a, 0xefb0effd, 0xdb62fc01, 0x7518f538,
-       0x015e6d21, 0x338afee5, 0xb4afcc16, 0x5f70170d, 0x0906d064, 0x3c5b6feb,
-       0x9d4ec023, 0xcfd5f63a, 0xbbbe467f, 0xcb7df07f, 0x3f3e2957, 0x6ec84019,
-       0x5f046528, 0xc8e7a58a, 0xeab38330, 0x43f60908, 0xe589a0fd, 0xcff4fe31,
-       0xbdf76665, 0x61cee1fa, 0xb6a2c780, 0xa82dc9c1, 0x9fa20737, 0xc8f5c559,
-       0x0c9a80b9, 0x385cf5fa, 0x73c9fd0f, 0xbc574587, 0x38e7c6fc, 0xf8805f7d,
-       0xb6db2d19, 0xf2915a92, 0x47691b5d, 0xd5b022bb, 0xd9c5b646, 0x9990aadf,
-       0xf8a1fc9e, 0x3e03fa00, 0x94b7b39e, 0x73b1c796, 0xbbeb9dff, 0x81fffba9,
-       0xe155e6eb, 0xa7b016cd, 0x316adaae, 0xeb9605c4, 0x0a405d7c, 0xeea7af80,
-       0x0386bbb7, 0x5e8b0f1e, 0x0aad03c8, 0xe2f8a17f, 0xf9e68df8, 0x8f60ff43,
-       0x707b2b3d, 0xd0e4d7dc, 0x6bc3c05c, 0xf6046d67, 0xb52b76d3, 0xf9c1e24b,
-       0xb9c1852b, 0xcba318fb, 0xa297858f, 0x18a46736, 0x095b3de2, 0x3a676df2,
-       0x73f3e413, 0x2ab82475, 0xb22de817, 0x68353d7a, 0x9414fbe8, 0xef838e5f,
-       0x635ed12e, 0xc68af3e4, 0xf4082f1d, 0xc16165bd, 0xcbeda163, 0xf80516a4,
-       0x4531aaa5, 0x54367d04, 0x3d5bf3d5, 0xe1896e43, 0x096567bf, 0xcc6079e7,
-       0x5e03b76b, 0x08519fce, 0x076801e4, 0xf84f31db, 0xf218787c, 0xbd79a25b,
-       0x275327ec, 0x410fd0ca, 0x71d3363e, 0xa1927d70, 0xd7c4b63e, 0x6a9ae00b,
-       0x8de9596d, 0x1c01f783, 0x7c963fef, 0x5b765576, 0xe5d5df7e, 0xc79627d7,
-       0x9d57ddf0, 0x9e2337e5, 0xa55f2efc, 0x97bcc066, 0x0065e537, 0x21bf973e,
-       0x57c78cf7, 0xdf99fa2f, 0x03e79db8, 0xf95035b7, 0x7e4626bd, 0xc6fca81b,
-       0xfcb61389, 0x22fbf2c8, 0x7b3c6fc8, 0x9757cf8c, 0xc7f0fcdf, 0x0df9bf28,
-       0xca1e4316, 0xefaf9969, 0xe857e509, 0xd41a4b79, 0x8e23af65, 0x403c06be,
-       0xdf3b739c, 0x40718007, 0xbbe5558e, 0xfc7ff1c9, 0xf978e58b, 0x3379822e,
-       0xe4cde99d, 0x2a6ef978, 0x9dd002c7, 0x26f2f1c9, 0x9db9c72a, 0x275077e5,
-       0x2fdf65f9, 0xabefb08b, 0x7b7f731a, 0x40af1d07, 0xfa36bd93, 0x3c87417e,
-       0x6795888f, 0xcf204955, 0xcf27bb87, 0x533cb8bb, 0x8de7ed39, 0xd86f5743,
-       0xdaf61f98, 0x2ff513e8, 0x41fe5f03, 0x6de9ff44, 0xff73b30b, 0x70c4fa38,
-       0x00db8be0, 0x632fca1e, 0xfd5a1d39, 0x74bfec01, 0x9074c6cc, 0xb5839293,
-       0xec3c81bf, 0x0132adca, 0xe1acb87d, 0xcd53f463, 0xbedd1771, 0x745fc732,
-       0xc38e623d, 0xbd33a92c, 0x9dbe30a7, 0xbc20b626, 0x77a24fe4, 0xd3be1c5b,
-       0xe704ebdf, 0x9cf7dae1, 0xece03bc3, 0xcfa42e2a, 0xf4b82ba3, 0x7c2b9579,
-       0x864a1bbd, 0xe291bc41, 0xf025e511, 0xaa7188a6, 0x8601a2f2, 0x72b70cf3,
-       0x16d58738, 0x62d84095, 0x80ebe41a, 0x9ee1b55f, 0x368fb043, 0x005aa8e2,
-       0x31d8f566, 0x57f81f56, 0x51dbd9cf, 0x3cba759e, 0x3964f9c4, 0x5eb5e7ef,
-       0x6fc0c5d5, 0x07828d55, 0xc8aa9dd6, 0xc6dcf03f, 0x955f8d81, 0x6a2d1f02,
-       0xe4563c12, 0xf0142fc3, 0xfae94afb, 0x2c34fc0b, 0xbfda05fc, 0x448a9a8b,
-       0x6ed17ef8, 0xbbe41301, 0xe9774fc2, 0xf7c396b6, 0x04efc022, 0xbad9db38,
-       0xdbd3e1c6, 0x0180a4ab, 0x2f2792fe, 0x7066c9ae, 0x03b556ab, 0x785111de,
-       0xaf388b67, 0xe3abc26e, 0x1f782bbd, 0xe3deb852, 0xb8d3fc74, 0x222f18f3,
-       0xf96e94e1, 0x6e35df37, 0xd19a4555, 0x57e3d35f, 0x2adf455b, 0x6588e219,
-       0xf38c6482, 0xfbfc63b6, 0x7fffe847, 0xf07fadbe, 0xdd74222f, 0xd3fd7dfa,
-       0xcfb3ef88, 0xe8153c7f, 0x9135e4b2, 0x5a5d28d8, 0x82245deb, 0x054124fb,
-       0x41b8b0e8, 0x240e30d4, 0xbba70a45, 0xc351f162, 0x85ddb1f0, 0x4ef1707a,
-       0xfd32706b, 0x9f2bf17e, 0xd33d83e6, 0xa1fb40fa, 0x3c03886c, 0x931ca02f,
-       0xec3e4b40, 0xd8962d13, 0xbf198dbe, 0x87c58511, 0xcc76eccf, 0xea107902,
-       0xc5a9b9d8, 0x35b299a1, 0x557e1ec6, 0x641c5991, 0x15af3b37, 0xbcc04e78,
-       0xf62f8031, 0x8f9e8edc, 0xe639e673, 0x946e2c97, 0x6afe7083, 0x568edd71,
-       0x3e2c9b88, 0xad75c56a, 0x8c0beeaa, 0x7f6c96fb, 0x6aef9d91, 0x72fe0d14,
-       0x4eb53f27, 0xbfc1588c, 0x38c4a86a, 0x8c7fad3c, 0x0bf710f5, 0xb51fa3bf,
-       0x2bd37b64, 0x25c28a01, 0xc6eb3f2f, 0xdbcd5873, 0xd6afe8dc, 0xa8dc7b7d,
-       0x7a1a5f93, 0x53a5fb88, 0x97df804e, 0xcd3d2fc8, 0x62b4e4f9, 0x7aebeff2,
-       0xe14abfa0, 0x638f2c2c, 0xfff947b7, 0x077f2fc5, 0x3b33d571, 0xc01dff3f,
-       0xf39bf4bd, 0xe28fbbbf, 0x7bb5ec93, 0x3d560f40, 0x438c17ff, 0x5649dfe9,
-       0x7b9fafae, 0xad78e316, 0xa17ab37f, 0x13a6d6b7, 0x6ac71039, 0x748ff1dd,
-       0x365653b0, 0x6bbb424d, 0x0c92aee5, 0xd04ec712, 0x60dfe04b, 0x6688e237,
-       0x38681dba, 0x9e700390, 0x748774a5, 0x21bc68be, 0x38e2c954, 0xd4338f2a,
-       0x76db8fc7, 0x4c342b8a, 0x70fc69bf, 0x4aaf6528, 0x785f11ba, 0x9af3d297,
-       0x9eb1d06e, 0x534291c7, 0x70be35be, 0xe941fe16, 0xc6356795, 0x986cbe17,
-       0x424f9fff, 0x848f435b, 0x374885f1, 0x85c7a7f0, 0xdf2d14db, 0xf3b9720a,
-       0x00eb8c05, 0x09d326fd, 0x65f8beb7, 0x4fd5c40e, 0x6177edca, 0x15935bbe,
-       0x3717d7f7, 0xa9e515fd, 0x68dbd775, 0x9f1e127f, 0x3fd1256d, 0xb9e34716,
-       0x5d5b55aa, 0xe9c12e2c, 0xd50b7100, 0x7c79cf8d, 0x1eb5f182, 0xaf1448b7,
-       0xc7ed6058, 0x5c594ef3, 0x07eb72a5, 0x83c5310a, 0xeb1d5184, 0xe97a227e,
-       0x1e00f078, 0xe3c6c646, 0xa287c7e2, 0xdd1338f1, 0x87109e80, 0x68dbc68b,
-       0x5dc437bd, 0xe35fc282, 0x375b77c5, 0xab5e38b3, 0xe95bcc6c, 0xcf8b13a0,
-       0x5bd136cd, 0xeb576f9f, 0xf8f35756, 0x069a78ae, 0xcecf768b, 0x29733af8,
-       0x6d5f7ebe, 0x3ed87e15, 0xbcc13ceb, 0x7c0353ef, 0xb1f0d959, 0xfa8d7902,
-       0xf7cfa6fa, 0xcfcfb70c, 0x5e622f3c, 0x01d09aee, 0xfd66efd4, 0x61ce0cb1,
-       0x37f781c4, 0x8d65de1c, 0xb338fd6c, 0xd27415d3, 0xdfecce7e, 0xacbd7c8d,
-       0x402563fe, 0xf7543bfb, 0x49fcc2b2, 0x7eb04726, 0x3fe06304, 0x7cbed2f3,
-       0xfe647f16, 0xad9c7980, 0x85563f5c, 0x55538fe3, 0x9c6185ff, 0xc2908125,
-       0x7dbfacf2, 0x3692d3bc, 0xdd3bfa13, 0xb3c8132c, 0xcb121d3c, 0xae6bede2,
-       0x5f7ccab5, 0xb9c596b3, 0xe78a3ae9, 0x9cec5c5e, 0x60aa988b, 0x6ba5641c,
-       0x5f3851d4, 0xa8a5d2b9, 0xacd51fe0, 0x35bcfb62, 0x0266f73f, 0x6e526bbd,
-       0xad6d78c5, 0x349ebf09, 0x7f9c114f, 0x1f2c4cf1, 0xd66aec0e, 0xc59a293b,
-       0x574aff00, 0xe14a8659, 0x81fb4d5c, 0xf244a8f3, 0xd11c39e2, 0xf3065a5d,
-       0x8f163d11, 0x4c7c4e3d, 0x5f139676, 0x8f645e0c, 0xb90cdcf1, 0x7e854c34,
-       0xa5d9fdf4, 0xd843e6b6, 0xe004d1e8, 0xc7ef892b, 0xc1e2dd17, 0x0bd5b779,
-       0xaa71605e, 0x3a4f559e, 0x758033cb, 0x72676da4, 0x3f06b93e, 0x5f5d1a24,
-       0x50b9fc1c, 0xe81f6fbf, 0xa26ed5a5, 0xa33950a5, 0x3cc55558, 0xd4343f38,
-       0x9f01e426, 0xd7c7f17e, 0xb0f6bf68, 0xa0352048, 0x19e7a9cd, 0x67202969,
-       0xe608f20e, 0x5f2b0093, 0xa701d1ee, 0xc084cf39, 0x97e7312b, 0x8c4e8927,
-       0x24db9c7f, 0x922b9fa2, 0x8e3b7eab, 0x0824edf9, 0x65f5f3f0, 0x1cf38709,
-       0xf0231175, 0xe30bbd7e, 0x98df0bf3, 0x7403f28b, 0x8f57c588, 0xb91fa332,
-       0x87ceeec1, 0x768d9dfd, 0x492816f7, 0xbc866b40, 0xdfbc79e6, 0x73c6e59e,
-       0x030c5448, 0xe7ce7f60, 0x82f9faf2, 0xaf98c3d2, 0x7a805be0, 0xf196633e,
-       0xbed9929c, 0x1fb50897, 0x0a0d7d61, 0xb38908de, 0x19b8dfaf, 0xdecaeee1,
-       0xb0e8f1d7, 0x3909bd51, 0x04e24e42, 0x97d6263c, 0x65b7e05d, 0x0dc76fe0,
-       0xb5f8eeff, 0x6bf11a66, 0x75f88d57, 0xcfe3320c, 0xd7975f88, 0xe6ca2f88,
-       0x6fc36fc1, 0xb9e328f2, 0x7e157faf, 0x1db8d987, 0xff4af1c9, 0x4ce96dca,
-       0x59dc0365, 0xc2e50452, 0xced9472c, 0xeeff0088, 0x855c1693, 0xe85d795f,
-       0xf9f264af, 0x77d8f308, 0x1123900e, 0x1ca2f5e0, 0xd00bc9c1, 0xa1f20ef3,
-       0x2169e807, 0x57cb929f, 0x8ae7a627, 0x9e3f0769, 0x04dabf43, 0xf20d7bfc,
-       0x955f3b03, 0xb935824a, 0x0f5ea720, 0xbf21dfac, 0x864f3bcd, 0x3bc4f673,
-       0xaf9c006f, 0x68f960f7, 0x6dbf7b01, 0x1a73c130, 0x7485c8a1, 0xf3554fd0,
-       0xbfe83949, 0xa9f69547, 0x6cbef7e0, 0x1bbdf167, 0xd3ea0aec, 0xae16eda7,
-       0x71be2757, 0xb6c7952d, 0xf9c2acb0, 0x36f0b6c0, 0x37a800db, 0xbd6e788a,
-       0x4af6a52a, 0x2c35bf18, 0xd9e6b833, 0xbfc00382, 0x3d71926f, 0x0e379d68,
-       0xed44c1cf, 0x4fdb30b7, 0xea7f0b6c, 0xcfa31b9e, 0xb89f1b5b, 0x1b0fe212,
-       0x31f7f12d, 0xdf2cd857, 0xae8d7fcb, 0xf29d0dbf, 0x58d8562e, 0xfda3c75e,
-       0x4d963ce8, 0x61d7c73b, 0x39630f26, 0xb82e0f9d, 0x2bbfe701, 0x3a7cfd4c,
-       0x8ef1528f, 0x79d0871b, 0xc48bfe8e, 0x26d12bf4, 0x47674ecf, 0x1afde080,
-       0x5fa82fd0, 0x0e2cff6b, 0x44a0b887, 0xf0c45ce0, 0x6fe805ea, 0x7ca6e6bd,
-       0x50a2f94e, 0xbe030d0b, 0xc14e189d, 0x3eaa0a7b, 0x8fd76824, 0xfc0c9668,
-       0xd5d7c859, 0x9f1616c2, 0xd8d4791f, 0x3245ba3e, 0x8c4141d9, 0x693d8f1f,
-       0xf3ab5e7c, 0x03a49bb9, 0x24bfaf9f, 0xd517900a, 0x0fbc4ed6, 0xe6dbb850,
-       0xda3842f5, 0x2b29c02e, 0xcb125e5a, 0x9bf7ade2, 0x6b0f2c6d, 0x9d7042a3,
-       0x89c0b8d9, 0x17fb08fb, 0xeb3cc62c, 0xebe67eaf, 0x5edcef1b, 0x664a7e8c,
-       0x325af5fb, 0xbdfc0519, 0xaf78605a, 0xb7dd8acd, 0x9f9d4bd2, 0xf9d6fe75,
-       0x92416b3a, 0xcbde5e2f, 0x7bb33b60, 0x120c178a, 0xf6d7f014, 0xa9fc780a,
-       0x219f01f5, 0x065cdb7f, 0x00d903c8, 0x79e3554f, 0xe16dbbb4, 0xfb5479f8,
-       0x0fe66e6d, 0x0558103e, 0xa53f1e79, 0x327a09c2, 0xd1ebbf71, 0xa083aadf,
-       0xab677c2a, 0xa6e78d9d, 0x16c8dbe6, 0xb54ad388, 0x80bb3759, 0x5fae4bff,
-       0xb27de143, 0xebeb82dc, 0xf08bd946, 0xc1092a07, 0xa73f03f8, 0xd92a7bd5,
-       0xec7e7b1c, 0xa8e8ad88, 0xa8f7ce8d, 0xeef383cd, 0x000af3e1, 0xffebf7bf,
-       0xa6bb06e3, 0xe915a2ed, 0x43fb8bd8, 0x6de777fa, 0xd80f4f0c, 0x7be077b5,
-       0x72869152, 0xbdb9f5e2, 0x39c186f3, 0x18f78a55, 0x5fa0ea39, 0xea91e700,
-       0xc28e3aa3, 0x20b4ea93, 0x534d125f, 0x031e7a3d, 0xc8c5efe1, 0x04088905,
-       0xbd741cf2, 0x8885842a, 0x70c1ca8b, 0x7e02339b, 0x9d056a47, 0x4ec10537,
-       0x66bfac6c, 0x1cf44ce9, 0x5251e61c, 0xe4842cbe, 0x12798279, 0xfd05a890,
-       0xd756faeb, 0x0853abd3, 0xc7eacbca, 0xed0d60a4, 0x62d49367, 0xae4af887,
-       0x56c316a6, 0xe2a4aa74, 0x153ebcf9, 0x1c73f304, 0x44a54f79, 0xf42a16ed,
-       0xef11bf43, 0x1fe7178e, 0xe5f1d76a, 0x2be027fb, 0x7efb70ff, 0x76bc6f30,
-       0x75f79e36, 0x51e9da1b, 0xb1edc1fd, 0x8efebe52, 0x2bed8cfe, 0x24b5c893,
-       0xd66f8e36, 0x327dba1f, 0x03cb7c7a, 0x6feef80e, 0xadda4e0c, 0xe08ddf06,
-       0x13ea8df3, 0x0c8e6ebe, 0xbf427d53, 0x3b0f082f, 0x82eef100, 0x771c990f,
-       0x038727d2, 0xfbefe022, 0x5f3311ea, 0xb9508d0c, 0x5583ede4, 0x89ecbf38,
-       0xafbda1d6, 0xd277a8dd, 0x40cf0da6, 0x9bf3973b, 0x7cbacf19, 0xe0bee59b,
-       0x2b01ef5e, 0x60910b83, 0x1d08871e, 0xa079a870, 0x60888e97, 0x5115b7ef,
-       0x0eb8503c, 0xb94bf972, 0xe61ebc10, 0x9d7c3ebf, 0x7be4e41d, 0xfa1127af,
-       0xf27c4c75, 0xde37d171, 0xdcf8f2ce, 0xfb658780, 0x24f5f02e, 0xca8ef482,
-       0xd8939501, 0xffce8978, 0xe5d77e66, 0x3a0e06a3, 0x0bf9e1e7, 0x28aceb02,
-       0xbdf0f084, 0x00f26c95, 0xbb7b755e, 0x24b7db86, 0xdff68590, 0xebe10f4a,
-       0xf8104e51, 0xedd646a4, 0x362daf75, 0x55d2b53e, 0xfb6df19c, 0xa9175535,
-       0x8793167f, 0xa3b5255d, 0x517556ff, 0x1bdfe7c1, 0x450a617f, 0xf37f01ba,
-       0xe33b3ded, 0x57c83c6f, 0xe62fffcf, 0xbf3ccab7, 0xfcc76ab5, 0x6bdf12c6,
-       0x147f542d, 0xe35758ae, 0x7793f150, 0xeb3b0b33, 0x657cfd05, 0x96603d22,
-       0x6b4b91f7, 0xb498600f, 0x72af790b, 0x3212fc70, 0x98d9f41d, 0x725bb508,
-       0x05ffcb3b, 0x072abf3e, 0xaddb7bc3, 0x9e4103ed, 0xdfbe8856, 0x16a811d9,
-       0x8aec058b, 0x1eed04dd, 0x6e63beef, 0x1ee6f794, 0xb3a7f586, 0xf660105d,
-       0xf4475f26, 0x48d0a7b8, 0x738e80e5, 0x0e7beec4, 0x30f1affa, 0x340e14bf,
-       0x623a7e81, 0x5e03d5f3, 0x24c6141d, 0x28324f38, 0x28e2cb92, 0x25dc8311,
-       0x49873392, 0xde74428e, 0xe805aeb0, 0x484036ba, 0x7b02cf0c, 0xd502230a,
-       0xf4b7602e, 0xb06c242e, 0x06f30465, 0x7bb3e77b, 0xb0177a00, 0xb4dec77b,
-       0x5bc938b3, 0xcbd11d7c, 0x03f2b623, 0x912cbf00, 0xfbe0b580, 0x42a00dc3,
-       0x5d88f17c, 0xb27807db, 0x8f386995, 0x0af10f6c, 0x52d98e94, 0xad7d8048,
-       0xc0aaa5d4, 0xad848ae2, 0xfed25043, 0x45ab27b2, 0xfeecf740, 0x6509cf04,
-       0x4713fd83, 0xe5d98e6e, 0x6b07161f, 0x1f8764ec, 0x487172e3, 0x31edf3a1,
-       0x473fe599, 0x7c1439e3, 0xebab6fc0, 0xeb6c9c56, 0x225f2c97, 0x6cf0c290,
-       0x6080cbf6, 0xd7892f30, 0x6488541f, 0x29bf454f, 0xb0197c00, 0x726fd0d8,
-       0xef086f10, 0xc7ea4949, 0xbc1145ee, 0x2bfea0eb, 0xf706dda9, 0xa0f2e825,
-       0xe3a3f9f3, 0xf44af66e, 0x73f8f755, 0x52d3e0f9, 0xe027ff7e, 0xb9dc75b9,
-       0x2671ab81, 0xef8c39ed, 0x6790d134, 0x51afd3a9, 0x0ecfd036, 0xfd5892f1,
-       0x810652ed, 0x242ade3d, 0x6a5fc179, 0x7830245d, 0x43cf1b05, 0xccf30c95,
-       0xa33f3074, 0xfec5eb8d, 0x0f38b949, 0xf3a09d7d, 0x5d71875b, 0xe7a23cd3,
-       0x8ce74c8e, 0x3290e7cc, 0x9df1a2f3, 0x2b07cc2c, 0x184ee057, 0x40ec2e72,
-       0xddcaacfb, 0x9ce2439e, 0xb168c993, 0xa6073dc7, 0xfd6f1497, 0x5e427a92,
-       0xe80a7561, 0x993b8cd9, 0xa3e3307e, 0x3d0c084d, 0x7f63fb04, 0xa3eee390,
-       0xe66665eb, 0xe8f3298d, 0xd75999fb, 0xdf3fa963, 0xc6e294e0, 0x0925c70b,
-       0x0c8fcc3f, 0x18df3cb2, 0xf3071dfe, 0xe77beb39, 0xbfc50d3d, 0x1be9e31d,
-       0x37de1892, 0x6fbc3124, 0xaa7c7450, 0x1d7f20c9, 0x5f21af75, 0x96dfbd62,
-       0x509e4122, 0x73e50b20, 0xbbd187be, 0xed0d7de3, 0xbb449e96, 0x125036fe,
-       0x0db265eb, 0x7dc59ef9, 0xdfe0bcf4, 0x994b9ff8, 0xdba7ed48, 0x8d505f38,
-       0xc29be8c0, 0x7eb0bee0, 0x4e9b8e12, 0x1481da2d, 0x2dca0bcf, 0x9d07885e,
-       0x1bbef39d, 0xc9cdc88e, 0x78242e6e, 0x0d7ab5f4, 0x157f73f8, 0xd125b77d,
-       0x5036d27e, 0xf183d545, 0xa525c805, 0x8fb8f5d3, 0x3712db39, 0xc497cfef,
-       0x925776fc, 0xccc8e107, 0xea748a9c, 0x014e4fa8, 0xa7ccc37f, 0xe6b35e54,
-       0xb738ef0d, 0x1166f946, 0x6f2cd9e0, 0x1469326d, 0x208add70, 0x7674d2be,
-       0x975b7ae6, 0x43903497, 0xa72a8fd8, 0x73a7547a, 0x3a6afe3f, 0x4ff13bc6,
-       0x1ffeff08, 0xc7b847e0, 0xd45ea317, 0x620c88e5, 0x7a0ede7a, 0xd9ce2637,
-       0x3ed7f4d6, 0xd1f89fb0, 0x60bbcfcf, 0x52efe93f, 0xecf40bbb, 0xecfffbc9,
-       0x8f863c82, 0x8ef167ee, 0xd7fe4cbb, 0xff4c4923, 0x5e54947f, 0xdbbaf303,
-       0x2fa175ff, 0xbdc95f86, 0x51645f6c, 0x6f9d3450, 0xae379e34, 0x17cf990c,
-       0x95df1007, 0xfd78fc52, 0xe71624fe, 0x59bf5459, 0x7c6156c9, 0xae81afdf,
-       0x797fb927, 0x03dd81b2, 0xa733c3a2, 0x3e02a87e, 0x56c3dfd7, 0x2cdeafbe,
-       0x9b43f5b3, 0x3e62fb0c, 0x9c33378e, 0xa4fdf887, 0xa22d7ff3, 0x8e9b33df,
-       0xc3d52f75, 0xf3cb30be, 0xfe63cf35, 0x9c296a47, 0x90ff9fe7, 0xbc34fe80,
-       0xcf5d3f7f, 0xc5aef77c, 0x3cf333fd, 0xa08fdf3b, 0x90b5dfa1, 0xce7cdbd3,
-       0xed98616a, 0x3e23cf6f, 0xf94ecf94, 0x0f966118, 0x9e238e6d, 0x00e79c3b,
-       0xf126343c, 0x3242ab7d, 0x762ef212, 0xfc97ee1e, 0x675ef96d, 0xd3f2b9f8,
-       0xa4f44f3c, 0x9359609f, 0xdbf3b2a4, 0x814bb7e1, 0xee3596bf, 0xbe657bc0,
-       0x0caa3eab, 0x84ff729f, 0x6a25e874, 0xe811fe5f, 0xc1827c48, 0xf9b65cee,
-       0x65fcc2bc, 0xf83b9f86, 0x1f003bf3, 0xeececfb8, 0xa963b90f, 0xdef6217c,
-       0x8c92f799, 0xa267ebfb, 0x3cd9e4e7, 0x93bef92a, 0x5f333f3e, 0x9b3e70d7,
-       0x9ada75b7, 0x35ca745e, 0xf872274d, 0xfbcc0779, 0x2166f9d6, 0x8acd2f29,
-       0xbd3a1fc3, 0xfe107ca2, 0xd3abc225, 0x6ced5e69, 0x2640af3e, 0x84cbf7df,
-       0x2f9992b8, 0xd76f3aba, 0x80e4b72a, 0xdee99abc, 0xfb3ce09a, 0x3ed893df,
-       0x2b553ced, 0x9f38bd05, 0xc4f1af94, 0xa5272bd8, 0x81f743da, 0x7c656d1c,
-       0xe06bd51c, 0x7ebe82bc, 0x7cf5c64b, 0x80cd4bb9, 0x1e90917b, 0x87615e70,
-       0xe9ef0035, 0x6bf71ce3, 0xf0197f5a, 0x69e5865d, 0x7fd6b97f, 0x82fb4740,
-       0x10dde78d, 0x441b6dc7, 0xead3be30, 0x71ebc232, 0xc78f0888, 0xa5bbd6c1,
-       0x1f37f352, 0xdada0e80, 0xc711f98c, 0xd0f8f12f, 0xbc596b25, 0x10ed5e79,
-       0xdd05f70c, 0xf74ae5c5, 0xf4e6ee3f, 0xf6cc2bbb, 0x9a6ce7bd, 0xdf30f486,
-       0xfb847267, 0x041bb32d, 0xfa6623d4, 0x775ef7cc, 0xdcedf40a, 0xdf7e1160,
-       0x11e45e89, 0x6e99bba4, 0x761e1deb, 0xad548dbf, 0xc73f7dc0, 0x4fb80937,
-       0xde8124b8, 0x8f0777fb, 0x3e737767, 0x822479e6, 0x55d6e17f, 0x98117a6b,
-       0xf80550ff, 0x3ebf0cdc, 0x6344f9ff, 0x37cf877a, 0xcb48bcd1, 0x829f2cb5,
-       0xc28be3af, 0x65a97eec, 0xaf2c888f, 0x748bc793, 0xcd7875f8, 0x971528f3,
-       0xdb6f3e62, 0x09f31106, 0xd7040aef, 0x77cbbdc0, 0x3d7016ad, 0x5d27444d,
-       0x32fbe84f, 0x63671acb, 0xf68f957e, 0xdb697603, 0xd9170487, 0xde0275b6,
-       0x9e90937f, 0x94579661, 0x30849e88, 0x74a3cdba, 0x7e6e387b, 0x3fd6915c,
-       0x78273f76, 0x763fd6bd, 0x3084897f, 0xdd4964af, 0x4af3c334, 0x774f5187,
-       0x3aa47f25, 0x2e9cde7e, 0xe9fcba6f, 0x9c1eb8f2, 0xa51fb073, 0x5ceca1e0,
-       0xe863cfc0, 0xfbfd50af, 0xff8b0773, 0x7d1b7a3c, 0xf3c6d965, 0xf984fd86,
-       0xe6bd18a3, 0x79f1938b, 0xe28375a2, 0xd787a0c1, 0xf87a8c3a, 0x9f47ce87,
-       0xfa272e87, 0x6272ccfc, 0x0f4cdefe, 0xa6670e3d, 0x001e998b, 0x470df827,
-       0x07c11c9a, 0x04479c28, 0xc9a07706, 0x66b7708e, 0xfe706896, 0xedd65966,
-       0x0f811e58, 0x57bd8347, 0xed038cfe, 0x7957ee56, 0x4503e7e3, 0xf76e25ed,
-       0x41961988, 0x93111e30, 0x2ec790bc, 0x77aa5b66, 0x7d8a79d2, 0xd2183969,
-       0x9c22bd99, 0x992daee7, 0x143dc220, 0x77bcfc35, 0x379d858d, 0xc3dbfbd3,
-       0xed97a0f1, 0x8046f28e, 0x9a9fece7, 0xfe2c1d0b, 0xce0afe8c, 0x143dee13,
-       0x760dbfa8, 0xf304ebf0, 0xc8d20b69, 0x83b7a001, 0xee40a368, 0x72a4743f,
-       0xffed9c3b, 0x286cbfd1, 0xcbcb56bd, 0x3f9097aa, 0x49b3e2fc, 0x37b25f70,
-       0x9722b2d9, 0x38e2ffd6, 0xb9ee093d, 0xce5b66f3, 0xfda87ae7, 0xd59cf8ed,
-       0xef9cb6af, 0x737feb47, 0xd875619c, 0xf87b82a8, 0x0527671c, 0x1e38c306,
-       0xb5eae7a6, 0x243e41ab, 0xa597f30b, 0xc3c60afd, 0xd5fdfdf5, 0x17e0e694,
-       0x79f9c87f, 0x17e2aacd, 0x2c67101c, 0x6fd854d6, 0x71be0ade, 0xea5fefcf,
-       0x161d1578, 0x4a0367bc, 0x1ca7ffc0, 0x485d3a9f, 0xe4357683, 0x7690923d,
-       0xb483ec35, 0x1dc77c3b, 0x91d87db4, 0x572009e6, 0x5fbcef0d, 0xf68df788,
-       0xa30cfd65, 0xf3a6e20c, 0x9f6afb39, 0x8afbb1cd, 0xcfa28eed, 0x0c943e81,
-       0xaa084768, 0xed41dc87, 0xa88d1a86, 0x31f81e4a, 0x81bdbb46, 0x49d7d9f3,
-       0xcf91e7e5, 0x9f50477a, 0x7df0e53c, 0xfd9be305, 0xda9cd211, 0xf253fe2d,
-       0x7af8c5ef, 0xd1e3766a, 0xff9f2039, 0x0afdcec5, 0x7af9869a, 0x9ef7a3db,
-       0x1df7f410, 0x710bc924, 0x9925e236, 0xb71e7481, 0x4abe30b0, 0x4bf18c2b,
-       0xf7e87cf8, 0x951ee113, 0x1fb60e91, 0x8227e74c, 0xa894369f, 0xf8830e58,
-       0x9ab01e43, 0x487beb0f, 0xb47de8e8, 0xccedc7ff, 0x11d5b7ef, 0x84675c43,
-       0x7707d993, 0x275c58b9, 0x0cdd0e49, 0x0be93dfa, 0xdefd01e2, 0xe12294f6,
-       0xb9e4a67e, 0x0e39f711, 0xf82e3059, 0x40f41cac, 0x4afdbd7c, 0x3a42dd49,
-       0x74e36bfa, 0x5c7dfbd7, 0x7884af51, 0xb3175cca, 0x222d9e27, 0x7edaf798,
-       0xfec2094a, 0xadb66a57, 0xcf4fd63a, 0x4faddfe7, 0xa4e41e2e, 0x8929a865,
-       0xf723f8c0, 0xd2928352, 0x02fa85e3, 0x76c5f03b, 0x43c511c0, 0x0f73d5aa,
-       0x9e7a97f4, 0xcf8b9bc2, 0xa4afc435, 0xf8a64d0e, 0x5383731d, 0x9e297b85,
-       0xc06e87b5, 0x2d17bf3c, 0x76d3ff78, 0xea0d3bc5, 0x1ea9cfdb, 0x9b3d0788,
-       0xf9c24a1b, 0xf9c168bc, 0xbf6a4f6c, 0xfb85396a, 0x8e2c41e1, 0x64883920,
-       0x2a79054b, 0xcfa1ef56, 0x7d993bc7, 0xe4c2dabb, 0x62a9daa9, 0x8e8171fd,
-       0x15ef005f, 0xf9e91ca1, 0xeced6d17, 0x5bcf471c, 0xe7e0459a, 0x3fba69a4,
-       0x0fc1111f, 0x704e571f, 0x94e71d5d, 0xad3a2a83, 0x2176739a, 0xd6ceffdc,
-       0x2e1f098d, 0x29f2cc9d, 0xefc2efbd, 0xf2701c21, 0xbef836fb, 0x4f9cb5d0,
-       0xd11693c6, 0x5fc7db46, 0x2e48de24, 0x8c6af7dc, 0x5a633edf, 0xfef127e7,
-       0x44cf76b5, 0x8c445c78, 0x0da4f0eb, 0xae20a7a5, 0x09344c5c, 0x66c4a9f8,
-       0xdcf5876a, 0x9ac4f70d, 0xf273c9ee, 0xe4872b75, 0xe8fde6c4, 0xe249fb71,
-       0x47688de0, 0xc05e2994, 0xf6a70ecb, 0x0d4fd857, 0xdbf2f750, 0xf8cf3de2,
-       0xa0d67e59, 0x57020e8b, 0x74fe50ff, 0xdaae7cc2, 0xd3b01b50, 0x9fd55f79,
-       0x087c0ff5, 0xa78ae5fa, 0xbe807ad2, 0xe97a7377, 0xc077cea5, 0xc6649e5f,
-       0x3a6b9e5f, 0x273ef3e4, 0xf2e89b8b, 0xfd077c06, 0xb78391ec, 0xa41fdbc7,
-       0xf01f7afc, 0x41270eeb, 0x5917fa7b, 0x672059b6, 0x9dfb38fa, 0xe5cdff8c,
-       0xf7cb559a, 0x0412efc1, 0xc6eb64be, 0x31175ec4, 0x6eba2e4f, 0xab783327,
-       0x53e9dad4, 0x29c76f21, 0x3a4e5e63, 0xcb16373f, 0xfc31592f, 0xab5df3a2,
-       0x3adff993, 0xfeec94ff, 0x284b9e33, 0x06fa92f9, 0x376a24b9, 0x2133fcea,
-       0xb37dc110, 0x89d98409, 0x99d9fe66, 0x2e8a7f80, 0xade812a8, 0x9873fc4e,
-       0xbe224ff1, 0xb048fda1, 0xe7f99a0e, 0xe3b72719, 0x25cff212, 0x6569e037,
-       0xeeb7c953, 0x8dfa34ef, 0x72e67cf9, 0xbe7e23b4, 0xef1c67e7, 0x1bda95bb,
-       0x4c6f41f3, 0x2f4178b1, 0xbec8ee50, 0x3bbbc299, 0xb5d7bf49, 0x3bea0f3a,
-       0x7687a624, 0x87a8ad84, 0x3e7d3876, 0xb2658b8c, 0xf24474f3, 0xb6fe40b5,
-       0x8d4d97b7, 0x7efb27bd, 0x39218fce, 0xd804fa32, 0x3e306f45, 0x00a53518,
-       0x5921bc6e, 0x185e98f3, 0x0cd9527e, 0xd0b28fbf, 0x9386f455, 0x74067fbe,
-       0xc753ac07, 0x60b7bc14, 0xf50531d9, 0xdf7babe3, 0x93b8852e, 0x723a179e,
-       0xc5a5dbcf, 0xc67de183, 0xfd736f6f, 0x6531d7aa, 0xe9a5f41e, 0x84d1d85e,
-       0xbdf331e9, 0x47c0e5ae, 0xe6ed1df9, 0x49434efb, 0x933d2e2c, 0x0e9bb2a8,
-       0xf958fd31, 0x885d7083, 0x99d3def9, 0x4fd01b91, 0x5f5de5b8, 0x394f7bfc,
-       0xdfef987f, 0x77c93afc, 0xf95fe61a, 0x985ef342, 0xbad95102, 0xafaa521d,
-       0x579ef766, 0xe93f01e7, 0x147f8872, 0x068fa17f, 0xf5ddee19, 0x11e8f5f2,
-       0x7beec4af, 0xbf705168, 0x7d8497e7, 0x98ebe217, 0x40f4c5cd, 0x6e97cac1,
-       0x55873807, 0x2e800768, 0xf9993bff, 0x1122bfd7, 0xcdd01e5b, 0x3a9c612b,
-       0x2725ab24, 0x88f78e84, 0xce083e54, 0x99e9ed75, 0x5fc60c34, 0x5c39f2e8,
-       0xed486f60, 0x91bbe187, 0x81860a63, 0x5d0e771e, 0x35d603dd, 0x570a6e1d,
-       0x076736d9, 0x175c3a1c, 0x742cbf39, 0x7ab876cd, 0x2f40efb2, 0xdc7c7e35,
-       0xfcebdf06, 0x82fa6a10, 0x5f0c41f1, 0xf0741f00, 0xd4377085, 0xf1a43c75,
-       0xd8ffaf52, 0x97fba17c, 0xf805f25d, 0xc5efee8f, 0x715c4317, 0x73da82f8,
-       0xd9b9e1c3, 0x2c290b9e, 0xfcfccccf, 0xbe114729, 0xe60855ef, 0x76bd9089,
-       0xbe3bbbf6, 0xbf2f8c14, 0xb66361ec, 0x073c747d, 0x5ceb957c, 0xf90e4ca9,
-       0x2343df3d, 0x439fda02, 0x03b8a2a9, 0xa8debced, 0x7f1cbd27, 0xc020b8e4,
-       0x4b985dfd, 0x68760d9c, 0x6bd807a4, 0x2393ad43, 0x1d3b0f20, 0x7ec1b213,
-       0xcb8c702c, 0x32bff983, 0xb05be568, 0xabd2bda4, 0x6aade5e2, 0xeba57d87,
-       0x5bbc03c3, 0x5d5bfc7d, 0xd5ae3f8c, 0xd010f9d8, 0xe870b1eb, 0x099003eb,
-       0x332210e0, 0xa81d972d, 0x142dc3c7, 0x1c02d76f, 0x04fb0f14, 0x43f600d2,
-       0x2b4b4591, 0x67b03b01, 0xdb380244, 0x0391fe9a, 0xe1c9a771, 0x78051fdf,
-       0x5bfbeb27, 0x96fee35e, 0xedd6ded9, 0xd0ffdd21, 0x228925ed, 0xa0abb742,
-       0xa73c047d, 0xbdc0f4f8, 0x45beb0e0, 0xf53e786c, 0x95ea73f1, 0x8967971a,
-       0x9f3263ce, 0x19a44dc7, 0x2e9722e1, 0xe9471e5f, 0x63e39533, 0x491261f2,
-       0x427687ca, 0xfdc014a6, 0x4c902433, 0x15e299c7, 0x7c3127c8, 0x6328d373,
-       0xa426fe1d, 0xd5d3f477, 0x6375e6fb, 0xffce29ac, 0x7ec3cb43, 0x4dfc6e76,
-       0x3c173b3f, 0x90189fa6, 0x951dfd60, 0x7b03cecb, 0x2b0e1e18, 0x23b1d7f1,
-       0x58c79e5c, 0x3ce1f25a, 0xff3dbee4, 0xff7375c4, 0x07be7f9e, 0x53e8e476,
-       0xc63c8112, 0x2786a731, 0x28ebbee3, 0xef4af915, 0x06b3eab7, 0x49cf6107,
-       0x87e87dec, 0x15da3c28, 0xcb0d9f00, 0xfe3cced7, 0xe177f404, 0xf3624498,
-       0x5f154be4, 0x968f887f, 0x0ff17bf2, 0xd29ecc09, 0xfbf10fdb, 0x78b977a8,
-       0x93d28e7c, 0x1ac4c7fb, 0x5429e743, 0x74172513, 0xc9ca75d0, 0x7e5253b2,
-       0xdfc0fa67, 0x7e1f3a27, 0x57749e4b, 0xfb0e7ea5, 0x5eb62ef7, 0xc37f0392,
-       0x35d70cf3, 0xfd8123dc, 0x48a65d7e, 0xaf7198b4, 0x1fa7a957, 0xebd8f713,
-       0x07bfd932, 0x2a627b9e, 0x111e79e4, 0x2aac6531, 0x7cade3bc, 0x718b37a8,
-       0xf19ba7cf, 0x1ef85d7b, 0x887ff809, 0x574dc99b, 0x8ab98fe3, 0x4035c9f2,
-       0xc0ecc277, 0xc8e50142, 0x7bfddf4c, 0xcb47a3fe, 0x4ef8c4e0, 0x1d337f44,
-       0x8c533b5e, 0xd15d21fb, 0x7bb7ccc3, 0x57033ce9, 0xd97aefc0, 0xd77f0048,
-       0x83f583cb, 0xebac4cfe, 0xf4d55afc, 0xf3b00f74, 0xd49d3e74, 0xe8cdf183,
-       0x20f44fdd, 0x997a0ece, 0x19b826f1, 0x75d976fd, 0x633bc4bb, 0x67f47d2a,
-       0xa3210eba, 0xe4334806, 0x587394d9, 0x8a5bbe67, 0xf9e10976, 0x6df5e6ff,
-       0x24c778a6, 0xdd5da750, 0x3a8b7f4b, 0xb9f75bbb, 0x95a91d97, 0x952c1d60,
-       0xc63d3256, 0x1e1d78ed, 0x42ff9d33, 0x44fe11ca, 0xc0f999f0, 0x68aee70c,
-       0xeb86b27e, 0xfb4f7e81, 0x72b9fef4, 0xe8799c6a, 0xd085b8f8, 0xfbaf38f5,
-       0xdb8e71eb, 0x4fe7ffc8, 0xa013fc4e, 0x99bc9135, 0xd76e66e9, 0x0c2947f5,
-       0x00658050, 0xee2193ec, 0xd2879474, 0x60d10a8b, 0x9db7ba5f, 0x379b1a7c,
-       0xe40af93a, 0xf61e15b7, 0x2dbf112c, 0xdf1228bb, 0x93be0eb0, 0x00731f1b,
-       0x6a96eddf, 0xf7f45e1d, 0x5324d5a7, 0xacfc4d3c, 0x073c16f8, 0x102162de,
-       0xfe149b5a, 0x19c400e2, 0xcc128eaa, 0xef0e2f07, 0x3d3e012b, 0x9fa33528,
-       0x908176d5, 0xceec62c7, 0x038d70c6, 0x34c6b2ec, 0x50e99e76, 0x9be4310a,
-       0x7d33711e, 0xdcec78dd, 0xbb4e2d54, 0x79f8cc98, 0xf2d2d13a, 0xd74b3fe9,
-       0x3f00fe51, 0xe30ba7b8, 0xef051324, 0xb76069eb, 0x9feec6dc, 0xf91a6b6c,
-       0xb7851a7a, 0xd414cef5, 0xd71a9333, 0x84a1e3de, 0x0c3d7d08, 0x16cfb79f,
-       0x7be85bbc, 0xeb17aaa5, 0xd172f3a5, 0x4df91bef, 0xa193e98f, 0xfd197afd,
-       0x52e2499e, 0x6755e209, 0xf0028533, 0x2d08f727, 0xf2f7e0ab, 0x38d8d302,
-       0x01e813c4, 0x933be9fe, 0xdfc50c7b, 0xfaf55174, 0x205dfc00, 0x56dff262,
-       0xcfbf3aee, 0xce57db4a, 0x733f3010, 0x049b2792, 0x74a7f862, 0xbaf3829d,
-       0x0c519c39, 0xccbd3d7c, 0xc22c4e78, 0xe519c9ed, 0xdd8c120e, 0x283c1527,
-       0xedec87d7, 0x5cefe2b7, 0xe604c936, 0x0df9cba7, 0xce67df9c, 0x6ef861ea,
-       0xa776611a, 0x7237572e, 0xfb81bbf9, 0xb2f9b7cd, 0x1397e30d, 0x81fd0f66,
-       0x92044fb4, 0x3cb32794, 0xcdeda9a2, 0x2f0edeef, 0x8047bd89, 0x9071bc3e,
-       0x9715efc9, 0xc8be46ae, 0xc780bc14, 0xfb635e29, 0xe74ca34d, 0x6bf24d14,
-       0x20330fd6, 0xacec4a3b, 0x307d7427, 0x219449a3, 0x88a3341e, 0x62ed19e2,
-       0x95dedda3, 0x949918be, 0x525c5f40, 0xa433041f, 0xb0f8be93, 0x8be97bec,
-       0x32dba957, 0x36f5ca8a, 0x21f46f5d, 0x4c6f407d, 0x009feb12, 0xeba36a3e,
-       0x1f0e35a6, 0x1e8eebe9, 0x72a52807, 0x0ce07a8c, 0x749e2fcb, 0x86048b31,
-       0xa201c475, 0x25da847a, 0xd2f638de, 0x619e777e, 0x57aa23ff, 0xb912ec62,
-       0x25db87f0, 0xaa3da893, 0xbd7c0014, 0xc252be11, 0x90a596e2, 0xc3f102c8,
-       0x0e302fcc, 0x7f512554, 0xa7e7d716, 0xffa39e99, 0xe43b5212, 0xe8af6cc3,
-       0x3c09e871, 0x97e6617e, 0x16f23c68, 0x3a42e319, 0x3e02949f, 0x116ffe41,
-       0x2ba09f71, 0x37c7d1be, 0x14c44bf3, 0x5f92ea1f, 0x577ddcb8, 0xe6ed397e,
-       0xa4fea1f1, 0x44f8777f, 0x5f9d0fe7, 0x9bcdebcc, 0xa25138a6, 0xb09fe6f5,
-       0xbc4cf4de, 0x483ebcde, 0x95debd46, 0x992e735d, 0x6e89f9e9, 0x75773b0f,
-       0xd8270ce5, 0x59921335, 0x6ebe817e, 0x1b5de345, 0xdebc9f18, 0x7d824732,
-       0x1fd02aa6, 0xd0741db9, 0x5f3ac5e3, 0x60275b2e, 0xd732747c, 0x2c4dad5f,
-       0x5135585e, 0x8fd1c20c, 0x4f63f092, 0x6fbb3ab0, 0x14efa746, 0xd24527ce,
-       0xff7e093e, 0xe0af26f4, 0xc693b885, 0x35538de3, 0x668de301, 0x44d7b5bd,
-       0x1fbce9f7, 0xbbe0bff0, 0x2084ca9b, 0xfd6693f8, 0xb322fd36, 0x53d93a2f,
-       0xccd89f7c, 0x7326572f, 0xf497d0fd, 0x15da57fd, 0xddbf92a3, 0xefbfd0ae,
-       0xb065ce8a, 0xc0ffa0a6, 0x3b0193ee, 0xdd7ce81e, 0x2dfb0945, 0x49da3649,
-       0xfc14ce17, 0xfe4f7d0a, 0x3a1ef9be, 0x1aba7cf3, 0x17f750bf, 0x8fa0ffb8,
-       0xcec4837b, 0xa7d79bf7, 0xfe23d72e, 0x775e999d, 0xb5e31b24, 0x3d745d3a,
-       0x5cef09dc, 0x5ba2274f, 0xd75a7a57, 0x3d6aff87, 0xafaff7ad, 0x66b8fa23,
-       0x7fc89dfd, 0x9af1f5d4, 0xdb8c16cd, 0xfa7ee78c, 0xfe3f1e78, 0x7ee7b705,
-       0xdffccc99, 0x166d2fb6, 0x32436f58, 0xec0b27db, 0x69fc6273, 0x07665efb,
-       0xbe2a5cd9, 0x6220a0f7, 0x11c1e47c, 0xd4d7d416, 0xf3061a07, 0x19098a96,
-       0xbdbdfb04, 0xbd6f7ed8, 0x7d472914, 0x9c0895ef, 0x8c5d13d3, 0x1fdc1e1f,
-       0x7ffa1db8, 0x968193f0, 0x474f8c1a, 0x1a5ec19a, 0x7ee12059, 0xc5558a59,
-       0x936b7678, 0x6a3bef15, 0xf6bffddb, 0x97cfd0c9, 0xe52e0bc4, 0x746b26c1,
-       0xc7f40abf, 0x0888f124, 0xed6d1cf9, 0x1b03ef04, 0x02522b37, 0xd278d97e,
-       0xfffe035c, 0xc1e58518, 0x6cd4f19b, 0xfbcca75a, 0x2c4d255d, 0xc5c4a5ff,
-       0xed3a5ff3, 0xefe33457, 0x04904f26, 0xbce90d6f, 0xc992f15f, 0xefd8e9df,
-       0xd15fb04a, 0x77d1f4c8, 0x0318afdd, 0xde7ca034, 0xd701cba4, 0xbec1244f,
-       0xed8576c5, 0xcdbfb577, 0x6993d3ed, 0x5d46e371, 0xdeec5fed, 0x7dc1a49b,
-       0xeff9db23, 0xdbdeec6c, 0x13f3534b, 0xd2df9fbf, 0xd8d30c5e, 0x84b37f5e,
-       0xbe3c73f9, 0x9a0b8d1b, 0x90e9cbf1, 0x6b481f68, 0xf5041cf4, 0xe7df7095,
-       0xaae18a82, 0x5d4f8aef, 0x4f1fb66e, 0xb7ef80d2, 0x01a5ef1f, 0xdc79fb1c,
-       0xbcf56bd0, 0xeec2f605, 0x7092e763, 0x54d1583f, 0x53da4ff0, 0xae765e6c,
-       0x2841c992, 0xf610606b, 0xeff0f7ab, 0xbfb527b6, 0xec5a7579, 0xbfdb0e7e,
-       0xd7d9cfd1, 0x47f30428, 0x3f961602, 0x0cdfc662, 0x3b938f0f, 0x2274faf1,
-       0xbc62a9a7, 0x096f503c, 0x3f3057cb, 0xce4c3c97, 0xfdfe2fff, 0x80006684,
-       0x00008000, 0x00088b1f, 0x00000000, 0x5bbdff00, 0xd554780d, 0xdceefe99,
-       0xf26677b9, 0xfc999933, 0x4dc2fe10, 0x00908102, 0x7e100843, 0x502021d4,
-       0x4540647e, 0x043abaec, 0xa1bf9085, 0x56d3ebb1, 0x4126e1f7, 0x27d3e08a,
-       0x6796dd6d, 0x57067db5, 0x3b1254b6, 0x770704c1, 0x08a00ec2, 0x80a0db54,
-       0x11dae3c2, 0x2486a229, 0xec56bb0d, 0x3befdd6e, 0x6664dce7, 0xecfa5c18,
-       0xf8728376, 0x9cf739ee, 0xfbdf7cef, 0xb3739dfd, 0x330001d3, 0x68776e01,
-       0xdb00d900, 0x8c802f64, 0xde0820cf, 0x16e91bf4, 0xd305d609, 0x7ae77688,
-       0xa9dfe0a7, 0xce1a6ba6, 0x2cb0ef91, 0x7a448f35, 0x42d1e986, 0xc639e7a4,
-       0x699e7a72, 0xf806e286, 0xba5bc867, 0xcfc00e68, 0x03875e9c, 0xd257e9d7,
-       0x00194876, 0x65049366, 0x528ed859, 0xec373803, 0x65ac0152, 0x3c1daeb8,
-       0xaa40174e, 0xd21b7405, 0x54fb360d, 0x1e95f1a0, 0xd11a4b6d, 0x87c43d00,
-       0xa5039a39, 0xd336bed8, 0xbe00b304, 0xadc1fb4d, 0x1ef8aaa4, 0xc5a8ffbe,
-       0xfb81ce37, 0xec46b7ab, 0x1ff6015a, 0xa40473ba, 0x6c1d7ed1, 0xcf2f25bf,
-       0xc60285cb, 0x33ffe157, 0xf8c9655f, 0x75f0a6da, 0x2c940f7a, 0x64bf5c04,
-       0x1a5f8a1c, 0x59994fd6, 0x416dcf63, 0xf49f3d00, 0x9095c9e0, 0xeeaa716e,
-       0xce34f99d, 0xb6f267d0, 0x21fd4145, 0x69aa725f, 0xce51e90b, 0xc0e96d30,
-       0x89874ef6, 0xac58bfcd, 0xb7903003, 0x8e0df51a, 0x5335bc81, 0x96fa4d38,
-       0x4881b2e5, 0x9b7f5239, 0x871e7eee, 0x0f8198c2, 0xddfa471e, 0x3bdc4a07,
-       0xc290be91, 0x502eb1e5, 0x7a4512d0, 0x363025ba, 0x9d397c82, 0xf7c92f3e,
-       0x04c0969b, 0x2db4a786, 0xe4bf34e9, 0xca0ef801, 0x3d104243, 0xf16efb80,
-       0x0216a680, 0x1ce7808c, 0x90004b97, 0x332af82b, 0x2560bad9, 0x8737deb9,
-       0x1758d5cb, 0x1c856865, 0x3f82a7e4, 0xf5c0f837, 0xc1beb47d, 0x301f10cf,
-       0x153971c6, 0x4857cfd8, 0xd33cd1f7, 0x0a321e50, 0xfff3d705, 0xa0b014de,
-       0x3ff8fdfc, 0x325f2fd1, 0xc9897405, 0x2cfd6d3d, 0x33ad88f6, 0x9966ade7,
-       0x9fe3ab31, 0xecd44c59, 0xbb543ca7, 0xf748ec02, 0xad462f98, 0x37f61d62,
-       0x9cf91c6e, 0x7d9fde27, 0x8d30b7c2, 0xc7e2f7da, 0xffa783cd, 0x15fbe320,
-       0xe5019010, 0xd09a2732, 0x31fe5a1f, 0x4aef3fcd, 0x77bff3fc, 0x7db167a4,
-       0x5f51828d, 0x77227db1, 0x95a35eb8, 0x66f837af, 0xd3e10641, 0xa2d9466c,
-       0x864d55fc, 0xa2bf6c0a, 0x3a003b9f, 0x0b38e2b7, 0x56adc1c0, 0xe3394ed6,
-       0x84eb40d8, 0x269022b6, 0x35babc02, 0x1d86b597, 0x0f03394d, 0x7598d4c1,
-       0x390dde04, 0xe5c7be0e, 0xe93a3d38, 0x5691f3a7, 0xd010284e, 0x5730e586,
-       0x5d106bc8, 0xf079e906, 0x475b9a4a, 0xbbc9d67a, 0x4b4fb265, 0x98b409ae,
-       0x14b4d9fd, 0xd30d26d0, 0x715c93a9, 0xb8f42cb4, 0x9e7f66cd, 0xf4f742e1,
-       0x333ae2e4, 0xeee93ac4, 0x41f37151, 0xe8c4ff00, 0xe2d755f3, 0x67ee1213,
-       0x0af55a46, 0x454657da, 0xe5fcdc41, 0xbbcbc66f, 0x091ebc0c, 0x8fbf765f,
-       0xb3fbe3fc, 0xcc7f60ce, 0x2b488af8, 0xfbc547c3, 0x5ee7cff1, 0x6f3ba78a,
-       0xc99bb7a6, 0x74fea613, 0x2e5fd67e, 0x5e27a74f, 0xe34b999e, 0x8ded99e5,
-       0x7588e797, 0xe91af2f1, 0xe8c7978b, 0xfd71c9ea, 0xc594b763, 0x33bee3d1,
-       0xbe7c6e37, 0x1747195e, 0x371658ee, 0x9aeb427e, 0xeee27a38, 0x2f8dc66f,
-       0xf5c5540e, 0xf9abec97, 0x253ff48b, 0x9e3718d8, 0x1afa6cc4, 0x7d0b4ffd,
-       0xbfbd6e2f, 0x9dfffe96, 0xcf7e8ff4, 0x7a44bfd0, 0x42fa499f, 0x1c36593f,
-       0x06b89c9f, 0xf8674bf9, 0xda12eb8d, 0xe9a95ea5, 0x0cbebcc4, 0xf7d82ddc,
-       0xc895ec8c, 0x51468dbf, 0x6c6fd09b, 0xf9354133, 0x4c981ffd, 0x86d3790f,
-       0x94e4dced, 0xaacffcd8, 0x14b8a660, 0xe94d6e3b, 0x4da338f0, 0x78d89a77,
-       0xd37edfc3, 0xd144b5a2, 0xb9974e9f, 0x9b3f453f, 0x707f44ee, 0x21427a41,
-       0xe964a937, 0xc594af8a, 0xd8bc879d, 0x6a4b213a, 0xd86336c4, 0xa15f6bbf,
-       0x81a82e52, 0xfe213fbd, 0xbdeec94f, 0x486fffc8, 0x17492320, 0xef3f166e,
-       0xa696fc37, 0xf8633865, 0xe2334c1a, 0xf14196ad, 0x42e1f073, 0x3fced7e6,
-       0xf50b4e88, 0xfbe55e7f, 0x115fc631, 0xe153ed7e, 0x9fc97ad7, 0xabfb8659,
-       0x5d38fcf7, 0x4fce79c3, 0x18c1a582, 0x390b1539, 0x2c1c1981, 0x3ae3ccee,
-       0x4bb350bb, 0xdff388d9, 0xa16c2ef7, 0x13fbee75, 0x6f7d896c, 0xfe6153b6,
-       0x6653b671, 0x726c5aed, 0x316bce51, 0x18cb39a6, 0x5db0911d, 0xb2140275,
-       0x7cbed5cb, 0x0ef28485, 0xe176cfb8, 0xd1480b92, 0xe03ddef8, 0x9fffc855,
-       0x9d3eb07b, 0xf3cd0dc6, 0x117713c6, 0xa2a2d73e, 0xd7792f29, 0xe8392ba9,
-       0x936e060f, 0x75c49c58, 0xfbdcf4ac, 0x2927e8c0, 0xdf039cbe, 0xafa8b3d5,
-       0xf366e035, 0x7222f319, 0x05ccfce3, 0x38992215, 0x12c17e8f, 0x347c8bd8,
-       0xfa825e52, 0xc11eec69, 0xcd7f5fe2, 0x827fdb1f, 0x1d1a1ee3, 0xfaf14b1d,
-       0x8a9fcd42, 0xeff7cf48, 0x7d434196, 0x77c5377e, 0x90c0e117, 0xaf87f9c3,
-       0xc63f53a5, 0xd867a65d, 0x65ef716f, 0xdecfdbf2, 0x73adc633, 0xde9bb82e,
-       0xd0140a83, 0x67f11b9c, 0x496814b4, 0xe06a352e, 0x3e43dfe7, 0xe6c294e1,
-       0x59b2f033, 0x5f31a5e0, 0x978b111b, 0xbc21f4c6, 0x71ab7cb0, 0xa6ecccaf,
-       0x0016dbb1, 0x8159cb94, 0xebfeff3b, 0x234f7d2f, 0x1f3de782, 0xc4346e21,
-       0x3711efc9, 0x8fbdc61a, 0x3f443711, 0x886b7b2a, 0xfe9e8fdf, 0x79a3eec8,
-       0xbe35b9ef, 0x7381a5fb, 0x3df2437f, 0x083ef1c9, 0x5f98e783, 0x28d62cef,
-       0xf0785baf, 0xebca39fa, 0x9a2d3a1a, 0xceabe905, 0x6967f1e8, 0x680921fc,
-       0xc6c4437c, 0xa743559c, 0x7f61b014, 0xfb63a84d, 0xda6ba468, 0xd8539756,
-       0x7221dbf0, 0x901ff507, 0x7fd8cd02, 0x7b5eab79, 0xf0b87509, 0x6997ebd5,
-       0xf957bede, 0xeab657bc, 0x9013cc1b, 0x03feb03e, 0xd3aeaf9a, 0x6fd43602,
-       0x8ea2339f, 0xa43af5a6, 0x1d57ad20, 0xf34aa1fc, 0x7ab0bf57, 0xb539a53c,
-       0xc6aa9afb, 0xbebff8c7, 0x0d55a783, 0xf9dd54e5, 0x5c62c5c3, 0x015f0f39,
-       0xfec63766, 0x369a0737, 0x2ee36398, 0x7b275bfe, 0x2df77e12, 0xe175ff21,
-       0x271216c2, 0x67ae95fa, 0x7657e625, 0xb872bf33, 0x85fedffd, 0x8bf43bd6,
-       0x281b8409, 0x837935bf, 0xb1716757, 0x5703ac41, 0x9ea951de, 0x2e54e869,
-       0x7c65e7c7, 0x77a735fc, 0xf92673af, 0x85b49855, 0x79f13bd5, 0x25940ee2,
-       0x7e7ae1e5, 0x390fb30a, 0x8f5d406d, 0x069f7cfc, 0xc7663f20, 0xf4855a80,
-       0x5718970e, 0xcdec0d60, 0x3ebf91bf, 0x67ad99a7, 0xac5f002d, 0xcfda30df,
-       0x82b1ff44, 0xd528d54f, 0x9515da17, 0xf910db70, 0x7f90d544, 0xc5c3e87f,
-       0x7def249e, 0x6295fc22, 0x29ef56f2, 0x468fb61f, 0x714a39a9, 0x44d0f1aa,
-       0xd67a674d, 0x2ebf8ca3, 0x58fb469b, 0x5993f078, 0x3ef998d1, 0x578c7c43,
-       0x5f86e986, 0x2155387d, 0xe1fcbdb9, 0xcc7a7354, 0xaad2723e, 0xe0f94903,
-       0xbb49e2f1, 0x5bad0af7, 0x35a2d07f, 0xdcdb7c33, 0x3877c211, 0x44668dd5,
-       0xcb9b56f8, 0x3f7df163, 0x2c21bbe3, 0xd0e911bb, 0x6bed5a10, 0xddd3e362,
-       0xb43906a4, 0xc99c2740, 0x23c32f0e, 0x37ae27fc, 0xfe30e28b, 0x756a3fa0,
-       0x78477efa, 0x55e9a731, 0xdaf898e6, 0x35e68a60, 0x5f3fa44b, 0xfb1882eb,
-       0xad74d393, 0x99e48b39, 0x61b596e9, 0xae2629fd, 0x6a2d3e97, 0xdb1c5177,
-       0xbd91f38a, 0x93b13e44, 0x3687b7fc, 0x3beec958, 0x47ae0e9c, 0x481cd755,
-       0x877a09b7, 0xbb26adea, 0xc29391da, 0x2e31b5eb, 0x09ffef86, 0xaf647daf,
-       0x3e028eb8, 0x09f77f56, 0x058df5bc, 0xf7297fe6, 0x94c99c23, 0x199215ef,
-       0xce341cf9, 0xbdaa6a1f, 0x87976b14, 0x7f1373ee, 0x1f7f0a4a, 0x135e3872,
-       0x7175cdd7, 0xaa693d9c, 0x13105d6a, 0xe5c71387, 0xc399b8d0, 0xceb30072,
-       0x697001ce, 0xfefc324f, 0x776959c2, 0xde5dfe91, 0xcd87e449, 0x51e118c4,
-       0x81f29353, 0xd95cb3e3, 0x2e4de3c3, 0x554f5b07, 0xeb920e7c, 0xad39397f,
-       0x67265ea8, 0xec8d6c34, 0x057f6878, 0x9b3b526a, 0x91def82e, 0xc4f7af1f,
-       0x38c4d371, 0x56e7a4c5, 0x65879f11, 0xdafd3766, 0x31bfd300, 0x9d723fae,
-       0xed7c3feb, 0x79d90f2e, 0xcf865afe, 0x5c597f4f, 0xbbccc726, 0x853959ce,
-       0x12e793f6, 0x5cf45078, 0x2ba47be2, 0x733f1f7e, 0x62b8677a, 0x4c601fce,
-       0x04e12dd6, 0x16e07d44, 0x83eb0ef1, 0xb57c6649, 0xe4dc521f, 0x1e443bdf,
-       0xc32f066c, 0x35b82a49, 0xe07af756, 0x7f70f3d7, 0xb04c472d, 0x1d3b4913,
-       0xf3628c72, 0x04d8b079, 0x8a326cbb, 0x4b158f08, 0x323212bd, 0x9ae25fec,
-       0xc86d8df6, 0x65d021ef, 0xd7c73f5e, 0x3c91e0c1, 0xfbfd6c52, 0xd5adcd5a,
-       0x5af9cfbf, 0xeb13cec8, 0xd31139df, 0x16e3357a, 0x96d7e0ea, 0x1f83ad25,
-       0x53d7c574, 0xc634bb0f, 0xc712705c, 0x12923061, 0x3028e7e0, 0x845c7083,
-       0xedfa84e1, 0xa555bc39, 0x275649be, 0xf4d733c6, 0x418c76a7, 0xe5cf1b3b,
-       0xfd0b7440, 0x8df3ca3b, 0xb5fabaa1, 0x44ff2cc9, 0x7ab3247f, 0x497821d2,
-       0xe6395fd0, 0x7118bc49, 0x91e5d5c7, 0xc9da5fe3, 0xb4bbb6ff, 0x067e92df,
-       0x7940ca4e, 0x551ccd9c, 0xebec499d, 0x98b3e520, 0xe2e4bc8f, 0x921ad67e,
-       0xdf5c013c, 0xe28079aa, 0x98e1cdbc, 0x59d8c72e, 0x85c78b95, 0xf217e3fa,
-       0xaf23cc54, 0x97b4de9a, 0x5d75fce2, 0xcc74ec07, 0xedfe7b53, 0xb4147459,
-       0x4edbecc8, 0xb4a9fb76, 0xf94ac8a7, 0x54c08ee1, 0x52304f92, 0x77714190,
-       0x7374198a, 0xf8fc8dd9, 0x50a6e377, 0x33bb0d86, 0x3c253b59, 0xa7e51363,
-       0x2fdf08fe, 0x0ba0a1ad, 0x8c490e2c, 0xb8b50bee, 0xbfff3e68, 0x3f228f76,
-       0x9f9b3fb5, 0x45f8be2f, 0x0cdf7f09, 0xacff1a66, 0x1ef029cb, 0xd479d130,
-       0xd58e717e, 0xc6cc85f7, 0x094feb19, 0x881d902d, 0xeb48d283, 0x164e7651,
-       0xca7cb0b6, 0x797002f6, 0xa3cf3184, 0x4bc39cf3, 0xbf51e280, 0xf612dc13,
-       0xb00ca7b7, 0xdba067fc, 0x912f3da2, 0xec815adc, 0x75e55dbd, 0xf602314b,
-       0x73f0da40, 0xf85b3d63, 0x44e674a7, 0xfc50f0b8, 0xe15b99b3, 0x7958b4b6,
-       0x877933a7, 0xa6c80f29, 0x34a62275, 0x77d1cfca, 0x1af8cf3e, 0xbad813e6,
-       0xccc59f06, 0x03abb7cf, 0x62cf1f97, 0x0708397c, 0x84f9c0c5, 0xfc8d44f0,
-       0x61e1cd9c, 0x3439b0fb, 0xc8dd2eb7, 0x262a7f97, 0x3f3f6860, 0x7b218668,
-       0xa7f6fb26, 0xb456d30c, 0x8e02f685, 0x3c37d06b, 0x0c7e68b5, 0x62a68e4d,
-       0xaed3fdf8, 0x1b6d4f8d, 0x748dcec3, 0x8a9ff519, 0xf68bba6d, 0xbd0aedc9,
-       0x8cbb27a7, 0x728dc1cb, 0xfef2b54a, 0xf388f1a1, 0xf8d3a234, 0x91c5b738,
-       0xd99f2cba, 0x18bd900b, 0xa5b7d9f9, 0x503be5c8, 0xf43fbdb5, 0xbee29466,
-       0x1f474d7a, 0x9f71c36b, 0x45160fad, 0x7d50fea8, 0x5f3e13ef, 0xd76abf79,
-       0xedbbf214, 0xf9057b8a, 0x23fea89f, 0xa8bf0796, 0xec633b68, 0xe40cc60e,
-       0xd7137e10, 0xfe6f9ff1, 0xfdb9e511, 0xaacd2487, 0xc81dff91, 0xc21bbe23,
-       0xd7e4ab1f, 0x643e87fd, 0x9913ed79, 0x5eb42bbe, 0x2169a845, 0xb40e75c9,
-       0x2edf90b6, 0x3041f911, 0xc193fb97, 0x37cf4533, 0x9ec1e8c5, 0x0edc7129,
-       0x9c51c6f8, 0x3d7b0b0a, 0xb627f54c, 0x2fee475d, 0x44bbf9a4, 0xd7bc6c7d,
-       0x93474704, 0x35e19bdc, 0x9dc50ed6, 0xe1297980, 0xf59ce4ac, 0x78cc4f21,
-       0xbf3f266b, 0x02f58ab5, 0x133fbe99, 0x2e47b5bf, 0xe7da76aa, 0xd51e60a5,
-       0x93ac4195, 0xc8fc491d, 0xd826fd90, 0xa03cdf93, 0x15ff78d2, 0xf5057e60,
-       0xf5032dbd, 0x685cffb7, 0xde7c7af2, 0xa0c93a85, 0xaf3ce17c, 0xef14bb13,
-       0x74df1a68, 0xe4a9f3f6, 0xa82806c7, 0x779f7fe1, 0xb9238ed7, 0x532bfe21,
-       0x803acec8, 0x4ec335f9, 0xf14ec94b, 0x7fc252fd, 0xccc5d139, 0x3dabb72f,
-       0x765d98cb, 0x12ec8099, 0x01eccff1, 0xb8a0eff1, 0x7b40ea5c, 0x644fef60,
-       0x63dede76, 0x167cb0f2, 0x4604fafd, 0x744dde57, 0x0722cf7b, 0xe21373b3,
-       0x35ec8cb9, 0x13cd9472, 0xa634a004, 0xec6f025c, 0xcb954139, 0xf86cf0ce,
-       0x7ec22dcb, 0x0cb49383, 0x5523ee37, 0x23ece396, 0x5a725e26, 0x7fc7d3c4,
-       0x9ea793fc, 0xa78f4f99, 0x10e138f3, 0xce9b5271, 0x22a3fefc, 0x3ebe3556,
-       0xe51b5577, 0xacc96fe5, 0xa738b0ff, 0x1c9c0888, 0x1414e715, 0xcfd43437,
-       0x75fce26b, 0xf41ed226, 0x5b3cb3a3, 0x556e5216, 0x18f5b4b1, 0xc1bd73b5,
-       0xce329485, 0x4c73d75f, 0x425e66e1, 0xfa3cebf8, 0xf933128d, 0xcebcf3bd,
-       0xe072fceb, 0x0e511783, 0xf9461d8f, 0xb8538927, 0xcc3f861d, 0xee4346b3,
-       0x92fdfd8d, 0xf97e47e1, 0xfa43aa0d, 0x1a61e53a, 0x020363e3, 0x9955e89b,
-       0x474a78bf, 0xf4c83ec6, 0x7944c9ac, 0x35bed9ca, 0x9cef9499, 0xcc8732fe,
-       0x45ccebb2, 0xaa773f56, 0x4fc2129e, 0x9c960167, 0x7b7a7049, 0x51f4c2a6,
-       0x673f896e, 0x84c7da31, 0xb0e9141d, 0xb1f5624b, 0xfd5008ec, 0x547b29dc,
-       0x80ae83cc, 0xf91e76be, 0xf81e711b, 0x0f1f8808, 0x6cfd41fe, 0x9423e414,
-       0xdadc60b7, 0x77128cf8, 0x2de4673e, 0xb07bc675, 0xdaf844c5, 0x1fe09614,
-       0xcfd51651, 0xa3af8fc5, 0xd9e705bc, 0x7c73da1c, 0xe6b5ea34, 0xca7e8485,
-       0x79b9d85b, 0x75a3d590, 0xfe5c4a6d, 0x38a658f2, 0x42842c0f, 0x57105fca,
-       0x66284fcc, 0x1c416138, 0x6df6c84f, 0x6fdf3b20, 0xff42f2e2, 0x0373ecca,
-       0xb79f15e1, 0x34bf7257, 0xcc021570, 0x8f05f67e, 0xb9df91d9, 0x5a6ef96d,
-       0xf799ae63, 0xf3e50dcf, 0x40730d7b, 0xa90a8d5e, 0xb316f8f0, 0x9cf75afc,
-       0x54b945c9, 0x0e097f0b, 0x59b5fe7e, 0xe45abeec, 0x4a039b77, 0x2fcefcd2,
-       0x4081cdc6, 0x69bbad0b, 0x47cec49f, 0x8fc5f76b, 0xd5390bf7, 0x9c7d3eed,
-       0x83eafd8e, 0x4e42fd09, 0xf3fc50fe, 0x78727c03, 0x1e5390d6, 0xf373b1e4,
-       0x6756b713, 0x7cf0a67d, 0x8f316de3, 0x38161fd1, 0x906dc06a, 0x7202eb7e,
-       0x2d547080, 0xf79e76e9, 0xdc7ada42, 0x060306df, 0xb941fe1a, 0xb4e42c3c,
-       0xed87e041, 0x7fafdf1f, 0xbdd00a4e, 0xc74fc3d3, 0x5e035ff3, 0xdf3e3475,
-       0x952df9d8, 0xf112f5ce, 0xb0a6dd56, 0xc846b7fc, 0x355f1127, 0x5569f843,
-       0xe225be29, 0xdd27c1ab, 0xb79e7f84, 0x37f96fff, 0xa6235cf4, 0xec2255a9,
-       0x1ff6a89c, 0xddaeb724, 0xfb435f7c, 0x4bfbfb11, 0xd0de75f7, 0xcc9864f7,
-       0xf334bdf4, 0xf8a5eb16, 0xe543bb7c, 0xe6683376, 0x9e06cae7, 0x2c5fdf12,
-       0xbb25f5f2, 0x357ade79, 0xe74ecd74, 0x833dfdc4, 0x69ad6076, 0xa247c529,
-       0xa5f8c7c7, 0x5d79324f, 0xa3f73dbd, 0xbf3e501f, 0x637143a4, 0x637507a6,
-       0xf1c52f15, 0xe7afb1ba, 0x2bad8f8c, 0x1d25f8c5, 0xe8db348f, 0x9297e23c,
-       0x3fb2cc9b, 0x894777fc, 0xf724dbd6, 0x78ff7c04, 0xe66fe0cf, 0x53725e91,
-       0xfe7cd167, 0xda4b3bee, 0xfcfe3e91, 0xfd6c770c, 0xf7c5dc79, 0xc2ac64b7,
-       0xa8ef6ae2, 0x415a7fd4, 0x3d9e85e7, 0x5f7bbecc, 0xfb25597d, 0x20976fef,
-       0x9e3a1717, 0x1d25ec7b, 0xf07bdde5, 0xfac94ab4, 0x6ad3cec2, 0x85f26bf4,
-       0x458e58ab, 0xab6a79d8, 0xb78f754a, 0x946af7eb, 0x3e17a7f2, 0x3554e764,
-       0x3e53e794, 0xd01c9cf6, 0xbac79ff0, 0x4f09515f, 0x8c126d0d, 0x57ed8fc8,
-       0x41f93f58, 0xe36e3fa2, 0x69c0d4fe, 0x81a5c095, 0x55b70353, 0xd86cffc2,
-       0x86971c91, 0x9e08da9f, 0xbe70a3ed, 0xabd6da47, 0xd23d0794, 0x137e3f1a,
-       0x68d399d5, 0xa6e5c73c, 0x9bfdf1dd, 0x33a8f087, 0xefe89d3f, 0x1e04b24a,
-       0xf098a18b, 0x1aa91838, 0x7fdc4667, 0x1c66ba7e, 0x7947b924, 0x2377c453,
-       0xbe4cdebe, 0x2a6ba17d, 0x18ff45c5, 0xfe17d585, 0xc6a1ff31, 0x166665e2,
-       0xf0e2cbc7, 0x569e981f, 0xa22c8f84, 0xaf8256f5, 0x32bce48e, 0x7ca0ea9c,
-       0xdb944579, 0x25b0b2f1, 0x3f889010, 0x2b878b13, 0x708db821, 0xc2d87fd0,
-       0x955f29cf, 0xc204de58, 0x72126dbf, 0xbce424df, 0xd1b1eb09, 0xa883ddf4,
-       0xdd441bc7, 0x9ed279bd, 0x340254e3, 0x93bafe88, 0xe724ecc7, 0xcffdc065,
-       0x3ff720b2, 0x788cfe86, 0x18f76892, 0xfd241ea9, 0x402d86d7, 0x172c33df,
-       0x1b7967fe, 0x46e91ffa, 0x323fd03f, 0xef47e195, 0xc6277ce2, 0xf8ce86cf,
-       0x78b20bf1, 0xf2283a3e, 0x712caae0, 0xb6f4203e, 0x4b520062, 0x9a65be71,
-       0xb7b00eec, 0xfeb4cc7a, 0x4788a989, 0x5684ff9c, 0xa24be198, 0x8dfda34f,
-       0x7a0defc8, 0xe18b9d15, 0x35a3a0f8, 0x7f7eb62d, 0xebd78b2b, 0x9d647335,
-       0xef5310f4, 0x4fcb2aac, 0x377cef5a, 0x31bfc70b, 0xd3d3c366, 0xcf1deb63,
-       0xe3c2229e, 0xbc7f73f7, 0xf157be82, 0xd2ff71b7, 0x66f38157, 0x2c0efe50,
-       0x59b7f61f, 0xf8975402, 0x37544f11, 0x90bc212c, 0x3ba586bd, 0x2f582f09,
-       0xaff3493c, 0xdc3b2ba6, 0xc610eaff, 0xf57e9c69, 0xfc303fa2, 0xf7cf1c9d,
-       0x911b728d, 0xea307eac, 0x782f8686, 0x6f3c6a7e, 0xfd594730, 0x189610d0,
-       0x5e8f3b7e, 0x7e47cbcf, 0x98ffbbfb, 0x50db1eb7, 0x9db38f16, 0xf48bc195,
-       0xede7c91d, 0xe879a4d6, 0xb6971f90, 0x50697b31, 0x3f2c39a2, 0xe0f98439,
-       0xde37ac6c, 0x1bd594fe, 0x0f6d479d, 0xcab43cb1, 0x35f1ce37, 0x66826a7a,
-       0xc336cf96, 0x9e52d636, 0x6dff9b13, 0x52eff072, 0x48388a36, 0xeb8813f4,
-       0xf6f6388d, 0x83fd1bb2, 0x05ea6fe1, 0xbe8337ae, 0xa3749e7d, 0x7617a89f,
-       0x67ba5b53, 0x8968a53b, 0xb0bd5079, 0x59fccc27, 0x83cc4bdc, 0x6bc04ade,
-       0x2c29dbd3, 0x293fedcf, 0x184ce83b, 0x51f3fbe5, 0x7e61ef94, 0x1ce4905f,
-       0xcf8153f4, 0xd9ff715e, 0xf9332154, 0xd6f0e699, 0x8e509bc8, 0xa7fd370c,
-       0x275402d3, 0xa57e1c94, 0xbb507080, 0xdac5c70f, 0xc7d1ea1f, 0xf00a0fbe,
-       0x2a60a573, 0xfa31d3bb, 0x657e1ff7, 0xe9ade132, 0xb88b2fed, 0xa917ae7e,
-       0xcfe73759, 0xd7892568, 0xd78926bf, 0xa8e65dbf, 0xff2eea9d, 0x881bd921,
-       0xefa1abd1, 0xc08e040f, 0x8bfcebcc, 0x9ba31a59, 0xa61f1cc2, 0xfae2de6e,
-       0x8f39f96b, 0xa1bfd6c2, 0xf37112bf, 0x880ef135, 0x5f80c42f, 0xf3f86019,
-       0x7e31369f, 0x7307a7fc, 0x4ebee362, 0xff208ef3, 0xcc0754d7, 0xf902a49f,
-       0x3a67f45d, 0xdfcbcbd5, 0xea7cb1b3, 0x15aec178, 0xc8157fcc, 0xb1ebfe40,
-       0xc6266bb7, 0x598d8bc6, 0x254c3f32, 0x1652e439, 0x5f5f0cf3, 0xd619a1c8,
-       0x8e027388, 0xb9338fe7, 0xeafac15f, 0x89cf64cf, 0xe6add5f5, 0x16dd4dc5,
-       0xff6473a0, 0xcefb0b05, 0x4deef3e4, 0x2f877eac, 0xdfc9137c, 0x8d37cf80,
-       0x6f0ec7da, 0x3fcf489a, 0x1a79bc3f, 0x9a94f73b, 0x4e99e2e3, 0xbe52e5fc,
-       0xc3473674, 0xb3eefafe, 0xfab8bbec, 0x4ff1856e, 0xcb3c6c74, 0xefe7e6c8,
-       0xec6c47fd, 0x0282437c, 0x1f18038e, 0xe75d6f37, 0xa8bf2ceb, 0x589ec90b,
-       0x8def183c, 0xb171e6cb, 0x20e05b30, 0x9e987928, 0x175b783b, 0x53f1997a,
-       0x1e9904ab, 0xde14da9b, 0xcc5bcedf, 0x3a1f193b, 0xbfe274b8, 0xf9bfce83,
-       0xe73b08bd, 0x3ecc91c0, 0x07152706, 0x6bfd2276, 0x1d72847a, 0x3f80980c,
-       0xe4fbb0b7, 0x19851396, 0x13c1fb84, 0x8b25672f, 0x3dd26f1b, 0x54e5420a,
-       0x1243af3e, 0xf3652ffb, 0xe75387f3, 0xb53b3fb9, 0x993137c0, 0x92a1d35f,
-       0x9092e9d7, 0x34b2a777, 0x45dc7dd9, 0x31bedf31, 0x4fda29fa, 0xdd8d876f,
-       0xf93af5c7, 0x03c2ea79, 0x1499cd27, 0x99a53b7f, 0x276a4714, 0xbe88bbbd,
-       0x9cba4003, 0xe46d5afc, 0xac77bb10, 0xec58eb6f, 0x4747c249, 0x32dfc736,
-       0xe67df935, 0x3bff44b7, 0x7516cee0, 0xae132ed4, 0xc50acef7, 0x1de593b1,
-       0xe891b49e, 0x7e12ef87, 0x0a95eef8, 0x01de53cb, 0x16f7e14d, 0x95617efc,
-       0x0977b3f0, 0x22aabcff, 0x57be3fb9, 0x39fab3cc, 0x17ee9278, 0xc7e27b56,
-       0xbdf22bdd, 0xf361e035, 0xa134bddf, 0xf77de45f, 0xc1f2137a, 0x8b87e16c,
-       0x70fc88a0, 0xe903e310, 0xc6d8b1bd, 0x29f2ece2, 0x09e69213, 0xd2ffd1c7,
-       0xc42703f7, 0xfe860477, 0x65df8a9b, 0x91d4ebf1, 0x99392ff3, 0x4141b6ff,
-       0xe1b1fb92, 0xfdd865f8, 0xe2ef5c3d, 0xc1dea1be, 0x7ff43479, 0xd8a32b15,
-       0xff432d73, 0x7f73674f, 0xb6cfbb59, 0xb0bef625, 0xa38ce83e, 0x5b91a1fd,
-       0xfbf8c52e, 0x8c73815a, 0x73d8e601, 0xdf641790, 0xf4d9d9d3, 0xcb2f6b3d,
-       0x2c0771af, 0xf2bee17e, 0x2cf2bec4, 0xeae97131, 0x7149f5c8, 0x973fbc3c,
-       0x167ffdce, 0x5b148f6b, 0x07d5fd98, 0x6bdd00a5, 0x3db847d5, 0xb123dfd6,
-       0xcea2c273, 0x857bec23, 0xb7248bb5, 0x33b1bb87, 0xa3819fc4, 0xcf1e5655,
-       0xc90cbc0d, 0xfa88e04b, 0x25dfbe29, 0x9e227be2, 0x62cf4226, 0x8f3eff9a,
-       0xecefa6e4, 0x75a38a6e, 0x30a75fd3, 0x211c3374, 0x9bf2152e, 0x24fa7889,
-       0xf249d7db, 0xed71fac3, 0x54ff9c14, 0x8479c7f1, 0xd89b869f, 0x1d856fd1,
-       0x4fd34bed, 0x3baffc51, 0x0fd5ee20, 0x24a28714, 0xf2c01397, 0xcf675ec0,
-       0x1f9e46f6, 0xfaf57bb3, 0x0f7d8d88, 0x754e1f58, 0x6cee88db, 0x754c994a,
-       0xa7765864, 0xf3a2bd22, 0xdfaa22f4, 0xeff39457, 0x01d41a3c, 0x3ab68796,
-       0xbf89277d, 0xb8a6ee95, 0xcf8374fb, 0xd13de19b, 0xe1245dcf, 0xfcf5ff64,
-       0x972145cf, 0x72d793c6, 0x9d7e1326, 0x5365dfbe, 0x45fd793c, 0xfcf6ae95,
-       0x9c595f93, 0x8d38d1a9, 0x76d95b8d, 0xe31d1b64, 0xcf4ffc1a, 0x4efe3076,
-       0x2c318129, 0xb5bd2cbf, 0x0e9a4bef, 0xf29531bd, 0x2723bee9, 0x3831aaa7,
-       0x7f446def, 0x4d7f449d, 0x6bf61260, 0xad24ad66, 0xb70ef911, 0xb1f77f67,
-       0xe85f3a1c, 0xa52e3b25, 0xe29dacf6, 0x3bc77d64, 0x779409f6, 0x98d6f174,
-       0x66586aef, 0x2d1cc0e3, 0x963d37ba, 0x7f1927bf, 0x1e7c8357, 0xddd16880,
-       0x5bfb6253, 0x40fdaffe, 0x03f30e7a, 0x603f38d1, 0x7bab09c8, 0x8799d59d,
-       0x9e9eec2d, 0xbf625bee, 0xe1ce2acf, 0x1636697e, 0x73af643d, 0x90b99ee8,
-       0x3c333352, 0x2219b440, 0x07dd1766, 0xddfe6447, 0xe7e618da, 0x67f58967,
-       0xe847239b, 0xe239cdbb, 0xf42e727e, 0xc3b771b0, 0xe03d6b00, 0x095b5330,
-       0x5856d66e, 0x6ca9cb23, 0x65060d2f, 0xc7247fd2, 0xe56cbcec, 0x4c90f2bf,
-       0x3372c3df, 0x1e4365c3, 0xf163dd32, 0xf712ffef, 0xf1c39953, 0xfdc3db38,
-       0xf416a50f, 0x040566dd, 0x6df9fdd9, 0xe8f71510, 0x0f31f7c9, 0x37ba37eb,
-       0x99d30dbb, 0x008f2614, 0xf69f3f1b, 0x4fdb2723, 0x33533974, 0x7f10722c,
-       0xf4c72452, 0xefadea55, 0xd8073fa3, 0x030df6bc, 0x0f978f7d, 0xc3ba3bdf,
-       0xdf47bc6f, 0x0f1e4a99, 0x6dd50efb, 0x1d508b4d, 0x1de8da83, 0xe80563f2,
-       0x56aa7337, 0xfe1ccce6, 0xc07c1f9e, 0xfc48cfbe, 0x7bb69f9e, 0xbbf86725,
-       0xd27be32f, 0x9a35817d, 0x2eb1f109, 0x1196eacb, 0xbcd6651f, 0x657bec19,
-       0xe1256fa7, 0x36d482ea, 0x0e624d81, 0xa87964cc, 0x782a55c0, 0x92ff682a,
-       0x027df8c7, 0xc5d17860, 0x039eb7f9, 0x5238f7ec, 0x2bf7fc2d, 0xad0e2176,
-       0x8d7e862e, 0x27858fbe, 0xef946a16, 0xdd5a776e, 0x8859cf94, 0x7e61d4df,
-       0x3bfcac5b, 0x5e6b168a, 0xf1b8fc80, 0x3ca2585d, 0x3d16505b, 0x56dd0ecc,
-       0xfc272f96, 0xc59b47fe, 0xcf922df7, 0x472bd3b7, 0xf25c1e50, 0x2cb9f9ab,
-       0xcc79472f, 0xba61e437, 0x7028f7f1, 0xfda1dfff, 0x82fefe27, 0x04546fb1,
-       0xc8438f03, 0x838390d3, 0xc77144f4, 0xf4327a83, 0x9f2c305c, 0x0e5c295d,
-       0x52417d0a, 0xc8d5dec8, 0x6ff7135e, 0x01bfefec, 0x8f1a3ec3, 0x00003430
+       0x00088b1f, 0x00000000, 0x7de5ff00, 0xd554780b, 0x733ef0b5, 0x7993331e,
+       0x0f20f264, 0x0084f102, 0x021842a2, 0x27088784, 0x01a8c421, 0x54bc8083,
+       0x48433c26, 0xbfa81132, 0x2677bd6d, 0xb5ad1104, 0xbc1b6951, 0x14101de8,
+       0xd1a07515, 0x40e81c06, 0xdbdab114, 0xd5a8f8a8, 0x40445076, 0x8bcbc248,
+       0xaf7fd52d, 0xe649cfb5, 0xd4484c9c, 0xffffbff6, 0xdbf3f1fd, 0xd9cfb3ec,
+       0xdaf5ed7b, 0xf6bdad6b, 0x9a32c11e, 0xe4224e24, 0x65a3f85b, 0xf4842784,
+       0x0adb2ce9, 0x64918fda, 0x8b2ffc42, 0x108e36f2, 0xf08e77ee, 0xbc8451a4,
+       0x980b99b5, 0xcfbc3d69, 0x9fad0846, 0x603d34de, 0xff6422ce, 0xef02b308,
+       0x8f9ade9f, 0xbd2fc9f5, 0x7b6814e7, 0x00bc4bd5, 0x13bed375, 0x109d88ce,
+       0xa1e5b9af, 0xf6f3e96b, 0x85b27897, 0x93fc450e, 0x9085244d, 0xfec21663,
+       0x52fab22e, 0x6d56ab2b, 0xf4077fde, 0x2664de5b, 0xd54fda56, 0xaed365ee,
+       0x8765f5a5, 0x54af0244, 0xfa95ab6d, 0x00f2fad2, 0x9afa8417, 0x71c67f7d,
+       0x79480ada, 0x27212870, 0x5f22167d, 0x96ceeb49, 0x79f45994, 0x11676045,
+       0x83b15fbc, 0xfbe89b73, 0x7ff69b15, 0x3457fd0c, 0xda79038a, 0x36ed8aff,
+       0x63610f22, 0x1e604b7f, 0xbc01a64b, 0xc4886f55, 0x97e5eb4c, 0x70044956,
+       0xa54bd424, 0x61ff180e, 0x38c07649, 0x0d1c7087, 0xd0cf559f, 0xd577e871,
+       0x986e702f, 0x7889b55a, 0xddd69e00, 0xda4f39d6, 0xd2b55e61, 0xf77ef860,
+       0xb7bc127d, 0xb2f6502c, 0x36f80655, 0xe700454b, 0xd2d2cda6, 0xadfd9da1,
+       0x0ea6fed8, 0xd90d63ae, 0x76a89ea9, 0x47d27963, 0xacee6c88, 0x04a21057,
+       0x407700ed, 0xf3ac3e9a, 0x812e79f9, 0x3fd0d190, 0x674b644f, 0xc83094ff,
+       0xe8f7fe07, 0xf60f813f, 0xb2db023a, 0xd2b5e93a, 0x772dff45, 0x4bacebd2,
+       0x9ed09fa5, 0x56bfdd17, 0xa074043e, 0x5cfbd4f0, 0x4be23e58, 0x4f8372c3,
+       0xcafdbc46, 0x06cb0437, 0x3f9f1b9f, 0xe58b1be6, 0xe5829f26, 0x2c62be13,
+       0x7c52be03, 0x0e6f8b6f, 0x1e7d5b96, 0xaf94fe7c, 0xbeedcb1c, 0xacfe7c1a,
+       0x772c6eef, 0xfcf8fcf8, 0x2c7adf05, 0x2c7abe83, 0xb01af977, 0xf005f46c,
+       0xdb7d97bd, 0x05f26cb1, 0x5f1ef9f1, 0x5f219613, 0x407dcb18, 0x7d865a5f,
+       0xf01e582d, 0xabe5887d, 0x777e08be, 0xcb1c77d0, 0x3bbc5507, 0x817c9027,
+       0x10a9cde2, 0x92171517, 0x8be4a258, 0xca589eb4, 0xf9b729ea, 0x4f5a25f3,
+       0xc53ad0f1, 0x70cadf63, 0xfbd699be, 0xccf6b0d6, 0x8581487b, 0xacfd33d6,
+       0x4a83c07d, 0x07d69581, 0xc1f6b3d4, 0x7105fc9b, 0xc0383eb4, 0x11deafda,
+       0xfad1b02e, 0x9ed641d5, 0xed932213, 0x66139eb4, 0x94b7dcf5, 0xcf5a0ec9,
+       0xbcf5616d, 0x9d93fd8f, 0x61179eb4, 0x153f8fdf, 0xeb4f1c9e, 0xfb59dbe3,
+       0xd0a44bc4, 0x0913eb45, 0x7b02f587, 0xad02617e, 0xbd58b817, 0x20995fa8,
+       0x7dbfe0c7, 0xa1116462, 0x7fddb0bc, 0xd3a422b3, 0x455914ba, 0xfe9f14dc,
+       0x8b0f5839, 0xbfb43164, 0x84532fe5, 0x912eb471, 0x17fed0d5, 0x1fb6057f,
+       0x6f6c6510, 0xf6c2aff7, 0xed8c9203, 0xb07bdaa6, 0x60a8aafe, 0xbded727b,
+       0x92abfef8, 0x6b83ed82, 0x41fac21f, 0x63ed83d1, 0xef8d7f6b, 0xd83c941f,
+       0x80dac8fe, 0xffeb4852, 0x00b679c1, 0x9e71d75f, 0xfc0d9272, 0xa52b4c1a,
+       0x238ebafc, 0x1e3e4073, 0xf2a6a600, 0x525d2eb0, 0xfbedbf40, 0x3c93de47,
+       0x3276f2a7, 0xf53e97d4, 0xf3f61640, 0xd223f61c, 0xfb9ef87e, 0x58cdf899,
+       0xbf133f5d, 0x69fad729, 0xaceaf784, 0xdf67ebbd, 0xf0f5e337, 0xf5a1537c,
+       0x71fb17b3, 0x135e6ef4, 0x87a09dbf, 0xad4adbe7, 0x4fd8839f, 0x09e0ef42,
+       0xfd74638b, 0x5a65c584, 0x7ec47f3f, 0x1e0ef4fa, 0xeba71a45, 0x6b969147,
+       0xfd887cfd, 0x9faef7a4, 0x1ead74b0, 0xd685691e, 0xa7ec11cf, 0xa5e6ef7f,
+       0xc3d3af98, 0xfad2ae63, 0xcf748939, 0x073f5dea, 0x1cfc7a1c, 0xe7e07470,
+       0xa833c21c, 0x702af377, 0xe053f1ea, 0x25cfc0ec, 0xdeaae7ec, 0xa9c073f5,
+       0x6701cfc7, 0x0e447e07, 0x77ac35e6, 0xd7882af3, 0xbe20a7e3, 0x0e4e3f03,
+       0x3bd119e0, 0xa3ed5e78, 0x7dabcfc7, 0x8a93f03a, 0x1dee8cf0, 0x7a29853c,
+       0x74a614fc, 0x784647e0, 0x9faef5c6, 0xf8f45357, 0x03a53579, 0x3f61573f,
+       0x5e6ef5d7, 0xfc7aa985, 0xe076a614, 0xc9fb1727, 0x78476cf7, 0xd1c7ed08,
+       0xfb073f7d, 0xb073f1eb, 0xae7e077f, 0xd0a67ec5, 0xee7bb27e, 0x8f5328a7,
+       0x0ecca29f, 0x9e2214fc, 0x3f5de86f, 0xf8f53307, 0x81d99839, 0xcfd8a99f,
+       0xabcdded4, 0x7e3d0ae8, 0xf860ae8a, 0xc08c2499, 0x9dae8675, 0x727e9e6e,
+       0x857cbf7d, 0x2ef3efa3, 0x6e5de756, 0xaf0f7602, 0x45a433d9, 0xf6fbe9e1,
+       0x0fb9091d, 0xa6bb6890, 0x8fc076e0, 0xd1795a83, 0xd8fc4d76, 0x951d9d38,
+       0xeaea24a0, 0x757dc549, 0x1d29f7ef, 0x9d4f6ba0, 0x3daeb573, 0xabab93dd,
+       0xd78f9467, 0xa6bfdfbd, 0xe2bf5740, 0xef751bee, 0xd16ff967, 0xcfd7b3d5,
+       0xa83fbdd3, 0xfdaea17e, 0x5d0a86ca, 0x958155fb, 0xdb35faba, 0x7f7ba27f,
+       0xae8d7058, 0x03d3787d, 0xe111f6ba, 0x91f57447, 0xbdd31e87, 0x8b65ba3f,
+       0x87cc7dae, 0xc7daeacf, 0xeae97645, 0xa3df1ed7, 0xf6baff7b, 0xa4faba03,
+       0xbdd7bf8b, 0xd5de4f9f, 0x3f96dbdb, 0xe29fdeeb, 0x7ed74cfa, 0x0697da7d,
+       0x3aeed53b, 0xe75a8d76, 0xfa08ae41, 0x0974fe25, 0x43b0d5ed, 0xd7d4bac2,
+       0xc714fcce, 0xe528f952, 0x22c0e91f, 0x92f91939, 0x21bb51fe, 0x95f96fbf,
+       0xaefcfa11, 0x5d2b9ef1, 0x925df9f4, 0x862bb867, 0x8df9437d, 0xca506923,
+       0xed8d2826, 0xdf8c89f7, 0x0d2e320b, 0xf7bf423e, 0x2707da9a, 0x3e70fad0,
+       0xf1f2083f, 0xbb426732, 0x35278e3a, 0x999c5ef0, 0x5f74dfa0, 0xfe93de56,
+       0xdf587928, 0x5c19da9f, 0x45ebbf67, 0x51da1a4f, 0xc1f89fb5, 0x9fd759ce,
+       0x212fabce, 0x849f70af, 0xf7e903fd, 0x79a697fd, 0x89667f68, 0xe3d119fa,
+       0xa1fc744b, 0xe4187e38, 0x3f8c20e1, 0xe6f8ebba, 0xe3756301, 0x75cb325b,
+       0x3a245be3, 0xdf908bbe, 0x8eae7ed7, 0x9e30894f, 0xcfb93790, 0x66737c71,
+       0x9f7f8e39, 0xe8aefd44, 0xc63ae3f1, 0xbff9816f, 0x07fcdddf, 0x3fcfd78c,
+       0x7f3f42b3, 0xa3ffcd89, 0xf8ead3da, 0x3fff3871, 0xfcd9a773, 0xfcd82b33,
+       0x8edfaccd, 0xf81d9df1, 0xc7f8c08f, 0x9cdf19ba, 0xff3f413d, 0xf3f52a2b,
+       0x4ff1b337, 0xc7505ed6, 0x5ff8e3b7, 0xfcd81772, 0xf1c4a8af, 0x0dc7b325,
+       0xc46523fc, 0xf8e804d5, 0x7c551fa4, 0x742ec0a9, 0x2487281c, 0x6421a152,
+       0xe100371b, 0xf18e2bb8, 0x947157db, 0xf99f50df, 0x500939f1, 0xfd4799cd,
+       0x57d79546, 0x4097c8ec, 0xf53b61ef, 0xa0a896b7, 0x91e26e2e, 0x7306c9bf,
+       0xb7851060, 0x43f789b5, 0xeb86f17d, 0xbd5fa002, 0x14a0b266, 0x184813be,
+       0xcbfe7f9e, 0xe7a25b61, 0xd4972c65, 0x5122c78b, 0x07e1d6f2, 0x35219016,
+       0xc029be14, 0xeb3ba304, 0x0e3f529f, 0xa98fe31c, 0xffa843df, 0xc6c899f3,
+       0xf7f50bfb, 0xfea11ea0, 0xa4ce3a1e, 0xdda3bf16, 0xf0a34e1d, 0x7ff0aa97,
+       0xfd79302a, 0xe02e36f4, 0xd5f9f2a7, 0x7fa0478f, 0x1b6ee0bd, 0x1c277a45,
+       0x5d24fe65, 0x0fcbce9d, 0x6ddf6a74, 0x10e16c0e, 0x6be032bf, 0x21268a3a,
+       0x5067d68b, 0xffbe775c, 0x07a9bec1, 0xb7212739, 0xa54c4512, 0x9abedfef,
+       0xe3a2efeb, 0xb9cc52ce, 0x32521d6c, 0x24d7284c, 0x909634c3, 0x88471a5b,
+       0x5d3207b4, 0x448d3f11, 0x58a33b8d, 0xaa559f5f, 0x8a8ab7af, 0xb570a268,
+       0x66c8e74e, 0x39ecefda, 0x9c6d76fa, 0x4644a681, 0x52bc7567, 0xfa74938a,
+       0xb9943668, 0x7485d8f0, 0xdf62e39e, 0x1778f06a, 0x7e8c2489, 0x010fbfbc,
+       0xf193faba, 0x362e79bd, 0x73bc236f, 0x4a528b44, 0x8ca739e7, 0x1b7f000f,
+       0x9f68ffe1, 0xd0e5314d, 0x22a3fd72, 0x8f9d7531, 0x1eb9fe11, 0x22827ce3,
+       0xcbf3f3ac, 0xdf19cf8d, 0xffe9531c, 0x2d07f029, 0xa0fe00bf, 0xf9551ff0,
+       0x32af53a3, 0x3d9af0fe, 0xda1f80d3, 0xe904f237, 0xadcbf2aa, 0xa92cbf2a,
+       0x2105f3d7, 0xb8e8111e, 0xfb970e6c, 0xcc1f1440, 0x5960f956, 0x6e6f9e83,
+       0x3d317e27, 0x6ee65d06, 0x9a6f7cd8, 0x9f7e75dc, 0xff337ca8, 0x9f88fdc1,
+       0x7464f3ae, 0xd3a543ba, 0xf6fa35ed, 0xdeba555b, 0x4e75d2ae, 0x51afc3c3,
+       0xc9e641f5, 0xdde41101, 0x9e8d53fb, 0x3d3d1d11, 0x708d3d2a, 0xf3d2a1de,
+       0x7a331f8e, 0xa88de11a, 0x9c348cf4, 0xae80c913, 0x5be11af0, 0xf9977770,
+       0xccab5c60, 0xde9e9b1f, 0x4755fca6, 0x05579ea3, 0x3475586f, 0x6c56ce4a,
+       0x2fabae9f, 0xbdd5cc0f, 0x4ca1acbf, 0x7ea4bed7, 0xd17daeb9, 0xf5753bfa,
+       0x758fff32, 0xbbb82fef, 0x7b7ed756, 0xf6bafdcd, 0xeb0fe5f9, 0x1b3d73ea,
+       0x9ecfef75, 0x3ed759b3, 0x5d19f4ab, 0x9de28cfb, 0x6574faba, 0xd37deeb7,
+       0x066eabbe, 0x3deb7cfe, 0x713d809e, 0xc605fdc1, 0x45b82f33, 0xd473bc37,
+       0x1f5f2327, 0xf2c10df3, 0x7c8dcfb8, 0x1637d27f, 0x66a6d6cb, 0x7413ac3b,
+       0x124a5c5d, 0xcd326908, 0x0fdf5dab, 0xeb8269d6, 0xa9e4c869, 0xb37ad3f5,
+       0x28794649, 0x78489069, 0x2c1c2124, 0xed1c2a36, 0xa47b547c, 0xaa06f687,
+       0xb6ba93f8, 0x3f624497, 0x76523ef7, 0x7765f005, 0xcbfd03eb, 0x4da7bb00,
+       0xed8debb5, 0x8d291c95, 0x1ac84e7e, 0x626ac384, 0xc4a54776, 0x5772bfe4,
+       0x4271017a, 0xe6b83c3d, 0x2905e372, 0x9f02a793, 0x78e4eb64, 0x3a35c359,
+       0x9a204efd, 0x6df807dc, 0x8af9eea4, 0xbeead7ed, 0x479fb53b, 0x5741abb8,
+       0xb165838c, 0xe81333f4, 0xe67370e1, 0xa700618c, 0x4deb1472, 0x3c2ed07d,
+       0x755e2be5, 0xafd01074, 0xbee3cb14, 0xf31e5839, 0xea3cb079, 0x53f2c72b,
+       0x11960d5f, 0xfe58dddf, 0xf2c7e7c5, 0x2c7adf63, 0x63d5f23f, 0x01afa1f9,
+       0x017df7cb, 0xb6fb0f2c, 0x2f8ef963, 0xaf8b6588, 0x9f56cb09, 0x7726a582,
+       0x71ddf13d, 0x093e1d75, 0xcf8317fc, 0xed7f3aa4, 0x7c9d09fa, 0x87dfc716,
+       0xb9e1a67c, 0xf2acc1a4, 0x1f8e8a43, 0x4397c012, 0xbda1eb3e, 0xb0f95441,
+       0xb763efbb, 0x6bfcb77b, 0x0fea6df8, 0x7e4eb7e4, 0x53f030ca, 0x34fc4f76,
+       0xa7e28f8c, 0xb31726a9, 0xfa7e547b, 0x8623cc19, 0x8c0f315f, 0xf6513e90,
+       0x826f929a, 0xbaa56c75, 0x601f420f, 0x763aacfd, 0x05b77d1d, 0x10c0baed,
+       0x0ece3758, 0xd860dbf9, 0x21fb3847, 0xf7567e25, 0x49f233f3, 0xd05778f7,
+       0xa01a59bf, 0xdaea4f44, 0x78638d6e, 0x31489ab5, 0xfddaeba1, 0x2f729e83,
+       0x81758a1c, 0x01f7c224, 0x8c4774f7, 0x0cada97e, 0xaf09edf8, 0x72af8e75,
+       0x8f63bfa0, 0xca0f3dfd, 0x2f6626a9, 0x68f335c7, 0x93f093b7, 0xc76fc06e,
+       0xa77664ba, 0x7dbdbc41, 0xbb42e490, 0xe3d64c81, 0xc3a05fcf, 0x4714fddf,
+       0xd6eeb82d, 0x06fe21a7, 0xbd38357e, 0x49ebf817, 0xcf84f7bf, 0x7fef3085,
+       0xd27b3e01, 0x45e93d8f, 0x342fc8a2, 0xedb7f9d1, 0x80fb961b, 0x1e5ee30c,
+       0x9afedadf, 0x7e5f9e11, 0x4b6e3e47, 0x25b8f8d1, 0xa41f8093, 0xc6d9cbca,
+       0x2e81e32b, 0x40f4fd1d, 0x9f77ee4f, 0x7eff8264, 0xdfdf4b3a, 0xe2fec67d,
+       0xa70dc225, 0x89243ae3, 0x92bf53c4, 0xd1e36cf7, 0xfc47719f, 0x67d83710,
+       0xe0c9d773, 0xaffc9e37, 0xeb3d0cb0, 0x0f670be3, 0x3f04e93d, 0x5f1a656c,
+       0x1d063473, 0x982ab2b5, 0xf68f6355, 0xf5f49a57, 0x715cf5b3, 0xc725e710,
+       0xeb061ccf, 0xa8e6ab8c, 0x0d3f7a08, 0x959fad4b, 0x738e1269, 0x3c767b72,
+       0x4c02fff3, 0x4048ec9f, 0x67d2737d, 0xd9fff7c1, 0x8fd774f0, 0x8d210f06,
+       0xe80b33e4, 0xdd96da73, 0xcaddfbfd, 0x825e7083, 0x890929f8, 0x69bf815f,
+       0x3b7fffa5, 0xb015fa00, 0x0debf5ae, 0x70f37ef2, 0x3743be78, 0xd64efd1e,
+       0xbbe18cf6, 0x204ee5ee, 0xa7be34c7, 0xbaabfbf4, 0xbb62bdbf, 0xc76f46b5,
+       0xdeeae826, 0x9d1af4a6, 0x00ff0b5d, 0x1386bdc3, 0x54ab0960, 0xb04db0d9,
+       0xda7e07af, 0xf049c103, 0x5ef6385f, 0x79222595, 0x16971464, 0x6385d3e0,
+       0x6797fe35, 0xa9ea99ff, 0x048a6f13, 0xa25c8ce4, 0xaea9e550, 0x899bf220,
+       0x917d6898, 0xc6c2f6fa, 0x6eb02515, 0x26f9789d, 0x931643f4, 0xc7f82752,
+       0x0f3ea4e5, 0x89a7b5e2, 0xf3e418a9, 0x39c77934, 0xad1e4a32, 0x2e9d8482,
+       0xe3b7af5a, 0xabaf7fa9, 0xd7d06b2f, 0x525b9297, 0xe97edf60, 0x38049106,
+       0xf6fa1bd0, 0xf61779af, 0xacd48cbb, 0x57fb7583, 0xa16bbc6a, 0x5419088b,
+       0xf6fd556f, 0x0a32bcf1, 0x71604b87, 0x7a1f6d16, 0x7ff32279, 0x2406662a,
+       0x59ffbe85, 0xa95bc8e3, 0x07dfa206, 0xbc7ec1d6, 0x6f713a7f, 0xf7e95d23,
+       0xc237e15d, 0x5d03d9ab, 0x3855c3f6, 0x4a73b792, 0xcb1e8620, 0x67263814,
+       0x102bbeaa, 0xc7b8ba5c, 0x7bfd4334, 0xd13253f3, 0xde1ed3f1, 0x668c2793,
+       0xc0fc03fc, 0xe792ed09, 0xd69ff487, 0x7f82ffa5, 0x68fdff6a, 0xfeba79ff,
+       0xfb53fda7, 0xfe05d81f, 0xaffab179, 0x2ff3edfa, 0xa93ea9fb, 0x4e97f178,
+       0x13c9d742, 0x9b8a7d42, 0xdb72b5d2, 0x96854ebd, 0x13bf05c7, 0x8044f5f8,
+       0xef458e2f, 0x154e0587, 0x41cec542, 0x49fe0ddc, 0xecf93ffb, 0xf11e30cf,
+       0x85d136d5, 0xe6edb4f1, 0x61ca99b0, 0x12f2e375, 0x23f58392, 0x19df7eac,
+       0x7a4dea1e, 0xfa78abfe, 0x1f902997, 0x8d453942, 0x9ed1852f, 0x79fadead,
+       0x5e4fac11, 0x64728ed2, 0xbfc60efc, 0xaffa8898, 0xdaef8a4c, 0x38c4e14e,
+       0x8bc55781, 0x6767f1b7, 0x37942778, 0x82fa017c, 0xc7e8227a, 0x572bbf1b,
+       0x8235d4ed, 0x8d98f923, 0x190c7bfe, 0xc3517a03, 0x3b30090b, 0x5f99eeb5,
+       0x70a11ce7, 0xa6fada9d, 0x97c28b93, 0x83674f26, 0x8f73fe8b, 0x6ddebddc,
+       0x6d16f2a5, 0x96eb690f, 0xd7daa4dc, 0x8a565621, 0xf3e42761, 0xdd166e54,
+       0xf2b8fa7e, 0x7a9f27f9, 0x7f99e20c, 0xd107bb32, 0xff3c57fe, 0x69e3fbda,
+       0x314ec57d, 0xc34d84b9, 0xd274a5ce, 0xbfff4bc7, 0x1e93b73b, 0x4d79bf15,
+       0xe7b18792, 0xd27624f7, 0xfdcec565, 0x15d61912, 0xfb83931f, 0x063d88a5,
+       0x8a47827d, 0x7ba85ec0, 0x8825bfe6, 0xc7d89e33, 0x18acd491, 0x1afcdcf8,
+       0x278003da, 0xaf4aa7a4, 0xde19fa0e, 0x80ba52f7, 0xcbd236de, 0x5522def8,
+       0x90bf40bf, 0xfbf94167, 0x07903d85, 0x0dd991f5, 0x617f2878, 0xf3e61395,
+       0xf8c35085, 0x537bf1fc, 0x8b959f40, 0x961714fe, 0x13f979ec, 0x5bfe423f,
+       0x528ff6f6, 0x9444be30, 0x45ae1374, 0xe79874fe, 0x70b34d92, 0x07894b9e,
+       0x71fcb0f9, 0xcb4034be, 0xde29020b, 0xac4e4319, 0x2f939322, 0xd2e250b6,
+       0xfe017e79, 0x77efe824, 0xb436c0f8, 0xa024efbb, 0xcea47e0f, 0x580c5a85,
+       0xf46160bf, 0x2ebaabfa, 0xa33eb010, 0x7deb77f9, 0x93a7402d, 0xd85495fd,
+       0xc112f177, 0xfb83e2af, 0xbfcbf696, 0xd195253d, 0x9e42c889, 0xf75d1dfa,
+       0x7873c327, 0xac5445bf, 0xc8efba39, 0xe39d59b7, 0xa7c756af, 0x7ac1c770,
+       0x6c4a45fd, 0xd44f35fb, 0xb75d00f4, 0x4a2cf8a3, 0x6ffc99de, 0xbbc99fbd,
+       0xe981ff26, 0xfe7ed0c5, 0xf8239330, 0x0a43d60e, 0xdb153857, 0x50e4cff7,
+       0x3a3f503f, 0x156f9c96, 0xb7d73955, 0xc285f91b, 0x51f1702f, 0x24e3037c,
+       0xdf701d22, 0xfa06e965, 0xf51e947d, 0xaeceb8c2, 0xbc726afd, 0x455bf34c,
+       0x9b203ebd, 0xdee81e98, 0x9e23f2ae, 0x53c0c52a, 0x52fc818f, 0x20cbf579,
+       0xcc2962bf, 0xcd1dcbff, 0x72a3cfef, 0x935065fb, 0x355ebd5b, 0xaef96dca,
+       0xdc9624d1, 0x9377697e, 0x9f4b7298, 0x7b5b94c7, 0xfff9f904, 0xf0d55eb4,
+       0x78f00c38, 0x351e274d, 0x3e1dd93d, 0x90f27a8d, 0x8d5e2320, 0x1dfe927a,
+       0xf95d7926, 0x8d43e351, 0xab9e2aff, 0x51f402ba, 0x7c6a9f07, 0x1aa7c1d8,
+       0xef89761f, 0x6c68f0ea, 0x34fb00bf, 0x96f9ae14, 0x528ed38d, 0x4ed2d257,
+       0x7f26df70, 0xaafb8f26, 0xe584f396, 0xf3111081, 0xd5303f43, 0x753b068c,
+       0x3d6fdfe2, 0x7785177d, 0x2c8bf13e, 0x445ea02f, 0xb7d2ffbb, 0xf3a04edf,
+       0x79e2a799, 0x54fb453e, 0x0239974a, 0x70a38e17, 0x3f8815ce, 0xb7e2113e,
+       0x0a34f91c, 0xfae5f98e, 0x4c4dfc3a, 0xa7a7ece9, 0x9fabbff7, 0xb7cb7df2,
+       0x1d3f5d29, 0x50bbc844, 0x10bc388a, 0x81d357cd, 0xde7f14ae, 0x00605c51,
+       0x5088a9ea, 0xbd77e51a, 0xf3fb3220, 0xa319c2ed, 0x9fc9bec1, 0xf19e2c3d,
+       0x7bf460fb, 0x3b3eaabd, 0x41e397eb, 0x650d9fcf, 0xf67b7fa3, 0xac4722d0,
+       0x9566d0bc, 0xf7535ecf, 0x5cecda5d, 0xbff94f3d, 0x7da3b48d, 0xc95bb7e3,
+       0x82fb18b6, 0x5f4d451b, 0x7fa374ab, 0x8e7f1d3c, 0xe97387ca, 0x51b9f1a7,
+       0xf5399b74, 0x4aece084, 0x34fbf807, 0xa1fb0fca, 0x06be05f8, 0x235b36fc,
+       0xe231a545, 0xf8a9cf79, 0x6be0789b, 0x0c2dcfcc, 0xc7800be5, 0x8baf3b42,
+       0xc9a93c83, 0x143250eb, 0x60789ae0, 0x5347cff9, 0xe21ef63e, 0xeb8f90dd,
+       0x3c919d0d, 0x2361fc31, 0xb07fa13e, 0x2e888f33, 0x627bd7c4, 0xebc012e9,
+       0x04acb37b, 0x95df35f6, 0xe0b155dc, 0xf5b3332c, 0xbd292e66, 0xbffb8a30,
+       0xb3f9bf0f, 0x8a02e11d, 0x9676b38f, 0xff95ddf7, 0x759fdc98, 0x0e5a8171,
+       0xf56790f8, 0x71002e64, 0xf9e222b4, 0xe50e04f9, 0xfeb4527d, 0xfe9a6fca,
+       0x54f5e43c, 0x89973887, 0x110b57b6, 0xdbd8f809, 0xfb0053b4, 0x289926fd,
+       0x6a108f18, 0x8a8ccd86, 0x05111d7b, 0xdff357c4, 0xf80edde6, 0x4cd3373d,
+       0xe8652e00, 0x01d82719, 0x512342e7, 0xd79bba0e, 0x5a647c1f, 0x10fd08a1,
+       0x3f230fe4, 0x74db2514, 0x499359f5, 0xdba5373f, 0x95647344, 0xeafd063b,
+       0xbd67c624, 0xff966fd6, 0x04dbf4cf, 0x5f18dfaa, 0xedfad18b, 0x7df18926,
+       0x8d4b7e94, 0xd656dfa5, 0x17c0a9ca, 0xa766f72b, 0xbe575d02, 0x2c4fa4b1,
+       0x8fbaf6fd, 0xa86ff7f9, 0xfd6de679, 0x1e1b7ea8, 0x51fadfa5, 0xae2316fd,
+       0xa5ea5a3b, 0xcffcb37e, 0xa0ebdfc8, 0xb7cc62df, 0xa69fc558, 0xb5438adf,
+       0xfb8adfa8, 0xa97cbaf1, 0xfa4f5249, 0xb397ecad, 0x6dba2eb0, 0xf007f831,
+       0x0dedfa0a, 0x38c1cf55, 0x5dfee7a0, 0x3d277d72, 0x3d5bd557, 0x67843ff7,
+       0xecadcf4d, 0xd33da1cf, 0x9e990f95, 0xf4c5995b, 0x4cbdcadc, 0xc41cadcf,
+       0xbf519cf4, 0x6fd17415, 0x21eafbec, 0x23f47bf4, 0x1b7d7eb3, 0x23992f6d,
+       0xfdf42dba, 0x9f3b5912, 0x5a3a3351, 0xd4bbfddf, 0x9f73be8d, 0x3d2e73c1,
+       0x823fbbe9, 0x7a841bbe, 0x91c8206c, 0x1c6e3f91, 0xd3e5d368, 0xb1f5f7bd,
+       0x79045ee7, 0xfe8f03f9, 0xe62607f7, 0xfafbed27, 0xbb9048d8, 0xaa1e00f7,
+       0xf9519eef, 0x47e7d5af, 0x28793a7d, 0x7baaf793, 0x1baafe18, 0xd5df3639,
+       0x7586407c, 0xd1176fe0, 0x2f7dbe8f, 0x9b67a3f3, 0xc0d8fa5b, 0x225fffcf,
+       0x2bfd25ca, 0x87e28b29, 0x302b1739, 0xce2bb9ee, 0xccfc05b9, 0x80b10239,
+       0xd0e0bb1d, 0x7ec0278d, 0x3d71705d, 0xe00bbdda, 0xc8e92279, 0xa1db98fb,
+       0xebf6f527, 0xaf9da6bc, 0xf9ae9065, 0x8ccd1310, 0x7157132e, 0x5d59cd81,
+       0x5da823f3, 0xc62df986, 0xabdf893c, 0x47cd9ff3, 0x8fe45f10, 0xe5f8cc7c,
+       0x72788def, 0xad54bc33, 0xaa78f5e6, 0x89e262e1, 0x2ca4ba52, 0xb72f13a5,
+       0x975914bf, 0x39cbed01, 0xf38cb7f4, 0x9c66f0d6, 0xcd4786bf, 0xbea059bf,
+       0x24743f3f, 0x86889e66, 0x22f92ee7, 0xf80dde1a, 0x33d34b78, 0x206190d7,
+       0x3c981f97, 0x7c0d1f3f, 0x178a7bf4, 0x73ade70a, 0x2bcee907, 0x65e2a3bd,
+       0x6148e7aa, 0x24780c8a, 0xf367c035, 0x96be77ca, 0xb377e742, 0x210b9592,
+       0x937f59f5, 0x688f103c, 0x1ea3b6b6, 0x9470f8d4, 0x5985c999, 0xf5ef2bd5,
+       0x7ae21575, 0x50b9c4d3, 0x3d06c2be, 0x7999e6a7, 0xd7f261ef, 0xbaf7fdcc,
+       0x6788518c, 0x91482e58, 0x5d015eb6, 0x86a73fe8, 0x40bc5d18, 0x69cffa17,
+       0xe020fda4, 0x73993abd, 0xa6fde187, 0x3f02f79d, 0xcfa56ebd, 0x39cbce41,
+       0x0e8616f7, 0x65ca7a7b, 0xc58858f9, 0xc8cc18c7, 0x173f5ceb, 0x5d897bc0,
+       0xe68993ed, 0x8e00f796, 0x366e5489, 0xfd00c3c3, 0x46fe8a2f, 0x07c8c5fb,
+       0x7503e53d, 0x2ab9efc7, 0x3a075f9e, 0xeddf01d8, 0xde43d812, 0xb47f5b30,
+       0x1720af76, 0x3a34de22, 0x65f5d134, 0x2983a314, 0xd66f9e06, 0xbd9e2aea,
+       0xef844e21, 0x6ffea06f, 0x7ebb0712, 0xf8d41f5f, 0xc5772cdd, 0xd215c413,
+       0xe806f4a3, 0xcd7de8b7, 0x11b7a6ea, 0xa6ae375f, 0x15dc99e6, 0x407d1a5f,
+       0x6f0e5e0f, 0xd34fcadd, 0x61799891, 0x467e55df, 0xb3f2f599, 0xe6fedacf,
+       0xedab8870, 0x90af50e5, 0x7e2e8250, 0xecccd330, 0x07ab6696, 0x0dfdbcf9,
+       0xee45bdd1, 0xa8a67faa, 0x257f0174, 0x64e27cfa, 0x4de80898, 0xa67c9597,
+       0xe3007bcd, 0xe0f5e8b7, 0xe907ab75, 0x33ff5dd7, 0xedfecccc, 0xead31ece,
+       0x9078c3d7, 0xc7eb28d7, 0x5a47ae33, 0x79a7a95c, 0xbf71d479, 0x71b4bcef,
+       0x84beebbe, 0x3c60b497, 0xd89fdb4e, 0x89767bc3, 0x73163f60, 0x0a107dba,
+       0xfe6fee39, 0x59bffa13, 0xff7ddd1a, 0x530a3f10, 0xe3bebf3c, 0x9f638c49,
+       0x34c8f67e, 0xaf159f90, 0xe542c4f0, 0x838775af, 0x889e5984, 0x45427604,
+       0x5dfb8f23, 0xcde70844, 0xa833b288, 0xf1f0c327, 0x5ef503a2, 0xa0732ec5,
+       0xf15f7e84, 0x103967f2, 0xc35d6b7f, 0x59ff9ff4, 0x91fd1f95, 0xa807c81c,
+       0xbcfed810, 0xa88f3e91, 0xb76a79fc, 0x6fe80e6d, 0xc73b3b6e, 0x2d9c115b,
+       0x0ce2a39a, 0x16459bf7, 0xc36ddee7, 0x33ff6c3c, 0x0331e61c, 0x48e7d17c,
+       0x53d0fcb5, 0x5cbd30cf, 0xe00624d1, 0xf6c5703c, 0x1710ad9d, 0x8cd0f8af,
+       0xfb77abf6, 0xd3ec0919, 0xcf3e2fc9, 0xf1371bce, 0x976878ba, 0x3e76e438,
+       0x59f8866c, 0x01ea1563, 0xf5823f5a, 0xfbf71aa0, 0x15b2718e, 0xd97dee2f,
+       0xe2b8514f, 0xf13b4f37, 0x36cb705c, 0xb723c627, 0xa05f7e5f, 0x7831dc4b,
+       0x9c771abf, 0xf5c105fa, 0xf1dc7621, 0x2127caa4, 0x48ee3eb3, 0x3c6127b6,
+       0x5799c292, 0xd17e231a, 0x5fcfffc1, 0xcdf60278, 0xf2faed4e, 0xf2bb8009,
+       0xfc4f739b, 0x2a93e294, 0xdbac1720, 0xc3df67de, 0xbbed067d, 0xd27d55f7,
+       0xb8d3ccfa, 0x27fad34f, 0x6b7a1bb3, 0x2645fbdd, 0xeeb453ec, 0xe2053afc,
+       0x4ef7abb8, 0xf56d7f41, 0x4953934b, 0x2b407f0c, 0xbd037f81, 0xd23227d8,
+       0x39b1b9ad, 0x4d3ce013, 0x77eb0ee9, 0x58393c47, 0xb2f4e2c5, 0x11de471a,
+       0x4bae5f7b, 0xc671b8dc, 0x3ac1d7cd, 0x65ba28de, 0xf1f88bd2, 0xe1cf4a61,
+       0x0ee3a0bd, 0x38209f75, 0xe3f1b2f5, 0x4a0ff0d3, 0x7d660baf, 0xe342fe1c,
+       0x0c7cff92, 0xba931ada, 0x7b871f8d, 0xdf6d3f81, 0x2159bf6f, 0x5da39016,
+       0x1edc61cf, 0x0f7d47e8, 0x85fcfad2, 0x1cbb884c, 0xc0efdb17, 0x66bdebfc,
+       0xd8aaa3cc, 0x53ca01fb, 0xe36f4beb, 0xf7511abe, 0xc7495adf, 0x5127db1f,
+       0x56ef3a7d, 0xab3b8b07, 0xb4b88074, 0x6ae7c4ec, 0xb5f199fc, 0x2eee9716,
+       0x32d63d1e, 0xabbfed80, 0x5b5591fb, 0x43112cff, 0x0b1b9fbc, 0xd9723af4,
+       0x0f0d547d, 0x98c3c02e, 0xd896fde8, 0xfd8efff1, 0x80dd0316, 0x758f609e,
+       0x7ad0a7ec, 0x07ab883f, 0xed620fb8, 0x666eb5df, 0x62ad34fb, 0x6d45bcec,
+       0xc5a465ff, 0xe812efb0, 0x4f4bbedd, 0x78aef8f3, 0xb42706ca, 0x9d7c574f,
+       0xbf5b14ba, 0xd4e16adf, 0xe7be037b, 0x67257ebe, 0x05981bcc, 0x78d5597c,
+       0x4a7b0244, 0xf9b4df5b, 0xe7fd529e, 0x78f2cf53, 0xb05d644e, 0x51bbf519,
+       0x1613547f, 0x5bc23437, 0xab7a616e, 0x1fad89ba, 0x023976a7, 0xa9cfda76,
+       0xaf91bb03, 0x911c77ab, 0x83bfb4fc, 0x45237fdb, 0x60acf2a2, 0xc14408fd,
+       0xfd85ea7f, 0x897f6c39, 0x71c6ebf9, 0xf1c752ee, 0xe38f6286, 0x374671dd,
+       0x507f0ace, 0x2e7ee762, 0x4149de3f, 0x9dfd0d99, 0xe409116c, 0xf20c9ffd,
+       0xe31881c5, 0x5a88b5cf, 0x0fc98b3c, 0x1cf1475d, 0xbb9d83a6, 0xb42513e4,
+       0xc63b57bb, 0xfde7087e, 0x19243b57, 0xb57517e2, 0xeeb52f2c, 0x4069dcdf,
+       0x5b84baef, 0xdeae3f71, 0xb2575f80, 0x1ae21f2b, 0x51d2c2ae, 0xbd46aec0,
+       0x7498a093, 0x1476aff0, 0xce14caa7, 0x469daab5, 0x0b9e3704, 0xc5459de5,
+       0x65de1f30, 0xec635972, 0x52f6883b, 0x8bc289e2, 0xe39fd2e8, 0xca469724,
+       0x7f968fd0, 0x39696953, 0x052e8d88, 0xb1858c53, 0x99fcddec, 0xdb779c2e,
+       0x507fd50e, 0x614aec88, 0x8eb06479, 0xcf8aedb4, 0x43f1c321, 0xb47e50a2,
+       0x1db9cfa9, 0x5e83f7fb, 0x4a24eb5a, 0x8a339502, 0x86cf9955, 0x2c23acf3,
+       0xe9f0365c, 0x857aff99, 0xf10d6bf6, 0xd9b457e8, 0x25527cb5, 0x46cce401,
+       0x41bcc41e, 0x936fe560, 0xe634e13a, 0x25781213, 0x298d3eea, 0xa1fd1dbc,
+       0x7c589bb3, 0xff572780, 0xcf8b027a, 0xafc00091, 0x542b2fae, 0xe212cf38,
+       0x3bfbc30e, 0x580f181c, 0x9422c6f6, 0x3443a01f, 0xf58a92be, 0xac1b5ee7,
+       0x67f01cce, 0xbf555a36, 0xc0b4afc6, 0x6ac59b39, 0xf54a7dbf, 0x18a962e7,
+       0x975e41fa, 0xe5faf2a8, 0x9843a2d2, 0x8a59e68f, 0x8e753e7a, 0x31acdcfe,
+       0xaa204b4f, 0xfe601c9f, 0xadbc9773, 0xb708cda6, 0xc56b7f31, 0xc35d7d76,
+       0x37a027e3, 0x127402af, 0x80e2e5fb, 0x3237e23d, 0x4613d7f8, 0x9afc777d,
+       0xb5f8f4d3, 0xdafc7aca, 0xa7f11886, 0xadc3afc7, 0x97e697c7, 0xf8df8776,
+       0xc873fab1, 0x8afc2aff, 0x548ed556, 0x4aff4af1, 0x654c292d, 0x42e9dc03,
+       0x28c2e518, 0x30f61947, 0x9feeff07, 0xafc5a81c, 0xefd40edc, 0xb87cea69,
+       0x1b3becc5, 0xf00f11c8, 0xe08e51ba, 0x79e82024, 0x75d8f91b, 0xfac40acc,
+       0x4d7b7c8c, 0x355cf4f7, 0x0b23d5fd, 0x809b57e9, 0x3f23877f, 0x89bef3b0,
+       0x05975024, 0xc176ea72, 0x59f41dfa, 0xb8458bdc, 0x17b885f7, 0x5efb820f,
+       0xa43e585c, 0x0db4abe6, 0x306e7825, 0x029f3e18, 0xdca1e9fa, 0xf7a069f6,
+       0x29484bbc, 0xc51fc1e8, 0x0f03f3b1, 0x38bf65a8, 0x85abd549, 0xef824c6f,
+       0xe70ca243, 0xdb42dbd5, 0xdea0832c, 0x2a3de3c4, 0xabfa84de, 0x90d6fc60,
+       0x6c5ae0c8, 0x38820c09, 0xc7115ec8, 0x013c5d6d, 0xd87665cf, 0x2f96216f,
+       0xccfa16d2, 0x9f4a28b9, 0x7a3d36b7, 0x36b9c415, 0xa9e7629a, 0x7e9ab14c,
+       0xec1bfad8, 0xc537b792, 0x1eeaf2ca, 0x51e7401a, 0xbaacfd3d, 0xb879330e,
+       0xabf3a556, 0xf9c46f4b, 0x64e214bf, 0xf88a4758, 0x461a6edb, 0x3dee39e7,
+       0xb0cf8d41, 0xf528e578, 0x2fd03afd, 0xdfeb5fa8, 0xddc3e9e5, 0xe7020547,
+       0x2cd546f4, 0x15eb7f45, 0xca73e527, 0x704a7917, 0x616df024, 0xcdef0128,
+       0xd04c7ef1, 0x22dd1fae, 0x4f33f8e8, 0x22f3575d, 0x44c05e54, 0x3edf50f9,
+       0xec18222e, 0xfc0f00a0, 0xfd71ed75, 0xd55685f3, 0x149272ee, 0x970df3e0,
+       0x5ef20e78, 0x7b89dadb, 0x6dbb850d, 0xa3845f71, 0xfa9c3ced, 0xbe25e5a5,
+       0xbf7ad638, 0x62f8caca, 0x9d7044a3, 0x8ed4b8d9, 0x4b03c5f1, 0xf580ae2b,
+       0x7b1fabfd, 0x8e7588ae, 0xc53f4a3c, 0x252c7cb3, 0xfe058c9e, 0xbc31cb5e,
+       0xc697a7d7, 0xf8d7f7c8, 0x8d6fe359, 0xc697d3af, 0x35e56279, 0x7665637e,
+       0x21d2c15a, 0xdafe049c, 0xe38f0e3e, 0x5cf1aeb6, 0x9f8ddcf6, 0x7800c9ac,
+       0xd0e74dbc, 0x3884b6ee, 0xb1bd9625, 0xfec4eac1, 0x6bf8d75b, 0x2eef8f21,
+       0x27a09c2a, 0x0377efbb, 0x813f5bfa, 0x677c2ca0, 0x73c32fa9, 0x642c4bbc,
+       0x85bbc40b, 0x1c5bf4fa, 0x6f93ffc0, 0x7de14758, 0xeb84d4ac, 0x8dd146eb,
+       0x08abfbf0, 0x1a83f8c1, 0x8d37edcf, 0xcf3e8e6c, 0xff3584fc, 0xc7a52b59,
+       0xd21756b3, 0xe6e3c925, 0x3ff77e00, 0xf209dbfe, 0x8cd176dd, 0xfaabec74,
+       0xaf77da43, 0x36dd9959, 0x0ad94e33, 0x64f293df, 0xc7b71394, 0x123c5ee9,
+       0x78a04dee, 0x4ea3928f, 0xbbf1f9fa, 0x71d50f44, 0xbb449e14, 0x2892f909,
+       0xc5d2ec8a, 0x4728fd29, 0x30905c9a, 0x4d8f2047, 0x885cabd3, 0x1ca83b0b,
+       0xc3d8b28c, 0x962477e0, 0x105379d3, 0xfac2c4ac, 0x754e116b, 0x3cc6cb9c,
+       0x7997ca79, 0x608a3870, 0x71121448, 0xdf4d7fa1, 0x6d7a7a6a, 0x59794102,
+       0xa810b0fb, 0x126cfda3, 0xaf885622, 0x01722964, 0x0a251aa4, 0xef179e32,
+       0xff304e5f, 0x78fd96d2, 0x42dd8742, 0x37c47e85, 0xfb5882fc, 0x869c7c79,
+       0x401fcf2f, 0x6a1ce46f, 0x8de6003f, 0x73c6cadb, 0x3b4166bf, 0xa87f43bd,
+       0xba9158f6, 0xdcfb8efe, 0xc209f2c4, 0x3ef44893, 0x687f519b, 0xebb8c9f6,
+       0xbf606b22, 0x189fdc68, 0x055bb49c, 0xcead1bbe, 0xa89f43b7, 0x1098e6eb,
+       0xfbf427d5, 0x66c8d0dc, 0xf72b07b8, 0x5dc72663, 0x3f21c9f4, 0xbefbf80f,
+       0x17c8c47a, 0x2e54c223, 0x32a1f6d5, 0xeae1a7dc, 0x19fb43a8, 0x9e49de83,
+       0xed152a3e, 0x8cdf955c, 0xdbe4d678, 0x77b9f728, 0x0ccd9bbb, 0x1a47e62e,
+       0x275c21c6, 0xe836721c, 0xb078b7a5, 0x29f2dbf7, 0xbf5c281e, 0xf4a3f902,
+       0xb81f384b, 0x21bfe601, 0xe415bd74, 0x27af7be4, 0x5475fa21, 0xbcd3f69e,
+       0x0fae3e27, 0xc04e27ae, 0xf3fef543, 0x46127aea, 0x01c8777a, 0x78e89395,
+       0x46ffc689, 0xa3e4d77e, 0xc8de2e0e, 0x047673c6, 0x0b9e59d6, 0x663065e2,
+       0x7805c9b2, 0x3aedecd5, 0xfe25bed5, 0x56ffb474, 0x1eba88bb, 0x4f800665,
+       0x5ecd44ea, 0xe3a25b77, 0x051dab53, 0x4fdb97a9, 0xfea45ef5, 0x1b39d459,
+       0xfe8ed0af, 0x84a2f79b, 0xfe37bfcf, 0x7914289a, 0x898dfc3a, 0x7f15dd1b,
+       0xb08471f1, 0x9ffec2fb, 0x230cdf9f, 0x7727dc7f, 0xe25aefce, 0xf5422579,
+       0xf5aade47, 0x3f193675, 0xd7969c39, 0xfb682f55, 0x01e9dd9f, 0xa98fbca3,
+       0x70c66fac, 0xeef20f4b, 0x25f8a9b5, 0xb3e80664, 0xb76a61f1, 0xff957564,
+       0xbcfceaf3, 0xb6f78636, 0x8307db5b, 0x3de7ad3c, 0x2f687135, 0xb0264c46,
+       0xb413762b, 0x8ffbdc7b, 0x5bde513a, 0x4feb7492, 0x8fc0bb57, 0xa7d9a9f2,
+       0x7c6a5d9a, 0x552ec3af, 0x3e2d1bd7, 0x795135ca, 0x193cf0a1, 0x1c03f1e7,
+       0xbfe62e75, 0xd05701c2, 0x3d584f63, 0x365fc075, 0xd838973a, 0xce12192f,
+       0xb096f162, 0x93bb3e4e, 0xde419b47, 0xb03f1482, 0xfae9f9fe, 0x1eeb8837,
+       0x0971b19e, 0x85aa5e0c, 0x97e9bec0, 0xd560d847, 0xfbc7f304, 0x6bfbb0e5,
+       0xfbb2e5fa, 0x31c73732, 0xa18b65fb, 0xfa5ac27c, 0x144bcc18, 0xfb9cdf88,
+       0x5006e1fd, 0x64f90e21, 0xf800d29c, 0x382b14b0, 0x71170c8f, 0x19de9473,
+       0xbc839042, 0x994ac489, 0xd247f163, 0xfb48ffb9, 0xf39128cb, 0x06323f81,
+       0x9a373c12, 0x9e7d8a11, 0xf13895e8, 0x8debd987, 0xbcc1ce5d, 0x41cfcaa2,
+       0xa937ce89, 0xe9839d84, 0xf050fb88, 0x8eadbf01, 0xadb2715b, 0xab3ed817,
+       0xd9e1813f, 0xc101bfe8, 0x5a825e60, 0x822257bf, 0x2bfd1135, 0xdfaff03f,
+       0xcaff4164, 0xd041dc46, 0xb1c41fb7, 0xce3aecf8, 0xbfea1ebd, 0x702dda10,
+       0x37268fcf, 0x343c3c9a, 0x40b716e1, 0x775e755f, 0x5f7c0736, 0x00ef172a,
+       0x9c275b9e, 0x6716bc1d, 0xf8c99ed2, 0xf975e14e, 0x9afd1af6, 0xacfd1d44,
+       0xd6895710, 0x08690ef3, 0x5cadedd8, 0xaafc1b9c, 0x831ce5d6, 0xe7a8b397,
+       0x3cdd0411, 0x1fcc6cd3, 0xe7f55369, 0x90b2e3df, 0x84f5b51f, 0xc63d6fce,
+       0xe8f30d7f, 0x386a8738, 0x973c6a77, 0x11dd969a, 0x7cc74a07, 0xee0952dc,
+       0x43672332, 0xbce3b436, 0x124cf6ce, 0x6a64bce3, 0x5cf31ac4, 0xbc5256b0,
+       0x4b780d7d, 0x40126b15, 0xcedea71f, 0x1f1188f4, 0xc47f9c6d, 0xfb47d841,
+       0x1f331883, 0xd2d32b45, 0x4c584a6e, 0xbf4b4fdf, 0x79ed4b01, 0x19885d83,
+       0x71b24c57, 0x64dcec3f, 0xfc18b103, 0xed1b24cd, 0x9de7b4ef, 0xff1415f7,
+       0x37bb8c76, 0x37bc31c4, 0x37bc31c4, 0xe53e1a48, 0xcebf9078, 0xf7975bba,
+       0x4967c1b4, 0xd10f2010, 0xb9f28e9f, 0xdde8c5c4, 0xf682bef9, 0xdca21f4d,
+       0xc4941730, 0x436c9106, 0x21f167be, 0xafc87ced, 0x4024cf7c, 0x96db94be,
+       0x16fbfaa5, 0x0604df46, 0x530df9f7, 0xb214dc70, 0xe2983ac6, 0xc9a96979,
+       0xd3a3710d, 0xc2723f0b, 0x1985e991, 0x0f20792d, 0x1b8f79a7, 0x984a97e6,
+       0x8e6cb85f, 0x2ed30814, 0xc2a81b93, 0x01ba7462, 0x4ccb3bf7, 0xc7aef331,
+       0xe9fed8d8, 0x961738d1, 0x90d36969, 0x92f59d4e, 0x8c4bf004, 0x35e54a7c,
+       0xcea8f17d, 0x6f94cc73, 0x790c5b14, 0x1349136b, 0x185beb87, 0xb1ac95f1,
+       0x35b7aab3, 0x39064979, 0x52ab7d84, 0x3a3547aa, 0x4d5f500f, 0xfe28b8c1,
+       0xbfd7a171, 0x79c37f06, 0x45ea015d, 0x10c88e4d, 0xa0ade7a6, 0xa1e2a377,
+       0xe83f7b6d, 0x9f8efb0f, 0x0739dbfc, 0x55fd3bec, 0x9e807768, 0xbbcf7e3d,
+       0xf4c7380e, 0x2e2c3dc9, 0x4fc18772, 0xfa63645b, 0x74ad8f7f, 0x8177e01e,
+       0x9e791fef, 0x77257e28, 0xe593fdb3, 0xde70de01, 0x506f7f5d, 0x70c93055,
+       0xf11f908f, 0x1fdea55a, 0x46c7a466, 0x2cb78b1b, 0xca59b1df, 0x4f7c6190,
+       0x5c7f8c25, 0x378f43f5, 0xd1dfd03a, 0x63b859e0, 0xd9be0484, 0x7566435f,
+       0x6445bdff, 0x025287eb, 0x151e67fb, 0x0f38466f, 0x2f6af7aa, 0x8fcb25f9,
+       0xdd63a329, 0x27b0f54d, 0x187bcec4, 0x13e4b1e7, 0x129528b9, 0x1cfdc96f,
+       0xfef0ddfa, 0xf33d743d, 0xee1f7ddc, 0xd9e719b3, 0x051f5ef5, 0x2a65b3fd,
+       0x6de78dbd, 0x3ed88597, 0x41e262f8, 0xfe72ecf9, 0xc5cec436, 0x678de318,
+       0x00db650f, 0xa9b0bf0f, 0x323cc4f1, 0xef6dce06, 0xfe20343a, 0x9f56f772,
+       0x828bef52, 0x3ca1bb7b, 0xce5823ee, 0xe2902303, 0xf6f432bf, 0xd55fc05d,
+       0x3ef13b4d, 0x8faaefb4, 0x9c2742aa, 0xe9ad4b90, 0x6e876a25, 0x8b20f903,
+       0x5a7d9d39, 0xc49cf9bd, 0x9f866afc, 0xb7e7d4db, 0x20723e01, 0xd9fe5bdf,
+       0xdbef4a04, 0xd1f3c52a, 0x6f3da5f7, 0xf7c3efd3, 0x3cdabe76, 0xed6b79b5,
+       0x9c5e6a55, 0x0e4d3bf1, 0xb97ca9e6, 0x75f4eb78, 0xea8a297d, 0xa9917ef6,
+       0xf3c3939e, 0x2d9f1a42, 0xe945a523, 0xa349f831, 0x84df076f, 0xd3f38e7e,
+       0xbeb8bae8, 0x3f83c54c, 0x4c4fdd4d, 0x91957883, 0xa73a7a8f, 0x32462add,
+       0x7c8dbe41, 0x7dcddad2, 0xb31b2128, 0x4acb162f, 0xa8cfc411, 0x15cebbf9,
+       0x171cdf65, 0x14fe0fea, 0xe32b6ee4, 0x083d0efb, 0xf7e8314e, 0xff5c4537,
+       0x54e43a57, 0xe90fffb8, 0x13f20e37, 0x4f787ecc, 0x4f98e71b, 0x808a0651,
+       0x4f2c62ff, 0x81954afa, 0x97db3a83, 0x04e73c6e, 0x086dbbfb, 0xab51b8c1,
+       0x69ef0f43, 0xe37a8f1b, 0x4a8f4ab4, 0x3f9be5a1, 0xdadace83, 0xc7177982,
+       0xa771a92e, 0x58e2e64b, 0x39d8b4f3, 0x7778bddd, 0xf9a872a8, 0xfa540b35,
+       0xfb6211dd, 0x4d370be9, 0xc9747a47, 0xa1fd54bf, 0xf50e46b2, 0x4b3e918e,
+       0x3e63d7dc, 0x3e40a2da, 0x5e85df7e, 0xbba441e4, 0xda776e91, 0x371eec5d,
+       0x7b8246a1, 0xe26d8eed, 0x8571ff70, 0x73ff7b10, 0x9df4ddb6, 0x479c63e6,
+       0xdb2ff077, 0x2faebb5a, 0x908ff981, 0xf08dcf80, 0x425ff36b, 0xd4a7a614,
+       0x2f3776f9, 0xf2c49912, 0x7f75d434, 0x815b9c39, 0x790793fd, 0xc6adcf96,
+       0x35f834a1, 0x28f38d78, 0x7cf12be2, 0x8f035b41, 0xf877d979, 0x77067dd9,
+       0xfd70e5ac, 0x9a4e8eed, 0x7bf6d15e, 0x30ca9baa, 0xfb43cb6f, 0xedb63b01,
+       0x29f6c263, 0xcf7873d6, 0x0cf4b75b, 0xeea57cb1, 0xa30849e8, 0x374a62db,
+       0xdebb3ff0, 0x0caf909f, 0x0a27de8c, 0x8c0ca0dc, 0x4122b7de, 0xb15957cc,
+       0xf9eeba7d, 0x8e35768d, 0x9ef5eaa5, 0x24d48fe4, 0x696f8cc4, 0x9fc9a6f2,
+       0xda778f26, 0x0a6f6665, 0x59198381, 0xd1879f80, 0x7afaa1bf, 0x3df99d9e,
+       0xafa5cd0f, 0xa73c6f54, 0x3258a7db, 0x096bd196, 0xbbcf825f, 0x0f14bbd3,
+       0xd8bdbd3a, 0xf8c3cfae, 0xe6d1f3a1, 0x3689c9a1, 0x189ca33f, 0x43d237bf,
+       0xe919ef8b, 0xc007a462, 0x5bc67e09, 0x35816d7b, 0x38b7ce14, 0xaf7fb706,
+       0x4d6ee115, 0xb9c0ac9b, 0xf9f4eacd, 0x3e01fe58, 0xb0fb074c, 0x768eceb4,
+       0x8d87eaae, 0x225c5dea, 0x5ecbb557, 0xd9232ab2, 0x24d2a7b9, 0xb58993e0,
+       0x17161991, 0x583e8f21, 0xa4f7045c, 0x32387c4e, 0xbff14203, 0x5646f07e,
+       0xd77916df, 0xfcfb86e2, 0x690a8a4b, 0x2fd071fd, 0x95fa2fa0, 0x6efbe0db,
+       0xf973c4eb, 0x1fdeccba, 0xcf9d2e65, 0xed66b1ee, 0xb33ed495, 0xf2aef5d0,
+       0x4157e0f0, 0x4a5b2b7e, 0x542e218a, 0xba781109, 0xce2955de, 0xad872db0,
+       0x7be9e3fb, 0x4f3cd91f, 0x76ee21d9, 0x8bae2d71, 0x94058795, 0xc588722f,
+       0x573a0567, 0x6d6efd2b, 0x2993b51c, 0x5a26d77e, 0xd317e0dc, 0x97f07ee7,
+       0xb22a26d7, 0xa35cf51c, 0x70077c1f, 0x7cb135ac, 0x0c6ffd82, 0xc65c8f8e,
+       0x23efd82e, 0x34cfe025, 0x1a582cfb, 0x1725f3db, 0x37c8e79e, 0xb18978b1,
+       0x76bb6dfd, 0x00ce49ae, 0x243ea8be, 0x1fc3fca1, 0x84559fd8, 0x613549c9,
+       0x0eaad0e7, 0x53773c13, 0xcf08a87d, 0x84b9c0dd, 0xe07a754f, 0xa6ee735f,
+       0x9e18af93, 0x44ae040a, 0xd0b71a88, 0xf9d5d56e, 0x9810d354, 0xdce3e10f,
+       0xcf846e70, 0xa2ecd530, 0xa0afe7f3, 0xe087c525, 0xff70f372, 0x89e4fd4c,
+       0x559fdc3c, 0x2d79aa27, 0xbe3e7626, 0xe557dd63, 0x39fb2b4f, 0xdd028f4a,
+       0x25b1ff4f, 0x53f6c6cf, 0xe6d6afd0, 0x8429c75b, 0x35ed7f03, 0x7219e782,
+       0xe0334993, 0xb19446cf, 0x47166fc0, 0x6c97caa2, 0x65fe9b3f, 0x9b36e940,
+       0x7e53237e, 0x9fc1faff, 0xe3bbff22, 0x68b2ab4d, 0x59f8739d, 0x2e74c33d,
+       0xef30b28b, 0x6bf565a8, 0xd006e74c, 0xc358e8ba, 0x4af1b0ea, 0xa3b33e17,
+       0x143fc8ae, 0xba3171c6, 0x01ae50ee, 0x2c4c16fe, 0x901c23ae, 0xcb477f70,
+       0x794b5957, 0xe2d1f806, 0x5d747a60, 0x3673c16d, 0x28179b88, 0xec4fe432,
+       0xfa41ef51, 0x5786a5be, 0x7f4266de, 0x7fc04a09, 0x53e183bc, 0x54690ba3,
+       0x5e3c81ae, 0x81ae5412, 0x0e7ebd7d, 0x7e83a24f, 0x96adf23f, 0x1bcfa089,
+       0x0f28f9df, 0x82bf73ef, 0x2df233f5, 0xf9d243ea, 0xff6dfe9c, 0xe4fbd1cd,
+       0xa9f91cfd, 0x03251df0, 0xec9cafda, 0x3951b722, 0x2c8853ac, 0xad9f8365,
+       0x091b2ff7, 0xd91f4fd3, 0xa070af4a, 0x3ae3093e, 0x67bb13f6, 0x7e8dd400,
+       0xec496933, 0x949dde55, 0x17ee3773, 0x7d346625, 0x85d610b8, 0x4a7bb1df,
+       0xfcc14538, 0xee3b17d3, 0x9718236b, 0x373891b2, 0x9b898dc4, 0xd453f9a4,
+       0xf1899af8, 0x945e7255, 0x87ceacff, 0x79085f7e, 0x2c6c63f2, 0x8fce81bf,
+       0x823afd07, 0x848e58c8, 0xa0365938, 0x3df583d8, 0x4fe1f824, 0x588fff69,
+       0xb2ca7c59, 0x8fe2e89d, 0xb7160e65, 0xe2c9c079, 0xf062718f, 0xe22bb016,
+       0xd81710ce, 0x4b8f6d15, 0x0bcfee02, 0xdf709bae, 0xe309a0ee, 0x018b4fdc,
+       0xb517ec17, 0x5bc8255f, 0x6d7f6748, 0x7eb5dd2a, 0xabe4911f, 0x0bf7ee20,
+       0x9d3fab27, 0xbb8f304f, 0x801484fd, 0x0cc4dcfd, 0x3c744d4b, 0xd9839e69,
+       0x1573bfbb, 0x043a04cc, 0x1811c6f7, 0x38becc7f, 0xb9e3d013, 0xe056b91d,
+       0x4701178b, 0x66890f14, 0x5fd09dd7, 0x6f0a39e2, 0xf9673e16, 0x223c82fd,
+       0xfc77e29e, 0xee19768d, 0x1ada7ad1, 0x56f311bc, 0xbde1379f, 0xee4a2fc1,
+       0xf17f50e9, 0x3d02ecac, 0x305674fc, 0xbcf3e70e, 0x62f3e709, 0x2bd5fb5c,
+       0x0c0fdc29, 0xc12ef161, 0xcfd00446, 0xbe40a982, 0xae5f3e93, 0xafa6b1f2,
+       0xd11c8137, 0xc11c23fa, 0x29820c73, 0xcb48e51f, 0x276b6a27, 0x67d44f98,
+       0xfc0f0b66, 0x8b5d371c, 0x8879853b, 0x25284d17, 0xb04dcf68, 0x05ce788b,
+       0xbce199f2, 0x0f5544db, 0xb2b8fc4f, 0xbb07e584, 0x9ebdc30f, 0x7ef576cd,
+       0x739f7530, 0xd727ca92, 0xa16f0891, 0x245dd7ed, 0x4d27886e, 0x8fdfa8ba,
+       0x5f60ca78, 0x57fb514e, 0xf0855dda, 0xede89f38, 0x450d29bf, 0x2c3d6027,
+       0xfc008a20, 0x6862d934, 0x09d23b07, 0x9febf0f7, 0xfd50e03f, 0x19924cdc,
+       0xeda6c79d, 0x87e14d43, 0xb5fb446e, 0x5e037258, 0x0f95da76, 0xdfc03f20,
+       0xc5cb9222, 0xb1f29f25, 0x1721c37c, 0x2cae046d, 0x8769fca4, 0x50dd5cf9,
+       0x79d2b7ef, 0xf5903d5f, 0xfa087c0f, 0x93c7cae5, 0x8fdf4093, 0x95a5e957,
+       0x7f01df1a, 0x7f19e2b9, 0xca7786b9, 0x2c8ed3e7, 0x37934f7c, 0x67e83be0,
+       0x1f98188f, 0xf29bbf6b, 0xafc0d3eb, 0xfd04ed3b, 0x5ba59fb8, 0x699c80e6,
+       0x7caab4e3, 0xd5d72c6d, 0xbf0fdcae, 0xc0bfe4fb, 0xbec28dd6, 0x75e8a517,
+       0x83024fbf, 0xcfd72bd7, 0x68790698, 0xccf31176, 0x5173d452, 0x1e92fcd1,
+       0xdf1a2fc5, 0x9c59dab5, 0xc99fe348, 0xe1e5dfbb, 0x840be4f9, 0x8748b2b8,
+       0xcff1a2bf, 0xf7187f44, 0xe6122781, 0x67f9189f, 0x93fc3757, 0x40165e7f,
+       0x9fe1756f, 0xba7f8c43, 0x0fda1be3, 0xe4616bde, 0xaa1c779f, 0xff2dddbd,
+       0xfcf3c25c, 0xbe4ef7ab, 0x93657eec, 0x6a9f9f4f, 0x62d9c72c, 0x54bb2fe7,
+       0xea96efbc, 0xbd01ca6f, 0xcec4d531, 0xe32409ef, 0xeeef0a16, 0xfcdeed38,
+       0xefa86c9a, 0xda1e9814, 0x1ea33219, 0x78f769da, 0x669b7e30, 0x0557e761,
+       0x23ce044f, 0xe45afbb8, 0xd921dfe8, 0x587660ee, 0xfb8f0c50, 0x37f1ec02,
+       0x9d8c1f18, 0x2a43cb9a, 0xa662fa5a, 0x971d4617, 0xcfefc336, 0xbfccea3d,
+       0x06967c00, 0x79dfa3b8, 0xcf784a8f, 0x0951f552, 0xf76fe3f5, 0xf1045dbd,
+       0x79cf2d51, 0x8bb79ecc, 0xfbc2860a, 0xa1fedf8c, 0x8ead65ea, 0x5f404047,
+       0x1fddee1a, 0x4b1e71d7, 0x297e6f7f, 0x674e51f0, 0xf93ef1bb, 0x3fdb1c60,
+       0x11644d99, 0xb4719886, 0xdeb85ef4, 0xfcaf78cc, 0xff3b30ec, 0x27b0f336,
+       0x2af2bdf6, 0x37ef187f, 0x8a77f6a7, 0xe7efec13, 0x6841f65a, 0xdd6cc884,
+       0xd7354a0e, 0x26a33f30, 0x9349f81b, 0xf8a3fc43, 0x44327e0b, 0xb706bbf7,
+       0xd07ff3a9, 0xa9fbb02d, 0x4bee1222, 0xefb09cfe, 0x363aea82, 0x40f4c9ca,
+       0xe617eaee, 0xcb239c03, 0xcba06695, 0xd7162eb3, 0x5b0905f9, 0x6e6e81b2,
+       0x8253f701, 0x0bf93ca2, 0x223df3ae, 0xd3b10e94, 0xe27d3df6, 0x8ff8c246,
+       0x9c633d3a, 0xed099f60, 0x31bbe087, 0x824773e3, 0x588fb71e, 0x9aeb049b,
+       0xab853706, 0x13bd9b78, 0x81ae0d0e, 0x8f97c64e, 0x00c6cb3a, 0xd03be01e,
+       0x8e474d4b, 0x8d7be059, 0xcf7b821f, 0xe2883e30, 0x4e83e00b, 0x4016e0be,
+       0xa283c35d, 0xfdb7cfae, 0x8b42f88b, 0x17c8f46b, 0x7e70b710, 0x0b98be2f,
+       0x05f23578, 0xce3ce7b5, 0x505cf618, 0xc6937962, 0xe7b13fe7, 0x896efbe3,
+       0xd913de60, 0x6bbf6567, 0x7dc049e8, 0xd8b8df90, 0x1c9f6d98, 0x28a6a4cb,
+       0x7664e559, 0x2a3bf6bd, 0xda1cc223, 0xa2a8239f, 0xbced0db8, 0xdd27a87e,
+       0x31c8fe2a, 0x46fb838e, 0x033e3731, 0x1270d0ec, 0xcc236bd8, 0x87906125,
+       0x1989b65d, 0xdae63f60, 0xfcc36426, 0xfab21e5f, 0x5ed2584d, 0x9bfe5bee,
+       0x7da772ad, 0x66c3e9a5, 0xfc6d5bb5, 0x4c7f2a35, 0x2779d852, 0x70d1ebd0,
+       0x9003eb68, 0xc2e0e009, 0xdadf4db3, 0x22878f50, 0x00936f14, 0xfd878a0e,
+       0xfb04691c, 0x24a4df21, 0xb03b064f, 0x3800584f, 0x9d7ef6db, 0x92cef109,
+       0x021febd0, 0x3eda25bc, 0x0fbf5bac, 0x35b7b46b, 0x3ff3487b, 0xf3497b34,
+       0x82aec17b, 0x1fd532f6, 0xbed99971, 0x05b084d8, 0xe47853ef, 0xa2957cac,
+       0xe740b3ca, 0xe3cea251, 0x7082d266, 0x4ca9f769, 0x7251f153, 0x39abfa88,
+       0x54c84ed0, 0xeaa9878a, 0xdd532a7d, 0x6e22fbfa, 0x3efb1b1e, 0x9e9fad15,
+       0x1bae37de, 0xa3f61ad7, 0xc879687e, 0xf94feec7, 0xc3f98fbd, 0x7ef007e3,
+       0xb1dfd601, 0x09feec59, 0x21c3c317, 0x763af629, 0xf1eb9551, 0x9c0e48a6,
+       0xe7bfdec7, 0x1e6eb8ef, 0xf7f7f3d8, 0x771c8ec1, 0x97902042, 0xa8c4fe3b,
+       0x180fcc78, 0x695f232b, 0x6f3f7afd, 0x9cf611b4, 0xccdeff44, 0x728f0a41,
+       0xc167c025, 0x8f5395f2, 0x9dfd0a3c, 0xe8902a3f, 0x92451f73, 0xe5c42067,
+       0x1ddfd48b, 0x7b31c83a, 0xa83f6b4a, 0x11c7defe, 0x21216f95, 0xc567bb43,
+       0xa9e7451c, 0x1a1ffdea, 0x2f1ea75d, 0x74e4213e, 0xfdfc0fa5, 0x5a10e233,
+       0xaa9ce1fc, 0x9ff3490f, 0xf5ce7cf0, 0x600a778d, 0xc69f5fbf, 0xdc6a2513,
+       0xe9ea641b, 0x4e21c547, 0x6ff60d3a, 0x4e8f33f3, 0xb7e5bc83, 0xf4814c78,
+       0x99be7686, 0x3e16f503, 0x462abde6, 0xba1f5efc, 0x9955ef13, 0xa3e4cf1b,
+       0x5fc7f1a7, 0x3864f94d, 0x3b309dd0, 0x4bdd8f30, 0x81efa462, 0x1491ff3d,
+       0xbe3dda19, 0x91bfa3bb, 0x2a9caf0e, 0x9eac7dc0, 0xdbe461e8, 0xfe9e747d,
+       0x5377e12b, 0xbf8fc42d, 0xfac2ea9b, 0xac34beab, 0xddeafc6b, 0xd81264fb,
+       0x4e9f1a79, 0x337c6249, 0x49a3f76e, 0x2f49dec4, 0xc586de23, 0xc97ffe33,
+       0xee25d9aa, 0xa3e8d359, 0x843ae977, 0x2d27ea8c, 0xaa563790, 0x70fb3ac2,
+       0x4425da11, 0x5c62cf3d, 0xb7f366df, 0xda75014d, 0xccfeefd3, 0xf57acb94,
+       0x6fc5397b, 0x0eb00bd5, 0x99ab0916, 0x78ed531e, 0x9d231e0d, 0x08a523df,
+       0x19f0777f, 0xe708c0f9, 0xf6f91d4b, 0xda07ae0a, 0x18cce0ef, 0xc6262598,
+       0x8f868798, 0xc7ae8499, 0x8f5fbdd9, 0xdbd78c6f, 0x178ee7ef, 0xdad011fe,
+       0xe919bc9d, 0xf4d76c66, 0x900c1147, 0xec1fa58b, 0x29f1b993, 0x8ba2df48,
+       0x3ae85112, 0xcfe9fa43, 0x2b9293f5, 0xb956df91, 0xf8eeb3d8, 0x4f22faad,
+       0xf93b233c, 0xd87a6c4e, 0x5bb77c06, 0x1c41b7a8, 0xf4fb3af5, 0xc2bd103a,
+       0xe2660bcf, 0x131115fd, 0x94dad081, 0x886699d0, 0x243f7833, 0x20a1be78,
+       0xf0327fb4, 0x0b42abe9, 0xe76d59fa, 0xca387909, 0xd50a6cee, 0x6b2ec0d9,
+       0xf3e7664a, 0x5d10260e, 0x78c5f4fe, 0x8e9a6fa6, 0xc4a69d9e, 0x62ee1f68,
+       0x28833cfc, 0x9ff439c9, 0x7f29eb45, 0xc7dc1f80, 0x42927181, 0x325afdce,
+       0x39732dd8, 0xf6da23f4, 0x992d798e, 0x7b7adbc2, 0x2999ea02, 0xe9ddf74d,
+       0xfe0884a2, 0x6f3e2463, 0xfef0e32f, 0x8dd92284, 0x59c5a2f5, 0xf98df7e8,
+       0x09466926, 0xa220dfb4, 0xaf8533df, 0x755e2014, 0xabc38d3a, 0x9170f63c,
+       0x623df85a, 0x0e3674ff, 0xc093f971, 0x24a77d3f, 0x66fe0469, 0x07d5ac9e,
+       0x122eefe1, 0xfab6ff83, 0xcdfb73a5, 0x2cf57db4, 0xa78df30e, 0x3f8832b8,
+       0xd68a7f8a, 0x5baf384b, 0xc005a942, 0xf58a33d7, 0xaac31ee7, 0xd4ab393d,
+       0xfbd10246, 0xe50b9cf9, 0xfdb5a0fa, 0xf11dfc56, 0xf98122bd, 0xa37e7269,
+       0xe7b3efca, 0x9bbee924, 0xa9dd984e, 0xaa4dd5c9, 0xfaa8ddfc, 0x193d73cd,
+       0x094bf1ba, 0x40fe87b3, 0x64810bda, 0x7ed8b8f7, 0x96f6b4f4, 0x25e1f3c3,
+       0xd068dfbe, 0x310d3787, 0xe57cbdf8, 0x348be45a, 0xc8f78dce, 0x37edf5b8,
+       0x8dd7d58f, 0x0fd46bf2, 0x8f8b20b3, 0x3427aaef, 0x2f6b307d, 0x683c422f,
+       0x33c53e56, 0xbb7ac5da, 0x317d27bd, 0x7d1bae26, 0x17be4971, 0xfa2e90cc,
+       0xefe2e3e2, 0x4b7e2fa5, 0x54b196dd, 0x578edfae, 0xa4fecdd7, 0x298de83f,
+       0x81478efc, 0xbae8da8f, 0x47c18e69, 0xc5a3bada, 0x1ca88a01, 0xc5381ea3,
+       0x5ca663f6, 0x91fe274c, 0x0e80719d, 0x12ed423d, 0xa97b0c77, 0xe51b3e35,
+       0x68ef43ab, 0x2eca257a, 0xb87ef311, 0xda85325d, 0xc02e52a3, 0x2be10fd7,
+       0x2925ef52, 0x882b8482, 0xc19da61f, 0xa0579038, 0xcfae2cfe, 0x817f224f,
+       0x3b12e3fe, 0xaf68c3e5, 0x0ae87168, 0xe94f6697, 0x1e23a5f9, 0xc3dd9339,
+       0x1149f1aa, 0x7fe413e0, 0x04fb8f26, 0x7fd41bff, 0x8000b303, 0x00008000,
+       0x00088b1f, 0x00000000, 0x7cc5ff00, 0x55547809, 0xf579f096, 0x55492d5e,
+       0x146caa92, 0xb612f08b, 0x84582484, 0x5916ec80, 0xa014a358, 0x8168cb80,
+       0x9a126b0b, 0x69ee9c71, 0x0242a6ff, 0x83b74343, 0xe8cedad2, 0x3ad857f4,
+       0x08b41a83, 0xd09d0301, 0x584c5015, 0xf82e0834, 0x1a6d1ad9, 0x84490ed1,
+       0xbfbb46d6, 0x739cffcf, 0x2aaa4bef, 0xffff4d85, 0xb49fdf3f, 0xdeefb97d,
+       0x67b9ef77, 0x979ee73f, 0xb3559bdb, 0xf6e008ad, 0x14078a99, 0x77f1d000,
+       0xe042c022, 0xadacc37f, 0xc78ef016, 0x69fcd7be, 0xe7f80d87, 0x9c2ffc3b,
+       0xa42cfc90, 0x900bcf50, 0xce54b009, 0x7d57fc5f, 0x3c5e3d33, 0x52fe7a27,
+       0x92b9fd98, 0xf81b700c, 0xf71c30cd, 0xff8ec5f3, 0xc7154bec, 0x7e8b2e97,
+       0x4a4ce99e, 0xff8790bf, 0xbe230118, 0xd4ca0153, 0x22b79dba, 0x5527ddbc,
+       0x334c558f, 0x390ffed1, 0x350ffec5, 0x7c800c97, 0x1674df80, 0x3db1f8a7,
+       0x1c2111b6, 0xd1bad00d, 0xec71edc6, 0xefc5f107, 0x3c66e7e8, 0x21fc059f,
+       0x52b4b607, 0x4801b721, 0xc4ed1805, 0xff602745, 0x0d3f9e2a, 0xc02486c7,
+       0x5c2473ef, 0xe7af00d9, 0xf104e798, 0x5eb8c3bd, 0xe30dd700, 0xf75c01fa,
+       0xf72746c8, 0xe6e8db5f, 0x442e0dfe, 0xfac0066a, 0x37af2714, 0x8776f72f,
+       0xe35bdf1f, 0x50e7e6cc, 0xf844da3e, 0x7b2fe036, 0x1004086a, 0xac77afdf,
+       0x807494d0, 0xb1e2b72a, 0x01d1f566, 0x8e58e34f, 0xbe25cbf3, 0x102ab72b,
+       0x1fe5e7c4, 0xc4072bae, 0xee33575f, 0x2aa9f887, 0xfc368355, 0x63d34967,
+       0x0cdf453b, 0xdefa08d6, 0x33028e22, 0x86cd16b5, 0x28f02cfb, 0xf1f7151e,
+       0x6ff78936, 0x1d412af5, 0x278b79ff, 0x63871e9a, 0xae58bee8, 0x0ffe80b3,
+       0x47305bdf, 0x9d718609, 0xdfa29305, 0xd6757c5b, 0xfed8cae7, 0xe898b47c,
+       0xbf3fb63e, 0xb7744edc, 0xc1863fe3, 0x95fba230, 0x8d6fa58b, 0xc5ba3e85,
+       0x8e74b1b6, 0x9d16bf1d, 0x673a27ef, 0xc6ce9b5c, 0xce8b7ffb, 0x904e110f,
+       0x1bf470be, 0x30049e8b, 0x1a07e9bb, 0x55f679d1, 0x32add78d, 0x861433ce,
+       0xd4fe79d2, 0xb76ff859, 0xaafcdf42, 0xfe2d2fa6, 0xe79f6b82, 0x22bfed6f,
+       0x69fde745, 0xdf7e6f5f, 0x8034f3be, 0xf9ce78c1, 0x8df8d139, 0xbd2c6ba5,
+       0x62f7ca16, 0xe635b5e9, 0xa05d061c, 0x60689913, 0x555fbc1c, 0xd16b8e19,
+       0x162e97ad, 0x7e4f08ff, 0x5f8071ff, 0xd6fab9f3, 0x76827493, 0xe02057cd,
+       0x03c84732, 0x052075f2, 0x0ade5be9, 0xec0444e1, 0x3e738b96, 0x28f5a8d7,
+       0x39c469f0, 0x8353e7e8, 0xfadf6ace, 0xb2075765, 0x96fb19fc, 0x14b01069,
+       0x972173d2, 0xd255f0b1, 0x7e69233a, 0xcb68f980, 0x10b2d32e, 0x05ba639e,
+       0x9b51f5ee, 0x4e03da28, 0x9d1a07a1, 0xfbb75e26, 0x6e099b2b, 0xf0e57804,
+       0xf8406280, 0x09e7563c, 0x33218bd2, 0xc945fbf0, 0x9cdfcf3a, 0xdc048104,
+       0x9b76b41f, 0x2b44f90f, 0x3941c806, 0x825906d3, 0x9d64b835, 0xdc91f616,
+       0xa8347b75, 0xd1bbb946, 0xe048ef78, 0x6c92402e, 0xa99474fe, 0x0fde8b26,
+       0x79c54fb7, 0xfa6a1537, 0xb2e29c36, 0xf1a03fea, 0x93ab66ae, 0xf83eebde,
+       0x5a662dcf, 0x20f02be7, 0x335af084, 0x4f8e1532, 0xa4839873, 0x93d4ca37,
+       0xddfb09aa, 0x8fa4003d, 0x970b2da6, 0x3a6dd200, 0xb138d7b4, 0x8c74429d,
+       0xd0bfbf43, 0xde843379, 0x9a74881a, 0x4334e921, 0x6692abea, 0x4946f595,
+       0xac841a92, 0xb374fd3e, 0x408cd1a4, 0xee0a497b, 0x3c53433b, 0xf9bfd835,
+       0x8fc516aa, 0xba3e932f, 0x951f4fb1, 0x3dbdf5c9, 0x019686ba, 0xff344266,
+       0x3d0a3596, 0x798b6254, 0xbe0fed2e, 0xe6557cc9, 0x429f1e8c, 0xfbf913ba,
+       0x825e8c62, 0xa653fb18, 0x03b935fe, 0xc58af0f1, 0x8454defb, 0x19b4e7bb,
+       0x70e7c59e, 0xfb933b11, 0xc631a7e3, 0x07b6c51e, 0x757a270f, 0xe215eb84,
+       0x07f50723, 0xd7b1f579, 0xa3b63f9e, 0xf18e98a7, 0x0d22dd4a, 0xcf2d99b2,
+       0xf0fb33ba, 0x92bf0fde, 0xad78b10e, 0xdbde7a97, 0x8e8d7ce8, 0xad8f0fdb,
+       0x979ed8b3, 0x48d749fc, 0xf8bdfdf5, 0x95e5e434, 0xe25e890b, 0x0c2e57ff,
+       0x4afdb2f2, 0x0c3e59d2, 0xfe783879, 0x51e92272, 0x21aea7c4, 0x6cb8f49f,
+       0x9f99679e, 0x06841c85, 0xc36e0a8e, 0xc12485fe, 0xf624aff7, 0xbc23cf1c,
+       0x3cf262df, 0xeb68db4b, 0x202a2f87, 0xd175b9fd, 0xe2803379, 0x2887e505,
+       0x84ee8a4f, 0xa00db1bb, 0x05ff113c, 0x72482152, 0xd0108662, 0x785e35be,
+       0xd319da9a, 0xfbc214f4, 0xddb35c65, 0x29e9eb41, 0xd7f0f7c4, 0x057d132b,
+       0xbf5ff1fd, 0xee1a7c11, 0xe6d1b0d3, 0x1c2f50d3, 0x7ee4e8d8, 0xb73746e3,
+       0xdcea3687, 0xfc913a6e, 0xaa1ff243, 0x169f16bc, 0xa5e657a1, 0x0330fd0a,
+       0x35c10ef5, 0x00609403, 0x23c66f79, 0x7288f2c0, 0x10a4dc10, 0x393cf0bd,
+       0xfa44f87d, 0xe888ee5c, 0x3b56ad43, 0x82a59321, 0x67985ee9, 0x09d1f7e2,
+       0xd59f3e08, 0x3fd23e7f, 0xfc8cbfaa, 0xefc38416, 0xb0b996f2, 0xb37c390d,
+       0x7adf885d, 0x4bd1e965, 0xf4b9fdc0, 0x43b95ebc, 0x8feb84bd, 0x1f84cf0f,
+       0x8f18bda2, 0xe2bc2184, 0xff045dcf, 0x100b1684, 0xb2b0d07d, 0xf21a167c,
+       0x5ca2b5f9, 0x8448fdc0, 0xef8c1bbe, 0xc4c3cb59, 0x23a0074f, 0x645ef08d,
+       0x7e49d9f3, 0x3f04b997, 0xdddb9578, 0x3937ae0a, 0x0951e2c3, 0xf1bee1b4,
+       0x2d7f11eb, 0xce21b819, 0x1cc9696f, 0xb713e7a2, 0xc93ef1bd, 0x08e6d7b7,
+       0xcc986cab, 0xf6111d9d, 0xe33c007c, 0x74927f24, 0x476877dc, 0x0e4e3f5a,
+       0x6abb9eb0, 0x6b5e9209, 0x09ec933d, 0xafd33ee3, 0xacbfd8da, 0x6e5117a7,
+       0x8f26270f, 0x42133d65, 0x63f2430d, 0x6d98e713, 0x3c23aff6, 0x7a3e65a0,
+       0xedfbdf0a, 0xafd20065, 0x543fdbd3, 0x312d0fc9, 0x40e80ee5, 0xa32a8f38,
+       0xf27da853, 0x6e7ce4e3, 0x127724cf, 0xec9b0e7e, 0xcefbed3a, 0x0474bd46,
+       0x8da9cbf2, 0xf9023a50, 0x368dade3, 0x746f4f6e, 0xa3667b72, 0x38a3db9b,
+       0x3af3fc4e, 0xbd7f138e, 0x6fd4e381, 0x4f6a71c3, 0x7ad43ae0, 0x489872df,
+       0xe5bc677e, 0xbc2da8d0, 0xfadb892b, 0x742c933b, 0x50c9c38e, 0xfc4fec67,
+       0x370c4e14, 0x2ee50780, 0xdb53fdd5, 0xad3f680d, 0x1c6502fe, 0xf754d4c0,
+       0xae3a6d5c, 0x8fe87b3b, 0x19f1c2be, 0x6a7ec3a9, 0x3b6f7843, 0x893868e3,
+       0xf5c7d2fd, 0x3f883a9f, 0x92a2244f, 0xb7643c24, 0xc7365179, 0xc418d293,
+       0x24c2f768, 0xfd19a7ec, 0xc8a5b9ec, 0x3a4a4b0a, 0xb005c0f2, 0x73e1b1f3,
+       0x25df886d, 0x513fff76, 0x9b6812df, 0xfa9d3a53, 0xbc927010, 0xcb20e62b,
+       0x7d2510fb, 0xadbfda11, 0xd4c4ff0e, 0xabc07f08, 0xf48d21fc, 0x02af44c3,
+       0x77a674ae, 0xf7d2a470, 0xd5b798dc, 0x15313651, 0x2ed7f7f9, 0xc269f995,
+       0x741bc534, 0x635f97f4, 0x7af384de, 0xe26fd129, 0xd4b559c5, 0xe2e3982e,
+       0x4dd96fbe, 0xa5ff24b5, 0x5fbd6b8e, 0x5c87efc2, 0xc547d666, 0x638bce1a,
+       0xe3798d17, 0xffc8c991, 0x0c4b69ee, 0x7d7c4b3e, 0x84935fd6, 0x567732fd,
+       0x34752aa1, 0x6bb5df70, 0xbf978d1b, 0xe572c0de, 0x59e8f249, 0xa5ed8ac4,
+       0xd33e3869, 0x24c278a1, 0xa93ed32a, 0xa771a34d, 0xcdb421e2, 0x553b8ef4,
+       0x5423e344, 0x9fea4ccf, 0xd89d4bd5, 0x4e66d19e, 0x66f384bd, 0x6c78a4e7,
+       0xf099def8, 0xff10ae8f, 0xf249ccce, 0x1714e824, 0xa4ae9f04, 0xa9eac7be,
+       0x8f1ce9d6, 0x3ad32495, 0x6131e2ba, 0x92d6febf, 0x147045ff, 0x514052fb,
+       0x91a5dc68, 0xc7e4fb1f, 0xe275293f, 0x0aa1fabc, 0x099cfc90, 0xe091fee7,
+       0xa89ad99f, 0xf5402027, 0xbd296716, 0x9c516f57, 0x2befb89b, 0x5181f9a1,
+       0x5c79fd66, 0x769de4f7, 0x6fe507b6, 0x745fb3e5, 0x6cc1cef2, 0x9adfca17,
+       0x49ed4c56, 0xcbdbf093, 0xc39f2adf, 0x930826e3, 0xebbf2952, 0x1dbdf81f,
+       0x4d293f25, 0x0c4ff5c7, 0x416eb173, 0x116a953a, 0x83e70d7a, 0x55dfef42,
+       0x945bf3c1, 0x8f3a3f01, 0xa7e4aff3, 0xff715a14, 0x5109e959, 0x710ce7f3,
+       0x8de7f545, 0x45aa5818, 0xfcf2b1d8, 0xadfea8ac, 0x88e94a45, 0x69bef988,
+       0x45fd5109, 0x11d2aea5, 0x2b6ff311, 0x5fd5181f, 0x54565b72, 0xb269a67f,
+       0xa11b1fd0, 0x7dc854bc, 0x9bfb2979, 0x0a87acd9, 0x1bee629d, 0x8e3f7e38,
+       0x7f09b617, 0xfe85d0aa, 0xb4a5d214, 0x80fd88ad, 0xc68f7c36, 0x8f52ec8b,
+       0x3ddda005, 0xfc80ec91, 0xf62fe209, 0x6677658b, 0x6305fa3b, 0xb768ae89,
+       0x752fe023, 0xfaf1db44, 0xcc27e144, 0x0bad7f01, 0x75a739e9, 0x6557fb1e,
+       0x6145d5e9, 0xbf467c20, 0x2a370b1f, 0x13779dd1, 0xac6ab61f, 0x890ce737,
+       0xd4adafd9, 0xf48c7ec1, 0xb7c8e6ef, 0xe0217d8c, 0xc6ff276d, 0xffb18738,
+       0x4733ceb5, 0xe17ec69d, 0xacd73adf, 0xa9a5859c, 0xcf5fe171, 0x9c2c4cfe,
+       0x4f32a979, 0xfb15fe81, 0xeca9ad85, 0x7a4fe22f, 0xf0c13f3c, 0xcf51ca7f,
+       0x9cf522b9, 0x585f4943, 0x673d6d70, 0xff2d7bac, 0x78d758cf, 0xde54ea1f,
+       0xf7bf78df, 0x7fc4aeb9, 0x27e71bbe, 0xae9e79c5, 0x5cfe7fc4, 0x9a19fcf4,
+       0x7940e35e, 0x278a0e3e, 0xa93f7840, 0x959ae46b, 0x52d6f59c, 0x5fa1f65b,
+       0xf670b723, 0xb52d40f9, 0x27833b53, 0xb9fe78ad, 0xf94eaa39, 0xea2fc307,
+       0x0aa56717, 0x55f8e47f, 0x78e3aedd, 0x53b7407d, 0x88ff51dc, 0xaaf8a76e,
+       0x28730bde, 0x370ef48e, 0xc438a7ad, 0xf62d879b, 0xfa154def, 0xdf7c857e,
+       0xfea90f68, 0x857f0415, 0xf251e3ad, 0xe9bf2a49, 0x1c5f10b1, 0xbf2f7f27,
+       0x5c77bfbf, 0xbf683a0b, 0x1d048fe3, 0x7e7d08be, 0x22defebd, 0xe20ca662,
+       0xa917c553, 0x096c4a4f, 0x51fd48be, 0xf54574e6, 0x83ff93c7, 0x0f76cdef,
+       0xae6f7a8c, 0x0f35159e, 0xf21cd8fd, 0x902c6a87, 0x353e91a3, 0xcfc87a25,
+       0xefe3c58b, 0x0e3df9e5, 0x6051b927, 0x7f55d74e, 0x29e4fb1c, 0x7d8bf811,
+       0xc4553dbe, 0x9ec88373, 0x52273ae3, 0x556b6e75, 0xd0e6709f, 0x887e267f,
+       0xbaac63ed, 0x95c3d68c, 0x1e77c4dd, 0xba0ae9bb, 0xe3d2f0e0, 0x686ae7f3,
+       0x4de33dff, 0xfb1c38ff, 0x215f1ec7, 0xfb4d53fa, 0xfadfb1b2, 0x7fa27df8,
+       0xd9bc69a3, 0xb819ec83, 0xf9296e7f, 0x7fbee90b, 0x9b75fa27, 0xd4155b1d,
+       0xa8099503, 0x4cd5b0d7, 0xf7a6140a, 0x2ddbc7c5, 0xc0915f68, 0x175e6cc8,
+       0x156ec0d2, 0xc26574f1, 0x13d920d0, 0x13abd8ad, 0x0c132ade, 0x9264777a,
+       0x09da879d, 0xdd9d7151, 0xfbe1ef82, 0x0bff3665, 0xc9c26f82, 0x87a5ea3a,
+       0x200d960e, 0xea9138fe, 0xede43c64, 0x7d26ea9b, 0x21edf085, 0x01fffefb,
+       0xf078e6be, 0x3ec59ad5, 0x2579f59d, 0x86f38f64, 0x3e947921, 0x3a6a15fa,
+       0x21084f3f, 0xeebfb0ef, 0xb1fe5375, 0x90f165c6, 0xf2427eff, 0x35b6f5ef,
+       0xdaa18f32, 0x29a91f05, 0xb17bf5a6, 0xcff25b7d, 0x6a2fb919, 0x910ba1be,
+       0x33d9c03f, 0xe8815174, 0x6aa87f13, 0xe1f90f61, 0xe490ff3d, 0x83f9f8a1,
+       0x183f8144, 0x8fd1f3d2, 0x777bf9f1, 0xf1b679e7, 0x65a78173, 0x0e9aecc1,
+       0x06b38fec, 0xe3fca06f, 0x47ff34a1, 0xad3b8784, 0x87cc91c1, 0xb449f58e,
+       0x8e05e28f, 0x0ff88c53, 0x32dd3ce3, 0x705c7fbc, 0x46c1fded, 0x64e96576,
+       0x7f637781, 0xe88db1c4, 0xf124def1, 0xe10780dc, 0x303e26e8, 0x0785eae0,
+       0x8f393886, 0xd4ff2200, 0x2e8be325, 0xa7ec8f5a, 0xdc7910ea, 0xff38983f,
+       0x8ac24552, 0x4de77dfd, 0x791a0f1c, 0xfb1022e0, 0x49b53e4d, 0xf803e065,
+       0x96a2513b, 0xcb5c695e, 0x7684fdf1, 0xf6fe262d, 0x2a9d3db2, 0xd5a9bfdf,
+       0xf6a0e25f, 0x5379e8fd, 0x093f1c65, 0x59c52a82, 0xc6623b93, 0x467fe71b,
+       0x18bd4feb, 0x4d293cfd, 0x3041c3da, 0xb24f3228, 0x974dc641, 0x10a7664f,
+       0x2b186b1f, 0x8b0f48a8, 0xd4a4c2ae, 0xb0d33d3e, 0x4959e711, 0x2db8da9f,
+       0x8fbceb38, 0x88dc69f6, 0xf49a3f0c, 0x435b9baa, 0xc2ce0aee, 0x623630bd,
+       0x0617291f, 0x2fbf2f1e, 0x23ae38f0, 0xb0d397e7, 0x43356e6f, 0xc3c3ef50,
+       0x0c2f8914, 0xbbfe38df, 0xf6c1d17c, 0x62db626b, 0xead9e495, 0x711e8136,
+       0x113d04be, 0x6c7d08f4, 0xea8d49cf, 0xb59e92ab, 0xca7ed109, 0x924fb978,
+       0x7ad45067, 0xd062bf86, 0xacea50f3, 0xc663f256, 0xdfb1563b, 0x3b293292,
+       0x93a2fd6a, 0x042ef8d1, 0x63e2979f, 0x71c087cf, 0x5ab3c4c0, 0x29327f94,
+       0x63f983bc, 0xcfd187d2, 0xee8f9ca7, 0xfcc9a697, 0xaedd2c56, 0xfb184f85,
+       0x7fe969cb, 0xde5d3e3f, 0xcda67c68, 0x8667c689, 0x039f1a2f, 0x6be34596,
+       0x1f1a3fa0, 0x898d5783, 0x7d61bf1a, 0xd87f5461, 0xcd44a70f, 0x198342cf,
+       0x75be1fd9, 0x91fcd45e, 0xf545163b, 0x67753f47, 0xe0dcfcd4, 0xbcf1a88a,
+       0x2efe6bdd, 0x368417fa, 0x3427cd44, 0xfe87be9b, 0x4bfe3637, 0x53ff7ed4,
+       0xa18daff4, 0xe7d256ff, 0xa85e8813, 0xecfb0b37, 0xa425b919, 0x6f4d5d3f,
+       0x9b79437c, 0xf9ceb140, 0xf03cc0aa, 0x2fd8e0d4, 0x7a429f54, 0xdaa2306e,
+       0xd6a37a84, 0x1ec8ab04, 0x71326a3c, 0xf390d31e, 0x3f84d317, 0xc89a62f2,
+       0x7b78197b, 0xd922ed1a, 0x43ea5541, 0x248efa73, 0x935453f2, 0xfec9da09,
+       0x1fd61e69, 0xbe101ce7, 0x0755f719, 0x4ac5e701, 0x982d2792, 0xbea8fc88,
+       0xa9fc72a9, 0x8e83f20e, 0xe4e6a4f6, 0x9f8453ce, 0x4e9b0e2b, 0xfaa6ab7c,
+       0xf0df6403, 0xa1e7a19c, 0xdef39fbf, 0xf1495846, 0xe65fd196, 0xe699bf5e,
+       0xe67bbb2f, 0x7b7f8a48, 0xacaddf9f, 0x43a08d2c, 0xc51739e4, 0xa40eabf1,
+       0xd867fb09, 0xdc7ec313, 0x3a6bd569, 0x538c3ed0, 0xbb407d85, 0xf10d2071,
+       0x88f281f1, 0x0169f859, 0xed1f9d33, 0xb827df2a, 0x80df21d0, 0xdd9f4a6d,
+       0xe643bfd2, 0xda3b20fa, 0x00937d6f, 0xf74438a3, 0x1de33df0, 0x955dfe86,
+       0xecbbf8cb, 0xf97f9e88, 0xaf02e1fe, 0x90f620f7, 0xe22ce70e, 0x17fc063c,
+       0x42fe5ea5, 0xd24ee5ea, 0xebf911c7, 0x2676bb55, 0x2e7e7f91, 0xc6e3f847,
+       0x3a49dff3, 0xe54d2eff, 0x9dddaff3, 0x047cfeb0, 0xae422ade, 0xe3557ea8,
+       0xf991f5c0, 0x39c6b5cd, 0xe7468afc, 0xa8e52758, 0xf923b5a2, 0xfe7f604e,
+       0xb75c34c3, 0x7b95d772, 0xa6fbd00e, 0x67614c9e, 0xd2dfbc03, 0x82e380f7,
+       0x28817fa5, 0xcd33b6bf, 0xa67570cc, 0x09613889, 0xbbe44e36, 0xb803e825,
+       0xda637da8, 0x7c3fe22c, 0xbfb0561e, 0xa4cc15a0, 0xb3fa16bf, 0x33f484cc,
+       0x3f6779e0, 0x69cfed1e, 0x1b73ef3a, 0xfb7ef8f8, 0x922a7bdd, 0xd6340fd8,
+       0x8141d633, 0x3def3f20, 0x499cc057, 0x0ae99f79, 0x9fb817fb, 0xeefb9e8d,
+       0xec99bc1e, 0xbbdfb1b0, 0x0ef4bfe0, 0xf022c5f2, 0xfac6baf0, 0x1134d740,
+       0x4b03f97a, 0x44ed1d2f, 0xa66d0dbf, 0x3685e530, 0xbdf2b39c, 0xcf75774a,
+       0x9c230fcb, 0x66f9af1f, 0x7f7082bf, 0xbfe7bcb4, 0x3bf3e00e, 0x4741529e,
+       0xfdd9f1be, 0xbc447a5a, 0x2bfeee79, 0xafe86f2c, 0x2924ff3c, 0x1eac97a5,
+       0xd60f9392, 0x322a34bc, 0x9f4e485e, 0xf74e9099, 0xe2d2933b, 0xc6c46fde,
+       0x3f886ba5, 0xf6757e59, 0x5cbe0d4b, 0xc372f92d, 0xf9f9a30b, 0xf3dea486,
+       0x2af3fe88, 0x3436c1e7, 0xf1af395b, 0x3587e48e, 0x31337e2f, 0x8f57cf32,
+       0xa95ba97c, 0xf74b7275, 0x09fa3aa6, 0x1e5e4efb, 0xeaab71cb, 0x1e73a2cf,
+       0x3269fabe, 0xf9bdf7f5, 0x6e079f2d, 0xbbf83ebb, 0x78917911, 0x79ea4aae,
+       0xc54af497, 0xf94eab01, 0xb90392ac, 0x7ec2ee27, 0x1fea2b65, 0x5725cf3c,
+       0x29a7b1c7, 0x00a83b1e, 0xc32ab7e5, 0x2be4ac09, 0xe520941b, 0xee34d6c3,
+       0xfb1832dd, 0x1616ea6b, 0x2556bb11, 0x59567d0b, 0xb13704af, 0xe9873e1f,
+       0xa365285c, 0xbfee50e4, 0xd778e3e5, 0x85feb171, 0x3cf6b08d, 0xf55d9dc6,
+       0x38205e5f, 0x395a35d6, 0x292176cf, 0xfb8c196c, 0x84abda5e, 0xdc9f7a02,
+       0x1c44b976, 0x98f42ab6, 0xf55df685, 0xe411c2dc, 0x381d7636, 0xb93d216d,
+       0x59b1e1aa, 0x309179f2, 0x8b9641ff, 0x9595bbb5, 0xd5ac7991, 0xa4420ee8,
+       0x02f842fd, 0x40eafb13, 0x2cfa494e, 0x435e1a6b, 0xb6bd42e8, 0xf58569ff,
+       0x97e242da, 0xf9ef0e0f, 0xdf686fdd, 0x923dff83, 0x7d745ff1, 0x805f07f8,
+       0xb94a8bfd, 0x633c5c0f, 0xb2b2f8a1, 0xde217cc1, 0xba6352fd, 0xcfda1eef,
+       0xfd638f88, 0x10162dee, 0x10d93ff7, 0x82ec9e7c, 0x1cb2c7a3, 0x9a57f9e1,
+       0xce68f080, 0xec0acb1e, 0xc8ce48db, 0xc11db85e, 0xbef57178, 0x84f18d74,
+       0x78fac4b1, 0x3921a0f7, 0x5877a25e, 0xe9579f28, 0x5f10b4ee, 0x173f8657,
+       0x9f8dfff7, 0x89c6f2cc, 0x574e5fb7, 0x273f33a4, 0x6437de4a, 0x30b9618c,
+       0x90c3daf7, 0x60bee58d, 0xa9d90f45, 0x3b91070d, 0xbfb7a214, 0xec0ee087,
+       0x7ce9d04f, 0x9f3e0725, 0xcfb111d8, 0xf47ca51f, 0xf95e59e6, 0xf099ac64,
+       0xb193efb9, 0xf3df525a, 0xaac74cae, 0x97997978, 0xdedd85d3, 0x18bbec9c,
+       0x9e09072d, 0xd95bee30, 0x147be764, 0x2d2d8394, 0x70729145, 0xc45daac7,
+       0x07aa4de7, 0x1b2a0225, 0x79abfa17, 0xc887927e, 0x0cce36a3, 0x4eaa1f10,
+       0xfc27f31f, 0x289bf715, 0xff508fef, 0x3ff74dcd, 0x39ac724d, 0x1e646560,
+       0xf1d4d2a4, 0xe88516ab, 0xa26bc3ba, 0xf5810afd, 0x75f0ea96, 0x94553c70,
+       0x7bdc53a9, 0x202cc274, 0x59bcfd3c, 0x39afbce1, 0x8b35bfd5, 0xe55c7be8,
+       0x2fa396f9, 0xbbbee804, 0x11141c6b, 0x7f79c67c, 0x2a0c2e3e, 0x00b9b3ae,
+       0xe6edb43c, 0xc4dd4b83, 0x38cf3fbf, 0xdd867ec6, 0x2bd20213, 0x503fe835,
+       0x1f9ec7de, 0x093ad30a, 0x1522be39, 0xee9359f7, 0x58b4be64, 0x27ca1efd,
+       0x36fb203d, 0xe08ab7cd, 0x8a27a5b3, 0xf5c87bf8, 0x48baf9e5, 0x6f74cdfe,
+       0x4b7ce7e9, 0x69f05997, 0x71c00dd7, 0x4cfcd722, 0xe32f21a6, 0xb83b06cd,
+       0xd6546aad, 0x44d7da46, 0x79e8dbf0, 0x1ea5c1d7, 0x2d9cdf82, 0x91333df9,
+       0xff7622e5, 0xa99f888f, 0x62b4c0ce, 0x99e1166b, 0x9ff7a6f0, 0x7be4a1f7,
+       0xf9a01f03, 0x115e4873, 0xfcbc6f54, 0xf8bd3f92, 0x7375d12c, 0x95c72faa,
+       0xc2bcd7cf, 0xc6277629, 0xff9c3b95, 0x31b7c901, 0x89f095bf, 0xfcd16fef,
+       0x51efc236, 0xc5b35f89, 0xfe593ba7, 0xdfed3a7d, 0xf141be7b, 0x3c8df7cf,
+       0xff6c96df, 0xcfef9ef7, 0x54e67cf2, 0x2f5a37e4, 0x399e7819, 0xfe201839,
+       0xa2824dab, 0xa8f8f84d, 0xe49b966b, 0x6f91cb6e, 0xd7bc9286, 0x40dc7926,
+       0x9be6b179, 0x6fdc9196, 0xf3277419, 0xe42f17ff, 0xfb11aa16, 0x7f17a724,
+       0x2f3be745, 0xe2c5b1cf, 0x7c73a1cf, 0x9c69cf2c, 0xefba496b, 0xf911e92f,
+       0x7e921826, 0xd7b3fc5d, 0x7194d7b8, 0x61da479e, 0x8f38f38c, 0x5c890dd8,
+       0xfa57b67f, 0x98f81ae1, 0xd1e0ec7f, 0xc2f2bfd9, 0xa92baa09, 0x36c13169,
+       0xb5253e3a, 0x92fdee22, 0x0c119355, 0xb2186d7a, 0x8d3435d3, 0x39d89f3b,
+       0x3ee116af, 0xf8550108, 0x0cf9d169, 0x255e2af0, 0xdaf18f32, 0x63cbeb9a,
+       0x21afe33c, 0x63cd8d79, 0x969b0e4c, 0x23ae525b, 0xbcdaf19f, 0xd18cf9b8,
+       0x5171d119, 0xc0ce8641, 0x7f047285, 0x4189c286, 0xf1833791, 0x26eabf94,
+       0x9fe3855b, 0xde5999e3, 0x9b1cae95, 0x13e0ed0b, 0x3adb6c4f, 0x8470e50d,
+       0x6bf503c0, 0xf1f5c988, 0xe6f507ec, 0xc31b5e47, 0x3dea387e, 0x4e02f395,
+       0x1d0c4b09, 0x137fd08b, 0x2a27a541, 0xf63e12bf, 0xdbf1326d, 0x2dfd549e,
+       0x9b4f4fa2, 0x092875ca, 0x15c5875a, 0x900eee47, 0xe076807f, 0x3e84339f,
+       0x7b8a35b7, 0x65ee9b4b, 0x74e0993d, 0xe423538e, 0xd8432f24, 0x1f638aa5,
+       0x2ca0b50c, 0x4c9d325d, 0xd7f5c7ce, 0xa64fafed, 0x73dade34, 0xd2a44f6f,
+       0xff353b9f, 0xff3c0c82, 0x51aeca17, 0xb75bf236, 0x7e12c706, 0xae6ce142,
+       0x20d02ccf, 0x87f615a0, 0x3c29eaa7, 0x9504ba14, 0x5b71a54f, 0x257e34d0,
+       0x58555ff1, 0x30f6979c, 0x6dcc8aa3, 0xd5dfb854, 0xeb4a9358, 0x79b6fd55,
+       0x97afe910, 0xf39f8432, 0xf13cd5e2, 0xcd1a06be, 0x25c33fbf, 0xa2682a99,
+       0x324be37c, 0x5575d94f, 0xfec679e5, 0x55338d05, 0x7e41f227, 0xce11c778,
+       0x7559368b, 0x73c26fa2, 0x94d1f020, 0xd5687ec0, 0x7640d9e1, 0x1e05dbaf,
+       0x24f7c705, 0xfc447cf6, 0xd56cd3d0, 0xc1373ee9, 0x715203b9, 0x1eb23dfd,
+       0xb619172c, 0xdcf7d1de, 0xe9a12fd8, 0x24439497, 0xe57be0be, 0x4c076d04,
+       0x3be24477, 0xc959d849, 0xc3127b57, 0xe967ba26, 0x59efdf41, 0x4e0fab86,
+       0x380d7de0, 0xec0ed973, 0xf85cf4b1, 0xe5c33a71, 0x05c83e24, 0x8d342701,
+       0x26af49d6, 0x8e7cbd38, 0x09eea704, 0xaae1fd28, 0x208e8b1a, 0xa4a3cfca,
+       0xc9f4a6cc, 0x5f625577, 0xb0b286df, 0xfca41b27, 0x9d2b6eb7, 0x8547d916,
+       0xfdefa933, 0xf8e278ff, 0x9c21dab6, 0x48a80bff, 0x49b63b7f, 0x214e74a9,
+       0xde122857, 0x0781428c, 0xdbb40baa, 0x7cef78c4, 0x2a4773e4, 0xe79e7fdb,
+       0xf3ed3ab1, 0xf85e58b2, 0x0ff0d17e, 0x17c2521f, 0x76d2466e, 0xc94be63e,
+       0x9a7573c7, 0x875c3c8e, 0x3cb8fef3, 0xfd8c2a34, 0x79ffab16, 0x3f57cfe2,
+       0x80bdb15c, 0xb31eeff4, 0x4ff49ca7, 0xf671e047, 0xeb345fcb, 0x0ee422db,
+       0x7264f486, 0x3ecc61dd, 0x3d36e755, 0xf776fe4e, 0xfba74541, 0xcf736ef4,
+       0xb2bb8250, 0xd50b33e9, 0xfc1d5663, 0xb2ebfd84, 0xda5eff4c, 0x3563526f,
+       0x864dcfd7, 0x873f5c1d, 0x20eb917a, 0x4fa16e43, 0xf51d9f2e, 0x1d04756c,
+       0x06f293de, 0x6461fe3d, 0xbca49abf, 0x1c38a61e, 0x772dfddb, 0xf7f5a70c,
+       0xf180fccb, 0x191c355e, 0x04df784c, 0x3c6b71af, 0x5c6a0eef, 0xaef79cbf,
+       0xc46f5eed, 0xfe52d3fc, 0x56fdcb4f, 0x20dffa67, 0x7cb6d778, 0xc2d2a16a,
+       0xa1a1f3aa, 0x3486f714, 0x4719c53d, 0x6fcaf48f, 0x69553c8c, 0x5f9a163d,
+       0xaf581175, 0x536bbd20, 0xbd2f7e90, 0x396638db, 0x348fdf3e, 0x8b3b2149,
+       0xe3d92af1, 0x60df66fd, 0xcefd5f9a, 0x8f4963d7, 0xf020241d, 0xaf375f7f,
+       0x4378461d, 0x244e2ffe, 0xac0bdb39, 0xcd390cd7, 0xf7c53927, 0x8bff89f3,
+       0x7acb9fa8, 0x7da58f79, 0x7ee5cb1e, 0x225c9013, 0x203cb3ff, 0xdfc93bff,
+       0x3ca277cb, 0x59a3fbf0, 0x9bb4f7ce, 0xa337ecbc, 0xfdc91f5e, 0xdfd4c5e2,
+       0x64ea5ed3, 0x843aa739, 0xf0d79242, 0x04275e11, 0x45f2d740, 0xfd22f80a,
+       0x648cbcff, 0xf1242f71, 0xd8433939, 0x9e8e5083, 0xd873c1e2, 0x3e4a3555,
+       0xe8a5ec22, 0x9a5a7b4b, 0xbf6d97f9, 0x26524698, 0xda5384ed, 0xd678ff49,
+       0x6d28fffb, 0xa7d786d5, 0x73c3a82c, 0xf2a5386e, 0xf71961f8, 0x1c9f2585,
+       0xb21af991, 0xa89a7a1b, 0x13e7a61f, 0xe5f54fb0, 0x4bebbd13, 0x9a4d1cc8,
+       0xb528e3b3, 0x12a17c53, 0x2da6db72, 0x166a3f6b, 0xfc479e62, 0x6e6470d7,
+       0x75e3d51e, 0x0242b39f, 0x6df0d882, 0x222f47cf, 0x8c3e1e1e, 0xa7638ff8,
+       0x7fcc38f0, 0x060d7fe8, 0x6ef1ff77, 0x4091ea45, 0xc7e27cd2, 0xafb506ae,
+       0x2254808f, 0xfddf5363, 0x007b7da4, 0x677fe76d, 0x2267077a, 0xf00ccf3e,
+       0xfa7ddb73, 0xcb124cdb, 0x5c4567fd, 0xe6f160df, 0x6434ff11, 0x871ba863,
+       0x2299ad4f, 0x856453ef, 0x379cf7b8, 0x18390a67, 0x0aed8015, 0x33aaebc7,
+       0xd4bf7488, 0xe82d7aa0, 0xc0845d2f, 0x6fa4a992, 0x01f75e64, 0xfc5e3f90,
+       0x283cfa45, 0xdf900fbb, 0xc1eb7682, 0x11d6c45f, 0x316fd978, 0xeb0058f2,
+       0x2b5fc44d, 0x0ff8149b, 0x67aac5c4, 0x93afe7a2, 0x1babf275, 0x8c1b1d77,
+       0x5cf35d74, 0x2df938cc, 0xe211ff7c, 0x5d5d7878, 0xcdc33d74, 0x197fd299,
+       0x7fc9c30e, 0x3d62be41, 0xd5a0d661, 0x60ac7c8a, 0xf6224314, 0x0be04992,
+       0x67cb2bf5, 0x8a6f61be, 0xb9ea5e85, 0x94a75c04, 0x94743bbb, 0xd4a681ea,
+       0x8f687965, 0x9f189a29, 0xee2598d2, 0x4aa0b4a7, 0xbc930c75, 0x77ec59fe,
+       0xa967bc07, 0xd49564de, 0x5fc4e097, 0xd3c8fbca, 0xddfe92af, 0x9d6c60ea,
+       0x9553c0a8, 0x8219379c, 0xcaefb435, 0x69dea2dd, 0xf9e8eeed, 0xeb4f1255,
+       0x8c7d3a9e, 0xa11585d2, 0xa7897198, 0x3a98c6aa, 0xdc38b116, 0xadef299f,
+       0xf5fb7d64, 0xd1fc5bd6, 0xb78dfc2c, 0xf8c63ae5, 0xef914ce6, 0x1063c4ad,
+       0xd505d77d, 0x2ad1f120, 0xfc2c9025, 0xc72c705e, 0xb067ddf3, 0xbdcfac81,
+       0x3ee9e25f, 0x7e7c3fc9, 0x19e2bf7c, 0xfdc57df1, 0x7f868b3f, 0x832cf80d,
+       0x0d83f9f1, 0xde50b03f, 0x56df9631, 0xffd999d5, 0x13f1235d, 0x7a6b5fcb,
+       0x858767f9, 0x7f2c5bec, 0x6b95fa55, 0xf6fc2fc0, 0x0df85bff, 0xcb91af3a,
+       0x398735ac, 0x09f6b53f, 0xabf943c5, 0xf7ab9d6b, 0x7f7cf23c, 0x359eb9ef,
+       0xc6063de8, 0xa4e7bd30, 0x63bd175d, 0x96bdedfd, 0xe726bcde, 0x66b72f05,
+       0xe0dd3e73, 0x6675d8ab, 0xf67dbf49, 0xbd7fc253, 0x276258d4, 0xa4fba3ff,
+       0x9ce8a3c9, 0xc02e4caf, 0x566f8ff3, 0xee91fc81, 0x033be1a6, 0xa9e17f08,
+       0x5f94c5a2, 0xed0a7f1f, 0xb707dd13, 0x0257fd16, 0xd27b07df, 0xb667ee48,
+       0xbdfb488d, 0xfb61d783, 0x70b27dde, 0xe9e93967, 0xb445a593, 0x54e382ae,
+       0xed285e9f, 0x42c9f554, 0xbd84477b, 0xc8a64dfa, 0xff716fcf, 0x1b8a51fe,
+       0x7b35ef66, 0xdb323f28, 0x8094dfec, 0xa0be15f0, 0xb771aa78, 0x9e47ed63,
+       0xbe5175a4, 0xf38acd28, 0x8d08e9fe, 0x1851ed57, 0xb2a6eefe, 0x3f643dbc,
+       0xec87aa83, 0x7dd37762, 0x1f920ff9, 0xfe40fcd4, 0x1dfb117d, 0x66fa154b,
+       0xb6660df6, 0xec839dd7, 0xbca72ebf, 0xeb1777a8, 0xfb43ce8d, 0xc37dfc2c,
+       0x78dc051e, 0xa3ee63ce, 0x3a1e132f, 0x50b69c0f, 0x70d25010, 0x4711d2da,
+       0x25ed1b7f, 0x9cc2f30c, 0xe161ddaf, 0x7ffdcdfa, 0x2b79d0b0, 0xf384fb9f,
+       0x7e286b6f, 0x19ef3f20, 0x3a77bf95, 0x85aafcda, 0x4eb2b4f8, 0x91590181,
+       0x271e66e3, 0xcffd4afd, 0x369e84ea, 0xe4857ff8, 0x0dff8377, 0xf5215879,
+       0xe35b7dda, 0xffa1bbf3, 0x96ef041e, 0x03deb841, 0x0eb9cb75, 0xd11d81e9,
+       0xfc5257f3, 0x17cd237a, 0xa9f2befc, 0xbdd5f1e8, 0xfd601e7c, 0xbf47ab1f,
+       0x2e7ff433, 0x5f9f12e4, 0xa618af0e, 0x7d7d3ca1, 0x8830cd7a, 0x293caf93,
+       0x6ec306fd, 0xd89b0e5f, 0xebcec5ee, 0x2162bc6a, 0xfad55b7b, 0x6773f627,
+       0xf4c97d35, 0xe16a6f28, 0xc05bd97a, 0x79f08ebf, 0x49dd934b, 0x877976fe,
+       0x9af303d0, 0x42a0c1ac, 0xa25aa1e3, 0xf161f773, 0x90e049bd, 0x4816fec2,
+       0xe252b8bd, 0xe3c4a575, 0x06e38c4a, 0x8c8c7d53, 0xbc652be3, 0xd7673abe,
+       0xa9292a31, 0xdaebe394, 0x1e13268e, 0x5bd081e7, 0x6f4242f3, 0xec31f419,
+       0x40beac50, 0xd10f770b, 0x95936d77, 0x4be7d6eb, 0x0ebf35bd, 0x5fd296f5,
+       0xb40f747f, 0x7ef1fc8b, 0xddac7701, 0x9e886cad, 0xfc201aef, 0x7fd2cbd8,
+       0x4d101c2e, 0xb01ef297, 0x9e7f7e53, 0xfc827aae, 0xfb46bb56, 0x7e458eb7,
+       0xf55bf5c3, 0xeaf129e1, 0x4df68cb5, 0xfd181719, 0xc3679405, 0x0ee721f9,
+       0xffdc6447, 0x7f84039f, 0x1ab266b3, 0xc446ba20, 0xb30a0b49, 0x7349c6e2,
+       0x8637f409, 0x71b3f7dc, 0x77927191, 0xb7e228d7, 0x2cef757f, 0xaaa6baa7,
+       0xba2fa13a, 0x29bae126, 0xfb03f7e4, 0xd67555d1, 0x5533c520, 0x7dfc2fc8,
+       0xc909f11a, 0x46529363, 0xc671827c, 0x42feb4ed, 0xf3c4eaba, 0xfb446c2f,
+       0x2c2fcb8e, 0xabf992fd, 0x3738846d, 0xbc406de2, 0x3788c3b8, 0xbf0aaf2a,
+       0xa95e78d6, 0x51dc7075, 0xb5ea24d9, 0x337c8e1b, 0xede10b34, 0xd0f3fe6e,
+       0x3e4f54e5, 0x86e7d840, 0x54a7d0e2, 0x1ef5f457, 0xb5ff5c5b, 0xb52bff57,
+       0xe6950f2c, 0x6bf64c8e, 0x791fa20e, 0xb7d1ea13, 0xa538e0bf, 0xbdc248e1,
+       0x5aebcf94, 0xfce61fe1, 0xc3553a1e, 0x3783f626, 0xe4b72d41, 0x8dfa451f,
+       0x4ea29d2b, 0x3f6941e9, 0xf208ffa9, 0x773883f5, 0xf97f6146, 0x8549f437,
+       0x10d5ebe4, 0xe95532d8, 0xa42a07af, 0xdfcdacdc, 0xf6ae85b5, 0x0aa7fd63,
+       0x31184f29, 0xf58cbdb0, 0x8633fe9f, 0x4edfab5f, 0xbbb8ff64, 0xae52754d,
+       0xabfbf119, 0x6227e441, 0x271d905c, 0xe485fb5f, 0x7f794ecf, 0x65493d5c,
+       0x8b2699fc, 0x10b7f0d6, 0xdd37cc8f, 0xb2411da7, 0x5f87796f, 0x583e26cd,
+       0xdefa3bbb, 0xe7e8e889, 0xc8a0b1ba, 0x7cec8547, 0xbf8c6517, 0x31d5f874,
+       0x6fd56fc4, 0xd04a3b7f, 0x96519be7, 0x67c36bf4, 0xe2228ab4, 0xe2229366,
+       0x475afde6, 0x556bc532, 0x645f5507, 0xef41bf3d, 0x813ca597, 0xf503f226,
+       0xabe67403, 0x1fc126ea, 0xe2d166a6, 0x7e444bfe, 0xf7fbccc8, 0xbe462f1b,
+       0x067b1ef9, 0x40f21704, 0xf987b995, 0x89b4eaaf, 0x7d3aa9e1, 0xc4447339,
+       0x775a017b, 0xeabfe900, 0xc4fac075, 0xe76fa40e, 0xd891f7d3, 0x027eff9f,
+       0xb2c761fb, 0xfb8b97b7, 0x7f48152f, 0x9af6fc3d, 0x60f691d1, 0x2f7100e2,
+       0x3707840e, 0x10bf3f79, 0x6c3c4bfb, 0xbf324582, 0xaf79f820, 0x2e309b8c,
+       0x9c40737b, 0xfd7aecb8, 0x2b66eae9, 0xeab9fe50, 0x19d72b03, 0x92bcdd7d,
+       0xeab87ee3, 0x06fa4d1f, 0xa91bfefc, 0xcaf0f87d, 0xebfcf4d1, 0xe46fabc3,
+       0x29b2a97c, 0x2011cf2a, 0x5fe4dcf8, 0x5deef57d, 0x69b67fe4, 0xb6149fec,
+       0xee977d9d, 0x9835f769, 0x8ad1dbf9, 0x067613fd, 0x2aafc892, 0x11df4f9c,
+       0x98d56bed, 0x32dfd0ff, 0xfb3b2bfc, 0xd88aa757, 0x7c75c2bf, 0x4e8b6e41,
+       0xa7bad394, 0x9a688b8a, 0xd7a4e382, 0xe57f93c6, 0x0cb7f3e8, 0xf8933e78,
+       0xe0496eec, 0xd9028bbc, 0x4460cf82, 0x1aebdc14, 0x64ff675e, 0xf51aa35d,
+       0xdef188fd, 0x7b88065f, 0x3e0cef87, 0xe65e290b, 0x5da2bda3, 0x932fb8d7,
+       0x1cd6b1ce, 0xaea93e62, 0x3df18b33, 0x07ba05a2, 0x411fc09a, 0x273f0807,
+       0x65d211e8, 0x8438259e, 0xbdbdfafc, 0x2eb28af7, 0xf5ea2824, 0xf3875a6a,
+       0x5b974c77, 0xb3c7a5f7, 0x9ee92743, 0xe3be1d07, 0x8a1e2259, 0x5badff1d,
+       0x9f8e41e4, 0xf8f1fa13, 0x78e8ff4c, 0xc500327a, 0x48a05f22, 0xef8835fa,
+       0x35e763ed, 0xfe787ad3, 0xc70243dd, 0xf73b8f89, 0x63fdf026, 0x75e44ba7,
+       0x34dbea4b, 0x6d661efa, 0xec813283, 0xf79cdad2, 0xec197bf8, 0x5c9e9117,
+       0xf7c83e1b, 0x7b7515af, 0xc0e37967, 0xec2dddb1, 0x9df93cc3, 0x7cf8ec72,
+       0x3c067e39, 0xdb9e3219, 0x673ef74e, 0xf14ecdca, 0xeef89bdd, 0xd7a956f5,
+       0x6662df17, 0xe80cea3f, 0x227f7166, 0x481639ee, 0xd4ab7dbd, 0x63dfb1f7,
+       0x76fdfa1b, 0x67c2ceb9, 0x73dd3360, 0x7d9f7ec4, 0x170ff4bb, 0xefd79781,
+       0xf4bd5df7, 0xfeff6313, 0xea5b8942, 0x8a3051f5, 0xed087af4, 0xe45bd70d,
+       0x9eddb026, 0xae32305f, 0xa9df41df, 0x753bf2eb, 0x57fa0d6a, 0xf6c7bee7,
+       0xb9cb78f0, 0x86fbf997, 0x1d900973, 0xcfad9ee7, 0xe47a1a1e, 0x79774136,
+       0x14e151ef, 0xbff41a30, 0x645a1184, 0xffa0cd7e, 0xff0e9283, 0x394575c7,
+       0x63e645a0, 0x07fea90e, 0x475419dd, 0x38fec9dd, 0x21ed809e, 0x3ca86b9e,
+       0x846b50d7, 0x7034bb9d, 0xee3e5c79, 0x406a5f3b, 0x6e7493d8, 0xecad725b,
+       0x14845637, 0x22b0eefe, 0x9b7fa20c, 0x51caf9c2, 0xbf5c2d0d, 0xf154a4b1,
+       0x3c5a8578, 0x7c19f04b, 0xfc26c0b4, 0x7a5f8303, 0x88f925f1, 0xb85fc9c6,
+       0xb10bfa55, 0xda1a34fc, 0x4bfad167, 0xea878abd, 0x47c9af36, 0x4ebdc6cb,
+       0xf8b5eee1, 0x4cd2f908, 0x9f96317a, 0x1ffb735e, 0xb775fc25, 0x80525e5f,
+       0xfdcf1feb, 0x4ff1286c, 0xe8e435e5, 0xddbf4945, 0xae71c08e, 0x7597a963,
+       0x8db9f504, 0x5697841d, 0xd3b2bf60, 0x8365bed5, 0x8eb9b7f0, 0xc09c22a0,
+       0x4d15a5f5, 0xad6efe76, 0x713aa1a2, 0x26e3e90c, 0x7ec763d5, 0x52e9c379,
+       0x179423ca, 0x2a973a89, 0xabbba8bb, 0xbbba8bb2, 0xe7fee9b9, 0xeff813dc,
+       0x11d74403, 0xb57e3a58, 0x3ef87be1, 0x9335df56, 0x7fe1370f, 0x4b350f4e,
+       0xbb686cfc, 0xc4863992, 0x887fdd34, 0xfd7eeee0, 0x8a7d0b45, 0xd5e63551,
+       0xd6825459, 0xde79d6ec, 0xb52d752d, 0xe0365694, 0x429dbbb7, 0x43839aef,
+       0xbfcd6fd8, 0xea9b7abe, 0x258c6f83, 0xd2d5d5fb, 0xc112d636, 0x501b9def,
+       0x63a1c76f, 0x1ca49835, 0xca2adc6b, 0x0947e922, 0x3e6aaeb9, 0x8bf9499a,
+       0x7ce7924e, 0x1e49df6a, 0xdec56d81, 0xc923c933, 0x5a2fd99f, 0x4d4bbd63,
+       0xad03cf2a, 0x49edd463, 0x666df091, 0xc4852ef8, 0xa31d003a, 0x8e441716,
+       0xd6bffcd7, 0x3e851707, 0x07d288e8, 0x16429e06, 0x0388efe0, 0xa75cad87,
+       0xae3ff740, 0x036a3a08, 0xc26efd05, 0x76e48a60, 0x0f7bdd32, 0x834f9727,
+       0x41afa9bb, 0xfba54b58, 0xea2ab0e9, 0xbeb086fb, 0xbff7289f, 0x50b70b49,
+       0x7964f03d, 0xda053a5f, 0xe80cde79, 0x4e0bd6e1, 0x18ba0efe, 0xb24edc3c,
+       0x5a53e785, 0xe2143f2b, 0x99c27bef, 0x4d82eb9a, 0x871d6f7e, 0xd3787dde,
+       0x0f8182e0, 0x44d5ee95, 0x79ec533d, 0xfc28186e, 0x42bc9bbc, 0x414b910f,
+       0x2093c0f5, 0xd3f9f7c4, 0xebde43a1, 0x54c73fc7, 0x1ee90b8c, 0x31ba3a6f,
+       0x208f8c89, 0xe7469fcf, 0xa79de351, 0x19933e63, 0x9f049d4a, 0x7d34ce12,
+       0x73febf67, 0x28355374, 0xebefbde5, 0x5171fae9, 0xa7a83ddf, 0xa9f78de9,
+       0x7af1597e, 0x43d9beb9, 0xfc538ddf, 0x7b3ad613, 0xc03659f5, 0x722b8198,
+       0xfbe84e06, 0xc0fc046e, 0xdfb12475, 0x277c448d, 0xfe231702, 0xe751922e,
+       0x48b83bbb, 0x65913aa7, 0x7bfe36e9, 0xa1b6853b, 0x79af29e3, 0x339fcd28,
+       0x7dea8330, 0x62f246eb, 0xfb02705a, 0xecbf92b9, 0x78449de0, 0xf7c6bc50,
+       0xd37cc02b, 0x320bf7fb, 0xb227bf81, 0x3e77c55b, 0x6d1f91db, 0x3a052ca9,
+       0x23c35fd5, 0xd3f93a25, 0x0f365c5b, 0x256c477d, 0x707dedb8, 0x1d44d8d7,
+       0xd44d8d48, 0x72f51879, 0xb1ad78b1, 0x8f4e7919, 0x98f1fd8d, 0x627e90ef,
+       0x7842dff3, 0x98a9287a, 0xde530eff, 0x5cdcd32b, 0x7fbf250f, 0xf03049aa,
+       0xe7e36c50, 0xec94f57d, 0x3d52d667, 0x9359c237, 0x78ff5c01, 0x0a546934,
+       0xb4d565d5, 0x9aee7a89, 0x77eb008c, 0x7d615fb3, 0xd25ad35f, 0xb2e2f64a,
+       0xdd75c2c3, 0x07512e35, 0xd080c81f, 0x3d347af3, 0xa0f419a6, 0x8f594bfb,
+       0x5c65d064, 0x7bd0943a, 0x91dec2e3, 0xdb429384, 0xfdd037cb, 0x7470b8c2,
+       0x69d2197d, 0xf7a9d135, 0xc9cd1e3b, 0x7d061ef5, 0xd9987190, 0x06ee929d,
+       0xdfc69cbd, 0x516af023, 0xa0c08f7f, 0x4144f6e3, 0xe055332f, 0x7577e70c,
+       0x4e96375a, 0x14e11bff, 0x4bb0bac1, 0x00004bb0
 };
 
 static const u32 xsem_int_table_data_e1h[] = {
-       0x00088b1f, 0x00000000, 0x277bff00, 0xa3f0c0cd, 0xa5fd811e, 0x79ba1818,
-       0x8968c550, 0x30327137, 0x303170b0, 0x06710268, 0x2036ded0, 0x17c40edd,
-       0x1022f880, 0x3033719b, 0x11710214, 0xf2032f10, 0x56dcd093, 0x50c0c4c1,
-       0x4035c405, 0x3ac4075c, 0xba0c0c8c, 0x1fdbc48c, 0xf0c0c42f, 0xd7c10c42,
-       0x48606710, 0xff9fa491, 0x54ee1b07, 0xc27dafa1, 0x860c0caa, 0x4662a8ba,
-       0x5d637c68, 0xa09866fc, 0xf1a29bc9, 0x17e8f0cd, 0x87e540b4, 0xe3f2a219,
-       0x7618198c, 0x3709a922, 0x7416efc4, 0xf7a802fc, 0x00031025, 0x22037beb,
-       0x00000368
+       0x00088b1f, 0x00000000, 0x93cbff00, 0x51f86065, 0xd2f9c08f, 0xbcde0c0c,
+       0xc4b462a8, 0x0c0c5c0c, 0x0e5c4041, 0x7b401ac4, 0xdbe9016f, 0xcdce1c40,
+       0xc40110c0, 0x1ff881fb, 0x6207ff10, 0x04d6200d, 0x79405fe2, 0x5b1ba845,
+       0xda181898, 0x8803b880, 0x875880bb, 0x97418191, 0x93fb7891, 0xde181984,
+       0x7af82389, 0xcd0c0c12, 0xfff3f452, 0x5631c360, 0x29efb5f4, 0x174e3ed0,
+       0x19c73f04, 0x505c2498, 0xe0bb70d5, 0x4d078337, 0xcf8d179e, 0x9e7f4787,
+       0x5cbf2a21, 0x4d3f950b, 0x23e18187, 0x2d0a9a92, 0xc7416efc, 0x0c0c468a,
+       0xabc4464a, 0xca8c60df, 0xd081300f, 0xb1adf900, 0x0003a809, 0x00000000
 };
 
 static const u32 xsem_pram_data_e1h[] = {
-       0x00088b1f, 0x00000000, 0x7de5ff00, 0xd5547c09, 0x73b9f8b9, 0xc999dee7,
-       0xac84992c, 0x5d86f12c, 0x48409c04, 0x5876c443, 0x0622b4a4, 0x30a20a97,
-       0x9037d96c, 0xff69f0fa, 0xa5ab0819, 0x68d06a1a, 0x68304ec1, 0x1a0741b0,
-       0x01c04830, 0x6a2be2d4, 0x6d8ad3ec, 0x2c3480c5, 0x0dc46486, 0x3ff2d3de,
-       0xcdce77df, 0x11337bdc, 0xbffbfb6c, 0x4f169fe5, 0xb7fb3dce, 0xe77cef9d,
-       0x92cc5f3b, 0x407e1240, 0xa1f865c8, 0x211318e9, 0x5d245c64, 0x88fdfd6c,
-       0xe5227d53, 0xacc8957f, 0x465a48e0, 0x46dbe42a, 0xb213be45, 0xb16feb12,
-       0x589346b9, 0xc402d348, 0x93df3f45, 0x84592268, 0xf826e7dc, 0x9bce25b3,
-       0x12126426, 0x6f7168de, 0x25dfa74d, 0xd02425c5, 0xb720fd74, 0x4a76805f,
-       0xebc3e412, 0x9a56f725, 0x165f5f27, 0xcad9bda1, 0x27e813da, 0xf87c9089,
-       0xd221107d, 0xe8f89145, 0x024ba4fc, 0x32245ba6, 0x4fce972f, 0x2646df72,
-       0x73f3223a, 0x9392e427, 0x994efbf4, 0x52efd396, 0x37d5ae42, 0x2d7e5232,
-       0xe4fe7011, 0x5fec4aeb, 0xfbb56f1d, 0xd717ab36, 0xdfb517eb, 0x5c17dcbb,
-       0xcb757df0, 0x2d0fd8ed, 0xc39675c1, 0x9e5a14fc, 0xa6265270, 0x3811ff48,
-       0x351c7005, 0x71d0b4af, 0xf08847bf, 0x84ed37ca, 0xb76abbae, 0x5c2858a4,
-       0x4296ef26, 0xd2f9a03f, 0x7900213a, 0x211b01d3, 0x9b9d6e14, 0x94e43e59,
-       0x7cff50bd, 0x2ed3cd3d, 0x8fad2dca, 0xdd7000dc, 0x38ad922d, 0xe609ae4c,
-       0xadc2aedb, 0x6cf3e599, 0x775a5b2c, 0x2fb42e70, 0x1b10b668, 0x6f74afed,
-       0x681b8cfe, 0x4488ff3e, 0xb6e94aa0, 0x9a5f7215, 0x41080c2f, 0x224d77c8,
-       0x8f7fbe38, 0xeb46d818, 0x935ab977, 0x3c70a4ee, 0xca256957, 0x676f3a30,
-       0x141dd26b, 0x9d81450e, 0x515da153, 0x1201e0a3, 0xdb7bbc9a, 0x5db4a9eb,
-       0x63c176e9, 0x6e2970a1, 0x386513b0, 0xfa65c39b, 0x0c49bdaf, 0x2f9680fd,
-       0xe924eba5, 0xa9ead780, 0x37f18444, 0x02338aca, 0xc39573a7, 0xe4896289,
-       0x71d3b74b, 0x17b2bb68, 0xb12c0f04, 0x407c44cc, 0x6d7b9d97, 0xc0719eb3,
-       0x43c856fa, 0xb5aeb09d, 0x0fcbd432, 0x5363dfcc, 0xf2757e60, 0xb45e5a54,
-       0xd3ce4eb9, 0xe1b8bfe0, 0x3558a23a, 0x941daaf3, 0x630fa5ac, 0x89928e7a,
-       0x84453e76, 0x200e8378, 0x533c8083, 0x857d17c3, 0x7177c438, 0x9feba883,
-       0x44909242, 0xe8f7dffa, 0xfe5e14af, 0xab844efd, 0x9ca5b78a, 0x5dbc548e,
-       0xcc43fce0, 0xff6d2ce1, 0xe008fa6a, 0xbaa7ce81, 0x2fe98dd2, 0xad30532b,
-       0x3f1054a9, 0x68fc038f, 0xdbcf81ba, 0x344c8135, 0x5e5d71d3, 0x8b3606e2,
-       0x289dee9f, 0x2e7c7cd1, 0xe3dd27cb, 0x596f9413, 0x2e3e9abf, 0x4f03e6f9,
-       0xbd53226e, 0x979a54e6, 0x87884b7d, 0xd5be6f8e, 0x213c653b, 0xa3df12af,
-       0xe4d17eb0, 0x12bc002b, 0xa5c94c12, 0x50235978, 0xb5e14239, 0xe1491616,
-       0xd29526b0, 0xe3d3c533, 0x233d66f7, 0x09ad7c0a, 0xf67bcf90, 0xa7ec74e1,
-       0x6991fb16, 0xdcae833f, 0x6cdcd24f, 0x73493f5d, 0xea7ed40b, 0xab989fb0,
-       0xb9f1e7eb, 0xccf9fa39, 0x79fb522d, 0xae89ea1e, 0xd2575bab, 0xf9fa09bc,
-       0x7ec12bcc, 0x10f1ef92, 0xaa2fad1f, 0xbd5a43f4, 0x34772d22, 0x98798dc6,
-       0xd268e968, 0x49cfe81e, 0x474b4ab9, 0x3a31d9b1, 0xc6f38a7e, 0xa67df2eb,
-       0x4fd5d5f5, 0x2ba81dcc, 0xc2359e4f, 0x770e9740, 0x0f3c75fb, 0x91597293,
-       0x32bee5ef, 0x7d899dca, 0xfbff38ad, 0xee503afb, 0x1be39fdc, 0x86f3a6e6,
-       0xff8a12b9, 0xf5df65fb, 0x437428ee, 0x149025d7, 0xa4131548, 0x12b5f2c6,
-       0x7ea4db83, 0x413d0f5f, 0xc29b97db, 0xfe68e343, 0x8ff13088, 0x80bfeeb0,
-       0x8b78a530, 0xd4054911, 0x9410b18b, 0xb3d36b7f, 0xe06bf19e, 0xa5006eba,
-       0xefd22117, 0x0297c93a, 0xafe6d8f4, 0xae7d03f0, 0x60532019, 0x54827212,
-       0x6983fc84, 0x297901fb, 0x4c8b7f00, 0x7c7687e5, 0x123f8e99, 0xf1876fc7,
-       0xdf197a3b, 0x375b3032, 0x40ad35be, 0xa655be37, 0x08fe53e3, 0xf1f397fb,
-       0x0872fc29, 0xc72c94f9, 0x05692df1, 0x995afe38, 0x8fc6e814, 0x4bff1ee9,
-       0x186bf718, 0xfaca313f, 0xd7e8e607, 0x5fa4569f, 0x4fd6ccbf, 0xf8f9f856,
-       0x417eb831, 0xa7f5b3f0, 0x5bf5b115, 0xe3ddbf58, 0x2fe1babb, 0x875c740b,
-       0x07facbd0, 0xffafd04d, 0xfafd129a, 0xf77c6c2d, 0x7c7c758a, 0x271f8e07,
-       0xbfeb63ac, 0x97c704a6, 0xd00f3e2d, 0xa62fdc91, 0x69fb0022, 0xc940ca7f,
-       0x98bd0328, 0x84278f0e, 0x93df93ca, 0xfb870881, 0x7ddd1863, 0xcde94319,
-       0x24a79111, 0xee903940, 0xa69c65c3, 0xca271b8b, 0xe3f67f6c, 0x4f98bebe,
-       0x88b35175, 0x2c6a4d74, 0xbe742181, 0x1fa2cd9d, 0x6e6a8bf2, 0x9fb8880c,
-       0x98823d32, 0xffbe0849, 0xada8d375, 0xd31975da, 0x7b52d5c5, 0xbaaf869b,
-       0x3224fbe5, 0xafce82bc, 0x5c608802, 0xe54edf24, 0xf872a134, 0x90c79524,
-       0x5e98969e, 0x71ca8a72, 0x37cb4c32, 0xe25e982b, 0xa70eef27, 0x9f09fff3,
-       0xc199bb7f, 0x10997dbb, 0xb97ff800, 0xf20c8971, 0x9db5716c, 0x8f323d02,
-       0xf0a78e72, 0xf5004b5e, 0x001dba29, 0x5642ee7c, 0x03c3e424, 0x502ebcb7,
-       0xb6bf2d3d, 0x3dddae8f, 0x853ab024, 0x61b85fd6, 0x5d3700fe, 0x96599cff,
-       0x4fec2231, 0x84cfdbc4, 0x99fa4c7c, 0xd59909b2, 0x47ea51b4, 0x92cd7733,
-       0xda69b64e, 0xf3e9f6cf, 0xf9f40a73, 0x9920294e, 0x14299f40, 0xf7ed1d48,
-       0xb97d0ade, 0x2134ce3a, 0x8f95e19e, 0x830a13f7, 0x5ee9fa54, 0x67c0c748,
-       0xae75e237, 0xe755b59b, 0x44a0fe53, 0xb71fb842, 0x7fc41225, 0xb9f3d622,
-       0xf38dbad9, 0xbd592b9d, 0x733e74b9, 0x9e11101f, 0x1db7f9c6, 0xa34d7bb0,
-       0x99fb5a69, 0x5c682404, 0xf3fe718f, 0xe3d71b96, 0x987f6196, 0x677e37ef,
-       0xa7a46274, 0x8f89e6f2, 0x53d0d29d, 0x8f47f069, 0x2bb4d29d, 0xcba9986e,
-       0xeb660617, 0xced7e7ea, 0xae2f95d7, 0x2f95d42e, 0x9744b75c, 0x407fef9f,
-       0xf2de7f57, 0x7bf2ba15, 0xcaebd62b, 0xd46c14e7, 0x9efb67e5, 0x6bbfd5d4,
-       0x5cae9d56, 0x4d785038, 0xdf55ca1b, 0xb7a0a935, 0x4021607e, 0xabbd2a8f,
-       0xea8670fc, 0xa39e902d, 0x2ba40b7a, 0xff294f80, 0xb4b2f69b, 0x6bfceb7c,
-       0xfebd1adc, 0x069154b4, 0x7ba464fc, 0xf48d3c23, 0x45fa7f4d, 0xb4d487db,
-       0x20b92044, 0x7ef8bae7, 0x5ebf7eae, 0x647a7130, 0x7e129de7, 0x95d9289e,
-       0x3bce093a, 0x68687225, 0x7ef7a385, 0x75c05049, 0x13d2d010, 0x5a946f01,
-       0x6e2b7035, 0x679ba418, 0xc71141c7, 0xa5de032f, 0xe4832ff2, 0x0f200b36,
-       0x6ed38742, 0xf1f3051f, 0x4cf905ee, 0xff71139a, 0xf69ca8ed, 0xe00929d8,
-       0x99e98b97, 0xb69859ca, 0x3d30fa57, 0xe9805955, 0x4c0acac9, 0x63972adb,
-       0x8fd2bc7a, 0xd72a5fe9, 0xcaa7fa61, 0x558f4c6a, 0xc7fa62d6, 0x9da600ca,
-       0x554c5e95, 0x9396edba, 0xe56f5cb9, 0x81fa0be7, 0x2d7cade9, 0x15bdfd22,
-       0x0293d1f9, 0xf1c178fc, 0xcbd050e5, 0x48a31c2f, 0x5e1def4e, 0x15e87a46,
-       0x7a8bc4ae, 0xe2805e45, 0x72cf4fb9, 0x93c30c5b, 0x11a644cd, 0x0fd6372a,
-       0x60b3d679, 0x24cde624, 0x3c07da1e, 0xfa519d33, 0xe0147ba5, 0x22784aeb,
-       0x3868f0de, 0xf53fb70f, 0xefd0599f, 0xb640c2f5, 0x71161e5f, 0x67a124bf,
-       0xefaf803c, 0x95e1370a, 0x6f80d30f, 0xf0aa27ce, 0x34234d6b, 0xb1b8225d,
-       0x164d0bff, 0xb6380662, 0x847003d8, 0x19e470bd, 0x4b77ec17, 0x53eac453,
-       0x57877b63, 0xdabd3069, 0x794f59a1, 0xa17f3eb3, 0xcec6985a, 0x1dec4af9,
-       0xdcae80a3, 0x0086a7d5, 0x553053fe, 0x229a59fb, 0xb9ea38e3, 0x21c63496,
-       0x2173d29d, 0xcf67fbd6, 0x227eb7a3, 0x1f2268f3, 0xbb01d853, 0xe5741e5c,
-       0x7c0f4bf3, 0x73973f9b, 0xd22d4f01, 0xc79fb097, 0x07977fd0, 0xcc66bf42,
-       0x0796fdab, 0x7ae5bf45, 0x1ba8def8, 0xd453b68f, 0xebb43733, 0xa4cd5e9d,
-       0x15275d5d, 0xdedc196d, 0xab60dc52, 0x38fdcbd6, 0x39bcbe5d, 0x0fb75ab5,
-       0xef942fc0, 0x06608149, 0x54e129ba, 0xac7665d4, 0x1cfce813, 0x2dfb0526,
-       0x52bd5817, 0x53ec9b6b, 0x415b0c90, 0xad90580f, 0xd7729dd2, 0x3e5ca99f,
-       0x3c897bfb, 0xeedce50c, 0x2547f6a2, 0xfcd13130, 0xd05b9e42, 0xe41d3c54,
-       0x373dd9dd, 0x88b0fea3, 0x10e0bae4, 0xb3aa4053, 0x4f390f40, 0xee80d34c,
-       0xb83f93cf, 0x03ce6ac6, 0xce324c73, 0xfd3ae167, 0x27f5483e, 0x56bf3e5d,
-       0xb723cf9f, 0xe79d0125, 0x202448d5, 0xcbea3f00, 0x7e31366f, 0x6b1527c8,
-       0xc5587f60, 0xdc0b13cf, 0xf28fdcc4, 0x5b4be97b, 0x79d3e6b2, 0xf931302c,
-       0x0bdf9ead, 0x511e99e3, 0xc193ac14, 0xd371f39e, 0x40dc9fd8, 0x0d607da0,
-       0xbbfc31d8, 0xa536cf05, 0xebbefe27, 0x55f38dfc, 0x761e8ff7, 0xd28f3e04,
-       0x881bc106, 0x98548fb2, 0xf8ffbe04, 0xeb097e99, 0x1b99e8d6, 0x435af90c,
-       0xff90debe, 0x812de9bb, 0x61cde8e8, 0x25306df2, 0xfd02fa32, 0x6587304a,
-       0x7fd23fdf, 0x6bfe8f4a, 0xf7fda9ff, 0xe967fda7, 0xa7ffaffa, 0xc7b83ff6,
-       0xfad183fc, 0xc7697d2f, 0x37953f1e, 0x726e2f45, 0x9cffba11, 0x79275735,
-       0xb64bfe28, 0xe2fb46ad, 0x05dfb319, 0x20367cf4, 0x39440b4e, 0x71369f57,
-       0x3af125bb, 0xc0f73804, 0x73ffb4af, 0x067cffcf, 0xdcbe5b9c, 0x3cf1b926,
-       0x590960d3, 0x35969f28, 0xa3274e15, 0xe5827f31, 0x422a7ed7, 0x9f4f59be,
-       0x4a6dcf45, 0xa51bfb02, 0x87efae14, 0xab2a5f50, 0xd854ebff, 0x1849ca7f,
-       0x0ed8ccf9, 0x8f18bfc6, 0x1cbe71f2, 0xce9cb3db, 0x72f0f513, 0xa6f2970e,
-       0xba2a7f9f, 0x69d1fd20, 0x369317b4, 0xed8d93d4, 0x73feb80a, 0x684ce4cc,
-       0xf91eaaa7, 0xc81ef91e, 0x242e154d, 0xf11ff4c0, 0xe1a32da5, 0xff51dafc,
-       0x81a0977b, 0x176fca97, 0xfd7f0b82, 0x5cbbd2b2, 0xb1e7e4ee, 0xb600bb48,
-       0xdeb99a53, 0x12d2c2d6, 0x7b02e429, 0xe49d4969, 0x25cfd3f1, 0xf6799e3b,
-       0x7e4f3829, 0xa10cf160, 0x78ef17fd, 0x34398fed, 0x4a53bc5f, 0x4049ce98,
-       0xa7e08a48, 0x3e5bfe9c, 0xa28f8226, 0x2b26bedf, 0x87f7d8a3, 0x297823e2,
-       0x265079de, 0x63c27aa3, 0xdca0f072, 0x9f8288e6, 0xa0a989e0, 0x7d2f895f,
-       0xcffe0323, 0x7248101e, 0xd678147a, 0x027a86bd, 0xc9f109c0, 0x3f8dd5f1,
-       0x8a72fd43, 0x46eb9017, 0xedeb197c, 0xfa05f2e5, 0xa521fb05, 0x065e17ef,
-       0x2c9ff33b, 0xc143801e, 0x60b9f70b, 0x15cda73d, 0xacb7ce8c, 0xf1d2f24e,
-       0x927f240b, 0xbdf6531b, 0x229fe9e0, 0xf3bfe5fd, 0x7e7624d3, 0x709aa6f3,
-       0xc2a7f2af, 0xbe6f173a, 0x4799d713, 0x0587487c, 0x905cc45b, 0xc9985f97,
-       0xf8519db4, 0xe4c89e64, 0x14ade9e6, 0xa79d74b9, 0x768436e9, 0x81883fd7,
-       0x58bf686d, 0xfc1e4042, 0x9397b554, 0xc2ff98a5, 0x4e35f0ca, 0xaa7ef554,
-       0xb7e969f5, 0xe02b6d7e, 0x6f00dce9, 0xcabdd832, 0xe1cfd989, 0xfda65c21,
-       0x94dcef8a, 0x1444f0cc, 0x476f1673, 0xf0c982f5, 0x4ab7ea1d, 0x5d68db5e,
-       0x3d39723b, 0x3e32fe32, 0x0c779d3e, 0x93a7e7ec, 0xca304148, 0xaa8836fa,
-       0xbafba01c, 0xfc34ce86, 0x7ebff8ce, 0x9577e33d, 0xa73303ff, 0xefe7f941,
-       0x76823e32, 0x79d25fb0, 0xfcb19285, 0xca021de0, 0x45090b07, 0x897af3e3,
-       0xdcbeb9f3, 0xfe742f48, 0x43562166, 0x3c4e3037, 0x5eed01e2, 0xbdb43579,
-       0xb8c2ae56, 0xaafd9eae, 0xe5cf9c7c, 0x9522ddc1, 0xe445d707, 0xe4ccd901,
-       0x977aef40, 0x2258f11f, 0x0a7d9e05, 0xabf297f8, 0x95fe015f, 0x9ffd6172,
-       0xe3fe1e34, 0x3e6f94dd, 0xab7caa09, 0xbe46ab97, 0x2e35d82d, 0xb27edf2a,
-       0xdf3a2321, 0xf951efd2, 0xdbe30376, 0x5572d7ff, 0xa8956385, 0x9caaab97,
-       0x469e0dec, 0x2a269939, 0x9ca35708, 0x92ef3fa4, 0xa8f49eac, 0x7f4aa1d2,
-       0xbd29bf45, 0x3751e406, 0xd874aa9d, 0x1d2aa74d, 0xe89fb0f6, 0xbf2c68e0,
-       0xd2826819, 0xf7deee4b, 0x78a3f6a6, 0xf761692d, 0xebddb450, 0xf2f0a790,
-       0xaa4736e2, 0xa097ef5f, 0xf90c07cd, 0xd7bea1a0, 0xd435cf90, 0x15f219f7,
-       0x6601fa86, 0x2c3e683f, 0x9087a413, 0x92b4beae, 0xb7609df8, 0xdda22fdb,
-       0x79ce8bae, 0xd5df6d0d, 0x53f01e98, 0xc6dab0f9, 0x44e18fce, 0xb3c80d79,
-       0x15d8772e, 0xd31b790f, 0xc372bb7b, 0xfe8d38ae, 0x4445a278, 0x2016dc79,
-       0x8cf6b4d3, 0x21545f08, 0x6f48dafe, 0xd90ecce5, 0x77eec315, 0x691d126f,
-       0x59dce1cb, 0x19287a2d, 0xee2b4590, 0xba898172, 0xadd065ab, 0xc5f7e8b3,
-       0x5aec886f, 0xa735efc4, 0x670dce6a, 0x09f1ff88, 0x6d97dc02, 0x6c2ffc40,
-       0x4588e761, 0x73d3a21b, 0xe7976f11, 0xdc832658, 0x49fffaa4, 0xed559dad,
-       0xe1b360a7, 0x9ccdcb7b, 0x3cf1abee, 0x2faf5457, 0xd0f3f1f7, 0x647e5549,
-       0x1f940c90, 0xf381d070, 0x37bb9738, 0x9d6f2389, 0x75d0f145, 0x37402444,
-       0xc4445a17, 0x764685c3, 0x89fc495f, 0x24653fc8, 0x854ef28c, 0xc7f00757,
-       0x50e5deb0, 0xb30feec7, 0x4a55a41e, 0xf479fcf6, 0xb1da68af, 0xfba183e7,
-       0xfbd2ff20, 0x3d267f69, 0x603e4feb, 0xd76e3b43, 0xbbde2701, 0x337fed74,
-       0xefc841ed, 0xbef078b5, 0xa357c0f9, 0x56ba8e81, 0x8e400a5a, 0xf7600d75,
-       0xbffb55f4, 0xfb86dd1a, 0x9fc42ae7, 0x5fceccd3, 0xf3fe5a17, 0x5fb3dc38,
-       0x02aba168, 0x1d80e0fd, 0x2fe5e1ed, 0xd08ed0db, 0x2cabffb5, 0xb79fe39f,
-       0xbf7e329e, 0xb324e5d2, 0xe2fcc176, 0x7cba5d98, 0x5667f8df, 0xd373fdc0,
-       0x2d217941, 0x37cafc9f, 0x763e41a3, 0x4f7a62ed, 0x34f6d4a7, 0xaca41fdc,
-       0xa242b4ba, 0xe604ee70, 0xf94f4be8, 0xf92672ab, 0xcb834647, 0xb91f6837,
-       0xff5c785a, 0x021e063f, 0xb49623de, 0x01560338, 0xf8e97dd6, 0x1c1e419f,
-       0xaa5d20b0, 0xb824fdeb, 0x2b91f502, 0xac067bad, 0xd37ff13b, 0xd5d085ba,
-       0xbff4bbac, 0xe33fbe39, 0x0f91a8fb, 0xfef9d27a, 0xc3bf31fb, 0x5ef9c1e9,
-       0xe2ffbd25, 0x77de1b7f, 0xaebbbc51, 0xffc6eebc, 0x1deeebe6, 0xe5cc6fef,
-       0xfdc37778, 0xdf2bf97b, 0xabbefce0, 0x3ffa3b9c, 0xbeaafd74, 0xf2933bfe,
-       0x3fad066e, 0x403b548d, 0xe951f8b1, 0x683237a1, 0x1ffaefe9, 0x4ef9838e,
-       0xc635f7e2, 0x66637df9, 0x7049bee7, 0x25c7436f, 0xef3f0271, 0x3f5273b1,
-       0x5bf45fae, 0x487a8796, 0x40bffebf, 0x9598827d, 0xfc0fb81a, 0x0f42da5d,
-       0x319036fa, 0x77907cc7, 0xfaf3c8df, 0x04afe2f3, 0xcaab85e2, 0x1f37697e,
-       0x7fb53d01, 0x58f5117f, 0xfafea29a, 0xfb1a6baa, 0xceeb225e, 0xf4523f33,
-       0x09a99be7, 0x14d073fa, 0x844ddfde, 0x8726ffcd, 0x38500810, 0x58f01a4c,
-       0x2743d802, 0x4088910d, 0x6f8953f3, 0xa61b9c15, 0x7dfdf438, 0xe3c4f700,
-       0xb7cc7022, 0x7f022dee, 0xc047ab3e, 0x987586fe, 0x33589e50, 0xe183a405,
-       0xbfcc66b5, 0x038f7263, 0xe1b8cf38, 0x201e4fa5, 0xcaf55760, 0x65cba14c,
-       0x2faff1f6, 0x05909e5f, 0x03f66fe7, 0x50b778fe, 0x66d17d7d, 0xeba18a12,
-       0xfe266c5d, 0x8bb078d8, 0xcea4e40a, 0xc3cfaa2e, 0x2293f7cf, 0x7ea95cfd,
-       0xcff8746f, 0x74a25f4e, 0x2108727f, 0xfbc5217b, 0x53cf662e, 0x6bdf57cf,
-       0x3f2af061, 0xd903024a, 0xab98b8bd, 0x2c5a3fb9, 0xe97bba31, 0xc2c6bb2f,
-       0xd76266b9, 0x8fc658c8, 0x904fcc99, 0x881797eb, 0x0071eb12, 0xc58a0e3f,
-       0xa223b17b, 0xd9df9a33, 0xfade7e76, 0xd297dc0d, 0x549eabb4, 0x93f7a08b,
-       0xfcf9da30, 0x2db256f5, 0xae427f8a, 0x382ddaa4, 0x988fe8de, 0x367af605,
-       0x34da62fe, 0x8eb78b56, 0xa3cd67e9, 0x7e01e27b, 0x2bee6a4e, 0xc2f851fe,
-       0xbbe00ef9, 0x3536d6dd, 0x2edf0a37, 0x633d9890, 0x784ba1c6, 0x52d11ebe,
-       0x1f3e0267, 0xddd26f51, 0x712dddbb, 0x190c7dfd, 0x719af303, 0x04cce6c8,
-       0x3d111cbc, 0xde57efe0, 0x8beca9f2, 0x84646f72, 0xf60ff427, 0x8dc95ad6,
-       0x8293eee3, 0xfbae010b, 0x9c095bce, 0xd5caf6b7, 0xe9e6d1c5, 0x2e79b0b0,
-       0x46fbc126, 0x83f7ffa7, 0x472ec4ef, 0x579c1268, 0x75f209ea, 0x4823fa4f,
-       0x481a17c7, 0x9c31e400, 0x5c2e406f, 0x1fb82468, 0x02fc9050, 0xdf946bce,
-       0xc73da07f, 0xf9de6b0f, 0xca47d81b, 0x9837045a, 0x6dcccba0, 0xcaedd832,
-       0x9044e39b, 0xea8a19db, 0x751ee90f, 0x6a2f8687, 0xebc23325, 0x39bece70,
-       0x1d67ee30, 0xcd7d8132, 0x05d86afb, 0x96b3ff72, 0xbd07c8b1, 0x95b7ebad,
-       0x048a68a4, 0x6ba410fd, 0x6c8c3d23, 0x6fe5d18c, 0x817d7d10, 0xda5866bf,
-       0xe0a27996, 0x7c66472f, 0x2df2d57a, 0x7c99fff0, 0x6f95577b, 0xc357313e,
-       0xd1992647, 0x25be46bd, 0x4b6f9347, 0xe0192505, 0xa0ff74be, 0xd2ebc064,
-       0x68c4a437, 0x25476df2, 0x917b07bb, 0x3576b1fb, 0xbd76f951, 0x5135be46,
-       0x4fc516f9, 0xf13243a0, 0xf20aedfd, 0xc35ff02d, 0xbe403b7f, 0xbe67a345,
-       0x6df2a83f, 0x9409cb74, 0x4c9ba36f, 0x2fccff3a, 0x84df28af, 0x9f403bc4,
-       0xec79223a, 0x0767e851, 0xe45edfd7, 0x0e30367e, 0xb271b9c8, 0x5abfc71b,
-       0xb5729739, 0x08bfee72, 0x5b9caace, 0x9fa09bba, 0x643a4f6a, 0x5ee96e72,
-       0xa004e72a, 0x96e72647, 0x8ecc27ee, 0xc36f9063, 0x8237c87b, 0xac42cbf5,
-       0xfa73797d, 0xfed0f713, 0x8f2578c6, 0x131fd695, 0xb4e37791, 0x6c9c6ef2,
-       0x90f73846, 0x4eae4777, 0xf2e6edde, 0x81b1ca8e, 0xf48d5f20, 0xfbd169e1,
-       0x7f1beeff, 0xc0b7f1ba, 0x788a6f2f, 0x898ef50f, 0x35bc17dd, 0xd02674fe,
-       0xc99906d7, 0x7b971f5f, 0xec7e959d, 0x6cabf27f, 0xec8da57d, 0x1359413d,
-       0xeacb0fd3, 0x7f4280c5, 0x09739a9d, 0xf70a93ef, 0xe699240b, 0x1faa5a67,
-       0xfd3e8077, 0x3eb8449c, 0x43433d3d, 0x8bb28b0f, 0x655bced1, 0x94256d73,
-       0x8999178f, 0xc5b9ec15, 0x4167a98e, 0x66ce2d9f, 0xfe62dff6, 0x544bf55d,
-       0xf78d33fd, 0x4bcd79e9, 0x7a47ef5e, 0xb0cfabde, 0x78cebc30, 0x1f800846,
-       0xf67bcf61, 0xe285ca00, 0x15f7fd06, 0xc533fd7c, 0x79178436, 0x8b6cf45b,
-       0x8c2b3fc2, 0xe1c23a70, 0x83a2e144, 0x0a884053, 0xe9e98a27, 0xb8114919,
-       0xb6d9be14, 0x85c0ec06, 0x6f780a4f, 0x0ab75c68, 0x55fae337, 0xd176aa38,
-       0x7e5fde62, 0x33be1d4b, 0x8545c231, 0xdd1e11b3, 0xa3c03770, 0xfff6e64a,
-       0xfc16320c, 0xa0dd2858, 0x9bfff19c, 0xb90ffe88, 0xdee88713, 0xf2e7ac43,
-       0xc4f56c7f, 0x3ddd70c9, 0xe182fc13, 0xc976ae3e, 0x37dfe0eb, 0x063298ee,
-       0x721bd3b6, 0x97b83e2c, 0xa30b6edb, 0xf0e9541c, 0xcd874e23, 0xfafbbe1c,
-       0x73c24c56, 0x06e0b361, 0x643ca43d, 0x5396b843, 0x2ad1b47a, 0x72fc9f87,
-       0x1bab872a, 0xf334bbdf, 0xc1e289fd, 0x751fe704, 0xf7b00abf, 0x185b6331,
-       0x181bca5e, 0x1849325e, 0xb565efed, 0xd7442782, 0x04bcd653, 0xf95582fd,
-       0x5a1c7f4c, 0x5fa1453c, 0x25fa3473, 0x8acc9c60, 0xbcc59bec, 0xf54b0cde,
-       0x3f9ec11f, 0x1d47f283, 0xdffd2192, 0x95f7d0b7, 0xf88c45fc, 0x6dc390fa,
-       0x01d5c007, 0xfd330bf0, 0xdf09742b, 0xe5e5a8cd, 0xae0ebf66, 0xc8ba9f93,
-       0xa0bf6fe8, 0x1ba51d80, 0xb4cf406e, 0x370a9c7c, 0x43c067a0, 0xf2117ccb,
-       0x7dde1479, 0x17ae7bd2, 0x7cb4c7ee, 0x04ffb85f, 0xe08b7feb, 0xfdd65121,
-       0x3bfbe99d, 0xfc6f75d2, 0xbe8191fe, 0x8f85b2df, 0xdefa058e, 0x93df202f,
-       0x3dfd3896, 0x4dcecc97, 0x0f946ddb, 0x0de61ee0, 0xe955b3c9, 0x1cc21f29,
-       0x509e70ce, 0x6b927634, 0x57e02161, 0xff4560d8, 0x40c79c30, 0xe56aafa6,
-       0x491b0ef5, 0xf7b323bc, 0xf9c6fffe, 0x497d37ac, 0xf1828fcd, 0xd3368e40,
-       0xc64786f1, 0xaa17ee33, 0xeb4ae01d, 0xb1fe5bb2, 0x7ce3a975, 0x7299ff57,
-       0x28f78ad2, 0xc38d1faa, 0xe0942be4, 0x304d3afc, 0xc2d1fdeb, 0x70ffcf1c,
-       0x2dfcb2ff, 0xab1493fd, 0x4de2fdee, 0x29f883a2, 0x4af33edc, 0xcb542fc8,
-       0xec026f78, 0x3ee8931f, 0x8ecf9348, 0x1eff7b8e, 0x5ef1172c, 0xfb37d6e6,
-       0xd5bdc294, 0x8a67ccad, 0xa0219adc, 0x740ef0fe, 0x70f41e36, 0xf85af12b,
-       0xfb3cb490, 0x7801717b, 0x5f519067, 0x7ca1593d, 0x5021a63d, 0x7267a905,
-       0xc02de138, 0x009144d7, 0x7dbd5abe, 0x7bfec326, 0x06495fdf, 0x9ea8ce98,
-       0x398cfd80, 0x5ea11242, 0x8f11378e, 0x3e9be333, 0x3a76f77f, 0x4547f1bf,
-       0xcdeb428f, 0x0070ec3c, 0x6cdf0d9f, 0x5c0d3e22, 0x0aa04872, 0x4fe347ec,
-       0x79076f79, 0x1ef54050, 0x682ff7f0, 0x4172aba9, 0xed80b37e, 0xa9befdcb,
-       0x1dbf3a2e, 0xbd4e9fb5, 0xad02e40e, 0x6f94dd07, 0xebcaf566, 0xb2b80f05,
-       0x946cb5e6, 0x0bd46e51, 0x476ca0f8, 0xd6562040, 0xfb4ac06f, 0xb699b1dd,
-       0x8bfd84cf, 0xeb7e87b6, 0x76f77d3f, 0x9e743b90, 0xdd91bed8, 0x76d1e6cf,
-       0xfd49f00a, 0x70afec12, 0x5de040b3, 0xdb234142, 0x4a8e0a9f, 0x3a6f281e,
-       0xbbee24f8, 0xa978e9d3, 0x851fb0e9, 0x8efbe0a6, 0xdf1b82b1, 0x43494dd5,
-       0x0b05d5b9, 0x01d60686, 0xe05cbeec, 0x51fe7e79, 0x2d37bff5, 0xcf377fcc,
-       0x43ee42b3, 0x3b2b79fb, 0xf484dd31, 0xfa0ca9f4, 0x6f0a29da, 0x3bf7851f,
-       0x70e17fdc, 0x9b72c7f6, 0x673c7f66, 0xbff48419, 0xfa2279a8, 0xb9262d4b,
-       0x633faf78, 0xdf3bd33c, 0x0016d1be, 0x52dbddbb, 0x3f7c3fb8, 0xbf05a37c,
-       0x7260ee77, 0x1b4073b8, 0x6f4f69da, 0x47bc0896, 0xa22cdaa8, 0x28dd389c,
-       0xb8b5fde1, 0x9db94245, 0x21e983bf, 0x7eb33787, 0xfd30374f, 0x3b96f26d,
-       0x9c3ec2a7, 0xefbd4dbf, 0x3d5a7266, 0x0bb9e687, 0x519bfb75, 0xb872aace,
-       0xa0a3c394, 0x5fef0eba, 0x54b7728d, 0xf20d0fdd, 0x65ee14b6, 0x8435fef1,
-       0x341a547c, 0x983913fa, 0x0d73863c, 0x12e843d0, 0x51d977d2, 0x46b9c089,
-       0x2a63b8f8, 0xec2ce7ac, 0x7c7cb4f7, 0xfb85e08b, 0x966382f0, 0x81e3ea00,
-       0x15fef3f9, 0x2c0f99f6, 0xbfc05044, 0xca83e29d, 0xf84b6ca9, 0xefd18f2f,
-       0x82b1df67, 0x9fa508a7, 0xd57f08f9, 0x1b73342f, 0x7cc8f3f3, 0xde0926a7,
-       0x7d29927f, 0xd7e40e50, 0x91a7c48a, 0xef05671b, 0xfdb377ed, 0xfff5adc1,
-       0xf3ab94cc, 0x6fed9f60, 0xd951f265, 0xddfbe126, 0x447cfcc3, 0xb7e80bcf,
-       0x6377b859, 0x87a1ac92, 0x931bfdc2, 0x6b20e8a8, 0x15447fb8, 0x285bf77f,
-       0x0f0a71b3, 0xcd3aee08, 0x6a3f6a38, 0xd65ef2bf, 0x967ed06e, 0x217fd6f6,
-       0xf9d70fcc, 0xc3720c85, 0xf18f4fd8, 0xfb27e97b, 0xc0d62fdf, 0xb7eced3b,
-       0xce6e7445, 0x20fa78fe, 0x9a80bded, 0x590c7eaa, 0x57889aef, 0xbfecbf03,
-       0x06af10c4, 0x28e34ddf, 0xddfc53ff, 0xb9f4ccd2, 0xe42771a6, 0xbbcc4cd2,
-       0xb8cbdf81, 0x0a6cba3d, 0xca69efbb, 0xf0156778, 0x014cf4ff, 0x7df881e9,
-       0xd4049f72, 0x4ff014df, 0xed64cfce, 0xe07b69f3, 0x1927a6cb, 0xa179529f,
-       0xdb293c80, 0xd62a71bc, 0xe81417af, 0x3e6ea9bf, 0xd90525ea, 0xfaf2c122,
-       0x1527a813, 0x00489f34, 0x5bfca67e, 0xd940fa03, 0xc41b8b04, 0x2a97cab1,
-       0xfdcdbf9f, 0x3dd58989, 0xcbf8fc0a, 0xf0a2a980, 0x709478b7, 0x65f195bd,
-       0xdbe33679, 0xb04877b7, 0x73e1abc2, 0x8f956be4, 0xcce3e045, 0xde1f1f08,
-       0xbe06593c, 0xd0101d3e, 0xc83262ef, 0xedf3e001, 0x31efb702, 0xf96af63d,
-       0x667a4afc, 0xd85fe529, 0x573e552f, 0xcfc8daf9, 0x3bb6e6ad, 0xddf71e60,
-       0x4c75c368, 0x3fdefefe, 0x15e4c7de, 0xfe4dd7de, 0x204903fe, 0xccccf31f,
-       0x6b8547af, 0x81f999a9, 0xcd5798f5, 0x6af5390a, 0xc79867e6, 0x5ede8b46,
-       0xc712d872, 0x25eb9dfc, 0xf12bfba4, 0xbb3e0f67, 0x5abcfe4a, 0x7f12babe,
-       0xfb8be3aa, 0x061cfdf5, 0xd9eb8e20, 0x6385275f, 0x77f1c288, 0x5fa0cf8d,
-       0x4fe7f9d9, 0x143c00cc, 0x0e74a3ef, 0x24e8d5f4, 0xe6739021, 0x455bee00,
-       0xfd17a24d, 0xaca1cd65, 0x3e5a9ddb, 0xc53ffe66, 0x9e913a2f, 0x0259768a,
-       0xa2fb69d3, 0x468f1f3d, 0x61958c3f, 0x3ff24ff4, 0x7f65f5cf, 0x83e068db,
-       0x43f33322, 0x9985ca32, 0x773fa656, 0x82cfb5ec, 0x2c0d09f5, 0xf05140de,
-       0xb9a2c92e, 0x956698a7, 0x2f787ad4, 0x0c74a7e8, 0x7e6131ef, 0xaaee77da,
-       0x76c751ff, 0x9a8a2726, 0x2dc400a5, 0xd9d86a28, 0x45a5fe09, 0xff682cc7,
-       0x14f86f2a, 0xbf27e7fd, 0x2bed03b8, 0xeea2cde5, 0x3f87ad3e, 0xb218835f,
-       0x535a1f80, 0xd1ffde29, 0x07cc09fc, 0x77dcffb9, 0x7e2b37f4, 0x3f1eff71,
-       0x6ff16105, 0x7c81739f, 0xcdbad739, 0x0d7d7e85, 0xdb5feedf, 0xb82f7fc3,
-       0xddeffb9e, 0xb9e09a72, 0xdeffba26, 0x3285f839, 0xbd5683ca, 0xe8691eff,
-       0x9d25fa83, 0x946e5667, 0xfd6e8ffb, 0x4f17c77c, 0xc779ff83, 0x869e4fae,
-       0xedfc9779, 0xafc1a7b3, 0xe1b01c88, 0xfcfe57be, 0xabafe87b, 0x6564dbb6,
-       0xfdb9da74, 0xee77f439, 0x81e2c0fc, 0x9ff73ade, 0xb2ff034e, 0x92979dce,
-       0x6cb99ec0, 0xef684dff, 0x727bb65d, 0x6fb28932, 0x6fd029a8, 0xadfc2ae0,
-       0xdc3b788d, 0x9ffd1874, 0x83bc53ce, 0xcbf6ec1c, 0x7f32960c, 0x63fb8557,
-       0x6ff74636, 0xd97fe1ef, 0x37adfb74, 0x626ffc82, 0xfd15e4fa, 0xf8a5df30,
-       0xf02afebc, 0x6dfdc8d8, 0xab7cb783, 0xf879e61f, 0xc9abe285, 0x9a2fc780,
-       0x29faff16, 0xd3ea6b28, 0xe8661fab, 0xfaa7e02a, 0xdeadfbcf, 0x6fc0ac57,
-       0xfe837ebb, 0xe9bf80af, 0x5f47ec0a, 0x83fbc1a4, 0x2e785233, 0xfde13fec,
-       0x52bf8c16, 0xe47dffb4, 0xefddcea7, 0x709a9da0, 0xd24ef63f, 0x8dfcc3fd,
-       0x7adebe05, 0xe4dff327, 0x4eff0078, 0xb9df85c5, 0x6ba3271f, 0x37b3bfd5,
-       0xacafcebf, 0xfd56ff4c, 0xffeb4bfa, 0x2324fdcc, 0x01b21378, 0xf5be275f,
-       0x070a823d, 0x11cb9737, 0x7ee8e5bf, 0xcb7eddb4, 0x3e01bc06, 0xf6ea9f61,
-       0xfef9a64b, 0xf24ed063, 0xf83f347e, 0xefe63ace, 0xdfe929dc, 0xc4f0468f,
-       0x0d5823df, 0xab81cbfe, 0xd2be5ff3, 0x9c2bbe3a, 0x3452824e, 0x3abc27ae,
-       0xdf2e8ebe, 0x3fc26d13, 0x916d5ef6, 0x931f7c60, 0x7f044b60, 0xcf681390,
-       0xf37f3eec, 0xfb7076f5, 0x22f3c77b, 0x09aebffa, 0x6ef9461e, 0x10651f94,
-       0x7cca2347, 0xbe98d987, 0xf6ccd65e, 0xce5d8e8f, 0xd3f68380, 0xd22f6871,
-       0x09e35975, 0x7bfb4fd9, 0x32b7e1bd, 0x7c62c7bb, 0x4047fb04, 0x178e9eb3,
-       0x7e668e0e, 0x6fdeccda, 0x1f1c671c, 0xfa25bca7, 0x9f8de538, 0xf629c6ea,
-       0xe3b76507, 0x339de3ca, 0xfe82ef7b, 0x3d32b5ce, 0x9c505cf1, 0x587ded16,
-       0xf7e24d8a, 0xa52cd561, 0x25c628fb, 0x2438b271, 0xf5062ba2, 0xecce65ce,
-       0x9009b163, 0x5407e8ca, 0x0dfb82b5, 0x0293ccfd, 0xfe72aef8, 0x577cc098,
-       0xf6357c03, 0x23edc91f, 0x294aafa0, 0x776099b9, 0x391dca30, 0x1a0244c1,
-       0x4e732f7c, 0x5ef0564b, 0xf01fd424, 0xb4e33c79, 0x647efd04, 0x647d5fb0,
-       0xe9926b26, 0x0bf23efc, 0x5fb4159e, 0x03c7f5f2, 0xfb3d9d72, 0x87bef357,
-       0xa9bd9d44, 0x0e3e12cc, 0x8af215e7, 0xc423ef0d, 0xe78c3603, 0x0db4fe50,
-       0xf7787bd7, 0xdea2cf57, 0x610b6bfd, 0x54f443f7, 0xdca47103, 0xbbd38fac,
-       0x3ffa7abf, 0xc686af41, 0xa7fcfc74, 0x4f387d69, 0xfcf1da34, 0x762bb5d3,
-       0xafcfea34, 0xe403383c, 0xd19dbe5a, 0xc98bfe63, 0x5fda2a81, 0xb7cb227b,
-       0xf18018ef, 0x39778a03, 0xf0f11fd1, 0x60ca97ee, 0xd17cea9f, 0xa4066e0e,
-       0xffae15f3, 0x3bc786ff, 0xad1495aa, 0x3121725f, 0x2077da2b, 0xe56790c5,
-       0x7f049ef8, 0x811f38b2, 0x1639ab1d, 0xbd508fdf, 0x79cfd758, 0x07bf7c29,
-       0x97dfd8e9, 0xf5099bbd, 0xac607905, 0x1fff96a7, 0xe5b7931b, 0x11ceda16,
-       0x872e5fa9, 0xbabe58f3, 0xad27932f, 0x2ae7ff58, 0x9ef2f39d, 0xebfab2fd,
-       0xf575036d, 0x3c65f6d4, 0x7e9188de, 0x16fde71f, 0x2c337c37, 0x288d3c5a,
-       0x3fefc7f3, 0x04df8815, 0x1b4ecb7a, 0x778251c6, 0xbf0fe0f8, 0x5ff76647,
-       0xc610ae25, 0xe5c7d933, 0x084c4971, 0xe5f4abe3, 0x90fa80f3, 0x17b6d627,
-       0x2fa5ef00, 0xe7c408d9, 0xe9c57d29, 0xee977c05, 0x57fdaaf9, 0x66efe099,
-       0xe95ebb47, 0x7482ff2b, 0xcd096a50, 0x3b6578c5, 0x99e2042d, 0x237cec75,
-       0x43b5f80d, 0x7fc5a50a, 0x695ebdcb, 0x478862d0, 0x52efe7e0, 0x7de18303,
-       0xb33efabd, 0xd33917a8, 0xdef76365, 0xbdde6cfb, 0x7d77e436, 0x95739edc,
-       0xefb483cd, 0xe8948bb4, 0x9b4df172, 0x69d977f4, 0xa3b8e5bb, 0x37c73bc7,
-       0x49e73e61, 0x2018126b, 0x0e3ea8cb, 0x21a8bcf2, 0x0fd83fbd, 0x77d4d90e,
-       0xec2c4aec, 0x05248747, 0x0687d9cf, 0xfbb5fd28, 0xab4a99cc, 0xaed09662,
-       0xdd576983, 0x097d79a7, 0x66da27f8, 0x1f7b9345, 0x8f08ecd9, 0x1bc5ab22,
-       0x07649ded, 0x02deafdf, 0x1b224063, 0x1d43f817, 0x401490f7, 0x4628bc39,
-       0x0ff4fd61, 0xb8bdf0c8, 0x2d20ef61, 0xd5cd0a1c, 0x29f28f58, 0xd490b3c2,
-       0xf91a99c8, 0xb8578ead, 0xf198a1dc, 0x3ff9ba3d, 0x8c55e9ba, 0xc88d19e0,
-       0x7472789a, 0xb33b45c7, 0x2cc0eefa, 0x7e015ae5, 0x9b75c932, 0x6a952045,
-       0x1218f7e4, 0xd541d4c4, 0xaabf162e, 0x3c9c8082, 0x83471dd3, 0xd7811a60,
-       0xfdf72803, 0x92190803, 0x1286fa0e, 0xefc0d6eb, 0xf385cd92, 0x082b98b1,
-       0xddd31793, 0x7e0a7fa0, 0xe94cb91f, 0x61b2aaa9, 0x40f78b10, 0x0d7ef0bc,
-       0x3f3a5855, 0x4bf5fb97, 0xd5f907a0, 0x27df70b8, 0x620a2a81, 0xbb453370,
-       0xe2c224eb, 0x463bad99, 0xb48fe7b4, 0xffaf8118, 0x0731ca20, 0x6984fc89,
-       0xc82ac41e, 0xbfd8aadb, 0x9cfdc365, 0xa0424dc3, 0x241dda1f, 0x63a9a764,
-       0x969cf9a4, 0x34995dff, 0xf74ba1af, 0x91b97d04, 0x335ca82f, 0xf8441b8c,
-       0x373f7ed1, 0xa1b9fbf4, 0xadbfcfdf, 0xe54e155f, 0x10e941d6, 0x65756087,
-       0x8d8dc390, 0xa370e567, 0x710e19f0, 0xc62988d7, 0x11cdefc3, 0x367c31ae,
-       0xf14fa816, 0x1d26273a, 0xd8f3f4e1, 0xaff06103, 0x04b50925, 0x04abc3ce,
-       0xc922fe35, 0x11da6875, 0x70f915b7, 0x4e671f3d, 0xf577a30c, 0xfacf7c1d,
-       0xe8efbc36, 0x5bd6df51, 0xf5e898fd, 0xc7cdbd9d, 0xdf3e751e, 0xbd94ce55,
-       0x705bfef2, 0x6f2ddb5f, 0xfa9414dc, 0x6273db77, 0x71a5bf68, 0xc36b7fed,
-       0xb46f4c2f, 0x2fe3d7f6, 0xd295e806, 0xfd60cc4f, 0x7bde2377, 0x7cf997a3,
-       0x48ef341d, 0x9bbaeba5, 0x9ea53f8f, 0xb3df77dd, 0xe8e3d98c, 0xf50bcff1,
-       0x77faf0e7, 0xaed1f35b, 0x87e62270, 0x9ee12718, 0xde17a65a, 0xf78890f3,
-       0x08e23dab, 0x7f942fc1, 0x042e5dee, 0xe2d1e942, 0xe3779122, 0xf8f3ff68,
-       0x4338c6f8, 0x5d4ca23e, 0x338b4627, 0x7d4ce8c4, 0x5f8c6587, 0xf2e488b0,
-       0xeffa51f8, 0x933736ed, 0x5c80e687, 0x2fb2323d, 0x3a5237f9, 0xd2927d06,
-       0x8967dc31, 0x712d3dfc, 0xfabfccc9, 0x3c9d788e, 0xb128a0bb, 0xc536bfb8,
-       0x2e1be2eb, 0xc724af1d, 0xf9b5e469, 0xbf175da2, 0xa4f24aa5, 0x2e92bc80,
-       0xca14475e, 0x3ec5f257, 0x5394d144, 0x1999143d, 0xee5136dc, 0x200398a4,
-       0x5ceecce7, 0x6c7a0f92, 0xb54fa31c, 0xa2309cbe, 0x9b7c6f5b, 0x262c7bfe,
-       0xe96cf911, 0xc6192512, 0xeb73da09, 0xcae893e1, 0x3d1cf8f6, 0x83bfc1e9,
-       0xd60abbad, 0x3d73de9d, 0x83c7b255, 0x774e73fa, 0xcc2b1bbc, 0xef28b44f,
-       0xdfbf302b, 0x2aec044b, 0x39e3e13d, 0xbbf0a013, 0x7e87e810, 0xf4ec6221,
-       0xc3afe8a1, 0x1075e4f5, 0xf5ca91cf, 0xe3be3c55, 0xf1cf1e2a, 0x737f1e61,
-       0xa8f38f0d, 0xa9eacfc2, 0xd68238c6, 0xab7facc1, 0xc127e39b, 0x43e3e1c4,
-       0x529ac97d, 0x3684f781, 0xe2084577, 0x74fe9171, 0xbb69809f, 0xb27e11ab,
-       0x927da09b, 0x05bcc7d6, 0x6a9534f2, 0xcc1e2247, 0x4f920aee, 0xfbb61fcb,
-       0xd9b802de, 0x41bc7d14, 0xc340ca4b, 0x9e01b0bd, 0xc93d3d2a, 0xa70262e4,
-       0x127c2327, 0x53df1664, 0xf4dea3a5, 0xcfee2aaa, 0x83d2a9bb, 0x2b8f1569,
-       0x84710555, 0x8f294e20, 0xcfc89423, 0x8e145589, 0xbe09fdf0, 0x6655566f,
-       0x9da67963, 0xa60953ed, 0xc012838a, 0xbb309e25, 0xf49f8267, 0x55cc22cf,
-       0xfc527e14, 0x7abc8144, 0xe7c3588f, 0x7441e9cd, 0xe1710d9b, 0x2f002794,
-       0x26486f35, 0x9715e7b8, 0xd63e4cdf, 0xcb38b3d0, 0x3476071b, 0x6013e1d1,
-       0xe039fbff, 0x2367ce95, 0x59c6179d, 0x9ab0f4e5, 0xa72d7de3, 0xde3cf587,
-       0x5d382fe7, 0x0fd74a3c, 0x7b0f2af9, 0x1a61b037, 0xc84b8bf3, 0x68b8f130,
-       0x3bf5a221, 0x8904f38b, 0x3c89d74c, 0x718a60aa, 0x0b31c8ef, 0x247d8bd2,
-       0x7e508af1, 0x8b0081ec, 0x0a9b9963, 0x1a9c66fb, 0x128272b7, 0xb61f1b37,
-       0x3e3ccc86, 0x1dcec89c, 0x3de351ad, 0x590e7956, 0xdbdefce1, 0xdcce0e7c,
-       0xf6bc6043, 0xd20e8851, 0x7b3b97c7, 0x6a3bcd31, 0x7f4dfea9, 0xda5f1eec,
-       0x5ae7a06a, 0x373f010b, 0xbe7f9d07, 0xf7b1af46, 0xd9080762, 0xa9d8a47f,
-       0x45074b3c, 0x97f7e283, 0x006c83b5, 0x05730a67, 0xa49b1dec, 0x039054dc,
-       0xdba2e29b, 0x4cec626d, 0x8e65765f, 0x8d75d1d0, 0xee76c5e4, 0xf4746309,
-       0x4fe5c35f, 0xdd1c94fc, 0x7cde5577, 0x0bfac31e, 0x30997dda, 0x998ba4af,
-       0xb709bfc8, 0x553f9745, 0x3887ec92, 0x98a35500, 0x94cff3bc, 0x43d59e99,
-       0x7539309e, 0xf8f08c81, 0x86467435, 0xbf07d413, 0xe2eb299c, 0x3e03ae19,
-       0x63710619, 0x02affd19, 0x38a9a07e, 0x89fa4658, 0xf3c26e9f, 0x5fce1aea,
-       0xda7e730f, 0x11e9f9c0, 0xc40b23e0, 0x677c659f, 0xb0e19e26, 0x58b9549f,
-       0xfe012ddc, 0xc5549b4f, 0x7187982c, 0x04598f8e, 0x32a89fb8, 0x4317537b,
-       0x59e2d6be, 0xe31e60a9, 0xed6bfb01, 0xdf7f344a, 0x2ce27d90, 0x6cd7853b,
-       0x6ac7bf8e, 0xacfe22c7, 0xac014f6e, 0xc188eccb, 0x50d57df3, 0x73b4416b,
-       0xb33b74c2, 0x2f78508f, 0x4cfa7e84, 0x873ee9cb, 0x66a19981, 0xfdc21666,
-       0x1d077831, 0xedca7e85, 0xfd218f4c, 0x46b064fd, 0x38f0d40e, 0x93f14471,
-       0xb0791ae1, 0x0254c872, 0x729e9e76, 0xb83917a0, 0x2ac1c98d, 0x062fef81,
-       0xf8f156bc, 0x341caadb, 0xc4a35e03, 0x4d7d5ad7, 0xbe7deeb6, 0xb1b8e5c4,
-       0x3b3b3ade, 0x9e21ad37, 0x59e84fb0, 0x0eb4e14e, 0x3fd914e0, 0xa0e3ba73,
-       0x3aca20fd, 0x0ceff28c, 0x532083ec, 0x338c3ecc, 0x9e5648b2, 0xe5720f18,
-       0x4cbf98df, 0x3a827a6f, 0x42c5fe5e, 0x2ef267dc, 0xbffdc78e, 0x213c76a0,
-       0x2b02ae70, 0xf69de6bd, 0x753fcde9, 0xd74ede01, 0xcdd3fbf2, 0x57fc0052,
-       0x2eaed74e, 0x4db57cc3, 0xfc4c9c01, 0x882e03e5, 0x69e8b2cb, 0xcf53ef11,
-       0xd0d3f8c4, 0xcbebefff, 0x7f8d4597, 0xb5ba8ac4, 0x169f2069, 0xef8b5d6d,
-       0x7bc4ceec, 0xf26ae687, 0xbd415324, 0x96d38d50, 0x0bc58cf7, 0xfb6f5dfa,
-       0xe8e6de52, 0xf82afde7, 0xca5af415, 0x1eb7a02f, 0x4384e574, 0x7e67ff14,
-       0xb27d4369, 0x4277f64a, 0x1dab6abe, 0xf8aa905a, 0x1e3ff1e8, 0x0bb4dfb6,
-       0x76c3c7e4, 0x89483eef, 0xed4bc583, 0xf8ea3e6d, 0x856b60ed, 0x78a7b77b,
-       0xa78a141c, 0x1bbb3a99, 0xe76b77bb, 0xed621476, 0x97863ca5, 0xbb94bd2b,
-       0x710c9f98, 0xe7572f47, 0x1f9f9673, 0x07b56d17, 0x03d14656, 0x84f7f116,
-       0x867df88b, 0xbb672f4a, 0x67462df5, 0x1725ff6a, 0x62f465af, 0xb9e14ba0,
-       0x9f874851, 0x7f70911d, 0x11bb9e11, 0x5d94b4e3, 0x12fd61b4, 0xf828f3d1,
-       0x45b79377, 0xdefbd3a4, 0x59f78718, 0x9078861d, 0x09e983a2, 0xb1779a6a,
-       0xe69fa758, 0xb0ca1605, 0x2c5de79f, 0xf60c7463, 0x93983867, 0x689b5e6f,
-       0x0396f4e6, 0xb4dd2fed, 0x6fcbd692, 0x264ef463, 0xbed0cbf8, 0x3cf76758,
-       0x8a0e451c, 0x3717450e, 0x84adbf34, 0x49f873b5, 0x7ffee682, 0x9e8b8f11,
-       0x45c5917f, 0x493f6e24, 0xf2e73a01, 0xfa9f4229, 0x261db5f8, 0x7ae32f86,
-       0x133af813, 0x437bd7ba, 0x3efdeb2f, 0x0fd72f5b, 0x1bc6dbf2, 0xf1abf5d6,
-       0x5915d6d1, 0x5fac04cf, 0x970de3c2, 0xd5de1898, 0x4c1d1bf2, 0x7b69ab0e,
-       0xa5e22ce5, 0x8f2151fb, 0xb81798ab, 0xcf3e064f, 0x2f171cdb, 0x5f99d668,
-       0xa7e7473b, 0x1f3b5792, 0x6fe570e3, 0xd02f2f9e, 0x9e3755f0, 0x6baf29fc,
-       0x86e374f1, 0x3a57533e, 0xbdca1f60, 0x3ee301d6, 0x65f73a5b, 0xbc32fd02,
-       0xa3fd919d, 0xdd0e502b, 0xcef68ae7, 0xdbc046e5, 0x387ced38, 0xc9fb06de,
-       0xa37bed48, 0x58e3d18b, 0xbe2b6fb6, 0xdbbbee1f, 0x4451649f, 0xd137977a,
-       0xe38469f1, 0x59bf0e2c, 0x8e1c70dd, 0x8657547e, 0x7f3a75e3, 0xc8e15ea9,
-       0x49c2aff1, 0xb0f54efd, 0x18448e99, 0x57f7b097, 0x0aafe3b5, 0x27f1917e,
-       0xa1defaf0, 0xa2fc824f, 0xf4f812f2, 0x1f3fb3ec, 0xb0f76dad, 0x30bde27d,
-       0xbabea90e, 0xd83fb57b, 0xdf50797d, 0x0473c93f, 0xadfe6bce, 0xae8aa7a2,
-       0xa9f630bb, 0x56ae10ce, 0xaeaddfbf, 0x760e186c, 0x20caaad6, 0x40bb54a6,
-       0x8a6a8bbd, 0x685fd01e, 0x78b46f15, 0xbc39eb54, 0x32b65757, 0x4fd5913b,
-       0x240f60dc, 0x99c92f8c, 0x333768b1, 0x837af43b, 0x60dcf92c, 0x7bf993a7,
-       0x5becc967, 0xe7099e97, 0xbf0c84e0, 0x1d6bbe06, 0x4362ffcc, 0xf83f52ca,
-       0x3ec159ed, 0x22ed0839, 0x81767417, 0x9c8bcd57, 0xf0d4ee94, 0xf58331a3,
-       0x904252e5, 0x246e1da0, 0x479daefd, 0x2eceab42, 0xd98b846a, 0x12fbc2ea,
-       0x2ef6e133, 0xeff50f0e, 0x72e5ac64, 0xcddb86b8, 0x197b071e, 0xbb4adf85,
-       0x35a3f70b, 0x39d898d7, 0xf3c66ac3, 0x40f1b835, 0x8fd6397d, 0x7ac1b0eb,
-       0x43f3d044, 0xe4427798, 0x7b43111a, 0x238f9009, 0x3ef9008a, 0xf406b424,
-       0x6d89aed6, 0xd9f7c3f7, 0xe01d5f36, 0xd6d4cbf7, 0x4fd802e3, 0x00c37d73,
-       0x3fa2b5ce, 0x7ff5a143, 0xa033862d, 0x3a2d1a5e, 0x6bd2cf16, 0xa7daafc0,
-       0xf16197b9, 0xb1792340, 0xe59afe67, 0xc53dc366, 0xe5b4c3d7, 0x2d946cfb,
-       0x7bfcf5c6, 0x0b1f0929, 0x74b6ef28, 0xf173c9db, 0x8e51d07d, 0xa00fa44f,
-       0xbf6c23af, 0x625660be, 0x4dfd99e3, 0x67675579, 0x6aaf2ab6, 0xf3f333c6,
-       0x57a53d50, 0x74aba7b0, 0x35ecd832, 0xa90d3d01, 0x74b5dfa6, 0x832f4511,
-       0x72f70671, 0x0fcea11f, 0x3c0007de, 0x6c598bc5, 0xc5d031bf, 0x25fb6ebe,
-       0xb32a7bfb, 0xaf33c255, 0xa238f962, 0xd1fc60fe, 0xe3edba0f, 0xcdde58ab,
-       0xd80be572, 0x05a1dc7d, 0xa6d7e8b1, 0xcb7663ce, 0xc3d056da, 0x2ea4b766,
-       0xd999fb84, 0x0afeebd6, 0x7c293ee9, 0xe2720ec8, 0xe79e2ca7, 0x2abdefdd,
-       0xfbba69d9, 0xdef8addd, 0xcfdf34fa, 0x04b092e6, 0xb711f7f8, 0x01ebeccc,
-       0xc405d3e4, 0x0941f3c3, 0x84f7bdce, 0x42de7702, 0x1abef773, 0x628e05b8,
-       0x5f848f73, 0x82f97403, 0xc368a9ee, 0x7b35db56, 0xd679675e, 0x66fd7bae,
-       0xb227ae2b, 0x5fae2b5e, 0xf6441f5d, 0xb8eef2c4, 0x912e2cc0, 0x0b498f0a,
-       0xdb67bad9, 0x7c98fce7, 0xdb39de8b, 0xccafea3a, 0xc7cd887f, 0xa1cf9f08,
-       0x4ec5ca88, 0xa4e4d787, 0xe1d0ffeb, 0x5eb49d15, 0x669c3589, 0x62fc881e,
-       0xe8997c81, 0xae8926bb, 0xdf00fcff, 0x438044b0, 0xd2ab9f6b, 0xf4e4df2f,
-       0xefa726fd, 0xe3bbd337, 0x1ea02718, 0xae024f7d, 0xb3a7066b, 0x47dfbb35,
-       0x6ff3cc3f, 0xa54b78b0, 0x83eb72a2, 0x49133768, 0x6aac38b4, 0xdfb726fa,
-       0x0e954e28, 0x0dce3c03, 0x4d1997e3, 0x9fbbf476, 0xf4ea2991, 0x029919f0,
-       0x1d6b87f7, 0x2f4e877d, 0xd2f5c55d, 0xff80fd9e, 0x859fb181, 0x39e327cb,
-       0x9eec8f6c, 0xffdff208, 0x85b3a334, 0x293c2853, 0x13ace5dd, 0xfc70def0,
-       0xf20236a9, 0x1c4d6170, 0x85f3fb81, 0x20fbfc0f, 0xd650c788, 0x81b734aa,
-       0x1e080c9c, 0x8b25bfb0, 0x467e324b, 0x10e9b5e7, 0xbf2187db, 0xf0e9e604,
-       0x3d8d0e2a, 0xc8aa43ba, 0xdf5d0370, 0x3c82f0eb, 0xf7877f98, 0x6fe78c03,
-       0x7b041d0e, 0xf99ebab7, 0x00d928f7, 0x9b41f9ff, 0x312b5317, 0x36b950c7,
-       0x90ac4cdf, 0x6cc4cb26, 0x73cb7c83, 0x1e4bb05f, 0x18e4eeb6, 0xdfdf6562,
-       0x72f404b8, 0x5bac835d, 0x3ea0a8f7, 0x3eb37d7f, 0xe7d2119f, 0xe7d11ec7,
-       0x431a83b7, 0xffc395f1, 0xfda1d4ce, 0x877f0216, 0x0b45f8a6, 0x0cbeb3fa,
-       0x05fa007b, 0x4dde50da, 0x82c96e2e, 0x5e4fd6fb, 0x9ce09a70, 0xdf9befbf,
-       0x786d7de2, 0xc9e31d87, 0x0c53fc1f, 0xc07f0189, 0xa15b6d17, 0x04e298bc,
-       0x2fc577ec, 0x0ec0eada, 0x7a8467b2, 0x5fa00d1e, 0x31bf9ec5, 0x76f0f9bf,
-       0x6fee004b, 0xdcfbd93f, 0x9f6f400b, 0xfa87ef6c, 0xdf82cbce, 0xd7f9fd04,
-       0xc4e67c33, 0x272d7db0, 0xde33d286, 0x75cfebbb, 0x1c993bf7, 0x1e6caf69,
-       0x4e59fb01, 0xb47fb33c, 0x011c1e57, 0x8f0e5cfb, 0x49eaae43, 0xbc7e3c39,
-       0x274fea9b, 0xe51439d9, 0x0fce70c2, 0xb2058179, 0xd5fa01d7, 0x5390188a,
-       0x79e5675d, 0xac358fe0, 0x15470f56, 0xf406d7cf, 0x7cf92bdf, 0xf7cd1016,
-       0x56f7b874, 0xbd00a4d6, 0xbea2433d, 0xf9c35c7b, 0x65e7f9e8, 0xf22fbcf5,
-       0xd14468f8, 0xc88acfbc, 0x1facb273, 0xbe0025f8, 0x17be4606, 0xfb55c61b,
-       0xfffbca9f, 0x92fccacc, 0xce1c3813, 0x7d411e55, 0xaddf5ba0, 0x68a77af4,
-       0x07b579f2, 0xfc23e693, 0xd02d260e, 0x1fb6f39e, 0xfe039a4e, 0xfc660d36,
-       0xb32553bb, 0x27247d9f, 0x418bbe01, 0x03942798, 0xaf823b1c, 0xd51ea0b9,
-       0xfd68c767, 0x6f6bf257, 0xecd14ef2, 0xce95dfd7, 0xbb65e3bb, 0xca5e5c19,
-       0x16fdbdce, 0xa2cdbba0, 0x0715aa07, 0x1479bcef, 0x84b37bc0, 0x764b72ef,
-       0xbdb7184a, 0xb406eebc, 0xbe371453, 0xffe31533, 0x03df393d, 0x9332caf3,
-       0x9a0c715c, 0xf480ee18, 0x8c6ecb4c, 0x61fc57af, 0x60566c8d, 0xa3ba7abe,
-       0xa3f08c74, 0x6dd6541a, 0x15de53c0, 0x7eab3fe8, 0x30b7e237, 0xc46f6fa0,
-       0x1ba72b53, 0x8b5c33fa, 0x3ebd636f, 0x8ef8fdd3, 0x953964b2, 0x543b1a63,
-       0xf46aa9c9, 0x038e33d7, 0xa344da37, 0x7703eca7, 0x1dafe01b, 0xfe836fcc,
-       0xee2cd608, 0xe5883ad7, 0xd0200e31, 0x047fac15, 0x3bc0a299, 0x34c8dbcc,
-       0xd1b95548, 0x0d1c1d91, 0xda165ff5, 0xf615fd9e, 0xed7e44e7, 0x2e308770,
-       0x3efe5f62, 0x796143b5, 0xa83aeff5, 0x362d45e5, 0xe4f8f3f4, 0x71f28cbc,
-       0x4197f805, 0x266c17fd, 0x3ebfdd13, 0x1267d9d9, 0x04762df8, 0x73dcbc59,
-       0xe4933ec1, 0x8d77d96f, 0x0fdd4172, 0x74afc04f, 0xe9c2fcdf, 0x4b7ec30d,
-       0xcebf3156, 0x19153ee4, 0xa4f05115, 0x2b904bb6, 0x123ce032, 0xd9e1d7be,
-       0xa7f2708a, 0xc1723ec3, 0x81f68297, 0x121edcf9, 0x06fdceef, 0xbad275fa,
-       0xfe2ffa5e, 0xe815b888, 0x73d163eb, 0xe4507bbf, 0xa6516f9e, 0x90f3df0f,
-       0xb45cec55, 0x66424cd0, 0x842eefaa, 0xe63463fd, 0xb85bbf71, 0xa6ff4059,
-       0xebf41b45, 0xdaad7881, 0x405087bf, 0x22dfb1aa, 0x60b4c412, 0x10bcbeb3,
-       0xf81723f6, 0xfc7bb067, 0xb97d7aa2, 0xa4a84efa, 0x1a25b2f1, 0xea20bedc,
-       0x2ec9bcfa, 0xb36e179a, 0xdbeefce2, 0x35eecb14, 0x7d85e264, 0x89c9bc30,
-       0xf898bc72, 0xbe3f3bd8, 0x303f960f, 0xd288bbdf, 0x85f2d767, 0x307d45de,
-       0x7d81077e, 0xf895b16f, 0x1e58635d, 0x0b2017e2, 0x38b29f21, 0xed4eb051,
-       0x29e2963b, 0x15c03424, 0x53ac2f59, 0x65de4e5b, 0x116e2cf8, 0xbd60a342,
-       0x64427ef0, 0x2bd6d5eb, 0x692870e1, 0x11ece8b4, 0x0a7fe0a5, 0x974d337e,
-       0xb97eba2d, 0x8fdd1f3f, 0x69e28d89, 0x0ddcb753, 0x4fcd1b5c, 0xd78738fe,
-       0x52f33ba6, 0x051f3f81, 0x072fb33d, 0x173d3668, 0x61cc9083, 0x71d2b780,
-       0xe776c662, 0x256b3cb1, 0x647d4fcb, 0x51e90fe0, 0x1bcefe1b, 0x142c6fde,
-       0xf7875f73, 0x7db9cf57, 0x71d1763f, 0x69bc9a16, 0xef53e466, 0x5cd7f450,
-       0xc4ffd6ce, 0x2b6b8a98, 0x557b9ca2, 0x042e3e7c, 0xbfd1bef1, 0xceabed97,
-       0x7da4b0cc, 0xc5c8b45f, 0xa1ec4fe4, 0x10777c36, 0xbbe02dde, 0x138527c7,
-       0xc9f02ef8, 0xce04291f, 0x6f1429e5, 0x149f1f20, 0xbf882ac8, 0x7334d995,
-       0xbf806bc9, 0xa3d418cc, 0x8a269b4a, 0x3f5c0ea5, 0x15eca3d3, 0x99ef7075,
-       0x18f86f3c, 0xeeba6ba0, 0xff01b779, 0x5b8414bb, 0x41d183aa, 0xfa7f4aca,
-       0x7e3091d2, 0x80d792ee, 0xe0c546ef, 0x0a64d93b, 0xa63c672b, 0x4a2f40eb,
-       0x41071921, 0x574ca78e, 0x772d80c6, 0x938d8b93, 0xcde71268, 0x0c6dfd04,
-       0x243fc7cb, 0x7122b778, 0x2575c46d, 0x369fd85b, 0x7fa0ef82, 0x804ec15a,
-       0xe78601e5, 0x301915c9, 0x9620f27e, 0xf421c826, 0x8dda3a53, 0xcdea1f77,
-       0xe504dccb, 0x134bb2f2, 0xfb69e393, 0xc0f41da3, 0xd1d5e54c, 0x1d9eaafe,
-       0x439e8072, 0xf5670f06, 0x2cb15eb9, 0x27e5f983, 0x10faa9a4, 0x7925d7ab,
-       0xfc82c763, 0xdbe9877c, 0xb1bc3b9f, 0x837737e0, 0xb80fdd1c, 0xfca9e386,
-       0x34049da2, 0xd67cbff2, 0xa4def897, 0xf74ba2fc, 0x69c9e21d, 0x0a4b49fd,
-       0xe3dc610e, 0x7e8ad252, 0xbd41a5c9, 0x310debff, 0xe955c7d1, 0x48a2fcbc,
-       0x95c751fc, 0xf62fdff5, 0xd13efe21, 0xbfe925ea, 0xf9f4145f, 0x3d78afe6,
-       0xd9277e33, 0xc7382e6d, 0x077d874d, 0xe4c049e4, 0xe08fae97, 0xa6ddd3a5,
-       0x153a6fdb, 0x71e2ef96, 0xb572d575, 0x3259ceff, 0xc6139f7f, 0xa92a3a71,
-       0x79f0a240, 0xb453e5aa, 0x1cb496a3, 0x74a8f844, 0x9d938111, 0x4a7035f8,
-       0x990d6aaa, 0xfeff8f28, 0x476b4591, 0x72514b5e, 0x3fb3f388, 0xf297ad6f,
-       0x2fc4126f, 0x3db7f0d7, 0x51df9bb3, 0x89326ccc, 0xbf99dedc, 0x4d04ca76,
-       0x6eefd79e, 0x21f82fef, 0x648e6794, 0xa47bdfed, 0x072b77f0, 0x5d13e447,
-       0x53ae5a47, 0xf21ab793, 0xa51f9a0e, 0xe50dbbc9, 0x14f28609, 0xab3fbe43,
-       0xa50ce1df, 0xda421e89, 0x21fd291e, 0x8eb95dfc, 0x885cd0d4, 0xac41b038,
-       0xddfc21f8, 0xf64cd2c9, 0x5acb1477, 0xb3730f04, 0xf32bf062, 0x87307bb0,
-       0x385e4da7, 0xfad0e012, 0x9283c83a, 0xfa0dc166, 0x33b823be, 0xa7687984,
-       0xd905da68, 0xe092ad3b, 0x6bd76c09, 0xc84dc3ff, 0x3f0f0fcf, 0xe4aef589,
-       0xeba644ef, 0xf37be0fd, 0x7c9874b3, 0x53df6117, 0xec770ce3, 0x77f23f7c,
-       0xcef7e8ed, 0x9461ef54, 0xaaf786a7, 0x471f30e5, 0x38545f84, 0x02fc3c3e,
-       0xf3fc5dc6, 0x40f796a8, 0xfb2fb00d, 0x95e80574, 0x1e9e961f, 0xc4167a07,
-       0xe3fd846e, 0x2d702171, 0x114f47ec, 0xee30b5df, 0x0e43a5bd, 0x39949fc2,
-       0x816db52e, 0x1ec31050, 0x3ff08f5d, 0x001b6cee, 0xdae8927f, 0x4f961ad8,
-       0x1008c36c, 0xfd37626b, 0x39fb4cd0, 0x806da03e, 0xc547e689, 0x43e5661e,
-       0xfe40b6da, 0xb0dfd8ce, 0x036d51f2, 0x1d1c3744, 0xdb7f111a, 0x3ef9d1dc,
-       0x1bc9962d, 0x06437e75, 0x4163537b, 0xfb612a8f, 0xb4873c0e, 0xb73ab952,
-       0x6d8edce8, 0xff731e14, 0x6ef28ed5, 0x3fedc75b, 0x3fb1fa66, 0x92a0fc17,
-       0x5f71bc39, 0x466ef944, 0xf61521bd, 0x3e08f8c2, 0x0aad699d, 0x2a231bee,
-       0x905e8276, 0xee24773c, 0xef4e9d1b, 0x9171d8da, 0x9a048bf4, 0x8dac79d2,
-       0x2ef93375, 0x5b3df09a, 0xd44e83f2, 0xf1e51e9f, 0x21df29ba, 0x5e38387d,
-       0x8cf5f2c6, 0xa1e7658d, 0xd84dd744, 0xaf5cddcf, 0xd81f59ad, 0xfff0a36e,
-       0xde0e7a93, 0x39e4f4c8, 0xc4ee5475, 0x37817f82, 0x1cc9e415, 0x8c8f07b0,
-       0xbfbd55e4, 0x1de68326, 0xcd58f391, 0x36aa6f4c, 0x1d4d782e, 0x55e5572b,
-       0xaf6b3a4d, 0x55c95bee, 0x8fc93e0c, 0xd615bb5e, 0xff333761, 0x86b3c581,
-       0x7a815d6e, 0x5f386dc0, 0xc2a6f5e2, 0xe154fcb9, 0xa3e81340, 0x0da67e2a,
-       0xeb82def6, 0x2a38f7e1, 0xd7f1d49e, 0x142f75f2, 0xf6011ea9, 0xe10fb774,
-       0xd18af549, 0xe99d72ec, 0x5ae96b15, 0x7c2a1f01, 0x1c6db989, 0x045fff7c,
-       0x0cffa5a7, 0x7eddfd38, 0xbc7bd3dc, 0xfd0359c7, 0xad3f2e97, 0xe1c38f7f,
-       0x9210b8fe, 0xf1353392, 0x3877e853, 0xf2eade77, 0x735622fd, 0xc1f735bf,
-       0xd53fd452, 0xe5ffd8f5, 0x917769a5, 0xd469fc9e, 0xc9ff8f0f, 0x02ec01ba,
-       0xca20e5c7, 0x263fe3e3, 0x38e42ef8, 0xeaa5678f, 0x5aff59b7, 0x6dce147c,
-       0x222b11ff, 0x7a54d87d, 0xe6777210, 0xa7aef851, 0x3bbc39db, 0xd464fd57,
-       0xc786bafd, 0xe079ada1, 0xd1af7c3a, 0x3cf0da45, 0x2826cfee, 0x67cbbb3f,
-       0x4a72c50f, 0xc81b7e27, 0x8c18c289, 0x41935fc7, 0xcd497df0, 0x0e5811ec,
-       0xc7f458e7, 0x71c56d99, 0x3a32666a, 0x478c29ac, 0x5dc8217b, 0x746f5b80,
-       0xecc55494, 0x1decc41f, 0x7f1fbdad, 0xf9f9962f, 0x76db33db, 0xed7a0fbf,
-       0xb5ea1b06, 0x57bc4280, 0xf1c64ea9, 0x8fec3d28, 0xcd97fdc5, 0xa963e163,
-       0x5c718781, 0xd603da0f, 0x51f3bd3a, 0xaeccfdce, 0xdb37fcc0, 0x18eb3ac8,
-       0x5590e638, 0x7cf92f28, 0xe813f548, 0xeb8f3157, 0x5c151f89, 0x721e8270,
-       0x1edbb634, 0xf9f385e0, 0x17cac202, 0x013f643c, 0x0f05abe7, 0x64b778b1,
-       0xfd5e4ddd, 0x6b9d093d, 0xf9d3d812, 0x09d86d4f, 0x3b41f070, 0x1ffff417,
-       0xe41f784e, 0xc3bd887b, 0x7eda7e25, 0x47fda478, 0x9760f7c0, 0x49fcd917,
-       0x16895da5, 0x58a3f4e7, 0xfd5397ee, 0x9e3b5784, 0x5fb18e3a, 0x036c8e7a,
-       0x0f70a37e, 0xf0a83bc1, 0x59dfd8cf, 0x4137ce30, 0x46c2ff0e, 0x8a56e7cb,
-       0x3c292b71, 0xb89dcb7d, 0xf3be755e, 0xa237c392, 0x7fd0c29d, 0x0b2cbdbb,
-       0x79eae7ec, 0x39a43c88, 0xe45c21ff, 0xf8845e48, 0x573c6101, 0xcfcef8f5,
-       0x2873c6cd, 0x68b37f21, 0x2bbf75eb, 0xfcc30450, 0x82295d39, 0xe3e6f019,
-       0x1cb2fef7, 0xeb720b9e, 0x50eb02ff, 0x8000589e, 0x00008000, 0x00088b1f,
-       0x00000000, 0x7dc5ff00, 0xd5547c0b, 0x73b9f899, 0x3332bcef, 0x49324cc9,
-       0x9b8f2126, 0x80402107, 0x52024c49, 0x1878431f, 0xa4076b35, 0x438b5b16,
-       0x921123c2, 0xb175b689, 0x5100cb65, 0x8d042208, 0x41380abc, 0xbb6bba50,
-       0x060222c1, 0xb6a2d11a, 0x6eb42fea, 0xfdfeed57, 0x58f88845, 0x16544649,
-       0xefffad5b, 0x99b9cefb, 0x514493b9, 0x67f4ddbb, 0x739ee72f, 0x77cef9cf,
-       0xcef9f7be, 0xe99a1619, 0xf4662deb, 0xfc3e79f7, 0x33577f87, 0x3034e896,
-       0x7cd8ca96, 0x96773599, 0xeb47df44, 0x6d67aa25, 0x34967d5b, 0x0bbc02c6,
-       0x66f536e6, 0x607da1fb, 0x694df9b9, 0xeb88bc22, 0x6330b19f, 0xb56d8c15,
-       0x993590b2, 0xf4126db1, 0xbbcf0e53, 0x7935e16c, 0x23580d8c, 0xc602b08f,
-       0x59afc782, 0x1bfbef80, 0x4d065412, 0x08589876, 0x8ee3a1cb, 0x576c3ef0,
-       0x64c45bd4, 0x7c1807a8, 0x24be786e, 0x0d248477, 0x5e9ac608, 0x87acf792,
-       0xae47fd76, 0xb2acfde5, 0x41ca0ca9, 0xb8c136a8, 0x575fd0c1, 0xa4c644b2,
-       0xff1a1639, 0x6c2921cc, 0x66c3fac6, 0x85e0d3e6, 0xbfe1faff, 0x2f1832fa,
-       0x2719086c, 0x102b13c1, 0x8236c38e, 0x40da6603, 0x813f7de3, 0x9bf187ad,
-       0x00cf920c, 0x8db74df5, 0xf0e1af0b, 0x67e01858, 0xc9ad0099, 0xe8245ac0,
-       0xb5e0532f, 0xe8ba70c9, 0xa75e128e, 0xf8a5bb40, 0x3dda950f, 0xcb9c012b,
-       0x647a1b2c, 0xe1399380, 0x0dbfa83f, 0xeba2f3eb, 0xbfe1b4d0, 0x3479c33f,
-       0x2db8041d, 0x3d97b851, 0x6dc79fa6, 0x27ad14cc, 0x7eb443b8, 0x2f8e72b6,
-       0x47858336, 0x510ebc03, 0x84f755b6, 0xf2c7c465, 0x65ccece9, 0xef44f4d0,
-       0xeb1dbf2c, 0x3c2d593b, 0x5f30ef83, 0xda9ee018, 0x28ccf1d5, 0xeeaaef68,
-       0x06e9c6c9, 0xa0b1ff97, 0x3ae8b2ef, 0xde5e706b, 0x766659b5, 0x03be8f1a,
-       0xec077c50, 0x9cec6ed4, 0xd5cfb109, 0x41aa5df4, 0xebc715be, 0x881957c5,
-       0x04865f1c, 0xc8696ce3, 0xdabae037, 0xb0057814, 0xb31b6a2e, 0xd9e11567,
-       0xc1c73457, 0xec8983d8, 0xd3e13f56, 0xfe87e95b, 0x2d56751e, 0xe97f4274,
-       0x9d5baaae, 0xbf1c7ca9, 0x029fa703, 0x6ba50d40, 0x47e1a9ed, 0xd05e976b,
-       0x1f6cda5c, 0xc4db9db9, 0x9ed916f1, 0xf083de14, 0x17951228, 0xb1d8deff,
-       0x8853e09e, 0x95d8ee6e, 0xebf84617, 0xe9099b59, 0x9b0b197c, 0x5b178e90,
-       0xe8112858, 0x4b343162, 0x6d92e782, 0xacc6a666, 0x5f58435f, 0xae1ced66,
-       0xd3f74a65, 0x4dd22252, 0x74b3f50f, 0xb2ddbebf, 0x01dbac19, 0xd6168df5,
-       0xa767c36d, 0x4589bebe, 0xe1e08e08, 0xfebacdcf, 0xc3ad1b59, 0xc8632b76,
-       0xbe6549a7, 0xfe01bbbc, 0xef460bc8, 0xb7cfa01e, 0x7868bac4, 0x35567648,
-       0x64139e20, 0xb233cd03, 0x03de16ca, 0xb033ecf3, 0x4de75c7a, 0x1ceb762e,
-       0x64aff678, 0xa12342be, 0x77ae2263, 0x1fd73e3c, 0x7d23d6b5, 0x13f9416c,
-       0x38373f43, 0x5ee7848d, 0xbe47ab13, 0xfd0d5ca9, 0xa6a5c8c5, 0xfc01ec9b,
-       0x9726976e, 0xc46f9d60, 0xa86b6675, 0x9e91ed8c, 0x4fe32e12, 0x83bdbbed,
-       0xa7f337ed, 0x4b7bf9c2, 0xae074243, 0x0cee9453, 0xc4aee88c, 0xf7c00a6f,
-       0x583c8547, 0x38fdf960, 0x40a3f7a4, 0xa1f7c808, 0x0b972b4e, 0x72fe738a,
-       0xa77d1f28, 0x455ebbc4, 0xe272e0fa, 0xd812f7e8, 0xf9f2186a, 0xdef5fef7,
-       0xfcfea197, 0x0cd5263b, 0x46910bf5, 0x4a8f3d60, 0x85e387cc, 0xf787309e,
-       0xc065bbc1, 0xb2cf08b6, 0x28c213e3, 0x02990edf, 0x38e117db, 0xfbbd1b8f,
-       0x8965bbe0, 0x423c5fe1, 0xa05e19f5, 0x9194f644, 0x88e861d3, 0x109f7f8d,
-       0xb95fb7fe, 0x1bdd3eb1, 0xac7bf682, 0x07c81381, 0x09356699, 0x97bf65fb,
-       0xbba71f19, 0x3bf805c8, 0x824af38d, 0x38495427, 0xfa83974e, 0x58cafe01,
-       0x699cfd04, 0x80f9a74d, 0x38e1f4dc, 0xf79a3667, 0x32dcdca0, 0xed44ae38,
-       0xb3fd1b4f, 0xfa7ca032, 0x2aef5289, 0x9bf01aa8, 0x7f404dba, 0x5f4b4dc1,
-       0xea17a064, 0xc46eea0c, 0xa36e3b0f, 0x11eb6879, 0x06a4b8dc, 0xadb783eb,
-       0xdae501b8, 0x7289fc48, 0xbbc8c59a, 0x41c9167e, 0x9f51dffa, 0xfa8dd9df,
-       0x57ac6ba0, 0x2c0f5aa6, 0x9387d03e, 0x7233edb7, 0x198e46fc, 0xb52f4f89,
-       0xa50ba47f, 0x1c0feb92, 0x94f20827, 0xf242fc69, 0x0f2ca634, 0x18ebe657,
-       0xfc4e9a3c, 0xdb3f5f1f, 0xf908f811, 0xfffee9a7, 0x8ab96379, 0x9e4845e3,
-       0xe254b6b1, 0xdbbb8033, 0x6df7df02, 0xe55f1077, 0xf70f50ae, 0x741ebae2,
-       0x335d3cd1, 0xcb03b27c, 0x3ca8f33b, 0x1c6dc855, 0xe2c6f516, 0xcaf48c29,
-       0x58b59962, 0xd17de8ca, 0xf67f6876, 0xcf5a6c89, 0xceb666c5, 0x36ce7c02,
-       0xdb3ffa70, 0xf00a7201, 0x25ee6753, 0x4dfecb39, 0xb518fb62, 0xcb76c16b,
-       0xb28c9060, 0xb94378a1, 0x385bc3a5, 0x7ffa0ca6, 0xe907676a, 0x8a720601,
-       0x9a05d8c5, 0xa4f9431c, 0xcdfd9efb, 0x4863c7ac, 0xc7c4b793, 0xd9f4a930,
-       0x28f2a213, 0x72cfe9d9, 0x30a16055, 0x5677f11d, 0x04e9dc0e, 0x8584b6f9,
-       0xb0363e48, 0xe36a7a6e, 0x72e5bc81, 0x2ee5c2d7, 0x412e133e, 0x3ac6defe,
-       0xa2366e49, 0xee4e1a44, 0x3bb900ae, 0xcbb96471, 0xe2297358, 0xdd8b7835,
-       0x221e788b, 0xd77c857f, 0xc4dd31d6, 0x15d4f0e5, 0x44959961, 0xe89a90f1,
-       0x115a969b, 0x57c1abd5, 0x1275162d, 0x1f2cfd96, 0xda63ade5, 0x7d41a7bf,
-       0x943e6150, 0xe61eb69b, 0xbbf780eb, 0xf3f5fd84, 0xf1fa9534, 0x185d3898,
-       0x852b3f15, 0x9eaacafa, 0x49f2036e, 0xbca2732a, 0xfef0f477, 0xbbe03977,
-       0xcb8efc32, 0x2defc1cd, 0xe62125ac, 0x56a3aafb, 0x470ba3a2, 0xe933611c,
-       0x0bae40c3, 0xb3fb4bfa, 0xfea4ec99, 0xf3920ea3, 0xaf3646fd, 0xd1bbda13,
-       0xbcf5a21e, 0xaefbfa87, 0x219e8f2b, 0x218a3556, 0x8dd74aed, 0xecd65642,
-       0x9ebcc683, 0x1edf489b, 0xc7c8ab30, 0x77bd5c17, 0x63c61962, 0xedbf2728,
-       0xf05da952, 0x9fd2f4e0, 0xdfa0fbc2, 0x0dd8e5ee, 0x98bd2294, 0x64dd1fe5,
-       0x259b7581, 0x05dc88af, 0xdb663670, 0x6787289d, 0x9fd7fee4, 0xbbf2866e,
-       0x8ccc8d07, 0xfa6fbeeb, 0xb23f963c, 0x1b08689c, 0xd0c6f74f, 0xfafdd2eb,
-       0xbea76372, 0x2fac3c1c, 0xb872e1df, 0xde278ecf, 0xf40e7ef4, 0xbf373664,
-       0x9af001d3, 0xdc93329f, 0xf815debc, 0x26e7a467, 0xe224e443, 0xfefb9cd1,
-       0x73ae00c4, 0x3e1207d7, 0x3d2640cd, 0xc8bf1c25, 0x0bac1757, 0xd8c39d72,
-       0x857b51eb, 0x47840c59, 0x513d06b0, 0x20e410f9, 0xdef95f01, 0xbfe61a7d,
-       0x73824e78, 0xd5f1bd35, 0xbda25454, 0xe0b23042, 0x45df6bb6, 0x35da1ebb,
-       0x0d989c90, 0xfaae00ed, 0x2f6e5c6d, 0xc8893d63, 0xd7604d0f, 0x7f096058,
-       0xb1f4e2e7, 0xd95225b4, 0x4f6cff0d, 0x708b1eae, 0x7e299f2a, 0xd8b5ff5c,
-       0xf61d8c6f, 0x1dfb8b90, 0xdb5bf74b, 0xa1f862fa, 0x2ba5d3b1, 0xb4670f07,
-       0x5de2c5f5, 0x25533ff0, 0xb6ded625, 0xb90f021b, 0x7b0f9152, 0xfc60d34d,
-       0x88fb3fab, 0xe592f7f4, 0x0a9d90cf, 0xedc058f3, 0x728aab36, 0x4f5dc975,
-       0x2fcd7bd3, 0x276d9b38, 0xed99e0bf, 0x99765e66, 0x17767ca8, 0x74965bf7,
-       0xa79c614a, 0xca62e734, 0xbba79434, 0x1b334e8c, 0x3c78d78a, 0x3ff3bdbe,
-       0xf54c1913, 0xfa3a426d, 0x1bb71213, 0x6489cd9c, 0x89cdaa9f, 0xb7051f68,
-       0xca2ef35d, 0x64bb25a9, 0x7635ea2f, 0xcd1de1cc, 0xec733cb0, 0xf3f63b22,
-       0x8034ca61, 0x4cf77da3, 0x65ef4ca7, 0x48f9187f, 0x0d5cf5f1, 0x93dd95ef,
-       0x67b7e455, 0x97f87177, 0x208f2cb8, 0x99fd5d1d, 0x62b2764c, 0xcfb40160,
-       0xb1be4dda, 0xceeab7c8, 0x7d70b37d, 0x699d9ede, 0x94bff6a0, 0xe2f11398,
-       0xef869e5a, 0x1f8a4897, 0x5b7eb4f9, 0x7eac4d43, 0x1325d5be, 0x5dcb4dbf,
-       0x276bd691, 0xf509babe, 0xe02ee355, 0xce7f1c23, 0xd9ba7feb, 0x692be51d,
-       0xa61bb6ce, 0x1a8fff62, 0x8377c8bd, 0x3fe7777a, 0x5fe17d11, 0x6dca2577,
-       0xca6faf8e, 0xc69b6667, 0x2845cd27, 0x6eac973f, 0x630e722e, 0xc9f20fcf,
-       0x6f97ce4e, 0xb7ee24b9, 0xeceb2566, 0x00fc91dd, 0x87c1b17b, 0x9978b7f8,
-       0xd33c1f6f, 0x7f430dc1, 0xa159212f, 0x136484fa, 0xe4f949e1, 0xa92ffd8e,
-       0x3e071768, 0x65ccfa44, 0x27d452be, 0x9559c46a, 0xec2b7484, 0xdb93b605,
-       0x907f6081, 0x9525b5bd, 0xc63eb23d, 0xfe8933ff, 0x8a7c4e40, 0xb5ffa272,
-       0x7e224f4f, 0x9fde729b, 0x783afa88, 0x0a9323f1, 0x4977b5f3, 0x5eedbf24,
-       0x09ba433f, 0x0b66cd76, 0x3772a24b, 0x217ae5e8, 0x26375e7e, 0x751cb91b,
-       0xab9fa847, 0xb73f3852, 0xd3d118bb, 0x6409e58e, 0x8770ee97, 0x57f408ad,
-       0x29f65be5, 0xe7587568, 0x675f0b06, 0xfb5fdecb, 0xb0f3a464, 0x658d1ce4,
-       0x40c7f395, 0x0cb0fcfd, 0xb7bbbce3, 0x83e54420, 0xd432bcd3, 0xbc3ef7d9,
-       0x74f11f2e, 0xf6c5e8d8, 0x226f6f76, 0xbdddefce, 0x7e711267, 0x9a657bf5,
-       0x83f87d77, 0x512545b4, 0x2917f139, 0x768c9050, 0xc7b25b82, 0xf7778bca,
-       0xd0b6987e, 0xd253fdce, 0xe3c3e597, 0xad35dd25, 0xfabfbf18, 0xef2ebe2a,
-       0x461cd2fd, 0x159ef839, 0xfc8c59f4, 0xf5c1cf7d, 0xcd64d4db, 0x41cce8cf,
-       0x565833fd, 0xfc701ac6, 0xfcf9391f, 0x1ccea6dd, 0x96ffcbe4, 0xb6dcfdf4,
-       0x9061664e, 0x24eb0d4b, 0xff990616, 0xcc9e2fde, 0xeefff941, 0x6a7327be,
-       0xff8be063, 0xd0ce7b4e, 0x9af113c6, 0xd78da65a, 0xd5e3859d, 0xa26fcd7a,
-       0x66eb619c, 0x26f906fa, 0xdb633f9f, 0x8a3e6db3, 0xd7000ca7, 0xdf6a1d22,
-       0xf827d40d, 0xcc2eb82c, 0x4e90c612, 0x6ddc976d, 0xbe7cfec6, 0xdfda3742,
-       0xfd71f7da, 0x927a0ab7, 0xa7e44b0e, 0x24224ada, 0xfcb6bf9f, 0x13d7e8f7,
-       0x4c98d9d6, 0x72723ff2, 0x30fa2314, 0x4d4cde21, 0x55f50576, 0x5f4e1ada,
-       0xc81b1f91, 0x2427701f, 0x3f60644e, 0x763d3299, 0x17576f94, 0x9218b425,
-       0x184e7df0, 0x166767db, 0x2aa177d3, 0x34a1ff4e, 0x0c9e7146, 0xff212cd6,
-       0x97b72732, 0xe730a6b3, 0x4fee287a, 0x878c76e6, 0x05c9b779, 0xc612feb4,
-       0x68bc3425, 0x08e901fa, 0x927be5e5, 0xea48e885, 0x947ec892, 0xb1f39d0d,
-       0xeae891df, 0x8ad75c6e, 0x960d5d28, 0xb57441ff, 0x086f1b49, 0xa254055d,
-       0x78658f2b, 0xf62552ba, 0x90b3da95, 0x74affd1f, 0x424daf81, 0x6c7e44fe,
-       0x4016f1e1, 0x46b7ce19, 0xb16357f4, 0x47a8cb77, 0x63f7c6bc, 0xc13b8fe3,
-       0x25ff45ee, 0x787ced03, 0x40b35a8e, 0x3d6375a5, 0xdaefe8bd, 0x5f485b26,
-       0xc9e86bde, 0x7d263b43, 0xa401f35c, 0x25f9f48f, 0x6fc86b65, 0x5ea172cb,
-       0x714b5d40, 0xfdd3e587, 0x7e808edc, 0x9b668e91, 0xba6b3fc8, 0xdb9f9a6b,
-       0x2fc4d511, 0x15560dc1, 0xaef4e0f5, 0xf76455bc, 0x335e60af, 0xf6c771d1,
-       0x9c2f18c5, 0xaca2f76b, 0x213c62b3, 0xe7afe705, 0x93a956bb, 0xb5d0f1ec,
-       0x5d728bcc, 0xbbb6478b, 0x14ff777a, 0x09437ff5, 0xf183f7f9, 0x7a4642c9,
-       0xcbe5dda3, 0x1ebc0648, 0xa78f1bfa, 0x194297b5, 0xf5894f9e, 0xcbed9f6c,
-       0x76b94170, 0xdef09583, 0x07ebc1de, 0x49a0801c, 0xfea4a714, 0xeb859258,
-       0x81f2a1a1, 0x53699be2, 0x0db7f698, 0xb95a99cb, 0x41d92b6d, 0xe7b7ff1a,
-       0x251c7871, 0xc8b43cfe, 0xf1dcdf2f, 0x47f0027c, 0xa68dc61a, 0xb42117d2,
-       0xc92e29f7, 0x7cb614cb, 0x648000d0, 0xeb27f162, 0x5b115c67, 0xdfa3ede6,
-       0x7ac7af5b, 0xf583bfd0, 0x65e83608, 0x02b3ecad, 0xd11d6b1c, 0x60ec057a,
-       0x7c4961cb, 0x3375e4ff, 0x92fe610b, 0x93f43f18, 0xafc61f56, 0x5e374cac,
-       0x5c4a7c2c, 0xdfe846ff, 0x77ed6aae, 0x0684cf56, 0xe569960f, 0xb2f9d78f,
-       0xbea33fa0, 0xf8a9423f, 0x78da0b1e, 0x63383dcf, 0xa8ac86fd, 0xc2f6007d,
-       0x34cf2827, 0xebed613b, 0x60936d35, 0x43f39b2c, 0x4d5fea13, 0x12dd07df,
-       0xfcf121d9, 0xbe914b6a, 0x085d7d99, 0xcea575f6, 0x70a5b6be, 0xb2167afb,
-       0x2425f824, 0xfc2b83bf, 0xb05bed0c, 0xbeb0924b, 0xcff7b5ff, 0xfdf50d3e,
-       0x7272fe73, 0x6eed8a94, 0x557e8f9f, 0xf242a2f0, 0x0e5fb837, 0x9637c04b,
-       0x83576e2e, 0xb478a73e, 0x39b73f46, 0x42b8fd05, 0xed6ce30c, 0xa40aa4c7,
-       0x73a3f077, 0xf96b03be, 0x665f14a3, 0x9fd4454a, 0x65f79f8c, 0x189e3c29,
-       0x5edaae2c, 0x95effd84, 0xeb0bda18, 0x2da74f8b, 0xcdea7f24, 0xdf3145b4,
-       0x907e1c35, 0xdfb0d9f0, 0x2f1e2c38, 0x8f09914b, 0xf09e474d, 0x2f78dca1,
-       0xa84c912c, 0x68adc257, 0x1bd7d6d7, 0xe56422d0, 0x533705e1, 0x899e7d7c,
-       0x65f9868d, 0xdc177d08, 0x2a68637f, 0x93fe1bce, 0xff0ed5e0, 0x3b139262,
-       0xb4ec59e6, 0x7b5c514f, 0x99c1e13b, 0xac3c43e0, 0xc0caae2f, 0xcf669a71,
-       0x1e5c5272, 0x6fac39ec, 0x147bebba, 0x5ae0d7a7, 0x8d58d87f, 0xd8254ef6,
-       0xb806bf75, 0xabaf93b3, 0x8f5f02f6, 0xfe940f92, 0x465bca10, 0xba2fe390,
-       0x48b45d39, 0xcbb7d0fe, 0x62c78e29, 0x87b972e3, 0x7d78fdb9, 0x69da898a,
-       0x514fafef, 0x8457af08, 0xb923a67a, 0x6d7a571c, 0x99075768, 0xabf403ef,
-       0xeeaedf99, 0xf2e275a3, 0xa552bdcb, 0xddc59378, 0xac24ef7b, 0x7f2142bf,
-       0x0fbd2986, 0xadfdb8e0, 0x267aef6e, 0x77cb00f8, 0xea1c5095, 0x1e604a68,
-       0xb0a56fae, 0x5c8ffb57, 0x125b5a53, 0xf75abfb5, 0x01abc239, 0xf50ead0f,
-       0x93946afe, 0x2724289f, 0x33d22599, 0xf869fa1d, 0xfbf5326b, 0x0ea05b07,
-       0x86b569fb, 0x420e915b, 0x73b5321d, 0x6374b1cf, 0xe23eef3f, 0xd33b40e8,
-       0x48636ee8, 0x50bee0c7, 0xf6e2c49c, 0xd3ca1533, 0x09140b43, 0x5d9c45f5,
-       0x49e31d33, 0x29b8b7e4, 0xf82558de, 0xc1503463, 0x42b10b59, 0x5129e7cb,
-       0x4ff9e73b, 0x52f82ae7, 0x160c7fb3, 0x319e1f1e, 0xf8e1812f, 0x49c89eec,
-       0xdd9bc603, 0xe1ed0c3d, 0xc6894ec6, 0xdc7e2c69, 0xd2cbfe84, 0x41dfce4e,
-       0xfe006fe1, 0x58aed072, 0x76136291, 0x77a70b66, 0x147273d6, 0xbe31f9e2,
-       0x3b418c9e, 0xb2dfac47, 0xfd69da8a, 0xbc9c4499, 0x4093c451, 0xdafd5213,
-       0x58cecd14, 0xc26d9e2d, 0x6ee3e0ce, 0x327c7a91, 0xd254b3e2, 0xe7b573c5,
-       0x9277216e, 0x2166444e, 0xbe8046ff, 0x5db4ae30, 0x6ffb7d9a, 0x2bdb7e61,
-       0x14d179c6, 0xc93900f3, 0x481ef865, 0x7e5ef011, 0x485983f8, 0x119aac37,
-       0x9e1d36bf, 0xfd8a3726, 0xd217b404, 0x581dcd6d, 0x316b7e9f, 0xef8c67e9,
-       0x5ec0bee3, 0x3b0cd781, 0x5679eb8f, 0x9f70f287, 0xff84e92d, 0xf8e2dff6,
-       0x1f681213, 0xc6d61d23, 0x75cf4c91, 0xb0f2d718, 0x3f51a7d2, 0x32d46a7b,
-       0x4fdb4784, 0xd9a8fdc2, 0xa9c72425, 0x7c95ec9c, 0xabf9e07b, 0x01e11714,
-       0x846abcfc, 0xed87df17, 0xf4adfdd1, 0x38a5cde9, 0xe11fee2e, 0x5ba33fb3,
-       0xeb3538a1, 0xfc8fbddd, 0xf113b37e, 0xb9f87355, 0xd6ff5157, 0xed275858,
-       0x2dd9c5f7, 0xf1bc4e3f, 0x03a39449, 0xbeeecee7, 0xcefae11b, 0xd6806f21,
-       0x5c8f6f47, 0xcfb7157d, 0x5367dbdf, 0x23dc8ed1, 0x8fd836e4, 0x5fa127c4,
-       0xde327f72, 0x45397c8e, 0x960c9fef, 0x2476eeff, 0xf0042f87, 0xef918bed,
-       0x0dffe141, 0x444f9fd4, 0x20faf5fd, 0x2bffa03c, 0xed5076a3, 0x2bed1b5e,
-       0x7117fa0f, 0x8ff3c8f6, 0x0f4842d8, 0x14ad3be7, 0xfec45477, 0xe44739cc,
-       0x8b52444e, 0x284de4eb, 0xbdb7836f, 0xf0032bf7, 0xf7c1d29f, 0xec49143b,
-       0x3320bc87, 0x73e37fbe, 0x294feec6, 0x5f1e59ae, 0x3e47ca09, 0x6e2265ef,
-       0x48b92cb4, 0x7c32fbe5, 0x62596a5f, 0x53da1177, 0xb43d094f, 0xabef812c,
-       0xdd4cb80c, 0xac7baeb8, 0xb429f381, 0x67bfc2ff, 0xb1ab31bf, 0x611d2ffb,
-       0x299dd76e, 0x609b7436, 0x1f681d9e, 0xe06dbae0, 0xfb8330fb, 0x1dcdc7d5,
-       0x51938266, 0xc455a079, 0x95fdb5eb, 0x571e3ce3, 0xce51f627, 0x10fc59cc,
-       0x48b5a96e, 0x9fe8d5cd, 0x8d3f585d, 0xde77d7e2, 0x759e9b3f, 0xf771f4eb,
-       0xde99acc5, 0x5a94fb6b, 0x7996bbbc, 0x8e5edc4d, 0x600d11c6, 0x94eba8bf,
-       0x7997d42a, 0xe51ab9cc, 0xd5821abf, 0x16cf0c9a, 0x2ed1a278, 0x73b42419,
-       0x02775694, 0x16daefae, 0x50a9e903, 0xed87c18b, 0xb8e73c34, 0xd2a91c79,
-       0xb01ae3cd, 0x471c6154, 0x4518b67b, 0xb7f45fdc, 0xf1ba198a, 0x73f89069,
-       0x1ea953ad, 0xfd6b5f4e, 0x2d9b18b5, 0x648ba718, 0x7dae281b, 0x479be4c1,
-       0x22e4e371, 0xb67c0216, 0x55d79a38, 0x9de27af3, 0x9f88d60b, 0xb854afea,
-       0x64d4c921, 0x376e9f94, 0xe3c6538f, 0xbe9b516d, 0xd21fbf1c, 0xeb97d610,
-       0x464c6058, 0x883fdf01, 0x7376ef7d, 0x7d6175f9, 0xd7b7c09e, 0x9b567284,
-       0x8e2caaff, 0x7f364337, 0xcd5767e6, 0x77c83a43, 0x203f2899, 0xabe3c5df,
-       0x3f821330, 0x44b74aff, 0x6f0711f4, 0x486d1a0b, 0xdf7cad5f, 0x1fc2abee,
-       0xee55f70f, 0x7c1fa134, 0xab67dc1e, 0xdf689a73, 0x24e352f4, 0x72f5bab7,
-       0xf7fcb068, 0x9fb967f7, 0x3c8b2ad4, 0xa1c9270e, 0xcb9f275a, 0x48fbc919,
-       0x83b7be37, 0x68f3809d, 0x6ed0cb95, 0x9da37e99, 0xdc74d1e6, 0xc6e0714a,
-       0xa839bd15, 0x7aaa9bc7, 0x203f308b, 0xad08bf1e, 0x682fc9a2, 0xff06eb57,
-       0xd884ed03, 0xc547e476, 0x7efa07ef, 0x3f454ee4, 0xe781cce7, 0xb01d5f50,
-       0x7f82be92, 0x38c66d3d, 0xb23c91cb, 0x023ac6a3, 0x305db02b, 0xa3f77ba1,
-       0x70b76879, 0xcbb1a9bb, 0x617681dc, 0x3ecc4b6d, 0x06dffe1b, 0x5b1bbefd,
-       0x77f14c97, 0x5f7faed6, 0xbbee33bf, 0x6d70fb21, 0x4c5bceb4, 0xefc8b181,
-       0x9f6877a0, 0x81835cfc, 0x64ebb7f6, 0xb79462ef, 0x7b7aace7, 0xaf839cfc,
-       0x9addcfd7, 0xc22de13d, 0x0f2c1e75, 0x116f6759, 0x819d73ae, 0x69fb6205,
-       0xf58675c4, 0xf9d6265d, 0x8b9313dc, 0x3fdf9d70, 0xd708b930, 0xcdb18b79,
-       0xa8f37c87, 0x1b90f033, 0xe99bedfa, 0xf70a7b27, 0x2e8f913d, 0xc40f1e95,
-       0xff81e3d1, 0xefa47a3d, 0xc787d246, 0xebd0e106, 0xcd49b743, 0x6b507942,
-       0x5ea17f31, 0xe361bfc4, 0xc5331678, 0xfa7f8e3b, 0x5047c6e1, 0x64c9740e,
-       0x1dfd688f, 0x68050257, 0xd57f1d0f, 0x23490de3, 0xed18bff7, 0x07da0aad,
-       0x455c610c, 0x7b3403f3, 0x9f1e5e32, 0xc779f312, 0x7b42abed, 0x8dc6ebfc,
-       0x4b3bc5eb, 0xe76e43f8, 0x3cbc95ee, 0x7149dc6e, 0x0b63a6e4, 0x7e27189c,
-       0xc6e3cc27, 0x52944f4d, 0xfc21b8dc, 0x2de6374c, 0x89c92eb1, 0xdec347fe,
-       0xdb171337, 0xf82e7ea3, 0x5f236fb5, 0x3f7e8b31, 0x99f09de9, 0xc13b3ac4,
-       0x71ea157d, 0x42623b9b, 0x7f026fba, 0x9ad4f30f, 0xec49c894, 0x28cdc9b7,
-       0xb0fca31f, 0xf2d3ffde, 0x4df876a2, 0x74777724, 0xd7946149, 0x5e40a669,
-       0x9635ea16, 0x8b6b3ce5, 0x6ec7d9f2, 0x77f71b9f, 0xbedbfba3, 0xe4c771ff,
-       0x4f6ef51b, 0x35edfa22, 0xe5139f32, 0x908776d9, 0xb7c90a67, 0xc2ba778f,
-       0xb788ff3c, 0xedcc38ff, 0xef2d0684, 0x0add6148, 0xb9e2d7ac, 0xbd70d7be,
-       0xc777de51, 0xb2d8fbc9, 0x14bd2fb6, 0xf6e3d1f7, 0x0ddb63bf, 0xecc7e7ee,
-       0x61faeb7f, 0xb96aa5cd, 0x5f5bff7e, 0x327ee21f, 0xb2f2c3f0, 0xeb6afd28,
-       0x936fd1a0, 0xeb074388, 0xf483df4f, 0x392c3c1b, 0xe65bbed1, 0x0cbbf4e5,
-       0xc4f32dfc, 0x3acefca1, 0x238979f5, 0xaa697ff1, 0xcb07ff9e, 0xeaf8a0ff,
-       0x9c9aa915, 0xcdaf7ce4, 0x0fdb8b5f, 0xe24bb3ce, 0xaf37197c, 0x3e353f78,
-       0x99f9aede, 0x6f0f2a97, 0xe387841c, 0x0ffcb063, 0xc6b78796, 0xfda465e1,
-       0x0f2caf8c, 0x35f797ff, 0x35b63a1e, 0xb40efd11, 0x594fd1e3, 0xf3c8cfb7,
-       0xb1fd0023, 0x64b3c5fb, 0x9fef8fbb, 0x7ebd5aca, 0x259d5e1f, 0x5f39e1f6,
-       0x4c84f33f, 0xf628d6eb, 0x398f1b89, 0xdeb4d8bc, 0x69f684be, 0x6f4ff7e3,
-       0xe1660763, 0xa3efc552, 0x2e7e432e, 0xd4fdf2f8, 0xbcc1d4d6, 0x5bcc3c85,
-       0xcbd2aca8, 0x1fec67f9, 0xd66204a6, 0x1c04aabd, 0xdbe86182, 0x725884a2,
-       0xa9adfbcc, 0x467eaedc, 0x4c78f7e4, 0xa5e61d6c, 0x7cd8726c, 0x0c78cfe8,
-       0x47e8ff3c, 0x28edfe29, 0xc0aa2d17, 0x32ef91eb, 0x21e5e003, 0x95c92763,
-       0x8bdda350, 0xdf8b5072, 0x2c7ffd68, 0x592ec1f6, 0xfbd1c7ff, 0x7a65ff81,
-       0x53cfc78f, 0x755f78da, 0xe01b6edf, 0x8c17c746, 0xdc45f8e8, 0x4a1bca5f,
-       0x33f523bf, 0x9cbf1d12, 0x95217fea, 0x226fa2e4, 0xa25c2be5, 0x4795b19c,
-       0x889c60ce, 0x18ab341d, 0x0938c4d7, 0x190dc7e9, 0x5bd26f22, 0x80f29b39,
-       0xbf9895bd, 0xf3fe06f5, 0xc8ed91f2, 0xe1f5c1be, 0x88df6476, 0xecf5f3eb,
-       0xfe9dbbc8, 0x7d6748b3, 0x6f947cd3, 0xf001d6be, 0x0bf87fa3, 0xd3b4779e,
-       0xa773e9ca, 0x2d92e9c4, 0x78a4b94f, 0x7471a7cb, 0x91ffe9f5, 0x8da4b51c,
-       0xbdfe5764, 0x125fe8e5, 0x723a7e31, 0xa79e213f, 0x7843d55b, 0xd8931c8b,
-       0x76b8989e, 0xe0cff310, 0xaf010cfb, 0xe123fef6, 0xf34c2c37, 0xfbc1a665,
-       0x58b35ff7, 0x3e981258, 0x362e5ce5, 0xafb4edf9, 0xf3c9d4d0, 0x30569a5f,
-       0x184de392, 0x78c12d37, 0x98b66ce2, 0x428189e2, 0xfb5b93cc, 0x27243dba,
-       0x0e7dbc61, 0xffaf3b43, 0xdebe5e35, 0xfec62815, 0x697a2b83, 0xce7da31f,
-       0x5587947b, 0xf787f9f9, 0xbc139754, 0x9b704f14, 0x6e25e7f5, 0x0efbe34c,
-       0xa69fd3da, 0xe28fbbad, 0xf3d7eff9, 0xdba0e2bc, 0x84b8c4e7, 0xa9b70f16,
-       0xd0afb43d, 0x6f1b9074, 0x0f9f3295, 0xd11669fb, 0x69c1d353, 0x653718a5,
-       0xb452d69d, 0x6cff2b77, 0xfdefbf27, 0x4f2932bb, 0xe04a68e2, 0x51d7846a,
-       0xed16be1e, 0x07185cd3, 0x0ff7deed, 0x708a5b5c, 0x0b6ff26b, 0xfda1cdc6,
-       0x1e3e8716, 0xdf3c2cce, 0x51d1e1bb, 0x1abcdc5a, 0xf045b3f1, 0x55b7b321,
-       0xef861ece, 0x974f7e35, 0xfa7fd40d, 0x3fb42df7, 0x2d83c9ae, 0x14b01646,
-       0x24c8e544, 0x74183f91, 0xaec5fc8b, 0x453f3cd9, 0xa9e2ed94, 0xf71df3e1,
-       0xaf3849cc, 0x37ca6949, 0x4a72c7db, 0xac7dd8f6, 0xea0148bf, 0xd0c4f317,
-       0xa515874f, 0x22ed8b78, 0x9df3a3b7, 0xc723a226, 0xa7f7c63a, 0x9ed08e80,
-       0x33d222bf, 0x59e6093d, 0x057dded8, 0x45f8f7e2, 0x3293ad03, 0x97da45fb,
-       0x78f89249, 0x5b7a1b05, 0xc61c60c7, 0xb895caf9, 0xb39b6a94, 0x36f8b70a,
-       0xa477fcb9, 0x1737df11, 0xff5578e3, 0x9379e461, 0x5f146cc7, 0x4659cf68,
-       0xaffd9379, 0x3ee7759b, 0xb6219fe2, 0xf324f29a, 0xf691ff0f, 0x25071c07,
-       0xe7b4de1d, 0xbe76697d, 0x99ea156f, 0x5735b945, 0x2abe49b8, 0x421cfec7,
-       0x5569437b, 0x16b0f250, 0x4560cfa3, 0x518ab5f9, 0xbb747f3c, 0x95eb80d3,
-       0x0662f22b, 0x6275ff8e, 0x6d15fc80, 0xf3cc203f, 0xf7bd8c9a, 0xaca61fa0,
-       0x842abdea, 0x65d071eb, 0xa9b8c268, 0xf144d231, 0x8a366396, 0x2e1ee6af,
-       0x282dfd58, 0xd273aee7, 0xd1c0d7fe, 0x6f94b9a5, 0x3d1cf30e, 0x4cef3ccc,
-       0xcd4879e3, 0x63945e82, 0x33ea0336, 0xe2f33365, 0x3e2d79e8, 0x7ef802e7,
-       0x3a2153b4, 0x0816985f, 0x9e0e7ae3, 0xc09e596f, 0x3c28b7cf, 0xfe58e23e,
-       0xdcf12ffa, 0xb7116ec8, 0xfc7c713d, 0xb5f38a1c, 0xfde2122a, 0x51e78b82,
-       0x3fa6963e, 0xf7c51087, 0xcd47ca09, 0xae47f63f, 0xf60da0bf, 0x7d3918af,
-       0x0eeead28, 0x3bf6278c, 0x7b7f9402, 0x4cb74b65, 0xbece63fb, 0x18d5aa07,
-       0xd71b66bf, 0xb9fb4d27, 0xc7ef1e1f, 0xf91e997c, 0xe13ca0ed, 0xfcb0647a,
-       0x7a4fb20f, 0x57c7f4e2, 0xde984ff6, 0x53b78baf, 0x21b8fde2, 0x7f5c7776,
-       0x5a2bd923, 0x745549be, 0x3b376e1c, 0xa4287b34, 0xb2a9c7cb, 0x166bf38b,
-       0x260fff7d, 0x22ff793b, 0x8d6d273f, 0x7d414aba, 0xe28c2ff5, 0x90fe5a73,
-       0xaa142f96, 0x213d79e2, 0xb7ce8583, 0xe51b5879, 0xdd628d09, 0xb4714492,
-       0xa7df865e, 0x7c10be63, 0xf2d2ffff, 0xcc5dffa9, 0x39264ebb, 0xbf084aa9,
-       0x524cf315, 0xf6f0ee10, 0x77de38c5, 0x159e34ec, 0xc8524cf3, 0xcdfe209f,
-       0xd4fcf3f4, 0x7f7cf5e9, 0x30f41321, 0x390b3396, 0x99e75a5d, 0xcb555f28,
-       0x4cf2d11f, 0x0954bc34, 0x598e677c, 0x5072879c, 0x92d947cb, 0xfb44ade0,
-       0x7b0255a7, 0x90d3e71a, 0x784bf220, 0xf90dedbf, 0xaff7a461, 0x8f127f9b,
-       0x650f2d67, 0x3d206272, 0x5e7a22bd, 0xd11fcb4e, 0x3d6626e8, 0xc71dae09,
-       0x555f3db8, 0x0c79a26f, 0x71475c34, 0x030681c9, 0xd55fbd43, 0x1874e665,
-       0x798ede37, 0xfd8dd626, 0xe52b612a, 0xf87a0bd7, 0xd6167b32, 0xbee318b7,
-       0x2fee5627, 0x7fde03e8, 0x3d276576, 0xa752ac07, 0x33ce893c, 0x950947ce,
-       0x5eb8e9e3, 0x6af31cb9, 0x90123922, 0x0fed84d0, 0x353950d7, 0xa79606f2,
-       0x51ae5e7a, 0x8c0c4f40, 0xa096ec8e, 0x2ddb7fbd, 0x99b48cbc, 0x7d3dfa09,
-       0xe4a84d76, 0x363be81b, 0x2aa36f24, 0x37e2953d, 0xbc50f4f7, 0x72bbe848,
-       0x0cd91f2e, 0xabc79873, 0x9d9b8a54, 0x3b23c8ca, 0x7f9c5ec0, 0xb3eb07b0,
-       0x836714cc, 0x53ffa27a, 0x7af1a7a3, 0xcb3faf95, 0x0dfcf072, 0xf9421bd6,
-       0x1a6f2a76, 0x911babc5, 0xb29ec03f, 0x7073023b, 0x3d49cf5d, 0x9c3f2277,
-       0x25cff99a, 0x0ee7e748, 0xe510b4fd, 0xb02635cf, 0x379187d3, 0xde5c1969,
-       0xebed180c, 0x65e7e824, 0xd8fbe07b, 0xf9b6abcf, 0x7cd530b3, 0x1334ca5e,
-       0xa1601d1e, 0xff28c85f, 0xb9fac552, 0xd1fb72e6, 0x612fc335, 0x2b1ae81e,
-       0xa0352387, 0x099ec8f8, 0x03be95cc, 0x09235ff3, 0x49a986fb, 0x6aa887e4,
-       0xcb21fa12, 0x5946b9c4, 0xf82cb7f0, 0x7b2b0ffb, 0xd830150a, 0x2cdcef2e,
-       0xdedfe70f, 0x686fe718, 0x5ce94dcf, 0xd591cf4e, 0x6e1f4809, 0xd7df91e3,
-       0x26c93ac0, 0xbdf1186f, 0xfb41db26, 0x2a3b4fb7, 0xafd0bd3d, 0xe52ffb94,
-       0x26bd5798, 0x71ca5ffb, 0xf64e4d9f, 0xe531fc7a, 0xf52ae94d, 0x21db0337,
-       0xe5cd6cfe, 0xbbfd7f18, 0xfd0497f5, 0xfefd7c95, 0x7331fb06, 0x225996b8,
-       0xddf00a39, 0x03c0d6cd, 0x16177eb8, 0xb3fb49bc, 0x7a9e6677, 0x4e2bf303,
-       0x88cf9919, 0x9c432472, 0x8ebd033f, 0x75cc9ee3, 0xce53f3f1, 0xb113d36d,
-       0xf2e9c05c, 0x7da6165a, 0xfcb99af5, 0xacf5e3bc, 0xda17a5a7, 0xaa31e35d,
-       0x71fc31bd, 0x5f2faaad, 0xd72fac5f, 0x7f8e3c88, 0xdfdfeaf2, 0xd20a22c0,
-       0x7ca7b7e9, 0xfdf62636, 0x2fdf5653, 0x929e8f90, 0xe867de78, 0xfb24e672,
-       0xd0852dd9, 0x64ff199e, 0xc9ff38a6, 0x55ff13f3, 0x4e4f5ff8, 0xb69f5461,
-       0x82c7b2df, 0x2d9e22f5, 0x1ef1fa8b, 0x264dc966, 0x30fa49b9, 0x473c8922,
-       0xb0f1ed37, 0x793bb743, 0x9ada175c, 0x0b439fa0, 0x9a4bc254, 0x42aec0dd,
-       0x10b72bfe, 0xbe7469ff, 0x0af40ac6, 0x651ca978, 0x5dfa4049, 0xc36ef463,
-       0xb304e4be, 0x5a6ffa8a, 0x96fa85a2, 0xfe90a67f, 0x33356558, 0xdc4f9427,
-       0x68654097, 0x44e07247, 0x718c2985, 0xee4235ee, 0x481bf7cb, 0xcc2a567f,
-       0xd01b798f, 0x9fdf1bae, 0x3b50b0c8, 0x7c5cd298, 0xf1a8ca7f, 0xf28534d5,
-       0x1aec0538, 0xf488c13f, 0x57e0ab7e, 0xb3cdf059, 0xfb8d0700, 0x7141dc82,
-       0x05bd5530, 0x632de7cb, 0x70511ce8, 0x629b9cf0, 0x9d8ac1c0, 0xf8bbdf82,
-       0x3f8d3339, 0xd2017935, 0x28b710ad, 0x6d0e3125, 0x3ea1a7af, 0x6b5f6466,
-       0x07edaafc, 0x76b45b66, 0xcffb0f8a, 0x3cd9df10, 0xdcb84279, 0x47fca668,
-       0x7aea5ef1, 0x1fa413ee, 0xaf77af8d, 0x3d7c40bd, 0x3fc5df14, 0x0e75f2a6,
-       0x98f7c727, 0x391fe42c, 0xea164c61, 0xaf2e359f, 0x17298fea, 0x4bcff903,
-       0x3b407c46, 0x7d58df28, 0x918950aa, 0xe70f36f3, 0x4be76857, 0xb09f7c01,
-       0x67c859aa, 0xc8db8cc3, 0x7dfdb5c7, 0xb8c0f5c7, 0x0384eed0, 0x7b7685c6,
-       0x436ee6ad, 0x4fe370e2, 0x2fbc7151, 0x6eb1971b, 0x04eb9e22, 0x420e815e,
-       0xe13a3718, 0x5e3d1030, 0x4f7bf227, 0x58f1f2a4, 0xa65f3eb1, 0x40d0e810,
-       0xfcfa58f9, 0x9da46b98, 0xb6efa82d, 0x20f7135a, 0xe8273ddd, 0x67eda4e2,
-       0x3cef6885, 0x59e8bf37, 0x92b3eb94, 0x9120b556, 0x893ac75c, 0x757935ef,
-       0x4acde321, 0x1adc832c, 0xbff581e7, 0x7cd4ff33, 0xd759fcec, 0x5fd442d6,
-       0x7bc60f20, 0xafc28752, 0x37069fd1, 0xfbd221d2, 0xc1c61d20, 0xbb11d1af,
-       0x0b1293a1, 0x88bd8177, 0x047ecd4f, 0x91e7884f, 0xf9d1d9ab, 0xb2cf1101,
-       0x3479f334, 0x6bee0884, 0x9e500f5c, 0x0199e5d9, 0x69d6079f, 0x720fa4de,
-       0x59ec6c14, 0x76e30630, 0xffb4ef00, 0xede3784b, 0xa7cb2fe5, 0xb58f891e,
-       0xfb39a5f1, 0x383a9f29, 0xd5f94ed7, 0x693e45d3, 0x7140deb0, 0xc8abf074,
-       0x96626f1e, 0xa9ddca30, 0xf2d5bec2, 0x3c4a8ffc, 0xc27a193e, 0xb18beeac,
-       0x59e68793, 0x1dc794ab, 0xb1f3c15a, 0x46e0ed07, 0x9060ec95, 0x0573badb,
-       0x765ca5ed, 0xd2aedfb7, 0x24a79979, 0x80b43ede, 0x7db3dc51, 0xe45fa8b6,
-       0x58f76b0c, 0x7cd16948, 0x460ef6f7, 0xc8eedff4, 0x594cfaa7, 0x16fdcb9c,
-       0x79ed37d7, 0xbf6c4fdc, 0xb7ea88b9, 0x52c78424, 0x87d88f5e, 0xf5fb81df,
-       0x7f1fb05f, 0xe3f3479f, 0xb0751c78, 0xa38a77fc, 0xb40cea3e, 0x2a2dfd21,
-       0x8118e5f1, 0x3c4cea5e, 0xbaf40a9e, 0x7a6187b3, 0xfa21735f, 0xe6b2d73b,
-       0x44050c57, 0x2e905baf, 0x7a078de7, 0xebd1d02d, 0x97054f56, 0x469708db,
-       0x5a7483af, 0x17379f1c, 0x76fb6308, 0x9b9fe757, 0x32e83fd0, 0x30de797b,
-       0x978c83cf, 0x2cf0310f, 0x6e3c3854, 0xf6782659, 0xc1c4ff13, 0x137c2973,
-       0x8ce9a74b, 0xfc48c7f3, 0x90b0ae93, 0x3fca2ca3, 0x4f03594f, 0x7c83b8e2,
-       0x0bf70f74, 0xdb2dc087, 0xba6e9e89, 0x0517ef99, 0xe3ef5c6d, 0x8c0651be,
-       0x7f8c5b3f, 0x867fab53, 0x96cddb0b, 0xe1ba1e38, 0x1cff007f, 0xabbb3f51,
-       0xe6c6f291, 0x8e9e30cc, 0x793473b5, 0xcd53eda9, 0x746fed13, 0x1e6236ce,
-       0xfd1adcf7, 0x5bbcd0fe, 0x4dd4fef8, 0xccfdf573, 0xa03e1b63, 0x6cd646fc,
-       0xbbcdfc44, 0x8aff5f45, 0x695f7067, 0x3d2bee0c, 0x0329e22b, 0x47c827c0,
-       0xb25d4dbf, 0xf3a076f3, 0x292f3f31, 0xcccf38c3, 0x9bbd86b4, 0x8ee8fca1,
-       0x6dfe5471, 0x747ff7da, 0x1777eb0a, 0x41867951, 0x90c7e7e2, 0x8acf810f,
-       0x2ebe6f2b, 0x89f5112f, 0x4676f7e8, 0x81093def, 0xced0d9f6, 0xf29f3133,
-       0xf888673e, 0x5e22c0c0, 0x0724fd7f, 0x55bded4f, 0x8ceaf8a5, 0xe47cc884,
-       0xff4b1783, 0x90f30cb3, 0x728be467, 0xb0e353d9, 0xc1f4acfc, 0xfd67d47c,
-       0xd705768d, 0xc79329a1, 0x4b17c7a5, 0xe22763dd, 0x7fd12c79, 0x4d579f23,
-       0x91322fd9, 0xf154664f, 0xa77bc67e, 0x3b6016b5, 0xf72a79c3, 0x11125a67,
-       0x19bf1aff, 0xd9a41f84, 0x27217e8d, 0xd9bdf49e, 0xfafd0292, 0xa717922d,
-       0x26f29fe8, 0x9d9817c5, 0xfbf3a79f, 0x6b8c14f2, 0x3cf1f74f, 0xd8ab6dd5,
-       0xb6f3b42a, 0xd653e95d, 0x0b74fd40, 0x7a04f5a3, 0xbd206537, 0x2720fe4f,
-       0xaecc8911, 0x9e8d77a7, 0x3e746b66, 0xc0cf4f43, 0xfefc76a7, 0x8eb5e4cb,
-       0x7a51ad9e, 0x09ce291e, 0xa0646570, 0x5e96f85c, 0x138e0d8f, 0xe3f18fc7,
-       0xf027248e, 0x46de562f, 0xbe24ebe1, 0xbfecc2cb, 0x36cbe402, 0xe1c72f8d,
-       0x1e864cfc, 0x2b943f3a, 0x01d1c779, 0x0b5e29dc, 0xfe38b9e9, 0xc6cbe0d4,
-       0x50d972d8, 0xd14ff0b8, 0xe7fe50ec, 0x9643f8c6, 0x7cef87a8, 0x170a392c,
-       0xf1153f8c, 0xf0e1eec0, 0xb99a92ec, 0x867e115c, 0xd268b716, 0x3f587be6,
-       0x7e04cadf, 0x7183df8e, 0x285bda26, 0xf708371d, 0x3683ac25, 0xdfd0a09f,
-       0x877e2d73, 0x1df6e609, 0xcfd11d57, 0xba834177, 0x811d5d70, 0x279c236f,
-       0xe863a10c, 0x3e622d8f, 0xfa065fda, 0x445467f0, 0x37834bd7, 0x234d4f1e,
-       0xf9f8d1c8, 0xba27e3c4, 0xf8193d6e, 0x0de7ced4, 0xe712f7ce, 0xb89f6f19,
-       0x5f78fa4d, 0x25cb88b2, 0xc570e347, 0x12c35f58, 0xf38714bc, 0xd5bfe44a,
-       0x7281bd80, 0x519aa6b9, 0x6ed9243c, 0x669c38a0, 0x27c48c77, 0x48c55f57,
-       0x632cd54e, 0x9f205ce2, 0xa63d3c5f, 0x931fdeb3, 0xb7516bff, 0xaf7e442f,
-       0xf0f2ebb7, 0x6e3cec6b, 0x1b935ebf, 0xf502b7ac, 0x887960fc, 0x40adef9e,
-       0xff7f13b9, 0x1e45cd57, 0x28be4e2f, 0xfbc6b3d1, 0xf9ea0566, 0x0adeeae4,
-       0x240f5f94, 0x75c5eef9, 0xe3c0c37d, 0xdcf8f1ea, 0xe2d0619a, 0xa74497c5,
-       0x78347cf1, 0xd811dace, 0xf168e381, 0x0f5273a4, 0x38a64f8f, 0x3c81ff45,
-       0x4ba067a4, 0x20669a23, 0x1cff3f27, 0x37fc519d, 0xf726ede0, 0x7b9c9aed,
-       0x18dce498, 0x5cfdd7a1, 0xbe9cf89e, 0x4e1c19bd, 0x021dcbc2, 0x9e85332f,
-       0x2653bf3d, 0xaf86643f, 0xa16e2b78, 0xb2379f04, 0x8fb1f130, 0x8f76a3f4,
-       0xa83079d7, 0x63fdb1ba, 0x4bb7d20e, 0xfda3a85e, 0x0cdb31a5, 0x97d18d4c,
-       0xba09c363, 0xefc641fb, 0x2795d64f, 0xdaea6674, 0xaf9c3a4f, 0x1eed2fab,
-       0xecbfaba7, 0xb95d32f9, 0xaeaa67a2, 0xab57e4fd, 0x7bcbe574, 0x7fb5d3af,
-       0xe03df504, 0xccef5bf5, 0xefffbdd1, 0xc79eb31d, 0x232bdcfd, 0x7f7dd3df,
-       0x5819c446, 0x0c53d7c8, 0xd1a85ff3, 0xdd5ac5ef, 0x74d660f7, 0x0728954b,
-       0x0dc2dff8, 0x1a7d4f3c, 0xbfb62c60, 0x7b7a6d45, 0x508b2662, 0x58535f7e,
-       0xcc3376f2, 0x37d7d353, 0xbc20ee1c, 0x013dd97e, 0x0c0bdc63, 0x197d0f48,
-       0x858c6760, 0x14b0a47f, 0x891bb3cc, 0xfd6cbfff, 0xd7e1588b, 0x47b37f5a,
-       0x5556febf, 0x62b6febf, 0xbc3bfafd, 0x9a4ff5fa, 0x977f5fa2, 0x29febf4f,
-       0x4ff5fad5, 0x3fd7ebf5, 0xfd7e9e7d, 0xf5fa0233, 0x5faf551f, 0xfd66ecf7,
-       0xd72ee77a, 0xe85e6baf, 0x36fdfd36, 0xd1a07471, 0x0b4f2693, 0x7711ddd6,
-       0x19818e1f, 0xa342e862, 0x7afe85b3, 0xdd1a5fca, 0x78dd13f6, 0x8631f4f1,
-       0x6fcbbc89, 0x99851f48, 0x7f981740, 0x3f92cc99, 0x1bef3d27, 0xd43a999d,
-       0x56e4d0be, 0xf58f3eac, 0x6792478f, 0xf094f443, 0x53d44797, 0xa35b2fe8,
-       0x7448f2fe, 0xfd031afa, 0xa06f834a, 0x4ecdd838, 0x0489c70e, 0x887fb76e,
-       0x3b439755, 0xe0053368, 0x03e70d7d, 0x3096bfe3, 0xdf1de29e, 0x1c469d63,
-       0x43d616f7, 0x422cf9cf, 0xea7300cf, 0x642c7dce, 0x7f88937e, 0x8159975c,
-       0x4ade9171, 0x1617a394, 0xf6837a9c, 0xb94c5eb3, 0x4e327ba4, 0x68c97ee3,
-       0xb90acec6, 0x26fb87d1, 0x8ab7ee50, 0xa98fa078, 0x9e7c18ee, 0xdacbf115,
-       0x57e912e9, 0x7e502726, 0x2577ed57, 0xffb54fd2, 0x99759fc3, 0xff1eae3c,
-       0xc35cb35c, 0x0bb09b6b, 0x5f707db8, 0xbbf54aa6, 0xb276aa60, 0x944ebd43,
-       0xdf1fd0ff, 0x44d878c7, 0xc2c7b9fe, 0xa29504e1, 0xe3a64c5c, 0xb8eeb474,
-       0xcbee78fe, 0x4df0e163, 0x22e59850, 0x02cf1fbc, 0x95de1764, 0xdffd4f99,
-       0xe38880ab, 0xfec38ffd, 0x15684a3d, 0xc07fd1c5, 0x5bf471f4, 0xa38a259a,
-       0x85e000ff, 0xf5e9c7a7, 0xcad61ea0, 0x33bc05ab, 0x4fbc1db0, 0x184b34f7,
-       0xfdbafaff, 0x78c3f60d, 0x7887f83f, 0x59a1e2d7, 0x58668740, 0x603fbdd7,
-       0x8f8bcf14, 0x41928e8b, 0x93fe63a2, 0xf7ab9f91, 0x9fb8db28, 0xd4ebd27a,
-       0xd1987dc5, 0xbf20e785, 0xbcc2decc, 0xe731b3e5, 0x87bd600c, 0xe9747fbd,
-       0xbf2fbe28, 0x31676566, 0x4fd88dd1, 0x7ee57bbc, 0x978acb2a, 0x3ef10af2,
-       0xf7cc572a, 0xc7d43726, 0x8762bbf0, 0x90e463ef, 0xcba7eed1, 0xd959ee57,
-       0x4678fb43, 0xdad66f71, 0x819c3bac, 0x2fc77898, 0x631d8533, 0x1a673109,
-       0xfc37a613, 0xe19d33bd, 0xe54ecafa, 0xcb5fac6c, 0x886c979e, 0xcf4146b7,
-       0xd7ba092f, 0x607b36e0, 0x5eb818bc, 0xe8def412, 0x3ce131ec, 0xe8b5825e,
-       0xd2b4b8c1, 0xd3fba6e3, 0x1c93716e, 0x83ac41ba, 0x8dd4a0f9, 0x0acc4ae7,
-       0x5ec5f99e, 0x832fda7a, 0x64bcf726, 0x76efb864, 0x2435c54f, 0xcdc94d4f,
-       0x8fa06ede, 0xc8b4be1f, 0xaf061819, 0x51ecd3da, 0xc5cac42e, 0x5f8532e7,
-       0xc64d993e, 0x1e061975, 0x743f93d2, 0x587e6ff2, 0x7e58f3c1, 0xf94603f8,
-       0xfc396ced, 0x94f14655, 0xf724bcca, 0x2f422c5c, 0x0604ac37, 0xe8f6031c,
-       0x980b0b4a, 0x66b21f41, 0x98d2d3b2, 0x4369e88f, 0x3ade8be9, 0xf65ecef8,
-       0xcff462bb, 0xaff8abef, 0x2a3b2c66, 0xf2c7af5f, 0x758fb1fa, 0x1d9a0e62,
-       0xde537161, 0xe0af1850, 0xaff7184c, 0x3b6357fb, 0x1f798f7c, 0xe01ef0d5,
-       0x574277b9, 0x26dbdb04, 0xeb077d1e, 0x96ddec13, 0xe12ef802, 0x0055e616,
-       0xf2dea95f, 0x74f00569, 0xb02f4395, 0xbdf136d4, 0x37ef0a6d, 0xdd26bf7e,
-       0x43df87be, 0xfb130573, 0x045efca2, 0xd5233f6d, 0x0aada7be, 0xbea156e5,
-       0x8f8141fe, 0xcfe3fb14, 0x303d63e7, 0xad1668dc, 0xbbd4407f, 0x54f78fec,
-       0xdd165cf1, 0xff459bf7, 0x97037649, 0xfb132a57, 0x937ebcb6, 0xf56ab7a8,
-       0x65f6261e, 0xa8ab7d79, 0xde79db37, 0xeeb7b012, 0xfc62b5fb, 0x2c0c5bb4,
-       0xeecf4310, 0x102c09b9, 0x35c91f43, 0xd1b2bac9, 0x3b25cfce, 0xbeea6467,
-       0x5bbdfad3, 0x45789b8c, 0x4b3beebe, 0xfb7d38e1, 0xcfa4c9b9, 0x367810ee,
-       0xeae99565, 0xacfef3b5, 0xf273b45d, 0xaa7b8a76, 0xaaf3dfae, 0xe072849a,
-       0xdd1ae5ec, 0xb7482d7a, 0xd3f23877, 0xbc21bf71, 0xa3353a12, 0xa788b13c,
-       0x683d3c53, 0xa553c05c, 0x7b889e72, 0x853959ae, 0x6e807bca, 0x95a1feb1,
-       0x82ef2a5e, 0x9fcf0ab2, 0xbc2a3f43, 0x60fd0edf, 0x83f42b79, 0x1fa107cf,
-       0xe3003e7c, 0xf866fd61, 0xa09bcb0e, 0xb7df2c3f, 0x7be547d2, 0xb9535657,
-       0xca9fa575, 0xa3ce576b, 0x032bdde7, 0xb2b35cf4, 0x8e67ea9e, 0x6bedfae2,
-       0xb39405e7, 0x9980bcf8, 0xe7a22aa3, 0x80bcb43a, 0xfef0d30e, 0xb8a3cddc,
-       0xfe65cc1c, 0xfe9c2da7, 0xecc89ee9, 0xa34f9d0d, 0xe7e29bdf, 0xa1b191eb,
-       0xd55dea99, 0x3bed1c7c, 0xacb10ee6, 0x158c7e4a, 0xea4bf5db, 0x1997ca6a,
-       0xcceae3cb, 0x256a6213, 0xfe974ebf, 0x13e90894, 0x5f2f58a5, 0xdfc3ccf3,
-       0xe3101d53, 0x3ecd85c8, 0x8a658e9c, 0xc4f31bbf, 0x9d00deed, 0x08bdcfef,
-       0x9b1f839d, 0xa62af174, 0xaee2e982, 0xc9d1dbd1, 0x7674ca33, 0x89b17caa,
-       0xbeb259da, 0x72676ba7, 0xd5daead7, 0xc7bbcd2e, 0xc518f883, 0xb0de61e7,
-       0xb8c0658a, 0xd337da8b, 0xbac5ebb8, 0xbdf97cc1, 0x3e2407d6, 0x3dbf615f,
-       0xb5f314ea, 0x3ab9206c, 0x458bc5c6, 0xca032149, 0x9d7ff7c3, 0xc8fafc44,
-       0x478a0643, 0x0361658e, 0x5078d7ae, 0x813f58d3, 0x127952f5, 0x9728574a,
-       0xf2c65532, 0x7e422c65, 0xab6fd82e, 0xe49b9d71, 0x285643c0, 0x3c0ecb9f,
-       0xba91f3ca, 0x8914af49, 0xecd228f5, 0x7c4a6dd8, 0x28dd6f7c, 0xe7f58ff2,
-       0x9bf7e295, 0xd32a3957, 0x1fe8fed1, 0xe6cc7f21, 0x42dcf339, 0xe32dbfc0,
-       0xef6a7a4d, 0xc30d55ef, 0x787de39e, 0xf2cdf494, 0xfbfac33e, 0x1fde81b8,
-       0x2b9c79c6, 0x5e6603f9, 0x08c2a6b1, 0x8c6b09f9, 0x93509c9a, 0xecb63d98,
-       0xf331624d, 0xabe56478, 0xec090a05, 0x764de100, 0xe7cc746a, 0xea527f2b,
-       0x22a63cc4, 0x7fb93791, 0x8ce14665, 0x7befd1d1, 0xb3141d04, 0xc5ff924e,
-       0xfc97836e, 0xe7539f48, 0xdb0b5a77, 0x445e787c, 0x98bcc71e, 0xb5963363,
-       0xf96b39d1, 0x23c9326f, 0x4cb5c4f9, 0xc123bb05, 0x7b216619, 0xfc265fb4,
-       0xf9091fd7, 0x067d91f9, 0x68e72fc1, 0xc8f9e1f7, 0xe9c8f9de, 0xd49e6275,
-       0xfa46ed47, 0xafad3e48, 0x5f7a762f, 0x2e9d000d, 0x22f3683e, 0x6dc50978,
-       0xbca03f74, 0x1259625b, 0x20f3c1c1, 0x6cbdb993, 0x42c956dc, 0x1b579eb0,
-       0xbf098702, 0x8321eabd, 0x5da1fca6, 0xee898a63, 0x78831f67, 0x6e5e23b1,
-       0x43819c2e, 0x1e131617, 0xbf798917, 0x26b1e625, 0x80bfc35b, 0x787cf987,
-       0x76e2e09f, 0xcfd6efcd, 0xaa92def3, 0x4b7d636f, 0xa0f94c8f, 0x973cf8f1,
-       0x44c4a7f8, 0xf1daf058, 0x70046e3c, 0xa0fc85be, 0x8829dc20, 0xb69fbe5f,
-       0xe30a69c4, 0xa97ee039, 0x30f29ab3, 0x7f281827, 0xdf2e9e35, 0xf368f617,
-       0x6d3d2728, 0xcf44b39e, 0x73df72d1, 0x7fc8530b, 0xaed67ae0, 0x9f16bcf0,
-       0xf78d8d4f, 0x28e2d7ad, 0x413f5f22, 0xdf783bc0, 0x479e38d8, 0xdb3d6768,
-       0x24664f30, 0x9590c6bf, 0xc0d7e717, 0x54fd20d2, 0x651f2858, 0xa4e796bd,
-       0x8f29529e, 0xe7989e1b, 0xba741164, 0xb9efc1d6, 0x3a37e6d0, 0xd1d1cb8b,
-       0x06ff9c59, 0x86de5a2c, 0x2634a6af, 0xabb6bfff, 0x6d75fc8e, 0xc4406a3f,
-       0xf4120649, 0x820d47fb, 0x6d9e0614, 0x7dc04aab, 0x1fbe3690, 0x3d75d0d5,
-       0xd8f2efbf, 0x285f7403, 0x3d22a9f4, 0x75f689d4, 0xfafef4eb, 0xe201fda2,
-       0x4078f8d7, 0x980fffbc, 0x1e5da133, 0x67e7ffef, 0xcbdf7f09, 0xe9bf714a,
-       0x938286cc, 0x29b70009, 0xd1b9d18f, 0x74e3f251, 0xa5583bef, 0x26cf786d,
-       0xcaf7e12b, 0x0fffafc4, 0x97844db2, 0xdf5f12fd, 0xf13b68d0, 0x2e0afec1,
-       0x7d3ff607, 0x28d186fe, 0x7d2572cf, 0x91ae713e, 0x818b77df, 0xc9df787e,
-       0xf970f558, 0x0cb23362, 0x5fcf4cdf, 0x8d7b97a1, 0xda4f7b87, 0xd37f9254,
-       0x4f3d70b3, 0x84b125fe, 0xf74228f8, 0x83b9a3e6, 0x78dc21e3, 0xe180e36e,
-       0xf4b1f983, 0x452cddf0, 0x66f86dc0, 0x1e8678f2, 0xaf2573ae, 0xe1c75da4,
-       0xf50b29ba, 0xb4e9f763, 0x0d7c7cd8, 0xc35503ae, 0xf86e2b9f, 0x029a78a6,
-       0x8b0e54f0, 0xc22ffaa7, 0xf0d301d3, 0xc04cfcf0, 0xf2cf6ff3, 0xd6862efb,
-       0x6dfb437f, 0x1efe1c67, 0xc509b9eb, 0x33fbc036, 0x2fa79fc2, 0x04c2f68d,
-       0x05cb3afe, 0xf90b967d, 0x895f25e3, 0x4c9f5f05, 0x0a9d64f9, 0x72c1a94b,
-       0x2aef42e5, 0x4a7f7a35, 0xfca010d0, 0x79baf67c, 0x4477f958, 0x990385c8,
-       0x3878b0d2, 0xf4f9e628, 0xa8b9b58b, 0xd57dee67, 0xb42e50cc, 0x5efdfb08,
-       0xef05a767, 0x88f0d59f, 0x067832e5, 0x5ec5914d, 0x647f972c, 0x8cc3ed51,
-       0x6de3e067, 0x6d1be38a, 0xabf9ed3c, 0x0fae62ac, 0xcc6567a5, 0xc574dfdb,
-       0xd42f742b, 0x648572a6, 0x7fc6d7ef, 0xce5e9ebb, 0x7692bf75, 0x5f97a703,
-       0x4934bd21, 0x1b7e256f, 0xf22941ca, 0xcbee0972, 0xff34029b, 0x43b1e020,
-       0xeda78a1a, 0xf9b45e82, 0xe0d7f369, 0x90b95c76, 0x9af1c1d6, 0x41c69499,
-       0x17d35ed1, 0xe1ff4249, 0x5c5f48bc, 0x0f73f0a1, 0xfbad0a15, 0xe95329a6,
-       0xb101ca5c, 0xdcb91e2f, 0xf83dec34, 0xf76f027d, 0x0f63fc5e, 0x2ea1b5fa,
-       0xc00bdd23, 0x8dcf5e94, 0x4bf12f78, 0x0c33dd0a, 0xf78d54f4, 0xe2fd3d1c,
-       0xf3b444f9, 0xf2e2ccde, 0x2e2ccdec, 0xca2e070f, 0xe45e74d5, 0x729c8fc5,
-       0xce9ffd0c, 0x4d3ec592, 0x039e0f4f, 0xf3c658d9, 0x1ec2eddf, 0x57d8bfb0,
-       0xa7dbf08f, 0xc52cc4fc, 0xb21fdbd0, 0x46d704cc, 0x0bcd2453, 0xc98f05fd,
-       0x82ec9bac, 0x6dafba5e, 0x939b9cf0, 0xfca9a1e3, 0x8ef68659, 0xe3df8bbd,
-       0xe54b3a76, 0x3ee01672, 0xc613ef04, 0xc3ace47e, 0x2f1872fa, 0xc3bdfa3f,
-       0xa133d7c9, 0xb2a3df82, 0x383f8ae9, 0x24b89ef1, 0xc7fdd189, 0xea36c83f,
-       0x57ada1ce, 0x2cec1cb9, 0x3b41e9ef, 0x2854e42e, 0xfbb3a72f, 0xfbda0b0e,
-       0xf2f85f1a, 0x8ad7bcf8, 0x4ed77cfb, 0x39e30e29, 0xd78e8d14, 0x202e0764,
-       0xbe046edf, 0xafec9c78, 0xc274ff1e, 0xf314b38f, 0x1eb0275c, 0x9586afba,
-       0x87c89c9b, 0x8e8306c5, 0xe6c9aedf, 0x413da374, 0xf3dd93fd, 0x9abb4163,
-       0x2c3b97de, 0x7db5cf0c, 0x1276717c, 0xb672a7da, 0x9d79ef66, 0xed8fc788,
-       0x7c4ec973, 0x0df6b7fb, 0xda0779b1, 0x73f02df3, 0xcb44c7bb, 0x59febc8b,
-       0x0b317ed8, 0xe97683dc, 0x775976e2, 0xc16dffde, 0xda2e8be7, 0x9d8c7758,
-       0xf7ca68bf, 0xa2d2bce8, 0xfef4898b, 0xf49f916d, 0x2a4bc8b6, 0x8af0f314,
-       0xdfd915e7, 0xc6f7fed0, 0xff5dcbc9, 0x972d48f9, 0xd0d98597, 0x6bd4a36f,
-       0xe36a7f42, 0xb9d0bfd4, 0x7fc0b791, 0xd17f36ef, 0x7758533c, 0xed83b8cc,
-       0x77595a2e, 0xa8baec4a, 0xbe747704, 0x6b7faa76, 0xf04be7a5, 0xc7874a38,
-       0x3a05ff68, 0xbfed0e3c, 0x5adfea88, 0xfd25fc59, 0xffa11f8f, 0xd1fc1d3c,
-       0x7de90b7e, 0x47da89ff, 0x272fc06d, 0x78ef57ba, 0x8eebf30a, 0x7cfee99b,
-       0x8ab3b876, 0x92fdafce, 0x3bc6b9d1, 0x06f27f8f, 0xb9ddcde6, 0x31c5e4c7,
-       0xf9918c06, 0x43f461de, 0xf0867321, 0x79ed291e, 0xcd017643, 0x45bdfe27,
-       0x0f313b09, 0x38ac52ce, 0x58593f51, 0xf135784f, 0x93e48583, 0xfad79716,
-       0x2672871d, 0xf76a3e46, 0xf62bbc85, 0x0b60ff8d, 0xc0aecc2c, 0x8157f732,
-       0x9c623773, 0xd961e1ad, 0x7421efc9, 0xc5a23f91, 0xf3f415bb, 0xe3d4300a,
-       0xe3fe7867, 0x4b03723f, 0x0e7e6e91, 0xdfe300e2, 0x01bd84f2, 0xff0a4f8a,
-       0x8f6b3eef, 0xf7231bc7, 0xdf2b6456, 0x8b6fdf4c, 0x7f1537d3, 0xeb9ba47a,
-       0x8f38159b, 0x57e7b946, 0x8e7879b5, 0x1bdc57a9, 0x5bdd92a5, 0xee927e5b,
-       0xfcd5ab97, 0xfbf175f9, 0xb42ed9ec, 0x7cf8b583, 0xa13fe622, 0xf3c8dfbe,
-       0xbc6cebef, 0x14fbf75c, 0x4789cf3a, 0xef104a45, 0xdf97b29d, 0xfc24e82b,
-       0x0f30179e, 0x20e63658, 0x9e04077e, 0x433d77cf, 0x5f9e18f7, 0xa0e89a37,
-       0xa53f37ee, 0x640ec97b, 0x63acfc8a, 0x7543d20e, 0xde256f66, 0x93207793,
-       0x4a9d9bdb, 0x8c596277, 0xab36b9fd, 0xfbebe48a, 0xd01b46eb, 0xbaf0d73e,
-       0x8d85c853, 0x89503c5a, 0x6dfde254, 0xbf7797ef, 0xa0f07a4c, 0xc6e77e95,
-       0x4a93e870, 0xa3714fba, 0xafa5ee99, 0xcb76343a, 0x2c6fa83c, 0xa8be5032,
-       0xe09590e1, 0xdf9eb739, 0xa2df84ef, 0x343c6ebe, 0xa80f7e8a, 0xbca116ce,
-       0x6f04c6ae, 0xd497ee11, 0xdd16fa1d, 0xbee67f27, 0x372839b1, 0x39aaa74f,
-       0x7dee7f74, 0xf7987480, 0xf86363e9, 0x74c9d6fb, 0xd1b1d25e, 0xae2e1816,
-       0xf893e9a1, 0x640ea3fb, 0x461ff696, 0x78b58cfc, 0x917940f7, 0xb8b03f76,
-       0xf9eeac0f, 0xf3151cc8, 0x557f85ac, 0x33ef7f67, 0xfdadf7ba, 0x3d385bcd,
-       0xcd027df3, 0xb71f8b3f, 0x039de84e, 0xfc7cc8a6, 0x35baa67d, 0x9e26ff02,
-       0x28675687, 0xd327dfa5, 0xee31bff0, 0x0457d57e, 0x99e7b5de, 0xb7ba1517,
-       0x1c81ec0e, 0x733a57dc, 0x76f44cdc, 0x3a78e366, 0x578dad2f, 0x0271b807,
-       0x564e9e9f, 0xfefae227, 0xbaafc859, 0xd4efdc35, 0x3619d7de, 0x477ae357,
-       0x6f94c98e, 0x248ce033, 0xd6887ee2, 0xce0f2b4e, 0xdfa64ba7, 0xf9903a19,
-       0xd03bad34, 0x32ba4315, 0xfa41c6fc, 0xfe1bf836, 0x97ef457b, 0xf50d90b3,
-       0xf266abf4, 0x331c4ed3, 0xf03c1d93, 0x3b773f1a, 0x7b2f1ee4, 0xadef0724,
-       0x1466fe0c, 0xec81b5c9, 0x376e6ec8, 0xb8dee95b, 0xc9815381, 0x432cff62,
-       0x81978bdc, 0x6385daf6, 0xd7b46ed6, 0x20fb49e0, 0x43d7b621, 0xe8db8fef,
-       0xd2780ffe, 0x1d260939, 0x9cefd0f4, 0x7df136b0, 0x677f7d0f, 0xca0c604e,
-       0xa00b3be9, 0xdf7e3b7f, 0xe42eed47, 0x19612607, 0x78c532fe, 0x766fd499,
-       0x4bde9720, 0xeff8791f, 0xfa89b47b, 0x9a0faa1e, 0x1e699303, 0x8eb0767f,
-       0x4df9e661, 0x2f7b7fef, 0x9be4853b, 0x99e03706, 0xbc78bfec, 0xe20c7278,
-       0x3e385df7, 0x7072e9e2, 0x3e04bf3d, 0x5f90a78c, 0x71d7c5d2, 0x971358fd,
-       0xc9e3ad27, 0x431ba5ce, 0x569af262, 0xe89b7b1d, 0xdbe8c072, 0x72297a8a,
-       0xbdf8c8ca, 0x6019606a, 0x6f0a619c, 0xfce36757, 0x9ef1c1a4, 0x686e6fc8,
-       0xef4f79e5, 0x9cede2fd, 0x273c7605, 0x9ceeb6fb, 0x83f716ac, 0xae31124e,
-       0x89aaf762, 0xdedc25b5, 0xfe2e0996, 0x8d1b4dfb, 0x554efd2a, 0x14b1bee8,
-       0x5263384f, 0x8ebdd10f, 0x901827eb, 0x5cbd5a9e, 0xf8da84f6, 0x9afbb4bc,
-       0xe2977bb4, 0x9cddf2f1, 0x38bbfe02, 0xde2b702c, 0xa99a7dd9, 0x8db36269,
-       0xc7ab9fee, 0xebca017f, 0x2b3e0d0b, 0xbd25bfcf, 0x379ef430, 0x8efc97d3,
-       0xf96dffd5, 0xe68cb907, 0x250dead9, 0xc77d5ea2, 0x583efdc9, 0xbbf4953d,
-       0x7749e7cc, 0xbea066e8, 0x939adff6, 0x0724f54a, 0x7d7891df, 0xf2699d3c,
-       0x903e086e, 0xfc5fb06e, 0x3dbefa0e, 0x48d5c787, 0x79bde058, 0x7ba2642c,
-       0x0abe8461, 0xcf018a4a, 0xd4b9f775, 0xbecba444, 0x55e482d6, 0x52e0a798,
-       0xe862cad3, 0xa32cf824, 0x9e2accf3, 0xbf8c984f, 0x889be273, 0xc903bcf1,
-       0x3c4238fa, 0xeb4f8f3c, 0xff5b1f9d, 0x772e1cd3, 0x1fb8735b, 0x261cebf8,
-       0x3c78feec, 0x22583a72, 0x1bd5a0e8, 0xcafc8ab8, 0xb64b76b8, 0x88fa0925,
-       0xd4f6df7b, 0xcabe533f, 0x85bdfd4e, 0xde3d6235, 0x9214de79, 0x8133e126,
-       0x37eb8df2, 0xff577973, 0x5dd14d42, 0xfce74cbc, 0x4ddc75a7, 0x70b30fbf,
-       0xc622cccf, 0x8bad17e5, 0x730b9f46, 0xdf68457c, 0x4ecbb645, 0x6dfa93e4,
-       0xaad3c132, 0xc3b659b4, 0x8cdbb3fb, 0x0bd5f764, 0x0566ce78, 0x14dd6912,
-       0xef0098a6, 0x22409567, 0xc5dbb5d9, 0xcdc4e0ef, 0xa2bdda03, 0x1f830d94,
-       0xc2675f0b, 0x7430c14f, 0xeb40ca70, 0x898130b4, 0xe89347df, 0xecd9c79c,
-       0xee58adc0, 0xee9e7f03, 0xa06b6e9f, 0xf1e2557b, 0x2012d67d, 0xe6225d7a,
-       0x7e33e1a3, 0x039f0d1c, 0x9fb44f88, 0xfa41df9e, 0x8ca0f82f, 0xee9ecc14,
-       0xecfc90fa, 0xbe66c769, 0xbf7c2df1, 0x1518ec19, 0xcbfe6df5, 0x077d47df,
-       0x98ed0a72, 0x690563da, 0xa36f4e2c, 0xd2fb593f, 0x8c4344dc, 0x976d6cbe,
-       0xb5a59f69, 0x22e24e70, 0x06fe7f6a, 0xaad3afa4, 0xa62cad37, 0x9a392bdd,
-       0xaf5fa93f, 0x4d7fcdba, 0x37ea71c4, 0xda5e6918, 0x4c000cba, 0x6cdb8724,
-       0x81ffa461, 0xabf508ac, 0x7d20d3ad, 0xf4683ae3, 0xcd3eed04, 0x78718a71,
-       0x2f2fb6bc, 0x861de950, 0x003f164e, 0xdb7f62e3, 0xe69f741c, 0xe1ab8ea5,
-       0x05bd7063, 0xd719535f, 0xc51e7771, 0x14a70dc7, 0xdd3f064a, 0xf20e4d76,
-       0x07d81d71, 0x93a88718, 0xbdd06f22, 0x74ccc7a6, 0xe6dd6fef, 0x78e2b7a5,
-       0x0d99af75, 0xfc77df58, 0x5704899a, 0x9e02badc, 0xf7a38672, 0x8e48bc81,
-       0x607f0637, 0x6b7f1057, 0x9b8189f3, 0x8b3f00e0, 0xc819c5ee, 0x918cf583,
-       0xe1cd7f03, 0xef681af1, 0xf37d1134, 0xe706997b, 0xaf9b8ceb, 0xafbe6e33,
-       0xe66fa230, 0x167cd00d, 0xe0366ebe, 0x5ff785fb, 0xb771845f, 0x69d3f5be,
-       0xbec97d5e, 0x7d5fc889, 0x30ffd039, 0xfde172f2, 0x2f92cf30, 0x959b6798,
-       0x79c46bd6, 0xb3764726, 0x27a7982f, 0xb7cf3f57, 0x7e913514, 0xcc88e34f,
-       0xcc128e30, 0x16fc6ff6, 0x97efd32f, 0x1e9c8d05, 0x746d9b82, 0x8bbfaa2e,
-       0xc9af8fdf, 0x12ef1801, 0xf440c1e9, 0x6ea557d0, 0x75f48299, 0xfdc4ec9f,
-       0x97f5be8a, 0x2fbf8cbd, 0x7651b7d7, 0x57d0dda2, 0xf207f1c5, 0x5f78f480,
-       0x2a06ff8e, 0xefd2371f, 0xfb699da4, 0x3ee89feb, 0xfa466382, 0x3c81e23d,
-       0x5879c6ff, 0xae517806, 0xe26e5e01, 0xe691ab76, 0xc1eebadf, 0xda1f5875,
-       0x6fce8936, 0x7ad7d50c, 0x906fd73c, 0x14c87c75, 0xde0bc695, 0x17ee8a3f,
-       0x120cf0d1, 0x23fd08b6, 0x9e581f0d, 0x978a213b, 0x8f7f38a0, 0x8fbf0276,
-       0xc433c84b, 0x13d73e4f, 0xe5058e78, 0x19a79e18, 0xcbc55f49, 0x7bbd789f,
-       0x4fb6ae63, 0x0dc797a9, 0x79afbf71, 0x69795c5b, 0x1658dc9c, 0x5718df57,
-       0x86f9fa0f, 0xcfd2e2e1, 0xa2cf8e0c, 0x1a21927e, 0x4fb81d1f, 0x56b4bf22,
-       0x07e84d51, 0xeb8d3e3d, 0x59853ae7, 0xe4be22ae, 0x156a73e7, 0xc32e62d6,
-       0xac535ef7, 0xb5fd04bf, 0x9ca19398, 0xb410e5c0, 0x94c536ab, 0xc1ab7935,
-       0xa3c04ab3, 0x9c76bf3d, 0x7dc466a0, 0x15b9558c, 0xca31f743, 0xbf5ffce4,
-       0x11d67e88, 0xe0ccfc99, 0xb0ff5c0b, 0xf2dc3f4f, 0x3bef1b98, 0x323ca02e,
-       0x78f1fe6d, 0x61fc381c, 0xe4defd22, 0x5f3a26f3, 0x5295db5e, 0x72587e45,
-       0x6fbc5864, 0x44fae5cd, 0xe95fafeb, 0x6b1d9c4d, 0xc4deb347, 0xadf7dfd8,
-       0x4ae1fc3d, 0x7f016bf4, 0x8e463921, 0x5a96399f, 0xdd65fe85, 0xf0ab32ef,
-       0x5cd1efbc, 0x3ea00e2d, 0xe6f901bc, 0x13e29988, 0x33cc2ffd, 0x2ffdf7e0,
-       0x9de78bd4, 0xff609f74, 0x7072675b, 0xfe8344fc, 0xcf7f89be, 0x9d54f6e5,
-       0x57ddcde1, 0x9a3ffca2, 0x2626b79e, 0x28675d0e, 0x31f8bf23, 0xc23e6463,
-       0x3aff760d, 0xfad503cc, 0x12ab9a39, 0xde47fd1c, 0xe1f28dde, 0x32ecc6cc,
-       0x47fd2b14, 0xdc1f90c6, 0x4565daff, 0xff6b5f78, 0x945e197d, 0xd5198f0b,
-       0xe2dfb93b, 0x8bc9eef0, 0xe0e387f6, 0x91ff63fe, 0x3f1895c9, 0xc38d7fe8,
-       0x278a650b, 0xe610bb40, 0x26fd6a5f, 0x984dd41a, 0x677ece8f, 0x8ee2bf24,
-       0xf1d20acf, 0xd344957e, 0xa050f7f0, 0xc3cfa11f, 0xd6f34d5e, 0xfde37df2,
-       0x37ff2d0c, 0xeed30fde, 0x17f78f8b, 0x3ddb59eb, 0xef1c9798, 0x6e618237,
-       0xdf89a509, 0x4ebfa733, 0xf74bf7d2, 0xdfd66e7f, 0xf6121d9f, 0x71e48580,
-       0x7ae3f02d, 0x79853f8a, 0x3c9d6fdc, 0xc5ec7eec, 0x6fa76e5c, 0x7e6dfdb5,
-       0x9ebacc6f, 0x03c53036, 0x626d3d78, 0x70d94f16, 0x9c85e3fe, 0xc37b925a,
-       0xb1758dfb, 0xa1b1d6f7, 0xaae9e47e, 0x9df9e530, 0xefd32f5e, 0xf5c3c459,
-       0xf8c8fd55, 0xebdfb5ef, 0xc4ed04f8, 0x00938c54, 0xe45fc9a4, 0xd5e1eb3f,
-       0xbf1569f0, 0x01fff2a3, 0x949113dd, 0x00008000, 0x00088b1f, 0x00000000,
-       0x7db5ff00, 0xc5547c0b, 0xbddcf8d5, 0xc3764cfb, 0x083c8426, 0x813bcd84,
-       0x44902c24, 0x8f2ed4ac, 0x0310f0c4, 0x5850822a, 0x89de4020, 0xc5b0fd60,
-       0x40802166, 0x151a86d1, 0x260dda2b, 0x22ec1208, 0x760d1201, 0x4a888941,
-       0xadb45503, 0x202a25f2, 0xd4109204, 0xeb6bfe8f, 0x73339cff, 0xd0820fb3,
-       0xcfe8fbf6, 0x99dee64e, 0x7de733b9, 0xfd999cce, 0xf7f87bfe, 0x17bec613,
-       0x62a2d9a5, 0xc963106c, 0x2d9990ff, 0x43b2b194, 0x891ae71a, 0xafdac0b1,
-       0xf50b999f, 0x398d16ee, 0xf958c2c6, 0x6726d921, 0x659ac630, 0x3e0c4267,
-       0x08a822ff, 0x8f3797de, 0x33cccb31, 0x9cb3795e, 0xac654ce7, 0xd86ae9ab,
-       0x671a54e2, 0xfd88c5ba, 0xa1dab69f, 0xc2acc834, 0x57b4f465, 0x4c8b58ca,
-       0x69de28f3, 0x9932fea8, 0xe1efbfd1, 0xb05752bf, 0x29bcbd4f, 0xbd4bfab2,
-       0x7f8c5ea7, 0x367fc244, 0x8c5967a6, 0xec57f095, 0x6187ea72, 0x5dde6053,
-       0x1912e7b5, 0xb2a8d12c, 0xa1325ac7, 0x169df89e, 0x67b58ceb, 0x7e6899e5,
-       0x67981641, 0x20dbf3b7, 0xb7d2f306, 0xbf9c36c8, 0x2c32fcff, 0xff32c65a,
-       0xc2e5f983, 0xf33cc2fc, 0x5864f983, 0x59e67906, 0xb2d1e966, 0x3e879858,
-       0xc48d9d28, 0xa369b616, 0xfc22fda0, 0x6a2fde13, 0x058d3c59, 0x79a93631,
-       0xe0031ac9, 0xb25abba1, 0x7e79e0ea, 0xf00dc00b, 0x764dbf90, 0x932f005a,
-       0x311d5692, 0xd3f17d40, 0xe6ba1ef0, 0xcf4ee3c8, 0x9ecbf686, 0xb87ea990,
-       0x1ad391f6, 0x0d36ebc4, 0x031e21d3, 0xef8bb682, 0xa15f9c31, 0xcb615f98,
-       0x7c120bd4, 0xd921d96f, 0xf5fec6ea, 0x5f3e2b26, 0x79f341bc, 0x96fad7bb,
-       0xde301fe0, 0xd392ad92, 0xa92de30d, 0x95df7df6, 0x38b2d0e9, 0xefd5bfe8,
-       0x99faed79, 0x54b14247, 0x51d60933, 0x8f7df4e8, 0xf986deff, 0x77bf8b94,
-       0x8c1e6c26, 0x3032e9f8, 0x61f806d6, 0x8630f6ea, 0x1a3dbba5, 0x7cd5d8f1,
-       0x58f11a36, 0x24fffafe, 0xa7f07eb2, 0x14c5ac94, 0xe0102e7a, 0xf7d89169,
-       0xabfba42a, 0x69faf3d3, 0xe7087a3f, 0xc71a9d8b, 0x3fbc2b60, 0x746dfb52,
-       0xb349d23b, 0x1fb9987d, 0x9f1bedfa, 0x08aa0c39, 0x8606dd2c, 0x3ccb8665,
-       0x4de4f905, 0xd213798d, 0x33f5f6c7, 0xf0dd43b7, 0x00660686, 0xf12304f5,
-       0x12c7f20b, 0x3e1571af, 0xd9b129d9, 0x99426654, 0x6892f38a, 0x930fdf5e,
-       0x1e771e88, 0xd09e9dee, 0x69867cdf, 0x21e8dda8, 0x347dda8c, 0xd2356f2c,
-       0x11ca805b, 0x3660f884, 0xe014259b, 0xaafa092b, 0xe121595a, 0x4d5608f3,
-       0xa2e610e5, 0xecc605f2, 0xaccf6c46, 0x63338466, 0x7e118343, 0x5eb4f3c4,
-       0xe6e90abb, 0x9b770267, 0x8e0f4e24, 0x87ace660, 0x3d5ae5bf, 0xa6300793,
-       0xd841ed65, 0xf33694c9, 0xbde0c3d7, 0x255943e6, 0x43c8bd01, 0xcd5a7c15,
-       0x8c6fdf88, 0xc6f00df7, 0x17f7e1df, 0xa578e2e5, 0x83a665fb, 0x6a372ef1,
-       0xed88db98, 0x9da05f81, 0xb5affde6, 0x5a972831, 0xeb009624, 0x3e3a8728,
-       0xb6a71f2f, 0x52e0bd39, 0x78f0e16f, 0xf04892da, 0x8edb52e8, 0x33fa434d,
-       0x2c3ad22f, 0x2e7e4e38, 0x11347183, 0xaf38b48b, 0xd04fefc3, 0x82de20c7,
-       0xeb37c4d5, 0xb6ef945b, 0x64fc7199, 0x78f329d5, 0xa993df78, 0xf1e1db66,
-       0xcdc6a3f9, 0xf7ca47c8, 0x3f1c2cba, 0x12812b67, 0x97cf3c92, 0x8397dc64,
-       0xfb3297fd, 0xa5a3a47a, 0x7b733235, 0x0d79fdd1, 0x6b92f7c7, 0xc63dcc81,
-       0x4cc45fab, 0x6b92d75a, 0xbcfcf441, 0x6f3bb781, 0x9ef174e2, 0xc7c5d385,
-       0x885fbbe2, 0xaf2dbffa, 0xeaf2beac, 0xef1f0bf2, 0xd6e5c458, 0xa547487b,
-       0x44ce7b52, 0x88fac4f8, 0xf5ca2d5e, 0xe66695b3, 0x3ad0fdd6, 0xd7b73207,
-       0x5ddafb77, 0x40f73033, 0x6859b86f, 0x1af59efe, 0xcad9fde9, 0x31c09b88,
-       0x9e8e07ca, 0xe07ce3f1, 0x89f8fd78, 0x656cfef4, 0x1fc64df2, 0x63f18371,
-       0x19efe67c, 0xaf9e9e37, 0x20b1554d, 0x9fb5aba0, 0x6cc49ce8, 0x74a7ae7a,
-       0xbad6ef82, 0xfd2de927, 0x4d83aff0, 0xe163628a, 0x8b9ca37d, 0xbcd97c74,
-       0xae7c8cc8, 0x74b90609, 0xd8d7f41b, 0x7180ef72, 0x0321c175, 0x5aaf7e91,
-       0xdf5d68e2, 0x1d105706, 0xb4743b7f, 0x8fc188ec, 0x7d61e454, 0x997c90ed,
-       0x59fab378, 0x7ae5f392, 0x21d37dfe, 0x9fe44a60, 0xaf42f5db, 0x18bcc9ff,
-       0xd43553be, 0xf4c98fae, 0xf994c7cc, 0xb33c4336, 0x9430fb26, 0x819b8f03,
-       0x801f896f, 0x5abd61af, 0x3bbbfec9, 0x9fd81f80, 0x8a1eac75, 0x24f60d6f,
-       0x471f17b3, 0x09fd70c4, 0x728510dc, 0xa86ac1d1, 0x4aba6f2c, 0xff00b670,
-       0xf794bae2, 0xe087ace5, 0xc2cd7c8e, 0x16d52691, 0x4f64df7a, 0xccf34bca,
-       0x78eecfa3, 0x0150e8c7, 0xfd0ee9ff, 0xd9e10823, 0x6e99eead, 0x22d5d285,
-       0x77c37a07, 0x8fe70c64, 0x4ebf4309, 0x65e7876f, 0xd3e40fd8, 0x27166f23,
-       0xd329fca1, 0xbce3a4f5, 0xf7f9bc8f, 0xdff79474, 0x861e2a1e, 0x7b4277cf,
-       0x3db413b2, 0xf1af5665, 0xa1d999e2, 0x9329eb1a, 0xef88e263, 0x3cef9ffc,
-       0xe7183554, 0x886200d1, 0x5677c085, 0xe5f717be, 0xdb072440, 0x18672853,
-       0x0b7a97c8, 0xcaf74dda, 0x3eca5728, 0xea04db02, 0xbf5ccd19, 0x4e650c67,
-       0x67da0c55, 0x7c46cd1f, 0xcd6a6595, 0xc04a582a, 0x1ae736a8, 0xa9901f78,
-       0x1d1ea337, 0x5f7f843e, 0x0e3cfa8b, 0x440f67fb, 0xe414fdbc, 0x0f247fec,
-       0x2becfcea, 0x06b2a9f7, 0xdca95ef8, 0x00e51d3e, 0x31e985c8, 0x07d97e30,
-       0xb5489f5f, 0x309e8b60, 0xd0b74fc4, 0xe3127f3f, 0x37931a3c, 0xfbaae913,
-       0xe3d777fe, 0xbb2437a3, 0x88e3d71d, 0x5f515bd4, 0xec6708b0, 0xcebc2f4c,
-       0xba09518d, 0xba01ee01, 0xb6e62e1d, 0x796bb067, 0x6725e930, 0xb943d208,
-       0x1e51d98a, 0xd40069b2, 0xf32e91db, 0xf5a666d2, 0xd0d79fa7, 0x6c62cb78,
-       0x4abe708b, 0xcd668ffb, 0xc3f7b34d, 0x04a94887, 0x21ebad4f, 0xa94f679c,
-       0xf01dbad1, 0x82be21f0, 0xd2cd2f7e, 0x93b065b9, 0x0dc635ba, 0x27d1d012,
-       0x075bf381, 0x184ffac1, 0xceb815ed, 0x5e4c0fd9, 0xc8e9758f, 0xa472cb40,
-       0x59ed85cb, 0x06399788, 0xbef8c3fb, 0x161f6f44, 0x3cbc4b06, 0x00349ed4,
-       0x40de6a95, 0x97966f0e, 0xfcefd796, 0x753c7cf9, 0x54b7fa46, 0x31b7a5c0,
-       0x49d9006e, 0x67480daf, 0x152e9f30, 0xd0fd402b, 0x15fbe625, 0x25e623e8,
-       0x279c0ba7, 0x7da10bb5, 0xed49dd61, 0x97f5af22, 0xeae08582, 0x3a7a2ec7,
-       0x1745db86, 0xdbfefdf7, 0x9d50c05f, 0x44481cdf, 0xba58b5bb, 0x76faeb44,
-       0x62f9c9d7, 0xbeb8d57d, 0xa27b7a47, 0x12aeb0b5, 0x972d61d7, 0xea7d621f,
-       0x5a1fc49e, 0x2daa975f, 0x80e2e887, 0xf18fae64, 0x3c6d2bf4, 0xf4051399,
-       0x3c17505e, 0x9674e65a, 0xe8567488, 0xd1788f84, 0x028e32b1, 0xde42e59f,
-       0xf014aef5, 0xb676e009, 0xfbe51f02, 0x33e0fc67, 0x8d93dd5f, 0x2abf98f3,
-       0xa9e5c558, 0x7947e893, 0xefa560bf, 0xfb14ab77, 0x49c931e7, 0x7ebc66f3,
-       0xdcec11d0, 0xea9d7504, 0xa2f787ea, 0xb2a690dd, 0x2db0dda2, 0x68c06400,
-       0xf028fec6, 0x07c802f3, 0xdf3d087d, 0x0223cf80, 0x6788ff78, 0xe82ace54,
-       0x99a1379f, 0x32a5f0e8, 0x6f8655a3, 0x98e0642d, 0x331614c0, 0x67d9d91b,
-       0x50fdffc7, 0x68f3ac3b, 0xf08ddd8c, 0x1550305f, 0xc3cd21fd, 0xda06623e,
-       0x1c38e36f, 0xfd17b3af, 0x99933fe0, 0xb1e46435, 0xfbe42acd, 0x94be6699,
-       0xe3e71225, 0x834d997b, 0xd99fbbdf, 0x2ea9dda9, 0x93fd0dad, 0xc15be853,
-       0x0e601fbc, 0x39873e7a, 0xdccb9ca9, 0xaca7fed4, 0x1f0aea9d, 0x082ffd00,
-       0x3e7ff4e5, 0xf9ba265c, 0x327de718, 0x4ae87d30, 0x678cc758, 0x5fc81293,
-       0xf04419ab, 0x67bcd9b9, 0x8f8e1c48, 0x71dbd8c6, 0x6fdcde9c, 0x7181ac5e,
-       0xd1377a54, 0x989c9f5f, 0xe1d04834, 0xb689cb0f, 0xcc7f3ede, 0xb8700918,
-       0x2ef4a04b, 0x63f9315b, 0x3991b2d9, 0xe36d3f00, 0x53fa2764, 0x43ab6cc7,
-       0x93aa6543, 0xcab36d5e, 0x59dff7a4, 0x50194ccd, 0xc694677f, 0x6b74455a,
-       0x5d3c3d23, 0xcd7d978c, 0x7800f6fe, 0x586e5d3e, 0xdcf50c1b, 0x790fe021,
-       0xd0e4d5d1, 0xb3e46abd, 0xcfbef129, 0xfafaa5a7, 0x6ab3774d, 0x3d3be119,
-       0x61ddb7c3, 0x95d00b84, 0x3ffb962a, 0xfe1b386c, 0x8fe1ecbd, 0x31f9147b,
-       0x1bb6aaed, 0xd62631e6, 0xf585886e, 0xecfbbf2f, 0x532efc7c, 0xa0c60fb3,
-       0xb3213a5e, 0x73fef04d, 0xd81b13e0, 0x82565f4b, 0x397e0306, 0xd61ff607,
-       0x0d3b02bf, 0x16958bcb, 0x5d812f2a, 0x2abbef85, 0x207f54ad, 0x16242f36,
-       0xc368bf40, 0xed1db515, 0xfa2ceafe, 0x5f410afe, 0x2ab72a6d, 0xbb67f910,
-       0xb87d4564, 0x2136d0c2, 0xa2b6e010, 0x180ac63e, 0xae4d4566, 0xbe7e9c56,
-       0xd1072f3b, 0x4558f4b8, 0xd7a5962b, 0xd2076624, 0x8bce417e, 0x3ebbf1c6,
-       0xddd67cfc, 0xe57cfcf0, 0x85fefa58, 0xbf7d1b4a, 0xca9732b3, 0x3c7b588a,
-       0x74b5b3b6, 0x20b40eb4, 0x7d10ae36, 0xa1d0dddc, 0xb67a828e, 0xdf21b24d,
-       0x4e6369dd, 0xab75e027, 0xada9eb86, 0x0f90a7a0, 0x7ccda7c7, 0x7a8661e1,
-       0xe38e9ec4, 0x30a53fdc, 0x3e99c71b, 0xdb1aa176, 0x631df03d, 0x743c6303,
-       0x65ba3376, 0xf2fc727e, 0xddd1129b, 0x1ee59565, 0xc71cabb4, 0x7a0fb265,
-       0x185530d5, 0xe193f7bf, 0x74e0074e, 0x70b8fef9, 0x35cb6794, 0x2f10f096,
-       0x27e9d639, 0xdcf73ac7, 0xdfade116, 0xdf5c433a, 0xd0e505fe, 0x810e5c67,
-       0xb7ee74a5, 0x118ca728, 0x976fc456, 0x520043f0, 0xcb8fa881, 0x406f82b4,
-       0x33bd608e, 0x83c82d80, 0x51abd67a, 0xf00f9013, 0x8f24967b, 0xf57c499c,
-       0x585fd8d9, 0xe9dbdf3c, 0xdf97f25a, 0x53b2fd42, 0x5e80d0e5, 0x5d5cccba,
-       0xeabae3af, 0x17b4568c, 0xc0752593, 0xefec10ca, 0x964bbe24, 0x2095ea2c,
-       0xfabd7647, 0x19e7e0c2, 0x8d8c09da, 0x6c6ff785, 0xf3392409, 0x667ac686,
-       0x817ff625, 0xc9f97ff7, 0xc26f3f47, 0xd1d289f2, 0x1059428f, 0xcd70421b,
-       0x70e14dff, 0x5111b3a4, 0x6f180680, 0x6dc941f7, 0xad2c6748, 0x489af0e6,
-       0x6dc8cf98, 0x50c1aa1d, 0xaa93aa8e, 0xca611cb0, 0xfbc3263d, 0xcd0b58b2,
-       0x8c434c63, 0x32ec851c, 0x9f97f9d8, 0x6be1bd90, 0x5cd6a487, 0x79983099,
-       0x92e191ec, 0xa5e222eb, 0x347a74ca, 0x4d563be9, 0xb96fece3, 0x69734ff7,
-       0xe0e9601d, 0xad6a17bc, 0x8e9c1fa4, 0xcbb3a45a, 0xd92b64f6, 0xe78e79e7,
-       0xed97bf10, 0x17d45661, 0xff5fc007, 0xa33fb611, 0xac1e75a6, 0xf184193b,
-       0x07e0019b, 0xe97de01b, 0x93d21ea8, 0x0c2d43a5, 0xc5f43bbf, 0x3e1172bb,
-       0x6bfb8d65, 0xbd129c69, 0x82d9fd15, 0x515b57fd, 0xccc9b26f, 0xd5f4809a,
-       0x9abfebc8, 0x1ea2b364, 0x86fda82d, 0xa8f2dbd7, 0x83de079e, 0xe62fdb1a,
-       0x42b3d976, 0x74f6b12f, 0xb2445b92, 0x7ebe0f16, 0xfdf1af05, 0x644718d6,
-       0xcfa3d185, 0x416d0f40, 0xf2d488fe, 0xe6136dfe, 0x6e5c1346, 0xe3290f51,
-       0x0e65ab3c, 0x2d45ea03, 0x20f597d7, 0x603e902f, 0x7c7117fc, 0xc9466f45,
-       0xac235a52, 0x1d59ea3b, 0xf8b7b397, 0xd603d99d, 0xec54de93, 0x1f6172b8,
-       0xe8136154, 0xbfb465df, 0x8970f282, 0x6d4cb3d0, 0xe3bb4549, 0x776da333,
-       0x6071d92c, 0x7f48a8e7, 0x65eb1efd, 0x7175d832, 0x319d765e, 0x17f496e4,
-       0xe3f6d933, 0x7db56e7a, 0x9fe798a8, 0x03433cc5, 0x1d2c9da2, 0x87f80afd,
-       0x7858e984, 0x587186d2, 0x447ef1f4, 0xc156eb24, 0xe11d073a, 0x8bb1e3f5,
-       0x1b05acb7, 0x77a47dfd, 0x3382470e, 0xfb430050, 0xca6e794c, 0x6210f4e0,
-       0x11dd93d7, 0x5462b03e, 0x337d1785, 0xc20c7bb5, 0x653fd363, 0xdb7684b7,
-       0xfc5233ff, 0x86de7fc7, 0xfd7fee38, 0x150e624c, 0x2d15d7d2, 0xb4d16bb5,
-       0xf43dfeef, 0xb54c296b, 0x007b3fa2, 0x71c7adf0, 0x8ec96a66, 0x05db416a,
-       0x09ccb7da, 0x86f7b923, 0xc741cb86, 0xdfde009c, 0xf7c10000, 0x689dc3ab,
-       0x55d60da7, 0xe38697bc, 0xdf120557, 0x1b9c68b4, 0xc7fc7162, 0xb2f8d206,
-       0xe8e1bdfe, 0xe4227d7f, 0x9ee49551, 0xc76df18b, 0xefc32d15, 0xa3bb04d5,
-       0x535ea1ca, 0x7fda9c38, 0xed192a02, 0x5b609ac4, 0x03d9ca24, 0xfe4994ff,
-       0xba828cd5, 0xc513e491, 0xd8666a61, 0xfea18322, 0x4d4bc0a0, 0x99feb3ad,
-       0x4c9e7c50, 0xb8c60ce3, 0xe18bb61e, 0xc345fce3, 0x07a7d9fb, 0x075ed1aa,
-       0xf089144d, 0x027e6dfb, 0xe3c2d2c5, 0x0871c826, 0xcfb7e15f, 0x19477216,
-       0xb3e83b1f, 0xffe30ed0, 0x37a92ce6, 0x5fdd7f20, 0x0d00e860, 0x58293ec2,
-       0xf5bf4263, 0xd6ecbb7e, 0xf7605c81, 0xecfadb65, 0xdf1c5882, 0xbd21c726,
-       0x937e2be5, 0xf5c2317b, 0xdb3d1ecd, 0xe0237644, 0xba7aed35, 0x1fdf80bb,
-       0xf8e3fe80, 0xc7fdbca7, 0x9fe71d42, 0x6887480b, 0x43da060f, 0x4de5fe70,
-       0xf6f29f93, 0x592ce72b, 0x40724417, 0xa552f77c, 0x132fa9ed, 0xa5c84ed0,
-       0xf2aef952, 0x7a99dcbd, 0xfe8a149b, 0x7189ce8d, 0x0ec205c0, 0x67b9d72d,
-       0x673e3f21, 0xefa30fb0, 0x474c5d14, 0x6674317b, 0x475c00f2, 0x0e60bbf7,
-       0x0233db41, 0x805067cf, 0x4c2b9e23, 0xd44c3744, 0x4818bfed, 0xdf04b9f6,
-       0x62fa3a41, 0xda3b698d, 0x2dad7673, 0xd1d20972, 0x47b240f2, 0xc1dc80ce,
-       0x0494cf71, 0xfbce1d13, 0xc8fbf175, 0xb4f2676f, 0x5a679f44, 0xe9f7bdb8,
-       0x85add94a, 0xbccd77f5, 0xf4224cf6, 0x45f55aeb, 0xdb2856d6, 0x1a35fcd7,
-       0x35bcd1f5, 0xdfb0d3a5, 0xd355a2bc, 0xe2374e11, 0x3a2579f3, 0x6e1cccc1,
-       0xb76ce353, 0x6742be23, 0x3941cb5e, 0xe4b8b83d, 0x17c18c39, 0xc4efd9c7,
-       0xdb6997f5, 0x651e10cb, 0x8d167c6f, 0xf37773f6, 0xa15b7bcb, 0x27d9336c,
-       0x35b2bf60, 0xc3acc577, 0x55ff84c1, 0x017c06a6, 0x671e7d1d, 0xe5f7c1cf,
-       0xd889dc93, 0x2da692ef, 0x56c6e107, 0x7ddd9add, 0x80fea5b1, 0x40607e84,
-       0xb295194b, 0xd1e71d33, 0xa483b929, 0xd8238438, 0x4beeb00f, 0x70507766,
-       0xc98d452a, 0xe9de289e, 0x5a9a3ebb, 0x403b8898, 0x6c9762bf, 0x32dd2033,
-       0xebe716a7, 0x9e18bedf, 0x7c5bbb53, 0xfc5cc45e, 0x93d37079, 0xab7d2077,
-       0x37f71b99, 0xd84aee2e, 0xbcbff88e, 0x6f44e5ff, 0xbcbfd83f, 0xfd7cbe7e,
-       0x00be9097, 0x89e0978e, 0x41abe906, 0x75ffe3e7, 0xfa248aed, 0xfd11ef82,
-       0x724aed74, 0x8f92f26e, 0x307e425d, 0x066b2bab, 0x95cdbdd2, 0x22967685,
-       0x95de982f, 0xb25bfe4e, 0x15fd1d2b, 0x3cb0de45, 0x773d2257, 0xfdb112ba,
-       0x8d67f401, 0xed16ef9e, 0xc4ddaa8e, 0x550e8ee3, 0x6c47d606, 0xee32bac7,
-       0xb497d6cd, 0x4f53eb55, 0x9fd6fa71, 0x95fcf210, 0x1f8ab457, 0x82bf0b2c,
-       0x5a3c1459, 0x7046fdb8, 0x8156b3f9, 0x5951c3cb, 0xbf803718, 0xdcde6962,
-       0xfb857e6f, 0xd94607cd, 0x2aae50a3, 0x6081f9fe, 0x5ea2a7a8, 0xea56f3e5,
-       0xe7fc1c0a, 0x4bcfe6bd, 0xf7be30a3, 0x1f8f1c46, 0xbcb81955, 0xb97032aa,
-       0x1594dab4, 0x34abef8e, 0xa2a6c760, 0xee2c72bf, 0x0e078d4b, 0x366d2ae7,
-       0xf57dc110, 0xe9475ba5, 0x6d976f91, 0xa6f7a51b, 0x639daa8f, 0xde60598e,
-       0xadaa7697, 0xb52a84b8, 0xd7b449f3, 0x2eca76aa, 0x7af7a307, 0x64bfb41b,
-       0xdb02723c, 0xe3c6dd2d, 0x65ff4a16, 0xf96db35b, 0xb11ef35e, 0x69be17d3,
-       0xc8fadf2e, 0x51fadf26, 0xfd0645b4, 0xb946fdeb, 0x8e63eb7d, 0x7fcfd6f9,
-       0x242cf0f8, 0xf1d902c3, 0xe3f68ca4, 0xa18e735f, 0xc0eaf93e, 0xf78a20c1,
-       0x8adf967c, 0xadb2f176, 0x3c0770be, 0x3827684a, 0x77a44876, 0xfcfe9d0b,
-       0x031f3fd2, 0x5f389446, 0x14dd37b2, 0x3aab4731, 0x9df6fae6, 0x86cb35cc,
-       0x7f95a571, 0x8c72fb8a, 0x5ddbdc67, 0x0fe8b45b, 0x46f77ff9, 0x368ccb7c,
-       0x1637c60b, 0x7eefe58e, 0xfb2272b4, 0x7cdbc702, 0x71e90732, 0xd224afe1,
-       0x25f70bc3, 0xd3748dbd, 0x14ce77b1, 0x12e5672a, 0xcbb8943c, 0x6dc916b2,
-       0x2c79ba82, 0x650fdbeb, 0x6b45ef30, 0xa1f13e75, 0xf3becdfc, 0xfbe35a58,
-       0xe1d3597e, 0x6bbee1bf, 0xda45fe81, 0xa6d82ea7, 0x396b8bf3, 0xbd3b42df,
-       0x7e462be8, 0xf7dd5178, 0x5ee2feba, 0x143ac44b, 0xee3990fb, 0x6e4eb864,
-       0x8edf8202, 0x3d7207ff, 0xc4d76cc4, 0x8dd8f20f, 0x95a9aa3f, 0xcca57e11,
-       0x8e3988fe, 0x207751fc, 0x0ea967cc, 0xa4d1b1ec, 0x577d6987, 0x78a00eb7,
-       0x06673c07, 0xb5957e78, 0xbe7ea165, 0xf2b268da, 0x965b5938, 0xa0cbea19,
-       0x602bf08e, 0x12a704d5, 0xa732cb94, 0xddb79b1b, 0xb3adf4e0, 0x97b76e6a,
-       0x1187dda8, 0x9dacc51e, 0xbd1e21fa, 0xbac095db, 0x3b41093e, 0xb33fafc4,
-       0xdcbc9c52, 0x95fc25a8, 0xf3af7d37, 0x0bf8af7e, 0xc4a2ff8a, 0xf4577ee1,
-       0xb7d20060, 0x3587d846, 0x5b7b9d1b, 0x94eb3d61, 0x0316deb8, 0x6b07a7c9,
-       0x7b07bcb9, 0x59d71130, 0xd68525b3, 0x8b64a0fd, 0xf6b68759, 0x7fd13d0c,
-       0xd3d8304d, 0x924764a1, 0x237600bd, 0x733dadd9, 0x12edceb4, 0x372e8fda,
-       0x4f35c1da, 0xca06f8f3, 0x9f6bb249, 0x527d9030, 0x27db8333, 0xa9c25b35,
-       0xca705fff, 0xf2576891, 0x913cd4f9, 0x995dedc6, 0x8ce163f7, 0x65f607e6,
-       0x5e6bdea2, 0xb2ff5d8a, 0xf1113ed9, 0x26b7acad, 0xfb84c7b8, 0xe060ac1d,
-       0x7af9e92d, 0x007abfa1, 0xff07180e, 0xc56bca52, 0xdda5097d, 0x1f5cf17d,
-       0xedb04d64, 0x5e28ed10, 0xb19aaf9e, 0xa79827e9, 0x52ca8cf0, 0x7f05e315,
-       0xd7112d9b, 0xc316e5ff, 0x99d3c468, 0x679e5c51, 0x05f1e04d, 0xdb6c5bf0,
-       0x5e22ff71, 0xfd7713e5, 0x614ef8a9, 0xf5e685bc, 0x2f8f3665, 0x28f2329a,
-       0xdab6038e, 0xf5f6fe82, 0xbef9e30b, 0xef36be68, 0x99fb8ff8, 0x3617028f,
-       0x5f17fb89, 0xbe91243e, 0x9a24f584, 0x1bf59ea1, 0xbe7fc503, 0xc1477a14,
-       0x2651d007, 0xc72161e9, 0xc67e90c2, 0x19e7e878, 0xa40e1741, 0xfd378b0b,
-       0x83c7d2f8, 0x09ecff02, 0x04d69f6e, 0x13cd7af3, 0x9fa03729, 0x650ffdfe,
-       0xfcb535bd, 0x01dfbfbd, 0xde36b074, 0x74fe9e0b, 0x4cced4c0, 0x7f35fdef,
-       0x8d96c83a, 0x57e728c9, 0xb4560148, 0xfe0857c7, 0x1184b158, 0x0ab1463d,
-       0x8235f909, 0x008f29b9, 0xc70181e4, 0xc00f71fb, 0x7f0f8bdc, 0xbccf4d72,
-       0x1678dff5, 0xa89f53ec, 0x9f69f48f, 0x79f18e6d, 0x8a44577f, 0x96c9fbcf,
-       0xa9f53e51, 0xb4fbb7c9, 0xde3adbbf, 0xd8cf7ea7, 0x67ed3ec9, 0xd4f866d8,
-       0xc6accc6d, 0xee54b7f9, 0xcde0fb24, 0x97dc574a, 0x65c3d709, 0x3ec8ee9c,
-       0xa6b1958b, 0xaa6707ba, 0x0dc61e81, 0x0622b238, 0xede387ea, 0xe4751ebc,
-       0xb1998c6a, 0xf217e2b7, 0x572388fa, 0x347ea163, 0xdfaf117e, 0x7f5fc8c1,
-       0x4cf17e27, 0x15c52a47, 0x667e218f, 0x8a38ab5d, 0xab47e16e, 0x41892e67,
-       0x24c92f1e, 0x67ecae39, 0x3f6313dc, 0xbcacfc84, 0x8d9fda57, 0xafbbfde7,
-       0x7ddff970, 0x2377cb85, 0xfe83291a, 0x32fc12fd, 0x0e04fefa, 0x6f413622,
-       0xa62ffda4, 0x8bea5cd7, 0x94fc8343, 0x3c618c6c, 0xf012a5af, 0xd370809d,
-       0x34aee953, 0x32a47953, 0x2bb7ca82, 0xe01f2c2d, 0x4c995ada, 0x2b4ab1e5,
-       0x395e3f3d, 0x2bf7ca96, 0xa89e546d, 0xadb2a5cc, 0x094a8f32, 0x2879a98c,
-       0x3758763f, 0x0e2e1068, 0xbd39f075, 0xc6e52f27, 0xcecd4c72, 0xc685f829,
-       0x5f6c186f, 0x31dd93c4, 0x71714cc4, 0xd35bbcf1, 0x73d222f3, 0xc16615d5,
-       0xa6c3b87c, 0x9fb416d3, 0x44f532ab, 0x9b4f52ef, 0xb8ebe505, 0xbaaf5e0c,
-       0x675166d2, 0xfdea3af0, 0x28d760ee, 0xa5550bd4, 0x189aeb46, 0x448eef7c,
-       0xa157197e, 0x387fa2b5, 0x3e67a7a9, 0xa338f1f2, 0xf47a82d6, 0x2df5a9b0,
-       0x73ca3df1, 0xdcc2bba9, 0x3457dc2a, 0xe2cc59b4, 0x7c0e383b, 0xc1f50637,
-       0xbbe187b8, 0xed056e34, 0x679b8d07, 0xe4aefbec, 0x0ffd5df7, 0xe4a2777f,
-       0x5ef8ddf5, 0xff3a6ef8, 0xbbe7c5ae, 0xe5ec996e, 0x0fb26e2b, 0x11ad83ba,
-       0xfa955f28, 0x4a9f7c24, 0x33d24271, 0x196e2ce3, 0xe887eff7, 0x070d3cb8,
-       0xa5e0d2f3, 0x6278956f, 0x675f2f5d, 0x08bba557, 0xb0926af9, 0x59692657,
-       0xa993c232, 0x98fe2802, 0x1ad77f2d, 0xcde5f505, 0x9dcc28d2, 0xdbcba498,
-       0x9aae7e46, 0xca161dcb, 0xb75332f5, 0xed0cbe15, 0x5945854e, 0x486adf31,
-       0x0f1601c4, 0x3cbb3872, 0xfaf51537, 0xd4df9129, 0x484f641c, 0x9bdc7980,
-       0x254a720a, 0xd9f71988, 0xde490372, 0xca4a1f77, 0xa67f7b44, 0x019fb2ce,
-       0x3c26a71f, 0x720d5333, 0x4b00e671, 0xfac664a6, 0xb70f5e36, 0xbde097ec,
-       0x73333d99, 0xc1ffedd2, 0x4934fafe, 0x381f97ed, 0xadf80136, 0xc8b2f734,
-       0xfb21ec57, 0xe498c7f6, 0x77e28834, 0x9ec7a46e, 0x03d226c9, 0x8e5b8f18,
-       0x92d53bf2, 0x35a2ed89, 0xff08413d, 0x94d4efee, 0x832d023f, 0xe38af3ee,
-       0xf3c2d8bc, 0xe3f9fc4a, 0xabd70272, 0x9f3cf1e5, 0xaf422ca9, 0x4ae5b2a7,
-       0x8f7ca30e, 0x3ff478bc, 0x57edeac1, 0x0277febf, 0x598e1fdf, 0x47f1e5af,
-       0x6530a114, 0xea53005b, 0xa96bcc0e, 0x3140247d, 0x4e006d46, 0x547ec5a6,
-       0x24cdfa6f, 0x1b7b4fb5, 0x67bcf7b6, 0xd29f0436, 0xcf7ea4bf, 0x8bc6d66f,
-       0x2cbd21ef, 0x825c4e65, 0x4da9febf, 0x0bfc510c, 0xa10bf3c2, 0xe38bf206,
-       0xa057a065, 0x1740a8cf, 0x0ceb33c5, 0xdcc17e9c, 0xc54eb2a0, 0xc0036bdf,
-       0x50fa85fe, 0x9a3ee3a8, 0x22bed13b, 0x67f51071, 0xef2fec66, 0x2291fea5,
-       0x1f794e6f, 0x1979518e, 0x0cdae9f3, 0x55938e58, 0x4e4dc2fd, 0xc46bff1c,
-       0x83a55777, 0x2fd2f59d, 0x2b41815d, 0x8654f1bd, 0xfdde8dfd, 0xa53f5026,
-       0xfdd8297f, 0x9c920767, 0x8d297a26, 0x2b3e5157, 0x4b6fcdf8, 0x36b0d768,
-       0xa561ea2d, 0xab9069df, 0x410fbdf8, 0x09f962ce, 0xc0b3d7c8, 0x9ca97f9b,
-       0x95a7e54d, 0xa67e7a76, 0xf6ca80b2, 0xfe7a0aca, 0x2a4ae579, 0x6535cd67,
-       0x37949f20, 0xbd6766ad, 0xa5d4bae8, 0x4bef7bb1, 0x3fdf1e9e, 0xe04aecbd,
-       0x98e9dd76, 0x95bbdffe, 0xbc7277f7, 0x817d8375, 0xdfd024f6, 0x8dc8735a,
-       0x136e8ced, 0x377abfdf, 0x7773d385, 0x25d7af24, 0x536ea868, 0xffd8adb1,
-       0xd12d14dd, 0xc6448aeb, 0x2c7889db, 0xdf8d1fd0, 0x3e54e707, 0x19ced28e,
-       0x2fedcaaf, 0xf225984f, 0xe89f4476, 0xc63d202f, 0x9967d178, 0x9fd3e885,
-       0x39136a2e, 0x38ebc4df, 0x2ea145dd, 0x708c7dc2, 0x0a731383, 0xdc36be60,
-       0x3893af57, 0x9f475e3d, 0x5d9fee2a, 0x0e309f47, 0x5ce809c1, 0x7ec7f282,
-       0xef94a3f4, 0x0b6fbe0a, 0xe08cfd33, 0xa331a2dc, 0x0cb1f8be, 0xaafec580,
-       0x0f9813de, 0xb266151e, 0xf6489ee0, 0xfe8ac6e3, 0x123fc7e4, 0x6ffd7db8,
-       0x1f8fbfaf, 0xdd7fd77d, 0xd07ec5ba, 0xe49baead, 0xa44bca09, 0xc3e47e9f,
-       0x3e4504a5, 0x1391fa70, 0x3f50e76d, 0x35064b74, 0x0dbbb3c6, 0x83ae2e9c,
-       0x4fa70a5b, 0x056a3e85, 0xbae1447d, 0xe9eb3ce2, 0xdf807f9b, 0xca3196fa,
-       0xa3c7f0eb, 0xd6bc5722, 0x2f04f7f5, 0xd818c279, 0x487fd017, 0x09f69189,
-       0x099a2457, 0xce83dd7e, 0x6f02dfcf, 0xe27a159f, 0xa7df1579, 0xdf76e450,
-       0x305e4973, 0x9e47d523, 0x7a33b433, 0xbf88e90e, 0xf0562adc, 0xf851fa1a,
-       0x70bf2f29, 0xef53c0ac, 0xee154cec, 0x6b7d75bf, 0xcd1e5074, 0x68339ee0,
-       0x056d7447, 0x7ffc8003, 0xf40934db, 0x878c12d9, 0xafbe3058, 0x8be8fda7,
-       0x24b20f60, 0x72bae768, 0xf298ed06, 0x07a664e7, 0x7dcfc9d0, 0x65e90b33,
-       0x998d21e9, 0x4fad9aec, 0x3b7a431d, 0x505928d7, 0xc23577df, 0xb39f71b2,
-       0x4034e4c6, 0x63a81cfb, 0x653b65fb, 0x03522527, 0x14fe907b, 0x286b3bdf,
-       0x777b458b, 0xa33f73e2, 0xb5a5f8fd, 0x71870b12, 0xa2badadf, 0xe7ea1235,
-       0xf9fcf1b6, 0x7fcf032a, 0x6b3791cf, 0xb47c6307, 0x312f3f96, 0x7bfe50e6,
-       0x75662ed1, 0xaf65bc63, 0xa5f3fc89, 0x1579be35, 0xeb7cdb05, 0x5cbe2285,
-       0xbcfbe754, 0x4f37c1a4, 0xc8a24c63, 0xa36148c3, 0x135a5e28, 0x22807642,
-       0x77e46f4f, 0x397396d9, 0x61d7d8c9, 0x0f95ef18, 0xb9fd137d, 0x8867d791,
-       0x2fd4077a, 0xa2f1c37f, 0xc94ca5c0, 0x1964882b, 0x23cc0cae, 0x3f719834,
-       0x8bf9acaa, 0x73f98620, 0x89d3ed01, 0x29975f3f, 0x93636adf, 0xa569fb4c,
-       0x3097862d, 0xff6cb0cf, 0x84c5ad49, 0xec887f70, 0x6398bb80, 0x6e8bfa3d,
-       0x6fe44a95, 0x8ddc51b7, 0x52967ad9, 0x60d9bb7c, 0xf65afd46, 0x73adc7fa,
-       0x625fbeb1, 0xd0e3c406, 0xa593a276, 0x5fb4c9cf, 0xc9f2d0cd, 0x8c89d0f2,
-       0xbb3c4578, 0xcf3ed006, 0xe23bc432, 0xe78ef019, 0x34e7e41b, 0xbba5f784,
-       0xb55f7a64, 0xed8b4ab5, 0x7e3939cf, 0xc8e7bc15, 0x45cf08ab, 0x4e7c702f,
-       0x99feae7c, 0x5d83a400, 0xdf73b21a, 0x79837e82, 0xd03a1f3f, 0x77e3e21e,
-       0xdf144bd5, 0x6683a3ea, 0xe01d1f5d, 0x07466f3c, 0x67a49fc0, 0x0607466f,
-       0x4fe41794, 0x8a1a3b8f, 0xf8cfedf6, 0x9db8947c, 0x1f9b9712, 0x10fa59d2,
-       0xd8884d34, 0x1b2cf647, 0x08955f60, 0xe4cce672, 0x74dc280f, 0x51eeca6a,
-       0xff034f94, 0xbf9461f4, 0xfb7cf047, 0x444b7fe7, 0x331dd079, 0x18c1db63,
-       0xae0767c2, 0x90383ba7, 0x923dd3eb, 0x3ae7a253, 0x93be0eb7, 0xf915720d,
-       0xa3a9bd92, 0xa0f743f8, 0x893e1e07, 0x184f68fb, 0xc92e88ad, 0xe2bafdc6,
-       0xc13e7796, 0xcc6b27f8, 0x7df8f9b6, 0x462b2fc2, 0x37df10bf, 0xb5e85f80,
-       0x3f9928df, 0x4bbf7ea0, 0xcb75a58c, 0xf256eb2a, 0x0598eadf, 0xe5eb95ed,
-       0xaff9233f, 0x686eafc4, 0x01e9f99f, 0x76e7fc8f, 0xf10c7319, 0xe5c0b73b,
-       0xf71132d3, 0x71c8fa3d, 0x675c40f5, 0x53373f1d, 0x297202d8, 0xf8a5ce94,
-       0xd13297c8, 0x19d23cfe, 0x472bf1c0, 0xec9501c5, 0x9d3e472d, 0xec94e384,
-       0x2194e3e2, 0x981c20fd, 0xdc0099fb, 0x28697027, 0x84c4591e, 0x5932695c,
-       0xe47e96dd, 0x7aed5d48, 0xe9fd7f34, 0x37ec18a7, 0x1d3f845c, 0xb6fa3595,
-       0x97ca03fb, 0xd25f2411, 0x077f47be, 0x23d32369, 0xd4e5b247, 0xf5afe801,
-       0xe400cb32, 0xb9e91be3, 0xdac0ada4, 0x38a6e35e, 0xb3ed4cf5, 0xa9f6615f,
-       0x7c22b9a7, 0xb26c8fda, 0xe51fbcf8, 0x3f79f64e, 0xa7d598e6, 0xd636d99e,
-       0x9f6dfda7, 0xb7ea7cd8, 0xb4fae7b7, 0x3cabe3bf, 0x2a6f7a9f, 0xf607e7ac,
-       0x908aeeef, 0xb64fda7c, 0x07c67c18, 0x99f04e0d, 0xf3ec1c9a, 0xe1c8d7bc,
-       0xef71a374, 0xab8efab6, 0x8cf7b9f8, 0x867f1df5, 0x5bdc77cd, 0xd00ec3c5,
-       0x4d106a9b, 0x628f413b, 0xc0254af9, 0x86f1ec1d, 0xbfaa08ca, 0xd2a1695a,
-       0xcf4c9955, 0x52b4ab5f, 0x2c72b1bd, 0x7d800fd5, 0xb026f58f, 0x1d7cb1f7,
-       0x7e7c7cec, 0x8ab57833, 0xdf131eef, 0xcbbe2e3d, 0x076e16d8, 0xef2e04dc,
-       0x4427fe8b, 0xafec36ff, 0x6961d0f1, 0x1aeaa66e, 0x90f8edf0, 0x2f8c5a0b,
-       0xe7b796d8, 0xf3df9fa0, 0x03b6ccae, 0xf3bb305f, 0xea286558, 0x1f3c81a9,
-       0x3de7af21, 0xed97178c, 0xfee3338f, 0x3fa6c6c7, 0x5df7c09d, 0x33c5328d,
-       0x117d348e, 0xba5ce384, 0x503ecc06, 0x97a837e8, 0xfaa24dfc, 0x798f7826,
-       0x82f793f8, 0xcb7a4b61, 0x52eb7a45, 0xd27752bc, 0x86bc8df9, 0xda76dabd,
-       0xef4bdc57, 0xf5be05df, 0xd6b3bf79, 0xdb19bde7, 0xdab67ee3, 0xc5f77e49,
-       0x373c6526, 0x97892fb5, 0xc5d23ce8, 0xc7ad6f9d, 0xbdd2be7c, 0x3ee2070b,
-       0xc9c37160, 0x003fc5b0, 0x7607cbff, 0x2f5ca2a7, 0xf9c5966d, 0x695e3e23,
-       0x891e72b3, 0x7e24bfcf, 0xca084e6f, 0x218906ed, 0x6ab12e7a, 0x6e2a8fca,
-       0x39412faa, 0x573c9c5a, 0x9721f143, 0x3c01e22c, 0xccc4b0df, 0xbae67db8,
-       0x35e7841a, 0x3a3ae0ff, 0xba85f31d, 0xc20ade5b, 0xf9e376ef, 0xdefc2f13,
-       0xdcedc493, 0xdfb8927b, 0x2df1a974, 0xd1b93f3a, 0xbb8716f5, 0x3feb4dda,
-       0x50ddea22, 0x649bbc12, 0x35e17f5a, 0x8ca0f099, 0x4c9260f7, 0x4a6e4de3,
-       0x4ebae130, 0xf2f7f8b9, 0x79fc2c93, 0x9c7cc2fc, 0x3988f1ff, 0x95d93299,
-       0x3ddf2e3c, 0xca3d6a7c, 0xe80fcc51, 0x047b0fcf, 0xb5f985c7, 0x77c63c8a,
-       0x0eb5f7e3, 0xcf1fb806, 0x748a381d, 0x274fe280, 0x473dfb71, 0x3d478f6b,
-       0xa168ca71, 0xdc9af838, 0xf7e21338, 0x3cf89608, 0x57da25f7, 0xdfe46a28,
-       0x0b6e653b, 0xd53bba42, 0x3b464638, 0x40af1946, 0xbe8fb77c, 0x20e6f0fb,
-       0x6b38153c, 0x078e388d, 0x7e79fc7f, 0x71e69992, 0x167279dc, 0x92a74bda,
-       0x68cec903, 0xfcfdf2d5, 0xef6e06e2, 0xaa896a9e, 0x5bf6bd95, 0xba3e05f2,
-       0xd7845593, 0x688d26ae, 0xf99eb737, 0x7c70d3b4, 0xc7cef9d5, 0x1278ecec,
-       0x1792eced, 0x54933a64, 0xc308a9a2, 0xe6df9ff5, 0x0102bf3b, 0x3b8d12e7,
-       0x5e8bcc2c, 0xf8fb9a4b, 0xde7448c6, 0x8589f0ac, 0xf1e0a9f0, 0xc73f3254,
-       0x9f822a72, 0x5bd92a83, 0xd1ed744f, 0x19ae3cf7, 0xbf3c5ff5, 0xae7e66f6,
-       0xf9780f62, 0x3cfd0c49, 0xa65c6e4d, 0xf7a3d62a, 0xbf6d137b, 0xfe841a4b,
-       0x85f91e53, 0x8a26ec40, 0x3c7da08b, 0xa7efe500, 0x7b77e0cf, 0xd879f91b,
-       0x11737d52, 0x5af5fbee, 0xbe604181, 0x4e34dbbd, 0xd118cfe1, 0xec2a5d4e,
-       0x7b16f3d4, 0xa3fb8c96, 0xaeb455ab, 0x89d90692, 0x425d98f9, 0x1bde5dde,
-       0x69d20f73, 0x8cd931c9, 0x5744cdfe, 0x65c7afcc, 0xfb26de90, 0xedc5ccae,
-       0x129db2dc, 0x7d8ab5d9, 0x8bec2a51, 0x3d8ec273, 0xdb87bab7, 0xf62487b7,
-       0xcec78c54, 0x45761528, 0x3d79bca9, 0x9ffb2be6, 0x396c2daf, 0xfd89e74c,
-       0xef16d5cf, 0xba97adf4, 0xbf8aeb7c, 0x9f524ef7, 0xfe82927f, 0x94a7d809,
-       0xc0a9f12f, 0xacafe2a7, 0x2386b348, 0x5b546fbf, 0x037128a6, 0xa1f95784,
-       0x6f38857d, 0x95804967, 0x6f9587fc, 0xbfbb5c10, 0x77497ee6, 0x77f5a304,
-       0xeedf0e33, 0xe5df4e26, 0xc7a9c91a, 0x7023a8fe, 0x5ce4bd3c, 0xa3a8768d,
-       0x12e48837, 0xf7c1e1e6, 0xfee1cf96, 0xa3630da7, 0x855a9530, 0x29fd140f,
-       0xa9decdce, 0xbd83976e, 0x2495c3e4, 0x124e776e, 0x4c2b48f9, 0x835fd256,
-       0xc1ebb9c5, 0x0f6f6e7a, 0x53573b56, 0x6631fe3c, 0xf2714359, 0x4e90a303,
-       0xf14eae30, 0x123d55ff, 0xeb1fc3c5, 0x063f9091, 0x7911ad9b, 0xf849f55e,
-       0x0763d53e, 0x48f6330c, 0xc7ba9df8, 0xd73af894, 0x66d433ef, 0x894fce0d,
-       0x87fb293b, 0x7394fcca, 0xf3e7ff08, 0x8cfcc333, 0xbe01f99e, 0xabff6007,
-       0x0fb25619, 0xe72867a2, 0x1e482afd, 0x04bcf028, 0x70093ef4, 0xa41d3185,
-       0x876d929b, 0x40fe7873, 0xcbdf9d1b, 0xc8ebe209, 0x39e3f911, 0x941cbc01,
-       0x2b35f1cc, 0x9e8bc799, 0x3722a510, 0x85b649df, 0x2fb94325, 0x39322f39,
-       0x62ce73d3, 0x9cfc07f9, 0x87bcbf85, 0x574f44e7, 0xee510f81, 0x3242b4fd,
-       0x63d8fbc7, 0xf9cabf9c, 0x2a3e3ea3, 0xe225e0fe, 0xb5b0e613, 0x9e618725,
-       0x05efe702, 0x78e60d2b, 0x1728be2f, 0xc5a6207e, 0x7297fee2, 0x5cc0be4e,
-       0xec40e748, 0xe8ccc32b, 0x97cb9597, 0xafff5e28, 0x93795df2, 0xe06ddd6f,
-       0x4936eff4, 0x9edcffe4, 0x13cf67dc, 0xfe0b463f, 0xb44bb5a8, 0x9dfb5c2f,
-       0xe6dbc79a, 0xbb5f1449, 0x7cf21e1f, 0x60aed17a, 0xdd9be53c, 0x37da550f,
-       0xfb1509ab, 0x9fb4a1d6, 0xf7589f77, 0xe2df22fd, 0x8315c6a8, 0xa5a3a0f1,
-       0x3f8e2b7a, 0x7f68b987, 0xa36b1e7d, 0xd96074f2, 0xee0d377e, 0xfcfe8a18,
-       0xc51d76c7, 0x6ed76aa1, 0x4f5ca137, 0xb8cd6b67, 0xd8a006cf, 0x5b98fdf9,
-       0xf2538fdf, 0x0e2ec189, 0xfc04fa47, 0x7ffc46cf, 0x1889b805, 0xe2ff7d7d,
-       0x3e53f68f, 0xfbc3e752, 0xd0c03d66, 0xff21eaaf, 0xb562a8a8, 0x1c4df686,
-       0xcb392dac, 0xef055783, 0xf0fade0a, 0x1f16616a, 0x869ac2bc, 0x4be49c20,
-       0xfd2e4833, 0x77a8664e, 0x0557866f, 0xf8113fee, 0xe5ccd659, 0x15be3f97,
-       0xe7803c3c, 0xdf48e2a3, 0x313c236e, 0x7f4bc91d, 0xbe19b87a, 0xe1e73080,
-       0x3aa189ab, 0x54a32ff2, 0x2d469e5c, 0x38be2895, 0xb50fd997, 0xf02b3943,
-       0xbbd10d53, 0x813cdbc0, 0xf3998fb7, 0xff98e4ee, 0x93bdbc3d, 0x3c9d579c,
-       0xf5be7ae8, 0xf11bd3e7, 0xfac58965, 0x3a5f4547, 0x1fa3f219, 0x6bf1fb3f,
-       0xf0ad1e1f, 0xda3c2f3f, 0x5f110657, 0x6e5be1f6, 0x88bd35b8, 0xaa1c607f,
-       0x716bdf89, 0x60957e53, 0x57cf8021, 0xa6f57d93, 0x2e053782, 0x9deb8a37,
-       0xc23b72d6, 0xfb4c88f1, 0xee499f98, 0x639466a3, 0xfce8a729, 0xb3fed29b,
-       0x1f436dd5, 0x1b3e7182, 0x5ad3cbcf, 0xd4a91f9e, 0x3e3c016d, 0xcea459f8,
-       0x4cfdeb81, 0xfa80994a, 0xbfe933e2, 0xb87af3a6, 0x39f582d6, 0x50cc13e1,
-       0xe251ad3f, 0x7c446b89, 0x67e549c0, 0x449b6e73, 0x36f624ed, 0x3f9f8ef3,
-       0x7cfc512a, 0x9c728801, 0x6784cc5f, 0xfeaf3173, 0x46e3cfcc, 0x72df3ed1,
-       0x1f50f1df, 0x921c50c7, 0x5e778bfb, 0xf42cd1eb, 0x7a7d3bd2, 0xfe15d270,
-       0xce933f3c, 0xd808161b, 0xb85242da, 0xe7e4ec7f, 0xd33d1536, 0xd19f6c7b,
-       0x417a4e3b, 0xeafb95c4, 0x7b444f29, 0x3bc3a9eb, 0xe388957e, 0xe91d6814,
-       0xabfb7e78, 0xd1a3e7da, 0xf1d8289e, 0xb7d92278, 0xa226363b, 0xfdb0529f,
-       0xaa368957, 0x4fc9da07, 0x7775f352, 0xa5fdb9ee, 0xe77a5e4d, 0x6fdce1d1,
-       0x9c3fa799, 0x94ee768d, 0x61d79711, 0xe7e13e3c, 0xf387dd12, 0x0eb6d653,
-       0x64fcdff5, 0x46acef4e, 0xe199724f, 0x73c02df9, 0x75ddca7d, 0x93c7a7c8,
-       0x43e4d0bf, 0x9a8a5d3b, 0x399f33e0, 0x7ee38737, 0x5cc906f6, 0x0fdbbccf,
-       0x85cafda5, 0x446d256b, 0xe0b7ea28, 0xea3fe851, 0x1e698252, 0x6a8c368b,
-       0x57f3e7c5, 0x7453e7f1, 0x3853c6ce, 0xca5ab3ce, 0x10f90237, 0xafc79deb,
-       0xf1e7e14b, 0xc8966c17, 0x93be57ae, 0xad584cf0, 0x29753af7, 0xd4672f42,
-       0xce51dc91, 0x755b4e09, 0x1808edf2, 0xbb6a9ff7, 0x39c60529, 0x78b9f4f1,
-       0x149f3c37, 0xfd152172, 0xfdad049b, 0xeeb885b7, 0x83ca3aed, 0x928f48cb,
-       0xe8fda1c3, 0x853fc787, 0x0b5582e5, 0xf2885b7f, 0x147eab71, 0xf3e6174f,
-       0x55592e5b, 0xaadf3f28, 0xc211607d, 0xf5a7abed, 0xaf2f9764, 0xfd670a4d,
-       0xbe528ff0, 0x8dc7f80c, 0x7a955d82, 0x9a57772a, 0x9eda3ce9, 0xffaa08ca,
-       0x2542d2be, 0x6be9cd9b, 0x8dcb99b9, 0xe6378d1b, 0x80b3205a, 0xc1b19abd,
-       0x70632cc0, 0x9c96ce5f, 0x18487002, 0xa37dba5e, 0xa56e1758, 0x4cc4728c,
-       0x6c643844, 0x4d15a87c, 0xee14d0da, 0x6a77bd67, 0xedf23443, 0x2f1d55b2,
-       0x537ae216, 0x7f6146f2, 0x142bb6fd, 0xf9ab7837, 0xef08f9f1, 0xbe3aed82,
-       0xafeeb13e, 0xff0c4e9e, 0x78ef8c2d, 0x7c7e4357, 0x178eb6f9, 0x78b94237,
-       0x6f5a43f3, 0xf5d5bf7a, 0xfbe14c8e, 0xabe3379d, 0x5fe1c11b, 0x455fabe7,
-       0x7f6cff13, 0xf9e1ee9c, 0x7caaf977, 0xdf826ad5, 0xd9bc94ba, 0x695f5f48,
-       0x4fc8d11c, 0x98fca55f, 0x4871dce8, 0xf22bf822, 0x4b3fe955, 0xe558bfc0,
-       0xc62e3cda, 0x61bf5f23, 0xc3df0419, 0xd113e7cd, 0x69a6fdae, 0xfbae0fce,
-       0xb7bf2540, 0xebe009a5, 0x52882f7d, 0x71ed6966, 0x965f5856, 0xffe0c738,
-       0x12a291de, 0x6fdf2cf6, 0x57927fc7, 0x17e8077e, 0x4f9800c7, 0x0ee48b49,
-       0xe9ae3f40, 0x20ea0bae, 0xfb1233d4, 0xc91e27dc, 0x7a5ee7d8, 0xbdf346f6,
-       0xe3865959, 0xeee47824, 0x7ca89f6d, 0xbdb963ee, 0x7ee7c03d, 0x03ff3e93,
-       0x3f69699e, 0x3956b227, 0x4c7980bf, 0x7429cd5d, 0x9682e25e, 0x00ebb1e3,
-       0x3e3c39d8, 0x7baf64c3, 0x77342e22, 0xf59ca3a6, 0xebd96f5f, 0x251f449d,
-       0x215f8f4d, 0xf269b63f, 0xcdfa7505, 0x47787fd7, 0x71dbdd27, 0x859ed341,
-       0xb69754fe, 0x50f11d3d, 0xe79706f6, 0x941c2aff, 0x601b85e7, 0x65e7c021,
-       0x24e89e92, 0x7144be5b, 0x3c63ae81, 0xfcd6502e, 0xded3c912, 0x29971e16,
-       0x84e5b557, 0xa2a31c63, 0x59e515a3, 0x93f7046f, 0x09bdc4ca, 0x1e84e2e3,
-       0xe344f754, 0xd8b70e79, 0x3bfc5627, 0xf90187bc, 0x2ae55cb5, 0xf4a5fca1,
-       0x2dfb8640, 0xe19f9117, 0x3195fcf9, 0xbfce91eb, 0x8d1a0e72, 0xf4bdf1f2,
-       0x1c5197bf, 0x66810fef, 0xd911ec99, 0x6fbc2f27, 0x27994e1d, 0xaec530c8,
-       0x8bc9f409, 0xee5ad72e, 0x38f67b21, 0x1f2b7fdf, 0xbd89f9ce, 0x74a9f9ce,
-       0x846d61ed, 0x820d78d7, 0x6efb149f, 0x4efe1fca, 0xd138797c, 0x92f91c76,
-       0x78e215ce, 0x929c0311, 0x7965da24, 0x2d8d1bf6, 0x95cfafc2, 0x93797de9,
-       0x8e5f70cc, 0x2f289845, 0x53559720, 0xe614e57e, 0x339b471a, 0xf127f6ea,
-       0x7fa99b5e, 0xfe60c790, 0xb441f816, 0x60139d7f, 0xa6fcc78f, 0xc0492ad3,
-       0xc33195d5, 0x87e99f4b, 0x4e353d73, 0xf58f4896, 0x9d920644, 0xe9767932,
-       0x69fb6f3c, 0x83b78ab4, 0x626ec871, 0xae7e1ece, 0xee93ddc6, 0xacc8ef7d,
-       0x9056043f, 0x8cae645e, 0x89df5e59, 0xe6f5ce1c, 0x06ffdc55, 0xfb17293a,
-       0x77f2d9ac, 0xbd3da0cf, 0x5fdf10fc, 0xf98aad3c, 0xe8b3f318, 0xe784b6dc,
-       0x7939f9a3, 0xbc366766, 0x6d2baf67, 0x2a079d10, 0xcc3123df, 0xd66b2b73,
-       0x5138c76d, 0x0c3da699, 0xd36379e9, 0xe7a45a47, 0x4d77dc72, 0x79abe7e3,
-       0x724f5cdc, 0x48ccdcbc, 0x2536957f, 0xbbf18c7d, 0x8b5c63d2, 0x924faa96,
-       0x1b728e7f, 0xb8dc57bf, 0x12f1fc97, 0xbc7f26e6, 0x6e97c1a4, 0x8ffa237a,
-       0xb70e47df, 0x3233dcf8, 0x8fe72b79, 0x325ee259, 0x93b0e226, 0xbd6bc223,
-       0x0a4531cf, 0xcee4d83c, 0x74c76875, 0xbc564ac7, 0xc03ba697, 0x23ed16b1,
-       0x6bb72247, 0x9ddcdfba, 0x8be494b1, 0x34dee333, 0xdb8757bc, 0x6c3793b1,
-       0xf35ecb51, 0xe3ee2c99, 0x05600eeb, 0xf6ef0807, 0x908f8821, 0xe1a8bca4,
-       0x9e3ee883, 0x7c607713, 0xf27b9c48, 0x446fc75f, 0x38b8e85c, 0x7bcca9bf,
-       0x9714546a, 0x7449cc67, 0x19ce2ad4, 0x4a367929, 0x1eb10aff, 0x3d077ec5,
-       0xfb43fe1d, 0x934fb825, 0xf269f62f, 0xbe4d3ec5, 0x17c9a7d8, 0x62f934fb,
-       0xec5f269f, 0x7d8be4d3, 0x4fb17c9a, 0x69f62f93, 0x0d3ec5f2, 0x54e2c3e5,
-       0x11cdff31, 0xd1ea34fb, 0xc1b5e456, 0x10e9fa9e, 0xdf60fabf, 0x2443a7f6,
-       0x8960fadf, 0x257c4fda, 0x118769f6, 0x2166a3e3, 0x547c789f, 0x2a79df39,
-       0xe1193ed0, 0xfce79cac, 0x03a9f72a, 0x42934fc8, 0xd9bf90e6, 0xca26fe0b,
-       0xf6e1caa3, 0xec776c3c, 0x2df8c4d8, 0x140d2724, 0xe0fd3ce7, 0x98739f08,
-       0xacc793e3, 0xc6307bc5, 0x7e71251b, 0x9e647abc, 0x38c1ffe2, 0x66165b13,
-       0x307cb9a8, 0x2d9cbda3, 0x77e3e497, 0xc61a4796, 0x24d61ca0, 0xf70ee7db,
-       0x8339db92, 0x5da3c597, 0x7cb1aad4, 0xc75af18c, 0xbf3a1a07, 0x94f5c4ab,
-       0x8d25ef76, 0x937ec42f, 0x8ed6e393, 0xfcf5f1c6, 0x969b38be, 0x6cfce035,
-       0xee8940aa, 0x3516616e, 0xe1c283ca, 0x58266e9c, 0xd6ec7db8, 0x1821d45a,
-       0x1f18098f, 0xad13798a, 0x04c7cf02, 0x3c0b8f9e, 0xa4d77ee3, 0x85dfbe04,
-       0x6177ee25, 0xd58de4a9, 0x1f2de4a5, 0x27b4f24e, 0xc4ace11a, 0xe728a6fd,
-       0xee8b98fc, 0xd0517c33, 0xbe70d26d, 0x7261f2cf, 0x09c3a3de, 0xb73a2e3f,
-       0x69e22c59, 0x437f629d, 0xcfd2a759, 0xfbf19fd3, 0x0732465c, 0x83b367ee,
-       0x08764f22, 0x9f5023d8, 0xe49c3079, 0x7a1e7290, 0x07ee18e6, 0xfce27db0,
-       0x13258462, 0xc44aa3f9, 0xfc9cbb53, 0x48696d1c, 0x239e225b, 0xa57c12e8,
-       0xd17395d4, 0x6ea1a3a5, 0x284b9cf4, 0x8896d99d, 0x24ba12e7, 0x0dce8a83,
-       0x4fefe76f, 0x8d2bbe09, 0xf729e315, 0xd15de84e, 0x43ee8788, 0xbcf1a307,
-       0x7ba326dd, 0x6efb9729, 0x2811de7e, 0x3a96f316, 0xcc19d725, 0xf7747dcf,
-       0x1e63f71b, 0xf5c6a77d, 0xdb1fd622, 0xcc7ee87d, 0xf694edcf, 0xbf7b319e,
-       0xc68ae41f, 0x7747ddfc, 0x83f7f0b7, 0x6c18bef6, 0x5e6baaf5, 0xb5ef833b,
-       0x8fdd0e6b, 0x7553bcf9, 0x489563ce, 0x74e7bf2f, 0xffb3d865, 0xb8adc21c,
-       0x13eddb99, 0xf4bfecf6, 0xfde5ea1a, 0x3fefda26, 0xe0863c38, 0xf2fcd55d,
-       0xaeb3a466, 0xbfde3cbd, 0x17a3e1a9, 0x74ed417f, 0x54dc0d74, 0xc1832b9d,
-       0x9eecd677, 0x1a9af34b, 0xeb1afae8, 0x46388d4f, 0x903a98f3, 0x11d6f3f3,
-       0xe78fddef, 0xeff6ba01, 0x6ef90479, 0x683000ea, 0xf9bb3e71, 0x7da2a0f9,
-       0xbfd09329, 0xcdb532ef, 0x5ecbf1c7, 0xf339d1d1, 0x74e17da2, 0xc3dbc72f,
-       0x9939f963, 0xa8d1d5e1, 0xefaf5567, 0x508bf1da, 0xfda0676c, 0x6e10f29e,
-       0xb5c915e7, 0xfe110f59, 0x3cf1da5e, 0x81977bce, 0x310b5ff6, 0xc2f502a6,
-       0xa714091d, 0x5f1fe37f, 0x643c47cc, 0x7ce8dbcb, 0x0675d7cf, 0x94e1c215,
-       0xcf0036d6, 0x694e38d3, 0x142cdfc8, 0xfcd3c2f5, 0x60517dbc, 0x2fe10e7b,
-       0xf51a3ab4, 0x47c0d16c, 0xa7bce3a7, 0xa22fd5ca, 0xe65ec3bf, 0xd85dc6f7,
-       0x7e837005, 0x9435ea17, 0xcbb5daad, 0x3be2e744, 0x78f9eaa5, 0x9ea3893f,
-       0x5434ebb7, 0xf51d3c13, 0xb4defc49, 0x48e8305d, 0xe7c5b76c, 0x97fa85f9,
-       0xbd1fd1d3, 0xf254caf8, 0x55fa154b, 0xcea8a5f8, 0x3f1d7cff, 0xfe245ab7,
-       0x33076666, 0x2e93c57a, 0xebae781e, 0xffd3ccb7, 0xce868362, 0xd8ea1779,
-       0x560fcc5a, 0xea28a1f8, 0x5f5c5cae, 0x1136aa91, 0x31c296ed, 0x2f91f3ed,
-       0x3e98182e, 0x27bdda02, 0xe35155f4, 0xff6819ea, 0xa63e68de, 0xbf8f9c11,
-       0xeb7ae089, 0xd383269b, 0xbfd1bf7b, 0x9992b4fc, 0xd4f04fdf, 0x7be15a7f,
-       0xad3df0de, 0xb4fd04ab, 0x3f2e10b2, 0xbc7b40ce, 0x7c502e93, 0xbf4ac167,
-       0x78239273, 0xb699645e, 0x9ef5113d, 0x863ffe32, 0xa85db99b, 0xb7fba76e,
-       0x454dfbfc, 0xc8e50473, 0xb79e7e6e, 0xa0ea51a8, 0x52082273, 0x8b667baf,
-       0xe6270ef4, 0x8787f509, 0x07812c88, 0x11b9eb18, 0xa28f3431, 0x079d0306,
-       0x0f680e2f, 0xc4a93b42, 0xf6841ed4, 0x32ebd74f, 0xe889c3dd, 0x8fc6550b,
-       0x894f7cf5, 0x34ba1613, 0xdf7f4336, 0x1c60e583, 0x0dfe1972, 0x047578a0,
-       0x682a27df, 0xcfe7e40a, 0x1e74edcd, 0x263cffdb, 0xc5ecd3ae, 0x2f4d5d8f,
-       0xe9fb7985, 0x797047a3, 0x10752dd0, 0xe3ff74df, 0x83a468f3, 0x8b5b1522,
-       0x251795fb, 0xea022e7e, 0xa2e21e74, 0xfa2cf7d8, 0xf48018d6, 0x129bf173,
-       0xa92ee3e2, 0xfb5ce49d, 0x7c933fee, 0x93b4d2e8, 0xc468fb9c, 0xe8fc937f,
-       0x8f9f6e0a, 0x447dab72, 0xd91f7f0f, 0x23cf1f3e, 0x7c7589bd, 0x81fff78f,
-       0xfddaeffe, 0xefa8fded, 0x8f3ccaa7, 0x31a4bd82, 0x8710f8f3, 0x270132f7,
-       0xae9c36c6, 0x6343ff24, 0x2dd0fd41, 0x166f03e8, 0x98fe5e64, 0xcc5d4fc2,
-       0xf911a7b2, 0xc7df80b3, 0xc3557603, 0xcdff686b, 0x84fba309, 0xeca6e1fc,
-       0xfc868633, 0x69e2296d, 0xc0fec986, 0x69538008, 0x17f93b6a, 0x87a4ed40,
-       0x91d4deca, 0xe9add99f, 0x2bf281d9, 0x8b9f64c5, 0x6db44aed, 0xbc2433eb,
-       0x15bda0a7, 0xca29fa4d, 0x3997c7f9, 0xbea575bd, 0x884dcfc4, 0x8162ca7d,
-       0xb25bbc07, 0xe243e916, 0x69ab7e78, 0x6f28fbdf, 0x48e2daba, 0xd3f3fb4e,
-       0xe8a7a685, 0x404f8a9e, 0xe2bc3baf, 0x7c2c9f00, 0x6601f299, 0xf1881e63,
-       0xbdbe73fa, 0xfe4bdddf, 0xf5ecdb20, 0xc6b1e91c, 0x170feeb7, 0x0fb74ba4,
-       0xde68381f, 0x00df903b, 0xda13c5fe, 0xbe877ee8, 0xcba84cfa, 0x7e23f55e,
-       0x78f6bf75, 0x0fda005f, 0x505d843b, 0x9a7dd432, 0x3c3df7fc, 0xf40ab76f,
-       0x07f7d51a, 0x6aa57e52, 0x50ade80f, 0x5f50b7ae, 0x51b50714, 0xbf6baadc,
-       0xd779f68e, 0xc68f9f34, 0x523d03f5, 0xf9b8a67c, 0x7ccbdd20, 0x4c87fd10,
-       0x94618fd2, 0x39bfb317, 0xe510fd0c, 0x95ca8979, 0xd3f5f228, 0xcf287e51,
-       0x2277654b, 0xda95f39d, 0x8388fee8, 0x2a25de62, 0x1758cba8, 0xdf3896f3,
-       0x2f7e66b3, 0x5ede3f96, 0x76edc119, 0x9f740f90, 0x79d79ae7, 0x079140dc,
-       0x1cae4285, 0x9ca9e7c1, 0x3ecacdff, 0x442d7411, 0x4e47efbe, 0x0b308f24,
-       0xe282b87f, 0x58463b3a, 0xa7f45d78, 0x89dc7971, 0xd1bd97de, 0x8a9b1e99,
-       0x3dca2cfd, 0x14791e5f, 0x282f91e7, 0x0e482207, 0xc184d1ac, 0x945e8aba,
-       0xc2a2fee8, 0xa073ab79, 0x7ea65b39, 0x2d49ee88, 0xe35bbcc0, 0xa7f2f3f5,
-       0x57b8f1a3, 0xec52f288, 0xe0ed1503, 0x351740fb, 0xe40d1f7c, 0x2ff5e50d,
-       0x073ab49b, 0x68496ff9, 0x4fdbd6a9, 0xd7f8d9be, 0x58af5b9d, 0x0fde139d,
-       0xdcad179f, 0x5d883ad2, 0xbda15e3f, 0x72cc2736, 0xde6573fd, 0x3cca0d17,
-       0x79066827, 0xeaf663c3, 0x734fbc1c, 0x85dffe99, 0xc5f75f07, 0xf51b9d66,
-       0xf697c02e, 0x56bcee83, 0xbd5f13e1, 0xcc8578d9, 0x371ffb49, 0x597fbf9a,
-       0x534fb922, 0x57f02d5e, 0xf9d9f13d, 0xa0fdef68, 0xf6be4229, 0x160a25c5,
-       0x407ba30e, 0x79870bec, 0x4bfc25c7, 0x55839410, 0xa0e23394, 0xbe70f812,
-       0x28781fb5, 0x0467ffed, 0x329a4fcf, 0xe0d5f382, 0xbdcfc5a9, 0xa39e28c6,
-       0xe3741d4e, 0x54a621f3, 0x7cb74fce, 0x2062643e, 0x60c8776f, 0xf74fb8c6,
-       0x5c51bfa1, 0x719d7bb8, 0x306fdf36, 0xdf7848b2, 0xddb6911a, 0x8afbfe3b,
-       0xe7814738, 0x7efce9be, 0xe387e6b2, 0xbea6a94a, 0x1bd912b8, 0xcfb481a9,
-       0x9574d5d2, 0x4b775bf4, 0x43f719a6, 0x469cdaba, 0x7ff2b7e4, 0xea184ffc,
-       0xb396aee1, 0xf5d69794, 0x57ca79dd, 0x06f228db, 0x7c89348f, 0x098b36af,
-       0x7ee7779f, 0x36ed8391, 0x5713d289, 0xa53171e0, 0x2565fc54, 0xff75e07e,
-       0x6b8428d1, 0x93e379bd, 0xa60f3019, 0x1ddfa6af, 0x0439ff00, 0xae2787f5,
-       0xa1ff0960, 0x2b8c4a3c, 0xb8f027c4, 0x57189602, 0xb8f0d788, 0xae31d602,
-       0x15c62580, 0x15c639f0, 0x05718eb0, 0x015c63ac, 0xc05718eb, 0xf80ae312,
-       0x8e716bfc, 0x378c1ba3, 0x9234f71e, 0xcf515ffc, 0x88576bf7, 0xd457a1fb,
-       0x85b7944a, 0x0f5038e7, 0xd3c7975e, 0x5c78f228, 0xb03f685b, 0x456cbf7c,
-       0x0f79e154, 0x79f30e87, 0x3c628e7a, 0x64af7ca8, 0xe7c16d5d, 0x1b1e69b3,
-       0x9e3f325b, 0x35ebcf87, 0xac97bc56, 0x309be5bb, 0xb515778c, 0x6adc53d4,
-       0x2d21f852, 0x6241b9e1, 0xa59d6f18, 0xa9727ee3, 0xd3474f0c, 0xd1d929be,
-       0xf236baa5, 0x4a778a5f, 0xddf3ef66, 0x90af63e5, 0x9bcbe89c, 0xf9cc1972,
-       0xc6d5fa3e, 0x4ff0aef3, 0x57d88fc4, 0xf49bca5e, 0x3d9159e5, 0x2d1f65e2,
-       0x7c64fdc5, 0xe7477f2e, 0xd1c14a4b, 0x93f5281d, 0xcfb7e587, 0x77b2d45c,
-       0xe29bde3d, 0x77dcdfbf, 0x9f6fcf5e, 0xd8aa6579, 0xcfc51e4f, 0x9d3ee489,
-       0x7c3f67bf, 0x475ab7af, 0x70e54af6, 0x266a657b, 0x28d86be6, 0x90f472ee,
-       0x2fadfc81, 0xc4f924b7, 0x21e5b25d, 0xae58f714, 0x6b8f4891, 0xb0ebed92,
-       0xc5dcc4df, 0x18996f14, 0x567e2261, 0xa4bdf0e8, 0xfdf1c7bc, 0xc50b34f2,
-       0xec75b2bb, 0xc89e3467, 0xf89282ef, 0xa24abb2d, 0x3217a97b, 0x597b9d2b,
-       0xf2f7e360, 0x2de8f729, 0x41cf3c60, 0x5be5aba1, 0x282bb224, 0xfb861100,
-       0x0b9e1c9d, 0x7ba1de5a, 0xc4eb164f, 0xbe2a7e3d, 0x89b51e1f, 0xc12cbfe7,
-       0xdef0a41b, 0x58abd010, 0xb37d9e82, 0x03db9e1d, 0x3b734487, 0xe38e12df,
-       0xa1ae3c2f, 0xf0ece13c, 0xa4ed13bb, 0x3e5127ef, 0xf6ef5e03, 0x921f88fd,
-       0x0cf9bea3, 0x43793547, 0x48addd70, 0xb1e714a7, 0xb2bc7953, 0x9e254a80,
-       0x762fe4a3, 0x17b83a1f, 0xce5d9fbf, 0xe1bde5ef, 0xfe80bd79, 0xe729adcf,
-       0xf9145e15, 0x53aa5175, 0x75fcf063, 0x2b46b7d4, 0xfc3b3fae, 0x8af79d10,
-       0x4e1fe313, 0xe5037bcc, 0x39882d8a, 0xcbee1fb0, 0x733c0354, 0xc6120170,
-       0x3c365dcd, 0x4873d337, 0xf51e5332, 0xcb73f275, 0x29efcc3a, 0xdee8978f,
-       0xea809cf0, 0x3f1830ec, 0x8ac63627, 0x89bcbbf2, 0xa0bb5dc7, 0xc3bf78e4,
-       0x3181f749, 0x14d73f7e, 0x2490b781, 0x4cd489fb, 0x82a9f3cf, 0xae5bba6f,
-       0x9be1fcf2, 0xe8eb65c7, 0xb06613be, 0x21b1f72a, 0x188ea7de, 0x8559f14a,
-       0xc21b7a6e, 0x7cdd23b7, 0xbcc3f42e, 0x68352779, 0x6c987c3f, 0x30e10cff,
-       0xbacaff3f, 0xff675a30, 0xcf2531f1, 0xa63e3fde, 0xabffedc8, 0x2bf7fafc,
-       0x513ca82b, 0xb6ca92b9, 0x07bd074a, 0xea75f0bd, 0xff55c5ad, 0x8ff5f08e,
-       0x65bd32ab, 0xe057e900, 0xf6c71e6f, 0x5f02a38b, 0x7af8bcab, 0xa2f04b62,
-       0xd47f680d, 0x4ffee968, 0x615e77cc, 0x49a03924, 0xaa9e37eb, 0xf148cdc0,
-       0x18665ed7, 0x909ff08d, 0xc156a71c, 0x926901fb, 0xf200fecf, 0xf90fae09,
-       0x13e44b04, 0xf3dc57b5, 0x70b02d05, 0x1c07b706, 0x08180f64, 0x8357ebaf,
-       0x1ef090fc, 0xfc8fb325, 0x3f27e4b8, 0x907971c0, 0xf0b57dce, 0xef2526fc,
-       0xd7140273, 0x4f23f746, 0x0c9e5c5c, 0xc2ed700d, 0x0b2d0cef, 0xa3e2bca0,
-       0x475f4e1a, 0xb9bcf237, 0xefc7967c, 0xae5eba6f, 0x163e2104, 0xf339ec0f,
-       0xfc5fb43c, 0x35d9232b, 0x669723eb, 0x257227fd, 0xc3c38d20, 0x63258131,
-       0xcacdf27e, 0xe045ee7e, 0x314e66f7, 0x2e5b9f91, 0x7cb2a0ec, 0x72a7f133,
-       0xed4cb43e, 0xed8f58ea, 0xff3c4d42, 0xbee8cd43, 0xc1aa5396, 0xc1599efc,
-       0xc4a6a767, 0x58605e51, 0xa887bf15, 0xee896ee7, 0xc8149e03, 0x56c857ef,
-       0x0cbc95e5, 0xb956dfef, 0x54c1efc5, 0x122bf8d3, 0x73d15c79, 0x6bdb951e,
-       0xba26b951, 0xbaf6413f, 0xc631a93f, 0x39f45eeb, 0x6ecfbefc, 0x4dff72a7,
-       0xa087bcde, 0x7e1ccd5f, 0xb33766cf, 0x03fb813c, 0x7100828e, 0xb5e8127f,
-       0x99fdcf0c, 0xedc9fe07, 0x15429ebc, 0x19ad539d, 0xeb8d5965, 0x42cc79aa,
-       0x27f73def, 0xe8dcf871, 0x82db9c3e, 0x8369f9ec, 0xe717bfae, 0xce6f2919,
-       0x669fec12, 0xe34ff7e4, 0xeed08de5, 0x4fe19ce8, 0x0e3840ec, 0x3da264b1,
-       0x706c68be, 0x11f40496, 0x06f306a5, 0xd4630fe8, 0x46d05f74, 0x71f313b5,
-       0x7dc5a887, 0xef216a01, 0xd180c861, 0x85a6ded4, 0x96a7c2fa, 0xabea1b31,
-       0xf3f74628, 0xfef9ebc6, 0x5863f438, 0x4646b862, 0x7c78c83d, 0x3e00e168,
-       0x4670c2fe, 0x45a5cfbf, 0x3bf25016, 0x2677f0b3, 0xb0bbc518, 0xea68d07f,
-       0xfef150ef, 0xc3943536, 0x523df8e2, 0xb474eb3d, 0xf1f0ba2f, 0xa71fa4a1,
-       0x773df04d, 0xe78d327f, 0xb8e5282d, 0x9f0f8b74, 0x429b5a2f, 0xd68b8bfb,
-       0x3b4529ce, 0x4810dec4, 0xef3b02e7, 0xef0ba97b, 0x9d962f71, 0xf5823f4b,
-       0x57b74ecc, 0x4a2f7c23, 0xa1fbf996, 0xdffba2c1, 0x8c9e62d2, 0xf2e335dd,
-       0x774e50eb, 0xf7813dec, 0x4fbf4de4, 0x19d3fea6, 0xad9a8fbf, 0xde6cf7e5,
-       0x8ea2b8ed, 0x1eeff180, 0xbcbc5127, 0x468e60c3, 0xc0a16efb, 0x5c69f3d7,
-       0x3f5c2f7e, 0xebfd1134, 0xbddf71bb, 0x5a733d1f, 0x0fde53b4, 0xfc7cc89b,
-       0xfbc54f9b, 0xfef8d34f, 0xfe38b0fc, 0xae837f3e, 0x4b082e23, 0x4a093b8d,
-       0x4ec2758d, 0x58b4cf5c, 0xe115b396, 0x378f28f8, 0x9b981876, 0x8d3eb1e8,
-       0x3d676ae0, 0x3ae38f1d, 0x3ad046ea, 0xa39bc63a, 0x710e5ee9, 0x3312eb7f,
-       0xe31d4f97, 0x98ce77f9, 0xa9214ddb, 0x1ef07f9c, 0xa502c5d7, 0x3d565767,
-       0x5bb41b79, 0xe74f4abc, 0x7d3c9735, 0x8b2bf92f, 0xa73a646b, 0xdefb36c9,
-       0xc4fa0ae3, 0xbff3f38d, 0xdeffd58f, 0xd239c455, 0x8966fe41, 0x955868e8,
-       0xf1fb8b55, 0x4ec05b3d, 0x46f9f780, 0x05da3c77, 0x758356f9, 0xbdcfd48d,
-       0xdc01dfac, 0x6b9ef0b2, 0xcf93f146, 0xe01fedd3, 0x2f561777, 0x03507ba4,
-       0x1714ed53, 0x217e061b, 0x48413fda, 0x69d7003f, 0x7fba5e00, 0x891edd42,
-       0x34facffe, 0x9cc43cf1, 0x34ba2468, 0x0ee7e430, 0xe711398d, 0xa0ceb1d7,
-       0x6d319942, 0xe04fa70d, 0x347abd1b, 0x0160339e, 0x4bbfbfc8, 0x6f3974e3,
-       0x16af3ab5, 0x6d4043ea, 0x6e90429b, 0x4e7d1146, 0x50ebdab6, 0x18f57daf,
-       0x73728b1b, 0x7c2de6f1, 0x4cff025e, 0x34e746dd, 0x198faabf, 0x0a06798d,
-       0x4eb64c3d, 0x4de69b38, 0x8449f707, 0x31cf587f, 0xeb1a37d4, 0x2f5c4ea2,
-       0xf48c3f3c, 0x9b826d31, 0xe5b212f2, 0xbcfdfa12, 0xf74608de, 0xce32f4f2,
-       0xd41bbdaf, 0x391467a4, 0xa003c8a1, 0xd39e1b07, 0x7ffdf055, 0xf2287f65,
-       0x7243e006, 0x8a1b9145, 0x4be8517c, 0x74fe3391, 0x7cc01f35, 0x4fea68e7,
-       0x63914cf2, 0x68d50eb8, 0xf0517c8f, 0x5e30d9ac, 0x81577145, 0xd2f96ce7,
-       0x8708839e, 0x2dd92302, 0xea31707d, 0x5ad12e09, 0xcff784d6, 0xb7943d56,
-       0xe3d22977, 0xd063732f, 0xe05b98fe, 0xa7f29e7b, 0x28e7be15, 0x3df4ac17,
-       0xe56f3947, 0xfc628e9f, 0x0fb00d89, 0x9cfc074b, 0x17b9e5f9, 0xefea863e,
-       0x8131797e, 0xea97d9fb, 0xaeefc59f, 0x68f3100a, 0xa55af3e7, 0x4c31bd25,
-       0x0ff881d8, 0x7188b2f1, 0x13185d3e, 0xdff5027c, 0x093f105f, 0xf1c1ffb8,
-       0x67e04673, 0xe80fc211, 0xae3ae17e, 0x121c3a97, 0xad1623c5, 0xc1ba7c15,
-       0xe7f47cf7, 0x303dac91, 0xfa8e73ce, 0xa312c7f3, 0x7395af91, 0xfc0df6d3,
-       0xf2b4b55c, 0x762fd918, 0x872d7ee5, 0x2b5afddf, 0xebf9f95b, 0xcd73df76,
-       0x2d361981, 0xf7182bc5, 0x1f2516a3, 0xd536f9e1, 0xbbf71992, 0xfcf3c5f3,
-       0xb9cf920d, 0x1e749cb9, 0xa698da17, 0xa3b63c26, 0xcaf1429d, 0x0a2fd26a,
-       0xa0dc829d, 0xd5f97c73, 0xbd4bb4a3, 0xf122e8e4, 0xcab2717c, 0x36d777e7,
-       0xebfdf1a6, 0x181a6476, 0xac725377, 0x3bc90976, 0x9547c50b, 0x47928bf6,
-       0xc1b8c7af, 0xebf8cda2, 0x33fe9e47, 0x367cf9d3, 0xdc94f98a, 0xe5f7ce40,
-       0xb79fe155, 0x9fc9bcd3, 0xf7757a2e, 0x033bf8ab, 0x91d57f45, 0x291a299e,
-       0x9d53d9f6, 0x3ed2f759, 0x55d73f32, 0x693df026, 0xe84167f7, 0xf2379427,
-       0xeca1b2fb, 0x556cb2c0, 0x65fbf901, 0x9087e056, 0xdfbff3eb, 0x41aff57e,
-       0x88ecbe3c, 0x47ffbf12, 0xd65563bf, 0x1fc505f8, 0x64772ed0, 0x4f9478d0,
-       0x5cbfdfee, 0xfb882efa, 0x9704edb1, 0x84df43ec, 0x5ff63cd1, 0xf979b8a5,
-       0xf66175a1, 0xdd7dd67e, 0xcf110139, 0x2af81728, 0xe0af9b67, 0xaaf95afe,
-       0xc82cf3dc, 0xbf7fbe33, 0xce22e975, 0x8dbb1b70, 0x4cd5d6f2, 0x5ccf7de5,
-       0x07e133af, 0xb7cb25f3, 0xbd9d73f2, 0xdc00cb6a, 0xe716eb97, 0x1ddbfcb4,
-       0xc37ee74f, 0x0c27e065, 0xc8377444, 0xddd3cfb4, 0x6578e3c0, 0xe2b54f0d,
-       0x7032d8f9, 0x959d919c, 0x8d654473, 0xeb7bd332, 0x1a47cc35, 0x1679e378,
-       0xfdd136ef, 0xc92e8534, 0xe9f30f56, 0x90697f05, 0x165e7cd7, 0x73ac5574,
-       0xcaf8e165, 0x72105ffc, 0xd857694c, 0xb79d14f2, 0x645d7685, 0x903efc9f,
-       0x9eb2fdf1, 0xcecf3813, 0x7f68636d, 0xb7b5d0ab, 0x0d8fe28c, 0x72b79481,
-       0x7e7be351, 0xdef89f7b, 0x676e74be, 0x24de6274, 0xa6557ff6, 0x13ce19b8,
-       0xe4a2f1f9, 0x2cd1cf9b, 0x73a735fa, 0x3a7e653b, 0x7da503e7, 0x2823aba1,
-       0x6f9fda1e, 0x6f9513fa, 0x6f7c7b61, 0xbd474b6c, 0x9031be79, 0x6f9ed3ce,
-       0x0de73e7c, 0xd765def8, 0x8bc950f8, 0xf3a74ebf, 0x6de5e5f8, 0x73b05ce2,
-       0xe26738a0, 0x3674f5a2, 0x5fe84944, 0xaffc8a96, 0x417dc6ce, 0xc75fe22a,
-       0x627bf67f, 0xefbbafb3, 0x264c77ac, 0xf76cbf9e, 0x7fecefb9, 0xf132fc6b,
-       0x13caa8dc, 0xb7bfe1df, 0x5ddf94ca, 0x4a76f331, 0x48fe763c, 0x0e7803cb,
-       0x7fc7bd97, 0xfeec0d97, 0x9a3fd167, 0xe481c7ff, 0xadefe27f, 0xf7ebfd60,
-       0xfcd9bef9, 0x44ae4231, 0x4cbe53b4, 0x1fb70c47, 0xcc48364a, 0x062b7006,
-       0x680072fa, 0xb3329c4b, 0x231dfde3, 0x2772fef9, 0x2476bfd0, 0x67ca0bc9,
-       0x1dfe0339, 0x6bc10efd, 0x24b93f7c, 0xe7889dd6, 0x5e453b03, 0x3b884941,
-       0x7b8c2071, 0xc949d049, 0xb7a2774c, 0xddb2537f, 0x9735794d, 0xbe1d3e44,
-       0xc95e78c7, 0x23aede68, 0xe745dcc6, 0x189bf638, 0x83aaabda, 0xd2c3a226,
-       0xbddb0d97, 0x4699d5cf, 0x92fffb72, 0xee1bdf96, 0x53e7c1d8, 0xe34d5418,
-       0x5df4125c, 0xf34d5018, 0x29ce233b, 0xbd796a17, 0xbee8c343, 0xfc5d9efe,
-       0x918ba13e, 0x3bf0076d, 0x50a57717, 0x8c4769de, 0xbd136973, 0x452679e7,
-       0x38dce8af, 0x4cbb0baf, 0xf7282e74, 0x9f695b97, 0x274eb7b1, 0xc2e1dc61,
-       0x1ee74620, 0x220fd42e, 0xb2417d7d, 0xc2f37c50, 0xbc6903bb, 0x7495caa2,
-       0xc408a5be, 0x509dda04, 0x76bda2e6, 0x68b9fea1, 0x6fa85fe4, 0x559dbac0,
-       0xf239ffcf, 0xbbfe4ee9, 0xf95f1710, 0xbef78a7b, 0xeffa528f, 0x54f8289f,
-       0xe48da7de, 0x923698fc, 0x91a8f3f3, 0x3bde7e66, 0x2c4cf5d0, 0x37f38fad,
-       0x02fc99c0, 0xafba27e0, 0x39ab8ce7, 0x8a71824c, 0xa86c9a0e, 0xee343bdf,
-       0x0e09e7c4, 0x7877e281, 0x1785f918, 0xbf240c76, 0x1a68ac1c, 0x348ec2e7,
-       0xf252d3ca, 0xada1a64d, 0x234c7846, 0xdbcb66f8, 0xe5fee9d2, 0xc7ca40ba,
-       0x36fc7a29, 0xc89fe515, 0x7a2eeedc, 0x5134f175, 0x4d7ee1b7, 0xa17fcfd1,
-       0x93e28bc0, 0x89695e4a, 0x8fa5a390, 0xf30031df, 0x651fd970, 0xaabb93ca,
-       0xfe8f79e6, 0x48e5f970, 0xbc0f4721, 0x025b7c40, 0xc3bf8e74, 0xc2f22c54,
-       0x71e15f8b, 0x77f5e296, 0xf1f24b3c, 0xde618684, 0x53d725ef, 0x2f70de41,
-       0x96e5c918, 0xda95bfa7, 0xde7b4317, 0x9a20bdff, 0xe50d0ecf, 0xebe3fb29,
-       0x22bffb96, 0x8bfd5bff, 0xf407605c, 0x957c1fb3, 0x57f23db5, 0x060d0394,
-       0xf29e83ab, 0x8d4ebdfc, 0xdf3f296b, 0xd0f92060, 0xaf7e2c19, 0x11e792b5,
-       0xfa9faf14, 0x3857ca6b, 0x699d2f75, 0x7fece65a, 0xa474aebf, 0x0f8bef86,
-       0x3e400eb4, 0xe07c052c, 0x3a1f8078, 0xa8fece5f, 0xebfefea1, 0xcb923a99,
-       0xdc3e3ef5, 0x3ba1f3c3, 0x74bc7307, 0x7a449abe, 0xd39823a7, 0xfc97cc35,
-       0x5e60ced4, 0xe604a252, 0x3d3998df, 0x91778e74, 0xed29ddff, 0xc343b2a5,
-       0x14ad15fb, 0xe6e22bbf, 0x482523f9, 0xff7871b3, 0xb436e6cf, 0x671e503b,
-       0xadd2a68d, 0x1efeb90b, 0xf263a076, 0x7e0a8eef, 0xe870f252, 0xae280177,
-       0x3ca2d2e9, 0xafbb0bb5, 0xdffae1a4, 0xefe7e08b, 0xae43ca25, 0xfb29291b,
-       0x540794ec, 0x2b3c25cc, 0x9fb44876, 0xa1f6bc5f, 0xe2fba442, 0x91732d8a,
-       0x1475941f, 0xfa2e59ab, 0x4c921d49, 0x7ebf01f3, 0xebd4ccc1, 0xf7c0a7bf,
-       0x197ccaf7, 0x3d27cfdf, 0x6fb6bc03, 0x53b145a4, 0x578c3559, 0x4cda56b2,
-       0xfc5189df, 0x053ebe4e, 0x83efb84e, 0x3c4a8cf9, 0x57eb46e0, 0xf9a379e6,
-       0x75e423bc, 0xd7e58c47, 0x1fdf10e3, 0xae4f24c8, 0x4066377e, 0x6dd80fc8,
-       0xcaa14bf4, 0x0fff3078, 0x38c11751, 0x56790acf, 0x79c3f30c, 0xfdf36e26,
-       0x3ae4807d, 0x06f0fadf, 0xa36a7adf, 0xc5bd3d6f, 0xdb7d6eb7, 0xdf82deb7,
-       0x09c0f4cd, 0x073c61fd, 0x879c53b1, 0xcf187f40, 0x8c3fa133, 0xb187f475,
-       0x9f187f44, 0x758c3fa3, 0x8eb187f4, 0x8925b0fe, 0xa258c3fb, 0x65cf8c3f,
-       0x4953872b, 0x023f8f2d, 0x2fb46c1e, 0x5df9473f, 0xd10bf00a, 0x421c2d1e,
-       0x7cc61d76, 0x7e9577e9, 0xd2296d79, 0xfd930cd1, 0xcc4cc8d2, 0x1f5b6ac7,
-       0xf2fded89, 0x1b464a94, 0x686f188c, 0x3d7e775f, 0x2629219a, 0xaf6c15fb,
-       0xae952fe4, 0x4f7e8b7c, 0xe5b57daf, 0x78e13f8f, 0xf287b8a2, 0x78454f7b,
-       0x714cbe4f, 0xf8a33d2e, 0xdfdf559e, 0xf9fedc3d, 0x679ab746, 0x5801fff4,
-       0x00db8bbb, 0x0000db8b, 0x00088b1f, 0x00000000, 0x7ccdff00, 0xd594740b,
-       0xe6feefbd, 0x49324995, 0x41e42126, 0x21e4cc20, 0x49389311, 0x47114bc8,
-       0xa8d53048, 0x684d43c3, 0x4092138c, 0xa3c30480, 0x7b96c4eb, 0xa4401833,
-       0x51b78d70, 0xa13a3951, 0xe85de94a, 0xb6950a09, 0x1006739c, 0x4e6d8ac5,
-       0xb6abad5b, 0xa9078838, 0x68349687, 0x69edec57, 0xdff7ffef, 0xbef997df,
-       0xbc7b5249, 0xacdd77ab, 0x7bfe7ba5, 0xfe3f6fef, 0xeffffdef, 0xfc42108d,
-       0xfb5bfe85, 0xdaf08c7c, 0x85fdff05, 0x442fdfff, 0x59cf10b9, 0x0e9d3247,
-       0xd77c2e21, 0x4f5c5bbe, 0x1868ac65, 0x06e6a42a, 0x09a449bb, 0xb8df11b1,
-       0x5335a884, 0xef0479a7, 0x28c7f651, 0xa4f34c42, 0x885d3108, 0x49f933d1,
-       0x05fffa82, 0x2c4f377f, 0xa8cac75b, 0xadde0eb3, 0x6ccf3098, 0x548af09b,
-       0x735dfb1a, 0x4f1a05f0, 0xa24d79d4, 0xea4d8842, 0x35ece71a, 0x59105109,
-       0x38c1b5ef, 0xbfeb7421, 0x018a60ee, 0x619a1a2e, 0xb1fd7fe8, 0x497b431c,
-       0xbda1ae68, 0x13d6f96d, 0x962144e6, 0xf4332eed, 0xbc116abb, 0xa7cfabcf,
-       0xea6e0307, 0xf0d1bbe7, 0x3aea109d, 0x936eb29d, 0xc3fce475, 0xd1d37fd4,
-       0xe3004f4c, 0x2f0b35ee, 0x8d03b7ed, 0x2b6442a5, 0x4f181d81, 0x179e2a0c,
-       0x6a56bc68, 0xe8bb53f7, 0x9d38f3b1, 0x2c3b7e2a, 0x2da4e022, 0x9bf3447d,
-       0xd1e77fa9, 0xc256e0f4, 0xc9c61f4b, 0xf0a776a4, 0x6b78d326, 0x87170ee6,
-       0x6f359c68, 0xd042bb7e, 0x83ccbb16, 0x215cced9, 0x03c12b36, 0x9f10b34e,
-       0xab4e1ca4, 0xd98776a6, 0xf443c8bf, 0xfca67cb9, 0xe78455c7, 0x1ecc87cb,
-       0x0d6d93cc, 0x291295a5, 0xab268385, 0x038cec06, 0xcdfb07fd, 0x63a24175,
-       0x9cc3ad16, 0xc18fe112, 0x797169fe, 0x35bec88e, 0x0b6d987e, 0x7d84dccd,
-       0x79eb1cbd, 0x0a3f8041, 0x9dbc62ef, 0x8fe02b31, 0x80945b8e, 0x3ec8faed,
-       0x77e53a37, 0xea3e7eda, 0x7c0632a5, 0xdb3e65e6, 0xbe5fb6ac, 0x8bb144f6,
-       0x7bd9d1f6, 0x2c4cdb2c, 0xe874ceb0, 0x01952640, 0xfb19bfbb, 0xffcc18e9,
-       0x679a7cc5, 0x61663bed, 0x3efffea6, 0x9ab128b0, 0x8bc9f7f6, 0xc13d4f56,
-       0xdb7ff70f, 0xac7da616, 0x1e6d04b5, 0x3bbe3b2a, 0x7952f368, 0xae41c1eb,
-       0x65b0755f, 0xb575f831, 0x7d81dee8, 0xbf12b25f, 0xb1d1f0eb, 0xa4e7d950,
-       0x31eebf75, 0xc4777f31, 0x6bda3f09, 0xa74ff3cd, 0x95077f62, 0xb97b2c12,
-       0x85adb0ef, 0x7ed47bea, 0x7a32f2d1, 0x74ed5976, 0xa43a3fea, 0x92a7de30,
-       0xd743bb8f, 0x1b2c7cb2, 0x7cb97373, 0x88213aec, 0xbe11df25, 0xa5744122,
-       0x3ef01ab5, 0xfcccd67a, 0x1cdc7a39, 0x8749f414, 0x0cba942d, 0x2b17f874,
-       0xf88ba1d3, 0xa4f88aa7, 0x40df7e8b, 0xd9be6fa5, 0xd40fbfc0, 0xbdf81bc4,
-       0x88e4e841, 0xcc47bbc6, 0xebcbc030, 0xeffd0d73, 0x945d7e5d, 0xda46943c,
-       0x0dfff8cd, 0xbb827691, 0x4a5c04b6, 0xc685a022, 0x30b72a7a, 0xf866dd9f,
-       0x8d2c4bbe, 0x3f9f03f4, 0x678c6fff, 0x4b6d8621, 0x26bf688b, 0xafd107a2,
-       0xad5e7fc1, 0x6d3d730f, 0xb39720c4, 0x98bf3d73, 0xf2317c4f, 0x47ec55b6,
-       0xdf089fc5, 0x7f46e815, 0x20e913b9, 0x9d5a1104, 0xb1d68937, 0xa9c908fe,
-       0x618a5f41, 0x06eb17d0, 0x74b6ba1d, 0x2a628bd4, 0xb4059be9, 0xb0c0ae8f,
-       0xf8c1dbad, 0x4a1164b7, 0xa22bf7d6, 0xdbfb8527, 0xbc2452b3, 0xac47f505,
-       0xf875861f, 0x686378c3, 0x816e633f, 0xafb744bc, 0xac0b7da7, 0x3dfeec47,
-       0x2dfad5f4, 0xde631f75, 0xea3cdaf5, 0xae9f1af8, 0xebdf4bde, 0x9e3d1dd6,
-       0x72c5c4a3, 0xe1e0f6bd, 0x7e1067d7, 0x4b92f996, 0x439d4720, 0x852dac4b,
-       0xd34df913, 0x9a0f57fb, 0xf06e3183, 0xb7e629df, 0x8f5683d1, 0xb2f01bf8,
-       0x0f182bde, 0x8ab87cd1, 0xf9a765f6, 0x3c511d57, 0x03f64541, 0xf146d67e,
-       0x9acdc627, 0xbe1a6f04, 0xd517f1c6, 0x683f1abe, 0x298fab9d, 0x09cbe841,
-       0xa7c68978, 0x3f2acf3a, 0x0aeb90fd, 0xc6a2baf2, 0xf2d15515, 0xfe86c9b8,
-       0xe114fba3, 0x1f18be54, 0x2c6cc74b, 0xe573b3df, 0x2a8e47fe, 0xddf4fd9e,
-       0xae16633d, 0x1f1fe71f, 0xf214ade1, 0x921f0137, 0x7e527c9f, 0xe34b1eee,
-       0x7c5efeef, 0x34fc45f5, 0xefdc573b, 0x7af44473, 0x621e9e44, 0x49294b3e,
-       0x5b48bd48, 0xace5dfa0, 0x3b3d541f, 0x4d243e95, 0xfc94facf, 0x71e7e603,
-       0xf894e3bb, 0xa57568dc, 0xeb4f8327, 0xd468f68c, 0xd64a4ae2, 0x642d21f9,
-       0xc0d35d67, 0xc2d333bf, 0x609f8e34, 0x4f4d57e8, 0x76f1d5fb, 0x0ecdcb6c,
-       0x6ff3beeb, 0xea09a6b7, 0x1a75bd9f, 0xceb12d97, 0x9691d834, 0xec1f66ad,
-       0xa48f87e3, 0x5f1155a7, 0x9addb87d, 0x7c434f5a, 0x6cbce0f8, 0x96b80451,
-       0xc58f0bcb, 0x131d0434, 0x625d55f7, 0xfd747c62, 0xaed8f7f7, 0x3674d6fd,
-       0xb77201b1, 0x156268fd, 0xfb6eb38d, 0x649c2acf, 0xfe4c87cf, 0xffda12ba,
-       0xdb20ca27, 0x2c1ce173, 0xfc4515f6, 0x6bdbb589, 0x3bf761d3, 0x59ea7cff,
-       0x56ff7dd8, 0xf8899a6b, 0x273f37e8, 0x3db0a87b, 0x52e23f63, 0x4be3e4ac,
-       0xfb07c42f, 0x292fff88, 0xf54b1bc2, 0x8a27cc6b, 0x7afb069d, 0xffcc1efc,
-       0xb79a76cf, 0x0f06f31c, 0x4f5e6064, 0xebcc1ae0, 0xe49f9adf, 0xddfe2bff,
-       0x7fa57b03, 0xe7b54077, 0xa0328857, 0x3b5ec1db, 0x97abffc3, 0x88473d10,
-       0x0c19bd43, 0xe2ebd4bf, 0x80b7a872, 0x3914d7eb, 0x46fbbd25, 0x3cd2364a,
-       0xa0a28581, 0xa3aded9b, 0xdfeb42c0, 0xe079c4a4, 0x3c526c4f, 0xfdd04ee9,
-       0xced2c9e7, 0x5e8bf4aa, 0xe4234dcf, 0xf3f8e983, 0x68bb31e6, 0x2deff1d3,
-       0x2f00d922, 0xfa1a67b2, 0x86dd3ad7, 0xae335bf6, 0xc57fb435, 0x6f806255,
-       0xf436a82f, 0x8b73c3bf, 0xeaabbe01, 0x4bfe862b, 0xf00c4bbc, 0x4346bab2,
-       0x2d7dbbff, 0x1b7bf686, 0x1bda18d6, 0xf00c1bfd, 0x341e3b57, 0x7bafbff4,
-       0x2bdda1ab, 0xbbd8169c, 0x171f44e3, 0x885ffde1, 0xbd37282e, 0xd3d0ef9d,
-       0x5322fe75, 0x7c24d0f7, 0xf48968fb, 0xea517e6f, 0x98fe05dd, 0x487c9265,
-       0xc3ae17a5, 0xd427b033, 0x0a42259e, 0x38622bfb, 0xdd137c13, 0x7e7dba2f,
-       0x2eabc9fc, 0xf4ada1a2, 0xe90b06c3, 0x2795f98d, 0xbe0972cb, 0x1b6be5f3,
-       0xe61fa42d, 0x2af278df, 0xb6951fe0, 0x32fb7235, 0xc345aec1, 0x04376fcb,
-       0x6ff39d68, 0x81edd9ce, 0xe913f3df, 0x9fc54cf7, 0xbe5b77d8, 0x10ca37dc,
-       0x93ca23f1, 0x5f288fc4, 0xb36c7e23, 0xfc47bf92, 0xaf4cf288, 0xd47feb87,
-       0xd9e5c55b, 0x3f972f5e, 0x72e3adee, 0xe5c7d7b8, 0xb81b7b4f, 0x9faf79fc,
-       0xb7b77bbf, 0x7af7cb83, 0x97feb9bb, 0xfe5c3dbd, 0xf5c037aa, 0x2c2896af,
-       0x0102b4ff, 0x037b05bd, 0x776f5dfe, 0x77a4cc84, 0xe5eb31c5, 0xf24abd71,
-       0xdda578ad, 0xa2a95c54, 0x6ebeca89, 0x5c878e11, 0x17c92d86, 0x39f8be89,
-       0x7a237ed9, 0xea2e22d4, 0xc61fadfc, 0xaf424f7a, 0xc9d33108, 0xffad58fa,
-       0x69ef52a7, 0x15ee5fae, 0x977a7d7a, 0xd023ffdb, 0xb2f71dfb, 0xec3332fc,
-       0x24e9f753, 0x24c77a6a, 0x93e3263a, 0x593e5467, 0xc62c4f60, 0x3d816ef9,
-       0xb27b083b, 0x83ee12c0, 0x4cfbea1e, 0x3d221eb8, 0xc6c12274, 0x11efa97a,
-       0xca13fb0b, 0x9be182a7, 0x7dc30552, 0xa19b0d9f, 0x3d381777, 0x54576c19,
-       0x022ecf38, 0xdd722949, 0x4a1e6758, 0xa7cd53c2, 0xf3b045e1, 0x2e6c3937,
-       0x5f9c09e8, 0xcf314a62, 0x02bcdabb, 0xd7bd52e3, 0xff3fdf46, 0x68990899,
-       0x5fa8b35d, 0x10a5f32c, 0x87d81728, 0x87923ecd, 0x276f5499, 0x9bd51678,
-       0x02d7bb65, 0x6c3a7c3a, 0x76a11d86, 0x03db2491, 0x7cc894a6, 0x2c133ada,
-       0xeca97e34, 0xe72a5897, 0x39c0bc01, 0x3ad0a254, 0x1e1cbafb, 0x02dd21e0,
-       0x5efee7de, 0x543f7f33, 0x3a1e04e2, 0xfb411e1d, 0xe2052c20, 0xaf1fb94a,
-       0xd722c133, 0x5fa9f353, 0x432fd178, 0x71d46278, 0x803db2ec, 0x0d4a6e71,
-       0x8f805a65, 0x20279b6e, 0x9d62f1c7, 0xfb2f17e8, 0xb93acc85, 0xad03fbcd,
-       0xacffec97, 0xf4376194, 0x4c43f12e, 0x2bd4f829, 0x539961f9, 0xa97083f2,
-       0x1a1fcab0, 0x4a752cbf, 0xedcafc92, 0x78d29677, 0xafe718be, 0x7fce49e3,
-       0x97e6e4aa, 0x512cdf10, 0x1fbff5fd, 0xfd2578bf, 0x7bbd5267, 0xf468df22,
-       0xe347f8d1, 0xd23e6883, 0xb7a340f8, 0x7f345df6, 0x3455f345, 0x4bb02d3f,
-       0x0f8e833a, 0x49f91329, 0x906874f9, 0x6769dfd7, 0x4fcd16bb, 0x35307cd1,
-       0x4e7dc93f, 0xfd08a3e4, 0xcf2f8f81, 0xde6ec347, 0xa4fb66c7, 0x8ff1a47c,
-       0x1f1a4fc6, 0x16223fdd, 0xcb535127, 0x9475eb98, 0xcffc727b, 0x8ab48f40,
-       0xab33165b, 0xbe45cd38, 0x9efd8984, 0x5bdfa298, 0x501fc4b1, 0x2f73c23c,
-       0x2e3381fc, 0x7ec5d8ab, 0x4251d7b6, 0xeaa45bf4, 0x9ba233d1, 0x8fb91ced,
-       0x46b5d001, 0xc2a2f125, 0xd77fecd5, 0x2c7e8c38, 0x88fc232c, 0x17efd4db,
-       0x0db7c9ff, 0x6a9c58eb, 0x536f6ff4, 0x455be3fd, 0x375f8f3f, 0xf0bdaa33,
-       0x6f9bf656, 0x6fd633cb, 0x5efd5528, 0xcf4370b7, 0x5c8f08d6, 0x7ecdd89f,
-       0x572a8d6b, 0x72fd2a59, 0x9f31665d, 0xfc2b58f0, 0xd7f72816, 0x62f3677e,
-       0x80455bdc, 0x2088afe1, 0x108bb797, 0x1907738f, 0x0977c002, 0x69dc0561,
-       0x91b6c91f, 0xfb37ad48, 0xf85f803f, 0x39fe59db, 0xc636c738, 0xcf20fbfa,
-       0x6cefe2a7, 0x5be6807a, 0x0f28b654, 0x71ac9ddf, 0xd2753fb1, 0x1dfecb9e,
-       0x129ac2e4, 0xc937cf91, 0xfd91e63e, 0x13f6453a, 0x9fb269e5, 0xdec76479,
-       0xf809fb20, 0x02ad82b6, 0x29762ddf, 0xb7dba2c2, 0xceedfdf6, 0x6d32c245,
-       0x7b74fb6a, 0xfa67f7f1, 0x4adf7f89, 0x1223539e, 0x60d65651, 0xa7256fbf,
-       0x6319649b, 0xd5e8b2e3, 0x4ffcc9bc, 0xf322ff8d, 0xa6f9e62d, 0xd786b3c2,
-       0x786a7c68, 0x7d7812fe, 0x3ebc3269, 0xced82253, 0x595fda8f, 0x5755b88f,
-       0xde6fd4bc, 0x06441357, 0xa3c6eff1, 0x1bfd1cf2, 0xe313312c, 0xf7b53c4b,
-       0xe42c28dc, 0x2bdc7f4a, 0xaaf3c002, 0x8fae6a9e, 0xf7898f8e, 0x6bf8616e,
-       0xd9572f2a, 0xdde821fd, 0x6ba1a5cb, 0x1f12c3c8, 0xbc4bebef, 0xedf9e681,
-       0xce0f664b, 0xd7669d27, 0xace20f6e, 0x2f3d996f, 0x9d3ffbe0, 0x724a5eca,
-       0x369f9e25, 0xd3ac39e9, 0x9da8f12e, 0xe39dbec3, 0xce14b963, 0x23c80cb2,
-       0x5f9829fd, 0x92665ff3, 0xfe27692f, 0xe59367dd, 0x454cfe54, 0x529fe91c,
-       0x50facfee, 0xc77d1fa3, 0x538d1670, 0xeb26fa41, 0xaf3e38d1, 0xf7de9d78,
-       0x08d50ed8, 0xc5afbf83, 0x25534623, 0x6b88171e, 0xb03c449e, 0x04558ce6,
-       0x82147da9, 0x250cf68f, 0x7a35bd08, 0xfa19aae6, 0x114136b6, 0x542f60d3,
-       0x6193127d, 0x3e9d2e12, 0x09c57588, 0xe38f8e97, 0x700c520b, 0xa1866782,
-       0x8e55527f, 0x3bd93da1, 0xad3ed0d7, 0x4f00d4ae, 0xe860ddf7, 0xd0b0de9f,
-       0x6ffa6700, 0xeacff433, 0x35806a58, 0xab25957d, 0x15eeacc4, 0xf767ef86,
-       0x77f434ac, 0xda1ad607, 0xfb8971cd, 0xbc068f59, 0x4e3405c3, 0xee4e3a9d,
-       0x7e868dce, 0xaa6dd082, 0xbfc89c80, 0xceeb1267, 0x3acf4428, 0xc87aaac7,
-       0xd7ff7e69, 0xd734eb8d, 0xbca9925b, 0x7fd465d5, 0x784619b5, 0x4284e391,
-       0x4e458b43, 0xeace1ea3, 0x8ce018b6, 0xd79bd232, 0x51628fd1, 0x2f82f1cc,
-       0xae7fbfa2, 0x78d1fe81, 0x84f07e22, 0x69ec9fd0, 0xb37aeb00, 0x8f7b02d5,
-       0x1f7e82fc, 0xf1e82fc8, 0x1e82fc80, 0xdf417e46, 0x7d05f91f, 0xfa0bf23b,
-       0x4633b2f6, 0x1b0f97fa, 0x9ef95fe9, 0x5f1afe91, 0xeaa7454e, 0x843f91b0,
-       0x7f2bf15f, 0x5e374e85, 0x344ff232, 0x37266e7d, 0xf4153927, 0xd7213c50,
-       0x9dd7a797, 0xfa22f451, 0xf7c04c04, 0x9f4904cc, 0xa04975d0, 0xb319ed57,
-       0x8ffc1208, 0xc77cfb51, 0x23286fe2, 0xab86f03d, 0xebfa0334, 0x147ae166,
-       0x9dc5db71, 0x86884f26, 0x7e35115d, 0x7dff0cf5, 0x1a17a465, 0xb6cd5da6,
-       0xfc463f81, 0xdc9e7073, 0xd9ddeaa5, 0xc0fc7271, 0x127cc142, 0xd839baf8,
-       0x339ee347, 0xcfd02bf5, 0xb7f44fdf, 0x0bfbfbe3, 0xd47f79bb, 0xcdf7c143,
-       0x0d931aff, 0xe0b679b8, 0x0c28b073, 0x88492f97, 0x2ce6c5e8, 0xd43b27aa,
-       0xe39ea655, 0xdf4ed43c, 0xb8c99775, 0x69c7824e, 0xa15178e3, 0x444e22f0,
-       0xe6ecafc7, 0x6ce3e022, 0x63e01cec, 0xde41e4c0, 0x25756c20, 0xde051f41,
-       0xbde40b34, 0x9fc217e0, 0x57faa59b, 0x29e46259, 0x5ece73ac, 0xd7abb061,
-       0x62c2ed06, 0x0d397fc8, 0x8650d170, 0xc7f5ffa1, 0x92f6865c, 0xbda18150,
-       0x00c78cec, 0x19570f97, 0xe7be57fa, 0xe1d5c035, 0x1bff433a, 0xf00cf92f,
-       0xef9e456c, 0x239653bf, 0x992e21f3, 0x387e6bdf, 0x6bfa5079, 0xf9afdcf2,
-       0x49ffa2d5, 0x38711daf, 0xbf357f95, 0x6da3f35c, 0xcfd04084, 0xf6c2d3b6,
-       0xfa5da660, 0xf62dfec9, 0x6827c8f3, 0x57e6bafe, 0x08a9fe6b, 0x76f57ad4,
-       0xf693be87, 0x35ebf545, 0x8bf359ff, 0x4c5d8b13, 0xb236eb3f, 0x4b07e0ab,
-       0xae761338, 0x1a4c4639, 0x4cb9790f, 0xd7a25b9e, 0x7a2badaf, 0xa762c4fe,
-       0xdc7517e4, 0x7ee2ec17, 0xccfe24df, 0xf57caabf, 0x63beb99f, 0xad67cfe0,
-       0xbb56f79e, 0xf4f3ebff, 0x1321fc25, 0xf5f352fe, 0x264dfd72, 0xc767c713,
-       0xd72e5fd7, 0x0bf595af, 0xd921dfc9, 0x37e2f359, 0x1fc83af7, 0xc2c7b678,
-       0xaf339671, 0xe40c6c5c, 0x5e121fc1, 0xfc9b338c, 0x3e07d07c, 0x0b07ce05,
-       0xdf3ccdcb, 0x772932a5, 0xcf2cbd11, 0xd242a365, 0xc6c7b47f, 0xe849d479,
-       0xeda07ccd, 0x8b43f107, 0x510dc655, 0xc9686e22, 0xc0437197, 0x44a21b88,
-       0x2ff510dc, 0x3e187af7, 0xf0c55bd2, 0x0cbd7af7, 0xe3adeb1f, 0x3ebd07f2,
-       0x26f8d7ae, 0x79da5f1a, 0xc43fa34b, 0x2f237610, 0x1feb1f8a, 0x6d72f492,
-       0xd3f6fab0, 0xa24deb16, 0xe08d294e, 0x8f151ef3, 0x3c49e633, 0x7fe41fa0,
-       0xe6b57eaa, 0x9bc424c2, 0xc92b8547, 0xaae257f9, 0x687c2f7f, 0x973f1f78,
-       0x949bcb8e, 0x52e4a987, 0xceeb3f3b, 0xd1772cab, 0xb72d18f2, 0x3fe778d1,
-       0xfc7bb9dd, 0x53c5ab5c, 0xe8d53954, 0x55b5c9a2, 0x5fa11b84, 0xce267982,
-       0x609c3f53, 0xf3c5a394, 0x077f7e24, 0xbcf2a239, 0x326699cb, 0xfdb2f847,
-       0x1017f271, 0x4869ef1f, 0x8059e0e4, 0x7dba8fce, 0xd2faf02e, 0x2b7ea06e,
-       0xd062ac07, 0xb0757d85, 0x44096d1d, 0xd8471b9f, 0xaddb6c9f, 0x3e469f38,
-       0xe7e4e77f, 0xd13fce4a, 0x6fc26d38, 0xfbdbbac3, 0xab56fd8d, 0xfce8cae7,
-       0xd53cd54a, 0x878479de, 0x7f351ffd, 0x19f6a1de, 0x6e609fe7, 0x60df1a92,
-       0x1432a479, 0xb9bf3ba3, 0x8b28ef90, 0xb8b784c0, 0x6dc3d802, 0x6bbe4f16,
-       0x7869bf22, 0x97e7989b, 0xf7c41bf7, 0xa0fcf962, 0x232ff9e5, 0x6afa0fcf,
-       0xffb514f9, 0x985980e5, 0x48e0df71, 0x7fa7e70c, 0x4f7b3a6b, 0x7f974b8e,
-       0x11b79099, 0x309fb889, 0x27ba687a, 0xb4bac930, 0x1b361fd2, 0x684c91ee,
-       0x11347adf, 0x17cec9e7, 0xf3a69e65, 0x796953c5, 0x3cd7bd3a, 0x1bfbc2cf,
-       0xe7dbf932, 0x9bdc8f4d, 0x60c7fb58, 0x357aca31, 0x9fbd127e, 0x5f36bd71,
-       0xa519fe61, 0xab5eb1fd, 0xa47f7853, 0x49e40517, 0x112fd7cb, 0x5a9454a1,
-       0xb3bfc43e, 0xe5a0e99a, 0xd5425a43, 0xfbbb8fbc, 0xa8e35b56, 0x2da9f84b,
-       0x48ae71b5, 0x4b3c249e, 0x2a99bfde, 0xac6cb25f, 0x3e5bc784, 0xb38f2376,
-       0xe65b9e6d, 0xd9edb64f, 0xee6fff00, 0x1e056141, 0x4e3956c2, 0x553e9e34,
-       0xdcb924e5, 0x6e37b7a8, 0x6f6f5855, 0xf796ad84, 0x6b6f587c, 0x157ed5f0,
-       0xa6f095ae, 0x5b0e12ed, 0x24953b1d, 0x05c45fb9, 0xd8944fb0, 0x87b1ce0f,
-       0xf60238d4, 0x40fb1281, 0x6015f43d, 0xd0c02be8, 0xafa18057, 0xa15f4250,
-       0x65f0a57e, 0xbc888e23, 0x4e4e8d4e, 0xd1a9d790, 0xebc81ff9, 0x75e461e8,
-       0xd791fdf4, 0xaf23b7d1, 0x5e476fa3, 0xaf230f47, 0xbc8fefa3, 0x5e461e8e,
-       0x791fdf47, 0xbc8c3d1d, 0xf23fbe8e, 0xe476fa3a, 0xc8edf475, 0xe461e8eb,
-       0x91fdf475, 0xdfb7d1d7, 0xf218a3df, 0x9a93f73e, 0xeeb5df06, 0x71fcc69d,
-       0x313bedda, 0x41fbe88f, 0x66bf9ffc, 0x8f9d01cd, 0x6edf01af, 0x48f38aec,
-       0x49d7f73a, 0xa4849bba, 0xd32348f3, 0xc24d8b79, 0xe7749eb5, 0xf20ffe24,
-       0x99563529, 0x7c89414f, 0x53e44a0a, 0x529f2250, 0x29f32f93, 0x414f9128,
-       0x2829f23d, 0x89414f91, 0xe44a0a7c, 0x9f225053, 0x14f91282, 0x0a7c877c,
-       0x5053e44a, 0x4a0a7c8f, 0x7f5053e4, 0xbc81d68e, 0xf82eb68a, 0xf38679cb,
-       0xe1a1f11c, 0xc034e73c, 0xfdf597f0, 0xdbeb2fe1, 0xdbeb2fe1, 0x61eb2fe1,
-       0xfefacbf8, 0xb0f597f0, 0xe58b9e69, 0xfeb37e0c, 0x7acdf83b, 0x703fa8b8,
-       0x3ba0b11a, 0x35eefdf6, 0xe504e194, 0xdf49c559, 0x15b7ff97, 0x638583c8,
-       0x0f64ec95, 0x0fadbfd9, 0xd821a8ad, 0x2ba7deaf, 0xd0262316, 0x44d8f39b,
-       0x04487f37, 0xe8a08f71, 0xd76e4cf3, 0x47fcaaf2, 0x22392f74, 0x535f0fd8,
-       0x7da5d724, 0x334e11ef, 0x047fad4a, 0xf45fbc9e, 0xd63f5afc, 0x9075ba97,
-       0xfdc12c9d, 0x8e2d9286, 0x4fc45dd2, 0xfb0a4c07, 0x9fc807a1, 0x5e893a5a,
-       0xa3fd50aa, 0x27c3a603, 0xa22f70e3, 0xa7ecf145, 0x88b1afa1, 0xe052d633,
-       0xfe14bba9, 0xb2797642, 0xdf75afea, 0xda3f7b80, 0x1db8b5ba, 0xf22f09e9,
-       0x8447f3ef, 0xb9e68dad, 0x6b6153e9, 0x9366df87, 0xc3be02fe, 0x80baedb9,
-       0xe3afdde2, 0x697282ef, 0x0d81fcff, 0xfd51b437, 0x6fba8775, 0x171f8768,
-       0xcefbbf27, 0xc78c8973, 0xfb29b73b, 0xf99fb4cd, 0x90778487, 0xcb9495fa,
-       0x8775dff3, 0x9e36b69c, 0xd76b69d7, 0x97d843df, 0x5ce1736d, 0x8835c228,
-       0x8a7989ff, 0xf0444178, 0x0d7bfb46, 0x4486bbfb, 0x75d7f105, 0x3ffb6307,
-       0xd751f1d2, 0x7e01b250, 0xff6658e0, 0x59fe3a47, 0x72441f87, 0xec206e41,
-       0xf24aa756, 0xc3bd6af5, 0x79c51be4, 0x623ecba2, 0x9a6efe03, 0x7b8b5c97,
-       0xf0b8e26c, 0xe6ef83e4, 0x4e9f6cb5, 0xbd07f2eb, 0xba03dc1e, 0xd3eed3e9,
-       0x63ef3f0c, 0x82a7d998, 0x70f6c7d7, 0xc509404e, 0x0cee2a13, 0x09529a0c,
-       0xd5b023be, 0x87fe869a, 0x00ee0784, 0xa0b12899, 0x42afb234, 0x558a6c31,
-       0xd4e22fc0, 0x91ff1d34, 0x7e0e58e6, 0x0558f129, 0xc58963f8, 0x89be8569,
-       0xefa237f6, 0x71ff907f, 0x6867bcaf, 0x6b1ec0b5, 0x538b51fe, 0x36eaf5ae,
-       0x2d1ffb2b, 0xd0ffc947, 0xfcd52bdd, 0x085eed0d, 0x109e1df9, 0xdb91f8ec,
-       0xb9d42e39, 0x7fbe1de1, 0x783b89f1, 0xfaf89920, 0xf7c39c93, 0xb7e1b954,
-       0xc94fac28, 0x272ce86f, 0x3f6cb63c, 0x55f3889d, 0xfb0af038, 0x3db7571b,
-       0x08e3289e, 0xa6d11f32, 0xcf8b49e2, 0x68f4abb4, 0x7d01ef53, 0x3bcb7a48,
-       0x086eed87, 0xbd6836f7, 0xfb4457ec, 0xb91f9a87, 0x384f1b4e, 0xa45c45df,
-       0x8bb7f683, 0x5bbbd5a0, 0x89886476, 0xd53ae3fe, 0xcdb35caf, 0x3a7ef7ca,
-       0xc2ed9044, 0x3f54609a, 0xbacfbef5, 0x9dfac683, 0xa7fe51e5, 0xeed22e7a,
-       0x7dbcb6e5, 0x7ff66eea, 0x6f9cadba, 0xfd2ada6b, 0x04587121, 0x8bc015f3,
-       0x3704b14c, 0x947af51d, 0x27e7f849, 0x1f545faa, 0x2ebc658e, 0x7d678b19,
-       0x8b2c74b2, 0x32c67be1, 0x4c77bcb9, 0x8a5c8bde, 0x3bd10c58, 0x9104ab5c,
-       0xea99fb4f, 0x7b8ddd0f, 0x2063a092, 0x9479f99d, 0x145319f8, 0xae6a7aab,
-       0x77053957, 0xdfeadeb3, 0xf5987b8e, 0xcbfd8283, 0xd137e03b, 0xa3f00df8,
-       0xdc1e41a6, 0xb73f7cb5, 0x6ef9114e, 0x9506c3c8, 0x041e49ff, 0xeb2f0feb,
-       0x41259ab5, 0xf069afdc, 0xee81361f, 0x03f81c9a, 0xef802de7, 0x57362808,
-       0xf8279f21, 0x79f1acbc, 0xc7343cb4, 0x8725f1ab, 0xfb8d1f8c, 0x9d2c58a7,
-       0xd7e045bb, 0xded4bc2b, 0x0ce0188c, 0xf7081195, 0xfdb28509, 0xaf5fd1e4,
-       0xd3c386d8, 0x343f8c97, 0xaf4c4c99, 0xf6f7f211, 0x70c56043, 0x65e43a6d,
-       0xcbba52b7, 0x53cf5915, 0x572f0b95, 0x2bc5cee8, 0xf922f955, 0x63f9c74b,
-       0xe9f923e3, 0x40ff1262, 0xcf095b2b, 0xa4e6b390, 0xa214d7f0, 0xc2e527cc,
-       0xdb0c435b, 0xe27dd428, 0x73ad0422, 0x7c670a85, 0x9dfdee2f, 0x861f8c85,
-       0x5e5f962f, 0xbffc2811, 0x8a4d87d0, 0xab57ef85, 0xfc9871f8, 0xefc3951f,
-       0x831787b7, 0x2385f1ae, 0x1a2dd036, 0x1eedf73f, 0xf08733da, 0xe9215190,
-       0xb7eb64d7, 0x045179f2, 0xb55f88ad, 0x22fb4a16, 0xafecae2c, 0xc5c43e72,
-       0xdf6d3e71, 0x89f7aa1f, 0xace1f1a3, 0x7e027690, 0xf48e6bb2, 0x4fc25193,
-       0xf81c7dc6, 0x27e180c9, 0x8c9f84a3, 0x80c9f87a, 0x860327e1, 0x7e180c9f,
-       0xc9f84a32, 0xe4c27fa8, 0xd130ff3d, 0xf05369f3, 0xa7c4abf0, 0x4dfaa59f,
-       0xa7feb415, 0xd79b8f71, 0x11fde7ef, 0x195eb0df, 0x5fc453d7, 0x1f088af6,
-       0x70b9ecad, 0xe11394d4, 0xbf9db6a7, 0xe205ea7f, 0x17e4958f, 0x3bfd9e42,
-       0xf14c5095, 0xdcf67cd4, 0x979638da, 0x636ebee7, 0x1b64dbfd, 0x47776d3e,
-       0xcf7ef9f0, 0x7d4ab4ff, 0xd177ca19, 0x63ba2bb8, 0x4fffd03d, 0xb1d2fa55,
-       0x0f42f8de, 0xad32e5d3, 0x251def89, 0xbf50b3fa, 0x9ebf0c52, 0xbf9afd41,
-       0xda3676f1, 0xb6ee381f, 0x1cb70f41, 0xe191d92b, 0x177ef7c2, 0xe1c5b5f8,
-       0x58cfc1b4, 0xed992dbf, 0x8cba736e, 0x73c712db, 0x47a34bde, 0xb78c8555,
-       0xb829527d, 0x979ea2bc, 0x25d64108, 0x6e927e86, 0xc5a6f2d1, 0x58e3a311,
-       0xf3ca7891, 0x0710733b, 0x3e9e1549, 0x217c44d7, 0x8d2b61ce, 0xe3a251c4,
-       0x6af2e31d, 0x9df88613, 0x50a9ae56, 0xdbcef70c, 0x85abcfc7, 0xd7e1d38b,
-       0x1138a63f, 0xb8736e6f, 0xb826adee, 0x37158ced, 0x8a7d4532, 0xf04996cb,
-       0x738a23c8, 0xb9bde83f, 0x1356f584, 0xf78a5268, 0xb72cd50b, 0xcb2a416d,
-       0xafef96a6, 0xd66a763e, 0x90afb1f7, 0xb67586d7, 0x14b6bd39, 0xdad3df9d,
-       0xf7f578af, 0xb1b83520, 0x9b0dc642, 0xfc0118e8, 0x6dd9b7dd, 0x2538895b,
-       0xffb83fb9, 0x13e546b7, 0xc7ea3bed, 0x73ea1ff7, 0xabe0ebc4, 0xf417da11,
-       0xd52be616, 0xe312bf8d, 0xfea7e6eb, 0x56b5b7ec, 0x2d78f024, 0x1bb7da4e,
-       0x49d793a5, 0x8d3c6078, 0x5cf1a1ec, 0xbde30f3c, 0x7ab41435, 0xbbdc1eb0,
-       0x33857820, 0x2b3cc568, 0x7c7095b7, 0xce5bbfdf, 0x6c99dfe3, 0x675f822b,
-       0xe966da71, 0x3be23dfd, 0x0e1365f0, 0x5ebca9f7, 0x08db87f6, 0x43f0294f,
-       0x75ffc853, 0x8b57c44c, 0xfeb6feba, 0xd8ffa364, 0xf41598ff, 0x4aed5469,
-       0x549e1d34, 0xb6e578f9, 0xd7786c5b, 0xf2f166d0, 0x8abf07bb, 0x10df7fef,
-       0x90f90bbb, 0xad2781c6, 0xae1f826e, 0x93f67e90, 0xeadf9215, 0xb8f94273,
-       0x21b231e7, 0x3721ef96, 0xbf79fb3a, 0x9c7ef8e3, 0xc4ff03f0, 0x137c63e9,
-       0x9f70049f, 0x48c06daf, 0x127ac8df, 0x81b6dc78, 0x55bf9616, 0xa9cdbf16,
-       0x13dec75f, 0xa5e10af9, 0x815ee491, 0xb3fa71fd, 0x1f173fc1, 0xf79b37bf,
-       0x7be4eb49, 0xe2d71e54, 0x37cc798c, 0xff1ad7cc, 0x79499734, 0xa97be6d6,
-       0xbdf3c2c2, 0xb4e525f4, 0xdf0b776d, 0x10cd6983, 0x62f9451e, 0x53e4d539,
-       0x3546d793, 0x7bbad92e, 0xf4ebf089, 0xeeefd90d, 0xcfc12797, 0x2b9d7565,
-       0x3e127a54, 0xb8ba135f, 0x3d2abbdd, 0x728c729b, 0xee30f18f, 0x9bee5529,
-       0x37f28616, 0x6bfa4614, 0xc8a536f3, 0xe0ffc0ef, 0xbd2a53b3, 0xf7237fd1,
-       0xeaa4f157, 0xbd71d68d, 0x1a7b6871, 0x8561c6f4, 0xf71b54f3, 0xe36ebf48,
-       0xe71c098b, 0xaf8d8ffa, 0xea1ef8fe, 0x8313c9f7, 0x13f7facd, 0x27a9216d,
-       0x829fc9da, 0xdaa558de, 0xff6286fd, 0x72742b4f, 0x17adf6dc, 0xac5c81af,
-       0xf8b92a18, 0x0efbc14b, 0xeafcdf41, 0x73be1fc5, 0x5f622b83, 0xdcac7db5,
-       0x16d66ff9, 0x726f1e87, 0x560abb9f, 0x493cef0a, 0x5ac39c2f, 0x1df229b7,
-       0xfd8d8f59, 0xd1de8d4f, 0xf242d07c, 0xf088eadb, 0xa9ff4681, 0x78db26fc,
-       0x5fd24e3e, 0x07c6b7a3, 0x3a35bd1a, 0x9d297bf1, 0xfbadafff, 0x2b5e9533,
-       0x531dfe54, 0x87456ee5, 0xe58ab6db, 0x056b6ddd, 0xb1fa6bdf, 0x4e3f58cd,
-       0x7eb8e727, 0xc0b901df, 0x69d022bb, 0xc655b774, 0xa04d0f23, 0xbeec3653,
-       0x6ad58eb6, 0x8d5db1dc, 0xfcd2ae1f, 0x4c7f62e0, 0xab4e8ea5, 0x6a74939f,
-       0x5fede97d, 0xfbc5c0ff, 0x4f6c7a93, 0x2b8bfb0c, 0xbd330e87, 0x663e771a,
-       0xf4bf5375, 0x5f41b74a, 0x389776b7, 0xb15f3711, 0xf90ad073, 0x4d74af4f,
-       0xea4defca, 0xaf0d60bd, 0xce8a3fb0, 0xa1fd69ee, 0x3cd30ef7, 0x26c4379b,
-       0x368d1ee2, 0xf252b78f, 0x72776b75, 0xed6be60a, 0x381ff96e, 0x3f7a68cf,
-       0xc42eee5a, 0x4958794a, 0x2f2e429f, 0xdec9e2dc, 0x3f313858, 0x959595a6,
-       0x10cf6e92, 0x256f717a, 0xbbe87e2b, 0x03d643c0, 0x93e41e71, 0x41c2f2f3,
-       0xc63e0bcc, 0x17a46dba, 0xaf25ff71, 0xac7bfc33, 0xbe745c83, 0x213282ef,
-       0xd23be645, 0x926fde08, 0xcc72b3ef, 0x52afbcb2, 0x0f6a3bda, 0x86a45da1,
-       0x68ffb1cb, 0x5f9535bd, 0x36a7f1a1, 0x9a9eb44e, 0x57777f6a, 0xa2fa794a,
-       0xab705dfd, 0x4f029371, 0x6de69db6, 0x078e747e, 0xda2fa471, 0xe64e2da7,
-       0x4bf7c697, 0x32955acc, 0xe4f37ec9, 0xfdea6839, 0x4da6d40e, 0x7909dfb2,
-       0xb44e555f, 0x79e3efbb, 0x27997e92, 0xdd90a0b9, 0x6c2eefa2, 0x65fbe588,
-       0x38b4beda, 0x5efadffd, 0x14cac1e1, 0x4e14fe35, 0x14d93f80, 0x487fcaa7,
-       0xa25fa8c2, 0xfdecd7ab, 0x21386739, 0x3f9fa745, 0xa1ed56ea, 0x3c81ef08,
-       0x815c9e8b, 0xfeb9c778, 0x42a6090b, 0x9f5ca7f0, 0xab66ddf6, 0xf40f5ce7,
-       0xbe18f6dc, 0xd37e4eef, 0xda93c40e, 0xa71cc903, 0xeca7afb9, 0xe71a5ee2,
-       0xfc596dbe, 0xf3f350de, 0x2ffaa957, 0x8ecb737e, 0xebdff44a, 0x6f8fc276,
-       0x886cf877, 0x2c0fc5c3, 0xdfb0e5b1, 0x5a01cf2b, 0x22b36ade, 0x0c9efc7c,
-       0x657211fa, 0x7b07913a, 0xf4af7ab3, 0x624debff, 0xb39bf227, 0x338b7cfb,
-       0x529e1fa1, 0xc527f03c, 0xdaa3d23e, 0xc7748c79, 0x6fbec587, 0xef68bf41,
-       0xc6c2e6ef, 0x219fb19a, 0x829dce2f, 0x07ec0bfc, 0xa65e01eb, 0x6e71fca9,
-       0xab827ce0, 0x2fcf8230, 0xe3481efb, 0xd67f2d0b, 0x194ff88e, 0x0d29a3f8,
-       0xe6a6d1fc, 0x2c0c76c9, 0x707db862, 0xe9fbbf19, 0x473a6743, 0xfb563db6,
-       0xef08a044, 0xda3e2578, 0x09dd16ba, 0x7f63a8bf, 0x35ce324c, 0xb640d6d9,
-       0x1b6d0fde, 0x01df987c, 0xe58c1a5d, 0xce354077, 0x67b83525, 0x7c9f6ab3,
-       0x3bf5a767, 0xb597eaa1, 0xef0c8b5d, 0x4c69da79, 0xd9ff8d27, 0x5fdf3c50,
-       0x04e9ded3, 0x95e3feec, 0x4ebdf2e5, 0xd3be4bb5, 0xaefee4c9, 0x5af4e349,
-       0xbe57b179, 0x3bbdd0fb, 0xbe91b3ba, 0x257aecef, 0x7bace311, 0x4e1567fc,
-       0xceb7c713, 0x77f1fc60, 0xbbe57b47, 0x27c7f6a3, 0xbe03ff7f, 0x1c767f06,
-       0xc6790c53, 0xec4982fb, 0xc243fa87, 0xdfb6fc86, 0xbdcfd829, 0xb03d1664,
-       0xa25f9aeb, 0xc552ffd5, 0xfea4a5c3, 0xcd7fd06c, 0x61b32781, 0x20937e37,
-       0xf703a6e1, 0xc87a08fe, 0xf48c7cff, 0xfd822dbf, 0xf480d6db, 0x64f7b597,
-       0x38ec7842, 0x19547f87, 0x46b9f2cf, 0xada4977d, 0xae0bfc8b, 0xd4458dff,
-       0x6f781d61, 0xdf7e7e04, 0x3d076a12, 0x147f27df, 0x2a138f79, 0x6fdfbdff,
-       0x87f7cc5e, 0x57e01048, 0x4affdfbc, 0x9a89f202, 0xfe6b561f, 0xb4ef1795,
-       0xef951e37, 0x870be381, 0xd4231cf9, 0xa77ac978, 0xdf8db7e4, 0x4ace2eb7,
-       0x6b8abf65, 0xdb212d3a, 0xab5af464, 0xf0e34dfa, 0x2e7cc391, 0xfd243ceb,
-       0xf3a1ce82, 0x7e6817ec, 0x70bef686, 0xecf3a1dd, 0xaddf6827, 0xd2f1223f,
-       0xb7d64475, 0x78b49814, 0xc3c9578b, 0x38615979, 0xb4d2c2bf, 0x9b9b00d5,
-       0x3a505ab6, 0x08c878d5, 0x0abbe5fb, 0x99e7ca7e, 0xb8ea6dae, 0xf3755b04,
-       0x974d56c5, 0x3ea8daef, 0xa5ef81d7, 0xbbdad73d, 0x50f3c88e, 0x276e2ba8,
-       0xef5d83df, 0xebeca0b0, 0xdf3db072, 0xc02a6dd7, 0x12af757d, 0x71dcfec7,
-       0xf4d6fef5, 0x22c6ef75, 0x4629904e, 0x7cdc994e, 0x15666b6f, 0x022e9b8d,
-       0x7b4b8f7c, 0x9fe5744f, 0xf8c32e3f, 0xafc2620b, 0x5b980220, 0x7909a335,
-       0xe1490593, 0xf73c6032, 0xd384ba58, 0x0e20afc3, 0x37240ce5, 0xa5f28f21,
-       0x8af54ae3, 0x30eece21, 0x0a07aff9, 0xdb2ec6ba, 0xc4635c64, 0x5799b906,
-       0xfa68f925, 0xe2473a49, 0x83b9f51c, 0xd3e981cf, 0x9b9df9ba, 0xa1970c28,
-       0x837c71df, 0x8c7f60fb, 0x420eff93, 0xf6f5979e, 0x027558c6, 0x3de99797,
-       0xa425aeaa, 0x9f0363e6, 0xf7f8829b, 0xa12b8e04, 0xbcfdeb6f, 0x4f292aee,
-       0x979918be, 0xceb14bbd, 0xe4fa27fa, 0x835fdb90, 0xcc72fa75, 0xb8b92545,
-       0x7def2b17, 0xb7f3515f, 0x50bcbf9a, 0x7a96769d, 0xc8cdb3ce, 0xb4fe4070,
-       0xd78a89fb, 0x1f52efcb, 0x8ad93c2a, 0xc4737f75, 0x1620efce, 0x73c9c48e,
-       0xb63a8cd5, 0xd9b17daf, 0x2e283fec, 0xfea2688b, 0x214d0b27, 0xa6ffdfdc,
-       0x599e73b0, 0x6dfca3d8, 0xc3df2c53, 0xf1bf8e56, 0x964dec39, 0x92a7f7f9,
-       0xff599f68, 0x8ba078a0, 0xfe2f479b, 0x6ca84fe3, 0x187fdb1a, 0xfe4911fb,
-       0xb9c3f066, 0x7ef3bad1, 0x9d37f542, 0xb48f7643, 0x8fbf4263, 0x9e7e0fe3,
-       0xac8a6298, 0xc5c8caef, 0x879d5f17, 0xe9f1ced2, 0x32cdc785, 0x9eb5159e,
-       0xbe2e192b, 0x98fd4e0f, 0xa61c573e, 0x0b87ce20, 0x0f7a9f8f, 0x7b885beb,
-       0xd83738ce, 0xf6f597ad, 0x2566b84e, 0x150e7e23, 0x88ac97fa, 0xb540783e,
-       0xae7d694b, 0x7b08dc9f, 0x2059a6f9, 0x651440ee, 0x07d6883e, 0x425f833f,
-       0xaa37c6fe, 0x07ed79e4, 0x546fbe39, 0x67065cb1, 0x9be72e41, 0xb69fbf27,
-       0xe3514aaf, 0xd1ae9259, 0x8ba68b74, 0xe7716f86, 0x8524e9f0, 0xa8f45cf1,
-       0xc62eefc4, 0xb767e7ef, 0x198a9893, 0xc636fbff, 0xf86ffff3, 0xca7de2fd,
-       0xfbe373f7, 0xd3ed3afc, 0x77e7d86d, 0x93ed1ffe, 0xbcdfc0f5, 0x3ee361cf,
-       0xb142fad3, 0x8f37c073, 0x8acfd89b, 0x0a2a37be, 0x66d1eb04, 0x53c71c73,
-       0xddf271fd, 0xd3cfe901, 0xde9a9fd0, 0x2e175d9c, 0x4e71bf82, 0xaeb16788,
-       0xeb8869b0, 0x30e5562f, 0xc314ccdf, 0xc27efc99, 0x3f872e12, 0x35bfb66b,
-       0x4bb223f7, 0x0f048f03, 0xf4e34abf, 0x56a7c129, 0xeddd5f41, 0x95dcfce0,
-       0xa56029a0, 0x45920679, 0x7f9a31f1, 0xce5ccd60, 0xaa115cb3, 0xb1b06a9e,
-       0xecf6a29e, 0xca37b41e, 0xf9fdeff6, 0xa3f81ec2, 0xf782f923, 0xae225033,
-       0xc0f04bd9, 0xff6e0292, 0xf6e7a6a1, 0x97efc824, 0x8193e608, 0xef7c2935,
-       0x83a7e9e4, 0x0e8ec2d7, 0x11337a0c, 0xf44cab57, 0x19c74187, 0x079f6966,
-       0xe54f54dc, 0xb1af8a13, 0xc914e31d, 0xe31b86f5, 0x43403a5e, 0x2a91e6c5,
-       0x3d73faa5, 0xd5cf9c09, 0x638b47e4, 0x7f9c0ecf, 0xded2780a, 0xf2a07f23,
-       0xc5778699, 0xa667df2b, 0xe8d678aa, 0x6a5bf1a0, 0xa6cf7c9c, 0x377c916c,
-       0xbd791f7e, 0x33c8fbe0, 0x27782969, 0x71e31cd7, 0x4adfdf01, 0xfd618ff2,
-       0x3e881b7d, 0xd243ec66, 0x5bde1ce1, 0x997fe24e, 0x7e5a4dab, 0x3463df9f,
-       0x9a5fa90b, 0x3d17f7b5, 0x2217f7c6, 0xef19333c, 0xe89f9891, 0x3edd67fb,
-       0x5fbe355b, 0xd2fb65ee, 0xd9def2ac, 0x7a4f34ff, 0x5aa9286f, 0x623b95da,
-       0x9dfc89fd, 0xf3450efa, 0x7c96cfc3, 0xe4f60b3c, 0xcc6f83dc, 0xa2577944,
-       0xf69ab92f, 0x1fe344f3, 0x7dc4c316, 0xf7e61990, 0xfe341f34, 0xe5c71671,
-       0xfcc1bcb7, 0x57aeb7ff, 0x01ffc75b, 0x0934e170, 0x000048d0
+       0x00088b1f, 0x00000000, 0x7de5ff00, 0xd5547c09, 0xf37df0f5, 0x66499996,
+       0x0d909326, 0x8a027108, 0x081380a8, 0xc3b44069, 0x8e22a222, 0x260dc55b,
+       0x1037d902, 0xfdaff0fd, 0x2d361032, 0x4682d0d6, 0xa0c0748b, 0x0d0482c1,
+       0x00e02418, 0xd52ff82e, 0x5b7bbfd8, 0x16c34a0c, 0x7e1b8092, 0xce7fe5b5,
+       0xef25f7b9, 0x6d80264d, 0xfdfb5fbf, 0xe6f169bf, 0x5ddf7bbc, 0x3dcf76ce,
+       0x14fbdcf7, 0xf89628db, 0xe0cec663, 0x2cabd20f, 0xdd51b18c, 0xa0db6ce9,
+       0x74fa87a1, 0x6559ffe7, 0x4287ead3, 0x6ed0ab1e, 0x9cfdd61e, 0x7e5485b1,
+       0x386b8c40, 0xf4d31cbb, 0x8f0e1b10, 0x9616c96d, 0x6e7dd8cc, 0x0901bf46,
+       0x912974be, 0x5615ceb1, 0x780cbaf7, 0x085c7aae, 0x20c8f7df, 0xf7c25077,
+       0x1652c93c, 0xbaa23fe4, 0xbecc01d7, 0x6cb3233f, 0xe0da66c6, 0xc3fc0f6f,
+       0x7cbea07a, 0x63106cac, 0x059969ea, 0x77ea7fa0, 0x3403a512, 0x00efc336,
+       0x6c2df978, 0xfeeed0dc, 0xecfd13b9, 0xe8b78073, 0x5b7e89f9, 0x097f90c0,
+       0xecffa893, 0x5faa4afb, 0xf2f16f6f, 0x073e6c5b, 0x8d941636, 0x7f963bcf,
+       0x8be7c2e9, 0x7aa16e9b, 0xd82c5318, 0xc8b772cf, 0x635cfc4f, 0xbbfaee96,
+       0x76a214f1, 0x04d3d874, 0x3188feed, 0xb6bfb5e9, 0xd543c032, 0x0563d556,
+       0xaad84cbc, 0x700c7f86, 0x84295ae9, 0x9d9765b0, 0xfb4bc031, 0x9d870e6a,
+       0x9fcb0f9a, 0xaa1805a8, 0xff36b728, 0xdbc40afc, 0xa3ad9956, 0xf784fc66,
+       0x3bc71b56, 0x9e70e46b, 0x6ba5839d, 0xf7c74f77, 0xccad1a0b, 0x6e95f50e,
+       0x057a9fcf, 0x54fbf9c0, 0xd74a4586, 0x01fad02f, 0xea92185c, 0xcf18ee11,
+       0x36e0fda8, 0xca1eb439, 0x939ab877, 0x1ff1836f, 0xcf31b4ab, 0x676fd0c5,
+       0x80adf273, 0x96d0a287, 0xd15ef849, 0x2c8bc946, 0xfaeb6134, 0x7bc2fb37,
+       0xaf241ba5, 0x5c52f015, 0x433ccb17, 0xc0ce1f78, 0x3906d6bf, 0x9fc863fc,
+       0x1964e30b, 0x49ead748, 0x57f6c64c, 0x37671e68, 0x0e558e9e, 0x376b1e61,
+       0xda01ba5c, 0x5ecaf781, 0xc438bc94, 0x200b0b32, 0xb76fb65f, 0x81d67b4f,
+       0x0da05be3, 0x96b8e276, 0x3f2e586a, 0xeecdbb94, 0xd5adfec1, 0xd17e4126,
+       0x9e5ab5ea, 0x75c5fe81, 0xcd8f3197, 0x419aafd0, 0x88fe4629, 0x9b018f4c,
+       0xc453fb18, 0xf91eaf98, 0x37690944, 0x9fa2e419, 0x2ef44f14, 0xf54d93ae,
+       0x4b192603, 0x007eff82, 0x82be027f, 0x57849d3b, 0x05736e9d, 0x3b74e91f,
+       0x2987e425, 0xfac6d99d, 0x48e7f4f5, 0x754fe807, 0x5fd29ba5, 0xba52a654,
+       0xf443d2b2, 0x07f10279, 0x6fd172e9, 0x4e3658d7, 0x3e5d7681, 0x4b3146e6,
+       0xa71be298, 0xe7e09c02, 0x01ddf270, 0xf19673c9, 0x6a13e9eb, 0x72651720,
+       0x53e49b15, 0x05ac02fa, 0xb42f30e6, 0x9be8dcaf, 0xd7b19a38, 0x1c71e059,
+       0x502922ff, 0xac657480, 0x740fd53e, 0x1e812259, 0xc52d7c01, 0x961e0241,
+       0x067e05f4, 0x4f713d3a, 0x24b2b3f6, 0x70889ac6, 0x668f73de, 0x54353d50,
+       0x0cf50a8f, 0xc93d773a, 0xf54c73d3, 0xd02f4f24, 0xf54b59eb, 0x9eafcfd8,
+       0x318fa627, 0x917a67f7, 0x580bcf5e, 0xfcf3916e, 0x633c95c6, 0x333fb9ac,
+       0x949ea84a, 0x002cbdbb, 0x7f9d65e5, 0x864fb358, 0xf8c6c77c, 0x23328f11,
+       0x86df8d1f, 0xaa4139f5, 0x97147c8c, 0xa7926313, 0x09825f78, 0x9fb933ee,
+       0x7f927ca9, 0x653f29a0, 0x7c11a5da, 0x5eb770e9, 0x54e86026, 0xfea35e38,
+       0xd234fd6a, 0xd9fae33b, 0x9fa07e08, 0x03cef483, 0xbb170263, 0x57d8dfa1,
+       0x407ff406, 0x8eee5c0b, 0x2e3037c2, 0xea62a589, 0x991a60b1, 0x78e554bf,
+       0xfbffdf1b, 0xfde107c1, 0xe0e74b72, 0x4bff8078, 0x8e21f71a, 0x4ca88ffb,
+       0x32316e81, 0x3172c0ab, 0x6ffa4656, 0xb3f64669, 0x975e0341, 0x917e000d,
+       0xa65debba, 0x1f915206, 0x4115825b, 0x3025cfe4, 0x8c7eb041, 0xe115641d,
+       0xfef085e0, 0xc454bc80, 0xfd0355bf, 0x835f6c61, 0xfb5287f6, 0x5b7ed8ad,
+       0x075bed2f, 0xb7da98e6, 0xda9817a5, 0x3ed069b7, 0x706747c8, 0xf01f68be,
+       0x93b18637, 0x6fb53e6c, 0xf6a02f4d, 0xc0ac6a97, 0x574c7ed4, 0xbb60dffb,
+       0x49fb63df, 0x703fc651, 0xe9fc798c, 0x6bf1e645, 0x416cfc7c, 0x431fb450,
+       0x20a497e3, 0x117a7f1f, 0xd795bf1f, 0xabbed5db, 0x049aff0b, 0x5ea43aed,
+       0xac683fc6, 0x9417fc79, 0xe56fc798, 0x2c17bbed, 0xa83bed13, 0x196978fd,
+       0x2505ff1f, 0x0d66bed4, 0xb48f9178, 0x211531fe, 0x40d34f9c, 0x07485280,
+       0x921d28fa, 0x93e818c0, 0x8481b2df, 0x38620787, 0x03137ddf, 0xd6e8e6fc,
+       0x12042ca7, 0x9970f308, 0x8de2e9e0, 0x3f3e34e3, 0x9f5e6907, 0xab3aba2d,
+       0x8cf9a651, 0x2e86b4ad, 0x37b6fe82, 0x678441ca, 0x2432bcad, 0x760a7cd3,
+       0xb0a7be02, 0xf3ff3e30, 0x8ceb61aa, 0x674c8ae3, 0x2dadab57, 0xd2eab906,
+       0x90d9e3ef, 0x055fe80a, 0x6ea8c132, 0x34f415b8, 0x39fc3d03, 0x0f4c63e8,
+       0x392edcab, 0x5d9c7a04, 0x059b946c, 0xb2092edc, 0xff4087f7, 0xdffa227f,
+       0xb77c70aa, 0x884293ce, 0xcc566fff, 0xcd9f50d1, 0xa4058eae, 0x5ca3f777,
+       0xbb73a9d0, 0x14f64435, 0x9f88074c, 0x191449db, 0x1baed3fb, 0x305c94de,
+       0x31f4d63f, 0x0b3777bd, 0xf2854e2d, 0x0ee79733, 0xeff8c370, 0x211d669a,
+       0x7cc4fce3, 0xc7242dfd, 0x8725bfac, 0x2b0d69b1, 0xdc00fed4, 0xbcfd4d3e,
+       0x1dfef0c5, 0x577c3301, 0x576e1981, 0xed05aa43, 0xad894299, 0xa9ef7a85,
+       0xedebe730, 0x3812964c, 0x3f7b455d, 0x85f41c01, 0x3a60f747, 0x89bb1f02,
+       0xfcddd3ae, 0xe53fbd5d, 0x4c2ca90f, 0x124b71f3, 0x5127fa23, 0x8f9b80b9,
+       0xd3bfb23b, 0x0fcf9b55, 0xa0fe99fd, 0xec8cf84c, 0x58aecb7f, 0xd9ec059f,
+       0x552f9a96, 0xf1c8c164, 0xc67ff644, 0xb8f1c8fc, 0x721f9c35, 0x39cf9183,
+       0x53f2449f, 0x5fb8e379, 0x53f0321e, 0xbfb5fd69, 0xaf78643c, 0x1326eeb8,
+       0xc3ba185c, 0x26bf3e54, 0xbb3f94d7, 0x3f94d0ba, 0x131cd973, 0xd07c1b9c,
+       0xfcc67e54, 0x7bfca605, 0xe5311e2a, 0xc2b055df, 0x7811df04, 0xf6fe54ca,
+       0xf94d6b69, 0xdc975d96, 0xf5547288, 0xde70cc81, 0xfad1daf8, 0xbf37b473,
+       0xa45e2876, 0x57b011c7, 0x818e0e50, 0x7b6982bd, 0xabb248e3, 0x31e60f41,
+       0x4b56a130, 0xc6cb83fb, 0xa4665ea2, 0xefd2433f, 0xc634c183, 0x843c979e,
+       0x6346b93f, 0x89616061, 0x71f17425, 0x6fc86ca7, 0x0d7e4739, 0x9ec8fa08,
+       0xf44b72f9, 0x72ebe5e7, 0xd3bd402f, 0x5f803e9b, 0x3ae79c7f, 0x99103d84,
+       0xbf31225f, 0x7ebeb9f1, 0x7ae25cba, 0x53ac44be, 0x3bea5e4a, 0x0e10b99e,
+       0x5b38ae0f, 0x5480f57b, 0xfd6893d4, 0x803f2127, 0x51e81814, 0x24c8375c,
+       0x65bb6ddf, 0xea1957ea, 0x99abd004, 0x4257bfcc, 0x9bde133d, 0xec30cb7e,
+       0xd475ef87, 0x8931acfb, 0xcab6f5e6, 0xa43cbfc9, 0x94fc7d22, 0x469ca91e,
+       0x80656b69, 0x059543d2, 0x595e7e94, 0xe54b6941, 0x540f4a7c, 0x63fd2906,
+       0x3f4a32e5, 0xf4a6acad, 0x4a1acae3, 0x510cac3f, 0xa3e95eda, 0x2e879754,
+       0xf617ebfd, 0xc0b758b0, 0x8b0f6e03, 0xb2822cb1, 0xdee724cd, 0x53f39454,
+       0xa3066f8e, 0x63ea7fbd, 0xde8ca260, 0x6fc915f1, 0x47d1d3bd, 0x085e4af6,
+       0xcf4fa798, 0xa70c7b7c, 0x26c2dd93, 0x8f47d033, 0xf79cf45c, 0x2b04a1de,
+       0xa9c032c8, 0x519c9bde, 0x0fb985ea, 0x3a2e75e9, 0x70e75f31, 0x3eb7675c,
+       0xac6c97fd, 0x206972f7, 0xcaf7879f, 0xf0b30f34, 0xd7a45eb3, 0xf49bc50f,
+       0x5bd29fda, 0x2e89dca0, 0x33a735fc, 0x6e48e748, 0x8354ffaa, 0xc7882995,
+       0x2e10d8a6, 0x7bed4f8d, 0x38f285d6, 0x3eae5537, 0x7c77b234, 0x5467d695,
+       0x29e30c3b, 0xa7c3346f, 0xdcc9a5aa, 0xbb89e07f, 0x95f21875, 0x45d0fabb,
+       0x4a54ff48, 0xa6e67af5, 0xb1ced46a, 0x7c7141ba, 0x79f10efe, 0xf13c6370,
+       0xa93bac2b, 0x3fbb3ffc, 0xf7a3d5bd, 0xf606b187, 0x01f50d85, 0xf73a0de4,
+       0xdd07a8fa, 0x3f34af95, 0xfd49abd2, 0x1885ed06, 0x206677f8, 0xac10abd6,
+       0x2f5e5bd7, 0xe397ad07, 0xf6a68df3, 0xbe8f3de0, 0x7af7c7a6, 0xb5855be7,
+       0x7d04e3ea, 0xe7f0a575, 0xabd9d714, 0xbc4af3cd, 0xec6f2e09, 0x679a6d5b,
+       0x7f900ff0, 0xc8292156, 0x9b82253f, 0x32c7143a, 0x6a97fa09, 0xe5bd50f1,
+       0x6a572f12, 0x1e02d16b, 0xb466c762, 0xd1cdee33, 0xfb73cff9, 0x1fdf401f,
+       0x1ecaadfd, 0xd7e17cc5, 0xb06cf551, 0xe7e82d6f, 0x0dbdd011, 0xef5053c5,
+       0x3d76dd1d, 0x98b327d9, 0xa48b85df, 0x8d9d5602, 0x6609ce76, 0x7ffc8c99,
+       0x35defd82, 0xc8deb0d2, 0x9fd468b7, 0xf3cccb99, 0x2667d82c, 0x0cc6bf38,
+       0x939bb1e7, 0x56f3df91, 0xa0b730aa, 0x6ff39a5c, 0xbe49b8b7, 0x12c559f2,
+       0x3f08ef5a, 0xa66ebdd8, 0x2fb907f4, 0xec99e57d, 0x87e8a1dc, 0xf75bfae0,
+       0x7026140f, 0x3128a53b, 0xff20f9a4, 0x3f91868b, 0xfbe182b9, 0xa7a825a1,
+       0x5de64e82, 0xefd27acf, 0xb23ff687, 0xd27cfabf, 0xfa214fc3, 0xbe49d721,
+       0xda759450, 0xd84916c3, 0x974a415b, 0x76eb718b, 0x5c044d6b, 0x47d7011b,
+       0xbf377fc0, 0xbf133225, 0x35025aa5, 0x5fce2496, 0x4a482f68, 0x47f816a7,
+       0x51ed4fea, 0xb53fed7f, 0x3fa834fe, 0xfd7f54db, 0x0bfeb53f, 0x29bff47b,
+       0xafa5fd5a, 0x0416da6c, 0x79b4537d, 0x3cc18b95, 0x4ea95474, 0x4bdd02f6,
+       0x21762fd6, 0x82511c1f, 0xa3e7e42e, 0x34727921, 0x22d2f87e, 0xe7cca2fc,
+       0x855d7090, 0xc7fd427f, 0x54d9f85e, 0x59bee7b4, 0xbd69baaf, 0x5b0d6754,
+       0x1acb4e41, 0xdfa0a70a, 0x1c83e017, 0x46527a5e, 0x9fccd1b8, 0x4aafcf45,
+       0x701eff46, 0x844f588a, 0xab2a5ec9, 0x9c24f3fd, 0x2759ca87, 0x7be459c9,
+       0x04e9fed8, 0x5ab98fd2, 0xe87ccf5c, 0xe5f9d927, 0x0de52f02, 0xbb293b3f,
+       0x30f6bd30, 0x4cb013ea, 0x7c8f0ec8, 0x41d840af, 0xc4ce2c87, 0xb1425856,
+       0xa11fb11f, 0xc2f1d4de, 0xaa0edc42, 0xf0e4f0da, 0xb6afd083, 0x24badfda,
+       0x7974be03, 0xf33f553b, 0x7a7aafd7, 0x62edcbd7, 0x5efdd7bd, 0x34f3de88,
+       0x89adfb0a, 0xd86a25a7, 0xc971f685, 0x841bd55a, 0x9e9b25c7, 0x5c69ee7d,
+       0xf5627eaf, 0x17f5045e, 0xc3e37a6f, 0x6f170031, 0xf0a71351, 0xe4a43861,
+       0xc394fa6e, 0xba23f9bf, 0xf2f451e9, 0x18679a1b, 0x4270fe7f, 0xb78a5d37,
+       0xb0d8d6ec, 0x5098f89e, 0x716b5bbf, 0xfd4fa144, 0x676849c1, 0x56f86d55,
+       0xd1e575c3, 0xc94b125d, 0xb5cf8288, 0x80bd906f, 0x0a7a2278, 0x2fd1757a,
+       0xd0397ca2, 0x247af505, 0xbdcb22bd, 0x1465fa81, 0x93fd17af, 0xbe2fdfc0,
+       0x4fec7e8a, 0x43c45ead, 0xb9f78bc1, 0x95873c70, 0xcfe7ce0a, 0x3f464e2c,
+       0x4c1a817d, 0x9fca5376, 0x9fb9ac17, 0xbdff2ff8, 0xfaf993fb, 0x42d7d7d0,
+       0x2fb05573, 0xeaf6738e, 0x799c68db, 0x587c402c, 0x0fec8cf0, 0xc2b5fa41,
+       0x22896f26, 0x9732c527, 0x80ebc393, 0xc3ce30b8, 0xbf414eb8, 0xd0e5efee,
+       0xcc8ff27a, 0xee0fa861, 0x6cf1fdd7, 0x8b5fc12e, 0xb27184fd, 0xdae75f45,
+       0xbb5bfc4c, 0x74e919b4, 0x052f806c, 0x4ce56afd, 0x487c0a09, 0xf95ea067,
+       0x3853abbd, 0xc947989d, 0x5d81ef16, 0x639f0130, 0x67d566f9, 0x8f7a6e1f,
+       0x6ee8c99d, 0x1f689e7f, 0xf3831dfa, 0x5664e1f9, 0x7c651f50, 0x07aeb235,
+       0xf0375e60, 0xb9de4199, 0xc23ed7fc, 0xff975de5, 0x31934dd0, 0xb9f7abff,
+       0x387be11c, 0xc2bf425f, 0xfbbf9429, 0x83f48956, 0xc9a38595, 0xe42aad79,
+       0xc91f9cdc, 0x457fd02f, 0x0df0338a, 0x744093b6, 0xde5abf20, 0xa8df784a,
+       0x575db157, 0x39757acf, 0x20fa17ce, 0x707d064f, 0x603eb759, 0xe81eb9ab,
+       0xf20aeedd, 0x7a1a9bf5, 0x5f9469ee, 0x07a0d790, 0xe3f557e5, 0xdc6f8ff8,
+       0x209de1fb, 0x75ebc7b7, 0xd5eb35b9, 0x782db948, 0x7c84bd69, 0xc7b7291a,
+       0x894ac00b, 0x3cf0b726, 0xb416dcaa, 0xaaf44bfc, 0x65c7c78e, 0xf5d55eb3,
+       0x8cf86f64, 0xca9793d4, 0x127aa89e, 0xecb3ef7e, 0xf3a8fc9e, 0x457fcea1,
+       0x80bd29bf, 0x9f3a09fc, 0xc5d87cea, 0xf61f3aa7, 0xf098cff0, 0x3b7f9918,
+       0xc10c04f2, 0x7f255dbf, 0xdf134962, 0xdef7838f, 0xf8459fec, 0xc734d1f2,
+       0x9fecdfaa, 0x11438468, 0x79447d70, 0x8fec045f, 0x80881f28, 0x4be54c2b,
+       0x8c6af71a, 0x2a6c20f8, 0x2bff9d67, 0x759445f6, 0x950f3eac, 0x82d49c37,
+       0x9d691fc8, 0x753fea1a, 0xe8a89821, 0x9329dc3f, 0x7003b0ff, 0xe9da04bc,
+       0x0a1198d8, 0x6c591e82, 0x0ecdebe7, 0x012ba777, 0x1cf1c5d2, 0x96d24cee,
+       0x9fd41ea0, 0x1fb9da77, 0xe9dfc3a4, 0x31f8378a, 0xa4c9360e, 0x6c425bc7,
+       0x093f3472, 0xdf8434cc, 0x3e5bd616, 0xe0768ff7, 0x87b633be, 0xcf40cefb,
+       0xfa4765ab, 0x56bf5c7c, 0x23605ecb, 0xedc16b36, 0x77a1742e, 0x71ba0d34,
+       0xfd9f3c1a, 0x6db7ccb6, 0xafa53e82, 0x8471dd61, 0x2b189f05, 0x72de7ee1,
+       0x4d999fe2, 0x6b321d7c, 0x28797479, 0x39e5ef12, 0x77a869e6, 0xb9f0fd61,
+       0xd7ac0fd1, 0xe23ab053, 0x42f5d379, 0x3d69aa6e, 0xce6b5458, 0xd4f5880f,
+       0xc9feba37, 0x7fa49964, 0xeb84a170, 0xafb7a17a, 0x38de8796, 0xb1d3e80d,
+       0xbfb8664f, 0x2649aa7a, 0xc8da9cfa, 0x305953f7, 0x8cafe489, 0xd4be9275,
+       0xf286d6f1, 0x7aef7175, 0x9feb6dac, 0x3e421fb2, 0xe187f6da, 0x6db482bf,
+       0x778327db, 0x47cafc20, 0x3d607fe9, 0x65d84fcb, 0xc7733f27, 0x7ff1272e,
+       0xa5dfcec7, 0x76f0843f, 0x3af7f92b, 0x1c3b7d76, 0xa163b1f9, 0x60f500b5,
+       0x7ebe00c7, 0xedf9daaa, 0x7f9a16f0, 0x331d1117, 0x7de88d14, 0x072fe9aa,
+       0x54e02e30, 0xed0a8c13, 0x24b15d8b, 0xdaafe55f, 0xb1d11fc9, 0x80ecdbf3,
+       0x9e379fe3, 0xd3ffb132, 0x5ed364e1, 0x73c5fec2, 0x8ef979bf, 0xc02ecfd1,
+       0xdd86f1fd, 0x9fc84cda, 0x875fdaf0, 0x78ed7ea3, 0xed4ddb89, 0xdc1acb6a,
+       0x48ba18df, 0xbd02a85e, 0xfac851da, 0xd16fb631, 0x4728f1c4, 0x57f2f13d,
+       0x2f9cb3f2, 0x7c28263e, 0x8feffb3d, 0xf5c7c90f, 0x9364339f, 0x1ddfdc70,
+       0x89ea03f8, 0x4be2565d, 0xebc7bc7d, 0x733d9017, 0xfbdf71ae, 0x52dc6e3f,
+       0xbdc67cf8, 0xff9cdfe0, 0xfa878aad, 0x3d072917, 0x03e77cf9, 0x7a726f04,
+       0xc9e7bfa9, 0xa7ff6bef, 0xa025fdd1, 0xe3dcebbb, 0x4b3fff0e, 0x0ba7b7f7,
+       0x3e31bbba, 0xbfb5fca0, 0xa87eff52, 0x37f96b9e, 0xe36f7ba7, 0xb7fdedd7,
+       0x33f79e2c, 0x5664fca1, 0xe2c340ed, 0x6f3dd2da, 0x5bee4267, 0xb1e37b69,
+       0xf623e3bf, 0x5e34f47b, 0xf1b6fee5, 0xed03efb8, 0xac4978b2, 0xab3af917,
+       0xfa2fb0bf, 0x3b23cbcf, 0x63da7fa4, 0xc5304f64, 0x2bf712b3, 0xe99f4adf,
+       0x360bd8a5, 0xc200e3e2, 0x6c052bee, 0x4afe6f5e, 0x4adc3e62, 0xfd7e9fed,
+       0xd373b43e, 0x83b264d2, 0xf7fb2521, 0xfe64d775, 0xad3344bc, 0x98f5ae87,
+       0x129347d7, 0x89a8ebcd, 0x19abbea2, 0x0ed5ffef, 0x3c021429, 0xcbf01f8c,
+       0x8ea7f444, 0x126548bf, 0x605893c0, 0x263bae11, 0x9df5cc3a, 0x836c7dc0,
+       0xc5eff1bf, 0x3c2ec4e3, 0x47e95c0e, 0xc9900e3c, 0x3c4e7aaf, 0x6f09bf62,
+       0xc78c2199, 0xe3978a61, 0x4bd4a131, 0x1eb16a7e, 0x1da26ec7, 0x349638a3,
+       0xb82b3ca3, 0xa078e69e, 0x9ebeb875, 0x4cdf0dee, 0xd115cfac, 0x257f8ea4,
+       0xcdd9f64d, 0x5cfad1f5, 0xa50fcba7, 0x7fc74e87, 0xaac92e94, 0x8e692e99,
+       0xebca0a39, 0x8c3f5c64, 0x1c99f2c4, 0xb42a0b4e, 0x0fd624df, 0x28e678d7,
+       0xa4278041, 0xaf482a65, 0x22f6db7c, 0x79b51f8c, 0xc5c7ea25, 0x1f9a166d,
+       0xe112596c, 0x428d487d, 0xf7167bf0, 0xd4f7a428, 0xfe395e2b, 0xbb3f4320,
+       0xba06e34f, 0x7c97ef9f, 0xd8cce67f, 0xf0c7f46c, 0xde7fc61f, 0x59b7eb00,
+       0x063859ab, 0x615b34f0, 0xf404b8c1, 0x73ec4b93, 0x0cdc9f93, 0xe4aaefe3,
+       0x55ce7aee, 0xf2bd37be, 0x015f4ecf, 0x45f9f63d, 0x94c76d8c, 0xc6288a6f,
+       0x9a8ff6f5, 0xf7cabe38, 0x1e40d0b3, 0x0dfb2187, 0xab2f8afb, 0xcaf33fdc,
+       0x891a5f1f, 0x1d71dceb, 0x7eb8e343, 0xa971e2cd, 0x8a70bd62, 0x0ebce279,
+       0xe283afd4, 0x9f74bf68, 0xe7168cec, 0xbfac41b8, 0x28f1837f, 0xb2d47690,
+       0x57d7196a, 0xbefc93ac, 0x5b1b5ac1, 0x661e251f, 0x7e116a8d, 0xf8374122,
+       0x7fb8d9c9, 0x0d9fdbc3, 0xe919c6af, 0xa8e536d6, 0x1d27bc32, 0x61b9f7f0,
+       0xc51feaff, 0x11f7ae2f, 0x2dec1bbf, 0xf451fc93, 0xdfc0bd47, 0x91df3dd4,
+       0xa6d2f49f, 0xdfe416b5, 0xa62d6b4b, 0x553ad8fd, 0xb04631f8, 0xa9afd811,
+       0x2cceec7b, 0xd93ecba4, 0xe5a5f18b, 0x40b5274d, 0x48c47d94, 0xe8fd627c,
+       0xdd556f7f, 0xb50eeed4, 0x75e2267e, 0xc31b09c7, 0xad76f575, 0x3f5a38ba,
+       0x7ef2b4ef, 0xf7f566ce, 0xf7f8cf0d, 0x0eb8efc3, 0xae3c7847, 0xf0996b3f,
+       0x1ff24483, 0x553e3e23, 0xbf3842c7, 0xf5157ae2, 0x8c8da9c2, 0xc94077e6,
+       0x06feb863, 0xd1b1ff79, 0xe37173af, 0x5da0df96, 0xb924d650, 0x4ca24b71,
+       0x8fd0d169, 0x2f18de5b, 0xe99c3ce3, 0xdd6fe3d1, 0xc8356ec3, 0x10aaab45,
+       0xd98ef6be, 0xfbb61771, 0xd0c69b65, 0xdebdf14e, 0xfc79c2e9, 0x2491a6cb,
+       0xeb8dbd07, 0x34564ae5, 0x841ce311, 0x87e48c3e, 0x4c631ba1, 0xa07215f0,
+       0x54d7ca1f, 0x6f3ccb6b, 0xd32dfa14, 0x788fb124, 0xf42dfa9e, 0x7b7e99ff,
+       0x016fd75f, 0x23906fd9, 0x419bc0bf, 0xd344a5bf, 0x4f25736f, 0xee7de20a,
+       0x482941ce, 0xab6fb9d7, 0xdbf4d149, 0x2fbe4aa6, 0x4dc459ba, 0x7e803477,
+       0xdfa0dcbb, 0x45bf401a, 0xa3191f89, 0x73fa7ee9, 0xbfd0b7e8, 0xa136fe46,
+       0xde328b7e, 0x74fe041b, 0xe9bc36fd, 0xe1b7e920, 0x3c53160d, 0xf84d44f0,
+       0x6fd57a9b, 0x68add252, 0xbd53ef1f, 0x67f851b1, 0x37c7b093, 0x6c46388b,
+       0x955cf507, 0x5cf4c3f6, 0xb9eaf9de, 0x759e117f, 0x2b77373d, 0x9ee8b8a3,
+       0xdcf5c87c, 0xe7a0eddc, 0xae47e424, 0x64eee6e7, 0xa1172fdc, 0xd0f486df,
+       0x97ca8c6f, 0xe5fbf985, 0xde4f198d, 0xf08df50d, 0x941b5ea9, 0xefadd11f,
+       0x5df51946, 0xbe8bd695, 0xfa7e77db, 0x77d0ab6e, 0xa206c7a0, 0x0fe48d7e,
+       0xde39936f, 0xc3e8c77c, 0x79465f1b, 0xfb4c9df9, 0xf859ef92, 0xa33bd1fe,
+       0x7f21670f, 0xf3fa2a7d, 0xd9e9c6a2, 0xfaa4195e, 0xc7cebc27, 0xfb91ba57,
+       0xb81acbcb, 0x2b56587d, 0xe7f03c87, 0x69df31a4, 0x9dc2ffd8, 0xf8014b12,
+       0x13f56b26, 0x9febb40e, 0x1f589957, 0xf034c94d, 0x629cacc3, 0xd957fbf2,
+       0xfcf0eb5d, 0xd9852cd1, 0xec5fbfd0, 0xed147498, 0xbe1ce2e0, 0x9e2c501f,
+       0xb3b071eb, 0x4464f4bb, 0x9ce3483c, 0x9eb3fb37, 0xad531671, 0x9f53ae9c,
+       0xb7184295, 0x22ee33da, 0xb8a17a44, 0x5dfcfcce, 0xc9377f21, 0xf62f842d,
+       0xee351cae, 0x85d72f43, 0x4f027da7, 0x9e131780, 0x3c545242, 0x64a7a501,
+       0xa5e37726, 0x4b2d77f0, 0xf0a05f70, 0x91f68929, 0xe3adc723, 0x3afc722d,
+       0x773f751e, 0xbf2fa8b1, 0x6b9d2d69, 0x8e8bc48a, 0x747c48e7, 0x1f023de1,
+       0x7e5d69ef, 0xd71891ed, 0x7a437c04, 0x809ff826, 0x3fc76817, 0xf9d322ee,
+       0x5e048f9b, 0x9b8f5646, 0x370fe180, 0xe43a1c61, 0x79ccd5e7, 0x63e02fb3,
+       0x119ec7d4, 0x315e9d38, 0x7dc01ac6, 0x4ef60dda, 0x1f3a83d2, 0x3e72b30e,
+       0xd95e84d4, 0x3c62afd1, 0x251bf3ad, 0xe521da37, 0xb5e13b61, 0x0ed1f81c,
+       0xf53ef645, 0x578124cd, 0x6aaf9d37, 0xd013f314, 0x26eb82c1, 0xf10abe7d,
+       0x9b2358f3, 0xebca5d38, 0x58b25d38, 0x94c7ed27, 0x30de48d5, 0x71aca78c,
+       0xeba1c50e, 0x0e7e19fa, 0xf0a29d23, 0x7f8d12af, 0xb39b3a19, 0x62cde7bb,
+       0xb5aa6e51, 0xe7dc43fa, 0xb1f20a99, 0xfe10d896, 0x3efe1677, 0x2450fc57,
+       0x78132ebd, 0x757884db, 0xb93afe20, 0x8efe15fd, 0xf9e969ce, 0x84d04ae5,
+       0x9f4f09d7, 0x53b7fce6, 0xac5fa0f2, 0xcfc86f0b, 0xc74a3f90, 0xd233f21b,
+       0x465729a1, 0xddf00f38, 0x78e7a327, 0x28d4bf71, 0x0f3b85f7, 0x919ffaf2,
+       0xb8ca2cbc, 0xff7f307f, 0x4deebe40, 0xc55987de, 0xf7f0413a, 0xfdcef63b,
+       0x77bf9123, 0xd12fdc4a, 0xf7da6f14, 0xd7cac1bc, 0x20ec1b4d, 0xf6dfb807,
+       0xe75deab6, 0xae1fa9e9, 0xc03972b2, 0xe0c784f5, 0x0704baf7, 0x75a6f182,
+       0xa4178a36, 0xf6e40c7e, 0x6f5f51aa, 0x5ba4b3b2, 0x7faf7ab3, 0x37bfa88a,
+       0x8787497b, 0x47a87b61, 0x21bda11b, 0xce45eddd, 0xe0ffba17, 0x43bae35c,
+       0x3bdfcff0, 0x1f9dbd2e, 0xce554f1a, 0x4c5f699a, 0xb54aab8f, 0xd1515e04,
+       0x992c9bbe, 0xe7a0b7e2, 0x70ffce82, 0xa36ab7fd, 0xa59faf7a, 0xd08ec8da,
+       0x2d5ecbcf, 0xf010583b, 0x254fa5f6, 0xe32b0179, 0x7f38b183, 0x1079878c,
+       0x8ff72f92, 0xca6ee8fa, 0xed9f6997, 0x29f5dfc6, 0x1bc87dc5, 0xbb1d0c79,
+       0xfb225331, 0x6cac3de1, 0x36e1da34, 0x268ab3e6, 0x47e73f21, 0xd73c21f1,
+       0x3d5b5992, 0x3d7203c1, 0x85542ea2, 0x674277a9, 0xaf483be2, 0x7a433271,
+       0x4cfafb35, 0xbef7f9c0, 0xdc4cb33f, 0x813b078a, 0x8fb119ea, 0x31b96125,
+       0xce5a24be, 0xeaf86e8c, 0x7fa05bfd, 0x5ecbf7a3, 0x69bb940f, 0x7281c3af,
+       0x85b56436, 0x19780c05, 0xe85542c3, 0xc87d1a77, 0x83ea0b77, 0xf07bb002,
+       0xd341497c, 0xc2172ada, 0xbf7a25ab, 0xe498183c, 0xaa6dfe82, 0x32e93939,
+       0x0e500bd4, 0xcd5f29ab, 0x4ad795cb, 0xce710c5e, 0xf1415a6b, 0x12b57948,
+       0x14dc601d, 0xd78d9892, 0xbd41b21b, 0xfbc3569b, 0xc17f3859, 0xed6f58fb,
+       0x416ff7c9, 0xa4fd03bd, 0xfdf237f7, 0xcf783cfa, 0x3b527283, 0x5c2bea87,
+       0x073c312d, 0xcf91b053, 0x55fb054f, 0xec37e62f, 0xdde68a7e, 0xdf5ed029,
+       0xc28f9c0c, 0xd13ce913, 0xe74dc948, 0x80be1f38, 0x0e0756f4, 0xa5f05f18,
+       0x4909f8f3, 0xa3fd62c0, 0x6dfd7fdb, 0x9e535cfc, 0x07d68177, 0x272779ea,
+       0xfc42c329, 0xe1f69274, 0x03be010f, 0x79379c56, 0x9cdecb3c, 0xc316b42f,
+       0x1b6398fc, 0x6acfef44, 0x1e71471c, 0xe29f99b3, 0xe68ea63c, 0x57bbe776,
+       0xefe843da, 0x4ced577b, 0xaf7be7c3, 0xf6f3d2b4, 0xb70f5c4d, 0xbf21680f,
+       0x2ad5e1fb, 0x552ff3c3, 0x13d265ab, 0x74aa3787, 0x867e576e, 0x6fe437c7,
+       0xdec876e2, 0xc3debcd5, 0x9b7edc75, 0x936dccf0, 0x5fce1e70, 0xeaf9cfcf,
+       0x875f5a7a, 0x4d0bb9e6, 0x9ea45bf3, 0xa970f5d5, 0xf54147c0, 0x8f4fda5a,
+       0xfaa5bbd4, 0x6fa1187c, 0x9d9f714b, 0x24c3d3f6, 0x91f5a547, 0x6e8e65f1,
+       0x43f20dbf, 0xefe23bf8, 0xc32afdb2, 0x45f48d75, 0x678a24db, 0xf21ef9c3,
+       0x3e493747, 0xf8287b8c, 0x7b221ad8, 0xe33b943c, 0xf99e703f, 0xc8f0cac4,
+       0x03d22b48, 0xb58e54f4, 0x84bf8ff3, 0xb3df47e7, 0xf010e461, 0x5fe12e4f,
+       0x5ace138f, 0xb27ee3cf, 0x8c995bde, 0xc4d98de7, 0xf207a43e, 0x3016646b,
+       0x92a38de8, 0xf93b96ef, 0xfb46e0fc, 0x966ba747, 0xf3879d56, 0xeb8d916c,
+       0x957acf47, 0x0bc78bce, 0x3e0bd618, 0xb70a77b4, 0x0cd648af, 0x73b850fc,
+       0x0ea83245, 0xcbc444b6, 0xe6738954, 0xa76f1a85, 0x5ee49770, 0xaf47686b,
+       0xdb57af47, 0xb41bdfce, 0xd5bda793, 0xa3fd885f, 0xa1ad7e71, 0xa7ac88de,
+       0xd4bdfb47, 0xa75ff393, 0xffb9e257, 0x0a65779c, 0x62f9cf76, 0x3ee320ca,
+       0x7eea9e8f, 0x2df7ece6, 0x5fc067cc, 0x98631fce, 0x86ef40cf, 0x40ff2051,
+       0xb91a1bbf, 0xea30d73d, 0x459a56a0, 0xbde51bb0, 0xcba3f84c, 0xbbfdf226,
+       0x16f7cc86, 0xc94ffca1, 0x581f8892, 0x49f5a030, 0x83cdfb24, 0x59f900fb,
+       0x787cfdfc, 0xe1b2e51f, 0xa0a72e29, 0x4fa83c2f, 0x98af56ca, 0x256be544,
+       0xb0dfd60f, 0x92ec9736, 0x51991c82, 0xb241ed7e, 0x0f1a0a93, 0x833ca226,
+       0x7b44aefc, 0xd5ac6ca0, 0x9758ea8d, 0xdfce5d4b, 0x9961e715, 0xcf0c3dcd,
+       0x5876e077, 0xf796f934, 0x72b76133, 0xe1cf2cb9, 0x26eefb72, 0x3e784715,
+       0xad724e72, 0x728cb1cb, 0xc72dd59c, 0xd04f577b, 0x870fae50, 0x99a38a24,
+       0xe5007a80, 0xe71e837c, 0xf3d8edc4, 0xd973f395, 0xbf20a599, 0x72ea5f38,
+       0xa475cbae, 0x2d2b373c, 0xee3f62b7, 0xe34ed2bb, 0xf6d57098, 0xfae3ef0f,
+       0x275ff68a, 0x3260f55c, 0x853cc7ea, 0x78e979c7, 0x5c78552d, 0xad7e8f60,
+       0x3df5a05c, 0xf445fe9f, 0xd9ab33e3, 0x8b6f125f, 0xb5eff1e7, 0xb9fdf12a,
+       0x9c87b3e4, 0x9e7ca79d, 0x4b9d5caf, 0xe5f6f53e, 0xe27ae69d, 0xf5476991,
+       0xf01dafac, 0xbe3c0618, 0x8a59f1b5, 0xc2f13e0f, 0x8748a9c1, 0xe7c01de2,
+       0x9d1b5fc8, 0x4e7a8c2c, 0x55bcd109, 0x39d320d4, 0xb384a603, 0xe51a716f,
+       0x1575c798, 0x3f12766f, 0x0d64bd15, 0x8bf7814d, 0x9c317db6, 0x76166ae2,
+       0xf05adc52, 0x072f6105, 0x1ca3865b, 0xbe3c2914, 0xfc2f522c, 0xe7edc6da,
+       0xd3b1edb6, 0x1d527c70, 0xa8a2dfbf, 0x6ad576fe, 0xc278a7d8, 0x50bb52a6,
+       0x8379f68e, 0xfe78c7c0, 0xbc67fb17, 0x2b8f4157, 0xf5c0db6b, 0x1aa35144,
+       0x8a327bc2, 0x63b4b6ea, 0xc7d171bc, 0x957ff256, 0xf3a49dd7, 0x6f361314,
+       0x794aff22, 0x8fda6ca3, 0x59df11eb, 0x18ad8727, 0x4a50d897, 0x1f0090fb,
+       0xc45eb824, 0xf8c0fe53, 0x3bcde2c3, 0x850105b7, 0xef3f2fc5, 0xac72fd42,
+       0xf10bbd79, 0x359ef50e, 0x3c47bade, 0x2223fd67, 0xc386f39e, 0x2f4b6f74,
+       0xf0c79cf1, 0xb794100f, 0x4e78e66d, 0xec87d756, 0xb667e84b, 0x47feca3f,
+       0xe9be7d97, 0x1e7835eb, 0xe3a5eda1, 0x25dfb06b, 0x0d72fb7f, 0x5db189c6,
+       0xcaf79a76, 0xe280f85f, 0xbef7f5b7, 0xc87f09b0, 0xfe29e786, 0xab13fdbd,
+       0xdf6b6b17, 0xe31d3879, 0x7cb7db06, 0xccfe8c97, 0x26af3b79, 0xadbcef7f,
+       0x94585213, 0x914f4379, 0x11e7437f, 0xb7491f7f, 0x297b0dbd, 0xd004ed9e,
+       0x5760f51d, 0x297d6e9c, 0x88f67f8f, 0xd18ddcf8, 0x88f43bcf, 0xe5b86dc7,
+       0xff512bc6, 0xf27b7037, 0xefb9719c, 0x3f2f3d03, 0x146e3a0f, 0x37f5d7f1,
+       0xf72e359c, 0xf401fe04, 0x74cdd8b2, 0xf661bafc, 0xbcc69faf, 0xc6bd3e86,
+       0x03cf86e5, 0x8a79fa7f, 0xa73e6c77, 0xa5e8e51d, 0x343c50df, 0x078a6fd2,
+       0xd3afa3e7, 0x11ca3cf1, 0xce3a73b5, 0xad3b9d3f, 0xd14fdf74, 0x9e488fce,
+       0x47beb7da, 0xce266a7e, 0xaeb3b435, 0x973f8f1f, 0x9d6b78c4, 0xd0579e3c,
+       0x3d7de301, 0xe22e7a2e, 0xeb5f397a, 0xc5bdbef1, 0x1f6d5ef9, 0xe00fee28,
+       0xb5a5c8f1, 0xb3f1107f, 0x729374dd, 0xcf075e90, 0xe3ad471a, 0x72f42dc1,
+       0xf47b1c77, 0x38aeeab8, 0x21ba08f6, 0xea9e713d, 0x3807538a, 0x49f9046d,
+       0x2e768a3e, 0x8f2d7da2, 0xa3576f7f, 0xe3d6379f, 0xf4117dda, 0x9bdbc7d6,
+       0x7b72e8bc, 0x50fc71ae, 0x4266d13c, 0xb57c4f52, 0xbf5d1f7d, 0x7f4bb4cf,
+       0xebbefad7, 0x148954bc, 0x5eeb1e79, 0x86d2cbe4, 0xeccfe483, 0xf18b7f5a,
+       0x7bff09b6, 0xc5320bdb, 0xdfa92f39, 0x523dfa4b, 0xbde1947f, 0x7bfa512d,
+       0xe7d85dbf, 0x68fe7c8d, 0x7219c97b, 0x7b6d3d40, 0x975f13b6, 0x71483c6d,
+       0xbdd66fd6, 0xe218b5ac, 0x08fe7027, 0xf6d3c619, 0xa4e1eee2, 0x30fdc5cf,
+       0x8954ed91, 0xa29bca76, 0xf1be53b7, 0xe29da9a4, 0x76e6bd60, 0x63bdbb9c,
+       0xac76ef8a, 0xb73358ef, 0xcbd58f13, 0xf6d14393, 0xd8aaec69, 0x29e6afef,
+       0x0f74a3cc, 0x7bdf938e, 0xc862bb23, 0xcce79cee, 0x112e38f9, 0xbae28d53,
+       0x388816aa, 0x537a9fb0, 0xce55de91, 0x77f618eb, 0xe0d7e231, 0x01dd51ff,
+       0x9aaaf686, 0xbf42cfea, 0xd1dea443, 0x642c2d12, 0xe73cf7a0, 0xed0f14e4,
+       0x90d3848b, 0x0f32079e, 0x67ef58ab, 0xcfabfe11, 0x0524b614, 0x5059f7fa,
+       0x7a802ef2, 0x0c5ff7d9, 0xd67b3bf0, 0x8781c3af, 0xa9bf9365, 0x0079dacc,
+       0x35ec2bd7, 0xc847ed3b, 0x7f74ecbb, 0x3b1af948, 0xd6ef778d, 0xbb239f6f,
+       0xc656d7fb, 0x556087f7, 0xb996f783, 0xb7871d79, 0x2fe6bb7e, 0xcbe35768,
+       0x1afe7ed0, 0x89eb8f28, 0xfeb4b18d, 0x8e2978e9, 0x7fcb51ee, 0xa8a9a1ed,
+       0x3963f2d7, 0x4e6fe63f, 0x7d415509, 0x6e1c49ad, 0xee8034dd, 0xc97e28ab,
+       0x7ba5f149, 0x8652beb7, 0xe6fb54f3, 0x60330c58, 0xfb09afed, 0x7ee237ff,
+       0x63d51aad, 0x642f338c, 0x2e78c78a, 0x536118a8, 0x3f23135c, 0xfa11c906,
+       0xe8e31ab1, 0xc5d8113c, 0xa84e7aa6, 0x89780f9d, 0xf8fd838f, 0x3f70aa39,
+       0xe59107d4, 0x76fdfcf4, 0xdcbd8e7e, 0xba39ef0a, 0x9d6b97cb, 0xeeae1c79,
+       0x3349f5c7, 0xe744ff95, 0xb3df9173, 0x23fe5e5e, 0x7aaedebd, 0xe265fbf8,
+       0xfe489b7e, 0x57a5d43d, 0xb4717afe, 0xf4a25bfb, 0x2fdf9e9f, 0xed05a0b1,
+       0xba762d96, 0x67ef0bb7, 0xdb0e73c0, 0x55ffbe34, 0xfdd30ae2, 0x3e843b39,
+       0xd309892e, 0x44fd3e7d, 0xc23cb03f, 0x22f2d6cc, 0x15f4bdd2, 0xb3f8c33b,
+       0x3e9cd7d2, 0xb6e977a4, 0x957f5b6f, 0xb18bf185, 0x7d2bd7e4, 0x1f117fed,
+       0xd3c35a94, 0x2dbcfee9, 0xe7f78656, 0x3b796db5, 0x4db5e51d, 0x9c27a70d,
+       0xb4af5f65, 0x57be6ade, 0x58e38c40, 0xbc42e865, 0xaf3f4177, 0x9e8bd45b,
+       0xdb8632b9, 0x9f18f6d7, 0xdde48635, 0xb1d44f7c, 0xc641c6ca, 0x9e45fbf3,
+       0x7fb17ae8, 0x9d8ffa8c, 0x38f47743, 0x263fdaf7, 0xe699ed09, 0x96407464,
+       0xfa8e3d81, 0xe4eea8bc, 0x7c1ff430, 0x6fdfa316, 0xf9c389e0, 0x73ad33e8,
+       0xcfbfea18, 0x19873bd2, 0x952399e7, 0x92a28f36, 0x8ed2875f, 0xfaf327b5,
+       0xb5378c31, 0xf7a68b4f, 0x12c4c586, 0x8e1e8afe, 0x7a8e7a8d, 0xabe70c4c,
+       0x531f6834, 0x43e5176c, 0x2d33f76f, 0x31b87a44, 0x49ebc3c6, 0xbcf8690b,
+       0x20fb6eb8, 0x950a1e23, 0x72072a6a, 0x642cf84a, 0x832cb52b, 0x2bdbd6fe,
+       0x28f0ef9c, 0xf2813f74, 0x55f8ba7f, 0x3933a6ee, 0x518e3191, 0x5c6614e0,
+       0xe7eb33f2, 0x6fd51448, 0xcc69fc43, 0x646456ef, 0xf7926a95, 0xa94f5618,
+       0x7e2ecc03, 0x43055a5f, 0xec44793d, 0x0c1fa3ef, 0x3d7c6ed3, 0x383f7a48,
+       0x328bb180, 0x4f09bef0, 0xbf80db9c, 0x3eb3706b, 0x2b69e309, 0x5317d718,
+       0x488f68dc, 0x033b00c1, 0x595554fc, 0x03df8837, 0x2f187cc2, 0xf42c2649,
+       0xf37ee5cf, 0x8083b43b, 0x843df94f, 0x1550b157, 0x86c318a0, 0x9e3aefc9,
+       0x96f3fbf1, 0xeb8ccc7d, 0x0741128f, 0x7a4ddc16, 0x7fbac1cc, 0x5aa3009d,
+       0x155b7d45, 0xdc1cb7f7, 0x59b8739f, 0x58c3ed18, 0x42c70b07, 0x1caa18ea,
+       0x2bbfca33, 0x5f03600b, 0xf39ac7ba, 0xf402e523, 0xf5bb445a, 0xf7a83f84,
+       0xbf7a88ab, 0xabf7a88a, 0xe3abd5b3, 0x2836dca9, 0x58a5ef03, 0xf02f595c,
+       0x09b3dbc6, 0x867e01bc, 0xcc7f3de0, 0xfb15e312, 0x18d784e6, 0x962b1bd1,
+       0x8e6eba07, 0xfa7e20c9, 0x4eaedc59, 0x8966978c, 0xc3d70c35, 0xbefd248b,
+       0x1877e64f, 0x1b6e63de, 0xa223e1c9, 0xcf02cd9d, 0x55bf748b, 0xb276f28f,
+       0xb7947abf, 0x263e56f7, 0x6f67797a, 0xde8d89fd, 0xea5ef89f, 0x5a8d8eaf,
+       0x4bd50fff, 0xf47daf65, 0x76efee0e, 0xa03727e9, 0x6e676cde, 0x1a54fd46,
+       0x16b7fadf, 0x4cedc27a, 0xde999a5b, 0xc0dfc831, 0x9a17316f, 0x49f2479f,
+       0xf472fe14, 0x29df7185, 0x61f3bbda, 0xe74d5e7e, 0xbe315c83, 0x9f7cb589,
+       0xdc79eefc, 0x46cb078f, 0x25dfe61f, 0xe1aeeff2, 0x0fdde3f6, 0x1b0fb4cb,
+       0xc1d5bf79, 0xe1efcdff, 0x801f07b8, 0x5f33ddbc, 0xa233850a, 0xdec5dbdd,
+       0x677a878f, 0xde44fe88, 0x9e601583, 0x68e4cb49, 0xbe7160f7, 0x45e1cfd4,
+       0x8b317fde, 0x66fdc5f9, 0x3159e7e6, 0x22dbe26e, 0x0f55a425, 0x82c79eed,
+       0xd1ef802b, 0xc7be04fe, 0x9c592ffd, 0x8d2e66c7, 0x9adfd7c7, 0xa77fd260,
+       0x70e27886, 0x8baf66be, 0x7cfe6ee7, 0x149eb5ee, 0xe54579e3, 0x1ee9ac74,
+       0x9bd52aa0, 0x3d4dfa8a, 0x80f33d7d, 0x07a76a1c, 0x1f218f31, 0x7e1256ec,
+       0x3d24f30c, 0x5084aa95, 0x3f6e2a2f, 0x37bb47cb, 0x5eb3f39e, 0xaebc4b5e,
+       0x177ccecb, 0xe6461dfe, 0x5dcfff81, 0xdff3a1e1, 0xa7fc3957, 0x5d95fe71,
+       0xa380de39, 0xb7043f27, 0xe15771f2, 0x8e7a33b8, 0x7af34aa7, 0x0ebedec9,
+       0xcbf245e6, 0x3fd86d79, 0xc8f9ead9, 0xadfbfd83, 0xd30fd0ca, 0x23de3f13,
+       0x153fc821, 0x24714fea, 0xc194dc72, 0xbc72fed8, 0xfff4146f, 0xe8bf7132,
+       0x52264aa2, 0x08b7571e, 0x34a51fef, 0x913ea447, 0x8f72a64e, 0x974a7b8a,
+       0xd5297a54, 0x56f36bf1, 0xb6983dd3, 0x36fb790b, 0xa25fa0b7, 0x402fe045,
+       0xb52d97f6, 0xed1df682, 0xde308aee, 0x60d2c727, 0xb961c1de, 0x9abf09ab,
+       0x13bf919b, 0x456c13ca, 0x66b55218, 0x7149d10a, 0xc87cb057, 0x0604754f,
+       0xe37da2c7, 0x6987df31, 0xd6711d4d, 0xf8bb31fb, 0xfbc7136d, 0xb7e71263,
+       0xa63fbc48, 0x6e307b36, 0xbb6bb1e2, 0xbc22abee, 0xe38872c3, 0x7ef93ffd,
+       0x37bc4f6e, 0xc0699b4f, 0x327b33bb, 0x0267fde1, 0x5e054bcf, 0xaa1d04ab,
+       0xc4ab3e04, 0xe255afbd, 0x812adcde, 0x3bc42adf, 0x7b888fa4, 0x3d23177b,
+       0xef119520, 0xa1d6bfc0, 0x7b432641, 0x520f0f7c, 0xb75be087, 0xb2a4fc85,
+       0xbc43efc3, 0xde39135b, 0x03a00e6d, 0xdde035f1, 0xc241f983, 0x78e0eaa7,
+       0x0e9cf286, 0xef105602, 0xa739f123, 0xb6fde007, 0x87d424d8, 0xd6784c63,
+       0x1f9fc712, 0xf3e29fde, 0xf390a25b, 0x6a25fc48, 0x5d605efc, 0x8fb37bbe,
+       0x765c44ab, 0x1197b895, 0xcd7688f1, 0xbb0fc02a, 0x3f93e398, 0x2f60221f,
+       0xfd6249a5, 0xc074055f, 0x3d8527fc, 0x74c67884, 0xb75f2c67, 0x762a5a24,
+       0x04a788ab, 0x4b0fdf7e, 0x6cb4b20c, 0xf18043c6, 0x1e641a97, 0xe1fdf584,
+       0xc8ff335a, 0x7ee2256e, 0xc893cf49, 0x56df2b6f, 0x2f7fb82d, 0x74debfcf,
+       0xe69e5bae, 0xfe10f78b, 0x35da1203, 0xb872133f, 0xfa85f902, 0x8bc3d7c7,
+       0x152c1f05, 0x223f06f7, 0x2131e7f8, 0x7ceb8fcf, 0x48e7e5e3, 0xf1e64f96,
+       0x1699898e, 0x9862bf71, 0xe309e319, 0x834cf5bd, 0xc6dad17e, 0x9fdd2943,
+       0x92b63ec9, 0x650ec6dc, 0xf8afe43e, 0xf10c1f8f, 0x7dfd70fb, 0xd78a1ed1,
+       0xeb1dbfef, 0x0e83bf89, 0x711587b4, 0xd7cca4cf, 0xef51cd93, 0xeef2ad8d,
+       0xa65fa1b1, 0xbeecfeb7, 0x73f11b69, 0x1e44e5de, 0xbfe027d6, 0x8ec03663,
+       0xc157581a, 0xc81bd62f, 0xa57a8c5e, 0xebfc49c6, 0x1be7fe80, 0x17b624f8,
+       0xc754ceff, 0x5f501bb5, 0x240680bc, 0x6a2fc130, 0xcf11d906, 0xfa0f7380,
+       0xfea956b1, 0xac2f38be, 0x8fee8f8a, 0xdf2c65fb, 0x5d657087, 0xac2bf26a,
+       0x9ef47d54, 0xef59ac7b, 0x44f314ac, 0x9cb344c2, 0x4fc2f3e8, 0x39577d45,
+       0x5fb13b02, 0x9227a7c9, 0x1cde273c, 0x52a89e7d, 0xf7de20b5, 0xcb8c3551,
+       0xe3573077, 0xfd0f73f6, 0xe49f68c3, 0x3af06054, 0x7ce983f4, 0x7d7190b6,
+       0xaedc6417, 0x04f5c7d4, 0xe715bdf2, 0x3ff13703, 0xcb0807ce, 0xdefc6a17,
+       0xe42dbbe3, 0xe4225887, 0x672151ed, 0xfd7c85cb, 0x8acbe51c, 0x297b58f7,
+       0xab9085fd, 0x90872895, 0xe0cd8f1e, 0x3fb8bcf6, 0x2ccf5f4c, 0xfba08db4,
+       0x161cab22, 0x4f94179a, 0xae0721ac, 0x768f760f, 0x7647ffa3, 0x4e03b966,
+       0xfba2cfcc, 0x2cf8a5dc, 0x37cdf237, 0x9c1759ce, 0xc8161e2d, 0x2b16f74f,
+       0xea4bf72a, 0x8957c8f7, 0xf75408fb, 0xd5fd0ccd, 0xd856264f, 0x9635de29,
+       0xe4d787c7, 0x81de1366, 0x86b19d1e, 0xb4ca5a75, 0xfbeebaeb, 0xec9feac3,
+       0xef835ee5, 0x6960de85, 0x41a17641, 0xfb88d44f, 0xc8279924, 0xc5f41886,
+       0x31268bc2, 0xd4f5eff4, 0xcde8bd13, 0x2e6f5cf5, 0x4deba292, 0xf5d78edd,
+       0xd17ea466, 0x4c17c5d3, 0x54bf9d36, 0x7a465e1d, 0x3f744867, 0xcac3b242,
+       0xd7992ff7, 0x33d19b9b, 0xec95f01f, 0xed0be030, 0xf16fdd21, 0x89e328e3,
+       0xae4793d4, 0x00d7e7d3, 0x4b343bdd, 0xfa393cf3, 0x79abf3ac, 0xfd3fc85e,
+       0x794fcd08, 0x5a5347a7, 0xd92d7350, 0x69770c23, 0x1c2ef70c, 0x0bbf7d5e,
+       0x46b87be9, 0x56af9fec, 0x74bf1843, 0x197166b8, 0x0f76d5c1, 0x2fdc66d2,
+       0x3de1741e, 0xc8d6b34d, 0x247e9fb4, 0xf14e9826, 0x399fdf9f, 0x63e21b23,
+       0x9a5dac16, 0x6b38fc8e, 0x373a52dd, 0x37c1247b, 0x59806fd8, 0x79ec8796,
+       0xbcc6fefd, 0xb43ead67, 0xdbe37bc7, 0xfdd1d5bc, 0x27f8553d, 0x779853ae,
+       0x7643ae08, 0x8674c6bb, 0xfc8e0f81, 0x82eb4ec2, 0x8ed82d2a, 0x58bad570,
+       0x2555837c, 0x280fbf44, 0x0fb571d5, 0xf0ea94e9, 0x73298b5d, 0x4f7ed024,
+       0xdbc472ef, 0x3b5f456f, 0x2d3ebbee, 0x3a0245ee, 0xbbf264dd, 0x56d77df2,
+       0xb66347e1, 0x4463f25e, 0x7c97a7be, 0x62938f17, 0x7ff9e8ee, 0x6869ffb7,
+       0x315df58f, 0xe6b4bf8e, 0xe84f92f8, 0xa11f7989, 0xcf8bc450, 0x5a1b175a,
+       0x66ce4518, 0xb3c7f389, 0xce997ec4, 0xebd7858f, 0xe3e739f6, 0x5e973e48,
+       0xfaf884b8, 0xcd2a7dcb, 0xafc0656b, 0x17a5efa8, 0x507dd346, 0xe2bb9e0b,
+       0xfc0b8c71, 0xf94cbf6a, 0xc4eda725, 0xf53fedc7, 0xce8239d2, 0x9df4a9df,
+       0x5df6af88, 0xda01e74d, 0x3ad3fdc5, 0x7c9cd29e, 0xc1c6bc3d, 0xe9de50f5,
+       0x743c919f, 0xa66857f1, 0x779e7286, 0x5e5ce7fa, 0x31d9fef0, 0xdeebec38,
+       0xe0a1771c, 0x2cd7806b, 0x2169349f, 0xc2df9bd4, 0x0d8d8ae5, 0x7b1f9196,
+       0xd1f7ac6d, 0xc6bff228, 0xb5f931e1, 0xf3965bf2, 0x4caec0f7, 0xcc99c434,
+       0xc87bdf12, 0x65efcd3f, 0x4b20ee65, 0xfa127945, 0xcc0e5bb0, 0xdbb772f7,
+       0xd3d4e3cd, 0x79c6bb17, 0xd6fd6985, 0xe8abce3d, 0x53b09e79, 0x13465bf2,
+       0x5f9e3ddc, 0x9e368e8d, 0xa58c71ee, 0xd1f1edf2, 0xb450ffdb, 0xc0595adf,
+       0x8b4fa07c, 0x79bffdc4, 0xd434fba1, 0xe3ab791f, 0xb8c32413, 0x4d8a6bf2,
+       0x35794ff1, 0x5fdf74b9, 0xed5ceafe, 0x76bc835e, 0x36cd85d1, 0x4743e5d1,
+       0xd532e880, 0x40e3dfe1, 0xf0a17cb9, 0x583d4f81, 0x11d3a72f, 0x82bc382d,
+       0xae7ddbf4, 0x3ea7e768, 0x8d53a48c, 0x1fac13a0, 0xd2740cb2, 0x7ef913e9,
+       0x07d2faeb, 0x8bfdc53e, 0x45edf8a7, 0x08b1ebbd, 0xc74465fa, 0xf383a75f,
+       0x0fd82b6b, 0xdfc2f381, 0xbbf8a665, 0xe827f15e, 0x7f47e3ad, 0x51dff60e,
+       0x944efb94, 0x1f5851cd, 0xe17387e7, 0xc17dbbad, 0x8fa2e30f, 0xf3a9c527,
+       0x04167cc3, 0x71aa3e01, 0xf1f7a3fb, 0xb682c43c, 0x974f18f3, 0xf1362e9c,
+       0x01738a43, 0xff415397, 0x211e7ba3, 0xc50d6ebe, 0xbd19ed7a, 0xd9c5278f,
+       0x185c1f0b, 0xffb34364, 0x11c1f1ef, 0x29f837cd, 0xde60479c, 0xf0bd79c2,
+       0x1b86c7f9, 0x18ea97fb, 0x79c4e697, 0xf6fcfaa9, 0xbde383b7, 0x1e1d70fb,
+       0xab7b275c, 0x8e254860, 0xbf7c60c0, 0x37f4f5c8, 0x145bdfe8, 0x68f0c4ff,
+       0xcae2f476, 0xdfa0977d, 0x99b2aab5, 0xc5d85552, 0x0ce2ed0c, 0x688f5dfe,
+       0x2b5e05f7, 0xcae2ebf4, 0xb5b7ee66, 0x70db9905, 0x323b00cf, 0x8ad8fc92,
+       0x69cf6cc3, 0x7e8dc06a, 0x83dc4d73, 0x65812aa0, 0x67e85919, 0x1a0ccc4a,
+       0x938d77f0, 0x4f2cd7ef, 0xfdc6e3dd, 0x8fd42b10, 0x9a5b33fe, 0x77e4ca72,
+       0xe5995d7b, 0xd7e93a04, 0x7ab0c744, 0x1f91249f, 0x1f8454f2, 0x1fa994f2,
+       0x7da6cd89, 0x28bc488a, 0x281dfe36, 0xb3ff0985, 0x9dfe87c0, 0x3e6ea5a4,
+       0x8fc295ce, 0xaffa04fd, 0x363b022f, 0xc1f645d6, 0x7c2c0b92, 0xe853687d,
+       0x3c6b2bbe, 0xf1c5af2f, 0xff71d871, 0x59f5c643, 0xde276098, 0xd5d32610,
+       0xf1c2128b, 0xdc2123cc, 0xe0978587, 0x5c63a37a, 0xfcf803cb, 0xd7207b79,
+       0xa6ff7809, 0x0901f36f, 0x81fc33f7, 0x35cf118b, 0x03d33072, 0x772d7fe5,
+       0x74b96266, 0x8138fac8, 0x39e017a7, 0x9f618087, 0xdcd7df94, 0xe13dcb0d,
+       0x112be60b, 0x5fdf86fb, 0xc7b7cc6c, 0x1fb02af8, 0x4acbdf91, 0xfda242fc,
+       0x074cfc41, 0x34fdff9f, 0xf2772f3f, 0x07f10575, 0x6e3ed7f2, 0x3c529d3f,
+       0x87efb871, 0xb4dd79d8, 0xbcf363ef, 0x114f686e, 0xe05ad8eb, 0x4fb0c557,
+       0xb3e2a177, 0x545d3f20, 0xfd8dcf0d, 0x2727628d, 0xf2dae838, 0xdebd76a8,
+       0x83af3c3f, 0x4f4f94f8, 0x92247b22, 0xed74762f, 0x69eff027, 0x9e33a1dd,
+       0xf1c388b2, 0xfad1ff4c, 0xfdae93ee, 0x761c45aa, 0x5efca873, 0x69fe3fbe,
+       0x99c51c6e, 0xa3b8fdea, 0xda336969, 0xf53477c5, 0xbcf8899d, 0x3fe2e0a3,
+       0xed43ba63, 0xfa8b13dc, 0xce897ee2, 0xc1f9dd97, 0xa42c6aeb, 0x475fdf5b,
+       0x2f3c1ff7, 0xeb3a71e4, 0x01fe9154, 0x7ef8d6e6, 0x47df8857, 0xae02bcc5,
+       0x715fd157, 0xdb743877, 0xf3dd000d, 0x3406e87a, 0xebefa6f7, 0x43d5037c,
+       0x893ddea0, 0xf7f494f6, 0x726fbd1a, 0x35d7bf98, 0xe346c57e, 0x8daf1ee9,
+       0x0f8fafc6, 0xeff84a7a, 0xf7b88fc2, 0xf8c7c74d, 0x77dc7c99, 0x1d75dec4,
+       0xe03acb3b, 0x3fb0db0e, 0xde3e78f3, 0x7cfc489f, 0x1fa05985, 0xf6fa745f,
+       0xe33e3f20, 0xbd45edf4, 0x4ceb6257, 0xbc920657, 0xcbcf85bc, 0xc905c0e4,
+       0x0313fe30, 0x21271702, 0x9cfb9a1e, 0xc07fbd97, 0x80fbf9ce, 0x81f7f39d,
+       0x5baf9d0c, 0xecd7c89c, 0x538d2274, 0x92c77eff, 0xbb1f87ad, 0xc4fbf81d,
+       0xbb3efcdb, 0xe373d952, 0x9697e443, 0x3e2e3199, 0xfc203d32, 0x7c5d2d0c,
+       0x433bc7c8, 0xa332f2e1, 0xc1ce9621, 0x9b2f98cc, 0x319fdbee, 0x32c3c79f,
+       0xadf879a5, 0x22c275a6, 0xb3d2d711, 0x4483f41e, 0xfe7333d6, 0x6517ba04,
+       0x471ee69b, 0x9c35917e, 0xf44e66cf, 0x608e78c9, 0xf68932cc, 0xf21f47f1,
+       0x3c00b634, 0x45ef1433, 0xe0f99d31, 0xfbc20d7f, 0xb99aca51, 0x9e45347f,
+       0x4853f993, 0xf3e1ed57, 0x1073c23d, 0xc79f0e4f, 0x69cfd861, 0xdd322b53,
+       0x38f7cfc8, 0x7207a87c, 0x827df56f, 0x22fdd574, 0x0afbbcfa, 0x171801d8,
+       0x27b77b9a, 0xb724f907, 0xd4a3eede, 0xd01894c6, 0xb30ab96b, 0x31a29a61,
+       0x0c698ec5, 0xbd9a61b3, 0x354fd850, 0xe0fd9137, 0x786bf1ca, 0xd36e79bf,
+       0xfbe35ff3, 0xb7784af9, 0xdcabe064, 0xa3bfb7a6, 0x3f3e7673, 0x565efdc5,
+       0x9fd699a7, 0xf0cdeac3, 0x38668de5, 0x47866c33, 0x65c333ee, 0x67683638,
+       0xe11ef88c, 0x86569d9e, 0xde2b2bdf, 0xf438a56c, 0xa0ae7157, 0xe93b5e78,
+       0x4dc509c5, 0x712718d9, 0x05a745fc, 0xfe3b95fd, 0x59c532fa, 0x658a6e74,
+       0xfbb86718, 0x831618d3, 0xed9bbc71, 0x18bf30eb, 0xd9fe8768, 0xb5f6cde2,
+       0xedb34f18, 0x434f9d52, 0xedb50f14, 0x4bbcfc6f, 0x086b06e7, 0x6f8e2ee3,
+       0xe445fe7f, 0xfa1be3cb, 0xaaf61d93, 0x7d60b414, 0xdd3847c1, 0x3ebd08c7,
+       0xe2f5e846, 0xfc7af33a, 0xaf6e970a, 0xfce287ba, 0xe3812637, 0x2fb2b5bb,
+       0x2577c587, 0x8c6dfb74, 0x40dd67b0, 0x7687cfcf, 0xd08879d3, 0x7ba179cf,
+       0x6bd11f35, 0xb3ea0c41, 0x0cdaa38e, 0x5c5d4bf4, 0xcea3c663, 0xcc8497df,
+       0x24ba27cf, 0xcf0ce7a1, 0xc55e3033, 0xe71524b3, 0xdfa367ef, 0x8bbd7f53,
+       0xbc2f19db, 0x20f2e9a0, 0x992a7b8b, 0xb2ae70c7, 0x79b3ef5b, 0x089e31fd,
+       0xfbb035e9, 0xbb447179, 0x2eb1fd7a, 0xda5fcf2e, 0x448279f8, 0x95638781,
+       0xe86ec8fb, 0x7d2b23b2, 0x380689be, 0x727766af, 0x776fe12e, 0xf986bdf2,
+       0xdec364aa, 0x4e30bbe4, 0x8f414eae, 0xe3b92b36, 0x498f9fb9, 0x3d72e7c4,
+       0x11f313f6, 0x6ff56d8f, 0xd81cb0b8, 0x718c23d9, 0x5735f967, 0xe41a26fb,
+       0xb9f287fe, 0x3712b74e, 0x392bcbc7, 0x9cf093cd, 0xff0d7148, 0xfd71618e,
+       0x80dcb76d, 0xcfcd5ef8, 0xcc2b67d3, 0x963c832f, 0xfaedb96c, 0xfcbcf061,
+       0xec5e5199, 0x2b71540f, 0x78de2f3e, 0x3d15ce92, 0x8efee16a, 0x0504fa48,
+       0x13fa3d9f, 0x39ea0147, 0xcb75efa8, 0x9f7f7a08, 0x239bec05, 0xdcef83e3,
+       0xb38e4505, 0xa06f0ffa, 0x9f3330f8, 0x684bdf02, 0x97ae75bf, 0xe9e8ebbc,
+       0xd19becc2, 0xa02df754, 0x8fc87978, 0x0c297eba, 0xa489eb99, 0x6fc16aef,
+       0xe4621bf0, 0x7d72c893, 0xdce904a6, 0xd07cc974, 0x43ff0693, 0x8a6aa1c9,
+       0x076c8dcf, 0xc1985823, 0xe181da0e, 0x9b972875, 0xfc169c78, 0x88b65b24,
+       0x61c41f63, 0xf915c7ba, 0xf8a21811, 0x83d13652, 0x4d99bd78, 0x37d754c6,
+       0xc3f5396d, 0x52abfcb1, 0xa2bf73cb, 0xe7249cfa, 0xdd30ee6d, 0x9c4fdb6f,
+       0x70f36f47, 0x8feeff58, 0x64d45f9e, 0xe3aeb8a7, 0xbfd23427, 0x149e300b,
+       0xb768bfcb, 0x3d68c058, 0x78cfa5be, 0xab6e538c, 0x1fa5f7e7, 0x5e33efab,
+       0x1ebccb3b, 0xf9f44fa9, 0x39fe20f6, 0xbe7afd1a, 0x83ce1726, 0x771c788b,
+       0xcc8a9f4a, 0xd274288a, 0x2ad44bdf, 0xd3fd7132, 0xbbc38f79, 0xcc14f08e,
+       0x9fefc850, 0x5c9a7e4a, 0xe83a9fe1, 0x02edbff6, 0xaca139ba, 0xec25fe0f,
+       0xdfa1d793, 0xfbd90bf3, 0xf7507b80, 0xacacfd3e, 0xa3df9d00, 0xfb40f40f,
+       0x56161533, 0xe266df80, 0x609c353c, 0xae674f9a, 0x719e2896, 0x78f372d6,
+       0xe36ebef0, 0xaac05afc, 0x5622dea9, 0x6ac1694f, 0xce217e73, 0x273c2e47,
+       0x8a76e3c7, 0xfaf9cd6a, 0x8d92c0b9, 0xf0d1ac67, 0xc7d335f6, 0xc702fbe7,
+       0xa36cdd27, 0x2ab7ddfe, 0x6977ef8e, 0x6df387cc, 0xe9272ae7, 0xa01662ff,
+       0xe629dc7e, 0x7307f2fd, 0xed20b37d, 0x37d33f98, 0xcb9e0fab, 0x2d23f3e7,
+       0xf99e4919, 0x13c57ebd, 0xbf007859, 0xbce187cf, 0x8524dc5b, 0x036c2187,
+       0x9fc11d51, 0x3826bde3, 0x3679e37e, 0x6e38fc7d, 0x3ef673e3, 0x9e116fa7,
+       0xb8f9929b, 0x0225f98d, 0xad1b251f, 0x98d17f26, 0x79d0528d, 0x6aaf9e39,
+       0x1acaf7a1, 0xf54d58ce, 0xec1d798a, 0xba076601, 0x2b58298d, 0x755660e3,
+       0x25d0f1e9, 0x1ccbced1, 0x755c7810, 0x945f5e5b, 0xbed1c7db, 0x9d1027ed,
+       0xf84a7a43, 0x06d858a3, 0xec8cc5ed, 0x7b3f2982, 0xe2938721, 0x26a6bd1e,
+       0x4a2fbe8d, 0x653361fb, 0x0e789bff, 0xd03e32b3, 0x99da0e37, 0x2ba5f169,
+       0xc1bebf24, 0xcf9d6fe4, 0x88e4f0f1, 0xa22a4b8a, 0x3a75b7ac, 0x53d5213f,
+       0x3b70409c, 0x599da79f, 0x20c06a9d, 0xb8e32317, 0xd3db8cbe, 0x3a8fe742,
+       0xfe744ab7, 0x20e929f9, 0xea7e0f9d, 0xff430f5a, 0x09d02a40, 0x1253eff5,
+       0xfcf7845b, 0x34dc3565, 0x73a40de7, 0xe3178c56, 0xc61b4a0f, 0x1a0ea5c9,
+       0x62e3b73f, 0xbee2d62b, 0x218cca54, 0x61df9023, 0x866e33dc, 0x3ce3a3e7,
+       0x075f5ed4, 0xc2ea7ba7, 0xa1dcc660, 0xce7fbed8, 0xc38f281b, 0x7cbce862,
+       0x99cae00a, 0xb432e940, 0xe65952cf, 0x5333b46e, 0xa04678a7, 0x8b957f4f,
+       0x916493b7, 0xf684dc67, 0x270e08e3, 0xd6f92c3c, 0xa0ae1311, 0xfcac5276,
+       0x1cf87a93, 0xfa1b4ded, 0x7a061c27, 0xc4c8a84f, 0xf10653f6, 0xa70b5134,
+       0xbbfb3d61, 0x75a01ee8, 0x23373cc8, 0xbbef3d7d, 0x2eb82971, 0x0b06dfdc,
+       0xfb63d075, 0x97fdf4d3, 0xfbec83b0, 0xf2f0870b, 0x97994ec2, 0x24e7cfc9,
+       0x15f6eba6, 0xfaa1d72f, 0x5ea246e2, 0xf9db8f7d, 0xe47c395f, 0xeb42bf07,
+       0xa0803ce5, 0x58e9f953, 0x0bcc3216, 0x21bed3e5, 0xb4fcb3fb, 0xef1cf4cb,
+       0x95c63509, 0xa1ec1497, 0xb2943bef, 0x509f3a66, 0x838e6f5a, 0x7a2622bf,
+       0x979f3abb, 0x3059969f, 0xf99abb6a, 0x2c3ee9f9, 0xb95a27d8, 0xd3f3f364,
+       0xfc6e1992, 0xe8539456, 0x7169cb39, 0x0a71fae1, 0x67a847ce, 0x7aa09642,
+       0xda5d3779, 0x79a62ddd, 0xe1c3dda8, 0xa8bfb10e, 0xb7f5ebe7, 0x39c4d34f,
+       0x7bcf7e3d, 0x2028255b, 0x4dd3cfc0, 0x5ddfc927, 0xf09bb4d2, 0x3745f3a3,
+       0xd059629e, 0xaae4a780, 0x6405b0e6, 0xfdb8e9fc, 0x025e874b, 0xcba3d924,
+       0x7d4b3bf3, 0xbf1f2163, 0xef90616b, 0x792eacd8, 0xcab37527, 0xf0fd0b22,
+       0x6389d2ee, 0xdf2f308d, 0x35f37efd, 0xb2b78113, 0x6bf7f286, 0x6b7bdee3,
+       0x7506c621, 0x4ce83b9d, 0xb00d3bf7, 0x0076022d, 0xbb00cc3c, 0x2313f223,
+       0xe02353f2, 0xcdbe5e34, 0xbd974e19, 0xfb8e6d8c, 0xf4051ae0, 0xf0df5b5c,
+       0x6479bc74, 0xd747d579, 0x4b8ef7e0, 0x7bf7f8b3, 0xaf249acb, 0x65a3d064,
+       0xe4871e5e, 0x3368b6f0, 0x9a1e2287, 0x507d44df, 0x71b928d2, 0xdfa8e0fd,
+       0xdf182612, 0xabde18f3, 0x92d3ebe7, 0x5ef483fa, 0xb10ff5af, 0x3a3f3c90,
+       0x772a73e4, 0x362dfdae, 0xaf3dfcc5, 0x52bbf6de, 0x50b7812d, 0xc7f7eadf,
+       0xa8f96db7, 0x20aa7bfb, 0x7d7ded7f, 0x469f497b, 0xc72f5b9c, 0xe5ba38fe,
+       0xa3e3c745, 0x7dd14e43, 0xd6187fba, 0x079a01f4, 0x2e4ef3b1, 0xff75abc0,
+       0x14787a54, 0x27785fda, 0x4f1fce2f, 0x704ba148, 0x059a7a5e, 0xef76c12e,
+       0x3768bd29, 0x80ec6a7e, 0x5e0cf2da, 0xdc4df309, 0x01ffc249, 0xfc00cb67,
+       0xc7e9dd64, 0xa4e1c2ff, 0xe609ba16, 0xafefeab6, 0x1ecdefc1, 0xc032d018,
+       0x8ff7f002, 0xe0993a5f, 0x419e5a8b, 0x04eac2f8, 0x196b0f0e, 0x03fbc320,
+       0x23267d83, 0xa3bbd6fd, 0xa109fdcb, 0xc5fef46f, 0x891df60e, 0x84aafb43,
+       0x2c783bcf, 0x757a06da, 0x4db1d17a, 0xd31f01eb, 0xf49623ff, 0x5bb6fadd,
+       0x1e13f3ae, 0x6f8c7e82, 0xa6f8114c, 0xbbf49179, 0x5f44f642, 0xba130b9c,
+       0x6f4ce9e9, 0x71bcd0f6, 0xb416c569, 0x0fa6521f, 0x55e379a5, 0xee27ef97,
+       0xe9e9dd51, 0xc4fe9e24, 0x5bfae6ed, 0x46bc50b6, 0xb24e43ca, 0xdf171eab,
+       0x23b90067, 0xba0870fe, 0x3c7cdc58, 0x73190dff, 0x80001bd1, 0x00008000,
+       0x00088b1f, 0x00000000, 0x7dddff00, 0xc594780d, 0xbbbcf0b5, 0x26effeef,
+       0xb24d9bbb, 0xf379f909, 0x71100843, 0xa9189313, 0x18884dd6, 0x220bb531,
+       0x49716b62, 0xc93049f8, 0x2d16ad46, 0x544859bd, 0x46d10882, 0xe1b80a04,
+       0xfd2b6202, 0x1a8c4582, 0xf68882e8, 0x72dfbd2b, 0xbd3fadeb, 0x8a7e1bd7,
+       0xb4564288, 0xeb6dea5c, 0x2666739d, 0x5c9377d9, 0x9f7b7aa8, 0xbe8f8be7,
+       0xcef33bce, 0xfe73399c, 0xb3339ce6, 0x9086bb1a, 0x258e4264, 0x4ec730dc,
+       0xe631df9f, 0x224c9d15, 0xf433bba4, 0xc84b499c, 0xc421127b, 0x09f04845,
+       0x0e7b6853, 0xd1eddf21, 0xb4897504, 0x734de1de, 0x44b2d116, 0xc345bd7c,
+       0xd57fbde5, 0xd2b3e5de, 0xd32d3172, 0x9912abe7, 0xbd33f58b, 0xfe5a0e69,
+       0xa7aefe02, 0x9f561ee5, 0x58ad25ae, 0x7fbec39f, 0xe5dc84aa, 0x76d4cfa3,
+       0x7d296e3a, 0xb5b89dae, 0x916b8e9d, 0x0bca1789, 0x5d6c16e7, 0x736a614e,
+       0x897842cc, 0x51269bd7, 0xe6364ef8, 0x76d1566a, 0xc8afa7bf, 0x515c8435,
+       0x97b0cde0, 0xff40f9d1, 0x44d21c74, 0x3c369527, 0x37981cfe, 0x7ad7afad,
+       0xcf3a64b3, 0x39fe1ddb, 0xe35ebed0, 0xd0b4429d, 0x77c0b789, 0x8823b405,
+       0x3b76399f, 0x40f227b6, 0xffffbc19, 0xb8954f08, 0x4f115fee, 0x7534ef77,
+       0xf8242c9d, 0xb7fd05f7, 0x2aa1d7b9, 0xbad2fa07, 0xcb871a4e, 0xd0ffc377,
+       0x24ad4871, 0x2c3a1493, 0x8d6e22ab, 0xbfe836ff, 0x7a07e979, 0x513781a2,
+       0xf02ff43d, 0xeb0a4ebe, 0x82fce952, 0x76cf24fb, 0xb2cfdec2, 0xe8959211,
+       0x21e613bf, 0xc3f79ee0, 0xd17f34e6, 0x3f2c7cf0, 0x76e6a978, 0xe4b79c5a,
+       0xf4edaecc, 0x590f79fb, 0xdb865108, 0x9d711ed3, 0xb8cf7fdf, 0x9f495c9a,
+       0x86b0defa, 0x19fdebe2, 0xb69cb3c4, 0x1a435f7b, 0x73efff00, 0x743f95bc,
+       0x853211f7, 0xb5d95f90, 0xd0499df8, 0xbddbe483, 0x53b7e288, 0xd0234122,
+       0xd23d4cc3, 0xd28860c3, 0xfeb095c3, 0xfbe87d74, 0x872707ee, 0x067d7482,
+       0x619100c9, 0xbec4153e, 0xbfa9895d, 0x29eb00a3, 0xb44d049d, 0x0e68da3e,
+       0x5e80956d, 0x50a5a028, 0x5feb093f, 0x07fad895, 0x38e230ef, 0x1d1933dd,
+       0x433a3776, 0xb6001cc1, 0xc6de008b, 0x7694a3a2, 0x64487482, 0xb69994ef,
+       0xe36c7c61, 0x3a52c172, 0xb4dbe2f0, 0xe4dab23f, 0xb01f4f19, 0xbb943284,
+       0x4a3c7152, 0xbe91ab0f, 0xfd470664, 0xab42d38f, 0x394f5c70, 0x36a3cbac,
+       0x1f787cef, 0x014591fd, 0xc89937f8, 0x7d09634a, 0xe8c3a44a, 0xe1c0eba4,
+       0x134f5d21, 0x60bb83a0, 0x7f878a00, 0x536f386f, 0xd89ffbe8, 0x08038425,
+       0x484e58cd, 0x75f5611d, 0xa4c72ccb, 0x86d4f029, 0xddf4090d, 0x03bc1bca,
+       0xd972be82, 0xf3fb48d3, 0xeb22ba73, 0x83c036a3, 0x804bbe1f, 0x29b73ffe,
+       0xefd32856, 0xd3f2c0a7, 0xbf870bef, 0x7df039ff, 0xe0c7c019, 0x65166d27,
+       0x1f8c34bb, 0x80b9fcf1, 0x6f69ebaf, 0x9c6278ec, 0xd98f7ef8, 0xf007ffbd,
+       0x4e1ef145, 0xb45e0174, 0xf0f1aeb8, 0xc7d1f4ba, 0x5e7eb44d, 0x82b1d69b,
+       0xd4bfd3e2, 0xf015f386, 0xbd1a95de, 0xec8de48e, 0xa5a594ff, 0x2ff9865c,
+       0x964f7465, 0x62e22819, 0x2e1fa2f1, 0x485dd253, 0xd23587a2, 0xf0e5ef28,
+       0x517f8001, 0xf8f7cc77, 0x621abfdf, 0x21be09db, 0x3f07148a, 0x92452ba7,
+       0x12fcdd61, 0x3ebd375b, 0x56e40f3a, 0x9f02dc3c, 0x8de5c6ff, 0x7c788ba0,
+       0xbbe01bff, 0x5dbe246c, 0xe84c81fa, 0x80d4bfd7, 0x9fef8a78, 0xf77e1090,
+       0x4d0489b4, 0x4bd6ee94, 0xfaebd212, 0x90212d07, 0xe8a6839b, 0x6067c00e,
+       0xdeb88dff, 0x0acd1ae7, 0xea364da1, 0xf705bf19, 0x171f18db, 0xdc80140c,
+       0xece7473b, 0xee73eba5, 0xa09eda37, 0xa4208024, 0xadda37e5, 0x5ee7ff40,
+       0xb3f589be, 0x5a10a2dc, 0xe986000e, 0x7fe081b8, 0x578a11b6, 0xc7119669,
+       0x0a57b13f, 0x8fbea019, 0x5e4639e2, 0x36ffa39e, 0x8dcb0c94, 0x3800a841,
+       0x07082cfa, 0x8e23699d, 0x59335df7, 0xd16fc745, 0xad0d5e48, 0x2932596f,
+       0x31e0ced4, 0x16d5cac6, 0x4a90e90d, 0x45bff986, 0xdee0bc73, 0xa7275622,
+       0x60ac7970, 0x851243bb, 0x3ab8c9b3, 0x05fa05a2, 0x4bf5a03e, 0x78673ea0,
+       0x7f565a1d, 0x479817f4, 0x7d351ecb, 0x9eaf3d34, 0xba5892c7, 0x17a619ca,
+       0x17c3294b, 0xf1a126a9, 0x2f1b5e14, 0x21226a5b, 0xe963e02d, 0x2ae27234,
+       0xc0e0f4da, 0x5b23a074, 0xa3a92f69, 0xe269c0cf, 0xa7b8510d, 0x36bcf7f6,
+       0xd477b68e, 0xba613244, 0xcdbfa581, 0xf0d5793b, 0xaf380b3a, 0x4b427fe9,
+       0x7e1e38ac, 0xeef14147, 0x89bb62b6, 0x7d88aeb3, 0x92efc0ae, 0x0f2f4c35,
+       0x1fe02bc0, 0x75cde999, 0xfd526f5c, 0x617af28a, 0xafd404d7, 0xce40ffa0,
+       0xf4c0953d, 0x903dc831, 0xaa8e6d33, 0x9e741cab, 0x14d56766, 0xc71b1947,
+       0x27e98367, 0xa788fea1, 0x243d78eb, 0xb5e6a5da, 0xc75ab716, 0x0cf9476e,
+       0x90dd16f1, 0x2c88e4c8, 0xafd17961, 0x10ab3d75, 0xe6e9193e, 0x2839cdde,
+       0x97481b97, 0x89bce81e, 0xc740f484, 0x98248c8b, 0x1162e940, 0x9f48966d,
+       0x881bd78b, 0x8d7eb312, 0x89b97521, 0x49bb85cb, 0x7bbfbf04, 0x357d5c67,
+       0x7d68db09, 0x2d8491b3, 0xd755ecf0, 0x8e7d50b7, 0x85f7d67c, 0xe93df621,
+       0x8bbdf366, 0x3aa3bbaf, 0x79d3f5a4, 0xdd51306f, 0x5d0684ea, 0x97533eb8,
+       0x267ae0f5, 0x1e737896, 0x2bf2bd06, 0xa52b679d, 0xf5f03fdb, 0x6639f812,
+       0xbc00aaaf, 0x9c1ab59b, 0x0361f47f, 0xd524e7e2, 0x6bfeb0e3, 0x59aee41d,
+       0x8dae79f4, 0x8075f378, 0x2cd67b26, 0xaf3c48db, 0x00d4c57a, 0xd0e0d374,
+       0xd32ae8a8, 0xf972c3a1, 0xe5ff8e0a, 0x1cd6d096, 0xa014f744, 0xa15cf2a7,
+       0x9994c957, 0x474c7cb4, 0x6e5a3bed, 0x43f56399, 0x4f60037f, 0x0efdf2d0,
+       0x77eecf26, 0x453d71e8, 0xd057cc59, 0xfb071d0d, 0x9ec55f33, 0x43658e02,
+       0x74609fed, 0xbaf0f5c3, 0xea0f7346, 0xd5fa21e1, 0x22dfa410, 0xfaf01e9f,
+       0xf32b970a, 0xf8a16ec1, 0x1412857e, 0x2f608fc8, 0x3e295fb3, 0xe5a52de6,
+       0x79174e57, 0x67402956, 0xf2bcde4c, 0x4159331d, 0xccf37c87, 0x27fb1f4f,
+       0xb4fe7f5a, 0xfad0315e, 0x746b4005, 0x88915efd, 0xbe0bc617, 0xbe810868,
+       0x7b33d26c, 0x15ff69b4, 0xfbd19ecc, 0x71842c37, 0xc079d05e, 0x084a69de,
+       0xeb03b73d, 0xa2943cd3, 0x863aabc9, 0x16cbe0cf, 0xf439bdf6, 0xa0bb9fb3,
+       0xa413d53e, 0xff26a3ed, 0x74d75846, 0x7a889283, 0xc25ad7f9, 0x381709c6,
+       0x878f5e28, 0x9c7ddd98, 0x4e304956, 0xa1fb0dbf, 0x90b69a7c, 0x33a273f6,
+       0xe543e715, 0x2759da2f, 0x82b618d6, 0x34375dfc, 0x8fed84ae, 0xd3d37ceb,
+       0x8bf8f968, 0xb4e59ec5, 0x0fa7d06a, 0x073d29eb, 0xafbb32d6, 0x016ca35e,
+       0x16fd90fc, 0x8f58879c, 0xb5c59ac0, 0xb2581f50, 0x8f9016ec, 0xc839f163,
+       0x3723127b, 0x166891cf, 0x86c6d3f0, 0xe830dedc, 0x1e89fe95, 0x4dc4af54,
+       0x8dd29f17, 0xa93db59d, 0xee8df863, 0x5f3d21d3, 0x1740ff6e, 0x43d33972,
+       0xca804e30, 0x0ff82265, 0x594c72e5, 0xad995a3b, 0x5495e063, 0xeba9df6e,
+       0x47fc1253, 0x9e5a5d60, 0x97f78ffc, 0x145e302a, 0x4ae922e5, 0xa93cbe46,
+       0xba03cef3, 0xf5875475, 0xfd7a3175, 0x99d983a4, 0x076e06f5, 0x963eb092,
+       0x797d450f, 0xc5ee9a95, 0x7fa704f3, 0xf7c9845b, 0xce1af591, 0x401ab71f,
+       0x20654d8f, 0x23d06c93, 0xc15fe856, 0x0e9ea7fe, 0x3969ebeb, 0xbf58597b,
+       0x4f813f88, 0x46c3be28, 0x1b93ef3a, 0x29bf8c6c, 0x459fa01a, 0xe5f50415,
+       0x63b52d22, 0xd2bde04b, 0xe5d74037, 0xa40e8bd4, 0x8a67f22f, 0xf9ef8a15,
+       0x5033b784, 0xb1ca97bb, 0x30a43a97, 0xafe60bec, 0xe5356c37, 0xb57b5f00,
+       0xcdcf5836, 0xf9b1ca12, 0x1b05951d, 0x9ec97968, 0x13fd702b, 0x2e5d182a,
+       0x2f503909, 0xb1f2e54e, 0xa3d210de, 0x8933fe1d, 0xf6883ec0, 0x1374f68f,
+       0x64ad28fd, 0xae401e24, 0x1421e8ab, 0xd1f6a653, 0x57265ed4, 0x24e79509,
+       0xf2126ec6, 0x8938e41e, 0xf4d503b3, 0x88fa1411, 0xa4a23dc9, 0x7213dc82,
+       0x97dd98f9, 0x3e3b44e8, 0x97d6153f, 0x9b9327ae, 0x6bc425bb, 0x7d456933,
+       0xd0c0f422, 0x9c8f5cb8, 0xbe9906d2, 0xcf813c32, 0xae0e677c, 0x8bd212eb,
+       0x95e844fa, 0xdf20e8b1, 0x88fbe1a9, 0xbc60e9d1, 0x9afec153, 0x75f0934e,
+       0x65a6bc74, 0x853cdc24, 0x50536d3d, 0x693d323f, 0x9e127a64, 0x97d0cbe6,
+       0x5e31faf1, 0xc1ebc61f, 0x77d33d54, 0x3d859d62, 0xd98d3a93, 0x85975301,
+       0xfc08a4b4, 0x94eade35, 0x26bb61e4, 0xa8d18ef0, 0x1f65095c, 0x9ef905c9,
+       0x2a62f950, 0xc4c80fad, 0xa1657c0b, 0xefa1e978, 0xb7fb7337, 0xd7cd9527,
+       0xabf467ad, 0xd8a47d93, 0xc112eb0a, 0x99346f7d, 0x051e81d8, 0xe8db373e,
+       0x1df02577, 0xefa1b7e3, 0x1cc3a48d, 0x2bd57df3, 0x173fd426, 0x0c85b65e,
+       0xb3f88f68, 0x94bfb41d, 0x4ed01bdf, 0x0d8af73d, 0xae39e9f5, 0xefc25d0f,
+       0x7e611e40, 0x41aebe16, 0x008e3552, 0xc6334bed, 0xf6140881, 0xd983b359,
+       0x21ed2359, 0x99139f5e, 0x80cae8c3, 0x8e0bcdfb, 0x4ca00781, 0x7fa021e1,
+       0x7e32716e, 0x5699ec0f, 0x3efa43fc, 0x187ab3e0, 0x40c5fdf6, 0xf7ed06af,
+       0x7d2918e7, 0x8b2ed74d, 0xd1e7483e, 0x83b5699c, 0xfeceab7e, 0x41dddfd7,
+       0xd1ee1fcb, 0xf3ac0311, 0x497369f6, 0xb7f2d8ee, 0x3e3ba431, 0x772fc310,
+       0x9b9754ef, 0x40e5d57b, 0xbf7cba9f, 0x653ae6d3, 0xf9e1d941, 0xc1b5d282,
+       0x87ba7ad0, 0xd5786bc2, 0x8668fa80, 0x1390ffd3, 0x7a26ade4, 0xc86cf018,
+       0xf80a78fe, 0x9ffd023b, 0x5034f048, 0x31148a36, 0x5f5f03fc, 0xb6cfcd30,
+       0x61b7828f, 0x06a311fc, 0x75ad4cf1, 0x173944f6, 0xd2e27ce0, 0x403c3f7b,
+       0x9668bfe7, 0xdf02bed9, 0xcacb6b78, 0x18449ec1, 0x4dfd6049, 0x8bbec21f,
+       0xf5846bb6, 0xb693353f, 0xac3570a3, 0x89b0fa67, 0x6f801244, 0x69dda85b,
+       0x1bfc4ba4, 0x77776fce, 0xf4c3cb44, 0x359dbb7f, 0xf94e0113, 0xe80fb22f,
+       0x37e851e3, 0xeade4ec6, 0x4bfc7264, 0x463299fb, 0x02b699f8, 0x038d9afe,
+       0xfe3a4afa, 0x0cf97ff5, 0xa5e2fde5, 0x823ee1af, 0xb33e63ce, 0xc80a4dab,
+       0x1e0fc5a7, 0xdf62f7c0, 0x8ad32a76, 0x36d7b6fb, 0xa1d95818, 0xcda9f2c7,
+       0xb8b95f6c, 0x3cc10a57, 0x931759a5, 0x6c2f412a, 0x640dd9d6, 0xf1e35e24,
+       0xb7a6c1f8, 0xf5efc013, 0xf61d2201, 0xc7b3127b, 0xb809adec, 0x135a507f,
+       0xac0cbec0, 0x9043f1bf, 0x6b378b8f, 0x902f603d, 0xcff4367d, 0xc37cde2c,
+       0xe85685c4, 0x4aa4d3e7, 0xb96d13f0, 0xd0543c01, 0x7e6217ce, 0xf4f5c89e,
+       0x6ae5bcbd, 0xd0f1f805, 0x62ff0666, 0xd0077187, 0xd17ff5d1, 0x1ac97f22,
+       0xb93b07e2, 0x089def5b, 0xda6cad7c, 0xe7d61d3e, 0x1ae99983, 0x224bbf6c,
+       0x638bc076, 0x5fbc0a69, 0xe03ec92c, 0x8df586e3, 0x4f76b1b5, 0xc7f9939d,
+       0xa597b32a, 0xaf91580c, 0x6d3e80e6, 0x08f94cde, 0xdef59fc6, 0x0d70eeef,
+       0x6b3495f3, 0xa1532dfd, 0x1e7567ff, 0x7b21bbe0, 0x90b7d366, 0x4c2fe0be,
+       0xe398b5f1, 0x99f2abeb, 0xa4f822c1, 0xeae400b5, 0x05ad15e2, 0x8cec51f6,
+       0x44d93e21, 0x213272f9, 0xf9129da7, 0x1993fc02, 0x63bed54e, 0xb59a7dac,
+       0xc67a8350, 0xedde21e8, 0xb74a99f4, 0xb71fb0c9, 0x6f58c925, 0x7d23d24b,
+       0x77ba7fcb, 0xbce86fe7, 0x2ffa749e, 0x26ccbe80, 0x6bd062de, 0x455ed44a,
+       0x35405acd, 0x136461da, 0xcc89afb3, 0x92eb85fc, 0x31558ec9, 0x125373fb,
+       0x39504fdb, 0x73f405f1, 0x1f3fddee, 0x64b6fc06, 0xec053c7d, 0xcfc5c085,
+       0xb35fe0f4, 0xdf284bf6, 0x011f1ead, 0xcff409ba, 0x868a0b24, 0xc3c072e5,
+       0xbcfc46f4, 0x98e924e6, 0xb145751c, 0x82974a9f, 0x41076ee5, 0xd4b8da7a,
+       0x46fef68c, 0x4004c857, 0x2b7cadff, 0xee46a7ec, 0xfb6e340f, 0x740b5785,
+       0xe3ec921e, 0xfe30aca1, 0x17986c18, 0x3e71d2d2, 0xc41796dc, 0x8f4a9ef2,
+       0xb759d696, 0x5ccae3fd, 0xce9f53c0, 0x9eaded03, 0xdf980481, 0x244edb87,
+       0xb61afcc0, 0x0dde7169, 0x16524fa1, 0x09cb0d16, 0x905fc69d, 0x5d827604,
+       0x42f8c2b2, 0xedb87c5e, 0x560594d3, 0x7d403fe6, 0x5e3a3a5a, 0xc9cacecc,
+       0xdff5fdf0, 0x6672eb64, 0x72042197, 0xf9898cf0, 0x33bb45f7, 0xaeffa636,
+       0xcdfe124b, 0x3fd02cde, 0xa2796543, 0xf7c4e406, 0x2efe6ced, 0xf0166f7d,
+       0xba9247e5, 0xb52b259f, 0x52e54424, 0x84894ae3, 0xf33fcca8, 0x20594bdc,
+       0xfedc3fff, 0x0c5d5652, 0x89dff17c, 0x6a498de7, 0xaff09a7f, 0x0ce1f4ba,
+       0x63ceaf18, 0x31cc7e60, 0x3da2abfc, 0xa4fccf59, 0x816b9483, 0x8377c50e,
+       0xd82f660d, 0x18c483bb, 0x5d5b9702, 0x7ad7f73f, 0xd82ef9bd, 0xe3ef88d7,
+       0xf40d5ffa, 0xfa92e144, 0x5827f424, 0x9f28a28a, 0x77fcb4bf, 0x918cf5d1,
+       0x8d9d74ff, 0xc6cd4eb0, 0x0471e1e8, 0x780f43e9, 0x6558b7d3, 0xed2957d0,
+       0xf7a2be8c, 0xe59f706b, 0x814c2732, 0xdd3e80b8, 0x76f9056d, 0x43b9817d,
+       0xb3ef0893, 0x333ed042, 0x0bbf10bd, 0x0ffa3156, 0xc3f410a6, 0x095691a5,
+       0xe676b4fd, 0x20a8cfe7, 0xf8b455f6, 0xe76624b3, 0xbd6789b8, 0x5fd70f36,
+       0xc70738c2, 0x400fd08b, 0xcf2f2047, 0x23a44648, 0x7b425fa9, 0x9de9ab54,
+       0x458efd07, 0xbac52b57, 0x2a1aba72, 0xeae89dff, 0x23c74149, 0x20afcae8,
+       0xa38db95d, 0x23f715d3, 0x127b765f, 0x36bec1f4, 0x2d6be395, 0xfbd13f97,
+       0x2eafc28d, 0x796b7cc1, 0x6b46b57f, 0xc47a0b58, 0xd638fba3, 0xda89bc3f,
+       0x4a7fb0c5, 0x3e9ebb03, 0x57cfb5c7, 0x6448dd70, 0x9608fc00, 0x2fa88dab,
+       0x7244d31f, 0x9d498ec0, 0xe81bbad4, 0x515e7523, 0x0bee3b49, 0x17a01c33,
+       0x7fa2d740, 0x1f34e974, 0x1c5823b3, 0x8f533a28, 0x07969cfb, 0x8ecc7d2b,
+       0x097e41a8, 0xa02936ac, 0xe7f5a707, 0x08fa072c, 0x031e232c, 0x86cf71d2,
+       0x9dcfe045, 0xac80f56d, 0xb225f113, 0x9d77cd52, 0x05538b12, 0x0f18226f,
+       0x0d338e1b, 0xe821f96c, 0xf422c6ff, 0x8ff90c9b, 0x8dea09f3, 0xd6438dcb,
+       0xde2136ad, 0xd068fc45, 0x25741146, 0x3fb191fa, 0x7a646892, 0x407ca468,
+       0x054a73ff, 0xa1eb7f11, 0x3cca2e9c, 0x5ff823de, 0x456ca3c4, 0xc8b01cbe,
+       0xbf399c2b, 0x049c4332, 0xb36c77fc, 0x00fd8416, 0x19598dfa, 0x694fcadd,
+       0x50e92028, 0xaaab9ffb, 0xbcca6233, 0xc1f7d0fd, 0x5f573755, 0xa877fa8b,
+       0x7aa6c01e, 0x26bd9459, 0xc355e205, 0x83b532f5, 0xff127d8d, 0x1be6e2be,
+       0x941eaaa8, 0xee7ff8c4, 0xd11f82f4, 0xc5e35444, 0xf5c727c2, 0x5bfda3af,
+       0x383ede15, 0xefe826ee, 0x7e5112a9, 0xe14bd3a0, 0xf753ab5b, 0xdfe52887,
+       0xf78c4143, 0xaf0e537f, 0x6c319d5a, 0xe17b501f, 0xc36549cf, 0xefa3c276,
+       0x495d76d5, 0x3fd8b2c7, 0x15fe83d5, 0x92e03efa, 0xe7890ed0, 0xf49704d7,
+       0x656becd5, 0xe09d7d84, 0x74f5f662, 0x2fba4960, 0x581df941, 0xdf6023e6,
+       0xe9c4bb52, 0xe3e4bb42, 0xfd680753, 0x1f9f59b9, 0xbb40a71e, 0xbec1e67b,
+       0x4651702a, 0xa9d81bf9, 0x6f94490d, 0xaeccfd8c, 0xe31cfaa6, 0x967e8205,
+       0x38fd39d8, 0x97fc0482, 0x32a4fbdd, 0x5a4277a0, 0x6ba36eb3, 0x379703f9,
+       0xfbe1c713, 0x9779f8cd, 0x205f98bb, 0xa1b55850, 0x26dffa00, 0x5617b011,
+       0x594f1e15, 0x63a9fb80, 0xbe630b29, 0x0a7bec6b, 0x53b8d9f1, 0xcb1e2a37,
+       0x7804e1a9, 0x45f9796c, 0x338dc82f, 0x42650921, 0x04ea1c83, 0x41a1b6bb,
+       0x29211603, 0x03bfcd0d, 0xf5731fe3, 0x5f9d3c64, 0x8177d706, 0xa706b79d,
+       0xbfe9bcc2, 0xd1b57d12, 0xc4e508b7, 0x2b46b9c6, 0xeb0a91c6, 0xd83c41ee,
+       0xc3c05ecd, 0x34aac2aa, 0xe665a718, 0x4dc63b74, 0xf5073da8, 0x077e0f2d,
+       0xae0245fd, 0x1aba7d55, 0xa9ca77b0, 0x0a0bf75d, 0x4673a677, 0xf5f2878d,
+       0xe2eeed38, 0x5710acfb, 0xff8e5d1f, 0x174664bf, 0xf82f921d, 0x8ff452ed,
+       0x677f5892, 0x1fb31f76, 0x55e9716f, 0x5c5bf1fe, 0x36bdaecc, 0xe4069918,
+       0xb01e5fb2, 0x201d5d80, 0x5f604fde, 0x65567c4d, 0x9313ae3b, 0x0536ae5f,
+       0xd74666fd, 0x425763c0, 0xee32b5fd, 0xf03c8867, 0x5cf71863, 0x8ab3cba7,
+       0xf2803e70, 0x90214583, 0xfe5cfbc7, 0x96fac2ef, 0xdcf57b73, 0x831637cb,
+       0x5fd8517f, 0x5099cf9d, 0x94da766f, 0x4e406b27, 0x796649fe, 0x6468c603,
+       0xc967ed1a, 0xb71c4ee7, 0x84ea14d3, 0x68f60ff5, 0xeac9beb1, 0xdbf4045f,
+       0x29faeb78, 0x0d608798, 0xd51e8015, 0xd008bab9, 0xa0bedd31, 0xf2e8c51f,
+       0x4f238811, 0x2597ce0b, 0x767117d0, 0x63f034cd, 0x85c5bee1, 0xce2adc7e,
+       0x1529e31f, 0x2b22329c, 0x34917c74, 0xf9bce76c, 0xbc32d9e7, 0xc68ff614,
+       0xd5eefcc8, 0xec04cd73, 0xf448f25c, 0xf8fc06b0, 0x7b0108ae, 0xc257b9b8,
+       0x5f0b9a71, 0xe5fec3d0, 0xdfc65eee, 0xa0dfbe01, 0x78c2cbf8, 0xedc2cb94,
+       0x67460e81, 0x1c787224, 0xb679f9e0, 0x76d0849e, 0x42577e31, 0xc0793396,
+       0xf8f3d3fb, 0x37f73343, 0xf5884d51, 0xcec25cab, 0x5b8ea158, 0x49d771f0,
+       0xf016af11, 0xfca92c5a, 0xc3d9e2e4, 0x183c4fbf, 0x1bfc0e9d, 0x7e05f4a5,
+       0xccd20da7, 0xf3a75e7b, 0xc93650db, 0x9b98a603, 0x04b69392, 0xa45253de,
+       0xfbed2f78, 0x0dd03a64, 0xafc821a9, 0xda957d2d, 0xeb8b2b66, 0xa58c5e60,
+       0x53ea07b5, 0xfd442aef, 0x5993710c, 0x1cb3fdf4, 0xe65669af, 0x08af73c7,
+       0x341c40e6, 0x9eefa0f1, 0x2bfc61d7, 0x4d87e8cc, 0x73636ba5, 0xf82573e2,
+       0xf8a4dcbd, 0x7767e800, 0xf00252ad, 0xc41f7888, 0x0d16670b, 0x3d38e3e7,
+       0x7d2b7792, 0x983976ee, 0x6a40cedf, 0x1f785e00, 0x1fc70eb2, 0xe3079fc1,
+       0x9e0f7c42, 0x32c2d2e7, 0xc0c9fffa, 0xefb8ed96, 0x483e6037, 0xef1bdf6d,
+       0x35adfe80, 0xc78c5e92, 0xd52dd9c6, 0x02beb789, 0xf6783ff4, 0x018796d4,
+       0x7af6dbae, 0xce25ef30, 0x9bfeb91e, 0xb33f3ecc, 0x3f00a2dd, 0x9b72e56c,
+       0x27c88fda, 0x3f6c5dc1, 0x1e476f19, 0x27f7a975, 0xddafe543, 0x05f0648e,
+       0x0b3cb3b7, 0x7c03df21, 0x70d837ff, 0xd7f4013e, 0x13c10dbf, 0x8db20f97,
+       0x8ff483e7, 0xe6f20f9e, 0xe8104b0e, 0x09af7ce1, 0x8f3292fd, 0x45b59d7b,
+       0x7524001f, 0x01cf0e38, 0x72581b79, 0xca1ae7e6, 0x8b0f727f, 0x8f12c923,
+       0x4b4afd33, 0x6bcc5c58, 0x808bff07, 0x774c765b, 0x3e408b7b, 0x713779b2,
+       0xb39351bf, 0x2ef16140, 0x94d43796, 0x7b002e10, 0x87ae55ea, 0x5e2ccc9a,
+       0x87d0e835, 0x26a35d61, 0x185d1fff, 0x93df62d7, 0xd8941a5f, 0x884f56b8,
+       0x0a2775d9, 0x9d3d6135, 0x07d80f67, 0x59ab6eb0, 0x9f286b7c, 0xc7a1bf60,
+       0x5890e2c0, 0x41ccec1e, 0xe22f5939, 0x3f99fb56, 0xa7c79eae, 0xf45acc4e,
+       0x745ca40c, 0xb035ad48, 0xaab0bb3f, 0x0fe8fd12, 0x9f13393c, 0x7ed52bf5,
+       0xa7e045ff, 0x238e1bcf, 0x1d7bff0b, 0xbd99e8f1, 0xd447ec3c, 0x5945fb50,
+       0xbe815729, 0x15f621cc, 0x2095ff20, 0xe9abad5d, 0xc13e83b3, 0x12349768,
+       0xa77239d8, 0xfbeb0ccb, 0xf5068768, 0xe343b054, 0xcf027685, 0x8fccc939,
+       0xf3324d74, 0x0aa5d06b, 0xd9e238c1, 0x0771e3a1, 0xa272dfde, 0x2353c309,
+       0x76a3e7b1, 0x7d3466b9, 0xd0ebfa2d, 0x4fc11ab5, 0xa0d4cd17, 0xde82fbdf,
+       0xc6fd173b, 0x790202ce, 0xd6b61d54, 0x1eac3595, 0x2982e779, 0xebfac3ea,
+       0x12486664, 0x33f209c5, 0xcbe79935, 0x616de1c5, 0x1f1cba97, 0xa90c698f,
+       0x3fc4f5cb, 0xc58f2d21, 0xa7df620f, 0x75f93326, 0xc70e5561, 0xe3f307b7,
+       0x6797fcc4, 0x3269bc30, 0xb33733d9, 0x41d02e6a, 0x7397c42e, 0xabfcc9e0,
+       0x7f082674, 0x092e75ee, 0xde0e23e9, 0x80da300e, 0x3c593abe, 0x3f856ff4,
+       0xe4caee1e, 0xbc1fae14, 0xd65f886e, 0x8f18f5db, 0x493f5cbe, 0x0e5ab25d,
+       0xfebf950d, 0x27db2cfd, 0x9e796a75, 0x50e51d8d, 0xe5cd9d9d, 0x11d9e484,
+       0x6a56f786, 0x3a3cc02f, 0x3f6025b5, 0x8ad5bb4c, 0x6fd968f3, 0xf3703f42,
+       0xd02c81b2, 0x03552de3, 0x89b71005, 0x2b402fc7, 0xdb45f90b, 0xfee8b9d5,
+       0xd884ec03, 0x4b5f3c76, 0xfef5671d, 0xf60cb920, 0xbf762739, 0xb76afa01,
+       0xfd15f509, 0xf00603bf, 0x839cbcb3, 0x3687ccf6, 0x0bb41b7f, 0x9e5bc398,
+       0x85bb01cd, 0xfdcd4dd9, 0x0bb01e86, 0xe2623aeb, 0xd59ff07c, 0x591fb8ea,
+       0x3bff44e9, 0x6fbf56e9, 0xddf714d8, 0x17603888, 0xbd3af3ae, 0x3bf0227f,
+       0x7f983bd5, 0x8351b670, 0x5af50379, 0xb79022cf, 0x7b6a4d67, 0xad8dacfc,
+       0x75a196d7, 0xb5bda0f6, 0xf675cc65, 0xd73ac014, 0xb63f886b, 0x6758669f,
+       0x7c4dbeba, 0x78becf9d, 0xf3ac0175, 0x2eafbbc7, 0xa75e7580, 0xdf02f2eb,
+       0x5bfc39b4, 0x27bf6993, 0x3da1f06f, 0x2f58f225, 0x24f71e97, 0x432bfdab,
+       0xff21ffe5, 0x30fa58ca, 0x5a87043c, 0x4af4ba1f, 0x3a83c806, 0xd5bfe1a3,
+       0xaa37f08b, 0x4068cf1f, 0x3ffec77f, 0x0766ba7f, 0x2d7e81c8, 0xbfa223da,
+       0x0f3fb2fd, 0xeffda1ec, 0x69413db8, 0xb91bfeec, 0x246dd85f, 0x88abf041,
+       0x27b0807d, 0x5bf1e5e3, 0x251f3e7c, 0xbb006f7b, 0x8dfacbe6, 0x633bf81b,
+       0xe76653e8, 0xcc3c936e, 0x7e8bdc6f, 0xf37d96e4, 0x3e27e0ed, 0xe37e621d,
+       0xd18b1796, 0x7a18dc6f, 0x65790c2d, 0xc3b25fa4, 0xdb71a3fe, 0x07c804b1,
+       0xba5cfb10, 0x8c933daf, 0xefdea8f4, 0x489d0e9e, 0x0a01fc80, 0x71e82577,
+       0x07aa2b8b, 0xfba16fba, 0x6c23c83d, 0xa187a391, 0xc11716df, 0x3ed2973c,
+       0xc44ffef5, 0xf4fa3779, 0xf6377728, 0xd790214b, 0x4e7f7a29, 0x9235e806,
+       0x2078c761, 0xc98bb3e7, 0xb294d4de, 0xf7baf8d8, 0xe1e4e4f3, 0x0d81b07c,
+       0x03bf4889, 0x83b5e23a, 0xe360db3c, 0xf9464cf2, 0x8e4dc7f6, 0x630fcb10,
+       0x6218ffed, 0xc8a34276, 0x5849930b, 0x68b5eba6, 0x585df7b6, 0xe1f7906f,
+       0x5b1f7938, 0xbbfb7116, 0x52f51849, 0xca181933, 0x176d8b0f, 0x7887d71f,
+       0xd21faab8, 0x1f80ac5a, 0x07ab4eec, 0xb8f881e0, 0xf6c83eba, 0x961f94eb,
+       0xafd30c96, 0xbf410758, 0x1d0fdc2d, 0x08fe3868, 0x4fa06fd0, 0xd77d83b2,
+       0xdbf461e4, 0x905bf744, 0xefcf1b47, 0x379d57a4, 0x97ff163a, 0xd1f5a8a6,
+       0xe4eff950, 0x453ebd5f, 0xfe62f7cd, 0x343f6fc2, 0xf1897ecf, 0xe2bcdc65,
+       0xfef1a9f7, 0xbccfb176, 0x2738795c, 0x870f2d45, 0x79677fca, 0x2eb43758,
+       0x1d50f2f1, 0xe59bf8cf, 0x5c70ffe1, 0x4f7d99e3, 0x03bec027, 0xa7d878ec,
+       0x63aedcac, 0xfd1413f9, 0xe9e2f1b1, 0xc597ab5a, 0x5ea2b54f, 0xa657871d,
+       0xe33c38f3, 0xd45ed7eb, 0xf335bae2, 0x3ef37138, 0x369a079b, 0x9c631758,
+       0xba7e3e36, 0x0e9eec84, 0x471f154b, 0xce7e026d, 0x753c74bb, 0x8f8b0a75,
+       0x20725852, 0x6f3e216f, 0xa7eb35eb, 0x7598fe49, 0x1ba22aaf, 0xdbe85182,
+       0x33890728, 0x14c6fde6, 0xc6bf5766, 0x7adc8bf3, 0xad608e76, 0xfd85e2cd,
+       0xf2c35b8c, 0xf2e07e9f, 0x18bc826d, 0xfaf1c2a3, 0x4344edf2, 0xae8cf2f1,
+       0xb04ae517, 0x3901ead9, 0xa237fc28, 0x5e3c8bff, 0x3ffad971, 0xfcf7de8e,
+       0x3c7bd30f, 0xf18bf67e, 0xddb8d6fe, 0x151b8a7a, 0xe3a4105f, 0xca5f1023,
+       0x63bf4919, 0x1d1633f5, 0x1df14d1f, 0xfe766149, 0xb857cc14, 0x2963394c,
+       0x3f009e8d, 0x5063d911, 0x7e09afc0, 0xab8fd412, 0xaa3e78d3, 0xe6267ca7,
+       0x2573b369, 0x58ce1ce2, 0x4307e476, 0xc8ecc3eb, 0x9f5cc60f, 0xde47672f,
+       0x087df0ee, 0xd2b27674, 0x1e01e78b, 0x61f851b5, 0x619cf87f, 0xe22e73d4,
+       0xfca5c63c, 0xd1c45f2d, 0x4bff17d5, 0x3a92d472, 0x75f95d96, 0x13cfd1cb,
+       0x763a7fc0, 0xff9e413f, 0x45bc4119, 0x6b6449f7, 0x103b5f8c, 0x197bf961,
+       0xfef15e1c, 0xa1bef83f, 0x999bd521, 0xfc7fdf4a, 0x1248d1ae, 0x652e9ea9,
+       0x67c5b172, 0x4b42b8c5, 0x697fcb2f, 0x8e504659, 0xb4df80b7, 0x3389fc08,
+       0x4f7dd809, 0x2013fd3a, 0xf7d1ee8f, 0x226d41ac, 0x1167dbf8, 0xbdcef3b0,
+       0x9c33cacb, 0x6798c9fe, 0xe3006cb7, 0xceb3dd18, 0xf9561e60, 0x523e9f17,
+       0xa2f08a53, 0x5065c13f, 0x3db9679f, 0xf133c995, 0x6f843d9c, 0x3ff3fa2f,
+       0xdaf9606e, 0x0ed79701, 0x0fe1097e, 0x8c1128b7, 0x61ecb42b, 0x96b95bc6,
+       0x30fc87cd, 0x65a9e903, 0xf831654f, 0xa9af494d, 0xf2ddec18, 0xdf715bdf,
+       0xe983f1f7, 0xcfb12798, 0x7c02afe5, 0x37434ad8, 0x4d9a7d81, 0xf7bb01c7,
+       0x1537dde3, 0xfe42dc03, 0x39bf03ad, 0x4d9d7f1d, 0x462717ed, 0x64bf7796,
+       0x33ee2647, 0x5afeac9b, 0x133aff98, 0x9db82383, 0xfee14f9f, 0x17fe78f2,
+       0xd5aa9f7c, 0xdfa938e0, 0x5c9c6235, 0x3a7585c8, 0x0de637e2, 0x9e1293cb,
+       0xf1701867, 0x99fec73c, 0x97854f2c, 0xbe752ead, 0x37c947e7, 0x253c0094,
+       0x8b57f2a9, 0xe4475967, 0xb2a4940b, 0x5cea9678, 0xb322e5a2, 0x7aed73a7,
+       0x4adb27a4, 0x9454e2c2, 0xbfaec09e, 0x06991a36, 0xbbf2bce7, 0x9e02d7c3,
+       0x20d45ff7, 0x4799e49e, 0x28933e30, 0x56f2f1b1, 0x004e740f, 0xadfd8c7f,
+       0x954960eb, 0xa0157b2e, 0xefa749f4, 0xffe45481, 0xaf1842d6, 0x2c745fea,
+       0x059f72bf, 0x59dd0cfd, 0x795f984d, 0xea833dee, 0x33fc4e7c, 0x3e605648,
+       0x6fdf6e65, 0xdb604e31, 0x279a8d23, 0x15aa44fb, 0x1825a6f9, 0x36398e99,
+       0xce50bad7, 0x1f7efbca, 0xee43bb04, 0x91024194, 0x03579d0e, 0xcb82d3e7,
+       0xc7f5fa09, 0xb035db77, 0x3f3cd95e, 0x7fff7066, 0xbee3f14e, 0x4205c445,
+       0x3749bf2c, 0xc7ec08f0, 0xdf03e5e4, 0xec7ac20c, 0xc05a6871, 0xb68baa7f,
+       0x9f65dfa0, 0xd9acfd05, 0xbe2b797d, 0x2bd9cb41, 0x1b0718ed, 0x6ceee57c,
+       0xf3a7e7cc, 0x3cca3f1c, 0xf9654a1f, 0x8b3ef248, 0xfc99f406, 0xa8c0f104,
+       0x0aa523b2, 0x968a7ee1, 0x07df3f69, 0x8e1e4a7a, 0x0a3f829b, 0xaa4354f4,
+       0xcdd0077f, 0xa5a4b9d0, 0x892e7666, 0x2db5a79f, 0x9c176f7d, 0xfdc2d9f7,
+       0x4ff707b9, 0xbffe859e, 0x7582594e, 0xf960e0b8, 0xb2a42f95, 0xfc48e278,
+       0xd63cc41f, 0x65bf7ddc, 0x02e28d7a, 0x8c7597fa, 0x574ee45e, 0x5f19f80f,
+       0xde63f049, 0x611d75ee, 0xeccdc62d, 0xa35c7f27, 0xd677ecc4, 0xb2d33d33,
+       0xe3cfed93, 0xd29737f7, 0x921ebf2f, 0x0cbf4c33, 0x764eff95, 0xf4e2efcb,
+       0x6fbcdfca, 0x5efdea21, 0xbf12fdbc, 0x8f611bbf, 0x9637f5c7, 0x50f2231d,
+       0x61c786aa, 0xd84db4f6, 0x9e554149, 0x9f95954e, 0xfbaa343b, 0x47649f5f,
+       0x3b79107a, 0x72caed29, 0xfe8fdbc8, 0x4edfa088, 0x3c8915e4, 0xcb1560a2,
+       0x8c6a09f7, 0x4dd12e78, 0x687f30ba, 0x124b091c, 0xf006d7fa, 0xe42a6dfc,
+       0x4fefd111, 0xff62e6a4, 0xa567899b, 0x22a6e516, 0xc826fc01, 0xb802493f,
+       0xc1161b43, 0x7159b778, 0x9fe4133c, 0x033ee124, 0xc7dd39f9, 0x35a756f2,
+       0x3a43b8b0, 0x4e50cfd5, 0x697467cf, 0x3cc7ab9a, 0x22579156, 0x5e044ff2,
+       0xd3be38aa, 0x01ca2c27, 0x54f228b9, 0xe53d99d6, 0x39c11760, 0x1cbf3868,
+       0xbcf3346c, 0x776fd613, 0x4f9e2e63, 0x2979b2fe, 0xf91678f1, 0x7f44fa29,
+       0xe46cbba6, 0x37416739, 0x7089eb31, 0xecc7dc6d, 0x3d06aafc, 0x71b063ce,
+       0x072bfa06, 0xec04351b, 0x037eaa81, 0xf1b8c3a3, 0x93d5ce36, 0x872bf430,
+       0x054f204c, 0xceca5c3d, 0x085beba5, 0x6d83e0fe, 0x524ef33b, 0xd6d43fde,
+       0x9341cf8b, 0x12bdabd4, 0x03cea1cf, 0xb48df5c9, 0x1af95afc, 0x6689b7c8,
+       0x6a849449, 0x96faafd3, 0x60c4f54c, 0x287df472, 0x7be1bedf, 0xba3e3cac,
+       0x9beda245, 0xed623ed3, 0xa9d33681, 0xefff5ed8, 0x57eb41b5, 0x267f7fd0,
+       0x351cf9f1, 0xebf464ee, 0x3f41123c, 0xa57fd712, 0xadba3e4c, 0xdc9fb47a,
+       0x54951f3c, 0x8854fcf3, 0x7b72d0f8, 0xefc6315a, 0x13d944ad, 0x030cfa81,
+       0xe30827b3, 0xccf1f687, 0xf4e46d6f, 0xbf843240, 0xf208206a, 0x81c73dae,
+       0xe7c90fdf, 0xf310863d, 0x8ff1b19b, 0x9e0578be, 0xb679124b, 0x6733d884,
+       0x36f9815f, 0x135af2aa, 0xdb29a73f, 0x7bbce133, 0xc1db8ebb, 0xe6c47cbc,
+       0x04f3885f, 0xddf6a4be, 0x507e1bd1, 0x7674fc04, 0x41f30fef, 0xa7a8ddce,
+       0xe45184fb, 0x933a595a, 0xeb3a836b, 0xb77e894a, 0x016fe6c6, 0x32c77c3a,
+       0x311c3a6f, 0xa9549b9a, 0xc1bc0077, 0xd780b4e7, 0x8e274e64, 0x473e0cd9,
+       0x3c824fb5, 0x1b1376d4, 0x7b2fd937, 0x7f845cf1, 0x851b74b6, 0xf2625dbb,
+       0x88947e9b, 0x92a15576, 0x26c87108, 0xcb55ee7e, 0xcb9688e5, 0x1b6e7f91,
+       0xc1a997c8, 0x13ef4d78, 0x7fe7b05a, 0xbfe2e3cb, 0x9f9f51cd, 0xb83371e8,
+       0x569673c5, 0xcfe802b9, 0x523aaba5, 0xab40e94b, 0xfd7084f7, 0x37186d32,
+       0x772b603e, 0xa5efd00f, 0x42951fec, 0xe67b773e, 0xbe214a8f, 0xdc7a75a7,
+       0x8f7298be, 0x357fd19b, 0x59bc03b4, 0xefc14b5a, 0x97f5b5fb, 0xfa2bfb48,
+       0xf50dfdf2, 0x35706063, 0x7059a319, 0x9359fe6e, 0xffac3b7f, 0x30c7f985,
+       0xfa40fc2e, 0xaf21f7d1, 0xd18ea8e3, 0xe793305d, 0x69ee93e3, 0x0eee9409,
+       0x5e7839e7, 0x1ebf8b0a, 0xa8fcc09e, 0xfcb17e54, 0xe61289d1, 0x66ced621,
+       0x266f62e7, 0xfa018e91, 0x68593a3d, 0x1c8af4fd, 0x796b7fb4, 0x77f4c89e,
+       0x7eb0097c, 0xca8f6fd3, 0xb2c7f720, 0xeb746ee7, 0x3e188194, 0x975149be,
+       0x97542e6f, 0x9751e5bf, 0x97f15dbf, 0x9365b109, 0xe8107bd9, 0xdf8955f5,
+       0xb10d7147, 0xa4ba7f23, 0x935dd820, 0xe7e74a5f, 0xe53e5989, 0xf17ef94f,
+       0xf5820aa5, 0x5b8d3b29, 0xfdcf508d, 0x3f5e5aef, 0xd98c4dd9, 0xea07c44e,
+       0xf3c4a8e9, 0x93185d32, 0xb1ef7b22, 0x6d343f33, 0xecfda7ab, 0x1f20af9d,
+       0xe43558a7, 0xa5ebc09b, 0x04c3b446, 0x289bb45f, 0x963c537d, 0x819a338f,
+       0x9e75dbde, 0xd697d0f5, 0x2f40506c, 0xb1182657, 0xc83fed6f, 0x9b96d7a8,
+       0xcb4ec40c, 0x63371f07, 0x3e265cb9, 0x20a123c8, 0x51e786ce, 0x0ad4279d,
+       0x60eda5f3, 0x160eedbe, 0xeb96d757, 0x7ed3cf51, 0x3e0f5d71, 0x9c1109a1,
+       0xf98ca57f, 0xc1661ca6, 0x7c247477, 0x6be734ff, 0x518486ad, 0x7bb3a58e,
+       0xfed10e39, 0xbf83dfa1, 0xdfa0f6d2, 0x13b950ae, 0x271bcfea, 0xc0a8b9e0,
+       0x592f79d0, 0xda15c003, 0x67e87cb9, 0x3f04f2e7, 0xa542f90b, 0x852bbe5e,
+       0xf8149030, 0x053b050f, 0xfb8204ec, 0xccb71100, 0xd97a8a34, 0x0da6fd0b,
+       0xe0e767b5, 0x56997852, 0x60253585, 0x27f1bca7, 0xe4b1c3a0, 0x931a6145,
+       0xe429e213, 0xc3c316c5, 0x19af6a47, 0xef0a3d6d, 0x9b0cf2c7, 0x84c7ad9d,
+       0xad4be00c, 0xe8064279, 0x478776cd, 0x0b94c5f1, 0xae6a76e9, 0xdb45f013,
+       0x35adf2d1, 0x18e5f2c7, 0xc69854fd, 0xe76d00e4, 0x1ef0a24d, 0xc0192934,
+       0xdb8ca3bf, 0x7cb5c6cc, 0xe9bae3bd, 0x41ddb4b8, 0xb6971d1b, 0x843266db,
+       0x8da30935, 0x78c0a15f, 0xa2971a97, 0x833f911d, 0x93a503af, 0x0ec1f820,
+       0xaf4834da, 0xf2be7833, 0x1e3664c1, 0xffe75429, 0xf8e99be4, 0xcea65f98,
+       0xda51b9f7, 0xfa7a01d4, 0x56c25369, 0x3837cfa0, 0xfcb61cdd, 0x69d83e43,
+       0x382bcc6f, 0x71267284, 0xd1100779, 0xf28bd20c, 0x0bc1c846, 0xa1cac769,
+       0x8de1e54c, 0x0fde7469, 0x079d1ee4, 0x3c721f9d, 0xa5f68f9d, 0x56935bd9,
+       0x417e1236, 0xa06e029f, 0x218be053, 0x5f838d3a, 0xa5b91bd0, 0x37251317,
+       0x9e173b53, 0xa425eec2, 0x2bc5e595, 0xa3f3c399, 0xd8dd3e44, 0x18d1e6ca,
+       0x746fb844, 0xe6f318fc, 0xffe718ee, 0xf735c01e, 0xbef04fca, 0x3f9ee222,
+       0x1477f601, 0xc96979de, 0xc6f07bff, 0xca97f9db, 0xcf8b1f0f, 0xacd2f8c5,
+       0x1e1f989d, 0x7cc56d98, 0x3f3c69f1, 0xc1a0d036, 0x0fdd00b8, 0x85a23ee2,
+       0x97204318, 0x5cbb72a7, 0x45785b9c, 0xe0d6fe62, 0x7d45068b, 0xde7c513f,
+       0xe97982b8, 0xbf2c65c1, 0x6f7ec87c, 0x1f7ed056, 0x9cfc73d2, 0x93317744,
+       0x28f7dded, 0xe689fbea, 0x44fdf513, 0x7121ed0b, 0x32948a6f, 0xdddfbf9c,
+       0xbbfe9043, 0x9f58b96d, 0x88fa65ae, 0xa3e9837c, 0xbaa21cee, 0x399d691f,
+       0x94f31134, 0x46c15e78, 0x6ff83fc8, 0x9a7e0bf2, 0xc2fca926, 0xc9afe543,
+       0xf0e6dc2f, 0x5b3a02ef, 0x92cde458, 0xebd63d28, 0xd2987f99, 0x8108a6eb,
+       0x7cd6c574, 0x44dda7d8, 0xe4d2df5a, 0x02febd21, 0xa53275e9, 0xbd153cd7,
+       0x15fc61ee, 0xe82d2144, 0x0b4e8875, 0xfd00f3e3, 0x6edc60fb, 0x5befef47,
+       0x6fd35f60, 0x683cb0f0, 0x2f19d796, 0x59e0621f, 0x5c783320, 0xf3c22d5a,
+       0x0f13f43a, 0x4df0e5cf, 0x12a69d2c, 0xf1631fc6, 0x824caa4f, 0xfe6192b6,
+       0x6ffd9931, 0x7c43b8c1, 0xcfdb08f4, 0x6b5b808e, 0x739a7a45, 0x057f8b07,
+       0x802ecc2c, 0x1d1a5838, 0x7f1f267f, 0xdaafa74e, 0x4a66ed01, 0xfa610f0c,
+       0x167f850f, 0xdfd99faf, 0xb370798c, 0x63c775aa, 0x2f2120ed, 0x2e6ddc45,
+       0x7dab7f6f, 0xd2f20ea6, 0xe3aad767, 0x64ef735d, 0xb339b6f1, 0x25ccfdd5,
+       0x7cc13fab, 0x03aad24d, 0x53bdcdfc, 0xda49ff5d, 0x026c9c50, 0x710ec9c4,
+       0xe520d03f, 0xd7a3e013, 0xba6f1793, 0x84f9d287, 0x8095149f, 0x9486f0df,
+       0xd04f6dc6, 0x271bb3f2, 0x94f5f961, 0x28ff7eef, 0xc0296fd4, 0xe25c3572,
+       0xe056fb04, 0x8567ca43, 0xc8cc77e5, 0xc27d0049, 0xe087bdfb, 0xdfd9b77b,
+       0x73b6933d, 0x3cc5c94f, 0xd7ee6ad6, 0xeac85c18, 0xc6d2be6f, 0x52ef9552,
+       0x6d5c5fd0, 0x1d35f766, 0x04bb7e29, 0x73abaaf2, 0xd5e4b979, 0x243e5049,
+       0x3af7827d, 0xcab66b9c, 0xe92d0eb0, 0xb93ecfcc, 0xa44f0a50, 0xf276a978,
+       0xbcd99bfe, 0x4b9e4b6a, 0xaea93e07, 0xf64cfd62, 0x41e67654, 0x2c79cd3b,
+       0x26374b9f, 0xbf05fe00, 0x957df0e5, 0x5c7d2bb0, 0x3de4bc4e, 0xfb4491d6,
+       0x0f2519f5, 0x7157d14c, 0x664bdd8c, 0x7d03e765, 0xfc191cde, 0x2cbcd3f4,
+       0xb8cab6ef, 0xe1e40d3c, 0x297d7e2d, 0x2c6ecbcc, 0x1179043e, 0x65951589,
+       0x246da798, 0xfe94beb8, 0x3f03a7c7, 0x5649fd5e, 0x559d1002, 0xbe82ff4d,
+       0xafba0a66, 0xe537d356, 0x65e9c9db, 0x2adf9697, 0xd30d36fa, 0x3ef658f7,
+       0xe102ab85, 0xaf5a86fa, 0xc7138d0d, 0x8ee3f19f, 0x2fe03725, 0xc30efe56,
+       0x987c8bd7, 0x798dd901, 0x825da7c0, 0x38026f4f, 0x9e089af4, 0x3c96ca8f,
+       0x7180f093, 0x7a88c785, 0x055f8e2f, 0x33e0997c, 0x1709192f, 0x6ec2c9fc,
+       0xf02e7f65, 0x7af064a3, 0x38979dfa, 0xe3a2e187, 0x7a0e91df, 0xcf0611fc,
+       0xc995a966, 0x112fbe19, 0x311697fe, 0x7cf53edf, 0x1eeccdcb, 0xcbf83703,
+       0x3c527630, 0xcbee0869, 0x9f310758, 0xb3e7d700, 0x9e9b3e8d, 0x4736edce,
+       0xedcfd23d, 0x283aa354, 0xff74c25e, 0xd41e700f, 0x7ec1f704, 0x62f1216f,
+       0x47d29cfc, 0x6ec63d20, 0xe3c6f012, 0xb90c65a9, 0x789f3f1a, 0x5baf0cfc,
+       0xe29e0d24, 0x7cd0e1fc, 0xf19e732f, 0xaf4b8af6, 0xb93a5bf6, 0xec39d17f,
+       0xfa842c4f, 0xa0f6625a, 0xe123d13f, 0xda96af7e, 0x6ba7201f, 0x71fa086b,
+       0xfa0d569c, 0x321d8513, 0xff5c9f16, 0x6ab7264d, 0xf73f089b, 0x4f17e6c8,
+       0xe064a98f, 0x1ad6787e, 0x800b0d95, 0xaaac1bff, 0x56b50673, 0x4e788f16,
+       0x503211c8, 0xa87f7a06, 0x0fef423c, 0x8a1c8194, 0xf6ae7fbf, 0x3b7bf322,
+       0xacf84a2f, 0x032b1cf5, 0x19acefbd, 0x56790328, 0x14fef767, 0x13dc55d6,
+       0xbdcf8f19, 0x97911ae9, 0x1a745972, 0x0e2247cf, 0x7fe6c47a, 0x3fc63d39,
+       0xa08a5675, 0xcbb5759f, 0xcfe7e7ce, 0xd8767a01, 0xefc12a73, 0xaad8db34,
+       0xd138bb03, 0xce903fe1, 0x5f17e8e4, 0x9a17e6c0, 0x56de3c52, 0x66587fed,
+       0xee1e22c3, 0x81b878e5, 0x9bf3d9eb, 0xa90fb8b4, 0x0d3e16f6, 0x9bc0a0a1,
+       0xbe42123a, 0x147ea2f5, 0xa79dc6f7, 0xda185506, 0x7d436f3f, 0xf557f8bb,
+       0xb09b2718, 0x1894435e, 0x6431397d, 0x327fdd56, 0x5553a779, 0x5d37a2be,
+       0xbecafed5, 0x717d555c, 0xfeaa9278, 0x544b37aa, 0x54c8b2e5, 0xdfabfb55,
+       0xaf9552a9, 0x6aa19819, 0x3df403bf, 0x4e37e3c5, 0xffbd52cf, 0x37f4e368,
+       0x5d7d3e21, 0xefaa3bf4, 0x043f704f, 0x85237a09, 0x040bfe74, 0x53ac5ebd,
+       0x9acd4f7d, 0x7c0e54b0, 0xac16fecf, 0x95f77966, 0xfdb16314, 0xdb52ec2d,
+       0x28903713, 0x84b62be6, 0x40984f24, 0xbeba9dde, 0xf107afb1, 0x0f7ba97a,
+       0x6be6b826, 0xc69754c0, 0x22633b51, 0x0d5c8220, 0xf1638379, 0xbfd6a5fb,
+       0xa97fe480, 0xd5b837f5, 0xd4526feb, 0x54296feb, 0xa3cdbfaf, 0x0ac4ff5e,
+       0xbc3bfaf5, 0xaa4ff5ea, 0xb27faf51, 0xa9febd4f, 0x9febd573, 0xffaf57e6,
+       0xbaf506b8, 0xd7aab667, 0x7aa97b3b, 0x4b82735d, 0x74f1f554, 0xc849e820,
+       0xf795bccf, 0xa453dbaa, 0x42e86268, 0x5f02d9d0, 0x8d63e603, 0x35487aef,
+       0x4c7d3c5e, 0xf48f3c20, 0xe547d22b, 0x727f6e38, 0xa97aa0ba, 0xda325c6a,
+       0x73c03719, 0xff6e04ee, 0x33b746fb, 0xd58afc84, 0xe6fbb1eb, 0x08dae4b1,
+       0xd1f7c57d, 0xd82bea63, 0xf7869b47, 0xefd163d1, 0x59ea84bb, 0xfa357c1c,
+       0x33b0eecf, 0x999a0e38, 0x5429ff3d, 0xd1db435d, 0xde141536, 0x743e6177,
+       0x93cd77fc, 0x1df20fd1, 0x7183abd2, 0x7c1124ef, 0x7c5123ce, 0x755d89fa,
+       0xf10165be, 0x645fb9e9, 0xc9a9e009, 0x7a0e5038, 0xa3fcc2ff, 0xee7c63ef,
+       0xdd65d248, 0xe21c7207, 0x3909e33f, 0x49c9e5c5, 0xf2d10388, 0x27f71339,
+       0x8ae2897a, 0xee29e7c1, 0x269bacf7, 0x5a259ea1, 0xd5b1e633, 0x9ea12edd,
+       0xf60ffbaa, 0xf4c71f6c, 0x52e788da, 0x6e2ed781, 0xa13b301f, 0x62dd0e0f,
+       0xadf890fc, 0xec7a8f68, 0x3fb4deb0, 0x47f98716, 0xdbb17f76, 0x25dce0c8,
+       0x89c2b911, 0xdd7106c7, 0x7ce1fd61, 0xe0c8db9b, 0x4623a5db, 0xe264efc0,
+       0x31f0fb47, 0xd63c8a99, 0xefd624ef, 0x17f05cd1, 0x7e6fcd9a, 0xa9f21aab,
+       0xf472e0e5, 0xa88f7fdf, 0xb677f7fd, 0xffbfe84a, 0x3e9b851e, 0x1b8f76dd,
+       0xef28b2f4, 0x1e21b802, 0xfbe8ed00, 0x04ab7754, 0xadafb1fe, 0xb10f3dbf,
+       0xbfb25f76, 0x83087ea1, 0x3d60fe0b, 0x83367f85, 0xd281b7d2, 0x11efb6cb,
+       0xfbc61ff4, 0xa969c76b, 0x31fc8106, 0xc097bb1d, 0xfb67af2d, 0xbb1ec3e2,
+       0x7444cfca, 0x7a47380e, 0xf20e7b29, 0x9cc54fbe, 0x3474a0d3, 0x1fbafdea,
+       0xa47cb065, 0x44c8b6f6, 0xe39e4b88, 0xdb87d771, 0x56b2c4de, 0x265e60f6,
+       0x88e5f7dc, 0xa2ef5ef9, 0x4e7231f5, 0x63efd2b6, 0xeace8de4, 0x1e6bcbc3,
+       0xbc608b69, 0x25efc753, 0x5ee3347b, 0xbfc63fbb, 0x6e38cef2, 0xc4831927,
+       0x69b8429e, 0x4f4eff4f, 0x5a3f4023, 0x762a7cbb, 0xd3706d1f, 0xeef562fe,
+       0x1b1264c5, 0xf6d9587f, 0x88fdc20e, 0x6743f7e4, 0x36127c86, 0x641b7c51,
+       0xdf4d0338, 0xe511b86f, 0xaf76deaf, 0x1aa1ee07, 0xb7067f0b, 0x7e56217c,
+       0xdf8e387e, 0xe7e5c5cf, 0xc9d16d93, 0xdb7b4e30, 0x5d6f0a80, 0xfdf1176d,
+       0xc452369a, 0x7ac43fea, 0xf4828d4d, 0x42d28a73, 0xf27ae204, 0xc1fc0d80,
+       0x10263ed4, 0x8db9d67f, 0xb8306f18, 0xa2e4bc18, 0x9e63e90b, 0x3e00c19d,
+       0x1f4a4cbf, 0xe1d52fef, 0x4cbefafe, 0xefbfb62b, 0x780fe337, 0x29eadf29,
+       0xc37fb41a, 0x61c7867c, 0xf973d3f8, 0x0fbf6449, 0x5d3e80e4, 0xd38538c6,
+       0xf1d70b3e, 0xf027f6cb, 0xcc1137ae, 0x5a67d647, 0x5cb85ed1, 0x6a19dd38,
+       0x8fe3c7bc, 0xffe509e2, 0xf74f1c7d, 0x93fcc83d, 0xf04fddf7, 0x4a59053c,
+       0xe987caff, 0x87971c6a, 0xcf87c4a9, 0x082a36ae, 0x465eb00d, 0xed409fe2,
+       0x8d8bd211, 0x82a7e04d, 0x80ecaf7a, 0xaa2788d4, 0xb9e1335d, 0x1764e2a6,
+       0x6bdae3b0, 0x13c08b3f, 0x2f801162, 0xc109037b, 0xab98bc55, 0xf877c740,
+       0xd7813959, 0xe565cc27, 0xe89f5e44, 0xef4ce563, 0x0035520b, 0xcb471716,
+       0xca6f3ab4, 0x80bc7907, 0xfcf173b0, 0x84cd8d7e, 0x73ab0bcb, 0xdfd43566,
+       0x8b9cf049, 0xaf09ffa8, 0x5f1eb34f, 0x637a0799, 0x0dfbfab6, 0xd6a90f1c,
+       0x30d35de3, 0x17aea6de, 0xeb64acf1, 0xfbf137f9, 0x53fd7522, 0xf59b7bfc,
+       0xd41a647c, 0x7fc7abe7, 0xac5bd79c, 0xca8def2c, 0x037f767e, 0xd78c7faf,
+       0xc61ea09b, 0x5af5642f, 0x6f09df71, 0x18e1c9d7, 0x431e33e2, 0xbf33260c,
+       0x233696f2, 0xbf3c57f2, 0x73f707dd, 0x9bf30d95, 0xf519297d, 0x32fb86de,
+       0x5049dc98, 0x51debc06, 0x77a8a2e4, 0x37cc65da, 0x48f5bad0, 0x972b064f,
+       0x871f9c27, 0xead489e4, 0xe4c64461, 0x9ae8a5f4, 0x9005f012, 0x0ff4596b,
+       0xfbe33ae8, 0x918fe21a, 0x664de973, 0x83e58fe2, 0x39554e05, 0x5574cee5,
+       0x5cecd77b, 0x74b5bd55, 0xcc9eaa92, 0xdc9f2276, 0x5ccbe9cb, 0x17aaa254,
+       0x6d9065f7, 0xb59d9dbc, 0x554fe5d3, 0xa85f3bb5, 0x9f8d0224, 0xa3dc49ba,
+       0x7c8231e6, 0x9b96d7b8, 0xb3f8fc0a, 0x4e440ab6, 0xf627e53b, 0x1ba7f3b4,
+       0x54fa598c, 0xcb10b978, 0x7e583bcf, 0x879b7b7f, 0x9e087395, 0xab6f6faf,
+       0xca2ef2c1, 0x69fcf09f, 0xdb9f179b, 0xcfa15969, 0x2bfda47f, 0xda1e9fb4,
+       0xa19f943f, 0x3373c3fd, 0x3f9e1fed, 0xfd43fda1, 0x942fda06, 0xc170a69f,
+       0x0fda29f3, 0xed31ffbc, 0xb44fca1f, 0xb6bcb0f9, 0x1f962e6d, 0xf3e3f36f,
+       0x7c06b6b1, 0x8ad6d9df, 0x96db47e5, 0xb6e1f3e2, 0xdbdb3e20, 0x2f7d6256,
+       0xf9e793a7, 0x2be7dc79, 0xf103bdd9, 0x219fdfeb, 0x9d2fbb61, 0x154a539f,
+       0x3f2ab97a, 0xfc033fa7, 0xfceabd02, 0xc21fc054, 0x8c786261, 0x0668e387,
+       0x91270fb3, 0x930b72c8, 0x1f07181f, 0x6159e7df, 0xae35fca1, 0x4e7bad95,
+       0xd3eb145f, 0x4778d81a, 0x5c409db9, 0xce519241, 0xbb439b8e, 0xcaa45273,
+       0xd007f2c2, 0x14dc430f, 0x5aece53f, 0x21e64672, 0x5725c00d, 0x331e3d50,
+       0x397c21af, 0xb7809c18, 0x57fde0d1, 0x696d378e, 0xa75fbb2f, 0x6c0c2ba6,
+       0xe2b6f666, 0xb9c63afd, 0x9f4cb0be, 0xef1f9f2e, 0x717498e9, 0x5224dd3a,
+       0x9bf176f9, 0x8ccfa144, 0x31fef526, 0x6a89417d, 0xb8bda67f, 0xd1572886,
+       0xfbd48b7e, 0xbdfe733c, 0x198cefaa, 0xf5eaa90f, 0xfaaa15ae, 0x1e73bbba,
+       0xc73e0371, 0x6199b8b1, 0x210272f5, 0x4fdd85e4, 0x4ce65c20, 0x92738f36,
+       0x605f7ec2, 0x133dff37, 0xd6797fbe, 0x5c65f1ce, 0x09f2fb8d, 0x482c560e,
+       0x0f406a0c, 0x448bfc7d, 0x9e3b7f94, 0x7e9fa0d1, 0x40690922, 0xe6a64cde,
+       0x015fd424, 0xf16b8c37, 0x942d26aa, 0x85a2898b, 0x8a2455f2, 0x7fba3afb,
+       0xf5d264d1, 0x9ffad16b, 0xd9f2d131, 0x2cb3ff4c, 0xfa8c30bf, 0x67af80ba,
+       0xadc7d881, 0xdcfde397, 0x37f44cc6, 0x7625cfa9, 0x874bfdf0, 0x970df989,
+       0xc153ca3b, 0x46373e0e, 0x7dcda83e, 0x14058de2, 0x63b4b6df, 0x1fef14f8,
+       0x9ea33457, 0x94cbcfd7, 0xf75e5abe, 0xd44faa7a, 0xf307937c, 0xcffa5b38,
+       0x6b76e029, 0xff228fc9, 0x3c84e874, 0x9e411253, 0x893d970d, 0x3b1e6624,
+       0x93c9deda, 0x11fa2151, 0x375f326f, 0x4ff95f31, 0x4bc87695, 0xd179e02c,
+       0xf2d2db3b, 0x7f0fc7ab, 0x5074e3ef, 0xa0352248, 0x348b0b5f, 0xe074109e,
+       0x31fcabb5, 0x2f2efca6, 0x4b930b9c, 0xf2c40788, 0xf785d244, 0xd57fc829,
+       0x7c9a3e62, 0x50a21af0, 0x0d6ad8fb, 0x70d16093, 0x75fb84bf, 0xfce5cfbe,
+       0x9c6af667, 0xec259c8f, 0x74e80f26, 0x1bd599f2, 0xacfc3a01, 0xf4d8c75b,
+       0xd0bebab8, 0x2def504a, 0x1487d42a, 0xebcbee09, 0xe5407bc2, 0xc8c9122d,
+       0xb9a63801, 0xdf7e83e7, 0xb63a416b, 0x9fc72fac, 0xe359b830, 0x0efc40af,
+       0xc2357b28, 0x9aeda2e8, 0x82b7eb27, 0xf001393d, 0xdcbc0562, 0x430d5f91,
+       0x1e2217e7, 0x2f79f217, 0xc8e8f3e4, 0x833fc21c, 0x70bc7887, 0x6ea2ef1f,
+       0xcf528fe1, 0xaad2f1f3, 0xa2bdc36f, 0xff2d11ed, 0x3e352299, 0x5322e957,
+       0x70c34be6, 0x66173851, 0xb8015c82, 0xd80f82af, 0x919f9afc, 0x941cc6c8,
+       0x6f68356b, 0x3f306994, 0x9b2e9e3d, 0x8fdc9932, 0x7dd9d866, 0x4853eee4,
+       0x93e5c3cf, 0xc2482c6f, 0x5bb333fd, 0x8fcb326c, 0x58957af4, 0xe12af7bf,
+       0x72e7e45f, 0xa1de1ccc, 0xb127057b, 0x892b60bc, 0xb4bc87ac, 0x2bf5f6b1,
+       0xdc707332, 0xb53d7de1, 0xa53f205d, 0x5c7988cc, 0xa13e44ab, 0x69995472,
+       0x57384f63, 0xfa74e465, 0xf79d4da8, 0x6fcf9db3, 0x418f5f3b, 0xf27bc8a3,
+       0x9cc716d6, 0xafeba9f3, 0x88963f47, 0xff720ed3, 0x1d59a0e1, 0xa4e46d57,
+       0xaba87830, 0xc1f10cca, 0x6da7162e, 0xdd99bfec, 0xc7efbb6b, 0xed302f78,
+       0xa87a0153, 0x57ebede7, 0x0b58fdaa, 0x5f91fa77, 0xf164fde3, 0x398a317e,
+       0xe31fec3d, 0x335b62fd, 0x43c27ef9, 0x7b0e218a, 0x61de7562, 0x7277ec33,
+       0x1f0f9e08, 0xef017da7, 0x81bba6dd, 0x974fb82e, 0xa3fbb114, 0x54ffd7e2,
+       0xb2f11e96, 0x78efac53, 0x3ba5da2b, 0xd81c98cb, 0x2dfce079, 0x2b3f69e3,
+       0xf9d52473, 0x3a399580, 0x29b7a75c, 0x97b3c37d, 0xeed19a90, 0xa9943b29,
+       0xef726af9, 0xc1eff55a, 0x1c0df734, 0xff2828b6, 0x1fba035e, 0x4279fc3c,
+       0x1451f211, 0x08c4bf7f, 0xc19930c2, 0x76b3e70d, 0x17993e6b, 0x676f0f4b,
+       0x36ff58ca, 0x0d2f8ba7, 0xae1ab557, 0xa56f45b3, 0xfd7060cc, 0xb9c6e40e,
+       0x5894f1f0, 0xb5c0467b, 0x03df8c7b, 0xe2abf0f8, 0x1fad42a9, 0xfa74f062,
+       0x6ed3c3bf, 0xfcf0e8fd, 0xb3f3c395, 0x9b5eec43, 0x515ff591, 0xe1ab759f,
+       0x647cfb3d, 0x0a49880e, 0x7f115fef, 0x182993ee, 0xebf8e613, 0x59f4e52d,
+       0x078fe5ca, 0xc09150cf, 0x1e63577b, 0x924caf66, 0xbe5ca16a, 0x2cf77f00,
+       0x02c3ef93, 0xbf9e3f1a, 0x4619ef21, 0x64d77f95, 0x9ddeba31, 0x878a8d2e,
+       0xcf362cd2, 0xb2ea4703, 0xd8f1bfc1, 0x7202063b, 0xbfcf3361, 0x6bdecc7e,
+       0x05a67b84, 0x425ca11e, 0x747d019f, 0xc7bc2811, 0x2a333f4a, 0xd3c651d6,
+       0xc6d6f1b0, 0x4f188df1, 0x1564a73c, 0x3a557b32, 0x387385a4, 0x0b7daf6b,
+       0x5b5b7fef, 0xfdeca32a, 0x1d5ff8d2, 0x5bf0ff87, 0x7a30b729, 0xe1459299,
+       0x90fe916b, 0x0e5a6df0, 0x2a7fd148, 0xbd157c82, 0xa01fe71f, 0x4691ec78,
+       0x8b2d29e2, 0x9f988bd1, 0xdb80bf98, 0x5c02dd76, 0x06bbdb07, 0xbca51a54,
+       0x8917d0bd, 0xbcc1ff5c, 0x2b5c5f50, 0x654c73b3, 0xdafbae32, 0xee78a98a,
+       0x17cf376c, 0x1fa35e89, 0x164477f5, 0x763dbc70, 0xb811b7f1, 0xafd83947,
+       0x883ffbc3, 0x15bee03c, 0x8dff1fee, 0x5389f78c, 0xfb81aa7a, 0x391c0ecc,
+       0xebfb009f, 0x843a59f9, 0x87973e7b, 0x35b51783, 0xc8ec1e78, 0x0c6d7667,
+       0x6965d7fd, 0x89127db9, 0x35af39c0, 0x8b3cec25, 0xd603db95, 0x001b2723,
+       0x43c56b7e, 0xde862906, 0x10196566, 0x68fa35ae, 0x17f6878a, 0x6125a7d8,
+       0x7bc1ffe6, 0xb3ce8719, 0x5a1e19da, 0xbda10f4a, 0xf767ed60, 0x2965d635,
+       0xb852ce4c, 0xe6f7d2f7, 0xebd99f89, 0x8e94bea1, 0xbdfc3b97, 0xd3d6cecd,
+       0x4beec65c, 0x3fed7b5a, 0xc83ee1db, 0x471df844, 0x79f2efd8, 0x7292b80a,
+       0x48dfbc35, 0xcbf81724, 0x5abe632e, 0x235ef86f, 0x2f82fbd8, 0x62d5cade,
+       0x39f947bb, 0x0a2b4789, 0x4cae7043, 0xdb35b1d0, 0xcc1640ff, 0x0bc5f28f,
+       0x7c44ef68, 0xf63f10d3, 0xdf33c862, 0x32e64525, 0x076f443b, 0x68d42c3e,
+       0xe116fc54, 0x549e26eb, 0x73dda3fd, 0xa15da73f, 0x46423bf7, 0xfe4de702,
+       0x22667178, 0x191da7d8, 0x1af3dec2, 0x259b5f01, 0x8c0e625f, 0xdc5a2ff3,
+       0x72381e0f, 0xedc601bc, 0xbe02f3a0, 0xeb75f87d, 0x3a53b06a, 0x53e45eec,
+       0xd0ecbe31, 0xfd60f5f0, 0xdf7bd6ec, 0xd4647f04, 0x3acdeec1, 0x11867538,
+       0xd3b69fe8, 0xa07f3f40, 0x04f0f7fb, 0xfd1aa7e8, 0xb3ed0b06, 0x8b77c3a6,
+       0xb011ff88, 0x6b75176f, 0x3c83f755, 0xc2c5e5cc, 0x8e12168b, 0xac2c2fd9,
+       0x6b9e0ef8, 0x0131785c, 0xcfcc3fdf, 0xcfcc3fed, 0xf8e2edbd, 0x5f3f9978,
+       0xfb8afacf, 0xde9c4f6f, 0x8eddfe4a, 0xbbf7c63a, 0xa59afd60, 0xfaa83d01,
+       0xc73f5335, 0x687f64f3, 0x21b093b3, 0xf311de06, 0x98e1224c, 0x5dda8771,
+       0x52709134, 0xfa32faec, 0x15af9e1d, 0xe6d0ffeb, 0xdd8e3c46, 0x1e1538ff,
+       0x53cffb87, 0xff6471e1, 0x87ff5805, 0xf44bc2b6, 0xfe8c793f, 0x0ff05473,
+       0xef8f9bf7, 0x7bac1dcf, 0xeef942d6, 0xc6c57860, 0xf7e14b57, 0x7bf80cf7,
+       0xb7afa41b, 0xeeb9cf0a, 0xfa0e7822, 0x7a7ffd81, 0x1f52f21f, 0xc0f7aad8,
+       0xe8ba8318, 0x7a28cf3c, 0x83d89f26, 0x789cef70, 0x87959dbe, 0xdeff1ceb,
+       0x90ec8728, 0x942c6a67, 0x8ce7a0ed, 0x015a1224, 0x235297fb, 0xdf1139ca,
+       0x34fefd12, 0xb392ab53, 0x46a17ee2, 0x68d87f9e, 0x26aff161, 0xac2cffab,
+       0x574d12ff, 0x1f68cfcb, 0xf03b0ba7, 0x0e213b7c, 0xf888d7dc, 0xc5fb0c8e,
+       0xf97d703c, 0x9b0b9c08, 0x0cffe397, 0x1509fbbe, 0xd1ef102b, 0x0fcdb15e,
+       0xf38f79f9, 0xa6e3e47d, 0x2313db88, 0xf2d9753f, 0xba1bb357, 0xecb7e8e2,
+       0x8cc23b77, 0x40d9757e, 0xcfc8dabf, 0x7ce072eb, 0x67bf00e3, 0xb9fb414e,
+       0xde30f4ae, 0xfc275947, 0xf3e32b02, 0x601d3256, 0x54788b4f, 0x8217e402,
+       0xdd86b0dd, 0x616f5853, 0x275ffae5, 0xba17b9e1, 0x8114b21f, 0x65add99c,
+       0x071e22fe, 0x1e61cf3b, 0x02c9ae34, 0x7cf20efc, 0xaffdf397, 0xe7a7bde1,
+       0x3a478e57, 0x0fe5ffa8, 0xddc31ef1, 0x0d9f4ce9, 0x3ea1b3ee, 0xca7837ab,
+       0xddcd5ee1, 0xed6ecce9, 0x2509c395, 0xa3ec7631, 0xa7285519, 0x5e395e3f,
+       0x19271b13, 0xc2e4cd9f, 0x94ffe11a, 0xce70e5a3, 0xf0d2e3ea, 0xdd3ea13f,
+       0x1bdfc263, 0x53fdecd3, 0xbabfde39, 0x63bf80c6, 0xe277b551, 0x5fb0b9ba,
+       0x1f31904c, 0x84d7b35b, 0xc55d9cf0, 0x6f8383ee, 0xef35ee41, 0xcbbf871d,
+       0x62896f56, 0xd9b364de, 0xc1f10053, 0xc0dfbdfa, 0xf1389fdf, 0x902cc4f8,
+       0x9593c783, 0xfb6fbc2c, 0x3a748a71, 0x26fbe3ef, 0x579df7b0, 0xdb6ab9e3,
+       0x347f8b1a, 0x4bd088ff, 0xedcdf7f1, 0xd73e2f4e, 0x6899f807, 0x5e1c80f4,
+       0x675fe438, 0xbfd607f7, 0x24a59d19, 0xf306ffa0, 0xa7edea17, 0xeb1df7f0,
+       0x49dd8fbb, 0x42e93e30, 0xbcfb15fa, 0xb9eb71f8, 0x8faddafe, 0xd5df83ce,
+       0xf8e76fab, 0x59f7bfe7, 0xdfc629af, 0x5ff8149b, 0xf31f7713, 0xc5de38f7,
+       0x1911c4f3, 0x76a4b9ef, 0x8ff81645, 0x2037ec4e, 0x33589dbd, 0x1057ef19,
+       0x5853d5e3, 0x8f4f94ed, 0xb029953b, 0x15b20bbe, 0xb676ff36, 0xe9ef157f,
+       0xbdf811f8, 0x2d3ee8ce, 0xda0dafe6, 0xc71009a3, 0x7944ed14, 0x5afd3e68,
+       0xddb7bdfc, 0xdd7007e9, 0xa0115d29, 0x6d2fcd2b, 0xbf03b7a8, 0xf71bbf64,
+       0x82092971, 0x8ef8349f, 0x077bf701, 0x9ed019f7, 0x9d977c1e, 0xef711fcf,
+       0x059a359f, 0x7e06dcf7, 0xdae50e39, 0x0b746660, 0x784dbfb3, 0x51e0e4cf,
+       0x5e3cd5ff, 0xd1efc69c, 0xefbb034c, 0x18533ec2, 0xc4fa3eec, 0x6c9043b8,
+       0xfdfbe373, 0x882fbc16, 0x24f9d93e, 0x7f1b8f69, 0xf1748937, 0xfdf823ef,
+       0x09fe5903, 0xc81fa720, 0xe15bfda3, 0xeed893fb, 0x4affae42, 0x9211598c,
+       0xc74bc7ce, 0xd9fd337e, 0xccfa5ef8, 0xa80f7ecd, 0xb047d78b, 0x5ff0603e,
+       0xbdf8f38d, 0x328cf48d, 0x5f7aafcf, 0x49d97de4, 0x6e028eb8, 0x23b4678a,
+       0x93d2f1e3, 0x029ff6cd, 0x3974f11f, 0x80979eb4, 0x7832fc0f, 0xb63ec0bf,
+       0xea26ab8e, 0x9ce93c99, 0xde32f68c, 0x27931430, 0x07df7cb8, 0x3a839748,
+       0x97a0d3ef, 0x847547a2, 0x2d48c3dd, 0x5457f003, 0x16f576b0, 0x7010f7e6,
+       0x07e7e19c, 0x1e593b1a, 0x3ee799e1, 0x856f9ac8, 0xa81ff3f3, 0xff0bcfce,
+       0x0124ed21, 0x8f5633fc, 0xc4575092, 0xc22d76ec, 0x6e8f7ec5, 0xdfc14e8d,
+       0x3e3e0c0b, 0x2712fd11, 0xbc5ecaf4, 0x15d57607, 0x6d27a01a, 0x4fbf9731,
+       0xfb8979b0, 0x6d3dc4dd, 0xc81978f1, 0x99b2fa66, 0x3b82eff8, 0x25138ffe,
+       0xf14b0785, 0xff744abe, 0x52cd206b, 0x7e589af6, 0x9185ea3b, 0x2fea42f7,
+       0xff827bf1, 0xb053e5bb, 0x9f806556, 0xd5e80260, 0x7fb676d3, 0x40225bc4,
+       0x3cd96bbf, 0xb803e03b, 0x4ef882ff, 0x5bc45e83, 0x4e1e2825, 0x9e3eac4b,
+       0x1bbc84ce, 0x1ba00f81, 0xa3be17e8, 0x9d9e7f7d, 0x763ff6c3, 0x17943f27,
+       0xaa5e43d4, 0x490157d0, 0x0f7dc0d6, 0x024a1d27, 0xcec9e5d0, 0xc872e73c,
+       0x292871f7, 0xe076f6b1, 0x0e7bc110, 0x73ff3814, 0x922efc35, 0x05f80a77,
+       0xfed53b77, 0x5e787888, 0xfd401ca8, 0xc6985ff3, 0x800053c5, 0x00008000,
+       0x00088b1f, 0x00000000, 0x7db5ff00, 0xd554780b, 0x733effb5, 0x79332666,
+       0x84841e4e, 0xe4249840, 0x09308401, 0x0741410f, 0x68151048, 0x85280978,
+       0x42100793, 0x17b6881e, 0x240cdb5b, 0x41b45a20, 0x768bd151, 0xb4544140,
+       0x03414141, 0x58a50077, 0x56d56351, 0x880dcb6d, 0xa8311fbc, 0xadadff97,
+       0xfb5bf5ff, 0x90ce649c, 0xf9b7b5a8, 0x67d9d83e, 0x7b5ad7bf, 0x3bdaf5ed,
+       0x3f437cdf, 0x756109d7, 0x10f4422b, 0x116dce22, 0xa3109862, 0x42f382dc,
+       0x11c885d8, 0xca8df3fc, 0x5c3adb89, 0x8df88588, 0xdaf9aaaa, 0x2bc89eb5,
+       0x1f5c2deb, 0x774675e3, 0xb5f1bdf1, 0x28f250ff, 0x084c21b3, 0x5d3dfe87,
+       0x1e310f88, 0x90ea7b8d, 0x460ca7dd, 0x09ac2e1a, 0x75ac5442, 0xa51a45fa,
+       0xbacc4e6f, 0x4285e653, 0x5c6cc775, 0xe34ad899, 0xca2a6f96, 0x1fb29112,
+       0xd0aaf341, 0xea9e55e7, 0x0a8752cd, 0xeaa8f6d1, 0xebf684da, 0x6a8f9e55,
+       0xa51eb8f3, 0xdbd627ef, 0x9fa9cb5c, 0x273e7d0a, 0xc5d16b7a, 0x0ab794b9,
+       0xf280bdab, 0x45da2d56, 0x54782efd, 0xb177f62d, 0x81f7aa3e, 0xf80ba0b5,
+       0x3a894d60, 0x1ea8327c, 0xe39469d6, 0x7268f7bf, 0xc2fcd157, 0x63cc77e9,
+       0xd1f7e2a3, 0xd1f44efc, 0xfc7f21e6, 0x82b13093, 0x45daeaf2, 0x2bdceed1,
+       0xa1c27de1, 0x01727b45, 0x031eb95f, 0x18e3a19e, 0x7808bcf0, 0xbabd20c6,
+       0xabf04bc5, 0xa0f5487d, 0x4be6bece, 0x98df80d1, 0xae47453d, 0x61b5f7c1,
+       0xecda8c22, 0xcefe9c3b, 0x8b8f34ad, 0x3d4155ab, 0x193dd28a, 0xdbc68289,
+       0x2e7cf96e, 0x4dbf73e0, 0xd2917acc, 0x47a7b7d2, 0x46fd285b, 0x21f51fa7,
+       0x6a352709, 0xae7cf47a, 0x98b93edf, 0x9edcc7f2, 0x7aa082c4, 0x2ce9d63f,
+       0x6b655f14, 0x718d16ff, 0x78d8d62a, 0x2e5e065d, 0xbf341d62, 0xfe118d8b,
+       0x8b9704e5, 0x5fb8dbbd, 0xbf464f03, 0x4183c015, 0xa56f544f, 0xe38fa5db,
+       0x114717b3, 0xe1b4d35c, 0x64e82e9e, 0x2e3483c1, 0xe51f5bfa, 0xff7de675,
+       0x74780d71, 0x25969be0, 0x8f03fc0c, 0xbc6da44f, 0xde59be97, 0x93d10ab3,
+       0x7d78d0e0, 0xcbdf42aa, 0x850984f6, 0xda532bfa, 0x9c09288e, 0xac14fb77,
+       0x8c3cf17f, 0x9871f657, 0xf7c7e505, 0xf3c79f5e, 0xc12bc10a, 0x7a2bb529,
+       0x96d698bf, 0xdf8209ea, 0x736d3ec5, 0x7d06be79, 0xe79bce74, 0x4c37bb51,
+       0x4c5c5f60, 0x76467c23, 0xf801b1c2, 0x5df5c619, 0x6f6fa676, 0xb1d7e01e,
+       0x7ac8575e, 0xfdeb215d, 0x0b7d3040, 0x29ebc68f, 0x82cc24ff, 0xdc0fe5ef,
+       0x71a6e594, 0x8e3bdf8e, 0xce3c75d7, 0x75fd879b, 0xcffa953c, 0xe59d72bd,
+       0x733ad00f, 0x8d9d65bf, 0xb757c64e, 0x7b6b8ceb, 0x3acb7c42, 0x6874ea37,
+       0xab33f3ac, 0xfa8ada3b, 0x9cb155bb, 0x14fb6a8a, 0xcc8d7fdf, 0xd0d056bb,
+       0x0f4936b5, 0xfc236bb5, 0x6685d7c0, 0x6e7f04db, 0xf1a01f27, 0x583d27be,
+       0x8f8e1e98, 0x023c3f75, 0xea9f75f4, 0x9701b9f2, 0x9cfcef21, 0x57efc7f2,
+       0xb1f9025d, 0x0fc47e12, 0xc70fe02c, 0x73278b53, 0xb5cdaf7e, 0xb4f9fa82,
+       0x047f6ff1, 0x63dc5cfd, 0x5f5e0b73, 0x90b3fdf1, 0xaf82f9a7, 0xc66e5c11,
+       0xebce54b8, 0xd619ef57, 0xe8f17288, 0xbba65760, 0x0214be0b, 0xaa358ae7,
+       0x01d21f69, 0x3ed5e3c1, 0x3ac6e290, 0x8713380c, 0xa83a9acd, 0x4fc81e13,
+       0x9709d41f, 0x9ad0bb5a, 0xfb12fbf8, 0xfc414194, 0x9749f00c, 0x3cff44e7,
+       0xa2d2c7c9, 0xc873f683, 0x8ff942fc, 0xff48cf51, 0xcc57c1d2, 0x705178fc,
+       0x1950e09e, 0xc21c5f92, 0xca42aa37, 0xb7ca43ab, 0xf99cfaf7, 0x13f8e840,
+       0x31bee4d3, 0xc3aa58e0, 0x9145bb71, 0xc53ee47c, 0x2d7e89bf, 0x4bedbab5,
+       0x8e2ffe69, 0x4fd0f311, 0xae385599, 0xced97de5, 0x8ab52beb, 0x7c02b086,
+       0x633d70f7, 0x435fd4dd, 0xc3e51c58, 0x7aa21f25, 0x7941ec13, 0xf31adf83,
+       0xf0934f09, 0x5bc5d230, 0x83c78d9d, 0x14dd59e0, 0xeed7ca6b, 0xee3c6e4a,
+       0xc62fcce8, 0x6ff4c92f, 0x387ead22, 0xaa7f22e0, 0x8c1eb577, 0xb249fa20,
+       0xd469e168, 0xff83c5ef, 0x66eb9d1b, 0x262f0fbc, 0xe9a816fc, 0xf5a61d2f,
+       0x3d56edb6, 0x9befd09b, 0x5f11fcf2, 0x1b787a5f, 0x9bd9af7d, 0x7775ee21,
+       0x8e143fae, 0x8a5d7717, 0x17efa74e, 0x05c3d90e, 0xcda501c9, 0xd1ed63f1,
+       0x84babfbc, 0xbb875bbb, 0x6b05dfd1, 0xa094f46b, 0x6b44177a, 0x7a20d4f4,
+       0xa975dd29, 0xfc31e44e, 0x1f106a7c, 0x8f4f74ff, 0x2f7d2ab1, 0xb1af7dfb,
+       0xe9c74a16, 0x736fdefd, 0xe686b93f, 0xe61ddbed, 0xbef34cd9, 0x0b2ce6f0,
+       0xb3785fda, 0xea7f4f42, 0x4fb3f4e5, 0xb47e3153, 0x31bbd245, 0x293488de,
+       0x8e59954f, 0xfc1a313e, 0x699ed5ff, 0xe59d69f5, 0x2c829665, 0xad9b79e0,
+       0x7de62e6d, 0x95ab1141, 0xc67eceb8, 0xfdb9b9a5, 0x9f27dd85, 0xf4f87f00,
+       0x60053efe, 0x6776172b, 0x7e5469e7, 0x5921e3e1, 0xc2f7ea2e, 0xf01ec97d,
+       0xf7366d85, 0xeede994f, 0xdf60f289, 0x9c61fd1b, 0xf77fe825, 0xa435c355,
+       0x52f9cb1f, 0xe3934f3e, 0xce8294fa, 0xee2da37e, 0xbf028f5f, 0xb3cdbdf8,
+       0x7fa59299, 0x8b19e8cf, 0x773f61f5, 0xd5b28781, 0xe26dc261, 0xde782b27,
+       0x8763c2a5, 0x1172841c, 0xa2e55f44, 0x6fcfbf98, 0x405f7f34, 0x17df027c,
+       0xaf7f37ae, 0x5aab8d10, 0xfc8b7d69, 0xf682efe6, 0xfb112f8f, 0xe269f8da,
+       0xd6f17ef3, 0xf54cc26f, 0x0fe74f84, 0xa5c7e60e, 0xc7c11fb4, 0xfefc579e,
+       0x3defc015, 0x7433af2a, 0xd2d3cb5d, 0x448f1d78, 0x6b6e63fc, 0x598f5e10,
+       0xe0893584, 0x1c2ecc7a, 0x47e80549, 0xbeab9c08, 0xcdfe613d, 0xfedee4d4,
+       0x3296a55f, 0xe0b24bdf, 0x05c3b83c, 0xedfd47ce, 0x7e8a9939, 0x791756ca,
+       0x77e6835b, 0xe47de6d1, 0xdf5790e7, 0xf54d7e23, 0x37f58d8e, 0x1d79a58e,
+       0xd4f557bb, 0x33af3177, 0xe3f99f24, 0x28f71e09, 0xf2843fc2, 0x2d4c9ccf,
+       0xde9cbc21, 0x34b5327c, 0x3115fe98, 0x8d1e982b, 0xebc26694, 0xf489ac82,
+       0xeb05ad18, 0x89d7ad09, 0x0d7cf35f, 0xb1553a78, 0x787a2ba4, 0xe54f7414,
+       0x05577f39, 0x3d9acee4, 0x33e83f36, 0x0f17e362, 0x6cfa0adf, 0xda40b9b6,
+       0x2f547bb5, 0x5bb174e4, 0x1ce267f5, 0xba34fe6b, 0xeecce712, 0x68352e21,
+       0x170e74dd, 0xb0b97ce3, 0x596252eb, 0x1933f72e, 0x9eed44f2, 0xdfa03c87,
+       0x5cf1e6ee, 0xf1affa9a, 0xff99af3f, 0x20fdcf9d, 0x81f046f1, 0xc0b2278d,
+       0x3e0f89df, 0x99fd8697, 0x791db5f5, 0x83875a21, 0x2c7e68fe, 0x7ff45fbf,
+       0xa3a5f2c5, 0xbbfaf559, 0x349ec3c0, 0x07ffc33b, 0xcd026fcf, 0x7e73b12f,
+       0xe03d9f34, 0x6b3cc6cb, 0x9c766ddc, 0xd11d17b3, 0xb4a7e079, 0x89f989a0,
+       0x06e4f9fa, 0x289b2d7f, 0xee16bf88, 0x09c2bf9e, 0xf151a179, 0x6f280f40,
+       0x2adcf956, 0xddfaa0df, 0xecc29784, 0x213bf6bb, 0xe5443e9f, 0x3abc74d4,
+       0xa8b38fea, 0x54fbc2fe, 0xf8dbefce, 0x80da3fd3, 0x11360dd7, 0x47863c06,
+       0x63c7d26f, 0x3e916879, 0x37cd45bf, 0xb7a0569d, 0x013d51ec, 0xe51cdfb4,
+       0xd5b2f7c1, 0xf4c163b6, 0x50bf1f35, 0x2bd7f37f, 0xf81a40fe, 0xc2fcb984,
+       0x27ce9f30, 0x5c6fbe42, 0x027f7535, 0x89eb2b52, 0x72e6fc8b, 0xf34ebcfc,
+       0xdf7fd5a9, 0x17a6b99a, 0x29c173f0, 0xabf60b44, 0x1df595b5, 0x054d6811,
+       0xfeec2f1e, 0xac78152c, 0xb27ff57d, 0xebf81744, 0x51cd4fd8, 0x84222709,
+       0xc6e74b38, 0xfdd01637, 0x5dc5c9a5, 0x8fb17fd4, 0x6d5b17dc, 0x63905ebe,
+       0x8afc6ff7, 0xddc5c1f9, 0x17575f5a, 0x5fb9dbf4, 0x124b4e7d, 0x205380d2,
+       0xbae4da1d, 0xe484fb11, 0x1f417bc1, 0xdd4d569b, 0x6be77944, 0xa2424836,
+       0xf7923336, 0xfcc7f60b, 0x7d8d7ea0, 0x017c15b2, 0x1fc930e9, 0xe523ec5e,
+       0xbcbad584, 0xfb5f75b0, 0xe62ecce4, 0x26cd3ab3, 0x923edbcf, 0x2b4dcc6f,
+       0x9c874f0e, 0x0345f161, 0x75ebc21f, 0x157c1027, 0x97eabe9d, 0x3df0512d,
+       0xda723449, 0xfa71345b, 0x245a10b8, 0x0b8f0bea, 0x4fa21670, 0x7bc7e02c,
+       0x31abd79e, 0x8e89fcdf, 0xd06af03b, 0xf8562f83, 0xeaefd337, 0x63508746,
+       0x46b5ed20, 0xa0d451a3, 0x4beebfa9, 0x540fb6e5, 0x3ed49fd6, 0x2e3d3e06,
+       0xc8cbf7e0, 0xf8c131e9, 0x74b877db, 0xdeabfa02, 0xf52e7a49, 0x4d877e77,
+       0x5957a004, 0x3d50bf69, 0xec2fe1db, 0xcd4be069, 0x5cbc808a, 0xaf7c794b,
+       0xfaf5651d, 0x9792e083, 0x9a91e12e, 0xbb70c59e, 0x9a1ef560, 0x9573fa08,
+       0xdbd721da, 0xc04f970e, 0x2a4b6379, 0xfb5e63b5, 0xa4758f0e, 0x56b16f01,
+       0x9aab37de, 0x5c5b718d, 0xf62a3fe8, 0x436f9e03, 0x534445ae, 0xc28f86bb,
+       0x874c0cfc, 0x3a6143e4, 0x85021b5c, 0xf817770e, 0x14c289f1, 0x77ca8231,
+       0xcf3013a8, 0x1752aef3, 0x958b68f0, 0x9b308776, 0x9af40277, 0x78b8d8b0,
+       0x7a446fcc, 0xabffcf06, 0xcf3c25d8, 0x80bc48af, 0x7af241be, 0xbd0df231,
+       0x7d8655cb, 0x8fbc23e3, 0xfc721d6b, 0x9f2a3da8, 0x43a462a3, 0xbbefdbe7,
+       0xc89c68ca, 0xd024dabe, 0xa89f3183, 0xf00baf61, 0x858b1ce7, 0x3786b3e5,
+       0x2f80d722, 0xd21be518, 0xf819bd25, 0x75609958, 0xae3c7f81, 0x574ae7d3,
+       0x6820a3b1, 0x161eb69d, 0x0ec55e1d, 0xbdbb69c0, 0x97ce10f8, 0x738efa36,
+       0x54d27f73, 0xaa14f407, 0x273f4167, 0x64c768ea, 0x0ee9dfa3, 0x424177c0,
+       0x5bb478e9, 0xc2ac9628, 0x5eb85b7e, 0x3e208115, 0xe39360db, 0x211cb82e,
+       0xc73a4302, 0xe3f8405d, 0xf9a397f6, 0xd653837b, 0xfb92886b, 0x2974cee7,
+       0xd3d4ae2f, 0x83fa7ab5, 0xccc7baf9, 0xfec7cfd7, 0xe4a94b71, 0x53a677ef,
+       0xeb4ad5bf, 0xab268878, 0x80edda92, 0x973a89ef, 0xcd058408, 0xc6758af7,
+       0x38d0408b, 0x3b2ef51d, 0x183e2045, 0x47c66e1f, 0xb9237ae7, 0x125d44fc,
+       0xfefbb1c3, 0xec704c53, 0x04c33fec, 0xcffb2bc7, 0x7513f2e2, 0xffd1df39,
+       0x4ffa6ec0, 0xb3bfcd33, 0x5dfc7edf, 0x82fad2ec, 0x22eddcbf, 0xd374c07e,
+       0xbb2676ca, 0x7606fda2, 0x9871f12f, 0x95f7dc80, 0x0576cb53, 0xe96d87f1,
+       0x0b9f5d76, 0xfadf80a4, 0x6b4e3ac4, 0x8f1a5d77, 0x0be26ef6, 0xcbd0e76c,
+       0xcf1b456b, 0xfa02fc13, 0xbab648bd, 0x96977cb9, 0x98c8bd0d, 0xf33c8747,
+       0x859f48bb, 0x9ed841f6, 0x1f6347bf, 0x4db6b45f, 0xa9aa7d86, 0xde088d59,
+       0xfdf407d7, 0x17cfb631, 0xd5d7b079, 0xbdf11da0, 0x9c5dee9f, 0x84d4f80d,
+       0xde61e5b5, 0x2dfef7fb, 0x57c8e70f, 0xc5f7167b, 0x9f54adf7, 0x5b7b0fe5,
+       0xbfa8278d, 0xb3e5c27e, 0x9b4ce88c, 0xfa1ffdf5, 0xfa9eeb7d, 0x36c7985e,
+       0x2e483dd8, 0x56f659ac, 0xb078f1c6, 0xe083ef21, 0x16f8825f, 0xa6bb43eb,
+       0xdf2063a9, 0x0f32487d, 0x96ee87e5, 0x3ed0c372, 0x83496fc2, 0x2ce1f7dc,
+       0x619a89f0, 0xe1541776, 0x9616fcf0, 0x3987c3b7, 0x9f9f385c, 0xebc193ed,
+       0xc84e43b3, 0x78a2fb40, 0xf154e7a6, 0x1b6dc9af, 0xe04ff642, 0x68db350f,
+       0x75b56abc, 0xf78538f2, 0xa9f031d1, 0x78bfb79a, 0x135fd747, 0x8c5a9f81,
+       0x5f78f04b, 0x432127ef, 0x9a7a893b, 0xabbef5a3, 0x9b8cdea8, 0x1fa15393,
+       0x99fae895, 0x19404898, 0x1068fcc9, 0x9e5720ec, 0x7a0f52db, 0xc034d14d,
+       0xf0ec97c1, 0x981afce0, 0x71c91c22, 0xf4fed0d8, 0x57ee34a9, 0x2ec316e9,
+       0x03de60aa, 0xdf3d35f4, 0x2c6969ab, 0x38fe939f, 0x3b3fd1d0, 0xfbc325ae,
+       0xa30bf077, 0xdf3787fe, 0xe2eb483a, 0x79e430dc, 0x36e9bdbb, 0x3aadb3cc,
+       0x9847f592, 0xc9eed0f3, 0x2a02c39b, 0xc8b68aec, 0x3fe7d0d5, 0xb07b988a,
+       0xfee3c107, 0x83222d28, 0x799acdda, 0x95e42ac3, 0xa5eef1fd, 0xd692e7a0,
+       0xd3e7c0e1, 0x83262d4e, 0x6872afc6, 0x8969137d, 0xd968fbe7, 0x8be43831,
+       0x449e25e3, 0x2ee2a0f1, 0x53e72fe7, 0x0ff1c8a2, 0xe8496947, 0xf2d2c4a7,
+       0x66f855c4, 0x837b616d, 0xfdc1e868, 0x8a8bb79c, 0x037fe4ae, 0x75f4470e,
+       0x6b89b3ec, 0xf6fad32f, 0xd4f18dad, 0xefcb7cd3, 0x96b7399e, 0xe296f9d2,
+       0x9a6a80c4, 0x55d61677, 0x9be92be5, 0x79f3f24c, 0x65ef3e9b, 0xaeadbcfa,
+       0x1cfde0ac, 0x437aef3a, 0xc285f95e, 0x50ff20fa, 0xac5f15fe, 0x87ca5eff,
+       0x307d2e59, 0x20d6e70d, 0x3649db0b, 0x22ded384, 0x7d5df23d, 0xbed38f9e,
+       0xf7f1c473, 0x149ef8d5, 0x3d27db2e, 0x7ec3f16c, 0x37763c50, 0x9ac9e9e3,
+       0x634a8f48, 0x1db70895, 0xf0995072, 0xd9fc5cb2, 0x69edbf98, 0x661575a5,
+       0x6e01d768, 0xa92de2f3, 0xb43cf01f, 0x6f205381, 0xf8eb928d, 0xd7937916,
+       0x6cb85531, 0x3589942c, 0x531fc816, 0xf329725d, 0xa63fb915, 0xe30daf09,
+       0xd71a10cd, 0xbb05c3fb, 0x1fc4fa17, 0xbcd10ba0, 0x7f1f0a67, 0x9cfc2d9f,
+       0x5c022ade, 0x95a2c7ff, 0x89bc06f3, 0x4825e63e, 0x53d938fa, 0x8cdff865,
+       0x9117bf79, 0xad1967d7, 0xd923ca63, 0xad5fac99, 0xf9f0c1eb, 0xd14f79ae,
+       0xeff686e9, 0xfd83f43c, 0x99fa9d3b, 0xfec8637a, 0xe061ec2d, 0xf6dbf333,
+       0x877b4b51, 0x4c9914fe, 0x475eb870, 0xc5def5e9, 0xa9153fac, 0xf847c291,
+       0xfaa51969, 0xf21c7721, 0xa0484f2e, 0xb9fddc75, 0xb77e83d4, 0x843dbc5c,
+       0x46377fca, 0xd2dcf515, 0x64d4f2cb, 0xbdc99fbd, 0x9d869fc7, 0x2408b0f5,
+       0x17b9a50c, 0x8f5ed65d, 0x564ef9a1, 0x52c435b7, 0xa4de84f9, 0xbdf104c7,
+       0x5bb6121b, 0xd8ddd7a1, 0x627dfccf, 0x99df59ae, 0xc0551a24, 0x7350f279,
+       0x0f807dbd, 0x0c8ad7d1, 0x0188b7a9, 0xdfee8062, 0x47fbb963, 0x13ed1f7a,
+       0x0be1d92f, 0xbb433579, 0x3a5c7007, 0x18b9b3e9, 0x7ae55857, 0xd951de6a,
+       0xe48c779e, 0xdf9d2f2c, 0x84e8ebc7, 0x08f29308, 0x6e48a7f2, 0xcea67a40,
+       0x3a39e9cd, 0xa17e51e7, 0x67eb23ce, 0x7d803f14, 0x73faba56, 0xb772f02b,
+       0x6ef9c253, 0x761faa67, 0xc6a68ab5, 0xe55e98f1, 0x4883a6ae, 0xe3c503cb,
+       0x382ecc71, 0xd220e4b4, 0xb6f43bbb, 0x5fdd0e25, 0x5dbff3c0, 0xa3dbd3a7,
+       0x8834dea6, 0xbbedc9f6, 0xf6ebdfa5, 0x4da7533e, 0xc6de404a, 0xa8e8eef9,
+       0x3422b2fa, 0xa8cf22da, 0xb758cdde, 0xc1e8f9b7, 0xc9e75a78, 0xff3c11ba,
+       0x9e5e75d3, 0x09bad9ff, 0xa33dfe9c, 0x27ae39f8, 0x6c79673e, 0xd6a3b6d2,
+       0xe45faa14, 0xb7d8bc55, 0xdf857ad7, 0xdeb1744f, 0xf581cf26, 0x1f600e74,
+       0xf534198f, 0xe9303bf1, 0xda276d0c, 0x5171b8cf, 0x3c99c611, 0x7a8ac4a2,
+       0x2216bf33, 0x4e93ad3e, 0x8dee8bbf, 0xf8eb57f5, 0x6157bf3b, 0x1bdf9e78,
+       0xdf6cf0cb, 0xf9031191, 0x8ccee960, 0x6f89489e, 0x046f7a1a, 0xd97ed7e0,
+       0xff6df3c2, 0x8ef59c28, 0x774bf6d0, 0x7a89ec0e, 0x22df0967, 0xfb3cde48,
+       0x83b87ffc, 0x71b395cf, 0x027d5f4d, 0xc957f6fe, 0x39b248df, 0x5ff818f1,
+       0xd01e5eef, 0xce5d05cb, 0x02233d26, 0x6e8d5fe7, 0x427f0457, 0xb4b86cfe,
+       0x217f0ee7, 0x17f62c65, 0x9c1373c6, 0xb9191cc3, 0x7f7087c7, 0xfd467e47,
+       0x9258fcbd, 0xb9effa07, 0x63a48fed, 0xf34dadfc, 0xfa8c793f, 0xf8b7ef3f,
+       0x9d4e746c, 0x5e174d17, 0x2a7e1f05, 0x777bed92, 0x9c2f342b, 0x717b9bc3,
+       0x86b1473e, 0x2c39c32f, 0x73cfbcfc, 0x1975b714, 0x17aaadf1, 0x7a05ed1f,
+       0x30608d7c, 0x5b5fca82, 0xed7cc11b, 0xc8e79b35, 0xb8f7f432, 0xfbe9efec,
+       0x0bb63cef, 0x05d57de9, 0x65fa5277, 0xa1e31c46, 0x034581fc, 0x79ce9ed0,
+       0x3dfd4c91, 0x80128af7, 0xbad06abf, 0x69922b7d, 0x1c37837e, 0x34a2f4b5,
+       0x1ea529ff, 0x373ec0e9, 0xf9fd821e, 0x6e6e196f, 0x9a5b643f, 0xd96d829a,
+       0x75c9ffcb, 0xe59bfe7c, 0x9f75dc82, 0x3a25ed8f, 0x4a0183e5, 0x348d99d3,
+       0x8fd4b0d7, 0x6386340a, 0x6767af23, 0x6ff7b4f3, 0x49075815, 0x8977981e,
+       0x91e7c3dd, 0x7811b7df, 0x78e5af3e, 0xf62bbf58, 0x3b7a0a3d, 0x707a25af,
+       0xfa4cbd3e, 0x7fa8d5fc, 0x7cebcac4, 0xa2f7a9e5, 0x2189df61, 0xbf09d93d,
+       0x78db7e48, 0xe3eeafd4, 0xf587f016, 0x09fae279, 0x8ecd4f80, 0x9fb91b9d,
+       0xfa07872a, 0x4bcec56e, 0x2f205307, 0x993c20de, 0x321dc7a0, 0xaf42abff,
+       0x56a5a547, 0xe652fc6c, 0x5f398a5b, 0xfc27da4c, 0xca4ca2fe, 0xe7e88f49,
+       0x63cd68a0, 0xee24c97e, 0xafd7c4ee, 0xebe518a8, 0xb0c97cd3, 0x27e71b6f,
+       0xfda97b9d, 0xb2ec65b0, 0x5bd8cb7d, 0xdf2e1953, 0xebb3dcf3, 0xdfd197e7,
+       0x73e17623, 0xdf303f52, 0xc1be9ec0, 0xcdebcf2e, 0x2f4067c4, 0xe34d79c6,
+       0xed93f5e6, 0x29afe0bd, 0x076832aa, 0x91e523c1, 0xbe379630, 0x62b3f8ef,
+       0x6df9f156, 0xe1b55bc8, 0xd9f22f92, 0x885fed41, 0x37eeaed2, 0x7932760c,
+       0x3bab0bde, 0xe3c8f217, 0xfa6bde51, 0x96d5bcb1, 0x39d0358a, 0x53e61d7a,
+       0x95fc92a3, 0x457f2411, 0x73af7dc6, 0x2de51034, 0x5beffb42, 0xcd046c7f,
+       0xf1290633, 0x86a468ef, 0x485a45de, 0x7d39fc97, 0xf3f8135b, 0x3f926143,
+       0xbe610d47, 0x7433ac64, 0x07c4039c, 0x6f3be234, 0x11a339d0, 0x3917183f,
+       0x7d78cac6, 0x907552dd, 0x3922e5ce, 0x1ada0802, 0xdef3943b, 0x61638228,
+       0x2eb42aa4, 0x252347f4, 0x3ac7cdbc, 0x984427c7, 0xc42515ea, 0xbf8fb1da,
+       0x1d55faef, 0x3cb86a4f, 0x8370d4bf, 0x7413babf, 0xfac87dbf, 0x776f7ae5,
+       0x3abe630e, 0xeb7ef956, 0xdf15b22e, 0x8b8f3c09, 0x7373e7cc, 0x2394e45c,
+       0xd475e09a, 0x7ae87be1, 0x1c25d743, 0xfa8e4fdf, 0x167c2289, 0xedcfc7ec,
+       0xb66b776c, 0x5bf73eb5, 0xa2f36b82, 0x47ec0f5c, 0x70bed32f, 0xb54e9f80,
+       0x0cdb9cb3, 0x37ea92d9, 0x5c7170f7, 0xdfba6bcb, 0x6f5b37dc, 0xbe7c14ef,
+       0xc5eecf34, 0x615ef47e, 0x48ec1034, 0xd26fd2f5, 0x16f25b6c, 0xe5e6ebce,
+       0x819a1e29, 0x69efc150, 0x97e47ccb, 0x095ebcfc, 0x817f0adc, 0x40bb73ef,
+       0xfeb175fd, 0x5f94e9d5, 0x9e0c8bf7, 0x8fa447cf, 0x8abc62d7, 0xeb5be670,
+       0x71c9bd62, 0xff979f04, 0xb279f2a1, 0x91f29f2e, 0x6ed9d7cc, 0x378a6eb3,
+       0x04ad7e19, 0x36eb6f1d, 0xb05ef2ca, 0x4d3ca293, 0x26c4ffb6, 0xd7a2dfeb,
+       0xfbf1d04b, 0xb4a74eb1, 0x683f99ff, 0xa0ac2393, 0x95fb77ff, 0x46fbc6be,
+       0x17e19378, 0x933cac7a, 0x54b7986d, 0xf4c690de, 0x66d3dba4, 0xe8dcfce9,
+       0xc31c0d17, 0x9fcb4f21, 0x3b37f3d9, 0x2a33df41, 0x1f21479c, 0x22b1547e,
+       0x0cfd7a0a, 0x21840d4d, 0x917a6abe, 0x4bae43b7, 0x395eb8c7, 0x1fa1b96e,
+       0xdf00ca06, 0x710e6dbd, 0x81ffcb2f, 0x96fac121, 0xfa45e781, 0x1a6eadbe,
+       0x7eb060f3, 0xfe27695d, 0x72e51833, 0x6a45573f, 0xd57d07bf, 0xc1e1baee,
+       0x54fbbd60, 0xbc7943f9, 0xcf71f4ef, 0x3c1f79d5, 0x6f39099e, 0xb8c6a702,
+       0xf011fa1d, 0xd5f6fd49, 0xefda73cf, 0xdaf00b3e, 0x92fa94e4, 0x85e3edb5,
+       0x359faf94, 0x09f7cf80, 0xd85e1d53, 0x8477daf5, 0xadaf61f9, 0xc5ee159f,
+       0x44f7eaba, 0x985761f9, 0xd21befa7, 0x6fbbf8bb, 0xade98dbb, 0x667feeca,
+       0xdaabb50b, 0x89e99fdb, 0x96ed95e8, 0x642357be, 0x6d37b479, 0xf79450e5,
+       0xcd79fa64, 0xf2e18ee6, 0xe5c15537, 0x58ac81e1, 0x539b7782, 0x1375853b,
+       0xbcfdb2bd, 0x1fbf2eca, 0xfa12e9d1, 0x96fffb25, 0x42bf7144, 0x8f3f6bcf,
+       0x584f7d67, 0x91f3c9bd, 0xaf207dbf, 0x7dcbb347, 0x7ea46a21, 0xe725c478,
+       0x9e39a475, 0x8f4185f7, 0xdcb78a47, 0xef809593, 0xfcd2af24, 0x0d4cb2fe,
+       0xd06e1fc0, 0xf2f5329f, 0xbb5157db, 0xd9555f4f, 0xd7e7336f, 0xfbe30f8b,
+       0x13d5159c, 0x6bbcad39, 0xf5cb9f32, 0xa2eea71f, 0xa7a984f2, 0xe06bbfd8,
+       0xd9954e7f, 0xe9989a9f, 0xdf813355, 0x83f6ff5c, 0xd9e1ff54, 0xaf001627,
+       0x473533c3, 0xf6dbec26, 0x4cff97d6, 0xfe5d6df3, 0x36a3d627, 0xf8116b44,
+       0xd3f7717e, 0xc566bf5c, 0x7e802cff, 0x74956350, 0xb5db9c63, 0x91bf3d3a,
+       0xffa2c5a9, 0x63bf15aa, 0xb722223d, 0xbbd7f245, 0x3a3f1fbe, 0x65f9bcd3,
+       0x0e2dda85, 0x54e1ae6f, 0xfce1e7f5, 0xa204ab3b, 0x2b860c95, 0x5ce775eb,
+       0x47e06881, 0x72b948b3, 0xbf10d6f1, 0xa8925031, 0xdda88bdb, 0x8f5526e2,
+       0x41dbf457, 0x17f5a1a7, 0xf7ae77d3, 0x8a57bf3d, 0x763df926, 0x30d7fdd7,
+       0xfe0045fe, 0x64cf33ae, 0x9c3d026e, 0x5674f9df, 0x34369fb0, 0x72be72bd,
+       0x7df4e7fd, 0xd8be8e73, 0xc2db6f40, 0x0b85f64c, 0xf4eb24cf, 0xc2e9e926,
+       0xe7ecd933, 0xd9f7d44e, 0x0967c505, 0x085fbb47, 0x9e10678e, 0x971ce1a6,
+       0x0e1a6de3, 0x9d61fbb9, 0x6f8e2e2f, 0x67be0e1a, 0x68e141f0, 0x41bb63ca,
+       0xf41e534e, 0x8a7f8364, 0xfe2ca6e2, 0x42ca6fee, 0xd22d97fb, 0xa7cc630e,
+       0x8e14b9f2, 0xf0b5a27b, 0x6e7caefe, 0x8de426e0, 0x929dea71, 0x253bd4ef,
+       0xb75d097f, 0xe8ed2996, 0x1ee64fa4, 0x3ea4b3a7, 0x5c82f496, 0xde6593e4,
+       0x370bf329, 0x6fe1d894, 0xbcc9b7af, 0xfd897d6b, 0x35f7e618, 0x4fc4b569,
+       0xc5bf7473, 0xdda97f02, 0xfafefb0b, 0x3f1ce1e5, 0xcf3edb31, 0x7af6694b,
+       0x035c69bb, 0xe6fdfd0f, 0xf9f48bef, 0x0b890df4, 0xedb6a5ea, 0xf639c30b,
+       0x8e32e8a4, 0xb4a64960, 0x6cfb3ee3, 0xaa917c47, 0x6dc2dbeb, 0xea5ba1d0,
+       0x8fd78c1b, 0xef5e06ed, 0x2ff9a148, 0x5ea5e3d6, 0xfab848b6, 0xe37c959e,
+       0x052d7ce5, 0xc005d5e7, 0x2c5ce71d, 0xef2173e5, 0x7919bc49, 0xf0a15f03,
+       0x82f1f15d, 0x9f95d814, 0xc7f694c8, 0x8f2c7c50, 0xe513de1a, 0xd4cf5c06,
+       0xdc00ca1d, 0xa89d758d, 0x68e97af3, 0xafbfb4eb, 0x8c6877cf, 0x30477c8f,
+       0x1d6fd77d, 0x20248872, 0xd5ab6e71, 0x5bd42583, 0xbf43f7fd, 0x36aadfa8,
+       0x3b9704f9, 0x91739780, 0xbd41dffb, 0x0b621b05, 0xed180fa0, 0xf22fae17,
+       0x7bcd0796, 0x5e3356e0, 0xf3993506, 0xf3997783, 0x0d06715b, 0xe5dbe7fb,
+       0x21f9cc07, 0x93f9cc87, 0x3371dc1f, 0xea854fb6, 0xbe855fbb, 0x87f1e7f3,
+       0x7a9f4e70, 0xe06895f9, 0xcb5ff16b, 0x0b8f420f, 0x3c21678d, 0x7c73d02a,
+       0x97a6145b, 0xba5ae22b, 0xdc4643e1, 0x30627606, 0xdf0a54dd, 0x95da6b41,
+       0xa68acff5, 0x6744bd9b, 0xcfdecb55, 0xecb37a90, 0x5ad36477, 0xd0cee43b,
+       0x3be3bb71, 0xc6ebd222, 0x21192a3e, 0x365eaecb, 0xfe8a7c4e, 0x1e37bcd6,
+       0x2bf258f4, 0x929be585, 0x075fb297, 0x3edd1cdd, 0x6f4e46fb, 0x30f0c09e,
+       0x9b0b92ec, 0xe5144095, 0x8744235d, 0x8bf11f7f, 0xf1210da5, 0xe2426b9f,
+       0xcb99d682, 0xf7daee17, 0x504710ff, 0xe38278e1, 0x678cae2e, 0x5e801ff4,
+       0xb04a7959, 0xa9f2aa7d, 0xe5ccc26f, 0xf5f35d72, 0xade71875, 0xf1cb5df0,
+       0xaacb577b, 0xa3fe38e2, 0x4ba8e973, 0xcb73853b, 0x5eaf7738, 0xf29551b7,
+       0xfd84b7bc, 0x8e7691c8, 0x8876ac8b, 0xebcd0440, 0xebdd9450, 0xd697efa2,
+       0xb2bcb147, 0xe85ce480, 0x270a948b, 0x627a4dc7, 0xbbc4eed0, 0xd565cb2a,
+       0xd51e12f1, 0xb0fc51bf, 0xa8c3571d, 0x3293fc8b, 0xd80448bf, 0xf23a0bbe,
+       0xf803ad06, 0x468bce0b, 0x59565fa9, 0x9f00fb03, 0xab68738e, 0xad155eb9,
+       0xc838a3f3, 0x35efe67b, 0xd7eb8da2, 0x2c26faee, 0x3d907bf8, 0x435ef59a,
+       0xf97556ff, 0x3865fd4a, 0x20744fcb, 0x6cbe8384, 0xeebedcba, 0x6823921e,
+       0x7b0d2b7d, 0xdf295af8, 0x9e51b2dd, 0x679f2463, 0xd6eb4e01, 0xef867c92,
+       0xce206fa4, 0xf70a2c44, 0xea5ef94b, 0x6766eb0b, 0xf2f45cb1, 0x400a5e3f,
+       0x487b691f, 0xbad2bb61, 0xbaefd97c, 0x3973fafb, 0xe3c2a7f8, 0xb61cb184,
+       0xde518a6e, 0x4f91f587, 0xc864c530, 0x1ef7faf9, 0x4bdefe6e, 0x3ec166f5,
+       0xb2741e22, 0xfb90c47d, 0x2ebeb90d, 0x1ac9cb56, 0x75feb9d6, 0xf0516db1,
+       0xf88a89bb, 0x6cb725ef, 0x36e3cfd6, 0x2afc3f5a, 0x83e295c7, 0xf5198ff0,
+       0x73c96646, 0xef58f865, 0xfb1ebd16, 0x532dca5f, 0xe68ebdee, 0xc5b0fe55,
+       0x81a17b0d, 0x66f5e107, 0xd7c70e01, 0x77400b3a, 0x7b4ac7c3, 0xc97c91d9,
+       0x0a8623e7, 0xab1a378e, 0xcb363bf7, 0xc2934a62, 0x9fa91e89, 0x1ed245e3,
+       0x98b4351f, 0x132496ed, 0x6e2aebcc, 0x4fdeb265, 0xf7f8bdb9, 0x4f98bba3,
+       0x4a145d07, 0x6df8fbf9, 0x2f3926ca, 0x0e27c72f, 0xf6c9c07f, 0x39fae3ce,
+       0xe881e064, 0x0fcb1868, 0x0d8b5f3a, 0xa0b59ba1, 0xa0879c07, 0x6e982507,
+       0x8b7174cc, 0xee2be122, 0xbaf7f293, 0xe8379958, 0xf13ff482, 0x229ba0bf,
+       0x4eeff0c1, 0xdbd6340f, 0x74481e9d, 0xd07408b0, 0x0e842f51, 0xec3fd584,
+       0xa542fcdb, 0x2b876223, 0xab148284, 0x17ce21f0, 0xebc32467, 0xb11fab1e,
+       0x12adbd78, 0x92ac7d2f, 0xf1b4e8ee, 0x7d701785, 0x4b7de22f, 0xbc285c1e,
+       0x4524bf54, 0x1fad7db0, 0x713155c9, 0x45204edc, 0xbb0a8e58, 0x5f68a513,
+       0x2ffb2312, 0xfe3829e9, 0x5af3fa8e, 0x36e674e2, 0xc15efe1c, 0x47da0572,
+       0x9f7b7017, 0x5af7b645, 0x219bed29, 0x95b698f5, 0x5cbf1c61, 0x2c9f7772,
+       0xb1c4c9d0, 0xa2393a66, 0xde9195d3, 0x8dd6ed94, 0xf0249e75, 0xfe86d283,
+       0x3bd4de7c, 0x0277ab8b, 0xb047cf9f, 0xeab259fc, 0x618693c7, 0x7bc42f7e,
+       0x9333c280, 0xa83fb3b7, 0x4ff661b4, 0xb4be843e, 0x2bdfc9d5, 0x59f5b5b2,
+       0xf715ff90, 0xa1f49ddc, 0x7b01c674, 0x9ad7b512, 0x957f9ca6, 0xedbec9d2,
+       0x989e40ef, 0xfae55d3c, 0x3fb48593, 0xce39068b, 0xd6e7df24, 0xd26fea24,
+       0x69c38528, 0xa95d3a8e, 0xa40fc1b7, 0x2ca9f7e3, 0xe47f9745, 0x5592813d,
+       0x73d2b27d, 0xc9213fe1, 0xfd390bb8, 0x18fea353, 0xa5e40365, 0xfee4e3be,
+       0x1fa3ea33, 0x4b3a7bf4, 0xd5bf55ca, 0x09e462e1, 0x7cbf5cae, 0x8cd1d875,
+       0x40b6a468, 0xfde9a536, 0x7584bec7, 0xe3174c4e, 0x77ee03d7, 0xcf1362aa,
+       0xf984adb7, 0x1b965442, 0x4291abf4, 0xd6e3facd, 0x8f27ccfe, 0x7a3b698e,
+       0x6e8fe537, 0x8ced241e, 0xbe617dba, 0x707cb04b, 0x77e48c74, 0x98239b6d,
+       0x5ab88ffe, 0x3da4e2a3, 0x650ded8e, 0xb67c493a, 0xf87efeac, 0xed22cbb9,
+       0xcc7e7147, 0xc71a687f, 0x53ad9427, 0x07b86103, 0x6f6cc6b0, 0xded48aa8,
+       0xb5087ec6, 0x07da841b, 0xa3a03340, 0xd30a35f2, 0x8f7adf61, 0x9cf9993d,
+       0xcafac2e2, 0x70fd0323, 0x9c7b940e, 0x857cc71c, 0x826be0fd, 0xb9d870fb,
+       0xb5890705, 0x009f6b67, 0x258d254e, 0xe446efac, 0xfabfcc6a, 0xec1704aa,
+       0x26fe9d17, 0xbe0b5ec2, 0xc64d6d64, 0x9655fcbe, 0x3130f19b, 0xc91595ce,
+       0xfbe4ed74, 0xae6d4711, 0xe8efcc2c, 0xe705a74a, 0x9215c4ed, 0x39df69be,
+       0x1ee18f70, 0x3f0708ab, 0xfb259ad8, 0x5adcb39d, 0xbdf291bc, 0x151ac21d,
+       0x67cafa07, 0x5fd85efa, 0x75e62dfb, 0x046217ea, 0x35b289e4, 0x74bce56b,
+       0x96d610fa, 0xe71a78c2, 0x02b4e6d4, 0xe43a01d8, 0xdb63fedb, 0xba0ec701,
+       0x3d30ae98, 0xc10e7ad0, 0xbfde9c8e, 0xe9ca32f4, 0xcbd03efb, 0x7e81b1c4,
+       0x522f1b88, 0xb6be38ab, 0xe078493d, 0x6d176c77, 0x93b48f2c, 0x67be023c,
+       0x9f8319f0, 0x1d785d10, 0xdef89d89, 0x22534752, 0xceb5be1e, 0x75b3e9c1,
+       0x7825612e, 0xe24bab6f, 0x6e750bfc, 0x72ea9b4e, 0x758bfbf8, 0xa8efce1e,
+       0x97f9c11b, 0xdf9cbceb, 0xd3813755, 0xf98aeb57, 0x08afc1bb, 0x0c97cc3e,
+       0x27f063be, 0x3e0cbe83, 0x73574a15, 0x17b8cc09, 0x1f99ed41, 0xeb107c1a,
+       0xf27414b0, 0xe9cf0327, 0x092fb14a, 0xceb450fc, 0x5228ff06, 0x0aff3dcf,
+       0x22bdb9c1, 0xed22ed92, 0xf6c1f242, 0x079f0748, 0x0bb176a9, 0xdbfa89f6,
+       0x0eef47bc, 0xad6f873a, 0x88358450, 0xc4bc7f8e, 0x7441ac29, 0xac596f3c,
+       0xd9673f29, 0xa4f46ffb, 0xd18ddffe, 0x1e69b372, 0xe2797e47, 0xf7d13ff1,
+       0x4cf2fcdf, 0xf34ef026, 0xc608fcd8, 0x9f5c2bbd, 0xd79cab47, 0x9796765d,
+       0x7d4b86fa, 0xd4b86fab, 0x08e3f0b7, 0xa23dcf8a, 0x2d24a3e3, 0xb1a79df6,
+       0x9baeec6f, 0xb44ec047, 0xfa4bde52, 0xf2a3f804, 0x2bf8e8bf, 0x70c6165d,
+       0xf7d06d2d, 0x36dc706b, 0xb258f5c1, 0xf14ef960, 0xd7bf010a, 0x03d85fb1,
+       0x63882b24, 0x40afc38a, 0x6be52276, 0xab98ec0e, 0xe411f77f, 0x21d96576,
+       0x4735b396, 0x087fc724, 0x705ced9f, 0x83b2ca7f, 0xf6b44f5c, 0x466fc536,
+       0xc1daf50c, 0xc0e34037, 0x7ece695f, 0x1a2efd81, 0x547fbe15, 0x5f2f7fae,
+       0xa2e298ad, 0xf2ab6467, 0x959645de, 0x4259f3d3, 0xf91a473f, 0x96e832bc,
+       0x61c708f8, 0xdbe63796, 0xe7f10417, 0x597bfd52, 0xa714c58e, 0x9d967f79,
+       0xcd8f39fb, 0x9bdefd49, 0xcf9f6e93, 0xf7cdcffc, 0xa5fa8c05, 0x60ab0539,
+       0x835d2e4f, 0xf6cea6a8, 0x7d56d925, 0x7fa92e5e, 0x8b5ce839, 0x2ea2f8e2,
+       0x9e4307cf, 0x475f8539, 0xef59fcf2, 0xb9e17caa, 0xac8fe017, 0x9f1873fc,
+       0x75839553, 0x7fae4afb, 0x839634f8, 0x70ca91bc, 0xff12e1c8, 0x35fdcf85,
+       0xb55d711a, 0x97bda43b, 0x6b48a3d2, 0xfb60aaee, 0xf6878d5e, 0xadf81c49,
+       0xfaffefd9, 0xfbe67f0b, 0x14b0849d, 0xe3986e3d, 0x7c766ad4, 0xb06bf1ca,
+       0x7286f9c7, 0x1d5f1c7f, 0xf956beda, 0x4257f59a, 0x68a7c32c, 0x3c8997cf,
+       0x12979d8f, 0xf76ae7c1, 0x2aec4cac, 0x1fb4288e, 0xb0c1ce23, 0x358ad5ff,
+       0x59cfc39f, 0x9384d77b, 0xff65de92, 0xca1eeda1, 0x31384a8e, 0xeec62050,
+       0x5893b62a, 0x2c9fc705, 0xed38edd5, 0x63f64cfe, 0xd7772777, 0x2446a7ae,
+       0xdd5bb592, 0xbeb38831, 0xae84c428, 0xb649f4f0, 0xd3cf6b94, 0xfb3f823e,
+       0xe59536e2, 0xa2db8bca, 0x6cd43f78, 0xe220f07b, 0x529e6b04, 0x2d58edd8,
+       0xafce385a, 0x1c2a8766, 0xec1de7c1, 0xcfddf147, 0x5173f173, 0x8b5f404b,
+       0x66ef149a, 0xc3bb4f9a, 0x6823d31d, 0xbe80af3e, 0x87173488, 0xff470d35,
+       0x079ffcc6, 0x37920b7f, 0xc83f3517, 0xef548df1, 0xbf37cb02, 0x3c38e08d,
+       0xc1dec93a, 0x186ecf3c, 0x45f5fec2, 0x586bdb4d, 0xe116d83e, 0x8ce9e982,
+       0xe40f7ccd, 0x81de3e80, 0x9c8f296c, 0x67d1edd5, 0x1f59505f, 0x2fb13cc2,
+       0xb871e8cf, 0xf537bb46, 0x4b666f76, 0x5b26a7f9, 0xfea34fee, 0xd1a3a6a2,
+       0xc9fea8fd, 0xfa73ef5d, 0x166fbebe, 0x3df0b645, 0x223b93cf, 0xc9e09ef8,
+       0xfe39ff1d, 0x7cef1a35, 0x250498d3, 0xc89d9f68, 0xba7dc9b6, 0xf32fc641,
+       0x13d61725, 0x673d789a, 0xac28a5b7, 0xa4de032f, 0xf1dd9fb7, 0x3643df12,
+       0x1c1febe4, 0xb14b382f, 0x18a3dc86, 0x8d72083d, 0xd7bf55a3, 0x63dba6d1,
+       0xaffa6ffe, 0x5927bfd1, 0xe471f58a, 0xc4610d3d, 0xbd64b86f, 0x27b73522,
+       0xc1dcddf6, 0x97b899ee, 0x7192de2d, 0xfbb7a297, 0x737fe811, 0xbb678ddf,
+       0xbb9b52cb, 0x1c5ff227, 0xe0958526, 0xce887733, 0x875a9257, 0x347bbec1,
+       0x8615ca4d, 0xb56aad3f, 0xbf04bc22, 0x3e67445e, 0xd0aafde4, 0x49c90760,
+       0x563d7c67, 0x71daf161, 0x99d9463e, 0x3bb7ea2e, 0x75bec137, 0xec7c2ec4,
+       0x29d17b7f, 0xd2e927fd, 0xf618f20f, 0x7155a517, 0xd878ac81, 0xa9ba74f1,
+       0x41e54a9a, 0x29b553f4, 0xea390590, 0x2bda5d9c, 0xa9fd0e51, 0xabd640aa,
+       0xfd14e9d7, 0x69a3dfa0, 0xf72c0bae, 0xd0128cee, 0x44af2c3f, 0xd3c8bb49,
+       0x41614dce, 0x1cbf76e7, 0xc777118b, 0x66df4afe, 0x0bcc3f39, 0x7b22fcf2,
+       0x5de41663, 0xd145dc63, 0x39de3c8d, 0xe145bc7d, 0xa39fd28d, 0x3ea211c7,
+       0xec136f8f, 0x267b6a77, 0x33e6e58c, 0x632f2dc9, 0xf4cf33fc, 0xa387b8e7,
+       0xbb05fe69, 0xf1c9dcb8, 0x86cf95e7, 0xd3df3005, 0x5db144cf, 0xca4db4eb,
+       0x12a3a763, 0x143b1e59, 0xf65cf0f5, 0xa6153d63, 0x5a742ec0, 0x9424f611,
+       0xf2c1ee6f, 0x32dd6540, 0x1254d7f6, 0x4b1c817b, 0x7fc804e9, 0x67f737a7,
+       0x37e9d17b, 0x415cbe55, 0xbbe357df, 0xfee71a26, 0x0880f58c, 0x799e23b6,
+       0x83fd6ff6, 0x5a463bfd, 0x3ed994f9, 0x5183d066, 0xf923945e, 0xd48e5160,
+       0x71c86e53, 0xd11d5a71, 0xaf3a70f4, 0xc207f253, 0xb481eb03, 0xef61131f,
+       0x3bb4d23f, 0x9c048951, 0x09ff5903, 0xfa956fb8, 0x366d99d6, 0xbe5553f6,
+       0x3b65e512, 0xf157ddd4, 0x554ac97d, 0x1695e3ca, 0xf950df79, 0xffb656e5,
+       0x2ce33fd4, 0xde083c00, 0x6db6dfac, 0xe471f556, 0xf4b7a7b8, 0x808d7e91,
+       0x10797f9e, 0xc62635fb, 0x59537989, 0x0790dace, 0x2a7a5eb8, 0x69fee382,
+       0x34e22f1c, 0x73f67f2a, 0x0598cf09, 0xc1d027ac, 0x4ab9fccd, 0x77d5cfe7,
+       0xfb83135f, 0x955de210, 0xb25c79ef, 0xff827a7a, 0xd1ebc286, 0xbf3f9d1c,
+       0x83f338fc, 0x8837da2a, 0xfbac5b0f, 0xab3f1713, 0x78b95cb0, 0x308f35d5,
+       0x26c77ddf, 0x5ce22f70, 0xc1d183d3, 0x91cfa8f8, 0xbdb3b0fc, 0xa62feb87,
+       0x5bfdb2fa, 0x2d9f3cd1, 0x13e60f36, 0xddefc78a, 0x07f559fe, 0x226cafb5,
+       0xcaef22f9, 0x2d125ff5, 0xf833fd3f, 0xfb2736cb, 0x7cff0951, 0xadacea3f,
+       0x7fd60169, 0xf32779f6, 0x72b1b39d, 0xf3a49fdf, 0xf98d97d4, 0xb66bf4dc,
+       0x9a61fccb, 0xd0b439c0, 0x98d7ee6f, 0x9b1cead7, 0x4f78b7a4, 0xd544fc0c,
+       0x47f40f84, 0xb711f9f8, 0xedc6d77f, 0x40b3d743, 0x4fb1d76f, 0xba608f9f,
+       0xe24bdb39, 0xd90bece5, 0x8d1d9e7c, 0xf34ef495, 0x74de854d, 0xb8a65636,
+       0xa87a0499, 0x387a4974, 0xed89a63b, 0xed956702, 0xc9b51e9c, 0x74cb9576,
+       0x5fd13b7f, 0xb407e812, 0x63aabb09, 0x19e40b4d, 0x05e1f9f0, 0x4f70069c,
+       0x0e8ed43b, 0xd7f9c53a, 0xe333efaa, 0xebf6051d, 0x89a79fb0, 0xba6bc7ef,
+       0xedb5593c, 0xf0257f4a, 0x614db554, 0x197fda7f, 0x13acd0fd, 0xd1003f0c,
+       0xc29f62e5, 0x6e2c22ef, 0xfb116db8, 0xbdac96d3, 0xac6f7415, 0x6f7eb163,
+       0xf2a2a8fc, 0x693a8e7c, 0x395ee4ff, 0xdfdf019e, 0xef1d28e7, 0xf38cb875,
+       0x3bf0f68b, 0x47496e39, 0xfea46d94, 0x35941aaa, 0xa19a4e3c, 0x19f5cae7,
+       0xd8b02270, 0xaa3be761, 0x6eeed3df, 0xbb3cc6fd, 0x9d31cf9b, 0x934d1fcf,
+       0xdedb93f7, 0x2fccf796, 0x26243d7d, 0x41e45bee, 0xf46061be, 0xd063b887,
+       0x22f3f520, 0x35f61cf8, 0xcf34ebec, 0xff660dac, 0xe653ce4e, 0xe66d80fc,
+       0x730eee7c, 0x9cd9af3e, 0xce6ebcf7, 0x0ee309ff, 0xf41384eb, 0x4235c46f,
+       0xfd0a46ff, 0xf5261ddb, 0x7fa1e46f, 0x8dfe8523, 0x91bfd0ef, 0x3c8dfe87,
+       0xa1e46ff4, 0xfe85237f, 0xfeeeef8d, 0xba554e12, 0xe07814bd, 0x4eddbab8,
+       0xf7813e23, 0x89d9c5cb, 0x558547cc, 0x1717a5ea, 0xd8fcb2e5, 0xe29a6f61,
+       0x11937b60, 0xad18958f, 0x1c47f785, 0x2ab2d280, 0xb1db8d39, 0x55f6ba1d,
+       0x2aae8769, 0xeec24670, 0xe4f2bad1, 0xa73d882a, 0xd418b4a3, 0xdb6b68bf,
+       0x2f56f802, 0xff7ec03b, 0x77eee5d6, 0x63f893af, 0x5f118bfb, 0x0f738255,
+       0x25f49b7c, 0x71ee7719, 0x4353db04, 0x4d6244fd, 0xd3f21e50, 0xd43e733a,
+       0xe6be042f, 0x46abed35, 0x6c6fc7c6, 0xfbe0c96d, 0xe0e33e9f, 0xea9f69fb,
+       0xcb313bf6, 0x2198f2c1, 0x1bce23cf, 0x9f7a5970, 0x95e709b2, 0xc31c7fa7,
+       0xa650fdb9, 0x68617ee9, 0x0879765a, 0xf91df3cb, 0xe3058a35, 0xbe5f4f94,
+       0xcd6af58f, 0xedd2e7cb, 0xd7b2dcfa, 0xeef34c5b, 0xd1370fef, 0x71adc0d1,
+       0x5ecc7e21, 0x7783faa6, 0x31f887a5, 0xa7ca9807, 0xbe6219ad, 0x8d7c5f8f,
+       0xbdafbca9, 0xa1cf6e23, 0xfce4b9fb, 0xa5ceb25c, 0x6f5e02c8, 0xc554bd68,
+       0x6ff827f3, 0x4e52dbc5, 0xc673a72d, 0x2bbfaf1b, 0x9d7f0052, 0x57e03277,
+       0x858b64d1, 0x3f4cad9d, 0xf332c487, 0x15615cb9, 0x275c573e, 0x84b855dd,
+       0x7fda9637, 0x654c6d69, 0x47e5fa3a, 0x68812aa9, 0x3c9680d1, 0xde8bafe8,
+       0xe838727c, 0x98dd5aaa, 0x3bf2a2ea, 0x5c16ff14, 0xb7133f20, 0x9524713d,
+       0x495aa927, 0xaa73c27f, 0x1cff702d, 0x19edd1f0, 0x7ca4ef02, 0x68a5e6ba,
+       0xe9d41f8e, 0x0ae6d52f, 0x6c6c1d07, 0x814f5954, 0xeb8d4cfd, 0x8d8d93a4,
+       0x6bd0e1f1, 0x3e28c62a, 0x5c06c7c8, 0x8508fa0c, 0xefefc907, 0x97bd69ba,
+       0x94f7c90e, 0x752e758c, 0x41a2fac9, 0x07de37b6, 0x5c7bd630, 0x372b47d7,
+       0x3b7591be, 0x7fd73f7d, 0x7e1b9e5f, 0xbc5dbadc, 0x6d96c5ee, 0x7d29925b,
+       0x85dda1c7, 0x7b7d2d75, 0x1a48f45c, 0x326dcbe7, 0x75b3fdae, 0x23e13e4f,
+       0xe3777a7e, 0x0fe87693, 0x9dbf5695, 0x6679cddf, 0x0ef11da3, 0xc8dd6fd7,
+       0x2d6c17df, 0x71807b61, 0x1194eecf, 0xa3c3ad97, 0xc1b2ac62, 0xde3ceb45,
+       0x1585ca5f, 0xa69e32e1, 0x46f51d48, 0x55b5d602, 0xa6bac7c9, 0xe3b76f17,
+       0xf58781fd, 0xa6fba17a, 0xa2b4f0fd, 0x357bb01e, 0xd4c71c29, 0x11993edd,
+       0x64fbcfe8, 0x4e34e5da, 0xc81e5fa7, 0x8287de7a, 0x239c2fb4, 0xf5fa21b9,
+       0xf5da5561, 0x4ef9559a, 0x30903d98, 0x5ec2f20d, 0x35456ef9, 0x0a23439d,
+       0x710bb7a0, 0xa3c5a535, 0xd79d1354, 0xf6984616, 0xb4112cc1, 0x9bbfa8af,
+       0x7e532f45, 0x530cc4fa, 0x07d399fd, 0x0b9df886, 0x7f99cb3a, 0x8f7a6d5d,
+       0x9f2efaa6, 0xc7bb615b, 0x4a77f358, 0xbb3a62ef, 0x5abed4d1, 0x47bd354c,
+       0xf7a9e8b3, 0x6544ce18, 0x54e1c476, 0x6658f7e8, 0xeff54769, 0x169dfcad,
+       0x7dafda62, 0x927f3c33, 0xfd8da5e7, 0x7d3d8609, 0xe8cf7e16, 0xef0cbcea,
+       0xbc451788, 0x9a1dec30, 0x61691e59, 0x3c48553d, 0xa8f6eb54, 0x8f691cea,
+       0xd8b5f6aa, 0xf04d8f11, 0x4810a6b7, 0xb6151a6a, 0x477d5237, 0xdfcc9c4a,
+       0xcc3bef85, 0xdfd052f7, 0x521f9465, 0x42bfb04b, 0xdd686bcb, 0x606a1738,
+       0xd83b6247, 0x076c9384, 0xfbd1c633, 0xf434e837, 0xfed0807d, 0x33700c06,
+       0xbadcaeff, 0x822f60fd, 0xd8e2b4cf, 0x549dc47c, 0x95b14d35, 0x6f495ee4,
+       0x54bfff06, 0x7ebf6161, 0x4c03e1fb, 0x5615ed6f, 0xff4b8c8f, 0x78d4b876,
+       0x9435dda5, 0xbad0170e, 0xb05e7fe0, 0x15f8f143, 0xe9f00f59, 0x810cfa05,
+       0x70174a4f, 0x01d5e033, 0x7e7290bf, 0xe2286e3f, 0x0a7be426, 0x1425c057,
+       0x0b38fa9e, 0x2772c134, 0xf3cfcbcd, 0x8c57e90a, 0xb78fdd08, 0xb0ffd9db,
+       0xe52e1141, 0xf531e1bb, 0xf4e3b4b2, 0x6feb90cd, 0x2078a9db, 0xd97cdfbf,
+       0xe83bdfca, 0xd9c658a7, 0xde689f4f, 0x54f41daf, 0x8ccff72c, 0xeedc89cb,
+       0xdf5745df, 0xff864f45, 0xdd7e3426, 0x19e647b8, 0x1ab7dfa0, 0xf37d8626,
+       0x1be1c44f, 0xe77741f2, 0xe439c74c, 0x9910f1d2, 0xbcf9e5de, 0xe39d2a34,
+       0xbedd35cc, 0x4d69f068, 0x5b8c676f, 0x78eee542, 0x7e6f7bd0, 0x43557167,
+       0xfbf06a46, 0x1b4ada37, 0x975381db, 0xe25a73c7, 0x7ce22574, 0xdf2e5929,
+       0x4f763969, 0x29f844cf, 0x25b4ad8e, 0x8faea44c, 0x553439dd, 0x88be420c,
+       0x86d74fd3, 0xcfb60acd, 0x032de91b, 0x9c61f9e4, 0x872de7ef, 0x3f6167a3,
+       0x8d19dcae, 0x2bc5a190, 0xa2ee1fdf, 0xa2d9be73, 0xfec01a2d, 0xce7c8de0,
+       0x3cc6d70b, 0x390ce7d8, 0x516572a3, 0x5503c84f, 0x04f038ff, 0xb96d01e4,
+       0xea72112d, 0x81540fe9, 0xe73a1ad0, 0xe538be58, 0x6a7df494, 0xabdf0473,
+       0x2f08a53c, 0xd48b51fc, 0xd32e797d, 0x337cdb79, 0xd2708fc6, 0xae30c3b8,
+       0xc6124b7f, 0x30b2f8f5, 0x333cb6ae, 0x8bbb2ba6, 0x97aed691, 0xc316dff2,
+       0xa3dbacce, 0x0f23f721, 0x4b645fb9, 0xc8791fb9, 0xf72148fd, 0xfc0d7be3,
+       0xd71bf00e, 0x6f43e5b7, 0x39158df5, 0x8e1cf84b, 0x7f5c81cc, 0x01ee12bb,
+       0xf15dba3f, 0x8478e4f4, 0xf9e5620f, 0x2357821b, 0xb246dd1d, 0x5edd1059,
+       0x8221d977, 0x88c6ebe3, 0x9c7e5358, 0xbf54d923, 0x2a6695c8, 0xbfa93ebf,
+       0x7706fca9, 0x537f29be, 0xfd5348ce, 0xa6319e49, 0xdc468ffc, 0xc53faa60,
+       0x9f94c53b, 0xa9b66136, 0x12e28cfe, 0x59ccf953, 0xb3e54c8b, 0xf94cdbb5,
+       0x34ee2b5b, 0x92f1ffd5, 0xaf72a6e5, 0x0e715970, 0x231f4336, 0x3e85efb8,
+       0x6fede946, 0xe3064667, 0x4b38d475, 0x350cef97, 0x56fa900d, 0x39f7ae74,
+       0x09ee25d0, 0xe8fb0e81, 0xe2f680f7, 0xbf06199c, 0xfa914065, 0xe8324b70,
+       0x685eb426, 0xfd88a8f9, 0x6594f097, 0x9f6ee7ff, 0x313e2561, 0x43fdaaea,
+       0xfb7f2832, 0x5619e6c0, 0xaea32fe2, 0x3a52ffd9, 0xdcf17fe5, 0xf07cb237,
+       0x57284bfe, 0xfccbf772, 0xc822c134, 0x9bce06af, 0x8c75a3e1, 0x8d7d2eba,
+       0xba53da47, 0x5235538c, 0x9d7101c0, 0x00d20380, 0xfdd227d1, 0x5f489f44,
+       0xb72cfa27, 0xe8907109, 0xd221e913, 0xf7fdf14b, 0x3d2297a4, 0xd2297a4c,
+       0x452f4877, 0x297a42da, 0xcdd43fd2, 0x3a83f4e2, 0xb1fddb8d, 0x8fd382ae,
+       0xf7f096ea, 0x7196ea4f, 0x1f3a97fa, 0x8064ff7f, 0xb0087f61, 0x8bf0c69d,
+       0x091fc0d5, 0xdb2ede7b, 0xb1bf60b9, 0xabe795e2, 0x5facc7e1, 0xb0235a22,
+       0xb1ad5b4f, 0xfe9d1c27, 0xadf9eec9, 0x92089c55, 0xdee19ccb, 0xf8f006cf,
+       0xb7cc5dbd, 0xc447eff5, 0x84053eb4, 0xb5d34fa7, 0x3307e0b3, 0xc656ca0a,
+       0xeeb8ff10, 0xd03625eb, 0xae9687cb, 0xd5efa3ef, 0x03a7dbf9, 0xf7e86dbd,
+       0xa65dfd5a, 0xae321d6b, 0x6b6b5af0, 0xbfdbdb3d, 0x03c46e14, 0xefec33ed,
+       0x5ef958f7, 0xe085f2b1, 0xc104e8fc, 0x5b2ffaf9, 0x5af10e38, 0xcf892797,
+       0xc46f3d1d, 0xfdf87505, 0xef1413f1, 0x8de1f863, 0x2fc29f78, 0x3e41c75a,
+       0x77691d18, 0x0dc48587, 0x2fbedfc0, 0xbcc68fea, 0xc3277df8, 0x97d4ffbf,
+       0xf2f78022, 0xb5fe3f0c, 0xd834968e, 0xe1df4615, 0x33c704f0, 0xe57afe19,
+       0xe715168b, 0x64af1189, 0x3bcc638c, 0x15fd4aca, 0x5d23c674, 0x47ca6aeb,
+       0x757d465c, 0x93d7f724, 0x49dde3be, 0xb955e7aa, 0xec3e535d, 0x22aba3c7,
+       0x8ce9423d, 0xafa9e813, 0x3af1ea9b, 0x38d0bf0b, 0x1eb4624e, 0x1c7e8127,
+       0x01df9cb2, 0x48109d1c, 0xa39ffbc6, 0xb03dd897, 0xb88e3e83, 0xb8ce82b3,
+       0x088fd405, 0x2798c7da, 0x15f7edfa, 0xbcf217cd, 0x9df0cbd7, 0x29f492e6,
+       0x3f5e7adc, 0x2c6385af, 0x3d54bbdb, 0xfae61c5f, 0xcfd1046b, 0x90da19ad,
+       0x1fdfd481, 0x7ccc8c94, 0x7a3217d6, 0x094fdf60, 0x0bb04779, 0xf03119fa,
+       0xbc7e84ff, 0x05bdef12, 0xe942e1db, 0x418fc0c8, 0xbbde064f, 0x0e832ba3,
+       0x18d0e282, 0x65711def, 0xf4a17f7a, 0x199d1dd6, 0x43ad75f4, 0x8cf001d2,
+       0xae8320f8, 0xf89a2f94, 0x2ae8eb1e, 0x067f9f07, 0xc5d2855d, 0xe9257495,
+       0x0e27feb4, 0xba4aefee, 0xc007a4ea, 0x55d387e5, 0xf8f38a8b, 0x79a7a59f,
+       0xee3c626d, 0x765c97ff, 0xabda441f, 0x7c17b69f, 0x198c4ca6, 0x2e13120f,
+       0x62ec1075, 0xba32f5a1, 0x7f4a17a9, 0xbc6eeda1, 0x6e465da2, 0xfa71bb70,
+       0xaeda1959, 0x047aed12, 0x71c21bb7, 0xf7e96f11, 0x1a72de08, 0x999e2d71,
+       0xb90e5390, 0x2f2df26d, 0x27cc8de1, 0xf3a719ba, 0x096243f3, 0xee24bf9f,
+       0x854f40fa, 0xcb8d693a, 0x42fac85d, 0x71d76461, 0xedea3705, 0xdc5d7fc7,
+       0x4f8cf980, 0x37e3cb30, 0xf5fcf2ea, 0x0ffb91a2, 0xc6e1477d, 0xce59ebdc,
+       0x61477d0f, 0xfe3d40f3, 0x81a44d20, 0x8f0a17df, 0x0efe9f9c, 0xcfbea146,
+       0xc9ba7453, 0x5462ab70, 0x6a9bee1c, 0xaf321c56, 0x3c8c1de3, 0xfce3eb8c,
+       0xe9cfc20d, 0xfdc0224d, 0x0903a24c, 0x61091ff9, 0xc85fef93, 0xaa35bafb,
+       0x5790dff6, 0x4fba7b8d, 0xb057b53b, 0x4c440fcf, 0x4a77839e, 0xd7190dc6,
+       0x17f6ed0f, 0xdbce59ba, 0xb960c8ef, 0x16d2fb13, 0xde27c9d7, 0x5fba73a4,
+       0x8a37bca6, 0xfb46f714, 0x3bfa79d1, 0xbf91c73a, 0x40b96731, 0x736ef1bb,
+       0xfed193bc, 0x6138d726, 0x9cfeef8d, 0x776f29bc, 0xdecdd86f, 0x042ecd8a,
+       0xbd8adf7e, 0x7deb10aa, 0x45a7b62b, 0x4e7661a6, 0xafd2bd07, 0xa0d8b92b,
+       0xc6f1cefb, 0xc1dd78f3, 0x286b80d9, 0xff380d3c, 0xeb1eb800, 0x077bae0a,
+       0xaa379608, 0xad5f2423, 0xd57c908e, 0x58757380, 0x9ede7dc7, 0x5527f1c1,
+       0xf9af090e, 0x5611aecb, 0x2c17f512, 0x93f9c91b, 0xb807c275, 0x6092c69f,
+       0xf7b10f10, 0xce58eb09, 0x9ddcef1b, 0xe8bdf87d, 0x2ae79a24, 0x983ff687,
+       0x4082b9df, 0xe2844916, 0xbe7a86e4, 0x05fe7f8f, 0xaa7d03d5, 0xf1af754a,
+       0x96facec0, 0x7d71ef2a, 0xfe15207d, 0xd754f158, 0x0e55e8f1, 0x9f435f09,
+       0x98afd21c, 0x5fb1adf7, 0x80befe85, 0x0ef55f21, 0xc6dcf193, 0xe4eef73d,
+       0x92e1e1ad, 0x930ef5af, 0xebc0d8fc, 0xee7ebb06, 0x89c33f53, 0x3afca68f,
+       0x98abf59c, 0x2e4c6f58, 0xc28583ec, 0x76189fa4, 0xf904f695, 0x22b5ca7e,
+       0x945191eb, 0x13643c2f, 0x076f2a7e, 0x92794043, 0x1fb6b3f4, 0xef82a4ba,
+       0xfc294517, 0x6f71863e, 0x22c92c29, 0xc27c41dc, 0xbd370ee9, 0x13911b4b,
+       0x7947ca67, 0xc7ea997a, 0x9537488c, 0x98077ac7, 0x1427e3ca, 0x8a3df298,
+       0xefd536af, 0x29ac6b39, 0x68ddac9f, 0x31529faa, 0xf83794d5, 0x24fc8a58,
+       0xc5b92cfa, 0xb2efbed4, 0x34fd5352, 0x5ca9a55f, 0x319b3bc5, 0x25b7ab40,
+       0x81cf1127, 0xd58c9fca, 0xe3de434b, 0xf0cb08b5, 0xfe6b77ce, 0xcbde5a33,
+       0x80b91099, 0x6cc9afdf, 0x9e7999fc, 0x2c6b44ea, 0xcdbbd7a5, 0xc928b17c,
+       0xb9171f9c, 0x71df814f, 0x9fcccb9c, 0x4d589653, 0xeae51ff9, 0xe44f34fc,
+       0xbbe3ddb1, 0x300daff0, 0x4e143fe1, 0x7efc0f44, 0xef9d3b68, 0xcdebcc3e,
+       0x070f7e32, 0x75e0937e, 0x0c126fc0, 0x824df807, 0x049bf0f3, 0x24df87d7,
+       0x937e1cb8, 0x8721f2e0, 0xd61ff8cc, 0x55ffc662, 0x6ff1991f, 0x787765d0,
+       0xa66ad91a, 0x9a29a10f, 0xba782df2, 0x7e9994e6, 0x1d73f142, 0x09b15b89,
+       0x09e287c0, 0xbe387fb8, 0x8be08656, 0x37f7c3f0, 0x31477bdb, 0xd7d71e7e,
+       0x20606d75, 0x3a2e97df, 0x6fbc0aa4, 0x71f3ac63, 0x6d3fdcfd, 0x89731ad5,
+       0x5dcefccf, 0x763e0490, 0xdb7e909d, 0x4f1655f1, 0x207fba80, 0x29d99c64,
+       0x3fa843da, 0xaa52fe2b, 0x26d2741d, 0x0e7bcfdf, 0x95d8797c, 0x123eb2f1,
+       0xf6bef84f, 0x27be54cf, 0xa8d2c475, 0x8eaf8f80, 0x9f009ed1, 0x84bb9799,
+       0x8a249bd7, 0x5c402fb7, 0xa5857fd4, 0xafb73f22, 0x722dc7bc, 0x89fef95b,
+       0xa6e727c1, 0x2da9b8c8, 0xdd7fbab9, 0x9ea7e323, 0x777295c9, 0x71c5c794,
+       0xf2b925de, 0x8ba90d7e, 0x010773a9, 0xd99d873e, 0x0b3acf80, 0x8ad9ebbf,
+       0x9d09e47b, 0x0f21c8f7, 0xa3ecfe43, 0x1ff57fcb, 0x47581c3b, 0x3a617af6,
+       0x1dfbfb7f, 0x81e2f8a6, 0xfca65d5b, 0x5324a6a0, 0xdcbbc1fd, 0x40fcf2a6,
+       0xc87ca98e, 0x3f298f21, 0xa98465ac, 0x791f55fe, 0xad91f94d, 0xaff54c13,
+       0xca6c5539, 0x47b688a7, 0x8abedf01, 0xcd1c53b4, 0xb9fa974d, 0xe4dc705b,
+       0xe563bbdc, 0x7edd5f7d, 0x46fbc861, 0xd3a6b9dc, 0xd11ea875, 0xe8e52ed7,
+       0xf52164fa, 0x1fae8746, 0xa13eb30a, 0x1de371e9, 0xe67c58f7, 0x5e2371b8,
+       0xd0ef43bc, 0x7b8e8af5, 0xe2f19d34, 0xf178e0de, 0xbf5d61b9, 0xc75e7d1f,
+       0xfbfce87b, 0xeb7ae5da, 0xbdf3b4ef, 0xa15e631d, 0x96c949f3, 0xd1d9bb74,
+       0xbfaabdf5, 0x46fb4ae5, 0x25f1666b, 0x3613fdd0, 0x6dff2b4f, 0xf3c62b84,
+       0xb75e22b4, 0xcf7617fe, 0x8f77f70a, 0x5cb07737, 0x658b1ccf, 0x8e5c94de,
+       0xddfd338b, 0x92418884, 0x7583adbe, 0x78c84afb, 0xdc646373, 0xbbb1889a,
+       0x8fddbf41, 0x6499e127, 0xff7c0d17, 0xf167bf4b, 0xf74d35e3, 0xbd8e68a1,
+       0xce3f7f51, 0x4c3d036f, 0x59f24b1c, 0x5b13c93e, 0x49143d7a, 0xcb13ca72,
+       0x8a9f6cac, 0x3757fe7b, 0xde75fafb, 0xfa4be99f, 0xb203e810, 0x07a8f40e,
+       0xb72954f2, 0x2beb920c, 0xb8eebf52, 0x187ec0e7, 0x43f3f421, 0x174fbc70,
+       0x6874c6f4, 0x75dfe3ac, 0xdba0c1ef, 0xfa193850, 0x3be3d0af, 0xd2f319fb,
+       0x07ec67e1, 0xfdc67e03, 0xb66df713, 0x7c914de2, 0xe202658f, 0x6dfc0ce5,
+       0xc6f693c9, 0x503c3a05, 0xbba8fc0f, 0x6e6a457a, 0xedf7ec0c, 0xeae31dc2,
+       0xea3b0e82, 0x62e09bff, 0xfbbbbfc0, 0x87f1dd6d, 0x5df0be50, 0xa3baddf7,
+       0xdef67fd3, 0x909f105b, 0x5e3a4bf1, 0x1c2cfdfc, 0x94777017, 0x323f3f79,
+       0x9189f248, 0xe4fdf483, 0xccd6fd23, 0x0ffc042f, 0x9d552bf5, 0xbcf3c85f,
+       0xdf98ad24, 0x8af9c6af, 0x37f35bfb, 0x8847f94a, 0x87abc4e2, 0xe36f8fc2,
+       0x7ad7cbfb, 0x4a6ddb05, 0xde3f151b, 0x75f12af9, 0x9fb30fad, 0x0772cdcf,
+       0x26c83bbf, 0x46576a4d, 0x5da5f6ed, 0xc2facef9, 0x60eef948, 0x0beafbe8,
+       0x2f19bd75, 0x86df606a, 0x19eebdfa, 0x3cb1fba4, 0x9cf2c3c2, 0xa150d71e,
+       0x37a0e9d7, 0x0e6f7cbf, 0x31f6327a, 0x671f1ca5, 0x3f0dcdc0, 0x3cce90d4,
+       0x073c37c1, 0xb58379e7, 0x0ec5f8cb, 0xab7e1af8, 0x61ecbf0e, 0x1a1127be,
+       0x77ce718f, 0x3f2bba20, 0xeb1fe198, 0xf8741f6e, 0xefc3bec7, 0x89691ed6,
+       0x69f1dfc6, 0x67df26df, 0xfd5bf4e9, 0x22cbb865, 0xf03153fd, 0xfdeab53f,
+       0x5d798d89, 0x96d50fdd, 0x9438e4ef, 0x73b68b66, 0x2cefad10, 0x7b778ff5,
+       0x9fdc89ef, 0x26117788, 0x2ba976ea, 0xcdcbadd7, 0x8fe914a3, 0xef8ca9f6,
+       0x5ef209f6, 0x8151f13d, 0x4fc4677d, 0x0481114c, 0x4a1f86a4, 0xe1923d5b,
+       0x4aa1f86f, 0x9e792302, 0xda17ea33, 0xeb68e4f0, 0x851577a3, 0x53fd3bbb,
+       0x5c647dad, 0xaa7e7754, 0xb9f39769, 0xaf97e9bf, 0x183e7ee1, 0xb6e52694,
+       0x036efb86, 0x2ad80d9d, 0xab67586c, 0x4bbfebad, 0xabf3a851, 0x3d9ae812,
+       0x96ade282, 0x962fbc2b, 0xbf88c22a, 0xe46f3e62, 0xf9ea352f, 0x7dbf9922,
+       0xeab7cca5, 0xd16da7ef, 0x275820ed, 0x7a07ac52, 0x4edd36f9, 0xc5207582,
+       0x7c1df03a, 0x35f0790d, 0x90d7c1e4, 0x0a435f07, 0xa5ef86be, 0x761538a2,
+       0x0ad3f85b, 0xfc07f683, 0x72418569, 0xc169fc13, 0x82d3f879, 0x169fc3eb,
+       0x5a7f0e5c, 0x69fc3970, 0xd3f879c1, 0x9fc3eb82, 0x3f879c16, 0xfc3eb82d,
+       0xf879c169, 0xc3eb82d3, 0x0e5c169f, 0x39705a7f, 0x79c169fc, 0xeb82d3f8,
+       0x5c169fc3, 0x62996f3e, 0xd3cdb7f2, 0x5b287fdf, 0x51f4cf1f, 0x9b1c5198,
+       0xeffdf847, 0xc4fc7f88, 0x373c0e96, 0x2edd022f, 0x48f70ead, 0x904e373c,
+       0x8908b778, 0x8cd9b6e7, 0x32ecbbe7, 0xb4e3245f, 0x7e07e943, 0xf49b42ab,
+       0xdf85215b, 0x56fc290a, 0x2ab7e148, 0x2b7e94cc, 0xe15bf0a4, 0x4856fc3b,
+       0x0a42b7e1, 0xf85215bf, 0x6fc290ad, 0x2b7e1485, 0x0adf83b4, 0xf856fc29,
+       0x5215bf0e, 0xfdf0adf8, 0xfe03cd08, 0x905e632b, 0xf499fbf3, 0x9343a252,
+       0xe532ea5e, 0xd707e721, 0x5c1f9c87, 0xb83f390e, 0x707e721c, 0x707e721e,
+       0xc1f9c87d, 0xdc8349f9, 0xef20bfbc, 0xbc83b707, 0xd41f9c1f, 0xb6037be8,
+       0x2e1b49ab, 0x35b48ebc, 0x7142794a, 0x2f353109, 0x8bfc2673, 0x35254ead,
+       0x6d8423d6, 0x859980f9, 0x38f4d794, 0x66d13cc7, 0xae39be01, 0x05a6f080,
+       0x0f65c704, 0x5cc97ffa, 0xf9b3f86e, 0xbf9ef087, 0x50deb043, 0x35afdfa3,
+       0x4b847bda, 0xefd46a45, 0x2f5d77cc, 0x1ea37c74, 0x79a0cbf3, 0x8f996290,
+       0xbbfc9378, 0xaf700b22, 0x91458b60, 0x642bb8f1, 0x5d28743c, 0xe793caad,
+       0xf6cb16fb, 0x5388e1fd, 0xb83c5129, 0x156591ef, 0x80056c87, 0x7e0292d3,
+       0x562f2af7, 0xab92d75f, 0xcc658711, 0x124bb0db, 0x867be09f, 0xbd84daa3,
+       0xfd19c69c, 0xefe3b085, 0x4bb44c73, 0xa0ed0279, 0x29f40e6f, 0xf4414dde,
+       0x9e4f2cbd, 0xb6ef9a7b, 0xfbe9cbab, 0xae4b6dc0, 0x89c5fdc6, 0xd3ddb2e1,
+       0x386689bf, 0xf8506e4e, 0x6da8ce9e, 0xc9fb8bc2, 0x3a7e75cb, 0x5ecb9b70,
+       0xf8bae3ce, 0x6fd1a3de, 0xbe5486c9, 0x5a2259a7, 0x450f710b, 0x3df8550c,
+       0xb46e037c, 0xbeb1d7be, 0xb02ada2c, 0xfbe0ff2f, 0x7e2e244f, 0xa34ffb9f,
+       0x2116c687, 0xcb3450ae, 0x0d2742f7, 0x83d9592d, 0xe5f9a5e6, 0xbfa3a17b,
+       0xe706f258, 0x85ef929f, 0xe70cf932, 0x9879f1f9, 0xfdf853ed, 0x8dbec995,
+       0xee370496, 0x25b72f65, 0xe136fea2, 0xf5055881, 0x8d8af708, 0x168ae575,
+       0xbd01538b, 0x41f10388, 0x639c47f4, 0xdf25e83a, 0x59f7e363, 0x365d58a6,
+       0xce431bf0, 0xb1c97129, 0x3151d48b, 0x4432cf7c, 0xd0d4b84e, 0x7e62e383,
+       0x3b4e9c78, 0xba5fe7df, 0x8572c9d3, 0xbe615eb6, 0xc65f3e79, 0xf6dd56bb,
+       0x7a4b70e1, 0x99ce9c67, 0xbc16ff34, 0x7d267b03, 0x8508f47b, 0x79bd88e5,
+       0x0da3d704, 0xcd3df12f, 0xf06f9592, 0x0d4b943d, 0xfbcb450f, 0x52ffd26c,
+       0xb0cdc3ae, 0xf1d7cd3b, 0x69c7ae53, 0xef93ab1d, 0xcc39d33a, 0x6a5caeef,
+       0x119cb1b0, 0xf21a2f2a, 0x911ef1a7, 0xc23fae10, 0x60d153ce, 0x0bc03be3,
+       0x4aac94d7, 0x91ca5712, 0x7339758b, 0xe38d8351, 0xf7f42ab2, 0x6eff42d4,
+       0x1e3d62cf, 0xf356f16b, 0x42f24ff7, 0x7de350e4, 0xc94ebd4d, 0xb06607db,
+       0xc6c4b43c, 0xcb39cdfe, 0xb6247ca5, 0x93ee3f0b, 0xce3e59cc, 0xe666f782,
+       0x947af4ec, 0x5de9e82e, 0xd89a4e5d, 0x4ff864ea, 0xfcc11cb9, 0x14e5ea65,
+       0x397cdfce, 0x9799d399, 0xee2adc65, 0x5a6e8122, 0x073be48b, 0xd1f2ebef,
+       0xc6b1c40c, 0xc9eb3e43, 0xf44eddf4, 0x74f2218d, 0xabc035be, 0x3878801c,
+       0x44ada6d1, 0x8dc4ec9c, 0x4d83ef82, 0xfd451c82, 0x155c82cf, 0x5691fd8f,
+       0x2661f7c4, 0x68bf7c28, 0xf4dbd0d2, 0x43fb40fd, 0xf7e13f30, 0x29c2b457,
+       0xcd39c47e, 0x805bb6d2, 0x685f637f, 0x5efca3be, 0x629f24ea, 0x9a923bc7,
+       0x741b6fae, 0xe63fba1f, 0xb276e846, 0xeb076948, 0xb26193b0, 0xb7c92478,
+       0xd3e4266a, 0xf66db0b9, 0x608109d2, 0xcb2b951f, 0xd576fc7b, 0x419206cc,
+       0xc9fb55ff, 0xde458b1c, 0x9039233f, 0x96880bef, 0x2f949ea2, 0x4014a359,
+       0xf5e6323f, 0x38ec67b9, 0x3a4eb0cf, 0xa7d8ed28, 0xd2e51ef2, 0x7e4d327b,
+       0x8cb4d09b, 0x34fd8de0, 0x27f5a637, 0xf468610a, 0x1c2de160, 0x85ebf781,
+       0x005428f1, 0xe8b798f1, 0x3bc1eaf9, 0x973ab4ff, 0x91f9c4e1, 0xa6687dbf,
+       0xe05ff22f, 0x6b147393, 0x4b1bdff0, 0x0d5768b2, 0x50f7c1ee, 0x11bf03c7,
+       0x9efc6db9, 0x4bb64a44, 0x7b10a9f2, 0x8960f54b, 0x4bbb50c7, 0x773cae59,
+       0x7a9dd584, 0xdc7bfb2b, 0xd634b76c, 0xbe66cc7d, 0xf3a46be7, 0x5ee7eb07,
+       0x9ee7bfdd, 0xf916c3ca, 0x1663c2fe, 0x8857f6ff, 0xd0f72f5e, 0x8fbd6066,
+       0xe79ede21, 0x8cfaf1af, 0xf83a4cf7, 0x896efe95, 0x96474f41, 0x2afbe25d,
+       0xb77691a5, 0xe54f441a, 0x0fbe15ab, 0xde4cba5a, 0x2b56d6e7, 0x6e845df2,
+       0x99bf58ec, 0x9efcbffd, 0x117e6fd5, 0xf8750b2e, 0xbcb7b1ce, 0x84eb48e1,
+       0x3d979fef, 0x347c9360, 0x0efb8990, 0xf2712cb7, 0x7b9fd9bb, 0x0f06ab8a,
+       0x8c3c9e03, 0xe5d871a7, 0x8c4b7f54, 0x4bdf04b6, 0xd841cb45, 0xfcfee71d,
+       0xba8f7e6d, 0xdf8d39b6, 0x95d92cbf, 0xd9ef0abf, 0x7ed1ee7c, 0x4497f582,
+       0x4790ecba, 0xf9621a6a, 0x53db9e7c, 0xda2bcfbf, 0xe067cfd8, 0xd2c1bee7,
+       0xbe7d778e, 0xaea2e71c, 0x6cc01157, 0xbaf54c53, 0xf61a63b6, 0x4b3b50d1,
+       0xdf21bbe8, 0xdd815765, 0x5f641ec4, 0xb632ec35, 0x71b3639c, 0x77b1cfae,
+       0xf73ef7fd, 0xf437f3ea, 0x7a1df9da, 0x9ef8ee6d, 0x2ad7ff90, 0xcbd3d82e,
+       0x7133dd23, 0x90fca1bf, 0x62b4910d, 0xbe5b9c62, 0x7c8f731f, 0x8ef4a63f,
+       0x7367e67c, 0xdc029380, 0xfbc9193b, 0xe94fdcb8, 0xfbf7ee90, 0xf40f6bad,
+       0x0a7a0dd9, 0x821df978, 0x1ed79772, 0x951f2417, 0x77a62a35, 0x0bfc8c24,
+       0x97c95583, 0xfc00dd48, 0x9a477c7e, 0xcd396f1d, 0xf1093121, 0x27417b99,
+       0x51db3ac3, 0x993f8e3d, 0xca0e2e98, 0xfe14bdf7, 0x2f18e4bb, 0x955beff8,
+       0xc3df9a36, 0xdf2cfaa0, 0xc51c1aed, 0x68b895fd, 0x5d4869dd, 0x03824f3c,
+       0x3eeda9c3, 0xe3cdcfea, 0x02ca3e30, 0x07ec1b7e, 0x42f71073, 0x7e5c5bf9,
+       0x6d29c61b, 0x68d4ef90, 0xda38e46b, 0x20fb58ea, 0x975607c8, 0x5cb04fbd,
+       0xbddf20d8, 0xddffa39e, 0xcb2f9a11, 0x2704e5cd, 0xee33b3dc, 0xabc286dd,
+       0x797f9f44, 0xce59ac63, 0x036b5c6c, 0xf377667e, 0xdd39c65e, 0x30da5d0e,
+       0x2837df86, 0xbef97ab7, 0xfbc3a68a, 0xf79cdbb3, 0x7b325fc2, 0x34b623dd,
+       0xb065ffca, 0xe9cf6b94, 0x7a6271fb, 0xa9df9320, 0xf1c9cdba, 0x8d5db3e3,
+       0x780edebc, 0x81f0443f, 0x662ae2dc, 0xf89d1378, 0xbe596f10, 0xcedf8cce,
+       0x77c944f9, 0xf095d7fc, 0xd5605bfe, 0x79e0aeec, 0x8997dfac, 0xb4d9a1f8,
+       0x970ef1ef, 0x1f7c6970, 0x3343c4f6, 0x6205eff9, 0xe6cf1c9e, 0xbbc78f71,
+       0x4c374453, 0x18fd06d7, 0xf18df3f7, 0xb4ab1eac, 0x6bbe7bc7, 0x420f7a9f,
+       0x7c27af4e, 0xddd00fc3, 0x02e3b53e, 0x2f6b8d26, 0x5e07ef97, 0xfdf4efc1,
+       0x6a01fffa, 0x00d36c91, 0x0000d36c, 0x00088b1f, 0x00000000, 0x7dedff00,
+       0x65555c7b, 0xd6bbf0ba, 0xc0d857da, 0x51b08b66, 0x62020dc0, 0x10106d11,
+       0x80a17515, 0x636a735b, 0x8dc42937, 0x910150b7, 0xf39fa8ac, 0xa96f0db1,
+       0x962a2695, 0x8da6b675, 0xb2707595, 0xd99b1b46, 0x0f5d9a6a, 0x39d38d3a,
+       0x32cdb653, 0x34d209bb, 0x99d37d9f, 0xde79e7be, 0x0daf60b5, 0xf9a675a4,
+       0x3efcefce, 0x7df5e3fc, 0xee7d7bd7, 0x765ef3cf, 0xb24c6322, 0x98783631,
+       0x8c81b183, 0x45931819, 0x77a13fc8, 0x6302edfb, 0xbeac7195, 0x28d2132d,
+       0x0b6bff56, 0xdfe3df63, 0xa2749ef8, 0x8f2c6453, 0x5da0dbb1, 0x10af7c1b,
+       0xd6ccabd9, 0x29d33df3, 0x148af7d0, 0xd41dd336, 0x7ec3fb1e, 0x13efd5e3,
+       0x338b69fc, 0xe3abea7b, 0xbb78d856, 0x9a7ed0a9, 0xdd8beb05, 0x3ea81bf5,
+       0x26e9b3cf, 0x3632c591, 0x87ff04db, 0x7b4894a5, 0x32e6c456, 0x7057b0d6,
+       0xe1a8a11a, 0x18b18941, 0xf08b9f48, 0xbec664b1, 0x3bcdf868, 0xcfbd40b7,
+       0x64af6f37, 0x35e67b43, 0x398a3fc7, 0xf7363046, 0x0c733652, 0xa5de6c60,
+       0x0f569431, 0x073864f3, 0xf8dbd506, 0xc607ba5c, 0xfb2dadbf, 0x5a307fdc,
+       0x30e59fb7, 0xbf73fef6, 0xe868e3fd, 0xde9f3197, 0x3acf4d7d, 0xa13ead66,
+       0xc304b2af, 0x4d73af8d, 0x83155746, 0x18b6ce79, 0xcd14121c, 0x64c55e5e,
+       0x33b32798, 0x13e41a67, 0x422bcc75, 0x16fd6cbf, 0xf3eb04d9, 0xb557fe30,
+       0x5da9905c, 0x824fbe63, 0x7a860cf5, 0xdf5e1cc6, 0x58f7f00c, 0x4884670c,
+       0x912de8a8, 0xcdbc1903, 0xf83d29f7, 0x21a90c1d, 0x89ef07a7, 0x5ecc1d0a,
+       0x7b6d0657, 0x330305f0, 0x65eb0f96, 0xfceaae1c, 0xbff32aa7, 0xfb20bd6d,
+       0x4e0ddea0, 0x2757cf07, 0x7ac1e61b, 0x364face7, 0x5cb486cc, 0x473e5ef9,
+       0x2f8dde5b, 0xccaf8aab, 0x4f587695, 0x57c71b57, 0xe13d3ad7, 0x2f4f6bab,
+       0xa931257c, 0x00771e67, 0x8e00d8be, 0xe382362f, 0x57c0530b, 0xa82f33a5,
+       0x7c70bfde, 0xedfe7ecd, 0xd0765e0f, 0xceffa8fa, 0x1dbe8d07, 0xb6acffd0,
+       0xf2b784bd, 0xc9f41bd5, 0x99ceaf50, 0xdb51704c, 0xb6cfaecf, 0x6de78032,
+       0x1debb7ab, 0xe8eefc16, 0x9521ee93, 0x413f1059, 0x6790099e, 0x3bbc40ba,
+       0x397ea7a2, 0x9c617ba4, 0x91cd8b25, 0x719edaec, 0x3cf428b6, 0x86da3ebb,
+       0xafaecde3, 0x7165887a, 0xf66777fa, 0x66b3bfe6, 0xa0b317ce, 0xb3cfe43f,
+       0xe424ce45, 0xd4510a8b, 0x3e9a9bf0, 0x79837884, 0x35e0063d, 0xdbc3fe23,
+       0x0c38469e, 0x6ce6145e, 0xa9a94f86, 0x8b8e1f01, 0x36f38cf4, 0x826bcc88,
+       0x8135a97a, 0x548f388b, 0x876c28a0, 0x528d8469, 0x1df90b16, 0x4802ed30,
+       0xee9e2453, 0xc3f5f273, 0x677e3f77, 0x5c3c8131, 0xa1cf4abf, 0x3b606af4,
+       0xfe00a757, 0xd9cc310d, 0x4fa1e8ec, 0x3e951fb5, 0x6fedfa55, 0x70ae7b7d,
+       0x3993677d, 0x3386593c, 0x56e304c9, 0xb9cc3c3e, 0x3afcb846, 0x0f00610d,
+       0x817ad05b, 0x7d6c0b58, 0x903537ac, 0x0fcd7657, 0x24a5b7ad, 0x86f58fb6,
+       0x93e553ae, 0xc3ce2639, 0x015127c0, 0xfad77798, 0xf10c51a1, 0xca2f302d,
+       0xcd8bb39d, 0x5d5bce22, 0x504d53d7, 0xbbb6e619, 0x33e944c9, 0xc368c04d,
+       0x764d3e00, 0xe4df3fca, 0x29adb4a0, 0x9ddbca83, 0x633f9a36, 0x80698881,
+       0x85308aa7, 0x8f3cfdff, 0xe54165e5, 0xee9c6d53, 0x11035b4e, 0xfd3920b6,
+       0x0d79bd71, 0x0efa428b, 0xccfc883c, 0x5db2871a, 0xf5e9d430, 0x4cc42367,
+       0x3f3e4fa4, 0x7d12ddb5, 0x163fc927, 0x02ec7061, 0x24b19b96, 0xe02374fb,
+       0x38f2ee6b, 0x9b129027, 0xe49438d1, 0xb46f0cc2, 0x7eb00093, 0xcc78430b,
+       0xf860e453, 0x2395aa92, 0xb26b7eb1, 0xe6718055, 0x5ae79c5a, 0xced5fda9,
+       0x4b7bf1fb, 0x93252199, 0x9026caaa, 0x72287763, 0xdcc0896c, 0xa07787c8,
+       0x12fe449c, 0xfea2a50f, 0xf055a3b9, 0x56cf291b, 0x21d7000b, 0x78d2eecd,
+       0x055b1394, 0xbb6c0ee7, 0xa9a9e40d, 0x0d769e47, 0x7a817f73, 0xf4077d81,
+       0x255ffd07, 0x5d710220, 0xca1c726d, 0x75824df1, 0xb979c317, 0x059f080d,
+       0x6e9c9d0a, 0xc8e11339, 0xa3eb81ec, 0x65105ff8, 0x288b23cc, 0x3d141b6f,
+       0x79406486, 0x310e4e45, 0xca41f870, 0x3a3f11da, 0xa0e909a7, 0xc51292cb,
+       0x886f28fa, 0xf2c38948, 0xc912ad39, 0xaa9e9545, 0x7c2835d5, 0xa3be1733,
+       0x2a912bde, 0x56be9162, 0x74a44cb6, 0xcd9286ce, 0x24e3a05e, 0x9a3b1dc1,
+       0xb867a3d6, 0x13b5399e, 0x55bc47af, 0x9b4630ef, 0x7a496f00, 0x104e526f,
+       0xbed9ce3f, 0xbb41892a, 0xd3cddbf3, 0x5b17fe51, 0xa1a38acb, 0xd16dbcfd,
+       0x1e9052d9, 0x7ae6ca49, 0xc4ed4164, 0xacf00638, 0x2791fbf9, 0xe78fa0ac,
+       0xe8569f42, 0x70b69bff, 0xd4aa179f, 0x924fed34, 0x31dee780, 0xa1b3e279,
+       0xe0f142fe, 0x1f50a32d, 0xe2a7be08, 0xce23bea9, 0x503c87da, 0x0fc073d3,
+       0xdaf7a00e, 0xf51ef5ff, 0xd6f895f3, 0xbed0e5f5, 0x4885f6a6, 0xa6e167ec,
+       0xa15be43f, 0x49e8a0fc, 0x173ffec3, 0x45653fb6, 0x9edd6c02, 0xee7c7a85,
+       0x4f28b4a6, 0xf917f21f, 0xbd51f100, 0xaaf8205f, 0x517c33e5, 0xc7bb8406,
+       0x4c560ccf, 0xf480ccad, 0x8d625e7e, 0xf6a80f68, 0x323e5a8c, 0xf3adcb9b,
+       0x9093eb51, 0xb53fe64e, 0xccf50925, 0x5f3c1167, 0x6fadd4f1, 0xecf2dca0,
+       0xaf101a34, 0x38331d1e, 0x41799f51, 0x551d22bf, 0x93c6ff03, 0x04ae61dd,
+       0x0eca2a7a, 0x6fceb827, 0x51fa411d, 0xa77c179d, 0xcc74cff2, 0xd218f385,
+       0x748d99dc, 0x7f9d67ff, 0xcff3e22e, 0x17a766f5, 0xf5cd99f1, 0x4bd79fdb,
+       0x05ee58a5, 0xe47b4186, 0x885febcf, 0xd8f4b548, 0xfbd2256f, 0xd67684b2,
+       0xea36428b, 0x76ccf0ed, 0x1bb22cc3, 0x9d59d118, 0xc359d395, 0xe0e97d01,
+       0xa8c7b218, 0x37e746a4, 0x05af85f4, 0x9dd5bd8a, 0x80d7b7df, 0x87b3527c,
+       0x6d3511db, 0x508ec867, 0x855a92ed, 0x39ee179f, 0xda857643, 0x871f6eae,
+       0x5e3eed4b, 0xc801955e, 0x80e5cd1d, 0x0aba4200, 0xfbf905f1, 0xd3d7f5fe,
+       0x7bf26997, 0xb5df7f29, 0x750f2e56, 0xb7a8499d, 0x349c64d6, 0x976bfe20,
+       0x5e42fd2b, 0xbcde341f, 0x2f0481ec, 0xc16a1f2c, 0xfd8d0ef6, 0x9a2fbb50,
+       0xc36bfbda, 0x97bea356, 0x4c3a2ceb, 0xa42d6b9b, 0x8bd5b7ff, 0x9c5cba19,
+       0xed13985c, 0x916183b9, 0x07472859, 0x06653c2e, 0x3b6a0248, 0xbe50888f,
+       0x2f73ca3a, 0x031c67d2, 0x6f5090ae, 0x5fb405f8, 0x74f95e3b, 0x6e3ff604,
+       0x066be048, 0xbf0bd753, 0xf20c5e9b, 0x2d981964, 0x06671f64, 0x0f1d2046,
+       0xf4e5cc3c, 0x1ab67ae3, 0xb9d31bf5, 0xf72834d9, 0x3c42dca3, 0xdbe61b7f,
+       0x1dffff05, 0xfec60ff3, 0x143fc999, 0xd0a4bddb, 0x5968dba7, 0xaebcc02d,
+       0x8359ea1e, 0xd041be4b, 0x222d935f, 0xac34a40e, 0xdfe7a1d7, 0x82757b55,
+       0xc113a722, 0xc8bb408e, 0x416ec830, 0xf3366e3a, 0xccb209f5, 0xf71e611a,
+       0x8d9e1e67, 0xa76d7a7a, 0x9d611989, 0xc8c33a13, 0xe41c4d7e, 0x6cd6bd22,
+       0x2dbd224e, 0x02ac7438, 0x14ce1fea, 0xcfac3afd, 0xcfac3e4c, 0xae76214c,
+       0x9db19668, 0x6fb5f070, 0x960fbe51, 0x82891e2e, 0x47be0df5, 0x9d433670,
+       0x8f73aeca, 0x15a41bff, 0xfdec7697, 0x2dff4857, 0xe113b3ca, 0x75cbba7a,
+       0x5ba803c6, 0x39336d6b, 0xc160deb9, 0xef7838eb, 0xb13691b7, 0x9d1d7e67,
+       0x4dfb9ee7, 0x2726a62e, 0x07099fea, 0xa11fd225, 0xc3b0e9f3, 0x3d5287c4,
+       0x2c3b3bb2, 0xb0104fa2, 0x70f791fe, 0x164c137e, 0xbaf684bf, 0xb065ff49,
+       0xc48e617e, 0x935773e8, 0x83df614a, 0x938b1091, 0xd1747d47, 0x38eb7642,
+       0x3a550f85, 0xdb9b2b7b, 0x72296f8f, 0x73338555, 0xaf582cc8, 0xd66cf0a8,
+       0x1022faab, 0xf87b32ce, 0xaf529176, 0x932892eb, 0xf46d5e1d, 0xebb2e831,
+       0x33d250e0, 0x3fd9c9fd, 0xf601dda0, 0xf954f2c4, 0x5327845d, 0x0acdeef4,
+       0x2dfd54fc, 0xacdffd29, 0x8b66f1c0, 0x5376e1c8, 0x7a14dc08, 0x1e97a50a,
+       0xdb41887a, 0xeccf1ba3, 0x51a3f6be, 0x6bdf84c9, 0xfd78e61e, 0xedfaf090,
+       0xcd802b5b, 0x4dbfa0d8, 0x0cfefc21, 0xb98bf578, 0xedaf023f, 0x9bf578a1,
+       0x375e2187, 0xa0676489, 0xa376881d, 0xb5c0e507, 0x60f6e794, 0x51392306,
+       0xd7398529, 0x8077e324, 0x87c91643, 0x541f28a3, 0x15c430b9, 0xe9f506b8,
+       0x71e57069, 0x8db1017e, 0x10a4e797, 0xf6b0245d, 0xbc072c78, 0x277da1e7,
+       0x7e668699, 0xe5b7720c, 0xdfdedf01, 0x82cd3f40, 0x983ceb6f, 0x8b66f78f,
+       0x0eb7ed13, 0xc3d5e89f, 0x59a25a3c, 0xbf187ed6, 0x4e55fe65, 0x4533962f,
+       0xf8374c6e, 0xef837ed0, 0xbdf88d49, 0xe97f7f9c, 0x441f67ef, 0x8d33acfb,
+       0xb25abad1, 0x67da3a59, 0xf419652d, 0xdcaab7fd, 0xb7823079, 0xddf4e32f,
+       0x43e6df32, 0xa3e8f43d, 0x27a8e1be, 0xf1cbb65a, 0x510d4836, 0x981cf89e,
+       0xd38920ff, 0x94324b7d, 0x7059ba43, 0x7ec5cf97, 0x0df3e1ae, 0xff3d8794,
+       0x4e657414, 0xe506d105, 0x76231ba7, 0xe9555ca0, 0x2e30f074, 0xcf7887df,
+       0x7938456c, 0x7a8cb027, 0x8543ffe8, 0x0bf854de, 0x008d36c0, 0x3c1098f7,
+       0xa31774a8, 0xca585fc0, 0x413bcfe9, 0xf31d4f59, 0x0091bfa1, 0x38070953,
+       0xf0c11a57, 0xd5967483, 0x6ff38d93, 0x91f80c5e, 0x0f1c1d70, 0xdd5645a7,
+       0x155f07d6, 0x0df128e6, 0xa6f90218, 0xa9be7192, 0x7a42ba44, 0x0aba046c,
+       0x481647a2, 0xae173e88, 0x83ca15d0, 0x1cb8f708, 0xc257e758, 0xf0b1f21f,
+       0xa694ffad, 0xa4ce35f7, 0x1e2f2e1c, 0x734a7b33, 0xd04def48, 0x656f9dd8,
+       0xfa889a7f, 0xafbdf4e5, 0x149a6025, 0xeb8c9ee5, 0xd7fe5cd8, 0x1fff1452,
+       0xb8f407c6, 0xffcb0f8e, 0x2dda224f, 0x235f4b95, 0x79d2bffa, 0x37989996,
+       0x5d1ee01c, 0x00fd382c, 0x462d79bf, 0x16f824e7, 0x0c755c57, 0x6ad659e1,
+       0x56911874, 0x1c8d62d8, 0x408f2b3b, 0xda1d8a37, 0x39ba246a, 0xf4894bf7,
+       0x8b92b9c1, 0x0f800eaf, 0x4e0856e7, 0x32d657ac, 0x3790256c, 0xa816292b,
+       0xa057995e, 0x1ca9657a, 0x051a275f, 0xaf4037a2, 0xde283b25, 0x8ef5a731,
+       0x13df88a9, 0xa40f5fc5, 0x187ac1f8, 0x2e63e547, 0x959e48de, 0x56abf529,
+       0xbb47911b, 0xacb597bf, 0x3ffc88ba, 0xde521bd3, 0xec53e93a, 0x5b51acb7,
+       0x8235c6ee, 0x4e57771d, 0x07ca0c44, 0xefce64e6, 0x40f24811, 0x93fa0ff2,
+       0x447140bb, 0xc20f30cf, 0x61bc89c3, 0x99eba47a, 0xdba05708, 0xdd7ca5e8,
+       0xbe0aa733, 0x99ceb049, 0x1f67ce16, 0xfbbe0996, 0x09ff3e05, 0x5065ef40,
+       0x5d740b1e, 0x38e4c316, 0xe626dd48, 0x2e79c70f, 0xca09f61d, 0xd438d3db,
+       0x8fefaa28, 0xf75ca1b4, 0xb78911e8, 0xe5a52f32, 0xede947cc, 0x98f34fcc,
+       0x74933ac1, 0xfc93af90, 0xf38e312b, 0x0367b32b, 0x8b5fd7d2, 0xe0169c4e,
+       0x4239ddfb, 0x439428de, 0xdd68038d, 0x701f5b97, 0x067680a5, 0x5fac41aa,
+       0x147ee396, 0x4ccab3fb, 0x74ab718f, 0x995a8e95, 0x17d61537, 0x9be2debb,
+       0x6b8beb04, 0xf5c21cf5, 0x38374fa6, 0x1383ef10, 0x74133af8, 0x543f9fdc,
+       0x81a3606e, 0x183f360e, 0xdb3a43e6, 0xda2035bc, 0x03e6fea1, 0x97cc0180,
+       0xf0bc14af, 0x4e61eadd, 0x7559d38c, 0xfeed111e, 0x188f56a2, 0xe1a7e208,
+       0x394441b2, 0x23d3be91, 0x5ab49ea2, 0x353d53d7, 0x4fd4ac5f, 0x59067937,
+       0x4e9e4ec9, 0xa15c33f4, 0xd49fb51f, 0x045f8356, 0x4ac917b8, 0x57b7997d,
+       0x9e8a61fb, 0x3961db56, 0xab7a67d2, 0x453f4fa3, 0x3f505b4d, 0x08f88f83,
+       0x7bd205c6, 0xfd711fca, 0x1bf084da, 0x36abf378, 0x2103374c, 0x9d1c71f8,
+       0x79e34cc7, 0x15d33cf8, 0xbfbf87da, 0x63e38f7f, 0xb9bbf01e, 0xe422fef5,
+       0x1f00cda3, 0x9de6f3c4, 0xcfd4ccb3, 0x799a59f4, 0xf286a931, 0x4b070825,
+       0xa23c75ef, 0xd53d2fcc, 0xbd695a23, 0xe76843ce, 0xe28ccba5, 0x763f6a01,
+       0xf405741d, 0x857a776a, 0x90cbcc7a, 0x47b8945a, 0x4eb38e3a, 0x5d31ff40,
+       0x6b4957c1, 0xf63361fd, 0x5f1466e3, 0xfe85cf4c, 0x8426fea1, 0xfc37a183,
+       0x5e99e742, 0x4273e7cc, 0xf18edfa9, 0xe76c7494, 0x74431158, 0xd5d7e7c5,
+       0x1c6214ea, 0xa08fb197, 0x7e90c9fd, 0x0cb8c29e, 0x7e4ecfa4, 0xb42e4a6d,
+       0x97d1fe7f, 0x52d0b476, 0x0fb33e0e, 0xf5ab56e5, 0x9c709be6, 0xff9f2283,
+       0x5de2724d, 0x206ddf98, 0x53be9a3d, 0x7944db4e, 0xebfd1393, 0x55df56ae,
+       0x2cbd422f, 0xeb64c618, 0x0a138f3d, 0x3a15da9c, 0xcb793938, 0x53ef5c20,
+       0x582c7745, 0x5f87ed02, 0x3b8d38f7, 0x94fcca7c, 0x9b0fc816, 0x30abcbf8,
+       0xc78e5f7f, 0xfee4023c, 0xde5fd2b0, 0x6ae50fb6, 0x821cfce9, 0x4576c597,
+       0xda39a9f2, 0xbf02f5e3, 0x52dc4737, 0xd2b8fc8e, 0x24487066, 0xfa19eb77,
+       0x7711cd59, 0xe5bfb1db, 0x4c26f9d1, 0x36bfd60d, 0x6e3c9ca1, 0x1e2131c9,
+       0x18132d9a, 0x0aaceb96, 0x4f1bbe9e, 0x885240fa, 0x73847772, 0xe5744cba,
+       0x0c272864, 0xbcad0609, 0x2f7971d6, 0xb43e1dd9, 0xf5acba9f, 0x60cc8148,
+       0x7ca05409, 0x69795493, 0x3c717a71, 0xa3b4e2c9, 0x9142b4bf, 0xaf862c37,
+       0xf73960d3, 0x5eaf389f, 0x962e63fd, 0x867f4b50, 0x4128ccb0, 0x9bda3ff9,
+       0x573e10c6, 0xbbc58353, 0x6844f518, 0x70205d7f, 0x4fa38e50, 0x7e337647,
+       0x5eddee48, 0x7a341bb2, 0x7a5e5ba4, 0xf221f5a2, 0x7a811e52, 0x792058a2,
+       0x0ceb61e9, 0x0c12feb8, 0x3c5c00b2, 0x545eb8db, 0xce267bf9, 0x49e5f005,
+       0x5e5c9165, 0x2673e4e9, 0xd1efc60e, 0x452a5cae, 0x5e021e22, 0xc3e9e0c9,
+       0x9378f79f, 0x9d1e507f, 0xa987fa41, 0x21fe9007, 0x0fe144fd, 0x6f078a8f,
+       0x50a3f5d9, 0xd912cb5f, 0x85cb9503, 0xe2cfb436, 0x6947d1bc, 0x2edcc5be,
+       0xa6bf9768, 0x892a1cf5, 0x7979444b, 0xc799d962, 0xbebd41ef, 0xfff49c29,
+       0x5667a5a4, 0xa66e3c60, 0x211a7057, 0x7d1a59ef, 0x6f987bf7, 0x905d3a34,
+       0x81f0ab3f, 0x914597fb, 0xb8084f68, 0x759e8cce, 0x83321656, 0xf139e29b,
+       0x3b409633, 0x34e0a34f, 0xa1e07a3b, 0xef527ac7, 0x37bc05f5, 0xfad0fe46,
+       0xa8d7bc3f, 0x3e7759c8, 0xc6a2d9ca, 0x700a87e4, 0x7cf5eb5d, 0xd7d18d9e,
+       0x3927de53, 0x1cb97639, 0x3fd8a99e, 0x57b3a59e, 0xc0f7c3c6, 0xcef9416a,
+       0xc8a956f1, 0x88e340e5, 0x0d3f1863, 0x3e48172c, 0xa252bc79, 0x5ccdda1f,
+       0xef784d9e, 0x5d900a28, 0xb43de5d8, 0x722b5a92, 0x3674a3de, 0x94588c17,
+       0xe3dfa76f, 0xfe479ffe, 0x9bb62563, 0x83b5a2d3, 0x0cfd0226, 0x67bcb840,
+       0xf1e9fd26, 0xefbad196, 0xea6945f0, 0xd38ead55, 0x8bab3de4, 0xe7b0c7ae,
+       0x52277bac, 0x3992af3c, 0x2ade9122, 0xc1376e65, 0xe61b259f, 0x4f9d5733,
+       0x2ac7b731, 0xa27ec18b, 0xb07b5aef, 0x3389fec7, 0x78a8df20, 0x3a13f154,
+       0x19765eef, 0xacd076e3, 0xdd7ada75, 0x16301076, 0xe5caba8a, 0x32bf76da,
+       0xb9459fbb, 0xe038dee8, 0xaeabf21b, 0x80821e50, 0x266e7f21, 0xa61f71e3,
+       0xced543e8, 0x517a592f, 0x6668728f, 0xc23d45e3, 0x1fd2e673, 0x385fa7e6,
+       0xa1bef3b5, 0x3ebb4a20, 0xbf934e39, 0x534435d1, 0x30f766ff, 0xa75bf7cd,
+       0x5ef9ab5f, 0xc9a919ee, 0x5e3d5edf, 0xfd467f53, 0x7a1cad24, 0xa3d69a37,
+       0x79bfa7e2, 0xa3e8a5bf, 0x12ec4277, 0xe23a9d35, 0xbf91133f, 0xe4672c3f,
+       0x33787cbf, 0x1d31f8d3, 0xe7822423, 0xf93d5c80, 0xc8e5f731, 0xbf208fef,
+       0xa1f44fc9, 0x7343f3c2, 0xa228c9a1, 0x7ee4627f, 0x725fa879, 0x5e503990,
+       0xfdb1d4ce, 0xff8f5442, 0x9cf30e67, 0xe3bafec7, 0xf10f4b0d, 0x1f884378,
+       0xff78a573, 0xbfcc0670, 0x4d79790f, 0x16c3f72e, 0xffaf36ee, 0xb58e0838,
+       0xfc9ad16d, 0xebf1fda2, 0x3bd60e3f, 0xae1d044b, 0x93e146b3, 0x7da0165a,
+       0xa0e8bb52, 0x40c4eafe, 0x583be62c, 0xf4b46c67, 0x0a8b838f, 0x258f800f,
+       0xa9de2837, 0x193fc3fa, 0x9e0a453e, 0x1a70b4cb, 0x90e3cb93, 0x29108f5f,
+       0xc7239cdd, 0xf103fee7, 0xf49eb41c, 0xdc7fbcdc, 0xc847227a, 0x9f9f0859,
+       0xe3dfaf1b, 0x17940f1e, 0x7f0b908e, 0xfe4cb826, 0x47a5c247, 0xd82f47cf,
+       0x72a3fa0d, 0xfdfb819d, 0xbf5c33de, 0xfefd7237, 0xf68fb47c, 0x44f39b87,
+       0xed070ee7, 0xe93ed297, 0x618d7ba1, 0x59df1819, 0x797d23a1, 0x8190997a,
+       0x2126c2fe, 0x0f36fc8c, 0xc81648ab, 0xc878b9be, 0xaa31fd48, 0x3afded07,
+       0x0551f390, 0xe4096b3e, 0x71e5ccdf, 0x716e35b1, 0xf5038a4a, 0x1eac1ff6,
+       0xe27a8b8a, 0xfd9e1e11, 0x696be130, 0x2bee45df, 0x6bd0127e, 0x8512d1e5,
+       0xd5cc5f8f, 0x2e1f3ad1, 0x949db914, 0x1f70ba2a, 0xa9d81563, 0x96065768,
+       0x915f28eb, 0x6d59e9c7, 0x9d0a1ff7, 0x14dd94c7, 0xda88f386, 0x7d7dba24,
+       0x2e51fb8c, 0x793d0f8f, 0xb3ed1857, 0x68742a01, 0xd6bddbef, 0xaf582e69,
+       0x8d96d0bd, 0xdcdadfb6, 0x4d6fea68, 0xcf159746, 0x748cfca1, 0xfe8eca78,
+       0x8cfac0a0, 0xe655cd33, 0x580feeab, 0xe936fe94, 0x9da2bf41, 0x1e289822,
+       0xf91af161, 0xb16715f9, 0x1ccade26, 0xa76e0b02, 0xf428f3d6, 0x1b42c76a,
+       0xeff697e1, 0x5db178d5, 0x1ba417a1, 0xcf4abbc4, 0x8983fda1, 0xe9cc8dec,
+       0x15d9f389, 0xe51a8e52, 0x8f748dd9, 0x1f90eafd, 0x07fe5cbc, 0xe3c4be6e,
+       0xded7de2c, 0xe18879c3, 0x0c9c525f, 0x5fce4aec, 0xbee2434b, 0x024f913f,
+       0x40cf0e66, 0xde1e5684, 0xdac9d0ab, 0x48de827f, 0x3ebc02ba, 0x8fe5cb9c,
+       0x36fdc0ab, 0xb2c73bca, 0xfba230d4, 0x96270b1f, 0x51384560, 0x3872ba5e,
+       0x1f3df379, 0xcc749e10, 0x7f71b46f, 0x72e1f90b, 0x31c2a47c, 0xbe9e6449,
+       0x3c88f2f4, 0xca1bfbe5, 0x6ab7ae7e, 0x61d90fc8, 0x02c57728, 0xcc2cd2c6,
+       0xffb6bc61, 0x8f9c0e7a, 0x396ae885, 0x96aee5d2, 0xcfe43094, 0xcabc6564,
+       0x0ca7d29b, 0x205fa077, 0x040ed018, 0xe3c0c3bf, 0x574edc3f, 0xb94f7ae5,
+       0x72c47ed6, 0x1f8f664f, 0xeaf7daa6, 0x82973c77, 0x59f3aae3, 0xfd61d8a5,
+       0x125577cd, 0xdca2724b, 0x808f765a, 0x5ab1dcf0, 0x717df8d4, 0x0325615e,
+       0x7fce3e3f, 0x8efd13af, 0xcdafb038, 0xf575cf28, 0x5e083382, 0x0a817b81,
+       0xf8871338, 0xe24fe02b, 0x8967bd3a, 0x57c7425e, 0x85abb1d7, 0x5de71b8f,
+       0x9f90c82c, 0xa02f5154, 0x9956b7df, 0xa3055c7f, 0x3e9969ef, 0x9e21e301,
+       0xe38a5616, 0x03335655, 0x332af5c6, 0xf2865399, 0x7443c6ca, 0x02b9edde,
+       0x206f2539, 0x4f3a4fc9, 0xa4f02ae3, 0x4d1d01e7, 0x7643284d, 0x864bb867,
+       0x167f89f1, 0x4cb5a71d, 0x59efa2f0, 0x843ce2d4, 0x11d001fe, 0x2d3c7dc5,
+       0xe75f1a01, 0x5d7271e5, 0x80e9c18b, 0x658d4875, 0x5521ffb4, 0xd4329c1b,
+       0xdf29b63b, 0x2d95f18f, 0x0ddfdc8d, 0xd67493f5, 0xd1c3d7fa, 0x9910ab5f,
+       0x790a0144, 0x5659fa2a, 0x30562e85, 0xf7ee3b77, 0x41fe1933, 0xdca548bb,
+       0x2a6f3d5a, 0xd0e52266, 0x13dc8378, 0x6b9e409f, 0xd3b240dc, 0x678daa94,
+       0xc92b2d48, 0x7d6233af, 0x890faca8, 0xa5d54877, 0xac971714, 0xf35bf2da,
+       0x8e086222, 0x9e1e3c59, 0x8d88ef73, 0x727cc2b7, 0x1fe3797f, 0x41873d30,
+       0xfe5b8033, 0x4c073bb2, 0xac16ff87, 0xa62378d8, 0xe8cebc4f, 0xe08fc19c,
+       0xfa8c6657, 0xe8fafcf1, 0xb2abf295, 0xb9d00f26, 0xd27dafc2, 0x094f1abf,
+       0xfe954fe5, 0x4d4ef943, 0x7f865ed7, 0x120526d7, 0xdf4f0f91, 0xdb03323b,
+       0x73de3657, 0x5f88c7c8, 0x77d00705, 0x117177a5, 0x5660ba23, 0x5e5bd097,
+       0x490b3784, 0x1f37bfec, 0x3b7c863f, 0x13e7effe, 0x95df087f, 0x63ce8c09,
+       0xf649fd81, 0xdfaa9a9c, 0x3eb9f223, 0x246790bd, 0xc1464ebc, 0x053bac0a,
+       0xc7bee0da, 0x2b4e6078, 0xf02e7fa4, 0x4de38b3c, 0xef9e3c81, 0x6b40fd7b,
+       0x4b37ae0c, 0xa78ef5c7, 0x76e68edb, 0xa8ffb748, 0x06590fd8, 0xdced0536,
+       0x771126c0, 0xc0e0596e, 0xe2d63be7, 0xc9b96bbe, 0xcaeb0699, 0xf448dfba,
+       0xf68a0484, 0xa7689651, 0xb6aee5b8, 0x9f69cb8f, 0xd2c0d1b1, 0x0ee06e28,
+       0x006473c3, 0x4caab0cf, 0xacc357b2, 0x857aaf68, 0x1e88aaa4, 0x22f5087b,
+       0xef2cb40a, 0x30ac53ad, 0xb042aefe, 0xec7b3347, 0x59fed51c, 0xeb4c9f9c,
+       0x6820ed57, 0x8fddb0c7, 0x0b4aa7e5, 0x19bb224b, 0xf7fb83e6, 0x90264cb6,
+       0xff5213ed, 0xd92332f4, 0x7baf76af, 0x5bb470ca, 0xa0e6a797, 0x9ae30add,
+       0xfd7f6e24, 0xbb67ca3b, 0x285ef94e, 0x49b9e0e6, 0x05801f75, 0x8718d174,
+       0xfeaaed53, 0xe763a5e7, 0x9505b954, 0x9f2f9b7f, 0x59ff7ec1, 0x5563dd72,
+       0x634d4de8, 0xe9e079f8, 0xcf8dbd0a, 0x9e9a5337, 0x73dbb3ff, 0xfe93aea7,
+       0x39feeb79, 0x9ffae1d7, 0xffd88eb1, 0x3cd8f821, 0x3ac67ff9, 0x4ff2996e,
+       0x5f37875c, 0x43cfc86e, 0xe746d679, 0x7e2eec88, 0xdee41c2e, 0xcb9cbc3d,
+       0x09938b39, 0x74ffc764, 0xfd84d779, 0x1c1f419d, 0x7778a1cf, 0x67183a08,
+       0x88a1a588, 0x8ca5cdec, 0x2c8681f6, 0x4340fbe5, 0x224d3a96, 0x6e1603da,
+       0xec520e27, 0xb94b41ce, 0x9ca719dd, 0x118b882b, 0x3fd4327d, 0xca5bcbf6,
+       0xbee0c6e7, 0xd5ec9190, 0xf5dd36e6, 0x5e53d416, 0x868fce89, 0xd2d289da,
+       0x5f9c4a95, 0xf6aa9f6b, 0x79e31a68, 0xb4b3b2fd, 0xa3daa74f, 0xb4f29443,
+       0x603f7ca5, 0x1ed68b48, 0xdad6ab8d, 0x1082fa8f, 0xbaa9733b, 0xeb49d07f,
+       0xe9d72dd3, 0xa87ffcf1, 0xb07b89dd, 0xab0714a8, 0xfeb4067a, 0xf630d74d,
+       0xf9f77e74, 0x1fdc1c8c, 0xd05ab99a, 0xcf5539e8, 0x7e282402, 0x43e3e2a4,
+       0x3f8873d4, 0x5fb534f7, 0xaf3e6fd2, 0x2e4c7048, 0x539cd74f, 0x1e7eec62,
+       0x3a73712f, 0x11eaf5fa, 0xddaed16b, 0x37c6eeb7, 0xfd697d31, 0x04e5e19d,
+       0x6f54f5af, 0xebc6cb7f, 0x7650ff30, 0xe6123dbb, 0x53a8d0f5, 0xefd009ef,
+       0x85e33c6a, 0x2978b3eb, 0x9e14b68f, 0x7ab3d08b, 0xa4dbdfda, 0x0d9f4c0f,
+       0x45122be5, 0x23be911c, 0x1832981d, 0x59309f9d, 0x35f57e78, 0x30e3ee8c,
+       0x1a9f5ce5, 0xd73d0987, 0xc7c3cab7, 0xc4f00559, 0x18963573, 0x39a91f7e,
+       0x08e9fee1, 0x818766ef, 0x8b3939e1, 0x624fee72, 0xa82aaed5, 0xbf7edc77,
+       0x0bee167d, 0x7e881867, 0x26ce98a4, 0x9ed993c4, 0x71c2af63, 0xcd35e242,
+       0x2037e929, 0xfbb5bc59, 0x20679ef0, 0xc9cf7b7d, 0x2a9d312f, 0xf3c3efb5,
+       0x88465225, 0xbf6bd29f, 0x9bdc1198, 0x4a5f3387, 0x6e3b9632, 0x754e9110,
+       0x869a6feb, 0x50c154fe, 0x4f581ae7, 0x1bf30258, 0xbd611e60, 0x7b7989f6,
+       0xce9c20a9, 0xf59648d5, 0xdfd80d15, 0x7fba08a8, 0xae03bec0, 0x4df3a7cb,
+       0x80f657f4, 0x0e3a47a8, 0xc38ff653, 0x1fed7b32, 0x30c2fcd3, 0x3b59e14d,
+       0x7a15c3e4, 0xca7b635f, 0x6b77fb87, 0x106e5213, 0x69f53d1d, 0xbbd6195f,
+       0xab1bbbf2, 0x26fd5f68, 0x9fcf1593, 0xcafb2985, 0xa574e3a1, 0x43675b3a,
+       0x6418b46a, 0x55f11673, 0xe0725f0f, 0xe68353d8, 0x9cfaf501, 0x736e3aa7,
+       0xda83c71e, 0x64c2d19f, 0xf74323b4, 0x81fb43ad, 0x56be7079, 0x31fda9ea,
+       0x01e746d6, 0x518b8874, 0xa7abb57d, 0xe9df0db9, 0xff1fbb24, 0xcc82e382,
+       0x35fc431a, 0xcedb55ac, 0x0dcfca9c, 0x2a18f4a8, 0xfdd0a52f, 0x6f7ad4f7,
+       0x9f81e138, 0x1fad0827, 0xf6d0d70a, 0x5833b7f0, 0xe160ddde, 0xa95d88fb,
+       0xac22b99d, 0x473da57b, 0xbf5a7f33, 0xef7fd3d0, 0xbe6d3cfd, 0xb9f6364c,
+       0x7d07943e, 0x4e8277cd, 0x6c596fbb, 0x8d2fb6d1, 0x25777ed1, 0x4592f368,
+       0x6d91dfe9, 0x8e1af3a2, 0xf79e137c, 0x18d8f953, 0x8af7efe2, 0x2efa2adf,
+       0x1e74c991, 0x79de9375, 0xe3c4e50e, 0x01d24033, 0xf82c3c7d, 0x552e58cc,
+       0x0f515bb4, 0x93d3adc6, 0xaefc7a9c, 0xbde0ce5b, 0x6ba016a0, 0xf771e584,
+       0xc56e9b47, 0xf148b17c, 0x70fb9b0d, 0xcb51d239, 0x37bf5f77, 0x3a9fcf1b,
+       0x5bce740d, 0x75b1b73d, 0x1e2b61ac, 0x94cb8a0b, 0xfdf069cd, 0x84e62aa1,
+       0x6323b099, 0xfc712363, 0x15a2d12d, 0xd1f3ddf5, 0x718efff5, 0x8c19e694,
+       0xe14219f6, 0x46d23757, 0x756e3672, 0x5bf780b6, 0x5f9b1e1e, 0x06317289,
+       0xaf9465fc, 0xc57dca90, 0xf015c717, 0xc5b6c0f8, 0xbe23c52f, 0xdb0f5837,
+       0xa2159e69, 0x52d8a713, 0x8b7fe5c1, 0x7b3ed185, 0x3752a8f3, 0x72ec4d1e,
+       0x8b3c0ec9, 0x41dee2d8, 0x2d595ef3, 0x9cacd972, 0xc8580197, 0xbe9c3951,
+       0xfd4a360c, 0xb3346e98, 0x972839f8, 0x7ce8c292, 0x81f67f50, 0x57cb84b4,
+       0xe9cc6f6c, 0x1143debf, 0x5cc8f18d, 0x9fe467cb, 0x6dfd0b9f, 0xf299b19d,
+       0x538d3caa, 0xdfbbbbe8, 0x1bba3d10, 0x36724bf0, 0x9e2ce41a, 0x878e63c7,
+       0xf575b789, 0x3a20b4c2, 0x7c8055d5, 0x2ee7e2cd, 0xbebb7e30, 0x87e334a8,
+       0x9b9d4cfc, 0x5518e5cb, 0x97ebbb1e, 0xda05dc61, 0x635f51fb, 0x0fce783f,
+       0xb7d71952, 0x443fa851, 0x830cf37e, 0xe839ef03, 0x430e402a, 0x56825d7b,
+       0xc9181c4f, 0xc1fb35f1, 0xa09eccbb, 0x728c4d38, 0xbea3661e, 0xeb069cde,
+       0x744338d9, 0x6c78076e, 0xfa1068a9, 0x55c4c78a, 0x0d997e70, 0xde6fd1f5,
+       0x1b139152, 0x8c669ebc, 0x36d0c073, 0xdb9f0fd7, 0xbfc885d3, 0xbc79235d,
+       0x1cdd67bd, 0x3f4071be, 0x479a87a8, 0x6ae6ae97, 0x557241da, 0x6d6de567,
+       0x073a7aae, 0xcfc155d9, 0xf813ad5d, 0xc4a4827e, 0xf28b9bcb, 0x4bf4bf49,
+       0x492b152f, 0x57e2849f, 0xe5fd3f9d, 0x9911e907, 0x8719f1f1, 0x4cceb49b,
+       0xda07e1fa, 0x4af9743b, 0x1e0bd47d, 0x62ba7f6d, 0xf8e33651, 0xaf105fa8,
+       0x7bc5e63a, 0x95fda193, 0x3a16fc2a, 0xe069c91f, 0x8d9db1ed, 0xdbf48bf8,
+       0xc8e00169, 0xa1ce82e9, 0x3c38f7b3, 0x7c3a24b7, 0x2e01f86b, 0xae7487d2,
+       0x78f7a52b, 0x658e098f, 0x7de8efb8, 0xe7f3a25d, 0xcd4f7aa1, 0xb13070ab,
+       0x3e9ce736, 0x0f9c4dec, 0xa76935ea, 0x01fa89d7, 0xed8a97d0, 0x094b2a36,
+       0x5cd4b3bb, 0xd7ade8e0, 0xab6d5cba, 0x937282af, 0x03f69983, 0x99534c3c,
+       0x79c0307f, 0x1ccf33ed, 0x3df58abf, 0xf803ae0e, 0xe6bce099, 0xe63347f9,
+       0xedf37b40, 0xb9b426ad, 0xf5a1cf43, 0x76a4ef6e, 0x4cab4b71, 0x23c519d3,
+       0x86b95465, 0xafd90b08, 0xe48674cc, 0xc6c934b3, 0x3d10a7ed, 0x50f80eb9,
+       0x644af08f, 0x38d0af04, 0x49f8e871, 0xdefcc905, 0x1a52e2e4, 0xa7454377,
+       0x5d90e31e, 0x4ec57aae, 0xefa9f4f2, 0x7bb1fb42, 0xff23a73a, 0xc81a1577,
+       0xc1f87e1e, 0xcf119349, 0xc51265de, 0x7bd17ad1, 0x233dbac8, 0x1cae9cf5,
+       0x7f28cd8b, 0xdbb9ccb7, 0xfec3e8ec, 0x8b3152d8, 0x965a2fce, 0xa5633b70,
+       0x88e481bd, 0xe7b942a5, 0x71cbd8a2, 0xa213bfaa, 0x3754b727, 0x9bdef198,
+       0x8590de7a, 0xed97dbd8, 0xbbbd1fbf, 0xf18bf961, 0x2aee4fa8, 0x79c78869,
+       0x4ff0896f, 0xd5df1377, 0xf2029f93, 0xf1e51e38, 0x920e91a2, 0x7ff2dd2f,
+       0x0e3b39c6, 0x5569181e, 0x43db8af8, 0x417fe25f, 0x928d66bf, 0x1c6014a7,
+       0x8e44b52d, 0x74bc6076, 0x00d3bbdf, 0x7abd93ae, 0xfb8d63f2, 0x2fc1f481,
+       0x49382632, 0x681e9e5f, 0xac9d22b0, 0x8f46fc6a, 0xe2ce6bf7, 0x7fe855e9,
+       0x87b70255, 0x9818c556, 0xa1f342df, 0x2e754f45, 0xf5a7a866, 0x0137dc09,
+       0x798fc5bf, 0xfd102316, 0xbaf18e4c, 0x298700ad, 0x30bbbe31, 0xd7ac4aad,
+       0x129c60d9, 0xf080b447, 0xc563a29d, 0x9daf1e06, 0x115cf385, 0x59c511f3,
+       0xd1c5a727, 0xc5a3547d, 0xc9fbc3ad, 0xf6d5677a, 0x8bce8cb5, 0xb015bc51,
+       0x8ce1f74a, 0xb6bdc718, 0xeeab8e27, 0xdcf1a913, 0x04290575, 0xffc1212f,
+       0xcb23e22d, 0x1ef1101a, 0x403e987e, 0x46aaf8f6, 0xcd41f913, 0x91da3b09,
+       0xf823323d, 0x3e7aa43e, 0xb163e017, 0x0c567c02, 0x95d69bbc, 0x17bb1494,
+       0x91faa5e7, 0x50af20f1, 0xcc2565de, 0x4beb8a9b, 0x4aedc37a, 0x0cc67a86,
+       0x1660365d, 0xa2b9eae0, 0xc61eac78, 0xd8583c21, 0xabfb4c38, 0x40d122bf,
+       0xf2d0d8f1, 0x5c780b27, 0x21050b32, 0x135eebae, 0x755dcfdd, 0xaaf7bee0,
+       0x301e7e50, 0x6767c939, 0xffbc1481, 0x66771dde, 0xaeddff7c, 0xdbb5bf9c,
+       0xa63f740d, 0xf8ccbe3b, 0xe71abcbe, 0xd9e51a88, 0x31f2788c, 0xc7f421c7,
+       0x8f71abfe, 0x4fca461b, 0x6dac7f60, 0x63c515c0, 0x68eac6c2, 0x8529279f,
+       0x05f78279, 0x5feb2956, 0x7a870dd5, 0x75f5ea3b, 0xf6079428, 0x378d870f,
+       0x2226bbe7, 0x88ec46dd, 0x47dafd47, 0x171343bc, 0x79287bc1, 0xfa6204b1,
+       0x9c79aa93, 0x3cea6624, 0x5348778a, 0x0ad93ef9, 0xdcfc6016, 0x7c84c0a0,
+       0xfd4beaba, 0xe887700d, 0x927accd7, 0x90ae9193, 0x7f2f48b8, 0x6576e645,
+       0xa2dbdc88, 0x02f1f9f0, 0xcf91ee25, 0x93e7bff2, 0x5228bb25, 0x1889f7d9,
+       0xe8724295, 0xd90a5711, 0x411cc443, 0x9d9cbef0, 0x87b15073, 0x8f9ca77e,
+       0x83e72bf7, 0x83e72b0f, 0x0b77c55f, 0x863f90c0, 0x7a4016ef, 0xe549c9bc,
+       0x2815346f, 0x6fe399ca, 0x4892ee45, 0xf9941fb2, 0xadf994e9, 0x25734eb0,
+       0x6d567e03, 0x5879d3d3, 0xe984c263, 0xaf32cf68, 0xdb119edc, 0x7587ef73,
+       0x9efcbfc2, 0x095da773, 0x3a4f3a1e, 0x3ff7cac7, 0x542d7c55, 0xb612afea,
+       0xc75f9019, 0x36e16a76, 0xc6a452fe, 0xda622cae, 0x4d1397f3, 0x4bf53443,
+       0x97f3daac, 0x6ad7ec93, 0x68764fbe, 0x975e5fcf, 0x1f643e31, 0x0b574b56,
+       0x806e8013, 0x7d33aa4e, 0xd685ff34, 0xcd7b8a52, 0x74c7b90d, 0x3f36ab47,
+       0x2fcda7df, 0xabcdaddc, 0x46c3c9e7, 0x9230f429, 0xf131fc8d, 0x0cf7e44e,
+       0x0107ef85, 0x3ab36fbf, 0xcfda1199, 0xf8bf7816, 0x1b00c61e, 0x76c94bed,
+       0xe3ac238c, 0x5cb09ff7, 0xc3bdcbc7, 0xbe7af695, 0xdb8ec56f, 0x4b1dbee8,
+       0x06ede1cc, 0xfc7eeff0, 0x72f1a48e, 0xfe87af0e, 0xa21bd612, 0xe5c353f4,
+       0xfe459c93, 0x33ec9b82, 0x62b36b23, 0xc2fe016a, 0xe9399a34, 0xab0c759e,
+       0x9075bf27, 0x51327f72, 0x43bca4e8, 0x3e6186b0, 0xf0a67045, 0xe48f85f8,
+       0xfe4950c3, 0x89f12a75, 0xf447745b, 0xb90d97e6, 0xaaf007ba, 0x910286f8,
+       0x5623e2e4, 0xd8f9ef46, 0xbf13f75c, 0xb016c36e, 0x8f6b336e, 0xf87a1549,
+       0x61bcede7, 0x5c135fc4, 0xb52fda0e, 0x780b2415, 0x8588a52e, 0x4536cb9c,
+       0xc4a3e869, 0x5f42171a, 0x4be84243, 0x9d7f7f4b, 0x3945d5ec, 0xe842ce90,
+       0xe5be2ff0, 0xaf182c51, 0x05fa8f4c, 0x7689d58f, 0xca9e054a, 0x754f9602,
+       0xee319b46, 0x73d18b67, 0x3fd8a579, 0xab9f4aa5, 0xb2eb59e4, 0x566bfbe1,
+       0xf6e649d1, 0xf13d2dba, 0x96df1825, 0xea35f600, 0x5c919963, 0x1fd3b07d,
+       0x7fd43576, 0x65fffc04, 0xeb1bfd0c, 0x65efbc64, 0x5f10e4b5, 0x7949623f,
+       0xd05ef300, 0x437f58e8, 0xe5aff731, 0xef826ce8, 0x05bea151, 0xc23da5ef,
+       0xc1a94cf2, 0xfebc2df5, 0x5164597a, 0x31189f90, 0x9dbfea82, 0xcef86667,
+       0xd9a07781, 0x63ec7187, 0xdd77acf2, 0x7b7feb41, 0xaf07d714, 0xa8f11c19,
+       0x7c991e0f, 0xd287a677, 0x685f8d74, 0xbee4104b, 0x8f8517ce, 0x92bd7236,
+       0x78c7e25b, 0x34c2747c, 0xfd039957, 0xe90bb71d, 0xf112e742, 0xfd375be8,
+       0xa87e2b44, 0x0fc106e4, 0x5d749b4b, 0xe3ff430e, 0x35770b11, 0xd59e291e,
+       0x02f98652, 0xd903ee91, 0xd9ebe25c, 0x7e02aeb8, 0xe54af0fe, 0x181ea871,
+       0xbfdb9a32, 0x3c448693, 0xdffa1430, 0xb15a2450, 0x2b7a0dff, 0x4ef1e7dd,
+       0x1757e466, 0xe097eabb, 0x11096dbc, 0xda6fcf0c, 0xbe781a0a, 0x00ccc0d8,
+       0xbd6b934f, 0x4a69f117, 0xf6c08cf5, 0x7a7e0747, 0x5b19ed1c, 0x703a4882,
+       0xaef9cba2, 0x2817eb1b, 0x79e29df1, 0x9b3c70eb, 0x599ab445, 0xb9541c0f,
+       0xcbc99ebe, 0x0ab2ffc9, 0x0accdef4, 0xce0d436b, 0x708491e7, 0xae6df3b2,
+       0x79e20b06, 0xd13d40c3, 0x7f224941, 0xc2556a57, 0xffcc0ab4, 0x7191a062,
+       0x1f2ff3be, 0x5381fe8a, 0x5b3575a0, 0xc75e681a, 0xc139892e, 0xa9a896ef,
+       0xcf85a1d9, 0xf8f146ef, 0xf1e30990, 0xf5b79f80, 0x8b9a9ccc, 0x78a7a3f4,
+       0x6b7c7f53, 0x7ece5d73, 0x2afe61fb, 0x110b0394, 0xc29785be, 0xfa404f98,
+       0xfe61293d, 0x5b017f77, 0x60d9d680, 0x6e41fec1, 0xbfa2fabb, 0x7e9cd188,
+       0x4b0e0b9b, 0xd7824ef8, 0x341f1021, 0x444e4e5b, 0xb528783e, 0xa1e8e88c,
+       0x899a8f82, 0xfcf3862f, 0xeef779db, 0x137a3c41, 0xe77f69c3, 0x315982a1,
+       0x60bef4c1, 0x32f44894, 0x4e616fee, 0x9463e23f, 0x91fbf881, 0x8c56c708,
+       0xccf3794f, 0x824bbf64, 0x986cd975, 0x2862c4e7, 0x5da2fe87, 0x7ef13e62,
+       0x0b8f0575, 0xd57e302b, 0xf8843b65, 0x31664a90, 0x3949ae7e, 0xef9114f7,
+       0xb435435c, 0x25956ffa, 0xd8cfde97, 0x4270d092, 0xbb20b6d9, 0x5722906a,
+       0x45889406, 0x5906df28, 0xeb655db8, 0xbb940594, 0xaa47fba1, 0xed29d7be,
+       0xa65b328c, 0x371b54a3, 0x7d7015d2, 0xe97f6a1b, 0xc35edc2c, 0xae8fbc3f,
+       0x893f35cf, 0x317438e7, 0x197f7ada, 0x0a739ca5, 0x3a54afb1, 0x7ae560df,
+       0xd1ae4362, 0xa1bd7487, 0x2a59db98, 0x47f2ab1f, 0x872abf85, 0xef7e7bd4,
+       0x5195f628, 0x87365e4e, 0xe599eae4, 0xd4076f78, 0xc317739e, 0xfa56897b,
+       0x1f72aefe, 0x6f6294f1, 0x5bd8a7bd, 0x5bd8a1ff, 0x05bda3ef, 0x835186f9,
+       0x1437bf08, 0x08dd762e, 0x20901af3, 0x3a14df11, 0xedc44c4e, 0x271971af,
+       0x61d97d2c, 0x0ea2d111, 0x348f05e3, 0x36497bf2, 0x1598ed97, 0x95cf59f1,
+       0x766b2cf9, 0xbcbb3469, 0x7ae3f27c, 0xe43ed1d2, 0xb9557beb, 0x994c794f,
+       0xfe6571ff, 0x57f3286f, 0x43498fed, 0xbca132be, 0xefaf10df, 0xfc297e47,
+       0xb9d0a729, 0xb57950a8, 0xe908c401, 0xfc9122eb, 0xe778209f, 0x25bde46a,
+       0x4ef5f720, 0x1e68c959, 0x7660dbbf, 0x7c462c57, 0xa714664e, 0x27aae89d,
+       0xb90365b9, 0xf8b37245, 0xca6ceb5c, 0xe5833847, 0x6381519e, 0x8e5acbb1,
+       0x4638be72, 0x24571f4f, 0x5bbdd0a4, 0x1d0efed5, 0x0cf072f7, 0x82a66795,
+       0xf3e25ef5, 0x6c7247ff, 0x8ee3e32c, 0xfd3a24bd, 0x4f1cde5c, 0x91237926,
+       0x5fed0a7c, 0x636f3795, 0xbe2064cc, 0xfba1644f, 0x610a7700, 0x9de7844e,
+       0x3f307c28, 0xff7dd197, 0x673d8ac1, 0x01d1de57, 0xceb8a14e, 0xf5b04ed8,
+       0xfc7af883, 0x1bf75325, 0x8f8edc6c, 0x9a27e4d6, 0x4bf535e2, 0xef9ac9ac,
+       0x35c3ec93, 0xb23b27df, 0x32ebf935, 0xffea6946, 0xc9a459c2, 0x593050df,
+       0x2e4cbf53, 0x6665e4d3, 0x0e4877a5, 0xfa1eed36, 0xa7fd1eb1, 0xa71fa1b6,
+       0xa14f86f5, 0x0e0bf0f1, 0xa3b5e160, 0x00e8678b, 0x87518546, 0xfc864cef,
+       0x6793d1c6, 0x0aef80e8, 0x3afe1f07, 0xd3685819, 0x7f3c29e8, 0x53afe1f5,
+       0xf465bf20, 0x863f3c75, 0x3adcf091, 0x2f0cea7a, 0xea1c59e0, 0xd0347479,
+       0xea972df1, 0xf83da28f, 0xe6d365c7, 0x4ef84b26, 0x06625940, 0x8a6ce7cc,
+       0x7efc61e7, 0x15acec73, 0xfc761178, 0x8f74f577, 0x79a337ed, 0xfc8b8ebb,
+       0x8b8e8d5d, 0xbb0d1dfc, 0x53f6f1c8, 0xcbbef553, 0x7e9a0e04, 0x64115fdf,
+       0xfd05af7e, 0xdc6939cd, 0xfd14c4df, 0xdfd14c4d, 0xcdfd14c4, 0x6fee7a39,
+       0x26fe8a62, 0x89bfa396, 0x324d5be9, 0xb934efa5, 0x726f6d28, 0xbf7dda53,
+       0x6ae729e0, 0xef380a3d, 0x985b8b4f, 0x1117e4c3, 0x4ae7a14e, 0x4f9df43a,
+       0x45ca7ed0, 0x12fbc0e6, 0x394e2287, 0x39acbf70, 0x2e7444cf, 0x4c3bb674,
+       0x9730bdf0, 0xb62f9be7, 0x617e503b, 0x8e9eed1e, 0x946cb6e8, 0x16b5cdbf,
+       0x35bbee27, 0x23c7f45f, 0x1bd6149f, 0x714cdee8, 0xe9c52767, 0xbdfc2d0a,
+       0xc7114384, 0x91e3288e, 0x9179da5c, 0x277c45f9, 0xb0eedcc7, 0x3f60e32a,
+       0xea326e30, 0x3025c2b7, 0xbf5bf52e, 0xb0a9fa98, 0x842b8f74, 0xe1fa6b8c,
+       0x410a2771, 0x3176a6e3, 0xc701177a, 0xf5c66875, 0xfc3f744b, 0x78c25fa2,
+       0xd3b44761, 0x354d718e, 0x21df8c5f, 0xdfcf45bf, 0xf8742c5f, 0xb893d425,
+       0x5bef89bd, 0x33d881c6, 0x1f0d79d3, 0x47a865c9, 0x5d9db971, 0x9a179d7c,
+       0x9f900bfc, 0x6077958a, 0x7ba58cc0, 0x730c4c9b, 0x9128bea2, 0x38363bbe,
+       0xe339df17, 0x1b15a0ef, 0x1f90dbdd, 0xde5c74eb, 0xdf3318b0, 0xcfb5d057,
+       0x3bd415ff, 0xec983b19, 0x4bfb0495, 0xb404752c, 0x44cae45f, 0x5b24e3bb,
+       0x7568724f, 0x8f7fe794, 0x31be7a06, 0xf4505eb3, 0x7763f527, 0xfdc0ef85,
+       0x86578e88, 0x4d1f21e5, 0x645e3a33, 0x1f7fbfc0, 0x3cfc44dd, 0x8791ca2d,
+       0x7dfdac2f, 0x8f9e0af4, 0x3788bc73, 0x69acad83, 0x8ffc7146, 0xf1452f3f,
+       0xa79a740d, 0x7fb43a0a, 0x765373d4, 0x063613d1, 0xfaeb54e0, 0xd7e7c0ca,
+       0x7078c069, 0xc10718d4, 0x4661e06f, 0x273a98e7, 0xe076f847, 0xfa80df7e,
+       0xb2878c6c, 0xd61e474c, 0xd277d24b, 0xef8ef27d, 0xa827fdf8, 0x50537919,
+       0x8389fefc, 0xf8afab92, 0xdc31c9e3, 0x6a945d4e, 0xa8788759, 0x944c9bb3,
+       0xe748bc1e, 0x9dce9982, 0xd96bf18a, 0xa97bf7d0, 0xfae18eaf, 0x41a57921,
+       0x74410231, 0x30e594c2, 0x0cbde6a6, 0xbbf6d0f4, 0x8bdfbac3, 0x43327003,
+       0xdef3c89a, 0xeb178f1d, 0xac65f534, 0xe31dfddf, 0xbda7acf4, 0x8fcddbfc,
+       0xc6554f2f, 0xc7997a43, 0xd50c7fc8, 0x6d0b6b3b, 0x843f3bea, 0xcc63c7e7,
+       0x523de9db, 0x14877949, 0x4e315aea, 0x3de8ce11, 0x37bfc1ae, 0x9e819afb,
+       0x3d399a76, 0xdd3c8aa7, 0xeafaf229, 0xbbeaa53b, 0x7a14cf6b, 0xa3cc2b6e,
+       0x8fd4fc7e, 0xdf1b37b4, 0x6d6788cb, 0x6efabe34, 0x012f5a94, 0x2b0920f4,
+       0xe23a675d, 0xfb1250ab, 0x63e7e784, 0x1d20e68a, 0xb2f2685c, 0xcdf4824f,
+       0xc6c8f085, 0x49d5fc60, 0x3f5af7da, 0xda81331f, 0x1b6beda9, 0x284fb227,
+       0x3a27e978, 0x69154daa, 0x624ebd1f, 0x9c3be2af, 0xa80d5920, 0xa776d597,
+       0x78e2de40, 0xc5fc82ef, 0xbb903df4, 0x3ed1e89f, 0xfbe94e9d, 0x3f2a1e4d,
+       0x694d54dd, 0xca9ea9a0, 0xa46a6a3f, 0x23db96f4, 0x167f9172, 0x3ec65fed,
+       0xdaf7a209, 0x1027bd36, 0xd4553f94, 0x51ad1d37, 0x7254e8e8, 0x1c9fdfdf,
+       0x53bbedc3, 0x3b3e38e3, 0xf7c0dec0, 0x972e80da, 0xdbfd6d5b, 0xfdca1d1d,
+       0xf9e3a3ae, 0x3c4765fe, 0xc31f2fcf, 0x64596efd, 0xe8fed8ad, 0x3fef0378,
+       0xefc6ac45, 0x7bf78db2, 0x77a45d2a, 0xb1357ea4, 0x5831fee8, 0x73ca163f,
+       0xaea7f27a, 0x41e5dfe2, 0xaf9d5cbc, 0x42b6fdfa, 0x61eefaab, 0x8fcf7f3a,
+       0x7a02f7df, 0xfad5fea7, 0x3e702663, 0x4befad0c, 0x43c9e7e5, 0xc2a9f1e1,
+       0x6817c4b7, 0x241f2367, 0x9d45f107, 0xa542f883, 0xd6fe9543, 0xa7387216,
+       0x0f3a151a, 0x07eee7e7, 0x76842ea3, 0xb4cce383, 0xbbe3208f, 0x9d9eb0cb,
+       0xa12fc282, 0x63bca0fc, 0xca83f2ac, 0x0fbd2a07, 0xefe33e06, 0x8c75f334,
+       0x5f79fa95, 0x7b475958, 0x845dc46c, 0x2b7a83d7, 0x12b1adea, 0xb0792f7f,
+       0xedcef5d8, 0x11b19fc8, 0x96918c0e, 0xf7d4b2ac, 0xfe3ec725, 0x9543c2af,
+       0xa3c0fd0b, 0xca0c1c17, 0x123fc3bb, 0x50e7240e, 0xf6fd238e, 0x8c4eb721,
+       0x177629b1, 0xc7cfdfa7, 0x1d226fc8, 0x1d660875, 0x30e87bde, 0xf05f7df7,
+       0x0ebe78e8, 0x16d68e95, 0xe3074a32, 0x96f6873a, 0xba7aea7b, 0x230779d7,
+       0xc61a97f9, 0xacf143cb, 0xfe482bae, 0xa979c19d, 0xec0c64f0, 0xa127e81f,
+       0xe8ef42c6, 0xe0e856dd, 0xd3f036fc, 0x67ac0dca, 0x3e8a35fd, 0xf8944c7b,
+       0x7e8ac87b, 0xa4172ee9, 0x1a996599, 0xcf4743bd, 0xefe15f3a, 0x5645fb8a,
+       0xa372ef8d, 0x171c1d6f, 0xe5c8521f, 0x3cf4d743, 0x2f13f711, 0xf742d5fc,
+       0xea0c2f8b, 0xcef68d3c, 0x533d5685, 0x2a9b23de, 0x8b9dde80, 0xf90c133e,
+       0xf39ef2a5, 0x0ef7e8e7, 0x176d7a83, 0xb5bda34f, 0x4cc4ab68, 0xeb609e78,
+       0x3d20b737, 0x4f457bcd, 0x5b9a99e7, 0x7a471e37, 0xc04fb73c, 0x85d96fe7,
+       0x31c5027d, 0x7c225b6b, 0x0a5fa866, 0xc77fac79, 0xe3c7c96e, 0x39c5328b,
+       0x3ef1946a, 0xa0a5d731, 0xeb713e5d, 0xfb843a5d, 0x8b02edbc, 0xb48f7e83,
+       0xdf0c79de, 0x8db7391d, 0x366b2fdf, 0xf9c0ee47, 0x0ceb4a97, 0xc17ca083,
+       0x635e5e76, 0xf70cfd29, 0xcd3c1743, 0x60b3fe28, 0x8ff9046f, 0x1ff45af3,
+       0x8eec8205, 0xfcda6dea, 0x4066d67c, 0x53b0583a, 0x07b35e5b, 0x79f241f2,
+       0x2f12a150, 0x29b2ce19, 0xe3c2d25e, 0xef7caa07, 0xb97b5f6d, 0xde506d1c,
+       0x897f66ff, 0x5f0ff7a5, 0x23e926f9, 0x2997cf0b, 0xff9033f9, 0x178e1bea,
+       0xca752e15, 0xb3c55fd8, 0x675836dc, 0x2b662bdd, 0x0775edfa, 0x79e246ce,
+       0x016145b0, 0xbd99177a, 0xded1592c, 0xe4bf607b, 0x1ed6f845, 0xfb893f34,
+       0x9e2f7598, 0xa13c6030, 0xb262df74, 0xef312657, 0xfd9bf44a, 0x89dac8a2,
+       0x7de9da8e, 0xce77265f, 0x1c2e7ec3, 0x0ed15b30, 0x4ff97ba8, 0xfcc76ec7,
+       0xa7dd028b, 0x201890bc, 0x55b7993a, 0x0c437ba2, 0x1efcb42d, 0xaf10913a,
+       0x28b6e788, 0x0ee58f7a, 0x19e23bc4, 0x4648eef0, 0xd071e13a, 0xf44b4f79,
+       0xd9b5b9bd, 0xf9cff580, 0xbc557e38, 0x094b4a97, 0xe71e0bcf, 0x75b89cf8,
+       0xa430e6d7, 0x64f5a783, 0x76811f8f, 0x0d3b7883, 0xe15e181d, 0xc5d85ffd,
+       0xd37791cf, 0x376301c1, 0x2f3ce01d, 0xa7c00747, 0x472ff7a4, 0x97e89d07,
+       0xddffbf92, 0x0ed0c7b9, 0x87e7e08f, 0xd51b77d5, 0x2e071a77, 0xdf14753c,
+       0xbfb34ae7, 0xa5777640, 0xc5da8bed, 0x9d09de8c, 0x4be78853, 0x02bdbf26,
+       0xca7277d1, 0x2f14d9b3, 0x6d7607d5, 0x744378c1, 0x3ac7c538, 0xe1b6cb92,
+       0xb6c598fb, 0xc2f6936f, 0xcefd163a, 0xeb11e748, 0x3fc67e15, 0xbea2073c,
+       0xa7780c4b, 0x07b519f3, 0xc65cfc8d, 0xe1fbed3e, 0xce9cf11d, 0x959d0c4b,
+       0x804fd18b, 0x411c70fe, 0xc2e9fee6, 0x451dfc83, 0xa85c9fd5, 0x47b8a7be,
+       0x60836efb, 0x3dea9b7d, 0x70429850, 0xd6371a18, 0x73797681, 0x0d84f339,
+       0xc17d21fd, 0x5c7ca9df, 0xb5fa8bf1, 0x1bd1fb27, 0xbcc91daa, 0x15daf721,
+       0x014775b9, 0xbbd1e39f, 0x7be1d0df, 0xf93b1d8c, 0x3fcc3bef, 0x062af208,
+       0x1af519f7, 0xd4a753b9, 0x0fe914ff, 0x5bde76e0, 0x052892ff, 0x8bf797cb,
+       0xa79a9fb1, 0x48753f79, 0xf5571457, 0xfe830e6f, 0x33d36cbe, 0x4c0597e4,
+       0x23fb3791, 0x4bd46e28, 0xbedcecbe, 0x50f7cd12, 0x76085aba, 0x94222e26,
+       0x69f6eabe, 0xa85d3deb, 0x670e7bec, 0xfff9e0d7, 0x90e031af, 0xba5f23d7,
+       0x8e67e9df, 0x6eefe428, 0xef68287d, 0x056b0fef, 0x77ea0f96, 0x63c4cfb8,
+       0xeafe4aa4, 0xfe4d56dd, 0xa6bb369a, 0x1dfbb5fe, 0xfed9ef9a, 0x11f7cd0c,
+       0x7c9a9dc7, 0xa6817b5e, 0x64f7c8fe, 0xc0547e4d, 0xe63fa9a5, 0xef935bbc,
+       0xf4f584ca, 0xe9a8cf61, 0xa9a0bb24, 0xd661d93f, 0x465d7ff4, 0x65df26b4,
+       0xd8a3e051, 0xfbfdaa99, 0xff6e42a7, 0x7c2aa686, 0x8ed4e17f, 0x37edfaa3,
+       0x2bc76814, 0x5de3b593, 0x1df05e29, 0xff9e9d41, 0xf8a6027e, 0x34ba09fb,
+       0x9809fbfe, 0xc04fdfc7, 0x013f7f14, 0xe4dd7fcb, 0xa6befca4, 0x04bfca02,
+       0xf7e6097e, 0xe9829f83, 0x609fe0cb, 0x77e0e5f9, 0xb8f7194c, 0xca1bee32,
+       0x4e153fb8, 0xbdfd296f, 0xef87f4a3, 0x3df4ea0d, 0x795d6bdf, 0xe3e025e2,
+       0x7467db22, 0x086e595f, 0xa31c6294, 0xe18975f3, 0xf1e667f9, 0x418a6f1d,
+       0xa18036fd, 0x9ddcc49d, 0x6e3ee26f, 0xad438bdd, 0x81efae78, 0x07787ffd,
+       0x27d85fbf, 0xf0e6bc51, 0xd891b3fe, 0xc29797cf, 0xe90a30e9, 0x7cd7c845,
+       0x0d7e502b, 0x6773c77c, 0xca4af793, 0xa46d67bb, 0x554cbeef, 0x2fba3ef3,
+       0xd7b3deed, 0xb85a7880, 0x7f7d2f7b, 0xf35af81d, 0xcd76f77d, 0x87d62b77,
+       0x47cea174, 0xf7cf8571, 0xa9f9fdab, 0x7f2a4d7e, 0xddf3fe3f, 0x418e5647,
+       0x6ab7bc7d, 0x17b5c600, 0x3b1139ee, 0xf1f007fb, 0x66cf4bd5, 0x3da81ea2,
+       0xd1e72920, 0x07b57f78, 0xcf9e4af4, 0x6f7526bf, 0x63379e29, 0xb3ba047b,
+       0x4f5b25f4, 0xee16c4e7, 0x728355df, 0xedc66176, 0xb57f8a7a, 0x83bc4a49,
+       0x6350d3bf, 0x6baedc65, 0xdf123afb, 0xdb7dffa9, 0x1ef1ebd1, 0x23c1c774,
+       0xc74c5ef4, 0x4fe3493e, 0xf1cb1d8d, 0xf72c763b, 0x77dcbeff, 0x09cf1224,
+       0x8476d03e, 0xa7e75dc3, 0xf2561ff5, 0xbc12901d, 0xfeb44bf7, 0xcd2497f9,
+       0xc0b801ef, 0xcdfba171, 0x7022d3fb, 0xf8db275d, 0x7d40d378, 0xd56a7950,
+       0x1bff9c1c, 0xe53cf2f6, 0xddfa327d, 0xaeab8ea1, 0x767285db, 0xe7d49b61,
+       0xd839f779, 0x98efcc2f, 0xebe9d39e, 0x1b1c2fa9, 0xc37f7004, 0x749b2035,
+       0x62af5284, 0xa59bd72c, 0xea2a4f06, 0x47169391, 0xfdf9d204, 0x8811a1ae,
+       0x6298c3df, 0xba49ebb9, 0x1f60be07, 0xb5a4ef1f, 0xeee9123d, 0x5211bee4,
+       0x2dcbfef0, 0xe9ba7aca, 0x5e6f1bbb, 0x6fb553c2, 0xe9fb05bb, 0x9f2f1fc1,
+       0xf54ad636, 0xb89df0df, 0x93aced05, 0xc0ddfc19, 0xfe460663, 0xdc3dc2f5,
+       0x70793e4e, 0xfbe0f6f0, 0x7c14d359, 0x7df06474, 0xf5fb0bf5, 0x77dbbd4a,
+       0x3d3d4d31, 0xed4ed7c7, 0x33beac7c, 0x5e7da10f, 0x6744b8f3, 0xf5f46a1d,
+       0x4ffeb8b1, 0x57e769b7, 0x46b9c0ad, 0x0d8d8fef, 0x039ad7a2, 0x21637cdd,
+       0xf2a03f3a, 0xa9f08389, 0x8664f1e2, 0xe765e7c4, 0xecd5f8ef, 0xdd7445dd,
+       0xe3c4be3b, 0x31ef83b7, 0x74be2939, 0xb55a7f19, 0x2dfc821b, 0xbd23bdfa,
+       0x989e686b, 0x9c1f63d2, 0x1a1f942e, 0x987e879b, 0x93ccfc9b, 0x185bec0c,
+       0xebed16b3, 0x891dfa28, 0xd76e38cd, 0xffbd3d3e, 0xb03a6b5f, 0xef23df00,
+       0xc0a30272, 0xe9b6bbbc, 0x4667dfbb, 0x629e773b, 0xf0ea7ee7, 0x7fa04be4,
+       0xb489976b, 0x923d9abe, 0x5c17cf0f, 0x57dee450, 0x406f937b, 0x2e39ad7a,
+       0x9a3fd159, 0x70fc96d8, 0x77e92e61, 0xdaeb57b2, 0xb75c9db8, 0x58bb205b,
+       0x156a43b5, 0x629ce43b, 0xd65b9f07, 0x57e3edc9, 0xea11b604, 0x7b030dad,
+       0x9b5de604, 0xdaec8539, 0xcadd695a, 0x473c0ec1, 0xe61bb5a5, 0xe7443c1f,
+       0xd1cec0ae, 0xaddc2f94, 0x69b6d7cd, 0xf8bfaaf3, 0x3b6ed8d2, 0x37fa3863,
+       0x1c615225, 0x0a9bc3f2, 0xe77f555e, 0xf49c6bce, 0xe80f27fb, 0xb8d4531c,
+       0xd16bc204, 0xc7cc2f2b, 0xc26afb79, 0x347fe49c, 0xdae096fe, 0xd7ee17f1,
+       0x1bdee074, 0xf0e333f2, 0xe9cfd8ed, 0xf05e917c, 0x2cbaefe1, 0xfd815d42,
+       0x32df0499, 0xbb7b3b8c, 0x293e4922, 0xca1a08e7, 0x632affb9, 0xb2a6180c,
+       0xe7f72c7e, 0x38eaf543, 0x0e8a405d, 0xb1811392, 0xd8af5429, 0xde57cfc0,
+       0xfd24e119, 0xedc4c436, 0x6e2621f5, 0x75d10faf, 0x85dfa32e, 0x7df02418,
+       0x6997ac8e, 0x9d6d60ff, 0x0417f685, 0xe10e957b, 0x955076b1, 0x887de90e,
+       0xfd032db5, 0x8c5f353a, 0xec7b33df, 0x478b5283, 0x8cece387, 0x047d9417,
+       0x74cb4fae, 0x90747d56, 0x996c657e, 0x3dea7e66, 0x7e7d9fcc, 0xa59f9856,
+       0xef807e67, 0x75ff6c28, 0x86ec93ae, 0xf7f532a4, 0x2e49ea1a, 0x12fcf0a8,
+       0x7018bde8, 0x816c7745, 0x1db66a6e, 0x96b2ff22, 0x76c4afb5, 0x1d7c91a5,
+       0xbefe06a5, 0x4f186951, 0xfcb8e375, 0xa5d2512a, 0xc3f6b4e3, 0x7eb27191,
+       0xc63ba41c, 0xf2e34db9, 0x79953f68, 0x6f0d7d61, 0x43d677f3, 0x13943ee5,
+       0x7c0d7d3d, 0x466ff288, 0xd54d60bd, 0xbf9c69d8, 0x6ea2f116, 0xf6f85a3e,
+       0xea27c493, 0xc66acc39, 0xa3667bf9, 0xc41a9ad9, 0xdf908b17, 0xc377ded0,
+       0x138c7cbf, 0xeb6abff0, 0xe9973a7c, 0xa2b58c69, 0xfa48b75f, 0x7e25f692,
+       0xda2ddf2c, 0xcdfbcdaf, 0x11fdfe9c, 0x1949f902, 0x0de3bae3, 0x0a498fc4,
+       0x08f76c7f, 0xfb600e74, 0xcf1e3a77, 0x7e2810ab, 0x36143377, 0x624994da,
+       0xba22eabd, 0xe333724f, 0x4b596347, 0x3dbbf28c, 0x796fb431, 0x9beeb293,
+       0x2843fe75, 0xdbea8e57, 0x749e3192, 0xc4e4d6b4, 0x1b59cbfe, 0xc15a6fbd,
+       0x153d29da, 0x9fa2f75e, 0x2226f73a, 0x63c9fddd, 0xf6d678a4, 0x50223be5,
+       0xe5b167be, 0x044fdc56, 0xb7c6ec50, 0x73b3fb01, 0xd51df742, 0x2f60c4fb,
+       0x027d21c7, 0x1d2127fe, 0xd8dc079c, 0x5fb77a73, 0x2317c7f8, 0x2c5f7f11,
+       0x5b96e179, 0x9d5ffa19, 0xa82d47e4, 0x5df7465f, 0x33da9c81, 0xaaf07bf2,
+       0x5bc55de2, 0xf01d5e37, 0xb0af182f, 0x938404a6, 0xc91965f4, 0xe8917fa5,
+       0xf0e5d69c, 0xbc7dc2aa, 0x0e3b9f82, 0x8a15f970, 0xb70f156f, 0x43f5bbe2,
+       0x236eef49, 0xc923313c, 0xb87a50cb, 0x3080be1c, 0xc4d93ce9, 0xa1f92318,
+       0x4f2e4583, 0x2813cf07, 0xf33b795e, 0xf48012bc, 0xf5f7f096, 0xc70adefc,
+       0xb782855b, 0x2fdf313f, 0x71ff9232, 0xce323b78, 0x606e34dd, 0xe50dbe6f,
+       0xb2f8fed3, 0x37fce1c6, 0x18fa5f55, 0x3f0863f2, 0x376bf087, 0x2ff09d1e,
+       0xc69e8f08, 0x6ecbe248, 0xae7b4b7c, 0x7fe22f4c, 0x5fb58e30, 0xaf93f9f0,
+       0x46055f80, 0xf8f8bfbf, 0x54dead38, 0xa5c2a6f1, 0x07e0b8bf, 0x2ad47fcc,
+       0xe70abed0, 0x748dbbe3, 0x57dd43ff, 0x5e4ff751, 0x5cf5c719, 0xd801fa68,
+       0xb55fb84b, 0x40e4e326, 0x194f33b4, 0xfef87ed4, 0xdacb07ef, 0xb6f7f113,
+       0xe9e2283e, 0xddff0329, 0x872f350f, 0x07e4b8f1, 0xc22f46f1, 0xf86103e9,
+       0x1f33d404, 0xcf5cf708, 0x070671f3, 0x26e3cbe6, 0x53903de0, 0x798e357a,
+       0xf07f12bf, 0x8f9479f1, 0x027aa62c, 0x074a5dff, 0xf61ddefe, 0x1736082b,
+       0xbb83e7cc, 0x9d7de8d2, 0x718d7dee, 0x467f0edc, 0xdc774759, 0xe2815eff,
+       0x355133fe, 0x84c4fee1, 0x877c2e2d, 0x437df4f3, 0xb4df69b3, 0xea3e3b41,
+       0x978a64fd, 0xfee7e06e, 0xabea752e, 0xb75bf482, 0xc8be2dbe, 0xd1e4e7cb,
+       0xbfa88cef, 0x86db2747, 0xc7dcff73, 0xd550df7f, 0x5fc75d67, 0x73c704b0,
+       0xdfe2533f, 0x0fe1f9dd, 0xc3eb0526, 0x4dad4f43, 0x0daa7ec7, 0x05a72cde,
+       0xb1ee877f, 0xaa5bb424, 0x4e955a9f, 0x0f53f4f6, 0x545fa3a4, 0xba6d63bd,
+       0x0f70f94c, 0xbe3a65f9, 0x1b9e2fee, 0xd4f3e745, 0xdccaf6fe, 0x1d30a8af,
+       0x3dbd412a, 0x56afeae5, 0xda41fee0, 0xffc5027d, 0x15f6b066, 0x332b67a8,
+       0x16b15f38, 0xe87fc913, 0x776bf68f, 0x4ec5ff0d, 0x646f0794, 0x81cfd59c,
+       0x203e127a, 0xd5df1035, 0xdfa3adf2, 0x7fcd5c09, 0x7ea7b027, 0x56ffed22,
+       0x9de8172d, 0xfcf519ab, 0xf1a4f377, 0x59c704d1, 0xd18fb3ab, 0x794b57fb,
+       0x6fa314f9, 0x67ec49df, 0x3fdf818b, 0xe094ee64, 0xb29270fb, 0x9d73385f,
+       0xca717bf2, 0x639b6938, 0x53af07b7, 0x591df652, 0xdf2477ea, 0x32f0506e,
+       0x5789e975, 0x54efd0ed, 0x1e3cc7bd, 0xe9b3bfbe, 0x619faa5c, 0x3a33f41c,
+       0xf066985f, 0xd71f3a3c, 0x7148c3bd, 0xc1acdcd2, 0xcfd41c52, 0x11b45259,
+       0xab4b99d3, 0x728f9d1e, 0xcd94d5b8, 0xf9f2358f, 0x114e0835, 0xed91f4e5,
+       0xb842ceb7, 0x7fc4df9d, 0xfb61abff, 0xc2ddfa30, 0xafdee4fe, 0xf9eff89a,
+       0xa264dd3d, 0x2b26d9f4, 0xcfeba3c3, 0xff29d935, 0x4a0e4daf, 0xcd3cf4d9,
+       0xd7f4d8ef, 0xe14b88df, 0xb973bbf4, 0x3bf4cdab, 0x39460d88, 0x2bc03c75,
+       0x1ddaaaed, 0xc2eb280f, 0xbdb2b8f7, 0x0e1113c9, 0x3e2c0fb9, 0x75b3a686,
+       0x7d97df3c, 0x24eae4f3, 0x2c77d614, 0x7cc4f33d, 0x78fb7ef8, 0x270835f7,
+       0x148bb6d3, 0x607238a7, 0xbbc22555, 0xaf91877a, 0xf9f7594f, 0x8f71e94d,
+       0x75f97c62, 0x160dc53d, 0xc4f33b6d, 0x877f0c03, 0x9821b177, 0xbd74afde,
+       0x7ee78f57, 0xaaf8e5e6, 0x78fc383f, 0x449b5abe, 0xf803b3fc, 0xf3a7f32a,
+       0xcba5a2d5, 0xc6cb7e08, 0xb8426fbb, 0x937bd79d, 0x0fce9f90, 0xee744b1f,
+       0xf820457d, 0xdbbc72ab, 0xbfe056af, 0x575b6c50, 0xc723dc98, 0x04b961bf,
+       0x3e0743df, 0xf9fb474d, 0x3fe5fd9b, 0x6097eeb8, 0x1861fedd, 0x1a5133af,
+       0xe0df3dfa, 0xf584ea19, 0x3ef3f7e5, 0x6af1d2e8, 0x539f9ffc, 0x36213fc0,
+       0xe6219df8, 0xd4f9828d, 0x61fc141c, 0x26cfa859, 0xbf43a67d, 0x8fcffc11,
+       0x198ce734, 0x9f4828fb, 0xcbdf37f7, 0x4fd875a5, 0x1ddc8f5a, 0xfcc89ef9,
+       0x547b7a41, 0x83f98c20, 0x73f6edc6, 0xfb40cca0, 0x1724f14e, 0x2e786f10,
+       0xe181c2ec, 0x99ff303b, 0xc2f1e381, 0xf14f604b, 0xf2931078, 0xd9f9d67b,
+       0x50b22f81, 0xb7ae86ce, 0x882fe5ee, 0xaff66a3e, 0xfad028ba, 0xcba67f27,
+       0x0ffafcba, 0x1645f53d, 0x7d33efe2, 0xb6fd1f20, 0x1640860b, 0xb7eea1e2,
+       0x58ff9e5c, 0xf3e5a838, 0xf7e81b57, 0x1304eb3a, 0xf48949d1, 0x2e1fc525,
+       0x87f1e71c, 0x924f03ba, 0xc83aed3c, 0xc48b40e3, 0x8c38d2f6, 0x399fd49b,
+       0xcbacf286, 0xe831fdce, 0x2b71de9f, 0x41e8aa1c, 0xde12675d, 0x4dd83bf7,
+       0x3c8fdc0f, 0x0c3bfc8f, 0xf3a369fb, 0x9c2b2cbd, 0x39f15da1, 0x7c30f3f2,
+       0x257930bf, 0xdf79f9d2, 0x8f941cc0, 0xadfd666f, 0xbf86e28e, 0xb27ba70f,
+       0xe6926db5, 0x3af7799c, 0x703f127c, 0x29fb54c4, 0xe7c1c99c, 0x1b8e0cb9,
+       0x837e6ec8, 0xba2e13ef, 0x7b13f38a, 0xed53f399, 0x7b0643f2, 0x15bb7f50,
+       0xc8ed527e, 0x1bffbf29, 0x85b3e5f1, 0xd504fd32, 0xffc7a54f, 0x4cf7fe9f,
+       0x33412fff, 0x800063ec, 0x00008000, 0x00088b1f, 0x00000000, 0x5aa5ff00,
+       0x5554700d, 0xbdef3e96, 0xdd2749fe, 0x12421349, 0x42068408, 0x03621a88,
+       0xc4d67281, 0x206efce9, 0x6b01bb33, 0x8d08c42d, 0x749d2422, 0x6aece882,
+       0x021a6eb9, 0x367564ac, 0x1d47598c, 0x809f9b47, 0x9476ec28, 0x0da0c040,
+       0x6ba2cb0a, 0x3a26aa45, 0xab545b55, 0xa6e00eac, 0xd63b8223, 0x3be7b8e2,
+       0x1dddb5ef, 0xa6ed4fe2, 0xee7dba8a, 0x9ee7b9cf, 0xce77ce7b, 0x52b48f3d,
+       0x6a22ca22, 0x2a08cdcf, 0x6ea6ff0a, 0x6d4445a2, 0xf67f2429, 0xaf1f4541,
+       0x7dbc64d3, 0x58c9a340, 0xce08eb93, 0x4754419e, 0x459a26dd, 0x654284b4,
+       0x29bf71a4, 0x795bcbf2, 0x6d0dfebc, 0x61931741, 0xb06aad1b, 0x7aa6d513,
+       0x1314360b, 0xaacaab0d, 0x0bcc6286, 0x4b9d2e95, 0x7efe0df4, 0x879b744a,
+       0x2a224f99, 0xf60f14d3, 0x169c9d1b, 0x8b5dc9dc, 0x491bfb97, 0xeaa7984d,
+       0x534f98f3, 0xa3827c08, 0xd81d4b25, 0x9964b468, 0x8eef3e23, 0x07d6d237,
+       0xd2a14e31, 0xf9f6123b, 0x68858f4b, 0xcb17d121, 0x650faa17, 0xdaae79f2,
+       0x51337403, 0x29ed768d, 0x70ddf785, 0x05564ccc, 0xafbc67fc, 0x670239f2,
+       0xfa65ea34, 0x790a4752, 0x4bceccac, 0x1bcf0f1e, 0xd8293b99, 0x3f6fe7c5,
+       0xe78990a0, 0xeeb11db5, 0x6d79e14c, 0x9bb648e6, 0xf036ddf7, 0xdb878b3b,
+       0x2cf7fef6, 0xcf58b9ae, 0x9e433647, 0x6dfa1514, 0x174ff277, 0xce607f91,
+       0x3f3177fb, 0xf44d69ff, 0x67bd37ed, 0x05d7d621, 0x5afd8f9e, 0x82d5f60e,
+       0x56f0a56e, 0x3cfdda27, 0x9bbf48af, 0xe5dff86f, 0xb386575c, 0xf8be7e38,
+       0xa7a25d39, 0x69f8bd18, 0xd602f73e, 0x43eb468b, 0x21ee5976, 0x6e717b96,
+       0x252e8ece, 0x5fae9d71, 0x4b69768f, 0x9d15cb0e, 0x6615b8a9, 0x6c0d4d15,
+       0x851f4276, 0x1797b38a, 0xb97f5f47, 0x9bf42d74, 0x9dbd2c12, 0x90b517cf,
+       0xc7e2c7dc, 0x04b49bb6, 0x6a0f1679, 0x3443dc1e, 0xc90e9a95, 0xe2a77bbd,
+       0x61bca83e, 0xd61267a9, 0x2b7bbe8d, 0x7955196f, 0x73fafdbd, 0x7975ca04,
+       0xc9a9b0ce, 0xd7721b7d, 0x80ede5e7, 0xc400d9fe, 0xfaa94e8e, 0xc7951efe,
+       0xbfd7c7e7, 0x46a79c68, 0xf089ce2b, 0x9dc506f8, 0x9f671ce3, 0xf587bb58,
+       0xe9ef86be, 0xb46fbe45, 0x6938752f, 0xfda26ccd, 0xff42b91d, 0xda4b8773,
+       0xf4914750, 0x16e1d2bf, 0x2dc760fa, 0xf0ea1f42, 0x51d03d08, 0x8ed1ed27,
+       0x033fe906, 0x708cff51, 0xe2ec20a0, 0x4a6d7c14, 0x1cce1e9c, 0x9e494f43,
+       0x24a99c3f, 0x991453d3, 0x3cb870ff, 0xa5fa6018, 0x939ca732, 0xc0d1ca8d,
+       0x4b4e68fa, 0xb40ca12f, 0x674a41f9, 0x037bb1bb, 0x3ffbb61e, 0x43daedd4,
+       0x4bcfc533, 0xf33aaf30, 0xdbf846ce, 0x692b2ce5, 0x1ec3cfac, 0xde63dfef,
+       0x0555d3e9, 0x683fd1db, 0xfef95b73, 0x94dc5787, 0xff47bd01, 0xb78d234d,
+       0xb05a28ae, 0x0ae994b9, 0xcc7622bb, 0xc86e6efc, 0x4fc6bb66, 0xb83553e6,
+       0xe3a4d4ba, 0x02b67384, 0xc1aeb7fd, 0xdb261b3e, 0xfc795816, 0x57f7b94a,
+       0xf7a627d8, 0x0aeb29da, 0xd98bd0bc, 0xf3cabef5, 0xa66eff02, 0x80f79e5e,
+       0xdf649dc3, 0x822bcb47, 0x45c59bb0, 0x07cf36b3, 0xd9ba767f, 0xf5bb3fbc,
+       0x51e7c87e, 0xc14e94d3, 0xb8099731, 0xf3fdc410, 0x452e953e, 0x716c30ec,
+       0x7f993299, 0x2b22b538, 0x194eebc0, 0xb8da7df7, 0x7dc633ef, 0xd5fdc3bf,
+       0xfdcbbedc, 0x1fb88768, 0x9e988aed, 0xd085a34d, 0x0da7f05f, 0xef44792f,
+       0xa3a0f9a3, 0x3b0e5a66, 0xd33f025c, 0x81bf27f1, 0x5ca278e5, 0x036ee397,
+       0x6b6e867f, 0x85d7d3e8, 0x858b4f84, 0x4bffb0bc, 0x9f609f58, 0xf5f175b1,
+       0x9bb2ed24, 0xe7c29029, 0x20b6c3a0, 0x895344f4, 0x0ecb5f80, 0x692e08e7,
+       0xcf8ab329, 0x017a644f, 0xabd29e09, 0xae5e7d56, 0x85fc216b, 0x8cfb2475,
+       0x9980d504, 0x399fc4ed, 0xf2c99854, 0x167e188e, 0x49fd0fa3, 0xcff6fc13,
+       0xd7db9a67, 0xfe7cfd14, 0x13854365, 0xa9b15eb0, 0x4eff33b0, 0xe1acfc7d,
+       0x0699fe87, 0x943ce33f, 0x7dc7ca12, 0xce1d8f44, 0x2ee987bf, 0x1ead787b,
+       0x8285c207, 0x5c2e14df, 0x42549c06, 0xd44dc8e7, 0xaf7dfc77, 0x47d027e9,
+       0xfdd079e8, 0xd3af7fc7, 0x6739df4a, 0x50a4f8e2, 0xfd04e2be, 0x3df74181,
+       0x409dc13f, 0x87395f9b, 0xdfa6cb71, 0x3327ab7b, 0xa783586e, 0xff37603b,
+       0xed97dba2, 0xd027ff40, 0x2b11cb5b, 0x0f2b2ec1, 0x0af67ff4, 0x3bf4b78f,
+       0xa8fb80dc, 0xbbe88667, 0xc7dec8f3, 0x7d236f61, 0xae87f166, 0xfe7bbffd,
+       0x25679911, 0x35bd5b98, 0xcfbc4a54, 0xe37fe3d1, 0xb49f6135, 0x6fd015d0,
+       0x39179c57, 0xfeea27ea, 0xa9f1543d, 0xf5bd0037, 0xc46bf81f, 0x0a0cfab5,
+       0x65e96ec0, 0xe46647be, 0x6a86f57b, 0xc771e12a, 0x6ff04ad0, 0x86eac97b,
+       0xcd5efa9d, 0x5f1f84a9, 0xfb14ccf3, 0x3bb1be6b, 0x3d57711f, 0x23cf6fba,
+       0x23679859, 0xc99edbc8, 0xf57ac476, 0xdd163b69, 0x6bb7f72f, 0xf7206fcf,
+       0x64ed1b3e, 0x03cccd3e, 0x99ef35fb, 0xd1f00c1d, 0xe3fafb5e, 0x1a87b895,
+       0xe83db9ed, 0xa6dbb2bf, 0x2d670f42, 0xf8728c9e, 0xbbb359e1, 0xba0ceb17,
+       0x2ea27879, 0x56a45a4f, 0x3bab2fee, 0x37d7711f, 0x80bfe1f1, 0xf75af5dc,
+       0x3ce2cff3, 0x3884ad7b, 0xeb1f6171, 0xe85dd78d, 0x2dc7cf35, 0x9873ec8f,
+       0x94972f60, 0x82cf95ee, 0xef3eaf7f, 0xf45bad92, 0x439de819, 0x11e78fd8,
+       0x6525f2e2, 0x85ff527b, 0x5e25bdde, 0x97c5dfd6, 0x09bd8bea, 0x17f31bf6,
+       0x526b6edf, 0x6024147c, 0xbf19f25c, 0x3b2019c9, 0x8366dfc7, 0x99e878bc,
+       0xbe296791, 0x737ee2fe, 0x6a3ac2d8, 0x94e6d2b6, 0xf83fb8cc, 0x0ebcfef2,
+       0x3ba9f3e7, 0x34c7910a, 0x84ac882f, 0x51b05c5f, 0x7bcf2e4a, 0xbe5f88db,
+       0x2a971b83, 0x4f2ddf25, 0xc7ee854d, 0x38f57357, 0x16c07576, 0x1ddf280c,
+       0x83a3fe8f, 0x8eccef9c, 0x67af77d3, 0x7e71297e, 0xad425b6f, 0x2db7de6e,
+       0x738fc753, 0xe33f7f3c, 0xcfb19558, 0xe79287aa, 0x299152df, 0x8966d3f6,
+       0xc60e2214, 0x88ac2ff8, 0x10a45ae1, 0x5d763578, 0xe013d23d, 0xe08acbc8,
+       0xf2a0ef88, 0xa86e96a1, 0x4fae3b34, 0xa8204a5f, 0x0f7f8c95, 0x7b8c8bb9,
+       0x55ef5e60, 0xdbe57ee8, 0x98d8f36f, 0x246a4b4f, 0xab53791d, 0x7c8e9223,
+       0x46a8e468, 0xcbeb8d3b, 0x199ff18a, 0x4649afdf, 0xf6643fb8, 0x8fdbc6d8,
+       0x6f3c438f, 0x2ab37e1d, 0xfdd0a93e, 0x4d2069a6, 0x646723f6, 0xe9b6ec11,
+       0x3875e4b9, 0x1fc133a7, 0x65760647, 0x8fe2137b, 0xaa3b90cf, 0x137e287c,
+       0x7ca3fafd, 0xa54f81d8, 0xf6ab0acd, 0x65b1af22, 0x3a294d0a, 0xe5b1b01d,
+       0xa7b4befb, 0x5e2e7ec2, 0x1e3f156d, 0x73822251, 0x0aae27b9, 0x23988c3e,
+       0xca8e7382, 0x18fc11ff, 0x09591099, 0xb4adcadc, 0xc9f196af, 0x1e2e9591,
+       0xa0c2b2ff, 0x03e491a7, 0x57322785, 0xb5ea4f03, 0x3711b7d1, 0x09d99769,
+       0x7be9893f, 0xa227a19d, 0x783b86c7, 0xb3410ffc, 0x4e61f10b, 0x0be462a5,
+       0xb5f9f896, 0x908d3fb8, 0xf841c0eb, 0xdddd9367, 0xfdc1a32b, 0xbc1f20af,
+       0xe5dddb33, 0x326f5eba, 0xcacae587, 0xee2d6afc, 0xfbdd3b29, 0xdfcc158f,
+       0x07c91c5f, 0x4bb5b1ce, 0xdd7b6a1c, 0x47fb13ba, 0x807ba3cd, 0xde1c175f,
+       0x9f582b27, 0xada196ad, 0x67d22ca5, 0xa429c8e6, 0x6f604bf8, 0xbdba2382,
+       0xb2ef148d, 0x561e9f08, 0x9767eb2a, 0x4b940f71, 0xa1f603b4, 0xe6fcf7e8,
+       0x00efabc0, 0x6686466f, 0xf58f4e09, 0x4f030ba7, 0x3e3703a6, 0x981ef8e0,
+       0x60ffef13, 0xfa0b5ef5, 0xc3b8bf97, 0x9ef6e112, 0xbbe7c9cd, 0x0cf6ed7c,
+       0x9e3d0bf8, 0xec7b0fd0, 0xeac7a649, 0x4e197605, 0xe88083f2, 0x29c79cfd,
+       0x0e54b7f2, 0xdf0f41b5, 0xd698cbd2, 0x6313e812, 0xa9f331e8, 0xce1fcf41,
+       0xb6f84879, 0x430f0b4e, 0xcc07236f, 0xe4ef7c04, 0x7f7426b8, 0x1aef105a,
+       0xadc700f5, 0x216e3d2c, 0x0fa4b45e, 0x8cbdc4ad, 0x989d5bf4, 0xa7c8e9bf,
+       0xdb3f38f9, 0xdbce3e63, 0x3670e472, 0xf78dcec1, 0x6cc7c704, 0x1ff4b78c,
+       0x24bbc6c9, 0x86aadfd6, 0x4717210a, 0x47e012b8, 0x85afdfac, 0x8b7f210b,
+       0xf1825432, 0xf996e428, 0x49a06b4c, 0xe8aad1ce, 0x34474f7e, 0xf7b1f9c1,
+       0x6e8551f6, 0x250f8caf, 0x1d3707c8, 0xb11254bd, 0xd9a0f1c7, 0xe81395c0,
+       0xdffdd62f, 0x09c0c8b9, 0xbf0cda5e, 0xbc27071f, 0xf5a3dc31, 0xae7dc816,
+       0xb63b9742, 0x3bcaf85e, 0x6de32023, 0x992a5daf, 0xc6758c59, 0xa3c04a3c,
+       0x017c7159, 0x0e0ae40e, 0xf367326c, 0x2bcf7cb9, 0xd25e4eee, 0x96b1b8dc,
+       0xd33ad3a7, 0x6bd0b5fd, 0x5de40513, 0xb1ae5637, 0x8570f476, 0x553ebf7e,
+       0xf6fb8f7f, 0x964ec128, 0x7d6322eb, 0x9bc17cee, 0x5d67f030, 0xf85ac6f5,
+       0x7e597ddf, 0xf9bbe24b, 0xedaff887, 0xadd7a649, 0x339b58df, 0x1efb9f8e,
+       0x126a7eda, 0xd9afcf5d, 0xdb36a3bb, 0x4c7f7d75, 0x98b68bee, 0x49e6959c,
+       0xbe58fa89, 0xb71276b1, 0xaffe52eb, 0x7dcfd0fa, 0x8c3588f1, 0xb5facbb8,
+       0xfdb7fce0, 0x0925bd71, 0x5f807fb7, 0x9d6b0533, 0xfe5bbe33, 0x12ab6db1,
+       0x4f80561e, 0xe2bd5fec, 0x0937ec67, 0x18aa6dfb, 0x5a68a753, 0x37791d3d,
+       0x4f4f5779, 0x6d8c53ac, 0xa8a72819, 0x49bd88b7, 0xd2b87ecb, 0x623e8e3d,
+       0xd4ae6ff3, 0x864d9f64, 0x6fa94f1d, 0x1e15e679, 0x53ccb97f, 0x557ec956,
+       0xbf92a9ae, 0xa6a7dd8f, 0x860fcf52, 0x80bf1db2, 0xcd07453d, 0xb949f84e,
+       0x4f33eba6, 0xfc2efcbd, 0xe1db2f31, 0x357e64ea, 0xbcfa6955, 0xea273663,
+       0x5f63d140, 0xffe07be5, 0xa5cbec5b, 0xd3b262ce, 0x953f1e64, 0x3df0573b,
+       0xc6c7cfb6, 0x7aa5693e, 0x645ed3be, 0x533afefe, 0x3adbe3b1, 0xc51be493,
+       0x12d9c169, 0xf890bf87, 0xe85c1d16, 0xf7c05cd4, 0xd6fe1da0, 0x677ff5fe,
+       0x0c8f0e23, 0x0bba67fe, 0xd3ed75b8, 0xb6cfd874, 0x81d38f81, 0x6606270f,
+       0x1d9ed039, 0x1fd03972, 0x16b8fbad, 0x368cbaf3, 0x8b30675e, 0xf636b19c,
+       0x13d58e7e, 0xcdd1de12, 0x73af6bd0, 0x614b2fdb, 0x82dda9ef, 0xce8efc63,
+       0xd788fc44, 0xe3395c19, 0xeb1265d5, 0xf5b3050c, 0xd45a033a, 0x7acc0a19,
+       0xea34019d, 0x6751680c, 0x0cea3f40, 0x006751a0, 0x68033a8d, 0xa2d019d4,
+       0x2bfe80ce, 0xbcb16ba8, 0x50de4e51, 0xecd1aadf, 0xf40fff82, 0xf5e4416a,
+       0x74d31c0f, 0xc412877a, 0xfbc67f7d, 0xaf460e23, 0x28b075e8, 0xe77953c7,
+       0xfbcb341f, 0x5eda1a20, 0xd6f71337, 0x5571b9af, 0xd9371117, 0xa3cddb14,
+       0x6a1f5127, 0x1bdc53ef, 0x2e5fe85d, 0x5c1b6c72, 0xfa237ef8, 0xd56ecd7b,
+       0x9abafb85, 0x6f97fa8d, 0x58ea57b0, 0x2cc739d5, 0x15fbcf72, 0xeffde1ca,
+       0x64efeab0, 0x2cbdc6bf, 0x9545b0f7, 0x1d6fda3c, 0xcb4bf792, 0x4d738a8b,
+       0x7eda1e42, 0x1382e7cb, 0x9df4b69d, 0xb21fd790, 0xc524d739, 0x7de48f57,
+       0xc174fc7e, 0x45433c8d, 0xa7d5af4c, 0x7b5edf90, 0xf9213801, 0xb47e4248,
+       0x33fcd9d6, 0x5da467e4, 0x7efce133, 0x644ee87e, 0x6d3dd6f9, 0xb09228fe,
+       0x9930737f, 0x6df60df6, 0x99c823cd, 0x034a8fdc, 0x943fb2e2, 0x74aa1fdc,
+       0xc6927d64, 0x3cd1e63f, 0xff755be4, 0x3f40e6b4, 0xdbb977ef, 0x61caf92a,
+       0x2570f78f, 0xb349f1fb, 0x272fea47, 0xbde4d98f, 0x9cfb7e75, 0x8d4bfaa4,
+       0x1fea5536, 0xc48acc1b, 0xdee52bf1, 0xaacbb063, 0xeea57bba, 0x10eb9552,
+       0xe1d98e7f, 0x3786f2d1, 0x5cc377c0, 0x6abfd497, 0xe10bf4ac, 0xf72f7ec7,
+       0x7f16683c, 0x8254e9ab, 0xc9abd32a, 0xad7f816d, 0x3d8a7562, 0x298fed99,
+       0x78ab0fec, 0xbb04c6af, 0x915db0da, 0x100a42bc, 0x8695e7ac, 0xfe0d573e,
+       0xfb0a57eb, 0x3d56bdcb, 0x5553ce0f, 0xc5d79fe1, 0xdfe78b71, 0xfc0b5e47,
+       0x55c71d66, 0x5f671cb4, 0x37bf708f, 0x9ebe6a6d, 0xc072bbe7, 0x3319f57f,
+       0x726a4f01, 0x95e85e7e, 0xfced5f78, 0x095bef84, 0x737da5df, 0xa8e1f7d3,
+       0xc8493e89, 0x759a4f6b, 0xca7d61fc, 0xec14eb7b, 0x5e3eea55, 0x3474cf69,
+       0x8ca2bb49, 0x340bffc4, 0xe02f6f3d, 0x4a6672bb, 0xeb0fa2dd, 0x6eedda6b,
+       0x0b863fe8, 0xbefc8dbb, 0xe796e540, 0x5bd54eed, 0xdc29d30b, 0xca5b8d3f,
+       0xe7617e14, 0x5c71d47c, 0x3d4f3fc2, 0x7d05c0bb, 0x4377697c, 0xc739351f,
+       0x31dde1e6, 0x72ffe0cb, 0xdc55c359, 0x029d2797, 0x438f9fd8, 0x5adfacdd,
+       0x5d41481c, 0x50d1e43d, 0x38a63f27, 0x1ebfaef1, 0x716fb74f, 0x140acfc2,
+       0xb5b7ea27, 0xd935dda9, 0xe676bfcc, 0x9cf0370c, 0x61ea55f1, 0x76eadc23,
+       0x53506b70, 0x6ca6b5f4, 0xff0df3d4, 0x54a6f729, 0xd7f78a4d, 0x1d147e1b,
+       0xf11d22fc, 0x6dd447f5, 0x807f8377, 0x835eee6c, 0xfea0ec3f, 0xbf5269a6,
+       0xe5d1d98d, 0x613b39fd, 0xf4ab5347, 0xef8d8d75, 0x0c4f9199, 0xc1cde6dd,
+       0x7cd72bfe, 0xce5b25be, 0x8cbd7e39, 0xb8033771, 0x165eb63b, 0x463df1c3,
+       0x6b781dfd, 0x26baea32, 0x326baea3, 0xa326baea, 0xea326bae, 0xaea326ba,
+       0xbaea326b, 0x6baea326, 0x26baea32, 0x97ae13a9, 0x878eddf6, 0x08ea1da4,
+       0xbc4278c8, 0xc7eab9b8, 0x55175dd5, 0xa577538d, 0xc4865714, 0xbd7bf65d,
+       0xcea63dde, 0x26aefeca, 0xe0d57bf8, 0x431e7b84, 0x7163d25e, 0x6b5438b3,
+       0x603c16f1, 0x54f07c17, 0x8d6f5b8d, 0xf52ecfe9, 0x9b64cbd9, 0x2ca87b8f,
+       0x5152659a, 0x23ee34c7, 0xdf84ef56, 0x1bf09ce0, 0xd31bf0b4, 0xfcdfb8ec,
+       0x5daec2d6, 0x0109e7aa, 0x726c13c9, 0x32375bbf, 0x2f7d30ae, 0xe5709339,
+       0xc2b831b3, 0x90159a0f, 0x95a0ed63, 0x233f74ba, 0x37254ff8, 0x0e3f9c7f,
+       0x9c7484ce, 0xda1a9699, 0xb5a67d87, 0x1791baa5, 0x9d8bbfb3, 0x88a6dc9d,
+       0x06a1afbf, 0xbc1c77d9, 0x7c9e4749, 0x73d1c4ef, 0xf7f9e1bf, 0xf25d83fe,
+       0xd793ad9d, 0xe0fffa2e, 0xae954d4d, 0x84775f8f, 0x9659e77d, 0x43b654ea,
+       0x16d5578e, 0xb8ba922a, 0x50fe2a9a, 0x58ae3da3, 0xd377a380, 0xb577dc3c,
+       0xc839e1b5, 0x2efec399, 0xa32cdfef, 0x6a1a6bbe, 0xd9f4cbde, 0xbe373cec,
+       0x3dcd4dab, 0x800b0544, 0xb0c57547, 0xadd4b3ab, 0x1963dd60, 0xbf83bfde,
+       0xa7cc5edc, 0x96fee356, 0xb3b69753, 0xce63ee4b, 0x32fbdc42, 0xf51fabab,
+       0x9e6f2d86, 0xb2c27a90, 0xd442d70c, 0x79bcb61b, 0x5c73a75a, 0xe51b8afd,
+       0xabab13b2, 0x66f8827f, 0x109f3eeb, 0x09a1fd67, 0xc0fb7449, 0x09f3eee4,
+       0x3f05ae71, 0x3f4e9df8, 0xafb84c53, 0x5c944356, 0xf21dbbd5, 0x4bfeebf9,
+       0xa8d3cf7f, 0xaaa7c9c4, 0x749c5c74, 0xe7b0c282, 0xf90ec5d1, 0x713397fe,
+       0xdbd43cfd, 0x10b5d8a8, 0xfdaf38f3, 0xe2f8ec35, 0xc1a79ead, 0x7738cf27,
+       0x3579f10e, 0x0d90c758, 0xbbe319ed, 0xdbd529e4, 0x3d36b688, 0x357e9260,
+       0x6df68a58, 0xfa20f435, 0x81762fd9, 0xf393ed4f, 0x3a622c6e, 0xb79a1acf,
+       0xe9788ede, 0x73fe8dd9, 0xec5e9e65, 0xdfeeb637, 0xe58f9c69, 0xc37987d9,
+       0xf9e4aa85, 0x6dea37c3, 0x55c22ecc, 0x371d0e3a, 0x93aca8fc, 0x58e7fbe4,
+       0xa55e39fb, 0xfdf9781a, 0x47bcb372, 0x7e4c4f20, 0x0a5d5eea, 0xa3de5879,
+       0x61afbc86, 0x5299ec9c, 0x7b6ef98f, 0xc77ec80d, 0x7c653b0d, 0xe3af396c,
+       0xa685b4a3, 0x0de404e0, 0x4e0d1e53, 0x7653bc80, 0xdc5cda8c, 0xb51810be,
+       0xe1787f21, 0xe86d476f, 0x7543c17f, 0x56bfe1e3, 0xc2df09ad, 0x3f5951b2,
+       0x921af79d, 0x04e8c277, 0x4d856fe4, 0x6c02596f, 0xe69e73b7, 0xb7f2937d,
+       0xd3638922, 0xfe9a5b0d, 0x87b04aa8, 0xe490cfe9, 0x259d54ab, 0xdd14bee3,
+       0x3e8f7dff, 0x6e8ec2a8, 0x09dcb208, 0x69e737f6, 0x1248e5d3, 0x6bacb0df,
+       0xf3837031, 0x3f71a4b5, 0x3cbe4733, 0xe423c0c5, 0x378c8d8f, 0xbeb7a6fe,
+       0x79c8be42, 0x8c7e18dc, 0x261c314d, 0xebef5dc4, 0x20fc1711, 0xbbdade79,
+       0xf78ad91e, 0x76e3536d, 0xd78fbc8b, 0xdb456df4, 0x259efada, 0x4cbf2487,
+       0x65f9cf9a, 0x9c9d7d12, 0x7b68e463, 0x39adf3f0, 0x76cbece3, 0x0ed12d70,
+       0x37439a4e, 0xd27abde0, 0x480eea9f, 0x0fdd091c, 0x6ad9d97c, 0xecae2377,
+       0xd8a555fa, 0xa9f5b7d7, 0xfaa98f32, 0xa751d947, 0x52540fcc, 0x87e6fc11,
+       0xe1e011da, 0x0c3c24ec, 0x8972dd48, 0xddae7043, 0xadb60778, 0x123e4a71,
+       0x5336ebf3, 0x98adc3e8, 0xef90e597, 0x45b70c11, 0x6f7c2ca6, 0x4aeee29a,
+       0x2ece2bc8, 0x9d041599, 0x830a19dd, 0x15cfe8ef, 0xd5c8ea37, 0xd6ae3a69,
+       0x7bad0da8, 0x352dfc79, 0x5bf1b82c, 0x6ff307e0, 0x7697acb7, 0xb14cd945,
+       0x290a5cdb, 0x7067fffa, 0x3d7bc42d, 0x67ad3df6, 0x20efb05b, 0xf04afbde,
+       0x8fa8b599, 0xe45d95fe, 0x80d50689, 0x33d3cf99, 0x7bb70481, 0xb8942cee,
+       0xc686a513, 0x2cff91fb, 0x6a3a954f, 0x13d704cf, 0xd3da6ef8, 0xf5e4a37c,
+       0xc7a4fe87, 0x29a5d1fb, 0x3d71e46e, 0x711b5cf3, 0x5d479eae, 0xa29afe32,
+       0xa13c0bf3, 0xa967a7eb, 0xe69ece7e, 0xc59f794c, 0x8767a1ee, 0xbfbe3267,
+       0xe5bc3259, 0x1803a8d5, 0x667b1fdf, 0x4fb73f70, 0xde770d29, 0x75733e07,
+       0xb9945779, 0xde4edee4, 0x7b13e379, 0xf1867d74, 0x897dac1d, 0xfefde923,
+       0xcb80febf, 0x002220b3, 0x00000000
 };
 
 #endif /*__BNX2X_INIT_VALUES_H__*/
index aea26b4dc45327bd7bcdd3bb0e347fc34e688cfd..73b52f17ea848d6de2a650afa583052088a79f76 100644 (file)
 #include <linux/ethtool.h>
 #include <linux/mutex.h>
 
-#include "bnx2x_reg.h"
-#include "bnx2x_fw_defs.h"
-#include "bnx2x_hsi.h"
-#include "bnx2x_link.h"
 #include "bnx2x.h"
 
 /********************************************************/
-#define SUPPORT_CL73 0 /* Currently no */
 #define ETH_HLEN                       14
 #define ETH_OVREHEAD           (ETH_HLEN + 8)/* 8 for CRC + VLAN*/
 #define ETH_MIN_PACKET_SIZE            60
 #define PHY_SGMII_FLAG                 0x2
 #define PHY_SERDES_FLAG                        0x4
 
+/* */
+#define SFP_EEPROM_CON_TYPE_ADDR               0x2
+       #define SFP_EEPROM_CON_TYPE_VAL_LC              0x7
+       #define SFP_EEPROM_CON_TYPE_VAL_COPPER  0x21
+
+#define SFP_EEPROM_FC_TX_TECH_ADDR             0x8
+       #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE 0x4
+       #define SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE      0x8
+#define SFP_EEPROM_VENDOR_NAME_ADDR            0x14
+#define SFP_EEPROM_VENDOR_NAME_SIZE    16
+#define SFP_EEPROM_OPTIONS_ADDR                0x40
+       #define SFP_EEPROM_OPTIONS_LINEAR_RX_OUT_MASK 0x1
+#define SFP_EEPROM_OPTIONS_SIZE                2
+
+#define SFP_MODULE_TYPE_UNKNOWN                        0x0
+#define SFP_MODULE_TYPE_LC                     0x1
+#define SFP_MODULE_TYPE_ACTIVE_COPPER_CABLE            0x2
+#define SFP_MODULE_TYPE_PASSIVE_COPPER_CABLE   0x3
+
+#define SFP_LIMITING_MODE_VALUE                        0x0044
 /**********************************************************/
 /*                     INTERFACE                          */
 /**********************************************************/
                (_bank + (_addr & 0xf)), \
                _val)
 
-static void bnx2x_set_phy_mdio(struct link_params *params)
+static void bnx2x_set_serdes_access(struct link_params *params)
 {
        struct bnx2x *bp = params->bp;
-       REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST +
-                  params->port*0x18, 0);
-       REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + params->port*0x18,
-                  DEFAULT_PHY_DEV_ADDR);
+       u32 emac_base = (params->port) ? GRCBASE_EMAC1 : GRCBASE_EMAC0;
+       /* Set Clause 22 */
+       REG_WR(bp, NIG_REG_SERDES0_CTRL_MD_ST + params->port*0x10, 1);
+       REG_WR(bp, emac_base + EMAC_REG_EMAC_MDIO_COMM, 0x245f8000);
+       udelay(500);
+       REG_WR(bp, emac_base + EMAC_REG_EMAC_MDIO_COMM, 0x245d000f);
+       udelay(500);
+        /* Set Clause 45 */
+       REG_WR(bp, NIG_REG_SERDES0_CTRL_MD_ST + params->port*0x10, 0);
+}
+static void bnx2x_set_phy_mdio(struct link_params *params, u8 phy_flags)
+{
+       struct bnx2x *bp = params->bp;
+       if (phy_flags & PHY_XGXS_FLAG) {
+               REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST +
+                          params->port*0x18, 0);
+               REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + params->port*0x18,
+                          DEFAULT_PHY_DEV_ADDR);
+       } else {
+               bnx2x_set_serdes_access(params);
+
+               REG_WR(bp, NIG_REG_SERDES0_CTRL_MD_DEVAD +
+                          params->port*0x10,
+                          DEFAULT_PHY_DEV_ADDR);
+       }
 }
 
 static u32 bnx2x_bits_en(struct bnx2x *bp, u32 reg, u32 bits)
@@ -277,8 +313,10 @@ static u8 bnx2x_emac_enable(struct link_params *params,
                           port*4, 0);
        }
 
-       /* enable emac */
-       REG_WR(bp, NIG_REG_NIG_EMAC0_EN + port*4, 1);
+       bnx2x_bits_en(bp, emac_base + EMAC_REG_EMAC_RX_MODE,
+                   EMAC_RX_MODE_RESET);
+       bnx2x_bits_en(bp, emac_base + EMAC_REG_EMAC_TX_MODE,
+                   EMAC_TX_MODE_RESET);
 
        if (CHIP_REV_IS_SLOW(bp)) {
                /* config GMII mode */
@@ -498,7 +536,7 @@ static void bnx2x_phy_deassert(struct link_params *params, u8 phy_flags)
        udelay(500);
        REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET,
                    val);
-       bnx2x_set_phy_mdio(params);
+       bnx2x_set_phy_mdio(params, phy_flags);
 }
 
 void bnx2x_link_status_update(struct link_params *params,
@@ -749,12 +787,17 @@ static u8 bnx2x_pbf_update(struct link_params *params, u32 flow_ctrl,
        return 0;
 }
 
-static u32 bnx2x_get_emac_base(u32 ext_phy_type, u8 port)
+static u32 bnx2x_get_emac_base(struct bnx2x *bp, u32 ext_phy_type, u8 port)
 {
        u32 emac_base;
        switch (ext_phy_type) {
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
-               emac_base = GRCBASE_EMAC0;
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+               /* All MDC/MDIO is directed through single EMAC */
+               if (REG_RD(bp, NIG_REG_PORT_SWAP))
+                       emac_base = GRCBASE_EMAC0;
+               else
+                       emac_base = GRCBASE_EMAC1;
                break;
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
                emac_base = (port) ? GRCBASE_EMAC0 : GRCBASE_EMAC1;
@@ -772,11 +815,12 @@ u8 bnx2x_cl45_write(struct bnx2x *bp, u8 port, u32 ext_phy_type,
 {
        u32 tmp, saved_mode;
        u8 i, rc = 0;
-       u32 mdio_ctrl = bnx2x_get_emac_base(ext_phy_type, port);
+       u32 mdio_ctrl = bnx2x_get_emac_base(bp, ext_phy_type, port);
 
        /* set clause 45 mode, slow down the MDIO clock to 2.5MHz
         * (a value of 49==0x31) and make sure that the AUTO poll is off
         */
+
        saved_mode = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE);
        tmp = saved_mode & ~(EMAC_MDIO_MODE_AUTO_POLL |
                             EMAC_MDIO_MODE_CLOCK_CNT);
@@ -841,10 +885,11 @@ u8 bnx2x_cl45_read(struct bnx2x *bp, u8 port, u32 ext_phy_type,
        u16 i;
        u8 rc = 0;
 
-       u32 mdio_ctrl = bnx2x_get_emac_base(ext_phy_type, port);
+       u32 mdio_ctrl = bnx2x_get_emac_base(bp, ext_phy_type, port);
        /* set clause 45 mode, slow down the MDIO clock to 2.5MHz
         * (a value of 49==0x31) and make sure that the AUTO poll is off
         */
+
        saved_mode = REG_RD(bp, mdio_ctrl + EMAC_REG_EMAC_MDIO_MODE);
        val = saved_mode & ((EMAC_MDIO_MODE_AUTO_POLL |
                             EMAC_MDIO_MODE_CLOCK_CNT));
@@ -967,6 +1012,8 @@ static u8 bnx2x_reset_unicore(struct link_params *params)
                              (mii_control |
                               MDIO_COMBO_IEEO_MII_CONTROL_RESET));
 
+       bnx2x_set_serdes_access(params);
+
        /* wait for the reset to self clear */
        for (i = 0; i < MDIO_ACCESS_TIMEOUT; i++) {
                udelay(5);
@@ -1156,62 +1203,9 @@ static void bnx2x_set_autoneg(struct link_params *params,
                              MDIO_BAM_NEXT_PAGE_MP5_NEXT_PAGE_CTRL,
                              reg_val);
 
-       /* Enable Clause 73 Aneg */
-       if ((vars->line_speed == SPEED_AUTO_NEG) &&
-           (SUPPORT_CL73)) {
-               /* Enable BAM Station Manager */
-
-               CL45_WR_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                                     MDIO_REG_BANK_CL73_USERB0,
-                                     MDIO_CL73_USERB0_CL73_BAM_CTRL1,
-                                  (MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_EN |
-                       MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_STATION_MNGR_EN |
-                       MDIO_CL73_USERB0_CL73_BAM_CTRL1_BAM_NP_AFTER_BP_EN));
-
-               /* Merge CL73 and CL37 aneg resolution */
-               CL45_RD_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                                     MDIO_REG_BANK_CL73_USERB0,
-                                     MDIO_CL73_USERB0_CL73_BAM_CTRL3,
-                                     &reg_val);
-
-               CL45_WR_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                       MDIO_REG_BANK_CL73_USERB0,
-                       MDIO_CL73_USERB0_CL73_BAM_CTRL3,
-                       (reg_val |
-                       MDIO_CL73_USERB0_CL73_BAM_CTRL3_USE_CL73_HCD_MR));
+       /* CL73 Autoneg Disabled */
+       reg_val = 0;
 
-               /* Set the CL73 AN speed */
-
-               CL45_RD_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                                     MDIO_REG_BANK_CL73_IEEEB1,
-                                     MDIO_CL73_IEEEB1_AN_ADV2, &reg_val);
-               /* In the SerDes we support only the 1G.
-                  In the XGXS we support the 10G KX4
-                  but we currently do not support the KR */
-               if (vars->phy_flags & PHY_XGXS_FLAG) {
-                       DP(NETIF_MSG_LINK, "XGXS\n");
-                       /* 10G KX4 */
-                       reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_10G_KX4;
-               } else {
-                       DP(NETIF_MSG_LINK, "SerDes\n");
-                       /* 1000M KX */
-                       reg_val |= MDIO_CL73_IEEEB1_AN_ADV2_ADVR_1000M_KX;
-               }
-               CL45_WR_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                                     MDIO_REG_BANK_CL73_IEEEB1,
-                                     MDIO_CL73_IEEEB1_AN_ADV2, reg_val);
-
-               /* CL73 Autoneg Enabled */
-               reg_val = MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN;
-       } else {
-               /* CL73 Autoneg Disabled */
-               reg_val = 0;
-       }
        CL45_WR_OVER_CL22(bp, params->port,
                              params->phy_addr,
                              MDIO_REG_BANK_CL73_IEEEB0,
@@ -1344,44 +1338,25 @@ static void bnx2x_set_ieee_aneg_advertisment(struct link_params *params,
 static void bnx2x_restart_autoneg(struct link_params *params)
 {
        struct bnx2x *bp = params->bp;
+       u16 mii_control;
        DP(NETIF_MSG_LINK, "bnx2x_restart_autoneg\n");
-       if (SUPPORT_CL73) {
-               /* enable and restart clause 73 aneg */
-               u16 an_ctrl;
+       /* Enable and restart BAM/CL37 aneg */
 
-               CL45_RD_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                                     MDIO_REG_BANK_CL73_IEEEB0,
-                                     MDIO_CL73_IEEEB0_CL73_AN_CONTROL,
-                                 &an_ctrl);
-               CL45_WR_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                               MDIO_REG_BANK_CL73_IEEEB0,
-                               MDIO_CL73_IEEEB0_CL73_AN_CONTROL,
-                               (an_ctrl |
-                               MDIO_CL73_IEEEB0_CL73_AN_CONTROL_AN_EN |
-                               MDIO_CL73_IEEEB0_CL73_AN_CONTROL_RESTART_AN));
-
-       } else {
-               /* Enable and restart BAM/CL37 aneg */
-               u16 mii_control;
-
-               CL45_RD_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                                     MDIO_REG_BANK_COMBO_IEEE0,
-                                     MDIO_COMBO_IEEE0_MII_CONTROL,
-                                     &mii_control);
-               DP(NETIF_MSG_LINK,
-                        "bnx2x_restart_autoneg mii_control before = 0x%x\n",
-                        mii_control);
-               CL45_WR_OVER_CL22(bp, params->port,
-                                     params->phy_addr,
-                                     MDIO_REG_BANK_COMBO_IEEE0,
-                                     MDIO_COMBO_IEEE0_MII_CONTROL,
-                                     (mii_control |
-                               MDIO_COMBO_IEEO_MII_CONTROL_AN_EN |
-                               MDIO_COMBO_IEEO_MII_CONTROL_RESTART_AN));
-       }
+       CL45_RD_OVER_CL22(bp, params->port,
+                             params->phy_addr,
+                             MDIO_REG_BANK_COMBO_IEEE0,
+                             MDIO_COMBO_IEEE0_MII_CONTROL,
+                             &mii_control);
+       DP(NETIF_MSG_LINK,
+                "bnx2x_restart_autoneg mii_control before = 0x%x\n",
+                mii_control);
+       CL45_WR_OVER_CL22(bp, params->port,
+                             params->phy_addr,
+                             MDIO_REG_BANK_COMBO_IEEE0,
+                             MDIO_COMBO_IEEE0_MII_CONTROL,
+                             (mii_control |
+                              MDIO_COMBO_IEEO_MII_CONTROL_AN_EN |
+                              MDIO_COMBO_IEEO_MII_CONTROL_RESTART_AN));
 }
 
 static void bnx2x_initialize_sgmii_process(struct link_params *params,
@@ -1726,7 +1701,11 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
                    ((XGXS_EXT_PHY_TYPE(params->ext_phy_config) ==
                     PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) ||
                    (XGXS_EXT_PHY_TYPE(params->ext_phy_config) ==
-                    PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705))) {
+                    PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705) ||
+                   (XGXS_EXT_PHY_TYPE(params->ext_phy_config) ==
+                    PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) ||
+                    (XGXS_EXT_PHY_TYPE(params->ext_phy_config) ==
+                    PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481))) {
                        vars->autoneg = AUTO_NEG_ENABLED;
 
                        if (gp_status & MDIO_AN_CL73_OR_37_COMPLETE) {
@@ -1770,38 +1749,44 @@ static u8 bnx2x_link_settings_status(struct link_params *params,
        return rc;
 }
 
-static void bnx2x_set_sgmii_tx_driver(struct link_params *params)
+static void bnx2x_set_gmii_tx_driver(struct link_params *params)
 {
        struct bnx2x *bp = params->bp;
        u16 lp_up2;
        u16 tx_driver;
+       u16 bank;
 
        /* read precomp */
-
        CL45_RD_OVER_CL22(bp, params->port,
                              params->phy_addr,
                              MDIO_REG_BANK_OVER_1G,
                              MDIO_OVER_1G_LP_UP2, &lp_up2);
 
-       CL45_RD_OVER_CL22(bp, params->port,
-                             params->phy_addr,
-                             MDIO_REG_BANK_TX0,
-                             MDIO_TX0_TX_DRIVER, &tx_driver);
-
        /* bits [10:7] at lp_up2, positioned at [15:12] */
        lp_up2 = (((lp_up2 & MDIO_OVER_1G_LP_UP2_PREEMPHASIS_MASK) >>
                   MDIO_OVER_1G_LP_UP2_PREEMPHASIS_SHIFT) <<
                  MDIO_TX0_TX_DRIVER_PREEMPHASIS_SHIFT);
 
-       if ((lp_up2 != 0) &&
-           (lp_up2 != (tx_driver & MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK))) {
-               /* replace tx_driver bits [15:12] */
-               tx_driver &= ~MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK;
-               tx_driver |= lp_up2;
-               CL45_WR_OVER_CL22(bp, params->port,
+       if (lp_up2 == 0)
+               return;
+
+       for (bank = MDIO_REG_BANK_TX0; bank <= MDIO_REG_BANK_TX3;
+             bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0)) {
+               CL45_RD_OVER_CL22(bp, params->port,
                                      params->phy_addr,
-                                     MDIO_REG_BANK_TX0,
-                                     MDIO_TX0_TX_DRIVER, tx_driver);
+                                     bank,
+                                     MDIO_TX0_TX_DRIVER, &tx_driver);
+
+               /* replace tx_driver bits [15:12] */
+               if (lp_up2 !=
+                   (tx_driver & MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK)) {
+                       tx_driver &= ~MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK;
+                       tx_driver |= lp_up2;
+                       CL45_WR_OVER_CL22(bp, params->port,
+                                             params->phy_addr,
+                                             bank,
+                                             MDIO_TX0_TX_DRIVER, tx_driver);
+               }
        }
 }
 
@@ -1902,6 +1887,25 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
                                       MDIO_PMA_DEVAD,
                                       MDIO_PMA_REG_CTRL, 0xa040);
                        break;
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+
+                       /* Restore normal power mode*/
+                       bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
+                                         MISC_REGISTERS_GPIO_OUTPUT_HIGH,
+                                         params->port);
+
+                       bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1,
+                                         MISC_REGISTERS_GPIO_OUTPUT_HIGH,
+                                         params->port);
+
+                       bnx2x_cl45_write(bp, params->port,
+                                      ext_phy_type,
+                                      ext_phy_addr,
+                                      MDIO_PMA_DEVAD,
+                                      MDIO_PMA_REG_CTRL,
+                                      1<<15);
+
+                       break;
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
                        /* Unset Low Power Mode and SW reset */
                        /* Restore normal power mode*/
@@ -1919,9 +1923,6 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
                        break;
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
                        {
-                       u16 emac_base;
-                       emac_base = (params->port) ? GRCBASE_EMAC0 :
-                                       GRCBASE_EMAC1;
 
                        /* Restore normal power mode*/
                        bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
@@ -1949,6 +1950,23 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
 
                        break;
 
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
+
+                       /* Restore normal power mode*/
+                       bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
+                                     MISC_REGISTERS_GPIO_OUTPUT_HIGH,
+                                         params->port);
+
+                       /* HW reset */
+                       bnx2x_hw_reset(bp, params->port);
+
+                       bnx2x_cl45_write(bp, params->port,
+                                      ext_phy_type,
+                                      ext_phy_addr,
+                                      MDIO_PMA_DEVAD,
+                                      MDIO_PMA_REG_CTRL,
+                                      1<<15);
+                       break;
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE:
                        DP(NETIF_MSG_LINK, "XGXS PHY Failure detected\n");
                        break;
@@ -1980,6 +1998,31 @@ static void bnx2x_ext_phy_reset(struct link_params *params,
        }
 }
 
+
+static void bnx2x_save_spirom_version(struct bnx2x *bp, u8 port,
+                                   u32 shmem_base, u32 spirom_ver)
+{
+       DP(NETIF_MSG_LINK, "FW version 0x%x:0x%x\n",
+                (u16)(spirom_ver>>16), (u16)spirom_ver);
+       REG_WR(bp, shmem_base +
+                  offsetof(struct shmem_region,
+                           port_mb[port].ext_phy_fw_version),
+                       spirom_ver);
+}
+
+static void bnx2x_save_bcm_spirom_ver(struct bnx2x *bp, u8 port,
+                                   u32 ext_phy_type, u8 ext_phy_addr,
+                                   u32 shmem_base)
+{
+       u16 fw_ver1, fw_ver2;
+       bnx2x_cl45_read(bp, port, ext_phy_type, ext_phy_addr, MDIO_PMA_DEVAD,
+                     MDIO_PMA_REG_ROM_VER1, &fw_ver1);
+       bnx2x_cl45_read(bp, port, ext_phy_type, ext_phy_addr, MDIO_PMA_DEVAD,
+                     MDIO_PMA_REG_ROM_VER2, &fw_ver2);
+       bnx2x_save_spirom_version(bp, port, shmem_base,
+                               (u32)(fw_ver1<<16 | fw_ver2));
+}
+
 static void bnx2x_bcm8072_external_rom_boot(struct link_params *params)
 {
        struct bnx2x *bp = params->bp;
@@ -1988,7 +2031,6 @@ static void bnx2x_bcm8072_external_rom_boot(struct link_params *params)
                             PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
                            PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
        u32 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
-       u16 fw_ver1, fw_ver2;
 
        /* Need to wait 200ms after reset */
        msleep(200);
@@ -2024,14 +2066,10 @@ static void bnx2x_bcm8072_external_rom_boot(struct link_params *params)
        /* Wait 100ms */
        msleep(100);
 
-       /* Print the PHY FW version */
-       bnx2x_cl45_read(bp, port, ext_phy_type, ext_phy_addr,
-                           MDIO_PMA_DEVAD,
-                           MDIO_PMA_REG_ROM_VER1, &fw_ver1);
-       bnx2x_cl45_read(bp, port, ext_phy_type, ext_phy_addr,
-                           MDIO_PMA_DEVAD,
-                           MDIO_PMA_REG_ROM_VER2, &fw_ver2);
-       DP(NETIF_MSG_LINK, "8072 FW version 0x%x:0x%x\n", fw_ver1, fw_ver2);
+       bnx2x_save_bcm_spirom_ver(bp, port,
+                               ext_phy_type,
+                               ext_phy_addr,
+                               params->shmem_base);
 }
 
 static u8 bnx2x_8073_is_snr_needed(struct link_params *params)
@@ -2049,7 +2087,7 @@ static u8 bnx2x_8073_is_snr_needed(struct link_params *params)
                      PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
                      ext_phy_addr,
                      MDIO_PMA_DEVAD,
-                     0xc801, &val);
+                     MDIO_PMA_REG_8073_CHIP_REV, &val);
 
        if (val != 1) {
                /* No need to workaround in 8073 A1 */
@@ -2081,7 +2119,7 @@ static u8 bnx2x_bcm8073_xaui_wa(struct link_params *params)
                      PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
                      ext_phy_addr,
                      MDIO_PMA_DEVAD,
-                     0xc801, &val);
+                     MDIO_PMA_REG_8073_CHIP_REV, &val);
 
        if (val > 0) {
                /* No need to workaround in 8073 A1 */
@@ -2097,7 +2135,8 @@ static u8 bnx2x_bcm8073_xaui_wa(struct link_params *params)
                              PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
                              ext_phy_addr,
                              MDIO_PMA_DEVAD,
-                             0xc820, &val);
+                             MDIO_PMA_REG_8073_SPEED_LINK_STATUS,
+                             &val);
                  /* If bit [14] = 0 or bit [13] = 0, continue on with
                   system initialization (XAUI work-around not required,
                    as these bits indicate 2.5G or 1G link up). */
@@ -2115,7 +2154,7 @@ static u8 bnx2x_bcm8073_xaui_wa(struct link_params *params)
                                        PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
                                        ext_phy_addr,
                                        MDIO_PMA_DEVAD,
-                                       0xc841, &val);
+                                       MDIO_PMA_REG_8073_XAUI_WA, &val);
                                if (val & (1<<15)) {
                                        DP(NETIF_MSG_LINK,
                                          "XAUI workaround has completed\n");
@@ -2133,9 +2172,8 @@ static u8 bnx2x_bcm8073_xaui_wa(struct link_params *params)
 }
 
 static void bnx2x_bcm8073_external_rom_boot(struct bnx2x *bp, u8 port,
-                                         u8 ext_phy_addr)
+                                         u8 ext_phy_addr, u32 shmem_base)
 {
-       u16 fw_ver1, fw_ver2;
        /* Boot port from external ROM  */
        /* EDC grst */
        bnx2x_cl45_write(bp, port,
@@ -2175,27 +2213,502 @@ static void bnx2x_bcm8073_external_rom_boot(struct bnx2x *bp, u8 port,
                       MDIO_PMA_REG_GEN_CTRL,
                       MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP);
 
-       /* wait for 100ms for code download via SPI port */
-       msleep(100);
+       /* wait for 100ms for code download via SPI port */
+       msleep(100);
+
+       /* Clear ser_boot_ctl bit */
+       bnx2x_cl45_write(bp, port,
+                      PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
+                      ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_MISC_CTRL1, 0x0000);
+
+       bnx2x_save_bcm_spirom_ver(bp, port,
+                               PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
+                               ext_phy_addr,
+                               shmem_base);
+}
+
+static void bnx2x_bcm8726_external_rom_boot(struct link_params *params)
+{
+       struct bnx2x *bp = params->bp;
+       u8 port = params->port;
+       u8 ext_phy_addr = ((params->ext_phy_config &
+                            PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
+                           PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
+       u32 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
+
+       /* Need to wait 100ms after reset */
+       msleep(100);
+
+       /* Set serial boot control for external load */
+       bnx2x_cl45_write(bp, port, ext_phy_type, ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_MISC_CTRL1, 0x0001);
+
+       /* Micro controller re-boot */
+       bnx2x_cl45_write(bp, port, ext_phy_type, ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_GEN_CTRL,
+                      MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP);
+
+       /* Set soft reset */
+       bnx2x_cl45_write(bp, port, ext_phy_type, ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_GEN_CTRL,
+                      MDIO_PMA_REG_GEN_CTRL_ROM_MICRO_RESET);
+
+       /* Clear soft reset.
+       Will automatically reset micro-controller re-boot */
+       bnx2x_cl45_write(bp, port, ext_phy_type, ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_GEN_CTRL,
+                      MDIO_PMA_REG_GEN_CTRL_ROM_RESET_INTERNAL_MP);
+
+       /* wait for 100ms for microcode load */
+       msleep(100);
+
+       /* Disable serial boot control, tristates pins SS_N, SCK, MOSI, MISO */
+       bnx2x_cl45_write(bp, port, ext_phy_type, ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_MISC_CTRL1, 0x0000);
+
+       msleep(200);
+       bnx2x_save_bcm_spirom_ver(bp, port,
+                               ext_phy_type,
+                               ext_phy_addr,
+                               params->shmem_base);
+}
+
+static void bnx2x_bcm8726_set_transmitter(struct bnx2x *bp, u8 port,
+                                       u8 ext_phy_addr, u8 tx_en)
+{
+       u16 val;
+       DP(NETIF_MSG_LINK, "Setting transmitter tx_en=%x for port %x\n",
+                tx_en, port);
+       /* Disable/Enable transmitter ( TX laser of the SFP+ module.)*/
+       bnx2x_cl45_read(bp, port,
+                     PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726,
+                     ext_phy_addr,
+                     MDIO_PMA_DEVAD,
+                     MDIO_PMA_REG_PHY_IDENTIFIER,
+                     &val);
+
+       if (tx_en)
+               val &= ~(1<<15);
+       else
+               val |= (1<<15);
+
+       bnx2x_cl45_write(bp, port,
+                      PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726,
+                      ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_PHY_IDENTIFIER,
+                      val);
+}
+
+
+static u8 bnx2x_read_sfp_module_eeprom(struct link_params *params, u16 addr,
+                                    u8 byte_cnt, u8 *o_buf) {
+       struct bnx2x *bp = params->bp;
+       u16 val, i;
+       u8 port = params->port;
+       u8 ext_phy_addr = ((params->ext_phy_config &
+                           PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
+                          PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
+       u32 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
+       if (byte_cnt > 16) {
+               DP(NETIF_MSG_LINK, "Reading from eeprom is"
+                           " is limited to 0xf\n");
+               return -EINVAL;
+       }
+       /* Set the read command byte count */
+       bnx2x_cl45_write(bp, port,
+                      ext_phy_type,
+                      ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_8726_TWO_WIRE_BYTE_CNT,
+                      (byte_cnt | 0xa000));
+
+       /* Set the read command address */
+       bnx2x_cl45_write(bp, port,
+                      ext_phy_type,
+                      ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_8726_TWO_WIRE_MEM_ADDR,
+                      addr);
+
+       /* Activate read command */
+       bnx2x_cl45_write(bp, port,
+                      ext_phy_type,
+                      ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_8726_TWO_WIRE_CTRL,
+                      0x2c0f);
+
+       /* Wait up to 500us for command complete status */
+       for (i = 0; i < 100; i++) {
+               bnx2x_cl45_read(bp, port,
+                             ext_phy_type,
+                             ext_phy_addr,
+                             MDIO_PMA_DEVAD,
+                             MDIO_PMA_REG_8726_TWO_WIRE_CTRL, &val);
+               if ((val & MDIO_PMA_REG_8726_TWO_WIRE_CTRL_STATUS_MASK) ==
+                   MDIO_PMA_REG_8726_TWO_WIRE_STATUS_COMPLETE)
+                       break;
+               udelay(5);
+       }
+
+       if ((val & MDIO_PMA_REG_8726_TWO_WIRE_CTRL_STATUS_MASK) !=
+                   MDIO_PMA_REG_8726_TWO_WIRE_STATUS_COMPLETE) {
+               DP(NETIF_MSG_LINK,
+                        "Got bad status 0x%x when reading from SFP+ EEPROM\n",
+                        (val & MDIO_PMA_REG_8726_TWO_WIRE_CTRL_STATUS_MASK));
+               return -EINVAL;
+       }
+
+       /* Read the buffer */
+       for (i = 0; i < byte_cnt; i++) {
+               bnx2x_cl45_read(bp, port,
+                             ext_phy_type,
+                             ext_phy_addr,
+                             MDIO_PMA_DEVAD,
+                             MDIO_PMA_REG_8726_TWO_WIRE_DATA_BUF + i, &val);
+               o_buf[i] = (u8)(val & MDIO_PMA_REG_8726_TWO_WIRE_DATA_MASK);
+       }
+
+       for (i = 0; i < 100; i++) {
+               bnx2x_cl45_read(bp, port,
+                             ext_phy_type,
+                             ext_phy_addr,
+                             MDIO_PMA_DEVAD,
+                             MDIO_PMA_REG_8726_TWO_WIRE_CTRL, &val);
+               if ((val & MDIO_PMA_REG_8726_TWO_WIRE_CTRL_STATUS_MASK) ==
+                   MDIO_PMA_REG_8726_TWO_WIRE_STATUS_IDLE)
+                       return 0;;
+               msleep(1);
+       }
+       return -EINVAL;
+}
+
+
+static u8 bnx2x_get_sfp_module_type(struct link_params *params,
+                                 u8 *module_type)
+{
+       struct bnx2x *bp = params->bp;
+       u8 val;
+       *module_type = SFP_MODULE_TYPE_UNKNOWN;
+
+       /* First check for copper cable */
+       if (bnx2x_read_sfp_module_eeprom(params,
+                                      SFP_EEPROM_CON_TYPE_ADDR,
+                                      1,
+                                      &val) != 0) {
+               DP(NETIF_MSG_LINK, "Failed to read from SFP+ module EEPROM");
+               return -EINVAL;
+       }
+
+       switch (val) {
+       case SFP_EEPROM_CON_TYPE_VAL_COPPER:
+       {
+               u8 copper_module_type;
+               /* Check if its active cable( includes SFP+ module)
+               of passive cable*/
+               if (bnx2x_read_sfp_module_eeprom(params,
+                                              SFP_EEPROM_FC_TX_TECH_ADDR,
+                                              1,
+                                              &copper_module_type) !=
+                   0) {
+                       DP(NETIF_MSG_LINK,
+                               "Failed to read copper-cable-type"
+                               " from SFP+ EEPROM\n");
+                       return -EINVAL;
+               }
+
+               if (copper_module_type &
+                   SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_ACTIVE) {
+                       DP(NETIF_MSG_LINK, "Active Copper cable detected\n");
+                       *module_type = SFP_MODULE_TYPE_ACTIVE_COPPER_CABLE;
+               } else if (copper_module_type &
+                       SFP_EEPROM_FC_TX_TECH_BITMASK_COPPER_PASSIVE) {
+                               DP(NETIF_MSG_LINK, "Passive Copper"
+                                           " cable detected\n");
+                               *module_type =
+                                     SFP_MODULE_TYPE_PASSIVE_COPPER_CABLE;
+               } else {
+                       DP(NETIF_MSG_LINK, "Unknown copper-cable-"
+                                    "type 0x%x !!!\n", copper_module_type);
+                       return -EINVAL;
+               }
+               break;
+       }
+       case SFP_EEPROM_CON_TYPE_VAL_LC:
+               DP(NETIF_MSG_LINK, "Optic module detected\n");
+               *module_type = SFP_MODULE_TYPE_LC;
+               break;
+
+       default:
+               DP(NETIF_MSG_LINK, "Unable to determine module type 0x%x !!!\n",
+                        val);
+               return -EINVAL;
+       }
+       return 0;
+}
+
+
+/* This function read the relevant field from the module ( SFP+ ),
+       and verify it is compliant with this board */
+static u8 bnx2x_verify_sfp_module(struct link_params *params,
+                               u8 module_type)
+{
+       struct bnx2x *bp = params->bp;
+       u8 *str_p, *tmp_buf;
+       u16 i;
+
+#define COMPLIANCE_STR_CNT 6
+       u8 *compliance_str[] = {"Broadcom", "JDSU", "Molex Inc", "PICOLIGHT",
+               "FINISAR CORP.   ", "Amphenol"};
+       u8 buf[SFP_EEPROM_VENDOR_NAME_SIZE];
+       /* Passive Copper cables are allowed to participate,
+       since the module is hardwired to the copper cable */
+
+       if (!(params->feature_config_flags &
+            FEATURE_CONFIG_MODULE_ENFORCMENT_ENABLED)) {
+               DP(NETIF_MSG_LINK, "NOT enforcing module verification\n");
+               return 0;
+       }
+
+       if (module_type != SFP_MODULE_TYPE_LC) {
+               DP(NETIF_MSG_LINK, "No need to verify copper cable\n");
+               return 0;
+       }
+
+       /* In case of non copper cable or Active copper cable,
+               verify that the SFP+ module is compliant with this board*/
+       if (bnx2x_read_sfp_module_eeprom(params,
+                                      SFP_EEPROM_VENDOR_NAME_ADDR,
+                                      SFP_EEPROM_VENDOR_NAME_SIZE,
+                                      buf) != 0) {
+               DP(NETIF_MSG_LINK, "Failed to read Vendor-Name from"
+                           " module EEPROM\n");
+               return -EINVAL;
+       }
+       for (i = 0; i < COMPLIANCE_STR_CNT; i++) {
+               str_p = compliance_str[i];
+               tmp_buf = buf;
+               while (*str_p) {
+                       if ((u8)(*tmp_buf) != (u8)(*str_p))
+                               break;
+                       str_p++;
+                       tmp_buf++;
+               }
+
+               if (!(*str_p)) {
+                       DP(NETIF_MSG_LINK, "SFP+ Module verified, "
+                                    "index=%x\n", i);
+                       return 0;
+               }
+       }
+       DP(NETIF_MSG_LINK, "Incompliant SFP+ module. Disable module !!!\n");
+       return -EINVAL;
+}
+
+
+static u8 bnx2x_bcm8726_set_limiting_mode(struct link_params *params,
+                                       u8 module_type)
+{
+       struct bnx2x *bp = params->bp;
+       u8 port = params->port;
+       u8 options[SFP_EEPROM_OPTIONS_SIZE];
+       u8 limiting_mode;
+       u8 ext_phy_addr = ((params->ext_phy_config &
+                           PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
+                          PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
+
+       if (bnx2x_read_sfp_module_eeprom(params,
+                                      SFP_EEPROM_OPTIONS_ADDR,
+                                      SFP_EEPROM_OPTIONS_SIZE,
+                                      options) != 0) {
+               DP(NETIF_MSG_LINK, "Failed to read Option field from"
+                           " module EEPROM\n");
+               return -EINVAL;
+       }
+       limiting_mode = !(options[0] &
+                         SFP_EEPROM_OPTIONS_LINEAR_RX_OUT_MASK);
+       if (limiting_mode &&
+           (module_type != SFP_MODULE_TYPE_PASSIVE_COPPER_CABLE)) {
+               DP(NETIF_MSG_LINK,
+                        "Module options = 0x%x.Setting LIMITING MODE\n",
+                        options[0]);
+               bnx2x_cl45_write(bp, port,
+                              PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726,
+                              ext_phy_addr,
+                              MDIO_PMA_DEVAD,
+                              MDIO_PMA_REG_ROM_VER2,
+                              SFP_LIMITING_MODE_VALUE);
+       } else { /* LRM mode ( default )*/
+               u16 cur_limiting_mode;
+               DP(NETIF_MSG_LINK, "Module options = 0x%x.Setting LRM MODE\n",
+                        options[0]);
+
+               bnx2x_cl45_read(bp, port,
+                              PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726,
+                              ext_phy_addr,
+                              MDIO_PMA_DEVAD,
+                              MDIO_PMA_REG_ROM_VER2,
+                              &cur_limiting_mode);
+
+               /* Changing to LRM mode takes quite few seconds.
+               So do it only if current mode is limiting
+               ( default is LRM )*/
+               if (cur_limiting_mode != SFP_LIMITING_MODE_VALUE)
+                       return 0;
+
+               bnx2x_cl45_write(bp, port,
+                              PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726,
+                              ext_phy_addr,
+                              MDIO_PMA_DEVAD,
+                              MDIO_PMA_REG_LRM_MODE,
+                              0);
+               bnx2x_cl45_write(bp, port,
+                              PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726,
+                              ext_phy_addr,
+                              MDIO_PMA_DEVAD,
+                              MDIO_PMA_REG_ROM_VER2,
+                              0x128);
+               bnx2x_cl45_write(bp, port,
+                              PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726,
+                              ext_phy_addr,
+                              MDIO_PMA_DEVAD,
+                              MDIO_PMA_REG_MISC_CTRL0,
+                              0x4008);
+               bnx2x_cl45_write(bp, port,
+                              PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726,
+                              ext_phy_addr,
+                              MDIO_PMA_DEVAD,
+                              MDIO_PMA_REG_LRM_MODE,
+                              0xaaaa);
+       }
+       return 0;
+}
+
+static u8 bnx2x_wait_for_sfp_module_initialized(struct link_params *params)
+{
+       u8 val;
+       struct bnx2x *bp = params->bp;
+       u16 timeout;
+       /* Initialization time after hot-plug may take up to 300ms for some
+       phys type ( e.g. JDSU ) */
+       for (timeout = 0; timeout < 60; timeout++) {
+               if (bnx2x_read_sfp_module_eeprom(params, 1, 1, &val)
+                   == 0) {
+                       DP(NETIF_MSG_LINK, "SFP+ module initialization "
+                                    "took %d ms\n", timeout * 5);
+                       return 0;
+               }
+               msleep(5);
+       }
+       return -EINVAL;
+}
+
+static u8 bnx2x_sfp_module_detection(struct link_params *params)
+{
+       struct bnx2x *bp = params->bp;
+       u8 module_type;
+       u8 ext_phy_addr = ((params->ext_phy_config &
+                               PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
+                               PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
+       u32 ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
+
+       if (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) {
+               DP(NETIF_MSG_LINK, "Module detection is not required "
+                           "for this phy\n");
+               return 0;
+       }
+
+       DP(NETIF_MSG_LINK, "SFP+ module plugged in/out detected on port %d\n",
+                params->port);
+
+       if (bnx2x_get_sfp_module_type(params,
+                                   &module_type) != 0) {
+               DP(NETIF_MSG_LINK, "Failed to get valid module type\n");
+               if (!(params->feature_config_flags &
+                     FEATURE_CONFIG_MODULE_ENFORCMENT_ENABLED)) {
+                       /* In case module detection is disabled, it trys to
+                       link up. The issue that can happen here is LRM /
+                       LIMITING mode which set according to the module-type*/
+                       DP(NETIF_MSG_LINK, "Unable to read module-type."
+                                   "Probably due to Bit Stretching."
+                                   " Proceeding...\n");
+               } else {
+                       return -EINVAL;
+               }
+       } else if (bnx2x_verify_sfp_module(params, module_type) !=
+                  0) {
+               /* check SFP+ module compatibility */
+               DP(NETIF_MSG_LINK, "Module verification failed!!\n");
+               /* Turn on fault module-detected led */
+               bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0,
+                                 MISC_REGISTERS_GPIO_HIGH,
+                                 params->port);
+               return -EINVAL;
+       }
+
+       /* Turn off fault module-detected led */
+       bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0,
+                         MISC_REGISTERS_GPIO_LOW,
+                         params->port);
+
+       /* Check and set limiting mode / LRM mode */
+       if (bnx2x_bcm8726_set_limiting_mode(params, module_type)
+            != 0) {
+               DP(NETIF_MSG_LINK, "Setting limiting mode failed!!\n");
+               return -EINVAL;
+       }
+
+       /* Enable transmit for this module */
+       bnx2x_bcm8726_set_transmitter(bp, params->port,
+                                   ext_phy_addr, 1);
+       return 0;
+}
+
+void bnx2x_handle_module_detect_int(struct link_params *params)
+{
+       struct bnx2x *bp = params->bp;
+       u32 gpio_val;
+       u8 port = params->port;
+       /* Set valid module led off */
+       bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0,
+                         MISC_REGISTERS_GPIO_HIGH,
+                         params->port);
+
+       /* Get current gpio val refelecting module plugged in / out*/
+       gpio_val = bnx2x_get_gpio(bp,  MISC_REGISTERS_GPIO_3, port);
 
-       /* Clear ser_boot_ctl bit */
-       bnx2x_cl45_write(bp, port,
-                      PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
-                      ext_phy_addr,
-                      MDIO_PMA_DEVAD,
-                      MDIO_PMA_REG_MISC_CTRL1, 0x0000);
+       /* Call the handling function in case module is detected */
+       if (gpio_val == 0) {
 
-       bnx2x_cl45_read(bp, port, PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
-                     ext_phy_addr,
-                     MDIO_PMA_DEVAD,
-                     MDIO_PMA_REG_ROM_VER1, &fw_ver1);
-       bnx2x_cl45_read(bp, port,
-                     PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
-                     ext_phy_addr,
-                     MDIO_PMA_DEVAD,
-                     MDIO_PMA_REG_ROM_VER2, &fw_ver2);
-       DP(NETIF_MSG_LINK, "8073 FW version 0x%x:0x%x\n", fw_ver1, fw_ver2);
+               bnx2x_set_gpio_int(bp, MISC_REGISTERS_GPIO_3,
+                                     MISC_REGISTERS_GPIO_INT_OUTPUT_CLR,
+                                     port);
 
+               if (bnx2x_wait_for_sfp_module_initialized(params)
+                   == 0)
+                       bnx2x_sfp_module_detection(params);
+               else
+                       DP(NETIF_MSG_LINK, "SFP+ module is not initialized\n");
+       } else {
+               u8 ext_phy_addr = ((params->ext_phy_config &
+                                   PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
+                                  PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
+               bnx2x_set_gpio_int(bp, MISC_REGISTERS_GPIO_3,
+                                     MISC_REGISTERS_GPIO_INT_OUTPUT_SET,
+                                     port);
+               /* Module was plugged out. */
+               /* Disable transmit for this module */
+               bnx2x_bcm8726_set_transmitter(bp, params->port,
+                                           ext_phy_addr, 0);
+       }
 }
 
 static void bnx2x_bcm807x_force_10G(struct link_params *params)
@@ -2239,7 +2752,7 @@ static void bnx2x_bcm8073_set_xaui_low_power_mode(struct link_params *params)
                      PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
                      ext_phy_addr,
                      MDIO_PMA_DEVAD,
-                     0xc801, &val);
+                     MDIO_PMA_REG_8073_CHIP_REV, &val);
 
        if (val == 0) {
                /* Mustn't set low power mode in 8073 A0 */
@@ -2377,31 +2890,40 @@ static void bnx2x_ext_phy_set_pause(struct link_params *params,
                       MDIO_AN_DEVAD,
                       MDIO_AN_REG_ADV_PAUSE, val);
 }
+static void bnx2x_set_preemphasis(struct link_params *params)
+{
+       u16 bank, i = 0;
+       struct bnx2x *bp = params->bp;
+
+       for (bank = MDIO_REG_BANK_RX0, i = 0; bank <= MDIO_REG_BANK_RX3;
+             bank += (MDIO_REG_BANK_RX1-MDIO_REG_BANK_RX0), i++) {
+                       CL45_WR_OVER_CL22(bp, params->port,
+                                             params->phy_addr,
+                                             bank,
+                                             MDIO_RX0_RX_EQ_BOOST,
+                                             params->xgxs_config_rx[i]);
+       }
 
+       for (bank = MDIO_REG_BANK_TX0, i = 0; bank <= MDIO_REG_BANK_TX3;
+                     bank += (MDIO_REG_BANK_TX1 - MDIO_REG_BANK_TX0), i++) {
+                       CL45_WR_OVER_CL22(bp, params->port,
+                                             params->phy_addr,
+                                             bank,
+                                             MDIO_TX0_TX_DRIVER,
+                                             params->xgxs_config_tx[i]);
+       }
+}
 
 static void bnx2x_init_internal_phy(struct link_params *params,
                                struct link_vars *vars)
 {
        struct bnx2x *bp = params->bp;
-       u8 port = params->port;
        if (!(vars->phy_flags & PHY_SGMII_FLAG)) {
-               u16 bank, rx_eq;
-
-               rx_eq = ((params->serdes_config &
-                         PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_MASK) >>
-                        PORT_HW_CFG_SERDES_RX_DRV_EQUALIZER_SHIFT);
-
-               DP(NETIF_MSG_LINK, "setting rx eq to 0x%x\n", rx_eq);
-               for (bank = MDIO_REG_BANK_RX0; bank <= MDIO_REG_BANK_RX_ALL;
-                     bank += (MDIO_REG_BANK_RX1-MDIO_REG_BANK_RX0)) {
-                       CL45_WR_OVER_CL22(bp, port,
-                                             params->phy_addr,
-                                             bank ,
-                                             MDIO_RX0_RX_EQ_BOOST,
-                                             ((rx_eq &
-                               MDIO_RX0_RX_EQ_BOOST_EQUALIZER_CTRL_MASK) |
-                               MDIO_RX0_RX_EQ_BOOST_OFFSET_CTRL));
-               }
+               if ((XGXS_EXT_PHY_TYPE(params->ext_phy_config) ==
+                    PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) &&
+                   (params->feature_config_flags &
+                    FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED))
+                       bnx2x_set_preemphasis(params);
 
                /* forced speed requested? */
                if (vars->line_speed != SPEED_AUTO_NEG) {
@@ -2506,12 +3028,54 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
                                       ext_phy_addr,
                                       MDIO_WIS_DEVAD,
                                       MDIO_WIS_REG_LASI_CNTL, 0x1);
+
+                       bnx2x_save_bcm_spirom_ver(bp, params->port,
+                                               ext_phy_type,
+                                               ext_phy_addr,
+                                               params->shmem_base);
                        break;
 
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706:
-                       DP(NETIF_MSG_LINK, "XGXS 8706\n");
-
-                       msleep(10);
+                       /* Wait until fw is loaded */
+                       for (cnt = 0; cnt < 100; cnt++) {
+                               bnx2x_cl45_read(bp, params->port, ext_phy_type,
+                                             ext_phy_addr, MDIO_PMA_DEVAD,
+                                             MDIO_PMA_REG_ROM_VER1, &val);
+                               if (val)
+                                       break;
+                               msleep(10);
+                       }
+                       DP(NETIF_MSG_LINK, "XGXS 8706 is initialized "
+                               "after %d ms\n", cnt);
+                       if ((params->feature_config_flags &
+                            FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED)) {
+                               u8 i;
+                               u16 reg;
+                               for (i = 0; i < 4; i++) {
+                                       reg = MDIO_XS_8706_REG_BANK_RX0 +
+                                               i*(MDIO_XS_8706_REG_BANK_RX1 -
+                                                  MDIO_XS_8706_REG_BANK_RX0);
+                                       bnx2x_cl45_read(bp, params->port,
+                                                     ext_phy_type,
+                                                     ext_phy_addr,
+                                                     MDIO_XS_DEVAD,
+                                                     reg, &val);
+                                       /* Clear first 3 bits of the control */
+                                       val &= ~0x7;
+                                       /* Set control bits according to
+                                       configuation */
+                                       val |= (params->xgxs_config_rx[i] &
+                                               0x7);
+                                       DP(NETIF_MSG_LINK, "Setting RX"
+                                                "Equalizer to BCM8706 reg 0x%x"
+                                                " <-- val 0x%x\n", reg, val);
+                                       bnx2x_cl45_write(bp, params->port,
+                                                      ext_phy_type,
+                                                      ext_phy_addr,
+                                                      MDIO_XS_DEVAD,
+                                                      reg, val);
+                               }
+                       }
                        /* Force speed */
                        /* First enable LASI */
                        bnx2x_cl45_write(bp, params->port,
@@ -2578,9 +3142,95 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
                                               0x1200);
 
                        }
-
+                       bnx2x_save_bcm_spirom_ver(bp, params->port,
+                                               ext_phy_type,
+                                               ext_phy_addr,
+                                               params->shmem_base);
                        break;
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+                       DP(NETIF_MSG_LINK, "Initializing BCM8726\n");
+                       bnx2x_bcm8726_external_rom_boot(params);
+
+                       /* Need to call module detected on initialization since
+                       the module detection triggered by actual module
+                       insertion might occur before driver is loaded, and when
+                       driver is loaded, it reset all registers, including the
+                       transmitter */
+                       bnx2x_sfp_module_detection(params);
+                       if (params->req_line_speed == SPEED_1000) {
+                               DP(NETIF_MSG_LINK, "Setting 1G force\n");
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_CTRL, 0x40);
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_10G_CTRL2, 0xD);
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_LASI_CTRL, 0x5);
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_RX_ALARM_CTRL,
+                                              0x400);
+                       } else if ((params->req_line_speed ==
+                                   SPEED_AUTO_NEG) &&
+                                  ((params->speed_cap_mask &
+                                    PORT_HW_CFG_SPEED_CAPABILITY_D0_1G))) {
+                               DP(NETIF_MSG_LINK, "Setting 1G clause37 \n");
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_AN_DEVAD,
+                                              MDIO_AN_REG_ADV, 0x20);
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_AN_DEVAD,
+                                              MDIO_AN_REG_CL37_CL73, 0x040c);
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_AN_DEVAD,
+                                              MDIO_AN_REG_CL37_FC_LD, 0x0020);
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_AN_DEVAD,
+                                              MDIO_AN_REG_CL37_AN, 0x1000);
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_AN_DEVAD,
+                                              MDIO_AN_REG_CTRL, 0x1200);
+
+                               /* Enable RX-ALARM control to receive
+                               interrupt for 1G speed change */
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_LASI_CTRL, 0x4);
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_RX_ALARM_CTRL,
+                                              0x400);
+
+                       } else { /* Default 10G. Set only LASI control */
+                               bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                              ext_phy_addr, MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_LASI_CTRL, 1);
+                       }
+
+                       /* Set TX PreEmphasis if needed */
+                       if ((params->feature_config_flags &
+                            FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED)) {
+                               DP(NETIF_MSG_LINK, "Setting TX_CTRL1 0x%x,"
+                                        "TX_CTRL2 0x%x\n",
+                                        params->xgxs_config_tx[0],
+                                        params->xgxs_config_tx[1]);
+                               bnx2x_cl45_write(bp, params->port,
+                                              ext_phy_type,
+                                              ext_phy_addr,
+                                              MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_8726_TX_CTRL1,
+                                              params->xgxs_config_tx[0]);
 
+                               bnx2x_cl45_write(bp, params->port,
+                                              ext_phy_type,
+                                              ext_phy_addr,
+                                              MDIO_PMA_DEVAD,
+                                              MDIO_PMA_REG_8726_TX_CTRL2,
+                                              params->xgxs_config_tx[1]);
+                       }
+                       break;
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
                {
@@ -2627,7 +3277,7 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
                                      ext_phy_type,
                                      ext_phy_addr,
                                      MDIO_PMA_DEVAD,
-                                     0xca13,
+                                     MDIO_PMA_REG_M8051_MSGOUT_REG,
                                      &tmp1);
 
                        bnx2x_cl45_read(bp, params->port,
@@ -2694,7 +3344,7 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
                                              ext_phy_type,
                                              ext_phy_addr,
                                              MDIO_AN_DEVAD,
-                                             0x8329, &tmp1);
+                                             MDIO_AN_REG_8073_2_5G, &tmp1);
 
                                if (((params->speed_cap_mask &
                                      PORT_HW_CFG_SPEED_CAPABILITY_D0_2_5G) &&
@@ -2708,7 +3358,7 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
                                         PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
                                         ext_phy_addr,
                                         MDIO_PMA_DEVAD,
-                                        0xc801, &phy_ver);
+                                        MDIO_PMA_REG_8073_CHIP_REV, &phy_ver);
                                        DP(NETIF_MSG_LINK, "Add 2.5G\n");
                                        if (phy_ver > 0)
                                                tmp1 |= 1;
@@ -2723,7 +3373,7 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
                                               ext_phy_type,
                                               ext_phy_addr,
                                               MDIO_AN_DEVAD,
-                                              0x8329, tmp1);
+                                              MDIO_AN_REG_8073_2_5G, tmp1);
                        }
 
                        /* Add support for CL37 (passive mode) II */
@@ -2798,6 +3448,8 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
                        break;
                }
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
+               {
+                       u16 fw_ver1, fw_ver2;
                        DP(NETIF_MSG_LINK,
                                "Setting the SFX7101 LASI indication\n");
 
@@ -2827,6 +3479,50 @@ static u8 bnx2x_ext_phy_init(struct link_params *params, struct link_vars *vars)
                                       ext_phy_addr,
                                       MDIO_AN_DEVAD,
                                       MDIO_AN_REG_CTRL, val);
+
+                       /* Save spirom version */
+                       bnx2x_cl45_read(bp, params->port, ext_phy_type,
+                                     ext_phy_addr, MDIO_PMA_DEVAD,
+                                     MDIO_PMA_REG_7101_VER1, &fw_ver1);
+
+                       bnx2x_cl45_read(bp, params->port, ext_phy_type,
+                                     ext_phy_addr, MDIO_PMA_DEVAD,
+                                     MDIO_PMA_REG_7101_VER2, &fw_ver2);
+
+                       bnx2x_save_spirom_version(params->bp, params->port,
+                                               params->shmem_base,
+                                               (u32)(fw_ver1<<16 | fw_ver2));
+
+                       break;
+               }
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
+                       DP(NETIF_MSG_LINK,
+                               "Setting the BCM8481 LASI control\n");
+
+                       bnx2x_cl45_write(bp, params->port,
+                                      ext_phy_type,
+                                      ext_phy_addr,
+                                      MDIO_PMA_DEVAD,
+                                      MDIO_PMA_REG_LASI_CTRL, 0x1);
+
+                       /* Restart autoneg */
+                       bnx2x_cl45_read(bp, params->port,
+                                     ext_phy_type,
+                                     ext_phy_addr,
+                                     MDIO_AN_DEVAD,
+                                     MDIO_AN_REG_CTRL, &val);
+                       val |= 0x200;
+                       bnx2x_cl45_write(bp, params->port,
+                                      ext_phy_type,
+                                      ext_phy_addr,
+                                      MDIO_AN_DEVAD,
+                                      MDIO_AN_REG_CTRL, val);
+
+                       bnx2x_save_bcm_spirom_ver(bp, params->port,
+                                               ext_phy_type,
+                                               ext_phy_addr,
+                                               params->shmem_base);
+
                        break;
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE:
                        DP(NETIF_MSG_LINK,
@@ -2910,38 +3606,43 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
                        break;
 
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706:
-                       DP(NETIF_MSG_LINK, "XGXS 8706\n");
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+                       DP(NETIF_MSG_LINK, "XGXS 8706/8726\n");
+                       /* Clear RX Alarm*/
                        bnx2x_cl45_read(bp, params->port, ext_phy_type,
                                      ext_phy_addr,
-                                     MDIO_PMA_DEVAD,
-                                     MDIO_PMA_REG_LASI_STATUS, &val1);
-                       DP(NETIF_MSG_LINK, "8706 LASI status 0x%x\n", val1);
-
+                                     MDIO_PMA_DEVAD, MDIO_PMA_REG_RX_ALARM,
+                                     &val2);
+                       /* clear LASI indication*/
                        bnx2x_cl45_read(bp, params->port, ext_phy_type,
                                      ext_phy_addr,
-                                     MDIO_PMA_DEVAD,
-                                     MDIO_PMA_REG_LASI_STATUS, &val1);
-                       DP(NETIF_MSG_LINK, "8706 LASI status 0x%x\n", val1);
+                                     MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_STATUS,
+                                     &val1);
+                       bnx2x_cl45_read(bp, params->port, ext_phy_type,
+                                     ext_phy_addr,
+                                     MDIO_PMA_DEVAD, MDIO_PMA_REG_LASI_STATUS,
+                                     &val2);
+                       DP(NETIF_MSG_LINK, "8706/8726 LASI status 0x%x-->"
+                                    "0x%x\n", val1, val2);
 
                        bnx2x_cl45_read(bp, params->port, ext_phy_type,
                                      ext_phy_addr,
-                                     MDIO_PMA_DEVAD,
-                                     MDIO_PMA_REG_RX_SD, &rx_sd);
+                                     MDIO_PMA_DEVAD, MDIO_PMA_REG_RX_SD,
+                                     &rx_sd);
                        bnx2x_cl45_read(bp, params->port, ext_phy_type,
                                      ext_phy_addr,
-                                     MDIO_PCS_DEVAD,
-                                     MDIO_PCS_REG_STATUS, &pcs_status);
-
+                                     MDIO_PCS_DEVAD, MDIO_PCS_REG_STATUS,
+                                     &pcs_status);
                        bnx2x_cl45_read(bp, params->port, ext_phy_type,
                                      ext_phy_addr,
-                                     MDIO_AN_DEVAD,
-                                     MDIO_AN_REG_LINK_STATUS, &val2);
+                                     MDIO_AN_DEVAD, MDIO_AN_REG_LINK_STATUS,
+                                     &val2);
                        bnx2x_cl45_read(bp, params->port, ext_phy_type,
                                      ext_phy_addr,
-                                     MDIO_AN_DEVAD,
-                                     MDIO_AN_REG_LINK_STATUS, &val2);
+                                     MDIO_AN_DEVAD, MDIO_AN_REG_LINK_STATUS,
+                                     &val2);
 
-                       DP(NETIF_MSG_LINK, "8706 rx_sd 0x%x"
+                       DP(NETIF_MSG_LINK, "8706/8726 rx_sd 0x%x"
                           "  pcs_status 0x%x 1Gbps link_status 0x%x\n",
                           rx_sd, pcs_status, val2);
                        /* link is up if both bit 0 of pmd_rx_sd and
@@ -2951,19 +3652,31 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
                        ext_phy_link_up = ((rx_sd & pcs_status & 0x1) ||
                                           (val2 & (1<<1)));
                        if (ext_phy_link_up) {
+                               if (ext_phy_type ==
+                                    PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) {
+                                       /* If transmitter is disabled,
+                                       ignore false link up indication */
+                                       bnx2x_cl45_read(bp, params->port,
+                                                  ext_phy_type,
+                                                  ext_phy_addr,
+                                                  MDIO_PMA_DEVAD,
+                                                  MDIO_PMA_REG_PHY_IDENTIFIER,
+                                                  &val1);
+                                       if (val1 & (1<<15)) {
+                                               DP(NETIF_MSG_LINK, "Tx is "
+                                                           "disabled\n");
+                                               ext_phy_link_up = 0;
+                                               break;
+                                       }
+                               }
+
                                if (val2 & (1<<1))
                                        vars->line_speed = SPEED_1000;
                                else
                                        vars->line_speed = SPEED_10000;
                        }
 
-                       /* clear LASI indication*/
-                       bnx2x_cl45_read(bp, params->port, ext_phy_type,
-                                     ext_phy_addr,
-                                     MDIO_PMA_DEVAD,
-                                     MDIO_PMA_REG_RX_ALARM, &val2);
                        break;
-
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
                {
@@ -3018,7 +3731,7 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
                                      ext_phy_type,
                                      ext_phy_addr,
                                      MDIO_PMA_DEVAD,
-                                     0xca13,
+                                     MDIO_PMA_REG_M8051_MSGOUT_REG,
                                      &val1);
 
                        /* Check the LASI */
@@ -3063,17 +3776,17 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
                                        }
                                }
                                bnx2x_cl45_read(bp, params->port,
-                                                     ext_phy_type,
-                                                     ext_phy_addr,
-                                                     MDIO_AN_DEVAD,
-                                                     0x8304,
-                                                     &an1000_status);
+                                             ext_phy_type,
+                                             ext_phy_addr,
+                                             MDIO_AN_DEVAD,
+                                             MDIO_AN_REG_LINK_STATUS,
+                                             &an1000_status);
                                bnx2x_cl45_read(bp, params->port,
-                                                     ext_phy_type,
-                                                     ext_phy_addr,
-                                                     MDIO_AN_DEVAD,
-                                                     0x8304,
-                                                     &an1000_status);
+                                             ext_phy_type,
+                                             ext_phy_addr,
+                                             MDIO_AN_DEVAD,
+                                             MDIO_AN_REG_LINK_STATUS,
+                                             &an1000_status);
 
                                /* Check the link status on 1.1.2 */
                                bnx2x_cl45_read(bp, params->port,
@@ -3090,7 +3803,7 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
                                             "an_link_status=0x%x\n",
                                          val2, val1, an1000_status);
 
-                                       ext_phy_link_up = (((val1 & 4) == 4) ||
+                               ext_phy_link_up = (((val1 & 4) == 4) ||
                                                (an1000_status & (1<<1)));
                                if (ext_phy_link_up &&
                                    bnx2x_8073_is_snr_needed(params)) {
@@ -3118,11 +3831,11 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
 
                                }
                                bnx2x_cl45_read(bp, params->port,
-                                                     ext_phy_type,
-                                                     ext_phy_addr,
-                                                     MDIO_PMA_DEVAD,
-                                                     0xc820,
-                                                     &link_status);
+                                          ext_phy_type,
+                                          ext_phy_addr,
+                                          MDIO_PMA_DEVAD,
+                                          MDIO_PMA_REG_8073_SPEED_LINK_STATUS,
+                                          &link_status);
 
                                /* Bits 0..2 --> speed detected,
                                   bits 13..15--> link is down */
@@ -3156,17 +3869,17 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
                        } else {
                                /* See if 1G link is up for the 8072 */
                                bnx2x_cl45_read(bp, params->port,
-                                                     ext_phy_type,
-                                                     ext_phy_addr,
-                                                     MDIO_AN_DEVAD,
-                                                     0x8304,
-                                                     &an1000_status);
+                                             ext_phy_type,
+                                             ext_phy_addr,
+                                             MDIO_AN_DEVAD,
+                                             MDIO_AN_REG_LINK_STATUS,
+                                             &an1000_status);
                                bnx2x_cl45_read(bp, params->port,
-                                                     ext_phy_type,
-                                                     ext_phy_addr,
-                                                     MDIO_AN_DEVAD,
-                                                     0x8304,
-                                                     &an1000_status);
+                                             ext_phy_type,
+                                             ext_phy_addr,
+                                             MDIO_AN_DEVAD,
+                                             MDIO_AN_REG_LINK_STATUS,
+                                             &an1000_status);
                                if (an1000_status & (1<<1)) {
                                        ext_phy_link_up = 1;
                                        vars->line_speed = SPEED_1000;
@@ -3226,7 +3939,53 @@ static u8 bnx2x_ext_phy_is_link_up(struct link_params *params,
                                         (val2 & (1<<14)));
                        }
                        break;
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
+                       /* Clear LASI interrupt */
+                       bnx2x_cl45_read(bp, params->port,
+                                     ext_phy_type,
+                                     ext_phy_addr,
+                                     MDIO_PMA_DEVAD,
+                                     MDIO_PMA_REG_LASI_STATUS, &val1);
+                       DP(NETIF_MSG_LINK, "8481 LASI status reg = 0x%x\n",
+                                val1);
+
+                       /* Check 10G-BaseT link status */
+                       /* Check Global PMD signal ok */
+                       bnx2x_cl45_read(bp, params->port, ext_phy_type,
+                                     ext_phy_addr,
+                                     MDIO_PMA_DEVAD, MDIO_PMA_REG_RX_SD,
+                                     &rx_sd);
+                       /* Check PCS block lock */
+                       bnx2x_cl45_read(bp, params->port, ext_phy_type,
+                                     ext_phy_addr,
+                                     MDIO_PCS_DEVAD, MDIO_PCS_REG_STATUS,
+                                     &pcs_status);
+                       DP(NETIF_MSG_LINK, "8481 1.a = 0x%x, 1.20 = 0x%x\n",
+                                rx_sd, pcs_status);
+                       if (rx_sd & pcs_status & 0x1) {
+                               vars->line_speed = SPEED_10000;
+                               ext_phy_link_up = 1;
+                       } else {
+
+                               /* Check 1000-BaseT link status */
+                               bnx2x_cl45_read(bp, params->port, ext_phy_type,
+                                             ext_phy_addr,
+                                             MDIO_AN_DEVAD, 0xFFE1,
+                                             &val1);
+
+                               bnx2x_cl45_read(bp, params->port, ext_phy_type,
+                                             ext_phy_addr,
+                                             MDIO_AN_DEVAD, 0xFFE1,
+                                             &val2);
+                               DP(NETIF_MSG_LINK, "8481 7.FFE1 ="
+                                            "0x%x-->0x%x\n", val1, val2);
+                               if (val2 & (1<<2)) {
+                                       vars->line_speed = SPEED_1000;
+                                       ext_phy_link_up = 1;
+                               }
+                       }
 
+                       break;
                default:
                        DP(NETIF_MSG_LINK, "BAD XGXS ext_phy_config 0x%x\n",
                           params->ext_phy_config);
@@ -3426,7 +4185,7 @@ static void bnx2x_turn_on_ef(struct bnx2x *bp, u8 port, u8 ext_phy_addr,
                              ext_phy_addr,
                              MDIO_PMA_DEVAD,
                              MDIO_PMA_REG_CTRL,
-                              &ctrl);
+                             &ctrl);
                if (!(ctrl & (1<<15))) {
                        DP(NETIF_MSG_LINK, "Reset completed\n\n");
                                break;
@@ -3452,91 +4211,38 @@ u8 bnx2x_get_ext_phy_fw_version(struct link_params *params, u8 driver_loaded,
 {
        struct bnx2x *bp = params->bp;
        u32 ext_phy_type = 0;
-       u16 val = 0;
-       u8 ext_phy_addr = 0 ;
+       u32 spirom_ver = 0;
        u8 status = 0 ;
-       u32 ver_num;
 
        if (version == NULL || params == NULL)
                return -EINVAL;
 
+       spirom_ver = REG_RD(bp, params->shmem_base +
+                  offsetof(struct shmem_region,
+                           port_mb[params->port].ext_phy_fw_version));
+
        /* reset the returned value to zero */
        ext_phy_type = XGXS_EXT_PHY_TYPE(params->ext_phy_config);
-       ext_phy_addr = ((params->ext_phy_config &
-                               PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
-                               PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
-
        switch (ext_phy_type) {
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
 
                if (len < 5)
                        return -EINVAL;
 
-               /* Take ext phy out of reset */
-               if (!driver_loaded)
-                       bnx2x_turn_on_ef(bp, params->port, ext_phy_addr,
-                                      ext_phy_type);
-
-               /*  wait for 1ms */
-               msleep(1);
-
-               bnx2x_cl45_read(bp, params->port,
-                             ext_phy_type,
-                             ext_phy_addr,
-                             MDIO_PMA_DEVAD,
-                             MDIO_PMA_REG_7101_VER1, &val);
-               version[2] = (val & 0xFF);
-               version[3] = ((val & 0xFF00)>>8);
-
-               bnx2x_cl45_read(bp, params->port,
-                             ext_phy_type,
-                             ext_phy_addr,
-                             MDIO_PMA_DEVAD, MDIO_PMA_REG_7101_VER2,
-                             &val);
-               version[0] = (val & 0xFF);
-               version[1] = ((val & 0xFF00)>>8);
+               version[0] = (spirom_ver & 0xFF);
+               version[1] = (spirom_ver & 0xFF00) >> 8;
+               version[2] = (spirom_ver & 0xFF0000) >> 16;
+               version[3] = (spirom_ver & 0xFF000000) >> 24;
                version[4] = '\0';
 
-               if (!driver_loaded)
-                       bnx2x_turn_off_sf(bp, params->port);
                break;
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
-       {
-               /* Take ext phy out of reset */
-               if (!driver_loaded)
-                       bnx2x_turn_on_ef(bp, params->port, ext_phy_addr,
-                                      ext_phy_type);
-
-               bnx2x_cl45_read(bp, params->port, ext_phy_type,
-                             ext_phy_addr,
-                             MDIO_PMA_DEVAD,
-                             MDIO_PMA_REG_ROM_VER1, &val);
-               ver_num = val<<16;
-               bnx2x_cl45_read(bp, params->port, ext_phy_type,
-                             ext_phy_addr,
-                             MDIO_PMA_DEVAD,
-                             MDIO_PMA_REG_ROM_VER2, &val);
-               ver_num |= val;
-               status = bnx2x_format_ver(ver_num, version, len);
-               break;
-       }
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705:
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706:
-
-               bnx2x_cl45_read(bp, params->port, ext_phy_type,
-                             ext_phy_addr,
-                             MDIO_PMA_DEVAD,
-                             MDIO_PMA_REG_ROM_VER1, &val);
-               ver_num = val<<16;
-               bnx2x_cl45_read(bp, params->port, ext_phy_type,
-                             ext_phy_addr,
-                             MDIO_PMA_DEVAD,
-                             MDIO_PMA_REG_ROM_VER2, &val);
-               ver_num |= val;
-               status = bnx2x_format_ver(ver_num, version, len);
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+               status = bnx2x_format_ver(spirom_ver, version, len);
                break;
-
        case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT:
                break;
 
@@ -3636,6 +4342,14 @@ static void bnx2x_ext_phy_loopback(struct link_params *params)
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706:
                        DP(NETIF_MSG_LINK, "ext_phy_loopback: 8706\n");
                        break;
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+                       DP(NETIF_MSG_LINK, "PMA/PMD ext_phy_loopback: 8726\n");
+                       bnx2x_cl45_write(bp, params->port, ext_phy_type,
+                                      ext_phy_addr,
+                                      MDIO_PMA_DEVAD,
+                                      MDIO_PMA_REG_CTRL,
+                                      0x0001);
+                       break;
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
                        /* SFX7101_XGXS_TEST1 */
                        bnx2x_cl45_write(bp, params->port, ext_phy_type,
@@ -3910,7 +4624,9 @@ static u8 bnx2x_link_initialize(struct link_params *params,
                       (params->loopback_mode == LOOPBACK_EXT_PHY));
 
        if (non_ext_phy ||
-           (ext_phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705)) {
+           (ext_phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705) ||
+           (ext_phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) ||
+           (ext_phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481)) {
                if (params->req_line_speed == SPEED_AUTO_NEG)
                        bnx2x_set_parallel_detection(params, vars->phy_flags);
                bnx2x_init_internal_phy(params, vars);
@@ -4104,6 +4820,7 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
                        return -EINVAL;
                        break;
                }
+               DP(NETIF_MSG_LINK, "Phy address = 0x%x\n", params->phy_addr);
 
                bnx2x_link_initialize(params, vars);
                msleep(30);
@@ -4112,7 +4829,23 @@ u8 bnx2x_phy_init(struct link_params *params, struct link_vars *vars)
        return 0;
 }
 
-u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars)
+static void bnx2x_8726_reset_phy(struct bnx2x *bp, u8 port, u8 ext_phy_addr)
+{
+       DP(NETIF_MSG_LINK, "bnx2x_8726_reset_phy port %d\n", port);
+
+       /* Set serial boot control for external load */
+       bnx2x_cl45_write(bp, port,
+                      PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726, ext_phy_addr,
+                      MDIO_PMA_DEVAD,
+                      MDIO_PMA_REG_GEN_CTRL, 0x0001);
+
+       /* Disable Transmitter */
+       bnx2x_bcm8726_set_transmitter(bp, port, ext_phy_addr, 0);
+
+}
+
+u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
+                 u8 reset_ext_phy)
 {
 
        struct bnx2x *bp = params->bp;
@@ -4150,28 +4883,37 @@ u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars)
         */
         /* clear link led */
        bnx2x_set_led(bp, port, LED_MODE_OFF, 0, hw_led_mode, chip_id);
-       if (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT) {
-               if ((ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072) &&
-                   (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073)) {
+       if (reset_ext_phy) {
+               switch (ext_phy_type) {
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT:
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
+                       break;
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
+                       DP(NETIF_MSG_LINK, "Setting 8073 port %d into "
+                                "low power mode\n",
+                                port);
+                       bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
+                                         MISC_REGISTERS_GPIO_OUTPUT_LOW,
+                                         port);
+                       break;
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+               {
+                       u8 ext_phy_addr = ((params->ext_phy_config &
+                                        PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
+                                        PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
+                       /* Set soft reset */
+                       bnx2x_8726_reset_phy(bp, params->port, ext_phy_addr);
+                       break;
+               }
+               default:
                        /* HW reset */
-
                        bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_1,
                                          MISC_REGISTERS_GPIO_OUTPUT_LOW,
                                          port);
-
                        bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
                                          MISC_REGISTERS_GPIO_OUTPUT_LOW,
                                          port);
-
                        DP(NETIF_MSG_LINK, "reset external PHY\n");
-               } else if (ext_phy_type ==
-                          PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073) {
-                               DP(NETIF_MSG_LINK, "Setting 8073 port %d into "
-                                        "low power mode\n",
-                                        port);
-                               bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_2,
-                                       MISC_REGISTERS_GPIO_OUTPUT_LOW,
-                                                 port);
                }
        }
        /* reset the SerDes/XGXS */
@@ -4248,7 +4990,7 @@ static u8 bnx2x_update_link_up(struct link_params *params,
                if (gp_status & MDIO_AN_CL73_OR_37_COMPLETE) {
                        if (!(vars->phy_flags &
                              PHY_SGMII_FLAG))
-                               bnx2x_set_sgmii_tx_driver(params);
+                               bnx2x_set_gmii_tx_driver(params);
                }
        }
 
@@ -4337,6 +5079,7 @@ u8 bnx2x_link_update(struct link_params *params, struct link_vars *vars)
 
        if ((ext_phy_type != PORT_HW_CFG_SERDES_EXT_PHY_TYPE_DIRECT) &&
            (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705) &&
+           (ext_phy_type != PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726) &&
            (ext_phy_link_up && !vars->phy_link_up))
                bnx2x_init_internal_phy(params, vars);
 
@@ -4398,7 +5141,7 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, u32 shmem_base)
                u16 fw_ver1;
 
                bnx2x_bcm8073_external_rom_boot(bp, port,
-                                                     ext_phy_addr[port]);
+                                             ext_phy_addr[port], shmem_base);
 
                bnx2x_cl45_read(bp, port, PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
                              ext_phy_addr[port],
@@ -4434,7 +5177,7 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, u32 shmem_base)
 
        /* PART3 - complete TX_POWER_DOWN process, and set GPIO2 back to low */
        for (port = PORT_MAX - 1; port >= PORT_0; port--) {
-               /* Phase2 of POWER_DOWN_RESET*/
+               /* Phase2 of POWER_DOWN_RESET */
                /* Release bit 10 (Release Tx power down) */
                bnx2x_cl45_read(bp, port,
                              PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073,
@@ -4469,12 +5212,51 @@ static u8 bnx2x_8073_common_init_phy(struct bnx2x *bp, u32 shmem_base)
 
 }
 
+
+static u8 bnx2x_8726_common_init_phy(struct bnx2x *bp, u32 shmem_base)
+{
+       u8 ext_phy_addr;
+       u32 val;
+       s8 port;
+       /* Use port1 because of the static port-swap */
+       /* Enable the module detection interrupt */
+       val = REG_RD(bp, MISC_REG_GPIO_EVENT_EN);
+       val |= ((1<<MISC_REGISTERS_GPIO_3)|
+               (1<<(MISC_REGISTERS_GPIO_3 + MISC_REGISTERS_GPIO_PORT_SHIFT)));
+       REG_WR(bp, MISC_REG_GPIO_EVENT_EN, val);
+
+       bnx2x_hw_reset(bp, 1);
+       msleep(5);
+       for (port = 0; port < PORT_MAX; port++) {
+               /* Extract the ext phy address for the port */
+               u32 ext_phy_config = REG_RD(bp, shmem_base +
+                                       offsetof(struct shmem_region,
+                       dev_info.port_hw_config[port].external_phy_config));
+
+               ext_phy_addr =
+                       ((ext_phy_config &
+                             PORT_HW_CFG_XGXS_EXT_PHY_ADDR_MASK) >>
+                             PORT_HW_CFG_XGXS_EXT_PHY_ADDR_SHIFT);
+               DP(NETIF_MSG_LINK, "8726_common_init : ext_phy_addr = 0x%x\n",
+                        ext_phy_addr);
+
+               bnx2x_8726_reset_phy(bp, port, ext_phy_addr);
+
+               /* Set fault module detected LED on */
+               bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_0,
+                                 MISC_REGISTERS_GPIO_HIGH,
+                                 port);
+       }
+
+       return 0;
+}
+
 u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base)
 {
        u8 rc = 0;
        u32 ext_phy_type;
 
-       DP(NETIF_MSG_LINK, "bnx2x_common_init_phy\n");
+       DP(NETIF_MSG_LINK, "Begin common phy init\n");
 
        /* Read the ext_phy_type for arbitrary port(0) */
        ext_phy_type = XGXS_EXT_PHY_TYPE(
@@ -4488,6 +5270,12 @@ u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base)
                rc = bnx2x_8073_common_init_phy(bp, shmem_base);
                break;
        }
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+               /* GPIO1 affects both ports, so there's need to pull
+               it for single port alone */
+               rc = bnx2x_8726_common_init_phy(bp, shmem_base);
+
+               break;
        default:
                DP(NETIF_MSG_LINK,
                         "bnx2x_common_init_phy: ext_phy 0x%x not required\n",
index 47cb585f4278a8680b0eba010eeb8f145d040b8d..19a866dc10ebbf1629f8b7207e15c366c4aade6c 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright 2008 Broadcom Corporation
+/* Copyright 2008-2009 Broadcom Corporation
  *
  * Unless you and Broadcom execute a separate written software license
  * agreement governing use of this software, this software is licensed to you
@@ -66,8 +66,6 @@ struct link_params {
        /* Device parameters */
        u8 mac_addr[6];
 
-
-
        /* shmem parameters */
        u32 shmem_base;
        u32 speed_cap_mask;
@@ -77,7 +75,6 @@ struct link_params {
 #define SWITCH_CFG_AUTO_DETECT PORT_FEATURE_CON_SWITCH_AUTO_DETECT
 
        u16 hw_led_mode; /* part of the hw_config read from the shmem */
-       u32 serdes_config;
        u32 lane_config;
        u32 ext_phy_config;
 #define XGXS_EXT_PHY_TYPE(ext_phy_config)      (ext_phy_config & \
@@ -89,6 +86,12 @@ struct link_params {
 
        /* phy_addr populated by the CLC */
        u8 phy_addr;
+       u16 xgxs_config_rx[4]; /* preemphasis values for the rx side */
+
+       u16 xgxs_config_tx[4]; /* preemphasis values for the tx side */
+       u32 feature_config_flags;
+#define FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED (1<<0)
+#define FEATURE_CONFIG_MODULE_ENFORCMENT_ENABLED       (2<<0)
        /* Device pointer passed to all callback functions */
        struct bnx2x *bp;
 };
@@ -125,8 +128,11 @@ struct link_vars {
 /* Initialize the phy */
 u8 bnx2x_phy_init(struct link_params *input, struct link_vars *output);
 
-/* Reset the link. Should be called when driver or interface goes down */
-u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars);
+/* Reset the link. Should be called when driver or interface goes down
+   Before calling phy firmware upgrade, the reset_ext_phy should be set
+   to 0 */
+u8 bnx2x_link_reset(struct link_params *params, struct link_vars *vars,
+                 u8 reset_ext_phy);
 
 /* bnx2x_link_update should be called upon link interrupt */
 u8 bnx2x_link_update(struct link_params *input, struct link_vars *output);
@@ -163,6 +169,10 @@ u8 bnx2x_override_led_value(struct bnx2x *bp, u8 port, u32 led_idx, u32 value);
 
 u8 bnx2x_flash_download(struct bnx2x *bp, u8 port, u32 ext_phy_config,
                      u8 driver_loaded, char data[], u32 size);
+/* bnx2x_handle_module_detect_int should be called upon module detection
+   interrupt */
+void bnx2x_handle_module_detect_int(struct link_params *params);
+
 /* Get the actual link status. In case it returns 0, link is up,
        otherwise link is down*/
 u8 bnx2x_test_link(struct link_params *input, struct link_vars *vars);
@@ -170,4 +180,5 @@ u8 bnx2x_test_link(struct link_params *input, struct link_vars *vars);
 /* One-time initialization for external phy after power up */
 u8 bnx2x_common_init_phy(struct bnx2x *bp, u32 shmem_base);
 
+
 #endif /* BNX2X_LINK_H */
index d3e7775a9ccfaa2cc262c28ff4ba6c60b4a1ab6e..942717526d6a942dd1576560f18da5a9a13fbf65 100644 (file)
 #include <linux/zlib.h>
 #include <linux/io.h>
 
-#include "bnx2x_reg.h"
-#include "bnx2x_fw_defs.h"
-#include "bnx2x_hsi.h"
-#include "bnx2x_link.h"
+
 #include "bnx2x.h"
 #include "bnx2x_init.h"
 
-#define DRV_MODULE_VERSION     "1.45.26"
-#define DRV_MODULE_RELDATE     "2009/01/26"
+#define DRV_MODULE_VERSION     "1.48.102"
+#define DRV_MODULE_RELDATE     "2009/02/12"
 #define BNX2X_BC_VER           0x040200
 
 /* Time in jiffies before concluding the transmitter is hung */
@@ -73,26 +70,31 @@ MODULE_DESCRIPTION("Broadcom NetXtreme II BCM57710/57711/57711E Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_MODULE_VERSION);
 
+static int multi_mode = 1;
+module_param(multi_mode, int, 0);
+
 static int disable_tpa;
-static int use_inta;
+module_param(disable_tpa, int, 0);
+MODULE_PARM_DESC(disable_tpa, " Disable the TPA (LRO) feature");
+
+static int int_mode;
+module_param(int_mode, int, 0);
+MODULE_PARM_DESC(int_mode, " Force interrupt mode (1 INT#x; 2 MSI)");
+
 static int poll;
+module_param(poll, int, 0);
+MODULE_PARM_DESC(poll, " Use polling (for debug)");
+
+static int mrrs = -1;
+module_param(mrrs, int, 0);
+MODULE_PARM_DESC(mrrs, " Force Max Read Req Size (0..3) (for debug)");
+
 static int debug;
+module_param(debug, int, 0);
+MODULE_PARM_DESC(debug, " Default debug msglevel");
+
 static int load_count[3]; /* 0-common, 1-port0, 2-port1 */
-static int use_multi;
 
-module_param(disable_tpa, int, 0);
-module_param(use_inta, int, 0);
-module_param(poll, int, 0);
-module_param(debug, int, 0);
-MODULE_PARM_DESC(disable_tpa, "disable the TPA (LRO) feature");
-MODULE_PARM_DESC(use_inta, "use INT#A instead of MSI-X");
-MODULE_PARM_DESC(poll, "use polling (for debug)");
-MODULE_PARM_DESC(debug, "default debug msglevel");
-
-#ifdef BNX2X_MULTI
-module_param(use_multi, int, 0);
-MODULE_PARM_DESC(use_multi, "use per-CPU queues");
-#endif
 static struct workqueue_struct *bnx2x_wq;
 
 enum bnx2x_board_type {
@@ -468,7 +470,7 @@ static int bnx2x_mc_assert(struct bnx2x *bp)
 static void bnx2x_fw_dump(struct bnx2x *bp)
 {
        u32 mark, offset;
-       u32 data[9];
+       __be32 data[9];
        int word;
 
        mark = REG_RD(bp, MCP_REG_MCPR_SCRATCH + 0xf104);
@@ -502,50 +504,54 @@ static void bnx2x_panic_dump(struct bnx2x *bp)
 
        BNX2X_ERR("begin crash dump -----------------\n");
 
-       for_each_queue(bp, i) {
+       /* Indices */
+       /* Common */
+       BNX2X_ERR("def_c_idx(%u)  def_u_idx(%u)  def_x_idx(%u)"
+                 "  def_t_idx(%u)  def_att_idx(%u)  attn_state(%u)"
+                 "  spq_prod_idx(%u)\n",
+                 bp->def_c_idx, bp->def_u_idx, bp->def_x_idx, bp->def_t_idx,
+                 bp->def_att_idx, bp->attn_state, bp->spq_prod_idx);
+
+       /* Rx */
+       for_each_rx_queue(bp, i) {
                struct bnx2x_fastpath *fp = &bp->fp[i];
-               struct eth_tx_db_data *hw_prods = fp->hw_tx_prods;
 
-               BNX2X_ERR("queue[%d]: tx_pkt_prod(%x)  tx_pkt_cons(%x)"
-                         "  tx_bd_prod(%x)  tx_bd_cons(%x)  *tx_cons_sb(%x)\n",
-                         i, fp->tx_pkt_prod, fp->tx_pkt_cons, fp->tx_bd_prod,
-                         fp->tx_bd_cons, le16_to_cpu(*fp->tx_cons_sb));
-               BNX2X_ERR("          rx_bd_prod(%x)  rx_bd_cons(%x)"
+               BNX2X_ERR("queue[%d]: rx_bd_prod(%x)  rx_bd_cons(%x)"
                          "  *rx_bd_cons_sb(%x)  rx_comp_prod(%x)"
                          "  rx_comp_cons(%x)  *rx_cons_sb(%x)\n",
-                         fp->rx_bd_prod, fp->rx_bd_cons,
+                         i, fp->rx_bd_prod, fp->rx_bd_cons,
                          le16_to_cpu(*fp->rx_bd_cons_sb), fp->rx_comp_prod,
                          fp->rx_comp_cons, le16_to_cpu(*fp->rx_cons_sb));
                BNX2X_ERR("          rx_sge_prod(%x)  last_max_sge(%x)"
-                         "  fp_c_idx(%x)  *sb_c_idx(%x)  fp_u_idx(%x)"
-                         "  *sb_u_idx(%x)  bd data(%x,%x)\n",
-                         fp->rx_sge_prod, fp->last_max_sge, fp->fp_c_idx,
-                         fp->status_blk->c_status_block.status_block_index,
-                         fp->fp_u_idx,
-                         fp->status_blk->u_status_block.status_block_index,
-                         hw_prods->packets_prod, hw_prods->bds_prod);
-
-               start = TX_BD(le16_to_cpu(*fp->tx_cons_sb) - 10);
-               end = TX_BD(le16_to_cpu(*fp->tx_cons_sb) + 245);
-               for (j = start; j < end; j++) {
-                       struct sw_tx_bd *sw_bd = &fp->tx_buf_ring[j];
+                         "  fp_u_idx(%x) *sb_u_idx(%x)\n",
+                         fp->rx_sge_prod, fp->last_max_sge,
+                         le16_to_cpu(fp->fp_u_idx),
+                         fp->status_blk->u_status_block.status_block_index);
+       }
 
-                       BNX2X_ERR("packet[%x]=[%p,%x]\n", j,
-                                 sw_bd->skb, sw_bd->first_bd);
-               }
+       /* Tx */
+       for_each_tx_queue(bp, i) {
+               struct bnx2x_fastpath *fp = &bp->fp[i];
+               struct eth_tx_db_data *hw_prods = fp->hw_tx_prods;
 
-               start = TX_BD(fp->tx_bd_cons - 10);
-               end = TX_BD(fp->tx_bd_cons + 254);
-               for (j = start; j < end; j++) {
-                       u32 *tx_bd = (u32 *)&fp->tx_desc_ring[j];
+               BNX2X_ERR("queue[%d]: tx_pkt_prod(%x)  tx_pkt_cons(%x)"
+                         "  tx_bd_prod(%x)  tx_bd_cons(%x)  *tx_cons_sb(%x)\n",
+                         i, fp->tx_pkt_prod, fp->tx_pkt_cons, fp->tx_bd_prod,
+                         fp->tx_bd_cons, le16_to_cpu(*fp->tx_cons_sb));
+               BNX2X_ERR("          fp_c_idx(%x)  *sb_c_idx(%x)"
+                         "  bd data(%x,%x)\n", le16_to_cpu(fp->fp_c_idx),
+                         fp->status_blk->c_status_block.status_block_index,
+                         hw_prods->packets_prod, hw_prods->bds_prod);
+       }
 
-                       BNX2X_ERR("tx_bd[%x]=[%x:%x:%x:%x]\n",
-                                 j, tx_bd[0], tx_bd[1], tx_bd[2], tx_bd[3]);
-               }
+       /* Rings */
+       /* Rx */
+       for_each_rx_queue(bp, i) {
+               struct bnx2x_fastpath *fp = &bp->fp[i];
 
                start = RX_BD(le16_to_cpu(*fp->rx_cons_sb) - 10);
                end = RX_BD(le16_to_cpu(*fp->rx_cons_sb) + 503);
-               for (j = start; j < end; j++) {
+               for (j = start; j != end; j = RX_BD(j + 1)) {
                        u32 *rx_bd = (u32 *)&fp->rx_desc_ring[j];
                        struct sw_rx_bd *sw_bd = &fp->rx_buf_ring[j];
 
@@ -555,7 +561,7 @@ static void bnx2x_panic_dump(struct bnx2x *bp)
 
                start = RX_SGE(fp->rx_sge_prod);
                end = RX_SGE(fp->last_max_sge);
-               for (j = start; j < end; j++) {
+               for (j = start; j != end; j = RX_SGE(j + 1)) {
                        u32 *rx_sge = (u32 *)&fp->rx_sge_ring[j];
                        struct sw_rx_page *sw_page = &fp->rx_page_ring[j];
 
@@ -565,7 +571,7 @@ static void bnx2x_panic_dump(struct bnx2x *bp)
 
                start = RCQ_BD(fp->rx_comp_cons - 10);
                end = RCQ_BD(fp->rx_comp_cons + 503);
-               for (j = start; j < end; j++) {
+               for (j = start; j != end; j = RCQ_BD(j + 1)) {
                        u32 *cqe = (u32 *)&fp->rx_comp_ring[j];
 
                        BNX2X_ERR("cqe[%x]=[%x:%x:%x:%x]\n",
@@ -573,11 +579,28 @@ static void bnx2x_panic_dump(struct bnx2x *bp)
                }
        }
 
-       BNX2X_ERR("def_c_idx(%u)  def_u_idx(%u)  def_x_idx(%u)"
-                 "  def_t_idx(%u)  def_att_idx(%u)  attn_state(%u)"
-                 "  spq_prod_idx(%u)\n",
-                 bp->def_c_idx, bp->def_u_idx, bp->def_x_idx, bp->def_t_idx,
-                 bp->def_att_idx, bp->attn_state, bp->spq_prod_idx);
+       /* Tx */
+       for_each_tx_queue(bp, i) {
+               struct bnx2x_fastpath *fp = &bp->fp[i];
+
+               start = TX_BD(le16_to_cpu(*fp->tx_cons_sb) - 10);
+               end = TX_BD(le16_to_cpu(*fp->tx_cons_sb) + 245);
+               for (j = start; j != end; j = TX_BD(j + 1)) {
+                       struct sw_tx_bd *sw_bd = &fp->tx_buf_ring[j];
+
+                       BNX2X_ERR("packet[%x]=[%p,%x]\n", j,
+                                 sw_bd->skb, sw_bd->first_bd);
+               }
+
+               start = TX_BD(fp->tx_bd_cons - 10);
+               end = TX_BD(fp->tx_bd_cons + 254);
+               for (j = start; j != end; j = TX_BD(j + 1)) {
+                       u32 *tx_bd = (u32 *)&fp->tx_desc_ring[j];
+
+                       BNX2X_ERR("tx_bd[%x]=[%x:%x:%x:%x]\n",
+                                 j, tx_bd[0], tx_bd[1], tx_bd[2], tx_bd[3]);
+               }
+       }
 
        bnx2x_fw_dump(bp);
        bnx2x_mc_assert(bp);
@@ -590,37 +613,44 @@ static void bnx2x_int_enable(struct bnx2x *bp)
        u32 addr = port ? HC_REG_CONFIG_1 : HC_REG_CONFIG_0;
        u32 val = REG_RD(bp, addr);
        int msix = (bp->flags & USING_MSIX_FLAG) ? 1 : 0;
+       int msi = (bp->flags & USING_MSI_FLAG) ? 1 : 0;
 
        if (msix) {
-               val &= ~HC_CONFIG_0_REG_SINGLE_ISR_EN_0;
+               val &= ~(HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
+                        HC_CONFIG_0_REG_INT_LINE_EN_0);
                val |= (HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
                        HC_CONFIG_0_REG_ATTN_BIT_EN_0);
+       } else if (msi) {
+               val &= ~HC_CONFIG_0_REG_INT_LINE_EN_0;
+               val |= (HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
+                       HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
+                       HC_CONFIG_0_REG_ATTN_BIT_EN_0);
        } else {
                val |= (HC_CONFIG_0_REG_SINGLE_ISR_EN_0 |
                        HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0 |
                        HC_CONFIG_0_REG_INT_LINE_EN_0 |
                        HC_CONFIG_0_REG_ATTN_BIT_EN_0);
 
-               DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)  MSI-X %d\n",
-                  val, port, addr, msix);
+               DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)\n",
+                  val, port, addr);
 
                REG_WR(bp, addr, val);
 
                val &= ~HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0;
        }
 
-       DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)  MSI-X %d\n",
-          val, port, addr, msix);
+       DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)  mode %s\n",
+          val, port, addr, (msix ? "MSI-X" : (msi ? "MSI" : "INTx")));
 
        REG_WR(bp, addr, val);
 
        if (CHIP_IS_E1H(bp)) {
                /* init leading/trailing edge */
                if (IS_E1HMF(bp)) {
-                       val = (0xfe0f | (1 << (BP_E1HVN(bp) + 4)));
+                       val = (0xee0f | (1 << (BP_E1HVN(bp) + 4)));
                        if (bp->port.pmf)
-                               /* enable nig attention */
-                               val |= 0x0100;
+                               /* enable nig and gpio3 attention */
+                               val |= 0x1100;
                } else
                        val = 0xffff;
 
@@ -643,15 +673,19 @@ static void bnx2x_int_disable(struct bnx2x *bp)
        DP(NETIF_MSG_INTR, "write %x to HC %d (addr 0x%x)\n",
           val, port, addr);
 
+       /* flush all outstanding writes */
+       mmiowb();
+
        REG_WR(bp, addr, val);
        if (REG_RD(bp, addr) != val)
                BNX2X_ERR("BUG! proper val not read from IGU!\n");
+
 }
 
 static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
 {
        int msix = (bp->flags & USING_MSIX_FLAG) ? 1 : 0;
-       int i;
+       int i, offset;
 
        /* disable interrupt handling */
        atomic_inc(&bp->intr_sem);
@@ -661,11 +695,10 @@ static void bnx2x_int_disable_sync(struct bnx2x *bp, int disable_hw)
 
        /* make sure all ISRs are done */
        if (msix) {
+               synchronize_irq(bp->msix_table[0].vector);
+               offset = 1;
                for_each_queue(bp, i)
-                       synchronize_irq(bp->msix_table[i].vector);
-
-               /* one more for the Slow Path IRQ */
-               synchronize_irq(bp->msix_table[i].vector);
+                       synchronize_irq(bp->msix_table[i + offset].vector);
        } else
                synchronize_irq(bp->pdev->irq);
 
@@ -748,7 +781,6 @@ static inline int bnx2x_has_tx_work_unload(struct bnx2x_fastpath *fp)
        /* Tell compiler that consumer and producer can change */
        barrier();
        return (fp->tx_pkt_prod != fp->tx_pkt_cons);
-
 }
 
 /* free skb in the packet ring at pos idx
@@ -845,6 +877,7 @@ static inline u16 bnx2x_tx_avail(struct bnx2x_fastpath *fp)
 static void bnx2x_tx_int(struct bnx2x_fastpath *fp, int work)
 {
        struct bnx2x *bp = fp->bp;
+       struct netdev_queue *txq;
        u16 hw_cons, sw_cons, bd_cons = fp->tx_bd_cons;
        int done = 0;
 
@@ -853,6 +886,7 @@ static void bnx2x_tx_int(struct bnx2x_fastpath *fp, int work)
                return;
 #endif
 
+       txq = netdev_get_tx_queue(bp->dev, fp->index);
        hw_cons = le16_to_cpu(*fp->tx_cons_sb);
        sw_cons = fp->tx_pkt_cons;
 
@@ -882,24 +916,24 @@ static void bnx2x_tx_int(struct bnx2x_fastpath *fp, int work)
        fp->tx_pkt_cons = sw_cons;
        fp->tx_bd_cons = bd_cons;
 
-       /* Need to make the tx_cons update visible to start_xmit()
-        * before checking for netif_queue_stopped().  Without the
+       /* Need to make the tx_bd_cons update visible to start_xmit()
+        * before checking for netif_tx_queue_stopped().  Without the
         * memory barrier, there is a small possibility that start_xmit()
         * will miss it and cause the queue to be stopped forever.
         */
        smp_mb();
 
        /* TBD need a thresh? */
-       if (unlikely(netif_queue_stopped(bp->dev))) {
+       if (unlikely(netif_tx_queue_stopped(txq))) {
 
-               netif_tx_lock(bp->dev);
+               __netif_tx_lock(txq, smp_processor_id());
 
-               if (netif_queue_stopped(bp->dev) &&
+               if ((netif_tx_queue_stopped(txq)) &&
                    (bp->state == BNX2X_STATE_OPEN) &&
                    (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3))
-                       netif_wake_queue(bp->dev);
+                       netif_tx_wake_queue(txq);
 
-               netif_tx_unlock(bp->dev);
+               __netif_tx_unlock(txq);
        }
 }
 
@@ -913,12 +947,12 @@ static void bnx2x_sp_event(struct bnx2x_fastpath *fp,
 
        DP(BNX2X_MSG_SP,
           "fp %d  cid %d  got ramrod #%d  state is %x  type is %d\n",
-          FP_IDX(fp), cid, command, bp->state,
+          fp->index, cid, command, bp->state,
           rr_cqe->ramrod_cqe.ramrod_type);
 
        bp->spq_left++;
 
-       if (FP_IDX(fp)) {
+       if (fp->index) {
                switch (command | fp->state) {
                case (RAMROD_CMD_ID_ETH_CLIENT_SETUP |
                                                BNX2X_FP_STATE_OPENING):
@@ -1078,8 +1112,7 @@ static void bnx2x_reuse_rx_skb(struct bnx2x_fastpath *fp,
 
        pci_dma_sync_single_for_device(bp->pdev,
                                       pci_unmap_addr(cons_rx_buf, mapping),
-                                      bp->rx_offset + RX_COPY_THRESH,
-                                      PCI_DMA_FROMDEVICE);
+                                      RX_COPY_THRESH, PCI_DMA_FROMDEVICE);
 
        prod_rx_buf->skb = cons_rx_buf->skb;
        pci_unmap_addr_set(prod_rx_buf, mapping,
@@ -1260,7 +1293,7 @@ static int bnx2x_fill_frag_skb(struct bnx2x *bp, struct bnx2x_fastpath *fp,
                   where we are and drop the whole packet */
                err = bnx2x_alloc_rx_sge(bp, fp, sge_idx);
                if (unlikely(err)) {
-                       bp->eth_stats.rx_skb_alloc_failed++;
+                       fp->eth_q_stats.rx_skb_alloc_failed++;
                        return err;
                }
 
@@ -1365,7 +1398,7 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
                /* else drop the packet and keep the buffer in the bin */
                DP(NETIF_MSG_RX_STATUS,
                   "Failed to allocate new skb - dropping packet!\n");
-               bp->eth_stats.rx_skb_alloc_failed++;
+               fp->eth_q_stats.rx_skb_alloc_failed++;
        }
 
        fp->tpa_state[queue] = BNX2X_TPA_STOP;
@@ -1376,7 +1409,7 @@ static inline void bnx2x_update_rx_prod(struct bnx2x *bp,
                                        u16 bd_prod, u16 rx_comp_prod,
                                        u16 rx_sge_prod)
 {
-       struct tstorm_eth_rx_producers rx_prods = {0};
+       struct ustorm_eth_rx_producers rx_prods = {0};
        int i;
 
        /* Update producers */
@@ -1394,16 +1427,16 @@ static inline void bnx2x_update_rx_prod(struct bnx2x *bp,
         */
        wmb();
 
-       for (i = 0; i < sizeof(struct tstorm_eth_rx_producers)/4; i++)
-               REG_WR(bp, BAR_TSTRORM_INTMEM +
-                      TSTORM_RX_PRODS_OFFSET(BP_PORT(bp), FP_CL_ID(fp)) + i*4,
+       for (i = 0; i < sizeof(struct ustorm_eth_rx_producers)/4; i++)
+               REG_WR(bp, BAR_USTRORM_INTMEM +
+                      USTORM_RX_PRODS_OFFSET(BP_PORT(bp), fp->cl_id) + i*4,
                       ((u32 *)&rx_prods)[i]);
 
        mmiowb(); /* keep prod updates ordered */
 
        DP(NETIF_MSG_RX_STATUS,
-          "Wrote: bd_prod %u  cqe_prod %u  sge_prod %u\n",
-          bd_prod, rx_comp_prod, rx_sge_prod);
+          "queue[%d]:  wrote  bd_prod %u  cqe_prod %u  sge_prod %u\n",
+          fp->index, bd_prod, rx_comp_prod, rx_sge_prod);
 }
 
 static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
@@ -1437,7 +1470,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
 
        DP(NETIF_MSG_RX_STATUS,
           "queue[%d]:  hw_comp_cons %u  sw_comp_cons %u\n",
-          FP_IDX(fp), hw_comp_cons, sw_comp_cons);
+          fp->index, hw_comp_cons, sw_comp_cons);
 
        while (sw_comp_cons != hw_comp_cons) {
                struct sw_rx_bd *rx_buf = NULL;
@@ -1527,7 +1560,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
                                DP(NETIF_MSG_RX_ERR,
                                   "ERROR  flags %x  rx packet %u\n",
                                   cqe_fp_flags, sw_comp_cons);
-                               bp->eth_stats.rx_err_discard_pkt++;
+                               fp->eth_q_stats.rx_err_discard_pkt++;
                                goto reuse_rx;
                        }
 
@@ -1544,7 +1577,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
                                        DP(NETIF_MSG_RX_ERR,
                                           "ERROR  packet dropped "
                                           "because of alloc failure\n");
-                                       bp->eth_stats.rx_skb_alloc_failed++;
+                                       fp->eth_q_stats.rx_skb_alloc_failed++;
                                        goto reuse_rx;
                                }
 
@@ -1570,7 +1603,7 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
                                DP(NETIF_MSG_RX_ERR,
                                   "ERROR  packet dropped because "
                                   "of alloc failure\n");
-                               bp->eth_stats.rx_skb_alloc_failed++;
+                               fp->eth_q_stats.rx_skb_alloc_failed++;
 reuse_rx:
                                bnx2x_reuse_rx_skb(fp, skb, bd_cons, bd_prod);
                                goto next_rx;
@@ -1583,10 +1616,11 @@ reuse_rx:
                                if (likely(BNX2X_RX_CSUM_OK(cqe)))
                                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                                else
-                                       bp->eth_stats.hw_csum_err++;
+                                       fp->eth_q_stats.hw_csum_err++;
                        }
                }
 
+               skb_record_rx_queue(skb, fp->index);
 #ifdef BCM_VLAN
                if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
                    (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
@@ -1632,7 +1666,7 @@ static irqreturn_t bnx2x_msix_fp_int(int irq, void *fp_cookie)
 {
        struct bnx2x_fastpath *fp = fp_cookie;
        struct bnx2x *bp = fp->bp;
-       int index = FP_IDX(fp);
+       int index = fp->index;
 
        /* Return here if interrupt is disabled */
        if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
@@ -1641,8 +1675,8 @@ static irqreturn_t bnx2x_msix_fp_int(int irq, void *fp_cookie)
        }
 
        DP(BNX2X_MSG_FP, "got an MSI-X interrupt on IDX:SB [%d:%d]\n",
-          index, FP_SB_ID(fp));
-       bnx2x_ack_sb(bp, FP_SB_ID(fp), USTORM_ID, 0, IGU_INT_DISABLE, 0);
+          index, fp->sb_id);
+       bnx2x_ack_sb(bp, fp->sb_id, USTORM_ID, 0, IGU_INT_DISABLE, 0);
 
 #ifdef BNX2X_STOP_ON_ERROR
        if (unlikely(bp->panic))
@@ -1654,15 +1688,14 @@ static irqreturn_t bnx2x_msix_fp_int(int irq, void *fp_cookie)
        prefetch(&fp->status_blk->c_status_block.status_block_index);
        prefetch(&fp->status_blk->u_status_block.status_block_index);
 
-       netif_rx_schedule(&bnx2x_fp(bp, index, napi));
+       napi_schedule(&bnx2x_fp(bp, index, napi));
 
        return IRQ_HANDLED;
 }
 
 static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance)
 {
-       struct net_device *dev = dev_instance;
-       struct bnx2x *bp = netdev_priv(dev);
+       struct bnx2x *bp = netdev_priv(dev_instance);
        u16 status = bnx2x_ack_int(bp);
        u16 mask;
 
@@ -1671,7 +1704,7 @@ static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance)
                DP(NETIF_MSG_INTR, "not our interrupt!\n");
                return IRQ_NONE;
        }
-       DP(NETIF_MSG_INTR, "got an interrupt  status %u\n", status);
+       DP(NETIF_MSG_INTR, "got an interrupt  status 0x%x\n", status);
 
        /* Return here if interrupt is disabled */
        if (unlikely(atomic_read(&bp->intr_sem) != 0)) {
@@ -1693,7 +1726,7 @@ static irqreturn_t bnx2x_interrupt(int irq, void *dev_instance)
                prefetch(&fp->status_blk->c_status_block.status_block_index);
                prefetch(&fp->status_blk->u_status_block.status_block_index);
 
-               netif_rx_schedule(&bnx2x_fp(bp, 0, napi));
+               napi_schedule(&bnx2x_fp(bp, 0, napi));
 
                status &= ~mask;
        }
@@ -1806,26 +1839,50 @@ static int bnx2x_release_hw_lock(struct bnx2x *bp, u32 resource)
 /* HW Lock for shared dual port PHYs */
 static void bnx2x_acquire_phy_lock(struct bnx2x *bp)
 {
-       u32 ext_phy_type = XGXS_EXT_PHY_TYPE(bp->link_params.ext_phy_config);
-
        mutex_lock(&bp->port.phy_mutex);
 
-       if ((ext_phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072) ||
-           (ext_phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073))
-               bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_8072_MDIO);
+       if (bp->port.need_hw_lock)
+               bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_MDIO);
 }
 
 static void bnx2x_release_phy_lock(struct bnx2x *bp)
 {
-       u32 ext_phy_type = XGXS_EXT_PHY_TYPE(bp->link_params.ext_phy_config);
-
-       if ((ext_phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072) ||
-           (ext_phy_type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073))
-               bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_8072_MDIO);
+       if (bp->port.need_hw_lock)
+               bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_MDIO);
 
        mutex_unlock(&bp->port.phy_mutex);
 }
 
+int bnx2x_get_gpio(struct bnx2x *bp, int gpio_num, u8 port)
+{
+       /* The GPIO should be swapped if swap register is set and active */
+       int gpio_port = (REG_RD(bp, NIG_REG_PORT_SWAP) &&
+                        REG_RD(bp, NIG_REG_STRAP_OVERRIDE)) ^ port;
+       int gpio_shift = gpio_num +
+                       (gpio_port ? MISC_REGISTERS_GPIO_PORT_SHIFT : 0);
+       u32 gpio_mask = (1 << gpio_shift);
+       u32 gpio_reg;
+       int value;
+
+       if (gpio_num > MISC_REGISTERS_GPIO_3) {
+               BNX2X_ERR("Invalid GPIO %d\n", gpio_num);
+               return -EINVAL;
+       }
+
+       /* read GPIO value */
+       gpio_reg = REG_RD(bp, MISC_REG_GPIO);
+
+       /* get the requested pin value */
+       if ((gpio_reg & gpio_mask) == gpio_mask)
+               value = 1;
+       else
+               value = 0;
+
+       DP(NETIF_MSG_LINK, "pin %d  value 0x%x\n", gpio_num, value);
+
+       return value;
+}
+
 int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port)
 {
        /* The GPIO should be swapped if swap register is set and active */
@@ -1879,6 +1936,52 @@ int bnx2x_set_gpio(struct bnx2x *bp, int gpio_num, u32 mode, u8 port)
        return 0;
 }
 
+int bnx2x_set_gpio_int(struct bnx2x *bp, int gpio_num, u32 mode, u8 port)
+{
+       /* The GPIO should be swapped if swap register is set and active */
+       int gpio_port = (REG_RD(bp, NIG_REG_PORT_SWAP) &&
+                        REG_RD(bp, NIG_REG_STRAP_OVERRIDE)) ^ port;
+       int gpio_shift = gpio_num +
+                       (gpio_port ? MISC_REGISTERS_GPIO_PORT_SHIFT : 0);
+       u32 gpio_mask = (1 << gpio_shift);
+       u32 gpio_reg;
+
+       if (gpio_num > MISC_REGISTERS_GPIO_3) {
+               BNX2X_ERR("Invalid GPIO %d\n", gpio_num);
+               return -EINVAL;
+       }
+
+       bnx2x_acquire_hw_lock(bp, HW_LOCK_RESOURCE_GPIO);
+       /* read GPIO int */
+       gpio_reg = REG_RD(bp, MISC_REG_GPIO_INT);
+
+       switch (mode) {
+       case MISC_REGISTERS_GPIO_INT_OUTPUT_CLR:
+               DP(NETIF_MSG_LINK, "Clear GPIO INT %d (shift %d) -> "
+                                  "output low\n", gpio_num, gpio_shift);
+               /* clear SET and set CLR */
+               gpio_reg &= ~(gpio_mask << MISC_REGISTERS_GPIO_INT_SET_POS);
+               gpio_reg |=  (gpio_mask << MISC_REGISTERS_GPIO_INT_CLR_POS);
+               break;
+
+       case MISC_REGISTERS_GPIO_INT_OUTPUT_SET:
+               DP(NETIF_MSG_LINK, "Set GPIO INT %d (shift %d) -> "
+                                  "output high\n", gpio_num, gpio_shift);
+               /* clear CLR and set SET */
+               gpio_reg &= ~(gpio_mask << MISC_REGISTERS_GPIO_INT_CLR_POS);
+               gpio_reg |=  (gpio_mask << MISC_REGISTERS_GPIO_INT_SET_POS);
+               break;
+
+       default:
+               break;
+       }
+
+       REG_WR(bp, MISC_REG_GPIO_INT, gpio_reg);
+       bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_GPIO);
+
+       return 0;
+}
+
 static int bnx2x_set_spio(struct bnx2x *bp, int spio_num, u32 mode)
 {
        u32 spio_mask = (1 << spio_num);
@@ -1933,13 +2036,16 @@ static void bnx2x_calc_fc_adv(struct bnx2x *bp)
                bp->port.advertising &= ~(ADVERTISED_Asym_Pause |
                                          ADVERTISED_Pause);
                break;
+
        case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH:
                bp->port.advertising |= (ADVERTISED_Asym_Pause |
                                         ADVERTISED_Pause);
                break;
+
        case MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC:
                bp->port.advertising |= ADVERTISED_Asym_Pause;
                break;
+
        default:
                bp->port.advertising &= ~(ADVERTISED_Asym_Pause |
                                          ADVERTISED_Pause);
@@ -1964,7 +2070,8 @@ static void bnx2x_link_report(struct bnx2x *bp)
                if (bp->link_vars.flow_ctrl != BNX2X_FLOW_CTRL_NONE) {
                        if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_RX) {
                                printk(", receive ");
-                               if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_TX)
+                               if (bp->link_vars.flow_ctrl &
+                                   BNX2X_FLOW_CTRL_TX)
                                        printk("& transmit ");
                        } else {
                                printk(", transmit ");
@@ -1979,7 +2086,7 @@ static void bnx2x_link_report(struct bnx2x *bp)
        }
 }
 
-static u8 bnx2x_initial_phy_init(struct bnx2x *bp)
+static u8 bnx2x_initial_phy_init(struct bnx2x *bp, int load_mode)
 {
        if (!BP_NOMCP(bp)) {
                u8 rc;
@@ -1995,18 +2102,24 @@ static u8 bnx2x_initial_phy_init(struct bnx2x *bp)
                        bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_BOTH;
 
                bnx2x_acquire_phy_lock(bp);
+
+               if (load_mode == LOAD_DIAG)
+                       bp->link_params.loopback_mode = LOOPBACK_XGXS_10;
+
                rc = bnx2x_phy_init(&bp->link_params, &bp->link_vars);
+
                bnx2x_release_phy_lock(bp);
 
                bnx2x_calc_fc_adv(bp);
 
-               if (bp->link_vars.link_up)
+               if (CHIP_REV_IS_SLOW(bp) && bp->link_vars.link_up) {
+                       bnx2x_stats_handle(bp, STATS_EVENT_LINK_UP);
                        bnx2x_link_report(bp);
-
+               }
 
                return rc;
        }
-       BNX2X_ERR("Bootcode is missing -not initializing link\n");
+       BNX2X_ERR("Bootcode is missing - can not initialize link\n");
        return -EINVAL;
 }
 
@@ -2019,17 +2132,17 @@ static void bnx2x_link_set(struct bnx2x *bp)
 
                bnx2x_calc_fc_adv(bp);
        } else
-               BNX2X_ERR("Bootcode is missing -not setting link\n");
+               BNX2X_ERR("Bootcode is missing - can not set link\n");
 }
 
 static void bnx2x__link_reset(struct bnx2x *bp)
 {
        if (!BP_NOMCP(bp)) {
                bnx2x_acquire_phy_lock(bp);
-               bnx2x_link_reset(&bp->link_params, &bp->link_vars);
+               bnx2x_link_reset(&bp->link_params, &bp->link_vars, 1);
                bnx2x_release_phy_lock(bp);
        } else
-               BNX2X_ERR("Bootcode is missing -not resetting link\n");
+               BNX2X_ERR("Bootcode is missing - can not reset link\n");
 }
 
 static u8 bnx2x_link_test(struct bnx2x *bp)
@@ -2043,119 +2156,42 @@ static u8 bnx2x_link_test(struct bnx2x *bp)
        return rc;
 }
 
-/* Calculates the sum of vn_min_rates.
-   It's needed for further normalizing of the min_rates.
-
-   Returns:
-     sum of vn_min_rates
-       or
-     0 - if all the min_rates are 0.
-     In the later case fairness algorithm should be deactivated.
-     If not all min_rates are zero then those that are zeroes will
-     be set to 1.
- */
-static u32 bnx2x_calc_vn_wsum(struct bnx2x *bp)
-{
-       int i, port = BP_PORT(bp);
-       u32 wsum = 0;
-       int all_zero = 1;
-
-       for (i = 0; i < E1HVN_MAX; i++) {
-               u32 vn_cfg =
-                       SHMEM_RD(bp, mf_cfg.func_mf_config[2*i + port].config);
-               u32 vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >>
-                                    FUNC_MF_CFG_MIN_BW_SHIFT) * 100;
-               if (!(vn_cfg & FUNC_MF_CFG_FUNC_HIDE)) {
-                       /* If min rate is zero - set it to 1 */
-                       if (!vn_min_rate)
-                               vn_min_rate = DEF_MIN_RATE;
-                       else
-                               all_zero = 0;
-
-                       wsum += vn_min_rate;
-               }
-       }
-
-       /* ... only if all min rates are zeros - disable FAIRNESS */
-       if (all_zero)
-               return 0;
-
-       return wsum;
-}
-
-static void bnx2x_init_port_minmax(struct bnx2x *bp,
-                                  int en_fness,
-                                  u16 port_rate,
-                                  struct cmng_struct_per_port *m_cmng_port)
+static void bnx2x_init_port_minmax(struct bnx2x *bp)
 {
-       u32 r_param = port_rate / 8;
-       int port = BP_PORT(bp);
-       int i;
-
-       memset(m_cmng_port, 0, sizeof(struct cmng_struct_per_port));
-
-       /* Enable minmax only if we are in e1hmf mode */
-       if (IS_E1HMF(bp)) {
-               u32 fair_periodic_timeout_usec;
-               u32 t_fair;
+       u32 r_param = bp->link_vars.line_speed / 8;
+       u32 fair_periodic_timeout_usec;
+       u32 t_fair;
 
-               /* Enable rate shaping and fairness */
-               m_cmng_port->flags.cmng_vn_enable = 1;
-               m_cmng_port->flags.fairness_enable = en_fness ? 1 : 0;
-               m_cmng_port->flags.rate_shaping_enable = 1;
-
-               if (!en_fness)
-                       DP(NETIF_MSG_IFUP, "All MIN values are zeroes"
-                          "  fairness will be disabled\n");
+       memset(&(bp->cmng.rs_vars), 0,
+              sizeof(struct rate_shaping_vars_per_port));
+       memset(&(bp->cmng.fair_vars), 0, sizeof(struct fairness_vars_per_port));
 
-               /* 100 usec in SDM ticks = 25 since each tick is 4 usec */
-               m_cmng_port->rs_vars.rs_periodic_timeout =
-                                               RS_PERIODIC_TIMEOUT_USEC / 4;
+       /* 100 usec in SDM ticks = 25 since each tick is 4 usec */
+       bp->cmng.rs_vars.rs_periodic_timeout = RS_PERIODIC_TIMEOUT_USEC / 4;
 
-               /* this is the threshold below which no timer arming will occur
-                  1.25 coefficient is for the threshold to be a little bigger
-                  than the real time, to compensate for timer in-accuracy */
-               m_cmng_port->rs_vars.rs_threshold =
+       /* this is the threshold below which no timer arming will occur
+          1.25 coefficient is for the threshold to be a little bigger
+          than the real time, to compensate for timer in-accuracy */
+       bp->cmng.rs_vars.rs_threshold =
                                (RS_PERIODIC_TIMEOUT_USEC * r_param * 5) / 4;
 
-               /* resolution of fairness timer */
-               fair_periodic_timeout_usec = QM_ARB_BYTES / r_param;
-               /* for 10G it is 1000usec. for 1G it is 10000usec. */
-               t_fair = T_FAIR_COEF / port_rate;
-
-               /* this is the threshold below which we won't arm
-                  the timer anymore */
-               m_cmng_port->fair_vars.fair_threshold = QM_ARB_BYTES;
-
-               /* we multiply by 1e3/8 to get bytes/msec.
-                  We don't want the credits to pass a credit
-                  of the T_FAIR*FAIR_MEM (algorithm resolution) */
-               m_cmng_port->fair_vars.upper_bound =
-                                               r_param * t_fair * FAIR_MEM;
-               /* since each tick is 4 usec */
-               m_cmng_port->fair_vars.fairness_timeout =
-                                               fair_periodic_timeout_usec / 4;
-
-       } else {
-               /* Disable rate shaping and fairness */
-               m_cmng_port->flags.cmng_vn_enable = 0;
-               m_cmng_port->flags.fairness_enable = 0;
-               m_cmng_port->flags.rate_shaping_enable = 0;
+       /* resolution of fairness timer */
+       fair_periodic_timeout_usec = QM_ARB_BYTES / r_param;
+       /* for 10G it is 1000usec. for 1G it is 10000usec. */
+       t_fair = T_FAIR_COEF / bp->link_vars.line_speed;
 
-               DP(NETIF_MSG_IFUP,
-                  "Single function mode  minmax will be disabled\n");
-       }
+       /* this is the threshold below which we won't arm the timer anymore */
+       bp->cmng.fair_vars.fair_threshold = QM_ARB_BYTES;
 
-       /* Store it to internal memory */
-       for (i = 0; i < sizeof(struct cmng_struct_per_port) / 4; i++)
-               REG_WR(bp, BAR_XSTRORM_INTMEM +
-                      XSTORM_CMNG_PER_PORT_VARS_OFFSET(port) + i * 4,
-                      ((u32 *)(m_cmng_port))[i]);
+       /* we multiply by 1e3/8 to get bytes/msec.
+          We don't want the credits to pass a credit
+          of the t_fair*FAIR_MEM (algorithm resolution) */
+       bp->cmng.fair_vars.upper_bound = r_param * t_fair * FAIR_MEM;
+       /* since each tick is 4 usec */
+       bp->cmng.fair_vars.fairness_timeout = fair_periodic_timeout_usec / 4;
 }
 
-static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func,
-                                  u32 wsum, u16 port_rate,
-                                struct cmng_struct_per_port *m_cmng_port)
+static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func)
 {
        struct rate_shaping_vars_per_vn m_rs_vn;
        struct fairness_vars_per_vn m_fair_vn;
@@ -2171,17 +2207,18 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func,
        } else {
                vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >>
                                FUNC_MF_CFG_MIN_BW_SHIFT) * 100;
-               /* If FAIRNESS is enabled (not all min rates are zeroes) and
+               /* If fairness is enabled (not all min rates are zeroes) and
                   if current min rate is zero - set it to 1.
                   This is a requirement of the algorithm. */
-               if ((vn_min_rate == 0) && wsum)
+               if (bp->vn_weight_sum && (vn_min_rate == 0))
                        vn_min_rate = DEF_MIN_RATE;
                vn_max_rate = ((vn_cfg & FUNC_MF_CFG_MAX_BW_MASK) >>
                                FUNC_MF_CFG_MAX_BW_SHIFT) * 100;
        }
 
-       DP(NETIF_MSG_IFUP, "func %d: vn_min_rate=%d  vn_max_rate=%d  "
-          "wsum=%d\n", func, vn_min_rate, vn_max_rate, wsum);
+       DP(NETIF_MSG_IFUP,
+          "func %d: vn_min_rate=%d  vn_max_rate=%d  vn_weight_sum=%d\n",
+          func, vn_min_rate, vn_max_rate, bp->vn_weight_sum);
 
        memset(&m_rs_vn, 0, sizeof(struct rate_shaping_vars_per_vn));
        memset(&m_fair_vn, 0, sizeof(struct fairness_vars_per_vn));
@@ -2193,55 +2230,20 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func,
        m_rs_vn.vn_counter.quota =
                                (vn_max_rate * RS_PERIODIC_TIMEOUT_USEC) / 8;
 
-#ifdef BNX2X_PER_PROT_QOS
-       /* per protocol counter */
-       for (protocol = 0; protocol < NUM_OF_PROTOCOLS; protocol++) {
-               /* maximal Mbps for this protocol */
-               m_rs_vn.protocol_counters[protocol].rate =
-                                               protocol_max_rate[protocol];
-               /* the quota in each timer period -
-                  number of bytes transmitted in this period */
-               m_rs_vn.protocol_counters[protocol].quota =
-                       (u32)(rs_periodic_timeout_usec *
-                         ((double)m_rs_vn.
-                                  protocol_counters[protocol].rate/8));
-       }
-#endif
-
-       if (wsum) {
+       if (bp->vn_weight_sum) {
                /* credit for each period of the fairness algorithm:
                   number of bytes in T_FAIR (the vn share the port rate).
-                  wsum should not be larger than 10000, thus
-                  T_FAIR_COEF / (8 * wsum) will always be grater than zero */
+                  vn_weight_sum should not be larger than 10000, thus
+                  T_FAIR_COEF / (8 * vn_weight_sum) will always be greater
+                  than zero */
                m_fair_vn.vn_credit_delta =
-                       max((u64)(vn_min_rate * (T_FAIR_COEF / (8 * wsum))),
-                           (u64)(m_cmng_port->fair_vars.fair_threshold * 2));
+                       max((u32)(vn_min_rate * (T_FAIR_COEF /
+                                                (8 * bp->vn_weight_sum))),
+                           (u32)(bp->cmng.fair_vars.fair_threshold * 2));
                DP(NETIF_MSG_IFUP, "m_fair_vn.vn_credit_delta=%d\n",
                   m_fair_vn.vn_credit_delta);
        }
 
-#ifdef BNX2X_PER_PROT_QOS
-       do {
-               u32 protocolWeightSum = 0;
-
-               for (protocol = 0; protocol < NUM_OF_PROTOCOLS; protocol++)
-                       protocolWeightSum +=
-                                       drvInit.protocol_min_rate[protocol];
-               /* per protocol counter -
-                  NOT NEEDED IF NO PER-PROTOCOL CONGESTION MANAGEMENT */
-               if (protocolWeightSum > 0) {
-                       for (protocol = 0;
-                            protocol < NUM_OF_PROTOCOLS; protocol++)
-                               /* credit for each period of the
-                                  fairness algorithm - number of bytes in
-                                  T_FAIR (the protocol share the vn rate) */
-                               m_fair_vn.protocol_credit_delta[protocol] =
-                                       (u32)((vn_min_rate / 8) * t_fair *
-                                       protocol_min_rate / protocolWeightSum);
-               }
-       } while (0);
-#endif
-
        /* Store it to internal memory */
        for (i = 0; i < sizeof(struct rate_shaping_vars_per_vn)/4; i++)
                REG_WR(bp, BAR_XSTRORM_INTMEM +
@@ -2254,11 +2256,10 @@ static void bnx2x_init_vn_minmax(struct bnx2x *bp, int func,
                       ((u32 *)(&m_fair_vn))[i]);
 }
 
+
 /* This function is called upon link interrupt */
 static void bnx2x_link_attn(struct bnx2x *bp)
 {
-       int vn;
-
        /* Make sure that we are synced with the current statistics */
        bnx2x_stats_handle(bp, STATS_EVENT_STOP);
 
@@ -2266,6 +2267,19 @@ static void bnx2x_link_attn(struct bnx2x *bp)
 
        if (bp->link_vars.link_up) {
 
+               /* dropless flow control */
+               if (CHIP_IS_E1H(bp)) {
+                       int port = BP_PORT(bp);
+                       u32 pause_enabled = 0;
+
+                       if (bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_TX)
+                               pause_enabled = 1;
+
+                       REG_WR(bp, BAR_USTRORM_INTMEM +
+                              USTORM_PAUSE_ENABLED_OFFSET(port),
+                              pause_enabled);
+               }
+
                if (bp->link_vars.mac_type == MAC_TYPE_BMAC) {
                        struct host_port_stats *pstats;
 
@@ -2283,36 +2297,38 @@ static void bnx2x_link_attn(struct bnx2x *bp)
        bnx2x_link_report(bp);
 
        if (IS_E1HMF(bp)) {
+               int port = BP_PORT(bp);
                int func;
+               int vn;
 
                for (vn = VN_0; vn < E1HVN_MAX; vn++) {
                        if (vn == BP_E1HVN(bp))
                                continue;
 
-                       func = ((vn << 1) | BP_PORT(bp));
+                       func = ((vn << 1) | port);
 
                        /* Set the attention towards other drivers
                           on the same port */
                        REG_WR(bp, MISC_REG_AEU_GENERAL_ATTN_0 +
                               (LINK_SYNC_ATTENTION_BIT_FUNC_0 + func)*4, 1);
                }
-       }
 
-       if (CHIP_IS_E1H(bp) && (bp->link_vars.line_speed > 0)) {
-               struct cmng_struct_per_port m_cmng_port;
-               u32 wsum;
-               int port = BP_PORT(bp);
+               if (bp->link_vars.link_up) {
+                       int i;
+
+                       /* Init rate shaping and fairness contexts */
+                       bnx2x_init_port_minmax(bp);
 
-               /* Init RATE SHAPING and FAIRNESS contexts */
-               wsum = bnx2x_calc_vn_wsum(bp);
-               bnx2x_init_port_minmax(bp, (int)wsum,
-                                       bp->link_vars.line_speed,
-                                       &m_cmng_port);
-               if (IS_E1HMF(bp))
                        for (vn = VN_0; vn < E1HVN_MAX; vn++)
-                               bnx2x_init_vn_minmax(bp, 2*vn + port,
-                                       wsum, bp->link_vars.line_speed,
-                                                    &m_cmng_port);
+                               bnx2x_init_vn_minmax(bp, 2*vn + port);
+
+                       /* Store it to internal memory */
+                       for (i = 0;
+                            i < sizeof(struct cmng_struct_per_port) / 4; i++)
+                               REG_WR(bp, BAR_XSTRORM_INTMEM +
+                                 XSTORM_CMNG_PER_PORT_VARS_OFFSET(port) + i*4,
+                                      ((u32 *)(&bp->cmng))[i]);
+               }
        }
 }
 
@@ -2489,6 +2505,7 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
        u32 nig_int_mask_addr = port ? NIG_REG_MASK_INTERRUPT_PORT1 :
                                       NIG_REG_MASK_INTERRUPT_PORT0;
        u32 aeu_mask;
+       u32 nig_mask = 0;
 
        if (bp->attn_state & asserted)
                BNX2X_ERR("IGU ERROR\n");
@@ -2514,7 +2531,7 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
                        bnx2x_acquire_phy_lock(bp);
 
                        /* save nig interrupt mask */
-                       bp->nig_mask = REG_RD(bp, nig_int_mask_addr);
+                       nig_mask = REG_RD(bp, nig_int_mask_addr);
                        REG_WR(bp, nig_int_mask_addr, 0);
 
                        bnx2x_link_attn(bp);
@@ -2569,7 +2586,7 @@ static void bnx2x_attn_int_asserted(struct bnx2x *bp, u32 asserted)
 
        /* now set back the mask */
        if (asserted & ATTN_NIG_FOR_FUNC) {
-               REG_WR(bp, nig_int_mask_addr, bp->nig_mask);
+               REG_WR(bp, nig_int_mask_addr, nig_mask);
                bnx2x_release_phy_lock(bp);
        }
 }
@@ -2591,9 +2608,8 @@ static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
 
                BNX2X_ERR("SPIO5 hw attention\n");
 
-               switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
-               case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
-               case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
+               switch (XGXS_EXT_PHY_TYPE(bp->link_params.ext_phy_config)) {
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
                        /* Fan failure attention */
 
                        /* The PHY reset is controlled by GPIO 1 */
@@ -2624,6 +2640,13 @@ static inline void bnx2x_attn_int_deasserted0(struct bnx2x *bp, u32 attn)
                }
        }
 
+       if (attn & (AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_0 |
+                   AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_1)) {
+               bnx2x_acquire_phy_lock(bp);
+               bnx2x_handle_module_detect_int(&bp->link_params);
+               bnx2x_release_phy_lock(bp);
+       }
+
        if (attn & HW_INTERRUT_ASSERT_SET_0) {
 
                val = REG_RD(bp, reg_offset);
@@ -2640,7 +2663,7 @@ static inline void bnx2x_attn_int_deasserted1(struct bnx2x *bp, u32 attn)
 {
        u32 val;
 
-       if (attn & BNX2X_DOORQ_ASSERT) {
+       if (attn & AEU_INPUTS_ATTN_BITS_DOORBELLQ_HW_INTERRUPT) {
 
                val = REG_RD(bp, DORQ_REG_DORQ_INT_STS_CLR);
                BNX2X_ERR("DB hw attention 0x%x\n", val);
@@ -2886,10 +2909,6 @@ static void bnx2x_sp_task(struct work_struct *work)
        if (status & 0x1)
                bnx2x_attn_int(bp);
 
-       /* CStorm events: query_stats, port delete ramrod */
-       if (status & 0x2)
-               bp->stats_pending = 0;
-
        bnx2x_ack_sb(bp, DEF_SB_ID, ATTENTION_ID, le16_to_cpu(bp->def_att_idx),
                     IGU_INT_NOP, 1);
        bnx2x_ack_sb(bp, DEF_SB_ID, USTORM_ID, le16_to_cpu(bp->def_u_idx),
@@ -2914,7 +2933,7 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
                return IRQ_HANDLED;
        }
 
-       bnx2x_ack_sb(bp, DEF_SB_ID, XSTORM_ID, 0, IGU_INT_DISABLE, 0);
+       bnx2x_ack_sb(bp, DEF_SB_ID, TSTORM_ID, 0, IGU_INT_DISABLE, 0);
 
 #ifdef BNX2X_STOP_ON_ERROR
        if (unlikely(bp->panic))
@@ -3003,16 +3022,41 @@ static irqreturn_t bnx2x_msix_sp_int(int irq, void *dev_instance)
 
 #define UPDATE_EXTEND_TSTAT(s, t) \
        do { \
-               diff = le32_to_cpu(tclient->s) - old_tclient->s; \
-               old_tclient->s = le32_to_cpu(tclient->s); \
-               ADD_EXTEND_64(fstats->t##_hi, fstats->t##_lo, diff); \
+               diff = le32_to_cpu(tclient->s) - le32_to_cpu(old_tclient->s); \
+               old_tclient->s = tclient->s; \
+               ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
+       } while (0)
+
+#define UPDATE_EXTEND_USTAT(s, t) \
+       do { \
+               diff = le32_to_cpu(uclient->s) - le32_to_cpu(old_uclient->s); \
+               old_uclient->s = uclient->s; \
+               ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
        } while (0)
 
 #define UPDATE_EXTEND_XSTAT(s, t) \
        do { \
-               diff = le32_to_cpu(xclient->s) - old_xclient->s; \
-               old_xclient->s = le32_to_cpu(xclient->s); \
-               ADD_EXTEND_64(fstats->t##_hi, fstats->t##_lo, diff); \
+               diff = le32_to_cpu(xclient->s) - le32_to_cpu(old_xclient->s); \
+               old_xclient->s = xclient->s; \
+               ADD_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
+       } while (0)
+
+/* minuend -= subtrahend */
+#define SUB_64(m_hi, s_hi, m_lo, s_lo) \
+       do { \
+               DIFF_64(m_hi, m_hi, s_hi, m_lo, m_lo, s_lo); \
+       } while (0)
+
+/* minuend[hi:lo] -= subtrahend */
+#define SUB_EXTEND_64(m_hi, m_lo, s) \
+       do { \
+               SUB_64(m_hi, 0, m_lo, s); \
+       } while (0)
+
+#define SUB_EXTEND_USTAT(s, t) \
+       do { \
+               diff = le32_to_cpu(uclient->s) - le32_to_cpu(old_uclient->s); \
+               SUB_EXTEND_64(qstats->t##_hi, qstats->t##_lo, diff); \
        } while (0)
 
 /*
@@ -3039,11 +3083,12 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
 {
        if (!bp->stats_pending) {
                struct eth_query_ramrod_data ramrod_data = {0};
-               int rc;
+               int i, rc;
 
                ramrod_data.drv_counter = bp->stats_counter++;
-               ramrod_data.collect_port_1b = bp->port.pmf ? 1 : 0;
-               ramrod_data.ctr_id_vector = (1 << BP_CL_ID(bp));
+               ramrod_data.collect_port = bp->port.pmf ? 1 : 0;
+               for_each_queue(bp, i)
+                       ramrod_data.ctr_id_vector |= (1 << bp->fp[i].cl_id);
 
                rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_STAT_QUERY, 0,
                                   ((u32 *)&ramrod_data)[1],
@@ -3059,7 +3104,9 @@ static void bnx2x_storm_stats_post(struct bnx2x *bp)
 static void bnx2x_stats_init(struct bnx2x *bp)
 {
        int port = BP_PORT(bp);
+       int i;
 
+       bp->stats_pending = 0;
        bp->executer_idx = 0;
        bp->stats_counter = 0;
 
@@ -3081,9 +3128,19 @@ static void bnx2x_stats_init(struct bnx2x *bp)
                    &(bp->port.old_nig_stats.egress_mac_pkt1_lo), 2);
 
        /* function stats */
+       for_each_queue(bp, i) {
+               struct bnx2x_fastpath *fp = &bp->fp[i];
+
+               memset(&fp->old_tclient, 0,
+                      sizeof(struct tstorm_per_client_stats));
+               memset(&fp->old_uclient, 0,
+                      sizeof(struct ustorm_per_client_stats));
+               memset(&fp->old_xclient, 0,
+                      sizeof(struct xstorm_per_client_stats));
+               memset(&fp->eth_q_stats, 0, sizeof(struct bnx2x_eth_q_stats));
+       }
+
        memset(&bp->dev->stats, 0, sizeof(struct net_device_stats));
-       memset(&bp->old_tclient, 0, sizeof(struct tstorm_per_client_stats));
-       memset(&bp->old_xclient, 0, sizeof(struct xstorm_per_client_stats));
        memset(&bp->eth_stats, 0, sizeof(struct bnx2x_eth_stats));
 
        bp->stats_state = STATS_STATE_DISABLED;
@@ -3097,6 +3154,8 @@ static void bnx2x_hw_stats_post(struct bnx2x *bp)
        u32 *stats_comp = bnx2x_sp(bp, stats_comp);
 
        *stats_comp = DMAE_COMP_VAL;
+       if (CHIP_REV_IS_SLOW(bp))
+               return;
 
        /* loader */
        if (bp->executer_idx) {
@@ -3486,7 +3545,11 @@ static void bnx2x_bmac_stats_update(struct bnx2x *bp)
 {
        struct bmac_stats *new = bnx2x_sp(bp, mac_stats.bmac_stats);
        struct host_port_stats *pstats = bnx2x_sp(bp, port_stats);
-       struct regpair diff;
+       struct bnx2x_eth_stats *estats = &bp->eth_stats;
+       struct {
+               u32 lo;
+               u32 hi;
+       } diff;
 
        UPDATE_STAT64(rx_stat_grerb, rx_stat_ifhcinbadoctets);
        UPDATE_STAT64(rx_stat_grfcs, rx_stat_dot3statsfcserrors);
@@ -3496,7 +3559,7 @@ static void bnx2x_bmac_stats_update(struct bnx2x *bp)
        UPDATE_STAT64(rx_stat_grjbr, rx_stat_etherstatsjabbers);
        UPDATE_STAT64(rx_stat_grxcf, rx_stat_maccontrolframesreceived);
        UPDATE_STAT64(rx_stat_grxpf, rx_stat_xoffstateentered);
-       UPDATE_STAT64(rx_stat_grxpf, rx_stat_xoffpauseframesreceived);
+       UPDATE_STAT64(rx_stat_grxpf, rx_stat_bmac_xpf);
        UPDATE_STAT64(tx_stat_gtxpf, tx_stat_outxoffsent);
        UPDATE_STAT64(tx_stat_gtxpf, tx_stat_flowcontroldone);
        UPDATE_STAT64(tx_stat_gt64, tx_stat_etherstatspkts64octets);
@@ -3517,12 +3580,23 @@ static void bnx2x_bmac_stats_update(struct bnx2x *bp)
        UPDATE_STAT64(tx_stat_gterr,
                                tx_stat_dot3statsinternalmactransmiterrors);
        UPDATE_STAT64(tx_stat_gtufl, tx_stat_bmac_ufl);
+
+       estats->pause_frames_received_hi =
+                               pstats->mac_stx[1].rx_stat_bmac_xpf_hi;
+       estats->pause_frames_received_lo =
+                               pstats->mac_stx[1].rx_stat_bmac_xpf_lo;
+
+       estats->pause_frames_sent_hi =
+                               pstats->mac_stx[1].tx_stat_outxoffsent_hi;
+       estats->pause_frames_sent_lo =
+                               pstats->mac_stx[1].tx_stat_outxoffsent_lo;
 }
 
 static void bnx2x_emac_stats_update(struct bnx2x *bp)
 {
        struct emac_stats *new = bnx2x_sp(bp, mac_stats.emac_stats);
        struct host_port_stats *pstats = bnx2x_sp(bp, port_stats);
+       struct bnx2x_eth_stats *estats = &bp->eth_stats;
 
        UPDATE_EXTEND_STAT(rx_stat_ifhcinbadoctets);
        UPDATE_EXTEND_STAT(tx_stat_ifhcoutbadoctets);
@@ -3555,6 +3629,24 @@ static void bnx2x_emac_stats_update(struct bnx2x *bp)
        UPDATE_EXTEND_STAT(tx_stat_etherstatspkts1024octetsto1522octets);
        UPDATE_EXTEND_STAT(tx_stat_etherstatspktsover1522octets);
        UPDATE_EXTEND_STAT(tx_stat_dot3statsinternalmactransmiterrors);
+
+       estats->pause_frames_received_hi =
+                       pstats->mac_stx[1].rx_stat_xonpauseframesreceived_hi;
+       estats->pause_frames_received_lo =
+                       pstats->mac_stx[1].rx_stat_xonpauseframesreceived_lo;
+       ADD_64(estats->pause_frames_received_hi,
+              pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_hi,
+              estats->pause_frames_received_lo,
+              pstats->mac_stx[1].rx_stat_xoffpauseframesreceived_lo);
+
+       estats->pause_frames_sent_hi =
+                       pstats->mac_stx[1].tx_stat_outxonsent_hi;
+       estats->pause_frames_sent_lo =
+                       pstats->mac_stx[1].tx_stat_outxonsent_lo;
+       ADD_64(estats->pause_frames_sent_hi,
+              pstats->mac_stx[1].tx_stat_outxoffsent_hi,
+              estats->pause_frames_sent_lo,
+              pstats->mac_stx[1].tx_stat_outxoffsent_lo);
 }
 
 static int bnx2x_hw_stats_update(struct bnx2x *bp)
@@ -3563,7 +3655,11 @@ static int bnx2x_hw_stats_update(struct bnx2x *bp)
        struct nig_stats *old = &(bp->port.old_nig_stats);
        struct host_port_stats *pstats = bnx2x_sp(bp, port_stats);
        struct bnx2x_eth_stats *estats = &bp->eth_stats;
-       struct regpair diff;
+       struct {
+               u32 lo;
+               u32 hi;
+       } diff;
+       u32 nig_timer_max;
 
        if (bp->link_vars.mac_type == MAC_TYPE_BMAC)
                bnx2x_bmac_stats_update(bp);
@@ -3594,134 +3690,211 @@ static int bnx2x_hw_stats_update(struct bnx2x *bp)
 
        pstats->host_port_stats_start = ++pstats->host_port_stats_end;
 
+       nig_timer_max = SHMEM_RD(bp, port_mb[BP_PORT(bp)].stat_nig_timer);
+       if (nig_timer_max != estats->nig_timer_max) {
+               estats->nig_timer_max = nig_timer_max;
+               BNX2X_ERR("NIG timer max (%u)\n", estats->nig_timer_max);
+       }
+
        return 0;
 }
 
 static int bnx2x_storm_stats_update(struct bnx2x *bp)
 {
        struct eth_stats_query *stats = bnx2x_sp(bp, fw_stats);
-       int cl_id = BP_CL_ID(bp);
        struct tstorm_per_port_stats *tport =
-                               &stats->tstorm_common.port_statistics;
-       struct tstorm_per_client_stats *tclient =
-                       &stats->tstorm_common.client_statistics[cl_id];
-       struct tstorm_per_client_stats *old_tclient = &bp->old_tclient;
-       struct xstorm_per_client_stats *xclient =
-                       &stats->xstorm_common.client_statistics[cl_id];
-       struct xstorm_per_client_stats *old_xclient = &bp->old_xclient;
+                                       &stats->tstorm_common.port_statistics;
        struct host_func_stats *fstats = bnx2x_sp(bp, func_stats);
        struct bnx2x_eth_stats *estats = &bp->eth_stats;
-       u32 diff;
+       int i;
+
+       memset(&(fstats->total_bytes_received_hi), 0,
+              sizeof(struct host_func_stats) - 2*sizeof(u32));
+       estats->error_bytes_received_hi = 0;
+       estats->error_bytes_received_lo = 0;
+       estats->etherstatsoverrsizepkts_hi = 0;
+       estats->etherstatsoverrsizepkts_lo = 0;
+       estats->no_buff_discard_hi = 0;
+       estats->no_buff_discard_lo = 0;
 
-       /* are storm stats valid? */
-       if ((u16)(le16_to_cpu(tclient->stats_counter) + 1) !=
+       for_each_queue(bp, i) {
+               struct bnx2x_fastpath *fp = &bp->fp[i];
+               int cl_id = fp->cl_id;
+               struct tstorm_per_client_stats *tclient =
+                               &stats->tstorm_common.client_statistics[cl_id];
+               struct tstorm_per_client_stats *old_tclient = &fp->old_tclient;
+               struct ustorm_per_client_stats *uclient =
+                               &stats->ustorm_common.client_statistics[cl_id];
+               struct ustorm_per_client_stats *old_uclient = &fp->old_uclient;
+               struct xstorm_per_client_stats *xclient =
+                               &stats->xstorm_common.client_statistics[cl_id];
+               struct xstorm_per_client_stats *old_xclient = &fp->old_xclient;
+               struct bnx2x_eth_q_stats *qstats = &fp->eth_q_stats;
+               u32 diff;
+
+               /* are storm stats valid? */
+               if ((u16)(le16_to_cpu(xclient->stats_counter) + 1) !=
                                                        bp->stats_counter) {
-               DP(BNX2X_MSG_STATS, "stats not updated by tstorm"
-                  "  tstorm counter (%d) != stats_counter (%d)\n",
-                  tclient->stats_counter, bp->stats_counter);
-               return -1;
-       }
-       if ((u16)(le16_to_cpu(xclient->stats_counter) + 1) !=
+                       DP(BNX2X_MSG_STATS, "[%d] stats not updated by xstorm"
+                          "  xstorm counter (%d) != stats_counter (%d)\n",
+                          i, xclient->stats_counter, bp->stats_counter);
+                       return -1;
+               }
+               if ((u16)(le16_to_cpu(tclient->stats_counter) + 1) !=
                                                        bp->stats_counter) {
-               DP(BNX2X_MSG_STATS, "stats not updated by xstorm"
-                  "  xstorm counter (%d) != stats_counter (%d)\n",
-                  xclient->stats_counter, bp->stats_counter);
-               return -2;
-       }
+                       DP(BNX2X_MSG_STATS, "[%d] stats not updated by tstorm"
+                          "  tstorm counter (%d) != stats_counter (%d)\n",
+                          i, tclient->stats_counter, bp->stats_counter);
+                       return -2;
+               }
+               if ((u16)(le16_to_cpu(uclient->stats_counter) + 1) !=
+                                                       bp->stats_counter) {
+                       DP(BNX2X_MSG_STATS, "[%d] stats not updated by ustorm"
+                          "  ustorm counter (%d) != stats_counter (%d)\n",
+                          i, uclient->stats_counter, bp->stats_counter);
+                       return -4;
+               }
 
-       fstats->total_bytes_received_hi =
-       fstats->valid_bytes_received_hi =
+               qstats->total_bytes_received_hi =
+               qstats->valid_bytes_received_hi =
                                le32_to_cpu(tclient->total_rcv_bytes.hi);
-       fstats->total_bytes_received_lo =
-       fstats->valid_bytes_received_lo =
+               qstats->total_bytes_received_lo =
+               qstats->valid_bytes_received_lo =
                                le32_to_cpu(tclient->total_rcv_bytes.lo);
 
-       estats->error_bytes_received_hi =
+               qstats->error_bytes_received_hi =
                                le32_to_cpu(tclient->rcv_error_bytes.hi);
-       estats->error_bytes_received_lo =
+               qstats->error_bytes_received_lo =
                                le32_to_cpu(tclient->rcv_error_bytes.lo);
-       ADD_64(estats->error_bytes_received_hi,
-              estats->rx_stat_ifhcinbadoctets_hi,
-              estats->error_bytes_received_lo,
-              estats->rx_stat_ifhcinbadoctets_lo);
 
-       ADD_64(fstats->total_bytes_received_hi,
-              estats->error_bytes_received_hi,
-              fstats->total_bytes_received_lo,
-              estats->error_bytes_received_lo);
-
-       UPDATE_EXTEND_TSTAT(rcv_unicast_pkts, total_unicast_packets_received);
-       UPDATE_EXTEND_TSTAT(rcv_multicast_pkts,
-                               total_multicast_packets_received);
-       UPDATE_EXTEND_TSTAT(rcv_broadcast_pkts,
-                               total_broadcast_packets_received);
-
-       fstats->total_bytes_transmitted_hi =
+               ADD_64(qstats->total_bytes_received_hi,
+                      qstats->error_bytes_received_hi,
+                      qstats->total_bytes_received_lo,
+                      qstats->error_bytes_received_lo);
+
+               UPDATE_EXTEND_TSTAT(rcv_unicast_pkts,
+                                       total_unicast_packets_received);
+               UPDATE_EXTEND_TSTAT(rcv_multicast_pkts,
+                                       total_multicast_packets_received);
+               UPDATE_EXTEND_TSTAT(rcv_broadcast_pkts,
+                                       total_broadcast_packets_received);
+               UPDATE_EXTEND_TSTAT(packets_too_big_discard,
+                                       etherstatsoverrsizepkts);
+               UPDATE_EXTEND_TSTAT(no_buff_discard, no_buff_discard);
+
+               SUB_EXTEND_USTAT(ucast_no_buff_pkts,
+                                       total_unicast_packets_received);
+               SUB_EXTEND_USTAT(mcast_no_buff_pkts,
+                                       total_multicast_packets_received);
+               SUB_EXTEND_USTAT(bcast_no_buff_pkts,
+                                       total_broadcast_packets_received);
+               UPDATE_EXTEND_USTAT(ucast_no_buff_pkts, no_buff_discard);
+               UPDATE_EXTEND_USTAT(mcast_no_buff_pkts, no_buff_discard);
+               UPDATE_EXTEND_USTAT(bcast_no_buff_pkts, no_buff_discard);
+
+               qstats->total_bytes_transmitted_hi =
                                le32_to_cpu(xclient->total_sent_bytes.hi);
-       fstats->total_bytes_transmitted_lo =
+               qstats->total_bytes_transmitted_lo =
                                le32_to_cpu(xclient->total_sent_bytes.lo);
 
-       UPDATE_EXTEND_XSTAT(unicast_pkts_sent,
-                               total_unicast_packets_transmitted);
-       UPDATE_EXTEND_XSTAT(multicast_pkts_sent,
-                               total_multicast_packets_transmitted);
-       UPDATE_EXTEND_XSTAT(broadcast_pkts_sent,
-                               total_broadcast_packets_transmitted);
+               UPDATE_EXTEND_XSTAT(unicast_pkts_sent,
+                                       total_unicast_packets_transmitted);
+               UPDATE_EXTEND_XSTAT(multicast_pkts_sent,
+                                       total_multicast_packets_transmitted);
+               UPDATE_EXTEND_XSTAT(broadcast_pkts_sent,
+                                       total_broadcast_packets_transmitted);
+
+               old_tclient->checksum_discard = tclient->checksum_discard;
+               old_tclient->ttl0_discard = tclient->ttl0_discard;
+
+               ADD_64(fstats->total_bytes_received_hi,
+                      qstats->total_bytes_received_hi,
+                      fstats->total_bytes_received_lo,
+                      qstats->total_bytes_received_lo);
+               ADD_64(fstats->total_bytes_transmitted_hi,
+                      qstats->total_bytes_transmitted_hi,
+                      fstats->total_bytes_transmitted_lo,
+                      qstats->total_bytes_transmitted_lo);
+               ADD_64(fstats->total_unicast_packets_received_hi,
+                      qstats->total_unicast_packets_received_hi,
+                      fstats->total_unicast_packets_received_lo,
+                      qstats->total_unicast_packets_received_lo);
+               ADD_64(fstats->total_multicast_packets_received_hi,
+                      qstats->total_multicast_packets_received_hi,
+                      fstats->total_multicast_packets_received_lo,
+                      qstats->total_multicast_packets_received_lo);
+               ADD_64(fstats->total_broadcast_packets_received_hi,
+                      qstats->total_broadcast_packets_received_hi,
+                      fstats->total_broadcast_packets_received_lo,
+                      qstats->total_broadcast_packets_received_lo);
+               ADD_64(fstats->total_unicast_packets_transmitted_hi,
+                      qstats->total_unicast_packets_transmitted_hi,
+                      fstats->total_unicast_packets_transmitted_lo,
+                      qstats->total_unicast_packets_transmitted_lo);
+               ADD_64(fstats->total_multicast_packets_transmitted_hi,
+                      qstats->total_multicast_packets_transmitted_hi,
+                      fstats->total_multicast_packets_transmitted_lo,
+                      qstats->total_multicast_packets_transmitted_lo);
+               ADD_64(fstats->total_broadcast_packets_transmitted_hi,
+                      qstats->total_broadcast_packets_transmitted_hi,
+                      fstats->total_broadcast_packets_transmitted_lo,
+                      qstats->total_broadcast_packets_transmitted_lo);
+               ADD_64(fstats->valid_bytes_received_hi,
+                      qstats->valid_bytes_received_hi,
+                      fstats->valid_bytes_received_lo,
+                      qstats->valid_bytes_received_lo);
+
+               ADD_64(estats->error_bytes_received_hi,
+                      qstats->error_bytes_received_hi,
+                      estats->error_bytes_received_lo,
+                      qstats->error_bytes_received_lo);
+               ADD_64(estats->etherstatsoverrsizepkts_hi,
+                      qstats->etherstatsoverrsizepkts_hi,
+                      estats->etherstatsoverrsizepkts_lo,
+                      qstats->etherstatsoverrsizepkts_lo);
+               ADD_64(estats->no_buff_discard_hi, qstats->no_buff_discard_hi,
+                      estats->no_buff_discard_lo, qstats->no_buff_discard_lo);
+       }
+
+       ADD_64(fstats->total_bytes_received_hi,
+              estats->rx_stat_ifhcinbadoctets_hi,
+              fstats->total_bytes_received_lo,
+              estats->rx_stat_ifhcinbadoctets_lo);
 
        memcpy(estats, &(fstats->total_bytes_received_hi),
               sizeof(struct host_func_stats) - 2*sizeof(u32));
 
-       estats->mac_filter_discard = le32_to_cpu(tport->mac_filter_discard);
-       estats->xxoverflow_discard = le32_to_cpu(tport->xxoverflow_discard);
-       estats->brb_truncate_discard =
+       ADD_64(estats->etherstatsoverrsizepkts_hi,
+              estats->rx_stat_dot3statsframestoolong_hi,
+              estats->etherstatsoverrsizepkts_lo,
+              estats->rx_stat_dot3statsframestoolong_lo);
+       ADD_64(estats->error_bytes_received_hi,
+              estats->rx_stat_ifhcinbadoctets_hi,
+              estats->error_bytes_received_lo,
+              estats->rx_stat_ifhcinbadoctets_lo);
+
+       if (bp->port.pmf) {
+               estats->mac_filter_discard =
+                               le32_to_cpu(tport->mac_filter_discard);
+               estats->xxoverflow_discard =
+                               le32_to_cpu(tport->xxoverflow_discard);
+               estats->brb_truncate_discard =
                                le32_to_cpu(tport->brb_truncate_discard);
-       estats->mac_discard = le32_to_cpu(tport->mac_discard);
-
-       old_tclient->rcv_unicast_bytes.hi =
-                               le32_to_cpu(tclient->rcv_unicast_bytes.hi);
-       old_tclient->rcv_unicast_bytes.lo =
-                               le32_to_cpu(tclient->rcv_unicast_bytes.lo);
-       old_tclient->rcv_broadcast_bytes.hi =
-                               le32_to_cpu(tclient->rcv_broadcast_bytes.hi);
-       old_tclient->rcv_broadcast_bytes.lo =
-                               le32_to_cpu(tclient->rcv_broadcast_bytes.lo);
-       old_tclient->rcv_multicast_bytes.hi =
-                               le32_to_cpu(tclient->rcv_multicast_bytes.hi);
-       old_tclient->rcv_multicast_bytes.lo =
-                               le32_to_cpu(tclient->rcv_multicast_bytes.lo);
-       old_tclient->total_rcv_pkts = le32_to_cpu(tclient->total_rcv_pkts);
-
-       old_tclient->checksum_discard = le32_to_cpu(tclient->checksum_discard);
-       old_tclient->packets_too_big_discard =
-                               le32_to_cpu(tclient->packets_too_big_discard);
-       estats->no_buff_discard =
-       old_tclient->no_buff_discard = le32_to_cpu(tclient->no_buff_discard);
-       old_tclient->ttl0_discard = le32_to_cpu(tclient->ttl0_discard);
-
-       old_xclient->total_sent_pkts = le32_to_cpu(xclient->total_sent_pkts);
-       old_xclient->unicast_bytes_sent.hi =
-                               le32_to_cpu(xclient->unicast_bytes_sent.hi);
-       old_xclient->unicast_bytes_sent.lo =
-                               le32_to_cpu(xclient->unicast_bytes_sent.lo);
-       old_xclient->multicast_bytes_sent.hi =
-                               le32_to_cpu(xclient->multicast_bytes_sent.hi);
-       old_xclient->multicast_bytes_sent.lo =
-                               le32_to_cpu(xclient->multicast_bytes_sent.lo);
-       old_xclient->broadcast_bytes_sent.hi =
-                               le32_to_cpu(xclient->broadcast_bytes_sent.hi);
-       old_xclient->broadcast_bytes_sent.lo =
-                               le32_to_cpu(xclient->broadcast_bytes_sent.lo);
+               estats->mac_discard = le32_to_cpu(tport->mac_discard);
+       }
 
        fstats->host_func_stats_start = ++fstats->host_func_stats_end;
 
+       bp->stats_pending = 0;
+
        return 0;
 }
 
 static void bnx2x_net_stats_update(struct bnx2x *bp)
 {
-       struct tstorm_per_client_stats *old_tclient = &bp->old_tclient;
        struct bnx2x_eth_stats *estats = &bp->eth_stats;
        struct net_device_stats *nstats = &bp->dev->stats;
+       int i;
 
        nstats->rx_packets =
                bnx2x_hilo(&estats->total_unicast_packets_received_hi) +
@@ -3733,34 +3906,33 @@ static void bnx2x_net_stats_update(struct bnx2x *bp)
                bnx2x_hilo(&estats->total_multicast_packets_transmitted_hi) +
                bnx2x_hilo(&estats->total_broadcast_packets_transmitted_hi);
 
-       nstats->rx_bytes = bnx2x_hilo(&estats->valid_bytes_received_hi);
+       nstats->rx_bytes = bnx2x_hilo(&estats->total_bytes_received_hi);
 
        nstats->tx_bytes = bnx2x_hilo(&estats->total_bytes_transmitted_hi);
 
-       nstats->rx_dropped = old_tclient->checksum_discard +
-                            estats->mac_discard;
+       nstats->rx_dropped = estats->mac_discard;
+       for_each_queue(bp, i)
+               nstats->rx_dropped +=
+                       le32_to_cpu(bp->fp[i].old_tclient.checksum_discard);
+
        nstats->tx_dropped = 0;
 
        nstats->multicast =
-               bnx2x_hilo(&estats->total_multicast_packets_transmitted_hi);
+               bnx2x_hilo(&estats->total_multicast_packets_received_hi);
 
        nstats->collisions =
-                       estats->tx_stat_dot3statssinglecollisionframes_lo +
-                       estats->tx_stat_dot3statsmultiplecollisionframes_lo +
-                       estats->tx_stat_dot3statslatecollisions_lo +
-                       estats->tx_stat_dot3statsexcessivecollisions_lo;
-
-       estats->jabber_packets_received =
-                               old_tclient->packets_too_big_discard +
-                               estats->rx_stat_dot3statsframestoolong_lo;
+               bnx2x_hilo(&estats->tx_stat_etherstatscollisions_hi);
 
        nstats->rx_length_errors =
-                               estats->rx_stat_etherstatsundersizepkts_lo +
-                               estats->jabber_packets_received;
-       nstats->rx_over_errors = estats->brb_drop_lo + estats->brb_truncate_lo;
-       nstats->rx_crc_errors = estats->rx_stat_dot3statsfcserrors_lo;
-       nstats->rx_frame_errors = estats->rx_stat_dot3statsalignmenterrors_lo;
-       nstats->rx_fifo_errors = old_tclient->no_buff_discard;
+               bnx2x_hilo(&estats->rx_stat_etherstatsundersizepkts_hi) +
+               bnx2x_hilo(&estats->etherstatsoverrsizepkts_hi);
+       nstats->rx_over_errors = bnx2x_hilo(&estats->brb_drop_hi) +
+                                bnx2x_hilo(&estats->brb_truncate_hi);
+       nstats->rx_crc_errors =
+               bnx2x_hilo(&estats->rx_stat_dot3statsfcserrors_hi);
+       nstats->rx_frame_errors =
+               bnx2x_hilo(&estats->rx_stat_dot3statsalignmenterrors_hi);
+       nstats->rx_fifo_errors = bnx2x_hilo(&estats->no_buff_discard_hi);
        nstats->rx_missed_errors = estats->xxoverflow_discard;
 
        nstats->rx_errors = nstats->rx_length_errors +
@@ -3771,46 +3943,61 @@ static void bnx2x_net_stats_update(struct bnx2x *bp)
                            nstats->rx_missed_errors;
 
        nstats->tx_aborted_errors =
-                       estats->tx_stat_dot3statslatecollisions_lo +
-                       estats->tx_stat_dot3statsexcessivecollisions_lo;
-       nstats->tx_carrier_errors = estats->rx_stat_falsecarriererrors_lo;
+               bnx2x_hilo(&estats->tx_stat_dot3statslatecollisions_hi) +
+               bnx2x_hilo(&estats->tx_stat_dot3statsexcessivecollisions_hi);
+       nstats->tx_carrier_errors =
+               bnx2x_hilo(&estats->rx_stat_dot3statscarriersenseerrors_hi);
        nstats->tx_fifo_errors = 0;
        nstats->tx_heartbeat_errors = 0;
        nstats->tx_window_errors = 0;
 
        nstats->tx_errors = nstats->tx_aborted_errors +
-                           nstats->tx_carrier_errors;
+                           nstats->tx_carrier_errors +
+           bnx2x_hilo(&estats->tx_stat_dot3statsinternalmactransmiterrors_hi);
+}
+
+static void bnx2x_drv_stats_update(struct bnx2x *bp)
+{
+       struct bnx2x_eth_stats *estats = &bp->eth_stats;
+       int i;
+
+       estats->driver_xoff = 0;
+       estats->rx_err_discard_pkt = 0;
+       estats->rx_skb_alloc_failed = 0;
+       estats->hw_csum_err = 0;
+       for_each_queue(bp, i) {
+               struct bnx2x_eth_q_stats *qstats = &bp->fp[i].eth_q_stats;
+
+               estats->driver_xoff += qstats->driver_xoff;
+               estats->rx_err_discard_pkt += qstats->rx_err_discard_pkt;
+               estats->rx_skb_alloc_failed += qstats->rx_skb_alloc_failed;
+               estats->hw_csum_err += qstats->hw_csum_err;
+       }
 }
 
 static void bnx2x_stats_update(struct bnx2x *bp)
 {
        u32 *stats_comp = bnx2x_sp(bp, stats_comp);
-       int update = 0;
 
        if (*stats_comp != DMAE_COMP_VAL)
                return;
 
        if (bp->port.pmf)
-               update = (bnx2x_hw_stats_update(bp) == 0);
+               bnx2x_hw_stats_update(bp);
 
-       update |= (bnx2x_storm_stats_update(bp) == 0);
-
-       if (update)
-               bnx2x_net_stats_update(bp);
-
-       else {
-               if (bp->stats_pending) {
-                       bp->stats_pending++;
-                       if (bp->stats_pending == 3) {
-                               BNX2X_ERR("stats not updated for 3 times\n");
-                               bnx2x_panic();
-                               return;
-                       }
-               }
+       if (bnx2x_storm_stats_update(bp) && (bp->stats_pending++ == 3)) {
+               BNX2X_ERR("storm stats were not updated for 3 times\n");
+               bnx2x_panic();
+               return;
        }
 
+       bnx2x_net_stats_update(bp);
+       bnx2x_drv_stats_update(bp);
+
        if (bp->msglevel & NETIF_MSG_TIMER) {
-               struct tstorm_per_client_stats *old_tclient = &bp->old_tclient;
+               struct tstorm_per_client_stats *old_tclient =
+                                                       &bp->fp->old_tclient;
+               struct bnx2x_eth_q_stats *qstats = &bp->fp->eth_q_stats;
                struct bnx2x_eth_stats *estats = &bp->eth_stats;
                struct net_device_stats *nstats = &bp->dev->stats;
                int i;
@@ -3825,20 +4012,22 @@ static void bnx2x_stats_update(struct bnx2x *bp)
                       (u16)(le16_to_cpu(*bp->fp->rx_cons_sb) -
                             bp->fp->rx_comp_cons),
                       le16_to_cpu(*bp->fp->rx_cons_sb), nstats->rx_packets);
-               printk(KERN_DEBUG "  %s (Xoff events %u)  brb drops %u\n",
-                      netif_queue_stopped(bp->dev) ? "Xoff" : "Xon",
-                      estats->driver_xoff, estats->brb_drop_lo);
+               printk(KERN_DEBUG "  %s (Xoff events %u)  brb drops %u  "
+                                 "brb truncate %u\n",
+                      (netif_queue_stopped(bp->dev) ? "Xoff" : "Xon"),
+                      qstats->driver_xoff,
+                      estats->brb_drop_lo, estats->brb_truncate_lo);
                printk(KERN_DEBUG "tstats: checksum_discard %u  "
-                       "packets_too_big_discard %u  no_buff_discard %u  "
+                       "packets_too_big_discard %lu  no_buff_discard %lu  "
                        "mac_discard %u  mac_filter_discard %u  "
                        "xxovrflow_discard %u  brb_truncate_discard %u  "
                        "ttl0_discard %u\n",
-                      old_tclient->checksum_discard,
-                      old_tclient->packets_too_big_discard,
-                      old_tclient->no_buff_discard, estats->mac_discard,
-                      estats->mac_filter_discard, estats->xxoverflow_discard,
-                      estats->brb_truncate_discard,
-                      old_tclient->ttl0_discard);
+                      le32_to_cpu(old_tclient->checksum_discard),
+                      bnx2x_hilo(&qstats->etherstatsoverrsizepkts_hi),
+                      bnx2x_hilo(&qstats->no_buff_discard_hi),
+                      estats->mac_discard, estats->mac_filter_discard,
+                      estats->xxoverflow_discard, estats->brb_truncate_discard,
+                      le32_to_cpu(old_tclient->ttl0_discard));
 
                for_each_queue(bp, i) {
                        printk(KERN_DEBUG "[%d]: %lu\t%lu\t%lu\n", i,
@@ -4239,10 +4428,6 @@ static void bnx2x_update_coalesce(struct bnx2x *bp)
                         USTORM_SB_HC_DISABLE_OFFSET(port, sb_id,
                                                     U_SB_ETH_RX_CQ_INDEX),
                         bp->rx_ticks ? 0 : 1);
-               REG_WR16(bp, BAR_USTRORM_INTMEM +
-                        USTORM_SB_HC_DISABLE_OFFSET(port, sb_id,
-                                                    U_SB_ETH_RX_BD_INDEX),
-                        bp->rx_ticks ? 0 : 1);
 
                /* HC_INDEX_C_ETH_TX_CQ_CONS */
                REG_WR8(bp, BAR_CSTRORM_INTMEM +
@@ -4273,8 +4458,7 @@ static inline void bnx2x_free_tpa_pool(struct bnx2x *bp,
                if (fp->tpa_state[i] == BNX2X_TPA_START)
                        pci_unmap_single(bp->pdev,
                                         pci_unmap_addr(rx_buf, mapping),
-                                        bp->rx_buf_size,
-                                        PCI_DMA_FROMDEVICE);
+                                        bp->rx_buf_size, PCI_DMA_FROMDEVICE);
 
                dev_kfree_skb(skb);
                rx_buf->skb = NULL;
@@ -4289,16 +4473,13 @@ static void bnx2x_init_rx_rings(struct bnx2x *bp)
        u16 ring_prod, cqe_ring_prod;
        int i, j;
 
-       bp->rx_buf_size = bp->dev->mtu;
-       bp->rx_buf_size += bp->rx_offset + ETH_OVREHEAD +
-               BCM_RX_ETH_PAYLOAD_ALIGN;
+       bp->rx_buf_size = bp->dev->mtu + ETH_OVREHEAD + BNX2X_RX_ALIGN;
+       DP(NETIF_MSG_IFUP,
+          "mtu %d  rx_buf_size %d\n", bp->dev->mtu, bp->rx_buf_size);
 
        if (bp->flags & TPA_ENABLE_FLAG) {
-               DP(NETIF_MSG_IFUP,
-                  "rx_buf_size %d  effective_mtu %d\n",
-                  bp->rx_buf_size, bp->dev->mtu + ETH_OVREHEAD);
 
-               for_each_queue(bp, j) {
+               for_each_rx_queue(bp, j) {
                        struct bnx2x_fastpath *fp = &bp->fp[j];
 
                        for (i = 0; i < max_agg_queues; i++) {
@@ -4321,7 +4502,7 @@ static void bnx2x_init_rx_rings(struct bnx2x *bp)
                }
        }
 
-       for_each_queue(bp, j) {
+       for_each_rx_queue(bp, j) {
                struct bnx2x_fastpath *fp = &bp->fp[j];
 
                fp->rx_bd_cons = 0;
@@ -4396,8 +4577,8 @@ static void bnx2x_init_rx_rings(struct bnx2x *bp)
                for (i = 0; i < bp->rx_ring_size; i++) {
                        if (bnx2x_alloc_rx_skb(bp, fp, ring_prod) < 0) {
                                BNX2X_ERR("was only able to allocate "
-                                         "%d rx skbs\n", i);
-                               bp->eth_stats.rx_skb_alloc_failed++;
+                                         "%d rx skbs on queue[%d]\n", i, j);
+                               fp->eth_q_stats.rx_skb_alloc_failed++;
                                break;
                        }
                        ring_prod = NEXT_RX_IDX(ring_prod);
@@ -4433,7 +4614,7 @@ static void bnx2x_init_tx_ring(struct bnx2x *bp)
 {
        int i, j;
 
-       for_each_queue(bp, j) {
+       for_each_tx_queue(bp, j) {
                struct bnx2x_fastpath *fp = &bp->fp[j];
 
                for (i = 1; i <= NUM_TX_RINGS; i++) {
@@ -4486,27 +4667,20 @@ static void bnx2x_init_context(struct bnx2x *bp)
        for_each_queue(bp, i) {
                struct eth_context *context = bnx2x_sp(bp, context[i].eth);
                struct bnx2x_fastpath *fp = &bp->fp[i];
-               u8 sb_id = FP_SB_ID(fp);
-
-               context->xstorm_st_context.tx_bd_page_base_hi =
-                                               U64_HI(fp->tx_desc_mapping);
-               context->xstorm_st_context.tx_bd_page_base_lo =
-                                               U64_LO(fp->tx_desc_mapping);
-               context->xstorm_st_context.db_data_addr_hi =
-                                               U64_HI(fp->tx_prods_mapping);
-               context->xstorm_st_context.db_data_addr_lo =
-                                               U64_LO(fp->tx_prods_mapping);
-               context->xstorm_st_context.statistics_data = (BP_CL_ID(bp) |
-                               XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE);
+               u8 cl_id = fp->cl_id;
+               u8 sb_id = fp->sb_id;
 
                context->ustorm_st_context.common.sb_index_numbers =
                                                BNX2X_RX_SB_INDEX_NUM;
-               context->ustorm_st_context.common.clientId = FP_CL_ID(fp);
+               context->ustorm_st_context.common.clientId = cl_id;
                context->ustorm_st_context.common.status_block_id = sb_id;
                context->ustorm_st_context.common.flags =
-                       USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT;
-               context->ustorm_st_context.common.mc_alignment_size =
-                       BCM_RX_ETH_PAYLOAD_ALIGN;
+                       (USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_MC_ALIGNMENT |
+                        USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_STATISTICS);
+               context->ustorm_st_context.common.statistics_counter_id =
+                                               cl_id;
+               context->ustorm_st_context.common.mc_alignment_log_size =
+                                               BNX2X_RX_ALIGN_SHIFT;
                context->ustorm_st_context.common.bd_buff_size =
                                                bp->rx_buf_size;
                context->ustorm_st_context.common.bd_page_base_hi =
@@ -4518,13 +4692,29 @@ static void bnx2x_init_context(struct bnx2x *bp)
                                (USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_TPA |
                                 USTORM_ETH_ST_CONTEXT_CONFIG_ENABLE_SGE_RING);
                        context->ustorm_st_context.common.sge_buff_size =
-                                       (u16)(BCM_PAGE_SIZE*PAGES_PER_SGE);
+                               (u16)min((u32)SGE_PAGE_SIZE*PAGES_PER_SGE,
+                                        (u32)0xffff);
                        context->ustorm_st_context.common.sge_page_base_hi =
                                                U64_HI(fp->rx_sge_mapping);
                        context->ustorm_st_context.common.sge_page_base_lo =
                                                U64_LO(fp->rx_sge_mapping);
                }
 
+               context->ustorm_ag_context.cdu_usage =
+                       CDU_RSRVD_VALUE_TYPE_A(HW_CID(bp, i),
+                                              CDU_REGION_NUMBER_UCM_AG,
+                                              ETH_CONNECTION_TYPE);
+
+               context->xstorm_st_context.tx_bd_page_base_hi =
+                                               U64_HI(fp->tx_desc_mapping);
+               context->xstorm_st_context.tx_bd_page_base_lo =
+                                               U64_LO(fp->tx_desc_mapping);
+               context->xstorm_st_context.db_data_addr_hi =
+                                               U64_HI(fp->tx_prods_mapping);
+               context->xstorm_st_context.db_data_addr_lo =
+                                               U64_LO(fp->tx_prods_mapping);
+               context->xstorm_st_context.statistics_data = (cl_id |
+                               XSTORM_ETH_ST_CONTEXT_STATISTICS_ENABLE);
                context->cstorm_st_context.sb_index_number =
                                                C_SB_ETH_TX_CQ_INDEX;
                context->cstorm_st_context.status_block_id = sb_id;
@@ -4533,10 +4723,6 @@ static void bnx2x_init_context(struct bnx2x *bp)
                        CDU_RSRVD_VALUE_TYPE_A(HW_CID(bp, i),
                                               CDU_REGION_NUMBER_XCM_AG,
                                               ETH_CONNECTION_TYPE);
-               context->ustorm_ag_context.cdu_usage =
-                       CDU_RSRVD_VALUE_TYPE_A(HW_CID(bp, i),
-                                              CDU_REGION_NUMBER_UCM_AG,
-                                              ETH_CONNECTION_TYPE);
        }
 }
 
@@ -4545,14 +4731,15 @@ static void bnx2x_init_ind_table(struct bnx2x *bp)
        int func = BP_FUNC(bp);
        int i;
 
-       if (!is_multi(bp))
+       if (bp->multi_mode == ETH_RSS_MODE_DISABLED)
                return;
 
-       DP(NETIF_MSG_IFUP, "Initializing indirection table\n");
+       DP(NETIF_MSG_IFUP,
+          "Initializing indirection table  multi_mode %d\n", bp->multi_mode);
        for (i = 0; i < TSTORM_INDIRECTION_TABLE_SIZE; i++)
                REG_WR8(bp, BAR_TSTRORM_INTMEM +
                        TSTORM_INDIRECTION_TABLE_OFFSET(func) + i,
-                       BP_CL_ID(bp) + (i % bp->num_queues));
+                       bp->fp->cl_id + (i % bp->num_rx_queues));
 }
 
 static void bnx2x_set_client_config(struct bnx2x *bp)
@@ -4562,13 +4749,13 @@ static void bnx2x_set_client_config(struct bnx2x *bp)
        int i;
 
        tstorm_client.mtu = bp->dev->mtu;
-       tstorm_client.statistics_counter_id = BP_CL_ID(bp);
        tstorm_client.config_flags =
-                               TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE;
+                               (TSTORM_ETH_CLIENT_CONFIG_STATSITICS_ENABLE |
+                                TSTORM_ETH_CLIENT_CONFIG_E1HOV_REM_ENABLE);
 #ifdef BCM_VLAN
        if (bp->rx_mode && bp->vlgrp && (bp->flags & HW_VLAN_RX_FLAG)) {
                tstorm_client.config_flags |=
-                               TSTORM_ETH_CLIENT_CONFIG_VLAN_REMOVAL_ENABLE;
+                               TSTORM_ETH_CLIENT_CONFIG_VLAN_REM_ENABLE;
                DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
        }
 #endif
@@ -4586,6 +4773,8 @@ static void bnx2x_set_client_config(struct bnx2x *bp)
        }
 
        for_each_queue(bp, i) {
+               tstorm_client.statistics_counter_id = bp->fp[i].cl_id;
+
                REG_WR(bp, BAR_TSTRORM_INTMEM +
                       TSTORM_CLIENT_CONFIG_OFFSET(port, bp->fp[i].cl_id),
                       ((u32 *)&tstorm_client)[0]);
@@ -4614,18 +4803,22 @@ static void bnx2x_set_storm_rx_mode(struct bnx2x *bp)
                tstorm_mac_filter.mcast_drop_all = mask;
                tstorm_mac_filter.bcast_drop_all = mask;
                break;
+
        case BNX2X_RX_MODE_NORMAL:
                tstorm_mac_filter.bcast_accept_all = mask;
                break;
+
        case BNX2X_RX_MODE_ALLMULTI:
                tstorm_mac_filter.mcast_accept_all = mask;
                tstorm_mac_filter.bcast_accept_all = mask;
                break;
+
        case BNX2X_RX_MODE_PROMISC:
                tstorm_mac_filter.ucast_accept_all = mask;
                tstorm_mac_filter.mcast_accept_all = mask;
                tstorm_mac_filter.bcast_accept_all = mask;
                break;
+
        default:
                BNX2X_ERR("BAD rx mode (%d)\n", mode);
                break;
@@ -4676,19 +4869,64 @@ static void bnx2x_init_internal_port(struct bnx2x *bp)
        REG_WR(bp, BAR_XSTRORM_INTMEM + XSTORM_HC_BTR_OFFSET(port), BNX2X_BTR);
 }
 
+/* Calculates the sum of vn_min_rates.
+   It's needed for further normalizing of the min_rates.
+   Returns:
+     sum of vn_min_rates.
+       or
+     0 - if all the min_rates are 0.
+     In the later case fainess algorithm should be deactivated.
+     If not all min_rates are zero then those that are zeroes will be set to 1.
+ */
+static void bnx2x_calc_vn_weight_sum(struct bnx2x *bp)
+{
+       int all_zero = 1;
+       int port = BP_PORT(bp);
+       int vn;
+
+       bp->vn_weight_sum = 0;
+       for (vn = VN_0; vn < E1HVN_MAX; vn++) {
+               int func = 2*vn + port;
+               u32 vn_cfg =
+                       SHMEM_RD(bp, mf_cfg.func_mf_config[func].config);
+               u32 vn_min_rate = ((vn_cfg & FUNC_MF_CFG_MIN_BW_MASK) >>
+                                  FUNC_MF_CFG_MIN_BW_SHIFT) * 100;
+
+               /* Skip hidden vns */
+               if (vn_cfg & FUNC_MF_CFG_FUNC_HIDE)
+                       continue;
+
+               /* If min rate is zero - set it to 1 */
+               if (!vn_min_rate)
+                       vn_min_rate = DEF_MIN_RATE;
+               else
+                       all_zero = 0;
+
+               bp->vn_weight_sum += vn_min_rate;
+       }
+
+       /* ... only if all min rates are zeros - disable fairness */
+       if (all_zero)
+               bp->vn_weight_sum = 0;
+}
+
 static void bnx2x_init_internal_func(struct bnx2x *bp)
 {
        struct tstorm_eth_function_common_config tstorm_config = {0};
        struct stats_indication_flags stats_flags = {0};
        int port = BP_PORT(bp);
        int func = BP_FUNC(bp);
-       int i;
+       int i, j;
+       u32 offset;
        u16 max_agg_size;
 
        if (is_multi(bp)) {
-               tstorm_config.config_flags = MULTI_FLAGS;
+               tstorm_config.config_flags = MULTI_FLAGS(bp);
                tstorm_config.rss_result_mask = MULTI_MASK;
        }
+       if (IS_E1HMF(bp))
+               tstorm_config.config_flags |=
+                               TSTORM_ETH_FUNCTION_COMMON_CONFIG_E1HOV_IN_CAM;
 
        tstorm_config.leading_client_id = BP_L_ID(bp);
 
@@ -4699,17 +4937,29 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
        bp->rx_mode = BNX2X_RX_MODE_NONE; /* no rx until link is up */
        bnx2x_set_storm_rx_mode(bp);
 
-       /* reset xstorm per client statistics */
-       for (i = 0; i < sizeof(struct xstorm_per_client_stats) / 4; i++) {
-               REG_WR(bp, BAR_XSTRORM_INTMEM +
-                      XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, BP_CL_ID(bp)) +
-                      i*4, 0);
-       }
-       /* reset tstorm per client statistics */
-       for (i = 0; i < sizeof(struct tstorm_per_client_stats) / 4; i++) {
-               REG_WR(bp, BAR_TSTRORM_INTMEM +
-                      TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, BP_CL_ID(bp)) +
-                      i*4, 0);
+       for_each_queue(bp, i) {
+               u8 cl_id = bp->fp[i].cl_id;
+
+               /* reset xstorm per client statistics */
+               offset = BAR_XSTRORM_INTMEM +
+                        XSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cl_id);
+               for (j = 0;
+                    j < sizeof(struct xstorm_per_client_stats) / 4; j++)
+                       REG_WR(bp, offset + j*4, 0);
+
+               /* reset tstorm per client statistics */
+               offset = BAR_TSTRORM_INTMEM +
+                        TSTORM_PER_COUNTER_ID_STATS_OFFSET(port, cl_id);
+               for (j = 0;
+                    j < sizeof(struct tstorm_per_client_stats) / 4; j++)
+                       REG_WR(bp, offset + j*4, 0);
+
+               /* reset ustorm per client statistics */
+               offset = BAR_USTRORM_INTMEM +
+                        USTORM_PER_COUNTER_ID_STATS_OFFSET(port, cl_id);
+               for (j = 0;
+                    j < sizeof(struct ustorm_per_client_stats) / 4; j++)
+                       REG_WR(bp, offset + j*4, 0);
        }
 
        /* Init statistics related context */
@@ -4725,6 +4975,11 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
        REG_WR(bp, BAR_TSTRORM_INTMEM + TSTORM_STATS_FLAGS_OFFSET(func) + 4,
               ((u32 *)&stats_flags)[1]);
 
+       REG_WR(bp, BAR_USTRORM_INTMEM + USTORM_STATS_FLAGS_OFFSET(func),
+              ((u32 *)&stats_flags)[0]);
+       REG_WR(bp, BAR_USTRORM_INTMEM + USTORM_STATS_FLAGS_OFFSET(func) + 4,
+              ((u32 *)&stats_flags)[1]);
+
        REG_WR(bp, BAR_CSTRORM_INTMEM + CSTORM_STATS_FLAGS_OFFSET(func),
               ((u32 *)&stats_flags)[0]);
        REG_WR(bp, BAR_CSTRORM_INTMEM + CSTORM_STATS_FLAGS_OFFSET(func) + 4,
@@ -4744,6 +4999,13 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
               TSTORM_ETH_STATS_QUERY_ADDR_OFFSET(func) + 4,
               U64_HI(bnx2x_sp_mapping(bp, fw_stats)));
 
+       REG_WR(bp, BAR_USTRORM_INTMEM +
+              USTORM_ETH_STATS_QUERY_ADDR_OFFSET(func),
+              U64_LO(bnx2x_sp_mapping(bp, fw_stats)));
+       REG_WR(bp, BAR_USTRORM_INTMEM +
+              USTORM_ETH_STATS_QUERY_ADDR_OFFSET(func) + 4,
+              U64_HI(bnx2x_sp_mapping(bp, fw_stats)));
+
        if (CHIP_IS_E1H(bp)) {
                REG_WR8(bp, BAR_XSTRORM_INTMEM + XSTORM_FUNCTION_MODE_OFFSET,
                        IS_E1HMF(bp));
@@ -4763,20 +5025,91 @@ static void bnx2x_init_internal_func(struct bnx2x *bp)
                min((u32)(min((u32)8, (u32)MAX_SKB_FRAGS) *
                          SGE_PAGE_SIZE * PAGES_PER_SGE),
                    (u32)0xffff);
-       for_each_queue(bp, i) {
+       for_each_rx_queue(bp, i) {
                struct bnx2x_fastpath *fp = &bp->fp[i];
 
                REG_WR(bp, BAR_USTRORM_INTMEM +
-                      USTORM_CQE_PAGE_BASE_OFFSET(port, FP_CL_ID(fp)),
+                      USTORM_CQE_PAGE_BASE_OFFSET(port, fp->cl_id),
                       U64_LO(fp->rx_comp_mapping));
                REG_WR(bp, BAR_USTRORM_INTMEM +
-                      USTORM_CQE_PAGE_BASE_OFFSET(port, FP_CL_ID(fp)) + 4,
+                      USTORM_CQE_PAGE_BASE_OFFSET(port, fp->cl_id) + 4,
                       U64_HI(fp->rx_comp_mapping));
 
                REG_WR16(bp, BAR_USTRORM_INTMEM +
-                        USTORM_MAX_AGG_SIZE_OFFSET(port, FP_CL_ID(fp)),
+                        USTORM_MAX_AGG_SIZE_OFFSET(port, fp->cl_id),
                         max_agg_size);
        }
+
+       /* dropless flow control */
+       if (CHIP_IS_E1H(bp)) {
+               struct ustorm_eth_rx_pause_data_e1h rx_pause = {0};
+
+               rx_pause.bd_thr_low = 250;
+               rx_pause.cqe_thr_low = 250;
+               rx_pause.cos = 1;
+               rx_pause.sge_thr_low = 0;
+               rx_pause.bd_thr_high = 350;
+               rx_pause.cqe_thr_high = 350;
+               rx_pause.sge_thr_high = 0;
+
+               for_each_rx_queue(bp, i) {
+                       struct bnx2x_fastpath *fp = &bp->fp[i];
+
+                       if (!fp->disable_tpa) {
+                               rx_pause.sge_thr_low = 150;
+                               rx_pause.sge_thr_high = 250;
+                       }
+
+
+                       offset = BAR_USTRORM_INTMEM +
+                                USTORM_ETH_RING_PAUSE_DATA_OFFSET(port,
+                                                                  fp->cl_id);
+                       for (j = 0;
+                            j < sizeof(struct ustorm_eth_rx_pause_data_e1h)/4;
+                            j++)
+                               REG_WR(bp, offset + j*4,
+                                      ((u32 *)&rx_pause)[j]);
+               }
+       }
+
+       memset(&(bp->cmng), 0, sizeof(struct cmng_struct_per_port));
+
+       /* Init rate shaping and fairness contexts */
+       if (IS_E1HMF(bp)) {
+               int vn;
+
+               /* During init there is no active link
+                  Until link is up, set link rate to 10Gbps */
+               bp->link_vars.line_speed = SPEED_10000;
+               bnx2x_init_port_minmax(bp);
+
+               bnx2x_calc_vn_weight_sum(bp);
+
+               for (vn = VN_0; vn < E1HVN_MAX; vn++)
+                       bnx2x_init_vn_minmax(bp, 2*vn + port);
+
+               /* Enable rate shaping and fairness */
+               bp->cmng.flags.cmng_enables =
+                                       CMNG_FLAGS_PER_PORT_RATE_SHAPING_VN;
+               if (bp->vn_weight_sum)
+                       bp->cmng.flags.cmng_enables |=
+                                       CMNG_FLAGS_PER_PORT_FAIRNESS_VN;
+               else
+                       DP(NETIF_MSG_IFUP, "All MIN values are zeroes"
+                          "  fairness will be disabled\n");
+       } else {
+               /* rate shaping and fairness are disabled */
+               DP(NETIF_MSG_IFUP,
+                  "single function mode  minmax will be disabled\n");
+       }
+
+
+       /* Store it to internal memory */
+       if (bp->port.pmf)
+               for (i = 0; i < sizeof(struct cmng_struct_per_port) / 4; i++)
+                       REG_WR(bp, BAR_XSTRORM_INTMEM +
+                              XSTORM_CMNG_PER_PORT_VARS_OFFSET(port) + i * 4,
+                              ((u32 *)(&bp->cmng))[i]);
 }
 
 static void bnx2x_init_internal(struct bnx2x *bp, u32 load_code)
@@ -4813,10 +5146,10 @@ static void bnx2x_nic_init(struct bnx2x *bp, u32 load_code)
                fp->cl_id = BP_L_ID(bp) + i;
                fp->sb_id = fp->cl_id;
                DP(NETIF_MSG_IFUP,
-                  "bnx2x_init_sb(%p,%p) index %d  cl_id %d  sb %d\n",
-                  bp, fp->status_blk, i, FP_CL_ID(fp), FP_SB_ID(fp));
+                  "queue[%d]:  bnx2x_init_sb(%p,%p)  cl_id %d  sb %d\n",
+                  i, bp, fp->status_blk, fp->cl_id, fp->sb_id);
                bnx2x_init_sb(bp, fp->status_blk, fp->status_blk_mapping,
-                             FP_SB_ID(fp));
+                             fp->sb_id);
                bnx2x_update_fpsb_idx(fp);
        }
 
@@ -5197,6 +5530,8 @@ static int bnx2x_init_common(struct bnx2x *bp)
        REG_WR(bp, PXP2_REG_RQ_SRC_ENDIAN_M, 1);
        REG_WR(bp, PXP2_REG_RQ_CDU_ENDIAN_M, 1);
        REG_WR(bp, PXP2_REG_RQ_DBG_ENDIAN_M, 1);
+       /* make sure this value is 0 */
+       REG_WR(bp, PXP2_REG_RQ_HC_ENDIAN_M, 0);
 
 /*     REG_WR(bp, PXP2_REG_RD_PBF_SWAP_MODE, 1); */
        REG_WR(bp, PXP2_REG_RD_QM_SWAP_MODE, 1);
@@ -5265,14 +5600,6 @@ static int bnx2x_init_common(struct bnx2x *bp)
        }
 
        bnx2x_init_block(bp, BRB1_COMMON_START, BRB1_COMMON_END);
-       if (CHIP_REV_IS_SLOW(bp)) {
-               /* fix for emulation and FPGA for no pause */
-               REG_WR(bp, BRB1_REG_PAUSE_HIGH_THRESHOLD_0, 513);
-               REG_WR(bp, BRB1_REG_PAUSE_HIGH_THRESHOLD_1, 513);
-               REG_WR(bp, BRB1_REG_PAUSE_LOW_THRESHOLD_0, 0);
-               REG_WR(bp, BRB1_REG_PAUSE_LOW_THRESHOLD_1, 0);
-       }
-
        bnx2x_init_block(bp, PRS_COMMON_START, PRS_COMMON_END);
        REG_WR(bp, PRS_REG_A_PRSU_20, 0xf);
        /* set NIC mode */
@@ -5337,8 +5664,7 @@ static int bnx2x_init_common(struct bnx2x *bp)
                REG_WR(bp, i, 0xc0cac01a);
                /* TODO: replace with something meaningful */
        }
-       if (CHIP_IS_E1H(bp))
-               bnx2x_init_block(bp, SRCH_COMMON_START, SRCH_COMMON_END);
+       bnx2x_init_block(bp, SRCH_COMMON_START, SRCH_COMMON_END);
        REG_WR(bp, SRC_REG_SOFT_RST, 0);
 
        if (sizeof(union cdu_context) != 1024)
@@ -5357,6 +5683,11 @@ static int bnx2x_init_common(struct bnx2x *bp)
 
        bnx2x_init_block(bp, CFC_COMMON_START, CFC_COMMON_END);
        REG_WR(bp, CFC_REG_INIT_REG, 0x7FF);
+       /* enable context validation interrupt from CFC */
+       REG_WR(bp, CFC_REG_CFC_INT_MASK, 0);
+
+       /* set the thresholds to prevent CFC/CDU race */
+       REG_WR(bp, CFC_REG_DEBUG0, 0x20020000);
 
        bnx2x_init_block(bp, HC_COMMON_START, HC_COMMON_END);
        bnx2x_init_block(bp, MISC_AEU_COMMON_START, MISC_AEU_COMMON_END);
@@ -5409,9 +5740,14 @@ static int bnx2x_init_common(struct bnx2x *bp)
                return -EBUSY;
        }
 
-       switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
-       case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
-       case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
+       switch (XGXS_EXT_PHY_TYPE(bp->link_params.ext_phy_config)) {
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+               bp->port.need_hw_lock = 1;
+               break;
+
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
                /* Fan failure is indicated by SPIO 5 */
                bnx2x_set_spio(bp, MISC_REGISTERS_SPIO_5,
                               MISC_REGISTERS_SPIO_INPUT_HI_Z);
@@ -5450,6 +5786,7 @@ static int bnx2x_init_common(struct bnx2x *bp)
 static int bnx2x_init_port(struct bnx2x *bp)
 {
        int port = BP_PORT(bp);
+       u32 low, high;
        u32 val;
 
        DP(BNX2X_MSG_MCP, "starting port init  port %x\n", port);
@@ -5484,6 +5821,8 @@ static int bnx2x_init_port(struct bnx2x *bp)
        REG_WR(bp, PXP2_REG_PSWRQ_SRC0_L2P + func*4, PXP_ONE_ILT(i));
 #endif
        /* Port CMs come here */
+       bnx2x_init_block(bp, (port ? XCM_PORT1_START : XCM_PORT0_START),
+                            (port ? XCM_PORT1_END : XCM_PORT0_END));
 
        /* Port QM comes here */
 #ifdef BCM_ISCSI
@@ -5494,12 +5833,38 @@ static int bnx2x_init_port(struct bnx2x *bp)
                             func ? TIMERS_PORT1_END : TIMERS_PORT0_END);
 #endif
        /* Port DQ comes here */
-       /* Port BRB1 comes here */
+
+       bnx2x_init_block(bp, (port ? BRB1_PORT1_START : BRB1_PORT0_START),
+                            (port ? BRB1_PORT1_END : BRB1_PORT0_END));
+       if (CHIP_REV_IS_SLOW(bp) && !CHIP_IS_E1H(bp)) {
+               /* no pause for emulation and FPGA */
+               low = 0;
+               high = 513;
+       } else {
+               if (IS_E1HMF(bp))
+                       low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246);
+               else if (bp->dev->mtu > 4096) {
+                       if (bp->flags & ONE_PORT_FLAG)
+                               low = 160;
+                       else {
+                               val = bp->dev->mtu;
+                               /* (24*1024 + val*4)/256 */
+                               low = 96 + (val/64) + ((val % 64) ? 1 : 0);
+                       }
+               } else
+                       low = ((bp->flags & ONE_PORT_FLAG) ? 80 : 160);
+               high = low + 56;        /* 14*1024/256 */
+       }
+       REG_WR(bp, BRB1_REG_PAUSE_LOW_THRESHOLD_0 + port*4, low);
+       REG_WR(bp, BRB1_REG_PAUSE_HIGH_THRESHOLD_0 + port*4, high);
+
+
        /* Port PRS comes here */
        /* Port TSDM comes here */
        /* Port CSDM comes here */
        /* Port USDM comes here */
        /* Port XSDM comes here */
+
        bnx2x_init_block(bp, port ? TSEM_PORT1_START : TSEM_PORT0_START,
                             port ? TSEM_PORT1_END : TSEM_PORT0_END);
        bnx2x_init_block(bp, port ? USEM_PORT1_START : USEM_PORT0_START,
@@ -5508,6 +5873,7 @@ static int bnx2x_init_port(struct bnx2x *bp)
                             port ? CSEM_PORT1_END : CSEM_PORT0_END);
        bnx2x_init_block(bp, port ? XSEM_PORT1_START : XSEM_PORT0_START,
                             port ? XSEM_PORT1_END : XSEM_PORT0_END);
+
        /* Port UPB comes here */
        /* Port XPB comes here */
 
@@ -5566,36 +5932,63 @@ static int bnx2x_init_port(struct bnx2x *bp)
        /* Port EMAC1 comes here */
        /* Port DBU comes here */
        /* Port DBG comes here */
+
        bnx2x_init_block(bp, port ? NIG_PORT1_START : NIG_PORT0_START,
                             port ? NIG_PORT1_END : NIG_PORT0_END);
 
        REG_WR(bp, NIG_REG_XGXS_SERDES0_MODE_SEL + port*4, 1);
 
        if (CHIP_IS_E1H(bp)) {
-               u32 wsum;
-               struct cmng_struct_per_port m_cmng_port;
-               int vn;
-
                /* 0x2 disable e1hov, 0x1 enable */
                REG_WR(bp, NIG_REG_LLH0_BRB1_DRV_MASK_MF + port*4,
                       (IS_E1HMF(bp) ? 0x1 : 0x2));
 
-               /* Init RATE SHAPING and FAIRNESS contexts.
-                  Initialize as if there is 10G link. */
-               wsum = bnx2x_calc_vn_wsum(bp);
-               bnx2x_init_port_minmax(bp, (int)wsum, 10000, &m_cmng_port);
-               if (IS_E1HMF(bp))
-                       for (vn = VN_0; vn < E1HVN_MAX; vn++)
-                               bnx2x_init_vn_minmax(bp, 2*vn + port,
-                                       wsum, 10000, &m_cmng_port);
+               /* support pause requests from USDM, TSDM and BRB */
+               REG_WR(bp, NIG_REG_LLFC_EGRESS_SRC_ENABLE_0 + port*4, 0x7);
+
+               {
+                       REG_WR(bp, NIG_REG_LLFC_ENABLE_0 + port*4, 0);
+                       REG_WR(bp, NIG_REG_LLFC_OUT_EN_0 + port*4, 0);
+                       REG_WR(bp, NIG_REG_PAUSE_ENABLE_0 + port*4, 1);
+               }
        }
 
        /* Port MCP comes here */
        /* Port DMAE comes here */
 
-       switch (bp->common.board & SHARED_HW_CFG_BOARD_TYPE_MASK) {
-       case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1021G:
-       case SHARED_HW_CFG_BOARD_TYPE_BCM957710A1022G:
+       switch (XGXS_EXT_PHY_TYPE(bp->link_params.ext_phy_config)) {
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+               {
+               u32 swap_val, swap_override, aeu_gpio_mask, offset;
+
+               bnx2x_set_gpio(bp, MISC_REGISTERS_GPIO_3,
+                              MISC_REGISTERS_GPIO_INPUT_HI_Z, port);
+
+               /* The GPIO should be swapped if the swap register is
+                  set and active */
+               swap_val = REG_RD(bp, NIG_REG_PORT_SWAP);
+               swap_override = REG_RD(bp, NIG_REG_STRAP_OVERRIDE);
+
+               /* Select function upon port-swap configuration */
+               if (port == 0) {
+                       offset = MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0;
+                       aeu_gpio_mask = (swap_val && swap_override) ?
+                               AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_1 :
+                               AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_0;
+               } else {
+                       offset = MISC_REG_AEU_ENABLE1_FUNC_1_OUT_0;
+                       aeu_gpio_mask = (swap_val && swap_override) ?
+                               AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_0 :
+                               AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_1;
+               }
+               val = REG_RD(bp, offset);
+               /* add GPIO3 to group */
+               val |= aeu_gpio_mask;
+               REG_WR(bp, offset, val);
+               }
+               break;
+
+       case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
                /* add SPIO 5 to group 0 */
                val = REG_RD(bp, MISC_REG_AEU_ENABLE1_FUNC_0_OUT_0);
                val |= AEU_INPUTS_ATTN_BITS_SPIO5;
@@ -5641,10 +6034,17 @@ static int bnx2x_init_func(struct bnx2x *bp)
 {
        int port = BP_PORT(bp);
        int func = BP_FUNC(bp);
+       u32 addr, val;
        int i;
 
        DP(BNX2X_MSG_MCP, "starting func init  func %x\n", func);
 
+       /* set MSI reconfigure capability */
+       addr = (port ? HC_REG_CONFIG_1 : HC_REG_CONFIG_0);
+       val = REG_RD(bp, addr);
+       val |= HC_CONFIG_0_REG_MSI_ATTN_EN_0;
+       REG_WR(bp, addr, val);
+
        i = FUNC_ILT_BASE(func);
 
        bnx2x_ilt_wr(bp, i, bnx2x_sp_mapping(bp, context));
@@ -5674,9 +6074,6 @@ static int bnx2x_init_func(struct bnx2x *bp)
        }
        bnx2x_init_block(bp, hc_limits[func][0], hc_limits[func][1]);
 
-       if (CHIP_IS_E1H(bp))
-               REG_WR(bp, HC_REG_FUNC_NUM_P0 + port*4, func);
-
        /* Reset PCIE errors for debug */
        REG_WR(bp, 0x2114, 0xffffffff);
        REG_WR(bp, 0x2120, 0xffffffff);
@@ -5805,20 +6202,19 @@ static void bnx2x_free_mem(struct bnx2x *bp)
        int i;
 
        /* fastpath */
+       /* Common */
        for_each_queue(bp, i) {
 
-               /* Status blocks */
+               /* status blocks */
                BNX2X_PCI_FREE(bnx2x_fp(bp, i, status_blk),
                               bnx2x_fp(bp, i, status_blk_mapping),
                               sizeof(struct host_status_block) +
                               sizeof(struct eth_tx_db_data));
+       }
+       /* Rx */
+       for_each_rx_queue(bp, i) {
 
-               /* fast path rings: tx_buf tx_desc rx_buf rx_desc rx_comp */
-               BNX2X_FREE(bnx2x_fp(bp, i, tx_buf_ring));
-               BNX2X_PCI_FREE(bnx2x_fp(bp, i, tx_desc_ring),
-                              bnx2x_fp(bp, i, tx_desc_mapping),
-                              sizeof(struct eth_tx_bd) * NUM_TX_BD);
-
+               /* fastpath rx rings: rx_buf rx_desc rx_comp */
                BNX2X_FREE(bnx2x_fp(bp, i, rx_buf_ring));
                BNX2X_PCI_FREE(bnx2x_fp(bp, i, rx_desc_ring),
                               bnx2x_fp(bp, i, rx_desc_mapping),
@@ -5835,6 +6231,15 @@ static void bnx2x_free_mem(struct bnx2x *bp)
                               bnx2x_fp(bp, i, rx_sge_mapping),
                               BCM_PAGE_SIZE * NUM_RX_SGE_PAGES);
        }
+       /* Tx */
+       for_each_tx_queue(bp, i) {
+
+               /* fastpath tx rings: tx_buf tx_desc */
+               BNX2X_FREE(bnx2x_fp(bp, i, tx_buf_ring));
+               BNX2X_PCI_FREE(bnx2x_fp(bp, i, tx_desc_ring),
+                              bnx2x_fp(bp, i, tx_desc_mapping),
+                              sizeof(struct eth_tx_bd) * NUM_TX_BD);
+       }
        /* end of fastpath */
 
        BNX2X_PCI_FREE(bp->def_status_blk, bp->def_status_blk_mapping,
@@ -5877,29 +6282,20 @@ static int bnx2x_alloc_mem(struct bnx2x *bp)
        int i;
 
        /* fastpath */
+       /* Common */
        for_each_queue(bp, i) {
                bnx2x_fp(bp, i, bp) = bp;
 
-               /* Status blocks */
+               /* status blocks */
                BNX2X_PCI_ALLOC(bnx2x_fp(bp, i, status_blk),
                                &bnx2x_fp(bp, i, status_blk_mapping),
                                sizeof(struct host_status_block) +
                                sizeof(struct eth_tx_db_data));
+       }
+       /* Rx */
+       for_each_rx_queue(bp, i) {
 
-               bnx2x_fp(bp, i, hw_tx_prods) =
-                               (void *)(bnx2x_fp(bp, i, status_blk) + 1);
-
-               bnx2x_fp(bp, i, tx_prods_mapping) =
-                               bnx2x_fp(bp, i, status_blk_mapping) +
-                               sizeof(struct host_status_block);
-
-               /* fast path rings: tx_buf tx_desc rx_buf rx_desc rx_comp */
-               BNX2X_ALLOC(bnx2x_fp(bp, i, tx_buf_ring),
-                               sizeof(struct sw_tx_bd) * NUM_TX_BD);
-               BNX2X_PCI_ALLOC(bnx2x_fp(bp, i, tx_desc_ring),
-                               &bnx2x_fp(bp, i, tx_desc_mapping),
-                               sizeof(struct eth_tx_bd) * NUM_TX_BD);
-
+               /* fastpath rx rings: rx_buf rx_desc rx_comp */
                BNX2X_ALLOC(bnx2x_fp(bp, i, rx_buf_ring),
                                sizeof(struct sw_rx_bd) * NUM_RX_BD);
                BNX2X_PCI_ALLOC(bnx2x_fp(bp, i, rx_desc_ring),
@@ -5918,6 +6314,23 @@ static int bnx2x_alloc_mem(struct bnx2x *bp)
                                &bnx2x_fp(bp, i, rx_sge_mapping),
                                BCM_PAGE_SIZE * NUM_RX_SGE_PAGES);
        }
+       /* Tx */
+       for_each_tx_queue(bp, i) {
+
+               bnx2x_fp(bp, i, hw_tx_prods) =
+                               (void *)(bnx2x_fp(bp, i, status_blk) + 1);
+
+               bnx2x_fp(bp, i, tx_prods_mapping) =
+                               bnx2x_fp(bp, i, status_blk_mapping) +
+                               sizeof(struct host_status_block);
+
+               /* fastpath tx rings: tx_buf tx_desc */
+               BNX2X_ALLOC(bnx2x_fp(bp, i, tx_buf_ring),
+                               sizeof(struct sw_tx_bd) * NUM_TX_BD);
+               BNX2X_PCI_ALLOC(bnx2x_fp(bp, i, tx_desc_ring),
+                               &bnx2x_fp(bp, i, tx_desc_mapping),
+                               sizeof(struct eth_tx_bd) * NUM_TX_BD);
+       }
        /* end of fastpath */
 
        BNX2X_PCI_ALLOC(bp->def_status_blk, &bp->def_status_blk_mapping,
@@ -5971,7 +6384,7 @@ static void bnx2x_free_tx_skbs(struct bnx2x *bp)
 {
        int i;
 
-       for_each_queue(bp, i) {
+       for_each_tx_queue(bp, i) {
                struct bnx2x_fastpath *fp = &bp->fp[i];
 
                u16 bd_cons = fp->tx_bd_cons;
@@ -5989,7 +6402,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp)
 {
        int i, j;
 
-       for_each_queue(bp, j) {
+       for_each_rx_queue(bp, j) {
                struct bnx2x_fastpath *fp = &bp->fp[j];
 
                for (i = 0; i < NUM_RX_BD; i++) {
@@ -6001,8 +6414,7 @@ static void bnx2x_free_rx_skbs(struct bnx2x *bp)
 
                        pci_unmap_single(bp->pdev,
                                         pci_unmap_addr(rx_buf, mapping),
-                                        bp->rx_buf_size,
-                                        PCI_DMA_FROMDEVICE);
+                                        bp->rx_buf_size, PCI_DMA_FROMDEVICE);
 
                        rx_buf->skb = NULL;
                        dev_kfree_skb(skb);
@@ -6033,10 +6445,6 @@ static void bnx2x_free_msix_irqs(struct bnx2x *bp)
                   "state %x\n", i, bp->msix_table[i + offset].vector,
                   bnx2x_fp(bp, i, state));
 
-               if (bnx2x_fp(bp, i, state) != BNX2X_FP_STATE_CLOSED)
-                       BNX2X_ERR("IRQ of fp #%d being freed while "
-                                 "state != closed\n", i);
-
                free_irq(bp->msix_table[i + offset].vector, &bp->fp[i]);
        }
 }
@@ -6048,32 +6456,37 @@ static void bnx2x_free_irq(struct bnx2x *bp)
                pci_disable_msix(bp->pdev);
                bp->flags &= ~USING_MSIX_FLAG;
 
+       } else if (bp->flags & USING_MSI_FLAG) {
+               free_irq(bp->pdev->irq, bp->dev);
+               pci_disable_msi(bp->pdev);
+               bp->flags &= ~USING_MSI_FLAG;
+
        } else
                free_irq(bp->pdev->irq, bp->dev);
 }
 
 static int bnx2x_enable_msix(struct bnx2x *bp)
 {
-       int i, rc, offset;
+       int i, rc, offset = 1;
+       int igu_vec = 0;
 
-       bp->msix_table[0].entry = 0;
-       offset = 1;
-       DP(NETIF_MSG_IFUP, "msix_table[0].entry = 0 (slowpath)\n");
+       bp->msix_table[0].entry = igu_vec;
+       DP(NETIF_MSG_IFUP, "msix_table[0].entry = %d (slowpath)\n", igu_vec);
 
        for_each_queue(bp, i) {
-               int igu_vec = offset + i + BP_L_ID(bp);
-
+               igu_vec = BP_L_ID(bp) + offset + i;
                bp->msix_table[i + offset].entry = igu_vec;
                DP(NETIF_MSG_IFUP, "msix_table[%d].entry = %d "
                   "(fastpath #%u)\n", i + offset, igu_vec, i);
        }
 
        rc = pci_enable_msix(bp->pdev, &bp->msix_table[0],
-                            bp->num_queues + offset);
+                            BNX2X_NUM_QUEUES(bp) + offset);
        if (rc) {
-               DP(NETIF_MSG_IFUP, "MSI-X is not attainable\n");
-               return -1;
+               DP(NETIF_MSG_IFUP, "MSI-X is not attainable  rc %d\n", rc);
+               return rc;
        }
+
        bp->flags |= USING_MSIX_FLAG;
 
        return 0;
@@ -6091,27 +6504,60 @@ static int bnx2x_req_msix_irqs(struct bnx2x *bp)
        }
 
        for_each_queue(bp, i) {
+               struct bnx2x_fastpath *fp = &bp->fp[i];
+
+               sprintf(fp->name, "%s.fp%d", bp->dev->name, i);
                rc = request_irq(bp->msix_table[i + offset].vector,
-                                bnx2x_msix_fp_int, 0,
-                                bp->dev->name, &bp->fp[i]);
+                                bnx2x_msix_fp_int, 0, fp->name, fp);
                if (rc) {
-                       BNX2X_ERR("request fp #%d irq failed  rc -%d\n",
-                                 i + offset, -rc);
+                       BNX2X_ERR("request fp #%d irq failed  rc %d\n", i, rc);
                        bnx2x_free_msix_irqs(bp);
                        return -EBUSY;
                }
 
-               bnx2x_fp(bp, i, state) = BNX2X_FP_STATE_IRQ;
+               fp->state = BNX2X_FP_STATE_IRQ;
+       }
+
+       i = BNX2X_NUM_QUEUES(bp);
+       if (is_multi(bp))
+               printk(KERN_INFO PFX
+                      "%s: using MSI-X  IRQs: sp %d  fp %d - %d\n",
+                      bp->dev->name, bp->msix_table[0].vector,
+                      bp->msix_table[offset].vector,
+                      bp->msix_table[offset + i - 1].vector);
+       else
+               printk(KERN_INFO PFX "%s: using MSI-X  IRQs: sp %d  fp %d\n",
+                      bp->dev->name, bp->msix_table[0].vector,
+                      bp->msix_table[offset + i - 1].vector);
+
+       return 0;
+}
+
+static int bnx2x_enable_msi(struct bnx2x *bp)
+{
+       int rc;
+
+       rc = pci_enable_msi(bp->pdev);
+       if (rc) {
+               DP(NETIF_MSG_IFUP, "MSI is not attainable\n");
+               return -1;
        }
+       bp->flags |= USING_MSI_FLAG;
 
        return 0;
 }
 
 static int bnx2x_req_irq(struct bnx2x *bp)
 {
+       unsigned long flags;
        int rc;
 
-       rc = request_irq(bp->pdev->irq, bnx2x_interrupt, IRQF_SHARED,
+       if (bp->flags & USING_MSI_FLAG)
+               flags = 0;
+       else
+               flags = IRQF_SHARED;
+
+       rc = request_irq(bp->pdev->irq, bnx2x_interrupt, flags,
                         bp->dev->name, bp->dev);
        if (!rc)
                bnx2x_fp(bp, 0, state) = BNX2X_FP_STATE_IRQ;
@@ -6123,7 +6569,7 @@ static void bnx2x_napi_enable(struct bnx2x *bp)
 {
        int i;
 
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                napi_enable(&bnx2x_fp(bp, i, napi));
 }
 
@@ -6131,7 +6577,7 @@ static void bnx2x_napi_disable(struct bnx2x *bp)
 {
        int i;
 
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                napi_disable(&bnx2x_fp(bp, i, napi));
 }
 
@@ -6139,10 +6585,10 @@ static void bnx2x_netif_start(struct bnx2x *bp)
 {
        if (atomic_dec_and_test(&bp->intr_sem)) {
                if (netif_running(bp->dev)) {
-                       if (bp->state == BNX2X_STATE_OPEN)
-                               netif_wake_queue(bp->dev);
                        bnx2x_napi_enable(bp);
                        bnx2x_int_enable(bp);
+                       if (bp->state == BNX2X_STATE_OPEN)
+                               netif_tx_wake_all_queues(bp->dev);
                }
        }
 }
@@ -6170,9 +6616,9 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp, int set)
         * unicasts 0-31:port0 32-63:port1
         * multicast 64-127:port0 128-191:port1
         */
-       config->hdr.length_6b = 2;
+       config->hdr.length = 2;
        config->hdr.offset = port ? 32 : 0;
-       config->hdr.client_id = BP_CL_ID(bp);
+       config->hdr.client_id = bp->fp->cl_id;
        config->hdr.reserved1 = 0;
 
        /* primary MAC */
@@ -6197,9 +6643,9 @@ static void bnx2x_set_mac_addr_e1(struct bnx2x *bp, int set)
           config->config_table[0].cam_entry.lsb_mac_addr);
 
        /* broadcast */
-       config->config_table[1].cam_entry.msb_mac_addr = 0xffff;
-       config->config_table[1].cam_entry.middle_mac_addr = 0xffff;
-       config->config_table[1].cam_entry.lsb_mac_addr = 0xffff;
+       config->config_table[1].cam_entry.msb_mac_addr = cpu_to_le16(0xffff);
+       config->config_table[1].cam_entry.middle_mac_addr = cpu_to_le16(0xffff);
+       config->config_table[1].cam_entry.lsb_mac_addr = cpu_to_le16(0xffff);
        config->config_table[1].cam_entry.flags = cpu_to_le16(port);
        if (set)
                config->config_table[1].target_table_entry.flags =
@@ -6228,9 +6674,9 @@ static void bnx2x_set_mac_addr_e1h(struct bnx2x *bp, int set)
         * unicasts: by func number
         * multicast: 20+FUNC*20, 20 each
         */
-       config->hdr.length_6b = 1;
+       config->hdr.length = 1;
        config->hdr.offset = BP_FUNC(bp);
-       config->hdr.client_id = BP_CL_ID(bp);
+       config->hdr.client_id = bp->fp->cl_id;
        config->hdr.reserved1 = 0;
 
        /* primary MAC */
@@ -6264,7 +6710,7 @@ static int bnx2x_wait_ramrod(struct bnx2x *bp, int state, int idx,
                             int *state_p, int poll)
 {
        /* can take a while if any port is running */
-       int cnt = 500;
+       int cnt = 5000;
 
        DP(NETIF_MSG_IFUP, "%s for state to become %x on IDX [%d]\n",
           poll ? "polling" : "waiting", state, idx);
@@ -6282,8 +6728,12 @@ static int bnx2x_wait_ramrod(struct bnx2x *bp, int state, int idx,
                }
 
                mb(); /* state is changed by bnx2x_sp_event() */
-               if (*state_p == state)
+               if (*state_p == state) {
+#ifdef BNX2X_STOP_ON_ERROR
+                       DP(NETIF_MSG_IFUP, "exit  (cnt %d)\n", 5000 - cnt);
+#endif
                        return 0;
+               }
 
                msleep(1);
        }
@@ -6316,19 +6766,68 @@ static int bnx2x_setup_leading(struct bnx2x *bp)
 
 static int bnx2x_setup_multi(struct bnx2x *bp, int index)
 {
+       struct bnx2x_fastpath *fp = &bp->fp[index];
+
        /* reset IGU state */
-       bnx2x_ack_sb(bp, bp->fp[index].sb_id, CSTORM_ID, 0, IGU_INT_ENABLE, 0);
+       bnx2x_ack_sb(bp, fp->sb_id, CSTORM_ID, 0, IGU_INT_ENABLE, 0);
 
        /* SETUP ramrod */
-       bp->fp[index].state = BNX2X_FP_STATE_OPENING;
-       bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_CLIENT_SETUP, index, 0, index, 0);
+       fp->state = BNX2X_FP_STATE_OPENING;
+       bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_CLIENT_SETUP, index, 0,
+                     fp->cl_id, 0);
 
        /* Wait for completion */
        return bnx2x_wait_ramrod(bp, BNX2X_FP_STATE_OPEN, index,
-                                &(bp->fp[index].state), 0);
+                                &(fp->state), 0);
 }
 
 static int bnx2x_poll(struct napi_struct *napi, int budget);
+
+static void bnx2x_set_int_mode(struct bnx2x *bp)
+{
+       int num_queues;
+
+       switch (int_mode) {
+       case INT_MODE_INTx:
+       case INT_MODE_MSI:
+               num_queues = 1;
+               bp->num_rx_queues = num_queues;
+               bp->num_tx_queues = num_queues;
+               DP(NETIF_MSG_IFUP,
+                  "set number of queues to %d\n", num_queues);
+               break;
+
+       case INT_MODE_MSIX:
+       default:
+               if (bp->multi_mode == ETH_RSS_MODE_REGULAR)
+                       num_queues = min_t(u32, num_online_cpus(),
+                                          BNX2X_MAX_QUEUES(bp));
+               else
+                       num_queues = 1;
+               bp->num_rx_queues = num_queues;
+               bp->num_tx_queues = num_queues;
+               DP(NETIF_MSG_IFUP, "set number of rx queues to %d"
+                  "  number of tx queues to %d\n",
+                  bp->num_rx_queues, bp->num_tx_queues);
+               /* if we can't use MSI-X we only need one fp,
+                * so try to enable MSI-X with the requested number of fp's
+                * and fallback to MSI or legacy INTx with one fp
+                */
+               if (bnx2x_enable_msix(bp)) {
+                       /* failed to enable MSI-X */
+                       num_queues = 1;
+                       bp->num_rx_queues = num_queues;
+                       bp->num_tx_queues = num_queues;
+                       if (bp->multi_mode)
+                               BNX2X_ERR("Multi requested but failed to "
+                                         "enable MSI-X  set number of "
+                                         "queues to %d\n", num_queues);
+               }
+               break;
+       }
+       bp->dev->real_num_tx_queues = bp->num_tx_queues;
+}
+
 static void bnx2x_set_rx_mode(struct net_device *dev);
 
 /* must be called with rtnl_lock */
@@ -6337,56 +6836,28 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
        u32 load_code;
        int i, rc = 0;
 #ifdef BNX2X_STOP_ON_ERROR
+       DP(NETIF_MSG_IFUP, "enter  load_mode %d\n", load_mode);
        if (unlikely(bp->panic))
                return -EPERM;
 #endif
 
        bp->state = BNX2X_STATE_OPENING_WAIT4_LOAD;
 
-       if (use_inta) {
-               bp->num_queues = 1;
-
-       } else {
-               if ((use_multi > 1) && (use_multi <= BP_MAX_QUEUES(bp)))
-                       /* user requested number */
-                       bp->num_queues = use_multi;
-
-               else if (use_multi)
-                       bp->num_queues = min_t(u32, num_online_cpus(),
-                                              BP_MAX_QUEUES(bp));
-               else
-                       bp->num_queues = 1;
-
-               DP(NETIF_MSG_IFUP,
-                  "set number of queues to %d\n", bp->num_queues);
-
-               /* if we can't use MSI-X we only need one fp,
-                * so try to enable MSI-X with the requested number of fp's
-                * and fallback to MSI or legacy INTx with one fp
-                */
-               rc = bnx2x_enable_msix(bp);
-               if (rc) {
-                       /* failed to enable MSI-X */
-                       bp->num_queues = 1;
-                       if (use_multi)
-                               BNX2X_ERR("Multi requested but failed"
-                                         " to enable MSI-X\n");
-               }
-       }
+       bnx2x_set_int_mode(bp);
 
        if (bnx2x_alloc_mem(bp))
                return -ENOMEM;
 
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                bnx2x_fp(bp, i, disable_tpa) =
                                        ((bp->flags & TPA_ENABLE_FLAG) == 0);
 
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                netif_napi_add(bp->dev, &bnx2x_fp(bp, i, napi),
                               bnx2x_poll, 128);
 
 #ifdef BNX2X_STOP_ON_ERROR
-       for_each_queue(bp, i) {
+       for_each_rx_queue(bp, i) {
                struct bnx2x_fastpath *fp = &bp->fp[i];
 
                fp->poll_no_work = 0;
@@ -6404,14 +6875,22 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
                        pci_disable_msix(bp->pdev);
                        goto load_error1;
                }
-               printk(KERN_INFO PFX "%s: using MSI-X\n", bp->dev->name);
        } else {
+               if ((rc != -ENOMEM) && (int_mode != INT_MODE_INTx))
+                       bnx2x_enable_msi(bp);
                bnx2x_ack_int(bp);
                rc = bnx2x_req_irq(bp);
                if (rc) {
                        BNX2X_ERR("IRQ request failed  rc %d, aborting\n", rc);
+                       if (bp->flags & USING_MSI_FLAG)
+                               pci_disable_msi(bp->pdev);
                        goto load_error1;
                }
+               if (bp->flags & USING_MSI_FLAG) {
+                       bp->dev->irq = bp->pdev->irq;
+                       printk(KERN_INFO PFX "%s: using MSI  IRQ %d\n",
+                              bp->dev->name, bp->pdev->irq);
+               }
        }
 
        /* Send LOAD_REQUEST command to MCP
@@ -6434,11 +6913,11 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
        } else {
                int port = BP_PORT(bp);
 
-               DP(NETIF_MSG_IFUP, "NO MCP load counts before us %d, %d, %d\n",
+               DP(NETIF_MSG_IFUP, "NO MCP - load counts      %d, %d, %d\n",
                   load_count[0], load_count[1], load_count[2]);
                load_count[0]++;
                load_count[1 + port]++;
-               DP(NETIF_MSG_IFUP, "NO MCP new load counts       %d, %d, %d\n",
+               DP(NETIF_MSG_IFUP, "NO MCP - new load counts  %d, %d, %d\n",
                   load_count[0], load_count[1], load_count[2]);
                if (load_count[0] == 1)
                        load_code = FW_MSG_CODE_DRV_LOAD_COMMON;
@@ -6485,7 +6964,7 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
 
        if (CHIP_IS_E1H(bp))
                if (bp->mf_config & FUNC_MF_CFG_FUNC_DISABLED) {
-                       BNX2X_ERR("!!!  mf_cfg function disabled\n");
+                       DP(NETIF_MSG_IFUP, "mf_cfg function disabled\n");
                        bp->state = BNX2X_STATE_DISABLED;
                }
 
@@ -6502,19 +6981,19 @@ static int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
                bnx2x_set_mac_addr_e1h(bp, 1);
 
        if (bp->port.pmf)
-               bnx2x_initial_phy_init(bp);
+               bnx2x_initial_phy_init(bp, load_mode);
 
        /* Start fast path */
        switch (load_mode) {
        case LOAD_NORMAL:
                /* Tx queue should be only reenabled */
-               netif_wake_queue(bp->dev);
+               netif_tx_wake_all_queues(bp->dev);
                /* Initialize the receive filter. */
                bnx2x_set_rx_mode(bp->dev);
                break;
 
        case LOAD_OPEN:
-               netif_start_queue(bp->dev);
+               netif_tx_start_all_queues(bp->dev);
                /* Initialize the receive filter. */
                bnx2x_set_rx_mode(bp->dev);
                break;
@@ -6547,33 +7026,32 @@ load_error3:
        bp->port.pmf = 0;
        /* Free SKBs, SGEs, TPA pool and driver internals */
        bnx2x_free_skbs(bp);
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
 load_error2:
        /* Release IRQs */
        bnx2x_free_irq(bp);
 load_error1:
        bnx2x_napi_disable(bp);
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                netif_napi_del(&bnx2x_fp(bp, i, napi));
        bnx2x_free_mem(bp);
 
-       /* TBD we really need to reset the chip
-          if we want to recover from this */
        return rc;
 }
 
 static int bnx2x_stop_multi(struct bnx2x *bp, int index)
 {
+       struct bnx2x_fastpath *fp = &bp->fp[index];
        int rc;
 
        /* halt the connection */
-       bp->fp[index].state = BNX2X_FP_STATE_HALTING;
-       bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_HALT, index, 0, index, 0);
+       fp->state = BNX2X_FP_STATE_HALTING;
+       bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_HALT, index, 0, fp->cl_id, 0);
 
        /* Wait for completion */
        rc = bnx2x_wait_ramrod(bp, BNX2X_FP_STATE_HALTED, index,
-                              &(bp->fp[index].state), 1);
+                              &(fp->state), 1);
        if (rc) /* timeout */
                return rc;
 
@@ -6582,13 +7060,13 @@ static int bnx2x_stop_multi(struct bnx2x *bp, int index)
 
        /* Wait for completion */
        rc = bnx2x_wait_ramrod(bp, BNX2X_FP_STATE_CLOSED, index,
-                              &(bp->fp[index].state), 1);
+                              &(fp->state), 1);
        return rc;
 }
 
 static int bnx2x_stop_leading(struct bnx2x *bp)
 {
-       u16 dsb_sp_prod_idx;
+       __le16 dsb_sp_prod_idx;
        /* if the other port is handling traffic,
           this can take a lot of time */
        int cnt = 500;
@@ -6598,7 +7076,7 @@ static int bnx2x_stop_leading(struct bnx2x *bp)
 
        /* Send HALT ramrod */
        bp->fp[0].state = BNX2X_FP_STATE_HALTING;
-       bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_HALT, 0, 0, BP_CL_ID(bp), 0);
+       bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_HALT, 0, 0, bp->fp->cl_id, 0);
 
        /* Wait for completion */
        rc = bnx2x_wait_ramrod(bp, BNX2X_FP_STATE_HALTED, 0,
@@ -6622,9 +7100,8 @@ static int bnx2x_stop_leading(struct bnx2x *bp)
                           *bp->dsb_sp_prod, dsb_sp_prod_idx);
 #ifdef BNX2X_STOP_ON_ERROR
                        bnx2x_panic();
-#else
-                       rc = -EBUSY;
 #endif
+                       rc = -EBUSY;
                        break;
                }
                cnt--;
@@ -6647,8 +7124,6 @@ static void bnx2x_reset_func(struct bnx2x *bp)
        REG_WR(bp, HC_REG_LEADING_EDGE_0 + port*8, 0);
        REG_WR(bp, HC_REG_TRAILING_EDGE_0 + port*8, 0);
 
-       REG_WR(bp, HC_REG_CONFIG_0 + port*4, 0x1000);
-
        /* Clear ILT */
        base = FUNC_ILT_BASE(func);
        for (i = base; i < base + ILT_PER_FUNC; i++)
@@ -6730,12 +7205,12 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
        /* Release IRQs */
        bnx2x_free_irq(bp);
 
-       /* Wait until tx fast path tasks complete */
-       for_each_queue(bp, i) {
+       /* Wait until tx fastpath tasks complete */
+       for_each_tx_queue(bp, i) {
                struct bnx2x_fastpath *fp = &bp->fp[i];
 
                cnt = 1000;
-               smp_rmb();
+               smp_mb();
                while (bnx2x_has_tx_work_unload(fp)) {
 
                        bnx2x_tx_int(fp, 1000);
@@ -6751,7 +7226,7 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
                        }
                        cnt--;
                        msleep(1);
-                       smp_rmb();
+                       smp_mb();
                }
        }
        /* Give HW time to discard old tx messages */
@@ -6763,15 +7238,15 @@ static int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode)
 
                bnx2x_set_mac_addr_e1(bp, 0);
 
-               for (i = 0; i < config->hdr.length_6b; i++)
+               for (i = 0; i < config->hdr.length; i++)
                        CAM_INVALIDATE(config->config_table[i]);
 
-               config->hdr.length_6b = i;
+               config->hdr.length = i;
                if (CHIP_REV_IS_SLOW(bp))
                        config->hdr.offset = BNX2X_MAX_EMUL_MULTI*(1 + port);
                else
                        config->hdr.offset = BNX2X_MAX_MULTICAST*(1 + port);
-               config->hdr.client_id = BP_CL_ID(bp);
+               config->hdr.client_id = bp->fp->cl_id;
                config->hdr.reserved1 = 0;
 
                bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_SET_MAC, 0,
@@ -6835,11 +7310,11 @@ unload_error:
        if (!BP_NOMCP(bp))
                reset_code = bnx2x_fw_command(bp, reset_code);
        else {
-               DP(NETIF_MSG_IFDOWN, "NO MCP load counts      %d, %d, %d\n",
+               DP(NETIF_MSG_IFDOWN, "NO MCP load counts      %d, %d, %d\n",
                   load_count[0], load_count[1], load_count[2]);
                load_count[0]--;
                load_count[1 + port]--;
-               DP(NETIF_MSG_IFDOWN, "NO MCP new load counts  %d, %d, %d\n",
+               DP(NETIF_MSG_IFDOWN, "NO MCP new load counts  %d, %d, %d\n",
                   load_count[0], load_count[1], load_count[2]);
                if (load_count[0] == 0)
                        reset_code = FW_MSG_CODE_DRV_UNLOAD_COMMON;
@@ -6859,13 +7334,14 @@ unload_error:
        /* Report UNLOAD_DONE to MCP */
        if (!BP_NOMCP(bp))
                bnx2x_fw_command(bp, DRV_MSG_CODE_UNLOAD_DONE);
+
        bp->port.pmf = 0;
 
        /* Free SKBs, SGEs, TPA pool and driver internals */
        bnx2x_free_skbs(bp);
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                netif_napi_del(&bnx2x_fp(bp, i, napi));
        bnx2x_free_mem(bp);
 
@@ -6907,6 +7383,64 @@ reset_task_exit:
  * Init service functions
  */
 
+static inline u32 bnx2x_get_pretend_reg(struct bnx2x *bp, int func)
+{
+       switch (func) {
+       case 0: return PXP2_REG_PGL_PRETEND_FUNC_F0;
+       case 1: return PXP2_REG_PGL_PRETEND_FUNC_F1;
+       case 2: return PXP2_REG_PGL_PRETEND_FUNC_F2;
+       case 3: return PXP2_REG_PGL_PRETEND_FUNC_F3;
+       case 4: return PXP2_REG_PGL_PRETEND_FUNC_F4;
+       case 5: return PXP2_REG_PGL_PRETEND_FUNC_F5;
+       case 6: return PXP2_REG_PGL_PRETEND_FUNC_F6;
+       case 7: return PXP2_REG_PGL_PRETEND_FUNC_F7;
+       default:
+               BNX2X_ERR("Unsupported function index: %d\n", func);
+               return (u32)(-1);
+       }
+}
+
+static void bnx2x_undi_int_disable_e1h(struct bnx2x *bp, int orig_func)
+{
+       u32 reg = bnx2x_get_pretend_reg(bp, orig_func), new_val;
+
+       /* Flush all outstanding writes */
+       mmiowb();
+
+       /* Pretend to be function 0 */
+       REG_WR(bp, reg, 0);
+       /* Flush the GRC transaction (in the chip) */
+       new_val = REG_RD(bp, reg);
+       if (new_val != 0) {
+               BNX2X_ERR("Hmmm... Pretend register wasn't updated: (0,%d)!\n",
+                         new_val);
+               BUG();
+       }
+
+       /* From now we are in the "like-E1" mode */
+       bnx2x_int_disable(bp);
+
+       /* Flush all outstanding writes */
+       mmiowb();
+
+       /* Restore the original funtion settings */
+       REG_WR(bp, reg, orig_func);
+       new_val = REG_RD(bp, reg);
+       if (new_val != orig_func) {
+               BNX2X_ERR("Hmmm... Pretend register wasn't updated: (%d,%d)!\n",
+                         orig_func, new_val);
+               BUG();
+       }
+}
+
+static inline void bnx2x_undi_int_disable(struct bnx2x *bp, int func)
+{
+       if (CHIP_IS_E1H(bp))
+               bnx2x_undi_int_disable_e1h(bp, func);
+       else
+               bnx2x_int_disable(bp);
+}
+
 static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
 {
        u32 val;
@@ -6957,8 +7491,7 @@ static void __devinit bnx2x_undi_unload(struct bnx2x *bp)
                        /* now it's safe to release the lock */
                        bnx2x_release_hw_lock(bp, HW_LOCK_RESOURCE_UNDI);
 
-                       REG_WR(bp, (BP_PORT(bp) ? HC_REG_CONFIG_1 :
-                                   HC_REG_CONFIG_0), 0x1000);
+                       bnx2x_undi_int_disable(bp, func);
 
                        /* close input traffic and wait for it */
                        /* Do not rcv packets to BRB */
@@ -7026,6 +7559,13 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
        bp->link_params.chip_id = bp->common.chip_id;
        BNX2X_DEV_INFO("chip ID is 0x%x\n", id);
 
+       val = (REG_RD(bp, 0x2874) & 0x55);
+       if ((bp->common.chip_id & 0x1) ||
+           (CHIP_IS_E1(bp) && val) || (CHIP_IS_E1H(bp) && (val == 0x55))) {
+               bp->flags |= ONE_PORT_FLAG;
+               BNX2X_DEV_INFO("single port device\n");
+       }
+
        val = REG_RD(bp, MCP_REG_MCPR_NVM_CFG4);
        bp->common.flash_size = (NVRAM_1MB_SIZE <<
                                 (val & MCPR_NVM_CFG4_FLASH_SIZE));
@@ -7050,15 +7590,21 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
                BNX2X_ERR("BAD MCP validity signature\n");
 
        bp->common.hw_config = SHMEM_RD(bp, dev_info.shared_hw_config.config);
-       bp->common.board = SHMEM_RD(bp, dev_info.shared_hw_config.board);
-
-       BNX2X_DEV_INFO("hw_config 0x%08x  board 0x%08x\n",
-                      bp->common.hw_config, bp->common.board);
+       BNX2X_DEV_INFO("hw_config 0x%08x\n", bp->common.hw_config);
 
        bp->link_params.hw_led_mode = ((bp->common.hw_config &
                                        SHARED_HW_CFG_LED_MODE_MASK) >>
                                       SHARED_HW_CFG_LED_MODE_SHIFT);
 
+       bp->link_params.feature_config_flags = 0;
+       val = SHMEM_RD(bp, dev_info.shared_feature_config.config);
+       if (val & SHARED_FEAT_CFG_OVERRIDE_PREEMPHASIS_CFG_ENABLED)
+               bp->link_params.feature_config_flags |=
+                               FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED;
+       else
+               bp->link_params.feature_config_flags &=
+                               ~FEATURE_CONFIG_OVERRIDE_PREEMPHASIS_ENABLED;
+
        val = SHMEM_RD(bp, dev_info.bc_rev) >> 8;
        bp->common.bc_ver = val;
        BNX2X_DEV_INFO("bc_ver %X\n", val);
@@ -7077,7 +7623,7 @@ static void __devinit bnx2x_get_common_hwinfo(struct bnx2x *bp)
                bp->flags |= NO_WOL_FLAG;
        }
        BNX2X_DEV_INFO("%sWoL capable\n",
-                      (bp->flags & NO_WOL_FLAG) ? "Not " : "");
+                      (bp->flags & NO_WOL_FLAG) ? "not " : "");
 
        val = SHMEM_RD(bp, dev_info.shared_hw_config.part_num);
        val2 = SHMEM_RD(bp, dev_info.shared_hw_config.part_num[4]);
@@ -7170,48 +7716,60 @@ static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp,
                                               SUPPORTED_Asym_Pause);
                        break;
 
-               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705:
-                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8705)\n",
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
+                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8072)\n",
                                       ext_phy_type);
 
                        bp->port.supported |= (SUPPORTED_10000baseT_Full |
+                                              SUPPORTED_1000baseT_Full |
                                               SUPPORTED_FIBRE |
+                                              SUPPORTED_Autoneg |
                                               SUPPORTED_Pause |
                                               SUPPORTED_Asym_Pause);
                        break;
 
-               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706:
-                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8706)\n",
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
+                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8073)\n",
                                       ext_phy_type);
 
                        bp->port.supported |= (SUPPORTED_10000baseT_Full |
+                                              SUPPORTED_2500baseX_Full |
                                               SUPPORTED_1000baseT_Full |
                                               SUPPORTED_FIBRE |
+                                              SUPPORTED_Autoneg |
                                               SUPPORTED_Pause |
                                               SUPPORTED_Asym_Pause);
                        break;
 
-               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
-                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8072)\n",
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705:
+                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8705)\n",
                                       ext_phy_type);
 
                        bp->port.supported |= (SUPPORTED_10000baseT_Full |
-                                              SUPPORTED_1000baseT_Full |
                                               SUPPORTED_FIBRE |
-                                              SUPPORTED_Autoneg |
                                               SUPPORTED_Pause |
                                               SUPPORTED_Asym_Pause);
                        break;
 
-               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
-                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8073)\n",
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706:
+                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8706)\n",
                                       ext_phy_type);
 
                        bp->port.supported |= (SUPPORTED_10000baseT_Full |
-                                              SUPPORTED_2500baseX_Full |
                                               SUPPORTED_1000baseT_Full |
                                               SUPPORTED_FIBRE |
+                                              SUPPORTED_Pause |
+                                              SUPPORTED_Asym_Pause);
+                       break;
+
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
+                       BNX2X_DEV_INFO("ext_phy_type 0x%x (8726)\n",
+                                      ext_phy_type);
+
+                       bp->port.supported |= (SUPPORTED_10000baseT_Full |
+                                              SUPPORTED_1000baseT_Full |
                                               SUPPORTED_Autoneg |
+                                              SUPPORTED_FIBRE |
                                               SUPPORTED_Pause |
                                               SUPPORTED_Asym_Pause);
                        break;
@@ -7227,6 +7785,22 @@ static void __devinit bnx2x_link_settings_supported(struct bnx2x *bp,
                                               SUPPORTED_Asym_Pause);
                        break;
 
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
+                       BNX2X_DEV_INFO("ext_phy_type 0x%x (BCM8481)\n",
+                                      ext_phy_type);
+
+                       bp->port.supported |= (SUPPORTED_10baseT_Half |
+                                              SUPPORTED_10baseT_Full |
+                                              SUPPORTED_100baseT_Half |
+                                              SUPPORTED_100baseT_Full |
+                                              SUPPORTED_1000baseT_Full |
+                                              SUPPORTED_10000baseT_Full |
+                                              SUPPORTED_TP |
+                                              SUPPORTED_Autoneg |
+                                              SUPPORTED_Pause |
+                                              SUPPORTED_Asym_Pause);
+                       break;
+
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_FAILURE:
                        BNX2X_ERR("XGXS PHY Failure detected 0x%x\n",
                                  bp->link_params.ext_phy_config);
@@ -7452,12 +8026,12 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
 {
        int port = BP_PORT(bp);
        u32 val, val2;
+       u32 config;
+       u16 i;
 
        bp->link_params.bp = bp;
        bp->link_params.port = port;
 
-       bp->link_params.serdes_config =
-               SHMEM_RD(bp, dev_info.port_hw_config[port].serdes_config);
        bp->link_params.lane_config =
                SHMEM_RD(bp, dev_info.port_hw_config[port].lane_config);
        bp->link_params.ext_phy_config =
@@ -7470,10 +8044,35 @@ static void __devinit bnx2x_get_port_hwinfo(struct bnx2x *bp)
        bp->port.link_config =
                SHMEM_RD(bp, dev_info.port_feature_config[port].link_config);
 
-       BNX2X_DEV_INFO("serdes_config 0x%08x  lane_config 0x%08x\n"
-            KERN_INFO "  ext_phy_config 0x%08x  speed_cap_mask 0x%08x"
-                      "  link_config 0x%08x\n",
-                      bp->link_params.serdes_config,
+       /* Get the 4 lanes xgxs config rx and tx */
+       for (i = 0; i < 2; i++) {
+               val = SHMEM_RD(bp,
+                          dev_info.port_hw_config[port].xgxs_config_rx[i<<1]);
+               bp->link_params.xgxs_config_rx[i << 1] = ((val>>16) & 0xffff);
+               bp->link_params.xgxs_config_rx[(i << 1) + 1] = (val & 0xffff);
+
+               val = SHMEM_RD(bp,
+                          dev_info.port_hw_config[port].xgxs_config_tx[i<<1]);
+               bp->link_params.xgxs_config_tx[i << 1] = ((val>>16) & 0xffff);
+               bp->link_params.xgxs_config_tx[(i << 1) + 1] = (val & 0xffff);
+       }
+
+       config = SHMEM_RD(bp, dev_info.port_feature_config[port].config);
+       if (config & PORT_FEAT_CFG_OPT_MDL_ENFRCMNT_ENABLED)
+               bp->link_params.feature_config_flags |=
+                               FEATURE_CONFIG_MODULE_ENFORCMENT_ENABLED;
+       else
+               bp->link_params.feature_config_flags &=
+                               ~FEATURE_CONFIG_MODULE_ENFORCMENT_ENABLED;
+
+       /* If the device is capable of WoL, set the default state according
+        * to the HW
+        */
+       bp->wol = (!(bp->flags & NO_WOL_FLAG) &&
+                  (config & PORT_FEATURE_WOL_ENABLED));
+
+       BNX2X_DEV_INFO("lane_config 0x%08x  ext_phy_config 0x%08x"
+                      "  speed_cap_mask 0x%08x  link_config 0x%08x\n",
                       bp->link_params.lane_config,
                       bp->link_params.ext_phy_config,
                       bp->link_params.speed_cap_mask, bp->port.link_config);
@@ -7520,7 +8119,7 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
                                       "(0x%04x)\n",
                                       func, bp->e1hov, bp->e1hov);
                } else {
-                       BNX2X_DEV_INFO("Single function mode\n");
+                       BNX2X_DEV_INFO("single function mode\n");
                        if (BP_E1HVN(bp)) {
                                BNX2X_ERR("!!!  No valid E1HOV for func %d,"
                                          "  aborting\n", func);
@@ -7570,6 +8169,7 @@ static int __devinit bnx2x_get_hwinfo(struct bnx2x *bp)
 static int __devinit bnx2x_init_bp(struct bnx2x *bp)
 {
        int func = BP_FUNC(bp);
+       int timer_interval;
        int rc;
 
        /* Disable interrupt handling until HW is initialized */
@@ -7593,6 +8193,16 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
                printk(KERN_ERR PFX
                       "MCP disabled, must load devices in order!\n");
 
+       /* Set multi queue mode */
+       if ((multi_mode != ETH_RSS_MODE_DISABLED) &&
+           ((int_mode == INT_MODE_INTx) || (int_mode == INT_MODE_MSI))) {
+               printk(KERN_ERR PFX
+                     "Multi disabled since int_mode requested is not MSI-X\n");
+               multi_mode = ETH_RSS_MODE_DISABLED;
+       }
+       bp->multi_mode = multi_mode;
+
+
        /* Set TPA flags */
        if (disable_tpa) {
                bp->flags &= ~TPA_ENABLE_FLAG;
@@ -7602,18 +8212,18 @@ static int __devinit bnx2x_init_bp(struct bnx2x *bp)
                bp->dev->features |= NETIF_F_LRO;
        }
 
+       bp->mrrs = mrrs;
 
        bp->tx_ring_size = MAX_TX_AVAIL;
        bp->rx_ring_size = MAX_RX_AVAIL;
 
        bp->rx_csum = 1;
-       bp->rx_offset = 0;
 
        bp->tx_ticks = 50;
        bp->rx_ticks = 25;
 
-       bp->timer_interval = (CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ);
-       bp->current_interval = (poll ? poll : bp->timer_interval);
+       timer_interval = (CHIP_REV_IS_SLOW(bp) ? 5*HZ : HZ);
+       bp->current_interval = (poll ? poll : timer_interval);
 
        init_timer(&bp->timer);
        bp->timer.expires = jiffies + bp->current_interval;
@@ -7658,14 +8268,16 @@ static int bnx2x_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 
                switch (ext_phy_type) {
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT:
-               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705:
-               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706:
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8072:
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8073:
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8705:
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8706:
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8726:
                        cmd->port = PORT_FIBRE;
                        break;
 
                case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_SFX7101:
+               case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_BCM8481:
                        cmd->port = PORT_TP;
                        break;
 
@@ -8045,7 +8657,7 @@ static void bnx2x_disable_nvram_access(struct bnx2x *bp)
                        MCPR_NVM_ACCESS_ENABLE_WR_EN)));
 }
 
-static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, u32 *ret_val,
+static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, __be32 *ret_val,
                                  u32 cmd_flags)
 {
        int count, i, rc;
@@ -8081,8 +8693,7 @@ static int bnx2x_nvram_read_dword(struct bnx2x *bp, u32 offset, u32 *ret_val,
                        /* we read nvram data in cpu order
                         * but ethtool sees it as an array of bytes
                         * converting to big-endian will do the work */
-                       val = cpu_to_be32(val);
-                       *ret_val = val;
+                       *ret_val = cpu_to_be32(val);
                        rc = 0;
                        break;
                }
@@ -8096,7 +8707,7 @@ static int bnx2x_nvram_read(struct bnx2x *bp, u32 offset, u8 *ret_buf,
 {
        int rc;
        u32 cmd_flags;
-       u32 val;
+       __be32 val;
 
        if ((offset & 0x03) || (buf_size & 0x03) || (buf_size == 0)) {
                DP(BNX2X_MSG_NVM,
@@ -8215,7 +8826,7 @@ static int bnx2x_nvram_write1(struct bnx2x *bp, u32 offset, u8 *data_buf,
        int rc;
        u32 cmd_flags;
        u32 align_offset;
-       u32 val;
+       __be32 val;
 
        if (offset + buf_size > bp->common.flash_size) {
                DP(BNX2X_MSG_NVM, "Invalid parameter: offset (0x%x) +"
@@ -8344,7 +8955,7 @@ static int bnx2x_set_eeprom(struct net_device *dev,
                        if ((bp->state == BNX2X_STATE_OPEN) ||
                            (bp->state == BNX2X_STATE_DISABLED)) {
                                rc |= bnx2x_link_reset(&bp->link_params,
-                                                      &bp->link_vars);
+                                                      &bp->link_vars, 1);
                                rc |= bnx2x_phy_init(&bp->link_params,
                                                     &bp->link_vars);
                        }
@@ -8434,7 +9045,8 @@ static void bnx2x_get_pauseparam(struct net_device *dev,
 {
        struct bnx2x *bp = netdev_priv(dev);
 
-       epause->autoneg = (bp->link_params.req_flow_ctrl == BNX2X_FLOW_CTRL_AUTO) &&
+       epause->autoneg = (bp->link_params.req_flow_ctrl ==
+                          BNX2X_FLOW_CTRL_AUTO) &&
                          (bp->link_params.req_line_speed == SPEED_AUTO_NEG);
 
        epause->rx_pause = ((bp->link_vars.flow_ctrl & BNX2X_FLOW_CTRL_RX) ==
@@ -8566,8 +9178,7 @@ static const struct {
        { "nvram_test (online)" },
        { "interrupt_test (online)" },
        { "link_test (online)" },
-       { "idle check (online)" },
-       { "MC errors (online)" }
+       { "idle check (online)" }
 };
 
 static int bnx2x_self_test_count(struct net_device *dev)
@@ -8755,23 +9366,23 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
        u16 len;
        int rc = -ENODEV;
 
-       if (loopback_mode == BNX2X_MAC_LOOPBACK) {
+       /* check the loopback mode */
+       switch (loopback_mode) {
+       case BNX2X_PHY_LOOPBACK:
+               if (bp->link_params.loopback_mode != LOOPBACK_XGXS_10)
+                       return -EINVAL;
+               break;
+       case BNX2X_MAC_LOOPBACK:
                bp->link_params.loopback_mode = LOOPBACK_BMAC;
                bnx2x_phy_init(&bp->link_params, &bp->link_vars);
-
-       } else if (loopback_mode == BNX2X_PHY_LOOPBACK) {
-               u16 cnt = 1000;
-               bp->link_params.loopback_mode = LOOPBACK_XGXS_10;
-               bnx2x_phy_init(&bp->link_params, &bp->link_vars);
-               /* wait until link state is restored */
-               if (link_up)
-                       while (cnt-- && bnx2x_test_link(&bp->link_params,
-                                                       &bp->link_vars))
-                               msleep(10);
-       } else
+               break;
+       default:
                return -EINVAL;
+       }
 
-       pkt_size = 1514;
+       /* prepare the loopback packet */
+       pkt_size = (((bp->dev->mtu < ETH_MAX_PACKET_SIZE) ?
+                    bp->dev->mtu : ETH_MAX_PACKET_SIZE) + ETH_HLEN);
        skb = netdev_alloc_skb(bp->dev, bp->rx_buf_size);
        if (!skb) {
                rc = -ENOMEM;
@@ -8783,6 +9394,7 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
        for (i = ETH_HLEN; i < pkt_size; i++)
                packet[i] = (unsigned char) (i & 0xff);
 
+       /* send the loopback packet */
        num_pkts = 0;
        tx_start_idx = le16_to_cpu(*fp->tx_cons_sb);
        rx_start_idx = le16_to_cpu(*fp->rx_cons_sb);
@@ -8807,12 +9419,10 @@ static int bnx2x_run_loopback(struct bnx2x *bp, int loopback_mode, u8 link_up)
 
        wmb();
 
-       fp->hw_tx_prods->bds_prod =
-               cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + 1);
+       le16_add_cpu(&fp->hw_tx_prods->bds_prod, 1);
        mb(); /* FW restriction: must not reorder writing nbd and packets */
-       fp->hw_tx_prods->packets_prod =
-               cpu_to_le32(le32_to_cpu(fp->hw_tx_prods->packets_prod) + 1);
-       DOORBELL(bp, FP_IDX(fp), 0);
+       le32_add_cpu(&fp->hw_tx_prods->packets_prod, 1);
+       DOORBELL(bp, fp->index, 0);
 
        mmiowb();
 
@@ -8867,7 +9477,7 @@ test_loopback_exit:
 
 static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up)
 {
-       int rc = 0;
+       int rc = 0, res;
 
        if (!netif_running(bp->dev))
                return BNX2X_LOOPBACK_FAILED;
@@ -8875,14 +9485,16 @@ static int bnx2x_test_loopback(struct bnx2x *bp, u8 link_up)
        bnx2x_netif_stop(bp, 1);
        bnx2x_acquire_phy_lock(bp);
 
-       if (bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up)) {
-               DP(NETIF_MSG_PROBE, "MAC loopback failed\n");
-               rc |= BNX2X_MAC_LOOPBACK_FAILED;
+       res = bnx2x_run_loopback(bp, BNX2X_PHY_LOOPBACK, link_up);
+       if (res) {
+               DP(NETIF_MSG_PROBE, "  PHY loopback failed  (res %d)\n", res);
+               rc |= BNX2X_PHY_LOOPBACK_FAILED;
        }
 
-       if (bnx2x_run_loopback(bp, BNX2X_PHY_LOOPBACK, link_up)) {
-               DP(NETIF_MSG_PROBE, "PHY loopback failed\n");
-               rc |= BNX2X_PHY_LOOPBACK_FAILED;
+       res = bnx2x_run_loopback(bp, BNX2X_MAC_LOOPBACK, link_up);
+       if (res) {
+               DP(NETIF_MSG_PROBE, "  MAC loopback failed  (res %d)\n", res);
+               rc |= BNX2X_MAC_LOOPBACK_FAILED;
        }
 
        bnx2x_release_phy_lock(bp);
@@ -8909,14 +9521,14 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
                { 0x778,  0x70 },
                {     0,     0 }
        };
-       u32 buf[0x350 / 4];
+       __be32 buf[0x350 / 4];
        u8 *data = (u8 *)buf;
        int i, rc;
        u32 magic, csum;
 
        rc = bnx2x_nvram_read(bp, 0, data, 4);
        if (rc) {
-               DP(NETIF_MSG_PROBE, "magic value read (rc -%d)\n", -rc);
+               DP(NETIF_MSG_PROBE, "magic value read (rc %d)\n", rc);
                goto test_nvram_exit;
        }
 
@@ -8933,7 +9545,7 @@ static int bnx2x_test_nvram(struct bnx2x *bp)
                                      nvram_tbl[i].size);
                if (rc) {
                        DP(NETIF_MSG_PROBE,
-                          "nvram_tbl[%d] read data (rc -%d)\n", i, -rc);
+                          "nvram_tbl[%d] read data (rc %d)\n", i, rc);
                        goto test_nvram_exit;
                }
 
@@ -8958,12 +9570,12 @@ static int bnx2x_test_intr(struct bnx2x *bp)
        if (!netif_running(bp->dev))
                return -ENODEV;
 
-       config->hdr.length_6b = 0;
+       config->hdr.length = 0;
        if (CHIP_IS_E1(bp))
                config->hdr.offset = (BP_PORT(bp) ? 32 : 0);
        else
                config->hdr.offset = BP_FUNC(bp);
-       config->hdr.client_id = BP_CL_ID(bp);
+       config->hdr.client_id = bp->fp->cl_id;
        config->hdr.reserved1 = 0;
 
        rc = bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_SET_MAC, 0,
@@ -9036,52 +9648,107 @@ static void bnx2x_self_test(struct net_device *dev,
                        buf[5] = 1;
                        etest->flags |= ETH_TEST_FL_FAILED;
                }
-       buf[7] = bnx2x_mc_assert(bp);
-       if (buf[7] != 0)
-               etest->flags |= ETH_TEST_FL_FAILED;
 
 #ifdef BNX2X_EXTRA_DEBUG
        bnx2x_panic_dump(bp);
 #endif
 }
 
+static const struct {
+       long offset;
+       int size;
+       u8 string[ETH_GSTRING_LEN];
+} bnx2x_q_stats_arr[BNX2X_NUM_Q_STATS] = {
+/* 1 */        { Q_STATS_OFFSET32(total_bytes_received_hi), 8, "[%d]: rx_bytes" },
+       { Q_STATS_OFFSET32(error_bytes_received_hi),
+                                               8, "[%d]: rx_error_bytes" },
+       { Q_STATS_OFFSET32(total_unicast_packets_received_hi),
+                                               8, "[%d]: rx_ucast_packets" },
+       { Q_STATS_OFFSET32(total_multicast_packets_received_hi),
+                                               8, "[%d]: rx_mcast_packets" },
+       { Q_STATS_OFFSET32(total_broadcast_packets_received_hi),
+                                               8, "[%d]: rx_bcast_packets" },
+       { Q_STATS_OFFSET32(no_buff_discard_hi), 8, "[%d]: rx_discards" },
+       { Q_STATS_OFFSET32(rx_err_discard_pkt),
+                                        4, "[%d]: rx_phy_ip_err_discards"},
+       { Q_STATS_OFFSET32(rx_skb_alloc_failed),
+                                        4, "[%d]: rx_skb_alloc_discard" },
+       { Q_STATS_OFFSET32(hw_csum_err), 4, "[%d]: rx_csum_offload_errors" },
+
+/* 10 */{ Q_STATS_OFFSET32(total_bytes_transmitted_hi),        8, "[%d]: tx_bytes" },
+       { Q_STATS_OFFSET32(total_unicast_packets_transmitted_hi),
+                                                       8, "[%d]: tx_packets" }
+};
+
 static const struct {
        long offset;
        int size;
        u32 flags;
 #define STATS_FLAGS_PORT               1
 #define STATS_FLAGS_FUNC               2
+#define STATS_FLAGS_BOTH               (STATS_FLAGS_FUNC | STATS_FLAGS_PORT)
        u8 string[ETH_GSTRING_LEN];
 } bnx2x_stats_arr[BNX2X_NUM_STATS] = {
-/* 1 */        { STATS_OFFSET32(valid_bytes_received_hi),
-                               8, STATS_FLAGS_FUNC, "rx_bytes" },
+/* 1 */        { STATS_OFFSET32(total_bytes_received_hi),
+                               8, STATS_FLAGS_BOTH, "rx_bytes" },
        { STATS_OFFSET32(error_bytes_received_hi),
-                               8, STATS_FLAGS_FUNC, "rx_error_bytes" },
-       { STATS_OFFSET32(total_bytes_transmitted_hi),
-                               8, STATS_FLAGS_FUNC, "tx_bytes" },
-       { STATS_OFFSET32(tx_stat_ifhcoutbadoctets_hi),
-                               8, STATS_FLAGS_PORT, "tx_error_bytes" },
+                               8, STATS_FLAGS_BOTH, "rx_error_bytes" },
        { STATS_OFFSET32(total_unicast_packets_received_hi),
-                               8, STATS_FLAGS_FUNC, "rx_ucast_packets" },
+                               8, STATS_FLAGS_BOTH, "rx_ucast_packets" },
        { STATS_OFFSET32(total_multicast_packets_received_hi),
-                               8, STATS_FLAGS_FUNC, "rx_mcast_packets" },
+                               8, STATS_FLAGS_BOTH, "rx_mcast_packets" },
        { STATS_OFFSET32(total_broadcast_packets_received_hi),
-                               8, STATS_FLAGS_FUNC, "rx_bcast_packets" },
-       { STATS_OFFSET32(total_unicast_packets_transmitted_hi),
-                               8, STATS_FLAGS_FUNC, "tx_packets" },
-       { STATS_OFFSET32(tx_stat_dot3statsinternalmactransmiterrors_hi),
-                               8, STATS_FLAGS_PORT, "tx_mac_errors" },
-/* 10 */{ STATS_OFFSET32(rx_stat_dot3statscarriersenseerrors_hi),
-                               8, STATS_FLAGS_PORT, "tx_carrier_errors" },
+                               8, STATS_FLAGS_BOTH, "rx_bcast_packets" },
        { STATS_OFFSET32(rx_stat_dot3statsfcserrors_hi),
                                8, STATS_FLAGS_PORT, "rx_crc_errors" },
        { STATS_OFFSET32(rx_stat_dot3statsalignmenterrors_hi),
                                8, STATS_FLAGS_PORT, "rx_align_errors" },
+       { STATS_OFFSET32(rx_stat_etherstatsundersizepkts_hi),
+                               8, STATS_FLAGS_PORT, "rx_undersize_packets" },
+       { STATS_OFFSET32(etherstatsoverrsizepkts_hi),
+                               8, STATS_FLAGS_PORT, "rx_oversize_packets" },
+/* 10 */{ STATS_OFFSET32(rx_stat_etherstatsfragments_hi),
+                               8, STATS_FLAGS_PORT, "rx_fragments" },
+       { STATS_OFFSET32(rx_stat_etherstatsjabbers_hi),
+                               8, STATS_FLAGS_PORT, "rx_jabbers" },
+       { STATS_OFFSET32(no_buff_discard_hi),
+                               8, STATS_FLAGS_BOTH, "rx_discards" },
+       { STATS_OFFSET32(mac_filter_discard),
+                               4, STATS_FLAGS_PORT, "rx_filtered_packets" },
+       { STATS_OFFSET32(xxoverflow_discard),
+                               4, STATS_FLAGS_PORT, "rx_fw_discards" },
+       { STATS_OFFSET32(brb_drop_hi),
+                               8, STATS_FLAGS_PORT, "rx_brb_discard" },
+       { STATS_OFFSET32(brb_truncate_hi),
+                               8, STATS_FLAGS_PORT, "rx_brb_truncate" },
+       { STATS_OFFSET32(pause_frames_received_hi),
+                               8, STATS_FLAGS_PORT, "rx_pause_frames" },
+       { STATS_OFFSET32(rx_stat_maccontrolframesreceived_hi),
+                               8, STATS_FLAGS_PORT, "rx_mac_ctrl_frames" },
+       { STATS_OFFSET32(nig_timer_max),
+                       4, STATS_FLAGS_PORT, "rx_constant_pause_events" },
+/* 20 */{ STATS_OFFSET32(rx_err_discard_pkt),
+                               4, STATS_FLAGS_BOTH, "rx_phy_ip_err_discards"},
+       { STATS_OFFSET32(rx_skb_alloc_failed),
+                               4, STATS_FLAGS_BOTH, "rx_skb_alloc_discard" },
+       { STATS_OFFSET32(hw_csum_err),
+                               4, STATS_FLAGS_BOTH, "rx_csum_offload_errors" },
+
+       { STATS_OFFSET32(total_bytes_transmitted_hi),
+                               8, STATS_FLAGS_BOTH, "tx_bytes" },
+       { STATS_OFFSET32(tx_stat_ifhcoutbadoctets_hi),
+                               8, STATS_FLAGS_PORT, "tx_error_bytes" },
+       { STATS_OFFSET32(total_unicast_packets_transmitted_hi),
+                               8, STATS_FLAGS_BOTH, "tx_packets" },
+       { STATS_OFFSET32(tx_stat_dot3statsinternalmactransmiterrors_hi),
+                               8, STATS_FLAGS_PORT, "tx_mac_errors" },
+       { STATS_OFFSET32(rx_stat_dot3statscarriersenseerrors_hi),
+                               8, STATS_FLAGS_PORT, "tx_carrier_errors" },
        { STATS_OFFSET32(tx_stat_dot3statssinglecollisionframes_hi),
                                8, STATS_FLAGS_PORT, "tx_single_collisions" },
        { STATS_OFFSET32(tx_stat_dot3statsmultiplecollisionframes_hi),
                                8, STATS_FLAGS_PORT, "tx_multi_collisions" },
-       { STATS_OFFSET32(tx_stat_dot3statsdeferredtransmissions_hi),
+/* 30 */{ STATS_OFFSET32(tx_stat_dot3statsdeferredtransmissions_hi),
                                8, STATS_FLAGS_PORT, "tx_deferred" },
        { STATS_OFFSET32(tx_stat_dot3statsexcessivecollisions_hi),
                                8, STATS_FLAGS_PORT, "tx_excess_collisions" },
@@ -9089,14 +9756,6 @@ static const struct {
                                8, STATS_FLAGS_PORT, "tx_late_collisions" },
        { STATS_OFFSET32(tx_stat_etherstatscollisions_hi),
                                8, STATS_FLAGS_PORT, "tx_total_collisions" },
-       { STATS_OFFSET32(rx_stat_etherstatsfragments_hi),
-                               8, STATS_FLAGS_PORT, "rx_fragments" },
-/* 20 */{ STATS_OFFSET32(rx_stat_etherstatsjabbers_hi),
-                               8, STATS_FLAGS_PORT, "rx_jabbers" },
-       { STATS_OFFSET32(rx_stat_etherstatsundersizepkts_hi),
-                               8, STATS_FLAGS_PORT, "rx_undersize_packets" },
-       { STATS_OFFSET32(jabber_packets_received),
-                               4, STATS_FLAGS_FUNC, "rx_oversize_packets" },
        { STATS_OFFSET32(tx_stat_etherstatspkts64octets_hi),
                                8, STATS_FLAGS_PORT, "tx_64_byte_packets" },
        { STATS_OFFSET32(tx_stat_etherstatspkts65octetsto127octets_hi),
@@ -9109,52 +9768,46 @@ static const struct {
                        8, STATS_FLAGS_PORT, "tx_512_to_1023_byte_packets" },
        { STATS_OFFSET32(etherstatspkts1024octetsto1522octets_hi),
                        8, STATS_FLAGS_PORT, "tx_1024_to_1522_byte_packets" },
-       { STATS_OFFSET32(etherstatspktsover1522octets_hi),
+/* 40 */{ STATS_OFFSET32(etherstatspktsover1522octets_hi),
                        8, STATS_FLAGS_PORT, "tx_1523_to_9022_byte_packets" },
-/* 30 */{ STATS_OFFSET32(rx_stat_xonpauseframesreceived_hi),
-                               8, STATS_FLAGS_PORT, "rx_xon_frames" },
-       { STATS_OFFSET32(rx_stat_xoffpauseframesreceived_hi),
-                               8, STATS_FLAGS_PORT, "rx_xoff_frames" },
-       { STATS_OFFSET32(tx_stat_outxonsent_hi),
-                               8, STATS_FLAGS_PORT, "tx_xon_frames" },
-       { STATS_OFFSET32(tx_stat_outxoffsent_hi),
-                               8, STATS_FLAGS_PORT, "tx_xoff_frames" },
-       { STATS_OFFSET32(rx_stat_maccontrolframesreceived_hi),
-                               8, STATS_FLAGS_PORT, "rx_mac_ctrl_frames" },
-       { STATS_OFFSET32(mac_filter_discard),
-                               4, STATS_FLAGS_PORT, "rx_filtered_packets" },
-       { STATS_OFFSET32(no_buff_discard),
-                               4, STATS_FLAGS_FUNC, "rx_discards" },
-       { STATS_OFFSET32(xxoverflow_discard),
-                               4, STATS_FLAGS_PORT, "rx_fw_discards" },
-       { STATS_OFFSET32(brb_drop_hi),
-                               8, STATS_FLAGS_PORT, "brb_discard" },
-       { STATS_OFFSET32(brb_truncate_hi),
-                               8, STATS_FLAGS_PORT, "brb_truncate" },
-/* 40 */{ STATS_OFFSET32(rx_err_discard_pkt),
-                               4, STATS_FLAGS_FUNC, "rx_phy_ip_err_discards"},
-       { STATS_OFFSET32(rx_skb_alloc_failed),
-                               4, STATS_FLAGS_FUNC, "rx_skb_alloc_discard" },
-/* 42 */{ STATS_OFFSET32(hw_csum_err),
-                               4, STATS_FLAGS_FUNC, "rx_csum_offload_errors" }
+       { STATS_OFFSET32(pause_frames_sent_hi),
+                               8, STATS_FLAGS_PORT, "tx_pause_frames" }
 };
 
-#define IS_NOT_E1HMF_STAT(bp, i) \
-               (IS_E1HMF(bp) && (bnx2x_stats_arr[i].flags & STATS_FLAGS_PORT))
+#define IS_PORT_STAT(i) \
+       ((bnx2x_stats_arr[i].flags & STATS_FLAGS_BOTH) == STATS_FLAGS_PORT)
+#define IS_FUNC_STAT(i)                (bnx2x_stats_arr[i].flags & STATS_FLAGS_FUNC)
+#define IS_E1HMF_MODE_STAT(bp) \
+                       (IS_E1HMF(bp) && !(bp->msglevel & BNX2X_MSG_STATS))
 
 static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
 {
        struct bnx2x *bp = netdev_priv(dev);
-       int i, j;
+       int i, j, k;
 
        switch (stringset) {
        case ETH_SS_STATS:
-               for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
-                       if (IS_NOT_E1HMF_STAT(bp, i))
-                               continue;
-                       strcpy(buf + j*ETH_GSTRING_LEN,
-                              bnx2x_stats_arr[i].string);
-                       j++;
+               if (is_multi(bp)) {
+                       k = 0;
+                       for_each_queue(bp, i) {
+                               for (j = 0; j < BNX2X_NUM_Q_STATS; j++)
+                                       sprintf(buf + (k + j)*ETH_GSTRING_LEN,
+                                               bnx2x_q_stats_arr[j].string, i);
+                               k += BNX2X_NUM_Q_STATS;
+                       }
+                       if (IS_E1HMF_MODE_STAT(bp))
+                               break;
+                       for (j = 0; j < BNX2X_NUM_STATS; j++)
+                               strcpy(buf + (k + j)*ETH_GSTRING_LEN,
+                                      bnx2x_stats_arr[j].string);
+               } else {
+                       for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
+                               if (IS_E1HMF_MODE_STAT(bp) && IS_PORT_STAT(i))
+                                       continue;
+                               strcpy(buf + j*ETH_GSTRING_LEN,
+                                      bnx2x_stats_arr[i].string);
+                               j++;
+                       }
                }
                break;
 
@@ -9167,13 +9820,22 @@ static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
 static int bnx2x_get_stats_count(struct net_device *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
-       int i, num_stats = 0;
+       int i, num_stats;
 
-       for (i = 0; i < BNX2X_NUM_STATS; i++) {
-               if (IS_NOT_E1HMF_STAT(bp, i))
-                       continue;
-               num_stats++;
+       if (is_multi(bp)) {
+               num_stats = BNX2X_NUM_Q_STATS * BNX2X_NUM_QUEUES(bp);
+               if (!IS_E1HMF_MODE_STAT(bp))
+                       num_stats += BNX2X_NUM_STATS;
+       } else {
+               if (IS_E1HMF_MODE_STAT(bp)) {
+                       num_stats = 0;
+                       for (i = 0; i < BNX2X_NUM_STATS; i++)
+                               if (IS_FUNC_STAT(i))
+                                       num_stats++;
+               } else
+                       num_stats = BNX2X_NUM_STATS;
        }
+
        return num_stats;
 }
 
@@ -9181,29 +9843,71 @@ static void bnx2x_get_ethtool_stats(struct net_device *dev,
                                    struct ethtool_stats *stats, u64 *buf)
 {
        struct bnx2x *bp = netdev_priv(dev);
-       u32 *hw_stats = (u32 *)&bp->eth_stats;
-       int i, j;
-
-       for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
-               if (IS_NOT_E1HMF_STAT(bp, i))
-                       continue;
+       u32 *hw_stats, *offset;
+       int i, j, k;
 
-               if (bnx2x_stats_arr[i].size == 0) {
-                       /* skip this counter */
-                       buf[j] = 0;
-                       j++;
-                       continue;
+       if (is_multi(bp)) {
+               k = 0;
+               for_each_queue(bp, i) {
+                       hw_stats = (u32 *)&bp->fp[i].eth_q_stats;
+                       for (j = 0; j < BNX2X_NUM_Q_STATS; j++) {
+                               if (bnx2x_q_stats_arr[j].size == 0) {
+                                       /* skip this counter */
+                                       buf[k + j] = 0;
+                                       continue;
+                               }
+                               offset = (hw_stats +
+                                         bnx2x_q_stats_arr[j].offset);
+                               if (bnx2x_q_stats_arr[j].size == 4) {
+                                       /* 4-byte counter */
+                                       buf[k + j] = (u64) *offset;
+                                       continue;
+                               }
+                               /* 8-byte counter */
+                               buf[k + j] = HILO_U64(*offset, *(offset + 1));
+                       }
+                       k += BNX2X_NUM_Q_STATS;
+               }
+               if (IS_E1HMF_MODE_STAT(bp))
+                       return;
+               hw_stats = (u32 *)&bp->eth_stats;
+               for (j = 0; j < BNX2X_NUM_STATS; j++) {
+                       if (bnx2x_stats_arr[j].size == 0) {
+                               /* skip this counter */
+                               buf[k + j] = 0;
+                               continue;
+                       }
+                       offset = (hw_stats + bnx2x_stats_arr[j].offset);
+                       if (bnx2x_stats_arr[j].size == 4) {
+                               /* 4-byte counter */
+                               buf[k + j] = (u64) *offset;
+                               continue;
+                       }
+                       /* 8-byte counter */
+                       buf[k + j] = HILO_U64(*offset, *(offset + 1));
                }
-               if (bnx2x_stats_arr[i].size == 4) {
-                       /* 4-byte counter */
-                       buf[j] = (u64) *(hw_stats + bnx2x_stats_arr[i].offset);
+       } else {
+               hw_stats = (u32 *)&bp->eth_stats;
+               for (i = 0, j = 0; i < BNX2X_NUM_STATS; i++) {
+                       if (IS_E1HMF_MODE_STAT(bp) && IS_PORT_STAT(i))
+                               continue;
+                       if (bnx2x_stats_arr[i].size == 0) {
+                               /* skip this counter */
+                               buf[j] = 0;
+                               j++;
+                               continue;
+                       }
+                       offset = (hw_stats + bnx2x_stats_arr[i].offset);
+                       if (bnx2x_stats_arr[i].size == 4) {
+                               /* 4-byte counter */
+                               buf[j] = (u64) *offset;
+                               j++;
+                               continue;
+                       }
+                       /* 8-byte counter */
+                       buf[j] = HILO_U64(*offset, *(offset + 1));
                        j++;
-                       continue;
                }
-               /* 8-byte counter */
-               buf[j] = HILO_U64(*(hw_stats + bnx2x_stats_arr[i].offset),
-                                 *(hw_stats + bnx2x_stats_arr[i].offset + 1));
-               j++;
        }
 }
 
@@ -9366,6 +10070,7 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
 
        if (bnx2x_has_rx_work(fp))
                work_done = bnx2x_rx_int(fp, budget);
+
        rmb(); /* BNX2X_HAS_WORK() reads the status block */
 
        /* must not complete if we consumed full budget */
@@ -9374,13 +10079,14 @@ static int bnx2x_poll(struct napi_struct *napi, int budget)
 #ifdef BNX2X_STOP_ON_ERROR
 poll_panic:
 #endif
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
-               bnx2x_ack_sb(bp, FP_SB_ID(fp), USTORM_ID,
+               bnx2x_ack_sb(bp, fp->sb_id, USTORM_ID,
                             le16_to_cpu(fp->fp_u_idx), IGU_INT_NOP, 1);
-               bnx2x_ack_sb(bp, FP_SB_ID(fp), CSTORM_ID,
+               bnx2x_ack_sb(bp, fp->sb_id, CSTORM_ID,
                             le16_to_cpu(fp->fp_c_idx), IGU_INT_ENABLE, 1);
        }
+
        return work_done;
 }
 
@@ -9456,7 +10162,7 @@ static inline u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
                rc = XMIT_PLAIN;
 
        else {
-               if (skb->protocol == ntohs(ETH_P_IPV6)) {
+               if (skb->protocol == htons(ETH_P_IPV6)) {
                        rc = XMIT_CSUM_V6;
                        if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
                                rc |= XMIT_CSUM_TCP;
@@ -9478,7 +10184,9 @@ static inline u32 bnx2x_xmit_type(struct bnx2x *bp, struct sk_buff *skb)
 }
 
 #if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3)
-/* check if packet requires linearization (packet is too fragmented) */
+/* check if packet requires linearization (packet is too fragmented)
+   no need to check fragmentation if page size > 8K (there will be no
+   violation to FW restrictions) */
 static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb,
                             u32 xmit_type)
 {
@@ -9537,7 +10245,6 @@ static int bnx2x_pkt_req_lin(struct bnx2x *bp, struct sk_buff *skb,
                                wnd_sum -=
                                        skb_shinfo(skb)->frags[wnd_idx].size;
                        }
-
                } else {
                        /* in non-LSO too fragmented packet should always
                           be linearized */
@@ -9565,6 +10272,7 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
        struct bnx2x_fastpath *fp;
+       struct netdev_queue *txq;
        struct sw_tx_bd *tx_buf;
        struct eth_tx_bd *tx_bd;
        struct eth_tx_parse_bd *pbd = NULL;
@@ -9581,12 +10289,14 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
                return NETDEV_TX_BUSY;
 #endif
 
-       fp_index = (smp_processor_id() % bp->num_queues);
+       fp_index = skb_get_queue_mapping(skb);
+       txq = netdev_get_tx_queue(dev, fp_index);
+
        fp = &bp->fp[fp_index];
 
        if (unlikely(bnx2x_tx_avail(fp) < (skb_shinfo(skb)->nr_frags + 3))) {
-               bp->eth_stats.driver_xoff++,
-               netif_stop_queue(dev);
+               fp->eth_q_stats.driver_xoff++,
+               netif_tx_stop_queue(txq);
                BNX2X_ERR("BUG! Tx ring full when queue awake!\n");
                return NETDEV_TX_BUSY;
        }
@@ -9597,8 +10307,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
           ip_hdr(skb)->protocol, skb_shinfo(skb)->gso_type, xmit_type);
 
 #if (MAX_SKB_FRAGS >= MAX_FETCH_BD - 3)
-       /* First, check if we need to linearize the skb
-          (due to FW restrictions) */
+       /* First, check if we need to linearize the skb (due to FW
+          restrictions). No need to check fragmentation if page size > 8K
+          (there will be no violation to FW restrictions) */
        if (bnx2x_pkt_req_lin(bp, skb, xmit_type)) {
                /* Statistics of linearization */
                bp->lin_cnt++;
@@ -9663,9 +10374,9 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
                hlen = (skb_network_header(skb) - skb->data + vlan_off) / 2;
 
                /* for now NS flag is not used in Linux */
-               pbd->global_data = (hlen |
-                                   ((skb->protocol == ntohs(ETH_P_8021Q)) <<
-                                    ETH_TX_PARSE_BD_LLC_SNAP_EN_SHIFT));
+               pbd->global_data =
+                       (hlen | ((skb->protocol == cpu_to_be16(ETH_P_8021Q)) <<
+                                ETH_TX_PARSE_BD_LLC_SNAP_EN_SHIFT));
 
                pbd->ip_hlen = (skb_transport_header(skb) -
                                skb_network_header(skb)) / 2;
@@ -9809,12 +10520,10 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
         */
        wmb();
 
-       fp->hw_tx_prods->bds_prod =
-               cpu_to_le16(le16_to_cpu(fp->hw_tx_prods->bds_prod) + nbd);
+       le16_add_cpu(&fp->hw_tx_prods->bds_prod, nbd);
        mb(); /* FW restriction: must not reorder writing nbd and packets */
-       fp->hw_tx_prods->packets_prod =
-               cpu_to_le32(le32_to_cpu(fp->hw_tx_prods->packets_prod) + 1);
-       DOORBELL(bp, FP_IDX(fp), 0);
+       le32_add_cpu(&fp->hw_tx_prods->packets_prod, 1);
+       DOORBELL(bp, fp->index, 0);
 
        mmiowb();
 
@@ -9825,10 +10534,10 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
                /* We want bnx2x_tx_int to "see" the updated tx_bd_prod
                   if we put Tx into XOFF state. */
                smp_mb();
-               netif_stop_queue(dev);
-               bp->eth_stats.driver_xoff++;
+               netif_tx_stop_queue(txq);
+               fp->eth_q_stats.driver_xoff++;
                if (bnx2x_tx_avail(fp) >= MAX_SKB_FRAGS + 3)
-                       netif_wake_queue(dev);
+                       netif_tx_wake_queue(txq);
        }
        fp->tx_pkt++;
 
@@ -9861,7 +10570,7 @@ static int bnx2x_close(struct net_device *dev)
        return 0;
 }
 
-/* called with netif_tx_lock from set_multicast */
+/* called with netif_tx_lock from dev_mcast.c */
 static void bnx2x_set_rx_mode(struct net_device *dev)
 {
        struct bnx2x *bp = netdev_priv(dev);
@@ -9920,7 +10629,7 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
                                   config->config_table[i].
                                                cam_entry.lsb_mac_addr);
                        }
-                       old = config->hdr.length_6b;
+                       old = config->hdr.length;
                        if (old > i) {
                                for (; i < old; i++) {
                                        if (CAM_IS_INVALID(config->
@@ -9939,9 +10648,9 @@ static void bnx2x_set_rx_mode(struct net_device *dev)
                        else
                                offset = BNX2X_MAX_MULTICAST*(1 + port);
 
-                       config->hdr.length_6b = i;
+                       config->hdr.length = i;
                        config->hdr.offset = offset;
-                       config->hdr.client_id = BP_CL_ID(bp);
+                       config->hdr.client_id = bp->fp->cl_id;
                        config->hdr.reserved1 = 0;
 
                        bnx2x_sp_post(bp, RAMROD_CMD_ID_ETH_SET_MAC, 0,
@@ -10127,7 +10836,7 @@ static const struct net_device_ops bnx2x_netdev_ops = {
        .ndo_open               = bnx2x_open,
        .ndo_stop               = bnx2x_close,
        .ndo_start_xmit         = bnx2x_start_xmit,
-       .ndo_set_multicast_list = bnx2x_set_rx_mode,
+       .ndo_set_multicast_list = bnx2x_set_rx_mode,
        .ndo_set_mac_address    = bnx2x_change_mac_addr,
        .ndo_validate_addr      = eth_validate_addr,
        .ndo_do_ioctl           = bnx2x_ioctl,
@@ -10141,7 +10850,6 @@ static const struct net_device_ops bnx2x_netdev_ops = {
 #endif
 };
 
-
 static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
                                    struct net_device *dev)
 {
@@ -10320,7 +11028,7 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
                printk(KERN_INFO "%s", version);
 
        /* dev zeroed in init_etherdev */
-       dev = alloc_etherdev(sizeof(*bp));
+       dev = alloc_etherdev_mq(sizeof(*bp), MAX_CONTEXT);
        if (!dev) {
                printk(KERN_ERR PFX "Cannot allocate net device\n");
                return -ENOMEM;
@@ -10347,9 +11055,8 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
                goto init_one_exit;
        }
 
-       bp->common.name = board_info[ent->driver_data].name;
        printk(KERN_INFO "%s: %s (%c%d) PCI-E x%d %s found at mem %lx,"
-              " IRQ %d, ", dev->name, bp->common.name,
+              " IRQ %d, ", dev->name, board_info[ent->driver_data].name,
               (CHIP_REV(bp) >> 12) + 'A', (CHIP_METAL(bp) >> 4),
               bnx2x_get_pcie_width(bp),
               (bnx2x_get_pcie_speed(bp) == 2) ? "5GHz (Gen2)" : "2.5GHz",
@@ -10486,15 +11193,15 @@ static int bnx2x_eeh_nic_unload(struct bnx2x *bp)
                struct mac_configuration_cmd *config =
                                                bnx2x_sp(bp, mcast_config);
 
-               for (i = 0; i < config->hdr.length_6b; i++)
+               for (i = 0; i < config->hdr.length; i++)
                        CAM_INVALIDATE(config->config_table[i]);
        }
 
        /* Free SKBs, SGEs, TPA pool and driver internals */
        bnx2x_free_skbs(bp);
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                bnx2x_free_rx_sge_range(bp, bp->fp + i, NUM_RX_SGE);
-       for_each_queue(bp, i)
+       for_each_rx_queue(bp, i)
                netif_napi_del(&bnx2x_fp(bp, i, napi));
        bnx2x_free_mem(bp);
 
@@ -10621,8 +11328,8 @@ static void bnx2x_io_resume(struct pci_dev *pdev)
 
 static struct pci_error_handlers bnx2x_err_handler = {
        .error_detected = bnx2x_io_error_detected,
-       .slot_reset = bnx2x_io_slot_reset,
-       .resume = bnx2x_io_resume,
+       .slot_reset     = bnx2x_io_slot_reset,
+       .resume         = bnx2x_io_resume,
 };
 
 static struct pci_driver bnx2x_pci_driver = {
index d084e5fc4b51a91e3946f96024ca727d60cd07f1..360a2564aa986918540b26f6d8824071408851ee 100644 (file)
    address BRB1_IND_FREE_LIST_PRS_CRDT+1 initialize free tail. At address
    BRB1_IND_FREE_LIST_PRS_CRDT+2 initialize parser initial credit. */
 #define BRB1_REG_FREE_LIST_PRS_CRDT                             0x60200
+/* [RW 10] The number of free blocks above which the High_llfc signal to
+   interface #n is de-asserted. */
+#define BRB1_REG_HIGH_LLFC_HIGH_THRESHOLD_0                     0x6014c
+/* [RW 10] The number of free blocks below which the High_llfc signal to
+   interface #n is asserted. */
+#define BRB1_REG_HIGH_LLFC_LOW_THRESHOLD_0                      0x6013c
 /* [RW 23] LL RAM data. */
 #define BRB1_REG_LL_RAM                                         0x61000
+/* [RW 10] The number of free blocks above which the Low_llfc signal to
+   interface #n is de-asserted. */
+#define BRB1_REG_LOW_LLFC_HIGH_THRESHOLD_0                      0x6016c
+/* [RW 10] The number of free blocks below which the Low_llfc signal to
+   interface #n is asserted. */
+#define BRB1_REG_LOW_LLFC_LOW_THRESHOLD_0                       0x6015c
 /* [R 24] The number of full blocks. */
 #define BRB1_REG_NUM_OF_FULL_BLOCKS                             0x60090
 /* [ST 32] The number of cycles that the write_full signal towards MAC #0
    stands for weight 8 (the most prioritised); 1 stands for weight 1(least
    prioritised); 2 stands for weight 2; tc. */
 #define CCM_REG_CQM_P_WEIGHT                                    0xd00b8
+/* [RW 3] The weight of the QM (secondary) input in the WRR mechanism. 0
+   stands for weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define CCM_REG_CQM_S_WEIGHT                                    0xd00bc
 /* [RW 1] Input SDM Interface enable. If 0 - the valid input is disregarded;
    acknowledge output is deasserted; all other signals are treated as usual;
    if 1 - normal activity. */
 /* [RC 1] Set when the message length mismatch (relative to last indication)
    at the SDM interface is detected. */
 #define CCM_REG_CSDM_LENGTH_MIS                                 0xd0170
+/* [RW 3] The weight of the SDM input in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define CCM_REG_CSDM_WEIGHT                                     0xd00b4
 /* [RW 28] The CM header for QM formatting in case of an error in the QM
    inputs. */
 #define CCM_REG_ERR_CCM_HDR                                     0xd0094
 /* [RC 1] Set when the message length mismatch (relative to last indication)
    at the STORM interface is detected. */
 #define CCM_REG_STORM_LENGTH_MIS                                0xd016c
+/* [RW 3] The weight of the STORM input in the WRR (Weighted Round robin)
+   mechanism. 0 stands for weight 8 (the most prioritised); 1 stands for
+   weight 1(least prioritised); 2 stands for weight 2 (more prioritised);
+   tc. */
+#define CCM_REG_STORM_WEIGHT                                    0xd009c
 /* [RW 1] Input tsem Interface enable. If 0 - the valid input is
    disregarded; acknowledge output is deasserted; all other signals are
    treated as usual; if 1 - normal activity. */
    set one of these bits. the bit description can be found in CFC
    specifications */
 #define CFC_REG_ERROR_VECTOR                                    0x10403c
+/* [WB 93] LCID info ram access */
+#define CFC_REG_INFO_RAM                                        0x105000
+#define CFC_REG_INFO_RAM_SIZE                                   1024
 #define CFC_REG_INIT_REG                                        0x10404c
+#define CFC_REG_INTERFACES                                      0x104058
 /* [RW 24] {weight_load_client7[2:0] to weight_load_client0[2:0]}. this
    field allows changing the priorities of the weighted-round-robin arbiter
    which selects which CFC load client should be served next */
 #define CFC_REG_NUM_LCIDS_ALLOC                                 0x104020
 /* [R 9] Number of Arriving LCIDs in Link List Block */
 #define CFC_REG_NUM_LCIDS_ARRIVING                              0x104004
-/* [R 9] Number of Inside LCIDs in Link List Block */
-#define CFC_REG_NUM_LCIDS_INSIDE                                0x104008
 /* [R 9] Number of Leaving LCIDs in Link List Block */
 #define CFC_REG_NUM_LCIDS_LEAVING                               0x104018
 /* [RW 8] The event id for aggregated interrupt 0 */
 #define DORQ_REG_SHRT_CMHEAD                                    0x170054
 #define HC_CONFIG_0_REG_ATTN_BIT_EN_0                           (0x1<<4)
 #define HC_CONFIG_0_REG_INT_LINE_EN_0                           (0x1<<3)
+#define HC_CONFIG_0_REG_MSI_ATTN_EN_0                           (0x1<<7)
 #define HC_CONFIG_0_REG_MSI_MSIX_INT_EN_0                       (0x1<<2)
 #define HC_CONFIG_0_REG_SINGLE_ISR_EN_0                         (0x1<<1)
 #define HC_REG_AGG_INT_0                                        0x108050
    This is the result value of the pin; not the drive value. Writing these
    bits will have not effect. */
 #define MISC_REG_GPIO                                           0xa490
+/* [RW 8] These bits enable the GPIO_INTs to signals event to the
+   IGU/MCP.according to the following map: [0] p0_gpio_0; [1] p0_gpio_1; [2]
+   p0_gpio_2; [3] p0_gpio_3; [4] p1_gpio_0; [5] p1_gpio_1; [6] p1_gpio_2;
+   [7] p1_gpio_3; */
+#define MISC_REG_GPIO_EVENT_EN                                  0xa2bc
+/* [RW 32] GPIO INT. [31-28] OLD_CLR port1; [27-24] OLD_CLR port0; Writing a
+   '1' to these bit clears the corresponding bit in the #OLD_VALUE register.
+   This will acknowledge an interrupt on the falling edge of corresponding
+   GPIO input (reset value 0). [23-16] OLD_SET [23-16] port1; OLD_SET port0;
+   Writing a '1' to these bit sets the corresponding bit in the #OLD_VALUE
+   register. This will acknowledge an interrupt on the rising edge of
+   corresponding SPIO input (reset value 0). [15-12] OLD_VALUE [11-8] port1;
+   OLD_VALUE port0; RO; These bits indicate the old value of the GPIO input
+   value. When the ~INT_STATE bit is set; this bit indicates the OLD value
+   of the pin such that if ~INT_STATE is set and this bit is '0'; then the
+   interrupt is due to a low to high edge. If ~INT_STATE is set and this bit
+   is '1'; then the interrupt is due to a high to low edge (reset value 0).
+   [7-4] INT_STATE port1; [3-0] INT_STATE RO port0; These bits indicate the
+   current GPIO interrupt state for each GPIO pin. This bit is cleared when
+   the appropriate #OLD_SET or #OLD_CLR command bit is written. This bit is
+   set when the GPIO input does not match the current value in #OLD_VALUE
+   (reset value 0). */
+#define MISC_REG_GPIO_INT                                       0xa494
 /* [R 28] this field hold the last information that caused reserved
    attention. bits [19:0] - address; [22:20] function; [23] reserved;
    [27:24] the master that caused the attention - according to the following
    command bit is written. This bit is set when the SPIO input does not
    match the current value in #OLD_VALUE (reset value 0). */
 #define MISC_REG_SPIO_INT                                       0xa500
+/* [RW 32] reload value for counter 4 if reload; the value will be reload if
+   the counter reached zero and the reload bit
+   (~misc_registers_sw_timer_cfg_4.sw_timer_cfg_4[1] ) is set */
+#define MISC_REG_SW_TIMER_RELOAD_VAL_4                          0xa2fc
+/* [RW 32] the value of the counter for sw timers1-8. there are 8 addresses
+   in this register. addres 0 - timer 1; address - timer 2�address 7 -
+   timer 8 */
+#define MISC_REG_SW_TIMER_VAL                                   0xa5c0
 /* [RW 1] Set by the MCP to remember if one or more of the drivers is/are
    loaded; 0-prepare; -unprepare */
 #define MISC_REG_UNPREPARED                                     0xa424
 /* [RW 4] led mode for port0: 0 MAC; 1-3 PHY1; 4 MAC2; 5-7 PHY4; 8-MAC3;
    9-11PHY7; 12 MAC4; 13-15 PHY10; */
 #define NIG_REG_LED_MODE_P0                                     0x102f0
+/* [RW 3] for port0 enable for llfc ppp and pause. b0 - brb1 enable; b1-
+   tsdm enable; b2- usdm enable */
+#define NIG_REG_LLFC_EGRESS_SRC_ENABLE_0                        0x16070
+/* [RW 1] SAFC enable for port0. This register may get 1 only when
+   ~ppp_enable.ppp_enable = 0 and pause_enable.pause_enable =0 for the same
+   port */
+#define NIG_REG_LLFC_ENABLE_0                                   0x16208
+/* [RW 16] classes are high-priority for port0 */
+#define NIG_REG_LLFC_HIGH_PRIORITY_CLASSES_0                    0x16058
+/* [RW 16] classes are low-priority for port0 */
+#define NIG_REG_LLFC_LOW_PRIORITY_CLASSES_0                     0x16060
+/* [RW 1] Output enable of message to LLFC BMAC IF for port0 */
+#define NIG_REG_LLFC_OUT_EN_0                                   0x160c8
 #define NIG_REG_LLH0_ACPI_PAT_0_CRC                             0x1015c
 #define NIG_REG_LLH0_ACPI_PAT_6_LEN                             0x10154
 #define NIG_REG_LLH0_BRB1_DRV_MASK                              0x10244
 #define NIG_REG_NIG_INT_STS_1                                   0x103c0
 /* [R 32] Parity register #0 read */
 #define NIG_REG_NIG_PRTY_STS                                    0x103d0
+/* [RW 1] Pause enable for port0. This register may get 1 only when
+   ~safc_enable.safc_enable = 0 and ppp_enable.ppp_enable =0 for the same
+   port */
+#define NIG_REG_PAUSE_ENABLE_0                                  0x160c0
 /* [RW 1] Input enable for RX PBF LP IF */
 #define NIG_REG_PBF_LB_IN_EN                                    0x100b4
 /* [RW 1] Value of this register will be transmitted to port swap when
 #define NIG_REG_PRS_EOP_OUT_EN                                  0x10104
 /* [RW 1] Input enable for RX parser request IF */
 #define NIG_REG_PRS_REQ_IN_EN                                   0x100b8
+/* [RW 5] control to serdes - CL45 DEVAD */
+#define NIG_REG_SERDES0_CTRL_MD_DEVAD                           0x10370
+/* [RW 1] control to serdes; 0 - clause 45; 1 - clause 22 */
+#define NIG_REG_SERDES0_CTRL_MD_ST                              0x1036c
 /* [RW 5] control to serdes - CL22 PHY_ADD and CL45 PRTAD */
 #define NIG_REG_SERDES0_CTRL_PHY_ADDR                           0x10374
 /* [R 1] status from serdes0 that inputs to interrupt logic of link status */
 #define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_2                        0x400e4
 #define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_3                        0x400e8
 #define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_4                        0x400ec
+#define PRS_REG_CM_HDR_FLUSH_LOAD_TYPE_5                        0x400f0
 /* [RW 32] The CM header for flush message where 'load existed' bit in CFC
    load response is set and packet type is 0. Used in packet start message
    to TCM. */
 #define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_2                     0x400c4
 #define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_3                     0x400c8
 #define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_4                     0x400cc
+#define PRS_REG_CM_HDR_FLUSH_NO_LOAD_TYPE_5                     0x400d0
 /* [RW 32] The CM header for a match and packet type 1 for loopback port.
    Used in packet start message to TCM. */
 #define PRS_REG_CM_HDR_LOOPBACK_TYPE_1                          0x4009c
 #define PXP2_REG_PGL_INT_XSDM_5                                 0x1204e8
 #define PXP2_REG_PGL_INT_XSDM_6                                 0x1204ec
 #define PXP2_REG_PGL_INT_XSDM_7                                 0x1204f0
+/* [RW 3] this field allows one function to pretend being another function
+   when accessing any BAR mapped resource within the device. the value of
+   the field is the number of the function that will be accessed
+   effectively. after software write to this bit it must read it in order to
+   know that the new value is updated */
+#define PXP2_REG_PGL_PRETEND_FUNC_F0                            0x120674
+#define PXP2_REG_PGL_PRETEND_FUNC_F1                            0x120678
+#define PXP2_REG_PGL_PRETEND_FUNC_F2                            0x12067c
+#define PXP2_REG_PGL_PRETEND_FUNC_F3                            0x120680
+#define PXP2_REG_PGL_PRETEND_FUNC_F4                            0x120684
+#define PXP2_REG_PGL_PRETEND_FUNC_F5                            0x120688
+#define PXP2_REG_PGL_PRETEND_FUNC_F6                            0x12068c
+#define PXP2_REG_PGL_PRETEND_FUNC_F7                            0x120690
 /* [R 1] this bit indicates that a read request was blocked because of
    bus_master_en was deasserted */
 #define PXP2_REG_PGL_READ_BLOCKED                               0x120568
    considered zero so practically there are only 20 bits in this register;
    queues 63-0 */
 #define QM_REG_BASEADDR                                         0x168900
+/* [RW 32] The base logical address (in bytes) of each physical queue. The
+   index I represents the physical queue number. The 12 lsbs are ignore and
+   considered zero so practically there are only 20 bits in this register;
+   queues 127-64 */
+#define QM_REG_BASEADDR_EXT_A                                   0x16e100
 /* [RW 16] The byte credit cost for each task. This value is for both ports */
 #define QM_REG_BYTECRDCOST                                      0x168234
 /* [RW 16] The initial byte credit value for both ports. */
 #define SRC_REG_KEYRSS0_0                                       0x40408
 #define SRC_REG_KEYRSS0_7                                       0x40424
 #define SRC_REG_KEYRSS1_9                                       0x40454
+#define SRC_REG_KEYSEARCH_0                                     0x40458
+#define SRC_REG_KEYSEARCH_1                                     0x4045c
+#define SRC_REG_KEYSEARCH_2                                     0x40460
+#define SRC_REG_KEYSEARCH_3                                     0x40464
+#define SRC_REG_KEYSEARCH_4                                     0x40468
+#define SRC_REG_KEYSEARCH_5                                     0x4046c
+#define SRC_REG_KEYSEARCH_6                                     0x40470
+#define SRC_REG_KEYSEARCH_7                                     0x40474
+#define SRC_REG_KEYSEARCH_8                                     0x40478
+#define SRC_REG_KEYSEARCH_9                                     0x4047c
 #define SRC_REG_LASTFREE0                                       0x40530
 #define SRC_REG_NUMBER_HASH_BITS0                               0x40400
 /* [RW 1] Reset internal state machines. */
 /* [RC 1] Message length mismatch (relative to last indication) at the In#9
    interface. */
 #define TCM_REG_CSEM_LENGTH_MIS                                 0x50174
+/* [RW 3] The weight of the input csem in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define TCM_REG_CSEM_WEIGHT                                     0x500bc
 /* [RW 8] The Event ID in case of ErrorFlg is set in the input message. */
 #define TCM_REG_ERR_EVNT_ID                                     0x500a0
 /* [RW 28] The CM erroneous header for QM and Timers formatting. */
 #define TCM_REG_N_SM_CTX_LD_2                                   0x50058
 #define TCM_REG_N_SM_CTX_LD_3                                   0x5005c
 #define TCM_REG_N_SM_CTX_LD_4                                   0x50060
+#define TCM_REG_N_SM_CTX_LD_5                                   0x50064
 /* [RW 1] Input pbf Interface enable. If 0 - the valid input is disregarded;
    acknowledge output is deasserted; all other signals are treated as usual;
    if 1 - normal activity. */
    disregarded; acknowledge output is deasserted; all other signals are
    treated as usual; if 1 - normal activity. */
 #define TCM_REG_STORM_TCM_IFEN                                  0x50010
+/* [RW 3] The weight of the STORM input in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define TCM_REG_STORM_WEIGHT                                    0x500ac
 /* [RW 1] CM - CFC Interface enable. If 0 - the valid input is disregarded;
    acknowledge output is deasserted; all other signals are treated as usual;
    if 1 - normal activity. */
    disregarded; acknowledge output is deasserted; all other signals are
    treated as usual; if 1 - normal activity. */
 #define TCM_REG_TM_TCM_IFEN                                     0x5001c
+/* [RW 3] The weight of the Timers input in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define TCM_REG_TM_WEIGHT                                       0x500d0
 /* [RW 6] QM output initial credit. Max credit available - 32.Write writes
    the initial credit value; read returns the current value of the credit
    counter. Must be initialized to 32 at start-up. */
 #define TCM_REG_TQM_INIT_CRD                                    0x5021c
+/* [RW 3] The weight of the QM (primary) input in the WRR mechanism. 0
+   stands for weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define TCM_REG_TQM_P_WEIGHT                                    0x500c8
+/* [RW 3] The weight of the QM (secondary) input in the WRR mechanism. 0
+   stands for weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define TCM_REG_TQM_S_WEIGHT                                    0x500cc
 /* [RW 28] The CM header value for QM request (primary). */
 #define TCM_REG_TQM_TCM_HDR_P                                   0x50090
 /* [RW 28] The CM header value for QM request (secondary). */
 /* [RC 1] Message length mismatch (relative to last indication) at the In#8
    interface. */
 #define TCM_REG_USEM_LENGTH_MIS                                 0x50170
+/* [RW 3] The weight of the input usem in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define TCM_REG_USEM_WEIGHT                                     0x500b8
 /* [RW 21] Indirect access to the descriptor table of the XX protection
    mechanism. The fields are: [5:0] - length of the message; 15:6] - message
    pointer; 20:16] - next pointer. */
 #define TM_REG_EN_CL1_INPUT                                     0x16400c
 /* [RW 1] Enable client2 input. */
 #define TM_REG_EN_CL2_INPUT                                     0x164010
+#define TM_REG_EN_LINEAR0_TIMER                                 0x164014
 /* [RW 1] Enable real time counter. */
 #define TM_REG_EN_REAL_TIME_CNT                                 0x1640d8
 /* [RW 1] Enable for Timers state machines. */
 /* [RW 4] Load value for expiration credit cnt. CFC max number of
    outstanding load requests for timers (expiration) context loading. */
 #define TM_REG_EXP_CRDCNT_VAL                                   0x164238
+/* [RW 32] Linear0 logic address. */
+#define TM_REG_LIN0_LOGIC_ADDR                                  0x164240
 /* [RW 18] Linear0 Max active cid (in banks of 32 entries). */
 #define TM_REG_LIN0_MAX_ACTIVE_CID                              0x164048
 /* [WB 64] Linear0 phy address. */
 #define TM_REG_LIN0_PHY_ADDR                                    0x164270
+/* [RW 1] Linear0 physical address valid. */
+#define TM_REG_LIN0_PHY_ADDR_VALID                              0x164248
 /* [RW 24] Linear0 array scan timeout. */
 #define TM_REG_LIN0_SCAN_TIME                                   0x16403c
+/* [RW 32] Linear1 logic address. */
+#define TM_REG_LIN1_LOGIC_ADDR                                  0x164250
 /* [WB 64] Linear1 phy address. */
 #define TM_REG_LIN1_PHY_ADDR                                    0x164280
+/* [RW 1] Linear1 physical address valid. */
+#define TM_REG_LIN1_PHY_ADDR_VALID                              0x164258
 /* [RW 6] Linear timer set_clear fifo threshold. */
 #define TM_REG_LIN_SETCLR_FIFO_ALFULL_THR                       0x164070
 /* [RW 2] Load value for pci arbiter credit cnt. */
 #define TM_REG_TM_INT_STS                                       0x1640f0
 /* [RW 8] The event id for aggregated interrupt 0 */
 #define TSDM_REG_AGG_INT_EVENT_0                                0x42038
+#define TSDM_REG_AGG_INT_EVENT_1                                0x4203c
+#define TSDM_REG_AGG_INT_EVENT_10                               0x42060
+#define TSDM_REG_AGG_INT_EVENT_11                               0x42064
+#define TSDM_REG_AGG_INT_EVENT_12                               0x42068
+#define TSDM_REG_AGG_INT_EVENT_13                               0x4206c
+#define TSDM_REG_AGG_INT_EVENT_14                               0x42070
+#define TSDM_REG_AGG_INT_EVENT_15                               0x42074
+#define TSDM_REG_AGG_INT_EVENT_16                               0x42078
+#define TSDM_REG_AGG_INT_EVENT_17                               0x4207c
+#define TSDM_REG_AGG_INT_EVENT_18                               0x42080
+#define TSDM_REG_AGG_INT_EVENT_19                               0x42084
 #define TSDM_REG_AGG_INT_EVENT_2                                0x42040
 #define TSDM_REG_AGG_INT_EVENT_20                               0x42088
 #define TSDM_REG_AGG_INT_EVENT_21                               0x4208c
 #define TSDM_REG_AGG_INT_EVENT_30                               0x420b0
 #define TSDM_REG_AGG_INT_EVENT_31                               0x420b4
 #define TSDM_REG_AGG_INT_EVENT_4                                0x42048
+/* [RW 1] The T bit for aggregated interrupt 0 */
+#define TSDM_REG_AGG_INT_T_0                                    0x420b8
+#define TSDM_REG_AGG_INT_T_1                                    0x420bc
+#define TSDM_REG_AGG_INT_T_10                                   0x420e0
+#define TSDM_REG_AGG_INT_T_11                                   0x420e4
+#define TSDM_REG_AGG_INT_T_12                                   0x420e8
+#define TSDM_REG_AGG_INT_T_13                                   0x420ec
+#define TSDM_REG_AGG_INT_T_14                                   0x420f0
+#define TSDM_REG_AGG_INT_T_15                                   0x420f4
+#define TSDM_REG_AGG_INT_T_16                                   0x420f8
+#define TSDM_REG_AGG_INT_T_17                                   0x420fc
+#define TSDM_REG_AGG_INT_T_18                                   0x42100
+#define TSDM_REG_AGG_INT_T_19                                   0x42104
 /* [RW 13] The start address in the internal RAM for the cfc_rsp lcid */
 #define TSDM_REG_CFC_RSP_START_ADDR                             0x42008
 /* [RW 16] The maximum value of the competion counter #0 */
 /* [RC 1] Set when the message length mismatch (relative to last indication)
    at the dorq interface is detected. */
 #define UCM_REG_DORQ_LENGTH_MIS                                 0xe0168
+/* [RW 3] The weight of the input dorq in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define UCM_REG_DORQ_WEIGHT                                     0xe00c0
 /* [RW 8] The Event ID in case ErrorFlg input message bit is set. */
 #define UCM_REG_ERR_EVNT_ID                                     0xe00a4
 /* [RW 28] The CM erroneous header for QM and Timers formatting. */
    disregarded; acknowledge output is deasserted; all other signals are
    treated as usual; if 1 - normal activity. */
 #define UCM_REG_STORM_UCM_IFEN                                  0xe0010
+/* [RW 3] The weight of the STORM input in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define UCM_REG_STORM_WEIGHT                                    0xe00b0
 /* [RW 4] Timers output initial credit. Max credit available - 15.Write
    writes the initial credit value; read returns the current value of the
    credit counter. Must be initialized to 4 at start-up. */
    disregarded; acknowledge output is deasserted; all other signals are
    treated as usual; if 1 - normal activity. */
 #define UCM_REG_TM_UCM_IFEN                                     0xe001c
+/* [RW 3] The weight of the Timers input in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define UCM_REG_TM_WEIGHT                                       0xe00d4
 /* [RW 1] Input tsem Interface enable. If 0 - the valid input is
    disregarded; acknowledge output is deasserted; all other signals are
    treated as usual; if 1 - normal activity. */
    stands for weight 8 (the most prioritised); 1 stands for weight 1(least
    prioritised); 2 stands for weight 2; tc. */
 #define UCM_REG_UQM_P_WEIGHT                                    0xe00cc
+/* [RW 3] The weight of the QM (secondary) input in the WRR mechanism. 0
+   stands for weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define UCM_REG_UQM_S_WEIGHT                                    0xe00d0
 /* [RW 28] The CM header value for QM request (primary). */
 #define UCM_REG_UQM_UCM_HDR_P                                   0xe0094
 /* [RW 28] The CM header value for QM request (secondary). */
 /* [RC 1] Set when the message length mismatch (relative to last indication)
    at the SDM interface is detected. */
 #define UCM_REG_USDM_LENGTH_MIS                                 0xe0158
+/* [RW 3] The weight of the SDM input in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define UCM_REG_USDM_WEIGHT                                     0xe00c8
 /* [RW 1] Input xsem Interface enable. If 0 - the valid input is
    disregarded; acknowledge output is deasserted; all other signals are
    treated as usual; if 1 - normal activity. */
 /* [RC 1] Set when the message length mismatch (relative to last indication)
    at the xsem interface isdetected. */
 #define UCM_REG_XSEM_LENGTH_MIS                                 0xe0164
+/* [RW 3] The weight of the input xsem in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define UCM_REG_XSEM_WEIGHT                                     0xe00bc
 /* [RW 20] Indirect access to the descriptor table of the XX protection
    mechanism. The fields are:[5:0] - message length; 14:6] - message
    pointer; 19:15] - next pointer. */
 #define USDM_REG_AGG_INT_EVENT_30                               0xc40b0
 #define USDM_REG_AGG_INT_EVENT_31                               0xc40b4
 #define USDM_REG_AGG_INT_EVENT_4                                0xc4048
+#define USDM_REG_AGG_INT_EVENT_5                                0xc404c
 /* [RW 1] For each aggregated interrupt index whether the mode is normal (0)
    or auto-mask-mode (1) */
 #define USDM_REG_AGG_INT_MODE_0                                 0xc41b8
 #define USDM_REG_AGG_INT_MODE_17                                0xc41fc
 #define USDM_REG_AGG_INT_MODE_18                                0xc4200
 #define USDM_REG_AGG_INT_MODE_19                                0xc4204
+#define USDM_REG_AGG_INT_MODE_4                                 0xc41c8
+#define USDM_REG_AGG_INT_MODE_5                                 0xc41cc
 /* [RW 13] The start address in the internal RAM for the cfc_rsp lcid */
 #define USDM_REG_CFC_RSP_START_ADDR                             0xc4008
 /* [RW 16] The maximum value of the competion counter #0 */
 /* [RC 1] Set at message length mismatch (relative to last indication) at
    the dorq interface. */
 #define XCM_REG_DORQ_LENGTH_MIS                                 0x20230
+/* [RW 3] The weight of the input dorq in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define XCM_REG_DORQ_WEIGHT                                     0x200cc
 /* [RW 8] The Event ID in case the ErrorFlg input message bit is set. */
 #define XCM_REG_ERR_EVNT_ID                                     0x200b0
 /* [RW 28] The CM erroneous header for QM and Timers formatting. */
 /* [RC 1] Set at message length mismatch (relative to last indication) at
    the nig0 interface. */
 #define XCM_REG_NIG0_LENGTH_MIS                                 0x20238
+/* [RW 3] The weight of the input nig0 in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define XCM_REG_NIG0_WEIGHT                                     0x200d4
 /* [RW 1] Input nig1 Interface enable. If 0 - the valid input is
    disregarded; acknowledge output is deasserted; all other signals are
    treated as usual; if 1 - normal activity. */
    writes the initial credit value; read returns the current value of the
    credit counter. Must be initialized to 4 at start-up. */
 #define XCM_REG_TM_INIT_CRD                                     0x2041c
+/* [RW 3] The weight of the Timers input in the WRR mechanism. 0 stands for
+   weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define XCM_REG_TM_WEIGHT                                       0x200ec
 /* [RW 28] The CM header for Timers expiration command. */
 #define XCM_REG_TM_XCM_HDR                                      0x200a8
 /* [RW 1] Timers - CM Interface enable. If 0 - the valid input is
    stands for weight 8 (the most prioritised); 1 stands for weight 1(least
    prioritised); 2 stands for weight 2; tc. */
 #define XCM_REG_XQM_P_WEIGHT                                    0x200e4
+/* [RW 3] The weight of the QM (secondary) input in the WRR mechanism. 0
+   stands for weight 8 (the most prioritised); 1 stands for weight 1(least
+   prioritised); 2 stands for weight 2; tc. */
+#define XCM_REG_XQM_S_WEIGHT                                    0x200e8
 /* [RW 28] The CM header value for QM request (primary). */
 #define XCM_REG_XQM_XCM_HDR_P                                   0x200a0
 /* [RW 28] The CM header value for QM request (secondary). */
 #define XSDM_REG_AGG_INT_EVENT_10                               0x166060
 #define XSDM_REG_AGG_INT_EVENT_11                               0x166064
 #define XSDM_REG_AGG_INT_EVENT_12                               0x166068
+#define XSDM_REG_AGG_INT_EVENT_13                               0x16606c
+#define XSDM_REG_AGG_INT_EVENT_14                               0x166070
 #define XSDM_REG_AGG_INT_EVENT_2                                0x166040
 #define XSDM_REG_AGG_INT_EVENT_20                               0x166088
 #define XSDM_REG_AGG_INT_EVENT_21                               0x16608c
 #define EMAC_RX_MODE_FLOW_EN                                    (1L<<2)
 #define EMAC_RX_MODE_KEEP_VLAN_TAG                              (1L<<10)
 #define EMAC_RX_MODE_PROMISCUOUS                                (1L<<8)
+#define EMAC_RX_MODE_RESET                                      (1L<<0)
 #define EMAC_RX_MTU_SIZE_JUMBO_ENA                              (1L<<31)
 #define EMAC_TX_MODE_EXT_PAUSE_EN                               (1L<<3)
 #define EMAC_TX_MODE_FLOW_EN                                    (1L<<4)
+#define EMAC_TX_MODE_RESET                                      (1L<<0)
 #define MISC_REGISTERS_GPIO_0                                   0
 #define MISC_REGISTERS_GPIO_1                                   1
 #define MISC_REGISTERS_GPIO_2                                   2
 #define MISC_REGISTERS_GPIO_FLOAT_POS                           24
 #define MISC_REGISTERS_GPIO_HIGH                                1
 #define MISC_REGISTERS_GPIO_INPUT_HI_Z                          2
+#define MISC_REGISTERS_GPIO_INT_CLR_POS                         24
+#define MISC_REGISTERS_GPIO_INT_OUTPUT_CLR                      0
+#define MISC_REGISTERS_GPIO_INT_OUTPUT_SET                      1
+#define MISC_REGISTERS_GPIO_INT_SET_POS                         16
 #define MISC_REGISTERS_GPIO_LOW                                 0
 #define MISC_REGISTERS_GPIO_OUTPUT_HIGH                         1
 #define MISC_REGISTERS_GPIO_OUTPUT_LOW                          0
 #define MISC_REGISTERS_SPIO_OUTPUT_LOW                          0
 #define MISC_REGISTERS_SPIO_SET_POS                             8
 #define HW_LOCK_MAX_RESOURCE_VALUE                              31
-#define HW_LOCK_RESOURCE_8072_MDIO                              0
 #define HW_LOCK_RESOURCE_GPIO                                   1
+#define HW_LOCK_RESOURCE_MDIO                                   0
 #define HW_LOCK_RESOURCE_PORT0_ATT_MASK                         3
 #define HW_LOCK_RESOURCE_SPIO                                   2
 #define HW_LOCK_RESOURCE_UNDI                                   5
+#define PRS_FLAG_OVERETH_IPV4                                   1
 #define AEU_INPUTS_ATTN_BITS_BRB_PARITY_ERROR                (1<<18)
 #define AEU_INPUTS_ATTN_BITS_CCM_HW_INTERRUPT                (1<<31)
 #define AEU_INPUTS_ATTN_BITS_CDU_HW_INTERRUPT                (1<<9)
 #define AEU_INPUTS_ATTN_BITS_DMAE_HW_INTERRUPT               (1<<11)
 #define AEU_INPUTS_ATTN_BITS_DOORBELLQ_HW_INTERRUPT          (1<<13)
 #define AEU_INPUTS_ATTN_BITS_DOORBELLQ_PARITY_ERROR          (1<<12)
+#define AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_0                (1<<5)
+#define AEU_INPUTS_ATTN_BITS_GPIO3_FUNCTION_1                (1<<9)
 #define AEU_INPUTS_ATTN_BITS_IGU_PARITY_ERROR                (1<<12)
 #define AEU_INPUTS_ATTN_BITS_MISC_HW_INTERRUPT               (1<<15)
 #define AEU_INPUTS_ATTN_BITS_MISC_PARITY_ERROR               (1<<14)
 #define PCICFG_PM_CSR_STATE                    (0x3<<0)
 #define PCICFG_PM_CSR_PME_ENABLE               (1<<8)
 #define PCICFG_PM_CSR_PME_STATUS               (1<<15)
+#define PCICFG_MSI_CAP_ID                              0x58
+#define PCICFG_MSI_CONTROL_ENABLE              (0x1<<16)
+#define PCICFG_MSI_CONTROL_MCAP                (0x7<<17)
+#define PCICFG_MSI_CONTROL_MENA                (0x7<<20)
+#define PCICFG_MSI_CONTROL_64_BIT_ADDR_CAP     (0x1<<23)
+#define PCICFG_MSI_CONTROL_MSI_PVMASK_CAPABLE  (0x1<<24)
 #define PCICFG_GRC_ADDRESS                             0x78
 #define PCICFG_GRC_DATA                                0x80
+#define PCICFG_MSIX_CAP_ID                             0xa0
+#define PCICFG_MSIX_CONTROL_TABLE_SIZE         (0x7ff<<16)
+#define PCICFG_MSIX_CONTROL_RESERVED           (0x7<<27)
+#define PCICFG_MSIX_CONTROL_FUNC_MASK          (0x1<<30)
+#define PCICFG_MSIX_CONTROL_MSIX_ENABLE        (0x1<<31)
+
 #define PCICFG_DEVICE_CONTROL                          0xb4
+#define PCICFG_DEVICE_STATUS                           0xb6
+#define PCICFG_DEVICE_STATUS_CORR_ERR_DET      (1<<0)
+#define PCICFG_DEVICE_STATUS_NON_FATAL_ERR_DET (1<<1)
+#define PCICFG_DEVICE_STATUS_FATAL_ERR_DET     (1<<2)
+#define PCICFG_DEVICE_STATUS_UNSUP_REQ_DET     (1<<3)
+#define PCICFG_DEVICE_STATUS_AUX_PWR_DET       (1<<4)
+#define PCICFG_DEVICE_STATUS_NO_PEND           (1<<5)
 #define PCICFG_LINK_CONTROL                            0xbc
 
 
 #define MDIO_TX0_TX_DRIVER_IFULLSPD_SHIFT              1
 #define MDIO_TX0_TX_DRIVER_ICBUF1T                     1
 
+#define MDIO_REG_BANK_TX1                              0x8070
+#define MDIO_TX1_TX_DRIVER                             0x17
+#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK            0xf000
+#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_SHIFT           12
+#define MDIO_TX0_TX_DRIVER_IDRIVER_MASK                0x0f00
+#define MDIO_TX0_TX_DRIVER_IDRIVER_SHIFT               8
+#define MDIO_TX0_TX_DRIVER_IPREDRIVER_MASK             0x00f0
+#define MDIO_TX0_TX_DRIVER_IPREDRIVER_SHIFT            4
+#define MDIO_TX0_TX_DRIVER_IFULLSPD_MASK               0x000e
+#define MDIO_TX0_TX_DRIVER_IFULLSPD_SHIFT              1
+#define MDIO_TX0_TX_DRIVER_ICBUF1T                     1
+
+#define MDIO_REG_BANK_TX2                              0x8080
+#define MDIO_TX2_TX_DRIVER                             0x17
+#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK            0xf000
+#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_SHIFT           12
+#define MDIO_TX0_TX_DRIVER_IDRIVER_MASK                0x0f00
+#define MDIO_TX0_TX_DRIVER_IDRIVER_SHIFT               8
+#define MDIO_TX0_TX_DRIVER_IPREDRIVER_MASK             0x00f0
+#define MDIO_TX0_TX_DRIVER_IPREDRIVER_SHIFT            4
+#define MDIO_TX0_TX_DRIVER_IFULLSPD_MASK               0x000e
+#define MDIO_TX0_TX_DRIVER_IFULLSPD_SHIFT              1
+#define MDIO_TX0_TX_DRIVER_ICBUF1T                     1
+
+#define MDIO_REG_BANK_TX3                              0x8090
+#define MDIO_TX3_TX_DRIVER                             0x17
+#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_MASK            0xf000
+#define MDIO_TX0_TX_DRIVER_PREEMPHASIS_SHIFT           12
+#define MDIO_TX0_TX_DRIVER_IDRIVER_MASK                0x0f00
+#define MDIO_TX0_TX_DRIVER_IDRIVER_SHIFT               8
+#define MDIO_TX0_TX_DRIVER_IPREDRIVER_MASK             0x00f0
+#define MDIO_TX0_TX_DRIVER_IPREDRIVER_SHIFT            4
+#define MDIO_TX0_TX_DRIVER_IFULLSPD_MASK               0x000e
+#define MDIO_TX0_TX_DRIVER_IFULLSPD_SHIFT              1
+#define MDIO_TX0_TX_DRIVER_ICBUF1T                     1
+
 #define MDIO_REG_BANK_XGXS_BLOCK0                      0x8000
 #define MDIO_BLOCK0_XGXS_CONTROL                       0x10
 
@@ -5566,9 +5843,29 @@ Theotherbitsarereservedandshouldbezero*/
 #define MDIO_PMA_REG_ROM_VER2          0xca1a
 #define MDIO_PMA_REG_EDC_FFE_MAIN      0xca1b
 #define MDIO_PMA_REG_PLL_BANDWIDTH     0xca1d
+#define MDIO_PMA_REG_MISC_CTRL0        0xca23
+#define MDIO_PMA_REG_LRM_MODE          0xca3f
 #define MDIO_PMA_REG_CDR_BANDWIDTH     0xca46
 #define MDIO_PMA_REG_MISC_CTRL1        0xca85
 
+#define MDIO_PMA_REG_8726_TWO_WIRE_CTRL        0x8000
+#define MDIO_PMA_REG_8726_TWO_WIRE_CTRL_STATUS_MASK    0x000c
+#define MDIO_PMA_REG_8726_TWO_WIRE_STATUS_IDLE         0x0000
+#define MDIO_PMA_REG_8726_TWO_WIRE_STATUS_COMPLETE     0x0004
+#define MDIO_PMA_REG_8726_TWO_WIRE_STATUS_IN_PROGRESS  0x0008
+#define MDIO_PMA_REG_8726_TWO_WIRE_STATUS_FAILED       0x000c
+#define MDIO_PMA_REG_8726_TWO_WIRE_BYTE_CNT    0x8002
+#define MDIO_PMA_REG_8726_TWO_WIRE_MEM_ADDR    0x8003
+#define MDIO_PMA_REG_8726_TWO_WIRE_DATA_BUF    0xc820
+#define MDIO_PMA_REG_8726_TWO_WIRE_DATA_MASK 0xff
+#define MDIO_PMA_REG_8726_TX_CTRL1             0xca01
+#define MDIO_PMA_REG_8726_TX_CTRL2             0xca05
+
+
+#define MDIO_PMA_REG_8073_CHIP_REV                     0xc801
+#define MDIO_PMA_REG_8073_SPEED_LINK_STATUS            0xc820
+#define MDIO_PMA_REG_8073_XAUI_WA                      0xc841
+
 #define MDIO_PMA_REG_7101_RESET        0xc000
 #define MDIO_PMA_REG_7107_LED_CNTL     0xc007
 #define MDIO_PMA_REG_7101_VER1         0xc026
@@ -5598,6 +5895,12 @@ Theotherbitsarereservedandshouldbezero*/
 #define MDIO_XS_PLL_SEQUENCER          0x8000
 #define MDIO_XS_SFX7101_XGXS_TEST1     0xc00a
 
+#define MDIO_XS_8706_REG_BANK_RX0      0x80bc
+#define MDIO_XS_8706_REG_BANK_RX1      0x80cc
+#define MDIO_XS_8706_REG_BANK_RX2      0x80dc
+#define MDIO_XS_8706_REG_BANK_RX3      0x80ec
+#define MDIO_XS_8706_REG_BANK_RXA      0x80fc
+
 #define MDIO_AN_DEVAD                  0x7
 /*ieee*/
 #define MDIO_AN_REG_CTRL               0x0000
@@ -5619,6 +5922,8 @@ Theotherbitsarereservedandshouldbezero*/
 #define MDIO_AN_REG_CL37_FC_LD         0xffe4
 #define MDIO_AN_REG_CL37_FC_LP         0xffe5
 
+#define MDIO_AN_REG_8073_2_5G          0x8329
+
 
 #define IGU_FUNC_BASE                  0x0400
 
index 8a83eb283c21c8abecb64047be80a72faaa611b5..a306230381c8f69c0ba83523430a16cfb1bef8a3 100644 (file)
@@ -29,7 +29,7 @@
 
 // General definitions
 #define BOND_ETH_P_LACPDU       0x8809
-#define PKT_TYPE_LACPDU         __constant_htons(BOND_ETH_P_LACPDU)
+#define PKT_TYPE_LACPDU         cpu_to_be16(BOND_ETH_P_LACPDU)
 #define AD_TIMER_INTERVAL       100 /*msec*/
 
 #define MULTICAST_LACPDU_ADDR    {0x01, 0x80, 0xC2, 0x00, 0x00, 0x02}
index 27fb7f5c21cf57029b62d830ada44b6f26904dac..8dc6fbb9a41e749cdb6a6f7e9e3b99790e811495 100644 (file)
@@ -822,7 +822,7 @@ static int rlb_initialize(struct bonding *bond)
        _unlock_rx_hashtbl(bond);
 
        /*initialize packet type*/
-       pk_type->type = __constant_htons(ETH_P_ARP);
+       pk_type->type = cpu_to_be16(ETH_P_ARP);
        pk_type->dev = NULL;
        pk_type->func = rlb_arp_recv;
 
@@ -892,7 +892,7 @@ static void alb_send_learning_packets(struct slave *slave, u8 mac_addr[])
        memset(&pkt, 0, size);
        memcpy(pkt.mac_dst, mac_addr, ETH_ALEN);
        memcpy(pkt.mac_src, mac_addr, ETH_ALEN);
-       pkt.type = __constant_htons(ETH_P_LOOP);
+       pkt.type = cpu_to_be16(ETH_P_LOOP);
 
        for (i = 0; i < MAX_LP_BURST; i++) {
                struct sk_buff *skb;
@@ -1628,6 +1628,10 @@ void bond_alb_handle_link_change(struct bonding *bond, struct slave *slave, char
  * no other locks may be held.
  */
 void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave)
+       __releases(&bond->curr_slave_lock)
+       __releases(&bond->lock)
+       __acquires(&bond->lock)
+       __acquires(&bond->curr_slave_lock)
 {
        struct slave *swap_slave;
        int i;
@@ -1704,6 +1708,10 @@ void bond_alb_handle_active_change(struct bonding *bond, struct slave *new_slave
  * Called with RTNL
  */
 int bond_alb_set_mac_address(struct net_device *bond_dev, void *addr)
+       __releases(&bond->curr_slave_lock)
+       __releases(&bond->lock)
+       __acquires(&bond->lock)
+       __acquires(&bond->curr_slave_lock)
 {
        struct bonding *bond = netdev_priv(bond_dev);
        struct sockaddr *sa = addr;
index 9fb388388fb72e6990e697843ac68158fb565bf0..2c96b93b12a5780209bf0c5a894c30903d1175c3 100644 (file)
@@ -1002,6 +1002,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active, struct
 static void bond_do_fail_over_mac(struct bonding *bond,
                                  struct slave *new_active,
                                  struct slave *old_active)
+       __releases(&bond->curr_slave_lock)
+       __releases(&bond->lock)
+       __acquires(&bond->lock)
+       __acquires(&bond->curr_slave_lock)
 {
        u8 tmp_mac[ETH_ALEN];
        struct sockaddr saddr;
@@ -3193,6 +3197,8 @@ out:
 #ifdef CONFIG_PROC_FS
 
 static void *bond_info_seq_start(struct seq_file *seq, loff_t *pos)
+       __acquires(&dev_base_lock)
+       __acquires(&bond->lock)
 {
        struct bonding *bond = seq->private;
        loff_t off = 0;
@@ -3232,6 +3238,8 @@ static void *bond_info_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 }
 
 static void bond_info_seq_stop(struct seq_file *seq, void *v)
+       __releases(&bond->lock)
+       __releases(&dev_base_lock)
 {
        struct bonding *bond = seq->private;
 
@@ -3369,7 +3377,7 @@ static int bond_info_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static struct seq_operations bond_info_seq_ops = {
+static const struct seq_operations bond_info_seq_ops = {
        .start = bond_info_seq_start,
        .next  = bond_info_seq_next,
        .stop  = bond_info_seq_stop,
@@ -4724,7 +4732,7 @@ static void bond_free_all(void)
  */
 int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
 {
-       int mode = -1, i, rv;
+       int modeint = -1, i, rv;
        char *p, modestr[BOND_MAX_MODENAME_LEN + 1] = { 0, };
 
        for (p = (char *)buf; *p; p++)
@@ -4734,13 +4742,13 @@ int bond_parse_parm(const char *buf, const struct bond_parm_tbl *tbl)
        if (*p)
                rv = sscanf(buf, "%20s", modestr);
        else
-               rv = sscanf(buf, "%d", &mode);
+               rv = sscanf(buf, "%d", &modeint);
 
        if (!rv)
                return -1;
 
        for (i = 0; tbl[i].modename; i++) {
-               if (mode == tbl[i].mode)
+               if (modeint == tbl[i].mode)
                        return tbl[i].mode;
                if (strcmp(modestr, tbl[i].modename) == 0)
                        return tbl[i].mode;
index bbbc3bb08aa54a2bcb52e80b7c9df860d1a42f16..0effefa1b882036813a3b5e2401ed4b4fc126888 100644 (file)
@@ -2506,7 +2506,7 @@ static irqreturn_t cas_interruptN(int irq, void *dev_id)
        if (status & INTR_RX_DONE_ALT) { /* handle rx separately */
 #ifdef USE_NAPI
                cas_mask_intr(cp);
-               netif_rx_schedule(&cp->napi);
+               napi_schedule(&cp->napi);
 #else
                cas_rx_ringN(cp, ring, 0);
 #endif
@@ -2557,7 +2557,7 @@ static irqreturn_t cas_interrupt1(int irq, void *dev_id)
        if (status & INTR_RX_DONE_ALT) { /* handle rx separately */
 #ifdef USE_NAPI
                cas_mask_intr(cp);
-               netif_rx_schedule(&cp->napi);
+               napi_schedule(&cp->napi);
 #else
                cas_rx_ringN(cp, 1, 0);
 #endif
@@ -2613,7 +2613,7 @@ static irqreturn_t cas_interrupt(int irq, void *dev_id)
        if (status & INTR_RX_DONE) {
 #ifdef USE_NAPI
                cas_mask_intr(cp);
-               netif_rx_schedule(&cp->napi);
+               napi_schedule(&cp->napi);
 #else
                cas_rx_ringN(cp, 0, 0);
 #endif
@@ -2691,7 +2691,7 @@ rx_comp:
 #endif
        spin_unlock_irqrestore(&cp->lock, flags);
        if (enable_intr) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                cas_unmask_intr(cp);
        }
        return credits;
index d984b799576373f1c7a7064d8180f476f8870f48..840da83fb3cf46669515ba8b6d849aa942d14374 100644 (file)
@@ -1612,7 +1612,7 @@ int t1_poll(struct napi_struct *napi, int budget)
        int work_done = process_responses(adapter, budget);
 
        if (likely(work_done < budget)) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                writel(adapter->sge->respQ.cidx,
                       adapter->regs + A_SG_SLEEPING);
        }
@@ -1630,7 +1630,7 @@ irqreturn_t t1_interrupt(int irq, void *data)
 
                if (napi_schedule_prep(&adapter->napi)) {
                        if (process_pure_responses(adapter))
-                               __netif_rx_schedule(&adapter->napi);
+                               __napi_schedule(&adapter->napi);
                        else {
                                /* no data, no NAPI needed */
                                writel(sge->respQ.cidx, adapter->regs + A_SG_SLEEPING);
index f66548751c384c1bf111f69b995dd701aa60b713..3f476c7c07365ab0d2bfcda55d0a86435d9096d8 100644 (file)
@@ -428,7 +428,7 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
                        printk(KERN_WARNING "%s: rx: polling, but no queue\n",
                               priv->dev->name);
                spin_unlock(&priv->rx_lock);
-               netif_rx_complete(napi);
+               napi_complete(napi);
                return 0;
        }
 
@@ -514,7 +514,7 @@ static int cpmac_poll(struct napi_struct *napi, int budget)
        if (processed == 0) {
                /* we ran out of packets to read,
                 * revert to interrupt-driven mode */
-               netif_rx_complete(napi);
+               napi_complete(napi);
                cpmac_write(priv->regs, CPMAC_RX_INT_ENABLE, 1);
                return 0;
        }
@@ -536,7 +536,7 @@ fatal_error:
        }
 
        spin_unlock(&priv->rx_lock);
-       netif_rx_complete(napi);
+       napi_complete(napi);
        netif_tx_stop_all_queues(priv->dev);
        napi_disable(&priv->napi);
 
@@ -802,9 +802,9 @@ static irqreturn_t cpmac_irq(int irq, void *dev_id)
 
        if (status & MAC_INT_RX) {
                queue = (status >> 8) & 7;
-               if (netif_rx_schedule_prep(&priv->napi)) {
+               if (napi_schedule_prep(&priv->napi)) {
                        cpmac_write(priv->regs, CPMAC_RX_INT_CLEAR, 1 << queue);
-                       __netif_rx_schedule(&priv->napi);
+                       __napi_schedule(&priv->napi);
                }
        }
 
@@ -1161,7 +1161,7 @@ static int __devinit cpmac_probe(struct platform_device *pdev)
        priv->msg_enable = netif_msg_init(debug_level, 0xff);
        memcpy(dev->dev_addr, pdata->dev_addr, sizeof(dev->dev_addr));
 
-       priv->phy = phy_connect(dev, cpmac_mii->phy_map[phy_id]->dev.bus_id,
+       priv->phy = phy_connect(dev, dev_name(&cpmac_mii->phy_map[phy_id]->dev),
                                &cpmac_adjust_link, 0, PHY_INTERFACE_MODE_MII);
        if (IS_ERR(priv->phy)) {
                if (netif_msg_drv(priv))
index a89d8cc512059001870ff122a9da174834041a1e..fbe15699584e537d6715a17d849acdb639296d7f 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/cache.h>
 #include <linux/mutex.h>
 #include <linux/bitops.h>
-#include <linux/inet_lro.h>
 #include "t3cdev.h"
 #include <asm/io.h>
 
@@ -178,15 +177,11 @@ enum {                            /* per port SGE statistics */
        SGE_PSTAT_TX_CSUM,      /* # of TX checksum offloads */
        SGE_PSTAT_VLANEX,       /* # of VLAN tag extractions */
        SGE_PSTAT_VLANINS,      /* # of VLAN tag insertions */
-       SGE_PSTAT_LRO_AGGR,     /* # of page chunks added to LRO sessions */
-       SGE_PSTAT_LRO_FLUSHED,  /* # of flushed LRO sessions */
-       SGE_PSTAT_LRO_NO_DESC,  /* # of overflown LRO sessions */
 
        SGE_PSTAT_MAX           /* must be last */
 };
 
-#define T3_MAX_LRO_SES 8
-#define T3_MAX_LRO_MAX_PKTS 64
+struct napi_gro_fraginfo;
 
 struct sge_qset {              /* an SGE queue set */
        struct adapter *adap;
@@ -194,12 +189,8 @@ struct sge_qset {          /* an SGE queue set */
        struct sge_rspq rspq;
        struct sge_fl fl[SGE_RXQ_PER_SET];
        struct sge_txq txq[SGE_TXQ_PER_SET];
-       struct net_lro_mgr lro_mgr;
-       struct net_lro_desc lro_desc[T3_MAX_LRO_SES];
-       struct skb_frag_struct *lro_frag_tbl;
-       int lro_nfrags;
+       struct napi_gro_fraginfo lro_frag_tbl;
        int lro_enabled;
-       int lro_frag_len;
        void *lro_va;
        struct net_device *netdev;
        struct netdev_queue *tx_q;      /* associated netdev TX queue */
@@ -230,6 +221,7 @@ struct adapter {
        unsigned int slow_intr_mask;
        unsigned long irq_stats[IRQ_NUM_STATS];
 
+       int msix_nvectors;
        struct {
                unsigned short vec;
                char desc[22];
index 5c3c05da4d96338e3f80e659c3c6e09d0017121b..e1b22490ff597e439bbb1deb90b3638d59dfdb6f 100644 (file)
@@ -1005,7 +1005,8 @@ static int ael2005_reset(struct cphy *phy, int wait)
                { 0, 0, 0, 0 }
        };
 
-       int err, lasi_ctrl;
+       int err;
+       unsigned int lasi_ctrl;
 
        err = mdio_read(phy, MDIO_DEV_PMA_PMD, LASI_CTRL, &lasi_ctrl);
        if (err)
index bab8a934c33d949127286fdc0ef07714bb7bb4b7..c32f514c41a7ef4c0785892b7f90ea5895f8bb26 100644 (file)
@@ -339,7 +339,7 @@ static void free_irq_resources(struct adapter *adapter)
 
                free_irq(adapter->msix_info[0].vec, adapter);
                for_each_port(adapter, i)
-                   n += adap2pinfo(adapter, i)->nqsets;
+                       n += adap2pinfo(adapter, i)->nqsets;
 
                for (i = 0; i < n; ++i)
                        free_irq(adapter->msix_info[i + 1].vec,
@@ -509,19 +509,9 @@ static void set_qset_lro(struct net_device *dev, int qset_idx, int val)
 {
        struct port_info *pi = netdev_priv(dev);
        struct adapter *adapter = pi->adapter;
-       int i, lro_on = 1;
 
        adapter->params.sge.qset[qset_idx].lro = !!val;
        adapter->sge.qs[qset_idx].lro_enabled = !!val;
-
-       /* let ethtool report LRO on only if all queues are LRO enabled */
-       for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; ++i)
-               lro_on &= adapter->params.sge.qset[i].lro;
-
-       if (lro_on)
-               dev->features |= NETIF_F_LRO;
-       else
-               dev->features &= ~NETIF_F_LRO;
 }
 
 /**
@@ -1434,9 +1424,9 @@ static void get_stats(struct net_device *dev, struct ethtool_stats *stats,
        *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_VLANINS);
        *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_TX_CSUM);
        *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_RX_CSUM_GOOD);
-       *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_LRO_AGGR);
-       *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_LRO_FLUSHED);
-       *data++ = collect_sge_port_stats(adapter, pi, SGE_PSTAT_LRO_NO_DESC);
+       *data++ = 0;
+       *data++ = 0;
+       *data++ = 0;
        *data++ = s->rx_cong_drops;
 
        *data++ = s->num_toggled;
@@ -1576,7 +1566,6 @@ static int speed_duplex_to_caps(int speed, int duplex)
 
 static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-       int cap;
        struct port_info *p = netdev_priv(dev);
        struct link_config *lc = &p->link_config;
 
@@ -1586,7 +1575,7 @@ static int set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
                 * being requested.
                 */
                if (cmd->autoneg == AUTONEG_DISABLE) {
-                       cap = speed_duplex_to_caps(cmd->speed, cmd->duplex);
+                       int cap = speed_duplex_to_caps(cmd->speed, cmd->duplex);
                        if (lc->supported & cap)
                                return 0;
                }
@@ -1827,28 +1816,6 @@ static void get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
        memset(&wol->sopass, 0, sizeof(wol->sopass));
 }
 
-static int cxgb3_set_flags(struct net_device *dev, u32 data)
-{
-       struct port_info *pi = netdev_priv(dev);
-       int i;
-
-       if (data & ETH_FLAG_LRO) {
-               if (!(pi->rx_offload & T3_RX_CSUM))
-                       return -EINVAL;
-
-               pi->rx_offload |= T3_LRO;
-               for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++)
-                       set_qset_lro(dev, i, 1);
-
-       } else {
-               pi->rx_offload &= ~T3_LRO;
-               for (i = pi->first_qset; i < pi->first_qset + pi->nqsets; i++)
-                       set_qset_lro(dev, i, 0);
-       }
-
-       return 0;
-}
-
 static const struct ethtool_ops cxgb_ethtool_ops = {
        .get_settings = get_settings,
        .set_settings = set_settings,
@@ -1878,8 +1845,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
        .get_regs = get_regs,
        .get_wol = get_wol,
        .set_tso = ethtool_op_set_tso,
-       .get_flags = ethtool_op_get_flags,
-       .set_flags = cxgb3_set_flags,
 };
 
 static int in_range(int val, int lo, int hi)
@@ -2577,6 +2542,12 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
 {
        int i, ret = 0;
 
+       if (is_offload(adapter) &&
+           test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map)) {
+               cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_DOWN, 0);
+               offload_close(&adapter->tdev);
+       }
+
        /* Stop all ports */
        for_each_port(adapter, i) {
                struct net_device *netdev = adapter->port[i];
@@ -2585,10 +2556,6 @@ static int t3_adapter_error(struct adapter *adapter, int reset)
                        cxgb_close(netdev);
        }
 
-       if (is_offload(adapter) &&
-           test_bit(OFFLOAD_DEVMAP_BIT, &adapter->open_device_map))
-               offload_close(&adapter->tdev);
-
        /* Stop SGE timers */
        t3_stop_sge_timers(adapter);
 
@@ -2640,6 +2607,9 @@ static void t3_resume_ports(struct adapter *adapter)
                        }
                }
        }
+
+       if (is_offload(adapter) && !ofld_disable)
+               cxgb3_err_notify(&adapter->tdev, OFFLOAD_STATUS_UP, 0);
 }
 
 /*
@@ -2753,7 +2723,7 @@ static void set_nqsets(struct adapter *adap)
        int i, j = 0;
        int num_cpus = num_online_cpus();
        int hwports = adap->params.nports;
-       int nqsets = SGE_QSETS;
+       int nqsets = adap->msix_nvectors - 1;
 
        if (adap->params.rev > 0 && adap->flags & USING_MSIX) {
                if (hwports == 2 &&
@@ -2782,18 +2752,25 @@ static void set_nqsets(struct adapter *adap)
 static int __devinit cxgb_enable_msix(struct adapter *adap)
 {
        struct msix_entry entries[SGE_QSETS + 1];
+       int vectors;
        int i, err;
 
-       for (i = 0; i < ARRAY_SIZE(entries); ++i)
+       vectors = ARRAY_SIZE(entries);
+       for (i = 0; i < vectors; ++i)
                entries[i].entry = i;
 
-       err = pci_enable_msix(adap->pdev, entries, ARRAY_SIZE(entries));
+       while ((err = pci_enable_msix(adap->pdev, entries, vectors)) > 0)
+               vectors = err;
+
+       if (!err && vectors < (adap->params.nports + 1))
+               err = -1;
+
        if (!err) {
-               for (i = 0; i < ARRAY_SIZE(entries); ++i)
+               for (i = 0; i < vectors; ++i)
                        adap->msix_info[i].vec = entries[i].vector;
-       } else if (err > 0)
-               dev_info(&adap->pdev->dev,
-                      "only %d MSI-X vectors left, not using MSI-X\n", err);
+               adap->msix_nvectors = vectors;
+       }
+
        return err;
 }
 
@@ -2961,7 +2938,7 @@ static int __devinit init_one(struct pci_dev *pdev,
                netdev->mem_end = mmio_start + mmio_len - 1;
                netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO;
                netdev->features |= NETIF_F_LLTX;
-               netdev->features |= NETIF_F_LRO;
+               netdev->features |= NETIF_F_GRO;
                if (pci_using_dac)
                        netdev->features |= NETIF_F_HIGHDMA;
 
index 2d7f69aff1d949a47e952997932800593444338e..620d80be6aacb1d3806d3f42f786c9f5b52bc6a3 100644 (file)
@@ -153,6 +153,18 @@ void cxgb3_remove_clients(struct t3cdev *tdev)
        mutex_unlock(&cxgb3_db_lock);
 }
 
+void cxgb3_err_notify(struct t3cdev *tdev, u32 status, u32 error)
+{
+       struct cxgb3_client *client;
+
+       mutex_lock(&cxgb3_db_lock);
+       list_for_each_entry(client, &client_list, client_list) {
+               if (client->err_handler)
+                       client->err_handler(tdev, status, error);
+       }
+       mutex_unlock(&cxgb3_db_lock);
+}
+
 static struct net_device *get_iff_from_mac(struct adapter *adapter,
                                           const unsigned char *mac,
                                           unsigned int vlan)
index d514e5019dfc36b0935bace2be32056b0ee4f272..a8e8e5fcdf84d55c5daa3aafd0f4d1081cab4f5a 100644 (file)
@@ -64,10 +64,16 @@ void cxgb3_register_client(struct cxgb3_client *client);
 void cxgb3_unregister_client(struct cxgb3_client *client);
 void cxgb3_add_clients(struct t3cdev *tdev);
 void cxgb3_remove_clients(struct t3cdev *tdev);
+void cxgb3_err_notify(struct t3cdev *tdev, u32 status, u32 error);
 
 typedef int (*cxgb3_cpl_handler_func)(struct t3cdev *dev,
                                      struct sk_buff *skb, void *ctx);
 
+enum {
+       OFFLOAD_STATUS_UP,
+       OFFLOAD_STATUS_DOWN
+};
+
 struct cxgb3_client {
        char *name;
        void (*add) (struct t3cdev *);
@@ -76,6 +82,7 @@ struct cxgb3_client {
        int (*redirect)(void *ctx, struct dst_entry *old,
                        struct dst_entry *new, struct l2t_entry *l2t);
        struct list_head client_list;
+       void (*err_handler)(struct t3cdev *tdev, u32 status, u32 error);
 };
 
 /*
index d31791f602924ca176c51ee612130b1b6d73967b..8205aa4ae945bee947e8613b5dd18f1208142f4e 100644 (file)
@@ -585,8 +585,7 @@ static void t3_reset_qset(struct sge_qset *q)
        memset(q->txq, 0, sizeof(struct sge_txq) * SGE_TXQ_PER_SET);
        q->txq_stopped = 0;
        q->tx_reclaim_timer.function = NULL; /* for t3_stop_sge_timers() */
-       kfree(q->lro_frag_tbl);
-       q->lro_nfrags = q->lro_frag_len = 0;
+       q->lro_frag_tbl.nr_frags = q->lro_frag_tbl.len = 0;
 }
 
 
@@ -1938,6 +1937,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
                skb->ip_summed = CHECKSUM_UNNECESSARY;
        } else
                skb->ip_summed = CHECKSUM_NONE;
+       skb_record_rx_queue(skb, qs - &adap->sge.qs[0]);
 
        if (unlikely(p->vlan_valid)) {
                struct vlan_group *grp = pi->vlan_grp;
@@ -1945,10 +1945,8 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
                qs->port_stats[SGE_PSTAT_VLANEX]++;
                if (likely(grp))
                        if (lro)
-                               lro_vlan_hwaccel_receive_skb(&qs->lro_mgr, skb,
-                                                            grp,
-                                                            ntohs(p->vlan),
-                                                            p);
+                               vlan_gro_receive(&qs->napi, grp,
+                                                ntohs(p->vlan), skb);
                        else {
                                if (unlikely(pi->iscsi_ipv4addr &&
                                    is_arp(skb))) {
@@ -1965,7 +1963,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
                        dev_kfree_skb_any(skb);
        } else if (rq->polling) {
                if (lro)
-                       lro_receive_skb(&qs->lro_mgr, skb, p);
+                       napi_gro_receive(&qs->napi, skb);
                else {
                        if (unlikely(pi->iscsi_ipv4addr && is_arp(skb)))
                                cxgb3_arp_process(adap, skb);
@@ -1980,59 +1978,6 @@ static inline int is_eth_tcp(u32 rss)
        return G_HASHTYPE(ntohl(rss)) == RSS_HASH_4_TUPLE;
 }
 
-/**
- *     lro_frame_ok - check if an ingress packet is eligible for LRO
- *     @p: the CPL header of the packet
- *
- *     Returns true if a received packet is eligible for LRO.
- *     The following conditions must be true:
- *     - packet is TCP/IP Ethernet II (checked elsewhere)
- *     - not an IP fragment
- *     - no IP options
- *     - TCP/IP checksums are correct
- *     - the packet is for this host
- */
-static inline int lro_frame_ok(const struct cpl_rx_pkt *p)
-{
-       const struct ethhdr *eh = (struct ethhdr *)(p + 1);
-       const struct iphdr *ih = (struct iphdr *)(eh + 1);
-
-       return (*((u8 *)p + 1) & 0x90) == 0x10 && p->csum == htons(0xffff) &&
-               eh->h_proto == htons(ETH_P_IP) && ih->ihl == (sizeof(*ih) >> 2);
-}
-
-static int t3_get_lro_header(void **eh,  void **iph, void **tcph,
-                            u64 *hdr_flags, void *priv)
-{
-       const struct cpl_rx_pkt *cpl = priv;
-
-       if (!lro_frame_ok(cpl))
-               return -1;
-
-       *eh = (struct ethhdr *)(cpl + 1);
-       *iph = (struct iphdr *)((struct ethhdr *)*eh + 1);
-       *tcph = (struct tcphdr *)((struct iphdr *)*iph + 1);
-
-       *hdr_flags = LRO_IPV4 | LRO_TCP;
-       return 0;
-}
-
-static int t3_get_skb_header(struct sk_buff *skb,
-                             void **iph, void **tcph, u64 *hdr_flags,
-                             void *priv)
-{
-       void *eh;
-
-       return t3_get_lro_header(&eh, iph, tcph, hdr_flags, priv);
-}
-
-static int t3_get_frag_header(struct skb_frag_struct *frag, void **eh,
-                             void **iph, void **tcph, u64 *hdr_flags,
-                             void *priv)
-{
-       return t3_get_lro_header(eh, iph, tcph, hdr_flags, priv);
-}
-
 /**
  *     lro_add_page - add a page chunk to an LRO session
  *     @adap: the adapter
@@ -2049,8 +1994,9 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
 {
        struct rx_sw_desc *sd = &fl->sdesc[fl->cidx];
        struct cpl_rx_pkt *cpl;
-       struct skb_frag_struct *rx_frag = qs->lro_frag_tbl;
-       int nr_frags = qs->lro_nfrags, frag_len = qs->lro_frag_len;
+       struct skb_frag_struct *rx_frag = qs->lro_frag_tbl.frags;
+       int nr_frags = qs->lro_frag_tbl.nr_frags;
+       int frag_len = qs->lro_frag_tbl.len;
        int offset = 0;
 
        if (!nr_frags) {
@@ -2069,13 +2015,13 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
        rx_frag->page_offset = sd->pg_chunk.offset + offset;
        rx_frag->size = len;
        frag_len += len;
-       qs->lro_nfrags++;
-       qs->lro_frag_len = frag_len;
+       qs->lro_frag_tbl.nr_frags++;
+       qs->lro_frag_tbl.len = frag_len;
 
        if (!complete)
                return;
 
-       qs->lro_nfrags = qs->lro_frag_len = 0;
+       qs->lro_frag_tbl.ip_summed = CHECKSUM_UNNECESSARY;
        cpl = qs->lro_va;
 
        if (unlikely(cpl->vlan_valid)) {
@@ -2084,36 +2030,15 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
                struct vlan_group *grp = pi->vlan_grp;
 
                if (likely(grp != NULL)) {
-                       lro_vlan_hwaccel_receive_frags(&qs->lro_mgr,
-                                                      qs->lro_frag_tbl,
-                                                      frag_len, frag_len,
-                                                      grp, ntohs(cpl->vlan),
-                                                      cpl, 0);
-                       return;
+                       vlan_gro_frags(&qs->napi, grp, ntohs(cpl->vlan),
+                                      &qs->lro_frag_tbl);
+                       goto out;
                }
        }
-       lro_receive_frags(&qs->lro_mgr, qs->lro_frag_tbl,
-                         frag_len, frag_len, cpl, 0);
-}
+       napi_gro_frags(&qs->napi, &qs->lro_frag_tbl);
 
-/**
- *     init_lro_mgr - initialize a LRO manager object
- *     @lro_mgr: the LRO manager object
- */
-static void init_lro_mgr(struct sge_qset *qs, struct net_lro_mgr *lro_mgr)
-{
-       lro_mgr->dev = qs->netdev;
-       lro_mgr->features = LRO_F_NAPI;
-       lro_mgr->frag_align_pad = NET_IP_ALIGN;
-       lro_mgr->ip_summed = CHECKSUM_UNNECESSARY;
-       lro_mgr->ip_summed_aggr = CHECKSUM_UNNECESSARY;
-       lro_mgr->max_desc = T3_MAX_LRO_SES;
-       lro_mgr->lro_arr = qs->lro_desc;
-       lro_mgr->get_frag_header = t3_get_frag_header;
-       lro_mgr->get_skb_header = t3_get_skb_header;
-       lro_mgr->max_aggr = T3_MAX_LRO_MAX_PKTS;
-       if (lro_mgr->max_aggr > MAX_SKB_FRAGS)
-               lro_mgr->max_aggr = MAX_SKB_FRAGS;
+out:
+       qs->lro_frag_tbl.nr_frags = qs->lro_frag_tbl.len = 0;
 }
 
 /**
@@ -2356,10 +2281,6 @@ next_fl:
        }
 
        deliver_partial_bundle(&adap->tdev, q, offload_skbs, ngathered);
-       lro_flush_all(&qs->lro_mgr);
-       qs->port_stats[SGE_PSTAT_LRO_AGGR] = qs->lro_mgr.stats.aggregated;
-       qs->port_stats[SGE_PSTAT_LRO_FLUSHED] = qs->lro_mgr.stats.flushed;
-       qs->port_stats[SGE_PSTAT_LRO_NO_DESC] = qs->lro_mgr.stats.no_desc;
 
        if (sleeping)
                check_ring_db(adap, qs, sleeping);
@@ -2906,7 +2827,6 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
 {
        int i, avail, ret = -ENOMEM;
        struct sge_qset *q = &adapter->sge.qs[id];
-       struct net_lro_mgr *lro_mgr = &q->lro_mgr;
 
        init_qset_cntxt(q, id);
        setup_timer(&q->tx_reclaim_timer, sge_timer_cb, (unsigned long)q);
@@ -2986,10 +2906,6 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
        q->fl[0].order = FL0_PG_ORDER;
        q->fl[1].order = FL1_PG_ORDER;
 
-       q->lro_frag_tbl = kcalloc(MAX_FRAME_SIZE / FL1_PG_CHUNK_SIZE + 1,
-                                 sizeof(struct skb_frag_struct),
-                                 GFP_KERNEL);
-       q->lro_nfrags = q->lro_frag_len = 0;
        spin_lock_irq(&adapter->sge.reg_lock);
 
        /* FL threshold comparison uses < */
@@ -3041,8 +2957,6 @@ int t3_sge_alloc_qset(struct adapter *adapter, unsigned int id, int nports,
        q->tx_q = netdevq;
        t3_update_qset_coalesce(q, p);
 
-       init_lro_mgr(q, lro_mgr);
-
        avail = refill_fl(adapter, &q->fl[0], q->fl[0].size,
                          GFP_KERNEL | __GFP_COMP);
        if (!avail) {
index 7ce3053530f9c62279f38dd17340e89167b6044b..861c867fca879a181095b23fef81c17056018d6c 100644 (file)
@@ -1027,7 +1027,7 @@ static int __init dec_lance_probe(struct device *bdev, const int type)
                printk(version);
 
        if (bdev)
-               snprintf(name, sizeof(name), "%s", bdev->bus_id);
+               snprintf(name, sizeof(name), "%s", dev_name(bdev));
        else {
                i = 0;
                dev = root_lance_dev;
@@ -1105,10 +1105,10 @@ static int __init dec_lance_probe(struct device *bdev, const int type)
 
                start = to_tc_dev(bdev)->resource.start;
                len = to_tc_dev(bdev)->resource.end - start + 1;
-               if (!request_mem_region(start, len, bdev->bus_id)) {
+               if (!request_mem_region(start, len, dev_name(bdev))) {
                        printk(KERN_ERR
                               "%s: Unable to reserve MMIO resource\n",
-                              bdev->bus_id);
+                              dev_name(bdev));
                        ret = -EBUSY;
                        goto err_out_dev;
                }
index 6445cedd586844ad6f544c9e1f34af3d3212d0eb..4ec055dc7174ceed6f17302d132a484151ab7671 100644 (file)
@@ -2937,7 +2937,7 @@ static int dfx_rcv_init(DFX_board_t *bp, int get_buffers)
        for (i = 0; i < (int)(bp->rcv_bufs_to_post); i++)
                for (j = 0; (i + j) < (int)PI_RCV_DATA_K_NUM_ENTRIES; j += bp->rcv_bufs_to_post)
                {
-                       struct sk_buff *newskb = __dev_alloc_skb(NEW_SKB_SIZE, GFP_NOIO);
+                       struct sk_buff *newskb = __netdev_alloc_skb(bp->dev, NEW_SKB_SIZE, GFP_NOIO);
                        if (!newskb)
                                return -ENOMEM;
                        bp->descr_block_virt->rcv_data[i+j].long_0 = (u32) (PI_RCV_DESCR_M_SOP |
index e4cef491dc73fc8d6486b98976d9b937b12399ad..55625dbbae5a8f8bf96415e8466f246c471f3585 100644 (file)
@@ -606,8 +606,8 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
        if (!mem_start || lp->adapter < DEPCA || lp->adapter >=unknown)
                return -ENXIO;
 
-       printk ("%s: %s at 0x%04lx",
-               device->bus_id, depca_signature[lp->adapter], ioaddr);
+       printk("%s: %s at 0x%04lx",
+              dev_name(device), depca_signature[lp->adapter], ioaddr);
 
        switch (lp->depca_bus) {
 #ifdef CONFIG_MCA
@@ -669,7 +669,7 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
 
        spin_lock_init(&lp->lock);
        sprintf(lp->adapter_name, "%s (%s)",
-               depca_signature[lp->adapter], device->bus_id);
+               depca_signature[lp->adapter], dev_name(device));
        status = -EBUSY;
 
        /* Initialisation Block */
index 86bb876fb123a312088b7d3edae3e4f91c2771e4..861d2eeaa43c1bd34deaeefc956d5d3f62a1788e 100644 (file)
@@ -1944,9 +1944,9 @@ static irqreturn_t e100_intr(int irq, void *dev_id)
        if (stat_ack & stat_ack_rnr)
                nic->ru_running = RU_SUSPENDED;
 
-       if (likely(netif_rx_schedule_prep(&nic->napi))) {
+       if (likely(napi_schedule_prep(&nic->napi))) {
                e100_disable_irq(nic);
-               __netif_rx_schedule(&nic->napi);
+               __napi_schedule(&nic->napi);
        }
 
        return IRQ_HANDLED;
@@ -1962,7 +1962,7 @@ static int e100_poll(struct napi_struct *napi, int budget)
 
        /* If budget not fully consumed, exit the polling mode */
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                e100_enable_irq(nic);
        }
 
index f5581de04757701df1c0205980018361459da7a0..e9a416f4016299b4dd5a09c15001efc9ff067bcd 100644 (file)
@@ -182,7 +182,6 @@ struct e1000_tx_ring {
        /* array of buffer information structs */
        struct e1000_buffer *buffer_info;
 
-       spinlock_t tx_lock;
        u16 tdh;
        u16 tdt;
        bool last_tx_tso;
@@ -238,7 +237,6 @@ struct e1000_adapter {
        u16 link_speed;
        u16 link_duplex;
        spinlock_t stats_lock;
-       spinlock_t tx_queue_lock;
        unsigned int total_tx_bytes;
        unsigned int total_tx_packets;
        unsigned int total_rx_bytes;
index 6bd63cc67b3ec37eec06275368b5685300cd9b79..61b56ca0005194844fd6c2f914a2c35c0b25c15a 100644 (file)
@@ -1048,8 +1048,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        if (pci_using_dac)
                netdev->features |= NETIF_F_HIGHDMA;
 
-       netdev->features |= NETIF_F_LLTX;
-
        netdev->vlan_features |= NETIF_F_TSO;
        netdev->vlan_features |= NETIF_F_TSO6;
        netdev->vlan_features |= NETIF_F_HW_CSUM;
@@ -1368,8 +1366,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
                return -ENOMEM;
        }
 
-       spin_lock_init(&adapter->tx_queue_lock);
-
        /* Explicitly disable IRQ since the NIC can be in any state. */
        e1000_irq_disable(adapter);
 
@@ -1624,7 +1620,6 @@ setup_tx_desc_die:
 
        txdr->next_to_use = 0;
        txdr->next_to_clean = 0;
-       spin_lock_init(&txdr->tx_lock);
 
        return 0;
 }
@@ -1882,8 +1877,6 @@ int e1000_setup_all_rx_resources(struct e1000_adapter *adapter)
  * e1000_setup_rctl - configure the receive control registers
  * @adapter: Board private structure
  **/
-#define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \
-                       (((S) & (PAGE_SIZE - 1)) ? 1 : 0))
 static void e1000_setup_rctl(struct e1000_adapter *adapter)
 {
        struct e1000_hw *hw = &adapter->hw;
@@ -2865,11 +2858,11 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter,
                return false;
 
        switch (skb->protocol) {
-       case __constant_htons(ETH_P_IP):
+       case cpu_to_be16(ETH_P_IP):
                if (ip_hdr(skb)->protocol == IPPROTO_TCP)
                        cmd_len |= E1000_TXD_CMD_TCP;
                break;
-       case __constant_htons(ETH_P_IPV6):
+       case cpu_to_be16(ETH_P_IPV6):
                /* XXX not handling all IPV6 headers */
                if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
                        cmd_len |= E1000_TXD_CMD_TCP;
@@ -3185,7 +3178,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
        unsigned int tx_flags = 0;
        unsigned int len = skb->len - skb->data_len;
-       unsigned long flags;
        unsigned int nr_frags;
        unsigned int mss;
        int count = 0;
@@ -3290,22 +3282,15 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
            (hw->mac_type == e1000_82573))
                e1000_transfer_dhcp_info(adapter, skb);
 
-       if (!spin_trylock_irqsave(&tx_ring->tx_lock, flags))
-               /* Collision - tell upper layer to requeue */
-               return NETDEV_TX_LOCKED;
-
        /* need: count + 2 desc gap to keep tail from touching
         * head, otherwise try next time */
-       if (unlikely(e1000_maybe_stop_tx(netdev, tx_ring, count + 2))) {
-               spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
+       if (unlikely(e1000_maybe_stop_tx(netdev, tx_ring, count + 2)))
                return NETDEV_TX_BUSY;
-       }
 
        if (unlikely(hw->mac_type == e1000_82547)) {
                if (unlikely(e1000_82547_fifo_workaround(adapter, skb))) {
                        netif_stop_queue(netdev);
                        mod_timer(&adapter->tx_fifo_stall_timer, jiffies + 1);
-                       spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
                        return NETDEV_TX_BUSY;
                }
        }
@@ -3320,7 +3305,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        tso = e1000_tso(adapter, tx_ring, skb);
        if (tso < 0) {
                dev_kfree_skb_any(skb);
-               spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
                return NETDEV_TX_OK;
        }
 
@@ -3345,7 +3329,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        /* Make sure there is space in the ring for the next send. */
        e1000_maybe_stop_tx(netdev, tx_ring, MAX_SKB_FRAGS + 2);
 
-       spin_unlock_irqrestore(&tx_ring->tx_lock, flags);
        return NETDEV_TX_OK;
 }
 
@@ -3687,12 +3670,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
                        mod_timer(&adapter->watchdog_timer, jiffies + 1);
        }
 
-       if (likely(netif_rx_schedule_prep(&adapter->napi))) {
+       if (likely(napi_schedule_prep(&adapter->napi))) {
                adapter->total_tx_bytes = 0;
                adapter->total_tx_packets = 0;
                adapter->total_rx_bytes = 0;
                adapter->total_rx_packets = 0;
-               __netif_rx_schedule(&adapter->napi);
+               __napi_schedule(&adapter->napi);
        } else
                e1000_irq_enable(adapter);
 
@@ -3747,12 +3730,12 @@ static irqreturn_t e1000_intr(int irq, void *data)
                ew32(IMC, ~0);
                E1000_WRITE_FLUSH();
        }
-       if (likely(netif_rx_schedule_prep(&adapter->napi))) {
+       if (likely(napi_schedule_prep(&adapter->napi))) {
                adapter->total_tx_bytes = 0;
                adapter->total_tx_packets = 0;
                adapter->total_rx_bytes = 0;
                adapter->total_rx_packets = 0;
-               __netif_rx_schedule(&adapter->napi);
+               __napi_schedule(&adapter->napi);
        } else
                /* this really should not happen! if it does it is basically a
                 * bug, but not a hard error, so enable ints and continue */
@@ -3773,15 +3756,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
 
        adapter = netdev_priv(poll_dev);
 
-       /* e1000_clean is called per-cpu.  This lock protects
-        * tx_ring[0] from being cleaned by multiple cpus
-        * simultaneously.  A failure obtaining the lock means
-        * tx_ring[0] is currently being cleaned anyway. */
-       if (spin_trylock(&adapter->tx_queue_lock)) {
-               tx_cleaned = e1000_clean_tx_irq(adapter,
-                                               &adapter->tx_ring[0]);
-               spin_unlock(&adapter->tx_queue_lock);
-       }
+       tx_cleaned = e1000_clean_tx_irq(adapter, &adapter->tx_ring[0]);
 
        adapter->clean_rx(adapter, &adapter->rx_ring[0],
                          &work_done, budget);
@@ -3793,7 +3768,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
        if (work_done < budget) {
                if (likely(adapter->itr_setting & 3))
                        e1000_set_itr(adapter);
-               netif_rx_complete(napi);
+               napi_complete(napi);
                e1000_irq_enable(adapter);
        }
 
index 0890162953e9045795ba7906d6332dd44ca02a5a..51f8e84bd4a348a51c999b2924350c74f83efb66 100644 (file)
@@ -61,6 +61,7 @@
 static s32 e1000_get_phy_id_82571(struct e1000_hw *hw);
 static s32 e1000_setup_copper_link_82571(struct e1000_hw *hw);
 static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw);
+static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw);
 static s32 e1000_write_nvm_eewr_82571(struct e1000_hw *hw, u16 offset,
                                      u16 words, u16 *data);
 static s32 e1000_fix_nvm_checksum_82571(struct e1000_hw *hw);
@@ -250,7 +251,7 @@ static s32 e1000_init_mac_params_82571(struct e1000_adapter *adapter)
        case e1000_media_type_internal_serdes:
                func->setup_physical_interface =
                        e1000_setup_fiber_serdes_link_82571;
-               func->check_for_link = e1000e_check_for_serdes_link;
+               func->check_for_link = e1000_check_for_serdes_link_82571;
                func->get_link_up_info =
                        e1000e_get_speed_and_duplex_fiber_serdes;
                break;
@@ -830,6 +831,10 @@ static s32 e1000_reset_hw_82571(struct e1000_hw *hw)
                hw->dev_spec.e82571.alt_mac_addr_is_present)
                        e1000e_set_laa_state_82571(hw, true);
 
+       /* Reinitialize the 82571 serdes link state machine */
+       if (hw->phy.media_type == e1000_media_type_internal_serdes)
+               hw->mac.serdes_link_state = e1000_serdes_link_down;
+
        return 0;
 }
 
@@ -980,6 +985,18 @@ static void e1000_initialize_hw_bits_82571(struct e1000_hw *hw)
                reg |= E1000_PBA_ECC_CORR_EN;
                ew32(PBA_ECC, reg);
        }
+       /*
+        * Workaround for hardware errata.
+        * Ensure that DMA Dynamic Clock gating is disabled on 82571 and 82572
+        */
+
+        if ((hw->mac.type == e1000_82571) ||
+           (hw->mac.type == e1000_82572)) {
+                reg = er32(CTRL_EXT);
+                reg &= ~E1000_CTRL_EXT_DMA_DYN_CLK_EN;
+                ew32(CTRL_EXT, reg);
+        }
+
 
        /* PCI-Ex Control Registers */
        if (hw->mac.type == e1000_82574) {
@@ -1202,6 +1219,131 @@ static s32 e1000_setup_fiber_serdes_link_82571(struct e1000_hw *hw)
        return e1000e_setup_fiber_serdes_link(hw);
 }
 
+/**
+ *  e1000_check_for_serdes_link_82571 - Check for link (Serdes)
+ *  @hw: pointer to the HW structure
+ *
+ *  Checks for link up on the hardware.  If link is not up and we have
+ *  a signal, then we need to force link up.
+ **/
+static s32 e1000_check_for_serdes_link_82571(struct e1000_hw *hw)
+{
+       struct e1000_mac_info *mac = &hw->mac;
+       u32 rxcw;
+       u32 ctrl;
+       u32 status;
+       s32 ret_val = 0;
+
+       ctrl = er32(CTRL);
+       status = er32(STATUS);
+       rxcw = er32(RXCW);
+
+       if ((rxcw & E1000_RXCW_SYNCH) && !(rxcw & E1000_RXCW_IV)) {
+
+               /* Receiver is synchronized with no invalid bits.  */
+               switch (mac->serdes_link_state) {
+               case e1000_serdes_link_autoneg_complete:
+                       if (!(status & E1000_STATUS_LU)) {
+                               /*
+                                * We have lost link, retry autoneg before
+                                * reporting link failure
+                                */
+                               mac->serdes_link_state =
+                                   e1000_serdes_link_autoneg_progress;
+                               hw_dbg(hw, "AN_UP     -> AN_PROG\n");
+                       }
+               break;
+
+               case e1000_serdes_link_forced_up:
+                       /*
+                        * If we are receiving /C/ ordered sets, re-enable
+                        * auto-negotiation in the TXCW register and disable
+                        * forced link in the Device Control register in an
+                        * attempt to auto-negotiate with our link partner.
+                        */
+                       if (rxcw & E1000_RXCW_C) {
+                               /* Enable autoneg, and unforce link up */
+                               ew32(TXCW, mac->txcw);
+                               ew32(CTRL,
+                                   (ctrl & ~E1000_CTRL_SLU));
+                               mac->serdes_link_state =
+                                   e1000_serdes_link_autoneg_progress;
+                               hw_dbg(hw, "FORCED_UP -> AN_PROG\n");
+                       }
+                       break;
+
+               case e1000_serdes_link_autoneg_progress:
+                       /*
+                        * If the LU bit is set in the STATUS register,
+                        * autoneg has completed sucessfully. If not,
+                        * try foring the link because the far end may be
+                        * available but not capable of autonegotiation.
+                        */
+                       if (status & E1000_STATUS_LU)  {
+                               mac->serdes_link_state =
+                                   e1000_serdes_link_autoneg_complete;
+                               hw_dbg(hw, "AN_PROG   -> AN_UP\n");
+                       } else {
+                               /*
+                                * Disable autoneg, force link up and
+                                * full duplex, and change state to forced
+                                */
+                               ew32(TXCW,
+                                   (mac->txcw & ~E1000_TXCW_ANE));
+                               ctrl |= (E1000_CTRL_SLU | E1000_CTRL_FD);
+                               ew32(CTRL, ctrl);
+
+                               /* Configure Flow Control after link up. */
+                               ret_val =
+                                   e1000e_config_fc_after_link_up(hw);
+                               if (ret_val) {
+                                       hw_dbg(hw, "Error config flow control\n");
+                                       break;
+                               }
+                               mac->serdes_link_state =
+                                   e1000_serdes_link_forced_up;
+                               hw_dbg(hw, "AN_PROG   -> FORCED_UP\n");
+                       }
+                       mac->serdes_has_link = true;
+                       break;
+
+               case e1000_serdes_link_down:
+               default:
+                       /* The link was down but the receiver has now gained
+                        * valid sync, so lets see if we can bring the link
+                        * up. */
+                       ew32(TXCW, mac->txcw);
+                       ew32(CTRL,
+                           (ctrl & ~E1000_CTRL_SLU));
+                       mac->serdes_link_state =
+                           e1000_serdes_link_autoneg_progress;
+                       hw_dbg(hw, "DOWN      -> AN_PROG\n");
+                       break;
+               }
+       } else {
+               if (!(rxcw & E1000_RXCW_SYNCH)) {
+                       mac->serdes_has_link = false;
+                       mac->serdes_link_state = e1000_serdes_link_down;
+                       hw_dbg(hw, "ANYSTATE  -> DOWN\n");
+               } else {
+                       /*
+                        * We have sync, and can tolerate one
+                        * invalid (IV) codeword before declaring
+                        * link down, so reread to look again
+                        */
+                       udelay(10);
+                       rxcw = er32(RXCW);
+                       if (rxcw & E1000_RXCW_IV) {
+                               mac->serdes_link_state = e1000_serdes_link_down;
+                               mac->serdes_has_link = false;
+                               hw_dbg(hw, "ANYSTATE  -> DOWN\n");
+                       }
+               }
+       }
+
+       return ret_val;
+}
+
 /**
  *  e1000_valid_led_default_82571 - Verify a valid default LED config
  *  @hw: pointer to the HW structure
index e6caf29d42522b8302e480bcbdc6115a0f971635..243aa499fe902a481a38288b5b264edb5c2efb9f 100644 (file)
@@ -69,6 +69,7 @@
 #define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Definable Pin 7 */
 #define E1000_CTRL_EXT_EE_RST    0x00002000 /* Reinitialize from EEPROM */
 #define E1000_CTRL_EXT_RO_DIS    0x00020000 /* Relaxed Ordering disable */
+#define E1000_CTRL_EXT_DMA_DYN_CLK_EN 0x00080000 /* DMA Dynamic Clock Gating */
 #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
 #define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES  0x00C00000
 #define E1000_CTRL_EXT_EIAME          0x01000000
index 37bcb190eef80856c89caa08e3e93df1380b38e7..28bf9a51346f57511107680a0a2633d56c7ad243 100644 (file)
@@ -195,8 +195,6 @@ struct e1000_adapter {
        u16 link_duplex;
        u16 eeprom_vers;
 
-       spinlock_t tx_queue_lock; /* prevent concurrent tail updates */
-
        /* track device up/down/testing state */
        unsigned long state;
 
index e48956d924b0faff43c4c2156bc795c8e87b5b8a..2557aeef65e6cedff2561e755d5e1c5b5558afb1 100644 (file)
@@ -1589,7 +1589,7 @@ static int e1000_link_test(struct e1000_adapter *adapter, u64 *data)
        *data = 0;
        if (hw->phy.media_type == e1000_media_type_internal_serdes) {
                int i = 0;
-               hw->mac.serdes_has_link = 0;
+               hw->mac.serdes_has_link = false;
 
                /*
                 * On some blade server designs, link establishment
index 2d4ce0492df026337fcef1d125b68cf811ee2af1..5cb428c2811d4a7483d7b29f4e50ee509e53cb5e 100644 (file)
@@ -459,6 +459,13 @@ enum e1000_smart_speed {
        e1000_smart_speed_off
 };
 
+enum e1000_serdes_link_state {
+       e1000_serdes_link_down = 0,
+       e1000_serdes_link_autoneg_progress,
+       e1000_serdes_link_autoneg_complete,
+       e1000_serdes_link_forced_up
+};
+
 /* Receive Descriptor */
 struct e1000_rx_desc {
        __le64 buffer_addr; /* Address of the descriptor's data buffer */
@@ -787,6 +794,7 @@ struct e1000_mac_info {
        bool in_ifs_mode;
        bool serdes_has_link;
        bool tx_pkt_filtering;
+       enum e1000_serdes_link_state serdes_link_state;
 };
 
 struct e1000_phy_info {
index e415e81ecd3e399cf9a3e63b7737bf41b107bdaf..6d1aab6316baec1a720f6fc4200e4b569bb9233e 100644 (file)
@@ -390,8 +390,6 @@ static s32 e1000_get_variants_ich8lan(struct e1000_adapter *adapter)
 }
 
 static DEFINE_MUTEX(nvm_mutex);
-static pid_t nvm_owner_pid = -1;
-static char nvm_owner_name[TASK_COMM_LEN] = "";
 
 /**
  *  e1000_acquire_swflag_ich8lan - Acquire software control flag
@@ -408,16 +406,7 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
 
        might_sleep();
 
-       if (!mutex_trylock(&nvm_mutex)) {
-               WARN(1, KERN_ERR "e1000e mutex contention. Owned by process "
-                    "%s (pid %d), required by process %s (pid %d)\n",
-                    nvm_owner_name, nvm_owner_pid,
-                    current->comm, current->pid);
-
-               mutex_lock(&nvm_mutex);
-       }
-       nvm_owner_pid = current->pid;
-       strncpy(nvm_owner_name, current->comm, TASK_COMM_LEN);
+       mutex_lock(&nvm_mutex);
 
        while (timeout) {
                extcnf_ctrl = er32(EXTCNF_CTRL);
@@ -435,8 +424,6 @@ static s32 e1000_acquire_swflag_ich8lan(struct e1000_hw *hw)
                hw_dbg(hw, "FW or HW has locked the resource for too long.\n");
                extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
                ew32(EXTCNF_CTRL, extcnf_ctrl);
-               nvm_owner_pid = -1;
-               strcpy(nvm_owner_name, "");
                mutex_unlock(&nvm_mutex);
                return -E1000_ERR_CONFIG;
        }
@@ -460,8 +447,6 @@ static void e1000_release_swflag_ich8lan(struct e1000_hw *hw)
        extcnf_ctrl &= ~E1000_EXTCNF_CTRL_SWFLAG;
        ew32(EXTCNF_CTRL, extcnf_ctrl);
 
-       nvm_owner_pid = -1;
-       strcpy(nvm_owner_name, "");
        mutex_unlock(&nvm_mutex);
 }
 
index 66741104ffd1b3e6c02ab4af574e915540591f58..ac2f34e1836d11bf3a34740eec3e5ddf67602870 100644 (file)
@@ -501,7 +501,7 @@ s32 e1000e_check_for_fiber_link(struct e1000_hw *hw)
                ew32(TXCW, mac->txcw);
                ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
 
-               mac->serdes_has_link = 1;
+               mac->serdes_has_link = true;
        }
 
        return 0;
@@ -566,7 +566,7 @@ s32 e1000e_check_for_serdes_link(struct e1000_hw *hw)
                ew32(TXCW, mac->txcw);
                ew32(CTRL, (ctrl & ~E1000_CTRL_SLU));
 
-               mac->serdes_has_link = 1;
+               mac->serdes_has_link = true;
        } else if (!(E1000_TXCW_ANE & er32(TXCW))) {
                /*
                 * If we force link for non-auto-negotiation switch, check
index 91817d0afcaf15a14db138a611160de81cd4fdf3..1b5a0c8b34c8e0ada712400a1c33f6a13eaea372 100644 (file)
 #include <linux/cpu.h>
 #include <linux/smp.h>
 #include <linux/pm_qos_params.h>
+#include <linux/aer.h>
 
 #include "e1000.h"
 
-#define DRV_VERSION "0.3.3.3-k6"
+#define DRV_VERSION "0.3.3.4-k2"
 char e1000e_driver_name[] = "e1000e";
 const char e1000e_driver_version[] = DRV_VERSION;
 
@@ -99,8 +100,8 @@ static void e1000_receive_skb(struct e1000_adapter *adapter,
        skb->protocol = eth_type_trans(skb, netdev);
 
        if (adapter->vlgrp && (status & E1000_RXD_STAT_VP))
-               vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
-                                        le16_to_cpu(vlan));
+               vlan_gro_receive(&adapter->napi, adapter->vlgrp,
+                                le16_to_cpu(vlan), skb);
        else
                napi_gro_receive(&adapter->napi, skb);
 }
@@ -1152,7 +1153,7 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
         * read ICR disables interrupts using IAM
         */
 
-       if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
+       if (icr & E1000_ICR_LSC) {
                hw->mac.get_link_status = 1;
                /*
                 * ICH8 workaround-- Call gig speed drop workaround on cable
@@ -1179,12 +1180,12 @@ static irqreturn_t e1000_intr_msi(int irq, void *data)
                        mod_timer(&adapter->watchdog_timer, jiffies + 1);
        }
 
-       if (netif_rx_schedule_prep(&adapter->napi)) {
+       if (napi_schedule_prep(&adapter->napi)) {
                adapter->total_tx_bytes = 0;
                adapter->total_tx_packets = 0;
                adapter->total_rx_bytes = 0;
                adapter->total_rx_packets = 0;
-               __netif_rx_schedule(&adapter->napi);
+               __napi_schedule(&adapter->napi);
        }
 
        return IRQ_HANDLED;
@@ -1218,7 +1219,7 @@ static irqreturn_t e1000_intr(int irq, void *data)
         * IMC write
         */
 
-       if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
+       if (icr & E1000_ICR_LSC) {
                hw->mac.get_link_status = 1;
                /*
                 * ICH8 workaround-- Call gig speed drop workaround on cable
@@ -1246,12 +1247,12 @@ static irqreturn_t e1000_intr(int irq, void *data)
                        mod_timer(&adapter->watchdog_timer, jiffies + 1);
        }
 
-       if (netif_rx_schedule_prep(&adapter->napi)) {
+       if (napi_schedule_prep(&adapter->napi)) {
                adapter->total_tx_bytes = 0;
                adapter->total_tx_packets = 0;
                adapter->total_rx_bytes = 0;
                adapter->total_rx_packets = 0;
-               __netif_rx_schedule(&adapter->napi);
+               __napi_schedule(&adapter->napi);
        }
 
        return IRQ_HANDLED;
@@ -1320,10 +1321,10 @@ static irqreturn_t e1000_intr_msix_rx(int irq, void *data)
                adapter->rx_ring->set_itr = 0;
        }
 
-       if (netif_rx_schedule_prep(&adapter->napi)) {
+       if (napi_schedule_prep(&adapter->napi)) {
                adapter->total_rx_bytes = 0;
                adapter->total_rx_packets = 0;
-               __netif_rx_schedule(&adapter->napi);
+               __napi_schedule(&adapter->napi);
        }
        return IRQ_HANDLED;
 }
@@ -1698,7 +1699,6 @@ int e1000e_setup_tx_resources(struct e1000_adapter *adapter)
 
        tx_ring->next_to_use = 0;
        tx_ring->next_to_clean = 0;
-       spin_lock_init(&adapter->tx_queue_lock);
 
        return 0;
 err:
@@ -2007,16 +2007,7 @@ static int e1000_clean(struct napi_struct *napi, int budget)
            !(adapter->rx_ring->ims_val & adapter->tx_ring->ims_val))
                goto clean_rx;
 
-       /*
-        * e1000_clean is called per-cpu.  This lock protects
-        * tx_ring from being cleaned by multiple cpus
-        * simultaneously.  A failure obtaining the lock means
-        * tx_ring is currently being cleaned anyway.
-        */
-       if (spin_trylock(&adapter->tx_queue_lock)) {
-               tx_cleaned = e1000_clean_tx_irq(adapter);
-               spin_unlock(&adapter->tx_queue_lock);
-       }
+       tx_cleaned = e1000_clean_tx_irq(adapter);
 
 clean_rx:
        adapter->clean_rx(adapter, &work_done, budget);
@@ -2028,7 +2019,7 @@ clean_rx:
        if (work_done < budget) {
                if (adapter->itr_setting & 3)
                        e1000_set_itr(adapter);
-               netif_rx_complete(napi);
+               napi_complete(napi);
                if (adapter->msix_entries)
                        ew32(IMS, adapter->rx_ring->ims_val);
                else
@@ -2922,8 +2913,6 @@ static int __devinit e1000_sw_init(struct e1000_adapter *adapter)
        if (e1000_alloc_queues(adapter))
                return -ENOMEM;
 
-       spin_lock_init(&adapter->tx_queue_lock);
-
        /* Explicitly disable IRQ since the NIC can be in any state. */
        e1000_irq_disable(adapter);
 
@@ -3782,11 +3771,11 @@ static bool e1000_tx_csum(struct e1000_adapter *adapter, struct sk_buff *skb)
                return 0;
 
        switch (skb->protocol) {
-       case __constant_htons(ETH_P_IP):
+       case cpu_to_be16(ETH_P_IP):
                if (ip_hdr(skb)->protocol == IPPROTO_TCP)
                        cmd_len |= E1000_TXD_CMD_TCP;
                break;
-       case __constant_htons(ETH_P_IPV6):
+       case cpu_to_be16(ETH_P_IPV6):
                /* XXX not handling all IPV6 headers */
                if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
                        cmd_len |= E1000_TXD_CMD_TCP;
@@ -3842,11 +3831,6 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
                buffer_info = &tx_ring->buffer_info[i];
                size = min(len, max_per_txd);
 
-               /* Workaround for premature desc write-backs
-                * in TSO mode.  Append 4-byte sentinel desc */
-               if (mss && !nr_frags && size == len && size > 8)
-                       size -= 4;
-
                buffer_info->length = size;
                /* set time_stamp *before* dma to help avoid a possible race */
                buffer_info->time_stamp = jiffies;
@@ -3880,10 +3864,6 @@ static int e1000_tx_map(struct e1000_adapter *adapter,
                while (len) {
                        buffer_info = &tx_ring->buffer_info[i];
                        size = min(len, max_per_txd);
-                       /* Workaround for premature desc write-backs
-                        * in TSO mode.  Append 4-byte sentinel desc */
-                       if (mss && f == (nr_frags-1) && size == len && size > 8)
-                               size -= 4;
 
                        buffer_info->length = size;
                        buffer_info->time_stamp = jiffies;
@@ -4069,7 +4049,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        unsigned int max_txd_pwr = E1000_MAX_TXD_PWR;
        unsigned int tx_flags = 0;
        unsigned int len = skb->len - skb->data_len;
-       unsigned long irq_flags;
        unsigned int nr_frags;
        unsigned int mss;
        int count = 0;
@@ -4138,18 +4117,12 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        if (adapter->hw.mac.tx_pkt_filtering)
                e1000_transfer_dhcp_info(adapter, skb);
 
-       if (!spin_trylock_irqsave(&adapter->tx_queue_lock, irq_flags))
-               /* Collision - tell upper layer to requeue */
-               return NETDEV_TX_LOCKED;
-
        /*
         * need: count + 2 desc gap to keep tail from touching
         * head, otherwise try next time
         */
-       if (e1000_maybe_stop_tx(netdev, count + 2)) {
-               spin_unlock_irqrestore(&adapter->tx_queue_lock, irq_flags);
+       if (e1000_maybe_stop_tx(netdev, count + 2))
                return NETDEV_TX_BUSY;
-       }
 
        if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
                tx_flags |= E1000_TX_FLAGS_VLAN;
@@ -4161,7 +4134,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        tso = e1000_tso(adapter, skb);
        if (tso < 0) {
                dev_kfree_skb_any(skb);
-               spin_unlock_irqrestore(&adapter->tx_queue_lock, irq_flags);
                return NETDEV_TX_OK;
        }
 
@@ -4182,7 +4154,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        if (count < 0) {
                /* handle pci_map_single() error in e1000_tx_map */
                dev_kfree_skb_any(skb);
-               spin_unlock_irqrestore(&adapter->tx_queue_lock, irq_flags);
                return NETDEV_TX_OK;
        }
 
@@ -4193,7 +4164,6 @@ static int e1000_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        /* Make sure there is space in the ring for the next send. */
        e1000_maybe_stop_tx(netdev, MAX_SKB_FRAGS + 2);
 
-       spin_unlock_irqrestore(&adapter->tx_queue_lock, irq_flags);
        return NETDEV_TX_OK;
 }
 
@@ -4543,6 +4513,14 @@ static int e1000_resume(struct pci_dev *pdev)
                return err;
        }
 
+       /* AER (Advanced Error Reporting) hooks */
+       err = pci_enable_pcie_error_reporting(pdev);
+       if (err) {
+               dev_err(&pdev->dev, "pci_enable_pcie_error_reporting failed "
+                                   "0x%x\n", err);
+               /* non-fatal, continue */
+       }
+
        pci_set_master(pdev);
 
        pci_enable_wake(pdev, PCI_D3hot, 0);
@@ -4637,24 +4615,29 @@ static pci_ers_result_t e1000_io_slot_reset(struct pci_dev *pdev)
        struct e1000_adapter *adapter = netdev_priv(netdev);
        struct e1000_hw *hw = &adapter->hw;
        int err;
+       pci_ers_result_t result;
 
        e1000e_disable_l1aspm(pdev);
        err = pci_enable_device_mem(pdev);
        if (err) {
                dev_err(&pdev->dev,
                        "Cannot re-enable PCI device after reset.\n");
-               return PCI_ERS_RESULT_DISCONNECT;
-       }
-       pci_set_master(pdev);
-       pci_restore_state(pdev);
+               result = PCI_ERS_RESULT_DISCONNECT;
+       } else {
+               pci_set_master(pdev);
+               pci_restore_state(pdev);
 
-       pci_enable_wake(pdev, PCI_D3hot, 0);
-       pci_enable_wake(pdev, PCI_D3cold, 0);
+               pci_enable_wake(pdev, PCI_D3hot, 0);
+               pci_enable_wake(pdev, PCI_D3cold, 0);
 
-       e1000e_reset(adapter);
-       ew32(WUS, ~0);
+               e1000e_reset(adapter);
+               ew32(WUS, ~0);
+               result = PCI_ERS_RESULT_RECOVERED;
+       }
+
+       pci_cleanup_aer_uncorrect_error_status(pdev);
 
-       return PCI_ERS_RESULT_RECOVERED;
+       return result;
 }
 
 /**
@@ -4922,12 +4905,6 @@ static int __devinit e1000_probe(struct pci_dev *pdev,
        if (pci_using_dac)
                netdev->features |= NETIF_F_HIGHDMA;
 
-       /*
-        * We should not be using LLTX anymore, but we are still Tx faster with
-        * it.
-        */
-       netdev->features |= NETIF_F_LLTX;
-
        if (e1000e_enable_mng_pass_thru(&adapter->hw))
                adapter->flags |= FLAG_MNG_PT_ENABLED;
 
@@ -5091,6 +5068,7 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
        struct e1000_adapter *adapter = netdev_priv(netdev);
+       int err;
 
        /*
         * flush_scheduled work may reschedule our watchdog task, so
@@ -5125,6 +5103,12 @@ static void __devexit e1000_remove(struct pci_dev *pdev)
 
        free_netdev(netdev);
 
+       /* AER disable */
+       err = pci_disable_pcie_error_reporting(pdev);
+       if (err)
+               dev_err(&pdev->dev,
+                       "pci_disable_pcie_error_reporting failed 0x%x\n", err);
+
        pci_disable_device(pdev);
 }
 
index b07ba1924de0b907ef5bdd6c298d5a83edd8b375..d2f6ee1a62904626cff295f57a6932e345b709af 100644 (file)
@@ -216,13 +216,13 @@ static int __init e21_probe1(struct net_device *dev, int ioaddr)
                printk(" %02X", station_addr[i]);
 
        if (dev->irq < 2) {
-               int irqlist[] = {15,11,10,12,5,9,3,4}, i;
-               for (i = 0; i < 8; i++)
+               int irqlist[] = {15, 11, 10, 12, 5, 9, 3, 4};
+               for (i = 0; i < ARRAY_SIZE(irqlist); i++)
                        if (request_irq (irqlist[i], NULL, 0, "bogus", NULL) != -EBUSY) {
                                dev->irq = irqlist[i];
                                break;
                        }
-               if (i >= 8) {
+               if (i >= ARRAY_SIZE(irqlist)) {
                        printk(" unable to get IRQ %d.\n", dev->irq);
                        retval = -EAGAIN;
                        goto out;
index 6271b9411ccf08c079046059a00d4584746a9d83..029631c58f0c2a9976811e44058f995a7749eaf3 100644 (file)
@@ -40,7 +40,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME       "ehea"
-#define DRV_VERSION    "EHEA_0096"
+#define DRV_VERSION    "EHEA_0099"
 
 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
index dfe92264e8252978d5719dc81f5b08dfff6d5f25..40c34bfe2cfa35f2eb961875a7a97c6bb58970de 100644 (file)
@@ -308,7 +308,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
 
        memset(stats, 0, sizeof(*stats));
 
-       cb2 = kzalloc(PAGE_SIZE, GFP_ATOMIC);
+       cb2 = (void *)get_zeroed_page(GFP_ATOMIC);
        if (!cb2) {
                ehea_error("no mem for cb2");
                goto out;
@@ -341,7 +341,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
        stats->rx_packets = rx_packets;
 
 out_herr:
-       kfree(cb2);
+       free_page((unsigned long)cb2);
 out:
        return stats;
 }
@@ -370,8 +370,6 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
                                                              EHEA_L_PKT_SIZE);
                        if (!skb_arr_rq1[index]) {
                                pr->rq1_skba.os_skbs = fill_wqes - i;
-                               ehea_error("%s: no mem for skb/%d wqes filled",
-                                          dev->name, i);
                                break;
                        }
                }
@@ -387,26 +385,19 @@ static void ehea_refill_rq1(struct ehea_port_res *pr, int index, int nr_of_wqes)
        ehea_update_rq1a(pr->qp, adder);
 }
 
-static int ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a)
+static void ehea_init_fill_rq1(struct ehea_port_res *pr, int nr_rq1a)
 {
-       int ret = 0;
        struct sk_buff **skb_arr_rq1 = pr->rq1_skba.arr;
        struct net_device *dev = pr->port->netdev;
        int i;
 
        for (i = 0; i < pr->rq1_skba.len; i++) {
                skb_arr_rq1[i] = netdev_alloc_skb(dev, EHEA_L_PKT_SIZE);
-               if (!skb_arr_rq1[i]) {
-                       ehea_error("%s: no mem for skb/%d wqes filled",
-                                  dev->name, i);
-                       ret = -ENOMEM;
-                       goto out;
-               }
+               if (!skb_arr_rq1[i])
+                       break;
        }
        /* Ring doorbell */
        ehea_update_rq1a(pr->qp, nr_rq1a);
-out:
-       return ret;
 }
 
 static int ehea_refill_rq_def(struct ehea_port_res *pr,
@@ -435,10 +426,12 @@ static int ehea_refill_rq_def(struct ehea_port_res *pr,
                u64 tmp_addr;
                struct sk_buff *skb = netdev_alloc_skb(dev, packet_size);
                if (!skb) {
-                       ehea_error("%s: no mem for skb/%d wqes filled",
-                                  pr->port->netdev->name, i);
                        q_skba->os_skbs = fill_wqes - i;
-                       ret = -ENOMEM;
+                       if (q_skba->os_skbs == q_skba->len - 2) {
+                               ehea_info("%s: rq%i ran dry - no mem for skb",
+                                         pr->port->netdev->name, rq_nr);
+                               ret = -ENOMEM;
+                       }
                        break;
                }
                skb_reserve(skb, NET_IP_ALIGN);
@@ -830,7 +823,7 @@ static int ehea_poll(struct napi_struct *napi, int budget)
        while ((rx != budget) || force_irq) {
                pr->poll_counter = 0;
                force_irq = 0;
-               netif_rx_complete(napi);
+               napi_complete(napi);
                ehea_reset_cq_ep(pr->recv_cq);
                ehea_reset_cq_ep(pr->send_cq);
                ehea_reset_cq_n1(pr->recv_cq);
@@ -841,7 +834,7 @@ static int ehea_poll(struct napi_struct *napi, int budget)
                if (!cqe && !cqe_skb)
                        return rx;
 
-               if (!netif_rx_reschedule(napi))
+               if (!napi_reschedule(napi))
                        return rx;
 
                cqe_skb = ehea_proc_cqes(pr, EHEA_POLL_MAX_CQES);
@@ -859,7 +852,7 @@ static void ehea_netpoll(struct net_device *dev)
        int i;
 
        for (i = 0; i < port->num_def_qps; i++)
-               netif_rx_schedule(&port->port_res[i].napi);
+               napi_schedule(&port->port_res[i].napi);
 }
 #endif
 
@@ -867,7 +860,7 @@ static irqreturn_t ehea_recv_irq_handler(int irq, void *param)
 {
        struct ehea_port_res *pr = param;
 
-       netif_rx_schedule(&pr->napi);
+       napi_schedule(&pr->napi);
 
        return IRQ_HANDLED;
 }
@@ -915,7 +908,7 @@ int ehea_sense_port_attr(struct ehea_port *port)
        struct hcp_ehea_port_cb0 *cb0;
 
        /* may be called via ehea_neq_tasklet() */
-       cb0 = kzalloc(PAGE_SIZE, GFP_ATOMIC);
+       cb0 = (void *)get_zeroed_page(GFP_ATOMIC);
        if (!cb0) {
                ehea_error("no mem for cb0");
                ret = -ENOMEM;
@@ -996,7 +989,7 @@ int ehea_sense_port_attr(struct ehea_port *port)
 out_free:
        if (ret || netif_msg_probe(port))
                ehea_dump(cb0, sizeof(*cb0), "ehea_sense_port_attr");
-       kfree(cb0);
+       free_page((unsigned long)cb0);
 out:
        return ret;
 }
@@ -1007,7 +1000,7 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed)
        u64 hret;
        int ret = 0;
 
-       cb4 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb4 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb4) {
                ehea_error("no mem for cb4");
                ret = -ENOMEM;
@@ -1075,7 +1068,7 @@ int ehea_set_portspeed(struct ehea_port *port, u32 port_speed)
        if (!prop_carrier_state || (port->phy_link == EHEA_PHY_LINK_UP))
                netif_carrier_on(port->netdev);
 
-       kfree(cb4);
+       free_page((unsigned long)cb4);
 out:
        return ret;
 }
@@ -1201,11 +1194,11 @@ static int ehea_fill_port_res(struct ehea_port_res *pr)
        int ret;
        struct ehea_qp_init_attr *init_attr = &pr->qp->init_attr;
 
-       ret = ehea_init_fill_rq1(pr, init_attr->act_nr_rwqes_rq1
-                                    - init_attr->act_nr_rwqes_rq2
-                                    - init_attr->act_nr_rwqes_rq3 - 1);
+       ehea_init_fill_rq1(pr, init_attr->act_nr_rwqes_rq1
+                              - init_attr->act_nr_rwqes_rq2
+                              - init_attr->act_nr_rwqes_rq3 - 1);
 
-       ret |= ehea_refill_rq2(pr, init_attr->act_nr_rwqes_rq2 - 1);
+       ret = ehea_refill_rq2(pr, init_attr->act_nr_rwqes_rq2 - 1);
 
        ret |= ehea_refill_rq3(pr, init_attr->act_nr_rwqes_rq3 - 1);
 
@@ -1302,7 +1295,7 @@ static int ehea_configure_port(struct ehea_port *port)
        struct hcp_ehea_port_cb0 *cb0;
 
        ret = -ENOMEM;
-       cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb0 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb0)
                goto out;
 
@@ -1338,7 +1331,7 @@ static int ehea_configure_port(struct ehea_port *port)
        ret = 0;
 
 out_free:
-       kfree(cb0);
+       free_page((unsigned long)cb0);
 out:
        return ret;
 }
@@ -1748,7 +1741,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
                goto out;
        }
 
-       cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb0 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb0) {
                ehea_error("no mem for cb0");
                ret = -ENOMEM;
@@ -1793,7 +1786,7 @@ out_upregs:
        ehea_update_bcmc_registrations();
        spin_unlock(&ehea_bcmc_regs.lock);
 out_free:
-       kfree(cb0);
+       free_page((unsigned long)cb0);
 out:
        return ret;
 }
@@ -1817,7 +1810,7 @@ static void ehea_promiscuous(struct net_device *dev, int enable)
        if ((enable && port->promisc) || (!enable && !port->promisc))
                return;
 
-       cb7 = kzalloc(PAGE_SIZE, GFP_ATOMIC);
+       cb7 = (void *)get_zeroed_page(GFP_ATOMIC);
        if (!cb7) {
                ehea_error("no mem for cb7");
                goto out;
@@ -1836,7 +1829,7 @@ static void ehea_promiscuous(struct net_device *dev, int enable)
 
        port->promisc = enable;
 out:
-       kfree(cb7);
+       free_page((unsigned long)cb7);
        return;
 }
 
@@ -2217,7 +2210,7 @@ static void ehea_vlan_rx_register(struct net_device *dev,
 
        port->vgrp = grp;
 
-       cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb1 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb1) {
                ehea_error("no mem for cb1");
                goto out;
@@ -2228,7 +2221,7 @@ static void ehea_vlan_rx_register(struct net_device *dev,
        if (hret != H_SUCCESS)
                ehea_error("modify_ehea_port failed");
 
-       kfree(cb1);
+       free_page((unsigned long)cb1);
 out:
        return;
 }
@@ -2241,7 +2234,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
        int index;
        u64 hret;
 
-       cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb1 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb1) {
                ehea_error("no mem for cb1");
                goto out;
@@ -2262,7 +2255,7 @@ static void ehea_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
        if (hret != H_SUCCESS)
                ehea_error("modify_ehea_port failed");
 out:
-       kfree(cb1);
+       free_page((unsigned long)cb1);
        return;
 }
 
@@ -2276,7 +2269,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
 
        vlan_group_set_device(port->vgrp, vid, NULL);
 
-       cb1 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb1 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb1) {
                ehea_error("no mem for cb1");
                goto out;
@@ -2297,7 +2290,7 @@ static void ehea_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
        if (hret != H_SUCCESS)
                ehea_error("modify_ehea_port failed");
 out:
-       kfree(cb1);
+       free_page((unsigned long)cb1);
        return;
 }
 
@@ -2309,7 +2302,7 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
        u64 dummy64 = 0;
        struct hcp_modify_qp_cb0 *cb0;
 
-       cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb0 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb0) {
                ret = -ENOMEM;
                goto out;
@@ -2372,7 +2365,7 @@ int ehea_activate_qp(struct ehea_adapter *adapter, struct ehea_qp *qp)
 
        ret = 0;
 out:
-       kfree(cb0);
+       free_page((unsigned long)cb0);
        return ret;
 }
 
@@ -2664,7 +2657,7 @@ int ehea_stop_qps(struct net_device *dev)
        u64 dummy64 = 0;
        u16 dummy16 = 0;
 
-       cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb0 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb0) {
                ret = -ENOMEM;
                goto out;
@@ -2716,7 +2709,7 @@ int ehea_stop_qps(struct net_device *dev)
 
        ret = 0;
 out:
-       kfree(cb0);
+       free_page((unsigned long)cb0);
 
        return ret;
 }
@@ -2766,7 +2759,7 @@ int ehea_restart_qps(struct net_device *dev)
        u64 dummy64 = 0;
        u16 dummy16 = 0;
 
-       cb0 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb0 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb0) {
                ret = -ENOMEM;
                goto out;
@@ -2819,7 +2812,7 @@ int ehea_restart_qps(struct net_device *dev)
                ehea_refill_rq3(pr, 0);
        }
 out:
-       kfree(cb0);
+       free_page((unsigned long)cb0);
 
        return ret;
 }
@@ -2950,7 +2943,7 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
        u64 hret;
        int ret;
 
-       cb = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb) {
                ret = -ENOMEM;
                goto out;
@@ -2967,7 +2960,7 @@ int ehea_sense_adapter_attr(struct ehea_adapter *adapter)
        ret = 0;
 
 out_herr:
-       kfree(cb);
+       free_page((unsigned long)cb);
 out:
        return ret;
 }
@@ -2981,7 +2974,7 @@ int ehea_get_jumboframe_status(struct ehea_port *port, int *jumbo)
        *jumbo = 0;
 
        /* (Try to) enable *jumbo frames */
-       cb4 = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       cb4 = (void *)get_zeroed_page(GFP_KERNEL);
        if (!cb4) {
                ehea_error("no mem for cb4");
                ret = -ENOMEM;
@@ -3009,7 +3002,7 @@ int ehea_get_jumboframe_status(struct ehea_port *port, int *jumbo)
                } else
                        ret = -EINVAL;
 
-               kfree(cb4);
+               free_page((unsigned long)cb4);
        }
 out:
        return ret;
@@ -3040,7 +3033,7 @@ static struct device *ehea_register_port(struct ehea_port *port,
        port->ofdev.dev.parent = &port->adapter->ofdev->dev;
        port->ofdev.dev.bus = &ibmebus_bus_type;
 
-       sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++);
+       dev_set_name(&port->ofdev.dev, "port%d", port_name_cnt++);
        port->ofdev.dev.release = logical_port_release;
 
        ret = of_device_register(&port->ofdev);
@@ -3069,6 +3062,22 @@ static void ehea_unregister_port(struct ehea_port *port)
        of_device_unregister(&port->ofdev);
 }
 
+static const struct net_device_ops ehea_netdev_ops = {
+       .ndo_open               = ehea_open,
+       .ndo_stop               = ehea_stop,
+       .ndo_start_xmit         = ehea_start_xmit,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = ehea_netpoll,
+#endif
+       .ndo_get_stats          = ehea_get_stats,
+       .ndo_set_mac_address    = ehea_set_mac_addr,
+       .ndo_set_multicast_list = ehea_set_multicast_list,
+       .ndo_change_mtu         = ehea_change_mtu,
+       .ndo_vlan_rx_register   = ehea_vlan_rx_register,
+       .ndo_vlan_rx_add_vid    = ehea_vlan_rx_add_vid,
+       .ndo_vlan_rx_kill_vid   = ehea_vlan_rx_kill_vid
+};
+
 struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
                                         u32 logical_port_id,
                                         struct device_node *dn)
@@ -3121,19 +3130,9 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
        /* initialize net_device structure */
        memcpy(dev->dev_addr, &port->mac_addr, ETH_ALEN);
 
-       dev->open = ehea_open;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = ehea_netpoll;
-#endif
-       dev->stop = ehea_stop;
-       dev->hard_start_xmit = ehea_start_xmit;
-       dev->get_stats = ehea_get_stats;
-       dev->set_multicast_list = ehea_set_multicast_list;
-       dev->set_mac_address = ehea_set_mac_addr;
-       dev->change_mtu = ehea_change_mtu;
-       dev->vlan_rx_register = ehea_vlan_rx_register;
-       dev->vlan_rx_add_vid = ehea_vlan_rx_add_vid;
-       dev->vlan_rx_kill_vid = ehea_vlan_rx_kill_vid;
+       dev->netdev_ops = &ehea_netdev_ops;
+       ehea_set_ethtool_ops(dev);
+
        dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_TSO
                      | NETIF_F_HIGHDMA | NETIF_F_IP_CSUM | NETIF_F_HW_VLAN_TX
                      | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER
@@ -3142,7 +3141,6 @@ struct ehea_port *ehea_setup_single_port(struct ehea_adapter *adapter,
        dev->watchdog_timeo = EHEA_WATCH_DOG_TIMEOUT;
 
        INIT_WORK(&port->reset_task, ehea_reset_port);
-       ehea_set_ethtool_ops(dev);
 
        ret = register_netdev(dev);
        if (ret) {
@@ -3450,6 +3448,7 @@ out_kill_eq:
        ehea_destroy_eq(adapter->neq);
 
 out_free_ad:
+       list_del(&adapter->list);
        kfree(adapter);
 
 out:
@@ -3518,12 +3517,14 @@ static int ehea_mem_notifier(struct notifier_block *nb,
                /* Readd canceled memory block */
        case MEM_ONLINE:
                ehea_info("memory is going online");
+               set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
                if (ehea_add_sect_bmap(arg->start_pfn, arg->nr_pages))
                        return NOTIFY_BAD;
                ehea_rereg_mrs(NULL);
                break;
        case MEM_GOING_OFFLINE:
                ehea_info("memory is going offline");
+               set_bit(__EHEA_STOP_XFER, &ehea_driver_flags);
                if (ehea_rem_sect_bmap(arg->start_pfn, arg->nr_pages))
                        return NOTIFY_BAD;
                ehea_rereg_mrs(NULL);
index 49d766ebbcf4e630d91cf8c245e50e96322be360..3747457f5e69441a14d91932b3ac3aca18a5c879 100644 (file)
@@ -1005,7 +1005,7 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
        unsigned long ret;
        u64 *rblock;
 
-       rblock = kzalloc(PAGE_SIZE, GFP_KERNEL);
+       rblock = (void *)get_zeroed_page(GFP_KERNEL);
        if (!rblock) {
                ehea_error("Cannot allocate rblock memory.");
                return;
@@ -1022,5 +1022,5 @@ void ehea_error_data(struct ehea_adapter *adapter, u64 res_handle)
        else
                ehea_error("Error data could not be fetched: %llX", res_handle);
 
-       kfree(rblock);
+       free_page((unsigned long)rblock);
 }
index a832cc5d6a1e3c9061b290f393adeaa897504508..c26cea0b300e4e0ceba58ebeccf234c27c86eebd 100644 (file)
@@ -33,7 +33,7 @@
 
 #define DRV_NAME               "enic"
 #define DRV_DESCRIPTION                "Cisco 10G Ethernet Driver"
-#define DRV_VERSION            "1.0.0.648"
+#define DRV_VERSION            "1.0.0.933"
 #define DRV_COPYRIGHT          "Copyright 2008 Cisco Systems, Inc"
 #define PFX                    DRV_NAME ": "
 
@@ -97,6 +97,7 @@ struct enic {
        ____cacheline_aligned struct vnic_rq rq[1];
        unsigned int rq_count;
        int (*rq_alloc_buf)(struct vnic_rq *rq);
+       u64 rq_bad_fcs;
        struct napi_struct napi;
        struct net_lro_mgr lro_mgr;
        struct net_lro_desc lro_desc[ENIC_LRO_MAX_DESC];
index 7d60551d538fccae67b2638ac8b85f985938a8b4..03403a51f7eae0f95cb26a3517c2b4d22536a149 100644 (file)
@@ -400,10 +400,13 @@ static irqreturn_t enic_isr_legacy(int irq, void *data)
                return IRQ_NONE;        /* not our interrupt */
        }
 
-       if (ENIC_TEST_INTR(pba, ENIC_INTX_NOTIFY))
+       if (ENIC_TEST_INTR(pba, ENIC_INTX_NOTIFY)) {
+               vnic_intr_return_all_credits(&enic->intr[ENIC_INTX_NOTIFY]);
                enic_notify_check(enic);
+       }
 
        if (ENIC_TEST_INTR(pba, ENIC_INTX_ERR)) {
+               vnic_intr_return_all_credits(&enic->intr[ENIC_INTX_ERR]);
                enic_log_q_error(enic);
                /* schedule recovery from WQ/RQ error */
                schedule_work(&enic->reset);
@@ -411,8 +414,8 @@ static irqreturn_t enic_isr_legacy(int irq, void *data)
        }
 
        if (ENIC_TEST_INTR(pba, ENIC_INTX_WQ_RQ)) {
-               if (netif_rx_schedule_prep(&enic->napi))
-                       __netif_rx_schedule(&enic->napi);
+               if (napi_schedule_prep(&enic->napi))
+                       __napi_schedule(&enic->napi);
        } else {
                vnic_intr_unmask(&enic->intr[ENIC_INTX_WQ_RQ]);
        }
@@ -440,7 +443,7 @@ static irqreturn_t enic_isr_msi(int irq, void *data)
         * writes).
         */
 
-       netif_rx_schedule(&enic->napi);
+       napi_schedule(&enic->napi);
 
        return IRQ_HANDLED;
 }
@@ -450,7 +453,7 @@ static irqreturn_t enic_isr_msix_rq(int irq, void *data)
        struct enic *enic = data;
 
        /* schedule NAPI polling for RQ cleanup */
-       netif_rx_schedule(&enic->napi);
+       napi_schedule(&enic->napi);
 
        return IRQ_HANDLED;
 }
@@ -476,6 +479,8 @@ static irqreturn_t enic_isr_msix_err(int irq, void *data)
 {
        struct enic *enic = data;
 
+       vnic_intr_return_all_credits(&enic->intr[ENIC_MSIX_ERR]);
+
        enic_log_q_error(enic);
 
        /* schedule recovery from WQ/RQ error */
@@ -488,8 +493,8 @@ static irqreturn_t enic_isr_msix_notify(int irq, void *data)
 {
        struct enic *enic = data;
 
+       vnic_intr_return_all_credits(&enic->intr[ENIC_MSIX_NOTIFY]);
        enic_notify_check(enic);
-       vnic_intr_unmask(&enic->intr[ENIC_MSIX_NOTIFY]);
 
        return IRQ_HANDLED;
 }
@@ -570,11 +575,11 @@ static inline void enic_queue_wq_skb_tso(struct enic *enic,
         * to each TCP segment resulting from the TSO.
         */
 
-       if (skb->protocol == __constant_htons(ETH_P_IP)) {
+       if (skb->protocol == cpu_to_be16(ETH_P_IP)) {
                ip_hdr(skb)->check = 0;
                tcp_hdr(skb)->check = ~csum_tcpudp_magic(ip_hdr(skb)->saddr,
                        ip_hdr(skb)->daddr, 0, IPPROTO_TCP, 0);
-       } else if (skb->protocol == __constant_htons(ETH_P_IPV6)) {
+       } else if (skb->protocol == cpu_to_be16(ETH_P_IPV6)) {
                tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
                        &ipv6_hdr(skb)->daddr, 0, IPPROTO_TCP, 0);
        }
@@ -616,7 +621,7 @@ static inline void enic_queue_wq_skb(struct enic *enic,
                        vlan_tag_insert, vlan_tag);
 }
 
-/* netif_tx_lock held, process context with BHs disabled */
+/* netif_tx_lock held, process context with BHs disabled, or BH */
 static int enic_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
 {
        struct enic *enic = netdev_priv(netdev);
@@ -683,7 +688,7 @@ static struct net_device_stats *enic_get_stats(struct net_device *netdev)
        net_stats->rx_bytes = stats->rx.rx_bytes_ok;
        net_stats->rx_errors = stats->rx.rx_errors;
        net_stats->multicast = stats->rx.rx_multicast_frames_ok;
-       net_stats->rx_crc_errors = stats->rx.rx_crc_errors;
+       net_stats->rx_crc_errors = enic->rq_bad_fcs;
        net_stats->rx_dropped = stats->rx.rx_no_bufs;
 
        return net_stats;
@@ -928,12 +933,8 @@ static void enic_rq_indicate_buf(struct vnic_rq *rq,
 
        if (packet_error) {
 
-               if (bytes_written > 0 && !fcs_ok) {
-                       if (net_ratelimit())
-                               printk(KERN_ERR PFX
-                                       "%s: packet error: bad FCS\n",
-                                       netdev->name);
-               }
+               if (bytes_written > 0 && !fcs_ok)
+                       enic->rq_bad_fcs++;
 
                dev_kfree_skb_any(skb);
 
@@ -1068,8 +1069,8 @@ static int enic_poll(struct napi_struct *napi, int budget)
                if (netdev->features & NETIF_F_LRO)
                        lro_flush_all(&enic->lro_mgr);
 
-               netif_rx_complete(napi);
-               vnic_intr_unmask(&enic->intr[ENIC_MSIX_RQ]);
+               napi_complete(napi);
+               vnic_intr_unmask(&enic->intr[ENIC_INTX_WQ_RQ]);
        }
 
        return rq_work_done;
@@ -1095,9 +1096,9 @@ static int enic_poll_msix(struct napi_struct *napi, int budget)
 
                vnic_rq_fill(&enic->rq[0], enic_rq_alloc_buf);
 
-               /* Accumulate intr event credits for this polling
+               /* Return intr event credits for this polling
                 * cycle.  An intr event is the completion of a
-                * a WQ or RQ packet.
+                * RQ packet.
                 */
 
                vnic_intr_return_credits(&enic->intr[ENIC_MSIX_RQ],
@@ -1112,7 +1113,7 @@ static int enic_poll_msix(struct napi_struct *napi, int budget)
                if (netdev->features & NETIF_F_LRO)
                        lro_flush_all(&enic->lro_mgr);
 
-               netif_rx_complete(napi);
+               napi_complete(napi);
                vnic_intr_unmask(&enic->intr[ENIC_MSIX_RQ]);
        }
 
@@ -1461,6 +1462,26 @@ static int enic_dev_soft_reset(struct enic *enic)
        return err;
 }
 
+static int enic_set_niccfg(struct enic *enic)
+{
+       const u8 rss_default_cpu = 0;
+       const u8 rss_hash_type = 0;
+       const u8 rss_hash_bits = 0;
+       const u8 rss_base_cpu = 0;
+       const u8 rss_enable = 0;
+       const u8 tso_ipid_split_en = 0;
+       const u8 ig_vlan_strip_en = 1;
+
+       /* Enable VLAN tag stripping.  RSS not enabled (yet).
+       */
+
+       return enic_set_nic_cfg(enic,
+               rss_default_cpu, rss_hash_type,
+               rss_hash_bits, rss_base_cpu,
+               rss_enable, tso_ipid_split_en,
+               ig_vlan_strip_en);
+}
+
 static void enic_reset(struct work_struct *work)
 {
        struct enic *enic = container_of(work, struct enic, reset);
@@ -1476,8 +1497,10 @@ static void enic_reset(struct work_struct *work)
 
        enic_stop(enic->netdev);
        enic_dev_soft_reset(enic);
+       vnic_dev_init(enic->vdev, 0);
        enic_reset_mcaddrs(enic);
        enic_init_vnic_resources(enic);
+       enic_set_niccfg(enic);
        enic_open(enic->netdev);
 
        rtnl_unlock();
@@ -1620,14 +1643,6 @@ static int __devinit enic_probe(struct pci_dev *pdev,
        unsigned int i;
        int err;
 
-       const u8 rss_default_cpu = 0;
-       const u8 rss_hash_type = 0;
-       const u8 rss_hash_bits = 0;
-       const u8 rss_base_cpu = 0;
-       const u8 rss_enable = 0;
-       const u8 tso_ipid_split_en = 0;
-       const u8 ig_vlan_strip_en = 1;
-
        /* Allocate net device structure and initialize.  Private
         * instance data is initialized to zero.
         */
@@ -1793,14 +1808,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,
 
        enic_init_vnic_resources(enic);
 
-       /* Enable VLAN tag stripping.  RSS not enabled (yet).
-        */
-
-       err = enic_set_nic_cfg(enic,
-               rss_default_cpu, rss_hash_type,
-               rss_hash_bits, rss_base_cpu,
-               rss_enable, tso_ipid_split_en,
-               ig_vlan_strip_en);
+       err = enic_set_niccfg(enic);
        if (err) {
                printk(KERN_ERR PFX
                        "Failed to config nic, aborting.\n");
@@ -1858,7 +1866,6 @@ static int __devinit enic_probe(struct pci_dev *pdev,
        if (using_dac)
                netdev->features |= NETIF_F_HIGHDMA;
 
-
        enic->csum_rx_enabled = ENIC_SETTING(enic, RXCSUM);
 
        enic->lro_mgr.max_aggr = ENIC_LRO_MAX_AGGR;
@@ -1870,7 +1877,6 @@ static int __devinit enic_probe(struct pci_dev *pdev,
        enic->lro_mgr.ip_summed = CHECKSUM_COMPLETE;
        enic->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
 
-
        err = register_netdev(netdev);
        if (err) {
                printk(KERN_ERR PFX
index 11708579b6ce7c5bfd8143234bea6c1122cb1748..e21b9d636aecf9782a31545068529091b7212650 100644 (file)
@@ -34,6 +34,9 @@ struct vnic_res {
        unsigned int count;
 };
 
+#define VNIC_DEV_CAP_INIT      0x0001
+#define VNIC_DEV_CAP_PERBI     0x0002
+
 struct vnic_dev {
        void *priv;
        struct pci_dev *pdev;
@@ -50,6 +53,7 @@ struct vnic_dev {
        dma_addr_t stats_pa;
        struct vnic_devcmd_fw_info *fw_info;
        dma_addr_t fw_info_pa;
+       u32 cap_flags;
 };
 
 #define VNIC_MAX_RES_HDR_SIZE \
@@ -575,9 +579,9 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)
 {
        u64 a0 = (u32)arg, a1 = 0;
        int wait = 1000;
-        int r = 0;
+       int r = 0;
 
-       if (vnic_dev_capable(vdev, CMD_INIT))
+       if (vdev->cap_flags & VNIC_DEV_CAP_INIT)
                r = vnic_dev_cmd(vdev, CMD_INIT, &a0, &a1, wait);
        else {
                vnic_dev_cmd(vdev, CMD_INIT_v1, &a0, &a1, wait);
@@ -587,8 +591,8 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)
                        vnic_dev_cmd(vdev, CMD_MAC_ADDR, &a0, &a1, wait);
                        vnic_dev_cmd(vdev, CMD_ADDR_ADD, &a0, &a1, wait);
                }
-        }
-        return r;
+       }
+       return r;
 }
 
 int vnic_dev_link_status(struct vnic_dev *vdev)
@@ -626,6 +630,22 @@ u32 vnic_dev_mtu(struct vnic_dev *vdev)
        return vdev->notify_copy.mtu;
 }
 
+u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev)
+{
+       if (!vnic_dev_notify_ready(vdev))
+               return 0;
+
+       return vdev->notify_copy.link_down_cnt;
+}
+
+u32 vnic_dev_notify_status(struct vnic_dev *vdev)
+{
+       if (!vnic_dev_notify_ready(vdev))
+               return 0;
+
+       return vdev->notify_copy.status;
+}
+
 void vnic_dev_set_intr_mode(struct vnic_dev *vdev,
        enum vnic_dev_intr_mode intr_mode)
 {
@@ -682,6 +702,11 @@ struct vnic_dev *vnic_dev_register(struct vnic_dev *vdev,
        if (!vdev->devcmd)
                goto err_out;
 
+       vdev->cap_flags = 0;
+
+       if (vnic_dev_capable(vdev, CMD_INIT))
+               vdev->cap_flags |= VNIC_DEV_CAP_INIT;
+
        return vdev;
 
 err_out:
index b9dc1821c8050dbbe13157a02518c6fcab0face7..8aa8db2fd03fbc6f49334861d89374f074d3f930 100644 (file)
@@ -102,6 +102,8 @@ int vnic_dev_link_status(struct vnic_dev *vdev);
 u32 vnic_dev_port_speed(struct vnic_dev *vdev);
 u32 vnic_dev_msg_lvl(struct vnic_dev *vdev);
 u32 vnic_dev_mtu(struct vnic_dev *vdev);
+u32 vnic_dev_link_down_cnt(struct vnic_dev *vdev);
+u32 vnic_dev_notify_status(struct vnic_dev *vdev);
 int vnic_dev_close(struct vnic_dev *vdev);
 int vnic_dev_enable(struct vnic_dev *vdev);
 int vnic_dev_disable(struct vnic_dev *vdev);
index 8062c75154e60d83098aa61293ec338931b7614f..2587f34fbfbdc7c1be26bc9cd5e1ea008a5d68dc 100644 (file)
@@ -191,7 +191,7 @@ enum vnic_devcmd_cmd {
        CMD_INIT_STATUS         = _CMDC(_CMD_DIR_READ, _CMD_VTYPE_ALL, 31),
 
        /* INT13 API: (u64)a0=paddr to vnic_int13_params struct
-        *            (u8)a1=INT13_CMD_xxx */
+        *            (u32)a1=INT13_CMD_xxx */
        CMD_INT13               = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_FC, 32),
 
        /* logical uplink enable/disable: (u64)a0: 0/1=disable/enable */
@@ -207,6 +207,11 @@ enum vnic_devcmd_cmd {
         * in:  (u32)a0=cmd
         * out: (u32)a0=errno, 0:valid cmd, a1=supported VNIC_STF_* bits */
        CMD_CAPABILITY          = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_ALL, 36),
+
+       /* persistent binding info
+        * in:  (u64)a0=paddr of arg
+        *      (u32)a1=CMD_PERBI_XXX */
+       CMD_PERBI               = _CMDC(_CMD_DIR_RW, _CMD_VTYPE_FC, 37),
 };
 
 /* flags for CMD_OPEN */
@@ -259,6 +264,7 @@ struct vnic_devcmd_notify {
        u32 status;             /* status bits (see VNIC_STF_*) */
        u32 error;              /* error code (see ERR_*) for first ERR */
        u32 link_down_cnt;      /* running count of link down transitions */
+       u32 perbi_rebuild_cnt;  /* running count of perbi rebuilds */
 };
 #define VNIC_STF_FATAL_ERR     0x0001  /* fatal fw error */
 #define VNIC_STF_STD_PAUSE     0x0002  /* standard link-level pause on */
index ce633a5a7e3c4d7924c43858942fc833257ef50b..9a53604edce69ca9dfb19eeb241b63f634627a6b 100644 (file)
@@ -76,6 +76,20 @@ static inline void vnic_intr_return_credits(struct vnic_intr *intr,
        iowrite32(int_credit_return, &intr->ctrl->int_credit_return);
 }
 
+static inline unsigned int vnic_intr_credits(struct vnic_intr *intr)
+{
+       return ioread32(&intr->ctrl->int_credits);
+}
+
+static inline void vnic_intr_return_all_credits(struct vnic_intr *intr)
+{
+       unsigned int credits = vnic_intr_credits(intr);
+       int unmask = 1;
+       int reset_timer = 1;
+
+       vnic_intr_return_credits(intr, credits, unmask, reset_timer);
+}
+
 static inline u32 vnic_intr_legacy_pba(u32 __iomem *legacy_pba)
 {
        /* read PBA without clearing */
index a539bc3163cf07548479422c633b1ebb1f87681e..b60e27dfcfa7c24a3c576ca1f5713e30befb4d60 100644 (file)
@@ -1114,9 +1114,9 @@ static irqreturn_t epic_interrupt(int irq, void *dev_instance)
 
        if ((status & EpicNapiEvent) && !ep->reschedule_in_poll) {
                spin_lock(&ep->napi_lock);
-               if (netif_rx_schedule_prep(&ep->napi)) {
+               if (napi_schedule_prep(&ep->napi)) {
                        epic_napi_irq_off(dev, ep);
-                       __netif_rx_schedule(&ep->napi);
+                       __napi_schedule(&ep->napi);
                } else
                        ep->reschedule_in_poll++;
                spin_unlock(&ep->napi_lock);
@@ -1293,7 +1293,7 @@ rx_action:
 
                more = ep->reschedule_in_poll;
                if (!more) {
-                       __netif_rx_complete(napi);
+                       __napi_complete(napi);
                        outl(EpicNapiEvent, ioaddr + INTSTAT);
                        epic_napi_irq_on(dev, ep);
                } else
index 2769083bfe83a27265925e46e00462127885b739..fe2650237e349a407b8bc22c5bf0af5c7dbddb11 100644 (file)
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
 #include <linux/bitops.h>
+#include <linux/io.h>
+#include <linux/irq.h>
+#include <linux/clk.h>
+#include <linux/platform_device.h>
 
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/io.h>
-#include <asm/pgtable.h>
 #include <asm/cacheflush.h>
 
+#ifndef CONFIG_ARCH_MXC
 #include <asm/coldfire.h>
 #include <asm/mcfsim.h>
+#endif
+
 #include "fec.h"
 
-#if defined(CONFIG_FEC2)
-#define        FEC_MAX_PORTS   2
+#ifdef CONFIG_ARCH_MXC
+#include <mach/hardware.h>
+#define FEC_ALIGNMENT  0xf
 #else
-#define        FEC_MAX_PORTS   1
+#define FEC_ALIGNMENT  0x3
 #endif
 
+#if defined CONFIG_M5272 || defined CONFIG_M527x || defined CONFIG_M523x \
+       || defined CONFIG_M528x || defined CONFIG_M532x || defined CONFIG_M520x
+#define FEC_LEGACY
+/*
+ * Define the fixed address of the FEC hardware.
+ */
 #if defined(CONFIG_M5272)
 #define HAVE_mii_link_interrupt
 #endif
 
-/*
- * Define the fixed address of the FEC hardware.
- */
+#if defined(CONFIG_FEC2)
+#define        FEC_MAX_PORTS   2
+#else
+#define        FEC_MAX_PORTS   1
+#endif
+
 static unsigned int fec_hw[] = {
 #if defined(CONFIG_M5272)
        (MCF_MBAR + 0x840),
@@ -72,8 +85,6 @@ static unsigned int fec_hw[] = {
        (MCF_MBAR+0x30000),
 #elif defined(CONFIG_M532x)
        (MCF_MBAR+0xfc030000),
-#else
-       &(((immap_t *)IMAP_ADDR)->im_cpm.cp_fec),
 #endif
 };
 
@@ -99,6 +110,8 @@ static unsigned char fec_mac_default[] = {
 #define        FEC_FLASHMAC    0
 #endif
 
+#endif /* FEC_LEGACY */
+
 /* Forward declarations of some structures to support different PHYs
 */
 
@@ -162,7 +175,7 @@ typedef struct {
  * account when setting it.
  */
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
-    defined(CONFIG_M520x) || defined(CONFIG_M532x)
+    defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARCH_MXC)
 #define        OPT_FRAME_SIZE  (PKT_MAXBUF_SIZE << 16)
 #else
 #define        OPT_FRAME_SIZE  0
@@ -182,6 +195,8 @@ struct fec_enet_private {
 
        struct net_device *netdev;
 
+       struct clk *clk;
+
        /* The saved address of a sent-in-place packet/buffer, for skfree(). */
        unsigned char *tx_bounce[TX_RING_SIZE];
        struct  sk_buff* tx_skbuff[TX_RING_SIZE];
@@ -190,6 +205,7 @@ struct fec_enet_private {
 
        /* CPM dual port RAM relative addresses.
        */
+       dma_addr_t      bd_dma;
        cbd_t   *rx_bd_base;            /* Address of Rx and Tx buffers. */
        cbd_t   *tx_bd_base;
        cbd_t   *cur_rx, *cur_tx;               /* The next free ring entry */
@@ -342,10 +358,10 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
         *      4-byte boundaries. Use bounce buffers to copy data
         *      and get it aligned. Ugh.
         */
-       if (bdp->cbd_bufaddr & 0x3) {
+       if (bdp->cbd_bufaddr & FEC_ALIGNMENT) {
                unsigned int index;
                index = bdp - fep->tx_bd_base;
-               memcpy(fep->tx_bounce[index], (void *) bdp->cbd_bufaddr, bdp->cbd_datlen);
+               memcpy(fep->tx_bounce[index], (void *)skb->data, skb->len);
                bdp->cbd_bufaddr = __pa(fep->tx_bounce[index]);
        }
 
@@ -359,8 +375,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
        /* Push the data cache so the CPM does not get stale memory
         * data.
         */
-       flush_dcache_range((unsigned long)skb->data,
-                          (unsigned long)skb->data + skb->len);
+       dma_sync_single(NULL, bdp->cbd_bufaddr,
+                       bdp->cbd_datlen, DMA_TO_DEVICE);
 
        /* Send it on its way.  Tell FEC it's ready, interrupt when done,
         * it's the last BD of the frame, and to put the CRC on the end.
@@ -633,6 +649,9 @@ while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) {
        dev->stats.rx_bytes += pkt_len;
        data = (__u8*)__va(bdp->cbd_bufaddr);
 
+       dma_sync_single(NULL, (unsigned long)__pa(data),
+                       pkt_len - 4, DMA_FROM_DEVICE);
+
        /* This does 16 byte alignment, exactly what we need.
         * The packet length includes FCS, but we don't want to
         * include that when passing upstream as it messes up
@@ -1114,7 +1133,7 @@ static phy_info_t const phy_info_am79c874 = {
 /* register definitions for the 8721 */
 
 #define MII_KS8721BL_RXERCR    21
-#define MII_KS8721BL_ICSR      22
+#define MII_KS8721BL_ICSR      27
 #define        MII_KS8721BL_PHYCR      31
 
 static phy_cmd_t const phy_cmd_ks8721bl_config[] = {
@@ -1308,10 +1327,6 @@ static void __inline__ fec_get_mac(struct net_device *dev)
                 dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
 }
 
-static void __inline__ fec_enable_phy_intr(void)
-{
-}
-
 static void __inline__ fec_disable_phy_intr(void)
 {
        volatile unsigned long *icrp;
@@ -1327,17 +1342,6 @@ static void __inline__ fec_phy_ack_intr(void)
        *icrp = 0x0d000000;
 }
 
-static void __inline__ fec_localhw_setup(void)
-{
-}
-
-/*
- *     Do not need to make region uncached on 5272.
- */
-static void __inline__ fec_uncache(unsigned long addr)
-{
-}
-
 /* ------------------------------------------------------------------------- */
 
 #elif defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
@@ -1477,10 +1481,6 @@ static void __inline__ fec_get_mac(struct net_device *dev)
                dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
 }
 
-static void __inline__ fec_enable_phy_intr(void)
-{
-}
-
 static void __inline__ fec_disable_phy_intr(void)
 {
 }
@@ -1489,17 +1489,6 @@ static void __inline__ fec_phy_ack_intr(void)
 {
 }
 
-static void __inline__ fec_localhw_setup(void)
-{
-}
-
-/*
- *     Do not need to make region uncached on 5272.
- */
-static void __inline__ fec_uncache(unsigned long addr)
-{
-}
-
 /* ------------------------------------------------------------------------- */
 
 #elif defined(CONFIG_M520x)
@@ -1598,10 +1587,6 @@ static void __inline__ fec_get_mac(struct net_device *dev)
                dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
 }
 
-static void __inline__ fec_enable_phy_intr(void)
-{
-}
-
 static void __inline__ fec_disable_phy_intr(void)
 {
 }
@@ -1610,14 +1595,6 @@ static void __inline__ fec_phy_ack_intr(void)
 {
 }
 
-static void __inline__ fec_localhw_setup(void)
-{
-}
-
-static void __inline__ fec_uncache(unsigned long addr)
-{
-}
-
 /* ------------------------------------------------------------------------- */
 
 #elif defined(CONFIG_M532x)
@@ -1737,10 +1714,6 @@ static void __inline__ fec_get_mac(struct net_device *dev)
                dev->dev_addr[ETH_ALEN-1] = fec_mac_default[ETH_ALEN-1] + fep->index;
 }
 
-static void __inline__ fec_enable_phy_intr(void)
-{
-}
-
 static void __inline__ fec_disable_phy_intr(void)
 {
 }
@@ -1749,107 +1722,6 @@ static void __inline__ fec_phy_ack_intr(void)
 {
 }
 
-static void __inline__ fec_localhw_setup(void)
-{
-}
-
-/*
- *     Do not need to make region uncached on 532x.
- */
-static void __inline__ fec_uncache(unsigned long addr)
-{
-}
-
-/* ------------------------------------------------------------------------- */
-
-
-#else
-
-/*
- *     Code specific to the MPC860T setup.
- */
-static void __inline__ fec_request_intrs(struct net_device *dev)
-{
-       volatile immap_t *immap;
-
-       immap = (immap_t *)IMAP_ADDR;   /* pointer to internal registers */
-
-       if (request_8xxirq(FEC_INTERRUPT, fec_enet_interrupt, 0, "fec", dev) != 0)
-               panic("Could not allocate FEC IRQ!");
-}
-
-static void __inline__ fec_get_mac(struct net_device *dev)
-{
-       bd_t *bd;
-
-       bd = (bd_t *)__res;
-       memcpy(dev->dev_addr, bd->bi_enetaddr, ETH_ALEN);
-}
-
-static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
-{
-       extern uint _get_IMMR(void);
-       volatile immap_t *immap;
-       volatile fec_t *fecp;
-
-       fecp = fep->hwp;
-       immap = (immap_t *)IMAP_ADDR;   /* pointer to internal registers */
-
-       /* Configure all of port D for MII.
-       */
-       immap->im_ioport.iop_pdpar = 0x1fff;
-
-       /* Bits moved from Rev. D onward.
-       */
-       if ((_get_IMMR() & 0xffff) < 0x0501)
-               immap->im_ioport.iop_pddir = 0x1c58;    /* Pre rev. D */
-       else
-               immap->im_ioport.iop_pddir = 0x1fff;    /* Rev. D and later */
-
-       /* Set MII speed to 2.5 MHz
-       */
-       fecp->fec_mii_speed = fep->phy_speed =
-               ((bd->bi_busfreq * 1000000) / 2500000) & 0x7e;
-}
-
-static void __inline__ fec_enable_phy_intr(void)
-{
-       volatile fec_t *fecp;
-
-       fecp = fep->hwp;
-
-       /* Enable MII command finished interrupt
-       */
-       fecp->fec_ivec = (FEC_INTERRUPT/2) << 29;
-}
-
-static void __inline__ fec_disable_phy_intr(void)
-{
-}
-
-static void __inline__ fec_phy_ack_intr(void)
-{
-}
-
-static void __inline__ fec_localhw_setup(void)
-{
-       volatile fec_t *fecp;
-
-       fecp = fep->hwp;
-       fecp->fec_r_hash = PKT_MAXBUF_SIZE;
-       /* Enable big endian and don't care about SDMA FC.
-       */
-       fecp->fec_fun_code = 0x78000000;
-}
-
-static void __inline__ fec_uncache(unsigned long addr)
-{
-       pte_t *pte;
-       pte = va_to_pte(mem_addr);
-       pte_val(*pte) |= _PAGE_NO_CACHE;
-       flush_tlb_page(init_mm.mmap, mem_addr);
-}
-
 #endif
 
 /* ------------------------------------------------------------------------- */
@@ -2055,7 +1927,9 @@ mii_discover_phy(uint mii_reg, struct net_device *dev)
                printk("FEC: No PHY device found.\n");
                /* Disable external MII interface */
                fecp->fec_mii_speed = fep->phy_speed = 0;
+#ifdef FREC_LEGACY
                fec_disable_phy_intr();
+#endif
        }
 }
 
@@ -2237,12 +2111,12 @@ fec_set_mac_address(struct net_device *dev)
 
 }
 
-/* Initialize the FEC Ethernet on 860T (or ColdFire 5272).
- */
  /*
   * XXX:  We need to clean up on failure exits here.
+  *
+  * index is only used in legacy code
   */
-int __init fec_enet_init(struct net_device *dev)
+int __init fec_enet_init(struct net_device *dev, int index)
 {
        struct fec_enet_private *fep = netdev_priv(dev);
        unsigned long   mem_addr;
@@ -2250,15 +2124,11 @@ int __init fec_enet_init(struct net_device *dev)
        cbd_t           *cbd_base;
        volatile fec_t  *fecp;
        int             i, j;
-       static int      index = 0;
-
-       /* Only allow us to be probed once. */
-       if (index >= FEC_MAX_PORTS)
-               return -ENXIO;
 
        /* Allocate memory for buffer descriptors.
        */
-       mem_addr = __get_free_page(GFP_KERNEL);
+       mem_addr = (unsigned long)dma_alloc_coherent(NULL, PAGE_SIZE,
+                       &fep->bd_dma, GFP_KERNEL);
        if (mem_addr == 0) {
                printk("FEC: allocate descriptor memory failed?\n");
                return -ENOMEM;
@@ -2269,7 +2139,7 @@ int __init fec_enet_init(struct net_device *dev)
 
        /* Create an Ethernet device instance.
        */
-       fecp = (volatile fec_t *) fec_hw[index];
+       fecp = (volatile fec_t *)dev->base_addr;
 
        fep->index = index;
        fep->hwp = fecp;
@@ -2280,18 +2150,24 @@ int __init fec_enet_init(struct net_device *dev)
        fecp->fec_ecntrl = 1;
        udelay(10);
 
-       /* Set the Ethernet address.  If using multiple Enets on the 8xx,
-        * this needs some work to get unique addresses.
-        *
-        * This is our default MAC address unless the user changes
-        * it via eth_mac_addr (our dev->set_mac_addr handler).
-        */
+       /* Set the Ethernet address */
+#ifdef FEC_LEGACY
        fec_get_mac(dev);
+#else
+       {
+               unsigned long l;
+               l = fecp->fec_addr_low;
+               dev->dev_addr[0] = (unsigned char)((l & 0xFF000000) >> 24);
+               dev->dev_addr[1] = (unsigned char)((l & 0x00FF0000) >> 16);
+               dev->dev_addr[2] = (unsigned char)((l & 0x0000FF00) >> 8);
+               dev->dev_addr[3] = (unsigned char)((l & 0x000000FF) >> 0);
+               l = fecp->fec_addr_high;
+               dev->dev_addr[4] = (unsigned char)((l & 0xFF000000) >> 24);
+               dev->dev_addr[5] = (unsigned char)((l & 0x00FF0000) >> 16);
+       }
+#endif
 
        cbd_base = (cbd_t *)mem_addr;
-       /* XXX: missing check for allocation failure */
-
-       fec_uncache(mem_addr);
 
        /* Set receive and transmit descriptor base.
        */
@@ -2313,8 +2189,6 @@ int __init fec_enet_init(struct net_device *dev)
                mem_addr = __get_free_page(GFP_KERNEL);
                /* XXX: missing check for allocation failure */
 
-               fec_uncache(mem_addr);
-
                /* Initialize the BD for every fragment in the page.
                */
                for (j=0; j<FEC_ENET_RX_FRPPG; j++) {
@@ -2357,13 +2231,16 @@ int __init fec_enet_init(struct net_device *dev)
 
        /* Set receive and transmit descriptor base.
        */
-       fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base));
-       fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base));
+       fecp->fec_r_des_start = fep->bd_dma;
+       fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t)
+                               * RX_RING_SIZE;
 
+#ifdef FEC_LEGACY
        /* Install our interrupt handlers. This varies depending on
         * the architecture.
        */
        fec_request_intrs(dev);
+#endif
 
        fecp->fec_grp_hash_table_high = 0;
        fecp->fec_grp_hash_table_low = 0;
@@ -2375,8 +2252,6 @@ int __init fec_enet_init(struct net_device *dev)
        fecp->fec_hash_table_low = 0;
 #endif
 
-       dev->base_addr = (unsigned long)fecp;
-
        /* The FEC Ethernet specific entries in the device structure. */
        dev->open = fec_enet_open;
        dev->hard_start_xmit = fec_enet_start_xmit;
@@ -2390,7 +2265,20 @@ int __init fec_enet_init(struct net_device *dev)
        mii_free = mii_cmds;
 
        /* setup MII interface */
+#ifdef FEC_LEGACY
        fec_set_mii(dev, fep);
+#else
+       fecp->fec_r_cntrl = OPT_FRAME_SIZE | 0x04;
+       fecp->fec_x_cntrl = 0x00;
+
+       /*
+        * Set MII speed to 2.5 MHz
+        */
+       fep->phy_speed = ((((clk_get_rate(fep->clk) / 2 + 4999999)
+                                       / 2500000) / 2) & 0x3F) << 1;
+       fecp->fec_mii_speed = fep->phy_speed;
+       fec_restart(dev, 0);
+#endif
 
        /* Clear and enable interrupts */
        fecp->fec_ievent = 0xffc00000;
@@ -2403,7 +2291,6 @@ int __init fec_enet_init(struct net_device *dev)
        fep->phy_addr = 0;
        mii_queue(dev, mk_mii_read(MII_REG_PHYIR1), mii_discover_phy);
 
-       index++;
        return 0;
 }
 
@@ -2430,7 +2317,6 @@ fec_restart(struct net_device *dev, int duplex)
        /* Clear any outstanding interrupt.
        */
        fecp->fec_ievent = 0xffc00000;
-       fec_enable_phy_intr();
 
        /* Set station address.
        */
@@ -2445,12 +2331,11 @@ fec_restart(struct net_device *dev, int duplex)
        */
        fecp->fec_r_buff_size = PKT_MAXBLR_SIZE;
 
-       fec_localhw_setup();
-
        /* Set receive and transmit descriptor base.
        */
-       fecp->fec_r_des_start = __pa((uint)(fep->rx_bd_base));
-       fecp->fec_x_des_start = __pa((uint)(fep->tx_bd_base));
+       fecp->fec_r_des_start = fep->bd_dma;
+       fecp->fec_x_des_start = (unsigned long)fep->bd_dma + sizeof(cbd_t)
+                               * RX_RING_SIZE;
 
        fep->dirty_tx = fep->cur_tx = fep->tx_bd_base;
        fep->cur_rx = fep->rx_bd_base;
@@ -2552,12 +2437,12 @@ fec_stop(struct net_device *dev)
        /* Clear outstanding MII command interrupts.
        */
        fecp->fec_ievent = FEC_ENET_MII;
-       fec_enable_phy_intr();
 
        fecp->fec_imask = FEC_ENET_MII;
        fecp->fec_mii_speed = fep->phy_speed;
 }
 
+#ifdef FEC_LEGACY
 static int __init fec_enet_module_init(void)
 {
        struct net_device *dev;
@@ -2569,7 +2454,8 @@ static int __init fec_enet_module_init(void)
                dev = alloc_etherdev(sizeof(struct fec_enet_private));
                if (!dev)
                        return -ENOMEM;
-               err = fec_enet_init(dev);
+               dev->base_addr = (unsigned long)fec_hw[i];
+               err = fec_enet_init(dev, i);
                if (err) {
                        free_netdev(dev);
                        continue;
@@ -2584,6 +2470,170 @@ static int __init fec_enet_module_init(void)
        }
        return 0;
 }
+#else
+
+static int __devinit
+fec_probe(struct platform_device *pdev)
+{
+       struct fec_enet_private *fep;
+       struct net_device *ndev;
+       int i, irq, ret = 0;
+       struct resource *r;
+
+       r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!r)
+               return -ENXIO;
+
+       r = request_mem_region(r->start, resource_size(r), pdev->name);
+       if (!r)
+               return -EBUSY;
+
+       /* Init network device */
+       ndev = alloc_etherdev(sizeof(struct fec_enet_private));
+       if (!ndev)
+               return -ENOMEM;
+
+       SET_NETDEV_DEV(ndev, &pdev->dev);
+
+       /* setup board info structure */
+       fep = netdev_priv(ndev);
+       memset(fep, 0, sizeof(*fep));
+
+       ndev->base_addr = (unsigned long)ioremap(r->start, resource_size(r));
+
+       if (!ndev->base_addr) {
+               ret = -ENOMEM;
+               goto failed_ioremap;
+       }
+
+       platform_set_drvdata(pdev, ndev);
+
+       /* This device has up to three irqs on some platforms */
+       for (i = 0; i < 3; i++) {
+               irq = platform_get_irq(pdev, i);
+               if (i && irq < 0)
+                       break;
+               ret = request_irq(irq, fec_enet_interrupt, IRQF_DISABLED, pdev->name, ndev);
+               if (ret) {
+                       while (i >= 0) {
+                               irq = platform_get_irq(pdev, i);
+                               free_irq(irq, ndev);
+                               i--;
+                       }
+                       goto failed_irq;
+               }
+       }
+
+       fep->clk = clk_get(&pdev->dev, "fec_clk");
+       if (IS_ERR(fep->clk)) {
+               ret = PTR_ERR(fep->clk);
+               goto failed_clk;
+       }
+       clk_enable(fep->clk);
+
+       ret = fec_enet_init(ndev, 0);
+       if (ret)
+               goto failed_init;
+
+       ret = register_netdev(ndev);
+       if (ret)
+               goto failed_register;
+
+       return 0;
+
+failed_register:
+failed_init:
+       clk_disable(fep->clk);
+       clk_put(fep->clk);
+failed_clk:
+       for (i = 0; i < 3; i++) {
+               irq = platform_get_irq(pdev, i);
+               if (irq > 0)
+                       free_irq(irq, ndev);
+       }
+failed_irq:
+       iounmap((void __iomem *)ndev->base_addr);
+failed_ioremap:
+       free_netdev(ndev);
+
+       return ret;
+}
+
+static int __devexit
+fec_drv_remove(struct platform_device *pdev)
+{
+       struct net_device *ndev = platform_get_drvdata(pdev);
+       struct fec_enet_private *fep = netdev_priv(ndev);
+
+       platform_set_drvdata(pdev, NULL);
+
+       fec_stop(ndev);
+       clk_disable(fep->clk);
+       clk_put(fep->clk);
+       iounmap((void __iomem *)ndev->base_addr);
+       unregister_netdev(ndev);
+       free_netdev(ndev);
+       return 0;
+}
+
+static int
+fec_suspend(struct platform_device *dev, pm_message_t state)
+{
+       struct net_device *ndev = platform_get_drvdata(dev);
+       struct fec_enet_private *fep;
+
+       if (ndev) {
+               fep = netdev_priv(ndev);
+               if (netif_running(ndev)) {
+                       netif_device_detach(ndev);
+                       fec_stop(ndev);
+               }
+       }
+       return 0;
+}
+
+static int
+fec_resume(struct platform_device *dev)
+{
+       struct net_device *ndev = platform_get_drvdata(dev);
+
+       if (ndev) {
+               if (netif_running(ndev)) {
+                       fec_enet_init(ndev, 0);
+                       netif_device_attach(ndev);
+               }
+       }
+       return 0;
+}
+
+static struct platform_driver fec_driver = {
+       .driver = {
+               .name    = "fec",
+               .owner   = THIS_MODULE,
+       },
+       .probe   = fec_probe,
+       .remove  = __devexit_p(fec_drv_remove),
+       .suspend = fec_suspend,
+       .resume  = fec_resume,
+};
+
+static int __init
+fec_enet_module_init(void)
+{
+       printk(KERN_INFO "FEC Ethernet Driver\n");
+
+       return platform_driver_register(&fec_driver);
+}
+
+static void __exit
+fec_enet_cleanup(void)
+{
+       platform_driver_unregister(&fec_driver);
+}
+
+module_exit(fec_enet_cleanup);
+
+#endif /* FEC_LEGACY */
 
 module_init(fec_enet_module_init);
 
index 292719daceff0e8060aa7ae6ddef7fda0a0bcf31..76c64c92e190980ef5a5d8451412882e410ff722 100644 (file)
@@ -14,7 +14,7 @@
 /****************************************************************************/
 
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) || \
-    defined(CONFIG_M520x) || defined(CONFIG_M532x)
+    defined(CONFIG_M520x) || defined(CONFIG_M532x) || defined(CONFIG_ARCH_MXC)
 /*
  *     Just figures, Motorola would have to change the offsets for
  *     registers in the same peripheral device on different models
@@ -103,12 +103,19 @@ typedef struct fec {
 /*
  *     Define the buffer descriptor structure.
  */
+#ifdef CONFIG_ARCH_MXC
+typedef struct bufdesc {
+       unsigned short cbd_datlen;      /* Data length */
+       unsigned short cbd_sc;  /* Control and status info */
+       unsigned long cbd_bufaddr;      /* Buffer address */
+} cbd_t;
+#else
 typedef struct bufdesc {
        unsigned short  cbd_sc;                 /* Control and status info */
        unsigned short  cbd_datlen;             /* Data length */
        unsigned long   cbd_bufaddr;            /* Buffer address */
 } cbd_t;
-
+#endif
 
 /*
  *     The following definitions courtesy of commproc.h, which where
index b8251e827059643203f8a5a02fa73d1156e32a34..8b7f8b77e5e01ef3db19f1ce1f99c7ca482ae3a2 100644 (file)
@@ -39,7 +39,7 @@
  * DEV_NEED_TIMERIRQ will not harm you on sane hardware, only generating a few
  * superfluous timer interrupts from the nic.
  */
-#define FORCEDETH_VERSION              "0.62"
+#define FORCEDETH_VERSION              "0.63"
 #define DRV_NAME                       "forcedeth"
 
 #include <linux/module.h>
 enum {
        NvRegIrqStatus = 0x000,
 #define NVREG_IRQSTAT_MIIEVENT 0x040
-#define NVREG_IRQSTAT_MASK             0x81ff
+#define NVREG_IRQSTAT_MASK             0x83ff
        NvRegIrqMask = 0x004,
 #define NVREG_IRQ_RX_ERROR             0x0001
 #define NVREG_IRQ_RX                   0x0002
@@ -113,7 +113,7 @@ enum {
 #define NVREG_IRQ_LINK                 0x0040
 #define NVREG_IRQ_RX_FORCED            0x0080
 #define NVREG_IRQ_TX_FORCED            0x0100
-#define NVREG_IRQ_RECOVER_ERROR                0x8000
+#define NVREG_IRQ_RECOVER_ERROR                0x8200
 #define NVREG_IRQMASK_THROUGHPUT       0x00df
 #define NVREG_IRQMASK_CPU              0x0060
 #define NVREG_IRQ_TX_ALL               (NVREG_IRQ_TX_ERR|NVREG_IRQ_TX_OK|NVREG_IRQ_TX_FORCED)
@@ -157,6 +157,9 @@ enum {
 #define NVREG_XMITCTL_HOST_SEMA_ACQ    0x0000f000
 #define NVREG_XMITCTL_HOST_LOADED      0x00004000
 #define NVREG_XMITCTL_TX_PATH_EN       0x01000000
+#define NVREG_XMITCTL_DATA_START       0x00100000
+#define NVREG_XMITCTL_DATA_READY       0x00010000
+#define NVREG_XMITCTL_DATA_ERROR       0x00020000
        NvRegTransmitterStatus = 0x088,
 #define NVREG_XMITSTAT_BUSY    0x01
 
@@ -289,8 +292,10 @@ enum {
 #define NVREG_WAKEUPFLAGS_ACCEPT_LINKCHANGE    0x04
 #define NVREG_WAKEUPFLAGS_ENABLE       0x1111
 
-       NvRegPatternCRC = 0x204,
-       NvRegPatternMask = 0x208,
+       NvRegMgmtUnitGetVersion = 0x204,
+#define NVREG_MGMTUNITGETVERSION       0x01
+       NvRegMgmtUnitVersion = 0x208,
+#define NVREG_MGMTUNITVERSION          0x08
        NvRegPowerCap = 0x268,
 #define NVREG_POWERCAP_D3SUPP  (1<<30)
 #define NVREG_POWERCAP_D2SUPP  (1<<26)
@@ -303,6 +308,8 @@ enum {
 #define NVREG_POWERSTATE_D1            0x0001
 #define NVREG_POWERSTATE_D2            0x0002
 #define NVREG_POWERSTATE_D3            0x0003
+       NvRegMgmtUnitControl = 0x278,
+#define NVREG_MGMTUNITCONTROL_INUSE    0x20000
        NvRegTxCnt = 0x280,
        NvRegTxZeroReXmt = 0x284,
        NvRegTxOneReXmt = 0x288,
@@ -582,6 +589,9 @@ union ring_type {
 #define NV_MSI_X_VECTOR_TX    0x1
 #define NV_MSI_X_VECTOR_OTHER 0x2
 
+#define NV_MSI_PRIV_OFFSET 0x68
+#define NV_MSI_PRIV_VALUE  0xffffffff
+
 #define NV_RESTART_TX         0x1
 #define NV_RESTART_RX         0x2
 
@@ -758,6 +768,8 @@ struct fe_priv {
        u32 register_size;
        int rx_csum;
        u32 mac_in_use;
+       int mgmt_version;
+       int mgmt_sema;
 
        void __iomem *base;
 
@@ -812,6 +824,11 @@ struct fe_priv {
 
        /* power saved state */
        u32 saved_config_space[NV_PCI_REGSZ_MAX/4];
+
+       /* for different msi-x irq type */
+       char name_rx[IFNAMSIZ + 3];       /* -rx    */
+       char name_tx[IFNAMSIZ + 3];       /* -tx    */
+       char name_other[IFNAMSIZ + 6];    /* -other */
 };
 
 /*
@@ -857,7 +874,7 @@ enum {
        NV_MSIX_INT_DISABLED,
        NV_MSIX_INT_ENABLED
 };
-static int msix = NV_MSIX_INT_DISABLED;
+static int msix = NV_MSIX_INT_ENABLED;
 
 /*
  * DMA 64bit
@@ -1760,7 +1777,7 @@ static void nv_do_rx_refill(unsigned long data)
        struct fe_priv *np = netdev_priv(dev);
 
        /* Just reschedule NAPI rx processing */
-       netif_rx_schedule(&np->napi);
+       napi_schedule(&np->napi);
 }
 #else
 static void nv_do_rx_refill(unsigned long data)
@@ -3406,7 +3423,7 @@ static irqreturn_t nv_nic_irq(int foo, void *data)
 #ifdef CONFIG_FORCEDETH_NAPI
                if (events & NVREG_IRQ_RX_ALL) {
                        spin_lock(&np->lock);
-                       netif_rx_schedule(&np->napi);
+                       napi_schedule(&np->napi);
 
                        /* Disable furthur receive irq's */
                        np->irqmask &= ~NVREG_IRQ_RX_ALL;
@@ -3523,7 +3540,7 @@ static irqreturn_t nv_nic_irq_optimized(int foo, void *data)
 #ifdef CONFIG_FORCEDETH_NAPI
                if (events & NVREG_IRQ_RX_ALL) {
                        spin_lock(&np->lock);
-                       netif_rx_schedule(&np->napi);
+                       napi_schedule(&np->napi);
 
                        /* Disable furthur receive irq's */
                        np->irqmask &= ~NVREG_IRQ_RX_ALL;
@@ -3680,7 +3697,7 @@ static int nv_napi_poll(struct napi_struct *napi, int budget)
                /* re-enable receive interrupts */
                spin_lock_irqsave(&np->lock, flags);
 
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
 
                np->irqmask |= NVREG_IRQ_RX_ALL;
                if (np->msi_flags & NV_MSI_X_ENABLED)
@@ -3703,13 +3720,13 @@ static irqreturn_t nv_nic_irq_rx(int foo, void *data)
        u32 events;
 
        events = readl(base + NvRegMSIXIrqStatus) & NVREG_IRQ_RX_ALL;
-       writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus);
 
        if (events) {
-               netif_rx_schedule(&np->napi);
                /* disable receive interrupts on the nic */
                writel(NVREG_IRQ_RX_ALL, base + NvRegIrqMask);
                pci_push(base);
+               writel(NVREG_IRQ_RX_ALL, base + NvRegMSIXIrqStatus);
+               napi_schedule(&np->napi);
        }
        return IRQ_HANDLED;
 }
@@ -3918,21 +3935,27 @@ static int nv_request_irq(struct net_device *dev, int intr_test)
                        np->msi_flags |= NV_MSI_X_ENABLED;
                        if (optimization_mode == NV_OPTIMIZATION_MODE_THROUGHPUT && !intr_test) {
                                /* Request irq for rx handling */
-                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector, &nv_nic_irq_rx, IRQF_SHARED, dev->name, dev) != 0) {
+                               sprintf(np->name_rx, "%s-rx", dev->name);
+                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector,
+                                               &nv_nic_irq_rx, IRQF_SHARED, np->name_rx, dev) != 0) {
                                        printk(KERN_INFO "forcedeth: request_irq failed for rx %d\n", ret);
                                        pci_disable_msix(np->pci_dev);
                                        np->msi_flags &= ~NV_MSI_X_ENABLED;
                                        goto out_err;
                                }
                                /* Request irq for tx handling */
-                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector, &nv_nic_irq_tx, IRQF_SHARED, dev->name, dev) != 0) {
+                               sprintf(np->name_tx, "%s-tx", dev->name);
+                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector,
+                                               &nv_nic_irq_tx, IRQF_SHARED, np->name_tx, dev) != 0) {
                                        printk(KERN_INFO "forcedeth: request_irq failed for tx %d\n", ret);
                                        pci_disable_msix(np->pci_dev);
                                        np->msi_flags &= ~NV_MSI_X_ENABLED;
                                        goto out_free_rx;
                                }
                                /* Request irq for link and timer handling */
-                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector, &nv_nic_irq_other, IRQF_SHARED, dev->name, dev) != 0) {
+                               sprintf(np->name_other, "%s-other", dev->name);
+                               if (request_irq(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector,
+                                               &nv_nic_irq_other, IRQF_SHARED, np->name_other, dev) != 0) {
                                        printk(KERN_INFO "forcedeth: request_irq failed for link %d\n", ret);
                                        pci_disable_msix(np->pci_dev);
                                        np->msi_flags &= ~NV_MSI_X_ENABLED;
@@ -4046,19 +4069,19 @@ static void nv_do_nic_poll(unsigned long data)
                        mask |= NVREG_IRQ_OTHER;
                }
        }
-       np->nic_poll_irq = 0;
-
        /* disable_irq() contains synchronize_irq, thus no irq handler can run now */
 
        if (np->recover_error) {
                np->recover_error = 0;
-               printk(KERN_INFO "forcedeth: MAC in recoverable error state\n");
+               printk(KERN_INFO "%s: MAC in recoverable error state\n", dev->name);
                if (netif_running(dev)) {
                        netif_tx_lock_bh(dev);
                        netif_addr_lock(dev);
                        spin_lock(&np->lock);
                        /* stop engines */
                        nv_stop_rxtx(dev);
+                       if (np->driver_data & DEV_HAS_POWER_CNTRL)
+                               nv_mac_reset(dev);
                        nv_txrx_reset(dev);
                        /* drain rx queue */
                        nv_drain_rxtx(dev);
@@ -4076,6 +4099,11 @@ static void nv_do_nic_poll(unsigned long data)
                        pci_push(base);
                        writel(NVREG_TXRXCTL_KICK|np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
                        pci_push(base);
+                       /* clear interrupts */
+                       if (!(np->msi_flags & NV_MSI_X_ENABLED))
+                               writel(NVREG_IRQSTAT_MASK, base + NvRegIrqStatus);
+                       else
+                               writel(NVREG_IRQSTAT_MASK, base + NvRegMSIXIrqStatus);
 
                        /* restart rx engine */
                        nv_start_rxtx(dev);
@@ -4085,11 +4113,11 @@ static void nv_do_nic_poll(unsigned long data)
                }
        }
 
-
        writel(mask, base + NvRegIrqMask);
        pci_push(base);
 
        if (!using_multi_irqs(dev)) {
+               np->nic_poll_irq = 0;
                if (nv_optimized(np))
                        nv_nic_irq_optimized(0, dev);
                else
@@ -4100,18 +4128,22 @@ static void nv_do_nic_poll(unsigned long data)
                        enable_irq_lockdep(np->pci_dev->irq);
        } else {
                if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {
+                       np->nic_poll_irq &= ~NVREG_IRQ_RX_ALL;
                        nv_nic_irq_rx(0, dev);
                        enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);
                }
                if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) {
+                       np->nic_poll_irq &= ~NVREG_IRQ_TX_ALL;
                        nv_nic_irq_tx(0, dev);
                        enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);
                }
                if (np->nic_poll_irq & NVREG_IRQ_OTHER) {
+                       np->nic_poll_irq &= ~NVREG_IRQ_OTHER;
                        nv_nic_irq_other(0, dev);
                        enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector);
                }
        }
+
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
@@ -4738,7 +4770,7 @@ static int nv_set_tx_csum(struct net_device *dev, u32 data)
        struct fe_priv *np = netdev_priv(dev);
 
        if (np->driver_data & DEV_HAS_CHECKSUM)
-               return ethtool_op_set_tx_hw_csum(dev, data);
+               return ethtool_op_set_tx_csum(dev, data);
        else
                return -EOPNOTSUPP;
 }
@@ -5169,6 +5201,7 @@ static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
 /* The mgmt unit and driver use a semaphore to access the phy during init */
 static int nv_mgmt_acquire_sema(struct net_device *dev)
 {
+       struct fe_priv *np = netdev_priv(dev);
        u8 __iomem *base = get_hwbase(dev);
        int i;
        u32 tx_ctrl, mgmt_sema;
@@ -5191,8 +5224,10 @@ static int nv_mgmt_acquire_sema(struct net_device *dev)
                /* verify that semaphore was acquired */
                tx_ctrl = readl(base + NvRegTransmitterControl);
                if (((tx_ctrl & NVREG_XMITCTL_HOST_SEMA_MASK) == NVREG_XMITCTL_HOST_SEMA_ACQ) &&
-                   ((tx_ctrl & NVREG_XMITCTL_MGMT_SEMA_MASK) == NVREG_XMITCTL_MGMT_SEMA_FREE))
+                   ((tx_ctrl & NVREG_XMITCTL_MGMT_SEMA_MASK) == NVREG_XMITCTL_MGMT_SEMA_FREE)) {
+                       np->mgmt_sema = 1;
                        return 1;
+               }
                else
                        udelay(50);
        }
@@ -5200,6 +5235,51 @@ static int nv_mgmt_acquire_sema(struct net_device *dev)
        return 0;
 }
 
+static void nv_mgmt_release_sema(struct net_device *dev)
+{
+       struct fe_priv *np = netdev_priv(dev);
+       u8 __iomem *base = get_hwbase(dev);
+       u32 tx_ctrl;
+
+       if (np->driver_data & DEV_HAS_MGMT_UNIT) {
+               if (np->mgmt_sema) {
+                       tx_ctrl = readl(base + NvRegTransmitterControl);
+                       tx_ctrl &= ~NVREG_XMITCTL_HOST_SEMA_ACQ;
+                       writel(tx_ctrl, base + NvRegTransmitterControl);
+               }
+       }
+}
+
+
+static int nv_mgmt_get_version(struct net_device *dev)
+{
+       struct fe_priv *np = netdev_priv(dev);
+       u8 __iomem *base = get_hwbase(dev);
+       u32 data_ready = readl(base + NvRegTransmitterControl);
+       u32 data_ready2 = 0;
+       unsigned long start;
+       int ready = 0;
+
+       writel(NVREG_MGMTUNITGETVERSION, base + NvRegMgmtUnitGetVersion);
+       writel(data_ready ^ NVREG_XMITCTL_DATA_START, base + NvRegTransmitterControl);
+       start = jiffies;
+       while (time_before(jiffies, start + 5*HZ)) {
+               data_ready2 = readl(base + NvRegTransmitterControl);
+               if ((data_ready & NVREG_XMITCTL_DATA_READY) != (data_ready2 & NVREG_XMITCTL_DATA_READY)) {
+                       ready = 1;
+                       break;
+               }
+               schedule_timeout_uninterruptible(1);
+       }
+
+       if (!ready || (data_ready2 & NVREG_XMITCTL_DATA_ERROR))
+               return 0;
+
+       np->mgmt_version = readl(base + NvRegMgmtUnitVersion) & NVREG_MGMTUNITVERSION;
+
+       return 1;
+}
+
 static int nv_open(struct net_device *dev)
 {
        struct fe_priv *np = netdev_priv(dev);
@@ -5771,19 +5851,26 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
 
        if (id->driver_data & DEV_HAS_MGMT_UNIT) {
                /* management unit running on the mac? */
-               if (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) {
-                       np->mac_in_use = readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST;
-                       dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n", pci_name(pci_dev), np->mac_in_use);
-                       if (nv_mgmt_acquire_sema(dev)) {
-                               /* management unit setup the phy already? */
-                               if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) ==
-                                   NVREG_XMITCTL_SYNC_PHY_INIT) {
-                                       /* phy is inited by mgmt unit */
-                                       phyinitialized = 1;
-                                       dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n", pci_name(pci_dev));
-                               } else {
-                                       /* we need to init the phy */
-                               }
+               if ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_MGMT_ST) &&
+                   (readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_PHY_INIT) &&
+                   nv_mgmt_acquire_sema(dev) &&
+                   nv_mgmt_get_version(dev)) {
+                       np->mac_in_use = 1;
+                       if (np->mgmt_version > 0) {
+                               np->mac_in_use = readl(base + NvRegMgmtUnitControl) & NVREG_MGMTUNITCONTROL_INUSE;
+                       }
+                       dprintk(KERN_INFO "%s: mgmt unit is running. mac in use %x.\n",
+                               pci_name(pci_dev), np->mac_in_use);
+                       /* management unit setup the phy already? */
+                       if (np->mac_in_use &&
+                           ((readl(base + NvRegTransmitterControl) & NVREG_XMITCTL_SYNC_MASK) ==
+                            NVREG_XMITCTL_SYNC_PHY_INIT)) {
+                               /* phy is inited by mgmt unit */
+                               phyinitialized = 1;
+                               dprintk(KERN_INFO "%s: Phy already initialized by mgmt unit.\n",
+                                       pci_name(pci_dev));
+                       } else {
+                               /* we need to init the phy */
                        }
                }
        }
@@ -5945,6 +6032,8 @@ static void __devexit nv_remove(struct pci_dev *pci_dev)
        /* restore any phy related changes */
        nv_restore_phy(dev);
 
+       nv_mgmt_release_sema(dev);
+
        /* free all structures */
        free_rings(dev);
        iounmap(get_hwbase(dev));
@@ -5995,6 +6084,8 @@ static int nv_resume(struct pci_dev *pdev)
        for (i = 0;i <= np->register_size/sizeof(u32); i++)
                writel(np->saved_config_space[i], base+i*sizeof(u32));
 
+       pci_write_config_dword(pdev, NV_MSI_PRIV_OFFSET, NV_MSI_PRIV_VALUE);
+
        netif_device_attach(dev);
        if (netif_running(dev)) {
                rc = nv_open(dev);
@@ -6068,11 +6159,11 @@ static struct pci_device_id pci_tbl[] = {
        },
        {       /* CK804 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_8),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
+               .driver_data = DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
        },
        {       /* CK804 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_9),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
+               .driver_data = DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_CHECKSUM|DEV_HAS_HIGH_DMA|DEV_HAS_STATISTICS_V1|DEV_NEED_TX_LIMIT,
        },
        {       /* MCP04 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_10),
@@ -6092,11 +6183,11 @@ static struct pci_device_id pci_tbl[] = {
        },
        {       /* MCP55 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_14),
-               .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_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT,
+               .driver_data = 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_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT,
        },
        {       /* MCP55 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_15),
-               .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_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT,
+               .driver_data = 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_V1|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_NEED_TX_LIMIT,
        },
        {       /* MCP61 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16),
index ce900e54d8d1dfa7db79e016472c7ce4996631c1..b037ce9857bf57e325a664adc0d6063bca993536 100644 (file)
@@ -209,7 +209,7 @@ static int fs_enet_rx_napi(struct napi_struct *napi, int budget)
 
        if (received < budget) {
                /* done */
-               netif_rx_complete(napi);
+               napi_complete(napi);
                (*fep->ops->napi_enable_rx)(dev);
        }
        return received;
@@ -478,7 +478,7 @@ fs_enet_interrupt(int irq, void *dev_id)
                                /* NOTE: it is possible for FCCs in NAPI mode    */
                                /* to submit a spurious interrupt while in poll  */
                                if (napi_ok)
-                                       __netif_rx_schedule(&fep->napi);
+                                       __napi_schedule(&fep->napi);
                        }
                }
 
diff --git a/drivers/net/fsl_pq_mdio.c b/drivers/net/fsl_pq_mdio.c
new file mode 100644 (file)
index 0000000..c434a15
--- /dev/null
@@ -0,0 +1,463 @@
+/*
+ * Freescale PowerQUICC Ethernet Driver -- MIIM bus implementation
+ * Provides Bus interface for MIIM regs
+ *
+ * Author: Andy Fleming <afleming@freescale.com>
+ *
+ * Copyright (c) 2002-2004,2008 Freescale Semiconductor, Inc.
+ *
+ * Based on gianfar_mii.c and ucc_geth_mii.c (Li Yang, Kim Phillips)
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/errno.h>
+#include <linux/unistd.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <linux/mm.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/crc32.h>
+#include <linux/mii.h>
+#include <linux/phy.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+
+#include <asm/io.h>
+#include <asm/irq.h>
+#include <asm/uaccess.h>
+#include <asm/ucc.h>
+
+#include "gianfar.h"
+#include "fsl_pq_mdio.h"
+
+/*
+ * Write value to the PHY at mii_id at register regnum,
+ * on the bus attached to the local interface, which may be different from the
+ * generic mdio bus (tied to a single interface), waiting until the write is
+ * done before returning. This is helpful in programming interfaces like
+ * the TBI which control interfaces like onchip SERDES and are always tied to
+ * the local mdio pins, which may not be the same as system mdio bus, used for
+ * controlling the external PHYs, for example.
+ */
+int fsl_pq_local_mdio_write(struct fsl_pq_mdio __iomem *regs, int mii_id,
+               int regnum, u16 value)
+{
+       /* Set the PHY address and the register address we want to write */
+       out_be32(&regs->miimadd, (mii_id << 8) | regnum);
+
+       /* Write out the value we want */
+       out_be32(&regs->miimcon, value);
+
+       /* Wait for the transaction to finish */
+       while (in_be32(&regs->miimind) & MIIMIND_BUSY)
+               cpu_relax();
+
+       return 0;
+}
+
+/*
+ * Read the bus for PHY at addr mii_id, register regnum, and
+ * return the value.  Clears miimcom first.  All PHY operation
+ * done on the bus attached to the local interface,
+ * which may be different from the generic mdio bus
+ * This is helpful in programming interfaces like
+ * the TBI which, in turn, control interfaces like onchip SERDES
+ * and are always tied to the local mdio pins, which may not be the
+ * same as system mdio bus, used for controlling the external PHYs, for eg.
+ */
+int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs,
+               int mii_id, int regnum)
+{
+       u16 value;
+
+       /* Set the PHY address and the register address we want to read */
+       out_be32(&regs->miimadd, (mii_id << 8) | regnum);
+
+       /* Clear miimcom, and then initiate a read */
+       out_be32(&regs->miimcom, 0);
+       out_be32(&regs->miimcom, MII_READ_COMMAND);
+
+       /* Wait for the transaction to finish */
+       while (in_be32(&regs->miimind) & (MIIMIND_NOTVALID | MIIMIND_BUSY))
+               cpu_relax();
+
+       /* Grab the value of the register from miimstat */
+       value = in_be32(&regs->miimstat);
+
+       return value;
+}
+
+/*
+ * Write value to the PHY at mii_id at register regnum,
+ * on the bus, waiting until the write is done before returning.
+ */
+int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
+{
+       struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv;
+
+       /* Write to the local MII regs */
+       return(fsl_pq_local_mdio_write(regs, mii_id, regnum, value));
+}
+
+/*
+ * Read the bus for PHY at addr mii_id, register regnum, and
+ * return the value.  Clears miimcom first.
+ */
+int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
+{
+       struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv;
+
+       /* Read the local MII regs */
+       return(fsl_pq_local_mdio_read(regs, mii_id, regnum));
+}
+
+/* Reset the MIIM registers, and wait for the bus to free */
+static int fsl_pq_mdio_reset(struct mii_bus *bus)
+{
+       struct fsl_pq_mdio __iomem *regs = (void __iomem *)bus->priv;
+       unsigned int timeout = PHY_INIT_TIMEOUT;
+
+       mutex_lock(&bus->mdio_lock);
+
+       /* Reset the management interface */
+       out_be32(&regs->miimcfg, MIIMCFG_RESET);
+
+       /* Setup the MII Mgmt clock speed */
+       out_be32(&regs->miimcfg, MIIMCFG_INIT_VALUE);
+
+       /* Wait until the bus is free */
+       while ((in_be32(&regs->miimind) & MIIMIND_BUSY) && timeout--)
+               cpu_relax();
+
+       mutex_unlock(&bus->mdio_lock);
+
+       if(timeout == 0) {
+               printk(KERN_ERR "%s: The MII Bus is stuck!\n",
+                               bus->name);
+               return -EBUSY;
+       }
+
+       return 0;
+}
+
+/* Allocate an array which provides irq #s for each PHY on the given bus */
+static int *create_irq_map(struct device_node *np)
+{
+       int *irqs;
+       int i;
+       struct device_node *child = NULL;
+
+       irqs = kcalloc(PHY_MAX_ADDR, sizeof(int), GFP_KERNEL);
+
+       if (!irqs)
+               return NULL;
+
+       for (i = 0; i < PHY_MAX_ADDR; i++)
+               irqs[i] = PHY_POLL;
+
+       while ((child = of_get_next_child(np, child)) != NULL) {
+               int irq = irq_of_parse_and_map(child, 0);
+               const u32 *id;
+
+               if (irq == NO_IRQ)
+                       continue;
+
+               id = of_get_property(child, "reg", NULL);
+
+               if (!id)
+                       continue;
+
+               if (*id < PHY_MAX_ADDR && *id >= 0)
+                       irqs[*id] = irq;
+               else
+                       printk(KERN_WARNING "%s: "
+                                       "%d is not a valid PHY address\n",
+                                       np->full_name, *id);
+       }
+
+       return irqs;
+}
+
+void fsl_pq_mdio_bus_name(char *name, struct device_node *np)
+{
+       const u32 *reg;
+
+       reg = of_get_property(np, "reg", NULL);
+
+       snprintf(name, MII_BUS_ID_SIZE, "%s@%x", np->name, reg ? *reg : 0);
+}
+
+/* Scan the bus in reverse, looking for an empty spot */
+static int fsl_pq_mdio_find_free(struct mii_bus *new_bus)
+{
+       int i;
+
+       for (i = PHY_MAX_ADDR; i > 0; i--) {
+               u32 phy_id;
+
+               if (get_phy_id(new_bus, i, &phy_id))
+                       return -1;
+
+               if (phy_id == 0xffffffff)
+                       break;
+       }
+
+       return i;
+}
+
+
+#ifdef CONFIG_GIANFAR
+static u32 __iomem *get_gfar_tbipa(struct fsl_pq_mdio __iomem *regs)
+{
+       struct gfar __iomem *enet_regs;
+
+       /*
+        * This is mildly evil, but so is our hardware for doing this.
+        * Also, we have to cast back to struct gfar because of
+        * definition weirdness done in gianfar.h.
+        */
+       enet_regs = (struct gfar __iomem *)
+               ((char __iomem *)regs - offsetof(struct gfar, gfar_mii_regs));
+
+       return &enet_regs->tbipa;
+}
+#endif
+
+
+#ifdef CONFIG_UCC_GETH
+static int get_ucc_id_for_range(u64 start, u64 end, u32 *ucc_id)
+{
+       struct device_node *np = NULL;
+       int err = 0;
+
+       for_each_compatible_node(np, NULL, "ucc_geth") {
+               struct resource tempres;
+
+               err = of_address_to_resource(np, 0, &tempres);
+               if (err)
+                       continue;
+
+               /* if our mdio regs fall within this UCC regs range */
+               if ((start >= tempres.start) && (end <= tempres.end)) {
+                       /* Find the id of the UCC */
+                       const u32 *id;
+
+                       id = of_get_property(np, "cell-index", NULL);
+                       if (!id) {
+                               id = of_get_property(np, "device-id", NULL);
+                               if (!id)
+                                       continue;
+                       }
+
+                       *ucc_id = *id;
+
+                       return 0;
+               }
+       }
+
+       if (err)
+               return err;
+       else
+               return -EINVAL;
+}
+#endif
+
+
+static int fsl_pq_mdio_probe(struct of_device *ofdev,
+               const struct of_device_id *match)
+{
+       struct device_node *np = ofdev->node;
+       struct device_node *tbi;
+       struct fsl_pq_mdio __iomem *regs;
+       u32 __iomem *tbipa;
+       struct mii_bus *new_bus;
+       int tbiaddr = -1;
+       u64 addr, size;
+       int err = 0;
+
+       new_bus = mdiobus_alloc();
+       if (NULL == new_bus)
+               return -ENOMEM;
+
+       new_bus->name = "Freescale PowerQUICC MII Bus",
+       new_bus->read = &fsl_pq_mdio_read,
+       new_bus->write = &fsl_pq_mdio_write,
+       new_bus->reset = &fsl_pq_mdio_reset,
+       fsl_pq_mdio_bus_name(new_bus->id, np);
+
+       /* Set the PHY base address */
+       addr = of_translate_address(np, of_get_address(np, 0, &size, NULL));
+       regs = ioremap(addr, size);
+
+       if (NULL == regs) {
+               err = -ENOMEM;
+               goto err_free_bus;
+       }
+
+       new_bus->priv = (void __force *)regs;
+
+       new_bus->irq = create_irq_map(np);
+
+       if (NULL == new_bus->irq) {
+               err = -ENOMEM;
+               goto err_unmap_regs;
+       }
+
+       new_bus->parent = &ofdev->dev;
+       dev_set_drvdata(&ofdev->dev, new_bus);
+
+       if (of_device_is_compatible(np, "fsl,gianfar-mdio") ||
+                       of_device_is_compatible(np, "gianfar")) {
+#ifdef CONFIG_GIANFAR
+               tbipa = get_gfar_tbipa(regs);
+#else
+               err = -ENODEV;
+               goto err_free_irqs;
+#endif
+       } else if (of_device_is_compatible(np, "fsl,ucc-mdio") ||
+                       of_device_is_compatible(np, "ucc_geth_phy")) {
+#ifdef CONFIG_UCC_GETH
+               u32 id;
+
+               tbipa = &regs->utbipar;
+
+               if ((err = get_ucc_id_for_range(addr, addr + size, &id)))
+                       goto err_free_irqs;
+
+               ucc_set_qe_mux_mii_mng(id - 1);
+#else
+               err = -ENODEV;
+               goto err_free_irqs;
+#endif
+       } else {
+               err = -ENODEV;
+               goto err_free_irqs;
+       }
+
+       for_each_child_of_node(np, tbi) {
+               if (!strncmp(tbi->type, "tbi-phy", 8))
+                       break;
+       }
+
+       if (tbi) {
+               const u32 *prop = of_get_property(tbi, "reg", NULL);
+
+               if (prop)
+                       tbiaddr = *prop;
+       }
+
+       if (tbiaddr == -1) {
+               out_be32(tbipa, 0);
+
+               tbiaddr = fsl_pq_mdio_find_free(new_bus);
+       }
+
+       /*
+        * We define TBIPA at 0 to be illegal, opting to fail for boards that
+        * have PHYs at 1-31, rather than change tbipa and rescan.
+        */
+       if (tbiaddr == 0) {
+               err = -EBUSY;
+
+               goto err_free_irqs;
+       }
+
+       out_be32(tbipa, tbiaddr);
+
+       /*
+        * The TBIPHY-only buses will find PHYs at every address,
+        * so we mask them all but the TBI
+        */
+       if (!of_device_is_compatible(np, "fsl,gianfar-mdio"))
+               new_bus->phy_mask = ~(1 << tbiaddr);
+
+       err = mdiobus_register(new_bus);
+
+       if (err) {
+               printk (KERN_ERR "%s: Cannot register as MDIO bus\n",
+                               new_bus->name);
+               goto err_free_irqs;
+       }
+
+       return 0;
+
+err_free_irqs:
+       kfree(new_bus->irq);
+err_unmap_regs:
+       iounmap(regs);
+err_free_bus:
+       kfree(new_bus);
+
+       return err;
+}
+
+
+static int fsl_pq_mdio_remove(struct of_device *ofdev)
+{
+       struct device *device = &ofdev->dev;
+       struct mii_bus *bus = dev_get_drvdata(device);
+
+       mdiobus_unregister(bus);
+
+       dev_set_drvdata(device, NULL);
+
+       iounmap((void __iomem *)bus->priv);
+       bus->priv = NULL;
+       mdiobus_free(bus);
+
+       return 0;
+}
+
+static struct of_device_id fsl_pq_mdio_match[] = {
+       {
+               .type = "mdio",
+               .compatible = "ucc_geth_phy",
+       },
+       {
+               .type = "mdio",
+               .compatible = "gianfar",
+       },
+       {
+               .compatible = "fsl,ucc-mdio",
+       },
+       {
+               .compatible = "fsl,gianfar-tbi",
+       },
+       {
+               .compatible = "fsl,gianfar-mdio",
+       },
+       {},
+};
+
+static struct of_platform_driver fsl_pq_mdio_driver = {
+       .name = "fsl-pq_mdio",
+       .probe = fsl_pq_mdio_probe,
+       .remove = fsl_pq_mdio_remove,
+       .match_table = fsl_pq_mdio_match,
+};
+
+int __init fsl_pq_mdio_init(void)
+{
+       return of_register_platform_driver(&fsl_pq_mdio_driver);
+}
+
+void fsl_pq_mdio_exit(void)
+{
+       of_unregister_platform_driver(&fsl_pq_mdio_driver);
+}
+subsys_initcall_sync(fsl_pq_mdio_init);
+module_exit(fsl_pq_mdio_exit);
diff --git a/drivers/net/fsl_pq_mdio.h b/drivers/net/fsl_pq_mdio.h
new file mode 100644 (file)
index 0000000..36dad52
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Freescale PowerQUICC MDIO Driver -- MII Management Bus Implementation
+ * Driver for the MDIO bus controller on Freescale PowerQUICC processors
+ *
+ * Author: Andy Fleming
+ *
+ * Copyright (c) 2002-2004,2008 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ *
+ */
+#ifndef __FSL_PQ_MDIO_H
+#define __FSL_PQ_MDIO_H
+
+#define MIIMIND_BUSY            0x00000001
+#define MIIMIND_NOTVALID        0x00000004
+#define MIIMCFG_INIT_VALUE     0x00000007
+#define MIIMCFG_RESET           0x80000000
+
+#define MII_READ_COMMAND       0x00000001
+
+struct fsl_pq_mdio {
+       u32 miimcfg;            /* MII management configuration reg */
+       u32 miimcom;            /* MII management command reg */
+       u32 miimadd;            /* MII management address reg */
+       u32 miimcon;            /* MII management control reg */
+       u32 miimstat;           /* MII management status reg */
+       u32 miimind;            /* MII management indication reg */
+       u8 reserved[28];        /* Space holder */
+       u32 utbipar;            /* TBI phy address reg (only on UCC) */
+} __attribute__ ((packed));
+
+
+int fsl_pq_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
+int fsl_pq_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
+int fsl_pq_local_mdio_write(struct fsl_pq_mdio __iomem *regs, int mii_id,
+                         int regnum, u16 value);
+int fsl_pq_local_mdio_read(struct fsl_pq_mdio __iomem *regs, int mii_id, int regnum);
+int __init fsl_pq_mdio_init(void);
+void fsl_pq_mdio_exit(void);
+void fsl_pq_mdio_bus_name(char *name, struct device_node *np);
+#endif /* FSL_PQ_MDIO_H */
index 9b12a13a640f1383fdd3265ae3ebe69949f1b936..a64a4385f5a5f992eae32be996f35f03143d18dc 100644 (file)
@@ -93,7 +93,7 @@
 #include <linux/of.h>
 
 #include "gianfar.h"
-#include "gianfar_mii.h"
+#include "fsl_pq_mdio.h"
 
 #define TX_TIMEOUT      (1*HZ)
 #undef BRIEF_GFAR_ERRORS
@@ -141,8 +141,6 @@ void gfar_start(struct net_device *dev);
 static void gfar_clear_exact_match(struct net_device *dev);
 static void gfar_set_mac_for_addr(struct net_device *dev, int num, u8 *addr);
 
-extern const struct ethtool_ops gfar_ethtool_ops;
-
 MODULE_AUTHOR("Freescale Semiconductor, Inc");
 MODULE_DESCRIPTION("Gianfar Ethernet Driver");
 MODULE_LICENSE("GPL");
@@ -166,6 +164,9 @@ static int gfar_of_init(struct net_device *dev)
        struct gfar_private *priv = netdev_priv(dev);
        struct device_node *np = priv->node;
        char bus_name[MII_BUS_ID_SIZE];
+       const u32 *stash;
+       const u32 *stash_len;
+       const u32 *stash_idx;
 
        if (!np || !of_device_is_available(np))
                return -ENODEV;
@@ -195,6 +196,26 @@ static int gfar_of_init(struct net_device *dev)
                }
        }
 
+       stash = of_get_property(np, "bd-stash", NULL);
+
+       if(stash) {
+               priv->device_flags |= FSL_GIANFAR_DEV_HAS_BD_STASHING;
+               priv->bd_stash_en = 1;
+       }
+
+       stash_len = of_get_property(np, "rx-stash-len", NULL);
+
+       if (stash_len)
+               priv->rx_stash_size = *stash_len;
+
+       stash_idx = of_get_property(np, "rx-stash-idx", NULL);
+
+       if (stash_idx)
+               priv->rx_stash_index = *stash_idx;
+
+       if (stash_len || stash_idx)
+               priv->device_flags |= FSL_GIANFAR_DEV_HAS_BUF_STASHING;
+
        mac_addr = of_get_mac_address(np);
        if (mac_addr)
                memcpy(dev->dev_addr, mac_addr, MAC_ADDR_LEN);
@@ -255,7 +276,7 @@ static int gfar_of_init(struct net_device *dev)
                of_node_put(phy);
                of_node_put(mdio);
 
-               gfar_mdio_bus_name(bus_name, mdio);
+               fsl_pq_mdio_bus_name(bus_name, mdio);
                snprintf(priv->phy_bus_id, sizeof(priv->phy_bus_id), "%s:%02x",
                                bus_name, *id);
        }
@@ -425,7 +446,7 @@ static int gfar_probe(struct of_device *ofdev,
                priv->hash_width = 8;
 
                priv->hash_regs[0] = &priv->regs->gaddr0;
-                priv->hash_regs[1] = &priv->regs->gaddr1;
+               priv->hash_regs[1] = &priv->regs->gaddr1;
                priv->hash_regs[2] = &priv->regs->gaddr2;
                priv->hash_regs[3] = &priv->regs->gaddr3;
                priv->hash_regs[4] = &priv->regs->gaddr4;
@@ -466,6 +487,9 @@ static int gfar_probe(struct of_device *ofdev,
                goto register_fail;
        }
 
+       device_init_wakeup(&dev->dev,
+               priv->device_flags & FSL_GIANFAR_DEV_HAS_MAGIC_PACKET);
+
        /* fill out IRQ number and name fields */
        len_devname = strlen(dev->name);
        strncpy(&priv->int_name_tx[0], dev->name, len_devname);
@@ -838,7 +862,7 @@ void stop_gfar(struct net_device *dev)
                free_irq(priv->interruptTransmit, dev);
                free_irq(priv->interruptReceive, dev);
        } else {
-               free_irq(priv->interruptTransmit, dev);
+               free_irq(priv->interruptTransmit, dev);
        }
 
        free_skb_resources(priv);
@@ -1183,6 +1207,8 @@ static int gfar_enet_open(struct net_device *dev)
 
        napi_enable(&priv->napi);
 
+       skb_queue_head_init(&priv->rx_recycle);
+
        /* Initialize a bunch of registers */
        init_registers(dev);
 
@@ -1203,6 +1229,8 @@ static int gfar_enet_open(struct net_device *dev)
 
        netif_start_queue(dev);
 
+       device_set_wakeup_enable(&dev->dev, priv->wol_en);
+
        return err;
 }
 
@@ -1399,6 +1427,7 @@ static int gfar_close(struct net_device *dev)
 
        napi_disable(&priv->napi);
 
+       skb_queue_purge(&priv->rx_recycle);
        cancel_work_sync(&priv->reset_task);
        stop_gfar(dev);
 
@@ -1595,7 +1624,17 @@ static int gfar_clean_tx_ring(struct net_device *dev)
                        bdp = next_txbd(bdp, base, tx_ring_size);
                }
 
-               dev_kfree_skb_any(skb);
+               /*
+                * If there's room in the queue (limit it to rx_buffer_size)
+                * we add this skb back into the pool, if it's the right size
+                */
+               if (skb_queue_len(&priv->rx_recycle) < priv->rx_ring_size &&
+                               skb_recycle_check(skb, priv->rx_buffer_size +
+                                       RXBUF_ALIGNMENT))
+                       __skb_queue_head(&priv->rx_recycle, skb);
+               else
+                       dev_kfree_skb_any(skb);
+
                priv->tx_skbuff[skb_dirtytx] = NULL;
 
                skb_dirtytx = (skb_dirtytx + 1) &
@@ -1626,9 +1665,9 @@ static void gfar_schedule_cleanup(struct net_device *dev)
        spin_lock_irqsave(&priv->txlock, flags);
        spin_lock(&priv->rxlock);
 
-       if (netif_rx_schedule_prep(&priv->napi)) {
+       if (napi_schedule_prep(&priv->napi)) {
                gfar_write(&priv->regs->imask, IMASK_RTX_DISABLED);
-               __netif_rx_schedule(&priv->napi);
+               __napi_schedule(&priv->napi);
        } else {
                /*
                 * Clear IEVENT, so interrupts aren't called again
@@ -1674,8 +1713,10 @@ struct sk_buff * gfar_new_skb(struct net_device *dev)
        struct gfar_private *priv = netdev_priv(dev);
        struct sk_buff *skb = NULL;
 
-       /* We have to allocate the skb, so keep trying till we succeed */
-       skb = netdev_alloc_skb(dev, priv->rx_buffer_size + RXBUF_ALIGNMENT);
+       skb = __skb_dequeue(&priv->rx_recycle);
+       if (!skb)
+               skb = netdev_alloc_skb(dev,
+                               priv->rx_buffer_size + RXBUF_ALIGNMENT);
 
        if (!skb)
                return NULL;
@@ -1823,7 +1864,7 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
                        if (unlikely(!newskb))
                                newskb = skb;
                        else if (skb)
-                               dev_kfree_skb_any(skb);
+                               __skb_queue_head(&priv->rx_recycle, skb);
                } else {
                        /* Increment the number of packets */
                        dev->stats.rx_packets++;
@@ -1835,6 +1876,8 @@ int gfar_clean_rx_ring(struct net_device *dev, int rx_work_limit)
                                skb_put(skb, pkt_len);
                                dev->stats.rx_bytes += pkt_len;
 
+                               if (in_irq() || irqs_disabled())
+                                       printk("Interrupt problem!\n");
                                gfar_process_frame(dev, skb, amount_pull);
 
                        } else {
@@ -1891,7 +1934,7 @@ static int gfar_poll(struct napi_struct *napi, int budget)
                return budget;
 
        if (rx_cleaned < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
                /* Clear the halt bit in RSTAT */
                gfar_write(&priv->regs->rstat, RSTAT_CLEAR_RHALT);
@@ -2308,23 +2351,12 @@ static struct of_platform_driver gfar_driver = {
 
 static int __init gfar_init(void)
 {
-       int err = gfar_mdio_init();
-
-       if (err)
-               return err;
-
-       err = of_register_platform_driver(&gfar_driver);
-
-       if (err)
-               gfar_mdio_exit();
-
-       return err;
+       return of_register_platform_driver(&gfar_driver);
 }
 
 static void __exit gfar_exit(void)
 {
        of_unregister_platform_driver(&gfar_driver);
-       gfar_mdio_exit();
 }
 
 module_init(gfar_init);
index eaa86897f5c391109713c60e1761f32fecd65c38..54332b0059df72d6e6dccbaf9168ca5c62715235 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/workqueue.h>
 #include <linux/ethtool.h>
 #include <linux/fsl_devices.h>
-#include "gianfar_mii.h"
 
 /* The maximum number of packets to be handled in one call of gfar_poll */
 #define GFAR_DEV_WEIGHT 64
@@ -126,9 +125,12 @@ extern const char gfar_driver_version[];
 #define DEFAULT_RX_COALESCE 0
 #define DEFAULT_RXCOUNT        0
 
-#define MIIMCFG_INIT_VALUE     0x00000007
-#define MIIMCFG_RESET           0x80000000
-#define MIIMIND_BUSY            0x00000001
+#define GFAR_SUPPORTED (SUPPORTED_10baseT_Half \
+               | SUPPORTED_10baseT_Full \
+               | SUPPORTED_100baseT_Half \
+               | SUPPORTED_100baseT_Full \
+               | SUPPORTED_Autoneg \
+               | SUPPORTED_MII)
 
 /* TBI register addresses */
 #define MII_TBICON             0x11
@@ -756,6 +758,8 @@ struct gfar_private {
        unsigned int rx_stash_size;
        unsigned int rx_stash_index;
 
+       struct sk_buff_head rx_recycle;
+
        struct vlan_group *vlgrp;
 
        /* Unprotected fields */
@@ -826,8 +830,7 @@ extern void gfar_halt(struct net_device *dev);
 extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev,
                int enable, u32 regnum, u32 read);
 void gfar_init_sysfs(struct net_device *dev);
-int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id,
-                         int regnum, u16 value);
-int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum);
+
+extern const struct ethtool_ops gfar_ethtool_ops;
 
 #endif /* __GIANFAR_H */
index 59b3b5d98efe5bcc746e687b766301e5c6b52720..dbf06e9313cc27750362aa59ab6bb779051f81b8 100644 (file)
@@ -600,6 +600,7 @@ static int gfar_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 
        spin_lock_irqsave(&priv->bflock, flags);
        priv->wol_en = wol->wolopts & WAKE_MAGIC ? 1 : 0;
+       device_set_wakeup_enable(&dev->dev, priv->wol_en);
        spin_unlock_irqrestore(&priv->bflock, flags);
 
        return 0;
index f49a426ad681c1996f7675f8e993eb784e4981af..64e4679b3279e8f93e65265c5e709cbc7c5c92f5 100644 (file)
@@ -105,7 +105,7 @@ int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum)
  * All PHY configuration is done through the TSEC1 MIIM regs */
 int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
 {
-       struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
+       struct gfar_mii __iomem *regs = (void __force __iomem *)bus->priv;
 
        /* Write to the local MII regs */
        return(gfar_local_mdio_write(regs, mii_id, regnum, value));
@@ -116,7 +116,7 @@ int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
  * configuration has to be done through the TSEC1 MIIM regs */
 int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 {
-       struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
+       struct gfar_mii __iomem *regs = (void __force __iomem *)bus->priv;
 
        /* Read the local MII regs */
        return(gfar_local_mdio_read(regs, mii_id, regnum));
@@ -125,7 +125,7 @@ int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
 /* Reset the MIIM registers, and wait for the bus to free */
 static int gfar_mdio_reset(struct mii_bus *bus)
 {
-       struct gfar_mii __iomem *regs = (void __iomem *)bus->priv;
+       struct gfar_mii __iomem *regs = (void __force __iomem *)bus->priv;
        unsigned int timeout = PHY_INIT_TIMEOUT;
 
        mutex_lock(&bus->mdio_lock);
@@ -268,8 +268,8 @@ static int gfar_mdio_probe(struct of_device *ofdev,
         * Also, we have to cast back to struct gfar_mii because of
         * definition weirdness done in gianfar.h.
         */
-       enet_regs = (struct gfar __iomem *)
-               ((char *)regs - offsetof(struct gfar, gfar_mii_regs));
+       enet_regs = (struct gfar __force __iomem *)
+               ((char __force *)regs - offsetof(struct gfar, gfar_mii_regs));
 
        for_each_child_of_node(np, tbi) {
                if (!strncmp(tbi->type, "tbi-phy", 8))
@@ -337,7 +337,7 @@ static int gfar_mdio_remove(struct of_device *ofdev)
 
        dev_set_drvdata(&ofdev->dev, NULL);
 
-       iounmap((void __iomem *)bus->priv);
+       iounmap((void __force __iomem *)bus->priv);
        bus->priv = NULL;
        kfree(bus->irq);
        mdiobus_free(bus);
diff --git a/drivers/net/gianfar_mii.h b/drivers/net/gianfar_mii.h
deleted file mode 100644 (file)
index 65c242c..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * drivers/net/gianfar_mii.h
- *
- * Gianfar Ethernet Driver -- MII Management Bus Implementation
- * Driver for the MDIO bus controller in the Gianfar register space
- *
- * Author: Andy Fleming
- * Maintainer: Kumar Gala
- *
- * Copyright (c) 2002-2004 Freescale Semiconductor, Inc.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-#ifndef __GIANFAR_MII_H
-#define __GIANFAR_MII_H
-
-struct gfar_private; /* forward ref */
-
-#define MIIMIND_BUSY            0x00000001
-#define MIIMIND_NOTVALID        0x00000004
-
-#define MII_READ_COMMAND       0x00000001
-
-#define GFAR_SUPPORTED (SUPPORTED_10baseT_Half \
-               | SUPPORTED_10baseT_Full \
-               | SUPPORTED_100baseT_Half \
-               | SUPPORTED_100baseT_Full \
-               | SUPPORTED_Autoneg \
-               | SUPPORTED_MII)
-
-struct gfar_mii {
-       u32     miimcfg;        /* 0x.520 - MII Management Config Register */
-       u32     miimcom;        /* 0x.524 - MII Management Command Register */
-       u32     miimadd;        /* 0x.528 - MII Management Address Register */
-       u32     miimcon;        /* 0x.52c - MII Management Control Register */
-       u32     miimstat;       /* 0x.530 - MII Management Status Register */
-       u32     miimind;        /* 0x.534 - MII Management Indicator Register */
-};
-
-int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
-int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
-int gfar_local_mdio_write(struct gfar_mii __iomem *regs, int mii_id,
-                         int regnum, u16 value);
-int gfar_local_mdio_read(struct gfar_mii __iomem *regs, int mii_id, int regnum);
-struct mii_bus *gfar_get_miibus(const struct gfar_private *priv);
-int __init gfar_mdio_init(void);
-void gfar_mdio_exit(void);
-
-void gfar_mdio_bus_name(char *name, struct device_node *np);
-#endif /* GIANFAR_PHY_H */
index 782c201700820c45abb1cddfd1dba606ba6c38ae..dd26da74f27a0e0ba808bdbb5c42c89dec3cbf65 100644 (file)
@@ -53,6 +53,9 @@ static ssize_t gfar_set_bd_stash(struct device *dev,
        u32 temp;
        unsigned long flags;
 
+       if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BD_STASHING))
+               return count;
+
        /* Find out the new setting */
        if (!strncmp("on", buf, count - 1) || !strncmp("1", buf, count - 1))
                new_setting = 1;
@@ -81,7 +84,7 @@ static ssize_t gfar_set_bd_stash(struct device *dev,
        return count;
 }
 
-DEVICE_ATTR(bd_stash, 0644, gfar_show_bd_stash, gfar_set_bd_stash);
+static DEVICE_ATTR(bd_stash, 0644, gfar_show_bd_stash, gfar_set_bd_stash);
 
 static ssize_t gfar_show_rx_stash_size(struct device *dev,
                                       struct device_attribute *attr, char *buf)
@@ -100,6 +103,9 @@ static ssize_t gfar_set_rx_stash_size(struct device *dev,
        u32 temp;
        unsigned long flags;
 
+       if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING))
+               return count;
+
        spin_lock_irqsave(&priv->rxlock, flags);
        if (length > priv->rx_buffer_size)
                goto out;
@@ -130,8 +136,8 @@ out:
        return count;
 }
 
-DEVICE_ATTR(rx_stash_size, 0644, gfar_show_rx_stash_size,
-           gfar_set_rx_stash_size);
+static DEVICE_ATTR(rx_stash_size, 0644, gfar_show_rx_stash_size,
+                  gfar_set_rx_stash_size);
 
 /* Stashing will only be enabled when rx_stash_size != 0 */
 static ssize_t gfar_show_rx_stash_index(struct device *dev,
@@ -152,6 +158,9 @@ static ssize_t gfar_set_rx_stash_index(struct device *dev,
        u32 temp;
        unsigned long flags;
 
+       if (!(priv->device_flags & FSL_GIANFAR_DEV_HAS_BUF_STASHING))
+               return count;
+
        spin_lock_irqsave(&priv->rxlock, flags);
        if (index > priv->rx_stash_size)
                goto out;
@@ -172,8 +181,8 @@ out:
        return count;
 }
 
-DEVICE_ATTR(rx_stash_index, 0644, gfar_show_rx_stash_index,
-           gfar_set_rx_stash_index);
+static DEVICE_ATTR(rx_stash_index, 0644, gfar_show_rx_stash_index,
+                  gfar_set_rx_stash_index);
 
 static ssize_t gfar_show_fifo_threshold(struct device *dev,
                                        struct device_attribute *attr,
@@ -210,8 +219,8 @@ static ssize_t gfar_set_fifo_threshold(struct device *dev,
        return count;
 }
 
-DEVICE_ATTR(fifo_threshold, 0644, gfar_show_fifo_threshold,
-           gfar_set_fifo_threshold);
+static DEVICE_ATTR(fifo_threshold, 0644, gfar_show_fifo_threshold,
+                  gfar_set_fifo_threshold);
 
 static ssize_t gfar_show_fifo_starve(struct device *dev,
                                     struct device_attribute *attr, char *buf)
@@ -247,7 +256,8 @@ static ssize_t gfar_set_fifo_starve(struct device *dev,
        return count;
 }
 
-DEVICE_ATTR(fifo_starve, 0644, gfar_show_fifo_starve, gfar_set_fifo_starve);
+static DEVICE_ATTR(fifo_starve, 0644, gfar_show_fifo_starve,
+                  gfar_set_fifo_starve);
 
 static ssize_t gfar_show_fifo_starve_off(struct device *dev,
                                         struct device_attribute *attr,
@@ -284,8 +294,8 @@ static ssize_t gfar_set_fifo_starve_off(struct device *dev,
        return count;
 }
 
-DEVICE_ATTR(fifo_starve_off, 0644, gfar_show_fifo_starve_off,
-           gfar_set_fifo_starve_off);
+static DEVICE_ATTR(fifo_starve_off, 0644, gfar_show_fifo_starve_off,
+                  gfar_set_fifo_starve_off);
 
 void gfar_init_sysfs(struct net_device *dev)
 {
@@ -293,12 +303,9 @@ void gfar_init_sysfs(struct net_device *dev)
        int rc;
 
        /* Initialize the default values */
-       priv->rx_stash_size = DEFAULT_STASH_LENGTH;
-       priv->rx_stash_index = DEFAULT_STASH_INDEX;
        priv->fifo_threshold = DEFAULT_FIFO_TX_THR;
        priv->fifo_starve = DEFAULT_FIFO_TX_STARVE;
        priv->fifo_starve_off = DEFAULT_FIFO_TX_STARVE_OFF;
-       priv->bd_stash_en = DEFAULT_BD_STASH;
 
        /* Create our sysfs files */
        rc = device_create_file(&dev->dev, &dev_attr_bd_stash);
index 7e8b3c59a7d6ca1f2613e2d3028b3f3b18f7d952..455641f8677e6be6e523b2f7b2230b34662d6d59 100644 (file)
@@ -1244,7 +1244,7 @@ do { \
     csum_add(sum, (ih)->saddr & 0xffff); \
     csum_add(sum, (ih)->daddr >> 16); \
     csum_add(sum, (ih)->daddr & 0xffff); \
-    csum_add(sum, __constant_htons(IPPROTO_UDP)); \
+    csum_add(sum, cpu_to_be16(IPPROTO_UDP)); \
     csum_add(sum, (uh)->len); \
 } while (0)
 
@@ -1255,7 +1255,7 @@ do { \
     csum_add(sum, (ih)->saddr & 0xffff); \
     csum_add(sum, (ih)->daddr >> 16); \
     csum_add(sum, (ih)->daddr & 0xffff); \
-    csum_add(sum, __constant_htons(IPPROTO_TCP)); \
+    csum_add(sum, cpu_to_be16(IPPROTO_TCP)); \
     csum_add(sum, htons(len)); \
 } while (0)
 #endif
@@ -1296,7 +1296,7 @@ static int hamachi_start_xmit(struct sk_buff *skb, struct net_device *dev)
            /* tack on checksum tag */
            u32 tagval = 0;
            struct ethhdr *eh = (struct ethhdr *)skb->data;
-           if (eh->h_proto == __constant_htons(ETH_P_IP)) {
+           if (eh->h_proto == cpu_to_be16(ETH_P_IP)) {
                struct iphdr *ih = (struct iphdr *)((char *)eh + ETH_HLEN);
                if (ih->protocol == IPPROTO_UDP) {
                    struct udphdr *uh
@@ -1605,7 +1605,7 @@ static int hamachi_rx(struct net_device *dev)
                                 */
                                if (ntohs(ih->tot_len) >= 46){
                                        /* don't worry about frags */
-                                       if (!(ih->frag_off & __constant_htons(IP_MF|IP_OFFSET))) {
+                                       if (!(ih->frag_off & cpu_to_be16(IP_MF|IP_OFFSET))) {
                                                u32 inv = *(u32 *) &buf_addr[data_size - 16];
                                                u32 *p = (u32 *) &buf_addr[data_size - 20];
                                                register u32 crc, p_r, p_r1;
index 2d4089894ec7b13c61f7626c95b8fa991ca104a5..155160052c8bd5dc690c1bfe04b253654e739cab 100644 (file)
@@ -322,23 +322,25 @@ static const struct header_ops sp_header_ops = {
        .rebuild        = sp_rebuild_header,
 };
 
+static const struct net_device_ops sp_netdev_ops = {
+       .ndo_open               = sp_open_dev,
+       .ndo_stop               = sp_close,
+       .ndo_start_xmit         = sp_xmit,
+       .ndo_set_mac_address    = sp_set_mac_address,
+};
+
 static void sp_setup(struct net_device *dev)
 {
        /* Finish setting up the DEVICE info. */
-       dev->mtu                = SIXP_MTU;
-       dev->hard_start_xmit    = sp_xmit;
-       dev->open               = sp_open_dev;
+       dev->netdev_ops         = &sp_netdev_ops;
        dev->destructor         = free_netdev;
-       dev->stop               = sp_close;
-
-       dev->set_mac_address    = sp_set_mac_address;
+       dev->mtu                = SIXP_MTU;
        dev->hard_header_len    = AX25_MAX_HEADER_LEN;
        dev->header_ops         = &sp_header_ops;
 
        dev->addr_len           = AX25_ADDR_LEN;
        dev->type               = ARPHRD_AX25;
        dev->tx_queue_len       = 10;
-       dev->tx_timeout         = NULL;
 
        /* Only activated in AX.25 mode */
        memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
@@ -788,9 +790,9 @@ static struct tty_ldisc_ops sp_ldisc = {
 
 /* Initialize 6pack control device -- register 6pack line discipline */
 
-static char msg_banner[]  __initdata = KERN_INFO \
+static const char msg_banner[]  __initdata = KERN_INFO \
        "AX.25: 6pack driver, " SIXPACK_VERSION "\n";
-static char msg_regfail[] __initdata = KERN_ERR  \
+static const char msg_regfail[] __initdata = KERN_ERR  \
        "6pack: can't register line discipline (err = %d)\n";
 
 static int __init sixpack_init_driver(void)
index 81a65e3a1c053fe070e9a3c8985ef6f909439801..bb78c11559cd2cd9cb0876cbe2630816b539aea3 100644 (file)
@@ -203,7 +203,6 @@ struct baycom_state {
                unsigned char buf[TXBUFFER_SIZE];
         } hdlctx;
 
-        struct net_device_stats stats;
        unsigned int ptt_keyed;
        struct sk_buff *skb;  /* next transmit packet  */
 
@@ -423,7 +422,7 @@ static void encode_hdlc(struct baycom_state *bc)
        bc->hdlctx.bufptr = bc->hdlctx.buf;
        bc->hdlctx.bufcnt = wp - bc->hdlctx.buf;
        dev_kfree_skb(skb);
-       bc->stats.tx_packets++;
+       bc->dev->stats.tx_packets++;
 }
 
 /* ---------------------------------------------------------------------- */
@@ -547,7 +546,7 @@ static void do_rxpacket(struct net_device *dev)
        pktlen = bc->hdlcrx.bufcnt-2+1; /* KISS kludge */
        if (!(skb = dev_alloc_skb(pktlen))) {
                printk("%s: memory squeeze, dropping packet\n", dev->name);
-               bc->stats.rx_dropped++;
+               dev->stats.rx_dropped++;
                return;
        }
        cp = skb_put(skb, pktlen);
@@ -555,7 +554,7 @@ static void do_rxpacket(struct net_device *dev)
        memcpy(cp, bc->hdlcrx.buf, pktlen - 1);
        skb->protocol = ax25_type_trans(skb, dev);
        netif_rx(skb);
-       bc->stats.rx_packets++;
+       dev->stats.rx_packets++;
 }
 
 static int receive(struct net_device *dev, int cnt)
@@ -802,19 +801,6 @@ static int baycom_set_mac_address(struct net_device *dev, void *addr)
 
 /* --------------------------------------------------------------------- */
 
-static struct net_device_stats *baycom_get_stats(struct net_device *dev)
-{
-       struct baycom_state *bc = netdev_priv(dev);
-
-       /* 
-        * Get the current statistics.  This may be called with the
-        * card open or closed. 
-        */
-       return &bc->stats;
-}
-
-/* --------------------------------------------------------------------- */
-
 static void epp_wakeup(void *handle)
 {
         struct net_device *dev = (struct net_device *)handle;
@@ -1065,10 +1051,10 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                hi.data.cs.ptt = !!(bc->stat & EPP_PTTBIT);
                hi.data.cs.dcd = !(bc->stat & EPP_DCDBIT);
                hi.data.cs.ptt_keyed = bc->ptt_keyed;
-               hi.data.cs.tx_packets = bc->stats.tx_packets;
-               hi.data.cs.tx_errors = bc->stats.tx_errors;
-               hi.data.cs.rx_packets = bc->stats.rx_packets;
-               hi.data.cs.rx_errors = bc->stats.rx_errors;
+               hi.data.cs.tx_packets = dev->stats.tx_packets;
+               hi.data.cs.tx_errors = dev->stats.tx_errors;
+               hi.data.cs.rx_packets = dev->stats.rx_packets;
+               hi.data.cs.rx_errors = dev->stats.rx_errors;
                break;          
 
        case HDLCDRVCTL_OLDGETSTAT:
@@ -1116,6 +1102,14 @@ static int baycom_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
 /* --------------------------------------------------------------------- */
 
+static const struct net_device_ops baycom_netdev_ops = {
+       .ndo_open            = epp_open,
+       .ndo_stop            = epp_close,
+       .ndo_do_ioctl        = baycom_ioctl,
+       .ndo_start_xmit      = baycom_send_packet,
+       .ndo_set_mac_address = baycom_set_mac_address,
+};
+
 /*
  * Check for a network adaptor of this type, and return '0' if one exists.
  * If dev->base_addr == 0, probe all likely locations.
@@ -1143,17 +1137,12 @@ static void baycom_probe(struct net_device *dev)
        /*
         * initialize the device struct
         */
-       dev->open = epp_open;
-       dev->stop = epp_close;
-       dev->do_ioctl = baycom_ioctl;
-       dev->hard_start_xmit = baycom_send_packet;
-       dev->get_stats = baycom_get_stats;
 
        /* Fill in the fields of the device structure */
        bc->skb = NULL;
        
+       dev->netdev_ops = &baycom_netdev_ops;
        dev->header_ops = &ax25_header_ops;
-       dev->set_mac_address = baycom_set_mac_address;
        
        dev->type = ARPHRD_AX25;           /* AF_AX25 device */
        dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;
index 46f8f3390e7d1806c038f791f0f103c744c09830..44b183b58f50282dc226eb8641690dd649e72b5c 100644 (file)
@@ -87,7 +87,8 @@
 
 #include <linux/bpqether.h>
 
-static char banner[] __initdata = KERN_INFO "AX.25: bpqether driver version 004\n";
+static const char banner[] __initdata = KERN_INFO \
+       "AX.25: bpqether driver version 004\n";
 
 static char bcast_addr[6]={0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
 
@@ -97,7 +98,7 @@ static int bpq_rcv(struct sk_buff *, struct net_device *, struct packet_type *,
 static int bpq_device_event(struct notifier_block *, unsigned long, void *);
 
 static struct packet_type bpq_packet_type = {
-       .type   = __constant_htons(ETH_P_BPQ),
+       .type   = cpu_to_be16(ETH_P_BPQ),
        .func   = bpq_rcv,
 };
 
@@ -110,7 +111,6 @@ struct bpqdev {
        struct list_head bpq_list;      /* list of bpq devices chain */
        struct net_device *ethdev;      /* link to ethernet device */
        struct net_device *axdev;       /* bpq device (bpq#) */
-       struct net_device_stats stats;  /* some statistics */
        char   dest_addr[6];            /* ether destination address */
        char   acpt_addr[6];            /* accept ether frames from this address only */
 };
@@ -222,8 +222,8 @@ static int bpq_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_ty
        skb_pull(skb, 2);       /* Remove the length bytes */
        skb_trim(skb, len);     /* Set the length of the data */
 
-       bpq->stats.rx_packets++;
-       bpq->stats.rx_bytes += len;
+       dev->stats.rx_packets++;
+       dev->stats.rx_bytes += len;
 
        ptr = skb_push(skb, 1);
        *ptr = 0;
@@ -292,7 +292,7 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
        bpq = netdev_priv(dev);
 
        if ((dev = bpq_get_ether_dev(dev)) == NULL) {
-               bpq->stats.tx_dropped++;
+               dev->stats.tx_dropped++;
                kfree_skb(skb);
                return -ENODEV;
        }
@@ -300,24 +300,14 @@ static int bpq_xmit(struct sk_buff *skb, struct net_device *dev)
        skb->protocol = ax25_type_trans(skb, dev);
        skb_reset_network_header(skb);
        dev_hard_header(skb, dev, ETH_P_BPQ, bpq->dest_addr, NULL, 0);
-       bpq->stats.tx_packets++;
-       bpq->stats.tx_bytes+=skb->len;
+       dev->stats.tx_packets++;
+       dev->stats.tx_bytes+=skb->len;
   
        dev_queue_xmit(skb);
        netif_wake_queue(dev);
        return 0;
 }
 
-/*
- *     Statistics
- */
-static struct net_device_stats *bpq_get_stats(struct net_device *dev)
-{
-       struct bpqdev *bpq = netdev_priv(dev);
-
-       return &bpq->stats;
-}
-
 /*
  *     Set AX.25 callsign
  */
@@ -396,6 +386,7 @@ static int bpq_close(struct net_device *dev)
  *     Proc filesystem
  */
 static void *bpq_seq_start(struct seq_file *seq, loff_t *pos)
+       __acquires(RCU)
 {
        int i = 1;
        struct bpqdev *bpqdev;
@@ -428,6 +419,7 @@ static void *bpq_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 }
 
 static void bpq_seq_stop(struct seq_file *seq, void *v)
+       __releases(RCU)
 {
        rcu_read_unlock();
 }
@@ -454,7 +446,7 @@ static int bpq_seq_show(struct seq_file *seq, void *v)
        return 0;
 }
 
-static struct seq_operations bpq_seqops = {
+static const struct seq_operations bpq_seqops = {
        .start = bpq_seq_start,
        .next = bpq_seq_next,
        .stop = bpq_seq_stop,
@@ -477,16 +469,17 @@ static const struct file_operations bpq_info_fops = {
 
 /* ------------------------------------------------------------------------ */
 
+static const struct net_device_ops bpq_netdev_ops = {
+       .ndo_open            = bpq_open,
+       .ndo_stop            = bpq_close,
+       .ndo_start_xmit      = bpq_xmit,
+       .ndo_set_mac_address = bpq_set_mac_address,
+       .ndo_do_ioctl        = bpq_ioctl,
+};
 
 static void bpq_setup(struct net_device *dev)
 {
-
-       dev->hard_start_xmit = bpq_xmit;
-       dev->open            = bpq_open;
-       dev->stop            = bpq_close;
-       dev->set_mac_address = bpq_set_mac_address;
-       dev->get_stats       = bpq_get_stats;
-       dev->do_ioctl        = bpq_ioctl;
+       dev->netdev_ops      = &bpq_netdev_ops;
        dev->destructor      = free_netdev;
 
        memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
index e67103396ed7649b32a331e7f4d9fc341f6dc206..881bf818bb48aac8a71672b4cd2677b2588613a4 100644 (file)
@@ -195,7 +195,7 @@ struct scc_priv {
        int chip;
        struct net_device *dev;
        struct scc_info *info;
-       struct net_device_stats stats;
+
        int channel;
        int card_base, scc_cmd, scc_data;
        int tmr_cnt, tmr_ctrl, tmr_mode;
@@ -239,7 +239,6 @@ static int scc_open(struct net_device *dev);
 static int scc_close(struct net_device *dev);
 static int scc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
 static int scc_send_packet(struct sk_buff *skb, struct net_device *dev);
-static struct net_device_stats *scc_get_stats(struct net_device *dev);
 static int scc_set_mac_address(struct net_device *dev, void *sa);
 
 static inline void tx_on(struct scc_priv *priv);
@@ -441,6 +440,13 @@ static void __init dev_setup(struct net_device *dev)
        memcpy(dev->dev_addr, &ax25_defaddr, AX25_ADDR_LEN);
 }
 
+static const struct net_device_ops scc_netdev_ops = {
+       .ndo_open = scc_open,
+       .ndo_stop = scc_close,
+       .ndo_start_xmit = scc_send_packet,
+       .ndo_do_ioctl = scc_ioctl,
+};
+
 static int __init setup_adapter(int card_base, int type, int n)
 {
        int i, irq, chip;
@@ -576,11 +582,7 @@ static int __init setup_adapter(int card_base, int type, int n)
                sprintf(dev->name, "dmascc%i", 2 * n + i);
                dev->base_addr = card_base;
                dev->irq = irq;
-               dev->open = scc_open;
-               dev->stop = scc_close;
-               dev->do_ioctl = scc_ioctl;
-               dev->hard_start_xmit = scc_send_packet;
-               dev->get_stats = scc_get_stats;
+               dev->netdev_ops = &scc_netdev_ops;
                dev->header_ops = &ax25_header_ops;
                dev->set_mac_address = scc_set_mac_address;
        }
@@ -961,14 +963,6 @@ static int scc_send_packet(struct sk_buff *skb, struct net_device *dev)
 }
 
 
-static struct net_device_stats *scc_get_stats(struct net_device *dev)
-{
-       struct scc_priv *priv = dev->ml_priv;
-
-       return &priv->stats;
-}
-
-
 static int scc_set_mac_address(struct net_device *dev, void *sa)
 {
        memcpy(dev->dev_addr, ((struct sockaddr *) sa)->sa_data,
@@ -1216,17 +1210,17 @@ static void special_condition(struct scc_priv *priv, int rc)
                }
                if (priv->rx_over) {
                        /* We had an overrun */
-                       priv->stats.rx_errors++;
+                       priv->dev->stats.rx_errors++;
                        if (priv->rx_over == 2)
-                               priv->stats.rx_length_errors++;
+                               priv->dev->stats.rx_length_errors++;
                        else
-                               priv->stats.rx_fifo_errors++;
+                               priv->dev->stats.rx_fifo_errors++;
                        priv->rx_over = 0;
                } else if (rc & CRC_ERR) {
                        /* Count invalid CRC only if packet length >= minimum */
                        if (cb >= 15) {
-                               priv->stats.rx_errors++;
-                               priv->stats.rx_crc_errors++;
+                               priv->dev->stats.rx_errors++;
+                               priv->dev->stats.rx_crc_errors++;
                        }
                } else {
                        if (cb >= 15) {
@@ -1239,8 +1233,8 @@ static void special_condition(struct scc_priv *priv, int rc)
                                        priv->rx_count++;
                                        schedule_work(&priv->rx_work);
                                } else {
-                                       priv->stats.rx_errors++;
-                                       priv->stats.rx_over_errors++;
+                                       priv->dev->stats.rx_errors++;
+                                       priv->dev->stats.rx_over_errors++;
                                }
                        }
                }
@@ -1275,7 +1269,7 @@ static void rx_bh(struct work_struct *ugli_api)
                skb = dev_alloc_skb(cb + 1);
                if (skb == NULL) {
                        /* Drop packet */
-                       priv->stats.rx_dropped++;
+                       priv->dev->stats.rx_dropped++;
                } else {
                        /* Fill buffer */
                        data = skb_put(skb, cb + 1);
@@ -1283,8 +1277,8 @@ static void rx_bh(struct work_struct *ugli_api)
                        memcpy(&data[1], priv->rx_buf[i], cb);
                        skb->protocol = ax25_type_trans(skb, priv->dev);
                        netif_rx(skb);
-                       priv->stats.rx_packets++;
-                       priv->stats.rx_bytes += cb;
+                       priv->dev->stats.rx_packets++;
+                       priv->dev->stats.rx_bytes += cb;
                }
                spin_lock_irqsave(&priv->ring_lock, flags);
                /* Move tail */
@@ -1351,15 +1345,15 @@ static void es_isr(struct scc_priv *priv)
                        write_scc(priv, R1, EXT_INT_ENAB | WT_FN_RDYFN);
                if (res) {
                        /* Update packet statistics */
-                       priv->stats.tx_errors++;
-                       priv->stats.tx_fifo_errors++;
+                       priv->dev->stats.tx_errors++;
+                       priv->dev->stats.tx_fifo_errors++;
                        /* Other underrun interrupts may already be waiting */
                        write_scc(priv, R0, RES_EXT_INT);
                        write_scc(priv, R0, RES_EXT_INT);
                } else {
                        /* Update packet statistics */
-                       priv->stats.tx_packets++;
-                       priv->stats.tx_bytes += priv->tx_len[i];
+                       priv->dev->stats.tx_packets++;
+                       priv->dev->stats.tx_bytes += priv->tx_len[i];
                        /* Remove frame from FIFO */
                        priv->tx_tail = (i + 1) % NUM_TX_BUF;
                        priv->tx_count--;
@@ -1425,7 +1419,7 @@ static void tm_isr(struct scc_priv *priv)
                write_scc(priv, R15, DCDIE);
                priv->rr0 = read_scc(priv, R0);
                if (priv->rr0 & DCD) {
-                       priv->stats.collisions++;
+                       priv->dev->stats.collisions++;
                        rx_on(priv);
                        priv->state = RX_ON;
                } else {
index 8eba61a1d4abc3ff7365b08d33f4d70c2d368819..61de56e45eedb509bc33bca2ed120b4868ab5c7f 100644 (file)
@@ -154,7 +154,7 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s)
        pkt_len = s->hdlcrx.len - 2 + 1; /* KISS kludge */
        if (!(skb = dev_alloc_skb(pkt_len))) {
                printk("%s: memory squeeze, dropping packet\n", dev->name);
-               s->stats.rx_dropped++;
+               dev->stats.rx_dropped++;
                return;
        }
        cp = skb_put(skb, pkt_len);
@@ -162,7 +162,7 @@ static void hdlc_rx_flag(struct net_device *dev, struct hdlcdrv_state *s)
        memcpy(cp, s->hdlcrx.buffer, pkt_len - 1);
        skb->protocol = ax25_type_trans(skb, dev);
        netif_rx(skb);
-       s->stats.rx_packets++;
+       dev->stats.rx_packets++;
 }
 
 void hdlcdrv_receiver(struct net_device *dev, struct hdlcdrv_state *s)
@@ -326,7 +326,7 @@ void hdlcdrv_transmitter(struct net_device *dev, struct hdlcdrv_state *s)
                        s->hdlctx.len = pkt_len+2; /* the appended CRC */
                        s->hdlctx.tx_state = 2;
                        s->hdlctx.bitstream = 0;
-                       s->stats.tx_packets++;
+                       dev->stats.tx_packets++;
                        break;
                case 2:
                        if (!s->hdlctx.len) {
@@ -426,19 +426,6 @@ static int hdlcdrv_set_mac_address(struct net_device *dev, void *addr)
        return 0;                                         
 }
 
-/* --------------------------------------------------------------------- */
-
-static struct net_device_stats *hdlcdrv_get_stats(struct net_device *dev)
-{
-       struct hdlcdrv_state *sm = netdev_priv(dev);
-
-       /* 
-        * Get the current statistics.  This may be called with the
-        * card open or closed. 
-        */
-       return &sm->stats;
-}
-
 /* --------------------------------------------------------------------- */
 /*
  * Open/initialize the board. This is called (in the current kernel)
@@ -568,10 +555,10 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                bi.data.cs.ptt = hdlcdrv_ptt(s);
                bi.data.cs.dcd = s->hdlcrx.dcd;
                bi.data.cs.ptt_keyed = s->ptt_keyed;
-               bi.data.cs.tx_packets = s->stats.tx_packets;
-               bi.data.cs.tx_errors = s->stats.tx_errors;
-               bi.data.cs.rx_packets = s->stats.rx_packets;
-               bi.data.cs.rx_errors = s->stats.rx_errors;
+               bi.data.cs.tx_packets = dev->stats.tx_packets;
+               bi.data.cs.tx_errors = dev->stats.tx_errors;
+               bi.data.cs.rx_packets = dev->stats.rx_packets;
+               bi.data.cs.rx_errors = dev->stats.rx_errors;
                break;          
 
        case HDLCDRVCTL_OLDGETSTAT:
@@ -630,6 +617,14 @@ static int hdlcdrv_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
 /* --------------------------------------------------------------------- */
 
+static const struct net_device_ops hdlcdrv_netdev = {
+       .ndo_open       = hdlcdrv_open,
+       .ndo_stop       = hdlcdrv_close,
+       .ndo_start_xmit = hdlcdrv_send_packet,
+       .ndo_do_ioctl   = hdlcdrv_ioctl,
+       .ndo_set_mac_address = hdlcdrv_set_mac_address,
+};
+
 /*
  * Initialize fields in hdlcdrv
  */
@@ -669,21 +664,13 @@ static void hdlcdrv_setup(struct net_device *dev)
        s->bitbuf_hdlc.shreg = 0x80;
 #endif /* HDLCDRV_DEBUG */
 
-       /*
-        * initialize the device struct
-        */
-       dev->open = hdlcdrv_open;
-       dev->stop = hdlcdrv_close;
-       dev->do_ioctl = hdlcdrv_ioctl;
-       dev->hard_start_xmit = hdlcdrv_send_packet;
-       dev->get_stats = hdlcdrv_get_stats;
 
        /* Fill in the fields of the device structure */
 
        s->skb = NULL;
        
+       dev->netdev_ops = &hdlcdrv_netdev;
        dev->header_ops = &ax25_header_ops;
-       dev->set_mac_address = hdlcdrv_set_mac_address;
        
        dev->type = ARPHRD_AX25;           /* AF_AX25 device */
        dev->hard_header_len = AX25_MAX_HEADER_LEN + AX25_BPQ_HEADER_LEN;
index bbdb311b8420c6cd500a60d8293132d7e67b3059..032c0db4c410b0d516f04f951ba1ed4d48fa5f35 100644 (file)
@@ -59,8 +59,6 @@ struct mkiss {
        unsigned char           *xhead; /* pointer to next byte to XMIT */
        int                     xleft;  /* bytes left in XMIT queue     */
 
-       struct net_device_stats stats;
-
        /* Detailed SLIP statistics. */
        int             mtu;            /* Our mtu (to spot changes!)   */
        int             buffsize;       /* Max buffers sizes            */
@@ -253,7 +251,7 @@ static void ax_bump(struct mkiss *ax)
        if (ax->rbuff[0] > 0x0f) {
                if (ax->rbuff[0] & 0x80) {
                        if (check_crc_16(ax->rbuff, ax->rcount) < 0) {
-                               ax->stats.rx_errors++;
+                               ax->dev->stats.rx_errors++;
                                spin_unlock_bh(&ax->buflock);
 
                                return;
@@ -268,7 +266,7 @@ static void ax_bump(struct mkiss *ax)
                        *ax->rbuff &= ~0x80;
                } else if (ax->rbuff[0] & 0x20)  {
                        if (check_crc_flex(ax->rbuff, ax->rcount) < 0) {
-                               ax->stats.rx_errors++;
+                               ax->dev->stats.rx_errors++;
                                spin_unlock_bh(&ax->buflock);
                                return;
                        }
@@ -295,7 +293,7 @@ static void ax_bump(struct mkiss *ax)
        if ((skb = dev_alloc_skb(count)) == NULL) {
                printk(KERN_ERR "mkiss: %s: memory squeeze, dropping packet.\n",
                       ax->dev->name);
-               ax->stats.rx_dropped++;
+               ax->dev->stats.rx_dropped++;
                spin_unlock_bh(&ax->buflock);
                return;
        }
@@ -303,8 +301,8 @@ static void ax_bump(struct mkiss *ax)
        memcpy(skb_put(skb,count), ax->rbuff, count);
        skb->protocol = ax25_type_trans(skb, ax->dev);
        netif_rx(skb);
-       ax->stats.rx_packets++;
-       ax->stats.rx_bytes += count;
+       ax->dev->stats.rx_packets++;
+       ax->dev->stats.rx_bytes += count;
        spin_unlock_bh(&ax->buflock);
 }
 
@@ -344,7 +342,7 @@ static void kiss_unesc(struct mkiss *ax, unsigned char s)
                        return;
                }
 
-               ax->stats.rx_over_errors++;
+               ax->dev->stats.rx_over_errors++;
                set_bit(AXF_ERROR, &ax->flags);
        }
        spin_unlock_bh(&ax->buflock);
@@ -406,7 +404,7 @@ static void ax_changedmtu(struct mkiss *ax)
                        memcpy(ax->xbuff, ax->xhead, ax->xleft);
                } else  {
                        ax->xleft = 0;
-                       ax->stats.tx_dropped++;
+                       dev->stats.tx_dropped++;
                }
        }
 
@@ -417,7 +415,7 @@ static void ax_changedmtu(struct mkiss *ax)
                        memcpy(ax->rbuff, orbuff, ax->rcount);
                } else  {
                        ax->rcount = 0;
-                       ax->stats.rx_over_errors++;
+                       dev->stats.rx_over_errors++;
                        set_bit(AXF_ERROR, &ax->flags);
                }
        }
@@ -444,7 +442,7 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
        if (len > ax->mtu) {            /* Sigh, shouldn't occur BUT ... */
                len = ax->mtu;
                printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name);
-               ax->stats.tx_dropped++;
+               dev->stats.tx_dropped++;
                netif_start_queue(dev);
                return;
        }
@@ -518,8 +516,8 @@ static void ax_encaps(struct net_device *dev, unsigned char *icp, int len)
 
        set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags);
        actual = ax->tty->ops->write(ax->tty, ax->xbuff, count);
-       ax->stats.tx_packets++;
-       ax->stats.tx_bytes += actual;
+       dev->stats.tx_packets++;
+       dev->stats.tx_bytes += actual;
 
        ax->dev->trans_start = jiffies;
        ax->xleft = count - actual;
@@ -664,32 +662,28 @@ static int ax_close(struct net_device *dev)
        return 0;
 }
 
-static struct net_device_stats *ax_get_stats(struct net_device *dev)
-{
-       struct mkiss *ax = netdev_priv(dev);
-
-       return &ax->stats;
-}
-
 static const struct header_ops ax_header_ops = {
        .create    = ax_header,
        .rebuild   = ax_rebuild_header,
 };
 
+static const struct net_device_ops ax_netdev_ops = {
+       .ndo_open            = ax_open_dev,
+       .ndo_stop            = ax_close,
+       .ndo_start_xmit      = ax_xmit,
+       .ndo_set_mac_address = ax_set_mac_address,
+};
+
 static void ax_setup(struct net_device *dev)
 {
        /* Finish setting up the DEVICE info. */
        dev->mtu             = AX_MTU;
-       dev->hard_start_xmit = ax_xmit;
-       dev->open            = ax_open_dev;
-       dev->stop            = ax_close;
-       dev->get_stats       = ax_get_stats;
-       dev->set_mac_address = ax_set_mac_address;
        dev->hard_header_len = 0;
        dev->addr_len        = 0;
        dev->type            = ARPHRD_AX25;
        dev->tx_queue_len    = 10;
        dev->header_ops      = &ax_header_ops;
+       dev->netdev_ops      = &ax_netdev_ops;
 
 
        memcpy(dev->broadcast, &ax25_bcast, AX25_ADDR_LEN);
@@ -929,7 +923,7 @@ static void mkiss_receive_buf(struct tty_struct *tty, const unsigned char *cp,
        while (count--) {
                if (fp != NULL && *fp++) {
                        if (!test_and_set_bit(AXF_ERROR, &ax->flags))
-                               ax->stats.rx_errors++;
+                               ax->dev->stats.rx_errors++;
                        cp++;
                        continue;
                }
@@ -982,9 +976,9 @@ static struct tty_ldisc_ops ax_ldisc = {
        .write_wakeup   = mkiss_write_wakeup
 };
 
-static char banner[] __initdata = KERN_INFO \
+static const char banner[] __initdata = KERN_INFO \
        "mkiss: AX.25 Multikiss, Hans Albas PE1AYX\n";
-static char msg_regfail[] __initdata = KERN_ERR \
+static const char msg_regfail[] __initdata = KERN_ERR \
        "mkiss: can't register line discipline (err = %d)\n";
 
 static int __init mkiss_init_driver(void)
@@ -993,8 +987,9 @@ static int __init mkiss_init_driver(void)
 
        printk(banner);
 
-       if ((status = tty_register_ldisc(N_AX25, &ax_ldisc)) != 0)
-               printk(msg_regfail);
+       status = tty_register_ldisc(N_AX25, &ax_ldisc);
+       if (status != 0)
+               printk(msg_regfail, status);
 
        return status;
 }
index c011af7088ea41cfb06325c02b6847addafed2bd..d712e7af780c8151755eb174b5272da0c4f545de 100644 (file)
 
 #include "z8530.h"
 
-static char banner[] __initdata = KERN_INFO "AX.25: Z8530 SCC driver version "VERSION".dl1bke\n";
+static const char banner[] __initdata = KERN_INFO \
+       "AX.25: Z8530 SCC driver version "VERSION".dl1bke\n";
 
 static void t_dwait(unsigned long);
 static void t_txdelay(unsigned long);
@@ -1542,23 +1543,24 @@ static int scc_net_alloc(const char *name, struct scc_channel *scc)
 /* *                       Network driver methods                    * */
 /* ******************************************************************** */
 
+static const struct net_device_ops scc_netdev_ops = {
+       .ndo_open            = scc_net_open,
+       .ndo_stop            = scc_net_close,
+       .ndo_start_xmit      = scc_net_tx,
+       .ndo_set_mac_address = scc_net_set_mac_address,
+       .ndo_get_stats       = scc_net_get_stats,
+       .ndo_do_ioctl        = scc_net_ioctl,
+};
+
 /* ----> Initialize device <----- */
 
 static void scc_net_setup(struct net_device *dev)
 {
        dev->tx_queue_len    = 16;      /* should be enough... */
 
-       dev->open            = scc_net_open;
-       dev->stop            = scc_net_close;
-
-       dev->hard_start_xmit = scc_net_tx;
+       dev->netdev_ops      = &scc_netdev_ops;
        dev->header_ops      = &ax25_header_ops;
 
-       dev->set_mac_address = scc_net_set_mac_address;
-       dev->get_stats       = scc_net_get_stats;
-       dev->do_ioctl        = scc_net_ioctl;
-       dev->tx_timeout      = NULL;
-
        memcpy(dev->broadcast, &ax25_bcast,  AX25_ADDR_LEN);
        memcpy(dev->dev_addr,  &ax25_defaddr, AX25_ADDR_LEN);
  
@@ -2073,7 +2075,7 @@ static int scc_net_seq_show(struct seq_file *seq, void *v)
         return 0;
 }
 
-static struct seq_operations scc_net_seq_ops = {
+static const struct seq_operations scc_net_seq_ops = {
        .start  = scc_net_seq_start,
        .next   = scc_net_seq_next,
        .stop   = scc_net_seq_stop,
index 5407f7486c9c00cdc310962e237284897eac9113..500a40b2afe785087c9f5ab2f93aeeb2863c0a40 100644 (file)
@@ -77,7 +77,8 @@
 /* --------------------------------------------------------------------- */
 
 static const char yam_drvname[] = "yam";
-static char yam_drvinfo[] __initdata = KERN_INFO "YAM driver version 0.8 by F1OAT/F6FBB\n";
+static const char yam_drvinfo[] __initdata = KERN_INFO \
+       "YAM driver version 0.8 by F1OAT/F6FBB\n";
 
 /* --------------------------------------------------------------------- */
 
@@ -115,10 +116,6 @@ struct yam_port {
 
        struct net_device *dev;
 
-       /* Stats section */
-
-       struct net_device_stats stats;
-
        int nb_rxint;
        int nb_mdint;
 
@@ -507,7 +504,7 @@ static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp)
                } else {
                        if (!(skb = dev_alloc_skb(pkt_len))) {
                                printk(KERN_WARNING "%s: memory squeeze, dropping packet\n", dev->name);
-                               ++yp->stats.rx_dropped;
+                               ++dev->stats.rx_dropped;
                        } else {
                                unsigned char *cp;
                                cp = skb_put(skb, pkt_len);
@@ -515,7 +512,7 @@ static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp)
                                memcpy(cp, yp->rx_buf, pkt_len - 1);
                                skb->protocol = ax25_type_trans(skb, dev);
                                netif_rx(skb);
-                               ++yp->stats.rx_packets;
+                               ++dev->stats.rx_packets;
                        }
                }
        }
@@ -677,7 +674,7 @@ static void yam_tx_byte(struct net_device *dev, struct yam_port *yp)
                        yp->tx_count = 1;
                        yp->tx_state = TX_HEAD;
                }
-               ++yp->stats.tx_packets;
+               ++dev->stats.tx_packets;
                break;
        case TX_TAIL:
                if (--yp->tx_count <= 0) {
@@ -716,7 +713,7 @@ static irqreturn_t yam_interrupt(int irq, void *dev_id)
                        handled = 1;
 
                        if (lsr & LSR_OE)
-                               ++yp->stats.rx_fifo_errors;
+                               ++dev->stats.rx_fifo_errors;
 
                        yp->dcd = (msr & RX_DCD) ? 1 : 0;
 
@@ -778,16 +775,16 @@ static int yam_seq_show(struct seq_file *seq, void *v)
        seq_printf(seq, "  TxTail   %u\n", yp->txtail);
        seq_printf(seq, "  SlotTime %u\n", yp->slot);
        seq_printf(seq, "  Persist  %u\n", yp->pers);
-       seq_printf(seq, "  TxFrames %lu\n", yp->stats.tx_packets);
-       seq_printf(seq, "  RxFrames %lu\n", yp->stats.rx_packets);
+       seq_printf(seq, "  TxFrames %lu\n", dev->stats.tx_packets);
+       seq_printf(seq, "  RxFrames %lu\n", dev->stats.rx_packets);
        seq_printf(seq, "  TxInt    %u\n", yp->nb_mdint);
        seq_printf(seq, "  RxInt    %u\n", yp->nb_rxint);
-       seq_printf(seq, "  RxOver   %lu\n", yp->stats.rx_fifo_errors);
+       seq_printf(seq, "  RxOver   %lu\n", dev->stats.rx_fifo_errors);
        seq_printf(seq, "\n");
        return 0;
 }
 
-static struct seq_operations yam_seqops = {
+static const struct seq_operations yam_seqops = {
        .start = yam_seq_start,
        .next = yam_seq_next,
        .stop = yam_seq_stop,
@@ -810,26 +807,6 @@ static const struct file_operations yam_info_fops = {
 #endif
 
 
-/* --------------------------------------------------------------------- */
-
-static struct net_device_stats *yam_get_stats(struct net_device *dev)
-{
-       struct yam_port *yp;
-
-       if (!dev)
-               return NULL;
-
-       yp = netdev_priv(dev);
-       if (yp->magic != YAM_MAGIC)
-               return NULL;
-
-       /* 
-        * Get the current statistics.  This may be called with the
-        * card open or closed. 
-        */
-       return &yp->stats;
-}
-
 /* --------------------------------------------------------------------- */
 
 static int yam_open(struct net_device *dev)
@@ -877,10 +854,10 @@ static int yam_open(struct net_device *dev)
 
        /* Reset overruns for all ports - FPGA programming makes overruns */
        for (i = 0; i < NR_PORTS; i++) {
-               struct net_device *dev = yam_devs[i];
-               struct yam_port *yp = netdev_priv(dev);
-               inb(LSR(dev->base_addr));
-               yp->stats.rx_fifo_errors = 0;
+               struct net_device *yam_dev = yam_devs[i];
+
+               inb(LSR(yam_dev->base_addr));
+               yam_dev->stats.rx_fifo_errors = 0;
        }
 
        printk(KERN_INFO "%s at iobase 0x%lx irq %u uart %s\n", dev->name, dev->base_addr, dev->irq,
@@ -1068,6 +1045,14 @@ static int yam_set_mac_address(struct net_device *dev, void *addr)
 
 /* --------------------------------------------------------------------- */
 
+static const struct net_device_ops yam_netdev_ops = {
+       .ndo_open            = yam_open,
+       .ndo_stop            = yam_close,
+       .ndo_start_xmit      = yam_send_packet,
+       .ndo_do_ioctl        = yam_ioctl,
+       .ndo_set_mac_address = yam_set_mac_address,
+};
+
 static void yam_setup(struct net_device *dev)
 {
        struct yam_port *yp = netdev_priv(dev);
@@ -1088,18 +1073,11 @@ static void yam_setup(struct net_device *dev)
        dev->base_addr = yp->iobase;
        dev->irq = yp->irq;
 
-       dev->open = yam_open;
-       dev->stop = yam_close;
-       dev->do_ioctl = yam_ioctl;
-       dev->hard_start_xmit = yam_send_packet;
-       dev->get_stats = yam_get_stats;
-
        skb_queue_head_init(&yp->send_queue);
 
+       dev->netdev_ops = &yam_netdev_ops;
        dev->header_ops = &ax25_header_ops;
 
-       dev->set_mac_address = yam_set_mac_address;
-
        dev->type = ARPHRD_AX25;
        dev->hard_header_len = AX25_MAX_HEADER_LEN;
        dev->mtu = AX25_MTU;
index dfa6348ac1dcbdad7e556de869149b6a81f154a6..5c6315df86b98ae29c7e8306fd3a803dc45f2ca4 100644 (file)
@@ -1028,10 +1028,10 @@ static int ibmveth_poll(struct napi_struct *napi, int budget)
 
                ibmveth_assert(lpar_rc == H_SUCCESS);
 
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
                if (ibmveth_rxq_pending_buffer(adapter) &&
-                   netif_rx_reschedule(napi)) {
+                   napi_reschedule(napi)) {
                        lpar_rc = h_vio_signal(adapter->vdev->unit_address,
                                               VIO_IRQ_DISABLE);
                        goto restart_poll;
@@ -1047,11 +1047,11 @@ static irqreturn_t ibmveth_interrupt(int irq, void *dev_instance)
        struct ibmveth_adapter *adapter = netdev_priv(netdev);
        unsigned long lpar_rc;
 
-       if (netif_rx_schedule_prep(&adapter->napi)) {
+       if (napi_schedule_prep(&adapter->napi)) {
                lpar_rc = h_vio_signal(adapter->vdev->unit_address,
                                       VIO_IRQ_DISABLE);
                ibmveth_assert(lpar_rc == H_SUCCESS);
-               __netif_rx_schedule(&adapter->napi);
+               __napi_schedule(&adapter->napi);
        }
        return IRQ_HANDLED;
 }
index 1927b3fd6f051af7ed37071d5c33c510e5ccaa9e..8372cb9a8c1acb4d8a76c63d2f7c4be4f06fd994 100644 (file)
@@ -1,7 +1,7 @@
 ################################################################################
 #
 # Intel 82575 PCI-Express Ethernet Linux driver
-# Copyright(c) 1999 - 2007 Intel Corporation.
+# Copyright(c) 1999 - 2009 Intel Corporation.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms and conditions of the GNU General Public License,
@@ -33,5 +33,5 @@
 obj-$(CONFIG_IGB) += igb.o
 
 igb-objs := igb_main.o igb_ethtool.o e1000_82575.o \
-           e1000_mac.o e1000_nvm.o e1000_phy.o
+           e1000_mac.o e1000_nvm.o e1000_phy.o e1000_mbx.o
 
index 13ca73f96ec6e397971ab9b7dbb42924430e8408..ea63a215c9099013ff71f18078d596a32175b49c 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 - 2008 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -62,17 +62,12 @@ static bool igb_sgmii_active_82575(struct e1000_hw *);
 static s32  igb_reset_init_script_82575(struct e1000_hw *);
 static s32  igb_read_mac_addr_82575(struct e1000_hw *);
 
-
-struct e1000_dev_spec_82575 {
-       bool sgmii_active;
-};
-
 static s32 igb_get_invariants_82575(struct e1000_hw *hw)
 {
        struct e1000_phy_info *phy = &hw->phy;
        struct e1000_nvm_info *nvm = &hw->nvm;
        struct e1000_mac_info *mac = &hw->mac;
-       struct e1000_dev_spec_82575 *dev_spec;
+       struct e1000_dev_spec_82575 * dev_spec = &hw->dev_spec._82575;
        u32 eecd;
        s32 ret_val;
        u16 size;
@@ -94,17 +89,6 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
                break;
        }
 
-       /* MAC initialization */
-       hw->dev_spec_size = sizeof(struct e1000_dev_spec_82575);
-
-       /* Device-specific structure allocation */
-       hw->dev_spec = kzalloc(hw->dev_spec_size, GFP_KERNEL);
-
-       if (!hw->dev_spec)
-               return -ENOMEM;
-
-       dev_spec = (struct e1000_dev_spec_82575 *)hw->dev_spec;
-
        /* Set media type */
        /*
         * The 82575 uses bits 22:23 for link mode. The mode can be changed
@@ -195,13 +179,13 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
 
        /* PHY function pointers */
        if (igb_sgmii_active_82575(hw)) {
-               phy->ops.reset_phy          = igb_phy_hw_reset_sgmii_82575;
-               phy->ops.read_phy_reg       = igb_read_phy_reg_sgmii_82575;
-               phy->ops.write_phy_reg      = igb_write_phy_reg_sgmii_82575;
+               phy->ops.reset              = igb_phy_hw_reset_sgmii_82575;
+               phy->ops.read_reg           = igb_read_phy_reg_sgmii_82575;
+               phy->ops.write_reg          = igb_write_phy_reg_sgmii_82575;
        } else {
-               phy->ops.reset_phy          = igb_phy_hw_reset;
-               phy->ops.read_phy_reg       = igb_read_phy_reg_igp;
-               phy->ops.write_phy_reg      = igb_write_phy_reg_igp;
+               phy->ops.reset              = igb_phy_hw_reset;
+               phy->ops.read_reg           = igb_read_phy_reg_igp;
+               phy->ops.write_reg          = igb_write_phy_reg_igp;
        }
 
        /* Set phy->phy_addr and phy->id. */
@@ -229,6 +213,10 @@ static s32 igb_get_invariants_82575(struct e1000_hw *hw)
                return -E1000_ERR_PHY;
        }
 
+       /* if 82576 then initialize mailbox parameters */
+       if (mac->type == e1000_82576)
+               igb_init_mbx_params_pf(hw);
+
        return 0;
 }
 
@@ -451,7 +439,7 @@ static s32 igb_phy_hw_reset_sgmii_82575(struct e1000_hw *hw)
         * SFP documentation requires the following to configure the SPF module
         * to work on SGMII.  No further documentation is given.
         */
-       ret_val = hw->phy.ops.write_phy_reg(hw, 0x1B, 0x8084);
+       ret_val = hw->phy.ops.write_reg(hw, 0x1B, 0x8084);
        if (ret_val)
                goto out;
 
@@ -480,28 +468,28 @@ static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active)
        s32 ret_val;
        u16 data;
 
-       ret_val = phy->ops.read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data);
+       ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data);
        if (ret_val)
                goto out;
 
        if (active) {
                data |= IGP02E1000_PM_D0_LPLU;
-               ret_val = phy->ops.write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
+               ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
                                                 data);
                if (ret_val)
                        goto out;
 
                /* When LPLU is enabled, we should disable SmartSpeed */
-               ret_val = phy->ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+               ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
                                                &data);
                data &= ~IGP01E1000_PSCFR_SMART_SPEED;
-               ret_val = phy->ops.write_phy_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
+               ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
                                                 data);
                if (ret_val)
                        goto out;
        } else {
                data &= ~IGP02E1000_PM_D0_LPLU;
-               ret_val = phy->ops.write_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
+               ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
                                                 data);
                /*
                 * LPLU and SmartSpeed are mutually exclusive.  LPLU is used
@@ -510,24 +498,24 @@ static s32 igb_set_d0_lplu_state_82575(struct e1000_hw *hw, bool active)
                 * SmartSpeed, so performance is maintained.
                 */
                if (phy->smart_speed == e1000_smart_speed_on) {
-                       ret_val = phy->ops.read_phy_reg(hw,
+                       ret_val = phy->ops.read_reg(hw,
                                        IGP01E1000_PHY_PORT_CONFIG, &data);
                        if (ret_val)
                                goto out;
 
                        data |= IGP01E1000_PSCFR_SMART_SPEED;
-                       ret_val = phy->ops.write_phy_reg(hw,
+                       ret_val = phy->ops.write_reg(hw,
                                        IGP01E1000_PHY_PORT_CONFIG, data);
                        if (ret_val)
                                goto out;
                } else if (phy->smart_speed == e1000_smart_speed_off) {
-                       ret_val = phy->ops.read_phy_reg(hw,
+                       ret_val = phy->ops.read_reg(hw,
                                        IGP01E1000_PHY_PORT_CONFIG, &data);
                        if (ret_val)
                                goto out;
 
                        data &= ~IGP01E1000_PSCFR_SMART_SPEED;
-                       ret_val = phy->ops.write_phy_reg(hw,
+                       ret_val = phy->ops.write_reg(hw,
                                        IGP01E1000_PHY_PORT_CONFIG, data);
                        if (ret_val)
                                goto out;
@@ -803,7 +791,7 @@ static void igb_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count)
 }
 
 /**
- *  igb_update_mc_addr_list_82575 - Update Multicast addresses
+ *  igb_update_mc_addr_list - Update Multicast addresses
  *  @hw: pointer to the HW structure
  *  @mc_addr_list: array of multicast addresses to program
  *  @mc_addr_count: number of multicast addresses to program
@@ -815,9 +803,9 @@ static void igb_init_rx_addrs_82575(struct e1000_hw *hw, u16 rar_count)
  *  The parameter rar_count will usually be hw->mac.rar_entry_count
  *  unless there are workarounds that change this.
  **/
-void igb_update_mc_addr_list_82575(struct e1000_hw *hw,
-                                   u8 *mc_addr_list, u32 mc_addr_count,
-                                   u32 rar_used_count, u32 rar_count)
+void igb_update_mc_addr_list(struct e1000_hw *hw,
+                             u8 *mc_addr_list, u32 mc_addr_count,
+                             u32 rar_used_count, u32 rar_count)
 {
        u32 hash_value;
        u32 i;
@@ -1051,7 +1039,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
                 * depending on user settings.
                 */
                hw_dbg("Forcing Speed and Duplex\n");
-               ret_val = igb_phy_force_speed_duplex(hw);
+               ret_val = hw->phy.ops.force_speed_duplex(hw);
                if (ret_val) {
                        hw_dbg("Error Forcing Speed and Duplex\n");
                        goto out;
@@ -1110,6 +1098,13 @@ static s32 igb_setup_fiber_serdes_link_82575(struct e1000_hw *hw)
               E1000_CTRL_SWDPIN1;
        wr32(E1000_CTRL, reg);
 
+       /* Power on phy for 82576 fiber adapters */
+       if (hw->mac.type == e1000_82576) {
+               reg = rd32(E1000_CTRL_EXT);
+               reg &= ~E1000_CTRL_EXT_SDP7_DATA;
+               wr32(E1000_CTRL_EXT, reg);
+       }
+
        /* Set switch control to serdes energy detect */
        reg = rd32(E1000_CONNSW);
        reg |= E1000_CONNSW_ENRGSRC;
@@ -1227,20 +1222,12 @@ out:
  **/
 static bool igb_sgmii_active_82575(struct e1000_hw *hw)
 {
-       struct e1000_dev_spec_82575 *dev_spec;
-       bool ret_val;
-
-       if (hw->mac.type != e1000_82575) {
-               ret_val = false;
-               goto out;
-       }
-
-       dev_spec = (struct e1000_dev_spec_82575 *)hw->dev_spec;
+       struct e1000_dev_spec_82575 *dev_spec = &hw->dev_spec._82575;
 
-       ret_val = dev_spec->sgmii_active;
+       if (hw->mac.type != e1000_82575 && hw->mac.type != e1000_82576)
+               return false;
 
-out:
-       return ret_val;
+       return dev_spec->sgmii_active;
 }
 
 /**
@@ -1430,6 +1417,44 @@ void igb_rx_fifo_flush_82575(struct e1000_hw *hw)
        rd32(E1000_MPC);
 }
 
+/**
+ *  igb_vmdq_set_loopback_pf - enable or disable vmdq loopback
+ *  @hw: pointer to the hardware struct
+ *  @enable: state to enter, either enabled or disabled
+ *
+ *  enables/disables L2 switch loopback functionality.
+ **/
+void igb_vmdq_set_loopback_pf(struct e1000_hw *hw, bool enable)
+{
+       u32 dtxswc = rd32(E1000_DTXSWC);
+
+       if (enable)
+               dtxswc |= E1000_DTXSWC_VMDQ_LOOPBACK_EN;
+       else
+               dtxswc &= ~E1000_DTXSWC_VMDQ_LOOPBACK_EN;
+
+       wr32(E1000_DTXSWC, dtxswc);
+}
+
+/**
+ *  igb_vmdq_set_replication_pf - enable or disable vmdq replication
+ *  @hw: pointer to the hardware struct
+ *  @enable: state to enter, either enabled or disabled
+ *
+ *  enables/disables replication of packets across multiple pools.
+ **/
+void igb_vmdq_set_replication_pf(struct e1000_hw *hw, bool enable)
+{
+       u32 vt_ctl = rd32(E1000_VT_CTL);
+
+       if (enable)
+               vt_ctl |= E1000_VT_CTL_VM_REPL_EN;
+       else
+               vt_ctl &= ~E1000_VT_CTL_VM_REPL_EN;
+
+       wr32(E1000_VT_CTL, vt_ctl);
+}
+
 static struct e1000_mac_operations e1000_mac_ops_82575 = {
        .reset_hw             = igb_reset_hw_82575,
        .init_hw              = igb_init_hw_82575,
@@ -1440,16 +1465,16 @@ static struct e1000_mac_operations e1000_mac_ops_82575 = {
 };
 
 static struct e1000_phy_operations e1000_phy_ops_82575 = {
-       .acquire_phy          = igb_acquire_phy_82575,
+       .acquire              = igb_acquire_phy_82575,
        .get_cfg_done         = igb_get_cfg_done_82575,
-       .release_phy          = igb_release_phy_82575,
+       .release              = igb_release_phy_82575,
 };
 
 static struct e1000_nvm_operations e1000_nvm_ops_82575 = {
-       .acquire_nvm          = igb_acquire_nvm_82575,
-       .read_nvm             = igb_read_nvm_eerd,
-       .release_nvm          = igb_release_nvm_82575,
-       .write_nvm            = igb_write_nvm_spi,
+       .acquire              = igb_acquire_nvm_82575,
+       .read                 = igb_read_nvm_eerd,
+       .release              = igb_release_nvm_82575,
+       .write                = igb_write_nvm_spi,
 };
 
 const struct e1000_info e1000_82575_info = {
index c1928b5efe1f711233994d2396d632645742c904..eaf9770503685126dc4b9b74f3d948aa61443019 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 - 2008 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -28,7 +28,7 @@
 #ifndef _E1000_82575_H_
 #define _E1000_82575_H_
 
-void igb_update_mc_addr_list_82575(struct e1000_hw*, u8*, u32, u32, u32);
+void igb_update_mc_addr_list(struct e1000_hw*, u8*, u32, u32, u32);
 extern void igb_shutdown_fiber_serdes_link_82575(struct e1000_hw *hw);
 extern void igb_rx_fifo_flush_82575(struct e1000_hw *hw);
 
@@ -40,8 +40,11 @@ extern void igb_rx_fifo_flush_82575(struct e1000_hw *hw);
 #define E1000_SRRCTL_BSIZEHDRSIZE_SHIFT                 2  /* Shift _left_ */
 #define E1000_SRRCTL_DESCTYPE_ADV_ONEBUF                0x02000000
 #define E1000_SRRCTL_DESCTYPE_HDR_SPLIT_ALWAYS          0x0A000000
+#define E1000_SRRCTL_DROP_EN                            0x80000000
 
 #define E1000_MRQC_ENABLE_RSS_4Q            0x00000002
+#define E1000_MRQC_ENABLE_VMDQ              0x00000003
+#define E1000_MRQC_ENABLE_VMDQ_RSS_2Q       0x00000005
 #define E1000_MRQC_RSS_FIELD_IPV4_UDP       0x00400000
 #define E1000_MRQC_RSS_FIELD_IPV6_UDP       0x00800000
 #define E1000_MRQC_RSS_FIELD_IPV6_UDP_EX    0x01000000
@@ -58,9 +61,6 @@ extern void igb_rx_fifo_flush_82575(struct e1000_hw *hw);
     E1000_EICR_RX_QUEUE2 |    \
     E1000_EICR_RX_QUEUE3)
 
-#define E1000_EIMS_RX_QUEUE E1000_EICR_RX_QUEUE
-#define E1000_EIMS_TX_QUEUE E1000_EICR_TX_QUEUE
-
 /* Immediate Interrupt Rx (A.K.A. Low Latency Interrupt) */
 
 /* Receive Descriptor - Advanced */
@@ -95,12 +95,6 @@ union e1000_adv_rx_desc {
 #define E1000_RXDADV_HDRBUFLEN_MASK      0x7FE0
 #define E1000_RXDADV_HDRBUFLEN_SHIFT     5
 
-/* RSS Hash results */
-
-/* RSS Packet Types as indicated in the receive descriptor */
-#define E1000_RXDADV_PKTTYPE_IPV4        0x00000010 /* IPV4 hdr present */
-#define E1000_RXDADV_PKTTYPE_TCP         0x00000100 /* TCP hdr present */
-
 /* Transmit Descriptor - Advanced */
 union e1000_adv_tx_desc {
        struct {
@@ -116,6 +110,7 @@ union e1000_adv_tx_desc {
 };
 
 /* Adv Transmit Descriptor Config Masks */
+#define E1000_ADVTXD_MAC_TSTAMP   0x00080000 /* IEEE1588 Timestamp packet */
 #define E1000_ADVTXD_DTYP_CTXT    0x00200000 /* Advanced Context Descriptor */
 #define E1000_ADVTXD_DTYP_DATA    0x00300000 /* Advanced Data Descriptor */
 #define E1000_ADVTXD_DCMD_IFCS    0x02000000 /* Insert FCS (Ethernet CRC) */
@@ -149,11 +144,8 @@ struct e1000_adv_tx_context_desc {
 #define E1000_RXDCTL_QUEUE_ENABLE  0x02000000 /* Enable specific Rx Queue */
 
 /* Direct Cache Access (DCA) definitions */
-#define E1000_DCA_CTRL_DCA_ENABLE  0x00000000 /* DCA Enable */
-#define E1000_DCA_CTRL_DCA_DISABLE 0x00000001 /* DCA Disable */
-
-#define E1000_DCA_CTRL_DCA_MODE_CB1 0x00 /* DCA Mode CB1 */
-#define E1000_DCA_CTRL_DCA_MODE_CB2 0x02 /* DCA Mode CB2 */
+#define E1000_DCA_CTRL_DCA_MODE_DISABLE 0x01 /* DCA Disable */
+#define E1000_DCA_CTRL_DCA_MODE_CB2     0x02 /* DCA Mode CB2 */
 
 #define E1000_DCA_RXCTRL_CPUID_MASK 0x0000001F /* Rx CPUID Mask */
 #define E1000_DCA_RXCTRL_DESC_DCA_EN (1 << 5) /* DCA Rx Desc enable */
@@ -170,4 +162,44 @@ struct e1000_adv_tx_context_desc {
 #define E1000_DCA_TXCTRL_CPUID_SHIFT 24 /* Tx CPUID now in the last byte */
 #define E1000_DCA_RXCTRL_CPUID_SHIFT 24 /* Rx CPUID now in the last byte */
 
+#define MAX_NUM_VFS                   8
+
+#define E1000_DTXSWC_VMDQ_LOOPBACK_EN (1 << 31)  /* global VF LB enable */
+
+/* Easy defines for setting default pool, would normally be left a zero */
+#define E1000_VT_CTL_DEFAULT_POOL_SHIFT 7
+#define E1000_VT_CTL_DEFAULT_POOL_MASK  (0x7 << E1000_VT_CTL_DEFAULT_POOL_SHIFT)
+
+/* Other useful VMD_CTL register defines */
+#define E1000_VT_CTL_IGNORE_MAC         (1 << 28)
+#define E1000_VT_CTL_DISABLE_DEF_POOL   (1 << 29)
+#define E1000_VT_CTL_VM_REPL_EN         (1 << 30)
+
+/* Per VM Offload register setup */
+#define E1000_VMOLR_RLPML_MASK 0x00003FFF /* Long Packet Maximum Length mask */
+#define E1000_VMOLR_LPE        0x00010000 /* Accept Long packet */
+#define E1000_VMOLR_RSSE       0x00020000 /* Enable RSS */
+#define E1000_VMOLR_AUPE       0x01000000 /* Accept untagged packets */
+#define E1000_VMOLR_ROMPE      0x02000000 /* Accept overflow multicast */
+#define E1000_VMOLR_ROPE       0x04000000 /* Accept overflow unicast */
+#define E1000_VMOLR_BAM        0x08000000 /* Accept Broadcast packets */
+#define E1000_VMOLR_MPME       0x10000000 /* Multicast promiscuous mode */
+#define E1000_VMOLR_STRVLAN    0x40000000 /* Vlan stripping enable */
+#define E1000_VMOLR_STRCRC     0x80000000 /* CRC stripping enable */
+
+#define E1000_VLVF_ARRAY_SIZE     32
+#define E1000_VLVF_VLANID_MASK    0x00000FFF
+#define E1000_VLVF_POOLSEL_SHIFT  12
+#define E1000_VLVF_POOLSEL_MASK   (0xFF << E1000_VLVF_POOLSEL_SHIFT)
+#define E1000_VLVF_LVLAN          0x00100000
+#define E1000_VLVF_VLANID_ENABLE  0x80000000
+
+#define E1000_IOVCTL 0x05BBC
+#define E1000_IOVCTL_REUSE_VFQ 0x00000001
+
+#define ALL_QUEUES   0xFFFF
+
+void igb_vmdq_set_loopback_pf(struct e1000_hw *, bool);
+void igb_vmdq_set_replication_pf(struct e1000_hw *, bool);
+
 #endif
index 40d03426c1223f85639e6f03c2d61c6499144636..62e378b64611a5aae775435ea6348eb6c46c2bbb 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 - 2008 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
 #define E1000_WUFC_EX   0x00000004 /* Directed Exact Wakeup Enable */
 #define E1000_WUFC_MC   0x00000008 /* Directed Multicast Wakeup Enable */
 #define E1000_WUFC_BC   0x00000010 /* Broadcast Wakeup Enable */
-#define E1000_WUFC_ARP  0x00000020 /* ARP Request Packet Wakeup Enable */
-#define E1000_WUFC_IPV4 0x00000040 /* Directed IPv4 Packet Wakeup Enable */
-#define E1000_WUFC_IPV6 0x00000080 /* Directed IPv6 Packet Wakeup Enable */
-#define E1000_WUFC_FLX0 0x00010000 /* Flexible Filter 0 Enable */
-#define E1000_WUFC_FLX1 0x00020000 /* Flexible Filter 1 Enable */
-#define E1000_WUFC_FLX2 0x00040000 /* Flexible Filter 2 Enable */
-#define E1000_WUFC_FLX3 0x00080000 /* Flexible Filter 3 Enable */
-#define E1000_WUFC_FLX_FILTERS 0x000F0000 /* Mask for the 4 flexible filters */
-
-/* Wake Up Status */
-
-/* Wake Up Packet Length */
-
-/* Four Flexible Filters are supported */
-#define E1000_FLEXIBLE_FILTER_COUNT_MAX 4
-
-/* Each Flexible Filter is at most 128 (0x80) bytes in length */
-#define E1000_FLEXIBLE_FILTER_SIZE_MAX  128
-
 
 /* Extended Device Control */
-#define E1000_CTRL_EXT_GPI1_EN   0x00000002 /* Maps SDP5 to GPI1 */
-#define E1000_CTRL_EXT_SDP4_DATA 0x00000010 /* Value of SW Defineable Pin 4 */
-#define E1000_CTRL_EXT_SDP5_DATA 0x00000020 /* Value of SW Defineable Pin 5 */
 #define E1000_CTRL_EXT_SDP7_DATA 0x00000080 /* Value of SW Defineable Pin 7 */
-#define E1000_CTRL_EXT_SDP4_DIR  0x00000100 /* Direction of SDP4 0=in 1=out */
-#define E1000_CTRL_EXT_EE_RST    0x00002000 /* Reinitialize from EEPROM */
+/* Physical Func Reset Done Indication */
+#define E1000_CTRL_EXT_PFRSTD    0x00004000
 #define E1000_CTRL_EXT_LINK_MODE_MASK 0x00C00000
 #define E1000_CTRL_EXT_LINK_MODE_PCIE_SERDES  0x00C00000
 #define E1000_CTRL_EXT_LINK_MODE_SGMII   0x00800000
 #define E1000_RXD_STAT_VP       0x08    /* IEEE VLAN Packet */
 #define E1000_RXD_STAT_UDPCS    0x10    /* UDP xsum calculated */
 #define E1000_RXD_STAT_TCPCS    0x20    /* TCP xsum calculated */
-#define E1000_RXD_STAT_DYNINT   0x800   /* Pkt caused INT via DYNINT */
-#define E1000_RXD_ERR_CE        0x01    /* CRC Error */
-#define E1000_RXD_ERR_SE        0x02    /* Symbol Error */
-#define E1000_RXD_ERR_SEQ       0x04    /* Sequence Error */
-#define E1000_RXD_ERR_CXE       0x10    /* Carrier Extension Error */
-#define E1000_RXD_ERR_RXE       0x80    /* Rx Data Error */
-#define E1000_RXD_SPC_VLAN_MASK 0x0FFF  /* VLAN ID is in lower 12 bits */
+#define E1000_RXD_STAT_TS       0x10000 /* Pkt was time stamped */
 
 #define E1000_RXDEXT_STATERR_CE    0x01000000
 #define E1000_RXDEXT_STATERR_SE    0x02000000
 #define E1000_RXDEXT_STATERR_IPE   0x40000000
 #define E1000_RXDEXT_STATERR_RXE   0x80000000
 
-/* mask to determine if packets should be dropped due to frame errors */
-#define E1000_RXD_ERR_FRAME_ERR_MASK ( \
-    E1000_RXD_ERR_CE  |                \
-    E1000_RXD_ERR_SE  |                \
-    E1000_RXD_ERR_SEQ |                \
-    E1000_RXD_ERR_CXE |                \
-    E1000_RXD_ERR_RXE)
-
 /* Same mask, but for extended and packet split descriptors */
 #define E1000_RXDEXT_ERR_FRAME_ERR_MASK ( \
     E1000_RXDEXT_STATERR_CE  |            \
 /* Management Control */
 #define E1000_MANC_SMBUS_EN      0x00000001 /* SMBus Enabled - RO */
 #define E1000_MANC_ASF_EN        0x00000002 /* ASF Enabled - RO */
-#define E1000_MANC_ARP_EN        0x00002000 /* Enable ARP Request Filtering */
 /* Enable Neighbor Discovery Filtering */
 #define E1000_MANC_RCV_TCO_EN    0x00020000 /* Receive TCO Packets Enabled */
 #define E1000_MANC_BLK_PHY_RST_ON_IDE   0x00040000 /* Block phy resets */
 /* Enable MAC address filtering */
 #define E1000_MANC_EN_MAC_ADDR_FILTER   0x00100000
-/* Enable MNG packets to host memory */
-#define E1000_MANC_EN_MNG2HOST   0x00200000
-/* Enable IP address filtering */
-
 
 /* Receive Control */
 #define E1000_RCTL_EN             0x00000002    /* enable */
 #define E1000_RCTL_UPE            0x00000008    /* unicast promiscuous enable */
 #define E1000_RCTL_MPE            0x00000010    /* multicast promiscuous enab */
 #define E1000_RCTL_LPE            0x00000020    /* long packet enable */
-#define E1000_RCTL_LBM_NO         0x00000000    /* no loopback mode */
 #define E1000_RCTL_LBM_MAC        0x00000040    /* MAC loopback mode */
 #define E1000_RCTL_LBM_TCVR       0x000000C0    /* tcvr loopback mode */
 #define E1000_RCTL_RDMTS_HALF     0x00000000    /* rx desc min threshold size */
 #define E1000_RCTL_MO_SHIFT       12            /* multicast offset shift */
 #define E1000_RCTL_BAM            0x00008000    /* broadcast enable */
-#define E1000_RCTL_SZ_2048        0x00000000    /* rx buffer size 2048 */
-#define E1000_RCTL_SZ_1024        0x00010000    /* rx buffer size 1024 */
 #define E1000_RCTL_SZ_512         0x00020000    /* rx buffer size 512 */
 #define E1000_RCTL_SZ_256         0x00030000    /* rx buffer size 256 */
 #define E1000_RCTL_VFE            0x00040000    /* vlan filter enable */
 /* enable link status from external LINK_0 and LINK_1 pins */
 #define E1000_CTRL_SWDPIN0  0x00040000  /* SWDPIN 0 value */
 #define E1000_CTRL_SWDPIN1  0x00080000  /* SWDPIN 1 value */
-#define E1000_CTRL_SWDPIN2  0x00100000  /* SWDPIN 2 value */
-#define E1000_CTRL_SWDPIN3  0x00200000  /* SWDPIN 3 value */
 #define E1000_CTRL_SWDPIO0  0x00400000  /* SWDPIN 0 Input or output */
-#define E1000_CTRL_SWDPIO2  0x01000000  /* SWDPIN 2 input or output */
-#define E1000_CTRL_SWDPIO3  0x02000000  /* SWDPIN 3 input or output */
 #define E1000_CTRL_RST      0x04000000  /* Global reset */
 #define E1000_CTRL_RFCE     0x08000000  /* Receive Flow Control enable */
 #define E1000_CTRL_TFCE     0x10000000  /* Transmit flow control enable */
 #define AUTONEG_ADVERTISE_SPEED_DEFAULT   E1000_ALL_SPEED_DUPLEX
 
 /* LED Control */
-#define E1000_LEDCTL_LED0_MODE_MASK       0x0000000F
 #define E1000_LEDCTL_LED0_MODE_SHIFT      0
-#define E1000_LEDCTL_LED0_IVRT            0x00000040
 #define E1000_LEDCTL_LED0_BLINK           0x00000080
 
 #define E1000_LEDCTL_MODE_LED_ON        0xE
 
 #define MAX_JUMBO_FRAME_SIZE    0x3F00
 
-/* Extended Configuration Control and Size */
-#define E1000_PHY_CTRL_GBE_DISABLE        0x00000040
-
 /* PBA constants */
-#define E1000_PBA_16K 0x0010    /* 16KB, default TX allocation */
-#define E1000_PBA_24K 0x0018
 #define E1000_PBA_34K 0x0022
 #define E1000_PBA_64K 0x0040    /* 64KB */
 
 
 /* Interrupt Cause Read */
 #define E1000_ICR_TXDW          0x00000001 /* Transmit desc written back */
-#define E1000_ICR_TXQE          0x00000002 /* Transmit Queue empty */
 #define E1000_ICR_LSC           0x00000004 /* Link Status Change */
 #define E1000_ICR_RXSEQ         0x00000008 /* rx sequence error */
 #define E1000_ICR_RXDMT0        0x00000010 /* rx desc min. threshold (0) */
-#define E1000_ICR_RXO           0x00000040 /* rx overrun */
 #define E1000_ICR_RXT0          0x00000080 /* rx timer intr (ring 0) */
-#define E1000_ICR_MDAC          0x00000200 /* MDIO access complete */
-#define E1000_ICR_RXCFG         0x00000400 /* Rx /c/ ordered set */
-#define E1000_ICR_GPI_EN0       0x00000800 /* GP Int 0 */
-#define E1000_ICR_GPI_EN1       0x00001000 /* GP Int 1 */
-#define E1000_ICR_GPI_EN2       0x00002000 /* GP Int 2 */
-#define E1000_ICR_GPI_EN3       0x00004000 /* GP Int 3 */
-#define E1000_ICR_TXD_LOW       0x00008000
-#define E1000_ICR_SRPD          0x00010000
-#define E1000_ICR_ACK           0x00020000 /* Receive Ack frame */
-#define E1000_ICR_MNG           0x00040000 /* Manageability event */
-#define E1000_ICR_DOCK          0x00080000 /* Dock/Undock */
+#define E1000_ICR_VMMB          0x00000100 /* VM MB event */
 /* If this bit asserted, the driver should claim the interrupt */
 #define E1000_ICR_INT_ASSERTED  0x80000000
-/* queue 0 Rx descriptor FIFO parity error */
-#define E1000_ICR_RXD_FIFO_PAR0 0x00100000
-/* queue 0 Tx descriptor FIFO parity error */
-#define E1000_ICR_TXD_FIFO_PAR0 0x00200000
-/* host arb read buffer parity error */
-#define E1000_ICR_HOST_ARB_PAR  0x00400000
-#define E1000_ICR_PB_PAR        0x00800000 /* packet buffer parity error */
-/* queue 1 Rx descriptor FIFO parity error */
-#define E1000_ICR_RXD_FIFO_PAR1 0x01000000
-/* queue 1 Tx descriptor FIFO parity error */
-#define E1000_ICR_TXD_FIFO_PAR1 0x02000000
-/* FW changed the status of DISSW bit in the FWSM */
-#define E1000_ICR_DSW           0x00000020
 /* LAN connected device generates an interrupt */
-#define E1000_ICR_PHYINT        0x00001000
-#define E1000_ICR_EPRST         0x00100000 /* ME handware reset occurs */
+#define E1000_ICR_DOUTSYNC      0x10000000 /* NIC DMA out of sync */
 
 /* Extended Interrupt Cause Read */
 #define E1000_EICR_RX_QUEUE0    0x00000001 /* Rx Queue 0 Interrupt */
 #define E1000_EICR_TX_QUEUE1    0x00000200 /* Tx Queue 1 Interrupt */
 #define E1000_EICR_TX_QUEUE2    0x00000400 /* Tx Queue 2 Interrupt */
 #define E1000_EICR_TX_QUEUE3    0x00000800 /* Tx Queue 3 Interrupt */
-#define E1000_EICR_TCP_TIMER    0x40000000 /* TCP Timer */
 #define E1000_EICR_OTHER        0x80000000 /* Interrupt Cause Active */
 /* TCP Timer */
 
     E1000_IMS_TXDW   |    \
     E1000_IMS_RXDMT0 |    \
     E1000_IMS_RXSEQ  |    \
-    E1000_IMS_LSC)
+    E1000_IMS_LSC    |    \
+    E1000_IMS_DOUTSYNC)
 
 /* Interrupt Mask Set */
 #define E1000_IMS_TXDW      E1000_ICR_TXDW      /* Transmit desc written back */
 #define E1000_IMS_LSC       E1000_ICR_LSC       /* Link Status Change */
+#define E1000_IMS_VMMB      E1000_ICR_VMMB      /* Mail box activity */
 #define E1000_IMS_RXSEQ     E1000_ICR_RXSEQ     /* rx sequence error */
 #define E1000_IMS_RXDMT0    E1000_ICR_RXDMT0    /* rx desc min. threshold */
 #define E1000_IMS_RXT0      E1000_ICR_RXT0      /* rx timer intr */
+#define E1000_IMS_DOUTSYNC  E1000_ICR_DOUTSYNC /* NIC DMA out of sync */
 
 /* Extended Interrupt Mask Set */
-#define E1000_EIMS_TCP_TIMER    E1000_EICR_TCP_TIMER /* TCP Timer */
 #define E1000_EIMS_OTHER        E1000_EICR_OTHER   /* Interrupt Cause Active */
 
 /* Interrupt Cause Set */
  * manageability enabled, allowing us room for 15 multicast addresses.
  */
 #define E1000_RAH_AV  0x80000000        /* Receive descriptor valid */
+#define E1000_RAL_MAC_ADDR_LEN 4
+#define E1000_RAH_MAC_ADDR_LEN 2
+#define E1000_RAH_POOL_MASK 0x03FC0000
+#define E1000_RAH_POOL_1 0x00040000
 
 /* Error Codes */
 #define E1000_ERR_NVM      1
 #define E1000_ERR_MAC_INIT 5
 #define E1000_ERR_RESET   9
 #define E1000_ERR_MASTER_REQUESTS_PENDING 10
-#define E1000_ERR_HOST_INTERFACE_COMMAND 11
 #define E1000_BLK_PHY_RESET   12
 #define E1000_ERR_SWFW_SYNC 13
 #define E1000_NOT_IMPLEMENTED 14
+#define E1000_ERR_MBX      15
 
 /* Loop limit on how long we wait for auto-negotiation to complete */
 #define COPPER_LINK_UP_LIMIT              10
 /* Flow Control */
 #define E1000_FCRTL_XONE 0x80000000     /* Enable XON frame transmission */
 
-/* Transmit Configuration Word */
-#define E1000_TXCW_ANE        0x80000000        /* Auto-neg enable */
-
-/* Receive Configuration Word */
-
-/* PCI Express Control */
-#define E1000_GCR_RXD_NO_SNOOP          0x00000001
-#define E1000_GCR_RXDSCW_NO_SNOOP       0x00000002
-#define E1000_GCR_RXDSCR_NO_SNOOP       0x00000004
-#define E1000_GCR_TXD_NO_SNOOP          0x00000008
-#define E1000_GCR_TXDSCW_NO_SNOOP       0x00000010
-#define E1000_GCR_TXDSCR_NO_SNOOP       0x00000020
-
-#define PCIE_NO_SNOOP_ALL (E1000_GCR_RXD_NO_SNOOP         | \
-                          E1000_GCR_RXDSCW_NO_SNOOP      | \
-                          E1000_GCR_RXDSCR_NO_SNOOP      | \
-                          E1000_GCR_TXD_NO_SNOOP         | \
-                          E1000_GCR_TXDSCW_NO_SNOOP      | \
-                          E1000_GCR_TXDSCR_NO_SNOOP)
-
 /* PHY Control Register */
 #define MII_CR_FULL_DUPLEX      0x0100  /* FDX =1, half duplex =0 */
 #define MII_CR_RESTART_AUTO_NEG 0x0200  /* Restart auto negotiation */
-#define MII_CR_POWER_DOWN       0x0800  /* Power down */
 #define MII_CR_AUTO_NEG_EN      0x1000  /* Auto Neg Enable */
 #define MII_CR_LOOPBACK         0x4000  /* 0 = normal, 1 = loopback */
 #define MII_CR_RESET            0x8000  /* 0 = normal, 1 = PHY reset */
 #define IGP_LED3_MODE           0x07000000
 
 /* PCI/PCI-X/PCI-EX Config space */
-#define PCI_HEADER_TYPE_REGISTER     0x0E
 #define PCIE_LINK_STATUS             0x12
 
-#define PCI_HEADER_TYPE_MULTIFUNC    0x80
 #define PCIE_LINK_WIDTH_MASK         0x3F0
 #define PCIE_LINK_WIDTH_SHIFT        4
 
 #define E1000_GEN_CTL_ADDRESS_SHIFT     8
 #define E1000_GEN_POLL_TIMEOUT          640
 
+#define E1000_VFTA_ENTRY_SHIFT               5
+#define E1000_VFTA_ENTRY_MASK                0x7F
+#define E1000_VFTA_ENTRY_BIT_SHIFT_MASK      0x1F
+
 #endif
index 99504a600a80f8348a99bdd2ffc9b367bab08819..d793dca1eef65243a396a2d88ecb7f1069f256f7 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -32,7 +32,6 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 
-#include "e1000_mac.h"
 #include "e1000_regs.h"
 #include "e1000_defines.h"
 
@@ -144,144 +143,6 @@ enum e1000_fc_type {
        e1000_fc_default = 0xFF
 };
 
-
-/* Receive Descriptor */
-struct e1000_rx_desc {
-       __le64 buffer_addr; /* Address of the descriptor's data buffer */
-       __le16 length;      /* Length of data DMAed into data buffer */
-       __le16 csum;        /* Packet checksum */
-       u8  status;      /* Descriptor status */
-       u8  errors;      /* Descriptor Errors */
-       __le16 special;
-};
-
-/* Receive Descriptor - Extended */
-union e1000_rx_desc_extended {
-       struct {
-               __le64 buffer_addr;
-               __le64 reserved;
-       } read;
-       struct {
-               struct {
-                       __le32 mrq;              /* Multiple Rx Queues */
-                       union {
-                               __le32 rss;            /* RSS Hash */
-                               struct {
-                                       __le16 ip_id;  /* IP id */
-                                       __le16 csum;   /* Packet Checksum */
-                               } csum_ip;
-                       } hi_dword;
-               } lower;
-               struct {
-                       __le32 status_error;     /* ext status/error */
-                       __le16 length;
-                       __le16 vlan;             /* VLAN tag */
-               } upper;
-       } wb;  /* writeback */
-};
-
-#define MAX_PS_BUFFERS 4
-/* Receive Descriptor - Packet Split */
-union e1000_rx_desc_packet_split {
-       struct {
-               /* one buffer for protocol header(s), three data buffers */
-               __le64 buffer_addr[MAX_PS_BUFFERS];
-       } read;
-       struct {
-               struct {
-                       __le32 mrq;              /* Multiple Rx Queues */
-                       union {
-                               __le32 rss;              /* RSS Hash */
-                               struct {
-                                       __le16 ip_id;    /* IP id */
-                                       __le16 csum;     /* Packet Checksum */
-                               } csum_ip;
-                       } hi_dword;
-               } lower;
-               struct {
-                       __le32 status_error;     /* ext status/error */
-                       __le16 length0;          /* length of buffer 0 */
-                       __le16 vlan;             /* VLAN tag */
-               } middle;
-               struct {
-                       __le16 header_status;
-                       __le16 length[3];        /* length of buffers 1-3 */
-               } upper;
-               __le64 reserved;
-       } wb; /* writeback */
-};
-
-/* Transmit Descriptor */
-struct e1000_tx_desc {
-       __le64 buffer_addr;      /* Address of the descriptor's data buffer */
-       union {
-               __le32 data;
-               struct {
-                       __le16 length;    /* Data buffer length */
-                       u8 cso;        /* Checksum offset */
-                       u8 cmd;        /* Descriptor control */
-               } flags;
-       } lower;
-       union {
-               __le32 data;
-               struct {
-                       u8 status;     /* Descriptor status */
-                       u8 css;        /* Checksum start */
-                       __le16 special;
-               } fields;
-       } upper;
-};
-
-/* Offload Context Descriptor */
-struct e1000_context_desc {
-       union {
-               __le32 ip_config;
-               struct {
-                       u8 ipcss;      /* IP checksum start */
-                       u8 ipcso;      /* IP checksum offset */
-                       __le16 ipcse;     /* IP checksum end */
-               } ip_fields;
-       } lower_setup;
-       union {
-               __le32 tcp_config;
-               struct {
-                       u8 tucss;      /* TCP checksum start */
-                       u8 tucso;      /* TCP checksum offset */
-                       __le16 tucse;     /* TCP checksum end */
-               } tcp_fields;
-       } upper_setup;
-       __le32 cmd_and_length;
-       union {
-               __le32 data;
-               struct {
-                       u8 status;     /* Descriptor status */
-                       u8 hdr_len;    /* Header length */
-                       __le16 mss;       /* Maximum segment size */
-               } fields;
-       } tcp_seg_setup;
-};
-
-/* Offload data descriptor */
-struct e1000_data_desc {
-       __le64 buffer_addr;   /* Address of the descriptor's buffer address */
-       union {
-               __le32 data;
-               struct {
-                       __le16 length;    /* Data buffer length */
-                       u8 typ_len_ext;
-                       u8 cmd;
-               } flags;
-       } lower;
-       union {
-               __le32 data;
-               struct {
-                       u8 status;     /* Descriptor status */
-                       u8 popts;      /* Packet Options */
-                       __le16 special;
-               } fields;
-       } upper;
-};
-
 /* Statistics counters collected by the MAC */
 struct e1000_hw_stats {
        u64 crcerrs;
@@ -359,6 +220,7 @@ struct e1000_hw_stats {
        u64 lenerrs;
        u64 scvpc;
        u64 hrmpc;
+       u64 doosync;
 };
 
 struct e1000_phy_stats {
@@ -409,6 +271,7 @@ struct e1000_host_mng_command_info {
 #include "e1000_mac.h"
 #include "e1000_phy.h"
 #include "e1000_nvm.h"
+#include "e1000_mbx.h"
 
 struct e1000_mac_operations {
        s32  (*check_for_link)(struct e1000_hw *);
@@ -422,25 +285,25 @@ struct e1000_mac_operations {
 };
 
 struct e1000_phy_operations {
-       s32  (*acquire_phy)(struct e1000_hw *);
+       s32  (*acquire)(struct e1000_hw *);
        s32  (*check_reset_block)(struct e1000_hw *);
        s32  (*force_speed_duplex)(struct e1000_hw *);
        s32  (*get_cfg_done)(struct e1000_hw *hw);
        s32  (*get_cable_length)(struct e1000_hw *);
        s32  (*get_phy_info)(struct e1000_hw *);
-       s32  (*read_phy_reg)(struct e1000_hw *, u32, u16 *);
-       void (*release_phy)(struct e1000_hw *);
-       s32  (*reset_phy)(struct e1000_hw *);
+       s32  (*read_reg)(struct e1000_hw *, u32, u16 *);
+       void (*release)(struct e1000_hw *);
+       s32  (*reset)(struct e1000_hw *);
        s32  (*set_d0_lplu_state)(struct e1000_hw *, bool);
        s32  (*set_d3_lplu_state)(struct e1000_hw *, bool);
-       s32  (*write_phy_reg)(struct e1000_hw *, u32, u16);
+       s32  (*write_reg)(struct e1000_hw *, u32, u16);
 };
 
 struct e1000_nvm_operations {
-       s32  (*acquire_nvm)(struct e1000_hw *);
-       s32  (*read_nvm)(struct e1000_hw *, u16, u16, u16 *);
-       void (*release_nvm)(struct e1000_hw *);
-       s32  (*write_nvm)(struct e1000_hw *, u16, u16, u16 *);
+       s32  (*acquire)(struct e1000_hw *);
+       s32  (*read)(struct e1000_hw *, u16, u16, u16 *);
+       void (*release)(struct e1000_hw *);
+       s32  (*write)(struct e1000_hw *, u16, u16, u16 *);
 };
 
 struct e1000_info {
@@ -483,7 +346,6 @@ struct e1000_mac_info {
        bool asf_firmware_present;
        bool autoneg;
        bool autoneg_failed;
-       bool disable_av;
        bool disable_hw_init_bits;
        bool get_link_status;
        bool ifs_params_forced;
@@ -565,9 +427,40 @@ struct e1000_fc_info {
        enum e1000_fc_type original_type;
 };
 
+struct e1000_mbx_operations {
+       s32 (*init_params)(struct e1000_hw *hw);
+       s32 (*read)(struct e1000_hw *, u32 *, u16,  u16);
+       s32 (*write)(struct e1000_hw *, u32 *, u16, u16);
+       s32 (*read_posted)(struct e1000_hw *, u32 *, u16,  u16);
+       s32 (*write_posted)(struct e1000_hw *, u32 *, u16, u16);
+       s32 (*check_for_msg)(struct e1000_hw *, u16);
+       s32 (*check_for_ack)(struct e1000_hw *, u16);
+       s32 (*check_for_rst)(struct e1000_hw *, u16);
+};
+
+struct e1000_mbx_stats {
+       u32 msgs_tx;
+       u32 msgs_rx;
+
+       u32 acks;
+       u32 reqs;
+       u32 rsts;
+};
+
+struct e1000_mbx_info {
+       struct e1000_mbx_operations ops;
+       struct e1000_mbx_stats stats;
+       u32 timeout;
+       u32 usec_delay;
+       u16 size;
+};
+
+struct e1000_dev_spec_82575 {
+       bool sgmii_active;
+};
+
 struct e1000_hw {
        void *back;
-       void *dev_spec;
 
        u8 __iomem *hw_addr;
        u8 __iomem *flash_address;
@@ -578,9 +471,12 @@ struct e1000_hw {
        struct e1000_phy_info  phy;
        struct e1000_nvm_info  nvm;
        struct e1000_bus_info  bus;
+       struct e1000_mbx_info mbx;
        struct e1000_host_mng_dhcp_cookie mng_cookie;
 
-       u32 dev_spec_size;
+       union {
+               struct e1000_dev_spec_82575     _82575;
+       } dev_spec;
 
        u16 device_id;
        u16 subsystem_vendor_id;
index 97f0049a5d6b60cca24d390e300c4f5938169a1b..2804db03e9d934eba256d964cd0fde3bb4dbf11e 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
 static s32 igb_set_default_fc(struct e1000_hw *hw);
 static s32 igb_set_fc_watermarks(struct e1000_hw *hw);
 
-/**
- *  igb_remove_device - Free device specific structure
- *  @hw: pointer to the HW structure
- *
- *  If a device specific structure was allocated, this function will
- *  free it.
- **/
-void igb_remove_device(struct e1000_hw *hw)
-{
-       /* Freeing the dev_spec member of e1000_hw structure */
-       kfree(hw->dev_spec);
-}
-
 static s32 igb_read_pcie_cap_reg(struct e1000_hw *hw, u32 reg, u16 *value)
 {
        struct igb_adapter *adapter = hw->back;
@@ -130,6 +117,30 @@ void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value)
        wrfl();
 }
 
+/**
+ *  igb_vfta_set - enable or disable vlan in VLAN filter table
+ *  @hw: pointer to the HW structure
+ *  @vid: VLAN id to add or remove
+ *  @add: if true add filter, if false remove
+ *
+ *  Sets or clears a bit in the VLAN filter table array based on VLAN id
+ *  and if we are adding or removing the filter
+ **/
+void igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add)
+{
+       u32 index = (vid >> E1000_VFTA_ENTRY_SHIFT) & E1000_VFTA_ENTRY_MASK;
+       u32 mask = 1 < (vid & E1000_VFTA_ENTRY_BIT_SHIFT_MASK);
+       u32 vfta;
+
+       vfta = array_rd32(E1000_VFTA, index);
+       if (add)
+               vfta |= mask;
+       else
+               vfta &= ~mask;
+
+       igb_write_vfta(hw, index, vfta);
+}
+
 /**
  *  igb_check_alt_mac_addr - Check for alternate MAC addr
  *  @hw: pointer to the HW structure
@@ -148,7 +159,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
        u16 offset, nvm_alt_mac_addr_offset, nvm_data;
        u8 alt_mac_addr[ETH_ALEN];
 
-       ret_val = hw->nvm.ops.read_nvm(hw, NVM_ALT_MAC_ADDR_PTR, 1,
+       ret_val = hw->nvm.ops.read(hw, NVM_ALT_MAC_ADDR_PTR, 1,
                                 &nvm_alt_mac_addr_offset);
        if (ret_val) {
                hw_dbg("NVM Read Error\n");
@@ -165,7 +176,7 @@ s32 igb_check_alt_mac_addr(struct e1000_hw *hw)
 
        for (i = 0; i < ETH_ALEN; i += 2) {
                offset = nvm_alt_mac_addr_offset + (i >> 1);
-               ret_val = hw->nvm.ops.read_nvm(hw, offset, 1, &nvm_data);
+               ret_val = hw->nvm.ops.read(hw, offset, 1, &nvm_data);
                if (ret_val) {
                        hw_dbg("NVM Read Error\n");
                        goto out;
@@ -213,7 +224,8 @@ void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index)
 
        rar_high = ((u32) addr[4] | ((u32) addr[5] << 8));
 
-       if (!hw->mac.disable_av)
+       /* If MAC address zero, no need to set the AV bit */
+       if (rar_low || rar_high)
                rar_high |= E1000_RAH_AV;
 
        wr32(E1000_RAL(index), rar_low);
@@ -588,8 +600,7 @@ static s32 igb_set_default_fc(struct e1000_hw *hw)
         * control setting, then the variable hw->fc will
         * be initialized based on a value in the EEPROM.
         */
-       ret_val = hw->nvm.ops.read_nvm(hw, NVM_INIT_CONTROL2_REG, 1,
-                                      &nvm_data);
+       ret_val = hw->nvm.ops.read(hw, NVM_INIT_CONTROL2_REG, 1, &nvm_data);
 
        if (ret_val) {
                hw_dbg("NVM Read Error\n");
@@ -720,11 +731,11 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
                 * has completed.  We read this twice because this reg has
                 * some "sticky" (latched) bits.
                 */
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS,
+               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS,
                                                   &mii_status_reg);
                if (ret_val)
                        goto out;
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS,
+               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS,
                                                   &mii_status_reg);
                if (ret_val)
                        goto out;
@@ -742,11 +753,11 @@ s32 igb_config_fc_after_link_up(struct e1000_hw *hw)
                 * Page Ability Register (Address 5) to determine how
                 * flow control was negotiated.
                 */
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_AUTONEG_ADV,
+               ret_val = hw->phy.ops.read_reg(hw, PHY_AUTONEG_ADV,
                                            &mii_nway_adv_reg);
                if (ret_val)
                        goto out;
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_LP_ABILITY,
+               ret_val = hw->phy.ops.read_reg(hw, PHY_LP_ABILITY,
                                            &mii_nway_lp_ability_reg);
                if (ret_val)
                        goto out;
@@ -1041,7 +1052,7 @@ static s32 igb_valid_led_default(struct e1000_hw *hw, u16 *data)
 {
        s32 ret_val;
 
-       ret_val = hw->nvm.ops.read_nvm(hw, NVM_ID_LED_SETTINGS, 1, data);
+       ret_val = hw->nvm.ops.read(hw, NVM_ID_LED_SETTINGS, 1, data);
        if (ret_val) {
                hw_dbg("NVM Read Error\n");
                goto out;
index cbee6af7d912af357147b1ec1afea0f6f5f2007a..eccc3536a5687550dc51febe0568533b62fbe5cc 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -58,12 +58,12 @@ s32  igb_write_8bit_ctrl_reg(struct e1000_hw *hw, u32 reg,
 
 void igb_clear_hw_cntrs_base(struct e1000_hw *hw);
 void igb_clear_vfta(struct e1000_hw *hw);
+void igb_vfta_set(struct e1000_hw *hw, u32 vid, bool add);
 void igb_config_collision_dist(struct e1000_hw *hw);
 void igb_mta_set(struct e1000_hw *hw, u32 hash_value);
 void igb_put_hw_semaphore(struct e1000_hw *hw);
 void igb_rar_set(struct e1000_hw *hw, u8 *addr, u32 index);
 s32  igb_check_alt_mac_addr(struct e1000_hw *hw);
-void igb_remove_device(struct e1000_hw *hw);
 void igb_reset_adaptive(struct e1000_hw *hw);
 void igb_update_adaptive(struct e1000_hw *hw);
 void igb_write_vfta(struct e1000_hw *hw, u32 offset, u32 value);
@@ -83,13 +83,8 @@ enum e1000_mng_mode {
 #define E1000_FWSM_MODE_MASK  0xE
 #define E1000_FWSM_MODE_SHIFT 1
 
-#define E1000_MNG_DHCP_COMMAND_TIMEOUT       10
 #define E1000_MNG_DHCP_COOKIE_STATUS_VLAN    0x2
 
-#define E1000_HICR_EN              0x01  /* Enable bit - RO */
-/* Driver sets this bit when done to put command in RAM */
-#define E1000_HICR_C               0x02
-
 extern void e1000_init_function_pointers_82575(struct e1000_hw *hw);
 extern u32 igb_hash_mc_addr(struct e1000_hw *hw, u8 *mc_addr);
 
diff --git a/drivers/net/igb/e1000_mbx.c b/drivers/net/igb/e1000_mbx.c
new file mode 100644 (file)
index 0000000..fe71c7d
--- /dev/null
@@ -0,0 +1,447 @@
+/*******************************************************************************
+
+  Intel(R) Gigabit Ethernet Linux driver
+  Copyright(c) 2007-2009 Intel Corporation.
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+  more details.
+
+  You should have received a copy of the GNU General Public License along with
+  this program; if not, write to the Free Software Foundation, Inc.,
+  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information:
+  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
+  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
+*******************************************************************************/
+
+#include "e1000_mbx.h"
+
+/**
+ *  igb_read_mbx - Reads a message from the mailbox
+ *  @hw: pointer to the HW structure
+ *  @msg: The message buffer
+ *  @size: Length of buffer
+ *  @mbx_id: id of mailbox to read
+ *
+ *  returns SUCCESS if it successfuly read message from buffer
+ **/
+s32 igb_read_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       s32 ret_val = -E1000_ERR_MBX;
+
+       /* limit read to size of mailbox */
+       if (size > mbx->size)
+               size = mbx->size;
+
+       if (mbx->ops.read)
+               ret_val = mbx->ops.read(hw, msg, size, mbx_id);
+
+       return ret_val;
+}
+
+/**
+ *  igb_write_mbx - Write a message to the mailbox
+ *  @hw: pointer to the HW structure
+ *  @msg: The message buffer
+ *  @size: Length of buffer
+ *  @mbx_id: id of mailbox to write
+ *
+ *  returns SUCCESS if it successfully copied message into the buffer
+ **/
+s32 igb_write_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       s32 ret_val = 0;
+
+       if (size > mbx->size)
+               ret_val = -E1000_ERR_MBX;
+
+       else if (mbx->ops.write)
+               ret_val = mbx->ops.write(hw, msg, size, mbx_id);
+
+       return ret_val;
+}
+
+/**
+ *  igb_check_for_msg - checks to see if someone sent us mail
+ *  @hw: pointer to the HW structure
+ *  @mbx_id: id of mailbox to check
+ *
+ *  returns SUCCESS if the Status bit was found or else ERR_MBX
+ **/
+s32 igb_check_for_msg(struct e1000_hw *hw, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       s32 ret_val = -E1000_ERR_MBX;
+
+       if (mbx->ops.check_for_msg)
+               ret_val = mbx->ops.check_for_msg(hw, mbx_id);
+
+       return ret_val;
+}
+
+/**
+ *  igb_check_for_ack - checks to see if someone sent us ACK
+ *  @hw: pointer to the HW structure
+ *  @mbx_id: id of mailbox to check
+ *
+ *  returns SUCCESS if the Status bit was found or else ERR_MBX
+ **/
+s32 igb_check_for_ack(struct e1000_hw *hw, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       s32 ret_val = -E1000_ERR_MBX;
+
+       if (mbx->ops.check_for_ack)
+               ret_val = mbx->ops.check_for_ack(hw, mbx_id);
+
+       return ret_val;
+}
+
+/**
+ *  igb_check_for_rst - checks to see if other side has reset
+ *  @hw: pointer to the HW structure
+ *  @mbx_id: id of mailbox to check
+ *
+ *  returns SUCCESS if the Status bit was found or else ERR_MBX
+ **/
+s32 igb_check_for_rst(struct e1000_hw *hw, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       s32 ret_val = -E1000_ERR_MBX;
+
+       if (mbx->ops.check_for_rst)
+               ret_val = mbx->ops.check_for_rst(hw, mbx_id);
+
+       return ret_val;
+}
+
+/**
+ *  igb_poll_for_msg - Wait for message notification
+ *  @hw: pointer to the HW structure
+ *  @mbx_id: id of mailbox to write
+ *
+ *  returns SUCCESS if it successfully received a message notification
+ **/
+static s32 igb_poll_for_msg(struct e1000_hw *hw, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       int countdown = mbx->timeout;
+
+       if (!mbx->ops.check_for_msg)
+               goto out;
+
+       while (mbx->ops.check_for_msg(hw, mbx_id)) {
+               if (!countdown)
+                       break;
+               countdown--;
+               udelay(mbx->usec_delay);
+       }
+out:
+       return countdown ? 0 : -E1000_ERR_MBX;
+}
+
+/**
+ *  igb_poll_for_ack - Wait for message acknowledgement
+ *  @hw: pointer to the HW structure
+ *  @mbx_id: id of mailbox to write
+ *
+ *  returns SUCCESS if it successfully received a message acknowledgement
+ **/
+static s32 igb_poll_for_ack(struct e1000_hw *hw, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       int countdown = mbx->timeout;
+
+       if (!mbx->ops.check_for_ack)
+               goto out;
+
+       while (mbx->ops.check_for_ack(hw, mbx_id)) {
+               if (!countdown)
+                       break;
+               countdown--;
+               udelay(mbx->usec_delay);
+       }
+out:
+       return countdown ? 0 : -E1000_ERR_MBX;
+}
+
+/**
+ *  igb_read_posted_mbx - Wait for message notification and receive message
+ *  @hw: pointer to the HW structure
+ *  @msg: The message buffer
+ *  @size: Length of buffer
+ *  @mbx_id: id of mailbox to write
+ *
+ *  returns SUCCESS if it successfully received a message notification and
+ *  copied it into the receive buffer.
+ **/
+s32 igb_read_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       s32 ret_val = -E1000_ERR_MBX;
+
+       if (!mbx->ops.read)
+               goto out;
+
+       ret_val = igb_poll_for_msg(hw, mbx_id);
+
+       if (!ret_val)
+               ret_val = mbx->ops.read(hw, msg, size, mbx_id);
+out:
+       return ret_val;
+}
+
+/**
+ *  igb_write_posted_mbx - Write a message to the mailbox, wait for ack
+ *  @hw: pointer to the HW structure
+ *  @msg: The message buffer
+ *  @size: Length of buffer
+ *  @mbx_id: id of mailbox to write
+ *
+ *  returns SUCCESS if it successfully copied message into the buffer and
+ *  received an ack to that message within delay * timeout period
+ **/
+s32 igb_write_posted_mbx(struct e1000_hw *hw, u32 *msg, u16 size, u16 mbx_id)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       s32 ret_val = 0;
+
+       if (!mbx->ops.write)
+               goto out;
+
+       /* send msg*/
+       ret_val = mbx->ops.write(hw, msg, size, mbx_id);
+
+       /* if msg sent wait until we receive an ack */
+       if (!ret_val)
+               ret_val = igb_poll_for_ack(hw, mbx_id);
+out:
+       return ret_val;
+}
+
+/**
+ *  e1000_init_mbx_ops_generic - Initialize NVM function pointers
+ *  @hw: pointer to the HW structure
+ *
+ *  Setups up the function pointers to no-op functions
+ **/
+void e1000_init_mbx_ops_generic(struct e1000_hw *hw)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+       mbx->ops.read_posted = igb_read_posted_mbx;
+       mbx->ops.write_posted = igb_write_posted_mbx;
+}
+
+static s32 igb_check_for_bit_pf(struct e1000_hw *hw, u32 mask)
+{
+       u32 mbvficr = rd32(E1000_MBVFICR);
+       s32 ret_val = -E1000_ERR_MBX;
+
+       if (mbvficr & mask) {
+               ret_val = 0;
+               wr32(E1000_MBVFICR, mask);
+       }
+
+       return ret_val;
+}
+
+/**
+ *  igb_check_for_msg_pf - checks to see if the VF has sent mail
+ *  @hw: pointer to the HW structure
+ *  @vf_number: the VF index
+ *
+ *  returns SUCCESS if the VF has set the Status bit or else ERR_MBX
+ **/
+static s32 igb_check_for_msg_pf(struct e1000_hw *hw, u16 vf_number)
+{
+       s32 ret_val = -E1000_ERR_MBX;
+
+       if (!igb_check_for_bit_pf(hw, E1000_MBVFICR_VFREQ_VF1 << vf_number)) {
+               ret_val = 0;
+               hw->mbx.stats.reqs++;
+       }
+
+       return ret_val;
+}
+
+/**
+ *  igb_check_for_ack_pf - checks to see if the VF has ACKed
+ *  @hw: pointer to the HW structure
+ *  @vf_number: the VF index
+ *
+ *  returns SUCCESS if the VF has set the Status bit or else ERR_MBX
+ **/
+static s32 igb_check_for_ack_pf(struct e1000_hw *hw, u16 vf_number)
+{
+       s32 ret_val = -E1000_ERR_MBX;
+
+       if (!igb_check_for_bit_pf(hw, E1000_MBVFICR_VFACK_VF1 << vf_number)) {
+               ret_val = 0;
+               hw->mbx.stats.acks++;
+       }
+
+       return ret_val;
+}
+
+/**
+ *  igb_check_for_rst_pf - checks to see if the VF has reset
+ *  @hw: pointer to the HW structure
+ *  @vf_number: the VF index
+ *
+ *  returns SUCCESS if the VF has set the Status bit or else ERR_MBX
+ **/
+static s32 igb_check_for_rst_pf(struct e1000_hw *hw, u16 vf_number)
+{
+       u32 vflre = rd32(E1000_VFLRE);
+       s32 ret_val = -E1000_ERR_MBX;
+
+       if (vflre & (1 << vf_number)) {
+               ret_val = 0;
+               wr32(E1000_VFLRE, (1 << vf_number));
+               hw->mbx.stats.rsts++;
+       }
+
+       return ret_val;
+}
+
+/**
+ *  igb_write_mbx_pf - Places a message in the mailbox
+ *  @hw: pointer to the HW structure
+ *  @msg: The message buffer
+ *  @size: Length of buffer
+ *  @vf_number: the VF index
+ *
+ *  returns SUCCESS if it successfully copied message into the buffer
+ **/
+static s32 igb_write_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,
+                              u16 vf_number)
+{
+       u32 p2v_mailbox;
+       s32 ret_val = 0;
+       u16 i;
+
+       /* Take ownership of the buffer */
+       wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
+
+       /* Make sure we have ownership now... */
+       p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number));
+       if (!(p2v_mailbox & E1000_P2VMAILBOX_PFU)) {
+               /* failed to grab ownership */
+               ret_val = -E1000_ERR_MBX;
+               goto out_no_write;
+       }
+
+       /*
+        * flush any ack or msg which may already be in the queue
+        * as they are likely the result of an error
+        */
+       igb_check_for_ack_pf(hw, vf_number);
+       igb_check_for_msg_pf(hw, vf_number);
+
+       /* copy the caller specified message to the mailbox memory buffer */
+       for (i = 0; i < size; i++)
+               array_wr32(E1000_VMBMEM(vf_number), i, msg[i]);
+
+       /* Interrupt VF to tell it a message has been sent and release buffer*/
+       wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_STS);
+
+       /* update stats */
+       hw->mbx.stats.msgs_tx++;
+
+out_no_write:
+       return ret_val;
+
+}
+
+/**
+ *  igb_read_mbx_pf - Read a message from the mailbox
+ *  @hw: pointer to the HW structure
+ *  @msg: The message buffer
+ *  @size: Length of buffer
+ *  @vf_number: the VF index
+ *
+ *  This function copies a message from the mailbox buffer to the caller's
+ *  memory buffer.  The presumption is that the caller knows that there was
+ *  a message due to a VF request so no polling for message is needed.
+ **/
+static s32 igb_read_mbx_pf(struct e1000_hw *hw, u32 *msg, u16 size,
+                             u16 vf_number)
+{
+       u32 p2v_mailbox;
+       s32 ret_val = 0;
+       u16 i;
+
+       /* Take ownership of the buffer */
+       wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_PFU);
+
+       /* Make sure we have ownership now... */
+       p2v_mailbox = rd32(E1000_P2VMAILBOX(vf_number));
+       if (!(p2v_mailbox & E1000_P2VMAILBOX_PFU)) {
+               /* failed to grab ownership */
+               ret_val = -E1000_ERR_MBX;
+               goto out_no_read;
+       }
+
+       /* copy the message to the mailbox memory buffer */
+       for (i = 0; i < size; i++)
+               msg[i] = array_rd32(E1000_VMBMEM(vf_number), i);
+
+       /* Acknowledge the message and release buffer */
+       wr32(E1000_P2VMAILBOX(vf_number), E1000_P2VMAILBOX_ACK);
+
+       /* update stats */
+       hw->mbx.stats.msgs_rx++;
+
+       ret_val = 0;
+
+out_no_read:
+       return ret_val;
+}
+
+/**
+ *  e1000_init_mbx_params_pf - set initial values for pf mailbox
+ *  @hw: pointer to the HW structure
+ *
+ *  Initializes the hw->mbx struct to correct values for pf mailbox
+ */
+s32 igb_init_mbx_params_pf(struct e1000_hw *hw)
+{
+       struct e1000_mbx_info *mbx = &hw->mbx;
+
+       if (hw->mac.type == e1000_82576) {
+               mbx->timeout = 0;
+               mbx->usec_delay = 0;
+
+               mbx->size = E1000_VFMAILBOX_SIZE;
+
+               mbx->ops.read = igb_read_mbx_pf;
+               mbx->ops.write = igb_write_mbx_pf;
+               mbx->ops.read_posted = igb_read_posted_mbx;
+               mbx->ops.write_posted = igb_write_posted_mbx;
+               mbx->ops.check_for_msg = igb_check_for_msg_pf;
+               mbx->ops.check_for_ack = igb_check_for_ack_pf;
+               mbx->ops.check_for_rst = igb_check_for_rst_pf;
+
+               mbx->stats.msgs_tx = 0;
+               mbx->stats.msgs_rx = 0;
+               mbx->stats.reqs = 0;
+               mbx->stats.acks = 0;
+               mbx->stats.rsts = 0;
+       }
+
+       return 0;
+}
+
diff --git a/drivers/net/igb/e1000_mbx.h b/drivers/net/igb/e1000_mbx.h
new file mode 100644 (file)
index 0000000..6ec9890
--- /dev/null
@@ -0,0 +1,77 @@
+/*******************************************************************************
+
+  Intel(R) Gigabit Ethernet Linux driver
+  Copyright(c) 2007-2009 Intel Corporation.
+
+  This program is free software; you can redistribute it and/or modify it
+  under the terms and conditions of the GNU General Public License,
+  version 2, as published by the Free Software Foundation.
+
+  This program is distributed in the hope it will be useful, but WITHOUT
+  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+  more details.
+
+  You should have received a copy of the GNU General Public License along with
+  this program; if not, write to the Free Software Foundation, Inc.,
+  51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+
+  The full GNU General Public License is included in this distribution in
+  the file called "COPYING".
+
+  Contact Information:
+  e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
+  Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+
+*******************************************************************************/
+
+#ifndef _E1000_MBX_H_
+#define _E1000_MBX_H_
+
+#include "e1000_hw.h"
+
+#define E1000_P2VMAILBOX_STS   0x00000001 /* Initiate message send to VF */
+#define E1000_P2VMAILBOX_ACK   0x00000002 /* Ack message recv'd from VF */
+#define E1000_P2VMAILBOX_VFU   0x00000004 /* VF owns the mailbox buffer */
+#define E1000_P2VMAILBOX_PFU   0x00000008 /* PF owns the mailbox buffer */
+#define E1000_P2VMAILBOX_RVFU  0x00000010 /* Reset VFU - used when VF stuck */
+
+#define E1000_MBVFICR_VFREQ_MASK 0x000000FF /* bits for VF messages */
+#define E1000_MBVFICR_VFREQ_VF1  0x00000001 /* bit for VF 1 message */
+#define E1000_MBVFICR_VFACK_MASK 0x00FF0000 /* bits for VF acks */
+#define E1000_MBVFICR_VFACK_VF1  0x00010000 /* bit for VF 1 ack */
+
+#define E1000_VFMAILBOX_SIZE   16 /* 16 32 bit words - 64 bytes */
+
+/* If it's a E1000_VF_* msg then it originates in the VF and is sent to the
+ * PF.  The reverse is true if it is E1000_PF_*.
+ * Message ACK's are the value or'd with 0xF0000000
+ */
+#define E1000_VT_MSGTYPE_ACK      0x80000000  /* Messages below or'd with
+                                               * this are the ACK */
+#define E1000_VT_MSGTYPE_NACK     0x40000000  /* Messages below or'd with
+                                               * this are the NACK */
+#define E1000_VT_MSGTYPE_CTS      0x20000000  /* Indicates that VF is still
+                                                 clear to send requests */
+#define E1000_VT_MSGINFO_SHIFT    16
+/* bits 23:16 are used for exra info for certain messages */
+#define E1000_VT_MSGINFO_MASK     (0xFF << E1000_VT_MSGINFO_SHIFT)
+
+#define E1000_VF_RESET            0x01 /* VF requests reset */
+#define E1000_VF_SET_MAC_ADDR     0x02 /* VF requests PF to set MAC addr */
+#define E1000_VF_SET_MULTICAST    0x03 /* VF requests PF to set MC addr */
+#define E1000_VF_SET_VLAN         0x04 /* VF requests PF to set VLAN */
+#define E1000_VF_SET_LPE          0x05 /* VF requests PF to set VMOLR.LPE */
+
+#define E1000_PF_CONTROL_MSG      0x0100 /* PF control message */
+
+s32 igb_read_mbx(struct e1000_hw *, u32 *, u16, u16);
+s32 igb_write_mbx(struct e1000_hw *, u32 *, u16, u16);
+s32 igb_read_posted_mbx(struct e1000_hw *, u32 *, u16, u16);
+s32 igb_write_posted_mbx(struct e1000_hw *, u32 *, u16, u16);
+s32 igb_check_for_msg(struct e1000_hw *, u16);
+s32 igb_check_for_ack(struct e1000_hw *, u16);
+s32 igb_check_for_rst(struct e1000_hw *, u16);
+s32 igb_init_mbx_params_pf(struct e1000_hw *);
+
+#endif /* _E1000_MBX_H_ */
index a84e4e429fa7e3a4a1606db2a7dd7a48069b0d78..a88bfe2f1e8f635985082d637fda2efdd562f021 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -419,7 +419,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
                goto out;
        }
 
-       ret_val = hw->nvm.ops.acquire_nvm(hw);
+       ret_val = hw->nvm.ops.acquire(hw);
        if (ret_val)
                goto out;
 
@@ -468,7 +468,7 @@ s32 igb_write_nvm_spi(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
 
        msleep(10);
 release:
-       hw->nvm.ops.release_nvm(hw);
+       hw->nvm.ops.release(hw);
 
 out:
        return ret_val;
@@ -487,14 +487,14 @@ s32 igb_read_part_num(struct e1000_hw *hw, u32 *part_num)
        s32  ret_val;
        u16 nvm_data;
 
-       ret_val = hw->nvm.ops.read_nvm(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
+       ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_0, 1, &nvm_data);
        if (ret_val) {
                hw_dbg("NVM Read Error\n");
                goto out;
        }
        *part_num = (u32)(nvm_data << 16);
 
-       ret_val = hw->nvm.ops.read_nvm(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
+       ret_val = hw->nvm.ops.read(hw, NVM_PBA_OFFSET_1, 1, &nvm_data);
        if (ret_val) {
                hw_dbg("NVM Read Error\n");
                goto out;
@@ -515,29 +515,23 @@ out:
  **/
 s32 igb_read_mac_addr(struct e1000_hw *hw)
 {
-       s32  ret_val = 0;
-       u16 offset, nvm_data, i;
+       u32 rar_high;
+       u32 rar_low;
+       u16 i;
 
-       for (i = 0; i < ETH_ALEN; i += 2) {
-               offset = i >> 1;
-               ret_val = hw->nvm.ops.read_nvm(hw, offset, 1, &nvm_data);
-               if (ret_val) {
-                       hw_dbg("NVM Read Error\n");
-                       goto out;
-               }
-               hw->mac.perm_addr[i] = (u8)(nvm_data & 0xFF);
-               hw->mac.perm_addr[i+1] = (u8)(nvm_data >> 8);
-       }
+       rar_high = rd32(E1000_RAH(0));
+       rar_low = rd32(E1000_RAL(0));
+
+       for (i = 0; i < E1000_RAL_MAC_ADDR_LEN; i++)
+               hw->mac.perm_addr[i] = (u8)(rar_low >> (i*8));
 
-       /* Flip last bit of mac address if we're on second port */
-       if (hw->bus.func == E1000_FUNC_1)
-               hw->mac.perm_addr[5] ^= 1;
+       for (i = 0; i < E1000_RAH_MAC_ADDR_LEN; i++)
+               hw->mac.perm_addr[i+4] = (u8)(rar_high >> (i*8));
 
        for (i = 0; i < ETH_ALEN; i++)
                hw->mac.addr[i] = hw->mac.perm_addr[i];
 
-out:
-       return ret_val;
+       return 0;
 }
 
 /**
@@ -554,7 +548,7 @@ s32 igb_validate_nvm_checksum(struct e1000_hw *hw)
        u16 i, nvm_data;
 
        for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
-               ret_val = hw->nvm.ops.read_nvm(hw, i, 1, &nvm_data);
+               ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
                if (ret_val) {
                        hw_dbg("NVM Read Error\n");
                        goto out;
@@ -587,7 +581,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
        u16 i, nvm_data;
 
        for (i = 0; i < NVM_CHECKSUM_REG; i++) {
-               ret_val = hw->nvm.ops.read_nvm(hw, i, 1, &nvm_data);
+               ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
                if (ret_val) {
                        hw_dbg("NVM Read Error while updating checksum.\n");
                        goto out;
@@ -595,7 +589,7 @@ s32 igb_update_nvm_checksum(struct e1000_hw *hw)
                checksum += nvm_data;
        }
        checksum = (u16) NVM_SUM - checksum;
-       ret_val = hw->nvm.ops.write_nvm(hw, NVM_CHECKSUM_REG, 1, &checksum);
+       ret_val = hw->nvm.ops.write(hw, NVM_CHECKSUM_REG, 1, &checksum);
        if (ret_val)
                hw_dbg("NVM Write Error while updating checksum.\n");
 
index 17fddb91c9f569823357c74bb98273e7a8c4a9b7..de2d48624683d03388039a15aff3bc4b22d9dbc9 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
 #include "e1000_mac.h"
 #include "e1000_phy.h"
 
-static s32  igb_get_phy_cfg_done(struct e1000_hw *hw);
-static void igb_release_phy(struct e1000_hw *hw);
-static s32  igb_acquire_phy(struct e1000_hw *hw);
-static s32  igb_phy_reset_dsp(struct e1000_hw *hw);
 static s32  igb_phy_setup_autoneg(struct e1000_hw *hw);
 static void igb_phy_force_speed_duplex_setup(struct e1000_hw *hw,
                                               u16 *phy_ctrl);
@@ -43,9 +39,6 @@ static s32  igb_wait_autoneg(struct e1000_hw *hw);
 /* Cable length tables */
 static const u16 e1000_m88_cable_length_table[] =
        { 0, 50, 80, 110, 140, 140, E1000_CABLE_LENGTH_UNDEFINED };
-#define M88E1000_CABLE_LENGTH_TABLE_SIZE \
-               (sizeof(e1000_m88_cable_length_table) / \
-                sizeof(e1000_m88_cable_length_table[0]))
 
 static const u16 e1000_igp_2_cable_length_table[] =
     { 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 8, 11, 13, 16, 18, 21,
@@ -91,13 +84,13 @@ s32 igb_get_phy_id(struct e1000_hw *hw)
        s32 ret_val = 0;
        u16 phy_id;
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, PHY_ID1, &phy_id);
+       ret_val = phy->ops.read_reg(hw, PHY_ID1, &phy_id);
        if (ret_val)
                goto out;
 
        phy->id = (u32)(phy_id << 16);
        udelay(20);
-       ret_val = hw->phy.ops.read_phy_reg(hw, PHY_ID2, &phy_id);
+       ret_val = phy->ops.read_reg(hw, PHY_ID2, &phy_id);
        if (ret_val)
                goto out;
 
@@ -118,11 +111,11 @@ static s32 igb_phy_reset_dsp(struct e1000_hw *hw)
 {
        s32 ret_val;
 
-       ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xC1);
+       ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0xC1);
        if (ret_val)
                goto out;
 
-       ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_GEN_CONTROL, 0);
+       ret_val = hw->phy.ops.write_reg(hw, M88E1000_PHY_GEN_CONTROL, 0);
 
 out:
        return ret_val;
@@ -257,9 +250,12 @@ out:
  **/
 s32 igb_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
 {
-       s32 ret_val;
+       s32 ret_val = 0;
+
+       if (!(hw->phy.ops.acquire))
+               goto out;
 
-       ret_val = igb_acquire_phy(hw);
+       ret_val = hw->phy.ops.acquire(hw);
        if (ret_val)
                goto out;
 
@@ -268,16 +264,15 @@ s32 igb_read_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 *data)
                                                   IGP01E1000_PHY_PAGE_SELECT,
                                                   (u16)offset);
                if (ret_val) {
-                       igb_release_phy(hw);
+                       hw->phy.ops.release(hw);
                        goto out;
                }
        }
 
-       ret_val = igb_read_phy_reg_mdic(hw,
-                                         MAX_PHY_REG_ADDRESS & offset,
-                                         data);
+       ret_val = igb_read_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
+                                       data);
 
-       igb_release_phy(hw);
+       hw->phy.ops.release(hw);
 
 out:
        return ret_val;
@@ -294,9 +289,12 @@ out:
  **/
 s32 igb_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
 {
-       s32 ret_val;
+       s32 ret_val = 0;
 
-       ret_val = igb_acquire_phy(hw);
+       if (!(hw->phy.ops.acquire))
+               goto out;
+
+       ret_val = hw->phy.ops.acquire(hw);
        if (ret_val)
                goto out;
 
@@ -305,16 +303,15 @@ s32 igb_write_phy_reg_igp(struct e1000_hw *hw, u32 offset, u16 data)
                                                   IGP01E1000_PHY_PAGE_SELECT,
                                                   (u16)offset);
                if (ret_val) {
-                       igb_release_phy(hw);
+                       hw->phy.ops.release(hw);
                        goto out;
                }
        }
 
-       ret_val = igb_write_phy_reg_mdic(hw,
-                                          MAX_PHY_REG_ADDRESS & offset,
+       ret_val = igb_write_phy_reg_mdic(hw, MAX_PHY_REG_ADDRESS & offset,
                                           data);
 
-       igb_release_phy(hw);
+       hw->phy.ops.release(hw);
 
 out:
        return ret_val;
@@ -339,8 +336,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
        }
 
        /* Enable CRS on TX. This must be set for half-duplex operation. */
-       ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                          &phy_data);
+       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
        if (ret_val)
                goto out;
 
@@ -383,8 +379,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
        if (phy->disable_polarity_correction == 1)
                phy_data |= M88E1000_PSCR_POLARITY_REVERSAL;
 
-       ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                           phy_data);
+       ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
        if (ret_val)
                goto out;
 
@@ -393,8 +388,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
                 * Force TX_CLK in the Extended PHY Specific Control Register
                 * to 25MHz clock.
                 */
-               ret_val = hw->phy.ops.read_phy_reg(hw,
-                                            M88E1000_EXT_PHY_SPEC_CTRL,
+               ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
                                             &phy_data);
                if (ret_val)
                        goto out;
@@ -413,8 +407,7 @@ s32 igb_copper_link_setup_m88(struct e1000_hw *hw)
                        phy_data |= (M88E1000_EPSCR_MASTER_DOWNSHIFT_1X |
                                     M88E1000_EPSCR_SLAVE_DOWNSHIFT_1X);
                }
-               ret_val = hw->phy.ops.write_phy_reg(hw,
-                                            M88E1000_EXT_PHY_SPEC_CTRL,
+               ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
                                             phy_data);
                if (ret_val)
                        goto out;
@@ -449,7 +442,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
                goto out;
        }
 
-       ret_val = hw->phy.ops.reset_phy(hw);
+       ret_val = phy->ops.reset(hw);
        if (ret_val) {
                hw_dbg("Error resetting the PHY.\n");
                goto out;
@@ -464,8 +457,8 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
         */
        if (phy->type == e1000_phy_igp) {
                /* disable lplu d3 during driver init */
-               if (hw->phy.ops.set_d3_lplu_state)
-                       ret_val = hw->phy.ops.set_d3_lplu_state(hw, false);
+               if (phy->ops.set_d3_lplu_state)
+                       ret_val = phy->ops.set_d3_lplu_state(hw, false);
                if (ret_val) {
                        hw_dbg("Error Disabling LPLU D3\n");
                        goto out;
@@ -473,13 +466,13 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
        }
 
        /* disable lplu d0 during driver init */
-       ret_val = hw->phy.ops.set_d0_lplu_state(hw, false);
+       ret_val = phy->ops.set_d0_lplu_state(hw, false);
        if (ret_val) {
                hw_dbg("Error Disabling LPLU D0\n");
                goto out;
        }
        /* Configure mdi-mdix settings */
-       ret_val = hw->phy.ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, &data);
+       ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &data);
        if (ret_val)
                goto out;
 
@@ -497,7 +490,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
                data |= IGP01E1000_PSCR_AUTO_MDIX;
                break;
        }
-       ret_val = hw->phy.ops.write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL, data);
+       ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, data);
        if (ret_val)
                goto out;
 
@@ -510,33 +503,31 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
                 */
                if (phy->autoneg_advertised == ADVERTISE_1000_FULL) {
                        /* Disable SmartSpeed */
-                       ret_val = hw->phy.ops.read_phy_reg(hw,
-                                                    IGP01E1000_PHY_PORT_CONFIG,
-                                                    &data);
+                       ret_val = phy->ops.read_reg(hw,
+                                                   IGP01E1000_PHY_PORT_CONFIG,
+                                                   &data);
                        if (ret_val)
                                goto out;
 
                        data &= ~IGP01E1000_PSCFR_SMART_SPEED;
-                       ret_val = hw->phy.ops.write_phy_reg(hw,
+                       ret_val = phy->ops.write_reg(hw,
                                                     IGP01E1000_PHY_PORT_CONFIG,
                                                     data);
                        if (ret_val)
                                goto out;
 
                        /* Set auto Master/Slave resolution process */
-                       ret_val = hw->phy.ops.read_phy_reg(hw, PHY_1000T_CTRL,
-                                                          &data);
+                       ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data);
                        if (ret_val)
                                goto out;
 
                        data &= ~CR_1000T_MS_ENABLE;
-                       ret_val = hw->phy.ops.write_phy_reg(hw, PHY_1000T_CTRL,
-                                                           data);
+                       ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data);
                        if (ret_val)
                                goto out;
                }
 
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_1000T_CTRL, &data);
+               ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL, &data);
                if (ret_val)
                        goto out;
 
@@ -560,7 +551,7 @@ s32 igb_copper_link_setup_igp(struct e1000_hw *hw)
                default:
                        break;
                }
-               ret_val = hw->phy.ops.write_phy_reg(hw, PHY_1000T_CTRL, data);
+               ret_val = phy->ops.write_reg(hw, PHY_1000T_CTRL, data);
                if (ret_val)
                        goto out;
        }
@@ -609,12 +600,12 @@ s32 igb_copper_link_autoneg(struct e1000_hw *hw)
         * Restart auto-negotiation by setting the Auto Neg Enable bit and
         * the Auto Neg Restart bit in the PHY control register.
         */
-       ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_ctrl);
+       ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_ctrl);
        if (ret_val)
                goto out;
 
        phy_ctrl |= (MII_CR_AUTO_NEG_EN | MII_CR_RESTART_AUTO_NEG);
-       ret_val = hw->phy.ops.write_phy_reg(hw, PHY_CONTROL, phy_ctrl);
+       ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_ctrl);
        if (ret_val)
                goto out;
 
@@ -656,15 +647,13 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
        phy->autoneg_advertised &= phy->autoneg_mask;
 
        /* Read the MII Auto-Neg Advertisement Register (Address 4). */
-       ret_val = hw->phy.ops.read_phy_reg(hw, PHY_AUTONEG_ADV,
-                                          &mii_autoneg_adv_reg);
+       ret_val = phy->ops.read_reg(hw, PHY_AUTONEG_ADV, &mii_autoneg_adv_reg);
        if (ret_val)
                goto out;
 
        if (phy->autoneg_mask & ADVERTISE_1000_FULL) {
                /* Read the MII 1000Base-T Control Register (Address 9). */
-               ret_val = hw->phy.ops.read_phy_reg(hw,
-                                           PHY_1000T_CTRL,
+               ret_val = phy->ops.read_reg(hw, PHY_1000T_CTRL,
                                            &mii_1000t_ctrl_reg);
                if (ret_val)
                        goto out;
@@ -785,17 +774,16 @@ static s32 igb_phy_setup_autoneg(struct e1000_hw *hw)
                goto out;
        }
 
-       ret_val = hw->phy.ops.write_phy_reg(hw, PHY_AUTONEG_ADV,
-                                           mii_autoneg_adv_reg);
+       ret_val = phy->ops.write_reg(hw, PHY_AUTONEG_ADV, mii_autoneg_adv_reg);
        if (ret_val)
                goto out;
 
        hw_dbg("Auto-Neg Advertising %x\n", mii_autoneg_adv_reg);
 
        if (phy->autoneg_mask & ADVERTISE_1000_FULL) {
-               ret_val = hw->phy.ops.write_phy_reg(hw,
-                                             PHY_1000T_CTRL,
-                                             mii_1000t_ctrl_reg);
+               ret_val = phy->ops.write_reg(hw,
+                                            PHY_1000T_CTRL,
+                                            mii_1000t_ctrl_reg);
                if (ret_val)
                        goto out;
        }
@@ -819,13 +807,13 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
        u16 phy_data;
        bool link;
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_data);
+       ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
        if (ret_val)
                goto out;
 
        igb_phy_force_speed_duplex_setup(hw, &phy_data);
 
-       ret_val = hw->phy.ops.write_phy_reg(hw, PHY_CONTROL, phy_data);
+       ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data);
        if (ret_val)
                goto out;
 
@@ -833,16 +821,14 @@ s32 igb_phy_force_speed_duplex_igp(struct e1000_hw *hw)
         * Clear Auto-Crossover to force MDI manually.  IGP requires MDI
         * forced whenever speed and duplex are forced.
         */
-       ret_val = hw->phy.ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL,
-                                          &phy_data);
+       ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CTRL, &phy_data);
        if (ret_val)
                goto out;
 
        phy_data &= ~IGP01E1000_PSCR_AUTO_MDIX;
        phy_data &= ~IGP01E1000_PSCR_FORCE_MDI_MDIX;
 
-       ret_val = hw->phy.ops.write_phy_reg(hw, IGP01E1000_PHY_PORT_CTRL,
-                                           phy_data);
+       ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CTRL, phy_data);
        if (ret_val)
                goto out;
 
@@ -897,20 +883,18 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
         * Clear Auto-Crossover to force MDI manually.  M88E1000 requires MDI
         * forced whenever speed and duplex are forced.
         */
-       ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                          &phy_data);
+       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
        if (ret_val)
                goto out;
 
        phy_data &= ~M88E1000_PSCR_AUTO_X_MODE;
-       ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                           phy_data);
+       ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
        if (ret_val)
                goto out;
 
        hw_dbg("M88E1000 PSCR: %X\n", phy_data);
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_data);
+       ret_val = phy->ops.read_reg(hw, PHY_CONTROL, &phy_data);
        if (ret_val)
                goto out;
 
@@ -919,7 +903,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
        /* Reset the phy to commit changes. */
        phy_data |= MII_CR_RESET;
 
-       ret_val = hw->phy.ops.write_phy_reg(hw, PHY_CONTROL, phy_data);
+       ret_val = phy->ops.write_reg(hw, PHY_CONTROL, phy_data);
        if (ret_val)
                goto out;
 
@@ -940,7 +924,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
                         * We didn't get link.
                         * Reset the DSP and cross our fingers.
                         */
-                       ret_val = hw->phy.ops.write_phy_reg(hw,
+                       ret_val = phy->ops.write_reg(hw,
                                                      M88E1000_PHY_PAGE_SELECT,
                                                      0x001d);
                        if (ret_val)
@@ -957,8 +941,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
                        goto out;
        }
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
-                                          &phy_data);
+       ret_val = phy->ops.read_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, &phy_data);
        if (ret_val)
                goto out;
 
@@ -968,8 +951,7 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
         * the reset value of 2.5MHz.
         */
        phy_data |= M88E1000_EPSCR_TX_CLK_25;
-       ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL,
-                                           phy_data);
+       ret_val = phy->ops.write_reg(hw, M88E1000_EXT_PHY_SPEC_CTRL, phy_data);
        if (ret_val)
                goto out;
 
@@ -977,14 +959,12 @@ s32 igb_phy_force_speed_duplex_m88(struct e1000_hw *hw)
         * In addition, we must re-enable CRS on Tx for both half and full
         * duplex.
         */
-       ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                          &phy_data);
+       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
        if (ret_val)
                goto out;
 
        phy_data |= M88E1000_PSCR_ASSERT_CRS_ON_TX;
-       ret_val = hw->phy.ops.write_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                           phy_data);
+       ret_val = phy->ops.write_reg(hw, M88E1000_PHY_SPEC_CTRL, phy_data);
 
 out:
        return ret_val;
@@ -1071,15 +1051,13 @@ s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active)
        s32 ret_val;
        u16 data;
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, IGP02E1000_PHY_POWER_MGMT,
-                                          &data);
+       ret_val = phy->ops.read_reg(hw, IGP02E1000_PHY_POWER_MGMT, &data);
        if (ret_val)
                goto out;
 
        if (!active) {
                data &= ~IGP02E1000_PM_D3_LPLU;
-               ret_val = hw->phy.ops.write_phy_reg(hw,
-                                            IGP02E1000_PHY_POWER_MGMT,
+               ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
                                             data);
                if (ret_val)
                        goto out;
@@ -1090,27 +1068,27 @@ s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active)
                 * SmartSpeed, so performance is maintained.
                 */
                if (phy->smart_speed == e1000_smart_speed_on) {
-                       ret_val = hw->phy.ops.read_phy_reg(hw,
+                       ret_val = phy->ops.read_reg(hw,
                                                    IGP01E1000_PHY_PORT_CONFIG,
                                                    &data);
                        if (ret_val)
                                goto out;
 
                        data |= IGP01E1000_PSCFR_SMART_SPEED;
-                       ret_val = hw->phy.ops.write_phy_reg(hw,
+                       ret_val = phy->ops.write_reg(hw,
                                                     IGP01E1000_PHY_PORT_CONFIG,
                                                     data);
                        if (ret_val)
                                goto out;
                } else if (phy->smart_speed == e1000_smart_speed_off) {
-                       ret_val = hw->phy.ops.read_phy_reg(hw,
+                       ret_val = phy->ops.read_reg(hw,
                                                     IGP01E1000_PHY_PORT_CONFIG,
                                                     &data);
                        if (ret_val)
                                goto out;
 
                        data &= ~IGP01E1000_PSCFR_SMART_SPEED;
-                       ret_val = hw->phy.ops.write_phy_reg(hw,
+                       ret_val = phy->ops.write_reg(hw,
                                                     IGP01E1000_PHY_PORT_CONFIG,
                                                     data);
                        if (ret_val)
@@ -1120,22 +1098,19 @@ s32 igb_set_d3_lplu_state(struct e1000_hw *hw, bool active)
                   (phy->autoneg_advertised == E1000_ALL_NOT_GIG) ||
                   (phy->autoneg_advertised == E1000_ALL_10_SPEED)) {
                data |= IGP02E1000_PM_D3_LPLU;
-               ret_val = hw->phy.ops.write_phy_reg(hw,
-                                             IGP02E1000_PHY_POWER_MGMT,
+               ret_val = phy->ops.write_reg(hw, IGP02E1000_PHY_POWER_MGMT,
                                              data);
                if (ret_val)
                        goto out;
 
                /* When LPLU is enabled, we should disable SmartSpeed */
-               ret_val = hw->phy.ops.read_phy_reg(hw,
-                                            IGP01E1000_PHY_PORT_CONFIG,
+               ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
                                             &data);
                if (ret_val)
                        goto out;
 
                data &= ~IGP01E1000_PSCFR_SMART_SPEED;
-               ret_val = hw->phy.ops.write_phy_reg(hw,
-                                             IGP01E1000_PHY_PORT_CONFIG,
+               ret_val = phy->ops.write_reg(hw, IGP01E1000_PHY_PORT_CONFIG,
                                              data);
        }
 
@@ -1176,7 +1151,7 @@ s32 igb_check_downshift(struct e1000_hw *hw)
                goto out;
        }
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, offset, &phy_data);
+       ret_val = phy->ops.read_reg(hw, offset, &phy_data);
 
        if (!ret_val)
                phy->speed_downgraded = (phy_data & mask) ? true : false;
@@ -1199,7 +1174,7 @@ static s32 igb_check_polarity_m88(struct e1000_hw *hw)
        s32 ret_val;
        u16 data;
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS, &data);
+       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &data);
 
        if (!ret_val)
                phy->cable_polarity = (data & M88E1000_PSSR_REV_POLARITY)
@@ -1228,8 +1203,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw)
         * Polarity is determined based on the speed of
         * our connection.
         */
-       ret_val = hw->phy.ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS,
-                                          &data);
+       ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data);
        if (ret_val)
                goto out;
 
@@ -1246,7 +1220,7 @@ static s32 igb_check_polarity_igp(struct e1000_hw *hw)
                mask    = IGP01E1000_PSSR_POLARITY_REVERSED;
        }
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, offset, &data);
+       ret_val = phy->ops.read_reg(hw, offset, &data);
 
        if (!ret_val)
                phy->cable_polarity = (data & mask)
@@ -1271,10 +1245,10 @@ static s32 igb_wait_autoneg(struct e1000_hw *hw)
 
        /* Break after autoneg completes or PHY_AUTO_NEG_LIMIT expires. */
        for (i = PHY_AUTO_NEG_LIMIT; i > 0; i--) {
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, &phy_status);
+               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
                if (ret_val)
                        break;
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, &phy_status);
+               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
                if (ret_val)
                        break;
                if (phy_status & MII_SR_AUTONEG_COMPLETE)
@@ -1310,10 +1284,10 @@ s32 igb_phy_has_link(struct e1000_hw *hw, u32 iterations,
                 * twice due to the link bit being sticky.  No harm doing
                 * it across the board.
                 */
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, &phy_status);
+               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
                if (ret_val)
                        break;
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_STATUS, &phy_status);
+               ret_val = hw->phy.ops.read_reg(hw, PHY_STATUS, &phy_status);
                if (ret_val)
                        break;
                if (phy_status & MII_SR_LINK_STATUS)
@@ -1350,8 +1324,7 @@ s32 igb_get_cable_length_m88(struct e1000_hw *hw)
        s32 ret_val;
        u16 phy_data, index;
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS,
-                                          &phy_data);
+       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
        if (ret_val)
                goto out;
 
@@ -1372,8 +1345,8 @@ out:
  *
  *  The automatic gain control (agc) normalizes the amplitude of the
  *  received signal, adjusting for the attenuation produced by the
- *  cable.  By reading the AGC registers, which reperesent the
- *  cobination of course and fine gain value, the value can be put
+ *  cable.  By reading the AGC registers, which represent the
+ *  combination of coarse and fine gain value, the value can be put
  *  into a lookup table to obtain the approximate cable length
  *  for each channel.
  **/
@@ -1392,14 +1365,13 @@ s32 igb_get_cable_length_igp_2(struct e1000_hw *hw)
 
        /* Read the AGC registers for all channels */
        for (i = 0; i < IGP02E1000_PHY_CHANNEL_NUM; i++) {
-               ret_val = hw->phy.ops.read_phy_reg(hw, agc_reg_array[i],
-                                                  &phy_data);
+               ret_val = phy->ops.read_reg(hw, agc_reg_array[i], &phy_data);
                if (ret_val)
                        goto out;
 
                /*
                 * Getting bits 15:9, which represent the combination of
-                * course and fine gain values.  The result is a number
+                * coarse and fine gain values.  The result is a number
                 * that can be put into the lookup table to obtain the
                 * approximate cable length.
                 */
@@ -1456,7 +1428,7 @@ s32 igb_get_phy_info_m88(struct e1000_hw *hw)
        u16 phy_data;
        bool link;
 
-       if (hw->phy.media_type != e1000_media_type_copper) {
+       if (phy->media_type != e1000_media_type_copper) {
                hw_dbg("Phy info is only valid for copper media\n");
                ret_val = -E1000_ERR_CONFIG;
                goto out;
@@ -1472,33 +1444,29 @@ s32 igb_get_phy_info_m88(struct e1000_hw *hw)
                goto out;
        }
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_CTRL,
-                                          &phy_data);
+       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_CTRL, &phy_data);
        if (ret_val)
                goto out;
 
        phy->polarity_correction = (phy_data & M88E1000_PSCR_POLARITY_REVERSAL)
-                                  ? true
-                                  : false;
+                                  ? true : false;
 
        ret_val = igb_check_polarity_m88(hw);
        if (ret_val)
                goto out;
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, M88E1000_PHY_SPEC_STATUS,
-                                          &phy_data);
+       ret_val = phy->ops.read_reg(hw, M88E1000_PHY_SPEC_STATUS, &phy_data);
        if (ret_val)
                goto out;
 
        phy->is_mdix = (phy_data & M88E1000_PSSR_MDIX) ? true : false;
 
        if ((phy_data & M88E1000_PSSR_SPEED) == M88E1000_PSSR_1000MBS) {
-               ret_val = hw->phy.ops.get_cable_length(hw);
+               ret_val = phy->ops.get_cable_length(hw);
                if (ret_val)
                        goto out;
 
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_1000T_STATUS,
-                                                  &phy_data);
+               ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &phy_data);
                if (ret_val)
                        goto out;
 
@@ -1552,8 +1520,7 @@ s32 igb_get_phy_info_igp(struct e1000_hw *hw)
        if (ret_val)
                goto out;
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, IGP01E1000_PHY_PORT_STATUS,
-                                          &data);
+       ret_val = phy->ops.read_reg(hw, IGP01E1000_PHY_PORT_STATUS, &data);
        if (ret_val)
                goto out;
 
@@ -1561,12 +1528,11 @@ s32 igb_get_phy_info_igp(struct e1000_hw *hw)
 
        if ((data & IGP01E1000_PSSR_SPEED_MASK) ==
            IGP01E1000_PSSR_SPEED_1000MBPS) {
-               ret_val = hw->phy.ops.get_cable_length(hw);
+               ret_val = phy->ops.get_cable_length(hw);
                if (ret_val)
                        goto out;
 
-               ret_val = hw->phy.ops.read_phy_reg(hw, PHY_1000T_STATUS,
-                                                  &data);
+               ret_val = phy->ops.read_reg(hw, PHY_1000T_STATUS, &data);
                if (ret_val)
                        goto out;
 
@@ -1599,12 +1565,12 @@ s32 igb_phy_sw_reset(struct e1000_hw *hw)
        s32 ret_val;
        u16 phy_ctrl;
 
-       ret_val = hw->phy.ops.read_phy_reg(hw, PHY_CONTROL, &phy_ctrl);
+       ret_val = hw->phy.ops.read_reg(hw, PHY_CONTROL, &phy_ctrl);
        if (ret_val)
                goto out;
 
        phy_ctrl |= MII_CR_RESET;
-       ret_val = hw->phy.ops.write_phy_reg(hw, PHY_CONTROL, phy_ctrl);
+       ret_val = hw->phy.ops.write_reg(hw, PHY_CONTROL, phy_ctrl);
        if (ret_val)
                goto out;
 
@@ -1635,7 +1601,7 @@ s32 igb_phy_hw_reset(struct e1000_hw *hw)
                goto out;
        }
 
-       ret_val = igb_acquire_phy(hw);
+       ret_val = phy->ops.acquire(hw);
        if (ret_val)
                goto out;
 
@@ -1650,74 +1616,14 @@ s32 igb_phy_hw_reset(struct e1000_hw *hw)
 
        udelay(150);
 
-       igb_release_phy(hw);
+       phy->ops.release(hw);
 
-       ret_val = igb_get_phy_cfg_done(hw);
+       ret_val = phy->ops.get_cfg_done(hw);
 
 out:
        return ret_val;
 }
 
-/* Internal function pointers */
-
-/**
- *  igb_get_phy_cfg_done - Generic PHY configuration done
- *  @hw: pointer to the HW structure
- *
- *  Return success if silicon family did not implement a family specific
- *  get_cfg_done function.
- **/
-static s32 igb_get_phy_cfg_done(struct e1000_hw *hw)
-{
-       if (hw->phy.ops.get_cfg_done)
-               return hw->phy.ops.get_cfg_done(hw);
-
-       return 0;
-}
-
-/**
- *  igb_release_phy - Generic release PHY
- *  @hw: pointer to the HW structure
- *
- *  Return if silicon family does not require a semaphore when accessing the
- *  PHY.
- **/
-static void igb_release_phy(struct e1000_hw *hw)
-{
-       if (hw->phy.ops.release_phy)
-               hw->phy.ops.release_phy(hw);
-}
-
-/**
- *  igb_acquire_phy - Generic acquire PHY
- *  @hw: pointer to the HW structure
- *
- *  Return success if silicon family does not require a semaphore when
- *  accessing the PHY.
- **/
-static s32 igb_acquire_phy(struct e1000_hw *hw)
-{
-       if (hw->phy.ops.acquire_phy)
-               return hw->phy.ops.acquire_phy(hw);
-
-       return 0;
-}
-
-/**
- *  igb_phy_force_speed_duplex - Generic force PHY speed/duplex
- *  @hw: pointer to the HW structure
- *
- *  When the silicon family has not implemented a forced speed/duplex
- *  function for the PHY, simply return 0.
- **/
-s32 igb_phy_force_speed_duplex(struct e1000_hw *hw)
-{
-       if (hw->phy.ops.force_speed_duplex)
-               return hw->phy.ops.force_speed_duplex(hw);
-
-       return 0;
-}
-
 /**
  *  igb_phy_init_script_igp3 - Inits the IGP3 PHY
  *  @hw: pointer to the HW structure
@@ -1730,75 +1636,75 @@ s32 igb_phy_init_script_igp3(struct e1000_hw *hw)
 
        /* PHY init IGP 3 */
        /* Enable rise/fall, 10-mode work in class-A */
-       hw->phy.ops.write_phy_reg(hw, 0x2F5B, 0x9018);
+       hw->phy.ops.write_reg(hw, 0x2F5B, 0x9018);
        /* Remove all caps from Replica path filter */
-       hw->phy.ops.write_phy_reg(hw, 0x2F52, 0x0000);
+       hw->phy.ops.write_reg(hw, 0x2F52, 0x0000);
        /* Bias trimming for ADC, AFE and Driver (Default) */
-       hw->phy.ops.write_phy_reg(hw, 0x2FB1, 0x8B24);
+       hw->phy.ops.write_reg(hw, 0x2FB1, 0x8B24);
        /* Increase Hybrid poly bias */
-       hw->phy.ops.write_phy_reg(hw, 0x2FB2, 0xF8F0);
+       hw->phy.ops.write_reg(hw, 0x2FB2, 0xF8F0);
        /* Add 4% to TX amplitude in Giga mode */
-       hw->phy.ops.write_phy_reg(hw, 0x2010, 0x10B0);
+       hw->phy.ops.write_reg(hw, 0x2010, 0x10B0);
        /* Disable trimming (TTT) */
-       hw->phy.ops.write_phy_reg(hw, 0x2011, 0x0000);
+       hw->phy.ops.write_reg(hw, 0x2011, 0x0000);
        /* Poly DC correction to 94.6% + 2% for all channels */
-       hw->phy.ops.write_phy_reg(hw, 0x20DD, 0x249A);
+       hw->phy.ops.write_reg(hw, 0x20DD, 0x249A);
        /* ABS DC correction to 95.9% */
-       hw->phy.ops.write_phy_reg(hw, 0x20DE, 0x00D3);
+       hw->phy.ops.write_reg(hw, 0x20DE, 0x00D3);
        /* BG temp curve trim */
-       hw->phy.ops.write_phy_reg(hw, 0x28B4, 0x04CE);
+       hw->phy.ops.write_reg(hw, 0x28B4, 0x04CE);
        /* Increasing ADC OPAMP stage 1 currents to max */
-       hw->phy.ops.write_phy_reg(hw, 0x2F70, 0x29E4);
+       hw->phy.ops.write_reg(hw, 0x2F70, 0x29E4);
        /* Force 1000 ( required for enabling PHY regs configuration) */
-       hw->phy.ops.write_phy_reg(hw, 0x0000, 0x0140);
+       hw->phy.ops.write_reg(hw, 0x0000, 0x0140);
        /* Set upd_freq to 6 */
-       hw->phy.ops.write_phy_reg(hw, 0x1F30, 0x1606);
+       hw->phy.ops.write_reg(hw, 0x1F30, 0x1606);
        /* Disable NPDFE */
-       hw->phy.ops.write_phy_reg(hw, 0x1F31, 0xB814);
+       hw->phy.ops.write_reg(hw, 0x1F31, 0xB814);
        /* Disable adaptive fixed FFE (Default) */
-       hw->phy.ops.write_phy_reg(hw, 0x1F35, 0x002A);
+       hw->phy.ops.write_reg(hw, 0x1F35, 0x002A);
        /* Enable FFE hysteresis */
-       hw->phy.ops.write_phy_reg(hw, 0x1F3E, 0x0067);
+       hw->phy.ops.write_reg(hw, 0x1F3E, 0x0067);
        /* Fixed FFE for short cable lengths */
-       hw->phy.ops.write_phy_reg(hw, 0x1F54, 0x0065);
+       hw->phy.ops.write_reg(hw, 0x1F54, 0x0065);
        /* Fixed FFE for medium cable lengths */
-       hw->phy.ops.write_phy_reg(hw, 0x1F55, 0x002A);
+       hw->phy.ops.write_reg(hw, 0x1F55, 0x002A);
        /* Fixed FFE for long cable lengths */
-       hw->phy.ops.write_phy_reg(hw, 0x1F56, 0x002A);
+       hw->phy.ops.write_reg(hw, 0x1F56, 0x002A);
        /* Enable Adaptive Clip Threshold */
-       hw->phy.ops.write_phy_reg(hw, 0x1F72, 0x3FB0);
+       hw->phy.ops.write_reg(hw, 0x1F72, 0x3FB0);
        /* AHT reset limit to 1 */
-       hw->phy.ops.write_phy_reg(hw, 0x1F76, 0xC0FF);
+       hw->phy.ops.write_reg(hw, 0x1F76, 0xC0FF);
        /* Set AHT master delay to 127 msec */
-       hw->phy.ops.write_phy_reg(hw, 0x1F77, 0x1DEC);
+       hw->phy.ops.write_reg(hw, 0x1F77, 0x1DEC);
        /* Set scan bits for AHT */
-       hw->phy.ops.write_phy_reg(hw, 0x1F78, 0xF9EF);
+       hw->phy.ops.write_reg(hw, 0x1F78, 0xF9EF);
        /* Set AHT Preset bits */
-       hw->phy.ops.write_phy_reg(hw, 0x1F79, 0x0210);
+       hw->phy.ops.write_reg(hw, 0x1F79, 0x0210);
        /* Change integ_factor of channel A to 3 */
-       hw->phy.ops.write_phy_reg(hw, 0x1895, 0x0003);
+       hw->phy.ops.write_reg(hw, 0x1895, 0x0003);
        /* Change prop_factor of channels BCD to 8 */
-       hw->phy.ops.write_phy_reg(hw, 0x1796, 0x0008);
+       hw->phy.ops.write_reg(hw, 0x1796, 0x0008);
        /* Change cg_icount + enable integbp for channels BCD */
-       hw->phy.ops.write_phy_reg(hw, 0x1798, 0xD008);
+       hw->phy.ops.write_reg(hw, 0x1798, 0xD008);
        /*
         * Change cg_icount + enable integbp + change prop_factor_master
         * to 8 for channel A
         */
-       hw->phy.ops.write_phy_reg(hw, 0x1898, 0xD918);
+       hw->phy.ops.write_reg(hw, 0x1898, 0xD918);
        /* Disable AHT in Slave mode on channel A */
-       hw->phy.ops.write_phy_reg(hw, 0x187A, 0x0800);
+       hw->phy.ops.write_reg(hw, 0x187A, 0x0800);
        /*
         * Enable LPLU and disable AN to 1000 in non-D0a states,
         * Enable SPD+B2B
         */
-       hw->phy.ops.write_phy_reg(hw, 0x0019, 0x008D);
+       hw->phy.ops.write_reg(hw, 0x0019, 0x008D);
        /* Enable restart AN on an1000_dis change */
-       hw->phy.ops.write_phy_reg(hw, 0x001B, 0x2080);
+       hw->phy.ops.write_reg(hw, 0x001B, 0x2080);
        /* Enable wh_fifo read clock in 10/100 modes */
-       hw->phy.ops.write_phy_reg(hw, 0x0014, 0x0045);
+       hw->phy.ops.write_reg(hw, 0x0014, 0x0045);
        /* Restart AN, Speed selection is 1000 */
-       hw->phy.ops.write_phy_reg(hw, 0x0000, 0x1340);
+       hw->phy.ops.write_reg(hw, 0x0000, 0x1340);
 
        return 0;
 }
index 8f8fe0a780d107dcf8141e57daf605df905cd5a4..3228a862031f87a231d992458def9c93d1e0d54f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -44,7 +44,6 @@ enum e1000_smart_speed {
 s32  igb_check_downshift(struct e1000_hw *hw);
 s32  igb_check_reset_block(struct e1000_hw *hw);
 s32  igb_copper_link_autoneg(struct e1000_hw *hw);
-s32  igb_phy_force_speed_duplex(struct e1000_hw *hw);
 s32  igb_copper_link_setup_igp(struct e1000_hw *hw);
 s32  igb_copper_link_setup_m88(struct e1000_hw *hw);
 s32  igb_phy_force_speed_duplex_igp(struct e1000_hw *hw);
index bdf5d839c4bf96452b76f7eed848bfe0841484c2..0bd7728fe469bd58c40c91385f609c8a061d3925 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
 #define E1000_TCPTIMER 0x0104C  /* TCP Timer - RW */
 #define E1000_FCRTL    0x02160  /* Flow Control Receive Threshold Low - RW */
 #define E1000_FCRTH    0x02168  /* Flow Control Receive Threshold High - RW */
-#define E1000_RDFPCQ(_n)  (0x02430 + (0x4 * (_n)))
 #define E1000_FCRTV    0x02460  /* Flow Control Refresh Timer Value - RW */
+
+/* IEEE 1588 TIMESYNCH */
+#define E1000_TSYNCTXCTL 0x0B614
+#define E1000_TSYNCTXCTL_VALID (1<<0)
+#define E1000_TSYNCTXCTL_ENABLED (1<<4)
+#define E1000_TSYNCRXCTL 0x0B620
+#define E1000_TSYNCRXCTL_VALID (1<<0)
+#define E1000_TSYNCRXCTL_ENABLED (1<<4)
+enum {
+       E1000_TSYNCRXCTL_TYPE_L2_V2 = 0,
+       E1000_TSYNCRXCTL_TYPE_L4_V1 = (1<<1),
+       E1000_TSYNCRXCTL_TYPE_L2_L4_V2 = (1<<2),
+       E1000_TSYNCRXCTL_TYPE_ALL = (1<<3),
+       E1000_TSYNCRXCTL_TYPE_EVENT_V2 = (1<<3) | (1<<1),
+};
+#define E1000_TSYNCRXCFG 0x05F50
+enum {
+       E1000_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE = 0<<0,
+       E1000_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE = 1<<0,
+       E1000_TSYNCRXCFG_PTP_V1_FOLLOWUP_MESSAGE = 2<<0,
+       E1000_TSYNCRXCFG_PTP_V1_DELAY_RESP_MESSAGE = 3<<0,
+       E1000_TSYNCRXCFG_PTP_V1_MANAGEMENT_MESSAGE = 4<<0,
+
+       E1000_TSYNCRXCFG_PTP_V2_SYNC_MESSAGE = 0<<8,
+       E1000_TSYNCRXCFG_PTP_V2_DELAY_REQ_MESSAGE = 1<<8,
+       E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_REQ_MESSAGE = 2<<8,
+       E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_RESP_MESSAGE = 3<<8,
+       E1000_TSYNCRXCFG_PTP_V2_FOLLOWUP_MESSAGE = 8<<8,
+       E1000_TSYNCRXCFG_PTP_V2_DELAY_RESP_MESSAGE = 9<<8,
+       E1000_TSYNCRXCFG_PTP_V2_PATH_DELAY_FOLLOWUP_MESSAGE = 0xA<<8,
+       E1000_TSYNCRXCFG_PTP_V2_ANNOUNCE_MESSAGE = 0xB<<8,
+       E1000_TSYNCRXCFG_PTP_V2_SIGNALLING_MESSAGE = 0xC<<8,
+       E1000_TSYNCRXCFG_PTP_V2_MANAGEMENT_MESSAGE = 0xD<<8,
+};
+#define E1000_SYSTIML 0x0B600
+#define E1000_SYSTIMH 0x0B604
+#define E1000_TIMINCA 0x0B608
+
+#define E1000_RXMTRL     0x0B634
+#define E1000_RXSTMPL 0x0B624
+#define E1000_RXSTMPH 0x0B628
+#define E1000_RXSATRL 0x0B62C
+#define E1000_RXSATRH 0x0B630
+
+#define E1000_TXSTMPL 0x0B618
+#define E1000_TXSTMPH 0x0B61C
+
+#define E1000_ETQF0   0x05CB0
+#define E1000_ETQF1   0x05CB4
+#define E1000_ETQF2   0x05CB8
+#define E1000_ETQF3   0x05CBC
+#define E1000_ETQF4   0x05CC0
+#define E1000_ETQF5   0x05CC4
+#define E1000_ETQF6   0x05CC8
+#define E1000_ETQF7   0x05CCC
+
+/* Filtering Registers */
+#define E1000_SAQF(_n) (0x5980 + 4 * (_n))
+#define E1000_DAQF(_n) (0x59A0 + 4 * (_n))
+#define E1000_SPQF(_n) (0x59C0 + 4 * (_n))
+#define E1000_FTQF(_n) (0x59E0 + 4 * (_n))
+#define E1000_SAQF0 E1000_SAQF(0)
+#define E1000_DAQF0 E1000_DAQF(0)
+#define E1000_SPQF0 E1000_SPQF(0)
+#define E1000_FTQF0 E1000_FTQF(0)
+#define E1000_SYNQF(_n) (0x055FC + (4 * (_n))) /* SYN Packet Queue Fltr */
+#define E1000_ETQF(_n)  (0x05CB0 + (4 * (_n))) /* EType Queue Fltr */
+
 /* Split and Replication RX Control - RW */
 /*
  * Convenience macros
                                    : (0x0E018 + ((_n) * 0x40)))
 #define E1000_TXDCTL(_n)  ((_n) < 4 ? (0x03828 + ((_n) * 0x100)) \
                                    : (0x0E028 + ((_n) * 0x40)))
-#define E1000_TARC(_n)    (0x03840 + (_n << 8))
 #define E1000_DCA_TXCTRL(_n) (0x03814 + (_n << 8))
 #define E1000_DCA_RXCTRL(_n) (0x02814 + (_n << 8))
 #define E1000_TDWBAL(_n)  ((_n) < 4 ? (0x03838 + ((_n) * 0x100)) \
 #define E1000_RAH(_i)  (((_i) <= 15) ? (0x05404 + ((_i) * 8)) : \
                                        (0x054E4 + ((_i - 16) * 8)))
 #define E1000_VFTA     0x05600  /* VLAN Filter Table Array - RW Array */
-#define E1000_VMD_CTL  0x0581C  /* VMDq Control - RW */
+#define E1000_VT_CTL   0x0581C  /* VMDq Control - RW */
 #define E1000_WUC      0x05800  /* Wakeup Control - RW */
 #define E1000_WUFC     0x05808  /* Wakeup Filter Control - RW */
 #define E1000_WUS      0x05810  /* Wakeup Status - RO */
 #define E1000_MANC     0x05820  /* Management Control - RW */
 #define E1000_IPAV     0x05838  /* IP Address Valid - RW */
 #define E1000_WUPL     0x05900  /* Wakeup Packet Length - RW */
-#define E1000_HOST_IF  0x08800  /* Host Interface */
 
-#define E1000_MANC2H      0x05860 /* Management Control To Host - RW */
 #define E1000_SW_FW_SYNC  0x05B5C /* Software-Firmware Synchronization - RW */
 #define E1000_CCMCTL      0x05B48 /* CCM Control Register */
 #define E1000_GIOCTL      0x05B44 /* GIO Analog Control Register */
 #define E1000_FACTPS    0x05B30 /* Function Active and Power State to MNG */
 #define E1000_SWSM      0x05B50 /* SW Semaphore */
 #define E1000_FWSM      0x05B54 /* FW Semaphore */
-#define E1000_DCA_ID    0x05B70 /* DCA Requester ID Information - RO */
 #define E1000_DCA_CTRL  0x05B74 /* DCA Control - RW */
-#define E1000_HICR      0x08F00 /* Host Inteface Control */
 
 /* RSS registers */
 #define E1000_MRQC      0x05818 /* Multiple Receive Control - RW */
 #define E1000_IMIRVP    0x05AC0 /* Immediate Interrupt RX VLAN Priority - RW */
 /* MSI-X Allocation Register (_i) - RW */
 #define E1000_MSIXBM(_i)    (0x01600 + ((_i) * 4))
-/* MSI-X Table entry addr low reg 0 - RW */
-#define E1000_MSIXTADD(_i)  (0x0C000 + ((_i) * 0x10))
-/* MSI-X Table entry addr upper reg 0 - RW */
-#define E1000_MSIXTUADD(_i) (0x0C004 + ((_i) * 0x10))
-/* MSI-X Table entry message reg 0 - RW */
-#define E1000_MSIXTMSG(_i)  (0x0C008 + ((_i) * 0x10))
-/* MSI-X Table entry vector ctrl reg 0 - RW */
-#define E1000_MSIXVCTRL(_i) (0x0C00C + ((_i) * 0x10))
 /* Redirection Table - RW Array */
 #define E1000_RETA(_i)  (0x05C00 + ((_i) * 4))
 #define E1000_RSSRK(_i) (0x05C80 + ((_i) * 4)) /* RSS Random Key - RW Array */
 
+/* VT Registers */
+#define E1000_MBVFICR   0x00C80 /* Mailbox VF Cause - RWC */
+#define E1000_MBVFIMR   0x00C84 /* Mailbox VF int Mask - RW */
+#define E1000_VFLRE     0x00C88 /* VF Register Events - RWC */
+#define E1000_VFRE      0x00C8C /* VF Receive Enables */
+#define E1000_VFTE      0x00C90 /* VF Transmit Enables */
+#define E1000_QDE       0x02408 /* Queue Drop Enable - RW */
+#define E1000_DTXSWC    0x03500 /* DMA Tx Switch Control - RW */
+#define E1000_RPLOLR    0x05AF0 /* Replication Offload - RW */
+#define E1000_IOVTCL    0x05BBC /* IOV Control Register */
+/* These act per VF so an array friendly macro is used */
+#define E1000_P2VMAILBOX(_n)   (0x00C00 + (4 * (_n)))
+#define E1000_VMBMEM(_n)       (0x00800 + (64 * (_n)))
+#define E1000_VMOLR(_n)        (0x05AD0 + (4 * (_n)))
+#define E1000_VLVF(_n)         (0x05D00 + (4 * (_n))) /* VLAN Virtual Machine
+                                                       * Filter - RW */
+
 #define wr32(reg, value) (writel(value, hw->hw_addr + reg))
 #define rd32(reg) (readl(hw->hw_addr + reg))
 #define wrfl() ((void)rd32(E1000_STATUS))
index aebef8e48e76ebd80d6cd22e7fd5468f7bf6e181..e18ac1bf45ff9dc687a26c9315dfdabb5eda920f 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
 #include "e1000_mac.h"
 #include "e1000_82575.h"
 
-struct igb_adapter;
-
-#ifdef CONFIG_IGB_LRO
-#include <linux/inet_lro.h>
-#define MAX_LRO_AGGR                      32
-#define MAX_LRO_DESCRIPTORS                8
-#endif
+#include <linux/clocksource.h>
+#include <linux/timecompare.h>
+#include <linux/net_tstamp.h>
 
-/* Interrupt defines */
-#define IGB_MIN_DYN_ITR 3000
-#define IGB_MAX_DYN_ITR 96000
+struct igb_adapter;
 
 /* ((1000000000ns / (6000ints/s * 1024ns)) << 2 = 648 */
 #define IGB_START_ITR 648
 
-#define IGB_DYN_ITR_PACKET_THRESHOLD 2
-#define IGB_DYN_ITR_LENGTH_LOW 200
-#define IGB_DYN_ITR_LENGTH_HIGH 1000
-
 /* TX/RX descriptor defines */
 #define IGB_DEFAULT_TXD                  256
 #define IGB_MIN_TXD                       80
@@ -67,8 +57,21 @@ struct igb_adapter;
 #define IGB_MIN_ITR_USECS                 10
 
 /* Transmit and receive queues */
-#define IGB_MAX_RX_QUEUES                  4
-#define IGB_MAX_TX_QUEUES                  4
+#define IGB_MAX_RX_QUEUES     (adapter->vfs_allocated_count ? \
+                               (adapter->vfs_allocated_count > 6 ? 1 : 2) : 4)
+#define IGB_MAX_TX_QUEUES     IGB_MAX_RX_QUEUES
+#define IGB_ABS_MAX_TX_QUEUES     4
+
+#define IGB_MAX_VF_MC_ENTRIES              30
+#define IGB_MAX_VF_FUNCTIONS               8
+#define IGB_MAX_VFTA_ENTRIES               128
+
+struct vf_data_storage {
+       unsigned char vf_mac_addresses[ETH_ALEN];
+       u16 vf_mc_hashes[IGB_MAX_VF_MC_ENTRIES];
+       u16 num_vf_mc_hashes;
+       bool clear_to_send;
+};
 
 /* RX descriptor control thresholds.
  * PTHRESH - MAC will consider prefetch if it has fewer than this number of
@@ -94,12 +97,9 @@ struct igb_adapter;
 #define IGB_RXBUFFER_512   512
 #define IGB_RXBUFFER_1024  1024
 #define IGB_RXBUFFER_2048  2048
-#define IGB_RXBUFFER_4096  4096
-#define IGB_RXBUFFER_8192  8192
 #define IGB_RXBUFFER_16384 16384
 
-/* Packet Buffer allocations */
-
+#define MAX_STD_JUMBO_FRAME_SIZE 9234
 
 /* How many Tx Descriptors do we need to call netif_wake_queue ? */
 #define IGB_TX_QUEUE_WAKE      16
@@ -176,10 +176,6 @@ struct igb_ring {
                        struct napi_struct napi;
                        int set_itr;
                        struct igb_ring *buddy;
-#ifdef CONFIG_IGB_LRO
-                       struct net_lro_mgr lro_mgr;
-                       bool lro_used;
-#endif
                };
        };
 
@@ -196,9 +192,6 @@ struct igb_ring {
        (&(((union e1000_adv_tx_desc *)((R).desc))[i]))
 #define E1000_TX_CTXTDESC_ADV(R, i)        \
        (&(((struct e1000_adv_tx_context_desc *)((R).desc))[i]))
-#define E1000_GET_DESC(R, i, type)     (&(((struct type *)((R).desc))[i]))
-#define E1000_TX_DESC(R, i)            E1000_GET_DESC(R, i, e1000_tx_desc)
-#define E1000_RX_DESC(R, i)            E1000_GET_DESC(R, i, e1000_rx_desc)
 
 /* board specific private data structure */
 
@@ -248,7 +241,6 @@ struct igb_adapter {
 
        u64 hw_csum_err;
        u64 hw_csum_good;
-       u64 rx_hdr_split;
        u32 alloc_rx_buff_failed;
        bool rx_csum;
        u32 gorc;
@@ -262,6 +254,10 @@ struct igb_adapter {
        struct napi_struct napi;
        struct pci_dev *pdev;
        struct net_device_stats net_stats;
+       struct cyclecounter cycles;
+       struct timecounter clock;
+       struct timecompare compare;
+       struct hwtstamp_config hwtstamp_config;
 
        /* structs defined in e1000_hw.h */
        struct e1000_hw hw;
@@ -283,27 +279,17 @@ struct igb_adapter {
        unsigned int flags;
        u32 eeprom_wol;
 
-       /* for ioport free */
-       int bars;
-       int need_ioport;
-
-       struct igb_ring *multi_tx_table[IGB_MAX_TX_QUEUES];
-#ifdef CONFIG_IGB_LRO
-       unsigned int lro_max_aggr;
-       unsigned int lro_aggregated;
-       unsigned int lro_flushed;
-       unsigned int lro_no_desc;
-#endif
+       struct igb_ring *multi_tx_table[IGB_ABS_MAX_TX_QUEUES];
        unsigned int tx_ring_count;
        unsigned int rx_ring_count;
+       unsigned int vfs_allocated_count;
+       struct vf_data_storage *vf_data;
 };
 
 #define IGB_FLAG_HAS_MSI           (1 << 0)
-#define IGB_FLAG_MSI_ENABLE        (1 << 1)
-#define IGB_FLAG_DCA_ENABLED       (1 << 2)
-#define IGB_FLAG_IN_NETPOLL        (1 << 3)
-#define IGB_FLAG_QUAD_PORT_A       (1 << 4)
-#define IGB_FLAG_NEED_CTX_IDX      (1 << 5)
+#define IGB_FLAG_DCA_ENABLED       (1 << 1)
+#define IGB_FLAG_QUAD_PORT_A       (1 << 2)
+#define IGB_FLAG_NEED_CTX_IDX      (1 << 3)
 
 enum e1000_state_t {
        __IGB_TESTING,
@@ -333,24 +319,24 @@ extern void igb_set_ethtool_ops(struct net_device *);
 
 static inline s32 igb_reset_phy(struct e1000_hw *hw)
 {
-       if (hw->phy.ops.reset_phy)
-               return hw->phy.ops.reset_phy(hw);
+       if (hw->phy.ops.reset)
+               return hw->phy.ops.reset(hw);
 
        return 0;
 }
 
 static inline s32 igb_read_phy_reg(struct e1000_hw *hw, u32 offset, u16 *data)
 {
-       if (hw->phy.ops.read_phy_reg)
-               return hw->phy.ops.read_phy_reg(hw, offset, data);
+       if (hw->phy.ops.read_reg)
+               return hw->phy.ops.read_reg(hw, offset, data);
 
        return 0;
 }
 
 static inline s32 igb_write_phy_reg(struct e1000_hw *hw, u32 offset, u16 data)
 {
-       if (hw->phy.ops.write_phy_reg)
-               return hw->phy.ops.write_phy_reg(hw, offset, data);
+       if (hw->phy.ops.write_reg)
+               return hw->phy.ops.write_reg(hw, offset, data);
 
        return 0;
 }
index 3c831f1472adcbb6608f258e33900c8d6e91088a..34a8a0fadf2dcd8de36c8df4f3d556ede79dd391 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -88,16 +88,11 @@ static const struct igb_stats igb_gstrings_stats[] = {
        { "rx_long_byte_count", IGB_STAT(stats.gorc) },
        { "rx_csum_offload_good", IGB_STAT(hw_csum_good) },
        { "rx_csum_offload_errors", IGB_STAT(hw_csum_err) },
-       { "rx_header_split", IGB_STAT(rx_hdr_split) },
+       { "tx_dma_out_of_sync", IGB_STAT(stats.doosync) },
        { "alloc_rx_buff_failed", IGB_STAT(alloc_rx_buff_failed) },
        { "tx_smbus", IGB_STAT(stats.mgptc) },
        { "rx_smbus", IGB_STAT(stats.mgprc) },
        { "dropped_smbus", IGB_STAT(stats.mgpdc) },
-#ifdef CONFIG_IGB_LRO
-       { "lro_aggregated", IGB_STAT(lro_aggregated) },
-       { "lro_flushed", IGB_STAT(lro_flushed) },
-       { "lro_no_desc", IGB_STAT(lro_no_desc) },
-#endif
 };
 
 #define IGB_QUEUE_STATS_LEN \
@@ -293,15 +288,15 @@ static int igb_set_rx_csum(struct net_device *netdev, u32 data)
 
 static u32 igb_get_tx_csum(struct net_device *netdev)
 {
-       return (netdev->features & NETIF_F_HW_CSUM) != 0;
+       return (netdev->features & NETIF_F_IP_CSUM) != 0;
 }
 
 static int igb_set_tx_csum(struct net_device *netdev, u32 data)
 {
        if (data)
-               netdev->features |= NETIF_F_HW_CSUM;
+               netdev->features |= (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
        else
-               netdev->features &= ~NETIF_F_HW_CSUM;
+               netdev->features &= ~(NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM);
 
        return 0;
 }
@@ -310,15 +305,13 @@ static int igb_set_tso(struct net_device *netdev, u32 data)
 {
        struct igb_adapter *adapter = netdev_priv(netdev);
 
-       if (data)
+       if (data) {
                netdev->features |= NETIF_F_TSO;
-       else
-               netdev->features &= ~NETIF_F_TSO;
-
-       if (data)
                netdev->features |= NETIF_F_TSO6;
-       else
+       } else {
+               netdev->features &= ~NETIF_F_TSO;
                netdev->features &= ~NETIF_F_TSO6;
+       }
 
        dev_info(&adapter->pdev->dev, "TSO is %s\n",
                 data ? "Enabled" : "Disabled");
@@ -405,7 +398,7 @@ static void igb_get_regs(struct net_device *netdev,
        regs_buff[34] = rd32(E1000_RLPML);
        regs_buff[35] = rd32(E1000_RFCTL);
        regs_buff[36] = rd32(E1000_MRQC);
-       regs_buff[37] = rd32(E1000_VMD_CTL);
+       regs_buff[37] = rd32(E1000_VT_CTL);
 
        /* Transmit */
        regs_buff[38] = rd32(E1000_TCTL);
@@ -598,12 +591,12 @@ static int igb_get_eeprom(struct net_device *netdev,
                return -ENOMEM;
 
        if (hw->nvm.type == e1000_nvm_eeprom_spi)
-               ret_val = hw->nvm.ops.read_nvm(hw, first_word,
+               ret_val = hw->nvm.ops.read(hw, first_word,
                                            last_word - first_word + 1,
                                            eeprom_buff);
        else {
                for (i = 0; i < last_word - first_word + 1; i++) {
-                       ret_val = hw->nvm.ops.read_nvm(hw, first_word + i, 1,
+                       ret_val = hw->nvm.ops.read(hw, first_word + i, 1,
                                                    &eeprom_buff[i]);
                        if (ret_val)
                                break;
@@ -650,14 +643,14 @@ static int igb_set_eeprom(struct net_device *netdev,
        if (eeprom->offset & 1) {
                /* need read/modify/write of first changed EEPROM word */
                /* only the second byte of the word is being modified */
-               ret_val = hw->nvm.ops.read_nvm(hw, first_word, 1,
+               ret_val = hw->nvm.ops.read(hw, first_word, 1,
                                            &eeprom_buff[0]);
                ptr++;
        }
        if (((eeprom->offset + eeprom->len) & 1) && (ret_val == 0)) {
                /* need read/modify/write of last changed EEPROM word */
                /* only the first byte of the word is being modified */
-               ret_val = hw->nvm.ops.read_nvm(hw, last_word, 1,
+               ret_val = hw->nvm.ops.read(hw, last_word, 1,
                                   &eeprom_buff[last_word - first_word]);
        }
 
@@ -670,7 +663,7 @@ static int igb_set_eeprom(struct net_device *netdev,
        for (i = 0; i < last_word - first_word + 1; i++)
                eeprom_buff[i] = cpu_to_le16(eeprom_buff[i]);
 
-       ret_val = hw->nvm.ops.write_nvm(hw, first_word,
+       ret_val = hw->nvm.ops.write(hw, first_word,
                                     last_word - first_word + 1, eeprom_buff);
 
        /* Update the checksum over the first part of the EEPROM if needed
@@ -694,7 +687,7 @@ static void igb_get_drvinfo(struct net_device *netdev,
 
        /* EEPROM image version # is reported as firmware version # for
         * 82575 controllers */
-       adapter->hw.nvm.ops.read_nvm(&adapter->hw, 5, 1, &eeprom_data);
+       adapter->hw.nvm.ops.read(&adapter->hw, 5, 1, &eeprom_data);
        sprintf(firmware_version, "%d.%d-%d",
                (eeprom_data & 0xF000) >> 12,
                (eeprom_data & 0x0FF0) >> 4,
@@ -863,23 +856,26 @@ static struct igb_reg_test reg_test_82576[] = {
        { E1000_RDBAL(0),  0x100, 4, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
        { E1000_RDBAH(0),  0x100, 4, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
        { E1000_RDLEN(0),  0x100, 4, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
-       { E1000_RDBAL(4),  0x40,  8, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
-       { E1000_RDBAH(4),  0x40,  8, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
-       { E1000_RDLEN(4),  0x40,  8, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
-       /* Enable all four RX queues before testing. */
-       { E1000_RXDCTL(0), 0x100, 1,  WRITE_NO_TEST, 0, E1000_RXDCTL_QUEUE_ENABLE },
+       { E1000_RDBAL(4),  0x40, 12, PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
+       { E1000_RDBAH(4),  0x40, 12, PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
+       { E1000_RDLEN(4),  0x40, 12, PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
+       /* Enable all RX queues before testing. */
+       { E1000_RXDCTL(0), 0x100, 4,  WRITE_NO_TEST, 0, E1000_RXDCTL_QUEUE_ENABLE },
+       { E1000_RXDCTL(4), 0x40, 12,  WRITE_NO_TEST, 0, E1000_RXDCTL_QUEUE_ENABLE },
        /* RDH is read-only for 82576, only test RDT. */
        { E1000_RDT(0),    0x100, 4,  PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
+       { E1000_RDT(4),    0x40, 12,  PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
        { E1000_RXDCTL(0), 0x100, 4,  WRITE_NO_TEST, 0, 0 },
+       { E1000_RXDCTL(4), 0x40, 12,  WRITE_NO_TEST, 0, 0 },
        { E1000_FCRTH,     0x100, 1,  PATTERN_TEST, 0x0000FFF0, 0x0000FFF0 },
        { E1000_FCTTV,     0x100, 1,  PATTERN_TEST, 0x0000FFFF, 0x0000FFFF },
        { E1000_TIPG,      0x100, 1,  PATTERN_TEST, 0x3FFFFFFF, 0x3FFFFFFF },
        { E1000_TDBAL(0),  0x100, 4,  PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
        { E1000_TDBAH(0),  0x100, 4,  PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
        { E1000_TDLEN(0),  0x100, 4,  PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
-       { E1000_TDBAL(4),  0x40, 8,  PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
-       { E1000_TDBAH(4),  0x40, 8,  PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
-       { E1000_TDLEN(4),  0x40, 8,  PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
+       { E1000_TDBAL(4),  0x40, 12,  PATTERN_TEST, 0xFFFFFF80, 0xFFFFFFFF },
+       { E1000_TDBAH(4),  0x40, 12,  PATTERN_TEST, 0xFFFFFFFF, 0xFFFFFFFF },
+       { E1000_TDLEN(4),  0x40, 12,  PATTERN_TEST, 0x000FFFF0, 0x000FFFFF },
        { E1000_RCTL,      0x100, 1,  SET_READ_TEST, 0xFFFFFFFF, 0x00000000 },
        { E1000_RCTL,      0x100, 1,  SET_READ_TEST, 0x04CFB0FE, 0x003FFFFB },
        { E1000_RCTL,      0x100, 1,  SET_READ_TEST, 0x04CFB0FE, 0xFFFFFFFF },
@@ -926,12 +922,13 @@ static struct igb_reg_test reg_test_82575[] = {
 static bool reg_pattern_test(struct igb_adapter *adapter, u64 *data,
                             int reg, u32 mask, u32 write)
 {
+       struct e1000_hw *hw = &adapter->hw;
        u32 pat, val;
        u32 _test[] =
                {0x5A5A5A5A, 0xA5A5A5A5, 0x00000000, 0xFFFFFFFF};
        for (pat = 0; pat < ARRAY_SIZE(_test); pat++) {
-               writel((_test[pat] & write), (adapter->hw.hw_addr + reg));
-               val = readl(adapter->hw.hw_addr + reg);
+               wr32(reg, (_test[pat] & write));
+               val = rd32(reg);
                if (val != (_test[pat] & write & mask)) {
                        dev_err(&adapter->pdev->dev, "pattern test reg %04X "
                                "failed: got 0x%08X expected 0x%08X\n",
@@ -946,9 +943,10 @@ static bool reg_pattern_test(struct igb_adapter *adapter, u64 *data,
 static bool reg_set_and_check(struct igb_adapter *adapter, u64 *data,
                              int reg, u32 mask, u32 write)
 {
+       struct e1000_hw *hw = &adapter->hw;
        u32 val;
-       writel((write & mask), (adapter->hw.hw_addr + reg));
-       val = readl(adapter->hw.hw_addr + reg);
+       wr32(reg, write & mask);
+       val = rd32(reg);
        if ((write & mask) != (val & mask)) {
                dev_err(&adapter->pdev->dev, "set/check reg %04X test failed:"
                        " got 0x%08X expected 0x%08X\n", reg,
@@ -1014,12 +1012,14 @@ static int igb_reg_test(struct igb_adapter *adapter, u64 *data)
                for (i = 0; i < test->array_len; i++) {
                        switch (test->test_type) {
                        case PATTERN_TEST:
-                               REG_PATTERN_TEST(test->reg + (i * test->reg_offset),
+                               REG_PATTERN_TEST(test->reg +
+                                               (i * test->reg_offset),
                                                test->mask,
                                                test->write);
                                break;
                        case SET_READ_TEST:
-                               REG_SET_AND_CHECK(test->reg + (i * test->reg_offset),
+                               REG_SET_AND_CHECK(test->reg +
+                                               (i * test->reg_offset),
                                                test->mask,
                                                test->write);
                                break;
@@ -1061,7 +1061,7 @@ static int igb_eeprom_test(struct igb_adapter *adapter, u64 *data)
        *data = 0;
        /* Read and add up the contents of the EEPROM */
        for (i = 0; i < (NVM_CHECKSUM_REG + 1); i++) {
-               if ((adapter->hw.nvm.ops.read_nvm(&adapter->hw, i, 1, &temp))
+               if ((adapter->hw.nvm.ops.read(&adapter->hw, i, 1, &temp))
                    < 0) {
                        *data = 1;
                        break;
@@ -1091,16 +1091,17 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
 {
        struct e1000_hw *hw = &adapter->hw;
        struct net_device *netdev = adapter->netdev;
-       u32 mask, i = 0, shared_int = true;
+       u32 mask, ics_mask, i = 0, shared_int = true;
        u32 irq = adapter->pdev->irq;
 
        *data = 0;
 
        /* Hook up test interrupt handler just for this test */
-       if (adapter->msix_entries) {
+       if (adapter->msix_entries)
                /* NOTE: we don't test MSI-X interrupts here, yet */
                return 0;
-       } else if (adapter->flags & IGB_FLAG_HAS_MSI) {
+
+       if (adapter->flags & IGB_FLAG_HAS_MSI) {
                shared_int = false;
                if (request_irq(irq, &igb_test_intr, 0, netdev->name, netdev)) {
                        *data = 1;
@@ -1116,16 +1117,31 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
        }
        dev_info(&adapter->pdev->dev, "testing %s interrupt\n",
                (shared_int ? "shared" : "unshared"));
-
        /* Disable all the interrupts */
        wr32(E1000_IMC, 0xFFFFFFFF);
        msleep(10);
 
+       /* Define all writable bits for ICS */
+       switch(hw->mac.type) {
+       case e1000_82575:
+               ics_mask = 0x37F47EDD;
+               break;
+       case e1000_82576:
+               ics_mask = 0x77D4FBFD;
+               break;
+       default:
+               ics_mask = 0x7FFFFFFF;
+               break;
+       }
+
        /* Test each interrupt */
-       for (; i < 10; i++) {
+       for (; i < 31; i++) {
                /* Interrupt to test */
                mask = 1 << i;
 
+               if (!(mask & ics_mask))
+                       continue;
+
                if (!shared_int) {
                        /* Disable the interrupt to be reported in
                         * the cause register and then force the same
@@ -1134,8 +1150,12 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
                         * test failed.
                         */
                        adapter->test_icr = 0;
-                       wr32(E1000_IMC, ~mask & 0x00007FFF);
-                       wr32(E1000_ICS, ~mask & 0x00007FFF);
+
+                       /* Flush any pending interrupts */
+                       wr32(E1000_ICR, ~0);
+
+                       wr32(E1000_IMC, mask);
+                       wr32(E1000_ICS, mask);
                        msleep(10);
 
                        if (adapter->test_icr & mask) {
@@ -1151,6 +1171,10 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
                 * test failed.
                 */
                adapter->test_icr = 0;
+
+               /* Flush any pending interrupts */
+               wr32(E1000_ICR, ~0);
+
                wr32(E1000_IMS, mask);
                wr32(E1000_ICS, mask);
                msleep(10);
@@ -1168,11 +1192,15 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
                         * test failed.
                         */
                        adapter->test_icr = 0;
-                       wr32(E1000_IMC, ~mask & 0x00007FFF);
-                       wr32(E1000_ICS, ~mask & 0x00007FFF);
+
+                       /* Flush any pending interrupts */
+                       wr32(E1000_ICR, ~0);
+
+                       wr32(E1000_IMC, ~mask);
+                       wr32(E1000_ICS, ~mask);
                        msleep(10);
 
-                       if (adapter->test_icr) {
+                       if (adapter->test_icr & mask) {
                                *data = 5;
                                break;
                        }
@@ -1180,7 +1208,7 @@ static int igb_intr_test(struct igb_adapter *adapter, u64 *data)
        }
 
        /* Disable all the interrupts */
-       wr32(E1000_IMC, 0xFFFFFFFF);
+       wr32(E1000_IMC, ~0);
        msleep(10);
 
        /* Unhook test interrupt handler */
@@ -1244,6 +1272,7 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
        struct igb_ring *tx_ring = &adapter->test_tx_ring;
        struct igb_ring *rx_ring = &adapter->test_rx_ring;
        struct pci_dev *pdev = adapter->pdev;
+       struct igb_buffer *buffer_info;
        u32 rctl;
        int i, ret_val;
 
@@ -1260,7 +1289,7 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
                goto err_nomem;
        }
 
-       tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc);
+       tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc);
        tx_ring->size = ALIGN(tx_ring->size, 4096);
        tx_ring->desc = pci_alloc_consistent(pdev, tx_ring->size,
                                             &tx_ring->dma);
@@ -1274,7 +1303,7 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
                        ((u64) tx_ring->dma & 0x00000000FFFFFFFF));
        wr32(E1000_TDBAH(0), ((u64) tx_ring->dma >> 32));
        wr32(E1000_TDLEN(0),
-                       tx_ring->count * sizeof(struct e1000_tx_desc));
+                       tx_ring->count * sizeof(union e1000_adv_tx_desc));
        wr32(E1000_TDH(0), 0);
        wr32(E1000_TDT(0), 0);
        wr32(E1000_TCTL,
@@ -1283,27 +1312,31 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
                        E1000_COLLISION_DISTANCE << E1000_COLD_SHIFT);
 
        for (i = 0; i < tx_ring->count; i++) {
-               struct e1000_tx_desc *tx_desc = E1000_TX_DESC(*tx_ring, i);
+               union e1000_adv_tx_desc *tx_desc;
                struct sk_buff *skb;
                unsigned int size = 1024;
 
+               tx_desc = E1000_TX_DESC_ADV(*tx_ring, i);
                skb = alloc_skb(size, GFP_KERNEL);
                if (!skb) {
                        ret_val = 3;
                        goto err_nomem;
                }
                skb_put(skb, size);
-               tx_ring->buffer_info[i].skb = skb;
-               tx_ring->buffer_info[i].length = skb->len;
-               tx_ring->buffer_info[i].dma =
-                       pci_map_single(pdev, skb->data, skb->len,
-                                      PCI_DMA_TODEVICE);
-               tx_desc->buffer_addr = cpu_to_le64(tx_ring->buffer_info[i].dma);
-               tx_desc->lower.data = cpu_to_le32(skb->len);
-               tx_desc->lower.data |= cpu_to_le32(E1000_TXD_CMD_EOP |
-                                                  E1000_TXD_CMD_IFCS |
-                                                  E1000_TXD_CMD_RS);
-               tx_desc->upper.data = 0;
+               buffer_info = &tx_ring->buffer_info[i];
+               buffer_info->skb = skb;
+               buffer_info->length = skb->len;
+               buffer_info->dma = pci_map_single(pdev, skb->data, skb->len,
+                                                 PCI_DMA_TODEVICE);
+               tx_desc->read.buffer_addr = cpu_to_le64(buffer_info->dma);
+               tx_desc->read.olinfo_status = cpu_to_le32(skb->len) <<
+                                             E1000_ADVTXD_PAYLEN_SHIFT;
+               tx_desc->read.cmd_type_len = cpu_to_le32(skb->len);
+               tx_desc->read.cmd_type_len |= cpu_to_le32(E1000_TXD_CMD_EOP |
+                                                         E1000_TXD_CMD_IFCS |
+                                                         E1000_TXD_CMD_RS |
+                                                         E1000_ADVTXD_DTYP_DATA |
+                                                         E1000_ADVTXD_DCMD_DEXT);
        }
 
        /* Setup Rx descriptor ring and Rx buffers */
@@ -1319,7 +1352,7 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
                goto err_nomem;
        }
 
-       rx_ring->size = rx_ring->count * sizeof(struct e1000_rx_desc);
+       rx_ring->size = rx_ring->count * sizeof(union e1000_adv_rx_desc);
        rx_ring->desc = pci_alloc_consistent(pdev, rx_ring->size,
                                             &rx_ring->dma);
        if (!rx_ring->desc) {
@@ -1338,16 +1371,17 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
        wr32(E1000_RDH(0), 0);
        wr32(E1000_RDT(0), 0);
        rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC);
-       rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_SZ_2048 |
-               E1000_RCTL_RDMTS_HALF |
+       rctl = E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_RDMTS_HALF |
                (adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
        wr32(E1000_RCTL, rctl);
-       wr32(E1000_SRRCTL(0), 0);
+       wr32(E1000_SRRCTL(0), E1000_SRRCTL_DESCTYPE_ADV_ONEBUF);
 
        for (i = 0; i < rx_ring->count; i++) {
-               struct e1000_rx_desc *rx_desc = E1000_RX_DESC(*rx_ring, i);
+               union e1000_adv_rx_desc *rx_desc;
                struct sk_buff *skb;
 
+               buffer_info = &rx_ring->buffer_info[i];
+               rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
                skb = alloc_skb(IGB_RXBUFFER_2048 + NET_IP_ALIGN,
                                GFP_KERNEL);
                if (!skb) {
@@ -1355,11 +1389,11 @@ static int igb_setup_desc_rings(struct igb_adapter *adapter)
                        goto err_nomem;
                }
                skb_reserve(skb, NET_IP_ALIGN);
-               rx_ring->buffer_info[i].skb = skb;
-               rx_ring->buffer_info[i].dma =
-                       pci_map_single(pdev, skb->data, IGB_RXBUFFER_2048,
-                                      PCI_DMA_FROMDEVICE);
-               rx_desc->buffer_addr = cpu_to_le64(rx_ring->buffer_info[i].dma);
+               buffer_info->skb = skb;
+               buffer_info->dma = pci_map_single(pdev, skb->data,
+                                                 IGB_RXBUFFER_2048,
+                                                 PCI_DMA_FROMDEVICE);
+               rx_desc->read.pkt_addr = cpu_to_le64(buffer_info->dma);
                memset(skb->data, 0x00, skb->len);
        }
 
@@ -1458,7 +1492,7 @@ static int igb_setup_loopback_test(struct igb_adapter *adapter)
                         E1000_CTRL_TFCE |
                         E1000_CTRL_LRST);
                reg |= E1000_CTRL_SLU |
-                      E1000_CTRL_FD; 
+                      E1000_CTRL_FD;
                wr32(E1000_CTRL, reg);
 
                /* Unset switch control to serdes energy detect */
@@ -1827,9 +1861,6 @@ static int igb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
        return 0;
 }
 
-/* toggle LED 4 times per second = 2 "blinks" per second */
-#define IGB_ID_INTERVAL                (HZ/4)
-
 /* bit defines for adapter->led_status */
 #define IGB_LED_ON             0
 
@@ -1921,18 +1952,6 @@ static void igb_get_ethtool_stats(struct net_device *netdev,
        int stat_count = sizeof(struct igb_queue_stats) / sizeof(u64);
        int j;
        int i;
-#ifdef CONFIG_IGB_LRO
-       int aggregated = 0, flushed = 0, no_desc = 0;
-
-       for (i = 0; i < adapter->num_rx_queues; i++) {
-               aggregated += adapter->rx_ring[i].lro_mgr.stats.aggregated;
-               flushed += adapter->rx_ring[i].lro_mgr.stats.flushed;
-               no_desc += adapter->rx_ring[i].lro_mgr.stats.no_desc;
-       }
-       adapter->lro_aggregated = aggregated;
-       adapter->lro_flushed = flushed;
-       adapter->lro_no_desc = no_desc;
-#endif
 
        igb_update_stats(adapter);
        for (i = 0; i < IGB_GLOBAL_STATS_LEN; i++) {
index a50db5398fa52a297c07b78dddc5c6502c406f39..6cae258df96d00290c896227766fd79051eb4f71 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel(R) Gigabit Ethernet Linux driver
-  Copyright(c) 2007 Intel Corporation.
+  Copyright(c) 2007-2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -34,6 +34,7 @@
 #include <linux/ipv6.h>
 #include <net/checksum.h>
 #include <net/ip6_checksum.h>
+#include <linux/net_tstamp.h>
 #include <linux/mii.h>
 #include <linux/ethtool.h>
 #include <linux/if_vlan.h>
 #endif
 #include "igb.h"
 
-#define DRV_VERSION "1.2.45-k2"
+#define DRV_VERSION "1.3.16-k2"
 char igb_driver_name[] = "igb";
 char igb_driver_version[] = DRV_VERSION;
 static const char igb_driver_string[] =
                                "Intel(R) Gigabit Ethernet Network Driver";
-static const char igb_copyright[] = "Copyright (c) 2008 Intel Corporation.";
+static const char igb_copyright[] = "Copyright (c) 2007-2009 Intel Corporation.";
 
 static const struct e1000_info *igb_info_tbl[] = {
        [board_82575] = &e1000_82575_info,
@@ -105,7 +106,6 @@ static irqreturn_t igb_intr_msi(int irq, void *);
 static irqreturn_t igb_msix_other(int irq, void *);
 static irqreturn_t igb_msix_rx(int irq, void *);
 static irqreturn_t igb_msix_tx(int irq, void *);
-static int igb_clean_rx_ring_msix(struct napi_struct *, int);
 #ifdef CONFIG_IGB_DCA
 static void igb_update_rx_dca(struct igb_ring *);
 static void igb_update_tx_dca(struct igb_ring *);
@@ -115,9 +115,6 @@ static bool igb_clean_tx_irq(struct igb_ring *);
 static int igb_poll(struct napi_struct *, int);
 static bool igb_clean_rx_irq_adv(struct igb_ring *, int *, int);
 static void igb_alloc_rx_buffers_adv(struct igb_ring *, int);
-#ifdef CONFIG_IGB_LRO
-static int igb_get_skb_hdr(struct sk_buff *skb, void **, void **, u64 *, void *);
-#endif
 static int igb_ioctl(struct net_device *, struct ifreq *, int cmd);
 static void igb_tx_timeout(struct net_device *);
 static void igb_reset_task(struct work_struct *);
@@ -125,6 +122,16 @@ static void igb_vlan_rx_register(struct net_device *, struct vlan_group *);
 static void igb_vlan_rx_add_vid(struct net_device *, u16);
 static void igb_vlan_rx_kill_vid(struct net_device *, u16);
 static void igb_restore_vlan(struct igb_adapter *);
+static void igb_ping_all_vfs(struct igb_adapter *);
+static void igb_msg_task(struct igb_adapter *);
+static int igb_rcv_msg_from_vf(struct igb_adapter *, u32);
+static inline void igb_set_rah_pool(struct e1000_hw *, int , int);
+static void igb_set_mc_list_pools(struct igb_adapter *, int, u16);
+static void igb_vmm_control(struct igb_adapter *);
+static inline void igb_set_vmolr(struct e1000_hw *, int);
+static inline int igb_set_vf_rlpml(struct igb_adapter *, int, int);
+static int igb_set_vf_mac(struct igb_adapter *adapter, int, unsigned char *);
+static void igb_restore_vf_multicasts(struct igb_adapter *adapter);
 
 static int igb_suspend(struct pci_dev *, pm_message_t);
 #ifdef CONFIG_PM
@@ -139,12 +146,18 @@ static struct notifier_block dca_notifier = {
        .priority       = 0
 };
 #endif
-
 #ifdef CONFIG_NET_POLL_CONTROLLER
 /* for netdump / net console */
 static void igb_netpoll(struct net_device *);
 #endif
 
+#ifdef CONFIG_PCI_IOV
+static ssize_t igb_set_num_vfs(struct device *, struct device_attribute *,
+                               const char *, size_t);
+static ssize_t igb_show_num_vfs(struct device *, struct device_attribute *,
+                               char *);
+DEVICE_ATTR(num_vfs, S_IRUGO | S_IWUSR, igb_show_num_vfs, igb_set_num_vfs);
+#endif
 static pci_ers_result_t igb_io_error_detected(struct pci_dev *,
                     pci_channel_state_t);
 static pci_ers_result_t igb_io_slot_reset(struct pci_dev *);
@@ -178,6 +191,54 @@ MODULE_DESCRIPTION("Intel(R) Gigabit Ethernet Network Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(DRV_VERSION);
 
+/**
+ * Scale the NIC clock cycle by a large factor so that
+ * relatively small clock corrections can be added or
+ * substracted at each clock tick. The drawbacks of a
+ * large factor are a) that the clock register overflows
+ * more quickly (not such a big deal) and b) that the
+ * increment per tick has to fit into 24 bits.
+ *
+ * Note that
+ *   TIMINCA = IGB_TSYNC_CYCLE_TIME_IN_NANOSECONDS *
+ *             IGB_TSYNC_SCALE
+ *   TIMINCA += TIMINCA * adjustment [ppm] / 1e9
+ *
+ * The base scale factor is intentionally a power of two
+ * so that the division in %struct timecounter can be done with
+ * a shift.
+ */
+#define IGB_TSYNC_SHIFT (19)
+#define IGB_TSYNC_SCALE (1<<IGB_TSYNC_SHIFT)
+
+/**
+ * The duration of one clock cycle of the NIC.
+ *
+ * @todo This hard-coded value is part of the specification and might change
+ * in future hardware revisions. Add revision check.
+ */
+#define IGB_TSYNC_CYCLE_TIME_IN_NANOSECONDS 16
+
+#if (IGB_TSYNC_SCALE * IGB_TSYNC_CYCLE_TIME_IN_NANOSECONDS) >= (1<<24)
+# error IGB_TSYNC_SCALE and/or IGB_TSYNC_CYCLE_TIME_IN_NANOSECONDS are too large to fit into TIMINCA
+#endif
+
+/**
+ * igb_read_clock - read raw cycle counter (to be used by time counter)
+ */
+static cycle_t igb_read_clock(const struct cyclecounter *tc)
+{
+       struct igb_adapter *adapter =
+               container_of(tc, struct igb_adapter, cycles);
+       struct e1000_hw *hw = &adapter->hw;
+       u64 stamp;
+
+       stamp =  rd32(E1000_SYSTIML);
+       stamp |= (u64)rd32(E1000_SYSTIMH) << 32ULL;
+
+       return stamp;
+}
+
 #ifdef DEBUG
 /**
  * igb_get_hw_dev_name - return device name string
@@ -188,6 +249,30 @@ char *igb_get_hw_dev_name(struct e1000_hw *hw)
        struct igb_adapter *adapter = hw->back;
        return adapter->netdev->name;
 }
+
+/**
+ * igb_get_time_str - format current NIC and system time as string
+ */
+static char *igb_get_time_str(struct igb_adapter *adapter,
+                             char buffer[160])
+{
+       cycle_t hw = adapter->cycles.read(&adapter->cycles);
+       struct timespec nic = ns_to_timespec(timecounter_read(&adapter->clock));
+       struct timespec sys;
+       struct timespec delta;
+       getnstimeofday(&sys);
+
+       delta = timespec_sub(nic, sys);
+
+       sprintf(buffer,
+               "HW %llu, NIC %ld.%09lus, SYS %ld.%09lus, NIC-SYS %lds + %09luns",
+               hw,
+               (long)nic.tv_sec, nic.tv_nsec,
+               (long)sys.tv_sec, sys.tv_nsec,
+               (long)delta.tv_sec, delta.tv_nsec);
+
+       return buffer;
+}
 #endif
 
 /**
@@ -243,6 +328,7 @@ module_exit(igb_exit_module);
 static void igb_cache_ring_register(struct igb_adapter *adapter)
 {
        int i;
+       unsigned int rbase_offset = adapter->vfs_allocated_count;
 
        switch (adapter->hw.mac.type) {
        case e1000_82576:
@@ -252,9 +338,11 @@ static void igb_cache_ring_register(struct igb_adapter *adapter)
                 * and continue consuming queues in the same sequence
                 */
                for (i = 0; i < adapter->num_rx_queues; i++)
-                       adapter->rx_ring[i].reg_idx = Q_IDX_82576(i);
+                       adapter->rx_ring[i].reg_idx = rbase_offset +
+                                                     Q_IDX_82576(i);
                for (i = 0; i < adapter->num_tx_queues; i++)
-                       adapter->tx_ring[i].reg_idx = Q_IDX_82576(i);
+                       adapter->tx_ring[i].reg_idx = rbase_offset +
+                                                     Q_IDX_82576(i);
                break;
        case e1000_82575:
        default:
@@ -354,7 +442,7 @@ static void igb_assign_vector(struct igb_adapter *adapter, int rx_queue,
                   a vector number along with a "valid" bit.  Sadly, the layout
                   of the table is somewhat counterintuitive. */
                if (rx_queue > IGB_N0_QUEUE) {
-                       index = (rx_queue >> 1);
+                       index = (rx_queue >> 1) + adapter->vfs_allocated_count;
                        ivar = array_rd32(E1000_IVAR0, index);
                        if (rx_queue & 0x1) {
                                /* vector goes into third byte of register */
@@ -369,7 +457,7 @@ static void igb_assign_vector(struct igb_adapter *adapter, int rx_queue,
                        array_wr32(E1000_IVAR0, index, ivar);
                }
                if (tx_queue > IGB_N0_QUEUE) {
-                       index = (tx_queue >> 1);
+                       index = (tx_queue >> 1) + adapter->vfs_allocated_count;
                        ivar = array_rd32(E1000_IVAR0, index);
                        if (tx_queue & 0x1) {
                                /* vector goes into high byte of register */
@@ -407,7 +495,7 @@ static void igb_configure_msix(struct igb_adapter *adapter)
                /* Turn on MSI-X capability first, or our settings
                 * won't stick.  And it will take days to debug. */
                wr32(E1000_GPIE, E1000_GPIE_MSIX_MODE |
-                                  E1000_GPIE_PBA | E1000_GPIE_EIAME | 
+                                  E1000_GPIE_PBA | E1000_GPIE_EIAME |
                                   E1000_GPIE_NSICR);
 
        for (i = 0; i < adapter->num_tx_queues; i++) {
@@ -506,9 +594,6 @@ static int igb_request_msix(struct igb_adapter *adapter)
                        goto out;
                ring->itr_register = E1000_EITR(0) + (vector << 2);
                ring->itr_val = adapter->itr;
-               /* overwrite the poll routine for MSIX, we've already done
-                * netif_napi_add */
-               ring->napi.poll = &igb_clean_rx_ring_msix;
                vector++;
        }
 
@@ -546,6 +631,11 @@ static void igb_set_interrupt_capability(struct igb_adapter *adapter)
        int err;
        int numvecs, i;
 
+       /* Number of supported queues. */
+       /* Having more queues than CPUs doesn't make sense. */
+       adapter->num_rx_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus());
+       adapter->num_tx_queues = min_t(u32, IGB_MAX_TX_QUEUES, num_online_cpus());
+
        numvecs = adapter->num_tx_queues + adapter->num_rx_queues + 1;
        adapter->msix_entries = kcalloc(numvecs, sizeof(struct msix_entry),
                                        GFP_KERNEL);
@@ -687,7 +777,10 @@ static void igb_irq_enable(struct igb_adapter *adapter)
                wr32(E1000_EIAC, adapter->eims_enable_mask);
                wr32(E1000_EIAM, adapter->eims_enable_mask);
                wr32(E1000_EIMS, adapter->eims_enable_mask);
-               wr32(E1000_IMS, E1000_IMS_LSC);
+               if (adapter->vfs_allocated_count)
+                       wr32(E1000_MBVFIMR, 0xFF);
+               wr32(E1000_IMS, (E1000_IMS_LSC | E1000_IMS_VMMB |
+                                E1000_IMS_DOUTSYNC));
        } else {
                wr32(E1000_IMS, IMS_ENABLE_MASK);
                wr32(E1000_IAM, IMS_ENABLE_MASK);
@@ -811,6 +904,10 @@ int igb_up(struct igb_adapter *adapter)
        if (adapter->msix_entries)
                igb_configure_msix(adapter);
 
+       igb_vmm_control(adapter);
+       igb_set_rah_pool(hw, adapter->vfs_allocated_count, 0);
+       igb_set_vmolr(hw, adapter->vfs_allocated_count);
+
        /* Clear any pending interrupts. */
        rd32(E1000_ICR);
        igb_irq_enable(adapter);
@@ -856,6 +953,10 @@ void igb_down(struct igb_adapter *adapter)
 
        netdev->tx_queue_len = adapter->tx_queue_len;
        netif_carrier_off(netdev);
+
+       /* record the stats before reset*/
+       igb_update_stats(adapter);
+
        adapter->link_speed = 0;
        adapter->link_duplex = 0;
 
@@ -886,11 +987,14 @@ void igb_reset(struct igb_adapter *adapter)
        /* Repartition Pba for greater than 9k mtu
         * To take effect CTRL.RST is required.
         */
-       if (mac->type != e1000_82576) {
-       pba = E1000_PBA_34K;
-       }
-       else {
+       switch (mac->type) {
+       case e1000_82576:
                pba = E1000_PBA_64K;
+               break;
+       case e1000_82575:
+       default:
+               pba = E1000_PBA_34K;
+               break;
        }
 
        if ((adapter->max_frame_size > ETH_FRAME_LEN + ETH_FCS_LEN) &&
@@ -912,7 +1016,7 @@ void igb_reset(struct igb_adapter *adapter)
                /* the tx fifo also stores 16 bytes of information about the tx
                 * but don't include ethernet FCS because hardware appends it */
                min_tx_space = (adapter->max_frame_size +
-                               sizeof(struct e1000_tx_desc) -
+                               sizeof(union e1000_adv_tx_desc) -
                                ETH_FCS_LEN) * 2;
                min_tx_space = ALIGN(min_tx_space, 1024);
                min_tx_space >>= 10;
@@ -956,6 +1060,20 @@ void igb_reset(struct igb_adapter *adapter)
        fc->send_xon = 1;
        fc->type = fc->original_type;
 
+       /* disable receive for all VFs and wait one second */
+       if (adapter->vfs_allocated_count) {
+               int i;
+               for (i = 0 ; i < adapter->vfs_allocated_count; i++)
+                       adapter->vf_data[i].clear_to_send = false;
+
+               /* ping all the active vfs to let them know we are going down */
+                       igb_ping_all_vfs(adapter);
+
+               /* disable transmits and receives */
+               wr32(E1000_VFRE, 0);
+               wr32(E1000_VFTE, 0);
+       }
+
        /* Allow time for pending master requests to run */
        adapter->hw.mac.ops.reset_hw(&adapter->hw);
        wr32(E1000_WUC, 0);
@@ -972,21 +1090,6 @@ void igb_reset(struct igb_adapter *adapter)
        igb_get_phy_info(&adapter->hw);
 }
 
-/**
- * igb_is_need_ioport - determine if an adapter needs ioport resources or not
- * @pdev: PCI device information struct
- *
- * Returns true if an adapter needs ioport resources
- **/
-static int igb_is_need_ioport(struct pci_dev *pdev)
-{
-       switch (pdev->device) {
-       /* Currently there are no adapters that need ioport resources */
-       default:
-               return false;
-       }
-}
-
 static const struct net_device_ops igb_netdev_ops = {
        .ndo_open               = igb_open,
        .ndo_stop               = igb_close,
@@ -1026,21 +1129,12 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        struct pci_dev *us_dev;
        const struct e1000_info *ei = igb_info_tbl[ent->driver_data];
        unsigned long mmio_start, mmio_len;
-       int i, err, pci_using_dac, pos;
+       int err, pci_using_dac, pos;
        u16 eeprom_data = 0, state = 0;
        u16 eeprom_apme_mask = IGB_EEPROM_APME;
        u32 part_num;
-       int bars, need_ioport;
 
-       /* do not allocate ioport bars when not needed */
-       need_ioport = igb_is_need_ioport(pdev);
-       if (need_ioport) {
-               bars = pci_select_bars(pdev, IORESOURCE_MEM | IORESOURCE_IO);
-               err = pci_enable_device(pdev);
-       } else {
-               bars = pci_select_bars(pdev, IORESOURCE_MEM);
-               err = pci_enable_device_mem(pdev);
-       }
+       err = pci_enable_device_mem(pdev);
        if (err)
                return err;
 
@@ -1083,7 +1177,9 @@ static int __devinit igb_probe(struct pci_dev *pdev,
                break;
        }
 
-       err = pci_request_selected_regions(pdev, bars, igb_driver_name);
+       err = pci_request_selected_regions(pdev, pci_select_bars(pdev,
+                                          IORESOURCE_MEM),
+                                          igb_driver_name);
        if (err)
                goto err_pci_reg;
 
@@ -1098,7 +1194,8 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        pci_save_state(pdev);
 
        err = -ENOMEM;
-       netdev = alloc_etherdev_mq(sizeof(struct igb_adapter), IGB_MAX_TX_QUEUES);
+       netdev = alloc_etherdev_mq(sizeof(struct igb_adapter),
+                                  IGB_ABS_MAX_TX_QUEUES);
        if (!netdev)
                goto err_alloc_etherdev;
 
@@ -1111,15 +1208,13 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        hw = &adapter->hw;
        hw->back = adapter;
        adapter->msg_enable = NETIF_MSG_DRV | NETIF_MSG_PROBE;
-       adapter->bars = bars;
-       adapter->need_ioport = need_ioport;
 
        mmio_start = pci_resource_start(pdev, 0);
        mmio_len = pci_resource_len(pdev, 0);
 
        err = -EIO;
-       adapter->hw.hw_addr = ioremap(mmio_start, mmio_len);
-       if (!adapter->hw.hw_addr)
+       hw->hw_addr = ioremap(mmio_start, mmio_len);
+       if (!hw->hw_addr)
                goto err_ioremap;
 
        netdev->netdev_ops = &igb_netdev_ops;
@@ -1147,8 +1242,9 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        /* Initialize skew-specific constants */
        err = ei->get_invariants(hw);
        if (err)
-               goto err_hw_init;
+               goto err_sw_init;
 
+       /* setup the private structure */
        err = igb_sw_init(adapter);
        if (err)
                goto err_sw_init;
@@ -1180,27 +1276,25 @@ static int __devinit igb_probe(struct pci_dev *pdev,
                        "PHY reset is blocked due to SOL/IDER session.\n");
 
        netdev->features = NETIF_F_SG |
-                          NETIF_F_HW_CSUM |
+                          NETIF_F_IP_CSUM |
                           NETIF_F_HW_VLAN_TX |
                           NETIF_F_HW_VLAN_RX |
                           NETIF_F_HW_VLAN_FILTER;
 
+       netdev->features |= NETIF_F_IPV6_CSUM;
        netdev->features |= NETIF_F_TSO;
        netdev->features |= NETIF_F_TSO6;
 
-#ifdef CONFIG_IGB_LRO
-       netdev->features |= NETIF_F_LRO;
-#endif
+       netdev->features |= NETIF_F_GRO;
 
        netdev->vlan_features |= NETIF_F_TSO;
        netdev->vlan_features |= NETIF_F_TSO6;
-       netdev->vlan_features |= NETIF_F_HW_CSUM;
+       netdev->vlan_features |= NETIF_F_IP_CSUM;
        netdev->vlan_features |= NETIF_F_SG;
 
        if (pci_using_dac)
                netdev->features |= NETIF_F_HIGHDMA;
 
-       netdev->features |= NETIF_F_LLTX;
        adapter->en_mng_pt = igb_enable_mng_pass_thru(&adapter->hw);
 
        /* before reading the NVM, reset the controller to put the device in a
@@ -1238,14 +1332,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        INIT_WORK(&adapter->reset_task, igb_reset_task);
        INIT_WORK(&adapter->watchdog_task, igb_watchdog_task);
 
-       /* Initialize link & ring properties that are user-changeable */
-       adapter->tx_ring->count = 256;
-       for (i = 0; i < adapter->num_tx_queues; i++)
-               adapter->tx_ring[i].count = adapter->tx_ring->count;
-       adapter->rx_ring->count = 256;
-       for (i = 0; i < adapter->num_rx_queues; i++)
-               adapter->rx_ring[i].count = adapter->rx_ring->count;
-
+       /* Initialize link properties that are user-changeable */
        adapter->fc_autoneg = true;
        hw->mac.autoneg = true;
        hw->phy.autoneg_advertised = 0x2f;
@@ -1253,7 +1340,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        hw->fc.original_type = e1000_fc_default;
        hw->fc.type = e1000_fc_default;
 
-       adapter->itr_setting = 3;
+       adapter->itr_setting = IGB_DEFAULT_ITR;
        adapter->itr = IGB_START_ITR;
 
        igb_validate_mdi_setting(hw);
@@ -1266,8 +1353,7 @@ static int __devinit igb_probe(struct pci_dev *pdev,
 
        if (hw->bus.func == 0 ||
            hw->device_id == E1000_DEV_ID_82575EB_COPPER)
-               hw->nvm.ops.read_nvm(hw, NVM_INIT_CONTROL3_PORT_A, 1,
-                                    &eeprom_data);
+               hw->nvm.ops.read(hw, NVM_INIT_CONTROL3_PORT_A, 1, &eeprom_data);
 
        if (eeprom_data & eeprom_apme_mask)
                adapter->eeprom_wol |= E1000_WUFC_MAG;
@@ -1309,17 +1395,82 @@ static int __devinit igb_probe(struct pci_dev *pdev,
        if (err)
                goto err_register;
 
+#ifdef CONFIG_PCI_IOV
+       /* since iov functionality isn't critical to base device function we
+        * can accept failure.  If it fails we don't allow iov to be enabled */
+       if (hw->mac.type == e1000_82576) {
+               err = pci_enable_sriov(pdev, 0);
+               if (!err)
+                       err = device_create_file(&netdev->dev,
+                                                &dev_attr_num_vfs);
+               if (err)
+                       dev_err(&pdev->dev, "Failed to initialize IOV\n");
+       }
+
+#endif
 #ifdef CONFIG_IGB_DCA
        if (dca_add_requester(&pdev->dev) == 0) {
                adapter->flags |= IGB_FLAG_DCA_ENABLED;
                dev_info(&pdev->dev, "DCA enabled\n");
                /* Always use CB2 mode, difference is masked
                 * in the CB driver. */
-               wr32(E1000_DCA_CTRL, 2);
+               wr32(E1000_DCA_CTRL, E1000_DCA_CTRL_DCA_MODE_CB2);
                igb_setup_dca(adapter);
        }
 #endif
 
+       /*
+        * Initialize hardware timer: we keep it running just in case
+        * that some program needs it later on.
+        */
+       memset(&adapter->cycles, 0, sizeof(adapter->cycles));
+       adapter->cycles.read = igb_read_clock;
+       adapter->cycles.mask = CLOCKSOURCE_MASK(64);
+       adapter->cycles.mult = 1;
+       adapter->cycles.shift = IGB_TSYNC_SHIFT;
+       wr32(E1000_TIMINCA,
+            (1<<24) |
+            IGB_TSYNC_CYCLE_TIME_IN_NANOSECONDS * IGB_TSYNC_SCALE);
+#if 0
+       /*
+        * Avoid rollover while we initialize by resetting the time counter.
+        */
+       wr32(E1000_SYSTIML, 0x00000000);
+       wr32(E1000_SYSTIMH, 0x00000000);
+#else
+       /*
+        * Set registers so that rollover occurs soon to test this.
+        */
+       wr32(E1000_SYSTIML, 0x00000000);
+       wr32(E1000_SYSTIMH, 0xFF800000);
+#endif
+       wrfl();
+       timecounter_init(&adapter->clock,
+                        &adapter->cycles,
+                        ktime_to_ns(ktime_get_real()));
+
+       /*
+        * Synchronize our NIC clock against system wall clock. NIC
+        * time stamp reading requires ~3us per sample, each sample
+        * was pretty stable even under load => only require 10
+        * samples for each offset comparison.
+        */
+       memset(&adapter->compare, 0, sizeof(adapter->compare));
+       adapter->compare.source = &adapter->clock;
+       adapter->compare.target = ktime_get_real;
+       adapter->compare.num_samples = 10;
+       timecompare_update(&adapter->compare, 0);
+
+#ifdef DEBUG
+       {
+               char buffer[160];
+               printk(KERN_DEBUG
+                       "igb: %s: hw %p initialized timer\n",
+                       igb_get_time_str(adapter, buffer),
+                       &adapter->hw);
+       }
+#endif
+
        dev_info(&pdev->dev, "Intel(R) Gigabit Ethernet Network Connection\n");
        /* print bus type/speed/width info */
        dev_info(&pdev->dev, "%s: (PCIe:%s:%s) %pM\n",
@@ -1352,15 +1503,14 @@ err_eeprom:
        if (hw->flash_address)
                iounmap(hw->flash_address);
 
-       igb_remove_device(hw);
        igb_free_queues(adapter);
 err_sw_init:
-err_hw_init:
        iounmap(hw->hw_addr);
 err_ioremap:
        free_netdev(netdev);
 err_alloc_etherdev:
-       pci_release_selected_regions(pdev, bars);
+       pci_release_selected_regions(pdev, pci_select_bars(pdev,
+                                    IORESOURCE_MEM));
 err_pci_reg:
 err_dma:
        pci_disable_device(pdev);
@@ -1380,9 +1530,7 @@ static void __devexit igb_remove(struct pci_dev *pdev)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
        struct igb_adapter *adapter = netdev_priv(netdev);
-#ifdef CONFIG_IGB_DCA
        struct e1000_hw *hw = &adapter->hw;
-#endif
        int err;
 
        /* flush_scheduled work may reschedule our watchdog task, so
@@ -1398,7 +1546,7 @@ static void __devexit igb_remove(struct pci_dev *pdev)
                dev_info(&pdev->dev, "DCA disabled\n");
                dca_remove_requester(&pdev->dev);
                adapter->flags &= ~IGB_FLAG_DCA_ENABLED;
-               wr32(E1000_DCA_CTRL, 1);
+               wr32(E1000_DCA_CTRL, E1000_DCA_CTRL_DCA_MODE_DISABLE);
        }
 #endif
 
@@ -1411,15 +1559,29 @@ static void __devexit igb_remove(struct pci_dev *pdev)
        if (!igb_check_reset_block(&adapter->hw))
                igb_reset_phy(&adapter->hw);
 
-       igb_remove_device(&adapter->hw);
        igb_reset_interrupt_capability(adapter);
 
        igb_free_queues(adapter);
 
-       iounmap(adapter->hw.hw_addr);
-       if (adapter->hw.flash_address)
-               iounmap(adapter->hw.flash_address);
-       pci_release_selected_regions(pdev, adapter->bars);
+#ifdef CONFIG_PCI_IOV
+       /* reclaim resources allocated to VFs */
+       if (adapter->vf_data) {
+               /* disable iov and allow time for transactions to clear */
+               pci_disable_sriov(pdev);
+               msleep(500);
+
+               kfree(adapter->vf_data);
+               adapter->vf_data = NULL;
+               wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
+               msleep(100);
+               dev_info(&pdev->dev, "IOV Disabled\n");
+       }
+#endif
+       iounmap(hw->hw_addr);
+       if (hw->flash_address)
+               iounmap(hw->flash_address);
+       pci_release_selected_regions(pdev, pci_select_bars(pdev,
+                                    IORESOURCE_MEM));
 
        free_netdev(netdev);
 
@@ -1454,11 +1616,6 @@ static int __devinit igb_sw_init(struct igb_adapter *adapter)
        adapter->max_frame_size = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
        adapter->min_frame_size = ETH_ZLEN + ETH_FCS_LEN;
 
-       /* Number of supported queues. */
-       /* Having more queues than CPUs doesn't make sense. */
-       adapter->num_rx_queues = min_t(u32, IGB_MAX_RX_QUEUES, num_online_cpus());
-       adapter->num_tx_queues = min_t(u32, IGB_MAX_TX_QUEUES, num_online_cpus());
-
        /* This call may decrease the number of queues depending on
         * interrupt mode. */
        igb_set_interrupt_capability(adapter);
@@ -1521,6 +1678,10 @@ static int igb_open(struct net_device *netdev)
         * clean_rx handler before we do so.  */
        igb_configure(adapter);
 
+       igb_vmm_control(adapter);
+       igb_set_rah_pool(hw, adapter->vfs_allocated_count, 0);
+       igb_set_vmolr(hw, adapter->vfs_allocated_count);
+
        err = igb_request_irq(adapter);
        if (err)
                goto err_req_irq;
@@ -1596,7 +1757,6 @@ static int igb_close(struct net_device *netdev)
  *
  * Return 0 on success, negative on failure
  **/
-
 int igb_setup_tx_resources(struct igb_adapter *adapter,
                           struct igb_ring *tx_ring)
 {
@@ -1610,7 +1770,7 @@ int igb_setup_tx_resources(struct igb_adapter *adapter,
        memset(tx_ring->buffer_info, 0, size);
 
        /* round up to nearest 4K */
-       tx_ring->size = tx_ring->count * sizeof(struct e1000_tx_desc);
+       tx_ring->size = tx_ring->count * sizeof(union e1000_adv_tx_desc);
        tx_ring->size = ALIGN(tx_ring->size, 4096);
 
        tx_ring->desc = pci_alloc_consistent(pdev, tx_ring->size,
@@ -1657,7 +1817,7 @@ static int igb_setup_all_tx_resources(struct igb_adapter *adapter)
        for (i = 0; i < IGB_MAX_TX_QUEUES; i++) {
                r_idx = i % adapter->num_tx_queues;
                adapter->multi_tx_table[i] = &adapter->tx_ring[r_idx];
-       }       
+       }
        return err;
 }
 
@@ -1676,13 +1836,13 @@ static void igb_configure_tx(struct igb_adapter *adapter)
        int i, j;
 
        for (i = 0; i < adapter->num_tx_queues; i++) {
-               struct igb_ring *ring = &(adapter->tx_ring[i]);
+               struct igb_ring *ring = &adapter->tx_ring[i];
                j = ring->reg_idx;
                wr32(E1000_TDLEN(j),
-                               ring->count * sizeof(struct e1000_tx_desc));
+                    ring->count * sizeof(union e1000_adv_tx_desc));
                tdba = ring->dma;
                wr32(E1000_TDBAL(j),
-                               tdba & 0x00000000ffffffffULL);
+                    tdba & 0x00000000ffffffffULL);
                wr32(E1000_TDBAH(j), tdba >> 32);
 
                ring->head = E1000_TDH(j);
@@ -1702,12 +1862,11 @@ static void igb_configure_tx(struct igb_adapter *adapter)
                wr32(E1000_DCA_TXCTRL(j), txctrl);
        }
 
-
-
-       /* Use the default values for the Tx Inter Packet Gap (IPG) timer */
+       /* disable queue 0 to prevent tail bump w/o re-configuration */
+       if (adapter->vfs_allocated_count)
+               wr32(E1000_TXDCTL(0), 0);
 
        /* Program the Transmit Control Register */
-
        tctl = rd32(E1000_TCTL);
        tctl &= ~E1000_TCTL_CT;
        tctl |= E1000_TCTL_PSP | E1000_TCTL_RTLC |
@@ -1731,21 +1890,12 @@ static void igb_configure_tx(struct igb_adapter *adapter)
  *
  * Returns 0 on success, negative on failure
  **/
-
 int igb_setup_rx_resources(struct igb_adapter *adapter,
                           struct igb_ring *rx_ring)
 {
        struct pci_dev *pdev = adapter->pdev;
        int size, desc_len;
 
-#ifdef CONFIG_IGB_LRO
-       size = sizeof(struct net_lro_desc) * MAX_LRO_DESCRIPTORS;
-       rx_ring->lro_mgr.lro_arr = vmalloc(size);
-       if (!rx_ring->lro_mgr.lro_arr)
-               goto err;
-       memset(rx_ring->lro_mgr.lro_arr, 0, size);
-#endif
-
        size = sizeof(struct igb_buffer) * rx_ring->count;
        rx_ring->buffer_info = vmalloc(size);
        if (!rx_ring->buffer_info)
@@ -1772,10 +1922,6 @@ int igb_setup_rx_resources(struct igb_adapter *adapter,
        return 0;
 
 err:
-#ifdef CONFIG_IGB_LRO
-       vfree(rx_ring->lro_mgr.lro_arr);
-       rx_ring->lro_mgr.lro_arr = NULL;
-#endif
        vfree(rx_ring->buffer_info);
        dev_err(&adapter->pdev->dev, "Unable to allocate memory for "
                "the receive descriptor ring\n");
@@ -1824,13 +1970,13 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
        rctl &= ~(E1000_RCTL_LBM_TCVR | E1000_RCTL_LBM_MAC);
 
        rctl |= E1000_RCTL_EN | E1000_RCTL_BAM | E1000_RCTL_RDMTS_HALF |
-               (adapter->hw.mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
+               (hw->mac.mc_filter_type << E1000_RCTL_MO_SHIFT);
 
        /*
         * enable stripping of CRC. It's unlikely this will break BMC
         * redirection as it did with e1000. Newer features require
         * that the HW strips the CRC.
-       */
+        */
        rctl |= E1000_RCTL_SECRC;
 
        /*
@@ -1874,6 +2020,30 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
                srrctl |= E1000_SRRCTL_DESCTYPE_ADV_ONEBUF;
        }
 
+       /* Attention!!!  For SR-IOV PF driver operations you must enable
+        * queue drop for all VF and PF queues to prevent head of line blocking
+        * if an un-trusted VF does not provide descriptors to hardware.
+        */
+       if (adapter->vfs_allocated_count) {
+               u32 vmolr;
+
+               j = adapter->rx_ring[0].reg_idx;
+
+               /* set all queue drop enable bits */
+               wr32(E1000_QDE, ALL_QUEUES);
+               srrctl |= E1000_SRRCTL_DROP_EN;
+
+               /* disable queue 0 to prevent tail write w/o re-config */
+               wr32(E1000_RXDCTL(0), 0);
+
+               vmolr = rd32(E1000_VMOLR(j));
+               if (rctl & E1000_RCTL_LPE)
+                       vmolr |= E1000_VMOLR_LPE;
+               if (adapter->num_rx_queues > 0)
+                       vmolr |= E1000_VMOLR_RSSE;
+               wr32(E1000_VMOLR(j), vmolr);
+       }
+
        for (i = 0; i < adapter->num_rx_queues; i++) {
                j = adapter->rx_ring[i].reg_idx;
                wr32(E1000_SRRCTL(j), srrctl);
@@ -1882,6 +2052,54 @@ static void igb_setup_rctl(struct igb_adapter *adapter)
        wr32(E1000_RCTL, rctl);
 }
 
+/**
+ * igb_rlpml_set - set maximum receive packet size
+ * @adapter: board private structure
+ *
+ * Configure maximum receivable packet size.
+ **/
+static void igb_rlpml_set(struct igb_adapter *adapter)
+{
+       u32 max_frame_size = adapter->max_frame_size;
+       struct e1000_hw *hw = &adapter->hw;
+       u16 pf_id = adapter->vfs_allocated_count;
+
+       if (adapter->vlgrp)
+               max_frame_size += VLAN_TAG_SIZE;
+
+       /* if vfs are enabled we set RLPML to the largest possible request
+        * size and set the VMOLR RLPML to the size we need */
+       if (pf_id) {
+               igb_set_vf_rlpml(adapter, max_frame_size, pf_id);
+               max_frame_size = MAX_STD_JUMBO_FRAME_SIZE + VLAN_TAG_SIZE;
+       }
+
+       wr32(E1000_RLPML, max_frame_size);
+}
+
+/**
+ * igb_configure_vt_default_pool - Configure VT default pool
+ * @adapter: board private structure
+ *
+ * Configure the default pool
+ **/
+static void igb_configure_vt_default_pool(struct igb_adapter *adapter)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       u16 pf_id = adapter->vfs_allocated_count;
+       u32 vtctl;
+
+       /* not in sr-iov mode - do nothing */
+       if (!pf_id)
+               return;
+
+       vtctl = rd32(E1000_VT_CTL);
+       vtctl &= ~(E1000_VT_CTL_DEFAULT_POOL_MASK |
+                  E1000_VT_CTL_DISABLE_DEF_POOL);
+       vtctl |= pf_id << E1000_VT_CTL_DEFAULT_POOL_SHIFT;
+       wr32(E1000_VT_CTL, vtctl);
+}
+
 /**
  * igb_configure_rx - Configure receive Unit after Reset
  * @adapter: board private structure
@@ -1894,7 +2112,7 @@ static void igb_configure_rx(struct igb_adapter *adapter)
        struct e1000_hw *hw = &adapter->hw;
        u32 rctl, rxcsum;
        u32 rxdctl;
-       int i, j;
+       int i;
 
        /* disable receives while setting up the descriptors */
        rctl = rd32(E1000_RCTL);
@@ -1908,14 +2126,14 @@ static void igb_configure_rx(struct igb_adapter *adapter)
        /* Setup the HW Rx Head and Tail Descriptor Pointers and
         * the Base and Length of the Rx Descriptor Ring */
        for (i = 0; i < adapter->num_rx_queues; i++) {
-               struct igb_ring *ring = &(adapter->rx_ring[i]);
-               j = ring->reg_idx;
+               struct igb_ring *ring = &adapter->rx_ring[i];
+               int j = ring->reg_idx;
                rdba = ring->dma;
                wr32(E1000_RDBAL(j),
-                               rdba & 0x00000000ffffffffULL);
+                    rdba & 0x00000000ffffffffULL);
                wr32(E1000_RDBAH(j), rdba >> 32);
                wr32(E1000_RDLEN(j),
-                              ring->count * sizeof(union e1000_adv_rx_desc));
+                    ring->count * sizeof(union e1000_adv_rx_desc));
 
                ring->head = E1000_RDH(j);
                ring->tail = E1000_RDT(j);
@@ -1929,16 +2147,6 @@ static void igb_configure_rx(struct igb_adapter *adapter)
                rxdctl |= IGB_RX_HTHRESH << 8;
                rxdctl |= IGB_RX_WTHRESH << 16;
                wr32(E1000_RXDCTL(j), rxdctl);
-#ifdef CONFIG_IGB_LRO
-               /* Intitial LRO Settings */
-               ring->lro_mgr.max_aggr = MAX_LRO_AGGR;
-               ring->lro_mgr.max_desc = MAX_LRO_DESCRIPTORS;
-               ring->lro_mgr.get_skb_header = igb_get_skb_hdr;
-               ring->lro_mgr.features = LRO_F_NAPI | LRO_F_EXTRACT_VLAN_ID;
-               ring->lro_mgr.dev = adapter->netdev;
-               ring->lro_mgr.ip_summed = CHECKSUM_UNNECESSARY;
-               ring->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
-#endif
        }
 
        if (adapter->num_rx_queues > 1) {
@@ -1963,7 +2171,10 @@ static void igb_configure_rx(struct igb_adapter *adapter)
                                writel(reta.dword,
                                       hw->hw_addr + E1000_RETA(0) + (j & ~3));
                }
-               mrqc = E1000_MRQC_ENABLE_RSS_4Q;
+               if (adapter->vfs_allocated_count)
+                       mrqc = E1000_MRQC_ENABLE_VMDQ_RSS_2Q;
+               else
+                       mrqc = E1000_MRQC_ENABLE_RSS_4Q;
 
                /* Fill out hash function seeds */
                for (j = 0; j < 10; j++)
@@ -1988,27 +2199,23 @@ static void igb_configure_rx(struct igb_adapter *adapter)
                rxcsum |= E1000_RXCSUM_PCSD;
                wr32(E1000_RXCSUM, rxcsum);
        } else {
+               /* Enable multi-queue for sr-iov */
+               if (adapter->vfs_allocated_count)
+                       wr32(E1000_MRQC, E1000_MRQC_ENABLE_VMDQ);
                /* Enable Receive Checksum Offload for TCP and UDP */
                rxcsum = rd32(E1000_RXCSUM);
-               if (adapter->rx_csum) {
-                       rxcsum |= E1000_RXCSUM_TUOFL;
+               if (adapter->rx_csum)
+                       rxcsum |= E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPPCSE;
+               else
+                       rxcsum &= ~(E1000_RXCSUM_TUOFL | E1000_RXCSUM_IPPCSE);
 
-                       /* Enable IPv4 payload checksum for UDP fragments
-                        * Must be used in conjunction with packet-split. */
-                       if (adapter->rx_ps_hdr_size)
-                               rxcsum |= E1000_RXCSUM_IPPCSE;
-               } else {
-                       rxcsum &= ~E1000_RXCSUM_TUOFL;
-                       /* don't need to clear IPPCSE as it defaults to 0 */
-               }
                wr32(E1000_RXCSUM, rxcsum);
        }
 
-       if (adapter->vlgrp)
-               wr32(E1000_RLPML,
-                               adapter->max_frame_size + VLAN_TAG_SIZE);
-       else
-               wr32(E1000_RLPML, adapter->max_frame_size);
+       /* Set the default pool for the PF's first queue */
+       igb_configure_vt_default_pool(adapter);
+
+       igb_rlpml_set(adapter);
 
        /* Enable Receives */
        wr32(E1000_RCTL, rctl);
@@ -2063,6 +2270,7 @@ static void igb_unmap_and_free_tx_resource(struct igb_adapter *adapter,
                buffer_info->skb = NULL;
        }
        buffer_info->time_stamp = 0;
+       buffer_info->next_to_watch = 0;
        /* buffer_info must be completely set up in the transmit path */
 }
 
@@ -2127,11 +2335,6 @@ void igb_free_rx_resources(struct igb_ring *rx_ring)
        vfree(rx_ring->buffer_info);
        rx_ring->buffer_info = NULL;
 
-#ifdef CONFIG_IGB_LRO
-       vfree(rx_ring->lro_mgr.lro_arr);
-       rx_ring->lro_mgr.lro_arr = NULL;
-#endif 
-
        pci_free_consistent(pdev, rx_ring->size, rx_ring->desc, rx_ring->dma);
 
        rx_ring->desc = NULL;
@@ -2231,15 +2434,18 @@ static void igb_clean_all_rx_rings(struct igb_adapter *adapter)
 static int igb_set_mac(struct net_device *netdev, void *p)
 {
        struct igb_adapter *adapter = netdev_priv(netdev);
+       struct e1000_hw *hw = &adapter->hw;
        struct sockaddr *addr = p;
 
        if (!is_valid_ether_addr(addr->sa_data))
                return -EADDRNOTAVAIL;
 
        memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
-       memcpy(adapter->hw.mac.addr, addr->sa_data, netdev->addr_len);
+       memcpy(hw->mac.addr, addr->sa_data, netdev->addr_len);
 
-       adapter->hw.mac.ops.rar_set(&adapter->hw, adapter->hw.mac.addr, 0);
+       hw->mac.ops.rar_set(hw, hw->mac.addr, 0);
+
+       igb_set_rah_pool(hw, adapter->vfs_allocated_count, 0);
 
        return 0;
 }
@@ -2282,8 +2488,8 @@ static void igb_set_multi(struct net_device *netdev)
 
        if (!netdev->mc_count) {
                /* nothing to program, so clear mc list */
-               igb_update_mc_addr_list_82575(hw, NULL, 0, 1,
-                                         mac->rar_entry_count);
+               igb_update_mc_addr_list(hw, NULL, 0, 1,
+                                       mac->rar_entry_count);
                return;
        }
 
@@ -2300,8 +2506,13 @@ static void igb_set_multi(struct net_device *netdev)
                memcpy(mta_list + (i*ETH_ALEN), mc_ptr->dmi_addr, ETH_ALEN);
                mc_ptr = mc_ptr->next;
        }
-       igb_update_mc_addr_list_82575(hw, mta_list, i, 1,
-                                     mac->rar_entry_count);
+       igb_update_mc_addr_list(hw, mta_list, i,
+                               adapter->vfs_allocated_count + 1,
+                               mac->rar_entry_count);
+
+       igb_set_mc_list_pools(adapter, i, mac->rar_entry_count);
+       igb_restore_vf_multicasts(adapter);
+
        kfree(mta_list);
 }
 
@@ -2313,6 +2524,46 @@ static void igb_update_phy_info(unsigned long data)
        igb_get_phy_info(&adapter->hw);
 }
 
+/**
+ * igb_has_link - check shared code for link and determine up/down
+ * @adapter: pointer to driver private info
+ **/
+static bool igb_has_link(struct igb_adapter *adapter)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       bool link_active = false;
+       s32 ret_val = 0;
+
+       /* get_link_status is set on LSC (link status) interrupt or
+        * rx sequence error interrupt.  get_link_status will stay
+        * false until the e1000_check_for_link establishes link
+        * for copper adapters ONLY
+        */
+       switch (hw->phy.media_type) {
+       case e1000_media_type_copper:
+               if (hw->mac.get_link_status) {
+                       ret_val = hw->mac.ops.check_for_link(hw);
+                       link_active = !hw->mac.get_link_status;
+               } else {
+                       link_active = true;
+               }
+               break;
+       case e1000_media_type_fiber:
+               ret_val = hw->mac.ops.check_for_link(hw);
+               link_active = !!(rd32(E1000_STATUS) & E1000_STATUS_LU);
+               break;
+       case e1000_media_type_internal_serdes:
+               ret_val = hw->mac.ops.check_for_link(hw);
+               link_active = hw->mac.serdes_has_link;
+               break;
+       default:
+       case e1000_media_type_unknown:
+               break;
+       }
+
+       return link_active;
+}
+
 /**
  * igb_watchdog - Timer Call-back
  * @data: pointer to adapter cast into an unsigned long
@@ -2329,34 +2580,16 @@ static void igb_watchdog_task(struct work_struct *work)
        struct igb_adapter *adapter = container_of(work,
                                        struct igb_adapter, watchdog_task);
        struct e1000_hw *hw = &adapter->hw;
-
        struct net_device *netdev = adapter->netdev;
        struct igb_ring *tx_ring = adapter->tx_ring;
-       struct e1000_mac_info *mac = &adapter->hw.mac;
        u32 link;
        u32 eics = 0;
-       s32 ret_val;
        int i;
 
-       if ((netif_carrier_ok(netdev)) &&
-           (rd32(E1000_STATUS) & E1000_STATUS_LU))
+       link = igb_has_link(adapter);
+       if ((netif_carrier_ok(netdev)) && link)
                goto link_up;
 
-       ret_val = hw->mac.ops.check_for_link(&adapter->hw);
-       if ((ret_val == E1000_ERR_PHY) &&
-           (hw->phy.type == e1000_phy_igp_3) &&
-           (rd32(E1000_CTRL) &
-            E1000_PHY_CTRL_GBE_DISABLE))
-               dev_info(&adapter->pdev->dev,
-                        "Gigabit has been disabled, downgrading speed\n");
-
-       if ((hw->phy.media_type == e1000_media_type_internal_serdes) &&
-           !(rd32(E1000_TXCW) & E1000_TXCW_ANE))
-               link = mac->serdes_has_link;
-       else
-               link = rd32(E1000_STATUS) &
-                                     E1000_STATUS_LU;
-
        if (link) {
                if (!netif_carrier_ok(netdev)) {
                        u32 ctrl;
@@ -2395,6 +2628,9 @@ static void igb_watchdog_task(struct work_struct *work)
                        netif_carrier_on(netdev);
                        netif_tx_wake_all_queues(netdev);
 
+                       igb_ping_all_vfs(adapter);
+
+                       /* link state has changed, schedule phy info update */
                        if (!test_bit(__IGB_DOWN, &adapter->state))
                                mod_timer(&adapter->phy_info_timer,
                                          round_jiffies(jiffies + 2 * HZ));
@@ -2408,6 +2644,10 @@ static void igb_watchdog_task(struct work_struct *work)
                               netdev->name);
                        netif_carrier_off(netdev);
                        netif_tx_stop_all_queues(netdev);
+
+                       igb_ping_all_vfs(adapter);
+
+                       /* link state has changed, schedule phy info update */
                        if (!test_bit(__IGB_DOWN, &adapter->state))
                                mod_timer(&adapter->phy_info_timer,
                                          round_jiffies(jiffies + 2 * HZ));
@@ -2417,9 +2657,9 @@ static void igb_watchdog_task(struct work_struct *work)
 link_up:
        igb_update_stats(adapter);
 
-       mac->tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
+       hw->mac.tx_packet_delta = adapter->stats.tpt - adapter->tpt_old;
        adapter->tpt_old = adapter->stats.tpt;
-       mac->collision_delta = adapter->stats.colc - adapter->colc_old;
+       hw->mac.collision_delta = adapter->stats.colc - adapter->colc_old;
        adapter->colc_old = adapter->stats.colc;
 
        adapter->gorc = adapter->stats.gorc - adapter->gorc_old;
@@ -2576,7 +2816,7 @@ static unsigned int igb_update_itr(struct igb_adapter *adapter, u16 itr_setting,
                if (bytes > 25000) {
                        if (packets > 35)
                                retval = low_latency;
-               } else if (bytes < 6000) {
+               } else if (bytes < 1500) {
                        retval = low_latency;
                }
                break;
@@ -2608,15 +2848,13 @@ static void igb_set_itr(struct igb_adapter *adapter)
                                            adapter->tx_itr,
                                            adapter->tx_ring->total_packets,
                                            adapter->tx_ring->total_bytes);
-
                current_itr = max(adapter->rx_itr, adapter->tx_itr);
        } else {
                current_itr = adapter->rx_itr;
        }
 
        /* conservative mode (itr 3) eliminates the lowest_latency setting */
-       if (adapter->itr_setting == 3 &&
-           current_itr == lowest_latency)
+       if (adapter->itr_setting == 3 && current_itr == lowest_latency)
                current_itr = low_latency;
 
        switch (current_itr) {
@@ -2668,6 +2906,7 @@ set_itr_now:
 #define IGB_TX_FLAGS_VLAN              0x00000002
 #define IGB_TX_FLAGS_TSO               0x00000004
 #define IGB_TX_FLAGS_IPV4              0x00000008
+#define IGB_TX_FLAGS_TSTAMP             0x00000010
 #define IGB_TX_FLAGS_VLAN_MASK 0xffff0000
 #define IGB_TX_FLAGS_VLAN_SHIFT        16
 
@@ -2733,7 +2972,7 @@ static inline int igb_tso_adv(struct igb_adapter *adapter,
        mss_l4len_idx = (skb_shinfo(skb)->gso_size << E1000_ADVTXD_MSS_SHIFT);
        mss_l4len_idx |= (l4len << E1000_ADVTXD_L4LEN_SHIFT);
 
-       /* Context index must be unique per ring. */
+       /* For 82575, context index must be unique per ring. */
        if (adapter->flags & IGB_FLAG_NEED_CTX_IDX)
                mss_l4len_idx |= tx_ring->queue_index << 4;
 
@@ -2779,12 +3018,12 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
 
                if (skb->ip_summed == CHECKSUM_PARTIAL) {
                        switch (skb->protocol) {
-                       case __constant_htons(ETH_P_IP):
+                       case cpu_to_be16(ETH_P_IP):
                                tu_cmd |= E1000_ADVTXD_TUCMD_IPV4;
                                if (ip_hdr(skb)->protocol == IPPROTO_TCP)
                                        tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
                                break;
-                       case __constant_htons(ETH_P_IPV6):
+                       case cpu_to_be16(ETH_P_IPV6):
                                /* XXX what about other V6 headers?? */
                                if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
                                        tu_cmd |= E1000_ADVTXD_TUCMD_L4T_TCP;
@@ -2803,6 +3042,8 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
                if (adapter->flags & IGB_FLAG_NEED_CTX_IDX)
                        context_desc->mss_l4len_idx =
                                cpu_to_le32(tx_ring->queue_index << 4);
+               else
+                       context_desc->mss_l4len_idx = 0;
 
                buffer_info->time_stamp = jiffies;
                buffer_info->next_to_watch = i;
@@ -2815,8 +3056,6 @@ static inline bool igb_tx_csum_adv(struct igb_adapter *adapter,
 
                return true;
        }
-
-
        return false;
 }
 
@@ -2893,6 +3132,9 @@ static inline void igb_tx_queue_adv(struct igb_adapter *adapter,
        if (tx_flags & IGB_TX_FLAGS_VLAN)
                cmd_type_len |= E1000_ADVTXD_DCMD_VLE;
 
+       if (tx_flags & IGB_TX_FLAGS_TSTAMP)
+               cmd_type_len |= E1000_ADVTXD_MAC_TSTAMP;
+
        if (tx_flags & IGB_TX_FLAGS_TSO) {
                cmd_type_len |= E1000_ADVTXD_DCMD_TSE;
 
@@ -2972,8 +3214,6 @@ static int igb_maybe_stop_tx(struct net_device *netdev,
        return __igb_maybe_stop_tx(netdev, tx_ring, size);
 }
 
-#define TXD_USE_COUNT(S) (((S) >> (IGB_MAX_TXD_PWR)) + 1)
-
 static int igb_xmit_frame_ring_adv(struct sk_buff *skb,
                                   struct net_device *netdev,
                                   struct igb_ring *tx_ring)
@@ -2981,11 +3221,9 @@ static int igb_xmit_frame_ring_adv(struct sk_buff *skb,
        struct igb_adapter *adapter = netdev_priv(netdev);
        unsigned int first;
        unsigned int tx_flags = 0;
-       unsigned int len;
        u8 hdr_len = 0;
        int tso = 0;
-
-       len = skb_headlen(skb);
+       union skb_shared_tx *shtx;
 
        if (test_bit(__IGB_DOWN, &adapter->state)) {
                dev_kfree_skb_any(skb);
@@ -3006,7 +3244,29 @@ static int igb_xmit_frame_ring_adv(struct sk_buff *skb,
                /* this is a hard error */
                return NETDEV_TX_BUSY;
        }
-       skb_orphan(skb);
+
+       /*
+        * TODO: check that there currently is no other packet with
+        * time stamping in the queue
+        *
+        * When doing time stamping, keep the connection to the socket
+        * a while longer: it is still needed by skb_hwtstamp_tx(),
+        * called either in igb_tx_hwtstamp() or by our caller when
+        * doing software time stamping.
+        */
+       shtx = skb_tx(skb);
+       if (unlikely(shtx->hardware)) {
+               shtx->in_progress = 1;
+               tx_flags |= IGB_TX_FLAGS_TSTAMP;
+       } else if (likely(!shtx->software)) {
+               /*
+                * TODO: can this be solved in dev.c:dev_hard_start_xmit()?
+                * There are probably unmodified driver which do something
+                * like this and thus don't work in combination with
+                * SOF_TIMESTAMPING_TX_SOFTWARE.
+                */
+               skb_orphan(skb);
+       }
 
        if (adapter->vlgrp && vlan_tx_tag_present(skb)) {
                tx_flags |= IGB_TX_FLAGS_VLAN;
@@ -3017,7 +3277,6 @@ static int igb_xmit_frame_ring_adv(struct sk_buff *skb,
                tx_flags |= IGB_TX_FLAGS_IPV4;
 
        first = tx_ring->next_to_use;
-
        tso = skb_is_gso(skb) ? igb_tso_adv(adapter, tx_ring, skb, tx_flags,
                                              &hdr_len) : 0;
 
@@ -3028,9 +3287,9 @@ static int igb_xmit_frame_ring_adv(struct sk_buff *skb,
 
        if (tso)
                tx_flags |= IGB_TX_FLAGS_TSO;
-       else if (igb_tx_csum_adv(adapter, tx_ring, skb, tx_flags))
-                       if (skb->ip_summed == CHECKSUM_PARTIAL)
-                               tx_flags |= IGB_TX_FLAGS_CSUM;
+       else if (igb_tx_csum_adv(adapter, tx_ring, skb, tx_flags) &&
+                (skb->ip_summed == CHECKSUM_PARTIAL))
+               tx_flags |= IGB_TX_FLAGS_CSUM;
 
        igb_tx_queue_adv(adapter, tx_ring, tx_flags,
                         igb_tx_map_adv(adapter, tx_ring, skb, first),
@@ -3050,7 +3309,7 @@ static int igb_xmit_frame_adv(struct sk_buff *skb, struct net_device *netdev)
        struct igb_ring *tx_ring;
 
        int r_idx = 0;
-       r_idx = skb->queue_mapping & (IGB_MAX_TX_QUEUES - 1);
+       r_idx = skb->queue_mapping & (IGB_ABS_MAX_TX_QUEUES - 1);
        tx_ring = adapter->multi_tx_table[r_idx];
 
        /* This goes back to the question of how to logically map a tx queue
@@ -3072,8 +3331,8 @@ static void igb_tx_timeout(struct net_device *netdev)
        /* Do the reset outside of interrupt context */
        adapter->tx_timeout_count++;
        schedule_work(&adapter->reset_task);
-       wr32(E1000_EICS, adapter->eims_enable_mask &
-               ~(E1000_EIMS_TCP_TIMER | E1000_EIMS_OTHER));
+       wr32(E1000_EICS,
+            (adapter->eims_enable_mask & ~adapter->eims_other));
 }
 
 static void igb_reset_task(struct work_struct *work)
@@ -3091,8 +3350,7 @@ static void igb_reset_task(struct work_struct *work)
  * Returns the address of the device statistics structure.
  * The statistics are actually updated from the timer callback.
  **/
-static struct net_device_stats *
-igb_get_stats(struct net_device *netdev)
+static struct net_device_stats *igb_get_stats(struct net_device *netdev)
 {
        struct igb_adapter *adapter = netdev_priv(netdev);
 
@@ -3118,7 +3376,6 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
                return -EINVAL;
        }
 
-#define MAX_STD_JUMBO_FRAME_SIZE 9234
        if (max_frame > MAX_STD_JUMBO_FRAME_SIZE) {
                dev_err(&adapter->pdev->dev, "MTU > 9216 not supported.\n");
                return -EINVAL;
@@ -3126,6 +3383,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
 
        while (test_and_set_bit(__IGB_RESETTING, &adapter->state))
                msleep(1);
+
        /* igb_down has a dependency on max_frame_size */
        adapter->max_frame_size = max_frame;
        if (netif_running(netdev))
@@ -3151,6 +3409,12 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
 #else
                adapter->rx_buffer_len = PAGE_SIZE / 2;
 #endif
+
+       /* if sr-iov is enabled we need to force buffer size to 1K or larger */
+       if (adapter->vfs_allocated_count &&
+           (adapter->rx_buffer_len < IGB_RXBUFFER_1024))
+               adapter->rx_buffer_len = IGB_RXBUFFER_1024;
+
        /* adjust allocation if LPE protects us, and we aren't using SBP */
        if ((max_frame == ETH_FRAME_LEN + ETH_FCS_LEN) ||
             (max_frame == MAXIMUM_ETHERNET_VLAN_SIZE))
@@ -3295,8 +3559,7 @@ void igb_update_stats(struct igb_adapter *adapter)
        /* Phy Stats */
        if (hw->phy.media_type == e1000_media_type_copper) {
                if ((adapter->link_speed == SPEED_1000) &&
-                  (!igb_read_phy_reg(hw, PHY_1000T_STATUS,
-                                             &phy_tmp))) {
+                  (!igb_read_phy_reg(hw, PHY_1000T_STATUS, &phy_tmp))) {
                        phy_tmp &= PHY_IDLE_ERROR_COUNT_MASK;
                        adapter->phy_stats.idle_errors += phy_tmp;
                }
@@ -3308,7 +3571,6 @@ void igb_update_stats(struct igb_adapter *adapter)
        adapter->stats.mgpdc += rd32(E1000_MGTPDC);
 }
 
-
 static irqreturn_t igb_msix_other(int irq, void *data)
 {
        struct net_device *netdev = data;
@@ -3317,15 +3579,24 @@ static irqreturn_t igb_msix_other(int irq, void *data)
        u32 icr = rd32(E1000_ICR);
 
        /* reading ICR causes bit 31 of EICR to be cleared */
-       if (!(icr & E1000_ICR_LSC))
-               goto no_link_interrupt;
-       hw->mac.get_link_status = 1;
-       /* guard against interrupt when we're going down */
-       if (!test_bit(__IGB_DOWN, &adapter->state))
-               mod_timer(&adapter->watchdog_timer, jiffies + 1);
-       
-no_link_interrupt:
-       wr32(E1000_IMS, E1000_IMS_LSC);
+
+       if(icr & E1000_ICR_DOUTSYNC) {
+               /* HW is reporting DMA is out of sync */
+               adapter->stats.doosync++;
+       }
+
+       /* Check for a mailbox event */
+       if (icr & E1000_ICR_VMMB)
+               igb_msg_task(adapter);
+
+       if (icr & E1000_ICR_LSC) {
+               hw->mac.get_link_status = 1;
+               /* guard against interrupt when we're going down */
+               if (!test_bit(__IGB_DOWN, &adapter->state))
+                       mod_timer(&adapter->watchdog_timer, jiffies + 1);
+       }
+
+       wr32(E1000_IMS, E1000_IMS_LSC | E1000_IMS_DOUTSYNC | E1000_IMS_VMMB);
        wr32(E1000_EIMS, adapter->eims_other);
 
        return IRQ_HANDLED;
@@ -3341,6 +3612,7 @@ static irqreturn_t igb_msix_tx(int irq, void *data)
        if (adapter->flags & IGB_FLAG_DCA_ENABLED)
                igb_update_tx_dca(tx_ring);
 #endif
+
        tx_ring->total_bytes = 0;
        tx_ring->total_packets = 0;
 
@@ -3361,13 +3633,11 @@ static void igb_write_itr(struct igb_ring *ring)
        if ((ring->adapter->itr_setting & 3) && ring->set_itr) {
                switch (hw->mac.type) {
                case e1000_82576:
-                       wr32(ring->itr_register,
-                            ring->itr_val |
+                       wr32(ring->itr_register, ring->itr_val |
                             0x80000000);
                        break;
                default:
-                       wr32(ring->itr_register,
-                            ring->itr_val |
+                       wr32(ring->itr_register, ring->itr_val |
                             (ring->itr_val << 16));
                        break;
                }
@@ -3385,8 +3655,8 @@ static irqreturn_t igb_msix_rx(int irq, void *data)
 
        igb_write_itr(rx_ring);
 
-       if (netif_rx_schedule_prep(&rx_ring->napi))
-               __netif_rx_schedule(&rx_ring->napi);
+       if (napi_schedule_prep(&rx_ring->napi))
+               __napi_schedule(&rx_ring->napi);
 
 #ifdef CONFIG_IGB_DCA
        if (rx_ring->adapter->flags & IGB_FLAG_DCA_ENABLED)
@@ -3479,7 +3749,7 @@ static int __igb_notify_dca(struct device *dev, void *data)
                        break;
                /* Always use CB2 mode, difference is masked
                 * in the CB driver. */
-               wr32(E1000_DCA_CTRL, 2);
+               wr32(E1000_DCA_CTRL, E1000_DCA_CTRL_DCA_MODE_CB2);
                if (dca_add_requester(dev) == 0) {
                        adapter->flags |= IGB_FLAG_DCA_ENABLED;
                        dev_info(&adapter->pdev->dev, "DCA enabled\n");
@@ -3494,7 +3764,7 @@ static int __igb_notify_dca(struct device *dev, void *data)
                        dca_remove_requester(dev);
                        dev_info(&adapter->pdev->dev, "DCA disabled\n");
                        adapter->flags &= ~IGB_FLAG_DCA_ENABLED;
-                       wr32(E1000_DCA_CTRL, 1);
+                       wr32(E1000_DCA_CTRL, E1000_DCA_CTRL_DCA_MODE_DISABLE);
                }
                break;
        }
@@ -3514,114 +3784,417 @@ static int igb_notify_dca(struct notifier_block *nb, unsigned long event,
 }
 #endif /* CONFIG_IGB_DCA */
 
-/**
- * igb_intr_msi - Interrupt Handler
- * @irq: interrupt number
- * @data: pointer to a network interface device structure
- **/
-static irqreturn_t igb_intr_msi(int irq, void *data)
+static void igb_ping_all_vfs(struct igb_adapter *adapter)
 {
-       struct net_device *netdev = data;
-       struct igb_adapter *adapter = netdev_priv(netdev);
        struct e1000_hw *hw = &adapter->hw;
-       /* read ICR disables interrupts using IAM */
-       u32 icr = rd32(E1000_ICR);
-
-       igb_write_itr(adapter->rx_ring);
+       u32 ping;
+       int i;
 
-       if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
-               hw->mac.get_link_status = 1;
-               if (!test_bit(__IGB_DOWN, &adapter->state))
-                       mod_timer(&adapter->watchdog_timer, jiffies + 1);
+       for (i = 0 ; i < adapter->vfs_allocated_count; i++) {
+               ping = E1000_PF_CONTROL_MSG;
+               if (adapter->vf_data[i].clear_to_send)
+                       ping |= E1000_VT_MSGTYPE_CTS;
+               igb_write_mbx(hw, &ping, 1, i);
        }
-
-       netif_rx_schedule(&adapter->rx_ring[0].napi);
-
-       return IRQ_HANDLED;
 }
 
-/**
- * igb_intr - Interrupt Handler
- * @irq: interrupt number
- * @data: pointer to a network interface device structure
- **/
-static irqreturn_t igb_intr(int irq, void *data)
+static int igb_set_vf_multicasts(struct igb_adapter *adapter,
+                                 u32 *msgbuf, u32 vf)
 {
-       struct net_device *netdev = data;
-       struct igb_adapter *adapter = netdev_priv(netdev);
-       struct e1000_hw *hw = &adapter->hw;
-       /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked.  No
-        * need for the IMC write */
-       u32 icr = rd32(E1000_ICR);
-       u32 eicr = 0;
-       if (!icr)
-               return IRQ_NONE;  /* Not our interrupt */
+       int n = (msgbuf[0] & E1000_VT_MSGINFO_MASK) >> E1000_VT_MSGINFO_SHIFT;
+       u16 *hash_list = (u16 *)&msgbuf[1];
+       struct vf_data_storage *vf_data = &adapter->vf_data[vf];
+       int i;
 
-       igb_write_itr(adapter->rx_ring);
+       /* only up to 30 hash values supported */
+       if (n > 30)
+               n = 30;
 
-       /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
-        * not set, then the adapter didn't send an interrupt */
-       if (!(icr & E1000_ICR_INT_ASSERTED))
-               return IRQ_NONE;
+       /* salt away the number of multi cast addresses assigned
+        * to this VF for later use to restore when the PF multi cast
+        * list changes
+        */
+       vf_data->num_vf_mc_hashes = n;
 
-       eicr = rd32(E1000_EICR);
+       /* VFs are limited to using the MTA hash table for their multicast
+        * addresses */
+       for (i = 0; i < n; i++)
+               vf_data->vf_mc_hashes[i] = hash_list[i];;
 
-       if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
+       /* Flush and reset the mta with the new values */
+       igb_set_multi(adapter->netdev);
+
+       return 0;
+}
+
+static void igb_restore_vf_multicasts(struct igb_adapter *adapter)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       struct vf_data_storage *vf_data;
+       int i, j;
+
+       for (i = 0; i < adapter->vfs_allocated_count; i++) {
+               vf_data = &adapter->vf_data[i];
+               for (j = 0; j < vf_data[i].num_vf_mc_hashes; j++)
+                       igb_mta_set(hw, vf_data->vf_mc_hashes[j]);
+       }
+}
+
+static void igb_clear_vf_vfta(struct igb_adapter *adapter, u32 vf)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       u32 pool_mask, reg, vid;
+       int i;
+
+       pool_mask = 1 << (E1000_VLVF_POOLSEL_SHIFT + vf);
+
+       /* Find the vlan filter for this id */
+       for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) {
+               reg = rd32(E1000_VLVF(i));
+
+               /* remove the vf from the pool */
+               reg &= ~pool_mask;
+
+               /* if pool is empty then remove entry from vfta */
+               if (!(reg & E1000_VLVF_POOLSEL_MASK) &&
+                   (reg & E1000_VLVF_VLANID_ENABLE)) {
+                       reg = 0;
+                       vid = reg & E1000_VLVF_VLANID_MASK;
+                       igb_vfta_set(hw, vid, false);
+               }
+
+               wr32(E1000_VLVF(i), reg);
+       }
+}
+
+static s32 igb_vlvf_set(struct igb_adapter *adapter, u32 vid, bool add, u32 vf)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       u32 reg, i;
+
+       /* It is an error to call this function when VFs are not enabled */
+       if (!adapter->vfs_allocated_count)
+               return -1;
+
+       /* Find the vlan filter for this id */
+       for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) {
+               reg = rd32(E1000_VLVF(i));
+               if ((reg & E1000_VLVF_VLANID_ENABLE) &&
+                   vid == (reg & E1000_VLVF_VLANID_MASK))
+                       break;
+       }
+
+       if (add) {
+               if (i == E1000_VLVF_ARRAY_SIZE) {
+                       /* Did not find a matching VLAN ID entry that was
+                        * enabled.  Search for a free filter entry, i.e.
+                        * one without the enable bit set
+                        */
+                       for (i = 0; i < E1000_VLVF_ARRAY_SIZE; i++) {
+                               reg = rd32(E1000_VLVF(i));
+                               if (!(reg & E1000_VLVF_VLANID_ENABLE))
+                                       break;
+                       }
+               }
+               if (i < E1000_VLVF_ARRAY_SIZE) {
+                       /* Found an enabled/available entry */
+                       reg |= 1 << (E1000_VLVF_POOLSEL_SHIFT + vf);
+
+                       /* if !enabled we need to set this up in vfta */
+                       if (!(reg & E1000_VLVF_VLANID_ENABLE)) {
+                               /* add VID to filter table */
+                               igb_vfta_set(hw, vid, true);
+                               reg |= E1000_VLVF_VLANID_ENABLE;
+                       }
+
+                       wr32(E1000_VLVF(i), reg);
+                       return 0;
+               }
+       } else {
+               if (i < E1000_VLVF_ARRAY_SIZE) {
+                       /* remove vf from the pool */
+                       reg &= ~(1 << (E1000_VLVF_POOLSEL_SHIFT + vf));
+                       /* if pool is empty then remove entry from vfta */
+                       if (!(reg & E1000_VLVF_POOLSEL_MASK)) {
+                               reg = 0;
+                               igb_vfta_set(hw, vid, false);
+                       }
+                       wr32(E1000_VLVF(i), reg);
+                       return 0;
+               }
+       }
+       return -1;
+}
+
+static int igb_set_vf_vlan(struct igb_adapter *adapter, u32 *msgbuf, u32 vf)
+{
+       int add = (msgbuf[0] & E1000_VT_MSGINFO_MASK) >> E1000_VT_MSGINFO_SHIFT;
+       int vid = (msgbuf[1] & E1000_VLVF_VLANID_MASK);
+
+       return igb_vlvf_set(adapter, vid, add, vf);
+}
+
+static inline void igb_vf_reset_event(struct igb_adapter *adapter, u32 vf)
+{
+       struct e1000_hw *hw = &adapter->hw;
+
+       /* disable mailbox functionality for vf */
+       adapter->vf_data[vf].clear_to_send = false;
+
+       /* reset offloads to defaults */
+       igb_set_vmolr(hw, vf);
+
+       /* reset vlans for device */
+       igb_clear_vf_vfta(adapter, vf);
+
+       /* reset multicast table array for vf */
+       adapter->vf_data[vf].num_vf_mc_hashes = 0;
+
+       /* Flush and reset the mta with the new values */
+       igb_set_multi(adapter->netdev);
+}
+
+static inline void igb_vf_reset_msg(struct igb_adapter *adapter, u32 vf)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       unsigned char *vf_mac = adapter->vf_data[vf].vf_mac_addresses;
+       u32 reg, msgbuf[3];
+       u8 *addr = (u8 *)(&msgbuf[1]);
+
+       /* process all the same items cleared in a function level reset */
+       igb_vf_reset_event(adapter, vf);
+
+       /* set vf mac address */
+       igb_rar_set(hw, vf_mac, vf + 1);
+       igb_set_rah_pool(hw, vf, vf + 1);
+
+       /* enable transmit and receive for vf */
+       reg = rd32(E1000_VFTE);
+       wr32(E1000_VFTE, reg | (1 << vf));
+       reg = rd32(E1000_VFRE);
+       wr32(E1000_VFRE, reg | (1 << vf));
+
+       /* enable mailbox functionality for vf */
+       adapter->vf_data[vf].clear_to_send = true;
+
+       /* reply to reset with ack and vf mac address */
+       msgbuf[0] = E1000_VF_RESET | E1000_VT_MSGTYPE_ACK;
+       memcpy(addr, vf_mac, 6);
+       igb_write_mbx(hw, msgbuf, 3, vf);
+}
+
+static int igb_set_vf_mac_addr(struct igb_adapter *adapter, u32 *msg, int vf)
+{
+               unsigned char *addr = (char *)&msg[1];
+               int err = -1;
+
+               if (is_valid_ether_addr(addr))
+                       err = igb_set_vf_mac(adapter, vf, addr);
+
+               return err;
+
+}
+
+static void igb_rcv_ack_from_vf(struct igb_adapter *adapter, u32 vf)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       u32 msg = E1000_VT_MSGTYPE_NACK;
+
+       /* if device isn't clear to send it shouldn't be reading either */
+       if (!adapter->vf_data[vf].clear_to_send)
+               igb_write_mbx(hw, &msg, 1, vf);
+}
+
+
+static void igb_msg_task(struct igb_adapter *adapter)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       u32 vf;
+
+       for (vf = 0; vf < adapter->vfs_allocated_count; vf++) {
+               /* process any reset requests */
+               if (!igb_check_for_rst(hw, vf)) {
+                       adapter->vf_data[vf].clear_to_send = false;
+                       igb_vf_reset_event(adapter, vf);
+               }
+
+               /* process any messages pending */
+               if (!igb_check_for_msg(hw, vf))
+                       igb_rcv_msg_from_vf(adapter, vf);
+
+               /* process any acks */
+               if (!igb_check_for_ack(hw, vf))
+                       igb_rcv_ack_from_vf(adapter, vf);
+
+       }
+}
+
+static int igb_rcv_msg_from_vf(struct igb_adapter *adapter, u32 vf)
+{
+       u32 mbx_size = E1000_VFMAILBOX_SIZE;
+       u32 msgbuf[mbx_size];
+       struct e1000_hw *hw = &adapter->hw;
+       s32 retval;
+
+       retval = igb_read_mbx(hw, msgbuf, mbx_size, vf);
+
+       if (retval)
+               dev_err(&adapter->pdev->dev,
+                       "Error receiving message from VF\n");
+
+       /* this is a message we already processed, do nothing */
+       if (msgbuf[0] & (E1000_VT_MSGTYPE_ACK | E1000_VT_MSGTYPE_NACK))
+               return retval;
+
+       /*
+        * until the vf completes a reset it should not be
+        * allowed to start any configuration.
+        */
+
+       if (msgbuf[0] == E1000_VF_RESET) {
+               igb_vf_reset_msg(adapter, vf);
+
+               return retval;
+       }
+
+       if (!adapter->vf_data[vf].clear_to_send) {
+               msgbuf[0] |= E1000_VT_MSGTYPE_NACK;
+               igb_write_mbx(hw, msgbuf, 1, vf);
+               return retval;
+       }
+
+       switch ((msgbuf[0] & 0xFFFF)) {
+       case E1000_VF_SET_MAC_ADDR:
+               retval = igb_set_vf_mac_addr(adapter, msgbuf, vf);
+               break;
+       case E1000_VF_SET_MULTICAST:
+               retval = igb_set_vf_multicasts(adapter, msgbuf, vf);
+               break;
+       case E1000_VF_SET_LPE:
+               retval = igb_set_vf_rlpml(adapter, msgbuf[1], vf);
+               break;
+       case E1000_VF_SET_VLAN:
+               retval = igb_set_vf_vlan(adapter, msgbuf, vf);
+               break;
+       default:
+               dev_err(&adapter->pdev->dev, "Unhandled Msg %08x\n", msgbuf[0]);
+               retval = -1;
+               break;
+       }
+
+       /* notify the VF of the results of what it sent us */
+       if (retval)
+               msgbuf[0] |= E1000_VT_MSGTYPE_NACK;
+       else
+               msgbuf[0] |= E1000_VT_MSGTYPE_ACK;
+
+       msgbuf[0] |= E1000_VT_MSGTYPE_CTS;
+
+       igb_write_mbx(hw, msgbuf, 1, vf);
+
+       return retval;
+}
+
+/**
+ * igb_intr_msi - Interrupt Handler
+ * @irq: interrupt number
+ * @data: pointer to a network interface device structure
+ **/
+static irqreturn_t igb_intr_msi(int irq, void *data)
+{
+       struct net_device *netdev = data;
+       struct igb_adapter *adapter = netdev_priv(netdev);
+       struct e1000_hw *hw = &adapter->hw;
+       /* read ICR disables interrupts using IAM */
+       u32 icr = rd32(E1000_ICR);
+
+       igb_write_itr(adapter->rx_ring);
+
+       if(icr & E1000_ICR_DOUTSYNC) {
+               /* HW is reporting DMA is out of sync */
+               adapter->stats.doosync++;
+       }
+
+       if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
                hw->mac.get_link_status = 1;
-               /* guard against interrupt when we're going down */
                if (!test_bit(__IGB_DOWN, &adapter->state))
                        mod_timer(&adapter->watchdog_timer, jiffies + 1);
        }
 
-       netif_rx_schedule(&adapter->rx_ring[0].napi);
+       napi_schedule(&adapter->rx_ring[0].napi);
 
        return IRQ_HANDLED;
 }
 
 /**
- * igb_poll - NAPI Rx polling callback
- * @napi: napi polling structure
- * @budget: count of how many packets we should handle
+ * igb_intr - Legacy Interrupt Handler
+ * @irq: interrupt number
+ * @data: pointer to a network interface device structure
  **/
-static int igb_poll(struct napi_struct *napi, int budget)
+static irqreturn_t igb_intr(int irq, void *data)
 {
-       struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi);
-       struct igb_adapter *adapter = rx_ring->adapter;
-       struct net_device *netdev = adapter->netdev;
-       int tx_clean_complete, work_done = 0;
+       struct net_device *netdev = data;
+       struct igb_adapter *adapter = netdev_priv(netdev);
+       struct e1000_hw *hw = &adapter->hw;
+       /* Interrupt Auto-Mask...upon reading ICR, interrupts are masked.  No
+        * need for the IMC write */
+       u32 icr = rd32(E1000_ICR);
+       if (!icr)
+               return IRQ_NONE;  /* Not our interrupt */
 
-       /* this poll routine only supports one tx and one rx queue */
-#ifdef CONFIG_IGB_DCA
-       if (adapter->flags & IGB_FLAG_DCA_ENABLED)
-               igb_update_tx_dca(&adapter->tx_ring[0]);
-#endif
-       tx_clean_complete = igb_clean_tx_irq(&adapter->tx_ring[0]);
+       igb_write_itr(adapter->rx_ring);
 
-#ifdef CONFIG_IGB_DCA
-       if (adapter->flags & IGB_FLAG_DCA_ENABLED)
-               igb_update_rx_dca(&adapter->rx_ring[0]);
-#endif
-       igb_clean_rx_irq_adv(&adapter->rx_ring[0], &work_done, budget);
+       /* IMS will not auto-mask if INT_ASSERTED is not set, and if it is
+        * not set, then the adapter didn't send an interrupt */
+       if (!(icr & E1000_ICR_INT_ASSERTED))
+               return IRQ_NONE;
 
-       /* If no Tx and not enough Rx work done, exit the polling mode */
-       if ((tx_clean_complete && (work_done < budget)) ||
-           !netif_running(netdev)) {
-               if (adapter->itr_setting & 3)
-                       igb_set_itr(adapter);
-               netif_rx_complete(napi);
+       if(icr & E1000_ICR_DOUTSYNC) {
+               /* HW is reporting DMA is out of sync */
+               adapter->stats.doosync++;
+       }
+
+       if (icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) {
+               hw->mac.get_link_status = 1;
+               /* guard against interrupt when we're going down */
                if (!test_bit(__IGB_DOWN, &adapter->state))
-                       igb_irq_enable(adapter);
-               return 0;
+                       mod_timer(&adapter->watchdog_timer, jiffies + 1);
        }
 
-       return 1;
+       napi_schedule(&adapter->rx_ring[0].napi);
+
+       return IRQ_HANDLED;
 }
 
-static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget)
+static inline void igb_rx_irq_enable(struct igb_ring *rx_ring)
 {
-       struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi);
        struct igb_adapter *adapter = rx_ring->adapter;
        struct e1000_hw *hw = &adapter->hw;
+
+       if (adapter->itr_setting & 3) {
+               if (adapter->num_rx_queues == 1)
+                       igb_set_itr(adapter);
+               else
+                       igb_update_ring_itr(rx_ring);
+       }
+
+       if (!test_bit(__IGB_DOWN, &adapter->state)) {
+               if (adapter->msix_entries)
+                       wr32(E1000_EIMS, rx_ring->eims_value);
+               else
+                       igb_irq_enable(adapter);
+       }
+}
+
+/**
+ * igb_poll - NAPI Rx polling callback
+ * @napi: napi polling structure
+ * @budget: count of how many packets we should handle
+ **/
+static int igb_poll(struct napi_struct *napi, int budget)
+{
+       struct igb_ring *rx_ring = container_of(napi, struct igb_ring, napi);
+       struct igb_adapter *adapter = rx_ring->adapter;
        struct net_device *netdev = adapter->netdev;
        int work_done = 0;
 
@@ -3631,25 +4204,59 @@ static int igb_clean_rx_ring_msix(struct napi_struct *napi, int budget)
 #endif
        igb_clean_rx_irq_adv(rx_ring, &work_done, budget);
 
+       if (rx_ring->buddy) {
+#ifdef CONFIG_IGB_DCA
+               if (adapter->flags & IGB_FLAG_DCA_ENABLED)
+                       igb_update_tx_dca(rx_ring->buddy);
+#endif
+               if (!igb_clean_tx_irq(rx_ring->buddy))
+                       work_done = budget;
+       }
 
        /* If not enough Rx work done, exit the polling mode */
-       if ((work_done == 0) || !netif_running(netdev)) {
-               netif_rx_complete(napi);
+       if ((work_done < budget) || !netif_running(netdev)) {
+               napi_complete(napi);
+               igb_rx_irq_enable(rx_ring);
+       }
 
-               if (adapter->itr_setting & 3) {
-                       if (adapter->num_rx_queues == 1)
-                               igb_set_itr(adapter);
-                       else
-                               igb_update_ring_itr(rx_ring);
-               }
+       return work_done;
+}
 
-               if (!test_bit(__IGB_DOWN, &adapter->state))
-                       wr32(E1000_EIMS, rx_ring->eims_value);
+/**
+ * igb_hwtstamp - utility function which checks for TX time stamp
+ * @adapter: board private structure
+ * @skb: packet that was just sent
+ *
+ * If we were asked to do hardware stamping and such a time stamp is
+ * available, then it must have been for this skb here because we only
+ * allow only one such packet into the queue.
+ */
+static void igb_tx_hwtstamp(struct igb_adapter *adapter, struct sk_buff *skb)
+{
+       union skb_shared_tx *shtx = skb_tx(skb);
+       struct e1000_hw *hw = &adapter->hw;
 
-               return 0;
-       }
+       if (unlikely(shtx->hardware)) {
+               u32 valid = rd32(E1000_TSYNCTXCTL) & E1000_TSYNCTXCTL_VALID;
+               if (valid) {
+                       u64 regval = rd32(E1000_TXSTMPL);
+                       u64 ns;
+                       struct skb_shared_hwtstamps shhwtstamps;
+
+                       memset(&shhwtstamps, 0, sizeof(shhwtstamps));
+                       regval |= (u64)rd32(E1000_TXSTMPH) << 32;
+                       ns = timecounter_cyc2time(&adapter->clock,
+                                                 regval);
+                       timecompare_update(&adapter->compare, ns);
+                       shhwtstamps.hwtstamp = ns_to_ktime(ns);
+                       shhwtstamps.syststamp =
+                               timecompare_transform(&adapter->compare, ns);
+                       skb_tstamp_tx(skb, &shhwtstamps);
+               }
 
-       return 1;
+               /* delayed orphaning: skb_tstamp_tx() needs the socket */
+               skb_orphan(skb);
+       }
 }
 
 /**
@@ -3690,6 +4297,8 @@ static bool igb_clean_tx_irq(struct igb_ring *tx_ring)
                                            skb->len;
                                total_packets += segs;
                                total_bytes += bytecount;
+
+                               igb_tx_hwtstamp(adapter, skb);
                        }
 
                        igb_unmap_and_free_tx_resource(adapter, buffer_info);
@@ -3699,7 +4308,6 @@ static bool igb_clean_tx_irq(struct igb_ring *tx_ring)
                        if (i == tx_ring->count)
                                i = 0;
                }
-
                eop = tx_ring->buffer_info[i].next_to_watch;
                eop_desc = E1000_TX_DESC_ADV(*tx_ring, eop);
        }
@@ -3764,44 +4372,11 @@ static bool igb_clean_tx_irq(struct igb_ring *tx_ring)
        return (count < tx_ring->count);
 }
 
-#ifdef CONFIG_IGB_LRO
- /**
- * igb_get_skb_hdr - helper function for LRO header processing
- * @skb: pointer to sk_buff to be added to LRO packet
- * @iphdr: pointer to ip header structure
- * @tcph: pointer to tcp header structure
- * @hdr_flags: pointer to header flags
- * @priv: pointer to the receive descriptor for the current sk_buff
- **/
-static int igb_get_skb_hdr(struct sk_buff *skb, void **iphdr, void **tcph,
-                           u64 *hdr_flags, void *priv)
-{
-       union e1000_adv_rx_desc *rx_desc = priv;
-       u16 pkt_type = rx_desc->wb.lower.lo_dword.pkt_info &
-                      (E1000_RXDADV_PKTTYPE_IPV4 | E1000_RXDADV_PKTTYPE_TCP);
-
-       /* Verify that this is a valid IPv4 TCP packet */
-       if (pkt_type != (E1000_RXDADV_PKTTYPE_IPV4 |
-                         E1000_RXDADV_PKTTYPE_TCP))
-               return -1;
-
-       /* Set network headers */
-       skb_reset_network_header(skb);
-       skb_set_transport_header(skb, ip_hdrlen(skb));
-       *iphdr = ip_hdr(skb);
-       *tcph = tcp_hdr(skb);
-       *hdr_flags = LRO_IPV4 | LRO_TCP;
-
-       return 0;
-
-}
-#endif /* CONFIG_IGB_LRO */
-
 /**
  * igb_receive_skb - helper function to handle rx indications
- * @ring: pointer to receive ring receving this packet 
+ * @ring: pointer to receive ring receving this packet
  * @status: descriptor status field as written by hardware
- * @vlan: descriptor vlan field as written by hardware (no le/be conversion)
+ * @rx_desc: receive descriptor containing vlan and type information.
  * @skb: pointer to sk_buff to be indicated to stack
  **/
 static void igb_receive_skb(struct igb_ring *ring, u8 status,
@@ -3811,31 +4386,23 @@ static void igb_receive_skb(struct igb_ring *ring, u8 status,
        struct igb_adapter * adapter = ring->adapter;
        bool vlan_extracted = (adapter->vlgrp && (status & E1000_RXD_STAT_VP));
 
-#ifdef CONFIG_IGB_LRO
-       if (adapter->netdev->features & NETIF_F_LRO &&
-           skb->ip_summed == CHECKSUM_UNNECESSARY) {
+       skb_record_rx_queue(skb, ring->queue_index);
+       if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
                if (vlan_extracted)
-                       lro_vlan_hwaccel_receive_skb(&ring->lro_mgr, skb,
-                                          adapter->vlgrp,
-                                          le16_to_cpu(rx_desc->wb.upper.vlan),
-                                          rx_desc);
+                       vlan_gro_receive(&ring->napi, adapter->vlgrp,
+                                        le16_to_cpu(rx_desc->wb.upper.vlan),
+                                        skb);
                else
-                       lro_receive_skb(&ring->lro_mgr,skb, rx_desc);
-               ring->lro_used = 1;
+                       napi_gro_receive(&ring->napi, skb);
        } else {
-#endif
                if (vlan_extracted)
                        vlan_hwaccel_receive_skb(skb, adapter->vlgrp,
                                          le16_to_cpu(rx_desc->wb.upper.vlan));
                else
-
                        netif_receive_skb(skb);
-#ifdef CONFIG_IGB_LRO
        }
-#endif
 }
 
-
 static inline void igb_rx_checksum_adv(struct igb_adapter *adapter,
                                       u32 status_err, struct sk_buff *skb)
 {
@@ -3863,17 +4430,19 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
 {
        struct igb_adapter *adapter = rx_ring->adapter;
        struct net_device *netdev = adapter->netdev;
+       struct e1000_hw *hw = &adapter->hw;
        struct pci_dev *pdev = adapter->pdev;
        union e1000_adv_rx_desc *rx_desc , *next_rxd;
        struct igb_buffer *buffer_info , *next_buffer;
        struct sk_buff *skb;
-       unsigned int i;
-       u32 length, hlen, staterr;
        bool cleaned = false;
        int cleaned_count = 0;
        unsigned int total_bytes = 0, total_packets = 0;
+       unsigned int i;
+       u32 length, hlen, staterr;
 
        i = rx_ring->next_to_clean;
+       buffer_info = &rx_ring->buffer_info[i];
        rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
        staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
 
@@ -3881,25 +4450,22 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
                if (*work_done >= budget)
                        break;
                (*work_done)++;
-               buffer_info = &rx_ring->buffer_info[i];
 
-               /* HW will not DMA in data larger than the given buffer, even
-                * if it parses the (NFS, of course) header to be larger.  In
-                * that case, it fills the header buffer and spills the rest
-                * into the page.
-                */
-               hlen = (le16_to_cpu(rx_desc->wb.lower.lo_dword.hdr_info) &
-                 E1000_RXDADV_HDRBUFLEN_MASK) >> E1000_RXDADV_HDRBUFLEN_SHIFT;
-               if (hlen > adapter->rx_ps_hdr_size)
-                       hlen = adapter->rx_ps_hdr_size;
+               skb = buffer_info->skb;
+               prefetch(skb->data - NET_IP_ALIGN);
+               buffer_info->skb = NULL;
+
+               i++;
+               if (i == rx_ring->count)
+                       i = 0;
+               next_rxd = E1000_RX_DESC_ADV(*rx_ring, i);
+               prefetch(next_rxd);
+               next_buffer = &rx_ring->buffer_info[i];
 
                length = le16_to_cpu(rx_desc->wb.upper.length);
                cleaned = true;
                cleaned_count++;
 
-               skb = buffer_info->skb;
-               prefetch(skb->data - NET_IP_ALIGN);
-               buffer_info->skb = NULL;
                if (!adapter->rx_ps_hdr_size) {
                        pci_unmap_single(pdev, buffer_info->dma,
                                         adapter->rx_buffer_len +
@@ -3909,10 +4475,19 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
                        goto send_up;
                }
 
+               /* HW will not DMA in data larger than the given buffer, even
+                * if it parses the (NFS, of course) header to be larger.  In
+                * that case, it fills the header buffer and spills the rest
+                * into the page.
+                */
+               hlen = (le16_to_cpu(rx_desc->wb.lower.lo_dword.hdr_info) &
+                 E1000_RXDADV_HDRBUFLEN_MASK) >> E1000_RXDADV_HDRBUFLEN_SHIFT;
+               if (hlen > adapter->rx_ps_hdr_size)
+                       hlen = adapter->rx_ps_hdr_size;
+
                if (!skb_shinfo(skb)->nr_frags) {
                        pci_unmap_single(pdev, buffer_info->dma,
-                                        adapter->rx_ps_hdr_size +
-                                          NET_IP_ALIGN,
+                                        adapter->rx_ps_hdr_size + NET_IP_ALIGN,
                                         PCI_DMA_FROMDEVICE);
                        skb_put(skb, hlen);
                }
@@ -3938,13 +4513,6 @@ static bool igb_clean_rx_irq_adv(struct igb_ring *rx_ring,
 
                        skb->truesize += length;
                }
-send_up:
-               i++;
-               if (i == rx_ring->count)
-                       i = 0;
-               next_rxd = E1000_RX_DESC_ADV(*rx_ring, i);
-               prefetch(next_rxd);
-               next_buffer = &rx_ring->buffer_info[i];
 
                if (!(staterr & E1000_RXD_STAT_EOP)) {
                        buffer_info->skb = next_buffer->skb;
@@ -3953,6 +4521,47 @@ send_up:
                        next_buffer->dma = 0;
                        goto next_desc;
                }
+send_up:
+               /*
+                * If this bit is set, then the RX registers contain
+                * the time stamp. No other packet will be time
+                * stamped until we read these registers, so read the
+                * registers to make them available again. Because
+                * only one packet can be time stamped at a time, we
+                * know that the register values must belong to this
+                * one here and therefore we don't need to compare
+                * any of the additional attributes stored for it.
+                *
+                * If nothing went wrong, then it should have a
+                * skb_shared_tx that we can turn into a
+                * skb_shared_hwtstamps.
+                *
+                * TODO: can time stamping be triggered (thus locking
+                * the registers) without the packet reaching this point
+                * here? In that case RX time stamping would get stuck.
+                *
+                * TODO: in "time stamp all packets" mode this bit is
+                * not set. Need a global flag for this mode and then
+                * always read the registers. Cannot be done without
+                * a race condition.
+                */
+               if (unlikely(staterr & E1000_RXD_STAT_TS)) {
+                       u64 regval;
+                       u64 ns;
+                       struct skb_shared_hwtstamps *shhwtstamps =
+                               skb_hwtstamps(skb);
+
+                       WARN(!(rd32(E1000_TSYNCRXCTL) & E1000_TSYNCRXCTL_VALID),
+                            "igb: no RX time stamp available for time stamped packet");
+                       regval = rd32(E1000_RXSTMPL);
+                       regval |= (u64)rd32(E1000_RXSTMPH) << 32;
+                       ns = timecounter_cyc2time(&adapter->clock, regval);
+                       timecompare_update(&adapter->compare, ns);
+                       memset(shhwtstamps, 0, sizeof(*shhwtstamps));
+                       shhwtstamps->hwtstamp = ns_to_ktime(ns);
+                       shhwtstamps->syststamp =
+                               timecompare_transform(&adapter->compare, ns);
+               }
 
                if (staterr & E1000_RXDEXT_ERR_FRAME_ERR_MASK) {
                        dev_kfree_skb_irq(skb);
@@ -3980,20 +4589,12 @@ next_desc:
                /* use prefetched values */
                rx_desc = next_rxd;
                buffer_info = next_buffer;
-
                staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
        }
 
        rx_ring->next_to_clean = i;
        cleaned_count = IGB_DESC_UNUSED(rx_ring);
 
-#ifdef CONFIG_IGB_LRO
-       if (rx_ring->lro_used) {
-               lro_flush_all(&rx_ring->lro_mgr);
-               rx_ring->lro_used = 0;
-       }
-#endif
-
        if (cleaned_count)
                igb_alloc_rx_buffers_adv(rx_ring, cleaned_count);
 
@@ -4006,7 +4607,6 @@ next_desc:
        return cleaned;
 }
 
-
 /**
  * igb_alloc_rx_buffers_adv - Replace used receive buffers; packet split
  * @adapter: address of board private structure
@@ -4021,10 +4621,17 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
        struct igb_buffer *buffer_info;
        struct sk_buff *skb;
        unsigned int i;
+       int bufsz;
 
        i = rx_ring->next_to_use;
        buffer_info = &rx_ring->buffer_info[i];
 
+       if (adapter->rx_ps_hdr_size)
+               bufsz = adapter->rx_ps_hdr_size;
+       else
+               bufsz = adapter->rx_buffer_len;
+       bufsz += NET_IP_ALIGN;
+
        while (cleaned_count--) {
                rx_desc = E1000_RX_DESC_ADV(*rx_ring, i);
 
@@ -4040,23 +4647,14 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
                                buffer_info->page_offset ^= PAGE_SIZE / 2;
                        }
                        buffer_info->page_dma =
-                               pci_map_page(pdev,
-                                            buffer_info->page,
+                               pci_map_page(pdev, buffer_info->page,
                                             buffer_info->page_offset,
                                             PAGE_SIZE / 2,
                                             PCI_DMA_FROMDEVICE);
                }
 
                if (!buffer_info->skb) {
-                       int bufsz;
-
-                       if (adapter->rx_ps_hdr_size)
-                               bufsz = adapter->rx_ps_hdr_size;
-                       else
-                               bufsz = adapter->rx_buffer_len;
-                       bufsz += NET_IP_ALIGN;
                        skb = netdev_alloc_skb(netdev, bufsz);
-
                        if (!skb) {
                                adapter->alloc_rx_buff_failed++;
                                goto no_buffers;
@@ -4072,7 +4670,6 @@ static void igb_alloc_rx_buffers_adv(struct igb_ring *rx_ring,
                        buffer_info->dma = pci_map_single(pdev, skb->data,
                                                          bufsz,
                                                          PCI_DMA_FROMDEVICE);
-
                }
                /* Refresh the desc even if buffer_addrs didn't change because
                 * each write-back erases this info. */
@@ -4141,6 +4738,163 @@ static int igb_mii_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
        return 0;
 }
 
+/**
+ * igb_hwtstamp_ioctl - control hardware time stamping
+ * @netdev:
+ * @ifreq:
+ * @cmd:
+ *
+ * Outgoing time stamping can be enabled and disabled. Play nice and
+ * disable it when requested, although it shouldn't case any overhead
+ * when no packet needs it. At most one packet in the queue may be
+ * marked for time stamping, otherwise it would be impossible to tell
+ * for sure to which packet the hardware time stamp belongs.
+ *
+ * Incoming time stamping has to be configured via the hardware
+ * filters. Not all combinations are supported, in particular event
+ * type has to be specified. Matching the kind of event packet is
+ * not supported, with the exception of "all V2 events regardless of
+ * level 2 or 4".
+ *
+ **/
+static int igb_hwtstamp_ioctl(struct net_device *netdev,
+                             struct ifreq *ifr, int cmd)
+{
+       struct igb_adapter *adapter = netdev_priv(netdev);
+       struct e1000_hw *hw = &adapter->hw;
+       struct hwtstamp_config config;
+       u32 tsync_tx_ctl_bit = E1000_TSYNCTXCTL_ENABLED;
+       u32 tsync_rx_ctl_bit = E1000_TSYNCRXCTL_ENABLED;
+       u32 tsync_rx_ctl_type = 0;
+       u32 tsync_rx_cfg = 0;
+       int is_l4 = 0;
+       int is_l2 = 0;
+       short port = 319; /* PTP */
+       u32 regval;
+
+       if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
+               return -EFAULT;
+
+       /* reserved for future extensions */
+       if (config.flags)
+               return -EINVAL;
+
+       switch (config.tx_type) {
+       case HWTSTAMP_TX_OFF:
+               tsync_tx_ctl_bit = 0;
+               break;
+       case HWTSTAMP_TX_ON:
+               tsync_tx_ctl_bit = E1000_TSYNCTXCTL_ENABLED;
+               break;
+       default:
+               return -ERANGE;
+       }
+
+       switch (config.rx_filter) {
+       case HWTSTAMP_FILTER_NONE:
+               tsync_rx_ctl_bit = 0;
+               break;
+       case HWTSTAMP_FILTER_PTP_V1_L4_EVENT:
+       case HWTSTAMP_FILTER_PTP_V2_L4_EVENT:
+       case HWTSTAMP_FILTER_PTP_V2_L2_EVENT:
+       case HWTSTAMP_FILTER_ALL:
+               /*
+                * register TSYNCRXCFG must be set, therefore it is not
+                * possible to time stamp both Sync and Delay_Req messages
+                * => fall back to time stamping all packets
+                */
+               tsync_rx_ctl_type = E1000_TSYNCRXCTL_TYPE_ALL;
+               config.rx_filter = HWTSTAMP_FILTER_ALL;
+               break;
+       case HWTSTAMP_FILTER_PTP_V1_L4_SYNC:
+               tsync_rx_ctl_type = E1000_TSYNCRXCTL_TYPE_L4_V1;
+               tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V1_SYNC_MESSAGE;
+               is_l4 = 1;
+               break;
+       case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ:
+               tsync_rx_ctl_type = E1000_TSYNCRXCTL_TYPE_L4_V1;
+               tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V1_DELAY_REQ_MESSAGE;
+               is_l4 = 1;
+               break;
+       case HWTSTAMP_FILTER_PTP_V2_L2_SYNC:
+       case HWTSTAMP_FILTER_PTP_V2_L4_SYNC:
+               tsync_rx_ctl_type = E1000_TSYNCRXCTL_TYPE_L2_L4_V2;
+               tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V2_SYNC_MESSAGE;
+               is_l2 = 1;
+               is_l4 = 1;
+               config.rx_filter = HWTSTAMP_FILTER_SOME;
+               break;
+       case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ:
+       case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ:
+               tsync_rx_ctl_type = E1000_TSYNCRXCTL_TYPE_L2_L4_V2;
+               tsync_rx_cfg = E1000_TSYNCRXCFG_PTP_V2_DELAY_REQ_MESSAGE;
+               is_l2 = 1;
+               is_l4 = 1;
+               config.rx_filter = HWTSTAMP_FILTER_SOME;
+               break;
+       case HWTSTAMP_FILTER_PTP_V2_EVENT:
+       case HWTSTAMP_FILTER_PTP_V2_SYNC:
+       case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ:
+               tsync_rx_ctl_type = E1000_TSYNCRXCTL_TYPE_EVENT_V2;
+               config.rx_filter = HWTSTAMP_FILTER_PTP_V2_EVENT;
+               is_l2 = 1;
+               break;
+       default:
+               return -ERANGE;
+       }
+
+       /* enable/disable TX */
+       regval = rd32(E1000_TSYNCTXCTL);
+       regval = (regval & ~E1000_TSYNCTXCTL_ENABLED) | tsync_tx_ctl_bit;
+       wr32(E1000_TSYNCTXCTL, regval);
+
+       /* enable/disable RX, define which PTP packets are time stamped */
+       regval = rd32(E1000_TSYNCRXCTL);
+       regval = (regval & ~E1000_TSYNCRXCTL_ENABLED) | tsync_rx_ctl_bit;
+       regval = (regval & ~0xE) | tsync_rx_ctl_type;
+       wr32(E1000_TSYNCRXCTL, regval);
+       wr32(E1000_TSYNCRXCFG, tsync_rx_cfg);
+
+       /*
+        * Ethertype Filter Queue Filter[0][15:0] = 0x88F7
+        *                                          (Ethertype to filter on)
+        * Ethertype Filter Queue Filter[0][26] = 0x1 (Enable filter)
+        * Ethertype Filter Queue Filter[0][30] = 0x1 (Enable Timestamping)
+        */
+       wr32(E1000_ETQF0, is_l2 ? 0x440088f7 : 0);
+
+       /* L4 Queue Filter[0]: only filter by source and destination port */
+       wr32(E1000_SPQF0, htons(port));
+       wr32(E1000_IMIREXT(0), is_l4 ?
+            ((1<<12) | (1<<19) /* bypass size and control flags */) : 0);
+       wr32(E1000_IMIR(0), is_l4 ?
+            (htons(port)
+             | (0<<16) /* immediate interrupt disabled */
+             | 0 /* (1<<17) bit cleared: do not bypass
+                    destination port check */)
+               : 0);
+       wr32(E1000_FTQF0, is_l4 ?
+            (0x11 /* UDP */
+             | (1<<15) /* VF not compared */
+             | (1<<27) /* Enable Timestamping */
+             | (7<<28) /* only source port filter enabled,
+                          source/target address and protocol
+                          masked */)
+            : ((1<<15) | (15<<28) /* all mask bits set = filter not
+                                     enabled */));
+
+       wrfl();
+
+       adapter->hwtstamp_config = config;
+
+       /* clear TX/RX time stamp registers, just to be sure */
+       regval = rd32(E1000_TXSTMPH);
+       regval = rd32(E1000_RXSTMPH);
+
+       return copy_to_user(ifr->ifr_data, &config, sizeof(config)) ?
+               -EFAULT : 0;
+}
+
 /**
  * igb_ioctl -
  * @netdev:
@@ -4154,6 +4908,8 @@ static int igb_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
        case SIOCGMIIREG:
        case SIOCSMIIREG:
                return igb_mii_ioctl(netdev, ifr, cmd);
+       case SIOCSHWTSTAMP:
+               return igb_hwtstamp_ioctl(netdev, ifr, cmd);
        default:
                return -EOPNOTSUPP;
        }
@@ -4180,8 +4936,6 @@ static void igb_vlan_rx_register(struct net_device *netdev,
                rctl &= ~E1000_RCTL_CFIEN;
                wr32(E1000_RCTL, rctl);
                igb_update_mng_vlan(adapter);
-               wr32(E1000_RLPML,
-                               adapter->max_frame_size + VLAN_TAG_SIZE);
        } else {
                /* disable VLAN tag insert/strip */
                ctrl = rd32(E1000_CTRL);
@@ -4192,10 +4946,10 @@ static void igb_vlan_rx_register(struct net_device *netdev,
                        igb_vlan_rx_kill_vid(netdev, adapter->mng_vlan_id);
                        adapter->mng_vlan_id = IGB_MNG_VLAN_NONE;
                }
-               wr32(E1000_RLPML,
-                               adapter->max_frame_size);
        }
 
+       igb_rlpml_set(adapter);
+
        if (!test_bit(__IGB_DOWN, &adapter->state))
                igb_irq_enable(adapter);
 }
@@ -4204,24 +4958,25 @@ static void igb_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
 {
        struct igb_adapter *adapter = netdev_priv(netdev);
        struct e1000_hw *hw = &adapter->hw;
-       u32 vfta, index;
+       int pf_id = adapter->vfs_allocated_count;
 
-       if ((adapter->hw.mng_cookie.status &
+       if ((hw->mng_cookie.status &
             E1000_MNG_DHCP_COOKIE_STATUS_VLAN) &&
            (vid == adapter->mng_vlan_id))
                return;
-       /* add VID to filter table */
-       index = (vid >> 5) & 0x7F;
-       vfta = array_rd32(E1000_VFTA, index);
-       vfta |= (1 << (vid & 0x1F));
-       igb_write_vfta(&adapter->hw, index, vfta);
+
+       /* add vid to vlvf if sr-iov is enabled,
+        * if that fails add directly to filter table */
+       if (igb_vlvf_set(adapter, vid, true, pf_id))
+               igb_vfta_set(hw, vid, true);
+
 }
 
 static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
 {
        struct igb_adapter *adapter = netdev_priv(netdev);
        struct e1000_hw *hw = &adapter->hw;
-       u32 vfta, index;
+       int pf_id = adapter->vfs_allocated_count;
 
        igb_irq_disable(adapter);
        vlan_group_set_device(adapter->vlgrp, vid, NULL);
@@ -4237,11 +4992,10 @@ static void igb_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
                return;
        }
 
-       /* remove VID from filter table */
-       index = (vid >> 5) & 0x7F;
-       vfta = array_rd32(E1000_VFTA, index);
-       vfta &= ~(1 << (vid & 0x1F));
-       igb_write_vfta(&adapter->hw, index, vfta);
+       /* remove vid from vlvf if sr-iov is enabled,
+        * if not in vlvf remove from vfta */
+       if (igb_vlvf_set(adapter, vid, false, pf_id))
+               igb_vfta_set(hw, vid, false);
 }
 
 static void igb_restore_vlan(struct igb_adapter *adapter)
@@ -4298,7 +5052,6 @@ int igb_set_spd_dplx(struct igb_adapter *adapter, u16 spddplx)
        return 0;
 }
 
-
 static int igb_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct net_device *netdev = pci_get_drvdata(pdev);
@@ -4390,10 +5143,7 @@ static int igb_resume(struct pci_dev *pdev)
        pci_set_power_state(pdev, PCI_D0);
        pci_restore_state(pdev);
 
-       if (adapter->need_ioport)
-               err = pci_enable_device(pdev);
-       else
-               err = pci_enable_device_mem(pdev);
+       err = pci_enable_device_mem(pdev);
        if (err) {
                dev_err(&pdev->dev,
                        "igb: Cannot enable PCI device from suspend\n");
@@ -4414,6 +5164,11 @@ static int igb_resume(struct pci_dev *pdev)
        /* e1000_power_up_phy(adapter); */
 
        igb_reset(adapter);
+
+       /* let the f/w know that the h/w is now under the control of the
+        * driver. */
+       igb_get_hw_control(adapter);
+
        wr32(E1000_WUS, ~0);
 
        if (netif_running(netdev)) {
@@ -4424,10 +5179,6 @@ static int igb_resume(struct pci_dev *pdev)
 
        netif_device_attach(netdev);
 
-       /* let the f/w know that the h/w is now under the control of the
-        * driver. */
-       igb_get_hw_control(adapter);
-
        return 0;
 }
 #endif
@@ -4446,22 +5197,27 @@ static void igb_shutdown(struct pci_dev *pdev)
 static void igb_netpoll(struct net_device *netdev)
 {
        struct igb_adapter *adapter = netdev_priv(netdev);
+       struct e1000_hw *hw = &adapter->hw;
        int i;
-       int work_done = 0;
-
-       igb_irq_disable(adapter);
-       adapter->flags |= IGB_FLAG_IN_NETPOLL;
 
-       for (i = 0; i < adapter->num_tx_queues; i++)
-               igb_clean_tx_irq(&adapter->tx_ring[i]);
+       if (!adapter->msix_entries) {
+               igb_irq_disable(adapter);
+               napi_schedule(&adapter->rx_ring[0].napi);
+               return;
+       }
 
-       for (i = 0; i < adapter->num_rx_queues; i++)
-               igb_clean_rx_irq_adv(&adapter->rx_ring[i],
-                                    &work_done,
-                                    adapter->rx_ring[i].napi.weight);
+       for (i = 0; i < adapter->num_tx_queues; i++) {
+               struct igb_ring *tx_ring = &adapter->tx_ring[i];
+               wr32(E1000_EIMC, tx_ring->eims_value);
+               igb_clean_tx_irq(tx_ring);
+               wr32(E1000_EIMS, tx_ring->eims_value);
+       }
 
-       adapter->flags &= ~IGB_FLAG_IN_NETPOLL;
-       igb_irq_enable(adapter);
+       for (i = 0; i < adapter->num_rx_queues; i++) {
+               struct igb_ring *rx_ring = &adapter->rx_ring[i];
+               wr32(E1000_EIMC, rx_ring->eims_value);
+               napi_schedule(&rx_ring->napi);
+       }
 }
 #endif /* CONFIG_NET_POLL_CONTROLLER */
 
@@ -4504,12 +5260,7 @@ static pci_ers_result_t igb_io_slot_reset(struct pci_dev *pdev)
        pci_ers_result_t result;
        int err;
 
-       if (adapter->need_ioport)
-               err = pci_enable_device(pdev);
-       else
-               err = pci_enable_device_mem(pdev);
-
-       if (err) {
+       if (pci_enable_device_mem(pdev)) {
                dev_err(&pdev->dev,
                        "Cannot re-enable PCI device after reset.\n");
                result = PCI_ERS_RESULT_DISCONNECT;
@@ -4562,4 +5313,172 @@ static void igb_io_resume(struct pci_dev *pdev)
        igb_get_hw_control(adapter);
 }
 
+static inline void igb_set_vmolr(struct e1000_hw *hw, int vfn)
+{
+       u32 reg_data;
+
+       reg_data = rd32(E1000_VMOLR(vfn));
+       reg_data |= E1000_VMOLR_BAM |    /* Accept broadcast */
+                   E1000_VMOLR_ROPE |   /* Accept packets matched in UTA */
+                   E1000_VMOLR_ROMPE |  /* Accept packets matched in MTA */
+                   E1000_VMOLR_AUPE |   /* Accept untagged packets */
+                   E1000_VMOLR_STRVLAN; /* Strip vlan tags */
+       wr32(E1000_VMOLR(vfn), reg_data);
+}
+
+static inline int igb_set_vf_rlpml(struct igb_adapter *adapter, int size,
+                                 int vfn)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       u32 vmolr;
+
+       vmolr = rd32(E1000_VMOLR(vfn));
+       vmolr &= ~E1000_VMOLR_RLPML_MASK;
+       vmolr |= size | E1000_VMOLR_LPE;
+       wr32(E1000_VMOLR(vfn), vmolr);
+
+       return 0;
+}
+
+static inline void igb_set_rah_pool(struct e1000_hw *hw, int pool, int entry)
+{
+       u32 reg_data;
+
+       reg_data = rd32(E1000_RAH(entry));
+       reg_data &= ~E1000_RAH_POOL_MASK;
+       reg_data |= E1000_RAH_POOL_1 << pool;;
+       wr32(E1000_RAH(entry), reg_data);
+}
+
+static void igb_set_mc_list_pools(struct igb_adapter *adapter,
+                                 int entry_count, u16 total_rar_filters)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       int i = adapter->vfs_allocated_count + 1;
+
+       if ((i + entry_count) < total_rar_filters)
+               total_rar_filters = i + entry_count;
+
+       for (; i < total_rar_filters; i++)
+               igb_set_rah_pool(hw, adapter->vfs_allocated_count, i);
+}
+
+static int igb_set_vf_mac(struct igb_adapter *adapter,
+                          int vf, unsigned char *mac_addr)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       int rar_entry = vf + 1; /* VF MAC addresses start at entry 1 */
+
+       igb_rar_set(hw, mac_addr, rar_entry);
+
+       memcpy(adapter->vf_data[vf].vf_mac_addresses, mac_addr, ETH_ALEN);
+
+       igb_set_rah_pool(hw, vf, rar_entry);
+
+       return 0;
+}
+
+static void igb_vmm_control(struct igb_adapter *adapter)
+{
+       struct e1000_hw *hw = &adapter->hw;
+       u32 reg_data;
+
+       if (!adapter->vfs_allocated_count)
+               return;
+
+       /* VF's need PF reset indication before they
+        * can send/receive mail */
+       reg_data = rd32(E1000_CTRL_EXT);
+       reg_data |= E1000_CTRL_EXT_PFRSTD;
+       wr32(E1000_CTRL_EXT, reg_data);
+
+       igb_vmdq_set_loopback_pf(hw, true);
+       igb_vmdq_set_replication_pf(hw, true);
+}
+
+#ifdef CONFIG_PCI_IOV
+static ssize_t igb_show_num_vfs(struct device *dev,
+                                struct device_attribute *attr, char *buf)
+{
+       struct igb_adapter *adapter = netdev_priv(to_net_dev(dev));
+
+       return sprintf(buf, "%d\n", adapter->vfs_allocated_count);
+}
+
+static ssize_t igb_set_num_vfs(struct device *dev,
+                               struct device_attribute *attr,
+                               const char *buf, size_t count)
+{
+       struct net_device *netdev = to_net_dev(dev);
+       struct igb_adapter *adapter = netdev_priv(netdev);
+       struct e1000_hw *hw = &adapter->hw;
+       struct pci_dev *pdev = adapter->pdev;
+       unsigned int num_vfs, i;
+       unsigned char mac_addr[ETH_ALEN];
+       int err;
+
+       sscanf(buf, "%u", &num_vfs);
+
+       if (num_vfs > 7)
+               num_vfs = 7;
+
+       /* value unchanged do nothing */
+       if (num_vfs == adapter->vfs_allocated_count)
+               return count;
+
+       if (netdev->flags & IFF_UP)
+               igb_close(netdev);
+
+       igb_reset_interrupt_capability(adapter);
+       igb_free_queues(adapter);
+       adapter->tx_ring = NULL;
+       adapter->rx_ring = NULL;
+       adapter->vfs_allocated_count = 0;
+
+       /* reclaim resources allocated to VFs since we are changing count */
+       if (adapter->vf_data) {
+               /* disable iov and allow time for transactions to clear */
+               pci_disable_sriov(pdev);
+               msleep(500);
+
+               kfree(adapter->vf_data);
+               adapter->vf_data = NULL;
+               wr32(E1000_IOVCTL, E1000_IOVCTL_REUSE_VFQ);
+               msleep(100);
+               dev_info(&pdev->dev, "IOV Disabled\n");
+       }
+
+       if (num_vfs) {
+               adapter->vf_data = kcalloc(num_vfs,
+                                          sizeof(struct vf_data_storage),
+                                          GFP_KERNEL);
+               if (!adapter->vf_data) {
+                       dev_err(&pdev->dev, "Could not allocate VF private "
+                               "data - IOV enable failed\n");
+               } else {
+                       err = pci_enable_sriov(pdev, num_vfs);
+                       if (!err) {
+                               adapter->vfs_allocated_count = num_vfs;
+                               dev_info(&pdev->dev, "%d vfs allocated\n", num_vfs);
+                               for (i = 0; i < adapter->vfs_allocated_count; i++) {
+                                       random_ether_addr(mac_addr);
+                                       igb_set_vf_mac(adapter, i, mac_addr);
+                               }
+                       } else {
+                               kfree(adapter->vf_data);
+                               adapter->vf_data = NULL;
+                       }
+               }
+       }
+
+       igb_set_interrupt_capability(adapter);
+       igb_alloc_queues(adapter);
+       igb_reset(adapter);
+
+       if (netdev->flags & IFF_UP)
+               igb_open(netdev);
+
+       return count;
+}
+#endif /* CONFIG_PCI_IOV */
 /* igb_main.c */
index 5b5862499def5e3163738aaa3b7d2b5f01382e6b..c23d211758ae9480ae34a3e2a72d96cffa337a62 100644 (file)
@@ -753,7 +753,8 @@ static int sirdev_alloc_buffers(struct sir_dev *dev)
        dev->rx_buff.truesize = IRDA_SKB_MAX_MTU; 
 
        /* Bootstrap ZeroCopy Rx */
-       dev->rx_buff.skb = __dev_alloc_skb(dev->rx_buff.truesize, GFP_KERNEL);
+       dev->rx_buff.skb = __netdev_alloc_skb(dev->netdev, dev->rx_buff.truesize,
+                                             GFP_KERNEL);
        if (dev->rx_buff.skb == NULL)
                return -ENOMEM;
        skb_reserve(dev->rx_buff.skb, 1);
index eee28d3956827cb8dcb3951df9738ab6c9cd54e6..e2ef16b29700ed0c0d81e258338c978f5f65f1b5 100644 (file)
@@ -1721,14 +1721,14 @@ ixgb_intr(int irq, void *data)
                if (!test_bit(__IXGB_DOWN, &adapter->flags))
                        mod_timer(&adapter->watchdog_timer, jiffies);
 
-       if (netif_rx_schedule_prep(&adapter->napi)) {
+       if (napi_schedule_prep(&adapter->napi)) {
 
                /* Disable interrupts and register for poll. The flush
                  of the posted write is intentionally left out.
                */
 
                IXGB_WRITE_REG(&adapter->hw, IMC, ~0);
-               __netif_rx_schedule(&adapter->napi);
+               __napi_schedule(&adapter->napi);
        }
        return IRQ_HANDLED;
 }
@@ -1749,7 +1749,7 @@ ixgb_clean(struct napi_struct *napi, int budget)
 
        /* If budget not fully consumed, exit the polling mode */
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                if (!test_bit(__IXGB_DOWN, &adapter->flags))
                        ixgb_irq_enable(adapter);
        }
index 6e7ef765bcd882ec2257dcd5c244f0352846f36c..f6061950f5d124b8fd4b128512f4b94a3129abd9 100644 (file)
@@ -1,7 +1,7 @@
 ################################################################################
 #
 # Intel 10 Gigabit PCI Express Linux driver
-# Copyright(c) 1999 - 2007 Intel Corporation.
+# Copyright(c) 1999 - 2009 Intel Corporation.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms and conditions of the GNU General Public License,
index e112008f39c1dc889a73e4b9c0af5a4ceb7b95f1..e98ace8c578dfa37c67ddc56c7585bf8cf80770b 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -31,7 +31,6 @@
 #include <linux/types.h>
 #include <linux/pci.h>
 #include <linux/netdevice.h>
-#include <linux/inet_lro.h>
 #include <linux/aer.h>
 
 #include "ixgbe_type.h"
@@ -88,9 +87,6 @@
 #define IXGBE_TX_FLAGS_VLAN_PRIO_MASK   0x0000e000
 #define IXGBE_TX_FLAGS_VLAN_SHIFT      16
 
-#define IXGBE_MAX_LRO_DESCRIPTORS       8
-#define IXGBE_MAX_LRO_AGGREGATE         32
-
 /* wrapper around a pointer to a socket buffer,
  * so a DMA handle can be stored along with the buffer */
 struct ixgbe_tx_buffer {
@@ -142,8 +138,6 @@ struct ixgbe_ring {
        /* cpu for tx queue */
        int cpu;
 #endif
-       struct net_lro_mgr lro_mgr;
-       bool lro_used;
        struct ixgbe_queue_stats stats;
        u16 v_idx; /* maps directly to the index for this ring in the hardware
                   * vector array, can also be used for finding the bit in EICR
@@ -210,9 +204,13 @@ struct ixgbe_q_vector {
 #define OTHER_VECTOR 1
 #define NON_Q_VECTORS (OTHER_VECTOR)
 
-#define MAX_MSIX_Q_VECTORS 16
+#define MAX_MSIX_VECTORS_82598 18
+#define MAX_MSIX_Q_VECTORS_82598 16
+
+#define MAX_MSIX_Q_VECTORS MAX_MSIX_Q_VECTORS_82598
+#define MAX_MSIX_COUNT MAX_MSIX_VECTORS_82598
+
 #define MIN_MSIX_Q_VECTORS 2
-#define MAX_MSIX_COUNT (MAX_MSIX_Q_VECTORS + NON_Q_VECTORS)
 #define MIN_MSIX_COUNT (MIN_MSIX_Q_VECTORS + NON_Q_VECTORS)
 
 /* board specific private data structure */
@@ -250,6 +248,7 @@ struct ixgbe_adapter {
        u64 hw_csum_rx_good;
        u64 non_eop_descs;
        int num_msix_vectors;
+       int max_msix_q_vectors;         /* true count of q_vectors for device */
        struct ixgbe_ring_feature ring_feature[3];
        struct msix_entry *msix_entries;
 
@@ -301,9 +300,6 @@ struct ixgbe_adapter {
 
        unsigned long state;
        u64 tx_busy;
-       u64 lro_aggregated;
-       u64 lro_flushed;
-       u64 lro_no_desc;
        unsigned int tx_ring_count;
        unsigned int rx_ring_count;
 
@@ -314,6 +310,8 @@ struct ixgbe_adapter {
        struct work_struct watchdog_task;
        struct work_struct sfp_task;
        struct timer_list sfp_timer;
+
+       u16 eeprom_version;
 };
 
 enum ixbge_state_t {
index ad5699d9ab0dacaaecf5fd6069b1268ff07d5e9c..51dba1c78e1e85cfc1eaca3597f050f193a927b8 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -49,6 +49,27 @@ static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
 static s32 ixgbe_read_i2c_eeprom_82598(struct ixgbe_hw *hw, u8 byte_offset,
                                        u8 *eeprom_data);
 
+/**
+ *  ixgbe_get_pcie_msix_count_82598 - Gets MSI-X vector count
+ *  @hw: pointer to hardware structure
+ *
+ *  Read PCIe configuration space, and get the MSI-X vector count from
+ *  the capabilities table.
+ **/
+static u16 ixgbe_get_pcie_msix_count_82598(struct ixgbe_hw *hw)
+{
+       struct ixgbe_adapter *adapter = hw->back;
+       u16 msix_count;
+       pci_read_config_word(adapter->pdev, IXGBE_PCIE_MSIX_82598_CAPS,
+                            &msix_count);
+       msix_count &= IXGBE_PCIE_MSIX_TBL_SZ_MASK;
+
+       /* MSI-X count is zero-based in HW, so increment to give proper value */
+       msix_count++;
+
+       return msix_count;
+}
+
 /**
  */
 static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
@@ -106,6 +127,7 @@ static s32 ixgbe_get_invariants_82598(struct ixgbe_hw *hw)
        mac->num_rar_entries = IXGBE_82598_RAR_ENTRIES;
        mac->max_rx_queues = IXGBE_82598_MAX_RX_QUEUES;
        mac->max_tx_queues = IXGBE_82598_MAX_TX_QUEUES;
+       mac->max_msix_vectors = ixgbe_get_pcie_msix_count_82598(hw);
 
 out:
        return ret_val;
@@ -124,18 +146,12 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
                                              bool *autoneg)
 {
        s32 status = 0;
-       s32 autoc_reg;
-
-       autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
 
-       if (hw->mac.link_settings_loaded) {
-               autoc_reg &= ~IXGBE_AUTOC_LMS_ATTACH_TYPE;
-               autoc_reg &= ~IXGBE_AUTOC_LMS_MASK;
-               autoc_reg |= hw->mac.link_attach_type;
-               autoc_reg |= hw->mac.link_mode_select;
-       }
-
-       switch (autoc_reg & IXGBE_AUTOC_LMS_MASK) {
+       /*
+        * Determine link capabilities based on the stored value of AUTOC,
+        * which represents EEPROM defaults.
+        */
+       switch (hw->mac.orig_autoc & IXGBE_AUTOC_LMS_MASK) {
        case IXGBE_AUTOC_LMS_1G_LINK_NO_AN:
                *speed = IXGBE_LINK_SPEED_1GB_FULL;
                *autoneg = false;
@@ -154,9 +170,9 @@ static s32 ixgbe_get_link_capabilities_82598(struct ixgbe_hw *hw,
        case IXGBE_AUTOC_LMS_KX4_AN:
        case IXGBE_AUTOC_LMS_KX4_AN_1G_AN:
                *speed = IXGBE_LINK_SPEED_UNKNOWN;
-               if (autoc_reg & IXGBE_AUTOC_KX4_SUPP)
+               if (hw->mac.orig_autoc & IXGBE_AUTOC_KX4_SUPP)
                        *speed |= IXGBE_LINK_SPEED_10GB_FULL;
-               if (autoc_reg & IXGBE_AUTOC_KX_SUPP)
+               if (hw->mac.orig_autoc & IXGBE_AUTOC_KX_SUPP)
                        *speed |= IXGBE_LINK_SPEED_1GB_FULL;
                *autoneg = true;
                break;
@@ -213,6 +229,10 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
 
        /* Media type for I82598 is based on device ID */
        switch (hw->device_id) {
+       case IXGBE_DEV_ID_82598:
+       case IXGBE_DEV_ID_82598_BX:
+               media_type = ixgbe_media_type_backplane;
+               break;
        case IXGBE_DEV_ID_82598AF_DUAL_PORT:
        case IXGBE_DEV_ID_82598AF_SINGLE_PORT:
        case IXGBE_DEV_ID_82598EB_CX4:
@@ -235,104 +255,75 @@ static enum ixgbe_media_type ixgbe_get_media_type_82598(struct ixgbe_hw *hw)
 }
 
 /**
- *  ixgbe_setup_fc_82598 - Configure flow control settings
+ *  ixgbe_fc_enable_82598 - Enable flow control
  *  @hw: pointer to hardware structure
  *  @packetbuf_num: packet buffer number (0-7)
  *
- *  Configures the flow control settings based on SW configuration.  This
- *  function is used for 802.3x flow control configuration only.
+ *  Enable flow control according to the current settings.
  **/
-static s32 ixgbe_setup_fc_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
+static s32 ixgbe_fc_enable_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
 {
-       u32 frctl_reg;
+       s32 ret_val = 0;
+       u32 fctrl_reg;
        u32 rmcs_reg;
+       u32 reg;
 
-       if (packetbuf_num < 0 || packetbuf_num > 7) {
-               hw_dbg(hw, "Invalid packet buffer number [%d], expected range is"
-                         " 0-7\n", packetbuf_num);
-       }
-
-       frctl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
-       frctl_reg &= ~(IXGBE_FCTRL_RFCE | IXGBE_FCTRL_RPFCE);
+       fctrl_reg = IXGBE_READ_REG(hw, IXGBE_FCTRL);
+       fctrl_reg &= ~(IXGBE_FCTRL_RFCE | IXGBE_FCTRL_RPFCE);
 
        rmcs_reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
        rmcs_reg &= ~(IXGBE_RMCS_TFCE_PRIORITY | IXGBE_RMCS_TFCE_802_3X);
 
        /*
-        * 10 gig parts do not have a word in the EEPROM to determine the
-        * default flow control setting, so we explicitly set it to full.
-        */
-       if (hw->fc.type == ixgbe_fc_default)
-               hw->fc.type = ixgbe_fc_full;
-
-       /*
-        * We want to save off the original Flow Control configuration just in
-        * case we get disconnected and then reconnected into a different hub
-        * or switch with different Flow Control capabilities.
-        */
-       hw->fc.original_type = hw->fc.type;
-
-       /*
-        * The possible values of the "flow_control" parameter are:
+        * The possible values of fc.current_mode are:
         * 0: Flow control is completely disabled
-        * 1: Rx flow control is enabled (we can receive pause frames but not
-        *    send pause frames).
-        * 2: Tx flow control is enabled (we can send pause frames but we do not
-        *    support receiving pause frames)
+        * 1: Rx flow control is enabled (we can receive pause frames,
+        *    but not send pause frames).
+        * 2:  Tx flow control is enabled (we can send pause frames but
+        *     we do not support receiving pause frames).
         * 3: Both Rx and Tx flow control (symmetric) are enabled.
         * other: Invalid.
         */
-       switch (hw->fc.type) {
+       switch (hw->fc.current_mode) {
        case ixgbe_fc_none:
+               /* Flow control completely disabled by software override. */
                break;
        case ixgbe_fc_rx_pause:
                /*
-                * Rx Flow control is enabled,
-                * and Tx Flow control is disabled.
+                * Rx Flow control is enabled and Tx Flow control is
+                * disabled by software override. Since there really
+                * isn't a way to advertise that we are capable of RX
+                * Pause ONLY, we will advertise that we support both
+                * symmetric and asymmetric Rx PAUSE.  Later, we will
+                * disable the adapter's ability to send PAUSE frames.
                 */
-               frctl_reg |= IXGBE_FCTRL_RFCE;
+               fctrl_reg |= IXGBE_FCTRL_RFCE;
                break;
        case ixgbe_fc_tx_pause:
                /*
-                * Tx Flow control is enabled, and Rx Flow control is disabled,
-                * by a software over-ride.
+                * Tx Flow control is enabled, and Rx Flow control is
+                * disabled by software override.
                 */
                rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
                break;
        case ixgbe_fc_full:
-               /*
-                * Flow control (both Rx and Tx) is enabled by a software
-                * over-ride.
-                */
-               frctl_reg |= IXGBE_FCTRL_RFCE;
+               /* Flow control (both Rx and Tx) is enabled by SW override. */
+               fctrl_reg |= IXGBE_FCTRL_RFCE;
                rmcs_reg |= IXGBE_RMCS_TFCE_802_3X;
                break;
        default:
-               /* We should never get here.  The value should be 0-3. */
                hw_dbg(hw, "Flow control param set incorrectly\n");
+               ret_val = -IXGBE_ERR_CONFIG;
+               goto out;
                break;
        }
 
        /* Enable 802.3x based flow control settings. */
-       IXGBE_WRITE_REG(hw, IXGBE_FCTRL, frctl_reg);
+       IXGBE_WRITE_REG(hw, IXGBE_FCTRL, fctrl_reg);
        IXGBE_WRITE_REG(hw, IXGBE_RMCS, rmcs_reg);
 
-       /*
-        * Check for invalid software configuration, zeros are completely
-        * invalid for all parameters used past this point, and if we enable
-        * flow control with zero water marks, we blast flow control packets.
-        */
-       if (!hw->fc.low_water || !hw->fc.high_water || !hw->fc.pause_time) {
-               hw_dbg(hw, "Flow control structure initialized incorrectly\n");
-               return IXGBE_ERR_INVALID_LINK_SETTINGS;
-       }
-
-       /*
-        * We need to set up the Receive Threshold high and low water
-        * marks as well as (optionally) enabling the transmission of
-        * XON frames.
-        */
-       if (hw->fc.type & ixgbe_fc_tx_pause) {
+       /* Set up and enable Rx high/low water mark thresholds, enable XON. */
+       if (hw->fc.current_mode & ixgbe_fc_tx_pause) {
                if (hw->fc.send_xon) {
                        IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num),
                                        (hw->fc.low_water | IXGBE_FCRTL_XONE));
@@ -340,14 +331,93 @@ static s32 ixgbe_setup_fc_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
                        IXGBE_WRITE_REG(hw, IXGBE_FCRTL(packetbuf_num),
                                        hw->fc.low_water);
                }
+
                IXGBE_WRITE_REG(hw, IXGBE_FCRTH(packetbuf_num),
-                               (hw->fc.high_water)|IXGBE_FCRTH_FCEN);
+                               (hw->fc.high_water | IXGBE_FCRTH_FCEN));
        }
 
-       IXGBE_WRITE_REG(hw, IXGBE_FCTTV(0), hw->fc.pause_time);
+       /* Configure pause time (2 TCs per register) */
+       reg = IXGBE_READ_REG(hw, IXGBE_FCTTV(packetbuf_num));
+       if ((packetbuf_num & 1) == 0)
+               reg = (reg & 0xFFFF0000) | hw->fc.pause_time;
+       else
+               reg = (reg & 0x0000FFFF) | (hw->fc.pause_time << 16);
+       IXGBE_WRITE_REG(hw, IXGBE_FCTTV(packetbuf_num / 2), reg);
+
        IXGBE_WRITE_REG(hw, IXGBE_FCRTV, (hw->fc.pause_time >> 1));
 
-       return 0;
+out:
+       return ret_val;
+}
+
+/**
+ *  ixgbe_setup_fc_82598 - Configure flow control settings
+ *  @hw: pointer to hardware structure
+ *  @packetbuf_num: packet buffer number (0-7)
+ *
+ *  Configures the flow control settings based on SW configuration.  This
+ *  function is used for 802.3x flow control configuration only.
+ **/
+static s32 ixgbe_setup_fc_82598(struct ixgbe_hw *hw, s32 packetbuf_num)
+{
+       s32 ret_val = 0;
+       ixgbe_link_speed speed;
+       bool link_up;
+
+       /* Validate the packetbuf configuration */
+       if (packetbuf_num < 0 || packetbuf_num > 7) {
+               hw_dbg(hw, "Invalid packet buffer number [%d], expected range is"
+                         " 0-7\n", packetbuf_num);
+               ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
+               goto out;
+       }
+
+       /*
+        * Validate the water mark configuration.  Zero water marks are invalid
+        * because it causes the controller to just blast out fc packets.
+        */
+       if (!hw->fc.low_water || !hw->fc.high_water || !hw->fc.pause_time) {
+               hw_dbg(hw, "Invalid water mark configuration\n");
+               ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
+               goto out;
+       }
+
+       /*
+        * Validate the requested mode.  Strict IEEE mode does not allow
+        * ixgbe_fc_rx_pause because it will cause testing anomalies.
+        */
+       if (hw->fc.strict_ieee && hw->fc.requested_mode == ixgbe_fc_rx_pause) {
+               hw_dbg(hw, "ixgbe_fc_rx_pause not valid in strict IEEE mode\n");
+               ret_val = IXGBE_ERR_INVALID_LINK_SETTINGS;
+               goto out;
+       }
+
+       /*
+        * 10gig parts do not have a word in the EEPROM to determine the
+        * default flow control setting, so we explicitly set it to full.
+        */
+       if (hw->fc.requested_mode == ixgbe_fc_default)
+               hw->fc.requested_mode = ixgbe_fc_full;
+
+       /*
+        * Save off the requested flow control mode for use later.  Depending
+        * on the link partner's capabilities, we may or may not use this mode.
+        */
+
+       hw->fc.current_mode = hw->fc.requested_mode;
+
+       /* Decide whether to use autoneg or not. */
+       hw->mac.ops.check_link(hw, &speed, &link_up, false);
+       if (hw->phy.multispeed_fiber && (speed == IXGBE_LINK_SPEED_1GB_FULL))
+               ret_val = ixgbe_fc_autoneg(hw);
+
+       if (ret_val)
+               goto out;
+
+       ret_val = ixgbe_fc_enable_82598(hw, packetbuf_num);
+
+out:
+       return ret_val;
 }
 
 /**
@@ -364,27 +434,17 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw)
        u32 i;
        s32 status = 0;
 
-       autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
-
-       if (hw->mac.link_settings_loaded) {
-               autoc_reg &= ~IXGBE_AUTOC_LMS_ATTACH_TYPE;
-               autoc_reg &= ~IXGBE_AUTOC_LMS_MASK;
-               autoc_reg |= hw->mac.link_attach_type;
-               autoc_reg |= hw->mac.link_mode_select;
-
-               IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
-               IXGBE_WRITE_FLUSH(hw);
-               msleep(50);
-       }
-
        /* Restart link */
+       autoc_reg = IXGBE_READ_REG(hw, IXGBE_AUTOC);
        autoc_reg |= IXGBE_AUTOC_AN_RESTART;
        IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc_reg);
 
        /* Only poll for autoneg to complete if specified to do so */
        if (hw->phy.autoneg_wait_to_complete) {
-               if (hw->mac.link_mode_select == IXGBE_AUTOC_LMS_KX4_AN ||
-                   hw->mac.link_mode_select == IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
+               if ((autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
+                    IXGBE_AUTOC_LMS_KX4_AN ||
+                   (autoc_reg & IXGBE_AUTOC_LMS_MASK) ==
+                    IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
                        links_reg = 0; /* Just in case Autoneg time = 0 */
                        for (i = 0; i < IXGBE_AUTO_NEG_TIME; i++) {
                                links_reg = IXGBE_READ_REG(hw, IXGBE_LINKS);
@@ -404,7 +464,6 @@ static s32 ixgbe_setup_mac_link_82598(struct ixgbe_hw *hw)
         * case we get disconnected and then reconnected into a different hub
         * or switch with different Flow Control capabilities.
         */
-       hw->fc.original_type = hw->fc.type;
        ixgbe_setup_fc_82598(hw, 0);
 
        /* Add delay to filter out noises during initial link setup */
@@ -508,37 +567,43 @@ out:
  *  Set the link speed in the AUTOC register and restarts link.
  **/
 static s32 ixgbe_setup_mac_link_speed_82598(struct ixgbe_hw *hw,
-                                            ixgbe_link_speed speed, bool autoneg,
-                                            bool autoneg_wait_to_complete)
+                                           ixgbe_link_speed speed, bool autoneg,
+                                           bool autoneg_wait_to_complete)
 {
-       s32 status = 0;
+       s32              status            = 0;
+       ixgbe_link_speed link_capabilities = IXGBE_LINK_SPEED_UNKNOWN;
+       u32              curr_autoc        = IXGBE_READ_REG(hw, IXGBE_AUTOC);
+       u32              autoc             = curr_autoc;
+       u32              link_mode         = autoc & IXGBE_AUTOC_LMS_MASK;
 
-       /* If speed is 10G, then check for CX4 or XAUI. */
-       if ((speed == IXGBE_LINK_SPEED_10GB_FULL) &&
-           (!(hw->mac.link_attach_type & IXGBE_AUTOC_10G_KX4))) {
-               hw->mac.link_mode_select = IXGBE_AUTOC_LMS_10G_LINK_NO_AN;
-       } else if ((speed == IXGBE_LINK_SPEED_1GB_FULL) && (!autoneg)) {
-               hw->mac.link_mode_select = IXGBE_AUTOC_LMS_1G_LINK_NO_AN;
-       } else if (autoneg) {
-               /* BX mode - Autonegotiate 1G */
-               if (!(hw->mac.link_attach_type & IXGBE_AUTOC_1G_PMA_PMD))
-                       hw->mac.link_mode_select = IXGBE_AUTOC_LMS_1G_AN;
-               else /* KX/KX4 mode */
-                       hw->mac.link_mode_select = IXGBE_AUTOC_LMS_KX4_AN_1G_AN;
-       } else {
+       /* Check to see if speed passed in is supported. */
+       ixgbe_get_link_capabilities_82598(hw, &link_capabilities, &autoneg);
+       speed &= link_capabilities;
+
+       if (speed == IXGBE_LINK_SPEED_UNKNOWN)
                status = IXGBE_ERR_LINK_SETUP;
+
+       /* Set KX4/KX support according to speed requested */
+       else if (link_mode == IXGBE_AUTOC_LMS_KX4_AN ||
+                link_mode == IXGBE_AUTOC_LMS_KX4_AN_1G_AN) {
+               autoc &= ~IXGBE_AUTOC_KX4_KX_SUPP_MASK;
+               if (speed & IXGBE_LINK_SPEED_10GB_FULL)
+                       autoc |= IXGBE_AUTOC_KX4_SUPP;
+               if (speed & IXGBE_LINK_SPEED_1GB_FULL)
+                       autoc |= IXGBE_AUTOC_KX_SUPP;
+               if (autoc != curr_autoc)
+                       IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
        }
 
        if (status == 0) {
                hw->phy.autoneg_wait_to_complete = autoneg_wait_to_complete;
 
-               hw->mac.link_settings_loaded = true;
                /*
                 * Setup and restart the link based on the new values in
                 * ixgbe_hw This will write the AUTOC register based on the new
                 * stored values
                 */
-               ixgbe_setup_mac_link_82598(hw);
+               status = ixgbe_setup_mac_link_82598(hw);
        }
 
        return status;
@@ -561,10 +626,6 @@ static s32 ixgbe_setup_copper_link_82598(struct ixgbe_hw *hw)
        /* Restart autonegotiation on PHY */
        status = hw->phy.ops.setup_link(hw);
 
-       /* Set MAC to KX/KX4 autoneg, which defaults to Parallel detection */
-       hw->mac.link_attach_type = (IXGBE_AUTOC_10G_KX4 | IXGBE_AUTOC_1G_KX);
-       hw->mac.link_mode_select = IXGBE_AUTOC_LMS_KX4_AN;
-
        /* Set up MAC */
        ixgbe_setup_mac_link_82598(hw);
 
@@ -591,10 +652,6 @@ static s32 ixgbe_setup_copper_link_speed_82598(struct ixgbe_hw *hw,
        status = hw->phy.ops.setup_link_speed(hw, speed, autoneg,
                                              autoneg_wait_to_complete);
 
-       /* Set MAC to KX/KX4 autoneg, which defaults to Parallel detection */
-       hw->mac.link_attach_type = (IXGBE_AUTOC_10G_KX4 | IXGBE_AUTOC_1G_KX);
-       hw->mac.link_mode_select = IXGBE_AUTOC_LMS_KX4_AN;
-
        /* Set up MAC */
        ixgbe_setup_mac_link_82598(hw);
 
@@ -694,24 +751,16 @@ static s32 ixgbe_reset_hw_82598(struct ixgbe_hw *hw)
        IXGBE_WRITE_REG(hw, IXGBE_GHECCR, gheccr);
 
        /*
-        * AUTOC register which stores link settings gets cleared
-        * and reloaded from EEPROM after reset. We need to restore
-        * our stored value from init in case SW changed the attach
-        * type or speed.  If this is the first time and link settings
-        * have not been stored, store default settings from AUTOC.
+        * Store the original AUTOC value if it has not been
+        * stored off yet.  Otherwise restore the stored original
+        * AUTOC value since the reset operation sets back to deaults.
         */
        autoc = IXGBE_READ_REG(hw, IXGBE_AUTOC);
-       if (hw->mac.link_settings_loaded) {
-               autoc &= ~(IXGBE_AUTOC_LMS_ATTACH_TYPE);
-               autoc &= ~(IXGBE_AUTOC_LMS_MASK);
-               autoc |= hw->mac.link_attach_type;
-               autoc |= hw->mac.link_mode_select;
-               IXGBE_WRITE_REG(hw, IXGBE_AUTOC, autoc);
-       } else {
-               hw->mac.link_attach_type =
-                                        (autoc & IXGBE_AUTOC_LMS_ATTACH_TYPE);
-               hw->mac.link_mode_select = (autoc & IXGBE_AUTOC_LMS_MASK);
-               hw->mac.link_settings_loaded = true;
+       if (hw->mac.orig_link_settings_stored == false) {
+               hw->mac.orig_autoc = autoc;
+               hw->mac.orig_link_settings_stored = true;
+       } else if (autoc != hw->mac.orig_autoc) {
+               IXGBE_WRITE_REG(hw, IXGBE_AUTOC, hw->mac.orig_autoc);
        }
 
        /* Store the permanent mac address */
@@ -1002,6 +1051,13 @@ static s32 ixgbe_get_supported_physical_layer_82598(struct ixgbe_hw *hw)
        s32 physical_layer = IXGBE_PHYSICAL_LAYER_UNKNOWN;
 
        switch (hw->device_id) {
+       case IXGBE_DEV_ID_82598:
+               /* Default device ID is mezzanine card KX/KX4 */
+               physical_layer = (IXGBE_PHYSICAL_LAYER_10GBASE_KX4 |
+                                 IXGBE_PHYSICAL_LAYER_1000BASE_KX);
+               break;
+       case IXGBE_DEV_ID_82598_BX:
+               physical_layer = IXGBE_PHYSICAL_LAYER_1000BASE_BX;
        case IXGBE_DEV_ID_82598EB_CX4:
        case IXGBE_DEV_ID_82598_CX4_DUAL_PORT:
                physical_layer = IXGBE_PHYSICAL_LAYER_10GBASE_CX4;
index f67c68404bb382462662ea664749b080a280ab6a..5ae93989784f06f3e52993cfbbd0c696c11fcf91 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -80,9 +80,6 @@ s32 ixgbe_start_hw_generic(struct ixgbe_hw *hw)
        /* Clear the VLAN filter table */
        hw->mac.ops.clear_vfta(hw);
 
-       /* Set up link */
-       hw->mac.ops.setup_link(hw);
-
        /* Clear statistics registers */
        hw->mac.ops.clear_hw_cntrs(hw);
 
@@ -1489,6 +1486,144 @@ s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw)
        return 0;
 }
 
+/**
+ *  ixgbe_fc_autoneg - Configure flow control
+ *  @hw: pointer to hardware structure
+ *
+ *  Negotiates flow control capabilities with link partner using autoneg and
+ *  applies the results.
+ **/
+s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw)
+{
+       s32 ret_val = 0;
+       u32 i, reg, pcs_anadv_reg, pcs_lpab_reg;
+
+       reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA);
+
+       /*
+        * The possible values of fc.current_mode are:
+        * 0:  Flow control is completely disabled
+        * 1:  Rx flow control is enabled (we can receive pause frames,
+        *     but not send pause frames).
+        * 2:  Tx flow control is enabled (we can send pause frames but
+        *     we do not support receiving pause frames).
+        * 3:  Both Rx and Tx flow control (symmetric) are enabled.
+        * other: Invalid.
+        */
+       switch (hw->fc.current_mode) {
+       case ixgbe_fc_none:
+               /* Flow control completely disabled by software override. */
+               reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE);
+               break;
+       case ixgbe_fc_rx_pause:
+               /*
+                * Rx Flow control is enabled and Tx Flow control is
+                * disabled by software override. Since there really
+                * isn't a way to advertise that we are capable of RX
+                * Pause ONLY, we will advertise that we support both
+                * symmetric and asymmetric Rx PAUSE.  Later, we will
+                * disable the adapter's ability to send PAUSE frames.
+                */
+               reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE);
+               break;
+       case ixgbe_fc_tx_pause:
+               /*
+                * Tx Flow control is enabled, and Rx Flow control is
+                * disabled by software override.
+                */
+               reg |= (IXGBE_PCS1GANA_ASM_PAUSE);
+               reg &= ~(IXGBE_PCS1GANA_SYM_PAUSE);
+               break;
+       case ixgbe_fc_full:
+               /* Flow control (both Rx and Tx) is enabled by SW override. */
+               reg |= (IXGBE_PCS1GANA_SYM_PAUSE | IXGBE_PCS1GANA_ASM_PAUSE);
+               break;
+       default:
+               hw_dbg(hw, "Flow control param set incorrectly\n");
+               ret_val = -IXGBE_ERR_CONFIG;
+               goto out;
+               break;
+       }
+
+       IXGBE_WRITE_REG(hw, IXGBE_PCS1GANA, reg);
+       reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLCTL);
+
+       /* Set PCS register for autoneg */
+       /* Enable and restart autoneg */
+       reg |= IXGBE_PCS1GLCTL_AN_ENABLE | IXGBE_PCS1GLCTL_AN_RESTART;
+
+       /* Disable AN timeout */
+       if (hw->fc.strict_ieee)
+               reg &= ~IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN;
+
+       hw_dbg(hw, "Configuring Autoneg; PCS_LCTL = 0x%08X\n", reg);
+       IXGBE_WRITE_REG(hw, IXGBE_PCS1GLCTL, reg);
+
+       /* See if autonegotiation has succeeded */
+       hw->mac.autoneg_succeeded = 0;
+       for (i = 0; i < FIBER_LINK_UP_LIMIT; i++) {
+               msleep(10);
+               reg = IXGBE_READ_REG(hw, IXGBE_PCS1GLSTA);
+               if ((reg & (IXGBE_PCS1GLSTA_LINK_OK |
+                    IXGBE_PCS1GLSTA_AN_COMPLETE)) ==
+                   (IXGBE_PCS1GLSTA_LINK_OK |
+                    IXGBE_PCS1GLSTA_AN_COMPLETE)) {
+                       if (!(reg & IXGBE_PCS1GLSTA_AN_TIMED_OUT))
+                               hw->mac.autoneg_succeeded = 1;
+                       break;
+               }
+       }
+
+       if (!hw->mac.autoneg_succeeded) {
+               /* Autoneg failed to achieve a link, so we turn fc off */
+               hw->fc.current_mode = ixgbe_fc_none;
+               hw_dbg(hw, "Flow Control = NONE.\n");
+               goto out;
+       }
+
+       /*
+        * Read the AN advertisement and LP ability registers and resolve
+        * local flow control settings accordingly
+        */
+       pcs_anadv_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANA);
+       pcs_lpab_reg = IXGBE_READ_REG(hw, IXGBE_PCS1GANLP);
+       if ((pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
+               (pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE)) {
+               /*
+                * Now we need to check if the user selected Rx ONLY
+                * of pause frames.  In this case, we had to advertise
+                * FULL flow control because we could not advertise RX
+                * ONLY. Hence, we must now check to see if we need to
+                * turn OFF the TRANSMISSION of PAUSE frames.
+                */
+               if (hw->fc.requested_mode == ixgbe_fc_full) {
+                       hw->fc.current_mode = ixgbe_fc_full;
+                       hw_dbg(hw, "Flow Control = FULL.\n");
+               } else {
+                       hw->fc.current_mode = ixgbe_fc_rx_pause;
+                       hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n");
+               }
+       } else if (!(pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
+                  (pcs_anadv_reg & IXGBE_PCS1GANA_ASM_PAUSE) &&
+                  (pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
+                  (pcs_lpab_reg & IXGBE_PCS1GANA_ASM_PAUSE)) {
+               hw->fc.current_mode = ixgbe_fc_tx_pause;
+               hw_dbg(hw, "Flow Control = TX PAUSE frames only.\n");
+       } else if ((pcs_anadv_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
+                  (pcs_anadv_reg & IXGBE_PCS1GANA_ASM_PAUSE) &&
+                  !(pcs_lpab_reg & IXGBE_PCS1GANA_SYM_PAUSE) &&
+                  (pcs_lpab_reg & IXGBE_PCS1GANA_ASM_PAUSE)) {
+               hw->fc.current_mode = ixgbe_fc_rx_pause;
+               hw_dbg(hw, "Flow Control = RX PAUSE frames only.\n");
+       } else {
+               hw->fc.current_mode = ixgbe_fc_none;
+               hw_dbg(hw, "Flow Control = NONE.\n");
+       }
+
+out:
+       return ret_val;
+}
+
 /**
  *  ixgbe_disable_pcie_master - Disable PCI-express master access
  *  @hw: pointer to hardware structure
index 192f8d0129111724b25fb52a82cc4a02a02bd4f1..c63021261e56715fc4308bde459ce0188210ac2c 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -61,6 +61,9 @@ s32 ixgbe_update_uc_addr_list_generic(struct ixgbe_hw *hw, u8 *addr_list,
                                       u32 addr_count, ixgbe_mc_addr_itr func);
 s32 ixgbe_enable_mc_generic(struct ixgbe_hw *hw);
 s32 ixgbe_disable_mc_generic(struct ixgbe_hw *hw);
+s32 ixgbe_setup_fc_generic(struct ixgbe_hw *hw, s32 packetbuf_num);
+s32 ixgbe_fc_enable(struct ixgbe_hw *hw, s32 packtetbuf_num);
+s32 ixgbe_fc_autoneg(struct ixgbe_hw *hw);
 
 s32 ixgbe_validate_mac_addr(u8 *mac_addr);
 s32 ixgbe_acquire_swfw_sync(struct ixgbe_hw *hw, u16 mask);
index e2e28ac63deca37eb752b1da2a8d7f1239d11e12..2a60c89ab3465e1aeec72be9c0ee89ddc94a760a 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2007 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 75f6efe1e36920a9fba4c1f4859ec701f0a2549a..0da5c6d5bcafc3207dd8a3dc980a242cd1a610f9 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2007 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 2c046b0b5d2806507178e5a2ff948cf9217f4d61..df359554d4926fcd8812cce58e52f8987e78bbff 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2007 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -298,7 +298,7 @@ s32 ixgbe_dcb_config_pfc_82598(struct ixgbe_hw *hw,
        reg = IXGBE_READ_REG(hw, IXGBE_RMCS);
        reg &= ~IXGBE_RMCS_TFCE_802_3X;
        /* correct the reporting of our flow control status */
-       hw->fc.type = ixgbe_fc_none;
+       hw->fc.current_mode = ixgbe_fc_none;
        reg |= IXGBE_RMCS_TFCE_PRIORITY;
        IXGBE_WRITE_REG(hw, IXGBE_RMCS, reg);
 
index 1e6a313719d7e2a0237896aa997c8871b8ee25bf..ebbe53c352a7a3f6ab172bf19e520f5efb60b5d7 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2007 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 4129976953f5609f58c4f442b22f58095c8a54f7..dd9d1d63a59c0fb069cd3d6c5a5b086e8c06bbfe 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 67f87a79154dbff3f88ab64bddaa7ab2577b7099..cec2f4e8c61eae107429dafe08b9466ee26a99ec 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -89,8 +89,6 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = {
        {"rx_header_split", IXGBE_STAT(rx_hdr_split)},
        {"alloc_rx_page_failed", IXGBE_STAT(alloc_rx_page_failed)},
        {"alloc_rx_buff_failed", IXGBE_STAT(alloc_rx_buff_failed)},
-       {"lro_aggregated", IXGBE_STAT(lro_aggregated)},
-       {"lro_flushed", IXGBE_STAT(lro_flushed)},
 };
 
 #define IXGBE_QUEUE_STATS_LEN \
@@ -132,6 +130,26 @@ static int ixgbe_get_settings(struct net_device *netdev,
                        ecmd->advertising |= ADVERTISED_1000baseT_Full;
 
                ecmd->port = PORT_TP;
+       } else if (hw->phy.media_type == ixgbe_media_type_backplane) {
+               /* Set as FIBRE until SERDES defined in kernel */
+               switch (hw->device_id) {
+               case IXGBE_DEV_ID_82598:
+                       ecmd->supported |= (SUPPORTED_1000baseT_Full |
+                               SUPPORTED_FIBRE);
+                       ecmd->advertising = (ADVERTISED_10000baseT_Full |
+                               ADVERTISED_1000baseT_Full |
+                               ADVERTISED_FIBRE);
+                       ecmd->port = PORT_FIBRE;
+                       break;
+               case IXGBE_DEV_ID_82598_BX:
+                       ecmd->supported = (SUPPORTED_1000baseT_Full |
+                                          SUPPORTED_FIBRE);
+                       ecmd->advertising = (ADVERTISED_1000baseT_Full |
+                                            ADVERTISED_FIBRE);
+                       ecmd->port = PORT_FIBRE;
+                       ecmd->autoneg = AUTONEG_DISABLE;
+                       break;
+               }
        } else {
                ecmd->supported |= SUPPORTED_FIBRE;
                ecmd->advertising = (ADVERTISED_10000baseT_Full |
@@ -206,13 +224,13 @@ static void ixgbe_get_pauseparam(struct net_device *netdev,
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
        struct ixgbe_hw *hw = &adapter->hw;
 
-       pause->autoneg = (hw->fc.type == ixgbe_fc_full ? 1 : 0);
+       pause->autoneg = (hw->fc.current_mode == ixgbe_fc_full ? 1 : 0);
 
-       if (hw->fc.type == ixgbe_fc_rx_pause) {
+       if (hw->fc.current_mode == ixgbe_fc_rx_pause) {
                pause->rx_pause = 1;
-       } else if (hw->fc.type == ixgbe_fc_tx_pause) {
+       } else if (hw->fc.current_mode == ixgbe_fc_tx_pause) {
                pause->tx_pause = 1;
-       } else if (hw->fc.type == ixgbe_fc_full) {
+       } else if (hw->fc.current_mode == ixgbe_fc_full) {
                pause->rx_pause = 1;
                pause->tx_pause = 1;
        }
@@ -226,22 +244,17 @@ static int ixgbe_set_pauseparam(struct net_device *netdev,
 
        if ((pause->autoneg == AUTONEG_ENABLE) ||
            (pause->rx_pause && pause->tx_pause))
-               hw->fc.type = ixgbe_fc_full;
+               hw->fc.requested_mode = ixgbe_fc_full;
        else if (pause->rx_pause && !pause->tx_pause)
-               hw->fc.type = ixgbe_fc_rx_pause;
+               hw->fc.requested_mode = ixgbe_fc_rx_pause;
        else if (!pause->rx_pause && pause->tx_pause)
-               hw->fc.type = ixgbe_fc_tx_pause;
+               hw->fc.requested_mode = ixgbe_fc_tx_pause;
        else if (!pause->rx_pause && !pause->tx_pause)
-               hw->fc.type = ixgbe_fc_none;
+               hw->fc.requested_mode = ixgbe_fc_none;
        else
                return -EINVAL;
 
-       hw->fc.original_type = hw->fc.type;
-
-       if (netif_running(netdev))
-               ixgbe_reinit_locked(adapter);
-       else
-               ixgbe_reset(adapter);
+       hw->mac.ops.setup_fc(hw, 0);
 
        return 0;
 }
@@ -661,10 +674,17 @@ static void ixgbe_get_drvinfo(struct net_device *netdev,
                               struct ethtool_drvinfo *drvinfo)
 {
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
+       char firmware_version[32];
 
        strncpy(drvinfo->driver, ixgbe_driver_name, 32);
        strncpy(drvinfo->version, ixgbe_driver_version, 32);
-       strncpy(drvinfo->fw_version, "N/A", 32);
+
+       sprintf(firmware_version, "%d.%d-%d",
+               (adapter->eeprom_version & 0xF000) >> 12,
+               (adapter->eeprom_version & 0x0FF0) >> 4,
+               adapter->eeprom_version & 0x000F);
+
+       strncpy(drvinfo->fw_version, firmware_version, 32);
        strncpy(drvinfo->bus_info, pci_name(adapter->pdev), 32);
        drvinfo->n_stats = IXGBE_STATS_LEN;
        drvinfo->regdump_len = ixgbe_get_regs_len(netdev);
@@ -808,15 +828,6 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
        int stat_count = sizeof(struct ixgbe_queue_stats) / sizeof(u64);
        int j, k;
        int i;
-       u64 aggregated = 0, flushed = 0, no_desc = 0;
-       for (i = 0; i < adapter->num_rx_queues; i++) {
-               aggregated += adapter->rx_ring[i].lro_mgr.stats.aggregated;
-               flushed += adapter->rx_ring[i].lro_mgr.stats.flushed;
-               no_desc += adapter->rx_ring[i].lro_mgr.stats.no_desc;
-       }
-       adapter->lro_aggregated = aggregated;
-       adapter->lro_flushed = flushed;
-       adapter->lro_no_desc = no_desc;
 
        ixgbe_update_stats(adapter);
        for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {
index d2f4d5f508b75f4283774e445619b5d920029564..e0d736cc245bd54842fa94f4cb71f089c43ac20a 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -47,9 +47,9 @@ char ixgbe_driver_name[] = "ixgbe";
 static const char ixgbe_driver_string[] =
                               "Intel(R) 10 Gigabit PCI Express Network Driver";
 
-#define DRV_VERSION "1.3.30-k2"
+#define DRV_VERSION "1.3.56-k2"
 const char ixgbe_driver_version[] = DRV_VERSION;
-static char ixgbe_copyright[] = "Copyright (c) 1999-2007 Intel Corporation.";
+static char ixgbe_copyright[] = "Copyright (c) 1999-2009 Intel Corporation.";
 
 static const struct ixgbe_info *ixgbe_info_tbl[] = {
        [board_82598] = &ixgbe_82598_info,
@@ -64,6 +64,8 @@ static const struct ixgbe_info *ixgbe_info_tbl[] = {
  *   Class, Class Mask, private data (not used) }
  */
 static struct pci_device_id ixgbe_pci_tbl[] = {
+       {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598),
+        board_82598 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598AF_DUAL_PORT),
         board_82598 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598AF_SINGLE_PORT),
@@ -82,6 +84,8 @@ static struct pci_device_id ixgbe_pci_tbl[] = {
         board_82598 },
        {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598EB_SFP_LOM),
         board_82598 },
+       {PCI_VDEVICE(INTEL, IXGBE_DEV_ID_82598_BX),
+        board_82598 },
 
        /* required last entry */
        {0, }
@@ -200,9 +204,6 @@ static inline bool ixgbe_check_tx_hang(struct ixgbe_adapter *adapter,
 #define DESC_NEEDED (TXD_USE_COUNT(IXGBE_MAX_DATA_PER_TXD) /* skb->data */ + \
        MAX_SKB_FRAGS * TXD_USE_COUNT(PAGE_SIZE) + 1) /* for context */
 
-#define GET_TX_HEAD_FROM_RING(ring) (\
-       *(volatile u32 *) \
-       ((union ixgbe_adv_tx_desc *)(ring)->desc + (ring)->count))
 static void ixgbe_tx_timeout(struct net_device *netdev);
 
 /**
@@ -213,26 +214,27 @@ static void ixgbe_tx_timeout(struct net_device *netdev);
 static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
                                struct ixgbe_ring *tx_ring)
 {
-       union ixgbe_adv_tx_desc *tx_desc;
-       struct ixgbe_tx_buffer *tx_buffer_info;
        struct net_device *netdev = adapter->netdev;
-       struct sk_buff *skb;
-       unsigned int i;
-       u32 head, oldhead;
-       unsigned int count = 0;
+       union ixgbe_adv_tx_desc *tx_desc, *eop_desc;
+       struct ixgbe_tx_buffer *tx_buffer_info;
+       unsigned int i, eop, count = 0;
        unsigned int total_bytes = 0, total_packets = 0;
 
-       rmb();
-       head = GET_TX_HEAD_FROM_RING(tx_ring);
-       head = le32_to_cpu(head);
        i = tx_ring->next_to_clean;
-       while (1) {
-               while (i != head) {
+       eop = tx_ring->tx_buffer_info[i].next_to_watch;
+       eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
+
+       while ((eop_desc->wb.status & cpu_to_le32(IXGBE_TXD_STAT_DD)) &&
+              (count < tx_ring->count)) {
+               bool cleaned = false;
+               for ( ; !cleaned; count++) {
+                       struct sk_buff *skb;
                        tx_desc = IXGBE_TX_DESC_ADV(*tx_ring, i);
                        tx_buffer_info = &tx_ring->tx_buffer_info[i];
+                       cleaned = (i == eop);
                        skb = tx_buffer_info->skb;
 
-                       if (skb) {
+                       if (cleaned && skb) {
                                unsigned int segs, bytecount;
 
                                /* gso_segs is currently only valid for tcp */
@@ -247,23 +249,17 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_adapter *adapter,
                        ixgbe_unmap_and_free_tx_resource(adapter,
                                                         tx_buffer_info);
 
+                       tx_desc->wb.status = 0;
+
                        i++;
                        if (i == tx_ring->count)
                                i = 0;
-
-                       count++;
-                       if (count == tx_ring->count)
-                               goto done_cleaning;
                }
-               oldhead = head;
-               rmb();
-               head = GET_TX_HEAD_FROM_RING(tx_ring);
-               head = le32_to_cpu(head);
-               if (head == oldhead)
-                       goto done_cleaning;
-       } /* while (1) */
-
-done_cleaning:
+
+               eop = tx_ring->tx_buffer_info[i].next_to_watch;
+               eop_desc = IXGBE_TX_DESC_ADV(*tx_ring, eop);
+       }
+
        tx_ring->next_to_clean = i;
 
 #define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
@@ -297,8 +293,8 @@ done_cleaning:
 
        tx_ring->total_bytes += total_bytes;
        tx_ring->total_packets += total_packets;
-       tx_ring->stats.bytes += total_bytes;
        tx_ring->stats.packets += total_packets;
+       tx_ring->stats.bytes += total_bytes;
        adapter->net_stats.tx_bytes += total_bytes;
        adapter->net_stats.tx_packets += total_packets;
        return (total_packets ? true : false);
@@ -403,23 +399,21 @@ static int __ixgbe_notify_dca(struct device *dev, void *data)
  * @rx_ring: rx descriptor ring (for a specific queue) to setup
  * @rx_desc: rx descriptor
  **/
-static void ixgbe_receive_skb(struct ixgbe_adapter *adapter,
+static void ixgbe_receive_skb(struct ixgbe_q_vector *q_vector,
                               struct sk_buff *skb, u8 status,
-                              struct ixgbe_ring *ring,
                               union ixgbe_adv_rx_desc *rx_desc)
 {
+       struct ixgbe_adapter *adapter = q_vector->adapter;
+       struct napi_struct *napi = &q_vector->napi;
        bool is_vlan = (status & IXGBE_RXD_STAT_VP);
        u16 tag = le16_to_cpu(rx_desc->wb.upper.vlan);
 
-       if (adapter->netdev->features & NETIF_F_LRO &&
-           skb->ip_summed == CHECKSUM_UNNECESSARY) {
+       skb_record_rx_queue(skb, q_vector - &adapter->q_vector[0]);
+       if (skb->ip_summed == CHECKSUM_UNNECESSARY) {
                if (adapter->vlgrp && is_vlan && (tag != 0))
-                       lro_vlan_hwaccel_receive_skb(&ring->lro_mgr, skb,
-                                                    adapter->vlgrp, tag,
-                                                    rx_desc);
+                       vlan_gro_receive(napi, adapter->vlgrp, tag, skb);
                else
-                       lro_receive_skb(&ring->lro_mgr, skb, rx_desc);
-               ring->lro_used = true;
+                       napi_gro_receive(napi, skb);
        } else {
                if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL)) {
                        if (adapter->vlgrp && is_vlan && (tag != 0))
@@ -574,10 +568,11 @@ static inline u16 ixgbe_get_pkt_info(union ixgbe_adv_rx_desc *rx_desc)
        return rx_desc->wb.lower.lo_dword.hs_rss.pkt_info;
 }
 
-static bool ixgbe_clean_rx_irq(struct ixgbe_adapter *adapter,
+static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector,
                                struct ixgbe_ring *rx_ring,
                                int *work_done, int work_to_do)
 {
+       struct ixgbe_adapter *adapter = q_vector->adapter;
        struct pci_dev *pdev = adapter->pdev;
        union ixgbe_adv_rx_desc *rx_desc, *next_rxd;
        struct ixgbe_rx_buffer *rx_buffer_info, *next_buffer;
@@ -678,7 +673,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_adapter *adapter,
                total_rx_packets++;
 
                skb->protocol = eth_type_trans(skb, adapter->netdev);
-               ixgbe_receive_skb(adapter, skb, staterr, rx_ring, rx_desc);
+               ixgbe_receive_skb(q_vector, skb, staterr, rx_desc);
 
 next_desc:
                rx_desc->wb.upper.status_error = 0;
@@ -696,11 +691,6 @@ next_desc:
                staterr = le32_to_cpu(rx_desc->wb.upper.status_error);
        }
 
-       if (rx_ring->lro_used) {
-               lro_flush_all(&rx_ring->lro_mgr);
-               rx_ring->lro_used = false;
-       }
-
        rx_ring->next_to_clean = i;
        cleaned_count = IXGBE_DESC_UNUSED(rx_ring);
 
@@ -946,7 +936,16 @@ static irqreturn_t ixgbe_msix_lsc(int irq, void *data)
        struct net_device *netdev = data;
        struct ixgbe_adapter *adapter = netdev_priv(netdev);
        struct ixgbe_hw *hw = &adapter->hw;
-       u32 eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
+       u32 eicr;
+
+       /*
+        * Workaround for Silicon errata.  Use clear-by-write instead
+        * of clear-by-read.  Reading with EICS will return the
+        * interrupt causes without clearing, which later be done
+        * with the write to EICR.
+        */
+       eicr = IXGBE_READ_REG(hw, IXGBE_EICS);
+       IXGBE_WRITE_REG(hw, IXGBE_EICR, eicr);
 
        if (eicr & IXGBE_EICR_LSC)
                ixgbe_check_lsc(adapter);
@@ -1015,7 +1014,7 @@ static irqreturn_t ixgbe_msix_clean_rx(int irq, void *data)
        rx_ring = &(adapter->rx_ring[r_idx]);
        /* disable interrupts on this vector only */
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_EIMC, rx_ring->v_idx);
-       netif_rx_schedule(&q_vector->napi);
+       napi_schedule(&q_vector->napi);
 
        return IRQ_HANDLED;
 }
@@ -1052,11 +1051,11 @@ static int ixgbe_clean_rxonly(struct napi_struct *napi, int budget)
                ixgbe_update_rx_dca(adapter, rx_ring);
 #endif
 
-       ixgbe_clean_rx_irq(adapter, rx_ring, &work_done, budget);
+       ixgbe_clean_rx_irq(q_vector, rx_ring, &work_done, budget);
 
        /* If all Rx work done, exit the polling mode */
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                if (adapter->itr_setting & 3)
                        ixgbe_set_itr_msix(q_vector);
                if (!test_bit(__IXGBE_DOWN, &adapter->state))
@@ -1095,7 +1094,7 @@ static int ixgbe_clean_rxonly_many(struct napi_struct *napi, int budget)
                if (adapter->flags & IXGBE_FLAG_DCA_ENABLED)
                        ixgbe_update_rx_dca(adapter, rx_ring);
 #endif
-               ixgbe_clean_rx_irq(adapter, rx_ring, &work_done, budget);
+               ixgbe_clean_rx_irq(q_vector, rx_ring, &work_done, budget);
                enable_mask |= rx_ring->v_idx;
                r_idx = find_next_bit(q_vector->rxr_idx, adapter->num_rx_queues,
                                      r_idx + 1);
@@ -1105,7 +1104,7 @@ static int ixgbe_clean_rxonly_many(struct napi_struct *napi, int budget)
        rx_ring = &(adapter->rx_ring[r_idx]);
        /* If all Rx work done, exit the polling mode */
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                if (adapter->itr_setting & 3)
                        ixgbe_set_itr_msix(q_vector);
                if (!test_bit(__IXGBE_DOWN, &adapter->state))
@@ -1365,6 +1364,12 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
        struct ixgbe_hw *hw = &adapter->hw;
        u32 eicr;
 
+       /*
+        * Workaround for silicon errata.  Mask the interrupts
+        * before the read of EICR.
+        */
+       IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_IRQ_CLEAR_MASK);
+
        /* for NAPI, using EIAM to auto-mask tx/rx interrupt bits on read
         * therefore no explict interrupt disable is necessary */
        eicr = IXGBE_READ_REG(hw, IXGBE_EICR);
@@ -1381,13 +1386,13 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
 
        ixgbe_check_fan_failure(adapter, eicr);
 
-       if (netif_rx_schedule_prep(&adapter->q_vector[0].napi)) {
+       if (napi_schedule_prep(&adapter->q_vector[0].napi)) {
                adapter->tx_ring[0].total_packets = 0;
                adapter->tx_ring[0].total_bytes = 0;
                adapter->rx_ring[0].total_packets = 0;
                adapter->rx_ring[0].total_bytes = 0;
                /* would disable interrupts here but EIAM disabled it */
-               __netif_rx_schedule(&adapter->q_vector[0].napi);
+               __napi_schedule(&adapter->q_vector[0].napi);
        }
 
        return IRQ_HANDLED;
@@ -1486,7 +1491,7 @@ static void ixgbe_configure_msi_and_legacy(struct ixgbe_adapter *adapter)
  **/
 static void ixgbe_configure_tx(struct ixgbe_adapter *adapter)
 {
-       u64 tdba, tdwba;
+       u64 tdba;
        struct ixgbe_hw *hw = &adapter->hw;
        u32 i, j, tdlen, txctrl;
 
@@ -1499,11 +1504,6 @@ static void ixgbe_configure_tx(struct ixgbe_adapter *adapter)
                IXGBE_WRITE_REG(hw, IXGBE_TDBAL(j),
                                (tdba & DMA_32BIT_MASK));
                IXGBE_WRITE_REG(hw, IXGBE_TDBAH(j), (tdba >> 32));
-               tdwba = ring->dma +
-                       (ring->count * sizeof(union ixgbe_adv_tx_desc));
-               tdwba |= IXGBE_TDWBAL_HEAD_WB_ENABLE;
-               IXGBE_WRITE_REG(hw, IXGBE_TDWBAL(j), tdwba & DMA_32BIT_MASK);
-               IXGBE_WRITE_REG(hw, IXGBE_TDWBAH(j), (tdwba >> 32));
                IXGBE_WRITE_REG(hw, IXGBE_TDLEN(j), tdlen);
                IXGBE_WRITE_REG(hw, IXGBE_TDH(j), 0);
                IXGBE_WRITE_REG(hw, IXGBE_TDT(j), 0);
@@ -1568,36 +1568,6 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter, int index)
        IXGBE_WRITE_REG(&adapter->hw, IXGBE_SRRCTL(index), srrctl);
 }
 
-/**
- * ixgbe_get_skb_hdr - helper function for LRO header processing
- * @skb: pointer to sk_buff to be added to LRO packet
- * @iphdr: pointer to ip header structure
- * @tcph: pointer to tcp header structure
- * @hdr_flags: pointer to header flags
- * @priv: private data
- **/
-static int ixgbe_get_skb_hdr(struct sk_buff *skb, void **iphdr, void **tcph,
-                             u64 *hdr_flags, void *priv)
-{
-       union ixgbe_adv_rx_desc *rx_desc = priv;
-
-       /* Verify that this is a valid IPv4 TCP packet */
-       if (!((ixgbe_get_pkt_info(rx_desc) & IXGBE_RXDADV_PKTTYPE_IPV4) &&
-            (ixgbe_get_pkt_info(rx_desc) & IXGBE_RXDADV_PKTTYPE_TCP)))
-               return -1;
-
-       /* Set network headers */
-       skb_reset_network_header(skb);
-       skb_set_transport_header(skb, ip_hdrlen(skb));
-       *iphdr = ip_hdr(skb);
-       *tcph = tcp_hdr(skb);
-       *hdr_flags = LRO_IPV4 | LRO_TCP;
-       return 0;
-}
-
-#define PAGE_USE_COUNT(S) (((S) >> PAGE_SHIFT) + \
-                           (((S) & (PAGE_SIZE - 1)) ? 1 : 0))
-
 /**
  * ixgbe_configure_rx - Configure 8259x Receive Unit after Reset
  * @adapter: board private structure
@@ -1616,7 +1586,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
                          0xA54F2BEC, 0xEA49AF7C, 0xE214AD3D, 0xB855AABE,
                          0x6A3E67EA, 0x14364D17, 0x3BED200D};
        u32 fctrl, hlreg0;
-       u32 pages;
        u32 reta = 0, mrqc;
        u32 rdrxctl;
        int rx_buf_len;
@@ -1646,8 +1615,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
                hlreg0 |= IXGBE_HLREG0_JUMBOEN;
        IXGBE_WRITE_REG(hw, IXGBE_HLREG0, hlreg0);
 
-       pages = PAGE_USE_COUNT(adapter->netdev->mtu);
-
        rdlen = adapter->rx_ring[0].count * sizeof(union ixgbe_adv_rx_desc);
        /* disable receives while setting up the descriptors */
        rxctrl = IXGBE_READ_REG(hw, IXGBE_RXCTRL);
@@ -1666,16 +1633,6 @@ static void ixgbe_configure_rx(struct ixgbe_adapter *adapter)
                adapter->rx_ring[i].head = IXGBE_RDH(j);
                adapter->rx_ring[i].tail = IXGBE_RDT(j);
                adapter->rx_ring[i].rx_buf_len = rx_buf_len;
-               /* Intitial LRO Settings */
-               adapter->rx_ring[i].lro_mgr.max_aggr = IXGBE_MAX_LRO_AGGREGATE;
-               adapter->rx_ring[i].lro_mgr.max_desc = IXGBE_MAX_LRO_DESCRIPTORS;
-               adapter->rx_ring[i].lro_mgr.get_skb_header = ixgbe_get_skb_hdr;
-               adapter->rx_ring[i].lro_mgr.features = LRO_F_EXTRACT_VLAN_ID;
-               if (!(adapter->flags & IXGBE_FLAG_IN_NETPOLL))
-                       adapter->rx_ring[i].lro_mgr.features |= LRO_F_NAPI;
-               adapter->rx_ring[i].lro_mgr.dev = adapter->netdev;
-               adapter->rx_ring[i].lro_mgr.ip_summed = CHECKSUM_UNNECESSARY;
-               adapter->rx_ring[i].lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
 
                ixgbe_configure_srrctl(adapter, j);
        }
@@ -1993,11 +1950,43 @@ static void ixgbe_configure(struct ixgbe_adapter *adapter)
                                       (adapter->rx_ring[i].count - 1));
 }
 
+/**
+ * ixgbe_link_config - set up initial link with default speed and duplex
+ * @hw: pointer to private hardware struct
+ *
+ * Returns 0 on success, negative on failure
+ **/
+static int ixgbe_link_config(struct ixgbe_hw *hw)
+{
+       u32 autoneg;
+       bool link_up = false;
+       u32 ret = IXGBE_ERR_LINK_SETUP;
+
+       if (hw->mac.ops.check_link)
+               ret = hw->mac.ops.check_link(hw, &autoneg, &link_up, false);
+
+       if (ret)
+               goto link_cfg_out;
+
+       if (hw->mac.ops.get_link_capabilities)
+               ret = hw->mac.ops.get_link_capabilities(hw, &autoneg,
+                                                       &hw->mac.autoneg);
+       if (ret)
+               goto link_cfg_out;
+
+       if (hw->mac.ops.setup_link_speed)
+               ret = hw->mac.ops.setup_link_speed(hw, autoneg, true, link_up);
+
+link_cfg_out:
+       return ret;
+}
+
 static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
 {
        struct net_device *netdev = adapter->netdev;
        struct ixgbe_hw *hw = &adapter->hw;
        int i, j = 0;
+       int err;
        int max_frame = netdev->mtu + ETH_HLEN + ETH_FCS_LEN;
        u32 txdctl, rxdctl, mhadd;
        u32 gpie;
@@ -2078,6 +2067,10 @@ static int ixgbe_up_complete(struct ixgbe_adapter *adapter)
 
        ixgbe_irq_enable(adapter);
 
+       err = ixgbe_link_config(hw);
+       if (err)
+               dev_err(&adapter->pdev->dev, "link_config FAILED %d\n", err);
+
        /* enable transmits */
        netif_tx_start_all_queues(netdev);
 
@@ -2310,14 +2303,14 @@ static int ixgbe_poll(struct napi_struct *napi, int budget)
 #endif
 
        tx_cleaned = ixgbe_clean_tx_irq(adapter, adapter->tx_ring);
-       ixgbe_clean_rx_irq(adapter, adapter->rx_ring, &work_done, budget);
+       ixgbe_clean_rx_irq(q_vector, adapter->rx_ring, &work_done, budget);
 
        if (tx_cleaned)
                work_done = budget;
 
        /* If budget not fully consumed, exit the polling mode */
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                if (adapter->itr_setting & 3)
                        ixgbe_set_itr(adapter);
                if (!test_bit(__IXGBE_DOWN, &adapter->state))
@@ -2353,68 +2346,57 @@ static void ixgbe_reset_task(struct work_struct *work)
        ixgbe_reinit_locked(adapter);
 }
 
-static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
+#ifdef CONFIG_IXGBE_DCB
+static inline bool ixgbe_set_dcb_queues(struct ixgbe_adapter *adapter)
 {
-       int nrq = 1, ntq = 1;
-       int feature_mask = 0, rss_i, rss_m;
-       int dcb_i, dcb_m;
+       bool ret = false;
 
-       /* Number of supported queues */
-       switch (adapter->hw.mac.type) {
-       case ixgbe_mac_82598EB:
-               dcb_i = adapter->ring_feature[RING_F_DCB].indices;
-               dcb_m = 0;
-               rss_i = adapter->ring_feature[RING_F_RSS].indices;
-               rss_m = 0;
-               feature_mask |= IXGBE_FLAG_RSS_ENABLED;
-               feature_mask |= IXGBE_FLAG_DCB_ENABLED;
-
-               switch (adapter->flags & feature_mask) {
-               case (IXGBE_FLAG_RSS_ENABLED | IXGBE_FLAG_DCB_ENABLED):
-                       dcb_m = 0x7 << 3;
-                       rss_i = min(8, rss_i);
-                       rss_m = 0x7;
-                       nrq = dcb_i * rss_i;
-                       ntq = min(MAX_TX_QUEUES, dcb_i * rss_i);
-                       break;
-               case (IXGBE_FLAG_DCB_ENABLED):
-                       dcb_m = 0x7 << 3;
-                       nrq = dcb_i;
-                       ntq = dcb_i;
-                       break;
-               case (IXGBE_FLAG_RSS_ENABLED):
-                       rss_m = 0xF;
-                       nrq = rss_i;
-                       ntq = rss_i;
-                       break;
-               case 0:
-               default:
-                       dcb_i = 0;
-                       dcb_m = 0;
-                       rss_i = 0;
-                       rss_m = 0;
-                       nrq = 1;
-                       ntq = 1;
-                       break;
-               }
+       if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
+               adapter->ring_feature[RING_F_DCB].mask = 0x7 << 3;
+               adapter->num_rx_queues =
+                                     adapter->ring_feature[RING_F_DCB].indices;
+               adapter->num_tx_queues =
+                                     adapter->ring_feature[RING_F_DCB].indices;
+               ret = true;
+       } else {
+               ret = false;
+       }
 
-               /* Sanity check, we should never have zero queues */
-               nrq = (nrq ?:1);
-               ntq = (ntq ?:1);
+       return ret;
+}
+#endif
 
-               adapter->ring_feature[RING_F_DCB].indices = dcb_i;
-               adapter->ring_feature[RING_F_DCB].mask = dcb_m;
-               adapter->ring_feature[RING_F_RSS].indices = rss_i;
-               adapter->ring_feature[RING_F_RSS].mask = rss_m;
-               break;
-       default:
-               nrq = 1;
-               ntq = 1;
-               break;
+static inline bool ixgbe_set_rss_queues(struct ixgbe_adapter *adapter)
+{
+       bool ret = false;
+
+       if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
+               adapter->ring_feature[RING_F_RSS].mask = 0xF;
+               adapter->num_rx_queues =
+                                     adapter->ring_feature[RING_F_RSS].indices;
+               adapter->num_tx_queues =
+                                     adapter->ring_feature[RING_F_RSS].indices;
+               ret = true;
+       } else {
+               ret = false;
        }
 
-       adapter->num_rx_queues = nrq;
-       adapter->num_tx_queues = ntq;
+       return ret;
+}
+
+static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
+{
+       /* Start with base case */
+       adapter->num_rx_queues = 1;
+       adapter->num_tx_queues = 1;
+
+#ifdef CONFIG_IXGBE_DCB
+       if (ixgbe_set_dcb_queues(adapter))
+               return;
+
+#endif
+       if (ixgbe_set_rss_queues(adapter))
+               return;
 }
 
 static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
@@ -2460,71 +2442,98 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
                ixgbe_set_num_queues(adapter);
        } else {
                adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */
-               adapter->num_msix_vectors = vectors;
+               /*
+                * Adjust for only the vectors we'll use, which is minimum
+                * of max_msix_q_vectors + NON_Q_VECTORS, or the number of
+                * vectors we were allocated.
+                */
+               adapter->num_msix_vectors = min(vectors,
+                                  adapter->max_msix_q_vectors + NON_Q_VECTORS);
        }
 }
 
 /**
- * ixgbe_cache_ring_register - Descriptor ring to register mapping
+ * ixgbe_cache_ring_rss - Descriptor ring to register mapping for RSS
  * @adapter: board private structure to initialize
  *
- * Once we know the feature-set enabled for the device, we'll cache
- * the register offset the descriptor ring is assigned to.
+ * Cache the descriptor ring offsets for RSS to the assigned rings.
+ *
  **/
-static void ixgbe_cache_ring_register(struct ixgbe_adapter *adapter)
+static inline bool ixgbe_cache_ring_rss(struct ixgbe_adapter *adapter)
 {
-       int feature_mask = 0, rss_i;
-       int i, txr_idx, rxr_idx;
-       int dcb_i;
+       int i;
+       bool ret = false;
 
-       /* Number of supported queues */
-       switch (adapter->hw.mac.type) {
-       case ixgbe_mac_82598EB:
-               dcb_i = adapter->ring_feature[RING_F_DCB].indices;
-               rss_i = adapter->ring_feature[RING_F_RSS].indices;
-               txr_idx = 0;
-               rxr_idx = 0;
-               feature_mask |= IXGBE_FLAG_DCB_ENABLED;
-               feature_mask |= IXGBE_FLAG_RSS_ENABLED;
-               switch (adapter->flags & feature_mask) {
-               case (IXGBE_FLAG_RSS_ENABLED | IXGBE_FLAG_DCB_ENABLED):
-                       for (i = 0; i < dcb_i; i++) {
-                               int j;
-                               /* Rx first */
-                               for (j = 0; j < adapter->num_rx_queues; j++) {
-                                       adapter->rx_ring[rxr_idx].reg_idx =
-                                               i << 3 | j;
-                                       rxr_idx++;
-                               }
-                               /* Tx now */
-                               for (j = 0; j < adapter->num_tx_queues; j++) {
-                                       adapter->tx_ring[txr_idx].reg_idx =
-                                               i << 2 | (j >> 1);
-                                       if (j & 1)
-                                               txr_idx++;
-                               }
-                       }
-               case (IXGBE_FLAG_DCB_ENABLED):
+       if (adapter->flags & IXGBE_FLAG_RSS_ENABLED) {
+               for (i = 0; i < adapter->num_rx_queues; i++)
+                       adapter->rx_ring[i].reg_idx = i;
+               for (i = 0; i < adapter->num_tx_queues; i++)
+                       adapter->tx_ring[i].reg_idx = i;
+               ret = true;
+       } else {
+               ret = false;
+       }
+
+       return ret;
+}
+
+#ifdef CONFIG_IXGBE_DCB
+/**
+ * ixgbe_cache_ring_dcb - Descriptor ring to register mapping for DCB
+ * @adapter: board private structure to initialize
+ *
+ * Cache the descriptor ring offsets for DCB to the assigned rings.
+ *
+ **/
+static inline bool ixgbe_cache_ring_dcb(struct ixgbe_adapter *adapter)
+{
+       int i;
+       bool ret = false;
+       int dcb_i = adapter->ring_feature[RING_F_DCB].indices;
+
+       if (adapter->flags & IXGBE_FLAG_DCB_ENABLED) {
+               if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
                        /* the number of queues is assumed to be symmetric */
                        for (i = 0; i < dcb_i; i++) {
                                adapter->rx_ring[i].reg_idx = i << 3;
                                adapter->tx_ring[i].reg_idx = i << 2;
                        }
-                       break;
-               case (IXGBE_FLAG_RSS_ENABLED):
-                       for (i = 0; i < adapter->num_rx_queues; i++)
-                               adapter->rx_ring[i].reg_idx = i;
-                       for (i = 0; i < adapter->num_tx_queues; i++)
-                               adapter->tx_ring[i].reg_idx = i;
-                       break;
-               case 0:
-               default:
-                       break;
+                       ret = true;
+               } else {
+                       ret = false;
                }
-               break;
-       default:
-               break;
+       } else {
+               ret = false;
        }
+
+       return ret;
+}
+#endif
+
+/**
+ * ixgbe_cache_ring_register - Descriptor ring to register mapping
+ * @adapter: board private structure to initialize
+ *
+ * Once we know the feature-set enabled for the device, we'll cache
+ * the register offset the descriptor ring is assigned to.
+ *
+ * Note, the order the various feature calls is important.  It must start with
+ * the "most" features enabled at the same time, then trickle down to the
+ * least amount of features turned on at once.
+ **/
+static void ixgbe_cache_ring_register(struct ixgbe_adapter *adapter)
+{
+       /* start with default case */
+       adapter->rx_ring[0].reg_idx = 0;
+       adapter->tx_ring[0].reg_idx = 0;
+
+#ifdef CONFIG_IXGBE_DCB
+       if (ixgbe_cache_ring_dcb(adapter))
+               return;
+
+#endif
+       if (ixgbe_cache_ring_rss(adapter))
+               return;
 }
 
 /**
@@ -2785,6 +2794,7 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
        adapter->ring_feature[RING_F_RSS].indices = rss;
        adapter->flags |= IXGBE_FLAG_RSS_ENABLED;
        adapter->ring_feature[RING_F_DCB].indices = IXGBE_MAX_DCB_INDICES;
+       adapter->max_msix_q_vectors = MAX_MSIX_Q_VECTORS_82598;
 
 #ifdef CONFIG_IXGBE_DCB
        /* Configure DCB traffic classes */
@@ -2810,16 +2820,12 @@ static int __devinit ixgbe_sw_init(struct ixgbe_adapter *adapter)
                adapter->flags |= IXGBE_FLAG_FAN_FAIL_CAPABLE;
 
        /* default flow control settings */
-       hw->fc.original_type = ixgbe_fc_none;
-       hw->fc.type = ixgbe_fc_none;
+       hw->fc.requested_mode = ixgbe_fc_none;
        hw->fc.high_water = IXGBE_DEFAULT_FCRTH;
        hw->fc.low_water = IXGBE_DEFAULT_FCRTL;
        hw->fc.pause_time = IXGBE_DEFAULT_FCPAUSE;
        hw->fc.send_xon = true;
 
-       /* select 10G link by default */
-       hw->mac.link_mode_select = IXGBE_AUTOC_LMS_10G_LINK_NO_AN;
-
        /* enable itr by default in dynamic mode */
        adapter->itr_setting = 1;
        adapter->eitr_param = 20000;
@@ -2866,8 +2872,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_adapter *adapter,
        memset(tx_ring->tx_buffer_info, 0, size);
 
        /* round up to nearest 4K */
-       tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc) +
-                       sizeof(u32);
+       tx_ring->size = tx_ring->count * sizeof(union ixgbe_adv_tx_desc);
        tx_ring->size = ALIGN(tx_ring->size, 4096);
 
        tx_ring->desc = pci_alloc_consistent(pdev, tx_ring->size,
@@ -2926,12 +2931,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
        struct pci_dev *pdev = adapter->pdev;
        int size;
 
-       size = sizeof(struct net_lro_desc) * IXGBE_MAX_LRO_DESCRIPTORS;
-       rx_ring->lro_mgr.lro_arr = vmalloc(size);
-       if (!rx_ring->lro_mgr.lro_arr)
-               return -ENOMEM;
-       memset(rx_ring->lro_mgr.lro_arr, 0, size);
-
        size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
        rx_ring->rx_buffer_info = vmalloc(size);
        if (!rx_ring->rx_buffer_info) {
@@ -2960,8 +2959,6 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
        return 0;
 
 alloc_failed:
-       vfree(rx_ring->lro_mgr.lro_arr);
-       rx_ring->lro_mgr.lro_arr = NULL;
        return -ENOMEM;
 }
 
@@ -3039,9 +3036,6 @@ void ixgbe_free_rx_resources(struct ixgbe_adapter *adapter,
 {
        struct pci_dev *pdev = adapter->pdev;
 
-       vfree(rx_ring->lro_mgr.lro_arr);
-       rx_ring->lro_mgr.lro_arr = NULL;
-
        ixgbe_clean_rx_ring(adapter, rx_ring);
 
        vfree(rx_ring->rx_buffer_info);
@@ -3619,13 +3613,13 @@ static bool ixgbe_tx_csum(struct ixgbe_adapter *adapter,
 
                if (skb->ip_summed == CHECKSUM_PARTIAL) {
                        switch (skb->protocol) {
-                       case __constant_htons(ETH_P_IP):
+                       case cpu_to_be16(ETH_P_IP):
                                type_tucmd_mlhl |= IXGBE_ADVTXD_TUCMD_IPV4;
                                if (ip_hdr(skb)->protocol == IPPROTO_TCP)
                                        type_tucmd_mlhl |=
                                                IXGBE_ADVTXD_TUCMD_L4T_TCP;
                                break;
-                       case __constant_htons(ETH_P_IPV6):
+                       case cpu_to_be16(ETH_P_IPV6):
                                /* XXX what about other V6 headers?? */
                                if (ipv6_hdr(skb)->nexthdr == IPPROTO_TCP)
                                        type_tucmd_mlhl |=
@@ -3948,26 +3942,6 @@ static void ixgbe_netpoll(struct net_device *netdev)
 }
 #endif
 
-/**
- * ixgbe_link_config - set up initial link with default speed and duplex
- * @hw: pointer to private hardware struct
- *
- * Returns 0 on success, negative on failure
- **/
-static int ixgbe_link_config(struct ixgbe_hw *hw)
-{
-       u32 autoneg = IXGBE_LINK_SPEED_10GB_FULL;
-
-       /* must always autoneg for both 1G and 10G link */
-       hw->mac.autoneg = true;
-
-       if ((hw->mac.type == ixgbe_mac_82598EB) &&
-           (hw->phy.media_type == ixgbe_media_type_copper))
-               autoneg = IXGBE_LINK_SPEED_82598_AUTONEG;
-
-       return hw->mac.ops.setup_link_speed(hw, autoneg, true, true);
-}
-
 static const struct net_device_ops ixgbe_netdev_ops = {
        .ndo_open               = ixgbe_open,
        .ndo_stop               = ixgbe_close,
@@ -4141,7 +4115,7 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
        netdev->features |= NETIF_F_IPV6_CSUM;
        netdev->features |= NETIF_F_TSO;
        netdev->features |= NETIF_F_TSO6;
-       netdev->features |= NETIF_F_LRO;
+       netdev->features |= NETIF_F_GRO;
 
        netdev->vlan_features |= NETIF_F_TSO;
        netdev->vlan_features |= NETIF_F_TSO6;
@@ -4212,16 +4186,12 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
                         "PCI-Express slot is required.\n");
        }
 
+       /* save off EEPROM version number */
+       hw->eeprom.ops.read(hw, 0x29, &adapter->eeprom_version);
+
        /* reset the hardware with the new settings */
        hw->mac.ops.start_hw(hw);
 
-       /* link_config depends on start_hw being called at least once */
-       err = ixgbe_link_config(hw);
-       if (err) {
-               dev_err(&pdev->dev, "setup_link_speed FAILED %d\n", err);
-               goto err_register;
-       }
-
        netif_carrier_off(netdev);
 
        strcpy(netdev->name, "eth%d");
index 5a8669aedf6417a244b0b4908f91e1913b530a11..77ec26f5650ae9808611127308fd72f0b09a9f96 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index 43a97bc420f54c0dbda983bdcbb214aad955f94b..539a3061eb29ac6a16553aedb41a4809cc1002b7 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
index f011c57c92051e419c31914c0639f221d25f1645..237c688f8b6e3196f2c202c96b297b3ecf0d93fc 100644 (file)
@@ -1,7 +1,7 @@
 /*******************************************************************************
 
   Intel 10 Gigabit PCI Express Linux driver
-  Copyright(c) 1999 - 2008 Intel Corporation.
+  Copyright(c) 1999 - 2009 Intel Corporation.
 
   This program is free software; you can redistribute it and/or modify it
   under the terms and conditions of the GNU General Public License,
@@ -34,6 +34,8 @@
 #define IXGBE_INTEL_VENDOR_ID   0x8086
 
 /* Device IDs */
+#define IXGBE_DEV_ID_82598               0x10B6
+#define IXGBE_DEV_ID_82598_BX            0x1508
 #define IXGBE_DEV_ID_82598AF_DUAL_PORT   0x10C6
 #define IXGBE_DEV_ID_82598AF_SINGLE_PORT 0x10C7
 #define IXGBE_DEV_ID_82598EB_SFP_LOM     0x10DB
 #define IXGBE_LED_OFF           0xF
 
 /* AUTOC Bit Masks */
+#define IXGBE_AUTOC_KX4_KX_SUPP_MASK 0xC0000000
 #define IXGBE_AUTOC_KX4_SUPP    0x80000000
 #define IXGBE_AUTOC_KX_SUPP     0x40000000
 #define IXGBE_AUTOC_PAUSE       0x30000000
 #define IXGBE_LINK_UP_TIME      90 /* 9.0 Seconds */
 #define IXGBE_AUTO_NEG_TIME     45 /* 4.5 Seconds */
 
+#define FIBER_LINK_UP_LIMIT     50
+
+/* PCS1GLSTA Bit Masks */
+#define IXGBE_PCS1GLSTA_LINK_OK         1
+#define IXGBE_PCS1GLSTA_SYNK_OK         0x10
+#define IXGBE_PCS1GLSTA_AN_COMPLETE     0x10000
+#define IXGBE_PCS1GLSTA_AN_PAGE_RX      0x20000
+#define IXGBE_PCS1GLSTA_AN_TIMED_OUT    0x40000
+#define IXGBE_PCS1GLSTA_AN_REMOTE_FAULT 0x80000
+#define IXGBE_PCS1GLSTA_AN_ERROR_RWS    0x100000
+
+#define IXGBE_PCS1GANA_SYM_PAUSE        0x80
+#define IXGBE_PCS1GANA_ASM_PAUSE        0x100
+
+/* PCS1GLCTL Bit Masks */
+#define IXGBE_PCS1GLCTL_AN_1G_TIMEOUT_EN  0x00040000 /* PCS 1G autoneg to en */
+#define IXGBE_PCS1GLCTL_FLV_LINK_UP     1
+#define IXGBE_PCS1GLCTL_FORCE_LINK      0x20
+#define IXGBE_PCS1GLCTL_LOW_LINK_LATCH  0x40
+#define IXGBE_PCS1GLCTL_AN_ENABLE       0x10000
+#define IXGBE_PCS1GLCTL_AN_RESTART      0x20000
+
 /* SW Semaphore Register bitmasks */
 #define IXGBE_SWSM_SMBI 0x00000001 /* Driver Semaphore bit */
 #define IXGBE_SWSM_SWESMBI 0x00000002 /* FW Semaphore bit */
 #define IXGBE_FW_PTR            0x0F
 #define IXGBE_PBANUM0_PTR       0x15
 #define IXGBE_PBANUM1_PTR       0x16
+#define IXGBE_PCIE_MSIX_82598_CAPS  0x62
+
+/* MSI-X capability fields masks */
+#define IXGBE_PCIE_MSIX_TBL_SZ_MASK     0x7FF
 
 /* Legacy EEPROM word offsets */
 #define IXGBE_ISCSI_BOOT_CAPS           0x0033
@@ -1263,7 +1292,7 @@ enum ixgbe_media_type {
 };
 
 /* Flow Control Settings */
-enum ixgbe_fc_type {
+enum ixgbe_fc_mode {
        ixgbe_fc_none = 0,
        ixgbe_fc_rx_pause,
        ixgbe_fc_tx_pause,
@@ -1287,8 +1316,8 @@ struct ixgbe_fc_info {
        u16 pause_time; /* Flow Control Pause timer */
        bool send_xon; /* Flow control send XON */
        bool strict_ieee; /* Strict IEEE mode */
-       enum ixgbe_fc_type type; /* Type of flow control */
-       enum ixgbe_fc_type original_type;
+       enum ixgbe_fc_mode current_mode; /* FC mode in effect */
+       enum ixgbe_fc_mode requested_mode; /* FC mode requested by caller */
 };
 
 /* Statistics counters collected by the MAC */
@@ -1449,11 +1478,12 @@ struct ixgbe_mac_info {
        u32                             num_rar_entries;
        u32                             max_tx_queues;
        u32                             max_rx_queues;
-       u32                             link_attach_type;
-       u32                             link_mode_select;
-       bool                            link_settings_loaded;
+       u32                             max_msix_vectors;
+       u32                             orig_autoc;
+       u32                             orig_autoc2;
+       bool                            orig_link_settings_stored;
        bool                            autoneg;
-       bool                            autoneg_failed;
+       bool                            autoneg_succeeded;
 };
 
 struct ixgbe_phy_info {
@@ -1467,6 +1497,7 @@ struct ixgbe_phy_info {
        bool                            reset_disable;
        ixgbe_autoneg_advertised        autoneg_advertised;
        bool                            autoneg_wait_to_complete;
+       bool                            multispeed_fiber;
 };
 
 struct ixgbe_hw {
index 014745720560df448b6654c0f051093505838e46..d3bf2f017cc27f0507b393a07761b198a15cd123 100644 (file)
@@ -141,7 +141,7 @@ static int ixpdev_poll(struct napi_struct *napi, int budget)
                        break;
        } while (ixp2000_reg_read(IXP2000_IRQ_THD_RAW_STATUS_A_0) & 0x00ff);
 
-       netif_rx_complete(napi);
+       napi_complete(napi);
        ixp2000_reg_write(IXP2000_IRQ_THD_ENABLE_SET_A_0, 0x00ff);
 
        return rx;
@@ -204,7 +204,7 @@ static irqreturn_t ixpdev_interrupt(int irq, void *dev_id)
 
                ixp2000_reg_wrb(IXP2000_IRQ_THD_ENABLE_CLEAR_A_0, 0x00ff);
                if (likely(napi_schedule_prep(&ip->napi))) {
-                       __netif_rx_schedule(&ip->napi);
+                       __napi_schedule(&ip->napi);
                } else {
                        printk(KERN_CRIT "ixp2000: irq while polling!!\n");
                }
index 334ff9e12cdd25c5aa131ce98e10fd485a435189..14248cfc3dfd165d74d2656d8a56431460478538 100644 (file)
@@ -131,7 +131,8 @@ static int __init sonic_probe1(struct net_device *dev)
        if (sonic_debug  &&  version_printed++ == 0)
                printk(version);
 
-       printk(KERN_INFO "%s: Sonic ethernet found at 0x%08lx, ", lp->device->bus_id, dev->base_addr);
+       printk(KERN_INFO "%s: Sonic ethernet found at 0x%08lx, ",
+              dev_name(lp->device), dev->base_addr);
 
        /*
         * Put the sonic into software reset, then
@@ -156,7 +157,8 @@ static int __init sonic_probe1(struct net_device *dev)
        if ((lp->descriptors = dma_alloc_coherent(lp->device,
                                SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
                                &lp->descriptors_laddr, GFP_KERNEL)) == NULL) {
-               printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", lp->device->bus_id);
+               printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n",
+                      dev_name(lp->device));
                goto out;
        }
 
index 5154411b5e6b0821054cdefef093947bf99a8333..e321c678b11c098f7436a9eb950912c50d6f47f1 100644 (file)
@@ -398,15 +398,15 @@ struct jme_ring {
 #define JME_NAPI_WEIGHT(w) int w
 #define JME_NAPI_WEIGHT_VAL(w) w
 #define JME_NAPI_WEIGHT_SET(w, r)
-#define JME_RX_COMPLETE(dev, napis) netif_rx_complete(napis)
+#define JME_RX_COMPLETE(dev, napis) napi_complete(napis)
 #define JME_NAPI_ENABLE(priv) napi_enable(&priv->napi);
 #define JME_NAPI_DISABLE(priv) \
        if (!napi_disable_pending(&priv->napi)) \
                napi_disable(&priv->napi);
 #define JME_RX_SCHEDULE_PREP(priv) \
-       netif_rx_schedule_prep(&priv->napi)
+       napi_schedule_prep(&priv->napi)
 #define JME_RX_SCHEDULE(priv) \
-       __netif_rx_schedule(&priv->napi);
+       __napi_schedule(&priv->napi);
 
 /*
  * Jmac Adapter Private data
index 75010cac76ac7e63e4f046322dcd21ec1525c278..38d6649a29c42a491139b2cb882d3a68421c0fc3 100644 (file)
@@ -334,7 +334,7 @@ static irqreturn_t korina_rx_dma_interrupt(int irq, void *dev_id)
                                DMA_STAT_HALT | DMA_STAT_ERR),
                                &lp->rx_dma_regs->dmasm);
 
-               netif_rx_schedule(&lp->napi);
+               napi_schedule(&lp->napi);
 
                if (dmas & DMA_STAT_ERR)
                        printk(KERN_ERR DRV_NAME "%s: DMA error\n", dev->name);
@@ -468,7 +468,7 @@ static int korina_poll(struct napi_struct *napi, int budget)
 
        work_done = korina_rx(dev, budget);
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
                writel(readl(&lp->rx_dma_regs->dmasm) &
                        ~(DMA_STAT_DONE | DMA_STAT_HALT | DMA_STAT_ERR),
index d7afb938ea626ae3bdf2c3c005dfacab258f2696..d83d4010656d60e58727f2542bbe27129bb16a91 100644 (file)
@@ -391,7 +391,8 @@ MODULE_LICENSE("GPL");
    */
 static int __init do_lance_probe(struct net_device *dev)
 {
-       int *port, result;
+       unsigned int *port;
+       int result;
 
        if (high_memory <= phys_to_virt(16*1024*1024))
                lance_need_isa_bounce_buffers = 0;
@@ -456,13 +457,13 @@ out:
 static int __init lance_probe1(struct net_device *dev, int ioaddr, int irq, int options)
 {
        struct lance_private *lp;
-       long dma_channels;                      /* Mark spuriously-busy DMA channels */
+       unsigned long dma_channels;     /* Mark spuriously-busy DMA channels */
        int i, reset_val, lance_version;
        const char *chipname;
        /* Flags for specific chips or boards. */
-       unsigned char hpJ2405A = 0;             /* HP ISA adaptor */
-       int hp_builtin = 0;                     /* HP on-board ethernet. */
-       static int did_version;                 /* Already printed version info. */
+       unsigned char hpJ2405A = 0;     /* HP ISA adaptor */
+       int hp_builtin = 0;             /* HP on-board ethernet. */
+       static int did_version;         /* Already printed version info. */
        unsigned long flags;
        int err = -ENOMEM;
        void __iomem *bios;
index f6c4936e2fa8e368ca1f2fdbdb09ad75d990562e..872c1bdf42bd4d211d6f78cb3137067afc72ed58 100644 (file)
@@ -211,10 +211,10 @@ static int macb_mii_probe(struct net_device *dev)
 
        /* attach the mac to the phy */
        if (pdata && pdata->is_rmii) {
-               phydev = phy_connect(dev, phydev->dev.bus_id,
+               phydev = phy_connect(dev, dev_name(&phydev->dev),
                        &macb_handle_link_change, 0, PHY_INTERFACE_MODE_RMII);
        } else {
-               phydev = phy_connect(dev, phydev->dev.bus_id,
+               phydev = phy_connect(dev, dev_name(&phydev->dev),
                        &macb_handle_link_change, 0, PHY_INTERFACE_MODE_MII);
        }
 
@@ -527,7 +527,7 @@ static int macb_poll(struct napi_struct *napi, int budget)
                 * this function was called last time, and no packets
                 * have been received since.
                 */
-               netif_rx_complete(napi);
+               napi_complete(napi);
                goto out;
        }
 
@@ -538,13 +538,13 @@ static int macb_poll(struct napi_struct *napi, int budget)
                dev_warn(&bp->pdev->dev,
                         "No RX buffers complete, status = %02lx\n",
                         (unsigned long)status);
-               netif_rx_complete(napi);
+               napi_complete(napi);
                goto out;
        }
 
        work_done = macb_rx(bp, budget);
        if (work_done < budget)
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
        /*
         * We've done what we can to clean the buffers. Make sure we
@@ -579,7 +579,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
                }
 
                if (status & MACB_RX_INT_FLAGS) {
-                       if (netif_rx_schedule_prep(&bp->napi)) {
+                       if (napi_schedule_prep(&bp->napi)) {
                                /*
                                 * There's no point taking any more interrupts
                                 * until we have processed the buffers
@@ -587,7 +587,7 @@ static irqreturn_t macb_interrupt(int irq, void *dev_id)
                                macb_writel(bp, IDR, MACB_RX_INT_FLAGS);
                                dev_dbg(&bp->pdev->dev,
                                        "scheduling RX softirq\n");
-                               __netif_rx_schedule(&bp->napi);
+                               __napi_schedule(&bp->napi);
                        }
                }
 
@@ -1077,7 +1077,7 @@ static void macb_get_drvinfo(struct net_device *dev,
 
        strcpy(info->driver, bp->pdev->dev.driver->name);
        strcpy(info->version, "$Revision: 1.14 $");
-       strcpy(info->bus_info, bp->pdev->dev.bus_id);
+       strcpy(info->bus_info, dev_name(&bp->pdev->dev));
 }
 
 static struct ethtool_ops macb_ethtool_ops = {
@@ -1234,8 +1234,8 @@ static int __init macb_probe(struct platform_device *pdev)
 
        phydev = bp->phy_dev;
        printk(KERN_INFO "%s: attached PHY driver [%s] "
-               "(mii_bus:phy_addr=%s, irq=%d)\n",
-               dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
+               "(mii_bus:phy_addr=%s, irq=%d)\n", dev->name,
+               phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
 
        return 0;
 
index 205bb05c25d6f41a2eec0abfdb958348179d0e93..527166e35d566b11897055e0aabb99911ab17c43 100644 (file)
@@ -176,7 +176,8 @@ static int __init macsonic_init(struct net_device *dev)
        if ((lp->descriptors = dma_alloc_coherent(lp->device,
                    SIZEOF_SONIC_DESC * SONIC_BUS_SCALE(lp->dma_bitmode),
                    &lp->descriptors_laddr, GFP_KERNEL)) == NULL) {
-               printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n", lp->device->bus_id);
+               printk(KERN_ERR "%s: couldn't alloc DMA memory for descriptors.\n",
+                      dev_name(lp->device));
                return -ENOMEM;
        }
 
@@ -337,7 +338,7 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev)
                sonic_version_printed = 1;
        }
        printk(KERN_INFO "%s: onboard / comm-slot SONIC at 0x%08lx\n",
-              lp->device->bus_id, dev->base_addr);
+              dev_name(lp->device), dev->base_addr);
 
        /* The PowerBook's SONIC is 16 bit always. */
        if (macintosh_config->ident == MAC_MODEL_PB520) {
@@ -370,10 +371,10 @@ static int __init mac_onboard_sonic_probe(struct net_device *dev)
        }
        printk(KERN_INFO
               "%s: revision 0x%04x, using %d bit DMA and register offset %d\n",
-              lp->device->bus_id, sr, lp->dma_bitmode?32:16, lp->reg_offset);
+              dev_name(lp->device), sr, lp->dma_bitmode?32:16, lp->reg_offset);
 
 #if 0 /* This is sometimes useful to find out how MacOS configured the card. */
-       printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", lp->device->bus_id,
+       printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", dev_name(lp->device),
               SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff);
 #endif
 
@@ -525,12 +526,12 @@ static int __init mac_nubus_sonic_probe(struct net_device *dev)
                sonic_version_printed = 1;
        }
        printk(KERN_INFO "%s: %s in slot %X\n",
-              lp->device->bus_id, ndev->board->name, ndev->board->slot);
+              dev_name(lp->device), ndev->board->name, ndev->board->slot);
        printk(KERN_INFO "%s: revision 0x%04x, using %d bit DMA and register offset %d\n",
-              lp->device->bus_id, SONIC_READ(SONIC_SR), dma_bitmode?32:16, reg_offset);
+              dev_name(lp->device), SONIC_READ(SONIC_SR), dma_bitmode?32:16, reg_offset);
 
 #if 0 /* This is sometimes useful to find out how MacOS configured the card. */
-       printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", lp->device->bus_id,
+       printk(KERN_INFO "%s: DCR: 0x%04x, DCR2: 0x%04x\n", dev_name(lp->device),
               SONIC_READ(SONIC_DCR) & 0xffff, SONIC_READ(SONIC_DCR2) & 0xffff);
 #endif
 
index c61b0bdca1a433c33771784d88fb8f6eae3f092d..a4130e764991a79e77a30395c685a2ac5088188e 100644 (file)
@@ -768,6 +768,7 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud
 
                skb->ip_summed = ip_summed;
                skb->protocol = eth_type_trans(skb, dev);
+               skb_record_rx_queue(skb, cq->ring);
 
                /* Push it up the stack */
                if (priv->vlgrp && (be32_to_cpu(cqe->vlan_my_qpn) &
@@ -814,7 +815,7 @@ void mlx4_en_rx_irq(struct mlx4_cq *mcq)
        struct mlx4_en_priv *priv = netdev_priv(cq->dev);
 
        if (priv->port_up)
-               netif_rx_schedule(&cq->napi);
+               napi_schedule(&cq->napi);
        else
                mlx4_en_arm_cq(priv, cq);
 }
@@ -834,7 +835,7 @@ int mlx4_en_poll_rx_cq(struct napi_struct *napi, int budget)
                INC_PERF_COUNTER(priv->pstats.napi_quota);
        else {
                /* Done for now */
-               netif_rx_complete(napi);
+               napi_complete(napi);
                mlx4_en_arm_cq(priv, cq);
        }
        return done;
index 13f11f402a9948b77878b108dca8ae36ecace50a..56912add8b1364ae12b1fe0a402b7a5e28b293dd 100644 (file)
@@ -53,6 +53,7 @@
 #include <linux/mv643xx_eth.h>
 #include <linux/io.h>
 #include <linux/types.h>
+#include <linux/inet_lro.h>
 #include <asm/system.h>
 
 static char mv643xx_eth_driver_name[] = "mv643xx_eth";
@@ -227,6 +228,12 @@ struct tx_desc {
 #define RX_ENABLE_INTERRUPT            0x20000000
 #define RX_FIRST_DESC                  0x08000000
 #define RX_LAST_DESC                   0x04000000
+#define RX_IP_HDR_OK                   0x02000000
+#define RX_PKT_IS_IPV4                 0x01000000
+#define RX_PKT_IS_ETHERNETV2           0x00800000
+#define RX_PKT_LAYER4_TYPE_MASK                0x00600000
+#define RX_PKT_LAYER4_TYPE_TCP_IPV4    0x00000000
+#define RX_PKT_IS_VLAN_TAGGED          0x00080000
 
 /* TX descriptor command */
 #define TX_ENABLE_INTERRUPT            0x00800000
@@ -286,6 +293,9 @@ struct mv643xx_eth_shared_private {
 #define TX_BW_CONTROL_OLD_LAYOUT       1
 #define TX_BW_CONTROL_NEW_LAYOUT       2
 
+static int mv643xx_eth_open(struct net_device *dev);
+static int mv643xx_eth_stop(struct net_device *dev);
+
 
 /* per-port *****************************************************************/
 struct mib_counters {
@@ -321,6 +331,12 @@ struct mib_counters {
        u32 late_collision;
 };
 
+struct lro_counters {
+       u32 lro_aggregated;
+       u32 lro_flushed;
+       u32 lro_no_desc;
+};
+
 struct rx_queue {
        int index;
 
@@ -334,6 +350,11 @@ struct rx_queue {
        dma_addr_t rx_desc_dma;
        int rx_desc_area_size;
        struct sk_buff **rx_skb;
+
+#ifdef CONFIG_MV643XX_ETH_LRO
+       struct net_lro_mgr lro_mgr;
+       struct net_lro_desc lro_arr[8];
+#endif
 };
 
 struct tx_queue {
@@ -369,6 +390,8 @@ struct mv643xx_eth_private {
        spinlock_t mib_counters_lock;
        struct mib_counters mib_counters;
 
+       struct lro_counters lro_counters;
+
        struct work_struct tx_timeout_task;
 
        struct napi_struct napi;
@@ -385,7 +408,7 @@ struct mv643xx_eth_private {
        /*
         * RX state.
         */
-       int default_rx_ring_size;
+       int rx_ring_size;
        unsigned long rx_desc_sram_addr;
        int rx_desc_sram_size;
        int rxq_count;
@@ -395,7 +418,7 @@ struct mv643xx_eth_private {
        /*
         * TX state.
         */
-       int default_tx_ring_size;
+       int tx_ring_size;
        unsigned long tx_desc_sram_addr;
        int tx_desc_sram_size;
        int txq_count;
@@ -493,12 +516,42 @@ static void txq_maybe_wake(struct tx_queue *txq)
 
 
 /* rx napi ******************************************************************/
+#ifdef CONFIG_MV643XX_ETH_LRO
+static int
+mv643xx_get_skb_header(struct sk_buff *skb, void **iphdr, void **tcph,
+                      u64 *hdr_flags, void *priv)
+{
+       unsigned long cmd_sts = (unsigned long)priv;
+
+       /*
+        * Make sure that this packet is Ethernet II, is not VLAN
+        * tagged, is IPv4, has a valid IP header, and is TCP.
+        */
+       if ((cmd_sts & (RX_IP_HDR_OK | RX_PKT_IS_IPV4 |
+                      RX_PKT_IS_ETHERNETV2 | RX_PKT_LAYER4_TYPE_MASK |
+                      RX_PKT_IS_VLAN_TAGGED)) !=
+           (RX_IP_HDR_OK | RX_PKT_IS_IPV4 |
+            RX_PKT_IS_ETHERNETV2 | RX_PKT_LAYER4_TYPE_TCP_IPV4))
+               return -1;
+
+       skb_reset_network_header(skb);
+       skb_set_transport_header(skb, ip_hdrlen(skb));
+       *iphdr = ip_hdr(skb);
+       *tcph = tcp_hdr(skb);
+       *hdr_flags = LRO_IPV4 | LRO_TCP;
+
+       return 0;
+}
+#endif
+
 static int rxq_process(struct rx_queue *rxq, int budget)
 {
        struct mv643xx_eth_private *mp = rxq_to_mp(rxq);
        struct net_device_stats *stats = &mp->dev->stats;
+       int lro_flush_needed;
        int rx;
 
+       lro_flush_needed = 0;
        rx = 0;
        while (rx < budget && rxq->rx_desc_count) {
                struct rx_desc *rx_desc;
@@ -558,7 +611,15 @@ static int rxq_process(struct rx_queue *rxq, int budget)
                if (cmd_sts & LAYER_4_CHECKSUM_OK)
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                skb->protocol = eth_type_trans(skb, mp->dev);
-               netif_receive_skb(skb);
+
+#ifdef CONFIG_MV643XX_ETH_LRO
+               if (skb->dev->features & NETIF_F_LRO &&
+                   skb->ip_summed == CHECKSUM_UNNECESSARY) {
+                       lro_receive_skb(&rxq->lro_mgr, skb, (void *)cmd_sts);
+                       lro_flush_needed = 1;
+               } else
+#endif
+                       netif_receive_skb(skb);
 
                continue;
 
@@ -579,6 +640,11 @@ err:
                dev_kfree_skb(skb);
        }
 
+#ifdef CONFIG_MV643XX_ETH_LRO
+       if (lro_flush_needed)
+               lro_flush_all(&rxq->lro_mgr);
+#endif
+
        if (rx < budget)
                mp->work_rx &= ~(1 << rxq->index);
 
@@ -907,7 +973,7 @@ static int txq_reclaim(struct tx_queue *txq, int budget, int force)
 
                if (skb != NULL) {
                        if (skb_queue_len(&mp->rx_recycle) <
-                                       mp->default_rx_ring_size &&
+                                       mp->rx_ring_size &&
                            skb_recycle_check(skb, mp->skb_size +
                                        dma_get_cache_alignment() - 1))
                                __skb_queue_head(&mp->rx_recycle, skb);
@@ -1158,6 +1224,28 @@ static struct net_device_stats *mv643xx_eth_get_stats(struct net_device *dev)
        return stats;
 }
 
+static void mv643xx_eth_grab_lro_stats(struct mv643xx_eth_private *mp)
+{
+       u32 lro_aggregated = 0;
+       u32 lro_flushed = 0;
+       u32 lro_no_desc = 0;
+       int i;
+
+#ifdef CONFIG_MV643XX_ETH_LRO
+       for (i = 0; i < mp->rxq_count; i++) {
+               struct rx_queue *rxq = mp->rxq + i;
+
+               lro_aggregated += rxq->lro_mgr.stats.aggregated;
+               lro_flushed += rxq->lro_mgr.stats.flushed;
+               lro_no_desc += rxq->lro_mgr.stats.no_desc;
+       }
+#endif
+
+       mp->lro_counters.lro_aggregated = lro_aggregated;
+       mp->lro_counters.lro_flushed = lro_flushed;
+       mp->lro_counters.lro_no_desc = lro_no_desc;
+}
+
 static inline u32 mib_read(struct mv643xx_eth_private *mp, int offset)
 {
        return rdl(mp, MIB_COUNTERS(mp->port_num) + offset);
@@ -1221,6 +1309,85 @@ static void mib_counters_timer_wrapper(unsigned long _mp)
 }
 
 
+/* interrupt coalescing *****************************************************/
+/*
+ * Hardware coalescing parameters are set in units of 64 t_clk
+ * cycles.  I.e.:
+ *
+ *     coal_delay_in_usec = 64000000 * register_value / t_clk_rate
+ *
+ *     register_value = coal_delay_in_usec * t_clk_rate / 64000000
+ *
+ * In the ->set*() methods, we round the computed register value
+ * to the nearest integer.
+ */
+static unsigned int get_rx_coal(struct mv643xx_eth_private *mp)
+{
+       u32 val = rdlp(mp, SDMA_CONFIG);
+       u64 temp;
+
+       if (mp->shared->extended_rx_coal_limit)
+               temp = ((val & 0x02000000) >> 10) | ((val & 0x003fff80) >> 7);
+       else
+               temp = (val & 0x003fff00) >> 8;
+
+       temp *= 64000000;
+       do_div(temp, mp->shared->t_clk);
+
+       return (unsigned int)temp;
+}
+
+static void set_rx_coal(struct mv643xx_eth_private *mp, unsigned int usec)
+{
+       u64 temp;
+       u32 val;
+
+       temp = (u64)usec * mp->shared->t_clk;
+       temp += 31999999;
+       do_div(temp, 64000000);
+
+       val = rdlp(mp, SDMA_CONFIG);
+       if (mp->shared->extended_rx_coal_limit) {
+               if (temp > 0xffff)
+                       temp = 0xffff;
+               val &= ~0x023fff80;
+               val |= (temp & 0x8000) << 10;
+               val |= (temp & 0x7fff) << 7;
+       } else {
+               if (temp > 0x3fff)
+                       temp = 0x3fff;
+               val &= ~0x003fff00;
+               val |= (temp & 0x3fff) << 8;
+       }
+       wrlp(mp, SDMA_CONFIG, val);
+}
+
+static unsigned int get_tx_coal(struct mv643xx_eth_private *mp)
+{
+       u64 temp;
+
+       temp = (rdlp(mp, TX_FIFO_URGENT_THRESHOLD) & 0x3fff0) >> 4;
+       temp *= 64000000;
+       do_div(temp, mp->shared->t_clk);
+
+       return (unsigned int)temp;
+}
+
+static void set_tx_coal(struct mv643xx_eth_private *mp, unsigned int usec)
+{
+       u64 temp;
+
+       temp = (u64)usec * mp->shared->t_clk;
+       temp += 31999999;
+       do_div(temp, 64000000);
+
+       if (temp > 0x3fff)
+               temp = 0x3fff;
+
+       wrlp(mp, TX_FIFO_URGENT_THRESHOLD, temp << 4);
+}
+
+
 /* ethtool ******************************************************************/
 struct mv643xx_eth_stats {
        char stat_string[ETH_GSTRING_LEN];
@@ -1237,6 +1404,10 @@ struct mv643xx_eth_stats {
        { #m, FIELD_SIZEOF(struct mib_counters, m),             \
          -1, offsetof(struct mv643xx_eth_private, mib_counters.m) }
 
+#define LROSTAT(m)                                             \
+       { #m, FIELD_SIZEOF(struct lro_counters, m),             \
+         -1, offsetof(struct mv643xx_eth_private, lro_counters.m) }
+
 static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
        SSTAT(rx_packets),
        SSTAT(tx_packets),
@@ -1276,12 +1447,15 @@ static const struct mv643xx_eth_stats mv643xx_eth_stats[] = {
        MIBSTAT(bad_crc_event),
        MIBSTAT(collision),
        MIBSTAT(late_collision),
+       LROSTAT(lro_aggregated),
+       LROSTAT(lro_flushed),
+       LROSTAT(lro_no_desc),
 };
 
 static int
-mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+mv643xx_eth_get_settings_phy(struct mv643xx_eth_private *mp,
+                            struct ethtool_cmd *cmd)
 {
-       struct mv643xx_eth_private *mp = netdev_priv(dev);
        int err;
 
        err = phy_read_status(mp->phy);
@@ -1298,10 +1472,9 @@ mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 }
 
 static int
-mv643xx_eth_get_settings_phyless(struct net_device *dev,
+mv643xx_eth_get_settings_phyless(struct mv643xx_eth_private *mp,
                                 struct ethtool_cmd *cmd)
 {
-       struct mv643xx_eth_private *mp = netdev_priv(dev);
        u32 port_status;
 
        port_status = rdlp(mp, PORT_STATUS);
@@ -1333,11 +1506,25 @@ mv643xx_eth_get_settings_phyless(struct net_device *dev,
        return 0;
 }
 
+static int
+mv643xx_eth_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+       struct mv643xx_eth_private *mp = netdev_priv(dev);
+
+       if (mp->phy != NULL)
+               return mv643xx_eth_get_settings_phy(mp, cmd);
+       else
+               return mv643xx_eth_get_settings_phyless(mp, cmd);
+}
+
 static int
 mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
        struct mv643xx_eth_private *mp = netdev_priv(dev);
 
+       if (mp->phy == NULL)
+               return -EINVAL;
+
        /*
         * The MAC does not support 1000baseT_Half.
         */
@@ -1346,13 +1533,6 @@ mv643xx_eth_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        return phy_ethtool_sset(mp->phy, cmd);
 }
 
-static int
-mv643xx_eth_set_settings_phyless(struct net_device *dev,
-                                struct ethtool_cmd *cmd)
-{
-       return -EINVAL;
-}
-
 static void mv643xx_eth_get_drvinfo(struct net_device *dev,
                                    struct ethtool_drvinfo *drvinfo)
 {
@@ -1367,17 +1547,95 @@ static int mv643xx_eth_nway_reset(struct net_device *dev)
 {
        struct mv643xx_eth_private *mp = netdev_priv(dev);
 
+       if (mp->phy == NULL)
+               return -EINVAL;
+
        return genphy_restart_aneg(mp->phy);
 }
 
-static int mv643xx_eth_nway_reset_phyless(struct net_device *dev)
+static u32 mv643xx_eth_get_link(struct net_device *dev)
 {
-       return -EINVAL;
+       return !!netif_carrier_ok(dev);
 }
 
-static u32 mv643xx_eth_get_link(struct net_device *dev)
+static int
+mv643xx_eth_get_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
 {
-       return !!netif_carrier_ok(dev);
+       struct mv643xx_eth_private *mp = netdev_priv(dev);
+
+       ec->rx_coalesce_usecs = get_rx_coal(mp);
+       ec->tx_coalesce_usecs = get_tx_coal(mp);
+
+       return 0;
+}
+
+static int
+mv643xx_eth_set_coalesce(struct net_device *dev, struct ethtool_coalesce *ec)
+{
+       struct mv643xx_eth_private *mp = netdev_priv(dev);
+
+       set_rx_coal(mp, ec->rx_coalesce_usecs);
+       set_tx_coal(mp, ec->tx_coalesce_usecs);
+
+       return 0;
+}
+
+static void
+mv643xx_eth_get_ringparam(struct net_device *dev, struct ethtool_ringparam *er)
+{
+       struct mv643xx_eth_private *mp = netdev_priv(dev);
+
+       er->rx_max_pending = 4096;
+       er->tx_max_pending = 4096;
+       er->rx_mini_max_pending = 0;
+       er->rx_jumbo_max_pending = 0;
+
+       er->rx_pending = mp->rx_ring_size;
+       er->tx_pending = mp->tx_ring_size;
+       er->rx_mini_pending = 0;
+       er->rx_jumbo_pending = 0;
+}
+
+static int
+mv643xx_eth_set_ringparam(struct net_device *dev, struct ethtool_ringparam *er)
+{
+       struct mv643xx_eth_private *mp = netdev_priv(dev);
+
+       if (er->rx_mini_pending || er->rx_jumbo_pending)
+               return -EINVAL;
+
+       mp->rx_ring_size = er->rx_pending < 4096 ? er->rx_pending : 4096;
+       mp->tx_ring_size = er->tx_pending < 4096 ? er->tx_pending : 4096;
+
+       if (netif_running(dev)) {
+               mv643xx_eth_stop(dev);
+               if (mv643xx_eth_open(dev)) {
+                       dev_printk(KERN_ERR, &dev->dev,
+                                  "fatal error on re-opening device after "
+                                  "ring param change\n");
+                       return -ENOMEM;
+               }
+       }
+
+       return 0;
+}
+
+static u32
+mv643xx_eth_get_rx_csum(struct net_device *dev)
+{
+       struct mv643xx_eth_private *mp = netdev_priv(dev);
+
+       return !!(rdlp(mp, PORT_CONFIG) & 0x02000000);
+}
+
+static int
+mv643xx_eth_set_rx_csum(struct net_device *dev, u32 rx_csum)
+{
+       struct mv643xx_eth_private *mp = netdev_priv(dev);
+
+       wrlp(mp, PORT_CONFIG, rx_csum ? 0x02000000 : 0x00000000);
+
+       return 0;
 }
 
 static void mv643xx_eth_get_strings(struct net_device *dev,
@@ -1403,6 +1661,7 @@ static void mv643xx_eth_get_ethtool_stats(struct net_device *dev,
 
        mv643xx_eth_get_stats(dev);
        mib_counters_update(mp);
+       mv643xx_eth_grab_lro_stats(mp);
 
        for (i = 0; i < ARRAY_SIZE(mv643xx_eth_stats); i++) {
                const struct mv643xx_eth_stats *stat;
@@ -1434,21 +1693,18 @@ static const struct ethtool_ops mv643xx_eth_ethtool_ops = {
        .get_drvinfo            = mv643xx_eth_get_drvinfo,
        .nway_reset             = mv643xx_eth_nway_reset,
        .get_link               = mv643xx_eth_get_link,
+       .get_coalesce           = mv643xx_eth_get_coalesce,
+       .set_coalesce           = mv643xx_eth_set_coalesce,
+       .get_ringparam          = mv643xx_eth_get_ringparam,
+       .set_ringparam          = mv643xx_eth_set_ringparam,
+       .get_rx_csum            = mv643xx_eth_get_rx_csum,
+       .set_rx_csum            = mv643xx_eth_set_rx_csum,
+       .set_tx_csum            = ethtool_op_set_tx_csum,
        .set_sg                 = ethtool_op_set_sg,
        .get_strings            = mv643xx_eth_get_strings,
        .get_ethtool_stats      = mv643xx_eth_get_ethtool_stats,
-       .get_sset_count         = mv643xx_eth_get_sset_count,
-};
-
-static const struct ethtool_ops mv643xx_eth_ethtool_ops_phyless = {
-       .get_settings           = mv643xx_eth_get_settings_phyless,
-       .set_settings           = mv643xx_eth_set_settings_phyless,
-       .get_drvinfo            = mv643xx_eth_get_drvinfo,
-       .nway_reset             = mv643xx_eth_nway_reset_phyless,
-       .get_link               = mv643xx_eth_get_link,
-       .set_sg                 = ethtool_op_set_sg,
-       .get_strings            = mv643xx_eth_get_strings,
-       .get_ethtool_stats      = mv643xx_eth_get_ethtool_stats,
+       .get_flags              = ethtool_op_get_flags,
+       .set_flags              = ethtool_op_set_flags,
        .get_sset_count         = mv643xx_eth_get_sset_count,
 };
 
@@ -1637,7 +1893,7 @@ static int rxq_init(struct mv643xx_eth_private *mp, int index)
 
        rxq->index = index;
 
-       rxq->rx_ring_size = mp->default_rx_ring_size;
+       rxq->rx_ring_size = mp->rx_ring_size;
 
        rxq->rx_desc_count = 0;
        rxq->rx_curr_desc = 0;
@@ -1683,6 +1939,21 @@ static int rxq_init(struct mv643xx_eth_private *mp, int index)
                                        nexti * sizeof(struct rx_desc);
        }
 
+#ifdef CONFIG_MV643XX_ETH_LRO
+       rxq->lro_mgr.dev = mp->dev;
+       memset(&rxq->lro_mgr.stats, 0, sizeof(rxq->lro_mgr.stats));
+       rxq->lro_mgr.features = LRO_F_NAPI;
+       rxq->lro_mgr.ip_summed = CHECKSUM_UNNECESSARY;
+       rxq->lro_mgr.ip_summed_aggr = CHECKSUM_UNNECESSARY;
+       rxq->lro_mgr.max_desc = ARRAY_SIZE(rxq->lro_arr);
+       rxq->lro_mgr.max_aggr = 32;
+       rxq->lro_mgr.frag_align_pad = 0;
+       rxq->lro_mgr.lro_arr = rxq->lro_arr;
+       rxq->lro_mgr.get_skb_header = mv643xx_get_skb_header;
+
+       memset(&rxq->lro_arr, 0, sizeof(rxq->lro_arr));
+#endif
+
        return 0;
 
 
@@ -1737,7 +2008,7 @@ static int txq_init(struct mv643xx_eth_private *mp, int index)
 
        txq->index = index;
 
-       txq->tx_ring_size = mp->default_tx_ring_size;
+       txq->tx_ring_size = mp->tx_ring_size;
 
        txq->tx_desc_count = 0;
        txq->tx_curr_desc = 0;
@@ -2061,36 +2332,6 @@ static void port_start(struct mv643xx_eth_private *mp)
        }
 }
 
-static void set_rx_coal(struct mv643xx_eth_private *mp, unsigned int delay)
-{
-       unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64;
-       u32 val;
-
-       val = rdlp(mp, SDMA_CONFIG);
-       if (mp->shared->extended_rx_coal_limit) {
-               if (coal > 0xffff)
-                       coal = 0xffff;
-               val &= ~0x023fff80;
-               val |= (coal & 0x8000) << 10;
-               val |= (coal & 0x7fff) << 7;
-       } else {
-               if (coal > 0x3fff)
-                       coal = 0x3fff;
-               val &= ~0x003fff00;
-               val |= (coal & 0x3fff) << 8;
-       }
-       wrlp(mp, SDMA_CONFIG, val);
-}
-
-static void set_tx_coal(struct mv643xx_eth_private *mp, unsigned int delay)
-{
-       unsigned int coal = ((mp->shared->t_clk / 1000000) * delay) / 64;
-
-       if (coal > 0x3fff)
-               coal = 0x3fff;
-       wrlp(mp, TX_FIFO_URGENT_THRESHOLD, (coal & 0x3fff) << 4);
-}
-
 static void mv643xx_eth_recalc_skb_size(struct mv643xx_eth_private *mp)
 {
        int skb_size;
@@ -2531,17 +2772,17 @@ static void set_params(struct mv643xx_eth_private *mp,
        else
                uc_addr_get(mp, dev->dev_addr);
 
-       mp->default_rx_ring_size = DEFAULT_RX_QUEUE_SIZE;
+       mp->rx_ring_size = DEFAULT_RX_QUEUE_SIZE;
        if (pd->rx_queue_size)
-               mp->default_rx_ring_size = pd->rx_queue_size;
+               mp->rx_ring_size = pd->rx_queue_size;
        mp->rx_desc_sram_addr = pd->rx_sram_addr;
        mp->rx_desc_sram_size = pd->rx_sram_size;
 
        mp->rxq_count = pd->rx_queue_count ? : 1;
 
-       mp->default_tx_ring_size = DEFAULT_TX_QUEUE_SIZE;
+       mp->tx_ring_size = DEFAULT_TX_QUEUE_SIZE;
        if (pd->tx_queue_size)
-               mp->default_tx_ring_size = pd->tx_queue_size;
+               mp->tx_ring_size = pd->tx_queue_size;
        mp->tx_desc_sram_addr = pd->tx_sram_addr;
        mp->tx_desc_sram_size = pd->tx_sram_size;
 
@@ -2588,7 +2829,7 @@ static void phy_init(struct mv643xx_eth_private *mp, int speed, int duplex)
 
        phy_reset(mp);
 
-       phy_attach(mp->dev, phy->dev.bus_id, 0, PHY_INTERFACE_MODE_GMII);
+       phy_attach(mp->dev, dev_name(&phy->dev), 0, PHY_INTERFACE_MODE_GMII);
 
        if (speed == 0) {
                phy->autoneg = AUTONEG_ENABLE;
@@ -2672,12 +2913,10 @@ static int mv643xx_eth_probe(struct platform_device *pdev)
        if (pd->phy_addr != MV643XX_ETH_PHY_NONE)
                mp->phy = phy_scan(mp, pd->phy_addr);
 
-       if (mp->phy != NULL) {
+       if (mp->phy != NULL)
                phy_init(mp, pd->speed, pd->duplex);
-               SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);
-       } else {
-               SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops_phyless);
-       }
+
+       SET_ETHTOOL_OPS(dev, &mv643xx_eth_ethtool_ops);
 
        init_pscr(mp, pd->speed, pd->duplex);
 
index e9c1296b267eccecb1eba8d7e9c53ffe7dcceeea..aea9fdaa3cd50db7e9ba983bf7174f0b302eb0f1 100644 (file)
@@ -1324,6 +1324,7 @@ myri10ge_rx_done(struct myri10ge_slice_state *ss, struct myri10ge_rx_buf *rx,
                skb_shinfo(skb)->nr_frags = 0;
        }
        skb->protocol = eth_type_trans(skb, dev);
+       skb_record_rx_queue(skb, ss - &mgp->ss[0]);
 
        if (mgp->csum_flag) {
                if ((skb->protocol == htons(ETH_P_IP)) ||
@@ -1514,7 +1515,7 @@ static int myri10ge_poll(struct napi_struct *napi, int budget)
        work_done = myri10ge_clean_rx_done(ss, budget);
 
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                put_be32(htonl(3), ss->irq_claim);
        }
        return work_done;
@@ -1532,7 +1533,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
        /* an interrupt on a non-zero receive-only slice is implicitly
         * valid  since MSI-X irqs are not shared */
        if ((mgp->dev->real_num_tx_queues == 1) && (ss != mgp->ss)) {
-               netif_rx_schedule(&ss->napi);
+               napi_schedule(&ss->napi);
                return (IRQ_HANDLED);
        }
 
@@ -1543,7 +1544,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
        /* low bit indicates receives are present, so schedule
         * napi poll handler */
        if (stats->valid & 1)
-               netif_rx_schedule(&ss->napi);
+               napi_schedule(&ss->napi);
 
        if (!mgp->msi_enabled && !mgp->msix_enabled) {
                put_be32(0, mgp->irq_deassert);
index 899ed065a1478dc7ef4303b445285954776eb282..88b52883acea0705804aa6b7ee04da7c2e963ddf 100644 (file)
@@ -748,7 +748,7 @@ static int myri_rebuild_header(struct sk_buff *skb)
        switch (eth->h_proto)
        {
 #ifdef CONFIG_INET
-       case __constant_htons(ETH_P_IP):
+       case cpu_to_be16(ETH_P_IP):
                return arp_find(eth->h_dest, skb);
 #endif
 
index c5dec54251bf4ad4641d3100e3e8d786e4f8a362..c23a58624a33fc00ea301e57aae28424c41aca6e 100644 (file)
@@ -2198,10 +2198,10 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
 
        prefetch(&np->rx_skbuff[np->cur_rx % RX_RING_SIZE]);
 
-       if (netif_rx_schedule_prep(&np->napi)) {
+       if (napi_schedule_prep(&np->napi)) {
                /* Disable interrupts and register for poll */
                natsemi_irq_disable(dev);
-               __netif_rx_schedule(&np->napi);
+               __napi_schedule(&np->napi);
        } else
                printk(KERN_WARNING
                       "%s: Ignoring interrupt, status %#08x, mask %#08x.\n",
@@ -2253,7 +2253,7 @@ static int natsemi_poll(struct napi_struct *napi, int budget)
                np->intr_status = readl(ioaddr + IntrStatus);
        } while (np->intr_status);
 
-       netif_rx_complete(napi);
+       napi_complete(napi);
 
        /* Reenable interrupts providing nothing is trying to shut
         * the chip down. */
index 821cff68b3f302c9fa7260215583e113e971b051..b2f67b98c934bf2ac083fbfa6162728eb15e76f4 100644 (file)
@@ -936,13 +936,12 @@ netxen_nic_pci_set_crbwindow_2M(struct netxen_adapter *adapter, ulong *off)
        u32 win_read;
 
        adapter->crb_win = CRB_HI(*off);
-       writel(adapter->crb_win, (void *)(CRB_WINDOW_2M +
-               adapter->ahw.pci_base0));
+       writel(adapter->crb_win, (adapter->ahw.pci_base0 + CRB_WINDOW_2M));
        /*
         * Read back value to make sure write has gone through before trying
         * to use it.
         */
-       win_read = readl((void *)(CRB_WINDOW_2M + adapter->ahw.pci_base0));
+       win_read = readl(adapter->ahw.pci_base0 + CRB_WINDOW_2M);
        if (win_read != adapter->crb_win) {
                printk(KERN_ERR "%s: Written crbwin (0x%x) != "
                                "Read crbwin (0x%x), off=0x%lx\n",
@@ -992,6 +991,8 @@ netxen_nic_hw_write_wx_128M(struct netxen_adapter *adapter,
 {
        void __iomem *addr;
 
+       BUG_ON(len != 4);
+
        if (ADDR_IN_WINDOW1(off)) {
                addr = NETXEN_CRB_NORMALIZE(adapter, off);
        } else {                /* Window 0 */
@@ -999,37 +1000,13 @@ netxen_nic_hw_write_wx_128M(struct netxen_adapter *adapter,
                netxen_nic_pci_change_crbwindow_128M(adapter, 0);
        }
 
-       DPRINTK(INFO, "writing to base %lx offset %llx addr %p"
-               " data %llx len %d\n",
-               pci_base(adapter, off), off, addr,
-               *(unsigned long long *)data, len);
        if (!addr) {
                netxen_nic_pci_change_crbwindow_128M(adapter, 1);
                return 1;
        }
 
-       switch (len) {
-       case 1:
-               writeb(*(u8 *) data, addr);
-               break;
-       case 2:
-               writew(*(u16 *) data, addr);
-               break;
-       case 4:
-               writel(*(u32 *) data, addr);
-               break;
-       case 8:
-               writeq(*(u64 *) data, addr);
-               break;
-       default:
-               DPRINTK(INFO,
-                       "writing data %lx to offset %llx, num words=%d\n",
-                       *(unsigned long *)data, off, (len >> 3));
+       writel(*(u32 *) data, addr);
 
-               netxen_nic_hw_block_write64((u64 __iomem *) data, addr,
-                                           (len >> 3));
-               break;
-       }
        if (!ADDR_IN_WINDOW1(off))
                netxen_nic_pci_change_crbwindow_128M(adapter, 1);
 
@@ -1042,6 +1019,8 @@ netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter,
 {
        void __iomem *addr;
 
+       BUG_ON(len != 4);
+
        if (ADDR_IN_WINDOW1(off)) {     /* Window 1 */
                addr = NETXEN_CRB_NORMALIZE(adapter, off);
        } else {                /* Window 0 */
@@ -1049,31 +1028,12 @@ netxen_nic_hw_read_wx_128M(struct netxen_adapter *adapter,
                netxen_nic_pci_change_crbwindow_128M(adapter, 0);
        }
 
-       DPRINTK(INFO, "reading from base %lx offset %llx addr %p\n",
-               pci_base(adapter, off), off, addr);
        if (!addr) {
                netxen_nic_pci_change_crbwindow_128M(adapter, 1);
                return 1;
        }
-       switch (len) {
-       case 1:
-               *(u8 *) data = readb(addr);
-               break;
-       case 2:
-               *(u16 *) data = readw(addr);
-               break;
-       case 4:
-               *(u32 *) data = readl(addr);
-               break;
-       case 8:
-               *(u64 *) data = readq(addr);
-               break;
-       default:
-               netxen_nic_hw_block_read64((u64 __iomem *) data, addr,
-                                          (len >> 3));
-               break;
-       }
-       DPRINTK(INFO, "read %lx\n", *(unsigned long *)data);
+
+       *(u32 *)data = readl(addr);
 
        if (!ADDR_IN_WINDOW1(off))
                netxen_nic_pci_change_crbwindow_128M(adapter, 1);
@@ -1088,6 +1048,8 @@ netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter,
        unsigned long flags = 0;
        int rv;
 
+       BUG_ON(len != 4);
+
        rv = netxen_nic_pci_get_crb_addr_2M(adapter, &off, len);
 
        if (rv == -1) {
@@ -1101,34 +1063,12 @@ netxen_nic_hw_write_wx_2M(struct netxen_adapter *adapter,
                write_lock_irqsave(&adapter->adapter_lock, flags);
                crb_win_lock(adapter);
                netxen_nic_pci_set_crbwindow_2M(adapter, &off);
-       }
-
-       DPRINTK(1, INFO, "write data %lx to offset %llx, len=%d\n",
-                       *(unsigned long *)data, off, len);
-
-       switch (len) {
-       case 1:
-               writeb(*(uint8_t *)data, (void *)off);
-               break;
-       case 2:
-               writew(*(uint16_t *)data, (void *)off);
-               break;
-       case 4:
-               writel(*(uint32_t *)data, (void *)off);
-               break;
-       case 8:
-               writeq(*(uint64_t *)data, (void *)off);
-               break;
-       default:
-               DPRINTK(1, INFO,
-                       "writing data %lx to offset %llx, num words=%d\n",
-                       *(unsigned long *)data, off, (len>>3));
-               break;
-       }
-       if (rv == 1) {
+               writel(*(uint32_t *)data, (void __iomem *)off);
                crb_win_unlock(adapter);
                write_unlock_irqrestore(&adapter->adapter_lock, flags);
-       }
+       } else
+               writel(*(uint32_t *)data, (void __iomem *)off);
+
 
        return 0;
 }
@@ -1140,6 +1080,8 @@ netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter,
        unsigned long flags = 0;
        int rv;
 
+       BUG_ON(len != 4);
+
        rv = netxen_nic_pci_get_crb_addr_2M(adapter, &off, len);
 
        if (rv == -1) {
@@ -1153,33 +1095,11 @@ netxen_nic_hw_read_wx_2M(struct netxen_adapter *adapter,
                write_lock_irqsave(&adapter->adapter_lock, flags);
                crb_win_lock(adapter);
                netxen_nic_pci_set_crbwindow_2M(adapter, &off);
-       }
-
-       DPRINTK(1, INFO, "read from offset %lx, len=%d\n", off, len);
-
-       switch (len) {
-       case 1:
-               *(uint8_t *)data = readb((void *)off);
-               break;
-       case 2:
-               *(uint16_t *)data = readw((void *)off);
-               break;
-       case 4:
-               *(uint32_t *)data = readl((void *)off);
-               break;
-       case 8:
-               *(uint64_t *)data = readq((void *)off);
-               break;
-       default:
-               break;
-       }
-
-       DPRINTK(1, INFO, "read %lx\n", *(unsigned long *)data);
-
-       if (rv == 1) {
+               *(uint32_t *)data = readl((void __iomem *)off);
                crb_win_unlock(adapter);
                write_unlock_irqrestore(&adapter->adapter_lock, flags);
-       }
+       } else
+               *(uint32_t *)data = readl((void __iomem *)off);
 
        return 0;
 }
@@ -1441,10 +1361,9 @@ static int netxen_nic_pci_mem_read_direct(struct netxen_adapter *adapter,
                        u64 off, void *data, int size)
 {
        unsigned long flags;
-       void *addr;
+       void __iomem *addr, *mem_ptr = NULL;
        int ret = 0;
        u64 start;
-       uint8_t *mem_ptr = NULL;
        unsigned long mem_base;
        unsigned long mem_page;
 
@@ -1464,7 +1383,7 @@ static int netxen_nic_pci_mem_read_direct(struct netxen_adapter *adapter,
                return -1;
        }
 
-       addr = (void *)(pci_base_offset(adapter, start));
+       addr = pci_base_offset(adapter, start);
        if (!addr) {
                write_unlock_irqrestore(&adapter->adapter_lock, flags);
                mem_base = pci_resource_start(adapter->pdev, 0);
@@ -1503,7 +1422,6 @@ static int netxen_nic_pci_mem_read_direct(struct netxen_adapter *adapter,
                break;
        }
        write_unlock_irqrestore(&adapter->adapter_lock, flags);
-       DPRINTK(1, INFO, "read %llx\n", *(unsigned long long *)data);
 
        if (mem_ptr)
                iounmap(mem_ptr);
@@ -1515,10 +1433,9 @@ netxen_nic_pci_mem_write_direct(struct netxen_adapter *adapter, u64 off,
                void *data, int size)
 {
        unsigned long flags;
-       void *addr;
+       void __iomem *addr, *mem_ptr = NULL;
        int ret = 0;
        u64 start;
-       uint8_t *mem_ptr = NULL;
        unsigned long mem_base;
        unsigned long mem_page;
 
@@ -1538,7 +1455,7 @@ netxen_nic_pci_mem_write_direct(struct netxen_adapter *adapter, u64 off,
                return -1;
        }
 
-       addr = (void *)(pci_base_offset(adapter, start));
+       addr = pci_base_offset(adapter, start);
        if (!addr) {
                write_unlock_irqrestore(&adapter->adapter_lock, flags);
                mem_base = pci_resource_start(adapter->pdev, 0);
@@ -1575,8 +1492,6 @@ netxen_nic_pci_mem_write_direct(struct netxen_adapter *adapter, u64 off,
                break;
        }
        write_unlock_irqrestore(&adapter->adapter_lock, flags);
-       DPRINTK(1, INFO, "writing data %llx to offset %llx\n",
-                       *(unsigned long long *)data, start);
        if (mem_ptr)
                iounmap(mem_ptr);
        return ret;
@@ -1588,10 +1503,11 @@ int
 netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter,
                u64 off, void *data, int size)
 {
-       unsigned long   flags, mem_crb;
+       unsigned long   flags;
        int          i, j, ret = 0, loop, sz[2], off0;
        uint32_t      temp;
        uint64_t      off8, tmpw, word[2] = {0, 0};
+       void __iomem *mem_crb;
 
        /*
         * If not MN, go check for MS or invalid.
@@ -1605,7 +1521,7 @@ netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter,
        sz[0] = (size < (8 - off0)) ? size : (8 - off0);
        sz[1] = size - sz[0];
        loop = ((off0 + size - 1) >> 3) + 1;
-       mem_crb = (unsigned long)pci_base_offset(adapter, NETXEN_CRB_DDR_NET);
+       mem_crb = pci_base_offset(adapter, NETXEN_CRB_DDR_NET);
 
        if ((size != 8) || (off0 != 0))  {
                for (i = 0; i < loop; i++) {
@@ -1643,28 +1559,29 @@ netxen_nic_pci_mem_write_128M(struct netxen_adapter *adapter,
 
        for (i = 0; i < loop; i++) {
                writel((uint32_t)(off8 + (i << 3)),
-                       (void *)(mem_crb+MIU_TEST_AGT_ADDR_LO));
+                       (mem_crb+MIU_TEST_AGT_ADDR_LO));
                writel(0,
-                       (void *)(mem_crb+MIU_TEST_AGT_ADDR_HI));
+                       (mem_crb+MIU_TEST_AGT_ADDR_HI));
                writel(word[i] & 0xffffffff,
-                       (void *)(mem_crb+MIU_TEST_AGT_WRDATA_LO));
+                       (mem_crb+MIU_TEST_AGT_WRDATA_LO));
                writel((word[i] >> 32) & 0xffffffff,
-                       (void *)(mem_crb+MIU_TEST_AGT_WRDATA_HI));
+                       (mem_crb+MIU_TEST_AGT_WRDATA_HI));
                writel(MIU_TA_CTL_ENABLE|MIU_TA_CTL_WRITE,
-                       (void *)(mem_crb+MIU_TEST_AGT_CTRL));
+                       (mem_crb+MIU_TEST_AGT_CTRL));
                writel(MIU_TA_CTL_START|MIU_TA_CTL_ENABLE|MIU_TA_CTL_WRITE,
-                       (void *)(mem_crb+MIU_TEST_AGT_CTRL));
+                       (mem_crb+MIU_TEST_AGT_CTRL));
 
                for (j = 0; j < MAX_CTL_CHECK; j++) {
                        temp = readl(
-                            (void *)(mem_crb+MIU_TEST_AGT_CTRL));
+                            (mem_crb+MIU_TEST_AGT_CTRL));
                        if ((temp & MIU_TA_CTL_BUSY) == 0)
                                break;
                }
 
                if (j >= MAX_CTL_CHECK) {
-                       printk("%s: %s Fail to write through agent\n",
-                                       __func__, netxen_nic_driver_name);
+                       if (printk_ratelimit())
+                               dev_err(&adapter->pdev->dev,
+                                       "failed to write through agent\n");
                        ret = -1;
                        break;
                }
@@ -1679,10 +1596,11 @@ int
 netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter,
                u64 off, void *data, int size)
 {
-       unsigned long   flags, mem_crb;
+       unsigned long   flags;
        int          i, j = 0, k, start, end, loop, sz[2], off0[2];
        uint32_t      temp;
        uint64_t      off8, val, word[2] = {0, 0};
+       void __iomem *mem_crb;
 
 
        /*
@@ -1697,31 +1615,32 @@ netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter,
        sz[0] = (size < (8 - off0[0])) ? size : (8 - off0[0]);
        sz[1] = size - sz[0];
        loop = ((off0[0] + size - 1) >> 3) + 1;
-       mem_crb = (unsigned long)pci_base_offset(adapter, NETXEN_CRB_DDR_NET);
+       mem_crb = pci_base_offset(adapter, NETXEN_CRB_DDR_NET);
 
        write_lock_irqsave(&adapter->adapter_lock, flags);
        netxen_nic_pci_change_crbwindow_128M(adapter, 0);
 
        for (i = 0; i < loop; i++) {
                writel((uint32_t)(off8 + (i << 3)),
-                       (void *)(mem_crb+MIU_TEST_AGT_ADDR_LO));
+                       (mem_crb+MIU_TEST_AGT_ADDR_LO));
                writel(0,
-                       (void *)(mem_crb+MIU_TEST_AGT_ADDR_HI));
+                       (mem_crb+MIU_TEST_AGT_ADDR_HI));
                writel(MIU_TA_CTL_ENABLE,
-                       (void *)(mem_crb+MIU_TEST_AGT_CTRL));
+                       (mem_crb+MIU_TEST_AGT_CTRL));
                writel(MIU_TA_CTL_START|MIU_TA_CTL_ENABLE,
-                       (void *)(mem_crb+MIU_TEST_AGT_CTRL));
+                       (mem_crb+MIU_TEST_AGT_CTRL));
 
                for (j = 0; j < MAX_CTL_CHECK; j++) {
                        temp = readl(
-                             (void *)(mem_crb+MIU_TEST_AGT_CTRL));
+                             (mem_crb+MIU_TEST_AGT_CTRL));
                        if ((temp & MIU_TA_CTL_BUSY) == 0)
                                break;
                }
 
                if (j >= MAX_CTL_CHECK) {
-                       printk(KERN_ERR "%s: %s Fail to read through agent\n",
-                                       __func__, netxen_nic_driver_name);
+                       if (printk_ratelimit())
+                               dev_err(&adapter->pdev->dev,
+                                       "failed to read through agent\n");
                        break;
                }
 
@@ -1729,7 +1648,7 @@ netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter,
                end   = (off0[i] + sz[i] - 1) >> 2;
                for (k = start; k <= end; k++) {
                        word[i] |= ((uint64_t) readl(
-                                   (void *)(mem_crb +
+                                   (mem_crb +
                                    MIU_TEST_AGT_RDDATA(k))) << (32*k));
                }
        }
@@ -1761,7 +1680,6 @@ netxen_nic_pci_mem_read_128M(struct netxen_adapter *adapter,
                *(uint64_t *)data = val;
                break;
        }
-       DPRINTK(1, INFO, "read %llx\n", *(unsigned long long *)data);
        return 0;
 }
 
@@ -1857,8 +1775,9 @@ netxen_nic_pci_mem_write_2M(struct netxen_adapter *adapter,
                }
 
                if (j >= MAX_CTL_CHECK) {
-                       printk(KERN_ERR "%s: Fail to write through agent\n",
-                                       netxen_nic_driver_name);
+                       if (printk_ratelimit())
+                               dev_err(&adapter->pdev->dev,
+                                       "failed to write through agent\n");
                        ret = -1;
                        break;
                }
@@ -1927,8 +1846,9 @@ netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter,
                }
 
                if (j >= MAX_CTL_CHECK) {
-                       printk(KERN_ERR "%s: Fail to read through agent\n",
-                                       netxen_nic_driver_name);
+                       if (printk_ratelimit())
+                               dev_err(&adapter->pdev->dev,
+                                       "failed to read through agent\n");
                        break;
                }
 
@@ -1970,7 +1890,6 @@ netxen_nic_pci_mem_read_2M(struct netxen_adapter *adapter,
                *(uint64_t *)data = val;
                break;
        }
-       DPRINTK(1, INFO, "read %llx\n", *(unsigned long long *)data);
        return 0;
 }
 
@@ -2024,10 +1943,10 @@ int netxen_nic_get_board_info(struct netxen_adapter *adapter)
        int addr = NETXEN_BRDCFG_START;
        struct netxen_board_info *boardinfo;
        int index;
-       u32 *ptr32;
+       int *ptr32;
 
        boardinfo = &adapter->ahw.boardcfg;
-       ptr32 = (u32 *) boardinfo;
+       ptr32 = (int *) boardinfo;
 
        for (index = 0; index < sizeof(struct netxen_board_info) / sizeof(u32);
             index++) {
@@ -2207,13 +2126,13 @@ void netxen_nic_flash_print(struct netxen_adapter *adapter)
        char brd_name[NETXEN_MAX_SHORT_NAME];
        char serial_num[32];
        int i, addr;
-       __le32 *ptr32;
+       int *ptr32;
 
        struct netxen_board_info *board_info = &(adapter->ahw.boardcfg);
 
        adapter->driver_mismatch = 0;
 
-       ptr32 = (u32 *)&serial_num;
+       ptr32 = (int *)&serial_num;
        addr = NETXEN_USER_START +
               offsetof(struct netxen_new_user_info, serial_num);
        for (i = 0; i < 8; i++) {
index aae737dc77a8aafaa0d1453c542c2f27694d22a0..70238bf7e11ad47c9d8813d8a7bb058da38d8560 100644 (file)
@@ -54,30 +54,6 @@ static inline void writeq(u64 val, void __iomem * addr)
 }
 #endif
 
-static inline void netxen_nic_hw_block_write64(u64 __iomem * data_ptr,
-                                              u64 __iomem * addr,
-                                              int num_words)
-{
-       int num;
-       for (num = 0; num < num_words; num++) {
-               writeq(readq((void __iomem *)data_ptr), addr);
-               addr++;
-               data_ptr++;
-       }
-}
-
-static inline void netxen_nic_hw_block_read64(u64 __iomem * data_ptr,
-                                             u64 __iomem * addr, int num_words)
-{
-       int num;
-       for (num = 0; num < num_words; num++) {
-               writeq(readq((void __iomem *)addr), data_ptr);
-               addr++;
-               data_ptr++;
-       }
-
-}
-
 struct netxen_adapter;
 
 #define NETXEN_PCI_MAPSIZE_BYTES  (NETXEN_PCI_MAPSIZE << 20)
index 13087782ac4068425c78d870022d2c872a5b0d66..2648e90267261700cbe9a027b89d11c20c38ee04 100644 (file)
@@ -482,7 +482,7 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 
        u8 __iomem *db_ptr = NULL;
-       unsigned long mem_base, mem_len, db_base, db_len, pci_len0 = 0;
+       unsigned long mem_base, mem_len, db_base, db_len = 0, pci_len0 = 0;
        int i = 0, err;
        int first_driver, first_boot;
        u32 val;
@@ -616,6 +616,9 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        dev_info(&pdev->dev, "%dMB memory map\n", (int)(mem_len>>20));
 
+       if (NX_IS_REVISION_P3(revision_id))
+               goto skip_doorbell;
+
        db_base = pci_resource_start(pdev, 4);  /* doorbell is on bar 4 */
        db_len = pci_resource_len(pdev, 4);
 
@@ -625,8 +628,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                err = -EIO;
                goto err_out_iounmap;
        }
-       DPRINTK(INFO, "doorbell ioremap from %lx a size of %lx\n", db_base,
-               db_len);
 
        db_ptr = ioremap(db_base, NETXEN_DB_MAPSIZE_BYTES);
        if (!db_ptr) {
@@ -635,8 +636,8 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                err = -EIO;
                goto err_out_iounmap;
        }
-       DPRINTK(INFO, "doorbell ioremaped at %p\n", db_ptr);
 
+skip_doorbell:
        adapter->ahw.pci_base0 = mem_ptr0;
        adapter->ahw.pci_len0 = pci_len0;
        adapter->ahw.first_page_group_start = first_page_group_start;
@@ -949,8 +950,9 @@ static void __devexit netxen_nic_remove(struct pci_dev *pdev)
        if (adapter->flags & NETXEN_NIC_MSI_ENABLED)
                pci_disable_msi(pdev);
 
-       iounmap(adapter->ahw.db_base);
        iounmap(adapter->ahw.pci_base0);
+       if (adapter->ahw.db_base != NULL)
+               iounmap(adapter->ahw.db_base);
        if (adapter->ahw.pci_base1 != NULL)
                iounmap(adapter->ahw.pci_base1);
        if (adapter->ahw.pci_base2 != NULL)
@@ -1117,7 +1119,7 @@ static bool netxen_tso_check(struct net_device *netdev,
        __be16 protocol = skb->protocol;
        u16 flags = 0;
 
-       if (protocol == __constant_htons(ETH_P_8021Q)) {
+       if (protocol == cpu_to_be16(ETH_P_8021Q)) {
                struct vlan_ethhdr *vh = (struct vlan_ethhdr *)skb->data;
                protocol = vh->h_vlan_encapsulated_proto;
                flags = FLAGS_VLAN_TAGGED;
@@ -1130,21 +1132,21 @@ static bool netxen_tso_check(struct net_device *netdev,
                desc->total_hdr_length =
                        skb_transport_offset(skb) + tcp_hdrlen(skb);
 
-               opcode = (protocol == __constant_htons(ETH_P_IPV6)) ?
+               opcode = (protocol == cpu_to_be16(ETH_P_IPV6)) ?
                                TX_TCP_LSO6 : TX_TCP_LSO;
                tso = true;
 
        } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
                u8 l4proto;
 
-               if (protocol == __constant_htons(ETH_P_IP)) {
+               if (protocol == cpu_to_be16(ETH_P_IP)) {
                        l4proto = ip_hdr(skb)->protocol;
 
                        if (l4proto == IPPROTO_TCP)
                                opcode = TX_TCP_PKT;
                        else if(l4proto == IPPROTO_UDP)
                                opcode = TX_UDP_PKT;
-               } else if (protocol == __constant_htons(ETH_P_IPV6)) {
+               } else if (protocol == cpu_to_be16(ETH_P_IPV6)) {
                        l4proto = ipv6_hdr(skb)->nexthdr;
 
                        if (l4proto == IPPROTO_TCP)
@@ -1595,7 +1597,7 @@ static int netxen_nic_poll(struct napi_struct *napi, int budget)
        }
 
        if ((work_done < budget) && tx_complete) {
-               netif_rx_complete(&adapter->napi);
+               napi_complete(&adapter->napi);
                netxen_nic_enable_int(adapter);
        }
 
index 254057275e0e32eccb17bd1c26cad8b5754e125a..df5f869e8d8f1b188b4fac8e868b75da2f643966 100644 (file)
@@ -481,8 +481,9 @@ static int __init ni65_probe1(struct net_device *dev,int ioaddr)
        else {
                if(dev->dma == 0) {
                /* 'stuck test' from lance.c */
-                       long dma_channels = ((inb(DMA1_STAT_REG) >> 4) & 0x0f) |
-                                           (inb(DMA2_STAT_REG) & 0xf0);
+                       unsigned long dma_channels =
+                               ((inb(DMA1_STAT_REG) >> 4) & 0x0f)
+                               | (inb(DMA2_STAT_REG) & 0xf0);
                        for(i=1;i<5;i++) {
                                int dma = dmatab[i];
                                if(test_bit(dma,&dma_channels) || request_dma(dma,"ni6510"))
@@ -897,7 +898,6 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
 
                if(csr0 & CSR0_ERR)
                {
-                       struct priv *p = dev->ml_priv;
                        if(debuglevel > 1)
                                printk(KERN_ERR "%s: general error: %04x.\n",dev->name,csr0);
                        if(csr0 & CSR0_BABL)
@@ -922,8 +922,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
  int j;
  for(j=0;j<RMDNUM;j++)
  {
-       struct priv *p = dev->ml_priv;
-       int i,k,num1,num2;
+       int i, num2;
        for(i=RMDNUM-1;i>0;i--) {
                 num2 = (p->rmdnum + i) & (RMDNUM-1);
                 if(!(p->rmdhead[num2].u.s.status & RCV_OWN))
@@ -931,6 +930,7 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
        }
 
        if(i) {
+               int k, num1;
                for(k=0;k<RMDNUM;k++) {
                        num1 = (p->rmdnum + k) & (RMDNUM-1);
                        if(!(p->rmdhead[num1].u.s.status & RCV_OWN))
@@ -942,7 +942,6 @@ static irqreturn_t ni65_interrupt(int irq, void * dev_id)
                if(debuglevel > 0)
                {
                        char buf[256],*buf1;
-                       int k;
                        buf1 = buf;
                        for(k=0;k<RMDNUM;k++) {
                                sprintf(buf1,"%02x ",(p->rmdhead[k].u.s.status)); /* & RCV_OWN) ); */
index 0c0b752315cae844c6944b912d8605032070e93c..50c11126a3db5adaa6dbb5d48ccfad1dafe95aa6 100644 (file)
@@ -1115,6 +1115,130 @@ static int link_status_10g_serdes(struct niu *np, int *link_up_p)
        return 0;
 }
 
+static int link_status_mii(struct niu *np, int *link_up_p)
+{
+       struct niu_link_config *lp = &np->link_config;
+       int err;
+       int bmsr, advert, ctrl1000, stat1000, lpa, bmcr, estatus;
+       int supported, advertising, active_speed, active_duplex;
+
+       err = mii_read(np, np->phy_addr, MII_BMCR);
+       if (unlikely(err < 0))
+               return err;
+       bmcr = err;
+
+       err = mii_read(np, np->phy_addr, MII_BMSR);
+       if (unlikely(err < 0))
+               return err;
+       bmsr = err;
+
+       err = mii_read(np, np->phy_addr, MII_ADVERTISE);
+       if (unlikely(err < 0))
+               return err;
+       advert = err;
+
+       err = mii_read(np, np->phy_addr, MII_LPA);
+       if (unlikely(err < 0))
+               return err;
+       lpa = err;
+
+       if (likely(bmsr & BMSR_ESTATEN)) {
+               err = mii_read(np, np->phy_addr, MII_ESTATUS);
+               if (unlikely(err < 0))
+                       return err;
+               estatus = err;
+
+               err = mii_read(np, np->phy_addr, MII_CTRL1000);
+               if (unlikely(err < 0))
+                       return err;
+               ctrl1000 = err;
+
+               err = mii_read(np, np->phy_addr, MII_STAT1000);
+               if (unlikely(err < 0))
+                       return err;
+               stat1000 = err;
+       } else
+               estatus = ctrl1000 = stat1000 = 0;
+
+       supported = 0;
+       if (bmsr & BMSR_ANEGCAPABLE)
+               supported |= SUPPORTED_Autoneg;
+       if (bmsr & BMSR_10HALF)
+               supported |= SUPPORTED_10baseT_Half;
+       if (bmsr & BMSR_10FULL)
+               supported |= SUPPORTED_10baseT_Full;
+       if (bmsr & BMSR_100HALF)
+               supported |= SUPPORTED_100baseT_Half;
+       if (bmsr & BMSR_100FULL)
+               supported |= SUPPORTED_100baseT_Full;
+       if (estatus & ESTATUS_1000_THALF)
+               supported |= SUPPORTED_1000baseT_Half;
+       if (estatus & ESTATUS_1000_TFULL)
+               supported |= SUPPORTED_1000baseT_Full;
+       lp->supported = supported;
+
+       advertising = 0;
+       if (advert & ADVERTISE_10HALF)
+               advertising |= ADVERTISED_10baseT_Half;
+       if (advert & ADVERTISE_10FULL)
+               advertising |= ADVERTISED_10baseT_Full;
+       if (advert & ADVERTISE_100HALF)
+               advertising |= ADVERTISED_100baseT_Half;
+       if (advert & ADVERTISE_100FULL)
+               advertising |= ADVERTISED_100baseT_Full;
+       if (ctrl1000 & ADVERTISE_1000HALF)
+               advertising |= ADVERTISED_1000baseT_Half;
+       if (ctrl1000 & ADVERTISE_1000FULL)
+               advertising |= ADVERTISED_1000baseT_Full;
+
+       if (bmcr & BMCR_ANENABLE) {
+               int neg, neg1000;
+
+               lp->active_autoneg = 1;
+               advertising |= ADVERTISED_Autoneg;
+
+               neg = advert & lpa;
+               neg1000 = (ctrl1000 << 2) & stat1000;
+
+               if (neg1000 & (LPA_1000FULL | LPA_1000HALF))
+                       active_speed = SPEED_1000;
+               else if (neg & LPA_100)
+                       active_speed = SPEED_100;
+               else if (neg & (LPA_10HALF | LPA_10FULL))
+                       active_speed = SPEED_10;
+               else
+                       active_speed = SPEED_INVALID;
+
+               if ((neg1000 & LPA_1000FULL) || (neg & LPA_DUPLEX))
+                       active_duplex = DUPLEX_FULL;
+               else if (active_speed != SPEED_INVALID)
+                       active_duplex = DUPLEX_HALF;
+               else
+                       active_duplex = DUPLEX_INVALID;
+       } else {
+               lp->active_autoneg = 0;
+
+               if ((bmcr & BMCR_SPEED1000) && !(bmcr & BMCR_SPEED100))
+                       active_speed = SPEED_1000;
+               else if (bmcr & BMCR_SPEED100)
+                       active_speed = SPEED_100;
+               else
+                       active_speed = SPEED_10;
+
+               if (bmcr & BMCR_FULLDPLX)
+                       active_duplex = DUPLEX_FULL;
+               else
+                       active_duplex = DUPLEX_HALF;
+       }
+
+       lp->active_advertising = advertising;
+       lp->active_speed = active_speed;
+       lp->active_duplex = active_duplex;
+       *link_up_p = !!(bmsr & BMSR_LSTATUS);
+
+       return 0;
+}
+
 static int link_status_1g_rgmii(struct niu *np, int *link_up_p)
 {
        struct niu_link_config *lp = &np->link_config;
@@ -1171,6 +1295,22 @@ out:
        return err;
 }
 
+static int link_status_1g(struct niu *np, int *link_up_p)
+{
+       struct niu_link_config *lp = &np->link_config;
+       unsigned long flags;
+       int err;
+
+       spin_lock_irqsave(&np->lock, flags);
+
+       err = link_status_mii(np, link_up_p);
+       lp->supported |= SUPPORTED_TP;
+       lp->active_advertising |= ADVERTISED_TP;
+
+       spin_unlock_irqrestore(&np->lock, flags);
+       return err;
+}
+
 static int bcm8704_reset(struct niu *np)
 {
        int err, limit;
@@ -1676,39 +1816,88 @@ static int mii_init_common(struct niu *np)
                        return err;
        }
 
-       /* XXX configurable XXX */
-       /* XXX for now don't advertise half-duplex or asym pause... XXX */
-       adv = ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP;
-       if (bmsr & BMSR_10FULL)
-               adv |= ADVERTISE_10FULL;
-       if (bmsr & BMSR_100FULL)
-               adv |= ADVERTISE_100FULL;
-       err = mii_write(np, np->phy_addr, MII_ADVERTISE, adv);
-       if (err)
-               return err;
-
-       if (bmsr & BMSR_ESTATEN) {
-               u16 ctrl1000 = 0;
-
-               if (estat & ESTATUS_1000_TFULL)
-                       ctrl1000 |= ADVERTISE_1000FULL;
-               err = mii_write(np, np->phy_addr, MII_CTRL1000, ctrl1000);
+       if (lp->autoneg) {
+               u16 ctrl1000;
+
+               adv = ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP;
+               if ((bmsr & BMSR_10HALF) &&
+                       (lp->advertising & ADVERTISED_10baseT_Half))
+                       adv |= ADVERTISE_10HALF;
+               if ((bmsr & BMSR_10FULL) &&
+                       (lp->advertising & ADVERTISED_10baseT_Full))
+                       adv |= ADVERTISE_10FULL;
+               if ((bmsr & BMSR_100HALF) &&
+                       (lp->advertising & ADVERTISED_100baseT_Half))
+                       adv |= ADVERTISE_100HALF;
+               if ((bmsr & BMSR_100FULL) &&
+                       (lp->advertising & ADVERTISED_100baseT_Full))
+                       adv |= ADVERTISE_100FULL;
+               err = mii_write(np, np->phy_addr, MII_ADVERTISE, adv);
                if (err)
                        return err;
+
+               if (likely(bmsr & BMSR_ESTATEN)) {
+                       ctrl1000 = 0;
+                       if ((estat & ESTATUS_1000_THALF) &&
+                               (lp->advertising & ADVERTISED_1000baseT_Half))
+                               ctrl1000 |= ADVERTISE_1000HALF;
+                       if ((estat & ESTATUS_1000_TFULL) &&
+                               (lp->advertising & ADVERTISED_1000baseT_Full))
+                               ctrl1000 |= ADVERTISE_1000FULL;
+                       err = mii_write(np, np->phy_addr,
+                                       MII_CTRL1000, ctrl1000);
+                       if (err)
+                               return err;
+               }
+
+               bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
+       } else {
+               /* !lp->autoneg */
+               int fulldpx;
+
+               if (lp->duplex == DUPLEX_FULL) {
+                       bmcr |= BMCR_FULLDPLX;
+                       fulldpx = 1;
+               } else if (lp->duplex == DUPLEX_HALF)
+                       fulldpx = 0;
+               else
+                       return -EINVAL;
+
+               if (lp->speed == SPEED_1000) {
+                       /* if X-full requested while not supported, or
+                          X-half requested while not supported... */
+                       if ((fulldpx && !(estat & ESTATUS_1000_TFULL)) ||
+                               (!fulldpx && !(estat & ESTATUS_1000_THALF)))
+                               return -EINVAL;
+                       bmcr |= BMCR_SPEED1000;
+               } else if (lp->speed == SPEED_100) {
+                       if ((fulldpx && !(bmsr & BMSR_100FULL)) ||
+                               (!fulldpx && !(bmsr & BMSR_100HALF)))
+                               return -EINVAL;
+                       bmcr |= BMCR_SPEED100;
+               } else if (lp->speed == SPEED_10) {
+                       if ((fulldpx && !(bmsr & BMSR_10FULL)) ||
+                               (!fulldpx && !(bmsr & BMSR_10HALF)))
+                               return -EINVAL;
+               } else
+                       return -EINVAL;
        }
-       bmcr |= (BMCR_ANENABLE | BMCR_ANRESTART);
 
        err = mii_write(np, np->phy_addr, MII_BMCR, bmcr);
        if (err)
                return err;
 
+#if 0
        err = mii_read(np, np->phy_addr, MII_BMCR);
        if (err < 0)
                return err;
+       bmcr = err;
+
        err = mii_read(np, np->phy_addr, MII_BMSR);
        if (err < 0)
                return err;
-#if 0
+       bmsr = err;
+
        pr_info(PFX "Port %u after MII init bmcr[%04x] bmsr[%04x]\n",
                np->port, bmcr, bmsr);
 #endif
@@ -2054,87 +2243,6 @@ static int link_status_10g_hotplug(struct niu *np, int *link_up_p)
        return err;
 }
 
-static int link_status_1g(struct niu *np, int *link_up_p)
-{
-       struct niu_link_config *lp = &np->link_config;
-       u16 current_speed, bmsr;
-       unsigned long flags;
-       u8 current_duplex;
-       int err, link_up;
-
-       link_up = 0;
-       current_speed = SPEED_INVALID;
-       current_duplex = DUPLEX_INVALID;
-
-       spin_lock_irqsave(&np->lock, flags);
-
-       err = -EINVAL;
-       if (np->link_config.loopback_mode != LOOPBACK_DISABLED)
-               goto out;
-
-       err = mii_read(np, np->phy_addr, MII_BMSR);
-       if (err < 0)
-               goto out;
-
-       bmsr = err;
-       if (bmsr & BMSR_LSTATUS) {
-               u16 adv, lpa, common, estat;
-
-               err = mii_read(np, np->phy_addr, MII_ADVERTISE);
-               if (err < 0)
-                       goto out;
-               adv = err;
-
-               err = mii_read(np, np->phy_addr, MII_LPA);
-               if (err < 0)
-                       goto out;
-               lpa = err;
-
-               common = adv & lpa;
-
-               err = mii_read(np, np->phy_addr, MII_ESTATUS);
-               if (err < 0)
-                       goto out;
-               estat = err;
-
-               link_up = 1;
-               if (estat & (ESTATUS_1000_TFULL | ESTATUS_1000_THALF)) {
-                       current_speed = SPEED_1000;
-                       if (estat & ESTATUS_1000_TFULL)
-                               current_duplex = DUPLEX_FULL;
-                       else
-                               current_duplex = DUPLEX_HALF;
-               } else {
-                       if (common & ADVERTISE_100BASE4) {
-                               current_speed = SPEED_100;
-                               current_duplex = DUPLEX_HALF;
-                       } else if (common & ADVERTISE_100FULL) {
-                               current_speed = SPEED_100;
-                               current_duplex = DUPLEX_FULL;
-                       } else if (common & ADVERTISE_100HALF) {
-                               current_speed = SPEED_100;
-                               current_duplex = DUPLEX_HALF;
-                       } else if (common & ADVERTISE_10FULL) {
-                               current_speed = SPEED_10;
-                               current_duplex = DUPLEX_FULL;
-                       } else if (common & ADVERTISE_10HALF) {
-                               current_speed = SPEED_10;
-                               current_duplex = DUPLEX_HALF;
-                       } else
-                               link_up = 0;
-               }
-       }
-       lp->active_speed = current_speed;
-       lp->active_duplex = current_duplex;
-       err = 0;
-
-out:
-       spin_unlock_irqrestore(&np->lock, flags);
-
-       *link_up_p = link_up;
-       return err;
-}
-
 static int niu_link_status(struct niu *np, int *link_up_p)
 {
        const struct niu_phy_ops *ops = np->phy_ops;
@@ -2284,7 +2392,6 @@ static int serdes_init_10g_serdes(struct niu *np)
        struct niu_link_config *lp = &np->link_config;
        unsigned long ctrl_reg, test_cfg_reg, pll_cfg, i;
        u64 ctrl_val, test_cfg_val, sig, mask, val;
-       int err;
        u64 reset_val;
 
        switch (np->port) {
@@ -2337,6 +2444,7 @@ static int serdes_init_10g_serdes(struct niu *np)
        /* Initialize all 4 lanes of the SERDES.  */
        for (i = 0; i < 4; i++) {
                u32 rxtx_ctrl, glue0;
+               int err;
 
                err = esr_read_rxtx_ctrl(np, i, &rxtx_ctrl);
                if (err)
@@ -2456,7 +2564,7 @@ static int niu_determine_phy_disposition(struct niu *np)
 
                case NIU_FLAGS_10G:
                        /* 10G copper */
-                       tp = &phy_template_1g_copper;
+                       tp = &phy_template_10g_copper;
                        break;
 
                case NIU_FLAGS_FIBER:
@@ -2873,7 +2981,6 @@ static int tcam_user_ip_class_enable(struct niu *np, unsigned long class,
        return 0;
 }
 
-#if 0
 static int tcam_user_ip_class_set(struct niu *np, unsigned long class,
                                  int ipv6, u64 protocol_id,
                                  u64 tos_mask, u64 tos_val)
@@ -2901,7 +3008,6 @@ static int tcam_user_ip_class_set(struct niu *np, unsigned long class,
 
        return 0;
 }
-#endif
 
 static int tcam_early_init(struct niu *np)
 {
@@ -3168,6 +3274,27 @@ static int niu_set_tcam_key(struct niu *np, unsigned long class_code, u64 key)
        return 0;
 }
 
+/* Entries for the ports are interleaved in the TCAM */
+static u16 tcam_get_index(struct niu *np, u16 idx)
+{
+       /* One entry reserved for IP fragment rule */
+       if (idx >= (np->clas.tcam_sz - 1))
+               idx = 0;
+       return (np->clas.tcam_top + ((idx+1) * np->parent->num_ports));
+}
+
+static u16 tcam_get_size(struct niu *np)
+{
+       /* One entry reserved for IP fragment rule */
+       return np->clas.tcam_sz - 1;
+}
+
+static u16 tcam_get_valid_entry_cnt(struct niu *np)
+{
+       /* One entry reserved for IP fragment rule */
+       return np->clas.tcam_valid_entries - 1;
+}
+
 static void niu_rx_skb_append(struct sk_buff *skb, struct page *page,
                              u32 offset, u32 size)
 {
@@ -3390,6 +3517,7 @@ static int niu_process_rx_pkt(struct niu *np, struct rx_ring_info *rp)
        rp->rx_bytes += skb->len;
 
        skb->protocol = eth_type_trans(skb, np->dev);
+       skb_record_rx_queue(skb, rp->rx_channel);
        netif_receive_skb(skb);
 
        return num_rcr;
@@ -3669,7 +3797,7 @@ static int niu_poll(struct napi_struct *napi, int budget)
        work_done = niu_poll_core(np, lp, budget);
 
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                niu_ldg_rearm(np, lp, 1);
        }
        return work_done;
@@ -4088,12 +4216,12 @@ static void __niu_fastpath_interrupt(struct niu *np, int ldg, u64 v0)
 static void niu_schedule_napi(struct niu *np, struct niu_ldg *lp,
                              u64 v0, u64 v1, u64 v2)
 {
-       if (likely(netif_rx_schedule_prep(&lp->napi))) {
+       if (likely(napi_schedule_prep(&lp->napi))) {
                lp->v0 = v0;
                lp->v1 = v1;
                lp->v2 = v2;
                __niu_fastpath_interrupt(np, lp->ldg_num, v0);
-               __netif_rx_schedule(&lp->napi);
+               __napi_schedule(&lp->napi);
        }
 }
 
@@ -4890,8 +5018,7 @@ static int niu_set_ip_frag_rule(struct niu *np)
        struct niu_tcam_entry *tp;
        int index, err;
 
-       /* XXX fix this allocation scheme XXX */
-       index = cp->tcam_index;
+       index = cp->tcam_top;
        tp = &parent->tcam[index];
 
        /* Note that the noport bit is the same in both ipv4 and
@@ -4908,6 +5035,8 @@ static int niu_set_ip_frag_rule(struct niu *np)
        err = tcam_assoc_write(np, index, tp->assoc_data);
        if (err)
                return err;
+       tp->valid = 1;
+       cp->tcam_valid_entries++;
 
        return 0;
 }
@@ -5211,10 +5340,10 @@ static void niu_init_xif_xmac(struct niu *np)
        if (np->flags & NIU_FLAGS_10G) {
                val |= XMAC_CONFIG_MODE_XGMII;
        } else {
-               if (lp->active_speed == SPEED_100)
-                       val |= XMAC_CONFIG_MODE_MII;
-               else
+               if (lp->active_speed == SPEED_1000)
                        val |= XMAC_CONFIG_MODE_GMII;
+               else
+                       val |= XMAC_CONFIG_MODE_MII;
        }
 
        nw64_mac(XMAC_CONFIG, val);
@@ -6446,11 +6575,11 @@ static u64 niu_compute_tx_flags(struct sk_buff *skb, struct ethhdr *ehdr,
 
        ipv6 = ihl = 0;
        switch (skb->protocol) {
-       case __constant_htons(ETH_P_IP):
+       case cpu_to_be16(ETH_P_IP):
                ip_proto = ip_hdr(skb)->protocol;
                ihl = ip_hdr(skb)->ihl;
                break;
-       case __constant_htons(ETH_P_IPV6):
+       case cpu_to_be16(ETH_P_IPV6):
                ip_proto = ipv6_hdr(skb)->nexthdr;
                ihl = (40 >> 2);
                ipv6 = 1;
@@ -6702,17 +6831,27 @@ static int niu_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
        memset(cmd, 0, sizeof(*cmd));
        cmd->phy_address = np->phy_addr;
        cmd->supported = lp->supported;
-       cmd->advertising = lp->advertising;
-       cmd->autoneg = lp->autoneg;
+       cmd->advertising = lp->active_advertising;
+       cmd->autoneg = lp->active_autoneg;
        cmd->speed = lp->active_speed;
        cmd->duplex = lp->active_duplex;
+       cmd->port = (np->flags & NIU_FLAGS_FIBER) ? PORT_FIBRE : PORT_TP;
+       cmd->transceiver = (np->flags & NIU_FLAGS_XCVR_SERDES) ?
+               XCVR_EXTERNAL : XCVR_INTERNAL;
 
        return 0;
 }
 
 static int niu_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
 {
-       return -EINVAL;
+       struct niu *np = netdev_priv(dev);
+       struct niu_link_config *lp = &np->link_config;
+
+       lp->advertising = cmd->advertising;
+       lp->speed = cmd->speed;
+       lp->duplex = cmd->duplex;
+       lp->autoneg = cmd->autoneg;
+       return niu_init_link(np);
 }
 
 static u32 niu_get_msglevel(struct net_device *dev)
@@ -6727,6 +6866,16 @@ static void niu_set_msglevel(struct net_device *dev, u32 value)
        np->msg_enable = value;
 }
 
+static int niu_nway_reset(struct net_device *dev)
+{
+       struct niu *np = netdev_priv(dev);
+
+       if (np->link_config.autoneg)
+               return niu_init_link(np);
+
+       return 0;
+}
+
 static int niu_get_eeprom_len(struct net_device *dev)
 {
        struct niu *np = netdev_priv(dev);
@@ -6778,6 +6927,75 @@ static int niu_get_eeprom(struct net_device *dev,
        return 0;
 }
 
+static void niu_ethflow_to_l3proto(int flow_type, u8 *pid)
+{
+       switch (flow_type) {
+       case TCP_V4_FLOW:
+       case TCP_V6_FLOW:
+               *pid = IPPROTO_TCP;
+               break;
+       case UDP_V4_FLOW:
+       case UDP_V6_FLOW:
+               *pid = IPPROTO_UDP;
+               break;
+       case SCTP_V4_FLOW:
+       case SCTP_V6_FLOW:
+               *pid = IPPROTO_SCTP;
+               break;
+       case AH_V4_FLOW:
+       case AH_V6_FLOW:
+               *pid = IPPROTO_AH;
+               break;
+       case ESP_V4_FLOW:
+       case ESP_V6_FLOW:
+               *pid = IPPROTO_ESP;
+               break;
+       default:
+               *pid = 0;
+               break;
+       }
+}
+
+static int niu_class_to_ethflow(u64 class, int *flow_type)
+{
+       switch (class) {
+       case CLASS_CODE_TCP_IPV4:
+               *flow_type = TCP_V4_FLOW;
+               break;
+       case CLASS_CODE_UDP_IPV4:
+               *flow_type = UDP_V4_FLOW;
+               break;
+       case CLASS_CODE_AH_ESP_IPV4:
+               *flow_type = AH_V4_FLOW;
+               break;
+       case CLASS_CODE_SCTP_IPV4:
+               *flow_type = SCTP_V4_FLOW;
+               break;
+       case CLASS_CODE_TCP_IPV6:
+               *flow_type = TCP_V6_FLOW;
+               break;
+       case CLASS_CODE_UDP_IPV6:
+               *flow_type = UDP_V6_FLOW;
+               break;
+       case CLASS_CODE_AH_ESP_IPV6:
+               *flow_type = AH_V6_FLOW;
+               break;
+       case CLASS_CODE_SCTP_IPV6:
+               *flow_type = SCTP_V6_FLOW;
+               break;
+       case CLASS_CODE_USER_PROG1:
+       case CLASS_CODE_USER_PROG2:
+       case CLASS_CODE_USER_PROG3:
+       case CLASS_CODE_USER_PROG4:
+               *flow_type = IP_USER_FLOW;
+               break;
+       default:
+               return 0;
+       }
+
+       return 1;
+}
+
 static int niu_ethflow_to_class(int flow_type, u64 *class)
 {
        switch (flow_type) {
@@ -6787,7 +7005,8 @@ static int niu_ethflow_to_class(int flow_type, u64 *class)
        case UDP_V4_FLOW:
                *class = CLASS_CODE_UDP_IPV4;
                break;
-       case AH_ESP_V4_FLOW:
+       case AH_V4_FLOW:
+       case ESP_V4_FLOW:
                *class = CLASS_CODE_AH_ESP_IPV4;
                break;
        case SCTP_V4_FLOW:
@@ -6799,7 +7018,8 @@ static int niu_ethflow_to_class(int flow_type, u64 *class)
        case UDP_V6_FLOW:
                *class = CLASS_CODE_UDP_IPV6;
                break;
-       case AH_ESP_V6_FLOW:
+       case AH_V6_FLOW:
+       case ESP_V6_FLOW:
                *class = CLASS_CODE_AH_ESP_IPV6;
                break;
        case SCTP_V6_FLOW:
@@ -6816,8 +7036,6 @@ static u64 niu_flowkey_to_ethflow(u64 flow_key)
 {
        u64 ethflow = 0;
 
-       if (flow_key & FLOW_KEY_PORT)
-               ethflow |= RXH_DEV_PORT;
        if (flow_key & FLOW_KEY_L2DA)
                ethflow |= RXH_L2DA;
        if (flow_key & FLOW_KEY_VLAN)
@@ -6841,8 +7059,6 @@ static int niu_ethflow_to_flowkey(u64 ethflow, u64 *flow_key)
 {
        u64 key = 0;
 
-       if (ethflow & RXH_DEV_PORT)
-               key |= FLOW_KEY_PORT;
        if (ethflow & RXH_L2DA)
                key |= FLOW_KEY_L2DA;
        if (ethflow & RXH_VLAN)
@@ -6864,41 +7080,279 @@ static int niu_ethflow_to_flowkey(u64 ethflow, u64 *flow_key)
 
 }
 
-static int niu_get_hash_opts(struct net_device *dev, struct ethtool_rxnfc *cmd)
+static int niu_get_hash_opts(struct niu *np, struct ethtool_rxnfc *nfc)
 {
-       struct niu *np = netdev_priv(dev);
        u64 class;
 
-       cmd->data = 0;
+       nfc->data = 0;
 
-       if (!niu_ethflow_to_class(cmd->flow_type, &class))
+       if (!niu_ethflow_to_class(nfc->flow_type, &class))
                return -EINVAL;
 
        if (np->parent->tcam_key[class - CLASS_CODE_USER_PROG1] &
            TCAM_KEY_DISC)
-               cmd->data = RXH_DISCARD;
+               nfc->data = RXH_DISCARD;
        else
-
-               cmd->data = niu_flowkey_to_ethflow(np->parent->flow_key[class -
+               nfc->data = niu_flowkey_to_ethflow(np->parent->flow_key[class -
                                                      CLASS_CODE_USER_PROG1]);
        return 0;
 }
 
-static int niu_set_hash_opts(struct net_device *dev, struct ethtool_rxnfc *cmd)
+static void niu_get_ip4fs_from_tcam_key(struct niu_tcam_entry *tp,
+                                       struct ethtool_rx_flow_spec *fsp)
+{
+
+       fsp->h_u.tcp_ip4_spec.ip4src = (tp->key[3] & TCAM_V4KEY3_SADDR) >>
+               TCAM_V4KEY3_SADDR_SHIFT;
+       fsp->h_u.tcp_ip4_spec.ip4dst = (tp->key[3] & TCAM_V4KEY3_DADDR) >>
+               TCAM_V4KEY3_DADDR_SHIFT;
+       fsp->m_u.tcp_ip4_spec.ip4src = (tp->key_mask[3] & TCAM_V4KEY3_SADDR) >>
+               TCAM_V4KEY3_SADDR_SHIFT;
+       fsp->m_u.tcp_ip4_spec.ip4dst = (tp->key_mask[3] & TCAM_V4KEY3_DADDR) >>
+               TCAM_V4KEY3_DADDR_SHIFT;
+
+       fsp->h_u.tcp_ip4_spec.ip4src =
+               cpu_to_be32(fsp->h_u.tcp_ip4_spec.ip4src);
+       fsp->m_u.tcp_ip4_spec.ip4src =
+               cpu_to_be32(fsp->m_u.tcp_ip4_spec.ip4src);
+       fsp->h_u.tcp_ip4_spec.ip4dst =
+               cpu_to_be32(fsp->h_u.tcp_ip4_spec.ip4dst);
+       fsp->m_u.tcp_ip4_spec.ip4dst =
+               cpu_to_be32(fsp->m_u.tcp_ip4_spec.ip4dst);
+
+       fsp->h_u.tcp_ip4_spec.tos = (tp->key[2] & TCAM_V4KEY2_TOS) >>
+               TCAM_V4KEY2_TOS_SHIFT;
+       fsp->m_u.tcp_ip4_spec.tos = (tp->key_mask[2] & TCAM_V4KEY2_TOS) >>
+               TCAM_V4KEY2_TOS_SHIFT;
+
+       switch (fsp->flow_type) {
+       case TCP_V4_FLOW:
+       case UDP_V4_FLOW:
+       case SCTP_V4_FLOW:
+               fsp->h_u.tcp_ip4_spec.psrc =
+                       ((tp->key[2] & TCAM_V4KEY2_PORT_SPI) >>
+                        TCAM_V4KEY2_PORT_SPI_SHIFT) >> 16;
+               fsp->h_u.tcp_ip4_spec.pdst =
+                       ((tp->key[2] & TCAM_V4KEY2_PORT_SPI) >>
+                        TCAM_V4KEY2_PORT_SPI_SHIFT) & 0xffff;
+               fsp->m_u.tcp_ip4_spec.psrc =
+                       ((tp->key_mask[2] & TCAM_V4KEY2_PORT_SPI) >>
+                        TCAM_V4KEY2_PORT_SPI_SHIFT) >> 16;
+               fsp->m_u.tcp_ip4_spec.pdst =
+                       ((tp->key_mask[2] & TCAM_V4KEY2_PORT_SPI) >>
+                        TCAM_V4KEY2_PORT_SPI_SHIFT) & 0xffff;
+
+               fsp->h_u.tcp_ip4_spec.psrc =
+                       cpu_to_be16(fsp->h_u.tcp_ip4_spec.psrc);
+               fsp->h_u.tcp_ip4_spec.pdst =
+                       cpu_to_be16(fsp->h_u.tcp_ip4_spec.pdst);
+               fsp->m_u.tcp_ip4_spec.psrc =
+                       cpu_to_be16(fsp->m_u.tcp_ip4_spec.psrc);
+               fsp->m_u.tcp_ip4_spec.pdst =
+                       cpu_to_be16(fsp->m_u.tcp_ip4_spec.pdst);
+               break;
+       case AH_V4_FLOW:
+       case ESP_V4_FLOW:
+               fsp->h_u.ah_ip4_spec.spi =
+                       (tp->key[2] & TCAM_V4KEY2_PORT_SPI) >>
+                       TCAM_V4KEY2_PORT_SPI_SHIFT;
+               fsp->m_u.ah_ip4_spec.spi =
+                       (tp->key_mask[2] & TCAM_V4KEY2_PORT_SPI) >>
+                       TCAM_V4KEY2_PORT_SPI_SHIFT;
+
+               fsp->h_u.ah_ip4_spec.spi =
+                       cpu_to_be32(fsp->h_u.ah_ip4_spec.spi);
+               fsp->m_u.ah_ip4_spec.spi =
+                       cpu_to_be32(fsp->m_u.ah_ip4_spec.spi);
+               break;
+       case IP_USER_FLOW:
+               fsp->h_u.usr_ip4_spec.l4_4_bytes =
+                       (tp->key[2] & TCAM_V4KEY2_PORT_SPI) >>
+                       TCAM_V4KEY2_PORT_SPI_SHIFT;
+               fsp->m_u.usr_ip4_spec.l4_4_bytes =
+                       (tp->key_mask[2] & TCAM_V4KEY2_PORT_SPI) >>
+                       TCAM_V4KEY2_PORT_SPI_SHIFT;
+
+               fsp->h_u.usr_ip4_spec.l4_4_bytes =
+                       cpu_to_be32(fsp->h_u.usr_ip4_spec.l4_4_bytes);
+               fsp->m_u.usr_ip4_spec.l4_4_bytes =
+                       cpu_to_be32(fsp->m_u.usr_ip4_spec.l4_4_bytes);
+
+               fsp->h_u.usr_ip4_spec.proto =
+                       (tp->key[2] & TCAM_V4KEY2_PROTO) >>
+                       TCAM_V4KEY2_PROTO_SHIFT;
+               fsp->m_u.usr_ip4_spec.proto =
+                       (tp->key_mask[2] & TCAM_V4KEY2_PROTO) >>
+                       TCAM_V4KEY2_PROTO_SHIFT;
+
+               fsp->h_u.usr_ip4_spec.ip_ver = ETH_RX_NFC_IP4;
+               break;
+       default:
+               break;
+       }
+}
+
+static int niu_get_ethtool_tcam_entry(struct niu *np,
+                                     struct ethtool_rxnfc *nfc)
+{
+       struct niu_parent *parent = np->parent;
+       struct niu_tcam_entry *tp;
+       struct ethtool_rx_flow_spec *fsp = &nfc->fs;
+       u16 idx;
+       u64 class;
+       int ret = 0;
+
+       idx = tcam_get_index(np, (u16)nfc->fs.location);
+
+       tp = &parent->tcam[idx];
+       if (!tp->valid) {
+               pr_info(PFX "niu%d: %s entry [%d] invalid for idx[%d]\n",
+               parent->index, np->dev->name, (u16)nfc->fs.location, idx);
+               return -EINVAL;
+       }
+
+       /* fill the flow spec entry */
+       class = (tp->key[0] & TCAM_V4KEY0_CLASS_CODE) >>
+               TCAM_V4KEY0_CLASS_CODE_SHIFT;
+       ret = niu_class_to_ethflow(class, &fsp->flow_type);
+
+       if (ret < 0) {
+               pr_info(PFX "niu%d: %s niu_class_to_ethflow failed\n",
+               parent->index, np->dev->name);
+               ret = -EINVAL;
+               goto out;
+       }
+
+       if (fsp->flow_type == AH_V4_FLOW || fsp->flow_type == AH_V6_FLOW) {
+               u32 proto = (tp->key[2] & TCAM_V4KEY2_PROTO) >>
+                       TCAM_V4KEY2_PROTO_SHIFT;
+               if (proto == IPPROTO_ESP) {
+                       if (fsp->flow_type == AH_V4_FLOW)
+                               fsp->flow_type = ESP_V4_FLOW;
+                       else
+                               fsp->flow_type = ESP_V6_FLOW;
+               }
+       }
+
+       switch (fsp->flow_type) {
+       case TCP_V4_FLOW:
+       case UDP_V4_FLOW:
+       case SCTP_V4_FLOW:
+       case AH_V4_FLOW:
+       case ESP_V4_FLOW:
+               niu_get_ip4fs_from_tcam_key(tp, fsp);
+               break;
+       case TCP_V6_FLOW:
+       case UDP_V6_FLOW:
+       case SCTP_V6_FLOW:
+       case AH_V6_FLOW:
+       case ESP_V6_FLOW:
+               /* Not yet implemented */
+               ret = -EINVAL;
+               break;
+       case IP_USER_FLOW:
+               niu_get_ip4fs_from_tcam_key(tp, fsp);
+               break;
+       default:
+               ret = -EINVAL;
+               break;
+       }
+
+       if (ret < 0)
+               goto out;
+
+       if (tp->assoc_data & TCAM_ASSOCDATA_DISC)
+               fsp->ring_cookie = RX_CLS_FLOW_DISC;
+       else
+               fsp->ring_cookie = (tp->assoc_data & TCAM_ASSOCDATA_OFFSET) >>
+                       TCAM_ASSOCDATA_OFFSET_SHIFT;
+
+       /* put the tcam size here */
+       nfc->data = tcam_get_size(np);
+out:
+       return ret;
+}
+
+static int niu_get_ethtool_tcam_all(struct niu *np,
+                                   struct ethtool_rxnfc *nfc,
+                                   u32 *rule_locs)
+{
+       struct niu_parent *parent = np->parent;
+       struct niu_tcam_entry *tp;
+       int i, idx, cnt;
+       u16 n_entries;
+       unsigned long flags;
+
+
+       /* put the tcam size here */
+       nfc->data = tcam_get_size(np);
+
+       niu_lock_parent(np, flags);
+       n_entries = nfc->rule_cnt;
+       for (cnt = 0, i = 0; i < nfc->data; i++) {
+               idx = tcam_get_index(np, i);
+               tp = &parent->tcam[idx];
+               if (!tp->valid)
+                       continue;
+               rule_locs[cnt] = i;
+               cnt++;
+       }
+       niu_unlock_parent(np, flags);
+
+       if (n_entries != cnt) {
+               /* print warning, this should not happen */
+               pr_info(PFX "niu%d: %s In niu_get_ethtool_tcam_all, "
+                       "n_entries[%d] != cnt[%d]!!!\n\n",
+                       np->parent->index, np->dev->name, n_entries, cnt);
+       }
+
+       return 0;
+}
+
+static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,
+                      void *rule_locs)
 {
        struct niu *np = netdev_priv(dev);
+       int ret = 0;
+
+       switch (cmd->cmd) {
+       case ETHTOOL_GRXFH:
+               ret = niu_get_hash_opts(np, cmd);
+               break;
+       case ETHTOOL_GRXRINGS:
+               cmd->data = np->num_rx_rings;
+               break;
+       case ETHTOOL_GRXCLSRLCNT:
+               cmd->rule_cnt = tcam_get_valid_entry_cnt(np);
+               break;
+       case ETHTOOL_GRXCLSRULE:
+               ret = niu_get_ethtool_tcam_entry(np, cmd);
+               break;
+       case ETHTOOL_GRXCLSRLALL:
+               ret = niu_get_ethtool_tcam_all(np, cmd, (u32 *)rule_locs);
+               break;
+       default:
+               ret = -EINVAL;
+               break;
+       }
+
+       return ret;
+}
+
+static int niu_set_hash_opts(struct niu *np, struct ethtool_rxnfc *nfc)
+{
        u64 class;
        u64 flow_key = 0;
        unsigned long flags;
 
-       if (!niu_ethflow_to_class(cmd->flow_type, &class))
+       if (!niu_ethflow_to_class(nfc->flow_type, &class))
                return -EINVAL;
 
        if (class < CLASS_CODE_USER_PROG1 ||
            class > CLASS_CODE_SCTP_IPV6)
                return -EINVAL;
 
-       if (cmd->data & RXH_DISCARD) {
+       if (nfc->data & RXH_DISCARD) {
                niu_lock_parent(np, flags);
                flow_key = np->parent->tcam_key[class -
                                               CLASS_CODE_USER_PROG1];
@@ -6923,7 +7377,7 @@ static int niu_set_hash_opts(struct net_device *dev, struct ethtool_rxnfc *cmd)
                }
        }
 
-       if (!niu_ethflow_to_flowkey(cmd->data, &flow_key))
+       if (!niu_ethflow_to_flowkey(nfc->data, &flow_key))
                return -EINVAL;
 
        niu_lock_parent(np, flags);
@@ -6934,6 +7388,331 @@ static int niu_set_hash_opts(struct net_device *dev, struct ethtool_rxnfc *cmd)
        return 0;
 }
 
+static void niu_get_tcamkey_from_ip4fs(struct ethtool_rx_flow_spec *fsp,
+                                      struct niu_tcam_entry *tp,
+                                      int l2_rdc_tab, u64 class)
+{
+       u8 pid = 0;
+       u32 sip, dip, sipm, dipm, spi, spim;
+       u16 sport, dport, spm, dpm;
+
+       sip = be32_to_cpu(fsp->h_u.tcp_ip4_spec.ip4src);
+       sipm = be32_to_cpu(fsp->m_u.tcp_ip4_spec.ip4src);
+       dip = be32_to_cpu(fsp->h_u.tcp_ip4_spec.ip4dst);
+       dipm = be32_to_cpu(fsp->m_u.tcp_ip4_spec.ip4dst);
+
+       tp->key[0] = class << TCAM_V4KEY0_CLASS_CODE_SHIFT;
+       tp->key_mask[0] = TCAM_V4KEY0_CLASS_CODE;
+       tp->key[1] = (u64)l2_rdc_tab << TCAM_V4KEY1_L2RDCNUM_SHIFT;
+       tp->key_mask[1] = TCAM_V4KEY1_L2RDCNUM;
+
+       tp->key[3] = (u64)sip << TCAM_V4KEY3_SADDR_SHIFT;
+       tp->key[3] |= dip;
+
+       tp->key_mask[3] = (u64)sipm << TCAM_V4KEY3_SADDR_SHIFT;
+       tp->key_mask[3] |= dipm;
+
+       tp->key[2] |= ((u64)fsp->h_u.tcp_ip4_spec.tos <<
+                      TCAM_V4KEY2_TOS_SHIFT);
+       tp->key_mask[2] |= ((u64)fsp->m_u.tcp_ip4_spec.tos <<
+                           TCAM_V4KEY2_TOS_SHIFT);
+       switch (fsp->flow_type) {
+       case TCP_V4_FLOW:
+       case UDP_V4_FLOW:
+       case SCTP_V4_FLOW:
+               sport = be16_to_cpu(fsp->h_u.tcp_ip4_spec.psrc);
+               spm = be16_to_cpu(fsp->m_u.tcp_ip4_spec.psrc);
+               dport = be16_to_cpu(fsp->h_u.tcp_ip4_spec.pdst);
+               dpm = be16_to_cpu(fsp->m_u.tcp_ip4_spec.pdst);
+
+               tp->key[2] |= (((u64)sport << 16) | dport);
+               tp->key_mask[2] |= (((u64)spm << 16) | dpm);
+               niu_ethflow_to_l3proto(fsp->flow_type, &pid);
+               break;
+       case AH_V4_FLOW:
+       case ESP_V4_FLOW:
+               spi = be32_to_cpu(fsp->h_u.ah_ip4_spec.spi);
+               spim = be32_to_cpu(fsp->m_u.ah_ip4_spec.spi);
+
+               tp->key[2] |= spi;
+               tp->key_mask[2] |= spim;
+               niu_ethflow_to_l3proto(fsp->flow_type, &pid);
+               break;
+       case IP_USER_FLOW:
+               spi = be32_to_cpu(fsp->h_u.usr_ip4_spec.l4_4_bytes);
+               spim = be32_to_cpu(fsp->m_u.usr_ip4_spec.l4_4_bytes);
+
+               tp->key[2] |= spi;
+               tp->key_mask[2] |= spim;
+               pid = fsp->h_u.usr_ip4_spec.proto;
+               break;
+       default:
+               break;
+       }
+
+       tp->key[2] |= ((u64)pid << TCAM_V4KEY2_PROTO_SHIFT);
+       if (pid) {
+               tp->key_mask[2] |= TCAM_V4KEY2_PROTO;
+       }
+}
+
+static int niu_add_ethtool_tcam_entry(struct niu *np,
+                                     struct ethtool_rxnfc *nfc)
+{
+       struct niu_parent *parent = np->parent;
+       struct niu_tcam_entry *tp;
+       struct ethtool_rx_flow_spec *fsp = &nfc->fs;
+       struct niu_rdc_tables *rdc_table = &parent->rdc_group_cfg[np->port];
+       int l2_rdc_table = rdc_table->first_table_num;
+       u16 idx;
+       u64 class;
+       unsigned long flags;
+       int err, ret;
+
+       ret = 0;
+
+       idx = nfc->fs.location;
+       if (idx >= tcam_get_size(np))
+               return -EINVAL;
+
+       if (fsp->flow_type == IP_USER_FLOW) {
+               int i;
+               int add_usr_cls = 0;
+               int ipv6 = 0;
+               struct ethtool_usrip4_spec *uspec = &fsp->h_u.usr_ip4_spec;
+               struct ethtool_usrip4_spec *umask = &fsp->m_u.usr_ip4_spec;
+
+               niu_lock_parent(np, flags);
+
+               for (i = 0; i < NIU_L3_PROG_CLS; i++) {
+                       if (parent->l3_cls[i]) {
+                               if (uspec->proto == parent->l3_cls_pid[i]) {
+                                       class = parent->l3_cls[i];
+                                       parent->l3_cls_refcnt[i]++;
+                                       add_usr_cls = 1;
+                                       break;
+                               }
+                       } else {
+                               /* Program new user IP class */
+                               switch (i) {
+                               case 0:
+                                       class = CLASS_CODE_USER_PROG1;
+                                       break;
+                               case 1:
+                                       class = CLASS_CODE_USER_PROG2;
+                                       break;
+                               case 2:
+                                       class = CLASS_CODE_USER_PROG3;
+                                       break;
+                               case 3:
+                                       class = CLASS_CODE_USER_PROG4;
+                                       break;
+                               default:
+                                       break;
+                               }
+                               if (uspec->ip_ver == ETH_RX_NFC_IP6)
+                                       ipv6 = 1;
+                               ret = tcam_user_ip_class_set(np, class, ipv6,
+                                                            uspec->proto,
+                                                            uspec->tos,
+                                                            umask->tos);
+                               if (ret)
+                                       goto out;
+
+                               ret = tcam_user_ip_class_enable(np, class, 1);
+                               if (ret)
+                                       goto out;
+                               parent->l3_cls[i] = class;
+                               parent->l3_cls_pid[i] = uspec->proto;
+                               parent->l3_cls_refcnt[i]++;
+                               add_usr_cls = 1;
+                               break;
+                       }
+               }
+               if (!add_usr_cls) {
+                       pr_info(PFX "niu%d: %s niu_add_ethtool_tcam_entry: "
+                               "Could not find/insert class for pid %d\n",
+                               parent->index, np->dev->name, uspec->proto);
+                       ret = -EINVAL;
+                       goto out;
+               }
+               niu_unlock_parent(np, flags);
+       } else {
+               if (!niu_ethflow_to_class(fsp->flow_type, &class)) {
+                       return -EINVAL;
+               }
+       }
+
+       niu_lock_parent(np, flags);
+
+       idx = tcam_get_index(np, idx);
+       tp = &parent->tcam[idx];
+
+       memset(tp, 0, sizeof(*tp));
+
+       /* fill in the tcam key and mask */
+       switch (fsp->flow_type) {
+       case TCP_V4_FLOW:
+       case UDP_V4_FLOW:
+       case SCTP_V4_FLOW:
+       case AH_V4_FLOW:
+       case ESP_V4_FLOW:
+               niu_get_tcamkey_from_ip4fs(fsp, tp, l2_rdc_table, class);
+               break;
+       case TCP_V6_FLOW:
+       case UDP_V6_FLOW:
+       case SCTP_V6_FLOW:
+       case AH_V6_FLOW:
+       case ESP_V6_FLOW:
+               /* Not yet implemented */
+               pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: "
+                       "flow %d for IPv6 not implemented\n\n",
+                       parent->index, np->dev->name, fsp->flow_type);
+               ret = -EINVAL;
+               goto out;
+       case IP_USER_FLOW:
+               if (fsp->h_u.usr_ip4_spec.ip_ver == ETH_RX_NFC_IP4) {
+                       niu_get_tcamkey_from_ip4fs(fsp, tp, l2_rdc_table,
+                                                  class);
+               } else {
+                       /* Not yet implemented */
+                       pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: "
+                       "usr flow for IPv6 not implemented\n\n",
+                       parent->index, np->dev->name);
+                       ret = -EINVAL;
+                       goto out;
+               }
+               break;
+       default:
+               pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: "
+                       "Unknown flow type %d\n\n",
+                       parent->index, np->dev->name, fsp->flow_type);
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /* fill in the assoc data */
+       if (fsp->ring_cookie == RX_CLS_FLOW_DISC) {
+               tp->assoc_data = TCAM_ASSOCDATA_DISC;
+       } else {
+               if (fsp->ring_cookie >= np->num_rx_rings) {
+                       pr_info(PFX "niu%d: %s In niu_add_ethtool_tcam_entry: "
+                               "Invalid RX ring %lld\n\n",
+                               parent->index, np->dev->name,
+                               (long long) fsp->ring_cookie);
+                       ret = -EINVAL;
+                       goto out;
+               }
+               tp->assoc_data = (TCAM_ASSOCDATA_TRES_USE_OFFSET |
+                                 (fsp->ring_cookie <<
+                                  TCAM_ASSOCDATA_OFFSET_SHIFT));
+       }
+
+       err = tcam_write(np, idx, tp->key, tp->key_mask);
+       if (err) {
+               ret = -EINVAL;
+               goto out;
+       }
+       err = tcam_assoc_write(np, idx, tp->assoc_data);
+       if (err) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       /* validate the entry */
+       tp->valid = 1;
+       np->clas.tcam_valid_entries++;
+out:
+       niu_unlock_parent(np, flags);
+
+       return ret;
+}
+
+static int niu_del_ethtool_tcam_entry(struct niu *np, u32 loc)
+{
+       struct niu_parent *parent = np->parent;
+       struct niu_tcam_entry *tp;
+       u16 idx;
+       unsigned long flags;
+       u64 class;
+       int ret = 0;
+
+       if (loc >= tcam_get_size(np))
+               return -EINVAL;
+
+       niu_lock_parent(np, flags);
+
+       idx = tcam_get_index(np, loc);
+       tp = &parent->tcam[idx];
+
+       /* if the entry is of a user defined class, then update*/
+       class = (tp->key[0] & TCAM_V4KEY0_CLASS_CODE) >>
+               TCAM_V4KEY0_CLASS_CODE_SHIFT;
+
+       if (class >= CLASS_CODE_USER_PROG1 && class <= CLASS_CODE_USER_PROG4) {
+               int i;
+               for (i = 0; i < NIU_L3_PROG_CLS; i++) {
+                       if (parent->l3_cls[i] == class) {
+                               parent->l3_cls_refcnt[i]--;
+                               if (!parent->l3_cls_refcnt[i]) {
+                                       /* disable class */
+                                       ret = tcam_user_ip_class_enable(np,
+                                                                       class,
+                                                                       0);
+                                       if (ret)
+                                               goto out;
+                                       parent->l3_cls[i] = 0;
+                                       parent->l3_cls_pid[i] = 0;
+                               }
+                               break;
+                       }
+               }
+               if (i == NIU_L3_PROG_CLS) {
+                       pr_info(PFX "niu%d: %s In niu_del_ethtool_tcam_entry,"
+                               "Usr class 0x%llx not found \n",
+                               parent->index, np->dev->name,
+                               (unsigned long long) class);
+                       ret = -EINVAL;
+                       goto out;
+               }
+       }
+
+       ret = tcam_flush(np, idx);
+       if (ret)
+               goto out;
+
+       /* invalidate the entry */
+       tp->valid = 0;
+       np->clas.tcam_valid_entries--;
+out:
+       niu_unlock_parent(np, flags);
+
+       return ret;
+}
+
+static int niu_set_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd)
+{
+       struct niu *np = netdev_priv(dev);
+       int ret = 0;
+
+       switch (cmd->cmd) {
+       case ETHTOOL_SRXFH:
+               ret = niu_set_hash_opts(np, cmd);
+               break;
+       case ETHTOOL_SRXCLSRLINS:
+               ret = niu_add_ethtool_tcam_entry(np, cmd);
+               break;
+       case ETHTOOL_SRXCLSRLDEL:
+               ret = niu_del_ethtool_tcam_entry(np, cmd->fs.location);
+               break;
+       default:
+               ret = -EINVAL;
+               break;
+       }
+
+       return ret;
+}
+
 static const struct {
        const char string[ETH_GSTRING_LEN];
 } niu_xmac_stat_keys[] = {
@@ -7158,6 +7937,7 @@ static const struct ethtool_ops niu_ethtool_ops = {
        .get_link               = ethtool_op_get_link,
        .get_msglevel           = niu_get_msglevel,
        .set_msglevel           = niu_set_msglevel,
+       .nway_reset             = niu_nway_reset,
        .get_eeprom_len         = niu_get_eeprom_len,
        .get_eeprom             = niu_get_eeprom,
        .get_settings           = niu_get_settings,
@@ -7166,8 +7946,8 @@ static const struct ethtool_ops niu_ethtool_ops = {
        .get_stats_count        = niu_get_stats_count,
        .get_ethtool_stats      = niu_get_ethtool_stats,
        .phys_id                = niu_phys_id,
-       .get_rxhash             = niu_get_hash_opts,
-       .set_rxhash             = niu_set_hash_opts,
+       .get_rxnfc              = niu_get_nfc,
+       .set_rxnfc              = niu_set_nfc,
 };
 
 static int niu_ldg_assign_ldn(struct niu *np, struct niu_parent *parent,
@@ -8237,7 +9017,8 @@ static int __devinit niu_classifier_swstate_init(struct niu *np)
        niudbg(PROBE, "niu_classifier_swstate_init: num_tcam(%d)\n",
               np->parent->tcam_num_entries);
 
-       cp->tcam_index = (u16) np->port;
+       cp->tcam_top = (u16) np->port;
+       cp->tcam_sz = np->parent->tcam_num_entries / np->parent->num_ports;
        cp->h1_init = 0xffffffff;
        cp->h2_init = 0xffff;
 
@@ -8257,7 +9038,9 @@ static void __devinit niu_link_config_init(struct niu *np)
                           ADVERTISED_10000baseT_Full |
                           ADVERTISED_Autoneg);
        lp->speed = lp->active_speed = SPEED_INVALID;
-       lp->duplex = lp->active_duplex = DUPLEX_INVALID;
+       lp->duplex = DUPLEX_FULL;
+       lp->active_duplex = DUPLEX_INVALID;
+       lp->autoneg = 1;
 #if 0
        lp->loopback_mode = LOOPBACK_MAC;
        lp->active_speed = SPEED_10000;
index e1a7392e8d70a61bb7b4c6703f3e74bb9b0cd44e..8754e44cadaeceed4e2c11b1f38250adc74e01c2 100644 (file)
@@ -3004,7 +3004,9 @@ struct niu_classifier {
        struct niu_altmac_rdc   alt_mac_mappings[16];
        struct niu_vlan_rdc     vlan_mappings[ENET_VLAN_TBL_NUM_ENTRIES];
 
-       u16                     tcam_index;
+       u16                     tcam_top;
+       u16                     tcam_sz;
+       u16                     tcam_valid_entries;
        u16                     num_alt_mac_mappings;
 
        u32                     h1_init;
@@ -3040,6 +3042,7 @@ struct phy_probe_info {
 };
 
 struct niu_tcam_entry {
+       u8                      valid;
        u64                     key[4];
        u64                     key_mask[4];
        u64                     assoc_data;
@@ -3107,10 +3110,15 @@ struct niu_parent {
        struct phy_probe_info   phy_probe_info;
 
        struct niu_tcam_entry   tcam[NIU_TCAM_ENTRIES_MAX];
-       u64                     l2_cls[2];
-       u64                     l3_cls[4];
+
+#define        NIU_L2_PROG_CLS         2
+#define        NIU_L3_PROG_CLS         4
+       u64                     l2_cls[NIU_L2_PROG_CLS];
+       u64                     l3_cls[NIU_L3_PROG_CLS];
        u64                     tcam_key[12];
        u64                     flow_key[12];
+       u16                     l3_cls_refcnt[NIU_L3_PROG_CLS];
+       u8                      l3_cls_pid[NIU_L3_PROG_CLS];
 };
 
 struct niu_ops {
@@ -3131,16 +3139,19 @@ struct niu_ops {
 };
 
 struct niu_link_config {
+       u32                             supported;
+
        /* Describes what we're trying to get. */
        u32                             advertising;
-       u32                             supported;
        u16                             speed;
        u8                              duplex;
        u8                              autoneg;
 
        /* Describes what we actually have. */
+       u32                             active_advertising;
        u16                             active_speed;
        u8                              active_duplex;
+       u8                              active_autoneg;
 #define SPEED_INVALID          0xffff
 #define DUPLEX_INVALID         0xff
 #define AUTONEG_INVALID                0xff
index e80294d8cc19e48fc5c230d2d78b50159235110f..9266502b5588d92006510b7b7f04841e4e153a2e 100644 (file)
@@ -409,7 +409,7 @@ static int lnksts = 0;              /* CFG_LNKSTS bit polarity */
 struct rx_info {
        spinlock_t      lock;
        int             up;
-       long            idle;
+       unsigned long   idle;
 
        struct sk_buff  *skbs[NR_RX_DESC];
 
index d0349e7d73ea9d873a4ce23afe6ae6e262e55fdb..5eeb5a87b7387ede885f565ea9409da99a704865 100644 (file)
@@ -970,7 +970,7 @@ static irqreturn_t pasemi_mac_rx_intr(int irq, void *data)
        if (*chan->status & PAS_STATUS_ERROR)
                reg |= PAS_IOB_DMA_RXCH_RESET_DINTC;
 
-       netif_rx_schedule(&mac->napi);
+       napi_schedule(&mac->napi);
 
        write_iob_reg(PAS_IOB_DMA_RXCH_RESET(chan->chno), reg);
 
@@ -1010,7 +1010,7 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
 
        mod_timer(&txring->clean_timer, jiffies + (TX_CLEAN_INTERVAL)*2);
 
-       netif_rx_schedule(&mac->napi);
+       napi_schedule(&mac->napi);
 
        if (reg)
                write_iob_reg(PAS_IOB_DMA_TXCH_RESET(chan->chno), reg);
@@ -1639,7 +1639,7 @@ static int pasemi_mac_poll(struct napi_struct *napi, int budget)
        pkts = pasemi_mac_clean_rx(rx_ring(mac), budget);
        if (pkts < budget) {
                /* all done, no more packets present */
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
                pasemi_mac_restart_rx_intr(mac);
                pasemi_mac_restart_tx_intr(mac);
index 0afa72095810e0f9ace213d48f5858bcbf5c5cf7..871ad2958ff6e8c0b9e5c3ad622b61f00df1422f 100644 (file)
@@ -861,7 +861,7 @@ module_exit(exit_axnet_cs);
 
   */
 
-static const char *version_8390 =
+static const char version_8390[] = KERN_INFO \
     "8390.c:v1.10cvs 9/23/94 Donald Becker (becker@scyld.com)\n";
 
 #include <linux/bitops.h>
index 665a4286da39dc29de659e03900ad7d89f172ab3..80124fac65fa83682a7b256db5dd11039fb7d445 100644 (file)
@@ -1397,7 +1397,7 @@ static int pcnet32_poll(struct napi_struct *napi, int budget)
        if (work_done < budget) {
                spin_lock_irqsave(&lp->lock, flags);
 
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
 
                /* clear interrupt masks */
                val = lp->a.read_csr(ioaddr, CSR3);
@@ -2592,14 +2592,14 @@ pcnet32_interrupt(int irq, void *dev_id)
                                       dev->name, csr0);
                        /* unlike for the lance, there is no restart needed */
                }
-               if (netif_rx_schedule_prep(&lp->napi)) {
+               if (napi_schedule_prep(&lp->napi)) {
                        u16 val;
                        /* set interrupt masks */
                        val = lp->a.read_csr(ioaddr, CSR3);
                        val |= 0x5f00;
                        lp->a.write_csr(ioaddr, CSR3, val);
                        mmiowb();
-                       __netif_rx_schedule(&lp->napi);
+                       __napi_schedule(&lp->napi);
                        break;
                }
                csr0 = lp->a.read_csr(ioaddr, CSR0);
index af28ff7ae1767a2c9ec6491c36d48b5797286197..33984b737233c8cb13d9d0dbf9a2e0d6d915601e 100644 (file)
@@ -202,16 +202,21 @@ static int __devinit mdio_ofgpio_probe(struct of_device *ofdev,
 {
        struct device_node *np = NULL;
        struct mdio_gpio_platform_data *pdata;
+       int ret;
 
        pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
        if (!pdata)
                return -ENOMEM;
 
-       pdata->mdc = of_get_gpio(ofdev->node, 0);
-       pdata->mdio = of_get_gpio(ofdev->node, 1);
-
-       if (pdata->mdc < 0 || pdata->mdio < 0)
+       ret = of_get_gpio(ofdev->node, 0);
+       if (ret < 0)
                goto out_free;
+       pdata->mdc = ret;
+
+       ret = of_get_gpio(ofdev->node, 1);
+       if (ret < 0)
+                goto out_free;
+       pdata->mdio = ret;
 
        while ((np = of_get_next_child(ofdev->node, np)))
                if (!strcmp(np->type, "ethernet-phy"))
index 811a637695caf4270247cbace802bca469bc03e0..bb29ae3ff17dc6765fac1db21c532c1c5660b93c 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/delay.h>
+#include <linux/device.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/skbuff.h>
@@ -286,33 +287,58 @@ static int mdio_bus_match(struct device *dev, struct device_driver *drv)
                (phydev->phy_id & phydrv->phy_id_mask));
 }
 
+static bool mdio_bus_phy_may_suspend(struct phy_device *phydev)
+{
+       struct device_driver *drv = phydev->dev.driver;
+       struct phy_driver *phydrv = to_phy_driver(drv);
+       struct net_device *netdev = phydev->attached_dev;
+
+       if (!drv || !phydrv->suspend)
+               return false;
+
+       /* PHY not attached? May suspend. */
+       if (!netdev)
+               return true;
+
+       /*
+        * Don't suspend PHY if the attched netdev parent may wakeup.
+        * The parent may point to a PCI device, as in tg3 driver.
+        */
+       if (netdev->dev.parent && device_may_wakeup(netdev->dev.parent))
+               return false;
+
+       /*
+        * Also don't suspend PHY if the netdev itself may wakeup. This
+        * is the case for devices w/o underlaying pwr. mgmt. aware bus,
+        * e.g. SoC devices.
+        */
+       if (device_may_wakeup(&netdev->dev))
+               return false;
+
+       return true;
+}
+
 /* Suspend and resume.  Copied from platform_suspend and
  * platform_resume
  */
 static int mdio_bus_suspend(struct device * dev, pm_message_t state)
 {
-       int ret = 0;
-       struct device_driver *drv = dev->driver;
-       struct phy_driver *phydrv = to_phy_driver(drv);
+       struct phy_driver *phydrv = to_phy_driver(dev->driver);
        struct phy_device *phydev = to_phy_device(dev);
 
-       if (drv && phydrv->suspend && !device_may_wakeup(phydev->dev.parent))
-               ret = phydrv->suspend(phydev);
-
-       return ret;
+       if (!mdio_bus_phy_may_suspend(phydev))
+               return 0;
+       return phydrv->suspend(phydev);
 }
 
 static int mdio_bus_resume(struct device * dev)
 {
-       int ret = 0;
-       struct device_driver *drv = dev->driver;
-       struct phy_driver *phydrv = to_phy_driver(drv);
+       struct phy_driver *phydrv = to_phy_driver(dev->driver);
        struct phy_device *phydev = to_phy_device(dev);
 
-       if (drv && phydrv->resume && !device_may_wakeup(phydev->dev.parent))
-               ret = phydrv->resume(phydev);
-
-       return ret;
+       if (!mdio_bus_phy_may_suspend(phydev))
+               return 0;
+       return phydrv->resume(phydev);
 }
 
 struct bus_type mdio_bus_type = {
index 7b2728b8f1b7327e77c92dd4afa93c712af2a36d..81e7fcced4b98173ffeb74392f50f73593979dd8 100644 (file)
 #include <net/slhc_vj.h>
 #include <asm/atomic.h>
 
+#include <linux/nsproxy.h>
+#include <net/net_namespace.h>
+#include <net/netns/generic.h>
+
 #define PPP_VERSION    "2.4.2"
 
 /*
@@ -131,6 +135,7 @@ struct ppp {
        struct sock_filter *active_filter;/* filter for pkts to reset idle */
        unsigned pass_len, active_len;
 #endif /* CONFIG_PPP_FILTER */
+       struct net      *ppp_net;       /* the net we belong to */
 };
 
 /*
@@ -155,6 +160,7 @@ struct channel {
        struct rw_semaphore chan_sem;   /* protects `chan' during chan ioctl */
        spinlock_t      downl;          /* protects `chan', file.xq dequeue */
        struct ppp      *ppp;           /* ppp unit we're connected to */
+       struct net      *chan_net;      /* the net channel belongs to */
        struct list_head clist;         /* link in list of channels per unit */
        rwlock_t        upl;            /* protects `ppp' */
 #ifdef CONFIG_PPP_MULTILINK
@@ -173,26 +179,35 @@ struct channel {
  * channel.downl.
  */
 
-/*
- * all_ppp_mutex protects the all_ppp_units mapping.
- * It also ensures that finding a ppp unit in the all_ppp_units map
- * and updating its file.refcnt field is atomic.
- */
-static DEFINE_MUTEX(all_ppp_mutex);
 static atomic_t ppp_unit_count = ATOMIC_INIT(0);
-static DEFINE_IDR(ppp_units_idr);
-
-/*
- * all_channels_lock protects all_channels and last_channel_index,
- * and the atomicity of find a channel and updating its file.refcnt
- * field.
- */
-static DEFINE_SPINLOCK(all_channels_lock);
-static LIST_HEAD(all_channels);
-static LIST_HEAD(new_channels);
-static int last_channel_index;
 static atomic_t channel_count = ATOMIC_INIT(0);
 
+/* per-net private data for this module */
+static int ppp_net_id;
+struct ppp_net {
+       /* units to ppp mapping */
+       struct idr units_idr;
+
+       /*
+        * all_ppp_mutex protects the units_idr mapping.
+        * It also ensures that finding a ppp unit in the units_idr
+        * map and updating its file.refcnt field is atomic.
+        */
+       struct mutex all_ppp_mutex;
+
+       /* channels */
+       struct list_head all_channels;
+       struct list_head new_channels;
+       int last_channel_index;
+
+       /*
+        * all_channels_lock protects all_channels and
+        * last_channel_index, and the atomicity of find
+        * a channel and updating its file.refcnt field.
+        */
+       spinlock_t all_channels_lock;
+};
+
 /* Get the PPP protocol number from a skb */
 #define PPP_PROTO(skb) (((skb)->data[0] << 8) + (skb)->data[1])
 
@@ -216,8 +231,8 @@ static atomic_t channel_count = ATOMIC_INIT(0);
 #define seq_after(a, b)                ((s32)((a) - (b)) > 0)
 
 /* Prototypes. */
-static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
-                               unsigned int cmd, unsigned long arg);
+static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
+                       struct file *file, unsigned int cmd, unsigned long arg);
 static void ppp_xmit_process(struct ppp *ppp);
 static void ppp_send_frame(struct ppp *ppp, struct sk_buff *skb);
 static void ppp_push(struct ppp *ppp);
@@ -240,12 +255,12 @@ static void ppp_ccp_peek(struct ppp *ppp, struct sk_buff *skb, int inbound);
 static void ppp_ccp_closed(struct ppp *ppp);
 static struct compressor *find_compressor(int type);
 static void ppp_get_stats(struct ppp *ppp, struct ppp_stats *st);
-static struct ppp *ppp_create_interface(int unit, int *retp);
+static struct ppp *ppp_create_interface(struct net *net, int unit, int *retp);
 static void init_ppp_file(struct ppp_file *pf, int kind);
 static void ppp_shutdown_interface(struct ppp *ppp);
 static void ppp_destroy_interface(struct ppp *ppp);
-static struct ppp *ppp_find_unit(int unit);
-static struct channel *ppp_find_channel(int unit);
+static struct ppp *ppp_find_unit(struct ppp_net *pn, int unit);
+static struct channel *ppp_find_channel(struct ppp_net *pn, int unit);
 static int ppp_connect_channel(struct channel *pch, int unit);
 static int ppp_disconnect_channel(struct channel *pch);
 static void ppp_destroy_channel(struct channel *pch);
@@ -256,6 +271,14 @@ static void *unit_find(struct idr *p, int n);
 
 static struct class *ppp_class;
 
+/* per net-namespace data */
+static inline struct ppp_net *ppp_pernet(struct net *net)
+{
+       BUG_ON(!net);
+
+       return net_generic(net, ppp_net_id);
+}
+
 /* Translates a PPP protocol number to a NP index (NP == network protocol) */
 static inline int proto_to_npindex(int proto)
 {
@@ -544,7 +567,8 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        int __user *p = argp;
 
        if (!pf)
-               return ppp_unattached_ioctl(pf, file, cmd, arg);
+               return ppp_unattached_ioctl(current->nsproxy->net_ns,
+                                       pf, file, cmd, arg);
 
        if (cmd == PPPIOCDETACH) {
                /*
@@ -763,12 +787,13 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        return err;
 }
 
-static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
-                               unsigned int cmd, unsigned long arg)
+static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
+                       struct file *file, unsigned int cmd, unsigned long arg)
 {
        int unit, err = -EFAULT;
        struct ppp *ppp;
        struct channel *chan;
+       struct ppp_net *pn;
        int __user *p = (int __user *)arg;
 
        lock_kernel();
@@ -777,7 +802,7 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
                /* Create a new ppp unit */
                if (get_user(unit, p))
                        break;
-               ppp = ppp_create_interface(unit, &err);
+               ppp = ppp_create_interface(net, unit, &err);
                if (!ppp)
                        break;
                file->private_data = &ppp->file;
@@ -792,29 +817,31 @@ static int ppp_unattached_ioctl(struct ppp_file *pf, struct file *file,
                /* Attach to an existing ppp unit */
                if (get_user(unit, p))
                        break;
-               mutex_lock(&all_ppp_mutex);
                err = -ENXIO;
-               ppp = ppp_find_unit(unit);
+               pn = ppp_pernet(net);
+               mutex_lock(&pn->all_ppp_mutex);
+               ppp = ppp_find_unit(pn, unit);
                if (ppp) {
                        atomic_inc(&ppp->file.refcnt);
                        file->private_data = &ppp->file;
                        err = 0;
                }
-               mutex_unlock(&all_ppp_mutex);
+               mutex_unlock(&pn->all_ppp_mutex);
                break;
 
        case PPPIOCATTCHAN:
                if (get_user(unit, p))
                        break;
-               spin_lock_bh(&all_channels_lock);
                err = -ENXIO;
-               chan = ppp_find_channel(unit);
+               pn = ppp_pernet(net);
+               spin_lock_bh(&pn->all_channels_lock);
+               chan = ppp_find_channel(pn, unit);
                if (chan) {
                        atomic_inc(&chan->file.refcnt);
                        file->private_data = &chan->file;
                        err = 0;
                }
-               spin_unlock_bh(&all_channels_lock);
+               spin_unlock_bh(&pn->all_channels_lock);
                break;
 
        default:
@@ -834,6 +861,51 @@ static const struct file_operations ppp_device_fops = {
        .release        = ppp_release
 };
 
+static __net_init int ppp_init_net(struct net *net)
+{
+       struct ppp_net *pn;
+       int err;
+
+       pn = kzalloc(sizeof(*pn), GFP_KERNEL);
+       if (!pn)
+               return -ENOMEM;
+
+       idr_init(&pn->units_idr);
+       mutex_init(&pn->all_ppp_mutex);
+
+       INIT_LIST_HEAD(&pn->all_channels);
+       INIT_LIST_HEAD(&pn->new_channels);
+
+       spin_lock_init(&pn->all_channels_lock);
+
+       err = net_assign_generic(net, ppp_net_id, pn);
+       if (err) {
+               kfree(pn);
+               return err;
+       }
+
+       return 0;
+}
+
+static __net_exit void ppp_exit_net(struct net *net)
+{
+       struct ppp_net *pn;
+
+       pn = net_generic(net, ppp_net_id);
+       idr_destroy(&pn->units_idr);
+       /*
+        * if someone has cached our net then
+        * further net_generic call will return NULL
+        */
+       net_assign_generic(net, ppp_net_id, NULL);
+       kfree(pn);
+}
+
+static struct pernet_operations ppp_net_ops = {
+       .init = ppp_init_net,
+       .exit = ppp_exit_net,
+};
+
 #define PPP_MAJOR      108
 
 /* Called at boot time if ppp is compiled into the kernel,
@@ -843,25 +915,36 @@ static int __init ppp_init(void)
        int err;
 
        printk(KERN_INFO "PPP generic driver version " PPP_VERSION "\n");
-       err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
-       if (!err) {
-               ppp_class = class_create(THIS_MODULE, "ppp");
-               if (IS_ERR(ppp_class)) {
-                       err = PTR_ERR(ppp_class);
-                       goto out_chrdev;
-               }
-               device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL,
-                             "ppp");
+
+       err = register_pernet_gen_device(&ppp_net_id, &ppp_net_ops);
+       if (err) {
+               printk(KERN_ERR "failed to register PPP pernet device (%d)\n", err);
+               goto out;
        }
 
-out:
-       if (err)
+       err = register_chrdev(PPP_MAJOR, "ppp", &ppp_device_fops);
+       if (err) {
                printk(KERN_ERR "failed to register PPP device (%d)\n", err);
-       return err;
+               goto out_net;
+       }
+
+       ppp_class = class_create(THIS_MODULE, "ppp");
+       if (IS_ERR(ppp_class)) {
+               err = PTR_ERR(ppp_class);
+               goto out_chrdev;
+       }
+
+       /* not a big deal if we fail here :-) */
+       device_create(ppp_class, NULL, MKDEV(PPP_MAJOR, 0), NULL, "ppp");
+
+       return 0;
 
 out_chrdev:
        unregister_chrdev(PPP_MAJOR, "ppp");
-       goto out;
+out_net:
+       unregister_pernet_gen_device(ppp_net_id, &ppp_net_ops);
+out:
+       return err;
 }
 
 /*
@@ -969,6 +1052,7 @@ static void ppp_setup(struct net_device *dev)
        dev->tx_queue_len = 3;
        dev->type = ARPHRD_PPP;
        dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
+       dev->features |= NETIF_F_NETNS_LOCAL;
 }
 
 /*
@@ -1986,19 +2070,27 @@ ppp_mp_reconstruct(struct ppp *ppp)
  * Channel interface.
  */
 
-/*
- * Create a new, unattached ppp channel.
- */
-int
-ppp_register_channel(struct ppp_channel *chan)
+/* Create a new, unattached ppp channel. */
+int ppp_register_channel(struct ppp_channel *chan)
+{
+       return ppp_register_net_channel(current->nsproxy->net_ns, chan);
+}
+
+/* Create a new, unattached ppp channel for specified net. */
+int ppp_register_net_channel(struct net *net, struct ppp_channel *chan)
 {
        struct channel *pch;
+       struct ppp_net *pn;
 
        pch = kzalloc(sizeof(struct channel), GFP_KERNEL);
        if (!pch)
                return -ENOMEM;
+
+       pn = ppp_pernet(net);
+
        pch->ppp = NULL;
        pch->chan = chan;
+       pch->chan_net = net;
        chan->ppp = pch;
        init_ppp_file(&pch->file, CHANNEL);
        pch->file.hdrlen = chan->hdrlen;
@@ -2008,11 +2100,13 @@ ppp_register_channel(struct ppp_channel *chan)
        init_rwsem(&pch->chan_sem);
        spin_lock_init(&pch->downl);
        rwlock_init(&pch->upl);
-       spin_lock_bh(&all_channels_lock);
-       pch->file.index = ++last_channel_index;
-       list_add(&pch->list, &new_channels);
+
+       spin_lock_bh(&pn->all_channels_lock);
+       pch->file.index = ++pn->last_channel_index;
+       list_add(&pch->list, &pn->new_channels);
        atomic_inc(&channel_count);
-       spin_unlock_bh(&all_channels_lock);
+       spin_unlock_bh(&pn->all_channels_lock);
+
        return 0;
 }
 
@@ -2053,9 +2147,11 @@ void
 ppp_unregister_channel(struct ppp_channel *chan)
 {
        struct channel *pch = chan->ppp;
+       struct ppp_net *pn;
 
        if (!pch)
                return;         /* should never happen */
+
        chan->ppp = NULL;
 
        /*
@@ -2068,9 +2164,12 @@ ppp_unregister_channel(struct ppp_channel *chan)
        spin_unlock_bh(&pch->downl);
        up_write(&pch->chan_sem);
        ppp_disconnect_channel(pch);
-       spin_lock_bh(&all_channels_lock);
+
+       pn = ppp_pernet(pch->chan_net);
+       spin_lock_bh(&pn->all_channels_lock);
        list_del(&pch->list);
-       spin_unlock_bh(&all_channels_lock);
+       spin_unlock_bh(&pn->all_channels_lock);
+
        pch->file.dead = 1;
        wake_up_interruptible(&pch->file.rwait);
        if (atomic_dec_and_test(&pch->file.refcnt))
@@ -2395,9 +2494,10 @@ ppp_get_stats(struct ppp *ppp, struct ppp_stats *st)
  * unit == -1 means allocate a new number.
  */
 static struct ppp *
-ppp_create_interface(int unit, int *retp)
+ppp_create_interface(struct net *net, int unit, int *retp)
 {
        struct ppp *ppp;
+       struct ppp_net *pn;
        struct net_device *dev = NULL;
        int ret = -ENOMEM;
        int i;
@@ -2406,6 +2506,8 @@ ppp_create_interface(int unit, int *retp)
        if (!dev)
                goto out1;
 
+       pn = ppp_pernet(net);
+
        ppp = netdev_priv(dev);
        ppp->dev = dev;
        ppp->mru = PPP_MRU;
@@ -2421,17 +2523,23 @@ ppp_create_interface(int unit, int *retp)
        skb_queue_head_init(&ppp->mrq);
 #endif /* CONFIG_PPP_MULTILINK */
 
+       /*
+        * drum roll: don't forget to set
+        * the net device is belong to
+        */
+       dev_net_set(dev, net);
+
        ret = -EEXIST;
-       mutex_lock(&all_ppp_mutex);
+       mutex_lock(&pn->all_ppp_mutex);
 
        if (unit < 0) {
-               unit = unit_get(&ppp_units_idr, ppp);
+               unit = unit_get(&pn->units_idr, ppp);
                if (unit < 0) {
                        *retp = unit;
                        goto out2;
                }
        } else {
-               if (unit_find(&ppp_units_idr, unit))
+               if (unit_find(&pn->units_idr, unit))
                        goto out2; /* unit already exists */
                /*
                 * if caller need a specified unit number
@@ -2442,7 +2550,7 @@ ppp_create_interface(int unit, int *retp)
                 * fair but at least pppd will ask us to allocate
                 * new unit in this case so user is happy :)
                 */
-               unit = unit_set(&ppp_units_idr, ppp, unit);
+               unit = unit_set(&pn->units_idr, ppp, unit);
                if (unit < 0)
                        goto out2;
        }
@@ -2453,20 +2561,22 @@ ppp_create_interface(int unit, int *retp)
 
        ret = register_netdev(dev);
        if (ret != 0) {
-               unit_put(&ppp_units_idr, unit);
+               unit_put(&pn->units_idr, unit);
                printk(KERN_ERR "PPP: couldn't register device %s (%d)\n",
                       dev->name, ret);
                goto out2;
        }
 
+       ppp->ppp_net = net;
+
        atomic_inc(&ppp_unit_count);
-       mutex_unlock(&all_ppp_mutex);
+       mutex_unlock(&pn->all_ppp_mutex);
 
        *retp = 0;
        return ppp;
 
 out2:
-       mutex_unlock(&all_ppp_mutex);
+       mutex_unlock(&pn->all_ppp_mutex);
        free_netdev(dev);
 out1:
        *retp = ret;
@@ -2492,7 +2602,11 @@ init_ppp_file(struct ppp_file *pf, int kind)
  */
 static void ppp_shutdown_interface(struct ppp *ppp)
 {
-       mutex_lock(&all_ppp_mutex);
+       struct ppp_net *pn;
+
+       pn = ppp_pernet(ppp->ppp_net);
+       mutex_lock(&pn->all_ppp_mutex);
+
        /* This will call dev_close() for us. */
        ppp_lock(ppp);
        if (!ppp->closing) {
@@ -2502,11 +2616,12 @@ static void ppp_shutdown_interface(struct ppp *ppp)
        } else
                ppp_unlock(ppp);
 
-       unit_put(&ppp_units_idr, ppp->file.index);
+       unit_put(&pn->units_idr, ppp->file.index);
        ppp->file.dead = 1;
        ppp->owner = NULL;
        wake_up_interruptible(&ppp->file.rwait);
-       mutex_unlock(&all_ppp_mutex);
+
+       mutex_unlock(&pn->all_ppp_mutex);
 }
 
 /*
@@ -2554,9 +2669,9 @@ static void ppp_destroy_interface(struct ppp *ppp)
  * The caller should have locked the all_ppp_mutex.
  */
 static struct ppp *
-ppp_find_unit(int unit)
+ppp_find_unit(struct ppp_net *pn, int unit)
 {
-       return unit_find(&ppp_units_idr, unit);
+       return unit_find(&pn->units_idr, unit);
 }
 
 /*
@@ -2568,20 +2683,22 @@ ppp_find_unit(int unit)
  * when we have a lot of channels in use.
  */
 static struct channel *
-ppp_find_channel(int unit)
+ppp_find_channel(struct ppp_net *pn, int unit)
 {
        struct channel *pch;
 
-       list_for_each_entry(pch, &new_channels, list) {
+       list_for_each_entry(pch, &pn->new_channels, list) {
                if (pch->file.index == unit) {
-                       list_move(&pch->list, &all_channels);
+                       list_move(&pch->list, &pn->all_channels);
                        return pch;
                }
        }
-       list_for_each_entry(pch, &all_channels, list) {
+
+       list_for_each_entry(pch, &pn->all_channels, list) {
                if (pch->file.index == unit)
                        return pch;
        }
+
        return NULL;
 }
 
@@ -2592,11 +2709,14 @@ static int
 ppp_connect_channel(struct channel *pch, int unit)
 {
        struct ppp *ppp;
+       struct ppp_net *pn;
        int ret = -ENXIO;
        int hdrlen;
 
-       mutex_lock(&all_ppp_mutex);
-       ppp = ppp_find_unit(unit);
+       pn = ppp_pernet(pch->chan_net);
+
+       mutex_lock(&pn->all_ppp_mutex);
+       ppp = ppp_find_unit(pn, unit);
        if (!ppp)
                goto out;
        write_lock_bh(&pch->upl);
@@ -2620,7 +2740,7 @@ ppp_connect_channel(struct channel *pch, int unit)
  outl:
        write_unlock_bh(&pch->upl);
  out:
-       mutex_unlock(&all_ppp_mutex);
+       mutex_unlock(&pn->all_ppp_mutex);
        return ret;
 }
 
@@ -2677,7 +2797,7 @@ static void __exit ppp_cleanup(void)
        unregister_chrdev(PPP_MAJOR, "ppp");
        device_destroy(ppp_class, MKDEV(PPP_MAJOR, 0));
        class_destroy(ppp_class);
-       idr_destroy(&ppp_units_idr);
+       unregister_pernet_gen_device(ppp_net_id, &ppp_net_ops);
 }
 
 /*
@@ -2743,6 +2863,7 @@ static void *unit_find(struct idr *p, int n)
 module_init(ppp_init);
 module_exit(ppp_cleanup);
 
+EXPORT_SYMBOL(ppp_register_net_channel);
 EXPORT_SYMBOL(ppp_register_channel);
 EXPORT_SYMBOL(ppp_unregister_channel);
 EXPORT_SYMBOL(ppp_channel_index);
index c22b30533a14cb89eeeda69a83317f80e8c383b3..e2968f0844394d9674540332885cc2edfd3a687d 100644 (file)
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 
+#include <linux/nsproxy.h>
 #include <net/net_namespace.h>
+#include <net/netns/generic.h>
 #include <net/sock.h>
 
 #include <asm/uaccess.h>
 
 #define PPPOE_HASH_BITS 4
-#define PPPOE_HASH_SIZE (1<<PPPOE_HASH_BITS)
-
-static struct ppp_channel_ops pppoe_chan_ops;
+#define PPPOE_HASH_SIZE (1 << PPPOE_HASH_BITS)
+#define PPPOE_HASH_MASK        (PPPOE_HASH_SIZE - 1)
 
 static int pppoe_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg);
 static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb);
 static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb);
 
 static const struct proto_ops pppoe_ops;
-static DEFINE_RWLOCK(pppoe_hash_lock);
-
 static struct ppp_channel_ops pppoe_chan_ops;
 
+/* per-net private data for this module */
+static int pppoe_net_id;
+struct pppoe_net {
+       /*
+        * we could use _single_ hash table for all
+        * nets by injecting net id into the hash but
+        * it would increase hash chains and add
+        * a few additional math comparations messy
+        * as well, moreover in case of SMP less locking
+        * controversy here
+        */
+       struct pppox_sock *hash_table[PPPOE_HASH_SIZE];
+       rwlock_t hash_lock;
+};
+
+/* to eliminate a race btw pppoe_flush_dev and pppoe_release */
+static DEFINE_SPINLOCK(flush_lock);
+
+/*
+ * PPPoE could be in the following stages:
+ * 1) Discovery stage (to obtain remote MAC and Session ID)
+ * 2) Session stage (MAC and SID are known)
+ *
+ * Ethernet frames have a special tag for this but
+ * we use simplier approach based on session id
+ */
+static inline bool stage_session(__be16 sid)
+{
+       return sid != 0;
+}
+
+static inline struct pppoe_net *pppoe_pernet(struct net *net)
+{
+       BUG_ON(!net);
+
+       return net_generic(net, pppoe_net_id);
+}
+
 static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
 {
-       return (a->sid == b->sid &&
-               (memcmp(a->remote, b->remote, ETH_ALEN) == 0));
+       return a->sid == b->sid && !memcmp(a->remote, b->remote, ETH_ALEN);
 }
 
 static inline int cmp_addr(struct pppoe_addr *a, __be16 sid, char *addr)
 {
-       return (a->sid == sid &&
-               (memcmp(a->remote,addr,ETH_ALEN) == 0));
+       return a->sid == sid && !memcmp(a->remote, addr, ETH_ALEN);
 }
 
-#if 8%PPPOE_HASH_BITS
+#if 8 % PPPOE_HASH_BITS
 #error 8 must be a multiple of PPPOE_HASH_BITS
 #endif
 
@@ -118,69 +153,71 @@ static int hash_item(__be16 sid, unsigned char *addr)
        unsigned char hash = 0;
        unsigned int i;
 
-       for (i = 0 ; i < ETH_ALEN ; i++) {
+       for (i = 0; i < ETH_ALEN; i++)
                hash ^= addr[i];
-       }
-       for (i = 0 ; i < sizeof(sid_t)*8 ; i += 8 ){
-               hash ^= (__force __u32)sid>>i;
-       }
-       for (i = 8 ; (i>>=1) >= PPPOE_HASH_BITS ; ) {
-               hash ^= hash>>i;
-       }
+       for (i = 0; i < sizeof(sid_t) * 8; i += 8)
+               hash ^= (__force __u32)sid >> i;
+       for (i = 8; (i >>= 1) >= PPPOE_HASH_BITS;)
+               hash ^= hash >> i;
 
-       return hash & ( PPPOE_HASH_SIZE - 1 );
+       return hash & PPPOE_HASH_MASK;
 }
 
-/* zeroed because its in .bss */
-static struct pppox_sock *item_hash_table[PPPOE_HASH_SIZE];
-
 /**********************************************************************
  *
  *  Set/get/delete/rehash items  (internal versions)
  *
  **********************************************************************/
-static struct pppox_sock *__get_item(__be16 sid, unsigned char *addr, int ifindex)
+static struct pppox_sock *__get_item(struct pppoe_net *pn, __be16 sid,
+                               unsigned char *addr, int ifindex)
 {
        int hash = hash_item(sid, addr);
        struct pppox_sock *ret;
 
-       ret = item_hash_table[hash];
+       ret = pn->hash_table[hash];
+       while (ret) {
+               if (cmp_addr(&ret->pppoe_pa, sid, addr) &&
+                   ret->pppoe_ifindex == ifindex)
+                       return ret;
 
-       while (ret && !(cmp_addr(&ret->pppoe_pa, sid, addr) && ret->pppoe_ifindex == ifindex))
                ret = ret->next;
+       }
 
-       return ret;
+       return NULL;
 }
 
-static int __set_item(struct pppox_sock *po)
+static int __set_item(struct pppoe_net *pn, struct pppox_sock *po)
 {
        int hash = hash_item(po->pppoe_pa.sid, po->pppoe_pa.remote);
        struct pppox_sock *ret;
 
-       ret = item_hash_table[hash];
+       ret = pn->hash_table[hash];
        while (ret) {
-               if (cmp_2_addr(&ret->pppoe_pa, &po->pppoe_pa) && ret->pppoe_ifindex == po->pppoe_ifindex)
+               if (cmp_2_addr(&ret->pppoe_pa, &po->pppoe_pa) &&
+                   ret->pppoe_ifindex == po->pppoe_ifindex)
                        return -EALREADY;
 
                ret = ret->next;
        }
 
-       po->next = item_hash_table[hash];
-       item_hash_table[hash] = po;
+       po->next = pn->hash_table[hash];
+       pn->hash_table[hash] = po;
 
        return 0;
 }
 
-static struct pppox_sock *__delete_item(__be16 sid, char *addr, int ifindex)
+static struct pppox_sock *__delete_item(struct pppoe_net *pn, __be16 sid,
+                                       char *addr, int ifindex)
 {
        int hash = hash_item(sid, addr);
        struct pppox_sock *ret, **src;
 
-       ret = item_hash_table[hash];
-       src = &item_hash_table[hash];
+       ret = pn->hash_table[hash];
+       src = &pn->hash_table[hash];
 
        while (ret) {
-               if (cmp_addr(&ret->pppoe_pa, sid, addr) && ret->pppoe_ifindex == ifindex) {
+               if (cmp_addr(&ret->pppoe_pa, sid, addr) &&
+                   ret->pppoe_ifindex == ifindex) {
                        *src = ret->next;
                        break;
                }
@@ -197,46 +234,54 @@ static struct pppox_sock *__delete_item(__be16 sid, char *addr, int ifindex)
  *  Set/get/delete/rehash items
  *
  **********************************************************************/
-static inline struct pppox_sock *get_item(__be16 sid,
-                                        unsigned char *addr, int ifindex)
+static inline struct pppox_sock *get_item(struct pppoe_net *pn, __be16 sid,
+                                       unsigned char *addr, int ifindex)
 {
        struct pppox_sock *po;
 
-       read_lock_bh(&pppoe_hash_lock);
-       po = __get_item(sid, addr, ifindex);
+       read_lock_bh(&pn->hash_lock);
+       po = __get_item(pn, sid, addr, ifindex);
        if (po)
                sock_hold(sk_pppox(po));
-       read_unlock_bh(&pppoe_hash_lock);
+       read_unlock_bh(&pn->hash_lock);
 
        return po;
 }
 
-static inline struct pppox_sock *get_item_by_addr(struct sockaddr_pppox *sp)
+static inline struct pppox_sock *get_item_by_addr(struct net *net,
+                                               struct sockaddr_pppox *sp)
 {
        struct net_device *dev;
+       struct pppoe_net *pn;
+       struct pppox_sock *pppox_sock;
+
        int ifindex;
 
-       dev = dev_get_by_name(&init_net, sp->sa_addr.pppoe.dev);
-       if(!dev)
+       dev = dev_get_by_name(net, sp->sa_addr.pppoe.dev);
+       if (!dev)
                return NULL;
+
        ifindex = dev->ifindex;
+       pn = net_generic(net, pppoe_net_id);
+       pppox_sock = get_item(pn, sp->sa_addr.pppoe.sid,
+                               sp->sa_addr.pppoe.remote, ifindex);
        dev_put(dev);
-       return get_item(sp->sa_addr.pppoe.sid, sp->sa_addr.pppoe.remote, ifindex);
+
+       return pppox_sock;
 }
 
-static inline struct pppox_sock *delete_item(__be16 sid, char *addr, int ifindex)
+static inline struct pppox_sock *delete_item(struct pppoe_net *pn, __be16 sid,
+                                       char *addr, int ifindex)
 {
        struct pppox_sock *ret;
 
-       write_lock_bh(&pppoe_hash_lock);
-       ret = __delete_item(sid, addr, ifindex);
-       write_unlock_bh(&pppoe_hash_lock);
+       write_lock_bh(&pn->hash_lock);
+       ret = __delete_item(pn, sid, addr, ifindex);
+       write_unlock_bh(&pn->hash_lock);
 
        return ret;
 }
 
-
-
 /***************************************************************************
  *
  *  Handler for device events.
@@ -246,25 +291,33 @@ static inline struct pppox_sock *delete_item(__be16 sid, char *addr, int ifindex
 
 static void pppoe_flush_dev(struct net_device *dev)
 {
-       int hash;
+       struct pppoe_net *pn;
+       int i;
+
        BUG_ON(dev == NULL);
 
-       write_lock_bh(&pppoe_hash_lock);
-       for (hash = 0; hash < PPPOE_HASH_SIZE; hash++) {
-               struct pppox_sock *po = item_hash_table[hash];
+       pn = pppoe_pernet(dev_net(dev));
+       if (!pn) /* already freed */
+               return;
+
+       write_lock_bh(&pn->hash_lock);
+       for (i = 0; i < PPPOE_HASH_SIZE; i++) {
+               struct pppox_sock *po = pn->hash_table[i];
 
                while (po != NULL) {
-                       struct sock *sk = sk_pppox(po);
+                       struct sock *sk;
                        if (po->pppoe_dev != dev) {
                                po = po->next;
                                continue;
                        }
+                       sk = sk_pppox(po);
+                       spin_lock(&flush_lock);
                        po->pppoe_dev = NULL;
+                       spin_unlock(&flush_lock);
                        dev_put(dev);
 
-
                        /* We always grab the socket lock, followed by the
-                        * pppoe_hash_lock, in that order.  Since we should
+                        * hash_lock, in that order.  Since we should
                         * hold the sock lock while doing any unbinding,
                         * we need to release the lock we're holding.
                         * Hold a reference to the sock so it doesn't disappear
@@ -273,7 +326,7 @@ static void pppoe_flush_dev(struct net_device *dev)
 
                        sock_hold(sk);
 
-                       write_unlock_bh(&pppoe_hash_lock);
+                       write_unlock_bh(&pn->hash_lock);
                        lock_sock(sk);
 
                        if (sk->sk_state & (PPPOX_CONNECTED | PPPOX_BOUND)) {
@@ -289,20 +342,17 @@ static void pppoe_flush_dev(struct net_device *dev)
                         * While the lock was dropped the chain contents may
                         * have changed.
                         */
-                       write_lock_bh(&pppoe_hash_lock);
-                       po = item_hash_table[hash];
+                       write_lock_bh(&pn->hash_lock);
+                       po = pn->hash_table[i];
                }
        }
-       write_unlock_bh(&pppoe_hash_lock);
+       write_unlock_bh(&pn->hash_lock);
 }
 
 static int pppoe_device_event(struct notifier_block *this,
                              unsigned long event, void *ptr)
 {
-       struct net_device *dev = (struct net_device *) ptr;
-
-       if (dev_net(dev) != &init_net)
-               return NOTIFY_DONE;
+       struct net_device *dev = (struct net_device *)ptr;
 
        /* Only look at sockets that are using this specific device. */
        switch (event) {
@@ -324,12 +374,10 @@ static int pppoe_device_event(struct notifier_block *this,
        return NOTIFY_DONE;
 }
 
-
 static struct notifier_block pppoe_notifier = {
        .notifier_call = pppoe_device_event,
 };
 
-
 /************************************************************************
  *
  * Do the real work of receiving a PPPoE Session frame.
@@ -343,8 +391,8 @@ static int pppoe_rcv_core(struct sock *sk, struct sk_buff *skb)
        if (sk->sk_state & PPPOX_BOUND) {
                ppp_input(&po->chan, skb);
        } else if (sk->sk_state & PPPOX_RELAY) {
-               relay_po = get_item_by_addr(&po->pppoe_relay);
-
+               relay_po = get_item_by_addr(dev_net(po->pppoe_dev),
+                                               &po->pppoe_relay);
                if (relay_po == NULL)
                        goto abort_kfree;
 
@@ -373,22 +421,18 @@ abort_kfree:
  * Receive wrapper called in BH context.
  *
  ***********************************************************************/
-static int pppoe_rcv(struct sk_buff *skb,
-                    struct net_device *dev,
-                    struct packet_type *pt,
-                    struct net_device *orig_dev)
-
+static int pppoe_rcv(struct sk_buff *skb, struct net_device *dev,
+                    struct packet_type *pt, struct net_device *orig_dev)
 {
        struct pppoe_hdr *ph;
        struct pppox_sock *po;
+       struct pppoe_net *pn;
        int len;
 
-       if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
+       skb = skb_share_check(skb, GFP_ATOMIC);
+       if (!skb)
                goto out;
 
-       if (dev_net(dev) != &init_net)
-               goto drop;
-
        if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
                goto drop;
 
@@ -402,7 +446,8 @@ static int pppoe_rcv(struct sk_buff *skb,
        if (pskb_trim_rcsum(skb, len))
                goto drop;
 
-       po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
+       pn = pppoe_pernet(dev_net(dev));
+       po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
        if (!po)
                goto drop;
 
@@ -420,19 +465,16 @@ out:
  * This is solely for detection of PADT frames
  *
  ***********************************************************************/
-static int pppoe_disc_rcv(struct sk_buff *skb,
-                         struct net_device *dev,
-                         struct packet_type *pt,
-                         struct net_device *orig_dev)
+static int pppoe_disc_rcv(struct sk_buff *skb, struct net_device *dev,
+                         struct packet_type *pt, struct net_device *orig_dev)
 
 {
        struct pppoe_hdr *ph;
        struct pppox_sock *po;
+       struct pppoe_net *pn;
 
-       if (dev_net(dev) != &init_net)
-               goto abort;
-
-       if (!(skb = skb_share_check(skb, GFP_ATOMIC)))
+       skb = skb_share_check(skb, GFP_ATOMIC);
+       if (!skb)
                goto out;
 
        if (!pskb_may_pull(skb, sizeof(struct pppoe_hdr)))
@@ -442,7 +484,8 @@ static int pppoe_disc_rcv(struct sk_buff *skb,
        if (ph->code != PADT_CODE)
                goto abort;
 
-       po = get_item(ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
+       pn = pppoe_pernet(dev_net(dev));
+       po = get_item(pn, ph->sid, eth_hdr(skb)->h_source, dev->ifindex);
        if (po) {
                struct sock *sk = sk_pppox(po);
 
@@ -471,12 +514,12 @@ out:
 }
 
 static struct packet_type pppoes_ptype = {
-       .type   = __constant_htons(ETH_P_PPP_SES),
+       .type   = cpu_to_be16(ETH_P_PPP_SES),
        .func   = pppoe_rcv,
 };
 
 static struct packet_type pppoed_ptype = {
-       .type   = __constant_htons(ETH_P_PPP_DISC),
+       .type   = cpu_to_be16(ETH_P_PPP_DISC),
        .func   = pppoe_disc_rcv,
 };
 
@@ -493,38 +536,37 @@ static struct proto pppoe_sk_proto = {
  **********************************************************************/
 static int pppoe_create(struct net *net, struct socket *sock)
 {
-       int error = -ENOMEM;
        struct sock *sk;
 
        sk = sk_alloc(net, PF_PPPOX, GFP_KERNEL, &pppoe_sk_proto);
        if (!sk)
-               goto out;
+               return -ENOMEM;
 
        sock_init_data(sock, sk);
 
-       sock->state = SS_UNCONNECTED;
-       sock->ops   = &pppoe_ops;
+       sock->state     = SS_UNCONNECTED;
+       sock->ops       = &pppoe_ops;
 
-       sk->sk_backlog_rcv = pppoe_rcv_core;
-       sk->sk_state       = PPPOX_NONE;
-       sk->sk_type        = SOCK_STREAM;
-       sk->sk_family      = PF_PPPOX;
-       sk->sk_protocol    = PX_PROTO_OE;
+       sk->sk_backlog_rcv      = pppoe_rcv_core;
+       sk->sk_state            = PPPOX_NONE;
+       sk->sk_type             = SOCK_STREAM;
+       sk->sk_family           = PF_PPPOX;
+       sk->sk_protocol         = PX_PROTO_OE;
 
-       error = 0;
-out:   return error;
+       return 0;
 }
 
 static int pppoe_release(struct socket *sock)
 {
        struct sock *sk = sock->sk;
        struct pppox_sock *po;
+       struct pppoe_net *pn;
 
        if (!sk)
                return 0;
 
        lock_sock(sk);
-       if (sock_flag(sk, SOCK_DEAD)){
+       if (sock_flag(sk, SOCK_DEAD)) {
                release_sock(sk);
                return -EBADF;
        }
@@ -534,26 +576,39 @@ static int pppoe_release(struct socket *sock)
        /* Signal the death of the socket. */
        sk->sk_state = PPPOX_DEAD;
 
+       /*
+        * pppoe_flush_dev could lead to a race with
+        * this routine so we use flush_lock to eliminate
+        * such a case (we only need per-net specific data)
+        */
+       spin_lock(&flush_lock);
+       po = pppox_sk(sk);
+       if (!po->pppoe_dev) {
+               spin_unlock(&flush_lock);
+               goto out;
+       }
+       pn = pppoe_pernet(dev_net(po->pppoe_dev));
+       spin_unlock(&flush_lock);
 
-       /* Write lock on hash lock protects the entire "po" struct from
-        * concurrent updates via pppoe_flush_dev. The "po" struct should
-        * be considered part of the hash table contents, thus protected
-        * by the hash table lock */
-       write_lock_bh(&pppoe_hash_lock);
+       /*
+        * protect "po" from concurrent updates
+        * on pppoe_flush_dev
+        */
+       write_lock_bh(&pn->hash_lock);
 
        po = pppox_sk(sk);
-       if (po->pppoe_pa.sid) {
-               __delete_item(po->pppoe_pa.sid,
-                             po->pppoe_pa.remote, po->pppoe_ifindex);
-       }
+       if (stage_session(po->pppoe_pa.sid))
+               __delete_item(pn, po->pppoe_pa.sid, po->pppoe_pa.remote,
+                               po->pppoe_ifindex);
 
        if (po->pppoe_dev) {
                dev_put(po->pppoe_dev);
                po->pppoe_dev = NULL;
        }
 
-       write_unlock_bh(&pppoe_hash_lock);
+       write_unlock_bh(&pn->hash_lock);
 
+out:
        sock_orphan(sk);
        sock->sk = NULL;
 
@@ -564,14 +619,14 @@ static int pppoe_release(struct socket *sock)
        return 0;
 }
 
-
 static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
                  int sockaddr_len, int flags)
 {
        struct sock *sk = sock->sk;
-       struct net_device *dev;
-       struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr;
+       struct sockaddr_pppox *sp = (struct sockaddr_pppox *)uservaddr;
        struct pppox_sock *po = pppox_sk(sk);
+       struct net_device *dev;
+       struct pppoe_net *pn;
        int error;
 
        lock_sock(sk);
@@ -582,44 +637,45 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
 
        /* Check for already bound sockets */
        error = -EBUSY;
-       if ((sk->sk_state & PPPOX_CONNECTED) && sp->sa_addr.pppoe.sid)
+       if ((sk->sk_state & PPPOX_CONNECTED) &&
+            stage_session(sp->sa_addr.pppoe.sid))
                goto end;
 
        /* Check for already disconnected sockets, on attempts to disconnect */
        error = -EALREADY;
-       if ((sk->sk_state & PPPOX_DEAD) && !sp->sa_addr.pppoe.sid )
+       if ((sk->sk_state & PPPOX_DEAD) &&
+            !stage_session(sp->sa_addr.pppoe.sid))
                goto end;
 
        error = 0;
-       if (po->pppoe_pa.sid) {
-               pppox_unbind_sock(sk);
-
-               /* Delete the old binding */
-               delete_item(po->pppoe_pa.sid,po->pppoe_pa.remote,po->pppoe_ifindex);
 
-               if(po->pppoe_dev)
+       /* Delete the old binding */
+       if (stage_session(po->pppoe_pa.sid)) {
+               pppox_unbind_sock(sk);
+               if (po->pppoe_dev) {
+                       pn = pppoe_pernet(dev_net(po->pppoe_dev));
+                       delete_item(pn, po->pppoe_pa.sid,
+                               po->pppoe_pa.remote, po->pppoe_ifindex);
                        dev_put(po->pppoe_dev);
-
+               }
                memset(sk_pppox(po) + 1, 0,
                       sizeof(struct pppox_sock) - sizeof(struct sock));
-
                sk->sk_state = PPPOX_NONE;
        }
 
-       /* Don't re-bind if sid==0 */
-       if (sp->sa_addr.pppoe.sid != 0) {
-               dev = dev_get_by_name(&init_net, sp->sa_addr.pppoe.dev);
-
+       /* Re-bind in session stage only */
+       if (stage_session(sp->sa_addr.pppoe.sid)) {
                error = -ENODEV;
+               dev = dev_get_by_name(sock_net(sk), sp->sa_addr.pppoe.dev);
                if (!dev)
                        goto end;
 
                po->pppoe_dev = dev;
                po->pppoe_ifindex = dev->ifindex;
-
-               write_lock_bh(&pppoe_hash_lock);
-               if (!(dev->flags & IFF_UP)){
-                       write_unlock_bh(&pppoe_hash_lock);
+               pn = pppoe_pernet(dev_net(dev));
+               write_lock_bh(&pn->hash_lock);
+               if (!(dev->flags & IFF_UP)) {
+                       write_unlock_bh(&pn->hash_lock);
                        goto err_put;
                }
 
@@ -627,8 +683,8 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
                       &sp->sa_addr.pppoe,
                       sizeof(struct pppoe_addr));
 
-               error = __set_item(po);
-               write_unlock_bh(&pppoe_hash_lock);
+               error = __set_item(pn, po);
+               write_unlock_bh(&pn->hash_lock);
                if (error < 0)
                        goto err_put;
 
@@ -639,7 +695,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
                po->chan.private = sk;
                po->chan.ops = &pppoe_chan_ops;
 
-               error = ppp_register_channel(&po->chan);
+               error = ppp_register_net_channel(dev_net(dev), &po->chan);
                if (error)
                        goto err_put;
 
@@ -648,7 +704,7 @@ static int pppoe_connect(struct socket *sock, struct sockaddr *uservaddr,
 
        po->num = sp->sa_addr.pppoe.sid;
 
- end:
+end:
        release_sock(sk);
        return error;
 err_put:
@@ -659,7 +715,6 @@ err_put:
        goto end;
 }
 
-
 static int pppoe_getname(struct socket *sock, struct sockaddr *uaddr,
                  int *usockaddr_len, int peer)
 {
@@ -678,7 +733,6 @@ static int pppoe_getname(struct socket *sock, struct sockaddr *uaddr,
        return 0;
 }
 
-
 static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
                unsigned long arg)
 {
@@ -690,7 +744,6 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
        switch (cmd) {
        case PPPIOCGMRU:
                err = -ENXIO;
-
                if (!(sk->sk_state & PPPOX_CONNECTED))
                        break;
 
@@ -698,7 +751,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
                if (put_user(po->pppoe_dev->mtu -
                             sizeof(struct pppoe_hdr) -
                             PPP_HDRLEN,
-                            (int __user *) arg))
+                            (int __user *)arg))
                        break;
                err = 0;
                break;
@@ -709,7 +762,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
                        break;
 
                err = -EFAULT;
-               if (get_user(val,(int __user *) arg))
+               if (get_user(val, (int __user *)arg))
                        break;
 
                if (val < (po->pppoe_dev->mtu
@@ -722,7 +775,7 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
 
        case PPPIOCSFLAGS:
                err = -EFAULT;
-               if (get_user(val, (int __user *) arg))
+               if (get_user(val, (int __user *)arg))
                        break;
                err = 0;
                break;
@@ -749,13 +802,12 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
 
                err = -EINVAL;
                if (po->pppoe_relay.sa_family != AF_PPPOX ||
-                   po->pppoe_relay.sa_protocol!= PX_PROTO_OE)
+                   po->pppoe_relay.sa_protocol != PX_PROTO_OE)
                        break;
 
                /* Check that the socket referenced by the address
                   actually exists. */
-               relay_po = get_item_by_addr(&po->pppoe_relay);
-
+               relay_po = get_item_by_addr(sock_net(sk), &po->pppoe_relay);
                if (!relay_po)
                        break;
 
@@ -781,7 +833,6 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
        return err;
 }
 
-
 static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
                  struct msghdr *m, size_t total_len)
 {
@@ -808,7 +859,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
        dev = po->pppoe_dev;
 
        error = -EMSGSIZE;
-       if (total_len > (dev->mtu + dev->hard_header_len))
+       if (total_len > (dev->mtu + dev->hard_header_len))
                goto end;
 
 
@@ -826,13 +877,12 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
        skb->dev = dev;
 
        skb->priority = sk->sk_priority;
-       skb->protocol = __constant_htons(ETH_P_PPP_SES);
+       skb->protocol = cpu_to_be16(ETH_P_PPP_SES);
 
-       ph = (struct pppoe_hdr *) skb_put(skb, total_len + sizeof(struct pppoe_hdr));
-       start = (char *) &ph->tag[0];
+       ph = (struct pppoe_hdr *)skb_put(skb, total_len + sizeof(struct pppoe_hdr));
+       start = (char *)&ph->tag[0];
 
        error = memcpy_fromiovec(start, m->msg_iov, total_len);
-
        if (error < 0) {
                kfree_skb(skb);
                goto end;
@@ -853,7 +903,6 @@ end:
        return error;
 }
 
-
 /************************************************************************
  *
  * xmit function for internal use.
@@ -888,7 +937,7 @@ static int __pppoe_xmit(struct sock *sk, struct sk_buff *skb)
        ph->sid = po->num;
        ph->length = htons(data_len);
 
-       skb->protocol = __constant_htons(ETH_P_PPP_SES);
+       skb->protocol = cpu_to_be16(ETH_P_PPP_SES);
        skb->dev = dev;
 
        dev_hard_header(skb, dev, ETH_P_PPP_SES,
@@ -903,7 +952,6 @@ abort:
        return 1;
 }
 
-
 /************************************************************************
  *
  * xmit function called by generic PPP driver
@@ -912,11 +960,10 @@ abort:
  ***********************************************************************/
 static int pppoe_xmit(struct ppp_channel *chan, struct sk_buff *skb)
 {
-       struct sock *sk = (struct sock *) chan->private;
+       struct sock *sk = (struct sock *)chan->private;
        return __pppoe_xmit(sk, skb);
 }
 
-
 static struct ppp_channel_ops pppoe_chan_ops = {
        .start_xmit = pppoe_xmit,
 };
@@ -935,7 +982,6 @@ static int pppoe_recvmsg(struct kiocb *iocb, struct socket *sock,
 
        skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT,
                                flags & MSG_DONTWAIT, &error);
-
        if (error < 0)
                goto end;
 
@@ -968,44 +1014,47 @@ static int pppoe_seq_show(struct seq_file *seq, void *v)
        dev_name = po->pppoe_pa.dev;
 
        seq_printf(seq, "%08X %pM %8s\n",
-                  po->pppoe_pa.sid, po->pppoe_pa.remote, dev_name);
+               po->pppoe_pa.sid, po->pppoe_pa.remote, dev_name);
 out:
        return 0;
 }
 
-static __inline__ struct pppox_sock *pppoe_get_idx(loff_t pos)
+static inline struct pppox_sock *pppoe_get_idx(struct pppoe_net *pn, loff_t pos)
 {
        struct pppox_sock *po;
-       int i = 0;
+       int i;
 
-       for (; i < PPPOE_HASH_SIZE; i++) {
-               po = item_hash_table[i];
+       for (i = 0; i < PPPOE_HASH_SIZE; i++) {
+               po = pn->hash_table[i];
                while (po) {
                        if (!pos--)
                                goto out;
                        po = po->next;
                }
        }
+
 out:
        return po;
 }
 
 static void *pppoe_seq_start(struct seq_file *seq, loff_t *pos)
-       __acquires(pppoe_hash_lock)
+       __acquires(pn->hash_lock)
 {
+       struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
        loff_t l = *pos;
 
-       read_lock_bh(&pppoe_hash_lock);
-       return l ? pppoe_get_idx(--l) : SEQ_START_TOKEN;
+       read_lock_bh(&pn->hash_lock);
+       return l ? pppoe_get_idx(pn, --l) : SEQ_START_TOKEN;
 }
 
 static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
+       struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
        struct pppox_sock *po;
 
        ++*pos;
        if (v == SEQ_START_TOKEN) {
-               po = pppoe_get_idx(0);
+               po = pppoe_get_idx(pn, 0);
                goto out;
        }
        po = v;
@@ -1015,22 +1064,24 @@ static void *pppoe_seq_next(struct seq_file *seq, void *v, loff_t *pos)
                int hash = hash_item(po->pppoe_pa.sid, po->pppoe_pa.remote);
 
                while (++hash < PPPOE_HASH_SIZE) {
-                       po = item_hash_table[hash];
+                       po = pn->hash_table[hash];
                        if (po)
                                break;
                }
        }
+
 out:
        return po;
 }
 
 static void pppoe_seq_stop(struct seq_file *seq, void *v)
-       __releases(pppoe_hash_lock)
+       __releases(pn->hash_lock)
 {
-       read_unlock_bh(&pppoe_hash_lock);
+       struct pppoe_net *pn = pppoe_pernet(seq_file_net(seq));
+       read_unlock_bh(&pn->hash_lock);
 }
 
-static struct seq_operations pppoe_seq_ops = {
+static const struct seq_operations pppoe_seq_ops = {
        .start          = pppoe_seq_start,
        .next           = pppoe_seq_next,
        .stop           = pppoe_seq_stop,
@@ -1039,7 +1090,8 @@ static struct seq_operations pppoe_seq_ops = {
 
 static int pppoe_seq_open(struct inode *inode, struct file *file)
 {
-       return seq_open(file, &pppoe_seq_ops);
+       return seq_open_net(inode, file, &pppoe_seq_ops,
+                       sizeof(struct seq_net_private));
 }
 
 static const struct file_operations pppoe_seq_fops = {
@@ -1047,74 +1099,115 @@ static const struct file_operations pppoe_seq_fops = {
        .open           = pppoe_seq_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = seq_release_net,
 };
 
-static int __init pppoe_proc_init(void)
-{
-       struct proc_dir_entry *p;
-
-       p = proc_net_fops_create(&init_net, "pppoe", S_IRUGO, &pppoe_seq_fops);
-       if (!p)
-               return -ENOMEM;
-       return 0;
-}
-#else /* CONFIG_PROC_FS */
-static inline int pppoe_proc_init(void) { return 0; }
 #endif /* CONFIG_PROC_FS */
 
 static const struct proto_ops pppoe_ops = {
-    .family            = AF_PPPOX,
-    .owner             = THIS_MODULE,
-    .release           = pppoe_release,
-    .bind              = sock_no_bind,
-    .connect           = pppoe_connect,
-    .socketpair                = sock_no_socketpair,
-    .accept            = sock_no_accept,
-    .getname           = pppoe_getname,
-    .poll              = datagram_poll,
-    .listen            = sock_no_listen,
-    .shutdown          = sock_no_shutdown,
-    .setsockopt                = sock_no_setsockopt,
-    .getsockopt                = sock_no_getsockopt,
-    .sendmsg           = pppoe_sendmsg,
-    .recvmsg           = pppoe_recvmsg,
-    .mmap              = sock_no_mmap,
-    .ioctl             = pppox_ioctl,
+       .family         = AF_PPPOX,
+       .owner          = THIS_MODULE,
+       .release        = pppoe_release,
+       .bind           = sock_no_bind,
+       .connect        = pppoe_connect,
+       .socketpair     = sock_no_socketpair,
+       .accept         = sock_no_accept,
+       .getname        = pppoe_getname,
+       .poll           = datagram_poll,
+       .listen         = sock_no_listen,
+       .shutdown       = sock_no_shutdown,
+       .setsockopt     = sock_no_setsockopt,
+       .getsockopt     = sock_no_getsockopt,
+       .sendmsg        = pppoe_sendmsg,
+       .recvmsg        = pppoe_recvmsg,
+       .mmap           = sock_no_mmap,
+       .ioctl          = pppox_ioctl,
 };
 
 static struct pppox_proto pppoe_proto = {
-    .create    = pppoe_create,
-    .ioctl     = pppoe_ioctl,
-    .owner     = THIS_MODULE,
+       .create = pppoe_create,
+       .ioctl  = pppoe_ioctl,
+       .owner  = THIS_MODULE,
 };
 
+static __net_init int pppoe_init_net(struct net *net)
+{
+       struct pppoe_net *pn;
+       struct proc_dir_entry *pde;
+       int err;
+
+       pn = kzalloc(sizeof(*pn), GFP_KERNEL);
+       if (!pn)
+               return -ENOMEM;
+
+       rwlock_init(&pn->hash_lock);
+
+       err = net_assign_generic(net, pppoe_net_id, pn);
+       if (err)
+               goto out;
+
+       pde = proc_net_fops_create(net, "pppoe", S_IRUGO, &pppoe_seq_fops);
+#ifdef CONFIG_PROC_FS
+       if (!pde) {
+               err = -ENOMEM;
+               goto out;
+       }
+#endif
+
+       return 0;
+
+out:
+       kfree(pn);
+       return err;
+}
+
+static __net_exit void pppoe_exit_net(struct net *net)
+{
+       struct pppoe_net *pn;
+
+       proc_net_remove(net, "pppoe");
+       pn = net_generic(net, pppoe_net_id);
+       /*
+        * if someone has cached our net then
+        * further net_generic call will return NULL
+        */
+       net_assign_generic(net, pppoe_net_id, NULL);
+       kfree(pn);
+}
+
+static struct pernet_operations pppoe_net_ops = {
+       .init = pppoe_init_net,
+       .exit = pppoe_exit_net,
+};
 
 static int __init pppoe_init(void)
 {
-       int err = proto_register(&pppoe_sk_proto, 0);
+       int err;
 
+       err = proto_register(&pppoe_sk_proto, 0);
        if (err)
                goto out;
 
-       err = register_pppox_proto(PX_PROTO_OE, &pppoe_proto);
+       err = register_pppox_proto(PX_PROTO_OE, &pppoe_proto);
        if (err)
                goto out_unregister_pppoe_proto;
 
-       err = pppoe_proc_init();
+       err = register_pernet_gen_device(&pppoe_net_id, &pppoe_net_ops);
        if (err)
                goto out_unregister_pppox_proto;
 
        dev_add_pack(&pppoes_ptype);
        dev_add_pack(&pppoed_ptype);
        register_netdevice_notifier(&pppoe_notifier);
-out:
-       return err;
+
+       return 0;
+
 out_unregister_pppox_proto:
        unregister_pppox_proto(PX_PROTO_OE);
 out_unregister_pppoe_proto:
        proto_unregister(&pppoe_sk_proto);
-       goto out;
+out:
+       return err;
 }
 
 static void __exit pppoe_exit(void)
@@ -1123,7 +1216,7 @@ static void __exit pppoe_exit(void)
        dev_remove_pack(&pppoes_ptype);
        dev_remove_pack(&pppoed_ptype);
        unregister_netdevice_notifier(&pppoe_notifier);
-       remove_proc_entry("pppoe", init_net.proc_net);
+       unregister_pernet_gen_device(pppoe_net_id, &pppoe_net_ops);
        proto_unregister(&pppoe_sk_proto);
 }
 
index f1a946785c6aee3bf580ad6015d9b825318c6566..5b07dd8e5c04e6b274e303b837c8243b31ba47dc 100644 (file)
@@ -90,7 +90,9 @@
 #include <linux/hash.h>
 #include <linux/sort.h>
 #include <linux/proc_fs.h>
+#include <linux/nsproxy.h>
 #include <net/net_namespace.h>
+#include <net/netns/generic.h>
 #include <net/dst.h>
 #include <net/ip.h>
 #include <net/udp.h>
@@ -204,6 +206,7 @@ struct pppol2tp_tunnel
        struct sock             *sock;          /* Parent socket */
        struct list_head        list;           /* Keep a list of all open
                                                 * prepared sockets */
+       struct net              *pppol2tp_net;  /* the net we belong to */
 
        atomic_t                ref_count;
 };
@@ -227,8 +230,20 @@ static atomic_t pppol2tp_tunnel_count;
 static atomic_t pppol2tp_session_count;
 static struct ppp_channel_ops pppol2tp_chan_ops = { pppol2tp_xmit , NULL };
 static struct proto_ops pppol2tp_ops;
-static LIST_HEAD(pppol2tp_tunnel_list);
-static DEFINE_RWLOCK(pppol2tp_tunnel_list_lock);
+
+/* per-net private data for this module */
+static int pppol2tp_net_id;
+struct pppol2tp_net {
+       struct list_head pppol2tp_tunnel_list;
+       rwlock_t pppol2tp_tunnel_list_lock;
+};
+
+static inline struct pppol2tp_net *pppol2tp_pernet(struct net *net)
+{
+       BUG_ON(!net);
+
+       return net_generic(net, pppol2tp_net_id);
+}
 
 /* Helpers to obtain tunnel/session contexts from sockets.
  */
@@ -321,18 +336,19 @@ pppol2tp_session_find(struct pppol2tp_tunnel *tunnel, u16 session_id)
 
 /* Lookup a tunnel by id
  */
-static struct pppol2tp_tunnel *pppol2tp_tunnel_find(u16 tunnel_id)
+static struct pppol2tp_tunnel *pppol2tp_tunnel_find(struct net *net, u16 tunnel_id)
 {
-       struct pppol2tp_tunnel *tunnel = NULL;
+       struct pppol2tp_tunnel *tunnel;
+       struct pppol2tp_net *pn = pppol2tp_pernet(net);
 
-       read_lock_bh(&pppol2tp_tunnel_list_lock);
-       list_for_each_entry(tunnel, &pppol2tp_tunnel_list, list) {
+       read_lock_bh(&pn->pppol2tp_tunnel_list_lock);
+       list_for_each_entry(tunnel, &pn->pppol2tp_tunnel_list, list) {
                if (tunnel->stats.tunnel_id == tunnel_id) {
-                       read_unlock_bh(&pppol2tp_tunnel_list_lock);
+                       read_unlock_bh(&pn->pppol2tp_tunnel_list_lock);
                        return tunnel;
                }
        }
-       read_unlock_bh(&pppol2tp_tunnel_list_lock);
+       read_unlock_bh(&pn->pppol2tp_tunnel_list_lock);
 
        return NULL;
 }
@@ -1287,10 +1303,12 @@ again:
  */
 static void pppol2tp_tunnel_free(struct pppol2tp_tunnel *tunnel)
 {
+       struct pppol2tp_net *pn = pppol2tp_pernet(tunnel->pppol2tp_net);
+
        /* Remove from socket list */
-       write_lock_bh(&pppol2tp_tunnel_list_lock);
+       write_lock_bh(&pn->pppol2tp_tunnel_list_lock);
        list_del_init(&tunnel->list);
-       write_unlock_bh(&pppol2tp_tunnel_list_lock);
+       write_unlock_bh(&pn->pppol2tp_tunnel_list_lock);
 
        atomic_dec(&pppol2tp_tunnel_count);
        kfree(tunnel);
@@ -1444,13 +1462,14 @@ error:
 /* Internal function to prepare a tunnel (UDP) socket to have PPPoX
  * sockets attached to it.
  */
-static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id,
-                                                  int *error)
+static struct sock *pppol2tp_prepare_tunnel_socket(struct net *net,
+                                       int fd, u16 tunnel_id, int *error)
 {
        int err;
        struct socket *sock = NULL;
        struct sock *sk;
        struct pppol2tp_tunnel *tunnel;
+       struct pppol2tp_net *pn;
        struct sock *ret = NULL;
 
        /* Get the tunnel UDP socket from the fd, which was opened by
@@ -1524,11 +1543,15 @@ static struct sock *pppol2tp_prepare_tunnel_socket(int fd, u16 tunnel_id,
        /* Misc init */
        rwlock_init(&tunnel->hlist_lock);
 
+       /* The net we belong to */
+       tunnel->pppol2tp_net = net;
+       pn = pppol2tp_pernet(net);
+
        /* Add tunnel to our list */
        INIT_LIST_HEAD(&tunnel->list);
-       write_lock_bh(&pppol2tp_tunnel_list_lock);
-       list_add(&tunnel->list, &pppol2tp_tunnel_list);
-       write_unlock_bh(&pppol2tp_tunnel_list_lock);
+       write_lock_bh(&pn->pppol2tp_tunnel_list_lock);
+       list_add(&tunnel->list, &pn->pppol2tp_tunnel_list);
+       write_unlock_bh(&pn->pppol2tp_tunnel_list_lock);
        atomic_inc(&pppol2tp_tunnel_count);
 
        /* Bump the reference count. The tunnel context is deleted
@@ -1629,7 +1652,8 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
         * tunnel id.
         */
        if ((sp->pppol2tp.s_session == 0) && (sp->pppol2tp.d_session == 0)) {
-               tunnel_sock = pppol2tp_prepare_tunnel_socket(sp->pppol2tp.fd,
+               tunnel_sock = pppol2tp_prepare_tunnel_socket(sock_net(sk),
+                                                            sp->pppol2tp.fd,
                                                             sp->pppol2tp.s_tunnel,
                                                             &error);
                if (tunnel_sock == NULL)
@@ -1637,7 +1661,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
 
                tunnel = tunnel_sock->sk_user_data;
        } else {
-               tunnel = pppol2tp_tunnel_find(sp->pppol2tp.s_tunnel);
+               tunnel = pppol2tp_tunnel_find(sock_net(sk), sp->pppol2tp.s_tunnel);
 
                /* Error if we can't find the tunnel */
                error = -ENOENT;
@@ -1725,7 +1749,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
        po->chan.ops     = &pppol2tp_chan_ops;
        po->chan.mtu     = session->mtu;
 
-       error = ppp_register_channel(&po->chan);
+       error = ppp_register_net_channel(sock_net(sk), &po->chan);
        if (error)
                goto end_put_tun;
 
@@ -2347,8 +2371,9 @@ end:
 #include <linux/seq_file.h>
 
 struct pppol2tp_seq_data {
-       struct pppol2tp_tunnel *tunnel; /* current tunnel */
-       struct pppol2tp_session *session; /* NULL means get first session in tunnel */
+       struct seq_net_private p;
+       struct pppol2tp_tunnel *tunnel;         /* current tunnel */
+       struct pppol2tp_session *session;       /* NULL means get first session in tunnel */
 };
 
 static struct pppol2tp_session *next_session(struct pppol2tp_tunnel *tunnel, struct pppol2tp_session *curr)
@@ -2384,17 +2409,18 @@ out:
        return session;
 }
 
-static struct pppol2tp_tunnel *next_tunnel(struct pppol2tp_tunnel *curr)
+static struct pppol2tp_tunnel *next_tunnel(struct pppol2tp_net *pn,
+                                          struct pppol2tp_tunnel *curr)
 {
        struct pppol2tp_tunnel *tunnel = NULL;
 
-       read_lock_bh(&pppol2tp_tunnel_list_lock);
-       if (list_is_last(&curr->list, &pppol2tp_tunnel_list)) {
+       read_lock_bh(&pn->pppol2tp_tunnel_list_lock);
+       if (list_is_last(&curr->list, &pn->pppol2tp_tunnel_list)) {
                goto out;
        }
        tunnel = list_entry(curr->list.next, struct pppol2tp_tunnel, list);
 out:
-       read_unlock_bh(&pppol2tp_tunnel_list_lock);
+       read_unlock_bh(&pn->pppol2tp_tunnel_list_lock);
 
        return tunnel;
 }
@@ -2402,6 +2428,7 @@ out:
 static void *pppol2tp_seq_start(struct seq_file *m, loff_t *offs)
 {
        struct pppol2tp_seq_data *pd = SEQ_START_TOKEN;
+       struct pppol2tp_net *pn;
        loff_t pos = *offs;
 
        if (!pos)
@@ -2409,14 +2436,15 @@ static void *pppol2tp_seq_start(struct seq_file *m, loff_t *offs)
 
        BUG_ON(m->private == NULL);
        pd = m->private;
+       pn = pppol2tp_pernet(seq_file_net(m));
 
        if (pd->tunnel == NULL) {
-               if (!list_empty(&pppol2tp_tunnel_list))
-                       pd->tunnel = list_entry(pppol2tp_tunnel_list.next, struct pppol2tp_tunnel, list);
+               if (!list_empty(&pn->pppol2tp_tunnel_list))
+                       pd->tunnel = list_entry(pn->pppol2tp_tunnel_list.next, struct pppol2tp_tunnel, list);
        } else {
                pd->session = next_session(pd->tunnel, pd->session);
                if (pd->session == NULL) {
-                       pd->tunnel = next_tunnel(pd->tunnel);
+                       pd->tunnel = next_tunnel(pn, pd->tunnel);
                }
        }
 
@@ -2517,7 +2545,7 @@ out:
        return 0;
 }
 
-static struct seq_operations pppol2tp_seq_ops = {
+static const struct seq_operations pppol2tp_seq_ops = {
        .start          = pppol2tp_seq_start,
        .next           = pppol2tp_seq_next,
        .stop           = pppol2tp_seq_stop,
@@ -2530,51 +2558,18 @@ static struct seq_operations pppol2tp_seq_ops = {
  */
 static int pppol2tp_proc_open(struct inode *inode, struct file *file)
 {
-       struct seq_file *m;
-       struct pppol2tp_seq_data *pd;
-       int ret = 0;
-
-       ret = seq_open(file, &pppol2tp_seq_ops);
-       if (ret < 0)
-               goto out;
-
-       m = file->private_data;
-
-       /* Allocate and fill our proc_data for access later */
-       ret = -ENOMEM;
-       m->private = kzalloc(sizeof(struct pppol2tp_seq_data), GFP_KERNEL);
-       if (m->private == NULL)
-               goto out;
-
-       pd = m->private;
-       ret = 0;
-
-out:
-       return ret;
-}
-
-/* Called when /proc file access completes.
- */
-static int pppol2tp_proc_release(struct inode *inode, struct file *file)
-{
-       struct seq_file *m = (struct seq_file *)file->private_data;
-
-       kfree(m->private);
-       m->private = NULL;
-
-       return seq_release(inode, file);
+       return seq_open_net(inode, file, &pppol2tp_seq_ops,
+                           sizeof(struct pppol2tp_seq_data));
 }
 
-static struct file_operations pppol2tp_proc_fops = {
+static const struct file_operations pppol2tp_proc_fops = {
        .owner          = THIS_MODULE,
        .open           = pppol2tp_proc_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = pppol2tp_proc_release,
+       .release        = seq_release_net,
 };
 
-static struct proc_dir_entry *pppol2tp_proc;
-
 #endif /* CONFIG_PROC_FS */
 
 /*****************************************************************************
@@ -2606,6 +2601,57 @@ static struct pppox_proto pppol2tp_proto = {
        .ioctl          = pppol2tp_ioctl
 };
 
+static __net_init int pppol2tp_init_net(struct net *net)
+{
+       struct pppol2tp_net *pn;
+       struct proc_dir_entry *pde;
+       int err;
+
+       pn = kzalloc(sizeof(*pn), GFP_KERNEL);
+       if (!pn)
+               return -ENOMEM;
+
+       INIT_LIST_HEAD(&pn->pppol2tp_tunnel_list);
+       rwlock_init(&pn->pppol2tp_tunnel_list_lock);
+
+       err = net_assign_generic(net, pppol2tp_net_id, pn);
+       if (err)
+               goto out;
+
+       pde = proc_net_fops_create(net, "pppol2tp", S_IRUGO, &pppol2tp_proc_fops);
+#ifdef CONFIG_PROC_FS
+       if (!pde) {
+               err = -ENOMEM;
+               goto out;
+       }
+#endif
+
+       return 0;
+
+out:
+       kfree(pn);
+       return err;
+}
+
+static __net_exit void pppol2tp_exit_net(struct net *net)
+{
+       struct pppoe_net *pn;
+
+       proc_net_remove(net, "pppol2tp");
+       pn = net_generic(net, pppol2tp_net_id);
+       /*
+        * if someone has cached our net then
+        * further net_generic call will return NULL
+        */
+       net_assign_generic(net, pppol2tp_net_id, NULL);
+       kfree(pn);
+}
+
+static struct pernet_operations pppol2tp_net_ops = {
+       .init = pppol2tp_init_net,
+       .exit = pppol2tp_exit_net,
+};
+
 static int __init pppol2tp_init(void)
 {
        int err;
@@ -2617,23 +2663,17 @@ static int __init pppol2tp_init(void)
        if (err)
                goto out_unregister_pppol2tp_proto;
 
-#ifdef CONFIG_PROC_FS
-       pppol2tp_proc = proc_net_fops_create(&init_net, "pppol2tp", 0,
-                                            &pppol2tp_proc_fops);
-       if (!pppol2tp_proc) {
-               err = -ENOMEM;
+       err = register_pernet_gen_device(&pppol2tp_net_id, &pppol2tp_net_ops);
+       if (err)
                goto out_unregister_pppox_proto;
-       }
-#endif /* CONFIG_PROC_FS */
+
        printk(KERN_INFO "PPPoL2TP kernel driver, %s\n",
               PPPOL2TP_DRV_VERSION);
 
 out:
        return err;
-#ifdef CONFIG_PROC_FS
 out_unregister_pppox_proto:
        unregister_pppox_proto(PX_PROTO_OL2TP);
-#endif
 out_unregister_pppol2tp_proto:
        proto_unregister(&pppol2tp_sk_proto);
        goto out;
@@ -2642,10 +2682,6 @@ out_unregister_pppol2tp_proto:
 static void __exit pppol2tp_exit(void)
 {
        unregister_pppox_proto(PX_PROTO_OL2TP);
-
-#ifdef CONFIG_PROC_FS
-       remove_proc_entry("pppol2tp", init_net.proc_net);
-#endif
        proto_unregister(&pppol2tp_sk_proto);
 }
 
index 03aecc97fb453d32eefb596dddba3f6286d909df..4f6d33fbc673ccb45a95cc56ebe915b712d3b07e 100644 (file)
@@ -108,9 +108,6 @@ static int pppox_create(struct net *net, struct socket *sock, int protocol)
 {
        int rc = -EPROTOTYPE;
 
-       if (net != &init_net)
-               return -EAFNOSUPPORT;
-
        if (protocol < 0 || protocol > PX_MAX_PROTO)
                goto out;
 
index 4b564eda5bd932ef67f8b850c4b947761da31628..30900b30d532e9dedf2b040a672d47d0921e6203 100644 (file)
@@ -745,7 +745,7 @@ static inline struct sk_buff *gelic_put_vlan_tag(struct sk_buff *skb,
        /* Move the mac addresses to the top of buffer */
        memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN);
 
-       veth->h_vlan_proto = __constant_htons(ETH_P_8021Q);
+       veth->h_vlan_proto = cpu_to_be16(ETH_P_8021Q);
        veth->h_vlan_TCI = htons(tag);
 
        return skb;
@@ -1403,6 +1403,19 @@ void gelic_net_tx_timeout(struct net_device *netdev)
                atomic_dec(&card->tx_timeout_task_counter);
 }
 
+static const struct net_device_ops gelic_netdevice_ops = {
+       .ndo_open = gelic_net_open,
+       .ndo_stop = gelic_net_stop,
+       .ndo_start_xmit = gelic_net_xmit,
+       .ndo_set_multicast_list = gelic_net_set_multi,
+       .ndo_change_mtu = gelic_net_change_mtu,
+       .ndo_tx_timeout = gelic_net_tx_timeout,
+       .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller = gelic_net_poll_controller,
+#endif
+};
+
 /**
  * gelic_ether_setup_netdev_ops - initialization of net_device operations
  * @netdev: net_device structure
@@ -1412,21 +1425,12 @@ void gelic_net_tx_timeout(struct net_device *netdev)
 static void gelic_ether_setup_netdev_ops(struct net_device *netdev,
                                         struct napi_struct *napi)
 {
-       netdev->open = &gelic_net_open;
-       netdev->stop = &gelic_net_stop;
-       netdev->hard_start_xmit = &gelic_net_xmit;
-       netdev->set_multicast_list = &gelic_net_set_multi;
-       netdev->change_mtu = &gelic_net_change_mtu;
-       /* tx watchdog */
-       netdev->tx_timeout = &gelic_net_tx_timeout;
        netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT;
        /* NAPI */
        netif_napi_add(netdev, napi,
                       gelic_net_poll, GELIC_NET_NAPI_WEIGHT);
        netdev->ethtool_ops = &gelic_ether_ethtool_ops;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       netdev->poll_controller = gelic_net_poll_controller;
-#endif
+       netdev->netdev_ops = &gelic_netdevice_ops;
 }
 
 /**
index 335da4831ab3ecfa5d142d572e6374a5b63f1800..a5ac2bd58b5ba0c3113e602a992341bee52d867d 100644 (file)
@@ -2697,6 +2697,19 @@ static int gelic_wl_stop(struct net_device *netdev)
 
 /* -- */
 
+static const struct net_device_ops gelic_wl_netdevice_ops = {
+       .ndo_open = gelic_wl_open,
+       .ndo_stop = gelic_wl_stop,
+       .ndo_start_xmit = gelic_net_xmit,
+       .ndo_set_multicast_list = gelic_net_set_multi,
+       .ndo_change_mtu = gelic_net_change_mtu,
+       .ndo_tx_timeout = gelic_net_tx_timeout,
+       .ndo_validate_addr = eth_validate_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller = gelic_net_poll_controller,
+#endif
+};
+
 static struct ethtool_ops gelic_wl_ethtool_ops = {
        .get_drvinfo    = gelic_net_get_drvinfo,
        .get_link       = gelic_wl_get_link,
@@ -2711,21 +2724,12 @@ static void gelic_wl_setup_netdev_ops(struct net_device *netdev)
        struct gelic_wl_info *wl;
        wl = port_wl(netdev_priv(netdev));
        BUG_ON(!wl);
-       netdev->open = &gelic_wl_open;
-       netdev->stop = &gelic_wl_stop;
-       netdev->hard_start_xmit = &gelic_net_xmit;
-       netdev->set_multicast_list = &gelic_net_set_multi;
-       netdev->change_mtu = &gelic_net_change_mtu;
-       netdev->wireless_data = &wl->wireless_data;
-       netdev->wireless_handlers = &gelic_wl_wext_handler_def;
-       /* tx watchdog */
-       netdev->tx_timeout = &gelic_net_tx_timeout;
        netdev->watchdog_timeo = GELIC_NET_WATCHDOG_TIMEOUT;
 
        netdev->ethtool_ops = &gelic_wl_ethtool_ops;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       netdev->poll_controller = gelic_net_poll_controller;
-#endif
+       netdev->netdev_ops = &gelic_wl_netdevice_ops;
+       netdev->wireless_data = &wl->wireless_data;
+       netdev->wireless_handlers = &gelic_wl_wext_handler_def;
 }
 
 /*
index 189ec29ac7a40678787ed8eb3706257268a28e6f..8b2823c8dccfafaf97b3b8c9f698cb25386d34c4 100644 (file)
@@ -2292,7 +2292,7 @@ static int ql_poll(struct napi_struct *napi, int budget)
 
        if (tx_cleaned + rx_cleaned != budget) {
                spin_lock_irqsave(&qdev->hw_lock, hw_flags);
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
                ql_update_small_bufq_prod_index(qdev);
                ql_update_lrg_bufq_prod_index(qdev);
                writel(qdev->rsp_consumer_index,
@@ -2351,8 +2351,8 @@ static irqreturn_t ql3xxx_isr(int irq, void *dev_id)
                spin_unlock(&qdev->adapter_lock);
        } else if (value & ISP_IMR_DISABLE_CMPL_INT) {
                ql_disable_interrupts(qdev);
-               if (likely(netif_rx_schedule_prep(&qdev->napi))) {
-                       __netif_rx_schedule(&qdev->napi);
+               if (likely(napi_schedule_prep(&qdev->napi))) {
+                       __napi_schedule(&qdev->napi);
                }
        } else {
                return IRQ_NONE;
index 8ea72dc60f79f96276659da86ad5c6a9228f30d3..fd515afb1aa5421ba6764fded89d2c7769d8399e 100644 (file)
@@ -1452,6 +1452,7 @@ static void ql_process_mac_rx_intr(struct ql_adapter *qdev,
        qdev->stats.rx_packets++;
        qdev->stats.rx_bytes += skb->len;
        skb->protocol = eth_type_trans(skb, ndev);
+       skb_record_rx_queue(skb, rx_ring - &qdev->rx_ring[0]);
        if (qdev->vlgrp && (ib_mac_rsp->flags2 & IB_MAC_IOCB_RSP_V)) {
                QPRINTK(qdev, RX_STATUS, DEBUG,
                        "Passing a VLAN packet upstream.\n");
@@ -1663,7 +1664,7 @@ static int ql_napi_poll_msix(struct napi_struct *napi, int budget)
                rx_ring->cq_id);
 
        if (work_done < budget) {
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
                ql_enable_completion_interrupt(qdev, rx_ring->irq);
        }
        return work_done;
@@ -1748,7 +1749,7 @@ static irqreturn_t qlge_msix_tx_isr(int irq, void *dev_id)
 static irqreturn_t qlge_msix_rx_isr(int irq, void *dev_id)
 {
        struct rx_ring *rx_ring = dev_id;
-       netif_rx_schedule(&rx_ring->napi);
+       napi_schedule(&rx_ring->napi);
        return IRQ_HANDLED;
 }
 
@@ -1834,7 +1835,7 @@ static irqreturn_t qlge_isr(int irq, void *dev_id)
                                                              &rx_ring->rx_work,
                                                              0);
                                else
-                                       netif_rx_schedule(&rx_ring->napi);
+                                       napi_schedule(&rx_ring->napi);
                                work_done++;
                        }
                }
index b2dcdb5ed8bde1b3ca424ad17fb310c4b5a2ba5e..9c95ebe643a329f129538f352d3fe97adc8ada38 100644 (file)
@@ -484,12 +484,12 @@ static int r6040_close(struct net_device *dev)
        /* Free Descriptor memory */
        if (lp->rx_ring) {
                pci_free_consistent(pdev, RX_DESC_SIZE, lp->rx_ring, lp->rx_ring_dma);
-               lp->rx_ring = 0;
+               lp->rx_ring = NULL;
        }
 
        if (lp->tx_ring) {
                pci_free_consistent(pdev, TX_DESC_SIZE, lp->tx_ring, lp->tx_ring_dma);
-               lp->tx_ring = 0;
+               lp->tx_ring = NULL;
        }
 
        return 0;
@@ -676,7 +676,7 @@ static int r6040_poll(struct napi_struct *napi, int budget)
        work_done = r6040_rx(dev, budget);
 
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                /* Enable RX interrupt */
                iowrite16(ioread16(ioaddr + MIER) | RX_INTS, ioaddr + MIER);
        }
@@ -713,7 +713,7 @@ static irqreturn_t r6040_interrupt(int irq, void *dev_id)
 
                /* Mask off RX interrupt */
                misr &= ~RX_INTS;
-               netif_rx_schedule(&lp->napi);
+               napi_schedule(&lp->napi);
        }
 
        /* TX interrupt request */
index 0771eb6fc6eb452cbf9e0a06793b9f7d0ba32e4d..dd83f936b03644d9f27560570219cb337e944ddb 100644 (file)
@@ -3601,8 +3601,8 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
                RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
                tp->intr_mask = ~tp->napi_event;
 
-               if (likely(netif_rx_schedule_prep(&tp->napi)))
-                       __netif_rx_schedule(&tp->napi);
+               if (likely(napi_schedule_prep(&tp->napi)))
+                       __napi_schedule(&tp->napi);
                else if (netif_msg_intr(tp)) {
                        printk(KERN_INFO "%s: interrupt %04x in poll\n",
                               dev->name, status);
@@ -3623,7 +3623,7 @@ static int rtl8169_poll(struct napi_struct *napi, int budget)
        rtl8169_tx_interrupt(dev, tp, ioaddr);
 
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                tp->intr_mask = 0xffff;
                /*
                 * 20040426: the barrier is not strictly required but the
index f5c57c059bca15c7d9e35f0b26c39fb0551bc718..16868b7a5d0aad2146b203200298d945947a631d 100644 (file)
@@ -2852,7 +2852,7 @@ static int s2io_poll_msix(struct napi_struct *napi, int budget)
        s2io_chk_rx_buffers(nic, ring);
 
        if (pkts_processed < budget_org) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                /*Re Enable MSI-Rx Vector*/
                addr = (u8 __iomem *)&bar0->xmsi_mask_reg;
                addr += 7 - ring->ring_no;
@@ -2889,7 +2889,7 @@ static int s2io_poll_inta(struct napi_struct *napi, int budget)
                        break;
        }
        if (pkts_processed < budget_org) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                /* Re enable the Rx interrupts for the ring */
                writeq(0, &bar0->rx_traffic_mask);
                readl(&bar0->rx_traffic_mask);
@@ -3862,7 +3862,7 @@ static int s2io_enable_msi_x(struct s2io_nic *nic)
        ret = pci_enable_msix(nic->pdev, nic->entries, nic->num_entries);
        /* We fail init if error or we get less vectors than min required */
        if (ret) {
-               DBG_PRINT(ERR_DBG, "%s: Enabling MSIX failed\n", nic->dev->name);
+               DBG_PRINT(ERR_DBG, "s2io: Enabling MSI-X failed\n");
                kfree(nic->entries);
                nic->mac_control.stats_info->sw_stat.mem_freed
                        += (nic->num_entries * sizeof(struct msix_entry));
@@ -4342,7 +4342,7 @@ static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id)
                val8 = (ring->ring_no == 0) ? 0x7f : 0xff;
                writeb(val8, addr);
                val8 = readb(addr);
-               netif_rx_schedule(&ring->napi);
+               napi_schedule(&ring->napi);
        } else {
                rx_intr_handler(ring, 0);
                s2io_chk_rx_buffers(sp, ring);
@@ -4789,7 +4789,7 @@ static irqreturn_t s2io_isr(int irq, void *dev_id)
 
                if (config->napi) {
                        if (reason & GEN_INTR_RXTRAFFIC) {
-                               netif_rx_schedule(&sp->napi);
+                               napi_schedule(&sp->napi);
                                writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_mask);
                                writeq(S2IO_MINUS_ONE, &bar0->rx_traffic_int);
                                readl(&bar0->rx_traffic_int);
@@ -7220,7 +7220,6 @@ static int s2io_card_up(struct s2io_nic * sp)
 
        /* Initialise napi */
        if (config->napi) {
-               int i;
                if (config->intr_type ==  MSI_X) {
                        for (i = 0; i < sp->config.rx_ring_num; i++)
                                napi_enable(&sp->mac_control.rings[i].napi);
@@ -7542,6 +7541,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
 
        sp->mac_control.stats_info->sw_stat.mem_freed += skb->truesize;
 send_up:
+       skb_record_rx_queue(skb, ring_no);
        queue_rx_frame(skb, RXD_GET_VLAN_TAG(rxdp->Control_2));
 aggregate:
        sp->mac_control.rings[ring_no].rx_bufs_left -= 1;
@@ -8009,8 +8009,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                if (ret) {
 
                        DBG_PRINT(ERR_DBG,
-                         "%s: MSI-X requested but failed to enable\n",
-                         dev->name);
+                         "s2io: MSI-X requested but failed to enable\n");
                        sp->config.intr_type = INTA;
                }
        }
index 31e38fae017f8def7273d568089914599a1b54d6..88dd2e09832f2875eba2ff0eebbe9f3e2abbb83b 100644 (file)
@@ -2039,9 +2039,9 @@ static irqreturn_t sbmac_intr(int irq,void *dev_instance)
                sbdma_tx_process(sc,&(sc->sbm_txdma), 0);
 
        if (isr & (M_MAC_INT_CHANNEL << S_MAC_RX_CH0)) {
-               if (netif_rx_schedule_prep(&sc->napi)) {
+               if (napi_schedule_prep(&sc->napi)) {
                        __raw_writeq(0, sc->sbm_imr);
-                       __netif_rx_schedule(&sc->napi);
+                       __napi_schedule(&sc->napi);
                        /* Depend on the exit from poll to reenable intr */
                }
                else {
@@ -2478,7 +2478,7 @@ static int sbmac_mii_probe(struct net_device *dev)
                return -ENXIO;
        }
 
-       phy_dev = phy_connect(dev, phy_dev->dev.bus_id, &sbmac_mii_poll, 0,
+       phy_dev = phy_connect(dev, dev_name(&phy_dev->dev), &sbmac_mii_poll, 0,
                              PHY_INTERFACE_MODE_GMII);
        if (IS_ERR(phy_dev)) {
                printk(KERN_ERR "%s: could not attach to PHY\n", dev->name);
@@ -2500,7 +2500,7 @@ static int sbmac_mii_probe(struct net_device *dev)
 
        pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
                dev->name, phy_dev->drv->name,
-               phy_dev->dev.bus_id, phy_dev->irq);
+               dev_name(&phy_dev->dev), phy_dev->irq);
 
        sc->phy_dev = phy_dev;
 
@@ -2667,7 +2667,7 @@ static int sbmac_poll(struct napi_struct *napi, int budget)
        sbdma_tx_process(sc, &(sc->sbm_txdma), 1);
 
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
 #ifdef CONFIG_SBMAC_COALESCE
                __raw_writeq(((M_MAC_INT_EOP_COUNT | M_MAC_INT_EOP_TIMER) << S_MAC_TX_CH0) |
@@ -2697,7 +2697,7 @@ static int __init sbmac_probe(struct platform_device *pldev)
        sbm_base = ioremap_nocache(res->start, res->end - res->start + 1);
        if (!sbm_base) {
                printk(KERN_ERR "%s: unable to map device registers\n",
-                      pldev->dev.bus_id);
+                      dev_name(&pldev->dev));
                err = -ENOMEM;
                goto out_out;
        }
@@ -2708,7 +2708,7 @@ static int __init sbmac_probe(struct platform_device *pldev)
         * If we find a zero, skip this MAC.
         */
        sbmac_orig_hwaddr = __raw_readq(sbm_base + R_MAC_ETHERNET_ADDR);
-       pr_debug("%s: %sconfiguring MAC at 0x%08Lx\n", pldev->dev.bus_id,
+       pr_debug("%s: %sconfiguring MAC at 0x%08Lx\n", dev_name(&pldev->dev),
                 sbmac_orig_hwaddr ? "" : "not ", (long long)res->start);
        if (sbmac_orig_hwaddr == 0) {
                err = 0;
@@ -2721,7 +2721,7 @@ static int __init sbmac_probe(struct platform_device *pldev)
        dev = alloc_etherdev(sizeof(struct sbmac_softc));
        if (!dev) {
                printk(KERN_ERR "%s: unable to allocate etherdev\n",
-                      pldev->dev.bus_id);
+                      dev_name(&pldev->dev));
                err = -ENOMEM;
                goto out_unmap;
        }
index 8b75bef4a841a7ae2d13552ea856b2630d14bee9..c13cbf099b88e6ef61fd51ba2cacc6973f4d8e30 100644 (file)
@@ -13,6 +13,9 @@
  *  Both are almost identical and seem to be based on pci-skeleton.c
  *
  *  Rewritten for 2.6 by Cesar Eduardo Barros
+ *
+ *  A datasheet for this chip can be found at
+ *  http://www.silan.com.cn/english/products/pdf/SC92031AY.pdf
  */
 
 /* Note about set_mac_address: I don't know how to change the hardware
 
 #include <asm/irq.h>
 
-#define PCI_VENDOR_ID_SILAN            0x1904
-#define PCI_DEVICE_ID_SILAN_SC92031    0x2031
-#define PCI_DEVICE_ID_SILAN_8139D      0x8139
-
 #define SC92031_NAME "sc92031"
-#define SC92031_DESCRIPTION "Silan SC92031 PCI Fast Ethernet Adapter driver"
-#define SC92031_VERSION "2.0c"
 
 /* BAR 0 is MMIO, BAR 1 is PIO */
 #ifndef SC92031_USE_BAR
@@ -1264,7 +1261,6 @@ static void sc92031_ethtool_get_drvinfo(struct net_device *dev,
        struct pci_dev *pdev = priv->pdev;
 
        strcpy(drvinfo->driver, SC92031_NAME);
-       strcpy(drvinfo->version, SC92031_VERSION);
        strcpy(drvinfo->bus_info, pci_name(pdev));
 }
 
@@ -1423,6 +1419,7 @@ static int __devinit sc92031_probe(struct pci_dev *pdev,
        struct net_device *dev;
        struct sc92031_priv *priv;
        u32 mac0, mac1;
+       unsigned long base_addr;
 
        err = pci_enable_device(pdev);
        if (unlikely(err < 0))
@@ -1497,6 +1494,14 @@ static int __devinit sc92031_probe(struct pci_dev *pdev,
        if (err < 0)
                goto out_register_netdev;
 
+#if SC92031_USE_BAR == 0
+       base_addr = dev->mem_start;
+#elif SC92031_USE_BAR == 1
+       base_addr = dev->base_addr;
+#endif
+       printk(KERN_INFO "%s: SC92031 at 0x%lx, %pM, IRQ %d\n", dev->name,
+                       base_addr, dev->dev_addr, dev->irq);
+
        return 0;
 
 out_register_netdev:
@@ -1586,8 +1591,8 @@ out:
 }
 
 static struct pci_device_id sc92031_pci_device_id_table[] __devinitdata = {
-       { PCI_DEVICE(PCI_VENDOR_ID_SILAN, PCI_DEVICE_ID_SILAN_SC92031) },
-       { PCI_DEVICE(PCI_VENDOR_ID_SILAN, PCI_DEVICE_ID_SILAN_8139D) },
+       { PCI_DEVICE(PCI_VENDOR_ID_SILAN, 0x2031) },
+       { PCI_DEVICE(PCI_VENDOR_ID_SILAN, 0x8139) },
        { 0, }
 };
 MODULE_DEVICE_TABLE(pci, sc92031_pci_device_id_table);
@@ -1603,7 +1608,6 @@ static struct pci_driver sc92031_pci_driver = {
 
 static int __init sc92031_init(void)
 {
-       printk(KERN_INFO SC92031_DESCRIPTION " " SC92031_VERSION "\n");
        return pci_register_driver(&sc92031_pci_driver);
 }
 
@@ -1617,5 +1621,4 @@ module_exit(sc92031_exit);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Cesar Eduardo Barros <cesarb@cesarb.net>");
-MODULE_DESCRIPTION(SC92031_DESCRIPTION);
-MODULE_VERSION(SC92031_VERSION);
+MODULE_DESCRIPTION("Silan SC92031 PCI Fast Ethernet Adapter driver");
index c535408ad6bef520262118f0283c0d004ee6cc56..12a82966b5779f2db7f115ac7f967afc4baff8e2 100644 (file)
@@ -2,7 +2,6 @@ config SFC
        tristate "Solarflare Solarstorm SFC4000 support"
        depends on PCI && INET
        select MII
-       select INET_LRO
        select CRC32
        select I2C
        select I2C_ALGOBIT
index d95c218280142108d8c490dea894ea6eb817b5f5..d54d84c267b906a4331f847008302b95566d2a33 100644 (file)
@@ -543,7 +543,7 @@ typedef union efx_oword {
 
 /* Static initialiser */
 #define EFX_OWORD32(a, b, c, d)                                                \
-       { .u32 = { __constant_cpu_to_le32(a), __constant_cpu_to_le32(b), \
-                  __constant_cpu_to_le32(c), __constant_cpu_to_le32(d) } }
+       { .u32 = { cpu_to_le32(a), cpu_to_le32(b), \
+                  cpu_to_le32(c), cpu_to_le32(d) } }
 
 #endif /* EFX_BITFIELD_H */
index ab0e09bf154d1f1fe2fdab401465e31cccdb2918..75836599e43dc87a51878f81d8b1058132df7f39 100644 (file)
@@ -182,7 +182,6 @@ static int efx_process_channel(struct efx_channel *channel, int rx_quota)
                channel->rx_pkt = NULL;
        }
 
-       efx_flush_lro(channel);
        efx_rx_strategy(channel);
 
        efx_fast_push_rx_descriptors(&efx->rx_queue[channel->channel]);
@@ -225,11 +224,11 @@ static int efx_poll(struct napi_struct *napi, int budget)
 
        if (rx_packets < budget) {
                /* There is no race here; although napi_disable() will
-                * only wait for netif_rx_complete(), this isn't a problem
+                * only wait for napi_complete(), this isn't a problem
                 * since efx_channel_processed() will have no effect if
                 * interrupts have already been disabled.
                 */
-               netif_rx_complete(napi);
+               napi_complete(napi);
                efx_channel_processed(channel);
        }
 
@@ -1269,18 +1268,11 @@ static int efx_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd)
 static int efx_init_napi(struct efx_nic *efx)
 {
        struct efx_channel *channel;
-       int rc;
 
        efx_for_each_channel(channel, efx) {
                channel->napi_dev = efx->net_dev;
-               rc = efx_lro_init(&channel->lro_mgr, efx);
-               if (rc)
-                       goto err;
        }
        return 0;
- err:
-       efx_fini_napi(efx);
-       return rc;
 }
 
 static void efx_fini_napi(struct efx_nic *efx)
@@ -1288,7 +1280,6 @@ static void efx_fini_napi(struct efx_nic *efx)
        struct efx_channel *channel;
 
        efx_for_each_channel(channel, efx) {
-               efx_lro_fini(&channel->lro_mgr);
                channel->napi_dev = NULL;
        }
 }
@@ -2120,7 +2111,7 @@ static int __devinit efx_pci_probe(struct pci_dev *pci_dev,
        net_dev->features |= (NETIF_F_IP_CSUM | NETIF_F_SG |
                              NETIF_F_HIGHDMA | NETIF_F_TSO);
        if (lro)
-               net_dev->features |= NETIF_F_LRO;
+               net_dev->features |= NETIF_F_GRO;
        /* Mask for features that also apply to VLAN devices */
        net_dev->vlan_features |= (NETIF_F_ALL_CSUM | NETIF_F_SG |
                                   NETIF_F_HIGHDMA | NETIF_F_TSO);
index 55d0f131b0e90d83dda988ee81ee73a9d97b63f0..8bde1d2a21db3f7108d3126e3edf9aeb76a07f3c 100644 (file)
@@ -80,7 +80,7 @@ static inline void efx_schedule_channel(struct efx_channel *channel)
                  channel->channel, raw_smp_processor_id());
        channel->work_pending = true;
 
-       netif_rx_schedule(&channel->napi_str);
+       napi_schedule(&channel->napi_str);
 }
 
 #endif /* EFX_EFX_H */
index 665cafb88d6a087a190b0391497a681442109018..820c233c3ea0aa6037e5d00405c3604526baf2a2 100644 (file)
@@ -15,6 +15,7 @@
 #define EFX_DRIVER_NAME "sfc_mtd"
 #include "net_driver.h"
 #include "spi.h"
+#include "efx.h"
 
 #define EFX_SPI_VERIFY_BUF_LEN 16
 
index e019ad1fb9a0c7db773c0e7f1446078d3eaee2b0..19930ff9df7b71dceebbb4712a9d96cbaaf5f464 100644 (file)
 #include <linux/device.h>
 #include <linux/highmem.h>
 #include <linux/workqueue.h>
-#include <linux/inet_lro.h>
 #include <linux/i2c.h>
 
 #include "enum.h"
 #include "bitfield.h"
 
-#define EFX_MAX_LRO_DESCRIPTORS 8
-#define EFX_MAX_LRO_AGGR MAX_SKB_FRAGS
-
 /**************************************************************************
  *
  * Build definitions
@@ -340,13 +336,10 @@ enum efx_rx_alloc_method {
  * @eventq_read_ptr: Event queue read pointer
  * @last_eventq_read_ptr: Last event queue read pointer value.
  * @eventq_magic: Event queue magic value for driver-generated test events
- * @lro_mgr: LRO state
  * @rx_alloc_level: Watermark based heuristic counter for pushing descriptors
  *     and diagnostic counters
  * @rx_alloc_push_pages: RX allocation method currently in use for pushing
  *     descriptors
- * @rx_alloc_pop_pages: RX allocation method currently in use for popping
- *     descriptors
  * @n_rx_tobe_disc: Count of RX_TOBE_DISC errors
  * @n_rx_ip_frag_err: Count of RX IP fragment errors
  * @n_rx_ip_hdr_chksum_err: Count of RX IP header checksum errors
@@ -371,10 +364,8 @@ struct efx_channel {
        unsigned int last_eventq_read_ptr;
        unsigned int eventq_magic;
 
-       struct net_lro_mgr lro_mgr;
        int rx_alloc_level;
        int rx_alloc_push_pages;
-       int rx_alloc_pop_pages;
 
        unsigned n_rx_tobe_disc;
        unsigned n_rx_ip_frag_err;
index b8ba4bbad8897f384f6eb6f6168cce13df95132a..66d7fe3db3e6e74cc6c2c137226121828bb5577d 100644 (file)
@@ -99,109 +99,6 @@ static inline unsigned int efx_rx_buf_size(struct efx_nic *efx)
 }
 
 
-/**************************************************************************
- *
- * Linux generic LRO handling
- *
- **************************************************************************
- */
-
-static int efx_lro_get_skb_hdr(struct sk_buff *skb, void **ip_hdr,
-                              void **tcpudp_hdr, u64 *hdr_flags, void *priv)
-{
-       struct efx_channel *channel = priv;
-       struct iphdr *iph;
-       struct tcphdr *th;
-
-       iph = (struct iphdr *)skb->data;
-       if (skb->protocol != htons(ETH_P_IP) || iph->protocol != IPPROTO_TCP)
-               goto fail;
-
-       th = (struct tcphdr *)(skb->data + iph->ihl * 4);
-
-       *tcpudp_hdr = th;
-       *ip_hdr = iph;
-       *hdr_flags = LRO_IPV4 | LRO_TCP;
-
-       channel->rx_alloc_level += RX_ALLOC_FACTOR_LRO;
-       return 0;
-fail:
-       channel->rx_alloc_level += RX_ALLOC_FACTOR_SKB;
-       return -1;
-}
-
-static int efx_get_frag_hdr(struct skb_frag_struct *frag, void **mac_hdr,
-                           void **ip_hdr, void **tcpudp_hdr, u64 *hdr_flags,
-                           void *priv)
-{
-       struct efx_channel *channel = priv;
-       struct ethhdr *eh;
-       struct iphdr *iph;
-
-       /* We support EtherII and VLAN encapsulated IPv4 */
-       eh = page_address(frag->page) + frag->page_offset;
-       *mac_hdr = eh;
-
-       if (eh->h_proto == htons(ETH_P_IP)) {
-               iph = (struct iphdr *)(eh + 1);
-       } else {
-               struct vlan_ethhdr *veh = (struct vlan_ethhdr *)eh;
-               if (veh->h_vlan_encapsulated_proto != htons(ETH_P_IP))
-                       goto fail;
-
-               iph = (struct iphdr *)(veh + 1);
-       }
-       *ip_hdr = iph;
-
-       /* We can only do LRO over TCP */
-       if (iph->protocol != IPPROTO_TCP)
-               goto fail;
-
-       *hdr_flags = LRO_IPV4 | LRO_TCP;
-       *tcpudp_hdr = (struct tcphdr *)((u8 *) iph + iph->ihl * 4);
-
-       channel->rx_alloc_level += RX_ALLOC_FACTOR_LRO;
-       return 0;
- fail:
-       channel->rx_alloc_level += RX_ALLOC_FACTOR_SKB;
-       return -1;
-}
-
-int efx_lro_init(struct net_lro_mgr *lro_mgr, struct efx_nic *efx)
-{
-       size_t s = sizeof(struct net_lro_desc) * EFX_MAX_LRO_DESCRIPTORS;
-       struct net_lro_desc *lro_arr;
-
-       /* Allocate the LRO descriptors structure */
-       lro_arr = kzalloc(s, GFP_KERNEL);
-       if (lro_arr == NULL)
-               return -ENOMEM;
-
-       lro_mgr->lro_arr = lro_arr;
-       lro_mgr->max_desc = EFX_MAX_LRO_DESCRIPTORS;
-       lro_mgr->max_aggr = EFX_MAX_LRO_AGGR;
-       lro_mgr->frag_align_pad = EFX_PAGE_SKB_ALIGN;
-
-       lro_mgr->get_skb_header = efx_lro_get_skb_hdr;
-       lro_mgr->get_frag_header = efx_get_frag_hdr;
-       lro_mgr->dev = efx->net_dev;
-
-       lro_mgr->features = LRO_F_NAPI;
-
-       /* We can pass packets up with the checksum intact */
-       lro_mgr->ip_summed = CHECKSUM_UNNECESSARY;
-
-       lro_mgr->ip_summed_aggr = CHECKSUM_UNNECESSARY;
-
-       return 0;
-}
-
-void efx_lro_fini(struct net_lro_mgr *lro_mgr)
-{
-       kfree(lro_mgr->lro_arr);
-       lro_mgr->lro_arr = NULL;
-}
-
 /**
  * efx_init_rx_buffer_skb - create new RX buffer using skb-based allocation
  *
@@ -549,77 +446,31 @@ static void efx_rx_packet__check_len(struct efx_rx_queue *rx_queue,
 static void efx_rx_packet_lro(struct efx_channel *channel,
                              struct efx_rx_buffer *rx_buf)
 {
-       struct net_lro_mgr *lro_mgr = &channel->lro_mgr;
-       void *priv = channel;
+       struct napi_struct *napi = &channel->napi_str;
 
        /* Pass the skb/page into the LRO engine */
        if (rx_buf->page) {
-               struct skb_frag_struct frags;
+               struct napi_gro_fraginfo info;
 
-               frags.page = rx_buf->page;
-               frags.page_offset = efx_rx_buf_offset(rx_buf);
-               frags.size = rx_buf->len;
+               info.frags[0].page = rx_buf->page;
+               info.frags[0].page_offset = efx_rx_buf_offset(rx_buf);
+               info.frags[0].size = rx_buf->len;
+               info.nr_frags = 1;
+               info.ip_summed = CHECKSUM_UNNECESSARY;
+               info.len = rx_buf->len;
 
-               lro_receive_frags(lro_mgr, &frags, rx_buf->len,
-                                 rx_buf->len, priv, 0);
+               napi_gro_frags(napi, &info);
 
                EFX_BUG_ON_PARANOID(rx_buf->skb);
                rx_buf->page = NULL;
        } else {
                EFX_BUG_ON_PARANOID(!rx_buf->skb);
 
-               lro_receive_skb(lro_mgr, rx_buf->skb, priv);
+               napi_gro_receive(napi, rx_buf->skb);
                rx_buf->skb = NULL;
        }
 }
 
-/* Allocate and construct an SKB around a struct page.*/
-static struct sk_buff *efx_rx_mk_skb(struct efx_rx_buffer *rx_buf,
-                                    struct efx_nic *efx,
-                                    int hdr_len)
-{
-       struct sk_buff *skb;
-
-       /* Allocate an SKB to store the headers */
-       skb = netdev_alloc_skb(efx->net_dev, hdr_len + EFX_PAGE_SKB_ALIGN);
-       if (unlikely(skb == NULL)) {
-               EFX_ERR_RL(efx, "RX out of memory for skb\n");
-               return NULL;
-       }
-
-       EFX_BUG_ON_PARANOID(skb_shinfo(skb)->nr_frags);
-       EFX_BUG_ON_PARANOID(rx_buf->len < hdr_len);
-
-       skb->ip_summed = CHECKSUM_UNNECESSARY;
-       skb_reserve(skb, EFX_PAGE_SKB_ALIGN);
-
-       skb->len = rx_buf->len;
-       skb->truesize = rx_buf->len + sizeof(struct sk_buff);
-       memcpy(skb->data, rx_buf->data, hdr_len);
-       skb->tail += hdr_len;
-
-       /* Append the remaining page onto the frag list */
-       if (unlikely(rx_buf->len > hdr_len)) {
-               struct skb_frag_struct *frag = skb_shinfo(skb)->frags;
-               frag->page = rx_buf->page;
-               frag->page_offset = efx_rx_buf_offset(rx_buf) + hdr_len;
-               frag->size = skb->len - hdr_len;
-               skb_shinfo(skb)->nr_frags = 1;
-               skb->data_len = frag->size;
-       } else {
-               __free_pages(rx_buf->page, efx->rx_buffer_order);
-               skb->data_len = 0;
-       }
-
-       /* Ownership has transferred from the rx_buf to skb */
-       rx_buf->page = NULL;
-
-       /* Move past the ethernet header */
-       skb->protocol = eth_type_trans(skb, efx->net_dev);
-
-       return skb;
-}
-
 void efx_rx_packet(struct efx_rx_queue *rx_queue, unsigned int index,
                   unsigned int len, bool checksummed, bool discard)
 {
@@ -687,7 +538,6 @@ void __efx_rx_packet(struct efx_channel *channel,
 {
        struct efx_nic *efx = channel->efx;
        struct sk_buff *skb;
-       bool lro = !!(efx->net_dev->features & NETIF_F_LRO);
 
        /* If we're in loopback test, then pass the packet directly to the
         * loopback layer, and free the rx_buf here
@@ -709,41 +559,23 @@ void __efx_rx_packet(struct efx_channel *channel,
                                                       efx->net_dev);
        }
 
-       /* Both our generic-LRO and SFC-SSR support skb and page based
-        * allocation, but neither support switching from one to the
-        * other on the fly. If we spot that the allocation mode has
-        * changed, then flush the LRO state.
-        */
-       if (unlikely(channel->rx_alloc_pop_pages != (rx_buf->page != NULL))) {
-               efx_flush_lro(channel);
-               channel->rx_alloc_pop_pages = (rx_buf->page != NULL);
-       }
-       if (likely(checksummed && lro)) {
+       if (likely(checksummed || rx_buf->page)) {
                efx_rx_packet_lro(channel, rx_buf);
                goto done;
        }
 
-       /* Form an skb if required */
-       if (rx_buf->page) {
-               int hdr_len = min(rx_buf->len, EFX_SKB_HEADERS);
-               skb = efx_rx_mk_skb(rx_buf, efx, hdr_len);
-               if (unlikely(skb == NULL)) {
-                       efx_free_rx_buffer(efx, rx_buf);
-                       goto done;
-               }
-       } else {
-               /* We now own the SKB */
-               skb = rx_buf->skb;
-               rx_buf->skb = NULL;
-       }
+       /* We now own the SKB */
+       skb = rx_buf->skb;
+       rx_buf->skb = NULL;
 
        EFX_BUG_ON_PARANOID(rx_buf->page);
        EFX_BUG_ON_PARANOID(rx_buf->skb);
        EFX_BUG_ON_PARANOID(!skb);
 
        /* Set the SKB flags */
-       if (unlikely(!checksummed || !efx->rx_checksum_enabled))
-               skb->ip_summed = CHECKSUM_NONE;
+       skb->ip_summed = CHECKSUM_NONE;
+
+       skb_record_rx_queue(skb, channel->channel);
 
        /* Pass the packet up */
        netif_receive_skb(skb);
@@ -760,7 +592,7 @@ void efx_rx_strategy(struct efx_channel *channel)
        enum efx_rx_alloc_method method = rx_alloc_method;
 
        /* Only makes sense to use page based allocation if LRO is enabled */
-       if (!(channel->efx->net_dev->features & NETIF_F_LRO)) {
+       if (!(channel->efx->net_dev->features & NETIF_F_GRO)) {
                method = RX_ALLOC_METHOD_SKB;
        } else if (method == RX_ALLOC_METHOD_AUTO) {
                /* Constrain the rx_alloc_level */
@@ -865,11 +697,6 @@ void efx_remove_rx_queue(struct efx_rx_queue *rx_queue)
        rx_queue->buffer = NULL;
 }
 
-void efx_flush_lro(struct efx_channel *channel)
-{
-       lro_flush_all(&channel->lro_mgr);
-}
-
 
 module_param(rx_alloc_method, int, 0644);
 MODULE_PARM_DESC(rx_alloc_method, "Allocation method used for RX buffers");
index 0e88a9ddc1c64ae967337fa218a5d24388b479f3..42ee7555a80b30d52fea3332c3a47e18ebab5c7c 100644 (file)
@@ -17,9 +17,6 @@ void efx_remove_rx_queue(struct efx_rx_queue *rx_queue);
 void efx_init_rx_queue(struct efx_rx_queue *rx_queue);
 void efx_fini_rx_queue(struct efx_rx_queue *rx_queue);
 
-int efx_lro_init(struct net_lro_mgr *lro_mgr, struct efx_nic *efx);
-void efx_lro_fini(struct net_lro_mgr *lro_mgr);
-void efx_flush_lro(struct efx_channel *channel);
 void efx_rx_strategy(struct efx_channel *channel);
 void efx_fast_push_rx_descriptors(struct efx_rx_queue *rx_queue);
 void efx_rx_work(struct work_struct *data);
index cb25ae5b257ae96a0d4da7b90aeea521a4d74299..c0e90683162339570a03154b14ae0a46e1ce4855 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/rtnetlink.h>
 #include "net_driver.h"
 #include "efx.h"
 #include "phy.h"
index f0efd246962cf01e2a9639b6fdb4421e8a3e1438..5b0f45166628161e6a225b39137d336e50266d93 100644 (file)
@@ -8,6 +8,7 @@
  */
 
 #include <linux/delay.h>
+#include <linux/rtnetlink.h>
 #include <linux/seq_file.h>
 #include "efx.h"
 #include "mdio_10g.h"
@@ -571,15 +572,14 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx)
 static void tenxpress_phy_poll(struct efx_nic *efx)
 {
        struct tenxpress_phy_data *phy_data = efx->phy_data;
-       bool change = false, link_ok;
-       unsigned link_fc;
+       bool change = false;
 
        if (efx->phy_type == PHY_TYPE_SFX7101) {
-               link_ok = sfx7101_link_ok(efx);
+               bool link_ok = sfx7101_link_ok(efx);
                if (link_ok != efx->link_up) {
                        change = true;
                } else {
-                       link_fc = mdio_clause45_get_pause(efx);
+                       unsigned int link_fc = mdio_clause45_get_pause(efx);
                        if (link_fc != efx->link_fc)
                                change = true;
                }
index 94325915e0d5148d13cc4542a6b9cb87bec3e182..1758d954836183d8f4fcbf17fb3145952e29648a 100644 (file)
@@ -467,5 +467,22 @@ struct s_smc {
 #endif /* DEBUG_BRD && DEBUG */
 } ;
 
+extern const struct fddi_addr fddi_broadcast;
+
+extern void all_selection_criteria(struct s_smc *smc);
+extern void card_stop(struct s_smc *smc);
+extern void init_board(struct s_smc *smc, u_char *mac_addr);
+extern int init_fplus(struct s_smc *smc);
+extern void init_plc(struct s_smc *smc);
+extern int init_smt(struct s_smc *smc, u_char * mac_addr);
+extern void mac1_irq(struct s_smc *smc, u_short stu, u_short stl);
+extern void mac2_irq(struct s_smc *smc, u_short code_s2u, u_short code_s2l);
+extern void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l);
+extern int pcm_status_twisted(struct s_smc *smc);
+extern void plc1_irq(struct s_smc *smc);
+extern void plc2_irq(struct s_smc *smc);
+extern void read_address(struct s_smc *smc, u_char * mac_addr);
+extern void timer_irq(struct s_smc *smc);
+
 #endif /* _SCMECM_ */
 
index 4218e97033c9e35d6a96a789c04adce94fc961e9..d322f1b702ac52ae1e3d8aa6ff8944155d8dab20 100644 (file)
@@ -97,23 +97,15 @@ static void mac_drv_clear_txd(struct s_smc *smc);
 
 extern void* mac_drv_get_space(struct s_smc *smc, unsigned int size);
 extern void* mac_drv_get_desc_mem(struct s_smc *smc, unsigned int size);
-extern void init_board(struct s_smc *smc, u_char *mac_addr);
 extern void mac_drv_fill_rxd(struct s_smc *smc);
-extern void plc1_irq(struct s_smc *smc);
 extern void mac_drv_tx_complete(struct s_smc *smc,
                                volatile struct s_smt_fp_txd *txd);
-extern void plc2_irq(struct s_smc *smc);
-extern void mac1_irq(struct s_smc *smc, u_short stu, u_short stl);
-extern void mac2_irq(struct s_smc *smc, u_short code_s2u, u_short code_s2l);
-extern void mac3_irq(struct s_smc *smc, u_short code_s3u, u_short code_s3l);
-extern void timer_irq(struct s_smc *smc);
 extern void mac_drv_rx_complete(struct s_smc *smc,
                                volatile struct s_smt_fp_rxd *rxd,
                                int frag_count, int len);
 extern void mac_drv_requeue_rxd(struct s_smc *smc, 
                                volatile struct s_smt_fp_rxd *rxd,
                                int frag_count);
-extern void init_plc(struct s_smc *smc);
 extern void mac_drv_clear_rxd(struct s_smc *smc,
                              volatile struct s_smt_fp_rxd *rxd, int frag_count);
 
@@ -136,7 +128,6 @@ extern void dma_complete(struct s_smc *smc, volatile union s_fp_descr *descr,
                         int flag);
 #endif
 
-extern int init_fplus(struct s_smc *smc);
 extern int mac_drv_rx_init(struct s_smc *smc, int len, int fc, char *look_ahead,
                           int la_len);
 
index 74e129f3ce92f32e2cb07673ebff0a79acd1414d..f1df2ec8ad41a8e7fd4ee3349ebbf6550ea1d983 100644 (file)
@@ -198,9 +198,6 @@ static int plc_imsk_na = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
 static const int plc_imsk_act = PL_PCM_CODE | PL_TRACE_PROP | PL_PCM_BREAK |
                        PL_PCM_ENABLED | PL_SELF_TEST | PL_EBUF_ERR;
 
-/* external functions */
-void all_selection_criteria(struct s_smc *smc);
-
 /* internal functions */
 static void pcm_fsm(struct s_smc *smc, struct s_phy *phy, int cmd);
 static void pc_rcode_actions(struct s_smc *smc, int bit, struct s_phy *phy);
index 9a00e5566af74db199d2625db4903ecd58e3b9e8..e14aec0a73337ee4e832284155cd8c9d313935b9 100644 (file)
@@ -135,14 +135,11 @@ void dump_data(unsigned char *Data, int length);
 
 // External functions from the hardware module
 extern u_int mac_drv_check_space(void);
-extern void read_address(struct s_smc *smc, u_char * mac_addr);
-extern void card_stop(struct s_smc *smc);
 extern int mac_drv_init(struct s_smc *smc);
 extern void hwm_tx_frag(struct s_smc *smc, char far * virt, u_long phys,
                        int len, int frame_status);
 extern int hwm_tx_init(struct s_smc *smc, u_char fc, int frag_count,
                       int frame_len, int frame_status);
-extern int init_smt(struct s_smc *smc, u_char * mac_addr);
 extern void fddi_isr(struct s_smc *smc);
 extern void hwm_rx_frag(struct s_smc *smc, char far * virt, u_long phys,
                        int len, int frame_status);
index 805383b33d3ccf358d185c8bb5f26598b7c89d8d..83d16fecfac4280608099dbb3747707f76000d54 100644 (file)
@@ -54,16 +54,6 @@ static const struct fddi_addr SMT_Unknown = {
        { 0,0,0x1f,0,0,0 }
 } ;
 
-/*
- * external variables
- */
-extern const struct fddi_addr fddi_broadcast ;
-
-/*
- * external functions
- */
-int pcm_status_twisted(struct s_smc *smc);
-
 /*
  * function prototypes
  */
index c9dbb06f8c9430cfb06779a8486544792972996a..952d37ffee51f8de796a20b650b946678ca5e333 100644 (file)
@@ -3214,7 +3214,7 @@ static int skge_poll(struct napi_struct *napi, int to_do)
                unsigned long flags;
 
                spin_lock_irqsave(&hw->hw_lock, flags);
-               __netif_rx_complete(napi);
+               __napi_complete(napi);
                hw->intr_mask |= napimask[skge->port];
                skge_write32(hw, B0_IMSK, hw->intr_mask);
                skge_read32(hw, B0_IMSK);
@@ -3377,7 +3377,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
        if (status & (IS_XA1_F|IS_R1_F)) {
                struct skge_port *skge = netdev_priv(hw->dev[0]);
                hw->intr_mask &= ~(IS_XA1_F|IS_R1_F);
-               netif_rx_schedule(&skge->napi);
+               napi_schedule(&skge->napi);
        }
 
        if (status & IS_PA_TO_TX1)
@@ -3397,7 +3397,7 @@ static irqreturn_t skge_intr(int irq, void *dev_id)
 
                if (status & (IS_XA2_F|IS_R2_F)) {
                        hw->intr_mask &= ~(IS_XA2_F|IS_R2_F);
-                       netif_rx_schedule(&skge->napi);
+                       napi_schedule(&skge->napi);
                }
 
                if (status & IS_PA_TO_RX2) {
index 994703cc0db32c87229f7754f1a246c1cc44d9ea..d01c56eb962759e511cf269a27d4952e85e15cfc 100644 (file)
@@ -1068,13 +1068,16 @@ static void sky2_rx_submit(struct sky2_port *sky2,
 }
 
 
-static void sky2_rx_map_skb(struct pci_dev *pdev, struct rx_ring_info *re,
+static int sky2_rx_map_skb(struct pci_dev *pdev, struct rx_ring_info *re,
                            unsigned size)
 {
        struct sk_buff *skb = re->skb;
        int i;
 
        re->data_addr = pci_map_single(pdev, skb->data, size, PCI_DMA_FROMDEVICE);
+       if (unlikely(pci_dma_mapping_error(pdev, re->data_addr)))
+               return -EIO;
+
        pci_unmap_len_set(re, data_size, size);
 
        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++)
@@ -1083,6 +1086,7 @@ static void sky2_rx_map_skb(struct pci_dev *pdev, struct rx_ring_info *re,
                                                skb_shinfo(skb)->frags[i].page_offset,
                                                skb_shinfo(skb)->frags[i].size,
                                                PCI_DMA_FROMDEVICE);
+       return 0;
 }
 
 static void sky2_rx_unmap_skb(struct pci_dev *pdev, struct rx_ring_info *re)
@@ -1354,7 +1358,12 @@ static int sky2_rx_start(struct sky2_port *sky2)
                if (!re->skb)
                        goto nomem;
 
-               sky2_rx_map_skb(hw->pdev, re, sky2->rx_data_size);
+               if (sky2_rx_map_skb(hw->pdev, re, sky2->rx_data_size)) {
+                       dev_kfree_skb(re->skb);
+                       re->skb = NULL;
+                       goto nomem;
+               }
+
                sky2_rx_submit(sky2, re);
        }
 
@@ -1547,7 +1556,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
        struct sky2_hw *hw = sky2->hw;
        struct sky2_tx_le *le = NULL;
        struct tx_ring_info *re;
-       unsigned i, len;
+       unsigned i, len, first_slot;
        dma_addr_t mapping;
        u16 mss;
        u8 ctrl;
@@ -1555,13 +1564,17 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
        if (unlikely(tx_avail(sky2) < tx_le_req(skb)))
                return NETDEV_TX_BUSY;
 
-       if (unlikely(netif_msg_tx_queued(sky2)))
-               printk(KERN_DEBUG "%s: tx queued, slot %u, len %d\n",
-                      dev->name, sky2->tx_prod, skb->len);
-
        len = skb_headlen(skb);
        mapping = pci_map_single(hw->pdev, skb->data, len, PCI_DMA_TODEVICE);
 
+       if (pci_dma_mapping_error(hw->pdev, mapping))
+               goto mapping_error;
+
+       first_slot = sky2->tx_prod;
+       if (unlikely(netif_msg_tx_queued(sky2)))
+               printk(KERN_DEBUG "%s: tx queued, slot %u, len %d\n",
+                      dev->name, first_slot, skb->len);
+
        /* Send high bits if needed */
        if (sizeof(dma_addr_t) > sizeof(u32)) {
                le = get_tx_le(sky2);
@@ -1648,6 +1661,9 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
                mapping = pci_map_page(hw->pdev, frag->page, frag->page_offset,
                                       frag->size, PCI_DMA_TODEVICE);
 
+               if (pci_dma_mapping_error(hw->pdev, mapping))
+                       goto mapping_unwind;
+
                if (sizeof(dma_addr_t) > sizeof(u32)) {
                        le = get_tx_le(sky2);
                        le->addr = cpu_to_le32(upper_32_bits(mapping));
@@ -1676,6 +1692,34 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev)
 
        dev->trans_start = jiffies;
        return NETDEV_TX_OK;
+
+mapping_unwind:
+       for (i = first_slot; i != sky2->tx_prod; i = RING_NEXT(i, TX_RING_SIZE)) {
+               le = sky2->tx_le + i;
+               re = sky2->tx_ring + i;
+
+               switch(le->opcode & ~HW_OWNER) {
+               case OP_LARGESEND:
+               case OP_PACKET:
+                       pci_unmap_single(hw->pdev,
+                                        pci_unmap_addr(re, mapaddr),
+                                        pci_unmap_len(re, maplen),
+                                        PCI_DMA_TODEVICE);
+                       break;
+               case OP_BUFFER:
+                       pci_unmap_page(hw->pdev, pci_unmap_addr(re, mapaddr),
+                                      pci_unmap_len(re, maplen),
+                                      PCI_DMA_TODEVICE);
+                       break;
+               }
+       }
+
+       sky2->tx_prod = first_slot;
+mapping_error:
+       if (net_ratelimit())
+               dev_warn(&hw->pdev->dev, "%s: tx mapping error\n", dev->name);
+       dev_kfree_skb(skb);
+       return NETDEV_TX_OK;
 }
 
 /*
@@ -2191,7 +2235,11 @@ static struct sk_buff *receive_new(struct sky2_port *sky2,
 
        prefetch(skb->data);
        re->skb = nskb;
-       sky2_rx_map_skb(sky2->hw->pdev, re, hdr_space);
+       if (sky2_rx_map_skb(sky2->hw->pdev, re, hdr_space)) {
+               dev_kfree_skb(nskb);
+               re->skb = skb;
+               return NULL;
+       }
 
        if (skb_shinfo(skb)->nr_frags)
                skb_put_frags(skb, hdr_space, length);
@@ -2687,13 +2735,6 @@ static int sky2_poll(struct napi_struct *napi, int work_limit)
                        goto done;
        }
 
-       /* Bug/Errata workaround?
-        * Need to kick the TX irq moderation timer.
-        */
-       if (sky2_read8(hw, STAT_TX_TIMER_CTRL) == TIM_START) {
-               sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_STOP);
-               sky2_write8(hw, STAT_TX_TIMER_CTRL, TIM_START);
-       }
        napi_complete(napi);
        sky2_read32(hw, B0_Y2_SP_LISR);
 done:
@@ -3864,6 +3905,86 @@ static const struct ethtool_ops sky2_ethtool_ops = {
 
 static struct dentry *sky2_debug;
 
+
+/*
+ * Read and parse the first part of Vital Product Data
+ */
+#define VPD_SIZE       128
+#define VPD_MAGIC      0x82
+
+static const struct vpd_tag {
+       char tag[2];
+       char *label;
+} vpd_tags[] = {
+       { "PN", "Part Number" },
+       { "EC", "Engineering Level" },
+       { "MN", "Manufacturer" },
+       { "SN", "Serial Number" },
+       { "YA", "Asset Tag" },
+       { "VL", "First Error Log Message" },
+       { "VF", "Second Error Log Message" },
+       { "VB", "Boot Agent ROM Configuration" },
+       { "VE", "EFI UNDI Configuration" },
+};
+
+static void sky2_show_vpd(struct seq_file *seq, struct sky2_hw *hw)
+{
+       size_t vpd_size;
+       loff_t offs;
+       u8 len;
+       unsigned char *buf;
+       u16 reg2;
+
+       reg2 = sky2_pci_read16(hw, PCI_DEV_REG2);
+       vpd_size = 1 << ( ((reg2 & PCI_VPD_ROM_SZ) >> 14) + 8);
+
+       seq_printf(seq, "%s Product Data\n", pci_name(hw->pdev));
+       buf = kmalloc(vpd_size, GFP_KERNEL);
+       if (!buf) {
+               seq_puts(seq, "no memory!\n");
+               return;
+       }
+
+       if (pci_read_vpd(hw->pdev, 0, vpd_size, buf) < 0) {
+               seq_puts(seq, "VPD read failed\n");
+               goto out;
+       }
+
+       if (buf[0] != VPD_MAGIC) {
+               seq_printf(seq, "VPD tag mismatch: %#x\n", buf[0]);
+               goto out;
+       }
+       len = buf[1];
+       if (len == 0 || len > vpd_size - 4) {
+               seq_printf(seq, "Invalid id length: %d\n", len);
+               goto out;
+       }
+
+       seq_printf(seq, "%.*s\n", len, buf + 3);
+       offs = len + 3;
+
+       while (offs < vpd_size - 4) {
+               int i;
+
+               if (!memcmp("RW", buf + offs, 2))       /* end marker */
+                       break;
+               len = buf[offs + 2];
+               if (offs + len + 3 >= vpd_size)
+                       break;
+
+               for (i = 0; i < ARRAY_SIZE(vpd_tags); i++) {
+                       if (!memcmp(vpd_tags[i].tag, buf + offs, 2)) {
+                               seq_printf(seq, " %s: %.*s\n",
+                                          vpd_tags[i].label, len, buf + offs + 3);
+                               break;
+                       }
+               }
+               offs += len + 3;
+       }
+out:
+       kfree(buf);
+}
+
 static int sky2_debug_show(struct seq_file *seq, void *v)
 {
        struct net_device *dev = seq->private;
@@ -3873,14 +3994,18 @@ static int sky2_debug_show(struct seq_file *seq, void *v)
        unsigned idx, last;
        int sop;
 
-       if (!netif_running(dev))
-               return -ENETDOWN;
+       sky2_show_vpd(seq, hw);
 
-       seq_printf(seq, "IRQ src=%x mask=%x control=%x\n",
+       seq_printf(seq, "\nIRQ src=%x mask=%x control=%x\n",
                   sky2_read32(hw, B0_ISRC),
                   sky2_read32(hw, B0_IMSK),
                   sky2_read32(hw, B0_Y2_SP_ICR));
 
+       if (!netif_running(dev)) {
+               seq_printf(seq, "network not running\n");
+               return 0;
+       }
+
        napi_disable(&hw->napi);
        last = sky2_read16(hw, STAT_PUT_IDX);
 
@@ -4204,69 +4329,6 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw)
        return err;
 }
 
-/*
- * Read and parse the first part of Vital Product Data
- */
-#define VPD_SIZE       128
-#define VPD_MAGIC      0x82
-
-static void __devinit sky2_vpd_info(struct sky2_hw *hw)
-{
-       int cap = pci_find_capability(hw->pdev, PCI_CAP_ID_VPD);
-       const u8 *p;
-       u8 *vpd_buf = NULL;
-       u16 len;
-       static struct vpd_tag {
-               char tag[2];
-               char *label;
-       } vpd_tags[] = {
-               { "PN", "Part Number" },
-               { "EC", "Engineering Level" },
-               { "MN", "Manufacturer" },
-       };
-
-       if (!cap)
-               goto out;
-
-       vpd_buf = kmalloc(VPD_SIZE, GFP_KERNEL);
-       if (!vpd_buf)
-               goto out;
-
-       if (sky2_vpd_read(hw, cap, vpd_buf, 0, VPD_SIZE))
-               goto out;
-
-       if (vpd_buf[0] != VPD_MAGIC)
-               goto out;
-       len = vpd_buf[1];
-       if (len == 0 || len > VPD_SIZE - 4)
-               goto out;
-       p = vpd_buf + 3;
-       dev_info(&hw->pdev->dev, "%.*s\n", len, p);
-       p += len;
-
-       while (p < vpd_buf + VPD_SIZE - 4) {
-               int i;
-
-               if (!memcmp("RW", p, 2))        /* end marker */
-                       break;
-
-               len = p[2];
-               if (len > (p - vpd_buf) - 4)
-                       break;
-
-               for (i = 0; i < ARRAY_SIZE(vpd_tags); i++) {
-                       if (!memcmp(vpd_tags[i].tag, p, 2)) {
-                               printk(KERN_DEBUG " %s: %.*s\n",
-                                      vpd_tags[i].label, len, p + 3);
-                               break;
-                       }
-               }
-               p += len + 3;
-       }
-out:
-       kfree(vpd_buf);
-}
-
 /* This driver supports yukon2 chipset only */
 static const char *sky2_name(u8 chipid, char *buf, int sz)
 {
@@ -4294,6 +4356,7 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
        struct net_device *dev;
        struct sky2_hw *hw;
        int err, using_dac = 0, wol_default;
+       u32 reg;
        char buf1[16];
 
        err = pci_enable_device(pdev);
@@ -4327,6 +4390,34 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
                }
        }
 
+       /* Get configuration information
+        * Note: only regular PCI config access once to test for HW issues
+        *       other PCI access through shared memory for speed and to
+        *       avoid MMCONFIG problems.
+        */
+       err = pci_read_config_dword(pdev, PCI_DEV_REG2, &reg);
+       if (err) {
+               dev_err(&pdev->dev, "PCI read config failed\n");
+               goto err_out_free_regions;
+       }
+
+       /* size of available VPD, only impact sysfs */
+       err = pci_vpd_truncate(pdev, 1ul << (((reg & PCI_VPD_ROM_SZ) >> 14) + 8));
+       if (err)
+               dev_warn(&pdev->dev, "Can't set VPD size\n");
+
+#ifdef __BIG_ENDIAN
+       /* The sk98lin vendor driver uses hardware byte swapping but
+        * this driver uses software swapping.
+        */
+       reg &= ~PCI_REV_DESC;
+       err = pci_write_config_dword(pdev,PCI_DEV_REG2, reg);
+       if (err) {
+               dev_err(&pdev->dev, "PCI write config failed\n");
+               goto err_out_free_regions;
+       }
+#endif
+
        wol_default = device_may_wakeup(&pdev->dev) ? WAKE_MAGIC : 0;
 
        err = -ENOMEM;
@@ -4344,18 +4435,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
                goto err_out_free_hw;
        }
 
-#ifdef __BIG_ENDIAN
-       /* The sk98lin vendor driver uses hardware byte swapping but
-        * this driver uses software swapping.
-        */
-       {
-               u32 reg;
-               reg = sky2_pci_read32(hw, PCI_DEV_REG2);
-               reg &= ~PCI_REV_DESC;
-               sky2_pci_write32(hw, PCI_DEV_REG2, reg);
-       }
-#endif
-
        /* ring for status responses */
        hw->st_le = pci_alloc_consistent(pdev, STATUS_LE_BYTES, &hw->st_dma);
        if (!hw->st_le)
@@ -4370,8 +4449,6 @@ static int __devinit sky2_probe(struct pci_dev *pdev,
 
        sky2_reset(hw);
 
-       sky2_vpd_info(hw);
-
        dev = sky2_init_netdev(hw, 0, using_dac, wol_default);
        if (!dev) {
                err = -ENOMEM;
index 223cde0d43be8a6674f956cea35e3a490530cfdb..293610334a778b2ca81c4af52a2b8e391d13b204 100644 (file)
@@ -1545,7 +1545,7 @@ smc911x_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        strncpy(info->driver, CARDNAME, sizeof(info->driver));
        strncpy(info->version, version, sizeof(info->version));
-       strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info));
+       strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info));
 }
 
 static int smc911x_ethtool_nwayreset(struct net_device *dev)
index b215a8d85e62d5e2fc3eb54064918ae8dd90fd97..fdcbaf8dfa739618a5a8f25bc27f6c24222e8004 100644 (file)
@@ -1614,7 +1614,7 @@ smc_ethtool_getdrvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
 {
        strncpy(info->driver, CARDNAME, sizeof(info->driver));
        strncpy(info->version, version, sizeof(info->version));
-       strncpy(info->bus_info, dev->dev.parent->bus_id, sizeof(info->bus_info));
+       strncpy(info->bus_info, dev_name(dev->dev.parent), sizeof(info->bus_info));
 }
 
 static int smc_ethtool_nwayreset(struct net_device *dev)
@@ -1643,6 +1643,117 @@ static void smc_ethtool_setmsglevel(struct net_device *dev, u32 level)
        lp->msg_enable = level;
 }
 
+static int smc_write_eeprom_word(struct net_device *dev, u16 addr, u16 word)
+{
+       u16 ctl;
+       struct smc_local *lp = netdev_priv(dev);
+       void __iomem *ioaddr = lp->base;
+
+       spin_lock_irq(&lp->lock);
+       /* load word into GP register */
+       SMC_SELECT_BANK(lp, 1);
+       SMC_SET_GP(lp, word);
+       /* set the address to put the data in EEPROM */
+       SMC_SELECT_BANK(lp, 2);
+       SMC_SET_PTR(lp, addr);
+       /* tell it to write */
+       SMC_SELECT_BANK(lp, 1);
+       ctl = SMC_GET_CTL(lp);
+       SMC_SET_CTL(lp, ctl | (CTL_EEPROM_SELECT | CTL_STORE));
+       /* wait for it to finish */
+       do {
+               udelay(1);
+       } while (SMC_GET_CTL(lp) & CTL_STORE);
+       /* clean up */
+       SMC_SET_CTL(lp, ctl);
+       SMC_SELECT_BANK(lp, 2);
+       spin_unlock_irq(&lp->lock);
+       return 0;
+}
+
+static int smc_read_eeprom_word(struct net_device *dev, u16 addr, u16 *word)
+{
+       u16 ctl;
+       struct smc_local *lp = netdev_priv(dev);
+       void __iomem *ioaddr = lp->base;
+
+       spin_lock_irq(&lp->lock);
+       /* set the EEPROM address to get the data from */
+       SMC_SELECT_BANK(lp, 2);
+       SMC_SET_PTR(lp, addr | PTR_READ);
+       /* tell it to load */
+       SMC_SELECT_BANK(lp, 1);
+       SMC_SET_GP(lp, 0xffff); /* init to known */
+       ctl = SMC_GET_CTL(lp);
+       SMC_SET_CTL(lp, ctl | (CTL_EEPROM_SELECT | CTL_RELOAD));
+       /* wait for it to finish */
+       do {
+               udelay(1);
+       } while (SMC_GET_CTL(lp) & CTL_RELOAD);
+       /* read word from GP register */
+       *word = SMC_GET_GP(lp);
+       /* clean up */
+       SMC_SET_CTL(lp, ctl);
+       SMC_SELECT_BANK(lp, 2);
+       spin_unlock_irq(&lp->lock);
+       return 0;
+}
+
+static int smc_ethtool_geteeprom_len(struct net_device *dev)
+{
+       return 0x23 * 2;
+}
+
+static int smc_ethtool_geteeprom(struct net_device *dev,
+               struct ethtool_eeprom *eeprom, u8 *data)
+{
+       int i;
+       int imax;
+
+       DBG(1, "Reading %d bytes at %d(0x%x)\n",
+               eeprom->len, eeprom->offset, eeprom->offset);
+       imax = smc_ethtool_geteeprom_len(dev);
+       for (i = 0; i < eeprom->len; i += 2) {
+               int ret;
+               u16 wbuf;
+               int offset = i + eeprom->offset;
+               if (offset > imax)
+                       break;
+               ret = smc_read_eeprom_word(dev, offset >> 1, &wbuf);
+               if (ret != 0)
+                       return ret;
+               DBG(2, "Read 0x%x from 0x%x\n", wbuf, offset >> 1);
+               data[i] = (wbuf >> 8) & 0xff;
+               data[i+1] = wbuf & 0xff;
+       }
+       return 0;
+}
+
+static int smc_ethtool_seteeprom(struct net_device *dev,
+               struct ethtool_eeprom *eeprom, u8 *data)
+{
+       int i;
+       int imax;
+
+       DBG(1, "Writing %d bytes to %d(0x%x)\n",
+                       eeprom->len, eeprom->offset, eeprom->offset);
+       imax = smc_ethtool_geteeprom_len(dev);
+       for (i = 0; i < eeprom->len; i += 2) {
+               int ret;
+               u16 wbuf;
+               int offset = i + eeprom->offset;
+               if (offset > imax)
+                       break;
+               wbuf = (data[i] << 8) | data[i + 1];
+               DBG(2, "Writing 0x%x to 0x%x\n", wbuf, offset >> 1);
+               ret = smc_write_eeprom_word(dev, offset >> 1, wbuf);
+               if (ret != 0)
+                       return ret;
+       }
+       return 0;
+}
+
+
 static const struct ethtool_ops smc_ethtool_ops = {
        .get_settings   = smc_ethtool_getsettings,
        .set_settings   = smc_ethtool_setsettings,
@@ -1652,8 +1763,22 @@ static const struct ethtool_ops smc_ethtool_ops = {
        .set_msglevel   = smc_ethtool_setmsglevel,
        .nway_reset     = smc_ethtool_nwayreset,
        .get_link       = ethtool_op_get_link,
-//     .get_eeprom     = smc_ethtool_geteeprom,
-//     .set_eeprom     = smc_ethtool_seteeprom,
+       .get_eeprom_len = smc_ethtool_geteeprom_len,
+       .get_eeprom     = smc_ethtool_geteeprom,
+       .set_eeprom     = smc_ethtool_seteeprom,
+};
+
+static const struct net_device_ops smc_netdev_ops = {
+       .ndo_open               = smc_open,
+       .ndo_stop               = smc_close,
+       .ndo_start_xmit         = smc_hard_start_xmit,
+       .ndo_tx_timeout         = smc_timeout,
+       .ndo_set_multicast_list = smc_set_multicast_list,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = eth_mac_addr,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = smc_poll_controller,
+#endif
 };
 
 /*
@@ -1865,16 +1990,9 @@ static int __devinit smc_probe(struct net_device *dev, void __iomem *ioaddr,
        /* Fill in the fields of the device structure with ethernet values. */
        ether_setup(dev);
 
-       dev->open = smc_open;
-       dev->stop = smc_close;
-       dev->hard_start_xmit = smc_hard_start_xmit;
-       dev->tx_timeout = smc_timeout;
        dev->watchdog_timeo = msecs_to_jiffies(watchdog);
-       dev->set_multicast_list = smc_set_multicast_list;
+       dev->netdev_ops = &smc_netdev_ops;
        dev->ethtool_ops = &smc_ethtool_ops;
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       dev->poll_controller = smc_poll_controller;
-#endif
 
        tasklet_init(&lp->tx_task, smc_hardware_send_pkt, (unsigned long)dev);
        INIT_WORK(&lp->phy_configure, smc_phy_configure);
index c4ccd121bc9c648ba90a2bbf8e3c110e2bacb187..ed9ae43523a12e88ec4e2ffada52d2f3844eea55 100644 (file)
@@ -1141,6 +1141,16 @@ static const char * chip_ids[ 16 ] =  {
 
 #define SMC_GET_MII(lp)                SMC_inw(ioaddr, MII_REG(lp))
 
+#define SMC_GET_GP(lp)         SMC_inw(ioaddr, GP_REG(lp))
+
+#define SMC_SET_GP(lp, x)                                              \
+       do {                                                            \
+               if (SMC_MUST_ALIGN_WRITE(lp))                           \
+                       SMC_outl((x)<<16, ioaddr, SMC_REG(lp, 8, 1));   \
+               else                                                    \
+                       SMC_outw(x, ioaddr, GP_REG(lp));                \
+       } while (0)
+
 #define SMC_SET_MII(lp, x)             SMC_outw(x, ioaddr, MII_REG(lp))
 
 #define SMC_GET_MIR(lp)                SMC_inw(ioaddr, MIR_REG(lp))
index 9a78daec2fe9268d3972f3dc8e3206cb6c2e46c8..dceae8a65809c079048797654f337b4cae372655 100644 (file)
@@ -368,48 +368,53 @@ out:
        return reg;
 }
 
-/* Autodetects and initialises external phy for SMSC9115 and SMSC9117 flavors.
- * If something goes wrong, returns -ENODEV to revert back to internal phy.
- * Performed at initialisation only, so interrupts are enabled */
-static int smsc911x_phy_initialise_external(struct smsc911x_data *pdata)
+/* Switch to external phy. Assumes tx and rx are stopped. */
+static void smsc911x_phy_enable_external(struct smsc911x_data *pdata)
 {
        unsigned int hwcfg = smsc911x_reg_read(pdata, HW_CFG);
 
-       /* External phy is requested, supported, and detected */
-       if (hwcfg & HW_CFG_EXT_PHY_DET_) {
+       /* Disable phy clocks to the MAC */
+       hwcfg &= (~HW_CFG_PHY_CLK_SEL_);
+       hwcfg |= HW_CFG_PHY_CLK_SEL_CLK_DIS_;
+       smsc911x_reg_write(pdata, HW_CFG, hwcfg);
+       udelay(10);     /* Enough time for clocks to stop */
 
-               /* Switch to external phy. Assuming tx and rx are stopped
-                * because smsc911x_phy_initialise is called before
-                * smsc911x_rx_initialise and tx_initialise. */
+       /* Switch to external phy */
+       hwcfg |= HW_CFG_EXT_PHY_EN_;
+       smsc911x_reg_write(pdata, HW_CFG, hwcfg);
 
-               /* Disable phy clocks to the MAC */
-               hwcfg &= (~HW_CFG_PHY_CLK_SEL_);
-               hwcfg |= HW_CFG_PHY_CLK_SEL_CLK_DIS_;
-               smsc911x_reg_write(pdata, HW_CFG, hwcfg);
-               udelay(10);     /* Enough time for clocks to stop */
+       /* Enable phy clocks to the MAC */
+       hwcfg &= (~HW_CFG_PHY_CLK_SEL_);
+       hwcfg |= HW_CFG_PHY_CLK_SEL_EXT_PHY_;
+       smsc911x_reg_write(pdata, HW_CFG, hwcfg);
+       udelay(10);     /* Enough time for clocks to restart */
 
-               /* Switch to external phy */
-               hwcfg |= HW_CFG_EXT_PHY_EN_;
-               smsc911x_reg_write(pdata, HW_CFG, hwcfg);
-
-               /* Enable phy clocks to the MAC */
-               hwcfg &= (~HW_CFG_PHY_CLK_SEL_);
-               hwcfg |= HW_CFG_PHY_CLK_SEL_EXT_PHY_;
-               smsc911x_reg_write(pdata, HW_CFG, hwcfg);
-               udelay(10);     /* Enough time for clocks to restart */
+       hwcfg |= HW_CFG_SMI_SEL_;
+       smsc911x_reg_write(pdata, HW_CFG, hwcfg);
+}
 
-               hwcfg |= HW_CFG_SMI_SEL_;
-               smsc911x_reg_write(pdata, HW_CFG, hwcfg);
+/* Autodetects and enables external phy if present on supported chips.
+ * autodetection can be overridden by specifying SMSC911X_FORCE_INTERNAL_PHY
+ * or SMSC911X_FORCE_EXTERNAL_PHY in the platform_data flags. */
+static void smsc911x_phy_initialise_external(struct smsc911x_data *pdata)
+{
+       unsigned int hwcfg = smsc911x_reg_read(pdata, HW_CFG);
 
-               SMSC_TRACE(HW, "Successfully switched to external PHY");
+       if (pdata->config.flags & SMSC911X_FORCE_INTERNAL_PHY) {
+               SMSC_TRACE(HW, "Forcing internal PHY");
+               pdata->using_extphy = 0;
+       } else if (pdata->config.flags & SMSC911X_FORCE_EXTERNAL_PHY) {
+               SMSC_TRACE(HW, "Forcing external PHY");
+               smsc911x_phy_enable_external(pdata);
+               pdata->using_extphy = 1;
+       } else if (hwcfg & HW_CFG_EXT_PHY_DET_) {
+               SMSC_TRACE(HW, "HW_CFG EXT_PHY_DET set, using external PHY");
+               smsc911x_phy_enable_external(pdata);
                pdata->using_extphy = 1;
        } else {
-               SMSC_WARNING(HW, "No external PHY detected, "
-                       "Using internal PHY instead.");
-               /* Use internal phy */
-               return -ENODEV;
+               SMSC_TRACE(HW, "HW_CFG EXT_PHY_DET clear, using internal PHY");
+               pdata->using_extphy = 0;
        }
-       return 0;
 }
 
 /* Fetches a tx status out of the status fifo */
@@ -769,7 +774,7 @@ static int smsc911x_mii_probe(struct net_device *dev)
                return -ENODEV;
        }
 
-       phydev = phy_connect(dev, phydev->dev.bus_id,
+       phydev = phy_connect(dev, dev_name(&phydev->dev),
                &smsc911x_phy_adjust_link, 0, pdata->config.phy_interface);
 
        if (IS_ERR(phydev)) {
@@ -778,7 +783,8 @@ static int smsc911x_mii_probe(struct net_device *dev)
        }
 
        pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
-               dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
+               dev->name, phydev->drv->name,
+               dev_name(&phydev->dev), phydev->irq);
 
        /* mask with MAC supported features */
        phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
@@ -824,22 +830,18 @@ static int __devinit smsc911x_mii_init(struct platform_device *pdev,
 
        pdata->mii_bus->parent = &pdev->dev;
 
-       pdata->using_extphy = 0;
-
        switch (pdata->idrev & 0xFFFF0000) {
        case 0x01170000:
        case 0x01150000:
        case 0x117A0000:
        case 0x115A0000:
                /* External PHY supported, try to autodetect */
-               if (smsc911x_phy_initialise_external(pdata) < 0) {
-                       SMSC_TRACE(HW, "No external PHY detected, "
-                               "using internal PHY");
-               }
+               smsc911x_phy_initialise_external(pdata);
                break;
        default:
                SMSC_TRACE(HW, "External PHY is not supported, "
                        "using internal PHY");
+               pdata->using_extphy = 0;
                break;
        }
 
@@ -984,7 +986,7 @@ static int smsc911x_poll(struct napi_struct *napi, int budget)
                        /* We processed all packets available.  Tell NAPI it can
                         * stop polling then re-enable rx interrupts */
                        smsc911x_reg_write(pdata, INT_STS, INT_STS_RSFL_);
-                       netif_rx_complete(napi);
+                       napi_complete(napi);
                        temp = smsc911x_reg_read(pdata, INT_EN);
                        temp |= INT_EN_RSFL_EN_;
                        smsc911x_reg_write(pdata, INT_EN, temp);
@@ -1246,7 +1248,7 @@ static int smsc911x_open(struct net_device *dev)
        napi_enable(&pdata->napi);
 
        temp = smsc911x_reg_read(pdata, INT_EN);
-       temp |= (INT_EN_TDFA_EN_ | INT_EN_RSFL_EN_);
+       temp |= (INT_EN_TDFA_EN_ | INT_EN_RSFL_EN_ | INT_EN_RXSTOP_INT_EN_);
        smsc911x_reg_write(pdata, INT_EN, temp);
 
        spin_lock_irq(&pdata->mac_lock);
@@ -1418,11 +1420,6 @@ static void smsc911x_set_multicast_list(struct net_device *dev)
 
                        /* Request the hardware to stop, then perform the
                         * update when we get an RX_STOP interrupt */
-                       smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_);
-                       temp = smsc911x_reg_read(pdata, INT_EN);
-                       temp |= INT_EN_RXSTOP_INT_EN_;
-                       smsc911x_reg_write(pdata, INT_EN, temp);
-
                        temp = smsc911x_mac_read(pdata, MAC_CR);
                        temp &= ~(MAC_CR_RXEN_);
                        smsc911x_mac_write(pdata, MAC_CR, temp);
@@ -1461,11 +1458,9 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
                /* Called when there is a multicast update scheduled and
                 * it is now safe to complete the update */
                SMSC_TRACE(INTR, "RX Stop interrupt");
-               temp = smsc911x_reg_read(pdata, INT_EN);
-               temp &= (~INT_EN_RXSTOP_INT_EN_);
-               smsc911x_reg_write(pdata, INT_EN, temp);
                smsc911x_reg_write(pdata, INT_STS, INT_STS_RXSTOP_INT_);
-               smsc911x_rx_multicast_update_workaround(pdata);
+               if (pdata->multicast_update_pending)
+                       smsc911x_rx_multicast_update_workaround(pdata);
                serviced = IRQ_HANDLED;
        }
 
@@ -1485,16 +1480,16 @@ static irqreturn_t smsc911x_irqhandler(int irq, void *dev_id)
        }
 
        if (likely(intsts & inten & INT_STS_RSFL_)) {
-               if (likely(netif_rx_schedule_prep(&pdata->napi))) {
+               if (likely(napi_schedule_prep(&pdata->napi))) {
                        /* Disable Rx interrupts */
                        temp = smsc911x_reg_read(pdata, INT_EN);
                        temp &= (~INT_EN_RSFL_EN_);
                        smsc911x_reg_write(pdata, INT_EN, temp);
                        /* Schedule a NAPI poll */
-                       __netif_rx_schedule(&pdata->napi);
+                       __napi_schedule(&pdata->napi);
                } else {
                        SMSC_WARNING(RX_ERR,
-                               "netif_rx_schedule_prep failed");
+                               "napi_schedule_prep failed");
                }
                serviced = IRQ_HANDLED;
        }
@@ -1545,7 +1540,7 @@ static void smsc911x_ethtool_getdrvinfo(struct net_device *dev,
 {
        strlcpy(info->driver, SMSC_CHIPNAME, sizeof(info->driver));
        strlcpy(info->version, SMSC_DRV_VERSION, sizeof(info->version));
-       strlcpy(info->bus_info, dev->dev.parent->bus_id,
+       strlcpy(info->bus_info, dev_name(dev->dev.parent),
                sizeof(info->bus_info));
 }
 
@@ -1747,6 +1742,21 @@ static const struct net_device_ops smsc911x_netdev_ops = {
 #endif
 };
 
+/* copies the current mac address from hardware to dev->dev_addr */
+static void __devinit smsc911x_read_mac_address(struct net_device *dev)
+{
+       struct smsc911x_data *pdata = netdev_priv(dev);
+       u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH);
+       u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL);
+
+       dev->dev_addr[0] = (u8)(mac_low32);
+       dev->dev_addr[1] = (u8)(mac_low32 >> 8);
+       dev->dev_addr[2] = (u8)(mac_low32 >> 16);
+       dev->dev_addr[3] = (u8)(mac_low32 >> 24);
+       dev->dev_addr[4] = (u8)(mac_high16);
+       dev->dev_addr[5] = (u8)(mac_high16 >> 8);
+}
+
 /* Initializing private device structures, only called from probe */
 static int __devinit smsc911x_init(struct net_device *dev)
 {
@@ -1834,6 +1844,12 @@ static int __devinit smsc911x_init(struct net_device *dev)
                SMSC_WARNING(PROBE,
                        "This driver is not intended for this chip revision");
 
+       /* workaround for platforms without an eeprom, where the mac address
+        * is stored elsewhere and set by the bootloader.  This saves the
+        * mac address before resetting the device */
+       if (pdata->config.flags & SMSC911X_SAVE_MAC_ADDRESS)
+               smsc911x_read_mac_address(dev);
+
        /* Reset the LAN911x */
        if (smsc911x_soft_reset(pdata))
                return -ENODEV;
@@ -1892,9 +1908,9 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
        struct net_device *dev;
        struct smsc911x_data *pdata;
        struct smsc911x_platform_config *config = pdev->dev.platform_data;
-       struct resource *res;
+       struct resource *res, *irq_res;
        unsigned int intcfg = 0;
-       int res_size;
+       int res_size, irq_flags;
        int retval;
        DECLARE_MAC_BUF(mac);
 
@@ -1919,6 +1935,14 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
        }
        res_size = res->end - res->start;
 
+       irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       if (!irq_res) {
+               pr_warning("%s: Could not allocate irq resource.\n",
+                       SMSC_CHIPNAME);
+               retval = -ENODEV;
+               goto out_0;
+       }
+
        if (!request_mem_region(res->start, res_size, SMSC_CHIPNAME)) {
                retval = -EBUSY;
                goto out_0;
@@ -1935,7 +1959,8 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
 
        pdata = netdev_priv(dev);
 
-       dev->irq = platform_get_irq(pdev, 0);
+       dev->irq = irq_res->start;
+       irq_flags = irq_res->flags & IRQF_TRIGGER_MASK;
        pdata->ioaddr = ioremap_nocache(res->start, res_size);
 
        /* copy config parameters across to pdata */
@@ -1968,8 +1993,8 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
        smsc911x_reg_write(pdata, INT_EN, 0);
        smsc911x_reg_write(pdata, INT_STS, 0xFFFFFFFF);
 
-       retval = request_irq(dev->irq, smsc911x_irqhandler, IRQF_DISABLED,
-                            dev->name, dev);
+       retval = request_irq(dev->irq, smsc911x_irqhandler,
+                            irq_flags | IRQF_SHARED, dev->name, dev);
        if (retval) {
                SMSC_WARNING(PROBE,
                        "Unable to claim requested irq: %d", dev->irq);
@@ -2005,14 +2030,7 @@ static int __devinit smsc911x_drv_probe(struct platform_device *pdev)
        } else {
                /* Try reading mac address from device. if EEPROM is present
                 * it will already have been set */
-               u32 mac_high16 = smsc911x_mac_read(pdata, ADDRH);
-               u32 mac_low32 = smsc911x_mac_read(pdata, ADDRL);
-               dev->dev_addr[0] = (u8)(mac_low32);
-               dev->dev_addr[1] = (u8)(mac_low32 >> 8);
-               dev->dev_addr[2] = (u8)(mac_low32 >> 16);
-               dev->dev_addr[3] = (u8)(mac_low32 >> 24);
-               dev->dev_addr[4] = (u8)(mac_high16);
-               dev->dev_addr[5] = (u8)(mac_high16 >> 8);
+               smsc911x_read_mac_address(dev);
 
                if (is_valid_ether_addr(dev->dev_addr)) {
                        /* eeprom values are valid  so use them */
index 4e15ae068b3ffdfb64bb974d7f6e9080e13f3c97..17560dbcc7ad7102a9fbacdd7d2af0a4ca7417f4 100644 (file)
@@ -670,7 +670,7 @@ static irqreturn_t smsc9420_isr(int irq, void *dev_id)
                        smsc9420_pci_flush_write(pd);
 
                        ints_to_clear |= (DMAC_STS_RX_ | DMAC_STS_NIS_);
-                       netif_rx_schedule(&pd->napi);
+                       napi_schedule(&pd->napi);
                }
 
                if (ints_to_clear)
@@ -893,7 +893,7 @@ static int smsc9420_rx_poll(struct napi_struct *napi, int budget)
        smsc9420_pci_flush_write(pd);
 
        if (work_done < budget) {
-               netif_rx_complete(&pd->napi);
+               napi_complete(&pd->napi);
 
                /* re-enable RX DMA interrupts */
                dma_intr_ena = smsc9420_reg_read(pd, DMAC_INTR_ENA);
@@ -1160,7 +1160,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
        smsc_info(PROBE, "PHY addr %d, phy_id 0x%08X", phydev->addr,
                phydev->phy_id);
 
-       phydev = phy_connect(dev, phydev->dev.bus_id,
+       phydev = phy_connect(dev, dev_name(&phydev->dev),
                &smsc9420_phy_adjust_link, 0, PHY_INTERFACE_MODE_MII);
 
        if (IS_ERR(phydev)) {
@@ -1169,7 +1169,7 @@ static int smsc9420_mii_probe(struct net_device *dev)
        }
 
        pr_info("%s: attached PHY driver [%s] (mii_bus:phy_addr=%s, irq=%d)\n",
-               dev->name, phydev->drv->name, phydev->dev.bus_id, phydev->irq);
+               dev->name, phydev->drv->name, dev_name(&phydev->dev), phydev->irq);
 
        /* mask with MAC supported features */
        phydev->supported &= (PHY_BASIC_FEATURES | SUPPORTED_Pause |
index 88d2c67788dfd2ab8fb692b575b98e2f2066ec6d..7f6b4a4052eed1ef5e46a3cfcdea456fe636cc46 100644 (file)
@@ -1301,7 +1301,7 @@ static int spider_net_poll(struct napi_struct *napi, int budget)
        /* if all packets are in the stack, enable interrupts and return 0 */
        /* if not, return 1 */
        if (packets_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                spider_net_rx_irq_on(card);
                card->ignore_rx_ramfull = 0;
        }
@@ -1528,7 +1528,7 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                        spider_net_refill_rx_chain(card);
                        spider_net_enable_rxdmac(card);
                        card->num_rx_ints ++;
-                       netif_rx_schedule(&card->napi);
+                       napi_schedule(&card->napi);
                }
                show_error = 0;
                break;
@@ -1548,7 +1548,7 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                spider_net_refill_rx_chain(card);
                spider_net_enable_rxdmac(card);
                card->num_rx_ints ++;
-               netif_rx_schedule(&card->napi);
+               napi_schedule(&card->napi);
                show_error = 0;
                break;
 
@@ -1562,7 +1562,7 @@ spider_net_handle_error_irq(struct spider_net_card *card, u32 status_reg,
                spider_net_refill_rx_chain(card);
                spider_net_enable_rxdmac(card);
                card->num_rx_ints ++;
-               netif_rx_schedule(&card->napi);
+               napi_schedule(&card->napi);
                show_error = 0;
                break;
 
@@ -1656,11 +1656,11 @@ spider_net_interrupt(int irq, void *ptr)
 
        if (status_reg & SPIDER_NET_RXINT ) {
                spider_net_rx_irq_off(card);
-               netif_rx_schedule(&card->napi);
+               napi_schedule(&card->napi);
                card->num_rx_ints ++;
        }
        if (status_reg & SPIDER_NET_TXINT)
-               netif_rx_schedule(&card->napi);
+               napi_schedule(&card->napi);
 
        if (status_reg & SPIDER_NET_LINKINT)
                spider_net_link_reset(netdev);
index da3a76b18effee66075bc0a09a93ea076215a0bd..98fe79515bab97bf2f8ff8d60d5ba35c94a4fa35 100644 (file)
@@ -1342,8 +1342,8 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
                if (intr_status & (IntrRxDone | IntrRxEmpty)) {
                        u32 enable;
 
-                       if (likely(netif_rx_schedule_prep(&np->napi))) {
-                               __netif_rx_schedule(&np->napi);
+                       if (likely(napi_schedule_prep(&np->napi))) {
+                               __napi_schedule(&np->napi);
                                enable = readl(ioaddr + IntrEnable);
                                enable &= ~(IntrRxDone | IntrRxEmpty);
                                writel(enable, ioaddr + IntrEnable);
@@ -1587,7 +1587,7 @@ static int netdev_poll(struct napi_struct *napi, int budget)
                intr_status = readl(ioaddr + IntrStatus);
        } while (intr_status & (IntrRxDone | IntrRxEmpty));
 
-       netif_rx_complete(napi);
+       napi_complete(napi);
        intr_status = readl(ioaddr + IntrEnable);
        intr_status |= IntrRxDone | IntrRxEmpty;
        writel(intr_status, ioaddr + IntrEnable);
index 8d64b1da0465c99a0502c642900f325964cf0186..c3e6aa137cdf299dc374fbe3e4a30766a207b921 100644 (file)
@@ -921,7 +921,7 @@ static int gem_poll(struct napi_struct *napi, int budget)
                gp->status = readl(gp->regs + GREG_STAT);
        } while (gp->status & GREG_STAT_NAPI);
 
-       __netif_rx_complete(napi);
+       __napi_complete(napi);
        gem_enable_ints(gp);
 
        spin_unlock_irqrestore(&gp->lock, flags);
@@ -944,7 +944,7 @@ static irqreturn_t gem_interrupt(int irq, void *dev_id)
 
        spin_lock_irqsave(&gp->lock, flags);
 
-       if (netif_rx_schedule_prep(&gp->napi)) {
+       if (napi_schedule_prep(&gp->napi)) {
                u32 gem_status = readl(gp->regs + GREG_STAT);
 
                if (gem_status == 0) {
@@ -954,7 +954,7 @@ static irqreturn_t gem_interrupt(int irq, void *dev_id)
                }
                gp->status = gem_status;
                gem_disable_ints(gp);
-               __netif_rx_schedule(&gp->napi);
+               __napi_schedule(&gp->napi);
        }
 
        spin_unlock_irqrestore(&gp->lock, flags);
index bcd0e60cbda98984c9383f55cc4df671510d33a1..b52a1c088f37717ff19e82df83ee0bd4743bd352 100644 (file)
@@ -725,7 +725,7 @@ static int tc_mii_probe(struct net_device *dev)
        }
 
        /* attach the mac to the phy */
-       phydev = phy_connect(dev, phydev->dev.bus_id,
+       phydev = phy_connect(dev, dev_name(&phydev->dev),
                             &tc_handle_link_change, 0,
                             lp->chiptype == TC35815_TX4939 ?
                             PHY_INTERFACE_MODE_RMII : PHY_INTERFACE_MODE_MII);
@@ -735,7 +735,7 @@ static int tc_mii_probe(struct net_device *dev)
        }
        printk(KERN_INFO "%s: attached PHY driver [%s] "
                "(mii_bus:phy_addr=%s, id=%x)\n",
-               dev->name, phydev->drv->name, phydev->dev.bus_id,
+               dev->name, phydev->drv->name, dev_name(&phydev->dev),
                phydev->phy_id);
 
        /* mask with MAC supported features */
@@ -1609,8 +1609,8 @@ static irqreturn_t tc35815_interrupt(int irq, void *dev_id)
        if (!(dmactl & DMA_IntMask)) {
                /* disable interrupts */
                tc_writel(dmactl | DMA_IntMask, &tr->DMA_Ctl);
-               if (netif_rx_schedule_prep(&lp->napi))
-                       __netif_rx_schedule(&lp->napi);
+               if (napi_schedule_prep(&lp->napi))
+                       __napi_schedule(&lp->napi);
                else {
                        printk(KERN_ERR "%s: interrupt taken in poll\n",
                               dev->name);
@@ -1919,7 +1919,7 @@ static int tc35815_poll(struct napi_struct *napi, int budget)
        spin_unlock(&lp->lock);
 
        if (received < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                /* enable interrupts */
                tc_writel(tc_readl(&tr->DMA_Ctl) & ~DMA_IntMask, &tr->DMA_Ctl);
        }
index a7a4dc4d6313c1403794435a14b99a83f8029505..be9f38f8f0bfae3173d452e48df8b4db2f747bb6 100644 (file)
@@ -265,8 +265,8 @@ static irqreturn_t bdx_isr_napi(int irq, void *dev)
                bdx_isr_extra(priv, isr);
 
        if (isr & (IR_RX_DESC_0 | IR_TX_FREE_0)) {
-               if (likely(netif_rx_schedule_prep(&priv->napi))) {
-                       __netif_rx_schedule(&priv->napi);
+               if (likely(napi_schedule_prep(&priv->napi))) {
+                       __napi_schedule(&priv->napi);
                        RET(IRQ_HANDLED);
                } else {
                        /* NOTE: we get here if intr has slipped into window
@@ -302,7 +302,7 @@ static int bdx_poll(struct napi_struct *napi, int budget)
                 * device lock and allow waiting tasks (eg rmmod) to advance) */
                priv->napi_stop = 0;
 
-               netif_rx_complete(napi);
+               napi_complete(napi);
                bdx_enable_interrupts(priv);
        }
        return work_done;
index b080f9493d83fe70a22dd236e3eaf045ca4aaf03..67630fb8272ec0dc4a4e5f5d98491d376ef818fe 100644 (file)
@@ -860,7 +860,7 @@ static int tg3_bmcr_reset(struct tg3 *tp)
 
 static int tg3_mdio_read(struct mii_bus *bp, int mii_id, int reg)
 {
-       struct tg3 *tp = (struct tg3 *)bp->priv;
+       struct tg3 *tp = bp->priv;
        u32 val;
 
        if (tp->tg3_flags3 & TG3_FLG3_MDIOBUS_PAUSED)
@@ -874,7 +874,7 @@ static int tg3_mdio_read(struct mii_bus *bp, int mii_id, int reg)
 
 static int tg3_mdio_write(struct mii_bus *bp, int mii_id, int reg, u16 val)
 {
-       struct tg3 *tp = (struct tg3 *)bp->priv;
+       struct tg3 *tp = bp->priv;
 
        if (tp->tg3_flags3 & TG3_FLG3_MDIOBUS_PAUSED)
                return -EAGAIN;
@@ -4460,7 +4460,7 @@ static int tg3_poll(struct napi_struct *napi, int budget)
                        sblk->status &= ~SD_STATUS_UPDATED;
 
                if (likely(!tg3_has_work(tp))) {
-                       netif_rx_complete(napi);
+                       napi_complete(napi);
                        tg3_restart_ints(tp);
                        break;
                }
@@ -4470,7 +4470,7 @@ static int tg3_poll(struct napi_struct *napi, int budget)
 
 tx_recovery:
        /* work_done is guaranteed to be less than budget. */
-       netif_rx_complete(napi);
+       napi_complete(napi);
        schedule_work(&tp->reset_task);
        return work_done;
 }
@@ -4519,7 +4519,7 @@ static irqreturn_t tg3_msi_1shot(int irq, void *dev_id)
        prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
 
        if (likely(!tg3_irq_sync(tp)))
-               netif_rx_schedule(&tp->napi);
+               napi_schedule(&tp->napi);
 
        return IRQ_HANDLED;
 }
@@ -4544,7 +4544,7 @@ static irqreturn_t tg3_msi(int irq, void *dev_id)
         */
        tw32_mailbox(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
        if (likely(!tg3_irq_sync(tp)))
-               netif_rx_schedule(&tp->napi);
+               napi_schedule(&tp->napi);
 
        return IRQ_RETVAL(1);
 }
@@ -4586,7 +4586,7 @@ static irqreturn_t tg3_interrupt(int irq, void *dev_id)
        sblk->status &= ~SD_STATUS_UPDATED;
        if (likely(tg3_has_work(tp))) {
                prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
-               netif_rx_schedule(&tp->napi);
+               napi_schedule(&tp->napi);
        } else {
                /* No work, shared interrupt perhaps?  re-enable
                 * interrupts, and flush that PCI write
@@ -4632,7 +4632,7 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
        tw32_mailbox_f(MAILBOX_INTERRUPT_0 + TG3_64BIT_REG_LOW, 0x00000001);
        if (tg3_irq_sync(tp))
                goto out;
-       if (netif_rx_schedule_prep(&tp->napi)) {
+       if (napi_schedule_prep(&tp->napi)) {
                prefetch(&tp->rx_rcb[tp->rx_rcb_ptr]);
                /* Update last_tag to mark that this status has been
                 * seen. Because interrupt may be shared, we may be
@@ -4640,7 +4640,7 @@ static irqreturn_t tg3_interrupt_tagged(int irq, void *dev_id)
                 * if tg3_poll() is not scheduled.
                 */
                tp->last_tag = sblk->status_tag;
-               __netif_rx_schedule(&tp->napi);
+               __napi_schedule(&tp->napi);
        }
 out:
        return IRQ_RETVAL(handled);
index 43853e3b210e42977100f1c1b3828a3dfa9fe623..4a65fc2dd9282ffef9dc72a92a559c90b85dd7e3 100644 (file)
@@ -274,6 +274,15 @@ static void  xl_ee_write(struct net_device *dev, int ee_addr, u16 ee_value)
        
        return ; 
 }
+
+static const struct net_device_ops xl_netdev_ops = {
+       .ndo_open               = xl_open,
+       .ndo_stop               = xl_close,
+       .ndo_start_xmit         = xl_xmit,
+       .ndo_change_mtu         = xl_change_mtu,
+       .ndo_set_multicast_list = xl_set_rx_mode,
+       .ndo_set_mac_address    = xl_set_mac_address,
+};
  
 static int __devinit xl_probe(struct pci_dev *pdev,
                              const struct pci_device_id *ent) 
@@ -337,13 +346,7 @@ static int __devinit xl_probe(struct pci_dev *pdev,
                return i ; 
        }                               
 
-       dev->open=&xl_open;
-       dev->hard_start_xmit=&xl_xmit;
-       dev->change_mtu=&xl_change_mtu;
-       dev->stop=&xl_close;
-       dev->do_ioctl=NULL;
-       dev->set_multicast_list=&xl_set_rx_mode;
-       dev->set_mac_address=&xl_set_mac_address ; 
+       dev->netdev_ops = &xl_netdev_ops;
        SET_NETDEV_DEV(dev, &pdev->dev);
 
        pci_set_drvdata(pdev,dev) ; 
index b566d6d79ecdbe7ce0a5f58f7546f50e77600ec5..b9db1b5a58a3db04af268a0c5148ac147aa40c89 100644 (file)
@@ -92,6 +92,8 @@ static void abyss_sifwritew(struct net_device *dev, unsigned short val, unsigned
        outw(val, dev->base_addr + reg);
 }
 
+static struct net_device_ops abyss_netdev_ops;
+
 static int __devinit abyss_attach(struct pci_dev *pdev, const struct pci_device_id *ent)
 {      
        static int versionprinted;
@@ -157,8 +159,7 @@ static int __devinit abyss_attach(struct pci_dev *pdev, const struct pci_device_
 
        memcpy(tp->ProductID, "Madge PCI 16/4 Mk2", PROD_ID_SIZE + 1);
                
-       dev->open = abyss_open;
-       dev->stop = abyss_close;
+       dev->netdev_ops = &abyss_netdev_ops;
 
        pci_set_drvdata(pdev, dev);
        SET_NETDEV_DEV(dev, &pdev->dev);
@@ -450,6 +451,11 @@ static struct pci_driver abyss_driver = {
 
 static int __init abyss_init (void)
 {
+       abyss_netdev_ops = tms380tr_netdev_ops;
+
+       abyss_netdev_ops.ndo_open = abyss_open;
+       abyss_netdev_ops.ndo_stop = abyss_close;
+
        return pci_register_driver(&abyss_driver);
 }
 
index fa7bce6e0c6dc56019d18197b2076ddfd3e6a3d8..9d896116cf761b6aea8a6b294a2da95fa07238f5 100644 (file)
@@ -200,7 +200,6 @@ static void         tr_rx(struct net_device *dev);
 static void    ibmtr_reset_timer(struct timer_list*tmr,struct net_device *dev);
 static void    tok_rerun(unsigned long dev_addr);
 static void    ibmtr_readlog(struct net_device *dev);
-static struct  net_device_stats *tok_get_stats(struct net_device *dev);
 static int     ibmtr_change_mtu(struct net_device *dev, int mtu);
 static void    find_turbo_adapters(int *iolist);
 
@@ -816,18 +815,21 @@ static unsigned char __devinit get_sram_size(struct tok_info *adapt_info)
 
 /*****************************************************************************/
 
+static const struct net_device_ops trdev_netdev_ops = {
+       .ndo_open               = tok_open,
+       .ndo_stop               = tok_close,
+       .ndo_start_xmit         = tok_send_packet,
+       .ndo_set_multicast_list = tok_set_multicast_list,
+       .ndo_change_mtu         = ibmtr_change_mtu,
+};
+
 static int __devinit trdev_init(struct net_device *dev)
 {
        struct tok_info *ti = netdev_priv(dev);
 
        SET_PAGE(ti->srb_page);
         ti->open_failure = NO    ;
-       dev->open = tok_open;
-       dev->stop = tok_close;
-       dev->hard_start_xmit = tok_send_packet;
-       dev->get_stats = tok_get_stats;
-       dev->set_multicast_list = tok_set_multicast_list;
-       dev->change_mtu = ibmtr_change_mtu;
+       dev->netdev_ops = &trdev_netdev_ops;
 
        return 0;
 }
@@ -1460,7 +1462,7 @@ static irqreturn_t tok_interrupt(int irq, void *dev_id)
                                        "%02X\n",
                                        (int)retcode, (int)readb(ti->ssb + 6));
                        else
-                               ti->tr_stats.tx_packets++;
+                               dev->stats.tx_packets++;
                        break;
                case XMIT_XID_CMD:
                        DPRINTK("xmit xid ret_code: %02X\n",
@@ -1646,7 +1648,7 @@ static void tr_tx(struct net_device *dev)
                break;
        }
        writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
-       ti->tr_stats.tx_bytes += ti->current_skb->len;
+       dev->stats.tx_bytes += ti->current_skb->len;
        dev_kfree_skb_irq(ti->current_skb);
        ti->current_skb = NULL;
        netif_wake_queue(dev);
@@ -1722,7 +1724,7 @@ static void tr_rx(struct net_device *dev)
        if (readb(llc + offsetof(struct trllc, llc)) != UI_CMD) {
                SET_PAGE(ti->asb_page);
                writeb(DATA_LOST, ti->asb + RETCODE_OFST);
-               ti->tr_stats.rx_dropped++;
+               dev->stats.rx_dropped++;
                writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
                return;
        }
@@ -1757,7 +1759,7 @@ static void tr_rx(struct net_device *dev)
 
        if (!(skb = dev_alloc_skb(skb_size))) {
                DPRINTK("out of memory. frame dropped.\n");
-               ti->tr_stats.rx_dropped++;
+               dev->stats.rx_dropped++;
                SET_PAGE(ti->asb_page);
                writeb(DATA_LOST, ti->asb + offsetof(struct asb_rec, ret_code));
                writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
@@ -1813,8 +1815,8 @@ static void tr_rx(struct net_device *dev)
 
        writeb(RESP_IN_ASB, ti->mmio + ACA_OFFSET + ACA_SET + ISRA_ODD);
 
-       ti->tr_stats.rx_bytes += skb->len;
-       ti->tr_stats.rx_packets++;
+       dev->stats.rx_bytes += skb->len;
+       dev->stats.rx_packets++;
 
        skb->protocol = tr_type_trans(skb, dev);
        if (IPv4_p) {
@@ -1876,21 +1878,6 @@ static void ibmtr_readlog(struct net_device *dev)
 
 /*****************************************************************************/
 
-/* tok_get_stats():  Basically a scaffold routine which will return
-   the address of the tr_statistics structure associated with
-   this device -- the tr.... structure is an ethnet look-alike
-   so at least for this iteration may suffice.   */
-
-static struct net_device_stats *tok_get_stats(struct net_device *dev)
-{
-
-       struct tok_info *toki;
-       toki = netdev_priv(dev);
-       return (struct net_device_stats *) &toki->tr_stats;
-}
-
-/*****************************************************************************/
-
 static int ibmtr_change_mtu(struct net_device *dev, int mtu)
 {
        struct tok_info *ti = netdev_priv(dev);
index 239c75217b120624d7ae500ce919552a869507b5..f309b8f703bd9fa828f338f62f234815b22ee54a 100644 (file)
@@ -207,7 +207,6 @@ static int streamer_xmit(struct sk_buff *skb, struct net_device *dev);
 static int streamer_close(struct net_device *dev);
 static void streamer_set_rx_mode(struct net_device *dev);
 static irqreturn_t streamer_interrupt(int irq, void *dev_id);
-static struct net_device_stats *streamer_get_stats(struct net_device *dev);
 static int streamer_set_mac_address(struct net_device *dev, void *addr);
 static void streamer_arb_cmd(struct net_device *dev);
 static int streamer_change_mtu(struct net_device *dev, int mtu);
@@ -222,6 +221,18 @@ struct streamer_private *dev_streamer=NULL;
 #endif
 #endif
 
+static const struct net_device_ops streamer_netdev_ops = {
+       .ndo_open               = streamer_open,
+       .ndo_stop               = streamer_close,
+       .ndo_start_xmit         = streamer_xmit,
+       .ndo_change_mtu         = streamer_change_mtu,
+#if STREAMER_IOCTL
+       .ndo_do_ioctl           = streamer_ioctl,
+#endif
+       .ndo_set_multicast_list = streamer_set_rx_mode,
+       .ndo_set_mac_address    = streamer_set_mac_address,
+};
+
 static int __devinit streamer_init_one(struct pci_dev *pdev,
                                       const struct pci_device_id *ent)
 {
@@ -321,18 +332,7 @@ static int __devinit streamer_init_one(struct pci_dev *pdev,
        init_waitqueue_head(&streamer_priv->srb_wait);
        init_waitqueue_head(&streamer_priv->trb_wait);
 
-       dev->open = &streamer_open;
-       dev->hard_start_xmit = &streamer_xmit;
-       dev->change_mtu = &streamer_change_mtu;
-       dev->stop = &streamer_close;
-#if STREAMER_IOCTL
-       dev->do_ioctl = &streamer_ioctl;
-#else
-       dev->do_ioctl = NULL;
-#endif
-       dev->set_multicast_list = &streamer_set_rx_mode;
-       dev->get_stats = &streamer_get_stats;
-       dev->set_mac_address = &streamer_set_mac_address;
+       dev->netdev_ops = &streamer_netdev_ops;
        dev->irq = pdev->irq;
        dev->base_addr=pio_start;
        SET_NETDEV_DEV(dev, &pdev->dev);
@@ -616,8 +616,6 @@ static int streamer_open(struct net_device *dev)
        printk("SISR Mask = %04x\n", readw(streamer_mmio + SISR_MASK));
 #endif
        do {
-               int i;
-
                for (i = 0; i < SRB_COMMAND_SIZE; i += 2) {
                        writew(0, streamer_mmio + LAPDINC);
                }
@@ -937,7 +935,7 @@ static void streamer_rx(struct net_device *dev)
                        if (skb == NULL) 
                        {
                                printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n", dev->name);
-                               streamer_priv->streamer_stats.rx_dropped++;
+                               dev->stats.rx_dropped++;
                        } else {        /* we allocated an skb OK */
                                if (buffer_cnt == 1) {
                                        /* release the DMA mapping */
@@ -1009,8 +1007,8 @@ static void streamer_rx(struct net_device *dev)
                                        /* send up to the protocol */
                                        netif_rx(skb);
                                }
-                               streamer_priv->streamer_stats.rx_packets++;
-                               streamer_priv->streamer_stats.rx_bytes += length;
+                               dev->stats.rx_packets++;
+                               dev->stats.rx_bytes += length;
                        }       /* if skb == null */
                }               /* end received without errors */
 
@@ -1053,8 +1051,8 @@ static irqreturn_t streamer_interrupt(int irq, void *dev_id)
                                while(streamer_priv->streamer_tx_ring[(streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1)].status) {
                                streamer_priv->tx_ring_last_status = (streamer_priv->tx_ring_last_status + 1) & (STREAMER_TX_RING_SIZE - 1);
                                streamer_priv->free_tx_ring_entries++;
-                               streamer_priv->streamer_stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len;
-                               streamer_priv->streamer_stats.tx_packets++;
+                               dev->stats.tx_bytes += streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]->len;
+                               dev->stats.tx_packets++;
                                dev_kfree_skb_irq(streamer_priv->tx_ring_skb[streamer_priv->tx_ring_last_status]);
                                streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].buffer = 0xdeadbeef;
                                streamer_priv->streamer_tx_ring[streamer_priv->tx_ring_last_status].status = 0;
@@ -1484,13 +1482,6 @@ static void streamer_srb_bh(struct net_device *dev)
        }                       /* switch srb[0] */
 }
 
-static struct net_device_stats *streamer_get_stats(struct net_device *dev)
-{
-       struct streamer_private *streamer_priv;
-       streamer_priv = netdev_priv(dev);
-       return (struct net_device_stats *) &streamer_priv->streamer_stats;
-}
-
 static int streamer_set_mac_address(struct net_device *dev, void *addr)
 {
        struct sockaddr *saddr = addr;
index 13ccee6449c1314a08db9e1863f2f0619fadf9c8..3c58d6a3fbc98a5420975b1f4182915840235c0a 100644 (file)
@@ -299,7 +299,6 @@ struct streamer_private {
        int tx_ring_free, tx_ring_last_status, rx_ring_last_received,
            free_tx_ring_entries;
 
-       struct net_device_stats streamer_stats;
        __u16 streamer_lan_status;
        __u8 streamer_ring_speed;
        __u16 pkt_buf_sz;
index 917b4d201e099da1aa3ed3a7b64f78ea4a5aceed..193308118f95a58f225e6f84a6e4ddf1ec678eb5 100644 (file)
@@ -692,8 +692,6 @@ static int madgemc_mcaproc(char *buf, int slot, void *d)
        
        len += sprintf(buf+len, "-------\n");
        if (curcard) {
-               struct net_local *tp = netdev_priv(dev);
-               
                len += sprintf(buf+len, "Card Revision: %d\n", curcard->cardrev);
                len += sprintf(buf+len, "RAM Size: %dkb\n", curcard->ramsize);
                len += sprintf(buf+len, "Cable type: %s\n", (curcard->cabletype)?"STP/DB9":"UTP/RJ-45");
index ecb5c7c969105ff6d79622f17f50a47c6ea3bd3e..d068a9d36883028d350eaf248d35a6332f722bef 100644 (file)
@@ -187,7 +187,6 @@ static int olympic_close(struct net_device *dev);
 static void olympic_set_rx_mode(struct net_device *dev);
 static void olympic_freemem(struct net_device *dev) ;  
 static irqreturn_t olympic_interrupt(int irq, void *dev_id);
-static struct net_device_stats * olympic_get_stats(struct net_device *dev);
 static int olympic_set_mac_address(struct net_device *dev, void *addr) ; 
 static void olympic_arb_cmd(struct net_device *dev);
 static int olympic_change_mtu(struct net_device *dev, int mtu);
@@ -195,6 +194,15 @@ static void olympic_srb_bh(struct net_device *dev) ;
 static void olympic_asb_bh(struct net_device *dev) ; 
 static int olympic_proc_info(char *buffer, char **start, off_t offset, int length, int *eof, void *data) ; 
 
+static const struct net_device_ops olympic_netdev_ops = {
+       .ndo_open               = olympic_open,
+       .ndo_stop               = olympic_close,
+       .ndo_start_xmit         = olympic_xmit,
+       .ndo_change_mtu         = olympic_change_mtu,
+       .ndo_set_multicast_list = olympic_set_rx_mode,
+       .ndo_set_mac_address    = olympic_set_mac_address,
+};
+
 static int __devinit olympic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        struct net_device *dev ; 
@@ -253,14 +261,7 @@ static int __devinit olympic_probe(struct pci_dev *pdev, const struct pci_device
                goto op_free_iomap;
        }                               
 
-       dev->open=&olympic_open;
-       dev->hard_start_xmit=&olympic_xmit;
-       dev->change_mtu=&olympic_change_mtu;
-       dev->stop=&olympic_close;
-       dev->do_ioctl=NULL;
-       dev->set_multicast_list=&olympic_set_rx_mode;
-       dev->get_stats=&olympic_get_stats ;
-       dev->set_mac_address=&olympic_set_mac_address ;  
+       dev->netdev_ops = &olympic_netdev_ops;
        SET_NETDEV_DEV(dev, &pdev->dev);
 
        pci_set_drvdata(pdev,dev) ; 
@@ -698,7 +699,6 @@ static int olympic_open(struct net_device *dev)
        if (olympic_priv->olympic_network_monitor) { 
                u8 __iomem *oat;
                u8 __iomem *opt;
-               int i;
                u8 addr[6];
                oat = (olympic_priv->olympic_lap + olympic_priv->olympic_addr_table_addr);
                opt = (olympic_priv->olympic_lap + olympic_priv->olympic_parms_addr);
@@ -785,7 +785,7 @@ static void olympic_rx(struct net_device *dev)
                                } 
                                olympic_priv->rx_ring_last_received += i ; 
                                olympic_priv->rx_ring_last_received &= (OLYMPIC_RX_RING_SIZE -1) ; 
-                               olympic_priv->olympic_stats.rx_errors++;         
+                               dev->stats.rx_errors++;
                        } else {        
                        
                                if (buffer_cnt == 1) {
@@ -796,7 +796,7 @@ static void olympic_rx(struct net_device *dev)
 
                                if (skb == NULL) {
                                        printk(KERN_WARNING "%s: Not enough memory to copy packet to upper layers. \n",dev->name) ;
-                                       olympic_priv->olympic_stats.rx_dropped++ ; 
+                                       dev->stats.rx_dropped++;
                                        /* Update counters even though we don't transfer the frame */
                                        olympic_priv->rx_ring_last_received += i ; 
                                        olympic_priv->rx_ring_last_received &= (OLYMPIC_RX_RING_SIZE -1) ;  
@@ -862,8 +862,8 @@ static void olympic_rx(struct net_device *dev)
                                                skb->protocol = tr_type_trans(skb,dev);
                                                netif_rx(skb) ; 
                                        } 
-                                       olympic_priv->olympic_stats.rx_packets++ ; 
-                                       olympic_priv->olympic_stats.rx_bytes += length ; 
+                                       dev->stats.rx_packets++ ;
+                                       dev->stats.rx_bytes += length ;
                                } /* if skb == null */
                        } /* If status & 0x3b */
 
@@ -971,8 +971,8 @@ static irqreturn_t olympic_interrupt(int irq, void *dev_id)
                                olympic_priv->tx_ring_last_status++;
                                olympic_priv->tx_ring_last_status &= (OLYMPIC_TX_RING_SIZE-1);
                                olympic_priv->free_tx_ring_entries++;
-                               olympic_priv->olympic_stats.tx_bytes += olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len;
-                               olympic_priv->olympic_stats.tx_packets++ ; 
+                               dev->stats.tx_bytes += olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len;
+                               dev->stats.tx_packets++ ;
                                pci_unmap_single(olympic_priv->pdev, 
                                        le32_to_cpu(olympic_priv->olympic_tx_ring[olympic_priv->tx_ring_last_status].buffer), 
                                        olympic_priv->tx_ring_skb[olympic_priv->tx_ring_last_status]->len,PCI_DMA_TODEVICE);
@@ -1344,13 +1344,6 @@ static void olympic_srb_bh(struct net_device *dev)
 
 } 
 
-static struct net_device_stats * olympic_get_stats(struct net_device *dev)
-{
-       struct olympic_private *olympic_priv ;
-       olympic_priv=netdev_priv(dev);
-       return (struct net_device_stats *) &olympic_priv->olympic_stats; 
-}
-
 static int olympic_set_mac_address (struct net_device *dev, void *addr) 
 {
        struct sockaddr *saddr = addr ; 
index 10fbba08978f4592666d92c6f4f55369589de825..30631bae4c9481e6676911e20659c285c74c2ec1 100644 (file)
@@ -275,7 +275,6 @@ struct olympic_private {
        struct sk_buff *tx_ring_skb[OLYMPIC_TX_RING_SIZE], *rx_ring_skb[OLYMPIC_RX_RING_SIZE];  
        int tx_ring_free, tx_ring_last_status, rx_ring_last_received,rx_status_last_received, free_tx_ring_entries;
 
-       struct net_device_stats olympic_stats ;
        u16 olympic_lan_status ;
        u8 olympic_ring_speed ;
        u16 pkt_buf_sz ; 
index 50eb29ce3c87c5388ffa6be35e99f29b09147584..9d7db2c8d6614ca2627622fcaeffdf8fc87c27fd 100644 (file)
@@ -61,7 +61,8 @@
 
 #include "smctr.h"               /* Our Stuff */
 
-static char version[] __initdata = KERN_INFO "smctr.c: v1.4 7/12/00 by jschlst@samba.org\n";
+static const char version[] __initdata =
+       KERN_INFO "smctr.c: v1.4 7/12/00 by jschlst@samba.org\n";
 static const char cardname[] = "smctr";
 
 
@@ -4392,52 +4393,42 @@ static int smctr_ring_status_chg(struct net_device *dev)
         {
                 case RING_RECOVERY:
                         printk(KERN_INFO "%s: Ring Recovery\n", dev->name);
-                        tp->current_ring_status |= RING_RECOVERY;
                         break;
 
                 case SINGLE_STATION:
                         printk(KERN_INFO "%s: Single Statinon\n", dev->name);
-                        tp->current_ring_status |= SINGLE_STATION;
                         break;
 
                 case COUNTER_OVERFLOW:
                         printk(KERN_INFO "%s: Counter Overflow\n", dev->name);
-                        tp->current_ring_status |= COUNTER_OVERFLOW;
                         break;
 
                 case REMOVE_RECEIVED:
                         printk(KERN_INFO "%s: Remove Received\n", dev->name);
-                        tp->current_ring_status |= REMOVE_RECEIVED;
                         break;
 
                 case AUTO_REMOVAL_ERROR:
                         printk(KERN_INFO "%s: Auto Remove Error\n", dev->name);
-                        tp->current_ring_status |= AUTO_REMOVAL_ERROR;
                         break;
 
                 case LOBE_WIRE_FAULT:
                         printk(KERN_INFO "%s: Lobe Wire Fault\n", dev->name);
-                        tp->current_ring_status |= LOBE_WIRE_FAULT;
                         break;
 
                 case TRANSMIT_BEACON:
                         printk(KERN_INFO "%s: Transmit Beacon\n", dev->name);
-                        tp->current_ring_status |= TRANSMIT_BEACON;
                         break;
 
                 case SOFT_ERROR:
                         printk(KERN_INFO "%s: Soft Error\n", dev->name);
-                        tp->current_ring_status |= SOFT_ERROR;
                         break;
 
                 case HARD_ERROR:
                         printk(KERN_INFO "%s: Hard Error\n", dev->name);
-                        tp->current_ring_status |= HARD_ERROR;
                         break;
 
                 case SIGNAL_LOSS:
                         printk(KERN_INFO "%s: Signal Loss\n", dev->name);
-                        tp->current_ring_status |= SIGNAL_LOSS;
                         break;
 
                 default:
index 52df7dd815ccb21ad7140822cd824ea9b521e21f..6e5700ab4fc3493033ca66e28dcbac658da7de70 100644 (file)
@@ -977,7 +977,6 @@ typedef struct net_local {
        __u8            monitor_state_ready;
        __u16           ring_status;
        __u8            ring_status_flags;
-       __u8            current_ring_status;
        __u8            state;
 
        __u8            join_state;
index 5be34c2fd48385751844d82dc0c12b1e6d5390d4..b11bb72dc7abae085326c605351cd92f52c6f70d 100644 (file)
@@ -2330,6 +2330,17 @@ void tmsdev_term(struct net_device *dev)
                DMA_BIDIRECTIONAL);
 }
 
+const struct net_device_ops tms380tr_netdev_ops = {
+       .ndo_open               = tms380tr_open,
+       .ndo_stop               = tms380tr_close,
+       .ndo_start_xmit         = tms380tr_send_packet,
+       .ndo_tx_timeout         = tms380tr_timeout,
+       .ndo_get_stats          = tms380tr_get_stats,
+       .ndo_set_multicast_list = tms380tr_set_multicast_list,
+       .ndo_set_mac_address    = tms380tr_set_mac_address,
+};
+EXPORT_SYMBOL(tms380tr_netdev_ops);
+
 int tmsdev_init(struct net_device *dev, struct device *pdev)
 {
        struct net_local *tms_local;
@@ -2353,16 +2364,8 @@ int tmsdev_init(struct net_device *dev, struct device *pdev)
                return -ENOMEM;
        }
        
-       /* These can be overridden by the card driver if needed */
-       dev->open               = tms380tr_open;
-       dev->stop               = tms380tr_close;
-       dev->do_ioctl           = NULL; 
-       dev->hard_start_xmit    = tms380tr_send_packet;
-       dev->tx_timeout         = tms380tr_timeout;
+       dev->netdev_ops         = &tms380tr_netdev_ops;
        dev->watchdog_timeo     = HZ;
-       dev->get_stats          = tms380tr_get_stats;
-       dev->set_multicast_list = &tms380tr_set_multicast_list;
-       dev->set_mac_address    = tms380tr_set_mac_address;
 
        return 0;
 }
index 7af76d7088490f61b57af4adcf832c7b16a018f7..60b30ee38dcbea0dd7d1c116eff56834ec32ec8d 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/interrupt.h>
 
 /* module prototypes */
+extern const struct net_device_ops tms380tr_netdev_ops;
 int tms380tr_open(struct net_device *dev);
 int tms380tr_close(struct net_device *dev);
 irqreturn_t tms380tr_interrupt(int irq, void *dev_id);
index 5f601773c26064e7962e6bc5026018f5f1c666af..b397e8785d6d3e5c3f7eb9ba8e3683214dddf9e1 100644 (file)
@@ -157,8 +157,8 @@ static int __devinit tms_pci_attach(struct pci_dev *pdev, const struct pci_devic
 
        tp->tmspriv = cardinfo;
 
-       dev->open = tms380tr_open;
-       dev->stop = tms380tr_close;
+       dev->netdev_ops = &tms380tr_netdev_ops;
+
        pci_set_drvdata(pdev, dev);
        SET_NETDEV_DEV(dev, &pdev->dev);
 
index a9fd2b2ccaf6be90517b491bbb78f8e013fb3939..bb43e7fb2a508b35e073f89a9eca2ce4d752bec0 100644 (file)
@@ -888,7 +888,7 @@ static int tsi108_poll(struct napi_struct *napi, int budget)
 
        if (num_received < budget) {
                data->rxpending = 0;
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
                TSI_WRITE(TSI108_EC_INTMASK,
                                     TSI_READ(TSI108_EC_INTMASK)
@@ -915,11 +915,11 @@ static void tsi108_rx_int(struct net_device *dev)
         *
         * This can happen if this code races with tsi108_poll(), which masks
         * the interrupts after tsi108_irq_one() read the mask, but before
-        * netif_rx_schedule is called.  It could also happen due to calls
+        * napi_schedule is called.  It could also happen due to calls
         * from tsi108_check_rxring().
         */
 
-       if (netif_rx_schedule_prep(&data->napi)) {
+       if (napi_schedule_prep(&data->napi)) {
                /* Mask, rather than ack, the receive interrupts.  The ack
                 * will happen in tsi108_poll().
                 */
@@ -930,7 +930,7 @@ static void tsi108_rx_int(struct net_device *dev)
                                     | TSI108_INT_RXTHRESH |
                                     TSI108_INT_RXOVERRUN | TSI108_INT_RXERROR |
                                     TSI108_INT_RXWAIT);
-               __netif_rx_schedule(&data->napi);
+               __napi_schedule(&data->napi);
        } else {
                if (!netif_running(dev)) {
                        /* This can happen if an interrupt occurs while the
index 6418f74415d7b2c964ad7483595d7f414d2a78d2..6430a2ec6db198649ea40421533d030cc432fa71 100644 (file)
 
 #include "de4x5.h"
 
-static char version[] __devinitdata = "de4x5.c:V0.546 2001/02/22 davies@maniac.ultranet.com\n";
+static const char version[] __devinitdata =
+       KERN_INFO "de4x5.c:V0.546 2001/02/22 davies@maniac.ultranet.com\n";
 
 #define c_char const char
 
@@ -3941,8 +3942,8 @@ PCI_signature(char *name, struct de4x5_private *lp)
        strcpy(name, "DE434/5");
        return status;
     } else {                           /* Search for a DEC name in the SROM */
-       int i = *((char *)&lp->srom + 19) * 3;
-       strncpy(name, (char *)&lp->srom + 26 + i, 8);
+       int tmp = *((char *)&lp->srom + 19) * 3;
+       strncpy(name, (char *)&lp->srom + 26 + tmp, 8);
     }
     name[8] = '\0';
     for (i=0; i<siglen; i++) {
index 6c3428a37c0b9d5c672e777b052a199710d01c97..9f946d4210885f3650ece6ece8629fc8a1c0724e 100644 (file)
@@ -103,7 +103,7 @@ void oom_timer(unsigned long data)
 {
         struct net_device *dev = (struct net_device *)data;
        struct tulip_private *tp = netdev_priv(dev);
-       netif_rx_schedule(&tp->napi);
+       napi_schedule(&tp->napi);
 }
 
 int tulip_poll(struct napi_struct *napi, int budget)
@@ -300,7 +300,7 @@ int tulip_poll(struct napi_struct *napi, int budget)
 
          /* Remove us from polling list and enable RX intr. */
 
-         netif_rx_complete(napi);
+         napi_complete(napi);
          iowrite32(tulip_tbl[tp->chip_id].valid_intrs, tp->base_addr+CSR7);
 
          /* The last op happens after poll completion. Which means the following:
@@ -333,10 +333,10 @@ int tulip_poll(struct napi_struct *napi, int budget)
 
          /* Think: timer_pending() was an explicit signature of bug.
           * Timer can be pending now but fired and completed
-          * before we did netif_rx_complete(). See? We would lose it. */
+          * before we did napi_complete(). See? We would lose it. */
 
          /* remove ourselves from the polling list */
-         netif_rx_complete(napi);
+         napi_complete(napi);
 
          return work_done;
 }
@@ -519,7 +519,7 @@ irqreturn_t tulip_interrupt(int irq, void *dev_instance)
                        rxd++;
                        /* Mask RX intrs and add the device to poll list. */
                        iowrite32(tulip_tbl[tp->chip_id].valid_intrs&~RxPollInt, ioaddr + CSR7);
-                       netif_rx_schedule(&tp->napi);
+                       napi_schedule(&tp->napi);
 
                        if (!(csr5&~(AbnormalIntr|NormalIntr|RxPollInt|TPLnkPass)))
                                break;
index 91cf9c863910600b8c910e51196cb3ed6c16aa50..daddfa51853e05b0d8c667dfdbda1580b497be78 100644 (file)
@@ -69,11 +69,10 @@ int tulip_mdio_read(struct net_device *dev, int phy_id, int location)
 
        spin_lock_irqsave(&tp->mii_lock, flags);
        if (tp->chip_id == LC82C168) {
-               int i = 1000;
                iowrite32(0x60020000 + (phy_id<<23) + (location<<18), ioaddr + 0xA0);
                ioread32(ioaddr + 0xA0);
                ioread32(ioaddr + 0xA0);
-               while (--i > 0) {
+               for (i = 1000; i >= 0; --i) {
                        barrier();
                        if ( ! ((retval = ioread32(ioaddr + 0xA0)) & 0x80000000))
                                break;
@@ -131,13 +130,12 @@ void tulip_mdio_write(struct net_device *dev, int phy_id, int location, int val)
 
        spin_lock_irqsave(&tp->mii_lock, flags);
        if (tp->chip_id == LC82C168) {
-               int i = 1000;
                iowrite32(cmd, ioaddr + 0xA0);
-               do {
+               for (i = 1000; i >= 0; --i) {
                        barrier();
                        if ( ! (ioread32(ioaddr + 0xA0) & 0x80000000))
                                break;
-               } while (--i > 0);
+               }
                spin_unlock_irqrestore(&tp->mii_lock, flags);
                return;
        }
index f467bf87817d086c9d560cdf71c49c3e08df3576..426b7c73e36abf1415a00bdd29002baf90ed95db 100644 (file)
@@ -139,7 +139,7 @@ static int full_duplex[MAX_UNITS] = {-1, -1, -1, -1, -1, -1, -1, -1};
 #define PKT_BUF_SZ             1536    /* Size of each temporary Rx buffer.*/
 
 /* These identify the driver base version and may not be removed. */
-static char version[] =
+static const char version[] __initdata =
 KERN_INFO DRV_NAME ".c:v" DRV_VERSION " (2.4 port) " DRV_RELDATE "  Donald Becker <becker@scyld.com>\n"
 KERN_INFO "  http://www.scyld.com/network/drivers.html\n";
 
index 09fea31d3e360da7d79afeb25c399ef6286f4951..a1b0697340ba1e3214da60fe5de59091cb65818b 100644 (file)
@@ -63,6 +63,8 @@
 #include <linux/virtio_net.h>
 #include <net/net_namespace.h>
 #include <net/netns/generic.h>
+#include <net/rtnetlink.h>
+#include <net/sock.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
@@ -87,26 +89,127 @@ struct tap_filter {
        unsigned char   addr[FLT_EXACT_COUNT][ETH_ALEN];
 };
 
+struct tun_file {
+       atomic_t count;
+       struct tun_struct *tun;
+       struct net *net;
+       wait_queue_head_t       read_wait;
+};
+
+struct tun_sock;
+
 struct tun_struct {
-       struct list_head        list;
+       struct tun_file         *tfile;
        unsigned int            flags;
-       int                     attached;
        uid_t                   owner;
        gid_t                   group;
 
-       wait_queue_head_t       read_wait;
        struct sk_buff_head     readq;
 
        struct net_device       *dev;
        struct fasync_struct    *fasync;
 
        struct tap_filter       txflt;
+       struct sock             *sk;
+       struct socket           socket;
 
 #ifdef TUN_DEBUG
        int debug;
 #endif
 };
 
+struct tun_sock {
+       struct sock             sk;
+       struct tun_struct       *tun;
+};
+
+static inline struct tun_sock *tun_sk(struct sock *sk)
+{
+       return container_of(sk, struct tun_sock, sk);
+}
+
+static int tun_attach(struct tun_struct *tun, struct file *file)
+{
+       struct tun_file *tfile = file->private_data;
+       const struct cred *cred = current_cred();
+       int err;
+
+       ASSERT_RTNL();
+
+       /* Check permissions */
+       if (((tun->owner != -1 && cred->euid != tun->owner) ||
+            (tun->group != -1 && !in_egroup_p(tun->group))) &&
+               !capable(CAP_NET_ADMIN))
+               return -EPERM;
+
+       netif_tx_lock_bh(tun->dev);
+
+       err = -EINVAL;
+       if (tfile->tun)
+               goto out;
+
+       err = -EBUSY;
+       if (tun->tfile)
+               goto out;
+
+       err = 0;
+       tfile->tun = tun;
+       tun->tfile = tfile;
+       dev_hold(tun->dev);
+       atomic_inc(&tfile->count);
+
+out:
+       netif_tx_unlock_bh(tun->dev);
+       return err;
+}
+
+static void __tun_detach(struct tun_struct *tun)
+{
+       struct tun_file *tfile = tun->tfile;
+
+       /* Detach from net device */
+       netif_tx_lock_bh(tun->dev);
+       tfile->tun = NULL;
+       tun->tfile = NULL;
+       netif_tx_unlock_bh(tun->dev);
+
+       /* Drop read queue */
+       skb_queue_purge(&tun->readq);
+
+       /* Drop the extra count on the net device */
+       dev_put(tun->dev);
+}
+
+static void tun_detach(struct tun_struct *tun)
+{
+       rtnl_lock();
+       __tun_detach(tun);
+       rtnl_unlock();
+}
+
+static struct tun_struct *__tun_get(struct tun_file *tfile)
+{
+       struct tun_struct *tun = NULL;
+
+       if (atomic_inc_not_zero(&tfile->count))
+               tun = tfile->tun;
+
+       return tun;
+}
+
+static struct tun_struct *tun_get(struct file *file)
+{
+       return __tun_get(file->private_data);
+}
+
+static void tun_put(struct tun_struct *tun)
+{
+       struct tun_file *tfile = tun->tfile;
+
+       if (atomic_dec_and_test(&tfile->count))
+               tun_detach(tfile->tun);
+}
+
 /* TAP filterting */
 static void addr_hash_set(u32 *mask, const u8 *addr)
 {
@@ -219,13 +322,23 @@ static int check_filter(struct tap_filter *filter, const struct sk_buff *skb)
 
 /* Network device part of the driver */
 
-static int tun_net_id;
-struct tun_net {
-       struct list_head dev_list;
-};
-
 static const struct ethtool_ops tun_ethtool_ops;
 
+/* Net device detach from fd. */
+static void tun_net_uninit(struct net_device *dev)
+{
+       struct tun_struct *tun = netdev_priv(dev);
+       struct tun_file *tfile = tun->tfile;
+
+       /* Inform the methods they need to stop using the dev.
+        */
+       if (tfile) {
+               wake_up_all(&tfile->read_wait);
+               if (atomic_dec_and_test(&tfile->count))
+                       __tun_detach(tun);
+       }
+}
+
 /* Net device open. */
 static int tun_net_open(struct net_device *dev)
 {
@@ -248,7 +361,7 @@ static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
        DBG(KERN_INFO "%s: tun_net_xmit %d\n", tun->dev->name, skb->len);
 
        /* Drop packet if interface is not attached */
-       if (!tun->attached)
+       if (!tun->tfile)
                goto drop;
 
        /* Drop if the filter does not like it.
@@ -280,7 +393,7 @@ static int tun_net_xmit(struct sk_buff *skb, struct net_device *dev)
        /* Notify and wake up reader process */
        if (tun->flags & TUN_FASYNC)
                kill_fasync(&tun->fasync, SIGIO, POLL_IN);
-       wake_up_interruptible(&tun->read_wait);
+       wake_up_interruptible(&tun->tfile->read_wait);
        return 0;
 
 drop:
@@ -312,6 +425,7 @@ tun_net_change_mtu(struct net_device *dev, int new_mtu)
 }
 
 static const struct net_device_ops tun_netdev_ops = {
+       .ndo_uninit             = tun_net_uninit,
        .ndo_open               = tun_net_open,
        .ndo_stop               = tun_net_close,
        .ndo_start_xmit         = tun_net_xmit,
@@ -319,6 +433,7 @@ static const struct net_device_ops tun_netdev_ops = {
 };
 
 static const struct net_device_ops tap_netdev_ops = {
+       .ndo_uninit             = tun_net_uninit,
        .ndo_open               = tun_net_open,
        .ndo_stop               = tun_net_close,
        .ndo_start_xmit         = tun_net_xmit,
@@ -365,86 +480,66 @@ static void tun_net_init(struct net_device *dev)
 /* Poll */
 static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
 {
-       struct tun_struct *tun = file->private_data;
-       unsigned int mask = POLLOUT | POLLWRNORM;
+       struct tun_file *tfile = file->private_data;
+       struct tun_struct *tun = __tun_get(tfile);
+       struct sock *sk = tun->sk;
+       unsigned int mask = 0;
 
        if (!tun)
-               return -EBADFD;
+               return POLLERR;
 
        DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name);
 
-       poll_wait(file, &tun->read_wait, wait);
+       poll_wait(file, &tfile->read_wait, wait);
 
        if (!skb_queue_empty(&tun->readq))
                mask |= POLLIN | POLLRDNORM;
 
+       if (sock_writeable(sk) ||
+           (!test_and_set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags) &&
+            sock_writeable(sk)))
+               mask |= POLLOUT | POLLWRNORM;
+
+       if (tun->dev->reg_state != NETREG_REGISTERED)
+               mask = POLLERR;
+
+       tun_put(tun);
        return mask;
 }
 
 /* prepad is the amount to reserve at front.  len is length after that.
  * linear is a hint as to how much to copy (usually headers). */
-static struct sk_buff *tun_alloc_skb(size_t prepad, size_t len, size_t linear,
-                                    gfp_t gfp)
+static inline struct sk_buff *tun_alloc_skb(struct tun_struct *tun,
+                                           size_t prepad, size_t len,
+                                           size_t linear, int noblock)
 {
+       struct sock *sk = tun->sk;
        struct sk_buff *skb;
-       unsigned int i;
-
-       skb = alloc_skb(prepad + len, gfp|__GFP_NOWARN);
-       if (skb) {
-               skb_reserve(skb, prepad);
-               skb_put(skb, len);
-               return skb;
-       }
+       int err;
 
        /* Under a page?  Don't bother with paged skb. */
        if (prepad + len < PAGE_SIZE)
-               return NULL;
+               linear = len;
 
-       /* Start with a normal skb, and add pages. */
-       skb = alloc_skb(prepad + linear, gfp);
+       skb = sock_alloc_send_pskb(sk, prepad + linear, len - linear, noblock,
+                                  &err);
        if (!skb)
-               return NULL;
+               return ERR_PTR(err);
 
        skb_reserve(skb, prepad);
        skb_put(skb, linear);
-
-       len -= linear;
-
-       for (i = 0; i < MAX_SKB_FRAGS; i++) {
-               skb_frag_t *f = &skb_shinfo(skb)->frags[i];
-
-               f->page = alloc_page(gfp|__GFP_ZERO);
-               if (!f->page)
-                       break;
-
-               f->page_offset = 0;
-               f->size = PAGE_SIZE;
-
-               skb->data_len += PAGE_SIZE;
-               skb->len += PAGE_SIZE;
-               skb->truesize += PAGE_SIZE;
-               skb_shinfo(skb)->nr_frags++;
-
-               if (len < PAGE_SIZE) {
-                       len = 0;
-                       break;
-               }
-               len -= PAGE_SIZE;
-       }
-
-       /* Too large, or alloc fail? */
-       if (unlikely(len)) {
-               kfree_skb(skb);
-               skb = NULL;
-       }
+       skb->data_len = len - linear;
+       skb->len += len - linear;
 
        return skb;
 }
 
 /* Get packet from user space buffer */
-static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv, size_t count)
+static __inline__ ssize_t tun_get_user(struct tun_struct *tun,
+                                      struct iovec *iv, size_t count,
+                                      int noblock)
 {
-       struct tun_pi pi = { 0, __constant_htons(ETH_P_IP) };
+       struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) };
        struct sk_buff *skb;
        size_t len = count, align = 0;
        struct virtio_net_hdr gso = { 0 };
@@ -474,9 +569,11 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
                        return -EINVAL;
        }
 
-       if (!(skb = tun_alloc_skb(align, len, gso.hdr_len, GFP_KERNEL))) {
-               tun->dev->stats.rx_dropped++;
-               return -ENOMEM;
+       skb = tun_alloc_skb(tun, align, len, gso.hdr_len, noblock);
+       if (IS_ERR(skb)) {
+               if (PTR_ERR(skb) != -EAGAIN)
+                       tun->dev->stats.rx_dropped++;
+               return PTR_ERR(skb);
        }
 
        if (skb_copy_datagram_from_iovec(skb, 0, iv, len)) {
@@ -562,14 +659,20 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
 static ssize_t tun_chr_aio_write(struct kiocb *iocb, const struct iovec *iv,
                              unsigned long count, loff_t pos)
 {
-       struct tun_struct *tun = iocb->ki_filp->private_data;
+       struct file *file = iocb->ki_filp;
+       struct tun_struct *tun = tun_get(file);
+       ssize_t result;
 
        if (!tun)
                return -EBADFD;
 
        DBG(KERN_INFO "%s: tun_chr_write %ld\n", tun->dev->name, count);
 
-       return tun_get_user(tun, (struct iovec *) iv, iov_length(iv, count));
+       result = tun_get_user(tun, (struct iovec *)iv, iov_length(iv, count),
+                             file->f_flags & O_NONBLOCK);
+
+       tun_put(tun);
+       return result;
 }
 
 /* Put packet to the user space buffer */
@@ -642,7 +745,8 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
                            unsigned long count, loff_t pos)
 {
        struct file *file = iocb->ki_filp;
-       struct tun_struct *tun = file->private_data;
+       struct tun_file *tfile = file->private_data;
+       struct tun_struct *tun = __tun_get(tfile);
        DECLARE_WAITQUEUE(wait, current);
        struct sk_buff *skb;
        ssize_t len, ret = 0;
@@ -653,10 +757,12 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
        DBG(KERN_INFO "%s: tun_chr_read\n", tun->dev->name);
 
        len = iov_length(iv, count);
-       if (len < 0)
-               return -EINVAL;
+       if (len < 0) {
+               ret = -EINVAL;
+               goto out;
+       }
 
-       add_wait_queue(&tun->read_wait, &wait);
+       add_wait_queue(&tfile->read_wait, &wait);
        while (len) {
                current->state = TASK_INTERRUPTIBLE;
 
@@ -670,6 +776,10 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
                                ret = -ERESTARTSYS;
                                break;
                        }
+                       if (tun->dev->reg_state != NETREG_REGISTERED) {
+                               ret = -EIO;
+                               break;
+                       }
 
                        /* Nothing to read, let's sleep */
                        schedule();
@@ -683,8 +793,10 @@ static ssize_t tun_chr_aio_read(struct kiocb *iocb, const struct iovec *iv,
        }
 
        current->state = TASK_RUNNING;
-       remove_wait_queue(&tun->read_wait, &wait);
+       remove_wait_queue(&tfile->read_wait, &wait);
 
+out:
+       tun_put(tun);
        return ret;
 }
 
@@ -693,54 +805,78 @@ static void tun_setup(struct net_device *dev)
        struct tun_struct *tun = netdev_priv(dev);
 
        skb_queue_head_init(&tun->readq);
-       init_waitqueue_head(&tun->read_wait);
 
        tun->owner = -1;
        tun->group = -1;
 
        dev->ethtool_ops = &tun_ethtool_ops;
        dev->destructor = free_netdev;
-       dev->features |= NETIF_F_NETNS_LOCAL;
 }
 
-static struct tun_struct *tun_get_by_name(struct tun_net *tn, const char *name)
+/* Trivial set of netlink ops to allow deleting tun or tap
+ * device with netlink.
+ */
+static int tun_validate(struct nlattr *tb[], struct nlattr *data[])
+{
+       return -EINVAL;
+}
+
+static struct rtnl_link_ops tun_link_ops __read_mostly = {
+       .kind           = DRV_NAME,
+       .priv_size      = sizeof(struct tun_struct),
+       .setup          = tun_setup,
+       .validate       = tun_validate,
+};
+
+static void tun_sock_write_space(struct sock *sk)
 {
        struct tun_struct *tun;
 
-       ASSERT_RTNL();
-       list_for_each_entry(tun, &tn->dev_list, list) {
-               if (!strncmp(tun->dev->name, name, IFNAMSIZ))
-                   return tun;
-       }
+       if (!sock_writeable(sk))
+               return;
+
+       if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
+               wake_up_interruptible_sync(sk->sk_sleep);
+
+       if (!test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags))
+               return;
 
-       return NULL;
+       tun = container_of(sk, struct tun_sock, sk)->tun;
+       kill_fasync(&tun->fasync, SIGIO, POLL_OUT);
 }
 
+static void tun_sock_destruct(struct sock *sk)
+{
+       dev_put(container_of(sk, struct tun_sock, sk)->tun->dev);
+}
+
+static struct proto tun_proto = {
+       .name           = "tun",
+       .owner          = THIS_MODULE,
+       .obj_size       = sizeof(struct tun_sock),
+};
+
 static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 {
-       struct tun_net *tn;
+       struct sock *sk;
        struct tun_struct *tun;
        struct net_device *dev;
-       const struct cred *cred = current_cred();
+       struct tun_file *tfile = file->private_data;
        int err;
 
-       tn = net_generic(net, tun_net_id);
-       tun = tun_get_by_name(tn, ifr->ifr_name);
-       if (tun) {
-               if (tun->attached)
-                       return -EBUSY;
-
-               /* Check permissions */
-               if (((tun->owner != -1 &&
-                     cred->euid != tun->owner) ||
-                    (tun->group != -1 &&
-                     cred->egid != tun->group)) &&
-                   !capable(CAP_NET_ADMIN)) {
-                       return -EPERM;
-               }
+       dev = __dev_get_by_name(net, ifr->ifr_name);
+       if (dev) {
+               if ((ifr->ifr_flags & IFF_TUN) && dev->netdev_ops == &tun_netdev_ops)
+                       tun = netdev_priv(dev);
+               else if ((ifr->ifr_flags & IFF_TAP) && dev->netdev_ops == &tap_netdev_ops)
+                       tun = netdev_priv(dev);
+               else
+                       return -EINVAL;
+
+               err = tun_attach(tun, file);
+               if (err < 0)
+                       return err;
        }
-       else if (__dev_get_by_name(net, ifr->ifr_name))
-               return -EINVAL;
        else {
                char *name;
                unsigned long flags = 0;
@@ -771,25 +907,45 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
                        return -ENOMEM;
 
                dev_net_set(dev, net);
+               dev->rtnl_link_ops = &tun_link_ops;
 
                tun = netdev_priv(dev);
                tun->dev = dev;
                tun->flags = flags;
                tun->txflt.count = 0;
 
+               err = -ENOMEM;
+               sk = sk_alloc(net, AF_UNSPEC, GFP_KERNEL, &tun_proto);
+               if (!sk)
+                       goto err_free_dev;
+
+               /* This ref count is for tun->sk. */
+               dev_hold(dev);
+               sock_init_data(&tun->socket, sk);
+               sk->sk_write_space = tun_sock_write_space;
+               sk->sk_destruct = tun_sock_destruct;
+               sk->sk_sndbuf = INT_MAX;
+               sk->sk_sleep = &tfile->read_wait;
+
+               tun->sk = sk;
+               container_of(sk, struct tun_sock, sk)->tun = tun;
+
                tun_net_init(dev);
 
                if (strchr(dev->name, '%')) {
                        err = dev_alloc_name(dev, dev->name);
                        if (err < 0)
-                               goto err_free_dev;
+                               goto err_free_sk;
                }
 
+               err = -EINVAL;
                err = register_netdevice(tun->dev);
                if (err < 0)
                        goto err_free_dev;
 
-               list_add(&tun->list, &tn->dev_list);
+               err = tun_attach(tun, file);
+               if (err < 0)
+                       goto err_free_dev;
        }
 
        DBG(KERN_INFO "%s: tun_set_iff\n", tun->dev->name);
@@ -809,10 +965,6 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
        else
                tun->flags &= ~TUN_VNET_HDR;
 
-       file->private_data = tun;
-       tun->attached = 1;
-       get_net(dev_net(tun->dev));
-
        /* Make sure persistent devices do not get stuck in
         * xoff state.
         */
@@ -822,6 +974,8 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
        strcpy(ifr->ifr_name, tun->dev->name);
        return 0;
 
+ err_free_sk:
+       sock_put(sk);
  err_free_dev:
        free_netdev(dev);
  failed:
@@ -830,7 +984,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
 
 static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr)
 {
-       struct tun_struct *tun = file->private_data;
+       struct tun_struct *tun = tun_get(file);
 
        if (!tun)
                return -EBADFD;
@@ -855,6 +1009,7 @@ static int tun_get_iff(struct net *net, struct file *file, struct ifreq *ifr)
        if (tun->flags & TUN_VNET_HDR)
                ifr->ifr_flags |= IFF_VNET_HDR;
 
+       tun_put(tun);
        return 0;
 }
 
@@ -901,22 +1056,34 @@ static int set_offload(struct net_device *dev, unsigned long arg)
 static int tun_chr_ioctl(struct inode *inode, struct file *file,
                         unsigned int cmd, unsigned long arg)
 {
-       struct tun_struct *tun = file->private_data;
+       struct tun_file *tfile = file->private_data;
+       struct tun_struct *tun;
        void __user* argp = (void __user*)arg;
        struct ifreq ifr;
+       int sndbuf;
        int ret;
 
        if (cmd == TUNSETIFF || _IOC_TYPE(cmd) == 0x89)
                if (copy_from_user(&ifr, argp, sizeof ifr))
                        return -EFAULT;
 
+       if (cmd == TUNGETFEATURES) {
+               /* Currently this just means: "what IFF flags are valid?".
+                * This is needed because we never checked for invalid flags on
+                * TUNSETIFF. */
+               return put_user(IFF_TUN | IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE |
+                               IFF_VNET_HDR,
+                               (unsigned int __user*)argp);
+       }
+
+       tun = __tun_get(tfile);
        if (cmd == TUNSETIFF && !tun) {
                int err;
 
                ifr.ifr_name[IFNAMSIZ-1] = '\0';
 
                rtnl_lock();
-               err = tun_set_iff(current->nsproxy->net_ns, file, &ifr);
+               err = tun_set_iff(tfile->net, file, &ifr);
                rtnl_unlock();
 
                if (err)
@@ -927,28 +1094,21 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
                return 0;
        }
 
-       if (cmd == TUNGETFEATURES) {
-               /* Currently this just means: "what IFF flags are valid?".
-                * This is needed because we never checked for invalid flags on
-                * TUNSETIFF. */
-               return put_user(IFF_TUN | IFF_TAP | IFF_NO_PI | IFF_ONE_QUEUE |
-                               IFF_VNET_HDR,
-                               (unsigned int __user*)argp);
-       }
 
        if (!tun)
                return -EBADFD;
 
        DBG(KERN_INFO "%s: tun_chr_ioctl cmd %d\n", tun->dev->name, cmd);
 
+       ret = 0;
        switch (cmd) {
        case TUNGETIFF:
                ret = tun_get_iff(current->nsproxy->net_ns, file, &ifr);
                if (ret)
-                       return ret;
+                       break;
 
                if (copy_to_user(argp, &ifr, sizeof(ifr)))
-                       return -EFAULT;
+                       ret = -EFAULT;
                break;
 
        case TUNSETNOCSUM:
@@ -1000,7 +1160,7 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
                        ret = 0;
                }
                rtnl_unlock();
-               return ret;
+               break;
 
 #ifdef TUN_DEBUG
        case TUNSETDEBUG:
@@ -1011,24 +1171,25 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
                rtnl_lock();
                ret = set_offload(tun->dev, arg);
                rtnl_unlock();
-               return ret;
+               break;
 
        case TUNSETTXFILTER:
                /* Can be set only for TAPs */
+               ret = -EINVAL;
                if ((tun->flags & TUN_TYPE_MASK) != TUN_TAP_DEV)
-                       return -EINVAL;
+                       break;
                rtnl_lock();
                ret = update_filter(&tun->txflt, (void __user *)arg);
                rtnl_unlock();
-               return ret;
+               break;
 
        case SIOCGIFHWADDR:
                /* Get hw addres */
                memcpy(ifr.ifr_hwaddr.sa_data, tun->dev->dev_addr, ETH_ALEN);
                ifr.ifr_hwaddr.sa_family = tun->dev->type;
                if (copy_to_user(argp, &ifr, sizeof ifr))
-                       return -EFAULT;
-               return 0;
+                       ret = -EFAULT;
+               break;
 
        case SIOCSIFHWADDR:
                /* Set hw address */
@@ -1038,18 +1199,35 @@ static int tun_chr_ioctl(struct inode *inode, struct file *file,
                rtnl_lock();
                ret = dev_set_mac_address(tun->dev, &ifr.ifr_hwaddr);
                rtnl_unlock();
-               return ret;
+               break;
+
+       case TUNGETSNDBUF:
+               sndbuf = tun->sk->sk_sndbuf;
+               if (copy_to_user(argp, &sndbuf, sizeof(sndbuf)))
+                       ret = -EFAULT;
+               break;
+
+       case TUNSETSNDBUF:
+               if (copy_from_user(&sndbuf, argp, sizeof(sndbuf))) {
+                       ret = -EFAULT;
+                       break;
+               }
+
+               tun->sk->sk_sndbuf = sndbuf;
+               break;
 
        default:
-               return -EINVAL;
+               ret = -EINVAL;
+               break;
        };
 
-       return 0;
+       tun_put(tun);
+       return ret;
 }
 
 static int tun_chr_fasync(int fd, struct file *file, int on)
 {
-       struct tun_struct *tun = file->private_data;
+       struct tun_struct *tun = tun_get(file);
        int ret;
 
        if (!tun)
@@ -1071,42 +1249,50 @@ static int tun_chr_fasync(int fd, struct file *file, int on)
        ret = 0;
 out:
        unlock_kernel();
+       tun_put(tun);
        return ret;
 }
 
 static int tun_chr_open(struct inode *inode, struct file * file)
 {
+       struct tun_file *tfile;
        cycle_kernel_lock();
        DBG1(KERN_INFO "tunX: tun_chr_open\n");
-       file->private_data = NULL;
+
+       tfile = kmalloc(sizeof(*tfile), GFP_KERNEL);
+       if (!tfile)
+               return -ENOMEM;
+       atomic_set(&tfile->count, 0);
+       tfile->tun = NULL;
+       tfile->net = get_net(current->nsproxy->net_ns);
+       init_waitqueue_head(&tfile->read_wait);
+       file->private_data = tfile;
        return 0;
 }
 
 static int tun_chr_close(struct inode *inode, struct file *file)
 {
-       struct tun_struct *tun = file->private_data;
-
-       if (!tun)
-               return 0;
+       struct tun_file *tfile = file->private_data;
+       struct tun_struct *tun = __tun_get(tfile);
 
-       DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name);
 
-       rtnl_lock();
+       if (tun) {
+               DBG(KERN_INFO "%s: tun_chr_close\n", tun->dev->name);
 
-       /* Detach from net device */
-       file->private_data = NULL;
-       tun->attached = 0;
-       put_net(dev_net(tun->dev));
+               rtnl_lock();
+               __tun_detach(tun);
 
-       /* Drop read queue */
-       skb_queue_purge(&tun->readq);
+               /* If desireable, unregister the netdevice. */
+               if (!(tun->flags & TUN_PERSIST)) {
+                       sock_put(tun->sk);
+                       unregister_netdevice(tun->dev);
+               }
 
-       if (!(tun->flags & TUN_PERSIST)) {
-               list_del(&tun->list);
-               unregister_netdevice(tun->dev);
+               rtnl_unlock();
        }
 
-       rtnl_unlock();
+       put_net(tfile->net);
+       kfree(tfile);
 
        return 0;
 }
@@ -1187,7 +1373,7 @@ static void tun_set_msglevel(struct net_device *dev, u32 value)
 static u32 tun_get_link(struct net_device *dev)
 {
        struct tun_struct *tun = netdev_priv(dev);
-       return tun->attached;
+       return !!tun->tfile;
 }
 
 static u32 tun_get_rx_csum(struct net_device *dev)
@@ -1216,45 +1402,6 @@ static const struct ethtool_ops tun_ethtool_ops = {
        .set_rx_csum    = tun_set_rx_csum
 };
 
-static int tun_init_net(struct net *net)
-{
-       struct tun_net *tn;
-
-       tn = kmalloc(sizeof(*tn), GFP_KERNEL);
-       if (tn == NULL)
-               return -ENOMEM;
-
-       INIT_LIST_HEAD(&tn->dev_list);
-
-       if (net_assign_generic(net, tun_net_id, tn)) {
-               kfree(tn);
-               return -ENOMEM;
-       }
-
-       return 0;
-}
-
-static void tun_exit_net(struct net *net)
-{
-       struct tun_net *tn;
-       struct tun_struct *tun, *nxt;
-
-       tn = net_generic(net, tun_net_id);
-
-       rtnl_lock();
-       list_for_each_entry_safe(tun, nxt, &tn->dev_list, list) {
-               DBG(KERN_INFO "%s cleaned up\n", tun->dev->name);
-               unregister_netdevice(tun->dev);
-       }
-       rtnl_unlock();
-
-       kfree(tn);
-}
-
-static struct pernet_operations tun_net_ops = {
-       .init = tun_init_net,
-       .exit = tun_exit_net,
-};
 
 static int __init tun_init(void)
 {
@@ -1263,10 +1410,10 @@ static int __init tun_init(void)
        printk(KERN_INFO "tun: %s, %s\n", DRV_DESCRIPTION, DRV_VERSION);
        printk(KERN_INFO "tun: %s\n", DRV_COPYRIGHT);
 
-       ret = register_pernet_gen_device(&tun_net_id, &tun_net_ops);
+       ret = rtnl_link_register(&tun_link_ops);
        if (ret) {
-               printk(KERN_ERR "tun: Can't register pernet ops\n");
-               goto err_pernet;
+               printk(KERN_ERR "tun: Can't register link_ops\n");
+               goto err_linkops;
        }
 
        ret = misc_register(&tun_miscdev);
@@ -1274,18 +1421,17 @@ static int __init tun_init(void)
                printk(KERN_ERR "tun: Can't register misc device %d\n", TUN_MINOR);
                goto err_misc;
        }
-       return 0;
-
+       return  0;
 err_misc:
-       unregister_pernet_gen_device(tun_net_id, &tun_net_ops);
-err_pernet:
+       rtnl_link_unregister(&tun_link_ops);
+err_linkops:
        return ret;
 }
 
 static void tun_cleanup(void)
 {
        misc_deregister(&tun_miscdev);
-       unregister_pernet_gen_device(tun_net_id, &tun_net_ops);
+       rtnl_link_unregister(&tun_link_ops);
 }
 
 module_init(tun_init);
index 3af9a9516ccb530e03fe7d5b1947018569fec773..a8e5651f31654bfb328545efe07cf1dbfd43276b 100644 (file)
@@ -1783,7 +1783,7 @@ typhoon_poll(struct napi_struct *napi, int budget)
        }
 
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                iowrite32(TYPHOON_INTR_NONE,
                                tp->ioaddr + TYPHOON_REG_INTR_MASK);
                typhoon_post_pci_writes(tp->ioaddr);
@@ -1806,10 +1806,10 @@ typhoon_interrupt(int irq, void *dev_instance)
 
        iowrite32(intr_status, ioaddr + TYPHOON_REG_INTR_STATUS);
 
-       if (netif_rx_schedule_prep(&tp->napi)) {
+       if (napi_schedule_prep(&tp->napi)) {
                iowrite32(TYPHOON_INTR_ALL, ioaddr + TYPHOON_REG_INTR_MASK);
                typhoon_post_pci_writes(ioaddr);
-               __netif_rx_schedule(&tp->napi);
+               __napi_schedule(&tp->napi);
        } else {
                printk(KERN_ERR "%s: Error, poll already scheduled\n",
                        dev->name);
@@ -1944,7 +1944,7 @@ typhoon_start_runtime(struct typhoon *tp)
                goto error_out;
 
        INIT_COMMAND_NO_RESPONSE(&xp_cmd, TYPHOON_CMD_VLAN_TYPE_WRITE);
-       xp_cmd.parm1 = __constant_cpu_to_le16(ETH_P_8021Q);
+       xp_cmd.parm1 = cpu_to_le16(ETH_P_8021Q);
        err = typhoon_issue_command(tp, 1, &xp_cmd, 0, NULL);
        if(err < 0)
                goto error_out;
index dd7022ca735421763a0cac5bfa2f7fad595f0655..673fd512591402c9729fe5e52dc88187357d31c6 100644 (file)
@@ -174,18 +174,18 @@ struct tx_desc {
                u64 tx_addr;    /* opaque for hardware, for TX_DESC */
        };
        __le32 processFlags;
-#define TYPHOON_TX_PF_NO_CRC           __constant_cpu_to_le32(0x00000001)
-#define TYPHOON_TX_PF_IP_CHKSUM                __constant_cpu_to_le32(0x00000002)
-#define TYPHOON_TX_PF_TCP_CHKSUM       __constant_cpu_to_le32(0x00000004)
-#define TYPHOON_TX_PF_TCP_SEGMENT      __constant_cpu_to_le32(0x00000008)
-#define TYPHOON_TX_PF_INSERT_VLAN      __constant_cpu_to_le32(0x00000010)
-#define TYPHOON_TX_PF_IPSEC            __constant_cpu_to_le32(0x00000020)
-#define TYPHOON_TX_PF_VLAN_PRIORITY    __constant_cpu_to_le32(0x00000040)
-#define TYPHOON_TX_PF_UDP_CHKSUM       __constant_cpu_to_le32(0x00000080)
-#define TYPHOON_TX_PF_PAD_FRAME                __constant_cpu_to_le32(0x00000100)
-#define TYPHOON_TX_PF_RESERVED         __constant_cpu_to_le32(0x00000e00)
-#define TYPHOON_TX_PF_VLAN_MASK                __constant_cpu_to_le32(0x0ffff000)
-#define TYPHOON_TX_PF_INTERNAL         __constant_cpu_to_le32(0xf0000000)
+#define TYPHOON_TX_PF_NO_CRC           cpu_to_le32(0x00000001)
+#define TYPHOON_TX_PF_IP_CHKSUM                cpu_to_le32(0x00000002)
+#define TYPHOON_TX_PF_TCP_CHKSUM       cpu_to_le32(0x00000004)
+#define TYPHOON_TX_PF_TCP_SEGMENT      cpu_to_le32(0x00000008)
+#define TYPHOON_TX_PF_INSERT_VLAN      cpu_to_le32(0x00000010)
+#define TYPHOON_TX_PF_IPSEC            cpu_to_le32(0x00000020)
+#define TYPHOON_TX_PF_VLAN_PRIORITY    cpu_to_le32(0x00000040)
+#define TYPHOON_TX_PF_UDP_CHKSUM       cpu_to_le32(0x00000080)
+#define TYPHOON_TX_PF_PAD_FRAME                cpu_to_le32(0x00000100)
+#define TYPHOON_TX_PF_RESERVED         cpu_to_le32(0x00000e00)
+#define TYPHOON_TX_PF_VLAN_MASK                cpu_to_le32(0x0ffff000)
+#define TYPHOON_TX_PF_INTERNAL         cpu_to_le32(0xf0000000)
 #define TYPHOON_TX_PF_VLAN_TAG_SHIFT   12
 } __attribute__ ((packed));
 
@@ -203,8 +203,8 @@ struct tcpopt_desc {
        u8  flags;
        u8  numDesc;
        __le16 mss_flags;
-#define TYPHOON_TSO_FIRST              __constant_cpu_to_le16(0x1000)
-#define TYPHOON_TSO_LAST               __constant_cpu_to_le16(0x2000)
+#define TYPHOON_TSO_FIRST              cpu_to_le16(0x1000)
+#define TYPHOON_TSO_LAST               cpu_to_le16(0x2000)
        __le32 respAddrLo;
        __le32 bytesTx;
        __le32 status;
@@ -222,8 +222,8 @@ struct ipsec_desc {
        u8  flags;
        u8  numDesc;
        __le16 ipsecFlags;
-#define TYPHOON_IPSEC_GEN_IV   __constant_cpu_to_le16(0x0000)
-#define TYPHOON_IPSEC_USE_IV   __constant_cpu_to_le16(0x0001)
+#define TYPHOON_IPSEC_GEN_IV   cpu_to_le16(0x0000)
+#define TYPHOON_IPSEC_USE_IV   cpu_to_le16(0x0001)
        __le32 sa1;
        __le32 sa2;
        __le32 reserved;
@@ -248,41 +248,41 @@ struct rx_desc {
        u32 addr;       /* opaque, comes from virtAddr */
        u32 addrHi;     /* opaque, comes from virtAddrHi */
        __le32 rxStatus;
-#define TYPHOON_RX_ERR_INTERNAL                __constant_cpu_to_le32(0x00000000)
-#define TYPHOON_RX_ERR_FIFO_UNDERRUN   __constant_cpu_to_le32(0x00000001)
-#define TYPHOON_RX_ERR_BAD_SSD         __constant_cpu_to_le32(0x00000002)
-#define TYPHOON_RX_ERR_RUNT            __constant_cpu_to_le32(0x00000003)
-#define TYPHOON_RX_ERR_CRC             __constant_cpu_to_le32(0x00000004)
-#define TYPHOON_RX_ERR_OVERSIZE                __constant_cpu_to_le32(0x00000005)
-#define TYPHOON_RX_ERR_ALIGN           __constant_cpu_to_le32(0x00000006)
-#define TYPHOON_RX_ERR_DRIBBLE         __constant_cpu_to_le32(0x00000007)
-#define TYPHOON_RX_PROTO_MASK          __constant_cpu_to_le32(0x00000003)
-#define TYPHOON_RX_PROTO_UNKNOWN       __constant_cpu_to_le32(0x00000000)
-#define TYPHOON_RX_PROTO_IP            __constant_cpu_to_le32(0x00000001)
-#define TYPHOON_RX_PROTO_IPX           __constant_cpu_to_le32(0x00000002)
-#define TYPHOON_RX_VLAN                        __constant_cpu_to_le32(0x00000004)
-#define TYPHOON_RX_IP_FRAG             __constant_cpu_to_le32(0x00000008)
-#define TYPHOON_RX_IPSEC               __constant_cpu_to_le32(0x00000010)
-#define TYPHOON_RX_IP_CHK_FAIL         __constant_cpu_to_le32(0x00000020)
-#define TYPHOON_RX_TCP_CHK_FAIL                __constant_cpu_to_le32(0x00000040)
-#define TYPHOON_RX_UDP_CHK_FAIL                __constant_cpu_to_le32(0x00000080)
-#define TYPHOON_RX_IP_CHK_GOOD         __constant_cpu_to_le32(0x00000100)
-#define TYPHOON_RX_TCP_CHK_GOOD                __constant_cpu_to_le32(0x00000200)
-#define TYPHOON_RX_UDP_CHK_GOOD                __constant_cpu_to_le32(0x00000400)
+#define TYPHOON_RX_ERR_INTERNAL                cpu_to_le32(0x00000000)
+#define TYPHOON_RX_ERR_FIFO_UNDERRUN   cpu_to_le32(0x00000001)
+#define TYPHOON_RX_ERR_BAD_SSD         cpu_to_le32(0x00000002)
+#define TYPHOON_RX_ERR_RUNT            cpu_to_le32(0x00000003)
+#define TYPHOON_RX_ERR_CRC             cpu_to_le32(0x00000004)
+#define TYPHOON_RX_ERR_OVERSIZE                cpu_to_le32(0x00000005)
+#define TYPHOON_RX_ERR_ALIGN           cpu_to_le32(0x00000006)
+#define TYPHOON_RX_ERR_DRIBBLE         cpu_to_le32(0x00000007)
+#define TYPHOON_RX_PROTO_MASK          cpu_to_le32(0x00000003)
+#define TYPHOON_RX_PROTO_UNKNOWN       cpu_to_le32(0x00000000)
+#define TYPHOON_RX_PROTO_IP            cpu_to_le32(0x00000001)
+#define TYPHOON_RX_PROTO_IPX           cpu_to_le32(0x00000002)
+#define TYPHOON_RX_VLAN                        cpu_to_le32(0x00000004)
+#define TYPHOON_RX_IP_FRAG             cpu_to_le32(0x00000008)
+#define TYPHOON_RX_IPSEC               cpu_to_le32(0x00000010)
+#define TYPHOON_RX_IP_CHK_FAIL         cpu_to_le32(0x00000020)
+#define TYPHOON_RX_TCP_CHK_FAIL                cpu_to_le32(0x00000040)
+#define TYPHOON_RX_UDP_CHK_FAIL                cpu_to_le32(0x00000080)
+#define TYPHOON_RX_IP_CHK_GOOD         cpu_to_le32(0x00000100)
+#define TYPHOON_RX_TCP_CHK_GOOD                cpu_to_le32(0x00000200)
+#define TYPHOON_RX_UDP_CHK_GOOD                cpu_to_le32(0x00000400)
        __le16 filterResults;
-#define TYPHOON_RX_FILTER_MASK         __constant_cpu_to_le16(0x7fff)
-#define TYPHOON_RX_FILTERED            __constant_cpu_to_le16(0x8000)
+#define TYPHOON_RX_FILTER_MASK         cpu_to_le16(0x7fff)
+#define TYPHOON_RX_FILTERED            cpu_to_le16(0x8000)
        __le16 ipsecResults;
-#define TYPHOON_RX_OUTER_AH_GOOD       __constant_cpu_to_le16(0x0001)
-#define TYPHOON_RX_OUTER_ESP_GOOD      __constant_cpu_to_le16(0x0002)
-#define TYPHOON_RX_INNER_AH_GOOD       __constant_cpu_to_le16(0x0004)
-#define TYPHOON_RX_INNER_ESP_GOOD      __constant_cpu_to_le16(0x0008)
-#define TYPHOON_RX_OUTER_AH_FAIL       __constant_cpu_to_le16(0x0010)
-#define TYPHOON_RX_OUTER_ESP_FAIL      __constant_cpu_to_le16(0x0020)
-#define TYPHOON_RX_INNER_AH_FAIL       __constant_cpu_to_le16(0x0040)
-#define TYPHOON_RX_INNER_ESP_FAIL      __constant_cpu_to_le16(0x0080)
-#define TYPHOON_RX_UNKNOWN_SA          __constant_cpu_to_le16(0x0100)
-#define TYPHOON_RX_ESP_FORMAT_ERR      __constant_cpu_to_le16(0x0200)
+#define TYPHOON_RX_OUTER_AH_GOOD       cpu_to_le16(0x0001)
+#define TYPHOON_RX_OUTER_ESP_GOOD      cpu_to_le16(0x0002)
+#define TYPHOON_RX_INNER_AH_GOOD       cpu_to_le16(0x0004)
+#define TYPHOON_RX_INNER_ESP_GOOD      cpu_to_le16(0x0008)
+#define TYPHOON_RX_OUTER_AH_FAIL       cpu_to_le16(0x0010)
+#define TYPHOON_RX_OUTER_ESP_FAIL      cpu_to_le16(0x0020)
+#define TYPHOON_RX_INNER_AH_FAIL       cpu_to_le16(0x0040)
+#define TYPHOON_RX_INNER_ESP_FAIL      cpu_to_le16(0x0080)
+#define TYPHOON_RX_UNKNOWN_SA          cpu_to_le16(0x0100)
+#define TYPHOON_RX_ESP_FORMAT_ERR      cpu_to_le16(0x0200)
        __be32 vlanTag;
 } __attribute__ ((packed));
 
@@ -318,31 +318,31 @@ struct cmd_desc {
        u8  flags;
        u8  numDesc;
        __le16 cmd;
-#define TYPHOON_CMD_TX_ENABLE          __constant_cpu_to_le16(0x0001)
-#define TYPHOON_CMD_TX_DISABLE         __constant_cpu_to_le16(0x0002)
-#define TYPHOON_CMD_RX_ENABLE          __constant_cpu_to_le16(0x0003)
-#define TYPHOON_CMD_RX_DISABLE         __constant_cpu_to_le16(0x0004)
-#define TYPHOON_CMD_SET_RX_FILTER      __constant_cpu_to_le16(0x0005)
-#define TYPHOON_CMD_READ_STATS         __constant_cpu_to_le16(0x0007)
-#define TYPHOON_CMD_XCVR_SELECT                __constant_cpu_to_le16(0x0013)
-#define TYPHOON_CMD_SET_MAX_PKT_SIZE   __constant_cpu_to_le16(0x001a)
-#define TYPHOON_CMD_READ_MEDIA_STATUS  __constant_cpu_to_le16(0x001b)
-#define TYPHOON_CMD_GOTO_SLEEP         __constant_cpu_to_le16(0x0023)
-#define TYPHOON_CMD_SET_MULTICAST_HASH __constant_cpu_to_le16(0x0025)
-#define TYPHOON_CMD_SET_MAC_ADDRESS    __constant_cpu_to_le16(0x0026)
-#define TYPHOON_CMD_READ_MAC_ADDRESS   __constant_cpu_to_le16(0x0027)
-#define TYPHOON_CMD_VLAN_TYPE_WRITE    __constant_cpu_to_le16(0x002b)
-#define TYPHOON_CMD_CREATE_SA          __constant_cpu_to_le16(0x0034)
-#define TYPHOON_CMD_DELETE_SA          __constant_cpu_to_le16(0x0035)
-#define TYPHOON_CMD_READ_VERSIONS      __constant_cpu_to_le16(0x0043)
-#define TYPHOON_CMD_IRQ_COALESCE_CTRL  __constant_cpu_to_le16(0x0045)
-#define TYPHOON_CMD_ENABLE_WAKE_EVENTS __constant_cpu_to_le16(0x0049)
-#define TYPHOON_CMD_SET_OFFLOAD_TASKS  __constant_cpu_to_le16(0x004f)
-#define TYPHOON_CMD_HELLO_RESP         __constant_cpu_to_le16(0x0057)
-#define TYPHOON_CMD_HALT               __constant_cpu_to_le16(0x005d)
-#define TYPHOON_CMD_READ_IPSEC_INFO    __constant_cpu_to_le16(0x005e)
-#define TYPHOON_CMD_GET_IPSEC_ENABLE   __constant_cpu_to_le16(0x0067)
-#define TYPHOON_CMD_GET_CMD_LVL                __constant_cpu_to_le16(0x0069)
+#define TYPHOON_CMD_TX_ENABLE          cpu_to_le16(0x0001)
+#define TYPHOON_CMD_TX_DISABLE         cpu_to_le16(0x0002)
+#define TYPHOON_CMD_RX_ENABLE          cpu_to_le16(0x0003)
+#define TYPHOON_CMD_RX_DISABLE         cpu_to_le16(0x0004)
+#define TYPHOON_CMD_SET_RX_FILTER      cpu_to_le16(0x0005)
+#define TYPHOON_CMD_READ_STATS         cpu_to_le16(0x0007)
+#define TYPHOON_CMD_XCVR_SELECT                cpu_to_le16(0x0013)
+#define TYPHOON_CMD_SET_MAX_PKT_SIZE   cpu_to_le16(0x001a)
+#define TYPHOON_CMD_READ_MEDIA_STATUS  cpu_to_le16(0x001b)
+#define TYPHOON_CMD_GOTO_SLEEP         cpu_to_le16(0x0023)
+#define TYPHOON_CMD_SET_MULTICAST_HASH cpu_to_le16(0x0025)
+#define TYPHOON_CMD_SET_MAC_ADDRESS    cpu_to_le16(0x0026)
+#define TYPHOON_CMD_READ_MAC_ADDRESS   cpu_to_le16(0x0027)
+#define TYPHOON_CMD_VLAN_TYPE_WRITE    cpu_to_le16(0x002b)
+#define TYPHOON_CMD_CREATE_SA          cpu_to_le16(0x0034)
+#define TYPHOON_CMD_DELETE_SA          cpu_to_le16(0x0035)
+#define TYPHOON_CMD_READ_VERSIONS      cpu_to_le16(0x0043)
+#define TYPHOON_CMD_IRQ_COALESCE_CTRL  cpu_to_le16(0x0045)
+#define TYPHOON_CMD_ENABLE_WAKE_EVENTS cpu_to_le16(0x0049)
+#define TYPHOON_CMD_SET_OFFLOAD_TASKS  cpu_to_le16(0x004f)
+#define TYPHOON_CMD_HELLO_RESP         cpu_to_le16(0x0057)
+#define TYPHOON_CMD_HALT               cpu_to_le16(0x005d)
+#define TYPHOON_CMD_READ_IPSEC_INFO    cpu_to_le16(0x005e)
+#define TYPHOON_CMD_GET_IPSEC_ENABLE   cpu_to_le16(0x0067)
+#define TYPHOON_CMD_GET_CMD_LVL                cpu_to_le16(0x0069)
        u16 seqNo;
        __le16 parm1;
        __le32 parm2;
@@ -380,11 +380,11 @@ struct resp_desc {
 
 /* TYPHOON_CMD_SET_RX_FILTER filter bits (cmd.parm1)
  */
-#define TYPHOON_RX_FILTER_DIRECTED     __constant_cpu_to_le16(0x0001)
-#define TYPHOON_RX_FILTER_ALL_MCAST    __constant_cpu_to_le16(0x0002)
-#define TYPHOON_RX_FILTER_BROADCAST    __constant_cpu_to_le16(0x0004)
-#define TYPHOON_RX_FILTER_PROMISCOUS   __constant_cpu_to_le16(0x0008)
-#define TYPHOON_RX_FILTER_MCAST_HASH   __constant_cpu_to_le16(0x0010)
+#define TYPHOON_RX_FILTER_DIRECTED     cpu_to_le16(0x0001)
+#define TYPHOON_RX_FILTER_ALL_MCAST    cpu_to_le16(0x0002)
+#define TYPHOON_RX_FILTER_BROADCAST    cpu_to_le16(0x0004)
+#define TYPHOON_RX_FILTER_PROMISCOUS   cpu_to_le16(0x0008)
+#define TYPHOON_RX_FILTER_MCAST_HASH   cpu_to_le16(0x0010)
 
 /* TYPHOON_CMD_READ_STATS response format
  */
@@ -416,40 +416,40 @@ struct stats_resp {
        __le32 rxOverflow;
        __le32 rxFiltered;
        __le32 linkStatus;
-#define TYPHOON_LINK_STAT_MASK         __constant_cpu_to_le32(0x00000001)
-#define TYPHOON_LINK_GOOD              __constant_cpu_to_le32(0x00000001)
-#define TYPHOON_LINK_BAD               __constant_cpu_to_le32(0x00000000)
-#define TYPHOON_LINK_SPEED_MASK                __constant_cpu_to_le32(0x00000002)
-#define TYPHOON_LINK_100MBPS           __constant_cpu_to_le32(0x00000002)
-#define TYPHOON_LINK_10MBPS            __constant_cpu_to_le32(0x00000000)
-#define TYPHOON_LINK_DUPLEX_MASK       __constant_cpu_to_le32(0x00000004)
-#define TYPHOON_LINK_FULL_DUPLEX       __constant_cpu_to_le32(0x00000004)
-#define TYPHOON_LINK_HALF_DUPLEX       __constant_cpu_to_le32(0x00000000)
+#define TYPHOON_LINK_STAT_MASK         cpu_to_le32(0x00000001)
+#define TYPHOON_LINK_GOOD              cpu_to_le32(0x00000001)
+#define TYPHOON_LINK_BAD               cpu_to_le32(0x00000000)
+#define TYPHOON_LINK_SPEED_MASK                cpu_to_le32(0x00000002)
+#define TYPHOON_LINK_100MBPS           cpu_to_le32(0x00000002)
+#define TYPHOON_LINK_10MBPS            cpu_to_le32(0x00000000)
+#define TYPHOON_LINK_DUPLEX_MASK       cpu_to_le32(0x00000004)
+#define TYPHOON_LINK_FULL_DUPLEX       cpu_to_le32(0x00000004)
+#define TYPHOON_LINK_HALF_DUPLEX       cpu_to_le32(0x00000000)
        __le32 unused2;
        __le32 unused3;
 } __attribute__ ((packed));
 
 /* TYPHOON_CMD_XCVR_SELECT xcvr values (resp.parm1)
  */
-#define TYPHOON_XCVR_10HALF    __constant_cpu_to_le16(0x0000)
-#define TYPHOON_XCVR_10FULL    __constant_cpu_to_le16(0x0001)
-#define TYPHOON_XCVR_100HALF   __constant_cpu_to_le16(0x0002)
-#define TYPHOON_XCVR_100FULL   __constant_cpu_to_le16(0x0003)
-#define TYPHOON_XCVR_AUTONEG   __constant_cpu_to_le16(0x0004)
+#define TYPHOON_XCVR_10HALF    cpu_to_le16(0x0000)
+#define TYPHOON_XCVR_10FULL    cpu_to_le16(0x0001)
+#define TYPHOON_XCVR_100HALF   cpu_to_le16(0x0002)
+#define TYPHOON_XCVR_100FULL   cpu_to_le16(0x0003)
+#define TYPHOON_XCVR_AUTONEG   cpu_to_le16(0x0004)
 
 /* TYPHOON_CMD_READ_MEDIA_STATUS (resp.parm1)
  */
-#define TYPHOON_MEDIA_STAT_CRC_STRIP_DISABLE   __constant_cpu_to_le16(0x0004)
-#define TYPHOON_MEDIA_STAT_COLLISION_DETECT    __constant_cpu_to_le16(0x0010)
-#define TYPHOON_MEDIA_STAT_CARRIER_SENSE       __constant_cpu_to_le16(0x0020)
-#define TYPHOON_MEDIA_STAT_POLARITY_REV                __constant_cpu_to_le16(0x0400)
-#define TYPHOON_MEDIA_STAT_NO_LINK             __constant_cpu_to_le16(0x0800)
+#define TYPHOON_MEDIA_STAT_CRC_STRIP_DISABLE   cpu_to_le16(0x0004)
+#define TYPHOON_MEDIA_STAT_COLLISION_DETECT    cpu_to_le16(0x0010)
+#define TYPHOON_MEDIA_STAT_CARRIER_SENSE       cpu_to_le16(0x0020)
+#define TYPHOON_MEDIA_STAT_POLARITY_REV                cpu_to_le16(0x0400)
+#define TYPHOON_MEDIA_STAT_NO_LINK             cpu_to_le16(0x0800)
 
 /* TYPHOON_CMD_SET_MULTICAST_HASH enable values (cmd.parm1)
  */
-#define TYPHOON_MCAST_HASH_DISABLE     __constant_cpu_to_le16(0x0000)
-#define TYPHOON_MCAST_HASH_ENABLE      __constant_cpu_to_le16(0x0001)
-#define TYPHOON_MCAST_HASH_SET         __constant_cpu_to_le16(0x0002)
+#define TYPHOON_MCAST_HASH_DISABLE     cpu_to_le16(0x0000)
+#define TYPHOON_MCAST_HASH_ENABLE      cpu_to_le16(0x0001)
+#define TYPHOON_MCAST_HASH_SET         cpu_to_le16(0x0002)
 
 /* TYPHOON_CMD_CREATE_SA descriptor and settings
  */
@@ -459,9 +459,9 @@ struct sa_descriptor {
        u16 cmd;
        u16 seqNo;
        u16 mode;
-#define TYPHOON_SA_MODE_NULL           __constant_cpu_to_le16(0x0000)
-#define TYPHOON_SA_MODE_AH             __constant_cpu_to_le16(0x0001)
-#define TYPHOON_SA_MODE_ESP            __constant_cpu_to_le16(0x0002)
+#define TYPHOON_SA_MODE_NULL           cpu_to_le16(0x0000)
+#define TYPHOON_SA_MODE_AH             cpu_to_le16(0x0001)
+#define TYPHOON_SA_MODE_ESP            cpu_to_le16(0x0002)
        u8  hashFlags;
 #define TYPHOON_SA_HASH_ENABLE         0x01
 #define TYPHOON_SA_HASH_SHA1           0x02
@@ -493,22 +493,22 @@ struct sa_descriptor {
 /* TYPHOON_CMD_SET_OFFLOAD_TASKS bits (cmd.parm2 (Tx) & cmd.parm3 (Rx))
  * This is all for IPv4.
  */
-#define TYPHOON_OFFLOAD_TCP_CHKSUM     __constant_cpu_to_le32(0x00000002)
-#define TYPHOON_OFFLOAD_UDP_CHKSUM     __constant_cpu_to_le32(0x00000004)
-#define TYPHOON_OFFLOAD_IP_CHKSUM      __constant_cpu_to_le32(0x00000008)
-#define TYPHOON_OFFLOAD_IPSEC          __constant_cpu_to_le32(0x00000010)
-#define TYPHOON_OFFLOAD_BCAST_THROTTLE __constant_cpu_to_le32(0x00000020)
-#define TYPHOON_OFFLOAD_DHCP_PREVENT   __constant_cpu_to_le32(0x00000040)
-#define TYPHOON_OFFLOAD_VLAN           __constant_cpu_to_le32(0x00000080)
-#define TYPHOON_OFFLOAD_FILTERING      __constant_cpu_to_le32(0x00000100)
-#define TYPHOON_OFFLOAD_TCP_SEGMENT    __constant_cpu_to_le32(0x00000200)
+#define TYPHOON_OFFLOAD_TCP_CHKSUM     cpu_to_le32(0x00000002)
+#define TYPHOON_OFFLOAD_UDP_CHKSUM     cpu_to_le32(0x00000004)
+#define TYPHOON_OFFLOAD_IP_CHKSUM      cpu_to_le32(0x00000008)
+#define TYPHOON_OFFLOAD_IPSEC          cpu_to_le32(0x00000010)
+#define TYPHOON_OFFLOAD_BCAST_THROTTLE cpu_to_le32(0x00000020)
+#define TYPHOON_OFFLOAD_DHCP_PREVENT   cpu_to_le32(0x00000040)
+#define TYPHOON_OFFLOAD_VLAN           cpu_to_le32(0x00000080)
+#define TYPHOON_OFFLOAD_FILTERING      cpu_to_le32(0x00000100)
+#define TYPHOON_OFFLOAD_TCP_SEGMENT    cpu_to_le32(0x00000200)
 
 /* TYPHOON_CMD_ENABLE_WAKE_EVENTS bits (cmd.parm1)
  */
-#define TYPHOON_WAKE_MAGIC_PKT         __constant_cpu_to_le16(0x01)
-#define TYPHOON_WAKE_LINK_EVENT                __constant_cpu_to_le16(0x02)
-#define TYPHOON_WAKE_ICMP_ECHO         __constant_cpu_to_le16(0x04)
-#define TYPHOON_WAKE_ARP               __constant_cpu_to_le16(0x08)
+#define TYPHOON_WAKE_MAGIC_PKT         cpu_to_le16(0x01)
+#define TYPHOON_WAKE_LINK_EVENT                cpu_to_le16(0x02)
+#define TYPHOON_WAKE_ICMP_ECHO         cpu_to_le16(0x04)
+#define TYPHOON_WAKE_ARP               cpu_to_le16(0x08)
 
 /* These are used to load the firmware image on the NIC
  */
index e87986867ba5b3042be2434f5620ca662242c1b8..1c095c63f98f482b10cf7ee71c3b84f472da12cf 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/ucc_fast.h>
 
 #include "ucc_geth.h"
-#include "ucc_geth_mii.h"
+#include "fsl_pq_mdio.h"
 
 #undef DEBUG
 
@@ -1557,7 +1557,7 @@ static int init_phy(struct net_device *dev)
        of_node_put(phy);
        of_node_put(mdio);
 
-       uec_mdio_bus_name(bus_name, mdio);
+       fsl_pq_mdio_bus_name(bus_name, mdio);
        snprintf(phy_id, sizeof(phy_id), "%s:%02x",
                                 bus_name, *id);
 
@@ -3266,7 +3266,7 @@ static int ucc_geth_poll(struct napi_struct *napi, int budget)
                howmany += ucc_geth_rx(ugeth, i, budget - howmany);
 
        if (howmany < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                setbits32(ugeth->uccf->p_uccm, UCCE_RX_EVENTS);
        }
 
@@ -3297,10 +3297,10 @@ static irqreturn_t ucc_geth_irq_handler(int irq, void *info)
 
        /* check for receive events that require processing */
        if (ucce & UCCE_RX_EVENTS) {
-               if (netif_rx_schedule_prep(&ugeth->napi)) {
+               if (napi_schedule_prep(&ugeth->napi)) {
                        uccm &= ~UCCE_RX_EVENTS;
                        out_be32(uccf->p_uccm, uccm);
-                       __netif_rx_schedule(&ugeth->napi);
+                       __napi_schedule(&ugeth->napi);
                }
        }
 
@@ -3657,7 +3657,8 @@ static int ucc_geth_probe(struct of_device* ofdev, const struct of_device_id *ma
                if (err)
                        return -1;
 
-               snprintf(ug_info->mdio_bus, MII_BUS_ID_SIZE, "%x", res.start);
+               snprintf(ug_info->mdio_bus, MII_BUS_ID_SIZE, "%x",
+                               res.start&0xfffff);
        }
 
        /* get the phy interface type, or default to MII */
@@ -3803,11 +3804,6 @@ static int __init ucc_geth_init(void)
 {
        int i, ret;
 
-       ret = uec_mdio_init();
-
-       if (ret)
-               return ret;
-
        if (netif_msg_drv(&debug))
                printk(KERN_INFO "ucc_geth: " DRV_DESC "\n");
        for (i = 0; i < 8; i++)
@@ -3816,16 +3812,12 @@ static int __init ucc_geth_init(void)
 
        ret = of_register_platform_driver(&ucc_geth_driver);
 
-       if (ret)
-               uec_mdio_exit();
-
        return ret;
 }
 
 static void __exit ucc_geth_exit(void)
 {
        of_unregister_platform_driver(&ucc_geth_driver);
-       uec_mdio_exit();
 }
 
 module_init(ucc_geth_init);
index 16cbe42ba43c9b0f8097222306324498da489abe..66d18971fa0c74cf2dbd7b127fd7ebcdc5beac2f 100644 (file)
@@ -28,8 +28,6 @@
 #include <asm/ucc.h>
 #include <asm/ucc_fast.h>
 
-#include "ucc_geth_mii.h"
-
 #define DRV_DESC "QE UCC Gigabit Ethernet Controller"
 #define DRV_NAME "ucc_geth"
 #define DRV_VERSION "1.1"
@@ -184,6 +182,18 @@ struct ucc_geth {
 #define UCCE_RX_EVENTS  (UCCE_RXF | UCC_GETH_UCCE_BSY)
 #define UCCE_TX_EVENTS (UCCE_TXB | UCC_GETH_UCCE_TXE)
 
+/* TBI defines */
+#define        ENET_TBI_MII_CR         0x00    /* Control */
+#define        ENET_TBI_MII_SR         0x01    /* Status */
+#define        ENET_TBI_MII_ANA        0x04    /* AN advertisement */
+#define        ENET_TBI_MII_ANLPBPA    0x05    /* AN link partner base page ability */
+#define        ENET_TBI_MII_ANEX       0x06    /* AN expansion */
+#define        ENET_TBI_MII_ANNPT      0x07    /* AN next page transmit */
+#define        ENET_TBI_MII_ANLPANP    0x08    /* AN link partner ability next page */
+#define        ENET_TBI_MII_EXST       0x0F    /* Extended status */
+#define        ENET_TBI_MII_JD         0x10    /* Jitter diagnostics */
+#define        ENET_TBI_MII_TBICON     0x11    /* TBI control */
+
 /* UCC GETH MACCFG1 (MAC Configuration 1 Register) */
 #define MACCFG1_FLOW_RX                         0x00000020     /* Flow Control
                                                                   Rx */
index 68a7f5414133d230bcb36b54a9e9ac4d626b8a08..a755bea559b98deb9d091c95eba19db84642a732 100644 (file)
@@ -39,7 +39,6 @@
 #include <asm/types.h>
 
 #include "ucc_geth.h"
-#include "ucc_geth_mii.h"
 
 static char hw_stat_gstrings[][ETH_GSTRING_LEN] = {
        "tx-64-frames",
diff --git a/drivers/net/ucc_geth_mii.c b/drivers/net/ucc_geth_mii.c
deleted file mode 100644 (file)
index 5463591..0000000
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * drivers/net/ucc_geth_mii.c
- *
- * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
- * Provides Bus interface for MII Management regs in the UCC register space
- *
- * Copyright (C) 2007 Freescale Semiconductor, Inc.
- *
- * Authors: Li Yang <leoli@freescale.com>
- *         Kim Phillips <kim.phillips@freescale.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/errno.h>
-#include <linux/unistd.h>
-#include <linux/slab.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
-#include <linux/spinlock.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/platform_device.h>
-#include <linux/crc32.h>
-#include <linux/mii.h>
-#include <linux/phy.h>
-#include <linux/fsl_devices.h>
-#include <linux/of_platform.h>
-
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/ucc.h>
-
-#include "ucc_geth_mii.h"
-#include "ucc_geth.h"
-
-#define DEBUG
-#ifdef DEBUG
-#define vdbg(format, arg...) printk(KERN_DEBUG , format "\n" , ## arg)
-#else
-#define vdbg(format, arg...) do {} while(0)
-#endif
-
-#define MII_DRV_DESC "QE UCC Ethernet Controller MII Bus"
-#define MII_DRV_NAME "fsl-uec_mdio"
-
-/* Write value to the PHY for this device to the register at regnum, */
-/* waiting until the write is done before it returns.  All PHY */
-/* configuration has to be done through the master UEC MIIM regs */
-int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value)
-{
-       struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
-
-       /* Setting up the MII Mangement Address Register */
-       out_be32(&regs->miimadd,
-                (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
-
-       /* Setting up the MII Mangement Control Register with the value */
-       out_be32(&regs->miimcon, value);
-
-       /* Wait till MII management write is complete */
-       while ((in_be32(&regs->miimind)) & MIIMIND_BUSY)
-               cpu_relax();
-
-       return 0;
-}
-
-/* Reads from register regnum in the PHY for device dev, */
-/* returning the value.  Clears miimcom first.  All PHY */
-/* configuration has to be done through the TSEC1 MIIM regs */
-int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum)
-{
-       struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
-       u16 value;
-
-       /* Setting up the MII Mangement Address Register */
-       out_be32(&regs->miimadd,
-                (mii_id << MIIMADD_PHY_ADDRESS_SHIFT) | regnum);
-
-       /* Clear miimcom, perform an MII management read cycle */
-       out_be32(&regs->miimcom, 0);
-       out_be32(&regs->miimcom, MIIMCOM_READ_CYCLE);
-
-       /* Wait till MII management write is complete */
-       while ((in_be32(&regs->miimind)) & (MIIMIND_BUSY | MIIMIND_NOT_VALID))
-               cpu_relax();
-
-       /* Read MII management status  */
-       value = in_be32(&regs->miimstat);
-
-       return value;
-}
-
-/* Reset the MIIM registers, and wait for the bus to free */
-static int uec_mdio_reset(struct mii_bus *bus)
-{
-       struct ucc_mii_mng __iomem *regs = (void __iomem *)bus->priv;
-       unsigned int timeout = PHY_INIT_TIMEOUT;
-
-       mutex_lock(&bus->mdio_lock);
-
-       /* Reset the management interface */
-       out_be32(&regs->miimcfg, MIIMCFG_RESET_MANAGEMENT);
-
-       /* Setup the MII Mgmt clock speed */
-       out_be32(&regs->miimcfg, MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112);
-
-       /* Wait until the bus is free */
-       while ((in_be32(&regs->miimind) & MIIMIND_BUSY) && timeout--)
-               cpu_relax();
-
-       mutex_unlock(&bus->mdio_lock);
-
-       if (timeout <= 0) {
-               printk(KERN_ERR "%s: The MII Bus is stuck!\n", bus->name);
-               return -EBUSY;
-       }
-
-       return 0;
-}
-
-static int uec_mdio_probe(struct of_device *ofdev, const struct of_device_id *match)
-{
-       struct device *device = &ofdev->dev;
-       struct device_node *np = ofdev->node, *tempnp = NULL;
-       struct device_node *child = NULL;
-       struct ucc_mii_mng __iomem *regs;
-       struct mii_bus *new_bus;
-       struct resource res;
-       int k, err = 0;
-
-       new_bus = mdiobus_alloc();
-       if (NULL == new_bus)
-               return -ENOMEM;
-
-       new_bus->name = "UCC Ethernet Controller MII Bus";
-       new_bus->read = &uec_mdio_read;
-       new_bus->write = &uec_mdio_write;
-       new_bus->reset = &uec_mdio_reset;
-
-       memset(&res, 0, sizeof(res));
-
-       err = of_address_to_resource(np, 0, &res);
-       if (err)
-               goto reg_map_fail;
-
-       uec_mdio_bus_name(new_bus->id, np);
-
-       new_bus->irq = kmalloc(32 * sizeof(int), GFP_KERNEL);
-
-       if (NULL == new_bus->irq) {
-               err = -ENOMEM;
-               goto reg_map_fail;
-       }
-
-       for (k = 0; k < 32; k++)
-               new_bus->irq[k] = PHY_POLL;
-
-       while ((child = of_get_next_child(np, child)) != NULL) {
-               int irq = irq_of_parse_and_map(child, 0);
-               if (irq != NO_IRQ) {
-                       const u32 *id = of_get_property(child, "reg", NULL);
-                       new_bus->irq[*id] = irq;
-               }
-       }
-
-       /* Set the base address */
-       regs = ioremap(res.start, sizeof(struct ucc_mii_mng));
-
-       if (NULL == regs) {
-               err = -ENOMEM;
-               goto ioremap_fail;
-       }
-
-       new_bus->priv = (void __force *)regs;
-
-       new_bus->parent = device;
-       dev_set_drvdata(device, new_bus);
-
-       /* Read MII management master from device tree */
-       while ((tempnp = of_find_compatible_node(tempnp, "network", "ucc_geth"))
-              != NULL) {
-               struct resource tempres;
-
-               err = of_address_to_resource(tempnp, 0, &tempres);
-               if (err)
-                       goto bus_register_fail;
-
-               /* if our mdio regs fall within this UCC regs range */
-               if ((res.start >= tempres.start) &&
-                   (res.end <= tempres.end)) {
-                       /* set this UCC to be the MII master */
-                       const u32 *id;
-
-                       id = of_get_property(tempnp, "cell-index", NULL);
-                       if (!id) {
-                               id = of_get_property(tempnp, "device-id", NULL);
-                               if (!id)
-                                       goto bus_register_fail;
-                       }
-
-                       ucc_set_qe_mux_mii_mng(*id - 1);
-
-                       /* assign the TBI an address which won't
-                        * conflict with the PHYs */
-                       out_be32(&regs->utbipar, UTBIPAR_INIT_TBIPA);
-                       break;
-               }
-       }
-
-       err = mdiobus_register(new_bus);
-       if (0 != err) {
-               printk(KERN_ERR "%s: Cannot register as MDIO bus\n",
-                      new_bus->name);
-               goto bus_register_fail;
-       }
-
-       return 0;
-
-bus_register_fail:
-       iounmap(regs);
-ioremap_fail:
-       kfree(new_bus->irq);
-reg_map_fail:
-       mdiobus_free(new_bus);
-
-       return err;
-}
-
-static int uec_mdio_remove(struct of_device *ofdev)
-{
-       struct device *device = &ofdev->dev;
-       struct mii_bus *bus = dev_get_drvdata(device);
-
-       mdiobus_unregister(bus);
-
-       dev_set_drvdata(device, NULL);
-
-       iounmap((void __iomem *)bus->priv);
-       bus->priv = NULL;
-       mdiobus_free(bus);
-
-       return 0;
-}
-
-static struct of_device_id uec_mdio_match[] = {
-       {
-               .type = "mdio",
-               .compatible = "ucc_geth_phy",
-       },
-       {
-               .compatible = "fsl,ucc-mdio",
-       },
-       {},
-};
-
-static struct of_platform_driver uec_mdio_driver = {
-       .name   = MII_DRV_NAME,
-       .probe  = uec_mdio_probe,
-       .remove = uec_mdio_remove,
-       .match_table    = uec_mdio_match,
-};
-
-int __init uec_mdio_init(void)
-{
-       return of_register_platform_driver(&uec_mdio_driver);
-}
-
-/* called from __init ucc_geth_init, therefore can not be __exit */
-void uec_mdio_exit(void)
-{
-       of_unregister_platform_driver(&uec_mdio_driver);
-}
-
-void uec_mdio_bus_name(char *name, struct device_node *np)
-{
-        const u32 *reg;
-
-        reg = of_get_property(np, "reg", NULL);
-
-        snprintf(name, MII_BUS_ID_SIZE, "%s@%x", np->name, reg ? *reg : 0);
-}
-
diff --git a/drivers/net/ucc_geth_mii.h b/drivers/net/ucc_geth_mii.h
deleted file mode 100644 (file)
index 840cf80..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * drivers/net/ucc_geth_mii.h
- *
- * QE UCC Gigabit Ethernet Driver -- MII Management Bus Implementation
- * Provides Bus interface for MII Management regs in the UCC register space
- *
- * Copyright (C) 2007 Freescale Semiconductor, Inc.
- *
- * Authors: Li Yang <leoli@freescale.com>
- *         Kim Phillips <kim.phillips@freescale.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-#ifndef __UEC_MII_H
-#define __UEC_MII_H
-
-/* UCC GETH MIIMCFG (MII Management Configuration Register) */
-#define MIIMCFG_RESET_MANAGEMENT                0x80000000     /* Reset
-                                                                  management */
-#define MIIMCFG_NO_PREAMBLE                     0x00000010     /* Preamble
-                                                                  suppress */
-#define MIIMCFG_CLOCK_DIVIDE_SHIFT              (31 - 31)      /* clock divide
-                                                                  << shift */
-#define MIIMCFG_CLOCK_DIVIDE_MAX                0xf    /* max clock divide */
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_2    0x00000000
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_4    0x00000001
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_6    0x00000002
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_8    0x00000003
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_10   0x00000004
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_14   0x00000005
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_16   0x00000008
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_20   0x00000006
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_28   0x00000007
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_32   0x00000009
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_48   0x0000000a
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_64   0x0000000b
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_80   0x0000000c
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_112  0x0000000d
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_160  0x0000000e
-#define MIIMCFG_MANAGEMENT_CLOCK_DIVIDE_BY_224  0x0000000f
-
-/* UCC GETH MIIMCOM (MII Management Command Register) */
-#define MIIMCOM_SCAN_CYCLE                      0x00000002     /* Scan cycle */
-#define MIIMCOM_READ_CYCLE                      0x00000001     /* Read cycle */
-
-/* UCC GETH MIIMADD (MII Management Address Register) */
-#define MIIMADD_PHY_ADDRESS_SHIFT               (31 - 23)      /* PHY Address
-                                                                  << shift */
-#define MIIMADD_PHY_REGISTER_SHIFT              (31 - 31)      /* PHY Register
-                                                                  << shift */
-
-/* UCC GETH MIIMCON (MII Management Control Register) */
-#define MIIMCON_PHY_CONTROL_SHIFT               (31 - 31)      /* PHY Control
-                                                                  << shift */
-#define MIIMCON_PHY_STATUS_SHIFT                (31 - 31)      /* PHY Status
-                                                                  << shift */
-
-/* UCC GETH MIIMIND (MII Management Indicator Register) */
-#define MIIMIND_NOT_VALID                       0x00000004     /* Not valid */
-#define MIIMIND_SCAN                            0x00000002     /* Scan in
-                                                                  progress */
-#define MIIMIND_BUSY                            0x00000001
-
-/* Initial TBI Physical Address */
-#define UTBIPAR_INIT_TBIPA                     0x1f
-
-struct ucc_mii_mng {
-       u32 miimcfg;            /* MII management configuration reg */
-       u32 miimcom;            /* MII management command reg */
-       u32 miimadd;            /* MII management address reg */
-       u32 miimcon;            /* MII management control reg */
-       u32 miimstat;           /* MII management status reg */
-       u32 miimind;            /* MII management indication reg */
-       u8 notcare[28];         /* Space holder */
-       u32 utbipar;            /* TBI phy address reg */
-} __attribute__ ((packed));
-
-/* TBI / MII Set Register */
-enum enet_tbi_mii_reg {
-       ENET_TBI_MII_CR = 0x00, /* Control */
-       ENET_TBI_MII_SR = 0x01, /* Status */
-       ENET_TBI_MII_ANA = 0x04,        /* AN advertisement */
-       ENET_TBI_MII_ANLPBPA = 0x05,    /* AN link partner base page ability */
-       ENET_TBI_MII_ANEX = 0x06,       /* AN expansion */
-       ENET_TBI_MII_ANNPT = 0x07,      /* AN next page transmit */
-       ENET_TBI_MII_ANLPANP = 0x08,    /* AN link partner ability next page */
-       ENET_TBI_MII_EXST = 0x0F,       /* Extended status */
-       ENET_TBI_MII_JD = 0x10, /* Jitter diagnostics */
-       ENET_TBI_MII_TBICON = 0x11      /* TBI control */
-};
-
-int uec_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
-int uec_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
-int __init uec_mdio_init(void);
-void uec_mdio_exit(void);
-void uec_mdio_bus_name(char *name, struct device_node *np);
-#endif                         /* __UEC_MII_H */
index fe98acaead976a1bdd6c5158377500e0a14a32b2..a074c16e2a62c0ca2f6f87da709cfb158d74dc9c 100644 (file)
@@ -936,8 +936,7 @@ static void packetizeRx(struct hso_net *odev, unsigned char *ip_pkt,
                        if (!odev->rx_buf_missing) {
                                /* Packet is complete. Inject into stack. */
                                /* We have IP packet here */
-                               odev->skb_rx_buf->protocol =
-                                               __constant_htons(ETH_P_IP);
+                               odev->skb_rx_buf->protocol = cpu_to_be16(ETH_P_IP);
                                /* don't check it */
                                odev->skb_rx_buf->ip_summed =
                                        CHECKSUM_UNNECESSARY;
@@ -1247,7 +1246,7 @@ static void hso_std_serial_read_bulk_callback(struct urb *urb)
  * This needs to be a tasklet otherwise we will
  * end up recursively calling this function.
  */
-void hso_unthrottle_tasklet(struct hso_serial *serial)
+static void hso_unthrottle_tasklet(struct hso_serial *serial)
 {
        unsigned long flags;
 
@@ -1266,7 +1265,7 @@ static    void hso_unthrottle(struct tty_struct *tty)
        tasklet_hi_schedule(&serial->unthrottle_tasklet);
 }
 
-void hso_unthrottle_workfunc(struct work_struct *work)
+static void hso_unthrottle_workfunc(struct work_struct *work)
 {
        struct hso_serial *serial =
            container_of(work, struct hso_serial,
@@ -1465,9 +1464,9 @@ static int hso_serial_chars_in_buffer(struct tty_struct *tty)
 
        return chars;
 }
-int tiocmget_submit_urb(struct hso_serial *serial,
-                       struct hso_tiocmget  *tiocmget,
-                       struct usb_device *usb)
+static int tiocmget_submit_urb(struct hso_serial *serial,
+                              struct hso_tiocmget *tiocmget,
+                              struct usb_device *usb)
 {
        int result;
 
index bcd858c567e04ef30c553d4c17783622a541f3ce..b7f763e1298ccb781e68a0e5b1040bf5ef5493fe 100644 (file)
@@ -169,7 +169,7 @@ int rndis_command(struct usbnet *dev, struct rndis_msg_hdr *buf, int buflen)
                                struct rndis_keepalive_c *msg = (void *)buf;
 
                                msg->msg_type = RNDIS_MSG_KEEPALIVE_C;
-                               msg->msg_len = ccpu2(sizeof *msg);
+                               msg->msg_len = cpu_to_le32(sizeof *msg);
                                msg->status = RNDIS_STATUS_SUCCESS;
                                retval = usb_control_msg(dev->udev,
                                        usb_sndctrlpipe(dev->udev, 0),
@@ -237,7 +237,7 @@ static int rndis_query(struct usbnet *dev, struct usb_interface *intf,
        u.get->msg_len = cpu_to_le32(sizeof *u.get + in_len);
        u.get->oid = oid;
        u.get->len = cpu_to_le32(in_len);
-       u.get->offset = ccpu2(20);
+       u.get->offset = cpu_to_le32(20);
 
        retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
        if (unlikely(retval < 0)) {
@@ -297,9 +297,9 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
                goto fail;
 
        u.init->msg_type = RNDIS_MSG_INIT;
-       u.init->msg_len = ccpu2(sizeof *u.init);
-       u.init->major_version = ccpu2(1);
-       u.init->minor_version = ccpu2(0);
+       u.init->msg_len = cpu_to_le32(sizeof *u.init);
+       u.init->major_version = cpu_to_le32(1);
+       u.init->minor_version = cpu_to_le32(0);
 
        /* max transfer (in spec) is 0x4000 at full speed, but for
         * TX we'll stick to one Ethernet packet plus RNDIS framing.
@@ -403,10 +403,10 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
        /* set a nonzero filter to enable data transfers */
        memset(u.set, 0, sizeof *u.set);
        u.set->msg_type = RNDIS_MSG_SET;
-       u.set->msg_len = ccpu2(4 + sizeof *u.set);
+       u.set->msg_len = cpu_to_le32(4 + sizeof *u.set);
        u.set->oid = OID_GEN_CURRENT_PACKET_FILTER;
-       u.set->len = ccpu2(4);
-       u.set->offset = ccpu2((sizeof *u.set) - 8);
+       u.set->len = cpu_to_le32(4);
+       u.set->offset = cpu_to_le32((sizeof *u.set) - 8);
        *(__le32 *)(u.buf + sizeof *u.set) = RNDIS_DEFAULT_FILTER;
 
        retval = rndis_command(dev, u.header, CONTROL_BUFFER_SIZE);
@@ -423,7 +423,7 @@ generic_rndis_bind(struct usbnet *dev, struct usb_interface *intf, int flags)
 halt_fail_and_release:
        memset(u.halt, 0, sizeof *u.halt);
        u.halt->msg_type = RNDIS_MSG_HALT;
-       u.halt->msg_len = ccpu2(sizeof *u.halt);
+       u.halt->msg_len = cpu_to_le32(sizeof *u.halt);
        (void) rndis_command(dev, (void *)u.halt, CONTROL_BUFFER_SIZE);
 fail_and_release:
        usb_set_intfdata(info->data, NULL);
@@ -448,7 +448,7 @@ void rndis_unbind(struct usbnet *dev, struct usb_interface *intf)
        halt = kzalloc(CONTROL_BUFFER_SIZE, GFP_KERNEL);
        if (halt) {
                halt->msg_type = RNDIS_MSG_HALT;
-               halt->msg_len = ccpu2(sizeof *halt);
+               halt->msg_len = cpu_to_le32(sizeof *halt);
                (void) rndis_command(dev, (void *)halt, CONTROL_BUFFER_SIZE);
                kfree(halt);
        }
@@ -543,7 +543,7 @@ fill:
        memset(hdr, 0, sizeof *hdr);
        hdr->msg_type = RNDIS_MSG_PACKET;
        hdr->msg_len = cpu_to_le32(skb->len);
-       hdr->data_offset = ccpu2(sizeof(*hdr) - 8);
+       hdr->data_offset = cpu_to_le32(sizeof(*hdr) - 8);
        hdr->data_len = cpu_to_le32(len);
 
        /* FIXME make the last packet always be short ... */
@@ -562,9 +562,6 @@ static const struct driver_info     rndis_info = {
        .tx_fixup =     rndis_tx_fixup,
 };
 
-#undef ccpu2
-
-
 /*-------------------------------------------------------------------------*/
 
 static const struct usb_device_id      products [] = {
index 5574abe29c73b64c63d0e123e132f3afb762e7f3..3e6155a38f0cdec848c26736e1c269a088a3d585 100644 (file)
@@ -55,11 +55,10 @@ struct smsc95xx_priv {
 
 struct usb_context {
        struct usb_ctrlrequest req;
-       struct completion notify;
        struct usbnet *dev;
 };
 
-int turbo_mode = true;
+static int turbo_mode = true;
 module_param(turbo_mode, bool, 0644);
 MODULE_PARM_DESC(turbo_mode, "Enable multiple frames per Rx transaction");
 
@@ -307,7 +306,7 @@ static int smsc95xx_write_eeprom(struct usbnet *dev, u32 offset, u32 length,
        return 0;
 }
 
-static void smsc95xx_async_cmd_callback(struct urb *urb, struct pt_regs *regs)
+static void smsc95xx_async_cmd_callback(struct urb *urb)
 {
        struct usb_context *usb_context = urb->context;
        struct usbnet *dev = usb_context->dev;
@@ -316,8 +315,6 @@ static void smsc95xx_async_cmd_callback(struct urb *urb, struct pt_regs *regs)
        if (status < 0)
                devwarn(dev, "async callback failed with %d", status);
 
-       complete(&usb_context->notify);
-
        kfree(usb_context);
        usb_free_urb(urb);
 }
@@ -348,11 +345,10 @@ static int smsc95xx_write_reg_async(struct usbnet *dev, u16 index, u32 *data)
        usb_context->req.wValue = 00;
        usb_context->req.wIndex = cpu_to_le16(index);
        usb_context->req.wLength = cpu_to_le16(size);
-       init_completion(&usb_context->notify);
 
        usb_fill_control_urb(urb, dev->udev, usb_sndctrlpipe(dev->udev, 0),
                (void *)&usb_context->req, data, size,
-               (usb_complete_t)smsc95xx_async_cmd_callback,
+               smsc95xx_async_cmd_callback,
                (void *)usb_context);
 
        status = usb_submit_urb(urb, GFP_ATOMIC);
index 3b8e63254277e1bdb5c1d7b86afcc47c77939646..4671436ecf0ed236d3263e9f0ac70096fbe4e6ec 100644 (file)
@@ -589,7 +589,7 @@ static int rhine_napipoll(struct napi_struct *napi, int budget)
        work_done = rhine_rx(dev, budget);
 
        if (work_done < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
 
                iowrite16(IntrRxDone | IntrRxErr | IntrRxEmpty| IntrRxOverflow |
                          IntrRxDropped | IntrRxNoBuf | IntrTxAborted |
@@ -1319,7 +1319,7 @@ static irqreturn_t rhine_interrupt(int irq, void *dev_instance)
                                  IntrPCIErr | IntrStatsMax | IntrLinkChange,
                                  ioaddr + IntrEnable);
 
-                       netif_rx_schedule(&rp->napi);
+                       napi_schedule(&rp->napi);
                }
 
                if (intr_status & (IntrTxErrSummary | IntrTxDone)) {
index 29a33090d3d4d7775c44eea63f13d5bbe1881c1a..ea43e1832afba07d389861b05ef3b2f6102f4595 100644 (file)
@@ -183,7 +183,7 @@ struct rdesc1 {
 };
 
 enum {
-       RX_INTEN = __constant_cpu_to_le16(0x8000)
+       RX_INTEN = cpu_to_le16(0x8000)
 };
 
 struct rx_desc {
@@ -210,7 +210,7 @@ struct tdesc1 {
 } __attribute__ ((__packed__));
 
 enum {
-       TD_QUEUE = __constant_cpu_to_le16(0x8000)
+       TD_QUEUE = cpu_to_le16(0x8000)
 };
 
 struct td_buf {
@@ -242,7 +242,7 @@ struct velocity_td_info {
 
 enum  velocity_owner {
        OWNED_BY_HOST = 0,
-       OWNED_BY_NIC = __constant_cpu_to_le16(0x8000)
+       OWNED_BY_NIC = cpu_to_le16(0x8000)
 };
 
 
index c68808336c8c4d84e90e03a8d0649592b72c1626..3d0033920224715360c67a75c608f9a7f42da17b 100644 (file)
@@ -37,12 +37,15 @@ module_param(gso, bool, 0444);
 #define MAX_PACKET_LEN (ETH_HLEN + VLAN_HLEN + ETH_DATA_LEN)
 #define GOOD_COPY_LEN  128
 
+#define VIRTNET_SEND_COMMAND_SG_MAX    2
+
 struct virtnet_info
 {
        struct virtio_device *vdev;
-       struct virtqueue *rvq, *svq;
+       struct virtqueue *rvq, *svq, *cvq;
        struct net_device *dev;
        struct napi_struct napi;
+       unsigned int status;
 
        /* The skb we couldn't send because buffers were full. */
        struct sk_buff *last_xmit_skb;
@@ -375,9 +378,9 @@ static void skb_recv_done(struct virtqueue *rvq)
 {
        struct virtnet_info *vi = rvq->vdev->priv;
        /* Schedule NAPI, Suppress further interrupts if successful. */
-       if (netif_rx_schedule_prep(&vi->napi)) {
+       if (napi_schedule_prep(&vi->napi)) {
                rvq->vq_ops->disable_cb(rvq);
-               __netif_rx_schedule(&vi->napi);
+               __napi_schedule(&vi->napi);
        }
 }
 
@@ -403,11 +406,11 @@ again:
 
        /* Out of packets? */
        if (received < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                if (unlikely(!vi->rvq->vq_ops->enable_cb(vi->rvq))
                    && napi_schedule_prep(napi)) {
                        vi->rvq->vq_ops->disable_cb(vi->rvq);
-                       __netif_rx_schedule(napi);
+                       __napi_schedule(napi);
                        goto again;
                }
        }
@@ -562,6 +565,22 @@ stop_queue:
        goto done;
 }
 
+static int virtnet_set_mac_address(struct net_device *dev, void *p)
+{
+       struct virtnet_info *vi = netdev_priv(dev);
+       struct virtio_device *vdev = vi->vdev;
+       int ret;
+
+       ret = eth_mac_addr(dev, p);
+       if (ret)
+               return ret;
+
+       vdev->config->set(vdev, offsetof(struct virtio_net_config, mac),
+                         dev->dev_addr, dev->addr_len);
+
+       return 0;
+}
+
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void virtnet_netpoll(struct net_device *dev)
 {
@@ -581,13 +600,60 @@ static int virtnet_open(struct net_device *dev)
         * won't get another interrupt, so process any outstanding packets
         * now.  virtnet_poll wants re-enable the queue, so we disable here.
         * We synchronize against interrupts via NAPI_STATE_SCHED */
-       if (netif_rx_schedule_prep(&vi->napi)) {
+       if (napi_schedule_prep(&vi->napi)) {
                vi->rvq->vq_ops->disable_cb(vi->rvq);
-               __netif_rx_schedule(&vi->napi);
+               __napi_schedule(&vi->napi);
        }
        return 0;
 }
 
+/*
+ * Send command via the control virtqueue and check status.  Commands
+ * supported by the hypervisor, as indicated by feature bits, should
+ * never fail unless improperly formated.
+ */
+static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd,
+                                struct scatterlist *data, int out, int in)
+{
+       struct scatterlist sg[VIRTNET_SEND_COMMAND_SG_MAX + 2];
+       struct virtio_net_ctrl_hdr ctrl;
+       virtio_net_ctrl_ack status = ~0;
+       unsigned int tmp;
+
+       if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)) {
+               BUG();  /* Caller should know better */
+               return false;
+       }
+
+       BUG_ON(out + in > VIRTNET_SEND_COMMAND_SG_MAX);
+
+       out++; /* Add header */
+       in++; /* Add return status */
+
+       ctrl.class = class;
+       ctrl.cmd = cmd;
+
+       sg_init_table(sg, out + in);
+
+       sg_set_buf(&sg[0], &ctrl, sizeof(ctrl));
+       memcpy(&sg[1], data, sizeof(struct scatterlist) * (out + in - 2));
+       sg_set_buf(&sg[out + in - 1], &status, sizeof(status));
+
+       if (vi->cvq->vq_ops->add_buf(vi->cvq, sg, out, in, vi) != 0)
+               BUG();
+
+       vi->cvq->vq_ops->kick(vi->cvq);
+
+       /*
+        * Spin for a response, the kick causes an ioport write, trapping
+        * into the hypervisor, so the request should be handled immediately.
+        */
+       while (!vi->cvq->vq_ops->get_buf(vi->cvq, &tmp))
+               cpu_relax();
+
+       return status == VIRTIO_NET_OK;
+}
+
 static int virtnet_close(struct net_device *dev)
 {
        struct virtnet_info *vi = netdev_priv(dev);
@@ -608,10 +674,104 @@ static int virtnet_set_tx_csum(struct net_device *dev, u32 data)
        return ethtool_op_set_tx_hw_csum(dev, data);
 }
 
+static void virtnet_set_rx_mode(struct net_device *dev)
+{
+       struct virtnet_info *vi = netdev_priv(dev);
+       struct scatterlist sg[2];
+       u8 promisc, allmulti;
+       struct virtio_net_ctrl_mac *mac_data;
+       struct dev_addr_list *addr;
+       void *buf;
+       int i;
+
+       /* We can't dynamicaly set ndo_set_rx_mode, so return gracefully */
+       if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_RX))
+               return;
+
+       promisc = ((dev->flags & IFF_PROMISC) != 0);
+       allmulti = ((dev->flags & IFF_ALLMULTI) != 0);
+
+       sg_set_buf(sg, &promisc, sizeof(promisc));
+
+       if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX,
+                                 VIRTIO_NET_CTRL_RX_PROMISC,
+                                 sg, 1, 0))
+               dev_warn(&dev->dev, "Failed to %sable promisc mode.\n",
+                        promisc ? "en" : "dis");
+
+       sg_set_buf(sg, &allmulti, sizeof(allmulti));
+
+       if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_RX,
+                                 VIRTIO_NET_CTRL_RX_ALLMULTI,
+                                 sg, 1, 0))
+               dev_warn(&dev->dev, "Failed to %sable allmulti mode.\n",
+                        allmulti ? "en" : "dis");
+
+       /* MAC filter - use one buffer for both lists */
+       mac_data = buf = kzalloc(((dev->uc_count + dev->mc_count) * ETH_ALEN) +
+                                (2 * sizeof(mac_data->entries)), GFP_ATOMIC);
+       if (!buf) {
+               dev_warn(&dev->dev, "No memory for MAC address buffer\n");
+               return;
+       }
+
+       /* Store the unicast list and count in the front of the buffer */
+       mac_data->entries = dev->uc_count;
+       addr = dev->uc_list;
+       for (i = 0; i < dev->uc_count; i++, addr = addr->next)
+               memcpy(&mac_data->macs[i][0], addr->da_addr, ETH_ALEN);
+
+       sg_set_buf(&sg[0], mac_data,
+                  sizeof(mac_data->entries) + (dev->uc_count * ETH_ALEN));
+
+       /* multicast list and count fill the end */
+       mac_data = (void *)&mac_data->macs[dev->uc_count][0];
+
+       mac_data->entries = dev->mc_count;
+       addr = dev->mc_list;
+       for (i = 0; i < dev->mc_count; i++, addr = addr->next)
+               memcpy(&mac_data->macs[i][0], addr->da_addr, ETH_ALEN);
+
+       sg_set_buf(&sg[1], mac_data,
+                  sizeof(mac_data->entries) + (dev->mc_count * ETH_ALEN));
+
+       if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC,
+                                 VIRTIO_NET_CTRL_MAC_TABLE_SET,
+                                 sg, 2, 0))
+               dev_warn(&dev->dev, "Failed to set MAC fitler table.\n");
+
+       kfree(buf);
+}
+
+static void virnet_vlan_rx_add_vid(struct net_device *dev, u16 vid)
+{
+       struct virtnet_info *vi = netdev_priv(dev);
+       struct scatterlist sg;
+
+       sg_set_buf(&sg, &vid, sizeof(vid));
+
+       if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
+                                 VIRTIO_NET_CTRL_VLAN_ADD, &sg, 1, 0))
+               dev_warn(&dev->dev, "Failed to add VLAN ID %d.\n", vid);
+}
+
+static void virnet_vlan_rx_kill_vid(struct net_device *dev, u16 vid)
+{
+       struct virtnet_info *vi = netdev_priv(dev);
+       struct scatterlist sg;
+
+       sg_set_buf(&sg, &vid, sizeof(vid));
+
+       if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN,
+                                 VIRTIO_NET_CTRL_VLAN_DEL, &sg, 1, 0))
+               dev_warn(&dev->dev, "Failed to kill VLAN ID %d.\n", vid);
+}
+
 static struct ethtool_ops virtnet_ethtool_ops = {
        .set_tx_csum = virtnet_set_tx_csum,
        .set_sg = ethtool_op_set_sg,
        .set_tso = ethtool_op_set_tso,
+       .get_link = ethtool_op_get_link,
 };
 
 #define MIN_MTU 68
@@ -630,13 +790,51 @@ static const struct net_device_ops virtnet_netdev = {
        .ndo_stop            = virtnet_close,
        .ndo_start_xmit      = start_xmit,
        .ndo_validate_addr   = eth_validate_addr,
-       .ndo_set_mac_address = eth_mac_addr,
+       .ndo_set_mac_address = virtnet_set_mac_address,
+       .ndo_set_rx_mode     = virtnet_set_rx_mode,
        .ndo_change_mtu      = virtnet_change_mtu,
+       .ndo_vlan_rx_add_vid = virnet_vlan_rx_add_vid,
+       .ndo_vlan_rx_kill_vid = virnet_vlan_rx_kill_vid,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller = virtnet_netpoll,
 #endif
 };
 
+static void virtnet_update_status(struct virtnet_info *vi)
+{
+       u16 v;
+
+       if (!virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS))
+               return;
+
+       vi->vdev->config->get(vi->vdev,
+                             offsetof(struct virtio_net_config, status),
+                             &v, sizeof(v));
+
+       /* Ignore unknown (future) status bits */
+       v &= VIRTIO_NET_S_LINK_UP;
+
+       if (vi->status == v)
+               return;
+
+       vi->status = v;
+
+       if (vi->status & VIRTIO_NET_S_LINK_UP) {
+               netif_carrier_on(vi->dev);
+               netif_wake_queue(vi->dev);
+       } else {
+               netif_carrier_off(vi->dev);
+               netif_stop_queue(vi->dev);
+       }
+}
+
+static void virtnet_config_changed(struct virtio_device *vdev)
+{
+       struct virtnet_info *vi = vdev->priv;
+
+       virtnet_update_status(vi);
+}
+
 static int virtnet_probe(struct virtio_device *vdev)
 {
        int err;
@@ -678,8 +876,11 @@ static int virtnet_probe(struct virtio_device *vdev)
                vdev->config->get(vdev,
                                  offsetof(struct virtio_net_config, mac),
                                  dev->dev_addr, dev->addr_len);
-       } else
+       } else {
                random_ether_addr(dev->dev_addr);
+               vdev->config->set(vdev, offsetof(struct virtio_net_config, mac),
+                                 dev->dev_addr, dev->addr_len);
+       }
 
        /* Set up our device-specific information */
        vi = netdev_priv(dev);
@@ -715,6 +916,17 @@ static int virtnet_probe(struct virtio_device *vdev)
                goto free_recv;
        }
 
+       if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)) {
+               vi->cvq = vdev->config->find_vq(vdev, 2, NULL);
+               if (IS_ERR(vi->cvq)) {
+                       err = PTR_ERR(vi->svq);
+                       goto free_send;
+               }
+
+               if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VLAN))
+                       dev->features |= NETIF_F_HW_VLAN_FILTER;
+       }
+
        /* Initialize our empty receive and send queues. */
        skb_queue_head_init(&vi->recv);
        skb_queue_head_init(&vi->send);
@@ -727,7 +939,7 @@ static int virtnet_probe(struct virtio_device *vdev)
        err = register_netdev(dev);
        if (err) {
                pr_debug("virtio_net: registering device failed\n");
-               goto free_send;
+               goto free_ctrl;
        }
 
        /* Last of all, set up some receive buffers. */
@@ -739,11 +951,17 @@ static int virtnet_probe(struct virtio_device *vdev)
                goto unregister;
        }
 
+       vi->status = VIRTIO_NET_S_LINK_UP;
+       virtnet_update_status(vi);
+
        pr_debug("virtnet: registered device %s\n", dev->name);
        return 0;
 
 unregister:
        unregister_netdev(dev);
+free_ctrl:
+       if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ))
+               vdev->config->del_vq(vi->cvq);
 free_send:
        vdev->config->del_vq(vi->svq);
 free_recv:
@@ -775,6 +993,8 @@ static void virtnet_remove(struct virtio_device *vdev)
 
        vdev->config->del_vq(vi->svq);
        vdev->config->del_vq(vi->rvq);
+       if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ))
+               vdev->config->del_vq(vi->cvq);
        unregister_netdev(vi->dev);
 
        while (vi->pages)
@@ -794,7 +1014,8 @@ static unsigned int features[] = {
        VIRTIO_NET_F_HOST_TSO4, VIRTIO_NET_F_HOST_UFO, VIRTIO_NET_F_HOST_TSO6,
        VIRTIO_NET_F_HOST_ECN, VIRTIO_NET_F_GUEST_TSO4, VIRTIO_NET_F_GUEST_TSO6,
        VIRTIO_NET_F_GUEST_ECN, /* We don't yet handle UFO input. */
-       VIRTIO_NET_F_MRG_RXBUF,
+       VIRTIO_NET_F_MRG_RXBUF, VIRTIO_NET_F_STATUS, VIRTIO_NET_F_CTRL_VQ,
+       VIRTIO_NET_F_CTRL_RX, VIRTIO_NET_F_CTRL_VLAN,
        VIRTIO_F_NOTIFY_ON_EMPTY,
 };
 
@@ -806,6 +1027,7 @@ static struct virtio_driver virtio_net = {
        .id_table =     id_table,
        .probe =        virtnet_probe,
        .remove =       __devexit_p(virtnet_remove),
+       .config_changed = virtnet_config_changed,
 };
 
 static int __init init(void)
index b46897996f7e3edf98645c3ec433f006d0f95059..9693b0fd323dbb82c252ba53720ab971445af126 100644 (file)
@@ -296,7 +296,13 @@ static void c101_destroy_card(card_t *card)
        kfree(card);
 }
 
-
+static const struct net_device_ops c101_ops = {
+       .ndo_open       = c101_open,
+       .ndo_stop       = c101_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = c101_ioctl,
+};
 
 static int __init c101_run(unsigned long irq, unsigned long winbase)
 {
@@ -367,9 +373,7 @@ static int __init c101_run(unsigned long irq, unsigned long winbase)
        dev->mem_start = winbase;
        dev->mem_end = winbase + C101_MAPPED_RAM_SIZE - 1;
        dev->tx_queue_len = 50;
-       dev->do_ioctl = c101_ioctl;
-       dev->open = c101_open;
-       dev->stop = c101_close;
+       dev->netdev_ops = &c101_ops;
        hdlc->attach = sca_attach;
        hdlc->xmit = sca_xmit;
        card->settings.clock_type = CLOCK_EXT;
index d80b72e22dea6be26d69b4e2d0fd016541a546f8..0d7ba117ef608debcafeb4185809a882487d6134 100644 (file)
@@ -427,6 +427,15 @@ static void __exit cosa_exit(void)
 }
 module_exit(cosa_exit);
 
+static const struct net_device_ops cosa_ops = {
+       .ndo_open       = cosa_net_open,
+       .ndo_stop       = cosa_net_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = cosa_net_ioctl,
+       .ndo_tx_timeout = cosa_net_timeout,
+};
+
 static int cosa_probe(int base, int irq, int dma)
 {
        struct cosa_data *cosa = cosa_cards+nr_cards;
@@ -575,10 +584,7 @@ static int cosa_probe(int base, int irq, int dma)
                }
                dev_to_hdlc(chan->netdev)->attach = cosa_net_attach;
                dev_to_hdlc(chan->netdev)->xmit = cosa_net_tx;
-               chan->netdev->open = cosa_net_open;
-               chan->netdev->stop = cosa_net_close;
-               chan->netdev->do_ioctl = cosa_net_ioctl;
-               chan->netdev->tx_timeout = cosa_net_timeout;
+               chan->netdev->netdev_ops = &cosa_ops;
                chan->netdev->watchdog_timeo = TX_TIMEOUT;
                chan->netdev->base_addr = chan->cosa->datareg;
                chan->netdev->irq = chan->cosa->irq;
index 888025db2f022616d6c0bd4343835be5e5c6a989..8face5db8f32a132be74c053ccafe6fec25d4ae1 100644 (file)
@@ -883,6 +883,15 @@ static inline int dscc4_set_quartz(struct dscc4_dev_priv *dpriv, int hz)
        return ret;
 }
 
+static const struct net_device_ops dscc4_ops = {
+       .ndo_open       = dscc4_open,
+       .ndo_stop       = dscc4_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = dscc4_ioctl,
+       .ndo_tx_timeout = dscc4_tx_timeout,
+};
+
 static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
 {
        struct dscc4_pci_priv *ppriv;
@@ -916,13 +925,8 @@ static int dscc4_found1(struct pci_dev *pdev, void __iomem *ioaddr)
                hdlc_device *hdlc = dev_to_hdlc(d);
 
                d->base_addr = (unsigned long)ioaddr;
-               d->init = NULL;
                d->irq = pdev->irq;
-               d->open = dscc4_open;
-               d->stop = dscc4_close;
-               d->set_multicast_list = NULL;
-               d->do_ioctl = dscc4_ioctl;
-               d->tx_timeout = dscc4_tx_timeout;
+               d->netdev_ops = &dscc4_ops;
                d->watchdog_timeo = TX_TIMEOUT;
                SET_NETDEV_DEV(d, &pdev->dev);
 
@@ -1048,7 +1052,7 @@ static int dscc4_open(struct net_device *dev)
        struct dscc4_pci_priv *ppriv;
        int ret = -EAGAIN;
 
-       if ((dscc4_loopback_check(dpriv) < 0) || !dev->hard_start_xmit)
+       if ((dscc4_loopback_check(dpriv) < 0))
                goto err;
 
        if ((ret = hdlc_open(dev)))
index 48a2c9d28950fc875a72334623343300bda21181..00945f7c1e9b07f7c3c0db54bf0d6db698825ece 100644 (file)
@@ -2424,6 +2424,15 @@ fst_init_card(struct fst_card_info *card)
               type_strings[card->type], card->irq, card->nports);
 }
 
+static const struct net_device_ops fst_ops = {
+       .ndo_open       = fst_open,
+       .ndo_stop       = fst_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = fst_ioctl,
+       .ndo_tx_timeout = fst_tx_timeout,
+};
+
 /*
  *      Initialise card when detected.
  *      Returns 0 to indicate success, or errno otherwise.
@@ -2565,12 +2574,9 @@ fst_add_one(struct pci_dev *pdev, const struct pci_device_id *ent)
                 dev->base_addr   = card->pci_conf;
                 dev->irq         = card->irq;
 
-                dev->tx_queue_len          = FST_TX_QUEUE_LEN;
-                dev->open                  = fst_open;
-                dev->stop                  = fst_close;
-                dev->do_ioctl              = fst_ioctl;
-                dev->watchdog_timeo        = FST_TX_TIMEOUT;
-                dev->tx_timeout            = fst_tx_timeout;
+               dev->netdev_ops = &fst_ops;
+               dev->tx_queue_len = FST_TX_QUEUE_LEN;
+               dev->watchdog_timeo = FST_TX_TIMEOUT;
                 hdlc->attach = fst_attach;
                 hdlc->xmit   = fst_start_xmit;
        }
index 08b3536944fe034544c74dc2470d7745393b89aa..497b003d72392a1ba87968ba3ea8fc47b077f610 100644 (file)
@@ -341,7 +341,7 @@ static int sca_poll(struct napi_struct *napi, int budget)
                received = sca_rx_done(port, budget);
 
        if (received < budget) {
-               netif_rx_complete(napi);
+               napi_complete(napi);
                enable_intr(port);
        }
 
@@ -359,7 +359,7 @@ static irqreturn_t sca_intr(int irq, void *dev_id)
                if (port && (isr0 & (i ? 0x08002200 : 0x00080022))) {
                        handled = 1;
                        disable_intr(port);
-                       netif_rx_schedule(&port->napi);
+                       napi_schedule(&port->napi);
                }
        }
 
index 1f2a140c9f7c6f113348966ef79dd69679963d91..5ce4372055582bcb652a3aaa14562470bbf2c6c1 100644 (file)
@@ -44,7 +44,7 @@ static const char* version = "HDLC support module revision 1.22";
 
 static struct hdlc_proto *first_proto;
 
-static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
+int hdlc_change_mtu(struct net_device *dev, int new_mtu)
 {
        if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
                return -EINVAL;
@@ -52,15 +52,6 @@ static int hdlc_change_mtu(struct net_device *dev, int new_mtu)
        return 0;
 }
 
-
-
-static struct net_device_stats *hdlc_get_stats(struct net_device *dev)
-{
-       return &dev->stats;
-}
-
-
-
 static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
                    struct packet_type *p, struct net_device *orig_dev)
 {
@@ -75,7 +66,15 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
        return hdlc->proto->netif_rx(skb);
 }
 
+int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+       hdlc_device *hdlc = dev_to_hdlc(dev);
+
+       if (hdlc->proto->xmit)
+               return hdlc->proto->xmit(skb, dev);
 
+       return hdlc->xmit(skb, dev); /* call hardware driver directly */
+}
 
 static inline void hdlc_proto_start(struct net_device *dev)
 {
@@ -102,11 +101,11 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
        hdlc_device *hdlc;
        unsigned long flags;
        int on;
+
        if (dev_net(dev) != &init_net)
                return NOTIFY_DONE;
 
-       if (dev->get_stats != hdlc_get_stats)
+       if (!(dev->priv_flags & IFF_WAN_HDLC))
                return NOTIFY_DONE; /* not an HDLC device */
 
        if (event != NETDEV_CHANGE)
@@ -233,15 +232,13 @@ static void hdlc_setup_dev(struct net_device *dev)
        /* Re-init all variables changed by HDLC protocol drivers,
         * including ether_setup() called from hdlc_raw_eth.c.
         */
-       dev->get_stats           = hdlc_get_stats;
        dev->flags               = IFF_POINTOPOINT | IFF_NOARP;
+       dev->priv_flags          = IFF_WAN_HDLC;
        dev->mtu                 = HDLC_MAX_MTU;
        dev->type                = ARPHRD_RAWHDLC;
        dev->hard_header_len     = 16;
        dev->addr_len            = 0;
        dev->header_ops          = &hdlc_null_ops;
-
-       dev->change_mtu          = hdlc_change_mtu;
 }
 
 static void hdlc_setup(struct net_device *dev)
@@ -339,6 +336,8 @@ MODULE_AUTHOR("Krzysztof Halasa <khc@pm.waw.pl>");
 MODULE_DESCRIPTION("HDLC support module");
 MODULE_LICENSE("GPL v2");
 
+EXPORT_SYMBOL(hdlc_change_mtu);
+EXPORT_SYMBOL(hdlc_start_xmit);
 EXPORT_SYMBOL(hdlc_open);
 EXPORT_SYMBOL(hdlc_close);
 EXPORT_SYMBOL(hdlc_ioctl);
@@ -350,7 +349,7 @@ EXPORT_SYMBOL(attach_hdlc_protocol);
 EXPORT_SYMBOL(detach_hdlc_protocol);
 
 static struct packet_type hdlc_packet_type = {
-       .type = __constant_htons(ETH_P_HDLC),
+       .type = cpu_to_be16(ETH_P_HDLC),
        .func = hdlc_rcv,
 };
 
index 44e64b15dbd10b64f626d7a31d98c08b86f25eff..cf5fd17ad7075b7f1753ff1c4d84f028ea03338b 100644 (file)
@@ -117,7 +117,7 @@ static void cisco_keepalive_send(struct net_device *dev, u32 type,
        data->type = htonl(type);
        data->par1 = par1;
        data->par2 = par2;
-       data->rel = __constant_htons(0xFFFF);
+       data->rel = cpu_to_be16(0xFFFF);
        /* we will need do_div here if 1000 % HZ != 0 */
        data->time = htonl((jiffies - INITIAL_JIFFIES) * (1000 / HZ));
 
@@ -136,20 +136,20 @@ static __be16 cisco_type_trans(struct sk_buff *skb, struct net_device *dev)
        struct hdlc_header *data = (struct hdlc_header*)skb->data;
 
        if (skb->len < sizeof(struct hdlc_header))
-               return __constant_htons(ETH_P_HDLC);
+               return cpu_to_be16(ETH_P_HDLC);
 
        if (data->address != CISCO_MULTICAST &&
            data->address != CISCO_UNICAST)
-               return __constant_htons(ETH_P_HDLC);
+               return cpu_to_be16(ETH_P_HDLC);
 
        switch(data->protocol) {
-       case __constant_htons(ETH_P_IP):
-       case __constant_htons(ETH_P_IPX):
-       case __constant_htons(ETH_P_IPV6):
+       case cpu_to_be16(ETH_P_IP):
+       case cpu_to_be16(ETH_P_IPX):
+       case cpu_to_be16(ETH_P_IPV6):
                skb_pull(skb, sizeof(struct hdlc_header));
                return data->protocol;
        default:
-               return __constant_htons(ETH_P_HDLC);
+               return cpu_to_be16(ETH_P_HDLC);
        }
 }
 
@@ -194,7 +194,7 @@ static int cisco_rx(struct sk_buff *skb)
                case CISCO_ADDR_REQ: /* Stolen from syncppp.c :-) */
                        in_dev = dev->ip_ptr;
                        addr = 0;
-                       mask = __constant_htonl(~0); /* is the mask correct? */
+                       mask = ~cpu_to_be32(0); /* is the mask correct? */
 
                        if (in_dev != NULL) {
                                struct in_ifaddr **ifap = &in_dev->ifa_list;
@@ -382,7 +382,6 @@ static int cisco_ioctl(struct net_device *dev, struct ifreq *ifr)
 
                memcpy(&state(hdlc)->settings, &new_settings, size);
                spin_lock_init(&state(hdlc)->lock);
-               dev->hard_start_xmit = hdlc->xmit;
                dev->header_ops = &cisco_header_ops;
                dev->type = ARPHRD_CISCO;
                netif_dormant_on(dev);
index f1ddd7c3459cdfeeccc1884de43e80e0fb189a9c..800530101093a10901ee16956bf75040a6ec971a 100644 (file)
@@ -278,31 +278,31 @@ static int fr_hard_header(struct sk_buff **skb_p, u16 dlci)
        struct sk_buff *skb = *skb_p;
 
        switch (skb->protocol) {
-       case __constant_htons(NLPID_CCITT_ANSI_LMI):
+       case cpu_to_be16(NLPID_CCITT_ANSI_LMI):
                head_len = 4;
                skb_push(skb, head_len);
                skb->data[3] = NLPID_CCITT_ANSI_LMI;
                break;
 
-       case __constant_htons(NLPID_CISCO_LMI):
+       case cpu_to_be16(NLPID_CISCO_LMI):
                head_len = 4;
                skb_push(skb, head_len);
                skb->data[3] = NLPID_CISCO_LMI;
                break;
 
-       case __constant_htons(ETH_P_IP):
+       case cpu_to_be16(ETH_P_IP):
                head_len = 4;
                skb_push(skb, head_len);
                skb->data[3] = NLPID_IP;
                break;
 
-       case __constant_htons(ETH_P_IPV6):
+       case cpu_to_be16(ETH_P_IPV6):
                head_len = 4;
                skb_push(skb, head_len);
                skb->data[3] = NLPID_IPV6;
                break;
 
-       case __constant_htons(ETH_P_802_3):
+       case cpu_to_be16(ETH_P_802_3):
                head_len = 10;
                if (skb_headroom(skb) < head_len) {
                        struct sk_buff *skb2 = skb_realloc_headroom(skb,
@@ -426,7 +426,7 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
                                skb_put(skb, pad);
                                memset(skb->data + len, 0, pad);
                        }
-                       skb->protocol = __constant_htons(ETH_P_802_3);
+                       skb->protocol = cpu_to_be16(ETH_P_802_3);
                }
                if (!fr_hard_header(&skb, pvc->dlci)) {
                        dev->stats.tx_bytes += skb->len;
@@ -444,18 +444,6 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev)
        return 0;
 }
 
-
-
-static int pvc_change_mtu(struct net_device *dev, int new_mtu)
-{
-       if ((new_mtu < 68) || (new_mtu > HDLC_MAX_MTU))
-               return -EINVAL;
-       dev->mtu = new_mtu;
-       return 0;
-}
-
-
-
 static inline void fr_log_dlci_active(pvc_device *pvc)
 {
        printk(KERN_INFO "%s: DLCI %d [%s%s%s]%s %s\n",
@@ -508,10 +496,10 @@ static void fr_lmi_send(struct net_device *dev, int fullrep)
        memset(skb->data, 0, len);
        skb_reserve(skb, 4);
        if (lmi == LMI_CISCO) {
-               skb->protocol = __constant_htons(NLPID_CISCO_LMI);
+               skb->protocol = cpu_to_be16(NLPID_CISCO_LMI);
                fr_hard_header(&skb, LMI_CISCO_DLCI);
        } else {
-               skb->protocol = __constant_htons(NLPID_CCITT_ANSI_LMI);
+               skb->protocol = cpu_to_be16(NLPID_CCITT_ANSI_LMI);
                fr_hard_header(&skb, LMI_CCITT_ANSI_DLCI);
        }
        data = skb_tail_pointer(skb);
@@ -1068,6 +1056,14 @@ static void pvc_setup(struct net_device *dev)
        dev->addr_len = 2;
 }
 
+static const struct net_device_ops pvc_ops = {
+       .ndo_open       = pvc_open,
+       .ndo_stop       = pvc_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = pvc_xmit,
+       .ndo_do_ioctl   = pvc_ioctl,
+};
+
 static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
 {
        hdlc_device *hdlc = dev_to_hdlc(frad);
@@ -1104,11 +1100,7 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type)
                *(__be16*)dev->dev_addr = htons(dlci);
                dlci_to_q922(dev->broadcast, dlci);
        }
-       dev->hard_start_xmit = pvc_xmit;
-       dev->open = pvc_open;
-       dev->stop = pvc_close;
-       dev->do_ioctl = pvc_ioctl;
-       dev->change_mtu = pvc_change_mtu;
+       dev->netdev_ops = &pvc_ops;
        dev->mtu = HDLC_MAX_MTU;
        dev->tx_queue_len = 0;
        dev->ml_priv = pvc;
@@ -1260,8 +1252,6 @@ static int fr_ioctl(struct net_device *dev, struct ifreq *ifr)
                        state(hdlc)->dce_pvc_count = 0;
                }
                memcpy(&state(hdlc)->settings, &new_settings, size);
-
-               dev->hard_start_xmit = hdlc->xmit;
                dev->type = ARPHRD_FRAD;
                return 0;
 
index 57fe714c1c7f63376e1694fc84d2f73788e50c2a..72a7cdab424531850f51462d6b16bf40c3faea50 100644 (file)
@@ -150,11 +150,11 @@ static __be16 ppp_type_trans(struct sk_buff *skb, struct net_device *dev)
                return htons(ETH_P_HDLC);
 
        switch (data->protocol) {
-       case __constant_htons(PID_IP):
+       case cpu_to_be16(PID_IP):
                skb_pull(skb, sizeof(struct hdlc_header));
                return htons(ETH_P_IP);
 
-       case __constant_htons(PID_IPV6):
+       case cpu_to_be16(PID_IPV6):
                skb_pull(skb, sizeof(struct hdlc_header));
                return htons(ETH_P_IPV6);
 
@@ -558,7 +558,6 @@ out:
        return NET_RX_DROP;
 }
 
-
 static void ppp_timer(unsigned long arg)
 {
        struct proto *proto = (struct proto *)arg;
@@ -679,7 +678,6 @@ static int ppp_ioctl(struct net_device *dev, struct ifreq *ifr)
                ppp->keepalive_interval = 10;
                ppp->keepalive_timeout = 60;
 
-               dev->hard_start_xmit = hdlc->xmit;
                dev->hard_header_len = sizeof(struct hdlc_header);
                dev->header_ops = &ppp_header_ops;
                dev->type = ARPHRD_PPP;
index 8612311748f415fe849aea5ced149888cb40e539..19f51fdd55227debdbcae8b10ab100feb93ee3d6 100644 (file)
@@ -27,11 +27,9 @@ static int raw_ioctl(struct net_device *dev, struct ifreq *ifr);
 
 static __be16 raw_type_trans(struct sk_buff *skb, struct net_device *dev)
 {
-       return __constant_htons(ETH_P_IP);
+       return cpu_to_be16(ETH_P_IP);
 }
 
-
-
 static struct hdlc_proto proto = {
        .type_trans     = raw_type_trans,
        .ioctl          = raw_ioctl,
@@ -86,7 +84,6 @@ static int raw_ioctl(struct net_device *dev, struct ifreq *ifr)
                if (result)
                        return result;
                memcpy(hdlc->state, &new_settings, size);
-               dev->hard_start_xmit = hdlc->xmit;
                dev->type = ARPHRD_RAWHDLC;
                netif_dormant_off(dev);
                return 0;
index a13fc320752047cbdf0dfdb5f4c4ee685688aa73..49e68f5ca5f2c95630635ac0fdf7a74512ce90aa 100644 (file)
@@ -45,6 +45,7 @@ static int eth_tx(struct sk_buff *skb, struct net_device *dev)
 
 static struct hdlc_proto proto = {
        .type_trans     = eth_type_trans,
+       .xmit           = eth_tx,
        .ioctl          = raw_eth_ioctl,
        .module         = THIS_MODULE,
 };
@@ -56,9 +57,7 @@ static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr)
        const size_t size = sizeof(raw_hdlc_proto);
        raw_hdlc_proto new_settings;
        hdlc_device *hdlc = dev_to_hdlc(dev);
-       int result;
-       int (*old_ch_mtu)(struct net_device *, int);
-       int old_qlen;
+       int result, old_qlen;
 
        switch (ifr->ifr_settings.type) {
        case IF_GET_PROTO:
@@ -99,11 +98,8 @@ static int raw_eth_ioctl(struct net_device *dev, struct ifreq *ifr)
                if (result)
                        return result;
                memcpy(hdlc->state, &new_settings, size);
-               dev->hard_start_xmit = eth_tx;
-               old_ch_mtu = dev->change_mtu;
                old_qlen = dev->tx_queue_len;
                ether_setup(dev);
-               dev->change_mtu = old_ch_mtu;
                dev->tx_queue_len = old_qlen;
                random_ether_addr(dev->dev_addr);
                netif_dormant_off(dev);
index cbcbf6f0414c9254aea1d14f95e7220b50ccab13..b1dc29ed15835675b1231505fc25696a62f29f73 100644 (file)
@@ -184,6 +184,7 @@ static struct hdlc_proto proto = {
        .close          = x25_close,
        .ioctl          = x25_ioctl,
        .netif_rx       = x25_rx,
+       .xmit           = x25_xmit,
        .module         = THIS_MODULE,
 };
 
@@ -213,7 +214,6 @@ static int x25_ioctl(struct net_device *dev, struct ifreq *ifr)
 
                if ((result = attach_hdlc_protocol(dev, &proto, 0)))
                        return result;
-               dev->hard_start_xmit = x25_xmit;
                dev->type = ARPHRD_X25;
                netif_dormant_off(dev);
                return 0;
index af54f0cf1b35fcc2d6f0130411df5432d5b55cc2..567d4f5062d6517bb397895093ebc560910ff023 100644 (file)
@@ -173,6 +173,14 @@ static int hostess_attach(struct net_device *dev, unsigned short encoding,
  *     Description block for a Comtrol Hostess SV11 card
  */
 
+static const struct net_device_ops hostess_ops = {
+       .ndo_open       = hostess_open,
+       .ndo_stop       = hostess_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = hostess_ioctl,
+};
+
 static struct z8530_dev *sv11_init(int iobase, int irq)
 {
        struct z8530_dev *sv;
@@ -267,9 +275,7 @@ static struct z8530_dev *sv11_init(int iobase, int irq)
 
        dev_to_hdlc(netdev)->attach = hostess_attach;
        dev_to_hdlc(netdev)->xmit = hostess_queue_xmit;
-       netdev->open = hostess_open;
-       netdev->stop = hostess_close;
-       netdev->do_ioctl = hostess_ioctl;
+       netdev->netdev_ops = &hostess_ops;
        netdev->base_addr = iobase;
        netdev->irq = irq;
 
index 0dbd85b0162da72a9a577cd91358b90b5d52d07b..3bf7d3f447db83002e3e7929e864eeb35303a272 100644 (file)
@@ -622,7 +622,7 @@ static void hss_hdlc_rx_irq(void *pdev)
        printk(KERN_DEBUG "%s: hss_hdlc_rx_irq\n", dev->name);
 #endif
        qmgr_disable_irq(queue_ids[port->id].rx);
-       netif_rx_schedule(&port->napi);
+       napi_schedule(&port->napi);
 }
 
 static int hss_hdlc_poll(struct napi_struct *napi, int budget)
@@ -649,15 +649,15 @@ static int hss_hdlc_poll(struct napi_struct *napi, int budget)
                if ((n = queue_get_desc(rxq, port, 0)) < 0) {
 #if DEBUG_RX
                        printk(KERN_DEBUG "%s: hss_hdlc_poll"
-                              " netif_rx_complete\n", dev->name);
+                              " napi_complete\n", dev->name);
 #endif
-                       netif_rx_complete(napi);
+                       napi_complete(napi);
                        qmgr_enable_irq(rxq);
                        if (!qmgr_stat_empty(rxq) &&
-                           netif_rx_reschedule(napi)) {
+                           napi_reschedule(napi)) {
 #if DEBUG_RX
                                printk(KERN_DEBUG "%s: hss_hdlc_poll"
-                                      " netif_rx_reschedule succeeded\n",
+                                      " napi_reschedule succeeded\n",
                                       dev->name);
 #endif
                                qmgr_disable_irq(rxq);
@@ -1069,7 +1069,7 @@ static int hss_hdlc_open(struct net_device *dev)
        hss_start_hdlc(port);
 
        /* we may already have RX data, enables IRQ */
-       netif_rx_schedule(&port->napi);
+       napi_schedule(&port->napi);
        return 0;
 
 err_unlock:
@@ -1230,6 +1230,14 @@ static int hss_hdlc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
  * initialization
  ****************************************************************************/
 
+static const struct net_device_ops hss_hdlc_ops = {
+       .ndo_open       = hss_hdlc_open,
+       .ndo_stop       = hss_hdlc_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = hss_hdlc_ioctl,
+};
+
 static int __devinit hss_init_one(struct platform_device *pdev)
 {
        struct port *port;
@@ -1254,9 +1262,7 @@ static int __devinit hss_init_one(struct platform_device *pdev)
        hdlc = dev_to_hdlc(dev);
        hdlc->attach = hss_hdlc_attach;
        hdlc->xmit = hss_hdlc_xmit;
-       dev->open = hss_hdlc_open;
-       dev->stop = hss_hdlc_close;
-       dev->do_ioctl = hss_hdlc_ioctl;
+       dev->netdev_ops = &hss_hdlc_ops;
        dev->tx_queue_len = 100;
        port->clock_type = CLOCK_EXT;
        port->clock_rate = 2048000;
index 5b61b3eef45f5b19da53e8e249b02895eaa6657a..06beba47ffdf5f7267e2bb88843a0ed760b58922 100644 (file)
@@ -422,7 +422,7 @@ static int lapbeth_device_event(struct notifier_block *this,
 /* ------------------------------------------------------------------------ */
 
 static struct packet_type lapbeth_packet_type = {
-       .type = __constant_htons(ETH_P_DEC),
+       .type = cpu_to_be16(ETH_P_DEC),
        .func = lapbeth_rcv,
 };
 
@@ -430,7 +430,8 @@ static struct notifier_block lapbeth_dev_notifier = {
        .notifier_call = lapbeth_device_event,
 };
 
-static char banner[] __initdata = KERN_INFO "LAPB Ethernet driver version 0.02\n";
+static const char banner[] __initdata =
+       KERN_INFO "LAPB Ethernet driver version 0.02\n";
 
 static int __init lapbeth_init_driver(void)
 {
index feac3b99f8fe7f42192062fca6b63189b73ec62b..45b1822c962dabf212b644092b761ac674264079 100644 (file)
@@ -806,6 +806,16 @@ static int lmc_attach(struct net_device *dev, unsigned short encoding,
        return -EINVAL;
 }
 
+static const struct net_device_ops lmc_ops = {
+       .ndo_open       = lmc_open,
+       .ndo_stop       = lmc_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = lmc_ioctl,
+       .ndo_tx_timeout = lmc_driver_timeout,
+       .ndo_get_stats  = lmc_get_stats,
+};
+
 static int __devinit lmc_init_one(struct pci_dev *pdev,
                                  const struct pci_device_id *ent)
 {
@@ -849,11 +859,7 @@ static int __devinit lmc_init_one(struct pci_dev *pdev,
        dev->type = ARPHRD_HDLC;
        dev_to_hdlc(dev)->xmit = lmc_start_xmit;
        dev_to_hdlc(dev)->attach = lmc_attach;
-       dev->open = lmc_open;
-       dev->stop = lmc_close;
-       dev->get_stats = lmc_get_stats;
-       dev->do_ioctl = lmc_ioctl;
-       dev->tx_timeout = lmc_driver_timeout;
+       dev->netdev_ops = &lmc_ops;
        dev->watchdog_timeo = HZ; /* 1 second */
        dev->tx_queue_len = 100;
        sc->lmc_device = dev;
@@ -1059,9 +1065,6 @@ static int lmc_open(struct net_device *dev)
     if ((err = lmc_proto_open(sc)) != 0)
            return err;
 
-    dev->do_ioctl = lmc_ioctl;
-
-
     netif_start_queue(dev);
     sc->extra_stats.tx_tbusy0++;
 
index 94b4c208b013e1a0a936ed25afc46785f90ab5a0..044a48175c42e4d4076d950cc23b0a2ffc162765 100644 (file)
 void lmc_proto_attach(lmc_softc_t *sc) /*FOLD00*/
 {
     lmc_trace(sc->lmc_device, "lmc_proto_attach in");
-    switch(sc->if_type){
-    case LMC_PPP:
-        {
-            struct net_device *dev = sc->lmc_device;
-            dev->do_ioctl = lmc_ioctl;
-        }
-        break;
-    case LMC_NET:
-        {
+    if (sc->if_type == LMC_NET) {
             struct net_device *dev = sc->lmc_device;
             /*
             * They set a few basics because they don't use HDLC
              */
             dev->flags |= IFF_POINTOPOINT;
-
             dev->hard_header_len = 0;
             dev->addr_len = 0;
         }
-    case LMC_RAW: /* Setup the task queue, maybe we should notify someone? */
-        {
-        }
-    default:
-        break;
-    }
     lmc_trace(sc->lmc_device, "lmc_proto_attach out");
 }
 
index 697715ae80f46917a463b5be6936c1f200ce8473..83da596e2052a84df3920cb2d681579e0caa9205 100644 (file)
@@ -324,7 +324,13 @@ static void n2_destroy_card(card_t *card)
        kfree(card);
 }
 
-
+static const struct net_device_ops n2_ops = {
+       .ndo_open       = n2_open,
+       .ndo_stop       = n2_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = n2_ioctl,
+};
 
 static int __init n2_run(unsigned long io, unsigned long irq,
                         unsigned long winbase, long valid0, long valid1)
@@ -460,9 +466,7 @@ static int __init n2_run(unsigned long io, unsigned long irq,
                dev->mem_start = winbase;
                dev->mem_end = winbase + USE_WINDOWSIZE - 1;
                dev->tx_queue_len = 50;
-               dev->do_ioctl = n2_ioctl;
-               dev->open = n2_open;
-               dev->stop = n2_close;
+               dev->netdev_ops = &n2_ops;
                hdlc->attach = sca_attach;
                hdlc->xmit = sca_xmit;
                port->settings.clock_type = CLOCK_EXT;
index f247e5d9002a3b8837f64e390583c3efcb1470c5..60ece54bdd940452f301215743b4658c7bbe2e59 100644 (file)
@@ -287,7 +287,13 @@ static void pc300_pci_remove_one(struct pci_dev *pdev)
        kfree(card);
 }
 
-
+static const struct net_device_ops pc300_ops = {
+       .ndo_open       = pc300_open,
+       .ndo_stop       = pc300_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = pc300_ioctl,
+};
 
 static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
                                        const struct pci_device_id *ent)
@@ -448,9 +454,7 @@ static int __devinit pc300_pci_init_one(struct pci_dev *pdev,
                dev->mem_start = ramphys;
                dev->mem_end = ramphys + ramsize - 1;
                dev->tx_queue_len = 50;
-               dev->do_ioctl = pc300_ioctl;
-               dev->open = pc300_open;
-               dev->stop = pc300_close;
+               dev->netdev_ops = &pc300_ops;
                hdlc->attach = sca_attach;
                hdlc->xmit = sca_xmit;
                port->settings.clock_type = CLOCK_EXT;
index 1104d3a692f77b52b72bc4b3b6d7cb3056b5646e..e035d8c57e119b5d0a875d503b25821c1b64b548 100644 (file)
@@ -265,7 +265,13 @@ static void pci200_pci_remove_one(struct pci_dev *pdev)
        kfree(card);
 }
 
-
+static const struct net_device_ops pci200_ops = {
+       .ndo_open       = pci200_open,
+       .ndo_stop       = pci200_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = pci200_ioctl,
+};
 
 static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
                                         const struct pci_device_id *ent)
@@ -395,9 +401,7 @@ static int __devinit pci200_pci_init_one(struct pci_dev *pdev,
                dev->mem_start = ramphys;
                dev->mem_end = ramphys + ramsize - 1;
                dev->tx_queue_len = 50;
-               dev->do_ioctl = pci200_ioctl;
-               dev->open = pci200_open;
-               dev->stop = pci200_close;
+               dev->netdev_ops = &pci200_ops;
                hdlc->attach = sca_attach;
                hdlc->xmit = sca_xmit;
                port->settings.clock_type = CLOCK_EXT;
index 0aa28e1d436614bc98fa1954fda862d8eeec8574..78f7bc92cbe88732dfcb8eed0cb225e4bcf3c00d 100644 (file)
@@ -1520,17 +1520,18 @@ int __init init_module( void )
 }
 
 void
-cleanup_module( void )
+cleanup_module(void)
 {
-       struct net_device  *dev;
-       int  num;
+       int i;
 
-       for( num = 0;  num < SBNI_MAX_NUM_CARDS;  ++num )
-               if( (dev = sbni_cards[ num ]) != NULL ) {
-                       unregister_netdev( dev );
-                       release_region( dev->base_addr, SBNI_IO_EXTENT );
-                       free_netdev( dev );
+       for (i = 0;  i < SBNI_MAX_NUM_CARDS;  ++i) {
+               struct net_device *dev = sbni_cards[i];
+               if (dev != NULL) {
+                       unregister_netdev(dev);
+                       release_region(dev->base_addr, SBNI_IO_EXTENT);
+                       free_netdev(dev);
                }
+       }
 }
 
 #else  /* MODULE */
index 0941a26f6e3f9b94d794bc2f43ecce49a35290cb..23b26902745310b5d93fca475467e25a6487fb23 100644 (file)
@@ -169,6 +169,14 @@ static int sealevel_attach(struct net_device *dev, unsigned short encoding,
        return -EINVAL;
 }
 
+static const struct net_device_ops sealevel_ops = {
+       .ndo_open       = sealevel_open,
+       .ndo_stop       = sealevel_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = sealevel_ioctl,
+};
+
 static int slvl_setup(struct slvl_device *sv, int iobase, int irq)
 {
        struct net_device *dev = alloc_hdlcdev(sv);
@@ -177,9 +185,7 @@ static int slvl_setup(struct slvl_device *sv, int iobase, int irq)
 
        dev_to_hdlc(dev)->attach = sealevel_attach;
        dev_to_hdlc(dev)->xmit = sealevel_queue_xmit;
-       dev->open = sealevel_open;
-       dev->stop = sealevel_close;
-       dev->do_ioctl = sealevel_ioctl;
+       dev->netdev_ops = &sealevel_ops;
        dev->base_addr = iobase;
        dev->irq = irq;
 
index 4bffb67ebcae32b9fbd2676bcb6e151fa16f9edf..887acb0dc8075f183925c19225d5d4cf725695dd 100644 (file)
@@ -547,6 +547,15 @@ static void wanxl_pci_remove_one(struct pci_dev *pdev)
 
 #include "wanxlfw.inc"
 
+static const struct net_device_ops wanxl_ops = {
+       .ndo_open       = wanxl_open,
+       .ndo_stop       = wanxl_close,
+       .ndo_change_mtu = hdlc_change_mtu,
+       .ndo_start_xmit = hdlc_start_xmit,
+       .ndo_do_ioctl   = wanxl_ioctl,
+       .ndo_get_stats  = wanxl_get_stats,
+};
+
 static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
                                        const struct pci_device_id *ent)
 {
@@ -777,12 +786,9 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
                hdlc = dev_to_hdlc(dev);
                spin_lock_init(&port->lock);
                dev->tx_queue_len = 50;
-               dev->do_ioctl = wanxl_ioctl;
-               dev->open = wanxl_open;
-               dev->stop = wanxl_close;
+               dev->netdev_ops = &wanxl_ops;
                hdlc->attach = wanxl_attach;
                hdlc->xmit = wanxl_xmit;
-               dev->get_stats = wanxl_get_stats;
                port->card = card;
                port->node = i;
                get_status(port)->clocking = CLOCK_EXT;
index 3d00971fe5ee6a6dc488d99bf72e262cf06f8a6f..ad4e79c4c5c3e8073783e1ab9df51de493b19557 100644 (file)
@@ -1775,7 +1775,8 @@ EXPORT_SYMBOL(z8530_queue_xmit);
 /*
  *     Module support
  */
-static char banner[] __initdata = KERN_INFO "Generic Z85C30/Z85230 interface driver v0.02\n";
+static const char banner[] __initdata =
+       KERN_INFO "Generic Z85C30/Z85230 interface driver v0.02\n";
 
 static int __init z85230_init_driver(void)
 {
index 1d8271f34c3832b35feafeaabe854cad7278e22b..ecd0cfaefdcc583785484b6b4c1cedadead9bc60 100644 (file)
 
 
 static const __le32 i2400m_ACK_BARKER[4] = {
-       __constant_cpu_to_le32(I2400M_ACK_BARKER),
-       __constant_cpu_to_le32(I2400M_ACK_BARKER),
-       __constant_cpu_to_le32(I2400M_ACK_BARKER),
-       __constant_cpu_to_le32(I2400M_ACK_BARKER)
+       cpu_to_le32(I2400M_ACK_BARKER),
+       cpu_to_le32(I2400M_ACK_BARKER),
+       cpu_to_le32(I2400M_ACK_BARKER),
+       cpu_to_le32(I2400M_ACK_BARKER)
 };
 
 
@@ -771,8 +771,8 @@ static
 int i2400m_dnload_init_nonsigned(struct i2400m *i2400m)
 {
 #define POKE(a, d) {                                   \
-       .address = __constant_cpu_to_le32(a),           \
-       .data = __constant_cpu_to_le32(d)               \
+       .address = cpu_to_le32(a),              \
+       .data = cpu_to_le32(d)          \
 }
        static const struct {
                __le32 address;
index 3b9d27ea2950ca4223c1ae72e4f3c340c9148f26..f9e55397ee88483b802de5984aa06615051b7da1 100644 (file)
@@ -664,17 +664,17 @@ extern struct i2400m_msg_hdr *i2400m_tx_msg_get(struct i2400m *, size_t *);
 extern void i2400m_tx_msg_sent(struct i2400m *);
 
 static const __le32 i2400m_NBOOT_BARKER[4] = {
-       __constant_cpu_to_le32(I2400M_NBOOT_BARKER),
-       __constant_cpu_to_le32(I2400M_NBOOT_BARKER),
-       __constant_cpu_to_le32(I2400M_NBOOT_BARKER),
-       __constant_cpu_to_le32(I2400M_NBOOT_BARKER)
+       cpu_to_le32(I2400M_NBOOT_BARKER),
+       cpu_to_le32(I2400M_NBOOT_BARKER),
+       cpu_to_le32(I2400M_NBOOT_BARKER),
+       cpu_to_le32(I2400M_NBOOT_BARKER)
 };
 
 static const __le32 i2400m_SBOOT_BARKER[4] = {
-       __constant_cpu_to_le32(I2400M_SBOOT_BARKER),
-       __constant_cpu_to_le32(I2400M_SBOOT_BARKER),
-       __constant_cpu_to_le32(I2400M_SBOOT_BARKER),
-       __constant_cpu_to_le32(I2400M_SBOOT_BARKER)
+       cpu_to_le32(I2400M_SBOOT_BARKER),
+       cpu_to_le32(I2400M_SBOOT_BARKER),
+       cpu_to_le32(I2400M_SBOOT_BARKER),
+       cpu_to_le32(I2400M_SBOOT_BARKER)
 };
 
 
index 63fe708e8a31509394422a0f8cc921dd7308e5c3..be8be4d0709c0963006b0243bce14b6d1e3e75ce 100644 (file)
@@ -419,7 +419,7 @@ void i2400m_rx_fake_eth_header(struct net_device *net_dev,
 
        memcpy(eth_hdr->h_dest, net_dev->dev_addr, sizeof(eth_hdr->h_dest));
        memset(eth_hdr->h_source, 0, sizeof(eth_hdr->h_dest));
-       eth_hdr->h_proto = __constant_cpu_to_be16(ETH_P_IP);
+       eth_hdr->h_proto = cpu_to_be16(ETH_P_IP);
 }
 
 
@@ -493,6 +493,14 @@ error_skb_realloc:
                i2400m, buf, buf_len);
 }
 
+static const struct net_device_ops i2400m_netdev_ops = {
+       .ndo_open = i2400m_open,
+       .ndo_stop = i2400m_stop,
+       .ndo_start_xmit = i2400m_hard_start_xmit,
+       .ndo_tx_timeout = i2400m_tx_timeout,
+       .ndo_change_mtu = i2400m_change_mtu,
+};
+
 
 /**
  * i2400m_netdev_setup - Setup setup @net_dev's i2400m private data
@@ -513,11 +521,7 @@ void i2400m_netdev_setup(struct net_device *net_dev)
                & (~IFF_BROADCAST       /* i2400m is P2P */
                   & ~IFF_MULTICAST);
        net_dev->watchdog_timeo = I2400M_TX_TIMEOUT;
-       net_dev->open = i2400m_open;
-       net_dev->stop = i2400m_stop;
-       net_dev->hard_start_xmit = i2400m_hard_start_xmit;
-       net_dev->change_mtu = i2400m_change_mtu;
-       net_dev->tx_timeout = i2400m_tx_timeout;
+       net_dev->netdev_ops = &i2400m_netdev_ops;
        d_fnend(3, NULL, "(net_dev %p) = void\n", net_dev);
 }
 EXPORT_SYMBOL_GPL(i2400m_netdev_setup);
index 1bfa283bbd8aabef64c88364cdd749933b02cde8..123a5f8db6adddbe27966e18dd194dcd3210270d 100644 (file)
@@ -255,16 +255,16 @@ int i2400ms_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt)
                container_of(i2400m, struct i2400ms, i2400m);
        struct device *dev = i2400m_dev(i2400m);
        static const __le32 i2400m_WARM_BOOT_BARKER[4] = {
-               __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
+               cpu_to_le32(I2400M_WARM_RESET_BARKER),
+               cpu_to_le32(I2400M_WARM_RESET_BARKER),
+               cpu_to_le32(I2400M_WARM_RESET_BARKER),
+               cpu_to_le32(I2400M_WARM_RESET_BARKER),
        };
        static const __le32 i2400m_COLD_BOOT_BARKER[4] = {
-               __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
+               cpu_to_le32(I2400M_COLD_RESET_BARKER),
+               cpu_to_le32(I2400M_COLD_RESET_BARKER),
+               cpu_to_le32(I2400M_COLD_RESET_BARKER),
+               cpu_to_le32(I2400M_COLD_RESET_BARKER),
        };
 
        if (rt == I2400M_RT_WARM)
index c6d93465c7e24d8e3883061814411edc00f0ecc0..7c28610da6f32b7382c1b48dd6f2b434f9721901 100644 (file)
@@ -211,16 +211,16 @@ int i2400mu_bus_reset(struct i2400m *i2400m, enum i2400m_reset_type rt)
                container_of(i2400m, struct i2400mu, i2400m);
        struct device *dev = i2400m_dev(i2400m);
        static const __le32 i2400m_WARM_BOOT_BARKER[4] = {
-               __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_WARM_RESET_BARKER),
+               cpu_to_le32(I2400M_WARM_RESET_BARKER),
+               cpu_to_le32(I2400M_WARM_RESET_BARKER),
+               cpu_to_le32(I2400M_WARM_RESET_BARKER),
+               cpu_to_le32(I2400M_WARM_RESET_BARKER),
        };
        static const __le32 i2400m_COLD_BOOT_BARKER[4] = {
-               __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
-               __constant_cpu_to_le32(I2400M_COLD_RESET_BARKER),
+               cpu_to_le32(I2400M_COLD_RESET_BARKER),
+               cpu_to_le32(I2400M_COLD_RESET_BARKER),
+               cpu_to_le32(I2400M_COLD_RESET_BARKER),
+               cpu_to_le32(I2400M_COLD_RESET_BARKER),
        };
 
        d_fnstart(3, dev, "(i2400m %p rt %u)\n", i2400m, rt);
index e4f9f747de88c94404ddbe17294783a3e37fa1ff..fe819a785714f50f5f30299b0d677e595c51b33e 100644 (file)
@@ -151,6 +151,12 @@ config LIBERTAS_SDIO
        ---help---
          A driver for Marvell Libertas 8385 and 8686 SDIO devices.
 
+config LIBERTAS_SPI
+       tristate "Marvell Libertas 8686 SPI 802.11b/g cards"
+       depends on LIBERTAS && SPI && GENERIC_GPIO
+       ---help---
+         A driver for Marvell Libertas 8686 SPI devices.
+
 config LIBERTAS_DEBUG
        bool "Enable full debugging output in the Libertas module."
        depends on LIBERTAS
@@ -188,127 +194,6 @@ config AIRO
 
          The driver can be compiled as a module and will be named "airo".
 
-config HERMES
-       tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)"
-       depends on (PPC_PMAC || PCI || PCMCIA) && WLAN_80211
-       select WIRELESS_EXT
-       select FW_LOADER
-       select CRYPTO
-       select CRYPTO_MICHAEL_MIC
-       ---help---
-         A driver for 802.11b wireless cards based on the "Hermes" or
-         Intersil HFA384x (Prism 2) MAC controller.  This includes the vast
-         majority of the PCMCIA 802.11b cards (which are nearly all rebadges)
-         - except for the Cisco/Aironet cards.  Cards supported include the
-         Apple Airport (not a PCMCIA card), WavelanIEEE/Orinoco,
-         Cabletron/EnteraSys Roamabout, ELSA AirLancer, MELCO Buffalo, Avaya,
-         IBM High Rate Wireless, Farralon Syyline, Samsung MagicLAN, Netgear
-         MA401, LinkSys WPC-11, D-Link DWL-650, 3Com AirConnect, Intel
-         IPW2011, and Symbol Spectrum24 High Rate amongst others.
-
-         This option includes the guts of the driver, but in order to
-         actually use a card you will also need to enable support for PCMCIA
-         Hermes cards, PLX9052 based PCI adaptors or the Apple Airport below.
-
-         You will also very likely also need the Wireless Tools in order to
-         configure your card and that /etc/pcmcia/wireless.opts works :
-         <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>
-
-config HERMES_CACHE_FW_ON_INIT
-       bool "Cache Hermes firmware on driver initialisation"
-       depends on HERMES
-       default y
-       ---help---
-         Say Y to cache any firmware required by the Hermes drivers
-         on startup.  The firmware will remain cached until the
-         driver is unloaded.  The cache uses 64K of RAM.
-
-         Otherwise load the firmware from userspace as required.  In
-         this case the driver should be unloaded and restarted
-         whenever the firmware is changed.
-
-         If you are not sure, say Y.
-
-config APPLE_AIRPORT
-       tristate "Apple Airport support (built-in)"
-       depends on PPC_PMAC && HERMES
-       help
-         Say Y here to support the Airport 802.11b wireless Ethernet hardware
-         built into the Macintosh iBook and other recent PowerPC-based
-         Macintosh machines. This is essentially a Lucent Orinoco card with 
-         a non-standard interface.
-
-         This driver does not support the Airport Extreme (802.11b/g). Use
-         the BCM43xx driver for Airport Extreme cards.
-
-config PLX_HERMES
-       tristate "Hermes in PLX9052 based PCI adaptor support (Netgear MA301 etc.)"
-       depends on PCI && HERMES
-       help
-         Enable support for PCMCIA cards supported by the "Hermes" (aka
-         orinoco) driver when used in PLX9052 based PCI adaptors.  These
-         adaptors are not a full PCMCIA controller but act as a more limited
-         PCI <-> PCMCIA bridge.  Several vendors sell such adaptors so that
-         802.11b PCMCIA cards can be used in desktop machines.  The Netgear
-         MA301 is such an adaptor.
-
-config TMD_HERMES
-       tristate "Hermes in TMD7160 based PCI adaptor support"
-       depends on PCI && HERMES
-       help
-         Enable support for PCMCIA cards supported by the "Hermes" (aka
-         orinoco) driver when used in TMD7160 based PCI adaptors.  These
-         adaptors are not a full PCMCIA controller but act as a more limited
-         PCI <-> PCMCIA bridge.  Several vendors sell such adaptors so that
-         802.11b PCMCIA cards can be used in desktop machines.
-
-config NORTEL_HERMES
-       tristate "Nortel emobility PCI adaptor support"
-       depends on PCI && HERMES
-       help
-         Enable support for PCMCIA cards supported by the "Hermes" (aka
-         orinoco) driver when used in Nortel emobility PCI adaptors.  These
-         adaptors are not full PCMCIA controllers, but act as a more limited
-         PCI <-> PCMCIA bridge.
-
-config PCI_HERMES
-       tristate "Prism 2.5 PCI 802.11b adaptor support"
-       depends on PCI && HERMES
-       help
-         Enable support for PCI and mini-PCI 802.11b wireless NICs based on
-         the Prism 2.5 chipset.  These are true PCI cards, not the 802.11b
-         PCMCIA cards bundled with PCI<->PCMCIA adaptors which are also
-         common.  Some of the built-in wireless adaptors in laptops are of
-         this variety.
-
-config PCMCIA_HERMES
-       tristate "Hermes PCMCIA card support"
-       depends on PCMCIA && HERMES
-       ---help---
-         A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
-         as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
-         EnteraSys RoamAbout 802.11, ELSA Airlancer, Melco Buffalo and
-         others).  It should also be usable on various Prism II based cards
-         such as the Linksys, D-Link and Farallon Skyline.  It should also
-         work on Symbol cards such as the 3Com AirConnect and Ericsson WLAN.
-
-         You will very likely need the Wireless Tools in order to
-         configure your card and that /etc/pcmcia/wireless.opts works:
-         <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
-
-config PCMCIA_SPECTRUM
-       tristate "Symbol Spectrum24 Trilogy PCMCIA card support"
-       depends on PCMCIA && HERMES
-       ---help---
-
-         This is a driver for 802.11b cards using RAM-loadable Symbol
-         firmware, such as Symbol Wireless Networker LA4100, CompactFlash
-         cards by Socket Communications and Intel PRO/Wireless 2011B.
-
-         This driver requires firmware download on startup.  Utilities
-         for downloading Symbol firmware are available at
-         <http://sourceforge.net/projects/orinoco/>
-
 config ATMEL
       tristate "Atmel at76c50x chipset  802.11b support"
       depends on (PCI || PCMCIA) && WLAN_80211
@@ -590,5 +475,6 @@ source "drivers/net/wireless/b43/Kconfig"
 source "drivers/net/wireless/b43legacy/Kconfig"
 source "drivers/net/wireless/zd1211rw/Kconfig"
 source "drivers/net/wireless/rt2x00/Kconfig"
+source "drivers/net/wireless/orinoco/Kconfig"
 
 endmenu
index fc4322ca669fa3a33c56650a784debdc15e8dab3..c44f38895fbe6c3db7aed02202c7594130d2c922 100644 (file)
@@ -496,39 +496,41 @@ typedef struct {
  * so all rid access should use the read/writeXXXRid routines.
  */
 
-/* This is redundant for x86 archs, but it seems necessary for ARM */
-#pragma pack(1)
-
 /* This structure came from an email sent to me from an engineer at
    aironet for inclusion into this driver */
-typedef struct {
+typedef struct WepKeyRid WepKeyRid;
+struct WepKeyRid {
        __le16 len;
        __le16 kindex;
        u8 mac[ETH_ALEN];
        __le16 klen;
        u8 key[16];
-} WepKeyRid;
+} __attribute__ ((packed));
 
 /* These structures are from the Aironet's PC4500 Developers Manual */
-typedef struct {
+typedef struct Ssid Ssid;
+struct Ssid {
        __le16 len;
        u8 ssid[32];
-} Ssid;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct SsidRid SsidRid;
+struct SsidRid {
        __le16 len;
        Ssid ssids[3];
-} SsidRid;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct ModulationRid ModulationRid;
+struct ModulationRid {
         __le16 len;
         __le16 modulation;
 #define MOD_DEFAULT cpu_to_le16(0)
 #define MOD_CCK cpu_to_le16(1)
 #define MOD_MOK cpu_to_le16(2)
-} ModulationRid;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct ConfigRid ConfigRid;
+struct ConfigRid {
        __le16 len; /* sizeof(ConfigRid) */
        __le16 opmode; /* operating mode */
 #define MODE_STA_IBSS cpu_to_le16(0)
@@ -649,9 +651,10 @@ typedef struct {
 #define MAGIC_STAY_IN_CAM (1<<10)
        u8 magicControl;
        __le16 autoWake;
-} ConfigRid;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct StatusRid StatusRid;
+struct StatusRid {
        __le16 len;
        u8 mac[ETH_ALEN];
        __le16 mode;
@@ -707,21 +710,23 @@ typedef struct {
 #define STAT_LEAPFAILED 91
 #define STAT_LEAPTIMEDOUT 92
 #define STAT_LEAPCOMPLETE 93
-} StatusRid;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct StatsRid StatsRid;
+struct StatsRid {
        __le16 len;
        __le16 spacer;
        __le32 vals[100];
-} StatsRid;
-
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct APListRid APListRid;
+struct APListRid {
        __le16 len;
        u8 ap[4][ETH_ALEN];
-} APListRid;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct CapabilityRid CapabilityRid;
+struct CapabilityRid {
        __le16 len;
        char oui[3];
        char zero;
@@ -748,17 +753,18 @@ typedef struct {
        __le16 bootBlockVer;
        __le16 requiredHard;
        __le16 extSoftCap;
-} CapabilityRid;
-
+} __attribute__ ((packed));
 
 /* Only present on firmware >= 5.30.17 */
-typedef struct {
+typedef struct BSSListRidExtra BSSListRidExtra;
+struct BSSListRidExtra {
   __le16 unknown[4];
   u8 fixed[12]; /* WLAN management frame */
   u8 iep[624];
-} BSSListRidExtra;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct BSSListRid BSSListRid;
+struct BSSListRid {
   __le16 len;
   __le16 index; /* First is 0 and 0xffff means end of list */
 #define RADIO_FH 1 /* Frequency hopping radio type */
@@ -789,33 +795,37 @@ typedef struct {
 
   /* Only present on firmware >= 5.30.17 */
   BSSListRidExtra extra;
-} BSSListRid;
+} __attribute__ ((packed));
 
 typedef struct {
   BSSListRid bss;
   struct list_head list;
 } BSSListElement;
 
-typedef struct {
+typedef struct tdsRssiEntry tdsRssiEntry;
+struct tdsRssiEntry {
   u8 rssipct;
   u8 rssidBm;
-} tdsRssiEntry;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct tdsRssiRid tdsRssiRid;
+struct tdsRssiRid {
   u16 len;
   tdsRssiEntry x[256];
-} tdsRssiRid;
+} __attribute__ ((packed));
 
-typedef struct {
-       u16 len;
-       u16 state;
-       u16 multicastValid;
+typedef struct MICRid MICRid;
+struct MICRid {
+       __le16 len;
+       __le16 state;
+       __le16 multicastValid;
        u8  multicast[16];
-       u16 unicastValid;
+       __le16 unicastValid;
        u8  unicast[16];
-} MICRid;
+} __attribute__ ((packed));
 
-typedef struct {
+typedef struct MICBuffer MICBuffer;
+struct MICBuffer {
        __be16 typelen;
 
        union {
@@ -830,15 +840,13 @@ typedef struct {
        } u;
        __be32 mic;
        __be32 seq;
-} MICBuffer;
+} __attribute__ ((packed));
 
 typedef struct {
        u8 da[ETH_ALEN];
        u8 sa[ETH_ALEN];
 } etherHead;
 
-#pragma pack()
-
 #define TXCTL_TXOK (1<<1) /* report if tx is ok */
 #define TXCTL_TXEX (1<<2) /* report if tx fails */
 #define TXCTL_802_3 (0<<3) /* 802.3 packet */
@@ -981,6 +989,14 @@ typedef struct {
        dma_addr_t host_addr;
 } TxFid;
 
+struct rx_hdr {
+       __le16 status, len;
+       u8 rssi[2];
+       u8 rate;
+       u8 freq;
+       __le16 tmp[4];
+} __attribute__ ((packed));
+
 typedef struct {
        unsigned int  ctl: 15;
        unsigned int  rdy: 1;
@@ -1070,10 +1086,6 @@ static WifiCtlHdr wifictlhdr8023 = {
        }
 };
 
-// Frequency list (map channels to frequencies)
-static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442,
-                               2447, 2452, 2457, 2462, 2467, 2472, 2484 };
-
 // A few details needed for WEP (Wireless Equivalent Privacy)
 #define MAX_KEY_SIZE 13                        // 128 (?) bits
 #define MIN_KEY_SIZE  5                        // 40 bits RC4 - WEP
@@ -1082,12 +1094,6 @@ typedef struct wep_key_t {
        u8      key[16];        /* 40-bit and 104-bit keys */
 } wep_key_t;
 
-/* Backward compatibility */
-#ifndef IW_ENCODE_NOKEY
-#define IW_ENCODE_NOKEY         0x0800  /* Key is write only, so not present */
-#define IW_ENCODE_MODE  (IW_ENCODE_DISABLED | IW_ENCODE_RESTRICTED | IW_ENCODE_OPEN)
-#endif /* IW_ENCODE_NOKEY */
-
 /* List of Wireless Handlers (new API) */
 static const struct iw_handler_def     airo_handler_def;
 
@@ -1155,7 +1161,7 @@ struct airo_info {
           use the high bit to mark whether it is in use. */
 #define MAX_FIDS 6
 #define MPI_MAX_FIDS 1
-       int                           fids[MAX_FIDS];
+       u32                           fids[MAX_FIDS];
        ConfigRid config;
        char keyindex; // Used with auto wep
        char defindex; // Used with auto wep
@@ -1229,6 +1235,9 @@ struct airo_info {
 #define        PCI_SHARED_LEN          2*MPI_MAX_FIDS*PKTSIZE+RIDSIZE
        char                    proc_name[IFNAMSIZ];
 
+       int                     wep_capable;
+       int                     max_wep_idx;
+
        /* WPA-related stuff */
        unsigned int bssListFirst;
        unsigned int bssListNext;
@@ -1287,6 +1296,29 @@ static void emmh32_update(emmh32_context *context, u8 *pOctets, int len);
 static void emmh32_final(emmh32_context *context, u8 digest[4]);
 static int flashpchar(struct airo_info *ai,int byte,int dwelltime);
 
+static void age_mic_context(miccntx *cur, miccntx *old, u8 *key, int key_len,
+                           struct crypto_cipher *tfm)
+{
+       /* If the current MIC context is valid and its key is the same as
+        * the MIC register, there's nothing to do.
+        */
+       if (cur->valid && (memcmp(cur->key, key, key_len) == 0))
+               return;
+
+       /* Age current mic Context */
+       memcpy(old, cur, sizeof(*cur));
+
+       /* Initialize new context */
+       memcpy(cur->key, key, key_len);
+       cur->window  = 33; /* Window always points to the middle */
+       cur->rx      = 0;  /* Rx Sequence numbers */
+       cur->tx      = 0;  /* Tx sequence numbers */
+       cur->valid   = 1;  /* Key is now valid */
+
+       /* Give key to mic seed */
+       emmh32_setseed(&cur->seed, key, key_len, tfm);
+}
+
 /* micinit - Initialize mic seed */
 
 static void micinit(struct airo_info *ai)
@@ -1297,49 +1329,26 @@ static void micinit(struct airo_info *ai)
        PC4500_readrid(ai, RID_MIC, &mic_rid, sizeof(mic_rid), 0);
        up(&ai->sem);
 
-       ai->micstats.enabled = (mic_rid.state & 0x00FF) ? 1 : 0;
-
-       if (ai->micstats.enabled) {
-               /* Key must be valid and different */
-               if (mic_rid.multicastValid && (!ai->mod[0].mCtx.valid ||
-                   (memcmp (ai->mod[0].mCtx.key, mic_rid.multicast,
-                            sizeof(ai->mod[0].mCtx.key)) != 0))) {
-                       /* Age current mic Context */
-                       memcpy(&ai->mod[1].mCtx,&ai->mod[0].mCtx,sizeof(miccntx));
-                       /* Initialize new context */
-                       memcpy(&ai->mod[0].mCtx.key,mic_rid.multicast,sizeof(mic_rid.multicast));
-                       ai->mod[0].mCtx.window  = 33; //Window always points to the middle
-                       ai->mod[0].mCtx.rx      = 0;  //Rx Sequence numbers
-                       ai->mod[0].mCtx.tx      = 0;  //Tx sequence numbers
-                       ai->mod[0].mCtx.valid   = 1;  //Key is now valid
-  
-                       /* Give key to mic seed */
-                       emmh32_setseed(&ai->mod[0].mCtx.seed,mic_rid.multicast,sizeof(mic_rid.multicast), ai->tfm);
-               }
-
-               /* Key must be valid and different */
-               if (mic_rid.unicastValid && (!ai->mod[0].uCtx.valid || 
-                   (memcmp(ai->mod[0].uCtx.key, mic_rid.unicast,
-                           sizeof(ai->mod[0].uCtx.key)) != 0))) {
-                       /* Age current mic Context */
-                       memcpy(&ai->mod[1].uCtx,&ai->mod[0].uCtx,sizeof(miccntx));
-                       /* Initialize new context */
-                       memcpy(&ai->mod[0].uCtx.key,mic_rid.unicast,sizeof(mic_rid.unicast));
-       
-                       ai->mod[0].uCtx.window  = 33; //Window always points to the middle
-                       ai->mod[0].uCtx.rx      = 0;  //Rx Sequence numbers
-                       ai->mod[0].uCtx.tx      = 0;  //Tx sequence numbers
-                       ai->mod[0].uCtx.valid   = 1;  //Key is now valid
-       
-                       //Give key to mic seed
-                       emmh32_setseed(&ai->mod[0].uCtx.seed, mic_rid.unicast, sizeof(mic_rid.unicast), ai->tfm);
-               }
-       } else {
-      /* So next time we have a valid key and mic is enabled, we will update
-       * the sequence number if the key is the same as before.
-       */
+       ai->micstats.enabled = (le16_to_cpu(mic_rid.state) & 0x00FF) ? 1 : 0;
+       if (!ai->micstats.enabled) {
+               /* So next time we have a valid key and mic is enabled, we will
+                * update the sequence number if the key is the same as before.
+                */
                ai->mod[0].uCtx.valid = 0;
                ai->mod[0].mCtx.valid = 0;
+               return;
+       }
+
+       if (mic_rid.multicastValid) {
+               age_mic_context(&ai->mod[0].mCtx, &ai->mod[1].mCtx,
+                               mic_rid.multicast, sizeof(mic_rid.multicast),
+                               ai->tfm);
+       }
+
+       if (mic_rid.unicastValid) {
+               age_mic_context(&ai->mod[0].uCtx, &ai->mod[1].uCtx,
+                               mic_rid.unicast, sizeof(mic_rid.unicast),
+                               ai->tfm);
        }
 }
 
@@ -2730,28 +2739,6 @@ static void airo_networks_initialize(struct airo_info *ai)
                              &ai->network_free_list);
 }
 
-static int airo_test_wpa_capable(struct airo_info *ai)
-{
-       int status;
-       CapabilityRid cap_rid;
-
-       status = readCapabilityRid(ai, &cap_rid, 1);
-       if (status != SUCCESS) return 0;
-
-       /* Only firmware versions 5.30.17 or better can do WPA */
-       if (le16_to_cpu(cap_rid.softVer) > 0x530
-         || (le16_to_cpu(cap_rid.softVer) == 0x530
-             && le16_to_cpu(cap_rid.softSubVer) >= 17)) {
-               airo_print_info("", "WPA is supported.");
-               return 1;
-       }
-
-       /* No WPA support */
-       airo_print_info("", "WPA unsupported (only firmware versions 5.30.17"
-               " and greater support WPA.  Detected %s)", cap_rid.prodVer);
-       return 0;
-}
-
 static struct net_device *_init_airo_card( unsigned short irq, int port,
                                           int is_pcmcia, struct pci_dev *pci,
                                           struct device *dmdev )
@@ -2759,6 +2746,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
        struct net_device *dev;
        struct airo_info *ai;
        int i, rc;
+       CapabilityRid cap_rid;
 
        /* Create the network device object. */
        dev = alloc_netdev(sizeof(*ai), "", ether_setup);
@@ -2828,7 +2816,7 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
        }
 
        if (probe) {
-               if ( setup_card( ai, dev->dev_addr, 1 ) != SUCCESS ) {
+               if (setup_card(ai, dev->dev_addr, 1) != SUCCESS) {
                        airo_print_err(dev->name, "MAC could not be enabled" );
                        rc = -EIO;
                        goto err_out_map;
@@ -2838,28 +2826,50 @@ static struct net_device *_init_airo_card( unsigned short irq, int port,
                set_bit(FLAG_FLASHING, &ai->flags);
        }
 
+       strcpy(dev->name, "eth%d");
+       rc = register_netdev(dev);
+       if (rc) {
+               airo_print_err(dev->name, "Couldn't register_netdev");
+               goto err_out_map;
+       }
+       ai->wifidev = init_wifidev(ai, dev);
+       if (!ai->wifidev)
+               goto err_out_reg;
+
+       rc = readCapabilityRid(ai, &cap_rid, 1);
+       if (rc != SUCCESS) {
+               rc = -EIO;
+               goto err_out_wifi;
+       }
+       /* WEP capability discovery */
+       ai->wep_capable = (cap_rid.softCap & cpu_to_le16(0x02)) ? 1 : 0;
+       ai->max_wep_idx = (cap_rid.softCap & cpu_to_le16(0x80)) ? 3 : 0;
+
+       airo_print_info(dev->name, "Firmware version %x.%x.%02x",
+                       ((le16_to_cpu(cap_rid.softVer) >> 8) & 0xF),
+                       (le16_to_cpu(cap_rid.softVer) & 0xFF),
+                       le16_to_cpu(cap_rid.softSubVer));
+
        /* Test for WPA support */
-       if (airo_test_wpa_capable(ai)) {
+       /* Only firmware versions 5.30.17 or better can do WPA */
+       if (le16_to_cpu(cap_rid.softVer) > 0x530
+        || (le16_to_cpu(cap_rid.softVer) == 0x530
+             && le16_to_cpu(cap_rid.softSubVer) >= 17)) {
+               airo_print_info(ai->dev->name, "WPA supported.");
+
                set_bit(FLAG_WPA_CAPABLE, &ai->flags);
                ai->bssListFirst = RID_WPA_BSSLISTFIRST;
                ai->bssListNext = RID_WPA_BSSLISTNEXT;
                ai->bssListRidLen = sizeof(BSSListRid);
        } else {
+               airo_print_info(ai->dev->name, "WPA unsupported with firmware "
+                       "versions older than 5.30.17.");
+
                ai->bssListFirst = RID_BSSLISTFIRST;
                ai->bssListNext = RID_BSSLISTNEXT;
                ai->bssListRidLen = sizeof(BSSListRid) - sizeof(BSSListRidExtra);
        }
 
-       strcpy(dev->name, "eth%d");
-       rc = register_netdev(dev);
-       if (rc) {
-               airo_print_err(dev->name, "Couldn't register_netdev");
-               goto err_out_map;
-       }
-       ai->wifidev = init_wifidev(ai, dev);
-       if (!ai->wifidev)
-               goto err_out_reg;
-
        set_bit(FLAG_REGISTERED,&ai->flags);
        airo_print_info(dev->name, "MAC enabled %pM", dev->dev_addr);
 
@@ -3127,314 +3137,354 @@ static int header_len(__le16 ctl)
        return 24;
 }
 
-static irqreturn_t airo_interrupt(int irq, void *dev_id)
+static void airo_handle_cisco_mic(struct airo_info *ai)
 {
-       struct net_device *dev = dev_id;
+       if (test_bit(FLAG_MIC_CAPABLE, &ai->flags)) {
+               set_bit(JOB_MIC, &ai->jobs);
+               wake_up_interruptible(&ai->thr_wait);
+       }
+}
+
+/* Airo Status codes */
+#define STAT_NOBEACON  0x8000 /* Loss of sync - missed beacons */
+#define STAT_MAXRETRIES        0x8001 /* Loss of sync - max retries */
+#define STAT_MAXARL    0x8002 /* Loss of sync - average retry level exceeded*/
+#define STAT_FORCELOSS 0x8003 /* Loss of sync - host request */
+#define STAT_TSFSYNC   0x8004 /* Loss of sync - TSF synchronization */
+#define STAT_DEAUTH    0x8100 /* low byte is 802.11 reason code */
+#define STAT_DISASSOC  0x8200 /* low byte is 802.11 reason code */
+#define STAT_ASSOC_FAIL        0x8400 /* low byte is 802.11 reason code */
+#define STAT_AUTH_FAIL 0x0300 /* low byte is 802.11 reason code */
+#define STAT_ASSOC     0x0400 /* Associated */
+#define STAT_REASSOC    0x0600 /* Reassociated?  Only on firmware >= 5.30.17 */
+
+static void airo_print_status(const char *devname, u16 status)
+{
+       u8 reason = status & 0xFF;
+
+       switch (status) {
+       case STAT_NOBEACON:
+               airo_print_dbg(devname, "link lost (missed beacons)");
+               break;
+       case STAT_MAXRETRIES:
+       case STAT_MAXARL:
+               airo_print_dbg(devname, "link lost (max retries)");
+               break;
+       case STAT_FORCELOSS:
+               airo_print_dbg(devname, "link lost (local choice)");
+               break;
+       case STAT_TSFSYNC:
+               airo_print_dbg(devname, "link lost (TSF sync lost)");
+               break;
+       case STAT_DEAUTH:
+               airo_print_dbg(devname, "deauthenticated (reason: %d)", reason);
+               break;
+       case STAT_DISASSOC:
+               airo_print_dbg(devname, "disassociated (reason: %d)", reason);
+               break;
+       case STAT_ASSOC_FAIL:
+               airo_print_dbg(devname, "association failed (reason: %d)",
+                              reason);
+               break;
+       case STAT_AUTH_FAIL:
+               airo_print_dbg(devname, "authentication failed (reason: %d)",
+                              reason);
+               break;
+       default:
+               break;
+       }
+}
+
+static void airo_handle_link(struct airo_info *ai)
+{
+       union iwreq_data wrqu;
+       int scan_forceloss = 0;
        u16 status;
-       u16 fid;
-       struct airo_info *apriv = dev->ml_priv;
-       u16 savedInterrupts = 0;
-       int handled = 0;
 
-       if (!netif_device_present(dev))
-               return IRQ_NONE;
+       /* Get new status and acknowledge the link change */
+       status = le16_to_cpu(IN4500(ai, LINKSTAT));
+       OUT4500(ai, EVACK, EV_LINK);
 
-       for (;;) {
-               status = IN4500( apriv, EVSTAT );
-               if ( !(status & STATUS_INTS) || status == 0xffff ) break;
+       if ((status == STAT_FORCELOSS) && (ai->scan_timeout > 0))
+               scan_forceloss = 1;
 
-               handled = 1;
+       airo_print_status(ai->dev->name, status);
 
-               if ( status & EV_AWAKE ) {
-                       OUT4500( apriv, EVACK, EV_AWAKE );
-                       OUT4500( apriv, EVACK, EV_AWAKE );
-               }
+       if ((status == STAT_ASSOC) || (status == STAT_REASSOC)) {
+               if (auto_wep)
+                       ai->expires = 0;
+               if (ai->list_bss_task)
+                       wake_up_process(ai->list_bss_task);
+               set_bit(FLAG_UPDATE_UNI, &ai->flags);
+               set_bit(FLAG_UPDATE_MULTI, &ai->flags);
 
-               if (!savedInterrupts) {
-                       savedInterrupts = IN4500( apriv, EVINTEN );
-                       OUT4500( apriv, EVINTEN, 0 );
+               if (down_trylock(&ai->sem) != 0) {
+                       set_bit(JOB_EVENT, &ai->jobs);
+                       wake_up_interruptible(&ai->thr_wait);
+               } else
+                       airo_send_event(ai->dev);
+       } else if (!scan_forceloss) {
+               if (auto_wep && !ai->expires) {
+                       ai->expires = RUN_AT(3*HZ);
+                       wake_up_interruptible(&ai->thr_wait);
                }
 
-               if ( status & EV_MIC ) {
-                       OUT4500( apriv, EVACK, EV_MIC );
-                       if (test_bit(FLAG_MIC_CAPABLE, &apriv->flags)) {
-                               set_bit(JOB_MIC, &apriv->jobs);
-                               wake_up_interruptible(&apriv->thr_wait);
-                       }
-               }
-               if ( status & EV_LINK ) {
-                       union iwreq_data        wrqu;
-                       int scan_forceloss = 0;
-                       /* The link status has changed, if you want to put a
-                          monitor hook in, do it here.  (Remember that
-                          interrupts are still disabled!)
-                       */
-                       u16 newStatus = IN4500(apriv, LINKSTAT);
-                       OUT4500( apriv, EVACK, EV_LINK);
-                       /* Here is what newStatus means: */
-#define NOBEACON 0x8000 /* Loss of sync - missed beacons */
-#define MAXRETRIES 0x8001 /* Loss of sync - max retries */
-#define MAXARL 0x8002 /* Loss of sync - average retry level exceeded*/
-#define FORCELOSS 0x8003 /* Loss of sync - host request */
-#define TSFSYNC 0x8004 /* Loss of sync - TSF synchronization */
-#define DEAUTH 0x8100 /* Deauthentication (low byte is reason code) */
-#define DISASS 0x8200 /* Disassociation (low byte is reason code) */
-#define ASSFAIL 0x8400 /* Association failure (low byte is reason
-                         code) */
-#define AUTHFAIL 0x0300 /* Authentication failure (low byte is reason
-                          code) */
-#define ASSOCIATED 0x0400 /* Associated */
-#define REASSOCIATED 0x0600 /* Reassociated?  Only on firmware >= 5.30.17 */
-#define RC_RESERVED 0 /* Reserved return code */
-#define RC_NOREASON 1 /* Unspecified reason */
-#define RC_AUTHINV 2 /* Previous authentication invalid */
-#define RC_DEAUTH 3 /* Deauthenticated because sending station is
-                      leaving */
-#define RC_NOACT 4 /* Disassociated due to inactivity */
-#define RC_MAXLOAD 5 /* Disassociated because AP is unable to handle
-                       all currently associated stations */
-#define RC_BADCLASS2 6 /* Class 2 frame received from
-                         non-Authenticated station */
-#define RC_BADCLASS3 7 /* Class 3 frame received from
-                         non-Associated station */
-#define RC_STATLEAVE 8 /* Disassociated because sending station is
-                         leaving BSS */
-#define RC_NOAUTH 9 /* Station requesting (Re)Association is not
-                      Authenticated with the responding station */
-                       if (newStatus == FORCELOSS && apriv->scan_timeout > 0)
-                               scan_forceloss = 1;
-                       if(newStatus == ASSOCIATED || newStatus == REASSOCIATED) {
-                               if (auto_wep)
-                                       apriv->expires = 0;
-                               if (apriv->list_bss_task)
-                                       wake_up_process(apriv->list_bss_task);
-                               set_bit(FLAG_UPDATE_UNI, &apriv->flags);
-                               set_bit(FLAG_UPDATE_MULTI, &apriv->flags);
-
-                               if (down_trylock(&apriv->sem) != 0) {
-                                       set_bit(JOB_EVENT, &apriv->jobs);
-                                       wake_up_interruptible(&apriv->thr_wait);
-                               } else
-                                       airo_send_event(dev);
-                       } else if (!scan_forceloss) {
-                               if (auto_wep && !apriv->expires) {
-                                       apriv->expires = RUN_AT(3*HZ);
-                                       wake_up_interruptible(&apriv->thr_wait);
-                               }
+               /* Send event to user space */
+               memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
+               wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+               wireless_send_event(ai->dev, SIOCGIWAP, &wrqu, NULL);
+       }
+}
 
-                               /* Send event to user space */
-                               memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
-                               wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-                               wireless_send_event(dev, SIOCGIWAP, &wrqu,NULL);
-                       }
-               }
+static void airo_handle_rx(struct airo_info *ai)
+{
+       struct sk_buff *skb = NULL;
+       __le16 fc, v, *buffer, tmpbuf[4];
+       u16 len, hdrlen = 0, gap, fid;
+       struct rx_hdr hdr;
+       int success = 0;
 
-               /* Check to see if there is something to receive */
-               if ( status & EV_RX  ) {
-                       struct sk_buff *skb = NULL;
-                       __le16 fc, v;
-                       u16 len, hdrlen = 0;
-#pragma pack(1)
-                       struct {
-                               __le16 status, len;
-                               u8 rssi[2];
-                               u8 rate;
-                               u8 freq;
-                               __le16 tmp[4];
-                       } hdr;
-#pragma pack()
-                       u16 gap;
-                       __le16 tmpbuf[4];
-                       __le16 *buffer;
-
-                       if (test_bit(FLAG_MPI,&apriv->flags)) {
-                               if (test_bit(FLAG_802_11, &apriv->flags))
-                                       mpi_receive_802_11(apriv);
-                               else
-                                       mpi_receive_802_3(apriv);
-                               OUT4500(apriv, EVACK, EV_RX);
-                               goto exitrx;
-                       }
+       if (test_bit(FLAG_MPI, &ai->flags)) {
+               if (test_bit(FLAG_802_11, &ai->flags))
+                       mpi_receive_802_11(ai);
+               else
+                       mpi_receive_802_3(ai);
+               OUT4500(ai, EVACK, EV_RX);
+               return;
+       }
 
-                       fid = IN4500( apriv, RXFID );
-
-                       /* Get the packet length */
-                       if (test_bit(FLAG_802_11, &apriv->flags)) {
-                               bap_setup (apriv, fid, 4, BAP0);
-                               bap_read (apriv, (__le16*)&hdr, sizeof(hdr), BAP0);
-                               /* Bad CRC. Ignore packet */
-                               if (le16_to_cpu(hdr.status) & 2)
-                                       hdr.len = 0;
-                               if (apriv->wifidev == NULL)
-                                       hdr.len = 0;
-                       } else {
-                               bap_setup (apriv, fid, 0x36, BAP0);
-                               bap_read (apriv, &hdr.len, 2, BAP0);
-                       }
-                       len = le16_to_cpu(hdr.len);
+       fid = IN4500(ai, RXFID);
 
-                       if (len > AIRO_DEF_MTU) {
-                               airo_print_err(apriv->dev->name, "Bad size %d", len);
-                               goto badrx;
-                       }
-                       if (len == 0)
-                               goto badrx;
+       /* Get the packet length */
+       if (test_bit(FLAG_802_11, &ai->flags)) {
+               bap_setup (ai, fid, 4, BAP0);
+               bap_read (ai, (__le16*)&hdr, sizeof(hdr), BAP0);
+               /* Bad CRC. Ignore packet */
+               if (le16_to_cpu(hdr.status) & 2)
+                       hdr.len = 0;
+               if (ai->wifidev == NULL)
+                       hdr.len = 0;
+       } else {
+               bap_setup(ai, fid, 0x36, BAP0);
+               bap_read(ai, &hdr.len, 2, BAP0);
+       }
+       len = le16_to_cpu(hdr.len);
 
-                       if (test_bit(FLAG_802_11, &apriv->flags)) {
-                               bap_read (apriv, &fc, sizeof(fc), BAP0);
-                               hdrlen = header_len(fc);
-                       } else
-                               hdrlen = ETH_ALEN * 2;
+       if (len > AIRO_DEF_MTU) {
+               airo_print_err(ai->dev->name, "Bad size %d", len);
+               goto done;
+       }
+       if (len == 0)
+               goto done;
 
-                       skb = dev_alloc_skb( len + hdrlen + 2 + 2 );
-                       if ( !skb ) {
-                               dev->stats.rx_dropped++;
-                               goto badrx;
-                       }
-                       skb_reserve(skb, 2); /* This way the IP header is aligned */
-                       buffer = (__le16*)skb_put (skb, len + hdrlen);
-                       if (test_bit(FLAG_802_11, &apriv->flags)) {
-                               buffer[0] = fc;
-                               bap_read (apriv, buffer + 1, hdrlen - 2, BAP0);
-                               if (hdrlen == 24)
-                                       bap_read (apriv, tmpbuf, 6, BAP0);
-
-                               bap_read (apriv, &v, sizeof(v), BAP0);
-                               gap = le16_to_cpu(v);
-                               if (gap) {
-                                       if (gap <= 8) {
-                                               bap_read (apriv, tmpbuf, gap, BAP0);
-                                       } else {
-                                               airo_print_err(apriv->dev->name, "gaplen too "
-                                                       "big. Problems will follow...");
-                                       }
-                               }
-                               bap_read (apriv, buffer + hdrlen/2, len, BAP0);
+       if (test_bit(FLAG_802_11, &ai->flags)) {
+               bap_read(ai, &fc, sizeof (fc), BAP0);
+               hdrlen = header_len(fc);
+       } else
+               hdrlen = ETH_ALEN * 2;
+
+       skb = dev_alloc_skb(len + hdrlen + 2 + 2);
+       if (!skb) {
+               ai->dev->stats.rx_dropped++;
+               goto done;
+       }
+
+       skb_reserve(skb, 2); /* This way the IP header is aligned */
+       buffer = (__le16 *) skb_put(skb, len + hdrlen);
+       if (test_bit(FLAG_802_11, &ai->flags)) {
+               buffer[0] = fc;
+               bap_read(ai, buffer + 1, hdrlen - 2, BAP0);
+               if (hdrlen == 24)
+                       bap_read(ai, tmpbuf, 6, BAP0);
+
+               bap_read(ai, &v, sizeof(v), BAP0);
+               gap = le16_to_cpu(v);
+               if (gap) {
+                       if (gap <= 8) {
+                               bap_read(ai, tmpbuf, gap, BAP0);
                        } else {
-                               MICBuffer micbuf;
-                               bap_read (apriv, buffer, ETH_ALEN*2, BAP0);
-                               if (apriv->micstats.enabled) {
-                                       bap_read (apriv,(__le16*)&micbuf,sizeof(micbuf),BAP0);
-                                       if (ntohs(micbuf.typelen) > 0x05DC)
-                                               bap_setup (apriv, fid, 0x44, BAP0);
-                                       else {
-                                               if (len <= sizeof(micbuf))
-                                                       goto badmic;
-
-                                               len -= sizeof(micbuf);
-                                               skb_trim (skb, len + hdrlen);
-                                       }
-                               }
-                               bap_read(apriv,buffer+ETH_ALEN,len,BAP0);
-                               if (decapsulate(apriv,&micbuf,(etherHead*)buffer,len)) {
-badmic:
-                                       dev_kfree_skb_irq (skb);
-badrx:
-                                       OUT4500( apriv, EVACK, EV_RX);
-                                       goto exitrx;
+                               airo_print_err(ai->dev->name, "gaplen too "
+                                       "big. Problems will follow...");
+                       }
+               }
+               bap_read(ai, buffer + hdrlen/2, len, BAP0);
+       } else {
+               MICBuffer micbuf;
+
+               bap_read(ai, buffer, ETH_ALEN * 2, BAP0);
+               if (ai->micstats.enabled) {
+                       bap_read(ai, (__le16 *) &micbuf, sizeof (micbuf), BAP0);
+                       if (ntohs(micbuf.typelen) > 0x05DC)
+                               bap_setup(ai, fid, 0x44, BAP0);
+                       else {
+                               if (len <= sizeof (micbuf)) {
+                                       dev_kfree_skb_irq(skb);
+                                       goto done;
                                }
+
+                               len -= sizeof(micbuf);
+                               skb_trim(skb, len + hdrlen);
                        }
+               }
+
+               bap_read(ai, buffer + ETH_ALEN, len, BAP0);
+               if (decapsulate(ai, &micbuf, (etherHead*) buffer, len))
+                       dev_kfree_skb_irq (skb);
+               else
+                       success = 1;
+       }
+
 #ifdef WIRELESS_SPY
-                       if (apriv->spy_data.spy_number > 0) {
-                               char *sa;
-                               struct iw_quality wstats;
-                               /* Prepare spy data : addr + qual */
-                               if (!test_bit(FLAG_802_11, &apriv->flags)) {
-                                       sa = (char*)buffer + 6;
-                                       bap_setup (apriv, fid, 8, BAP0);
-                                       bap_read (apriv, (__le16*)hdr.rssi, 2, BAP0);
-                               } else
-                                       sa = (char*)buffer + 10;
-                               wstats.qual = hdr.rssi[0];
-                               if (apriv->rssi)
-                                       wstats.level = 0x100 - apriv->rssi[hdr.rssi[1]].rssidBm;
-                               else
-                                       wstats.level = (hdr.rssi[1] + 321) / 2;
-                               wstats.noise = apriv->wstats.qual.noise;
-                               wstats.updated = IW_QUAL_LEVEL_UPDATED
-                                       | IW_QUAL_QUAL_UPDATED
-                                       | IW_QUAL_DBM;
-                               /* Update spy records */
-                               wireless_spy_update(dev, sa, &wstats);
-                       }
+       if (success && (ai->spy_data.spy_number > 0)) {
+               char *sa;
+               struct iw_quality wstats;
+
+               /* Prepare spy data : addr + qual */
+               if (!test_bit(FLAG_802_11, &ai->flags)) {
+                       sa = (char *) buffer + 6;
+                       bap_setup(ai, fid, 8, BAP0);
+                       bap_read(ai, (__le16 *) hdr.rssi, 2, BAP0);
+               } else
+                       sa = (char *) buffer + 10;
+               wstats.qual = hdr.rssi[0];
+               if (ai->rssi)
+                       wstats.level = 0x100 - ai->rssi[hdr.rssi[1]].rssidBm;
+               else
+                       wstats.level = (hdr.rssi[1] + 321) / 2;
+               wstats.noise = ai->wstats.qual.noise;
+               wstats.updated =  IW_QUAL_LEVEL_UPDATED
+                               | IW_QUAL_QUAL_UPDATED
+                               | IW_QUAL_DBM;
+               /* Update spy records */
+               wireless_spy_update(ai->dev, sa, &wstats);
+       }
 #endif /* WIRELESS_SPY */
-                       OUT4500( apriv, EVACK, EV_RX);
 
-                       if (test_bit(FLAG_802_11, &apriv->flags)) {
-                               skb_reset_mac_header(skb);
-                               skb->pkt_type = PACKET_OTHERHOST;
-                               skb->dev = apriv->wifidev;
-                               skb->protocol = htons(ETH_P_802_2);
-                       } else
-                               skb->protocol = eth_type_trans(skb,dev);
-                       skb->ip_summed = CHECKSUM_NONE;
+done:
+       OUT4500(ai, EVACK, EV_RX);
+
+       if (success) {
+               if (test_bit(FLAG_802_11, &ai->flags)) {
+                       skb_reset_mac_header(skb);
+                       skb->pkt_type = PACKET_OTHERHOST;
+                       skb->dev = ai->wifidev;
+                       skb->protocol = htons(ETH_P_802_2);
+               } else
+                       skb->protocol = eth_type_trans(skb, ai->dev);
+               skb->ip_summed = CHECKSUM_NONE;
+
+               netif_rx(skb);
+       }
+}
+
+static void airo_handle_tx(struct airo_info *ai, u16 status)
+{
+       int i, len = 0, index = -1;
+       u16 fid;
+
+       if (test_bit(FLAG_MPI, &ai->flags)) {
+               unsigned long flags;
+
+               if (status & EV_TXEXC)
+                       get_tx_error(ai, -1);
 
-                       netif_rx( skb );
+               spin_lock_irqsave(&ai->aux_lock, flags);
+               if (!skb_queue_empty(&ai->txq)) {
+                       spin_unlock_irqrestore(&ai->aux_lock,flags);
+                       mpi_send_packet(ai->dev);
+               } else {
+                       clear_bit(FLAG_PENDING_XMIT, &ai->flags);
+                       spin_unlock_irqrestore(&ai->aux_lock,flags);
+                       netif_wake_queue(ai->dev);
                }
-exitrx:
+               OUT4500(ai, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC));
+               return;
+       }
 
-               /* Check to see if a packet has been transmitted */
-               if (  status & ( EV_TX|EV_TXCPY|EV_TXEXC ) ) {
-                       int i;
-                       int len = 0;
-                       int index = -1;
-
-                       if (test_bit(FLAG_MPI,&apriv->flags)) {
-                               unsigned long flags;
-
-                               if (status & EV_TXEXC)
-                                       get_tx_error(apriv, -1);
-                               spin_lock_irqsave(&apriv->aux_lock, flags);
-                               if (!skb_queue_empty(&apriv->txq)) {
-                                       spin_unlock_irqrestore(&apriv->aux_lock,flags);
-                                       mpi_send_packet (dev);
-                               } else {
-                                       clear_bit(FLAG_PENDING_XMIT, &apriv->flags);
-                                       spin_unlock_irqrestore(&apriv->aux_lock,flags);
-                                       netif_wake_queue (dev);
-                               }
-                               OUT4500( apriv, EVACK,
-                                       status & (EV_TX|EV_TXCPY|EV_TXEXC));
-                               goto exittx;
-                       }
+       fid = IN4500(ai, TXCOMPLFID);
 
-                       fid = IN4500(apriv, TXCOMPLFID);
+       for(i = 0; i < MAX_FIDS; i++) {
+               if ((ai->fids[i] & 0xffff) == fid) {
+                       len = ai->fids[i] >> 16;
+                       index = i;
+               }
+       }
 
-                       for( i = 0; i < MAX_FIDS; i++ ) {
-                               if ( ( apriv->fids[i] & 0xffff ) == fid ) {
-                                       len = apriv->fids[i] >> 16;
-                                       index = i;
-                               }
-                       }
-                       if (index != -1) {
-                               if (status & EV_TXEXC)
-                                       get_tx_error(apriv, index);
-                               OUT4500( apriv, EVACK, status & (EV_TX | EV_TXEXC));
-                               /* Set up to be used again */
-                               apriv->fids[index] &= 0xffff;
-                               if (index < MAX_FIDS / 2) {
-                                       if (!test_bit(FLAG_PENDING_XMIT, &apriv->flags))
-                                               netif_wake_queue(dev);
-                               } else {
-                                       if (!test_bit(FLAG_PENDING_XMIT11, &apriv->flags))
-                                               netif_wake_queue(apriv->wifidev);
-                               }
-                       } else {
-                               OUT4500( apriv, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC));
-                               airo_print_err(apriv->dev->name, "Unallocated FID was "
-                                       "used to xmit" );
-                       }
+       if (index != -1) {
+               if (status & EV_TXEXC)
+                       get_tx_error(ai, index);
+
+               OUT4500(ai, EVACK, status & (EV_TX | EV_TXEXC));
+
+               /* Set up to be used again */
+               ai->fids[index] &= 0xffff;
+               if (index < MAX_FIDS / 2) {
+                       if (!test_bit(FLAG_PENDING_XMIT, &ai->flags))
+                               netif_wake_queue(ai->dev);
+               } else {
+                       if (!test_bit(FLAG_PENDING_XMIT11, &ai->flags))
+                               netif_wake_queue(ai->wifidev);
+               }
+       } else {
+               OUT4500(ai, EVACK, status & (EV_TX | EV_TXCPY | EV_TXEXC));
+               airo_print_err(ai->dev->name, "Unallocated FID was used to xmit");
+       }
+}
+
+static irqreturn_t airo_interrupt(int irq, void *dev_id)
+{
+       struct net_device *dev = dev_id;
+       u16 status, savedInterrupts = 0;
+       struct airo_info *ai = dev->ml_priv;
+       int handled = 0;
+
+       if (!netif_device_present(dev))
+               return IRQ_NONE;
+
+       for (;;) {
+               status = IN4500(ai, EVSTAT);
+               if (!(status & STATUS_INTS) || (status == 0xffff))
+                       break;
+
+               handled = 1;
+
+               if (status & EV_AWAKE) {
+                       OUT4500(ai, EVACK, EV_AWAKE);
+                       OUT4500(ai, EVACK, EV_AWAKE);
+               }
+
+               if (!savedInterrupts) {
+                       savedInterrupts = IN4500(ai, EVINTEN);
+                       OUT4500(ai, EVINTEN, 0);
+               }
+
+               if (status & EV_MIC) {
+                       OUT4500(ai, EVACK, EV_MIC);
+                       airo_handle_cisco_mic(ai);
+               }
+
+               if (status & EV_LINK) {
+                       /* Link status changed */
+                       airo_handle_link(ai);
                }
-exittx:
-               if ( status & ~STATUS_INTS & ~IGNORE_INTS )
-                       airo_print_warn(apriv->dev->name, "Got weird status %x",
+
+               /* Check to see if there is something to receive */
+               if (status & EV_RX)
+                       airo_handle_rx(ai);
+
+               /* Check to see if a packet has been transmitted */
+               if (status & (EV_TX | EV_TXCPY | EV_TXEXC))
+                       airo_handle_tx(ai, status);
+
+               if ( status & ~STATUS_INTS & ~IGNORE_INTS ) {
+                       airo_print_warn(ai->dev->name, "Got weird status %x",
                                status & ~STATUS_INTS & ~IGNORE_INTS );
+               }
        }
 
        if (savedInterrupts)
-               OUT4500( apriv, EVINTEN, savedInterrupts );
+               OUT4500(ai, EVINTEN, savedInterrupts);
 
-       /* done.. */
        return IRQ_RETVAL(handled);
 }
 
@@ -3613,18 +3663,10 @@ static void mpi_receive_802_11(struct airo_info *ai)
        struct sk_buff *skb = NULL;
        u16 len, hdrlen = 0;
        __le16 fc;
-#pragma pack(1)
-       struct {
-               __le16 status, len;
-               u8 rssi[2];
-               u8 rate;
-               u8 freq;
-               __le16 tmp[4];
-       } hdr;
-#pragma pack()
+       struct rx_hdr hdr;
        u16 gap;
        u16 *buffer;
-       char *ptr = ai->rxfids[0].virtual_host_addr+4;
+       char *ptr = ai->rxfids[0].virtual_host_addr + 4;
 
        memcpy_fromio(&rxd, ai->rxfids[0].card_ram_off, sizeof(rxd));
        memcpy ((char *)&hdr, ptr, sizeof(hdr));
@@ -3691,6 +3733,7 @@ static void mpi_receive_802_11(struct airo_info *ai)
        skb->protocol = htons(ETH_P_802_2);
        skb->ip_summed = CHECKSUM_NONE;
        netif_rx( skb );
+
 badrx:
        if (rxd.valid == 0) {
                rxd.valid = 1;
@@ -3705,7 +3748,6 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
        Cmd cmd;
        Resp rsp;
        int status;
-       int i;
        SsidRid mySsid;
        __le16 lastindex;
        WepKeyRid wkr;
@@ -3747,6 +3789,7 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
        if (lock)
                up(&ai->sem);
        if (ai->config.len == 0) {
+               int i;
                tdsRssiRid rssi_rid;
                CapabilityRid cap_rid;
 
@@ -3794,14 +3837,12 @@ static u16 setup_card(struct airo_info *ai, u8 *mac, int lock)
                /* Check to see if there are any insmod configured
                   rates to add */
                if ( rates[0] ) {
-                       int i = 0;
                        memset(ai->config.rates,0,sizeof(ai->config.rates));
                        for( i = 0; i < 8 && rates[i]; i++ ) {
                                ai->config.rates[i] = rates[i];
                        }
                }
                if ( basic_rate > 0 ) {
-                       int i;
                        for( i = 0; i < 8; i++ ) {
                                if ( ai->config.rates[i] == basic_rate ||
                                     !ai->config.rates ) {
@@ -5131,55 +5172,98 @@ static int do_writerid( struct airo_info *ai, u16 rid, const void *rid_data,
        return rc;
 }
 
-/* Returns the length of the key at the index.  If index == 0xffff
- * the index of the transmit key is returned.  If the key doesn't exist,
- * -1 will be returned.
+/* Returns the WEP key at the specified index, or -1 if that key does
+ * not exist.  The buffer is assumed to be at least 16 bytes in length.
  */
-static int get_wep_key(struct airo_info *ai, u16 index) {
+static int get_wep_key(struct airo_info *ai, u16 index, char *buf, u16 buflen)
+{
        WepKeyRid wkr;
        int rc;
        __le16 lastindex;
 
        rc = readWepKeyRid(ai, &wkr, 1, 1);
-       if (rc == SUCCESS) do {
+       if (rc != SUCCESS)
+               return -1;
+       do {
                lastindex = wkr.kindex;
-               if (wkr.kindex == cpu_to_le16(index)) {
-                       if (index == 0xffff) {
-                               return wkr.mac[0];
-                       }
-                       return le16_to_cpu(wkr.klen);
+               if (le16_to_cpu(wkr.kindex) == index) {
+                       int klen = min_t(int, buflen, le16_to_cpu(wkr.klen));
+                       memcpy(buf, wkr.key, klen);
+                       return klen;
                }
-               readWepKeyRid(ai, &wkr, 0, 1);
+               rc = readWepKeyRid(ai, &wkr, 0, 1);
+               if (rc != SUCCESS)
+                       return -1;
        } while (lastindex != wkr.kindex);
        return -1;
 }
 
-static int set_wep_key(struct airo_info *ai, u16 index,
-                      const char *key, u16 keylen, int perm, int lock )
+static int get_wep_tx_idx(struct airo_info *ai)
+{
+       WepKeyRid wkr;
+       int rc;
+       __le16 lastindex;
+
+       rc = readWepKeyRid(ai, &wkr, 1, 1);
+       if (rc != SUCCESS)
+               return -1;
+       do {
+               lastindex = wkr.kindex;
+               if (wkr.kindex == cpu_to_le16(0xffff))
+                       return wkr.mac[0];
+               rc = readWepKeyRid(ai, &wkr, 0, 1);
+               if (rc != SUCCESS)
+                       return -1;
+       } while (lastindex != wkr.kindex);
+       return -1;
+}
+
+static int set_wep_key(struct airo_info *ai, u16 index, const char *key,
+                      u16 keylen, int perm, int lock)
 {
        static const unsigned char macaddr[ETH_ALEN] = { 0x01, 0, 0, 0, 0, 0 };
        WepKeyRid wkr;
+       int rc;
 
-       memset(&wkr, 0, sizeof(wkr));
        if (keylen == 0) {
-// We are selecting which key to use
-               wkr.len = cpu_to_le16(sizeof(wkr));
-               wkr.kindex = cpu_to_le16(0xffff);
-               wkr.mac[0] = (char)index;
-               if (perm) ai->defindex = (char)index;
-       } else {
-// We are actually setting the key
-               wkr.len = cpu_to_le16(sizeof(wkr));
-               wkr.kindex = cpu_to_le16(index);
-               wkr.klen = cpu_to_le16(keylen);
-               memcpy( wkr.key, key, keylen );
-               memcpy( wkr.mac, macaddr, ETH_ALEN );
+               airo_print_err(ai->dev->name, "%s: key length to set was zero",
+                              __func__);
+               return -1;
        }
 
+       memset(&wkr, 0, sizeof(wkr));
+       wkr.len = cpu_to_le16(sizeof(wkr));
+       wkr.kindex = cpu_to_le16(index);
+       wkr.klen = cpu_to_le16(keylen);
+       memcpy(wkr.key, key, keylen);
+       memcpy(wkr.mac, macaddr, ETH_ALEN);
+
        if (perm) disable_MAC(ai, lock);
-       writeWepKeyRid(ai, &wkr, perm, lock);
+       rc = writeWepKeyRid(ai, &wkr, perm, lock);
        if (perm) enable_MAC(ai, lock);
-       return 0;
+       return rc;
+}
+
+static int set_wep_tx_idx(struct airo_info *ai, u16 index, int perm, int lock)
+{
+       WepKeyRid wkr;
+       int rc;
+
+       memset(&wkr, 0, sizeof(wkr));
+       wkr.len = cpu_to_le16(sizeof(wkr));
+       wkr.kindex = cpu_to_le16(0xffff);
+       wkr.mac[0] = (char)index;
+
+       if (perm) {
+               ai->defindex = (char)index;
+               disable_MAC(ai, lock);
+       }
+
+       rc = writeWepKeyRid(ai, &wkr, perm, lock);
+
+       if (perm)
+               enable_MAC(ai, lock);
+       return rc;
 }
 
 static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
@@ -5187,7 +5271,7 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
        struct proc_dir_entry *dp = PDE(inode);
        struct net_device *dev = dp->data;
        struct airo_info *ai = dev->ml_priv;
-       int i;
+       int i, rc;
        char key[16];
        u16 index = 0;
        int j = 0;
@@ -5201,7 +5285,12 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
            (data->wbuffer[1] == ' ' || data->wbuffer[1] == '\n')) {
                index = data->wbuffer[0] - '0';
                if (data->wbuffer[1] == '\n') {
-                       set_wep_key(ai, index, NULL, 0, 1, 1);
+                       rc = set_wep_tx_idx(ai, index, 1, 1);
+                       if (rc < 0) {
+                               airo_print_err(ai->dev->name, "failed to set "
+                                              "WEP transmit index to %d: %d.",
+                                              index, rc);
+                       }
                        return;
                }
                j = 2;
@@ -5220,7 +5309,12 @@ static void proc_wepkey_on_close( struct inode *inode, struct file *file ) {
                        break;
                }
        }
-       set_wep_key(ai, index, key, i/3, 1, 1);
+
+       rc = set_wep_key(ai, index, key, i/3, 1, 1);
+       if (rc < 0) {
+               airo_print_err(ai->dev->name, "failed to set WEP key at index "
+                              "%d: %d.", index, rc);
+       }
 }
 
 static int proc_wepkey_open( struct inode *inode, struct file *file )
@@ -5451,13 +5545,13 @@ static void timer_func( struct net_device *dev ) {
                        break;
                case AUTH_SHAREDKEY:
                        if (apriv->keyindex < auto_wep) {
-                               set_wep_key(apriv, apriv->keyindex, NULL, 0, 0, 0);
+                               set_wep_tx_idx(apriv, apriv->keyindex, 0, 0);
                                apriv->config.authType = AUTH_SHAREDKEY;
                                apriv->keyindex++;
                        } else {
                                /* Drop to ENCRYPT */
                                apriv->keyindex = 0;
-                               set_wep_key(apriv, apriv->defindex, NULL, 0, 0, 0);
+                               set_wep_tx_idx(apriv, apriv->defindex, 0, 0);
                                apriv->config.authType = AUTH_ENCRYPT;
                        }
                        break;
@@ -5725,16 +5819,12 @@ static int airo_set_freq(struct net_device *dev,
        int rc = -EINPROGRESS;          /* Call commit handler */
 
        /* If setting by frequency, convert to a channel */
-       if((fwrq->e == 1) &&
-          (fwrq->m >= (int) 2.412e8) &&
-          (fwrq->m <= (int) 2.487e8)) {
+       if(fwrq->e == 1) {
                int f = fwrq->m / 100000;
-               int c = 0;
-               while((c < 14) && (f != frequency_list[c]))
-                       c++;
+
                /* Hack to fall through... */
                fwrq->e = 0;
-               fwrq->m = c + 1;
+               fwrq->m = ieee80211_freq_to_dsss_chan(f);
        }
        /* Setting by channel number */
        if((fwrq->m > 1000) || (fwrq->e > 0))
@@ -5778,7 +5868,7 @@ static int airo_get_freq(struct net_device *dev,
 
        ch = le16_to_cpu(status_rid.channel);
        if((ch > 0) && (ch < 15)) {
-               fwrq->m = frequency_list[ch - 1] * 100000;
+               fwrq->m = ieee80211_dsss_chan_to_freq(ch) * 100000;
                fwrq->e = 1;
        } else {
                fwrq->m = ch;
@@ -6234,11 +6324,9 @@ static int airo_get_mode(struct net_device *dev,
        return 0;
 }
 
-static inline int valid_index(CapabilityRid *p, int index)
+static inline int valid_index(struct airo_info *ai, int index)
 {
-       if (index < 0)
-               return 0;
-       return index < (p->softCap & cpu_to_le16(0x80) ? 4 : 1);
+       return (index >= 0) && (index <= ai->max_wep_idx);
 }
 
 /*------------------------------------------------------------------*/
@@ -6251,16 +6339,13 @@ static int airo_set_encode(struct net_device *dev,
                           char *extra)
 {
        struct airo_info *local = dev->ml_priv;
-       CapabilityRid cap_rid;          /* Card capability info */
-       int perm = ( dwrq->flags & IW_ENCODE_TEMP ? 0 : 1 );
+       int perm = (dwrq->flags & IW_ENCODE_TEMP ? 0 : 1);
        __le16 currentAuthType = local->config.authType;
+       int rc = 0;
 
-       /* Is WEP supported ? */
-       readCapabilityRid(local, &cap_rid, 1);
-       /* Older firmware doesn't support this...
-       if(!(cap_rid.softCap & cpu_to_le16(2))) {
+       if (!local->wep_capable)
                return -EOPNOTSUPP;
-       } */
+
        readConfigRid(local, 1);
 
        /* Basic checking: do we have a key to set ?
@@ -6272,14 +6357,21 @@ static int airo_set_encode(struct net_device *dev,
        if (dwrq->length > 0) {
                wep_key_t key;
                int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
-               int current_index = get_wep_key(local, 0xffff);
+               int current_index;
+
                /* Check the size of the key */
                if (dwrq->length > MAX_KEY_SIZE) {
                        return -EINVAL;
                }
+
+               current_index = get_wep_tx_idx(local);
+               if (current_index < 0)
+                       current_index = 0;
+
                /* Check the index (none -> use current) */
-               if (!valid_index(&cap_rid, index))
+               if (!valid_index(local, index))
                        index = current_index;
+
                /* Set the length */
                if (dwrq->length > MIN_KEY_SIZE)
                        key.len = MAX_KEY_SIZE;
@@ -6296,7 +6388,13 @@ static int airo_set_encode(struct net_device *dev,
                        /* Copy the key in the driver */
                        memcpy(key.key, extra, dwrq->length);
                        /* Send the key to the card */
-                       set_wep_key(local, index, key.key, key.len, perm, 1);
+                       rc = set_wep_key(local, index, key.key, key.len, perm, 1);
+                       if (rc < 0) {
+                               airo_print_err(local->dev->name, "failed to set"
+                                              " WEP key at index %d: %d.",
+                                              index, rc);
+                               return rc;
+                       }
                }
                /* WE specify that if a valid key is set, encryption
                 * should be enabled (user may turn it off later)
@@ -6308,12 +6406,19 @@ static int airo_set_encode(struct net_device *dev,
        } else {
                /* Do we want to just set the transmit key index ? */
                int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
-               if (valid_index(&cap_rid, index)) {
-                       set_wep_key(local, index, NULL, 0, perm, 1);
-               } else
+               if (valid_index(local, index)) {
+                       rc = set_wep_tx_idx(local, index, perm, 1);
+                       if (rc < 0) {
+                               airo_print_err(local->dev->name, "failed to set"
+                                              " WEP transmit index to %d: %d.",
+                                              index, rc);
+                               return rc;
+                       }
+               } else {
                        /* Don't complain if only change the mode */
                        if (!(dwrq->flags & IW_ENCODE_MODE))
                                return -EINVAL;
+               }
        }
        /* Read the flags */
        if(dwrq->flags & IW_ENCODE_DISABLED)
@@ -6339,14 +6444,13 @@ static int airo_get_encode(struct net_device *dev,
 {
        struct airo_info *local = dev->ml_priv;
        int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
-       CapabilityRid cap_rid;          /* Card capability info */
+       u8 buf[16];
 
-       /* Is it supported ? */
-       readCapabilityRid(local, &cap_rid, 1);
-       if(!(cap_rid.softCap & cpu_to_le16(2))) {
+       if (!local->wep_capable)
                return -EOPNOTSUPP;
-       }
+
        readConfigRid(local, 1);
+
        /* Check encryption mode */
        switch(local->config.authType)  {
                case AUTH_ENCRYPT:
@@ -6365,14 +6469,17 @@ static int airo_get_encode(struct net_device *dev,
        memset(extra, 0, 16);
 
        /* Which key do we want ? -1 -> tx index */
-       if (!valid_index(&cap_rid, index))
-               index = get_wep_key(local, 0xffff);
+       if (!valid_index(local, index)) {
+               index = get_wep_tx_idx(local);
+               if (index < 0)
+                       index = 0;
+       }
        dwrq->flags |= index + 1;
+
        /* Copy the key to the user buffer */
-       dwrq->length = get_wep_key(local, index);
-       if (dwrq->length > 16) {
-               dwrq->length=0;
-       }
+       dwrq->length = get_wep_key(local, index, &buf[0], sizeof(buf));
+       memcpy(extra, buf, dwrq->length);
+
        return 0;
 }
 
@@ -6388,28 +6495,27 @@ static int airo_set_encodeext(struct net_device *dev,
        struct airo_info *local = dev->ml_priv;
        struct iw_point *encoding = &wrqu->encoding;
        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
-       CapabilityRid cap_rid;          /* Card capability info */
        int perm = ( encoding->flags & IW_ENCODE_TEMP ? 0 : 1 );
        __le16 currentAuthType = local->config.authType;
-       int idx, key_len, alg = ext->alg, set_key = 1;
+       int idx, key_len, alg = ext->alg, set_key = 1, rc;
        wep_key_t key;
 
-       /* Is WEP supported ? */
-       readCapabilityRid(local, &cap_rid, 1);
-       /* Older firmware doesn't support this...
-       if(!(cap_rid.softCap & cpu_to_le16(2))) {
+       if (!local->wep_capable)
                return -EOPNOTSUPP;
-       } */
+
        readConfigRid(local, 1);
 
        /* Determine and validate the key index */
        idx = encoding->flags & IW_ENCODE_INDEX;
        if (idx) {
-               if (!valid_index(&cap_rid, idx - 1))
+               if (!valid_index(local, idx - 1))
                        return -EINVAL;
                idx--;
-       } else
-               idx = get_wep_key(local, 0xffff);
+       } else {
+               idx = get_wep_tx_idx(local);
+               if (idx < 0)
+                       idx = 0;
+       }
 
        if (encoding->flags & IW_ENCODE_DISABLED)
                alg = IW_ENCODE_ALG_NONE;
@@ -6418,7 +6524,13 @@ static int airo_set_encodeext(struct net_device *dev,
                /* Only set transmit key index here, actual
                 * key is set below if needed.
                 */
-               set_wep_key(local, idx, NULL, 0, perm, 1);
+               rc = set_wep_tx_idx(local, idx, perm, 1);
+               if (rc < 0) {
+                       airo_print_err(local->dev->name, "failed to set "
+                                      "WEP transmit index to %d: %d.",
+                                      idx, rc);
+                       return rc;
+               }
                set_key = ext->key_len > 0 ? 1 : 0;
        }
 
@@ -6444,7 +6556,12 @@ static int airo_set_encodeext(struct net_device *dev,
                        return -EINVAL;
                }
                /* Send the key to the card */
-               set_wep_key(local, idx, key.key, key.len, perm, 1);
+               rc = set_wep_key(local, idx, key.key, key.len, perm, 1);
+               if (rc < 0) {
+                       airo_print_err(local->dev->name, "failed to set WEP key"
+                                      " at index %d: %d.", idx, rc);
+                       return rc;
+               }
        }
 
        /* Read the flags */
@@ -6474,14 +6591,12 @@ static int airo_get_encodeext(struct net_device *dev,
        struct airo_info *local = dev->ml_priv;
        struct iw_point *encoding = &wrqu->encoding;
        struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
-       CapabilityRid cap_rid;          /* Card capability info */
        int idx, max_key_len;
+       u8 buf[16];
 
-       /* Is it supported ? */
-       readCapabilityRid(local, &cap_rid, 1);
-       if(!(cap_rid.softCap & cpu_to_le16(2))) {
+       if (!local->wep_capable)
                return -EOPNOTSUPP;
-       }
+
        readConfigRid(local, 1);
 
        max_key_len = encoding->length - sizeof(*ext);
@@ -6490,11 +6605,14 @@ static int airo_get_encodeext(struct net_device *dev,
 
        idx = encoding->flags & IW_ENCODE_INDEX;
        if (idx) {
-               if (!valid_index(&cap_rid, idx - 1))
+               if (!valid_index(local, idx - 1))
                        return -EINVAL;
                idx--;
-       } else
-               idx = get_wep_key(local, 0xffff);
+       } else {
+               idx = get_wep_tx_idx(local);
+               if (idx < 0)
+                       idx = 0;
+       }
 
        encoding->flags = idx + 1;
        memset(ext, 0, sizeof(*ext));
@@ -6517,10 +6635,8 @@ static int airo_get_encodeext(struct net_device *dev,
        memset(extra, 0, 16);
        
        /* Copy the key to the user buffer */
-       ext->key_len = get_wep_key(local, idx);
-       if (ext->key_len > 16) {
-               ext->key_len=0;
-       }
+       ext->key_len = get_wep_key(local, idx, &buf[0], sizeof(buf));
+       memcpy(extra, buf, ext->key_len);
 
        return 0;
 }
@@ -6795,8 +6911,8 @@ static int airo_get_range(struct net_device *dev,
        k = 0;
        for(i = 0; i < 14; i++) {
                range->freq[k].i = i + 1; /* List index */
-               range->freq[k].m = frequency_list[i] * 100000;
-               range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */
+               range->freq[k].m = ieee80211_dsss_chan_to_freq(i + 1) * 100000;
+               range->freq[k++].e = 1; /* Values in MHz -> * 10^5 * 10 */
        }
        range->num_frequency = k;
 
@@ -7189,10 +7305,7 @@ static inline char *airo_translate_scan(struct net_device *dev,
        /* Add frequency */
        iwe.cmd = SIOCGIWFREQ;
        iwe.u.freq.m = le16_to_cpu(bss->dsChannel);
-       /* iwe.u.freq.m containt the channel (starting 1), our 
-        * frequency_list array start at index 0...
-        */
-       iwe.u.freq.m = frequency_list[iwe.u.freq.m - 1] * 100000;
+       iwe.u.freq.m = ieee80211_dsss_chan_to_freq(iwe.u.freq.m) * 100000;
        iwe.u.freq.e = 1;
        current_ev = iwe_stream_add_event(info, current_ev, end_buf,
                                          &iwe, IW_EV_FREQ_LEN);
index 183ffc8e62cadc4b6b78c339d7a8ec0c4febf481..b9af2b84c05f4bbe4810285aaca3ea6a5f81d0b8 100644 (file)
 #define AR5K_INI_VAL_XR                        0
 #define AR5K_INI_VAL_MAX               5
 
-#define AR5K_RF5111_INI_RF_MAX_BANKS   AR5K_MAX_RF_BANKS
-#define AR5K_RF5112_INI_RF_MAX_BANKS   AR5K_MAX_RF_BANKS
-
 /* Used for BSSID etc manipulation */
 #define AR5K_LOW_ID(_a)(                               \
 (_a)[0] | (_a)[1] << 8 | (_a)[2] << 16 | (_a)[3] << 24 \
 #endif
 
 /* Initial values */
+#define        AR5K_INIT_CYCRSSI_THR1                  2
 #define AR5K_INIT_TX_LATENCY                   502
 #define AR5K_INIT_USEC                         39
 #define AR5K_INIT_USEC_TURBO                   79
@@ -316,7 +314,7 @@ struct ath5k_srev_name {
 #define AR5K_SREV_AR5424       0x90 /* Condor */
 #define AR5K_SREV_AR5413       0xa4 /* Eagle lite */
 #define AR5K_SREV_AR5414       0xa0 /* Eagle */
-#define AR5K_SREV_AR2415       0xb0 /* Cobra */
+#define AR5K_SREV_AR2415       0xb0 /* Talon */
 #define AR5K_SREV_AR5416       0xc0 /* PCI-E */
 #define AR5K_SREV_AR5418       0xca /* PCI-E */
 #define AR5K_SREV_AR2425       0xe0 /* Swan */
@@ -334,7 +332,7 @@ struct ath5k_srev_name {
 #define        AR5K_SREV_RAD_2112B     0x46
 #define AR5K_SREV_RAD_2413     0x50
 #define AR5K_SREV_RAD_5413     0x60
-#define AR5K_SREV_RAD_2316     0x70
+#define AR5K_SREV_RAD_2316     0x70 /* Cobra SoC */
 #define AR5K_SREV_RAD_2317     0x80
 #define AR5K_SREV_RAD_5424     0xa0 /* Mostly same as 5413 */
 #define AR5K_SREV_RAD_2425     0xa2
@@ -342,7 +340,8 @@ struct ath5k_srev_name {
 
 #define AR5K_SREV_PHY_5211     0x30
 #define AR5K_SREV_PHY_5212     0x41
-#define AR5K_SREV_PHY_2112B    0x43
+#define        AR5K_SREV_PHY_5212A     0x42
+#define AR5K_SREV_PHY_5212B    0x43
 #define AR5K_SREV_PHY_2413     0x45
 #define AR5K_SREV_PHY_5413     0x61
 #define AR5K_SREV_PHY_2425     0x70
@@ -649,49 +648,21 @@ struct ath5k_beacon_state {
 
 enum ath5k_rfgain {
        AR5K_RFGAIN_INACTIVE = 0,
+       AR5K_RFGAIN_ACTIVE,
        AR5K_RFGAIN_READ_REQUESTED,
        AR5K_RFGAIN_NEED_CHANGE,
 };
 
-#define AR5K_GAIN_CRN_FIX_BITS_5111            4
-#define AR5K_GAIN_CRN_FIX_BITS_5112            7
-#define AR5K_GAIN_CRN_MAX_FIX_BITS             AR5K_GAIN_CRN_FIX_BITS_5112
-#define AR5K_GAIN_DYN_ADJUST_HI_MARGIN         15
-#define AR5K_GAIN_DYN_ADJUST_LO_MARGIN         20
-#define AR5K_GAIN_CCK_PROBE_CORR               5
-#define AR5K_GAIN_CCK_OFDM_GAIN_DELTA          15
-#define AR5K_GAIN_STEP_COUNT                   10
-#define AR5K_GAIN_PARAM_TX_CLIP                        0
-#define AR5K_GAIN_PARAM_PD_90                  1
-#define AR5K_GAIN_PARAM_PD_84                  2
-#define AR5K_GAIN_PARAM_GAIN_SEL               3
-#define AR5K_GAIN_PARAM_MIX_ORN                        0
-#define AR5K_GAIN_PARAM_PD_138                 1
-#define AR5K_GAIN_PARAM_PD_137                 2
-#define AR5K_GAIN_PARAM_PD_136                 3
-#define AR5K_GAIN_PARAM_PD_132                 4
-#define AR5K_GAIN_PARAM_PD_131                 5
-#define AR5K_GAIN_PARAM_PD_130                 6
-#define AR5K_GAIN_CHECK_ADJUST(_g)             \
-       ((_g)->g_current <= (_g)->g_low || (_g)->g_current >= (_g)->g_high)
-
-struct ath5k_gain_opt_step {
-       s16                             gos_param[AR5K_GAIN_CRN_MAX_FIX_BITS];
-       s32                             gos_gain;
-};
-
 struct ath5k_gain {
-       u32                     g_step_idx;
-       u32                     g_current;
-       u32                     g_target;
-       u32                     g_low;
-       u32                     g_high;
-       u32                     g_f_corr;
-       u32                     g_active;
-       const struct ath5k_gain_opt_step        *g_step;
+       u8                      g_step_idx;
+       u8                      g_current;
+       u8                      g_target;
+       u8                      g_low;
+       u8                      g_high;
+       u8                      g_f_corr;
+       u8                      g_state;
 };
 
-
 /********************\
   COMMON DEFINITIONS
 \********************/
@@ -1053,7 +1024,6 @@ struct ath5k_hw {
        bool                    ah_running;
        bool                    ah_single_chip;
        bool                    ah_combined_mic;
-       enum ath5k_rfgain       ah_rf_gain;
 
        u32                     ah_mac_srev;
        u16                     ah_mac_version;
@@ -1061,7 +1031,6 @@ struct ath5k_hw {
        u16                     ah_phy_revision;
        u16                     ah_radio_5ghz_revision;
        u16                     ah_radio_2ghz_revision;
-       u32                     ah_phy_spending;
 
        enum ath5k_version      ah_version;
        enum ath5k_radio        ah_radio;
@@ -1112,8 +1081,9 @@ struct ath5k_hw {
        u32                     ah_txq_isr;
        u32                     *ah_rf_banks;
        size_t                  ah_rf_banks_size;
+       size_t                  ah_rf_regs_count;
        struct ath5k_gain       ah_gain;
-       u32                     ah_offset[AR5K_MAX_RF_BANKS];
+       u                     ah_offset[AR5K_MAX_RF_BANKS];
 
        struct {
                u16             txp_pcdac[AR5K_EEPROM_POWER_TABLE_SIZE];
@@ -1186,6 +1156,7 @@ extern void ath5k_hw_update_mib_counters(struct ath5k_hw *ah, struct ieee80211_l
 /* EEPROM access functions */
 extern int ath5k_eeprom_init(struct ath5k_hw *ah);
 extern int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac);
+extern bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah);
 
 /* Protocol Control Unit Functions */
 extern int ath5k_hw_set_opmode(struct ath5k_hw *ah);
@@ -1206,6 +1177,7 @@ extern void ath5k_hw_set_rx_filter(struct ath5k_hw *ah, u32 filter);
 /* Beacon control functions */
 extern u32 ath5k_hw_get_tsf32(struct ath5k_hw *ah);
 extern u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah);
+extern void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64);
 extern void ath5k_hw_reset_tsf(struct ath5k_hw *ah);
 extern void ath5k_hw_init_beacon(struct ath5k_hw *ah, u32 next_beacon, u32 interval);
 #if 0
@@ -1260,10 +1232,12 @@ extern int ath5k_hw_disable_pspoll(struct ath5k_hw *ah);
 extern int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel);
 
 /* Initialize RF */
-extern int ath5k_hw_rfregs(struct ath5k_hw *ah, struct ieee80211_channel *channel, unsigned int mode);
-extern int ath5k_hw_rfgain(struct ath5k_hw *ah, unsigned int freq);
-extern enum ath5k_rfgain ath5k_hw_get_rf_gain(struct ath5k_hw *ah);
-extern int ath5k_hw_set_rfgain_opt(struct ath5k_hw *ah);
+extern int ath5k_hw_rfregs_init(struct ath5k_hw *ah,
+                               struct ieee80211_channel *channel,
+                               unsigned int mode);
+extern int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq);
+extern enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah);
+extern int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah);
 /* PHY/RF channel functions */
 extern bool ath5k_channel_ok(struct ath5k_hw *ah, u16 freq, unsigned int flags);
 extern int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel);
@@ -1285,6 +1259,7 @@ extern int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, unsigned int power);
 
 /*
  * Translate usec to hw clock units
+ * TODO: Half/quarter rate
  */
 static inline unsigned int ath5k_hw_htoclock(unsigned int usec, bool turbo)
 {
@@ -1293,6 +1268,7 @@ static inline unsigned int ath5k_hw_htoclock(unsigned int usec, bool turbo)
 
 /*
  * Translate hw clock units to usec
+ * TODO: Half/quarter rate
  */
 static inline unsigned int ath5k_hw_clocktoh(unsigned int clock, bool turbo)
 {
index dea378f767310818a289667b7b24441beab89713..05bc5cb44e881d3080b593ca864becffc24908d2 100644 (file)
@@ -169,7 +169,6 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
                ah->ah_single_chip = false;
                ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
                                                        CHANNEL_2GHZ);
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5111;
                break;
        case AR5K_SREV_RAD_5112:
        case AR5K_SREV_RAD_2112:
@@ -177,38 +176,31 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
                ah->ah_single_chip = false;
                ah->ah_radio_2ghz_revision = ath5k_hw_radio_revision(ah,
                                                        CHANNEL_2GHZ);
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5112;
                break;
        case AR5K_SREV_RAD_2413:
                ah->ah_radio = AR5K_RF2413;
                ah->ah_single_chip = true;
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
                break;
        case AR5K_SREV_RAD_5413:
                ah->ah_radio = AR5K_RF5413;
                ah->ah_single_chip = true;
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
                break;
        case AR5K_SREV_RAD_2316:
                ah->ah_radio = AR5K_RF2316;
                ah->ah_single_chip = true;
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2316;
                break;
        case AR5K_SREV_RAD_2317:
                ah->ah_radio = AR5K_RF2317;
                ah->ah_single_chip = true;
-               ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2317;
                break;
        case AR5K_SREV_RAD_5424:
                if (ah->ah_mac_version == AR5K_SREV_AR2425 ||
                ah->ah_mac_version == AR5K_SREV_AR2417){
                        ah->ah_radio = AR5K_RF2425;
                        ah->ah_single_chip = true;
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425;
                } else {
                        ah->ah_radio = AR5K_RF5413;
                        ah->ah_single_chip = true;
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
                }
                break;
        default:
@@ -227,29 +219,25 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
                        ah->ah_radio = AR5K_RF2425;
                        ah->ah_single_chip = true;
                        ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2425;
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2425;
                } else if (srev == AR5K_SREV_AR5213A &&
-               ah->ah_phy_revision == AR5K_SREV_PHY_2112B) {
+               ah->ah_phy_revision == AR5K_SREV_PHY_5212B) {
                        ah->ah_radio = AR5K_RF5112;
                        ah->ah_single_chip = false;
-                       ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2112B;
+                       ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5112B;
                } else if (ah->ah_mac_version == (AR5K_SREV_AR2415 >> 4)) {
                        ah->ah_radio = AR5K_RF2316;
                        ah->ah_single_chip = true;
                        ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2316;
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2316;
                } else if (ah->ah_mac_version == (AR5K_SREV_AR5414 >> 4) ||
                ah->ah_phy_revision == AR5K_SREV_PHY_5413) {
                        ah->ah_radio = AR5K_RF5413;
                        ah->ah_single_chip = true;
                        ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_5413;
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF5413;
                } else if (ah->ah_mac_version == (AR5K_SREV_AR2414 >> 4) ||
                ah->ah_phy_revision == AR5K_SREV_PHY_2413) {
                        ah->ah_radio = AR5K_RF2413;
                        ah->ah_single_chip = true;
                        ah->ah_radio_5ghz_revision = AR5K_SREV_RAD_2413;
-                       ah->ah_phy_spending = AR5K_PHY_SPENDING_RF2413;
                } else {
                        ATH5K_ERR(sc, "Couldn't identify radio revision.\n");
                        ret = -ENODEV;
@@ -331,7 +319,7 @@ struct ath5k_hw *ath5k_hw_attach(struct ath5k_softc *sc, u8 mac_version)
        ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
        ath5k_hw_set_opmode(ah);
 
-       ath5k_hw_set_rfgain_opt(ah);
+       ath5k_hw_rfgain_opt_init(ah);
 
        return ah;
 err_free:
index 1d77ee9d6e993225c74966b840d37607bde436ee..6837ca9f3831ab3bc2af2859a8687eddc1c6cf02 100644 (file)
@@ -232,13 +232,14 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
                int mc_count, struct dev_mc_list *mclist);
 static int ath5k_set_key(struct ieee80211_hw *hw,
                enum set_key_cmd cmd,
-               const u8 *local_addr, const u8 *addr,
+               struct ieee80211_vif *vif, struct ieee80211_sta *sta,
                struct ieee80211_key_conf *key);
 static int ath5k_get_stats(struct ieee80211_hw *hw,
                struct ieee80211_low_level_stats *stats);
 static int ath5k_get_tx_stats(struct ieee80211_hw *hw,
                struct ieee80211_tx_queue_stats *stats);
 static u64 ath5k_get_tsf(struct ieee80211_hw *hw);
+static void ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf);
 static void ath5k_reset_tsf(struct ieee80211_hw *hw);
 static int ath5k_beacon_update(struct ath5k_softc *sc,
                struct sk_buff *skb);
@@ -261,6 +262,7 @@ static struct ieee80211_ops ath5k_hw_ops = {
        .conf_tx        = NULL,
        .get_tx_stats   = ath5k_get_tx_stats,
        .get_tsf        = ath5k_get_tsf,
+       .set_tsf        = ath5k_set_tsf,
        .reset_tsf      = ath5k_reset_tsf,
        .bss_info_changed = ath5k_bss_info_changed,
 };
@@ -308,6 +310,19 @@ static inline void ath5k_txbuf_free(struct ath5k_softc *sc,
        bf->skb = NULL;
 }
 
+static inline void ath5k_rxbuf_free(struct ath5k_softc *sc,
+                               struct ath5k_buf *bf)
+{
+       BUG_ON(!bf);
+       if (!bf->skb)
+               return;
+       pci_unmap_single(sc->pdev, bf->skbaddr, sc->rxbufsize,
+                       PCI_DMA_FROMDEVICE);
+       dev_kfree_skb_any(bf->skb);
+       bf->skb = NULL;
+}
+
+
 /* Queues setup */
 static struct  ath5k_txq *ath5k_txq_setup(struct ath5k_softc *sc,
                                int qtype, int subtype);
@@ -347,9 +362,9 @@ static inline u64 ath5k_extend_tsf(struct ath5k_hw *ah, u32 rstamp)
 }
 
 /* Interrupt handling */
-static int     ath5k_init(struct ath5k_softc *sc, bool is_resume);
+static int     ath5k_init(struct ath5k_softc *sc);
 static int     ath5k_stop_locked(struct ath5k_softc *sc);
-static int     ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend);
+static int     ath5k_stop_hw(struct ath5k_softc *sc);
 static irqreturn_t ath5k_intr(int irq, void *dev_id);
 static void    ath5k_tasklet_reset(unsigned long data);
 
@@ -653,8 +668,6 @@ ath5k_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 
        ath5k_led_off(sc);
 
-       ath5k_stop_hw(sc, true);
-
        free_irq(pdev->irq, sc);
        pci_save_state(pdev);
        pci_disable_device(pdev);
@@ -689,14 +702,9 @@ ath5k_pci_resume(struct pci_dev *pdev)
                goto err_no_irq;
        }
 
-       err = ath5k_init(sc, true);
-       if (err)
-               goto err_irq;
        ath5k_led_enable(sc);
-
        return 0;
-err_irq:
-       free_irq(pdev->irq, sc);
+
 err_no_irq:
        pci_disable_device(pdev);
        return err;
@@ -1188,6 +1196,10 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
        struct ieee80211_rate *rate;
        unsigned int mrr_rate[3], mrr_tries[3];
        int i, ret;
+       u16 hw_rate;
+       u16 cts_rate = 0;
+       u16 duration = 0;
+       u8 rc_flags;
 
        flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK;
 
@@ -1195,11 +1207,30 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
        bf->skbaddr = pci_map_single(sc->pdev, skb->data, skb->len,
                        PCI_DMA_TODEVICE);
 
+       rate = ieee80211_get_tx_rate(sc->hw, info);
+
        if (info->flags & IEEE80211_TX_CTL_NO_ACK)
                flags |= AR5K_TXDESC_NOACK;
 
+       rc_flags = info->control.rates[0].flags;
+       hw_rate = (rc_flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) ?
+               rate->hw_value_short : rate->hw_value;
+
        pktlen = skb->len;
 
+       if (rc_flags & IEEE80211_TX_RC_USE_RTS_CTS) {
+               flags |= AR5K_TXDESC_RTSENA;
+               cts_rate = ieee80211_get_rts_cts_rate(sc->hw, info)->hw_value;
+               duration = le16_to_cpu(ieee80211_rts_duration(sc->hw,
+                       sc->vif, pktlen, info));
+       }
+       if (rc_flags & IEEE80211_TX_RC_USE_CTS_PROTECT) {
+               flags |= AR5K_TXDESC_CTSENA;
+               cts_rate = ieee80211_get_rts_cts_rate(sc->hw, info)->hw_value;
+               duration = le16_to_cpu(ieee80211_ctstoself_duration(sc->hw,
+                       sc->vif, pktlen, info));
+       }
+
        if (info->control.hw_key) {
                keyidx = info->control.hw_key->hw_key_idx;
                pktlen += info->control.hw_key->icv_len;
@@ -1207,8 +1238,9 @@ ath5k_txbuf_setup(struct ath5k_softc *sc, struct ath5k_buf *bf)
        ret = ah->ah_setup_tx_desc(ah, ds, pktlen,
                ieee80211_get_hdrlen_from_skb(skb), AR5K_PKT_TYPE_NORMAL,
                (sc->power_level * 2),
-               ieee80211_get_tx_rate(sc->hw, info)->hw_value,
-               info->control.rates[0].count, keyidx, 0, flags, 0, 0);
+               hw_rate,
+               info->control.rates[0].count, keyidx, 0, flags,
+               cts_rate, duration);
        if (ret)
                goto err_unmap;
 
@@ -1324,7 +1356,7 @@ ath5k_desc_free(struct ath5k_softc *sc, struct pci_dev *pdev)
        list_for_each_entry(bf, &sc->txbuf, list)
                ath5k_txbuf_free(sc, bf);
        list_for_each_entry(bf, &sc->rxbuf, list)
-               ath5k_txbuf_free(sc, bf);
+               ath5k_rxbuf_free(sc, bf);
 
        /* Free memory associated with all descriptors */
        pci_free_consistent(pdev, sc->desc_len, sc->desc, sc->desc_daddr);
@@ -2177,10 +2209,6 @@ ath5k_beacon_update_timers(struct ath5k_softc *sc, u64 bc_tsf)
  *
  * @sc: struct ath5k_softc pointer we are operating on
  *
- * When operating in station mode we want to receive a BMISS interrupt when we
- * stop seeing beacons from the AP we've associated with so we can look for
- * another AP to associate with.
- *
  * In IBSS mode we use a self-linked tx descriptor if possible. We enable SWBA
  * interrupts to detect TSF updates only.
  */
@@ -2193,9 +2221,7 @@ ath5k_beacon_config(struct ath5k_softc *sc)
        sc->bmisscount = 0;
        sc->imask &= ~(AR5K_INT_BMISS | AR5K_INT_SWBA);
 
-       if (sc->opmode == NL80211_IFTYPE_STATION) {
-               sc->imask |= AR5K_INT_BMISS;
-       } else if (sc->opmode == NL80211_IFTYPE_ADHOC ||
+       if (sc->opmode == NL80211_IFTYPE_ADHOC ||
                        sc->opmode == NL80211_IFTYPE_MESH_POINT ||
                        sc->opmode == NL80211_IFTYPE_AP) {
                /*
@@ -2228,18 +2254,13 @@ ath5k_beacon_config(struct ath5k_softc *sc)
 \********************/
 
 static int
-ath5k_init(struct ath5k_softc *sc, bool is_resume)
+ath5k_init(struct ath5k_softc *sc)
 {
        struct ath5k_hw *ah = sc->ah;
        int ret, i;
 
        mutex_lock(&sc->lock);
 
-       if (is_resume && !test_bit(ATH_STAT_STARTED, sc->status))
-               goto out_ok;
-
-       __clear_bit(ATH_STAT_STARTED, sc->status);
-
        ATH5K_DBG(sc, ATH5K_DEBUG_RESET, "mode %d\n", sc->opmode);
 
        /*
@@ -2271,15 +2292,12 @@ ath5k_init(struct ath5k_softc *sc, bool is_resume)
        for (i = 0; i < AR5K_KEYTABLE_SIZE; i++)
                ath5k_hw_reset_key(ah, i);
 
-       __set_bit(ATH_STAT_STARTED, sc->status);
-
        /* Set ack to be sent at low bit-rates */
        ath5k_hw_set_ack_bitrate_high(ah, false);
 
        mod_timer(&sc->calib_tim, round_jiffies(jiffies +
                        msecs_to_jiffies(ath5k_calinterval * 1000)));
 
-out_ok:
        ret = 0;
 done:
        mmiowb();
@@ -2334,7 +2352,7 @@ ath5k_stop_locked(struct ath5k_softc *sc)
  * stop is preempted).
  */
 static int
-ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend)
+ath5k_stop_hw(struct ath5k_softc *sc)
 {
        int ret;
 
@@ -2365,8 +2383,6 @@ ath5k_stop_hw(struct ath5k_softc *sc, bool is_suspend)
                }
        }
        ath5k_txbuf_free(sc, sc->bbuf);
-       if (!is_suspend)
-               __clear_bit(ATH_STAT_STARTED, sc->status);
 
        mmiowb();
        mutex_unlock(&sc->lock);
@@ -2457,6 +2473,7 @@ ath5k_intr(int irq, void *dev_id)
                                        | AR5K_INT_TXERR | AR5K_INT_TXEOL))
                                tasklet_schedule(&sc->txtq);
                        if (status & AR5K_INT_BMISS) {
+                               /* TODO */
                        }
                        if (status & AR5K_INT_MIB) {
                                /*
@@ -2496,7 +2513,7 @@ ath5k_calibrate(unsigned long data)
                ieee80211_frequency_to_channel(sc->curchan->center_freq),
                sc->curchan->hw_value);
 
-       if (ath5k_hw_get_rf_gain(ah) == AR5K_RFGAIN_NEED_CHANGE) {
+       if (ath5k_hw_gainf_calibrate(ah) == AR5K_RFGAIN_NEED_CHANGE) {
                /*
                 * Rfgain is out of bounds, reset the chip
                 * to load new gain values.
@@ -2619,6 +2636,17 @@ ath5k_init_leds(struct ath5k_softc *sc)
                sc->led_pin = 1;
                sc->led_on = 1;  /* active high */
        }
+       /*
+        * Pin 3 on Foxconn chips used in Acer Aspire One (0x105b:e008) and
+        * in emachines notebooks with AMBIT subsystem.
+        */
+       if (pdev->subsystem_vendor == PCI_VENDOR_ID_FOXCONN ||
+           pdev->subsystem_vendor == PCI_VENDOR_ID_AMBIT) {
+               __set_bit(ATH_STAT_LEDSOFT, sc->status);
+               sc->led_pin = 3;
+               sc->led_on = 0;  /* active low */
+       }
+
        if (!test_bit(ATH_STAT_LEDSOFT, sc->status))
                goto out;
 
@@ -2766,12 +2794,12 @@ ath5k_reset_wake(struct ath5k_softc *sc)
 
 static int ath5k_start(struct ieee80211_hw *hw)
 {
-       return ath5k_init(hw->priv, false);
+       return ath5k_init(hw->priv);
 }
 
 static void ath5k_stop(struct ieee80211_hw *hw)
 {
-       ath5k_stop_hw(hw->priv, false);
+       ath5k_stop_hw(hw->priv);
 }
 
 static int ath5k_add_interface(struct ieee80211_hw *hw,
@@ -2856,7 +2884,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
 {
        struct ath5k_softc *sc = hw->priv;
        struct ath5k_hw *ah = sc->ah;
-       int ret;
+       int ret = 0;
 
        mutex_lock(&sc->lock);
        if (sc->vif != vif) {
@@ -2882,9 +2910,7 @@ ath5k_config_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
                }
                ath5k_beacon_update(sc, beacon);
        }
-       mutex_unlock(&sc->lock);
 
-       return ath5k_reset_wake(sc);
 unlock:
        mutex_unlock(&sc->lock);
        return ret;
@@ -3020,8 +3046,8 @@ static void ath5k_configure_filter(struct ieee80211_hw *hw,
 
 static int
 ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-               const u8 *local_addr, const u8 *addr,
-               struct ieee80211_key_conf *key)
+             struct ieee80211_vif *vif, struct ieee80211_sta *sta,
+             struct ieee80211_key_conf *key)
 {
        struct ath5k_softc *sc = hw->priv;
        int ret = 0;
@@ -3044,7 +3070,8 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 
        switch (cmd) {
        case SET_KEY:
-               ret = ath5k_hw_set_key(sc->ah, key->keyidx, key, addr);
+               ret = ath5k_hw_set_key(sc->ah, key->keyidx, key,
+                                      sta ? sta->addr : NULL);
                if (ret) {
                        ATH5K_ERR(sc, "can't set the key\n");
                        goto unlock;
@@ -3103,6 +3130,14 @@ ath5k_get_tsf(struct ieee80211_hw *hw)
        return ath5k_hw_get_tsf64(sc->ah);
 }
 
+static void
+ath5k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
+{
+       struct ath5k_softc *sc = hw->priv;
+
+       ath5k_hw_set_tsf64(sc->ah, tsf);
+}
+
 static void
 ath5k_reset_tsf(struct ieee80211_hw *hw)
 {
index facc60ddada2824ceba476c8efcda1a66a398a1d..c0fb8b5c42fe75d783aac07fa9551658728a82ab 100644 (file)
@@ -148,8 +148,7 @@ struct ath5k_softc {
        u8                      bssidmask[ETH_ALEN];
 
        unsigned int            led_pin,        /* GPIO pin for driving LED */
-                               led_on,         /* pin setting for LED on */
-                               led_off;        /* off time for current blink */
+                               led_on;         /* pin setting for LED on */
 
        struct tasklet_struct   restq;          /* reset tasklet */
 
index 150f5ed204a01605a024703d5b8e9fb244e95a7a..367a6c7d3cc7dd493f93103ed980749011a158ad 100644 (file)
@@ -85,7 +85,8 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
                /* Enable  802.11b if a 2GHz capable radio (2111/5112) is
                 * connected */
                if (AR5K_EEPROM_HDR_11B(ee_header) ||
-                               AR5K_EEPROM_HDR_11G(ee_header)) {
+                   (AR5K_EEPROM_HDR_11G(ee_header) &&
+                    ah->ah_version != AR5K_AR5211)) {
                        /* 2312 */
                        ah->ah_capabilities.cap_range.range_2ghz_min = 2412;
                        ah->ah_capabilities.cap_range.range_2ghz_max = 2732;
@@ -94,7 +95,8 @@ int ath5k_hw_set_capabilities(struct ath5k_hw *ah)
                                __set_bit(AR5K_MODE_11B,
                                                ah->ah_capabilities.cap_mode);
 
-                       if (AR5K_EEPROM_HDR_11G(ee_header))
+                       if (AR5K_EEPROM_HDR_11G(ee_header) &&
+                           ah->ah_version != AR5K_AR5211)
                                __set_bit(AR5K_MODE_11G,
                                                ah->ah_capabilities.cap_mode);
                }
index ccaeb5c219d2ddda8ea8e7f160a8f9a472c8c89a..413ed689cd5fe177527bae6414b8ac7a23ac5740 100644 (file)
@@ -165,7 +165,7 @@ static int reg_show(struct seq_file *seq, void *p)
        return 0;
 }
 
-static struct seq_operations register_seq_ops = {
+static const struct seq_operations register_seq_ops = {
        .start = reg_start,
        .next  = reg_next,
        .stop  = reg_stop,
@@ -193,43 +193,6 @@ static const struct file_operations fops_registers = {
 };
 
 
-/* debugfs: TSF */
-
-static ssize_t read_file_tsf(struct file *file, char __user *user_buf,
-                                  size_t count, loff_t *ppos)
-{
-       struct ath5k_softc *sc = file->private_data;
-       char buf[100];
-       snprintf(buf, sizeof(buf), "0x%016llx\n",
-                (unsigned long long)ath5k_hw_get_tsf64(sc->ah));
-       return simple_read_from_buffer(user_buf, count, ppos, buf, 19);
-}
-
-static ssize_t write_file_tsf(struct file *file,
-                                const char __user *userbuf,
-                                size_t count, loff_t *ppos)
-{
-       struct ath5k_softc *sc = file->private_data;
-       char buf[20];
-
-       if (copy_from_user(buf, userbuf, min(count, sizeof(buf))))
-               return -EFAULT;
-
-       if (strncmp(buf, "reset", 5) == 0) {
-               ath5k_hw_reset_tsf(sc->ah);
-               printk(KERN_INFO "debugfs reset TSF\n");
-       }
-       return count;
-}
-
-static const struct file_operations fops_tsf = {
-       .read = read_file_tsf,
-       .write = write_file_tsf,
-       .open = ath5k_debugfs_open,
-       .owner = THIS_MODULE,
-};
-
-
 /* debugfs: beacons */
 
 static ssize_t read_file_beacon(struct file *file, char __user *user_buf,
@@ -423,9 +386,6 @@ ath5k_debug_init_device(struct ath5k_softc *sc)
        sc->debug.debugfs_registers = debugfs_create_file("registers", S_IRUGO,
                                sc->debug.debugfs_phydir, sc, &fops_registers);
 
-       sc->debug.debugfs_tsf = debugfs_create_file("tsf", S_IWUSR | S_IRUGO,
-                               sc->debug.debugfs_phydir, sc, &fops_tsf);
-
        sc->debug.debugfs_beacon = debugfs_create_file("beacon", S_IWUSR | S_IRUGO,
                                sc->debug.debugfs_phydir, sc, &fops_beacon);
 
@@ -444,7 +404,6 @@ ath5k_debug_finish_device(struct ath5k_softc *sc)
 {
        debugfs_remove(sc->debug.debugfs_debug);
        debugfs_remove(sc->debug.debugfs_registers);
-       debugfs_remove(sc->debug.debugfs_tsf);
        debugfs_remove(sc->debug.debugfs_beacon);
        debugfs_remove(sc->debug.debugfs_reset);
        debugfs_remove(sc->debug.debugfs_phydir);
index ffc529393306175cd0686f5c8da25099d74b0d10..66f69f04e55efbed331099d7b7fd5e26f0b61db1 100644 (file)
@@ -72,7 +72,6 @@ struct ath5k_dbg_info {
        struct dentry           *debugfs_phydir;
        struct dentry           *debugfs_debug;
        struct dentry           *debugfs_registers;
-       struct dentry           *debugfs_tsf;
        struct dentry           *debugfs_beacon;
        struct dentry           *debugfs_reset;
 };
index 1cb7edfae625cca6076f45d6b11afa8463ae47cb..a54ee7e4967b7b042575049f8058afb3309a919f 100644 (file)
@@ -137,6 +137,18 @@ ath5k_eeprom_init_header(struct ath5k_hw *ah)
        if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_0) {
                AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC0, ee_misc0);
                AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC1, ee_misc1);
+
+               /* XXX: Don't know which versions include these two */
+               AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC2, ee_misc2);
+
+               if (ee->ee_version >= AR5K_EEPROM_VERSION_4_3)
+                       AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC3, ee_misc3);
+
+               if (ee->ee_version >= AR5K_EEPROM_VERSION_5_0) {
+                       AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC4, ee_misc4);
+                       AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC5, ee_misc5);
+                       AR5K_EEPROM_READ_HDR(AR5K_EEPROM_MISC6, ee_misc6);
+               }
        }
 
        if (ah->ah_ee_version < AR5K_EEPROM_VERSION_3_3) {
@@ -192,7 +204,7 @@ static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset,
 
        /* Get antenna modes */
        ah->ah_antenna[mode][0] =
-           (ee->ee_ant_control[mode][0] << 4) | 0x1;
+           (ee->ee_ant_control[mode][0] << 4);
        ah->ah_antenna[mode][AR5K_ANT_FIXED_A] =
             ee->ee_ant_control[mode][1]        |
            (ee->ee_ant_control[mode][2] << 6)  |
@@ -213,7 +225,8 @@ static int ath5k_eeprom_read_ants(struct ath5k_hw *ah, u32 *offset,
 }
 
 /*
- * Read supported modes from eeprom
+ * Read supported modes and some mode-specific calibration data
+ * from eeprom
  */
 static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset,
                unsigned int mode)
@@ -315,6 +328,9 @@ static int ath5k_eeprom_read_modes(struct ath5k_hw *ah, u32 *offset,
        if (ah->ah_ee_version < AR5K_EEPROM_VERSION_4_0)
                goto done;
 
+       /* Note: >= v5 have bg freq piers on another location
+        * so these freq piers are ignored for >= v5 (should be 0xff
+        * anyway) */
        switch(mode) {
        case AR5K_EEPROM_MODE_11A:
                if (ah->ah_ee_version < AR5K_EEPROM_VERSION_4_1)
@@ -442,7 +458,7 @@ ath5k_eeprom_read_turbo_modes(struct ath5k_hw *ah,
        return 0;
 }
 
-
+/* Read mode-specific data (except power calibration data) */
 static int
 ath5k_eeprom_init_modes(struct ath5k_hw *ah)
 {
@@ -488,12 +504,22 @@ ath5k_eeprom_init_modes(struct ath5k_hw *ah)
        return 0;
 }
 
+/* Used to match PCDAC steps with power values on RF5111 chips
+ * (eeprom versions < 4). For RF5111 we have 10 pre-defined PCDAC
+ * steps that match with the power values we read from eeprom. On
+ * older eeprom versions (< 3.2) these steps are equaly spaced at
+ * 10% of the pcdac curve -until the curve reaches it's maximum-
+ * (10 steps from 0 to 100%) but on newer eeprom versions (>= 3.2)
+ * these 10 steps are spaced in a different way. This function returns
+ * the pcdac steps based on eeprom version and curve min/max so that we
+ * can have  pcdac/pwr points.
+ */
 static inline void
 ath5k_get_pcdac_intercepts(struct ath5k_hw *ah, u8 min, u8 max, u8 *vp)
 {
-       const static u16 intercepts3[] =
+       static const u16 intercepts3[] =
                { 0, 5, 10, 20, 30, 50, 70, 85, 90, 95, 100 };
-       const static u16 intercepts3_2[] =
+       static const u16 intercepts3_2[] =
                { 0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100 };
        const u16 *ip;
        int i;
@@ -507,37 +533,48 @@ ath5k_get_pcdac_intercepts(struct ath5k_hw *ah, u8 min, u8 max, u8 *vp)
                *vp++ = (ip[i] * max + (100 - ip[i]) * min) / 100;
 }
 
+/* Read the frequency piers for each mode (mostly used on newer eeproms with 0xff
+ * frequency mask) */
 static inline int
 ath5k_eeprom_read_freq_list(struct ath5k_hw *ah, int *offset, int max,
-                            struct ath5k_chan_pcal_info *pc, u8 *count)
+                       struct ath5k_chan_pcal_info *pc, unsigned int mode)
 {
+       struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
        int o = *offset;
        int i = 0;
-       u8 f1, f2;
+       u8 freq1, freq2;
        int ret;
        u16 val;
 
        while(i < max) {
                AR5K_EEPROM_READ(o++, val);
 
-               f1 = (val >> 8) & 0xff;
-               f2 = val & 0xff;
+               freq1 = (val >> 8) & 0xff;
+               freq2 = val & 0xff;
 
-               if (f1)
-                       pc[i++].freq = f1;
+               if (freq1) {
+                       pc[i++].freq = ath5k_eeprom_bin2freq(ee,
+                                       freq1, mode);
+                       ee->ee_n_piers[mode]++;
+               }
 
-               if (f2)
-                       pc[i++].freq = f2;
+               if (freq2) {
+                       pc[i++].freq = ath5k_eeprom_bin2freq(ee,
+                                       freq2, mode);
+                       ee->ee_n_piers[mode]++;
+               }
 
-               if (!f1 || !f2)
+               if (!freq1 || !freq2)
                        break;
        }
+
+       /* return new offset */
        *offset = o;
-       *count = i;
 
        return 0;
 }
 
+/* Read frequency piers for 802.11a */
 static int
 ath5k_eeprom_init_11a_pcal_freq(struct ath5k_hw *ah, int offset)
 {
@@ -550,7 +587,7 @@ ath5k_eeprom_init_11a_pcal_freq(struct ath5k_hw *ah, int offset)
        if (ee->ee_version >= AR5K_EEPROM_VERSION_3_3) {
                ath5k_eeprom_read_freq_list(ah, &offset,
                        AR5K_EEPROM_N_5GHZ_CHAN, pcal,
-                       &ee->ee_n_piers[AR5K_EEPROM_MODE_11A]);
+                       AR5K_EEPROM_MODE_11A);
        } else {
                mask = AR5K_EEPROM_FREQ_M(ah->ah_ee_version);
 
@@ -577,23 +614,25 @@ ath5k_eeprom_init_11a_pcal_freq(struct ath5k_hw *ah, int offset)
 
                AR5K_EEPROM_READ(offset++, val);
                pcal[9].freq |= (val >> 10) & 0x3f;
+
+               /* Fixed number of piers */
                ee->ee_n_piers[AR5K_EEPROM_MODE_11A] = 10;
-       }
 
-       for(i = 0; i < AR5K_EEPROM_N_5GHZ_CHAN; i += 1) {
-               pcal[i].freq = ath5k_eeprom_bin2freq(ee,
+               for (i = 0; i < AR5K_EEPROM_N_5GHZ_CHAN; i++) {
+                       pcal[i].freq = ath5k_eeprom_bin2freq(ee,
                                pcal[i].freq, AR5K_EEPROM_MODE_11A);
+               }
        }
 
        return 0;
 }
 
+/* Read frequency piers for 802.11bg on eeprom versions >= 5 and eemap >= 2 */
 static inline int
 ath5k_eeprom_init_11bg_2413(struct ath5k_hw *ah, unsigned int mode, int offset)
 {
        struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
        struct ath5k_chan_pcal_info *pcal;
-       int i;
 
        switch(mode) {
        case AR5K_EEPROM_MODE_11B:
@@ -608,23 +647,25 @@ ath5k_eeprom_init_11bg_2413(struct ath5k_hw *ah, unsigned int mode, int offset)
 
        ath5k_eeprom_read_freq_list(ah, &offset,
                AR5K_EEPROM_N_2GHZ_CHAN_2413, pcal,
-               &ee->ee_n_piers[mode]);
-       for(i = 0; i < AR5K_EEPROM_N_2GHZ_CHAN_2413; i += 1) {
-               pcal[i].freq = ath5k_eeprom_bin2freq(ee,
-                               pcal[i].freq, mode);
-       }
+               mode);
 
        return 0;
 }
 
-
+/* Read power calibration for RF5111 chips
+ * For RF5111 we have an XPD -eXternal Power Detector- curve
+ * for each calibrated channel. Each curve has PCDAC steps on
+ * x axis and power on y axis and looks like a logarithmic
+ * function. To recreate the curve and pass the power values
+ * on the pcdac table, we read 10 points here and interpolate later.
+ */
 static int
 ath5k_eeprom_read_pcal_info_5111(struct ath5k_hw *ah, int mode)
 {
        struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
        struct ath5k_chan_pcal_info *pcal;
        int offset, ret;
-       int i, j;
+       int i;
        u16 val;
 
        offset = AR5K_EEPROM_GROUPS_START(ee->ee_version);
@@ -704,16 +745,22 @@ ath5k_eeprom_read_pcal_info_5111(struct ath5k_hw *ah, int mode)
 
                ath5k_get_pcdac_intercepts(ah, cdata->pcdac_min,
                        cdata->pcdac_max, cdata->pcdac);
-
-               for (j = 0; j < AR5K_EEPROM_N_PCDAC; j++) {
-                       cdata->pwr[j] = (u16)
-                               (AR5K_EEPROM_POWER_STEP * cdata->pwr[j]);
-               }
        }
 
        return 0;
 }
 
+/* Read power calibration for RF5112 chips
+ * For RF5112 we have 4 XPD -eXternal Power Detector- curves
+ * for each calibrated channel on 0, -6, -12 and -18dbm but we only
+ * use the higher (3) and the lower (0) curves. Each curve has PCDAC
+ * steps on x axis and power on y axis and looks like a linear
+ * function. To recreate the curve and pass the power values
+ * on the pcdac table, we read 4 points for xpd 0 and 3 points
+ * for xpd 3 here and interpolate later.
+ *
+ * Note: Many vendors just use xpd 0 so xpd 3 is zeroed.
+ */
 static int
 ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
 {
@@ -790,7 +837,7 @@ ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
 
                /* PCDAC steps
                 * corresponding to the above power
-                * measurements (static) */
+                * measurements (fixed) */
                chan_pcal_info->pcdac_x3[0] = 20;
                chan_pcal_info->pcdac_x3[1] = 35;
                chan_pcal_info->pcdac_x3[2] = 63;
@@ -814,6 +861,13 @@ ath5k_eeprom_read_pcal_info_5112(struct ath5k_hw *ah, int mode)
        return 0;
 }
 
+/* For RF2413 power calibration data doesn't start on a fixed location and
+ * if a mode is not supported, it's section is missing -not zeroed-.
+ * So we need to calculate the starting offset for each section by using
+ * these two functions */
+
+/* Return the size of each section based on the mode and the number of pd
+ * gains available (maximum 4). */
 static inline unsigned int
 ath5k_pdgains_size_2413(struct ath5k_eeprom_info *ee, unsigned int mode)
 {
@@ -826,6 +880,8 @@ ath5k_pdgains_size_2413(struct ath5k_eeprom_info *ee, unsigned int mode)
        return sz;
 }
 
+/* Return the starting offset for a section based on the modes supported
+ * and each section's size. */
 static unsigned int
 ath5k_cal_data_offset_2413(struct ath5k_eeprom_info *ee, int mode)
 {
@@ -834,11 +890,13 @@ ath5k_cal_data_offset_2413(struct ath5k_eeprom_info *ee, int mode)
        switch(mode) {
        case AR5K_EEPROM_MODE_11G:
                if (AR5K_EEPROM_HDR_11B(ee->ee_header))
-                       offset += ath5k_pdgains_size_2413(ee, AR5K_EEPROM_MODE_11B) + 2;
+                       offset += ath5k_pdgains_size_2413(ee, AR5K_EEPROM_MODE_11B) +
+                                                       AR5K_EEPROM_N_2GHZ_CHAN_2413 / 2;
                /* fall through */
        case AR5K_EEPROM_MODE_11B:
                if (AR5K_EEPROM_HDR_11A(ee->ee_header))
-                       offset += ath5k_pdgains_size_2413(ee, AR5K_EEPROM_MODE_11A) + 5;
+                       offset += ath5k_pdgains_size_2413(ee, AR5K_EEPROM_MODE_11A) +
+                                                       AR5K_EEPROM_N_5GHZ_CHAN / 2;
                /* fall through */
        case AR5K_EEPROM_MODE_11A:
                break;
@@ -849,6 +907,17 @@ ath5k_cal_data_offset_2413(struct ath5k_eeprom_info *ee, int mode)
        return offset;
 }
 
+/* Read power calibration for RF2413 chips
+ * For RF2413 we have a PDDAC table (Power Detector) instead
+ * of a PCDAC and 4 pd gain curves for each calibrated channel.
+ * Each curve has PDDAC steps on x axis and power on y axis and
+ * looks like an exponential function. To recreate the curves
+ * we read here the points and interpolate later. Note that
+ * in most cases only higher and lower curves are used (like
+ * RF5112) but vendors have the oportunity to include all 4
+ * curves on eeprom. The final curve (higher power) has an extra
+ * point for better accuracy like RF5112.
+ */
 static int
 ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
 {
@@ -868,6 +937,7 @@ ath5k_eeprom_read_pcal_info_2413(struct ath5k_hw *ah, int mode)
        ee->ee_pd_gains[mode] = pd_gains;
 
        offset = ath5k_cal_data_offset_2413(ee, mode);
+       ee->ee_n_piers[mode] = 0;
        switch (mode) {
        case AR5K_EEPROM_MODE_11A:
                if (!AR5K_EEPROM_HDR_11A(ee->ee_header))
@@ -1163,6 +1233,20 @@ static int ath5k_eeprom_read_target_rate_pwr_info(struct ath5k_hw *ah, unsigned
        return 0;
 }
 
+/*
+ * Read per channel calibration info from EEPROM
+ *
+ * This info is used to calibrate the baseband power table. Imagine
+ * that for each channel there is a power curve that's hw specific
+ * (depends on amplifier etc) and we try to "correct" this curve using
+ * offests we pass on to phy chip (baseband -> before amplifier) so that
+ * it can use accurate power values when setting tx power (takes amplifier's
+ * performance on each channel into account).
+ *
+ * EEPROM provides us with the offsets for some pre-calibrated channels
+ * and we have to interpolate to create the full table for these channels and
+ * also the table for any channel.
+ */
 static int
 ath5k_eeprom_read_pcal_info(struct ath5k_hw *ah)
 {
@@ -1193,7 +1277,7 @@ ath5k_eeprom_read_pcal_info(struct ath5k_hw *ah)
        return 0;
 }
 
-/* Read conformance test limits */
+/* Read conformance test limits used for regulatory control */
 static int
 ath5k_eeprom_read_ctl_info(struct ath5k_hw *ah)
 {
@@ -1328,6 +1412,7 @@ ath5k_eeprom_init(struct ath5k_hw *ah)
 
        return 0;
 }
+
 /*
  * Read the MAC address from eeprom
  */
@@ -1364,3 +1449,14 @@ int ath5k_eeprom_read_mac(struct ath5k_hw *ah, u8 *mac)
        return 0;
 }
 
+bool ath5k_eeprom_is_hb63(struct ath5k_hw *ah)
+{
+       u16 data;
+
+       ath5k_hw_eeprom_read(ah, AR5K_EEPROM_IS_HB63, &data);
+
+       if ((ah->ah_mac_version == (AR5K_SREV_AR2425 >> 4)) && data)
+               return true;
+       else
+               return false;
+}
index 09eb7d0176a4e93dad5b9691bb03e7fa2025a757..1deebc0257d40d63d44346d5dbb19b31cbb518af 100644 (file)
@@ -25,6 +25,7 @@
 #define AR5K_EEPROM_MAGIC_5211         0x0000145b /* 5211 */
 #define AR5K_EEPROM_MAGIC_5210         0x0000145a /* 5210 */
 
+#define        AR5K_EEPROM_IS_HB63             0x000b  /* Talon detect */
 #define AR5K_EEPROM_REG_DOMAIN         0x00bf  /* EEPROM regdom */
 #define AR5K_EEPROM_CHECKSUM           0x00c0  /* EEPROM checksum */
 #define AR5K_EEPROM_INFO_BASE          0x00c0  /* EEPROM header */
index b77205adc18025278f06d5adc84ee694a5fea03f..64a27e73d02ed6f87cc9299ea78aa56603ad5a58 100644 (file)
@@ -83,7 +83,7 @@ void ath5k_hw_set_ledstate(struct ath5k_hw *ah, unsigned int state)
 int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio)
 {
        ATH5K_TRACE(ah->ah_sc);
-       if (gpio > AR5K_NUM_GPIO)
+       if (gpio >= AR5K_NUM_GPIO)
                return -EINVAL;
 
        ath5k_hw_reg_write(ah,
@@ -99,7 +99,7 @@ int ath5k_hw_set_gpio_input(struct ath5k_hw *ah, u32 gpio)
 int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio)
 {
        ATH5K_TRACE(ah->ah_sc);
-       if (gpio > AR5K_NUM_GPIO)
+       if (gpio >= AR5K_NUM_GPIO)
                return -EINVAL;
 
        ath5k_hw_reg_write(ah,
@@ -115,7 +115,7 @@ int ath5k_hw_set_gpio_output(struct ath5k_hw *ah, u32 gpio)
 u32 ath5k_hw_get_gpio(struct ath5k_hw *ah, u32 gpio)
 {
        ATH5K_TRACE(ah->ah_sc);
-       if (gpio > AR5K_NUM_GPIO)
+       if (gpio >= AR5K_NUM_GPIO)
                return 0xffffffff;
 
        /* GPIO input magic */
@@ -131,7 +131,7 @@ int ath5k_hw_set_gpio(struct ath5k_hw *ah, u32 gpio, u32 val)
        u32 data;
        ATH5K_TRACE(ah->ah_sc);
 
-       if (gpio > AR5K_NUM_GPIO)
+       if (gpio >= AR5K_NUM_GPIO)
                return -EINVAL;
 
        /* GPIO output magic */
@@ -154,7 +154,7 @@ void ath5k_hw_set_gpio_intr(struct ath5k_hw *ah, unsigned int gpio,
        u32 data;
 
        ATH5K_TRACE(ah->ah_sc);
-       if (gpio > AR5K_NUM_GPIO)
+       if (gpio >= AR5K_NUM_GPIO)
                return;
 
        /*
index 450bd6e945ff152d76d411b7380b38fb84f4baa7..44886434187bc702293f668533851b78e1ece1d0 100644 (file)
@@ -2,7 +2,7 @@
  * Initial register settings functions
  *
  * Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org>
- * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com>
+ * Copyright (c) 2006-2009 Nick Kossifidis <mickflemm@gmail.com>
  * Copyright (c) 2007-2008 Jiri Slaby <jirislaby@gmail.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
@@ -340,7 +340,7 @@ static const struct ath5k_ini ar5211_ini[] = {
         * common on all cards/modes.
         * Note: Table is rewritten during
         * txpower setup later using calibration
-        * data etc. so next write is non-common
+        * data etc. so next write is non-common */
        { AR5K_PHY_PCDAC_TXPOWER(1), 0x06ff05ff },
        { AR5K_PHY_PCDAC_TXPOWER(2), 0x07ff07ff },
        { AR5K_PHY_PCDAC_TXPOWER(3), 0x08ff08ff },
@@ -371,7 +371,7 @@ static const struct ath5k_ini ar5211_ini[] = {
        { AR5K_PHY_PCDAC_TXPOWER(28), 0x3aff3aff },
        { AR5K_PHY_PCDAC_TXPOWER(29), 0x3aff3aff },
        { AR5K_PHY_PCDAC_TXPOWER(30), 0x3aff3aff },
-       { AR5K_PHY_PCDAC_TXPOWER(31), 0x3aff3aff },*/
+       { AR5K_PHY_PCDAC_TXPOWER(31), 0x3aff3aff },
        { AR5K_PHY_CCKTXCTL, 0x00000000 },
        { AR5K_PHY(642), 0x503e4646 },
        { AR5K_PHY_GAIN_2GHZ, 0x6480416c },
@@ -386,85 +386,85 @@ static const struct ath5k_ini ar5211_ini[] = {
 };
 
 /* Initial mode-specific settings for AR5211
- * XXX: how about g / gTurbo ? RF5111 supports it, how about AR5211 ?
- * Maybe 5211 supports OFDM-only g but we need to test it !
+ * 5211 supports OFDM-only g (draft g) but we
+ * need to test it !
  */
 static const struct ath5k_ini_mode ar5211_ini_mode[] = {
        { AR5K_TXCFG,
-       /*        a           aTurbo      b             */
-               { 0x00000015, 0x00000015, 0x0000001d } },
+       /*        a         aTurbo        b       g (OFDM)    */
+          { 0x00000015, 0x00000015, 0x0000001d, 0x00000015 } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(0),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(1),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(2),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(3),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(4),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(5),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(6),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(7),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(8),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(9),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f } },
        { AR5K_DCU_GBL_IFS_SLOT,
-               { 0x00000168, 0x000001e0, 0x000001b8 } },
+          { 0x00000168, 0x000001e0, 0x000001b8, 0x00000168 } },
        { AR5K_DCU_GBL_IFS_SIFS,
-               { 0x00000230, 0x000001e0, 0x000000b0 } },
+          { 0x00000230, 0x000001e0, 0x000000b0, 0x00000230 } },
        { AR5K_DCU_GBL_IFS_EIFS,
-               { 0x00000d98, 0x00001180, 0x00001f48 } },
+          { 0x00000d98, 0x00001180, 0x00001f48, 0x00000d98 } },
        { AR5K_DCU_GBL_IFS_MISC,
-               { 0x0000a0e0, 0x00014068, 0x00005880 } },
+          { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000a0e0 } },
        { AR5K_TIME_OUT,
-               { 0x04000400, 0x08000800, 0x20003000 } },
+          { 0x04000400, 0x08000800, 0x20003000, 0x04000400 } },
        { AR5K_USEC_5211,
-               { 0x0e8d8fa7, 0x0e8d8fcf, 0x01608f95 } },
+          { 0x0e8d8fa7, 0x0e8d8fcf, 0x01608f95, 0x0e8d8fa7 } },
        { AR5K_PHY_TURBO,
-               { 0x00000000, 0x00000003, 0x00000000 } },
+          { 0x00000000, 0x00000003, 0x00000000, 0x00000000 } },
        { AR5K_PHY(8),
-               { 0x02020200, 0x02020200, 0x02010200 } },
+          { 0x02020200, 0x02020200, 0x02010200, 0x02020200 } },
        { AR5K_PHY(9),
-               { 0x00000e0e, 0x00000e0e, 0x00000707 } },
+          { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e } },
        { AR5K_PHY(10),
-               { 0x0a020001, 0x0a020001, 0x05010000 } },
+          { 0x0a020001, 0x0a020001, 0x05010000, 0x0a020001 } },
        { AR5K_PHY(13),
-               { 0x00000e0e, 0x00000e0e, 0x00000e0e } },
+          { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
        { AR5K_PHY(14),
-               { 0x00000007, 0x00000007, 0x0000000b } },
+          { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b } },
        { AR5K_PHY(17),
-               { 0x1372169c, 0x137216a5, 0x137216a8 } },
+          { 0x1372169c, 0x137216a5, 0x137216a8, 0x1372169c } },
        { AR5K_PHY(18),
-               { 0x0018ba67, 0x0018ba67, 0x0018ba69 } },
+          { 0x0018ba67, 0x0018ba67, 0x0018ba69, 0x0018ba69 } },
        { AR5K_PHY(20),
-               { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } },
+          { 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0, 0x0c28b4e0 } },
        { AR5K_PHY_SIG,
-               { 0x7e800d2e, 0x7e800d2e, 0x7ec00d2e } },
+          { 0x7e800d2e, 0x7e800d2e, 0x7ec00d2e, 0x7e800d2e } },
        { AR5K_PHY_AGCCOARSE,
-               { 0x31375d5e, 0x31375d5e, 0x313a5d5e } },
+          { 0x31375d5e, 0x31375d5e, 0x313a5d5e, 0x31375d5e } },
        { AR5K_PHY_AGCCTL,
-               { 0x0000bd10, 0x0000bd10, 0x0000bd38 } },
+          { 0x0000bd10, 0x0000bd10, 0x0000bd38, 0x0000bd10 } },
        { AR5K_PHY_NF,
-               { 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
+          { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
        { AR5K_PHY_RX_DELAY,
-               { 0x00002710, 0x00002710, 0x0000157c } },
+          { 0x00002710, 0x00002710, 0x0000157c, 0x00002710 } },
        { AR5K_PHY(70),
-               { 0x00000190, 0x00000190, 0x00000084 } },
+          { 0x00000190, 0x00000190, 0x00000084, 0x00000190 } },
        { AR5K_PHY_FRAME_CTL_5211,
-               { 0x6fe01020, 0x6fe01020, 0x6fe00920 } },
-       { AR5K_PHY_PCDAC_TXPOWER_BASE_5211,
-               { 0x05ff14ff, 0x05ff14ff, 0x05ff14ff } },
+          { 0x6fe01020, 0x6fe01020, 0x6fe00920, 0x6fe01020 } },
+       { AR5K_PHY_PCDAC_TXPOWER_BASE,
+          { 0x05ff14ff, 0x05ff14ff, 0x05ff14ff, 0x05ff19ff } },
        { AR5K_RF_BUFFER_CONTROL_4,
-               { 0x00000010, 0x00000014, 0x00000010 } },
+          { 0x00000010, 0x00000014, 0x00000010, 0x00000010 } },
 };
 
 /* Initial register settings for AR5212 */
-static const struct ath5k_ini ar5212_ini[] = {
+static const struct ath5k_ini ar5212_ini_common_start[] = {
        { AR5K_RXDP,            0x00000000 },
        { AR5K_RXCFG,           0x00000005 },
        { AR5K_MIBC,            0x00000000 },
@@ -485,91 +485,83 @@ static const struct ath5k_ini ar5212_ini[] = {
        { AR5K_QUEUE_TXDP(9),   0x00000000 },
        { AR5K_DCU_FP,          0x00000000 },
        { AR5K_DCU_TXP,         0x00000000 },
-       { AR5K_DCU_TX_FILTER_0_BASE,    0x00000000 },
-       /* Unknown table */
-       { 0x1078, 0x00000000 },
-       { 0x10b8, 0x00000000 },
-       { 0x10f8, 0x00000000 },
-       { 0x1138, 0x00000000 },
-       { 0x1178, 0x00000000 },
-       { 0x11b8, 0x00000000 },
-       { 0x11f8, 0x00000000 },
-       { 0x1238, 0x00000000 },
-       { 0x1278, 0x00000000 },
-       { 0x12b8, 0x00000000 },
-       { 0x12f8, 0x00000000 },
-       { 0x1338, 0x00000000 },
-       { 0x1378, 0x00000000 },
-       { 0x13b8, 0x00000000 },
-       { 0x13f8, 0x00000000 },
-       { 0x1438, 0x00000000 },
-       { 0x1478, 0x00000000 },
-       { 0x14b8, 0x00000000 },
-       { 0x14f8, 0x00000000 },
-       { 0x1538, 0x00000000 },
-       { 0x1578, 0x00000000 },
-       { 0x15b8, 0x00000000 },
-       { 0x15f8, 0x00000000 },
-       { 0x1638, 0x00000000 },
-       { 0x1678, 0x00000000 },
-       { 0x16b8, 0x00000000 },
-       { 0x16f8, 0x00000000 },
-       { 0x1738, 0x00000000 },
-       { 0x1778, 0x00000000 },
-       { 0x17b8, 0x00000000 },
-       { 0x17f8, 0x00000000 },
-       { 0x103c, 0x00000000 },
-       { 0x107c, 0x00000000 },
-       { 0x10bc, 0x00000000 },
-       { 0x10fc, 0x00000000 },
-       { 0x113c, 0x00000000 },
-       { 0x117c, 0x00000000 },
-       { 0x11bc, 0x00000000 },
-       { 0x11fc, 0x00000000 },
-       { 0x123c, 0x00000000 },
-       { 0x127c, 0x00000000 },
-       { 0x12bc, 0x00000000 },
-       { 0x12fc, 0x00000000 },
-       { 0x133c, 0x00000000 },
-       { 0x137c, 0x00000000 },
-       { 0x13bc, 0x00000000 },
-       { 0x13fc, 0x00000000 },
-       { 0x143c, 0x00000000 },
-       { 0x147c, 0x00000000 },
+       /* Tx filter table 0 (32 entries) */
+       { AR5K_DCU_TX_FILTER_0(0),  0x00000000 }, /* DCU 0 */
+       { AR5K_DCU_TX_FILTER_0(1),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(2),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(3),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(4),  0x00000000 }, /* DCU 1 */
+       { AR5K_DCU_TX_FILTER_0(5),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(6),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(7),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(8),  0x00000000 }, /* DCU 2 */
+       { AR5K_DCU_TX_FILTER_0(9),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(10), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(11), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(12), 0x00000000 }, /* DCU 3 */
+       { AR5K_DCU_TX_FILTER_0(13), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(14), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(15), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(16), 0x00000000 }, /* DCU 4 */
+       { AR5K_DCU_TX_FILTER_0(17), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(18), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(19), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(20), 0x00000000 }, /* DCU 5 */
+       { AR5K_DCU_TX_FILTER_0(21), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(22), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(23), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(24), 0x00000000 }, /* DCU 6 */
+       { AR5K_DCU_TX_FILTER_0(25), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(26), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(27), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(28), 0x00000000 }, /* DCU 7 */
+       { AR5K_DCU_TX_FILTER_0(29), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(30), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_0(31), 0x00000000 },
+       /* Tx filter table 1 (16 entries) */
+       { AR5K_DCU_TX_FILTER_1(0),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(1),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(2),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(3),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(4),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(5),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(6),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(7),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(8),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(9),  0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(10), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(11), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(12), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(13), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(14), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_1(15), 0x00000000 },
+       { AR5K_DCU_TX_FILTER_CLR, 0x00000000 },
+       { AR5K_DCU_TX_FILTER_SET, 0x00000000 },
        { AR5K_DCU_TX_FILTER_CLR, 0x00000000 },
        { AR5K_DCU_TX_FILTER_SET, 0x00000000 },
        { AR5K_STA_ID1,         0x00000000 },
        { AR5K_BSS_ID0,         0x00000000 },
        { AR5K_BSS_ID1,         0x00000000 },
-       /*{ AR5K_RSSI_THR,      0x00000000 },*/ /* Found on SuperAG cards */
-       { AR5K_BEACON_5211,     0x00000000 },   /* Found on SuperAG cards */
-       { AR5K_CFP_PERIOD_5211, 0x00000000 },   /* Found on SuperAG cards */
-       { AR5K_TIMER0_5211,     0x00000030 },   /* Found on SuperAG cards */
-       { AR5K_TIMER1_5211,     0x0007ffff },   /* Found on SuperAG cards */
-       { AR5K_TIMER2_5211,     0x01ffffff },   /* Found on SuperAG cards */
-       { AR5K_TIMER3_5211,     0x00000031 },   /* Found on SuperAG cards */
-       { AR5K_CFP_DUR_5211,    0x00000000 },   /* Found on SuperAG cards */
+       { AR5K_BEACON_5211,     0x00000000 },
+       { AR5K_CFP_PERIOD_5211, 0x00000000 },
+       { AR5K_TIMER0_5211,     0x00000030 },
+       { AR5K_TIMER1_5211,     0x0007ffff },
+       { AR5K_TIMER2_5211,     0x01ffffff },
+       { AR5K_TIMER3_5211,     0x00000031 },
+       { AR5K_CFP_DUR_5211,    0x00000000 },
        { AR5K_RX_FILTER_5211,  0x00000000 },
        { AR5K_DIAG_SW_5211,    0x00000000 },
        { AR5K_ADDAC_TEST,      0x00000000 },
        { AR5K_DEFAULT_ANTENNA, 0x00000000 },
-       { 0x8080, 0x00000000 },
-       /*{ 0x805c, 0xffffc7ff },*/ /* Old value */
-       { 0x805c, 0x000fc78f },
-       { AR5K_NAV_5211,        0x00000000 },   /* Not found on recent */
-       { AR5K_RTS_OK_5211,     0x00000000 },   /* dumps but it makes  */
-       { AR5K_RTS_FAIL_5211,   0x00000000 },   /* sense to reset counters */
-       { AR5K_ACK_FAIL_5211,   0x00000000 },   /* since pcu registers */
-       { AR5K_FCS_FAIL_5211,   0x00000000 },   /* are skiped during chan*/
-       { AR5K_BEACON_CNT_5211, 0x00000000 },   /* change */
+       { AR5K_FRAME_CTL_QOSM,  0x000fc78f },
        { AR5K_XRMODE,          0x2a82301a },
        { AR5K_XRDELAY,         0x05dc01e0 },
        { AR5K_XRTIMEOUT,       0x1f402710 },
        { AR5K_XRCHIRP,         0x01f40000 },
        { AR5K_XRSTOMP,         0x00001e1c },
-       { AR5K_SLEEP0,          0x0002aaaa },   /* Found on SuperAG cards */
-       { AR5K_SLEEP1,          0x02005555 },   /* Found on SuperAG cards */
-       { AR5K_SLEEP2,          0x00000000 },   /* Found on SuperAG cards */
+       { AR5K_SLEEP0,          0x0002aaaa },
+       { AR5K_SLEEP1,          0x02005555 },
+       { AR5K_SLEEP2,          0x00000000 },
        { AR5K_BSS_IDM0,        0xffffffff },
        { AR5K_BSS_IDM1,        0x0000ffff },
        { AR5K_TXPC,            0x00000000 },
@@ -577,7 +569,8 @@ static const struct ath5k_ini ar5212_ini[] = {
        { AR5K_PROFCNT_RX,      0x00000000 },
        { AR5K_PROFCNT_RXCLR,   0x00000000 },
        { AR5K_PROFCNT_CYCLE,   0x00000000 },
-       { 0x80fc, 0x00000088 },
+       { AR5K_QUIET_CTL1,      0x00000088 },
+       /* Initial rate duration table (32 entries )*/
        { AR5K_RATE_DUR(0),     0x00000000 },
        { AR5K_RATE_DUR(1),     0x0000008c },
        { AR5K_RATE_DUR(2),     0x000000e4 },
@@ -610,881 +603,625 @@ static const struct ath5k_ini ar5212_ini[] = {
        { AR5K_RATE_DUR(29),    0x0000007f },
        { AR5K_RATE_DUR(30),    0x000000a2 },
        { AR5K_RATE_DUR(31),    0x00000000 },
-       { 0x8100, 0x00010002},
+       { AR5K_QUIET_CTL2,      0x00010002 },
        { AR5K_TSF_PARM,        0x00000001 },
-       { 0x8108, 0x000000c0 },
+       { AR5K_QOS_NOACK,       0x000000c0 },
        { AR5K_PHY_ERR_FIL,     0x00000000 },
-       { 0x8110, 0x00000168 },
-       { 0x8114, 0x00000000 },
-       /* Some kind of table
-        * also notice ...03<-02<-01<-00) */
-       { 0x87c0, 0x03020100 },
-       { 0x87c4, 0x07060504 },
-       { 0x87c8, 0x0b0a0908 },
-       { 0x87cc, 0x0f0e0d0c },
-       { 0x87d0, 0x13121110 },
-       { 0x87d4, 0x17161514 },
-       { 0x87d8, 0x1b1a1918 },
-       { 0x87dc, 0x1f1e1d1c },
-       /* loop ? */
-       { 0x87e0, 0x03020100 },
-       { 0x87e4, 0x07060504 },
-       { 0x87e8, 0x0b0a0908 },
-       { 0x87ec, 0x0f0e0d0c },
-       { 0x87f0, 0x13121110 },
-       { 0x87f4, 0x17161514 },
-       { 0x87f8, 0x1b1a1918 },
-       { 0x87fc, 0x1f1e1d1c },
-       /* PHY registers */
-       /*{ AR5K_PHY_AGC, 0x00000000 },*/
-       { AR5K_PHY(3),  0xad848e19 },
-       { AR5K_PHY(4),  0x7d28e000 },
-       { AR5K_PHY_TIMING_3, 0x9c0a9f6b },
-       { AR5K_PHY_ACT, 0x00000000 },
-       /*{ AR5K_PHY(11), 0x00022ffe },*/
-       /*{ AR5K_PHY(15), 0x00020100 },*/
-       { AR5K_PHY(16), 0x206a017a },
-       /*{ AR5K_PHY(19), 0x1284613c },*/
-       { AR5K_PHY(21), 0x00000859 },
-       { AR5K_PHY(64), 0x00000000 },
-       { AR5K_PHY(65), 0x00000000 },
-       { AR5K_PHY(66), 0x00000000 },
-       { AR5K_PHY(67), 0x00800000 },
-       { AR5K_PHY(68), 0x00000001 },
+       { AR5K_XRLAT_TX,        0x00000168 },
+       { AR5K_ACKSIFS,         0x00000000 },
+       /* Rate -> db table
+        * notice ...03<-02<-01<-00 ! */
+       { AR5K_RATE2DB(0),      0x03020100 },
+       { AR5K_RATE2DB(1),      0x07060504 },
+       { AR5K_RATE2DB(2),      0x0b0a0908 },
+       { AR5K_RATE2DB(3),      0x0f0e0d0c },
+       { AR5K_RATE2DB(4),      0x13121110 },
+       { AR5K_RATE2DB(5),      0x17161514 },
+       { AR5K_RATE2DB(6),      0x1b1a1918 },
+       { AR5K_RATE2DB(7),      0x1f1e1d1c },
+       /* Db -> Rate table */
+       { AR5K_DB2RATE(0),      0x03020100 },
+       { AR5K_DB2RATE(1),      0x07060504 },
+       { AR5K_DB2RATE(2),      0x0b0a0908 },
+       { AR5K_DB2RATE(3),      0x0f0e0d0c },
+       { AR5K_DB2RATE(4),      0x13121110 },
+       { AR5K_DB2RATE(5),      0x17161514 },
+       { AR5K_DB2RATE(6),      0x1b1a1918 },
+       { AR5K_DB2RATE(7),      0x1f1e1d1c },
+       /* PHY registers (Common settings
+        * for all chips/modes) */
+       { AR5K_PHY(3),          0xad848e19 },
+       { AR5K_PHY(4),          0x7d28e000 },
+       { AR5K_PHY_TIMING_3,    0x9c0a9f6b },
+       { AR5K_PHY_ACT,         0x00000000 },
+       { AR5K_PHY(16),         0x206a017a },
+       { AR5K_PHY(21),         0x00000859 },
+       { AR5K_PHY_BIN_MASK_1,  0x00000000 },
+       { AR5K_PHY_BIN_MASK_2,  0x00000000 },
+       { AR5K_PHY_BIN_MASK_3,  0x00000000 },
+       { AR5K_PHY_BIN_MASK_CTL, 0x00800000 },
+       { AR5K_PHY_ANT_CTL,     0x00000001 },
        /*{ AR5K_PHY(71), 0x0000092a },*/ /* Old value */
-       { AR5K_PHY(71), 0x00000c80 },
-       { AR5K_PHY_IQ,  0x05100000 },
-       { AR5K_PHY(74), 0x00000001 },
-       { AR5K_PHY(75), 0x00000004 },
+       { AR5K_PHY_MAX_RX_LEN,  0x00000c80 },
+       { AR5K_PHY_IQ,          0x05100000 },
+       { AR5K_PHY_WARM_RESET,  0x00000001 },
+       { AR5K_PHY_CTL,         0x00000004 },
        { AR5K_PHY_TXPOWER_RATE1, 0x1e1f2022 },
        { AR5K_PHY_TXPOWER_RATE2, 0x0a0b0c0d },
        { AR5K_PHY_TXPOWER_RATE_MAX, 0x0000003f },
-       /*{ AR5K_PHY(80), 0x00000004 },*/
-       { AR5K_PHY(82), 0x9280b212 },
-       { AR5K_PHY_RADAR, 0x5d50e188 },
+       { AR5K_PHY(82),         0x9280b212 },
+       { AR5K_PHY_RADAR,       0x5d50e188 },
        /*{ AR5K_PHY(86), 0x000000ff },*/
-       { AR5K_PHY(87), 0x004b6a8e },
-       { AR5K_PHY(90), 0x000003ce },
-       { AR5K_PHY(92), 0x192fb515 },
-       /*{ AR5K_PHY(93), 0x00000000 },*/
-       { AR5K_PHY(94), 0x00000001 },
-       { AR5K_PHY(95), 0x00000000 },
+       { AR5K_PHY(87),         0x004b6a8e },
+       { AR5K_PHY_NFTHRES,     0x000003ce },
+       { AR5K_PHY_RESTART,     0x192fb515 },
+       { AR5K_PHY(94),         0x00000001 },
+       { AR5K_PHY_RFBUS_REQ,   0x00000000 },
        /*{ AR5K_PHY(644), 0x0080a333 },*/ /* Old value */
        /*{ AR5K_PHY(645), 0x00206c10 },*/ /* Old value */
-       { AR5K_PHY(644), 0x00806333 },
-       { AR5K_PHY(645), 0x00106c10 },
-       { AR5K_PHY(646), 0x009c4060 },
-       { AR5K_PHY(647), 0x1483800a },
-       /* { AR5K_PHY(648), 0x018830c6 },*/ /* 2413/2425 */
-       { AR5K_PHY(648), 0x01831061 },
-       { AR5K_PHY(649), 0x00000400 },
+       { AR5K_PHY(644),        0x00806333 },
+       { AR5K_PHY(645),        0x00106c10 },
+       { AR5K_PHY(646),        0x009c4060 },
+       /* { AR5K_PHY(647), 0x1483800a }, */
+       /* { AR5K_PHY(648), 0x01831061 }, */ /* Old value */
+       { AR5K_PHY(648),        0x018830c6 },
+       { AR5K_PHY(649),        0x00000400 },
        /*{ AR5K_PHY(650), 0x000001b5 },*/
-       { AR5K_PHY(651), 0x00000000 },
+       { AR5K_PHY(651),        0x00000000 },
        { AR5K_PHY_TXPOWER_RATE3, 0x20202020 },
        { AR5K_PHY_TXPOWER_RATE2, 0x20202020 },
        /*{ AR5K_PHY(655), 0x13c889af },*/
-       { AR5K_PHY(656), 0x38490a20 },
-       { AR5K_PHY(657), 0x00007bb6 },
-       { AR5K_PHY(658), 0x0fff3ffc },
-       /*{ AR5K_PHY_CCKTXCTL, 0x00000000 },*/
+       { AR5K_PHY(656),        0x38490a20 },
+       { AR5K_PHY(657),        0x00007bb6 },
+       { AR5K_PHY(658),        0x0fff3ffc },
 };
 
 /* Initial mode-specific settings for AR5212 (Written before ar5212_ini) */
 static const struct ath5k_ini_mode ar5212_ini_mode_start[] = {
-       { AR5K_PHY(640),
-       /*        a/XR        aTurbo      b           g (DYN)     gTurbo */
-               { 0x00000008, 0x00000008, 0x0000000b, 0x0000000e, 0x0000000e } },
-       { AR5K_PHY(0),
-               { 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0x00000007 } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(0),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+       /*      a/XR       aTurbo         b        g (DYN)     gTurbo     */
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(1),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(2),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(3),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(4),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(5),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(6),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(7),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(8),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_QUEUE_DFS_LOCAL_IFS(9),
-               { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
+          { 0x002ffc0f, 0x002ffc0f, 0x002ffc1f, 0x002ffc0f, 0x002ffc0f } },
        { AR5K_DCU_GBL_IFS_SIFS,
-               { 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 } },
+          { 0x00000230, 0x000001e0, 0x000000b0, 0x00000160, 0x000001e0 } },
        { AR5K_DCU_GBL_IFS_SLOT,
-               { 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 } },
+          { 0x00000168, 0x000001e0, 0x000001b8, 0x0000018c, 0x000001e0 } },
        { AR5K_DCU_GBL_IFS_EIFS,
-               { 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 } },
+          { 0x00000e60, 0x00001180, 0x00001f1c, 0x00003e38, 0x00001180 } },
        { AR5K_DCU_GBL_IFS_MISC,
-               { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } },
+          { 0x0000a0e0, 0x00014068, 0x00005880, 0x0000b0e0, 0x00014068 } },
        { AR5K_TIME_OUT,
-               { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } },
+          { 0x03e803e8, 0x06e006e0, 0x04200420, 0x08400840, 0x06e006e0 } },
        { AR5K_PHY_TURBO,
-               { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } },
+          { 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000003 } },
        { AR5K_PHY(8),
-               { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } },
-       { AR5K_PHY(9),
-               { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e, 0x00000e0e } },
-       { AR5K_PHY(17),
-               { 0x1372161c, 0x13721c25, 0x13721722, 0x137216a2, 0x13721c25 } },
+          { 0x02020200, 0x02020200, 0x02010200, 0x02020200, 0x02020200 } },
+       { AR5K_PHY_RF_CTL2,
+          { 0x00000e0e, 0x00000e0e, 0x00000707, 0x00000e0e, 0x00000e0e } },
+       { AR5K_PHY_SETTLING,
+          { 0x1372161c, 0x13721c25, 0x13721722, 0x137216a2, 0x13721c25 } },
        { AR5K_PHY_AGCCTL,
-               { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d18, 0x00009d18 } },
+          { 0x00009d10, 0x00009d10, 0x00009d18, 0x00009d18, 0x00009d18 } },
        { AR5K_PHY_NF,
-               { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
-       { AR5K_PHY(26),
-               { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } },
+          { 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00, 0x0001ce00 } },
+       { AR5K_PHY_WEAK_OFDM_HIGH_THR,
+          { 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190, 0x409a4190 } },
        { AR5K_PHY(70),
-               { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } },
-       { AR5K_PHY(73),
-               { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } },
+          { 0x000001b8, 0x000001b8, 0x00000084, 0x00000108, 0x000001b8 } },
+       { AR5K_PHY_OFDM_SELFCORR,
+          { 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05, 0x10058a05 } },
        { 0xa230,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } },
+          { 0x00000000, 0x00000000, 0x00000000, 0x00000108, 0x00000000 } },
 };
 
 /* Initial mode-specific settings for AR5212 + RF5111 (Written after ar5212_ini) */
-/* New dump pending */
-static const struct ath5k_ini_mode ar5212_rf5111_ini_mode_end[] = {
-       { AR5K_PHY(640), /* This one differs from ar5212_ini_mode_start ! */
-       /*        a/XR        aTurbo      b           g (DYN)     gTurbo */
-               { 0x00000000, 0x00000000, 0x00000003, 0x00000006, 0x00000006 } },
+static const struct ath5k_ini_mode rf5111_ini_mode_end[] = {
        { AR5K_TXCFG,
-               { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } },
+       /*      a/XR       aTurbo         b        g (DYN)     gTurbo     */
+          { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } },
        { AR5K_USEC_5211,
-               { 0x128d8fa7, 0x09880fcf, 0x04e00f95, 0x12e00fab, 0x09880fcf } },
-       { AR5K_PHY(10),
-               { 0x0a020001, 0x0a020001, 0x05010100, 0x0a020001, 0x0a020001 } },
-       { AR5K_PHY(13),
-               { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
-       { AR5K_PHY(14),
-               { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
-       { AR5K_PHY(18),
-               { 0x0018da5a, 0x0018da5a, 0x0018ca69, 0x0018ca69, 0x0018ca69 } },
-       { AR5K_PHY(20),
-               { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
+          { 0x128d8fa7, 0x09880fcf, 0x04e00f95, 0x12e00fab, 0x09880fcf } },
+       { AR5K_PHY_RF_CTL3,
+          { 0x0a020001, 0x0a020001, 0x05010100, 0x0a020001, 0x0a020001 } },
+       { AR5K_PHY_RF_CTL4,
+          { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
+       { AR5K_PHY_PA_CTL,
+          { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
+       { AR5K_PHY_GAIN,
+          { 0x0018da5a, 0x0018da5a, 0x0018ca69, 0x0018ca69, 0x0018ca69 } },
+       { AR5K_PHY_DESIRED_SIZE,
+          { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
        { AR5K_PHY_SIG,
-               { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } },
+          { 0x7e800d2e, 0x7e800d2e, 0x7ee84d2e, 0x7ee84d2e, 0x7e800d2e } },
        { AR5K_PHY_AGCCOARSE,
-               { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137615e } },
-       { AR5K_PHY(27),
-               { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb080, 0x050cb080 } },
+          { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137615e } },
+       { AR5K_PHY_WEAK_OFDM_LOW_THR,
+          { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb080, 0x050cb080 } },
        { AR5K_PHY_RX_DELAY,
-               { 0x00002710, 0x00002710, 0x0000157c, 0x00002af8, 0x00002710 } },
+          { 0x00002710, 0x00002710, 0x0000157c, 0x00002af8, 0x00002710 } },
        { AR5K_PHY_FRAME_CTL_5211,
-               { 0xf7b81020, 0xf7b81020, 0xf7b80d20, 0xf7b81020, 0xf7b81020 } },
+          { 0xf7b81020, 0xf7b81020, 0xf7b80d20, 0xf7b81020, 0xf7b81020 } },
        { AR5K_PHY_GAIN_2GHZ,
-               { 0x642c416a, 0x642c416a, 0x6440416a, 0x6440416a, 0x6440416a } },
-       { 0xa21c,
-               { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } },
-       { AR5K_DCU_FP,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY_AGC,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(11),
-               { 0x00022ffe, 0x00022ffe, 0x00022ffe, 0x00022ffe, 0x00022ffe } },
-       { AR5K_PHY(15),
-               { 0x00020100, 0x00020100, 0x00020100, 0x00020100, 0x00020100 } },
-       { AR5K_PHY(19),
-               { 0x1284613c, 0x1284613c, 0x1284613c, 0x1284613c, 0x1284613c } },
-       { AR5K_PHY_PAPD_PROBE,
-               { 0x00004883, 0x00004883, 0x00004883, 0x00004883, 0x00004883 } },
-       { AR5K_PHY(80),
-               { 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004 } },
-       { AR5K_PHY(86),
-               { 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff } },
-       { AR5K_PHY(93),
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY_SPENDING,
-               { 0x00000018, 0x00000018, 0x00000018, 0x00000018, 0x00000018 } },
-       { AR5K_PHY_CCKTXCTL,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(642),
-               { 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
-       { 0xa228,
-               { 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5 } },
-       { 0xa23c,
-               { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } },
+          { 0x642c416a, 0x642c416a, 0x6440416a, 0x6440416a, 0x6440416a } },
+       { AR5K_PHY_CCK_RX_CTL_4,
+          { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } },
+};
+
+static const struct ath5k_ini rf5111_ini_common_end[] = {
+       { AR5K_DCU_FP,          0x00000000 },
+       { AR5K_PHY_AGC,         0x00000000 },
+       { AR5K_PHY_ADC_CTL,     0x00022ffe },
+       { 0x983c,               0x00020100 },
+       { AR5K_PHY_GAIN_OFFSET, 0x1284613c },
+       { AR5K_PHY_PAPD_PROBE,  0x00004883 },
+       { 0x9940,               0x00000004 },
+       { 0x9958,               0x000000ff },
+       { 0x9974,               0x00000000 },
+       { AR5K_PHY_SPENDING,    0x00000018 },
+       { AR5K_PHY_CCKTXCTL,    0x00000000 },
+       { AR5K_PHY_CCK_CROSSCORR, 0xd03e6788 },
+       { AR5K_PHY_DAG_CCK_CTL, 0x000001b5 },
+       { 0xa23c,               0x13c889af },
 };
 
 /* Initial mode-specific settings for AR5212 + RF5112 (Written after ar5212_ini) */
-/* XXX: No dumps for turbog yet, but i found settings from old values so it should be ok */
-static const struct ath5k_ini_mode ar5212_rf5112_ini_mode_end[] = {
+static const struct ath5k_ini_mode rf5112_ini_mode_end[] = {
        { AR5K_TXCFG,
-       /*        a/XR        aTurbo      b           g (DYN)     gTurbo */
-               { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } },
+       /*      a/XR       aTurbo         b        g (DYN)     gTurbo     */
+          { 0x00008015, 0x00008015, 0x00008015, 0x00008015, 0x00008015 } },
        { AR5K_USEC_5211,
-               { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
-       { AR5K_PHY(10),
-               { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },
-       { AR5K_PHY(13),
-               { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
-       { AR5K_PHY(14),
-               { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
-       { AR5K_PHY(18),
-               { 0x0018da6d, 0x0018da6d, 0x0018ca75, 0x0018ca75, 0x0018ca75 } },
-       { AR5K_PHY(20),
-               { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
+          { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
+       { AR5K_PHY_RF_CTL3,
+          { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },
+       { AR5K_PHY_RF_CTL4,
+          { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
+       { AR5K_PHY_PA_CTL,
+          { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
+       { AR5K_PHY_GAIN,
+          { 0x0018da6d, 0x0018da6d, 0x0018ca75, 0x0018ca75, 0x0018ca75 } },
+       { AR5K_PHY_DESIRED_SIZE,
+          { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0, 0x0de8b4e0 } },
        { AR5K_PHY_SIG,
-               { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e, 0x7ee80d2e } },
+          { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ee80d2e, 0x7ee80d2e } },
        { AR5K_PHY_AGCCOARSE,
-               { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e } },
-       { AR5K_PHY(27),
-               { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
+          { 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e, 0x3137665e } },
+       { AR5K_PHY_WEAK_OFDM_LOW_THR,
+          { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
        { AR5K_PHY_RX_DELAY,
-               { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
+          { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
        { AR5K_PHY_FRAME_CTL_5211,
-               { 0xf7b81020, 0xf7b81020, 0xf7b80d10, 0xf7b81010, 0xf7b81010 } },
+          { 0xf7b81020, 0xf7b81020, 0xf7b80d10, 0xf7b81010, 0xf7b81010 } },
        { AR5K_PHY_CCKTXCTL,
-               { 0x00000000, 0x00000000, 0x00000008, 0x00000008, 0x00000008 } },
-       { AR5K_PHY(642),
-               { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
+          { 0x00000000, 0x00000000, 0x00000008, 0x00000008, 0x00000008 } },
+       { AR5K_PHY_CCK_CROSSCORR,
+          { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
        { AR5K_PHY_GAIN_2GHZ,
-               { 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 } },
-       { 0xa21c,
-               { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } },
-       { AR5K_DCU_FP,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY_AGC,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(11),
-               { 0x00022ffe, 0x00022ffe, 0x00022ffe, 0x00022ffe, 0x00022ffe } },
-       { AR5K_PHY(15),
-               { 0x00020100, 0x00020100, 0x00020100, 0x00020100, 0x00020100 } },
-       { AR5K_PHY(19),
-               { 0x1284613c, 0x1284613c, 0x1284613c, 0x1284613c, 0x1284613c } },
-       { AR5K_PHY_PAPD_PROBE,
-               { 0x00004882, 0x00004882, 0x00004882, 0x00004882, 0x00004882 } },
-       { AR5K_PHY(80),
-               { 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004 } },
-       { AR5K_PHY(86),
-               { 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff } },
-       { AR5K_PHY(93),
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa228,
-               { 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5, 0x000001b5 } },
-       { 0xa23c,
-               { 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af, 0x13c889af } },
+          { 0x642c0140, 0x642c0140, 0x6442c160, 0x6442c160, 0x6442c160 } },
+       { AR5K_PHY_CCK_RX_CTL_4,
+          { 0x1883800a, 0x1883800a, 0x1873800a, 0x1883800a, 0x1883800a } },
+};
+
+static const struct ath5k_ini rf5112_ini_common_end[] = {
+       { AR5K_DCU_FP,          0x00000000 },
+       { AR5K_PHY_AGC,         0x00000000 },
+       { AR5K_PHY_ADC_CTL,     0x00022ffe },
+       { 0x983c,               0x00020100 },
+       { AR5K_PHY_GAIN_OFFSET, 0x1284613c },
+       { AR5K_PHY_PAPD_PROBE,  0x00004882 },
+       { 0x9940,               0x00000004 },
+       { 0x9958,               0x000000ff },
+       { 0x9974,               0x00000000 },
+       { AR5K_PHY_DAG_CCK_CTL, 0x000001b5 },
+       { 0xa23c,               0x13c889af },
 };
 
 /* Initial mode-specific settings for RF5413/5414 (Written after ar5212_ini) */
-/* XXX: No dumps for turbog yet, so turbog is the same with g here with some
- * minor tweaking based on dumps from other chips */
 static const struct ath5k_ini_mode rf5413_ini_mode_end[] = {
        { AR5K_TXCFG,
-       /*        a/XR        aTurbo      b           g           gTurbo */
-               { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } },
+       /*      a/XR       aTurbo         b        g (DYN)     gTurbo     */
+          { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } },
        { AR5K_USEC_5211,
-               { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
-       { AR5K_PHY(10),
-               { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },
-       { AR5K_PHY(13),
-               { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
-       { AR5K_PHY(14),
-               { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
-       { AR5K_PHY(18),
-               { 0x0018fa61, 0x0018fa61, 0x001a1a63, 0x001a1a63, 0x001a1a63 } },
-       { AR5K_PHY(20),
-               { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } },
+          { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
+       { AR5K_PHY_RF_CTL3,
+          { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },
+       { AR5K_PHY_RF_CTL4,
+          { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
+       { AR5K_PHY_PA_CTL,
+          { 0x00000007, 0x00000007, 0x0000000b, 0x0000000b, 0x0000000b } },
+       { AR5K_PHY_GAIN,
+          { 0x0018fa61, 0x0018fa61, 0x001a1a63, 0x001a1a63, 0x001a1a63 } },
+       { AR5K_PHY_DESIRED_SIZE,
+          { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } },
        { AR5K_PHY_SIG,
-               { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
+          { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
        { AR5K_PHY_AGCCOARSE,
-               { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } },
-       { AR5K_PHY(27),
-               { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
+          { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } },
+       { AR5K_PHY_WEAK_OFDM_LOW_THR,
+          { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
        { AR5K_PHY_RX_DELAY,
-               { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
+          { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
        { AR5K_PHY_FRAME_CTL_5211,
-               { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },
+          { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },
        { AR5K_PHY_CCKTXCTL,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(642),
-               { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
+          { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { AR5K_PHY_CCK_CROSSCORR,
+          { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
        { AR5K_PHY_GAIN_2GHZ,
-               { 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 } },
-       { 0xa21c,
-               { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } },
+          { 0x002ec1e0, 0x002ec1e0, 0x002ac120, 0x002ac120, 0x002ac120 } },
+       { AR5K_PHY_CCK_RX_CTL_4,
+          { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } },
        { 0xa300,
-               { 0x18010000, 0x18010000, 0x18010000, 0x18010000, 0x18010000 } },
+          { 0x18010000, 0x18010000, 0x18010000, 0x18010000, 0x18010000 } },
        { 0xa304,
-               { 0x30032602, 0x30032602, 0x30032602, 0x30032602, 0x30032602 } },
+          { 0x30032602, 0x30032602, 0x30032602, 0x30032602, 0x30032602 } },
        { 0xa308,
-               { 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06 } },
+          { 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06, 0x48073e06 } },
        { 0xa30c,
-               { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },
+          { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },
        { 0xa310,
-               { 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f } },
+          { 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f, 0x641a600f } },
        { 0xa314,
-               { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },
+          { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },
        { 0xa318,
-               { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },
+          { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },
        { 0xa31c,
-               { 0x90cf865b, 0x90cf865b, 0x8ecf865b, 0x8ecf865b, 0x8ecf865b } },
+          { 0x90cf865b, 0x90cf865b, 0x8ecf865b, 0x8ecf865b, 0x8ecf865b } },
        { 0xa320,
-               { 0x9d4f970f, 0x9d4f970f, 0x9b4f970f, 0x9b4f970f, 0x9b4f970f } },
+          { 0x9d4f970f, 0x9d4f970f, 0x9b4f970f, 0x9b4f970f, 0x9b4f970f } },
        { 0xa324,
-               { 0xa7cfa38f, 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f, 0xa3cf9f8f } },
+          { 0xa7cfa38f, 0xa7cfa38f, 0xa3cf9f8f, 0xa3cf9f8f, 0xa3cf9f8f } },
        { 0xa328,
-               { 0xb55faf1f, 0xb55faf1f, 0xb35faf1f, 0xb35faf1f, 0xb35faf1f } },
+          { 0xb55faf1f, 0xb55faf1f, 0xb35faf1f, 0xb35faf1f, 0xb35faf1f } },
        { 0xa32c,
-               { 0xbddfb99f, 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f, 0xbbdfb99f } },
+          { 0xbddfb99f, 0xbddfb99f, 0xbbdfb99f, 0xbbdfb99f, 0xbbdfb99f } },
        { 0xa330,
-               { 0xcb7fc53f, 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f, 0xcb7fc73f } },
+          { 0xcb7fc53f, 0xcb7fc53f, 0xcb7fc73f, 0xcb7fc73f, 0xcb7fc73f } },
        { 0xa334,
-               { 0xd5ffd1bf, 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } },
-       { AR5K_DCU_FP,
-               { 0x000003e0, 0x000003e0, 0x000003e0, 0x000003e0, 0x000003e0 } },
-       { 0x4068,
-               { 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010 } },
-       { 0x8060,
-               { 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f, 0x0000000f } },
-       { 0x809c,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x80a0,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8118,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x811c,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8120,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8124,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8128,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x812c,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8130,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8134,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8138,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x813c,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8140,
-               { 0x800003f9, 0x800003f9, 0x800003f9, 0x800003f9, 0x800003f9 } },
-       { 0x8144,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY_AGC,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(11),
-               { 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000 } },
-       { AR5K_PHY(15),
-               { 0x00200400, 0x00200400, 0x00200400, 0x00200400, 0x00200400 } },
-       { AR5K_PHY(19),
-               { 0x1284233c, 0x1284233c, 0x1284233c, 0x1284233c, 0x1284233c } },
-       { AR5K_PHY_SCR,
-               { 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f, 0x0000001f } },
-       { AR5K_PHY_SLMT,
-               { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },
-       { AR5K_PHY_SCAL,
-               { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
-       { AR5K_PHY(86),
-               { 0x00081fff, 0x00081fff, 0x00081fff, 0x00081fff, 0x00081fff } },
-       { AR5K_PHY(96),
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(97),
-               { 0x02800000, 0x02800000, 0x02800000, 0x02800000, 0x02800000 } },
-       { AR5K_PHY(104),
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(120),
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(121),
-               { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa } },
-       { AR5K_PHY(122),
-               { 0x3c466478, 0x3c466478, 0x3c466478, 0x3c466478, 0x3c466478 } },
-       { AR5K_PHY(123),
-               { 0x000000aa, 0x000000aa, 0x000000aa, 0x000000aa, 0x000000aa } },
-       { AR5K_PHY_SCLOCK,
-               { 0x0000000c, 0x0000000c, 0x0000000c, 0x0000000c, 0x0000000c } },
-       { AR5K_PHY_SDELAY,
-               { 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff, 0x000000ff } },
-       { AR5K_PHY_SPENDING,
-               { 0x00000014, 0x00000014, 0x00000014, 0x00000014, 0x00000014 } },
-       { 0xa228,
-               { 0x000009b5, 0x000009b5, 0x000009b5, 0x000009b5, 0x000009b5 } },
-       { 0xa23c,
-               { 0x93c889af, 0x93c889af, 0x93c889af, 0x93c889af, 0x93c889af } },
-       { 0xa24c,
-               { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
-       { 0xa250,
-               { 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000, 0x0000a000 } },
-       { 0xa254,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa258,
-               { 0x0cc75380, 0x0cc75380, 0x0cc75380, 0x0cc75380, 0x0cc75380 } },
-       { 0xa25c,
-               { 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01 } },
-       { 0xa260,
-               { 0x5f690f01, 0x5f690f01, 0x5f690f01, 0x5f690f01, 0x5f690f01 } },
-       { 0xa264,
-               { 0x00418a11, 0x00418a11, 0x00418a11, 0x00418a11, 0x00418a11 } },
-       { 0xa268,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa26c,
-               { 0x0c30c16a, 0x0c30c16a, 0x0c30c16a, 0x0c30c16a, 0x0c30c16a } },
-       { 0xa270,
-               { 0x00820820, 0x00820820, 0x00820820, 0x00820820, 0x00820820 } },
-       { 0xa274,
-               { 0x081b7caa, 0x081b7caa, 0x081b7caa, 0x081b7caa, 0x081b7caa } },
-       { 0xa278,
-               { 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce, 0x1ce739ce } },
-       { 0xa27c,
-               { 0x051701ce, 0x051701ce, 0x051701ce, 0x051701ce, 0x051701ce } },
-       { 0xa338,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa33c,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa340,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa344,
-               { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa348,
-               { 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff } },
-       { 0xa34c,
-               { 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff } },
-       { 0xa350,
-               { 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff, 0x3fffffff } },
-       { 0xa354,
-               { 0x0003ffff, 0x0003ffff, 0x0003ffff, 0x0003ffff, 0x0003ffff } },
-       { 0xa358,
-               { 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f } },
-       { 0xa35c,
-               { 0x066c420f, 0x066c420f, 0x066c420f, 0x066c420f, 0x066c420f } },
-       { 0xa360,
-               { 0x0f282207, 0x0f282207, 0x0f282207, 0x0f282207, 0x0f282207 } },
-       { 0xa364,
-               { 0x17601685, 0x17601685, 0x17601685, 0x17601685, 0x17601685 } },
-       { 0xa368,
-               { 0x1f801104, 0x1f801104, 0x1f801104, 0x1f801104, 0x1f801104 } },
-       { 0xa36c,
-               { 0x37a00c03, 0x37a00c03, 0x37a00c03, 0x37a00c03, 0x37a00c03 } },
-       { 0xa370,
-               { 0x3fc40883, 0x3fc40883, 0x3fc40883, 0x3fc40883, 0x3fc40883 } },
-       { 0xa374,
-               { 0x57c00803, 0x57c00803, 0x57c00803, 0x57c00803, 0x57c00803 } },
-       { 0xa378,
-               { 0x5fd80682, 0x5fd80682, 0x5fd80682, 0x5fd80682, 0x5fd80682 } },
-       { 0xa37c,
-               { 0x7fe00482, 0x7fe00482, 0x7fe00482, 0x7fe00482, 0x7fe00482 } },
-       { 0xa380,
-               { 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba } },
-       { 0xa384,
-               { 0xf3307ff0, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0, 0xf3307ff0 } },
+          { 0xd5ffd1bf, 0xd5ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf, 0xd3ffd1bf } },
+};
+
+static const struct ath5k_ini rf5413_ini_common_end[] = {
+       { AR5K_DCU_FP,          0x000003e0 },
+       { AR5K_5414_CBCFG,      0x00000010 },
+       { AR5K_SEQ_MASK,        0x0000000f },
+       { 0x809c,               0x00000000 },
+       { 0x80a0,               0x00000000 },
+       { AR5K_MIC_QOS_CTL,     0x00000000 },
+       { AR5K_MIC_QOS_SEL,     0x00000000 },
+       { AR5K_MISC_MODE,       0x00000000 },
+       { AR5K_OFDM_FIL_CNT,    0x00000000 },
+       { AR5K_CCK_FIL_CNT,     0x00000000 },
+       { AR5K_PHYERR_CNT1,     0x00000000 },
+       { AR5K_PHYERR_CNT1_MASK, 0x00000000 },
+       { AR5K_PHYERR_CNT2,     0x00000000 },
+       { AR5K_PHYERR_CNT2_MASK, 0x00000000 },
+       { AR5K_TSF_THRES,       0x00000000 },
+       { 0x8140,               0x800003f9 },
+       { 0x8144,               0x00000000 },
+       { AR5K_PHY_AGC,         0x00000000 },
+       { AR5K_PHY_ADC_CTL,     0x0000a000 },
+       { 0x983c,               0x00200400 },
+       { AR5K_PHY_GAIN_OFFSET, 0x1284233c },
+       { AR5K_PHY_SCR,         0x0000001f },
+       { AR5K_PHY_SLMT,        0x00000080 },
+       { AR5K_PHY_SCAL,        0x0000000e },
+       { 0x9958,               0x00081fff },
+       { AR5K_PHY_TIMING_7,    0x00000000 },
+       { AR5K_PHY_TIMING_8,    0x02800000 },
+       { AR5K_PHY_TIMING_11,   0x00000000 },
+       { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
+       { 0x99e4,               0xaaaaaaaa },
+       { 0x99e8,               0x3c466478 },
+       { 0x99ec,               0x000000aa },
+       { AR5K_PHY_SCLOCK,      0x0000000c },
+       { AR5K_PHY_SDELAY,      0x000000ff },
+       { AR5K_PHY_SPENDING,    0x00000014 },
+       { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 },
+       { 0xa23c,               0x93c889af },
+       { AR5K_PHY_FAST_ADC,    0x00000001 },
+       { 0xa250,               0x0000a000 },
+       { AR5K_PHY_BLUETOOTH,   0x00000000 },
+       { AR5K_PHY_TPC_RG1,     0x0cc75380 },
+       { 0xa25c,               0x0f0f0f01 },
+       { 0xa260,               0x5f690f01 },
+       { 0xa264,               0x00418a11 },
+       { 0xa268,               0x00000000 },
+       { AR5K_PHY_TPC_RG5,     0x0c30c16a },
+       { 0xa270, 0x00820820 },
+       { 0xa274, 0x081b7caa },
+       { 0xa278, 0x1ce739ce },
+       { 0xa27c, 0x051701ce },
+       { 0xa338, 0x00000000 },
+       { 0xa33c, 0x00000000 },
+       { 0xa340, 0x00000000 },
+       { 0xa344, 0x00000000 },
+       { 0xa348, 0x3fffffff },
+       { 0xa34c, 0x3fffffff },
+       { 0xa350, 0x3fffffff },
+       { 0xa354, 0x0003ffff },
+       { 0xa358, 0x79a8aa1f },
+       { 0xa35c, 0x066c420f },
+       { 0xa360, 0x0f282207 },
+       { 0xa364, 0x17601685 },
+       { 0xa368, 0x1f801104 },
+       { 0xa36c, 0x37a00c03 },
+       { 0xa370, 0x3fc40883 },
+       { 0xa374, 0x57c00803 },
+       { 0xa378, 0x5fd80682 },
+       { 0xa37c, 0x7fe00482 },
+       { 0xa380, 0x7f3c7bba },
+       { 0xa384, 0xf3307ff0 },
 };
 
 /* Initial mode-specific settings for RF2413/2414 (Written after ar5212_ini) */
-/* XXX: No dumps for turbog yet, so turbog is the same with g here with some
- * minor tweaking based on dumps from other chips */
+/* XXX: a mode ? */
 static const struct ath5k_ini_mode rf2413_ini_mode_end[] = {
        { AR5K_TXCFG,
-       /*            b         g           gTurbo */
-               { 0x00000015, 0x00000015, 0x00000015 } },
+       /*      a/XR       aTurbo         b        g (DYN)     gTurbo     */
+          { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } },
        { AR5K_USEC_5211,
-               { 0x04e01395, 0x12e013ab, 0x098813cf } },
-       { AR5K_PHY(10),
-               { 0x05020000, 0x0a020001, 0x0a020001 } },
-       { AR5K_PHY(13),
-               { 0x00000e00, 0x00000e00, 0x00000e00 } },
-       { AR5K_PHY(14),
-               { 0x0000000a, 0x0000000a, 0x0000000a } },
-       { AR5K_PHY(18),
-               { 0x001a6a64, 0x001a6a64, 0x001a6a64 } },
-       { AR5K_PHY(20),
-               { 0x0de8b0da, 0x0c98b0da, 0x0c98b0da } },
+          { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
+       { AR5K_PHY_RF_CTL3,
+          { 0x0a020001, 0x0a020001, 0x05020000, 0x0a020001, 0x0a020001 } },
+       { AR5K_PHY_RF_CTL4,
+          { 0x00000e00, 0x00000e00, 0x00000e00, 0x00000e00, 0x00000e00 } },
+       { AR5K_PHY_PA_CTL,
+          { 0x00000002, 0x00000002, 0x0000000a, 0x0000000a, 0x0000000a } },
+       { AR5K_PHY_GAIN,
+          { 0x0018da6d, 0x0018da6d, 0x001a6a64, 0x001a6a64, 0x001a6a64 } },
+       { AR5K_PHY_DESIRED_SIZE,
+          { 0x0de8b4e0, 0x0de8b4e0, 0x0de8b0da, 0x0c98b0da, 0x0de8b0da } },
        { AR5K_PHY_SIG,
-               { 0x7ee80d2e, 0x7ec80d2e, 0x7ec80d2e } },
+          { 0x7e800d2e, 0x7e800d2e, 0x7ee80d2e, 0x7ec80d2e, 0x7e800d2e } },
        { AR5K_PHY_AGCCOARSE,
-               { 0x3137665e, 0x3139605e, 0x3139605e } },
-       { AR5K_PHY(27),
-               { 0x050cb081, 0x050cb081, 0x050cb081 } },
+          { 0x3137665e, 0x3137665e, 0x3137665e, 0x3139605e, 0x3137665e } },
+       { AR5K_PHY_WEAK_OFDM_LOW_THR,
+          { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
        { AR5K_PHY_RX_DELAY,
-               { 0x0000044c, 0x00000898, 0x000007d0 } },
+          { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
        { AR5K_PHY_FRAME_CTL_5211,
-               { 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },
+          { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },
        { AR5K_PHY_CCKTXCTL,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(642),
-               { 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
+          { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { AR5K_PHY_CCK_CROSSCORR,
+          { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
        { AR5K_PHY_GAIN_2GHZ,
-               { 0x0042c140, 0x0042c140, 0x0042c140 } },
-       { 0xa21c,
-               { 0x1863800a, 0x1883800a, 0x1883800a } },
-       { AR5K_DCU_FP,
-               { 0x000003e0, 0x000003e0, 0x000003e0 } },
-       { 0x8060,
-               { 0x0000000f, 0x0000000f, 0x0000000f } },
-       { 0x8118,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x811c,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8120,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8124,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8128,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x812c,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8130,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8134,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8138,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x813c,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0x8140,
-               { 0x800000a8, 0x800000a8, 0x800000a8 } },
-       { 0x8144,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY_AGC,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(11),
-               { 0x0000a000, 0x0000a000, 0x0000a000 } },
-       { AR5K_PHY(15),
-               { 0x00200400, 0x00200400, 0x00200400 } },
-       { AR5K_PHY(19),
-               { 0x1284233c, 0x1284233c, 0x1284233c } },
-       { AR5K_PHY_SCR,
-               { 0x0000001f, 0x0000001f, 0x0000001f } },
-       { AR5K_PHY_SLMT,
-               { 0x00000080, 0x00000080, 0x00000080 } },
-       { AR5K_PHY_SCAL,
-               { 0x0000000e, 0x0000000e, 0x0000000e } },
-       { AR5K_PHY(86),
-               { 0x000000ff, 0x000000ff, 0x000000ff } },
-       { AR5K_PHY(96),
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(97),
-               { 0x02800000, 0x02800000, 0x02800000 } },
-       { AR5K_PHY(104),
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(120),
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { AR5K_PHY(121),
-               { 0xaaaaaaaa, 0xaaaaaaaa, 0xaaaaaaaa } },
-       { AR5K_PHY(122),
-               { 0x3c466478, 0x3c466478, 0x3c466478 } },
-       { AR5K_PHY(123),
-               { 0x000000aa, 0x000000aa, 0x000000aa } },
-       { AR5K_PHY_SCLOCK,
-               { 0x0000000c, 0x0000000c, 0x0000000c } },
-       { AR5K_PHY_SDELAY,
-               { 0x000000ff, 0x000000ff, 0x000000ff } },
-       { AR5K_PHY_SPENDING,
-               { 0x00000014, 0x00000014, 0x00000014 } },
-       { 0xa228,
-               { 0x000009b5, 0x000009b5, 0x000009b5 } },
-       { 0xa23c,
-               { 0x93c889af, 0x93c889af, 0x93c889af } },
-       { 0xa24c,
-               { 0x00000001, 0x00000001, 0x00000001 } },
-       { 0xa250,
-               { 0x0000a000, 0x0000a000, 0x0000a000 } },
-       { 0xa254,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa258,
-               { 0x0cc75380, 0x0cc75380, 0x0cc75380 } },
-       { 0xa25c,
-               { 0x0f0f0f01, 0x0f0f0f01, 0x0f0f0f01 } },
-       { 0xa260,
-               { 0x5f690f01, 0x5f690f01, 0x5f690f01 } },
-       { 0xa264,
-               { 0x00418a11, 0x00418a11, 0x00418a11 } },
-       { 0xa268,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa26c,
-               { 0x0c30c16a, 0x0c30c16a, 0x0c30c16a } },
-       { 0xa270,
-               { 0x00820820, 0x00820820, 0x00820820 } },
-       { 0xa274,
-               { 0x001b7caa, 0x001b7caa, 0x001b7caa } },
-       { 0xa278,
-               { 0x1ce739ce, 0x1ce739ce, 0x1ce739ce } },
-       { 0xa27c,
-               { 0x051701ce, 0x051701ce, 0x051701ce } },
-       { 0xa300,
-               { 0x18010000, 0x18010000, 0x18010000 } },
-       { 0xa304,
-               { 0x30032602, 0x30032602, 0x30032602 } },
-       { 0xa308,
-               { 0x48073e06, 0x48073e06, 0x48073e06 } },
-       { 0xa30c,
-               { 0x560b4c0a, 0x560b4c0a, 0x560b4c0a } },
-       { 0xa310,
-               { 0x641a600f, 0x641a600f, 0x641a600f } },
-       { 0xa314,
-               { 0x784f6e1b, 0x784f6e1b, 0x784f6e1b } },
-       { 0xa318,
-               { 0x868f7c5a, 0x868f7c5a, 0x868f7c5a } },
-       { 0xa31c,
-               { 0x8ecf865b, 0x8ecf865b, 0x8ecf865b } },
-       { 0xa320,
-               { 0x9d4f970f, 0x9d4f970f, 0x9d4f970f } },
-       { 0xa324,
-               { 0xa5cfa18f, 0xa5cfa18f, 0xa5cfa18f } },
-       { 0xa328,
-               { 0xb55faf1f, 0xb55faf1f, 0xb55faf1f } },
-       { 0xa32c,
-               { 0xbddfb99f, 0xbddfb99f, 0xbddfb99f } },
-       { 0xa330,
-               { 0xcd7fc73f, 0xcd7fc73f, 0xcd7fc73f } },
-       { 0xa334,
-               { 0xd5ffd1bf, 0xd5ffd1bf, 0xd5ffd1bf } },
-       { 0xa338,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa33c,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa340,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa344,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 0xa348,
-               { 0x3fffffff, 0x3fffffff, 0x3fffffff } },
-       { 0xa34c,
-               { 0x3fffffff, 0x3fffffff, 0x3fffffff } },
-       { 0xa350,
-               { 0x3fffffff, 0x3fffffff, 0x3fffffff } },
-       { 0xa354,
-               { 0x0003ffff, 0x0003ffff, 0x0003ffff } },
-       { 0xa358,
-               { 0x79a8aa1f, 0x79a8aa1f, 0x79a8aa1f } },
-       { 0xa35c,
-               { 0x066c420f, 0x066c420f, 0x066c420f } },
-       { 0xa360,
-               { 0x0f282207, 0x0f282207, 0x0f282207 } },
-       { 0xa364,
-               { 0x17601685, 0x17601685, 0x17601685 } },
-       { 0xa368,
-               { 0x1f801104, 0x1f801104, 0x1f801104 } },
-       { 0xa36c,
-               { 0x37a00c03, 0x37a00c03, 0x37a00c03 } },
-       { 0xa370,
-               { 0x3fc40883, 0x3fc40883, 0x3fc40883 } },
-       { 0xa374,
-               { 0x57c00803, 0x57c00803, 0x57c00803 } },
-       { 0xa378,
-               { 0x5fd80682, 0x5fd80682, 0x5fd80682 } },
-       { 0xa37c,
-               { 0x7fe00482, 0x7fe00482, 0x7fe00482 } },
-       { 0xa380,
-               { 0x7f3c7bba, 0x7f3c7bba, 0x7f3c7bba } },
-       { 0xa384,
-               { 0xf3307ff0, 0xf3307ff0, 0xf3307ff0 } },
+          { 0x002c0140, 0x002c0140, 0x0042c140, 0x0042c140, 0x0042c140 } },
+       { AR5K_PHY_CCK_RX_CTL_4,
+          { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } },
+};
+
+static const struct ath5k_ini rf2413_ini_common_end[] = {
+       { AR5K_DCU_FP,          0x000003e0 },
+       { AR5K_SEQ_MASK,        0x0000000f },
+       { AR5K_MIC_QOS_CTL,     0x00000000 },
+       { AR5K_MIC_QOS_SEL,     0x00000000 },
+       { AR5K_MISC_MODE,       0x00000000 },
+       { AR5K_OFDM_FIL_CNT,    0x00000000 },
+       { AR5K_CCK_FIL_CNT,     0x00000000 },
+       { AR5K_PHYERR_CNT1,     0x00000000 },
+       { AR5K_PHYERR_CNT1_MASK, 0x00000000 },
+       { AR5K_PHYERR_CNT2,     0x00000000 },
+       { AR5K_PHYERR_CNT2_MASK, 0x00000000 },
+       { AR5K_TSF_THRES,       0x00000000 },
+       { 0x8140,               0x800000a8 },
+       { 0x8144,               0x00000000 },
+       { AR5K_PHY_AGC,         0x00000000 },
+       { AR5K_PHY_ADC_CTL,     0x0000a000 },
+       { 0x983c,               0x00200400 },
+       { AR5K_PHY_GAIN_OFFSET, 0x1284233c },
+       { AR5K_PHY_SCR,         0x0000001f },
+       { AR5K_PHY_SLMT,        0x00000080 },
+       { AR5K_PHY_SCAL,        0x0000000e },
+       { 0x9958,               0x000000ff },
+       { AR5K_PHY_TIMING_7,    0x00000000 },
+       { AR5K_PHY_TIMING_8,    0x02800000 },
+       { AR5K_PHY_TIMING_11,   0x00000000 },
+       { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
+       { 0x99e4,               0xaaaaaaaa },
+       { 0x99e8,               0x3c466478 },
+       { 0x99ec,               0x000000aa },
+       { AR5K_PHY_SCLOCK,      0x0000000c },
+       { AR5K_PHY_SDELAY,      0x000000ff },
+       { AR5K_PHY_SPENDING,    0x00000014 },
+       { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 },
+       { 0xa23c,               0x93c889af },
+       { AR5K_PHY_FAST_ADC,    0x00000001 },
+       { 0xa250,               0x0000a000 },
+       { AR5K_PHY_BLUETOOTH,   0x00000000 },
+       { AR5K_PHY_TPC_RG1,     0x0cc75380 },
+       { 0xa25c,               0x0f0f0f01 },
+       { 0xa260,               0x5f690f01 },
+       { 0xa264,               0x00418a11 },
+       { 0xa268,               0x00000000 },
+       { AR5K_PHY_TPC_RG5,     0x0c30c16a },
+       { 0xa270, 0x00820820 },
+       { 0xa274, 0x001b7caa },
+       { 0xa278, 0x1ce739ce },
+       { 0xa27c, 0x051701ce },
+       { 0xa300, 0x18010000 },
+       { 0xa304, 0x30032602 },
+       { 0xa308, 0x48073e06 },
+       { 0xa30c, 0x560b4c0a },
+       { 0xa310, 0x641a600f },
+       { 0xa314, 0x784f6e1b },
+       { 0xa318, 0x868f7c5a },
+       { 0xa31c, 0x8ecf865b },
+       { 0xa320, 0x9d4f970f },
+       { 0xa324, 0xa5cfa18f },
+       { 0xa328, 0xb55faf1f },
+       { 0xa32c, 0xbddfb99f },
+       { 0xa330, 0xcd7fc73f },
+       { 0xa334, 0xd5ffd1bf },
+       { 0xa338, 0x00000000 },
+       { 0xa33c, 0x00000000 },
+       { 0xa340, 0x00000000 },
+       { 0xa344, 0x00000000 },
+       { 0xa348, 0x3fffffff },
+       { 0xa34c, 0x3fffffff },
+       { 0xa350, 0x3fffffff },
+       { 0xa354, 0x0003ffff },
+       { 0xa358, 0x79a8aa1f },
+       { 0xa35c, 0x066c420f },
+       { 0xa360, 0x0f282207 },
+       { 0xa364, 0x17601685 },
+       { 0xa368, 0x1f801104 },
+       { 0xa36c, 0x37a00c03 },
+       { 0xa370, 0x3fc40883 },
+       { 0xa374, 0x57c00803 },
+       { 0xa378, 0x5fd80682 },
+       { 0xa37c, 0x7fe00482 },
+       { 0xa380, 0x7f3c7bba },
+       { 0xa384, 0xf3307ff0 },
 };
 
 /* Initial mode-specific settings for RF2425 (Written after ar5212_ini) */
-/* XXX: No dumps for turbog yet, so turbog is the same with g here with some
- * minor tweaking based on dumps from other chips */
+/* XXX: a mode ? */
 static const struct ath5k_ini_mode rf2425_ini_mode_end[] = {
        { AR5K_TXCFG,
-       /*             g        gTurbo */
-               { 0x00000015, 0x00000015 } },
+       /*      a/XR       aTurbo         b        g (DYN)     gTurbo     */
+          { 0x00000015, 0x00000015, 0x00000015, 0x00000015, 0x00000015 } },
        { AR5K_USEC_5211,
-               { 0x12e013ab, 0x098813cf } },
+          { 0x128d93a7, 0x098813cf, 0x04e01395, 0x12e013ab, 0x098813cf } },
        { AR5K_PHY_TURBO,
-               { 0x00000000, 0x00000003 } },
-       { AR5K_PHY(10),
-               { 0x0a020001, 0x0a020001 } },
-       { AR5K_PHY(13),
-               { 0x00000e0e, 0x00000e0e } },
-       { AR5K_PHY(14),
-               { 0x0000000b, 0x0000000b } },
-       { AR5K_PHY(17),
-               { 0x13721422, 0x13721422 } },
-       { AR5K_PHY(18),
-               { 0x00199a65, 0x00199a65 } },
-       { AR5K_PHY(20),
-               { 0x0c98b0da, 0x0c98b0da } },
+          { 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000001 } },
+       { AR5K_PHY_RF_CTL3,
+          { 0x0a020001, 0x0a020001, 0x05020100, 0x0a020001, 0x0a020001 } },
+       { AR5K_PHY_RF_CTL4,
+          { 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e } },
+       { AR5K_PHY_PA_CTL,
+          { 0x00000003, 0x00000003, 0x0000000b, 0x0000000b, 0x0000000b } },
+       { AR5K_PHY_SETTLING,
+          { 0x1372161c, 0x13721c25, 0x13721722, 0x13721422, 0x13721c25 } },
+       { AR5K_PHY_GAIN,
+          { 0x0018fa61, 0x0018fa61, 0x00199a65, 0x00199a65, 0x00199a65 } },
+       { AR5K_PHY_DESIRED_SIZE,
+          { 0x0c98b4e0, 0x0c98b4e0, 0x0c98b0da, 0x0c98b0da, 0x0c98b0da } },
        { AR5K_PHY_SIG,
-               { 0x7ec80d2e, 0x7ec80d2e } },
+          { 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e, 0x7ec80d2e } },
        { AR5K_PHY_AGCCOARSE,
-               { 0x3139605e, 0x3139605e } },
-       { AR5K_PHY(27),
-               { 0x050cb081, 0x050cb081 } },
+          { 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e, 0x3139605e } },
+       { AR5K_PHY_WEAK_OFDM_LOW_THR,
+          { 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081, 0x050cb081 } },
        { AR5K_PHY_RX_DELAY,
-               { 0x00000898, 0x000007d0 } },
+          { 0x000007d0, 0x000007d0, 0x0000044c, 0x00000898, 0x000007d0 } },
        { AR5K_PHY_FRAME_CTL_5211,
-               { 0xf7b81000, 0xf7b81000 } },
+          { 0xf7b81000, 0xf7b81000, 0xf7b80d00, 0xf7b81000, 0xf7b81000 } },
        { AR5K_PHY_CCKTXCTL,
-               { 0x00000000, 0x00000000 } },
-       { AR5K_PHY(642),
-               { 0xd03e6788, 0xd03e6788 } },
+          { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { AR5K_PHY_CCK_CROSSCORR,
+          { 0xd6be6788, 0xd6be6788, 0xd03e6788, 0xd03e6788, 0xd03e6788 } },
        { AR5K_PHY_GAIN_2GHZ,
-               { 0x0052c140, 0x0052c140 } },
-       { 0xa21c,
-               { 0x1883800a, 0x1883800a } },
+          { 0x00000140, 0x00000140, 0x0052c140, 0x0052c140, 0x0052c140 } },
+       { AR5K_PHY_CCK_RX_CTL_4,
+          { 0x1883800a, 0x1883800a, 0x1863800a, 0x1883800a, 0x1883800a } },
        { 0xa324,
-               { 0xa7cfa7cf, 0xa7cfa7cf } },
+          { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
        { 0xa328,
-               { 0xa7cfa7cf, 0xa7cfa7cf } },
+          { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
        { 0xa32c,
-               { 0xa7cfa7cf, 0xa7cfa7cf } },
+          { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
        { 0xa330,
-               { 0xa7cfa7cf, 0xa7cfa7cf } },
+          { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
        { 0xa334,
-               { 0xa7cfa7cf, 0xa7cfa7cf } },
-       { AR5K_DCU_FP,
-               { 0x000003e0, 0x000003e0 } },
-       { 0x8060,
-               { 0x0000000f, 0x0000000f } },
-       { 0x809c,
-               { 0x00000000, 0x00000000 } },
-       { 0x80a0,
-               { 0x00000000, 0x00000000 } },
-       { 0x8118,
-               { 0x00000000, 0x00000000 } },
-       { 0x811c,
-               { 0x00000000, 0x00000000 } },
-       { 0x8120,
-               { 0x00000000, 0x00000000 } },
-       { 0x8124,
-               { 0x00000000, 0x00000000 } },
-       { 0x8128,
-               { 0x00000000, 0x00000000 } },
-       { 0x812c,
-               { 0x00000000, 0x00000000 } },
-       { 0x8130,
-               { 0x00000000, 0x00000000 } },
-       { 0x8134,
-               { 0x00000000, 0x00000000 } },
-       { 0x8138,
-               { 0x00000000, 0x00000000 } },
-       { 0x813c,
-               { 0x00000000, 0x00000000 } },
-       { 0x8140,
-               { 0x800003f9, 0x800003f9 } },
-       { 0x8144,
-               { 0x00000000, 0x00000000 } },
-       { AR5K_PHY_AGC,
-               { 0x00000000, 0x00000000 } },
-       { AR5K_PHY(11),
-               { 0x0000a000, 0x0000a000 } },
-       { AR5K_PHY(15),
-               { 0x00200400, 0x00200400 } },
-       { AR5K_PHY(19),
-               { 0x1284233c, 0x1284233c } },
-       { AR5K_PHY_SCR,
-               { 0x0000001f, 0x0000001f } },
-       { AR5K_PHY_SLMT,
-               { 0x00000080, 0x00000080 } },
-       { AR5K_PHY_SCAL,
-               { 0x0000000e, 0x0000000e } },
-       { AR5K_PHY(86),
-               { 0x00081fff, 0x00081fff } },
-       { AR5K_PHY(96),
-               { 0x00000000, 0x00000000 } },
-       { AR5K_PHY(97),
-               { 0x02800000, 0x02800000 } },
-       { AR5K_PHY(104),
-               { 0x00000000, 0x00000000 } },
-       { AR5K_PHY(119),
-               { 0xfebadbe8, 0xfebadbe8 } },
-       { AR5K_PHY(120),
-               { 0x00000000, 0x00000000 } },
-       { AR5K_PHY(121),
-               { 0xaaaaaaaa, 0xaaaaaaaa } },
-       { AR5K_PHY(122),
-               { 0x3c466478, 0x3c466478 } },
-       { AR5K_PHY(123),
-               { 0x000000aa, 0x000000aa } },
-       { AR5K_PHY_SCLOCK,
-               { 0x0000000c, 0x0000000c } },
-       { AR5K_PHY_SDELAY,
-               { 0x000000ff, 0x000000ff } },
-       { AR5K_PHY_SPENDING,
-               { 0x00000014, 0x00000014 } },
-       { 0xa228,
-               { 0x000009b5, 0x000009b5 } },
-       { AR5K_PHY_TXPOWER_RATE3,
-               { 0x20202020, 0x20202020 } },
-       { AR5K_PHY_TXPOWER_RATE4,
-               { 0x20202020, 0x20202020 } },
-       { 0xa23c,
-               { 0x93c889af, 0x93c889af } },
-       { 0xa24c,
-               { 0x00000001, 0x00000001 } },
-       { 0xa250,
-               { 0x0000a000, 0x0000a000 } },
-       { 0xa254,
-               { 0x00000000, 0x00000000 } },
-       { 0xa258,
-               { 0x0cc75380, 0x0cc75380 } },
-       { 0xa25c,
-               { 0x0f0f0f01, 0x0f0f0f01 } },
-       { 0xa260,
-               { 0x5f690f01, 0x5f690f01 } },
-       { 0xa264,
-               { 0x00418a11, 0x00418a11 } },
-       { 0xa268,
-               { 0x00000000, 0x00000000 } },
-       { 0xa26c,
-               { 0x0c30c166, 0x0c30c166 } },
-       { 0xa270,
-               { 0x00820820, 0x00820820 } },
-       { 0xa274,
-               { 0x081a3caa, 0x081a3caa } },
-       { 0xa278,
-               { 0x1ce739ce, 0x1ce739ce } },
-       { 0xa27c,
-               { 0x051701ce, 0x051701ce } },
-       { 0xa300,
-               { 0x16010000, 0x16010000 } },
-       { 0xa304,
-               { 0x2c032402, 0x2c032402 } },
-       { 0xa308,
-               { 0x48433e42, 0x48433e42 } },
-       { 0xa30c,
-               { 0x5a0f500b, 0x5a0f500b } },
-       { 0xa310,
-               { 0x6c4b624a, 0x6c4b624a } },
-       { 0xa314,
-               { 0x7e8b748a, 0x7e8b748a } },
-       { 0xa318,
-               { 0x96cf8ccb, 0x96cf8ccb } },
-       { 0xa31c,
-               { 0xa34f9d0f, 0xa34f9d0f } },
-       { 0xa320,
-               { 0xa7cfa58f, 0xa7cfa58f } },
-       { 0xa348,
-               { 0x3fffffff, 0x3fffffff } },
-       { 0xa34c,
-               { 0x3fffffff, 0x3fffffff } },
-       { 0xa350,
-               { 0x3fffffff, 0x3fffffff } },
-       { 0xa354,
-               { 0x0003ffff, 0x0003ffff } },
-       { 0xa358,
-               { 0x79a8aa1f, 0x79a8aa1f } },
-       { 0xa35c,
-               { 0x066c420f, 0x066c420f } },
-       { 0xa360,
-               { 0x0f282207, 0x0f282207 } },
-       { 0xa364,
-               { 0x17601685, 0x17601685 } },
-       { 0xa368,
-               { 0x1f801104, 0x1f801104 } },
-       { 0xa36c,
-               { 0x37a00c03, 0x37a00c03 } },
-       { 0xa370,
-               { 0x3fc40883, 0x3fc40883 } },
-       { 0xa374,
-               { 0x57c00803, 0x57c00803 } },
-       { 0xa378,
-               { 0x5fd80682, 0x5fd80682 } },
-       { 0xa37c,
-               { 0x7fe00482, 0x7fe00482 } },
-       { 0xa380,
-               { 0x7f3c7bba, 0x7f3c7bba } },
-       { 0xa384,
-               { 0xf3307ff0, 0xf3307ff0 } },
+          { 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf, 0xa7cfa7cf } },
+};
+
+static const struct ath5k_ini rf2425_ini_common_end[] = {
+       { AR5K_DCU_FP,          0x000003e0 },
+       { AR5K_SEQ_MASK,        0x0000000f },
+       { 0x809c,               0x00000000 },
+       { 0x80a0,               0x00000000 },
+       { AR5K_MIC_QOS_CTL,     0x00000000 },
+       { AR5K_MIC_QOS_SEL,     0x00000000 },
+       { AR5K_MISC_MODE,       0x00000000 },
+       { AR5K_OFDM_FIL_CNT,    0x00000000 },
+       { AR5K_CCK_FIL_CNT,     0x00000000 },
+       { AR5K_PHYERR_CNT1,     0x00000000 },
+       { AR5K_PHYERR_CNT1_MASK, 0x00000000 },
+       { AR5K_PHYERR_CNT2,     0x00000000 },
+       { AR5K_PHYERR_CNT2_MASK, 0x00000000 },
+       { AR5K_TSF_THRES,       0x00000000 },
+       { 0x8140,               0x800003f9 },
+       { 0x8144,               0x00000000 },
+       { AR5K_PHY_AGC,         0x00000000 },
+       { AR5K_PHY_ADC_CTL,     0x0000a000 },
+       { 0x983c,               0x00200400 },
+       { AR5K_PHY_GAIN_OFFSET, 0x1284233c },
+       { AR5K_PHY_SCR,         0x0000001f },
+       { AR5K_PHY_SLMT,        0x00000080 },
+       { AR5K_PHY_SCAL,        0x0000000e },
+       { 0x9958,               0x00081fff },
+       { AR5K_PHY_TIMING_7,    0x00000000 },
+       { AR5K_PHY_TIMING_8,    0x02800000 },
+       { AR5K_PHY_TIMING_11,   0x00000000 },
+       { 0x99dc,               0xfebadbe8 },
+       { AR5K_PHY_HEAVY_CLIP_ENABLE, 0x00000000 },
+       { 0x99e4,               0xaaaaaaaa },
+       { 0x99e8,               0x3c466478 },
+       { 0x99ec,               0x000000aa },
+       { AR5K_PHY_SCLOCK,      0x0000000c },
+       { AR5K_PHY_SDELAY,      0x000000ff },
+       { AR5K_PHY_SPENDING,    0x00000014 },
+       { AR5K_PHY_DAG_CCK_CTL, 0x000009b5 },
+       { AR5K_PHY_TXPOWER_RATE3, 0x20202020 },
+       { AR5K_PHY_TXPOWER_RATE4, 0x20202020 },
+       { 0xa23c,               0x93c889af },
+       { AR5K_PHY_FAST_ADC,    0x00000001 },
+       { 0xa250,               0x0000a000 },
+       { AR5K_PHY_BLUETOOTH,   0x00000000 },
+       { AR5K_PHY_TPC_RG1,     0x0cc75380 },
+       { 0xa25c,               0x0f0f0f01 },
+       { 0xa260,               0x5f690f01 },
+       { 0xa264,               0x00418a11 },
+       { 0xa268,               0x00000000 },
+       { AR5K_PHY_TPC_RG5,     0x0c30c166 },
+       { 0xa270, 0x00820820 },
+       { 0xa274, 0x081a3caa },
+       { 0xa278, 0x1ce739ce },
+       { 0xa27c, 0x051701ce },
+       { 0xa300, 0x16010000 },
+       { 0xa304, 0x2c032402 },
+       { 0xa308, 0x48433e42 },
+       { 0xa30c, 0x5a0f500b },
+       { 0xa310, 0x6c4b624a },
+       { 0xa314, 0x7e8b748a },
+       { 0xa318, 0x96cf8ccb },
+       { 0xa31c, 0xa34f9d0f },
+       { 0xa320, 0xa7cfa58f },
+       { 0xa348, 0x3fffffff },
+       { 0xa34c, 0x3fffffff },
+       { 0xa350, 0x3fffffff },
+       { 0xa354, 0x0003ffff },
+       { 0xa358, 0x79a8aa1f },
+       { 0xa35c, 0x066c420f },
+       { 0xa360, 0x0f282207 },
+       { 0xa364, 0x17601685 },
+       { 0xa368, 0x1f801104 },
+       { 0xa36c, 0x37a00c03 },
+       { 0xa370, 0x3fc40883 },
+       { 0xa374, 0x57c00803 },
+       { 0xa378, 0x5fd80682 },
+       { 0xa37c, 0x7fe00482 },
+       { 0xa380, 0x7f3c7bba },
+       { 0xa384, 0xf3307ff0 },
 };
 
 /*
@@ -1560,7 +1297,7 @@ static const struct ath5k_ini rf5111_ini_bbgain[] = {
        { AR5K_BB_GAIN(63), 0x00000016 },
 };
 
-/* RF5112 Initial BaseBand Gain settings (Same for RF5413/5414) */
+/* RF5112 Initial BaseBand Gain settings (Same for RF5413/5414+) */
 static const struct ath5k_ini rf5112_ini_bbgain[] = {
        { AR5K_BB_GAIN(0), 0x00000000 },
        { AR5K_BB_GAIN(1), 0x00000001 },
@@ -1691,87 +1428,97 @@ int ath5k_hw_write_initvals(struct ath5k_hw *ah, u8 mode, bool change_channel)
                /*
                 * Write initial settings common for all modes
                 */
-               ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini),
-                                       ar5212_ini, change_channel);
+               ath5k_hw_ini_registers(ah, ARRAY_SIZE(ar5212_ini_common_start),
+                               ar5212_ini_common_start, change_channel);
 
                /* Second set of mode-specific settings */
-               if (ah->ah_radio == AR5K_RF5111) {
+               switch (ah->ah_radio) {
+               case AR5K_RF5111:
 
                        ath5k_hw_ini_mode_registers(ah,
-                                       ARRAY_SIZE(ar5212_rf5111_ini_mode_end),
-                                       ar5212_rf5111_ini_mode_end, mode);
+                                       ARRAY_SIZE(rf5111_ini_mode_end),
+                                       rf5111_ini_mode_end, mode);
+
+                       ath5k_hw_ini_registers(ah,
+                                       ARRAY_SIZE(rf5111_ini_common_end),
+                                       rf5111_ini_common_end, change_channel);
 
                        /* Baseband gain table */
                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5111_ini_bbgain),
                                        rf5111_ini_bbgain, change_channel);
 
-               } else if (ah->ah_radio == AR5K_RF5112) {
+                       break;
+               case AR5K_RF5112:
 
                        ath5k_hw_ini_mode_registers(ah,
-                                       ARRAY_SIZE(ar5212_rf5112_ini_mode_end),
-                                       ar5212_rf5112_ini_mode_end, mode);
+                                       ARRAY_SIZE(rf5112_ini_mode_end),
+                                       rf5112_ini_mode_end, mode);
+
+                       ath5k_hw_ini_registers(ah,
+                                       ARRAY_SIZE(rf5112_ini_common_end),
+                                       rf5112_ini_common_end, change_channel);
 
                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_bbgain),
                                        rf5112_ini_bbgain, change_channel);
 
-               } else if (ah->ah_radio == AR5K_RF5413) {
+                       break;
+               case AR5K_RF5413:
 
                        ath5k_hw_ini_mode_registers(ah,
                                        ARRAY_SIZE(rf5413_ini_mode_end),
                                        rf5413_ini_mode_end, mode);
 
+                       ath5k_hw_ini_registers(ah,
+                                       ARRAY_SIZE(rf5413_ini_common_end),
+                                       rf5413_ini_common_end, change_channel);
+
                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_bbgain),
                                        rf5112_ini_bbgain, change_channel);
 
-               } else if (ah->ah_radio == AR5K_RF2413) {
-
-                       if (mode < 2) {
-                               ATH5K_ERR(ah->ah_sc,
-                                       "unsupported channel mode: %d\n", mode);
-                               return -EINVAL;
-                       }
-                       mode = mode - 2;
-
-                       /* Override a setting from ar5212_ini */
-                       ath5k_hw_reg_write(ah, 0x018830c6, AR5K_PHY(648));
+                       break;
+               case AR5K_RF2316:
+               case AR5K_RF2413:
 
                        ath5k_hw_ini_mode_registers(ah,
                                        ARRAY_SIZE(rf2413_ini_mode_end),
                                        rf2413_ini_mode_end, mode);
 
-                       /* Baseband gain table */
                        ath5k_hw_ini_registers(ah,
-                                       ARRAY_SIZE(rf5112_ini_bbgain),
-                                       rf5112_ini_bbgain, change_channel);
-
-               } else if (ah->ah_radio == AR5K_RF2425) {
+                                       ARRAY_SIZE(rf2413_ini_common_end),
+                                       rf2413_ini_common_end, change_channel);
 
-                       if (mode < 2) {
-                               ATH5K_ERR(ah->ah_sc,
-                                       "unsupported channel mode: %d\n", mode);
-                               return -EINVAL;
+                       /* Override settings from rf2413_ini_common_end */
+                       if (ah->ah_radio == AR5K_RF2316) {
+                               ath5k_hw_reg_write(ah, 0x00004000,
+                                                       AR5K_PHY_AGC);
+                               ath5k_hw_reg_write(ah, 0x081b7caa,
+                                                       0xa274);
                        }
 
-                       /* Map b to g */
-                       if (mode == 2)
-                               mode = 0;
-                       else
-                               mode = mode - 3;
-
-                       /* Override a setting from ar5212_ini */
-                       ath5k_hw_reg_write(ah, 0x018830c6, AR5K_PHY(648));
+                       ath5k_hw_ini_registers(ah,
+                                       ARRAY_SIZE(rf5112_ini_bbgain),
+                                       rf5112_ini_bbgain, change_channel);
+                       break;
+               case AR5K_RF2317:
+               case AR5K_RF2425:
 
                        ath5k_hw_ini_mode_registers(ah,
                                        ARRAY_SIZE(rf2425_ini_mode_end),
                                        rf2425_ini_mode_end, mode);
 
-                       /* Baseband gain table */
+                       ath5k_hw_ini_registers(ah,
+                                       ARRAY_SIZE(rf2413_ini_common_end),
+                                       rf2413_ini_common_end, change_channel);
+
                        ath5k_hw_ini_registers(ah,
                                        ARRAY_SIZE(rf5112_ini_bbgain),
                                        rf5112_ini_bbgain, change_channel);
+                       break;
+               default:
+                       return -EINVAL;
 
                }
 
index 75eb9f43c7417980266d2eb652f7ac5a9ad70580..f8a4a69602707bc95256ba4c9d252cc1585fc970 100644 (file)
@@ -645,6 +645,23 @@ u64 ath5k_hw_get_tsf64(struct ath5k_hw *ah)
        return ath5k_hw_reg_read(ah, AR5K_TSF_L32) | (tsf << 32);
 }
 
+/**
+ * ath5k_hw_set_tsf64 - Set a new 64bit TSF
+ *
+ * @ah: The &struct ath5k_hw
+ * @tsf64: The new 64bit TSF
+ *
+ * Sets the new TSF
+ */
+void ath5k_hw_set_tsf64(struct ath5k_hw *ah, u64 tsf64)
+{
+       ATH5K_TRACE(ah->ah_sc);
+
+       ath5k_hw_reg_write(ah, 0x00000000, AR5K_TSF_L32);
+       ath5k_hw_reg_write(ah, (tsf64 >> 32) & 0xffffffff, AR5K_TSF_U32);
+       ath5k_hw_reg_write(ah, tsf64 & 0xffffffff, AR5K_TSF_L32);
+}
+
 /**
  * ath5k_hw_reset_tsf - Force a TSF reset
  *
@@ -1026,6 +1043,9 @@ int ath5k_keycache_type(const struct ieee80211_key_conf *key)
                        return AR5K_KEYTABLE_TYPE_40;
                else if (key->keylen == LEN_WEP104)
                        return AR5K_KEYTABLE_TYPE_104;
+               return -EINVAL;
+       default:
+               return -EINVAL;
        }
        return -EINVAL;
 }
@@ -1041,7 +1061,7 @@ int ath5k_hw_set_key(struct ath5k_hw *ah, u16 entry,
        __le32 key_v[5] = {};
        __le32 key0 = 0, key1 = 0;
        __le32 *rxmic, *txmic;
-       u32 keytype;
+       int keytype;
        u16 micentry = entry + AR5K_KEYTABLE_MIC_OFFSET;
        bool is_tkip;
        const u8 *key_ptr;
@@ -1139,7 +1159,7 @@ int ath5k_hw_set_key_lladdr(struct ath5k_hw *ah, u16 entry, const u8 *mac)
 
        /* MAC may be NULL if it's a broadcast key. In this case no need to
         * to compute AR5K_LOW_ID and AR5K_HIGH_ID as we already know it. */
-       if (unlikely(mac == NULL)) {
+       if (!mac) {
                low_id = 0xffffffff;
                high_id = 0xffff | AR5K_KEYTABLE_VALID;
        } else {
index 7ba18e09463b2ab981712bbfa87766e1a26a7caa..81f5bebc48b13d2a40074664af148e4f162ef1d2 100644 (file)
@@ -2,7 +2,7 @@
  * PHY functions
  *
  * Copyright (c) 2004-2007 Reyk Floeter <reyk@openbsd.org>
- * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm@gmail.com>
+ * Copyright (c) 2006-2009 Nick Kossifidis <mickflemm@gmail.com>
  * Copyright (c) 2007-2008 Jiri Slaby <jirislaby@gmail.com>
  *
  * Permission to use, copy, modify, and distribute this software for any
 #include "ath5k.h"
 #include "reg.h"
 #include "base.h"
-
-/* Struct to hold initial RF register values (RF Banks) */
-struct ath5k_ini_rf {
-       u8      rf_bank;        /* check out ath5k_reg.h */
-       u16     rf_register;    /* register address */
-       u32     rf_value[5];    /* register value for different modes (above) */
-};
-
-/*
- * Mode-specific RF Gain table (64bytes) for RF5111/5112
- * (RF5110 only comes with AR5210 and only supports a/turbo a mode so initial
- * RF Gain values are included in AR5K_AR5210_INI)
- */
-struct ath5k_ini_rfgain {
-       u16     rfg_register;   /* RF Gain register address */
-       u32     rfg_value[2];   /* [freq (see below)] */
-};
-
-struct ath5k_gain_opt {
-       u32                     go_default;
-       u32                     go_steps_count;
-       const struct ath5k_gain_opt_step        go_step[AR5K_GAIN_STEP_COUNT];
-};
-
-/* RF5111 mode-specific init registers */
-static const struct ath5k_ini_rf rfregs_5111[] = {
-       { 0, 0x989c,
-       /*    mode a/XR   mode aTurbo mode b      mode g      mode gTurbo */
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00380000, 0x00380000, 0x00380000, 0x00380000, 0x00380000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 0, 0x989c,
-           { 0x00000000, 0x00000000, 0x000000c0, 0x00000080, 0x00000080 } },
-       { 0, 0x989c,
-           { 0x000400f9, 0x000400f9, 0x000400ff, 0x000400fd, 0x000400fd } },
-       { 0, 0x98d4,
-           { 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004 } },
-       { 1, 0x98d4,
-           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
-       { 2, 0x98d4,
-           { 0x00000010, 0x00000014, 0x00000010, 0x00000010, 0x00000014 } },
-       { 3, 0x98d8,
-           { 0x00601068, 0x00601068, 0x00601068, 0x00601068, 0x00601068 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } },
-       { 6, 0x989c,
-           { 0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x0a000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x003800c0, 0x00380080, 0x023800c0, 0x003800c0, 0x003800c0 } },
-       { 6, 0x989c,
-           { 0x00020006, 0x00020006, 0x00000006, 0x00020006, 0x00020006 } },
-       { 6, 0x989c,
-           { 0x00000089, 0x00000089, 0x00000089, 0x00000089, 0x00000089 } },
-       { 6, 0x989c,
-           { 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0 } },
-       { 6, 0x989c,
-           { 0x00040007, 0x00040007, 0x00040007, 0x00040007, 0x00040007 } },
-       { 6, 0x98d4,
-           { 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a } },
-       { 7, 0x989c,
-           { 0x00000040, 0x00000048, 0x00000040, 0x00000040, 0x00000040 } },
-       { 7, 0x989c,
-           { 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010 } },
-       { 7, 0x989c,
-           { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } },
-       { 7, 0x989c,
-           { 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f } },
-       { 7, 0x989c,
-           { 0x000000f1, 0x000000f1, 0x00000061, 0x000000f1, 0x000000f1 } },
-       { 7, 0x989c,
-           { 0x0000904f, 0x0000904f, 0x0000904c, 0x0000904f, 0x0000904f } },
-       { 7, 0x989c,
-           { 0x0000125a, 0x0000125a, 0x0000129a, 0x0000125a, 0x0000125a } },
-       { 7, 0x98cc,
-           { 0x0000000e, 0x0000000e, 0x0000000f, 0x0000000e, 0x0000000e } },
-};
-
-/* Initial RF Gain settings for RF5111 */
-static const struct ath5k_ini_rfgain rfgain_5111[] = {
-       /*                            5Ghz      2Ghz    */
-       { AR5K_RF_GAIN(0),      { 0x000001a9, 0x00000000 } },
-       { AR5K_RF_GAIN(1),      { 0x000001e9, 0x00000040 } },
-       { AR5K_RF_GAIN(2),      { 0x00000029, 0x00000080 } },
-       { AR5K_RF_GAIN(3),      { 0x00000069, 0x00000150 } },
-       { AR5K_RF_GAIN(4),      { 0x00000199, 0x00000190 } },
-       { AR5K_RF_GAIN(5),      { 0x000001d9, 0x000001d0 } },
-       { AR5K_RF_GAIN(6),      { 0x00000019, 0x00000010 } },
-       { AR5K_RF_GAIN(7),      { 0x00000059, 0x00000044 } },
-       { AR5K_RF_GAIN(8),      { 0x00000099, 0x00000084 } },
-       { AR5K_RF_GAIN(9),      { 0x000001a5, 0x00000148 } },
-       { AR5K_RF_GAIN(10),     { 0x000001e5, 0x00000188 } },
-       { AR5K_RF_GAIN(11),     { 0x00000025, 0x000001c8 } },
-       { AR5K_RF_GAIN(12),     { 0x000001c8, 0x00000014 } },
-       { AR5K_RF_GAIN(13),     { 0x00000008, 0x00000042 } },
-       { AR5K_RF_GAIN(14),     { 0x00000048, 0x00000082 } },
-       { AR5K_RF_GAIN(15),     { 0x00000088, 0x00000178 } },
-       { AR5K_RF_GAIN(16),     { 0x00000198, 0x000001b8 } },
-       { AR5K_RF_GAIN(17),     { 0x000001d8, 0x000001f8 } },
-       { AR5K_RF_GAIN(18),     { 0x00000018, 0x00000012 } },
-       { AR5K_RF_GAIN(19),     { 0x00000058, 0x00000052 } },
-       { AR5K_RF_GAIN(20),     { 0x00000098, 0x00000092 } },
-       { AR5K_RF_GAIN(21),     { 0x000001a4, 0x0000017c } },
-       { AR5K_RF_GAIN(22),     { 0x000001e4, 0x000001bc } },
-       { AR5K_RF_GAIN(23),     { 0x00000024, 0x000001fc } },
-       { AR5K_RF_GAIN(24),     { 0x00000064, 0x0000000a } },
-       { AR5K_RF_GAIN(25),     { 0x000000a4, 0x0000004a } },
-       { AR5K_RF_GAIN(26),     { 0x000000e4, 0x0000008a } },
-       { AR5K_RF_GAIN(27),     { 0x0000010a, 0x0000015a } },
-       { AR5K_RF_GAIN(28),     { 0x0000014a, 0x0000019a } },
-       { AR5K_RF_GAIN(29),     { 0x0000018a, 0x000001da } },
-       { AR5K_RF_GAIN(30),     { 0x000001ca, 0x0000000e } },
-       { AR5K_RF_GAIN(31),     { 0x0000000a, 0x0000004e } },
-       { AR5K_RF_GAIN(32),     { 0x0000004a, 0x0000008e } },
-       { AR5K_RF_GAIN(33),     { 0x0000008a, 0x0000015e } },
-       { AR5K_RF_GAIN(34),     { 0x000001ba, 0x0000019e } },
-       { AR5K_RF_GAIN(35),     { 0x000001fa, 0x000001de } },
-       { AR5K_RF_GAIN(36),     { 0x0000003a, 0x00000009 } },
-       { AR5K_RF_GAIN(37),     { 0x0000007a, 0x00000049 } },
-       { AR5K_RF_GAIN(38),     { 0x00000186, 0x00000089 } },
-       { AR5K_RF_GAIN(39),     { 0x000001c6, 0x00000179 } },
-       { AR5K_RF_GAIN(40),     { 0x00000006, 0x000001b9 } },
-       { AR5K_RF_GAIN(41),     { 0x00000046, 0x000001f9 } },
-       { AR5K_RF_GAIN(42),     { 0x00000086, 0x00000039 } },
-       { AR5K_RF_GAIN(43),     { 0x000000c6, 0x00000079 } },
-       { AR5K_RF_GAIN(44),     { 0x000000c6, 0x000000b9 } },
-       { AR5K_RF_GAIN(45),     { 0x000000c6, 0x000001bd } },
-       { AR5K_RF_GAIN(46),     { 0x000000c6, 0x000001fd } },
-       { AR5K_RF_GAIN(47),     { 0x000000c6, 0x0000003d } },
-       { AR5K_RF_GAIN(48),     { 0x000000c6, 0x0000007d } },
-       { AR5K_RF_GAIN(49),     { 0x000000c6, 0x000000bd } },
-       { AR5K_RF_GAIN(50),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(51),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(52),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(53),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(54),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(55),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(56),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(57),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(58),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(59),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(60),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(61),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(62),     { 0x000000c6, 0x000000fd } },
-       { AR5K_RF_GAIN(63),     { 0x000000c6, 0x000000fd } },
-};
-
-static const struct ath5k_gain_opt rfgain_opt_5111 = {
-       4,
-       9,
-       {
-               { { 4, 1, 1, 1 }, 6 },
-               { { 4, 0, 1, 1 }, 4 },
-               { { 3, 1, 1, 1 }, 3 },
-               { { 4, 0, 0, 1 }, 1 },
-               { { 4, 1, 1, 0 }, 0 },
-               { { 4, 0, 1, 0 }, -2 },
-               { { 3, 1, 1, 0 }, -3 },
-               { { 4, 0, 0, 0 }, -4 },
-               { { 2, 1, 1, 0 }, -6 }
-       }
-};
-
-/* RF5112 mode-specific init registers */
-static const struct ath5k_ini_rf rfregs_5112[] = {
-       { 1, 0x98d4,
-       /*    mode a/XR   mode aTurbo mode b      mode g      mode gTurbo */
-           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
-       { 2, 0x98d0,
-           { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } },
-       { 3, 0x98dc,
-           { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } },
-       { 6, 0x989c,
-           { 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000 } },
-       { 6, 0x989c,
-           { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00660000, 0x00660000, 0x00660000, 0x00660000, 0x00660000 } },
-       { 6, 0x989c,
-           { 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000 } },
-       { 6, 0x989c,
-           { 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000 } },
-       { 6, 0x989c,
-           { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },
-       { 6, 0x989c,
-           { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },
-       { 6, 0x989c,
-           { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },
-       { 6, 0x989c,
-           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
-       { 6, 0x989c,
-           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
-       { 6, 0x989c,
-           { 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000 } },
-       { 6, 0x989c,
-           { 0x00600000, 0x00600000, 0x00600000, 0x00600000, 0x00600000 } },
-       { 6, 0x989c,
-           { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },
-       { 6, 0x989c,
-           { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } },
-       { 6, 0x989c,
-           { 0x00640000, 0x00640000, 0x00640000, 0x00640000, 0x00640000 } },
-       { 6, 0x989c,
-           { 0x00200000, 0x00200000, 0x00200000, 0x00200000, 0x00200000 } },
-       { 6, 0x989c,
-           { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } },
-       { 6, 0x989c,
-           { 0x00250000, 0x00250000, 0x00250000, 0x00250000, 0x00250000 } },
-       { 6, 0x989c,
-           { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },
-       { 6, 0x989c,
-           { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },
-       { 6, 0x989c,
-           { 0x00510000, 0x00510000, 0x00510000, 0x00510000, 0x00510000 } },
-       { 6, 0x989c,
-           { 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000 } },
-       { 6, 0x989c,
-           { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } },
-       { 6, 0x989c,
-           { 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000 } },
-       { 6, 0x989c,
-           { 0x00400000, 0x00400000, 0x00400000, 0x00400000, 0x00400000 } },
-       { 6, 0x989c,
-           { 0x03090000, 0x03090000, 0x03090000, 0x03090000, 0x03090000 } },
-       { 6, 0x989c,
-           { 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000 } },
-       { 6, 0x989c,
-           { 0x000000b0, 0x000000b0, 0x000000a8, 0x000000a8, 0x000000a8 } },
-       { 6, 0x989c,
-           { 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e } },
-       { 6, 0x989c,
-           { 0x006c4a41, 0x006c4a41, 0x006c4af1, 0x006c4a61, 0x006c4a61 } },
-       { 6, 0x989c,
-           { 0x0050892a, 0x0050892a, 0x0050892b, 0x0050892b, 0x0050892b } },
-       { 6, 0x989c,
-           { 0x00842400, 0x00842400, 0x00842400, 0x00842400, 0x00842400 } },
-       { 6, 0x989c,
-           { 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200 } },
-       { 6, 0x98d0,
-           { 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c } },
-       { 7, 0x989c,
-           { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } },
-       { 7, 0x989c,
-           { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } },
-       { 7, 0x989c,
-           { 0x0000000a, 0x0000000a, 0x00000012, 0x00000012, 0x00000012 } },
-       { 7, 0x989c,
-           { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },
-       { 7, 0x989c,
-           { 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1 } },
-       { 7, 0x989c,
-           { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },
-       { 7, 0x989c,
-           { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } },
-       { 7, 0x989c,
-           { 0x00000022, 0x00000022, 0x00000022, 0x00000022, 0x00000022 } },
-       { 7, 0x989c,
-           { 0x00000092, 0x00000092, 0x00000092, 0x00000092, 0x00000092 } },
-       { 7, 0x989c,
-           { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } },
-       { 7, 0x989c,
-           { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } },
-       { 7, 0x989c,
-           { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } },
-       { 7, 0x98c4,
-           { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
-};
-
-/* RF5112A mode-specific init registers */
-static const struct ath5k_ini_rf rfregs_5112a[] = {
-       { 1, 0x98d4,
-       /*    mode a/XR   mode aTurbo mode b      mode g      mode gTurbo */
-           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
-       { 2, 0x98d0,
-           { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } },
-       { 3, 0x98dc,
-           { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } },
-       { 6, 0x989c,
-           { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00800000, 0x00800000, 0x00800000, 0x00800000, 0x00800000 } },
-       { 6, 0x989c,
-           { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },
-       { 6, 0x989c,
-           { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00180000, 0x00180000, 0x00180000, 0x00180000, 0x00180000 } },
-       { 6, 0x989c,
-           { 0x00600000, 0x00600000, 0x006e0000, 0x006e0000, 0x006e0000 } },
-       { 6, 0x989c,
-           { 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000 } },
-       { 6, 0x989c,
-           { 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000 } },
-       { 6, 0x989c,
-           { 0x04480000, 0x04480000, 0x04480000, 0x04480000, 0x04480000 } },
-       { 6, 0x989c,
-           { 0x00220000, 0x00220000, 0x00220000, 0x00220000, 0x00220000 } },
-       { 6, 0x989c,
-           { 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000 } },
-       { 6, 0x989c,
-           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
-       { 6, 0x989c,
-           { 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000 } },
-       { 6, 0x989c,
-           { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },
-       { 6, 0x989c,
-           { 0x00190000, 0x00190000, 0x00190000, 0x00190000, 0x00190000 } },
-       { 6, 0x989c,
-           { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } },
-       { 6, 0x989c,
-           { 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000 } },
-       { 6, 0x989c,
-           { 0x00990000, 0x00990000, 0x00990000, 0x00990000, 0x00990000 } },
-       { 6, 0x989c,
-           { 0x00500000, 0x00500000, 0x00500000, 0x00500000, 0x00500000 } },
-       { 6, 0x989c,
-           { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },
-       { 6, 0x989c,
-           { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },
-       { 6, 0x989c,
-           { 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000 } },
-       { 6, 0x989c,
-           { 0x01740000, 0x01740000, 0x01740000, 0x01740000, 0x01740000 } },
-       { 6, 0x989c,
-           { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },
-       { 6, 0x989c,
-           { 0x86280000, 0x86280000, 0x86280000, 0x86280000, 0x86280000 } },
-       { 6, 0x989c,
-           { 0x31840000, 0x31840000, 0x31840000, 0x31840000, 0x31840000 } },
-       { 6, 0x989c,
-           { 0x00020080, 0x00020080, 0x00020080, 0x00020080, 0x00020080 } },
-       { 6, 0x989c,
-           { 0x00080009, 0x00080009, 0x00080009, 0x00080009, 0x00080009 } },
-       { 6, 0x989c,
-           { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2 } },
-       { 6, 0x989c,
-           { 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084 } },
-       { 6, 0x989c,
-           { 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4 } },
-       { 6, 0x989c,
-           { 0x00119220, 0x00119220, 0x00119220, 0x00119220, 0x00119220 } },
-       { 6, 0x989c,
-           { 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800 } },
-       { 6, 0x98d8,
-           { 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230 } },
-       { 7, 0x989c,
-           { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } },
-       { 7, 0x989c,
-           { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } },
-       { 7, 0x989c,
-           { 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012 } },
-       { 7, 0x989c,
-           { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },
-       { 7, 0x989c,
-           { 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9 } },
-       { 7, 0x989c,
-           { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },
-       { 7, 0x989c,
-           { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } },
-       { 7, 0x989c,
-           { 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2 } },
-       { 7, 0x989c,
-           { 0x00000052, 0x00000052, 0x00000052, 0x00000052, 0x00000052 } },
-       { 7, 0x989c,
-           { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } },
-       { 7, 0x989c,
-           { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } },
-       { 7, 0x989c,
-           { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } },
-       { 7, 0x98c4,
-           { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
-};
-
-
-static const struct ath5k_ini_rf rfregs_2112a[] = {
-       { 1, AR5K_RF_BUFFER_CONTROL_4,
-       /*         mode b       mode g    mode gTurbo */
-               { 0x00000020, 0x00000020, 0x00000020 } },
-       { 2, AR5K_RF_BUFFER_CONTROL_3,
-               { 0x03060408, 0x03060408, 0x03070408 } },
-       { 3, AR5K_RF_BUFFER_CONTROL_6,
-               { 0x00e020c0, 0x00e020c0, 0x00e020c0 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x0a000000, 0x0a000000, 0x0a000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00800000, 0x00800000, 0x00800000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x002a0000, 0x002a0000, 0x002a0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00010000, 0x00010000, 0x00010000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00180000, 0x00180000, 0x00180000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x006e0000, 0x006e0000, 0x006e0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00c70000, 0x00c70000, 0x00c70000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x004b0000, 0x004b0000, 0x004b0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x04480000, 0x04480000, 0x04480000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x002a0000, 0x002a0000, 0x002a0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00e40000, 0x00e40000, 0x00e40000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00fc0000, 0x00fc0000, 0x00fc0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x043f0000, 0x043f0000, 0x043f0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x0c0c0000, 0x0c0c0000, 0x0c0c0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x02190000, 0x02190000, 0x02190000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00240000, 0x00240000, 0x00240000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00b40000, 0x00b40000, 0x00b40000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00990000, 0x00990000, 0x00990000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00500000, 0x00500000, 0x00500000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x002a0000, 0x002a0000, 0x002a0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00120000, 0x00120000, 0x00120000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0xc0320000, 0xc0320000, 0xc0320000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x01740000, 0x01740000, 0x01740000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00110000, 0x00110000, 0x00110000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x86280000, 0x86280000, 0x86280000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x31840000, 0x31840000, 0x31840000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00f20080, 0x00f20080, 0x00f20080 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00070019, 0x00070019, 0x00070019 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x000000b2, 0x000000b2, 0x000000b2 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00b02184, 0x00b02184, 0x00b02184 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x004125a4, 0x004125a4, 0x004125a4 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00119220, 0x00119220, 0x00119220 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x001a4800, 0x001a4800, 0x001a4800 } },
-       { 6, AR5K_RF_BUFFER_CONTROL_5,
-               { 0x000b0230, 0x000b0230, 0x000b0230 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00000094, 0x00000094, 0x00000094 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00000091, 0x00000091, 0x00000091 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00000012, 0x00000012, 0x00000012 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00000080, 0x00000080, 0x00000080 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x000000d9, 0x000000d9, 0x000000d9 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00000060, 0x00000060, 0x00000060 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x000000f0, 0x000000f0, 0x000000f0 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x000000a2, 0x000000a2, 0x000000a2 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00000052, 0x00000052, 0x00000052 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x000000d4, 0x000000d4, 0x000000d4 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x000014cc, 0x000014cc, 0x000014cc } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x0000048c, 0x0000048c, 0x0000048c } },
-       { 7, AR5K_RF_BUFFER_CONTROL_1,
-               { 0x00000003, 0x00000003, 0x00000003 } },
-};
-
-/* RF5413/5414 mode-specific init registers */
-static const struct ath5k_ini_rf rfregs_5413[] = {
-       { 1, 0x98d4,
-       /*    mode a/XR   mode aTurbo mode b      mode g      mode gTurbo */
-           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
-       { 2, 0x98d0,
-           { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } },
-       { 3, 0x98dc,
-           { 0x00a000c0, 0x00a000c0, 0x00e000c0, 0x00e000c0, 0x00e000c0 } },
-       { 6, 0x989c,
-           { 0x33000000, 0x33000000, 0x33000000, 0x33000000, 0x33000000 } },
-       { 6, 0x989c,
-           { 0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000 } },
-       { 6, 0x989c,
-           { 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000 } },
-       { 6, 0x989c,
-           { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } },
-       { 6, 0x989c,
-           { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },
-       { 6, 0x989c,
-           { 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000 } },
-       { 6, 0x989c,
-           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
-       { 6, 0x989c,
-           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
-       { 6, 0x989c,
-           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
-       { 6, 0x989c,
-           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
-       { 6, 0x989c,
-           { 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000 } },
-       { 6, 0x989c,
-           { 0x00610000, 0x00610000, 0x00610000, 0x00610000, 0x00610000 } },
-       { 6, 0x989c,
-           { 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000 } },
-       { 6, 0x989c,
-           { 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000 } },
-       { 6, 0x989c,
-           { 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000 } },
-       { 6, 0x989c,
-           { 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000 } },
-       { 6, 0x989c,
-           { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } },
-       { 6, 0x989c,
-           { 0x00440000, 0x00440000, 0x00440000, 0x00440000, 0x00440000 } },
-       { 6, 0x989c,
-           { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },
-       { 6, 0x989c,
-           { 0x00100080, 0x00100080, 0x00100080, 0x00100080, 0x00100080 } },
-       { 6, 0x989c,
-           { 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034 } },
-       { 6, 0x989c,
-           { 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0 } },
-       { 6, 0x989c,
-           { 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f } },
-       { 6, 0x989c,
-           { 0x00510040, 0x00510040, 0x005100a0, 0x005100a0, 0x005100a0 } },
-       { 6, 0x989c,
-           { 0x0050006a, 0x0050006a, 0x005000dd, 0x005000dd, 0x005000dd } },
-       { 6, 0x989c,
-           { 0x00000001, 0x00000001, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x00004044, 0x00004044, 0x00004044, 0x00004044, 0x00004044 } },
-       { 6, 0x989c,
-           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, 0x989c,
-           { 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0 } },
-       { 6, 0x989c,
-           { 0x00002c00, 0x00002c00, 0x00003600, 0x00003600, 0x00003600 } },
-       { 6, 0x98c8,
-           { 0x00000403, 0x00000403, 0x00040403, 0x00040403, 0x00040403 } },
-       { 7, 0x989c,
-           { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
-       { 7, 0x989c,
-           { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
-       { 7, 0x98cc,
-           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
-};
-
-/* RF2413/2414 mode-specific init registers */
-static const struct ath5k_ini_rf rfregs_2413[] = {
-       { 1, AR5K_RF_BUFFER_CONTROL_4,
-       /*         mode b      mode g     mode gTurbo */
-               { 0x00000020, 0x00000020, 0x00000020 } },
-       { 2, AR5K_RF_BUFFER_CONTROL_3,
-               { 0x02001408, 0x02001408, 0x02001408 } },
-       { 3, AR5K_RF_BUFFER_CONTROL_6,
-               { 0x00e020c0, 0x00e020c0, 0x00e020c0 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0xf0000000, 0xf0000000, 0xf0000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x03000000, 0x03000000, 0x03000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x40400000, 0x40400000, 0x40400000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x65050000, 0x65050000, 0x65050000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00420000, 0x00420000, 0x00420000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00b50000, 0x00b50000, 0x00b50000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00030000, 0x00030000, 0x00030000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00f70000, 0x00f70000, 0x00f70000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x009d0000, 0x009d0000, 0x009d0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00220000, 0x00220000, 0x00220000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x04220000, 0x04220000, 0x04220000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00230018, 0x00230018, 0x00230018 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00280050, 0x00280050, 0x00280050 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x005000c3, 0x005000c3, 0x005000c3 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x0004007f, 0x0004007f, 0x0004007f } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000458, 0x00000458, 0x00000458 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x0000c000, 0x0000c000, 0x0000c000 } },
-       { 6, AR5K_RF_BUFFER_CONTROL_5,
-               { 0x00400230, 0x00400230, 0x00400230 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00006400, 0x00006400, 0x00006400 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00000800, 0x00000800, 0x00000800 } },
-       { 7, AR5K_RF_BUFFER_CONTROL_2,
-               { 0x0000000e, 0x0000000e, 0x0000000e } },
-};
-
-/* RF2425 mode-specific init registers */
-static const struct ath5k_ini_rf rfregs_2425[] = {
-       { 1, AR5K_RF_BUFFER_CONTROL_4,
-       /*         mode g     mode gTurbo */
-               { 0x00000020, 0x00000020 } },
-       { 2, AR5K_RF_BUFFER_CONTROL_3,
-               { 0x02001408, 0x02001408 } },
-       { 3, AR5K_RF_BUFFER_CONTROL_6,
-               { 0x00e020c0, 0x00e020c0 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x10000000, 0x10000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x002a0000, 0x002a0000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00100000, 0x00100000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00020000, 0x00020000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00730000, 0x00730000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00f80000, 0x00f80000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00e70000, 0x00e70000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00140000, 0x00140000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00910040, 0x00910040 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x0007001a, 0x0007001a } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00410000, 0x00410000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00810060, 0x00810060 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00020803, 0x00020803 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00000000, 0x00000000 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00001660, 0x00001660 } },
-       { 6, AR5K_RF_BUFFER,
-               { 0x00001688, 0x00001688 } },
-       { 6, AR5K_RF_BUFFER_CONTROL_1,
-               { 0x00000001, 0x00000001 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00006400, 0x00006400 } },
-       { 7, AR5K_RF_BUFFER,
-               { 0x00000800, 0x00000800 } },
-       { 7, AR5K_RF_BUFFER_CONTROL_2,
-               { 0x0000000e, 0x0000000e } },
-};
-
-/* Initial RF Gain settings for RF5112 */
-static const struct ath5k_ini_rfgain rfgain_5112[] = {
-       /*                            5Ghz      2Ghz    */
-       { AR5K_RF_GAIN(0),      { 0x00000007, 0x00000007 } },
-       { AR5K_RF_GAIN(1),      { 0x00000047, 0x00000047 } },
-       { AR5K_RF_GAIN(2),      { 0x00000087, 0x00000087 } },
-       { AR5K_RF_GAIN(3),      { 0x000001a0, 0x000001a0 } },
-       { AR5K_RF_GAIN(4),      { 0x000001e0, 0x000001e0 } },
-       { AR5K_RF_GAIN(5),      { 0x00000020, 0x00000020 } },
-       { AR5K_RF_GAIN(6),      { 0x00000060, 0x00000060 } },
-       { AR5K_RF_GAIN(7),      { 0x000001a1, 0x000001a1 } },
-       { AR5K_RF_GAIN(8),      { 0x000001e1, 0x000001e1 } },
-       { AR5K_RF_GAIN(9),      { 0x00000021, 0x00000021 } },
-       { AR5K_RF_GAIN(10),     { 0x00000061, 0x00000061 } },
-       { AR5K_RF_GAIN(11),     { 0x00000162, 0x00000162 } },
-       { AR5K_RF_GAIN(12),     { 0x000001a2, 0x000001a2 } },
-       { AR5K_RF_GAIN(13),     { 0x000001e2, 0x000001e2 } },
-       { AR5K_RF_GAIN(14),     { 0x00000022, 0x00000022 } },
-       { AR5K_RF_GAIN(15),     { 0x00000062, 0x00000062 } },
-       { AR5K_RF_GAIN(16),     { 0x00000163, 0x00000163 } },
-       { AR5K_RF_GAIN(17),     { 0x000001a3, 0x000001a3 } },
-       { AR5K_RF_GAIN(18),     { 0x000001e3, 0x000001e3 } },
-       { AR5K_RF_GAIN(19),     { 0x00000023, 0x00000023 } },
-       { AR5K_RF_GAIN(20),     { 0x00000063, 0x00000063 } },
-       { AR5K_RF_GAIN(21),     { 0x00000184, 0x00000184 } },
-       { AR5K_RF_GAIN(22),     { 0x000001c4, 0x000001c4 } },
-       { AR5K_RF_GAIN(23),     { 0x00000004, 0x00000004 } },
-       { AR5K_RF_GAIN(24),     { 0x000001ea, 0x0000000b } },
-       { AR5K_RF_GAIN(25),     { 0x0000002a, 0x0000004b } },
-       { AR5K_RF_GAIN(26),     { 0x0000006a, 0x0000008b } },
-       { AR5K_RF_GAIN(27),     { 0x000000aa, 0x000001ac } },
-       { AR5K_RF_GAIN(28),     { 0x000001ab, 0x000001ec } },
-       { AR5K_RF_GAIN(29),     { 0x000001eb, 0x0000002c } },
-       { AR5K_RF_GAIN(30),     { 0x0000002b, 0x00000012 } },
-       { AR5K_RF_GAIN(31),     { 0x0000006b, 0x00000052 } },
-       { AR5K_RF_GAIN(32),     { 0x000000ab, 0x00000092 } },
-       { AR5K_RF_GAIN(33),     { 0x000001ac, 0x00000193 } },
-       { AR5K_RF_GAIN(34),     { 0x000001ec, 0x000001d3 } },
-       { AR5K_RF_GAIN(35),     { 0x0000002c, 0x00000013 } },
-       { AR5K_RF_GAIN(36),     { 0x0000003a, 0x00000053 } },
-       { AR5K_RF_GAIN(37),     { 0x0000007a, 0x00000093 } },
-       { AR5K_RF_GAIN(38),     { 0x000000ba, 0x00000194 } },
-       { AR5K_RF_GAIN(39),     { 0x000001bb, 0x000001d4 } },
-       { AR5K_RF_GAIN(40),     { 0x000001fb, 0x00000014 } },
-       { AR5K_RF_GAIN(41),     { 0x0000003b, 0x0000003a } },
-       { AR5K_RF_GAIN(42),     { 0x0000007b, 0x0000007a } },
-       { AR5K_RF_GAIN(43),     { 0x000000bb, 0x000000ba } },
-       { AR5K_RF_GAIN(44),     { 0x000001bc, 0x000001bb } },
-       { AR5K_RF_GAIN(45),     { 0x000001fc, 0x000001fb } },
-       { AR5K_RF_GAIN(46),     { 0x0000003c, 0x0000003b } },
-       { AR5K_RF_GAIN(47),     { 0x0000007c, 0x0000007b } },
-       { AR5K_RF_GAIN(48),     { 0x000000bc, 0x000000bb } },
-       { AR5K_RF_GAIN(49),     { 0x000000fc, 0x000001bc } },
-       { AR5K_RF_GAIN(50),     { 0x000000fc, 0x000001fc } },
-       { AR5K_RF_GAIN(51),     { 0x000000fc, 0x0000003c } },
-       { AR5K_RF_GAIN(52),     { 0x000000fc, 0x0000007c } },
-       { AR5K_RF_GAIN(53),     { 0x000000fc, 0x000000bc } },
-       { AR5K_RF_GAIN(54),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(55),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(56),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(57),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(58),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(59),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(60),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(61),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(62),     { 0x000000fc, 0x000000fc } },
-       { AR5K_RF_GAIN(63),     { 0x000000fc, 0x000000fc } },
-};
-
-/* Initial RF Gain settings for RF5413 */
-static const struct ath5k_ini_rfgain rfgain_5413[] = {
-       /*                            5Ghz      2Ghz    */
-       { AR5K_RF_GAIN(0),      { 0x00000000, 0x00000000 } },
-       { AR5K_RF_GAIN(1),      { 0x00000040, 0x00000040 } },
-       { AR5K_RF_GAIN(2),      { 0x00000080, 0x00000080 } },
-       { AR5K_RF_GAIN(3),      { 0x000001a1, 0x00000161 } },
-       { AR5K_RF_GAIN(4),      { 0x000001e1, 0x000001a1 } },
-       { AR5K_RF_GAIN(5),      { 0x00000021, 0x000001e1 } },
-       { AR5K_RF_GAIN(6),      { 0x00000061, 0x00000021 } },
-       { AR5K_RF_GAIN(7),      { 0x00000188, 0x00000061 } },
-       { AR5K_RF_GAIN(8),      { 0x000001c8, 0x00000188 } },
-       { AR5K_RF_GAIN(9),      { 0x00000008, 0x000001c8 } },
-       { AR5K_RF_GAIN(10),     { 0x00000048, 0x00000008 } },
-       { AR5K_RF_GAIN(11),     { 0x00000088, 0x00000048 } },
-       { AR5K_RF_GAIN(12),     { 0x000001a9, 0x00000088 } },
-       { AR5K_RF_GAIN(13),     { 0x000001e9, 0x00000169 } },
-       { AR5K_RF_GAIN(14),     { 0x00000029, 0x000001a9 } },
-       { AR5K_RF_GAIN(15),     { 0x00000069, 0x000001e9 } },
-       { AR5K_RF_GAIN(16),     { 0x000001d0, 0x00000029 } },
-       { AR5K_RF_GAIN(17),     { 0x00000010, 0x00000069 } },
-       { AR5K_RF_GAIN(18),     { 0x00000050, 0x00000190 } },
-       { AR5K_RF_GAIN(19),     { 0x00000090, 0x000001d0 } },
-       { AR5K_RF_GAIN(20),     { 0x000001b1, 0x00000010 } },
-       { AR5K_RF_GAIN(21),     { 0x000001f1, 0x00000050 } },
-       { AR5K_RF_GAIN(22),     { 0x00000031, 0x00000090 } },
-       { AR5K_RF_GAIN(23),     { 0x00000071, 0x00000171 } },
-       { AR5K_RF_GAIN(24),     { 0x000001b8, 0x000001b1 } },
-       { AR5K_RF_GAIN(25),     { 0x000001f8, 0x000001f1 } },
-       { AR5K_RF_GAIN(26),     { 0x00000038, 0x00000031 } },
-       { AR5K_RF_GAIN(27),     { 0x00000078, 0x00000071 } },
-       { AR5K_RF_GAIN(28),     { 0x00000199, 0x00000198 } },
-       { AR5K_RF_GAIN(29),     { 0x000001d9, 0x000001d8 } },
-       { AR5K_RF_GAIN(30),     { 0x00000019, 0x00000018 } },
-       { AR5K_RF_GAIN(31),     { 0x00000059, 0x00000058 } },
-       { AR5K_RF_GAIN(32),     { 0x00000099, 0x00000098 } },
-       { AR5K_RF_GAIN(33),     { 0x000000d9, 0x00000179 } },
-       { AR5K_RF_GAIN(34),     { 0x000000f9, 0x000001b9 } },
-       { AR5K_RF_GAIN(35),     { 0x000000f9, 0x000001f9 } },
-       { AR5K_RF_GAIN(36),     { 0x000000f9, 0x00000039 } },
-       { AR5K_RF_GAIN(37),     { 0x000000f9, 0x00000079 } },
-       { AR5K_RF_GAIN(38),     { 0x000000f9, 0x000000b9 } },
-       { AR5K_RF_GAIN(39),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(40),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(41),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(42),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(43),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(44),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(45),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(46),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(47),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(48),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(49),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(50),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(51),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(52),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(53),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(54),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(55),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(56),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(57),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(58),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(59),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(60),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(61),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(62),     { 0x000000f9, 0x000000f9 } },
-       { AR5K_RF_GAIN(63),     { 0x000000f9, 0x000000f9 } },
-};
-
-/* Initial RF Gain settings for RF2413 */
-static const struct ath5k_ini_rfgain rfgain_2413[] = {
-       { AR5K_RF_GAIN(0), { 0x00000000 } },
-       { AR5K_RF_GAIN(1), { 0x00000040 } },
-       { AR5K_RF_GAIN(2), { 0x00000080 } },
-       { AR5K_RF_GAIN(3), { 0x00000181 } },
-       { AR5K_RF_GAIN(4), { 0x000001c1 } },
-       { AR5K_RF_GAIN(5), { 0x00000001 } },
-       { AR5K_RF_GAIN(6), { 0x00000041 } },
-       { AR5K_RF_GAIN(7), { 0x00000081 } },
-       { AR5K_RF_GAIN(8), { 0x00000168 } },
-       { AR5K_RF_GAIN(9), { 0x000001a8 } },
-       { AR5K_RF_GAIN(10), { 0x000001e8 } },
-       { AR5K_RF_GAIN(11), { 0x00000028 } },
-       { AR5K_RF_GAIN(12), { 0x00000068 } },
-       { AR5K_RF_GAIN(13), { 0x00000189 } },
-       { AR5K_RF_GAIN(14), { 0x000001c9 } },
-       { AR5K_RF_GAIN(15), { 0x00000009 } },
-       { AR5K_RF_GAIN(16), { 0x00000049 } },
-       { AR5K_RF_GAIN(17), { 0x00000089 } },
-       { AR5K_RF_GAIN(18), { 0x00000190 } },
-       { AR5K_RF_GAIN(19), { 0x000001d0 } },
-       { AR5K_RF_GAIN(20), { 0x00000010 } },
-       { AR5K_RF_GAIN(21), { 0x00000050 } },
-       { AR5K_RF_GAIN(22), { 0x00000090 } },
-       { AR5K_RF_GAIN(23), { 0x00000191 } },
-       { AR5K_RF_GAIN(24), { 0x000001d1 } },
-       { AR5K_RF_GAIN(25), { 0x00000011 } },
-       { AR5K_RF_GAIN(26), { 0x00000051 } },
-       { AR5K_RF_GAIN(27), { 0x00000091 } },
-       { AR5K_RF_GAIN(28), { 0x00000178 } },
-       { AR5K_RF_GAIN(29), { 0x000001b8 } },
-       { AR5K_RF_GAIN(30), { 0x000001f8 } },
-       { AR5K_RF_GAIN(31), { 0x00000038 } },
-       { AR5K_RF_GAIN(32), { 0x00000078 } },
-       { AR5K_RF_GAIN(33), { 0x00000199 } },
-       { AR5K_RF_GAIN(34), { 0x000001d9 } },
-       { AR5K_RF_GAIN(35), { 0x00000019 } },
-       { AR5K_RF_GAIN(36), { 0x00000059 } },
-       { AR5K_RF_GAIN(37), { 0x00000099 } },
-       { AR5K_RF_GAIN(38), { 0x000000d9 } },
-       { AR5K_RF_GAIN(39), { 0x000000f9 } },
-       { AR5K_RF_GAIN(40), { 0x000000f9 } },
-       { AR5K_RF_GAIN(41), { 0x000000f9 } },
-       { AR5K_RF_GAIN(42), { 0x000000f9 } },
-       { AR5K_RF_GAIN(43), { 0x000000f9 } },
-       { AR5K_RF_GAIN(44), { 0x000000f9 } },
-       { AR5K_RF_GAIN(45), { 0x000000f9 } },
-       { AR5K_RF_GAIN(46), { 0x000000f9 } },
-       { AR5K_RF_GAIN(47), { 0x000000f9 } },
-       { AR5K_RF_GAIN(48), { 0x000000f9 } },
-       { AR5K_RF_GAIN(49), { 0x000000f9 } },
-       { AR5K_RF_GAIN(50), { 0x000000f9 } },
-       { AR5K_RF_GAIN(51), { 0x000000f9 } },
-       { AR5K_RF_GAIN(52), { 0x000000f9 } },
-       { AR5K_RF_GAIN(53), { 0x000000f9 } },
-       { AR5K_RF_GAIN(54), { 0x000000f9 } },
-       { AR5K_RF_GAIN(55), { 0x000000f9 } },
-       { AR5K_RF_GAIN(56), { 0x000000f9 } },
-       { AR5K_RF_GAIN(57), { 0x000000f9 } },
-       { AR5K_RF_GAIN(58), { 0x000000f9 } },
-       { AR5K_RF_GAIN(59), { 0x000000f9 } },
-       { AR5K_RF_GAIN(60), { 0x000000f9 } },
-       { AR5K_RF_GAIN(61), { 0x000000f9 } },
-       { AR5K_RF_GAIN(62), { 0x000000f9 } },
-       { AR5K_RF_GAIN(63), { 0x000000f9 } },
-};
-
-/* Initial RF Gain settings for RF2425 */
-static const struct ath5k_ini_rfgain rfgain_2425[] = {
-       { AR5K_RF_GAIN(0), { 0x00000000 } },
-       { AR5K_RF_GAIN(1), { 0x00000040 } },
-       { AR5K_RF_GAIN(2), { 0x00000080 } },
-       { AR5K_RF_GAIN(3), { 0x00000181 } },
-       { AR5K_RF_GAIN(4), { 0x000001c1 } },
-       { AR5K_RF_GAIN(5), { 0x00000001 } },
-       { AR5K_RF_GAIN(6), { 0x00000041 } },
-       { AR5K_RF_GAIN(7), { 0x00000081 } },
-       { AR5K_RF_GAIN(8), { 0x00000188 } },
-       { AR5K_RF_GAIN(9), { 0x000001c8 } },
-       { AR5K_RF_GAIN(10), { 0x00000008 } },
-       { AR5K_RF_GAIN(11), { 0x00000048 } },
-       { AR5K_RF_GAIN(12), { 0x00000088 } },
-       { AR5K_RF_GAIN(13), { 0x00000189 } },
-       { AR5K_RF_GAIN(14), { 0x000001c9 } },
-       { AR5K_RF_GAIN(15), { 0x00000009 } },
-       { AR5K_RF_GAIN(16), { 0x00000049 } },
-       { AR5K_RF_GAIN(17), { 0x00000089 } },
-       { AR5K_RF_GAIN(18), { 0x000001b0 } },
-       { AR5K_RF_GAIN(19), { 0x000001f0 } },
-       { AR5K_RF_GAIN(20), { 0x00000030 } },
-       { AR5K_RF_GAIN(21), { 0x00000070 } },
-       { AR5K_RF_GAIN(22), { 0x00000171 } },
-       { AR5K_RF_GAIN(23), { 0x000001b1 } },
-       { AR5K_RF_GAIN(24), { 0x000001f1 } },
-       { AR5K_RF_GAIN(25), { 0x00000031 } },
-       { AR5K_RF_GAIN(26), { 0x00000071 } },
-       { AR5K_RF_GAIN(27), { 0x000001b8 } },
-       { AR5K_RF_GAIN(28), { 0x000001f8 } },
-       { AR5K_RF_GAIN(29), { 0x00000038 } },
-       { AR5K_RF_GAIN(30), { 0x00000078 } },
-       { AR5K_RF_GAIN(31), { 0x000000b8 } },
-       { AR5K_RF_GAIN(32), { 0x000001b9 } },
-       { AR5K_RF_GAIN(33), { 0x000001f9 } },
-       { AR5K_RF_GAIN(34), { 0x00000039 } },
-       { AR5K_RF_GAIN(35), { 0x00000079 } },
-       { AR5K_RF_GAIN(36), { 0x000000b9 } },
-       { AR5K_RF_GAIN(37), { 0x000000f9 } },
-       { AR5K_RF_GAIN(38), { 0x000000f9 } },
-       { AR5K_RF_GAIN(39), { 0x000000f9 } },
-       { AR5K_RF_GAIN(40), { 0x000000f9 } },
-       { AR5K_RF_GAIN(41), { 0x000000f9 } },
-       { AR5K_RF_GAIN(42), { 0x000000f9 } },
-       { AR5K_RF_GAIN(43), { 0x000000f9 } },
-       { AR5K_RF_GAIN(44), { 0x000000f9 } },
-       { AR5K_RF_GAIN(45), { 0x000000f9 } },
-       { AR5K_RF_GAIN(46), { 0x000000f9 } },
-       { AR5K_RF_GAIN(47), { 0x000000f9 } },
-       { AR5K_RF_GAIN(48), { 0x000000f9 } },
-       { AR5K_RF_GAIN(49), { 0x000000f9 } },
-       { AR5K_RF_GAIN(50), { 0x000000f9 } },
-       { AR5K_RF_GAIN(51), { 0x000000f9 } },
-       { AR5K_RF_GAIN(52), { 0x000000f9 } },
-       { AR5K_RF_GAIN(53), { 0x000000f9 } },
-       { AR5K_RF_GAIN(54), { 0x000000f9 } },
-       { AR5K_RF_GAIN(55), { 0x000000f9 } },
-       { AR5K_RF_GAIN(56), { 0x000000f9 } },
-       { AR5K_RF_GAIN(57), { 0x000000f9 } },
-       { AR5K_RF_GAIN(58), { 0x000000f9 } },
-       { AR5K_RF_GAIN(59), { 0x000000f9 } },
-       { AR5K_RF_GAIN(60), { 0x000000f9 } },
-       { AR5K_RF_GAIN(61), { 0x000000f9 } },
-       { AR5K_RF_GAIN(62), { 0x000000f9 } },
-       { AR5K_RF_GAIN(63), { 0x000000f9 } },
-};
-
-static const struct ath5k_gain_opt rfgain_opt_5112 = {
-       1,
-       8,
-       {
-               { { 3, 0, 0, 0, 0, 0, 0 }, 6 },
-               { { 2, 0, 0, 0, 0, 0, 0 }, 0 },
-               { { 1, 0, 0, 0, 0, 0, 0 }, -3 },
-               { { 0, 0, 0, 0, 0, 0, 0 }, -6 },
-               { { 0, 1, 1, 0, 0, 0, 0 }, -8 },
-               { { 0, 1, 1, 0, 1, 1, 0 }, -10 },
-               { { 0, 1, 0, 1, 1, 1, 0 }, -13 },
-               { { 0, 1, 0, 1, 1, 0, 1 }, -16 },
-       }
-};
+#include "rfbuffer.h"
+#include "rfgain.h"
 
 /*
  * Used to modify RF Banks before writing them to AR5K_RF_BUFFER
  */
-static unsigned int ath5k_hw_rfregs_op(u32 *rf, u32 offset, u32 reg, u32 bits,
-               u32 first, u32 col, bool set)
+static unsigned int ath5k_hw_rfb_op(struct ath5k_hw *ah,
+                                       const struct ath5k_rf_reg *rf_regs,
+                                       u32 val, u8 reg_id, bool set)
 {
-       u32 mask, entry, last, data, shift, position;
-       s32 left;
+       const struct ath5k_rf_reg *rfreg = NULL;
+       u8 offset, bank, num_bits, col, position;
+       u16 entry;
+       u32 mask, data, last_bit, bits_shifted, first_bit;
+       u32 *rfb;
+       s32 bits_left;
        int i;
 
        data = 0;
+       rfb = ah->ah_rf_banks;
 
-       if (rf == NULL)
+       for (i = 0; i < ah->ah_rf_regs_count; i++) {
+               if (rf_regs[i].index == reg_id) {
+                       rfreg = &rf_regs[i];
+                       break;
+               }
+       }
+
+       if (rfb == NULL || rfreg == NULL) {
+               ATH5K_PRINTF("Rf register not found!\n");
                /* should not happen */
                return 0;
+       }
+
+       bank = rfreg->bank;
+       num_bits = rfreg->field.len;
+       first_bit = rfreg->field.pos;
+       col = rfreg->field.col;
+
+       /* first_bit is an offset from bank's
+        * start. Since we have all banks on
+        * the same array, we use this offset
+        * to mark each bank's start */
+       offset = ah->ah_offset[bank];
 
-       if (!(col <= 3 && bits <= 32 && first + bits <= 319)) {
+       /* Boundary check */
+       if (!(col <= 3 && num_bits <= 32 && first_bit + num_bits <= 319)) {
                ATH5K_PRINTF("invalid values at offset %u\n", offset);
                return 0;
        }
 
-       entry = ((first - 1) / 8) + offset;
-       position = (first - 1) % 8;
+       entry = ((first_bit - 1) / 8) + offset;
+       position = (first_bit - 1) % 8;
 
        if (set)
-               data = ath5k_hw_bitswap(reg, bits);
+               data = ath5k_hw_bitswap(val, num_bits);
+
+       for (bits_shifted = 0, bits_left = num_bits; bits_left > 0;
+       position = 0, entry++) {
+
+               last_bit = (position + bits_left > 8) ? 8 :
+                                       position + bits_left;
 
-       for (i = shift = 0, left = bits; left > 0; position = 0, entry++, i++) {
-               last = (position + left > 8) ? 8 : position + left;
-               mask = (((1 << last) - 1) ^ ((1 << position) - 1)) << (col * 8);
+               mask = (((1 << last_bit) - 1) ^ ((1 << position) - 1)) <<
+                                                               (col * 8);
 
                if (set) {
-                       rf[entry] &= ~mask;
-                       rf[entry] |= ((data << position) << (col * 8)) & mask;
+                       rfb[entry] &= ~mask;
+                       rfb[entry] |= ((data << position) << (col * 8)) & mask;
                        data >>= (8 - position);
                } else {
-                       data = (((rf[entry] & mask) >> (col * 8)) >> position)
-                               << shift;
-                       shift += last - position;
+                       data |= (((rfb[entry] & mask) >> (col * 8)) >> position)
+                               << bits_shifted;
+                       bits_shifted += last_bit - position;
                }
 
-               left -= 8 - position;
+               bits_left -= 8 - position;
        }
 
-       data = set ? 1 : ath5k_hw_bitswap(data, bits);
+       data = set ? 1 : ath5k_hw_bitswap(data, num_bits);
 
        return data;
 }
 
-static u32 ath5k_hw_rfregs_gainf_corr(struct ath5k_hw *ah)
+/**********************\
+* RF Gain optimization *
+\**********************/
+
+/*
+ * This code is used to optimize rf gain on different environments
+ * (temprature mostly) based on feedback from a power detector.
+ *
+ * It's only used on RF5111 and RF5112, later RF chips seem to have
+ * auto adjustment on hw -notice they have a much smaller BANK 7 and
+ * no gain optimization ladder-.
+ *
+ * For more infos check out this patent doc
+ * http://www.freepatentsonline.com/7400691.html
+ *
+ * This paper describes power drops as seen on the receiver due to
+ * probe packets
+ * http://www.cnri.dit.ie/publications/ICT08%20-%20Practical%20Issues
+ * %20of%20Power%20Control.pdf
+ *
+ * And this is the MadWiFi bug entry related to the above
+ * http://madwifi-project.org/ticket/1659
+ * with various measurements and diagrams
+ *
+ * TODO: Deal with power drops due to probes by setting an apropriate
+ * tx power on the probe packets ! Make this part of the calibration process.
+ */
+
+/* Initialize ah_gain durring attach */
+int ath5k_hw_rfgain_opt_init(struct ath5k_hw *ah)
+{
+       /* Initialize the gain optimization values */
+       switch (ah->ah_radio) {
+       case AR5K_RF5111:
+               ah->ah_gain.g_step_idx = rfgain_opt_5111.go_default;
+               ah->ah_gain.g_low = 20;
+               ah->ah_gain.g_high = 35;
+               ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
+               break;
+       case AR5K_RF5112:
+               ah->ah_gain.g_step_idx = rfgain_opt_5112.go_default;
+               ah->ah_gain.g_low = 20;
+               ah->ah_gain.g_high = 85;
+               ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return 0;
+}
+
+/* Schedule a gain probe check on the next transmited packet.
+ * That means our next packet is going to be sent with lower
+ * tx power and a Peak to Average Power Detector (PAPD) will try
+ * to measure the gain.
+ *
+ * TODO: Use propper tx power setting for the probe packet so
+ * that we don't observe a serious power drop on the receiver
+ *
+ * XXX:  How about forcing a tx packet (bypassing PCU arbitrator etc)
+ * just after we enable the probe so that we don't mess with
+ * standard traffic ? Maybe it's time to use sw interrupts and
+ * a probe tasklet !!!
+ */
+static void ath5k_hw_request_rfgain_probe(struct ath5k_hw *ah)
+{
+
+       /* Skip if gain calibration is inactive or
+        * we already handle a probe request */
+       if (ah->ah_gain.g_state != AR5K_RFGAIN_ACTIVE)
+               return;
+
+       ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txpower.txp_max,
+                       AR5K_PHY_PAPD_PROBE_TXPOWER) |
+                       AR5K_PHY_PAPD_PROBE_TX_NEXT, AR5K_PHY_PAPD_PROBE);
+
+       ah->ah_gain.g_state = AR5K_RFGAIN_READ_REQUESTED;
+
+}
+
+/* Calculate gain_F measurement correction
+ * based on the current step for RF5112 rev. 2 */
+static u32 ath5k_hw_rf_gainf_corr(struct ath5k_hw *ah)
 {
        u32 mix, step;
        u32 *rf;
+       const struct ath5k_gain_opt *go;
+       const struct ath5k_gain_opt_step *g_step;
+       const struct ath5k_rf_reg *rf_regs;
+
+       /* Only RF5112 Rev. 2 supports it */
+       if ((ah->ah_radio != AR5K_RF5112) ||
+       (ah->ah_radio_5ghz_revision <= AR5K_SREV_RAD_5112A))
+               return 0;
+
+       go = &rfgain_opt_5112;
+       rf_regs = rf_regs_5112a;
+       ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112a);
+
+       g_step = &go->go_step[ah->ah_gain.g_step_idx];
 
        if (ah->ah_rf_banks == NULL)
                return 0;
@@ -1165,11 +218,15 @@ static u32 ath5k_hw_rfregs_gainf_corr(struct ath5k_hw *ah)
        rf = ah->ah_rf_banks;
        ah->ah_gain.g_f_corr = 0;
 
-       if (ath5k_hw_rfregs_op(rf, ah->ah_offset[7], 0, 1, 36, 0, false) != 1)
+       /* No VGA (Variable Gain Amplifier) override, skip */
+       if (ath5k_hw_rfb_op(ah, rf_regs, 0, AR5K_RF_MIXVGA_OVR, false) != 1)
                return 0;
 
-       step = ath5k_hw_rfregs_op(rf, ah->ah_offset[7], 0, 4, 32, 0, false);
-       mix = ah->ah_gain.g_step->gos_param[0];
+       /* Mix gain stepping */
+       step = ath5k_hw_rfb_op(ah, rf_regs, 0, AR5K_RF_MIXGAIN_STEP, false);
+
+       /* Mix gain override */
+       mix = g_step->gos_param[0];
 
        switch (mix) {
        case 3:
@@ -1189,9 +246,14 @@ static u32 ath5k_hw_rfregs_gainf_corr(struct ath5k_hw *ah)
        return ah->ah_gain.g_f_corr;
 }
 
-static bool ath5k_hw_rfregs_gain_readback(struct ath5k_hw *ah)
+/* Check if current gain_F measurement is in the range of our
+ * power detector windows. If we get a measurement outside range
+ * we know it's not accurate (detectors can't measure anything outside
+ * their detection window) so we must ignore it */
+static bool ath5k_hw_rf_check_gainf_readback(struct ath5k_hw *ah)
 {
-       u32 step, mix, level[4];
+       const struct ath5k_rf_reg *rf_regs;
+       u32 step, mix_ovr, level[4];
        u32 *rf;
 
        if (ah->ah_rf_banks == NULL)
@@ -1200,23 +262,33 @@ static bool ath5k_hw_rfregs_gain_readback(struct ath5k_hw *ah)
        rf = ah->ah_rf_banks;
 
        if (ah->ah_radio == AR5K_RF5111) {
-               step = ath5k_hw_rfregs_op(rf, ah->ah_offset[7], 0, 6, 37, 0,
-                               false);
+
+               rf_regs = rf_regs_5111;
+               ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5111);
+
+               step = ath5k_hw_rfb_op(ah, rf_regs, 0, AR5K_RF_RFGAIN_STEP,
+                       false);
+
                level[0] = 0;
-               level[1] = (step == 0x3f) ? 0x32 : step + 4;
-               level[2] = (step != 0x3f) ? 0x40 : level[0];
-               level[3] = level[2] + 0x32;
+               level[1] = (step == 63) ? 50 : step + 4;
+               level[2] = (step != 63) ? 64 : level[0];
+               level[3] = level[2] + 50 ;
 
                ah->ah_gain.g_high = level[3] -
-                       (step == 0x3f ? AR5K_GAIN_DYN_ADJUST_HI_MARGIN : -5);
+                       (step == 63 ? AR5K_GAIN_DYN_ADJUST_HI_MARGIN : -5);
                ah->ah_gain.g_low = level[0] +
-                       (step == 0x3f ? AR5K_GAIN_DYN_ADJUST_LO_MARGIN : 0);
+                       (step == 63 ? AR5K_GAIN_DYN_ADJUST_LO_MARGIN : 0);
        } else {
-               mix = ath5k_hw_rfregs_op(rf, ah->ah_offset[7], 0, 1, 36, 0,
-                               false);
+
+               rf_regs = rf_regs_5112;
+               ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112);
+
+               mix_ovr = ath5k_hw_rfb_op(ah, rf_regs, 0, AR5K_RF_MIXVGA_OVR,
+                       false);
+
                level[0] = level[2] = 0;
 
-               if (mix == 1) {
+               if (mix_ovr == 1) {
                        level[1] = level[3] = 83;
                } else {
                        level[1] = level[3] = 107;
@@ -1230,9 +302,12 @@ static bool ath5k_hw_rfregs_gain_readback(struct ath5k_hw *ah)
                        ah->ah_gain.g_current <= level[3]);
 }
 
-static s32 ath5k_hw_rfregs_gain_adjust(struct ath5k_hw *ah)
+/* Perform gain_F adjustment by choosing the right set
+ * of parameters from rf gain optimization ladder */
+static s8 ath5k_hw_rf_gainf_adjust(struct ath5k_hw *ah)
 {
        const struct ath5k_gain_opt *go;
+       const struct ath5k_gain_opt_step *g_step;
        int ret = 0;
 
        switch (ah->ah_radio) {
@@ -1246,35 +321,39 @@ static s32 ath5k_hw_rfregs_gain_adjust(struct ath5k_hw *ah)
                return 0;
        }
 
-       ah->ah_gain.g_step = &go->go_step[ah->ah_gain.g_step_idx];
+       g_step = &go->go_step[ah->ah_gain.g_step_idx];
 
        if (ah->ah_gain.g_current >= ah->ah_gain.g_high) {
+
+               /* Reached maximum */
                if (ah->ah_gain.g_step_idx == 0)
                        return -1;
+
                for (ah->ah_gain.g_target = ah->ah_gain.g_current;
                                ah->ah_gain.g_target >=  ah->ah_gain.g_high &&
                                ah->ah_gain.g_step_idx > 0;
-                               ah->ah_gain.g_step =
-                                       &go->go_step[ah->ah_gain.g_step_idx])
+                               g_step = &go->go_step[ah->ah_gain.g_step_idx])
                        ah->ah_gain.g_target -= 2 *
                            (go->go_step[--(ah->ah_gain.g_step_idx)].gos_gain -
-                           ah->ah_gain.g_step->gos_gain);
+                           g_step->gos_gain);
 
                ret = 1;
                goto done;
        }
 
        if (ah->ah_gain.g_current <= ah->ah_gain.g_low) {
+
+               /* Reached minimum */
                if (ah->ah_gain.g_step_idx == (go->go_steps_count - 1))
                        return -2;
+
                for (ah->ah_gain.g_target = ah->ah_gain.g_current;
                                ah->ah_gain.g_target <= ah->ah_gain.g_low &&
                                ah->ah_gain.g_step_idx < go->go_steps_count-1;
-                               ah->ah_gain.g_step =
-                                       &go->go_step[ah->ah_gain.g_step_idx])
+                               g_step = &go->go_step[ah->ah_gain.g_step_idx])
                        ah->ah_gain.g_target -= 2 *
                            (go->go_step[++ah->ah_gain.g_step_idx].gos_gain -
-                           ah->ah_gain.g_step->gos_gain);
+                           g_step->gos_gain);
 
                ret = 2;
                goto done;
@@ -1289,468 +368,449 @@ done:
        return ret;
 }
 
-/*
- * Read EEPROM Calibration data, modify RF Banks and Initialize RF5111
- */
-static int ath5k_hw_rf5111_rfregs(struct ath5k_hw *ah,
-               struct ieee80211_channel *channel, unsigned int mode)
+/* Main callback for thermal rf gain calibration engine
+ * Check for a new gain reading and schedule an adjustment
+ * if needed.
+ *
+ * TODO: Use sw interrupt to schedule reset if gain_F needs
+ * adjustment */
+enum ath5k_rfgain ath5k_hw_gainf_calibrate(struct ath5k_hw *ah)
 {
+       u32 data, type;
        struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
-       u32 *rf;
-       const unsigned int rf_size = ARRAY_SIZE(rfregs_5111);
-       unsigned int i;
-       int obdb = -1, bank = -1;
-       u32 ee_mode;
-
-       AR5K_ASSERT_ENTRY(mode, AR5K_MODE_MAX);
-
-       rf = ah->ah_rf_banks;
 
-       /* Copy values to modify them */
-       for (i = 0; i < rf_size; i++) {
-               if (rfregs_5111[i].rf_bank >= AR5K_RF5111_INI_RF_MAX_BANKS) {
-                       ATH5K_ERR(ah->ah_sc, "invalid bank\n");
-                       return -EINVAL;
-               }
-
-               if (bank != rfregs_5111[i].rf_bank) {
-                       bank = rfregs_5111[i].rf_bank;
-                       ah->ah_offset[bank] = i;
-               }
+       ATH5K_TRACE(ah->ah_sc);
 
-               rf[i] = rfregs_5111[i].rf_value[mode];
-       }
+       if (ah->ah_rf_banks == NULL ||
+       ah->ah_gain.g_state == AR5K_RFGAIN_INACTIVE)
+               return AR5K_RFGAIN_INACTIVE;
 
-       /* Modify bank 0 */
-       if (channel->hw_value & CHANNEL_2GHZ) {
-               if (channel->hw_value & CHANNEL_CCK)
-                       ee_mode = AR5K_EEPROM_MODE_11B;
-               else
-                       ee_mode = AR5K_EEPROM_MODE_11G;
-               obdb = 0;
+       /* No check requested, either engine is inactive
+        * or an adjustment is already requested */
+       if (ah->ah_gain.g_state != AR5K_RFGAIN_READ_REQUESTED)
+               goto done;
 
-               if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[0],
-                               ee->ee_ob[ee_mode][obdb], 3, 119, 0, true))
-                       return -EINVAL;
+       /* Read the PAPD (Peak to Average Power Detector)
+        * register */
+       data = ath5k_hw_reg_read(ah, AR5K_PHY_PAPD_PROBE);
 
-               if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[0],
-                               ee->ee_ob[ee_mode][obdb], 3, 122, 0, true))
-                       return -EINVAL;
+       /* No probe is scheduled, read gain_F measurement */
+       if (!(data & AR5K_PHY_PAPD_PROBE_TX_NEXT)) {
+               ah->ah_gain.g_current = data >> AR5K_PHY_PAPD_PROBE_GAINF_S;
+               type = AR5K_REG_MS(data, AR5K_PHY_PAPD_PROBE_TYPE);
 
-               obdb = 1;
-       /* Modify bank 6 */
-       } else {
-               /* For 11a, Turbo and XR */
-               ee_mode = AR5K_EEPROM_MODE_11A;
-               obdb =   channel->center_freq >= 5725 ? 3 :
-                       (channel->center_freq >= 5500 ? 2 :
-                       (channel->center_freq >= 5260 ? 1 :
-                        (channel->center_freq > 4000 ? 0 : -1)));
+               /* If tx packet is CCK correct the gain_F measurement
+                * by cck ofdm gain delta */
+               if (type == AR5K_PHY_PAPD_PROBE_TYPE_CCK) {
+                       if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A)
+                               ah->ah_gain.g_current +=
+                                       ee->ee_cck_ofdm_gain_delta;
+                       else
+                               ah->ah_gain.g_current +=
+                                       AR5K_GAIN_CCK_PROBE_CORR;
+               }
 
-               if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                               ee->ee_pwd_84, 1, 51, 3, true))
-                       return -EINVAL;
+               /* Further correct gain_F measurement for
+                * RF5112A radios */
+               if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) {
+                       ath5k_hw_rf_gainf_corr(ah);
+                       ah->ah_gain.g_current =
+                               ah->ah_gain.g_current >= ah->ah_gain.g_f_corr ?
+                               (ah->ah_gain.g_current-ah->ah_gain.g_f_corr) :
+                               0;
+               }
 
-               if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                               ee->ee_pwd_90, 1, 45, 3, true))
-                       return -EINVAL;
+               /* Check if measurement is ok and if we need
+                * to adjust gain, schedule a gain adjustment,
+                * else switch back to the acive state */
+               if (ath5k_hw_rf_check_gainf_readback(ah) &&
+               AR5K_GAIN_CHECK_ADJUST(&ah->ah_gain) &&
+               ath5k_hw_rf_gainf_adjust(ah)) {
+                       ah->ah_gain.g_state = AR5K_RFGAIN_NEED_CHANGE;
+               } else {
+                       ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
+               }
        }
 
-       if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                       !ee->ee_xpd[ee_mode], 1, 95, 0, true))
-               return -EINVAL;
-
-       if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                       ee->ee_x_gain[ee_mode], 4, 96, 0, true))
-               return -EINVAL;
-
-       if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6], obdb >= 0 ?
-                       ee->ee_ob[ee_mode][obdb] : 0, 3, 104, 0, true))
-               return -EINVAL;
+done:
+       return ah->ah_gain.g_state;
+}
 
-       if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6], obdb >= 0 ?
-                       ee->ee_db[ee_mode][obdb] : 0, 3, 107, 0, true))
-               return -EINVAL;
+/* Write initial rf gain table to set the RF sensitivity
+ * this one works on all RF chips and has nothing to do
+ * with gain_F calibration */
+int ath5k_hw_rfgain_init(struct ath5k_hw *ah, unsigned int freq)
+{
+       const struct ath5k_ini_rfgain *ath5k_rfg;
+       unsigned int i, size;
 
-       /* Modify bank 7 */
-       if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[7],
-                       ee->ee_i_gain[ee_mode], 6, 29, 0, true))
+       switch (ah->ah_radio) {
+       case AR5K_RF5111:
+               ath5k_rfg = rfgain_5111;
+               size = ARRAY_SIZE(rfgain_5111);
+               break;
+       case AR5K_RF5112:
+               ath5k_rfg = rfgain_5112;
+               size = ARRAY_SIZE(rfgain_5112);
+               break;
+       case AR5K_RF2413:
+               ath5k_rfg = rfgain_2413;
+               size = ARRAY_SIZE(rfgain_2413);
+               break;
+       case AR5K_RF2316:
+               ath5k_rfg = rfgain_2316;
+               size = ARRAY_SIZE(rfgain_2316);
+               break;
+       case AR5K_RF5413:
+               ath5k_rfg = rfgain_5413;
+               size = ARRAY_SIZE(rfgain_5413);
+               break;
+       case AR5K_RF2317:
+       case AR5K_RF2425:
+               ath5k_rfg = rfgain_2425;
+               size = ARRAY_SIZE(rfgain_2425);
+               break;
+       default:
                return -EINVAL;
+       }
 
-       if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[7],
-                       ee->ee_xpd[ee_mode], 1, 4, 0, true))
+       switch (freq) {
+       case AR5K_INI_RFGAIN_2GHZ:
+       case AR5K_INI_RFGAIN_5GHZ:
+               break;
+       default:
                return -EINVAL;
+       }
 
-       /* Write RF values */
-       for (i = 0; i < rf_size; i++) {
+       for (i = 0; i < size; i++) {
                AR5K_REG_WAIT(i);
-               ath5k_hw_reg_write(ah, rf[i], rfregs_5111[i].rf_register);
+               ath5k_hw_reg_write(ah, ath5k_rfg[i].rfg_value[freq],
+                       (u32)ath5k_rfg[i].rfg_register);
        }
 
        return 0;
 }
 
+
+
+/********************\
+* RF Registers setup *
+\********************/
+
+
 /*
- * Read EEPROM Calibration data, modify RF Banks and Initialize RF5112
+ * Setup RF registers by writing rf buffer on hw
  */
-static int ath5k_hw_rf5112_rfregs(struct ath5k_hw *ah,
-               struct ieee80211_channel *channel, unsigned int mode)
+int ath5k_hw_rfregs_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
+               unsigned int mode)
 {
-       const struct ath5k_ini_rf *rf_ini;
+       const struct ath5k_rf_reg *rf_regs;
+       const struct ath5k_ini_rfbuffer *ini_rfb;
+       const struct ath5k_gain_opt *go = NULL;
+       const struct ath5k_gain_opt_step *g_step;
        struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
-       u32 *rf;
-       unsigned int rf_size, i;
-       int obdb = -1, bank = -1;
-       u32 ee_mode;
-
-       AR5K_ASSERT_ENTRY(mode, AR5K_MODE_MAX);
+       u8 ee_mode = 0;
+       u32 *rfb;
+       int i, obdb = -1, bank = -1;
 
-       rf = ah->ah_rf_banks;
+       switch (ah->ah_radio) {
+       case AR5K_RF5111:
+               rf_regs = rf_regs_5111;
+               ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5111);
+               ini_rfb = rfb_5111;
+               ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5111);
+               go = &rfgain_opt_5111;
+               break;
+       case AR5K_RF5112:
+               if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) {
+                       rf_regs = rf_regs_5112a;
+                       ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112a);
+                       ini_rfb = rfb_5112a;
+                       ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5112a);
+               } else {
+                       rf_regs = rf_regs_5112;
+                       ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5112);
+                       ini_rfb = rfb_5112;
+                       ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5112);
+               }
+               go = &rfgain_opt_5112;
+               break;
+       case AR5K_RF2413:
+               rf_regs = rf_regs_2413;
+               ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2413);
+               ini_rfb = rfb_2413;
+               ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2413);
+               break;
+       case AR5K_RF2316:
+               rf_regs = rf_regs_2316;
+               ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2316);
+               ini_rfb = rfb_2316;
+               ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2316);
+               break;
+       case AR5K_RF5413:
+               rf_regs = rf_regs_5413;
+               ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_5413);
+               ini_rfb = rfb_5413;
+               ah->ah_rf_banks_size = ARRAY_SIZE(rfb_5413);
+               break;
+       case AR5K_RF2317:
+               rf_regs = rf_regs_2425;
+               ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2425);
+               ini_rfb = rfb_2317;
+               ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2317);
+               break;
+       case AR5K_RF2425:
+               rf_regs = rf_regs_2425;
+               ah->ah_rf_regs_count = ARRAY_SIZE(rf_regs_2425);
+               if (ah->ah_mac_srev < AR5K_SREV_AR2417) {
+                       ini_rfb = rfb_2425;
+                       ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2425);
+               } else {
+                       ini_rfb = rfb_2417;
+                       ah->ah_rf_banks_size = ARRAY_SIZE(rfb_2417);
+               }
+               break;
+       default:
+               return -EINVAL;
+       }
 
-       if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_2112A
-               && !test_bit(AR5K_MODE_11A, ah->ah_capabilities.cap_mode)) {
-               rf_ini = rfregs_2112a;
-               rf_size = ARRAY_SIZE(rfregs_5112a);
-               if (mode < 2) {
-                       ATH5K_ERR(ah->ah_sc, "invalid channel mode: %i\n",
-                                 mode);
-                       return -EINVAL;
+       /* If it's the first time we set rf buffer, allocate
+        * ah->ah_rf_banks based on ah->ah_rf_banks_size
+        * we set above */
+       if (ah->ah_rf_banks == NULL) {
+               ah->ah_rf_banks = kmalloc(sizeof(u32) * ah->ah_rf_banks_size,
+                                                               GFP_KERNEL);
+               if (ah->ah_rf_banks == NULL) {
+                       ATH5K_ERR(ah->ah_sc, "out of memory\n");
+                       return -ENOMEM;
                }
-               mode = mode - 2; /*no a/turboa modes for 2112*/
-       } else if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A) {
-               rf_ini = rfregs_5112a;
-               rf_size = ARRAY_SIZE(rfregs_5112a);
-       } else {
-               rf_ini = rfregs_5112;
-               rf_size = ARRAY_SIZE(rfregs_5112);
        }
 
        /* Copy values to modify them */
-       for (i = 0; i < rf_size; i++) {
-               if (rf_ini[i].rf_bank >= AR5K_RF5112_INI_RF_MAX_BANKS) {
+       rfb = ah->ah_rf_banks;
+
+       for (i = 0; i < ah->ah_rf_banks_size; i++) {
+               if (ini_rfb[i].rfb_bank >= AR5K_MAX_RF_BANKS) {
                        ATH5K_ERR(ah->ah_sc, "invalid bank\n");
                        return -EINVAL;
                }
 
-               if (bank != rf_ini[i].rf_bank) {
-                       bank = rf_ini[i].rf_bank;
+               /* Bank changed, write down the offset */
+               if (bank != ini_rfb[i].rfb_bank) {
+                       bank = ini_rfb[i].rfb_bank;
                        ah->ah_offset[bank] = i;
                }
 
-               rf[i] = rf_ini[i].rf_value[mode];
+               rfb[i] = ini_rfb[i].rfb_mode_data[mode];
        }
 
-       /* Modify bank 6 */
+       /* Set Output and Driver bias current (OB/DB) */
        if (channel->hw_value & CHANNEL_2GHZ) {
-               if (channel->hw_value & CHANNEL_OFDM)
+
+               if (channel->hw_value & CHANNEL_CCK)
+                       ee_mode = AR5K_EEPROM_MODE_11B;
+               else
                        ee_mode = AR5K_EEPROM_MODE_11G;
+
+               /* For RF511X/RF211X combination we
+                * use b_OB and b_DB parameters stored
+                * in eeprom on ee->ee_ob[ee_mode][0]
+                *
+                * For all other chips we use OB/DB for 2Ghz
+                * stored in the b/g modal section just like
+                * 802.11a on ee->ee_ob[ee_mode][1] */
+               if ((ah->ah_radio == AR5K_RF5111) ||
+               (ah->ah_radio == AR5K_RF5112))
+                       obdb = 0;
                else
-                       ee_mode = AR5K_EEPROM_MODE_11B;
-               obdb = 0;
+                       obdb = 1;
 
-               if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                               ee->ee_ob[ee_mode][obdb], 3, 287, 0, true))
-                       return -EINVAL;
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_ob[ee_mode][obdb],
+                                               AR5K_RF_OB_2GHZ, true);
 
-               if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                               ee->ee_ob[ee_mode][obdb], 3, 290, 0, true))
-                       return -EINVAL;
-       } else {
-               /* For 11a, Turbo and XR */
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_db[ee_mode][obdb],
+                                               AR5K_RF_DB_2GHZ, true);
+
+       /* RF5111 always needs OB/DB for 5GHz, even if we use 2GHz */
+       } else if ((channel->hw_value & CHANNEL_5GHZ) ||
+                       (ah->ah_radio == AR5K_RF5111)) {
+
+               /* For 11a, Turbo and XR we need to choose
+                * OB/DB based on frequency range */
                ee_mode = AR5K_EEPROM_MODE_11A;
-               obdb = channel->center_freq >= 5725 ? 3 :
-                   (channel->center_freq >= 5500 ? 2 :
+               obdb =   channel->center_freq >= 5725 ? 3 :
+                       (channel->center_freq >= 5500 ? 2 :
                        (channel->center_freq >= 5260 ? 1 :
-                           (channel->center_freq > 4000 ? 0 : -1)));
+                        (channel->center_freq > 4000 ? 0 : -1)));
 
-               if (obdb == -1)
+               if (obdb < 0)
                        return -EINVAL;
 
-               if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                               ee->ee_ob[ee_mode][obdb], 3, 279, 0, true))
-                       return -EINVAL;
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_ob[ee_mode][obdb],
+                                               AR5K_RF_OB_5GHZ, true);
 
-               if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                               ee->ee_ob[ee_mode][obdb], 3, 282, 0, true))
-                       return -EINVAL;
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_db[ee_mode][obdb],
+                                               AR5K_RF_DB_5GHZ, true);
        }
 
-       ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-           ee->ee_x_gain[ee_mode], 2, 270, 0, true);
-       ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-           ee->ee_x_gain[ee_mode], 2, 257, 0, true);
+       g_step = &go->go_step[ah->ah_gain.g_step_idx];
 
-       if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[6],
-                       ee->ee_xpd[ee_mode], 1, 302, 0, true))
-               return -EINVAL;
+       /* Bank Modifications (chip-specific) */
+       if (ah->ah_radio == AR5K_RF5111) {
 
-       /* Modify bank 7 */
-       if (!ath5k_hw_rfregs_op(rf, ah->ah_offset[7],
-                       ee->ee_i_gain[ee_mode], 6, 14, 0, true))
-               return -EINVAL;
+               /* Set gain_F settings according to current step */
+               if (channel->hw_value & CHANNEL_OFDM) {
 
-       /* Write RF values */
-       for (i = 0; i < rf_size; i++)
-               ath5k_hw_reg_write(ah, rf[i], rf_ini[i].rf_register);
+                       AR5K_REG_WRITE_BITS(ah, AR5K_PHY_FRAME_CTL,
+                                       AR5K_PHY_FRAME_CTL_TX_CLIP,
+                                       g_step->gos_param[0]);
 
-       return 0;
-}
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[1],
+                                                       AR5K_RF_PWD_90, true);
 
-/*
- * Initialize RF5413/5414 and future chips
- * (until we come up with a better solution)
- */
-static int ath5k_hw_rf5413_rfregs(struct ath5k_hw *ah,
-               struct ieee80211_channel *channel, unsigned int mode)
-{
-       const struct ath5k_ini_rf *rf_ini;
-       u32 *rf;
-       unsigned int rf_size, i;
-       int bank = -1;
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[2],
+                                                       AR5K_RF_PWD_84, true);
 
-       AR5K_ASSERT_ENTRY(mode, AR5K_MODE_MAX);
-
-       rf = ah->ah_rf_banks;
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[3],
+                                               AR5K_RF_RFGAIN_SEL, true);
 
-       switch (ah->ah_radio) {
-       case AR5K_RF5413:
-               rf_ini = rfregs_5413;
-               rf_size = ARRAY_SIZE(rfregs_5413);
-               break;
-       case AR5K_RF2413:
-               rf_ini = rfregs_2413;
-               rf_size = ARRAY_SIZE(rfregs_2413);
+                       /* We programmed gain_F parameters, switch back
+                        * to active state */
+                       ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
 
-               if (mode < 2) {
-                       ATH5K_ERR(ah->ah_sc,
-                               "invalid channel mode: %i\n", mode);
-                       return -EINVAL;
                }
 
-               mode = mode - 2;
-               break;
-       case AR5K_RF2425:
-               rf_ini = rfregs_2425;
-               rf_size = ARRAY_SIZE(rfregs_2425);
+               /* Bank 6/7 setup */
 
-               if (mode < 2) {
-                       ATH5K_ERR(ah->ah_sc,
-                               "invalid channel mode: %i\n", mode);
-                       return -EINVAL;
-               }
+               ath5k_hw_rfb_op(ah, rf_regs, !ee->ee_xpd[ee_mode],
+                                               AR5K_RF_PWD_XPD, true);
 
-               /* Map b to g */
-               if (mode == 2)
-                       mode = 0;
-               else
-                       mode = mode - 3;
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_x_gain[ee_mode],
+                                               AR5K_RF_XPD_GAIN, true);
 
-               break;
-       default:
-               return -EINVAL;
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode],
+                                               AR5K_RF_GAIN_I, true);
+
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode],
+                                               AR5K_RF_PLO_SEL, true);
+
+               /* TODO: Half/quarter channel support */
        }
 
-       /* Copy values to modify them */
-       for (i = 0; i < rf_size; i++) {
-               if (rf_ini[i].rf_bank >= AR5K_RF5112_INI_RF_MAX_BANKS) {
-                       ATH5K_ERR(ah->ah_sc, "invalid bank\n");
-                       return -EINVAL;
-               }
+       if (ah->ah_radio == AR5K_RF5112) {
 
-               if (bank != rf_ini[i].rf_bank) {
-                       bank = rf_ini[i].rf_bank;
-                       ah->ah_offset[bank] = i;
-               }
+               /* Set gain_F settings according to current step */
+               if (channel->hw_value & CHANNEL_OFDM) {
 
-               rf[i] = rf_ini[i].rf_value[mode];
-       }
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[0],
+                                               AR5K_RF_MIXGAIN_OVR, true);
 
-       /*
-        * After compairing dumps from different cards
-        * we get the same RF_BUFFER settings (diff returns
-        * 0 lines). It seems that RF_BUFFER settings are static
-        * and are written unmodified (no EEPROM stuff
-        * is used because calibration data would be
-        * different between different cards and would result
-        * different RF_BUFFER settings)
-        */
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[1],
+                                               AR5K_RF_PWD_138, true);
 
-       /* Write RF values */
-       for (i = 0; i < rf_size; i++)
-               ath5k_hw_reg_write(ah, rf[i], rf_ini[i].rf_register);
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[2],
+                                               AR5K_RF_PWD_137, true);
 
-       return 0;
-}
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[3],
+                                               AR5K_RF_PWD_136, true);
 
-/*
- * Initialize RF
- */
-int ath5k_hw_rfregs(struct ath5k_hw *ah, struct ieee80211_channel *channel,
-               unsigned int mode)
-{
-       int (*func)(struct ath5k_hw *, struct ieee80211_channel *, unsigned int);
-       int ret;
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[4],
+                                               AR5K_RF_PWD_132, true);
 
-       switch (ah->ah_radio) {
-       case AR5K_RF5111:
-               ah->ah_rf_banks_size = sizeof(rfregs_5111);
-               func = ath5k_hw_rf5111_rfregs;
-               break;
-       case AR5K_RF5112:
-               if (ah->ah_radio_5ghz_revision >= AR5K_SREV_RAD_5112A)
-                       ah->ah_rf_banks_size = sizeof(rfregs_5112a);
-               else
-                       ah->ah_rf_banks_size = sizeof(rfregs_5112);
-               func = ath5k_hw_rf5112_rfregs;
-               break;
-       case AR5K_RF5413:
-               ah->ah_rf_banks_size = sizeof(rfregs_5413);
-               func = ath5k_hw_rf5413_rfregs;
-               break;
-       case AR5K_RF2413:
-               ah->ah_rf_banks_size = sizeof(rfregs_2413);
-               func = ath5k_hw_rf5413_rfregs;
-               break;
-       case AR5K_RF2425:
-               ah->ah_rf_banks_size = sizeof(rfregs_2425);
-               func = ath5k_hw_rf5413_rfregs;
-               break;
-       default:
-               return -EINVAL;
-       }
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[5],
+                                               AR5K_RF_PWD_131, true);
 
-       if (ah->ah_rf_banks == NULL) {
-               /* XXX do extra checks? */
-               ah->ah_rf_banks = kmalloc(ah->ah_rf_banks_size, GFP_KERNEL);
-               if (ah->ah_rf_banks == NULL) {
-                       ATH5K_ERR(ah->ah_sc, "out of memory\n");
-                       return -ENOMEM;
+                       ath5k_hw_rfb_op(ah, rf_regs, g_step->gos_param[6],
+                                               AR5K_RF_PWD_130, true);
+
+                       /* We programmed gain_F parameters, switch back
+                        * to active state */
+                       ah->ah_gain.g_state = AR5K_RFGAIN_ACTIVE;
                }
-       }
 
-       ret = func(ah, channel, mode);
-       if (!ret)
-               ah->ah_rf_gain = AR5K_RFGAIN_INACTIVE;
+               /* Bank 6/7 setup */
 
-       return ret;
-}
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_xpd[ee_mode],
+                                               AR5K_RF_XPD_SEL, true);
 
-int ath5k_hw_rfgain(struct ath5k_hw *ah, unsigned int freq)
-{
-       const struct ath5k_ini_rfgain *ath5k_rfg;
-       unsigned int i, size;
+               if (ah->ah_radio_5ghz_revision < AR5K_SREV_RAD_5112A) {
+                       /* Rev. 1 supports only one xpd */
+                       ath5k_hw_rfb_op(ah, rf_regs,
+                                               ee->ee_x_gain[ee_mode],
+                                               AR5K_RF_XPD_GAIN, true);
 
-       switch (ah->ah_radio) {
-       case AR5K_RF5111:
-               ath5k_rfg = rfgain_5111;
-               size = ARRAY_SIZE(rfgain_5111);
-               break;
-       case AR5K_RF5112:
-               ath5k_rfg = rfgain_5112;
-               size = ARRAY_SIZE(rfgain_5112);
-               break;
-       case AR5K_RF5413:
-               ath5k_rfg = rfgain_5413;
-               size = ARRAY_SIZE(rfgain_5413);
-               break;
-       case AR5K_RF2413:
-               ath5k_rfg = rfgain_2413;
-               size = ARRAY_SIZE(rfgain_2413);
-               freq = 0; /* only 2Ghz */
-               break;
-       case AR5K_RF2425:
-               ath5k_rfg = rfgain_2425;
-               size = ARRAY_SIZE(rfgain_2425);
-               freq = 0; /* only 2Ghz */
-               break;
-       default:
-               return -EINVAL;
-       }
+               } else {
+                       /* TODO: Set high and low gain bits */
+                       ath5k_hw_rfb_op(ah, rf_regs,
+                                               ee->ee_x_gain[ee_mode],
+                                               AR5K_RF_PD_GAIN_LO, true);
+                       ath5k_hw_rfb_op(ah, rf_regs,
+                                               ee->ee_x_gain[ee_mode],
+                                               AR5K_RF_PD_GAIN_HI, true);
 
-       switch (freq) {
-       case AR5K_INI_RFGAIN_2GHZ:
-       case AR5K_INI_RFGAIN_5GHZ:
-               break;
-       default:
-               return -EINVAL;
-       }
+                       /* Lower synth voltage on Rev 2 */
+                       ath5k_hw_rfb_op(ah, rf_regs, 2,
+                                       AR5K_RF_HIGH_VC_CP, true);
 
-       for (i = 0; i < size; i++) {
-               AR5K_REG_WAIT(i);
-               ath5k_hw_reg_write(ah, ath5k_rfg[i].rfg_value[freq],
-                       (u32)ath5k_rfg[i].rfg_register);
-       }
+                       ath5k_hw_rfb_op(ah, rf_regs, 2,
+                                       AR5K_RF_MID_VC_CP, true);
 
-       return 0;
-}
+                       ath5k_hw_rfb_op(ah, rf_regs, 2,
+                                       AR5K_RF_LOW_VC_CP, true);
 
-enum ath5k_rfgain ath5k_hw_get_rf_gain(struct ath5k_hw *ah)
-{
-       u32 data, type;
+                       ath5k_hw_rfb_op(ah, rf_regs, 2,
+                                       AR5K_RF_PUSH_UP, true);
 
-       ATH5K_TRACE(ah->ah_sc);
+                       /* Decrease power consumption on 5213+ BaseBand */
+                       if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) {
+                               ath5k_hw_rfb_op(ah, rf_regs, 1,
+                                               AR5K_RF_PAD2GND, true);
 
-       if (ah->ah_rf_banks == NULL || !ah->ah_gain.g_active ||
-                       ah->ah_version <= AR5K_AR5211)
-               return AR5K_RFGAIN_INACTIVE;
+                               ath5k_hw_rfb_op(ah, rf_regs, 1,
+                                               AR5K_RF_XB2_LVL, true);
 
-       if (ah->ah_rf_gain != AR5K_RFGAIN_READ_REQUESTED)
-               goto done;
+                               ath5k_hw_rfb_op(ah, rf_regs, 1,
+                                               AR5K_RF_XB5_LVL, true);
 
-       data = ath5k_hw_reg_read(ah, AR5K_PHY_PAPD_PROBE);
+                               ath5k_hw_rfb_op(ah, rf_regs, 1,
+                                               AR5K_RF_PWD_167, true);
 
-       if (!(data & AR5K_PHY_PAPD_PROBE_TX_NEXT)) {
-               ah->ah_gain.g_current = data >> AR5K_PHY_PAPD_PROBE_GAINF_S;
-               type = AR5K_REG_MS(data, AR5K_PHY_PAPD_PROBE_TYPE);
+                               ath5k_hw_rfb_op(ah, rf_regs, 1,
+                                               AR5K_RF_PWD_166, true);
+                       }
+               }
 
-               if (type == AR5K_PHY_PAPD_PROBE_TYPE_CCK)
-                       ah->ah_gain.g_current += AR5K_GAIN_CCK_PROBE_CORR;
+               ath5k_hw_rfb_op(ah, rf_regs, ee->ee_i_gain[ee_mode],
+                                               AR5K_RF_GAIN_I, true);
 
-               if (ah->ah_radio >= AR5K_RF5112) {
-                       ath5k_hw_rfregs_gainf_corr(ah);
-                       ah->ah_gain.g_current =
-                               ah->ah_gain.g_current >= ah->ah_gain.g_f_corr ?
-                               (ah->ah_gain.g_current-ah->ah_gain.g_f_corr) :
-                               0;
-               }
+               /* TODO: Half/quarter channel support */
 
-               if (ath5k_hw_rfregs_gain_readback(ah) &&
-                               AR5K_GAIN_CHECK_ADJUST(&ah->ah_gain) &&
-                               ath5k_hw_rfregs_gain_adjust(ah))
-                       ah->ah_rf_gain = AR5K_RFGAIN_NEED_CHANGE;
        }
 
-done:
-       return ah->ah_rf_gain;
-}
+       if (ah->ah_radio == AR5K_RF5413 &&
+       channel->hw_value & CHANNEL_2GHZ) {
+
+               ath5k_hw_rfb_op(ah, rf_regs, 1, AR5K_RF_DERBY_CHAN_SEL_MODE,
+                                                                       true);
+
+               /* Set optimum value for early revisions (on pci-e chips) */
+               if (ah->ah_mac_srev >= AR5K_SREV_AR5424 &&
+               ah->ah_mac_srev < AR5K_SREV_AR5413)
+                       ath5k_hw_rfb_op(ah, rf_regs, ath5k_hw_bitswap(6, 3),
+                                               AR5K_RF_PWD_ICLOBUF_2G, true);
 
-int ath5k_hw_set_rfgain_opt(struct ath5k_hw *ah)
-{
-       /* Initialize the gain optimization values */
-       switch (ah->ah_radio) {
-       case AR5K_RF5111:
-               ah->ah_gain.g_step_idx = rfgain_opt_5111.go_default;
-               ah->ah_gain.g_step =
-                   &rfgain_opt_5111.go_step[ah->ah_gain.g_step_idx];
-               ah->ah_gain.g_low = 20;
-               ah->ah_gain.g_high = 35;
-               ah->ah_gain.g_active = 1;
-               break;
-       case AR5K_RF5112:
-               ah->ah_gain.g_step_idx = rfgain_opt_5112.go_default;
-               ah->ah_gain.g_step =
-                   &rfgain_opt_5112.go_step[ah->ah_gain.g_step_idx];
-               ah->ah_gain.g_low = 20;
-               ah->ah_gain.g_high = 85;
-               ah->ah_gain.g_active = 1;
-               break;
-       default:
-               return -EINVAL;
+       }
+
+       /* Write RF banks on hw */
+       for (i = 0; i < ah->ah_rf_banks_size; i++) {
+               AR5K_REG_WAIT(i);
+               ath5k_hw_reg_write(ah, rfb[i], ini_rfb[i].rfb_ctrl_register);
        }
 
        return 0;
 }
 
+
 /**************************\
   PHY/RF channel functions
 \**************************/
@@ -2271,13 +1331,8 @@ done:
         * as often as I/Q calibration.*/
        ath5k_hw_noise_floor_calibration(ah, channel->center_freq);
 
-       /* Request RF gain */
-       if (channel->hw_value & CHANNEL_5GHZ) {
-               ath5k_hw_reg_write(ah, AR5K_REG_SM(ah->ah_txpower.txp_max,
-                       AR5K_PHY_PAPD_PROBE_TXPOWER) |
-                       AR5K_PHY_PAPD_PROBE_TX_NEXT, AR5K_PHY_PAPD_PROBE);
-               ah->ah_rf_gain = AR5K_RFGAIN_READ_REQUESTED;
-       }
+       /* Initiate a gain_F calibration */
+       ath5k_hw_request_rfgain_probe(ah);
 
        return 0;
 }
index 1b7bc50ea8eb212b68fdd51f96283de34998e693..5094c394a4b2c9b1270e7a8c664540b02e0a2bf0 100644 (file)
@@ -148,6 +148,7 @@ int ath5k_hw_setup_tx_queue(struct ath5k_hw *ah, enum ath5k_tx_queue queue_type,
  */
 u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue)
 {
+       u32 pending;
        ATH5K_TRACE(ah->ah_sc);
        AR5K_ASSERT_ENTRY(queue, ah->ah_capabilities.cap_queues.q_tx_num);
 
@@ -159,7 +160,15 @@ u32 ath5k_hw_num_tx_pending(struct ath5k_hw *ah, unsigned int queue)
        if (ah->ah_version == AR5K_AR5210)
                return false;
 
-       return AR5K_QUEUE_STATUS(queue) & AR5K_QCU_STS_FRMPENDCNT;
+       pending = (AR5K_QUEUE_STATUS(queue) & AR5K_QCU_STS_FRMPENDCNT);
+
+       /* It's possible to have no frames pending even if TXE
+        * is set. To indicate that q has not stopped return
+        * true */
+       if (!pending && AR5K_REG_READ_Q(ah, AR5K_QCU_TXE, queue))
+               return true;
+
+       return pending;
 }
 
 /*
@@ -324,8 +333,18 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
                /*
                 * Set misc registers
                 */
-               ath5k_hw_reg_write(ah, AR5K_QCU_MISC_DCU_EARLY,
-                       AR5K_QUEUE_MISC(queue));
+               /* Enable DCU early termination for this queue */
+               AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_MISC(queue),
+                                       AR5K_QCU_MISC_DCU_EARLY);
+
+               /* Enable DCU to wait for next fragment from QCU */
+               AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue),
+                                       AR5K_DCU_MISC_FRAG_WAIT);
+
+               /* On Maui and Spirit use the global seqnum on DCU */
+               if (ah->ah_mac_version < AR5K_SREV_AR5211)
+                       AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue),
+                                               AR5K_DCU_MISC_SEQNUM_CTL);
 
                if (tq->tqi_cbr_period) {
                        ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_cbr_period,
@@ -341,7 +360,8 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
                                        AR5K_QCU_MISC_CBR_THRES_ENABLE);
                }
 
-               if (tq->tqi_ready_time)
+               if (tq->tqi_ready_time &&
+               (tq->tqi_type != AR5K_TX_QUEUE_ID_CAB))
                        ath5k_hw_reg_write(ah, AR5K_REG_SM(tq->tqi_ready_time,
                                AR5K_QCU_RDYTIMECFG_INTVAL) |
                                AR5K_QCU_RDYTIMECFG_ENABLE,
@@ -383,13 +403,6 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
                                AR5K_DCU_MISC_ARBLOCK_CTL_S) |
                                AR5K_DCU_MISC_POST_FR_BKOFF_DIS |
                                AR5K_DCU_MISC_BCN_ENABLE);
-
-                       ath5k_hw_reg_write(ah, ((AR5K_TUNE_BEACON_INTERVAL -
-                               (AR5K_TUNE_SW_BEACON_RESP -
-                               AR5K_TUNE_DMA_BEACON_RESP) -
-                               AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF) * 1024) |
-                               AR5K_QCU_RDYTIMECFG_ENABLE,
-                               AR5K_QUEUE_RDYTIMECFG(queue));
                        break;
 
                case AR5K_TX_QUEUE_CAB:
@@ -398,6 +411,13 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
                                AR5K_QCU_MISC_CBREXP_DIS |
                                AR5K_QCU_MISC_CBREXP_BCN_DIS);
 
+                       ath5k_hw_reg_write(ah, ((AR5K_TUNE_BEACON_INTERVAL -
+                               (AR5K_TUNE_SW_BEACON_RESP -
+                               AR5K_TUNE_DMA_BEACON_RESP) -
+                               AR5K_TUNE_ADDITIONAL_SWBA_BACKOFF) * 1024) |
+                               AR5K_QCU_RDYTIMECFG_ENABLE,
+                               AR5K_QUEUE_RDYTIMECFG(queue));
+
                        AR5K_REG_ENABLE_BITS(ah, AR5K_QUEUE_DFS_MISC(queue),
                                (AR5K_DCU_MISC_ARBLOCK_CTL_GLOBAL <<
                                AR5K_DCU_MISC_ARBLOCK_CTL_S));
@@ -413,6 +433,8 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
                        break;
                }
 
+               /* TODO: Handle frame compression */
+
                /*
                 * Enable interrupts for this tx queue
                 * in the secondary interrupt mask registers
@@ -483,6 +505,9 @@ int ath5k_hw_reset_tx_queue(struct ath5k_hw *ah, unsigned int queue)
                 * by setting AR5K_TXNOFRM to zero */
                if (ah->ah_txq_imr_nofrm == 0)
                        ath5k_hw_reg_write(ah, 0, AR5K_TXNOFRM);
+
+               /* Set QCU mask for this DCU to save power */
+               AR5K_REG_WRITE_Q(ah, AR5K_QUEUE_QCUMASK(queue), queue);
        }
 
        return 0;
index 9189ab13286cafde039c7201fec8ae17c456fde2..2dc008e102268baf945fe2e8b064c99c5e7e7233 100644 (file)
 #define AR5K_TXCFG_FRMPAD_DIS          0x00002000      /* [5211+] */
 #define AR5K_TXCFG_RDY_CBR_DIS         0x00004000      /* Ready time CBR disable [5211+] */
 #define AR5K_TXCFG_JUMBO_FRM_MODE      0x00008000      /* Jumbo frame mode [5211+] */
+#define        AR5K_TXCFG_DCU_DBL_BUF_DIS      0x00008000      /* Disable double buffering on DCU */
 #define AR5K_TXCFG_DCU_CACHING_DIS     0x00010000      /* Disable DCU caching */
 
 /*
  */
 #define AR5K_DCU_SEQNUM_BASE           0x1140
 #define        AR5K_DCU_SEQNUM_M               0x00000fff
-#define        AR5K_QUEUE_DFS_SEQNUM(_q)       AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q)
+#define        AR5K_QUEUE_DCU_SEQNUM(_q)       AR5K_QUEUE_REG(AR5K_DCU_SEQNUM_BASE, _q)
 
 /*
  * DCU global IFS SIFS register
 
 /*
  * DCU transmit filter table 0 (32 entries)
+ * each entry contains a 32bit slice of the
+ * 128bit tx filter for each DCU (4 slices per DCU)
  */
 #define AR5K_DCU_TX_FILTER_0_BASE      0x1038
 #define        AR5K_DCU_TX_FILTER_0(_n)        (AR5K_DCU_TX_FILTER_0_BASE + (_n * 64))
  * DCU transmit filter table 1 (16 entries)
  */
 #define AR5K_DCU_TX_FILTER_1_BASE      0x103c
-#define        AR5K_DCU_TX_FILTER_1(_n)        (AR5K_DCU_TX_FILTER_1_BASE + ((_n - 32) * 64))
+#define        AR5K_DCU_TX_FILTER_1(_n)        (AR5K_DCU_TX_FILTER_1_BASE + (_n * 64))
 
 /*
  * DCU clear transmit filter register
                                AR5K_TSF_U32_5210 : AR5K_TSF_U32_5211)
 
 /*
- * Last beacon timestamp register
+ * Last beacon timestamp register (Read Only)
  */
 #define AR5K_LAST_TSTP 0x8080
 
 #define AR5K_ADDAC_TEST_TRIG_PTY       0x00020000      /* Trigger polarity */
 #define AR5K_ADDAC_TEST_RXCONT         0x00040000      /* Continuous capture */
 #define AR5K_ADDAC_TEST_CAPTURE                0x00080000      /* Begin capture */
-#define AR5K_ADDAC_TEST_TST_ARM                0x00100000      /* Test ARM (Adaptive Radio Mode ?) */
+#define AR5K_ADDAC_TEST_TST_ARM                0x00100000      /* ARM rx buffer for capture */
 
 /*
  * Default antenna register [5211+]
  * TSF parameter register
  */
 #define AR5K_TSF_PARM                  0x8104                  /* Register Address */
-#define AR5K_TSF_PARM_INC_M            0x000000ff      /* Mask for TSF increment */
+#define AR5K_TSF_PARM_INC              0x000000ff      /* Mask for TSF increment */
 #define AR5K_TSF_PARM_INC_S            0
 
 /*
 #define AR5K_QOS_NOACK_BIT_OFFSET      0x00000070      /* ??? */
 #define AR5K_QOS_NOACK_BIT_OFFSET_S    4
 #define AR5K_QOS_NOACK_BYTE_OFFSET     0x00000180      /* ??? */
-#define AR5K_QOS_NOACK_BYTE_OFFSET_S   8
+#define AR5K_QOS_NOACK_BYTE_OFFSET_S   7
 
 /*
  * PHY error filter register
  * TST_2 (Misc config parameters)
  */
 #define        AR5K_PHY_TST2                   0x9800                  /* Register Address */
-#define AR5K_PHY_TST2_TRIG_SEL         0x00000001      /* Trigger select (?) (field ?) */
-#define AR5K_PHY_TST2_TRIG             0x00000010      /* Trigger (?) (field ?) */
-#define AR5K_PHY_TST2_CBUS_MODE                0x00000100      /* Cardbus mode (?) */
-/* bit reserved */
+#define AR5K_PHY_TST2_TRIG_SEL         0x00000007      /* Trigger select (?)*/
+#define AR5K_PHY_TST2_TRIG             0x00000010      /* Trigger (?) */
+#define AR5K_PHY_TST2_CBUS_MODE                0x00000060      /* Cardbus mode (?) */
 #define AR5K_PHY_TST2_CLK32            0x00000400      /* CLK_OUT is CLK32 (32Khz external) */
 #define AR5K_PHY_TST2_CHANCOR_DUMP_EN  0x00000800      /* Enable Chancor dump (?) */
 #define AR5K_PHY_TST2_EVEN_CHANCOR_DUMP        0x00001000      /* Even Chancor dump (?) */
 #define AR5K_PHY_TST2_RFSILENT_EN      0x00002000      /* Enable RFSILENT */
-#define AR5K_PHY_TST2_ALT_RFDATA       0x00004000      /* Alternate RFDATA (5-2GHz switch) */
+#define AR5K_PHY_TST2_ALT_RFDATA       0x00004000      /* Alternate RFDATA (5-2GHz switch ?) */
 #define AR5K_PHY_TST2_MINI_OBS_EN      0x00008000      /* Enable mini OBS (?) */
 #define AR5K_PHY_TST2_RX2_IS_RX5_INV   0x00010000      /* 2GHz rx path is the 5GHz path inverted (?) */
 #define AR5K_PHY_TST2_SLOW_CLK160      0x00020000      /* Slow CLK160 (?) */
 #define        AR5K_PHY_RF_CTL2_TXF2TXD_START_S        0
 
 #define AR5K_PHY_RF_CTL3               0x9828                  /* Register Address */
-#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON   0x0000000f      /* TX end to XLNA on */
-#define        AR5K_PHY_RF_CTL3_TXE2XLNA_ON_S  0
+#define AR5K_PHY_RF_CTL3_TXE2XLNA_ON   0x0000ff00      /* TX end to XLNA on */
+#define        AR5K_PHY_RF_CTL3_TXE2XLNA_ON_S  8
 
 #define        AR5K_PHY_ADC_CTL                        0x982c
 #define        AR5K_PHY_ADC_CTL_INBUFGAIN_OFF          0x00000003
 #define        AR5K_PHY_SETTLING_AGC           0x0000007f      /* AGC settling time */
 #define        AR5K_PHY_SETTLING_AGC_S         0
 #define        AR5K_PHY_SETTLING_SWITCH        0x00003f80      /* Switch settlig time */
-#define        AR5K_PHY_SETTLINK_SWITCH_S      7
+#define        AR5K_PHY_SETTLING_SWITCH_S      7
 
 /*
  * PHY Gain registers
  * PHY sleep registers [5112+]
  */
 #define AR5K_PHY_SCR                   0x9870
-#define AR5K_PHY_SCR_32MHZ             0x0000001f
 
 #define AR5K_PHY_SLMT                  0x9874
 #define AR5K_PHY_SLMT_32MHZ            0x0000007f
 
 #define AR5K_PHY_SCAL                  0x9878
 #define AR5K_PHY_SCAL_32MHZ            0x0000000e
-
+#define        AR5K_PHY_SCAL_32MHZ_2417        0x0000000a
+#define        AR5K_PHY_SCAL_32MHZ_HB63        0x00000032
 
 /*
  * PHY PLL (Phase Locked Loop) control register
 /*
  * RF Buffer register
  *
- * There are some special control registers on the RF chip
- * that hold various operation settings related mostly to
- * the analog parts (channel, gain adjustment etc).
- *
- * We don't write on those registers directly but
- * we send a data packet on the buffer register and
- * then write on another special register to notify hw
- * to apply the settings. This is done so that control registers
- * can be dynamicaly programmed during operation and the settings
- * are applied faster on the hw.
- *
- * We sent such data packets during rf initialization and channel change
- * through ath5k_hw_rf*_rfregs and ath5k_hw_rf*_channel functions.
- *
- * The data packets we send during initializadion are inside ath5k_ini_rf
- * struct (see ath5k_hw.h) and each one is related to an "rf register bank".
- * We use *rfregs functions to modify them  acording to current operation
- * mode and eeprom values and pass them all together to the chip.
- *
  * It's obvious from the code that 0x989c is the buffer register but
  * for the other special registers that we write to after sending each
  * packet, i have no idea. So i'll name them BUFFER_CONTROL_X registers
  * for now. It's interesting that they are also used for some other operations.
- *
- * Also check out hw.h and U.S. Patent 6677779 B1 (about buffer
- * registers and control registers):
- *
- * http://www.google.com/patents?id=qNURAAAAEBAJ
  */
 
 #define AR5K_RF_BUFFER                 0x989c
 #define        AR5K_PHY_ANT_CTL_TXRX_EN        0x00000001      /* Enable TX/RX (?) */
 #define        AR5K_PHY_ANT_CTL_SECTORED_ANT   0x00000004      /* Sectored Antenna */
 #define        AR5K_PHY_ANT_CTL_HITUNE5        0x00000008      /* Hitune5 (?) */
-#define        AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x00000010      /* Switch table idle (?) */
+#define        AR5K_PHY_ANT_CTL_SWTABLE_IDLE   0x000003f0      /* Switch table idle (?) */
+#define        AR5K_PHY_ANT_CTL_SWTABLE_IDLE_S 4
 
 /*
  * PHY receiver delay register [5111+]
 #define        AR5K_PHY_OFDM_SELFCORR                  0x9924                  /* Register Address */
 #define        AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_EN    0x00000001      /* Enable cyclic RSSI thr 1 */
 #define        AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1       0x000000fe      /* Mask for Cyclic RSSI threshold 1 */
-#define        AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S     0
+#define        AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1_S     1
 #define        AR5K_PHY_OFDM_SELFCORR_CYPWR_THR3       0x00000100      /* Cyclic RSSI threshold 3 (field) (?) */
 #define        AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR_EN    0x00008000      /* Enable 1A RSSI threshold (?) */
 #define        AR5K_PHY_OFDM_SELFCORR_RSSI_1ATHR       0x00010000      /* 1A RSSI threshold (field) (?) */
 #define        AR5K_PHY_CTL_LOW_FREQ_SLE_EN    0x00000080      /* Enable low freq sleep */
 
 /*
- * PHY PAPD probe register [5111+ (?)]
- * Is this only present in 5212 ?
- * Because it's always 0 in 5211 initialization code
+ * PHY PAPD probe register [5111+]
  */
 #define        AR5K_PHY_PAPD_PROBE             0x9930
 #define        AR5K_PHY_PAPD_PROBE_SH_HI_PAR   0x00000001
                        AR5K_PHY_FRAME_CTL_PARITY_ERR | \
                        AR5K_PHY_FRAME_CTL_TIMING_ERR
 
+/*
+ * PHY Tx Power adjustment register [5212A+]
+ */
+#define        AR5K_PHY_TX_PWR_ADJ                     0x994c
+#define        AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA      0x00000fc0
+#define        AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA_S    6
+#define        AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX     0x00fc0000
+#define        AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX_S   18
+
 /*
  * PHY radar detection register [5111+]
  */
 #define AR5K_PHY_SIGMA_DELTA_FILT2_S   3
 #define AR5K_PHY_SIGMA_DELTA_FILT1     0x00001f00
 #define AR5K_PHY_SIGMA_DELTA_FILT1_S   8
-#define AR5K_PHY_SIGMA_DELTA_ADC_CLIP  0x01ff3000
+#define AR5K_PHY_SIGMA_DELTA_ADC_CLIP  0x01ffe000
 #define AR5K_PHY_SIGMA_DELTA_ADC_CLIP_S        13
 
 /*
 #define AR5K_PHY_BIN_MASK2_4_MASK_4    0x00003fff
 #define AR5K_PHY_BIN_MASK2_4_MASK_4_S  0
 
-#define AR_PHY_TIMING_9                        0x9998
-#define AR_PHY_TIMING_10               0x999c
-#define AR_PHY_TIMING_10_PILOT_MASK_2  0x000fffff
-#define AR_PHY_TIMING_10_PILOT_MASK_2_S        0
+#define AR5K_PHY_TIMING_9                      0x9998
+#define AR5K_PHY_TIMING_10                     0x999c
+#define AR5K_PHY_TIMING_10_PILOT_MASK_2                0x000fffff
+#define AR5K_PHY_TIMING_10_PILOT_MASK_2_S      0
 
 /*
  * Spur mitigation control
  */
-#define AR_PHY_TIMING_11                       0x99a0          /* Register address */
-#define AR_PHY_TIMING_11_SPUR_DELTA_PHASE      0x000fffff      /* Spur delta phase */
-#define AR_PHY_TIMING_11_SPUR_DELTA_PHASE_S    0
-#define AR_PHY_TIMING_11_SPUR_FREQ_SD          0x3ff00000      /* Freq sigma delta */
-#define AR_PHY_TIMING_11_SPUR_FREQ_SD_S        20
-#define AR_PHY_TIMING_11_USE_SPUR_IN_AGC       0x40000000      /* Spur filter in AGC detector */
-#define AR_PHY_TIMING_11_USE_SPUR_IN_SELFCOR   0x80000000      /* Spur filter in OFDM self correlator */
+#define AR5K_PHY_TIMING_11                     0x99a0          /* Register address */
+#define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE    0x000fffff      /* Spur delta phase */
+#define AR5K_PHY_TIMING_11_SPUR_DELTA_PHASE_S  0
+#define AR5K_PHY_TIMING_11_SPUR_FREQ_SD                0x3ff00000      /* Freq sigma delta */
+#define AR5K_PHY_TIMING_11_SPUR_FREQ_SD_S      20
+#define AR5K_PHY_TIMING_11_USE_SPUR_IN_AGC     0x40000000      /* Spur filter in AGC detector */
+#define AR5K_PHY_TIMING_11_USE_SPUR_IN_SELFCOR 0x80000000      /* Spur filter in OFDM self correlator */
 
 /*
  * Gain tables
 #define AR5K_PHY_SDELAY                        0x99f4
 #define AR5K_PHY_SDELAY_32MHZ          0x000000ff
 #define AR5K_PHY_SPENDING              0x99f8
-#define AR5K_PHY_SPENDING_14           0x00000014
-#define AR5K_PHY_SPENDING_18           0x00000018
-#define AR5K_PHY_SPENDING_RF5111       0x00000018
-#define AR5K_PHY_SPENDING_RF5112       0x00000014
-/* #define AR5K_PHY_SPENDING_RF5112A   0x0000000e */
-/* #define AR5K_PHY_SPENDING_RF5424    0x00000012 */
-#define AR5K_PHY_SPENDING_RF5413       0x00000018
-#define AR5K_PHY_SPENDING_RF2413       0x00000018
-#define AR5K_PHY_SPENDING_RF2316       0x00000018
-#define AR5K_PHY_SPENDING_RF2317       0x00000018
-#define AR5K_PHY_SPENDING_RF2425       0x00000014
+
 
 /*
  * PHY PAPD I (power?) table (?)
 /*
  * PHY PCDAC TX power table
  */
-#define        AR5K_PHY_PCDAC_TXPOWER_BASE_5211        0xa180
-#define AR5K_PHY_PCDAC_TXPOWER_BASE_2413       0xa280
-#define AR5K_PHY_PCDAC_TXPOWER_BASE    (ah->ah_radio >= AR5K_RF2413 ? \
-                                       AR5K_PHY_PCDAC_TXPOWER_BASE_2413 :\
-                                       AR5K_PHY_PCDAC_TXPOWER_BASE_5211)
+#define        AR5K_PHY_PCDAC_TXPOWER_BASE     0xa180
 #define        AR5K_PHY_PCDAC_TXPOWER(_n)      (AR5K_PHY_PCDAC_TXPOWER_BASE + ((_n) << 2))
 
 /*
 #define        AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_3_S   16
 #define        AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4     0x0FC00000
 #define        AR5K_PHY_TPC_RG5_PD_GAIN_BOUNDARY_4_S   22
+
+/*
+ * PHY PDADC Tx power table
+ */
+#define AR5K_PHY_PDADC_TXPOWER_BASE    0xa280
+#define        AR5K_PHY_PDADC_TXPOWER(_n)      (AR5K_PHY_PDADC_TXPOWER_BASE + ((_n) << 2))
index dc2d7d8bdb7aceda7a27d52571b1047f65e86a3e..1531ccd35066a52bfdb895f619a875bfb81ee879 100644 (file)
@@ -25,7 +25,8 @@
   Reset functions and helpers
 \*****************************/
 
-#include <linux/pci.h>
+#include <linux/pci.h>                 /* To determine if a card is pci-e */
+#include <linux/bitops.h>      /* For get_bitmask_order */
 #include "ath5k.h"
 #include "reg.h"
 #include "base.h"
  * @ah: the &struct ath5k_hw
  * @channel: the currently set channel upon reset
  *
- * Write the OFDM timings for the AR5212 upon reset. This is a helper for
- * ath5k_hw_reset(). This seems to tune the PLL a specified frequency
- * depending on the bandwidth of the channel.
+ * Write the delta slope coefficient (used on pilot tracking ?) for OFDM
+ * operation on the AR5212 upon reset. This is a helper for ath5k_hw_reset().
  *
+ * Since delta slope is floating point we split it on its exponent and
+ * mantissa and provide these values on hw.
+ *
+ * For more infos i think this patent is related
+ * http://www.freepatentsonline.com/7184495.html
  */
 static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah,
        struct ieee80211_channel *channel)
@@ -53,23 +58,34 @@ static inline int ath5k_hw_write_ofdm_timings(struct ath5k_hw *ah,
                !(channel->hw_value & CHANNEL_OFDM))
                BUG();
 
-       /* Seems there are two PLLs, one for baseband sampling and one
-        * for tuning. Tuning basebands are 40 MHz or 80MHz when in
-        * turbo. */
-       clock = channel->hw_value & CHANNEL_TURBO ? 80 : 40;
-       coef_scaled = ((5 * (clock << 24)) / 2) /
-       channel->center_freq;
+       /* Get coefficient
+        * ALGO: coef = (5 * clock * carrier_freq) / 2)
+        * we scale coef by shifting clock value by 24 for
+        * better precision since we use integers */
+       /* TODO: Half/quarter rate */
+       clock =  ath5k_hw_htoclock(1, channel->hw_value & CHANNEL_TURBO);
 
-       for (coef_exp = 31; coef_exp > 0; coef_exp--)
-               if ((coef_scaled >> coef_exp) & 0x1)
-                       break;
+       coef_scaled = ((5 * (clock << 24)) / 2) / channel->center_freq;
+
+       /* Get exponent
+        * ALGO: coef_exp = 14 - highest set bit position */
+       coef_exp = get_bitmask_order(coef_scaled);
 
+       /* Doesn't make sense if it's zero*/
        if (!coef_exp)
                return -EINVAL;
 
+       /* Note: we've shifted coef_scaled by 24 */
        coef_exp = 14 - (coef_exp - 24);
+
+
+       /* Get mantissa (significant digits)
+        * ALGO: coef_mant = floor(coef_scaled* 2^coef_exp+0.5) */
        coef_man = coef_scaled +
                (1 << (24 - coef_exp - 1));
+
+       /* Calculate delta slope coefficient exponent
+        * and mantissa (remove scaling) and set them on hw */
        ds_coef_man = coef_man >> (24 - coef_exp);
        ds_coef_exp = coef_exp - 16;
 
@@ -90,16 +106,23 @@ static int control_rates[] =
        { 0, 1, 1, 1, 4, 4, 6, 6, 8, 8, 8, 8 };
 
 /**
- * ath5k_hw_write_rate_duration - set rate duration during hw resets
+ * ath5k_hw_write_rate_duration - fill rate code to duration table
  *
  * @ah: the &struct ath5k_hw
  * @mode: one of enum ath5k_driver_mode
  *
- * Write the rate duration table upon hw reset. This is a helper for
- * ath5k_hw_reset(). It seems all this is doing is setting an ACK timeout for
- * the hardware for the current mode for each rate. The rates which are capable
- * of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have another
- * register for the short preamble ACK timeout calculation.
+ * Write the rate code to duration table upon hw reset. This is a helper for
+ * ath5k_hw_reset(). It seems all this is doing is setting an ACK timeout on
+ * the hardware, based on current mode, for each rate. The rates which are
+ * capable of short preamble (802.11b rates 2Mbps, 5.5Mbps, and 11Mbps) have
+ * different rate code so we write their value twice (one for long preample
+ * and one for short).
+ *
+ * Note: Band doesn't matter here, if we set the values for OFDM it works
+ * on both a and g modes. So all we have to do is set values for all g rates
+ * that include all OFDM and CCK rates. If we operate in turbo or xr/half/
+ * quarter rate mode, we need to use another set of bitrates (that's why we
+ * need the mode parameter) but we don't handle these proprietary modes yet.
  */
 static inline void ath5k_hw_write_rate_duration(struct ath5k_hw *ah,
        unsigned int mode)
@@ -275,7 +298,8 @@ commit:
 }
 
 /*
- * Bring up MAC + PHY Chips
+ * Bring up MAC + PHY Chips and program PLL
+ * TODO: Half/Quarter rate support
  */
 int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
 {
@@ -333,7 +357,11 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
                        }
                } else if (flags & CHANNEL_5GHZ) {
                        mode |= AR5K_PHY_MODE_FREQ_5GHZ;
-                       clock |= AR5K_PHY_PLL_40MHZ;
+
+                       if (ah->ah_radio == AR5K_RF5413)
+                               clock |= AR5K_PHY_PLL_40MHZ_5413;
+                       else
+                               clock |= AR5K_PHY_PLL_40MHZ;
 
                        if (flags & CHANNEL_OFDM)
                                mode |= AR5K_PHY_MODE_MOD_OFDM;
@@ -391,10 +419,14 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
        }
 
        if (ah->ah_version != AR5K_AR5210) {
-               /* ...set the PHY operating mode */
-               ath5k_hw_reg_write(ah, clock, AR5K_PHY_PLL);
-               udelay(300);
 
+               /* ...update PLL if needed */
+               if (ath5k_hw_reg_read(ah, AR5K_PHY_PLL) != clock) {
+                       ath5k_hw_reg_write(ah, clock, AR5K_PHY_PLL);
+                       udelay(300);
+               }
+
+               /* ...set the PHY operating mode */
                ath5k_hw_reg_write(ah, mode, AR5K_PHY_MODE);
                ath5k_hw_reg_write(ah, turbo, AR5K_PHY_TURBO);
        }
@@ -402,23 +434,394 @@ int ath5k_hw_nic_wakeup(struct ath5k_hw *ah, int flags, bool initial)
        return 0;
 }
 
+/*
+ * If there is an external 32KHz crystal available, use it
+ * as ref. clock instead of 32/40MHz clock and baseband clocks
+ * to save power during sleep or restore normal 32/40MHz
+ * operation.
+ *
+ * XXX: When operating on 32KHz certain PHY registers (27 - 31,
+ *     123 - 127) require delay on access.
+ */
+static void ath5k_hw_set_sleep_clock(struct ath5k_hw *ah, bool enable)
+{
+       struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
+       u32 scal, spending, usec32;
+
+       /* Only set 32KHz settings if we have an external
+        * 32KHz crystal present */
+       if ((AR5K_EEPROM_HAS32KHZCRYSTAL(ee->ee_misc1) ||
+       AR5K_EEPROM_HAS32KHZCRYSTAL_OLD(ee->ee_misc1)) &&
+       enable) {
+
+               /* 1 usec/cycle */
+               AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, 1);
+               /* Set up tsf increment on each cycle */
+               AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 61);
+
+               /* Set baseband sleep control registers
+                * and sleep control rate */
+               ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR);
+
+               if ((ah->ah_radio == AR5K_RF5112) ||
+               (ah->ah_radio == AR5K_RF5413) ||
+               (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
+                       spending = 0x14;
+               else
+                       spending = 0x18;
+               ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING);
+
+               if ((ah->ah_radio == AR5K_RF5112) ||
+               (ah->ah_radio == AR5K_RF5413) ||
+               (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) {
+                       ath5k_hw_reg_write(ah, 0x26, AR5K_PHY_SLMT);
+                       ath5k_hw_reg_write(ah, 0x0d, AR5K_PHY_SCAL);
+                       ath5k_hw_reg_write(ah, 0x07, AR5K_PHY_SCLOCK);
+                       ath5k_hw_reg_write(ah, 0x3f, AR5K_PHY_SDELAY);
+                       AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
+                               AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x02);
+               } else {
+                       ath5k_hw_reg_write(ah, 0x0a, AR5K_PHY_SLMT);
+                       ath5k_hw_reg_write(ah, 0x0c, AR5K_PHY_SCAL);
+                       ath5k_hw_reg_write(ah, 0x03, AR5K_PHY_SCLOCK);
+                       ath5k_hw_reg_write(ah, 0x20, AR5K_PHY_SDELAY);
+                       AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
+                               AR5K_PCICFG_SLEEP_CLOCK_RATE, 0x03);
+               }
+
+               /* Enable sleep clock operation */
+               AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG,
+                               AR5K_PCICFG_SLEEP_CLOCK_EN);
+
+       } else {
+
+               /* Disable sleep clock operation and
+                * restore default parameters */
+               AR5K_REG_DISABLE_BITS(ah, AR5K_PCICFG,
+                               AR5K_PCICFG_SLEEP_CLOCK_EN);
+
+               AR5K_REG_WRITE_BITS(ah, AR5K_PCICFG,
+                               AR5K_PCICFG_SLEEP_CLOCK_RATE, 0);
+
+               ath5k_hw_reg_write(ah, 0x1f, AR5K_PHY_SCR);
+               ath5k_hw_reg_write(ah, AR5K_PHY_SLMT_32MHZ, AR5K_PHY_SLMT);
+
+               if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
+                       scal = AR5K_PHY_SCAL_32MHZ_2417;
+               else if (ath5k_eeprom_is_hb63(ah))
+                       scal = AR5K_PHY_SCAL_32MHZ_HB63;
+               else
+                       scal = AR5K_PHY_SCAL_32MHZ;
+               ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL);
+
+               ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK);
+               ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY);
+
+               if ((ah->ah_radio == AR5K_RF5112) ||
+               (ah->ah_radio == AR5K_RF5413) ||
+               (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
+                       spending = 0x14;
+               else
+                       spending = 0x18;
+               ath5k_hw_reg_write(ah, spending, AR5K_PHY_SPENDING);
+
+               if ((ah->ah_radio == AR5K_RF5112) ||
+               (ah->ah_radio == AR5K_RF5413))
+                       usec32 = 39;
+               else
+                       usec32 = 31;
+               AR5K_REG_WRITE_BITS(ah, AR5K_USEC_5211, AR5K_USEC_32, usec32);
+
+               AR5K_REG_WRITE_BITS(ah, AR5K_TSF_PARM, AR5K_TSF_PARM_INC, 1);
+       }
+       return;
+}
+
+static bool ath5k_hw_chan_has_spur_noise(struct ath5k_hw *ah,
+                               struct ieee80211_channel *channel)
+{
+       u8 refclk_freq;
+
+       if ((ah->ah_radio == AR5K_RF5112) ||
+       (ah->ah_radio == AR5K_RF5413) ||
+       (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4)))
+               refclk_freq = 40;
+       else
+               refclk_freq = 32;
+
+       if ((channel->center_freq % refclk_freq != 0) &&
+       ((channel->center_freq % refclk_freq < 10) ||
+       (channel->center_freq % refclk_freq > 22)))
+               return true;
+       else
+               return false;
+}
+
+/* TODO: Half/Quarter rate */
+static void ath5k_hw_tweak_initval_settings(struct ath5k_hw *ah,
+                               struct ieee80211_channel *channel)
+{
+       if (ah->ah_version == AR5K_AR5212 &&
+           ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) {
+
+               /* Setup ADC control */
+               ath5k_hw_reg_write(ah,
+                               (AR5K_REG_SM(2,
+                               AR5K_PHY_ADC_CTL_INBUFGAIN_OFF) |
+                               AR5K_REG_SM(2,
+                               AR5K_PHY_ADC_CTL_INBUFGAIN_ON) |
+                               AR5K_PHY_ADC_CTL_PWD_DAC_OFF |
+                               AR5K_PHY_ADC_CTL_PWD_ADC_OFF),
+                               AR5K_PHY_ADC_CTL);
+
+
+
+               /* Disable barker RSSI threshold */
+               AR5K_REG_DISABLE_BITS(ah, AR5K_PHY_DAG_CCK_CTL,
+                               AR5K_PHY_DAG_CCK_CTL_EN_RSSI_THR);
+
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DAG_CCK_CTL,
+                       AR5K_PHY_DAG_CCK_CTL_RSSI_THR, 2);
+
+               /* Set the mute mask */
+               ath5k_hw_reg_write(ah, 0x0000000f, AR5K_SEQ_MASK);
+       }
+
+       /* Clear PHY_BLUETOOTH to allow RX_CLEAR line debug */
+       if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212B)
+               ath5k_hw_reg_write(ah, 0, AR5K_PHY_BLUETOOTH);
+
+       /* Enable DCU double buffering */
+       if (ah->ah_phy_revision > AR5K_SREV_PHY_5212B)
+               AR5K_REG_DISABLE_BITS(ah, AR5K_TXCFG,
+                               AR5K_TXCFG_DCU_DBL_BUF_DIS);
+
+       /* Set DAC/ADC delays */
+       if (ah->ah_version == AR5K_AR5212) {
+               u32 scal;
+               if (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))
+                       scal = AR5K_PHY_SCAL_32MHZ_2417;
+               else if (ath5k_eeprom_is_hb63(ah))
+                       scal = AR5K_PHY_SCAL_32MHZ_HB63;
+               else
+                       scal = AR5K_PHY_SCAL_32MHZ;
+               ath5k_hw_reg_write(ah, scal, AR5K_PHY_SCAL);
+       }
+
+       /* Set fast ADC */
+       if ((ah->ah_radio == AR5K_RF5413) ||
+       (ah->ah_mac_version == (AR5K_SREV_AR2417 >> 4))) {
+               u32 fast_adc = true;
+
+               if (channel->center_freq == 2462 ||
+               channel->center_freq == 2467)
+                       fast_adc = 0;
+
+               /* Only update if needed */
+               if (ath5k_hw_reg_read(ah, AR5K_PHY_FAST_ADC) != fast_adc)
+                               ath5k_hw_reg_write(ah, fast_adc,
+                                               AR5K_PHY_FAST_ADC);
+       }
+
+       /* Fix for first revision of the RF5112 RF chipset */
+       if (ah->ah_radio == AR5K_RF5112 &&
+                       ah->ah_radio_5ghz_revision <
+                       AR5K_SREV_RAD_5112A) {
+               u32 data;
+               ath5k_hw_reg_write(ah, AR5K_PHY_CCKTXCTL_WORLD,
+                               AR5K_PHY_CCKTXCTL);
+               if (channel->hw_value & CHANNEL_5GHZ)
+                       data = 0xffb81020;
+               else
+                       data = 0xffb80d20;
+               ath5k_hw_reg_write(ah, data, AR5K_PHY_FRAME_CTL);
+       }
+
+       if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
+               u32 usec_reg;
+               /* 5311 has different tx/rx latency masks
+                * from 5211, since we deal 5311 the same
+                * as 5211 when setting initvals, shift
+                * values here to their proper locations */
+               usec_reg = ath5k_hw_reg_read(ah, AR5K_USEC_5211);
+               ath5k_hw_reg_write(ah, usec_reg & (AR5K_USEC_1 |
+                               AR5K_USEC_32 |
+                               AR5K_USEC_TX_LATENCY_5211 |
+                               AR5K_REG_SM(29,
+                               AR5K_USEC_RX_LATENCY_5210)),
+                               AR5K_USEC_5211);
+               /* Clear QCU/DCU clock gating register */
+               ath5k_hw_reg_write(ah, 0, AR5K_QCUDCU_CLKGT);
+               /* Set DAC/ADC delays */
+               ath5k_hw_reg_write(ah, 0x08, AR5K_PHY_SCAL);
+               /* Enable PCU FIFO corruption ECO */
+               AR5K_REG_ENABLE_BITS(ah, AR5K_DIAG_SW_5211,
+                                       AR5K_DIAG_SW_ECO_ENABLE);
+       }
+}
+
+static void ath5k_hw_commit_eeprom_settings(struct ath5k_hw *ah,
+               struct ieee80211_channel *channel, u8 *ant, u8 ee_mode)
+{
+       struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
+
+       /* Set CCK to OFDM power delta */
+       if (ah->ah_phy_revision >= AR5K_SREV_PHY_5212A) {
+               int16_t cck_ofdm_pwr_delta;
+
+               /* Adjust power delta for channel 14 */
+               if (channel->center_freq == 2484)
+                       cck_ofdm_pwr_delta =
+                               ((ee->ee_cck_ofdm_power_delta -
+                               ee->ee_scaled_cck_delta) * 2) / 10;
+               else
+                       cck_ofdm_pwr_delta =
+                               (ee->ee_cck_ofdm_power_delta * 2) / 10;
+
+               if (channel->hw_value == CHANNEL_G)
+                       ath5k_hw_reg_write(ah,
+                       AR5K_REG_SM((ee->ee_cck_ofdm_power_delta * -1),
+                               AR5K_PHY_TX_PWR_ADJ_CCK_GAIN_DELTA) |
+                       AR5K_REG_SM((cck_ofdm_pwr_delta * -1),
+                               AR5K_PHY_TX_PWR_ADJ_CCK_PCDAC_INDEX),
+                               AR5K_PHY_TX_PWR_ADJ);
+               else
+                       ath5k_hw_reg_write(ah, 0, AR5K_PHY_TX_PWR_ADJ);
+       }
+
+       /* Set antenna idle switch table */
+       AR5K_REG_WRITE_BITS(ah, AR5K_PHY_ANT_CTL,
+                       AR5K_PHY_ANT_CTL_SWTABLE_IDLE,
+                       (ah->ah_antenna[ee_mode][0] |
+                       AR5K_PHY_ANT_CTL_TXRX_EN));
+
+       /* Set antenna switch table */
+       ath5k_hw_reg_write(ah, ah->ah_antenna[ee_mode][ant[0]],
+               AR5K_PHY_ANT_SWITCH_TABLE_0);
+       ath5k_hw_reg_write(ah, ah->ah_antenna[ee_mode][ant[1]],
+               AR5K_PHY_ANT_SWITCH_TABLE_1);
+
+       /* Noise floor threshold */
+       ath5k_hw_reg_write(ah,
+               AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]),
+               AR5K_PHY_NFTHRES);
+
+       if ((channel->hw_value & CHANNEL_TURBO) &&
+       (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_0)) {
+               /* Switch settling time (Turbo) */
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING,
+                               AR5K_PHY_SETTLING_SWITCH,
+                               ee->ee_switch_settling_turbo[ee_mode]);
+
+               /* Tx/Rx attenuation (Turbo) */
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN,
+                               AR5K_PHY_GAIN_TXRX_ATTEN,
+                               ee->ee_atn_tx_rx_turbo[ee_mode]);
+
+               /* ADC/PGA desired size (Turbo) */
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE,
+                               AR5K_PHY_DESIRED_SIZE_ADC,
+                               ee->ee_adc_desired_size_turbo[ee_mode]);
+
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE,
+                               AR5K_PHY_DESIRED_SIZE_PGA,
+                               ee->ee_pga_desired_size_turbo[ee_mode]);
+
+               /* Tx/Rx margin (Turbo) */
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN_2GHZ,
+                               AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX,
+                               ee->ee_margin_tx_rx_turbo[ee_mode]);
+
+       } else {
+               /* Switch settling time */
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_SETTLING,
+                               AR5K_PHY_SETTLING_SWITCH,
+                               ee->ee_switch_settling[ee_mode]);
+
+               /* Tx/Rx attenuation */
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN,
+                               AR5K_PHY_GAIN_TXRX_ATTEN,
+                               ee->ee_atn_tx_rx[ee_mode]);
+
+               /* ADC/PGA desired size */
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE,
+                               AR5K_PHY_DESIRED_SIZE_ADC,
+                               ee->ee_adc_desired_size[ee_mode]);
+
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_DESIRED_SIZE,
+                               AR5K_PHY_DESIRED_SIZE_PGA,
+                               ee->ee_pga_desired_size[ee_mode]);
+
+               /* Tx/Rx margin */
+               if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_1)
+                       AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN_2GHZ,
+                               AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX,
+                               ee->ee_margin_tx_rx[ee_mode]);
+       }
+
+       /* XPA delays */
+       ath5k_hw_reg_write(ah,
+               (ee->ee_tx_end2xpa_disable[ee_mode] << 24) |
+               (ee->ee_tx_end2xpa_disable[ee_mode] << 16) |
+               (ee->ee_tx_frm2xpa_enable[ee_mode] << 8) |
+               (ee->ee_tx_frm2xpa_enable[ee_mode]), AR5K_PHY_RF_CTL4);
+
+       /* XLNA delay */
+       AR5K_REG_WRITE_BITS(ah, AR5K_PHY_RF_CTL3,
+                       AR5K_PHY_RF_CTL3_TXE2XLNA_ON,
+                       ee->ee_tx_end2xlna_enable[ee_mode]);
+
+       /* Thresh64 (ANI) */
+       AR5K_REG_WRITE_BITS(ah, AR5K_PHY_NF,
+                       AR5K_PHY_NF_THRESH62,
+                       ee->ee_thr_62[ee_mode]);
+
+
+       /* False detect backoff for channels
+        * that have spur noise. Write the new
+        * cyclic power RSSI threshold. */
+       if (ath5k_hw_chan_has_spur_noise(ah, channel))
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_OFDM_SELFCORR,
+                               AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1,
+                               AR5K_INIT_CYCRSSI_THR1 +
+                               ee->ee_false_detect[ee_mode]);
+       else
+               AR5K_REG_WRITE_BITS(ah, AR5K_PHY_OFDM_SELFCORR,
+                               AR5K_PHY_OFDM_SELFCORR_CYPWR_THR1,
+                               AR5K_INIT_CYCRSSI_THR1);
+
+       /* I/Q correction
+        * TODO: Per channel i/q infos ? */
+       AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
+               AR5K_PHY_IQ_CORR_ENABLE |
+               (ee->ee_i_cal[ee_mode] << AR5K_PHY_IQ_CORR_Q_I_COFF_S) |
+               ee->ee_q_cal[ee_mode]);
+
+       /* Heavy clipping -disable for now */
+       if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_5_1)
+               ath5k_hw_reg_write(ah, 0, AR5K_PHY_HEAVY_CLIP_ENABLE);
+
+       return;
+}
+
 /*
  * Main reset function
  */
 int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
        struct ieee80211_channel *channel, bool change_channel)
 {
-       struct ath5k_eeprom_info *ee = &ah->ah_capabilities.cap_eeprom;
-       struct pci_dev *pdev = ah->ah_sc->pdev;
-       u32 data, s_seq, s_ant, s_led[3], dma_size;
-       unsigned int i, mode, freq, ee_mode, ant[2];
-       int ret;
+       u32 s_seq[10], s_ant, s_led[3], staid1_flags, tsf_up, tsf_lo;
+       u32 phy_tst1;
+       u8 mode, freq, ee_mode, ant[2];
+       int i, ret;
 
        ATH5K_TRACE(ah->ah_sc);
 
-       s_seq = 0;
        s_ant = 0;
        ee_mode = 0;
+       staid1_flags = 0;
+       tsf_up = 0;
+       tsf_lo = 0;
        freq = 0;
        mode = 0;
 
@@ -427,48 +830,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
         */
        /*DCU/Antenna selection not available on 5210*/
        if (ah->ah_version != AR5K_AR5210) {
-               if (change_channel) {
-                       /* Seq number for queue 0 -do this for all queues ? */
-                       s_seq = ath5k_hw_reg_read(ah,
-                                       AR5K_QUEUE_DFS_SEQNUM(0));
-                       /*Default antenna*/
-                       s_ant = ath5k_hw_reg_read(ah, AR5K_DEFAULT_ANTENNA);
-               }
-       }
-
-       /*GPIOs*/
-       s_led[0] = ath5k_hw_reg_read(ah, AR5K_PCICFG) & AR5K_PCICFG_LEDSTATE;
-       s_led[1] = ath5k_hw_reg_read(ah, AR5K_GPIOCR);
-       s_led[2] = ath5k_hw_reg_read(ah, AR5K_GPIODO);
-
-       if (change_channel && ah->ah_rf_banks != NULL)
-               ath5k_hw_get_rf_gain(ah);
-
-
-       /*Wakeup the device*/
-       ret = ath5k_hw_nic_wakeup(ah, channel->hw_value, false);
-       if (ret)
-               return ret;
-
-       /*
-        * Initialize operating mode
-        */
-       ah->ah_op_mode = op_mode;
-
-       /*
-        * 5111/5112 Settings
-        * 5210 only comes with RF5110
-        */
-       if (ah->ah_version != AR5K_AR5210) {
-               if (ah->ah_radio != AR5K_RF5111 &&
-                       ah->ah_radio != AR5K_RF5112 &&
-                       ah->ah_radio != AR5K_RF5413 &&
-                       ah->ah_radio != AR5K_RF2413 &&
-                       ah->ah_radio != AR5K_RF2425) {
-                       ATH5K_ERR(ah->ah_sc,
-                               "invalid phy radio: %u\n", ah->ah_radio);
-                       return -EINVAL;
-               }
 
                switch (channel->hw_value & CHANNEL_MODES) {
                case CHANNEL_A:
@@ -491,8 +852,12 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                        freq = AR5K_INI_RFGAIN_5GHZ;
                        ee_mode = AR5K_EEPROM_MODE_11A;
                        break;
-               /*Is this ok on 5211 too ?*/
                case CHANNEL_TG:
+                       if (ah->ah_version == AR5K_AR5211) {
+                               ATH5K_ERR(ah->ah_sc,
+                                       "TurboG mode not available on 5211");
+                               return -EINVAL;
+                       }
                        mode = AR5K_MODE_11G_TURBO;
                        freq = AR5K_INI_RFGAIN_2GHZ;
                        ee_mode = AR5K_EEPROM_MODE_11G;
@@ -513,11 +878,93 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                        return -EINVAL;
                }
 
-               /* PHY access enable */
-               ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0));
+               if (change_channel) {
+                       /*
+                        * Save frame sequence count
+                        * For revs. after Oahu, only save
+                        * seq num for DCU 0 (Global seq num)
+                        */
+                       if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
+
+                               for (i = 0; i < 10; i++)
+                                       s_seq[i] = ath5k_hw_reg_read(ah,
+                                               AR5K_QUEUE_DCU_SEQNUM(i));
+
+                       } else {
+                               s_seq[0] = ath5k_hw_reg_read(ah,
+                                               AR5K_QUEUE_DCU_SEQNUM(0));
+                       }
+
+                       /* TSF accelerates on AR5211 durring reset
+                        * As a workaround save it here and restore
+                        * it later so that it's back in time after
+                        * reset. This way it'll get re-synced on the
+                        * next beacon without breaking ad-hoc.
+                        *
+                        * On AR5212 TSF is almost preserved across a
+                        * reset so it stays back in time anyway and
+                        * we don't have to save/restore it.
+                        *
+                        * XXX: Since this breaks power saving we have
+                        * to disable power saving until we receive the
+                        * next beacon, so we can resync beacon timers */
+                       if (ah->ah_version == AR5K_AR5211) {
+                               tsf_up = ath5k_hw_reg_read(ah, AR5K_TSF_U32);
+                               tsf_lo = ath5k_hw_reg_read(ah, AR5K_TSF_L32);
+                       }
+               }
+
+               /* Save default antenna */
+               s_ant = ath5k_hw_reg_read(ah, AR5K_DEFAULT_ANTENNA);
 
+               if (ah->ah_version == AR5K_AR5212) {
+                       /* Restore normal 32/40MHz clock operation
+                        * to avoid register access delay on certain
+                        * PHY registers */
+                       ath5k_hw_set_sleep_clock(ah, false);
+
+                       /* Since we are going to write rf buffer
+                        * check if we have any pending gain_F
+                        * optimization settings */
+                       if (change_channel && ah->ah_rf_banks != NULL)
+                               ath5k_hw_gainf_calibrate(ah);
+               }
        }
 
+       /*GPIOs*/
+       s_led[0] = ath5k_hw_reg_read(ah, AR5K_PCICFG) &
+                                       AR5K_PCICFG_LEDSTATE;
+       s_led[1] = ath5k_hw_reg_read(ah, AR5K_GPIOCR);
+       s_led[2] = ath5k_hw_reg_read(ah, AR5K_GPIODO);
+
+       /* AR5K_STA_ID1 flags, only preserve antenna
+        * settings and ack/cts rate mode */
+       staid1_flags = ath5k_hw_reg_read(ah, AR5K_STA_ID1) &
+                       (AR5K_STA_ID1_DEFAULT_ANTENNA |
+                       AR5K_STA_ID1_DESC_ANTENNA |
+                       AR5K_STA_ID1_RTS_DEF_ANTENNA |
+                       AR5K_STA_ID1_ACKCTS_6MB |
+                       AR5K_STA_ID1_BASE_RATE_11B |
+                       AR5K_STA_ID1_SELFGEN_DEF_ANT);
+
+       /* Wakeup the device */
+       ret = ath5k_hw_nic_wakeup(ah, channel->hw_value, false);
+       if (ret)
+               return ret;
+
+       /*
+        * Initialize operating mode
+        */
+       ah->ah_op_mode = op_mode;
+
+       /* PHY access enable */
+       if (ah->ah_mac_srev >= AR5K_SREV_AR5211)
+               ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ, AR5K_PHY(0));
+       else
+               ath5k_hw_reg_write(ah, AR5K_PHY_SHIFT_5GHZ | 0x40,
+                                                       AR5K_PHY(0));
+
+       /* Write initial settings */
        ret = ath5k_hw_write_initvals(ah, mode, change_channel);
        if (ret)
                return ret;
@@ -526,64 +973,23 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
         * 5211/5212 Specific
         */
        if (ah->ah_version != AR5K_AR5210) {
+
                /*
                 * Write initial RF gain settings
                 * This should work for both 5111/5112
                 */
-               ret = ath5k_hw_rfgain(ah, freq);
+               ret = ath5k_hw_rfgain_init(ah, freq);
                if (ret)
                        return ret;
 
                mdelay(1);
 
                /*
-                * Write some more initial register settings for revised chips
+                * Tweak initval settings for revised
+                * chipsets and add some more config
+                * bits
                 */
-               if (ah->ah_version == AR5K_AR5212 &&
-                   ah->ah_phy_revision > 0x41) {
-                       ath5k_hw_reg_write(ah, 0x0002a002, 0x982c);
-
-                       if (channel->hw_value == CHANNEL_G)
-                               if (ah->ah_mac_srev < AR5K_SREV_AR2413)
-                                       ath5k_hw_reg_write(ah, 0x00f80d80,
-                                                               0x994c);
-                               else if (ah->ah_mac_srev < AR5K_SREV_AR5424)
-                                       ath5k_hw_reg_write(ah, 0x00380140,
-                                                               0x994c);
-                               else if (ah->ah_mac_srev < AR5K_SREV_AR2425)
-                                       ath5k_hw_reg_write(ah, 0x00fc0ec0,
-                                                               0x994c);
-                               else /* 2425 */
-                                       ath5k_hw_reg_write(ah, 0x00fc0fc0,
-                                                               0x994c);
-                       else
-                               ath5k_hw_reg_write(ah, 0x00000000, 0x994c);
-
-                       /* Got this from legacy-hal */
-                       AR5K_REG_DISABLE_BITS(ah, 0xa228, 0x200);
-
-                       AR5K_REG_MASKED_BITS(ah, 0xa228, 0x800, 0xfffe03ff);
-
-                       /* Just write 0x9b5 ? */
-                       /* ath5k_hw_reg_write(ah, 0x000009b5, 0xa228); */
-                       ath5k_hw_reg_write(ah, 0x0000000f, AR5K_SEQ_MASK);
-                       ath5k_hw_reg_write(ah, 0x00000000, 0xa254);
-                       ath5k_hw_reg_write(ah, 0x0000000e, AR5K_PHY_SCAL);
-               }
-
-               /* Fix for first revision of the RF5112 RF chipset */
-               if (ah->ah_radio >= AR5K_RF5112 &&
-                               ah->ah_radio_5ghz_revision <
-                               AR5K_SREV_RAD_5112A) {
-                       ath5k_hw_reg_write(ah, AR5K_PHY_CCKTXCTL_WORLD,
-                                       AR5K_PHY_CCKTXCTL);
-                       if (channel->hw_value & CHANNEL_5GHZ)
-                               data = 0xffb81020;
-                       else
-                               data = 0xffb80d20;
-                       ath5k_hw_reg_write(ah, data, AR5K_PHY_FRAME_CTL);
-                       data = 0;
-               }
+               ath5k_hw_tweak_initval_settings(ah, channel);
 
                /*
                 * Set TX power (FIXME)
@@ -601,15 +1007,12 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                        ath5k_hw_write_rate_duration(ah, mode);
 
                /*
-                * Write RF registers
+                * Write RF buffer
                 */
-               ret = ath5k_hw_rfregs(ah, channel, mode);
+               ret = ath5k_hw_rfregs_init(ah, channel, mode);
                if (ret)
                        return ret;
 
-               /*
-                * Configure additional registers
-                */
 
                /* Write OFDM timings on 5212*/
                if (ah->ah_version == AR5K_AR5212 &&
@@ -630,17 +1033,6 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                                    AR5K_TXCFG_B_MODE);
                }
 
-               /*
-                * Set channel and calibrate the PHY
-                */
-               ret = ath5k_hw_channel(ah, channel);
-               if (ret)
-                       return ret;
-
-               /* Set antenna mode */
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_ANT_CTL,
-                       ah->ah_antenna[ee_mode][0], 0xfffffc06);
-
                /*
                 * In case a fixed antenna was set as default
                 * write the same settings on both AR5K_PHY_ANT_SWITCH_TABLE
@@ -656,54 +1048,16 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                        ant[1] = AR5K_ANT_FIXED_B;
                }
 
-               ath5k_hw_reg_write(ah, ah->ah_antenna[ee_mode][ant[0]],
-                       AR5K_PHY_ANT_SWITCH_TABLE_0);
-               ath5k_hw_reg_write(ah, ah->ah_antenna[ee_mode][ant[1]],
-                       AR5K_PHY_ANT_SWITCH_TABLE_1);
-
                /* Commit values from EEPROM */
-               if (ah->ah_radio == AR5K_RF5111)
-                       AR5K_REG_WRITE_BITS(ah, AR5K_PHY_FRAME_CTL,
-                           AR5K_PHY_FRAME_CTL_TX_CLIP, ee->ee_tx_clip);
-
-               ath5k_hw_reg_write(ah,
-                       AR5K_PHY_NF_SVAL(ee->ee_noise_floor_thr[ee_mode]),
-                       AR5K_PHY_NFTHRES);
-
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_SETTLING,
-                       (ee->ee_switch_settling[ee_mode] << 7) & 0x3f80,
-                       0xffffc07f);
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_GAIN,
-                       (ee->ee_atn_tx_rx[ee_mode] << 12) & 0x3f000,
-                       0xfffc0fff);
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_DESIRED_SIZE,
-                       (ee->ee_adc_desired_size[ee_mode] & 0x00ff) |
-                       ((ee->ee_pga_desired_size[ee_mode] << 8) & 0xff00),
-                       0xffff0000);
-
-               ath5k_hw_reg_write(ah,
-                       (ee->ee_tx_end2xpa_disable[ee_mode] << 24) |
-                       (ee->ee_tx_end2xpa_disable[ee_mode] << 16) |
-                       (ee->ee_tx_frm2xpa_enable[ee_mode] << 8) |
-                       (ee->ee_tx_frm2xpa_enable[ee_mode]), AR5K_PHY_RF_CTL4);
-
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_RF_CTL3,
-                       ee->ee_tx_end2xlna_enable[ee_mode] << 8, 0xffff00ff);
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_NF,
-                       (ee->ee_thr_62[ee_mode] << 12) & 0x7f000, 0xfff80fff);
-               AR5K_REG_MASKED_BITS(ah, AR5K_PHY_OFDM_SELFCORR, 4, 0xffffff01);
-
-               AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_IQ,
-                   AR5K_PHY_IQ_CORR_ENABLE |
-                   (ee->ee_i_cal[ee_mode] << AR5K_PHY_IQ_CORR_Q_I_COFF_S) |
-                   ee->ee_q_cal[ee_mode]);
-
-               if (ah->ah_ee_version >= AR5K_EEPROM_VERSION_4_1)
-                       AR5K_REG_WRITE_BITS(ah, AR5K_PHY_GAIN_2GHZ,
-                               AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX,
-                               ee->ee_margin_tx_rx[ee_mode]);
+               ath5k_hw_commit_eeprom_settings(ah, channel, ant, ee_mode);
 
        } else {
+               /*
+                * For 5210 we do all initialization using
+                * initvals, so we don't have to modify
+                * any settings (5210 also only supports
+                * a/aturbo modes)
+                */
                mdelay(1);
                /* Disable phy and wait */
                ath5k_hw_reg_write(ah, AR5K_PHY_ACT_DISABLE, AR5K_PHY_ACT);
@@ -713,100 +1067,154 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
        /*
         * Restore saved values
         */
+
        /*DCU/Antenna selection not available on 5210*/
        if (ah->ah_version != AR5K_AR5210) {
-               ath5k_hw_reg_write(ah, s_seq, AR5K_QUEUE_DFS_SEQNUM(0));
+
+               if (change_channel) {
+                       if (ah->ah_mac_srev < AR5K_SREV_AR5211) {
+                               for (i = 0; i < 10; i++)
+                                       ath5k_hw_reg_write(ah, s_seq[i],
+                                               AR5K_QUEUE_DCU_SEQNUM(i));
+                       } else {
+                               ath5k_hw_reg_write(ah, s_seq[0],
+                                       AR5K_QUEUE_DCU_SEQNUM(0));
+                       }
+
+
+                       if (ah->ah_version == AR5K_AR5211) {
+                               ath5k_hw_reg_write(ah, tsf_up, AR5K_TSF_U32);
+                               ath5k_hw_reg_write(ah, tsf_lo, AR5K_TSF_L32);
+                       }
+               }
+
                ath5k_hw_reg_write(ah, s_ant, AR5K_DEFAULT_ANTENNA);
        }
+
+       /* Ledstate */
        AR5K_REG_ENABLE_BITS(ah, AR5K_PCICFG, s_led[0]);
+
+       /* Gpio settings */
        ath5k_hw_reg_write(ah, s_led[1], AR5K_GPIOCR);
        ath5k_hw_reg_write(ah, s_led[2], AR5K_GPIODO);
 
+       /* Restore sta_id flags and preserve our mac address*/
+       ath5k_hw_reg_write(ah, AR5K_LOW_ID(ah->ah_sta_id),
+                                               AR5K_STA_ID0);
+       ath5k_hw_reg_write(ah, staid1_flags | AR5K_HIGH_ID(ah->ah_sta_id),
+                                               AR5K_STA_ID1);
+
+
        /*
-        * Misc
+        * Configure PCU
         */
+
+       /* Restore bssid and bssid mask */
        /* XXX: add ah->aid once mac80211 gives this to us */
        ath5k_hw_set_associd(ah, ah->ah_bssid, 0);
 
+       /* Set PCU config */
        ath5k_hw_set_opmode(ah);
-       /*PISR/SISR Not available on 5210*/
-       if (ah->ah_version != AR5K_AR5210) {
+
+       /* Clear any pending interrupts
+        * PISR/SISR Not available on 5210 */
+       if (ah->ah_version != AR5K_AR5210)
                ath5k_hw_reg_write(ah, 0xffffffff, AR5K_PISR);
-               /* If we later allow tuning for this, store into sc structure */
-               data = AR5K_TUNE_RSSI_THRES |
-                       AR5K_TUNE_BMISS_THRES << AR5K_RSSI_THR_BMISS_S;
-               ath5k_hw_reg_write(ah, data, AR5K_RSSI_THR);
+
+       /* Set RSSI/BRSSI thresholds
+        *
+        * Note: If we decide to set this value
+        * dynamicaly, have in mind that when AR5K_RSSI_THR
+        * register is read it might return 0x40 if we haven't
+        * wrote anything to it plus BMISS RSSI threshold is zeroed.
+        * So doing a save/restore procedure here isn't the right
+        * choice. Instead store it on ath5k_hw */
+       ath5k_hw_reg_write(ah, (AR5K_TUNE_RSSI_THRES |
+                               AR5K_TUNE_BMISS_THRES <<
+                               AR5K_RSSI_THR_BMISS_S),
+                               AR5K_RSSI_THR);
+
+       /* MIC QoS support */
+       if (ah->ah_mac_srev >= AR5K_SREV_AR2413) {
+               ath5k_hw_reg_write(ah, 0x000100aa, AR5K_MIC_QOS_CTL);
+               ath5k_hw_reg_write(ah, 0x00003210, AR5K_MIC_QOS_SEL);
        }
 
+       /* QoS NOACK Policy */
+       if (ah->ah_version == AR5K_AR5212) {
+               ath5k_hw_reg_write(ah,
+                       AR5K_REG_SM(2, AR5K_QOS_NOACK_2BIT_VALUES) |
+                       AR5K_REG_SM(5, AR5K_QOS_NOACK_BIT_OFFSET)  |
+                       AR5K_REG_SM(0, AR5K_QOS_NOACK_BYTE_OFFSET),
+                       AR5K_QOS_NOACK);
+       }
+
+
        /*
-        * Set Rx/Tx DMA Configuration
-        *
-        * Set maximum DMA size (512) except for PCI-E cards since
-        * it causes rx overruns and tx errors (tested on 5424 but since
-        * rx overruns also occur on 5416/5418 with madwifi we set 128
-        * for all PCI-E cards to be safe).
-        *
-        * In dumps this is 128 for allchips.
-        *
-        * XXX: need to check 5210 for this
-        * TODO: Check out tx triger level, it's always 64 on dumps but I
-        * guess we can tweak it and see how it goes ;-)
+        * Configure PHY
         */
-       dma_size = (pdev->is_pcie) ? AR5K_DMASIZE_128B : AR5K_DMASIZE_512B;
-       if (ah->ah_version != AR5K_AR5210) {
-               AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG,
-                       AR5K_TXCFG_SDMAMR, dma_size);
-               AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG,
-                       AR5K_RXCFG_SDMAMW, dma_size);
-       }
+
+       /* Set channel on PHY */
+       ret = ath5k_hw_channel(ah, channel);
+       if (ret)
+               return ret;
 
        /*
         * Enable the PHY and wait until completion
+        * This includes BaseBand and Synthesizer
+        * activation.
         */
        ath5k_hw_reg_write(ah, AR5K_PHY_ACT_ENABLE, AR5K_PHY_ACT);
 
        /*
         * On 5211+ read activation -> rx delay
         * and use it.
+        *
+        * TODO: Half/quarter rate support
         */
        if (ah->ah_version != AR5K_AR5210) {
-               data = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) &
+               u32 delay;
+               delay = ath5k_hw_reg_read(ah, AR5K_PHY_RX_DELAY) &
                        AR5K_PHY_RX_DELAY_M;
-               data = (channel->hw_value & CHANNEL_CCK) ?
-                       ((data << 2) / 22) : (data / 10);
+               delay = (channel->hw_value & CHANNEL_CCK) ?
+                       ((delay << 2) / 22) : (delay / 10);
 
-               udelay(100 + (2 * data));
-               data = 0;
+               udelay(100 + (2 * delay));
        } else {
                mdelay(1);
        }
 
        /*
-        * Perform ADC test (?)
+        * Perform ADC test to see if baseband is ready
+        * Set tx hold and check adc test register
         */
-       data = ath5k_hw_reg_read(ah, AR5K_PHY_TST1);
+       phy_tst1 = ath5k_hw_reg_read(ah, AR5K_PHY_TST1);
        ath5k_hw_reg_write(ah, AR5K_PHY_TST1_TXHOLD, AR5K_PHY_TST1);
        for (i = 0; i <= 20; i++) {
                if (!(ath5k_hw_reg_read(ah, AR5K_PHY_ADC_TEST) & 0x10))
                        break;
                udelay(200);
        }
-       ath5k_hw_reg_write(ah, data, AR5K_PHY_TST1);
-       data = 0;
+       ath5k_hw_reg_write(ah, phy_tst1, AR5K_PHY_TST1);
 
        /*
-        * Start automatic gain calibration
+        * Start automatic gain control calibration
         *
         * During AGC calibration RX path is re-routed to
-        * a signal detector so we don't receive anything.
+        * a power detector so we don't receive anything.
         *
         * This method is used to calibrate some static offsets
         * used together with on-the fly I/Q calibration (the
         * one performed via ath5k_hw_phy_calibrate), that doesn't
         * interrupt rx path.
         *
+        * While rx path is re-routed to the power detector we also
+        * start a noise floor calibration, to measure the
+        * card's noise floor (the noise we measure when we are not
+        * transmiting or receiving anything).
+        *
         * If we are in a noisy environment AGC calibration may time
-        * out.
+        * out and/or noise floor calibration might timeout.
         */
        AR5K_REG_ENABLE_BITS(ah, AR5K_PHY_AGCCTL,
                                AR5K_PHY_AGCCTL_CAL);
@@ -828,30 +1236,37 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                        AR5K_PHY_AGCCTL_CAL, 0, false)) {
                ATH5K_ERR(ah->ah_sc, "gain calibration timeout (%uMHz)\n",
                        channel->center_freq);
-               return -EAGAIN;
        }
 
        /*
-        * Start noise floor calibration
-        *
         * If we run NF calibration before AGC, it always times out.
         * Binary HAL starts NF and AGC calibration at the same time
-        * and only waits for AGC to finish. I believe that's wrong because
-        * during NF calibration, rx path is also routed to a detector, so if
-        * it doesn't finish we won't have RX.
-        *
-        * XXX: Find an interval that's OK for all cards...
+        * and only waits for AGC to finish. Also if AGC or NF cal.
+        * times out, reset doesn't fail on binary HAL. I believe
+        * that's wrong because since rx path is routed to a detector,
+        * if cal. doesn't finish we won't have RX. Sam's HAL for AR5210/5211
+        * enables noise floor calibration after offset calibration and if noise
+        * floor calibration fails, reset fails. I believe that's
+        * a better approach, we just need to find a polling interval
+        * that suits best, even if reset continues we need to make
+        * sure that rx path is ready.
         */
        ath5k_hw_noise_floor_calibration(ah, channel->center_freq);
 
+
+       /*
+        * Configure QCUs/DCUs
+        */
+
+       /* TODO: HW Compression support for data queues */
+       /* TODO: Burst prefetch for data queues */
+
        /*
         * Reset queues and start beacon timers at the end of the reset routine
+        * This also sets QCU mask on each DCU for 1:1 qcu to dcu mapping
+        * Note: If we want we can assign multiple qcus on one dcu.
         */
        for (i = 0; i < ah->ah_capabilities.cap_queues.q_tx_num; i++) {
-               /*No QCU on 5210*/
-               if (ah->ah_version != AR5K_AR5210)
-                       AR5K_REG_WRITE_Q(ah, AR5K_QUEUE_QCUMASK(i), i);
-
                ret = ath5k_hw_reset_tx_queue(ah, i);
                if (ret) {
                        ATH5K_ERR(ah->ah_sc,
@@ -860,14 +1275,40 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
                }
        }
 
+
+       /*
+        * Configure DMA/Interrupts
+        */
+
+       /*
+        * Set Rx/Tx DMA Configuration
+        *
+        * Set standard DMA size (128). Note that
+        * a DMA size of 512 causes rx overruns and tx errors
+        * on pci-e cards (tested on 5424 but since rx overruns
+        * also occur on 5416/5418 with madwifi we set 128
+        * for all PCI-E cards to be safe).
+        *
+        * XXX: need to check 5210 for this
+        * TODO: Check out tx triger level, it's always 64 on dumps but I
+        * guess we can tweak it and see how it goes ;-)
+        */
+       if (ah->ah_version != AR5K_AR5210) {
+               AR5K_REG_WRITE_BITS(ah, AR5K_TXCFG,
+                       AR5K_TXCFG_SDMAMR, AR5K_DMASIZE_128B);
+               AR5K_REG_WRITE_BITS(ah, AR5K_RXCFG,
+                       AR5K_RXCFG_SDMAMW, AR5K_DMASIZE_128B);
+       }
+
        /* Pre-enable interrupts on 5211/5212*/
        if (ah->ah_version != AR5K_AR5210)
                ath5k_hw_set_imr(ah, ah->ah_imr);
 
        /*
-        * Set RF kill flags if supported by the device (read from the EEPROM)
-        * Disable gpio_intr for now since it results system hang.
-        * TODO: Handle this in ath5k_intr
+        * Setup RFKill interrupt if rfkill flag is set on eeprom.
+        * TODO: Use gpio pin and polarity infos from eeprom
+        * TODO: Handle this in ath5k_intr because it'll result
+        *       a nasty interrupt storm.
         */
 #if 0
        if (AR5K_EEPROM_HDR_RFKILL(ah->ah_capabilities.cap_eeprom.ee_header)) {
@@ -880,33 +1321,12 @@ int ath5k_hw_reset(struct ath5k_hw *ah, enum nl80211_iftype op_mode,
        }
 #endif
 
-       /*
-        * Set the 32MHz reference clock on 5212 phy clock sleep register
-        *
-        * TODO: Find out how to switch to external 32Khz clock to save power
-        */
-       if (ah->ah_version == AR5K_AR5212) {
-               ath5k_hw_reg_write(ah, AR5K_PHY_SCR_32MHZ, AR5K_PHY_SCR);
-               ath5k_hw_reg_write(ah, AR5K_PHY_SLMT_32MHZ, AR5K_PHY_SLMT);
-               ath5k_hw_reg_write(ah, AR5K_PHY_SCAL_32MHZ, AR5K_PHY_SCAL);
-               ath5k_hw_reg_write(ah, AR5K_PHY_SCLOCK_32MHZ, AR5K_PHY_SCLOCK);
-               ath5k_hw_reg_write(ah, AR5K_PHY_SDELAY_32MHZ, AR5K_PHY_SDELAY);
-               ath5k_hw_reg_write(ah, ah->ah_phy_spending, AR5K_PHY_SPENDING);
-
-               data = ath5k_hw_reg_read(ah, AR5K_USEC_5211) & 0xffffc07f ;
-               data |= (ah->ah_phy_spending == AR5K_PHY_SPENDING_18) ?
-                                               0x00000f80 : 0x00001380 ;
-               ath5k_hw_reg_write(ah, data, AR5K_USEC_5211);
-               data = 0;
-       }
-
-       if (ah->ah_version == AR5K_AR5212) {
-               ath5k_hw_reg_write(ah, 0x000100aa, 0x8118);
-               ath5k_hw_reg_write(ah, 0x00003210, 0x811c);
-               ath5k_hw_reg_write(ah, 0x00000052, 0x8108);
-               if (ah->ah_mac_srev >= AR5K_SREV_AR2413)
-                       ath5k_hw_reg_write(ah, 0x00000004, 0x8120);
-       }
+       /* Enable 32KHz clock function for AR5212+ chips
+        * Set clocks to 32KHz operation and use an
+        * external 32KHz crystal when sleeping if one
+        * exists */
+       if (ah->ah_version == AR5K_AR5212)
+                       ath5k_hw_set_sleep_clock(ah, true);
 
        /*
         * Disable beacons and reset the register
diff --git a/drivers/net/wireless/ath5k/rfbuffer.h b/drivers/net/wireless/ath5k/rfbuffer.h
new file mode 100644 (file)
index 0000000..e50baff
--- /dev/null
@@ -0,0 +1,1181 @@
+/*
+ * RF Buffer handling functions
+ *
+ * Copyright (c) 2009 Nick Kossifidis <mickflemm@gmail.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+
+/*
+ * There are some special registers on the RF chip
+ * that control various operation settings related mostly to
+ * the analog parts (channel, gain adjustment etc).
+ *
+ * We don't write on those registers directly but
+ * we send a data packet on the chip, using a special register,
+ * that holds all the settings we need. After we 've sent the
+ * data packet, we write on another special register to notify hw
+ * to apply the settings. This is done so that control registers
+ * can be dynamicaly programmed during operation and the settings
+ * are applied faster on the hw.
+ *
+ * We call each data packet an "RF Bank" and all the data we write
+ * (all RF Banks) "RF Buffer". This file holds initial RF Buffer
+ * data for the different RF chips, and various info to match RF
+ * Buffer offsets with specific RF registers so that we can access
+ * them. We tweak these settings on rfregs_init function.
+ *
+ * Also check out reg.h and U.S. Patent 6677779 B1 (about buffer
+ * registers and control registers):
+ *
+ * http://www.google.com/patents?id=qNURAAAAEBAJ
+ */
+
+
+/*
+ * Struct to hold default mode specific RF
+ * register values (RF Banks)
+ */
+struct ath5k_ini_rfbuffer {
+       u8      rfb_bank;               /* RF Bank number */
+       u16     rfb_ctrl_register;      /* RF Buffer control register */
+       u32     rfb_mode_data[5];       /* RF Buffer data for each mode */
+};
+
+/*
+ * Struct to hold RF Buffer field
+ * infos used to access certain RF
+ * analog registers
+ */
+struct ath5k_rfb_field {
+       u8      len;    /* Field length */
+       u16     pos;    /* Offset on the raw packet */
+       u8      col;    /* Column -used for shifting */
+};
+
+/*
+ * RF analog register definition
+ */
+struct ath5k_rf_reg {
+       u8                      bank;   /* RF Buffer Bank number */
+       u8                      index;  /* Register's index on rf_regs_idx */
+       struct ath5k_rfb_field  field;  /* RF Buffer field for this register */
+};
+
+/* Map RF registers to indexes
+ * We do this to handle common bits and make our
+ * life easier by using an index for each register
+ * instead of a full rfb_field */
+enum ath5k_rf_regs_idx {
+       /* BANK 6 */
+       AR5K_RF_OB_2GHZ = 0,
+       AR5K_RF_OB_5GHZ,
+       AR5K_RF_DB_2GHZ,
+       AR5K_RF_DB_5GHZ,
+       AR5K_RF_FIXED_BIAS_A,
+       AR5K_RF_FIXED_BIAS_B,
+       AR5K_RF_PWD_XPD,
+       AR5K_RF_XPD_SEL,
+       AR5K_RF_XPD_GAIN,
+       AR5K_RF_PD_GAIN_LO,
+       AR5K_RF_PD_GAIN_HI,
+       AR5K_RF_HIGH_VC_CP,
+       AR5K_RF_MID_VC_CP,
+       AR5K_RF_LOW_VC_CP,
+       AR5K_RF_PUSH_UP,
+       AR5K_RF_PAD2GND,
+       AR5K_RF_XB2_LVL,
+       AR5K_RF_XB5_LVL,
+       AR5K_RF_PWD_ICLOBUF_2G,
+       AR5K_RF_PWD_84,
+       AR5K_RF_PWD_90,
+       AR5K_RF_PWD_130,
+       AR5K_RF_PWD_131,
+       AR5K_RF_PWD_132,
+       AR5K_RF_PWD_136,
+       AR5K_RF_PWD_137,
+       AR5K_RF_PWD_138,
+       AR5K_RF_PWD_166,
+       AR5K_RF_PWD_167,
+       AR5K_RF_DERBY_CHAN_SEL_MODE,
+       /* BANK 7 */
+       AR5K_RF_GAIN_I,
+       AR5K_RF_PLO_SEL,
+       AR5K_RF_RFGAIN_SEL,
+       AR5K_RF_RFGAIN_STEP,
+       AR5K_RF_WAIT_S,
+       AR5K_RF_WAIT_I,
+       AR5K_RF_MAX_TIME,
+       AR5K_RF_MIXVGA_OVR,
+       AR5K_RF_MIXGAIN_OVR,
+       AR5K_RF_MIXGAIN_STEP,
+       AR5K_RF_PD_DELAY_A,
+       AR5K_RF_PD_DELAY_B,
+       AR5K_RF_PD_DELAY_XR,
+       AR5K_RF_PD_PERIOD_A,
+       AR5K_RF_PD_PERIOD_B,
+       AR5K_RF_PD_PERIOD_XR,
+};
+
+
+/*******************\
+* RF5111 (Sombrero) *
+\*******************/
+
+/* BANK 6                              len  pos col */
+#define        AR5K_RF5111_OB_2GHZ             { 3, 119, 0 }
+#define        AR5K_RF5111_DB_2GHZ             { 3, 122, 0 }
+
+#define        AR5K_RF5111_OB_5GHZ             { 3, 104, 0 }
+#define        AR5K_RF5111_DB_5GHZ             { 3, 107, 0 }
+
+#define        AR5K_RF5111_PWD_XPD             { 1, 95,  0 }
+#define        AR5K_RF5111_XPD_GAIN            { 4, 96,  0 }
+
+/* Access to PWD registers */
+#define AR5K_RF5111_PWD(_n)            { 1, (135 - _n), 3 }
+
+/* BANK 7                              len  pos col */
+#define        AR5K_RF5111_GAIN_I              { 6, 29,  0 }
+#define        AR5K_RF5111_PLO_SEL             { 1, 4,   0 }
+#define        AR5K_RF5111_RFGAIN_SEL          { 1, 36,  0 }
+#define AR5K_RF5111_RFGAIN_STEP                { 6, 37,  0 }
+/* Only on AR5212 BaseBand and up */
+#define        AR5K_RF5111_WAIT_S              { 5, 19,  0 }
+#define        AR5K_RF5111_WAIT_I              { 5, 24,  0 }
+#define        AR5K_RF5111_MAX_TIME            { 2, 49,  0 }
+
+static const struct ath5k_rf_reg rf_regs_5111[] = {
+       {6, AR5K_RF_OB_2GHZ,            AR5K_RF5111_OB_2GHZ},
+       {6, AR5K_RF_DB_2GHZ,            AR5K_RF5111_DB_2GHZ},
+       {6, AR5K_RF_OB_5GHZ,            AR5K_RF5111_OB_5GHZ},
+       {6, AR5K_RF_DB_5GHZ,            AR5K_RF5111_DB_5GHZ},
+       {6, AR5K_RF_PWD_XPD,            AR5K_RF5111_PWD_XPD},
+       {6, AR5K_RF_XPD_GAIN,           AR5K_RF5111_XPD_GAIN},
+       {6, AR5K_RF_PWD_84,             AR5K_RF5111_PWD(84)},
+       {6, AR5K_RF_PWD_90,             AR5K_RF5111_PWD(90)},
+       {7, AR5K_RF_GAIN_I,             AR5K_RF5111_GAIN_I},
+       {7, AR5K_RF_PLO_SEL,            AR5K_RF5111_PLO_SEL},
+       {7, AR5K_RF_RFGAIN_SEL,         AR5K_RF5111_RFGAIN_SEL},
+       {7, AR5K_RF_RFGAIN_STEP,        AR5K_RF5111_RFGAIN_STEP},
+       {7, AR5K_RF_WAIT_S,             AR5K_RF5111_WAIT_S},
+       {7, AR5K_RF_WAIT_I,             AR5K_RF5111_WAIT_I},
+       {7, AR5K_RF_MAX_TIME,           AR5K_RF5111_MAX_TIME}
+};
+
+/* Default mode specific settings */
+static const struct ath5k_ini_rfbuffer rfb_5111[] = {
+       { 0, 0x989c,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00380000, 0x00380000, 0x00380000, 0x00380000, 0x00380000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 0, 0x989c,
+           { 0x00000000, 0x00000000, 0x000000c0, 0x00000080, 0x00000080 } },
+       { 0, 0x989c,
+           { 0x000400f9, 0x000400f9, 0x000400ff, 0x000400fd, 0x000400fd } },
+       { 0, 0x98d4,
+           { 0x00000000, 0x00000000, 0x00000004, 0x00000004, 0x00000004 } },
+       { 1, 0x98d4,
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d4,
+           { 0x00000010, 0x00000014, 0x00000010, 0x00000010, 0x00000014 } },
+       { 3, 0x98d8,
+           { 0x00601068, 0x00601068, 0x00601068, 0x00601068, 0x00601068 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } },
+       { 6, 0x989c,
+           { 0x04000000, 0x04000000, 0x04000000, 0x04000000, 0x04000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x0a000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x003800c0, 0x00380080, 0x023800c0, 0x003800c0, 0x003800c0 } },
+       { 6, 0x989c,
+           { 0x00020006, 0x00020006, 0x00000006, 0x00020006, 0x00020006 } },
+       { 6, 0x989c,
+           { 0x00000089, 0x00000089, 0x00000089, 0x00000089, 0x00000089 } },
+       { 6, 0x989c,
+           { 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0, 0x000000a0 } },
+       { 6, 0x989c,
+           { 0x00040007, 0x00040007, 0x00040007, 0x00040007, 0x00040007 } },
+       { 6, 0x98d4,
+           { 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a, 0x0000001a } },
+       { 7, 0x989c,
+           { 0x00000040, 0x00000048, 0x00000040, 0x00000040, 0x00000040 } },
+       { 7, 0x989c,
+           { 0x00000010, 0x00000010, 0x00000010, 0x00000010, 0x00000010 } },
+       { 7, 0x989c,
+           { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } },
+       { 7, 0x989c,
+           { 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f, 0x0000004f } },
+       { 7, 0x989c,
+           { 0x000000f1, 0x000000f1, 0x00000061, 0x000000f1, 0x000000f1 } },
+       { 7, 0x989c,
+           { 0x0000904f, 0x0000904f, 0x0000904c, 0x0000904f, 0x0000904f } },
+       { 7, 0x989c,
+           { 0x0000125a, 0x0000125a, 0x0000129a, 0x0000125a, 0x0000125a } },
+       { 7, 0x98cc,
+           { 0x0000000e, 0x0000000e, 0x0000000f, 0x0000000e, 0x0000000e } },
+};
+
+
+
+/***********************\
+* RF5112/RF2112 (Derby) *
+\***********************/
+
+/* BANK 7 (Common)                     len  pos col */
+#define        AR5K_RF5112X_GAIN_I             { 6, 14,  0 }
+#define        AR5K_RF5112X_MIXVGA_OVR         { 1, 36,  0 }
+#define        AR5K_RF5112X_MIXGAIN_OVR        { 2, 37,  0 }
+#define AR5K_RF5112X_MIXGAIN_STEP      { 4, 32,  0 }
+#define        AR5K_RF5112X_PD_DELAY_A         { 4, 58,  0 }
+#define        AR5K_RF5112X_PD_DELAY_B         { 4, 62,  0 }
+#define        AR5K_RF5112X_PD_DELAY_XR        { 4, 66,  0 }
+#define        AR5K_RF5112X_PD_PERIOD_A        { 4, 70,  0 }
+#define        AR5K_RF5112X_PD_PERIOD_B        { 4, 74,  0 }
+#define        AR5K_RF5112X_PD_PERIOD_XR       { 4, 78,  0 }
+
+/* RFX112 (Derby 1) */
+
+/* BANK 6                              len  pos col */
+#define        AR5K_RF5112_OB_2GHZ             { 3, 269, 0 }
+#define        AR5K_RF5112_DB_2GHZ             { 3, 272, 0 }
+
+#define        AR5K_RF5112_OB_5GHZ             { 3, 261, 0 }
+#define        AR5K_RF5112_DB_5GHZ             { 3, 264, 0 }
+
+#define        AR5K_RF5112_FIXED_BIAS_A        { 1, 260, 0 }
+#define        AR5K_RF5112_FIXED_BIAS_B        { 1, 259, 0 }
+
+#define        AR5K_RF5112_XPD_SEL             { 1, 284, 0 }
+#define        AR5K_RF5112_XPD_GAIN            { 2, 252, 0 }
+
+/* Access to PWD registers */
+#define AR5K_RF5112_PWD(_n)            { 1, (302 - _n), 3 }
+
+static const struct ath5k_rf_reg rf_regs_5112[] = {
+       {6, AR5K_RF_OB_2GHZ,            AR5K_RF5112_OB_2GHZ},
+       {6, AR5K_RF_DB_2GHZ,            AR5K_RF5112_DB_2GHZ},
+       {6, AR5K_RF_OB_5GHZ,            AR5K_RF5112_OB_5GHZ},
+       {6, AR5K_RF_DB_5GHZ,            AR5K_RF5112_DB_5GHZ},
+       {6, AR5K_RF_FIXED_BIAS_A,       AR5K_RF5112_FIXED_BIAS_A},
+       {6, AR5K_RF_FIXED_BIAS_B,       AR5K_RF5112_FIXED_BIAS_B},
+       {6, AR5K_RF_XPD_SEL,            AR5K_RF5112_XPD_SEL},
+       {6, AR5K_RF_XPD_GAIN,           AR5K_RF5112_XPD_GAIN},
+       {6, AR5K_RF_PWD_130,            AR5K_RF5112_PWD(130)},
+       {6, AR5K_RF_PWD_131,            AR5K_RF5112_PWD(131)},
+       {6, AR5K_RF_PWD_132,            AR5K_RF5112_PWD(132)},
+       {6, AR5K_RF_PWD_136,            AR5K_RF5112_PWD(136)},
+       {6, AR5K_RF_PWD_137,            AR5K_RF5112_PWD(137)},
+       {6, AR5K_RF_PWD_138,            AR5K_RF5112_PWD(138)},
+       {7, AR5K_RF_GAIN_I,             AR5K_RF5112X_GAIN_I},
+       {7, AR5K_RF_MIXVGA_OVR,         AR5K_RF5112X_MIXVGA_OVR},
+       {7, AR5K_RF_MIXGAIN_OVR,        AR5K_RF5112X_MIXGAIN_OVR},
+       {7, AR5K_RF_MIXGAIN_STEP,       AR5K_RF5112X_MIXGAIN_STEP},
+       {7, AR5K_RF_PD_DELAY_A,         AR5K_RF5112X_PD_DELAY_A},
+       {7, AR5K_RF_PD_DELAY_B,         AR5K_RF5112X_PD_DELAY_B},
+       {7, AR5K_RF_PD_DELAY_XR,        AR5K_RF5112X_PD_DELAY_XR},
+       {7, AR5K_RF_PD_PERIOD_A,        AR5K_RF5112X_PD_PERIOD_A},
+       {7, AR5K_RF_PD_PERIOD_B,        AR5K_RF5112X_PD_PERIOD_B},
+       {7, AR5K_RF_PD_PERIOD_XR,       AR5K_RF5112X_PD_PERIOD_XR},
+};
+
+/* Default mode specific settings */
+static const struct ath5k_ini_rfbuffer rfb_5112[] = {
+       { 1, 0x98d4,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d0,
+           { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } },
+       { 3, 0x98dc,
+           { 0x00a0c0c0, 0x00a0c0c0, 0x00e0c0c0, 0x00e0c0c0, 0x00e0c0c0 } },
+       { 6, 0x989c,
+           { 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000, 0x00a00000 } },
+       { 6, 0x989c,
+           { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00660000, 0x00660000, 0x00660000, 0x00660000, 0x00660000 } },
+       { 6, 0x989c,
+           { 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000, 0x00db0000 } },
+       { 6, 0x989c,
+           { 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000, 0x00f10000 } },
+       { 6, 0x989c,
+           { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },
+       { 6, 0x989c,
+           { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },
+       { 6, 0x989c,
+           { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },
+       { 6, 0x989c,
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
+       { 6, 0x989c,
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
+       { 6, 0x989c,
+           { 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000, 0x008b0000 } },
+       { 6, 0x989c,
+           { 0x00600000, 0x00600000, 0x00600000, 0x00600000, 0x00600000 } },
+       { 6, 0x989c,
+           { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },
+       { 6, 0x989c,
+           { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } },
+       { 6, 0x989c,
+           { 0x00640000, 0x00640000, 0x00640000, 0x00640000, 0x00640000 } },
+       { 6, 0x989c,
+           { 0x00200000, 0x00200000, 0x00200000, 0x00200000, 0x00200000 } },
+       { 6, 0x989c,
+           { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } },
+       { 6, 0x989c,
+           { 0x00250000, 0x00250000, 0x00250000, 0x00250000, 0x00250000 } },
+       { 6, 0x989c,
+           { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },
+       { 6, 0x989c,
+           { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },
+       { 6, 0x989c,
+           { 0x00510000, 0x00510000, 0x00510000, 0x00510000, 0x00510000 } },
+       { 6, 0x989c,
+           { 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000, 0x1c040000 } },
+       { 6, 0x989c,
+           { 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000, 0x000a0000 } },
+       { 6, 0x989c,
+           { 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000, 0x00a10000 } },
+       { 6, 0x989c,
+           { 0x00400000, 0x00400000, 0x00400000, 0x00400000, 0x00400000 } },
+       { 6, 0x989c,
+           { 0x03090000, 0x03090000, 0x03090000, 0x03090000, 0x03090000 } },
+       { 6, 0x989c,
+           { 0x06000000, 0x06000000, 0x06000000, 0x06000000, 0x06000000 } },
+       { 6, 0x989c,
+           { 0x000000b0, 0x000000b0, 0x000000a8, 0x000000a8, 0x000000a8 } },
+       { 6, 0x989c,
+           { 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e, 0x0000002e } },
+       { 6, 0x989c,
+           { 0x006c4a41, 0x006c4a41, 0x006c4af1, 0x006c4a61, 0x006c4a61 } },
+       { 6, 0x989c,
+           { 0x0050892a, 0x0050892a, 0x0050892b, 0x0050892b, 0x0050892b } },
+       { 6, 0x989c,
+           { 0x00842400, 0x00842400, 0x00842400, 0x00842400, 0x00842400 } },
+       { 6, 0x989c,
+           { 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200, 0x00c69200 } },
+       { 6, 0x98d0,
+           { 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c, 0x0002000c } },
+       { 7, 0x989c,
+           { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } },
+       { 7, 0x989c,
+           { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } },
+       { 7, 0x989c,
+           { 0x0000000a, 0x0000000a, 0x00000012, 0x00000012, 0x00000012 } },
+       { 7, 0x989c,
+           { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },
+       { 7, 0x989c,
+           { 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1, 0x000000c1 } },
+       { 7, 0x989c,
+           { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },
+       { 7, 0x989c,
+           { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } },
+       { 7, 0x989c,
+           { 0x00000022, 0x00000022, 0x00000022, 0x00000022, 0x00000022 } },
+       { 7, 0x989c,
+           { 0x00000092, 0x00000092, 0x00000092, 0x00000092, 0x00000092 } },
+       { 7, 0x989c,
+           { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } },
+       { 7, 0x989c,
+           { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } },
+       { 7, 0x989c,
+           { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } },
+       { 7, 0x98c4,
+           { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
+};
+
+/* RFX112A (Derby 2) */
+
+/* BANK 6                              len  pos col */
+#define        AR5K_RF5112A_OB_2GHZ            { 3, 287, 0 }
+#define        AR5K_RF5112A_DB_2GHZ            { 3, 290, 0 }
+
+#define        AR5K_RF5112A_OB_5GHZ            { 3, 279, 0 }
+#define        AR5K_RF5112A_DB_5GHZ            { 3, 282, 0 }
+
+#define        AR5K_RF5112A_FIXED_BIAS_A       { 1, 278, 0 }
+#define        AR5K_RF5112A_FIXED_BIAS_B       { 1, 277, 0 }
+
+#define        AR5K_RF5112A_XPD_SEL            { 1, 302, 0 }
+#define        AR5K_RF5112A_PDGAINLO           { 2, 270, 0 }
+#define        AR5K_RF5112A_PDGAINHI           { 2, 257, 0 }
+
+/* Access to PWD registers */
+#define AR5K_RF5112A_PWD(_n)           { 1, (306 - _n), 3 }
+
+/* Voltage regulators */
+#define        AR5K_RF5112A_HIGH_VC_CP         { 2, 90,  2 }
+#define        AR5K_RF5112A_MID_VC_CP          { 2, 92,  2 }
+#define        AR5K_RF5112A_LOW_VC_CP          { 2, 94,  2 }
+#define        AR5K_RF5112A_PUSH_UP            { 1, 254,  2 }
+
+/* Power consumption */
+#define        AR5K_RF5112A_PAD2GND            { 1, 281, 1 }
+#define        AR5K_RF5112A_XB2_LVL            { 2, 1,   3 }
+#define        AR5K_RF5112A_XB5_LVL            { 2, 3,   3 }
+
+static const struct ath5k_rf_reg rf_regs_5112a[] = {
+       {6, AR5K_RF_OB_2GHZ,            AR5K_RF5112A_OB_2GHZ},
+       {6, AR5K_RF_DB_2GHZ,            AR5K_RF5112A_DB_2GHZ},
+       {6, AR5K_RF_OB_5GHZ,            AR5K_RF5112A_OB_5GHZ},
+       {6, AR5K_RF_DB_5GHZ,            AR5K_RF5112A_DB_5GHZ},
+       {6, AR5K_RF_FIXED_BIAS_A,       AR5K_RF5112A_FIXED_BIAS_A},
+       {6, AR5K_RF_FIXED_BIAS_B,       AR5K_RF5112A_FIXED_BIAS_B},
+       {6, AR5K_RF_XPD_SEL,            AR5K_RF5112A_XPD_SEL},
+       {6, AR5K_RF_PD_GAIN_LO,         AR5K_RF5112A_PDGAINLO},
+       {6, AR5K_RF_PD_GAIN_HI,         AR5K_RF5112A_PDGAINHI},
+       {6, AR5K_RF_PWD_130,            AR5K_RF5112A_PWD(130)},
+       {6, AR5K_RF_PWD_131,            AR5K_RF5112A_PWD(131)},
+       {6, AR5K_RF_PWD_132,            AR5K_RF5112A_PWD(132)},
+       {6, AR5K_RF_PWD_136,            AR5K_RF5112A_PWD(136)},
+       {6, AR5K_RF_PWD_137,            AR5K_RF5112A_PWD(137)},
+       {6, AR5K_RF_PWD_138,            AR5K_RF5112A_PWD(138)},
+       {6, AR5K_RF_PWD_166,            AR5K_RF5112A_PWD(166)},
+       {6, AR5K_RF_PWD_167,            AR5K_RF5112A_PWD(167)},
+       {6, AR5K_RF_HIGH_VC_CP,         AR5K_RF5112A_HIGH_VC_CP},
+       {6, AR5K_RF_MID_VC_CP,          AR5K_RF5112A_MID_VC_CP},
+       {6, AR5K_RF_LOW_VC_CP,          AR5K_RF5112A_LOW_VC_CP},
+       {6, AR5K_RF_PUSH_UP,            AR5K_RF5112A_PUSH_UP},
+       {6, AR5K_RF_PAD2GND,            AR5K_RF5112A_PAD2GND},
+       {6, AR5K_RF_XB2_LVL,            AR5K_RF5112A_XB2_LVL},
+       {6, AR5K_RF_XB5_LVL,            AR5K_RF5112A_XB5_LVL},
+       {7, AR5K_RF_GAIN_I,             AR5K_RF5112X_GAIN_I},
+       {7, AR5K_RF_MIXVGA_OVR,         AR5K_RF5112X_MIXVGA_OVR},
+       {7, AR5K_RF_MIXGAIN_OVR,        AR5K_RF5112X_MIXGAIN_OVR},
+       {7, AR5K_RF_MIXGAIN_STEP,       AR5K_RF5112X_MIXGAIN_STEP},
+       {7, AR5K_RF_PD_DELAY_A,         AR5K_RF5112X_PD_DELAY_A},
+       {7, AR5K_RF_PD_DELAY_B,         AR5K_RF5112X_PD_DELAY_B},
+       {7, AR5K_RF_PD_DELAY_XR,        AR5K_RF5112X_PD_DELAY_XR},
+       {7, AR5K_RF_PD_PERIOD_A,        AR5K_RF5112X_PD_PERIOD_A},
+       {7, AR5K_RF_PD_PERIOD_B,        AR5K_RF5112X_PD_PERIOD_B},
+       {7, AR5K_RF_PD_PERIOD_XR,       AR5K_RF5112X_PD_PERIOD_XR},
+};
+
+/* Default mode specific settings */
+static const struct ath5k_ini_rfbuffer rfb_5112a[] = {
+       { 1, 0x98d4,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d0,
+           { 0x03060408, 0x03070408, 0x03060408, 0x03060408, 0x03070408 } },
+       { 3, 0x98dc,
+           { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } },
+       { 6, 0x989c,
+           { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00800000, 0x00800000, 0x00800000, 0x00800000, 0x00800000 } },
+       { 6, 0x989c,
+           { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },
+       { 6, 0x989c,
+           { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00180000, 0x00180000, 0x00180000, 0x00180000, 0x00180000 } },
+       { 6, 0x989c,
+           { 0x00600000, 0x00600000, 0x006e0000, 0x006e0000, 0x006e0000 } },
+       { 6, 0x989c,
+           { 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000, 0x00c70000 } },
+       { 6, 0x989c,
+           { 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000, 0x004b0000 } },
+       { 6, 0x989c,
+           { 0x04480000, 0x04480000, 0x04480000, 0x04480000, 0x04480000 } },
+       { 6, 0x989c,
+           { 0x004c0000, 0x004c0000, 0x004c0000, 0x004c0000, 0x004c0000 } },
+       { 6, 0x989c,
+           { 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000, 0x00e40000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000, 0x00fc0000 } },
+       { 6, 0x989c,
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
+       { 6, 0x989c,
+           { 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000, 0x043f0000 } },
+       { 6, 0x989c,
+           { 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000, 0x000c0000 } },
+       { 6, 0x989c,
+           { 0x02190000, 0x02190000, 0x02190000, 0x02190000, 0x02190000 } },
+       { 6, 0x989c,
+           { 0x00240000, 0x00240000, 0x00240000, 0x00240000, 0x00240000 } },
+       { 6, 0x989c,
+           { 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000, 0x00b40000 } },
+       { 6, 0x989c,
+           { 0x00990000, 0x00990000, 0x00990000, 0x00990000, 0x00990000 } },
+       { 6, 0x989c,
+           { 0x00500000, 0x00500000, 0x00500000, 0x00500000, 0x00500000 } },
+       { 6, 0x989c,
+           { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },
+       { 6, 0x989c,
+           { 0x00120000, 0x00120000, 0x00120000, 0x00120000, 0x00120000 } },
+       { 6, 0x989c,
+           { 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000, 0xc0320000 } },
+       { 6, 0x989c,
+           { 0x01740000, 0x01740000, 0x01740000, 0x01740000, 0x01740000 } },
+       { 6, 0x989c,
+           { 0x00110000, 0x00110000, 0x00110000, 0x00110000, 0x00110000 } },
+       { 6, 0x989c,
+           { 0x86280000, 0x86280000, 0x86280000, 0x86280000, 0x86280000 } },
+       { 6, 0x989c,
+           { 0x31840000, 0x31840000, 0x31840000, 0x31840000, 0x31840000 } },
+       { 6, 0x989c,
+           { 0x00f20080, 0x00f20080, 0x00f20080, 0x00f20080, 0x00f20080 } },
+       { 6, 0x989c,
+           { 0x00270019, 0x00270019, 0x00270019, 0x00270019, 0x00270019 } },
+       { 6, 0x989c,
+           { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2, 0x000000b2 } },
+       { 6, 0x989c,
+           { 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084, 0x00b02084 } },
+       { 6, 0x989c,
+           { 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4, 0x004125a4 } },
+       { 6, 0x989c,
+           { 0x00119220, 0x00119220, 0x00119220, 0x00119220, 0x00119220 } },
+       { 6, 0x989c,
+           { 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800, 0x001a4800 } },
+       { 6, 0x98d8,
+           { 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230, 0x000b0230 } },
+       { 7, 0x989c,
+           { 0x00000094, 0x00000094, 0x00000094, 0x00000094, 0x00000094 } },
+       { 7, 0x989c,
+           { 0x00000091, 0x00000091, 0x00000091, 0x00000091, 0x00000091 } },
+       { 7, 0x989c,
+           { 0x00000012, 0x00000012, 0x00000012, 0x00000012, 0x00000012 } },
+       { 7, 0x989c,
+           { 0x00000080, 0x00000080, 0x00000080, 0x00000080, 0x00000080 } },
+       { 7, 0x989c,
+           { 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9, 0x000000d9 } },
+       { 7, 0x989c,
+           { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },
+       { 7, 0x989c,
+           { 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0, 0x000000f0 } },
+       { 7, 0x989c,
+           { 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2, 0x000000a2 } },
+       { 7, 0x989c,
+           { 0x00000052, 0x00000052, 0x00000052, 0x00000052, 0x00000052 } },
+       { 7, 0x989c,
+           { 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4, 0x000000d4 } },
+       { 7, 0x989c,
+           { 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc, 0x000014cc } },
+       { 7, 0x989c,
+           { 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c, 0x0000048c } },
+       { 7, 0x98c4,
+           { 0x00000003, 0x00000003, 0x00000003, 0x00000003, 0x00000003 } },
+};
+
+
+
+/******************\
+* RF2413 (Griffin) *
+\******************/
+
+/* BANK 6                              len  pos col */
+#define        AR5K_RF2413_OB_2GHZ             { 3, 168, 0 }
+#define        AR5K_RF2413_DB_2GHZ             { 3, 165, 0 }
+
+static const struct ath5k_rf_reg rf_regs_2413[] = {
+       {6, AR5K_RF_OB_2GHZ,            AR5K_RF2413_OB_2GHZ},
+       {6, AR5K_RF_DB_2GHZ,            AR5K_RF2413_DB_2GHZ},
+};
+
+/* Default mode specific settings
+ * XXX: a/aTurbo ???
+ */
+static const struct ath5k_ini_rfbuffer rfb_2413[] = {
+       { 1, 0x98d4,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d0,
+           { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } },
+       { 3, 0x98dc,
+           { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } },
+       { 6, 0x989c,
+           { 0xf0000000, 0xf0000000, 0xf0000000, 0xf0000000, 0xf0000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x03000000, 0x03000000, 0x03000000, 0x03000000, 0x03000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x40400000, 0x40400000, 0x40400000, 0x40400000, 0x40400000 } },
+       { 6, 0x989c,
+           { 0x65050000, 0x65050000, 0x65050000, 0x65050000, 0x65050000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00420000, 0x00420000, 0x00420000, 0x00420000, 0x00420000 } },
+       { 6, 0x989c,
+           { 0x00b50000, 0x00b50000, 0x00b50000, 0x00b50000, 0x00b50000 } },
+       { 6, 0x989c,
+           { 0x00030000, 0x00030000, 0x00030000, 0x00030000, 0x00030000 } },
+       { 6, 0x989c,
+           { 0x00f70000, 0x00f70000, 0x00f70000, 0x00f70000, 0x00f70000 } },
+       { 6, 0x989c,
+           { 0x009d0000, 0x009d0000, 0x009d0000, 0x009d0000, 0x009d0000 } },
+       { 6, 0x989c,
+           { 0x00220000, 0x00220000, 0x00220000, 0x00220000, 0x00220000 } },
+       { 6, 0x989c,
+           { 0x04220000, 0x04220000, 0x04220000, 0x04220000, 0x04220000 } },
+       { 6, 0x989c,
+           { 0x00230018, 0x00230018, 0x00230018, 0x00230018, 0x00230018 } },
+       { 6, 0x989c,
+           { 0x00280000, 0x00280000, 0x00280060, 0x00280060, 0x00280060 } },
+       { 6, 0x989c,
+           { 0x005000c0, 0x005000c0, 0x005000c3, 0x005000c3, 0x005000c3 } },
+       { 6, 0x989c,
+           { 0x0004007f, 0x0004007f, 0x0004007f, 0x0004007f, 0x0004007f } },
+       { 6, 0x989c,
+           { 0x00000458, 0x00000458, 0x00000458, 0x00000458, 0x00000458 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x0000c000, 0x0000c000, 0x0000c000, 0x0000c000, 0x0000c000 } },
+       { 6, 0x98d8,
+           { 0x00400230, 0x00400230, 0x00400230, 0x00400230, 0x00400230 } },
+       { 7, 0x989c,
+           { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
+       { 7, 0x989c,
+           { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
+       { 7, 0x98cc,
+           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
+};
+
+
+
+/***************************\
+* RF2315/RF2316 (Cobra SoC) *
+\***************************/
+
+/* BANK 6                              len  pos col */
+#define        AR5K_RF2316_OB_2GHZ             { 3, 178, 0 }
+#define        AR5K_RF2316_DB_2GHZ             { 3, 175, 0 }
+
+static const struct ath5k_rf_reg rf_regs_2316[] = {
+       {6, AR5K_RF_OB_2GHZ,            AR5K_RF2316_OB_2GHZ},
+       {6, AR5K_RF_DB_2GHZ,            AR5K_RF2316_DB_2GHZ},
+};
+
+/* Default mode specific settings */
+static const struct ath5k_ini_rfbuffer rfb_2316[] = {
+       { 1, 0x98d4,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d0,
+           { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } },
+       { 3, 0x98dc,
+           { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000, 0xc0000000 } },
+       { 6, 0x989c,
+           { 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000, 0x0f000000 } },
+       { 6, 0x989c,
+           { 0x02000000, 0x02000000, 0x02000000, 0x02000000, 0x02000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0xf8000000, 0xf8000000, 0xf8000000, 0xf8000000, 0xf8000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x95150000, 0x95150000, 0x95150000, 0x95150000, 0x95150000 } },
+       { 6, 0x989c,
+           { 0xc1000000, 0xc1000000, 0xc1000000, 0xc1000000, 0xc1000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00080000, 0x00080000, 0x00080000, 0x00080000, 0x00080000 } },
+       { 6, 0x989c,
+           { 0x00d50000, 0x00d50000, 0x00d50000, 0x00d50000, 0x00d50000 } },
+       { 6, 0x989c,
+           { 0x000e0000, 0x000e0000, 0x000e0000, 0x000e0000, 0x000e0000 } },
+       { 6, 0x989c,
+           { 0x00dc0000, 0x00dc0000, 0x00dc0000, 0x00dc0000, 0x00dc0000 } },
+       { 6, 0x989c,
+           { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } },
+       { 6, 0x989c,
+           { 0x008a0000, 0x008a0000, 0x008a0000, 0x008a0000, 0x008a0000 } },
+       { 6, 0x989c,
+           { 0x10880000, 0x10880000, 0x10880000, 0x10880000, 0x10880000 } },
+       { 6, 0x989c,
+           { 0x008c0060, 0x008c0060, 0x008c0060, 0x008c0060, 0x008c0060 } },
+       { 6, 0x989c,
+           { 0x00a00000, 0x00a00000, 0x00a00080, 0x00a00080, 0x00a00080 } },
+       { 6, 0x989c,
+           { 0x00400000, 0x00400000, 0x0040000d, 0x0040000d, 0x0040000d } },
+       { 6, 0x989c,
+           { 0x00110400, 0x00110400, 0x00110400, 0x00110400, 0x00110400 } },
+       { 6, 0x989c,
+           { 0x00000060, 0x00000060, 0x00000060, 0x00000060, 0x00000060 } },
+       { 6, 0x989c,
+           { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
+       { 6, 0x989c,
+           { 0x00000b00, 0x00000b00, 0x00000b00, 0x00000b00, 0x00000b00 } },
+       { 6, 0x989c,
+           { 0x00000be8, 0x00000be8, 0x00000be8, 0x00000be8, 0x00000be8 } },
+       { 6, 0x98c0,
+           { 0x00010000, 0x00010000, 0x00010000, 0x00010000, 0x00010000 } },
+       { 7, 0x989c,
+           { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
+       { 7, 0x989c,
+           { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
+       { 7, 0x98cc,
+           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
+};
+
+
+
+/******************************\
+* RF5413/RF5424 (Eagle/Condor) *
+\******************************/
+
+/* BANK 6                              len  pos col */
+#define        AR5K_RF5413_OB_2GHZ             { 3, 241, 0 }
+#define        AR5K_RF5413_DB_2GHZ             { 3, 238, 0 }
+
+#define        AR5K_RF5413_OB_5GHZ             { 3, 247, 0 }
+#define        AR5K_RF5413_DB_5GHZ             { 3, 244, 0 }
+
+#define        AR5K_RF5413_PWD_ICLOBUF2G       { 3, 131, 3 }
+#define        AR5K_RF5413_DERBY_CHAN_SEL_MODE { 1, 291, 2 }
+
+static const struct ath5k_rf_reg rf_regs_5413[] = {
+       {6, AR5K_RF_OB_2GHZ,             AR5K_RF5413_OB_2GHZ},
+       {6, AR5K_RF_DB_2GHZ,             AR5K_RF5413_DB_2GHZ},
+       {6, AR5K_RF_OB_5GHZ,             AR5K_RF5413_OB_5GHZ},
+       {6, AR5K_RF_DB_5GHZ,             AR5K_RF5413_DB_5GHZ},
+       {6, AR5K_RF_PWD_ICLOBUF_2G,      AR5K_RF5413_PWD_ICLOBUF2G},
+       {6, AR5K_RF_DERBY_CHAN_SEL_MODE, AR5K_RF5413_DERBY_CHAN_SEL_MODE},
+};
+
+/* Default mode specific settings */
+static const struct ath5k_ini_rfbuffer rfb_5413[] = {
+       { 1, 0x98d4,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d0,
+           { 0x00000008, 0x00000008, 0x00000008, 0x00000008, 0x00000008 } },
+       { 3, 0x98dc,
+           { 0x00a000c0, 0x00a000c0, 0x00e000c0, 0x00e000c0, 0x00e000c0 } },
+       { 6, 0x989c,
+           { 0x33000000, 0x33000000, 0x33000000, 0x33000000, 0x33000000 } },
+       { 6, 0x989c,
+           { 0x01000000, 0x01000000, 0x01000000, 0x01000000, 0x01000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000, 0x1f000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000, 0x00b80000 } },
+       { 6, 0x989c,
+           { 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000, 0x00b70000 } },
+       { 6, 0x989c,
+           { 0x00840000, 0x00840000, 0x00840000, 0x00840000, 0x00840000 } },
+       { 6, 0x989c,
+           { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },
+       { 6, 0x989c,
+           { 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000, 0x00c00000 } },
+       { 6, 0x989c,
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
+       { 6, 0x989c,
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
+       { 6, 0x989c,
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
+       { 6, 0x989c,
+           { 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000, 0x00ff0000 } },
+       { 6, 0x989c,
+           { 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000, 0x00d70000 } },
+       { 6, 0x989c,
+           { 0x00610000, 0x00610000, 0x00610000, 0x00610000, 0x00610000 } },
+       { 6, 0x989c,
+           { 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000, 0x00fe0000 } },
+       { 6, 0x989c,
+           { 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000, 0x00de0000 } },
+       { 6, 0x989c,
+           { 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000, 0x007f0000 } },
+       { 6, 0x989c,
+           { 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000, 0x043d0000 } },
+       { 6, 0x989c,
+           { 0x00770000, 0x00770000, 0x00770000, 0x00770000, 0x00770000 } },
+       { 6, 0x989c,
+           { 0x00440000, 0x00440000, 0x00440000, 0x00440000, 0x00440000 } },
+       { 6, 0x989c,
+           { 0x00980000, 0x00980000, 0x00980000, 0x00980000, 0x00980000 } },
+       { 6, 0x989c,
+           { 0x00100080, 0x00100080, 0x00100080, 0x00100080, 0x00100080 } },
+       { 6, 0x989c,
+           { 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034, 0x0005c034 } },
+       { 6, 0x989c,
+           { 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0, 0x003100f0 } },
+       { 6, 0x989c,
+           { 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f, 0x000c011f } },
+       { 6, 0x989c,
+           { 0x00510040, 0x00510040, 0x00510040, 0x00510040, 0x00510040 } },
+       { 6, 0x989c,
+           { 0x005000da, 0x005000da, 0x005000da, 0x005000da, 0x005000da } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00004044, 0x00004044, 0x00004044, 0x00004044, 0x00004044 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0, 0x000060c0 } },
+       { 6, 0x989c,
+           { 0x00002c00, 0x00002c00, 0x00003600, 0x00003600, 0x00002c00 } },
+       { 6, 0x98c8,
+           { 0x00000403, 0x00000403, 0x00040403, 0x00040403, 0x00040403 } },
+       { 7, 0x989c,
+           { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
+       { 7, 0x989c,
+           { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
+       { 7, 0x98cc,
+           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
+};
+
+
+
+/***************************\
+* RF2425/RF2417 (Swan/Nala) *
+* AR2317 (Spider SoC)       *
+\***************************/
+
+/* BANK 6                              len  pos col */
+#define        AR5K_RF2425_OB_2GHZ             { 3, 193, 0 }
+#define        AR5K_RF2425_DB_2GHZ             { 3, 190, 0 }
+
+static const struct ath5k_rf_reg rf_regs_2425[] = {
+       {6, AR5K_RF_OB_2GHZ,            AR5K_RF2425_OB_2GHZ},
+       {6, AR5K_RF_DB_2GHZ,            AR5K_RF2425_DB_2GHZ},
+};
+
+/* Default mode specific settings
+ * XXX: a/aTurbo ?
+ */
+static const struct ath5k_ini_rfbuffer rfb_2425[] = {
+       { 1, 0x98d4,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d0,
+           { 0x02001408, 0x02001408, 0x02001408, 0x02001408, 0x02001408 } },
+       { 3, 0x98dc,
+           { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } },
+       { 6, 0x989c,
+           { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } },
+       { 6, 0x989c,
+           { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } },
+       { 6, 0x989c,
+           { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },
+       { 6, 0x989c,
+           { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } },
+       { 6, 0x989c,
+           { 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000 } },
+       { 6, 0x989c,
+           { 0x00140000, 0x00140000, 0x00140000, 0x00140000, 0x00140000 } },
+       { 6, 0x989c,
+           { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } },
+       { 6, 0x989c,
+           { 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a } },
+       { 6, 0x989c,
+           { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } },
+       { 6, 0x989c,
+           { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } },
+       { 6, 0x989c,
+           { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } },
+       { 6, 0x989c,
+           { 0x00001688, 0x00001688, 0x00001688, 0x00001688, 0x00001688 } },
+       { 6, 0x98c4,
+           { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
+       { 7, 0x989c,
+           { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
+       { 7, 0x989c,
+           { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
+       { 7, 0x98cc,
+           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
+};
+
+/*
+ * TODO: Handle the few differences with swan during
+ * bank modification and get rid of this
+ */
+static const struct ath5k_ini_rfbuffer rfb_2317[] = {
+       { 1, 0x98d4,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d0,
+           { 0x02001408, 0x02011408, 0x02001408, 0x02001408, 0x02011408 } },
+       { 3, 0x98dc,
+           { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } },
+       { 6, 0x989c,
+           { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } },
+       { 6, 0x989c,
+           { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } },
+       { 6, 0x989c,
+           { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },
+       { 6, 0x989c,
+           { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } },
+       { 6, 0x989c,
+           { 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000, 0x00e70000 } },
+       { 6, 0x989c,
+           { 0x00140100, 0x00140100, 0x00140100, 0x00140100, 0x00140100 } },
+       { 6, 0x989c,
+           { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } },
+       { 6, 0x989c,
+           { 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a, 0x0007001a } },
+       { 6, 0x989c,
+           { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } },
+       { 6, 0x989c,
+           { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } },
+       { 6, 0x989c,
+           { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } },
+       { 6, 0x989c,
+           { 0x00009688, 0x00009688, 0x00009688, 0x00009688, 0x00009688 } },
+       { 6, 0x98c4,
+           { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
+       { 7, 0x989c,
+           { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
+       { 7, 0x989c,
+           { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
+       { 7, 0x98cc,
+           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
+};
+
+/*
+ * TODO: Handle the few differences with swan during
+ * bank modification and get rid of this
+ * XXX: a/aTurbo ?
+ */
+static const struct ath5k_ini_rfbuffer rfb_2417[] = {
+       { 1, 0x98d4,
+       /*     mode a/XR  mode aTurbo    mode b     mode g    mode gTurbo */
+           { 0x00000020, 0x00000020, 0x00000020, 0x00000020, 0x00000020 } },
+       { 2, 0x98d0,
+           { 0x02001408, 0x02001408, 0x02001408, 0x02001408, 0x02001408 } },
+       { 3, 0x98dc,
+           { 0x00a020c0, 0x00a020c0, 0x00e020c0, 0x00e020c0, 0x00e020c0 } },
+       { 6, 0x989c,
+           { 0x10000000, 0x10000000, 0x10000000, 0x10000000, 0x10000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000, 0x002a0000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00100000, 0x00100000, 0x00100000, 0x00100000, 0x00100000 } },
+       { 6, 0x989c,
+           { 0x00020000, 0x00020000, 0x00020000, 0x00020000, 0x00020000 } },
+       { 6, 0x989c,
+           { 0x00730000, 0x00730000, 0x00730000, 0x00730000, 0x00730000 } },
+       { 6, 0x989c,
+           { 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000, 0x00f80000 } },
+       { 6, 0x989c,
+           { 0x00e70000, 0x00e70000, 0x80e70000, 0x80e70000, 0x00e70000 } },
+       { 6, 0x989c,
+           { 0x00140000, 0x00140000, 0x00140000, 0x00140000, 0x00140000 } },
+       { 6, 0x989c,
+           { 0x00910040, 0x00910040, 0x00910040, 0x00910040, 0x00910040 } },
+       { 6, 0x989c,
+           { 0x0007001a, 0x0007001a, 0x0207001a, 0x0207001a, 0x0007001a } },
+       { 6, 0x989c,
+           { 0x00410000, 0x00410000, 0x00410000, 0x00410000, 0x00410000 } },
+       { 6, 0x989c,
+           { 0x00810000, 0x00810000, 0x00810060, 0x00810060, 0x00810060 } },
+       { 6, 0x989c,
+           { 0x00020800, 0x00020800, 0x00020803, 0x00020803, 0x00020803 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 } },
+       { 6, 0x989c,
+           { 0x00001660, 0x00001660, 0x00001660, 0x00001660, 0x00001660 } },
+       { 6, 0x989c,
+           { 0x00001688, 0x00001688, 0x00001688, 0x00001688, 0x00001688 } },
+       { 6, 0x98c4,
+           { 0x00000001, 0x00000001, 0x00000001, 0x00000001, 0x00000001 } },
+       { 7, 0x989c,
+           { 0x00006400, 0x00006400, 0x00006400, 0x00006400, 0x00006400 } },
+       { 7, 0x989c,
+           { 0x00000800, 0x00000800, 0x00000800, 0x00000800, 0x00000800 } },
+       { 7, 0x98cc,
+           { 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e, 0x0000000e } },
+};
diff --git a/drivers/net/wireless/ath5k/rfgain.h b/drivers/net/wireless/ath5k/rfgain.h
new file mode 100644 (file)
index 0000000..1354d8c
--- /dev/null
@@ -0,0 +1,516 @@
+/*
+ * RF Gain optimization
+ *
+ * Copyright (c) 2004-2009 Reyk Floeter <reyk@openbsd.org>
+ * Copyright (c) 2006-2009 Nick Kossifidis <mickflemm@gmail.com>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ */
+
+/*
+ * Mode-specific RF Gain table (64bytes) for RF5111/5112
+ * (RF5110 only comes with AR5210 and only supports a/turbo a mode so initial
+ * RF Gain values are included in AR5K_AR5210_INI)
+ */
+struct ath5k_ini_rfgain {
+       u16     rfg_register;   /* RF Gain register address */
+       u32     rfg_value[2];   /* [freq (see below)] */
+};
+
+/* Initial RF Gain settings for RF5111 */
+static const struct ath5k_ini_rfgain rfgain_5111[] = {
+       /*                            5Ghz      2Ghz    */
+       { AR5K_RF_GAIN(0),      { 0x000001a9, 0x00000000 } },
+       { AR5K_RF_GAIN(1),      { 0x000001e9, 0x00000040 } },
+       { AR5K_RF_GAIN(2),      { 0x00000029, 0x00000080 } },
+       { AR5K_RF_GAIN(3),      { 0x00000069, 0x00000150 } },
+       { AR5K_RF_GAIN(4),      { 0x00000199, 0x00000190 } },
+       { AR5K_RF_GAIN(5),      { 0x000001d9, 0x000001d0 } },
+       { AR5K_RF_GAIN(6),      { 0x00000019, 0x00000010 } },
+       { AR5K_RF_GAIN(7),      { 0x00000059, 0x00000044 } },
+       { AR5K_RF_GAIN(8),      { 0x00000099, 0x00000084 } },
+       { AR5K_RF_GAIN(9),      { 0x000001a5, 0x00000148 } },
+       { AR5K_RF_GAIN(10),     { 0x000001e5, 0x00000188 } },
+       { AR5K_RF_GAIN(11),     { 0x00000025, 0x000001c8 } },
+       { AR5K_RF_GAIN(12),     { 0x000001c8, 0x00000014 } },
+       { AR5K_RF_GAIN(13),     { 0x00000008, 0x00000042 } },
+       { AR5K_RF_GAIN(14),     { 0x00000048, 0x00000082 } },
+       { AR5K_RF_GAIN(15),     { 0x00000088, 0x00000178 } },
+       { AR5K_RF_GAIN(16),     { 0x00000198, 0x000001b8 } },
+       { AR5K_RF_GAIN(17),     { 0x000001d8, 0x000001f8 } },
+       { AR5K_RF_GAIN(18),     { 0x00000018, 0x00000012 } },
+       { AR5K_RF_GAIN(19),     { 0x00000058, 0x00000052 } },
+       { AR5K_RF_GAIN(20),     { 0x00000098, 0x00000092 } },
+       { AR5K_RF_GAIN(21),     { 0x000001a4, 0x0000017c } },
+       { AR5K_RF_GAIN(22),     { 0x000001e4, 0x000001bc } },
+       { AR5K_RF_GAIN(23),     { 0x00000024, 0x000001fc } },
+       { AR5K_RF_GAIN(24),     { 0x00000064, 0x0000000a } },
+       { AR5K_RF_GAIN(25),     { 0x000000a4, 0x0000004a } },
+       { AR5K_RF_GAIN(26),     { 0x000000e4, 0x0000008a } },
+       { AR5K_RF_GAIN(27),     { 0x0000010a, 0x0000015a } },
+       { AR5K_RF_GAIN(28),     { 0x0000014a, 0x0000019a } },
+       { AR5K_RF_GAIN(29),     { 0x0000018a, 0x000001da } },
+       { AR5K_RF_GAIN(30),     { 0x000001ca, 0x0000000e } },
+       { AR5K_RF_GAIN(31),     { 0x0000000a, 0x0000004e } },
+       { AR5K_RF_GAIN(32),     { 0x0000004a, 0x0000008e } },
+       { AR5K_RF_GAIN(33),     { 0x0000008a, 0x0000015e } },
+       { AR5K_RF_GAIN(34),     { 0x000001ba, 0x0000019e } },
+       { AR5K_RF_GAIN(35),     { 0x000001fa, 0x000001de } },
+       { AR5K_RF_GAIN(36),     { 0x0000003a, 0x00000009 } },
+       { AR5K_RF_GAIN(37),     { 0x0000007a, 0x00000049 } },
+       { AR5K_RF_GAIN(38),     { 0x00000186, 0x00000089 } },
+       { AR5K_RF_GAIN(39),     { 0x000001c6, 0x00000179 } },
+       { AR5K_RF_GAIN(40),     { 0x00000006, 0x000001b9 } },
+       { AR5K_RF_GAIN(41),     { 0x00000046, 0x000001f9 } },
+       { AR5K_RF_GAIN(42),     { 0x00000086, 0x00000039 } },
+       { AR5K_RF_GAIN(43),     { 0x000000c6, 0x00000079 } },
+       { AR5K_RF_GAIN(44),     { 0x000000c6, 0x000000b9 } },
+       { AR5K_RF_GAIN(45),     { 0x000000c6, 0x000001bd } },
+       { AR5K_RF_GAIN(46),     { 0x000000c6, 0x000001fd } },
+       { AR5K_RF_GAIN(47),     { 0x000000c6, 0x0000003d } },
+       { AR5K_RF_GAIN(48),     { 0x000000c6, 0x0000007d } },
+       { AR5K_RF_GAIN(49),     { 0x000000c6, 0x000000bd } },
+       { AR5K_RF_GAIN(50),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(51),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(52),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(53),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(54),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(55),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(56),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(57),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(58),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(59),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(60),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(61),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(62),     { 0x000000c6, 0x000000fd } },
+       { AR5K_RF_GAIN(63),     { 0x000000c6, 0x000000fd } },
+};
+
+/* Initial RF Gain settings for RF5112 */
+static const struct ath5k_ini_rfgain rfgain_5112[] = {
+       /*                            5Ghz      2Ghz    */
+       { AR5K_RF_GAIN(0),      { 0x00000007, 0x00000007 } },
+       { AR5K_RF_GAIN(1),      { 0x00000047, 0x00000047 } },
+       { AR5K_RF_GAIN(2),      { 0x00000087, 0x00000087 } },
+       { AR5K_RF_GAIN(3),      { 0x000001a0, 0x000001a0 } },
+       { AR5K_RF_GAIN(4),      { 0x000001e0, 0x000001e0 } },
+       { AR5K_RF_GAIN(5),      { 0x00000020, 0x00000020 } },
+       { AR5K_RF_GAIN(6),      { 0x00000060, 0x00000060 } },
+       { AR5K_RF_GAIN(7),      { 0x000001a1, 0x000001a1 } },
+       { AR5K_RF_GAIN(8),      { 0x000001e1, 0x000001e1 } },
+       { AR5K_RF_GAIN(9),      { 0x00000021, 0x00000021 } },
+       { AR5K_RF_GAIN(10),     { 0x00000061, 0x00000061 } },
+       { AR5K_RF_GAIN(11),     { 0x00000162, 0x00000162 } },
+       { AR5K_RF_GAIN(12),     { 0x000001a2, 0x000001a2 } },
+       { AR5K_RF_GAIN(13),     { 0x000001e2, 0x000001e2 } },
+       { AR5K_RF_GAIN(14),     { 0x00000022, 0x00000022 } },
+       { AR5K_RF_GAIN(15),     { 0x00000062, 0x00000062 } },
+       { AR5K_RF_GAIN(16),     { 0x00000163, 0x00000163 } },
+       { AR5K_RF_GAIN(17),     { 0x000001a3, 0x000001a3 } },
+       { AR5K_RF_GAIN(18),     { 0x000001e3, 0x000001e3 } },
+       { AR5K_RF_GAIN(19),     { 0x00000023, 0x00000023 } },
+       { AR5K_RF_GAIN(20),     { 0x00000063, 0x00000063 } },
+       { AR5K_RF_GAIN(21),     { 0x00000184, 0x00000184 } },
+       { AR5K_RF_GAIN(22),     { 0x000001c4, 0x000001c4 } },
+       { AR5K_RF_GAIN(23),     { 0x00000004, 0x00000004 } },
+       { AR5K_RF_GAIN(24),     { 0x000001ea, 0x0000000b } },
+       { AR5K_RF_GAIN(25),     { 0x0000002a, 0x0000004b } },
+       { AR5K_RF_GAIN(26),     { 0x0000006a, 0x0000008b } },
+       { AR5K_RF_GAIN(27),     { 0x000000aa, 0x000001ac } },
+       { AR5K_RF_GAIN(28),     { 0x000001ab, 0x000001ec } },
+       { AR5K_RF_GAIN(29),     { 0x000001eb, 0x0000002c } },
+       { AR5K_RF_GAIN(30),     { 0x0000002b, 0x00000012 } },
+       { AR5K_RF_GAIN(31),     { 0x0000006b, 0x00000052 } },
+       { AR5K_RF_GAIN(32),     { 0x000000ab, 0x00000092 } },
+       { AR5K_RF_GAIN(33),     { 0x000001ac, 0x00000193 } },
+       { AR5K_RF_GAIN(34),     { 0x000001ec, 0x000001d3 } },
+       { AR5K_RF_GAIN(35),     { 0x0000002c, 0x00000013 } },
+       { AR5K_RF_GAIN(36),     { 0x0000003a, 0x00000053 } },
+       { AR5K_RF_GAIN(37),     { 0x0000007a, 0x00000093 } },
+       { AR5K_RF_GAIN(38),     { 0x000000ba, 0x00000194 } },
+       { AR5K_RF_GAIN(39),     { 0x000001bb, 0x000001d4 } },
+       { AR5K_RF_GAIN(40),     { 0x000001fb, 0x00000014 } },
+       { AR5K_RF_GAIN(41),     { 0x0000003b, 0x0000003a } },
+       { AR5K_RF_GAIN(42),     { 0x0000007b, 0x0000007a } },
+       { AR5K_RF_GAIN(43),     { 0x000000bb, 0x000000ba } },
+       { AR5K_RF_GAIN(44),     { 0x000001bc, 0x000001bb } },
+       { AR5K_RF_GAIN(45),     { 0x000001fc, 0x000001fb } },
+       { AR5K_RF_GAIN(46),     { 0x0000003c, 0x0000003b } },
+       { AR5K_RF_GAIN(47),     { 0x0000007c, 0x0000007b } },
+       { AR5K_RF_GAIN(48),     { 0x000000bc, 0x000000bb } },
+       { AR5K_RF_GAIN(49),     { 0x000000fc, 0x000001bc } },
+       { AR5K_RF_GAIN(50),     { 0x000000fc, 0x000001fc } },
+       { AR5K_RF_GAIN(51),     { 0x000000fc, 0x0000003c } },
+       { AR5K_RF_GAIN(52),     { 0x000000fc, 0x0000007c } },
+       { AR5K_RF_GAIN(53),     { 0x000000fc, 0x000000bc } },
+       { AR5K_RF_GAIN(54),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(55),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(56),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(57),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(58),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(59),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(60),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(61),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(62),     { 0x000000fc, 0x000000fc } },
+       { AR5K_RF_GAIN(63),     { 0x000000fc, 0x000000fc } },
+};
+
+/* Initial RF Gain settings for RF2413 */
+static const struct ath5k_ini_rfgain rfgain_2413[] = {
+       { AR5K_RF_GAIN(0),      { 0x00000000, 0x00000000 } },
+       { AR5K_RF_GAIN(1),      { 0x00000000, 0x00000040 } },
+       { AR5K_RF_GAIN(2),      { 0x00000000, 0x00000080 } },
+       { AR5K_RF_GAIN(3),      { 0x00000000, 0x00000181 } },
+       { AR5K_RF_GAIN(4),      { 0x00000000, 0x000001c1 } },
+       { AR5K_RF_GAIN(5),      { 0x00000000, 0x00000001 } },
+       { AR5K_RF_GAIN(6),      { 0x00000000, 0x00000041 } },
+       { AR5K_RF_GAIN(7),      { 0x00000000, 0x00000081 } },
+       { AR5K_RF_GAIN(8),      { 0x00000000, 0x00000168 } },
+       { AR5K_RF_GAIN(9),      { 0x00000000, 0x000001a8 } },
+       { AR5K_RF_GAIN(10),     { 0x00000000, 0x000001e8 } },
+       { AR5K_RF_GAIN(11),     { 0x00000000, 0x00000028 } },
+       { AR5K_RF_GAIN(12),     { 0x00000000, 0x00000068 } },
+       { AR5K_RF_GAIN(13),     { 0x00000000, 0x00000189 } },
+       { AR5K_RF_GAIN(14),     { 0x00000000, 0x000001c9 } },
+       { AR5K_RF_GAIN(15),     { 0x00000000, 0x00000009 } },
+       { AR5K_RF_GAIN(16),     { 0x00000000, 0x00000049 } },
+       { AR5K_RF_GAIN(17),     { 0x00000000, 0x00000089 } },
+       { AR5K_RF_GAIN(18),     { 0x00000000, 0x00000190 } },
+       { AR5K_RF_GAIN(19),     { 0x00000000, 0x000001d0 } },
+       { AR5K_RF_GAIN(20),     { 0x00000000, 0x00000010 } },
+       { AR5K_RF_GAIN(21),     { 0x00000000, 0x00000050 } },
+       { AR5K_RF_GAIN(22),     { 0x00000000, 0x00000090 } },
+       { AR5K_RF_GAIN(23),     { 0x00000000, 0x00000191 } },
+       { AR5K_RF_GAIN(24),     { 0x00000000, 0x000001d1 } },
+       { AR5K_RF_GAIN(25),     { 0x00000000, 0x00000011 } },
+       { AR5K_RF_GAIN(26),     { 0x00000000, 0x00000051 } },
+       { AR5K_RF_GAIN(27),     { 0x00000000, 0x00000091 } },
+       { AR5K_RF_GAIN(28),     { 0x00000000, 0x00000178 } },
+       { AR5K_RF_GAIN(29),     { 0x00000000, 0x000001b8 } },
+       { AR5K_RF_GAIN(30),     { 0x00000000, 0x000001f8 } },
+       { AR5K_RF_GAIN(31),     { 0x00000000, 0x00000038 } },
+       { AR5K_RF_GAIN(32),     { 0x00000000, 0x00000078 } },
+       { AR5K_RF_GAIN(33),     { 0x00000000, 0x00000199 } },
+       { AR5K_RF_GAIN(34),     { 0x00000000, 0x000001d9 } },
+       { AR5K_RF_GAIN(35),     { 0x00000000, 0x00000019 } },
+       { AR5K_RF_GAIN(36),     { 0x00000000, 0x00000059 } },
+       { AR5K_RF_GAIN(37),     { 0x00000000, 0x00000099 } },
+       { AR5K_RF_GAIN(38),     { 0x00000000, 0x000000d9 } },
+       { AR5K_RF_GAIN(39),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(40),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(41),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(42),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(43),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(44),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(45),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(46),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(47),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(48),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(49),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(50),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(51),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(52),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(53),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(54),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(55),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(56),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(57),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(58),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(59),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(60),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(61),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(62),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(63),     { 0x00000000, 0x000000f9 } },
+};
+
+/* Initial RF Gain settings for AR2316 */
+static const struct ath5k_ini_rfgain rfgain_2316[] = {
+       { AR5K_RF_GAIN(0),      { 0x00000000, 0x00000000 } },
+       { AR5K_RF_GAIN(1),      { 0x00000000, 0x00000040 } },
+       { AR5K_RF_GAIN(2),      { 0x00000000, 0x00000080 } },
+       { AR5K_RF_GAIN(3),      { 0x00000000, 0x000000c0 } },
+       { AR5K_RF_GAIN(4),      { 0x00000000, 0x000000e0 } },
+       { AR5K_RF_GAIN(5),      { 0x00000000, 0x000000e0 } },
+       { AR5K_RF_GAIN(6),      { 0x00000000, 0x00000128 } },
+       { AR5K_RF_GAIN(7),      { 0x00000000, 0x00000128 } },
+       { AR5K_RF_GAIN(8),      { 0x00000000, 0x00000128 } },
+       { AR5K_RF_GAIN(9),      { 0x00000000, 0x00000168 } },
+       { AR5K_RF_GAIN(10),     { 0x00000000, 0x000001a8 } },
+       { AR5K_RF_GAIN(11),     { 0x00000000, 0x000001e8 } },
+       { AR5K_RF_GAIN(12),     { 0x00000000, 0x00000028 } },
+       { AR5K_RF_GAIN(13),     { 0x00000000, 0x00000068 } },
+       { AR5K_RF_GAIN(14),     { 0x00000000, 0x000000a8 } },
+       { AR5K_RF_GAIN(15),     { 0x00000000, 0x000000e8 } },
+       { AR5K_RF_GAIN(16),     { 0x00000000, 0x000000e8 } },
+       { AR5K_RF_GAIN(17),     { 0x00000000, 0x00000130 } },
+       { AR5K_RF_GAIN(18),     { 0x00000000, 0x00000130 } },
+       { AR5K_RF_GAIN(19),     { 0x00000000, 0x00000170 } },
+       { AR5K_RF_GAIN(20),     { 0x00000000, 0x000001b0 } },
+       { AR5K_RF_GAIN(21),     { 0x00000000, 0x000001f0 } },
+       { AR5K_RF_GAIN(22),     { 0x00000000, 0x00000030 } },
+       { AR5K_RF_GAIN(23),     { 0x00000000, 0x00000070 } },
+       { AR5K_RF_GAIN(24),     { 0x00000000, 0x000000b0 } },
+       { AR5K_RF_GAIN(25),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(26),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(27),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(28),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(29),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(30),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(31),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(32),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(33),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(34),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(35),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(36),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(37),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(38),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(39),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(40),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(41),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(42),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(43),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(44),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(45),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(46),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(47),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(48),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(49),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(50),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(51),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(52),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(53),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(54),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(55),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(56),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(57),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(58),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(59),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(60),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(61),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(62),     { 0x00000000, 0x000000f0 } },
+       { AR5K_RF_GAIN(63),     { 0x00000000, 0x000000f0 } },
+};
+
+
+/* Initial RF Gain settings for RF5413 */
+static const struct ath5k_ini_rfgain rfgain_5413[] = {
+       /*                            5Ghz      2Ghz    */
+       { AR5K_RF_GAIN(0),      { 0x00000000, 0x00000000 } },
+       { AR5K_RF_GAIN(1),      { 0x00000040, 0x00000040 } },
+       { AR5K_RF_GAIN(2),      { 0x00000080, 0x00000080 } },
+       { AR5K_RF_GAIN(3),      { 0x000001a1, 0x00000161 } },
+       { AR5K_RF_GAIN(4),      { 0x000001e1, 0x000001a1 } },
+       { AR5K_RF_GAIN(5),      { 0x00000021, 0x000001e1 } },
+       { AR5K_RF_GAIN(6),      { 0x00000061, 0x00000021 } },
+       { AR5K_RF_GAIN(7),      { 0x00000188, 0x00000061 } },
+       { AR5K_RF_GAIN(8),      { 0x000001c8, 0x00000188 } },
+       { AR5K_RF_GAIN(9),      { 0x00000008, 0x000001c8 } },
+       { AR5K_RF_GAIN(10),     { 0x00000048, 0x00000008 } },
+       { AR5K_RF_GAIN(11),     { 0x00000088, 0x00000048 } },
+       { AR5K_RF_GAIN(12),     { 0x000001a9, 0x00000088 } },
+       { AR5K_RF_GAIN(13),     { 0x000001e9, 0x00000169 } },
+       { AR5K_RF_GAIN(14),     { 0x00000029, 0x000001a9 } },
+       { AR5K_RF_GAIN(15),     { 0x00000069, 0x000001e9 } },
+       { AR5K_RF_GAIN(16),     { 0x000001d0, 0x00000029 } },
+       { AR5K_RF_GAIN(17),     { 0x00000010, 0x00000069 } },
+       { AR5K_RF_GAIN(18),     { 0x00000050, 0x00000190 } },
+       { AR5K_RF_GAIN(19),     { 0x00000090, 0x000001d0 } },
+       { AR5K_RF_GAIN(20),     { 0x000001b1, 0x00000010 } },
+       { AR5K_RF_GAIN(21),     { 0x000001f1, 0x00000050 } },
+       { AR5K_RF_GAIN(22),     { 0x00000031, 0x00000090 } },
+       { AR5K_RF_GAIN(23),     { 0x00000071, 0x00000171 } },
+       { AR5K_RF_GAIN(24),     { 0x000001b8, 0x000001b1 } },
+       { AR5K_RF_GAIN(25),     { 0x000001f8, 0x000001f1 } },
+       { AR5K_RF_GAIN(26),     { 0x00000038, 0x00000031 } },
+       { AR5K_RF_GAIN(27),     { 0x00000078, 0x00000071 } },
+       { AR5K_RF_GAIN(28),     { 0x00000199, 0x00000198 } },
+       { AR5K_RF_GAIN(29),     { 0x000001d9, 0x000001d8 } },
+       { AR5K_RF_GAIN(30),     { 0x00000019, 0x00000018 } },
+       { AR5K_RF_GAIN(31),     { 0x00000059, 0x00000058 } },
+       { AR5K_RF_GAIN(32),     { 0x00000099, 0x00000098 } },
+       { AR5K_RF_GAIN(33),     { 0x000000d9, 0x00000179 } },
+       { AR5K_RF_GAIN(34),     { 0x000000f9, 0x000001b9 } },
+       { AR5K_RF_GAIN(35),     { 0x000000f9, 0x000001f9 } },
+       { AR5K_RF_GAIN(36),     { 0x000000f9, 0x00000039 } },
+       { AR5K_RF_GAIN(37),     { 0x000000f9, 0x00000079 } },
+       { AR5K_RF_GAIN(38),     { 0x000000f9, 0x000000b9 } },
+       { AR5K_RF_GAIN(39),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(40),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(41),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(42),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(43),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(44),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(45),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(46),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(47),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(48),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(49),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(50),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(51),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(52),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(53),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(54),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(55),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(56),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(57),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(58),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(59),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(60),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(61),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(62),     { 0x000000f9, 0x000000f9 } },
+       { AR5K_RF_GAIN(63),     { 0x000000f9, 0x000000f9 } },
+};
+
+
+/* Initial RF Gain settings for RF2425 */
+static const struct ath5k_ini_rfgain rfgain_2425[] = {
+       { AR5K_RF_GAIN(0),      { 0x00000000, 0x00000000 } },
+       { AR5K_RF_GAIN(1),      { 0x00000000, 0x00000040 } },
+       { AR5K_RF_GAIN(2),      { 0x00000000, 0x00000080 } },
+       { AR5K_RF_GAIN(3),      { 0x00000000, 0x00000181 } },
+       { AR5K_RF_GAIN(4),      { 0x00000000, 0x000001c1 } },
+       { AR5K_RF_GAIN(5),      { 0x00000000, 0x00000001 } },
+       { AR5K_RF_GAIN(6),      { 0x00000000, 0x00000041 } },
+       { AR5K_RF_GAIN(7),      { 0x00000000, 0x00000081 } },
+       { AR5K_RF_GAIN(8),      { 0x00000000, 0x00000188 } },
+       { AR5K_RF_GAIN(9),      { 0x00000000, 0x000001c8 } },
+       { AR5K_RF_GAIN(10),     { 0x00000000, 0x00000008 } },
+       { AR5K_RF_GAIN(11),     { 0x00000000, 0x00000048 } },
+       { AR5K_RF_GAIN(12),     { 0x00000000, 0x00000088 } },
+       { AR5K_RF_GAIN(13),     { 0x00000000, 0x00000189 } },
+       { AR5K_RF_GAIN(14),     { 0x00000000, 0x000001c9 } },
+       { AR5K_RF_GAIN(15),     { 0x00000000, 0x00000009 } },
+       { AR5K_RF_GAIN(16),     { 0x00000000, 0x00000049 } },
+       { AR5K_RF_GAIN(17),     { 0x00000000, 0x00000089 } },
+       { AR5K_RF_GAIN(18),     { 0x00000000, 0x000001b0 } },
+       { AR5K_RF_GAIN(19),     { 0x00000000, 0x000001f0 } },
+       { AR5K_RF_GAIN(20),     { 0x00000000, 0x00000030 } },
+       { AR5K_RF_GAIN(21),     { 0x00000000, 0x00000070 } },
+       { AR5K_RF_GAIN(22),     { 0x00000000, 0x00000171 } },
+       { AR5K_RF_GAIN(23),     { 0x00000000, 0x000001b1 } },
+       { AR5K_RF_GAIN(24),     { 0x00000000, 0x000001f1 } },
+       { AR5K_RF_GAIN(25),     { 0x00000000, 0x00000031 } },
+       { AR5K_RF_GAIN(26),     { 0x00000000, 0x00000071 } },
+       { AR5K_RF_GAIN(27),     { 0x00000000, 0x000001b8 } },
+       { AR5K_RF_GAIN(28),     { 0x00000000, 0x000001f8 } },
+       { AR5K_RF_GAIN(29),     { 0x00000000, 0x00000038 } },
+       { AR5K_RF_GAIN(30),     { 0x00000000, 0x00000078 } },
+       { AR5K_RF_GAIN(31),     { 0x00000000, 0x000000b8 } },
+       { AR5K_RF_GAIN(32),     { 0x00000000, 0x000001b9 } },
+       { AR5K_RF_GAIN(33),     { 0x00000000, 0x000001f9 } },
+       { AR5K_RF_GAIN(34),     { 0x00000000, 0x00000039 } },
+       { AR5K_RF_GAIN(35),     { 0x00000000, 0x00000079 } },
+       { AR5K_RF_GAIN(36),     { 0x00000000, 0x000000b9 } },
+       { AR5K_RF_GAIN(37),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(38),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(39),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(40),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(41),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(42),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(43),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(44),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(45),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(46),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(47),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(48),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(49),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(50),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(51),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(52),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(53),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(54),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(55),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(56),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(57),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(58),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(59),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(60),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(61),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(62),     { 0x00000000, 0x000000f9 } },
+       { AR5K_RF_GAIN(63),     { 0x00000000, 0x000000f9 } },
+};
+
+#define AR5K_GAIN_CRN_FIX_BITS_5111            4
+#define AR5K_GAIN_CRN_FIX_BITS_5112            7
+#define AR5K_GAIN_CRN_MAX_FIX_BITS             AR5K_GAIN_CRN_FIX_BITS_5112
+#define AR5K_GAIN_DYN_ADJUST_HI_MARGIN         15
+#define AR5K_GAIN_DYN_ADJUST_LO_MARGIN         20
+#define AR5K_GAIN_CCK_PROBE_CORR               5
+#define AR5K_GAIN_CCK_OFDM_GAIN_DELTA          15
+#define AR5K_GAIN_STEP_COUNT                   10
+
+/* Check if our current measurement is inside our
+ * current variable attenuation window */
+#define AR5K_GAIN_CHECK_ADJUST(_g)             \
+       ((_g)->g_current <= (_g)->g_low || (_g)->g_current >= (_g)->g_high)
+
+struct ath5k_gain_opt_step {
+       s8                              gos_param[AR5K_GAIN_CRN_MAX_FIX_BITS];
+       s8                              gos_gain;
+};
+
+struct ath5k_gain_opt {
+       u8                              go_default;
+       u8                              go_steps_count;
+       const struct ath5k_gain_opt_step        go_step[AR5K_GAIN_STEP_COUNT];
+};
+
+/*
+ * Parameters on gos_param:
+ * 1) Tx clip PHY register
+ * 2) PWD 90 RF register
+ * 3) PWD 84 RF register
+ * 4) RFGainSel RF register
+ */
+static const struct ath5k_gain_opt rfgain_opt_5111 = {
+       4,
+       9,
+       {
+               { { 4, 1, 1, 1 }, 6 },
+               { { 4, 0, 1, 1 }, 4 },
+               { { 3, 1, 1, 1 }, 3 },
+               { { 4, 0, 0, 1 }, 1 },
+               { { 4, 1, 1, 0 }, 0 },
+               { { 4, 0, 1, 0 }, -2 },
+               { { 3, 1, 1, 0 }, -3 },
+               { { 4, 0, 0, 0 }, -4 },
+               { { 2, 1, 1, 0 }, -6 }
+       }
+};
+
+/*
+ * Parameters on gos_param:
+ * 1) Mixgain ovr RF register
+ * 2) PWD 138 RF register
+ * 3) PWD 137 RF register
+ * 4) PWD 136 RF register
+ * 5) PWD 132 RF register
+ * 6) PWD 131 RF register
+ * 7) PWD 130 RF register
+ */
+static const struct ath5k_gain_opt rfgain_opt_5112 = {
+       1,
+       8,
+       {
+               { { 3, 0, 0, 0, 0, 0, 0 }, 6 },
+               { { 2, 0, 0, 0, 0, 0, 0 }, 0 },
+               { { 1, 0, 0, 0, 0, 0, 0 }, -3 },
+               { { 0, 0, 0, 0, 0, 0, 0 }, -6 },
+               { { 0, 1, 1, 0, 0, 0, 0 }, -8 },
+               { { 0, 1, 1, 0, 1, 1, 0 }, -10 },
+               { { 0, 1, 0, 1, 1, 1, 0 }, -13 },
+               { { 0, 1, 0, 1, 1, 0, 1 }, -16 },
+       }
+};
+
index 1209d14613ac49cbdabf8e10fd17cf4257e2b440..00629587b790f8cc037ea643ad52ba7a66d6a1f9 100644 (file)
@@ -11,6 +11,8 @@ ath9k-y +=    hw.o \
                xmit.o \
                rc.o
 
+ath9k-$(CONFIG_PCI) += pci.o
+ath9k-$(CONFIG_ATHEROS_AR71XX) += ahb.o
 ath9k-$(CONFIG_ATH9K_DEBUG) += debug.o
 
 obj-$(CONFIG_ATH9K) += ath9k.o
diff --git a/drivers/net/wireless/ath9k/ahb.c b/drivers/net/wireless/ath9k/ahb.c
new file mode 100644 (file)
index 0000000..391c9fd
--- /dev/null
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/nl80211.h>
+#include <linux/platform_device.h>
+#include <linux/ath9k_platform.h>
+#include "ath9k.h"
+
+/* return bus cachesize in 4B word units */
+static void ath_ahb_read_cachesize(struct ath_softc *sc, int *csz)
+{
+       *csz = L1_CACHE_BYTES >> 2;
+}
+
+static void ath_ahb_cleanup(struct ath_softc *sc)
+{
+       iounmap(sc->mem);
+}
+
+static bool ath_ahb_eeprom_read(struct ath_hw *ah, u32 off, u16 *data)
+{
+       struct ath_softc *sc = ah->ah_sc;
+       struct platform_device *pdev = to_platform_device(sc->dev);
+       struct ath9k_platform_data *pdata;
+
+       pdata = (struct ath9k_platform_data *) pdev->dev.platform_data;
+       if (off >= (ARRAY_SIZE(pdata->eeprom_data))) {
+               DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
+                       "%s: flash read failed, offset %08x is out of range\n",
+                               __func__, off);
+               return false;
+       }
+
+       *data = pdata->eeprom_data[off];
+       return true;
+}
+
+static struct ath_bus_ops ath_ahb_bus_ops  = {
+       .read_cachesize = ath_ahb_read_cachesize,
+       .cleanup = ath_ahb_cleanup,
+
+       .eeprom_read = ath_ahb_eeprom_read,
+};
+
+static int ath_ahb_probe(struct platform_device *pdev)
+{
+       void __iomem *mem;
+       struct ath_softc *sc;
+       struct ieee80211_hw *hw;
+       struct resource *res;
+       int irq;
+       int ret = 0;
+       struct ath_hw *ah;
+
+       if (!pdev->dev.platform_data) {
+               dev_err(&pdev->dev, "no platform data specified\n");
+               ret = -EINVAL;
+               goto err_out;
+       }
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (res == NULL) {
+               dev_err(&pdev->dev, "no memory resource found\n");
+               ret = -ENXIO;
+               goto err_out;
+       }
+
+       mem = ioremap_nocache(res->start, res->end - res->start + 1);
+       if (mem == NULL) {
+               dev_err(&pdev->dev, "ioremap failed\n");
+               ret = -ENOMEM;
+               goto err_out;
+       }
+
+       res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
+       if (res == NULL) {
+               dev_err(&pdev->dev, "no IRQ resource found\n");
+               ret = -ENXIO;
+               goto err_iounmap;
+       }
+
+       irq = res->start;
+
+       hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops);
+       if (hw == NULL) {
+               dev_err(&pdev->dev, "no memory for ieee80211_hw\n");
+               ret = -ENOMEM;
+               goto err_iounmap;
+       }
+
+       SET_IEEE80211_DEV(hw, &pdev->dev);
+       platform_set_drvdata(pdev, hw);
+
+       sc = hw->priv;
+       sc->hw = hw;
+       sc->dev = &pdev->dev;
+       sc->mem = mem;
+       sc->bus_ops = &ath_ahb_bus_ops;
+       sc->irq = irq;
+
+       ret = ath_attach(AR5416_AR9100_DEVID, sc);
+       if (ret != 0) {
+               dev_err(&pdev->dev, "failed to attach device, err=%d\n", ret);
+               ret = -ENODEV;
+               goto err_free_hw;
+       }
+
+       ret = request_irq(irq, ath_isr, IRQF_SHARED, "ath9k", sc);
+       if (ret) {
+               dev_err(&pdev->dev, "request_irq failed, err=%d\n", ret);
+               ret = -EIO;
+               goto err_detach;
+       }
+
+       ah = sc->sc_ah;
+       printk(KERN_INFO
+              "%s: Atheros AR%s MAC/BB Rev:%x, "
+              "AR%s RF Rev:%x, mem=0x%lx, irq=%d\n",
+              wiphy_name(hw->wiphy),
+              ath_mac_bb_name(ah->hw_version.macVersion),
+              ah->hw_version.macRev,
+              ath_rf_name((ah->hw_version.analog5GhzRev & AR_RADIO_SREV_MAJOR)),
+              ah->hw_version.phyRev,
+              (unsigned long)mem, irq);
+
+       return 0;
+
+ err_detach:
+       ath_detach(sc);
+ err_free_hw:
+       ieee80211_free_hw(hw);
+       platform_set_drvdata(pdev, NULL);
+ err_iounmap:
+       iounmap(mem);
+ err_out:
+       return ret;
+}
+
+static int ath_ahb_remove(struct platform_device *pdev)
+{
+       struct ieee80211_hw *hw = platform_get_drvdata(pdev);
+
+       if (hw) {
+               struct ath_softc *sc = hw->priv;
+
+               ath_cleanup(sc);
+               platform_set_drvdata(pdev, NULL);
+       }
+
+       return 0;
+}
+
+static struct platform_driver ath_ahb_driver = {
+       .probe      = ath_ahb_probe,
+       .remove     = ath_ahb_remove,
+       .driver         = {
+               .name   = "ath9k",
+               .owner  = THIS_MODULE,
+       },
+};
+
+int ath_ahb_init(void)
+{
+       return platform_driver_register(&ath_ahb_driver);
+}
+
+void ath_ahb_exit(void)
+{
+       platform_driver_unregister(&ath_ahb_driver);
+}
index 251e2d9a7a4a6d20e772325f6d7449a757f91984..d4df7e611df5703119a5bad219da9a7881f4ca8d 100644 (file)
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
-#include "hw.h"
-#include "reg.h"
-#include "phy.h"
+#include "ath9k.h"
 
-static int ath9k_hw_get_ani_channel_idx(struct ath_hal *ah,
+static int ath9k_hw_get_ani_channel_idx(struct ath_hw *ah,
                                        struct ath9k_channel *chan)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int i;
 
-       for (i = 0; i < ARRAY_SIZE(ahp->ah_ani); i++) {
-               if (ahp->ah_ani[i].c.channel == chan->channel)
+       for (i = 0; i < ARRAY_SIZE(ah->ani); i++) {
+               if (ah->ani[i].c &&
+                   ah->ani[i].c->channel == chan->channel)
                        return i;
-               if (ahp->ah_ani[i].c.channel == 0) {
-                       ahp->ah_ani[i].c.channel = chan->channel;
-                       ahp->ah_ani[i].c.channelFlags = chan->channelFlags;
+               if (ah->ani[i].c == NULL) {
+                       ah->ani[i].c = chan;
                        return i;
                }
        }
@@ -41,41 +37,40 @@ static int ath9k_hw_get_ani_channel_idx(struct ath_hal *ah,
        return 0;
 }
 
-static bool ath9k_hw_ani_control(struct ath_hal *ah,
+static bool ath9k_hw_ani_control(struct ath_hw *ah,
                                 enum ath9k_ani_cmd cmd, int param)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416AniState *aniState = ahp->ah_curani;
+       struct ar5416AniState *aniState = ah->curani;
 
-       switch (cmd & ahp->ah_ani_function) {
+       switch (cmd & ah->ani_function) {
        case ATH9K_ANI_NOISE_IMMUNITY_LEVEL:{
                u32 level = param;
 
-               if (level >= ARRAY_SIZE(ahp->ah_totalSizeDesired)) {
+               if (level >= ARRAY_SIZE(ah->totalSizeDesired)) {
                        DPRINTF(ah->ah_sc, ATH_DBG_ANI,
                                "level out of range (%u > %u)\n",
                                level,
-                               (unsigned)ARRAY_SIZE(ahp->ah_totalSizeDesired));
+                               (unsigned)ARRAY_SIZE(ah->totalSizeDesired));
                        return false;
                }
 
                REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
                              AR_PHY_DESIRED_SZ_TOT_DES,
-                             ahp->ah_totalSizeDesired[level]);
+                             ah->totalSizeDesired[level]);
                REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1,
                              AR_PHY_AGC_CTL1_COARSE_LOW,
-                             ahp->ah_coarseLow[level]);
+                             ah->coarse_low[level]);
                REG_RMW_FIELD(ah, AR_PHY_AGC_CTL1,
                              AR_PHY_AGC_CTL1_COARSE_HIGH,
-                             ahp->ah_coarseHigh[level]);
+                             ah->coarse_high[level]);
                REG_RMW_FIELD(ah, AR_PHY_FIND_SIG,
                              AR_PHY_FIND_SIG_FIRPWR,
-                             ahp->ah_firpwr[level]);
+                             ah->firpwr[level]);
 
                if (level > aniState->noiseImmunityLevel)
-                       ahp->ah_stats.ast_ani_niup++;
+                       ah->stats.ast_ani_niup++;
                else if (level < aniState->noiseImmunityLevel)
-                       ahp->ah_stats.ast_ani_nidown++;
+                       ah->stats.ast_ani_nidown++;
                aniState->noiseImmunityLevel = level;
                break;
        }
@@ -129,9 +124,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah,
 
                if (!on != aniState->ofdmWeakSigDetectOff) {
                        if (on)
-                               ahp->ah_stats.ast_ani_ofdmon++;
+                               ah->stats.ast_ani_ofdmon++;
                        else
-                               ahp->ah_stats.ast_ani_ofdmoff++;
+                               ah->stats.ast_ani_ofdmoff++;
                        aniState->ofdmWeakSigDetectOff = !on;
                }
                break;
@@ -145,9 +140,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah,
                              weakSigThrCck[high]);
                if (high != aniState->cckWeakSigThreshold) {
                        if (high)
-                               ahp->ah_stats.ast_ani_cckhigh++;
+                               ah->stats.ast_ani_cckhigh++;
                        else
-                               ahp->ah_stats.ast_ani_ccklow++;
+                               ah->stats.ast_ani_ccklow++;
                        aniState->cckWeakSigThreshold = high;
                }
                break;
@@ -167,9 +162,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah,
                              AR_PHY_FIND_SIG_FIRSTEP,
                              firstep[level]);
                if (level > aniState->firstepLevel)
-                       ahp->ah_stats.ast_ani_stepup++;
+                       ah->stats.ast_ani_stepup++;
                else if (level < aniState->firstepLevel)
-                       ahp->ah_stats.ast_ani_stepdown++;
+                       ah->stats.ast_ani_stepdown++;
                aniState->firstepLevel = level;
                break;
        }
@@ -190,9 +185,9 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah,
                              AR_PHY_TIMING5_CYCPWR_THR1,
                              cycpwrThr1[level]);
                if (level > aniState->spurImmunityLevel)
-                       ahp->ah_stats.ast_ani_spurup++;
+                       ah->stats.ast_ani_spurup++;
                else if (level < aniState->spurImmunityLevel)
-                       ahp->ah_stats.ast_ani_spurdown++;
+                       ah->stats.ast_ani_spurdown++;
                aniState->spurImmunityLevel = level;
                break;
        }
@@ -223,7 +218,7 @@ static bool ath9k_hw_ani_control(struct ath_hal *ah,
        return true;
 }
 
-static void ath9k_hw_update_mibstats(struct ath_hal *ah,
+static void ath9k_hw_update_mibstats(struct ath_hw *ah,
                                     struct ath9k_mib_stats *stats)
 {
        stats->ackrcv_bad += REG_READ(ah, AR_ACK_FAIL);
@@ -233,18 +228,17 @@ static void ath9k_hw_update_mibstats(struct ath_hal *ah,
        stats->beacons += REG_READ(ah, AR_BEACON_CNT);
 }
 
-static void ath9k_ani_restart(struct ath_hal *ah)
+static void ath9k_ani_restart(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        struct ar5416AniState *aniState;
 
        if (!DO_ANI(ah))
                return;
 
-       aniState = ahp->ah_curani;
+       aniState = ah->curani;
 
        aniState->listenTime = 0;
-       if (ahp->ah_hasHwPhyCounters) {
+       if (ah->has_hw_phycounters) {
                if (aniState->ofdmTrigHigh > AR_PHY_COUNTMAX) {
                        aniState->ofdmPhyErrBase = 0;
                        DPRINTF(ah->ah_sc, ATH_DBG_ANI,
@@ -270,24 +264,22 @@ static void ath9k_ani_restart(struct ath_hal *ah)
                REG_WRITE(ah, AR_PHY_ERR_MASK_1, AR_PHY_ERR_OFDM_TIMING);
                REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
 
-               ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats);
+               ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
        }
        aniState->ofdmPhyErrCount = 0;
        aniState->cckPhyErrCount = 0;
 }
 
-static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
+static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_channel *chan = ah->ah_curchan;
+       struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
        struct ar5416AniState *aniState;
-       enum wireless_mode mode;
        int32_t rssi;
 
        if (!DO_ANI(ah))
                return;
 
-       aniState = ahp->ah_curani;
+       aniState = ah->curani;
 
        if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) {
                if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL,
@@ -303,14 +295,14 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
                }
        }
 
-       if (ah->ah_opmode == NL80211_IFTYPE_AP) {
+       if (ah->opmode == NL80211_IFTYPE_AP) {
                if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
                        ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                             aniState->firstepLevel + 1);
                }
                return;
        }
-       rssi = BEACON_RSSI(ahp);
+       rssi = BEACON_RSSI(ah);
        if (rssi > aniState->rssiThrHigh) {
                if (!aniState->ofdmWeakSigDetectOff) {
                        if (ath9k_hw_ani_control(ah,
@@ -336,8 +328,7 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
                                             aniState->firstepLevel + 1);
                return;
        } else {
-               mode = ath9k_hw_chan2wmode(ah, chan);
-               if (mode == ATH9K_MODE_11G || mode == ATH9K_MODE_11B) {
+               if (conf->channel->band == IEEE80211_BAND_2GHZ) {
                        if (!aniState->ofdmWeakSigDetectOff)
                                ath9k_hw_ani_control(ah,
                                     ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION,
@@ -350,39 +341,36 @@ static void ath9k_hw_ani_ofdm_err_trigger(struct ath_hal *ah)
        }
 }
 
-static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah)
+static void ath9k_hw_ani_cck_err_trigger(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_channel *chan = ah->ah_curchan;
+       struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
        struct ar5416AniState *aniState;
-       enum wireless_mode mode;
        int32_t rssi;
 
        if (!DO_ANI(ah))
                return;
 
-       aniState = ahp->ah_curani;
+       aniState = ah->curani;
        if (aniState->noiseImmunityLevel < HAL_NOISE_IMMUNE_MAX) {
                if (ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL,
                                         aniState->noiseImmunityLevel + 1)) {
                        return;
                }
        }
-       if (ah->ah_opmode == NL80211_IFTYPE_AP) {
+       if (ah->opmode == NL80211_IFTYPE_AP) {
                if (aniState->firstepLevel < HAL_FIRST_STEP_MAX) {
                        ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                             aniState->firstepLevel + 1);
                }
                return;
        }
-       rssi = BEACON_RSSI(ahp);
+       rssi = BEACON_RSSI(ah);
        if (rssi > aniState->rssiThrLow) {
                if (aniState->firstepLevel < HAL_FIRST_STEP_MAX)
                        ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                             aniState->firstepLevel + 1);
        } else {
-               mode = ath9k_hw_chan2wmode(ah, chan);
-               if (mode == ATH9K_MODE_11G || mode == ATH9K_MODE_11B) {
+               if (conf->channel->band == IEEE80211_BAND_2GHZ) {
                        if (aniState->firstepLevel > 0)
                                ath9k_hw_ani_control(ah,
                                             ATH9K_ANI_FIRSTEP_LEVEL, 0);
@@ -390,22 +378,21 @@ static void ath9k_hw_ani_cck_err_trigger(struct ath_hal *ah)
        }
 }
 
-static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah)
+static void ath9k_hw_ani_lower_immunity(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        struct ar5416AniState *aniState;
        int32_t rssi;
 
-       aniState = ahp->ah_curani;
+       aniState = ah->curani;
 
-       if (ah->ah_opmode == NL80211_IFTYPE_AP) {
+       if (ah->opmode == NL80211_IFTYPE_AP) {
                if (aniState->firstepLevel > 0) {
                        if (ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                                 aniState->firstepLevel - 1))
                                return;
                }
        } else {
-               rssi = BEACON_RSSI(ahp);
+               rssi = BEACON_RSSI(ah);
                if (rssi > aniState->rssiThrHigh) {
                        /* XXX: Handle me */
                } else if (rssi > aniState->rssiThrLow) {
@@ -444,9 +431,8 @@ static void ath9k_hw_ani_lower_immunity(struct ath_hal *ah)
        }
 }
 
-static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah)
+static int32_t ath9k_hw_ani_get_listen_time(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        struct ar5416AniState *aniState;
        u32 txFrameCount, rxFrameCount, cycleCount;
        int32_t listenTime;
@@ -455,11 +441,11 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah)
        rxFrameCount = REG_READ(ah, AR_RFCNT);
        cycleCount = REG_READ(ah, AR_CCCNT);
 
-       aniState = ahp->ah_curani;
+       aniState = ah->curani;
        if (aniState->cycleCount == 0 || aniState->cycleCount > cycleCount) {
 
                listenTime = 0;
-               ahp->ah_stats.ast_ani_lzero++;
+               ah->stats.ast_ani_lzero++;
        } else {
                int32_t ccdelta = cycleCount - aniState->cycleCount;
                int32_t rfdelta = rxFrameCount - aniState->rxFrameCount;
@@ -473,25 +459,24 @@ static int32_t ath9k_hw_ani_get_listen_time(struct ath_hal *ah)
        return listenTime;
 }
 
-void ath9k_ani_reset(struct ath_hal *ah)
+void ath9k_ani_reset(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        struct ar5416AniState *aniState;
-       struct ath9k_channel *chan = ah->ah_curchan;
+       struct ath9k_channel *chan = ah->curchan;
        int index;
 
        if (!DO_ANI(ah))
                return;
 
        index = ath9k_hw_get_ani_channel_idx(ah, chan);
-       aniState = &ahp->ah_ani[index];
-       ahp->ah_curani = aniState;
+       aniState = &ah->ani[index];
+       ah->curani = aniState;
 
-       if (DO_ANI(ah) && ah->ah_opmode != NL80211_IFTYPE_STATION
-           && ah->ah_opmode != NL80211_IFTYPE_ADHOC) {
+       if (DO_ANI(ah) && ah->opmode != NL80211_IFTYPE_STATION
+           && ah->opmode != NL80211_IFTYPE_ADHOC) {
                DPRINTF(ah->ah_sc, ATH_DBG_ANI,
-                       "Reset ANI state opmode %u\n", ah->ah_opmode);
-               ahp->ah_stats.ast_ani_reset++;
+                       "Reset ANI state opmode %u\n", ah->opmode);
+               ah->stats.ast_ani_reset++;
 
                ath9k_hw_ani_control(ah, ATH9K_ANI_NOISE_IMMUNITY_LEVEL, 0);
                ath9k_hw_ani_control(ah, ATH9K_ANI_SPUR_IMMUNITY_LEVEL, 0);
@@ -504,15 +489,15 @@ void ath9k_ani_reset(struct ath_hal *ah)
                ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) |
                                     ATH9K_RX_FILTER_PHYERR);
 
-               if (ah->ah_opmode == NL80211_IFTYPE_AP) {
-                       ahp->ah_curani->ofdmTrigHigh =
-                               ah->ah_config.ofdm_trig_high;
-                       ahp->ah_curani->ofdmTrigLow =
-                               ah->ah_config.ofdm_trig_low;
-                       ahp->ah_curani->cckTrigHigh =
-                               ah->ah_config.cck_trig_high;
-                       ahp->ah_curani->cckTrigLow =
-                               ah->ah_config.cck_trig_low;
+               if (ah->opmode == NL80211_IFTYPE_AP) {
+                       ah->curani->ofdmTrigHigh =
+                               ah->config.ofdm_trig_high;
+                       ah->curani->ofdmTrigLow =
+                               ah->config.ofdm_trig_low;
+                       ah->curani->cckTrigHigh =
+                               ah->config.cck_trig_high;
+                       ah->curani->cckTrigLow =
+                               ah->config.cck_trig_low;
                }
                ath9k_ani_restart(ah);
                return;
@@ -533,7 +518,7 @@ void ath9k_ani_reset(struct ath_hal *ah)
        if (aniState->firstepLevel != 0)
                ath9k_hw_ani_control(ah, ATH9K_ANI_FIRSTEP_LEVEL,
                                     aniState->firstepLevel);
-       if (ahp->ah_hasHwPhyCounters) {
+       if (ah->has_hw_phycounters) {
                ath9k_hw_setrxfilter(ah, ath9k_hw_getrxfilter(ah) &
                                     ~ATH9K_RX_FILTER_PHYERR);
                ath9k_ani_restart(ah);
@@ -547,31 +532,33 @@ void ath9k_ani_reset(struct ath_hal *ah)
        }
 }
 
-void ath9k_hw_ani_monitor(struct ath_hal *ah,
+void ath9k_hw_ani_monitor(struct ath_hw *ah,
                          const struct ath9k_node_stats *stats,
                          struct ath9k_channel *chan)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        struct ar5416AniState *aniState;
        int32_t listenTime;
 
-       aniState = ahp->ah_curani;
-       ahp->ah_stats.ast_nodestats = *stats;
+       if (!DO_ANI(ah))
+               return;
+
+       aniState = ah->curani;
+       ah->stats.ast_nodestats = *stats;
 
        listenTime = ath9k_hw_ani_get_listen_time(ah);
        if (listenTime < 0) {
-               ahp->ah_stats.ast_ani_lneg++;
+               ah->stats.ast_ani_lneg++;
                ath9k_ani_restart(ah);
                return;
        }
 
        aniState->listenTime += listenTime;
 
-       if (ahp->ah_hasHwPhyCounters) {
+       if (ah->has_hw_phycounters) {
                u32 phyCnt1, phyCnt2;
                u32 ofdmPhyErrCnt, cckPhyErrCnt;
 
-               ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats);
+               ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
 
                phyCnt1 = REG_READ(ah, AR_PHY_ERR_1);
                phyCnt2 = REG_READ(ah, AR_PHY_ERR_2);
@@ -604,27 +591,24 @@ void ath9k_hw_ani_monitor(struct ath_hal *ah,
                }
 
                ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase;
-               ahp->ah_stats.ast_ani_ofdmerrs +=
+               ah->stats.ast_ani_ofdmerrs +=
                        ofdmPhyErrCnt - aniState->ofdmPhyErrCount;
                aniState->ofdmPhyErrCount = ofdmPhyErrCnt;
 
                cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase;
-               ahp->ah_stats.ast_ani_cckerrs +=
+               ah->stats.ast_ani_cckerrs +=
                        cckPhyErrCnt - aniState->cckPhyErrCount;
                aniState->cckPhyErrCount = cckPhyErrCnt;
        }
 
-       if (!DO_ANI(ah))
-               return;
-
-       if (aniState->listenTime > 5 * ahp->ah_aniPeriod) {
+       if (aniState->listenTime > 5 * ah->aniperiod) {
                if (aniState->ofdmPhyErrCount <= aniState->listenTime *
                    aniState->ofdmTrigLow / 1000 &&
                    aniState->cckPhyErrCount <= aniState->listenTime *
                    aniState->cckTrigLow / 1000)
                        ath9k_hw_ani_lower_immunity(ah);
                ath9k_ani_restart(ah);
-       } else if (aniState->listenTime > ahp->ah_aniPeriod) {
+       } else if (aniState->listenTime > ah->aniperiod) {
                if (aniState->ofdmPhyErrCount > aniState->listenTime *
                    aniState->ofdmTrigHigh / 1000) {
                        ath9k_hw_ani_ofdm_err_trigger(ah);
@@ -638,20 +622,16 @@ void ath9k_hw_ani_monitor(struct ath_hal *ah,
        }
 }
 
-bool ath9k_hw_phycounters(struct ath_hal *ah)
+bool ath9k_hw_phycounters(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       return ahp->ah_hasHwPhyCounters ? true : false;
+       return ah->has_hw_phycounters ? true : false;
 }
 
-void ath9k_enable_mib_counters(struct ath_hal *ah)
+void ath9k_enable_mib_counters(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Enable MIB counters\n");
 
-       ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats);
+       ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
 
        REG_WRITE(ah, AR_FILT_OFDM, 0);
        REG_WRITE(ah, AR_FILT_CCK, 0);
@@ -662,21 +642,19 @@ void ath9k_enable_mib_counters(struct ath_hal *ah)
        REG_WRITE(ah, AR_PHY_ERR_MASK_2, AR_PHY_ERR_CCK_TIMING);
 }
 
-void ath9k_hw_disable_mib_counters(struct ath_hal *ah)
+void ath9k_hw_disable_mib_counters(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Disable MIB counters\n");
 
        REG_WRITE(ah, AR_MIBC, AR_MIBC_FMC | AR_MIBC_CMC);
 
-       ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats);
+       ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
 
        REG_WRITE(ah, AR_FILT_OFDM, 0);
        REG_WRITE(ah, AR_FILT_CCK, 0);
 }
 
-u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah,
+u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah,
                                  u32 *rxc_pcnt,
                                  u32 *rxf_pcnt,
                                  u32 *txf_pcnt)
@@ -721,10 +699,9 @@ u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah,
  * any of the MIB counters overflow/trigger so don't assume we're
  * here because a PHY error counter triggered.
  */
-void ath9k_hw_procmibevent(struct ath_hal *ah,
+void ath9k_hw_procmibevent(struct ath_hw *ah,
                           const struct ath9k_node_stats *stats)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        u32 phyCnt1, phyCnt2;
 
        /* Reset these counters regardless */
@@ -734,8 +711,8 @@ void ath9k_hw_procmibevent(struct ath_hal *ah,
                REG_WRITE(ah, AR_SLP_MIB_CTRL, AR_SLP_MIB_CLEAR);
 
        /* Clear the mib counters and save them in the stats */
-       ath9k_hw_update_mibstats(ah, &ahp->ah_mibStats);
-       ahp->ah_stats.ast_nodestats = *stats;
+       ath9k_hw_update_mibstats(ah, &ah->ah_mibStats);
+       ah->stats.ast_nodestats = *stats;
 
        if (!DO_ANI(ah))
                return;
@@ -745,17 +722,17 @@ void ath9k_hw_procmibevent(struct ath_hal *ah,
        phyCnt2 = REG_READ(ah, AR_PHY_ERR_2);
        if (((phyCnt1 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK) ||
            ((phyCnt2 & AR_MIBCNT_INTRMASK) == AR_MIBCNT_INTRMASK)) {
-               struct ar5416AniState *aniState = ahp->ah_curani;
+               struct ar5416AniState *aniState = ah->curani;
                u32 ofdmPhyErrCnt, cckPhyErrCnt;
 
                /* NB: only use ast_ani_*errs with AH_PRIVATE_DIAG */
                ofdmPhyErrCnt = phyCnt1 - aniState->ofdmPhyErrBase;
-               ahp->ah_stats.ast_ani_ofdmerrs +=
+               ah->stats.ast_ani_ofdmerrs +=
                        ofdmPhyErrCnt - aniState->ofdmPhyErrCount;
                aniState->ofdmPhyErrCount = ofdmPhyErrCnt;
 
                cckPhyErrCnt = phyCnt2 - aniState->cckPhyErrBase;
-               ahp->ah_stats.ast_ani_cckerrs +=
+               ah->stats.ast_ani_cckerrs +=
                        cckPhyErrCnt - aniState->cckPhyErrCount;
                aniState->cckPhyErrCount = cckPhyErrCnt;
 
@@ -774,9 +751,8 @@ void ath9k_hw_procmibevent(struct ath_hal *ah,
        }
 }
 
-void ath9k_hw_ani_setup(struct ath_hal *ah)
+void ath9k_hw_ani_setup(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int i;
 
        const int totalSizeDesired[] = { -55, -55, -55, -55, -62 };
@@ -785,66 +761,63 @@ void ath9k_hw_ani_setup(struct ath_hal *ah)
        const int firpwr[] = { -78, -78, -78, -78, -80 };
 
        for (i = 0; i < 5; i++) {
-               ahp->ah_totalSizeDesired[i] = totalSizeDesired[i];
-               ahp->ah_coarseHigh[i] = coarseHigh[i];
-               ahp->ah_coarseLow[i] = coarseLow[i];
-               ahp->ah_firpwr[i] = firpwr[i];
+               ah->totalSizeDesired[i] = totalSizeDesired[i];
+               ah->coarse_high[i] = coarseHigh[i];
+               ah->coarse_low[i] = coarseLow[i];
+               ah->firpwr[i] = firpwr[i];
        }
 }
 
-void ath9k_hw_ani_attach(struct ath_hal *ah)
+void ath9k_hw_ani_attach(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int i;
 
        DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Attach ANI\n");
 
-       ahp->ah_hasHwPhyCounters = 1;
-
-       memset(ahp->ah_ani, 0, sizeof(ahp->ah_ani));
-       for (i = 0; i < ARRAY_SIZE(ahp->ah_ani); i++) {
-               ahp->ah_ani[i].ofdmTrigHigh = ATH9K_ANI_OFDM_TRIG_HIGH;
-               ahp->ah_ani[i].ofdmTrigLow = ATH9K_ANI_OFDM_TRIG_LOW;
-               ahp->ah_ani[i].cckTrigHigh = ATH9K_ANI_CCK_TRIG_HIGH;
-               ahp->ah_ani[i].cckTrigLow = ATH9K_ANI_CCK_TRIG_LOW;
-               ahp->ah_ani[i].rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH;
-               ahp->ah_ani[i].rssiThrLow = ATH9K_ANI_RSSI_THR_LOW;
-               ahp->ah_ani[i].ofdmWeakSigDetectOff =
+       ah->has_hw_phycounters = 1;
+
+       memset(ah->ani, 0, sizeof(ah->ani));
+       for (i = 0; i < ARRAY_SIZE(ah->ani); i++) {
+               ah->ani[i].ofdmTrigHigh = ATH9K_ANI_OFDM_TRIG_HIGH;
+               ah->ani[i].ofdmTrigLow = ATH9K_ANI_OFDM_TRIG_LOW;
+               ah->ani[i].cckTrigHigh = ATH9K_ANI_CCK_TRIG_HIGH;
+               ah->ani[i].cckTrigLow = ATH9K_ANI_CCK_TRIG_LOW;
+               ah->ani[i].rssiThrHigh = ATH9K_ANI_RSSI_THR_HIGH;
+               ah->ani[i].rssiThrLow = ATH9K_ANI_RSSI_THR_LOW;
+               ah->ani[i].ofdmWeakSigDetectOff =
                        !ATH9K_ANI_USE_OFDM_WEAK_SIG;
-               ahp->ah_ani[i].cckWeakSigThreshold =
+               ah->ani[i].cckWeakSigThreshold =
                        ATH9K_ANI_CCK_WEAK_SIG_THR;
-               ahp->ah_ani[i].spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL;
-               ahp->ah_ani[i].firstepLevel = ATH9K_ANI_FIRSTEP_LVL;
-               if (ahp->ah_hasHwPhyCounters) {
-                       ahp->ah_ani[i].ofdmPhyErrBase =
+               ah->ani[i].spurImmunityLevel = ATH9K_ANI_SPUR_IMMUNE_LVL;
+               ah->ani[i].firstepLevel = ATH9K_ANI_FIRSTEP_LVL;
+               if (ah->has_hw_phycounters) {
+                       ah->ani[i].ofdmPhyErrBase =
                                AR_PHY_COUNTMAX - ATH9K_ANI_OFDM_TRIG_HIGH;
-                       ahp->ah_ani[i].cckPhyErrBase =
+                       ah->ani[i].cckPhyErrBase =
                                AR_PHY_COUNTMAX - ATH9K_ANI_CCK_TRIG_HIGH;
                }
        }
-       if (ahp->ah_hasHwPhyCounters) {
+       if (ah->has_hw_phycounters) {
                DPRINTF(ah->ah_sc, ATH_DBG_ANI,
                        "Setting OfdmErrBase = 0x%08x\n",
-                       ahp->ah_ani[0].ofdmPhyErrBase);
+                       ah->ani[0].ofdmPhyErrBase);
                DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Setting cckErrBase = 0x%08x\n",
-                       ahp->ah_ani[0].cckPhyErrBase);
+                       ah->ani[0].cckPhyErrBase);
 
-               REG_WRITE(ah, AR_PHY_ERR_1, ahp->ah_ani[0].ofdmPhyErrBase);
-               REG_WRITE(ah, AR_PHY_ERR_2, ahp->ah_ani[0].cckPhyErrBase);
+               REG_WRITE(ah, AR_PHY_ERR_1, ah->ani[0].ofdmPhyErrBase);
+               REG_WRITE(ah, AR_PHY_ERR_2, ah->ani[0].cckPhyErrBase);
                ath9k_enable_mib_counters(ah);
        }
-       ahp->ah_aniPeriod = ATH9K_ANI_PERIOD;
-       if (ah->ah_config.enable_ani)
-               ahp->ah_procPhyErr |= HAL_PROCESS_ANI;
+       ah->aniperiod = ATH9K_ANI_PERIOD;
+       if (ah->config.enable_ani)
+               ah->proc_phyerr |= HAL_PROCESS_ANI;
 }
 
-void ath9k_hw_ani_detach(struct ath_hal *ah)
+void ath9k_hw_ani_detach(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        DPRINTF(ah->ah_sc, ATH_DBG_ANI, "Detach ANI\n");
 
-       if (ahp->ah_hasHwPhyCounters) {
+       if (ah->has_hw_phycounters) {
                ath9k_hw_disable_mib_counters(ah);
                REG_WRITE(ah, AR_PHY_ERR_1, 0);
                REG_WRITE(ah, AR_PHY_ERR_2, 0);
diff --git a/drivers/net/wireless/ath9k/ani.h b/drivers/net/wireless/ath9k/ani.h
new file mode 100644 (file)
index 0000000..7315761
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef ANI_H
+#define ANI_H
+
+#define HAL_PROCESS_ANI           0x00000001
+#define ATH9K_RSSI_EP_MULTIPLIER  (1<<7)
+
+#define DO_ANI(ah) (((ah)->proc_phyerr & HAL_PROCESS_ANI))
+
+#define HAL_EP_RND(x, mul)                                             \
+       ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
+#define BEACON_RSSI(ahp)                                       \
+       HAL_EP_RND(ahp->stats.ast_nodestats.ns_avgbrssi,        \
+                  ATH9K_RSSI_EP_MULTIPLIER)
+
+#define ATH9K_ANI_OFDM_TRIG_HIGH          500
+#define ATH9K_ANI_OFDM_TRIG_LOW           200
+#define ATH9K_ANI_CCK_TRIG_HIGH           200
+#define ATH9K_ANI_CCK_TRIG_LOW            100
+#define ATH9K_ANI_NOISE_IMMUNE_LVL        4
+#define ATH9K_ANI_USE_OFDM_WEAK_SIG       true
+#define ATH9K_ANI_CCK_WEAK_SIG_THR        false
+#define ATH9K_ANI_SPUR_IMMUNE_LVL         7
+#define ATH9K_ANI_FIRSTEP_LVL             0
+#define ATH9K_ANI_RSSI_THR_HIGH           40
+#define ATH9K_ANI_RSSI_THR_LOW            7
+#define ATH9K_ANI_PERIOD                  100
+
+#define HAL_NOISE_IMMUNE_MAX              4
+#define HAL_SPUR_IMMUNE_MAX               7
+#define HAL_FIRST_STEP_MAX                2
+
+enum ath9k_ani_cmd {
+       ATH9K_ANI_PRESENT = 0x1,
+       ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2,
+       ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4,
+       ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8,
+       ATH9K_ANI_FIRSTEP_LEVEL = 0x10,
+       ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20,
+       ATH9K_ANI_MODE = 0x40,
+       ATH9K_ANI_PHYERR_RESET = 0x80,
+       ATH9K_ANI_ALL = 0xff
+};
+
+struct ath9k_mib_stats {
+       u32 ackrcv_bad;
+       u32 rts_bad;
+       u32 rts_good;
+       u32 fcs_bad;
+       u32 beacons;
+};
+
+struct ath9k_node_stats {
+       u32 ns_avgbrssi;
+       u32 ns_avgrssi;
+       u32 ns_avgtxrssi;
+       u32 ns_avgtxrate;
+};
+
+struct ar5416AniState {
+       struct ath9k_channel *c;
+       u8 noiseImmunityLevel;
+       u8 spurImmunityLevel;
+       u8 firstepLevel;
+       u8 ofdmWeakSigDetectOff;
+       u8 cckWeakSigThreshold;
+       u32 listenTime;
+       u32 ofdmTrigHigh;
+       u32 ofdmTrigLow;
+       int32_t cckTrigHigh;
+       int32_t cckTrigLow;
+       int32_t rssiThrLow;
+       int32_t rssiThrHigh;
+       u32 noiseFloor;
+       u32 txFrameCount;
+       u32 rxFrameCount;
+       u32 cycleCount;
+       u32 ofdmPhyErrCount;
+       u32 cckPhyErrCount;
+       u32 ofdmPhyErrBase;
+       u32 cckPhyErrBase;
+       int16_t pktRssi[2];
+       int16_t ofdmErrRssi[2];
+       int16_t cckErrRssi[2];
+};
+
+struct ar5416Stats {
+       u32 ast_ani_niup;
+       u32 ast_ani_nidown;
+       u32 ast_ani_spurup;
+       u32 ast_ani_spurdown;
+       u32 ast_ani_ofdmon;
+       u32 ast_ani_ofdmoff;
+       u32 ast_ani_cckhigh;
+       u32 ast_ani_ccklow;
+       u32 ast_ani_stepup;
+       u32 ast_ani_stepdown;
+       u32 ast_ani_ofdmerrs;
+       u32 ast_ani_cckerrs;
+       u32 ast_ani_reset;
+       u32 ast_ani_lzero;
+       u32 ast_ani_lneg;
+       struct ath9k_mib_stats ast_mibstats;
+       struct ath9k_node_stats ast_nodestats;
+};
+#define ah_mibStats stats.ast_mibstats
+
+void ath9k_ani_reset(struct ath_hw *ah);
+void ath9k_hw_ani_monitor(struct ath_hw *ah,
+                         const struct ath9k_node_stats *stats,
+                         struct ath9k_channel *chan);
+bool ath9k_hw_phycounters(struct ath_hw *ah);
+void ath9k_enable_mib_counters(struct ath_hw *ah);
+void ath9k_hw_disable_mib_counters(struct ath_hw *ah);
+u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hw *ah, u32 *rxc_pcnt,
+                                 u32 *rxf_pcnt, u32 *txf_pcnt);
+void ath9k_hw_procmibevent(struct ath_hw *ah,
+                          const struct ath9k_node_stats *stats);
+void ath9k_hw_ani_setup(struct ath_hw *ah);
+void ath9k_hw_ani_attach(struct ath_hw *ah);
+void ath9k_hw_ani_detach(struct ath_hw *ah);
+
+#endif /* ANI_H */
index d2781350295348f850c7b0501044a904c8a3ce65..0b0f82c83ffc979061eec52448725bc787ca28e6 100644 (file)
 #ifndef ATH9K_H
 #define ATH9K_H
 
-#include <linux/io.h>
-
-#define ATHEROS_VENDOR_ID      0x168c
-
-#define AR5416_DEVID_PCI       0x0023
-#define AR5416_DEVID_PCIE      0x0024
-#define AR9160_DEVID_PCI       0x0027
-#define AR9280_DEVID_PCI       0x0029
-#define AR9280_DEVID_PCIE      0x002a
-#define AR9285_DEVID_PCIE      0x002b
-
-#define AR5416_AR9100_DEVID    0x000b
-
-#define        AR_SUBVENDOR_ID_NOG     0x0e11
-#define AR_SUBVENDOR_ID_NEW_A  0x7065
-
-#define ATH9K_TXERR_XRETRY         0x01
-#define ATH9K_TXERR_FILT           0x02
-#define ATH9K_TXERR_FIFO           0x04
-#define ATH9K_TXERR_XTXOP          0x08
-#define ATH9K_TXERR_TIMER_EXPIRED  0x10
-
-#define ATH9K_TX_BA                0x01
-#define ATH9K_TX_PWRMGMT           0x02
-#define ATH9K_TX_DESC_CFG_ERR      0x04
-#define ATH9K_TX_DATA_UNDERRUN     0x08
-#define ATH9K_TX_DELIM_UNDERRUN    0x10
-#define ATH9K_TX_SW_ABORTED        0x40
-#define ATH9K_TX_SW_FILTERED       0x80
-
-#define NBBY    8
-
-struct ath_tx_status {
-       u32 ts_tstamp;
-       u16 ts_seqnum;
-       u8 ts_status;
-       u8 ts_ratecode;
-       u8 ts_rateindex;
-       int8_t ts_rssi;
-       u8 ts_shortretry;
-       u8 ts_longretry;
-       u8 ts_virtcol;
-       u8 ts_antenna;
-       u8 ts_flags;
-       int8_t ts_rssi_ctl0;
-       int8_t ts_rssi_ctl1;
-       int8_t ts_rssi_ctl2;
-       int8_t ts_rssi_ext0;
-       int8_t ts_rssi_ext1;
-       int8_t ts_rssi_ext2;
-       u8 pad[3];
-       u32 ba_low;
-       u32 ba_high;
-       u32 evm0;
-       u32 evm1;
-       u32 evm2;
-};
-
-struct ath_rx_status {
-       u32 rs_tstamp;
-       u16 rs_datalen;
-       u8 rs_status;
-       u8 rs_phyerr;
-       int8_t rs_rssi;
-       u8 rs_keyix;
-       u8 rs_rate;
-       u8 rs_antenna;
-       u8 rs_more;
-       int8_t rs_rssi_ctl0;
-       int8_t rs_rssi_ctl1;
-       int8_t rs_rssi_ctl2;
-       int8_t rs_rssi_ext0;
-       int8_t rs_rssi_ext1;
-       int8_t rs_rssi_ext2;
-       u8 rs_isaggr;
-       u8 rs_moreaggr;
-       u8 rs_num_delims;
-       u8 rs_flags;
-       u32 evm0;
-       u32 evm1;
-       u32 evm2;
-};
-
-#define ATH9K_RXERR_CRC           0x01
-#define ATH9K_RXERR_PHY           0x02
-#define ATH9K_RXERR_FIFO          0x04
-#define ATH9K_RXERR_DECRYPT       0x08
-#define ATH9K_RXERR_MIC           0x10
-
-#define ATH9K_RX_MORE             0x01
-#define ATH9K_RX_MORE_AGGR        0x02
-#define ATH9K_RX_GI               0x04
-#define ATH9K_RX_2040             0x08
-#define ATH9K_RX_DELIM_CRC_PRE    0x10
-#define ATH9K_RX_DELIM_CRC_POST   0x20
-#define ATH9K_RX_DECRYPT_BUSY     0x40
-
-#define ATH9K_RXKEYIX_INVALID  ((u8)-1)
-#define ATH9K_TXKEYIX_INVALID  ((u32)-1)
-
-struct ath_desc {
-       u32 ds_link;
-       u32 ds_data;
-       u32 ds_ctl0;
-       u32 ds_ctl1;
-       u32 ds_hw[20];
-       union {
-               struct ath_tx_status tx;
-               struct ath_rx_status rx;
-               void *stats;
-       } ds_us;
-       void *ds_vdata;
-} __packed;
-
-#define        ds_txstat       ds_us.tx
-#define        ds_rxstat       ds_us.rx
-#define ds_stat                ds_us.stats
-
-#define ATH9K_TXDESC_CLRDMASK          0x0001
-#define ATH9K_TXDESC_NOACK             0x0002
-#define ATH9K_TXDESC_RTSENA            0x0004
-#define ATH9K_TXDESC_CTSENA            0x0008
-/* ATH9K_TXDESC_INTREQ forces a tx interrupt to be generated for
- * the descriptor its marked on.  We take a tx interrupt to reap
- * descriptors when the h/w hits an EOL condition or
- * when the descriptor is specifically marked to generate
- * an interrupt with this flag. Descriptors should be
- * marked periodically to insure timely replenishing of the
- * supply needed for sending frames. Defering interrupts
- * reduces system load and potentially allows more concurrent
- * work to be done but if done to aggressively can cause
- * senders to backup. When the hardware queue is left too
- * large rate control information may also be too out of
- * date. An Alternative for this is TX interrupt mitigation
- * but this needs more testing. */
-#define ATH9K_TXDESC_INTREQ            0x0010
-#define ATH9K_TXDESC_VEOL              0x0020
-#define ATH9K_TXDESC_EXT_ONLY          0x0040
-#define ATH9K_TXDESC_EXT_AND_CTL       0x0080
-#define ATH9K_TXDESC_VMF               0x0100
-#define ATH9K_TXDESC_FRAG_IS_ON        0x0200
-#define ATH9K_TXDESC_CAB               0x0400
-
-#define ATH9K_RXDESC_INTREQ            0x0020
-
-enum wireless_mode {
-       ATH9K_MODE_11A = 0,
-       ATH9K_MODE_11B = 2,
-       ATH9K_MODE_11G = 3,
-       ATH9K_MODE_11NA_HT20 = 6,
-       ATH9K_MODE_11NG_HT20 = 7,
-       ATH9K_MODE_11NA_HT40PLUS = 8,
-       ATH9K_MODE_11NA_HT40MINUS = 9,
-       ATH9K_MODE_11NG_HT40PLUS = 10,
-       ATH9K_MODE_11NG_HT40MINUS = 11,
-       ATH9K_MODE_MAX
-};
-
-enum ath9k_hw_caps {
-       ATH9K_HW_CAP_CHAN_SPREAD                = BIT(0),
-       ATH9K_HW_CAP_MIC_AESCCM                 = BIT(1),
-       ATH9K_HW_CAP_MIC_CKIP                   = BIT(2),
-       ATH9K_HW_CAP_MIC_TKIP                   = BIT(3),
-       ATH9K_HW_CAP_CIPHER_AESCCM              = BIT(4),
-       ATH9K_HW_CAP_CIPHER_CKIP                = BIT(5),
-       ATH9K_HW_CAP_CIPHER_TKIP                = BIT(6),
-       ATH9K_HW_CAP_VEOL                       = BIT(7),
-       ATH9K_HW_CAP_BSSIDMASK                  = BIT(8),
-       ATH9K_HW_CAP_MCAST_KEYSEARCH            = BIT(9),
-       ATH9K_HW_CAP_CHAN_HALFRATE              = BIT(10),
-       ATH9K_HW_CAP_CHAN_QUARTERRATE           = BIT(11),
-       ATH9K_HW_CAP_HT                         = BIT(12),
-       ATH9K_HW_CAP_GTT                        = BIT(13),
-       ATH9K_HW_CAP_FASTCC                     = BIT(14),
-       ATH9K_HW_CAP_RFSILENT                   = BIT(15),
-       ATH9K_HW_CAP_WOW                        = BIT(16),
-       ATH9K_HW_CAP_CST                        = BIT(17),
-       ATH9K_HW_CAP_ENHANCEDPM                 = BIT(18),
-       ATH9K_HW_CAP_AUTOSLEEP                  = BIT(19),
-       ATH9K_HW_CAP_4KB_SPLITTRANS             = BIT(20),
-       ATH9K_HW_CAP_WOW_MATCHPATTERN_EXACT     = BIT(21),
-};
-
-enum ath9k_capability_type {
-       ATH9K_CAP_CIPHER = 0,
-       ATH9K_CAP_TKIP_MIC,
-       ATH9K_CAP_TKIP_SPLIT,
-       ATH9K_CAP_PHYCOUNTERS,
-       ATH9K_CAP_DIVERSITY,
-       ATH9K_CAP_TXPOW,
-       ATH9K_CAP_PHYDIAG,
-       ATH9K_CAP_MCAST_KEYSRCH,
-       ATH9K_CAP_TSF_ADJUST,
-       ATH9K_CAP_WME_TKIPMIC,
-       ATH9K_CAP_RFSILENT,
-       ATH9K_CAP_ANT_CFG_2GHZ,
-       ATH9K_CAP_ANT_CFG_5GHZ
-};
-
-struct ath9k_hw_capabilities {
-       u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */
-       DECLARE_BITMAP(wireless_modes, ATH9K_MODE_MAX); /* ATH9K_MODE_* */
-       u16 total_queues;
-       u16 keycache_size;
-       u16 low_5ghz_chan, high_5ghz_chan;
-       u16 low_2ghz_chan, high_2ghz_chan;
-       u16 num_mr_retries;
-       u16 rts_aggr_limit;
-       u8 tx_chainmask;
-       u8 rx_chainmask;
-       u16 tx_triglevel_max;
-       u16 reg_cap;
-       u8 num_gpio_pins;
-       u8 num_antcfg_2ghz;
-       u8 num_antcfg_5ghz;
-};
-
-struct ath9k_ops_config {
-       int dma_beacon_response_time;
-       int sw_beacon_response_time;
-       int additional_swba_backoff;
-       int ack_6mb;
-       int cwm_ignore_extcca;
-       u8 pcie_powersave_enable;
-       u8 pcie_l1skp_enable;
-       u8 pcie_clock_req;
-       u32 pcie_waen;
-       int pcie_power_reset;
-       u8 pcie_restore;
-       u8 analog_shiftreg;
-       u8 ht_enable;
-       u32 ofdm_trig_low;
-       u32 ofdm_trig_high;
-       u32 cck_trig_high;
-       u32 cck_trig_low;
-       u32 enable_ani;
-       u8 noise_immunity_level;
-       u32 ofdm_weaksignal_det;
-       u32 cck_weaksignal_thr;
-       u8 spur_immunity_level;
-       u8 firstep_level;
-       int8_t rssi_thr_high;
-       int8_t rssi_thr_low;
-       u16 diversity_control;
-       u16 antenna_switch_swap;
-       int serialize_regmode;
-       int intr_mitigation;
-#define SPUR_DISABLE           0
-#define SPUR_ENABLE_IOCTL      1
-#define SPUR_ENABLE_EEPROM     2
-#define AR_EEPROM_MODAL_SPURS   5
-#define AR_SPUR_5413_1         1640
-#define AR_SPUR_5413_2         1200
-#define AR_NO_SPUR             0x8000
-#define AR_BASE_FREQ_2GHZ      2300
-#define AR_BASE_FREQ_5GHZ      4900
-#define AR_SPUR_FEEQ_BOUND_HT40 19
-#define AR_SPUR_FEEQ_BOUND_HT20 10
-       int spurmode;
-       u16 spurchans[AR_EEPROM_MODAL_SPURS][2];
-};
-
-enum ath9k_tx_queue {
-       ATH9K_TX_QUEUE_INACTIVE = 0,
-       ATH9K_TX_QUEUE_DATA,
-       ATH9K_TX_QUEUE_BEACON,
-       ATH9K_TX_QUEUE_CAB,
-       ATH9K_TX_QUEUE_UAPSD,
-       ATH9K_TX_QUEUE_PSPOLL
-};
-
-#define        ATH9K_NUM_TX_QUEUES 10
-
-enum ath9k_tx_queue_subtype {
-       ATH9K_WME_AC_BK = 0,
-       ATH9K_WME_AC_BE,
-       ATH9K_WME_AC_VI,
-       ATH9K_WME_AC_VO,
-       ATH9K_WME_UPSD
-};
-
-enum ath9k_tx_queue_flags {
-       TXQ_FLAG_TXOKINT_ENABLE = 0x0001,
-       TXQ_FLAG_TXERRINT_ENABLE = 0x0001,
-       TXQ_FLAG_TXDESCINT_ENABLE = 0x0002,
-       TXQ_FLAG_TXEOLINT_ENABLE = 0x0004,
-       TXQ_FLAG_TXURNINT_ENABLE = 0x0008,
-       TXQ_FLAG_BACKOFF_DISABLE = 0x0010,
-       TXQ_FLAG_COMPRESSION_ENABLE = 0x0020,
-       TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE = 0x0040,
-       TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE = 0x0080,
-};
-
-#define ATH9K_TXQ_USEDEFAULT ((u32) -1)
-
-#define ATH9K_DECOMP_MASK_SIZE     128
-#define ATH9K_READY_TIME_LO_BOUND  50
-#define ATH9K_READY_TIME_HI_BOUND  96
-
-enum ath9k_pkt_type {
-       ATH9K_PKT_TYPE_NORMAL = 0,
-       ATH9K_PKT_TYPE_ATIM,
-       ATH9K_PKT_TYPE_PSPOLL,
-       ATH9K_PKT_TYPE_BEACON,
-       ATH9K_PKT_TYPE_PROBE_RESP,
-       ATH9K_PKT_TYPE_CHIRP,
-       ATH9K_PKT_TYPE_GRP_POLL,
-};
+#include <linux/etherdevice.h>
+#include <linux/device.h>
+#include <net/mac80211.h>
+#include <linux/leds.h>
+#include <linux/rfkill.h>
+
+#include "hw.h"
+#include "rc.h"
+#include "debug.h"
+
+struct ath_node;
+
+/* Macro to expand scalars to 64-bit objects */
+
+#define        ito64(x) (sizeof(x) == 8) ?                     \
+       (((unsigned long long int)(x)) & (0xff)) :      \
+       (sizeof(x) == 16) ?                             \
+       (((unsigned long long int)(x)) & 0xffff) :      \
+       ((sizeof(x) == 32) ?                            \
+        (((unsigned long long int)(x)) & 0xffffffff) : \
+        (unsigned long long int)(x))
+
+/* increment with wrap-around */
+#define INCR(_l, _sz)   do {                   \
+               (_l)++;                         \
+               (_l) &= ((_sz) - 1);            \
+       } while (0)
+
+/* decrement with wrap-around */
+#define DECR(_l,  _sz)  do {                   \
+               (_l)--;                         \
+               (_l) &= ((_sz) - 1);            \
+       } while (0)
+
+#define A_MAX(a, b) ((a) > (b) ? (a) : (b))
+
+#define ASSERT(exp) do {                       \
+               if (unlikely(!(exp))) {         \
+                       BUG();                  \
+               }                               \
+       } while (0)
+
+#define TSF_TO_TU(_h,_l) \
+       ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
+
+#define        ATH_TXQ_SETUP(sc, i)        ((sc)->tx.txqsetup & (1<<i))
+
+static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
+struct ath_config {
+       u32 ath_aggr_prot;
+       u16 txpowlimit;
+       u8 cabqReadytime;
+       u8 swBeaconProcess;
+};
+
+/*************************/
+/* Descriptor Management */
+/*************************/
+
+#define ATH_TXBUF_RESET(_bf) do {                              \
+               (_bf)->bf_status = 0;                           \
+               (_bf)->bf_lastbf = NULL;                        \
+               (_bf)->bf_next = NULL;                          \
+               memset(&((_bf)->bf_state), 0,                   \
+                      sizeof(struct ath_buf_state));           \
+       } while (0)
+
+/**
+ * enum buffer_type - Buffer type flags
+ *
+ * @BUF_HT: Send this buffer using HT capabilities
+ * @BUF_AMPDU: This buffer is an ampdu, as part of an aggregate (during TX)
+ * @BUF_AGGR: Indicates whether the buffer can be aggregated
+ *     (used in aggregation scheduling)
+ * @BUF_RETRY: Indicates whether the buffer is retried
+ * @BUF_XRETRY: To denote excessive retries of the buffer
+ */
+enum buffer_type {
+       BUF_HT                  = BIT(1),
+       BUF_AMPDU               = BIT(2),
+       BUF_AGGR                = BIT(3),
+       BUF_RETRY               = BIT(4),
+       BUF_XRETRY              = BIT(5),
+};
+
+struct ath_buf_state {
+       int bfs_nframes;
+       u16 bfs_al;
+       u16 bfs_frmlen;
+       int bfs_seqno;
+       int bfs_tidno;
+       int bfs_retries;
+       u32 bf_type;
+       u32 bfs_keyix;
+       enum ath9k_key_type bfs_keytype;
+};
+
+#define bf_nframes             bf_state.bfs_nframes
+#define bf_al                  bf_state.bfs_al
+#define bf_frmlen              bf_state.bfs_frmlen
+#define bf_retries             bf_state.bfs_retries
+#define bf_seqno               bf_state.bfs_seqno
+#define bf_tidno               bf_state.bfs_tidno
+#define bf_keyix                bf_state.bfs_keyix
+#define bf_keytype             bf_state.bfs_keytype
+#define bf_isht(bf)            (bf->bf_state.bf_type & BUF_HT)
+#define bf_isampdu(bf)         (bf->bf_state.bf_type & BUF_AMPDU)
+#define bf_isaggr(bf)          (bf->bf_state.bf_type & BUF_AGGR)
+#define bf_isretried(bf)       (bf->bf_state.bf_type & BUF_RETRY)
+#define bf_isxretried(bf)      (bf->bf_state.bf_type & BUF_XRETRY)
+
+struct ath_buf {
+       struct list_head list;
+       struct ath_buf *bf_lastbf;      /* last buf of this unit (a frame or
+                                          an aggregate) */
+       struct ath_buf *bf_next;        /* next subframe in the aggregate */
+       void *bf_mpdu;                  /* enclosing frame structure */
+       struct ath_desc *bf_desc;       /* virtual addr of desc */
+       dma_addr_t bf_daddr;            /* physical addr of desc */
+       dma_addr_t bf_buf_addr;         /* physical addr of data buffer */
+       u32 bf_status;
+       u16 bf_flags;
+       struct ath_buf_state bf_state;
+       dma_addr_t bf_dmacontext;
+};
+
+#define ATH_RXBUF_RESET(_bf)    ((_bf)->bf_status = 0)
+#define ATH_BUFSTATUS_STALE     0x00000002
+
+struct ath_descdma {
+       const char *dd_name;
+       struct ath_desc *dd_desc;
+       dma_addr_t dd_desc_paddr;
+       u32 dd_desc_len;
+       struct ath_buf *dd_bufptr;
+       dma_addr_t dd_dmacontext;
+};
+
+int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
+                     struct list_head *head, const char *name,
+                     int nbuf, int ndesc);
+void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd,
+                        struct list_head *head);
+
+/***********/
+/* RX / TX */
+/***********/
+
+#define ATH_MAX_ANTENNA         3
+#define ATH_RXBUF               512
+#define WME_NUM_TID             16
+#define ATH_TXBUF               512
+#define ATH_TXMAXTRY            13
+#define ATH_11N_TXMAXTRY        10
+#define ATH_MGT_TXMAXTRY        4
+#define WME_BA_BMP_SIZE         64
+#define WME_MAX_BA              WME_BA_BMP_SIZE
+#define ATH_TID_MAX_BUFS        (2 * WME_MAX_BA)
+
+#define TID_TO_WME_AC(_tid)                            \
+       ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
+        (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
+        (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
+        WME_AC_VO)
+
+#define WME_AC_BE   0
+#define WME_AC_BK   1
+#define WME_AC_VI   2
+#define WME_AC_VO   3
+#define WME_NUM_AC  4
+
+#define ADDBA_EXCHANGE_ATTEMPTS    10
+#define ATH_AGGR_DELIM_SZ          4
+#define ATH_AGGR_MINPLEN           256 /* in bytes, minimum packet length */
+/* number of delimiters for encryption padding */
+#define ATH_AGGR_ENCRYPTDELIM      10
+/* minimum h/w qdepth to be sustained to maximize aggregation */
+#define ATH_AGGR_MIN_QDEPTH        2
+#define ATH_AMPDU_SUBFRAME_DEFAULT 32
+#define ATH_AMPDU_LIMIT_MAX        (64 * 1024 - 1)
+#define ATH_AMPDU_LIMIT_DEFAULT    ATH_AMPDU_LIMIT_MAX
+
+#define IEEE80211_SEQ_SEQ_SHIFT    4
+#define IEEE80211_SEQ_MAX          4096
+#define IEEE80211_MIN_AMPDU_BUF    0x8
+#define IEEE80211_HTCAP_MAXRXAMPDU_FACTOR 13
+#define IEEE80211_WEP_IVLEN        3
+#define IEEE80211_WEP_KIDLEN       1
+#define IEEE80211_WEP_CRCLEN       4
+#define IEEE80211_MAX_MPDU_LEN     (3840 + FCS_LEN +           \
+                                   (IEEE80211_WEP_IVLEN +      \
+                                    IEEE80211_WEP_KIDLEN +     \
+                                    IEEE80211_WEP_CRCLEN))
+
+/* return whether a bit at index _n in bitmap _bm is set
+ * _sz is the size of the bitmap  */
+#define ATH_BA_ISSET(_bm, _n)  (((_n) < (WME_BA_BMP_SIZE)) &&          \
+                               ((_bm)[(_n) >> 5] & (1 << ((_n) & 31))))
+
+/* return block-ack bitmap index given sequence and starting sequence */
+#define ATH_BA_INDEX(_st, _seq) (((_seq) - (_st)) & (IEEE80211_SEQ_MAX - 1))
+
+/* returns delimiter padding required given the packet length */
+#define ATH_AGGR_GET_NDELIM(_len)                                      \
+       (((((_len) + ATH_AGGR_DELIM_SZ) < ATH_AGGR_MINPLEN) ?           \
+         (ATH_AGGR_MINPLEN - (_len) - ATH_AGGR_DELIM_SZ) : 0) >> 2)
+
+#define BAW_WITHIN(_start, _bawsz, _seqno) \
+       ((((_seqno) - (_start)) & 4095) < (_bawsz))
+
+#define ATH_DS_BA_SEQ(_ds)         ((_ds)->ds_us.tx.ts_seqnum)
+#define ATH_DS_BA_BITMAP(_ds)      (&(_ds)->ds_us.tx.ba_low)
+#define ATH_DS_TX_BA(_ds)          ((_ds)->ds_us.tx.ts_flags & ATH9K_TX_BA)
+#define ATH_AN_2_TID(_an, _tidno)  (&(_an)->tid[(_tidno)])
+
+enum ATH_AGGR_STATUS {
+       ATH_AGGR_DONE,
+       ATH_AGGR_BAW_CLOSED,
+       ATH_AGGR_LIMITED,
+};
+
+struct ath_txq {
+       u32 axq_qnum;
+       u32 *axq_link;
+       struct list_head axq_q;
+       spinlock_t axq_lock;
+       u32 axq_depth;
+       u8 axq_aggr_depth;
+       u32 axq_totalqueued;
+       bool stopped;
+       struct ath_buf *axq_linkbuf;
+
+       /* first desc of the last descriptor that contains CTS */
+       struct ath_desc *axq_lastdsWithCTS;
+
+       /* final desc of the gating desc that determines whether
+          lastdsWithCTS has been DMA'ed or not */
+       struct ath_desc *axq_gatingds;
+
+       struct list_head axq_acq;
+};
+
+#define AGGR_CLEANUP         BIT(1)
+#define AGGR_ADDBA_COMPLETE  BIT(2)
+#define AGGR_ADDBA_PROGRESS  BIT(3)
+
+struct ath_atx_tid {
+       struct list_head list;
+       struct list_head buf_q;
+       struct ath_node *an;
+       struct ath_atx_ac *ac;
+       struct ath_buf *tx_buf[ATH_TID_MAX_BUFS];
+       u16 seq_start;
+       u16 seq_next;
+       u16 baw_size;
+       int tidno;
+       int baw_head;   /* first un-acked tx buffer */
+       int baw_tail;   /* next unused tx buffer slot */
+       int sched;
+       int paused;
+       u8 state;
+       int addba_exchangeattempts;
+};
+
+struct ath_atx_ac {
+       int sched;
+       int qnum;
+       struct list_head list;
+       struct list_head tid_q;
+};
+
+struct ath_tx_control {
+       struct ath_txq *txq;
+       int if_id;
+};
+
+struct ath_xmit_status {
+       int retries;
+       int flags;
+#define ATH_TX_ERROR        0x01
+#define ATH_TX_XRETRY       0x02
+#define ATH_TX_BAR          0x04
+};
+
+/* All RSSI values are noise floor adjusted */
+struct ath_tx_stat {
+       int rssi;
+       int rssictl[ATH_MAX_ANTENNA];
+       int rssiextn[ATH_MAX_ANTENNA];
+       int rateieee;
+       int rateKbps;
+       int ratecode;
+       int flags;
+       u32 airtime;    /* time on air per final tx rate */
+};
+
+struct aggr_rifs_param {
+       int param_max_frames;
+       int param_max_len;
+       int param_rl;
+       int param_al;
+       struct ath_rc_series *param_rcs;
+};
+
+struct ath_node {
+       struct ath_softc *an_sc;
+       struct ath_atx_tid tid[WME_NUM_TID];
+       struct ath_atx_ac ac[WME_NUM_AC];
+       u16 maxampdu;
+       u8 mpdudensity;
+};
+
+struct ath_tx {
+       u16 seq_no;
+       u32 txqsetup;
+       int hwq_map[ATH9K_WME_AC_VO+1];
+       spinlock_t txbuflock;
+       struct list_head txbuf;
+       struct ath_txq txq[ATH9K_NUM_TX_QUEUES];
+       struct ath_descdma txdma;
+};
+
+struct ath_rx {
+       u8 defant;
+       u8 rxotherant;
+       u32 *rxlink;
+       int bufsize;
+       unsigned int rxfilter;
+       spinlock_t rxflushlock;
+       spinlock_t rxbuflock;
+       struct list_head rxbuf;
+       struct ath_descdma rxdma;
+};
+
+int ath_startrecv(struct ath_softc *sc);
+bool ath_stoprecv(struct ath_softc *sc);
+void ath_flushrecv(struct ath_softc *sc);
+u32 ath_calcrxfilter(struct ath_softc *sc);
+int ath_rx_init(struct ath_softc *sc, int nbufs);
+void ath_rx_cleanup(struct ath_softc *sc);
+int ath_rx_tasklet(struct ath_softc *sc, int flush);
+struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype);
+void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq);
+int ath_tx_setup(struct ath_softc *sc, int haltype);
+void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx);
+void ath_draintxq(struct ath_softc *sc,
+                    struct ath_txq *txq, bool retry_tx);
+void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an);
+void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an);
+void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq);
+int ath_tx_init(struct ath_softc *sc, int nbufs);
+int ath_tx_cleanup(struct ath_softc *sc);
+struct ath_txq *ath_test_get_txq(struct ath_softc *sc, struct sk_buff *skb);
+int ath_txq_update(struct ath_softc *sc, int qnum,
+                  struct ath9k_tx_queue_info *q);
+int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb,
+                struct ath_tx_control *txctl);
+void ath_tx_tasklet(struct ath_softc *sc);
+void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb);
+bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno);
+int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
+                     u16 tid, u16 *ssn);
+int ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
+void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
+
+/********/
+/* VIFs */
+/********/
 
-struct ath9k_tx_queue_info {
-       u32 tqi_ver;
-       enum ath9k_tx_queue tqi_type;
-       enum ath9k_tx_queue_subtype tqi_subtype;
-       enum ath9k_tx_queue_flags tqi_qflags;
-       u32 tqi_priority;
-       u32 tqi_aifs;
-       u32 tqi_cwmin;
-       u32 tqi_cwmax;
-       u16 tqi_shretry;
-       u16 tqi_lgretry;
-       u32 tqi_cbrPeriod;
-       u32 tqi_cbrOverflowLimit;
-       u32 tqi_burstTime;
-       u32 tqi_readyTime;
-       u32 tqi_physCompBuf;
-       u32 tqi_intFlags;
-};
+/*
+ * Define the scheme that we select MAC address for multiple
+ * BSS on the same radio. The very first VIF will just use the MAC
+ * address from the EEPROM. For the next 3 VIFs, we set the
+ * U/L bit (bit 1) in MAC address, and use the next two bits as the
+ * index of the VIF.
+ */
 
-enum ath9k_rx_filter {
-       ATH9K_RX_FILTER_UCAST = 0x00000001,
-       ATH9K_RX_FILTER_MCAST = 0x00000002,
-       ATH9K_RX_FILTER_BCAST = 0x00000004,
-       ATH9K_RX_FILTER_CONTROL = 0x00000008,
-       ATH9K_RX_FILTER_BEACON = 0x00000010,
-       ATH9K_RX_FILTER_PROM = 0x00000020,
-       ATH9K_RX_FILTER_PROBEREQ = 0x00000080,
-       ATH9K_RX_FILTER_PSPOLL = 0x00004000,
-       ATH9K_RX_FILTER_PHYERR = 0x00000100,
-       ATH9K_RX_FILTER_PHYRADAR = 0x00002000,
-};
+#define ATH_SET_VIF_BSSID_MASK(bssid_mask) \
+       ((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))
 
-enum ath9k_int {
-       ATH9K_INT_RX = 0x00000001,
-       ATH9K_INT_RXDESC = 0x00000002,
-       ATH9K_INT_RXNOFRM = 0x00000008,
-       ATH9K_INT_RXEOL = 0x00000010,
-       ATH9K_INT_RXORN = 0x00000020,
-       ATH9K_INT_TX = 0x00000040,
-       ATH9K_INT_TXDESC = 0x00000080,
-       ATH9K_INT_TIM_TIMER = 0x00000100,
-       ATH9K_INT_TXURN = 0x00000800,
-       ATH9K_INT_MIB = 0x00001000,
-       ATH9K_INT_RXPHY = 0x00004000,
-       ATH9K_INT_RXKCM = 0x00008000,
-       ATH9K_INT_SWBA = 0x00010000,
-       ATH9K_INT_BMISS = 0x00040000,
-       ATH9K_INT_BNR = 0x00100000,
-       ATH9K_INT_TIM = 0x00200000,
-       ATH9K_INT_DTIM = 0x00400000,
-       ATH9K_INT_DTIMSYNC = 0x00800000,
-       ATH9K_INT_GPIO = 0x01000000,
-       ATH9K_INT_CABEND = 0x02000000,
-       ATH9K_INT_CST = 0x10000000,
-       ATH9K_INT_GTT = 0x20000000,
-       ATH9K_INT_FATAL = 0x40000000,
-       ATH9K_INT_GLOBAL = 0x80000000,
-       ATH9K_INT_BMISC = ATH9K_INT_TIM |
-               ATH9K_INT_DTIM |
-               ATH9K_INT_DTIMSYNC |
-               ATH9K_INT_CABEND,
-       ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM |
-               ATH9K_INT_RXDESC |
-               ATH9K_INT_RXEOL |
-               ATH9K_INT_RXORN |
-               ATH9K_INT_TXURN |
-               ATH9K_INT_TXDESC |
-               ATH9K_INT_MIB |
-               ATH9K_INT_RXPHY |
-               ATH9K_INT_RXKCM |
-               ATH9K_INT_SWBA |
-               ATH9K_INT_BMISS |
-               ATH9K_INT_GPIO,
-       ATH9K_INT_NOCARD = 0xffffffff
+struct ath_vif {
+       int av_bslot;
+       enum nl80211_iftype av_opmode;
+       struct ath_buf *av_bcbuf;
+       struct ath_tx_control av_btxctl;
 };
 
-#define ATH9K_RATESERIES_RTS_CTS  0x0001
-#define ATH9K_RATESERIES_2040     0x0002
-#define ATH9K_RATESERIES_HALFGI   0x0004
+/*******************/
+/* Beacon Handling */
+/*******************/
 
-struct ath9k_11n_rate_series {
-       u32 Tries;
-       u32 Rate;
-       u32 PktDuration;
-       u32 ChSel;
-       u32 RateFlags;
-};
+/*
+ * Regardless of the number of beacons we stagger, (i.e. regardless of the
+ * number of BSSIDs) if a given beacon does not go out even after waiting this
+ * number of beacon intervals, the game's up.
+ */
+#define BSTUCK_THRESH                  (9 * ATH_BCBUF)
+#define        ATH_BCBUF                       1
+#define ATH_DEFAULT_BINTVAL            100 /* TU */
+#define ATH_DEFAULT_BMISS_LIMIT        10
+#define IEEE80211_MS_TO_TU(x)           (((x) * 1000) / 1024)
+
+struct ath_beacon_config {
+       u16 beacon_interval;
+       u16 listen_interval;
+       u16 dtim_period;
+       u16 bmiss_timeout;
+       u8 dtim_count;
+       u8 tim_offset;
+       union {
+               u64 last_tsf;
+               u8 last_tstamp[8];
+       } u; /* last received beacon/probe response timestamp of this BSS. */
+};
+
+struct ath_beacon {
+       enum {
+               OK,             /* no change needed */
+               UPDATE,         /* update pending */
+               COMMIT          /* beacon sent, commit change */
+       } updateslot;           /* slot time update fsm */
+
+       u32 beaconq;
+       u32 bmisscnt;
+       u32 ast_be_xmit;
+       u64 bc_tstamp;
+       int bslot[ATH_BCBUF];
+       int slottime;
+       int slotupdate;
+       struct ath9k_tx_queue_info beacon_qi;
+       struct ath_descdma bdma;
+       struct ath_txq *cabq;
+       struct list_head bbuf;
+};
+
+void ath9k_beacon_tasklet(unsigned long data);
+void ath_beacon_config(struct ath_softc *sc, int if_id);
+int ath_beaconq_setup(struct ath_hw *ah);
+int ath_beacon_alloc(struct ath_softc *sc, int if_id);
+void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp);
+void ath_beacon_sync(struct ath_softc *sc, int if_id);
+
+/*******/
+/* ANI */
+/*******/
 
-#define CHANNEL_CW_INT    0x00002
-#define CHANNEL_CCK       0x00020
-#define CHANNEL_OFDM      0x00040
-#define CHANNEL_2GHZ      0x00080
-#define CHANNEL_5GHZ      0x00100
-#define CHANNEL_PASSIVE   0x00200
-#define CHANNEL_DYN       0x00400
-#define CHANNEL_HALF      0x04000
-#define CHANNEL_QUARTER   0x08000
-#define CHANNEL_HT20      0x10000
-#define CHANNEL_HT40PLUS  0x20000
-#define CHANNEL_HT40MINUS 0x40000
-
-#define CHANNEL_INTERFERENCE    0x01
-#define CHANNEL_DFS             0x02
-#define CHANNEL_4MS_LIMIT       0x04
-#define CHANNEL_DFS_CLEAR       0x08
-#define CHANNEL_DISALLOW_ADHOC  0x10
-#define CHANNEL_PER_11D_ADHOC   0x20
-
-#define CHANNEL_A           (CHANNEL_5GHZ|CHANNEL_OFDM)
-#define CHANNEL_B           (CHANNEL_2GHZ|CHANNEL_CCK)
-#define CHANNEL_G           (CHANNEL_2GHZ|CHANNEL_OFDM)
-#define CHANNEL_G_HT20      (CHANNEL_2GHZ|CHANNEL_HT20)
-#define CHANNEL_A_HT20      (CHANNEL_5GHZ|CHANNEL_HT20)
-#define CHANNEL_G_HT40PLUS  (CHANNEL_2GHZ|CHANNEL_HT40PLUS)
-#define CHANNEL_G_HT40MINUS (CHANNEL_2GHZ|CHANNEL_HT40MINUS)
-#define CHANNEL_A_HT40PLUS  (CHANNEL_5GHZ|CHANNEL_HT40PLUS)
-#define CHANNEL_A_HT40MINUS (CHANNEL_5GHZ|CHANNEL_HT40MINUS)
-#define CHANNEL_ALL                            \
-       (CHANNEL_OFDM|                          \
-        CHANNEL_CCK|                           \
-        CHANNEL_2GHZ |                         \
-        CHANNEL_5GHZ |                         \
-        CHANNEL_HT20 |                         \
-        CHANNEL_HT40PLUS |                     \
-        CHANNEL_HT40MINUS)
-
-struct ath9k_channel {
-       u16 channel;
-       u32 channelFlags;
-       u8 privFlags;
-       int8_t maxRegTxPower;
-       int8_t maxTxPower;
-       int8_t minTxPower;
-       u32 chanmode;
-       int32_t CalValid;
-       bool oneTimeCalsDone;
-       int8_t iCoff;
-       int8_t qCoff;
-       int16_t rawNoiseFloor;
-       int8_t antennaMax;
-       u32 regDmnFlags;
-       u32 conformanceTestLimit[3]; /* 0:11a, 1: 11b, 2:11g */
-#ifdef ATH_NF_PER_CHAN
-       struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
-#endif
-};
+/* ANI values for STA only.
+   FIXME: Add appropriate values for AP later */
 
-#define IS_CHAN_A(_c) ((((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) || \
-       (((_c)->channelFlags & CHANNEL_A_HT20) == CHANNEL_A_HT20) || \
-       (((_c)->channelFlags & CHANNEL_A_HT40PLUS) == CHANNEL_A_HT40PLUS) || \
-       (((_c)->channelFlags & CHANNEL_A_HT40MINUS) == CHANNEL_A_HT40MINUS))
-#define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \
-       (((_c)->channelFlags & CHANNEL_G_HT20) == CHANNEL_G_HT20) || \
-       (((_c)->channelFlags & CHANNEL_G_HT40PLUS) == CHANNEL_G_HT40PLUS) || \
-       (((_c)->channelFlags & CHANNEL_G_HT40MINUS) == CHANNEL_G_HT40MINUS))
-#define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0)
-#define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0)
-#define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0)
-#define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0)
-#define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0)
-#define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0)
-
-/* These macros check chanmode and not channelFlags */
-#define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B)
-#define IS_CHAN_HT20(_c) (((_c)->chanmode == CHANNEL_A_HT20) ||        \
-                         ((_c)->chanmode == CHANNEL_G_HT20))
-#define IS_CHAN_HT40(_c) (((_c)->chanmode == CHANNEL_A_HT40PLUS) ||    \
-                         ((_c)->chanmode == CHANNEL_A_HT40MINUS) ||    \
-                         ((_c)->chanmode == CHANNEL_G_HT40PLUS) ||     \
-                         ((_c)->chanmode == CHANNEL_G_HT40MINUS))
-#define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c)))
-
-#define IS_CHAN_IN_PUBLIC_SAFETY_BAND(_c) ((_c) > 4940 && (_c) < 4990)
-#define IS_CHAN_A_5MHZ_SPACED(_c)                      \
-       ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) &&  \
-        (((_c)->channel % 20) != 0) &&                 \
-        (((_c)->channel % 10) != 0))
-
-struct ath9k_keyval {
-       u8 kv_type;
-       u8 kv_pad;
-       u16 kv_len;
-       u8 kv_val[16];
-       u8 kv_mic[8];
-       u8 kv_txmic[8];
-};
+#define ATH_ANI_POLLINTERVAL    100     /* 100 milliseconds between ANI poll */
+#define ATH_SHORT_CALINTERVAL   1000    /* 1 second between calibrations */
+#define ATH_LONG_CALINTERVAL    30000   /* 30 seconds between calibrations */
+#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes between calibrations */
 
-enum ath9k_key_type {
-       ATH9K_KEY_TYPE_CLEAR,
-       ATH9K_KEY_TYPE_WEP,
-       ATH9K_KEY_TYPE_AES,
-       ATH9K_KEY_TYPE_TKIP,
+struct ath_ani {
+       bool caldone;
+       int16_t noise_floor;
+       unsigned int longcal_timer;
+       unsigned int shortcal_timer;
+       unsigned int resetcal_timer;
+       unsigned int checkani_timer;
+       struct timer_list timer;
 };
 
-enum ath9k_cipher {
-       ATH9K_CIPHER_WEP = 0,
-       ATH9K_CIPHER_AES_OCB = 1,
-       ATH9K_CIPHER_AES_CCM = 2,
-       ATH9K_CIPHER_CKIP = 3,
-       ATH9K_CIPHER_TKIP = 4,
-       ATH9K_CIPHER_CLR = 5,
-       ATH9K_CIPHER_MIC = 127
-};
+/********************/
+/*   LED Control    */
+/********************/
 
-#define AR_EEPROM_EEPCAP_COMPRESS_DIS   0x0001
-#define AR_EEPROM_EEPCAP_AES_DIS        0x0002
-#define AR_EEPROM_EEPCAP_FASTFRAME_DIS  0x0004
-#define AR_EEPROM_EEPCAP_BURST_DIS      0x0008
-#define AR_EEPROM_EEPCAP_MAXQCU         0x01F0
-#define AR_EEPROM_EEPCAP_MAXQCU_S       4
-#define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN  0x0200
-#define AR_EEPROM_EEPCAP_KC_ENTRIES     0xF000
-#define AR_EEPROM_EEPCAP_KC_ENTRIES_S   12
-
-#define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND   0x0040
-#define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN    0x0080
-#define AR_EEPROM_EEREGCAP_EN_KK_U2         0x0100
-#define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND    0x0200
-#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD     0x0400
-#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A    0x0800
-
-#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0  0x4000
-#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000
-
-#define SD_NO_CTL               0xE0
-#define NO_CTL                  0xff
-#define CTL_MODE_M              7
-#define CTL_11A                 0
-#define CTL_11B                 1
-#define CTL_11G                 2
-#define CTL_2GHT20              5
-#define CTL_5GHT20              6
-#define CTL_2GHT40              7
-#define CTL_5GHT40              8
-
-#define AR_EEPROM_MAC(i)        (0x1d+(i))
-
-#define AR_EEPROM_RFSILENT_GPIO_SEL     0x001c
-#define AR_EEPROM_RFSILENT_GPIO_SEL_S   2
-#define AR_EEPROM_RFSILENT_POLARITY     0x0002
-#define AR_EEPROM_RFSILENT_POLARITY_S   1
-
-#define CTRY_DEBUG 0x1ff
-#define        CTRY_DEFAULT 0
-
-enum reg_ext_bitmap {
-       REG_EXT_JAPAN_MIDBAND = 1,
-       REG_EXT_FCC_DFS_HT40 = 2,
-       REG_EXT_JAPAN_NONDFS_HT40 = 3,
-       REG_EXT_JAPAN_DFS_HT40 = 4
-};
+#define ATH_LED_PIN    1
+#define ATH_LED_ON_DURATION_IDLE       350     /* in msecs */
+#define ATH_LED_OFF_DURATION_IDLE      250     /* in msecs */
 
-struct ath9k_country_entry {
-       u16 countryCode;
-       u16 regDmnEnum;
-       u16 regDmn5G;
-       u16 regDmn2G;
-       u8 isMultidomain;
-       u8 iso[3];
+enum ath_led_type {
+       ATH_LED_RADIO,
+       ATH_LED_ASSOC,
+       ATH_LED_TX,
+       ATH_LED_RX
 };
 
-#define REG_WRITE(_ah, _reg, _val) iowrite32(_val, _ah->ah_sh + _reg)
-#define REG_READ(_ah, _reg) ioread32(_ah->ah_sh + _reg)
-
-#define SM(_v, _f)  (((_v) << _f##_S) & _f)
-#define MS(_v, _f)  (((_v) & _f) >> _f##_S)
-#define REG_RMW(_a, _r, _set, _clr)    \
-       REG_WRITE(_a, _r, (REG_READ(_a, _r) & ~(_clr)) | (_set))
-#define REG_RMW_FIELD(_a, _r, _f, _v) \
-       REG_WRITE(_a, _r, \
-       (REG_READ(_a, _r) & ~_f) | (((_v) << _f##_S) & _f))
-#define REG_SET_BIT(_a, _r, _f) \
-       REG_WRITE(_a, _r, REG_READ(_a, _r) | _f)
-#define REG_CLR_BIT(_a, _r, _f) \
-       REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f)
-
-#define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS   0x00000001
-
-#define INIT_AIFS       2
-#define INIT_CWMIN      15
-#define INIT_CWMIN_11B  31
-#define INIT_CWMAX      1023
-#define INIT_SH_RETRY   10
-#define INIT_LG_RETRY   10
-#define INIT_SSH_RETRY  32
-#define INIT_SLG_RETRY  32
-
-#define WLAN_CTRL_FRAME_SIZE (2+2+6+4)
-
-#define ATH_AMPDU_LIMIT_MAX      (64 * 1024 - 1)
-#define ATH_AMPDU_LIMIT_DEFAULT  ATH_AMPDU_LIMIT_MAX
-
-#define IEEE80211_WEP_IVLEN      3
-#define IEEE80211_WEP_KIDLEN     1
-#define IEEE80211_WEP_CRCLEN     4
-#define IEEE80211_MAX_MPDU_LEN  (3840 + FCS_LEN +              \
-                                (IEEE80211_WEP_IVLEN +         \
-                                 IEEE80211_WEP_KIDLEN +        \
-                                 IEEE80211_WEP_CRCLEN))
-#define MAX_RATE_POWER 63
-
-enum ath9k_power_mode {
-       ATH9K_PM_AWAKE = 0,
-       ATH9K_PM_FULL_SLEEP,
-       ATH9K_PM_NETWORK_SLEEP,
-       ATH9K_PM_UNDEFINED
+struct ath_led {
+       struct ath_softc *sc;
+       struct led_classdev led_cdev;
+       enum ath_led_type led_type;
+       char name[32];
+       bool registered;
 };
 
-struct ath9k_mib_stats {
-       u32 ackrcv_bad;
-       u32 rts_bad;
-       u32 rts_good;
-       u32 fcs_bad;
-       u32 beacons;
-};
+/* Rfkill */
+#define ATH_RFKILL_POLL_INTERVAL       2000 /* msecs */
 
-enum ath9k_ant_setting {
-       ATH9K_ANT_VARIABLE = 0,
-       ATH9K_ANT_FIXED_A,
-       ATH9K_ANT_FIXED_B
+struct ath_rfkill {
+       struct rfkill *rfkill;
+       struct delayed_work rfkill_poll;
+       char rfkill_name[32];
 };
 
-#define ATH9K_SLOT_TIME_6 6
-#define ATH9K_SLOT_TIME_9 9
-#define ATH9K_SLOT_TIME_20 20
+/********************/
+/* Main driver core */
+/********************/
 
-enum ath9k_ht_macmode {
-       ATH9K_HT_MACMODE_20 = 0,
-       ATH9K_HT_MACMODE_2040 = 1,
-};
-
-enum ath9k_ht_extprotspacing {
-       ATH9K_HT_EXTPROTSPACING_20 = 0,
-       ATH9K_HT_EXTPROTSPACING_25 = 1,
-};
+/*
+ * Default cache line size, in bytes.
+ * Used when PCI device not fully initialized by bootrom/BIOS
+*/
+#define DEFAULT_CACHELINE       32
+#define        ATH_DEFAULT_NOISE_FLOOR -95
+#define ATH_REGCLASSIDS_MAX     10
+#define ATH_CABQ_READY_TIME     80      /* % of beacon interval */
+#define ATH_MAX_SW_RETRIES      10
+#define ATH_CHAN_MAX            255
+#define IEEE80211_WEP_NKID      4       /* number of key ids */
 
-struct ath9k_ht_cwm {
-       enum ath9k_ht_macmode ht_macmode;
+/*
+ * The key cache is used for h/w cipher state and also for
+ * tracking station state such as the current tx antenna.
+ * We also setup a mapping table between key cache slot indices
+ * and station state to short-circuit node lookups on rx.
+ * Different parts have different size key caches.  We handle
+ * up to ATH_KEYMAX entries (could dynamically allocate state).
+ */
+#define        ATH_KEYMAX              128     /* max key cache size we handle */
+
+#define ATH_IF_ID_ANY          0xff
+#define ATH_TXPOWER_MAX         100     /* .5 dBm units */
+#define ATH_RSSI_DUMMY_MARKER   0x127
+#define ATH_RATE_DUMMY_MARKER   0
+
+#define SC_OP_INVALID          BIT(0)
+#define SC_OP_BEACONS          BIT(1)
+#define SC_OP_RXAGGR           BIT(2)
+#define SC_OP_TXAGGR           BIT(3)
+#define SC_OP_CHAINMASK_UPDATE BIT(4)
+#define SC_OP_FULL_RESET       BIT(5)
+#define SC_OP_NO_RESET         BIT(6)
+#define SC_OP_PREAMBLE_SHORT   BIT(7)
+#define SC_OP_PROTECT_ENABLE   BIT(8)
+#define SC_OP_RXFLUSH          BIT(9)
+#define SC_OP_LED_ASSOCIATED   BIT(10)
+#define SC_OP_RFKILL_REGISTERED        BIT(11)
+#define SC_OP_RFKILL_SW_BLOCKED        BIT(12)
+#define SC_OP_RFKILL_HW_BLOCKED        BIT(13)
+#define SC_OP_WAIT_FOR_BEACON  BIT(14)
+#define SC_OP_LED_ON           BIT(15)
+
+struct ath_bus_ops {
+       void            (*read_cachesize)(struct ath_softc *sc, int *csz);
+       void            (*cleanup)(struct ath_softc *sc);
+       bool            (*eeprom_read)(struct ath_hw *ah, u32 off, u16 *data);
+};
+
+struct ath_softc {
+       struct ieee80211_hw *hw;
+       struct device *dev;
+       struct tasklet_struct intr_tq;
+       struct tasklet_struct bcon_tasklet;
+       struct ath_hw *sc_ah;
+       void __iomem *mem;
+       int irq;
+       spinlock_t sc_resetlock;
+       struct mutex mutex;
+
+       u8 curbssid[ETH_ALEN];
+       u8 bssidmask[ETH_ALEN];
+       u32 intrstatus;
+       u32 sc_flags; /* SC_OP_* */
+       u16 curtxpow;
+       u16 curaid;
+       u16 cachelsz;
+       u8 nbcnvifs;
+       u16 nvifs;
+       u8 tx_chainmask;
+       u8 rx_chainmask;
+       u32 keymax;
+       DECLARE_BITMAP(keymap, ATH_KEYMAX);
+       u8 splitmic;
+       atomic_t ps_usecount;
+       enum ath9k_int imask;
        enum ath9k_ht_extprotspacing ht_extprotspacing;
-};
-
-enum ath9k_ani_cmd {
-       ATH9K_ANI_PRESENT = 0x1,
-       ATH9K_ANI_NOISE_IMMUNITY_LEVEL = 0x2,
-       ATH9K_ANI_OFDM_WEAK_SIGNAL_DETECTION = 0x4,
-       ATH9K_ANI_CCK_WEAK_SIGNAL_THR = 0x8,
-       ATH9K_ANI_FIRSTEP_LEVEL = 0x10,
-       ATH9K_ANI_SPUR_IMMUNITY_LEVEL = 0x20,
-       ATH9K_ANI_MODE = 0x40,
-       ATH9K_ANI_PHYERR_RESET = 0x80,
-       ATH9K_ANI_ALL = 0xff
-};
-
-enum {
-       WLAN_RC_PHY_OFDM,
-       WLAN_RC_PHY_CCK,
-       WLAN_RC_PHY_HT_20_SS,
-       WLAN_RC_PHY_HT_20_DS,
-       WLAN_RC_PHY_HT_40_SS,
-       WLAN_RC_PHY_HT_40_DS,
-       WLAN_RC_PHY_HT_20_SS_HGI,
-       WLAN_RC_PHY_HT_20_DS_HGI,
-       WLAN_RC_PHY_HT_40_SS_HGI,
-       WLAN_RC_PHY_HT_40_DS_HGI,
-       WLAN_RC_PHY_MAX
-};
-
-enum ath9k_tp_scale {
-       ATH9K_TP_SCALE_MAX = 0,
-       ATH9K_TP_SCALE_50,
-       ATH9K_TP_SCALE_25,
-       ATH9K_TP_SCALE_12,
-       ATH9K_TP_SCALE_MIN
-};
-
-enum ser_reg_mode {
-       SER_REG_MODE_OFF = 0,
-       SER_REG_MODE_ON = 1,
-       SER_REG_MODE_AUTO = 2,
-};
-
-#define AR_PHY_CCA_MAX_GOOD_VALUE                      -85
-#define AR_PHY_CCA_MAX_HIGH_VALUE                      -62
-#define AR_PHY_CCA_MIN_BAD_VALUE                       -121
-#define AR_PHY_CCA_FILTERWINDOW_LENGTH_INIT     3
-#define AR_PHY_CCA_FILTERWINDOW_LENGTH          5
-
-#define ATH9K_NF_CAL_HIST_MAX           5
-#define NUM_NF_READINGS                 6
-
-struct ath9k_nfcal_hist {
-       int16_t nfCalBuffer[ATH9K_NF_CAL_HIST_MAX];
-       u8 currIndex;
-       int16_t privNF;
-       u8 invalidNFcount;
-};
-
-struct ath9k_beacon_state {
-       u32 bs_nexttbtt;
-       u32 bs_nextdtim;
-       u32 bs_intval;
-#define ATH9K_BEACON_PERIOD       0x0000ffff
-#define ATH9K_BEACON_ENA          0x00800000
-#define ATH9K_BEACON_RESET_TSF    0x01000000
-       u32 bs_dtimperiod;
-       u16 bs_cfpperiod;
-       u16 bs_cfpmaxduration;
-       u32 bs_cfpnext;
-       u16 bs_timoffset;
-       u16 bs_bmissthreshold;
-       u32 bs_sleepduration;
-};
-
-struct ath9k_node_stats {
-       u32 ns_avgbrssi;
-       u32 ns_avgrssi;
-       u32 ns_avgtxrssi;
-       u32 ns_avgtxrate;
-};
-
-#define ATH9K_RSSI_EP_MULTIPLIER  (1<<7)
-
-#define AR_GPIO_OUTPUT_MUX_AS_OUTPUT             0
-#define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
-#define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED     2
-#define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED    5
-#define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED      6
-
-enum {
-       ATH9K_RESET_POWER_ON,
-       ATH9K_RESET_WARM,
-       ATH9K_RESET_COLD,
-};
-
-#define AH_USE_EEPROM   0x1
-
-struct ath_hal {
-       u32 ah_magic;
-       u16 ah_devid;
-       u16 ah_subvendorid;
-       u32 ah_macVersion;
-       u16 ah_macRev;
-       u16 ah_phyRev;
-       u16 ah_analog5GhzRev;
-       u16 ah_analog2GhzRev;
-
-       void __iomem *ah_sh;
-       struct ath_softc *ah_sc;
-
-       enum nl80211_iftype ah_opmode;
-       struct ath9k_ops_config ah_config;
-       struct ath9k_hw_capabilities ah_caps;
-
-       u16 ah_countryCode;
-       u32 ah_flags;
-       int16_t ah_powerLimit;
-       u16 ah_maxPowerLevel;
-       u32 ah_tpScale;
-       u16 ah_currentRD;
-       u16 ah_currentRDExt;
-       u16 ah_currentRDInUse;
-       u16 ah_currentRD5G;
-       u16 ah_currentRD2G;
-       char ah_iso[4];
-
-       struct ath9k_channel ah_channels[150];
-       struct ath9k_channel *ah_curchan;
-       u32 ah_nchan;
-
-       bool ah_isPciExpress;
-       u16 ah_txTrigLevel;
-       u16 ah_rfsilent;
-       u32 ah_rfkill_gpio;
-       u32 ah_rfkill_polarity;
-
-#ifndef ATH_NF_PER_CHAN
-       struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
+       enum ath9k_ht_macmode tx_chan_width;
+
+       struct ath_config config;
+       struct ath_rx rx;
+       struct ath_tx tx;
+       struct ath_beacon beacon;
+       struct ieee80211_vif *vifs[ATH_BCBUF];
+       struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX];
+       struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX];
+       struct ath_rate_table *cur_rate_table;
+       struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
+
+       struct ath_led radio_led;
+       struct ath_led assoc_led;
+       struct ath_led tx_led;
+       struct ath_led rx_led;
+       struct delayed_work ath_led_blink_work;
+       int led_on_duration;
+       int led_off_duration;
+       int led_on_cnt;
+       int led_off_cnt;
+
+       struct ath_rfkill rf_kill;
+       struct ath_ani ani;
+       struct ath9k_node_stats nodestats;
+#ifdef CONFIG_ATH9K_DEBUG
+       struct ath9k_debug debug;
 #endif
-};
-
-struct chan_centers {
-       u16 synth_center;
-       u16 ctl_center;
-       u16 ext_center;
-};
-
-struct ath_rate_table;
-
-/* Helpers */
-
-enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah,
-                              const struct ath9k_channel *chan);
-bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val);
-u32 ath9k_hw_reverse_bits(u32 val, u32 n);
-bool ath9k_get_channel_edges(struct ath_hal *ah,
-                            u16 flags, u16 *low,
-                            u16 *high);
-u16 ath9k_hw_computetxtime(struct ath_hal *ah,
-                          struct ath_rate_table *rates,
-                          u32 frameLen, u16 rateix,
-                          bool shortPreamble);
-u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags);
-void ath9k_hw_get_channel_centers(struct ath_hal *ah,
-                                 struct ath9k_channel *chan,
-                                 struct chan_centers *centers);
-
-/* Attach, Detach */
-
-const char *ath9k_hw_probe(u16 vendorid, u16 devid);
-void ath9k_hw_detach(struct ath_hal *ah);
-struct ath_hal *ath9k_hw_attach(u16 devid, struct ath_softc *sc,
-                               void __iomem *mem, int *error);
-void ath9k_hw_rfdetach(struct ath_hal *ah);
-
-
-/* HW Reset */
-
-bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
-                   enum ath9k_ht_macmode macmode,
-                   u8 txchainmask, u8 rxchainmask,
-                   enum ath9k_ht_extprotspacing extprotspacing,
-                   bool bChannelChange, int *status);
-
-/* Key Cache Management */
-
-bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry);
-bool ath9k_hw_keysetmac(struct ath_hal *ah, u16 entry, const u8 *mac);
-bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
-                                const struct ath9k_keyval *k,
-                                const u8 *mac, int xorKey);
-bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry);
-
-/* Power Management */
-
-bool ath9k_hw_setpower(struct ath_hal *ah,
-                      enum ath9k_power_mode mode);
-void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore);
-
-/* Beacon timers */
-
-void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period);
-void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah,
-                                   const struct ath9k_beacon_state *bs);
-/* HW Capabilities */
-
-bool ath9k_hw_fill_cap_info(struct ath_hal *ah);
-bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type,
-                           u32 capability, u32 *result);
-bool ath9k_hw_setcapability(struct ath_hal *ah, enum ath9k_capability_type type,
-                           u32 capability, u32 setting, int *status);
-
-/* GPIO / RFKILL / Antennae */
-
-void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio);
-u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio);
-void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio,
-                        u32 ah_signal_type);
-void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 val);
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-void ath9k_enable_rfkill(struct ath_hal *ah);
+       struct ath_bus_ops *bus_ops;
+};
+
+int ath_reset(struct ath_softc *sc, bool retry_tx);
+int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);
+int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
+int ath_cabq_update(struct ath_softc *);
+
+static inline void ath_read_cachesize(struct ath_softc *sc, int *csz)
+{
+       sc->bus_ops->read_cachesize(sc, csz);
+}
+
+static inline void ath_bus_cleanup(struct ath_softc *sc)
+{
+       sc->bus_ops->cleanup(sc);
+}
+
+extern struct ieee80211_ops ath9k_ops;
+
+irqreturn_t ath_isr(int irq, void *dev);
+void ath_cleanup(struct ath_softc *sc);
+int ath_attach(u16 devid, struct ath_softc *sc);
+void ath_detach(struct ath_softc *sc);
+const char *ath_mac_bb_name(u32 mac_bb_version);
+const char *ath_rf_name(u16 rf_version);
+
+#ifdef CONFIG_PCI
+int ath_pci_init(void);
+void ath_pci_exit(void);
+#else
+static inline int ath_pci_init(void) { return 0; };
+static inline void ath_pci_exit(void) {};
 #endif
-int ath9k_hw_select_antconfig(struct ath_hal *ah, u32 cfg);
-u32 ath9k_hw_getdefantenna(struct ath_hal *ah);
-void ath9k_hw_setantenna(struct ath_hal *ah, u32 antenna);
-bool ath9k_hw_setantennaswitch(struct ath_hal *ah,
-                              enum ath9k_ant_setting settings,
-                              struct ath9k_channel *chan,
-                              u8 *tx_chainmask,
-                              u8 *rx_chainmask,
-                              u8 *antenna_cfgd);
-
-/* General Operation */
-
-u32 ath9k_hw_getrxfilter(struct ath_hal *ah);
-void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits);
-bool ath9k_hw_phy_disable(struct ath_hal *ah);
-bool ath9k_hw_disable(struct ath_hal *ah);
-bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit);
-void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac);
-bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac);
-void ath9k_hw_setopmode(struct ath_hal *ah);
-void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1);
-void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask);
-bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask);
-void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId);
-u64 ath9k_hw_gettsf64(struct ath_hal *ah);
-void ath9k_hw_reset_tsf(struct ath_hal *ah);
-bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting);
-bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us);
-void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode);
-
-/* Regulatory */
-
-bool ath9k_regd_is_public_safety_sku(struct ath_hal *ah);
-struct ath9k_channel* ath9k_regd_check_channel(struct ath_hal *ah,
-                        const struct ath9k_channel *c);
-u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan);
-u32 ath9k_regd_get_antenna_allowed(struct ath_hal *ah,
-                                  struct ath9k_channel *chan);
-bool ath9k_regd_init_channels(struct ath_hal *ah,
-                             u32 maxchans, u32 *nchans, u8 *regclassids,
-                             u32 maxregids, u32 *nregids, u16 cc,
-                             bool enableOutdoor, bool enableExtendedChannels);
-
-/* ANI */
-
-void ath9k_ani_reset(struct ath_hal *ah);
-void ath9k_hw_ani_monitor(struct ath_hal *ah,
-                         const struct ath9k_node_stats *stats,
-                         struct ath9k_channel *chan);
-bool ath9k_hw_phycounters(struct ath_hal *ah);
-void ath9k_enable_mib_counters(struct ath_hal *ah);
-void ath9k_hw_disable_mib_counters(struct ath_hal *ah);
-u32 ath9k_hw_GetMibCycleCountsPct(struct ath_hal *ah,
-                                 u32 *rxc_pcnt,
-                                 u32 *rxf_pcnt,
-                                 u32 *txf_pcnt);
-void ath9k_hw_procmibevent(struct ath_hal *ah,
-                          const struct ath9k_node_stats *stats);
-void ath9k_hw_ani_setup(struct ath_hal *ah);
-void ath9k_hw_ani_attach(struct ath_hal *ah);
-void ath9k_hw_ani_detach(struct ath_hal *ah);
-
-/* Calibration */
-
-void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan,
-                            bool *isCalDone);
-void ath9k_hw_start_nfcal(struct ath_hal *ah);
-void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan);
-int16_t ath9k_hw_getnf(struct ath_hal *ah,
-                      struct ath9k_channel *chan);
-void ath9k_init_nfcal_hist_buffer(struct ath_hal *ah);
-s16 ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan);
-bool ath9k_hw_calibrate(struct ath_hal *ah, struct ath9k_channel *chan,
-                       u8 rxchainmask, bool longcal,
-                       bool *isCalDone);
-bool ath9k_hw_init_cal(struct ath_hal *ah,
-                      struct ath9k_channel *chan);
-
-
-/* EEPROM */
-
-int ath9k_hw_set_txpower(struct ath_hal *ah,
-                        struct ath9k_channel *chan,
-                        u16 cfgCtl,
-                        u8 twiceAntennaReduction,
-                        u8 twiceMaxRegulatoryPower,
-                        u8 powerLimit);
-void ath9k_hw_set_addac(struct ath_hal *ah, struct ath9k_channel *chan);
-bool ath9k_hw_set_power_per_rate_table(struct ath_hal *ah,
-                                      struct ath9k_channel *chan,
-                                      int16_t *ratesArray,
-                                      u16 cfgCtl,
-                                      u8 AntennaReduction,
-                                      u8 twiceMaxRegulatoryPower,
-                                      u8 powerLimit);
-bool ath9k_hw_set_power_cal_table(struct ath_hal *ah,
-                                 struct ath9k_channel *chan,
-                                 int16_t *pTxPowerIndexOffset);
-bool ath9k_hw_eeprom_set_board_values(struct ath_hal *ah,
-                                     struct ath9k_channel *chan);
-int ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah,
-                                   struct ath9k_channel *chan,
-                                   u8 index, u16 *config);
-u8 ath9k_hw_get_num_ant_config(struct ath_hal *ah,
-                              enum ieee80211_band freq_band);
-u16 ath9k_hw_eeprom_get_spur_chan(struct ath_hal *ah, u16 i, bool is2GHz);
-int ath9k_hw_eeprom_attach(struct ath_hal *ah);
-
-/* Interrupt Handling */
-
-bool ath9k_hw_intrpend(struct ath_hal *ah);
-bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked);
-enum ath9k_int ath9k_hw_intrget(struct ath_hal *ah);
-enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints);
-
-/* MAC (PCU/QCU) */
-
-u32 ath9k_hw_gettxbuf(struct ath_hal *ah, u32 q);
-bool ath9k_hw_puttxbuf(struct ath_hal *ah, u32 q, u32 txdp);
-bool ath9k_hw_txstart(struct ath_hal *ah, u32 q);
-u32 ath9k_hw_numtxpending(struct ath_hal *ah, u32 q);
-bool ath9k_hw_updatetxtriglevel(struct ath_hal *ah, bool bIncTrigLevel);
-bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q);
-bool ath9k_hw_filltxdesc(struct ath_hal *ah, struct ath_desc *ds,
-                        u32 segLen, bool firstSeg,
-                        bool lastSeg, const struct ath_desc *ds0);
-void ath9k_hw_cleartxdesc(struct ath_hal *ah, struct ath_desc *ds);
-int ath9k_hw_txprocdesc(struct ath_hal *ah, struct ath_desc *ds);
-void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds,
-                           u32 pktLen, enum ath9k_pkt_type type, u32 txPower,
-                           u32 keyIx, enum ath9k_key_type keyType, u32 flags);
-void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds,
-                                 struct ath_desc *lastds,
-                                 u32 durUpdateEn, u32 rtsctsRate,
-                                 u32 rtsctsDuration,
-                                 struct ath9k_11n_rate_series series[],
-                                 u32 nseries, u32 flags);
-void ath9k_hw_set11n_aggr_first(struct ath_hal *ah, struct ath_desc *ds,
-                               u32 aggrLen);
-void ath9k_hw_set11n_aggr_middle(struct ath_hal *ah, struct ath_desc *ds,
-                                u32 numDelims);
-void ath9k_hw_set11n_aggr_last(struct ath_hal *ah, struct ath_desc *ds);
-void ath9k_hw_clr11n_aggr(struct ath_hal *ah, struct ath_desc *ds);
-void ath9k_hw_set11n_burstduration(struct ath_hal *ah, struct ath_desc *ds,
-                                  u32 burstDuration);
-void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah, struct ath_desc *ds,
-                                    u32 vmf);
-void ath9k_hw_gettxintrtxqs(struct ath_hal *ah, u32 *txqs);
-bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q,
-                           const struct ath9k_tx_queue_info *qinfo);
-bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q,
-                           struct ath9k_tx_queue_info *qinfo);
-int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type,
-                         const struct ath9k_tx_queue_info *qinfo);
-bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q);
-bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q);
-int ath9k_hw_rxprocdesc(struct ath_hal *ah, struct ath_desc *ds,
-                       u32 pa, struct ath_desc *nds, u64 tsf);
-bool ath9k_hw_setuprxdesc(struct ath_hal *ah, struct ath_desc *ds,
-                         u32 size, u32 flags);
-bool ath9k_hw_setrxabort(struct ath_hal *ah, bool set);
-void ath9k_hw_putrxbuf(struct ath_hal *ah, u32 rxdp);
-void ath9k_hw_rxena(struct ath_hal *ah);
-void ath9k_hw_startpcureceive(struct ath_hal *ah);
-void ath9k_hw_stoppcurecv(struct ath_hal *ah);
-bool ath9k_hw_stopdmarecv(struct ath_hal *ah);
 
+#ifdef CONFIG_ATHEROS_AR71XX
+int ath_ahb_init(void);
+void ath_ahb_exit(void);
+#else
+static inline int ath_ahb_init(void) { return 0; };
+static inline void ath_ahb_exit(void) {};
 #endif
+
+static inline void ath9k_ps_wakeup(struct ath_softc *sc)
+{
+       if (atomic_inc_return(&sc->ps_usecount) == 1)
+               if (sc->sc_ah->power_mode !=  ATH9K_PM_AWAKE) {
+                       sc->sc_ah->restore_mode = sc->sc_ah->power_mode;
+                       ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
+               }
+}
+
+static inline void ath9k_ps_restore(struct ath_softc *sc)
+{
+       if (atomic_dec_and_test(&sc->ps_usecount))
+               if (sc->hw->conf.flags & IEEE80211_CONF_PS)
+                       ath9k_hw_setpower(sc->sc_ah,
+                                         sc->sc_ah->restore_mode);
+}
+#endif /* ATH9K_H */
index 3ab0b43aaf93f79c6b8af3859f7cf0ea9990e3db..2e2ef352913518e1e2586da3f5cc03e1a2664fc9 100644 (file)
@@ -14,7 +14,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
+#include "ath9k.h"
 
 /*
  *  This function will modify certain transmit queue properties depending on
 */
 static int ath_beaconq_config(struct ath_softc *sc)
 {
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        struct ath9k_tx_queue_info qi;
 
        ath9k_hw_get_txq_props(ah, sc->beacon.beaconq, &qi);
-       if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) {
+       if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
                /* Always burst out beacon and CAB traffic. */
                qi.tqi_aifs = 1;
                qi.tqi_cwmin = 0;
@@ -63,10 +63,10 @@ static void ath_bstuck_process(struct ath_softc *sc)
  *  Beacons are always sent out at the lowest rate, and are not retried.
 */
 static void ath_beacon_setup(struct ath_softc *sc,
-                            struct ath_vap *avp, struct ath_buf *bf)
+                            struct ath_vif *avp, struct ath_buf *bf)
 {
        struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu;
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        struct ath_desc *ds;
        struct ath9k_11n_rate_series series[4];
        struct ath_rate_table *rt;
@@ -82,8 +82,8 @@ static void ath_beacon_setup(struct ath_softc *sc,
 
        flags = ATH9K_TXDESC_NOACK;
 
-       if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC &&
-           (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
+       if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
+           (ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
                ds->ds_link = bf->bf_daddr; /* self-linked */
                flags |= ATH9K_TXDESC_VEOL;
                /* Let hardware handle antenna switching. */
@@ -96,7 +96,7 @@ static void ath_beacon_setup(struct ath_softc *sc,
                 * SWBA's
                 * XXX assumes two antenna
                 */
-               antenna = ((sc->beacon.ast_be_xmit / sc->sc_nbcnvaps) & 1 ? 2 : 1);
+               antenna = ((sc->beacon.ast_be_xmit / sc->nbcnvifs) & 1 ? 2 : 1);
        }
 
        ds->ds_data = bf->bf_buf_addr;
@@ -132,24 +132,24 @@ static void ath_beacon_setup(struct ath_softc *sc,
        memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
        series[0].Tries = 1;
        series[0].Rate = rate;
-       series[0].ChSel = sc->sc_tx_chainmask;
+       series[0].ChSel = sc->tx_chainmask;
        series[0].RateFlags = (ctsrate) ? ATH9K_RATESERIES_RTS_CTS : 0;
        ath9k_hw_set11n_ratescenario(ah, ds, ds, 0,
                ctsrate, ctsduration, series, 4, 0);
 }
 
-/* Generate beacon frame and queue cab data for a vap */
+/* Generate beacon frame and queue cab data for a VIF */
 static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
 {
        struct ath_buf *bf;
-       struct ath_vap *avp;
+       struct ath_vif *avp;
        struct sk_buff *skb;
        struct ath_txq *cabq;
        struct ieee80211_vif *vif;
        struct ieee80211_tx_info *info;
        int cabq_depth;
 
-       vif = sc->sc_vaps[if_id];
+       vif = sc->vifs[if_id];
        ASSERT(vif);
 
        avp = (void *)vif->drv_priv;
@@ -164,9 +164,9 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
        bf = avp->av_bcbuf;
        skb = (struct sk_buff *)bf->bf_mpdu;
        if (skb) {
-               pci_unmap_single(sc->pdev, bf->bf_dmacontext,
+               dma_unmap_single(sc->dev, bf->bf_dmacontext,
                                 skb->len,
-                                PCI_DMA_TODEVICE);
+                                DMA_TO_DEVICE);
                dev_kfree_skb_any(skb);
        }
 
@@ -188,14 +188,14 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
        }
 
        bf->bf_buf_addr = bf->bf_dmacontext =
-               pci_map_single(sc->pdev, skb->data,
+               dma_map_single(sc->dev, skb->data,
                               skb->len,
-                              PCI_DMA_TODEVICE);
-       if (unlikely(pci_dma_mapping_error(sc->pdev, bf->bf_buf_addr))) {
+                              DMA_TO_DEVICE);
+       if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) {
                dev_kfree_skb_any(skb);
                bf->bf_mpdu = NULL;
                DPRINTF(sc, ATH_DBG_CONFIG,
-                       "pci_dma_mapping_error() on beaconing\n");
+                       "dma_mapping_error() on beaconing\n");
                return NULL;
        }
 
@@ -204,10 +204,10 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
        /*
         * if the CABQ traffic from previous DTIM is pending and the current
         *  beacon is also a DTIM.
-        *  1) if there is only one vap let the cab traffic continue.
-        *  2) if there are more than one vap and we are using staggered
+        *  1) if there is only one vif let the cab traffic continue.
+        *  2) if there are more than one vif and we are using staggered
         *     beacons, then drain the cabq by dropping all the frames in
-        *     the cabq so that the current vaps cab traffic can be scheduled.
+        *     the cabq so that the current vifs cab traffic can be scheduled.
         */
        spin_lock_bh(&cabq->axq_lock);
        cabq_depth = cabq->axq_depth;
@@ -219,8 +219,8 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
                 * the lock again which is a common function and that
                 * acquires txq lock inside.
                 */
-               if (sc->sc_nvaps > 1) {
-                       ath_tx_draintxq(sc, cabq, false);
+               if (sc->nvifs > 1) {
+                       ath_draintxq(sc, cabq, false);
                        DPRINTF(sc, ATH_DBG_BEACON,
                                "flush previous cabq traffic\n");
                }
@@ -248,12 +248,12 @@ static struct ath_buf *ath_beacon_generate(struct ath_softc *sc, int if_id)
 static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id)
 {
        struct ieee80211_vif *vif;
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        struct ath_buf *bf;
-       struct ath_vap *avp;
+       struct ath_vif *avp;
        struct sk_buff *skb;
 
-       vif = sc->sc_vaps[if_id];
+       vif = sc->vifs[if_id];
        ASSERT(vif);
 
        avp = (void *)vif->drv_priv;
@@ -276,7 +276,7 @@ static void ath_beacon_start_adhoc(struct ath_softc *sc, int if_id)
                sc->beacon.beaconq, ito64(bf->bf_daddr), bf->bf_desc);
 }
 
-int ath_beaconq_setup(struct ath_hal *ah)
+int ath_beaconq_setup(struct ath_hw *ah)
 {
        struct ath9k_tx_queue_info qi;
 
@@ -291,13 +291,13 @@ int ath_beaconq_setup(struct ath_hal *ah)
 int ath_beacon_alloc(struct ath_softc *sc, int if_id)
 {
        struct ieee80211_vif *vif;
-       struct ath_vap *avp;
+       struct ath_vif *avp;
        struct ieee80211_hdr *hdr;
        struct ath_buf *bf;
        struct sk_buff *skb;
        __le64 tstamp;
 
-       vif = sc->sc_vaps[if_id];
+       vif = sc->vifs[if_id];
        ASSERT(vif);
 
        avp = (void *)vif->drv_priv;
@@ -310,11 +310,11 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
                                                 struct ath_buf, list);
                list_del(&avp->av_bcbuf->list);
 
-               if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP ||
-                   !(sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
+               if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
+                   !(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_VEOL)) {
                        int slot;
                        /*
-                        * Assign the vap to a beacon xmit slot. As
+                        * Assign the vif to a beacon xmit slot. As
                         * above, this cannot fail to find one.
                         */
                        avp->av_bslot = 0;
@@ -335,7 +335,7 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
                                }
                        BUG_ON(sc->beacon.bslot[avp->av_bslot] != ATH_IF_ID_ANY);
                        sc->beacon.bslot[avp->av_bslot] = if_id;
-                       sc->sc_nbcnvaps++;
+                       sc->nbcnvifs++;
                }
        }
 
@@ -343,9 +343,9 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
        bf = avp->av_bcbuf;
        if (bf->bf_mpdu != NULL) {
                skb = (struct sk_buff *)bf->bf_mpdu;
-               pci_unmap_single(sc->pdev, bf->bf_dmacontext,
+               dma_unmap_single(sc->dev, bf->bf_dmacontext,
                                 skb->len,
-                                PCI_DMA_TODEVICE);
+                                DMA_TO_DEVICE);
                dev_kfree_skb_any(skb);
                bf->bf_mpdu = NULL;
        }
@@ -384,8 +384,8 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
                 * timestamp then convert to TSF units and handle
                 * byte swapping before writing it in the frame.
                 * The hardware will then add this each time a beacon
-                * frame is sent.  Note that we align vap's 1..N
-                * and leave vap 0 untouched.  This means vap 0
+                * frame is sent.  Note that we align vif's 1..N
+                * and leave vif 0 untouched.  This means vap 0
                 * has a timestamp in one beacon interval while the
                 * others get a timestamp aligned to the next interval.
                 */
@@ -402,36 +402,36 @@ int ath_beacon_alloc(struct ath_softc *sc, int if_id)
 
        bf->bf_mpdu = skb;
        bf->bf_buf_addr = bf->bf_dmacontext =
-               pci_map_single(sc->pdev, skb->data,
+               dma_map_single(sc->dev, skb->data,
                               skb->len,
-                              PCI_DMA_TODEVICE);
-       if (unlikely(pci_dma_mapping_error(sc->pdev, bf->bf_buf_addr))) {
+                              DMA_TO_DEVICE);
+       if (unlikely(dma_mapping_error(sc->dev, bf->bf_buf_addr))) {
                dev_kfree_skb_any(skb);
                bf->bf_mpdu = NULL;
                DPRINTF(sc, ATH_DBG_CONFIG,
-                       "pci_dma_mapping_error() on beacon alloc\n");
+                       "dma_mapping_error() on beacon alloc\n");
                return -ENOMEM;
        }
 
        return 0;
 }
 
-void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp)
+void ath_beacon_return(struct ath_softc *sc, struct ath_vif *avp)
 {
        if (avp->av_bcbuf != NULL) {
                struct ath_buf *bf;
 
                if (avp->av_bslot != -1) {
                        sc->beacon.bslot[avp->av_bslot] = ATH_IF_ID_ANY;
-                       sc->sc_nbcnvaps--;
+                       sc->nbcnvifs--;
                }
 
                bf = avp->av_bcbuf;
                if (bf->bf_mpdu != NULL) {
                        struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu;
-                       pci_unmap_single(sc->pdev, bf->bf_dmacontext,
+                       dma_unmap_single(sc->dev, bf->bf_dmacontext,
                                         skb->len,
-                                        PCI_DMA_TODEVICE);
+                                        DMA_TO_DEVICE);
                        dev_kfree_skb_any(skb);
                        bf->bf_mpdu = NULL;
                }
@@ -444,7 +444,7 @@ void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp)
 void ath9k_beacon_tasklet(unsigned long data)
 {
        struct ath_softc *sc = (struct ath_softc *)data;
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        struct ath_buf *bf = NULL;
        int slot, if_id;
        u32 bfaddr;
@@ -597,7 +597,7 @@ void ath9k_beacon_tasklet(unsigned long data)
                ath9k_hw_puttxbuf(ah, sc->beacon.beaconq, bfaddr);
                ath9k_hw_txstart(ah, sc->beacon.beaconq);
 
-               sc->beacon.ast_be_xmit += bc;     /* XXX per-vap? */
+               sc->beacon.ast_be_xmit += bc;     /* XXX per-vif? */
        }
 }
 
@@ -619,19 +619,19 @@ void ath9k_beacon_tasklet(unsigned long data)
 void ath_beacon_config(struct ath_softc *sc, int if_id)
 {
        struct ieee80211_vif *vif;
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        struct ath_beacon_config conf;
-       struct ath_vap *avp;
+       struct ath_vif *avp;
        enum nl80211_iftype opmode;
        u32 nexttbtt, intval;
 
        if (if_id != ATH_IF_ID_ANY) {
-               vif = sc->sc_vaps[if_id];
+               vif = sc->vifs[if_id];
                ASSERT(vif);
                avp = (void *)vif->drv_priv;
                opmode = avp->av_opmode;
        } else {
-               opmode = sc->sc_ah->ah_opmode;
+               opmode = sc->sc_ah->opmode;
        }
 
        memset(&conf, 0, sizeof(struct ath_beacon_config));
@@ -647,7 +647,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
        nexttbtt = TSF_TO_TU(sc->beacon.bc_tstamp >> 32, sc->beacon.bc_tstamp);
 
        /* XXX conditionalize multi-bss support? */
-       if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) {
+       if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
                /*
                 * For multi-bss ap support beacons are either staggered
                 * evenly over N slots or burst together.  For the former
@@ -670,7 +670,7 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
                nexttbtt, intval, conf.beacon_interval);
 
        /* Check for NL80211_IFTYPE_AP and sc_nostabeacons for WDS client */
-       if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) {
+       if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION) {
                struct ath9k_beacon_state bs;
                u64 tsf;
                u32 tsftu;
@@ -781,15 +781,15 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
 
                ath9k_hw_set_interrupts(ah, 0);
                ath9k_hw_set_sta_beacon_timers(ah, &bs);
-               sc->sc_imask |= ATH9K_INT_BMISS;
-               ath9k_hw_set_interrupts(ah, sc->sc_imask);
+               sc->imask |= ATH9K_INT_BMISS;
+               ath9k_hw_set_interrupts(ah, sc->imask);
        } else {
                u64 tsf;
                u32 tsftu;
                ath9k_hw_set_interrupts(ah, 0);
                if (nexttbtt == intval)
                        intval |= ATH9K_BEACON_RESET_TSF;
-               if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC) {
+               if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) {
                        /*
                         * Pull nexttbtt forward to reflect the current
                         * TSF
@@ -818,27 +818,27 @@ void ath_beacon_config(struct ath_softc *sc, int if_id)
                         * deal with things.
                         */
                        intval |= ATH9K_BEACON_ENA;
-                       if (!(ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL))
-                               sc->sc_imask |= ATH9K_INT_SWBA;
+                       if (!(ah->caps.hw_caps & ATH9K_HW_CAP_VEOL))
+                               sc->imask |= ATH9K_INT_SWBA;
                        ath_beaconq_config(sc);
-               } else if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) {
+               } else if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
                        /*
                         * In AP mode we enable the beacon timers and
                         * SWBA interrupts to prepare beacon frames.
                         */
                        intval |= ATH9K_BEACON_ENA;
-                       sc->sc_imask |= ATH9K_INT_SWBA;   /* beacon prepare */
+                       sc->imask |= ATH9K_INT_SWBA;   /* beacon prepare */
                        ath_beaconq_config(sc);
                }
                ath9k_hw_beaconinit(ah, nexttbtt, intval);
                sc->beacon.bmisscnt = 0;
-               ath9k_hw_set_interrupts(ah, sc->sc_imask);
+               ath9k_hw_set_interrupts(ah, sc->imask);
                /*
                 * When using a self-linked beacon descriptor in
                 * ibss mode load it once here.
                 */
-               if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC &&
-                   (ah->ah_caps.hw_caps & ATH9K_HW_CAP_VEOL))
+               if (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC &&
+                   (ah->caps.hw_caps & ATH9K_HW_CAP_VEOL))
                        ath_beacon_start_adhoc(sc, 0);
        }
 }
index 3c7454fc51bdf0f24f1c70475352c85443236818..1fc3a08e85c64b14d16c9c0dc80e06a36dd819c0 100644 (file)
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
-#include "hw.h"
-#include "reg.h"
-#include "phy.h"
-
-static const int16_t NOISE_FLOOR[] = { -96, -93, -98, -96, -93, -96 };
+#include "ath9k.h"
 
 /* We can tune this as we go by monitoring really low values */
 #define ATH9K_NF_TOO_LOW       -60
@@ -28,7 +23,7 @@ static const int16_t NOISE_FLOOR[] = { -96, -93, -98, -96, -93, -96 };
  * is incorrect and we should use the static NF value. Later we can try to
  * find out why they are reporting these values */
 
-static bool ath9k_hw_nf_in_range(struct ath_hal *ah, s16 nf)
+static bool ath9k_hw_nf_in_range(struct ath_hw *ah, s16 nf)
 {
        if (nf > ATH9K_NF_TOO_LOW) {
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
@@ -91,7 +86,7 @@ static void ath9k_hw_update_nfcal_hist_buffer(struct ath9k_nfcal_hist *h,
        return;
 }
 
-static void ath9k_hw_do_getnf(struct ath_hal *ah,
+static void ath9k_hw_do_getnf(struct ath_hw *ah,
                              int16_t nfarray[NUM_NF_READINGS])
 {
        int16_t nf;
@@ -107,27 +102,29 @@ static void ath9k_hw_do_getnf(struct ath_hal *ah,
                "NF calibrated [ctl] [chain 0] is %d\n", nf);
        nfarray[0] = nf;
 
-       if (AR_SREV_9280_10_OR_LATER(ah))
-               nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
-                       AR9280_PHY_CH1_MINCCA_PWR);
-       else
-               nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
-                       AR_PHY_CH1_MINCCA_PWR);
-
-       if (nf & 0x100)
-               nf = 0 - ((nf ^ 0x1ff) + 1);
-       DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-               "NF calibrated [ctl] [chain 1] is %d\n", nf);
-       nfarray[1] = nf;
+       if (!AR_SREV_9285(ah)) {
+               if (AR_SREV_9280_10_OR_LATER(ah))
+                       nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
+                                       AR9280_PHY_CH1_MINCCA_PWR);
+               else
+                       nf = MS(REG_READ(ah, AR_PHY_CH1_CCA),
+                                       AR_PHY_CH1_MINCCA_PWR);
 
-       if (!AR_SREV_9280(ah)) {
-               nf = MS(REG_READ(ah, AR_PHY_CH2_CCA),
-                       AR_PHY_CH2_MINCCA_PWR);
                if (nf & 0x100)
                        nf = 0 - ((nf ^ 0x1ff) + 1);
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-                       "NF calibrated [ctl] [chain 2] is %d\n", nf);
-               nfarray[2] = nf;
+                               "NF calibrated [ctl] [chain 1] is %d\n", nf);
+               nfarray[1] = nf;
+
+               if (!AR_SREV_9280(ah)) {
+                       nf = MS(REG_READ(ah, AR_PHY_CH2_CCA),
+                                       AR_PHY_CH2_MINCCA_PWR);
+                       if (nf & 0x100)
+                               nf = 0 - ((nf ^ 0x1ff) + 1);
+                       DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
+                               "NF calibrated [ctl] [chain 2] is %d\n", nf);
+                       nfarray[2] = nf;
+               }
        }
 
        if (AR_SREV_9280_10_OR_LATER(ah))
@@ -143,58 +140,52 @@ static void ath9k_hw_do_getnf(struct ath_hal *ah,
                "NF calibrated [ext] [chain 0] is %d\n", nf);
        nfarray[3] = nf;
 
-       if (AR_SREV_9280_10_OR_LATER(ah))
-               nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
-                       AR9280_PHY_CH1_EXT_MINCCA_PWR);
-       else
-               nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
-                       AR_PHY_CH1_EXT_MINCCA_PWR);
+       if (!AR_SREV_9285(ah)) {
+               if (AR_SREV_9280_10_OR_LATER(ah))
+                       nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
+                                       AR9280_PHY_CH1_EXT_MINCCA_PWR);
+               else
+                       nf = MS(REG_READ(ah, AR_PHY_CH1_EXT_CCA),
+                                       AR_PHY_CH1_EXT_MINCCA_PWR);
 
-       if (nf & 0x100)
-               nf = 0 - ((nf ^ 0x1ff) + 1);
-       DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-               "NF calibrated [ext] [chain 1] is %d\n", nf);
-       nfarray[4] = nf;
-
-       if (!AR_SREV_9280(ah)) {
-               nf = MS(REG_READ(ah, AR_PHY_CH2_EXT_CCA),
-                       AR_PHY_CH2_EXT_MINCCA_PWR);
                if (nf & 0x100)
                        nf = 0 - ((nf ^ 0x1ff) + 1);
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-                       "NF calibrated [ext] [chain 2] is %d\n", nf);
-               nfarray[5] = nf;
+                               "NF calibrated [ext] [chain 1] is %d\n", nf);
+               nfarray[4] = nf;
+
+               if (!AR_SREV_9280(ah)) {
+                       nf = MS(REG_READ(ah, AR_PHY_CH2_EXT_CCA),
+                                       AR_PHY_CH2_EXT_MINCCA_PWR);
+                       if (nf & 0x100)
+                               nf = 0 - ((nf ^ 0x1ff) + 1);
+                       DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
+                               "NF calibrated [ext] [chain 2] is %d\n", nf);
+                       nfarray[5] = nf;
+               }
        }
 }
 
-static bool getNoiseFloorThresh(struct ath_hal *ah,
-                               const struct ath9k_channel *chan,
+static bool getNoiseFloorThresh(struct ath_hw *ah,
+                               enum ieee80211_band band,
                                int16_t *nft)
 {
-       switch (chan->chanmode) {
-       case CHANNEL_A:
-       case CHANNEL_A_HT20:
-       case CHANNEL_A_HT40PLUS:
-       case CHANNEL_A_HT40MINUS:
-               *nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_5);
+       switch (band) {
+       case IEEE80211_BAND_5GHZ:
+               *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_5);
                break;
-       case CHANNEL_B:
-       case CHANNEL_G:
-       case CHANNEL_G_HT20:
-       case CHANNEL_G_HT40PLUS:
-       case CHANNEL_G_HT40MINUS:
-               *nft = (int8_t)ath9k_hw_get_eeprom(ah, EEP_NFTHRESH_2);
+       case IEEE80211_BAND_2GHZ:
+               *nft = (int8_t)ah->eep_ops->get_eeprom(ah, EEP_NFTHRESH_2);
                break;
        default:
-               DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-                       "invalid channel flags 0x%x\n", chan->channelFlags);
+               BUG_ON(1);
                return false;
        }
 
        return true;
 }
 
-static void ath9k_hw_setup_calibration(struct ath_hal *ah,
+static void ath9k_hw_setup_calibration(struct ath_hw *ah,
                                       struct hal_cal_list *currCal)
 {
        REG_RMW_FIELD(ah, AR_PHY_TIMING_CTRL4(0),
@@ -228,10 +219,9 @@ static void ath9k_hw_setup_calibration(struct ath_hal *ah,
                    AR_PHY_TIMING_CTRL4_DO_CAL);
 }
 
-static void ath9k_hw_reset_calibration(struct ath_hal *ah,
+static void ath9k_hw_reset_calibration(struct ath_hw *ah,
                                       struct hal_cal_list *currCal)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int i;
 
        ath9k_hw_setup_calibration(ah, currCal);
@@ -239,23 +229,21 @@ static void ath9k_hw_reset_calibration(struct ath_hal *ah,
        currCal->calState = CAL_RUNNING;
 
        for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-               ahp->ah_Meas0.sign[i] = 0;
-               ahp->ah_Meas1.sign[i] = 0;
-               ahp->ah_Meas2.sign[i] = 0;
-               ahp->ah_Meas3.sign[i] = 0;
+               ah->meas0.sign[i] = 0;
+               ah->meas1.sign[i] = 0;
+               ah->meas2.sign[i] = 0;
+               ah->meas3.sign[i] = 0;
        }
 
-       ahp->ah_CalSamples = 0;
+       ah->cal_samples = 0;
 }
 
-static void ath9k_hw_per_calibration(struct ath_hal *ah,
+static void ath9k_hw_per_calibration(struct ath_hw *ah,
                                     struct ath9k_channel *ichan,
                                     u8 rxchainmask,
                                     struct hal_cal_list *currCal,
                                     bool *isCalDone)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        *isCalDone = false;
 
        if (currCal->calState == CAL_RUNNING) {
@@ -263,9 +251,9 @@ static void ath9k_hw_per_calibration(struct ath_hal *ah,
                      AR_PHY_TIMING_CTRL4_DO_CAL)) {
 
                        currCal->calData->calCollect(ah);
-                       ahp->ah_CalSamples++;
+                       ah->cal_samples++;
 
-                       if (ahp->ah_CalSamples >= currCal->calData->calNumSamples) {
+                       if (ah->cal_samples >= currCal->calData->calNumSamples) {
                                int i, numChains = 0;
                                for (i = 0; i < AR5416_MAX_CHAINS; i++) {
                                        if (rxchainmask & (1 << i))
@@ -285,113 +273,105 @@ static void ath9k_hw_per_calibration(struct ath_hal *ah,
        }
 }
 
-static bool ath9k_hw_iscal_supported(struct ath_hal *ah,
-                                    struct ath9k_channel *chan,
+/* Assumes you are talking about the currently configured channel */
+static bool ath9k_hw_iscal_supported(struct ath_hw *ah,
                                     enum hal_cal_types calType)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       bool retval = false;
+       struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
 
-       switch (calType & ahp->ah_suppCals) {
-       case IQ_MISMATCH_CAL:
-               if (!IS_CHAN_B(chan))
-                       retval = true;
-               break;
+       switch (calType & ah->supp_cals) {
+       case IQ_MISMATCH_CAL: /* Both 2 GHz and 5 GHz support OFDM */
+               return true;
        case ADC_GAIN_CAL:
        case ADC_DC_CAL:
-               if (!IS_CHAN_B(chan)
-                   && !(IS_CHAN_2GHZ(chan) && IS_CHAN_HT20(chan)))
-                       retval = true;
+               if (conf->channel->band == IEEE80211_BAND_5GHZ &&
+                 conf_is_ht20(conf))
+                       return true;
                break;
        }
-
-       return retval;
+       return false;
 }
 
-static void ath9k_hw_iqcal_collect(struct ath_hal *ah)
+static void ath9k_hw_iqcal_collect(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int i;
 
        for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-               ahp->ah_totalPowerMeasI[i] +=
+               ah->totalPowerMeasI[i] +=
                        REG_READ(ah, AR_PHY_CAL_MEAS_0(i));
-               ahp->ah_totalPowerMeasQ[i] +=
+               ah->totalPowerMeasQ[i] +=
                        REG_READ(ah, AR_PHY_CAL_MEAS_1(i));
-               ahp->ah_totalIqCorrMeas[i] +=
+               ah->totalIqCorrMeas[i] +=
                        (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i));
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                        "%d: Chn %d pmi=0x%08x;pmq=0x%08x;iqcm=0x%08x;\n",
-                       ahp->ah_CalSamples, i, ahp->ah_totalPowerMeasI[i],
-                       ahp->ah_totalPowerMeasQ[i],
-                       ahp->ah_totalIqCorrMeas[i]);
+                       ah->cal_samples, i, ah->totalPowerMeasI[i],
+                       ah->totalPowerMeasQ[i],
+                       ah->totalIqCorrMeas[i]);
        }
 }
 
-static void ath9k_hw_adc_gaincal_collect(struct ath_hal *ah)
+static void ath9k_hw_adc_gaincal_collect(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int i;
 
        for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-               ahp->ah_totalAdcIOddPhase[i] +=
+               ah->totalAdcIOddPhase[i] +=
                        REG_READ(ah, AR_PHY_CAL_MEAS_0(i));
-               ahp->ah_totalAdcIEvenPhase[i] +=
+               ah->totalAdcIEvenPhase[i] +=
                        REG_READ(ah, AR_PHY_CAL_MEAS_1(i));
-               ahp->ah_totalAdcQOddPhase[i] +=
+               ah->totalAdcQOddPhase[i] +=
                        REG_READ(ah, AR_PHY_CAL_MEAS_2(i));
-               ahp->ah_totalAdcQEvenPhase[i] +=
+               ah->totalAdcQEvenPhase[i] +=
                        REG_READ(ah, AR_PHY_CAL_MEAS_3(i));
 
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                        "%d: Chn %d oddi=0x%08x; eveni=0x%08x; "
                        "oddq=0x%08x; evenq=0x%08x;\n",
-                       ahp->ah_CalSamples, i,
-                       ahp->ah_totalAdcIOddPhase[i],
-                       ahp->ah_totalAdcIEvenPhase[i],
-                       ahp->ah_totalAdcQOddPhase[i],
-                       ahp->ah_totalAdcQEvenPhase[i]);
+                       ah->cal_samples, i,
+                       ah->totalAdcIOddPhase[i],
+                       ah->totalAdcIEvenPhase[i],
+                       ah->totalAdcQOddPhase[i],
+                       ah->totalAdcQEvenPhase[i]);
        }
 }
 
-static void ath9k_hw_adc_dccal_collect(struct ath_hal *ah)
+static void ath9k_hw_adc_dccal_collect(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int i;
 
        for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-               ahp->ah_totalAdcDcOffsetIOddPhase[i] +=
+               ah->totalAdcDcOffsetIOddPhase[i] +=
                        (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_0(i));
-               ahp->ah_totalAdcDcOffsetIEvenPhase[i] +=
+               ah->totalAdcDcOffsetIEvenPhase[i] +=
                        (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_1(i));
-               ahp->ah_totalAdcDcOffsetQOddPhase[i] +=
+               ah->totalAdcDcOffsetQOddPhase[i] +=
                        (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_2(i));
-               ahp->ah_totalAdcDcOffsetQEvenPhase[i] +=
+               ah->totalAdcDcOffsetQEvenPhase[i] +=
                        (int32_t) REG_READ(ah, AR_PHY_CAL_MEAS_3(i));
 
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                        "%d: Chn %d oddi=0x%08x; eveni=0x%08x; "
                        "oddq=0x%08x; evenq=0x%08x;\n",
-                       ahp->ah_CalSamples, i,
-                       ahp->ah_totalAdcDcOffsetIOddPhase[i],
-                       ahp->ah_totalAdcDcOffsetIEvenPhase[i],
-                       ahp->ah_totalAdcDcOffsetQOddPhase[i],
-                       ahp->ah_totalAdcDcOffsetQEvenPhase[i]);
+                       ah->cal_samples, i,
+                       ah->totalAdcDcOffsetIOddPhase[i],
+                       ah->totalAdcDcOffsetIEvenPhase[i],
+                       ah->totalAdcDcOffsetQOddPhase[i],
+                       ah->totalAdcDcOffsetQEvenPhase[i]);
        }
 }
 
-static void ath9k_hw_iqcalibrate(struct ath_hal *ah, u8 numChains)
+static void ath9k_hw_iqcalibrate(struct ath_hw *ah, u8 numChains)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        u32 powerMeasQ, powerMeasI, iqCorrMeas;
        u32 qCoffDenom, iCoffDenom;
        int32_t qCoff, iCoff;
        int iqCorrNeg, i;
 
        for (i = 0; i < numChains; i++) {
-               powerMeasI = ahp->ah_totalPowerMeasI[i];
-               powerMeasQ = ahp->ah_totalPowerMeasQ[i];
-               iqCorrMeas = ahp->ah_totalIqCorrMeas[i];
+               powerMeasI = ah->totalPowerMeasI[i];
+               powerMeasQ = ah->totalPowerMeasQ[i];
+               iqCorrMeas = ah->totalIqCorrMeas[i];
 
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                        "Starting IQ Cal and Correction for Chain %d\n",
@@ -399,7 +379,7 @@ static void ath9k_hw_iqcalibrate(struct ath_hal *ah, u8 numChains)
 
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                        "Orignal: Chn %diq_corr_meas = 0x%08x\n",
-                       i, ahp->ah_totalIqCorrMeas[i]);
+                       i, ah->totalIqCorrMeas[i]);
 
                iqCorrNeg = 0;
 
@@ -457,17 +437,16 @@ static void ath9k_hw_iqcalibrate(struct ath_hal *ah, u8 numChains)
                    AR_PHY_TIMING_CTRL4_IQCORR_ENABLE);
 }
 
-static void ath9k_hw_adc_gaincal_calibrate(struct ath_hal *ah, u8 numChains)
+static void ath9k_hw_adc_gaincal_calibrate(struct ath_hw *ah, u8 numChains)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        u32 iOddMeasOffset, iEvenMeasOffset, qOddMeasOffset, qEvenMeasOffset;
        u32 qGainMismatch, iGainMismatch, val, i;
 
        for (i = 0; i < numChains; i++) {
-               iOddMeasOffset = ahp->ah_totalAdcIOddPhase[i];
-               iEvenMeasOffset = ahp->ah_totalAdcIEvenPhase[i];
-               qOddMeasOffset = ahp->ah_totalAdcQOddPhase[i];
-               qEvenMeasOffset = ahp->ah_totalAdcQEvenPhase[i];
+               iOddMeasOffset = ah->totalAdcIOddPhase[i];
+               iEvenMeasOffset = ah->totalAdcIEvenPhase[i];
+               qOddMeasOffset = ah->totalAdcQOddPhase[i];
+               qEvenMeasOffset = ah->totalAdcQEvenPhase[i];
 
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                        "Starting ADC Gain Cal for Chain %d\n", i);
@@ -515,21 +494,20 @@ static void ath9k_hw_adc_gaincal_calibrate(struct ath_hal *ah, u8 numChains)
                  AR_PHY_NEW_ADC_GAIN_CORR_ENABLE);
 }
 
-static void ath9k_hw_adc_dccal_calibrate(struct ath_hal *ah, u8 numChains)
+static void ath9k_hw_adc_dccal_calibrate(struct ath_hw *ah, u8 numChains)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        u32 iOddMeasOffset, iEvenMeasOffset, val, i;
        int32_t qOddMeasOffset, qEvenMeasOffset, qDcMismatch, iDcMismatch;
        const struct hal_percal_data *calData =
-               ahp->ah_cal_list_curr->calData;
+               ah->cal_list_curr->calData;
        u32 numSamples =
                (1 << (calData->calCountMax + 5)) * calData->calNumSamples;
 
        for (i = 0; i < numChains; i++) {
-               iOddMeasOffset = ahp->ah_totalAdcDcOffsetIOddPhase[i];
-               iEvenMeasOffset = ahp->ah_totalAdcDcOffsetIEvenPhase[i];
-               qOddMeasOffset = ahp->ah_totalAdcDcOffsetQOddPhase[i];
-               qEvenMeasOffset = ahp->ah_totalAdcDcOffsetQEvenPhase[i];
+               iOddMeasOffset = ah->totalAdcDcOffsetIOddPhase[i];
+               iEvenMeasOffset = ah->totalAdcDcOffsetIEvenPhase[i];
+               qOddMeasOffset = ah->totalAdcDcOffsetQOddPhase[i];
+               qEvenMeasOffset = ah->totalAdcDcOffsetQEvenPhase[i];
 
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                        "Starting ADC DC Offset Cal for Chain %d\n", i);
@@ -573,53 +551,42 @@ static void ath9k_hw_adc_dccal_calibrate(struct ath_hal *ah, u8 numChains)
                  AR_PHY_NEW_ADC_DC_OFFSET_CORR_ENABLE);
 }
 
-void ath9k_hw_reset_calvalid(struct ath_hal *ah, struct ath9k_channel *chan,
-                            bool *isCalDone)
+/* This is done for the currently configured channel */
+bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_channel *ichan =
-               ath9k_regd_check_channel(ah, chan);
-       struct hal_cal_list *currCal = ahp->ah_cal_list_curr;
+       struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
+       struct hal_cal_list *currCal = ah->cal_list_curr;
 
-       *isCalDone = true;
+       if (!ah->curchan)
+               return true;
 
        if (!AR_SREV_9100(ah) && !AR_SREV_9160_10_OR_LATER(ah))
-               return;
+               return true;
 
        if (currCal == NULL)
-               return;
-
-       if (ichan == NULL) {
-               DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-                       "invalid channel %u/0x%x; no mapping\n",
-                       chan->channel, chan->channelFlags);
-               return;
-       }
-
+               return true;
 
        if (currCal->calState != CAL_DONE) {
                DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                        "Calibration state incorrect, %d\n",
                        currCal->calState);
-               return;
+               return true;
        }
 
-
-       if (!ath9k_hw_iscal_supported(ah, chan, currCal->calData->calType))
-               return;
+       if (!ath9k_hw_iscal_supported(ah, currCal->calData->calType))
+               return true;
 
        DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-               "Resetting Cal %d state for channel %u/0x%x\n",
-               currCal->calData->calType, chan->channel,
-               chan->channelFlags);
+               "Resetting Cal %d state for channel %u\n",
+               currCal->calData->calType, conf->channel->center_freq);
 
-       ichan->CalValid &= ~currCal->calData->calType;
+       ah->curchan->CalValid &= ~currCal->calData->calType;
        currCal->calState = CAL_WAITING;
 
-       *isCalDone = false;
+       return false;
 }
 
-void ath9k_hw_start_nfcal(struct ath_hal *ah)
+void ath9k_hw_start_nfcal(struct ath_hw *ah)
 {
        REG_SET_BIT(ah, AR_PHY_AGC_CONTROL,
                    AR_PHY_AGC_CONTROL_ENABLE_NF);
@@ -628,7 +595,7 @@ void ath9k_hw_start_nfcal(struct ath_hal *ah)
        REG_SET_BIT(ah, AR_PHY_AGC_CONTROL, AR_PHY_AGC_CONTROL_NF);
 }
 
-void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan)
+void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
 {
        struct ath9k_nfcal_hist *h;
        int i, j;
@@ -643,16 +610,14 @@ void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan)
        };
        u8 chainmask;
 
-       if (AR_SREV_9280(ah))
+       if (AR_SREV_9285(ah))
+               chainmask = 0x9;
+       else if (AR_SREV_9280(ah))
                chainmask = 0x1B;
        else
                chainmask = 0x3F;
 
-#ifdef ATH_NF_PER_CHAN
-       h = chan->nfCalHist;
-#else
        h = ah->nfCalHist;
-#endif
 
        for (i = 0; i < NUM_NF_READINGS; i++) {
                if (chainmask & (1 << i)) {
@@ -686,18 +651,13 @@ void ath9k_hw_loadnf(struct ath_hal *ah, struct ath9k_channel *chan)
        }
 }
 
-int16_t ath9k_hw_getnf(struct ath_hal *ah,
+int16_t ath9k_hw_getnf(struct ath_hw *ah,
                       struct ath9k_channel *chan)
 {
        int16_t nf, nfThresh;
        int16_t nfarray[NUM_NF_READINGS] = { 0 };
        struct ath9k_nfcal_hist *h;
-       u8 chainmask;
-
-       if (AR_SREV_9280(ah))
-               chainmask = 0x1B;
-       else
-               chainmask = 0x3F;
+       struct ieee80211_channel *c = chan->chan;
 
        chan->channelFlags &= (~CHANNEL_CW_INT);
        if (REG_READ(ah, AR_PHY_AGC_CONTROL) & AR_PHY_AGC_CONTROL_NF) {
@@ -709,7 +669,7 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah,
        } else {
                ath9k_hw_do_getnf(ah, nfarray);
                nf = nfarray[0];
-               if (getNoiseFloorThresh(ah, chan, &nfThresh)
+               if (getNoiseFloorThresh(ah, c->band, &nfThresh)
                    && nf > nfThresh) {
                        DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                                "noise floor failed detected; "
@@ -719,11 +679,7 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah,
                }
        }
 
-#ifdef ATH_NF_PER_CHAN
-       h = chan->nfCalHist;
-#else
        h = ah->nfCalHist;
-#endif
 
        ath9k_hw_update_nfcal_hist_buffer(h, nfarray);
        chan->rawNoiseFloor = h[0].privNF;
@@ -731,7 +687,7 @@ int16_t ath9k_hw_getnf(struct ath_hal *ah,
        return chan->rawNoiseFloor;
 }
 
-void ath9k_init_nfcal_hist_buffer(struct ath_hal *ah)
+void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah)
 {
        int i, j;
 
@@ -745,26 +701,16 @@ void ath9k_init_nfcal_hist_buffer(struct ath_hal *ah)
                                AR_PHY_CCA_MAX_GOOD_VALUE;
                }
        }
-       return;
 }
 
-s16 ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan)
+s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan)
 {
-       struct ath9k_channel *ichan;
        s16 nf;
 
-       ichan = ath9k_regd_check_channel(ah, chan);
-       if (ichan == NULL) {
-               DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
-                       "invalid channel %u/0x%x; no mapping\n",
-                       chan->channel, chan->channelFlags);
-               return ATH_DEFAULT_NOISE_FLOOR;
-       }
-       if (ichan->rawNoiseFloor == 0) {
-               enum wireless_mode mode = ath9k_hw_chan2wmode(ah, chan);
-               nf = NOISE_FLOOR[mode];
-       } else
-               nf = ichan->rawNoiseFloor;
+       if (chan->rawNoiseFloor == 0)
+               nf = -96;
+       else
+               nf = chan->rawNoiseFloor;
 
        if (!ath9k_hw_nf_in_range(ah, nf))
                nf = ATH_DEFAULT_NOISE_FLOOR;
@@ -772,30 +718,21 @@ s16 ath9k_hw_getchan_noise(struct ath_hal *ah, struct ath9k_channel *chan)
        return nf;
 }
 
-bool ath9k_hw_calibrate(struct ath_hal *ah, struct ath9k_channel *chan,
+bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
                        u8 rxchainmask, bool longcal,
                        bool *isCalDone)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct hal_cal_list *currCal = ahp->ah_cal_list_curr;
-       struct ath9k_channel *ichan = ath9k_regd_check_channel(ah, chan);
+       struct hal_cal_list *currCal = ah->cal_list_curr;
 
        *isCalDone = true;
 
-       if (ichan == NULL) {
-               DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-                       "invalid channel %u/0x%x; no mapping\n",
-                       chan->channel, chan->channelFlags);
-               return false;
-       }
-
        if (currCal &&
            (currCal->calState == CAL_RUNNING ||
             currCal->calState == CAL_WAITING)) {
-               ath9k_hw_per_calibration(ah, ichan, rxchainmask, currCal,
+               ath9k_hw_per_calibration(ah, chan, rxchainmask, currCal,
                                         isCalDone);
                if (*isCalDone) {
-                       ahp->ah_cal_list_curr = currCal = currCal->calNext;
+                       ah->cal_list_curr = currCal = currCal->calNext;
 
                        if (currCal->calState == CAL_WAITING) {
                                *isCalDone = false;
@@ -805,20 +742,18 @@ bool ath9k_hw_calibrate(struct ath_hal *ah, struct ath9k_channel *chan,
        }
 
        if (longcal) {
-               ath9k_hw_getnf(ah, ichan);
-               ath9k_hw_loadnf(ah, ah->ah_curchan);
+               ath9k_hw_getnf(ah, chan);
+               ath9k_hw_loadnf(ah, ah->curchan);
                ath9k_hw_start_nfcal(ah);
 
-               if ((ichan->channelFlags & CHANNEL_CW_INT) != 0) {
-                       chan->channelFlags |= CHANNEL_CW_INT;
-                       ichan->channelFlags &= ~CHANNEL_CW_INT;
-               }
+               if (chan->channelFlags & CHANNEL_CW_INT)
+                       chan->channelFlags &= ~CHANNEL_CW_INT;
        }
 
        return true;
 }
 
-static inline void ath9k_hw_9285_pa_cal(struct ath_hal *ah)
+static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah)
 {
 
        u32 regVal;
@@ -913,12 +848,9 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hal *ah)
 
 }
 
-bool ath9k_hw_init_cal(struct ath_hal *ah,
+bool ath9k_hw_init_cal(struct ath_hw *ah,
                       struct ath9k_channel *chan)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_channel *ichan = ath9k_regd_check_channel(ah, chan);
-
        REG_WRITE(ah, AR_PHY_AGC_CONTROL,
                  REG_READ(ah, AR_PHY_AGC_CONTROL) |
                  AR_PHY_AGC_CONTROL_CAL);
@@ -937,35 +869,35 @@ bool ath9k_hw_init_cal(struct ath_hal *ah,
                  REG_READ(ah, AR_PHY_AGC_CONTROL) |
                  AR_PHY_AGC_CONTROL_NF);
 
-       ahp->ah_cal_list = ahp->ah_cal_list_last = ahp->ah_cal_list_curr = NULL;
+       ah->cal_list = ah->cal_list_last = ah->cal_list_curr = NULL;
 
        if (AR_SREV_9100(ah) || AR_SREV_9160_10_OR_LATER(ah)) {
-               if (ath9k_hw_iscal_supported(ah, chan, ADC_GAIN_CAL)) {
-                       INIT_CAL(&ahp->ah_adcGainCalData);
-                       INSERT_CAL(ahp, &ahp->ah_adcGainCalData);
+               if (ath9k_hw_iscal_supported(ah, ADC_GAIN_CAL)) {
+                       INIT_CAL(&ah->adcgain_caldata);
+                       INSERT_CAL(ah, &ah->adcgain_caldata);
                        DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                                "enabling ADC Gain Calibration.\n");
                }
-               if (ath9k_hw_iscal_supported(ah, chan, ADC_DC_CAL)) {
-                       INIT_CAL(&ahp->ah_adcDcCalData);
-                       INSERT_CAL(ahp, &ahp->ah_adcDcCalData);
+               if (ath9k_hw_iscal_supported(ah, ADC_DC_CAL)) {
+                       INIT_CAL(&ah->adcdc_caldata);
+                       INSERT_CAL(ah, &ah->adcdc_caldata);
                        DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                                "enabling ADC DC Calibration.\n");
                }
-               if (ath9k_hw_iscal_supported(ah, chan, IQ_MISMATCH_CAL)) {
-                       INIT_CAL(&ahp->ah_iqCalData);
-                       INSERT_CAL(ahp, &ahp->ah_iqCalData);
+               if (ath9k_hw_iscal_supported(ah, IQ_MISMATCH_CAL)) {
+                       INIT_CAL(&ah->iq_caldata);
+                       INSERT_CAL(ah, &ah->iq_caldata);
                        DPRINTF(ah->ah_sc, ATH_DBG_CALIBRATE,
                                "enabling IQ Calibration.\n");
                }
 
-               ahp->ah_cal_list_curr = ahp->ah_cal_list;
+               ah->cal_list_curr = ah->cal_list;
 
-               if (ahp->ah_cal_list_curr)
-                       ath9k_hw_reset_calibration(ah, ahp->ah_cal_list_curr);
+               if (ah->cal_list_curr)
+                       ath9k_hw_reset_calibration(ah, ah->cal_list_curr);
        }
 
-       ichan->CalValid = 0;
+       chan->CalValid = 0;
 
        return true;
 }
diff --git a/drivers/net/wireless/ath9k/calib.h b/drivers/net/wireless/ath9k/calib.h
new file mode 100644 (file)
index 0000000..d2448f0
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef CALIB_H
+#define CALIB_H
+
+extern const struct hal_percal_data iq_cal_multi_sample;
+extern const struct hal_percal_data iq_cal_single_sample;
+extern const struct hal_percal_data adc_gain_cal_multi_sample;
+extern const struct hal_percal_data adc_gain_cal_single_sample;
+extern const struct hal_percal_data adc_dc_cal_multi_sample;
+extern const struct hal_percal_data adc_dc_cal_single_sample;
+extern const struct hal_percal_data adc_init_dc_cal;
+
+#define AR_PHY_CCA_MAX_GOOD_VALUE                      -85
+#define AR_PHY_CCA_MAX_HIGH_VALUE                      -62
+#define AR_PHY_CCA_MIN_BAD_VALUE                       -121
+#define AR_PHY_CCA_FILTERWINDOW_LENGTH_INIT     3
+#define AR_PHY_CCA_FILTERWINDOW_LENGTH          5
+
+#define NUM_NF_READINGS       6
+#define ATH9K_NF_CAL_HIST_MAX 5
+
+struct ar5416IniArray {
+       u32 *ia_array;
+       u32 ia_rows;
+       u32 ia_columns;
+};
+
+#define INIT_INI_ARRAY(iniarray, array, rows, columns) do {    \
+               (iniarray)->ia_array = (u32 *)(array);          \
+               (iniarray)->ia_rows = (rows);                   \
+               (iniarray)->ia_columns = (columns);             \
+       } while (0)
+
+#define INI_RA(iniarray, row, column) \
+       (((iniarray)->ia_array)[(row) * ((iniarray)->ia_columns) + (column)])
+
+#define INIT_CAL(_perCal) do {                         \
+               (_perCal)->calState = CAL_WAITING;      \
+               (_perCal)->calNext = NULL;              \
+       } while (0)
+
+#define INSERT_CAL(_ahp, _perCal)                                      \
+       do {                                                            \
+               if ((_ahp)->cal_list_last == NULL) {                    \
+                       (_ahp)->cal_list =                              \
+                               (_ahp)->cal_list_last = (_perCal);      \
+                       ((_ahp)->cal_list_last)->calNext = (_perCal); \
+               } else {                                                \
+                       ((_ahp)->cal_list_last)->calNext = (_perCal); \
+                       (_ahp)->cal_list_last = (_perCal);              \
+                       (_perCal)->calNext = (_ahp)->cal_list;  \
+               }                                                       \
+       } while (0)
+
+enum hal_cal_types {
+       ADC_DC_INIT_CAL = 0x1,
+       ADC_GAIN_CAL = 0x2,
+       ADC_DC_CAL = 0x4,
+       IQ_MISMATCH_CAL = 0x8
+};
+
+enum hal_cal_state {
+       CAL_INACTIVE,
+       CAL_WAITING,
+       CAL_RUNNING,
+       CAL_DONE
+};
+
+#define MIN_CAL_SAMPLES     1
+#define MAX_CAL_SAMPLES    64
+#define INIT_LOG_COUNT      5
+#define PER_MIN_LOG_COUNT   2
+#define PER_MAX_LOG_COUNT  10
+
+struct hal_percal_data {
+       enum hal_cal_types calType;
+       u32 calNumSamples;
+       u32 calCountMax;
+       void (*calCollect) (struct ath_hw *);
+       void (*calPostProc) (struct ath_hw *, u8);
+};
+
+struct hal_cal_list {
+       const struct hal_percal_data *calData;
+       enum hal_cal_state calState;
+       struct hal_cal_list *calNext;
+};
+
+struct ath9k_nfcal_hist {
+       int16_t nfCalBuffer[ATH9K_NF_CAL_HIST_MAX];
+       u8 currIndex;
+       int16_t privNF;
+       u8 invalidNFcount;
+};
+
+bool ath9k_hw_reset_calvalid(struct ath_hw *ah);
+void ath9k_hw_start_nfcal(struct ath_hw *ah);
+void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan);
+int16_t ath9k_hw_getnf(struct ath_hw *ah,
+                      struct ath9k_channel *chan);
+void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah);
+s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan);
+bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan,
+                       u8 rxchainmask, bool longcal,
+                       bool *isCalDone);
+bool ath9k_hw_init_cal(struct ath_hw *ah,
+                      struct ath9k_channel *chan);
+
+#endif /* CALIB_H */
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
deleted file mode 100644 (file)
index 4ca2aed..0000000
+++ /dev/null
@@ -1,754 +0,0 @@
-/*
- * Copyright (c) 2008 Atheros Communications Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifndef CORE_H
-#define CORE_H
-
-#include <linux/etherdevice.h>
-#include <linux/pci.h>
-#include <net/mac80211.h>
-#include <linux/leds.h>
-#include <linux/rfkill.h>
-
-#include "ath9k.h"
-#include "rc.h"
-
-struct ath_node;
-
-/* Macro to expand scalars to 64-bit objects */
-
-#define        ito64(x) (sizeof(x) == 8) ?                     \
-       (((unsigned long long int)(x)) & (0xff)) :      \
-       (sizeof(x) == 16) ?                             \
-       (((unsigned long long int)(x)) & 0xffff) :      \
-       ((sizeof(x) == 32) ?                            \
-        (((unsigned long long int)(x)) & 0xffffffff) : \
-        (unsigned long long int)(x))
-
-/* increment with wrap-around */
-#define INCR(_l, _sz)   do {                   \
-               (_l)++;                         \
-               (_l) &= ((_sz) - 1);            \
-       } while (0)
-
-/* decrement with wrap-around */
-#define DECR(_l,  _sz)  do {                   \
-               (_l)--;                         \
-               (_l) &= ((_sz) - 1);            \
-       } while (0)
-
-#define A_MAX(a, b) ((a) > (b) ? (a) : (b))
-
-#define ASSERT(exp) do {                       \
-               if (unlikely(!(exp))) {         \
-                       BUG();                  \
-               }                               \
-       } while (0)
-
-#define TSF_TO_TU(_h,_l) \
-       ((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
-
-#define        ATH_TXQ_SETUP(sc, i)        ((sc)->tx.txqsetup & (1<<i))
-
-static const u8 ath_bcast_mac[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
-
-enum ATH_DEBUG {
-       ATH_DBG_RESET           = 0x00000001,
-       ATH_DBG_REG_IO          = 0x00000002,
-       ATH_DBG_QUEUE           = 0x00000004,
-       ATH_DBG_EEPROM          = 0x00000008,
-       ATH_DBG_CALIBRATE       = 0x00000010,
-       ATH_DBG_CHANNEL         = 0x00000020,
-       ATH_DBG_INTERRUPT       = 0x00000040,
-       ATH_DBG_REGULATORY      = 0x00000080,
-       ATH_DBG_ANI             = 0x00000100,
-       ATH_DBG_POWER_MGMT      = 0x00000200,
-       ATH_DBG_XMIT            = 0x00000400,
-       ATH_DBG_BEACON          = 0x00001000,
-       ATH_DBG_CONFIG          = 0x00002000,
-       ATH_DBG_KEYCACHE        = 0x00004000,
-       ATH_DBG_FATAL           = 0x00008000,
-       ATH_DBG_ANY             = 0xffffffff
-};
-
-#define DBG_DEFAULT (ATH_DBG_FATAL)
-
-#ifdef CONFIG_ATH9K_DEBUG
-
-/**
- * struct ath_interrupt_stats - Contains statistics about interrupts
- * @total: Total no. of interrupts generated so far
- * @rxok: RX with no errors
- * @rxeol: RX with no more RXDESC available
- * @rxorn: RX FIFO overrun
- * @txok: TX completed at the requested rate
- * @txurn: TX FIFO underrun
- * @mib: MIB regs reaching its threshold
- * @rxphyerr: RX with phy errors
- * @rx_keycache_miss: RX with key cache misses
- * @swba: Software Beacon Alert
- * @bmiss: Beacon Miss
- * @bnr: Beacon Not Ready
- * @cst: Carrier Sense TImeout
- * @gtt: Global TX Timeout
- * @tim: RX beacon TIM occurrence
- * @cabend: RX End of CAB traffic
- * @dtimsync: DTIM sync lossage
- * @dtim: RX Beacon with DTIM
- */
-struct ath_interrupt_stats {
-       u32 total;
-       u32 rxok;
-       u32 rxeol;
-       u32 rxorn;
-       u32 txok;
-       u32 txeol;
-       u32 txurn;
-       u32 mib;
-       u32 rxphyerr;
-       u32 rx_keycache_miss;
-       u32 swba;
-       u32 bmiss;
-       u32 bnr;
-       u32 cst;
-       u32 gtt;
-       u32 tim;
-       u32 cabend;
-       u32 dtimsync;
-       u32 dtim;
-};
-
-struct ath_stats {
-       struct ath_interrupt_stats istats;
-};
-
-struct ath9k_debug {
-       int debug_mask;
-       struct dentry *debugfs_root;
-       struct dentry *debugfs_phy;
-       struct dentry *debugfs_dma;
-       struct dentry *debugfs_interrupt;
-       struct ath_stats stats;
-};
-
-void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
-int ath9k_init_debug(struct ath_softc *sc);
-void ath9k_exit_debug(struct ath_softc *sc);
-void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
-
-#else
-
-static inline void DPRINTF(struct ath_softc *sc, int dbg_mask,
-                          const char *fmt, ...)
-{
-}
-
-static inline int ath9k_init_debug(struct ath_softc *sc)
-{
-       return 0;
-}
-
-static inline void ath9k_exit_debug(struct ath_softc *sc)
-{
-}
-
-static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
-                                           enum ath9k_int status)
-{
-}
-
-#endif /* CONFIG_ATH9K_DEBUG */
-
-struct ath_config {
-       u32 ath_aggr_prot;
-       u16 txpowlimit;
-       u16 txpowlimit_override;
-       u8 cabqReadytime;
-       u8 swBeaconProcess;
-};
-
-/*************************/
-/* Descriptor Management */
-/*************************/
-
-#define ATH_TXBUF_RESET(_bf) do {                              \
-               (_bf)->bf_status = 0;                           \
-               (_bf)->bf_lastbf = NULL;                        \
-               (_bf)->bf_lastfrm = NULL;                       \
-               (_bf)->bf_next = NULL;                          \
-               memset(&((_bf)->bf_state), 0,                   \
-                           sizeof(struct ath_buf_state));      \
-       } while (0)
-
-enum buffer_type {
-       BUF_DATA                = BIT(0),
-       BUF_AGGR                = BIT(1),
-       BUF_AMPDU               = BIT(2),
-       BUF_HT                  = BIT(3),
-       BUF_RETRY               = BIT(4),
-       BUF_XRETRY              = BIT(5),
-       BUF_SHORT_PREAMBLE      = BIT(6),
-       BUF_BAR                 = BIT(7),
-       BUF_PSPOLL              = BIT(8),
-       BUF_AGGR_BURST          = BIT(9),
-       BUF_CALC_AIRTIME        = BIT(10),
-};
-
-struct ath_buf_state {
-       int bfs_nframes;                /* # frames in aggregate */
-       u16 bfs_al;                     /* length of aggregate */
-       u16 bfs_frmlen;                 /* length of frame */
-       int bfs_seqno;                  /* sequence number */
-       int bfs_tidno;                  /* tid of this frame */
-       int bfs_retries;                /* current retries */
-       u32 bf_type;                    /* BUF_* (enum buffer_type) */
-       u32 bfs_keyix;
-       enum ath9k_key_type bfs_keytype;
-};
-
-#define bf_nframes             bf_state.bfs_nframes
-#define bf_al                  bf_state.bfs_al
-#define bf_frmlen              bf_state.bfs_frmlen
-#define bf_retries             bf_state.bfs_retries
-#define bf_seqno               bf_state.bfs_seqno
-#define bf_tidno               bf_state.bfs_tidno
-#define bf_rcs                 bf_state.bfs_rcs
-#define bf_keyix                bf_state.bfs_keyix
-#define bf_keytype             bf_state.bfs_keytype
-#define bf_isdata(bf)          (bf->bf_state.bf_type & BUF_DATA)
-#define bf_isaggr(bf)          (bf->bf_state.bf_type & BUF_AGGR)
-#define bf_isampdu(bf)         (bf->bf_state.bf_type & BUF_AMPDU)
-#define bf_isht(bf)            (bf->bf_state.bf_type & BUF_HT)
-#define bf_isretried(bf)       (bf->bf_state.bf_type & BUF_RETRY)
-#define bf_isxretried(bf)      (bf->bf_state.bf_type & BUF_XRETRY)
-#define bf_isshpreamble(bf)    (bf->bf_state.bf_type & BUF_SHORT_PREAMBLE)
-#define bf_isbar(bf)           (bf->bf_state.bf_type & BUF_BAR)
-#define bf_ispspoll(bf)        (bf->bf_state.bf_type & BUF_PSPOLL)
-#define bf_isaggrburst(bf)     (bf->bf_state.bf_type & BUF_AGGR_BURST)
-
-/*
- * Abstraction of a contiguous buffer to transmit/receive.  There is only
- * a single hw descriptor encapsulated here.
- */
-struct ath_buf {
-       struct list_head list;
-       struct list_head *last;
-       struct ath_buf *bf_lastbf;      /* last buf of this unit (a frame or
-                                          an aggregate) */
-       struct ath_buf *bf_lastfrm;     /* last buf of this frame */
-       struct ath_buf *bf_next;        /* next subframe in the aggregate */
-       void *bf_mpdu;                  /* enclosing frame structure */
-       struct ath_desc *bf_desc;       /* virtual addr of desc */
-       dma_addr_t bf_daddr;            /* physical addr of desc */
-       dma_addr_t bf_buf_addr;         /* physical addr of data buffer */
-       u32 bf_status;
-       u16 bf_flags;                   /* tx descriptor flags */
-       struct ath_buf_state bf_state;  /* buffer state */
-       dma_addr_t bf_dmacontext;
-};
-
-#define ATH_RXBUF_RESET(_bf)    ((_bf)->bf_status = 0)
-
-/* hw processing complete, desc processed by hal */
-#define ATH_BUFSTATUS_DONE      0x00000001
-/* hw processing complete, desc hold for hw */
-#define ATH_BUFSTATUS_STALE     0x00000002
-/* Rx-only: OS is done with this packet and it's ok to queued it to hw */
-#define ATH_BUFSTATUS_FREE      0x00000004
-
-/* DMA state for tx/rx descriptors */
-
-struct ath_descdma {
-       const char *dd_name;
-       struct ath_desc *dd_desc;       /* descriptors  */
-       dma_addr_t dd_desc_paddr;       /* physical addr of dd_desc  */
-       u32 dd_desc_len;                /* size of dd_desc  */
-       struct ath_buf *dd_bufptr;      /* associated buffers */
-       dma_addr_t dd_dmacontext;
-};
-
-int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
-                     struct list_head *head, const char *name,
-                     int nbuf, int ndesc);
-void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *dd,
-                        struct list_head *head);
-
-/***********/
-/* RX / TX */
-/***********/
-
-#define ATH_MAX_ANTENNA         3
-#define ATH_RXBUF               512
-#define WME_NUM_TID             16
-#define ATH_TXBUF               512
-#define ATH_TXMAXTRY            13
-#define ATH_11N_TXMAXTRY        10
-#define ATH_MGT_TXMAXTRY        4
-#define WME_BA_BMP_SIZE         64
-#define WME_MAX_BA              WME_BA_BMP_SIZE
-#define ATH_TID_MAX_BUFS        (2 * WME_MAX_BA)
-
-#define TID_TO_WME_AC(_tid)                            \
-       ((((_tid) == 0) || ((_tid) == 3)) ? WME_AC_BE : \
-        (((_tid) == 1) || ((_tid) == 2)) ? WME_AC_BK : \
-        (((_tid) == 4) || ((_tid) == 5)) ? WME_AC_VI : \
-        WME_AC_VO)
-
-#define WME_AC_BE   0
-#define WME_AC_BK   1
-#define WME_AC_VI   2
-#define WME_AC_VO   3
-#define WME_NUM_AC  4
-
-#define ADDBA_EXCHANGE_ATTEMPTS    10
-#define ATH_AGGR_DELIM_SZ          4
-#define ATH_AGGR_MINPLEN           256 /* in bytes, minimum packet length */
-/* number of delimiters for encryption padding */
-#define ATH_AGGR_ENCRYPTDELIM      10
-/* minimum h/w qdepth to be sustained to maximize aggregation */
-#define ATH_AGGR_MIN_QDEPTH        2
-#define ATH_AMPDU_SUBFRAME_DEFAULT 32
-#define IEEE80211_SEQ_SEQ_SHIFT    4
-#define IEEE80211_SEQ_MAX          4096
-#define IEEE80211_MIN_AMPDU_BUF    0x8
-#define IEEE80211_HTCAP_MAXRXAMPDU_FACTOR 13
-
-/* return whether a bit at index _n in bitmap _bm is set
- * _sz is the size of the bitmap  */
-#define ATH_BA_ISSET(_bm, _n)  (((_n) < (WME_BA_BMP_SIZE)) &&          \
-                               ((_bm)[(_n) >> 5] & (1 << ((_n) & 31))))
-
-/* return block-ack bitmap index given sequence and starting sequence */
-#define ATH_BA_INDEX(_st, _seq) (((_seq) - (_st)) & (IEEE80211_SEQ_MAX - 1))
-
-/* returns delimiter padding required given the packet length */
-#define ATH_AGGR_GET_NDELIM(_len)                                      \
-       (((((_len) + ATH_AGGR_DELIM_SZ) < ATH_AGGR_MINPLEN) ?           \
-         (ATH_AGGR_MINPLEN - (_len) - ATH_AGGR_DELIM_SZ) : 0) >> 2)
-
-#define BAW_WITHIN(_start, _bawsz, _seqno) \
-       ((((_seqno) - (_start)) & 4095) < (_bawsz))
-
-#define ATH_DS_BA_SEQ(_ds)         ((_ds)->ds_us.tx.ts_seqnum)
-#define ATH_DS_BA_BITMAP(_ds)      (&(_ds)->ds_us.tx.ba_low)
-#define ATH_DS_TX_BA(_ds)          ((_ds)->ds_us.tx.ts_flags & ATH9K_TX_BA)
-#define ATH_AN_2_TID(_an, _tidno)  (&(_an)->tid[(_tidno)])
-
-enum ATH_AGGR_STATUS {
-       ATH_AGGR_DONE,
-       ATH_AGGR_BAW_CLOSED,
-       ATH_AGGR_LIMITED,
-       ATH_AGGR_SHORTPKT,
-       ATH_AGGR_8K_LIMITED,
-};
-
-struct ath_txq {
-       u32 axq_qnum;                   /* hardware q number */
-       u32 *axq_link;                  /* link ptr in last TX desc */
-       struct list_head axq_q;         /* transmit queue */
-       spinlock_t axq_lock;
-       unsigned long axq_lockflags;    /* intr state when must cli */
-       u32 axq_depth;                  /* queue depth */
-       u8 axq_aggr_depth;              /* aggregates queued */
-       u32 axq_totalqueued;            /* total ever queued */
-       bool stopped;                   /* Is mac80211 queue stopped ? */
-       struct ath_buf *axq_linkbuf;    /* virtual addr of last buffer*/
-
-       /* first desc of the last descriptor that contains CTS */
-       struct ath_desc *axq_lastdsWithCTS;
-
-       /* final desc of the gating desc that determines whether
-          lastdsWithCTS has been DMA'ed or not */
-       struct ath_desc *axq_gatingds;
-
-       struct list_head axq_acq;
-};
-
-#define AGGR_CLEANUP         BIT(1)
-#define AGGR_ADDBA_COMPLETE  BIT(2)
-#define AGGR_ADDBA_PROGRESS  BIT(3)
-
-/* per TID aggregate tx state for a destination */
-struct ath_atx_tid {
-       struct list_head list;          /* round-robin tid entry */
-       struct list_head buf_q;         /* pending buffers */
-       struct ath_node *an;
-       struct ath_atx_ac *ac;
-       struct ath_buf *tx_buf[ATH_TID_MAX_BUFS]; /* active tx frames */
-       u16 seq_start;
-       u16 seq_next;
-       u16 baw_size;
-       int tidno;
-       int baw_head;                   /* first un-acked tx buffer */
-       int baw_tail;                   /* next unused tx buffer slot */
-       int sched;
-       int paused;
-       u8 state;
-       int addba_exchangeattempts;
-};
-
-/* per access-category aggregate tx state for a destination */
-struct ath_atx_ac {
-       int sched;                      /* dest-ac is scheduled */
-       int qnum;                       /* H/W queue number associated
-                                          with this AC */
-       struct list_head list;          /* round-robin txq entry */
-       struct list_head tid_q;         /* queue of TIDs with buffers */
-};
-
-/* per-frame tx control block */
-struct ath_tx_control {
-       struct ath_txq *txq;
-       int if_id;
-};
-
-/* per frame tx status block */
-struct ath_xmit_status {
-       int retries;    /* number of retries to successufully
-                          transmit this frame */
-       int flags;      /* status of transmit */
-#define ATH_TX_ERROR        0x01
-#define ATH_TX_XRETRY       0x02
-#define ATH_TX_BAR          0x04
-};
-
-/* All RSSI values are noise floor adjusted */
-struct ath_tx_stat {
-       int rssi;
-       int rssictl[ATH_MAX_ANTENNA];
-       int rssiextn[ATH_MAX_ANTENNA];
-       int rateieee;
-       int rateKbps;
-       int ratecode;
-       int flags;
-       u32 airtime;    /* time on air per final tx rate */
-};
-
-struct aggr_rifs_param {
-       int param_max_frames;
-       int param_max_len;
-       int param_rl;
-       int param_al;
-       struct ath_rc_series *param_rcs;
-};
-
-struct ath_node {
-       struct ath_softc *an_sc;
-       struct ath_atx_tid tid[WME_NUM_TID];
-       struct ath_atx_ac ac[WME_NUM_AC];
-       u16 maxampdu;
-       u8 mpdudensity;
-};
-
-struct ath_tx {
-       u16 seq_no;
-       u32 txqsetup;
-       int hwq_map[ATH9K_WME_AC_VO+1];
-       spinlock_t txbuflock;
-       struct list_head txbuf;
-       struct ath_txq txq[ATH9K_NUM_TX_QUEUES];
-       struct ath_descdma txdma;
-};
-
-struct ath_rx {
-       u8 defant;
-       u8 rxotherant;
-       u32 *rxlink;
-       int bufsize;
-       unsigned int rxfilter;
-       spinlock_t rxflushlock;
-       spinlock_t rxbuflock;
-       struct list_head rxbuf;
-       struct ath_descdma rxdma;
-};
-
-int ath_startrecv(struct ath_softc *sc);
-bool ath_stoprecv(struct ath_softc *sc);
-void ath_flushrecv(struct ath_softc *sc);
-u32 ath_calcrxfilter(struct ath_softc *sc);
-int ath_rx_init(struct ath_softc *sc, int nbufs);
-void ath_rx_cleanup(struct ath_softc *sc);
-int ath_rx_tasklet(struct ath_softc *sc, int flush);
-struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype);
-void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq);
-int ath_tx_setup(struct ath_softc *sc, int haltype);
-void ath_draintxq(struct ath_softc *sc, bool retry_tx);
-void ath_tx_draintxq(struct ath_softc *sc,
-                    struct ath_txq *txq, bool retry_tx);
-void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an);
-void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an);
-void ath_tx_node_free(struct ath_softc *sc, struct ath_node *an);
-void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq);
-int ath_tx_init(struct ath_softc *sc, int nbufs);
-int ath_tx_cleanup(struct ath_softc *sc);
-int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype);
-struct ath_txq *ath_test_get_txq(struct ath_softc *sc, struct sk_buff *skb);
-int ath_txq_update(struct ath_softc *sc, int qnum,
-                  struct ath9k_tx_queue_info *q);
-int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb,
-                struct ath_tx_control *txctl);
-void ath_tx_tasklet(struct ath_softc *sc);
-u32 ath_txq_depth(struct ath_softc *sc, int qnum);
-u32 ath_txq_aggr_depth(struct ath_softc *sc, int qnum);
-void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb);
-void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid);
-bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno);
-void ath_tx_aggr_teardown(struct ath_softc *sc,        struct ath_node *an, u8 tidno);
-int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
-                     u16 tid, u16 *ssn);
-int ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
-void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid);
-
-/********/
-/* VAPs */
-/********/
-
-/*
- * Define the scheme that we select MAC address for multiple
- * BSS on the same radio. The very first VAP will just use the MAC
- * address from the EEPROM. For the next 3 VAPs, we set the
- * U/L bit (bit 1) in MAC address, and use the next two bits as the
- * index of the VAP.
- */
-
-#define ATH_SET_VAP_BSSID_MASK(bssid_mask) \
-       ((bssid_mask)[0] &= ~(((ATH_BCBUF-1)<<2)|0x02))
-
-struct ath_vap {
-       int av_bslot;
-       enum nl80211_iftype av_opmode;
-       struct ath_buf *av_bcbuf;
-       struct ath_tx_control av_btxctl;
-};
-
-/*******************/
-/* Beacon Handling */
-/*******************/
-
-/*
- * Regardless of the number of beacons we stagger, (i.e. regardless of the
- * number of BSSIDs) if a given beacon does not go out even after waiting this
- * number of beacon intervals, the game's up.
- */
-#define BSTUCK_THRESH                  (9 * ATH_BCBUF)
-#define        ATH_BCBUF                       1
-#define ATH_DEFAULT_BINTVAL            100 /* TU */
-#define ATH_DEFAULT_BMISS_LIMIT        10
-#define IEEE80211_MS_TO_TU(x)           (((x) * 1000) / 1024)
-
-struct ath_beacon_config {
-       u16 beacon_interval;
-       u16 listen_interval;
-       u16 dtim_period;
-       u16 bmiss_timeout;
-       u8 dtim_count;
-       u8 tim_offset;
-       union {
-               u64 last_tsf;
-               u8 last_tstamp[8];
-       } u; /* last received beacon/probe response timestamp of this BSS. */
-};
-
-struct ath_beacon {
-       enum {
-               OK,             /* no change needed */
-               UPDATE,         /* update pending */
-               COMMIT          /* beacon sent, commit change */
-       } updateslot;           /* slot time update fsm */
-
-       u32 beaconq;
-       u32 bmisscnt;
-       u32 ast_be_xmit;
-       u64 bc_tstamp;
-       int bslot[ATH_BCBUF];
-       int slottime;
-       int slotupdate;
-       struct ath9k_tx_queue_info beacon_qi;
-       struct ath_descdma bdma;
-       struct ath_txq *cabq;
-       struct list_head bbuf;
-};
-
-void ath9k_beacon_tasklet(unsigned long data);
-void ath_beacon_config(struct ath_softc *sc, int if_id);
-int ath_beaconq_setup(struct ath_hal *ah);
-int ath_beacon_alloc(struct ath_softc *sc, int if_id);
-void ath_beacon_return(struct ath_softc *sc, struct ath_vap *avp);
-void ath_beacon_sync(struct ath_softc *sc, int if_id);
-
-/*******/
-/* ANI */
-/*******/
-
-/* ANI values for STA only.
-   FIXME: Add appropriate values for AP later */
-
-#define ATH_ANI_POLLINTERVAL    100     /* 100 milliseconds between ANI poll */
-#define ATH_SHORT_CALINTERVAL   1000    /* 1 second between calibrations */
-#define ATH_LONG_CALINTERVAL    30000   /* 30 seconds between calibrations */
-#define ATH_RESTART_CALINTERVAL 1200000 /* 20 minutes between calibrations */
-
-struct ath_ani {
-       bool sc_caldone;
-       int16_t sc_noise_floor;
-       unsigned int sc_longcal_timer;
-       unsigned int sc_shortcal_timer;
-       unsigned int sc_resetcal_timer;
-       unsigned int sc_checkani_timer;
-       struct timer_list timer;
-};
-
-/********************/
-/*   LED Control    */
-/********************/
-
-#define ATH_LED_PIN    1
-
-enum ath_led_type {
-       ATH_LED_RADIO,
-       ATH_LED_ASSOC,
-       ATH_LED_TX,
-       ATH_LED_RX
-};
-
-struct ath_led {
-       struct ath_softc *sc;
-       struct led_classdev led_cdev;
-       enum ath_led_type led_type;
-       char name[32];
-       bool registered;
-};
-
-/* Rfkill */
-#define ATH_RFKILL_POLL_INTERVAL       2000 /* msecs */
-
-struct ath_rfkill {
-       struct rfkill *rfkill;
-       struct delayed_work rfkill_poll;
-       char rfkill_name[32];
-};
-
-/********************/
-/* Main driver core */
-/********************/
-
-/*
- * Default cache line size, in bytes.
- * Used when PCI device not fully initialized by bootrom/BIOS
-*/
-#define DEFAULT_CACHELINE       32
-#define        ATH_DEFAULT_NOISE_FLOOR -95
-#define ATH_REGCLASSIDS_MAX     10
-#define ATH_CABQ_READY_TIME     80      /* % of beacon interval */
-#define ATH_MAX_SW_RETRIES      10
-#define ATH_CHAN_MAX            255
-#define IEEE80211_WEP_NKID      4       /* number of key ids */
-#define IEEE80211_RATE_VAL      0x7f
-/*
- * The key cache is used for h/w cipher state and also for
- * tracking station state such as the current tx antenna.
- * We also setup a mapping table between key cache slot indices
- * and station state to short-circuit node lookups on rx.
- * Different parts have different size key caches.  We handle
- * up to ATH_KEYMAX entries (could dynamically allocate state).
- */
-#define        ATH_KEYMAX              128     /* max key cache size we handle */
-
-#define ATH_IF_ID_ANY          0xff
-#define ATH_TXPOWER_MAX         100     /* .5 dBm units */
-#define ATH_RSSI_DUMMY_MARKER   0x127
-#define ATH_RATE_DUMMY_MARKER   0
-
-enum PROT_MODE {
-       PROT_M_NONE = 0,
-       PROT_M_RTSCTS,
-       PROT_M_CTSONLY
-};
-
-#define SC_OP_INVALID          BIT(0)
-#define SC_OP_BEACONS          BIT(1)
-#define SC_OP_RXAGGR           BIT(2)
-#define SC_OP_TXAGGR           BIT(3)
-#define SC_OP_CHAINMASK_UPDATE BIT(4)
-#define SC_OP_FULL_RESET       BIT(5)
-#define SC_OP_NO_RESET         BIT(6)
-#define SC_OP_PREAMBLE_SHORT   BIT(7)
-#define SC_OP_PROTECT_ENABLE   BIT(8)
-#define SC_OP_RXFLUSH          BIT(9)
-#define SC_OP_LED_ASSOCIATED   BIT(10)
-#define SC_OP_RFKILL_REGISTERED        BIT(11)
-#define SC_OP_RFKILL_SW_BLOCKED        BIT(12)
-#define SC_OP_RFKILL_HW_BLOCKED        BIT(13)
-
-struct ath_softc {
-       struct ieee80211_hw *hw;
-       struct pci_dev *pdev;
-       struct tasklet_struct intr_tq;
-       struct tasklet_struct bcon_tasklet;
-       struct ath_hal *sc_ah;
-       void __iomem *mem;
-       spinlock_t sc_resetlock;
-       struct mutex mutex;
-
-       u8 sc_curbssid[ETH_ALEN];
-       u8 sc_myaddr[ETH_ALEN];
-       u8 sc_bssidmask[ETH_ALEN];
-       u32 sc_intrstatus;
-       u32 sc_flags; /* SC_OP_* */
-       u16 sc_curtxpow;
-       u16 sc_curaid;
-       u16 sc_cachelsz;
-       u8 sc_nbcnvaps;
-       u16 sc_nvaps;
-       u8 sc_tx_chainmask;
-       u8 sc_rx_chainmask;
-       u32 sc_keymax;
-       DECLARE_BITMAP(sc_keymap, ATH_KEYMAX);
-       u8 sc_splitmic;
-       u8 sc_protrix;
-       enum ath9k_int sc_imask;
-       enum PROT_MODE sc_protmode;
-       enum ath9k_ht_extprotspacing sc_ht_extprotspacing;
-       enum ath9k_ht_macmode tx_chan_width;
-
-       struct ath_config sc_config;
-       struct ath_rx rx;
-       struct ath_tx tx;
-       struct ath_beacon beacon;
-       struct ieee80211_vif *sc_vaps[ATH_BCBUF];
-       struct ieee80211_rate rates[IEEE80211_NUM_BANDS][ATH_RATE_MAX];
-       struct ath_rate_table *hw_rate_table[ATH9K_MODE_MAX];
-       struct ath_rate_table *cur_rate_table;
-       struct ieee80211_channel channels[IEEE80211_NUM_BANDS][ATH_CHAN_MAX];
-       struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
-       struct ath_led radio_led;
-       struct ath_led assoc_led;
-       struct ath_led tx_led;
-       struct ath_led rx_led;
-       struct ath_rfkill rf_kill;
-       struct ath_ani sc_ani;
-       struct ath9k_node_stats sc_halstats;
-#ifdef CONFIG_ATH9K_DEBUG
-       struct ath9k_debug sc_debug;
-#endif
-};
-
-int ath_reset(struct ath_softc *sc, bool retry_tx);
-int ath_get_hal_qnum(u16 queue, struct ath_softc *sc);
-int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc);
-int ath_cabq_update(struct ath_softc *);
-
-#endif /* CORE_H */
index a80ed576830f0238f07ac003a8c8c579d52c86cc..800ad5926b6f0654e321abb1874933a27692f17a 100644 (file)
@@ -14,9 +14,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
-#include "reg.h"
-#include "hw.h"
+#include "ath9k.h"
 
 static unsigned int ath9k_debug = DBG_DEFAULT;
 module_param_named(debug, ath9k_debug, uint, 0);
@@ -26,7 +24,7 @@ void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...)
        if (!sc)
                return;
 
-       if (sc->sc_debug.debug_mask & dbg_mask) {
+       if (sc->debug.debug_mask & dbg_mask) {
                va_list args;
 
                va_start(args, fmt);
@@ -46,7 +44,7 @@ static ssize_t read_file_dma(struct file *file, char __user *user_buf,
                             size_t count, loff_t *ppos)
 {
        struct ath_softc *sc = file->private_data;
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        char buf[1024];
        unsigned int len = 0;
        u32 val[ATH9K_NUM_DMA_DEBUG_REGS];
@@ -132,41 +130,41 @@ static const struct file_operations fops_dma = {
 void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status)
 {
        if (status)
-               sc->sc_debug.stats.istats.total++;
+               sc->debug.stats.istats.total++;
        if (status & ATH9K_INT_RX)
-               sc->sc_debug.stats.istats.rxok++;
+               sc->debug.stats.istats.rxok++;
        if (status & ATH9K_INT_RXEOL)
-               sc->sc_debug.stats.istats.rxeol++;
+               sc->debug.stats.istats.rxeol++;
        if (status & ATH9K_INT_RXORN)
-               sc->sc_debug.stats.istats.rxorn++;
+               sc->debug.stats.istats.rxorn++;
        if (status & ATH9K_INT_TX)
-               sc->sc_debug.stats.istats.txok++;
+               sc->debug.stats.istats.txok++;
        if (status & ATH9K_INT_TXURN)
-               sc->sc_debug.stats.istats.txurn++;
+               sc->debug.stats.istats.txurn++;
        if (status & ATH9K_INT_MIB)
-               sc->sc_debug.stats.istats.mib++;
+               sc->debug.stats.istats.mib++;
        if (status & ATH9K_INT_RXPHY)
-               sc->sc_debug.stats.istats.rxphyerr++;
+               sc->debug.stats.istats.rxphyerr++;
        if (status & ATH9K_INT_RXKCM)
-               sc->sc_debug.stats.istats.rx_keycache_miss++;
+               sc->debug.stats.istats.rx_keycache_miss++;
        if (status & ATH9K_INT_SWBA)
-               sc->sc_debug.stats.istats.swba++;
+               sc->debug.stats.istats.swba++;
        if (status & ATH9K_INT_BMISS)
-               sc->sc_debug.stats.istats.bmiss++;
+               sc->debug.stats.istats.bmiss++;
        if (status & ATH9K_INT_BNR)
-               sc->sc_debug.stats.istats.bnr++;
+               sc->debug.stats.istats.bnr++;
        if (status & ATH9K_INT_CST)
-               sc->sc_debug.stats.istats.cst++;
+               sc->debug.stats.istats.cst++;
        if (status & ATH9K_INT_GTT)
-               sc->sc_debug.stats.istats.gtt++;
+               sc->debug.stats.istats.gtt++;
        if (status & ATH9K_INT_TIM)
-               sc->sc_debug.stats.istats.tim++;
+               sc->debug.stats.istats.tim++;
        if (status & ATH9K_INT_CABEND)
-               sc->sc_debug.stats.istats.cabend++;
+               sc->debug.stats.istats.cabend++;
        if (status & ATH9K_INT_DTIMSYNC)
-               sc->sc_debug.stats.istats.dtimsync++;
+               sc->debug.stats.istats.dtimsync++;
        if (status & ATH9K_INT_DTIM)
-               sc->sc_debug.stats.istats.dtim++;
+               sc->debug.stats.istats.dtim++;
 }
 
 static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
@@ -177,41 +175,41 @@ static ssize_t read_file_interrupt(struct file *file, char __user *user_buf,
        unsigned int len = 0;
 
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "RX", sc->sc_debug.stats.istats.rxok);
+               "%8s: %10u\n", "RX", sc->debug.stats.istats.rxok);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "RXEOL", sc->sc_debug.stats.istats.rxeol);
+               "%8s: %10u\n", "RXEOL", sc->debug.stats.istats.rxeol);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "RXORN", sc->sc_debug.stats.istats.rxorn);
+               "%8s: %10u\n", "RXORN", sc->debug.stats.istats.rxorn);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "TX", sc->sc_debug.stats.istats.txok);
+               "%8s: %10u\n", "TX", sc->debug.stats.istats.txok);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "TXURN", sc->sc_debug.stats.istats.txurn);
+               "%8s: %10u\n", "TXURN", sc->debug.stats.istats.txurn);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "MIB", sc->sc_debug.stats.istats.mib);
+               "%8s: %10u\n", "MIB", sc->debug.stats.istats.mib);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "RXPHY", sc->sc_debug.stats.istats.rxphyerr);
+               "%8s: %10u\n", "RXPHY", sc->debug.stats.istats.rxphyerr);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "RXKCM", sc->sc_debug.stats.istats.rx_keycache_miss);
+               "%8s: %10u\n", "RXKCM", sc->debug.stats.istats.rx_keycache_miss);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "SWBA", sc->sc_debug.stats.istats.swba);
+               "%8s: %10u\n", "SWBA", sc->debug.stats.istats.swba);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "BMISS", sc->sc_debug.stats.istats.bmiss);
+               "%8s: %10u\n", "BMISS", sc->debug.stats.istats.bmiss);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "BNR", sc->sc_debug.stats.istats.bnr);
+               "%8s: %10u\n", "BNR", sc->debug.stats.istats.bnr);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "CST", sc->sc_debug.stats.istats.cst);
+               "%8s: %10u\n", "CST", sc->debug.stats.istats.cst);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "GTT", sc->sc_debug.stats.istats.gtt);
+               "%8s: %10u\n", "GTT", sc->debug.stats.istats.gtt);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "TIM", sc->sc_debug.stats.istats.tim);
+               "%8s: %10u\n", "TIM", sc->debug.stats.istats.tim);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "CABEND", sc->sc_debug.stats.istats.cabend);
+               "%8s: %10u\n", "CABEND", sc->debug.stats.istats.cabend);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "DTIMSYNC", sc->sc_debug.stats.istats.dtimsync);
+               "%8s: %10u\n", "DTIMSYNC", sc->debug.stats.istats.dtimsync);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "DTIM", sc->sc_debug.stats.istats.dtim);
+               "%8s: %10u\n", "DTIM", sc->debug.stats.istats.dtim);
        len += snprintf(buf + len, sizeof(buf) - len,
-               "%8s: %10u\n", "TOTAL", sc->sc_debug.stats.istats.total);
+               "%8s: %10u\n", "TOTAL", sc->debug.stats.istats.total);
 
        return simple_read_from_buffer(user_buf, count, ppos, buf, len);
 }
@@ -222,29 +220,144 @@ static const struct file_operations fops_interrupt = {
        .owner = THIS_MODULE
 };
 
+static void ath_debug_stat_11n_rc(struct ath_softc *sc, struct sk_buff *skb)
+{
+       struct ath_tx_info_priv *tx_info_priv = NULL;
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_tx_rate *rates = tx_info->status.rates;
+       int final_ts_idx, idx;
+
+       tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
+       final_ts_idx = tx_info_priv->tx.ts_rateindex;
+       idx = sc->cur_rate_table->info[rates[final_ts_idx].idx].dot11rate;
+
+       sc->debug.stats.n_rcstats[idx].success++;
+}
+
+static void ath_debug_stat_legacy_rc(struct ath_softc *sc, struct sk_buff *skb)
+{
+       struct ath_tx_info_priv *tx_info_priv = NULL;
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_tx_rate *rates = tx_info->status.rates;
+       int final_ts_idx, idx;
+
+       tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
+       final_ts_idx = tx_info_priv->tx.ts_rateindex;
+       idx = rates[final_ts_idx].idx;
+
+       sc->debug.stats.legacy_rcstats[idx].success++;
+}
+
+void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb)
+{
+       if (conf_is_ht(&sc->hw->conf))
+               ath_debug_stat_11n_rc(sc, skb);
+       else
+               ath_debug_stat_legacy_rc(sc, skb);
+}
+
+/* FIXME: legacy rates, later on .. */
+void ath_debug_stat_retries(struct ath_softc *sc, int rix,
+                           int xretries, int retries)
+{
+       if (conf_is_ht(&sc->hw->conf)) {
+               int idx = sc->cur_rate_table->info[rix].dot11rate;
+
+               sc->debug.stats.n_rcstats[idx].xretries += xretries;
+               sc->debug.stats.n_rcstats[idx].retries += retries;
+       }
+}
+
+static ssize_t ath_read_file_stat_11n_rc(struct file *file,
+                                        char __user *user_buf,
+                                        size_t count, loff_t *ppos)
+{
+       struct ath_softc *sc = file->private_data;
+       char buf[1024];
+       unsigned int len = 0;
+       int i = 0;
+
+       len += sprintf(buf, "%7s %13s %8s %8s\n\n", "Rate", "Success",
+                      "Retries", "XRetries");
+
+       for (i = 0; i <= 15; i++) {
+               len += snprintf(buf + len, sizeof(buf) - len,
+                               "%5s%3d: %8u %8u %8u\n", "MCS", i,
+                               sc->debug.stats.n_rcstats[i].success,
+                               sc->debug.stats.n_rcstats[i].retries,
+                               sc->debug.stats.n_rcstats[i].xretries);
+       }
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t ath_read_file_stat_legacy_rc(struct file *file,
+                                           char __user *user_buf,
+                                           size_t count, loff_t *ppos)
+{
+       struct ath_softc *sc = file->private_data;
+       char buf[512];
+       unsigned int len = 0;
+       int i = 0;
+
+       len += sprintf(buf, "%7s %13s\n\n", "Rate", "Success");
+
+       for (i = 0; i < sc->cur_rate_table->rate_cnt; i++) {
+               len += snprintf(buf + len, sizeof(buf) - len, "%5u: %12u\n",
+                               sc->cur_rate_table->info[i].ratekbps / 1000,
+                               sc->debug.stats.legacy_rcstats[i].success);
+       }
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, len);
+}
+
+static ssize_t read_file_rcstat(struct file *file, char __user *user_buf,
+                               size_t count, loff_t *ppos)
+{
+       struct ath_softc *sc = file->private_data;
+
+       if (conf_is_ht(&sc->hw->conf))
+               return ath_read_file_stat_11n_rc(file, user_buf, count, ppos);
+       else
+               return ath_read_file_stat_legacy_rc(file, user_buf, count ,ppos);
+}
+
+static const struct file_operations fops_rcstat = {
+       .read = read_file_rcstat,
+       .open = ath9k_debugfs_open,
+       .owner = THIS_MODULE
+};
+
 int ath9k_init_debug(struct ath_softc *sc)
 {
-       sc->sc_debug.debug_mask = ath9k_debug;
+       sc->debug.debug_mask = ath9k_debug;
 
-       sc->sc_debug.debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
-       if (!sc->sc_debug.debugfs_root)
+       sc->debug.debugfs_root = debugfs_create_dir(KBUILD_MODNAME, NULL);
+       if (!sc->debug.debugfs_root)
                goto err;
 
-       sc->sc_debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
-                                                     sc->sc_debug.debugfs_root);
-       if (!sc->sc_debug.debugfs_phy)
+       sc->debug.debugfs_phy = debugfs_create_dir(wiphy_name(sc->hw->wiphy),
+                                                     sc->debug.debugfs_root);
+       if (!sc->debug.debugfs_phy)
                goto err;
 
-       sc->sc_debug.debugfs_dma = debugfs_create_file("dma", S_IRUGO,
-                                      sc->sc_debug.debugfs_phy, sc, &fops_dma);
-       if (!sc->sc_debug.debugfs_dma)
+       sc->debug.debugfs_dma = debugfs_create_file("dma", S_IRUGO,
+                                      sc->debug.debugfs_phy, sc, &fops_dma);
+       if (!sc->debug.debugfs_dma)
                goto err;
 
-       sc->sc_debug.debugfs_interrupt = debugfs_create_file("interrupt",
+       sc->debug.debugfs_interrupt = debugfs_create_file("interrupt",
                                                     S_IRUGO,
-                                                    sc->sc_debug.debugfs_phy,
+                                                    sc->debug.debugfs_phy,
                                                     sc, &fops_interrupt);
-       if (!sc->sc_debug.debugfs_interrupt)
+       if (!sc->debug.debugfs_interrupt)
+               goto err;
+
+       sc->debug.debugfs_rcstat = debugfs_create_file("rcstat",
+                                                 S_IRUGO,
+                                                 sc->debug.debugfs_phy,
+                                                 sc, &fops_rcstat);
+       if (!sc->debug.debugfs_rcstat)
                goto err;
 
        return 0;
@@ -255,8 +368,9 @@ err:
 
 void ath9k_exit_debug(struct ath_softc *sc)
 {
-       debugfs_remove(sc->sc_debug.debugfs_interrupt);
-       debugfs_remove(sc->sc_debug.debugfs_dma);
-       debugfs_remove(sc->sc_debug.debugfs_phy);
-       debugfs_remove(sc->sc_debug.debugfs_root);
+       debugfs_remove(sc->debug.debugfs_rcstat);
+       debugfs_remove(sc->debug.debugfs_interrupt);
+       debugfs_remove(sc->debug.debugfs_dma);
+       debugfs_remove(sc->debug.debugfs_phy);
+       debugfs_remove(sc->debug.debugfs_root);
 }
diff --git a/drivers/net/wireless/ath9k/debug.h b/drivers/net/wireless/ath9k/debug.h
new file mode 100644 (file)
index 0000000..61e9698
--- /dev/null
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef DEBUG_H
+#define DEBUG_H
+
+enum ATH_DEBUG {
+       ATH_DBG_RESET           = 0x00000001,
+       ATH_DBG_REG_IO          = 0x00000002,
+       ATH_DBG_QUEUE           = 0x00000004,
+       ATH_DBG_EEPROM          = 0x00000008,
+       ATH_DBG_CALIBRATE       = 0x00000010,
+       ATH_DBG_CHANNEL         = 0x00000020,
+       ATH_DBG_INTERRUPT       = 0x00000040,
+       ATH_DBG_REGULATORY      = 0x00000080,
+       ATH_DBG_ANI             = 0x00000100,
+       ATH_DBG_POWER_MGMT      = 0x00000200,
+       ATH_DBG_XMIT            = 0x00000400,
+       ATH_DBG_BEACON          = 0x00001000,
+       ATH_DBG_CONFIG          = 0x00002000,
+       ATH_DBG_KEYCACHE        = 0x00004000,
+       ATH_DBG_FATAL           = 0x00008000,
+       ATH_DBG_ANY             = 0xffffffff
+};
+
+#define DBG_DEFAULT (ATH_DBG_FATAL)
+
+#ifdef CONFIG_ATH9K_DEBUG
+
+/**
+ * struct ath_interrupt_stats - Contains statistics about interrupts
+ * @total: Total no. of interrupts generated so far
+ * @rxok: RX with no errors
+ * @rxeol: RX with no more RXDESC available
+ * @rxorn: RX FIFO overrun
+ * @txok: TX completed at the requested rate
+ * @txurn: TX FIFO underrun
+ * @mib: MIB regs reaching its threshold
+ * @rxphyerr: RX with phy errors
+ * @rx_keycache_miss: RX with key cache misses
+ * @swba: Software Beacon Alert
+ * @bmiss: Beacon Miss
+ * @bnr: Beacon Not Ready
+ * @cst: Carrier Sense TImeout
+ * @gtt: Global TX Timeout
+ * @tim: RX beacon TIM occurrence
+ * @cabend: RX End of CAB traffic
+ * @dtimsync: DTIM sync lossage
+ * @dtim: RX Beacon with DTIM
+ */
+struct ath_interrupt_stats {
+       u32 total;
+       u32 rxok;
+       u32 rxeol;
+       u32 rxorn;
+       u32 txok;
+       u32 txeol;
+       u32 txurn;
+       u32 mib;
+       u32 rxphyerr;
+       u32 rx_keycache_miss;
+       u32 swba;
+       u32 bmiss;
+       u32 bnr;
+       u32 cst;
+       u32 gtt;
+       u32 tim;
+       u32 cabend;
+       u32 dtimsync;
+       u32 dtim;
+};
+
+struct ath_legacy_rc_stats {
+       u32 success;
+};
+
+struct ath_11n_rc_stats {
+       u32 success;
+       u32 retries;
+       u32 xretries;
+};
+
+struct ath_stats {
+       struct ath_interrupt_stats istats;
+       struct ath_legacy_rc_stats legacy_rcstats[12]; /* max(11a,11b,11g) */
+       struct ath_11n_rc_stats n_rcstats[16]; /* 0..15 MCS rates */
+};
+
+struct ath9k_debug {
+       int debug_mask;
+       struct dentry *debugfs_root;
+       struct dentry *debugfs_phy;
+       struct dentry *debugfs_dma;
+       struct dentry *debugfs_interrupt;
+       struct dentry *debugfs_rcstat;
+       struct ath_stats stats;
+};
+
+void DPRINTF(struct ath_softc *sc, int dbg_mask, const char *fmt, ...);
+int ath9k_init_debug(struct ath_softc *sc);
+void ath9k_exit_debug(struct ath_softc *sc);
+void ath_debug_stat_interrupt(struct ath_softc *sc, enum ath9k_int status);
+void ath_debug_stat_rc(struct ath_softc *sc, struct sk_buff *skb);
+void ath_debug_stat_retries(struct ath_softc *sc, int rix,
+                           int xretries, int retries);
+
+#else
+
+static inline void DPRINTF(struct ath_softc *sc, int dbg_mask,
+                          const char *fmt, ...)
+{
+}
+
+static inline int ath9k_init_debug(struct ath_softc *sc)
+{
+       return 0;
+}
+
+static inline void ath9k_exit_debug(struct ath_softc *sc)
+{
+}
+
+static inline void ath_debug_stat_interrupt(struct ath_softc *sc,
+                                           enum ath9k_int status)
+{
+}
+
+static inline void ath_debug_stat_rc(struct ath_softc *sc,
+                                    struct sk_buff *skb)
+{
+}
+
+static inline void ath_debug_stat_retries(struct ath_softc *sc, int rix,
+                                         int xretries, int retries)
+{
+}
+
+#endif /* CONFIG_ATH9K_DEBUG */
+
+#endif /* DEBUG_H */
index acd6c5374d44c1cca46ecaca40009f9051ec11cf..b55e9920a5d454e3515e411383303d22367dd879 100644 (file)
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
-#include "hw.h"
-#include "reg.h"
-#include "phy.h"
+#include "ath9k.h"
 
-static void ath9k_hw_analog_shift_rmw(struct ath_hal *ah,
+static void ath9k_hw_analog_shift_rmw(struct ath_hw *ah,
                                      u32 reg, u32 mask,
                                      u32 shift, u32 val)
 {
@@ -30,7 +27,7 @@ static void ath9k_hw_analog_shift_rmw(struct ath_hal *ah,
 
        REG_WRITE(ah, reg, regVal);
 
-       if (ah->ah_config.analog_shiftreg)
+       if (ah->config.analog_shiftreg)
                udelay(100);
 
        return;
@@ -91,60 +88,198 @@ static inline bool ath9k_hw_get_lower_upper_index(u8 target, u8 *pList,
        return false;
 }
 
-static bool ath9k_hw_eeprom_read(struct ath_hal *ah, u32 off, u16 *data)
+static inline bool ath9k_hw_nvram_read(struct ath_hw *ah, u32 off, u16 *data)
 {
-       (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
+       struct ath_softc *sc = ah->ah_sc;
 
-       if (!ath9k_hw_wait(ah,
-                          AR_EEPROM_STATUS_DATA,
-                          AR_EEPROM_STATUS_DATA_BUSY |
-                          AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0)) {
-               return false;
-       }
+       return sc->bus_ops->eeprom_read(ah, off, data);
+}
+
+static inline bool ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
+                                          u8 *pVpdList, u16 numIntercepts,
+                                          u8 *pRetVpdList)
+{
+       u16 i, k;
+       u8 currPwr = pwrMin;
+       u16 idxL = 0, idxR = 0;
 
-       *data = MS(REG_READ(ah, AR_EEPROM_STATUS_DATA),
-                  AR_EEPROM_STATUS_DATA_VAL);
+       for (i = 0; i <= (pwrMax - pwrMin) / 2; i++) {
+               ath9k_hw_get_lower_upper_index(currPwr, pPwrList,
+                                              numIntercepts, &(idxL),
+                                              &(idxR));
+               if (idxR < 1)
+                       idxR = 1;
+               if (idxL == numIntercepts - 1)
+                       idxL = (u16) (numIntercepts - 2);
+               if (pPwrList[idxL] == pPwrList[idxR])
+                       k = pVpdList[idxL];
+               else
+                       k = (u16)(((currPwr - pPwrList[idxL]) * pVpdList[idxR] +
+                                  (pPwrList[idxR] - currPwr) * pVpdList[idxL]) /
+                                 (pPwrList[idxR] - pPwrList[idxL]));
+               pRetVpdList[i] = (u8) k;
+               currPwr += 2;
+       }
 
        return true;
 }
 
-static int ath9k_hw_flash_map(struct ath_hal *ah)
+static void ath9k_hw_get_legacy_target_powers(struct ath_hw *ah,
+                                     struct ath9k_channel *chan,
+                                     struct cal_target_power_leg *powInfo,
+                                     u16 numChannels,
+                                     struct cal_target_power_leg *pNewPower,
+                                     u16 numRates, bool isExtTarget)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       struct chan_centers centers;
+       u16 clo, chi;
+       int i;
+       int matchIndex = -1, lowIndex = -1;
+       u16 freq;
 
-       ahp->ah_cal_mem = ioremap(AR5416_EEPROM_START_ADDR, AR5416_EEPROM_MAX);
+       ath9k_hw_get_channel_centers(ah, chan, &centers);
+       freq = (isExtTarget) ? centers.ext_center : centers.ctl_center;
 
-       if (!ahp->ah_cal_mem) {
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                       "cannot remap eeprom region \n");
-               return -EIO;
+       if (freq <= ath9k_hw_fbin2freq(powInfo[0].bChannel,
+                                      IS_CHAN_2GHZ(chan))) {
+               matchIndex = 0;
+       } else {
+               for (i = 0; (i < numChannels) &&
+                            (powInfo[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
+                       if (freq == ath9k_hw_fbin2freq(powInfo[i].bChannel,
+                                                      IS_CHAN_2GHZ(chan))) {
+                               matchIndex = i;
+                               break;
+                       } else if ((freq < ath9k_hw_fbin2freq(powInfo[i].bChannel,
+                                                     IS_CHAN_2GHZ(chan))) &&
+                                  (freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel,
+                                                     IS_CHAN_2GHZ(chan)))) {
+                               lowIndex = i - 1;
+                               break;
+                       }
+               }
+               if ((matchIndex == -1) && (lowIndex == -1))
+                       matchIndex = i - 1;
        }
 
-       return 0;
+       if (matchIndex != -1) {
+               *pNewPower = powInfo[matchIndex];
+       } else {
+               clo = ath9k_hw_fbin2freq(powInfo[lowIndex].bChannel,
+                                        IS_CHAN_2GHZ(chan));
+               chi = ath9k_hw_fbin2freq(powInfo[lowIndex + 1].bChannel,
+                                        IS_CHAN_2GHZ(chan));
+
+               for (i = 0; i < numRates; i++) {
+                       pNewPower->tPow2x[i] =
+                               (u8)ath9k_hw_interpolate(freq, clo, chi,
+                                               powInfo[lowIndex].tPow2x[i],
+                                               powInfo[lowIndex + 1].tPow2x[i]);
+               }
+       }
 }
 
-static bool ath9k_hw_flash_read(struct ath_hal *ah, u32 off, u16 *data)
+static void ath9k_hw_get_target_powers(struct ath_hw *ah,
+                                      struct ath9k_channel *chan,
+                                      struct cal_target_power_ht *powInfo,
+                                      u16 numChannels,
+                                      struct cal_target_power_ht *pNewPower,
+                                      u16 numRates, bool isHt40Target)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       struct chan_centers centers;
+       u16 clo, chi;
+       int i;
+       int matchIndex = -1, lowIndex = -1;
+       u16 freq;
 
-       *data = ioread16(ahp->ah_cal_mem + off);
+       ath9k_hw_get_channel_centers(ah, chan, &centers);
+       freq = isHt40Target ? centers.synth_center : centers.ctl_center;
 
-       return true;
+       if (freq <= ath9k_hw_fbin2freq(powInfo[0].bChannel, IS_CHAN_2GHZ(chan))) {
+               matchIndex = 0;
+       } else {
+               for (i = 0; (i < numChannels) &&
+                            (powInfo[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
+                       if (freq == ath9k_hw_fbin2freq(powInfo[i].bChannel,
+                                                      IS_CHAN_2GHZ(chan))) {
+                               matchIndex = i;
+                               break;
+                       } else
+                               if ((freq < ath9k_hw_fbin2freq(powInfo[i].bChannel,
+                                                      IS_CHAN_2GHZ(chan))) &&
+                                   (freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel,
+                                                      IS_CHAN_2GHZ(chan)))) {
+                                       lowIndex = i - 1;
+                                       break;
+                               }
+               }
+               if ((matchIndex == -1) && (lowIndex == -1))
+                       matchIndex = i - 1;
+       }
+
+       if (matchIndex != -1) {
+               *pNewPower = powInfo[matchIndex];
+       } else {
+               clo = ath9k_hw_fbin2freq(powInfo[lowIndex].bChannel,
+                                        IS_CHAN_2GHZ(chan));
+               chi = ath9k_hw_fbin2freq(powInfo[lowIndex + 1].bChannel,
+                                        IS_CHAN_2GHZ(chan));
+
+               for (i = 0; i < numRates; i++) {
+                       pNewPower->tPow2x[i] = (u8)ath9k_hw_interpolate(freq,
+                                               clo, chi,
+                                               powInfo[lowIndex].tPow2x[i],
+                                               powInfo[lowIndex + 1].tPow2x[i]);
+               }
+       }
 }
 
-static inline bool ath9k_hw_nvram_read(struct ath_hal *ah, u32 off, u16 *data)
+static u16 ath9k_hw_get_max_edge_power(u16 freq,
+                                      struct cal_ctl_edges *pRdEdgesPower,
+                                      bool is2GHz, int num_band_edges)
 {
-       if (ath9k_hw_use_flash(ah))
-               return ath9k_hw_flash_read(ah, off, data);
-       else
-               return ath9k_hw_eeprom_read(ah, off, data);
+       u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
+       int i;
+
+       for (i = 0; (i < num_band_edges) &&
+                    (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
+               if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) {
+                       twiceMaxEdgePower = pRdEdgesPower[i].tPower;
+                       break;
+               } else if ((i > 0) &&
+                          (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel,
+                                                     is2GHz))) {
+                       if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel,
+                                              is2GHz) < freq &&
+                           pRdEdgesPower[i - 1].flag) {
+                               twiceMaxEdgePower =
+                                       pRdEdgesPower[i - 1].tPower;
+                       }
+                       break;
+               }
+       }
+
+       return twiceMaxEdgePower;
+}
+
+/****************************************/
+/* EEPROM Operations for 4K sized cards */
+/****************************************/
+
+static int ath9k_hw_4k_get_eeprom_ver(struct ath_hw *ah)
+{
+       return ((ah->eeprom.map4k.baseEepHeader.version >> 12) & 0xF);
+}
+
+static int ath9k_hw_4k_get_eeprom_rev(struct ath_hw *ah)
+{
+       return ((ah->eeprom.map4k.baseEepHeader.version) & 0xFFF);
 }
 
-static bool ath9k_hw_fill_4k_eeprom(struct ath_hal *ah)
+static bool ath9k_hw_4k_fill_eeprom(struct ath_hw *ah)
 {
 #define SIZE_EEPROM_4K (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k;
+       struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
        u16 *eep_data;
        int addr, eep_start_loc = 0;
 
@@ -169,60 +304,26 @@ static bool ath9k_hw_fill_4k_eeprom(struct ath_hal *ah)
 #undef SIZE_EEPROM_4K
 }
 
-static bool ath9k_hw_fill_def_eeprom(struct ath_hal *ah)
-{
-#define SIZE_EEPROM_DEF (sizeof(struct ar5416_eeprom_def) / sizeof(u16))
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def;
-       u16 *eep_data;
-       int addr, ar5416_eep_start_loc = 0x100;
-
-       eep_data = (u16 *)eep;
-
-       for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) {
-               if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc,
-                                        eep_data)) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                               "Unable to read eeprom region\n");
-                       return false;
-               }
-               eep_data++;
-       }
-       return true;
-#undef SIZE_EEPROM_DEF
-}
-
-static bool (*ath9k_fill_eeprom[]) (struct ath_hal *) = {
-       ath9k_hw_fill_def_eeprom,
-       ath9k_hw_fill_4k_eeprom
-};
-
-static inline bool ath9k_hw_fill_eeprom(struct ath_hal *ah)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       return ath9k_fill_eeprom[ahp->ah_eep_map](ah);
-}
-
-static int ath9k_hw_check_def_eeprom(struct ath_hal *ah)
+static int ath9k_hw_4k_check_eeprom(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *eep =
-               (struct ar5416_eeprom_def *) &ahp->ah_eeprom.def;
+#define EEPROM_4K_SIZE (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
+       struct ar5416_eeprom_4k *eep =
+               (struct ar5416_eeprom_4k *) &ah->eeprom.map4k;
        u16 *eepdata, temp, magic, magic2;
        u32 sum = 0, el;
        bool need_swap = false;
-       int i, addr, size;
+       int i, addr;
 
-       if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
-                                &magic)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                       "Reading Magic # failed\n");
-               return false;
-       }
 
        if (!ath9k_hw_use_flash(ah)) {
 
+               if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
+                                        &magic)) {
+                       DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                               "Reading Magic # failed\n");
+                       return false;
+               }
+
                DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
                                "Read Magic = 0x%04X\n", magic);
 
@@ -230,11 +331,10 @@ static int ath9k_hw_check_def_eeprom(struct ath_hal *ah)
                        magic2 = swab16(magic);
 
                        if (magic2 == AR5416_EEPROM_MAGIC) {
-                               size = sizeof(struct ar5416_eeprom_def);
                                need_swap = true;
-                               eepdata = (u16 *) (&ahp->ah_eeprom);
+                               eepdata = (u16 *) (&ah->eeprom);
 
-                               for (addr = 0; addr < size / sizeof(u16); addr++) {
+                               for (addr = 0; addr < EEPROM_4K_SIZE; addr++) {
                                        temp = swab16(*eepdata);
                                        *eepdata = temp;
                                        eepdata++;
@@ -259,22 +359,22 @@ static int ath9k_hw_check_def_eeprom(struct ath_hal *ah)
                need_swap ? "True" : "False");
 
        if (need_swap)
-               el = swab16(ahp->ah_eeprom.def.baseEepHeader.length);
+               el = swab16(ah->eeprom.map4k.baseEepHeader.length);
        else
-               el = ahp->ah_eeprom.def.baseEepHeader.length;
+               el = ah->eeprom.map4k.baseEepHeader.length;
 
        if (el > sizeof(struct ar5416_eeprom_def))
-               el = sizeof(struct ar5416_eeprom_def) / sizeof(u16);
+               el = sizeof(struct ar5416_eeprom_4k) / sizeof(u16);
        else
                el = el / sizeof(u16);
 
-       eepdata = (u16 *)(&ahp->ah_eeprom);
+       eepdata = (u16 *)(&ah->eeprom);
 
        for (i = 0; i < el; i++)
                sum ^= *eepdata++;
 
        if (need_swap) {
-               u32 integer, j;
+               u32 integer;
                u16 word;
 
                DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
@@ -304,204 +404,74 @@ static int ath9k_hw_check_def_eeprom(struct ath_hal *ah)
                word = swab16(eep->baseEepHeader.deviceCap);
                eep->baseEepHeader.deviceCap = word;
 
-               for (j = 0; j < ARRAY_SIZE(eep->modalHeader); j++) {
-                       struct modal_eep_header *pModal =
-                               &eep->modalHeader[j];
-                       integer = swab32(pModal->antCtrlCommon);
-                       pModal->antCtrlCommon = integer;
+               integer = swab32(eep->modalHeader.antCtrlCommon);
+               eep->modalHeader.antCtrlCommon = integer;
 
-                       for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-                               integer = swab32(pModal->antCtrlChain[i]);
-                               pModal->antCtrlChain[i] = integer;
-                       }
+               for (i = 0; i < AR5416_MAX_CHAINS; i++) {
+                       integer = swab32(eep->modalHeader.antCtrlChain[i]);
+                       eep->modalHeader.antCtrlChain[i] = integer;
+               }
 
-                       for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
-                               word = swab16(pModal->spurChans[i].spurChan);
-                               pModal->spurChans[i].spurChan = word;
-                       }
+               for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
+                       word = swab16(eep->modalHeader.spurChans[i].spurChan);
+                       eep->modalHeader.spurChans[i].spurChan = word;
                }
        }
 
-       if (sum != 0xffff || ar5416_get_eep_ver(ahp) != AR5416_EEP_VER ||
-           ar5416_get_eep_rev(ahp) < AR5416_EEP_NO_BACK_VER) {
+       if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER ||
+           ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
                DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
                        "Bad EEPROM checksum 0x%x or revision 0x%04x\n",
-                       sum, ar5416_get_eep_ver(ahp));
+                       sum, ah->eep_ops->get_eeprom_ver(ah));
                return -EINVAL;
        }
 
        return 0;
+#undef EEPROM_4K_SIZE
 }
 
-static int ath9k_hw_check_4k_eeprom(struct ath_hal *ah)
+static u32 ath9k_hw_4k_get_eeprom(struct ath_hw *ah,
+                                 enum eeprom_param param)
 {
-#define EEPROM_4K_SIZE (sizeof(struct ar5416_eeprom_4k) / sizeof(u16))
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *eep =
-               (struct ar5416_eeprom_4k *) &ahp->ah_eeprom.map4k;
-       u16 *eepdata, temp, magic, magic2;
-       u32 sum = 0, el;
-       bool need_swap = false;
-       int i, addr;
-
-
-       if (!ath9k_hw_use_flash(ah)) {
-
-               if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
-                                        &magic)) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                               "Reading Magic # failed\n");
-                       return false;
-               }
+       struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
+       struct modal_eep_4k_header *pModal = &eep->modalHeader;
+       struct base_eep_header_4k *pBase = &eep->baseEepHeader;
 
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                               "Read Magic = 0x%04X\n", magic);
-
-               if (magic != AR5416_EEPROM_MAGIC) {
-                       magic2 = swab16(magic);
-
-                       if (magic2 == AR5416_EEPROM_MAGIC) {
-                               need_swap = true;
-                               eepdata = (u16 *) (&ahp->ah_eeprom);
-
-                               for (addr = 0; addr < EEPROM_4K_SIZE; addr++) {
-                                       temp = swab16(*eepdata);
-                                       *eepdata = temp;
-                                       eepdata++;
-
-                                       DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                                               "0x%04X  ", *eepdata);
-
-                                       if (((addr + 1) % 6) == 0)
-                                               DPRINTF(ah->ah_sc,
-                                                       ATH_DBG_EEPROM, "\n");
-                               }
-                       } else {
-                               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                                       "Invalid EEPROM Magic. "
-                                       "endianness mismatch.\n");
-                               return -EINVAL;
-                       }
-               }
-       }
-
-       DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, "need_swap = %s.\n",
-               need_swap ? "True" : "False");
-
-       if (need_swap)
-               el = swab16(ahp->ah_eeprom.map4k.baseEepHeader.length);
-       else
-               el = ahp->ah_eeprom.map4k.baseEepHeader.length;
-
-       if (el > sizeof(struct ar5416_eeprom_def))
-               el = sizeof(struct ar5416_eeprom_4k) / sizeof(u16);
-       else
-               el = el / sizeof(u16);
-
-       eepdata = (u16 *)(&ahp->ah_eeprom);
-
-       for (i = 0; i < el; i++)
-               sum ^= *eepdata++;
-
-       if (need_swap) {
-               u32 integer;
-               u16 word;
-
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                       "EEPROM Endianness is not native.. Changing \n");
-
-               word = swab16(eep->baseEepHeader.length);
-               eep->baseEepHeader.length = word;
-
-               word = swab16(eep->baseEepHeader.checksum);
-               eep->baseEepHeader.checksum = word;
-
-               word = swab16(eep->baseEepHeader.version);
-               eep->baseEepHeader.version = word;
-
-               word = swab16(eep->baseEepHeader.regDmn[0]);
-               eep->baseEepHeader.regDmn[0] = word;
-
-               word = swab16(eep->baseEepHeader.regDmn[1]);
-               eep->baseEepHeader.regDmn[1] = word;
-
-               word = swab16(eep->baseEepHeader.rfSilent);
-               eep->baseEepHeader.rfSilent = word;
-
-               word = swab16(eep->baseEepHeader.blueToothOptions);
-               eep->baseEepHeader.blueToothOptions = word;
-
-               word = swab16(eep->baseEepHeader.deviceCap);
-               eep->baseEepHeader.deviceCap = word;
-
-               integer = swab32(eep->modalHeader.antCtrlCommon);
-               eep->modalHeader.antCtrlCommon = integer;
-
-               for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-                       integer = swab32(eep->modalHeader.antCtrlChain[i]);
-                       eep->modalHeader.antCtrlChain[i] = integer;
-               }
-
-               for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
-                       word = swab16(eep->modalHeader.spurChans[i].spurChan);
-                       eep->modalHeader.spurChans[i].spurChan = word;
-               }
-       }
-
-       if (sum != 0xffff || ar5416_get_eep4k_ver(ahp) != AR5416_EEP_VER ||
-           ar5416_get_eep4k_rev(ahp) < AR5416_EEP_NO_BACK_VER) {
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                       "Bad EEPROM checksum 0x%x or revision 0x%04x\n",
-                       sum, ar5416_get_eep4k_ver(ahp));
-               return -EINVAL;
-       }
-
-       return 0;
-#undef EEPROM_4K_SIZE
-}
-
-static int (*ath9k_check_eeprom[]) (struct ath_hal *) = {
-       ath9k_hw_check_def_eeprom,
-       ath9k_hw_check_4k_eeprom
-};
-
-static inline int ath9k_hw_check_eeprom(struct ath_hal *ah)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       return ath9k_check_eeprom[ahp->ah_eep_map](ah);
-}
-
-static inline bool ath9k_hw_fill_vpd_table(u8 pwrMin, u8 pwrMax, u8 *pPwrList,
-                                          u8 *pVpdList, u16 numIntercepts,
-                                          u8 *pRetVpdList)
-{
-       u16 i, k;
-       u8 currPwr = pwrMin;
-       u16 idxL = 0, idxR = 0;
-
-       for (i = 0; i <= (pwrMax - pwrMin) / 2; i++) {
-               ath9k_hw_get_lower_upper_index(currPwr, pPwrList,
-                                              numIntercepts, &(idxL),
-                                              &(idxR));
-               if (idxR < 1)
-                       idxR = 1;
-               if (idxL == numIntercepts - 1)
-                       idxL = (u16) (numIntercepts - 2);
-               if (pPwrList[idxL] == pPwrList[idxR])
-                       k = pVpdList[idxL];
-               else
-                       k = (u16)(((currPwr - pPwrList[idxL]) * pVpdList[idxR] +
-                                  (pPwrList[idxR] - currPwr) * pVpdList[idxL]) /
-                                 (pPwrList[idxR] - pPwrList[idxL]));
-               pRetVpdList[i] = (u8) k;
-               currPwr += 2;
+       switch (param) {
+       case EEP_NFTHRESH_2:
+               return pModal[1].noiseFloorThreshCh[0];
+       case AR_EEPROM_MAC(0):
+               return pBase->macAddr[0] << 8 | pBase->macAddr[1];
+       case AR_EEPROM_MAC(1):
+               return pBase->macAddr[2] << 8 | pBase->macAddr[3];
+       case AR_EEPROM_MAC(2):
+               return pBase->macAddr[4] << 8 | pBase->macAddr[5];
+       case EEP_REG_0:
+               return pBase->regDmn[0];
+       case EEP_REG_1:
+               return pBase->regDmn[1];
+       case EEP_OP_CAP:
+               return pBase->deviceCap;
+       case EEP_OP_MODE:
+               return pBase->opCapFlags;
+       case EEP_RF_SILENT:
+               return pBase->rfSilent;
+       case EEP_OB_2:
+               return pModal->ob_01;
+       case EEP_DB_2:
+               return pModal->db1_01;
+       case EEP_MINOR_REV:
+               return pBase->version & AR5416_EEP_VER_MINOR_MASK;
+       case EEP_TX_MASK:
+               return pBase->txMask;
+       case EEP_RX_MASK:
+               return pBase->rxMask;
+       default:
+               return 0;
        }
-
-       return true;
 }
 
-static void ath9k_hw_get_4k_gain_boundaries_pdadcs(struct ath_hal *ah,
+static void ath9k_hw_get_4k_gain_boundaries_pdadcs(struct ath_hw *ah,
                                struct ath9k_channel *chan,
                                struct cal_data_per_freq_4k *pRawDataSet,
                                u8 *bChans, u16 availPiers,
@@ -669,1375 +639,1229 @@ static void ath9k_hw_get_4k_gain_boundaries_pdadcs(struct ath_hal *ah,
 #undef TMP_VAL_VPD_TABLE
 }
 
-static void ath9k_hw_get_def_gain_boundaries_pdadcs(struct ath_hal *ah,
-                               struct ath9k_channel *chan,
-                               struct cal_data_per_freq *pRawDataSet,
-                               u8 *bChans, u16 availPiers,
-                               u16 tPdGainOverlap, int16_t *pMinCalPower,
-                               u16 *pPdGainBoundaries, u8 *pPDADCValues,
-                               u16 numXpdGains)
+static bool ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah,
+                                 struct ath9k_channel *chan,
+                                 int16_t *pTxPowerIndexOffset)
 {
-       int i, j, k;
-       int16_t ss;
-       u16 idxL = 0, idxR = 0, numPiers;
-       static u8 vpdTableL[AR5416_NUM_PD_GAINS]
-               [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
-       static u8 vpdTableR[AR5416_NUM_PD_GAINS]
-               [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
-       static u8 vpdTableI[AR5416_NUM_PD_GAINS]
-               [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
-
-       u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
-       u8 minPwrT4[AR5416_NUM_PD_GAINS];
-       u8 maxPwrT4[AR5416_NUM_PD_GAINS];
-       int16_t vpdStep;
-       int16_t tmpVal;
-       u16 sizeCurrVpdTable, maxIndex, tgtIndex;
-       bool match;
-       int16_t minDelta = 0;
-       struct chan_centers centers;
+       struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
+       struct cal_data_per_freq_4k *pRawDataset;
+       u8 *pCalBChans = NULL;
+       u16 pdGainOverlap_t2;
+       static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
+       u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
+       u16 numPiers, i, j;
+       int16_t tMinCalPower;
+       u16 numXpdGain, xpdMask;
+       u16 xpdGainValues[AR5416_NUM_PD_GAINS] = { 0, 0, 0, 0 };
+       u32 reg32, regOffset, regChainOffset;
 
-       ath9k_hw_get_channel_centers(ah, chan, &centers);
+       xpdMask = pEepData->modalHeader.xpdGain;
 
-       for (numPiers = 0; numPiers < availPiers; numPiers++) {
-               if (bChans[numPiers] == AR5416_BCHAN_UNUSED)
-                       break;
+       if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
+           AR5416_EEP_MINOR_VER_2) {
+               pdGainOverlap_t2 =
+                       pEepData->modalHeader.pdGainOverlap;
+       } else {
+               pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5),
+                                           AR_PHY_TPCRG5_PD_GAIN_OVERLAP));
        }
 
-       match = ath9k_hw_get_lower_upper_index((u8)FREQ2FBIN(centers.synth_center,
-                                                            IS_CHAN_2GHZ(chan)),
-                                              bChans, numPiers, &idxL, &idxR);
-
-       if (match) {
-               for (i = 0; i < numXpdGains; i++) {
-                       minPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][0];
-                       maxPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][4];
-                       ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
-                                       pRawDataSet[idxL].pwrPdg[i],
-                                       pRawDataSet[idxL].vpdPdg[i],
-                                       AR5416_PD_GAIN_ICEPTS,
-                                       vpdTableI[i]);
-               }
-       } else {
-               for (i = 0; i < numXpdGains; i++) {
-                       pVpdL = pRawDataSet[idxL].vpdPdg[i];
-                       pPwrL = pRawDataSet[idxL].pwrPdg[i];
-                       pVpdR = pRawDataSet[idxR].vpdPdg[i];
-                       pPwrR = pRawDataSet[idxR].pwrPdg[i];
+       pCalBChans = pEepData->calFreqPier2G;
+       numPiers = AR5416_NUM_2G_CAL_PIERS;
 
-                       minPwrT4[i] = max(pPwrL[0], pPwrR[0]);
+       numXpdGain = 0;
 
-                       maxPwrT4[i] =
-                               min(pPwrL[AR5416_PD_GAIN_ICEPTS - 1],
-                                   pPwrR[AR5416_PD_GAIN_ICEPTS - 1]);
+       for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
+               if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
+                       if (numXpdGain >= AR5416_NUM_PD_GAINS)
+                               break;
+                       xpdGainValues[numXpdGain] =
+                               (u16)(AR5416_PD_GAINS_IN_MASK - i);
+                       numXpdGain++;
+               }
+       }
 
+       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
+                     (numXpdGain - 1) & 0x3);
+       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
+                     xpdGainValues[0]);
+       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
+                     xpdGainValues[1]);
+       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3,
+                     xpdGainValues[2]);
 
-                       ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
-                                               pPwrL, pVpdL,
-                                               AR5416_PD_GAIN_ICEPTS,
-                                               vpdTableL[i]);
-                       ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
-                                               pPwrR, pVpdR,
-                                               AR5416_PD_GAIN_ICEPTS,
-                                               vpdTableR[i]);
-
-                       for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
-                               vpdTableI[i][j] =
-                                       (u8)(ath9k_hw_interpolate((u16)
-                                            FREQ2FBIN(centers.
-                                                      synth_center,
-                                                      IS_CHAN_2GHZ
-                                                      (chan)),
-                                            bChans[idxL], bChans[idxR],
-                                            vpdTableL[i][j], vpdTableR[i][j]));
-                       }
-               }
-       }
-
-       *pMinCalPower = (int16_t)(minPwrT4[0] / 2);
-
-       k = 0;
-
-       for (i = 0; i < numXpdGains; i++) {
-               if (i == (numXpdGains - 1))
-                       pPdGainBoundaries[i] =
-                               (u16)(maxPwrT4[i] / 2);
-               else
-                       pPdGainBoundaries[i] =
-                               (u16)((maxPwrT4[i] + minPwrT4[i + 1]) / 4);
-
-               pPdGainBoundaries[i] =
-                       min((u16)AR5416_MAX_RATE_POWER, pPdGainBoundaries[i]);
-
-               if ((i == 0) && !AR_SREV_5416_V20_OR_LATER(ah)) {
-                       minDelta = pPdGainBoundaries[0] - 23;
-                       pPdGainBoundaries[0] = 23;
-               } else {
-                       minDelta = 0;
-               }
+       for (i = 0; i < AR5416_MAX_CHAINS; i++) {
+               if (AR_SREV_5416_V20_OR_LATER(ah) &&
+                   (ah->rxchainmask == 5 || ah->txchainmask == 5) &&
+                   (i != 0)) {
+                       regChainOffset = (i == 1) ? 0x2000 : 0x1000;
+               } else
+                       regChainOffset = i * 0x1000;
 
-               if (i == 0) {
-                       if (AR_SREV_9280_10_OR_LATER(ah))
-                               ss = (int16_t)(0 - (minPwrT4[i] / 2));
-                       else
-                               ss = 0;
-               } else {
-                       ss = (int16_t)((pPdGainBoundaries[i - 1] -
-                                       (minPwrT4[i] / 2)) -
-                                      tPdGainOverlap + 1 + minDelta);
-               }
-               vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
-               vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
+               if (pEepData->baseEepHeader.txMask & (1 << i)) {
+                       pRawDataset = pEepData->calPierData2G[i];
 
-               while ((ss < 0) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
-                       tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep);
-                       pPDADCValues[k++] = (u8)((tmpVal < 0) ? 0 : tmpVal);
-                       ss++;
-               }
+                       ath9k_hw_get_4k_gain_boundaries_pdadcs(ah, chan,
+                                           pRawDataset, pCalBChans,
+                                           numPiers, pdGainOverlap_t2,
+                                           &tMinCalPower, gainBoundaries,
+                                           pdadcValues, numXpdGain);
 
-               sizeCurrVpdTable = (u8) ((maxPwrT4[i] - minPwrT4[i]) / 2 + 1);
-               tgtIndex = (u8)(pPdGainBoundaries[i] + tPdGainOverlap -
-                               (minPwrT4[i] / 2));
-               maxIndex = (tgtIndex < sizeCurrVpdTable) ?
-                       tgtIndex : sizeCurrVpdTable;
+                       if ((i == 0) || AR_SREV_5416_V20_OR_LATER(ah)) {
+                               REG_WRITE(ah, AR_PHY_TPCRG5 + regChainOffset,
+                                         SM(pdGainOverlap_t2,
+                                            AR_PHY_TPCRG5_PD_GAIN_OVERLAP)
+                                         | SM(gainBoundaries[0],
+                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1)
+                                         | SM(gainBoundaries[1],
+                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2)
+                                         | SM(gainBoundaries[2],
+                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3)
+                                         | SM(gainBoundaries[3],
+                                      AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4));
+                       }
 
-               while ((ss < maxIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
-                       pPDADCValues[k++] = vpdTableI[i][ss++];
-               }
+                       regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset;
+                       for (j = 0; j < 32; j++) {
+                               reg32 = ((pdadcValues[4 * j + 0] & 0xFF) << 0) |
+                                       ((pdadcValues[4 * j + 1] & 0xFF) << 8) |
+                                       ((pdadcValues[4 * j + 2] & 0xFF) << 16)|
+                                       ((pdadcValues[4 * j + 3] & 0xFF) << 24);
+                               REG_WRITE(ah, regOffset, reg32);
 
-               vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] -
-                                   vpdTableI[i][sizeCurrVpdTable - 2]);
-               vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
+                               DPRINTF(ah->ah_sc, ATH_DBG_REG_IO,
+                                       "PDADC (%d,%4x): %4.4x %8.8x\n",
+                                       i, regChainOffset, regOffset,
+                                       reg32);
+                               DPRINTF(ah->ah_sc, ATH_DBG_REG_IO,
+                                       "PDADC: Chain %d | "
+                                       "PDADC %3d Value %3d | "
+                                       "PDADC %3d Value %3d | "
+                                       "PDADC %3d Value %3d | "
+                                       "PDADC %3d Value %3d |\n",
+                                       i, 4 * j, pdadcValues[4 * j],
+                                       4 * j + 1, pdadcValues[4 * j + 1],
+                                       4 * j + 2, pdadcValues[4 * j + 2],
+                                       4 * j + 3,
+                                       pdadcValues[4 * j + 3]);
 
-               if (tgtIndex > maxIndex) {
-                       while ((ss <= tgtIndex) &&
-                              (k < (AR5416_NUM_PDADC_VALUES - 1))) {
-                               tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] +
-                                                   (ss - maxIndex + 1) * vpdStep));
-                               pPDADCValues[k++] = (u8)((tmpVal > 255) ?
-                                                        255 : tmpVal);
-                               ss++;
+                               regOffset += 4;
                        }
                }
        }
 
-       while (i < AR5416_PD_GAINS_IN_MASK) {
-               pPdGainBoundaries[i] = pPdGainBoundaries[i - 1];
-               i++;
-       }
-
-       while (k < AR5416_NUM_PDADC_VALUES) {
-               pPDADCValues[k] = pPDADCValues[k - 1];
-               k++;
-       }
+       *pTxPowerIndexOffset = 0;
 
-       return;
+       return true;
 }
 
-static void ath9k_hw_get_legacy_target_powers(struct ath_hal *ah,
-                                     struct ath9k_channel *chan,
-                                     struct cal_target_power_leg *powInfo,
-                                     u16 numChannels,
-                                     struct cal_target_power_leg *pNewPower,
-                                     u16 numRates, bool isExtTarget)
+static bool ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah,
+                                                struct ath9k_channel *chan,
+                                                int16_t *ratesArray,
+                                                u16 cfgCtl,
+                                                u16 AntennaReduction,
+                                                u16 twiceMaxRegulatoryPower,
+                                                u16 powerLimit)
 {
-       struct chan_centers centers;
-       u16 clo, chi;
+       struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
+       u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
+       static const u16 tpScaleReductionTable[5] =
+               { 0, 3, 6, 9, AR5416_MAX_RATE_POWER };
+
        int i;
-       int matchIndex = -1, lowIndex = -1;
-       u16 freq;
+       int16_t twiceLargestAntenna;
+       struct cal_ctl_data_4k *rep;
+       struct cal_target_power_leg targetPowerOfdm, targetPowerCck = {
+               0, { 0, 0, 0, 0}
+       };
+       struct cal_target_power_leg targetPowerOfdmExt = {
+               0, { 0, 0, 0, 0} }, targetPowerCckExt = {
+               0, { 0, 0, 0, 0 }
+       };
+       struct cal_target_power_ht targetPowerHt20, targetPowerHt40 = {
+               0, {0, 0, 0, 0}
+       };
+       u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
+       u16 ctlModesFor11g[] =
+               { CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT, CTL_11G_EXT,
+                 CTL_2GHT40
+               };
+       u16 numCtlModes, *pCtlMode, ctlMode, freq;
+       struct chan_centers centers;
+       int tx_chainmask;
+       u16 twiceMinEdgePower;
+
+       tx_chainmask = ah->txchainmask;
 
        ath9k_hw_get_channel_centers(ah, chan, &centers);
-       freq = (isExtTarget) ? centers.ext_center : centers.ctl_center;
 
-       if (freq <= ath9k_hw_fbin2freq(powInfo[0].bChannel,
-                                      IS_CHAN_2GHZ(chan))) {
-               matchIndex = 0;
-       } else {
-               for (i = 0; (i < numChannels) &&
-                            (powInfo[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
-                       if (freq == ath9k_hw_fbin2freq(powInfo[i].bChannel,
-                                                      IS_CHAN_2GHZ(chan))) {
-                               matchIndex = i;
-                               break;
-                       } else if ((freq < ath9k_hw_fbin2freq(powInfo[i].bChannel,
-                                                     IS_CHAN_2GHZ(chan))) &&
-                                  (freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel,
-                                                     IS_CHAN_2GHZ(chan)))) {
-                               lowIndex = i - 1;
-                               break;
-                       }
-               }
-               if ((matchIndex == -1) && (lowIndex == -1))
-                       matchIndex = i - 1;
-       }
+       twiceLargestAntenna = pEepData->modalHeader.antennaGainCh[0];
 
-       if (matchIndex != -1) {
-               *pNewPower = powInfo[matchIndex];
-       } else {
-               clo = ath9k_hw_fbin2freq(powInfo[lowIndex].bChannel,
-                                        IS_CHAN_2GHZ(chan));
-               chi = ath9k_hw_fbin2freq(powInfo[lowIndex + 1].bChannel,
-                                        IS_CHAN_2GHZ(chan));
+       twiceLargestAntenna = (int16_t)min(AntennaReduction -
+                                          twiceLargestAntenna, 0);
 
-               for (i = 0; i < numRates; i++) {
-                       pNewPower->tPow2x[i] =
-                               (u8)ath9k_hw_interpolate(freq, clo, chi,
-                                               powInfo[lowIndex].tPow2x[i],
-                                               powInfo[lowIndex + 1].tPow2x[i]);
-               }
+       maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna;
+
+       if (ah->regulatory.tp_scale != ATH9K_TP_SCALE_MAX) {
+               maxRegAllowedPower -=
+                       (tpScaleReductionTable[(ah->regulatory.tp_scale)] * 2);
        }
-}
 
-static void ath9k_hw_get_target_powers(struct ath_hal *ah,
-                                      struct ath9k_channel *chan,
-                                      struct cal_target_power_ht *powInfo,
-                                      u16 numChannels,
-                                      struct cal_target_power_ht *pNewPower,
-                                      u16 numRates, bool isHt40Target)
-{
-       struct chan_centers centers;
-       u16 clo, chi;
-       int i;
-       int matchIndex = -1, lowIndex = -1;
-       u16 freq;
+       scaledPower = min(powerLimit, maxRegAllowedPower);
+       scaledPower = max((u16)0, scaledPower);
 
-       ath9k_hw_get_channel_centers(ah, chan, &centers);
-       freq = isHt40Target ? centers.synth_center : centers.ctl_center;
+       numCtlModes = ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40;
+       pCtlMode = ctlModesFor11g;
 
-       if (freq <= ath9k_hw_fbin2freq(powInfo[0].bChannel, IS_CHAN_2GHZ(chan))) {
-               matchIndex = 0;
-       } else {
-               for (i = 0; (i < numChannels) &&
-                            (powInfo[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
-                       if (freq == ath9k_hw_fbin2freq(powInfo[i].bChannel,
-                                                      IS_CHAN_2GHZ(chan))) {
-                               matchIndex = i;
-                               break;
-                       } else
-                               if ((freq < ath9k_hw_fbin2freq(powInfo[i].bChannel,
-                                                      IS_CHAN_2GHZ(chan))) &&
-                                   (freq > ath9k_hw_fbin2freq(powInfo[i - 1].bChannel,
-                                                      IS_CHAN_2GHZ(chan)))) {
-                                       lowIndex = i - 1;
-                                       break;
-                               }
-               }
-               if ((matchIndex == -1) && (lowIndex == -1))
-                       matchIndex = i - 1;
+       ath9k_hw_get_legacy_target_powers(ah, chan,
+                       pEepData->calTargetPowerCck,
+                       AR5416_NUM_2G_CCK_TARGET_POWERS,
+                       &targetPowerCck, 4, false);
+       ath9k_hw_get_legacy_target_powers(ah, chan,
+                       pEepData->calTargetPower2G,
+                       AR5416_NUM_2G_20_TARGET_POWERS,
+                       &targetPowerOfdm, 4, false);
+       ath9k_hw_get_target_powers(ah, chan,
+                       pEepData->calTargetPower2GHT20,
+                       AR5416_NUM_2G_20_TARGET_POWERS,
+                       &targetPowerHt20, 8, false);
+
+       if (IS_CHAN_HT40(chan)) {
+               numCtlModes = ARRAY_SIZE(ctlModesFor11g);
+               ath9k_hw_get_target_powers(ah, chan,
+                               pEepData->calTargetPower2GHT40,
+                               AR5416_NUM_2G_40_TARGET_POWERS,
+                               &targetPowerHt40, 8, true);
+               ath9k_hw_get_legacy_target_powers(ah, chan,
+                               pEepData->calTargetPowerCck,
+                               AR5416_NUM_2G_CCK_TARGET_POWERS,
+                               &targetPowerCckExt, 4, true);
+               ath9k_hw_get_legacy_target_powers(ah, chan,
+                               pEepData->calTargetPower2G,
+                               AR5416_NUM_2G_20_TARGET_POWERS,
+                               &targetPowerOfdmExt, 4, true);
        }
 
-       if (matchIndex != -1) {
-               *pNewPower = powInfo[matchIndex];
-       } else {
-               clo = ath9k_hw_fbin2freq(powInfo[lowIndex].bChannel,
-                                        IS_CHAN_2GHZ(chan));
-               chi = ath9k_hw_fbin2freq(powInfo[lowIndex + 1].bChannel,
-                                        IS_CHAN_2GHZ(chan));
+       for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
+               bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
+                       (pCtlMode[ctlMode] == CTL_2GHT40);
+               if (isHt40CtlMode)
+                       freq = centers.synth_center;
+               else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
+                       freq = centers.ext_center;
+               else
+                       freq = centers.ctl_center;
 
-               for (i = 0; i < numRates; i++) {
-                       pNewPower->tPow2x[i] = (u8)ath9k_hw_interpolate(freq,
-                                               clo, chi,
-                                               powInfo[lowIndex].tPow2x[i],
-                                               powInfo[lowIndex + 1].tPow2x[i]);
+               if (ah->eep_ops->get_eeprom_ver(ah) == 14 &&
+                   ah->eep_ops->get_eeprom_rev(ah) <= 2)
+                       twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
+
+               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
+                       "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, "
+                       "EXT_ADDITIVE %d\n",
+                       ctlMode, numCtlModes, isHt40CtlMode,
+                       (pCtlMode[ctlMode] & EXT_ADDITIVE));
+
+               for (i = 0; (i < AR5416_NUM_CTLS) &&
+                               pEepData->ctlIndex[i]; i++) {
+                       DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
+                               "  LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
+                               "pCtlMode 0x%2.2x ctlIndex 0x%2.2x "
+                               "chan %d\n",
+                               i, cfgCtl, pCtlMode[ctlMode],
+                               pEepData->ctlIndex[i], chan->channel);
+
+                       if ((((cfgCtl & ~CTL_MODE_M) |
+                             (pCtlMode[ctlMode] & CTL_MODE_M)) ==
+                            pEepData->ctlIndex[i]) ||
+                           (((cfgCtl & ~CTL_MODE_M) |
+                             (pCtlMode[ctlMode] & CTL_MODE_M)) ==
+                            ((pEepData->ctlIndex[i] & CTL_MODE_M) |
+                             SD_NO_CTL))) {
+                               rep = &(pEepData->ctlData[i]);
+
+                               twiceMinEdgePower =
+                                       ath9k_hw_get_max_edge_power(freq,
+                               rep->ctlEdges[ar5416_get_ntxchains
+                                               (tx_chainmask) - 1],
+                               IS_CHAN_2GHZ(chan),
+                               AR5416_EEP4K_NUM_BAND_EDGES);
+
+                               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
+                                       "    MATCH-EE_IDX %d: ch %d is2 %d "
+                                       "2xMinEdge %d chainmask %d chains %d\n",
+                                       i, freq, IS_CHAN_2GHZ(chan),
+                                       twiceMinEdgePower, tx_chainmask,
+                                       ar5416_get_ntxchains
+                                       (tx_chainmask));
+                               if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
+                                       twiceMaxEdgePower =
+                                               min(twiceMaxEdgePower,
+                                                   twiceMinEdgePower);
+                               } else {
+                                       twiceMaxEdgePower = twiceMinEdgePower;
+                                       break;
+                               }
+                       }
                }
-       }
-}
 
-static u16 ath9k_hw_get_max_edge_power(u16 freq,
-                                      struct cal_ctl_edges *pRdEdgesPower,
-                                      bool is2GHz, int num_band_edges)
-{
-       u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
-       int i;
+               minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
 
-       for (i = 0; (i < num_band_edges) &&
-                    (pRdEdgesPower[i].bChannel != AR5416_BCHAN_UNUSED); i++) {
-               if (freq == ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel, is2GHz)) {
-                       twiceMaxEdgePower = pRdEdgesPower[i].tPower;
+               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
+                       "    SEL-Min ctlMode %d pCtlMode %d "
+                       "2xMaxEdge %d sP %d minCtlPwr %d\n",
+                       ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower,
+                       scaledPower, minCtlPower);
+
+               switch (pCtlMode[ctlMode]) {
+               case CTL_11B:
+                       for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x);
+                                       i++) {
+                               targetPowerCck.tPow2x[i] =
+                                       min((u16)targetPowerCck.tPow2x[i],
+                                           minCtlPower);
+                       }
                        break;
-               } else if ((i > 0) &&
-                          (freq < ath9k_hw_fbin2freq(pRdEdgesPower[i].bChannel,
-                                                     is2GHz))) {
-                       if (ath9k_hw_fbin2freq(pRdEdgesPower[i - 1].bChannel,
-                                              is2GHz) < freq &&
-                           pRdEdgesPower[i - 1].flag) {
-                               twiceMaxEdgePower =
-                                       pRdEdgesPower[i - 1].tPower;
+               case CTL_11G:
+                       for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x);
+                                       i++) {
+                               targetPowerOfdm.tPow2x[i] =
+                                       min((u16)targetPowerOfdm.tPow2x[i],
+                                           minCtlPower);
+                       }
+                       break;
+               case CTL_2GHT20:
+                       for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x);
+                                       i++) {
+                               targetPowerHt20.tPow2x[i] =
+                                       min((u16)targetPowerHt20.tPow2x[i],
+                                           minCtlPower);
+                       }
+                       break;
+               case CTL_11B_EXT:
+                       targetPowerCckExt.tPow2x[0] = min((u16)
+                                       targetPowerCckExt.tPow2x[0],
+                                       minCtlPower);
+                       break;
+               case CTL_11G_EXT:
+                       targetPowerOfdmExt.tPow2x[0] = min((u16)
+                                       targetPowerOfdmExt.tPow2x[0],
+                                       minCtlPower);
+                       break;
+               case CTL_2GHT40:
+                       for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x);
+                                       i++) {
+                               targetPowerHt40.tPow2x[i] =
+                                       min((u16)targetPowerHt40.tPow2x[i],
+                                           minCtlPower);
                        }
                        break;
+               default:
+                       break;
                }
        }
 
-       return twiceMaxEdgePower;
+       ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] =
+               ratesArray[rate18mb] = ratesArray[rate24mb] =
+               targetPowerOfdm.tPow2x[0];
+       ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1];
+       ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2];
+       ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3];
+       ratesArray[rateXr] = targetPowerOfdm.tPow2x[0];
+
+       for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++)
+               ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i];
+
+       ratesArray[rate1l] = targetPowerCck.tPow2x[0];
+       ratesArray[rate2s] = ratesArray[rate2l] = targetPowerCck.tPow2x[1];
+       ratesArray[rate5_5s] = ratesArray[rate5_5l] = targetPowerCck.tPow2x[2];
+       ratesArray[rate11s] = ratesArray[rate11l] = targetPowerCck.tPow2x[3];
+
+       if (IS_CHAN_HT40(chan)) {
+               for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
+                       ratesArray[rateHt40_0 + i] =
+                               targetPowerHt40.tPow2x[i];
+               }
+               ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0];
+               ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0];
+               ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0];
+               ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0];
+       }
+       return true;
 }
 
-static bool ath9k_hw_set_def_power_cal_table(struct ath_hal *ah,
-                                 struct ath9k_channel *chan,
-                                 int16_t *pTxPowerIndexOffset)
+static int ath9k_hw_4k_set_txpower(struct ath_hw *ah,
+                                  struct ath9k_channel *chan,
+                                  u16 cfgCtl,
+                                  u8 twiceAntennaReduction,
+                                  u8 twiceMaxRegulatoryPower,
+                                  u8 powerLimit)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *pEepData = &ahp->ah_eeprom.def;
-       struct cal_data_per_freq *pRawDataset;
-       u8 *pCalBChans = NULL;
-       u16 pdGainOverlap_t2;
-       static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
-       u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
-       u16 numPiers, i, j;
-       int16_t tMinCalPower;
-       u16 numXpdGain, xpdMask;
-       u16 xpdGainValues[AR5416_NUM_PD_GAINS] = { 0, 0, 0, 0 };
-       u32 reg32, regOffset, regChainOffset;
-       int16_t modalIdx;
+       struct ar5416_eeprom_4k *pEepData = &ah->eeprom.map4k;
+       struct modal_eep_4k_header *pModal = &pEepData->modalHeader;
+       int16_t ratesArray[Ar5416RateSize];
+       int16_t txPowerIndexOffset = 0;
+       u8 ht40PowerIncForPdadc = 2;
+       int i;
 
-       modalIdx = IS_CHAN_2GHZ(chan) ? 1 : 0;
-       xpdMask = pEepData->modalHeader[modalIdx].xpdGain;
+       memset(ratesArray, 0, sizeof(ratesArray));
 
        if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
            AR5416_EEP_MINOR_VER_2) {
-               pdGainOverlap_t2 =
-                       pEepData->modalHeader[modalIdx].pdGainOverlap;
-       } else {
-               pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5),
-                                           AR_PHY_TPCRG5_PD_GAIN_OVERLAP));
+               ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc;
        }
 
-       if (IS_CHAN_2GHZ(chan)) {
-               pCalBChans = pEepData->calFreqPier2G;
-               numPiers = AR5416_NUM_2G_CAL_PIERS;
-       } else {
-               pCalBChans = pEepData->calFreqPier5G;
-               numPiers = AR5416_NUM_5G_CAL_PIERS;
+       if (!ath9k_hw_set_4k_power_per_rate_table(ah, chan,
+                                              &ratesArray[0], cfgCtl,
+                                              twiceAntennaReduction,
+                                              twiceMaxRegulatoryPower,
+                                              powerLimit)) {
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                       "ath9k_hw_set_txpower: unable to set "
+                       "tx power per rate table\n");
+               return -EIO;
        }
 
-       numXpdGain = 0;
+       if (!ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset)) {
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                        "ath9k_hw_set_txpower: unable to set power table\n");
+               return -EIO;
+       }
 
-       for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
-               if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
-                       if (numXpdGain >= AR5416_NUM_PD_GAINS)
-                               break;
-                       xpdGainValues[numXpdGain] =
-                               (u16)(AR5416_PD_GAINS_IN_MASK - i);
-                       numXpdGain++;
-               }
+       for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
+               ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
+               if (ratesArray[i] > AR5416_MAX_RATE_POWER)
+                       ratesArray[i] = AR5416_MAX_RATE_POWER;
        }
 
-       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
-                     (numXpdGain - 1) & 0x3);
-       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
-                     xpdGainValues[0]);
-       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
-                     xpdGainValues[1]);
-       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3,
-                     xpdGainValues[2]);
+       if (AR_SREV_9280_10_OR_LATER(ah)) {
+               for (i = 0; i < Ar5416RateSize; i++)
+                       ratesArray[i] -= AR5416_PWR_TABLE_OFFSET * 2;
+       }
 
-       for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-               if (AR_SREV_5416_V20_OR_LATER(ah) &&
-                   (ahp->ah_rxchainmask == 5 || ahp->ah_txchainmask == 5) &&
-                   (i != 0)) {
-                       regChainOffset = (i == 1) ? 0x2000 : 0x1000;
-               } else
-                       regChainOffset = i * 0x1000;
+       REG_WRITE(ah, AR_PHY_POWER_TX_RATE1,
+                 ATH9K_POW_SM(ratesArray[rate18mb], 24)
+                 | ATH9K_POW_SM(ratesArray[rate12mb], 16)
+                 | ATH9K_POW_SM(ratesArray[rate9mb], 8)
+                 | ATH9K_POW_SM(ratesArray[rate6mb], 0));
+       REG_WRITE(ah, AR_PHY_POWER_TX_RATE2,
+                 ATH9K_POW_SM(ratesArray[rate54mb], 24)
+                 | ATH9K_POW_SM(ratesArray[rate48mb], 16)
+                 | ATH9K_POW_SM(ratesArray[rate36mb], 8)
+                 | ATH9K_POW_SM(ratesArray[rate24mb], 0));
 
-               if (pEepData->baseEepHeader.txMask & (1 << i)) {
-                       if (IS_CHAN_2GHZ(chan))
-                               pRawDataset = pEepData->calPierData2G[i];
-                       else
-                               pRawDataset = pEepData->calPierData5G[i];
+       if (IS_CHAN_2GHZ(chan)) {
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE3,
+                         ATH9K_POW_SM(ratesArray[rate2s], 24)
+                         | ATH9K_POW_SM(ratesArray[rate2l], 16)
+                         | ATH9K_POW_SM(ratesArray[rateXr], 8)
+                         | ATH9K_POW_SM(ratesArray[rate1l], 0));
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE4,
+                         ATH9K_POW_SM(ratesArray[rate11s], 24)
+                         | ATH9K_POW_SM(ratesArray[rate11l], 16)
+                         | ATH9K_POW_SM(ratesArray[rate5_5s], 8)
+                         | ATH9K_POW_SM(ratesArray[rate5_5l], 0));
+       }
 
-                       ath9k_hw_get_def_gain_boundaries_pdadcs(ah, chan,
-                                           pRawDataset, pCalBChans,
-                                           numPiers, pdGainOverlap_t2,
-                                           &tMinCalPower, gainBoundaries,
-                                           pdadcValues, numXpdGain);
+       REG_WRITE(ah, AR_PHY_POWER_TX_RATE5,
+                 ATH9K_POW_SM(ratesArray[rateHt20_3], 24)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_2], 16)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_1], 8)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_0], 0));
+       REG_WRITE(ah, AR_PHY_POWER_TX_RATE6,
+                 ATH9K_POW_SM(ratesArray[rateHt20_7], 24)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_6], 16)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_5], 8)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_4], 0));
 
-                       if ((i == 0) || AR_SREV_5416_V20_OR_LATER(ah)) {
-                               REG_WRITE(ah,
-                                         AR_PHY_TPCRG5 + regChainOffset,
-                                         SM(pdGainOverlap_t2,
-                                            AR_PHY_TPCRG5_PD_GAIN_OVERLAP)
-                                         | SM(gainBoundaries[0],
-                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1)
-                                         | SM(gainBoundaries[1],
-                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2)
-                                         | SM(gainBoundaries[2],
-                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3)
-                                         | SM(gainBoundaries[3],
-                                      AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4));
-                       }
+       if (IS_CHAN_HT40(chan)) {
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE7,
+                         ATH9K_POW_SM(ratesArray[rateHt40_3] +
+                                      ht40PowerIncForPdadc, 24)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_2] +
+                                        ht40PowerIncForPdadc, 16)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_1] +
+                                        ht40PowerIncForPdadc, 8)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_0] +
+                                        ht40PowerIncForPdadc, 0));
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE8,
+                         ATH9K_POW_SM(ratesArray[rateHt40_7] +
+                                      ht40PowerIncForPdadc, 24)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_6] +
+                                        ht40PowerIncForPdadc, 16)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_5] +
+                                        ht40PowerIncForPdadc, 8)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_4] +
+                                        ht40PowerIncForPdadc, 0));
 
-                       regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset;
-                       for (j = 0; j < 32; j++) {
-                               reg32 = ((pdadcValues[4 * j + 0] & 0xFF) << 0) |
-                                       ((pdadcValues[4 * j + 1] & 0xFF) << 8) |
-                                       ((pdadcValues[4 * j + 2] & 0xFF) << 16)|
-                                       ((pdadcValues[4 * j + 3] & 0xFF) << 24);
-                               REG_WRITE(ah, regOffset, reg32);
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE9,
+                         ATH9K_POW_SM(ratesArray[rateExtOfdm], 24)
+                         | ATH9K_POW_SM(ratesArray[rateExtCck], 16)
+                         | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
+                         | ATH9K_POW_SM(ratesArray[rateDupCck], 0));
+       }
 
-                               DPRINTF(ah->ah_sc, ATH_DBG_REG_IO,
-                                       "PDADC (%d,%4x): %4.4x %8.8x\n",
-                                       i, regChainOffset, regOffset,
-                                       reg32);
-                               DPRINTF(ah->ah_sc, ATH_DBG_REG_IO,
-                                       "PDADC: Chain %d | PDADC %3d "
-                                       "Value %3d | PDADC %3d Value %3d | "
-                                       "PDADC %3d Value %3d | PDADC %3d "
-                                       "Value %3d |\n",
-                                       i, 4 * j, pdadcValues[4 * j],
-                                       4 * j + 1, pdadcValues[4 * j + 1],
-                                       4 * j + 2, pdadcValues[4 * j + 2],
-                                       4 * j + 3,
-                                       pdadcValues[4 * j + 3]);
+       i = rate6mb;
 
-                               regOffset += 4;
-                       }
-               }
-       }
+       if (IS_CHAN_HT40(chan))
+               i = rateHt40_0;
+       else if (IS_CHAN_HT20(chan))
+               i = rateHt20_0;
 
-       *pTxPowerIndexOffset = 0;
+       if (AR_SREV_9280_10_OR_LATER(ah))
+               ah->regulatory.max_power_level =
+                       ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2;
+       else
+               ah->regulatory.max_power_level = ratesArray[i];
 
-       return true;
+       return 0;
 }
 
-static bool ath9k_hw_set_4k_power_cal_table(struct ath_hal *ah,
-                                 struct ath9k_channel *chan,
-                                 int16_t *pTxPowerIndexOffset)
+static void ath9k_hw_4k_set_addac(struct ath_hw *ah,
+                                 struct ath9k_channel *chan)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *pEepData = &ahp->ah_eeprom.map4k;
-       struct cal_data_per_freq_4k *pRawDataset;
-       u8 *pCalBChans = NULL;
-       u16 pdGainOverlap_t2;
-       static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
-       u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
-       u16 numPiers, i, j;
-       int16_t tMinCalPower;
-       u16 numXpdGain, xpdMask;
-       u16 xpdGainValues[AR5416_NUM_PD_GAINS] = { 0, 0, 0, 0 };
-       u32 reg32, regOffset, regChainOffset;
-
-       xpdMask = pEepData->modalHeader.xpdGain;
+       struct modal_eep_4k_header *pModal;
+       struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
+       u8 biaslevel;
 
-       if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
-           AR5416_EEP_MINOR_VER_2) {
-               pdGainOverlap_t2 =
-                       pEepData->modalHeader.pdGainOverlap;
-       } else {
-               pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5),
-                                           AR_PHY_TPCRG5_PD_GAIN_OVERLAP));
-       }
+       if (ah->hw_version.macVersion != AR_SREV_VERSION_9160)
+               return;
 
-       pCalBChans = pEepData->calFreqPier2G;
-       numPiers = AR5416_NUM_2G_CAL_PIERS;
+       if (ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_MINOR_VER_7)
+               return;
 
-       numXpdGain = 0;
+       pModal = &eep->modalHeader;
 
-       for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
-               if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
-                       if (numXpdGain >= AR5416_NUM_PD_GAINS)
-                               break;
-                       xpdGainValues[numXpdGain] =
-                               (u16)(AR5416_PD_GAINS_IN_MASK - i);
-                       numXpdGain++;
-               }
+       if (pModal->xpaBiasLvl != 0xff) {
+               biaslevel = pModal->xpaBiasLvl;
+               INI_RA(&ah->iniAddac, 7, 1) =
+                 (INI_RA(&ah->iniAddac, 7, 1) & (~0x18)) | biaslevel << 3;
        }
+}
 
-       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
-                     (numXpdGain - 1) & 0x3);
-       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
-                     xpdGainValues[0]);
-       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
-                     xpdGainValues[1]);
-       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3,
-                     xpdGainValues[2]);
-
-       for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-               if (AR_SREV_5416_V20_OR_LATER(ah) &&
-                   (ahp->ah_rxchainmask == 5 || ahp->ah_txchainmask == 5) &&
-                   (i != 0)) {
-                       regChainOffset = (i == 1) ? 0x2000 : 0x1000;
-               } else
-                       regChainOffset = i * 0x1000;
+static bool ath9k_hw_4k_set_board_values(struct ath_hw *ah,
+                                        struct ath9k_channel *chan)
+{
+       struct modal_eep_4k_header *pModal;
+       struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
+       int regChainOffset;
+       u8 txRxAttenLocal;
+       u8 ob[5], db1[5], db2[5];
+       u8 ant_div_control1, ant_div_control2;
+       u32 regVal;
 
-               if (pEepData->baseEepHeader.txMask & (1 << i)) {
-                       pRawDataset = pEepData->calPierData2G[i];
 
-                       ath9k_hw_get_4k_gain_boundaries_pdadcs(ah, chan,
-                                           pRawDataset, pCalBChans,
-                                           numPiers, pdGainOverlap_t2,
-                                           &tMinCalPower, gainBoundaries,
-                                           pdadcValues, numXpdGain);
+       pModal = &eep->modalHeader;
 
-                       if ((i == 0) || AR_SREV_5416_V20_OR_LATER(ah)) {
-                               REG_WRITE(ah, AR_PHY_TPCRG5 + regChainOffset,
-                                         SM(pdGainOverlap_t2,
-                                            AR_PHY_TPCRG5_PD_GAIN_OVERLAP)
-                                         | SM(gainBoundaries[0],
-                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1)
-                                         | SM(gainBoundaries[1],
-                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2)
-                                         | SM(gainBoundaries[2],
-                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3)
-                                         | SM(gainBoundaries[3],
-                                      AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4));
-                       }
+       txRxAttenLocal = 23;
 
-                       regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset;
-                       for (j = 0; j < 32; j++) {
-                               reg32 = ((pdadcValues[4 * j + 0] & 0xFF) << 0) |
-                                       ((pdadcValues[4 * j + 1] & 0xFF) << 8) |
-                                       ((pdadcValues[4 * j + 2] & 0xFF) << 16)|
-                                       ((pdadcValues[4 * j + 3] & 0xFF) << 24);
-                               REG_WRITE(ah, regOffset, reg32);
+       REG_WRITE(ah, AR_PHY_SWITCH_COM,
+                 ah->eep_ops->get_eeprom_antenna_cfg(ah, chan));
 
-                               DPRINTF(ah->ah_sc, ATH_DBG_REG_IO,
-                                       "PDADC (%d,%4x): %4.4x %8.8x\n",
-                                       i, regChainOffset, regOffset,
-                                       reg32);
-                               DPRINTF(ah->ah_sc, ATH_DBG_REG_IO,
-                                       "PDADC: Chain %d | "
-                                       "PDADC %3d Value %3d | "
-                                       "PDADC %3d Value %3d | "
-                                       "PDADC %3d Value %3d | "
-                                       "PDADC %3d Value %3d |\n",
-                                       i, 4 * j, pdadcValues[4 * j],
-                                       4 * j + 1, pdadcValues[4 * j + 1],
-                                       4 * j + 2, pdadcValues[4 * j + 2],
-                                       4 * j + 3,
-                                       pdadcValues[4 * j + 3]);
+       regChainOffset = 0;
+       REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
+                 pModal->antCtrlChain[0]);
 
-                               regOffset += 4;
-                       }
-               }
-       }
+       REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset,
+                (REG_READ(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset) &
+                ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
+                AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
+                SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
+                SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
 
-       *pTxPowerIndexOffset = 0;
+       if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
+                       AR5416_EEP_MINOR_VER_3) {
+               txRxAttenLocal = pModal->txRxAttenCh[0];
+               REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
+                       AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, pModal->bswMargin[0]);
+               REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
+                       AR_PHY_GAIN_2GHZ_XATTEN1_DB, pModal->bswAtten[0]);
+               REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
+                       AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN,
+                       pModal->xatten2Margin[0]);
+               REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
+                       AR_PHY_GAIN_2GHZ_XATTEN2_DB, pModal->xatten2Db[0]);
+       }
 
-       return true;
-}
+       REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
+                       AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
+       REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
+                       AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
 
-static bool ath9k_hw_set_def_power_per_rate_table(struct ath_hal *ah,
-                                                 struct ath9k_channel *chan,
-                                                 int16_t *ratesArray,
-                                                 u16 cfgCtl,
-                                                 u16 AntennaReduction,
-                                                 u16 twiceMaxRegulatoryPower,
-                                                 u16 powerLimit)
-{
-#define REDUCE_SCALED_POWER_BY_TWO_CHAIN     6  /* 10*log10(2)*2 */
-#define REDUCE_SCALED_POWER_BY_THREE_CHAIN   10 /* 10*log10(3)*2 */
+       if (AR_SREV_9285_11(ah))
+               REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14));
 
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *pEepData = &ahp->ah_eeprom.def;
-       u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
-       static const u16 tpScaleReductionTable[5] =
-               { 0, 3, 6, 9, AR5416_MAX_RATE_POWER };
+       /* Initialize Ant Diversity settings from EEPROM */
+       if (pModal->version == 3) {
+               ant_div_control1 = ((pModal->ob_234 >> 12) & 0xf);
+               ant_div_control2 = ((pModal->db1_234 >> 12) & 0xf);
+               regVal = REG_READ(ah, 0x99ac);
+               regVal &= (~(0x7f000000));
+               regVal |= ((ant_div_control1 & 0x1) << 24);
+               regVal |= (((ant_div_control1 >> 1) & 0x1) << 29);
+               regVal |= (((ant_div_control1 >> 2) & 0x1) << 30);
+               regVal |= ((ant_div_control2 & 0x3) << 25);
+               regVal |= (((ant_div_control2 >> 2) & 0x3) << 27);
+               REG_WRITE(ah, 0x99ac, regVal);
+               regVal = REG_READ(ah, 0x99ac);
+               regVal = REG_READ(ah, 0xa208);
+               regVal &= (~(0x1 << 13));
+               regVal |= (((ant_div_control1 >> 3) & 0x1) << 13);
+               REG_WRITE(ah, 0xa208, regVal);
+               regVal = REG_READ(ah, 0xa208);
+       }
 
-       int i;
-       int16_t twiceLargestAntenna;
-       struct cal_ctl_data *rep;
-       struct cal_target_power_leg targetPowerOfdm, targetPowerCck = {
-               0, { 0, 0, 0, 0}
-       };
-       struct cal_target_power_leg targetPowerOfdmExt = {
-               0, { 0, 0, 0, 0} }, targetPowerCckExt = {
-               0, { 0, 0, 0, 0 }
-       };
-       struct cal_target_power_ht targetPowerHt20, targetPowerHt40 = {
-               0, {0, 0, 0, 0}
-       };
-       u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
-       u16 ctlModesFor11a[] =
-               { CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40 };
-       u16 ctlModesFor11g[] =
-               { CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT, CTL_11G_EXT,
-                 CTL_2GHT40
-               };
-       u16 numCtlModes, *pCtlMode, ctlMode, freq;
-       struct chan_centers centers;
-       int tx_chainmask;
-       u16 twiceMinEdgePower;
+       if (pModal->version >= 2) {
+               ob[0] = (pModal->ob_01 & 0xf);
+               ob[1] = (pModal->ob_01 >> 4) & 0xf;
+               ob[2] = (pModal->ob_234 & 0xf);
+               ob[3] = ((pModal->ob_234 >> 4) & 0xf);
+               ob[4] = ((pModal->ob_234 >> 8) & 0xf);
 
-       tx_chainmask = ahp->ah_txchainmask;
+               db1[0] = (pModal->db1_01 & 0xf);
+               db1[1] = ((pModal->db1_01 >> 4) & 0xf);
+               db1[2] = (pModal->db1_234 & 0xf);
+               db1[3] = ((pModal->db1_234 >> 4) & 0xf);
+               db1[4] = ((pModal->db1_234 >> 8) & 0xf);
 
-       ath9k_hw_get_channel_centers(ah, chan, &centers);
+               db2[0] = (pModal->db2_01 & 0xf);
+               db2[1] = ((pModal->db2_01 >> 4) & 0xf);
+               db2[2] = (pModal->db2_234 & 0xf);
+               db2[3] = ((pModal->db2_234 >> 4) & 0xf);
+               db2[4] = ((pModal->db2_234 >> 8) & 0xf);
 
-       twiceLargestAntenna = max(
-               pEepData->modalHeader
-                       [IS_CHAN_2GHZ(chan)].antennaGainCh[0],
-               pEepData->modalHeader
-                       [IS_CHAN_2GHZ(chan)].antennaGainCh[1]);
+       } else if (pModal->version == 1) {
 
-       twiceLargestAntenna = max((u8)twiceLargestAntenna,
-                                 pEepData->modalHeader
-                                 [IS_CHAN_2GHZ(chan)].antennaGainCh[2]);
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                       "EEPROM Model version is set to 1 \n");
+               ob[0] = (pModal->ob_01 & 0xf);
+               ob[1] = ob[2] = ob[3] = ob[4] = (pModal->ob_01 >> 4) & 0xf;
+               db1[0] = (pModal->db1_01 & 0xf);
+               db1[1] = db1[2] = db1[3] =
+                       db1[4] = ((pModal->db1_01 >> 4) & 0xf);
+               db2[0] = (pModal->db2_01 & 0xf);
+               db2[1] = db2[2] = db2[3] =
+                       db2[4] = ((pModal->db2_01 >> 4) & 0xf);
+       } else {
+               int i;
+               for (i = 0; i < 5; i++) {
+                       ob[i] = pModal->ob_01;
+                       db1[i] = pModal->db1_01;
+                       db2[i] = pModal->db1_01;
+               }
+       }
 
-       twiceLargestAntenna = (int16_t)min(AntennaReduction -
-                                          twiceLargestAntenna, 0);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
+                       AR9285_AN_RF2G3_OB_0, AR9285_AN_RF2G3_OB_0_S, ob[0]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
+                       AR9285_AN_RF2G3_OB_1, AR9285_AN_RF2G3_OB_1_S, ob[1]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
+                       AR9285_AN_RF2G3_OB_2, AR9285_AN_RF2G3_OB_2_S, ob[2]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
+                       AR9285_AN_RF2G3_OB_3, AR9285_AN_RF2G3_OB_3_S, ob[3]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
+                       AR9285_AN_RF2G3_OB_4, AR9285_AN_RF2G3_OB_4_S, ob[4]);
 
-       maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna;
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
+                       AR9285_AN_RF2G3_DB1_0, AR9285_AN_RF2G3_DB1_0_S, db1[0]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
+                       AR9285_AN_RF2G3_DB1_1, AR9285_AN_RF2G3_DB1_1_S, db1[1]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
+                       AR9285_AN_RF2G3_DB1_2, AR9285_AN_RF2G3_DB1_2_S, db1[2]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
+                       AR9285_AN_RF2G4_DB1_3, AR9285_AN_RF2G4_DB1_3_S, db1[3]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
+                       AR9285_AN_RF2G4_DB1_4, AR9285_AN_RF2G4_DB1_4_S, db1[4]);
 
-       if (ah->ah_tpScale != ATH9K_TP_SCALE_MAX) {
-               maxRegAllowedPower -=
-                       (tpScaleReductionTable[(ah->ah_tpScale)] * 2);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
+                       AR9285_AN_RF2G4_DB2_0, AR9285_AN_RF2G4_DB2_0_S, db2[0]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
+                       AR9285_AN_RF2G4_DB2_1, AR9285_AN_RF2G4_DB2_1_S, db2[1]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
+                       AR9285_AN_RF2G4_DB2_2, AR9285_AN_RF2G4_DB2_2_S, db2[2]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
+                       AR9285_AN_RF2G4_DB2_3, AR9285_AN_RF2G4_DB2_3_S, db2[3]);
+       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
+                       AR9285_AN_RF2G4_DB2_4, AR9285_AN_RF2G4_DB2_4_S, db2[4]);
+
+
+       if (AR_SREV_9285_11(ah))
+               REG_WRITE(ah, AR9285_AN_TOP4, AR9285_AN_TOP4_DEFAULT);
+
+       REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
+                     pModal->switchSettling);
+       REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC,
+                     pModal->adcDesiredSize);
+
+       REG_WRITE(ah, AR_PHY_RF_CTL4,
+                 SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF) |
+                 SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF) |
+                 SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON)  |
+                 SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON));
+
+       REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON,
+                     pModal->txEndToRxOn);
+       REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62,
+                     pModal->thresh62);
+       REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, AR_PHY_EXT_CCA0_THRESH62,
+                     pModal->thresh62);
+
+       if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
+                                               AR5416_EEP_MINOR_VER_2) {
+               REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_DATA_START,
+                             pModal->txFrameToDataStart);
+               REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_PA_ON,
+                             pModal->txFrameToPaOn);
        }
 
-       scaledPower = min(powerLimit, maxRegAllowedPower);
+       if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
+                                               AR5416_EEP_MINOR_VER_3) {
+               if (IS_CHAN_HT40(chan))
+                       REG_RMW_FIELD(ah, AR_PHY_SETTLING,
+                                     AR_PHY_SETTLING_SWITCH,
+                                     pModal->swSettleHt40);
+       }
 
-       switch (ar5416_get_ntxchains(tx_chainmask)) {
-       case 1:
+       return true;
+}
+
+static u16 ath9k_hw_4k_get_eeprom_antenna_cfg(struct ath_hw *ah,
+                                             struct ath9k_channel *chan)
+{
+       struct ar5416_eeprom_4k *eep = &ah->eeprom.map4k;
+       struct modal_eep_4k_header *pModal = &eep->modalHeader;
+
+       return pModal->antCtrlCommon & 0xFFFF;
+}
+
+static u8 ath9k_hw_4k_get_num_ant_config(struct ath_hw *ah,
+                                        enum ieee80211_band freq_band)
+{
+       return 1;
+}
+
+static u16 ath9k_hw_4k_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)
+{
+#define EEP_MAP4K_SPURCHAN \
+       (ah->eeprom.map4k.modalHeader.spurChans[i].spurChan)
+
+       u16 spur_val = AR_NO_SPUR;
+
+       DPRINTF(ah->ah_sc, ATH_DBG_ANI,
+               "Getting spur idx %d is2Ghz. %d val %x\n",
+               i, is2GHz, ah->config.spurchans[i][is2GHz]);
+
+       switch (ah->config.spurmode) {
+       case SPUR_DISABLE:
                break;
-       case 2:
-               scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
+       case SPUR_ENABLE_IOCTL:
+               spur_val = ah->config.spurchans[i][is2GHz];
+               DPRINTF(ah->ah_sc, ATH_DBG_ANI,
+                       "Getting spur val from new loc. %d\n", spur_val);
                break;
-       case 3:
-               scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
+       case SPUR_ENABLE_EEPROM:
+               spur_val = EEP_MAP4K_SPURCHAN;
                break;
        }
 
-       scaledPower = max((u16)0, scaledPower);
+       return spur_val;
 
-       if (IS_CHAN_2GHZ(chan)) {
-               numCtlModes = ARRAY_SIZE(ctlModesFor11g) -
-                       SUB_NUM_CTL_MODES_AT_2G_40;
-               pCtlMode = ctlModesFor11g;
+#undef EEP_MAP4K_SPURCHAN
+}
 
-               ath9k_hw_get_legacy_target_powers(ah, chan,
-                       pEepData->calTargetPowerCck,
-                       AR5416_NUM_2G_CCK_TARGET_POWERS,
-                       &targetPowerCck, 4, false);
-               ath9k_hw_get_legacy_target_powers(ah, chan,
-                       pEepData->calTargetPower2G,
-                       AR5416_NUM_2G_20_TARGET_POWERS,
-                       &targetPowerOfdm, 4, false);
-               ath9k_hw_get_target_powers(ah, chan,
-                       pEepData->calTargetPower2GHT20,
-                       AR5416_NUM_2G_20_TARGET_POWERS,
-                       &targetPowerHt20, 8, false);
+static struct eeprom_ops eep_4k_ops = {
+       .check_eeprom           = ath9k_hw_4k_check_eeprom,
+       .get_eeprom             = ath9k_hw_4k_get_eeprom,
+       .fill_eeprom            = ath9k_hw_4k_fill_eeprom,
+       .get_eeprom_ver         = ath9k_hw_4k_get_eeprom_ver,
+       .get_eeprom_rev         = ath9k_hw_4k_get_eeprom_rev,
+       .get_num_ant_config     = ath9k_hw_4k_get_num_ant_config,
+       .get_eeprom_antenna_cfg = ath9k_hw_4k_get_eeprom_antenna_cfg,
+       .set_board_values       = ath9k_hw_4k_set_board_values,
+       .set_addac              = ath9k_hw_4k_set_addac,
+       .set_txpower            = ath9k_hw_4k_set_txpower,
+       .get_spur_channel       = ath9k_hw_4k_get_spur_channel
+};
 
-               if (IS_CHAN_HT40(chan)) {
-                       numCtlModes = ARRAY_SIZE(ctlModesFor11g);
-                       ath9k_hw_get_target_powers(ah, chan,
-                               pEepData->calTargetPower2GHT40,
-                               AR5416_NUM_2G_40_TARGET_POWERS,
-                               &targetPowerHt40, 8, true);
-                       ath9k_hw_get_legacy_target_powers(ah, chan,
-                               pEepData->calTargetPowerCck,
-                               AR5416_NUM_2G_CCK_TARGET_POWERS,
-                               &targetPowerCckExt, 4, true);
-                       ath9k_hw_get_legacy_target_powers(ah, chan,
-                               pEepData->calTargetPower2G,
-                               AR5416_NUM_2G_20_TARGET_POWERS,
-                               &targetPowerOfdmExt, 4, true);
-               }
-       } else {
-               numCtlModes = ARRAY_SIZE(ctlModesFor11a) -
-                       SUB_NUM_CTL_MODES_AT_5G_40;
-               pCtlMode = ctlModesFor11a;
+/************************************************/
+/* EEPROM Operations for non-4K (Default) cards */
+/************************************************/
 
-               ath9k_hw_get_legacy_target_powers(ah, chan,
-                       pEepData->calTargetPower5G,
-                       AR5416_NUM_5G_20_TARGET_POWERS,
-                       &targetPowerOfdm, 4, false);
-               ath9k_hw_get_target_powers(ah, chan,
-                       pEepData->calTargetPower5GHT20,
-                       AR5416_NUM_5G_20_TARGET_POWERS,
-                       &targetPowerHt20, 8, false);
+static int ath9k_hw_def_get_eeprom_ver(struct ath_hw *ah)
+{
+       return ((ah->eeprom.def.baseEepHeader.version >> 12) & 0xF);
+}
 
-               if (IS_CHAN_HT40(chan)) {
-                       numCtlModes = ARRAY_SIZE(ctlModesFor11a);
-                       ath9k_hw_get_target_powers(ah, chan,
-                               pEepData->calTargetPower5GHT40,
-                               AR5416_NUM_5G_40_TARGET_POWERS,
-                               &targetPowerHt40, 8, true);
-                       ath9k_hw_get_legacy_target_powers(ah, chan,
-                               pEepData->calTargetPower5G,
-                               AR5416_NUM_5G_20_TARGET_POWERS,
-                               &targetPowerOfdmExt, 4, true);
+static int ath9k_hw_def_get_eeprom_rev(struct ath_hw *ah)
+{
+       return ((ah->eeprom.def.baseEepHeader.version) & 0xFFF);
+}
+
+static bool ath9k_hw_def_fill_eeprom(struct ath_hw *ah)
+{
+#define SIZE_EEPROM_DEF (sizeof(struct ar5416_eeprom_def) / sizeof(u16))
+       struct ar5416_eeprom_def *eep = &ah->eeprom.def;
+       u16 *eep_data;
+       int addr, ar5416_eep_start_loc = 0x100;
+
+       eep_data = (u16 *)eep;
+
+       for (addr = 0; addr < SIZE_EEPROM_DEF; addr++) {
+               if (!ath9k_hw_nvram_read(ah, addr + ar5416_eep_start_loc,
+                                        eep_data)) {
+                       DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                               "Unable to read eeprom region\n");
+                       return false;
                }
+               eep_data++;
        }
+       return true;
+#undef SIZE_EEPROM_DEF
+}
 
-       for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
-               bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
-                       (pCtlMode[ctlMode] == CTL_2GHT40);
-               if (isHt40CtlMode)
-                       freq = centers.synth_center;
-               else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
-                       freq = centers.ext_center;
-               else
-                       freq = centers.ctl_center;
+static int ath9k_hw_def_check_eeprom(struct ath_hw *ah)
+{
+       struct ar5416_eeprom_def *eep =
+               (struct ar5416_eeprom_def *) &ah->eeprom.def;
+       u16 *eepdata, temp, magic, magic2;
+       u32 sum = 0, el;
+       bool need_swap = false;
+       int i, addr, size;
 
-               if (ar5416_get_eep_ver(ahp) == 14 && ar5416_get_eep_rev(ahp) <= 2)
-                       twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
+       if (!ath9k_hw_nvram_read(ah, AR5416_EEPROM_MAGIC_OFFSET,
+                                &magic)) {
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                       "Reading Magic # failed\n");
+               return false;
+       }
 
-               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
-                       "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, "
-                       "EXT_ADDITIVE %d\n",
-                       ctlMode, numCtlModes, isHt40CtlMode,
-                       (pCtlMode[ctlMode] & EXT_ADDITIVE));
+       if (!ath9k_hw_use_flash(ah)) {
 
-               for (i = 0; (i < AR5416_NUM_CTLS) && pEepData->ctlIndex[i]; i++) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
-                               "  LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
-                               "pCtlMode 0x%2.2x ctlIndex 0x%2.2x "
-                               "chan %d\n",
-                               i, cfgCtl, pCtlMode[ctlMode],
-                               pEepData->ctlIndex[i], chan->channel);
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                               "Read Magic = 0x%04X\n", magic);
 
-                       if ((((cfgCtl & ~CTL_MODE_M) |
-                             (pCtlMode[ctlMode] & CTL_MODE_M)) ==
-                            pEepData->ctlIndex[i]) ||
-                           (((cfgCtl & ~CTL_MODE_M) |
-                             (pCtlMode[ctlMode] & CTL_MODE_M)) ==
-                            ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))) {
-                               rep = &(pEepData->ctlData[i]);
+               if (magic != AR5416_EEPROM_MAGIC) {
+                       magic2 = swab16(magic);
 
-                               twiceMinEdgePower = ath9k_hw_get_max_edge_power(freq,
-                               rep->ctlEdges[ar5416_get_ntxchains(tx_chainmask) - 1],
-                               IS_CHAN_2GHZ(chan), AR5416_NUM_BAND_EDGES);
+                       if (magic2 == AR5416_EEPROM_MAGIC) {
+                               size = sizeof(struct ar5416_eeprom_def);
+                               need_swap = true;
+                               eepdata = (u16 *) (&ah->eeprom);
 
-                               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
-                                       "    MATCH-EE_IDX %d: ch %d is2 %d "
-                                       "2xMinEdge %d chainmask %d chains %d\n",
-                                       i, freq, IS_CHAN_2GHZ(chan),
-                                       twiceMinEdgePower, tx_chainmask,
-                                       ar5416_get_ntxchains
-                                       (tx_chainmask));
-                               if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
-                                       twiceMaxEdgePower = min(twiceMaxEdgePower,
-                                                               twiceMinEdgePower);
-                               } else {
-                                       twiceMaxEdgePower = twiceMinEdgePower;
-                                       break;
+                               for (addr = 0; addr < size / sizeof(u16); addr++) {
+                                       temp = swab16(*eepdata);
+                                       *eepdata = temp;
+                                       eepdata++;
+
+                                       DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                                               "0x%04X  ", *eepdata);
+
+                                       if (((addr + 1) % 6) == 0)
+                                               DPRINTF(ah->ah_sc,
+                                                       ATH_DBG_EEPROM, "\n");
                                }
+                       } else {
+                               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                                       "Invalid EEPROM Magic. "
+                                       "endianness mismatch.\n");
+                               return -EINVAL;
                        }
                }
+       }
 
-               minCtlPower = min(twiceMaxEdgePower, scaledPower);
+       DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, "need_swap = %s.\n",
+               need_swap ? "True" : "False");
 
-               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
-                       "    SEL-Min ctlMode %d pCtlMode %d "
-                       "2xMaxEdge %d sP %d minCtlPwr %d\n",
-                       ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower,
-                       scaledPower, minCtlPower);
+       if (need_swap)
+               el = swab16(ah->eeprom.def.baseEepHeader.length);
+       else
+               el = ah->eeprom.def.baseEepHeader.length;
 
-               switch (pCtlMode[ctlMode]) {
-               case CTL_11B:
-                       for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x); i++) {
-                               targetPowerCck.tPow2x[i] =
-                                       min((u16)targetPowerCck.tPow2x[i],
-                                           minCtlPower);
-                       }
-                       break;
-               case CTL_11A:
-               case CTL_11G:
-                       for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x); i++) {
-                               targetPowerOfdm.tPow2x[i] =
-                                       min((u16)targetPowerOfdm.tPow2x[i],
-                                           minCtlPower);
-                       }
-                       break;
-               case CTL_5GHT20:
-               case CTL_2GHT20:
-                       for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) {
-                               targetPowerHt20.tPow2x[i] =
-                                       min((u16)targetPowerHt20.tPow2x[i],
-                                           minCtlPower);
+       if (el > sizeof(struct ar5416_eeprom_def))
+               el = sizeof(struct ar5416_eeprom_def) / sizeof(u16);
+       else
+               el = el / sizeof(u16);
+
+       eepdata = (u16 *)(&ah->eeprom);
+
+       for (i = 0; i < el; i++)
+               sum ^= *eepdata++;
+
+       if (need_swap) {
+               u32 integer, j;
+               u16 word;
+
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                       "EEPROM Endianness is not native.. Changing \n");
+
+               word = swab16(eep->baseEepHeader.length);
+               eep->baseEepHeader.length = word;
+
+               word = swab16(eep->baseEepHeader.checksum);
+               eep->baseEepHeader.checksum = word;
+
+               word = swab16(eep->baseEepHeader.version);
+               eep->baseEepHeader.version = word;
+
+               word = swab16(eep->baseEepHeader.regDmn[0]);
+               eep->baseEepHeader.regDmn[0] = word;
+
+               word = swab16(eep->baseEepHeader.regDmn[1]);
+               eep->baseEepHeader.regDmn[1] = word;
+
+               word = swab16(eep->baseEepHeader.rfSilent);
+               eep->baseEepHeader.rfSilent = word;
+
+               word = swab16(eep->baseEepHeader.blueToothOptions);
+               eep->baseEepHeader.blueToothOptions = word;
+
+               word = swab16(eep->baseEepHeader.deviceCap);
+               eep->baseEepHeader.deviceCap = word;
+
+               for (j = 0; j < ARRAY_SIZE(eep->modalHeader); j++) {
+                       struct modal_eep_header *pModal =
+                               &eep->modalHeader[j];
+                       integer = swab32(pModal->antCtrlCommon);
+                       pModal->antCtrlCommon = integer;
+
+                       for (i = 0; i < AR5416_MAX_CHAINS; i++) {
+                               integer = swab32(pModal->antCtrlChain[i]);
+                               pModal->antCtrlChain[i] = integer;
                        }
-                       break;
-               case CTL_11B_EXT:
-                       targetPowerCckExt.tPow2x[0] = min((u16)
-                                       targetPowerCckExt.tPow2x[0],
-                                       minCtlPower);
-                       break;
-               case CTL_11A_EXT:
-               case CTL_11G_EXT:
-                       targetPowerOfdmExt.tPow2x[0] = min((u16)
-                                       targetPowerOfdmExt.tPow2x[0],
-                                       minCtlPower);
-                       break;
-               case CTL_5GHT40:
-               case CTL_2GHT40:
-                       for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
-                               targetPowerHt40.tPow2x[i] =
-                                       min((u16)targetPowerHt40.tPow2x[i],
-                                           minCtlPower);
+
+                       for (i = 0; i < AR5416_EEPROM_MODAL_SPURS; i++) {
+                               word = swab16(pModal->spurChans[i].spurChan);
+                               pModal->spurChans[i].spurChan = word;
                        }
-                       break;
-               default:
-                       break;
                }
        }
 
-       ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] =
-               ratesArray[rate18mb] = ratesArray[rate24mb] =
-               targetPowerOfdm.tPow2x[0];
-       ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1];
-       ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2];
-       ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3];
-       ratesArray[rateXr] = targetPowerOfdm.tPow2x[0];
+       if (sum != 0xffff || ah->eep_ops->get_eeprom_ver(ah) != AR5416_EEP_VER ||
+           ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_NO_BACK_VER) {
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                       "Bad EEPROM checksum 0x%x or revision 0x%04x\n",
+                       sum, ah->eep_ops->get_eeprom_ver(ah));
+               return -EINVAL;
+       }
 
-       for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++)
-               ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i];
+       return 0;
+}
 
-       if (IS_CHAN_2GHZ(chan)) {
-               ratesArray[rate1l] = targetPowerCck.tPow2x[0];
-               ratesArray[rate2s] = ratesArray[rate2l] =
-                       targetPowerCck.tPow2x[1];
-               ratesArray[rate5_5s] = ratesArray[rate5_5l] =
-                       targetPowerCck.tPow2x[2];
-               ;
-               ratesArray[rate11s] = ratesArray[rate11l] =
-                       targetPowerCck.tPow2x[3];
-               ;
-       }
-       if (IS_CHAN_HT40(chan)) {
-               for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
-                       ratesArray[rateHt40_0 + i] =
-                               targetPowerHt40.tPow2x[i];
-               }
-               ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0];
-               ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0];
-               ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0];
-               if (IS_CHAN_2GHZ(chan)) {
-                       ratesArray[rateExtCck] =
-                               targetPowerCckExt.tPow2x[0];
-               }
+static u32 ath9k_hw_def_get_eeprom(struct ath_hw *ah,
+                                  enum eeprom_param param)
+{
+#define AR5416_VER_MASK (pBase->version & AR5416_EEP_VER_MINOR_MASK)
+       struct ar5416_eeprom_def *eep = &ah->eeprom.def;
+       struct modal_eep_header *pModal = eep->modalHeader;
+       struct base_eep_header *pBase = &eep->baseEepHeader;
+
+       switch (param) {
+       case EEP_NFTHRESH_5:
+               return pModal[0].noiseFloorThreshCh[0];
+       case EEP_NFTHRESH_2:
+               return pModal[1].noiseFloorThreshCh[0];
+       case AR_EEPROM_MAC(0):
+               return pBase->macAddr[0] << 8 | pBase->macAddr[1];
+       case AR_EEPROM_MAC(1):
+               return pBase->macAddr[2] << 8 | pBase->macAddr[3];
+       case AR_EEPROM_MAC(2):
+               return pBase->macAddr[4] << 8 | pBase->macAddr[5];
+       case EEP_REG_0:
+               return pBase->regDmn[0];
+       case EEP_REG_1:
+               return pBase->regDmn[1];
+       case EEP_OP_CAP:
+               return pBase->deviceCap;
+       case EEP_OP_MODE:
+               return pBase->opCapFlags;
+       case EEP_RF_SILENT:
+               return pBase->rfSilent;
+       case EEP_OB_5:
+               return pModal[0].ob;
+       case EEP_DB_5:
+               return pModal[0].db;
+       case EEP_OB_2:
+               return pModal[1].ob;
+       case EEP_DB_2:
+               return pModal[1].db;
+       case EEP_MINOR_REV:
+               return AR5416_VER_MASK;
+       case EEP_TX_MASK:
+               return pBase->txMask;
+       case EEP_RX_MASK:
+               return pBase->rxMask;
+       case EEP_RXGAIN_TYPE:
+               return pBase->rxGainType;
+       case EEP_TXGAIN_TYPE:
+               return pBase->txGainType;
+       case EEP_DAC_HPWR_5G:
+               if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_20)
+                       return pBase->dacHiPwrMode_5G;
+               else
+                       return 0;
+       default:
+               return 0;
        }
-       return true;
+#undef AR5416_VER_MASK
 }
 
-static bool ath9k_hw_set_4k_power_per_rate_table(struct ath_hal *ah,
-                                                struct ath9k_channel *chan,
-                                                int16_t *ratesArray,
-                                                u16 cfgCtl,
-                                                u16 AntennaReduction,
-                                                u16 twiceMaxRegulatoryPower,
-                                                u16 powerLimit)
+/* XXX: Clean me up, make me more legible */
+static bool ath9k_hw_def_set_board_values(struct ath_hw *ah,
+                                         struct ath9k_channel *chan)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *pEepData = &ahp->ah_eeprom.map4k;
-       u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
-       static const u16 tpScaleReductionTable[5] =
-               { 0, 3, 6, 9, AR5416_MAX_RATE_POWER };
-
-       int i;
-       int16_t twiceLargestAntenna;
-       struct cal_ctl_data_4k *rep;
-       struct cal_target_power_leg targetPowerOfdm, targetPowerCck = {
-               0, { 0, 0, 0, 0}
-       };
-       struct cal_target_power_leg targetPowerOfdmExt = {
-               0, { 0, 0, 0, 0} }, targetPowerCckExt = {
-               0, { 0, 0, 0, 0 }
-       };
-       struct cal_target_power_ht targetPowerHt20, targetPowerHt40 = {
-               0, {0, 0, 0, 0}
-       };
-       u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
-       u16 ctlModesFor11g[] =
-               { CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT, CTL_11G_EXT,
-                 CTL_2GHT40
-               };
-       u16 numCtlModes, *pCtlMode, ctlMode, freq;
-       struct chan_centers centers;
-       int tx_chainmask;
-       u16 twiceMinEdgePower;
-
-       tx_chainmask = ahp->ah_txchainmask;
-
-       ath9k_hw_get_channel_centers(ah, chan, &centers);
-
-       twiceLargestAntenna = pEepData->modalHeader.antennaGainCh[0];
-
-       twiceLargestAntenna = (int16_t)min(AntennaReduction -
-                                          twiceLargestAntenna, 0);
-
-       maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna;
-
-       if (ah->ah_tpScale != ATH9K_TP_SCALE_MAX) {
-               maxRegAllowedPower -=
-                       (tpScaleReductionTable[(ah->ah_tpScale)] * 2);
-       }
+#define AR5416_VER_MASK (eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK)
+       struct modal_eep_header *pModal;
+       struct ar5416_eeprom_def *eep = &ah->eeprom.def;
+       int i, regChainOffset;
+       u8 txRxAttenLocal;
 
-       scaledPower = min(powerLimit, maxRegAllowedPower);
-       scaledPower = max((u16)0, scaledPower);
+       pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
 
-       numCtlModes = ARRAY_SIZE(ctlModesFor11g) - SUB_NUM_CTL_MODES_AT_2G_40;
-       pCtlMode = ctlModesFor11g;
+       txRxAttenLocal = IS_CHAN_2GHZ(chan) ? 23 : 44;
 
-       ath9k_hw_get_legacy_target_powers(ah, chan,
-                       pEepData->calTargetPowerCck,
-                       AR5416_NUM_2G_CCK_TARGET_POWERS,
-                       &targetPowerCck, 4, false);
-       ath9k_hw_get_legacy_target_powers(ah, chan,
-                       pEepData->calTargetPower2G,
-                       AR5416_NUM_2G_20_TARGET_POWERS,
-                       &targetPowerOfdm, 4, false);
-       ath9k_hw_get_target_powers(ah, chan,
-                       pEepData->calTargetPower2GHT20,
-                       AR5416_NUM_2G_20_TARGET_POWERS,
-                       &targetPowerHt20, 8, false);
+       REG_WRITE(ah, AR_PHY_SWITCH_COM,
+                 ah->eep_ops->get_eeprom_antenna_cfg(ah, chan));
 
-       if (IS_CHAN_HT40(chan)) {
-               numCtlModes = ARRAY_SIZE(ctlModesFor11g);
-               ath9k_hw_get_target_powers(ah, chan,
-                               pEepData->calTargetPower2GHT40,
-                               AR5416_NUM_2G_40_TARGET_POWERS,
-                               &targetPowerHt40, 8, true);
-               ath9k_hw_get_legacy_target_powers(ah, chan,
-                               pEepData->calTargetPowerCck,
-                               AR5416_NUM_2G_CCK_TARGET_POWERS,
-                               &targetPowerCckExt, 4, true);
-               ath9k_hw_get_legacy_target_powers(ah, chan,
-                               pEepData->calTargetPower2G,
-                               AR5416_NUM_2G_20_TARGET_POWERS,
-                               &targetPowerOfdmExt, 4, true);
-       }
+       for (i = 0; i < AR5416_MAX_CHAINS; i++) {
+               if (AR_SREV_9280(ah)) {
+                       if (i >= 2)
+                               break;
+               }
 
-       for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
-               bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
-                       (pCtlMode[ctlMode] == CTL_2GHT40);
-               if (isHt40CtlMode)
-                       freq = centers.synth_center;
-               else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
-                       freq = centers.ext_center;
+               if (AR_SREV_5416_V20_OR_LATER(ah) &&
+                   (ah->rxchainmask == 5 || ah->txchainmask == 5)
+                   && (i != 0))
+                       regChainOffset = (i == 1) ? 0x2000 : 0x1000;
                else
-                       freq = centers.ctl_center;
-
-               if (ar5416_get_eep_ver(ahp) == 14 &&
-                               ar5416_get_eep_rev(ahp) <= 2)
-                       twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
-
-               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
-                       "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, "
-                       "EXT_ADDITIVE %d\n",
-                       ctlMode, numCtlModes, isHt40CtlMode,
-                       (pCtlMode[ctlMode] & EXT_ADDITIVE));
-
-               for (i = 0; (i < AR5416_NUM_CTLS) &&
-                               pEepData->ctlIndex[i]; i++) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
-                               "  LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
-                               "pCtlMode 0x%2.2x ctlIndex 0x%2.2x "
-                               "chan %d\n",
-                               i, cfgCtl, pCtlMode[ctlMode],
-                               pEepData->ctlIndex[i], chan->channel);
+                       regChainOffset = i * 0x1000;
 
-                       if ((((cfgCtl & ~CTL_MODE_M) |
-                             (pCtlMode[ctlMode] & CTL_MODE_M)) ==
-                            pEepData->ctlIndex[i]) ||
-                           (((cfgCtl & ~CTL_MODE_M) |
-                             (pCtlMode[ctlMode] & CTL_MODE_M)) ==
-                            ((pEepData->ctlIndex[i] & CTL_MODE_M) |
-                             SD_NO_CTL))) {
-                               rep = &(pEepData->ctlData[i]);
+               REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
+                         pModal->antCtrlChain[i]);
 
-                               twiceMinEdgePower =
-                                       ath9k_hw_get_max_edge_power(freq,
-                               rep->ctlEdges[ar5416_get_ntxchains
-                                               (tx_chainmask) - 1],
-                               IS_CHAN_2GHZ(chan),
-                               AR5416_EEP4K_NUM_BAND_EDGES);
+               REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset,
+                         (REG_READ(ah,
+                                   AR_PHY_TIMING_CTRL4(0) +
+                                   regChainOffset) &
+                          ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
+                            AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
+                         SM(pModal->iqCalICh[i],
+                            AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
+                         SM(pModal->iqCalQCh[i],
+                            AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
 
-                               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
-                                       "    MATCH-EE_IDX %d: ch %d is2 %d "
-                                       "2xMinEdge %d chainmask %d chains %d\n",
-                                       i, freq, IS_CHAN_2GHZ(chan),
-                                       twiceMinEdgePower, tx_chainmask,
-                                       ar5416_get_ntxchains
-                                       (tx_chainmask));
-                               if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
-                                       twiceMaxEdgePower =
-                                               min(twiceMaxEdgePower,
-                                                   twiceMinEdgePower);
+               if ((i == 0) || AR_SREV_5416_V20_OR_LATER(ah)) {
+                       if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
+                               txRxAttenLocal = pModal->txRxAttenCh[i];
+                               if (AR_SREV_9280_10_OR_LATER(ah)) {
+                                       REG_RMW_FIELD(ah,
+                                               AR_PHY_GAIN_2GHZ +
+                                               regChainOffset,
+                                               AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
+                                               pModal->
+                                               bswMargin[i]);
+                                       REG_RMW_FIELD(ah,
+                                               AR_PHY_GAIN_2GHZ +
+                                               regChainOffset,
+                                               AR_PHY_GAIN_2GHZ_XATTEN1_DB,
+                                               pModal->
+                                               bswAtten[i]);
+                                       REG_RMW_FIELD(ah,
+                                               AR_PHY_GAIN_2GHZ +
+                                               regChainOffset,
+                                               AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN,
+                                               pModal->
+                                               xatten2Margin[i]);
+                                       REG_RMW_FIELD(ah,
+                                               AR_PHY_GAIN_2GHZ +
+                                               regChainOffset,
+                                               AR_PHY_GAIN_2GHZ_XATTEN2_DB,
+                                               pModal->
+                                               xatten2Db[i]);
                                } else {
-                                       twiceMaxEdgePower = twiceMinEdgePower;
-                                       break;
-                               }
-                       }
-               }
-
-               minCtlPower = (u8)min(twiceMaxEdgePower, scaledPower);
-
-               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
-                       "    SEL-Min ctlMode %d pCtlMode %d "
-                       "2xMaxEdge %d sP %d minCtlPwr %d\n",
-                       ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower,
-                       scaledPower, minCtlPower);
-
-               switch (pCtlMode[ctlMode]) {
-               case CTL_11B:
-                       for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x);
-                                       i++) {
-                               targetPowerCck.tPow2x[i] =
-                                       min((u16)targetPowerCck.tPow2x[i],
-                                           minCtlPower);
-                       }
-                       break;
-               case CTL_11G:
-                       for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x);
-                                       i++) {
-                               targetPowerOfdm.tPow2x[i] =
-                                       min((u16)targetPowerOfdm.tPow2x[i],
-                                           minCtlPower);
-                       }
-                       break;
-               case CTL_2GHT20:
-                       for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x);
-                                       i++) {
-                               targetPowerHt20.tPow2x[i] =
-                                       min((u16)targetPowerHt20.tPow2x[i],
-                                           minCtlPower);
+                                       REG_WRITE(ah,
+                                                 AR_PHY_GAIN_2GHZ +
+                                                 regChainOffset,
+                                                 (REG_READ(ah,
+                                                           AR_PHY_GAIN_2GHZ +
+                                                           regChainOffset) &
+                                                  ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
+                                                 | SM(pModal->
+                                                 bswMargin[i],
+                                                 AR_PHY_GAIN_2GHZ_BSW_MARGIN));
+                                       REG_WRITE(ah,
+                                                 AR_PHY_GAIN_2GHZ +
+                                                 regChainOffset,
+                                                 (REG_READ(ah,
+                                                           AR_PHY_GAIN_2GHZ +
+                                                           regChainOffset) &
+                                                  ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
+                                                 | SM(pModal->bswAtten[i],
+                                                 AR_PHY_GAIN_2GHZ_BSW_ATTEN));
+                               }
                        }
-                       break;
-               case CTL_11B_EXT:
-                       targetPowerCckExt.tPow2x[0] = min((u16)
-                                       targetPowerCckExt.tPow2x[0],
-                                       minCtlPower);
-                       break;
-               case CTL_11G_EXT:
-                       targetPowerOfdmExt.tPow2x[0] = min((u16)
-                                       targetPowerOfdmExt.tPow2x[0],
-                                       minCtlPower);
-                       break;
-               case CTL_2GHT40:
-                       for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x);
-                                       i++) {
-                               targetPowerHt40.tPow2x[i] =
-                                       min((u16)targetPowerHt40.tPow2x[i],
-                                           minCtlPower);
+                       if (AR_SREV_9280_10_OR_LATER(ah)) {
+                               REG_RMW_FIELD(ah,
+                                             AR_PHY_RXGAIN +
+                                             regChainOffset,
+                                             AR9280_PHY_RXGAIN_TXRX_ATTEN,
+                                             txRxAttenLocal);
+                               REG_RMW_FIELD(ah,
+                                             AR_PHY_RXGAIN +
+                                             regChainOffset,
+                                             AR9280_PHY_RXGAIN_TXRX_MARGIN,
+                                             pModal->rxTxMarginCh[i]);
+                       } else {
+                               REG_WRITE(ah,
+                                         AR_PHY_RXGAIN + regChainOffset,
+                                         (REG_READ(ah,
+                                                   AR_PHY_RXGAIN +
+                                                   regChainOffset) &
+                                          ~AR_PHY_RXGAIN_TXRX_ATTEN) |
+                                         SM(txRxAttenLocal,
+                                            AR_PHY_RXGAIN_TXRX_ATTEN));
+                               REG_WRITE(ah,
+                                         AR_PHY_GAIN_2GHZ +
+                                         regChainOffset,
+                                         (REG_READ(ah,
+                                                   AR_PHY_GAIN_2GHZ +
+                                                   regChainOffset) &
+                                          ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
+                                         SM(pModal->rxTxMarginCh[i],
+                                            AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
                        }
-                       break;
-               default:
-                       break;
                }
        }
 
-       ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] =
-               ratesArray[rate18mb] = ratesArray[rate24mb] =
-               targetPowerOfdm.tPow2x[0];
-       ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1];
-       ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2];
-       ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3];
-       ratesArray[rateXr] = targetPowerOfdm.tPow2x[0];
-
-       for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++)
-               ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i];
-
-       ratesArray[rate1l] = targetPowerCck.tPow2x[0];
-       ratesArray[rate2s] = ratesArray[rate2l] = targetPowerCck.tPow2x[1];
-       ratesArray[rate5_5s] = ratesArray[rate5_5l] = targetPowerCck.tPow2x[2];
-       ratesArray[rate11s] = ratesArray[rate11l] = targetPowerCck.tPow2x[3];
-
-       if (IS_CHAN_HT40(chan)) {
-               for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
-                       ratesArray[rateHt40_0 + i] =
-                               targetPowerHt40.tPow2x[i];
-               }
-               ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0];
-               ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0];
-               ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0];
-               ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0];
-       }
-       return true;
-}
-
-static int ath9k_hw_def_set_txpower(struct ath_hal *ah,
-                        struct ath9k_channel *chan,
-                        u16 cfgCtl,
-                        u8 twiceAntennaReduction,
-                        u8 twiceMaxRegulatoryPower,
-                        u8 powerLimit)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *pEepData = &ahp->ah_eeprom.def;
-       struct modal_eep_header *pModal =
-               &(pEepData->modalHeader[IS_CHAN_2GHZ(chan)]);
-       int16_t ratesArray[Ar5416RateSize];
-       int16_t txPowerIndexOffset = 0;
-       u8 ht40PowerIncForPdadc = 2;
-       int i;
-
-       memset(ratesArray, 0, sizeof(ratesArray));
-
-       if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
-           AR5416_EEP_MINOR_VER_2) {
-               ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc;
-       }
-
-       if (!ath9k_hw_set_def_power_per_rate_table(ah, chan,
-                                              &ratesArray[0], cfgCtl,
-                                              twiceAntennaReduction,
-                                              twiceMaxRegulatoryPower,
-                                              powerLimit)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                       "ath9k_hw_set_txpower: unable to set "
-                       "tx power per rate table\n");
-               return -EIO;
-       }
-
-       if (!ath9k_hw_set_def_power_cal_table(ah, chan, &txPowerIndexOffset)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                        "ath9k_hw_set_txpower: unable to set power table\n");
-               return -EIO;
-       }
-
-       for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
-               ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
-               if (ratesArray[i] > AR5416_MAX_RATE_POWER)
-                       ratesArray[i] = AR5416_MAX_RATE_POWER;
-       }
-
        if (AR_SREV_9280_10_OR_LATER(ah)) {
-               for (i = 0; i < Ar5416RateSize; i++)
-                       ratesArray[i] -= AR5416_PWR_TABLE_OFFSET * 2;
-       }
-
-       REG_WRITE(ah, AR_PHY_POWER_TX_RATE1,
-                 ATH9K_POW_SM(ratesArray[rate18mb], 24)
-                 | ATH9K_POW_SM(ratesArray[rate12mb], 16)
-                 | ATH9K_POW_SM(ratesArray[rate9mb], 8)
-                 | ATH9K_POW_SM(ratesArray[rate6mb], 0));
-       REG_WRITE(ah, AR_PHY_POWER_TX_RATE2,
-                 ATH9K_POW_SM(ratesArray[rate54mb], 24)
-                 | ATH9K_POW_SM(ratesArray[rate48mb], 16)
-                 | ATH9K_POW_SM(ratesArray[rate36mb], 8)
-                 | ATH9K_POW_SM(ratesArray[rate24mb], 0));
-
-       if (IS_CHAN_2GHZ(chan)) {
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE3,
-                         ATH9K_POW_SM(ratesArray[rate2s], 24)
-                         | ATH9K_POW_SM(ratesArray[rate2l], 16)
-                         | ATH9K_POW_SM(ratesArray[rateXr], 8)
-                         | ATH9K_POW_SM(ratesArray[rate1l], 0));
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE4,
-                         ATH9K_POW_SM(ratesArray[rate11s], 24)
-                         | ATH9K_POW_SM(ratesArray[rate11l], 16)
-                         | ATH9K_POW_SM(ratesArray[rate5_5s], 8)
-                         | ATH9K_POW_SM(ratesArray[rate5_5l], 0));
-       }
-
-       REG_WRITE(ah, AR_PHY_POWER_TX_RATE5,
-                 ATH9K_POW_SM(ratesArray[rateHt20_3], 24)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_2], 16)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_1], 8)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_0], 0));
-       REG_WRITE(ah, AR_PHY_POWER_TX_RATE6,
-                 ATH9K_POW_SM(ratesArray[rateHt20_7], 24)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_6], 16)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_5], 8)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_4], 0));
-
-       if (IS_CHAN_HT40(chan)) {
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE7,
-                         ATH9K_POW_SM(ratesArray[rateHt40_3] +
-                                      ht40PowerIncForPdadc, 24)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_2] +
-                                        ht40PowerIncForPdadc, 16)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_1] +
-                                        ht40PowerIncForPdadc, 8)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_0] +
-                                        ht40PowerIncForPdadc, 0));
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE8,
-                         ATH9K_POW_SM(ratesArray[rateHt40_7] +
-                                      ht40PowerIncForPdadc, 24)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_6] +
-                                        ht40PowerIncForPdadc, 16)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_5] +
-                                        ht40PowerIncForPdadc, 8)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_4] +
-                                        ht40PowerIncForPdadc, 0));
-
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE9,
-                         ATH9K_POW_SM(ratesArray[rateExtOfdm], 24)
-                         | ATH9K_POW_SM(ratesArray[rateExtCck], 16)
-                         | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
-                         | ATH9K_POW_SM(ratesArray[rateDupCck], 0));
-       }
-
-       REG_WRITE(ah, AR_PHY_POWER_TX_SUB,
-                 ATH9K_POW_SM(pModal->pwrDecreaseFor3Chain, 6)
-                 | ATH9K_POW_SM(pModal->pwrDecreaseFor2Chain, 0));
-
-       i = rate6mb;
-
-       if (IS_CHAN_HT40(chan))
-               i = rateHt40_0;
-       else if (IS_CHAN_HT20(chan))
-               i = rateHt20_0;
-
-       if (AR_SREV_9280_10_OR_LATER(ah))
-               ah->ah_maxPowerLevel =
-                       ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2;
-       else
-               ah->ah_maxPowerLevel = ratesArray[i];
-
-       return 0;
-}
-
-static int ath9k_hw_4k_set_txpower(struct ath_hal *ah,
-                        struct ath9k_channel *chan,
-                        u16 cfgCtl,
-                        u8 twiceAntennaReduction,
-                        u8 twiceMaxRegulatoryPower,
-                        u8 powerLimit)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *pEepData = &ahp->ah_eeprom.map4k;
-       struct modal_eep_4k_header *pModal = &pEepData->modalHeader;
-       int16_t ratesArray[Ar5416RateSize];
-       int16_t txPowerIndexOffset = 0;
-       u8 ht40PowerIncForPdadc = 2;
-       int i;
-
-       memset(ratesArray, 0, sizeof(ratesArray));
-
-       if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
-           AR5416_EEP_MINOR_VER_2) {
-               ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc;
+               if (IS_CHAN_2GHZ(chan)) {
+                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0,
+                                                 AR_AN_RF2G1_CH0_OB,
+                                                 AR_AN_RF2G1_CH0_OB_S,
+                                                 pModal->ob);
+                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0,
+                                                 AR_AN_RF2G1_CH0_DB,
+                                                 AR_AN_RF2G1_CH0_DB_S,
+                                                 pModal->db);
+                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH1,
+                                                 AR_AN_RF2G1_CH1_OB,
+                                                 AR_AN_RF2G1_CH1_OB_S,
+                                                 pModal->ob_ch1);
+                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH1,
+                                                 AR_AN_RF2G1_CH1_DB,
+                                                 AR_AN_RF2G1_CH1_DB_S,
+                                                 pModal->db_ch1);
+               } else {
+                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH0,
+                                                 AR_AN_RF5G1_CH0_OB5,
+                                                 AR_AN_RF5G1_CH0_OB5_S,
+                                                 pModal->ob);
+                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH0,
+                                                 AR_AN_RF5G1_CH0_DB5,
+                                                 AR_AN_RF5G1_CH0_DB5_S,
+                                                 pModal->db);
+                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH1,
+                                                 AR_AN_RF5G1_CH1_OB5,
+                                                 AR_AN_RF5G1_CH1_OB5_S,
+                                                 pModal->ob_ch1);
+                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH1,
+                                                 AR_AN_RF5G1_CH1_DB5,
+                                                 AR_AN_RF5G1_CH1_DB5_S,
+                                                 pModal->db_ch1);
+               }
+               ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
+                                         AR_AN_TOP2_XPABIAS_LVL,
+                                         AR_AN_TOP2_XPABIAS_LVL_S,
+                                         pModal->xpaBiasLvl);
+               ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
+                                         AR_AN_TOP2_LOCALBIAS,
+                                         AR_AN_TOP2_LOCALBIAS_S,
+                                         pModal->local_bias);
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, "ForceXPAon: %d\n",
+                       pModal->force_xpaon);
+               REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
+                             pModal->force_xpaon);
        }
 
-       if (!ath9k_hw_set_4k_power_per_rate_table(ah, chan,
-                                              &ratesArray[0], cfgCtl,
-                                              twiceAntennaReduction,
-                                              twiceMaxRegulatoryPower,
-                                              powerLimit)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                       "ath9k_hw_set_txpower: unable to set "
-                       "tx power per rate table\n");
-               return -EIO;
-       }
+       REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
+                     pModal->switchSettling);
+       REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC,
+                     pModal->adcDesiredSize);
 
-       if (!ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                        "ath9k_hw_set_txpower: unable to set power table\n");
-               return -EIO;
-       }
+       if (!AR_SREV_9280_10_OR_LATER(ah))
+               REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
+                             AR_PHY_DESIRED_SZ_PGA,
+                             pModal->pgaDesiredSize);
 
-       for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
-               ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
-               if (ratesArray[i] > AR5416_MAX_RATE_POWER)
-                       ratesArray[i] = AR5416_MAX_RATE_POWER;
-       }
+       REG_WRITE(ah, AR_PHY_RF_CTL4,
+                 SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF)
+                 | SM(pModal->txEndToXpaOff,
+                      AR_PHY_RF_CTL4_TX_END_XPAB_OFF)
+                 | SM(pModal->txFrameToXpaOn,
+                      AR_PHY_RF_CTL4_FRAME_XPAA_ON)
+                 | SM(pModal->txFrameToXpaOn,
+                      AR_PHY_RF_CTL4_FRAME_XPAB_ON));
 
+       REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON,
+                     pModal->txEndToRxOn);
        if (AR_SREV_9280_10_OR_LATER(ah)) {
-               for (i = 0; i < Ar5416RateSize; i++)
-                       ratesArray[i] -= AR5416_PWR_TABLE_OFFSET * 2;
+               REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62,
+                             pModal->thresh62);
+               REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0,
+                             AR_PHY_EXT_CCA0_THRESH62,
+                             pModal->thresh62);
+       } else {
+               REG_RMW_FIELD(ah, AR_PHY_CCA, AR_PHY_CCA_THRESH62,
+                             pModal->thresh62);
+               REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
+                             AR_PHY_EXT_CCA_THRESH62,
+                             pModal->thresh62);
        }
 
-       REG_WRITE(ah, AR_PHY_POWER_TX_RATE1,
-                 ATH9K_POW_SM(ratesArray[rate18mb], 24)
-                 | ATH9K_POW_SM(ratesArray[rate12mb], 16)
-                 | ATH9K_POW_SM(ratesArray[rate9mb], 8)
-                 | ATH9K_POW_SM(ratesArray[rate6mb], 0));
-       REG_WRITE(ah, AR_PHY_POWER_TX_RATE2,
-                 ATH9K_POW_SM(ratesArray[rate54mb], 24)
-                 | ATH9K_POW_SM(ratesArray[rate48mb], 16)
-                 | ATH9K_POW_SM(ratesArray[rate36mb], 8)
-                 | ATH9K_POW_SM(ratesArray[rate24mb], 0));
-
-       if (IS_CHAN_2GHZ(chan)) {
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE3,
-                         ATH9K_POW_SM(ratesArray[rate2s], 24)
-                         | ATH9K_POW_SM(ratesArray[rate2l], 16)
-                         | ATH9K_POW_SM(ratesArray[rateXr], 8)
-                         | ATH9K_POW_SM(ratesArray[rate1l], 0));
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE4,
-                         ATH9K_POW_SM(ratesArray[rate11s], 24)
-                         | ATH9K_POW_SM(ratesArray[rate11l], 16)
-                         | ATH9K_POW_SM(ratesArray[rate5_5s], 8)
-                         | ATH9K_POW_SM(ratesArray[rate5_5l], 0));
+       if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_2) {
+               REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
+                             AR_PHY_TX_END_DATA_START,
+                             pModal->txFrameToDataStart);
+               REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_PA_ON,
+                             pModal->txFrameToPaOn);
        }
 
-       REG_WRITE(ah, AR_PHY_POWER_TX_RATE5,
-                 ATH9K_POW_SM(ratesArray[rateHt20_3], 24)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_2], 16)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_1], 8)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_0], 0));
-       REG_WRITE(ah, AR_PHY_POWER_TX_RATE6,
-                 ATH9K_POW_SM(ratesArray[rateHt20_7], 24)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_6], 16)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_5], 8)
-                 | ATH9K_POW_SM(ratesArray[rateHt20_4], 0));
-
-       if (IS_CHAN_HT40(chan)) {
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE7,
-                         ATH9K_POW_SM(ratesArray[rateHt40_3] +
-                                      ht40PowerIncForPdadc, 24)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_2] +
-                                        ht40PowerIncForPdadc, 16)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_1] +
-                                        ht40PowerIncForPdadc, 8)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_0] +
-                                        ht40PowerIncForPdadc, 0));
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE8,
-                         ATH9K_POW_SM(ratesArray[rateHt40_7] +
-                                      ht40PowerIncForPdadc, 24)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_6] +
-                                        ht40PowerIncForPdadc, 16)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_5] +
-                                        ht40PowerIncForPdadc, 8)
-                         | ATH9K_POW_SM(ratesArray[rateHt40_4] +
-                                        ht40PowerIncForPdadc, 0));
-
-               REG_WRITE(ah, AR_PHY_POWER_TX_RATE9,
-                         ATH9K_POW_SM(ratesArray[rateExtOfdm], 24)
-                         | ATH9K_POW_SM(ratesArray[rateExtCck], 16)
-                         | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
-                         | ATH9K_POW_SM(ratesArray[rateDupCck], 0));
+       if (AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_3) {
+               if (IS_CHAN_HT40(chan))
+                       REG_RMW_FIELD(ah, AR_PHY_SETTLING,
+                                     AR_PHY_SETTLING_SWITCH,
+                                     pModal->swSettleHt40);
        }
 
-       i = rate6mb;
-
-       if (IS_CHAN_HT40(chan))
-               i = rateHt40_0;
-       else if (IS_CHAN_HT20(chan))
-               i = rateHt20_0;
-
-       if (AR_SREV_9280_10_OR_LATER(ah))
-               ah->ah_maxPowerLevel =
-                       ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2;
-       else
-               ah->ah_maxPowerLevel = ratesArray[i];
-
-       return 0;
-}
-
-static int (*ath9k_set_txpower[]) (struct ath_hal *,
-                                  struct ath9k_channel *,
-                                  u16, u8, u8, u8) = {
-       ath9k_hw_def_set_txpower,
-       ath9k_hw_4k_set_txpower
-};
+       if (AR_SREV_9280_20(ah) && AR5416_VER_MASK >= AR5416_EEP_MINOR_VER_20) {
+               if (IS_CHAN_HT20(chan))
+                       REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE,
+                                       eep->baseEepHeader.dacLpMode);
+               else if (eep->baseEepHeader.dacHiPwrMode_5G)
+                       REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE, 0);
+               else
+                       REG_RMW_FIELD(ah, AR_AN_TOP1, AR_AN_TOP1_DACIPMODE,
+                                       eep->baseEepHeader.dacLpMode);
 
-int ath9k_hw_set_txpower(struct ath_hal *ah,
-                        struct ath9k_channel *chan,
-                        u16 cfgCtl,
-                        u8 twiceAntennaReduction,
-                        u8 twiceMaxRegulatoryPower,
-                        u8 powerLimit)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
+               REG_RMW_FIELD(ah, AR_PHY_FRAME_CTL, AR_PHY_FRAME_CTL_TX_CLIP,
+                               pModal->miscBits >> 2);
+       }
 
-       return ath9k_set_txpower[ahp->ah_eep_map](ah, chan, cfgCtl,
-                       twiceAntennaReduction, twiceMaxRegulatoryPower,
-                       powerLimit);
+       return true;
+#undef AR5416_VER_MASK
 }
 
-static void ath9k_hw_set_def_addac(struct ath_hal *ah,
+static void ath9k_hw_def_set_addac(struct ath_hw *ah,
                                   struct ath9k_channel *chan)
 {
 #define XPA_LVL_FREQ(cnt) (pModal->xpaBiasLvlFreq[cnt])
        struct modal_eep_header *pModal;
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def;
+       struct ar5416_eeprom_def *eep = &ah->eeprom.def;
        u8 biaslevel;
 
-       if (ah->ah_macVersion != AR_SREV_VERSION_9160)
+       if (ah->hw_version.macVersion != AR_SREV_VERSION_9160)
                return;
 
-       if (ar5416_get_eep_rev(ahp) < AR5416_EEP_MINOR_VER_7)
+       if (ah->eep_ops->get_eeprom_rev(ah) < AR5416_EEP_MINOR_VER_7)
                return;
 
        pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
@@ -2068,569 +1892,736 @@ static void ath9k_hw_set_def_addac(struct ath_hal *ah,
                                break;
                        freqCount++;
                }
-       }
+       }
+
+       if (IS_CHAN_2GHZ(chan)) {
+               INI_RA(&ah->iniAddac, 7, 1) = (INI_RA(&ah->iniAddac,
+                                       7, 1) & (~0x18)) | biaslevel << 3;
+       } else {
+               INI_RA(&ah->iniAddac, 6, 1) = (INI_RA(&ah->iniAddac,
+                                       6, 1) & (~0xc0)) | biaslevel << 6;
+       }
+#undef XPA_LVL_FREQ
+}
+
+static void ath9k_hw_get_def_gain_boundaries_pdadcs(struct ath_hw *ah,
+                               struct ath9k_channel *chan,
+                               struct cal_data_per_freq *pRawDataSet,
+                               u8 *bChans, u16 availPiers,
+                               u16 tPdGainOverlap, int16_t *pMinCalPower,
+                               u16 *pPdGainBoundaries, u8 *pPDADCValues,
+                               u16 numXpdGains)
+{
+       int i, j, k;
+       int16_t ss;
+       u16 idxL = 0, idxR = 0, numPiers;
+       static u8 vpdTableL[AR5416_NUM_PD_GAINS]
+               [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+       static u8 vpdTableR[AR5416_NUM_PD_GAINS]
+               [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+       static u8 vpdTableI[AR5416_NUM_PD_GAINS]
+               [AR5416_MAX_PWR_RANGE_IN_HALF_DB];
+
+       u8 *pVpdL, *pVpdR, *pPwrL, *pPwrR;
+       u8 minPwrT4[AR5416_NUM_PD_GAINS];
+       u8 maxPwrT4[AR5416_NUM_PD_GAINS];
+       int16_t vpdStep;
+       int16_t tmpVal;
+       u16 sizeCurrVpdTable, maxIndex, tgtIndex;
+       bool match;
+       int16_t minDelta = 0;
+       struct chan_centers centers;
+
+       ath9k_hw_get_channel_centers(ah, chan, &centers);
+
+       for (numPiers = 0; numPiers < availPiers; numPiers++) {
+               if (bChans[numPiers] == AR5416_BCHAN_UNUSED)
+                       break;
+       }
+
+       match = ath9k_hw_get_lower_upper_index((u8)FREQ2FBIN(centers.synth_center,
+                                                            IS_CHAN_2GHZ(chan)),
+                                              bChans, numPiers, &idxL, &idxR);
+
+       if (match) {
+               for (i = 0; i < numXpdGains; i++) {
+                       minPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][0];
+                       maxPwrT4[i] = pRawDataSet[idxL].pwrPdg[i][4];
+                       ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+                                       pRawDataSet[idxL].pwrPdg[i],
+                                       pRawDataSet[idxL].vpdPdg[i],
+                                       AR5416_PD_GAIN_ICEPTS,
+                                       vpdTableI[i]);
+               }
+       } else {
+               for (i = 0; i < numXpdGains; i++) {
+                       pVpdL = pRawDataSet[idxL].vpdPdg[i];
+                       pPwrL = pRawDataSet[idxL].pwrPdg[i];
+                       pVpdR = pRawDataSet[idxR].vpdPdg[i];
+                       pPwrR = pRawDataSet[idxR].pwrPdg[i];
+
+                       minPwrT4[i] = max(pPwrL[0], pPwrR[0]);
+
+                       maxPwrT4[i] =
+                               min(pPwrL[AR5416_PD_GAIN_ICEPTS - 1],
+                                   pPwrR[AR5416_PD_GAIN_ICEPTS - 1]);
+
+
+                       ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+                                               pPwrL, pVpdL,
+                                               AR5416_PD_GAIN_ICEPTS,
+                                               vpdTableL[i]);
+                       ath9k_hw_fill_vpd_table(minPwrT4[i], maxPwrT4[i],
+                                               pPwrR, pVpdR,
+                                               AR5416_PD_GAIN_ICEPTS,
+                                               vpdTableR[i]);
+
+                       for (j = 0; j <= (maxPwrT4[i] - minPwrT4[i]) / 2; j++) {
+                               vpdTableI[i][j] =
+                                       (u8)(ath9k_hw_interpolate((u16)
+                                            FREQ2FBIN(centers.
+                                                      synth_center,
+                                                      IS_CHAN_2GHZ
+                                                      (chan)),
+                                            bChans[idxL], bChans[idxR],
+                                            vpdTableL[i][j], vpdTableR[i][j]));
+                       }
+               }
+       }
+
+       *pMinCalPower = (int16_t)(minPwrT4[0] / 2);
+
+       k = 0;
+
+       for (i = 0; i < numXpdGains; i++) {
+               if (i == (numXpdGains - 1))
+                       pPdGainBoundaries[i] =
+                               (u16)(maxPwrT4[i] / 2);
+               else
+                       pPdGainBoundaries[i] =
+                               (u16)((maxPwrT4[i] + minPwrT4[i + 1]) / 4);
+
+               pPdGainBoundaries[i] =
+                       min((u16)AR5416_MAX_RATE_POWER, pPdGainBoundaries[i]);
+
+               if ((i == 0) && !AR_SREV_5416_V20_OR_LATER(ah)) {
+                       minDelta = pPdGainBoundaries[0] - 23;
+                       pPdGainBoundaries[0] = 23;
+               } else {
+                       minDelta = 0;
+               }
 
-       if (IS_CHAN_2GHZ(chan)) {
-               INI_RA(&ahp->ah_iniAddac, 7, 1) = (INI_RA(&ahp->ah_iniAddac,
-                                       7, 1) & (~0x18)) | biaslevel << 3;
-       } else {
-               INI_RA(&ahp->ah_iniAddac, 6, 1) = (INI_RA(&ahp->ah_iniAddac,
-                                       6, 1) & (~0xc0)) | biaslevel << 6;
-       }
-#undef XPA_LVL_FREQ
-}
+               if (i == 0) {
+                       if (AR_SREV_9280_10_OR_LATER(ah))
+                               ss = (int16_t)(0 - (minPwrT4[i] / 2));
+                       else
+                               ss = 0;
+               } else {
+                       ss = (int16_t)((pPdGainBoundaries[i - 1] -
+                                       (minPwrT4[i] / 2)) -
+                                      tPdGainOverlap + 1 + minDelta);
+               }
+               vpdStep = (int16_t)(vpdTableI[i][1] - vpdTableI[i][0]);
+               vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
 
-static void ath9k_hw_set_4k_addac(struct ath_hal *ah,
-                                 struct ath9k_channel *chan)
-{
-       struct modal_eep_4k_header *pModal;
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k;
-       u8 biaslevel;
+               while ((ss < 0) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
+                       tmpVal = (int16_t)(vpdTableI[i][0] + ss * vpdStep);
+                       pPDADCValues[k++] = (u8)((tmpVal < 0) ? 0 : tmpVal);
+                       ss++;
+               }
 
-       if (ah->ah_macVersion != AR_SREV_VERSION_9160)
-               return;
+               sizeCurrVpdTable = (u8) ((maxPwrT4[i] - minPwrT4[i]) / 2 + 1);
+               tgtIndex = (u8)(pPdGainBoundaries[i] + tPdGainOverlap -
+                               (minPwrT4[i] / 2));
+               maxIndex = (tgtIndex < sizeCurrVpdTable) ?
+                       tgtIndex : sizeCurrVpdTable;
 
-       if (ar5416_get_eep_rev(ahp) < AR5416_EEP_MINOR_VER_7)
-               return;
+               while ((ss < maxIndex) && (k < (AR5416_NUM_PDADC_VALUES - 1))) {
+                       pPDADCValues[k++] = vpdTableI[i][ss++];
+               }
 
-       pModal = &eep->modalHeader;
+               vpdStep = (int16_t)(vpdTableI[i][sizeCurrVpdTable - 1] -
+                                   vpdTableI[i][sizeCurrVpdTable - 2]);
+               vpdStep = (int16_t)((vpdStep < 1) ? 1 : vpdStep);
 
-       if (pModal->xpaBiasLvl != 0xff) {
-               biaslevel = pModal->xpaBiasLvl;
-               INI_RA(&ahp->ah_iniAddac, 7, 1) =
-                 (INI_RA(&ahp->ah_iniAddac, 7, 1) & (~0x18)) | biaslevel << 3;
+               if (tgtIndex > maxIndex) {
+                       while ((ss <= tgtIndex) &&
+                              (k < (AR5416_NUM_PDADC_VALUES - 1))) {
+                               tmpVal = (int16_t)((vpdTableI[i][sizeCurrVpdTable - 1] +
+                                                   (ss - maxIndex + 1) * vpdStep));
+                               pPDADCValues[k++] = (u8)((tmpVal > 255) ?
+                                                        255 : tmpVal);
+                               ss++;
+                       }
+               }
        }
-}
 
-static void (*ath9k_set_addac[]) (struct ath_hal *, struct ath9k_channel *) = {
-       ath9k_hw_set_def_addac,
-       ath9k_hw_set_4k_addac
-};
+       while (i < AR5416_PD_GAINS_IN_MASK) {
+               pPdGainBoundaries[i] = pPdGainBoundaries[i - 1];
+               i++;
+       }
 
-void ath9k_hw_set_addac(struct ath_hal *ah, struct ath9k_channel *chan)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       while (k < AR5416_NUM_PDADC_VALUES) {
+               pPDADCValues[k] = pPDADCValues[k - 1];
+               k++;
+       }
 
-       ath9k_set_addac[ahp->ah_eep_map](ah, chan);
+       return;
 }
 
-
-
-/* XXX: Clean me up, make me more legible */
-static bool ath9k_hw_eeprom_set_def_board_values(struct ath_hal *ah,
-                                     struct ath9k_channel *chan)
+static bool ath9k_hw_set_def_power_cal_table(struct ath_hw *ah,
+                                 struct ath9k_channel *chan,
+                                 int16_t *pTxPowerIndexOffset)
 {
-       struct modal_eep_header *pModal;
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def;
-       int i, regChainOffset;
-       u8 txRxAttenLocal;
-       u16 ant_config;
-
-       pModal = &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
-
-       txRxAttenLocal = IS_CHAN_2GHZ(chan) ? 23 : 44;
-
-       ath9k_hw_get_eeprom_antenna_cfg(ah, chan, 0, &ant_config);
-       REG_WRITE(ah, AR_PHY_SWITCH_COM, ant_config);
-
-       for (i = 0; i < AR5416_MAX_CHAINS; i++) {
-               if (AR_SREV_9280(ah)) {
-                       if (i >= 2)
-                               break;
-               }
-
-               if (AR_SREV_5416_V20_OR_LATER(ah) &&
-                   (ahp->ah_rxchainmask == 5 || ahp->ah_txchainmask == 5)
-                   && (i != 0))
-                       regChainOffset = (i == 1) ? 0x2000 : 0x1000;
-               else
-                       regChainOffset = i * 0x1000;
+       struct ar5416_eeprom_def *pEepData = &ah->eeprom.def;
+       struct cal_data_per_freq *pRawDataset;
+       u8 *pCalBChans = NULL;
+       u16 pdGainOverlap_t2;
+       static u8 pdadcValues[AR5416_NUM_PDADC_VALUES];
+       u16 gainBoundaries[AR5416_PD_GAINS_IN_MASK];
+       u16 numPiers, i, j;
+       int16_t tMinCalPower;
+       u16 numXpdGain, xpdMask;
+       u16 xpdGainValues[AR5416_NUM_PD_GAINS] = { 0, 0, 0, 0 };
+       u32 reg32, regOffset, regChainOffset;
+       int16_t modalIdx;
 
-               REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
-                         pModal->antCtrlChain[i]);
+       modalIdx = IS_CHAN_2GHZ(chan) ? 1 : 0;
+       xpdMask = pEepData->modalHeader[modalIdx].xpdGain;
 
-               REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset,
-                         (REG_READ(ah,
-                                   AR_PHY_TIMING_CTRL4(0) +
-                                   regChainOffset) &
-                          ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
-                            AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
-                         SM(pModal->iqCalICh[i],
-                            AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
-                         SM(pModal->iqCalQCh[i],
-                            AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
+       if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
+           AR5416_EEP_MINOR_VER_2) {
+               pdGainOverlap_t2 =
+                       pEepData->modalHeader[modalIdx].pdGainOverlap;
+       } else {
+               pdGainOverlap_t2 = (u16)(MS(REG_READ(ah, AR_PHY_TPCRG5),
+                                           AR_PHY_TPCRG5_PD_GAIN_OVERLAP));
+       }
 
-               if ((i == 0) || AR_SREV_5416_V20_OR_LATER(ah)) {
-                       if ((eep->baseEepHeader.version &
-                            AR5416_EEP_VER_MINOR_MASK) >=
-                           AR5416_EEP_MINOR_VER_3) {
-                               txRxAttenLocal = pModal->txRxAttenCh[i];
-                               if (AR_SREV_9280_10_OR_LATER(ah)) {
-                                       REG_RMW_FIELD(ah,
-                                               AR_PHY_GAIN_2GHZ +
-                                               regChainOffset,
-                                               AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN,
-                                               pModal->
-                                               bswMargin[i]);
-                                       REG_RMW_FIELD(ah,
-                                               AR_PHY_GAIN_2GHZ +
-                                               regChainOffset,
-                                               AR_PHY_GAIN_2GHZ_XATTEN1_DB,
-                                               pModal->
-                                               bswAtten[i]);
-                                       REG_RMW_FIELD(ah,
-                                               AR_PHY_GAIN_2GHZ +
-                                               regChainOffset,
-                                               AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN,
-                                               pModal->
-                                               xatten2Margin[i]);
-                                       REG_RMW_FIELD(ah,
-                                               AR_PHY_GAIN_2GHZ +
-                                               regChainOffset,
-                                               AR_PHY_GAIN_2GHZ_XATTEN2_DB,
-                                               pModal->
-                                               xatten2Db[i]);
-                               } else {
-                                       REG_WRITE(ah,
-                                                 AR_PHY_GAIN_2GHZ +
-                                                 regChainOffset,
-                                                 (REG_READ(ah,
-                                                           AR_PHY_GAIN_2GHZ +
-                                                           regChainOffset) &
-                                                  ~AR_PHY_GAIN_2GHZ_BSW_MARGIN)
-                                                 | SM(pModal->
-                                                 bswMargin[i],
-                                                 AR_PHY_GAIN_2GHZ_BSW_MARGIN));
-                                       REG_WRITE(ah,
-                                                 AR_PHY_GAIN_2GHZ +
-                                                 regChainOffset,
-                                                 (REG_READ(ah,
-                                                           AR_PHY_GAIN_2GHZ +
-                                                           regChainOffset) &
-                                                  ~AR_PHY_GAIN_2GHZ_BSW_ATTEN)
-                                                 | SM(pModal->bswAtten[i],
-                                                 AR_PHY_GAIN_2GHZ_BSW_ATTEN));
-                               }
-                       }
-                       if (AR_SREV_9280_10_OR_LATER(ah)) {
-                               REG_RMW_FIELD(ah,
-                                             AR_PHY_RXGAIN +
-                                             regChainOffset,
-                                             AR9280_PHY_RXGAIN_TXRX_ATTEN,
-                                             txRxAttenLocal);
-                               REG_RMW_FIELD(ah,
-                                             AR_PHY_RXGAIN +
-                                             regChainOffset,
-                                             AR9280_PHY_RXGAIN_TXRX_MARGIN,
-                                             pModal->rxTxMarginCh[i]);
-                       } else {
-                               REG_WRITE(ah,
-                                         AR_PHY_RXGAIN + regChainOffset,
-                                         (REG_READ(ah,
-                                                   AR_PHY_RXGAIN +
-                                                   regChainOffset) &
-                                          ~AR_PHY_RXGAIN_TXRX_ATTEN) |
-                                         SM(txRxAttenLocal,
-                                            AR_PHY_RXGAIN_TXRX_ATTEN));
-                               REG_WRITE(ah,
-                                         AR_PHY_GAIN_2GHZ +
-                                         regChainOffset,
-                                         (REG_READ(ah,
-                                                   AR_PHY_GAIN_2GHZ +
-                                                   regChainOffset) &
-                                          ~AR_PHY_GAIN_2GHZ_RXTX_MARGIN) |
-                                         SM(pModal->rxTxMarginCh[i],
-                                            AR_PHY_GAIN_2GHZ_RXTX_MARGIN));
-                       }
-               }
+       if (IS_CHAN_2GHZ(chan)) {
+               pCalBChans = pEepData->calFreqPier2G;
+               numPiers = AR5416_NUM_2G_CAL_PIERS;
+       } else {
+               pCalBChans = pEepData->calFreqPier5G;
+               numPiers = AR5416_NUM_5G_CAL_PIERS;
        }
 
-       if (AR_SREV_9280_10_OR_LATER(ah)) {
-               if (IS_CHAN_2GHZ(chan)) {
-                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0,
-                                                 AR_AN_RF2G1_CH0_OB,
-                                                 AR_AN_RF2G1_CH0_OB_S,
-                                                 pModal->ob);
-                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH0,
-                                                 AR_AN_RF2G1_CH0_DB,
-                                                 AR_AN_RF2G1_CH0_DB_S,
-                                                 pModal->db);
-                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH1,
-                                                 AR_AN_RF2G1_CH1_OB,
-                                                 AR_AN_RF2G1_CH1_OB_S,
-                                                 pModal->ob_ch1);
-                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF2G1_CH1,
-                                                 AR_AN_RF2G1_CH1_DB,
-                                                 AR_AN_RF2G1_CH1_DB_S,
-                                                 pModal->db_ch1);
-               } else {
-                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH0,
-                                                 AR_AN_RF5G1_CH0_OB5,
-                                                 AR_AN_RF5G1_CH0_OB5_S,
-                                                 pModal->ob);
-                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH0,
-                                                 AR_AN_RF5G1_CH0_DB5,
-                                                 AR_AN_RF5G1_CH0_DB5_S,
-                                                 pModal->db);
-                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH1,
-                                                 AR_AN_RF5G1_CH1_OB5,
-                                                 AR_AN_RF5G1_CH1_OB5_S,
-                                                 pModal->ob_ch1);
-                       ath9k_hw_analog_shift_rmw(ah, AR_AN_RF5G1_CH1,
-                                                 AR_AN_RF5G1_CH1_DB5,
-                                                 AR_AN_RF5G1_CH1_DB5_S,
-                                                 pModal->db_ch1);
+       numXpdGain = 0;
+
+       for (i = 1; i <= AR5416_PD_GAINS_IN_MASK; i++) {
+               if ((xpdMask >> (AR5416_PD_GAINS_IN_MASK - i)) & 1) {
+                       if (numXpdGain >= AR5416_NUM_PD_GAINS)
+                               break;
+                       xpdGainValues[numXpdGain] =
+                               (u16)(AR5416_PD_GAINS_IN_MASK - i);
+                       numXpdGain++;
                }
-               ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
-                                         AR_AN_TOP2_XPABIAS_LVL,
-                                         AR_AN_TOP2_XPABIAS_LVL_S,
-                                         pModal->xpaBiasLvl);
-               ath9k_hw_analog_shift_rmw(ah, AR_AN_TOP2,
-                                         AR_AN_TOP2_LOCALBIAS,
-                                         AR_AN_TOP2_LOCALBIAS_S,
-                                         pModal->local_bias);
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, "ForceXPAon: %d\n",
-                       pModal->force_xpaon);
-               REG_RMW_FIELD(ah, AR_PHY_XPA_CFG, AR_PHY_FORCE_XPA_CFG,
-                             pModal->force_xpaon);
        }
 
-       REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
-                     pModal->switchSettling);
-       REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC,
-                     pModal->adcDesiredSize);
+       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_NUM_PD_GAIN,
+                     (numXpdGain - 1) & 0x3);
+       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_1,
+                     xpdGainValues[0]);
+       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_2,
+                     xpdGainValues[1]);
+       REG_RMW_FIELD(ah, AR_PHY_TPCRG1, AR_PHY_TPCRG1_PD_GAIN_3,
+                     xpdGainValues[2]);
 
-       if (!AR_SREV_9280_10_OR_LATER(ah))
-               REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ,
-                             AR_PHY_DESIRED_SZ_PGA,
-                             pModal->pgaDesiredSize);
+       for (i = 0; i < AR5416_MAX_CHAINS; i++) {
+               if (AR_SREV_5416_V20_OR_LATER(ah) &&
+                   (ah->rxchainmask == 5 || ah->txchainmask == 5) &&
+                   (i != 0)) {
+                       regChainOffset = (i == 1) ? 0x2000 : 0x1000;
+               } else
+                       regChainOffset = i * 0x1000;
 
-       REG_WRITE(ah, AR_PHY_RF_CTL4,
-                 SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF)
-                 | SM(pModal->txEndToXpaOff,
-                      AR_PHY_RF_CTL4_TX_END_XPAB_OFF)
-                 | SM(pModal->txFrameToXpaOn,
-                      AR_PHY_RF_CTL4_FRAME_XPAA_ON)
-                 | SM(pModal->txFrameToXpaOn,
-                      AR_PHY_RF_CTL4_FRAME_XPAB_ON));
+               if (pEepData->baseEepHeader.txMask & (1 << i)) {
+                       if (IS_CHAN_2GHZ(chan))
+                               pRawDataset = pEepData->calPierData2G[i];
+                       else
+                               pRawDataset = pEepData->calPierData5G[i];
 
-       REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON,
-                     pModal->txEndToRxOn);
-       if (AR_SREV_9280_10_OR_LATER(ah)) {
-               REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62,
-                             pModal->thresh62);
-               REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0,
-                             AR_PHY_EXT_CCA0_THRESH62,
-                             pModal->thresh62);
-       } else {
-               REG_RMW_FIELD(ah, AR_PHY_CCA, AR_PHY_CCA_THRESH62,
-                             pModal->thresh62);
-               REG_RMW_FIELD(ah, AR_PHY_EXT_CCA,
-                             AR_PHY_EXT_CCA_THRESH62,
-                             pModal->thresh62);
-       }
+                       ath9k_hw_get_def_gain_boundaries_pdadcs(ah, chan,
+                                           pRawDataset, pCalBChans,
+                                           numPiers, pdGainOverlap_t2,
+                                           &tMinCalPower, gainBoundaries,
+                                           pdadcValues, numXpdGain);
 
-       if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
-           AR5416_EEP_MINOR_VER_2) {
-               REG_RMW_FIELD(ah, AR_PHY_RF_CTL2,
-                             AR_PHY_TX_END_DATA_START,
-                             pModal->txFrameToDataStart);
-               REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_PA_ON,
-                             pModal->txFrameToPaOn);
-       }
+                       if ((i == 0) || AR_SREV_5416_V20_OR_LATER(ah)) {
+                               REG_WRITE(ah,
+                                         AR_PHY_TPCRG5 + regChainOffset,
+                                         SM(pdGainOverlap_t2,
+                                            AR_PHY_TPCRG5_PD_GAIN_OVERLAP)
+                                         | SM(gainBoundaries[0],
+                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_1)
+                                         | SM(gainBoundaries[1],
+                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_2)
+                                         | SM(gainBoundaries[2],
+                                              AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_3)
+                                         | SM(gainBoundaries[3],
+                                      AR_PHY_TPCRG5_PD_GAIN_BOUNDARY_4));
+                       }
 
-       if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
-           AR5416_EEP_MINOR_VER_3) {
-               if (IS_CHAN_HT40(chan))
-                       REG_RMW_FIELD(ah, AR_PHY_SETTLING,
-                                     AR_PHY_SETTLING_SWITCH,
-                                     pModal->swSettleHt40);
+                       regOffset = AR_PHY_BASE + (672 << 2) + regChainOffset;
+                       for (j = 0; j < 32; j++) {
+                               reg32 = ((pdadcValues[4 * j + 0] & 0xFF) << 0) |
+                                       ((pdadcValues[4 * j + 1] & 0xFF) << 8) |
+                                       ((pdadcValues[4 * j + 2] & 0xFF) << 16)|
+                                       ((pdadcValues[4 * j + 3] & 0xFF) << 24);
+                               REG_WRITE(ah, regOffset, reg32);
+
+                               DPRINTF(ah->ah_sc, ATH_DBG_REG_IO,
+                                       "PDADC (%d,%4x): %4.4x %8.8x\n",
+                                       i, regChainOffset, regOffset,
+                                       reg32);
+                               DPRINTF(ah->ah_sc, ATH_DBG_REG_IO,
+                                       "PDADC: Chain %d | PDADC %3d "
+                                       "Value %3d | PDADC %3d Value %3d | "
+                                       "PDADC %3d Value %3d | PDADC %3d "
+                                       "Value %3d |\n",
+                                       i, 4 * j, pdadcValues[4 * j],
+                                       4 * j + 1, pdadcValues[4 * j + 1],
+                                       4 * j + 2, pdadcValues[4 * j + 2],
+                                       4 * j + 3,
+                                       pdadcValues[4 * j + 3]);
+
+                               regOffset += 4;
+                       }
+               }
        }
 
+       *pTxPowerIndexOffset = 0;
+
        return true;
 }
 
-static bool ath9k_hw_eeprom_set_4k_board_values(struct ath_hal *ah,
-                                     struct ath9k_channel *chan)
+static bool ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah,
+                                                 struct ath9k_channel *chan,
+                                                 int16_t *ratesArray,
+                                                 u16 cfgCtl,
+                                                 u16 AntennaReduction,
+                                                 u16 twiceMaxRegulatoryPower,
+                                                 u16 powerLimit)
 {
-       struct modal_eep_4k_header *pModal;
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k;
-       int regChainOffset;
-       u8 txRxAttenLocal;
-       u16 ant_config = 0;
-       u8 ob[5], db1[5], db2[5];
-       u8 ant_div_control1, ant_div_control2;
-       u32 regVal;
+#define REDUCE_SCALED_POWER_BY_TWO_CHAIN     6  /* 10*log10(2)*2 */
+#define REDUCE_SCALED_POWER_BY_THREE_CHAIN   10 /* 10*log10(3)*2 */
 
+       struct ar5416_eeprom_def *pEepData = &ah->eeprom.def;
+       u16 twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
+       static const u16 tpScaleReductionTable[5] =
+               { 0, 3, 6, 9, AR5416_MAX_RATE_POWER };
 
-       pModal = &eep->modalHeader;
+       int i;
+       int16_t twiceLargestAntenna;
+       struct cal_ctl_data *rep;
+       struct cal_target_power_leg targetPowerOfdm, targetPowerCck = {
+               0, { 0, 0, 0, 0}
+       };
+       struct cal_target_power_leg targetPowerOfdmExt = {
+               0, { 0, 0, 0, 0} }, targetPowerCckExt = {
+               0, { 0, 0, 0, 0 }
+       };
+       struct cal_target_power_ht targetPowerHt20, targetPowerHt40 = {
+               0, {0, 0, 0, 0}
+       };
+       u16 scaledPower = 0, minCtlPower, maxRegAllowedPower;
+       u16 ctlModesFor11a[] =
+               { CTL_11A, CTL_5GHT20, CTL_11A_EXT, CTL_5GHT40 };
+       u16 ctlModesFor11g[] =
+               { CTL_11B, CTL_11G, CTL_2GHT20, CTL_11B_EXT, CTL_11G_EXT,
+                 CTL_2GHT40
+               };
+       u16 numCtlModes, *pCtlMode, ctlMode, freq;
+       struct chan_centers centers;
+       int tx_chainmask;
+       u16 twiceMinEdgePower;
 
-       txRxAttenLocal = 23;
+       tx_chainmask = ah->txchainmask;
 
-       ath9k_hw_get_eeprom_antenna_cfg(ah, chan, 0, &ant_config);
-       REG_WRITE(ah, AR_PHY_SWITCH_COM, ant_config);
+       ath9k_hw_get_channel_centers(ah, chan, &centers);
 
-       regChainOffset = 0;
-       REG_WRITE(ah, AR_PHY_SWITCH_CHAIN_0 + regChainOffset,
-                 pModal->antCtrlChain[0]);
+       twiceLargestAntenna = max(
+               pEepData->modalHeader
+                       [IS_CHAN_2GHZ(chan)].antennaGainCh[0],
+               pEepData->modalHeader
+                       [IS_CHAN_2GHZ(chan)].antennaGainCh[1]);
 
-       REG_WRITE(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset,
-                (REG_READ(ah, AR_PHY_TIMING_CTRL4(0) + regChainOffset) &
-                ~(AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF |
-                AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF)) |
-                SM(pModal->iqCalICh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_I_COFF) |
-                SM(pModal->iqCalQCh[0], AR_PHY_TIMING_CTRL4_IQCORR_Q_Q_COFF));
+       twiceLargestAntenna = max((u8)twiceLargestAntenna,
+                                 pEepData->modalHeader
+                                 [IS_CHAN_2GHZ(chan)].antennaGainCh[2]);
 
-       if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
-                       AR5416_EEP_MINOR_VER_3) {
-               txRxAttenLocal = pModal->txRxAttenCh[0];
-               REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
-                       AR_PHY_GAIN_2GHZ_XATTEN1_MARGIN, pModal->bswMargin[0]);
-               REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
-                       AR_PHY_GAIN_2GHZ_XATTEN1_DB, pModal->bswAtten[0]);
-               REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
-                       AR_PHY_GAIN_2GHZ_XATTEN2_MARGIN,
-                       pModal->xatten2Margin[0]);
-               REG_RMW_FIELD(ah, AR_PHY_GAIN_2GHZ + regChainOffset,
-                       AR_PHY_GAIN_2GHZ_XATTEN2_DB, pModal->xatten2Db[0]);
+       twiceLargestAntenna = (int16_t)min(AntennaReduction -
+                                          twiceLargestAntenna, 0);
+
+       maxRegAllowedPower = twiceMaxRegulatoryPower + twiceLargestAntenna;
+
+       if (ah->regulatory.tp_scale != ATH9K_TP_SCALE_MAX) {
+               maxRegAllowedPower -=
+                       (tpScaleReductionTable[(ah->regulatory.tp_scale)] * 2);
        }
 
-       REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
-                       AR9280_PHY_RXGAIN_TXRX_ATTEN, txRxAttenLocal);
-       REG_RMW_FIELD(ah, AR_PHY_RXGAIN + regChainOffset,
-                       AR9280_PHY_RXGAIN_TXRX_MARGIN, pModal->rxTxMarginCh[0]);
+       scaledPower = min(powerLimit, maxRegAllowedPower);
+
+       switch (ar5416_get_ntxchains(tx_chainmask)) {
+       case 1:
+               break;
+       case 2:
+               scaledPower -= REDUCE_SCALED_POWER_BY_TWO_CHAIN;
+               break;
+       case 3:
+               scaledPower -= REDUCE_SCALED_POWER_BY_THREE_CHAIN;
+               break;
+       }
+
+       scaledPower = max((u16)0, scaledPower);
+
+       if (IS_CHAN_2GHZ(chan)) {
+               numCtlModes = ARRAY_SIZE(ctlModesFor11g) -
+                       SUB_NUM_CTL_MODES_AT_2G_40;
+               pCtlMode = ctlModesFor11g;
+
+               ath9k_hw_get_legacy_target_powers(ah, chan,
+                       pEepData->calTargetPowerCck,
+                       AR5416_NUM_2G_CCK_TARGET_POWERS,
+                       &targetPowerCck, 4, false);
+               ath9k_hw_get_legacy_target_powers(ah, chan,
+                       pEepData->calTargetPower2G,
+                       AR5416_NUM_2G_20_TARGET_POWERS,
+                       &targetPowerOfdm, 4, false);
+               ath9k_hw_get_target_powers(ah, chan,
+                       pEepData->calTargetPower2GHT20,
+                       AR5416_NUM_2G_20_TARGET_POWERS,
+                       &targetPowerHt20, 8, false);
+
+               if (IS_CHAN_HT40(chan)) {
+                       numCtlModes = ARRAY_SIZE(ctlModesFor11g);
+                       ath9k_hw_get_target_powers(ah, chan,
+                               pEepData->calTargetPower2GHT40,
+                               AR5416_NUM_2G_40_TARGET_POWERS,
+                               &targetPowerHt40, 8, true);
+                       ath9k_hw_get_legacy_target_powers(ah, chan,
+                               pEepData->calTargetPowerCck,
+                               AR5416_NUM_2G_CCK_TARGET_POWERS,
+                               &targetPowerCckExt, 4, true);
+                       ath9k_hw_get_legacy_target_powers(ah, chan,
+                               pEepData->calTargetPower2G,
+                               AR5416_NUM_2G_20_TARGET_POWERS,
+                               &targetPowerOfdmExt, 4, true);
+               }
+       } else {
+               numCtlModes = ARRAY_SIZE(ctlModesFor11a) -
+                       SUB_NUM_CTL_MODES_AT_5G_40;
+               pCtlMode = ctlModesFor11a;
 
-       if (AR_SREV_9285_11(ah))
-               REG_WRITE(ah, AR9285_AN_TOP4, (AR9285_AN_TOP4_DEFAULT | 0x14));
+               ath9k_hw_get_legacy_target_powers(ah, chan,
+                       pEepData->calTargetPower5G,
+                       AR5416_NUM_5G_20_TARGET_POWERS,
+                       &targetPowerOfdm, 4, false);
+               ath9k_hw_get_target_powers(ah, chan,
+                       pEepData->calTargetPower5GHT20,
+                       AR5416_NUM_5G_20_TARGET_POWERS,
+                       &targetPowerHt20, 8, false);
 
-       /* Initialize Ant Diversity settings from EEPROM */
-       if (pModal->version == 3) {
-               ant_div_control1 = ((pModal->ob_234 >> 12) & 0xf);
-               ant_div_control2 = ((pModal->db1_234 >> 12) & 0xf);
-               regVal = REG_READ(ah, 0x99ac);
-               regVal &= (~(0x7f000000));
-               regVal |= ((ant_div_control1 & 0x1) << 24);
-               regVal |= (((ant_div_control1 >> 1) & 0x1) << 29);
-               regVal |= (((ant_div_control1 >> 2) & 0x1) << 30);
-               regVal |= ((ant_div_control2 & 0x3) << 25);
-               regVal |= (((ant_div_control2 >> 2) & 0x3) << 27);
-               REG_WRITE(ah, 0x99ac, regVal);
-               regVal = REG_READ(ah, 0x99ac);
-               regVal = REG_READ(ah, 0xa208);
-               regVal &= (~(0x1 << 13));
-               regVal |= (((ant_div_control1 >> 3) & 0x1) << 13);
-               REG_WRITE(ah, 0xa208, regVal);
-               regVal = REG_READ(ah, 0xa208);
+               if (IS_CHAN_HT40(chan)) {
+                       numCtlModes = ARRAY_SIZE(ctlModesFor11a);
+                       ath9k_hw_get_target_powers(ah, chan,
+                               pEepData->calTargetPower5GHT40,
+                               AR5416_NUM_5G_40_TARGET_POWERS,
+                               &targetPowerHt40, 8, true);
+                       ath9k_hw_get_legacy_target_powers(ah, chan,
+                               pEepData->calTargetPower5G,
+                               AR5416_NUM_5G_20_TARGET_POWERS,
+                               &targetPowerOfdmExt, 4, true);
+               }
        }
 
-       if (pModal->version >= 2) {
-               ob[0] = (pModal->ob_01 & 0xf);
-               ob[1] = (pModal->ob_01 >> 4) & 0xf;
-               ob[2] = (pModal->ob_234 & 0xf);
-               ob[3] = ((pModal->ob_234 >> 4) & 0xf);
-               ob[4] = ((pModal->ob_234 >> 8) & 0xf);
+       for (ctlMode = 0; ctlMode < numCtlModes; ctlMode++) {
+               bool isHt40CtlMode = (pCtlMode[ctlMode] == CTL_5GHT40) ||
+                       (pCtlMode[ctlMode] == CTL_2GHT40);
+               if (isHt40CtlMode)
+                       freq = centers.synth_center;
+               else if (pCtlMode[ctlMode] & EXT_ADDITIVE)
+                       freq = centers.ext_center;
+               else
+                       freq = centers.ctl_center;
 
-               db1[0] = (pModal->db1_01 & 0xf);
-               db1[1] = ((pModal->db1_01 >> 4) & 0xf);
-               db1[2] = (pModal->db1_234 & 0xf);
-               db1[3] = ((pModal->db1_234 >> 4) & 0xf);
-               db1[4] = ((pModal->db1_234 >> 8) & 0xf);
+               if (ah->eep_ops->get_eeprom_ver(ah) == 14 &&
+                   ah->eep_ops->get_eeprom_rev(ah) <= 2)
+                       twiceMaxEdgePower = AR5416_MAX_RATE_POWER;
 
-               db2[0] = (pModal->db2_01 & 0xf);
-               db2[1] = ((pModal->db2_01 >> 4) & 0xf);
-               db2[2] = (pModal->db2_234 & 0xf);
-               db2[3] = ((pModal->db2_234 >> 4) & 0xf);
-               db2[4] = ((pModal->db2_234 >> 8) & 0xf);
+               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
+                       "LOOP-Mode ctlMode %d < %d, isHt40CtlMode %d, "
+                       "EXT_ADDITIVE %d\n",
+                       ctlMode, numCtlModes, isHt40CtlMode,
+                       (pCtlMode[ctlMode] & EXT_ADDITIVE));
 
-       } else if (pModal->version == 1) {
+               for (i = 0; (i < AR5416_NUM_CTLS) && pEepData->ctlIndex[i]; i++) {
+                       DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
+                               "  LOOP-Ctlidx %d: cfgCtl 0x%2.2x "
+                               "pCtlMode 0x%2.2x ctlIndex 0x%2.2x "
+                               "chan %d\n",
+                               i, cfgCtl, pCtlMode[ctlMode],
+                               pEepData->ctlIndex[i], chan->channel);
 
-               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
-                       "EEPROM Model version is set to 1 \n");
-               ob[0] = (pModal->ob_01 & 0xf);
-               ob[1] = ob[2] = ob[3] = ob[4] = (pModal->ob_01 >> 4) & 0xf;
-               db1[0] = (pModal->db1_01 & 0xf);
-               db1[1] = db1[2] = db1[3] =
-                       db1[4] = ((pModal->db1_01 >> 4) & 0xf);
-               db2[0] = (pModal->db2_01 & 0xf);
-               db2[1] = db2[2] = db2[3] =
-                       db2[4] = ((pModal->db2_01 >> 4) & 0xf);
-       } else {
-               int i;
-               for (i = 0; i < 5; i++) {
-                       ob[i] = pModal->ob_01;
-                       db1[i] = pModal->db1_01;
-                       db2[i] = pModal->db1_01;
+                       if ((((cfgCtl & ~CTL_MODE_M) |
+                             (pCtlMode[ctlMode] & CTL_MODE_M)) ==
+                            pEepData->ctlIndex[i]) ||
+                           (((cfgCtl & ~CTL_MODE_M) |
+                             (pCtlMode[ctlMode] & CTL_MODE_M)) ==
+                            ((pEepData->ctlIndex[i] & CTL_MODE_M) | SD_NO_CTL))) {
+                               rep = &(pEepData->ctlData[i]);
+
+                               twiceMinEdgePower = ath9k_hw_get_max_edge_power(freq,
+                               rep->ctlEdges[ar5416_get_ntxchains(tx_chainmask) - 1],
+                               IS_CHAN_2GHZ(chan), AR5416_NUM_BAND_EDGES);
+
+                               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
+                                       "    MATCH-EE_IDX %d: ch %d is2 %d "
+                                       "2xMinEdge %d chainmask %d chains %d\n",
+                                       i, freq, IS_CHAN_2GHZ(chan),
+                                       twiceMinEdgePower, tx_chainmask,
+                                       ar5416_get_ntxchains
+                                       (tx_chainmask));
+                               if ((cfgCtl & ~CTL_MODE_M) == SD_NO_CTL) {
+                                       twiceMaxEdgePower = min(twiceMaxEdgePower,
+                                                               twiceMinEdgePower);
+                               } else {
+                                       twiceMaxEdgePower = twiceMinEdgePower;
+                                       break;
+                               }
+                       }
                }
-       }
 
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
-                       AR9285_AN_RF2G3_OB_0, AR9285_AN_RF2G3_OB_0_S, ob[0]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
-                       AR9285_AN_RF2G3_OB_1, AR9285_AN_RF2G3_OB_1_S, ob[1]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
-                       AR9285_AN_RF2G3_OB_2, AR9285_AN_RF2G3_OB_2_S, ob[2]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
-                       AR9285_AN_RF2G3_OB_3, AR9285_AN_RF2G3_OB_3_S, ob[3]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
-                       AR9285_AN_RF2G3_OB_4, AR9285_AN_RF2G3_OB_4_S, ob[4]);
+               minCtlPower = min(twiceMaxEdgePower, scaledPower);
 
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
-                       AR9285_AN_RF2G3_DB1_0, AR9285_AN_RF2G3_DB1_0_S, db1[0]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
-                       AR9285_AN_RF2G3_DB1_1, AR9285_AN_RF2G3_DB1_1_S, db1[1]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G3,
-                       AR9285_AN_RF2G3_DB1_2, AR9285_AN_RF2G3_DB1_2_S, db1[2]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
-                       AR9285_AN_RF2G4_DB1_3, AR9285_AN_RF2G4_DB1_3_S, db1[3]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
-                       AR9285_AN_RF2G4_DB1_4, AR9285_AN_RF2G4_DB1_4_S, db1[4]);
+               DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
+                       "    SEL-Min ctlMode %d pCtlMode %d "
+                       "2xMaxEdge %d sP %d minCtlPwr %d\n",
+                       ctlMode, pCtlMode[ctlMode], twiceMaxEdgePower,
+                       scaledPower, minCtlPower);
 
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
-                       AR9285_AN_RF2G4_DB2_0, AR9285_AN_RF2G4_DB2_0_S, db2[0]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
-                       AR9285_AN_RF2G4_DB2_1, AR9285_AN_RF2G4_DB2_1_S, db2[1]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
-                       AR9285_AN_RF2G4_DB2_2, AR9285_AN_RF2G4_DB2_2_S, db2[2]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
-                       AR9285_AN_RF2G4_DB2_3, AR9285_AN_RF2G4_DB2_3_S, db2[3]);
-       ath9k_hw_analog_shift_rmw(ah, AR9285_AN_RF2G4,
-                       AR9285_AN_RF2G4_DB2_4, AR9285_AN_RF2G4_DB2_4_S, db2[4]);
+               switch (pCtlMode[ctlMode]) {
+               case CTL_11B:
+                       for (i = 0; i < ARRAY_SIZE(targetPowerCck.tPow2x); i++) {
+                               targetPowerCck.tPow2x[i] =
+                                       min((u16)targetPowerCck.tPow2x[i],
+                                           minCtlPower);
+                       }
+                       break;
+               case CTL_11A:
+               case CTL_11G:
+                       for (i = 0; i < ARRAY_SIZE(targetPowerOfdm.tPow2x); i++) {
+                               targetPowerOfdm.tPow2x[i] =
+                                       min((u16)targetPowerOfdm.tPow2x[i],
+                                           minCtlPower);
+                       }
+                       break;
+               case CTL_5GHT20:
+               case CTL_2GHT20:
+                       for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++) {
+                               targetPowerHt20.tPow2x[i] =
+                                       min((u16)targetPowerHt20.tPow2x[i],
+                                           minCtlPower);
+                       }
+                       break;
+               case CTL_11B_EXT:
+                       targetPowerCckExt.tPow2x[0] = min((u16)
+                                       targetPowerCckExt.tPow2x[0],
+                                       minCtlPower);
+                       break;
+               case CTL_11A_EXT:
+               case CTL_11G_EXT:
+                       targetPowerOfdmExt.tPow2x[0] = min((u16)
+                                       targetPowerOfdmExt.tPow2x[0],
+                                       minCtlPower);
+                       break;
+               case CTL_5GHT40:
+               case CTL_2GHT40:
+                       for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
+                               targetPowerHt40.tPow2x[i] =
+                                       min((u16)targetPowerHt40.tPow2x[i],
+                                           minCtlPower);
+                       }
+                       break;
+               default:
+                       break;
+               }
+       }
 
+       ratesArray[rate6mb] = ratesArray[rate9mb] = ratesArray[rate12mb] =
+               ratesArray[rate18mb] = ratesArray[rate24mb] =
+               targetPowerOfdm.tPow2x[0];
+       ratesArray[rate36mb] = targetPowerOfdm.tPow2x[1];
+       ratesArray[rate48mb] = targetPowerOfdm.tPow2x[2];
+       ratesArray[rate54mb] = targetPowerOfdm.tPow2x[3];
+       ratesArray[rateXr] = targetPowerOfdm.tPow2x[0];
 
-       if (AR_SREV_9285_11(ah))
-               REG_WRITE(ah, AR9285_AN_TOP4, AR9285_AN_TOP4_DEFAULT);
+       for (i = 0; i < ARRAY_SIZE(targetPowerHt20.tPow2x); i++)
+               ratesArray[rateHt20_0 + i] = targetPowerHt20.tPow2x[i];
 
-       REG_RMW_FIELD(ah, AR_PHY_SETTLING, AR_PHY_SETTLING_SWITCH,
-                     pModal->switchSettling);
-       REG_RMW_FIELD(ah, AR_PHY_DESIRED_SZ, AR_PHY_DESIRED_SZ_ADC,
-                     pModal->adcDesiredSize);
+       if (IS_CHAN_2GHZ(chan)) {
+               ratesArray[rate1l] = targetPowerCck.tPow2x[0];
+               ratesArray[rate2s] = ratesArray[rate2l] =
+                       targetPowerCck.tPow2x[1];
+               ratesArray[rate5_5s] = ratesArray[rate5_5l] =
+                       targetPowerCck.tPow2x[2];
+               ;
+               ratesArray[rate11s] = ratesArray[rate11l] =
+                       targetPowerCck.tPow2x[3];
+               ;
+       }
+       if (IS_CHAN_HT40(chan)) {
+               for (i = 0; i < ARRAY_SIZE(targetPowerHt40.tPow2x); i++) {
+                       ratesArray[rateHt40_0 + i] =
+                               targetPowerHt40.tPow2x[i];
+               }
+               ratesArray[rateDupOfdm] = targetPowerHt40.tPow2x[0];
+               ratesArray[rateDupCck] = targetPowerHt40.tPow2x[0];
+               ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0];
+               if (IS_CHAN_2GHZ(chan)) {
+                       ratesArray[rateExtCck] =
+                               targetPowerCckExt.tPow2x[0];
+               }
+       }
+       return true;
+}
 
-       REG_WRITE(ah, AR_PHY_RF_CTL4,
-                 SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAA_OFF) |
-                 SM(pModal->txEndToXpaOff, AR_PHY_RF_CTL4_TX_END_XPAB_OFF) |
-                 SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAA_ON)  |
-                 SM(pModal->txFrameToXpaOn, AR_PHY_RF_CTL4_FRAME_XPAB_ON));
+static int ath9k_hw_def_set_txpower(struct ath_hw *ah,
+                                   struct ath9k_channel *chan,
+                                   u16 cfgCtl,
+                                   u8 twiceAntennaReduction,
+                                   u8 twiceMaxRegulatoryPower,
+                                   u8 powerLimit)
+{
+       struct ar5416_eeprom_def *pEepData = &ah->eeprom.def;
+       struct modal_eep_header *pModal =
+               &(pEepData->modalHeader[IS_CHAN_2GHZ(chan)]);
+       int16_t ratesArray[Ar5416RateSize];
+       int16_t txPowerIndexOffset = 0;
+       u8 ht40PowerIncForPdadc = 2;
+       int i;
 
-       REG_RMW_FIELD(ah, AR_PHY_RF_CTL3, AR_PHY_TX_END_TO_A2_RX_ON,
-                     pModal->txEndToRxOn);
-       REG_RMW_FIELD(ah, AR_PHY_CCA, AR9280_PHY_CCA_THRESH62,
-                     pModal->thresh62);
-       REG_RMW_FIELD(ah, AR_PHY_EXT_CCA0, AR_PHY_EXT_CCA0_THRESH62,
-                     pModal->thresh62);
+       memset(ratesArray, 0, sizeof(ratesArray));
 
-       if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
-                                               AR5416_EEP_MINOR_VER_2) {
-               REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_DATA_START,
-                             pModal->txFrameToDataStart);
-               REG_RMW_FIELD(ah, AR_PHY_RF_CTL2, AR_PHY_TX_END_PA_ON,
-                             pModal->txFrameToPaOn);
+       if ((pEepData->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
+           AR5416_EEP_MINOR_VER_2) {
+               ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc;
        }
 
-       if ((eep->baseEepHeader.version & AR5416_EEP_VER_MINOR_MASK) >=
-                                               AR5416_EEP_MINOR_VER_3) {
-               if (IS_CHAN_HT40(chan))
-                       REG_RMW_FIELD(ah, AR_PHY_SETTLING,
-                                     AR_PHY_SETTLING_SWITCH,
-                                     pModal->swSettleHt40);
+       if (!ath9k_hw_set_def_power_per_rate_table(ah, chan,
+                                              &ratesArray[0], cfgCtl,
+                                              twiceAntennaReduction,
+                                              twiceMaxRegulatoryPower,
+                                              powerLimit)) {
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                       "ath9k_hw_set_txpower: unable to set "
+                       "tx power per rate table\n");
+               return -EIO;
        }
 
-       return true;
-}
-
-static bool (*ath9k_eeprom_set_board_values[])(struct ath_hal *,
-                                              struct ath9k_channel *) = {
-       ath9k_hw_eeprom_set_def_board_values,
-       ath9k_hw_eeprom_set_4k_board_values
-};
+       if (!ath9k_hw_set_def_power_cal_table(ah, chan, &txPowerIndexOffset)) {
+               DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
+                        "ath9k_hw_set_txpower: unable to set power table\n");
+               return -EIO;
+       }
 
-bool ath9k_hw_eeprom_set_board_values(struct ath_hal *ah,
-                                     struct ath9k_channel *chan)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       for (i = 0; i < ARRAY_SIZE(ratesArray); i++) {
+               ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]);
+               if (ratesArray[i] > AR5416_MAX_RATE_POWER)
+                       ratesArray[i] = AR5416_MAX_RATE_POWER;
+       }
 
-       return ath9k_eeprom_set_board_values[ahp->ah_eep_map](ah, chan);
-}
+       if (AR_SREV_9280_10_OR_LATER(ah)) {
+               for (i = 0; i < Ar5416RateSize; i++)
+                       ratesArray[i] -= AR5416_PWR_TABLE_OFFSET * 2;
+       }
 
-static int ath9k_hw_get_def_eeprom_antenna_cfg(struct ath_hal *ah,
-                                   struct ath9k_channel *chan,
-                                   u8 index, u16 *config)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def;
-       struct modal_eep_header *pModal =
-               &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
-       struct base_eep_header *pBase = &eep->baseEepHeader;
+       REG_WRITE(ah, AR_PHY_POWER_TX_RATE1,
+                 ATH9K_POW_SM(ratesArray[rate18mb], 24)
+                 | ATH9K_POW_SM(ratesArray[rate12mb], 16)
+                 | ATH9K_POW_SM(ratesArray[rate9mb], 8)
+                 | ATH9K_POW_SM(ratesArray[rate6mb], 0));
+       REG_WRITE(ah, AR_PHY_POWER_TX_RATE2,
+                 ATH9K_POW_SM(ratesArray[rate54mb], 24)
+                 | ATH9K_POW_SM(ratesArray[rate48mb], 16)
+                 | ATH9K_POW_SM(ratesArray[rate36mb], 8)
+                 | ATH9K_POW_SM(ratesArray[rate24mb], 0));
 
-       switch (index) {
-       case 0:
-               *config = pModal->antCtrlCommon & 0xFFFF;
-               return 0;
-       case 1:
-               if (pBase->version >= 0x0E0D) {
-                       if (pModal->useAnt1) {
-                               *config =
-                               ((pModal->antCtrlCommon & 0xFFFF0000) >> 16);
-                               return 0;
-                       }
-               }
-               break;
-       default:
-               break;
+       if (IS_CHAN_2GHZ(chan)) {
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE3,
+                         ATH9K_POW_SM(ratesArray[rate2s], 24)
+                         | ATH9K_POW_SM(ratesArray[rate2l], 16)
+                         | ATH9K_POW_SM(ratesArray[rateXr], 8)
+                         | ATH9K_POW_SM(ratesArray[rate1l], 0));
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE4,
+                         ATH9K_POW_SM(ratesArray[rate11s], 24)
+                         | ATH9K_POW_SM(ratesArray[rate11l], 16)
+                         | ATH9K_POW_SM(ratesArray[rate5_5s], 8)
+                         | ATH9K_POW_SM(ratesArray[rate5_5l], 0));
        }
 
-       return -EINVAL;
-}
+       REG_WRITE(ah, AR_PHY_POWER_TX_RATE5,
+                 ATH9K_POW_SM(ratesArray[rateHt20_3], 24)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_2], 16)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_1], 8)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_0], 0));
+       REG_WRITE(ah, AR_PHY_POWER_TX_RATE6,
+                 ATH9K_POW_SM(ratesArray[rateHt20_7], 24)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_6], 16)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_5], 8)
+                 | ATH9K_POW_SM(ratesArray[rateHt20_4], 0));
 
-static int ath9k_hw_get_4k_eeprom_antenna_cfg(struct ath_hal *ah,
-                                   struct ath9k_channel *chan,
-                                   u8 index, u16 *config)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k;
-       struct modal_eep_4k_header *pModal = &eep->modalHeader;
+       if (IS_CHAN_HT40(chan)) {
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE7,
+                         ATH9K_POW_SM(ratesArray[rateHt40_3] +
+                                      ht40PowerIncForPdadc, 24)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_2] +
+                                        ht40PowerIncForPdadc, 16)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_1] +
+                                        ht40PowerIncForPdadc, 8)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_0] +
+                                        ht40PowerIncForPdadc, 0));
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE8,
+                         ATH9K_POW_SM(ratesArray[rateHt40_7] +
+                                      ht40PowerIncForPdadc, 24)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_6] +
+                                        ht40PowerIncForPdadc, 16)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_5] +
+                                        ht40PowerIncForPdadc, 8)
+                         | ATH9K_POW_SM(ratesArray[rateHt40_4] +
+                                        ht40PowerIncForPdadc, 0));
 
-       switch (index) {
-       case 0:
-               *config = pModal->antCtrlCommon & 0xFFFF;
-               return 0;
-       default:
-               break;
+               REG_WRITE(ah, AR_PHY_POWER_TX_RATE9,
+                         ATH9K_POW_SM(ratesArray[rateExtOfdm], 24)
+                         | ATH9K_POW_SM(ratesArray[rateExtCck], 16)
+                         | ATH9K_POW_SM(ratesArray[rateDupOfdm], 8)
+                         | ATH9K_POW_SM(ratesArray[rateDupCck], 0));
        }
 
-       return -EINVAL;
-}
+       REG_WRITE(ah, AR_PHY_POWER_TX_SUB,
+                 ATH9K_POW_SM(pModal->pwrDecreaseFor3Chain, 6)
+                 | ATH9K_POW_SM(pModal->pwrDecreaseFor2Chain, 0));
 
-static int (*ath9k_get_eeprom_antenna_cfg[])(struct ath_hal *,
-                                            struct ath9k_channel *,
-                                            u8, u16 *) = {
-       ath9k_hw_get_def_eeprom_antenna_cfg,
-       ath9k_hw_get_4k_eeprom_antenna_cfg
-};
+       i = rate6mb;
 
-int ath9k_hw_get_eeprom_antenna_cfg(struct ath_hal *ah,
-                                   struct ath9k_channel *chan,
-                                   u8 index, u16 *config)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       if (IS_CHAN_HT40(chan))
+               i = rateHt40_0;
+       else if (IS_CHAN_HT20(chan))
+               i = rateHt20_0;
 
-       return ath9k_get_eeprom_antenna_cfg[ahp->ah_eep_map](ah, chan,
-                                                            index, config);
-}
+       if (AR_SREV_9280_10_OR_LATER(ah))
+               ah->regulatory.max_power_level =
+                       ratesArray[i] + AR5416_PWR_TABLE_OFFSET * 2;
+       else
+               ah->regulatory.max_power_level = ratesArray[i];
 
-static u8 ath9k_hw_get_4k_num_ant_config(struct ath_hal *ah,
-                                        enum ieee80211_band freq_band)
-{
-       return 1;
+       return 0;
 }
 
-static u8 ath9k_hw_get_def_num_ant_config(struct ath_hal *ah,
+static u8 ath9k_hw_def_get_num_ant_config(struct ath_hw *ah,
                                          enum ieee80211_band freq_band)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def;
+       struct ar5416_eeprom_def *eep = &ah->eeprom.def;
        struct modal_eep_header *pModal =
                &(eep->modalHeader[ATH9K_HAL_FREQ_BAND_2GHZ == freq_band]);
        struct base_eep_header *pBase = &eep->baseEepHeader;
@@ -2645,180 +2636,75 @@ static u8 ath9k_hw_get_def_num_ant_config(struct ath_hal *ah,
        return num_ant_config;
 }
 
-static u8 (*ath9k_get_num_ant_config[])(struct ath_hal *,
-                                       enum ieee80211_band) = {
-       ath9k_hw_get_def_num_ant_config,
-       ath9k_hw_get_4k_num_ant_config
-};
-
-u8 ath9k_hw_get_num_ant_config(struct ath_hal *ah,
-                              enum ieee80211_band freq_band)
+static u16 ath9k_hw_def_get_eeprom_antenna_cfg(struct ath_hw *ah,
+                                              struct ath9k_channel *chan)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       struct ar5416_eeprom_def *eep = &ah->eeprom.def;
+       struct modal_eep_header *pModal =
+               &(eep->modalHeader[IS_CHAN_2GHZ(chan)]);
 
-       return ath9k_get_num_ant_config[ahp->ah_eep_map](ah, freq_band);
+       return pModal->antCtrlCommon & 0xFFFF;
 }
 
-u16 ath9k_hw_eeprom_get_spur_chan(struct ath_hal *ah, u16 i, bool is2GHz)
+static u16 ath9k_hw_def_get_spur_channel(struct ath_hw *ah, u16 i, bool is2GHz)
 {
-#define EEP_MAP4K_SPURCHAN \
-       (ahp->ah_eeprom.map4k.modalHeader.spurChans[i].spurChan)
 #define EEP_DEF_SPURCHAN \
-       (ahp->ah_eeprom.def.modalHeader[is2GHz].spurChans[i].spurChan)
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       (ah->eeprom.def.modalHeader[is2GHz].spurChans[i].spurChan)
+
        u16 spur_val = AR_NO_SPUR;
 
        DPRINTF(ah->ah_sc, ATH_DBG_ANI,
                "Getting spur idx %d is2Ghz. %d val %x\n",
-               i, is2GHz, ah->ah_config.spurchans[i][is2GHz]);
+               i, is2GHz, ah->config.spurchans[i][is2GHz]);
 
-       switch (ah->ah_config.spurmode) {
+       switch (ah->config.spurmode) {
        case SPUR_DISABLE:
                break;
        case SPUR_ENABLE_IOCTL:
-               spur_val = ah->ah_config.spurchans[i][is2GHz];
+               spur_val = ah->config.spurchans[i][is2GHz];
                DPRINTF(ah->ah_sc, ATH_DBG_ANI,
                        "Getting spur val from new loc. %d\n", spur_val);
                break;
        case SPUR_ENABLE_EEPROM:
-               if (ahp->ah_eep_map == EEP_MAP_4KBITS)
-                       spur_val = EEP_MAP4K_SPURCHAN;
-               else
-                       spur_val = EEP_DEF_SPURCHAN;
+               spur_val = EEP_DEF_SPURCHAN;
                break;
-
        }
 
        return spur_val;
-#undef EEP_DEF_SPURCHAN
-#undef EEP_MAP4K_SPURCHAN
-}
-
-static u32 ath9k_hw_get_eeprom_4k(struct ath_hal *ah,
-                                 enum eeprom_param param)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_4k *eep = &ahp->ah_eeprom.map4k;
-       struct modal_eep_4k_header *pModal = &eep->modalHeader;
-       struct base_eep_header_4k *pBase = &eep->baseEepHeader;
-
-       switch (param) {
-       case EEP_NFTHRESH_2:
-               return pModal[1].noiseFloorThreshCh[0];
-       case AR_EEPROM_MAC(0):
-               return pBase->macAddr[0] << 8 | pBase->macAddr[1];
-       case AR_EEPROM_MAC(1):
-               return pBase->macAddr[2] << 8 | pBase->macAddr[3];
-       case AR_EEPROM_MAC(2):
-               return pBase->macAddr[4] << 8 | pBase->macAddr[5];
-       case EEP_REG_0:
-               return pBase->regDmn[0];
-       case EEP_REG_1:
-               return pBase->regDmn[1];
-       case EEP_OP_CAP:
-               return pBase->deviceCap;
-       case EEP_OP_MODE:
-               return pBase->opCapFlags;
-       case EEP_RF_SILENT:
-               return pBase->rfSilent;
-       case EEP_OB_2:
-               return pModal->ob_01;
-       case EEP_DB_2:
-               return pModal->db1_01;
-       case EEP_MINOR_REV:
-               return pBase->version & AR5416_EEP_VER_MINOR_MASK;
-       case EEP_TX_MASK:
-               return pBase->txMask;
-       case EEP_RX_MASK:
-               return pBase->rxMask;
-       default:
-               return 0;
-       }
-}
-
-static u32 ath9k_hw_get_eeprom_def(struct ath_hal *ah,
-                                  enum eeprom_param param)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ar5416_eeprom_def *eep = &ahp->ah_eeprom.def;
-       struct modal_eep_header *pModal = eep->modalHeader;
-       struct base_eep_header *pBase = &eep->baseEepHeader;
-
-       switch (param) {
-       case EEP_NFTHRESH_5:
-               return pModal[0].noiseFloorThreshCh[0];
-       case EEP_NFTHRESH_2:
-               return pModal[1].noiseFloorThreshCh[0];
-       case AR_EEPROM_MAC(0):
-               return pBase->macAddr[0] << 8 | pBase->macAddr[1];
-       case AR_EEPROM_MAC(1):
-               return pBase->macAddr[2] << 8 | pBase->macAddr[3];
-       case AR_EEPROM_MAC(2):
-               return pBase->macAddr[4] << 8 | pBase->macAddr[5];
-       case EEP_REG_0:
-               return pBase->regDmn[0];
-       case EEP_REG_1:
-               return pBase->regDmn[1];
-       case EEP_OP_CAP:
-               return pBase->deviceCap;
-       case EEP_OP_MODE:
-               return pBase->opCapFlags;
-       case EEP_RF_SILENT:
-               return pBase->rfSilent;
-       case EEP_OB_5:
-               return pModal[0].ob;
-       case EEP_DB_5:
-               return pModal[0].db;
-       case EEP_OB_2:
-               return pModal[1].ob;
-       case EEP_DB_2:
-               return pModal[1].db;
-       case EEP_MINOR_REV:
-               return pBase->version & AR5416_EEP_VER_MINOR_MASK;
-       case EEP_TX_MASK:
-               return pBase->txMask;
-       case EEP_RX_MASK:
-               return pBase->rxMask;
-       case EEP_RXGAIN_TYPE:
-               return pBase->rxGainType;
-       case EEP_TXGAIN_TYPE:
-               return pBase->txGainType;
 
-       default:
-               return 0;
-       }
+#undef EEP_DEF_SPURCHAN
 }
 
-static u32 (*ath9k_get_eeprom[])(struct ath_hal *, enum eeprom_param) = {
-       ath9k_hw_get_eeprom_def,
-       ath9k_hw_get_eeprom_4k
+static struct eeprom_ops eep_def_ops = {
+       .check_eeprom           = ath9k_hw_def_check_eeprom,
+       .get_eeprom             = ath9k_hw_def_get_eeprom,
+       .fill_eeprom            = ath9k_hw_def_fill_eeprom,
+       .get_eeprom_ver         = ath9k_hw_def_get_eeprom_ver,
+       .get_eeprom_rev         = ath9k_hw_def_get_eeprom_rev,
+       .get_num_ant_config     = ath9k_hw_def_get_num_ant_config,
+       .get_eeprom_antenna_cfg = ath9k_hw_def_get_eeprom_antenna_cfg,
+       .set_board_values       = ath9k_hw_def_set_board_values,
+       .set_addac              = ath9k_hw_def_set_addac,
+       .set_txpower            = ath9k_hw_def_set_txpower,
+       .get_spur_channel       = ath9k_hw_def_get_spur_channel
 };
 
-u32 ath9k_hw_get_eeprom(struct ath_hal *ah,
-                       enum eeprom_param param)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       return ath9k_get_eeprom[ahp->ah_eep_map](ah, param);
-}
-
-int ath9k_hw_eeprom_attach(struct ath_hal *ah)
+int ath9k_hw_eeprom_attach(struct ath_hw *ah)
 {
        int status;
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
-       if (ath9k_hw_use_flash(ah))
-               ath9k_hw_flash_map(ah);
-
-       if (AR_SREV_9285(ah))
-               ahp->ah_eep_map = EEP_MAP_4KBITS;
-       else
-               ahp->ah_eep_map = EEP_MAP_DEFAULT;
+       if (AR_SREV_9285(ah)) {
+               ah->eep_map = EEP_MAP_4KBITS;
+               ah->eep_ops = &eep_4k_ops;
+       } else {
+               ah->eep_map = EEP_MAP_DEFAULT;
+               ah->eep_ops = &eep_def_ops;
+       }
 
-       if (!ath9k_hw_fill_eeprom(ah))
+       if (!ah->eep_ops->fill_eeprom(ah))
                return -EIO;
 
-       status = ath9k_hw_check_eeprom(ah);
+       status = ah->eep_ops->check_eeprom(ah);
 
        return status;
 }
diff --git a/drivers/net/wireless/ath9k/eeprom.h b/drivers/net/wireless/ath9k/eeprom.h
new file mode 100644 (file)
index 0000000..99863b5
--- /dev/null
@@ -0,0 +1,473 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef EEPROM_H
+#define EEPROM_H
+
+#define AH_USE_EEPROM   0x1
+
+#ifdef __BIG_ENDIAN
+#define AR5416_EEPROM_MAGIC 0x5aa5
+#else
+#define AR5416_EEPROM_MAGIC 0xa55a
+#endif
+
+#define CTRY_DEBUG   0x1ff
+#define        CTRY_DEFAULT 0
+
+#define AR_EEPROM_EEPCAP_COMPRESS_DIS   0x0001
+#define AR_EEPROM_EEPCAP_AES_DIS        0x0002
+#define AR_EEPROM_EEPCAP_FASTFRAME_DIS  0x0004
+#define AR_EEPROM_EEPCAP_BURST_DIS      0x0008
+#define AR_EEPROM_EEPCAP_MAXQCU         0x01F0
+#define AR_EEPROM_EEPCAP_MAXQCU_S       4
+#define AR_EEPROM_EEPCAP_HEAVY_CLIP_EN  0x0200
+#define AR_EEPROM_EEPCAP_KC_ENTRIES     0xF000
+#define AR_EEPROM_EEPCAP_KC_ENTRIES_S   12
+
+#define AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND   0x0040
+#define AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN    0x0080
+#define AR_EEPROM_EEREGCAP_EN_KK_U2         0x0100
+#define AR_EEPROM_EEREGCAP_EN_KK_MIDBAND    0x0200
+#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD     0x0400
+#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A    0x0800
+
+#define AR_EEPROM_EEREGCAP_EN_KK_U1_ODD_PRE4_0  0x4000
+#define AR_EEPROM_EEREGCAP_EN_KK_NEW_11A_PRE4_0 0x8000
+
+#define AR5416_EEPROM_MAGIC_OFFSET  0x0
+#define AR5416_EEPROM_S             2
+#define AR5416_EEPROM_OFFSET        0x2000
+#define AR5416_EEPROM_MAX           0xae0
+
+#define AR5416_EEPROM_START_ADDR \
+       (AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200
+
+#define SD_NO_CTL               0xE0
+#define NO_CTL                  0xff
+#define CTL_MODE_M              7
+#define CTL_11A                 0
+#define CTL_11B                 1
+#define CTL_11G                 2
+#define CTL_2GHT20              5
+#define CTL_5GHT20              6
+#define CTL_2GHT40              7
+#define CTL_5GHT40              8
+
+#define EXT_ADDITIVE (0x8000)
+#define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
+#define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
+#define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
+
+#define SUB_NUM_CTL_MODES_AT_5G_40 2
+#define SUB_NUM_CTL_MODES_AT_2G_40 3
+
+#define AR_EEPROM_MAC(i)       (0x1d+(i))
+#define ATH9K_POW_SM(_r, _s)   (((_r) & 0x3f) << (_s))
+#define FREQ2FBIN(x, y)                ((y) ? ((x) - 2300) : (((x) - 4800) / 5))
+#define ath9k_hw_use_flash(_ah)        (!(_ah->ah_flags & AH_USE_EEPROM))
+
+#define AR_EEPROM_RFSILENT_GPIO_SEL     0x001c
+#define AR_EEPROM_RFSILENT_GPIO_SEL_S   2
+#define AR_EEPROM_RFSILENT_POLARITY     0x0002
+#define AR_EEPROM_RFSILENT_POLARITY_S   1
+
+#define EEP_RFSILENT_ENABLED        0x0001
+#define EEP_RFSILENT_ENABLED_S      0
+#define EEP_RFSILENT_POLARITY       0x0002
+#define EEP_RFSILENT_POLARITY_S     1
+#define EEP_RFSILENT_GPIO_SEL       0x001c
+#define EEP_RFSILENT_GPIO_SEL_S     2
+
+#define AR5416_OPFLAGS_11A           0x01
+#define AR5416_OPFLAGS_11G           0x02
+#define AR5416_OPFLAGS_N_5G_HT40     0x04
+#define AR5416_OPFLAGS_N_2G_HT40     0x08
+#define AR5416_OPFLAGS_N_5G_HT20     0x10
+#define AR5416_OPFLAGS_N_2G_HT20     0x20
+
+#define AR5416_EEP_NO_BACK_VER       0x1
+#define AR5416_EEP_VER               0xE
+#define AR5416_EEP_VER_MINOR_MASK    0x0FFF
+#define AR5416_EEP_MINOR_VER_2       0x2
+#define AR5416_EEP_MINOR_VER_3       0x3
+#define AR5416_EEP_MINOR_VER_7       0x7
+#define AR5416_EEP_MINOR_VER_9       0x9
+#define AR5416_EEP_MINOR_VER_16      0x10
+#define AR5416_EEP_MINOR_VER_17      0x11
+#define AR5416_EEP_MINOR_VER_19      0x13
+#define AR5416_EEP_MINOR_VER_20      0x14
+
+#define AR5416_NUM_5G_CAL_PIERS         8
+#define AR5416_NUM_2G_CAL_PIERS         4
+#define AR5416_NUM_5G_20_TARGET_POWERS  8
+#define AR5416_NUM_5G_40_TARGET_POWERS  8
+#define AR5416_NUM_2G_CCK_TARGET_POWERS 3
+#define AR5416_NUM_2G_20_TARGET_POWERS  4
+#define AR5416_NUM_2G_40_TARGET_POWERS  4
+#define AR5416_NUM_CTLS                 24
+#define AR5416_NUM_BAND_EDGES           8
+#define AR5416_NUM_PD_GAINS             4
+#define AR5416_PD_GAINS_IN_MASK         4
+#define AR5416_PD_GAIN_ICEPTS           5
+#define AR5416_EEPROM_MODAL_SPURS       5
+#define AR5416_MAX_RATE_POWER           63
+#define AR5416_NUM_PDADC_VALUES         128
+#define AR5416_BCHAN_UNUSED             0xFF
+#define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64
+#define AR5416_MAX_CHAINS               3
+#define AR5416_PWR_TABLE_OFFSET         -5
+
+/* Rx gain type values */
+#define AR5416_EEP_RXGAIN_23DB_BACKOFF     0
+#define AR5416_EEP_RXGAIN_13DB_BACKOFF     1
+#define AR5416_EEP_RXGAIN_ORIG             2
+
+/* Tx gain type values */
+#define AR5416_EEP_TXGAIN_ORIGINAL         0
+#define AR5416_EEP_TXGAIN_HIGH_POWER       1
+
+#define AR5416_EEP4K_START_LOC                64
+#define AR5416_EEP4K_NUM_2G_CAL_PIERS         3
+#define AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS 3
+#define AR5416_EEP4K_NUM_2G_20_TARGET_POWERS  3
+#define AR5416_EEP4K_NUM_2G_40_TARGET_POWERS  3
+#define AR5416_EEP4K_NUM_CTLS                 12
+#define AR5416_EEP4K_NUM_BAND_EDGES           4
+#define AR5416_EEP4K_NUM_PD_GAINS             2
+#define AR5416_EEP4K_PD_GAINS_IN_MASK         4
+#define AR5416_EEP4K_PD_GAIN_ICEPTS           5
+#define AR5416_EEP4K_MAX_CHAINS               1
+
+enum eeprom_param {
+       EEP_NFTHRESH_5,
+       EEP_NFTHRESH_2,
+       EEP_MAC_MSW,
+       EEP_MAC_MID,
+       EEP_MAC_LSW,
+       EEP_REG_0,
+       EEP_REG_1,
+       EEP_OP_CAP,
+       EEP_OP_MODE,
+       EEP_RF_SILENT,
+       EEP_OB_5,
+       EEP_DB_5,
+       EEP_OB_2,
+       EEP_DB_2,
+       EEP_MINOR_REV,
+       EEP_TX_MASK,
+       EEP_RX_MASK,
+       EEP_RXGAIN_TYPE,
+       EEP_TXGAIN_TYPE,
+       EEP_DAC_HPWR_5G,
+};
+
+enum ar5416_rates {
+       rate6mb, rate9mb, rate12mb, rate18mb,
+       rate24mb, rate36mb, rate48mb, rate54mb,
+       rate1l, rate2l, rate2s, rate5_5l,
+       rate5_5s, rate11l, rate11s, rateXr,
+       rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3,
+       rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7,
+       rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3,
+       rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7,
+       rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm,
+       Ar5416RateSize
+};
+
+enum ath9k_hal_freq_band {
+       ATH9K_HAL_FREQ_BAND_5GHZ = 0,
+       ATH9K_HAL_FREQ_BAND_2GHZ = 1
+};
+
+struct base_eep_header {
+       u16 length;
+       u16 checksum;
+       u16 version;
+       u8 opCapFlags;
+       u8 eepMisc;
+       u16 regDmn[2];
+       u8 macAddr[6];
+       u8 rxMask;
+       u8 txMask;
+       u16 rfSilent;
+       u16 blueToothOptions;
+       u16 deviceCap;
+       u32 binBuildNumber;
+       u8 deviceType;
+       u8 pwdclkind;
+       u8 futureBase_1[2];
+       u8 rxGainType;
+       u8 dacHiPwrMode_5G;
+       u8 futureBase_2;
+       u8 dacLpMode;
+       u8 txGainType;
+       u8 rcChainMask;
+       u8 desiredScaleCCK;
+       u8 futureBase_3[23];
+} __packed;
+
+struct base_eep_header_4k {
+       u16 length;
+       u16 checksum;
+       u16 version;
+       u8 opCapFlags;
+       u8 eepMisc;
+       u16 regDmn[2];
+       u8 macAddr[6];
+       u8 rxMask;
+       u8 txMask;
+       u16 rfSilent;
+       u16 blueToothOptions;
+       u16 deviceCap;
+       u32 binBuildNumber;
+       u8 deviceType;
+       u8 futureBase[1];
+} __packed;
+
+
+struct spur_chan {
+       u16 spurChan;
+       u8 spurRangeLow;
+       u8 spurRangeHigh;
+} __packed;
+
+struct modal_eep_header {
+       u32 antCtrlChain[AR5416_MAX_CHAINS];
+       u32 antCtrlCommon;
+       u8 antennaGainCh[AR5416_MAX_CHAINS];
+       u8 switchSettling;
+       u8 txRxAttenCh[AR5416_MAX_CHAINS];
+       u8 rxTxMarginCh[AR5416_MAX_CHAINS];
+       u8 adcDesiredSize;
+       u8 pgaDesiredSize;
+       u8 xlnaGainCh[AR5416_MAX_CHAINS];
+       u8 txEndToXpaOff;
+       u8 txEndToRxOn;
+       u8 txFrameToXpaOn;
+       u8 thresh62;
+       u8 noiseFloorThreshCh[AR5416_MAX_CHAINS];
+       u8 xpdGain;
+       u8 xpd;
+       u8 iqCalICh[AR5416_MAX_CHAINS];
+       u8 iqCalQCh[AR5416_MAX_CHAINS];
+       u8 pdGainOverlap;
+       u8 ob;
+       u8 db;
+       u8 xpaBiasLvl;
+       u8 pwrDecreaseFor2Chain;
+       u8 pwrDecreaseFor3Chain;
+       u8 txFrameToDataStart;
+       u8 txFrameToPaOn;
+       u8 ht40PowerIncForPdadc;
+       u8 bswAtten[AR5416_MAX_CHAINS];
+       u8 bswMargin[AR5416_MAX_CHAINS];
+       u8 swSettleHt40;
+       u8 xatten2Db[AR5416_MAX_CHAINS];
+       u8 xatten2Margin[AR5416_MAX_CHAINS];
+       u8 ob_ch1;
+       u8 db_ch1;
+       u8 useAnt1:1,
+           force_xpaon:1,
+           local_bias:1,
+           femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
+       u8 miscBits;
+       u16 xpaBiasLvlFreq[3];
+       u8 futureModal[6];
+
+       struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
+} __packed;
+
+struct modal_eep_4k_header {
+       u32  antCtrlChain[AR5416_EEP4K_MAX_CHAINS];
+       u32  antCtrlCommon;
+       u8   antennaGainCh[AR5416_EEP4K_MAX_CHAINS];
+       u8   switchSettling;
+       u8   txRxAttenCh[AR5416_EEP4K_MAX_CHAINS];
+       u8   rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS];
+       u8   adcDesiredSize;
+       u8   pgaDesiredSize;
+       u8   xlnaGainCh[AR5416_EEP4K_MAX_CHAINS];
+       u8   txEndToXpaOff;
+       u8   txEndToRxOn;
+       u8   txFrameToXpaOn;
+       u8   thresh62;
+       u8   noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS];
+       u8   xpdGain;
+       u8   xpd;
+       u8   iqCalICh[AR5416_EEP4K_MAX_CHAINS];
+       u8   iqCalQCh[AR5416_EEP4K_MAX_CHAINS];
+       u8   pdGainOverlap;
+       u8   ob_01;
+       u8   db1_01;
+       u8   xpaBiasLvl;
+       u8   txFrameToDataStart;
+       u8   txFrameToPaOn;
+       u8   ht40PowerIncForPdadc;
+       u8   bswAtten[AR5416_EEP4K_MAX_CHAINS];
+       u8   bswMargin[AR5416_EEP4K_MAX_CHAINS];
+       u8   swSettleHt40;
+       u8   xatten2Db[AR5416_EEP4K_MAX_CHAINS];
+       u8   xatten2Margin[AR5416_EEP4K_MAX_CHAINS];
+       u8   db2_01;
+       u8   version;
+       u16  ob_234;
+       u16  db1_234;
+       u16  db2_234;
+       u8   futureModal[4];
+
+       struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
+} __packed;
+
+
+struct cal_data_per_freq {
+       u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
+       u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
+} __packed;
+
+struct cal_data_per_freq_4k {
+       u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS];
+       u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS];
+} __packed;
+
+struct cal_target_power_leg {
+       u8 bChannel;
+       u8 tPow2x[4];
+} __packed;
+
+struct cal_target_power_ht {
+       u8 bChannel;
+       u8 tPow2x[8];
+} __packed;
+
+
+#ifdef __BIG_ENDIAN_BITFIELD
+struct cal_ctl_edges {
+       u8 bChannel;
+       u8 flag:2, tPower:6;
+} __packed;
+#else
+struct cal_ctl_edges {
+       u8 bChannel;
+       u8 tPower:6, flag:2;
+} __packed;
+#endif
+
+struct cal_ctl_data {
+       struct cal_ctl_edges
+       ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
+} __packed;
+
+struct cal_ctl_data_4k {
+       struct cal_ctl_edges
+       ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES];
+} __packed;
+
+struct ar5416_eeprom_def {
+       struct base_eep_header baseEepHeader;
+       u8 custData[64];
+       struct modal_eep_header modalHeader[2];
+       u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS];
+       u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS];
+       struct cal_data_per_freq
+        calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS];
+       struct cal_data_per_freq
+        calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS];
+       struct cal_target_power_leg
+        calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS];
+       struct cal_target_power_ht
+        calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS];
+       struct cal_target_power_ht
+        calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS];
+       struct cal_target_power_leg
+        calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS];
+       struct cal_target_power_leg
+        calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS];
+       struct cal_target_power_ht
+        calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS];
+       struct cal_target_power_ht
+        calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS];
+       u8 ctlIndex[AR5416_NUM_CTLS];
+       struct cal_ctl_data ctlData[AR5416_NUM_CTLS];
+       u8 padding;
+} __packed;
+
+struct ar5416_eeprom_4k {
+       struct base_eep_header_4k baseEepHeader;
+       u8 custData[20];
+       struct modal_eep_4k_header modalHeader;
+       u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS];
+       struct cal_data_per_freq_4k
+       calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS];
+       struct cal_target_power_leg
+       calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS];
+       struct cal_target_power_leg
+       calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS];
+       struct cal_target_power_ht
+       calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS];
+       struct cal_target_power_ht
+       calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS];
+       u8 ctlIndex[AR5416_EEP4K_NUM_CTLS];
+       struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS];
+       u8 padding;
+} __packed;
+
+enum reg_ext_bitmap {
+       REG_EXT_JAPAN_MIDBAND = 1,
+       REG_EXT_FCC_DFS_HT40 = 2,
+       REG_EXT_JAPAN_NONDFS_HT40 = 3,
+       REG_EXT_JAPAN_DFS_HT40 = 4
+};
+
+struct ath9k_country_entry {
+       u16 countryCode;
+       u16 regDmnEnum;
+       u16 regDmn5G;
+       u16 regDmn2G;
+       u8 isMultidomain;
+       u8 iso[3];
+};
+
+enum ath9k_eep_map {
+       EEP_MAP_DEFAULT = 0x0,
+       EEP_MAP_4KBITS,
+       EEP_MAP_MAX
+};
+
+struct eeprom_ops {
+       int (*check_eeprom)(struct ath_hw *hw);
+       u32 (*get_eeprom)(struct ath_hw *hw, enum eeprom_param param);
+       bool (*fill_eeprom)(struct ath_hw *hw);
+       int (*get_eeprom_ver)(struct ath_hw *hw);
+       int (*get_eeprom_rev)(struct ath_hw *hw);
+       u8 (*get_num_ant_config)(struct ath_hw *hw, enum ieee80211_band band);
+       u16 (*get_eeprom_antenna_cfg)(struct ath_hw *hw,
+                                     struct ath9k_channel *chan);
+       bool (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan);
+       void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan);
+       int (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan,
+                          u16 cfgCtl, u8 twiceAntennaReduction,
+                          u8 twiceMaxRegulatoryPower, u8 powerLimit);
+       u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz);
+};
+
+#define ar5416_get_ntxchains(_txchainmask)                     \
+       (((_txchainmask >> 2) & 1) +                            \
+        ((_txchainmask >> 1) & 1) + (_txchainmask & 1))
+
+int ath9k_hw_eeprom_attach(struct ath_hw *ah);
+
+#endif /* EEPROM_H */
index 34474edefc97ee4ff472be082d15ebbcad7c9a20..cad8e39c201eb6d3f3360b605ac0d100753363f6 100644 (file)
 #include <linux/io.h>
 #include <asm/unaligned.h>
 
-#include "core.h"
-#include "hw.h"
-#include "reg.h"
-#include "phy.h"
+#include "ath9k.h"
 #include "initvals.h"
 
-static const u8 CLOCK_RATE[] = { 40, 80, 22, 44, 88, 40 };
+static int btcoex_enable;
+module_param(btcoex_enable, bool, 0);
+MODULE_PARM_DESC(btcoex_enable, "Enable Bluetooth coexistence support");
 
-extern struct hal_percal_data iq_cal_multi_sample;
-extern struct hal_percal_data iq_cal_single_sample;
-extern struct hal_percal_data adc_gain_cal_multi_sample;
-extern struct hal_percal_data adc_gain_cal_single_sample;
-extern struct hal_percal_data adc_dc_cal_multi_sample;
-extern struct hal_percal_data adc_dc_cal_single_sample;
-extern struct hal_percal_data adc_init_dc_cal;
+#define ATH9K_CLOCK_RATE_CCK           22
+#define ATH9K_CLOCK_RATE_5GHZ_OFDM     40
+#define ATH9K_CLOCK_RATE_2GHZ_OFDM     44
 
-static bool ath9k_hw_set_reset_reg(struct ath_hal *ah, u32 type);
-static void ath9k_hw_set_regs(struct ath_hal *ah, struct ath9k_channel *chan,
+static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type);
+static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan,
                              enum ath9k_ht_macmode macmode);
-static u32 ath9k_hw_ini_fixup(struct ath_hal *ah,
+static u32 ath9k_hw_ini_fixup(struct ath_hw *ah,
                              struct ar5416_eeprom_def *pEepData,
                              u32 reg, u32 value);
-static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *chan);
-static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *chan);
+static void ath9k_hw_9280_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan);
+static void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan);
 
 /********************/
 /* Helper Functions */
 /********************/
 
-static u32 ath9k_hw_mac_usec(struct ath_hal *ah, u32 clks)
+static u32 ath9k_hw_mac_usec(struct ath_hw *ah, u32 clks)
 {
-       if (ah->ah_curchan != NULL)
-               return clks / CLOCK_RATE[ath9k_hw_chan2wmode(ah, ah->ah_curchan)];
-       else
-               return clks / CLOCK_RATE[ATH9K_MODE_11B];
+       struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
+
+       if (!ah->curchan) /* should really check for CCK instead */
+               return clks / ATH9K_CLOCK_RATE_CCK;
+       if (conf->channel->band == IEEE80211_BAND_2GHZ)
+               return clks / ATH9K_CLOCK_RATE_2GHZ_OFDM;
+
+       return clks / ATH9K_CLOCK_RATE_5GHZ_OFDM;
 }
 
-static u32 ath9k_hw_mac_to_usec(struct ath_hal *ah, u32 clks)
+static u32 ath9k_hw_mac_to_usec(struct ath_hw *ah, u32 clks)
 {
-       struct ath9k_channel *chan = ah->ah_curchan;
+       struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
 
-       if (chan && IS_CHAN_HT40(chan))
+       if (conf_is_ht40(conf))
                return ath9k_hw_mac_usec(ah, clks) / 2;
        else
                return ath9k_hw_mac_usec(ah, clks);
 }
 
-static u32 ath9k_hw_mac_clks(struct ath_hal *ah, u32 usecs)
+static u32 ath9k_hw_mac_clks(struct ath_hw *ah, u32 usecs)
 {
-       if (ah->ah_curchan != NULL)
-               return usecs * CLOCK_RATE[ath9k_hw_chan2wmode(ah,
-                       ah->ah_curchan)];
-       else
-               return usecs * CLOCK_RATE[ATH9K_MODE_11B];
+       struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
+
+       if (!ah->curchan) /* should really check for CCK instead */
+               return usecs *ATH9K_CLOCK_RATE_CCK;
+       if (conf->channel->band == IEEE80211_BAND_2GHZ)
+               return usecs *ATH9K_CLOCK_RATE_2GHZ_OFDM;
+       return usecs *ATH9K_CLOCK_RATE_5GHZ_OFDM;
 }
 
-static u32 ath9k_hw_mac_to_clks(struct ath_hal *ah, u32 usecs)
+static u32 ath9k_hw_mac_to_clks(struct ath_hw *ah, u32 usecs)
 {
-       struct ath9k_channel *chan = ah->ah_curchan;
+       struct ieee80211_conf *conf = &ah->ah_sc->hw->conf;
 
-       if (chan && IS_CHAN_HT40(chan))
+       if (conf_is_ht40(conf))
                return ath9k_hw_mac_clks(ah, usecs) * 2;
        else
                return ath9k_hw_mac_clks(ah, usecs);
 }
 
-enum wireless_mode ath9k_hw_chan2wmode(struct ath_hal *ah,
-                              const struct ath9k_channel *chan)
-{
-       if (IS_CHAN_B(chan))
-               return ATH9K_MODE_11B;
-       if (IS_CHAN_G(chan))
-               return ATH9K_MODE_11G;
-
-       return ATH9K_MODE_11A;
-}
-
-bool ath9k_hw_wait(struct ath_hal *ah, u32 reg, u32 mask, u32 val)
+bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val)
 {
        int i;
 
@@ -124,11 +114,11 @@ u32 ath9k_hw_reverse_bits(u32 val, u32 n)
        return retval;
 }
 
-bool ath9k_get_channel_edges(struct ath_hal *ah,
+bool ath9k_get_channel_edges(struct ath_hw *ah,
                             u16 flags, u16 *low,
                             u16 *high)
 {
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
 
        if (flags & CHANNEL_5GHZ) {
                *low = pCap->low_5ghz_chan;
@@ -143,7 +133,7 @@ bool ath9k_get_channel_edges(struct ath_hal *ah,
        return false;
 }
 
-u16 ath9k_hw_computetxtime(struct ath_hal *ah,
+u16 ath9k_hw_computetxtime(struct ath_hw *ah,
                           struct ath_rate_table *rates,
                           u32 frameLen, u16 rateix,
                           bool shortPreamble)
@@ -165,15 +155,15 @@ u16 ath9k_hw_computetxtime(struct ath_hal *ah,
                txTime = CCK_SIFS_TIME + phyTime + ((numBits * 1000) / kbps);
                break;
        case WLAN_RC_PHY_OFDM:
-               if (ah->ah_curchan && IS_CHAN_QUARTER_RATE(ah->ah_curchan)) {
+               if (ah->curchan && IS_CHAN_QUARTER_RATE(ah->curchan)) {
                        bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_QUARTER) / 1000;
                        numBits = OFDM_PLCP_BITS + (frameLen << 3);
                        numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol);
                        txTime = OFDM_SIFS_TIME_QUARTER
                                + OFDM_PREAMBLE_TIME_QUARTER
                                + (numSymbols * OFDM_SYMBOL_TIME_QUARTER);
-               } else if (ah->ah_curchan &&
-                          IS_CHAN_HALF_RATE(ah->ah_curchan)) {
+               } else if (ah->curchan &&
+                          IS_CHAN_HALF_RATE(ah->curchan)) {
                        bitsPerSymbol = (kbps * OFDM_SYMBOL_TIME_HALF) / 1000;
                        numBits = OFDM_PLCP_BITS + (frameLen << 3);
                        numSymbols = DIV_ROUND_UP(numBits, bitsPerSymbol);
@@ -199,52 +189,11 @@ u16 ath9k_hw_computetxtime(struct ath_hal *ah,
        return txTime;
 }
 
-u32 ath9k_hw_mhz2ieee(struct ath_hal *ah, u32 freq, u32 flags)
-{
-       if (flags & CHANNEL_2GHZ) {
-               if (freq == 2484)
-                       return 14;
-               if (freq < 2484)
-                       return (freq - 2407) / 5;
-               else
-                       return 15 + ((freq - 2512) / 20);
-       } else if (flags & CHANNEL_5GHZ) {
-               if (ath9k_regd_is_public_safety_sku(ah) &&
-                   IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) {
-                       return ((freq * 10) +
-                               (((freq % 5) == 2) ? 5 : 0) - 49400) / 5;
-               } else if ((flags & CHANNEL_A) && (freq <= 5000)) {
-                       return (freq - 4000) / 5;
-               } else {
-                       return (freq - 5000) / 5;
-               }
-       } else {
-               if (freq == 2484)
-                       return 14;
-               if (freq < 2484)
-                       return (freq - 2407) / 5;
-               if (freq < 5000) {
-                       if (ath9k_regd_is_public_safety_sku(ah)
-                           && IS_CHAN_IN_PUBLIC_SAFETY_BAND(freq)) {
-                               return ((freq * 10) +
-                                       (((freq % 5) ==
-                                         2) ? 5 : 0) - 49400) / 5;
-                       } else if (freq > 4900) {
-                               return (freq - 4000) / 5;
-                       } else {
-                               return 15 + ((freq - 2512) / 20);
-                       }
-               }
-               return (freq - 5000) / 5;
-       }
-}
-
-void ath9k_hw_get_channel_centers(struct ath_hal *ah,
+void ath9k_hw_get_channel_centers(struct ath_hw *ah,
                                  struct ath9k_channel *chan,
                                  struct chan_centers *centers)
 {
        int8_t extoff;
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
        if (!IS_CHAN_HT40(chan)) {
                centers->ctl_center = centers->ext_center =
@@ -267,16 +216,15 @@ void ath9k_hw_get_channel_centers(struct ath_hal *ah,
                centers->synth_center - (extoff * HT40_CHANNEL_CENTER_SHIFT);
        centers->ext_center =
                centers->synth_center + (extoff *
-                        ((ahp->ah_extprotspacing == ATH9K_HT_EXTPROTSPACING_20) ?
+                        ((ah->extprotspacing == ATH9K_HT_EXTPROTSPACING_20) ?
                          HT40_CHANNEL_CENTER_SHIFT : 15));
-
 }
 
 /******************/
 /* Chip Revisions */
 /******************/
 
-static void ath9k_hw_read_revisions(struct ath_hal *ah)
+static void ath9k_hw_read_revisions(struct ath_hw *ah)
 {
        u32 val;
 
@@ -284,21 +232,22 @@ static void ath9k_hw_read_revisions(struct ath_hal *ah)
 
        if (val == 0xFF) {
                val = REG_READ(ah, AR_SREV);
-               ah->ah_macVersion = (val & AR_SREV_VERSION2) >> AR_SREV_TYPE2_S;
-               ah->ah_macRev = MS(val, AR_SREV_REVISION2);
-               ah->ah_isPciExpress = (val & AR_SREV_TYPE2_HOST_MODE) ? 0 : 1;
+               ah->hw_version.macVersion =
+                       (val & AR_SREV_VERSION2) >> AR_SREV_TYPE2_S;
+               ah->hw_version.macRev = MS(val, AR_SREV_REVISION2);
+               ah->is_pciexpress = (val & AR_SREV_TYPE2_HOST_MODE) ? 0 : 1;
        } else {
                if (!AR_SREV_9100(ah))
-                       ah->ah_macVersion = MS(val, AR_SREV_VERSION);
+                       ah->hw_version.macVersion = MS(val, AR_SREV_VERSION);
 
-               ah->ah_macRev = val & AR_SREV_REVISION;
+               ah->hw_version.macRev = val & AR_SREV_REVISION;
 
-               if (ah->ah_macVersion == AR_SREV_VERSION_5416_PCIE)
-                       ah->ah_isPciExpress = true;
+               if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE)
+                       ah->is_pciexpress = true;
        }
 }
 
-static int ath9k_hw_get_radiorev(struct ath_hal *ah)
+static int ath9k_hw_get_radiorev(struct ath_hw *ah)
 {
        u32 val;
        int i;
@@ -317,9 +266,9 @@ static int ath9k_hw_get_radiorev(struct ath_hal *ah)
 /* HW Attach, Detach, Init Routines */
 /************************************/
 
-static void ath9k_hw_disablepcie(struct ath_hal *ah)
+static void ath9k_hw_disablepcie(struct ath_hw *ah)
 {
-       if (!AR_SREV_9100(ah))
+       if (AR_SREV_9100(ah))
                return;
 
        REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00);
@@ -335,7 +284,7 @@ static void ath9k_hw_disablepcie(struct ath_hal *ah)
        REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
 }
 
-static bool ath9k_hw_chip_test(struct ath_hal *ah)
+static bool ath9k_hw_chip_test(struct ath_hw *ah)
 {
        u32 regAddr[2] = { AR_STA_ID0, AR_PHY_BASE + (8 << 2) };
        u32 regHold[2];
@@ -377,6 +326,7 @@ static bool ath9k_hw_chip_test(struct ath_hal *ah)
                REG_WRITE(ah, regAddr[i], regHold[i]);
        }
        udelay(100);
+
        return true;
 }
 
@@ -389,6 +339,8 @@ static const char *ath9k_hw_devname(u16 devid)
                return "Atheros 5418";
        case AR9160_DEVID_PCI:
                return "Atheros 9160";
+       case AR5416_AR9100_DEVID:
+               return "Atheros 9100";
        case AR9280_DEVID_PCI:
        case AR9280_DEVID_PCIE:
                return "Atheros 9280";
@@ -399,99 +351,91 @@ static const char *ath9k_hw_devname(u16 devid)
        return NULL;
 }
 
-static void ath9k_hw_set_defaults(struct ath_hal *ah)
+static void ath9k_hw_set_defaults(struct ath_hw *ah)
 {
        int i;
 
-       ah->ah_config.dma_beacon_response_time = 2;
-       ah->ah_config.sw_beacon_response_time = 10;
-       ah->ah_config.additional_swba_backoff = 0;
-       ah->ah_config.ack_6mb = 0x0;
-       ah->ah_config.cwm_ignore_extcca = 0;
-       ah->ah_config.pcie_powersave_enable = 0;
-       ah->ah_config.pcie_l1skp_enable = 0;
-       ah->ah_config.pcie_clock_req = 0;
-       ah->ah_config.pcie_power_reset = 0x100;
-       ah->ah_config.pcie_restore = 0;
-       ah->ah_config.pcie_waen = 0;
-       ah->ah_config.analog_shiftreg = 1;
-       ah->ah_config.ht_enable = 1;
-       ah->ah_config.ofdm_trig_low = 200;
-       ah->ah_config.ofdm_trig_high = 500;
-       ah->ah_config.cck_trig_high = 200;
-       ah->ah_config.cck_trig_low = 100;
-       ah->ah_config.enable_ani = 1;
-       ah->ah_config.noise_immunity_level = 4;
-       ah->ah_config.ofdm_weaksignal_det = 1;
-       ah->ah_config.cck_weaksignal_thr = 0;
-       ah->ah_config.spur_immunity_level = 2;
-       ah->ah_config.firstep_level = 0;
-       ah->ah_config.rssi_thr_high = 40;
-       ah->ah_config.rssi_thr_low = 7;
-       ah->ah_config.diversity_control = 0;
-       ah->ah_config.antenna_switch_swap = 0;
+       ah->config.dma_beacon_response_time = 2;
+       ah->config.sw_beacon_response_time = 10;
+       ah->config.additional_swba_backoff = 0;
+       ah->config.ack_6mb = 0x0;
+       ah->config.cwm_ignore_extcca = 0;
+       ah->config.pcie_powersave_enable = 0;
+       ah->config.pcie_l1skp_enable = 0;
+       ah->config.pcie_clock_req = 0;
+       ah->config.pcie_power_reset = 0x100;
+       ah->config.pcie_restore = 0;
+       ah->config.pcie_waen = 0;
+       ah->config.analog_shiftreg = 1;
+       ah->config.ht_enable = 1;
+       ah->config.ofdm_trig_low = 200;
+       ah->config.ofdm_trig_high = 500;
+       ah->config.cck_trig_high = 200;
+       ah->config.cck_trig_low = 100;
+       ah->config.enable_ani = 1;
+       ah->config.noise_immunity_level = 4;
+       ah->config.ofdm_weaksignal_det = 1;
+       ah->config.cck_weaksignal_thr = 0;
+       ah->config.spur_immunity_level = 2;
+       ah->config.firstep_level = 0;
+       ah->config.rssi_thr_high = 40;
+       ah->config.rssi_thr_low = 7;
+       ah->config.diversity_control = 0;
+       ah->config.antenna_switch_swap = 0;
 
        for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
-               ah->ah_config.spurchans[i][0] = AR_NO_SPUR;
-               ah->ah_config.spurchans[i][1] = AR_NO_SPUR;
+               ah->config.spurchans[i][0] = AR_NO_SPUR;
+               ah->config.spurchans[i][1] = AR_NO_SPUR;
        }
 
-       ah->ah_config.intr_mitigation = 1;
+       ah->config.intr_mitigation = 1;
 }
 
-static struct ath_hal_5416 *ath9k_hw_newstate(u16 devid,
-                                             struct ath_softc *sc,
-                                             void __iomem *mem,
-                                             int *status)
+static struct ath_hw *ath9k_hw_newstate(u16 devid, struct ath_softc *sc,
+                                       int *status)
 {
-       static const u8 defbssidmask[ETH_ALEN] =
-               { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-       struct ath_hal_5416 *ahp;
-       struct ath_hal *ah;
+       struct ath_hw *ah;
 
-       ahp = kzalloc(sizeof(struct ath_hal_5416), GFP_KERNEL);
-       if (ahp == NULL) {
+       ah = kzalloc(sizeof(struct ath_hw), GFP_KERNEL);
+       if (ah == NULL) {
                DPRINTF(sc, ATH_DBG_FATAL,
                        "Cannot allocate memory for state block\n");
                *status = -ENOMEM;
                return NULL;
        }
 
-       ah = &ahp->ah;
        ah->ah_sc = sc;
-       ah->ah_sh = mem;
-       ah->ah_magic = AR5416_MAGIC;
-       ah->ah_countryCode = CTRY_DEFAULT;
-       ah->ah_devid = devid;
-       ah->ah_subvendorid = 0;
+       ah->hw_version.magic = AR5416_MAGIC;
+       ah->regulatory.country_code = CTRY_DEFAULT;
+       ah->hw_version.devid = devid;
+       ah->hw_version.subvendorid = 0;
 
        ah->ah_flags = 0;
        if ((devid == AR5416_AR9100_DEVID))
-               ah->ah_macVersion = AR_SREV_VERSION_9100;
+               ah->hw_version.macVersion = AR_SREV_VERSION_9100;
        if (!AR_SREV_9100(ah))
                ah->ah_flags = AH_USE_EEPROM;
 
-       ah->ah_powerLimit = MAX_RATE_POWER;
-       ah->ah_tpScale = ATH9K_TP_SCALE_MAX;
-       ahp->ah_atimWindow = 0;
-       ahp->ah_diversityControl = ah->ah_config.diversity_control;
-       ahp->ah_antennaSwitchSwap =
-               ah->ah_config.antenna_switch_swap;
-       ahp->ah_staId1Defaults = AR_STA_ID1_CRPT_MIC_ENABLE;
-       ahp->ah_beaconInterval = 100;
-       ahp->ah_enable32kHzClock = DONT_USE_32KHZ;
-       ahp->ah_slottime = (u32) -1;
-       ahp->ah_acktimeout = (u32) -1;
-       ahp->ah_ctstimeout = (u32) -1;
-       ahp->ah_globaltxtimeout = (u32) -1;
-       memcpy(&ahp->ah_bssidmask, defbssidmask, ETH_ALEN);
-
-       ahp->ah_gBeaconRate = 0;
+       ah->regulatory.power_limit = MAX_RATE_POWER;
+       ah->regulatory.tp_scale = ATH9K_TP_SCALE_MAX;
+       ah->atim_window = 0;
+       ah->diversity_control = ah->config.diversity_control;
+       ah->antenna_switch_swap =
+               ah->config.antenna_switch_swap;
+       ah->sta_id1_defaults = AR_STA_ID1_CRPT_MIC_ENABLE;
+       ah->beacon_interval = 100;
+       ah->enable_32kHz_clock = DONT_USE_32KHZ;
+       ah->slottime = (u32) -1;
+       ah->acktimeout = (u32) -1;
+       ah->ctstimeout = (u32) -1;
+       ah->globaltxtimeout = (u32) -1;
+
+       ah->gbeacon_rate = 0;
 
-       return ahp;
+       return ah;
 }
 
-static int ath9k_hw_rfattach(struct ath_hal *ah)
+static int ath9k_hw_rfattach(struct ath_hw *ah)
 {
        bool rfStatus = false;
        int ecode = 0;
@@ -506,7 +450,7 @@ static int ath9k_hw_rfattach(struct ath_hal *ah)
        return 0;
 }
 
-static int ath9k_hw_rf_claim(struct ath_hal *ah)
+static int ath9k_hw_rf_claim(struct ath_hw *ah)
 {
        u32 val;
 
@@ -526,88 +470,87 @@ static int ath9k_hw_rf_claim(struct ath_hal *ah)
                DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
                        "5G Radio Chip Rev 0x%02X is not "
                        "supported by this driver\n",
-                       ah->ah_analog5GhzRev);
+                       ah->hw_version.analog5GhzRev);
                return -EOPNOTSUPP;
        }
 
-       ah->ah_analog5GhzRev = val;
+       ah->hw_version.analog5GhzRev = val;
 
        return 0;
 }
 
-static int ath9k_hw_init_macaddr(struct ath_hal *ah)
+static int ath9k_hw_init_macaddr(struct ath_hw *ah)
 {
        u32 sum;
        int i;
        u16 eeval;
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
        sum = 0;
        for (i = 0; i < 3; i++) {
-               eeval = ath9k_hw_get_eeprom(ah, AR_EEPROM_MAC(i));
+               eeval = ah->eep_ops->get_eeprom(ah, AR_EEPROM_MAC(i));
                sum += eeval;
-               ahp->ah_macaddr[2 * i] = eeval >> 8;
-               ahp->ah_macaddr[2 * i + 1] = eeval & 0xff;
+               ah->macaddr[2 * i] = eeval >> 8;
+               ah->macaddr[2 * i + 1] = eeval & 0xff;
        }
        if (sum == 0 || sum == 0xffff * 3) {
                DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
                        "mac address read failed: %pM\n",
-                       ahp->ah_macaddr);
+                       ah->macaddr);
                return -EADDRNOTAVAIL;
        }
 
        return 0;
 }
 
-static void ath9k_hw_init_rxgain_ini(struct ath_hal *ah)
+static void ath9k_hw_init_rxgain_ini(struct ath_hw *ah)
 {
        u32 rxgain_type;
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
-       if (ath9k_hw_get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_17) {
-               rxgain_type = ath9k_hw_get_eeprom(ah, EEP_RXGAIN_TYPE);
+       if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_17) {
+               rxgain_type = ah->eep_ops->get_eeprom(ah, EEP_RXGAIN_TYPE);
 
                if (rxgain_type == AR5416_EEP_RXGAIN_13DB_BACKOFF)
-                       INIT_INI_ARRAY(&ahp->ah_iniModesRxGain,
+                       INIT_INI_ARRAY(&ah->iniModesRxGain,
                        ar9280Modes_backoff_13db_rxgain_9280_2,
                        ARRAY_SIZE(ar9280Modes_backoff_13db_rxgain_9280_2), 6);
                else if (rxgain_type == AR5416_EEP_RXGAIN_23DB_BACKOFF)
-                       INIT_INI_ARRAY(&ahp->ah_iniModesRxGain,
+                       INIT_INI_ARRAY(&ah->iniModesRxGain,
                        ar9280Modes_backoff_23db_rxgain_9280_2,
                        ARRAY_SIZE(ar9280Modes_backoff_23db_rxgain_9280_2), 6);
                else
-                       INIT_INI_ARRAY(&ahp->ah_iniModesRxGain,
+                       INIT_INI_ARRAY(&ah->iniModesRxGain,
                        ar9280Modes_original_rxgain_9280_2,
                        ARRAY_SIZE(ar9280Modes_original_rxgain_9280_2), 6);
-       } else
-               INIT_INI_ARRAY(&ahp->ah_iniModesRxGain,
+       } else {
+               INIT_INI_ARRAY(&ah->iniModesRxGain,
                        ar9280Modes_original_rxgain_9280_2,
                        ARRAY_SIZE(ar9280Modes_original_rxgain_9280_2), 6);
+       }
 }
 
-static void ath9k_hw_init_txgain_ini(struct ath_hal *ah)
+static void ath9k_hw_init_txgain_ini(struct ath_hw *ah)
 {
        u32 txgain_type;
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
-       if (ath9k_hw_get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_19) {
-               txgain_type = ath9k_hw_get_eeprom(ah, EEP_TXGAIN_TYPE);
+       if (ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV) >= AR5416_EEP_MINOR_VER_19) {
+               txgain_type = ah->eep_ops->get_eeprom(ah, EEP_TXGAIN_TYPE);
 
                if (txgain_type == AR5416_EEP_TXGAIN_HIGH_POWER)
-                       INIT_INI_ARRAY(&ahp->ah_iniModesTxGain,
+                       INIT_INI_ARRAY(&ah->iniModesTxGain,
                        ar9280Modes_high_power_tx_gain_9280_2,
                        ARRAY_SIZE(ar9280Modes_high_power_tx_gain_9280_2), 6);
                else
-                       INIT_INI_ARRAY(&ahp->ah_iniModesTxGain,
+                       INIT_INI_ARRAY(&ah->iniModesTxGain,
                        ar9280Modes_original_tx_gain_9280_2,
                        ARRAY_SIZE(ar9280Modes_original_tx_gain_9280_2), 6);
-       } else
-               INIT_INI_ARRAY(&ahp->ah_iniModesTxGain,
+       } else {
+               INIT_INI_ARRAY(&ah->iniModesTxGain,
                ar9280Modes_original_tx_gain_9280_2,
                ARRAY_SIZE(ar9280Modes_original_tx_gain_9280_2), 6);
+       }
 }
 
-static int ath9k_hw_post_attach(struct ath_hal *ah)
+static int ath9k_hw_post_attach(struct ath_hw *ah)
 {
        int ecode;
 
@@ -636,237 +579,234 @@ static int ath9k_hw_post_attach(struct ath_hal *ah)
        return 0;
 }
 
-static struct ath_hal *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
-                                         void __iomem *mem, int *status)
+static struct ath_hw *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
+                                        int *status)
 {
-       struct ath_hal_5416 *ahp;
-       struct ath_hal *ah;
+       struct ath_hw *ah;
        int ecode;
        u32 i, j;
 
-       ahp = ath9k_hw_newstate(devid, sc, mem, status);
-       if (ahp == NULL)
+       ah = ath9k_hw_newstate(devid, sc, status);
+       if (ah == NULL)
                return NULL;
 
-       ah = &ahp->ah;
-
        ath9k_hw_set_defaults(ah);
 
-       if (ah->ah_config.intr_mitigation != 0)
-               ahp->ah_intrMitigation = true;
+       if (ah->config.intr_mitigation != 0)
+               ah->intr_mitigation = true;
 
        if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_POWER_ON)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_RESET, "Couldn't reset chip\n");
+               DPRINTF(sc, ATH_DBG_RESET, "Couldn't reset chip\n");
                ecode = -EIO;
                goto bad;
        }
 
        if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_RESET, "Couldn't wakeup chip\n");
+               DPRINTF(sc, ATH_DBG_RESET, "Couldn't wakeup chip\n");
                ecode = -EIO;
                goto bad;
        }
 
-       if (ah->ah_config.serialize_regmode == SER_REG_MODE_AUTO) {
-               if (ah->ah_macVersion == AR_SREV_VERSION_5416_PCI) {
-                       ah->ah_config.serialize_regmode =
+       if (ah->config.serialize_regmode == SER_REG_MODE_AUTO) {
+               if (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI) {
+                       ah->config.serialize_regmode =
                                SER_REG_MODE_ON;
                } else {
-                       ah->ah_config.serialize_regmode =
+                       ah->config.serialize_regmode =
                                SER_REG_MODE_OFF;
                }
        }
 
-       DPRINTF(ah->ah_sc, ATH_DBG_RESET,
-               "serialize_regmode is %d\n",
-               ah->ah_config.serialize_regmode);
+       DPRINTF(sc, ATH_DBG_RESET, "serialize_regmode is %d\n",
+               ah->config.serialize_regmode);
 
-       if ((ah->ah_macVersion != AR_SREV_VERSION_5416_PCI) &&
-           (ah->ah_macVersion != AR_SREV_VERSION_5416_PCIE) &&
-           (ah->ah_macVersion != AR_SREV_VERSION_9160) &&
+       if ((ah->hw_version.macVersion != AR_SREV_VERSION_5416_PCI) &&
+           (ah->hw_version.macVersion != AR_SREV_VERSION_5416_PCIE) &&
+           (ah->hw_version.macVersion != AR_SREV_VERSION_9160) &&
            (!AR_SREV_9100(ah)) && (!AR_SREV_9280(ah)) && (!AR_SREV_9285(ah))) {
-               DPRINTF(ah->ah_sc, ATH_DBG_RESET,
+               DPRINTF(sc, ATH_DBG_RESET,
                        "Mac Chip Rev 0x%02x.%x is not supported by "
-                       "this driver\n", ah->ah_macVersion, ah->ah_macRev);
+                       "this driver\n", ah->hw_version.macVersion,
+                       ah->hw_version.macRev);
                ecode = -EOPNOTSUPP;
                goto bad;
        }
 
        if (AR_SREV_9100(ah)) {
-               ahp->ah_iqCalData.calData = &iq_cal_multi_sample;
-               ahp->ah_suppCals = IQ_MISMATCH_CAL;
-               ah->ah_isPciExpress = false;
+               ah->iq_caldata.calData = &iq_cal_multi_sample;
+               ah->supp_cals = IQ_MISMATCH_CAL;
+               ah->is_pciexpress = false;
        }
-       ah->ah_phyRev = REG_READ(ah, AR_PHY_CHIP_ID);
+       ah->hw_version.phyRev = REG_READ(ah, AR_PHY_CHIP_ID);
 
        if (AR_SREV_9160_10_OR_LATER(ah)) {
                if (AR_SREV_9280_10_OR_LATER(ah)) {
-                       ahp->ah_iqCalData.calData = &iq_cal_single_sample;
-                       ahp->ah_adcGainCalData.calData =
+                       ah->iq_caldata.calData = &iq_cal_single_sample;
+                       ah->adcgain_caldata.calData =
                                &adc_gain_cal_single_sample;
-                       ahp->ah_adcDcCalData.calData =
+                       ah->adcdc_caldata.calData =
                                &adc_dc_cal_single_sample;
-                       ahp->ah_adcDcCalInitData.calData =
+                       ah->adcdc_calinitdata.calData =
                                &adc_init_dc_cal;
                } else {
-                       ahp->ah_iqCalData.calData = &iq_cal_multi_sample;
-                       ahp->ah_adcGainCalData.calData =
+                       ah->iq_caldata.calData = &iq_cal_multi_sample;
+                       ah->adcgain_caldata.calData =
                                &adc_gain_cal_multi_sample;
-                       ahp->ah_adcDcCalData.calData =
+                       ah->adcdc_caldata.calData =
                                &adc_dc_cal_multi_sample;
-                       ahp->ah_adcDcCalInitData.calData =
+                       ah->adcdc_calinitdata.calData =
                                &adc_init_dc_cal;
                }
-               ahp->ah_suppCals = ADC_GAIN_CAL | ADC_DC_CAL | IQ_MISMATCH_CAL;
+               ah->supp_cals = ADC_GAIN_CAL | ADC_DC_CAL | IQ_MISMATCH_CAL;
        }
 
        if (AR_SREV_9160(ah)) {
-               ah->ah_config.enable_ani = 1;
-               ahp->ah_ani_function = (ATH9K_ANI_SPUR_IMMUNITY_LEVEL |
+               ah->config.enable_ani = 1;
+               ah->ani_function = (ATH9K_ANI_SPUR_IMMUNITY_LEVEL |
                                        ATH9K_ANI_FIRSTEP_LEVEL);
        } else {
-               ahp->ah_ani_function = ATH9K_ANI_ALL;
+               ah->ani_function = ATH9K_ANI_ALL;
                if (AR_SREV_9280_10_OR_LATER(ah)) {
-                       ahp->ah_ani_function &= ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL;
+                       ah->ani_function &=     ~ATH9K_ANI_NOISE_IMMUNITY_LEVEL;
                }
        }
 
-       DPRINTF(ah->ah_sc, ATH_DBG_RESET,
+       DPRINTF(sc, ATH_DBG_RESET,
                "This Mac Chip Rev 0x%02x.%x is \n",
-               ah->ah_macVersion, ah->ah_macRev);
+               ah->hw_version.macVersion, ah->hw_version.macRev);
 
        if (AR_SREV_9285_12_OR_LATER(ah)) {
-               INIT_INI_ARRAY(&ahp->ah_iniModes, ar9285Modes_9285_1_2,
+               INIT_INI_ARRAY(&ah->iniModes, ar9285Modes_9285_1_2,
                               ARRAY_SIZE(ar9285Modes_9285_1_2), 6);
-               INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9285Common_9285_1_2,
+               INIT_INI_ARRAY(&ah->iniCommon, ar9285Common_9285_1_2,
                               ARRAY_SIZE(ar9285Common_9285_1_2), 2);
 
-               if (ah->ah_config.pcie_clock_req) {
-                       INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes,
+               if (ah->config.pcie_clock_req) {
+                       INIT_INI_ARRAY(&ah->iniPcieSerdes,
                        ar9285PciePhy_clkreq_off_L1_9285_1_2,
                        ARRAY_SIZE(ar9285PciePhy_clkreq_off_L1_9285_1_2), 2);
                } else {
-                       INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes,
+                       INIT_INI_ARRAY(&ah->iniPcieSerdes,
                        ar9285PciePhy_clkreq_always_on_L1_9285_1_2,
                        ARRAY_SIZE(ar9285PciePhy_clkreq_always_on_L1_9285_1_2),
                                  2);
                }
        } else if (AR_SREV_9285_10_OR_LATER(ah)) {
-               INIT_INI_ARRAY(&ahp->ah_iniModes, ar9285Modes_9285,
+               INIT_INI_ARRAY(&ah->iniModes, ar9285Modes_9285,
                               ARRAY_SIZE(ar9285Modes_9285), 6);
-               INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9285Common_9285,
+               INIT_INI_ARRAY(&ah->iniCommon, ar9285Common_9285,
                               ARRAY_SIZE(ar9285Common_9285), 2);
 
-               if (ah->ah_config.pcie_clock_req) {
-                       INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes,
+               if (ah->config.pcie_clock_req) {
+                       INIT_INI_ARRAY(&ah->iniPcieSerdes,
                        ar9285PciePhy_clkreq_off_L1_9285,
                        ARRAY_SIZE(ar9285PciePhy_clkreq_off_L1_9285), 2);
                } else {
-                       INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes,
+                       INIT_INI_ARRAY(&ah->iniPcieSerdes,
                        ar9285PciePhy_clkreq_always_on_L1_9285,
                        ARRAY_SIZE(ar9285PciePhy_clkreq_always_on_L1_9285), 2);
                }
        } else if (AR_SREV_9280_20_OR_LATER(ah)) {
-               INIT_INI_ARRAY(&ahp->ah_iniModes, ar9280Modes_9280_2,
+               INIT_INI_ARRAY(&ah->iniModes, ar9280Modes_9280_2,
                               ARRAY_SIZE(ar9280Modes_9280_2), 6);
-               INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9280Common_9280_2,
+               INIT_INI_ARRAY(&ah->iniCommon, ar9280Common_9280_2,
                               ARRAY_SIZE(ar9280Common_9280_2), 2);
 
-               if (ah->ah_config.pcie_clock_req) {
-                       INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes,
+               if (ah->config.pcie_clock_req) {
+                       INIT_INI_ARRAY(&ah->iniPcieSerdes,
                               ar9280PciePhy_clkreq_off_L1_9280,
                               ARRAY_SIZE(ar9280PciePhy_clkreq_off_L1_9280),2);
                } else {
-                       INIT_INI_ARRAY(&ahp->ah_iniPcieSerdes,
+                       INIT_INI_ARRAY(&ah->iniPcieSerdes,
                               ar9280PciePhy_clkreq_always_on_L1_9280,
                               ARRAY_SIZE(ar9280PciePhy_clkreq_always_on_L1_9280), 2);
                }
-               INIT_INI_ARRAY(&ahp->ah_iniModesAdditional,
+               INIT_INI_ARRAY(&ah->iniModesAdditional,
                               ar9280Modes_fast_clock_9280_2,
                               ARRAY_SIZE(ar9280Modes_fast_clock_9280_2), 3);
        } else if (AR_SREV_9280_10_OR_LATER(ah)) {
-               INIT_INI_ARRAY(&ahp->ah_iniModes, ar9280Modes_9280,
+               INIT_INI_ARRAY(&ah->iniModes, ar9280Modes_9280,
                               ARRAY_SIZE(ar9280Modes_9280), 6);
-               INIT_INI_ARRAY(&ahp->ah_iniCommon, ar9280Common_9280,
+               INIT_INI_ARRAY(&ah->iniCommon, ar9280Common_9280,
                               ARRAY_SIZE(ar9280Common_9280), 2);
        } else if (AR_SREV_9160_10_OR_LATER(ah)) {
-               INIT_INI_ARRAY(&ahp->ah_iniModes, ar5416Modes_9160,
+               INIT_INI_ARRAY(&ah->iniModes, ar5416Modes_9160,
                               ARRAY_SIZE(ar5416Modes_9160), 6);
-               INIT_INI_ARRAY(&ahp->ah_iniCommon, ar5416Common_9160,
+               INIT_INI_ARRAY(&ah->iniCommon, ar5416Common_9160,
                               ARRAY_SIZE(ar5416Common_9160), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank0, ar5416Bank0_9160,
+               INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0_9160,
                               ARRAY_SIZE(ar5416Bank0_9160), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBB_RfGain, ar5416BB_RfGain_9160,
+               INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain_9160,
                               ARRAY_SIZE(ar5416BB_RfGain_9160), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank1, ar5416Bank1_9160,
+               INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1_9160,
                               ARRAY_SIZE(ar5416Bank1_9160), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank2, ar5416Bank2_9160,
+               INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2_9160,
                               ARRAY_SIZE(ar5416Bank2_9160), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank3, ar5416Bank3_9160,
+               INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3_9160,
                               ARRAY_SIZE(ar5416Bank3_9160), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank6, ar5416Bank6_9160,
+               INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6_9160,
                               ARRAY_SIZE(ar5416Bank6_9160), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank6TPC, ar5416Bank6TPC_9160,
+               INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC_9160,
                               ARRAY_SIZE(ar5416Bank6TPC_9160), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank7, ar5416Bank7_9160,
+               INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7_9160,
                               ARRAY_SIZE(ar5416Bank7_9160), 2);
                if (AR_SREV_9160_11(ah)) {
-                       INIT_INI_ARRAY(&ahp->ah_iniAddac,
+                       INIT_INI_ARRAY(&ah->iniAddac,
                                       ar5416Addac_91601_1,
                                       ARRAY_SIZE(ar5416Addac_91601_1), 2);
                } else {
-                       INIT_INI_ARRAY(&ahp->ah_iniAddac, ar5416Addac_9160,
+                       INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac_9160,
                                       ARRAY_SIZE(ar5416Addac_9160), 2);
                }
        } else if (AR_SREV_9100_OR_LATER(ah)) {
-               INIT_INI_ARRAY(&ahp->ah_iniModes, ar5416Modes_9100,
+               INIT_INI_ARRAY(&ah->iniModes, ar5416Modes_9100,
                               ARRAY_SIZE(ar5416Modes_9100), 6);
-               INIT_INI_ARRAY(&ahp->ah_iniCommon, ar5416Common_9100,
+               INIT_INI_ARRAY(&ah->iniCommon, ar5416Common_9100,
                               ARRAY_SIZE(ar5416Common_9100), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank0, ar5416Bank0_9100,
+               INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0_9100,
                               ARRAY_SIZE(ar5416Bank0_9100), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBB_RfGain, ar5416BB_RfGain_9100,
+               INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain_9100,
                               ARRAY_SIZE(ar5416BB_RfGain_9100), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank1, ar5416Bank1_9100,
+               INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1_9100,
                               ARRAY_SIZE(ar5416Bank1_9100), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank2, ar5416Bank2_9100,
+               INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2_9100,
                               ARRAY_SIZE(ar5416Bank2_9100), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank3, ar5416Bank3_9100,
+               INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3_9100,
                               ARRAY_SIZE(ar5416Bank3_9100), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank6, ar5416Bank6_9100,
+               INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6_9100,
                               ARRAY_SIZE(ar5416Bank6_9100), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank6TPC, ar5416Bank6TPC_9100,
+               INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC_9100,
                               ARRAY_SIZE(ar5416Bank6TPC_9100), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank7, ar5416Bank7_9100,
+               INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7_9100,
                               ARRAY_SIZE(ar5416Bank7_9100), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniAddac, ar5416Addac_9100,
+               INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac_9100,
                               ARRAY_SIZE(ar5416Addac_9100), 2);
        } else {
-               INIT_INI_ARRAY(&ahp->ah_iniModes, ar5416Modes,
+               INIT_INI_ARRAY(&ah->iniModes, ar5416Modes,
                               ARRAY_SIZE(ar5416Modes), 6);
-               INIT_INI_ARRAY(&ahp->ah_iniCommon, ar5416Common,
+               INIT_INI_ARRAY(&ah->iniCommon, ar5416Common,
                               ARRAY_SIZE(ar5416Common), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank0, ar5416Bank0,
+               INIT_INI_ARRAY(&ah->iniBank0, ar5416Bank0,
                               ARRAY_SIZE(ar5416Bank0), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBB_RfGain, ar5416BB_RfGain,
+               INIT_INI_ARRAY(&ah->iniBB_RfGain, ar5416BB_RfGain,
                               ARRAY_SIZE(ar5416BB_RfGain), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank1, ar5416Bank1,
+               INIT_INI_ARRAY(&ah->iniBank1, ar5416Bank1,
                               ARRAY_SIZE(ar5416Bank1), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank2, ar5416Bank2,
+               INIT_INI_ARRAY(&ah->iniBank2, ar5416Bank2,
                               ARRAY_SIZE(ar5416Bank2), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniBank3, ar5416Bank3,
+               INIT_INI_ARRAY(&ah->iniBank3, ar5416Bank3,
                               ARRAY_SIZE(ar5416Bank3), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank6, ar5416Bank6,
+               INIT_INI_ARRAY(&ah->iniBank6, ar5416Bank6,
                               ARRAY_SIZE(ar5416Bank6), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank6TPC, ar5416Bank6TPC,
+               INIT_INI_ARRAY(&ah->iniBank6TPC, ar5416Bank6TPC,
                               ARRAY_SIZE(ar5416Bank6TPC), 3);
-               INIT_INI_ARRAY(&ahp->ah_iniBank7, ar5416Bank7,
+               INIT_INI_ARRAY(&ah->iniBank7, ar5416Bank7,
                               ARRAY_SIZE(ar5416Bank7), 2);
-               INIT_INI_ARRAY(&ahp->ah_iniAddac, ar5416Addac,
+               INIT_INI_ARRAY(&ah->iniAddac, ar5416Addac,
                               ARRAY_SIZE(ar5416Addac), 2);
        }
 
-       if (ah->ah_isPciExpress)
+       if (ah->is_pciexpress)
                ath9k_hw_configpcipowersave(ah, 0);
        else
                ath9k_hw_disablepcie(ah);
@@ -883,23 +823,23 @@ static struct ath_hal *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
        if (AR_SREV_9280_20(ah))
                ath9k_hw_init_txgain_ini(ah);
 
-       if (ah->ah_devid == AR9280_DEVID_PCI) {
-               for (i = 0; i < ahp->ah_iniModes.ia_rows; i++) {
-                       u32 reg = INI_RA(&ahp->ah_iniModes, i, 0);
+       if (ah->hw_version.devid == AR9280_DEVID_PCI) {
+               for (i = 0; i < ah->iniModes.ia_rows; i++) {
+                       u32 reg = INI_RA(&ah->iniModes, i, 0);
 
-                       for (j = 1; j < ahp->ah_iniModes.ia_columns; j++) {
-                               u32 val = INI_RA(&ahp->ah_iniModes, i, j);
+                       for (j = 1; j < ah->iniModes.ia_columns; j++) {
+                               u32 val = INI_RA(&ah->iniModes, i, j);
 
-                               INI_RA(&ahp->ah_iniModes, i, j) =
+                               INI_RA(&ah->iniModes, i, j) =
                                        ath9k_hw_ini_fixup(ah,
-                                                          &ahp->ah_eeprom.def,
+                                                          &ah->eeprom.def,
                                                           reg, val);
                        }
                }
        }
 
        if (!ath9k_hw_fill_cap_info(ah)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_RESET,
+               DPRINTF(sc, ATH_DBG_RESET,
                        "failed ath9k_hw_fill_cap_info\n");
                ecode = -EINVAL;
                goto bad;
@@ -907,29 +847,29 @@ static struct ath_hal *ath9k_hw_do_attach(u16 devid, struct ath_softc *sc,
 
        ecode = ath9k_hw_init_macaddr(ah);
        if (ecode != 0) {
-               DPRINTF(ah->ah_sc, ATH_DBG_RESET,
+               DPRINTF(sc, ATH_DBG_RESET,
                        "failed initializing mac address\n");
                goto bad;
        }
 
        if (AR_SREV_9285(ah))
-               ah->ah_txTrigLevel = (AR_FTRIG_256B >> AR_FTRIG_S);
+               ah->tx_trig_level = (AR_FTRIG_256B >> AR_FTRIG_S);
        else
-               ah->ah_txTrigLevel = (AR_FTRIG_512B >> AR_FTRIG_S);
+               ah->tx_trig_level = (AR_FTRIG_512B >> AR_FTRIG_S);
 
        ath9k_init_nfcal_hist_buffer(ah);
 
        return ah;
 bad:
-       if (ahp)
-               ath9k_hw_detach((struct ath_hal *) ahp);
+       if (ah)
+               ath9k_hw_detach(ah);
        if (status)
                *status = ecode;
 
        return NULL;
 }
 
-static void ath9k_hw_init_bb(struct ath_hal *ah,
+static void ath9k_hw_init_bb(struct ath_hw *ah,
                             struct ath9k_channel *chan)
 {
        u32 synthDelay;
@@ -945,7 +885,7 @@ static void ath9k_hw_init_bb(struct ath_hal *ah,
        udelay(synthDelay + BASE_ACTIVATE_DELAY);
 }
 
-static void ath9k_hw_init_qos(struct ath_hal *ah)
+static void ath9k_hw_init_qos(struct ath_hw *ah)
 {
        REG_WRITE(ah, AR_MIC_QOS_CONTROL, 0x100aa);
        REG_WRITE(ah, AR_MIC_QOS_SELECT, 0x3210);
@@ -962,7 +902,7 @@ static void ath9k_hw_init_qos(struct ath_hal *ah)
        REG_WRITE(ah, AR_TXOP_12_15, 0xFFFFFFFF);
 }
 
-static void ath9k_hw_init_pll(struct ath_hal *ah,
+static void ath9k_hw_init_pll(struct ath_hw *ah,
                              struct ath9k_channel *chan)
 {
        u32 pll;
@@ -1023,27 +963,26 @@ static void ath9k_hw_init_pll(struct ath_hal *ah,
                                pll |= SM(0xb, AR_RTC_PLL_DIV);
                }
        }
-       REG_WRITE(ah, (u16) (AR_RTC_PLL_CONTROL), pll);
+       REG_WRITE(ah, AR_RTC_PLL_CONTROL, pll);
 
        udelay(RTC_PLL_SETTLE_DELAY);
 
        REG_WRITE(ah, AR_RTC_SLEEP_CLK, AR_RTC_FORCE_DERIVED_CLK);
 }
 
-static void ath9k_hw_init_chain_masks(struct ath_hal *ah)
+static void ath9k_hw_init_chain_masks(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int rx_chainmask, tx_chainmask;
 
-       rx_chainmask = ahp->ah_rxchainmask;
-       tx_chainmask = ahp->ah_txchainmask;
+       rx_chainmask = ah->rxchainmask;
+       tx_chainmask = ah->txchainmask;
 
        switch (rx_chainmask) {
        case 0x5:
                REG_SET_BIT(ah, AR_PHY_ANALOG_SWAP,
                            AR_PHY_SWAP_ALT_CHAIN);
        case 0x3:
-               if (((ah)->ah_macVersion <= AR_SREV_VERSION_9160)) {
+               if (((ah)->hw_version.macVersion <= AR_SREV_VERSION_9160)) {
                        REG_WRITE(ah, AR_PHY_RX_CHAINMASK, 0x7);
                        REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, 0x7);
                        break;
@@ -1068,28 +1007,26 @@ static void ath9k_hw_init_chain_masks(struct ath_hal *ah)
                          REG_READ(ah, AR_PHY_ANALOG_SWAP) | 0x00000001);
 }
 
-static void ath9k_hw_init_interrupt_masks(struct ath_hal *ah,
+static void ath9k_hw_init_interrupt_masks(struct ath_hw *ah,
                                          enum nl80211_iftype opmode)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       ahp->ah_maskReg = AR_IMR_TXERR |
+       ah->mask_reg = AR_IMR_TXERR |
                AR_IMR_TXURN |
                AR_IMR_RXERR |
                AR_IMR_RXORN |
                AR_IMR_BCNMISC;
 
-       if (ahp->ah_intrMitigation)
-               ahp->ah_maskReg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
+       if (ah->intr_mitigation)
+               ah->mask_reg |= AR_IMR_RXINTM | AR_IMR_RXMINTR;
        else
-               ahp->ah_maskReg |= AR_IMR_RXOK;
+               ah->mask_reg |= AR_IMR_RXOK;
 
-       ahp->ah_maskReg |= AR_IMR_TXOK;
+       ah->mask_reg |= AR_IMR_TXOK;
 
        if (opmode == NL80211_IFTYPE_AP)
-               ahp->ah_maskReg |= AR_IMR_MIB;
+               ah->mask_reg |= AR_IMR_MIB;
 
-       REG_WRITE(ah, AR_IMR, ahp->ah_maskReg);
+       REG_WRITE(ah, AR_IMR, ah->mask_reg);
        REG_WRITE(ah, AR_IMR_S2, REG_READ(ah, AR_IMR_S2) | AR_IMR_S2_GTT);
 
        if (!AR_SREV_9100(ah)) {
@@ -1099,72 +1036,64 @@ static void ath9k_hw_init_interrupt_masks(struct ath_hal *ah,
        }
 }
 
-static bool ath9k_hw_set_ack_timeout(struct ath_hal *ah, u32 us)
+static bool ath9k_hw_set_ack_timeout(struct ath_hw *ah, u32 us)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        if (us > ath9k_hw_mac_to_usec(ah, MS(0xffffffff, AR_TIME_OUT_ACK))) {
                DPRINTF(ah->ah_sc, ATH_DBG_RESET, "bad ack timeout %u\n", us);
-               ahp->ah_acktimeout = (u32) -1;
+               ah->acktimeout = (u32) -1;
                return false;
        } else {
                REG_RMW_FIELD(ah, AR_TIME_OUT,
                              AR_TIME_OUT_ACK, ath9k_hw_mac_to_clks(ah, us));
-               ahp->ah_acktimeout = us;
+               ah->acktimeout = us;
                return true;
        }
 }
 
-static bool ath9k_hw_set_cts_timeout(struct ath_hal *ah, u32 us)
+static bool ath9k_hw_set_cts_timeout(struct ath_hw *ah, u32 us)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        if (us > ath9k_hw_mac_to_usec(ah, MS(0xffffffff, AR_TIME_OUT_CTS))) {
                DPRINTF(ah->ah_sc, ATH_DBG_RESET, "bad cts timeout %u\n", us);
-               ahp->ah_ctstimeout = (u32) -1;
+               ah->ctstimeout = (u32) -1;
                return false;
        } else {
                REG_RMW_FIELD(ah, AR_TIME_OUT,
                              AR_TIME_OUT_CTS, ath9k_hw_mac_to_clks(ah, us));
-               ahp->ah_ctstimeout = us;
+               ah->ctstimeout = us;
                return true;
        }
 }
 
-static bool ath9k_hw_set_global_txtimeout(struct ath_hal *ah, u32 tu)
+static bool ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        if (tu > 0xFFFF) {
                DPRINTF(ah->ah_sc, ATH_DBG_XMIT,
                        "bad global tx timeout %u\n", tu);
-               ahp->ah_globaltxtimeout = (u32) -1;
+               ah->globaltxtimeout = (u32) -1;
                return false;
        } else {
                REG_RMW_FIELD(ah, AR_GTXTO, AR_GTXTO_TIMEOUT_LIMIT, tu);
-               ahp->ah_globaltxtimeout = tu;
+               ah->globaltxtimeout = tu;
                return true;
        }
 }
 
-static void ath9k_hw_init_user_settings(struct ath_hal *ah)
+static void ath9k_hw_init_user_settings(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       DPRINTF(ah->ah_sc, ATH_DBG_RESET, "ahp->ah_miscMode 0x%x\n",
-               ahp->ah_miscMode);
+       DPRINTF(ah->ah_sc, ATH_DBG_RESET, "ah->misc_mode 0x%x\n",
+               ah->misc_mode);
 
-       if (ahp->ah_miscMode != 0)
+       if (ah->misc_mode != 0)
                REG_WRITE(ah, AR_PCU_MISC,
-                         REG_READ(ah, AR_PCU_MISC) | ahp->ah_miscMode);
-       if (ahp->ah_slottime != (u32) -1)
-               ath9k_hw_setslottime(ah, ahp->ah_slottime);
-       if (ahp->ah_acktimeout != (u32) -1)
-               ath9k_hw_set_ack_timeout(ah, ahp->ah_acktimeout);
-       if (ahp->ah_ctstimeout != (u32) -1)
-               ath9k_hw_set_cts_timeout(ah, ahp->ah_ctstimeout);
-       if (ahp->ah_globaltxtimeout != (u32) -1)
-               ath9k_hw_set_global_txtimeout(ah, ahp->ah_globaltxtimeout);
+                         REG_READ(ah, AR_PCU_MISC) | ah->misc_mode);
+       if (ah->slottime != (u32) -1)
+               ath9k_hw_setslottime(ah, ah->slottime);
+       if (ah->acktimeout != (u32) -1)
+               ath9k_hw_set_ack_timeout(ah, ah->acktimeout);
+       if (ah->ctstimeout != (u32) -1)
+               ath9k_hw_set_cts_timeout(ah, ah->ctstimeout);
+       if (ah->globaltxtimeout != (u32) -1)
+               ath9k_hw_set_global_txtimeout(ah, ah->globaltxtimeout);
 }
 
 const char *ath9k_hw_probe(u16 vendorid, u16 devid)
@@ -1173,7 +1102,7 @@ const char *ath9k_hw_probe(u16 vendorid, u16 devid)
                ath9k_hw_devname(devid) : NULL;
 }
 
-void ath9k_hw_detach(struct ath_hal *ah)
+void ath9k_hw_detach(struct ath_hw *ah)
 {
        if (!AR_SREV_9100(ah))
                ath9k_hw_ani_detach(ah);
@@ -1183,19 +1112,19 @@ void ath9k_hw_detach(struct ath_hal *ah)
        kfree(ah);
 }
 
-struct ath_hal *ath9k_hw_attach(u16 devid, struct ath_softc *sc,
-                               void __iomem *mem, int *error)
+struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error)
 {
-       struct ath_hal *ah = NULL;
+       struct ath_hw *ah = NULL;
 
        switch (devid) {
        case AR5416_DEVID_PCI:
        case AR5416_DEVID_PCIE:
+       case AR5416_AR9100_DEVID:
        case AR9160_DEVID_PCI:
        case AR9280_DEVID_PCI:
        case AR9280_DEVID_PCIE:
        case AR9285_DEVID_PCIE:
-               ah = ath9k_hw_do_attach(devid, sc, mem, error);
+               ah = ath9k_hw_do_attach(devid, sc, error);
                break;
        default:
                *error = -ENXIO;
@@ -1209,7 +1138,7 @@ struct ath_hal *ath9k_hw_attach(u16 devid, struct ath_softc *sc,
 /* INI */
 /*******/
 
-static void ath9k_hw_override_ini(struct ath_hal *ah,
+static void ath9k_hw_override_ini(struct ath_hw *ah,
                                  struct ath9k_channel *chan)
 {
        /*
@@ -1227,13 +1156,13 @@ static void ath9k_hw_override_ini(struct ath_hal *ah,
        REG_WRITE(ah, 0x9800 + (651 << 2), 0x11);
 }
 
-static u32 ath9k_hw_def_ini_fixup(struct ath_hal *ah,
+static u32 ath9k_hw_def_ini_fixup(struct ath_hw *ah,
                              struct ar5416_eeprom_def *pEepData,
                              u32 reg, u32 value)
 {
        struct base_eep_header *pBase = &(pEepData->baseEepHeader);
 
-       switch (ah->ah_devid) {
+       switch (ah->hw_version.devid) {
        case AR9280_DEVID_PCI:
                if (reg == 0x7894) {
                        DPRINTF(ah->ah_sc, ATH_DBG_ANY,
@@ -1261,24 +1190,22 @@ static u32 ath9k_hw_def_ini_fixup(struct ath_hal *ah,
        return value;
 }
 
-static u32 ath9k_hw_ini_fixup(struct ath_hal *ah,
+static u32 ath9k_hw_ini_fixup(struct ath_hw *ah,
                              struct ar5416_eeprom_def *pEepData,
                              u32 reg, u32 value)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       if (ahp->ah_eep_map == EEP_MAP_4KBITS)
+       if (ah->eep_map == EEP_MAP_4KBITS)
                return value;
        else
                return ath9k_hw_def_ini_fixup(ah, pEepData, reg, value);
 }
 
-static int ath9k_hw_process_ini(struct ath_hal *ah,
+static int ath9k_hw_process_ini(struct ath_hw *ah,
                                struct ath9k_channel *chan,
                                enum ath9k_ht_macmode macmode)
 {
        int i, regWrites = 0;
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       struct ieee80211_channel *channel = chan->chan;
        u32 modesIndex, freqIndex;
        int status;
 
@@ -1310,40 +1237,38 @@ static int ath9k_hw_process_ini(struct ath_hal *ah,
        }
 
        REG_WRITE(ah, AR_PHY(0), 0x00000007);
-
        REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_EXTERNAL_RADIO);
-
-       ath9k_hw_set_addac(ah, chan);
+       ah->eep_ops->set_addac(ah, chan);
 
        if (AR_SREV_5416_V22_OR_LATER(ah)) {
-               REG_WRITE_ARRAY(&ahp->ah_iniAddac, 1, regWrites);
+               REG_WRITE_ARRAY(&ah->iniAddac, 1, regWrites);
        } else {
                struct ar5416IniArray temp;
                u32 addacSize =
-                       sizeof(u32) * ahp->ah_iniAddac.ia_rows *
-                       ahp->ah_iniAddac.ia_columns;
+                       sizeof(u32) * ah->iniAddac.ia_rows *
+                       ah->iniAddac.ia_columns;
 
-               memcpy(ahp->ah_addac5416_21,
-                      ahp->ah_iniAddac.ia_array, addacSize);
+               memcpy(ah->addac5416_21,
+                      ah->iniAddac.ia_array, addacSize);
 
-               (ahp->ah_addac5416_21)[31 * ahp->ah_iniAddac.ia_columns + 1] = 0;
+               (ah->addac5416_21)[31 * ah->iniAddac.ia_columns + 1] = 0;
 
-               temp.ia_array = ahp->ah_addac5416_21;
-               temp.ia_columns = ahp->ah_iniAddac.ia_columns;
-               temp.ia_rows = ahp->ah_iniAddac.ia_rows;
+               temp.ia_array = ah->addac5416_21;
+               temp.ia_columns = ah->iniAddac.ia_columns;
+               temp.ia_rows = ah->iniAddac.ia_rows;
                REG_WRITE_ARRAY(&temp, 1, regWrites);
        }
 
        REG_WRITE(ah, AR_PHY_ADC_SERIAL_CTL, AR_PHY_SEL_INTERNAL_ADDAC);
 
-       for (i = 0; i < ahp->ah_iniModes.ia_rows; i++) {
-               u32 reg = INI_RA(&ahp->ah_iniModes, i, 0);
-               u32 val = INI_RA(&ahp->ah_iniModes, i, modesIndex);
+       for (i = 0; i < ah->iniModes.ia_rows; i++) {
+               u32 reg = INI_RA(&ah->iniModes, i, 0);
+               u32 val = INI_RA(&ah->iniModes, i, modesIndex);
 
                REG_WRITE(ah, reg, val);
 
                if (reg >= 0x7800 && reg < 0x78a0
-                   && ah->ah_config.analog_shiftreg) {
+                   && ah->config.analog_shiftreg) {
                        udelay(100);
                }
 
@@ -1351,19 +1276,19 @@ static int ath9k_hw_process_ini(struct ath_hal *ah,
        }
 
        if (AR_SREV_9280(ah))
-               REG_WRITE_ARRAY(&ahp->ah_iniModesRxGain, modesIndex, regWrites);
+               REG_WRITE_ARRAY(&ah->iniModesRxGain, modesIndex, regWrites);
 
        if (AR_SREV_9280(ah))
-               REG_WRITE_ARRAY(&ahp->ah_iniModesTxGain, modesIndex, regWrites);
+               REG_WRITE_ARRAY(&ah->iniModesTxGain, modesIndex, regWrites);
 
-       for (i = 0; i < ahp->ah_iniCommon.ia_rows; i++) {
-               u32 reg = INI_RA(&ahp->ah_iniCommon, i, 0);
-               u32 val = INI_RA(&ahp->ah_iniCommon, i, 1);
+       for (i = 0; i < ah->iniCommon.ia_rows; i++) {
+               u32 reg = INI_RA(&ah->iniCommon, i, 0);
+               u32 val = INI_RA(&ah->iniCommon, i, 1);
 
                REG_WRITE(ah, reg, val);
 
                if (reg >= 0x7800 && reg < 0x78a0
-                   && ah->ah_config.analog_shiftreg) {
+                   && ah->config.analog_shiftreg) {
                        udelay(100);
                }
 
@@ -1373,7 +1298,7 @@ static int ath9k_hw_process_ini(struct ath_hal *ah,
        ath9k_hw_write_regs(ah, modesIndex, freqIndex, regWrites);
 
        if (AR_SREV_9280_20(ah) && IS_CHAN_A_5MHZ_SPACED(chan)) {
-               REG_WRITE_ARRAY(&ahp->ah_iniModesAdditional, modesIndex,
+               REG_WRITE_ARRAY(&ah->iniModesAdditional, modesIndex,
                                regWrites);
        }
 
@@ -1381,13 +1306,12 @@ static int ath9k_hw_process_ini(struct ath_hal *ah,
        ath9k_hw_set_regs(ah, chan, macmode);
        ath9k_hw_init_chain_masks(ah);
 
-       status = ath9k_hw_set_txpower(ah, chan,
-                                     ath9k_regd_get_ctl(ah, chan),
-                                     ath9k_regd_get_antenna_allowed(ah,
-                                                                    chan),
-                                     chan->maxRegTxPower * 2,
-                                     min((u32) MAX_RATE_POWER,
-                                         (u32) ah->ah_powerLimit));
+       status = ah->eep_ops->set_txpower(ah, chan,
+                                 ath9k_regd_get_ctl(ah, chan),
+                                 channel->max_antenna_gain * 2,
+                                 channel->max_power * 2,
+                                 min((u32) MAX_RATE_POWER,
+                                     (u32) ah->regulatory.power_limit));
        if (status != 0) {
                DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT,
                        "error init'ing transmit power\n");
@@ -1407,7 +1331,7 @@ static int ath9k_hw_process_ini(struct ath_hal *ah,
 /* Reset and Channel Switching Routines */
 /****************************************/
 
-static void ath9k_hw_set_rfmode(struct ath_hal *ah, struct ath9k_channel *chan)
+static void ath9k_hw_set_rfmode(struct ath_hw *ah, struct ath9k_channel *chan)
 {
        u32 rfMode = 0;
 
@@ -1427,12 +1351,12 @@ static void ath9k_hw_set_rfmode(struct ath_hal *ah, struct ath9k_channel *chan)
        REG_WRITE(ah, AR_PHY_MODE, rfMode);
 }
 
-static void ath9k_hw_mark_phy_inactive(struct ath_hal *ah)
+static void ath9k_hw_mark_phy_inactive(struct ath_hw *ah)
 {
        REG_WRITE(ah, AR_PHY_ACTIVE, AR_PHY_ACTIVE_DIS);
 }
 
-static inline void ath9k_hw_set_dma(struct ath_hal *ah)
+static inline void ath9k_hw_set_dma(struct ath_hw *ah)
 {
        u32 regval;
 
@@ -1442,7 +1366,7 @@ static inline void ath9k_hw_set_dma(struct ath_hal *ah)
        regval = REG_READ(ah, AR_TXCFG) & ~AR_TXCFG_DMASZ_MASK;
        REG_WRITE(ah, AR_TXCFG, regval | AR_TXCFG_DMASZ_128B);
 
-       REG_RMW_FIELD(ah, AR_TXCFG, AR_FTRIG, ah->ah_txTrigLevel);
+       REG_RMW_FIELD(ah, AR_TXCFG, AR_FTRIG, ah->tx_trig_level);
 
        regval = REG_READ(ah, AR_RXCFG) & ~AR_RXCFG_DMASZ_MASK;
        REG_WRITE(ah, AR_RXCFG, regval | AR_RXCFG_DMASZ_128B);
@@ -1458,7 +1382,7 @@ static inline void ath9k_hw_set_dma(struct ath_hal *ah)
        }
 }
 
-static void ath9k_hw_set_operating_mode(struct ath_hal *ah, int opmode)
+static void ath9k_hw_set_operating_mode(struct ath_hw *ah, int opmode)
 {
        u32 val;
 
@@ -1482,7 +1406,7 @@ static void ath9k_hw_set_operating_mode(struct ath_hal *ah, int opmode)
        }
 }
 
-static inline void ath9k_hw_get_delta_slope_vals(struct ath_hal *ah,
+static inline void ath9k_hw_get_delta_slope_vals(struct ath_hw *ah,
                                                 u32 coef_scaled,
                                                 u32 *coef_mantissa,
                                                 u32 *coef_exponent)
@@ -1501,7 +1425,7 @@ static inline void ath9k_hw_get_delta_slope_vals(struct ath_hal *ah,
        *coef_exponent = coef_exp - 16;
 }
 
-static void ath9k_hw_set_delta_slope(struct ath_hal *ah,
+static void ath9k_hw_set_delta_slope(struct ath_hw *ah,
                                     struct ath9k_channel *chan)
 {
        u32 coef_scaled, ds_coef_exp, ds_coef_man;
@@ -1535,7 +1459,7 @@ static void ath9k_hw_set_delta_slope(struct ath_hal *ah,
                      AR_PHY_HALFGI_DSC_EXP, ds_coef_exp);
 }
 
-static bool ath9k_hw_set_reset(struct ath_hal *ah, int type)
+static bool ath9k_hw_set_reset(struct ath_hw *ah, int type)
 {
        u32 rst_flags;
        u32 tmpReg;
@@ -1562,11 +1486,11 @@ static bool ath9k_hw_set_reset(struct ath_hal *ah, int type)
                        rst_flags |= AR_RTC_RC_MAC_COLD;
        }
 
-       REG_WRITE(ah, (u16) (AR_RTC_RC), rst_flags);
+       REG_WRITE(ah, AR_RTC_RC, rst_flags);
        udelay(50);
 
-       REG_WRITE(ah, (u16) (AR_RTC_RC), 0);
-       if (!ath9k_hw_wait(ah, (u16) (AR_RTC_RC), AR_RTC_RC_M, 0)) {
+       REG_WRITE(ah, AR_RTC_RC, 0);
+       if (!ath9k_hw_wait(ah, AR_RTC_RC, AR_RTC_RC_M, 0)) {
                DPRINTF(ah->ah_sc, ATH_DBG_RESET,
                        "RTC stuck in MAC reset\n");
                return false;
@@ -1583,13 +1507,13 @@ static bool ath9k_hw_set_reset(struct ath_hal *ah, int type)
        return true;
 }
 
-static bool ath9k_hw_set_reset_power_on(struct ath_hal *ah)
+static bool ath9k_hw_set_reset_power_on(struct ath_hw *ah)
 {
        REG_WRITE(ah, AR_RTC_FORCE_WAKE, AR_RTC_FORCE_WAKE_EN |
                  AR_RTC_FORCE_WAKE_ON_INT);
 
-       REG_WRITE(ah, (u16) (AR_RTC_RESET), 0);
-       REG_WRITE(ah, (u16) (AR_RTC_RESET), 1);
+       REG_WRITE(ah, AR_RTC_RESET, 0);
+       REG_WRITE(ah, AR_RTC_RESET, 1);
 
        if (!ath9k_hw_wait(ah,
                           AR_RTC_STATUS,
@@ -1604,7 +1528,7 @@ static bool ath9k_hw_set_reset_power_on(struct ath_hal *ah)
        return ath9k_hw_set_reset(ah, ATH9K_RESET_WARM);
 }
 
-static bool ath9k_hw_set_reset_reg(struct ath_hal *ah, u32 type)
+static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
 {
        REG_WRITE(ah, AR_RTC_FORCE_WAKE,
                  AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT);
@@ -1622,12 +1546,11 @@ static bool ath9k_hw_set_reset_reg(struct ath_hal *ah, u32 type)
        }
 }
 
-static void ath9k_hw_set_regs(struct ath_hal *ah, struct ath9k_channel *chan,
+static void ath9k_hw_set_regs(struct ath_hw *ah, struct ath9k_channel *chan,
                              enum ath9k_ht_macmode macmode)
 {
        u32 phymode;
        u32 enableDacFifo = 0;
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
        if (AR_SREV_9285_10_OR_LATER(ah))
                enableDacFifo = (REG_READ(ah, AR_PHY_TURBO) &
@@ -1643,7 +1566,7 @@ static void ath9k_hw_set_regs(struct ath_hal *ah, struct ath9k_channel *chan,
                    (chan->chanmode == CHANNEL_G_HT40PLUS))
                        phymode |= AR_PHY_FC_DYN2040_PRI_CH;
 
-               if (ahp->ah_extprotspacing == ATH9K_HT_EXTPROTSPACING_25)
+               if (ah->extprotspacing == ATH9K_HT_EXTPROTSPACING_25)
                        phymode |= AR_PHY_FC_DYN2040_EXT_CH;
        }
        REG_WRITE(ah, AR_PHY_TURBO, phymode);
@@ -1654,54 +1577,27 @@ static void ath9k_hw_set_regs(struct ath_hal *ah, struct ath9k_channel *chan,
        REG_WRITE(ah, AR_CST, 0xF << AR_CST_TIMEOUT_LIMIT_S);
 }
 
-static bool ath9k_hw_chip_reset(struct ath_hal *ah,
+static bool ath9k_hw_chip_reset(struct ath_hw *ah,
                                struct ath9k_channel *chan)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        if (!ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM))
                return false;
 
        if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
                return false;
 
-       ahp->ah_chipFullSleep = false;
-
+       ah->chip_fullsleep = false;
        ath9k_hw_init_pll(ah, chan);
-
        ath9k_hw_set_rfmode(ah, chan);
 
        return true;
 }
 
-static struct ath9k_channel *ath9k_hw_check_chan(struct ath_hal *ah,
-                                                struct ath9k_channel *chan)
-{
-       if (!(IS_CHAN_2GHZ(chan) ^ IS_CHAN_5GHZ(chan))) {
-               DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-                       "invalid channel %u/0x%x; not marked as "
-                       "2GHz or 5GHz\n", chan->channel, chan->channelFlags);
-               return NULL;
-       }
-
-       if (!IS_CHAN_OFDM(chan) &&
-           !IS_CHAN_B(chan) &&
-           !IS_CHAN_HT20(chan) &&
-           !IS_CHAN_HT40(chan)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-                       "invalid channel %u/0x%x; not marked as "
-                       "OFDM or CCK or HT20 or HT40PLUS or HT40MINUS\n",
-                       chan->channel, chan->channelFlags);
-               return NULL;
-       }
-
-       return ath9k_regd_check_channel(ah, chan);
-}
-
-static bool ath9k_hw_channel_change(struct ath_hal *ah,
+static bool ath9k_hw_channel_change(struct ath_hw *ah,
                                    struct ath9k_channel *chan,
                                    enum ath9k_ht_macmode macmode)
 {
+       struct ieee80211_channel *channel = chan->chan;
        u32 synthDelay, qnum;
 
        for (qnum = 0; qnum < AR_NUM_QCU; qnum++) {
@@ -1736,12 +1632,12 @@ static bool ath9k_hw_channel_change(struct ath_hal *ah,
                }
        }
 
-       if (ath9k_hw_set_txpower(ah, chan,
-                                ath9k_regd_get_ctl(ah, chan),
-                                ath9k_regd_get_antenna_allowed(ah, chan),
-                                chan->maxRegTxPower * 2,
-                                min((u32) MAX_RATE_POWER,
-                                    (u32) ah->ah_powerLimit)) != 0) {
+       if (ah->eep_ops->set_txpower(ah, chan,
+                            ath9k_regd_get_ctl(ah, chan),
+                            channel->max_antenna_gain * 2,
+                            channel->max_power * 2,
+                            min((u32) MAX_RATE_POWER,
+                                (u32) ah->regulatory.power_limit)) != 0) {
                DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
                        "error init'ing transmit power\n");
                return false;
@@ -1771,7 +1667,7 @@ static bool ath9k_hw_channel_change(struct ath_hal *ah,
        return true;
 }
 
-static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *chan)
+static void ath9k_hw_9280_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan)
 {
        int bb_spur = AR_NO_SPUR;
        int freq;
@@ -1805,9 +1701,9 @@ static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah, struct ath9k_channel
        ath9k_hw_get_channel_centers(ah, chan, &centers);
        freq = centers.synth_center;
 
-       ah->ah_config.spurmode = SPUR_ENABLE_EEPROM;
+       ah->config.spurmode = SPUR_ENABLE_EEPROM;
        for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
-               cur_bb_spur = ath9k_hw_eeprom_get_spur_chan(ah, i, is2GHz);
+               cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
 
                if (is2GHz)
                        cur_bb_spur = (cur_bb_spur / 10) + AR_BASE_FREQ_2GHZ;
@@ -1918,9 +1814,9 @@ static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah, struct ath9k_channel
                if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
 
                        /* workaround for gcc bug #37014 */
-                       volatile int tmp = abs(cur_vit_mask - bin);
+                       volatile int tmp_v = abs(cur_vit_mask - bin);
 
-                       if (tmp < 75)
+                       if (tmp_v < 75)
                                mask_amt = 1;
                        else
                                mask_amt = 0;
@@ -2021,7 +1917,7 @@ static void ath9k_hw_9280_spur_mitigate(struct ath_hal *ah, struct ath9k_channel
        REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
 }
 
-static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *chan)
+static void ath9k_hw_spur_mitigate(struct ath_hw *ah, struct ath9k_channel *chan)
 {
        int bb_spur = AR_NO_SPUR;
        int bin, cur_bin;
@@ -2050,7 +1946,7 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha
        memset(&mask_p, 0, sizeof(int8_t) * 123);
 
        for (i = 0; i < AR_EEPROM_MODAL_SPURS; i++) {
-               cur_bb_spur = ath9k_hw_eeprom_get_spur_chan(ah, i, is2GHz);
+               cur_bb_spur = ah->eep_ops->get_spur_channel(ah, i, is2GHz);
                if (AR_NO_SPUR == cur_bb_spur)
                        break;
                cur_bb_spur = cur_bb_spur - (chan->channel * 10);
@@ -2119,9 +2015,9 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha
                if ((cur_vit_mask > lower) && (cur_vit_mask < upper)) {
 
                        /* workaround for gcc bug #37014 */
-                       volatile int tmp = abs(cur_vit_mask - bin);
+                       volatile int tmp_v = abs(cur_vit_mask - bin);
 
-                       if (tmp < 75)
+                       if (tmp_v < 75)
                                mask_amt = 1;
                        else
                                mask_amt = 0;
@@ -2222,58 +2118,47 @@ static void ath9k_hw_spur_mitigate(struct ath_hal *ah, struct ath9k_channel *cha
        REG_WRITE(ah, AR_PHY_MASK2_P_61_45, tmp_mask);
 }
 
-bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
-                   enum ath9k_ht_macmode macmode,
-                   u8 txchainmask, u8 rxchainmask,
-                   enum ath9k_ht_extprotspacing extprotspacing,
-                   bool bChannelChange, int *status)
+int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
+                   bool bChannelChange)
 {
        u32 saveLedState;
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_channel *curchan = ah->ah_curchan;
+       struct ath_softc *sc = ah->ah_sc;
+       struct ath9k_channel *curchan = ah->curchan;
        u32 saveDefAntenna;
        u32 macStaId1;
-       int ecode;
-       int i, rx_chainmask;
-
-       ahp->ah_extprotspacing = extprotspacing;
-       ahp->ah_txchainmask = txchainmask;
-       ahp->ah_rxchainmask = rxchainmask;
+       int i, rx_chainmask, r;
 
-       if (AR_SREV_9280(ah)) {
-               ahp->ah_txchainmask &= 0x3;
-               ahp->ah_rxchainmask &= 0x3;
-       }
+       ah->extprotspacing = sc->ht_extprotspacing;
+       ah->txchainmask = sc->tx_chainmask;
+       ah->rxchainmask = sc->rx_chainmask;
 
-       if (ath9k_hw_check_chan(ah, chan) == NULL) {
-               DPRINTF(ah->ah_sc, ATH_DBG_CHANNEL,
-                       "invalid channel %u/0x%x; no mapping\n",
-                       chan->channel, chan->channelFlags);
-               ecode = -EINVAL;
-               goto bad;
+       if (AR_SREV_9285(ah)) {
+               ah->txchainmask &= 0x1;
+               ah->rxchainmask &= 0x1;
+       } else if (AR_SREV_9280(ah)) {
+               ah->txchainmask &= 0x3;
+               ah->rxchainmask &= 0x3;
        }
 
-       if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE)) {
-               ecode = -EIO;
-               goto bad;
-       }
+       if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
+               return -EIO;
 
        if (curchan)
                ath9k_hw_getnf(ah, curchan);
 
        if (bChannelChange &&
-           (ahp->ah_chipFullSleep != true) &&
-           (ah->ah_curchan != NULL) &&
-           (chan->channel != ah->ah_curchan->channel) &&
+           (ah->chip_fullsleep != true) &&
+           (ah->curchan != NULL) &&
+           (chan->channel != ah->curchan->channel) &&
            ((chan->channelFlags & CHANNEL_ALL) ==
-            (ah->ah_curchan->channelFlags & CHANNEL_ALL)) &&
+            (ah->curchan->channelFlags & CHANNEL_ALL)) &&
            (!AR_SREV_9280(ah) || (!IS_CHAN_A_5MHZ_SPACED(chan) &&
-                                  !IS_CHAN_A_5MHZ_SPACED(ah->ah_curchan)))) {
+                                  !IS_CHAN_A_5MHZ_SPACED(ah->curchan)))) {
 
-               if (ath9k_hw_channel_change(ah, chan, macmode)) {
-                       ath9k_hw_loadnf(ah, ah->ah_curchan);
+               if (ath9k_hw_channel_change(ah, chan, sc->tx_chan_width)) {
+                       ath9k_hw_loadnf(ah, ah->curchan);
                        ath9k_hw_start_nfcal(ah);
-                       return true;
+                       return 0;
                }
        }
 
@@ -2291,28 +2176,32 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
 
        if (!ath9k_hw_chip_reset(ah, chan)) {
                DPRINTF(ah->ah_sc, ATH_DBG_RESET, "chip reset failed\n");
-               ecode = -EINVAL;
-               goto bad;
+               return -EINVAL;
        }
 
-       if (AR_SREV_9280(ah)) {
-               REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
-                           AR_GPIO_JTAG_DISABLE);
+       if (AR_SREV_9280_10_OR_LATER(ah))
+               REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL, AR_GPIO_JTAG_DISABLE);
 
-               if (test_bit(ATH9K_MODE_11A, ah->ah_caps.wireless_modes)) {
-                       if (IS_CHAN_5GHZ(chan))
-                               ath9k_hw_set_gpio(ah, 9, 0);
-                       else
-                               ath9k_hw_set_gpio(ah, 9, 1);
-               }
-               ath9k_hw_cfg_output(ah, 9, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
-       }
+       r = ath9k_hw_process_ini(ah, chan, sc->tx_chan_width);
+       if (r)
+               return r;
 
-       ecode = ath9k_hw_process_ini(ah, chan, macmode);
-       if (ecode != 0) {
-               ecode = -EINVAL;
-               goto bad;
-       }
+       /* Setup MFP options for CCMP */
+       if (AR_SREV_9280_20_OR_LATER(ah)) {
+               /* Mask Retry(b11), PwrMgt(b12), MoreData(b13) to 0 in mgmt
+                * frames when constructing CCMP AAD. */
+               REG_RMW_FIELD(ah, AR_AES_MUTE_MASK1, AR_AES_MUTE_MASK1_FC_MGMT,
+                             0xc7ff);
+               ah->sw_mgmt_crypto = false;
+       } else if (AR_SREV_9160_10_OR_LATER(ah)) {
+               /* Disable hardware crypto for management frames */
+               REG_CLR_BIT(ah, AR_PCU_MISC_MODE2,
+                           AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE);
+               REG_SET_BIT(ah, AR_PCU_MISC_MODE2,
+                           AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT);
+               ah->sw_mgmt_crypto = true;
+       } else
+               ah->sw_mgmt_crypto = true;
 
        if (IS_CHAN_OFDM(chan) || IS_CHAN_HT(chan))
                ath9k_hw_set_delta_slope(ah, chan);
@@ -2322,61 +2211,56 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
        else
                ath9k_hw_spur_mitigate(ah, chan);
 
-       if (!ath9k_hw_eeprom_set_board_values(ah, chan)) {
+       if (!ah->eep_ops->set_board_values(ah, chan)) {
                DPRINTF(ah->ah_sc, ATH_DBG_EEPROM,
                        "error setting board options\n");
-               ecode = -EIO;
-               goto bad;
+               return -EIO;
        }
 
        ath9k_hw_decrease_chain_power(ah, chan);
 
-       REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(ahp->ah_macaddr));
-       REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(ahp->ah_macaddr + 4)
+       REG_WRITE(ah, AR_STA_ID0, get_unaligned_le32(ah->macaddr));
+       REG_WRITE(ah, AR_STA_ID1, get_unaligned_le16(ah->macaddr + 4)
                  | macStaId1
                  | AR_STA_ID1_RTS_USE_DEF
-                 | (ah->ah_config.
+                 | (ah->config.
                     ack_6mb ? AR_STA_ID1_ACKCTS_6MB : 0)
-                 | ahp->ah_staId1Defaults);
-       ath9k_hw_set_operating_mode(ah, ah->ah_opmode);
+                 | ah->sta_id1_defaults);
+       ath9k_hw_set_operating_mode(ah, ah->opmode);
 
-       REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(ahp->ah_bssidmask));
-       REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(ahp->ah_bssidmask + 4));
+       REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(sc->bssidmask));
+       REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(sc->bssidmask + 4));
 
        REG_WRITE(ah, AR_DEF_ANTENNA, saveDefAntenna);
 
-       REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(ahp->ah_bssid));
-       REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(ahp->ah_bssid + 4) |
-                 ((ahp->ah_assocId & 0x3fff) << AR_BSS_ID1_AID_S));
+       REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(sc->curbssid));
+       REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(sc->curbssid + 4) |
+                 ((sc->curaid & 0x3fff) << AR_BSS_ID1_AID_S));
 
        REG_WRITE(ah, AR_ISR, ~0);
 
        REG_WRITE(ah, AR_RSSI_THR, INIT_RSSI_THR);
 
        if (AR_SREV_9280_10_OR_LATER(ah)) {
-               if (!(ath9k_hw_ar9280_set_channel(ah, chan))) {
-                       ecode = -EIO;
-                       goto bad;
-               }
+               if (!(ath9k_hw_ar9280_set_channel(ah, chan)))
+                       return -EIO;
        } else {
-               if (!(ath9k_hw_set_channel(ah, chan))) {
-                       ecode = -EIO;
-                       goto bad;
-               }
+               if (!(ath9k_hw_set_channel(ah, chan)))
+                       return -EIO;
        }
 
        for (i = 0; i < AR_NUM_DCU; i++)
                REG_WRITE(ah, AR_DQCUMASK(i), 1 << i);
 
-       ahp->ah_intrTxqs = 0;
-       for (i = 0; i < ah->ah_caps.total_queues; i++)
+       ah->intr_txqs = 0;
+       for (i = 0; i < ah->caps.total_queues; i++)
                ath9k_hw_resettxqueue(ah, i);
 
-       ath9k_hw_init_interrupt_masks(ah, ah->ah_opmode);
+       ath9k_hw_init_interrupt_masks(ah, ah->opmode);
        ath9k_hw_init_qos(ah);
 
 #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-       if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
+       if (ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
                ath9k_enable_rfkill(ah);
 #endif
        ath9k_hw_init_user_settings(ah);
@@ -2388,7 +2272,7 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
 
        REG_WRITE(ah, AR_OBS, 8);
 
-       if (ahp->ah_intrMitigation) {
+       if (ah->intr_mitigation) {
 
                REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_LAST, 500);
                REG_RMW_FIELD(ah, AR_RIMT, AR_RIMT_FIRST, 2000);
@@ -2396,12 +2280,10 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
 
        ath9k_hw_init_bb(ah, chan);
 
-       if (!ath9k_hw_init_cal(ah, chan)){
-               ecode = -EIO;;
-               goto bad;
-       }
+       if (!ath9k_hw_init_cal(ah, chan))
+               return -EIO;;
 
-       rx_chainmask = ahp->ah_rxchainmask;
+       rx_chainmask = ah->rxchainmask;
        if ((rx_chainmask == 0x5) || (rx_chainmask == 0x3)) {
                REG_WRITE(ah, AR_PHY_RX_CHAINMASK, rx_chainmask);
                REG_WRITE(ah, AR_PHY_CAL_CHAINMASK, rx_chainmask);
@@ -2428,22 +2310,18 @@ bool ath9k_hw_reset(struct ath_hal *ah, struct ath9k_channel *chan,
 #endif
        }
 
-       return true;
-bad:
-       if (status)
-               *status = ecode;
-       return false;
+       return 0;
 }
 
 /************************/
 /* Key Cache Management */
 /************************/
 
-bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry)
+bool ath9k_hw_keyreset(struct ath_hw *ah, u16 entry)
 {
        u32 keyType;
 
-       if (entry >= ah->ah_caps.keycache_size) {
+       if (entry >= ah->caps.keycache_size) {
                DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
                        "entry %u out of range\n", entry);
                return false;
@@ -2470,17 +2348,17 @@ bool ath9k_hw_keyreset(struct ath_hal *ah, u16 entry)
 
        }
 
-       if (ah->ah_curchan == NULL)
+       if (ah->curchan == NULL)
                return true;
 
        return true;
 }
 
-bool ath9k_hw_keysetmac(struct ath_hal *ah, u16 entry, const u8 *mac)
+bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac)
 {
        u32 macHi, macLo;
 
-       if (entry >= ah->ah_caps.keycache_size) {
+       if (entry >= ah->caps.keycache_size) {
                DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
                        "entry %u out of range\n", entry);
                return false;
@@ -2504,17 +2382,16 @@ bool ath9k_hw_keysetmac(struct ath_hal *ah, u16 entry, const u8 *mac)
        return true;
 }
 
-bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
+bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry,
                                 const struct ath9k_keyval *k,
                                 const u8 *mac, int xorKey)
 {
-       const struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       const struct ath9k_hw_capabilities *pCap = &ah->caps;
        u32 key0, key1, key2, key3, key4;
        u32 keyType;
        u32 xorMask = xorKey ?
                (ATH9K_KEY_XOR << 24 | ATH9K_KEY_XOR << 16 | ATH9K_KEY_XOR << 8
                 | ATH9K_KEY_XOR) : 0;
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
        if (entry >= pCap->keycache_size) {
                DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
@@ -2530,7 +2407,7 @@ bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
                if (!(pCap->hw_caps & ATH9K_HW_CAP_CIPHER_AESCCM)) {
                        DPRINTF(ah->ah_sc, ATH_DBG_KEYCACHE,
                                "AES-CCM not supported by mac rev 0x%x\n",
-                               ah->ah_macRev);
+                               ah->hw_version.macRev);
                        return false;
                }
                keyType = AR_KEYTABLE_TYPE_CCM;
@@ -2585,7 +2462,7 @@ bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
                REG_WRITE(ah, AR_KEYTABLE_TYPE(entry), keyType);
                (void) ath9k_hw_keysetmac(ah, entry, mac);
 
-               if (ahp->ah_miscMode & AR_PCU_MIC_NEW_LOC_ENA) {
+               if (ah->misc_mode & AR_PCU_MIC_NEW_LOC_ENA) {
                        u32 mic0, mic1, mic2, mic3, mic4;
 
                        mic0 = get_unaligned_le32(k->kv_mic + 0);
@@ -2629,15 +2506,15 @@ bool ath9k_hw_set_keycache_entry(struct ath_hal *ah, u16 entry,
                (void) ath9k_hw_keysetmac(ah, entry, mac);
        }
 
-       if (ah->ah_curchan == NULL)
+       if (ah->curchan == NULL)
                return true;
 
        return true;
 }
 
-bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry)
+bool ath9k_hw_keyisvalid(struct ath_hw *ah, u16 entry)
 {
-       if (entry < ah->ah_caps.keycache_size) {
+       if (entry < ah->caps.keycache_size) {
                u32 val = REG_READ(ah, AR_KEYTABLE_MAC1(entry));
                if (val & AR_KEYTABLE_VALID)
                        return true;
@@ -2649,7 +2526,7 @@ bool ath9k_hw_keyisvalid(struct ath_hal *ah, u16 entry)
 /* Power Management (Chipset) */
 /******************************/
 
-static void ath9k_set_power_sleep(struct ath_hal *ah, int setChip)
+static void ath9k_set_power_sleep(struct ath_hw *ah, int setChip)
 {
        REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV);
        if (setChip) {
@@ -2658,16 +2535,16 @@ static void ath9k_set_power_sleep(struct ath_hal *ah, int setChip)
                if (!AR_SREV_9100(ah))
                        REG_WRITE(ah, AR_RC, AR_RC_AHB | AR_RC_HOSTIF);
 
-               REG_CLR_BIT(ah, (u16) (AR_RTC_RESET),
+               REG_CLR_BIT(ah, (AR_RTC_RESET),
                            AR_RTC_RESET_EN);
        }
 }
 
-static void ath9k_set_power_network_sleep(struct ath_hal *ah, int setChip)
+static void ath9k_set_power_network_sleep(struct ath_hw *ah, int setChip)
 {
        REG_SET_BIT(ah, AR_STA_ID1, AR_STA_ID1_PWR_SAV);
        if (setChip) {
-               struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+               struct ath9k_hw_capabilities *pCap = &ah->caps;
 
                if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) {
                        REG_WRITE(ah, AR_RTC_FORCE_WAKE,
@@ -2679,8 +2556,7 @@ static void ath9k_set_power_network_sleep(struct ath_hal *ah, int setChip)
        }
 }
 
-static bool ath9k_hw_set_power_awake(struct ath_hal *ah,
-                                    int setChip)
+static bool ath9k_hw_set_power_awake(struct ath_hw *ah, int setChip)
 {
        u32 val;
        int i;
@@ -2721,20 +2597,18 @@ static bool ath9k_hw_set_power_awake(struct ath_hal *ah,
        return true;
 }
 
-bool ath9k_hw_setpower(struct ath_hal *ah,
-                      enum ath9k_power_mode mode)
+bool ath9k_hw_setpower(struct ath_hw *ah, enum ath9k_power_mode mode)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
+       int status = true, setChip = true;
        static const char *modes[] = {
                "AWAKE",
                "FULL-SLEEP",
                "NETWORK SLEEP",
                "UNDEFINED"
        };
-       int status = true, setChip = true;
 
        DPRINTF(ah->ah_sc, ATH_DBG_POWER_MGMT, "%s -> %s (%s)\n",
-               modes[ahp->ah_powerMode], modes[mode],
+               modes[ah->power_mode], modes[mode],
                setChip ? "set chip " : "");
 
        switch (mode) {
@@ -2743,7 +2617,7 @@ bool ath9k_hw_setpower(struct ath_hal *ah,
                break;
        case ATH9K_PM_FULL_SLEEP:
                ath9k_set_power_sleep(ah, setChip);
-               ahp->ah_chipFullSleep = true;
+               ah->chip_fullsleep = true;
                break;
        case ATH9K_PM_NETWORK_SLEEP:
                ath9k_set_power_network_sleep(ah, setChip);
@@ -2753,41 +2627,57 @@ bool ath9k_hw_setpower(struct ath_hal *ah,
                        "Unknown power mode %u\n", mode);
                return false;
        }
-       ahp->ah_powerMode = mode;
+       ah->power_mode = mode;
 
        return status;
 }
 
-void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore)
+/*
+ * Helper for ASPM support.
+ *
+ * Disable PLL when in L0s as well as receiver clock when in L1.
+ * This power saving option must be enabled through the SerDes.
+ *
+ * Programming the SerDes must go through the same 288 bit serial shift
+ * register as the other analog registers.  Hence the 9 writes.
+ */
+void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        u8 i;
 
-       if (ah->ah_isPciExpress != true)
+       if (ah->is_pciexpress != true)
                return;
 
-       if (ah->ah_config.pcie_powersave_enable == 2)
+       /* Do not touch SerDes registers */
+       if (ah->config.pcie_powersave_enable == 2)
                return;
 
+       /* Nothing to do on restore for 11N */
        if (restore)
                return;
 
        if (AR_SREV_9280_20_OR_LATER(ah)) {
-               for (i = 0; i < ahp->ah_iniPcieSerdes.ia_rows; i++) {
-                       REG_WRITE(ah, INI_RA(&ahp->ah_iniPcieSerdes, i, 0),
-                                 INI_RA(&ahp->ah_iniPcieSerdes, i, 1));
+               /*
+                * AR9280 2.0 or later chips use SerDes values from the
+                * initvals.h initialized depending on chipset during
+                * ath9k_hw_do_attach()
+                */
+               for (i = 0; i < ah->iniPcieSerdes.ia_rows; i++) {
+                       REG_WRITE(ah, INI_RA(&ah->iniPcieSerdes, i, 0),
+                                 INI_RA(&ah->iniPcieSerdes, i, 1));
                }
-               udelay(1000);
        } else if (AR_SREV_9280(ah) &&
-                  (ah->ah_macRev == AR_SREV_REVISION_9280_10)) {
+                  (ah->hw_version.macRev == AR_SREV_REVISION_9280_10)) {
                REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fd00);
                REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924);
 
+               /* RX shut off when elecidle is asserted */
                REG_WRITE(ah, AR_PCIE_SERDES, 0xa8000019);
                REG_WRITE(ah, AR_PCIE_SERDES, 0x13160820);
                REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980560);
 
-               if (ah->ah_config.pcie_clock_req)
+               /* Shut off CLKREQ active in L1 */
+               if (ah->config.pcie_clock_req)
                        REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffc);
                else
                        REG_WRITE(ah, AR_PCIE_SERDES, 0x401deffd);
@@ -2796,42 +2686,59 @@ void ath9k_hw_configpcipowersave(struct ath_hal *ah, int restore)
                REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554);
                REG_WRITE(ah, AR_PCIE_SERDES, 0x00043007);
 
+               /* Load the new settings */
                REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
 
-               udelay(1000);
        } else {
                REG_WRITE(ah, AR_PCIE_SERDES, 0x9248fc00);
                REG_WRITE(ah, AR_PCIE_SERDES, 0x24924924);
+
+               /* RX shut off when elecidle is asserted */
                REG_WRITE(ah, AR_PCIE_SERDES, 0x28000039);
                REG_WRITE(ah, AR_PCIE_SERDES, 0x53160824);
                REG_WRITE(ah, AR_PCIE_SERDES, 0xe5980579);
+
+               /*
+                * Ignore ah->ah_config.pcie_clock_req setting for
+                * pre-AR9280 11n
+                */
                REG_WRITE(ah, AR_PCIE_SERDES, 0x001defff);
+
                REG_WRITE(ah, AR_PCIE_SERDES, 0x1aaabe40);
                REG_WRITE(ah, AR_PCIE_SERDES, 0xbe105554);
                REG_WRITE(ah, AR_PCIE_SERDES, 0x000e3007);
+
+               /* Load the new settings */
                REG_WRITE(ah, AR_PCIE_SERDES2, 0x00000000);
        }
 
+       udelay(1000);
+
+       /* set bit 19 to allow forcing of pcie core into L1 state */
        REG_SET_BIT(ah, AR_PCIE_PM_CTRL, AR_PCIE_PM_CTRL_ENA);
 
-       if (ah->ah_config.pcie_waen) {
-               REG_WRITE(ah, AR_WA, ah->ah_config.pcie_waen);
+       /* Several PCIe massages to ensure proper behaviour */
+       if (ah->config.pcie_waen) {
+               REG_WRITE(ah, AR_WA, ah->config.pcie_waen);
        } else {
                if (AR_SREV_9285(ah))
                        REG_WRITE(ah, AR_WA, AR9285_WA_DEFAULT);
+               /*
+                * On AR9280 chips bit 22 of 0x4004 needs to be set to
+                * otherwise card may disappear.
+                */
                else if (AR_SREV_9280(ah))
                        REG_WRITE(ah, AR_WA, AR9280_WA_DEFAULT);
                else
                        REG_WRITE(ah, AR_WA, AR_WA_DEFAULT);
        }
-
 }
 
 /**********************/
 /* Interrupt Handling */
 /**********************/
 
-bool ath9k_hw_intrpend(struct ath_hal *ah)
+bool ath9k_hw_intrpend(struct ath_hw *ah)
 {
        u32 host_isr;
 
@@ -2850,14 +2757,13 @@ bool ath9k_hw_intrpend(struct ath_hal *ah)
        return false;
 }
 
-bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked)
+bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked)
 {
        u32 isr = 0;
        u32 mask2 = 0;
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
        u32 sync_cause = 0;
        bool fatal_int = false;
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
        if (!AR_SREV_9100(ah)) {
                if (REG_READ(ah, AR_INTR_ASYNC_CAUSE) & AR_INTR_MAC_IRQ) {
@@ -2905,7 +2811,7 @@ bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked)
 
                *masked = isr & ATH9K_INT_COMMON;
 
-               if (ahp->ah_intrMitigation) {
+               if (ah->intr_mitigation) {
                        if (isr & (AR_ISR_RXMINTR | AR_ISR_RXINTM))
                                *masked |= ATH9K_INT_RX;
                }
@@ -2920,12 +2826,12 @@ bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked)
                        *masked |= ATH9K_INT_TX;
 
                        s0_s = REG_READ(ah, AR_ISR_S0_S);
-                       ahp->ah_intrTxqs |= MS(s0_s, AR_ISR_S0_QCU_TXOK);
-                       ahp->ah_intrTxqs |= MS(s0_s, AR_ISR_S0_QCU_TXDESC);
+                       ah->intr_txqs |= MS(s0_s, AR_ISR_S0_QCU_TXOK);
+                       ah->intr_txqs |= MS(s0_s, AR_ISR_S0_QCU_TXDESC);
 
                        s1_s = REG_READ(ah, AR_ISR_S1_S);
-                       ahp->ah_intrTxqs |= MS(s1_s, AR_ISR_S1_QCU_TXERR);
-                       ahp->ah_intrTxqs |= MS(s1_s, AR_ISR_S1_QCU_TXEOL);
+                       ah->intr_txqs |= MS(s1_s, AR_ISR_S1_QCU_TXERR);
+                       ah->intr_txqs |= MS(s1_s, AR_ISR_S1_QCU_TXEOL);
                }
 
                if (isr & AR_ISR_RXORN) {
@@ -2982,17 +2888,16 @@ bool ath9k_hw_getisr(struct ath_hal *ah, enum ath9k_int *masked)
        return true;
 }
 
-enum ath9k_int ath9k_hw_intrget(struct ath_hal *ah)
+enum ath9k_int ath9k_hw_intrget(struct ath_hw *ah)
 {
-       return AH5416(ah)->ah_maskReg;
+       return ah->mask_reg;
 }
 
-enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints)
+enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       u32 omask = ahp->ah_maskReg;
+       u32 omask = ah->mask_reg;
        u32 mask, mask2;
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
 
        DPRINTF(ah->ah_sc, ATH_DBG_INTERRUPT, "0x%x => 0x%x\n", omask, ints);
 
@@ -3013,18 +2918,18 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints)
        mask2 = 0;
 
        if (ints & ATH9K_INT_TX) {
-               if (ahp->ah_txOkInterruptMask)
+               if (ah->txok_interrupt_mask)
                        mask |= AR_IMR_TXOK;
-               if (ahp->ah_txDescInterruptMask)
+               if (ah->txdesc_interrupt_mask)
                        mask |= AR_IMR_TXDESC;
-               if (ahp->ah_txErrInterruptMask)
+               if (ah->txerr_interrupt_mask)
                        mask |= AR_IMR_TXERR;
-               if (ahp->ah_txEolInterruptMask)
+               if (ah->txeol_interrupt_mask)
                        mask |= AR_IMR_TXEOL;
        }
        if (ints & ATH9K_INT_RX) {
                mask |= AR_IMR_RXERR;
-               if (ahp->ah_intrMitigation)
+               if (ah->intr_mitigation)
                        mask |= AR_IMR_RXMINTR | AR_IMR_RXINTM;
                else
                        mask |= AR_IMR_RXOK | AR_IMR_RXDESC;
@@ -3062,7 +2967,7 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints)
                                           AR_IMR_S2_TSFOOR |
                                           AR_IMR_S2_GTT | AR_IMR_S2_CST);
        REG_WRITE(ah, AR_IMR_S2, mask | mask2);
-       ahp->ah_maskReg = ints;
+       ah->mask_reg = ints;
 
        if (!(pCap->hw_caps & ATH9K_HW_CAP_AUTOSLEEP)) {
                if (ints & ATH9K_INT_TIM_TIMER)
@@ -3096,14 +3001,13 @@ enum ath9k_int ath9k_hw_set_interrupts(struct ath_hal *ah, enum ath9k_int ints)
 /* Beacon Handling */
 /*******************/
 
-void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period)
+void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        int flags = 0;
 
-       ahp->ah_beaconInterval = beacon_period;
+       ah->beacon_interval = beacon_period;
 
-       switch (ah->ah_opmode) {
+       switch (ah->opmode) {
        case NL80211_IFTYPE_STATION:
        case NL80211_IFTYPE_MONITOR:
                REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(next_beacon));
@@ -3116,18 +3020,18 @@ void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period)
                            AR_TXCFG_ADHOC_BEACON_ATIM_TX_POLICY);
                REG_WRITE(ah, AR_NEXT_NDP_TIMER,
                          TU_TO_USEC(next_beacon +
-                                    (ahp->ah_atimWindow ? ahp->
-                                     ah_atimWindow : 1)));
+                                    (ah->atim_window ? ah->
+                                     atim_window : 1)));
                flags |= AR_NDP_TIMER_EN;
        case NL80211_IFTYPE_AP:
                REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(next_beacon));
                REG_WRITE(ah, AR_NEXT_DMA_BEACON_ALERT,
                          TU_TO_USEC(next_beacon -
-                                    ah->ah_config.
+                                    ah->config.
                                     dma_beacon_response_time));
                REG_WRITE(ah, AR_NEXT_SWBA,
                          TU_TO_USEC(next_beacon -
-                                    ah->ah_config.
+                                    ah->config.
                                     sw_beacon_response_time));
                flags |=
                        AR_TBTT_TIMER_EN | AR_DBA_TIMER_EN | AR_SWBA_TIMER_EN;
@@ -3135,7 +3039,7 @@ void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period)
        default:
                DPRINTF(ah->ah_sc, ATH_DBG_BEACON,
                        "%s: unsupported opmode: %d\n",
-                       __func__, ah->ah_opmode);
+                       __func__, ah->opmode);
                return;
                break;
        }
@@ -3154,11 +3058,11 @@ void ath9k_hw_beaconinit(struct ath_hal *ah, u32 next_beacon, u32 beacon_period)
        REG_SET_BIT(ah, AR_TIMER_MODE, flags);
 }
 
-void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah,
+void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
                                    const struct ath9k_beacon_state *bs)
 {
        u32 nextTbtt, beaconintval, dtimperiod, beacontimeout;
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
 
        REG_WRITE(ah, AR_NEXT_TBTT_TIMER, TU_TO_USEC(bs->bs_nexttbtt));
 
@@ -3218,37 +3122,37 @@ void ath9k_hw_set_sta_beacon_timers(struct ath_hal *ah,
 /* HW Capabilities */
 /*******************/
 
-bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
+bool ath9k_hw_fill_cap_info(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
        u16 capField = 0, eeval;
 
-       eeval = ath9k_hw_get_eeprom(ah, EEP_REG_0);
+       eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_0);
 
-       ah->ah_currentRD = eeval;
+       ah->regulatory.current_rd = eeval;
 
-       eeval = ath9k_hw_get_eeprom(ah, EEP_REG_1);
-       ah->ah_currentRDExt = eeval;
+       eeval = ah->eep_ops->get_eeprom(ah, EEP_REG_1);
+       ah->regulatory.current_rd_ext = eeval;
 
-       capField = ath9k_hw_get_eeprom(ah, EEP_OP_CAP);
+       capField = ah->eep_ops->get_eeprom(ah, EEP_OP_CAP);
 
-       if (ah->ah_opmode != NL80211_IFTYPE_AP &&
-           ah->ah_subvendorid == AR_SUBVENDOR_ID_NEW_A) {
-               if (ah->ah_currentRD == 0x64 || ah->ah_currentRD == 0x65)
-                       ah->ah_currentRD += 5;
-               else if (ah->ah_currentRD == 0x41)
-                       ah->ah_currentRD = 0x43;
+       if (ah->opmode != NL80211_IFTYPE_AP &&
+           ah->hw_version.subvendorid == AR_SUBVENDOR_ID_NEW_A) {
+               if (ah->regulatory.current_rd == 0x64 ||
+                   ah->regulatory.current_rd == 0x65)
+                       ah->regulatory.current_rd += 5;
+               else if (ah->regulatory.current_rd == 0x41)
+                       ah->regulatory.current_rd = 0x43;
                DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "regdomain mapped to 0x%x\n", ah->ah_currentRD);
+                       "regdomain mapped to 0x%x\n", ah->regulatory.current_rd);
        }
 
-       eeval = ath9k_hw_get_eeprom(ah, EEP_OP_MODE);
+       eeval = ah->eep_ops->get_eeprom(ah, EEP_OP_MODE);
        bitmap_zero(pCap->wireless_modes, ATH9K_MODE_MAX);
 
        if (eeval & AR5416_OPFLAGS_11A) {
                set_bit(ATH9K_MODE_11A, pCap->wireless_modes);
-               if (ah->ah_config.ht_enable) {
+               if (ah->config.ht_enable) {
                        if (!(eeval & AR5416_OPFLAGS_N_5G_HT20))
                                set_bit(ATH9K_MODE_11NA_HT20,
                                        pCap->wireless_modes);
@@ -3264,7 +3168,7 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
        if (eeval & AR5416_OPFLAGS_11G) {
                set_bit(ATH9K_MODE_11B, pCap->wireless_modes);
                set_bit(ATH9K_MODE_11G, pCap->wireless_modes);
-               if (ah->ah_config.ht_enable) {
+               if (ah->config.ht_enable) {
                        if (!(eeval & AR5416_OPFLAGS_N_2G_HT20))
                                set_bit(ATH9K_MODE_11NG_HT20,
                                        pCap->wireless_modes);
@@ -3277,18 +3181,18 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
                }
        }
 
-       pCap->tx_chainmask = ath9k_hw_get_eeprom(ah, EEP_TX_MASK);
-       if ((ah->ah_isPciExpress)
+       pCap->tx_chainmask = ah->eep_ops->get_eeprom(ah, EEP_TX_MASK);
+       if ((ah->is_pciexpress)
            || (eeval & AR5416_OPFLAGS_11A)) {
                pCap->rx_chainmask =
-                       ath9k_hw_get_eeprom(ah, EEP_RX_MASK);
+                       ah->eep_ops->get_eeprom(ah, EEP_RX_MASK);
        } else {
                pCap->rx_chainmask =
                        (ath9k_hw_gpio_get(ah, 0)) ? 0x5 : 0x7;
        }
 
-       if (!(AR_SREV_9280(ah) && (ah->ah_macRev == 0)))
-               ahp->ah_miscMode |= AR_PCU_MIC_NEW_LOC_ENA;
+       if (!(AR_SREV_9280(ah) && (ah->hw_version.macRev == 0)))
+               ah->misc_mode |= AR_PCU_MIC_NEW_LOC_ENA;
 
        pCap->low_2ghz_chan = 2312;
        pCap->high_2ghz_chan = 2732;
@@ -3306,7 +3210,7 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
 
        pCap->hw_caps |= ATH9K_HW_CAP_CHAN_SPREAD;
 
-       if (ah->ah_config.ht_enable)
+       if (ah->config.ht_enable)
                pCap->hw_caps |= ATH9K_HW_CAP_HT;
        else
                pCap->hw_caps &= ~ATH9K_HW_CAP_HT;
@@ -3332,7 +3236,9 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
        pCap->num_mr_retries = 4;
        pCap->tx_triglevel_max = MAX_TX_FIFO_THRESHOLD;
 
-       if (AR_SREV_9280_10_OR_LATER(ah))
+       if (AR_SREV_9285_10_OR_LATER(ah))
+               pCap->num_gpio_pins = AR9285_NUM_GPIO;
+       else if (AR_SREV_9280_10_OR_LATER(ah))
                pCap->num_gpio_pins = AR928X_NUM_GPIO;
        else
                pCap->num_gpio_pins = AR_NUM_GPIO;
@@ -3355,22 +3261,22 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
        pCap->hw_caps |= ATH9K_HW_CAP_ENHANCEDPM;
 
 #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-       ah->ah_rfsilent = ath9k_hw_get_eeprom(ah, EEP_RF_SILENT);
-       if (ah->ah_rfsilent & EEP_RFSILENT_ENABLED) {
-               ah->ah_rfkill_gpio =
-                       MS(ah->ah_rfsilent, EEP_RFSILENT_GPIO_SEL);
-               ah->ah_rfkill_polarity =
-                       MS(ah->ah_rfsilent, EEP_RFSILENT_POLARITY);
+       ah->rfsilent = ah->eep_ops->get_eeprom(ah, EEP_RF_SILENT);
+       if (ah->rfsilent & EEP_RFSILENT_ENABLED) {
+               ah->rfkill_gpio =
+                       MS(ah->rfsilent, EEP_RFSILENT_GPIO_SEL);
+               ah->rfkill_polarity =
+                       MS(ah->rfsilent, EEP_RFSILENT_POLARITY);
 
                pCap->hw_caps |= ATH9K_HW_CAP_RFSILENT;
        }
 #endif
 
-       if ((ah->ah_macVersion == AR_SREV_VERSION_5416_PCI) ||
-           (ah->ah_macVersion == AR_SREV_VERSION_5416_PCIE) ||
-           (ah->ah_macVersion == AR_SREV_VERSION_9160) ||
-           (ah->ah_macVersion == AR_SREV_VERSION_9100) ||
-           (ah->ah_macVersion == AR_SREV_VERSION_9280))
+       if ((ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCI) ||
+           (ah->hw_version.macVersion == AR_SREV_VERSION_5416_PCIE) ||
+           (ah->hw_version.macVersion == AR_SREV_VERSION_9160) ||
+           (ah->hw_version.macVersion == AR_SREV_VERSION_9100) ||
+           (ah->hw_version.macVersion == AR_SREV_VERSION_9280))
                pCap->hw_caps &= ~ATH9K_HW_CAP_AUTOSLEEP;
        else
                pCap->hw_caps |= ATH9K_HW_CAP_AUTOSLEEP;
@@ -3380,7 +3286,7 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
        else
                pCap->hw_caps |= ATH9K_HW_CAP_4KB_SPLITTRANS;
 
-       if (ah->ah_currentRDExt & (1 << REG_EXT_JAPAN_MIDBAND)) {
+       if (ah->regulatory.current_rd_ext & (1 << REG_EXT_JAPAN_MIDBAND)) {
                pCap->reg_cap =
                        AR_EEPROM_EEREGCAP_EN_KK_NEW_11A |
                        AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN |
@@ -3395,18 +3301,23 @@ bool ath9k_hw_fill_cap_info(struct ath_hal *ah)
        pCap->reg_cap |= AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND;
 
        pCap->num_antcfg_5ghz =
-               ath9k_hw_get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_5GHZ);
+               ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_5GHZ);
        pCap->num_antcfg_2ghz =
-               ath9k_hw_get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ);
+               ah->eep_ops->get_num_ant_config(ah, ATH9K_HAL_FREQ_BAND_2GHZ);
+
+       if (AR_SREV_9280_10_OR_LATER(ah) && btcoex_enable) {
+               pCap->hw_caps |= ATH9K_HW_CAP_BT_COEX;
+               ah->btactive_gpio = 6;
+               ah->wlanactive_gpio = 5;
+       }
 
        return true;
 }
 
-bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type,
+bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type,
                            u32 capability, u32 *result)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       const struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       const struct ath9k_hw_capabilities *pCap = &ah->caps;
 
        switch (type) {
        case ATH9K_CAP_CIPHER:
@@ -3426,17 +3337,17 @@ bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type,
                case 0:
                        return true;
                case 1:
-                       return (ahp->ah_staId1Defaults &
+                       return (ah->sta_id1_defaults &
                                AR_STA_ID1_CRPT_MIC_ENABLE) ? true :
                        false;
                }
        case ATH9K_CAP_TKIP_SPLIT:
-               return (ahp->ah_miscMode & AR_PCU_MIC_NEW_LOC_ENA) ?
+               return (ah->misc_mode & AR_PCU_MIC_NEW_LOC_ENA) ?
                        false : true;
        case ATH9K_CAP_WME_TKIPMIC:
                return 0;
        case ATH9K_CAP_PHYCOUNTERS:
-               return ahp->ah_hasHwPhyCounters ? 0 : -ENXIO;
+               return ah->has_hw_phycounters ? 0 : -ENXIO;
        case ATH9K_CAP_DIVERSITY:
                return (REG_READ(ah, AR_PHY_CCK_DETECT) &
                        AR_PHY_CCK_DETECT_BB_ENABLE_ANT_FAST_DIV) ?
@@ -3451,14 +3362,14 @@ bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type,
                        if (REG_READ(ah, AR_STA_ID1) & AR_STA_ID1_ADHOC) {
                                return false;
                        } else {
-                               return (ahp->ah_staId1Defaults &
+                               return (ah->sta_id1_defaults &
                                        AR_STA_ID1_MCAST_KSRCH) ? true :
                                        false;
                        }
                }
                return false;
        case ATH9K_CAP_TSF_ADJUST:
-               return (ahp->ah_miscMode & AR_PCU_TX_ADD_TSF) ?
+               return (ah->misc_mode & AR_PCU_TX_ADD_TSF) ?
                        true : false;
        case ATH9K_CAP_RFSILENT:
                if (capability == 3)
@@ -3474,13 +3385,13 @@ bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type,
                case 0:
                        return 0;
                case 1:
-                       *result = ah->ah_powerLimit;
+                       *result = ah->regulatory.power_limit;
                        return 0;
                case 2:
-                       *result = ah->ah_maxPowerLevel;
+                       *result = ah->regulatory.max_power_level;
                        return 0;
                case 3:
-                       *result = ah->ah_tpScale;
+                       *result = ah->regulatory.tp_scale;
                        return 0;
                }
                return false;
@@ -3489,19 +3400,18 @@ bool ath9k_hw_getcapability(struct ath_hal *ah, enum ath9k_capability_type type,
        }
 }
 
-bool ath9k_hw_setcapability(struct ath_hal *ah, enum ath9k_capability_type type,
+bool ath9k_hw_setcapability(struct ath_hw *ah, enum ath9k_capability_type type,
                            u32 capability, u32 setting, int *status)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        u32 v;
 
        switch (type) {
        case ATH9K_CAP_TKIP_MIC:
                if (setting)
-                       ahp->ah_staId1Defaults |=
+                       ah->sta_id1_defaults |=
                                AR_STA_ID1_CRPT_MIC_ENABLE;
                else
-                       ahp->ah_staId1Defaults &=
+                       ah->sta_id1_defaults &=
                                ~AR_STA_ID1_CRPT_MIC_ENABLE;
                return true;
        case ATH9K_CAP_DIVERSITY:
@@ -3514,15 +3424,15 @@ bool ath9k_hw_setcapability(struct ath_hal *ah, enum ath9k_capability_type type,
                return true;
        case ATH9K_CAP_MCAST_KEYSRCH:
                if (setting)
-                       ahp->ah_staId1Defaults |= AR_STA_ID1_MCAST_KSRCH;
+                       ah->sta_id1_defaults |= AR_STA_ID1_MCAST_KSRCH;
                else
-                       ahp->ah_staId1Defaults &= ~AR_STA_ID1_MCAST_KSRCH;
+                       ah->sta_id1_defaults &= ~AR_STA_ID1_MCAST_KSRCH;
                return true;
        case ATH9K_CAP_TSF_ADJUST:
                if (setting)
-                       ahp->ah_miscMode |= AR_PCU_TX_ADD_TSF;
+                       ah->misc_mode |= AR_PCU_TX_ADD_TSF;
                else
-                       ahp->ah_miscMode &= ~AR_PCU_TX_ADD_TSF;
+                       ah->misc_mode &= ~AR_PCU_TX_ADD_TSF;
                return true;
        default:
                return false;
@@ -3533,7 +3443,7 @@ bool ath9k_hw_setcapability(struct ath_hal *ah, enum ath9k_capability_type type,
 /* GPIO / RFKILL / Antennae */
 /****************************/
 
-static void ath9k_hw_gpio_cfg_output_mux(struct ath_hal *ah,
+static void ath9k_hw_gpio_cfg_output_mux(struct ath_hw *ah,
                                         u32 gpio, u32 type)
 {
        int addr;
@@ -3561,11 +3471,11 @@ static void ath9k_hw_gpio_cfg_output_mux(struct ath_hal *ah,
        }
 }
 
-void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio)
+void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio)
 {
        u32 gpio_shift;
 
-       ASSERT(gpio < ah->ah_caps.num_gpio_pins);
+       ASSERT(gpio < ah->caps.num_gpio_pins);
 
        gpio_shift = gpio << 1;
 
@@ -3575,22 +3485,23 @@ void ath9k_hw_cfg_gpio_input(struct ath_hal *ah, u32 gpio)
                (AR_GPIO_OE_OUT_DRV << gpio_shift));
 }
 
-u32 ath9k_hw_gpio_get(struct ath_hal *ah, u32 gpio)
+u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio)
 {
-       if (gpio >= ah->ah_caps.num_gpio_pins)
+#define MS_REG_READ(x, y) \
+       (MS(REG_READ(ah, AR_GPIO_IN_OUT), x##_GPIO_IN_VAL) & (AR_GPIO_BIT(y)))
+
+       if (gpio >= ah->caps.num_gpio_pins)
                return 0xffffffff;
 
-       if (AR_SREV_9280_10_OR_LATER(ah)) {
-               return (MS
-                       (REG_READ(ah, AR_GPIO_IN_OUT),
-                        AR928X_GPIO_IN_VAL) & AR_GPIO_BIT(gpio)) != 0;
-       } else {
-               return (MS(REG_READ(ah, AR_GPIO_IN_OUT), AR_GPIO_IN_VAL) &
-                       AR_GPIO_BIT(gpio)) != 0;
-       }
+       if (AR_SREV_9285_10_OR_LATER(ah))
+               return MS_REG_READ(AR9285, gpio) != 0;
+       else if (AR_SREV_9280_10_OR_LATER(ah))
+               return MS_REG_READ(AR928X, gpio) != 0;
+       else
+               return MS_REG_READ(AR, gpio) != 0;
 }
 
-void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio,
+void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
                         u32 ah_signal_type)
 {
        u32 gpio_shift;
@@ -3605,14 +3516,14 @@ void ath9k_hw_cfg_output(struct ath_hal *ah, u32 gpio,
                (AR_GPIO_OE_OUT_DRV << gpio_shift));
 }
 
-void ath9k_hw_set_gpio(struct ath_hal *ah, u32 gpio, u32 val)
+void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val)
 {
        REG_RMW(ah, AR_GPIO_IN_OUT, ((val & 1) << gpio),
                AR_GPIO_BIT(gpio));
 }
 
 #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-void ath9k_enable_rfkill(struct ath_hal *ah)
+void ath9k_enable_rfkill(struct ath_hw *ah)
 {
        REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
                    AR_GPIO_INPUT_EN_VAL_RFSILENT_BB);
@@ -3620,50 +3531,28 @@ void ath9k_enable_rfkill(struct ath_hal *ah)
        REG_CLR_BIT(ah, AR_GPIO_INPUT_MUX2,
                    AR_GPIO_INPUT_MUX2_RFSILENT);
 
-       ath9k_hw_cfg_gpio_input(ah, ah->ah_rfkill_gpio);
+       ath9k_hw_cfg_gpio_input(ah, ah->rfkill_gpio);
        REG_SET_BIT(ah, AR_PHY_TEST, RFSILENT_BB);
 }
 #endif
 
-int ath9k_hw_select_antconfig(struct ath_hal *ah, u32 cfg)
-{
-       struct ath9k_channel *chan = ah->ah_curchan;
-       const struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
-       u16 ant_config;
-       u32 halNumAntConfig;
-
-       halNumAntConfig = IS_CHAN_2GHZ(chan) ?
-               pCap->num_antcfg_2ghz : pCap->num_antcfg_5ghz;
-
-       if (cfg < halNumAntConfig) {
-               if (!ath9k_hw_get_eeprom_antenna_cfg(ah, chan,
-                                                    cfg, &ant_config)) {
-                       REG_WRITE(ah, AR_PHY_SWITCH_COM, ant_config);
-                       return 0;
-               }
-       }
-
-       return -EINVAL;
-}
-
-u32 ath9k_hw_getdefantenna(struct ath_hal *ah)
+u32 ath9k_hw_getdefantenna(struct ath_hw *ah)
 {
        return REG_READ(ah, AR_DEF_ANTENNA) & 0x7;
 }
 
-void ath9k_hw_setantenna(struct ath_hal *ah, u32 antenna)
+void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna)
 {
        REG_WRITE(ah, AR_DEF_ANTENNA, (antenna & 0x7));
 }
 
-bool ath9k_hw_setantennaswitch(struct ath_hal *ah,
+bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
                               enum ath9k_ant_setting settings,
                               struct ath9k_channel *chan,
                               u8 *tx_chainmask,
                               u8 *rx_chainmask,
                               u8 *antenna_cfgd)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        static u8 tx_chainmask_cfg, rx_chainmask_cfg;
 
        if (AR_SREV_9280(ah)) {
@@ -3680,7 +3569,7 @@ bool ath9k_hw_setantennaswitch(struct ath_hal *ah,
                        *antenna_cfgd = true;
                        break;
                case ATH9K_ANT_FIXED_B:
-                       if (ah->ah_caps.tx_chainmask >
+                       if (ah->caps.tx_chainmask >
                            ATH9K_ANTENNA1_CHAINMASK) {
                                *tx_chainmask = ATH9K_ANTENNA1_CHAINMASK;
                        }
@@ -3696,7 +3585,7 @@ bool ath9k_hw_setantennaswitch(struct ath_hal *ah,
                        break;
                }
        } else {
-               ahp->ah_diversityControl = settings;
+               ah->diversity_control = settings;
        }
 
        return true;
@@ -3706,7 +3595,7 @@ bool ath9k_hw_setantennaswitch(struct ath_hal *ah,
 /* General Operation */
 /*********************/
 
-u32 ath9k_hw_getrxfilter(struct ath_hal *ah)
+u32 ath9k_hw_getrxfilter(struct ath_hw *ah)
 {
        u32 bits = REG_READ(ah, AR_RX_FILTER);
        u32 phybits = REG_READ(ah, AR_PHY_ERR);
@@ -3719,7 +3608,7 @@ u32 ath9k_hw_getrxfilter(struct ath_hal *ah)
        return bits;
 }
 
-void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits)
+void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits)
 {
        u32 phybits;
 
@@ -3739,12 +3628,12 @@ void ath9k_hw_setrxfilter(struct ath_hal *ah, u32 bits)
                          REG_READ(ah, AR_RXCFG) & ~AR_RXCFG_ZLFDMA);
 }
 
-bool ath9k_hw_phy_disable(struct ath_hal *ah)
+bool ath9k_hw_phy_disable(struct ath_hw *ah)
 {
        return ath9k_hw_set_reset_reg(ah, ATH9K_RESET_WARM);
 }
 
-bool ath9k_hw_disable(struct ath_hal *ah)
+bool ath9k_hw_disable(struct ath_hw *ah)
 {
        if (!ath9k_hw_setpower(ah, ATH9K_PM_AWAKE))
                return false;
@@ -3752,82 +3641,54 @@ bool ath9k_hw_disable(struct ath_hal *ah)
        return ath9k_hw_set_reset_reg(ah, ATH9K_RESET_COLD);
 }
 
-bool ath9k_hw_set_txpowerlimit(struct ath_hal *ah, u32 limit)
+bool ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit)
 {
-       struct ath9k_channel *chan = ah->ah_curchan;
+       struct ath9k_channel *chan = ah->curchan;
+       struct ieee80211_channel *channel = chan->chan;
 
-       ah->ah_powerLimit = min(limit, (u32) MAX_RATE_POWER);
+       ah->regulatory.power_limit = min(limit, (u32) MAX_RATE_POWER);
 
-       if (ath9k_hw_set_txpower(ah, chan,
-                                ath9k_regd_get_ctl(ah, chan),
-                                ath9k_regd_get_antenna_allowed(ah, chan),
-                                chan->maxRegTxPower * 2,
-                                min((u32) MAX_RATE_POWER,
-                                    (u32) ah->ah_powerLimit)) != 0)
+       if (ah->eep_ops->set_txpower(ah, chan,
+                            ath9k_regd_get_ctl(ah, chan),
+                            channel->max_antenna_gain * 2,
+                            channel->max_power * 2,
+                            min((u32) MAX_RATE_POWER,
+                                (u32) ah->regulatory.power_limit)) != 0)
                return false;
 
        return true;
 }
 
-void ath9k_hw_getmac(struct ath_hal *ah, u8 *mac)
+void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       memcpy(mac, ahp->ah_macaddr, ETH_ALEN);
+       memcpy(ah->macaddr, mac, ETH_ALEN);
 }
 
-bool ath9k_hw_setmac(struct ath_hal *ah, const u8 *mac)
+void ath9k_hw_setopmode(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       memcpy(ahp->ah_macaddr, mac, ETH_ALEN);
-
-       return true;
-}
-
-void ath9k_hw_setopmode(struct ath_hal *ah)
-{
-       ath9k_hw_set_operating_mode(ah, ah->ah_opmode);
+       ath9k_hw_set_operating_mode(ah, ah->opmode);
 }
 
-void ath9k_hw_setmcastfilter(struct ath_hal *ah, u32 filter0, u32 filter1)
+void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1)
 {
        REG_WRITE(ah, AR_MCAST_FIL0, filter0);
        REG_WRITE(ah, AR_MCAST_FIL1, filter1);
 }
 
-void ath9k_hw_getbssidmask(struct ath_hal *ah, u8 *mask)
+void ath9k_hw_setbssidmask(struct ath_softc *sc)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       memcpy(mask, ahp->ah_bssidmask, ETH_ALEN);
+       REG_WRITE(sc->sc_ah, AR_BSSMSKL, get_unaligned_le32(sc->bssidmask));
+       REG_WRITE(sc->sc_ah, AR_BSSMSKU, get_unaligned_le16(sc->bssidmask + 4));
 }
 
-bool ath9k_hw_setbssidmask(struct ath_hal *ah, const u8 *mask)
+void ath9k_hw_write_associd(struct ath_softc *sc)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       memcpy(ahp->ah_bssidmask, mask, ETH_ALEN);
-
-       REG_WRITE(ah, AR_BSSMSKL, get_unaligned_le32(ahp->ah_bssidmask));
-       REG_WRITE(ah, AR_BSSMSKU, get_unaligned_le16(ahp->ah_bssidmask + 4));
-
-       return true;
-}
-
-void ath9k_hw_write_associd(struct ath_hal *ah, const u8 *bssid, u16 assocId)
-{
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       memcpy(ahp->ah_bssid, bssid, ETH_ALEN);
-       ahp->ah_assocId = assocId;
-
-       REG_WRITE(ah, AR_BSS_ID0, get_unaligned_le32(ahp->ah_bssid));
-       REG_WRITE(ah, AR_BSS_ID1, get_unaligned_le16(ahp->ah_bssid + 4) |
-                 ((assocId & 0x3fff) << AR_BSS_ID1_AID_S));
+       REG_WRITE(sc->sc_ah, AR_BSS_ID0, get_unaligned_le32(sc->curbssid));
+       REG_WRITE(sc->sc_ah, AR_BSS_ID1, get_unaligned_le16(sc->curbssid + 4) |
+                 ((sc->curaid & 0x3fff) << AR_BSS_ID1_AID_S));
 }
 
-u64 ath9k_hw_gettsf64(struct ath_hal *ah)
+u64 ath9k_hw_gettsf64(struct ath_hw *ah)
 {
        u64 tsf;
 
@@ -3837,7 +3698,14 @@ u64 ath9k_hw_gettsf64(struct ath_hal *ah)
        return tsf;
 }
 
-void ath9k_hw_reset_tsf(struct ath_hal *ah)
+void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64)
+{
+       REG_WRITE(ah, AR_TSF_L32, 0x00000000);
+       REG_WRITE(ah, AR_TSF_U32, (tsf64 >> 32) & 0xffffffff);
+       REG_WRITE(ah, AR_TSF_L32, tsf64 & 0xffffffff);
+}
+
+void ath9k_hw_reset_tsf(struct ath_hw *ah)
 {
        int count;
 
@@ -3854,42 +3722,65 @@ void ath9k_hw_reset_tsf(struct ath_hal *ah)
        REG_WRITE(ah, AR_RESET_TSF, AR_RESET_TSF_ONCE);
 }
 
-bool ath9k_hw_set_tsfadjust(struct ath_hal *ah, u32 setting)
+bool ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        if (setting)
-               ahp->ah_miscMode |= AR_PCU_TX_ADD_TSF;
+               ah->misc_mode |= AR_PCU_TX_ADD_TSF;
        else
-               ahp->ah_miscMode &= ~AR_PCU_TX_ADD_TSF;
+               ah->misc_mode &= ~AR_PCU_TX_ADD_TSF;
 
        return true;
 }
 
-bool ath9k_hw_setslottime(struct ath_hal *ah, u32 us)
+bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        if (us < ATH9K_SLOT_TIME_9 || us > ath9k_hw_mac_to_usec(ah, 0xffff)) {
                DPRINTF(ah->ah_sc, ATH_DBG_RESET, "bad slot time %u\n", us);
-               ahp->ah_slottime = (u32) -1;
+               ah->slottime = (u32) -1;
                return false;
        } else {
                REG_WRITE(ah, AR_D_GBL_IFS_SLOT, ath9k_hw_mac_to_clks(ah, us));
-               ahp->ah_slottime = us;
+               ah->slottime = us;
                return true;
        }
 }
 
-void ath9k_hw_set11nmac2040(struct ath_hal *ah, enum ath9k_ht_macmode mode)
+void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode)
 {
        u32 macmode;
 
        if (mode == ATH9K_HT_MACMODE_2040 &&
-           !ah->ah_config.cwm_ignore_extcca)
+           !ah->config.cwm_ignore_extcca)
                macmode = AR_2040_JOINED_RX_CLEAR;
        else
                macmode = 0;
 
        REG_WRITE(ah, AR_2040_MODE, macmode);
 }
+
+/***************************/
+/*  Bluetooth Coexistence  */
+/***************************/
+
+void ath9k_hw_btcoex_enable(struct ath_hw *ah)
+{
+       /* connect bt_active to baseband */
+       REG_CLR_BIT(ah, AR_GPIO_INPUT_EN_VAL,
+                       (AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF |
+                        AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF));
+
+       REG_SET_BIT(ah, AR_GPIO_INPUT_EN_VAL,
+                       AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB);
+
+       /* Set input mux for bt_active to gpio pin */
+       REG_RMW_FIELD(ah, AR_GPIO_INPUT_MUX1,
+                       AR_GPIO_INPUT_MUX1_BT_ACTIVE,
+                       ah->btactive_gpio);
+
+       /* Configure the desired gpio port for input */
+       ath9k_hw_cfg_gpio_input(ah, ah->btactive_gpio);
+
+       /* Configure the desired GPIO port for TX_FRAME output */
+       ath9k_hw_cfg_output(ah, ah->wlanactive_gpio,
+                           AR_GPIO_OUTPUT_MUX_AS_TX_FRAME);
+}
index 91d8f594af813a9d1d5100ea117c4ffef0e841d7..82111636c6932c7b3f77b1156487009078053b5f 100644 (file)
 
 #include <linux/if_ether.h>
 #include <linux/delay.h>
+#include <linux/io.h>
+
+#include "mac.h"
+#include "ani.h"
+#include "eeprom.h"
+#include "calib.h"
+#include "regd.h"
+#include "reg.h"
+#include "phy.h"
+
+#define ATHEROS_VENDOR_ID      0x168c
+#define AR5416_DEVID_PCI       0x0023
+#define AR5416_DEVID_PCIE      0x0024
+#define AR9160_DEVID_PCI       0x0027
+#define AR9280_DEVID_PCI       0x0029
+#define AR9280_DEVID_PCIE      0x002a
+#define AR9285_DEVID_PCIE      0x002b
+#define AR5416_AR9100_DEVID    0x000b
+#define        AR_SUBVENDOR_ID_NOG     0x0e11
+#define AR_SUBVENDOR_ID_NEW_A  0x7065
+#define AR5416_MAGIC           0x19641014
+
+/* Register read/write primitives */
+#define REG_WRITE(_ah, _reg, _val) iowrite32(_val, _ah->ah_sc->mem + _reg)
+#define REG_READ(_ah, _reg) ioread32(_ah->ah_sc->mem + _reg)
+
+#define SM(_v, _f)  (((_v) << _f##_S) & _f)
+#define MS(_v, _f)  (((_v) & _f) >> _f##_S)
+#define REG_RMW(_a, _r, _set, _clr)    \
+       REG_WRITE(_a, _r, (REG_READ(_a, _r) & ~(_clr)) | (_set))
+#define REG_RMW_FIELD(_a, _r, _f, _v) \
+       REG_WRITE(_a, _r, \
+       (REG_READ(_a, _r) & ~_f) | (((_v) << _f##_S) & _f))
+#define REG_SET_BIT(_a, _r, _f) \
+       REG_WRITE(_a, _r, REG_READ(_a, _r) | _f)
+#define REG_CLR_BIT(_a, _r, _f) \
+       REG_WRITE(_a, _r, REG_READ(_a, _r) & ~_f)
 
-struct ar5416_desc {
-       u32 ds_link;
-       u32 ds_data;
-       u32 ds_ctl0;
-       u32 ds_ctl1;
-       union {
-               struct {
-                       u32 ctl2;
-                       u32 ctl3;
-                       u32 ctl4;
-                       u32 ctl5;
-                       u32 ctl6;
-                       u32 ctl7;
-                       u32 ctl8;
-                       u32 ctl9;
-                       u32 ctl10;
-                       u32 ctl11;
-                       u32 status0;
-                       u32 status1;
-                       u32 status2;
-                       u32 status3;
-                       u32 status4;
-                       u32 status5;
-                       u32 status6;
-                       u32 status7;
-                       u32 status8;
-                       u32 status9;
-               } tx;
-               struct {
-                       u32 status0;
-                       u32 status1;
-                       u32 status2;
-                       u32 status3;
-                       u32 status4;
-                       u32 status5;
-                       u32 status6;
-                       u32 status7;
-                       u32 status8;
-               } rx;
-       } u;
-} __packed;
-
-#define AR5416DESC(_ds)         ((struct ar5416_desc *)(_ds))
-#define AR5416DESC_CONST(_ds)   ((const struct ar5416_desc *)(_ds))
-
-#define ds_ctl2     u.tx.ctl2
-#define ds_ctl3     u.tx.ctl3
-#define ds_ctl4     u.tx.ctl4
-#define ds_ctl5     u.tx.ctl5
-#define ds_ctl6     u.tx.ctl6
-#define ds_ctl7     u.tx.ctl7
-#define ds_ctl8     u.tx.ctl8
-#define ds_ctl9     u.tx.ctl9
-#define ds_ctl10    u.tx.ctl10
-#define ds_ctl11    u.tx.ctl11
-
-#define ds_txstatus0    u.tx.status0
-#define ds_txstatus1    u.tx.status1
-#define ds_txstatus2    u.tx.status2
-#define ds_txstatus3    u.tx.status3
-#define ds_txstatus4    u.tx.status4
-#define ds_txstatus5    u.tx.status5
-#define ds_txstatus6    u.tx.status6
-#define ds_txstatus7    u.tx.status7
-#define ds_txstatus8    u.tx.status8
-#define ds_txstatus9    u.tx.status9
-
-#define ds_rxstatus0    u.rx.status0
-#define ds_rxstatus1    u.rx.status1
-#define ds_rxstatus2    u.rx.status2
-#define ds_rxstatus3    u.rx.status3
-#define ds_rxstatus4    u.rx.status4
-#define ds_rxstatus5    u.rx.status5
-#define ds_rxstatus6    u.rx.status6
-#define ds_rxstatus7    u.rx.status7
-#define ds_rxstatus8    u.rx.status8
-
-#define AR_FrameLen         0x00000fff
-#define AR_VirtMoreFrag     0x00001000
-#define AR_TxCtlRsvd00      0x0000e000
-#define AR_XmitPower        0x003f0000
-#define AR_XmitPower_S      16
-#define AR_RTSEnable        0x00400000
-#define AR_VEOL             0x00800000
-#define AR_ClrDestMask      0x01000000
-#define AR_TxCtlRsvd01      0x1e000000
-#define AR_TxIntrReq        0x20000000
-#define AR_DestIdxValid     0x40000000
-#define AR_CTSEnable        0x80000000
-
-#define AR_BufLen           0x00000fff
-#define AR_TxMore           0x00001000
-#define AR_DestIdx          0x000fe000
-#define AR_DestIdx_S        13
-#define AR_FrameType        0x00f00000
-#define AR_FrameType_S      20
-#define AR_NoAck            0x01000000
-#define AR_InsertTS         0x02000000
-#define AR_CorruptFCS       0x04000000
-#define AR_ExtOnly          0x08000000
-#define AR_ExtAndCtl        0x10000000
-#define AR_MoreAggr         0x20000000
-#define AR_IsAggr           0x40000000
-
-#define AR_BurstDur         0x00007fff
-#define AR_BurstDur_S       0
-#define AR_DurUpdateEna     0x00008000
-#define AR_XmitDataTries0   0x000f0000
-#define AR_XmitDataTries0_S 16
-#define AR_XmitDataTries1   0x00f00000
-#define AR_XmitDataTries1_S 20
-#define AR_XmitDataTries2   0x0f000000
-#define AR_XmitDataTries2_S 24
-#define AR_XmitDataTries3   0xf0000000
-#define AR_XmitDataTries3_S 28
-
-#define AR_XmitRate0        0x000000ff
-#define AR_XmitRate0_S      0
-#define AR_XmitRate1        0x0000ff00
-#define AR_XmitRate1_S      8
-#define AR_XmitRate2        0x00ff0000
-#define AR_XmitRate2_S      16
-#define AR_XmitRate3        0xff000000
-#define AR_XmitRate3_S      24
-
-#define AR_PacketDur0       0x00007fff
-#define AR_PacketDur0_S     0
-#define AR_RTSCTSQual0      0x00008000
-#define AR_PacketDur1       0x7fff0000
-#define AR_PacketDur1_S     16
-#define AR_RTSCTSQual1      0x80000000
-
-#define AR_PacketDur2       0x00007fff
-#define AR_PacketDur2_S     0
-#define AR_RTSCTSQual2      0x00008000
-#define AR_PacketDur3       0x7fff0000
-#define AR_PacketDur3_S     16
-#define AR_RTSCTSQual3      0x80000000
-
-#define AR_AggrLen          0x0000ffff
-#define AR_AggrLen_S        0
-#define AR_TxCtlRsvd60      0x00030000
-#define AR_PadDelim         0x03fc0000
-#define AR_PadDelim_S       18
-#define AR_EncrType         0x0c000000
-#define AR_EncrType_S       26
-#define AR_TxCtlRsvd61      0xf0000000
-
-#define AR_2040_0           0x00000001
-#define AR_GI0              0x00000002
-#define AR_ChainSel0        0x0000001c
-#define AR_ChainSel0_S      2
-#define AR_2040_1           0x00000020
-#define AR_GI1              0x00000040
-#define AR_ChainSel1        0x00000380
-#define AR_ChainSel1_S      7
-#define AR_2040_2           0x00000400
-#define AR_GI2              0x00000800
-#define AR_ChainSel2        0x00007000
-#define AR_ChainSel2_S      12
-#define AR_2040_3           0x00008000
-#define AR_GI3              0x00010000
-#define AR_ChainSel3        0x000e0000
-#define AR_ChainSel3_S      17
-#define AR_RTSCTSRate       0x0ff00000
-#define AR_RTSCTSRate_S     20
-#define AR_TxCtlRsvd70      0xf0000000
-
-#define AR_TxRSSIAnt00      0x000000ff
-#define AR_TxRSSIAnt00_S    0
-#define AR_TxRSSIAnt01      0x0000ff00
-#define AR_TxRSSIAnt01_S    8
-#define AR_TxRSSIAnt02      0x00ff0000
-#define AR_TxRSSIAnt02_S    16
-#define AR_TxStatusRsvd00   0x3f000000
-#define AR_TxBaStatus       0x40000000
-#define AR_TxStatusRsvd01   0x80000000
-
-#define AR_FrmXmitOK            0x00000001
-#define AR_ExcessiveRetries     0x00000002
-#define AR_FIFOUnderrun         0x00000004
-#define AR_Filtered             0x00000008
-#define AR_RTSFailCnt           0x000000f0
-#define AR_RTSFailCnt_S         4
-#define AR_DataFailCnt          0x00000f00
-#define AR_DataFailCnt_S        8
-#define AR_VirtRetryCnt         0x0000f000
-#define AR_VirtRetryCnt_S       12
-#define AR_TxDelimUnderrun      0x00010000
-#define AR_TxDataUnderrun       0x00020000
-#define AR_DescCfgErr           0x00040000
-#define AR_TxTimerExpired       0x00080000
-#define AR_TxStatusRsvd10       0xfff00000
-
-#define AR_SendTimestamp    ds_txstatus2
-#define AR_BaBitmapLow      ds_txstatus3
-#define AR_BaBitmapHigh     ds_txstatus4
-
-#define AR_TxRSSIAnt10      0x000000ff
-#define AR_TxRSSIAnt10_S    0
-#define AR_TxRSSIAnt11      0x0000ff00
-#define AR_TxRSSIAnt11_S    8
-#define AR_TxRSSIAnt12      0x00ff0000
-#define AR_TxRSSIAnt12_S    16
-#define AR_TxRSSICombined   0xff000000
-#define AR_TxRSSICombined_S 24
-
-#define AR_TxEVM0           ds_txstatus5
-#define AR_TxEVM1           ds_txstatus6
-#define AR_TxEVM2           ds_txstatus7
-
-#define AR_TxDone           0x00000001
-#define AR_SeqNum           0x00001ffe
-#define AR_SeqNum_S         1
-#define AR_TxStatusRsvd80   0x0001e000
-#define AR_TxOpExceeded     0x00020000
-#define AR_TxStatusRsvd81   0x001c0000
-#define AR_FinalTxIdx       0x00600000
-#define AR_FinalTxIdx_S     21
-#define AR_TxStatusRsvd82   0x01800000
-#define AR_PowerMgmt        0x02000000
-#define AR_TxStatusRsvd83   0xfc000000
-
-#define AR_RxCTLRsvd00  0xffffffff
-
-#define AR_BufLen       0x00000fff
-#define AR_RxCtlRsvd00  0x00001000
-#define AR_RxIntrReq    0x00002000
-#define AR_RxCtlRsvd01  0xffffc000
-
-#define AR_RxRSSIAnt00      0x000000ff
-#define AR_RxRSSIAnt00_S    0
-#define AR_RxRSSIAnt01      0x0000ff00
-#define AR_RxRSSIAnt01_S    8
-#define AR_RxRSSIAnt02      0x00ff0000
-#define AR_RxRSSIAnt02_S    16
-#define AR_RxRate           0xff000000
-#define AR_RxRate_S         24
-#define AR_RxStatusRsvd00   0xff000000
-
-#define AR_DataLen          0x00000fff
-#define AR_RxMore           0x00001000
-#define AR_NumDelim         0x003fc000
-#define AR_NumDelim_S       14
-#define AR_RxStatusRsvd10   0xff800000
-
-#define AR_RcvTimestamp     ds_rxstatus2
-
-#define AR_GI               0x00000001
-#define AR_2040             0x00000002
-#define AR_Parallel40       0x00000004
-#define AR_Parallel40_S     2
-#define AR_RxStatusRsvd30   0x000000f8
-#define AR_RxAntenna       0xffffff00
-#define AR_RxAntenna_S     8
-
-#define AR_RxRSSIAnt10            0x000000ff
-#define AR_RxRSSIAnt10_S          0
-#define AR_RxRSSIAnt11            0x0000ff00
-#define AR_RxRSSIAnt11_S          8
-#define AR_RxRSSIAnt12            0x00ff0000
-#define AR_RxRSSIAnt12_S          16
-#define AR_RxRSSICombined         0xff000000
-#define AR_RxRSSICombined_S       24
-
-#define AR_RxEVM0           ds_rxstatus4
-#define AR_RxEVM1           ds_rxstatus5
-#define AR_RxEVM2           ds_rxstatus6
-
-#define AR_RxDone           0x00000001
-#define AR_RxFrameOK        0x00000002
-#define AR_CRCErr           0x00000004
-#define AR_DecryptCRCErr    0x00000008
-#define AR_PHYErr           0x00000010
-#define AR_MichaelErr       0x00000020
-#define AR_PreDelimCRCErr   0x00000040
-#define AR_RxStatusRsvd70   0x00000080
-#define AR_RxKeyIdxValid    0x00000100
-#define AR_KeyIdx           0x0000fe00
-#define AR_KeyIdx_S         9
-#define AR_PHYErrCode       0x0000ff00
-#define AR_PHYErrCode_S     8
-#define AR_RxMoreAggr       0x00010000
-#define AR_RxAggr           0x00020000
-#define AR_PostDelimCRCErr  0x00040000
-#define AR_RxStatusRsvd71   0x3ff80000
-#define AR_DecryptBusyErr   0x40000000
-#define AR_KeyMiss          0x80000000
-
-#define AR5416_MAGIC        0x19641014
-
-#define RXSTATUS_RATE(ah, ads)  (AR_SREV_5416_V20_OR_LATER(ah) ?       \
-                                MS(ads->ds_rxstatus0, AR_RxRate) :     \
-                                (ads->ds_rxstatus3 >> 2) & 0xFF)
-
-#define set11nTries(_series, _index) \
-       (SM((_series)[_index].Tries, AR_XmitDataTries##_index))
-
-#define set11nRate(_series, _index) \
-       (SM((_series)[_index].Rate, AR_XmitRate##_index))
-
-#define set11nPktDurRTSCTS(_series, _index)                            \
-       (SM((_series)[_index].PktDuration, AR_PacketDur##_index) |      \
-       ((_series)[_index].RateFlags & ATH9K_RATESERIES_RTS_CTS   ?     \
-               AR_RTSCTSQual##_index : 0))
+#define DO_DELAY(x) do {                       \
+               if ((++(x) % 64) == 0)          \
+                       udelay(1);              \
+       } while (0)
 
-#define set11nRateFlags(_series, _index)                               \
-       (((_series)[_index].RateFlags & ATH9K_RATESERIES_2040 ?         \
-         AR_2040_##_index : 0)                                         \
-        |((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ?      \
-          AR_GI##_index : 0)                                           \
-        |SM((_series)[_index].ChSel, AR_ChainSel##_index))
+#define REG_WRITE_ARRAY(iniarray, column, regWr) do {                   \
+               int r;                                                  \
+               for (r = 0; r < ((iniarray)->ia_rows); r++) {           \
+                       REG_WRITE(ah, INI_RA((iniarray), (r), 0),       \
+                                 INI_RA((iniarray), r, (column)));     \
+                       DO_DELAY(regWr);                                \
+               }                                                       \
+       } while (0)
 
-#define AR_SREV_9100(ah) ((ah->ah_macVersion) == AR_SREV_VERSION_9100)
+#define AR_GPIO_OUTPUT_MUX_AS_OUTPUT             0
+#define AR_GPIO_OUTPUT_MUX_AS_PCIE_ATTENTION_LED 1
+#define AR_GPIO_OUTPUT_MUX_AS_PCIE_POWER_LED     2
+#define AR_GPIO_OUTPUT_MUX_AS_TX_FRAME           3
+#define AR_GPIO_OUTPUT_MUX_AS_MAC_NETWORK_LED    5
+#define AR_GPIO_OUTPUT_MUX_AS_MAC_POWER_LED      6
 
-#define INIT_CONFIG_STATUS  0x00000000
-#define INIT_RSSI_THR       0x00000700
-#define INIT_BCON_CNTRL_REG 0x00000000
+#define AR_GPIOD_MASK               0x00001FFF
+#define AR_GPIO_BIT(_gpio)          (1 << (_gpio))
 
-#define MIN_TX_FIFO_THRESHOLD   0x1
-#define MAX_TX_FIFO_THRESHOLD   ((4096 / 64) - 1)
-#define INIT_TX_FIFO_THRESHOLD  MIN_TX_FIFO_THRESHOLD
+#define BASE_ACTIVATE_DELAY         100
+#define RTC_PLL_SETTLE_DELAY        1000
+#define COEF_SCALE_S                24
+#define HT40_CHANNEL_CENTER_SHIFT   10
 
-struct ar5416AniState {
-       struct ath9k_channel c;
-       u8 noiseImmunityLevel;
-       u8 spurImmunityLevel;
-       u8 firstepLevel;
-       u8 ofdmWeakSigDetectOff;
-       u8 cckWeakSigThreshold;
-       u32 listenTime;
-       u32 ofdmTrigHigh;
-       u32 ofdmTrigLow;
-       int32_t cckTrigHigh;
-       int32_t cckTrigLow;
-       int32_t rssiThrLow;
-       int32_t rssiThrHigh;
-       u32 noiseFloor;
-       u32 txFrameCount;
-       u32 rxFrameCount;
-       u32 cycleCount;
-       u32 ofdmPhyErrCount;
-       u32 cckPhyErrCount;
-       u32 ofdmPhyErrBase;
-       u32 cckPhyErrBase;
-       int16_t pktRssi[2];
-       int16_t ofdmErrRssi[2];
-       int16_t cckErrRssi[2];
+#define ATH9K_ANTENNA0_CHAINMASK    0x1
+#define ATH9K_ANTENNA1_CHAINMASK    0x2
+
+#define ATH9K_NUM_DMA_DEBUG_REGS    8
+#define ATH9K_NUM_QUEUES            10
+
+#define MAX_RATE_POWER              63
+#define AH_TIMEOUT                  100000
+#define AH_TIME_QUANTUM             10
+#define AR_KEYTABLE_SIZE            128
+#define POWER_UP_TIME               200000
+#define SPUR_RSSI_THRESH            40
+
+#define CAB_TIMEOUT_VAL             10
+#define BEACON_TIMEOUT_VAL          10
+#define MIN_BEACON_TIMEOUT_VAL      1
+#define SLEEP_SLOP                  3
+
+#define INIT_CONFIG_STATUS          0x00000000
+#define INIT_RSSI_THR               0x00000700
+#define INIT_BCON_CNTRL_REG         0x00000000
+
+#define TU_TO_USEC(_tu)             ((_tu) << 10)
+
+enum wireless_mode {
+       ATH9K_MODE_11A = 0,
+       ATH9K_MODE_11B = 2,
+       ATH9K_MODE_11G = 3,
+       ATH9K_MODE_11NA_HT20 = 6,
+       ATH9K_MODE_11NG_HT20 = 7,
+       ATH9K_MODE_11NA_HT40PLUS = 8,
+       ATH9K_MODE_11NA_HT40MINUS = 9,
+       ATH9K_MODE_11NG_HT40PLUS = 10,
+       ATH9K_MODE_11NG_HT40MINUS = 11,
+       ATH9K_MODE_MAX
 };
 
-#define HAL_PROCESS_ANI     0x00000001
-#define DO_ANI(ah) \
-       ((AH5416(ah)->ah_procPhyErr & HAL_PROCESS_ANI))
-
-struct ar5416Stats {
-       u32 ast_ani_niup;
-       u32 ast_ani_nidown;
-       u32 ast_ani_spurup;
-       u32 ast_ani_spurdown;
-       u32 ast_ani_ofdmon;
-       u32 ast_ani_ofdmoff;
-       u32 ast_ani_cckhigh;
-       u32 ast_ani_ccklow;
-       u32 ast_ani_stepup;
-       u32 ast_ani_stepdown;
-       u32 ast_ani_ofdmerrs;
-       u32 ast_ani_cckerrs;
-       u32 ast_ani_reset;
-       u32 ast_ani_lzero;
-       u32 ast_ani_lneg;
-       struct ath9k_mib_stats ast_mibstats;
-       struct ath9k_node_stats ast_nodestats;
+enum ath9k_hw_caps {
+       ATH9K_HW_CAP_CHAN_SPREAD                = BIT(0),
+       ATH9K_HW_CAP_MIC_AESCCM                 = BIT(1),
+       ATH9K_HW_CAP_MIC_CKIP                   = BIT(2),
+       ATH9K_HW_CAP_MIC_TKIP                   = BIT(3),
+       ATH9K_HW_CAP_CIPHER_AESCCM              = BIT(4),
+       ATH9K_HW_CAP_CIPHER_CKIP                = BIT(5),
+       ATH9K_HW_CAP_CIPHER_TKIP                = BIT(6),
+       ATH9K_HW_CAP_VEOL                       = BIT(7),
+       ATH9K_HW_CAP_BSSIDMASK                  = BIT(8),
+       ATH9K_HW_CAP_MCAST_KEYSEARCH            = BIT(9),
+       ATH9K_HW_CAP_CHAN_HALFRATE              = BIT(10),
+       ATH9K_HW_CAP_CHAN_QUARTERRATE           = BIT(11),
+       ATH9K_HW_CAP_HT                         = BIT(12),
+       ATH9K_HW_CAP_GTT                        = BIT(13),
+       ATH9K_HW_CAP_FASTCC                     = BIT(14),
+       ATH9K_HW_CAP_RFSILENT                   = BIT(15),
+       ATH9K_HW_CAP_WOW                        = BIT(16),
+       ATH9K_HW_CAP_CST                        = BIT(17),
+       ATH9K_HW_CAP_ENHANCEDPM                 = BIT(18),
+       ATH9K_HW_CAP_AUTOSLEEP                  = BIT(19),
+       ATH9K_HW_CAP_4KB_SPLITTRANS             = BIT(20),
+       ATH9K_HW_CAP_WOW_MATCHPATTERN_EXACT     = BIT(21),
+       ATH9K_HW_CAP_BT_COEX                    = BIT(22)
 };
 
-#define AR5416_OPFLAGS_11A           0x01
-#define AR5416_OPFLAGS_11G           0x02
-#define AR5416_OPFLAGS_N_5G_HT40     0x04
-#define AR5416_OPFLAGS_N_2G_HT40     0x08
-#define AR5416_OPFLAGS_N_5G_HT20     0x10
-#define AR5416_OPFLAGS_N_2G_HT20     0x20
-
-#define EEP_RFSILENT_ENABLED        0x0001
-#define EEP_RFSILENT_ENABLED_S      0
-#define EEP_RFSILENT_POLARITY       0x0002
-#define EEP_RFSILENT_POLARITY_S     1
-#define EEP_RFSILENT_GPIO_SEL       0x001c
-#define EEP_RFSILENT_GPIO_SEL_S     2
-
-#define AR5416_EEP_NO_BACK_VER       0x1
-#define AR5416_EEP_VER               0xE
-#define AR5416_EEP_VER_MINOR_MASK    0x0FFF
-#define AR5416_EEP_MINOR_VER_2       0x2
-#define AR5416_EEP_MINOR_VER_3       0x3
-#define AR5416_EEP_MINOR_VER_7       0x7
-#define AR5416_EEP_MINOR_VER_9       0x9
-#define AR5416_EEP_MINOR_VER_16      0x10
-#define AR5416_EEP_MINOR_VER_17      0x11
-#define AR5416_EEP_MINOR_VER_19      0x13
-
-#define AR5416_NUM_5G_CAL_PIERS         8
-#define AR5416_NUM_2G_CAL_PIERS         4
-#define AR5416_NUM_5G_20_TARGET_POWERS  8
-#define AR5416_NUM_5G_40_TARGET_POWERS  8
-#define AR5416_NUM_2G_CCK_TARGET_POWERS 3
-#define AR5416_NUM_2G_20_TARGET_POWERS  4
-#define AR5416_NUM_2G_40_TARGET_POWERS  4
-#define AR5416_NUM_CTLS                 24
-#define AR5416_NUM_BAND_EDGES           8
-#define AR5416_NUM_PD_GAINS             4
-#define AR5416_PD_GAINS_IN_MASK         4
-#define AR5416_PD_GAIN_ICEPTS           5
-#define AR5416_EEPROM_MODAL_SPURS       5
-#define AR5416_MAX_RATE_POWER           63
-#define AR5416_NUM_PDADC_VALUES         128
-#define AR5416_BCHAN_UNUSED             0xFF
-#define AR5416_MAX_PWR_RANGE_IN_HALF_DB 64
-#define AR5416_MAX_CHAINS               3
-#define AR5416_PWR_TABLE_OFFSET         -5
-
-/* Rx gain type values */
-#define AR5416_EEP_RXGAIN_23DB_BACKOFF     0
-#define AR5416_EEP_RXGAIN_13DB_BACKOFF     1
-#define AR5416_EEP_RXGAIN_ORIG             2
-
-/* Tx gain type values */
-#define AR5416_EEP_TXGAIN_ORIGINAL         0
-#define AR5416_EEP_TXGAIN_HIGH_POWER       1
-
-#define AR5416_EEP4K_START_LOC         64
-#define AR5416_EEP4K_NUM_2G_CAL_PIERS      3
-#define AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS 3
-#define AR5416_EEP4K_NUM_2G_20_TARGET_POWERS  3
-#define AR5416_EEP4K_NUM_2G_40_TARGET_POWERS  3
-#define AR5416_EEP4K_NUM_CTLS              12
-#define AR5416_EEP4K_NUM_BAND_EDGES        4
-#define AR5416_EEP4K_NUM_PD_GAINS          2
-#define AR5416_EEP4K_PD_GAINS_IN_MASK      4
-#define AR5416_EEP4K_PD_GAIN_ICEPTS        5
-#define AR5416_EEP4K_MAX_CHAINS            1
-
-enum eeprom_param {
-       EEP_NFTHRESH_5,
-       EEP_NFTHRESH_2,
-       EEP_MAC_MSW,
-       EEP_MAC_MID,
-       EEP_MAC_LSW,
-       EEP_REG_0,
-       EEP_REG_1,
-       EEP_OP_CAP,
-       EEP_OP_MODE,
-       EEP_RF_SILENT,
-       EEP_OB_5,
-       EEP_DB_5,
-       EEP_OB_2,
-       EEP_DB_2,
-       EEP_MINOR_REV,
-       EEP_TX_MASK,
-       EEP_RX_MASK,
-       EEP_RXGAIN_TYPE,
-       EEP_TXGAIN_TYPE,
+enum ath9k_capability_type {
+       ATH9K_CAP_CIPHER = 0,
+       ATH9K_CAP_TKIP_MIC,
+       ATH9K_CAP_TKIP_SPLIT,
+       ATH9K_CAP_PHYCOUNTERS,
+       ATH9K_CAP_DIVERSITY,
+       ATH9K_CAP_TXPOW,
+       ATH9K_CAP_PHYDIAG,
+       ATH9K_CAP_MCAST_KEYSRCH,
+       ATH9K_CAP_TSF_ADJUST,
+       ATH9K_CAP_WME_TKIPMIC,
+       ATH9K_CAP_RFSILENT,
+       ATH9K_CAP_ANT_CFG_2GHZ,
+       ATH9K_CAP_ANT_CFG_5GHZ
 };
 
-enum ar5416_rates {
-       rate6mb, rate9mb, rate12mb, rate18mb,
-       rate24mb, rate36mb, rate48mb, rate54mb,
-       rate1l, rate2l, rate2s, rate5_5l,
-       rate5_5s, rate11l, rate11s, rateXr,
-       rateHt20_0, rateHt20_1, rateHt20_2, rateHt20_3,
-       rateHt20_4, rateHt20_5, rateHt20_6, rateHt20_7,
-       rateHt40_0, rateHt40_1, rateHt40_2, rateHt40_3,
-       rateHt40_4, rateHt40_5, rateHt40_6, rateHt40_7,
-       rateDupCck, rateDupOfdm, rateExtCck, rateExtOfdm,
-       Ar5416RateSize
+struct ath9k_hw_capabilities {
+       u32 hw_caps; /* ATH9K_HW_CAP_* from ath9k_hw_caps */
+       DECLARE_BITMAP(wireless_modes, ATH9K_MODE_MAX); /* ATH9K_MODE_* */
+       u16 total_queues;
+       u16 keycache_size;
+       u16 low_5ghz_chan, high_5ghz_chan;
+       u16 low_2ghz_chan, high_2ghz_chan;
+       u16 num_mr_retries;
+       u16 rts_aggr_limit;
+       u8 tx_chainmask;
+       u8 rx_chainmask;
+       u16 tx_triglevel_max;
+       u16 reg_cap;
+       u8 num_gpio_pins;
+       u8 num_antcfg_2ghz;
+       u8 num_antcfg_5ghz;
 };
 
-enum ath9k_hal_freq_band {
-       ATH9K_HAL_FREQ_BAND_5GHZ = 0,
-       ATH9K_HAL_FREQ_BAND_2GHZ = 1
+struct ath9k_ops_config {
+       int dma_beacon_response_time;
+       int sw_beacon_response_time;
+       int additional_swba_backoff;
+       int ack_6mb;
+       int cwm_ignore_extcca;
+       u8 pcie_powersave_enable;
+       u8 pcie_l1skp_enable;
+       u8 pcie_clock_req;
+       u32 pcie_waen;
+       int pcie_power_reset;
+       u8 pcie_restore;
+       u8 analog_shiftreg;
+       u8 ht_enable;
+       u32 ofdm_trig_low;
+       u32 ofdm_trig_high;
+       u32 cck_trig_high;
+       u32 cck_trig_low;
+       u32 enable_ani;
+       u8 noise_immunity_level;
+       u32 ofdm_weaksignal_det;
+       u32 cck_weaksignal_thr;
+       u8 spur_immunity_level;
+       u8 firstep_level;
+       int8_t rssi_thr_high;
+       int8_t rssi_thr_low;
+       u16 diversity_control;
+       u16 antenna_switch_swap;
+       int serialize_regmode;
+       int intr_mitigation;
+#define SPUR_DISABLE           0
+#define SPUR_ENABLE_IOCTL      1
+#define SPUR_ENABLE_EEPROM     2
+#define AR_EEPROM_MODAL_SPURS   5
+#define AR_SPUR_5413_1         1640
+#define AR_SPUR_5413_2         1200
+#define AR_NO_SPUR             0x8000
+#define AR_BASE_FREQ_2GHZ      2300
+#define AR_BASE_FREQ_5GHZ      4900
+#define AR_SPUR_FEEQ_BOUND_HT40 19
+#define AR_SPUR_FEEQ_BOUND_HT20 10
+       int spurmode;
+       u16 spurchans[AR_EEPROM_MODAL_SPURS][2];
 };
 
-struct base_eep_header {
-       u16 length;
-       u16 checksum;
-       u16 version;
-       u8 opCapFlags;
-       u8 eepMisc;
-       u16 regDmn[2];
-       u8 macAddr[6];
-       u8 rxMask;
-       u8 txMask;
-       u16 rfSilent;
-       u16 blueToothOptions;
-       u16 deviceCap;
-       u32 binBuildNumber;
-       u8 deviceType;
-       u8 pwdclkind;
-       u8 futureBase_1[2];
-       u8 rxGainType;
-       u8 futureBase_2[3];
-       u8 txGainType;
-       u8 futureBase_3[25];
-} __packed;
-
-struct base_eep_header_4k {
-       u16 length;
-       u16 checksum;
-       u16 version;
-       u8 opCapFlags;
-       u8 eepMisc;
-       u16 regDmn[2];
-       u8 macAddr[6];
-       u8 rxMask;
-       u8 txMask;
-       u16 rfSilent;
-       u16 blueToothOptions;
-       u16 deviceCap;
-       u32 binBuildNumber;
-       u8 deviceType;
-       u8 futureBase[1];
-} __packed;
-
-
-struct spur_chan {
-       u16 spurChan;
-       u8 spurRangeLow;
-       u8 spurRangeHigh;
-} __packed;
-
-struct modal_eep_header {
-       u32 antCtrlChain[AR5416_MAX_CHAINS];
-       u32 antCtrlCommon;
-       u8 antennaGainCh[AR5416_MAX_CHAINS];
-       u8 switchSettling;
-       u8 txRxAttenCh[AR5416_MAX_CHAINS];
-       u8 rxTxMarginCh[AR5416_MAX_CHAINS];
-       u8 adcDesiredSize;
-       u8 pgaDesiredSize;
-       u8 xlnaGainCh[AR5416_MAX_CHAINS];
-       u8 txEndToXpaOff;
-       u8 txEndToRxOn;
-       u8 txFrameToXpaOn;
-       u8 thresh62;
-       u8 noiseFloorThreshCh[AR5416_MAX_CHAINS];
-       u8 xpdGain;
-       u8 xpd;
-       u8 iqCalICh[AR5416_MAX_CHAINS];
-       u8 iqCalQCh[AR5416_MAX_CHAINS];
-       u8 pdGainOverlap;
-       u8 ob;
-       u8 db;
-       u8 xpaBiasLvl;
-       u8 pwrDecreaseFor2Chain;
-       u8 pwrDecreaseFor3Chain;
-       u8 txFrameToDataStart;
-       u8 txFrameToPaOn;
-       u8 ht40PowerIncForPdadc;
-       u8 bswAtten[AR5416_MAX_CHAINS];
-       u8 bswMargin[AR5416_MAX_CHAINS];
-       u8 swSettleHt40;
-       u8 xatten2Db[AR5416_MAX_CHAINS];
-       u8 xatten2Margin[AR5416_MAX_CHAINS];
-       u8 ob_ch1;
-       u8 db_ch1;
-       u8 useAnt1:1,
-           force_xpaon:1,
-           local_bias:1,
-           femBandSelectUsed:1, xlnabufin:1, xlnaisel:2, xlnabufmode:1;
-       u8 futureModalar9280;
-       u16 xpaBiasLvlFreq[3];
-       u8 futureModal[6];
-
-       struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
-} __packed;
-
-struct modal_eep_4k_header {
-    u32  antCtrlChain[AR5416_EEP4K_MAX_CHAINS];
-    u32  antCtrlCommon;
-    u8   antennaGainCh[AR5416_EEP4K_MAX_CHAINS];
-    u8   switchSettling;
-    u8   txRxAttenCh[AR5416_EEP4K_MAX_CHAINS];
-    u8   rxTxMarginCh[AR5416_EEP4K_MAX_CHAINS];
-    u8   adcDesiredSize;
-    u8   pgaDesiredSize;
-    u8   xlnaGainCh[AR5416_EEP4K_MAX_CHAINS];
-    u8   txEndToXpaOff;
-    u8   txEndToRxOn;
-    u8   txFrameToXpaOn;
-    u8   thresh62;
-    u8   noiseFloorThreshCh[AR5416_EEP4K_MAX_CHAINS];
-    u8   xpdGain;
-    u8   xpd;
-    u8   iqCalICh[AR5416_EEP4K_MAX_CHAINS];
-    u8   iqCalQCh[AR5416_EEP4K_MAX_CHAINS];
-    u8   pdGainOverlap;
-    u8   ob_01;
-    u8   db1_01;
-    u8   xpaBiasLvl;
-    u8   txFrameToDataStart;
-    u8   txFrameToPaOn;
-    u8   ht40PowerIncForPdadc;
-    u8   bswAtten[AR5416_EEP4K_MAX_CHAINS];
-    u8   bswMargin[AR5416_EEP4K_MAX_CHAINS];
-    u8   swSettleHt40;
-    u8   xatten2Db[AR5416_EEP4K_MAX_CHAINS];
-    u8   xatten2Margin[AR5416_EEP4K_MAX_CHAINS];
-    u8   db2_01;
-    u8   version;
-    u16  ob_234;
-    u16  db1_234;
-    u16  db2_234;
-    u8   futureModal[4];
-
-    struct spur_chan spurChans[AR5416_EEPROM_MODAL_SPURS];
-} __packed;
-
-
-struct cal_data_per_freq {
-       u8 pwrPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
-       u8 vpdPdg[AR5416_NUM_PD_GAINS][AR5416_PD_GAIN_ICEPTS];
-} __packed;
-
-struct cal_data_per_freq_4k {
-       u8 pwrPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS];
-       u8 vpdPdg[AR5416_EEP4K_NUM_PD_GAINS][AR5416_EEP4K_PD_GAIN_ICEPTS];
-} __packed;
-
-struct cal_target_power_leg {
-       u8 bChannel;
-       u8 tPow2x[4];
-} __packed;
-
-struct cal_target_power_ht {
-       u8 bChannel;
-       u8 tPow2x[8];
-} __packed;
-
-
-#ifdef __BIG_ENDIAN_BITFIELD
-struct cal_ctl_edges {
-       u8 bChannel;
-       u8 flag:2, tPower:6;
-} __packed;
-#else
-struct cal_ctl_edges {
-       u8 bChannel;
-       u8 tPower:6, flag:2;
-} __packed;
-#endif
-
-struct cal_ctl_data {
-       struct cal_ctl_edges
-       ctlEdges[AR5416_MAX_CHAINS][AR5416_NUM_BAND_EDGES];
-} __packed;
-
-struct cal_ctl_data_4k {
-       struct cal_ctl_edges
-       ctlEdges[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_BAND_EDGES];
-} __packed;
-
-struct ar5416_eeprom_def {
-       struct base_eep_header baseEepHeader;
-       u8 custData[64];
-       struct modal_eep_header modalHeader[2];
-       u8 calFreqPier5G[AR5416_NUM_5G_CAL_PIERS];
-       u8 calFreqPier2G[AR5416_NUM_2G_CAL_PIERS];
-       struct cal_data_per_freq
-        calPierData5G[AR5416_MAX_CHAINS][AR5416_NUM_5G_CAL_PIERS];
-       struct cal_data_per_freq
-        calPierData2G[AR5416_MAX_CHAINS][AR5416_NUM_2G_CAL_PIERS];
-       struct cal_target_power_leg
-        calTargetPower5G[AR5416_NUM_5G_20_TARGET_POWERS];
-       struct cal_target_power_ht
-        calTargetPower5GHT20[AR5416_NUM_5G_20_TARGET_POWERS];
-       struct cal_target_power_ht
-        calTargetPower5GHT40[AR5416_NUM_5G_40_TARGET_POWERS];
-       struct cal_target_power_leg
-        calTargetPowerCck[AR5416_NUM_2G_CCK_TARGET_POWERS];
-       struct cal_target_power_leg
-        calTargetPower2G[AR5416_NUM_2G_20_TARGET_POWERS];
-       struct cal_target_power_ht
-        calTargetPower2GHT20[AR5416_NUM_2G_20_TARGET_POWERS];
-       struct cal_target_power_ht
-        calTargetPower2GHT40[AR5416_NUM_2G_40_TARGET_POWERS];
-       u8 ctlIndex[AR5416_NUM_CTLS];
-       struct cal_ctl_data ctlData[AR5416_NUM_CTLS];
-       u8 padding;
-} __packed;
-
-struct ar5416_eeprom_4k {
-       struct base_eep_header_4k baseEepHeader;
-       u8 custData[20];
-       struct modal_eep_4k_header modalHeader;
-       u8 calFreqPier2G[AR5416_EEP4K_NUM_2G_CAL_PIERS];
-       struct cal_data_per_freq_4k
-       calPierData2G[AR5416_EEP4K_MAX_CHAINS][AR5416_EEP4K_NUM_2G_CAL_PIERS];
-       struct cal_target_power_leg
-       calTargetPowerCck[AR5416_EEP4K_NUM_2G_CCK_TARGET_POWERS];
-       struct cal_target_power_leg
-       calTargetPower2G[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS];
-       struct cal_target_power_ht
-       calTargetPower2GHT20[AR5416_EEP4K_NUM_2G_20_TARGET_POWERS];
-       struct cal_target_power_ht
-       calTargetPower2GHT40[AR5416_EEP4K_NUM_2G_40_TARGET_POWERS];
-       u8 ctlIndex[AR5416_EEP4K_NUM_CTLS];
-       struct cal_ctl_data_4k ctlData[AR5416_EEP4K_NUM_CTLS];
-       u8 padding;
-} __packed;
-
-struct ar5416IniArray {
-       u32 *ia_array;
-       u32 ia_rows;
-       u32 ia_columns;
+enum ath9k_int {
+       ATH9K_INT_RX = 0x00000001,
+       ATH9K_INT_RXDESC = 0x00000002,
+       ATH9K_INT_RXNOFRM = 0x00000008,
+       ATH9K_INT_RXEOL = 0x00000010,
+       ATH9K_INT_RXORN = 0x00000020,
+       ATH9K_INT_TX = 0x00000040,
+       ATH9K_INT_TXDESC = 0x00000080,
+       ATH9K_INT_TIM_TIMER = 0x00000100,
+       ATH9K_INT_TXURN = 0x00000800,
+       ATH9K_INT_MIB = 0x00001000,
+       ATH9K_INT_RXPHY = 0x00004000,
+       ATH9K_INT_RXKCM = 0x00008000,
+       ATH9K_INT_SWBA = 0x00010000,
+       ATH9K_INT_BMISS = 0x00040000,
+       ATH9K_INT_BNR = 0x00100000,
+       ATH9K_INT_TIM = 0x00200000,
+       ATH9K_INT_DTIM = 0x00400000,
+       ATH9K_INT_DTIMSYNC = 0x00800000,
+       ATH9K_INT_GPIO = 0x01000000,
+       ATH9K_INT_CABEND = 0x02000000,
+       ATH9K_INT_CST = 0x10000000,
+       ATH9K_INT_GTT = 0x20000000,
+       ATH9K_INT_FATAL = 0x40000000,
+       ATH9K_INT_GLOBAL = 0x80000000,
+       ATH9K_INT_BMISC = ATH9K_INT_TIM |
+               ATH9K_INT_DTIM |
+               ATH9K_INT_DTIMSYNC |
+               ATH9K_INT_CABEND,
+       ATH9K_INT_COMMON = ATH9K_INT_RXNOFRM |
+               ATH9K_INT_RXDESC |
+               ATH9K_INT_RXEOL |
+               ATH9K_INT_RXORN |
+               ATH9K_INT_TXURN |
+               ATH9K_INT_TXDESC |
+               ATH9K_INT_MIB |
+               ATH9K_INT_RXPHY |
+               ATH9K_INT_RXKCM |
+               ATH9K_INT_SWBA |
+               ATH9K_INT_BMISS |
+               ATH9K_INT_GPIO,
+       ATH9K_INT_NOCARD = 0xffffffff
 };
 
-#define INIT_INI_ARRAY(iniarray, array, rows, columns) do {    \
-               (iniarray)->ia_array = (u32 *)(array);          \
-               (iniarray)->ia_rows = (rows);                   \
-               (iniarray)->ia_columns = (columns);             \
-       } while (0)
-
-#define INI_RA(iniarray, row, column) \
-       (((iniarray)->ia_array)[(row) * ((iniarray)->ia_columns) + (column)])
+#define CHANNEL_CW_INT    0x00002
+#define CHANNEL_CCK       0x00020
+#define CHANNEL_OFDM      0x00040
+#define CHANNEL_2GHZ      0x00080
+#define CHANNEL_5GHZ      0x00100
+#define CHANNEL_PASSIVE   0x00200
+#define CHANNEL_DYN       0x00400
+#define CHANNEL_HALF      0x04000
+#define CHANNEL_QUARTER   0x08000
+#define CHANNEL_HT20      0x10000
+#define CHANNEL_HT40PLUS  0x20000
+#define CHANNEL_HT40MINUS 0x40000
+
+#define CHANNEL_INTERFERENCE    0x01
+#define CHANNEL_DFS             0x02
+#define CHANNEL_4MS_LIMIT       0x04
+#define CHANNEL_DFS_CLEAR       0x08
+#define CHANNEL_DISALLOW_ADHOC  0x10
+#define CHANNEL_PER_11D_ADHOC   0x20
+
+#define CHANNEL_A           (CHANNEL_5GHZ|CHANNEL_OFDM)
+#define CHANNEL_B           (CHANNEL_2GHZ|CHANNEL_CCK)
+#define CHANNEL_G           (CHANNEL_2GHZ|CHANNEL_OFDM)
+#define CHANNEL_G_HT20      (CHANNEL_2GHZ|CHANNEL_HT20)
+#define CHANNEL_A_HT20      (CHANNEL_5GHZ|CHANNEL_HT20)
+#define CHANNEL_G_HT40PLUS  (CHANNEL_2GHZ|CHANNEL_HT40PLUS)
+#define CHANNEL_G_HT40MINUS (CHANNEL_2GHZ|CHANNEL_HT40MINUS)
+#define CHANNEL_A_HT40PLUS  (CHANNEL_5GHZ|CHANNEL_HT40PLUS)
+#define CHANNEL_A_HT40MINUS (CHANNEL_5GHZ|CHANNEL_HT40MINUS)
+#define CHANNEL_ALL                            \
+       (CHANNEL_OFDM|                          \
+        CHANNEL_CCK|                           \
+        CHANNEL_2GHZ |                         \
+        CHANNEL_5GHZ |                         \
+        CHANNEL_HT20 |                         \
+        CHANNEL_HT40PLUS |                     \
+        CHANNEL_HT40MINUS)
+
+struct ath9k_channel {
+       struct ieee80211_channel *chan;
+       u16 channel;
+       u32 channelFlags;
+       u32 chanmode;
+       int32_t CalValid;
+       bool oneTimeCalsDone;
+       int8_t iCoff;
+       int8_t qCoff;
+       int16_t rawNoiseFloor;
+};
 
-#define INIT_CAL(_perCal) do {                         \
-               (_perCal)->calState = CAL_WAITING;      \
-               (_perCal)->calNext = NULL;              \
-       } while (0)
+#define IS_CHAN_A(_c) ((((_c)->channelFlags & CHANNEL_A) == CHANNEL_A) || \
+       (((_c)->channelFlags & CHANNEL_A_HT20) == CHANNEL_A_HT20) || \
+       (((_c)->channelFlags & CHANNEL_A_HT40PLUS) == CHANNEL_A_HT40PLUS) || \
+       (((_c)->channelFlags & CHANNEL_A_HT40MINUS) == CHANNEL_A_HT40MINUS))
+#define IS_CHAN_G(_c) ((((_c)->channelFlags & (CHANNEL_G)) == CHANNEL_G) || \
+       (((_c)->channelFlags & CHANNEL_G_HT20) == CHANNEL_G_HT20) || \
+       (((_c)->channelFlags & CHANNEL_G_HT40PLUS) == CHANNEL_G_HT40PLUS) || \
+       (((_c)->channelFlags & CHANNEL_G_HT40MINUS) == CHANNEL_G_HT40MINUS))
+#define IS_CHAN_OFDM(_c) (((_c)->channelFlags & CHANNEL_OFDM) != 0)
+#define IS_CHAN_5GHZ(_c) (((_c)->channelFlags & CHANNEL_5GHZ) != 0)
+#define IS_CHAN_2GHZ(_c) (((_c)->channelFlags & CHANNEL_2GHZ) != 0)
+#define IS_CHAN_PASSIVE(_c) (((_c)->channelFlags & CHANNEL_PASSIVE) != 0)
+#define IS_CHAN_HALF_RATE(_c) (((_c)->channelFlags & CHANNEL_HALF) != 0)
+#define IS_CHAN_QUARTER_RATE(_c) (((_c)->channelFlags & CHANNEL_QUARTER) != 0)
+#define IS_CHAN_A_5MHZ_SPACED(_c)                      \
+       ((((_c)->channelFlags & CHANNEL_5GHZ) != 0) &&  \
+        (((_c)->channel % 20) != 0) &&                 \
+        (((_c)->channel % 10) != 0))
+
+/* These macros check chanmode and not channelFlags */
+#define IS_CHAN_B(_c) ((_c)->chanmode == CHANNEL_B)
+#define IS_CHAN_HT20(_c) (((_c)->chanmode == CHANNEL_A_HT20) ||        \
+                         ((_c)->chanmode == CHANNEL_G_HT20))
+#define IS_CHAN_HT40(_c) (((_c)->chanmode == CHANNEL_A_HT40PLUS) ||    \
+                         ((_c)->chanmode == CHANNEL_A_HT40MINUS) ||    \
+                         ((_c)->chanmode == CHANNEL_G_HT40PLUS) ||     \
+                         ((_c)->chanmode == CHANNEL_G_HT40MINUS))
+#define IS_CHAN_HT(_c) (IS_CHAN_HT20((_c)) || IS_CHAN_HT40((_c)))
+
+enum ath9k_power_mode {
+       ATH9K_PM_AWAKE = 0,
+       ATH9K_PM_FULL_SLEEP,
+       ATH9K_PM_NETWORK_SLEEP,
+       ATH9K_PM_UNDEFINED
+};
 
-#define INSERT_CAL(_ahp, _perCal)                                      \
-       do {                                                            \
-               if ((_ahp)->ah_cal_list_last == NULL) {                 \
-                       (_ahp)->ah_cal_list =                           \
-                               (_ahp)->ah_cal_list_last = (_perCal);   \
-                       ((_ahp)->ah_cal_list_last)->calNext = (_perCal); \
-               } else {                                                \
-                       ((_ahp)->ah_cal_list_last)->calNext = (_perCal); \
-                       (_ahp)->ah_cal_list_last = (_perCal);           \
-                       (_perCal)->calNext = (_ahp)->ah_cal_list;       \
-               }                                                       \
-       } while (0)
+enum ath9k_ant_setting {
+       ATH9K_ANT_VARIABLE = 0,
+       ATH9K_ANT_FIXED_A,
+       ATH9K_ANT_FIXED_B
+};
 
-enum hal_cal_types {
-       ADC_DC_INIT_CAL = 0x1,
-       ADC_GAIN_CAL = 0x2,
-       ADC_DC_CAL = 0x4,
-       IQ_MISMATCH_CAL = 0x8
+enum ath9k_tp_scale {
+       ATH9K_TP_SCALE_MAX = 0,
+       ATH9K_TP_SCALE_50,
+       ATH9K_TP_SCALE_25,
+       ATH9K_TP_SCALE_12,
+       ATH9K_TP_SCALE_MIN
 };
 
-enum hal_cal_state {
-       CAL_INACTIVE,
-       CAL_WAITING,
-       CAL_RUNNING,
-       CAL_DONE
+enum ser_reg_mode {
+       SER_REG_MODE_OFF = 0,
+       SER_REG_MODE_ON = 1,
+       SER_REG_MODE_AUTO = 2,
 };
 
-#define MIN_CAL_SAMPLES     1
-#define MAX_CAL_SAMPLES    64
-#define INIT_LOG_COUNT      5
-#define PER_MIN_LOG_COUNT   2
-#define PER_MAX_LOG_COUNT  10
+struct ath9k_beacon_state {
+       u32 bs_nexttbtt;
+       u32 bs_nextdtim;
+       u32 bs_intval;
+#define ATH9K_BEACON_PERIOD       0x0000ffff
+#define ATH9K_BEACON_ENA          0x00800000
+#define ATH9K_BEACON_RESET_TSF    0x01000000
+       u32 bs_dtimperiod;
+       u16 bs_cfpperiod;
+       u16 bs_cfpmaxduration;
+       u32 bs_cfpnext;
+       u16 bs_timoffset;
+       u16 bs_bmissthreshold;
+       u32 bs_sleepduration;
+};
 
-struct hal_percal_data {
-       enum hal_cal_types calType;
-       u32 calNumSamples;
-       u32 calCountMax;
-       void (*calCollect) (struct ath_hal *);
-       void (*calPostProc) (struct ath_hal *, u8);
+struct chan_centers {
+       u16 synth_center;
+       u16 ctl_center;
+       u16 ext_center;
 };
 
-struct hal_cal_list {
-       const struct hal_percal_data *calData;
-       enum hal_cal_state calState;
-       struct hal_cal_list *calNext;
+enum {
+       ATH9K_RESET_POWER_ON,
+       ATH9K_RESET_WARM,
+       ATH9K_RESET_COLD,
 };
 
-/*
- * Enum to indentify the eeprom mappings
- */
-enum hal_eep_map {
-       EEP_MAP_DEFAULT = 0x0,
-       EEP_MAP_4KBITS,
-       EEP_MAP_MAX
+struct ath9k_hw_version {
+       u32 magic;
+       u16 devid;
+       u16 subvendorid;
+       u32 macVersion;
+       u16 macRev;
+       u16 phyRev;
+       u16 analog5GhzRev;
+       u16 analog2GhzRev;
 };
 
+struct ath_hw {
+       struct ath_softc *ah_sc;
+       struct ath9k_hw_version hw_version;
+       struct ath9k_ops_config config;
+       struct ath9k_hw_capabilities caps;
+       struct ath9k_regulatory regulatory;
+       struct ath9k_channel channels[38];
+       struct ath9k_channel *curchan;
 
-struct ath_hal_5416 {
-       struct ath_hal ah;
        union {
                struct ar5416_eeprom_def def;
                struct ar5416_eeprom_4k map4k;
-       } ah_eeprom;
-       struct ar5416Stats ah_stats;
-       struct ath9k_tx_queue_info ah_txq[ATH9K_NUM_TX_QUEUES];
-       void __iomem *ah_cal_mem;
-
-       u8 ah_macaddr[ETH_ALEN];
-       u8 ah_bssid[ETH_ALEN];
-       u8 ah_bssidmask[ETH_ALEN];
-       u16 ah_assocId;
-
-       int16_t ah_curchanRadIndex;
-       u32 ah_maskReg;
-       u32 ah_txOkInterruptMask;
-       u32 ah_txErrInterruptMask;
-       u32 ah_txDescInterruptMask;
-       u32 ah_txEolInterruptMask;
-       u32 ah_txUrnInterruptMask;
-       bool ah_chipFullSleep;
-       u32 ah_atimWindow;
-       u16 ah_antennaSwitchSwap;
-       enum ath9k_power_mode ah_powerMode;
-       enum ath9k_ant_setting ah_diversityControl;
+       } eeprom;
+       const struct eeprom_ops *eep_ops;
+       enum ath9k_eep_map eep_map;
+
+       bool sw_mgmt_crypto;
+       bool is_pciexpress;
+       u8 macaddr[ETH_ALEN];
+       u16 tx_trig_level;
+       u16 rfsilent;
+       u32 rfkill_gpio;
+       u32 rfkill_polarity;
+       u32 btactive_gpio;
+       u32 wlanactive_gpio;
+       u32 ah_flags;
+
+       enum nl80211_iftype opmode;
+       enum ath9k_power_mode power_mode;
+       enum ath9k_power_mode restore_mode;
+
+       struct ath9k_nfcal_hist nfCalHist[NUM_NF_READINGS];
+       struct ar5416Stats stats;
+       struct ath9k_tx_queue_info txq[ATH9K_NUM_TX_QUEUES];
+
+       int16_t curchan_rad_index;
+       u32 mask_reg;
+       u32 txok_interrupt_mask;
+       u32 txerr_interrupt_mask;
+       u32 txdesc_interrupt_mask;
+       u32 txeol_interrupt_mask;
+       u32 txurn_interrupt_mask;
+       bool chip_fullsleep;
+       u32 atim_window;
+       u16 antenna_switch_swap;
+       enum ath9k_ant_setting diversity_control;
 
        /* Calibration */
-       enum hal_cal_types ah_suppCals;
-       struct hal_cal_list ah_iqCalData;
-       struct hal_cal_list ah_adcGainCalData;
-       struct hal_cal_list ah_adcDcCalInitData;
-       struct hal_cal_list ah_adcDcCalData;
-       struct hal_cal_list *ah_cal_list;
-       struct hal_cal_list *ah_cal_list_last;
-       struct hal_cal_list *ah_cal_list_curr;
-#define ah_totalPowerMeasI ah_Meas0.unsign
-#define ah_totalPowerMeasQ ah_Meas1.unsign
-#define ah_totalIqCorrMeas ah_Meas2.sign
-#define ah_totalAdcIOddPhase  ah_Meas0.unsign
-#define ah_totalAdcIEvenPhase ah_Meas1.unsign
-#define ah_totalAdcQOddPhase  ah_Meas2.unsign
-#define ah_totalAdcQEvenPhase ah_Meas3.unsign
-#define ah_totalAdcDcOffsetIOddPhase  ah_Meas0.sign
-#define ah_totalAdcDcOffsetIEvenPhase ah_Meas1.sign
-#define ah_totalAdcDcOffsetQOddPhase  ah_Meas2.sign
-#define ah_totalAdcDcOffsetQEvenPhase ah_Meas3.sign
+       enum hal_cal_types supp_cals;
+       struct hal_cal_list iq_caldata;
+       struct hal_cal_list adcgain_caldata;
+       struct hal_cal_list adcdc_calinitdata;
+       struct hal_cal_list adcdc_caldata;
+       struct hal_cal_list *cal_list;
+       struct hal_cal_list *cal_list_last;
+       struct hal_cal_list *cal_list_curr;
+#define totalPowerMeasI meas0.unsign
+#define totalPowerMeasQ meas1.unsign
+#define totalIqCorrMeas meas2.sign
+#define totalAdcIOddPhase  meas0.unsign
+#define totalAdcIEvenPhase meas1.unsign
+#define totalAdcQOddPhase  meas2.unsign
+#define totalAdcQEvenPhase meas3.unsign
+#define totalAdcDcOffsetIOddPhase  meas0.sign
+#define totalAdcDcOffsetIEvenPhase meas1.sign
+#define totalAdcDcOffsetQOddPhase  meas2.sign
+#define totalAdcDcOffsetQEvenPhase meas3.sign
        union {
                u32 unsign[AR5416_MAX_CHAINS];
                int32_t sign[AR5416_MAX_CHAINS];
-       } ah_Meas0;
+       } meas0;
        union {
                u32 unsign[AR5416_MAX_CHAINS];
                int32_t sign[AR5416_MAX_CHAINS];
-       } ah_Meas1;
+       } meas1;
        union {
                u32 unsign[AR5416_MAX_CHAINS];
                int32_t sign[AR5416_MAX_CHAINS];
-       } ah_Meas2;
+       } meas2;
        union {
                u32 unsign[AR5416_MAX_CHAINS];
                int32_t sign[AR5416_MAX_CHAINS];
-       } ah_Meas3;
-       u16 ah_CalSamples;
+       } meas3;
+       u16 cal_samples;
 
-       u32 ah_staId1Defaults;
-       u32 ah_miscMode;
+       u32 sta_id1_defaults;
+       u32 misc_mode;
        enum {
                AUTO_32KHZ,
                USE_32KHZ,
                DONT_USE_32KHZ,
-       } ah_enable32kHzClock;
+       } enable_32kHz_clock;
 
        /* RF */
-       u32 *ah_analogBank0Data;
-       u32 *ah_analogBank1Data;
-       u32 *ah_analogBank2Data;
-       u32 *ah_analogBank3Data;
-       u32 *ah_analogBank6Data;
-       u32 *ah_analogBank6TPCData;
-       u32 *ah_analogBank7Data;
-       u32 *ah_addac5416_21;
-       u32 *ah_bank6Temp;
-
-       int16_t ah_txPowerIndexOffset;
-       u32 ah_beaconInterval;
-       u32 ah_slottime;
-       u32 ah_acktimeout;
-       u32 ah_ctstimeout;
-       u32 ah_globaltxtimeout;
-       u8 ah_gBeaconRate;
-       u32 ah_gpioSelect;
-       u32 ah_polarity;
-       u32 ah_gpioBit;
+       u32 *analogBank0Data;
+       u32 *analogBank1Data;
+       u32 *analogBank2Data;
+       u32 *analogBank3Data;
+       u32 *analogBank6Data;
+       u32 *analogBank6TPCData;
+       u32 *analogBank7Data;
+       u32 *addac5416_21;
+       u32 *bank6Temp;
+
+       int16_t txpower_indexoffset;
+       u32 beacon_interval;
+       u32 slottime;
+       u32 acktimeout;
+       u32 ctstimeout;
+       u32 globaltxtimeout;
+       u8 gbeacon_rate;
 
        /* ANI */
-       u32 ah_procPhyErr;
-       bool ah_hasHwPhyCounters;
-       u32 ah_aniPeriod;
-       struct ar5416AniState *ah_curani;
-       struct ar5416AniState ah_ani[255];
-       int ah_totalSizeDesired[5];
-       int ah_coarseHigh[5];
-       int ah_coarseLow[5];
-       int ah_firpwr[5];
-       enum ath9k_ani_cmd ah_ani_function;
-
-       u32 ah_intrTxqs;
-       bool ah_intrMitigation;
-       enum ath9k_ht_extprotspacing ah_extprotspacing;
-       u8 ah_txchainmask;
-       u8 ah_rxchainmask;
-
-       struct ar5416IniArray ah_iniModes;
-       struct ar5416IniArray ah_iniCommon;
-       struct ar5416IniArray ah_iniBank0;
-       struct ar5416IniArray ah_iniBB_RfGain;
-       struct ar5416IniArray ah_iniBank1;
-       struct ar5416IniArray ah_iniBank2;
-       struct ar5416IniArray ah_iniBank3;
-       struct ar5416IniArray ah_iniBank6;
-       struct ar5416IniArray ah_iniBank6TPC;
-       struct ar5416IniArray ah_iniBank7;
-       struct ar5416IniArray ah_iniAddac;
-       struct ar5416IniArray ah_iniPcieSerdes;
-       struct ar5416IniArray ah_iniModesAdditional;
-       struct ar5416IniArray ah_iniModesRxGain;
-       struct ar5416IniArray ah_iniModesTxGain;
-       /* To indicate EEPROM mapping used */
-       enum hal_eep_map ah_eep_map;
+       u32 proc_phyerr;
+       bool has_hw_phycounters;
+       u32 aniperiod;
+       struct ar5416AniState *curani;
+       struct ar5416AniState ani[255];
+       int totalSizeDesired[5];
+       int coarse_high[5];
+       int coarse_low[5];
+       int firpwr[5];
+       enum ath9k_ani_cmd ani_function;
+
+       u32 intr_txqs;
+       bool intr_mitigation;
+       enum ath9k_ht_extprotspacing extprotspacing;
+       u8 txchainmask;
+       u8 rxchainmask;
+
+       struct ar5416IniArray iniModes;
+       struct ar5416IniArray iniCommon;
+       struct ar5416IniArray iniBank0;
+       struct ar5416IniArray iniBB_RfGain;
+       struct ar5416IniArray iniBank1;
+       struct ar5416IniArray iniBank2;
+       struct ar5416IniArray iniBank3;
+       struct ar5416IniArray iniBank6;
+       struct ar5416IniArray iniBank6TPC;
+       struct ar5416IniArray iniBank7;
+       struct ar5416IniArray iniAddac;
+       struct ar5416IniArray iniPcieSerdes;
+       struct ar5416IniArray iniModesAdditional;
+       struct ar5416IniArray iniModesRxGain;
+       struct ar5416IniArray iniModesTxGain;
 };
-#define AH5416(_ah) ((struct ath_hal_5416 *)(_ah))
-
-#define FREQ2FBIN(x, y) ((y) ? ((x) - 2300) : (((x) - 4800) / 5))
-
-#define ar5416RfDetach(ah) do {                                        \
-               if (AH5416(ah)->ah_rfHal.rfDetach != NULL)      \
-                       AH5416(ah)->ah_rfHal.rfDetach(ah);      \
-       } while (0)
-
-#define ath9k_hw_use_flash(_ah)                        \
-       (!(_ah->ah_flags & AH_USE_EEPROM))
-
-
-#define DO_DELAY(x) do {                       \
-               if ((++(x) % 64) == 0)          \
-                       udelay(1);              \
-       } while (0)
-
-#define REG_WRITE_ARRAY(iniarray, column, regWr) do {                   \
-               int r;                                                  \
-               for (r = 0; r < ((iniarray)->ia_rows); r++) {           \
-                       REG_WRITE(ah, INI_RA((iniarray), (r), 0),       \
-                                 INI_RA((iniarray), r, (column)));     \
-                       DO_DELAY(regWr);                                \
-               }                                                       \
-       } while (0)
-
-#define BASE_ACTIVATE_DELAY         100
-#define RTC_PLL_SETTLE_DELAY        1000
-#define COEF_SCALE_S                24
-#define HT40_CHANNEL_CENTER_SHIFT   10
-
-#define AR5416_EEPROM_MAGIC_OFFSET  0x0
-
-#define AR5416_EEPROM_S             2
-#define AR5416_EEPROM_OFFSET        0x2000
-#define AR5416_EEPROM_START_ADDR \
-       (AR_SREV_9100(ah)) ? 0x1fff1000 : 0x503f1200
-#define AR5416_EEPROM_MAX           0xae0
-#define ar5416_get_eep_ver(_ahp) \
-       (((_ahp)->ah_eeprom.def.baseEepHeader.version >> 12) & 0xF)
-#define ar5416_get_eep_rev(_ahp) \
-       (((_ahp)->ah_eeprom.def.baseEepHeader.version) & 0xFFF)
-#define ar5416_get_ntxchains(_txchainmask) \
-       (((_txchainmask >> 2) & 1) + \
-               ((_txchainmask >> 1) & 1) + (_txchainmask & 1))
 
-/* EEPROM 4K bit map definations */
-#define ar5416_get_eep4k_ver(_ahp)   \
-    (((_ahp)->ah_eeprom.map4k.baseEepHeader.version >> 12) & 0xF)
-#define ar5416_get_eep4k_rev(_ahp)   \
-    (((_ahp)->ah_eeprom.map4k.baseEepHeader.version) & 0xFFF)
-
-
-#ifdef __BIG_ENDIAN
-#define AR5416_EEPROM_MAGIC 0x5aa5
-#else
-#define AR5416_EEPROM_MAGIC 0xa55a
+/* Attach, Detach, Reset */
+const char *ath9k_hw_probe(u16 vendorid, u16 devid);
+void ath9k_hw_detach(struct ath_hw *ah);
+struct ath_hw *ath9k_hw_attach(u16 devid, struct ath_softc *sc, int *error);
+void ath9k_hw_rfdetach(struct ath_hw *ah);
+int ath9k_hw_reset(struct ath_hw *ah, struct ath9k_channel *chan,
+                  bool bChannelChange);
+bool ath9k_hw_fill_cap_info(struct ath_hw *ah);
+bool ath9k_hw_getcapability(struct ath_hw *ah, enum ath9k_capability_type type,
+                           u32 capability, u32 *result);
+bool ath9k_hw_setcapability(struct ath_hw *ah, enum ath9k_capability_type type,
+                           u32 capability, u32 setting, int *status);
+
+/* Key Cache Management */
+bool ath9k_hw_keyreset(struct ath_hw *ah, u16 entry);
+bool ath9k_hw_keysetmac(struct ath_hw *ah, u16 entry, const u8 *mac);
+bool ath9k_hw_set_keycache_entry(struct ath_hw *ah, u16 entry,
+                                const struct ath9k_keyval *k,
+                                const u8 *mac, int xorKey);
+bool ath9k_hw_keyisvalid(struct ath_hw *ah, u16 entry);
+
+/* GPIO / RFKILL / Antennae */
+void ath9k_hw_cfg_gpio_input(struct ath_hw *ah, u32 gpio);
+u32 ath9k_hw_gpio_get(struct ath_hw *ah, u32 gpio);
+void ath9k_hw_cfg_output(struct ath_hw *ah, u32 gpio,
+                        u32 ah_signal_type);
+void ath9k_hw_set_gpio(struct ath_hw *ah, u32 gpio, u32 val);
+#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
+void ath9k_enable_rfkill(struct ath_hw *ah);
 #endif
-
-#define ATH9K_POW_SM(_r, _s)     (((_r) & 0x3f) << (_s))
-
-#define ATH9K_ANTENNA0_CHAINMASK        0x1
-#define ATH9K_ANTENNA1_CHAINMASK        0x2
-
-#define ATH9K_NUM_DMA_DEBUG_REGS        8
-#define ATH9K_NUM_QUEUES                10
-
-#define HAL_NOISE_IMMUNE_MAX            4
-#define HAL_SPUR_IMMUNE_MAX             7
-#define HAL_FIRST_STEP_MAX              2
-
-#define ATH9K_ANI_OFDM_TRIG_HIGH          500
-#define ATH9K_ANI_OFDM_TRIG_LOW           200
-#define ATH9K_ANI_CCK_TRIG_HIGH           200
-#define ATH9K_ANI_CCK_TRIG_LOW            100
-#define ATH9K_ANI_NOISE_IMMUNE_LVL        4
-#define ATH9K_ANI_USE_OFDM_WEAK_SIG       true
-#define ATH9K_ANI_CCK_WEAK_SIG_THR        false
-#define ATH9K_ANI_SPUR_IMMUNE_LVL         7
-#define ATH9K_ANI_FIRSTEP_LVL             0
-#define ATH9K_ANI_RSSI_THR_HIGH           40
-#define ATH9K_ANI_RSSI_THR_LOW            7
-#define ATH9K_ANI_PERIOD                  100
-
-#define AR_GPIOD_MASK                   0x00001FFF
-#define AR_GPIO_BIT(_gpio)              (1 << (_gpio))
-
-#define HAL_EP_RND(x, mul) \
-       ((((x)%(mul)) >= ((mul)/2)) ? ((x) + ((mul) - 1)) / (mul) : (x)/(mul))
-#define BEACON_RSSI(ahp) \
-       HAL_EP_RND(ahp->ah_stats.ast_nodestats.ns_avgbrssi, \
-               ATH9K_RSSI_EP_MULTIPLIER)
-
-#define ah_mibStats     ah_stats.ast_mibstats
-
-#define AH_TIMEOUT         100000
-#define AH_TIME_QUANTUM        10
-
-#define AR_KEYTABLE_SIZE 128
-#define POWER_UP_TIME    200000
-
-#define EXT_ADDITIVE (0x8000)
-#define CTL_11A_EXT (CTL_11A | EXT_ADDITIVE)
-#define CTL_11G_EXT (CTL_11G | EXT_ADDITIVE)
-#define CTL_11B_EXT (CTL_11B | EXT_ADDITIVE)
-
-#define SUB_NUM_CTL_MODES_AT_5G_40 2
-#define SUB_NUM_CTL_MODES_AT_2G_40 3
-#define SPUR_RSSI_THRESH 40
-
-#define TU_TO_USEC(_tu)         ((_tu) << 10)
-
-#define CAB_TIMEOUT_VAL         10
-#define BEACON_TIMEOUT_VAL      10
-#define MIN_BEACON_TIMEOUT_VAL   1
-#define SLEEP_SLOP               3
-
-#define CCK_SIFS_TIME        10
-#define CCK_PREAMBLE_BITS   144
-#define CCK_PLCP_BITS        48
-
-#define OFDM_SIFS_TIME        16
-#define OFDM_PREAMBLE_TIME    20
-#define OFDM_PLCP_BITS        22
-#define OFDM_SYMBOL_TIME      4
-
-#define OFDM_SIFS_TIME_HALF     32
-#define OFDM_PREAMBLE_TIME_HALF 40
-#define OFDM_PLCP_BITS_HALF     22
-#define OFDM_SYMBOL_TIME_HALF   8
-
-#define OFDM_SIFS_TIME_QUARTER      64
-#define OFDM_PREAMBLE_TIME_QUARTER  80
-#define OFDM_PLCP_BITS_QUARTER      22
-#define OFDM_SYMBOL_TIME_QUARTER    16
-
-u32 ath9k_hw_get_eeprom(struct ath_hal *ah,
-                       enum eeprom_param param);
+u32 ath9k_hw_getdefantenna(struct ath_hw *ah);
+void ath9k_hw_setantenna(struct ath_hw *ah, u32 antenna);
+bool ath9k_hw_setantennaswitch(struct ath_hw *ah,
+                              enum ath9k_ant_setting settings,
+                              struct ath9k_channel *chan,
+                              u8 *tx_chainmask, u8 *rx_chainmask,
+                              u8 *antenna_cfgd);
+
+/* General Operation */
+bool ath9k_hw_wait(struct ath_hw *ah, u32 reg, u32 mask, u32 val);
+u32 ath9k_hw_reverse_bits(u32 val, u32 n);
+bool ath9k_get_channel_edges(struct ath_hw *ah, u16 flags, u16 *low, u16 *high);
+u16 ath9k_hw_computetxtime(struct ath_hw *ah, struct ath_rate_table *rates,
+                          u32 frameLen, u16 rateix, bool shortPreamble);
+void ath9k_hw_get_channel_centers(struct ath_hw *ah,
+                                 struct ath9k_channel *chan,
+                                 struct chan_centers *centers);
+u32 ath9k_hw_getrxfilter(struct ath_hw *ah);
+void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits);
+bool ath9k_hw_phy_disable(struct ath_hw *ah);
+bool ath9k_hw_disable(struct ath_hw *ah);
+bool ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit);
+void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac);
+void ath9k_hw_setopmode(struct ath_hw *ah);
+void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
+void ath9k_hw_setbssidmask(struct ath_softc *sc);
+void ath9k_hw_write_associd(struct ath_softc *sc);
+u64 ath9k_hw_gettsf64(struct ath_hw *ah);
+void ath9k_hw_settsf64(struct ath_hw *ah, u64 tsf64);
+void ath9k_hw_reset_tsf(struct ath_hw *ah);
+bool ath9k_hw_set_tsfadjust(struct ath_hw *ah, u32 setting);
+bool ath9k_hw_setslottime(struct ath_hw *ah, u32 us);
+void ath9k_hw_set11nmac2040(struct ath_hw *ah, enum ath9k_ht_macmode mode);
+void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
+void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
+                                   const struct ath9k_beacon_state *bs);
+bool ath9k_hw_setpower(struct ath_hw *ah,
+                      enum ath9k_power_mode mode);
+void ath9k_hw_configpcipowersave(struct ath_hw *ah, int restore);
+
+/* Interrupt Handling */
+bool ath9k_hw_intrpend(struct ath_hw *ah);
+bool ath9k_hw_getisr(struct ath_hw *ah, enum ath9k_int *masked);
+enum ath9k_int ath9k_hw_intrget(struct ath_hw *ah);
+enum ath9k_int ath9k_hw_set_interrupts(struct ath_hw *ah, enum ath9k_int ints);
+
+void ath9k_hw_btcoex_enable(struct ath_hw *ah);
 
 #endif
index f3cfa16525e42d029c98be3d8d681a4bd39a2096..d49236368a1c7e866df2f273517c1230e1ea5893 100644 (file)
@@ -14,7 +14,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* AR5416 to Fowl ar5146.ini */
 static const u32 ar5416Modes_9100[][6] = {
     { 0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160, 0x000001e0 },
     { 0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c, 0x000001e0 },
@@ -659,10 +658,9 @@ static const u32 ar5416Addac_9100[][2] = {
     {0x0000989c,  0x00000000 },
     {0x0000989c,  0x00000000 },
     {0x0000989c,  0x00000000 },
-    {0x000098c4,  0x00000000 },
+    {0x000098cc,  0x00000000 },
 };
 
-/* ar5416 - howl ar5416_howl.ini */
 static const u32 ar5416Modes[][6] = {
     { 0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160, 0x000001e0 },
     { 0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c, 0x000001e0 },
@@ -1313,7 +1311,6 @@ static const u32 ar5416Addac[][2] = {
     {0x000098cc, 0x00000000 },
 };
 
-/* AR5416 9160 Sowl ar5416_sowl.ini */
 static const u32 ar5416Modes_9160[][6] = {
     { 0x00001030, 0x00000230, 0x00000460, 0x000002c0, 0x00000160, 0x000001e0 },
     { 0x00001070, 0x00000168, 0x000002d0, 0x00000318, 0x0000018c, 0x000001e0 },
@@ -2549,6 +2546,8 @@ static const u32 ar9280Modes_9280_2[][6] = {
     { 0x000010f0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000008 },
     { 0x00008014, 0x03e803e8, 0x07d007d0, 0x10801600, 0x08400b00, 0x06e006e0 },
     { 0x0000801c, 0x128d8027, 0x128d804f, 0x12e00057, 0x12e0002b, 0x0988004f },
+    { 0x00008120, 0x08f04800, 0x08f04800, 0x08f04810, 0x08f04810, 0x08f04810 },
+    { 0x000081d0, 0x00003210, 0x00003210, 0x0000320a, 0x0000320a, 0x0000320a },
     { 0x00008318, 0x00003e80, 0x00007d00, 0x00006880, 0x00003440, 0x00006880 },
     { 0x00009804, 0x00000300, 0x000003c4, 0x000003c4, 0x00000300, 0x00000303 },
     { 0x00009820, 0x02020200, 0x02020200, 0x02020200, 0x02020200, 0x02020200 },
@@ -2587,7 +2586,6 @@ static const u32 ar9280Modes_9280_2[][6] = {
     { 0x0000a21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a },
     { 0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108, 0x00000000 },
     { 0x0000a250, 0x001ff000, 0x001ff000, 0x0004a000, 0x0004a000, 0x0004a000 },
-    { 0x0000a274, 0x0a19c652, 0x0a19c652, 0x0a1aa652, 0x0a1aa652, 0x0a1aa652 },
     { 0x0000a358, 0x7999aa02, 0x7999aa02, 0x7999aa0e, 0x7999aa0e, 0x7999aa0e },
     { 0x0000a3d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     { 0x00007894, 0x5a508000, 0x5a508000, 0x5a508000, 0x5a508000, 0x5a508000 },
@@ -2719,7 +2717,6 @@ static const u32 ar9280Common_9280_2[][2] = {
     { 0x00008110, 0x00000168 },
     { 0x00008118, 0x000100aa },
     { 0x0000811c, 0x00003210 },
-    { 0x00008120, 0x08f04800 },
     { 0x00008124, 0x00000000 },
     { 0x00008128, 0x00000000 },
     { 0x0000812c, 0x00000000 },
@@ -2735,7 +2732,6 @@ static const u32 ar9280Common_9280_2[][2] = {
     { 0x00008178, 0x00000100 },
     { 0x0000817c, 0x00000000 },
     { 0x000081c0, 0x00000000 },
-    { 0x000081d0, 0x00003210 },
     { 0x000081ec, 0x00000000 },
     { 0x000081f0, 0x00000000 },
     { 0x000081f4, 0x00000000 },
@@ -2817,7 +2813,7 @@ static const u32 ar9280Common_9280_2[][2] = {
     { 0x00009958, 0x2108ecff },
     { 0x00009940, 0x14750604 },
     { 0x0000c95c, 0x004b6a8e },
-    { 0x00009968, 0x000003ce },
+    { 0x0000c968, 0x000003ce },
     { 0x00009970, 0x190fb515 },
     { 0x00009974, 0x00000000 },
     { 0x00009978, 0x00000001 },
@@ -2909,16 +2905,12 @@ static const u32 ar9280Common_9280_2[][2] = {
     { 0x0000780c, 0x21084210 },
     { 0x00007810, 0x6d801300 },
     { 0x00007818, 0x07e41000 },
-    { 0x0000781c, 0x00392000 },
-    { 0x00007820, 0x92592480 },
     { 0x00007824, 0x00040000 },
     { 0x00007828, 0xdb005012 },
     { 0x0000782c, 0x04924914 },
     { 0x00007830, 0x21084210 },
     { 0x00007834, 0x6d801300 },
     { 0x0000783c, 0x07e40000 },
-    { 0x00007840, 0x00392000 },
-    { 0x00007844, 0x92592480 },
     { 0x00007848, 0x00100000 },
     { 0x0000784c, 0x773f0567 },
     { 0x00007850, 0x54214514 },
@@ -2954,7 +2946,6 @@ static const u32 ar9280Modes_fast_clock_9280_2[][3] = {
     { 0x00009844, 0x03721821, 0x03721821 },
     { 0x00009914, 0x00000898, 0x00001130 },
     { 0x00009918, 0x0000000b, 0x00000016 },
-    { 0x00009944, 0xdfbc1210, 0xdfbc1210 },
 };
 
 static const u32 ar9280Modes_backoff_23db_rxgain_9280_2[][6] = {
@@ -3366,21 +3357,26 @@ static const u32 ar9280Modes_high_power_tx_gain_9280_2[][6] = {
     { 0x0000a318, 0x0001504a, 0x0001504a, 0x0001820a, 0x0001820a, 0x0001820a },
     { 0x0000a31c, 0x0001904c, 0x0001904c, 0x0001b211, 0x0001b211, 0x0001b211 },
     { 0x0000a320, 0x0001c04e, 0x0001c04e, 0x0001e213, 0x0001e213, 0x0001e213 },
-    { 0x0000a324, 0x00020092, 0x00020092, 0x00022411, 0x00022411, 0x00022411 },
-    { 0x0000a328, 0x0002410a, 0x0002410a, 0x00025413, 0x00025413, 0x00025413 },
-    { 0x0000a32c, 0x0002710c, 0x0002710c, 0x00029811, 0x00029811, 0x00029811 },
-    { 0x0000a330, 0x0002b18b, 0x0002b18b, 0x0002c813, 0x0002c813, 0x0002c813 },
-    { 0x0000a334, 0x0002e1cc, 0x0002e1cc, 0x00030a14, 0x00030a14, 0x00030a14 },
-    { 0x0000a338, 0x000321ec, 0x000321ec, 0x00035a50, 0x00035a50, 0x00035a50 },
-    { 0x0000a33c, 0x000321ec, 0x000321ec, 0x00039c4c, 0x00039c4c, 0x00039c4c },
-    { 0x0000a340, 0x000321ec, 0x000321ec, 0x0003de8a, 0x0003de8a, 0x0003de8a },
-    { 0x0000a344, 0x000321ec, 0x000321ec, 0x00042e92, 0x00042e92, 0x00042e92 },
-    { 0x0000a348, 0x000321ec, 0x000321ec, 0x00046ed2, 0x00046ed2, 0x00046ed2 },
-    { 0x0000a34c, 0x000321ec, 0x000321ec, 0x0004bed5, 0x0004bed5, 0x0004bed5 },
-    { 0x0000a350, 0x000321ec, 0x000321ec, 0x0004ff54, 0x0004ff54, 0x0004ff54 },
-    { 0x0000a354, 0x000321ec, 0x000321ec, 0x00053fd5, 0x00053fd5, 0x00053fd5 },
+    { 0x0000a324, 0x00021092, 0x00021092, 0x00022411, 0x00022411, 0x00022411 },
+    { 0x0000a328, 0x0002510a, 0x0002510a, 0x00025413, 0x00025413, 0x00025413 },
+    { 0x0000a32c, 0x0002910c, 0x0002910c, 0x00029811, 0x00029811, 0x00029811 },
+    { 0x0000a330, 0x0002c18b, 0x0002c18b, 0x0002c813, 0x0002c813, 0x0002c813 },
+    { 0x0000a334, 0x0002f1cc, 0x0002f1cc, 0x00030a14, 0x00030a14, 0x00030a14 },
+    { 0x0000a338, 0x000321eb, 0x000321eb, 0x00035a50, 0x00035a50, 0x00035a50 },
+    { 0x0000a33c, 0x000341ec, 0x000341ec, 0x00039c4c, 0x00039c4c, 0x00039c4c },
+    { 0x0000a340, 0x000341ec, 0x000341ec, 0x0003de8a, 0x0003de8a, 0x0003de8a },
+    { 0x0000a344, 0x000341ec, 0x000341ec, 0x00042e92, 0x00042e92, 0x00042e92 },
+    { 0x0000a348, 0x000341ec, 0x000341ec, 0x00046ed2, 0x00046ed2, 0x00046ed2 },
+    { 0x0000a34c, 0x000341ec, 0x000341ec, 0x0004bed5, 0x0004bed5, 0x0004bed5 },
+    { 0x0000a350, 0x000341ec, 0x000341ec, 0x0004ff54, 0x0004ff54, 0x0004ff54 },
+    { 0x0000a354, 0x000341ec, 0x000341ec, 0x00055fd5, 0x00055fd5, 0x00055fd5 },
     { 0x00007814, 0x00198eff, 0x00198eff, 0x00198eff, 0x00198eff, 0x00198eff },
     { 0x00007838, 0x00198eff, 0x00198eff, 0x00198eff, 0x00198eff, 0x00198eff },
+    { 0x0000781c, 0x00172000, 0x00172000, 0x00172000, 0x00172000, 0x00172000 },
+    { 0x00007840, 0x00172000, 0x00172000, 0x00172000, 0x00172000, 0x00172000 },
+    { 0x00007820, 0xf258a480, 0xf258a480, 0xf258a480, 0xf258a480, 0xf258a480 },
+    { 0x00007844, 0xf258a480, 0xf258a480, 0xf258a480, 0xf258a480, 0xf258a480 },
+    { 0x0000a274, 0x0a19e652, 0x0a19e652, 0x0a1aa652, 0x0a1aa652, 0x0a1aa652 },
     { 0x0000a27c, 0x050739ce, 0x050739ce, 0x050739ce, 0x050739ce, 0x050739ce },
 };
 
@@ -3409,6 +3405,11 @@ static const u32 ar9280Modes_original_tx_gain_9280_2[][6] = {
     { 0x0000a354, 0x000321ec, 0x000321ec, 0x0004bf42, 0x0004bf42, 0x0004bf42 },
     { 0x00007814, 0x0019beff, 0x0019beff, 0x0019beff, 0x0019beff, 0x0019beff },
     { 0x00007838, 0x0019beff, 0x0019beff, 0x0019beff, 0x0019beff, 0x0019beff },
+    { 0x0000781c, 0x00392000, 0x00392000, 0x00392000, 0x00392000, 0x00392000 },
+    { 0x00007840, 0x00392000, 0x00392000, 0x00392000, 0x00392000, 0x00392000 },
+    { 0x00007820, 0x92592480, 0x92592480, 0x92592480, 0x92592480, 0x92592480 },
+    { 0x00007844, 0x92592480, 0x92592480, 0x92592480, 0x92592480, 0x92592480 },
+    { 0x0000a274, 0x0a19c652, 0x0a19c652, 0x0a1aa652, 0x0a1aa652, 0x0a1aa652 },
     { 0x0000a27c, 0x050701ce, 0x050701ce, 0x050701ce, 0x050701ce, 0x050701ce },
 };
 
@@ -4135,11 +4136,11 @@ static const u_int32_t ar9285Modes_9285_1_2[][6] = {
     { 0x00009834, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e, 0x00000e0e },
     { 0x00009838, 0x00000007, 0x00000007, 0x00000007, 0x00000007, 0x00000007 },
     { 0x00009840, 0x206a012e, 0x206a012e, 0x206a012e, 0x206a012e, 0x206a012e },
-    { 0x00009844, 0x0372161e, 0x0372161e, 0x03720020, 0x03720020, 0x037216a0 },
-    { 0x00009848, 0x00001066, 0x00001066, 0x00000057, 0x00000057, 0x00001059 },
+    { 0x00009844, 0x0372161e, 0x0372161e, 0x03721620, 0x03721620, 0x037216a0 },
+    { 0x00009848, 0x00001066, 0x00001066, 0x00001053, 0x00001053, 0x00001059 },
     { 0x00009850, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2, 0x6d4000e2 },
     { 0x00009858, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e, 0x7ec84d2e },
-    { 0x0000985c, 0x3139605e, 0x3139605e, 0x3136605e, 0x3136605e, 0x3139605e },
+    { 0x0000985c, 0x3139605e, 0x3139605e, 0x3137605e, 0x3137605e, 0x3139605e },
     { 0x00009860, 0x00058d18, 0x00058d18, 0x00058d20, 0x00058d20, 0x00058d18 },
     { 0x00009864, 0x0000fe00, 0x0000fe00, 0x0001ce00, 0x0001ce00, 0x0001ce00 },
     { 0x00009868, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0, 0x5ac640d0 },
@@ -4159,264 +4160,264 @@ static const u_int32_t ar9285Modes_9285_1_2[][6] = {
     { 0x000099d0, 0x00046384, 0x00046384, 0x00046384, 0x00046384, 0x00046384 },
     { 0x000099d4, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
     { 0x000099d8, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 },
-    { 0x00009a00, 0x00000000, 0x00000000, 0x00068084, 0x00068084, 0x00000000 },
-    { 0x00009a04, 0x00000000, 0x00000000, 0x00068088, 0x00068088, 0x00000000 },
-    { 0x00009a08, 0x00000000, 0x00000000, 0x0006808c, 0x0006808c, 0x00000000 },
-    { 0x00009a0c, 0x00000000, 0x00000000, 0x00068100, 0x00068100, 0x00000000 },
-    { 0x00009a10, 0x00000000, 0x00000000, 0x00068104, 0x00068104, 0x00000000 },
-    { 0x00009a14, 0x00000000, 0x00000000, 0x00068108, 0x00068108, 0x00000000 },
-    { 0x00009a18, 0x00000000, 0x00000000, 0x0006810c, 0x0006810c, 0x00000000 },
-    { 0x00009a1c, 0x00000000, 0x00000000, 0x00068110, 0x00068110, 0x00000000 },
-    { 0x00009a20, 0x00000000, 0x00000000, 0x00068114, 0x00068114, 0x00000000 },
-    { 0x00009a24, 0x00000000, 0x00000000, 0x00068180, 0x00068180, 0x00000000 },
-    { 0x00009a28, 0x00000000, 0x00000000, 0x00068184, 0x00068184, 0x00000000 },
-    { 0x00009a2c, 0x00000000, 0x00000000, 0x00068188, 0x00068188, 0x00000000 },
-    { 0x00009a30, 0x00000000, 0x00000000, 0x0006818c, 0x0006818c, 0x00000000 },
-    { 0x00009a34, 0x00000000, 0x00000000, 0x00068190, 0x00068190, 0x00000000 },
-    { 0x00009a38, 0x00000000, 0x00000000, 0x00068194, 0x00068194, 0x00000000 },
-    { 0x00009a3c, 0x00000000, 0x00000000, 0x000681a0, 0x000681a0, 0x00000000 },
-    { 0x00009a40, 0x00000000, 0x00000000, 0x0006820c, 0x0006820c, 0x00000000 },
-    { 0x00009a44, 0x00000000, 0x00000000, 0x000681a8, 0x000681a8, 0x00000000 },
-    { 0x00009a48, 0x00000000, 0x00000000, 0x00068284, 0x00068284, 0x00000000 },
-    { 0x00009a4c, 0x00000000, 0x00000000, 0x00068288, 0x00068288, 0x00000000 },
-    { 0x00009a50, 0x00000000, 0x00000000, 0x00068220, 0x00068220, 0x00000000 },
-    { 0x00009a54, 0x00000000, 0x00000000, 0x00068290, 0x00068290, 0x00000000 },
-    { 0x00009a58, 0x00000000, 0x00000000, 0x00068300, 0x00068300, 0x00000000 },
-    { 0x00009a5c, 0x00000000, 0x00000000, 0x00068304, 0x00068304, 0x00000000 },
-    { 0x00009a60, 0x00000000, 0x00000000, 0x00068308, 0x00068308, 0x00000000 },
-    { 0x00009a64, 0x00000000, 0x00000000, 0x0006830c, 0x0006830c, 0x00000000 },
-    { 0x00009a68, 0x00000000, 0x00000000, 0x00068380, 0x00068380, 0x00000000 },
-    { 0x00009a6c, 0x00000000, 0x00000000, 0x00068384, 0x00068384, 0x00000000 },
+    { 0x00009a00, 0x00000000, 0x00000000, 0x00058084, 0x00058084, 0x00000000 },
+    { 0x00009a04, 0x00000000, 0x00000000, 0x00058088, 0x00058088, 0x00000000 },
+    { 0x00009a08, 0x00000000, 0x00000000, 0x0005808c, 0x0005808c, 0x00000000 },
+    { 0x00009a0c, 0x00000000, 0x00000000, 0x00058100, 0x00058100, 0x00000000 },
+    { 0x00009a10, 0x00000000, 0x00000000, 0x00058104, 0x00058104, 0x00000000 },
+    { 0x00009a14, 0x00000000, 0x00000000, 0x00058108, 0x00058108, 0x00000000 },
+    { 0x00009a18, 0x00000000, 0x00000000, 0x0005810c, 0x0005810c, 0x00000000 },
+    { 0x00009a1c, 0x00000000, 0x00000000, 0x00058110, 0x00058110, 0x00000000 },
+    { 0x00009a20, 0x00000000, 0x00000000, 0x00058114, 0x00058114, 0x00000000 },
+    { 0x00009a24, 0x00000000, 0x00000000, 0x00058180, 0x00058180, 0x00000000 },
+    { 0x00009a28, 0x00000000, 0x00000000, 0x00058184, 0x00058184, 0x00000000 },
+    { 0x00009a2c, 0x00000000, 0x00000000, 0x00058188, 0x00058188, 0x00000000 },
+    { 0x00009a30, 0x00000000, 0x00000000, 0x0005818c, 0x0005818c, 0x00000000 },
+    { 0x00009a34, 0x00000000, 0x00000000, 0x00058190, 0x00058190, 0x00000000 },
+    { 0x00009a38, 0x00000000, 0x00000000, 0x00058194, 0x00058194, 0x00000000 },
+    { 0x00009a3c, 0x00000000, 0x00000000, 0x000581a0, 0x000581a0, 0x00000000 },
+    { 0x00009a40, 0x00000000, 0x00000000, 0x0005820c, 0x0005820c, 0x00000000 },
+    { 0x00009a44, 0x00000000, 0x00000000, 0x000581a8, 0x000581a8, 0x00000000 },
+    { 0x00009a48, 0x00000000, 0x00000000, 0x00058284, 0x00058284, 0x00000000 },
+    { 0x00009a4c, 0x00000000, 0x00000000, 0x00058288, 0x00058288, 0x00000000 },
+    { 0x00009a50, 0x00000000, 0x00000000, 0x00058220, 0x00058220, 0x00000000 },
+    { 0x00009a54, 0x00000000, 0x00000000, 0x00058290, 0x00058290, 0x00000000 },
+    { 0x00009a58, 0x00000000, 0x00000000, 0x00058300, 0x00058300, 0x00000000 },
+    { 0x00009a5c, 0x00000000, 0x00000000, 0x00058304, 0x00058304, 0x00000000 },
+    { 0x00009a60, 0x00000000, 0x00000000, 0x00058308, 0x00058308, 0x00000000 },
+    { 0x00009a64, 0x00000000, 0x00000000, 0x0005830c, 0x0005830c, 0x00000000 },
+    { 0x00009a68, 0x00000000, 0x00000000, 0x00058380, 0x00058380, 0x00000000 },
+    { 0x00009a6c, 0x00000000, 0x00000000, 0x00058384, 0x00058384, 0x00000000 },
     { 0x00009a70, 0x00000000, 0x00000000, 0x00068700, 0x00068700, 0x00000000 },
     { 0x00009a74, 0x00000000, 0x00000000, 0x00068704, 0x00068704, 0x00000000 },
     { 0x00009a78, 0x00000000, 0x00000000, 0x00068708, 0x00068708, 0x00000000 },
     { 0x00009a7c, 0x00000000, 0x00000000, 0x0006870c, 0x0006870c, 0x00000000 },
     { 0x00009a80, 0x00000000, 0x00000000, 0x00068780, 0x00068780, 0x00000000 },
     { 0x00009a84, 0x00000000, 0x00000000, 0x00068784, 0x00068784, 0x00000000 },
-    { 0x00009a88, 0x00000000, 0x00000000, 0x00068b04, 0x00068b04, 0x00000000 },
-    { 0x00009a8c, 0x00000000, 0x00000000, 0x00068b08, 0x00068b08, 0x00000000 },
-    { 0x00009a90, 0x00000000, 0x00000000, 0x00068b08, 0x00068b08, 0x00000000 },
-    { 0x00009a94, 0x00000000, 0x00000000, 0x00068b0c, 0x00068b0c, 0x00000000 },
-    { 0x00009a98, 0x00000000, 0x00000000, 0x00068b80, 0x00068b80, 0x00000000 },
-    { 0x00009a9c, 0x00000000, 0x00000000, 0x00068b84, 0x00068b84, 0x00000000 },
-    { 0x00009aa0, 0x00000000, 0x00000000, 0x00068b88, 0x00068b88, 0x00000000 },
-    { 0x00009aa4, 0x00000000, 0x00000000, 0x00068b8c, 0x00068b8c, 0x00000000 },
-    { 0x00009aa8, 0x00000000, 0x00000000, 0x000b8b90, 0x000b8b90, 0x00000000 },
-    { 0x00009aac, 0x00000000, 0x00000000, 0x000b8f80, 0x000b8f80, 0x00000000 },
-    { 0x00009ab0, 0x00000000, 0x00000000, 0x000b8f84, 0x000b8f84, 0x00000000 },
-    { 0x00009ab4, 0x00000000, 0x00000000, 0x000b8f88, 0x000b8f88, 0x00000000 },
-    { 0x00009ab8, 0x00000000, 0x00000000, 0x000b8f8c, 0x000b8f8c, 0x00000000 },
-    { 0x00009abc, 0x00000000, 0x00000000, 0x000b8f90, 0x000b8f90, 0x00000000 },
-    { 0x00009ac0, 0x00000000, 0x00000000, 0x000bb30c, 0x000bb30c, 0x00000000 },
-    { 0x00009ac4, 0x00000000, 0x00000000, 0x000bb310, 0x000bb310, 0x00000000 },
-    { 0x00009ac8, 0x00000000, 0x00000000, 0x000bb384, 0x000bb384, 0x00000000 },
-    { 0x00009acc, 0x00000000, 0x00000000, 0x000bb388, 0x000bb388, 0x00000000 },
-    { 0x00009ad0, 0x00000000, 0x00000000, 0x000bb324, 0x000bb324, 0x00000000 },
-    { 0x00009ad4, 0x00000000, 0x00000000, 0x000bb704, 0x000bb704, 0x00000000 },
-    { 0x00009ad8, 0x00000000, 0x00000000, 0x000f96a4, 0x000f96a4, 0x00000000 },
-    { 0x00009adc, 0x00000000, 0x00000000, 0x000f96a8, 0x000f96a8, 0x00000000 },
-    { 0x00009ae0, 0x00000000, 0x00000000, 0x000f9710, 0x000f9710, 0x00000000 },
-    { 0x00009ae4, 0x00000000, 0x00000000, 0x000f9714, 0x000f9714, 0x00000000 },
-    { 0x00009ae8, 0x00000000, 0x00000000, 0x000f9720, 0x000f9720, 0x00000000 },
-    { 0x00009aec, 0x00000000, 0x00000000, 0x000f9724, 0x000f9724, 0x00000000 },
-    { 0x00009af0, 0x00000000, 0x00000000, 0x000f9728, 0x000f9728, 0x00000000 },
-    { 0x00009af4, 0x00000000, 0x00000000, 0x000f972c, 0x000f972c, 0x00000000 },
-    { 0x00009af8, 0x00000000, 0x00000000, 0x000f97a0, 0x000f97a0, 0x00000000 },
-    { 0x00009afc, 0x00000000, 0x00000000, 0x000f97a4, 0x000f97a4, 0x00000000 },
-    { 0x00009b00, 0x00000000, 0x00000000, 0x000fb7a8, 0x000fb7a8, 0x00000000 },
-    { 0x00009b04, 0x00000000, 0x00000000, 0x000fb7b0, 0x000fb7b0, 0x00000000 },
-    { 0x00009b08, 0x00000000, 0x00000000, 0x000fb7b4, 0x000fb7b4, 0x00000000 },
-    { 0x00009b0c, 0x00000000, 0x00000000, 0x000fb7b8, 0x000fb7b8, 0x00000000 },
-    { 0x00009b10, 0x00000000, 0x00000000, 0x000fb7a5, 0x000fb7a5, 0x00000000 },
-    { 0x00009b14, 0x00000000, 0x00000000, 0x000fb7a9, 0x000fb7a9, 0x00000000 },
-    { 0x00009b18, 0x00000000, 0x00000000, 0x000fb7ad, 0x000fb7ad, 0x00000000 },
-    { 0x00009b1c, 0x00000000, 0x00000000, 0x000fb7b1, 0x000fb7b1, 0x00000000 },
-    { 0x00009b20, 0x00000000, 0x00000000, 0x000fb7b5, 0x000fb7b5, 0x00000000 },
-    { 0x00009b24, 0x00000000, 0x00000000, 0x000fb7b9, 0x000fb7b9, 0x00000000 },
-    { 0x00009b28, 0x00000000, 0x00000000, 0x000fb7c5, 0x000fb7c5, 0x00000000 },
-    { 0x00009b2c, 0x00000000, 0x00000000, 0x000fb7c9, 0x000fb7c9, 0x00000000 },
-    { 0x00009b30, 0x00000000, 0x00000000, 0x000fb7d1, 0x000fb7d1, 0x00000000 },
-    { 0x00009b34, 0x00000000, 0x00000000, 0x000fb7d5, 0x000fb7d5, 0x00000000 },
-    { 0x00009b38, 0x00000000, 0x00000000, 0x000fb7d9, 0x000fb7d9, 0x00000000 },
-    { 0x00009b3c, 0x00000000, 0x00000000, 0x000fb7c6, 0x000fb7c6, 0x00000000 },
-    { 0x00009b40, 0x00000000, 0x00000000, 0x000fb7ca, 0x000fb7ca, 0x00000000 },
-    { 0x00009b44, 0x00000000, 0x00000000, 0x000fb7ce, 0x000fb7ce, 0x00000000 },
-    { 0x00009b48, 0x00000000, 0x00000000, 0x000fb7d2, 0x000fb7d2, 0x00000000 },
-    { 0x00009b4c, 0x00000000, 0x00000000, 0x000fb7d6, 0x000fb7d6, 0x00000000 },
-    { 0x00009b50, 0x00000000, 0x00000000, 0x000fb7c3, 0x000fb7c3, 0x00000000 },
-    { 0x00009b54, 0x00000000, 0x00000000, 0x000fb7c7, 0x000fb7c7, 0x00000000 },
-    { 0x00009b58, 0x00000000, 0x00000000, 0x000fb7cb, 0x000fb7cb, 0x00000000 },
-    { 0x00009b5c, 0x00000000, 0x00000000, 0x000fb7cf, 0x000fb7cf, 0x00000000 },
-    { 0x00009b60, 0x00000000, 0x00000000, 0x000fb7d7, 0x000fb7d7, 0x00000000 },
-    { 0x00009b64, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b68, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b6c, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b70, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b74, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b78, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b7c, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b80, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b84, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b88, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b8c, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b90, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b94, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b98, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009b9c, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009ba0, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009ba4, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009ba8, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bac, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bb0, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bb4, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bb8, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bbc, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bc0, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bc4, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bc8, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bcc, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bd0, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bd4, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bd8, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bdc, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009be0, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009be4, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009be8, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bec, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bf0, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bf4, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bf8, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x00009bfc, 0x00000000, 0x00000000, 0x000fb7db, 0x000fb7db, 0x00000000 },
-    { 0x0000aa00, 0x00000000, 0x00000000, 0x0006801c, 0x0006801c, 0x00000000 },
-    { 0x0000aa04, 0x00000000, 0x00000000, 0x0006801c, 0x0006801c, 0x00000000 },
-    { 0x0000aa08, 0x00000000, 0x00000000, 0x0006801c, 0x0006801c, 0x00000000 },
-    { 0x0000aa0c, 0x00000000, 0x00000000, 0x00068080, 0x00068080, 0x00000000 },
-    { 0x0000aa10, 0x00000000, 0x00000000, 0x00068084, 0x00068084, 0x00000000 },
-    { 0x0000aa14, 0x00000000, 0x00000000, 0x00068088, 0x00068088, 0x00000000 },
-    { 0x0000aa18, 0x00000000, 0x00000000, 0x0006808c, 0x0006808c, 0x00000000 },
-    { 0x0000aa1c, 0x00000000, 0x00000000, 0x00068100, 0x00068100, 0x00000000 },
-    { 0x0000aa20, 0x00000000, 0x00000000, 0x00068104, 0x00068104, 0x00000000 },
-    { 0x0000aa24, 0x00000000, 0x00000000, 0x00068108, 0x00068108, 0x00000000 },
-    { 0x0000aa28, 0x00000000, 0x00000000, 0x0006810c, 0x0006810c, 0x00000000 },
-    { 0x0000aa2c, 0x00000000, 0x00000000, 0x00068110, 0x00068110, 0x00000000 },
-    { 0x0000aa30, 0x00000000, 0x00000000, 0x00068110, 0x00068110, 0x00000000 },
-    { 0x0000aa34, 0x00000000, 0x00000000, 0x00068180, 0x00068180, 0x00000000 },
-    { 0x0000aa38, 0x00000000, 0x00000000, 0x00068184, 0x00068184, 0x00000000 },
-    { 0x0000aa3c, 0x00000000, 0x00000000, 0x00068188, 0x00068188, 0x00000000 },
-    { 0x0000aa40, 0x00000000, 0x00000000, 0x0006818c, 0x0006818c, 0x00000000 },
-    { 0x0000aa44, 0x00000000, 0x00000000, 0x00068190, 0x00068190, 0x00000000 },
-    { 0x0000aa48, 0x00000000, 0x00000000, 0x00068194, 0x00068194, 0x00000000 },
-    { 0x0000aa4c, 0x00000000, 0x00000000, 0x000681a0, 0x000681a0, 0x00000000 },
-    { 0x0000aa50, 0x00000000, 0x00000000, 0x0006820c, 0x0006820c, 0x00000000 },
-    { 0x0000aa54, 0x00000000, 0x00000000, 0x000681a8, 0x000681a8, 0x00000000 },
-    { 0x0000aa58, 0x00000000, 0x00000000, 0x000681ac, 0x000681ac, 0x00000000 },
-    { 0x0000aa5c, 0x00000000, 0x00000000, 0x0006821c, 0x0006821c, 0x00000000 },
-    { 0x0000aa60, 0x00000000, 0x00000000, 0x00068224, 0x00068224, 0x00000000 },
-    { 0x0000aa64, 0x00000000, 0x00000000, 0x00068290, 0x00068290, 0x00000000 },
-    { 0x0000aa68, 0x00000000, 0x00000000, 0x00068300, 0x00068300, 0x00000000 },
-    { 0x0000aa6c, 0x00000000, 0x00000000, 0x00068308, 0x00068308, 0x00000000 },
-    { 0x0000aa70, 0x00000000, 0x00000000, 0x0006830c, 0x0006830c, 0x00000000 },
-    { 0x0000aa74, 0x00000000, 0x00000000, 0x00068310, 0x00068310, 0x00000000 },
-    { 0x0000aa78, 0x00000000, 0x00000000, 0x00068788, 0x00068788, 0x00000000 },
-    { 0x0000aa7c, 0x00000000, 0x00000000, 0x0006878c, 0x0006878c, 0x00000000 },
-    { 0x0000aa80, 0x00000000, 0x00000000, 0x00068790, 0x00068790, 0x00000000 },
-    { 0x0000aa84, 0x00000000, 0x00000000, 0x00068794, 0x00068794, 0x00000000 },
-    { 0x0000aa88, 0x00000000, 0x00000000, 0x00068798, 0x00068798, 0x00000000 },
-    { 0x0000aa8c, 0x00000000, 0x00000000, 0x0006879c, 0x0006879c, 0x00000000 },
-    { 0x0000aa90, 0x00000000, 0x00000000, 0x00068b89, 0x00068b89, 0x00000000 },
-    { 0x0000aa94, 0x00000000, 0x00000000, 0x00068b8d, 0x00068b8d, 0x00000000 },
-    { 0x0000aa98, 0x00000000, 0x00000000, 0x00068b91, 0x00068b91, 0x00000000 },
-    { 0x0000aa9c, 0x00000000, 0x00000000, 0x00068b95, 0x00068b95, 0x00000000 },
-    { 0x0000aaa0, 0x00000000, 0x00000000, 0x00068b99, 0x00068b99, 0x00000000 },
-    { 0x0000aaa4, 0x00000000, 0x00000000, 0x00068ba5, 0x00068ba5, 0x00000000 },
-    { 0x0000aaa8, 0x00000000, 0x00000000, 0x00068ba9, 0x00068ba9, 0x00000000 },
-    { 0x0000aaac, 0x00000000, 0x00000000, 0x00068bad, 0x00068bad, 0x00000000 },
-    { 0x0000aab0, 0x00000000, 0x00000000, 0x000b8b0c, 0x000b8b0c, 0x00000000 },
-    { 0x0000aab4, 0x00000000, 0x00000000, 0x000b8f10, 0x000b8f10, 0x00000000 },
-    { 0x0000aab8, 0x00000000, 0x00000000, 0x000b8f14, 0x000b8f14, 0x00000000 },
-    { 0x0000aabc, 0x00000000, 0x00000000, 0x000b8f84, 0x000b8f84, 0x00000000 },
-    { 0x0000aac0, 0x00000000, 0x00000000, 0x000b8f84, 0x000b8f84, 0x00000000 },
-    { 0x0000aac4, 0x00000000, 0x00000000, 0x000b8f88, 0x000b8f88, 0x00000000 },
-    { 0x0000aac8, 0x00000000, 0x00000000, 0x000bb380, 0x000bb380, 0x00000000 },
-    { 0x0000aacc, 0x00000000, 0x00000000, 0x000bb384, 0x000bb384, 0x00000000 },
-    { 0x0000aad0, 0x00000000, 0x00000000, 0x000bb388, 0x000bb388, 0x00000000 },
-    { 0x0000aad4, 0x00000000, 0x00000000, 0x000bb38c, 0x000bb38c, 0x00000000 },
-    { 0x0000aad8, 0x00000000, 0x00000000, 0x000bb394, 0x000bb394, 0x00000000 },
-    { 0x0000aadc, 0x00000000, 0x00000000, 0x000bb798, 0x000bb798, 0x00000000 },
-    { 0x0000aae0, 0x00000000, 0x00000000, 0x000f970c, 0x000f970c, 0x00000000 },
-    { 0x0000aae4, 0x00000000, 0x00000000, 0x000f9710, 0x000f9710, 0x00000000 },
-    { 0x0000aae8, 0x00000000, 0x00000000, 0x000f9714, 0x000f9714, 0x00000000 },
-    { 0x0000aaec, 0x00000000, 0x00000000, 0x000f9718, 0x000f9718, 0x00000000 },
-    { 0x0000aaf0, 0x00000000, 0x00000000, 0x000f9705, 0x000f9705, 0x00000000 },
-    { 0x0000aaf4, 0x00000000, 0x00000000, 0x000f9709, 0x000f9709, 0x00000000 },
-    { 0x0000aaf8, 0x00000000, 0x00000000, 0x000f970d, 0x000f970d, 0x00000000 },
-    { 0x0000aafc, 0x00000000, 0x00000000, 0x000f9711, 0x000f9711, 0x00000000 },
-    { 0x0000ab00, 0x00000000, 0x00000000, 0x000f9715, 0x000f9715, 0x00000000 },
-    { 0x0000ab04, 0x00000000, 0x00000000, 0x000f9719, 0x000f9719, 0x00000000 },
-    { 0x0000ab08, 0x00000000, 0x00000000, 0x000fb7a4, 0x000fb7a4, 0x00000000 },
-    { 0x0000ab0c, 0x00000000, 0x00000000, 0x000fb7a8, 0x000fb7a8, 0x00000000 },
-    { 0x0000ab10, 0x00000000, 0x00000000, 0x000fb7ac, 0x000fb7ac, 0x00000000 },
-    { 0x0000ab14, 0x00000000, 0x00000000, 0x000fb7ac, 0x000fb7ac, 0x00000000 },
-    { 0x0000ab18, 0x00000000, 0x00000000, 0x000fb7b0, 0x000fb7b0, 0x00000000 },
-    { 0x0000ab1c, 0x00000000, 0x00000000, 0x000fb7b8, 0x000fb7b8, 0x00000000 },
-    { 0x0000ab20, 0x00000000, 0x00000000, 0x000fb7bc, 0x000fb7bc, 0x00000000 },
-    { 0x0000ab24, 0x00000000, 0x00000000, 0x000fb7a1, 0x000fb7a1, 0x00000000 },
-    { 0x0000ab28, 0x00000000, 0x00000000, 0x000fb7a5, 0x000fb7a5, 0x00000000 },
-    { 0x0000ab2c, 0x00000000, 0x00000000, 0x000fb7a9, 0x000fb7a9, 0x00000000 },
-    { 0x0000ab30, 0x00000000, 0x00000000, 0x000fb7b1, 0x000fb7b1, 0x00000000 },
-    { 0x0000ab34, 0x00000000, 0x00000000, 0x000fb7b5, 0x000fb7b5, 0x00000000 },
-    { 0x0000ab38, 0x00000000, 0x00000000, 0x000fb7bd, 0x000fb7bd, 0x00000000 },
-    { 0x0000ab3c, 0x00000000, 0x00000000, 0x000fb7c9, 0x000fb7c9, 0x00000000 },
-    { 0x0000ab40, 0x00000000, 0x00000000, 0x000fb7cd, 0x000fb7cd, 0x00000000 },
-    { 0x0000ab44, 0x00000000, 0x00000000, 0x000fb7d1, 0x000fb7d1, 0x00000000 },
-    { 0x0000ab48, 0x00000000, 0x00000000, 0x000fb7d9, 0x000fb7d9, 0x00000000 },
-    { 0x0000ab4c, 0x00000000, 0x00000000, 0x000fb7c2, 0x000fb7c2, 0x00000000 },
-    { 0x0000ab50, 0x00000000, 0x00000000, 0x000fb7c6, 0x000fb7c6, 0x00000000 },
-    { 0x0000ab54, 0x00000000, 0x00000000, 0x000fb7ca, 0x000fb7ca, 0x00000000 },
-    { 0x0000ab58, 0x00000000, 0x00000000, 0x000fb7ce, 0x000fb7ce, 0x00000000 },
-    { 0x0000ab5c, 0x00000000, 0x00000000, 0x000fb7d2, 0x000fb7d2, 0x00000000 },
-    { 0x0000ab60, 0x00000000, 0x00000000, 0x000fb7d6, 0x000fb7d6, 0x00000000 },
-    { 0x0000ab64, 0x00000000, 0x00000000, 0x000fb7c3, 0x000fb7c3, 0x00000000 },
-    { 0x0000ab68, 0x00000000, 0x00000000, 0x000fb7cb, 0x000fb7cb, 0x00000000 },
-    { 0x0000ab6c, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab70, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab74, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab78, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab7c, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab80, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab84, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab88, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab8c, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab90, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab94, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab98, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000ab9c, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000aba0, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000aba4, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000aba8, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abac, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abb0, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abb4, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abb8, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abbc, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abc0, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abc4, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abc8, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abcc, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abd0, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abd4, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abd8, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abdc, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abe0, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abe4, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abe8, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abec, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abf0, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abf4, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abf8, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
-    { 0x0000abfc, 0x00000000, 0x00000000, 0x000fb7d3, 0x000fb7d3, 0x00000000 },
+    { 0x00009a88, 0x00000000, 0x00000000, 0x00078b04, 0x00078b04, 0x00000000 },
+    { 0x00009a8c, 0x00000000, 0x00000000, 0x00078b08, 0x00078b08, 0x00000000 },
+    { 0x00009a90, 0x00000000, 0x00000000, 0x00078b08, 0x00078b08, 0x00000000 },
+    { 0x00009a94, 0x00000000, 0x00000000, 0x00078b0c, 0x00078b0c, 0x00000000 },
+    { 0x00009a98, 0x00000000, 0x00000000, 0x00078b80, 0x00078b80, 0x00000000 },
+    { 0x00009a9c, 0x00000000, 0x00000000, 0x00078b84, 0x00078b84, 0x00000000 },
+    { 0x00009aa0, 0x00000000, 0x00000000, 0x00078b88, 0x00078b88, 0x00000000 },
+    { 0x00009aa4, 0x00000000, 0x00000000, 0x00078b8c, 0x00078b8c, 0x00000000 },
+    { 0x00009aa8, 0x00000000, 0x00000000, 0x00078b90, 0x00078b90, 0x00000000 },
+    { 0x00009aac, 0x00000000, 0x00000000, 0x000caf80, 0x000caf80, 0x00000000 },
+    { 0x00009ab0, 0x00000000, 0x00000000, 0x000caf84, 0x000caf84, 0x00000000 },
+    { 0x00009ab4, 0x00000000, 0x00000000, 0x000caf88, 0x000caf88, 0x00000000 },
+    { 0x00009ab8, 0x00000000, 0x00000000, 0x000caf8c, 0x000caf8c, 0x00000000 },
+    { 0x00009abc, 0x00000000, 0x00000000, 0x000caf90, 0x000caf90, 0x00000000 },
+    { 0x00009ac0, 0x00000000, 0x00000000, 0x000db30c, 0x000db30c, 0x00000000 },
+    { 0x00009ac4, 0x00000000, 0x00000000, 0x000db310, 0x000db310, 0x00000000 },
+    { 0x00009ac8, 0x00000000, 0x00000000, 0x000db384, 0x000db384, 0x00000000 },
+    { 0x00009acc, 0x00000000, 0x00000000, 0x000db388, 0x000db388, 0x00000000 },
+    { 0x00009ad0, 0x00000000, 0x00000000, 0x000db324, 0x000db324, 0x00000000 },
+    { 0x00009ad4, 0x00000000, 0x00000000, 0x000eb704, 0x000eb704, 0x00000000 },
+    { 0x00009ad8, 0x00000000, 0x00000000, 0x000eb6a4, 0x000eb6a4, 0x00000000 },
+    { 0x00009adc, 0x00000000, 0x00000000, 0x000eb6a8, 0x000eb6a8, 0x00000000 },
+    { 0x00009ae0, 0x00000000, 0x00000000, 0x000eb710, 0x000eb710, 0x00000000 },
+    { 0x00009ae4, 0x00000000, 0x00000000, 0x000eb714, 0x000eb714, 0x00000000 },
+    { 0x00009ae8, 0x00000000, 0x00000000, 0x000eb720, 0x000eb720, 0x00000000 },
+    { 0x00009aec, 0x00000000, 0x00000000, 0x000eb724, 0x000eb724, 0x00000000 },
+    { 0x00009af0, 0x00000000, 0x00000000, 0x000eb728, 0x000eb728, 0x00000000 },
+    { 0x00009af4, 0x00000000, 0x00000000, 0x000eb72c, 0x000eb72c, 0x00000000 },
+    { 0x00009af8, 0x00000000, 0x00000000, 0x000eb7a0, 0x000eb7a0, 0x00000000 },
+    { 0x00009afc, 0x00000000, 0x00000000, 0x000eb7a4, 0x000eb7a4, 0x00000000 },
+    { 0x00009b00, 0x00000000, 0x00000000, 0x000eb7a8, 0x000eb7a8, 0x00000000 },
+    { 0x00009b04, 0x00000000, 0x00000000, 0x000eb7b0, 0x000eb7b0, 0x00000000 },
+    { 0x00009b08, 0x00000000, 0x00000000, 0x000eb7b4, 0x000eb7b4, 0x00000000 },
+    { 0x00009b0c, 0x00000000, 0x00000000, 0x000eb7b8, 0x000eb7b8, 0x00000000 },
+    { 0x00009b10, 0x00000000, 0x00000000, 0x000eb7a5, 0x000eb7a5, 0x00000000 },
+    { 0x00009b14, 0x00000000, 0x00000000, 0x000eb7a9, 0x000eb7a9, 0x00000000 },
+    { 0x00009b18, 0x00000000, 0x00000000, 0x000eb7ad, 0x000eb7ad, 0x00000000 },
+    { 0x00009b1c, 0x00000000, 0x00000000, 0x000eb7b1, 0x000eb7b1, 0x00000000 },
+    { 0x00009b20, 0x00000000, 0x00000000, 0x000eb7b5, 0x000eb7b5, 0x00000000 },
+    { 0x00009b24, 0x00000000, 0x00000000, 0x000eb7b9, 0x000eb7b9, 0x00000000 },
+    { 0x00009b28, 0x00000000, 0x00000000, 0x000eb7c5, 0x000eb7c5, 0x00000000 },
+    { 0x00009b2c, 0x00000000, 0x00000000, 0x000eb7c9, 0x000eb7c9, 0x00000000 },
+    { 0x00009b30, 0x00000000, 0x00000000, 0x000eb7d1, 0x000eb7d1, 0x00000000 },
+    { 0x00009b34, 0x00000000, 0x00000000, 0x000eb7d5, 0x000eb7d5, 0x00000000 },
+    { 0x00009b38, 0x00000000, 0x00000000, 0x000eb7d9, 0x000eb7d9, 0x00000000 },
+    { 0x00009b3c, 0x00000000, 0x00000000, 0x000eb7c6, 0x000eb7c6, 0x00000000 },
+    { 0x00009b40, 0x00000000, 0x00000000, 0x000eb7ca, 0x000eb7ca, 0x00000000 },
+    { 0x00009b44, 0x00000000, 0x00000000, 0x000eb7ce, 0x000eb7ce, 0x00000000 },
+    { 0x00009b48, 0x00000000, 0x00000000, 0x000eb7d2, 0x000eb7d2, 0x00000000 },
+    { 0x00009b4c, 0x00000000, 0x00000000, 0x000eb7d6, 0x000eb7d6, 0x00000000 },
+    { 0x00009b50, 0x00000000, 0x00000000, 0x000eb7c3, 0x000eb7c3, 0x00000000 },
+    { 0x00009b54, 0x00000000, 0x00000000, 0x000eb7c7, 0x000eb7c7, 0x00000000 },
+    { 0x00009b58, 0x00000000, 0x00000000, 0x000eb7cb, 0x000eb7cb, 0x00000000 },
+    { 0x00009b5c, 0x00000000, 0x00000000, 0x000eb7cf, 0x000eb7cf, 0x00000000 },
+    { 0x00009b60, 0x00000000, 0x00000000, 0x000eb7d7, 0x000eb7d7, 0x00000000 },
+    { 0x00009b64, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b68, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b6c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b70, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b74, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b78, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b7c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b80, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b84, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b88, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b8c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b90, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b94, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b98, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009b9c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009ba0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009ba4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009ba8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bac, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bb0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bb4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bb8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bbc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bc0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bc4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bc8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bcc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bd0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bd4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bd8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bdc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009be0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009be4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009be8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bec, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bf0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bf4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bf8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x00009bfc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000aa00, 0x00000000, 0x00000000, 0x00058084, 0x00058084, 0x00000000 },
+    { 0x0000aa04, 0x00000000, 0x00000000, 0x00058088, 0x00058088, 0x00000000 },
+    { 0x0000aa08, 0x00000000, 0x00000000, 0x0005808c, 0x0005808c, 0x00000000 },
+    { 0x0000aa0c, 0x00000000, 0x00000000, 0x00058100, 0x00058100, 0x00000000 },
+    { 0x0000aa10, 0x00000000, 0x00000000, 0x00058104, 0x00058104, 0x00000000 },
+    { 0x0000aa14, 0x00000000, 0x00000000, 0x00058108, 0x00058108, 0x00000000 },
+    { 0x0000aa18, 0x00000000, 0x00000000, 0x0005810c, 0x0005810c, 0x00000000 },
+    { 0x0000aa1c, 0x00000000, 0x00000000, 0x00058110, 0x00058110, 0x00000000 },
+    { 0x0000aa20, 0x00000000, 0x00000000, 0x00058114, 0x00058114, 0x00000000 },
+    { 0x0000aa24, 0x00000000, 0x00000000, 0x00058180, 0x00058180, 0x00000000 },
+    { 0x0000aa28, 0x00000000, 0x00000000, 0x00058184, 0x00058184, 0x00000000 },
+    { 0x0000aa2c, 0x00000000, 0x00000000, 0x00058188, 0x00058188, 0x00000000 },
+    { 0x0000aa30, 0x00000000, 0x00000000, 0x0005818c, 0x0005818c, 0x00000000 },
+    { 0x0000aa34, 0x00000000, 0x00000000, 0x00058190, 0x00058190, 0x00000000 },
+    { 0x0000aa38, 0x00000000, 0x00000000, 0x00058194, 0x00058194, 0x00000000 },
+    { 0x0000aa3c, 0x00000000, 0x00000000, 0x000581a0, 0x000581a0, 0x00000000 },
+    { 0x0000aa40, 0x00000000, 0x00000000, 0x0005820c, 0x0005820c, 0x00000000 },
+    { 0x0000aa44, 0x00000000, 0x00000000, 0x000581a8, 0x000581a8, 0x00000000 },
+    { 0x0000aa48, 0x00000000, 0x00000000, 0x00058284, 0x00058284, 0x00000000 },
+    { 0x0000aa4c, 0x00000000, 0x00000000, 0x00058288, 0x00058288, 0x00000000 },
+    { 0x0000aa50, 0x00000000, 0x00000000, 0x00058220, 0x00058220, 0x00000000 },
+    { 0x0000aa54, 0x00000000, 0x00000000, 0x00058290, 0x00058290, 0x00000000 },
+    { 0x0000aa58, 0x00000000, 0x00000000, 0x00058300, 0x00058300, 0x00000000 },
+    { 0x0000aa5c, 0x00000000, 0x00000000, 0x00058304, 0x00058304, 0x00000000 },
+    { 0x0000aa60, 0x00000000, 0x00000000, 0x00058308, 0x00058308, 0x00000000 },
+    { 0x0000aa64, 0x00000000, 0x00000000, 0x0005830c, 0x0005830c, 0x00000000 },
+    { 0x0000aa68, 0x00000000, 0x00000000, 0x00058380, 0x00058380, 0x00000000 },
+    { 0x0000aa6c, 0x00000000, 0x00000000, 0x00058384, 0x00058384, 0x00000000 },
+    { 0x0000aa70, 0x00000000, 0x00000000, 0x00068700, 0x00068700, 0x00000000 },
+    { 0x0000aa74, 0x00000000, 0x00000000, 0x00068704, 0x00068704, 0x00000000 },
+    { 0x0000aa78, 0x00000000, 0x00000000, 0x00068708, 0x00068708, 0x00000000 },
+    { 0x0000aa7c, 0x00000000, 0x00000000, 0x0006870c, 0x0006870c, 0x00000000 },
+    { 0x0000aa80, 0x00000000, 0x00000000, 0x00068780, 0x00068780, 0x00000000 },
+    { 0x0000aa84, 0x00000000, 0x00000000, 0x00068784, 0x00068784, 0x00000000 },
+    { 0x0000aa88, 0x00000000, 0x00000000, 0x00078b04, 0x00078b04, 0x00000000 },
+    { 0x0000aa8c, 0x00000000, 0x00000000, 0x00078b08, 0x00078b08, 0x00000000 },
+    { 0x0000aa90, 0x00000000, 0x00000000, 0x00078b08, 0x00078b08, 0x00000000 },
+    { 0x0000aa94, 0x00000000, 0x00000000, 0x00078b0c, 0x00078b0c, 0x00000000 },
+    { 0x0000aa98, 0x00000000, 0x00000000, 0x00078b80, 0x00078b80, 0x00000000 },
+    { 0x0000aa9c, 0x00000000, 0x00000000, 0x00078b84, 0x00078b84, 0x00000000 },
+    { 0x0000aaa0, 0x00000000, 0x00000000, 0x00078b88, 0x00078b88, 0x00000000 },
+    { 0x0000aaa4, 0x00000000, 0x00000000, 0x00078b8c, 0x00078b8c, 0x00000000 },
+    { 0x0000aaa8, 0x00000000, 0x00000000, 0x00078b90, 0x00078b90, 0x00000000 },
+    { 0x0000aaac, 0x00000000, 0x00000000, 0x000caf80, 0x000caf80, 0x00000000 },
+    { 0x0000aab0, 0x00000000, 0x00000000, 0x000caf84, 0x000caf84, 0x00000000 },
+    { 0x0000aab4, 0x00000000, 0x00000000, 0x000caf88, 0x000caf88, 0x00000000 },
+    { 0x0000aab8, 0x00000000, 0x00000000, 0x000caf8c, 0x000caf8c, 0x00000000 },
+    { 0x0000aabc, 0x00000000, 0x00000000, 0x000caf90, 0x000caf90, 0x00000000 },
+    { 0x0000aac0, 0x00000000, 0x00000000, 0x000db30c, 0x000db30c, 0x00000000 },
+    { 0x0000aac4, 0x00000000, 0x00000000, 0x000db310, 0x000db310, 0x00000000 },
+    { 0x0000aac8, 0x00000000, 0x00000000, 0x000db384, 0x000db384, 0x00000000 },
+    { 0x0000aacc, 0x00000000, 0x00000000, 0x000db388, 0x000db388, 0x00000000 },
+    { 0x0000aad0, 0x00000000, 0x00000000, 0x000db324, 0x000db324, 0x00000000 },
+    { 0x0000aad4, 0x00000000, 0x00000000, 0x000eb704, 0x000eb704, 0x00000000 },
+    { 0x0000aad8, 0x00000000, 0x00000000, 0x000eb6a4, 0x000eb6a4, 0x00000000 },
+    { 0x0000aadc, 0x00000000, 0x00000000, 0x000eb6a8, 0x000eb6a8, 0x00000000 },
+    { 0x0000aae0, 0x00000000, 0x00000000, 0x000eb710, 0x000eb710, 0x00000000 },
+    { 0x0000aae4, 0x00000000, 0x00000000, 0x000eb714, 0x000eb714, 0x00000000 },
+    { 0x0000aae8, 0x00000000, 0x00000000, 0x000eb720, 0x000eb720, 0x00000000 },
+    { 0x0000aaec, 0x00000000, 0x00000000, 0x000eb724, 0x000eb724, 0x00000000 },
+    { 0x0000aaf0, 0x00000000, 0x00000000, 0x000eb728, 0x000eb728, 0x00000000 },
+    { 0x0000aaf4, 0x00000000, 0x00000000, 0x000eb72c, 0x000eb72c, 0x00000000 },
+    { 0x0000aaf8, 0x00000000, 0x00000000, 0x000eb7a0, 0x000eb7a0, 0x00000000 },
+    { 0x0000aafc, 0x00000000, 0x00000000, 0x000eb7a4, 0x000eb7a4, 0x00000000 },
+    { 0x0000ab00, 0x00000000, 0x00000000, 0x000eb7a8, 0x000eb7a8, 0x00000000 },
+    { 0x0000ab04, 0x00000000, 0x00000000, 0x000eb7b0, 0x000eb7b0, 0x00000000 },
+    { 0x0000ab08, 0x00000000, 0x00000000, 0x000eb7b4, 0x000eb7b4, 0x00000000 },
+    { 0x0000ab0c, 0x00000000, 0x00000000, 0x000eb7b8, 0x000eb7b8, 0x00000000 },
+    { 0x0000ab10, 0x00000000, 0x00000000, 0x000eb7a5, 0x000eb7a5, 0x00000000 },
+    { 0x0000ab14, 0x00000000, 0x00000000, 0x000eb7a9, 0x000eb7a9, 0x00000000 },
+    { 0x0000ab18, 0x00000000, 0x00000000, 0x000eb7ad, 0x000eb7ad, 0x00000000 },
+    { 0x0000ab1c, 0x00000000, 0x00000000, 0x000eb7b1, 0x000eb7b1, 0x00000000 },
+    { 0x0000ab20, 0x00000000, 0x00000000, 0x000eb7b5, 0x000eb7b5, 0x00000000 },
+    { 0x0000ab24, 0x00000000, 0x00000000, 0x000eb7b9, 0x000eb7b9, 0x00000000 },
+    { 0x0000ab28, 0x00000000, 0x00000000, 0x000eb7c5, 0x000eb7c5, 0x00000000 },
+    { 0x0000ab2c, 0x00000000, 0x00000000, 0x000eb7c9, 0x000eb7c9, 0x00000000 },
+    { 0x0000ab30, 0x00000000, 0x00000000, 0x000eb7d1, 0x000eb7d1, 0x00000000 },
+    { 0x0000ab34, 0x00000000, 0x00000000, 0x000eb7d5, 0x000eb7d5, 0x00000000 },
+    { 0x0000ab38, 0x00000000, 0x00000000, 0x000eb7d9, 0x000eb7d9, 0x00000000 },
+    { 0x0000ab3c, 0x00000000, 0x00000000, 0x000eb7c6, 0x000eb7c6, 0x00000000 },
+    { 0x0000ab40, 0x00000000, 0x00000000, 0x000eb7ca, 0x000eb7ca, 0x00000000 },
+    { 0x0000ab44, 0x00000000, 0x00000000, 0x000eb7ce, 0x000eb7ce, 0x00000000 },
+    { 0x0000ab48, 0x00000000, 0x00000000, 0x000eb7d2, 0x000eb7d2, 0x00000000 },
+    { 0x0000ab4c, 0x00000000, 0x00000000, 0x000eb7d6, 0x000eb7d6, 0x00000000 },
+    { 0x0000ab50, 0x00000000, 0x00000000, 0x000eb7c3, 0x000eb7c3, 0x00000000 },
+    { 0x0000ab54, 0x00000000, 0x00000000, 0x000eb7c7, 0x000eb7c7, 0x00000000 },
+    { 0x0000ab58, 0x00000000, 0x00000000, 0x000eb7cb, 0x000eb7cb, 0x00000000 },
+    { 0x0000ab5c, 0x00000000, 0x00000000, 0x000eb7cf, 0x000eb7cf, 0x00000000 },
+    { 0x0000ab60, 0x00000000, 0x00000000, 0x000eb7d7, 0x000eb7d7, 0x00000000 },
+    { 0x0000ab64, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab68, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab6c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab70, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab74, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab78, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab7c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab80, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab84, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab88, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab8c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab90, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab94, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab98, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000ab9c, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000aba0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000aba4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000aba8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abac, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abb0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abb4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abb8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abbc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abc0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abc4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abc8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abcc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abd0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abd4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abd8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abdc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abe0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abe4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abe8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abec, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abf0, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abf4, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abf8, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
+    { 0x0000abfc, 0x00000000, 0x00000000, 0x000eb7db, 0x000eb7db, 0x00000000 },
     { 0x0000a204, 0x00000004, 0x00000004, 0x00000004, 0x00000004, 0x00000004 },
-    { 0x0000a20c, 0x00000014, 0x00000014, 0x00000000, 0x00000000, 0x0001f000 },
+    { 0x0000a20c, 0x00000014, 0x00000014, 0x0001f000, 0x0001f000, 0x0001f000 },
     { 0x0000a21c, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a, 0x1883800a },
     { 0x0000a230, 0x00000000, 0x00000000, 0x00000210, 0x00000108, 0x00000000 },
     { 0x0000a250, 0x0004f000, 0x0004f000, 0x0004a000, 0x0004a000, 0x0004a000 },
@@ -4679,7 +4680,7 @@ static const u_int32_t ar9285Common_9285_1_2[][2] = {
     { 0x000099a0, 0x00000000 },
     { 0x000099a4, 0x00000001 },
     { 0x000099a8, 0x201fff00 },
-    { 0x000099ac, 0x2def1000 },
+    { 0x000099ac, 0x2def0400 },
     { 0x000099b0, 0x03051000 },
     { 0x000099b4, 0x00000820 },
     { 0x000099dc, 0x00000000 },
@@ -4688,7 +4689,7 @@ static const u_int32_t ar9285Common_9285_1_2[][2] = {
     { 0x000099e8, 0x3c466478 },
     { 0x000099ec, 0x0cc80caa },
     { 0x000099f0, 0x00000000 },
-    { 0x0000a208, 0x803e6788 },
+    { 0x0000a208, 0x803e68c8 },
     { 0x0000a210, 0x4080a333 },
     { 0x0000a214, 0x00206c10 },
     { 0x0000a218, 0x009c4060 },
index af32d091dc38231b4d77ba321d56711e93297c7e..f32c622db6e7c82322e0f27b929b51a6e09b529e 100644 (file)
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
-#include "hw.h"
-#include "reg.h"
-#include "phy.h"
+#include "ath9k.h"
 
-static void ath9k_hw_set_txq_interrupts(struct ath_hal *ah,
+static void ath9k_hw_set_txq_interrupts(struct ath_hw *ah,
                                        struct ath9k_tx_queue_info *qi)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        DPRINTF(ah->ah_sc, ATH_DBG_INTERRUPT,
                "tx ok 0x%x err 0x%x desc 0x%x eol 0x%x urn 0x%x\n",
-               ahp->ah_txOkInterruptMask, ahp->ah_txErrInterruptMask,
-               ahp->ah_txDescInterruptMask, ahp->ah_txEolInterruptMask,
-               ahp->ah_txUrnInterruptMask);
+               ah->txok_interrupt_mask, ah->txerr_interrupt_mask,
+               ah->txdesc_interrupt_mask, ah->txeol_interrupt_mask,
+               ah->txurn_interrupt_mask);
 
        REG_WRITE(ah, AR_IMR_S0,
-                 SM(ahp->ah_txOkInterruptMask, AR_IMR_S0_QCU_TXOK)
-                 | SM(ahp->ah_txDescInterruptMask, AR_IMR_S0_QCU_TXDESC));
+                 SM(ah->txok_interrupt_mask, AR_IMR_S0_QCU_TXOK)
+                 | SM(ah->txdesc_interrupt_mask, AR_IMR_S0_QCU_TXDESC));
        REG_WRITE(ah, AR_IMR_S1,
-                 SM(ahp->ah_txErrInterruptMask, AR_IMR_S1_QCU_TXERR)
-                 | SM(ahp->ah_txEolInterruptMask, AR_IMR_S1_QCU_TXEOL));
+                 SM(ah->txerr_interrupt_mask, AR_IMR_S1_QCU_TXERR)
+                 | SM(ah->txeol_interrupt_mask, AR_IMR_S1_QCU_TXEOL));
        REG_RMW_FIELD(ah, AR_IMR_S2,
-                     AR_IMR_S2_QCU_TXURN, ahp->ah_txUrnInterruptMask);
+                     AR_IMR_S2_QCU_TXURN, ah->txurn_interrupt_mask);
 }
 
-u32 ath9k_hw_gettxbuf(struct ath_hal *ah, u32 q)
+u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q)
 {
        return REG_READ(ah, AR_QTXDP(q));
 }
 
-bool ath9k_hw_puttxbuf(struct ath_hal *ah, u32 q, u32 txdp)
+bool ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp)
 {
        REG_WRITE(ah, AR_QTXDP(q), txdp);
 
        return true;
 }
 
-bool ath9k_hw_txstart(struct ath_hal *ah, u32 q)
+bool ath9k_hw_txstart(struct ath_hw *ah, u32 q)
 {
        DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "queue %u\n", q);
 
@@ -61,7 +56,7 @@ bool ath9k_hw_txstart(struct ath_hal *ah, u32 q)
        return true;
 }
 
-u32 ath9k_hw_numtxpending(struct ath_hal *ah, u32 q)
+u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q)
 {
        u32 npend;
 
@@ -75,16 +70,15 @@ u32 ath9k_hw_numtxpending(struct ath_hal *ah, u32 q)
        return npend;
 }
 
-bool ath9k_hw_updatetxtriglevel(struct ath_hal *ah, bool bIncTrigLevel)
+bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        u32 txcfg, curLevel, newLevel;
        enum ath9k_int omask;
 
-       if (ah->ah_txTrigLevel >= MAX_TX_FIFO_THRESHOLD)
+       if (ah->tx_trig_level >= MAX_TX_FIFO_THRESHOLD)
                return false;
 
-       omask = ath9k_hw_set_interrupts(ah, ahp->ah_maskReg & ~ATH9K_INT_GLOBAL);
+       omask = ath9k_hw_set_interrupts(ah, ah->mask_reg & ~ATH9K_INT_GLOBAL);
 
        txcfg = REG_READ(ah, AR_TXCFG);
        curLevel = MS(txcfg, AR_FTRIG);
@@ -100,21 +94,38 @@ bool ath9k_hw_updatetxtriglevel(struct ath_hal *ah, bool bIncTrigLevel)
 
        ath9k_hw_set_interrupts(ah, omask);
 
-       ah->ah_txTrigLevel = newLevel;
+       ah->tx_trig_level = newLevel;
 
        return newLevel != curLevel;
 }
 
-bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q)
+bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q)
 {
+#define ATH9K_TX_STOP_DMA_TIMEOUT      4000    /* usec */
+#define ATH9K_TIME_QUANTUM             100     /* usec */
+
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
+       struct ath9k_tx_queue_info *qi;
        u32 tsfLow, j, wait;
+       u32 wait_time = ATH9K_TX_STOP_DMA_TIMEOUT / ATH9K_TIME_QUANTUM;
+
+       if (q >= pCap->total_queues) {
+               DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "invalid queue num %u\n", q);
+               return false;
+       }
+
+       qi = &ah->txq[q];
+       if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
+               DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n");
+               return false;
+       }
 
        REG_WRITE(ah, AR_Q_TXD, 1 << q);
 
-       for (wait = 1000; wait != 0; wait--) {
+       for (wait = wait_time; wait != 0; wait--) {
                if (ath9k_hw_numtxpending(ah, q) == 0)
                        break;
-               udelay(100);
+               udelay(ATH9K_TIME_QUANTUM);
        }
 
        if (ath9k_hw_numtxpending(ah, q)) {
@@ -144,8 +155,7 @@ bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q)
                udelay(200);
                REG_CLR_BIT(ah, AR_TIMER_MODE, AR_QUIET_TIMER_EN);
 
-               wait = 1000;
-
+               wait = wait_time;
                while (ath9k_hw_numtxpending(ah, q)) {
                        if ((--wait) == 0) {
                                DPRINTF(ah->ah_sc, ATH_DBG_XMIT,
@@ -153,18 +163,20 @@ bool ath9k_hw_stoptxdma(struct ath_hal *ah, u32 q)
                                        "msec after killing last frame\n");
                                break;
                        }
-                       udelay(100);
+                       udelay(ATH9K_TIME_QUANTUM);
                }
 
                REG_CLR_BIT(ah, AR_DIAG_SW, AR_DIAG_FORCE_CH_IDLE_HIGH);
        }
 
        REG_WRITE(ah, AR_Q_TXD, 0);
-
        return wait != 0;
+
+#undef ATH9K_TX_STOP_DMA_TIMEOUT
+#undef ATH9K_TIME_QUANTUM
 }
 
-bool ath9k_hw_filltxdesc(struct ath_hal *ah, struct ath_desc *ds,
+bool ath9k_hw_filltxdesc(struct ath_hw *ah, struct ath_desc *ds,
                         u32 segLen, bool firstSeg,
                         bool lastSeg, const struct ath_desc *ds0)
 {
@@ -192,7 +204,7 @@ bool ath9k_hw_filltxdesc(struct ath_hal *ah, struct ath_desc *ds,
        return true;
 }
 
-void ath9k_hw_cleartxdesc(struct ath_hal *ah, struct ath_desc *ds)
+void ath9k_hw_cleartxdesc(struct ath_hw *ah, struct ath_desc *ds)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
 
@@ -203,7 +215,7 @@ void ath9k_hw_cleartxdesc(struct ath_hal *ah, struct ath_desc *ds)
        ads->ds_txstatus8 = ads->ds_txstatus9 = 0;
 }
 
-int ath9k_hw_txprocdesc(struct ath_hal *ah, struct ath_desc *ds)
+int ath9k_hw_txprocdesc(struct ath_hw *ah, struct ath_desc *ds)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
 
@@ -278,14 +290,13 @@ int ath9k_hw_txprocdesc(struct ath_hal *ah, struct ath_desc *ds)
        return 0;
 }
 
-void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds,
+void ath9k_hw_set11n_txdesc(struct ath_hw *ah, struct ath_desc *ds,
                            u32 pktLen, enum ath9k_pkt_type type, u32 txPower,
                            u32 keyIx, enum ath9k_key_type keyType, u32 flags)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
-       struct ath_hal_5416 *ahp = AH5416(ah);
 
-       txPower += ahp->ah_txPowerIndexOffset;
+       txPower += ah->txpower_indexoffset;
        if (txPower > 63)
                txPower = 63;
 
@@ -314,7 +325,7 @@ void ath9k_hw_set11n_txdesc(struct ath_hal *ah, struct ath_desc *ds,
        }
 }
 
-void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds,
+void ath9k_hw_set11n_ratescenario(struct ath_hw *ah, struct ath_desc *ds,
                                  struct ath_desc *lastds,
                                  u32 durUpdateEn, u32 rtsctsRate,
                                  u32 rtsctsDuration,
@@ -325,9 +336,6 @@ void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds,
        struct ar5416_desc *last_ads = AR5416DESC(lastds);
        u32 ds_ctl0;
 
-       (void) nseries;
-       (void) rtsctsDuration;
-
        if (flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA)) {
                ds_ctl0 = ads->ds_ctl0;
 
@@ -372,7 +380,7 @@ void ath9k_hw_set11n_ratescenario(struct ath_hal *ah, struct ath_desc *ds,
        last_ads->ds_ctl3 = ads->ds_ctl3;
 }
 
-void ath9k_hw_set11n_aggr_first(struct ath_hal *ah, struct ath_desc *ds,
+void ath9k_hw_set11n_aggr_first(struct ath_hw *ah, struct ath_desc *ds,
                                u32 aggrLen)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
@@ -382,7 +390,7 @@ void ath9k_hw_set11n_aggr_first(struct ath_hal *ah, struct ath_desc *ds,
        ads->ds_ctl6 |= SM(aggrLen, AR_AggrLen);
 }
 
-void ath9k_hw_set11n_aggr_middle(struct ath_hal *ah, struct ath_desc *ds,
+void ath9k_hw_set11n_aggr_middle(struct ath_hw *ah, struct ath_desc *ds,
                                 u32 numDelims)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
@@ -396,7 +404,7 @@ void ath9k_hw_set11n_aggr_middle(struct ath_hal *ah, struct ath_desc *ds,
        ads->ds_ctl6 = ctl6;
 }
 
-void ath9k_hw_set11n_aggr_last(struct ath_hal *ah, struct ath_desc *ds)
+void ath9k_hw_set11n_aggr_last(struct ath_hw *ah, struct ath_desc *ds)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
 
@@ -405,14 +413,14 @@ void ath9k_hw_set11n_aggr_last(struct ath_hal *ah, struct ath_desc *ds)
        ads->ds_ctl6 &= ~AR_PadDelim;
 }
 
-void ath9k_hw_clr11n_aggr(struct ath_hal *ah, struct ath_desc *ds)
+void ath9k_hw_clr11n_aggr(struct ath_hw *ah, struct ath_desc *ds)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
 
        ads->ds_ctl1 &= (~AR_IsAggr & ~AR_MoreAggr);
 }
 
-void ath9k_hw_set11n_burstduration(struct ath_hal *ah, struct ath_desc *ds,
+void ath9k_hw_set11n_burstduration(struct ath_hw *ah, struct ath_desc *ds,
                                   u32 burstDuration)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
@@ -421,7 +429,7 @@ void ath9k_hw_set11n_burstduration(struct ath_hal *ah, struct ath_desc *ds,
        ads->ds_ctl2 |= SM(burstDuration, AR_BurstDur);
 }
 
-void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah, struct ath_desc *ds,
+void ath9k_hw_set11n_virtualmorefrag(struct ath_hw *ah, struct ath_desc *ds,
                                     u32 vmf)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
@@ -432,20 +440,17 @@ void ath9k_hw_set11n_virtualmorefrag(struct ath_hal *ah, struct ath_desc *ds,
                ads->ds_ctl0 &= ~AR_VirtMoreFrag;
 }
 
-void ath9k_hw_gettxintrtxqs(struct ath_hal *ah, u32 *txqs)
+void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       *txqs &= ahp->ah_intrTxqs;
-       ahp->ah_intrTxqs &= ~(*txqs);
+       *txqs &= ah->intr_txqs;
+       ah->intr_txqs &= ~(*txqs);
 }
 
-bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q,
+bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
                            const struct ath9k_tx_queue_info *qinfo)
 {
        u32 cw;
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
        struct ath9k_tx_queue_info *qi;
 
        if (q >= pCap->total_queues) {
@@ -453,7 +458,7 @@ bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q,
                return false;
        }
 
-       qi = &ahp->ah_txq[q];
+       qi = &ah->txq[q];
        if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
                DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n");
                return false;
@@ -509,11 +514,10 @@ bool ath9k_hw_set_txq_props(struct ath_hal *ah, int q,
        return true;
 }
 
-bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q,
+bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q,
                            struct ath9k_tx_queue_info *qinfo)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
        struct ath9k_tx_queue_info *qi;
 
        if (q >= pCap->total_queues) {
@@ -521,7 +525,7 @@ bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q,
                return false;
        }
 
-       qi = &ahp->ah_txq[q];
+       qi = &ah->txq[q];
        if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
                DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue\n");
                return false;
@@ -545,12 +549,11 @@ bool ath9k_hw_get_txq_props(struct ath_hal *ah, int q,
        return true;
 }
 
-int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type,
+int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type,
                          const struct ath9k_tx_queue_info *qinfo)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
        struct ath9k_tx_queue_info *qi;
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
        int q;
 
        switch (type) {
@@ -568,7 +571,7 @@ int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type,
                break;
        case ATH9K_TX_QUEUE_DATA:
                for (q = 0; q < pCap->total_queues; q++)
-                       if (ahp->ah_txq[q].tqi_type ==
+                       if (ah->txq[q].tqi_type ==
                            ATH9K_TX_QUEUE_INACTIVE)
                                break;
                if (q == pCap->total_queues) {
@@ -584,7 +587,7 @@ int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type,
 
        DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "queue %u\n", q);
 
-       qi = &ahp->ah_txq[q];
+       qi = &ah->txq[q];
        if (qi->tqi_type != ATH9K_TX_QUEUE_INACTIVE) {
                DPRINTF(ah->ah_sc, ATH_DBG_QUEUE,
                        "tx queue %u already active\n", q);
@@ -611,17 +614,16 @@ int ath9k_hw_setuptxqueue(struct ath_hal *ah, enum ath9k_tx_queue type,
        return q;
 }
 
-bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q)
+bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
        struct ath9k_tx_queue_info *qi;
 
        if (q >= pCap->total_queues) {
                DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "invalid queue num %u\n", q);
                return false;
        }
-       qi = &ahp->ah_txq[q];
+       qi = &ah->txq[q];
        if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
                DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue %u\n", q);
                return false;
@@ -630,21 +632,20 @@ bool ath9k_hw_releasetxqueue(struct ath_hal *ah, u32 q)
        DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "release queue %u\n", q);
 
        qi->tqi_type = ATH9K_TX_QUEUE_INACTIVE;
-       ahp->ah_txOkInterruptMask &= ~(1 << q);
-       ahp->ah_txErrInterruptMask &= ~(1 << q);
-       ahp->ah_txDescInterruptMask &= ~(1 << q);
-       ahp->ah_txEolInterruptMask &= ~(1 << q);
-       ahp->ah_txUrnInterruptMask &= ~(1 << q);
+       ah->txok_interrupt_mask &= ~(1 << q);
+       ah->txerr_interrupt_mask &= ~(1 << q);
+       ah->txdesc_interrupt_mask &= ~(1 << q);
+       ah->txeol_interrupt_mask &= ~(1 << q);
+       ah->txurn_interrupt_mask &= ~(1 << q);
        ath9k_hw_set_txq_interrupts(ah, qi);
 
        return true;
 }
 
-bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q)
+bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
-       struct ath9k_channel *chan = ah->ah_curchan;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
+       struct ath9k_channel *chan = ah->curchan;
        struct ath9k_tx_queue_info *qi;
        u32 cwMin, chanCwMin, value;
 
@@ -653,7 +654,7 @@ bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q)
                return false;
        }
 
-       qi = &ahp->ah_txq[q];
+       qi = &ah->txq[q];
        if (qi->tqi_type == ATH9K_TX_QUEUE_INACTIVE) {
                DPRINTF(ah->ah_sc, ATH_DBG_QUEUE, "inactive queue %u\n", q);
                return true;
@@ -741,9 +742,9 @@ bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q)
                          | AR_Q_MISC_CBR_INCR_DIS1
                          | AR_Q_MISC_CBR_INCR_DIS0);
                value = (qi->tqi_readyTime -
-                        (ah->ah_config.sw_beacon_response_time -
-                         ah->ah_config.dma_beacon_response_time) -
-                        ah->ah_config.additional_swba_backoff) * 1024;
+                        (ah->config.sw_beacon_response_time -
+                         ah->config.dma_beacon_response_time) -
+                        ah->config.additional_swba_backoff) * 1024;
                REG_WRITE(ah, AR_QRDYTIMECFG(q),
                          value | AR_Q_RDYTIMECFG_EN);
                REG_WRITE(ah, AR_DMISC(q), REG_READ(ah, AR_DMISC(q))
@@ -771,31 +772,31 @@ bool ath9k_hw_resettxqueue(struct ath_hal *ah, u32 q)
        }
 
        if (qi->tqi_qflags & TXQ_FLAG_TXOKINT_ENABLE)
-               ahp->ah_txOkInterruptMask |= 1 << q;
+               ah->txok_interrupt_mask |= 1 << q;
        else
-               ahp->ah_txOkInterruptMask &= ~(1 << q);
+               ah->txok_interrupt_mask &= ~(1 << q);
        if (qi->tqi_qflags & TXQ_FLAG_TXERRINT_ENABLE)
-               ahp->ah_txErrInterruptMask |= 1 << q;
+               ah->txerr_interrupt_mask |= 1 << q;
        else
-               ahp->ah_txErrInterruptMask &= ~(1 << q);
+               ah->txerr_interrupt_mask &= ~(1 << q);
        if (qi->tqi_qflags & TXQ_FLAG_TXDESCINT_ENABLE)
-               ahp->ah_txDescInterruptMask |= 1 << q;
+               ah->txdesc_interrupt_mask |= 1 << q;
        else
-               ahp->ah_txDescInterruptMask &= ~(1 << q);
+               ah->txdesc_interrupt_mask &= ~(1 << q);
        if (qi->tqi_qflags & TXQ_FLAG_TXEOLINT_ENABLE)
-               ahp->ah_txEolInterruptMask |= 1 << q;
+               ah->txeol_interrupt_mask |= 1 << q;
        else
-               ahp->ah_txEolInterruptMask &= ~(1 << q);
+               ah->txeol_interrupt_mask &= ~(1 << q);
        if (qi->tqi_qflags & TXQ_FLAG_TXURNINT_ENABLE)
-               ahp->ah_txUrnInterruptMask |= 1 << q;
+               ah->txurn_interrupt_mask |= 1 << q;
        else
-               ahp->ah_txUrnInterruptMask &= ~(1 << q);
+               ah->txurn_interrupt_mask &= ~(1 << q);
        ath9k_hw_set_txq_interrupts(ah, qi);
 
        return true;
 }
 
-int ath9k_hw_rxprocdesc(struct ath_hal *ah, struct ath_desc *ds,
+int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
                        u32 pa, struct ath_desc *nds, u64 tsf)
 {
        struct ar5416_desc ads;
@@ -860,11 +861,11 @@ int ath9k_hw_rxprocdesc(struct ath_hal *ah, struct ath_desc *ds,
        return 0;
 }
 
-bool ath9k_hw_setuprxdesc(struct ath_hal *ah, struct ath_desc *ds,
+bool ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds,
                          u32 size, u32 flags)
 {
        struct ar5416_desc *ads = AR5416DESC(ds);
-       struct ath9k_hw_capabilities *pCap = &ah->ah_caps;
+       struct ath9k_hw_capabilities *pCap = &ah->caps;
 
        ads->ds_ctl1 = size & AR_BufLen;
        if (flags & ATH9K_RXDESC_INTREQ)
@@ -877,7 +878,7 @@ bool ath9k_hw_setuprxdesc(struct ath_hal *ah, struct ath_desc *ds,
        return true;
 }
 
-bool ath9k_hw_setrxabort(struct ath_hal *ah, bool set)
+bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set)
 {
        u32 reg;
 
@@ -904,17 +905,17 @@ bool ath9k_hw_setrxabort(struct ath_hal *ah, bool set)
        return true;
 }
 
-void ath9k_hw_putrxbuf(struct ath_hal *ah, u32 rxdp)
+void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp)
 {
        REG_WRITE(ah, AR_RXDP, rxdp);
 }
 
-void ath9k_hw_rxena(struct ath_hal *ah)
+void ath9k_hw_rxena(struct ath_hw *ah)
 {
        REG_WRITE(ah, AR_CR, AR_CR_RXE);
 }
 
-void ath9k_hw_startpcureceive(struct ath_hal *ah)
+void ath9k_hw_startpcureceive(struct ath_hw *ah)
 {
        ath9k_enable_mib_counters(ah);
 
@@ -923,14 +924,14 @@ void ath9k_hw_startpcureceive(struct ath_hal *ah)
        REG_CLR_BIT(ah, AR_DIAG_SW, (AR_DIAG_RX_DIS | AR_DIAG_RX_ABORT));
 }
 
-void ath9k_hw_stoppcurecv(struct ath_hal *ah)
+void ath9k_hw_stoppcurecv(struct ath_hw *ah)
 {
        REG_SET_BIT(ah, AR_DIAG_SW, AR_DIAG_RX_DIS);
 
        ath9k_hw_disable_mib_counters(ah);
 }
 
-bool ath9k_hw_stopdmarecv(struct ath_hal *ah)
+bool ath9k_hw_stopdmarecv(struct ath_hw *ah)
 {
        REG_WRITE(ah, AR_CR, AR_CR_RXD);
 
diff --git a/drivers/net/wireless/ath9k/mac.h b/drivers/net/wireless/ath9k/mac.h
new file mode 100644 (file)
index 0000000..74b660a
--- /dev/null
@@ -0,0 +1,676 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef MAC_H
+#define MAC_H
+
+#define RXSTATUS_RATE(ah, ads) (AR_SREV_5416_V20_OR_LATER(ah) ?                \
+                               MS(ads->ds_rxstatus0, AR_RxRate) :      \
+                               (ads->ds_rxstatus3 >> 2) & 0xFF)
+
+#define set11nTries(_series, _index) \
+       (SM((_series)[_index].Tries, AR_XmitDataTries##_index))
+
+#define set11nRate(_series, _index) \
+       (SM((_series)[_index].Rate, AR_XmitRate##_index))
+
+#define set11nPktDurRTSCTS(_series, _index)                            \
+       (SM((_series)[_index].PktDuration, AR_PacketDur##_index) |      \
+        ((_series)[_index].RateFlags & ATH9K_RATESERIES_RTS_CTS   ?    \
+         AR_RTSCTSQual##_index : 0))
+
+#define set11nRateFlags(_series, _index)                               \
+       (((_series)[_index].RateFlags & ATH9K_RATESERIES_2040 ?         \
+         AR_2040_##_index : 0)                                         \
+        |((_series)[_index].RateFlags & ATH9K_RATESERIES_HALFGI ?      \
+          AR_GI##_index : 0)                                           \
+        |SM((_series)[_index].ChSel, AR_ChainSel##_index))
+
+#define CCK_SIFS_TIME        10
+#define CCK_PREAMBLE_BITS   144
+#define CCK_PLCP_BITS        48
+
+#define OFDM_SIFS_TIME        16
+#define OFDM_PREAMBLE_TIME    20
+#define OFDM_PLCP_BITS        22
+#define OFDM_SYMBOL_TIME      4
+
+#define OFDM_SIFS_TIME_HALF     32
+#define OFDM_PREAMBLE_TIME_HALF 40
+#define OFDM_PLCP_BITS_HALF     22
+#define OFDM_SYMBOL_TIME_HALF   8
+
+#define OFDM_SIFS_TIME_QUARTER      64
+#define OFDM_PREAMBLE_TIME_QUARTER  80
+#define OFDM_PLCP_BITS_QUARTER      22
+#define OFDM_SYMBOL_TIME_QUARTER    16
+
+#define INIT_AIFS       2
+#define INIT_CWMIN      15
+#define INIT_CWMIN_11B  31
+#define INIT_CWMAX      1023
+#define INIT_SH_RETRY   10
+#define INIT_LG_RETRY   10
+#define INIT_SSH_RETRY  32
+#define INIT_SLG_RETRY  32
+
+#define ATH9K_SLOT_TIME_6 6
+#define ATH9K_SLOT_TIME_9 9
+#define ATH9K_SLOT_TIME_20 20
+
+#define ATH9K_TXERR_XRETRY         0x01
+#define ATH9K_TXERR_FILT           0x02
+#define ATH9K_TXERR_FIFO           0x04
+#define ATH9K_TXERR_XTXOP          0x08
+#define ATH9K_TXERR_TIMER_EXPIRED  0x10
+
+#define ATH9K_TX_BA                0x01
+#define ATH9K_TX_PWRMGMT           0x02
+#define ATH9K_TX_DESC_CFG_ERR      0x04
+#define ATH9K_TX_DATA_UNDERRUN     0x08
+#define ATH9K_TX_DELIM_UNDERRUN    0x10
+#define ATH9K_TX_SW_ABORTED        0x40
+#define ATH9K_TX_SW_FILTERED       0x80
+
+#define MIN_TX_FIFO_THRESHOLD   0x1
+#define MAX_TX_FIFO_THRESHOLD   ((4096 / 64) - 1)
+#define INIT_TX_FIFO_THRESHOLD  MIN_TX_FIFO_THRESHOLD
+
+struct ath_tx_status {
+       u32 ts_tstamp;
+       u16 ts_seqnum;
+       u8 ts_status;
+       u8 ts_ratecode;
+       u8 ts_rateindex;
+       int8_t ts_rssi;
+       u8 ts_shortretry;
+       u8 ts_longretry;
+       u8 ts_virtcol;
+       u8 ts_antenna;
+       u8 ts_flags;
+       int8_t ts_rssi_ctl0;
+       int8_t ts_rssi_ctl1;
+       int8_t ts_rssi_ctl2;
+       int8_t ts_rssi_ext0;
+       int8_t ts_rssi_ext1;
+       int8_t ts_rssi_ext2;
+       u8 pad[3];
+       u32 ba_low;
+       u32 ba_high;
+       u32 evm0;
+       u32 evm1;
+       u32 evm2;
+};
+
+struct ath_rx_status {
+       u32 rs_tstamp;
+       u16 rs_datalen;
+       u8 rs_status;
+       u8 rs_phyerr;
+       int8_t rs_rssi;
+       u8 rs_keyix;
+       u8 rs_rate;
+       u8 rs_antenna;
+       u8 rs_more;
+       int8_t rs_rssi_ctl0;
+       int8_t rs_rssi_ctl1;
+       int8_t rs_rssi_ctl2;
+       int8_t rs_rssi_ext0;
+       int8_t rs_rssi_ext1;
+       int8_t rs_rssi_ext2;
+       u8 rs_isaggr;
+       u8 rs_moreaggr;
+       u8 rs_num_delims;
+       u8 rs_flags;
+       u32 evm0;
+       u32 evm1;
+       u32 evm2;
+};
+
+#define ATH9K_RXERR_CRC           0x01
+#define ATH9K_RXERR_PHY           0x02
+#define ATH9K_RXERR_FIFO          0x04
+#define ATH9K_RXERR_DECRYPT       0x08
+#define ATH9K_RXERR_MIC           0x10
+
+#define ATH9K_RX_MORE             0x01
+#define ATH9K_RX_MORE_AGGR        0x02
+#define ATH9K_RX_GI               0x04
+#define ATH9K_RX_2040             0x08
+#define ATH9K_RX_DELIM_CRC_PRE    0x10
+#define ATH9K_RX_DELIM_CRC_POST   0x20
+#define ATH9K_RX_DECRYPT_BUSY     0x40
+
+#define ATH9K_RXKEYIX_INVALID  ((u8)-1)
+#define ATH9K_TXKEYIX_INVALID  ((u32)-1)
+
+struct ath_desc {
+       u32 ds_link;
+       u32 ds_data;
+       u32 ds_ctl0;
+       u32 ds_ctl1;
+       u32 ds_hw[20];
+       union {
+               struct ath_tx_status tx;
+               struct ath_rx_status rx;
+               void *stats;
+       } ds_us;
+       void *ds_vdata;
+} __packed;
+
+#define        ds_txstat       ds_us.tx
+#define        ds_rxstat       ds_us.rx
+#define ds_stat                ds_us.stats
+
+#define ATH9K_TXDESC_CLRDMASK          0x0001
+#define ATH9K_TXDESC_NOACK             0x0002
+#define ATH9K_TXDESC_RTSENA            0x0004
+#define ATH9K_TXDESC_CTSENA            0x0008
+/* ATH9K_TXDESC_INTREQ forces a tx interrupt to be generated for
+ * the descriptor its marked on.  We take a tx interrupt to reap
+ * descriptors when the h/w hits an EOL condition or
+ * when the descriptor is specifically marked to generate
+ * an interrupt with this flag. Descriptors should be
+ * marked periodically to insure timely replenishing of the
+ * supply needed for sending frames. Defering interrupts
+ * reduces system load and potentially allows more concurrent
+ * work to be done but if done to aggressively can cause
+ * senders to backup. When the hardware queue is left too
+ * large rate control information may also be too out of
+ * date. An Alternative for this is TX interrupt mitigation
+ * but this needs more testing. */
+#define ATH9K_TXDESC_INTREQ            0x0010
+#define ATH9K_TXDESC_VEOL              0x0020
+#define ATH9K_TXDESC_EXT_ONLY          0x0040
+#define ATH9K_TXDESC_EXT_AND_CTL       0x0080
+#define ATH9K_TXDESC_VMF               0x0100
+#define ATH9K_TXDESC_FRAG_IS_ON        0x0200
+#define ATH9K_TXDESC_CAB               0x0400
+
+#define ATH9K_RXDESC_INTREQ            0x0020
+
+struct ar5416_desc {
+       u32 ds_link;
+       u32 ds_data;
+       u32 ds_ctl0;
+       u32 ds_ctl1;
+       union {
+               struct {
+                       u32 ctl2;
+                       u32 ctl3;
+                       u32 ctl4;
+                       u32 ctl5;
+                       u32 ctl6;
+                       u32 ctl7;
+                       u32 ctl8;
+                       u32 ctl9;
+                       u32 ctl10;
+                       u32 ctl11;
+                       u32 status0;
+                       u32 status1;
+                       u32 status2;
+                       u32 status3;
+                       u32 status4;
+                       u32 status5;
+                       u32 status6;
+                       u32 status7;
+                       u32 status8;
+                       u32 status9;
+               } tx;
+               struct {
+                       u32 status0;
+                       u32 status1;
+                       u32 status2;
+                       u32 status3;
+                       u32 status4;
+                       u32 status5;
+                       u32 status6;
+                       u32 status7;
+                       u32 status8;
+               } rx;
+       } u;
+} __packed;
+
+#define AR5416DESC(_ds)         ((struct ar5416_desc *)(_ds))
+#define AR5416DESC_CONST(_ds)   ((const struct ar5416_desc *)(_ds))
+
+#define ds_ctl2     u.tx.ctl2
+#define ds_ctl3     u.tx.ctl3
+#define ds_ctl4     u.tx.ctl4
+#define ds_ctl5     u.tx.ctl5
+#define ds_ctl6     u.tx.ctl6
+#define ds_ctl7     u.tx.ctl7
+#define ds_ctl8     u.tx.ctl8
+#define ds_ctl9     u.tx.ctl9
+#define ds_ctl10    u.tx.ctl10
+#define ds_ctl11    u.tx.ctl11
+
+#define ds_txstatus0    u.tx.status0
+#define ds_txstatus1    u.tx.status1
+#define ds_txstatus2    u.tx.status2
+#define ds_txstatus3    u.tx.status3
+#define ds_txstatus4    u.tx.status4
+#define ds_txstatus5    u.tx.status5
+#define ds_txstatus6    u.tx.status6
+#define ds_txstatus7    u.tx.status7
+#define ds_txstatus8    u.tx.status8
+#define ds_txstatus9    u.tx.status9
+
+#define ds_rxstatus0    u.rx.status0
+#define ds_rxstatus1    u.rx.status1
+#define ds_rxstatus2    u.rx.status2
+#define ds_rxstatus3    u.rx.status3
+#define ds_rxstatus4    u.rx.status4
+#define ds_rxstatus5    u.rx.status5
+#define ds_rxstatus6    u.rx.status6
+#define ds_rxstatus7    u.rx.status7
+#define ds_rxstatus8    u.rx.status8
+
+#define AR_FrameLen         0x00000fff
+#define AR_VirtMoreFrag     0x00001000
+#define AR_TxCtlRsvd00      0x0000e000
+#define AR_XmitPower        0x003f0000
+#define AR_XmitPower_S      16
+#define AR_RTSEnable        0x00400000
+#define AR_VEOL             0x00800000
+#define AR_ClrDestMask      0x01000000
+#define AR_TxCtlRsvd01      0x1e000000
+#define AR_TxIntrReq        0x20000000
+#define AR_DestIdxValid     0x40000000
+#define AR_CTSEnable        0x80000000
+
+#define AR_BufLen           0x00000fff
+#define AR_TxMore           0x00001000
+#define AR_DestIdx          0x000fe000
+#define AR_DestIdx_S        13
+#define AR_FrameType        0x00f00000
+#define AR_FrameType_S      20
+#define AR_NoAck            0x01000000
+#define AR_InsertTS         0x02000000
+#define AR_CorruptFCS       0x04000000
+#define AR_ExtOnly          0x08000000
+#define AR_ExtAndCtl        0x10000000
+#define AR_MoreAggr         0x20000000
+#define AR_IsAggr           0x40000000
+
+#define AR_BurstDur         0x00007fff
+#define AR_BurstDur_S       0
+#define AR_DurUpdateEna     0x00008000
+#define AR_XmitDataTries0   0x000f0000
+#define AR_XmitDataTries0_S 16
+#define AR_XmitDataTries1   0x00f00000
+#define AR_XmitDataTries1_S 20
+#define AR_XmitDataTries2   0x0f000000
+#define AR_XmitDataTries2_S 24
+#define AR_XmitDataTries3   0xf0000000
+#define AR_XmitDataTries3_S 28
+
+#define AR_XmitRate0        0x000000ff
+#define AR_XmitRate0_S      0
+#define AR_XmitRate1        0x0000ff00
+#define AR_XmitRate1_S      8
+#define AR_XmitRate2        0x00ff0000
+#define AR_XmitRate2_S      16
+#define AR_XmitRate3        0xff000000
+#define AR_XmitRate3_S      24
+
+#define AR_PacketDur0       0x00007fff
+#define AR_PacketDur0_S     0
+#define AR_RTSCTSQual0      0x00008000
+#define AR_PacketDur1       0x7fff0000
+#define AR_PacketDur1_S     16
+#define AR_RTSCTSQual1      0x80000000
+
+#define AR_PacketDur2       0x00007fff
+#define AR_PacketDur2_S     0
+#define AR_RTSCTSQual2      0x00008000
+#define AR_PacketDur3       0x7fff0000
+#define AR_PacketDur3_S     16
+#define AR_RTSCTSQual3      0x80000000
+
+#define AR_AggrLen          0x0000ffff
+#define AR_AggrLen_S        0
+#define AR_TxCtlRsvd60      0x00030000
+#define AR_PadDelim         0x03fc0000
+#define AR_PadDelim_S       18
+#define AR_EncrType         0x0c000000
+#define AR_EncrType_S       26
+#define AR_TxCtlRsvd61      0xf0000000
+
+#define AR_2040_0           0x00000001
+#define AR_GI0              0x00000002
+#define AR_ChainSel0        0x0000001c
+#define AR_ChainSel0_S      2
+#define AR_2040_1           0x00000020
+#define AR_GI1              0x00000040
+#define AR_ChainSel1        0x00000380
+#define AR_ChainSel1_S      7
+#define AR_2040_2           0x00000400
+#define AR_GI2              0x00000800
+#define AR_ChainSel2        0x00007000
+#define AR_ChainSel2_S      12
+#define AR_2040_3           0x00008000
+#define AR_GI3              0x00010000
+#define AR_ChainSel3        0x000e0000
+#define AR_ChainSel3_S      17
+#define AR_RTSCTSRate       0x0ff00000
+#define AR_RTSCTSRate_S     20
+#define AR_TxCtlRsvd70      0xf0000000
+
+#define AR_TxRSSIAnt00      0x000000ff
+#define AR_TxRSSIAnt00_S    0
+#define AR_TxRSSIAnt01      0x0000ff00
+#define AR_TxRSSIAnt01_S    8
+#define AR_TxRSSIAnt02      0x00ff0000
+#define AR_TxRSSIAnt02_S    16
+#define AR_TxStatusRsvd00   0x3f000000
+#define AR_TxBaStatus       0x40000000
+#define AR_TxStatusRsvd01   0x80000000
+
+#define AR_FrmXmitOK            0x00000001
+#define AR_ExcessiveRetries     0x00000002
+#define AR_FIFOUnderrun         0x00000004
+#define AR_Filtered             0x00000008
+#define AR_RTSFailCnt           0x000000f0
+#define AR_RTSFailCnt_S         4
+#define AR_DataFailCnt          0x00000f00
+#define AR_DataFailCnt_S        8
+#define AR_VirtRetryCnt         0x0000f000
+#define AR_VirtRetryCnt_S       12
+#define AR_TxDelimUnderrun      0x00010000
+#define AR_TxDataUnderrun       0x00020000
+#define AR_DescCfgErr           0x00040000
+#define AR_TxTimerExpired       0x00080000
+#define AR_TxStatusRsvd10       0xfff00000
+
+#define AR_SendTimestamp    ds_txstatus2
+#define AR_BaBitmapLow      ds_txstatus3
+#define AR_BaBitmapHigh     ds_txstatus4
+
+#define AR_TxRSSIAnt10      0x000000ff
+#define AR_TxRSSIAnt10_S    0
+#define AR_TxRSSIAnt11      0x0000ff00
+#define AR_TxRSSIAnt11_S    8
+#define AR_TxRSSIAnt12      0x00ff0000
+#define AR_TxRSSIAnt12_S    16
+#define AR_TxRSSICombined   0xff000000
+#define AR_TxRSSICombined_S 24
+
+#define AR_TxEVM0           ds_txstatus5
+#define AR_TxEVM1           ds_txstatus6
+#define AR_TxEVM2           ds_txstatus7
+
+#define AR_TxDone           0x00000001
+#define AR_SeqNum           0x00001ffe
+#define AR_SeqNum_S         1
+#define AR_TxStatusRsvd80   0x0001e000
+#define AR_TxOpExceeded     0x00020000
+#define AR_TxStatusRsvd81   0x001c0000
+#define AR_FinalTxIdx       0x00600000
+#define AR_FinalTxIdx_S     21
+#define AR_TxStatusRsvd82   0x01800000
+#define AR_PowerMgmt        0x02000000
+#define AR_TxStatusRsvd83   0xfc000000
+
+#define AR_RxCTLRsvd00  0xffffffff
+
+#define AR_BufLen       0x00000fff
+#define AR_RxCtlRsvd00  0x00001000
+#define AR_RxIntrReq    0x00002000
+#define AR_RxCtlRsvd01  0xffffc000
+
+#define AR_RxRSSIAnt00      0x000000ff
+#define AR_RxRSSIAnt00_S    0
+#define AR_RxRSSIAnt01      0x0000ff00
+#define AR_RxRSSIAnt01_S    8
+#define AR_RxRSSIAnt02      0x00ff0000
+#define AR_RxRSSIAnt02_S    16
+#define AR_RxRate           0xff000000
+#define AR_RxRate_S         24
+#define AR_RxStatusRsvd00   0xff000000
+
+#define AR_DataLen          0x00000fff
+#define AR_RxMore           0x00001000
+#define AR_NumDelim         0x003fc000
+#define AR_NumDelim_S       14
+#define AR_RxStatusRsvd10   0xff800000
+
+#define AR_RcvTimestamp     ds_rxstatus2
+
+#define AR_GI               0x00000001
+#define AR_2040             0x00000002
+#define AR_Parallel40       0x00000004
+#define AR_Parallel40_S     2
+#define AR_RxStatusRsvd30   0x000000f8
+#define AR_RxAntenna       0xffffff00
+#define AR_RxAntenna_S     8
+
+#define AR_RxRSSIAnt10            0x000000ff
+#define AR_RxRSSIAnt10_S          0
+#define AR_RxRSSIAnt11            0x0000ff00
+#define AR_RxRSSIAnt11_S          8
+#define AR_RxRSSIAnt12            0x00ff0000
+#define AR_RxRSSIAnt12_S          16
+#define AR_RxRSSICombined         0xff000000
+#define AR_RxRSSICombined_S       24
+
+#define AR_RxEVM0           ds_rxstatus4
+#define AR_RxEVM1           ds_rxstatus5
+#define AR_RxEVM2           ds_rxstatus6
+
+#define AR_RxDone           0x00000001
+#define AR_RxFrameOK        0x00000002
+#define AR_CRCErr           0x00000004
+#define AR_DecryptCRCErr    0x00000008
+#define AR_PHYErr           0x00000010
+#define AR_MichaelErr       0x00000020
+#define AR_PreDelimCRCErr   0x00000040
+#define AR_RxStatusRsvd70   0x00000080
+#define AR_RxKeyIdxValid    0x00000100
+#define AR_KeyIdx           0x0000fe00
+#define AR_KeyIdx_S         9
+#define AR_PHYErrCode       0x0000ff00
+#define AR_PHYErrCode_S     8
+#define AR_RxMoreAggr       0x00010000
+#define AR_RxAggr           0x00020000
+#define AR_PostDelimCRCErr  0x00040000
+#define AR_RxStatusRsvd71   0x3ff80000
+#define AR_DecryptBusyErr   0x40000000
+#define AR_KeyMiss          0x80000000
+
+enum ath9k_tx_queue {
+       ATH9K_TX_QUEUE_INACTIVE = 0,
+       ATH9K_TX_QUEUE_DATA,
+       ATH9K_TX_QUEUE_BEACON,
+       ATH9K_TX_QUEUE_CAB,
+       ATH9K_TX_QUEUE_UAPSD,
+       ATH9K_TX_QUEUE_PSPOLL
+};
+
+#define        ATH9K_NUM_TX_QUEUES 10
+
+enum ath9k_tx_queue_subtype {
+       ATH9K_WME_AC_BK = 0,
+       ATH9K_WME_AC_BE,
+       ATH9K_WME_AC_VI,
+       ATH9K_WME_AC_VO,
+       ATH9K_WME_UPSD
+};
+
+enum ath9k_tx_queue_flags {
+       TXQ_FLAG_TXOKINT_ENABLE = 0x0001,
+       TXQ_FLAG_TXERRINT_ENABLE = 0x0001,
+       TXQ_FLAG_TXDESCINT_ENABLE = 0x0002,
+       TXQ_FLAG_TXEOLINT_ENABLE = 0x0004,
+       TXQ_FLAG_TXURNINT_ENABLE = 0x0008,
+       TXQ_FLAG_BACKOFF_DISABLE = 0x0010,
+       TXQ_FLAG_COMPRESSION_ENABLE = 0x0020,
+       TXQ_FLAG_RDYTIME_EXP_POLICY_ENABLE = 0x0040,
+       TXQ_FLAG_FRAG_BURST_BACKOFF_ENABLE = 0x0080,
+};
+
+#define ATH9K_TXQ_USEDEFAULT ((u32) -1)
+#define ATH9K_TXQ_USE_LOCKOUT_BKOFF_DIS 0x00000001
+
+#define ATH9K_DECOMP_MASK_SIZE     128
+#define ATH9K_READY_TIME_LO_BOUND  50
+#define ATH9K_READY_TIME_HI_BOUND  96
+
+enum ath9k_pkt_type {
+       ATH9K_PKT_TYPE_NORMAL = 0,
+       ATH9K_PKT_TYPE_ATIM,
+       ATH9K_PKT_TYPE_PSPOLL,
+       ATH9K_PKT_TYPE_BEACON,
+       ATH9K_PKT_TYPE_PROBE_RESP,
+       ATH9K_PKT_TYPE_CHIRP,
+       ATH9K_PKT_TYPE_GRP_POLL,
+};
+
+struct ath9k_tx_queue_info {
+       u32 tqi_ver;
+       enum ath9k_tx_queue tqi_type;
+       enum ath9k_tx_queue_subtype tqi_subtype;
+       enum ath9k_tx_queue_flags tqi_qflags;
+       u32 tqi_priority;
+       u32 tqi_aifs;
+       u32 tqi_cwmin;
+       u32 tqi_cwmax;
+       u16 tqi_shretry;
+       u16 tqi_lgretry;
+       u32 tqi_cbrPeriod;
+       u32 tqi_cbrOverflowLimit;
+       u32 tqi_burstTime;
+       u32 tqi_readyTime;
+       u32 tqi_physCompBuf;
+       u32 tqi_intFlags;
+};
+
+enum ath9k_rx_filter {
+       ATH9K_RX_FILTER_UCAST = 0x00000001,
+       ATH9K_RX_FILTER_MCAST = 0x00000002,
+       ATH9K_RX_FILTER_BCAST = 0x00000004,
+       ATH9K_RX_FILTER_CONTROL = 0x00000008,
+       ATH9K_RX_FILTER_BEACON = 0x00000010,
+       ATH9K_RX_FILTER_PROM = 0x00000020,
+       ATH9K_RX_FILTER_PROBEREQ = 0x00000080,
+       ATH9K_RX_FILTER_PSPOLL = 0x00004000,
+       ATH9K_RX_FILTER_PHYERR = 0x00000100,
+       ATH9K_RX_FILTER_PHYRADAR = 0x00002000,
+};
+
+#define ATH9K_RATESERIES_RTS_CTS  0x0001
+#define ATH9K_RATESERIES_2040     0x0002
+#define ATH9K_RATESERIES_HALFGI   0x0004
+
+struct ath9k_11n_rate_series {
+       u32 Tries;
+       u32 Rate;
+       u32 PktDuration;
+       u32 ChSel;
+       u32 RateFlags;
+};
+
+struct ath9k_keyval {
+       u8 kv_type;
+       u8 kv_pad;
+       u16 kv_len;
+       u8 kv_val[16];
+       u8 kv_mic[8];
+       u8 kv_txmic[8];
+};
+
+enum ath9k_key_type {
+       ATH9K_KEY_TYPE_CLEAR,
+       ATH9K_KEY_TYPE_WEP,
+       ATH9K_KEY_TYPE_AES,
+       ATH9K_KEY_TYPE_TKIP,
+};
+
+enum ath9k_cipher {
+       ATH9K_CIPHER_WEP = 0,
+       ATH9K_CIPHER_AES_OCB = 1,
+       ATH9K_CIPHER_AES_CCM = 2,
+       ATH9K_CIPHER_CKIP = 3,
+       ATH9K_CIPHER_TKIP = 4,
+       ATH9K_CIPHER_CLR = 5,
+       ATH9K_CIPHER_MIC = 127
+};
+
+enum ath9k_ht_macmode {
+       ATH9K_HT_MACMODE_20 = 0,
+       ATH9K_HT_MACMODE_2040 = 1,
+};
+
+enum ath9k_ht_extprotspacing {
+       ATH9K_HT_EXTPROTSPACING_20 = 0,
+       ATH9K_HT_EXTPROTSPACING_25 = 1,
+};
+
+struct ath_hw;
+struct ath9k_channel;
+struct ath_rate_table;
+
+u32 ath9k_hw_gettxbuf(struct ath_hw *ah, u32 q);
+bool ath9k_hw_puttxbuf(struct ath_hw *ah, u32 q, u32 txdp);
+bool ath9k_hw_txstart(struct ath_hw *ah, u32 q);
+u32 ath9k_hw_numtxpending(struct ath_hw *ah, u32 q);
+bool ath9k_hw_updatetxtriglevel(struct ath_hw *ah, bool bIncTrigLevel);
+bool ath9k_hw_stoptxdma(struct ath_hw *ah, u32 q);
+bool ath9k_hw_filltxdesc(struct ath_hw *ah, struct ath_desc *ds,
+                        u32 segLen, bool firstSeg,
+                        bool lastSeg, const struct ath_desc *ds0);
+void ath9k_hw_cleartxdesc(struct ath_hw *ah, struct ath_desc *ds);
+int ath9k_hw_txprocdesc(struct ath_hw *ah, struct ath_desc *ds);
+void ath9k_hw_set11n_txdesc(struct ath_hw *ah, struct ath_desc *ds,
+                           u32 pktLen, enum ath9k_pkt_type type, u32 txPower,
+                           u32 keyIx, enum ath9k_key_type keyType, u32 flags);
+void ath9k_hw_set11n_ratescenario(struct ath_hw *ah, struct ath_desc *ds,
+                                 struct ath_desc *lastds,
+                                 u32 durUpdateEn, u32 rtsctsRate,
+                                 u32 rtsctsDuration,
+                                 struct ath9k_11n_rate_series series[],
+                                 u32 nseries, u32 flags);
+void ath9k_hw_set11n_aggr_first(struct ath_hw *ah, struct ath_desc *ds,
+                               u32 aggrLen);
+void ath9k_hw_set11n_aggr_middle(struct ath_hw *ah, struct ath_desc *ds,
+                                u32 numDelims);
+void ath9k_hw_set11n_aggr_last(struct ath_hw *ah, struct ath_desc *ds);
+void ath9k_hw_clr11n_aggr(struct ath_hw *ah, struct ath_desc *ds);
+void ath9k_hw_set11n_burstduration(struct ath_hw *ah, struct ath_desc *ds,
+                                  u32 burstDuration);
+void ath9k_hw_set11n_virtualmorefrag(struct ath_hw *ah, struct ath_desc *ds,
+                                    u32 vmf);
+void ath9k_hw_gettxintrtxqs(struct ath_hw *ah, u32 *txqs);
+bool ath9k_hw_set_txq_props(struct ath_hw *ah, int q,
+                           const struct ath9k_tx_queue_info *qinfo);
+bool ath9k_hw_get_txq_props(struct ath_hw *ah, int q,
+                           struct ath9k_tx_queue_info *qinfo);
+int ath9k_hw_setuptxqueue(struct ath_hw *ah, enum ath9k_tx_queue type,
+                         const struct ath9k_tx_queue_info *qinfo);
+bool ath9k_hw_releasetxqueue(struct ath_hw *ah, u32 q);
+bool ath9k_hw_resettxqueue(struct ath_hw *ah, u32 q);
+int ath9k_hw_rxprocdesc(struct ath_hw *ah, struct ath_desc *ds,
+                       u32 pa, struct ath_desc *nds, u64 tsf);
+bool ath9k_hw_setuprxdesc(struct ath_hw *ah, struct ath_desc *ds,
+                         u32 size, u32 flags);
+bool ath9k_hw_setrxabort(struct ath_hw *ah, bool set);
+void ath9k_hw_putrxbuf(struct ath_hw *ah, u32 rxdp);
+void ath9k_hw_rxena(struct ath_hw *ah);
+void ath9k_hw_startpcureceive(struct ath_hw *ah);
+void ath9k_hw_stoppcurecv(struct ath_hw *ah);
+bool ath9k_hw_stopdmarecv(struct ath_hw *ah);
+
+#endif /* MAC_H */
index 727f067aca4f8a764cbf9284c287b20ad96b73e4..fc3460f8f7fcd6df688f4b9e8c52fc3c9c8605b5 100644 (file)
@@ -15,9 +15,7 @@
  */
 
 #include <linux/nl80211.h>
-#include "core.h"
-#include "reg.h"
-#include "hw.h"
+#include "ath9k.h"
 
 #define ATH_PCI_VERSION "0.1"
 
@@ -28,84 +26,125 @@ MODULE_DESCRIPTION("Support for Atheros 802.11n wireless LAN cards.");
 MODULE_SUPPORTED_DEVICE("Atheros 802.11n WLAN cards");
 MODULE_LICENSE("Dual BSD/GPL");
 
-static struct pci_device_id ath_pci_id_table[] __devinitdata = {
-       { PCI_VDEVICE(ATHEROS, 0x0023) }, /* PCI   */
-       { PCI_VDEVICE(ATHEROS, 0x0024) }, /* PCI-E */
-       { PCI_VDEVICE(ATHEROS, 0x0027) }, /* PCI   */
-       { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI   */
-       { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
-       { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */
-       { 0 }
+/* We use the hw_value as an index into our private channel structure */
+
+#define CHAN2G(_freq, _idx)  { \
+       .center_freq = (_freq), \
+       .hw_value = (_idx), \
+       .max_power = 30, \
+}
+
+#define CHAN5G(_freq, _idx) { \
+       .band = IEEE80211_BAND_5GHZ, \
+       .center_freq = (_freq), \
+       .hw_value = (_idx), \
+       .max_power = 30, \
+}
+
+/* Some 2 GHz radios are actually tunable on 2312-2732
+ * on 5 MHz steps, we support the channels which we know
+ * we have calibration data for all cards though to make
+ * this static */
+static struct ieee80211_channel ath9k_2ghz_chantable[] = {
+       CHAN2G(2412, 0), /* Channel 1 */
+       CHAN2G(2417, 1), /* Channel 2 */
+       CHAN2G(2422, 2), /* Channel 3 */
+       CHAN2G(2427, 3), /* Channel 4 */
+       CHAN2G(2432, 4), /* Channel 5 */
+       CHAN2G(2437, 5), /* Channel 6 */
+       CHAN2G(2442, 6), /* Channel 7 */
+       CHAN2G(2447, 7), /* Channel 8 */
+       CHAN2G(2452, 8), /* Channel 9 */
+       CHAN2G(2457, 9), /* Channel 10 */
+       CHAN2G(2462, 10), /* Channel 11 */
+       CHAN2G(2467, 11), /* Channel 12 */
+       CHAN2G(2472, 12), /* Channel 13 */
+       CHAN2G(2484, 13), /* Channel 14 */
 };
 
-static void ath_detach(struct ath_softc *sc);
-
-/* return bus cachesize in 4B word units */
-
-static void bus_read_cachesize(struct ath_softc *sc, int *csz)
-{
-       u8 u8tmp;
-
-       pci_read_config_byte(sc->pdev, PCI_CACHE_LINE_SIZE, (u8 *)&u8tmp);
-       *csz = (int)u8tmp;
-
-       /*
-        * This check was put in to avoid "unplesant" consequences if
-        * the bootrom has not fully initialized all PCI devices.
-        * Sometimes the cache line size register is not set
-        */
-
-       if (*csz == 0)
-               *csz = DEFAULT_CACHELINE >> 2;   /* Use the default size */
-}
-
-static void ath_setcurmode(struct ath_softc *sc, enum wireless_mode mode)
-{
-       sc->cur_rate_table = sc->hw_rate_table[mode];
-       /*
-        * All protection frames are transmited at 2Mb/s for
-        * 11g, otherwise at 1Mb/s.
-        * XXX select protection rate index from rate table.
-        */
-       sc->sc_protrix = (mode == ATH9K_MODE_11G ? 1 : 0);
-}
+/* Some 5 GHz radios are actually tunable on XXXX-YYYY
+ * on 5 MHz steps, we support the channels which we know
+ * we have calibration data for all cards though to make
+ * this static */
+static struct ieee80211_channel ath9k_5ghz_chantable[] = {
+       /* _We_ call this UNII 1 */
+       CHAN5G(5180, 14), /* Channel 36 */
+       CHAN5G(5200, 15), /* Channel 40 */
+       CHAN5G(5220, 16), /* Channel 44 */
+       CHAN5G(5240, 17), /* Channel 48 */
+       /* _We_ call this UNII 2 */
+       CHAN5G(5260, 18), /* Channel 52 */
+       CHAN5G(5280, 19), /* Channel 56 */
+       CHAN5G(5300, 20), /* Channel 60 */
+       CHAN5G(5320, 21), /* Channel 64 */
+       /* _We_ call this "Middle band" */
+       CHAN5G(5500, 22), /* Channel 100 */
+       CHAN5G(5520, 23), /* Channel 104 */
+       CHAN5G(5540, 24), /* Channel 108 */
+       CHAN5G(5560, 25), /* Channel 112 */
+       CHAN5G(5580, 26), /* Channel 116 */
+       CHAN5G(5600, 27), /* Channel 120 */
+       CHAN5G(5620, 28), /* Channel 124 */
+       CHAN5G(5640, 29), /* Channel 128 */
+       CHAN5G(5660, 30), /* Channel 132 */
+       CHAN5G(5680, 31), /* Channel 136 */
+       CHAN5G(5700, 32), /* Channel 140 */
+       /* _We_ call this UNII 3 */
+       CHAN5G(5745, 33), /* Channel 149 */
+       CHAN5G(5765, 34), /* Channel 153 */
+       CHAN5G(5785, 35), /* Channel 157 */
+       CHAN5G(5805, 36), /* Channel 161 */
+       CHAN5G(5825, 37), /* Channel 165 */
+};
 
-static enum wireless_mode ath_chan2mode(struct ath9k_channel *chan)
+static void ath_cache_conf_rate(struct ath_softc *sc,
+                               struct ieee80211_conf *conf)
 {
-       if (chan->chanmode == CHANNEL_A)
-               return ATH9K_MODE_11A;
-       else if (chan->chanmode == CHANNEL_G)
-               return ATH9K_MODE_11G;
-       else if (chan->chanmode == CHANNEL_B)
-               return ATH9K_MODE_11B;
-       else if (chan->chanmode == CHANNEL_A_HT20)
-               return ATH9K_MODE_11NA_HT20;
-       else if (chan->chanmode == CHANNEL_G_HT20)
-               return ATH9K_MODE_11NG_HT20;
-       else if (chan->chanmode == CHANNEL_A_HT40PLUS)
-               return ATH9K_MODE_11NA_HT40PLUS;
-       else if (chan->chanmode == CHANNEL_A_HT40MINUS)
-               return ATH9K_MODE_11NA_HT40MINUS;
-       else if (chan->chanmode == CHANNEL_G_HT40PLUS)
-               return ATH9K_MODE_11NG_HT40PLUS;
-       else if (chan->chanmode == CHANNEL_G_HT40MINUS)
-               return ATH9K_MODE_11NG_HT40MINUS;
-
-       WARN_ON(1); /* should not get here */
-
-       return ATH9K_MODE_11B;
+       switch (conf->channel->band) {
+       case IEEE80211_BAND_2GHZ:
+               if (conf_is_ht20(conf))
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11NG_HT20];
+               else if (conf_is_ht40_minus(conf))
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11NG_HT40MINUS];
+               else if (conf_is_ht40_plus(conf))
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11NG_HT40PLUS];
+               else
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11G];
+               break;
+       case IEEE80211_BAND_5GHZ:
+               if (conf_is_ht20(conf))
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11NA_HT20];
+               else if (conf_is_ht40_minus(conf))
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11NA_HT40MINUS];
+               else if (conf_is_ht40_plus(conf))
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11NA_HT40PLUS];
+               else
+                       sc->cur_rate_table =
+                         sc->hw_rate_table[ATH9K_MODE_11A];
+               break;
+       default:
+               BUG_ON(1);
+               break;
+       }
 }
 
 static void ath_update_txpow(struct ath_softc *sc)
 {
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        u32 txpow;
 
-       if (sc->sc_curtxpow != sc->sc_config.txpowlimit) {
-               ath9k_hw_set_txpowerlimit(ah, sc->sc_config.txpowlimit);
+       if (sc->curtxpow != sc->config.txpowlimit) {
+               ath9k_hw_set_txpowerlimit(ah, sc->config.txpowlimit);
                /* read back in case value is clamped */
                ath9k_hw_getcapability(ah, ATH9K_CAP_TXPOW, 1, &txpow);
-               sc->sc_curtxpow = txpow;
+               sc->curtxpow = txpow;
        }
 }
 
@@ -176,79 +215,18 @@ static void ath_setup_rates(struct ath_softc *sc, enum ieee80211_band band)
        for (i = 0; i < maxrates; i++) {
                rate[i].bitrate = rate_table->info[i].ratekbps / 100;
                rate[i].hw_value = rate_table->info[i].ratecode;
+               if (rate_table->info[i].short_preamble) {
+                       rate[i].hw_value_short = rate_table->info[i].ratecode |
+                               rate_table->info[i].short_preamble;
+                       rate[i].flags = IEEE80211_RATE_SHORT_PREAMBLE;
+               }
                sband->n_bitrates++;
+
                DPRINTF(sc, ATH_DBG_CONFIG, "Rate: %2dMbps, ratecode: %2d\n",
                        rate[i].bitrate / 10, rate[i].hw_value);
        }
 }
 
-static int ath_setup_channels(struct ath_softc *sc)
-{
-       struct ath_hal *ah = sc->sc_ah;
-       int nchan, i, a = 0, b = 0;
-       u8 regclassids[ATH_REGCLASSIDS_MAX];
-       u32 nregclass = 0;
-       struct ieee80211_supported_band *band_2ghz;
-       struct ieee80211_supported_band *band_5ghz;
-       struct ieee80211_channel *chan_2ghz;
-       struct ieee80211_channel *chan_5ghz;
-       struct ath9k_channel *c;
-
-       /* Fill in ah->ah_channels */
-       if (!ath9k_regd_init_channels(ah, ATH_CHAN_MAX, (u32 *)&nchan,
-                                     regclassids, ATH_REGCLASSIDS_MAX,
-                                     &nregclass, CTRY_DEFAULT, false, 1)) {
-               u32 rd = ah->ah_currentRD;
-               DPRINTF(sc, ATH_DBG_FATAL,
-                       "Unable to collect channel list; "
-                       "regdomain likely %u country code %u\n",
-                       rd, CTRY_DEFAULT);
-               return -EINVAL;
-       }
-
-       band_2ghz = &sc->sbands[IEEE80211_BAND_2GHZ];
-       band_5ghz = &sc->sbands[IEEE80211_BAND_5GHZ];
-       chan_2ghz = sc->channels[IEEE80211_BAND_2GHZ];
-       chan_5ghz = sc->channels[IEEE80211_BAND_5GHZ];
-
-       for (i = 0; i < nchan; i++) {
-               c = &ah->ah_channels[i];
-               if (IS_CHAN_2GHZ(c)) {
-                       chan_2ghz[a].band = IEEE80211_BAND_2GHZ;
-                       chan_2ghz[a].center_freq = c->channel;
-                       chan_2ghz[a].max_power = c->maxTxPower;
-
-                       if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
-                               chan_2ghz[a].flags |= IEEE80211_CHAN_NO_IBSS;
-                       if (c->channelFlags & CHANNEL_PASSIVE)
-                               chan_2ghz[a].flags |= IEEE80211_CHAN_PASSIVE_SCAN;
-
-                       band_2ghz->n_channels = ++a;
-
-                       DPRINTF(sc, ATH_DBG_CONFIG, "2MHz channel: %d, "
-                               "channelFlags: 0x%x\n",
-                               c->channel, c->channelFlags);
-               } else if (IS_CHAN_5GHZ(c)) {
-                       chan_5ghz[b].band = IEEE80211_BAND_5GHZ;
-                       chan_5ghz[b].center_freq = c->channel;
-                       chan_5ghz[b].max_power = c->maxTxPower;
-
-                       if (c->privFlags & CHANNEL_DISALLOW_ADHOC)
-                               chan_5ghz[b].flags |= IEEE80211_CHAN_NO_IBSS;
-                       if (c->channelFlags & CHANNEL_PASSIVE)
-                               chan_5ghz[b].flags |= IEEE80211_CHAN_PASSIVE_SCAN;
-
-                       band_5ghz->n_channels = ++b;
-
-                       DPRINTF(sc, ATH_DBG_CONFIG, "5MHz channel: %d, "
-                               "channelFlags: 0x%x\n",
-                               c->channel, c->channelFlags);
-               }
-       }
-
-       return 0;
-}
-
 /*
  * Set/change channels.  If the channel is really being changed, it's done
  * by reseting the chip.  To accomplish this we must first cleanup any pending
@@ -256,70 +234,68 @@ static int ath_setup_channels(struct ath_softc *sc)
 */
 static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
 {
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        bool fastcc = true, stopped;
+       struct ieee80211_hw *hw = sc->hw;
+       struct ieee80211_channel *channel = hw->conf.channel;
+       int r;
 
        if (sc->sc_flags & SC_OP_INVALID)
                return -EIO;
 
-       if (hchan->channel != sc->sc_ah->ah_curchan->channel ||
-           hchan->channelFlags != sc->sc_ah->ah_curchan->channelFlags ||
-           (sc->sc_flags & SC_OP_CHAINMASK_UPDATE) ||
-           (sc->sc_flags & SC_OP_FULL_RESET)) {
-               int status;
-               /*
-                * This is only performed if the channel settings have
-                * actually changed.
-                *
-                * To switch channels clear any pending DMA operations;
-                * wait long enough for the RX fifo to drain, reset the
-                * hardware at the new frequency, and then re-enable
-                * the relevant bits of the h/w.
-                */
-               ath9k_hw_set_interrupts(ah, 0);
-               ath_draintxq(sc, false);
-               stopped = ath_stoprecv(sc);
-
-               /* XXX: do not flush receive queue here. We don't want
-                * to flush data frames already in queue because of
-                * changing channel. */
-
-               if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET))
-                       fastcc = false;
-
-               DPRINTF(sc, ATH_DBG_CONFIG,
-                       "(%u MHz) -> (%u MHz), cflags:%x, chanwidth: %d\n",
-                       sc->sc_ah->ah_curchan->channel,
-                       hchan->channel, hchan->channelFlags, sc->tx_chan_width);
-
-               spin_lock_bh(&sc->sc_resetlock);
-               if (!ath9k_hw_reset(ah, hchan, sc->tx_chan_width,
-                                   sc->sc_tx_chainmask, sc->sc_rx_chainmask,
-                                   sc->sc_ht_extprotspacing, fastcc, &status)) {
-                       DPRINTF(sc, ATH_DBG_FATAL,
-                               "Unable to reset channel %u (%uMhz) "
-                               "flags 0x%x hal status %u\n",
-                               ath9k_hw_mhz2ieee(ah, hchan->channel,
-                                                 hchan->channelFlags),
-                               hchan->channel, hchan->channelFlags, status);
-                       spin_unlock_bh(&sc->sc_resetlock);
-                       return -EIO;
-               }
-               spin_unlock_bh(&sc->sc_resetlock);
+       ath9k_ps_wakeup(sc);
+
+       /*
+        * This is only performed if the channel settings have
+        * actually changed.
+        *
+        * To switch channels clear any pending DMA operations;
+        * wait long enough for the RX fifo to drain, reset the
+        * hardware at the new frequency, and then re-enable
+        * the relevant bits of the h/w.
+        */
+       ath9k_hw_set_interrupts(ah, 0);
+       ath_drain_all_txq(sc, false);
+       stopped = ath_stoprecv(sc);
 
-               sc->sc_flags &= ~SC_OP_CHAINMASK_UPDATE;
-               sc->sc_flags &= ~SC_OP_FULL_RESET;
+       /* XXX: do not flush receive queue here. We don't want
+        * to flush data frames already in queue because of
+        * changing channel. */
 
-               if (ath_startrecv(sc) != 0) {
-                       DPRINTF(sc, ATH_DBG_FATAL,
-                               "Unable to restart recv logic\n");
-                       return -EIO;
-               }
+       if (!stopped || (sc->sc_flags & SC_OP_FULL_RESET))
+               fastcc = false;
 
-               ath_setcurmode(sc, ath_chan2mode(hchan));
-               ath_update_txpow(sc);
-               ath9k_hw_set_interrupts(ah, sc->sc_imask);
+       DPRINTF(sc, ATH_DBG_CONFIG,
+               "(%u MHz) -> (%u MHz), chanwidth: %d\n",
+               sc->sc_ah->curchan->channel,
+               channel->center_freq, sc->tx_chan_width);
+
+       spin_lock_bh(&sc->sc_resetlock);
+
+       r = ath9k_hw_reset(ah, hchan, fastcc);
+       if (r) {
+               DPRINTF(sc, ATH_DBG_FATAL,
+                       "Unable to reset channel (%u Mhz) "
+                       "reset status %u\n",
+                       channel->center_freq, r);
+               spin_unlock_bh(&sc->sc_resetlock);
+               return r;
        }
+       spin_unlock_bh(&sc->sc_resetlock);
+
+       sc->sc_flags &= ~SC_OP_CHAINMASK_UPDATE;
+       sc->sc_flags &= ~SC_OP_FULL_RESET;
+
+       if (ath_startrecv(sc) != 0) {
+               DPRINTF(sc, ATH_DBG_FATAL,
+                       "Unable to restart recv logic\n");
+               return -EIO;
+       }
+
+       ath_cache_conf_rate(sc, &hw->conf);
+       ath_update_txpow(sc);
+       ath9k_hw_set_interrupts(ah, sc->imask);
+       ath9k_ps_restore(sc);
        return 0;
 }
 
@@ -333,7 +309,7 @@ static int ath_set_channel(struct ath_softc *sc, struct ath9k_channel *hchan)
 static void ath_ani_calibrate(unsigned long data)
 {
        struct ath_softc *sc;
-       struct ath_hal *ah;
+       struct ath_hw *ah;
        bool longcal = false;
        bool shortcal = false;
        bool aniflag = false;
@@ -351,69 +327,68 @@ static void ath_ani_calibrate(unsigned long data)
                return;
 
        /* Long calibration runs independently of short calibration. */
-       if ((timestamp - sc->sc_ani.sc_longcal_timer) >= ATH_LONG_CALINTERVAL) {
+       if ((timestamp - sc->ani.longcal_timer) >= ATH_LONG_CALINTERVAL) {
                longcal = true;
                DPRINTF(sc, ATH_DBG_ANI, "longcal @%lu\n", jiffies);
-               sc->sc_ani.sc_longcal_timer = timestamp;
+               sc->ani.longcal_timer = timestamp;
        }
 
-       /* Short calibration applies only while sc_caldone is false */
-       if (!sc->sc_ani.sc_caldone) {
-               if ((timestamp - sc->sc_ani.sc_shortcal_timer) >=
+       /* Short calibration applies only while caldone is false */
+       if (!sc->ani.caldone) {
+               if ((timestamp - sc->ani.shortcal_timer) >=
                    ATH_SHORT_CALINTERVAL) {
                        shortcal = true;
                        DPRINTF(sc, ATH_DBG_ANI, "shortcal @%lu\n", jiffies);
-                       sc->sc_ani.sc_shortcal_timer = timestamp;
-                       sc->sc_ani.sc_resetcal_timer = timestamp;
+                       sc->ani.shortcal_timer = timestamp;
+                       sc->ani.resetcal_timer = timestamp;
                }
        } else {
-               if ((timestamp - sc->sc_ani.sc_resetcal_timer) >=
+               if ((timestamp - sc->ani.resetcal_timer) >=
                    ATH_RESTART_CALINTERVAL) {
-                       ath9k_hw_reset_calvalid(ah, ah->ah_curchan,
-                                               &sc->sc_ani.sc_caldone);
-                       if (sc->sc_ani.sc_caldone)
-                               sc->sc_ani.sc_resetcal_timer = timestamp;
+                       sc->ani.caldone = ath9k_hw_reset_calvalid(ah);
+                       if (sc->ani.caldone)
+                               sc->ani.resetcal_timer = timestamp;
                }
        }
 
        /* Verify whether we must check ANI */
-       if ((timestamp - sc->sc_ani.sc_checkani_timer) >=
+       if ((timestamp - sc->ani.checkani_timer) >=
           ATH_ANI_POLLINTERVAL) {
                aniflag = true;
-               sc->sc_ani.sc_checkani_timer = timestamp;
+               sc->ani.checkani_timer = timestamp;
        }
 
        /* Skip all processing if there's nothing to do. */
        if (longcal || shortcal || aniflag) {
                /* Call ANI routine if necessary */
                if (aniflag)
-                       ath9k_hw_ani_monitor(ah, &sc->sc_halstats,
-                                            ah->ah_curchan);
+                       ath9k_hw_ani_monitor(ah, &sc->nodestats,
+                                            ah->curchan);
 
                /* Perform calibration if necessary */
                if (longcal || shortcal) {
                        bool iscaldone = false;
 
-                       if (ath9k_hw_calibrate(ah, ah->ah_curchan,
-                                              sc->sc_rx_chainmask, longcal,
+                       if (ath9k_hw_calibrate(ah, ah->curchan,
+                                              sc->rx_chainmask, longcal,
                                               &iscaldone)) {
                                if (longcal)
-                                       sc->sc_ani.sc_noise_floor =
+                                       sc->ani.noise_floor =
                                                ath9k_hw_getchan_noise(ah,
-                                                              ah->ah_curchan);
+                                                              ah->curchan);
 
                                DPRINTF(sc, ATH_DBG_ANI,
                                        "calibrate chan %u/%x nf: %d\n",
-                                       ah->ah_curchan->channel,
-                                       ah->ah_curchan->channelFlags,
-                                       sc->sc_ani.sc_noise_floor);
+                                       ah->curchan->channel,
+                                       ah->curchan->channelFlags,
+                                       sc->ani.noise_floor);
                        } else {
                                DPRINTF(sc, ATH_DBG_ANY,
                                        "calibrate chan %u/%x failed\n",
-                                       ah->ah_curchan->channel,
-                                       ah->ah_curchan->channelFlags);
+                                       ah->curchan->channel,
+                                       ah->curchan->channelFlags);
                        }
-                       sc->sc_ani.sc_caldone = iscaldone;
+                       sc->ani.caldone = iscaldone;
                }
        }
 
@@ -423,32 +398,34 @@ static void ath_ani_calibrate(unsigned long data)
        * short calibration and long calibration.
        */
        cal_interval = ATH_LONG_CALINTERVAL;
-       if (sc->sc_ah->ah_config.enable_ani)
+       if (sc->sc_ah->config.enable_ani)
                cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
-       if (!sc->sc_ani.sc_caldone)
+       if (!sc->ani.caldone)
                cal_interval = min(cal_interval, (u32)ATH_SHORT_CALINTERVAL);
 
-       mod_timer(&sc->sc_ani.timer, jiffies + msecs_to_jiffies(cal_interval));
+       mod_timer(&sc->ani.timer, jiffies + msecs_to_jiffies(cal_interval));
 }
 
 /*
  * Update tx/rx chainmask. For legacy association,
  * hard code chainmask to 1x1, for 11n association, use
- * the chainmask configuration.
+ * the chainmask configuration, for bt coexistence, use
+ * the chainmask configuration even in legacy mode.
  */
 static void ath_update_chainmask(struct ath_softc *sc, int is_ht)
 {
        sc->sc_flags |= SC_OP_CHAINMASK_UPDATE;
-       if (is_ht) {
-               sc->sc_tx_chainmask = sc->sc_ah->ah_caps.tx_chainmask;
-               sc->sc_rx_chainmask = sc->sc_ah->ah_caps.rx_chainmask;
+       if (is_ht ||
+           (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_BT_COEX)) {
+               sc->tx_chainmask = sc->sc_ah->caps.tx_chainmask;
+               sc->rx_chainmask = sc->sc_ah->caps.rx_chainmask;
        } else {
-               sc->sc_tx_chainmask = 1;
-               sc->sc_rx_chainmask = 1;
+               sc->tx_chainmask = 1;
+               sc->rx_chainmask = 1;
        }
 
        DPRINTF(sc, ATH_DBG_CONFIG, "tx chmask: %d, rx chmask: %d\n",
-               sc->sc_tx_chainmask, sc->sc_rx_chainmask);
+               sc->tx_chainmask, sc->rx_chainmask);
 }
 
 static void ath_node_attach(struct ath_softc *sc, struct ieee80211_sta *sta)
@@ -476,7 +453,7 @@ static void ath_node_detach(struct ath_softc *sc, struct ieee80211_sta *sta)
 static void ath9k_tasklet(unsigned long data)
 {
        struct ath_softc *sc = (struct ath_softc *)data;
-       u32 status = sc->sc_intrstatus;
+       u32 status = sc->intrstatus;
 
        if (status & ATH9K_INT_FATAL) {
                /* need a chip reset */
@@ -496,13 +473,13 @@ static void ath9k_tasklet(unsigned long data)
        }
 
        /* re-enable hardware interrupt */
-       ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_imask);
+       ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);
 }
 
-static irqreturn_t ath_isr(int irq, void *dev)
+irqreturn_t ath_isr(int irq, void *dev)
 {
        struct ath_softc *sc = dev;
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        enum ath9k_int status;
        bool sched = false;
 
@@ -527,7 +504,7 @@ static irqreturn_t ath_isr(int irq, void *dev)
                 */
                ath9k_hw_getisr(ah, &status);   /* NB: clears ISR too */
 
-               status &= sc->sc_imask; /* discard unasked-for bits */
+               status &= sc->imask;    /* discard unasked-for bits */
 
                /*
                 * If there are no status bits set, then this interrupt was not
@@ -536,7 +513,7 @@ static irqreturn_t ath_isr(int irq, void *dev)
                if (!status)
                        return IRQ_NONE;
 
-               sc->sc_intrstatus = status;
+               sc->intrstatus = status;
 
                if (status & ATH9K_INT_FATAL) {
                        /* need a chip reset */
@@ -583,16 +560,18 @@ static irqreturn_t ath_isr(int irq, void *dev)
                                 * it will clear whatever condition caused
                                 * the interrupt.
                                 */
-                               ath9k_hw_procmibevent(ah, &sc->sc_halstats);
-                               ath9k_hw_set_interrupts(ah, sc->sc_imask);
+                               ath9k_hw_procmibevent(ah, &sc->nodestats);
+                               ath9k_hw_set_interrupts(ah, sc->imask);
                        }
                        if (status & ATH9K_INT_TIM_TIMER) {
-                               if (!(ah->ah_caps.hw_caps &
+                               if (!(ah->caps.hw_caps &
                                      ATH9K_HW_CAP_AUTOSLEEP)) {
                                        /* Clear RxAbort bit so that we can
                                         * receive frames */
+                                       ath9k_hw_setpower(ah, ATH9K_PM_AWAKE);
                                        ath9k_hw_setrxabort(ah, 0);
                                        sched = true;
+                                       sc->sc_flags |= SC_OP_WAIT_FOR_BEACON;
                                }
                        }
                }
@@ -602,26 +581,13 @@ static irqreturn_t ath_isr(int irq, void *dev)
 
        if (sched) {
                /* turn off every interrupt except SWBA */
-               ath9k_hw_set_interrupts(ah, (sc->sc_imask & ATH9K_INT_SWBA));
+               ath9k_hw_set_interrupts(ah, (sc->imask & ATH9K_INT_SWBA));
                tasklet_schedule(&sc->intr_tq);
        }
 
        return IRQ_HANDLED;
 }
 
-static int ath_get_channel(struct ath_softc *sc,
-                          struct ieee80211_channel *chan)
-{
-       int i;
-
-       for (i = 0; i < sc->sc_ah->ah_nchan; i++) {
-               if (sc->sc_ah->ah_channels[i].channel == chan->center_freq)
-                       return i;
-       }
-
-       return -1;
-}
-
 static u32 ath_get_extchanmode(struct ath_softc *sc,
                               struct ieee80211_channel *chan,
                               enum nl80211_channel_type channel_type)
@@ -690,7 +656,7 @@ static int ath_setkey_tkip(struct ath_softc *sc, u16 keyix, const u8 *key,
                memcpy(hk->kv_mic, key_rxmic, sizeof(hk->kv_mic));
                return ath_keyset(sc, keyix, hk, addr);
        }
-       if (!sc->sc_splitmic) {
+       if (!sc->splitmic) {
                /*
                 * data key goes at first index,
                 * the hal handles the MIC keys at index+64.
@@ -720,13 +686,13 @@ static int ath_reserve_key_cache_slot_tkip(struct ath_softc *sc)
 {
        int i;
 
-       for (i = IEEE80211_WEP_NKID; i < sc->sc_keymax / 2; i++) {
-               if (test_bit(i, sc->sc_keymap) ||
-                   test_bit(i + 64, sc->sc_keymap))
+       for (i = IEEE80211_WEP_NKID; i < sc->keymax / 2; i++) {
+               if (test_bit(i, sc->keymap) ||
+                   test_bit(i + 64, sc->keymap))
                        continue; /* At least one part of TKIP key allocated */
-               if (sc->sc_splitmic &&
-                   (test_bit(i + 32, sc->sc_keymap) ||
-                    test_bit(i + 64 + 32, sc->sc_keymap)))
+               if (sc->splitmic &&
+                   (test_bit(i + 32, sc->keymap) ||
+                    test_bit(i + 64 + 32, sc->keymap)))
                        continue; /* At least one part of TKIP key allocated */
 
                /* Found a free slot for a TKIP key */
@@ -740,55 +706,55 @@ static int ath_reserve_key_cache_slot(struct ath_softc *sc)
        int i;
 
        /* First, try to find slots that would not be available for TKIP. */
-       if (sc->sc_splitmic) {
-               for (i = IEEE80211_WEP_NKID; i < sc->sc_keymax / 4; i++) {
-                       if (!test_bit(i, sc->sc_keymap) &&
-                           (test_bit(i + 32, sc->sc_keymap) ||
-                            test_bit(i + 64, sc->sc_keymap) ||
-                            test_bit(i + 64 + 32, sc->sc_keymap)))
+       if (sc->splitmic) {
+               for (i = IEEE80211_WEP_NKID; i < sc->keymax / 4; i++) {
+                       if (!test_bit(i, sc->keymap) &&
+                           (test_bit(i + 32, sc->keymap) ||
+                            test_bit(i + 64, sc->keymap) ||
+                            test_bit(i + 64 + 32, sc->keymap)))
                                return i;
-                       if (!test_bit(i + 32, sc->sc_keymap) &&
-                           (test_bit(i, sc->sc_keymap) ||
-                            test_bit(i + 64, sc->sc_keymap) ||
-                            test_bit(i + 64 + 32, sc->sc_keymap)))
+                       if (!test_bit(i + 32, sc->keymap) &&
+                           (test_bit(i, sc->keymap) ||
+                            test_bit(i + 64, sc->keymap) ||
+                            test_bit(i + 64 + 32, sc->keymap)))
                                return i + 32;
-                       if (!test_bit(i + 64, sc->sc_keymap) &&
-                           (test_bit(i , sc->sc_keymap) ||
-                            test_bit(i + 32, sc->sc_keymap) ||
-                            test_bit(i + 64 + 32, sc->sc_keymap)))
+                       if (!test_bit(i + 64, sc->keymap) &&
+                           (test_bit(i , sc->keymap) ||
+                            test_bit(i + 32, sc->keymap) ||
+                            test_bit(i + 64 + 32, sc->keymap)))
                                return i + 64;
-                       if (!test_bit(i + 64 + 32, sc->sc_keymap) &&
-                           (test_bit(i, sc->sc_keymap) ||
-                            test_bit(i + 32, sc->sc_keymap) ||
-                            test_bit(i + 64, sc->sc_keymap)))
+                       if (!test_bit(i + 64 + 32, sc->keymap) &&
+                           (test_bit(i, sc->keymap) ||
+                            test_bit(i + 32, sc->keymap) ||
+                            test_bit(i + 64, sc->keymap)))
                                return i + 64 + 32;
                }
        } else {
-               for (i = IEEE80211_WEP_NKID; i < sc->sc_keymax / 2; i++) {
-                       if (!test_bit(i, sc->sc_keymap) &&
-                           test_bit(i + 64, sc->sc_keymap))
+               for (i = IEEE80211_WEP_NKID; i < sc->keymax / 2; i++) {
+                       if (!test_bit(i, sc->keymap) &&
+                           test_bit(i + 64, sc->keymap))
                                return i;
-                       if (test_bit(i, sc->sc_keymap) &&
-                           !test_bit(i + 64, sc->sc_keymap))
+                       if (test_bit(i, sc->keymap) &&
+                           !test_bit(i + 64, sc->keymap))
                                return i + 64;
                }
        }
 
        /* No partially used TKIP slots, pick any available slot */
-       for (i = IEEE80211_WEP_NKID; i < sc->sc_keymax; i++) {
+       for (i = IEEE80211_WEP_NKID; i < sc->keymax; i++) {
                /* Do not allow slots that could be needed for TKIP group keys
                 * to be used. This limitation could be removed if we know that
                 * TKIP will not be used. */
                if (i >= 64 && i < 64 + IEEE80211_WEP_NKID)
                        continue;
-               if (sc->sc_splitmic) {
+               if (sc->splitmic) {
                        if (i >= 32 && i < 32 + IEEE80211_WEP_NKID)
                                continue;
                        if (i >= 64 + 32 && i < 64 + 32 + IEEE80211_WEP_NKID)
                                continue;
                }
 
-               if (!test_bit(i, sc->sc_keymap))
+               if (!test_bit(i, sc->keymap))
                        return i; /* Found a free slot for a key */
        }
 
@@ -797,7 +763,7 @@ static int ath_reserve_key_cache_slot(struct ath_softc *sc)
 }
 
 static int ath_key_config(struct ath_softc *sc,
-                         const u8 *addr,
+                         struct ieee80211_sta *sta,
                          struct ieee80211_key_conf *key)
 {
        struct ath9k_keyval hk;
@@ -818,7 +784,7 @@ static int ath_key_config(struct ath_softc *sc,
                hk.kv_type = ATH9K_CIPHER_AES_CCM;
                break;
        default:
-               return -EINVAL;
+               return -EOPNOTSUPP;
        }
 
        hk.kv_len = key->keylen;
@@ -831,8 +797,11 @@ static int ath_key_config(struct ath_softc *sc,
        } else if (key->keyidx) {
                struct ieee80211_vif *vif;
 
-               mac = addr;
-               vif = sc->sc_vaps[0];
+               if (WARN_ON(!sta))
+                       return -EOPNOTSUPP;
+               mac = sta->addr;
+
+               vif = sc->vifs[0];
                if (vif->type != NL80211_IFTYPE_AP) {
                        /* Only keyidx 0 should be used with unicast key, but
                         * allow this for client mode for now. */
@@ -840,13 +809,16 @@ static int ath_key_config(struct ath_softc *sc,
                } else
                        return -EIO;
        } else {
-               mac = addr;
+               if (WARN_ON(!sta))
+                       return -EOPNOTSUPP;
+               mac = sta->addr;
+
                if (key->alg == ALG_TKIP)
                        idx = ath_reserve_key_cache_slot_tkip(sc);
                else
                        idx = ath_reserve_key_cache_slot(sc);
                if (idx < 0)
-                       return -EIO; /* no free key cache entries */
+                       return -ENOSPC; /* no free key cache entries */
        }
 
        if (key->alg == ALG_TKIP)
@@ -857,12 +829,12 @@ static int ath_key_config(struct ath_softc *sc,
        if (!ret)
                return -EIO;
 
-       set_bit(idx, sc->sc_keymap);
+       set_bit(idx, sc->keymap);
        if (key->alg == ALG_TKIP) {
-               set_bit(idx + 64, sc->sc_keymap);
-               if (sc->sc_splitmic) {
-                       set_bit(idx + 32, sc->sc_keymap);
-                       set_bit(idx + 64 + 32, sc->sc_keymap);
+               set_bit(idx + 64, sc->keymap);
+               if (sc->splitmic) {
+                       set_bit(idx + 32, sc->keymap);
+                       set_bit(idx + 64 + 32, sc->keymap);
                }
        }
 
@@ -875,18 +847,19 @@ static void ath_key_delete(struct ath_softc *sc, struct ieee80211_key_conf *key)
        if (key->hw_key_idx < IEEE80211_WEP_NKID)
                return;
 
-       clear_bit(key->hw_key_idx, sc->sc_keymap);
+       clear_bit(key->hw_key_idx, sc->keymap);
        if (key->alg != ALG_TKIP)
                return;
 
-       clear_bit(key->hw_key_idx + 64, sc->sc_keymap);
-       if (sc->sc_splitmic) {
-               clear_bit(key->hw_key_idx + 32, sc->sc_keymap);
-               clear_bit(key->hw_key_idx + 64 + 32, sc->sc_keymap);
+       clear_bit(key->hw_key_idx + 64, sc->keymap);
+       if (sc->splitmic) {
+               clear_bit(key->hw_key_idx + 32, sc->keymap);
+               clear_bit(key->hw_key_idx + 64 + 32, sc->keymap);
        }
 }
 
-static void setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info)
+static void setup_ht_cap(struct ath_softc *sc,
+                        struct ieee80211_sta_ht_cap *ht_info)
 {
 #define        ATH9K_HT_CAP_MAXRXAMPDU_65536 0x3       /* 2 ^ 16 */
 #define        ATH9K_HT_CAP_MPDUDENSITY_8 0x6          /* 8 usec */
@@ -899,10 +872,23 @@ static void setup_ht_cap(struct ieee80211_sta_ht_cap *ht_info)
 
        ht_info->ampdu_factor = ATH9K_HT_CAP_MAXRXAMPDU_65536;
        ht_info->ampdu_density = ATH9K_HT_CAP_MPDUDENSITY_8;
+
        /* set up supported mcs set */
        memset(&ht_info->mcs, 0, sizeof(ht_info->mcs));
-       ht_info->mcs.rx_mask[0] = 0xff;
-       ht_info->mcs.rx_mask[1] = 0xff;
+
+       switch(sc->rx_chainmask) {
+       case 1:
+               ht_info->mcs.rx_mask[0] = 0xff;
+               break;
+       case 3:
+       case 5:
+       case 7:
+       default:
+               ht_info->mcs.rx_mask[0] = 0xff;
+               ht_info->mcs.rx_mask[1] = 0xff;
+               break;
+       }
+
        ht_info->mcs.tx_params = IEEE80211_HT_MCS_TX_DEFINED;
 }
 
@@ -910,17 +896,16 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
                                 struct ieee80211_vif *vif,
                                 struct ieee80211_bss_conf *bss_conf)
 {
-       struct ath_vap *avp = (void *)vif->drv_priv;
+       struct ath_vif *avp = (void *)vif->drv_priv;
 
        if (bss_conf->assoc) {
                DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info ASSOC %d, bssid: %pM\n",
-                       bss_conf->aid, sc->sc_curbssid);
+                       bss_conf->aid, sc->curbssid);
 
                /* New association, store aid */
                if (avp->av_opmode == NL80211_IFTYPE_STATION) {
-                       sc->sc_curaid = bss_conf->aid;
-                       ath9k_hw_write_associd(sc->sc_ah, sc->sc_curbssid,
-                                              sc->sc_curaid);
+                       sc->curaid = bss_conf->aid;
+                       ath9k_hw_write_associd(sc);
                }
 
                /* Configure the beacon */
@@ -928,18 +913,18 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
                sc->sc_flags |= SC_OP_BEACONS;
 
                /* Reset rssi stats */
-               sc->sc_halstats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER;
-               sc->sc_halstats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER;
-               sc->sc_halstats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER;
-               sc->sc_halstats.ns_avgtxrate = ATH_RATE_DUMMY_MARKER;
+               sc->nodestats.ns_avgbrssi = ATH_RSSI_DUMMY_MARKER;
+               sc->nodestats.ns_avgrssi = ATH_RSSI_DUMMY_MARKER;
+               sc->nodestats.ns_avgtxrssi = ATH_RSSI_DUMMY_MARKER;
+               sc->nodestats.ns_avgtxrate = ATH_RATE_DUMMY_MARKER;
 
                /* Start ANI */
-               mod_timer(&sc->sc_ani.timer,
+               mod_timer(&sc->ani.timer,
                        jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
 
        } else {
                DPRINTF(sc, ATH_DBG_CONFIG, "Bss Info DISSOC\n");
-               sc->sc_curaid = 0;
+               sc->curaid = 0;
        }
 }
 
@@ -947,6 +932,32 @@ static void ath9k_bss_assoc_info(struct ath_softc *sc,
 /*      LED functions          */
 /********************************/
 
+static void ath_led_blink_work(struct work_struct *work)
+{
+       struct ath_softc *sc = container_of(work, struct ath_softc,
+                                           ath_led_blink_work.work);
+
+       if (!(sc->sc_flags & SC_OP_LED_ASSOCIATED))
+               return;
+       ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN,
+                         (sc->sc_flags & SC_OP_LED_ON) ? 1 : 0);
+
+       queue_delayed_work(sc->hw->workqueue, &sc->ath_led_blink_work,
+                          (sc->sc_flags & SC_OP_LED_ON) ?
+                          msecs_to_jiffies(sc->led_off_duration) :
+                          msecs_to_jiffies(sc->led_on_duration));
+
+       sc->led_on_duration =
+                       max((ATH_LED_ON_DURATION_IDLE - sc->led_on_cnt), 25);
+       sc->led_off_duration =
+                       max((ATH_LED_OFF_DURATION_IDLE - sc->led_off_cnt), 10);
+       sc->led_on_cnt = sc->led_off_cnt = 0;
+       if (sc->sc_flags & SC_OP_LED_ON)
+               sc->sc_flags &= ~SC_OP_LED_ON;
+       else
+               sc->sc_flags |= SC_OP_LED_ON;
+}
+
 static void ath_led_brightness(struct led_classdev *led_cdev,
                               enum led_brightness brightness)
 {
@@ -956,16 +967,27 @@ static void ath_led_brightness(struct led_classdev *led_cdev,
        switch (brightness) {
        case LED_OFF:
                if (led->led_type == ATH_LED_ASSOC ||
-                   led->led_type == ATH_LED_RADIO)
+                   led->led_type == ATH_LED_RADIO) {
+                       ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN,
+                               (led->led_type == ATH_LED_RADIO));
                        sc->sc_flags &= ~SC_OP_LED_ASSOCIATED;
-               ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN,
-                               (led->led_type == ATH_LED_RADIO) ? 1 :
-                               !!(sc->sc_flags & SC_OP_LED_ASSOCIATED));
+                       if (led->led_type == ATH_LED_RADIO)
+                               sc->sc_flags &= ~SC_OP_LED_ON;
+               } else {
+                       sc->led_off_cnt++;
+               }
                break;
        case LED_FULL:
-               if (led->led_type == ATH_LED_ASSOC)
+               if (led->led_type == ATH_LED_ASSOC) {
                        sc->sc_flags |= SC_OP_LED_ASSOCIATED;
-               ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0);
+                       queue_delayed_work(sc->hw->workqueue,
+                                          &sc->ath_led_blink_work, 0);
+               } else if (led->led_type == ATH_LED_RADIO) {
+                       ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 0);
+                       sc->sc_flags |= SC_OP_LED_ON;
+               } else {
+                       sc->led_on_cnt++;
+               }
                break;
        default:
                break;
@@ -1001,6 +1023,7 @@ static void ath_unregister_led(struct ath_led *led)
 
 static void ath_deinit_leds(struct ath_softc *sc)
 {
+       cancel_delayed_work_sync(&sc->ath_led_blink_work);
        ath_unregister_led(&sc->assoc_led);
        sc->sc_flags &= ~SC_OP_LED_ASSOCIATED;
        ath_unregister_led(&sc->tx_led);
@@ -1020,9 +1043,11 @@ static void ath_init_leds(struct ath_softc *sc)
        /* LED off, active low */
        ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1);
 
+       INIT_DELAYED_WORK(&sc->ath_led_blink_work, ath_led_blink_work);
+
        trigger = ieee80211_get_radio_led_name(sc->hw);
        snprintf(sc->radio_led.name, sizeof(sc->radio_led.name),
-               "ath9k-%s:radio", wiphy_name(sc->hw->wiphy));
+               "ath9k-%s::radio", wiphy_name(sc->hw->wiphy));
        ret = ath_register_led(sc, &sc->radio_led, trigger);
        sc->radio_led.led_type = ATH_LED_RADIO;
        if (ret)
@@ -1030,7 +1055,7 @@ static void ath_init_leds(struct ath_softc *sc)
 
        trigger = ieee80211_get_assoc_led_name(sc->hw);
        snprintf(sc->assoc_led.name, sizeof(sc->assoc_led.name),
-               "ath9k-%s:assoc", wiphy_name(sc->hw->wiphy));
+               "ath9k-%s::assoc", wiphy_name(sc->hw->wiphy));
        ret = ath_register_led(sc, &sc->assoc_led, trigger);
        sc->assoc_led.led_type = ATH_LED_ASSOC;
        if (ret)
@@ -1038,7 +1063,7 @@ static void ath_init_leds(struct ath_softc *sc)
 
        trigger = ieee80211_get_tx_led_name(sc->hw);
        snprintf(sc->tx_led.name, sizeof(sc->tx_led.name),
-               "ath9k-%s:tx", wiphy_name(sc->hw->wiphy));
+               "ath9k-%s::tx", wiphy_name(sc->hw->wiphy));
        ret = ath_register_led(sc, &sc->tx_led, trigger);
        sc->tx_led.led_type = ATH_LED_TX;
        if (ret)
@@ -1046,7 +1071,7 @@ static void ath_init_leds(struct ath_softc *sc)
 
        trigger = ieee80211_get_rx_led_name(sc->hw);
        snprintf(sc->rx_led.name, sizeof(sc->rx_led.name),
-               "ath9k-%s:rx", wiphy_name(sc->hw->wiphy));
+               "ath9k-%s::rx", wiphy_name(sc->hw->wiphy));
        ret = ath_register_led(sc, &sc->rx_led, trigger);
        sc->rx_led.led_type = ATH_LED_RX;
        if (ret)
@@ -1066,24 +1091,20 @@ fail:
 
 static void ath_radio_enable(struct ath_softc *sc)
 {
-       struct ath_hal *ah = sc->sc_ah;
-       int status;
+       struct ath_hw *ah = sc->sc_ah;
+       struct ieee80211_channel *channel = sc->hw->conf.channel;
+       int r;
 
+       ath9k_ps_wakeup(sc);
        spin_lock_bh(&sc->sc_resetlock);
-       if (!ath9k_hw_reset(ah, ah->ah_curchan,
-                           sc->tx_chan_width,
-                           sc->sc_tx_chainmask,
-                           sc->sc_rx_chainmask,
-                           sc->sc_ht_extprotspacing,
-                           false, &status)) {
+
+       r = ath9k_hw_reset(ah, ah->curchan, false);
+
+       if (r) {
                DPRINTF(sc, ATH_DBG_FATAL,
-                       "Unable to reset channel %u (%uMhz) "
-                       "flags 0x%x hal status %u\n",
-                       ath9k_hw_mhz2ieee(ah,
-                                         ah->ah_curchan->channel,
-                                         ah->ah_curchan->channelFlags),
-                       ah->ah_curchan->channel,
-                       ah->ah_curchan->channelFlags, status);
+                       "Unable to reset channel %u (%uMhz) ",
+                       "reset status %u\n",
+                       channel->center_freq, r);
        }
        spin_unlock_bh(&sc->sc_resetlock);
 
@@ -1098,7 +1119,7 @@ static void ath_radio_enable(struct ath_softc *sc)
                ath_beacon_config(sc, ATH_IF_ID_ANY);   /* restart beacons */
 
        /* Re-Enable  interrupts */
-       ath9k_hw_set_interrupts(ah, sc->sc_imask);
+       ath9k_hw_set_interrupts(ah, sc->imask);
 
        /* Enable LED */
        ath9k_hw_cfg_output(ah, ATH_LED_PIN,
@@ -1106,14 +1127,16 @@ static void ath_radio_enable(struct ath_softc *sc)
        ath9k_hw_set_gpio(ah, ATH_LED_PIN, 0);
 
        ieee80211_wake_queues(sc->hw);
+       ath9k_ps_restore(sc);
 }
 
 static void ath_radio_disable(struct ath_softc *sc)
 {
-       struct ath_hal *ah = sc->sc_ah;
-       int status;
-
+       struct ath_hw *ah = sc->sc_ah;
+       struct ieee80211_channel *channel = sc->hw->conf.channel;
+       int r;
 
+       ath9k_ps_wakeup(sc);
        ieee80211_stop_queues(sc->hw);
 
        /* Disable LED */
@@ -1123,38 +1146,31 @@ static void ath_radio_disable(struct ath_softc *sc)
        /* Disable interrupts */
        ath9k_hw_set_interrupts(ah, 0);
 
-       ath_draintxq(sc, false);        /* clear pending tx frames */
+       ath_drain_all_txq(sc, false);   /* clear pending tx frames */
        ath_stoprecv(sc);               /* turn off frame recv */
        ath_flushrecv(sc);              /* flush recv queue */
 
        spin_lock_bh(&sc->sc_resetlock);
-       if (!ath9k_hw_reset(ah, ah->ah_curchan,
-                           sc->tx_chan_width,
-                           sc->sc_tx_chainmask,
-                           sc->sc_rx_chainmask,
-                           sc->sc_ht_extprotspacing,
-                           false, &status)) {
+       r = ath9k_hw_reset(ah, ah->curchan, false);
+       if (r) {
                DPRINTF(sc, ATH_DBG_FATAL,
                        "Unable to reset channel %u (%uMhz) "
-                       "flags 0x%x hal status %u\n",
-                       ath9k_hw_mhz2ieee(ah,
-                               ah->ah_curchan->channel,
-                               ah->ah_curchan->channelFlags),
-                       ah->ah_curchan->channel,
-                       ah->ah_curchan->channelFlags, status);
+                       "reset status %u\n",
+                       channel->center_freq, r);
        }
        spin_unlock_bh(&sc->sc_resetlock);
 
        ath9k_hw_phy_disable(ah);
        ath9k_hw_setpower(ah, ATH9K_PM_FULL_SLEEP);
+       ath9k_ps_restore(sc);
 }
 
 static bool ath_is_rfkill_set(struct ath_softc *sc)
 {
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
 
-       return ath9k_hw_gpio_get(ah, ah->ah_rfkill_gpio) ==
-                                 ah->ah_rfkill_polarity;
+       return ath9k_hw_gpio_get(ah, ah->rfkill_gpio) ==
+                                 ah->rfkill_polarity;
 }
 
 /* h/w rfkill poll function */
@@ -1238,7 +1254,7 @@ static int ath_init_sw_rfkill(struct ath_softc *sc)
        }
 
        snprintf(sc->rf_kill.rfkill_name, sizeof(sc->rf_kill.rfkill_name),
-               "ath9k-%s:rfkill", wiphy_name(sc->hw->wiphy));
+               "ath9k-%s::rfkill", wiphy_name(sc->hw->wiphy));
        sc->rf_kill.rfkill->name = sc->rf_kill.rfkill_name;
        sc->rf_kill.rfkill->data = sc;
        sc->rf_kill.rfkill->toggle_radio = ath_sw_toggle_radio;
@@ -1251,7 +1267,7 @@ static int ath_init_sw_rfkill(struct ath_softc *sc)
 /* Deinitialize rfkill */
 static void ath_deinit_rfkill(struct ath_softc *sc)
 {
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
                cancel_delayed_work_sync(&sc->rf_kill.rfkill_poll);
 
        if (sc->sc_flags & SC_OP_RFKILL_REGISTERED) {
@@ -1263,7 +1279,7 @@ static void ath_deinit_rfkill(struct ath_softc *sc)
 
 static int ath_start_rfkill_poll(struct ath_softc *sc)
 {
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
                queue_delayed_work(sc->hw->workqueue,
                                   &sc->rf_kill.rfkill_poll, 0);
 
@@ -1274,13 +1290,7 @@ static int ath_start_rfkill_poll(struct ath_softc *sc)
                        rfkill_free(sc->rf_kill.rfkill);
 
                        /* Deinitialize the device */
-                       ath_detach(sc);
-                       if (sc->pdev->irq)
-                               free_irq(sc->pdev->irq, sc);
-                       pci_iounmap(sc->pdev, sc->mem);
-                       pci_release_region(sc->pdev, 0);
-                       pci_disable_device(sc->pdev);
-                       ieee80211_free_hw(sc->hw);
+                       ath_cleanup(sc);
                        return -EIO;
                } else {
                        sc->sc_flags |= SC_OP_RFKILL_REGISTERED;
@@ -1291,11 +1301,21 @@ static int ath_start_rfkill_poll(struct ath_softc *sc)
 }
 #endif /* CONFIG_RFKILL */
 
-static void ath_detach(struct ath_softc *sc)
+void ath_cleanup(struct ath_softc *sc)
+{
+       ath_detach(sc);
+       free_irq(sc->irq, sc);
+       ath_bus_cleanup(sc);
+       ieee80211_free_hw(sc->hw);
+}
+
+void ath_detach(struct ath_softc *sc)
 {
        struct ieee80211_hw *hw = sc->hw;
        int i = 0;
 
+       ath9k_ps_wakeup(sc);
+
        DPRINTF(sc, ATH_DBG_CONFIG, "Detach ATH hw\n");
 
 #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
@@ -1320,11 +1340,12 @@ static void ath_detach(struct ath_softc *sc)
 
        ath9k_hw_detach(sc->sc_ah);
        ath9k_exit_debug(sc);
+       ath9k_ps_restore(sc);
 }
 
 static int ath_init(u16 devid, struct ath_softc *sc)
 {
-       struct ath_hal *ah = NULL;
+       struct ath_hw *ah = NULL;
        int status;
        int error = 0, i;
        int csz = 0;
@@ -1345,44 +1366,40 @@ static int ath_init(u16 devid, struct ath_softc *sc)
         * Cache line size is used to size and align various
         * structures used to communicate with the hardware.
         */
-       bus_read_cachesize(sc, &csz);
+       ath_read_cachesize(sc, &csz);
        /* XXX assert csz is non-zero */
-       sc->sc_cachelsz = csz << 2;     /* convert to bytes */
+       sc->cachelsz = csz << 2;        /* convert to bytes */
 
-       ah = ath9k_hw_attach(devid, sc, sc->mem, &status);
+       ah = ath9k_hw_attach(devid, sc, &status);
        if (ah == NULL) {
                DPRINTF(sc, ATH_DBG_FATAL,
-                       "Unable to attach hardware; HAL status %u\n", status);
+                       "Unable to attach hardware; HAL status %d\n", status);
                error = -ENXIO;
                goto bad;
        }
        sc->sc_ah = ah;
 
        /* Get the hardware key cache size. */
-       sc->sc_keymax = ah->ah_caps.keycache_size;
-       if (sc->sc_keymax > ATH_KEYMAX) {
+       sc->keymax = ah->caps.keycache_size;
+       if (sc->keymax > ATH_KEYMAX) {
                DPRINTF(sc, ATH_DBG_KEYCACHE,
                        "Warning, using only %u entries in %u key cache\n",
-                       ATH_KEYMAX, sc->sc_keymax);
-               sc->sc_keymax = ATH_KEYMAX;
+                       ATH_KEYMAX, sc->keymax);
+               sc->keymax = ATH_KEYMAX;
        }
 
        /*
         * Reset the key cache since some parts do not
         * reset the contents on initial power up.
         */
-       for (i = 0; i < sc->sc_keymax; i++)
+       for (i = 0; i < sc->keymax; i++)
                ath9k_hw_keyreset(ah, (u16) i);
 
-       /* Collect the channel list using the default country code */
-
-       error = ath_setup_channels(sc);
-       if (error)
+       if (ath9k_regd_init(sc->sc_ah))
                goto bad;
 
        /* default to MONITOR mode */
-       sc->sc_ah->ah_opmode = NL80211_IFTYPE_MONITOR;
-
+       sc->sc_ah->opmode = NL80211_IFTYPE_MONITOR;
 
        /* Setup rate tables */
 
@@ -1411,7 +1428,7 @@ static int ath_init(u16 devid, struct ath_softc *sc)
                goto bad2;
        }
 
-       sc->sc_config.cabqReadytime = ATH_CABQ_READY_TIME;
+       sc->config.cabqReadytime = ATH_CABQ_READY_TIME;
        ath_cabq_update(sc);
 
        for (i = 0; i < ARRAY_SIZE(sc->tx.hwq_map); i++)
@@ -1448,8 +1465,8 @@ static int ath_init(u16 devid, struct ath_softc *sc)
        /* Initializes the noise floor to a reasonable default value.
         * Later on this will be updated during ANI processing. */
 
-       sc->sc_ani.sc_noise_floor = ATH_DEFAULT_NOISE_FLOOR;
-       setup_timer(&sc->sc_ani.timer, ath_ani_calibrate, (unsigned long)sc);
+       sc->ani.noise_floor = ATH_DEFAULT_NOISE_FLOOR;
+       setup_timer(&sc->ani.timer, ath_ani_calibrate, (unsigned long)sc);
 
        if (ath9k_hw_getcapability(ah, ATH9K_CAP_CIPHER,
                                   ATH9K_CIPHER_TKIP, NULL)) {
@@ -1475,33 +1492,31 @@ static int ath_init(u16 devid, struct ath_softc *sc)
                                      ATH9K_CIPHER_MIC, NULL)
            && ath9k_hw_getcapability(ah, ATH9K_CAP_TKIP_SPLIT,
                                      0, NULL))
-               sc->sc_splitmic = 1;
+               sc->splitmic = 1;
 
        /* turn on mcast key search if possible */
        if (!ath9k_hw_getcapability(ah, ATH9K_CAP_MCAST_KEYSRCH, 0, NULL))
                (void)ath9k_hw_setcapability(ah, ATH9K_CAP_MCAST_KEYSRCH, 1,
                                             1, NULL);
 
-       sc->sc_config.txpowlimit = ATH_TXPOWER_MAX;
-       sc->sc_config.txpowlimit_override = 0;
+       sc->config.txpowlimit = ATH_TXPOWER_MAX;
 
        /* 11n Capabilities */
-       if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) {
+       if (ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
                sc->sc_flags |= SC_OP_TXAGGR;
                sc->sc_flags |= SC_OP_RXAGGR;
        }
 
-       sc->sc_tx_chainmask = ah->ah_caps.tx_chainmask;
-       sc->sc_rx_chainmask = ah->ah_caps.rx_chainmask;
+       sc->tx_chainmask = ah->caps.tx_chainmask;
+       sc->rx_chainmask = ah->caps.rx_chainmask;
 
        ath9k_hw_setcapability(ah, ATH9K_CAP_DIVERSITY, 1, true, NULL);
        sc->rx.defant = ath9k_hw_getdefantenna(ah);
 
-       ath9k_hw_getmac(ah, sc->sc_myaddr);
-       if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) {
-               ath9k_hw_getbssidmask(ah, sc->sc_bssidmask);
-               ATH_SET_VAP_BSSID_MASK(sc->sc_bssidmask);
-               ath9k_hw_setbssidmask(ah, sc->sc_bssidmask);
+       if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK) {
+               memcpy(sc->bssidmask, ath_bcast_mac, ETH_ALEN);
+               ATH_SET_VIF_BSSID_MASK(sc->bssidmask);
+               ath9k_hw_setbssidmask(sc);
        }
 
        sc->beacon.slottime = ATH9K_SLOT_TIME_9;        /* default to short slot time */
@@ -1511,24 +1526,29 @@ static int ath_init(u16 devid, struct ath_softc *sc)
                sc->beacon.bslot[i] = ATH_IF_ID_ANY;
 
        /* save MISC configurations */
-       sc->sc_config.swBeaconProcess = 1;
+       sc->config.swBeaconProcess = 1;
 
        /* setup channels and rates */
 
-       sc->sbands[IEEE80211_BAND_2GHZ].channels =
-               sc->channels[IEEE80211_BAND_2GHZ];
+       sc->sbands[IEEE80211_BAND_2GHZ].channels = ath9k_2ghz_chantable;
        sc->sbands[IEEE80211_BAND_2GHZ].bitrates =
                sc->rates[IEEE80211_BAND_2GHZ];
        sc->sbands[IEEE80211_BAND_2GHZ].band = IEEE80211_BAND_2GHZ;
+       sc->sbands[IEEE80211_BAND_2GHZ].n_channels =
+               ARRAY_SIZE(ath9k_2ghz_chantable);
 
-       if (test_bit(ATH9K_MODE_11A, sc->sc_ah->ah_caps.wireless_modes)) {
-               sc->sbands[IEEE80211_BAND_5GHZ].channels =
-                       sc->channels[IEEE80211_BAND_5GHZ];
+       if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes)) {
+               sc->sbands[IEEE80211_BAND_5GHZ].channels = ath9k_5ghz_chantable;
                sc->sbands[IEEE80211_BAND_5GHZ].bitrates =
                        sc->rates[IEEE80211_BAND_5GHZ];
                sc->sbands[IEEE80211_BAND_5GHZ].band = IEEE80211_BAND_5GHZ;
+               sc->sbands[IEEE80211_BAND_5GHZ].n_channels =
+                       ARRAY_SIZE(ath9k_5ghz_chantable);
        }
 
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_BT_COEX)
+               ath9k_hw_btcoex_enable(sc->sc_ah);
+
        return 0;
 bad2:
        /* cleanup tx queues */
@@ -1542,7 +1562,7 @@ bad:
        return error;
 }
 
-static int ath_attach(u16 devid, struct ath_softc *sc)
+int ath_attach(u16 devid, struct ath_softc *sc)
 {
        struct ieee80211_hw *hw = sc->hw;
        int error = 0;
@@ -1555,34 +1575,42 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
 
        /* get mac address from hardware and set in mac80211 */
 
-       SET_IEEE80211_PERM_ADDR(hw, sc->sc_myaddr);
+       SET_IEEE80211_PERM_ADDR(hw, sc->sc_ah->macaddr);
 
        hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
                IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
                IEEE80211_HW_SIGNAL_DBM |
-               IEEE80211_HW_AMPDU_AGGREGATION;
+               IEEE80211_HW_AMPDU_AGGREGATION |
+               IEEE80211_HW_SUPPORTS_PS |
+               IEEE80211_HW_PS_NULLFUNC_STACK;
+
+       if (AR_SREV_9160_10_OR_LATER(sc->sc_ah))
+               hw->flags |= IEEE80211_HW_MFP_CAPABLE;
 
        hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_AP) |
                BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_ADHOC);
 
+       hw->wiphy->reg_notifier = ath9k_reg_notifier;
+       hw->wiphy->strict_regulatory = true;
+
        hw->queues = 4;
        hw->max_rates = 4;
        hw->max_rate_tries = ATH_11N_TXMAXTRY;
        hw->sta_data_size = sizeof(struct ath_node);
-       hw->vif_data_size = sizeof(struct ath_vap);
+       hw->vif_data_size = sizeof(struct ath_vif);
 
        hw->rate_control_algorithm = "ath9k_rate_control";
 
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) {
-               setup_ht_cap(&sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
-               if (test_bit(ATH9K_MODE_11A, sc->sc_ah->ah_caps.wireless_modes))
-                       setup_ht_cap(&sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT) {
+               setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_2GHZ].ht_cap);
+               if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
+                       setup_ht_cap(sc, &sc->sbands[IEEE80211_BAND_5GHZ].ht_cap);
        }
 
        hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &sc->sbands[IEEE80211_BAND_2GHZ];
-       if (test_bit(ATH9K_MODE_11A, sc->sc_ah->ah_caps.wireless_modes))
+       if (test_bit(ATH9K_MODE_11A, sc->sc_ah->caps.wireless_modes))
                hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
                        &sc->sbands[IEEE80211_BAND_5GHZ];
 
@@ -1597,7 +1625,7 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
 
 #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
        /* Initialze h/w Rfkill */
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
                INIT_DELAYED_WORK(&sc->rf_kill.rfkill_poll, ath_rfkill_poll);
 
        /* Initialize s/w rfkill */
@@ -1605,11 +1633,36 @@ static int ath_attach(u16 devid, struct ath_softc *sc)
                goto detach;
 #endif
 
+       if (ath9k_is_world_regd(sc->sc_ah)) {
+               /* Anything applied here (prior to wiphy registratoin) gets
+                * saved on the wiphy orig_* parameters */
+               const struct ieee80211_regdomain *regd =
+                       ath9k_world_regdomain(sc->sc_ah);
+               hw->wiphy->custom_regulatory = true;
+               hw->wiphy->strict_regulatory = false;
+               wiphy_apply_custom_regulatory(sc->hw->wiphy, regd);
+               ath9k_reg_apply_radar_flags(hw->wiphy);
+               ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
+       } else {
+               /* This gets applied in the case of the absense of CRDA,
+                * its our own custom world regulatory domain, similar to
+                * cfg80211's but we enable passive scanning */
+               const struct ieee80211_regdomain *regd =
+                       ath9k_default_world_regdomain();
+               wiphy_apply_custom_regulatory(sc->hw->wiphy, regd);
+               ath9k_reg_apply_radar_flags(hw->wiphy);
+               ath9k_reg_apply_world_flags(hw->wiphy, REGDOM_SET_BY_INIT);
+       }
+
        error = ieee80211_register_hw(hw);
 
+       if (!ath9k_is_world_regd(sc->sc_ah))
+               regulatory_hint(hw->wiphy, sc->sc_ah->regulatory.alpha2);
+
        /* Initialize LED control */
        ath_init_leds(sc);
 
+
        return 0;
 detach:
        ath_detach(sc);
@@ -1618,24 +1671,20 @@ detach:
 
 int ath_reset(struct ath_softc *sc, bool retry_tx)
 {
-       struct ath_hal *ah = sc->sc_ah;
-       int status;
-       int error = 0;
+       struct ath_hw *ah = sc->sc_ah;
+       struct ieee80211_hw *hw = sc->hw;
+       int r;
 
        ath9k_hw_set_interrupts(ah, 0);
-       ath_draintxq(sc, retry_tx);
+       ath_drain_all_txq(sc, retry_tx);
        ath_stoprecv(sc);
        ath_flushrecv(sc);
 
        spin_lock_bh(&sc->sc_resetlock);
-       if (!ath9k_hw_reset(ah, sc->sc_ah->ah_curchan,
-                           sc->tx_chan_width,
-                           sc->sc_tx_chainmask, sc->sc_rx_chainmask,
-                           sc->sc_ht_extprotspacing, false, &status)) {
+       r = ath9k_hw_reset(ah, sc->sc_ah->curchan, false);
+       if (r)
                DPRINTF(sc, ATH_DBG_FATAL,
-                       "Unable to reset hardware; hal status %u\n", status);
-               error = -EIO;
-       }
+                       "Unable to reset hardware; reset status %u\n", r);
        spin_unlock_bh(&sc->sc_resetlock);
 
        if (ath_startrecv(sc) != 0)
@@ -1646,14 +1695,14 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
         * that changes the channel so update any state that
         * might change as a result.
         */
-       ath_setcurmode(sc, ath_chan2mode(sc->sc_ah->ah_curchan));
+       ath_cache_conf_rate(sc, &hw->conf);
 
        ath_update_txpow(sc);
 
        if (sc->sc_flags & SC_OP_BEACONS)
                ath_beacon_config(sc, ATH_IF_ID_ANY);   /* restart beacons */
 
-       ath9k_hw_set_interrupts(ah, sc->sc_imask);
+       ath9k_hw_set_interrupts(ah, sc->imask);
 
        if (retry_tx) {
                int i;
@@ -1666,7 +1715,7 @@ int ath_reset(struct ath_softc *sc, bool retry_tx)
                }
        }
 
-       return error;
+       return r;
 }
 
 /*
@@ -1706,7 +1755,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
         * descriptors that cross the 4K page boundary. Assume
         * one skipped descriptor per 4K page.
         */
-       if (!(sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_4KB_SPLITTRANS)) {
+       if (!(sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_4KB_SPLITTRANS)) {
                u32 ndesc_skipped =
                        ATH_DESC_4KB_BOUND_NUM_SKIPPED(dd->dd_desc_len);
                u32 dma_len;
@@ -1720,9 +1769,8 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
        }
 
        /* allocate descriptors */
-       dd->dd_desc = pci_alloc_consistent(sc->pdev,
-                             dd->dd_desc_len,
-                             &dd->dd_desc_paddr);
+       dd->dd_desc = dma_alloc_coherent(sc->dev, dd->dd_desc_len,
+                                        &dd->dd_desc_paddr, GFP_ATOMIC);
        if (dd->dd_desc == NULL) {
                error = -ENOMEM;
                goto fail;
@@ -1747,7 +1795,7 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
                bf->bf_desc = ds;
                bf->bf_daddr = DS2PHYS(dd, ds);
 
-               if (!(sc->sc_ah->ah_caps.hw_caps &
+               if (!(sc->sc_ah->caps.hw_caps &
                      ATH9K_HW_CAP_4KB_SPLITTRANS)) {
                        /*
                         * Skip descriptor addresses which can cause 4KB
@@ -1768,8 +1816,8 @@ int ath_descdma_setup(struct ath_softc *sc, struct ath_descdma *dd,
        }
        return 0;
 fail2:
-       pci_free_consistent(sc->pdev,
-               dd->dd_desc_len, dd->dd_desc, dd->dd_desc_paddr);
+       dma_free_coherent(sc->dev, dd->dd_desc_len, dd->dd_desc,
+                         dd->dd_desc_paddr);
 fail:
        memset(dd, 0, sizeof(*dd));
        return error;
@@ -1782,8 +1830,8 @@ void ath_descdma_cleanup(struct ath_softc *sc,
                         struct ath_descdma *dd,
                         struct list_head *head)
 {
-       pci_free_consistent(sc->pdev,
-               dd->dd_desc_len, dd->dd_desc, dd->dd_desc_paddr);
+       dma_free_coherent(sc->dev, dd->dd_desc_len, dd->dd_desc,
+                         dd->dd_desc_paddr);
 
        INIT_LIST_HEAD(head);
        kfree(dd->dd_bufptr);
@@ -1840,6 +1888,37 @@ int ath_get_mac80211_qnum(u32 queue, struct ath_softc *sc)
        return qnum;
 }
 
+/* XXX: Remove me once we don't depend on ath9k_channel for all
+ * this redundant data */
+static void ath9k_update_ichannel(struct ath_softc *sc,
+                         struct ath9k_channel *ichan)
+{
+       struct ieee80211_hw *hw = sc->hw;
+       struct ieee80211_channel *chan = hw->conf.channel;
+       struct ieee80211_conf *conf = &hw->conf;
+
+       ichan->channel = chan->center_freq;
+       ichan->chan = chan;
+
+       if (chan->band == IEEE80211_BAND_2GHZ) {
+               ichan->chanmode = CHANNEL_G;
+               ichan->channelFlags = CHANNEL_2GHZ | CHANNEL_OFDM;
+       } else {
+               ichan->chanmode = CHANNEL_A;
+               ichan->channelFlags = CHANNEL_5GHZ | CHANNEL_OFDM;
+       }
+
+       sc->tx_chan_width = ATH9K_HT_MACMODE_20;
+
+       if (conf_is_ht(conf)) {
+               if (conf_is_ht40(conf))
+                       sc->tx_chan_width = ATH9K_HT_MACMODE_2040;
+
+               ichan->chanmode = ath_get_extchanmode(sc, chan,
+                                           conf->channel_type);
+       }
+}
+
 /**********************/
 /* mac80211 callbacks */
 /**********************/
@@ -1849,24 +1928,19 @@ static int ath9k_start(struct ieee80211_hw *hw)
        struct ath_softc *sc = hw->priv;
        struct ieee80211_channel *curchan = hw->conf.channel;
        struct ath9k_channel *init_channel;
-       int error = 0, pos, status;
+       int r, pos;
 
        DPRINTF(sc, ATH_DBG_CONFIG, "Starting driver with "
                "initial channel: %d MHz\n", curchan->center_freq);
 
+       mutex_lock(&sc->mutex);
+
        /* setup initial channel */
 
-       pos = ath_get_channel(sc, curchan);
-       if (pos == -1) {
-               DPRINTF(sc, ATH_DBG_FATAL, "Invalid channel: %d\n", curchan->center_freq);
-               error = -EINVAL;
-               goto error;
-       }
+       pos = curchan->hw_value;
 
-       sc->tx_chan_width = ATH9K_HT_MACMODE_20;
-       sc->sc_ah->ah_channels[pos].chanmode =
-               (curchan->band == IEEE80211_BAND_2GHZ) ? CHANNEL_G : CHANNEL_A;
-       init_channel = &sc->sc_ah->ah_channels[pos];
+       init_channel = &sc->sc_ah->channels[pos];
+       ath9k_update_ichannel(sc, init_channel);
 
        /* Reset SERDES registers */
        ath9k_hw_configpcipowersave(sc->sc_ah, 0);
@@ -1879,17 +1953,14 @@ static int ath9k_start(struct ieee80211_hw *hw)
         * and then setup of the interrupt mask.
         */
        spin_lock_bh(&sc->sc_resetlock);
-       if (!ath9k_hw_reset(sc->sc_ah, init_channel,
-                           sc->tx_chan_width,
-                           sc->sc_tx_chainmask, sc->sc_rx_chainmask,
-                           sc->sc_ht_extprotspacing, false, &status)) {
+       r = ath9k_hw_reset(sc->sc_ah, init_channel, false);
+       if (r) {
                DPRINTF(sc, ATH_DBG_FATAL,
-                       "Unable to reset hardware; hal status %u "
-                       "(freq %u flags 0x%x)\n", status,
-                       init_channel->channel, init_channel->channelFlags);
-               error = -EIO;
+                       "Unable to reset hardware; reset status %u "
+                       "(freq %u MHz)\n", r,
+                       curchan->center_freq);
                spin_unlock_bh(&sc->sc_resetlock);
-               goto error;
+               goto mutex_unlock;
        }
        spin_unlock_bh(&sc->sc_resetlock);
 
@@ -1909,56 +1980,39 @@ static int ath9k_start(struct ieee80211_hw *hw)
        if (ath_startrecv(sc) != 0) {
                DPRINTF(sc, ATH_DBG_FATAL,
                        "Unable to start recv logic\n");
-               error = -EIO;
-               goto error;
+               r = -EIO;
+               goto mutex_unlock;
        }
 
        /* Setup our intr mask. */
-       sc->sc_imask = ATH9K_INT_RX | ATH9K_INT_TX
+       sc->imask = ATH9K_INT_RX | ATH9K_INT_TX
                | ATH9K_INT_RXEOL | ATH9K_INT_RXORN
                | ATH9K_INT_FATAL | ATH9K_INT_GLOBAL;
 
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_GTT)
-               sc->sc_imask |= ATH9K_INT_GTT;
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_GTT)
+               sc->imask |= ATH9K_INT_GTT;
 
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT)
-               sc->sc_imask |= ATH9K_INT_CST;
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
+               sc->imask |= ATH9K_INT_CST;
 
-       /*
-        * Enable MIB interrupts when there are hardware phy counters.
-        * Note we only do this (at the moment) for station mode.
-        */
-       if (ath9k_hw_phycounters(sc->sc_ah) &&
-           ((sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) ||
-            (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC)))
-               sc->sc_imask |= ATH9K_INT_MIB;
-       /*
-        * Some hardware processes the TIM IE and fires an
-        * interrupt when the TIM bit is set.  For hardware
-        * that does, if not overridden by configuration,
-        * enable the TIM interrupt when operating as station.
-        */
-       if ((sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_ENHANCEDPM) &&
-           (sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) &&
-           !sc->sc_config.swBeaconProcess)
-               sc->sc_imask |= ATH9K_INT_TIM;
-
-       ath_setcurmode(sc, ath_chan2mode(init_channel));
+       ath_cache_conf_rate(sc, &hw->conf);
 
        sc->sc_flags &= ~SC_OP_INVALID;
 
        /* Disable BMISS interrupt when we're not associated */
-       sc->sc_imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
-       ath9k_hw_set_interrupts(sc->sc_ah, sc->sc_imask);
+       sc->imask &= ~(ATH9K_INT_SWBA | ATH9K_INT_BMISS);
+       ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);
 
        ieee80211_wake_queues(sc->hw);
 
 #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-       error = ath_start_rfkill_poll(sc);
+       r = ath_start_rfkill_poll(sc);
 #endif
 
-error:
-       return error;
+mutex_unlock:
+       mutex_unlock(&sc->mutex);
+
+       return r;
 }
 
 static int ath9k_tx(struct ieee80211_hw *hw,
@@ -2022,7 +2076,7 @@ static void ath9k_stop(struct ieee80211_hw *hw)
                return;
        }
 
-       DPRINTF(sc, ATH_DBG_CONFIG, "Cleaning up\n");
+       mutex_lock(&sc->mutex);
 
        ieee80211_stop_queues(sc->hw);
 
@@ -2031,14 +2085,14 @@ static void ath9k_stop(struct ieee80211_hw *hw)
        ath9k_hw_set_interrupts(sc->sc_ah, 0);
 
        if (!(sc->sc_flags & SC_OP_INVALID)) {
-               ath_draintxq(sc, false);
+               ath_drain_all_txq(sc, false);
                ath_stoprecv(sc);
                ath9k_hw_phy_disable(sc->sc_ah);
        } else
                sc->rx.rxlink = NULL;
 
 #if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
                cancel_delayed_work_sync(&sc->rf_kill.rfkill_poll);
 #endif
        /* disable HAL and put h/w to sleep */
@@ -2047,6 +2101,8 @@ static void ath9k_stop(struct ieee80211_hw *hw)
 
        sc->sc_flags |= SC_OP_INVALID;
 
+       mutex_unlock(&sc->mutex);
+
        DPRINTF(sc, ATH_DBG_CONFIG, "Driver halt\n");
 }
 
@@ -2054,14 +2110,16 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
                               struct ieee80211_if_init_conf *conf)
 {
        struct ath_softc *sc = hw->priv;
-       struct ath_vap *avp = (void *)conf->vif->drv_priv;
+       struct ath_vif *avp = (void *)conf->vif->drv_priv;
        enum nl80211_iftype ic_opmode = NL80211_IFTYPE_UNSPECIFIED;
 
-       /* Support only vap for now */
+       /* Support only vif for now */
 
-       if (sc->sc_nvaps)
+       if (sc->nvifs)
                return -ENOBUFS;
 
+       mutex_lock(&sc->mutex);
+
        switch (conf->type) {
        case NL80211_IFTYPE_STATION:
                ic_opmode = NL80211_IFTYPE_STATION;
@@ -2078,28 +2136,51 @@ static int ath9k_add_interface(struct ieee80211_hw *hw,
                return -EOPNOTSUPP;
        }
 
-       DPRINTF(sc, ATH_DBG_CONFIG, "Attach a VAP of type: %d\n", ic_opmode);
+       DPRINTF(sc, ATH_DBG_CONFIG, "Attach a VIF of type: %d\n", ic_opmode);
 
-       /* Set the VAP opmode */
+       /* Set the VIF opmode */
        avp->av_opmode = ic_opmode;
        avp->av_bslot = -1;
 
        if (ic_opmode == NL80211_IFTYPE_AP)
                ath9k_hw_set_tsfadjust(sc->sc_ah, 1);
 
-       sc->sc_vaps[0] = conf->vif;
-       sc->sc_nvaps++;
+       sc->vifs[0] = conf->vif;
+       sc->nvifs++;
 
        /* Set the device opmode */
-       sc->sc_ah->ah_opmode = ic_opmode;
+       sc->sc_ah->opmode = ic_opmode;
+
+       /*
+        * Enable MIB interrupts when there are hardware phy counters.
+        * Note we only do this (at the moment) for station mode.
+        */
+       if (ath9k_hw_phycounters(sc->sc_ah) &&
+           ((conf->type == NL80211_IFTYPE_STATION) ||
+            (conf->type == NL80211_IFTYPE_ADHOC)))
+               sc->imask |= ATH9K_INT_MIB;
+       /*
+        * Some hardware processes the TIM IE and fires an
+        * interrupt when the TIM bit is set.  For hardware
+        * that does, if not overridden by configuration,
+        * enable the TIM interrupt when operating as station.
+        */
+       if ((sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_ENHANCEDPM) &&
+           (conf->type == NL80211_IFTYPE_STATION) &&
+           !sc->config.swBeaconProcess)
+               sc->imask |= ATH9K_INT_TIM;
+
+       ath9k_hw_set_interrupts(sc->sc_ah, sc->imask);
 
        if (conf->type == NL80211_IFTYPE_AP) {
                /* TODO: is this a suitable place to start ANI for AP mode? */
                /* Start ANI */
-               mod_timer(&sc->sc_ani.timer,
+               mod_timer(&sc->ani.timer,
                          jiffies + msecs_to_jiffies(ATH_ANI_POLLINTERVAL));
        }
 
+       mutex_unlock(&sc->mutex);
+
        return 0;
 }
 
@@ -2107,24 +2188,28 @@ static void ath9k_remove_interface(struct ieee80211_hw *hw,
                                   struct ieee80211_if_init_conf *conf)
 {
        struct ath_softc *sc = hw->priv;
-       struct ath_vap *avp = (void *)conf->vif->drv_priv;
+       struct ath_vif *avp = (void *)conf->vif->drv_priv;
 
        DPRINTF(sc, ATH_DBG_CONFIG, "Detach Interface\n");
 
+       mutex_lock(&sc->mutex);
+
        /* Stop ANI */
-       del_timer_sync(&sc->sc_ani.timer);
+       del_timer_sync(&sc->ani.timer);
 
        /* Reclaim beacon resources */
-       if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP ||
-           sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC) {
+       if (sc->sc_ah->opmode == NL80211_IFTYPE_AP ||
+           sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC) {
                ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
                ath_beacon_return(sc, avp);
        }
 
        sc->sc_flags &= ~SC_OP_BEACONS;
 
-       sc->sc_vaps[0] = NULL;
-       sc->sc_nvaps--;
+       sc->vifs[0] = NULL;
+       sc->nvifs--;
+
+       mutex_unlock(&sc->mutex);
 }
 
 static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
@@ -2133,40 +2218,41 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
        struct ieee80211_conf *conf = &hw->conf;
 
        mutex_lock(&sc->mutex);
-       if (changed & (IEEE80211_CONF_CHANGE_CHANNEL |
-                      IEEE80211_CONF_CHANGE_HT)) {
-               struct ieee80211_channel *curchan = hw->conf.channel;
-               int pos;
 
-               DPRINTF(sc, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
-                       curchan->center_freq);
-
-               pos = ath_get_channel(sc, curchan);
-               if (pos == -1) {
-                       DPRINTF(sc, ATH_DBG_FATAL, "Invalid channel: %d\n",
-                               curchan->center_freq);
-                       mutex_unlock(&sc->mutex);
-                       return -EINVAL;
+       if (changed & IEEE80211_CONF_CHANGE_PS) {
+               if (conf->flags & IEEE80211_CONF_PS) {
+                       if ((sc->imask & ATH9K_INT_TIM_TIMER) == 0) {
+                               sc->imask |= ATH9K_INT_TIM_TIMER;
+                               ath9k_hw_set_interrupts(sc->sc_ah,
+                                               sc->imask);
+                       }
+                       ath9k_hw_setrxabort(sc->sc_ah, 1);
+                       ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
+               } else {
+                       ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_AWAKE);
+                       ath9k_hw_setrxabort(sc->sc_ah, 0);
+                       sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON;
+                       if (sc->imask & ATH9K_INT_TIM_TIMER) {
+                               sc->imask &= ~ATH9K_INT_TIM_TIMER;
+                               ath9k_hw_set_interrupts(sc->sc_ah,
+                                               sc->imask);
+                       }
                }
+       }
 
-               sc->tx_chan_width = ATH9K_HT_MACMODE_20;
-               sc->sc_ah->ah_channels[pos].chanmode =
-                       (curchan->band == IEEE80211_BAND_2GHZ) ?
-                       CHANNEL_G : CHANNEL_A;
+       if (changed & IEEE80211_CONF_CHANGE_CHANNEL) {
+               struct ieee80211_channel *curchan = hw->conf.channel;
+               int pos = curchan->hw_value;
 
-               if (conf->ht.enabled) {
-                       if (conf->ht.channel_type == NL80211_CHAN_HT40PLUS ||
-                           conf->ht.channel_type == NL80211_CHAN_HT40MINUS)
-                               sc->tx_chan_width = ATH9K_HT_MACMODE_2040;
+               DPRINTF(sc, ATH_DBG_CONFIG, "Set channel: %d MHz\n",
+                       curchan->center_freq);
 
-                       sc->sc_ah->ah_channels[pos].chanmode =
-                               ath_get_extchanmode(sc, curchan,
-                                                   conf->ht.channel_type);
-               }
+               /* XXX: remove me eventualy */
+               ath9k_update_ichannel(sc, &sc->sc_ah->channels[pos]);
 
-               ath_update_chainmask(sc, conf->ht.enabled);
+               ath_update_chainmask(sc, conf_is_ht(conf));
 
-               if (ath_set_channel(sc, &sc->sc_ah->ah_channels[pos]) < 0) {
+               if (ath_set_channel(sc, &sc->sc_ah->channels[pos]) < 0) {
                        DPRINTF(sc, ATH_DBG_FATAL, "Unable to set channel\n");
                        mutex_unlock(&sc->mutex);
                        return -EINVAL;
@@ -2174,9 +2260,10 @@ static int ath9k_config(struct ieee80211_hw *hw, u32 changed)
        }
 
        if (changed & IEEE80211_CONF_CHANGE_POWER)
-               sc->sc_config.txpowlimit = 2 * conf->power_level;
+               sc->config.txpowlimit = 2 * conf->power_level;
 
        mutex_unlock(&sc->mutex);
+
        return 0;
 }
 
@@ -2185,18 +2272,20 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
                                  struct ieee80211_if_conf *conf)
 {
        struct ath_softc *sc = hw->priv;
-       struct ath_hal *ah = sc->sc_ah;
-       struct ath_vap *avp = (void *)vif->drv_priv;
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath_vif *avp = (void *)vif->drv_priv;
        u32 rfilt = 0;
        int error, i;
 
        /* TODO: Need to decide which hw opmode to use for multi-interface
         * cases */
        if (vif->type == NL80211_IFTYPE_AP &&
-           ah->ah_opmode != NL80211_IFTYPE_AP) {
-               ah->ah_opmode = NL80211_IFTYPE_STATION;
+           ah->opmode != NL80211_IFTYPE_AP) {
+               ah->opmode = NL80211_IFTYPE_STATION;
                ath9k_hw_setopmode(ah);
-               ath9k_hw_write_associd(ah, sc->sc_myaddr, 0);
+               memcpy(sc->curbssid, sc->sc_ah->macaddr, ETH_ALEN);
+               sc->curaid = 0;
+               ath9k_hw_write_associd(sc);
                /* Request full reset to get hw opmode changed properly */
                sc->sc_flags |= SC_OP_FULL_RESET;
        }
@@ -2207,17 +2296,16 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
                case NL80211_IFTYPE_STATION:
                case NL80211_IFTYPE_ADHOC:
                        /* Set BSSID */
-                       memcpy(sc->sc_curbssid, conf->bssid, ETH_ALEN);
-                       sc->sc_curaid = 0;
-                       ath9k_hw_write_associd(sc->sc_ah, sc->sc_curbssid,
-                                              sc->sc_curaid);
+                       memcpy(sc->curbssid, conf->bssid, ETH_ALEN);
+                       sc->curaid = 0;
+                       ath9k_hw_write_associd(sc);
 
                        /* Set aggregation protection mode parameters */
-                       sc->sc_config.ath_aggr_prot = 0;
+                       sc->config.ath_aggr_prot = 0;
 
                        DPRINTF(sc, ATH_DBG_CONFIG,
                                "RX filter 0x%x bssid %pM aid 0x%x\n",
-                               rfilt, sc->sc_curbssid, sc->sc_curaid);
+                               rfilt, sc->curbssid, sc->curaid);
 
                        /* need to reconfigure the beacon */
                        sc->sc_flags &= ~SC_OP_BEACONS ;
@@ -2228,24 +2316,27 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
                }
        }
 
-       if ((conf->changed & IEEE80211_IFCC_BEACON) &&
-           ((vif->type == NL80211_IFTYPE_ADHOC) ||
-            (vif->type == NL80211_IFTYPE_AP))) {
-               /*
-                * Allocate and setup the beacon frame.
-                *
-                * Stop any previous beacon DMA.  This may be
-                * necessary, for example, when an ibss merge
-                * causes reconfiguration; we may be called
-                * with beacon transmission active.
-                */
-               ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
+       if ((vif->type == NL80211_IFTYPE_ADHOC) ||
+           (vif->type == NL80211_IFTYPE_AP)) {
+               if ((conf->changed & IEEE80211_IFCC_BEACON) ||
+                   (conf->changed & IEEE80211_IFCC_BEACON_ENABLED &&
+                    conf->enable_beacon)) {
+                       /*
+                        * Allocate and setup the beacon frame.
+                        *
+                        * Stop any previous beacon DMA.  This may be
+                        * necessary, for example, when an ibss merge
+                        * causes reconfiguration; we may be called
+                        * with beacon transmission active.
+                        */
+                       ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
 
-               error = ath_beacon_alloc(sc, 0);
-               if (error != 0)
-                       return error;
+                       error = ath_beacon_alloc(sc, 0);
+                       if (error != 0)
+                               return error;
 
-               ath_beacon_sync(sc, 0);
+                       ath_beacon_sync(sc, 0);
+               }
        }
 
        /* Check for WLAN_CAPABILITY_PRIVACY ? */
@@ -2254,7 +2345,7 @@ static int ath9k_config_interface(struct ieee80211_hw *hw,
                        if (ath9k_hw_keyisvalid(sc->sc_ah, (u16)i))
                                ath9k_hw_keysetmac(sc->sc_ah,
                                                   (u16)i,
-                                                  sc->sc_curbssid);
+                                                  sc->curbssid);
        }
 
        /* Only legacy IBSS for now */
@@ -2290,8 +2381,11 @@ static void ath9k_configure_filter(struct ieee80211_hw *hw,
        ath9k_hw_setrxfilter(sc->sc_ah, rfilt);
 
        if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
-               if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
-                       ath9k_hw_write_associd(sc->sc_ah, ath_bcast_mac, 0);
+               if (*total_flags & FIF_BCN_PRBRESP_PROMISC) {
+                       memcpy(sc->curbssid, ath_bcast_mac, ETH_ALEN);
+                       sc->curaid = 0;
+                       ath9k_hw_write_associd(sc);
+               }
        }
 
        DPRINTF(sc, ATH_DBG_CONFIG, "Set HW RX filter: 0x%x\n", sc->rx.rxfilter);
@@ -2316,8 +2410,7 @@ static void ath9k_sta_notify(struct ieee80211_hw *hw,
        }
 }
 
-static int ath9k_conf_tx(struct ieee80211_hw *hw,
-                        u16 queue,
+static int ath9k_conf_tx(struct ieee80211_hw *hw, u16 queue,
                         const struct ieee80211_tx_queue_params *params)
 {
        struct ath_softc *sc = hw->priv;
@@ -2327,6 +2420,8 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw,
        if (queue >= WME_NUM_AC)
                return 0;
 
+       mutex_lock(&sc->mutex);
+
        qi.tqi_aifs = params->aifs;
        qi.tqi_cwmin = params->cw_min;
        qi.tqi_cwmax = params->cw_max;
@@ -2343,29 +2438,35 @@ static int ath9k_conf_tx(struct ieee80211_hw *hw,
        if (ret)
                DPRINTF(sc, ATH_DBG_FATAL, "TXQ Update failed\n");
 
+       mutex_unlock(&sc->mutex);
+
        return ret;
 }
 
 static int ath9k_set_key(struct ieee80211_hw *hw,
                         enum set_key_cmd cmd,
-                        const u8 *local_addr,
-                        const u8 *addr,
+                        struct ieee80211_vif *vif,
+                        struct ieee80211_sta *sta,
                         struct ieee80211_key_conf *key)
 {
        struct ath_softc *sc = hw->priv;
        int ret = 0;
 
+       mutex_lock(&sc->mutex);
+       ath9k_ps_wakeup(sc);
        DPRINTF(sc, ATH_DBG_KEYCACHE, "Set HW Key\n");
 
        switch (cmd) {
        case SET_KEY:
-               ret = ath_key_config(sc, addr, key);
+               ret = ath_key_config(sc, sta, key);
                if (ret >= 0) {
                        key->hw_key_idx = ret;
                        /* push IV and Michael MIC generation to stack */
                        key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
                        if (key->alg == ALG_TKIP)
                                key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
+                       if (sc->sc_ah->sw_mgmt_crypto && key->alg == ALG_CCMP)
+                               key->flags |= IEEE80211_KEY_FLAG_SW_MGMT;
                        ret = 0;
                }
                break;
@@ -2376,6 +2477,9 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
                ret = -EINVAL;
        }
 
+       ath9k_ps_restore(sc);
+       mutex_unlock(&sc->mutex);
+
        return ret;
 }
 
@@ -2386,6 +2490,8 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
 {
        struct ath_softc *sc = hw->priv;
 
+       mutex_lock(&sc->mutex);
+
        if (changed & BSS_CHANGED_ERP_PREAMBLE) {
                DPRINTF(sc, ATH_DBG_CONFIG, "BSS Changed PREAMBLE %d\n",
                        bss_conf->use_short_preamble);
@@ -2410,31 +2516,44 @@ static void ath9k_bss_info_changed(struct ieee80211_hw *hw,
                        bss_conf->assoc);
                ath9k_bss_assoc_info(sc, vif, bss_conf);
        }
+
+       mutex_unlock(&sc->mutex);
 }
 
 static u64 ath9k_get_tsf(struct ieee80211_hw *hw)
 {
        u64 tsf;
        struct ath_softc *sc = hw->priv;
-       struct ath_hal *ah = sc->sc_ah;
 
-       tsf = ath9k_hw_gettsf64(ah);
+       mutex_lock(&sc->mutex);
+       tsf = ath9k_hw_gettsf64(sc->sc_ah);
+       mutex_unlock(&sc->mutex);
 
        return tsf;
 }
 
+static void ath9k_set_tsf(struct ieee80211_hw *hw, u64 tsf)
+{
+       struct ath_softc *sc = hw->priv;
+
+       mutex_lock(&sc->mutex);
+       ath9k_hw_settsf64(sc->sc_ah, tsf);
+       mutex_unlock(&sc->mutex);
+}
+
 static void ath9k_reset_tsf(struct ieee80211_hw *hw)
 {
        struct ath_softc *sc = hw->priv;
-       struct ath_hal *ah = sc->sc_ah;
 
-       ath9k_hw_reset_tsf(ah);
+       mutex_lock(&sc->mutex);
+       ath9k_hw_reset_tsf(sc->sc_ah);
+       mutex_unlock(&sc->mutex);
 }
 
 static int ath9k_ampdu_action(struct ieee80211_hw *hw,
-                      enum ieee80211_ampdu_mlme_action action,
-                      struct ieee80211_sta *sta,
-                      u16 tid, u16 *ssn)
+                             enum ieee80211_ampdu_mlme_action action,
+                             struct ieee80211_sta *sta,
+                             u16 tid, u16 *ssn)
 {
        struct ath_softc *sc = hw->priv;
        int ret = 0;
@@ -2472,7 +2591,7 @@ static int ath9k_ampdu_action(struct ieee80211_hw *hw,
        return ret;
 }
 
-static struct ieee80211_ops ath9k_ops = {
+struct ieee80211_ops ath9k_ops = {
        .tx                 = ath9k_tx,
        .start              = ath9k_start,
        .stop               = ath9k_stop,
@@ -2486,6 +2605,7 @@ static struct ieee80211_ops ath9k_ops = {
        .bss_info_changed   = ath9k_bss_info_changed,
        .set_key            = ath9k_set_key,
        .get_tsf            = ath9k_get_tsf,
+       .set_tsf            = ath9k_set_tsf,
        .reset_tsf          = ath9k_reset_tsf,
        .ampdu_action       = ath9k_ampdu_action,
 };
@@ -2516,7 +2636,7 @@ static struct {
 /*
  * Return the MAC/BB name. "????" is returned if the MAC/BB is unknown.
  */
-static const char *
+const char *
 ath_mac_bb_name(u32 mac_bb_version)
 {
        int i;
@@ -2533,7 +2653,7 @@ ath_mac_bb_name(u32 mac_bb_version)
 /*
  * Return the RF name. "????" is returned if the RF is unknown.
  */
-static const char *
+const char *
 ath_rf_name(u16 rf_version)
 {
        int i;
@@ -2547,254 +2667,51 @@ ath_rf_name(u16 rf_version)
        return "????";
 }
 
-static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-       void __iomem *mem;
-       struct ath_softc *sc;
-       struct ieee80211_hw *hw;
-       u8 csz;
-       u32 val;
-       int ret = 0;
-       struct ath_hal *ah;
-
-       if (pci_enable_device(pdev))
-               return -EIO;
-
-       ret =  pci_set_dma_mask(pdev, DMA_32BIT_MASK);
-
-       if (ret) {
-               printk(KERN_ERR "ath9k: 32-bit DMA not available\n");
-               goto bad;
-       }
-
-       ret = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
-
-       if (ret) {
-               printk(KERN_ERR "ath9k: 32-bit DMA consistent "
-                       "DMA enable failed\n");
-               goto bad;
-       }
-
-       /*
-        * Cache line size is used to size and align various
-        * structures used to communicate with the hardware.
-        */
-       pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &csz);
-       if (csz == 0) {
-               /*
-                * Linux 2.4.18 (at least) writes the cache line size
-                * register as a 16-bit wide register which is wrong.
-                * We must have this setup properly for rx buffer
-                * DMA to work so force a reasonable value here if it
-                * comes up zero.
-                */
-               csz = L1_CACHE_BYTES / sizeof(u32);
-               pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, csz);
-       }
-       /*
-        * The default setting of latency timer yields poor results,
-        * set it to the value used by other systems. It may be worth
-        * tweaking this setting more.
-        */
-       pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xa8);
-
-       pci_set_master(pdev);
-
-       /*
-        * Disable the RETRY_TIMEOUT register (0x41) to keep
-        * PCI Tx retries from interfering with C3 CPU state.
-        */
-       pci_read_config_dword(pdev, 0x40, &val);
-       if ((val & 0x0000ff00) != 0)
-               pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
-
-       ret = pci_request_region(pdev, 0, "ath9k");
-       if (ret) {
-               dev_err(&pdev->dev, "PCI memory region reserve error\n");
-               ret = -ENODEV;
-               goto bad;
-       }
-
-       mem = pci_iomap(pdev, 0, 0);
-       if (!mem) {
-               printk(KERN_ERR "PCI memory map error\n") ;
-               ret = -EIO;
-               goto bad1;
-       }
-
-       hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops);
-       if (hw == NULL) {
-               printk(KERN_ERR "ath_pci: no memory for ieee80211_hw\n");
-               goto bad2;
-       }
-
-       SET_IEEE80211_DEV(hw, &pdev->dev);
-       pci_set_drvdata(pdev, hw);
-
-       sc = hw->priv;
-       sc->hw = hw;
-       sc->pdev = pdev;
-       sc->mem = mem;
-
-       if (ath_attach(id->device, sc) != 0) {
-               ret = -ENODEV;
-               goto bad3;
-       }
-
-       /* setup interrupt service routine */
-
-       if (request_irq(pdev->irq, ath_isr, IRQF_SHARED, "ath", sc)) {
-               printk(KERN_ERR "%s: request_irq failed\n",
-                       wiphy_name(hw->wiphy));
-               ret = -EIO;
-               goto bad4;
-       }
-
-       ah = sc->sc_ah;
-       printk(KERN_INFO
-              "%s: Atheros AR%s MAC/BB Rev:%x "
-              "AR%s RF Rev:%x: mem=0x%lx, irq=%d\n",
-              wiphy_name(hw->wiphy),
-              ath_mac_bb_name(ah->ah_macVersion),
-              ah->ah_macRev,
-              ath_rf_name((ah->ah_analog5GhzRev & AR_RADIO_SREV_MAJOR)),
-              ah->ah_phyRev,
-              (unsigned long)mem, pdev->irq);
-
-       return 0;
-bad4:
-       ath_detach(sc);
-bad3:
-       ieee80211_free_hw(hw);
-bad2:
-       pci_iounmap(pdev, mem);
-bad1:
-       pci_release_region(pdev, 0);
-bad:
-       pci_disable_device(pdev);
-       return ret;
-}
-
-static void ath_pci_remove(struct pci_dev *pdev)
-{
-       struct ieee80211_hw *hw = pci_get_drvdata(pdev);
-       struct ath_softc *sc = hw->priv;
-
-       ath_detach(sc);
-       if (pdev->irq)
-               free_irq(pdev->irq, sc);
-       pci_iounmap(pdev, sc->mem);
-       pci_release_region(pdev, 0);
-       pci_disable_device(pdev);
-       ieee80211_free_hw(hw);
-}
-
-#ifdef CONFIG_PM
-
-static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state)
-{
-       struct ieee80211_hw *hw = pci_get_drvdata(pdev);
-       struct ath_softc *sc = hw->priv;
-
-       ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1);
-
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
-               cancel_delayed_work_sync(&sc->rf_kill.rfkill_poll);
-#endif
-
-       pci_save_state(pdev);
-       pci_disable_device(pdev);
-       pci_set_power_state(pdev, 3);
-
-       return 0;
-}
-
-static int ath_pci_resume(struct pci_dev *pdev)
-{
-       struct ieee80211_hw *hw = pci_get_drvdata(pdev);
-       struct ath_softc *sc = hw->priv;
-       u32 val;
-       int err;
-
-       err = pci_enable_device(pdev);
-       if (err)
-               return err;
-       pci_restore_state(pdev);
-       /*
-        * Suspend/Resume resets the PCI configuration space, so we have to
-        * re-disable the RETRY_TIMEOUT register (0x41) to keep
-        * PCI Tx retries from interfering with C3 CPU state
-        */
-       pci_read_config_dword(pdev, 0x40, &val);
-       if ((val & 0x0000ff00) != 0)
-               pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
-
-       /* Enable LED */
-       ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN,
-                           AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
-       ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1);
-
-#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
-       /*
-        * check the h/w rfkill state on resume
-        * and start the rfkill poll timer
-        */
-       if (sc->sc_ah->ah_caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
-               queue_delayed_work(sc->hw->workqueue,
-                                  &sc->rf_kill.rfkill_poll, 0);
-#endif
-
-       return 0;
-}
-
-#endif /* CONFIG_PM */
-
-MODULE_DEVICE_TABLE(pci, ath_pci_id_table);
-
-static struct pci_driver ath_pci_driver = {
-       .name       = "ath9k",
-       .id_table   = ath_pci_id_table,
-       .probe      = ath_pci_probe,
-       .remove     = ath_pci_remove,
-#ifdef CONFIG_PM
-       .suspend    = ath_pci_suspend,
-       .resume     = ath_pci_resume,
-#endif /* CONFIG_PM */
-};
-
-static int __init init_ath_pci(void)
+static int __init ath9k_init(void)
 {
        int error;
 
-       printk(KERN_INFO "%s: %s\n", dev_info, ATH_PCI_VERSION);
-
        /* Register rate control algorithm */
        error = ath_rate_control_register();
        if (error != 0) {
                printk(KERN_ERR
-                       "Unable to register rate control algorithm: %d\n",
+                       "ath9k: Unable to register rate control "
+                       "algorithm: %d\n",
                        error);
-               ath_rate_control_unregister();
-               return error;
+               goto err_out;
        }
 
-       if (pci_register_driver(&ath_pci_driver) < 0) {
+       error = ath_pci_init();
+       if (error < 0) {
                printk(KERN_ERR
-                       "ath_pci: No devices found, driver not installed.\n");
-               ath_rate_control_unregister();
-               pci_unregister_driver(&ath_pci_driver);
-               return -ENODEV;
+                       "ath9k: No PCI devices found, driver not installed.\n");
+               error = -ENODEV;
+               goto err_rate_unregister;
+       }
+
+       error = ath_ahb_init();
+       if (error < 0) {
+               error = -ENODEV;
+               goto err_pci_exit;
        }
 
        return 0;
+
+ err_pci_exit:
+       ath_pci_exit();
+
+ err_rate_unregister:
+       ath_rate_control_unregister();
+ err_out:
+       return error;
 }
-module_init(init_ath_pci);
+module_init(ath9k_init);
 
-static void __exit exit_ath_pci(void)
+static void __exit ath9k_exit(void)
 {
+       ath_ahb_exit();
+       ath_pci_exit();
        ath_rate_control_unregister();
-       pci_unregister_driver(&ath_pci_driver);
        printk(KERN_INFO "%s: Driver unloaded\n", dev_info);
 }
-module_exit(exit_ath_pci);
+module_exit(ath9k_exit);
diff --git a/drivers/net/wireless/ath9k/pci.c b/drivers/net/wireless/ath9k/pci.c
new file mode 100644 (file)
index 0000000..c28afe4
--- /dev/null
@@ -0,0 +1,303 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include <linux/nl80211.h>
+#include <linux/pci.h>
+#include "ath9k.h"
+
+static struct pci_device_id ath_pci_id_table[] __devinitdata = {
+       { PCI_VDEVICE(ATHEROS, 0x0023) }, /* PCI   */
+       { PCI_VDEVICE(ATHEROS, 0x0024) }, /* PCI-E */
+       { PCI_VDEVICE(ATHEROS, 0x0027) }, /* PCI   */
+       { PCI_VDEVICE(ATHEROS, 0x0029) }, /* PCI   */
+       { PCI_VDEVICE(ATHEROS, 0x002A) }, /* PCI-E */
+       { PCI_VDEVICE(ATHEROS, 0x002B) }, /* PCI-E */
+       { 0 }
+};
+
+/* return bus cachesize in 4B word units */
+static void ath_pci_read_cachesize(struct ath_softc *sc, int *csz)
+{
+       u8 u8tmp;
+
+       pci_read_config_byte(to_pci_dev(sc->dev), PCI_CACHE_LINE_SIZE,
+                            (u8 *)&u8tmp);
+       *csz = (int)u8tmp;
+
+       /*
+        * This check was put in to avoid "unplesant" consequences if
+        * the bootrom has not fully initialized all PCI devices.
+        * Sometimes the cache line size register is not set
+        */
+
+       if (*csz == 0)
+               *csz = DEFAULT_CACHELINE >> 2;   /* Use the default size */
+}
+
+static void ath_pci_cleanup(struct ath_softc *sc)
+{
+       struct pci_dev *pdev = to_pci_dev(sc->dev);
+
+       pci_iounmap(pdev, sc->mem);
+       pci_release_region(pdev, 0);
+       pci_disable_device(pdev);
+}
+
+static bool ath_pci_eeprom_read(struct ath_hw *ah, u32 off, u16 *data)
+{
+       (void)REG_READ(ah, AR5416_EEPROM_OFFSET + (off << AR5416_EEPROM_S));
+
+       if (!ath9k_hw_wait(ah,
+                          AR_EEPROM_STATUS_DATA,
+                          AR_EEPROM_STATUS_DATA_BUSY |
+                          AR_EEPROM_STATUS_DATA_PROT_ACCESS, 0)) {
+               return false;
+       }
+
+       *data = MS(REG_READ(ah, AR_EEPROM_STATUS_DATA),
+                  AR_EEPROM_STATUS_DATA_VAL);
+
+       return true;
+}
+
+static struct ath_bus_ops ath_pci_bus_ops = {
+       .read_cachesize = ath_pci_read_cachesize,
+       .cleanup = ath_pci_cleanup,
+       .eeprom_read = ath_pci_eeprom_read,
+};
+
+static int ath_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
+{
+       void __iomem *mem;
+       struct ath_softc *sc;
+       struct ieee80211_hw *hw;
+       u8 csz;
+       u32 val;
+       int ret = 0;
+       struct ath_hw *ah;
+
+       if (pci_enable_device(pdev))
+               return -EIO;
+
+       ret =  pci_set_dma_mask(pdev, DMA_32BIT_MASK);
+
+       if (ret) {
+               printk(KERN_ERR "ath9k: 32-bit DMA not available\n");
+               goto bad;
+       }
+
+       ret = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
+
+       if (ret) {
+               printk(KERN_ERR "ath9k: 32-bit DMA consistent "
+                       "DMA enable failed\n");
+               goto bad;
+       }
+
+       /*
+        * Cache line size is used to size and align various
+        * structures used to communicate with the hardware.
+        */
+       pci_read_config_byte(pdev, PCI_CACHE_LINE_SIZE, &csz);
+       if (csz == 0) {
+               /*
+                * Linux 2.4.18 (at least) writes the cache line size
+                * register as a 16-bit wide register which is wrong.
+                * We must have this setup properly for rx buffer
+                * DMA to work so force a reasonable value here if it
+                * comes up zero.
+                */
+               csz = L1_CACHE_BYTES / sizeof(u32);
+               pci_write_config_byte(pdev, PCI_CACHE_LINE_SIZE, csz);
+       }
+       /*
+        * The default setting of latency timer yields poor results,
+        * set it to the value used by other systems. It may be worth
+        * tweaking this setting more.
+        */
+       pci_write_config_byte(pdev, PCI_LATENCY_TIMER, 0xa8);
+
+       pci_set_master(pdev);
+
+       /*
+        * Disable the RETRY_TIMEOUT register (0x41) to keep
+        * PCI Tx retries from interfering with C3 CPU state.
+        */
+       pci_read_config_dword(pdev, 0x40, &val);
+       if ((val & 0x0000ff00) != 0)
+               pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
+
+       ret = pci_request_region(pdev, 0, "ath9k");
+       if (ret) {
+               dev_err(&pdev->dev, "PCI memory region reserve error\n");
+               ret = -ENODEV;
+               goto bad;
+       }
+
+       mem = pci_iomap(pdev, 0, 0);
+       if (!mem) {
+               printk(KERN_ERR "PCI memory map error\n") ;
+               ret = -EIO;
+               goto bad1;
+       }
+
+       hw = ieee80211_alloc_hw(sizeof(struct ath_softc), &ath9k_ops);
+       if (hw == NULL) {
+               printk(KERN_ERR "ath_pci: no memory for ieee80211_hw\n");
+               goto bad2;
+       }
+
+       SET_IEEE80211_DEV(hw, &pdev->dev);
+       pci_set_drvdata(pdev, hw);
+
+       sc = hw->priv;
+       sc->hw = hw;
+       sc->dev = &pdev->dev;
+       sc->mem = mem;
+       sc->bus_ops = &ath_pci_bus_ops;
+
+       if (ath_attach(id->device, sc) != 0) {
+               ret = -ENODEV;
+               goto bad3;
+       }
+
+       /* setup interrupt service routine */
+
+       if (request_irq(pdev->irq, ath_isr, IRQF_SHARED, "ath", sc)) {
+               printk(KERN_ERR "%s: request_irq failed\n",
+                       wiphy_name(hw->wiphy));
+               ret = -EIO;
+               goto bad4;
+       }
+
+       sc->irq = pdev->irq;
+
+       ah = sc->sc_ah;
+       printk(KERN_INFO
+              "%s: Atheros AR%s MAC/BB Rev:%x "
+              "AR%s RF Rev:%x: mem=0x%lx, irq=%d\n",
+              wiphy_name(hw->wiphy),
+              ath_mac_bb_name(ah->hw_version.macVersion),
+              ah->hw_version.macRev,
+              ath_rf_name((ah->hw_version.analog5GhzRev & AR_RADIO_SREV_MAJOR)),
+              ah->hw_version.phyRev,
+              (unsigned long)mem, pdev->irq);
+
+       return 0;
+bad4:
+       ath_detach(sc);
+bad3:
+       ieee80211_free_hw(hw);
+bad2:
+       pci_iounmap(pdev, mem);
+bad1:
+       pci_release_region(pdev, 0);
+bad:
+       pci_disable_device(pdev);
+       return ret;
+}
+
+static void ath_pci_remove(struct pci_dev *pdev)
+{
+       struct ieee80211_hw *hw = pci_get_drvdata(pdev);
+       struct ath_softc *sc = hw->priv;
+
+       ath_cleanup(sc);
+}
+
+#ifdef CONFIG_PM
+
+static int ath_pci_suspend(struct pci_dev *pdev, pm_message_t state)
+{
+       struct ieee80211_hw *hw = pci_get_drvdata(pdev);
+       struct ath_softc *sc = hw->priv;
+
+       ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1);
+
+#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
+               cancel_delayed_work_sync(&sc->rf_kill.rfkill_poll);
+#endif
+
+       pci_save_state(pdev);
+       pci_disable_device(pdev);
+       pci_set_power_state(pdev, PCI_D3hot);
+
+       return 0;
+}
+
+static int ath_pci_resume(struct pci_dev *pdev)
+{
+       struct ieee80211_hw *hw = pci_get_drvdata(pdev);
+       struct ath_softc *sc = hw->priv;
+       u32 val;
+       int err;
+
+       err = pci_enable_device(pdev);
+       if (err)
+               return err;
+       pci_restore_state(pdev);
+       /*
+        * Suspend/Resume resets the PCI configuration space, so we have to
+        * re-disable the RETRY_TIMEOUT register (0x41) to keep
+        * PCI Tx retries from interfering with C3 CPU state
+        */
+       pci_read_config_dword(pdev, 0x40, &val);
+       if ((val & 0x0000ff00) != 0)
+               pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
+
+       /* Enable LED */
+       ath9k_hw_cfg_output(sc->sc_ah, ATH_LED_PIN,
+                           AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
+       ath9k_hw_set_gpio(sc->sc_ah, ATH_LED_PIN, 1);
+
+#if defined(CONFIG_RFKILL) || defined(CONFIG_RFKILL_MODULE)
+       /*
+        * check the h/w rfkill state on resume
+        * and start the rfkill poll timer
+        */
+       if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_RFSILENT)
+               queue_delayed_work(sc->hw->workqueue,
+                                  &sc->rf_kill.rfkill_poll, 0);
+#endif
+
+       return 0;
+}
+
+#endif /* CONFIG_PM */
+
+MODULE_DEVICE_TABLE(pci, ath_pci_id_table);
+
+static struct pci_driver ath_pci_driver = {
+       .name       = "ath9k",
+       .id_table   = ath_pci_id_table,
+       .probe      = ath_pci_probe,
+       .remove     = ath_pci_remove,
+#ifdef CONFIG_PM
+       .suspend    = ath_pci_suspend,
+       .resume     = ath_pci_resume,
+#endif /* CONFIG_PM */
+};
+
+int __init ath_pci_init(void)
+{
+       return pci_register_driver(&ath_pci_driver);
+}
+
+void ath_pci_exit(void)
+{
+       pci_unregister_driver(&ath_pci_driver);
+}
index 766982a8196e38b154348f14944e816519abea4e..52aa2a7abe7aa8b189f07fe32ea33c29363b81c1 100644 (file)
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
-#include "hw.h"
-#include "reg.h"
-#include "phy.h"
+#include "ath9k.h"
 
 void
-ath9k_hw_write_regs(struct ath_hal *ah, u32 modesIndex, u32 freqIndex,
+ath9k_hw_write_regs(struct ath_hw *ah, u32 modesIndex, u32 freqIndex,
                    int regWrites)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       REG_WRITE_ARRAY(&ahp->ah_iniBB_RfGain, freqIndex, regWrites);
+       REG_WRITE_ARRAY(&ah->iniBB_RfGain, freqIndex, regWrites);
 }
 
 bool
-ath9k_hw_set_channel(struct ath_hal *ah, struct ath9k_channel *chan)
+ath9k_hw_set_channel(struct ath_hw *ah, struct ath9k_channel *chan)
 {
        u32 channelSel = 0;
        u32 bModeSynth = 0;
@@ -95,15 +90,14 @@ ath9k_hw_set_channel(struct ath_hal *ah, struct ath9k_channel *chan)
 
        REG_WRITE(ah, AR_PHY(0x37), reg32);
 
-       ah->ah_curchan = chan;
-
-       AH5416(ah)->ah_curchanRadIndex = -1;
+       ah->curchan = chan;
+       ah->curchan_rad_index = -1;
 
        return true;
 }
 
 bool
-ath9k_hw_ar9280_set_channel(struct ath_hal *ah,
+ath9k_hw_ar9280_set_channel(struct ath_hw *ah,
                            struct ath9k_channel *chan)
 {
        u16 bMode, fracMode, aModeRefSel = 0;
@@ -166,9 +160,8 @@ ath9k_hw_ar9280_set_channel(struct ath_hal *ah,
 
        REG_WRITE(ah, AR_PHY_SYNTH_CONTROL, reg32);
 
-       ah->ah_curchan = chan;
-
-       AH5416(ah)->ah_curchanRadIndex = -1;
+       ah->curchan = chan;
+       ah->curchan_rad_index = -1;
 
        return true;
 }
@@ -201,11 +194,9 @@ ath9k_phy_modify_rx_buffer(u32 *rfBuf, u32 reg32,
 }
 
 bool
-ath9k_hw_set_rf_regs(struct ath_hal *ah, struct ath9k_channel *chan,
+ath9k_hw_set_rf_regs(struct ath_hw *ah, struct ath9k_channel *chan,
                     u16 modesIndex)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        u32 eepMinorRev;
        u32 ob5GHz = 0, db5GHz = 0;
        u32 ob2GHz = 0, db2GHz = 0;
@@ -214,161 +205,156 @@ ath9k_hw_set_rf_regs(struct ath_hal *ah, struct ath9k_channel *chan,
        if (AR_SREV_9280_10_OR_LATER(ah))
                return true;
 
-       eepMinorRev = ath9k_hw_get_eeprom(ah, EEP_MINOR_REV);
+       eepMinorRev = ah->eep_ops->get_eeprom(ah, EEP_MINOR_REV);
 
-       RF_BANK_SETUP(ahp->ah_analogBank0Data, &ahp->ah_iniBank0, 1);
+       RF_BANK_SETUP(ah->analogBank0Data, &ah->iniBank0, 1);
 
-       RF_BANK_SETUP(ahp->ah_analogBank1Data, &ahp->ah_iniBank1, 1);
+       RF_BANK_SETUP(ah->analogBank1Data, &ah->iniBank1, 1);
 
-       RF_BANK_SETUP(ahp->ah_analogBank2Data, &ahp->ah_iniBank2, 1);
+       RF_BANK_SETUP(ah->analogBank2Data, &ah->iniBank2, 1);
 
-       RF_BANK_SETUP(ahp->ah_analogBank3Data, &ahp->ah_iniBank3,
+       RF_BANK_SETUP(ah->analogBank3Data, &ah->iniBank3,
                      modesIndex);
        {
                int i;
-               for (i = 0; i < ahp->ah_iniBank6TPC.ia_rows; i++) {
-                       ahp->ah_analogBank6Data[i] =
-                           INI_RA(&ahp->ah_iniBank6TPC, i, modesIndex);
+               for (i = 0; i < ah->iniBank6TPC.ia_rows; i++) {
+                       ah->analogBank6Data[i] =
+                           INI_RA(&ah->iniBank6TPC, i, modesIndex);
                }
        }
 
        if (eepMinorRev >= 2) {
                if (IS_CHAN_2GHZ(chan)) {
-                       ob2GHz = ath9k_hw_get_eeprom(ah, EEP_OB_2);
-                       db2GHz = ath9k_hw_get_eeprom(ah, EEP_DB_2);
-                       ath9k_phy_modify_rx_buffer(ahp->ah_analogBank6Data,
+                       ob2GHz = ah->eep_ops->get_eeprom(ah, EEP_OB_2);
+                       db2GHz = ah->eep_ops->get_eeprom(ah, EEP_DB_2);
+                       ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
                                                   ob2GHz, 3, 197, 0);
-                       ath9k_phy_modify_rx_buffer(ahp->ah_analogBank6Data,
+                       ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
                                                   db2GHz, 3, 194, 0);
                } else {
-                       ob5GHz = ath9k_hw_get_eeprom(ah, EEP_OB_5);
-                       db5GHz = ath9k_hw_get_eeprom(ah, EEP_DB_5);
-                       ath9k_phy_modify_rx_buffer(ahp->ah_analogBank6Data,
+                       ob5GHz = ah->eep_ops->get_eeprom(ah, EEP_OB_5);
+                       db5GHz = ah->eep_ops->get_eeprom(ah, EEP_DB_5);
+                       ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
                                                   ob5GHz, 3, 203, 0);
-                       ath9k_phy_modify_rx_buffer(ahp->ah_analogBank6Data,
+                       ath9k_phy_modify_rx_buffer(ah->analogBank6Data,
                                                   db5GHz, 3, 200, 0);
                }
        }
 
-       RF_BANK_SETUP(ahp->ah_analogBank7Data, &ahp->ah_iniBank7, 1);
+       RF_BANK_SETUP(ah->analogBank7Data, &ah->iniBank7, 1);
 
-       REG_WRITE_RF_ARRAY(&ahp->ah_iniBank0, ahp->ah_analogBank0Data,
+       REG_WRITE_RF_ARRAY(&ah->iniBank0, ah->analogBank0Data,
                           regWrites);
-       REG_WRITE_RF_ARRAY(&ahp->ah_iniBank1, ahp->ah_analogBank1Data,
+       REG_WRITE_RF_ARRAY(&ah->iniBank1, ah->analogBank1Data,
                           regWrites);
-       REG_WRITE_RF_ARRAY(&ahp->ah_iniBank2, ahp->ah_analogBank2Data,
+       REG_WRITE_RF_ARRAY(&ah->iniBank2, ah->analogBank2Data,
                           regWrites);
-       REG_WRITE_RF_ARRAY(&ahp->ah_iniBank3, ahp->ah_analogBank3Data,
+       REG_WRITE_RF_ARRAY(&ah->iniBank3, ah->analogBank3Data,
                           regWrites);
-       REG_WRITE_RF_ARRAY(&ahp->ah_iniBank6TPC, ahp->ah_analogBank6Data,
+       REG_WRITE_RF_ARRAY(&ah->iniBank6TPC, ah->analogBank6Data,
                           regWrites);
-       REG_WRITE_RF_ARRAY(&ahp->ah_iniBank7, ahp->ah_analogBank7Data,
+       REG_WRITE_RF_ARRAY(&ah->iniBank7, ah->analogBank7Data,
                           regWrites);
 
        return true;
 }
 
 void
-ath9k_hw_rfdetach(struct ath_hal *ah)
+ath9k_hw_rfdetach(struct ath_hw *ah)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
-       if (ahp->ah_analogBank0Data != NULL) {
-               kfree(ahp->ah_analogBank0Data);
-               ahp->ah_analogBank0Data = NULL;
+       if (ah->analogBank0Data != NULL) {
+               kfree(ah->analogBank0Data);
+               ah->analogBank0Data = NULL;
        }
-       if (ahp->ah_analogBank1Data != NULL) {
-               kfree(ahp->ah_analogBank1Data);
-               ahp->ah_analogBank1Data = NULL;
+       if (ah->analogBank1Data != NULL) {
+               kfree(ah->analogBank1Data);
+               ah->analogBank1Data = NULL;
        }
-       if (ahp->ah_analogBank2Data != NULL) {
-               kfree(ahp->ah_analogBank2Data);
-               ahp->ah_analogBank2Data = NULL;
+       if (ah->analogBank2Data != NULL) {
+               kfree(ah->analogBank2Data);
+               ah->analogBank2Data = NULL;
        }
-       if (ahp->ah_analogBank3Data != NULL) {
-               kfree(ahp->ah_analogBank3Data);
-               ahp->ah_analogBank3Data = NULL;
+       if (ah->analogBank3Data != NULL) {
+               kfree(ah->analogBank3Data);
+               ah->analogBank3Data = NULL;
        }
-       if (ahp->ah_analogBank6Data != NULL) {
-               kfree(ahp->ah_analogBank6Data);
-               ahp->ah_analogBank6Data = NULL;
+       if (ah->analogBank6Data != NULL) {
+               kfree(ah->analogBank6Data);
+               ah->analogBank6Data = NULL;
        }
-       if (ahp->ah_analogBank6TPCData != NULL) {
-               kfree(ahp->ah_analogBank6TPCData);
-               ahp->ah_analogBank6TPCData = NULL;
+       if (ah->analogBank6TPCData != NULL) {
+               kfree(ah->analogBank6TPCData);
+               ah->analogBank6TPCData = NULL;
        }
-       if (ahp->ah_analogBank7Data != NULL) {
-               kfree(ahp->ah_analogBank7Data);
-               ahp->ah_analogBank7Data = NULL;
+       if (ah->analogBank7Data != NULL) {
+               kfree(ah->analogBank7Data);
+               ah->analogBank7Data = NULL;
        }
-       if (ahp->ah_addac5416_21 != NULL) {
-               kfree(ahp->ah_addac5416_21);
-               ahp->ah_addac5416_21 = NULL;
+       if (ah->addac5416_21 != NULL) {
+               kfree(ah->addac5416_21);
+               ah->addac5416_21 = NULL;
        }
-       if (ahp->ah_bank6Temp != NULL) {
-               kfree(ahp->ah_bank6Temp);
-               ahp->ah_bank6Temp = NULL;
+       if (ah->bank6Temp != NULL) {
+               kfree(ah->bank6Temp);
+               ah->bank6Temp = NULL;
        }
 }
 
-bool ath9k_hw_init_rf(struct ath_hal *ah, int *status)
+bool ath9k_hw_init_rf(struct ath_hw *ah, int *status)
 {
-       struct ath_hal_5416 *ahp = AH5416(ah);
-
        if (!AR_SREV_9280_10_OR_LATER(ah)) {
-
-               ahp->ah_analogBank0Data =
+               ah->analogBank0Data =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniBank0.ia_rows), GFP_KERNEL);
-               ahp->ah_analogBank1Data =
+                            ah->iniBank0.ia_rows), GFP_KERNEL);
+               ah->analogBank1Data =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniBank1.ia_rows), GFP_KERNEL);
-               ahp->ah_analogBank2Data =
+                            ah->iniBank1.ia_rows), GFP_KERNEL);
+               ah->analogBank2Data =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniBank2.ia_rows), GFP_KERNEL);
-               ahp->ah_analogBank3Data =
+                            ah->iniBank2.ia_rows), GFP_KERNEL);
+               ah->analogBank3Data =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniBank3.ia_rows), GFP_KERNEL);
-               ahp->ah_analogBank6Data =
+                            ah->iniBank3.ia_rows), GFP_KERNEL);
+               ah->analogBank6Data =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniBank6.ia_rows), GFP_KERNEL);
-               ahp->ah_analogBank6TPCData =
+                            ah->iniBank6.ia_rows), GFP_KERNEL);
+               ah->analogBank6TPCData =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniBank6TPC.ia_rows), GFP_KERNEL);
-               ahp->ah_analogBank7Data =
+                            ah->iniBank6TPC.ia_rows), GFP_KERNEL);
+               ah->analogBank7Data =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniBank7.ia_rows), GFP_KERNEL);
-
-               if (ahp->ah_analogBank0Data == NULL
-                   || ahp->ah_analogBank1Data == NULL
-                   || ahp->ah_analogBank2Data == NULL
-                   || ahp->ah_analogBank3Data == NULL
-                   || ahp->ah_analogBank6Data == NULL
-                   || ahp->ah_analogBank6TPCData == NULL
-                   || ahp->ah_analogBank7Data == NULL) {
+                            ah->iniBank7.ia_rows), GFP_KERNEL);
+
+               if (ah->analogBank0Data == NULL
+                   || ah->analogBank1Data == NULL
+                   || ah->analogBank2Data == NULL
+                   || ah->analogBank3Data == NULL
+                   || ah->analogBank6Data == NULL
+                   || ah->analogBank6TPCData == NULL
+                   || ah->analogBank7Data == NULL) {
                        DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
                                "Cannot allocate RF banks\n");
                        *status = -ENOMEM;
                        return false;
                }
 
-               ahp->ah_addac5416_21 =
+               ah->addac5416_21 =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniAddac.ia_rows *
-                            ahp->ah_iniAddac.ia_columns), GFP_KERNEL);
-               if (ahp->ah_addac5416_21 == NULL) {
+                            ah->iniAddac.ia_rows *
+                            ah->iniAddac.ia_columns), GFP_KERNEL);
+               if (ah->addac5416_21 == NULL) {
                        DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
-                               "Cannot allocate ah_addac5416_21\n");
+                               "Cannot allocate addac5416_21\n");
                        *status = -ENOMEM;
                        return false;
                }
 
-               ahp->ah_bank6Temp =
+               ah->bank6Temp =
                    kzalloc((sizeof(u32) *
-                            ahp->ah_iniBank6.ia_rows), GFP_KERNEL);
-               if (ahp->ah_bank6Temp == NULL) {
+                            ah->iniBank6.ia_rows), GFP_KERNEL);
+               if (ah->bank6Temp == NULL) {
                        DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
-                               "Cannot allocate ah_bank6Temp\n");
+                               "Cannot allocate bank6Temp\n");
                        *status = -ENOMEM;
                        return false;
                }
@@ -378,24 +364,23 @@ bool ath9k_hw_init_rf(struct ath_hal *ah, int *status)
 }
 
 void
-ath9k_hw_decrease_chain_power(struct ath_hal *ah, struct ath9k_channel *chan)
+ath9k_hw_decrease_chain_power(struct ath_hw *ah, struct ath9k_channel *chan)
 {
        int i, regWrites = 0;
-       struct ath_hal_5416 *ahp = AH5416(ah);
        u32 bank6SelMask;
-       u32 *bank6Temp = ahp->ah_bank6Temp;
+       u32 *bank6Temp = ah->bank6Temp;
 
-       switch (ahp->ah_diversityControl) {
+       switch (ah->diversity_control) {
        case ATH9K_ANT_FIXED_A:
                bank6SelMask =
-                   (ahp->
-                    ah_antennaSwitchSwap & ANTSWAP_AB) ? REDUCE_CHAIN_0 :
+                   (ah->
+                    antenna_switch_swap & ANTSWAP_AB) ? REDUCE_CHAIN_0 :
                    REDUCE_CHAIN_1;
                break;
        case ATH9K_ANT_FIXED_B:
                bank6SelMask =
-                   (ahp->
-                    ah_antennaSwitchSwap & ANTSWAP_AB) ? REDUCE_CHAIN_1 :
+                   (ah->
+                    antenna_switch_swap & ANTSWAP_AB) ? REDUCE_CHAIN_1 :
                    REDUCE_CHAIN_0;
                break;
        case ATH9K_ANT_VARIABLE:
@@ -406,8 +391,8 @@ ath9k_hw_decrease_chain_power(struct ath_hal *ah, struct ath9k_channel *chan)
                break;
        }
 
-       for (i = 0; i < ahp->ah_iniBank6.ia_rows; i++)
-               bank6Temp[i] = ahp->ah_analogBank6Data[i];
+       for (i = 0; i < ah->iniBank6.ia_rows; i++)
+               bank6Temp[i] = ah->analogBank6Data[i];
 
        REG_WRITE(ah, AR_PHY_BASE + 0xD8, bank6SelMask);
 
@@ -421,7 +406,7 @@ ath9k_hw_decrease_chain_power(struct ath_hal *ah, struct ath9k_channel *chan)
        ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 246, 0);
        ath9k_phy_modify_rx_buffer(bank6Temp, 1, 1, 247, 0);
 
-       REG_WRITE_RF_ARRAY(&ahp->ah_iniBank6, bank6Temp, regWrites);
+       REG_WRITE_RF_ARRAY(&ah->iniBank6, bank6Temp, regWrites);
 
        REG_WRITE(ah, AR_PHY_BASE + 0xD8, 0x00000053);
 #ifdef ALTER_SWITCH
index 3a406a5c0593c624d0f4a5d3842778fdb342874e..837a598a7ae5196f28efaa32c9a1122875a181ec 100644 (file)
 #ifndef PHY_H
 #define PHY_H
 
-bool ath9k_hw_ar9280_set_channel(struct ath_hal *ah,
+bool ath9k_hw_ar9280_set_channel(struct ath_hw *ah,
                                 struct ath9k_channel
                                 *chan);
-bool ath9k_hw_set_channel(struct ath_hal *ah,
+bool ath9k_hw_set_channel(struct ath_hw *ah,
                          struct ath9k_channel *chan);
-void ath9k_hw_write_regs(struct ath_hal *ah, u32 modesIndex,
+void ath9k_hw_write_regs(struct ath_hw *ah, u32 modesIndex,
                         u32 freqIndex, int regWrites);
-bool ath9k_hw_set_rf_regs(struct ath_hal *ah,
+bool ath9k_hw_set_rf_regs(struct ath_hw *ah,
                          struct ath9k_channel *chan,
                          u16 modesIndex);
-void ath9k_hw_decrease_chain_power(struct ath_hal *ah,
+void ath9k_hw_decrease_chain_power(struct ath_hw *ah,
                                   struct ath9k_channel *chan);
-bool ath9k_hw_init_rf(struct ath_hal *ah,
+bool ath9k_hw_init_rf(struct ath_hw *ah,
                      int *status);
 
 #define AR_PHY_BASE     0x9800
@@ -533,7 +533,7 @@ bool ath9k_hw_init_rf(struct ath_hal *ah,
 #define ATH9K_KEY_XOR                 0xaa
 
 #define ATH9K_IS_MIC_ENABLED(ah)                                       \
-       (AH5416(ah)->ah_staId1Defaults & AR_STA_ID1_CRPT_MIC_ENABLE)
+       ((ah)->sta_id1_defaults & AR_STA_ID1_CRPT_MIC_ENABLE)
 
 #define ANTSWAP_AB 0x0001
 #define REDUCE_CHAIN_0 0x00000050
index 1b71b934bb5eb07ac979cf06684d16cfc090be01..a4e86319176669aae0cec0d49d02b8b98f032c7d 100644 (file)
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
+#include "ath9k.h"
 
 static struct ath_rate_table ar5416_11na_ratetable = {
        42,
-       {0},
        {
                { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */
                        5400, 0x0b, 0x00, 12,
                        0, 2, 1, 0, 0, 0, 0, 0 },
-               { VALID,        VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */
+               { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */
                        7800,  0x0f, 0x00, 18,
                        0, 3, 1, 1, 1, 1, 1, 0 },
                { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */
@@ -158,7 +157,6 @@ static struct ath_rate_table ar5416_11na_ratetable = {
 
 static struct ath_rate_table ar5416_11ng_ratetable = {
        46,
-       {0},
        {
                { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */
                        900, 0x1b, 0x00, 2,
@@ -306,7 +304,6 @@ static struct ath_rate_table ar5416_11ng_ratetable = {
 
 static struct ath_rate_table ar5416_11a_ratetable = {
        8,
-       {0},
        {
                { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */
                        5400, 0x0b, 0x00, (0x80|12),
@@ -340,7 +337,6 @@ static struct ath_rate_table ar5416_11a_ratetable = {
 
 static struct ath_rate_table ar5416_11g_ratetable = {
        12,
-       {0},
        {
                { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */
                        900, 0x1b, 0x00, 2,
@@ -386,7 +382,6 @@ static struct ath_rate_table ar5416_11g_ratetable = {
 
 static struct ath_rate_table ar5416_11b_ratetable = {
        4,
-       {0},
        {
                { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */
                        900, 0x1b,  0x00, (0x80|2),
@@ -636,8 +631,7 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv,
 static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
                             struct ath_rate_priv *ath_rc_priv,
                             struct ath_rate_table *rate_table,
-                            int probe_allowed, int *is_probing,
-                            int is_retry)
+                            int *is_probing)
 {
        u32 dt, best_thruput, this_thruput, now_msec;
        u8 rate, next_rate, best_rate, maxindex, minindex;
@@ -719,13 +713,6 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
        }
 
        rate = best_rate;
-
-       /* if we are retrying for more than half the number
-        * of max retries, use the min rate for the next retry
-        */
-       if (is_retry)
-               rate = ath_rc_priv->valid_rate_index[minindex];
-
        ath_rc_priv->rssi_last_lookup = rssi_last;
 
        /*
@@ -733,13 +720,12 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
         * non-monoticity of 11g's rate table
         */
 
-       if (rate >= ath_rc_priv->rate_max_phy && probe_allowed) {
+       if (rate >= ath_rc_priv->rate_max_phy) {
                rate = ath_rc_priv->rate_max_phy;
 
                /* Probe the next allowed phy state */
-               /* FIXME:XXXX Check to make sure ratMax is checked properly */
                if (ath_rc_get_nextvalid_txrate(rate_table,
-                                               ath_rc_priv, rate, &next_rate) &&
+                                       ath_rc_priv, rate, &next_rate) &&
                    (now_msec - ath_rc_priv->probe_time >
                     rate_table->probe_interval) &&
                    (ath_rc_priv->hw_maxretry_pktcnt >= 1)) {
@@ -761,14 +747,17 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc,
        return rate;
 }
 
-static void ath_rc_rate_set_series(struct ath_rate_table *rate_table ,
+static void ath_rc_rate_set_series(struct ath_rate_table *rate_table,
                                   struct ieee80211_tx_rate *rate,
+                                  struct ieee80211_tx_rate_control *txrc,
                                   u8 tries, u8 rix, int rtsctsenable)
 {
        rate->count = tries;
        rate->idx = rix;
 
-       if (rtsctsenable)
+       if (txrc->short_preamble)
+               rate->flags |= IEEE80211_TX_RC_USE_SHORT_PREAMBLE;
+       if (txrc->rts || rtsctsenable)
                rate->flags |= IEEE80211_TX_RC_USE_RTS_CTS;
        if (WLAN_RC_PHY_40(rate_table->info[rix].phy))
                rate->flags |= IEEE80211_TX_RC_40_MHZ_WIDTH;
@@ -778,6 +767,43 @@ static void ath_rc_rate_set_series(struct ath_rate_table *rate_table ,
                rate->flags |= IEEE80211_TX_RC_MCS;
 }
 
+static void ath_rc_rate_set_rtscts(struct ath_softc *sc,
+                                  struct ath_rate_table *rate_table,
+                                  struct ieee80211_tx_info *tx_info)
+{
+       struct ieee80211_tx_rate *rates = tx_info->control.rates;
+       int i = 0, rix = 0, cix, enable_g_protection = 0;
+
+       /* get the cix for the lowest valid rix */
+       for (i = 3; i >= 0; i--) {
+               if (rates[i].count && (rates[i].idx >= 0)) {
+                       rix = rates[i].idx;
+                       break;
+               }
+       }
+       cix = rate_table->info[rix].ctrl_rate;
+
+       /* All protection frames are transmited at 2Mb/s for 802.11g,
+        * otherwise we transmit them at 1Mb/s */
+       if (sc->hw->conf.channel->band == IEEE80211_BAND_2GHZ &&
+           !conf_is_ht(&sc->hw->conf))
+               enable_g_protection = 1;
+
+       /*
+        * If 802.11g protection is enabled, determine whether to use RTS/CTS or
+        * just CTS.  Note that this is only done for OFDM/HT unicast frames.
+        */
+       if ((sc->sc_flags & SC_OP_PROTECT_ENABLE) &&
+           !(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
+           (rate_table->info[rix].phy == WLAN_RC_PHY_OFDM ||
+            WLAN_RC_PHY_HT(rate_table->info[rix].phy))) {
+               rates[0].flags |= IEEE80211_TX_RC_USE_CTS_PROTECT;
+               cix = rate_table->info[enable_g_protection].ctrl_rate;
+       }
+
+       tx_info->control.rts_cts_rate_idx = cix;
+}
+
 static u8 ath_rc_rate_getidx(struct ath_softc *sc,
                             struct ath_rate_priv *ath_rc_priv,
                             struct ath_rate_table *rate_table,
@@ -809,54 +835,56 @@ static u8 ath_rc_rate_getidx(struct ath_softc *sc,
 
 static void ath_rc_ratefind(struct ath_softc *sc,
                            struct ath_rate_priv *ath_rc_priv,
-                           int num_tries, int num_rates,
-                           struct ieee80211_tx_info *tx_info, int *is_probe,
-                           int is_retry)
+                           struct ieee80211_tx_rate_control *txrc)
 {
-       u8 try_per_rate = 0, i = 0, rix, nrix;
        struct ath_rate_table *rate_table;
+       struct sk_buff *skb = txrc->skb;
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
        struct ieee80211_tx_rate *rates = tx_info->control.rates;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+       __le16 fc = hdr->frame_control;
+       u8 try_per_rate = 0, i = 0, rix, nrix;
+       int is_probe = 0;
 
        rate_table = sc->cur_rate_table;
-       rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, 1,
-                                is_probe, is_retry);
+       rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, &is_probe);
        nrix = rix;
 
-       if (*is_probe) {
+       if (is_probe) {
                /* set one try for probe rates. For the
                 * probes don't enable rts */
-               ath_rc_rate_set_series(rate_table,
-                       &rates[i++], 1, nrix, 0);
+               ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
+                                      1, nrix, 0);
 
-               try_per_rate = (num_tries/num_rates);
+               try_per_rate = (ATH_11N_TXMAXTRY/4);
                /* Get the next tried/allowed rate. No RTS for the next series
                 * after the probe rate
                 */
-               nrix = ath_rc_rate_getidx(sc,
-                       ath_rc_priv, rate_table, nrix, 1, 0);
-               ath_rc_rate_set_series(rate_table,
-                       &rates[i++], try_per_rate, nrix, 0);
+               nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
+                                         rate_table, nrix, 1, 0);
+               ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
+                                      try_per_rate, nrix, 0);
        } else {
-               try_per_rate = (num_tries/num_rates);
+               try_per_rate = (ATH_11N_TXMAXTRY/4);
                /* Set the choosen rate. No RTS for first series entry. */
-               ath_rc_rate_set_series(rate_table,
-                       &rates[i++], try_per_rate, nrix, 0);
+               ath_rc_rate_set_series(rate_table, &rates[i++], txrc,
+                                      try_per_rate, nrix, 0);
        }
 
        /* Fill in the other rates for multirate retry */
-       for ( ; i < num_rates; i++) {
+       for ( ; i < 4; i++) {
                u8 try_num;
                u8 min_rate;
 
-               try_num = ((i + 1) == num_rates) ?
-                       num_tries - (try_per_rate * i) : try_per_rate ;
-               min_rate = (((i + 1) == num_rates) && 0);
+               try_num = ((i + 1) == 4) ?
+                       ATH_11N_TXMAXTRY - (try_per_rate * i) : try_per_rate ;
+               min_rate = (((i + 1) == 4) && 0);
 
                nrix = ath_rc_rate_getidx(sc, ath_rc_priv,
                                          rate_table, nrix, 1, min_rate);
                /* All other rates in the series have RTS enabled */
-               ath_rc_rate_set_series(rate_table,
-                                      &rates[i], try_num, nrix, 1);
+               ath_rc_rate_set_series(rate_table, &rates[i], txrc,
+                                      try_num, nrix, 1);
        }
 
        /*
@@ -875,7 +903,7 @@ static void ath_rc_ratefind(struct ath_softc *sc,
         * above conditions.
         */
        if ((sc->hw->conf.channel->band == IEEE80211_BAND_2GHZ) &&
-           (sc->hw->conf.ht.enabled)) {
+           (conf_is_ht(&sc->hw->conf))) {
                u8 dot11rate = rate_table->info[rix].dot11rate;
                u8 phy = rate_table->info[rix].phy;
                if (i == 4 &&
@@ -885,6 +913,24 @@ static void ath_rc_ratefind(struct ath_softc *sc,
                        rates[3].flags = rates[2].flags;
                }
        }
+
+       /*
+        * Force hardware to use computed duration for next
+        * fragment by disabling multi-rate retry, which
+        * updates duration based on the multi-rate duration table.
+        *
+        * FIXME: Fix duration
+        */
+       if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK) &&
+           (ieee80211_has_morefrags(fc) ||
+            (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG))) {
+               rates[1].count = rates[2].count = rates[3].count = 0;
+               rates[1].idx = rates[2].idx = rates[3].idx = 0;
+               rates[0].count = ATH_TXMAXTRY;
+       }
+
+       /* Setup RTS/CTS */
+       ath_rc_rate_set_rtscts(sc, rate_table, tx_info);
 }
 
 static bool ath_rc_update_per(struct ath_softc *sc,
@@ -1221,6 +1267,8 @@ static void ath_rc_update_ht(struct ath_softc *sc,
                ath_rc_priv->per_down_time = now_msec;
        }
 
+       ath_debug_stat_retries(sc, tx_rate, xretries, retries);
+
 #undef CHK_RSSI
 }
 
@@ -1346,13 +1394,13 @@ static void ath_rc_init(struct ath_softc *sc,
        u8 i, j, k, hi = 0, hthi = 0;
 
        /* FIXME: Adhoc */
-       if ((sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION) ||
-           (sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC)) {
+       if ((sc->sc_ah->opmode == NL80211_IFTYPE_STATION) ||
+           (sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)) {
                bool is_cw_40 = sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40;
                rate_table = ath_choose_rate_table(sc, sband->band,
                                                   sta->ht_cap.ht_supported,
                                                   is_cw_40);
-       } else if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP) {
+       } else if (sc->sc_ah->opmode == NL80211_IFTYPE_AP) {
                /* cur_rate_table would be set on init through config() */
                rate_table = sc->cur_rate_table;
        }
@@ -1363,9 +1411,13 @@ static void ath_rc_init(struct ath_softc *sc,
        }
 
        if (sta->ht_cap.ht_supported) {
-               ath_rc_priv->ht_cap = (WLAN_RC_HT_FLAG | WLAN_RC_DS_FLAG);
+               ath_rc_priv->ht_cap = WLAN_RC_HT_FLAG;
+               if (sc->sc_ah->caps.tx_chainmask != 1)
+                       ath_rc_priv->ht_cap |= WLAN_RC_DS_FLAG;
                if (sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40)
                        ath_rc_priv->ht_cap |= WLAN_RC_40_FLAG;
+               if (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40)
+                       ath_rc_priv->ht_cap |= WLAN_RC_SGI_FLAG;
        }
 
        /* Initial rate table size. Will change depending
@@ -1395,16 +1447,16 @@ static void ath_rc_init(struct ath_softc *sc,
        if (!rateset->rs_nrates) {
                /* No working rate, just initialize valid rates */
                hi = ath_rc_init_validrates(ath_rc_priv, rate_table,
-                                               ath_rc_priv->ht_cap);
+                                           ath_rc_priv->ht_cap);
        } else {
                /* Use intersection of working rates and valid rates */
                hi = ath_rc_setvalid_rates(ath_rc_priv, rate_table,
-                                              rateset, ath_rc_priv->ht_cap);
+                                          rateset, ath_rc_priv->ht_cap);
                if (ath_rc_priv->ht_cap & WLAN_RC_HT_FLAG) {
                        hthi = ath_rc_setvalid_htrates(ath_rc_priv,
-                                                          rate_table,
-                                                          ht_mcs,
-                                                          ath_rc_priv->ht_cap);
+                                                      rate_table,
+                                                      ht_mcs,
+                                                      ath_rc_priv->ht_cap);
                }
                hi = A_MAX(hi, hthi);
        }
@@ -1467,7 +1519,7 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
         */
        if (tx_info_priv->tx.ts_flags &
            (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN) &&
-           ((sc->sc_ah->ah_txTrigLevel) >= ath_rc_priv->tx_triglevel_max)) {
+           ((sc->sc_ah->tx_trig_level) >= ath_rc_priv->tx_triglevel_max)) {
                tx_status = 1;
                is_underrun = 1;
        }
@@ -1480,6 +1532,22 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband,
                         (is_underrun) ? ATH_11N_TXMAXTRY :
                         tx_info_priv->tx.ts_longretry);
 
+       /* Check if aggregation has to be enabled for this tid */
+       if (conf_is_ht(&sc->hw->conf)) {
+               if (ieee80211_is_data_qos(fc)) {
+                       u8 *qc, tid;
+                       struct ath_node *an;
+
+                       qc = ieee80211_get_qos_ctl(hdr);
+                       tid = qc[0] & 0xf;
+                       an = (struct ath_node *)sta->drv_priv;
+
+                       if(ath_tx_aggr_check(sc, an, tid))
+                               ieee80211_start_tx_ba_session(sc->hw, hdr->addr1, tid);
+               }
+       }
+
+       ath_debug_stat_rc(sc, skb);
 exit:
        kfree(tx_info_priv);
 }
@@ -1490,11 +1558,9 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
        struct ieee80211_supported_band *sband = txrc->sband;
        struct sk_buff *skb = txrc->skb;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
        struct ath_softc *sc = priv;
-       struct ieee80211_hw *hw = sc->hw;
        struct ath_rate_priv *ath_rc_priv = priv_sta;
-       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-       int is_probe = 0;
        __le16 fc = hdr->frame_control;
 
        /* lowest rate for management and multicast/broadcast frames */
@@ -1507,23 +1573,7 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta,
        }
 
        /* Find tx rate for unicast frames */
-       ath_rc_ratefind(sc, ath_rc_priv, ATH_11N_TXMAXTRY, 4,
-                       tx_info, &is_probe, false);
-
-       /* Check if aggregation has to be enabled for this tid */
-       if (hw->conf.ht.enabled) {
-               if (ieee80211_is_data_qos(fc)) {
-                       u8 *qc, tid;
-                       struct ath_node *an;
-
-                       qc = ieee80211_get_qos_ctl(hdr);
-                       tid = qc[0] & 0xf;
-                       an = (struct ath_node *)sta->drv_priv;
-
-                       if(ath_tx_aggr_check(sc, an, tid))
-                               ieee80211_start_tx_ba_session(hw, hdr->addr1, tid);
-               }
-       }
+       ath_rc_ratefind(sc, ath_rc_priv, txrc);
 }
 
 static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
@@ -1578,7 +1628,7 @@ static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp
        }
 
        rate_priv->rssi_down_time = jiffies_to_msecs(jiffies);
-       rate_priv->tx_triglevel_max = sc->sc_ah->ah_caps.tx_triglevel_max;
+       rate_priv->tx_triglevel_max = sc->sc_ah->caps.tx_triglevel_max;
 
        return rate_priv;
 }
@@ -1607,16 +1657,8 @@ static void ath_setup_rate_table(struct ath_softc *sc,
 {
        int i;
 
-       for (i = 0; i < 256; i++)
-               rate_table->rateCodeToIndex[i] = (u8)-1;
-
        for (i = 0; i < rate_table->rate_cnt; i++) {
-               u8 code = rate_table->info[i].ratecode;
                u8 cix = rate_table->info[i].ctrl_rate;
-               u8 sh = rate_table->info[i].short_preamble;
-
-               rate_table->rateCodeToIndex[code] = i;
-               rate_table->rateCodeToIndex[code | sh] = i;
 
                rate_table->info[i].lpAckDuration =
                        ath9k_hw_computetxtime(sc->sc_ah, rate_table,
index 97c60d12e8aa51cbfc7e34cff14869a556888908..d688ec51a14fa8cca27b4266290aa58489c69d4b 100644 (file)
 #ifndef RC_H
 #define RC_H
 
-#include "ath9k.h"
-
 struct ath_softc;
 
 #define ATH_RATE_MAX     30
 #define RATE_TABLE_SIZE  64
 #define MAX_TX_RATE_PHY  48
+#define WLAN_CTRL_FRAME_SIZE (2+2+6+4)
 
 /* VALID_ALL - valid for 20/40/Legacy,
  * VALID - Legacy only,
@@ -39,6 +38,20 @@ struct ath_softc;
 #define VALID_2040 (VALID_20|VALID_40)
 #define VALID_ALL  (VALID_2040|VALID)
 
+enum {
+       WLAN_RC_PHY_OFDM,
+       WLAN_RC_PHY_CCK,
+       WLAN_RC_PHY_HT_20_SS,
+       WLAN_RC_PHY_HT_20_DS,
+       WLAN_RC_PHY_HT_40_SS,
+       WLAN_RC_PHY_HT_40_DS,
+       WLAN_RC_PHY_HT_20_SS_HGI,
+       WLAN_RC_PHY_HT_20_DS_HGI,
+       WLAN_RC_PHY_HT_40_SS_HGI,
+       WLAN_RC_PHY_HT_40_DS_HGI,
+       WLAN_RC_PHY_MAX
+};
+
 #define WLAN_RC_PHY_DS(_phy)   ((_phy == WLAN_RC_PHY_HT_20_DS)         \
                                || (_phy == WLAN_RC_PHY_HT_40_DS)       \
                                || (_phy == WLAN_RC_PHY_HT_20_DS_HGI)   \
@@ -90,7 +103,6 @@ struct ath_softc;
  */
 struct ath_rate_table {
        int rate_cnt;
-       u8 rateCodeToIndex[256];
        struct {
                int valid;
                int valid_single_stream;
index 462e08c3d09dc4cf18693f4e39c383a7dc34c580..08f676af894f0cbd9d3b98185b6aba6663751774 100644 (file)
@@ -14,7 +14,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
+#include "ath9k.h"
 
 /*
  * Setup and link descriptors.
@@ -26,7 +26,7 @@
  */
 static void ath_rx_buf_link(struct ath_softc *sc, struct ath_buf *bf)
 {
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        struct ath_desc *ds;
        struct sk_buff *skb;
 
@@ -97,11 +97,11 @@ static struct sk_buff *ath_rxbuf_alloc(struct ath_softc *sc, u32 len)
         * Unfortunately this means we may get 8 KB here from the
         * kernel... and that is actually what is observed on some
         * systems :( */
-       skb = dev_alloc_skb(len + sc->sc_cachelsz - 1);
+       skb = dev_alloc_skb(len + sc->cachelsz - 1);
        if (skb != NULL) {
-               off = ((unsigned long) skb->data) % sc->sc_cachelsz;
+               off = ((unsigned long) skb->data) % sc->cachelsz;
                if (off != 0)
-                       skb_reserve(skb, sc->sc_cachelsz - off);
+                       skb_reserve(skb, sc->cachelsz - off);
        } else {
                DPRINTF(sc, ATH_DBG_FATAL,
                        "skbuff alloc of size %u failed\n", len);
@@ -135,7 +135,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
                 * discard the frame. Enable this if you want to see
                 * error frames in Monitor mode.
                 */
-               if (sc->sc_ah->ah_opmode != NL80211_IFTYPE_MONITOR)
+               if (sc->sc_ah->opmode != NL80211_IFTYPE_MONITOR)
                        goto rx_next;
        } else if (ds->ds_rxstat.rs_status != 0) {
                if (ds->ds_rxstat.rs_status & ATH9K_RXERR_CRC)
@@ -161,7 +161,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
                 * decryption and MIC failures. For monitor mode,
                 * we also ignore the CRC error.
                 */
-               if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_MONITOR) {
+               if (sc->sc_ah->opmode == NL80211_IFTYPE_MONITOR) {
                        if (ds->ds_rxstat.rs_status &
                            ~(ATH9K_RXERR_DECRYPT | ATH9K_RXERR_MIC |
                              ATH9K_RXERR_CRC))
@@ -210,7 +210,7 @@ static int ath_rx_prepare(struct sk_buff *skb, struct ath_desc *ds,
        rx_status->mactime = ath_extend_tsf(sc, ds->ds_rxstat.rs_tstamp);
        rx_status->band = sc->hw->conf.channel->band;
        rx_status->freq =  sc->hw->conf.channel->center_freq;
-       rx_status->noise = sc->sc_ani.sc_noise_floor;
+       rx_status->noise = sc->ani.noise_floor;
        rx_status->signal = rx_status->noise + ds->ds_rxstat.rs_rssi;
        rx_status->antenna = ds->ds_rxstat.rs_antenna;
 
@@ -233,7 +233,7 @@ rx_next:
 
 static void ath_opmode_init(struct ath_softc *sc)
 {
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        u32 rfilt, mfilt[2];
 
        /* configure rx filter */
@@ -241,14 +241,14 @@ static void ath_opmode_init(struct ath_softc *sc)
        ath9k_hw_setrxfilter(ah, rfilt);
 
        /* configure bssid mask */
-       if (ah->ah_caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
-               ath9k_hw_setbssidmask(ah, sc->sc_bssidmask);
+       if (ah->caps.hw_caps & ATH9K_HW_CAP_BSSIDMASK)
+               ath9k_hw_setbssidmask(sc);
 
        /* configure operational mode */
        ath9k_hw_setopmode(ah);
 
        /* Handle any link-level address change. */
-       ath9k_hw_setmac(ah, sc->sc_myaddr);
+       ath9k_hw_setmac(ah, sc->sc_ah->macaddr);
 
        /* calculate and install multicast filter */
        mfilt[0] = mfilt[1] = ~0;
@@ -267,11 +267,11 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
                spin_lock_init(&sc->rx.rxbuflock);
 
                sc->rx.bufsize = roundup(IEEE80211_MAX_MPDU_LEN,
-                                          min(sc->sc_cachelsz,
+                                          min(sc->cachelsz,
                                               (u16)64));
 
                DPRINTF(sc, ATH_DBG_CONFIG, "cachelsz %u rxbufsize %u\n",
-                       sc->sc_cachelsz, sc->rx.bufsize);
+                       sc->cachelsz, sc->rx.bufsize);
 
                /* Initialize rx descriptors */
 
@@ -291,15 +291,15 @@ int ath_rx_init(struct ath_softc *sc, int nbufs)
                        }
 
                        bf->bf_mpdu = skb;
-                       bf->bf_buf_addr = pci_map_single(sc->pdev, skb->data,
+                       bf->bf_buf_addr = dma_map_single(sc->dev, skb->data,
                                                         sc->rx.bufsize,
-                                                        PCI_DMA_FROMDEVICE);
-                       if (unlikely(pci_dma_mapping_error(sc->pdev,
+                                                        DMA_FROM_DEVICE);
+                       if (unlikely(dma_mapping_error(sc->dev,
                                  bf->bf_buf_addr))) {
                                dev_kfree_skb_any(skb);
                                bf->bf_mpdu = NULL;
                                DPRINTF(sc, ATH_DBG_CONFIG,
-                                       "pci_dma_mapping_error() on RX init\n");
+                                       "dma_mapping_error() on RX init\n");
                                error = -ENOMEM;
                                break;
                        }
@@ -360,25 +360,28 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
                | ATH9K_RX_FILTER_MCAST;
 
        /* If not a STA, enable processing of Probe Requests */
-       if (sc->sc_ah->ah_opmode != NL80211_IFTYPE_STATION)
+       if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
                rfilt |= ATH9K_RX_FILTER_PROBEREQ;
 
        /* Can't set HOSTAP into promiscous mode */
-       if (((sc->sc_ah->ah_opmode != NL80211_IFTYPE_AP) &&
+       if (((sc->sc_ah->opmode != NL80211_IFTYPE_AP) &&
             (sc->rx.rxfilter & FIF_PROMISC_IN_BSS)) ||
-           (sc->sc_ah->ah_opmode == NL80211_IFTYPE_MONITOR)) {
+           (sc->sc_ah->opmode == NL80211_IFTYPE_MONITOR)) {
                rfilt |= ATH9K_RX_FILTER_PROM;
                /* ??? To prevent from sending ACK */
                rfilt &= ~ATH9K_RX_FILTER_UCAST;
        }
 
-       if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_STATION ||
-           sc->sc_ah->ah_opmode == NL80211_IFTYPE_ADHOC)
+       if (sc->rx.rxfilter & FIF_CONTROL)
+               rfilt |= ATH9K_RX_FILTER_CONTROL;
+
+       if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION ||
+           sc->sc_ah->opmode == NL80211_IFTYPE_ADHOC)
                rfilt |= ATH9K_RX_FILTER_BEACON;
 
        /* If in HOSTAP mode, want to enable reception of PSPOLL frames
           & beacon frames */
-       if (sc->sc_ah->ah_opmode == NL80211_IFTYPE_AP)
+       if (sc->sc_ah->opmode == NL80211_IFTYPE_AP)
                rfilt |= (ATH9K_RX_FILTER_BEACON | ATH9K_RX_FILTER_PSPOLL);
 
        return rfilt;
@@ -388,7 +391,7 @@ u32 ath_calcrxfilter(struct ath_softc *sc)
 
 int ath_startrecv(struct ath_softc *sc)
 {
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        struct ath_buf *bf, *tbf;
 
        spin_lock_bh(&sc->rx.rxbuflock);
@@ -418,7 +421,7 @@ start_recv:
 
 bool ath_stoprecv(struct ath_softc *sc)
 {
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        bool stopped;
 
        ath9k_hw_stoppcurecv(ah);
@@ -449,7 +452,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
        struct ath_desc *ds;
        struct sk_buff *skb = NULL, *requeue_skb;
        struct ieee80211_rx_status rx_status;
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        struct ieee80211_hdr *hdr;
        int hdrlen, padsize, retval;
        bool decrypt_error = false;
@@ -524,9 +527,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
                 * 1. accessing the frame
                 * 2. requeueing the same buffer to h/w
                 */
-               pci_dma_sync_single_for_cpu(sc->pdev, bf->bf_buf_addr,
+               dma_sync_single_for_cpu(sc->dev, bf->bf_buf_addr,
                                sc->rx.bufsize,
-                               PCI_DMA_FROMDEVICE);
+                               DMA_FROM_DEVICE);
 
                /*
                 * If we're asked to flush receive queue, directly
@@ -557,9 +560,9 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
                        goto requeue;
 
                /* Unmap the frame */
-               pci_unmap_single(sc->pdev, bf->bf_buf_addr,
+               dma_unmap_single(sc->dev, bf->bf_buf_addr,
                                 sc->rx.bufsize,
-                                PCI_DMA_FROMDEVICE);
+                                DMA_FROM_DEVICE);
 
                skb_put(skb, ds->ds_rxstat.rs_datalen);
                skb->protocol = cpu_to_be16(ETH_P_CONTROL);
@@ -590,24 +593,30 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
                           && !decrypt_error && skb->len >= hdrlen + 4) {
                        keyix = skb->data[hdrlen + 3] >> 6;
 
-                       if (test_bit(keyix, sc->sc_keymap))
+                       if (test_bit(keyix, sc->keymap))
                                rx_status.flag |= RX_FLAG_DECRYPTED;
                }
+               if (ah->sw_mgmt_crypto &&
+                   (rx_status.flag & RX_FLAG_DECRYPTED) &&
+                   ieee80211_is_mgmt(hdr->frame_control)) {
+                       /* Use software decrypt for management frames. */
+                       rx_status.flag &= ~RX_FLAG_DECRYPTED;
+               }
 
                /* Send the frame to mac80211 */
                __ieee80211_rx(sc->hw, skb, &rx_status);
 
                /* We will now give hardware our shiny new allocated skb */
                bf->bf_mpdu = requeue_skb;
-               bf->bf_buf_addr = pci_map_single(sc->pdev, requeue_skb->data,
+               bf->bf_buf_addr = dma_map_single(sc->dev, requeue_skb->data,
                                         sc->rx.bufsize,
-                                        PCI_DMA_FROMDEVICE);
-               if (unlikely(pci_dma_mapping_error(sc->pdev,
+                                        DMA_FROM_DEVICE);
+               if (unlikely(dma_mapping_error(sc->dev,
                          bf->bf_buf_addr))) {
                        dev_kfree_skb_any(requeue_skb);
                        bf->bf_mpdu = NULL;
                        DPRINTF(sc, ATH_DBG_CONFIG,
-                               "pci_dma_mapping_error() on RX\n");
+                               "dma_mapping_error() on RX\n");
                        break;
                }
                bf->bf_dmacontext = bf->bf_buf_addr;
@@ -622,6 +631,12 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush)
                } else {
                        sc->rx.rxotherant = 0;
                }
+
+               if (ieee80211_is_beacon(hdr->frame_control) &&
+                               (sc->sc_flags & SC_OP_WAIT_FOR_BEACON)) {
+                       sc->sc_flags &= ~SC_OP_WAIT_FOR_BEACON;
+                       ath9k_hw_setpower(sc->sc_ah, ATH9K_PM_NETWORK_SLEEP);
+               }
 requeue:
                list_move_tail(&bf->list, &sc->rx.rxbuf);
                ath_rx_buf_link(sc, bf);
index 9fedb4911bc30b859ca87d907bdb8357c7a80178..17ed190349a53e6088c83fe209287be7f004aa07 100644 (file)
 
 #define AR_SREV_VERSION_9100                  0x014
 
+#define AR_SREV_9100(ah) ((ah->hw_version.macVersion) == AR_SREV_VERSION_9100)
 #define AR_SREV_5416_V20_OR_LATER(_ah) \
        (AR_SREV_9100((_ah)) || AR_SREV_5416_20_OR_LATER(_ah))
 #define AR_SREV_5416_V22_OR_LATER(_ah) \
 #define AR_SREV_REVISION_9285_12              2
 
 #define AR_SREV_9100_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion >= AR_SREV_VERSION_5416_PCIE))
+       (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_5416_PCIE))
 #define AR_SREV_5416_20_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion >= AR_SREV_VERSION_9160) || \
-               ((_ah)->ah_macRev >= AR_SREV_REVISION_5416_20))
+       (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9160) || \
+               ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_20))
 #define AR_SREV_5416_22_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion >= AR_SREV_VERSION_9160) || \
-               ((_ah)->ah_macRev >= AR_SREV_REVISION_5416_22))
+       (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9160) || \
+               ((_ah)->hw_version.macRev >= AR_SREV_REVISION_5416_22))
 #define AR_SREV_9160(_ah) \
-       (((_ah)->ah_macVersion == AR_SREV_VERSION_9160))
+       (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9160))
 #define AR_SREV_9160_10_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion >= AR_SREV_VERSION_9160))
+       (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9160))
 #define AR_SREV_9160_11(_ah) \
-       (AR_SREV_9160(_ah) && ((_ah)->ah_macRev == AR_SREV_REVISION_9160_11))
+       (AR_SREV_9160(_ah) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9160_11))
 #define AR_SREV_9280(_ah) \
-       (((_ah)->ah_macVersion == AR_SREV_VERSION_9280))
+       (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280))
 #define AR_SREV_9280_10_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion >= AR_SREV_VERSION_9280))
+       (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9280))
 #define AR_SREV_9280_20(_ah) \
-       (((_ah)->ah_macVersion == AR_SREV_VERSION_9280) && \
-               ((_ah)->ah_macRev >= AR_SREV_REVISION_9280_20))
+       (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280) && \
+               ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9280_20))
 #define AR_SREV_9280_20_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion > AR_SREV_VERSION_9280) || \
-       (((_ah)->ah_macVersion == AR_SREV_VERSION_9280) && \
-       ((_ah)->ah_macRev >= AR_SREV_REVISION_9280_20)))
+       (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9280) || \
+       (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9280) && \
+       ((_ah)->hw_version.macRev >= AR_SREV_REVISION_9280_20)))
 
-#define AR_SREV_9285(_ah) (((_ah)->ah_macVersion == AR_SREV_VERSION_9285))
+#define AR_SREV_9285(_ah) \
+       (((_ah)->hw_version.macVersion == AR_SREV_VERSION_9285))
 #define AR_SREV_9285_10_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion >= AR_SREV_VERSION_9285))
+       (((_ah)->hw_version.macVersion >= AR_SREV_VERSION_9285))
 #define AR_SREV_9285_11(_ah) \
-       (AR_SREV_9280(ah) && ((_ah)->ah_macRev == AR_SREV_REVISION_9285_11))
+       (AR_SREV_9280(ah) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9285_11))
 #define AR_SREV_9285_11_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion > AR_SREV_VERSION_9285) || \
-        (AR_SREV_9285(ah) && ((_ah)->ah_macRev >= AR_SREV_REVISION_9285_11)))
+       (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9285) || \
+        (AR_SREV_9285(ah) && ((_ah)->hw_version.macRev >= \
+                              AR_SREV_REVISION_9285_11)))
 #define AR_SREV_9285_12(_ah) \
-       (AR_SREV_9280(ah) && ((_ah)->ah_macRev == AR_SREV_REVISION_9285_12))
+       (AR_SREV_9280(ah) && \
+        ((_ah)->hw_version.macRev == AR_SREV_REVISION_9285_12))
 #define AR_SREV_9285_12_OR_LATER(_ah) \
-       (((_ah)->ah_macVersion > AR_SREV_VERSION_9285) || \
-        (AR_SREV_9285(ah) && ((_ah)->ah_macRev >= AR_SREV_REVISION_9285_12)))
+       (((_ah)->hw_version.macVersion > AR_SREV_VERSION_9285) || \
+        (AR_SREV_9285(ah) && ((_ah)->hw_version.macRev >= \
+                              AR_SREV_REVISION_9285_12)))
 
 #define AR_RADIO_SREV_MAJOR                   0xf0
 #define AR_RAD5133_SREV_MAJOR                 0xc0
@@ -875,12 +882,15 @@ enum {
 
 #define AR_NUM_GPIO                              14
 #define AR928X_NUM_GPIO                          10
+#define AR9285_NUM_GPIO                          12
 
 #define AR_GPIO_IN_OUT                           0x4048
 #define AR_GPIO_IN_VAL                           0x0FFFC000
 #define AR_GPIO_IN_VAL_S                         14
 #define AR928X_GPIO_IN_VAL                       0x000FFC00
 #define AR928X_GPIO_IN_VAL_S                     10
+#define AR9285_GPIO_IN_VAL                       0x00FFF000
+#define AR9285_GPIO_IN_VAL_S                     12
 
 #define AR_GPIO_OE_OUT                           0x404c
 #define AR_GPIO_OE_OUT_DRV                       0x3
@@ -894,14 +904,24 @@ enum {
 #define AR_GPIO_INTR_POL_VAL_S                   0
 
 #define AR_GPIO_INPUT_EN_VAL                     0x4054
+#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_DEF     0x00000004
+#define AR_GPIO_INPUT_EN_VAL_BT_PRIORITY_S       2
+#define AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_DEF    0x00000008
+#define AR_GPIO_INPUT_EN_VAL_BT_FREQUENCY_S      3
+#define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_DEF       0x00000010
+#define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_S         4
 #define AR_GPIO_INPUT_EN_VAL_RFSILENT_DEF        0x00000080
 #define AR_GPIO_INPUT_EN_VAL_RFSILENT_DEF_S      7
+#define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB        0x00001000
+#define AR_GPIO_INPUT_EN_VAL_BT_ACTIVE_BB_S      12
 #define AR_GPIO_INPUT_EN_VAL_RFSILENT_BB         0x00008000
 #define AR_GPIO_INPUT_EN_VAL_RFSILENT_BB_S       15
 #define AR_GPIO_RTC_RESET_OVERRIDE_ENABLE        0x00010000
 #define AR_GPIO_JTAG_DISABLE                     0x00020000
 
 #define AR_GPIO_INPUT_MUX1                       0x4058
+#define AR_GPIO_INPUT_MUX1_BT_ACTIVE             0x000f0000
+#define AR_GPIO_INPUT_MUX1_BT_ACTIVE_S           16
 
 #define AR_GPIO_INPUT_MUX2                       0x405c
 #define AR_GPIO_INPUT_MUX2_CLK25                 0x0000000f
@@ -940,7 +960,7 @@ enum {
 
 #define AR_RTC_BASE             0x00020000
 #define AR_RTC_RC \
-       (AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0000) : 0x7000
+       ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0000) : 0x7000)
 #define AR_RTC_RC_M            0x00000003
 #define AR_RTC_RC_MAC_WARM      0x00000001
 #define AR_RTC_RC_MAC_COLD      0x00000002
@@ -948,7 +968,7 @@ enum {
 #define AR_RTC_RC_WARM_RESET    0x00000008
 
 #define AR_RTC_PLL_CONTROL \
-       (AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0014) : 0x7014
+       ((AR_SREV_9100(ah)) ? (AR_RTC_BASE + 0x0014) : 0x7014)
 
 #define AR_RTC_PLL_DIV          0x0000001f
 #define AR_RTC_PLL_DIV_S        0
@@ -1021,6 +1041,10 @@ enum {
 #define AR_AN_RF5G1_CH1_DB5     0x00380000
 #define AR_AN_RF5G1_CH1_DB5_S   19
 
+#define AR_AN_TOP1                  0x7890
+#define AR_AN_TOP1_DACIPMODE       0x00040000
+#define AR_AN_TOP1_DACIPMODE_S     18
+
 #define AR_AN_TOP2                  0x7894
 #define AR_AN_TOP2_XPABIAS_LVL      0xC0000000
 #define AR_AN_TOP2_XPABIAS_LVL_S    30
@@ -1181,18 +1205,7 @@ enum {
 #define AR_CFP_VAL          0x0000FFFF
 
 #define AR_RX_FILTER        0x803C
-#define AR_RX_FILTER_ALL    0x00000000
-#define AR_RX_UCAST         0x00000001
-#define AR_RX_MCAST         0x00000002
-#define AR_RX_BCAST         0x00000004
-#define AR_RX_CONTROL       0x00000008
-#define AR_RX_BEACON        0x00000010
-#define AR_RX_PROM          0x00000020
-#define AR_RX_PROBE_REQ     0x00000080
-#define AR_RX_MY_BEACON     0x00000200
 #define AR_RX_COMPR_BAR     0x00000400
-#define AR_RX_COMPR_BA      0x00000800
-#define AR_RX_UNCOM_BA_BAR  0x00001000
 
 #define AR_MCAST_FIL0       0x8040
 #define AR_MCAST_FIL1       0x8044
@@ -1236,6 +1249,8 @@ enum {
 
 #define AR_AES_MUTE_MASK1       0x8060
 #define AR_AES_MUTE_MASK1_SEQ   0x0000FFFF
+#define AR_AES_MUTE_MASK1_FC_MGMT 0xFFFF0000
+#define AR_AES_MUTE_MASK1_FC_MGMT_S 16
 
 #define AR_GATED_CLKS       0x8064
 #define AR_GATED_CLKS_TX    0x00000002
@@ -1460,6 +1475,10 @@ enum {
 #define AR_PCU_TXBUF_CTRL_USABLE_SIZE   0x700
 #define AR_9285_PCU_TXBUF_CTRL_USABLE_SIZE   0x380
 
+#define AR_PCU_MISC_MODE2               0x8344
+#define AR_PCU_MISC_MODE2_MGMT_CRYPTO_ENABLE           0x00000002
+#define AR_PCU_MISC_MODE2_NO_CRYPTO_FOR_NON_DATA_PKT   0x00000004
+
 #define AR_KEYTABLE_0           0x8800
 #define AR_KEYTABLE(_n)         (AR_KEYTABLE_0 + ((_n)*32))
 #define AR_KEY_CACHE_SIZE       128
index 64043e99facff0faef1838b01ca214c2d2f7c9b8..8c2b56ac55ff250c68f8914d00c3c2377a8cfea6 100644 (file)
 
 #include <linux/kernel.h>
 #include <linux/slab.h>
-#include "core.h"
-#include "hw.h"
-#include "regd.h"
+#include "ath9k.h"
 #include "regd_common.h"
 
-static int ath9k_regd_chansort(const void *a, const void *b)
-{
-       const struct ath9k_channel *ca = a;
-       const struct ath9k_channel *cb = b;
+/*
+ * This is a set of common rules used by our world regulatory domains.
+ * We have 12 world regulatory domains. To save space we consolidate
+ * the regulatory domains in 5 structures by frequency and change
+ * the flags on our reg_notifier() on a case by case basis.
+ */
 
-       return (ca->channel == cb->channel) ?
-           (ca->channelFlags & CHAN_FLAGS) -
-           (cb->channelFlags & CHAN_FLAGS) : ca->channel - cb->channel;
+/* Only these channels all allow active scan on all world regulatory domains */
+#define ATH9K_2GHZ_CH01_11     REG_RULE(2412-10, 2462+10, 40, 0, 20, 0)
+
+/* We enable active scan on these a case by case basis by regulatory domain */
+#define ATH9K_2GHZ_CH12_13     REG_RULE(2467-10, 2472+10, 40, 0, 20,\
+                                       NL80211_RRF_PASSIVE_SCAN)
+#define ATH9K_2GHZ_CH14                REG_RULE(2484-10, 2484+10, 40, 0, 20,\
+                               NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_OFDM)
+
+/* We allow IBSS on these on a case by case basis by regulatory domain */
+#define ATH9K_5GHZ_5150_5350   REG_RULE(5150-10, 5350+10, 40, 0, 30,\
+                               NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
+#define ATH9K_5GHZ_5470_5850   REG_RULE(5470-10, 5850+10, 40, 0, 30,\
+                               NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
+#define ATH9K_5GHZ_5725_5850   REG_RULE(5725-10, 5850+10, 40, 0, 30,\
+                               NL80211_RRF_PASSIVE_SCAN | NL80211_RRF_NO_IBSS)
+
+#define ATH9K_2GHZ_ALL         ATH9K_2GHZ_CH01_11, \
+                               ATH9K_2GHZ_CH12_13, \
+                               ATH9K_2GHZ_CH14
+
+#define ATH9K_5GHZ_ALL         ATH9K_5GHZ_5150_5350, \
+                               ATH9K_5GHZ_5470_5850
+/* This one skips what we call "mid band" */
+#define ATH9K_5GHZ_NO_MIDBAND  ATH9K_5GHZ_5150_5350, \
+                               ATH9K_5GHZ_5725_5850
+
+/* Can be used for:
+ * 0x60, 0x61, 0x62 */
+static const struct ieee80211_regdomain ath9k_world_regdom_60_61_62 = {
+       .n_reg_rules = 5,
+       .alpha2 =  "99",
+       .reg_rules = {
+               ATH9K_2GHZ_ALL,
+               ATH9K_5GHZ_ALL,
+       }
+};
+
+/* Can be used by 0x63 and 0x65 */
+static const struct ieee80211_regdomain ath9k_world_regdom_63_65 = {
+       .n_reg_rules = 4,
+       .alpha2 =  "99",
+       .reg_rules = {
+               ATH9K_2GHZ_CH01_11,
+               ATH9K_2GHZ_CH12_13,
+               ATH9K_5GHZ_NO_MIDBAND,
+       }
+};
+
+/* Can be used by 0x64 only */
+static const struct ieee80211_regdomain ath9k_world_regdom_64 = {
+       .n_reg_rules = 3,
+       .alpha2 =  "99",
+       .reg_rules = {
+               ATH9K_2GHZ_CH01_11,
+               ATH9K_5GHZ_NO_MIDBAND,
+       }
+};
+
+/* Can be used by 0x66 and 0x69 */
+static const struct ieee80211_regdomain ath9k_world_regdom_66_69 = {
+       .n_reg_rules = 3,
+       .alpha2 =  "99",
+       .reg_rules = {
+               ATH9K_2GHZ_CH01_11,
+               ATH9K_5GHZ_ALL,
+       }
+};
+
+/* Can be used by 0x67, 0x6A and 0x68 */
+static const struct ieee80211_regdomain ath9k_world_regdom_67_68_6A = {
+       .n_reg_rules = 4,
+       .alpha2 =  "99",
+       .reg_rules = {
+               ATH9K_2GHZ_CH01_11,
+               ATH9K_2GHZ_CH12_13,
+               ATH9K_5GHZ_ALL,
+       }
+};
+
+static u16 ath9k_regd_get_eepromRD(struct ath_hw *ah)
+{
+       return ah->regulatory.current_rd & ~WORLDWIDE_ROAMING_FLAG;
 }
 
-static void
-ath9k_regd_sort(void *a, u32 n, u32 size, ath_hal_cmp_t *cmp)
+u16 ath9k_regd_get_rd(struct ath_hw *ah)
 {
-       u8 *aa = a;
-       u8 *ai, *t;
-
-       for (ai = aa + size; --n >= 1; ai += size)
-               for (t = ai; t > aa; t -= size) {
-                       u8 *u = t - size;
-                       if (cmp(u, t) <= 0)
-                               break;
-                       swap_array(u, t, size);
-               }
+       return ath9k_regd_get_eepromRD(ah);
 }
 
-static u16 ath9k_regd_get_eepromRD(struct ath_hal *ah)
+bool ath9k_is_world_regd(struct ath_hw *ah)
 {
-       return ah->ah_currentRD & ~WORLDWIDE_ROAMING_FLAG;
+       return isWwrSKU(ah);
 }
 
-static bool ath9k_regd_is_chan_bm_zero(u64 *bitmask)
+const struct ieee80211_regdomain *ath9k_default_world_regdomain(void)
 {
-       int i;
-
-       for (i = 0; i < BMLEN; i++) {
-               if (bitmask[i] != 0)
-                       return false;
-       }
-       return true;
+       /* this is the most restrictive */
+       return &ath9k_world_regdom_64;
 }
 
-static bool ath9k_regd_is_eeprom_valid(struct ath_hal *ah)
+const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hw *ah)
 {
-       u16 rd = ath9k_regd_get_eepromRD(ah);
-       int i;
-
-       if (rd & COUNTRY_ERD_FLAG) {
-               u16 cc = rd & ~COUNTRY_ERD_FLAG;
-               for (i = 0; i < ARRAY_SIZE(allCountries); i++)
-                       if (allCountries[i].countryCode == cc)
-                               return true;
-       } else {
-               for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++)
-                       if (regDomainPairs[i].regDmnEnum == rd)
-                               return true;
+       switch (ah->regulatory.regpair->regDmnEnum) {
+       case 0x60:
+       case 0x61:
+       case 0x62:
+               return &ath9k_world_regdom_60_61_62;
+       case 0x63:
+       case 0x65:
+               return &ath9k_world_regdom_63_65;
+       case 0x64:
+               return &ath9k_world_regdom_64;
+       case 0x66:
+       case 0x69:
+               return &ath9k_world_regdom_66_69;
+       case 0x67:
+       case 0x68:
+       case 0x6A:
+               return &ath9k_world_regdom_67_68_6A;
+       default:
+               WARN_ON(1);
+               return ath9k_default_world_regdomain();
        }
-       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                "invalid regulatory domain/country code 0x%x\n", rd);
-       return false;
 }
 
-static bool ath9k_regd_is_fcc_midband_supported(struct ath_hal *ah)
+/* Frequency is one where radar detection is required */
+static bool ath9k_is_radar_freq(u16 center_freq)
 {
-       u32 regcap;
+       return (center_freq >= 5260 && center_freq <= 5700);
+}
 
-       regcap = ah->ah_caps.reg_cap;
+/*
+ * Enable adhoc on 5 GHz if allowed by 11d.
+ * Remove passive scan if channel is allowed by 11d,
+ * except when on radar frequencies.
+ */
+static void ath9k_reg_apply_5ghz_beaconing_flags(struct wiphy *wiphy,
+                                            enum reg_set_by setby)
+{
+       struct ieee80211_supported_band *sband;
+       const struct ieee80211_reg_rule *reg_rule;
+       struct ieee80211_channel *ch;
+       unsigned int i;
+       u32 bandwidth = 0;
+       int r;
+
+       if (setby != REGDOM_SET_BY_COUNTRY_IE)
+               return;
+       if (!wiphy->bands[IEEE80211_BAND_5GHZ])
+               return;
 
-       if (regcap & AR_EEPROM_EEREGCAP_EN_FCC_MIDBAND)
-               return true;
-       else
-               return false;
+       sband = wiphy->bands[IEEE80211_BAND_5GHZ];
+       for (i = 0; i < sband->n_channels; i++) {
+               ch = &sband->channels[i];
+               r = freq_reg_info(wiphy, ch->center_freq,
+                       &bandwidth, &reg_rule);
+               if (r)
+                       continue;
+               /* If 11d had a rule for this channel ensure we enable adhoc
+                * if it allows us to use it. Note that we would have disabled
+                * it by applying our static world regdomain by default during
+                * probe */
+               if (!(reg_rule->flags & NL80211_RRF_NO_IBSS))
+                       ch->flags &= ~IEEE80211_CHAN_NO_IBSS;
+               if (!ath9k_is_radar_freq(ch->center_freq))
+                       continue;
+               if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN))
+                       ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
+       }
 }
 
-static bool ath9k_regd_is_ccode_valid(struct ath_hal *ah,
-                                     u16 cc)
+/* Allows active scan scan on Ch 12 and 13 */
+static void ath9k_reg_apply_active_scan_flags(struct wiphy *wiphy,
+                                             enum reg_set_by setby)
 {
-       u16 rd;
-       int i;
-
-       if (cc == CTRY_DEFAULT)
-               return true;
-       if (cc == CTRY_DEBUG)
-               return true;
+       struct ieee80211_supported_band *sband;
+       struct ieee80211_channel *ch;
+       const struct ieee80211_reg_rule *reg_rule;
+       u32 bandwidth = 0;
+       int r;
+
+       /* Force passive scan on Channels 12-13 */
+       sband = wiphy->bands[IEEE80211_BAND_2GHZ];
+
+       /* If no country IE has been received always enable active scan
+        * on these channels */
+       if (setby != REGDOM_SET_BY_COUNTRY_IE) {
+               ch = &sband->channels[11]; /* CH 12 */
+               if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
+                       ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
+               ch = &sband->channels[12]; /* CH 13 */
+               if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
+                       ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
+               return;
+       }
 
-       rd = ath9k_regd_get_eepromRD(ah);
-       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, "EEPROM regdomain 0x%x\n", rd);
+       /* If a country IE has been recieved check its rule for this
+        * channel first before enabling active scan. The passive scan
+        * would have been enforced by the initial probe processing on
+        * our custom regulatory domain. */
 
-       if (rd & COUNTRY_ERD_FLAG) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "EEPROM setting is country code %u\n",
-                       rd & ~COUNTRY_ERD_FLAG);
-               return cc == (rd & ~COUNTRY_ERD_FLAG);
+       ch = &sband->channels[11]; /* CH 12 */
+       r = freq_reg_info(wiphy, ch->center_freq, &bandwidth, &reg_rule);
+       if (!r) {
+               if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN))
+                       if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
+                               ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
        }
 
-       for (i = 0; i < ARRAY_SIZE(allCountries); i++) {
-               if (cc == allCountries[i].countryCode) {
-#ifdef AH_SUPPORT_11D
-                       if ((rd & WORLD_SKU_MASK) == WORLD_SKU_PREFIX)
-                               return true;
-#endif
-                       if (allCountries[i].regDmnEnum == rd ||
-                           rd == DEBUG_REG_DMN || rd == NO_ENUMRD)
-                               return true;
-               }
+       ch = &sband->channels[12]; /* CH 13 */
+       r = freq_reg_info(wiphy, ch->center_freq, &bandwidth, &reg_rule);
+       if (!r) {
+               if (!(reg_rule->flags & NL80211_RRF_PASSIVE_SCAN))
+                       if (ch->flags & IEEE80211_CHAN_PASSIVE_SCAN)
+                               ch->flags &= ~IEEE80211_CHAN_PASSIVE_SCAN;
        }
-       return false;
 }
 
-static void
-ath9k_regd_get_wmodes_nreg(struct ath_hal *ah,
-                          struct country_code_to_enum_rd *country,
-                          struct regDomain *rd5GHz,
-                          unsigned long *modes_allowed)
+/* Always apply Radar/DFS rules on freq range 5260 MHz - 5700 MHz */
+void ath9k_reg_apply_radar_flags(struct wiphy *wiphy)
 {
-       bitmap_copy(modes_allowed, ah->ah_caps.wireless_modes, ATH9K_MODE_MAX);
+       struct ieee80211_supported_band *sband;
+       struct ieee80211_channel *ch;
+       unsigned int i;
 
-       if (test_bit(ATH9K_MODE_11G, ah->ah_caps.wireless_modes) &&
-           (!country->allow11g))
-               clear_bit(ATH9K_MODE_11G, modes_allowed);
+       if (!wiphy->bands[IEEE80211_BAND_5GHZ])
+               return;
 
-       if (test_bit(ATH9K_MODE_11A, ah->ah_caps.wireless_modes) &&
-           (ath9k_regd_is_chan_bm_zero(rd5GHz->chan11a)))
-               clear_bit(ATH9K_MODE_11A, modes_allowed);
+       sband = wiphy->bands[IEEE80211_BAND_5GHZ];
 
-       if (test_bit(ATH9K_MODE_11NG_HT20, ah->ah_caps.wireless_modes)
-           && (!country->allow11ng20))
-               clear_bit(ATH9K_MODE_11NG_HT20, modes_allowed);
+       for (i = 0; i < sband->n_channels; i++) {
+               ch = &sband->channels[i];
+               if (!ath9k_is_radar_freq(ch->center_freq))
+                       continue;
+               /* We always enable radar detection/DFS on this
+                * frequency range. Additionally we also apply on
+                * this frequency range:
+                * - If STA mode does not yet have DFS supports disable
+                *   active scanning
+                * - If adhoc mode does not support DFS yet then
+                *   disable adhoc in the frequency.
+                * - If AP mode does not yet support radar detection/DFS
+                *   do not allow AP mode
+                */
+               if (!(ch->flags & IEEE80211_CHAN_DISABLED))
+                       ch->flags |= IEEE80211_CHAN_RADAR |
+                                    IEEE80211_CHAN_NO_IBSS |
+                                    IEEE80211_CHAN_PASSIVE_SCAN;
+       }
+}
 
-       if (test_bit(ATH9K_MODE_11NA_HT20, ah->ah_caps.wireless_modes)
-           && (!country->allow11na20))
-               clear_bit(ATH9K_MODE_11NA_HT20, modes_allowed);
+void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby)
+{
+       struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+       struct ath_softc *sc = hw->priv;
+       struct ath_hw *ah = sc->sc_ah;
+
+       switch (ah->regulatory.regpair->regDmnEnum) {
+       case 0x60:
+       case 0x63:
+       case 0x66:
+       case 0x67:
+               ath9k_reg_apply_5ghz_beaconing_flags(wiphy, setby);
+               break;
+       case 0x68:
+               ath9k_reg_apply_5ghz_beaconing_flags(wiphy, setby);
+               ath9k_reg_apply_active_scan_flags(wiphy, setby);
+               break;
+       }
+       return;
+}
 
-       if (test_bit(ATH9K_MODE_11NG_HT40PLUS, ah->ah_caps.wireless_modes) &&
-           (!country->allow11ng40))
-               clear_bit(ATH9K_MODE_11NG_HT40PLUS, modes_allowed);
+int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request)
+{
+       struct ieee80211_hw *hw = wiphy_to_ieee80211_hw(wiphy);
+       struct ath_softc *sc = hw->priv;
 
-       if (test_bit(ATH9K_MODE_11NG_HT40MINUS, ah->ah_caps.wireless_modes) &&
-           (!country->allow11ng40))
-               clear_bit(ATH9K_MODE_11NG_HT40MINUS, modes_allowed);
+       /* We always apply this */
+       ath9k_reg_apply_radar_flags(wiphy);
 
-       if (test_bit(ATH9K_MODE_11NA_HT40PLUS, ah->ah_caps.wireless_modes) &&
-           (!country->allow11na40))
-               clear_bit(ATH9K_MODE_11NA_HT40PLUS, modes_allowed);
+       switch (request->initiator) {
+       case REGDOM_SET_BY_DRIVER:
+       case REGDOM_SET_BY_INIT:
+       case REGDOM_SET_BY_CORE:
+       case REGDOM_SET_BY_USER:
+               break;
+       case REGDOM_SET_BY_COUNTRY_IE:
+               if (ath9k_is_world_regd(sc->sc_ah))
+                       ath9k_reg_apply_world_flags(wiphy, request->initiator);
+               break;
+       }
 
-       if (test_bit(ATH9K_MODE_11NA_HT40MINUS, ah->ah_caps.wireless_modes) &&
-           (!country->allow11na40))
-               clear_bit(ATH9K_MODE_11NA_HT40MINUS, modes_allowed);
+       return 0;
 }
 
-bool ath9k_regd_is_public_safety_sku(struct ath_hal *ah)
+bool ath9k_regd_is_eeprom_valid(struct ath_hw *ah)
 {
-       u16 rd;
-
-       rd = ath9k_regd_get_eepromRD(ah);
+       u16 rd = ath9k_regd_get_eepromRD(ah);
+       int i;
 
-       switch (rd) {
-       case FCC4_FCCA:
-       case (CTRY_UNITED_STATES_FCC49 | COUNTRY_ERD_FLAG):
-               return true;
-       case DEBUG_REG_DMN:
-       case NO_ENUMRD:
-               if (ah->ah_countryCode == CTRY_UNITED_STATES_FCC49)
-                       return true;
-               break;
+       if (rd & COUNTRY_ERD_FLAG) {
+               /* EEPROM value is a country code */
+               u16 cc = rd & ~COUNTRY_ERD_FLAG;
+               for (i = 0; i < ARRAY_SIZE(allCountries); i++)
+                       if (allCountries[i].countryCode == cc)
+                               return true;
+       } else {
+               /* EEPROM value is a regpair value */
+               for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++)
+                       if (regDomainPairs[i].regDmnEnum == rd)
+                               return true;
        }
+       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
+                "invalid regulatory domain/country code 0x%x\n", rd);
        return false;
 }
 
+/* EEPROM country code to regpair mapping */
 static struct country_code_to_enum_rd*
 ath9k_regd_find_country(u16 countryCode)
 {
@@ -201,11 +357,24 @@ ath9k_regd_find_country(u16 countryCode)
        return NULL;
 }
 
-static u16 ath9k_regd_get_default_country(struct ath_hal *ah)
+/* EEPROM rd code to regpair mapping */
+static struct country_code_to_enum_rd*
+ath9k_regd_find_country_by_rd(int regdmn)
 {
-       u16 rd;
        int i;
 
+       for (i = 0; i < ARRAY_SIZE(allCountries); i++) {
+               if (allCountries[i].regDmnEnum == regdmn)
+                       return &allCountries[i];
+       }
+       return NULL;
+}
+
+/* Returns the map of the EEPROM set RD to a country code */
+static u16 ath9k_regd_get_default_country(struct ath_hw *ah)
+{
+       u16 rd;
+
        rd = ath9k_regd_get_eepromRD(ah);
        if (rd & COUNTRY_ERD_FLAG) {
                struct country_code_to_enum_rd *country = NULL;
@@ -216,798 +385,104 @@ static u16 ath9k_regd_get_default_country(struct ath_hal *ah)
                        return cc;
        }
 
-       for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++)
-               if (regDomainPairs[i].regDmnEnum == rd) {
-                       if (regDomainPairs[i].singleCC != 0)
-                               return regDomainPairs[i].singleCC;
-                       else
-                               i = ARRAY_SIZE(regDomainPairs);
-               }
        return CTRY_DEFAULT;
 }
 
-static bool ath9k_regd_is_valid_reg_domain(int regDmn,
-                                          struct regDomain *rd)
-{
-       int i;
-
-       for (i = 0; i < ARRAY_SIZE(regDomains); i++) {
-               if (regDomains[i].regDmnEnum == regDmn) {
-                       if (rd != NULL) {
-                               memcpy(rd, &regDomains[i],
-                                      sizeof(struct regDomain));
-                       }
-                       return true;
-               }
-       }
-       return false;
-}
-
-static bool ath9k_regd_is_valid_reg_domainPair(int regDmnPair)
+static struct reg_dmn_pair_mapping*
+ath9k_get_regpair(int regdmn)
 {
        int i;
 
-       if (regDmnPair == NO_ENUMRD)
-               return false;
+       if (regdmn == NO_ENUMRD)
+               return NULL;
        for (i = 0; i < ARRAY_SIZE(regDomainPairs); i++) {
-               if (regDomainPairs[i].regDmnEnum == regDmnPair)
-                       return true;
-       }
-       return false;
-}
-
-static bool
-ath9k_regd_get_wmode_regdomain(struct ath_hal *ah, int regDmn,
-                              u16 channelFlag, struct regDomain *rd)
-{
-       int i, found;
-       u64 flags = NO_REQ;
-       struct reg_dmn_pair_mapping *regPair = NULL;
-       int regOrg;
-
-       regOrg = regDmn;
-       if (regDmn == CTRY_DEFAULT) {
-               u16 rdnum;
-               rdnum = ath9k_regd_get_eepromRD(ah);
-
-               if (!(rdnum & COUNTRY_ERD_FLAG)) {
-                       if (ath9k_regd_is_valid_reg_domain(rdnum, NULL) ||
-                           ath9k_regd_is_valid_reg_domainPair(rdnum)) {
-                               regDmn = rdnum;
-                       }
-               }
-       }
-
-       if ((regDmn & MULTI_DOMAIN_MASK) == 0) {
-               for (i = 0, found = 0;
-                    (i < ARRAY_SIZE(regDomainPairs)) && (!found); i++) {
-                       if (regDomainPairs[i].regDmnEnum == regDmn) {
-                               regPair = &regDomainPairs[i];
-                               found = 1;
-                       }
-               }
-               if (!found) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                               "Failed to find reg domain pair %u\n", regDmn);
-                       return false;
-               }
-               if (!(channelFlag & CHANNEL_2GHZ)) {
-                       regDmn = regPair->regDmn5GHz;
-                       flags = regPair->flags5GHz;
-               }
-               if (channelFlag & CHANNEL_2GHZ) {
-                       regDmn = regPair->regDmn2GHz;
-                       flags = regPair->flags2GHz;
-               }
-       }
-
-       found = ath9k_regd_is_valid_reg_domain(regDmn, rd);
-       if (!found) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Failed to find unitary reg domain %u\n", regDmn);
-               return false;
-       } else {
-               rd->pscan &= regPair->pscanMask;
-               if (((regOrg & MULTI_DOMAIN_MASK) == 0) &&
-                   (flags != NO_REQ)) {
-                       rd->flags = flags;
-               }
-
-               rd->flags &= (channelFlag & CHANNEL_2GHZ) ?
-                   REG_DOMAIN_2GHZ_MASK : REG_DOMAIN_5GHZ_MASK;
-               return true;
-       }
-}
-
-static bool ath9k_regd_is_bit_set(int bit, u64 *bitmask)
-{
-       int byteOffset, bitnum;
-       u64 val;
-
-       byteOffset = bit / 64;
-       bitnum = bit - byteOffset * 64;
-       val = ((u64) 1) << bitnum;
-       if (bitmask[byteOffset] & val)
-               return true;
-       else
-               return false;
-}
-
-static void
-ath9k_regd_add_reg_classid(u8 *regclassids, u32 maxregids,
-                          u32 *nregids, u8 regclassid)
-{
-       int i;
-
-       if (regclassid == 0)
-               return;
-
-       for (i = 0; i < maxregids; i++) {
-               if (regclassids[i] == regclassid)
-                       return;
-               if (regclassids[i] == 0)
-                       break;
-       }
-
-       if (i == maxregids)
-               return;
-       else {
-               regclassids[i] = regclassid;
-               *nregids += 1;
-       }
-
-       return;
-}
-
-static bool
-ath9k_regd_get_eeprom_reg_ext_bits(struct ath_hal *ah,
-                                  enum reg_ext_bitmap bit)
-{
-       return (ah->ah_currentRDExt & (1 << bit)) ? true : false;
-}
-
-#ifdef ATH_NF_PER_CHAN
-
-static void ath9k_regd_init_rf_buffer(struct ath9k_channel *ichans,
-                                     int nchans)
-{
-       int i, j, next;
-
-       for (next = 0; next < nchans; next++) {
-               for (i = 0; i < NUM_NF_READINGS; i++) {
-                       ichans[next].nfCalHist[i].currIndex = 0;
-                       ichans[next].nfCalHist[i].privNF =
-                           AR_PHY_CCA_MAX_GOOD_VALUE;
-                       ichans[next].nfCalHist[i].invalidNFcount =
-                           AR_PHY_CCA_FILTERWINDOW_LENGTH;
-                       for (j = 0; j < ATH9K_NF_CAL_HIST_MAX; j++) {
-                               ichans[next].nfCalHist[i].nfCalBuffer[j] =
-                                   AR_PHY_CCA_MAX_GOOD_VALUE;
-                       }
-               }
-       }
-}
-#endif
-
-static int ath9k_regd_is_chan_present(struct ath_hal *ah,
-                                     u16 c)
-{
-       int i;
-
-       for (i = 0; i < 150; i++) {
-               if (!ah->ah_channels[i].channel)
-                       return -1;
-               else if (ah->ah_channels[i].channel == c)
-                       return i;
-       }
-
-       return -1;
-}
-
-static bool
-ath9k_regd_add_channel(struct ath_hal *ah,
-                      u16 c,
-                      u16 c_lo,
-                      u16 c_hi,
-                      u16 maxChan,
-                      u8 ctl,
-                      int pos,
-                      struct regDomain rd5GHz,
-                      struct RegDmnFreqBand *fband,
-                      struct regDomain *rd,
-                      const struct cmode *cm,
-                      struct ath9k_channel *ichans,
-                      bool enableExtendedChannels)
-{
-       struct ath9k_channel *chan;
-       int ret;
-       u32 channelFlags = 0;
-       u8 privFlags = 0;
-
-       if (!(c_lo <= c && c <= c_hi)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "c %u out of range [%u..%u]\n",
-                       c, c_lo, c_hi);
-               return false;
-       }
-       if ((fband->channelBW == CHANNEL_HALF_BW) &&
-           !(ah->ah_caps.hw_caps & ATH9K_HW_CAP_CHAN_HALFRATE)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Skipping %u half rate channel\n", c);
-               return false;
-       }
-
-       if ((fband->channelBW == CHANNEL_QUARTER_BW) &&
-           !(ah->ah_caps.hw_caps & ATH9K_HW_CAP_CHAN_QUARTERRATE)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Skipping %u quarter rate channel\n", c);
-               return false;
-       }
-
-       if (((c + fband->channelSep) / 2) > (maxChan + HALF_MAXCHANBW)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "c %u > maxChan %u\n", c, maxChan);
-               return false;
-       }
-
-       if ((fband->usePassScan & IS_ECM_CHAN) && !enableExtendedChannels) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Skipping ecm channel\n");
-               return false;
+               if (regDomainPairs[i].regDmnEnum == regdmn)
+                       return &regDomainPairs[i];
        }
-
-       if ((rd->flags & NO_HOSTAP) && (ah->ah_opmode == NL80211_IFTYPE_AP)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Skipping HOSTAP channel\n");
-               return false;
-       }
-
-       if (IS_HT40_MODE(cm->mode) &&
-           !(ath9k_regd_get_eeprom_reg_ext_bits(ah, REG_EXT_FCC_DFS_HT40)) &&
-           (fband->useDfs) &&
-           (rd->conformanceTestLimit != MKK)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Skipping HT40 channel (en_fcc_dfs_ht40 = 0)\n");
-               return false;
-       }
-
-       if (IS_HT40_MODE(cm->mode) &&
-           !(ath9k_regd_get_eeprom_reg_ext_bits(ah,
-                                                REG_EXT_JAPAN_NONDFS_HT40)) &&
-           !(fband->useDfs) && (rd->conformanceTestLimit == MKK)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Skipping HT40 channel (en_jap_ht40 = 0)\n");
-               return false;
-       }
-
-       if (IS_HT40_MODE(cm->mode) &&
-           !(ath9k_regd_get_eeprom_reg_ext_bits(ah, REG_EXT_JAPAN_DFS_HT40)) &&
-           (fband->useDfs) &&
-           (rd->conformanceTestLimit == MKK)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Skipping HT40 channel (en_jap_dfs_ht40 = 0)\n");
-               return false;
-       }
-
-       /* Calculate channel flags */
-
-       channelFlags = cm->flags;
-
-       switch (fband->channelBW) {
-       case CHANNEL_HALF_BW:
-               channelFlags |= CHANNEL_HALF;
-               break;
-       case CHANNEL_QUARTER_BW:
-               channelFlags |= CHANNEL_QUARTER;
-               break;
-       }
-
-       if (fband->usePassScan & rd->pscan)
-               channelFlags |= CHANNEL_PASSIVE;
-       else
-               channelFlags &= ~CHANNEL_PASSIVE;
-       if (fband->useDfs & rd->dfsMask)
-               privFlags = CHANNEL_DFS;
-       else
-               privFlags = 0;
-       if (rd->flags & LIMIT_FRAME_4MS)
-               privFlags |= CHANNEL_4MS_LIMIT;
-       if (privFlags & CHANNEL_DFS)
-               privFlags |= CHANNEL_DISALLOW_ADHOC;
-       if (rd->flags & ADHOC_PER_11D)
-               privFlags |= CHANNEL_PER_11D_ADHOC;
-
-       if (channelFlags & CHANNEL_PASSIVE) {
-               if ((c < 2412) || (c > 2462)) {
-                       if (rd5GHz.regDmnEnum == MKK1 ||
-                           rd5GHz.regDmnEnum == MKK2) {
-                               u32 regcap = ah->ah_caps.reg_cap;
-                               if (!(regcap &
-                                     (AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN |
-                                      AR_EEPROM_EEREGCAP_EN_KK_U2 |
-                                      AR_EEPROM_EEREGCAP_EN_KK_MIDBAND)) &&
-                                   isUNII1OddChan(c)) {
-                                       channelFlags &= ~CHANNEL_PASSIVE;
-                               } else {
-                                       privFlags |= CHANNEL_DISALLOW_ADHOC;
-                               }
-                       } else {
-                               privFlags |= CHANNEL_DISALLOW_ADHOC;
-                       }
-               }
-       }
-
-       if ((cm->mode == ATH9K_MODE_11A) ||
-           (cm->mode == ATH9K_MODE_11NA_HT20) ||
-           (cm->mode == ATH9K_MODE_11NA_HT40PLUS) ||
-           (cm->mode == ATH9K_MODE_11NA_HT40MINUS)) {
-               if (rd->flags & (ADHOC_NO_11A | DISALLOW_ADHOC_11A))
-                       privFlags |= CHANNEL_DISALLOW_ADHOC;
-       }
-
-       /* Fill in channel details */
-
-       ret = ath9k_regd_is_chan_present(ah, c);
-       if (ret == -1) {
-               chan = &ah->ah_channels[pos];
-               chan->channel = c;
-               chan->maxRegTxPower = fband->powerDfs;
-               chan->antennaMax = fband->antennaMax;
-               chan->regDmnFlags = rd->flags;
-               chan->maxTxPower = AR5416_MAX_RATE_POWER;
-               chan->minTxPower = AR5416_MAX_RATE_POWER;
-               chan->channelFlags = channelFlags;
-               chan->privFlags = privFlags;
-       } else {
-               chan = &ah->ah_channels[ret];
-               chan->channelFlags |= channelFlags;
-               chan->privFlags |= privFlags;
-       }
-
-       /* Set CTLs */
-
-       if ((cm->flags & CHANNEL_ALL) == CHANNEL_A)
-               chan->conformanceTestLimit[0] = ctl;
-       else if ((cm->flags & CHANNEL_ALL) == CHANNEL_B)
-               chan->conformanceTestLimit[1] = ctl;
-       else if ((cm->flags & CHANNEL_ALL) == CHANNEL_G)
-               chan->conformanceTestLimit[2] = ctl;
-
-       return (ret == -1) ? true : false;
-}
-
-static bool ath9k_regd_japan_check(struct ath_hal *ah,
-                                  int b,
-                                  struct regDomain *rd5GHz)
-{
-       bool skipband = false;
-       int i;
-       u32 regcap;
-
-       for (i = 0; i < ARRAY_SIZE(j_bandcheck); i++) {
-               if (j_bandcheck[i].freqbandbit == b) {
-                       regcap = ah->ah_caps.reg_cap;
-                       if ((j_bandcheck[i].eepromflagtocheck & regcap) == 0) {
-                               skipband = true;
-                       } else if ((regcap & AR_EEPROM_EEREGCAP_EN_KK_U2) ||
-                                 (regcap & AR_EEPROM_EEREGCAP_EN_KK_MIDBAND)) {
-                               rd5GHz->dfsMask |= DFS_MKK4;
-                               rd5GHz->pscan |= PSCAN_MKK3;
-                       }
-                       break;
-               }
-       }
-
-       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-               "Skipping %d freq band\n", j_bandcheck[i].freqbandbit);
-
-       return skipband;
+       return NULL;
 }
 
-bool
-ath9k_regd_init_channels(struct ath_hal *ah,
-                        u32 maxchans,
-                        u32 *nchans, u8 *regclassids,
-                        u32 maxregids, u32 *nregids, u16 cc,
-                        bool enableOutdoor,
-                        bool enableExtendedChannels)
+int ath9k_regd_init(struct ath_hw *ah)
 {
-       u16 maxChan = 7000;
        struct country_code_to_enum_rd *country = NULL;
-       struct regDomain rd5GHz, rd2GHz;
-       const struct cmode *cm;
-       struct ath9k_channel *ichans = &ah->ah_channels[0];
-       int next = 0, b;
-       u8 ctl;
        int regdmn;
-       u16 chanSep;
-       unsigned long *modes_avail;
-       DECLARE_BITMAP(modes_allowed, ATH9K_MODE_MAX);
-
-       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, "cc %u %s %s\n", cc,
-                enableOutdoor ? "Enable outdoor" : "",
-                enableExtendedChannels ? "Enable ecm" : "");
-
-       if (!ath9k_regd_is_ccode_valid(ah, cc)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Invalid country code %d\n", cc);
-               return false;
-       }
 
        if (!ath9k_regd_is_eeprom_valid(ah)) {
                DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
                        "Invalid EEPROM contents\n");
-               return false;
+               return -EINVAL;
        }
 
-       ah->ah_countryCode = ath9k_regd_get_default_country(ah);
+       ah->regulatory.country_code = ath9k_regd_get_default_country(ah);
 
-       if (ah->ah_countryCode == CTRY_DEFAULT) {
-               ah->ah_countryCode = cc & COUNTRY_CODE_MASK;
-               if ((ah->ah_countryCode == CTRY_DEFAULT) &&
-                   (ath9k_regd_get_eepromRD(ah) == CTRY_DEFAULT)) {
-                       ah->ah_countryCode = CTRY_UNITED_STATES;
-               }
-       }
+       if (ah->regulatory.country_code == CTRY_DEFAULT &&
+           ath9k_regd_get_eepromRD(ah) == CTRY_DEFAULT)
+               ah->regulatory.country_code = CTRY_UNITED_STATES;
 
-#ifdef AH_SUPPORT_11D
-       if (ah->ah_countryCode == CTRY_DEFAULT) {
+       if (ah->regulatory.country_code == CTRY_DEFAULT) {
                regdmn = ath9k_regd_get_eepromRD(ah);
                country = NULL;
        } else {
-#endif
-               country = ath9k_regd_find_country(ah->ah_countryCode);
+               country = ath9k_regd_find_country(ah->regulatory.country_code);
                if (country == NULL) {
                        DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
                                "Country is NULL!!!!, cc= %d\n",
-                               ah->ah_countryCode);
-                       return false;
-               } else {
+                               ah->regulatory.country_code);
+                       return -EINVAL;
+               } else
                        regdmn = country->regDmnEnum;
-#ifdef AH_SUPPORT_11D
-                       if (((ath9k_regd_get_eepromRD(ah) &
-                             WORLD_SKU_MASK) == WORLD_SKU_PREFIX) &&
-                           (cc == CTRY_UNITED_STATES)) {
-                               if (!isWwrSKU_NoMidband(ah)
-                                   && ath9k_regd_is_fcc_midband_supported(ah))
-                                       regdmn = FCC3_FCCA;
-                               else
-                                       regdmn = FCC1_FCCA;
-                       }
-#endif
-               }
-#ifdef AH_SUPPORT_11D
-       }
-#endif
-       if (!ath9k_regd_get_wmode_regdomain(ah,
-                                           regdmn,
-                                           ~CHANNEL_2GHZ,
-                                           &rd5GHz)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Couldn't find unitary "
-                       "5GHz reg domain for country %u\n",
-                       ah->ah_countryCode);
-               return false;
-       }
-       if (!ath9k_regd_get_wmode_regdomain(ah,
-                                           regdmn,
-                                           CHANNEL_2GHZ,
-                                           &rd2GHz)) {
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "Couldn't find unitary 2GHz "
-                       "reg domain for country %u\n",
-                       ah->ah_countryCode);
-               return false;
-       }
-
-       if (!isWwrSKU(ah) && ((rd5GHz.regDmnEnum == FCC1) ||
-                             (rd5GHz.regDmnEnum == FCC2))) {
-               if (ath9k_regd_is_fcc_midband_supported(ah)) {
-                       if (!ath9k_regd_get_wmode_regdomain(ah,
-                                                           FCC3_FCCA,
-                                                           ~CHANNEL_2GHZ,
-                                                           &rd5GHz)) {
-                               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                                       "Couldn't find unitary 5GHz "
-                                       "reg domain for country %u\n",
-                                       ah->ah_countryCode);
-                               return false;
-                       }
-               }
        }
 
-       if (country == NULL) {
-               modes_avail = ah->ah_caps.wireless_modes;
-       } else {
-               ath9k_regd_get_wmodes_nreg(ah, country, &rd5GHz, modes_allowed);
-               modes_avail = modes_allowed;
+       ah->regulatory.current_rd_inuse = regdmn;
+       ah->regulatory.regpair = ath9k_get_regpair(regdmn);
 
-               if (!enableOutdoor)
-                       maxChan = country->outdoorChanStart;
+       if (!ah->regulatory.regpair) {
+               DPRINTF(ah->ah_sc, ATH_DBG_FATAL,
+                       "No regulatory domain pair found, cannot continue\n");
+               return -EINVAL;
        }
 
-       next = 0;
-
-       if (maxchans > ARRAY_SIZE(ah->ah_channels))
-               maxchans = ARRAY_SIZE(ah->ah_channels);
-
-       for (cm = modes; cm < &modes[ARRAY_SIZE(modes)]; cm++) {
-               u16 c, c_hi, c_lo;
-               u64 *channelBM = NULL;
-               struct regDomain *rd = NULL;
-               struct RegDmnFreqBand *fband = NULL, *freqs;
-               int8_t low_adj = 0, hi_adj = 0;
-
-               if (!test_bit(cm->mode, modes_avail)) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                               "!avail mode %d flags 0x%x\n",
-                               cm->mode, cm->flags);
-                       continue;
-               }
-               if (!ath9k_get_channel_edges(ah, cm->flags, &c_lo, &c_hi)) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                               "channels 0x%x not supported "
-                               "by hardware\n", cm->flags);
-                       continue;
-               }
-
-               switch (cm->mode) {
-               case ATH9K_MODE_11A:
-               case ATH9K_MODE_11NA_HT20:
-               case ATH9K_MODE_11NA_HT40PLUS:
-               case ATH9K_MODE_11NA_HT40MINUS:
-                       rd = &rd5GHz;
-                       channelBM = rd->chan11a;
-                       freqs = &regDmn5GhzFreq[0];
-                       ctl = rd->conformanceTestLimit;
-                       break;
-               case ATH9K_MODE_11B:
-                       rd = &rd2GHz;
-                       channelBM = rd->chan11b;
-                       freqs = &regDmn2GhzFreq[0];
-                       ctl = rd->conformanceTestLimit | CTL_11B;
-                       break;
-               case ATH9K_MODE_11G:
-               case ATH9K_MODE_11NG_HT20:
-               case ATH9K_MODE_11NG_HT40PLUS:
-               case ATH9K_MODE_11NG_HT40MINUS:
-                       rd = &rd2GHz;
-                       channelBM = rd->chan11g;
-                       freqs = &regDmn2Ghz11gFreq[0];
-                       ctl = rd->conformanceTestLimit | CTL_11G;
-                       break;
-               default:
-                       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                               "Unknown HAL mode 0x%x\n", cm->mode);
-                       continue;
-               }
-
-               if (ath9k_regd_is_chan_bm_zero(channelBM))
-                       continue;
+       if (!country)
+               country = ath9k_regd_find_country_by_rd(regdmn);
 
-               if ((cm->mode == ATH9K_MODE_11NA_HT40PLUS) ||
-                   (cm->mode == ATH9K_MODE_11NG_HT40PLUS)) {
-                       hi_adj = -20;
-               }
-
-               if ((cm->mode == ATH9K_MODE_11NA_HT40MINUS) ||
-                   (cm->mode == ATH9K_MODE_11NG_HT40MINUS)) {
-                       low_adj = 20;
-               }
-
-               /* XXX: Add a helper here instead */
-               for (b = 0; b < 64 * BMLEN; b++) {
-                       if (ath9k_regd_is_bit_set(b, channelBM)) {
-                               fband = &freqs[b];
-                               if (rd5GHz.regDmnEnum == MKK1
-                                   || rd5GHz.regDmnEnum == MKK2) {
-                                       if (ath9k_regd_japan_check(ah,
-                                                                  b,
-                                                                  &rd5GHz))
-                                               continue;
-                               }
-
-                               ath9k_regd_add_reg_classid(regclassids,
-                                                          maxregids,
-                                                          nregids,
-                                                          fband->
-                                                          regClassId);
-
-                               if (IS_HT40_MODE(cm->mode) && (rd == &rd5GHz)) {
-                                       chanSep = 40;
-                                       if (fband->lowChannel == 5280)
-                                               low_adj += 20;
-
-                                       if (fband->lowChannel == 5170)
-                                               continue;
-                               } else
-                                       chanSep = fband->channelSep;
-
-                               for (c = fband->lowChannel + low_adj;
-                                    ((c <= (fband->highChannel + hi_adj)) &&
-                                     (c >= (fband->lowChannel + low_adj)));
-                                    c += chanSep) {
-                                       if (next >= maxchans) {
-                                               DPRINTF(ah->ah_sc,
-                                                       ATH_DBG_REGULATORY,
-                                                       "too many channels "
-                                                       "for channel table\n");
-                                               goto done;
-                                       }
-                                       if (ath9k_regd_add_channel(ah,
-                                                  c, c_lo, c_hi,
-                                                  maxChan, ctl,
-                                                  next,
-                                                  rd5GHz,
-                                                  fband, rd, cm,
-                                                  ichans,
-                                                  enableExtendedChannels))
-                                               next++;
-                               }
-                               if (IS_HT40_MODE(cm->mode) &&
-                                   (fband->lowChannel == 5280)) {
-                                       low_adj -= 20;
-                               }
-                       }
-               }
-       }
-done:
-       if (next != 0) {
-               int i;
-
-               if (next > ARRAY_SIZE(ah->ah_channels)) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                               "too many channels %u; truncating to %u\n",
-                               next, (int) ARRAY_SIZE(ah->ah_channels));
-                       next = ARRAY_SIZE(ah->ah_channels);
-               }
-#ifdef ATH_NF_PER_CHAN
-               ath9k_regd_init_rf_buffer(ichans, next);
-#endif
-               ath9k_regd_sort(ichans, next,
-                               sizeof(struct ath9k_channel),
-                               ath9k_regd_chansort);
-
-               ah->ah_nchan = next;
-
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, "Channel list:\n");
-               for (i = 0; i < next; i++) {
-                       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                               "chan: %d flags: 0x%x\n",
-                               ah->ah_channels[i].channel,
-                               ah->ah_channels[i].channelFlags);
-               }
-       }
-       *nchans = next;
-
-       ah->ah_countryCode = ah->ah_countryCode;
-
-       ah->ah_currentRDInUse = regdmn;
-       ah->ah_currentRD5G = rd5GHz.regDmnEnum;
-       ah->ah_currentRD2G = rd2GHz.regDmnEnum;
-       if (country == NULL) {
-               ah->ah_iso[0] = 0;
-               ah->ah_iso[1] = 0;
+       if (country) {
+               ah->regulatory.alpha2[0] = country->isoName[0];
+               ah->regulatory.alpha2[1] = country->isoName[1];
        } else {
-               ah->ah_iso[0] = country->isoName[0];
-               ah->ah_iso[1] = country->isoName[1];
+               ah->regulatory.alpha2[0] = '0';
+               ah->regulatory.alpha2[1] = '0';
        }
 
-       return next != 0;
-}
-
-struct ath9k_channel*
-ath9k_regd_check_channel(struct ath_hal *ah,
-                        const struct ath9k_channel *c)
-{
-       struct ath9k_channel *base, *cc;
-
-       int flags = c->channelFlags & CHAN_FLAGS;
-       int n, lim;
-
        DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-               "channel %u/0x%x (0x%x) requested\n",
-               c->channel, c->channelFlags, flags);
-
-       cc = ah->ah_curchan;
-       if (cc != NULL && cc->channel == c->channel &&
-           (cc->channelFlags & CHAN_FLAGS) == flags) {
-               if ((cc->privFlags & CHANNEL_INTERFERENCE) &&
-                   (cc->privFlags & CHANNEL_DFS))
-                       return NULL;
-               else
-                       return cc;
-       }
+               "Country alpha2 being used: %c%c\n"
+               "Regulatory.Regpair detected: 0x%0x\n",
+               ah->regulatory.alpha2[0], ah->regulatory.alpha2[1],
+               ah->regulatory.regpair->regDmnEnum);
 
-       base = ah->ah_channels;
-       n = ah->ah_nchan;
-
-       for (lim = n; lim != 0; lim >>= 1) {
-               int d;
-               cc = &base[lim >> 1];
-               d = c->channel - cc->channel;
-               if (d == 0) {
-                       if ((cc->channelFlags & CHAN_FLAGS) == flags) {
-                               if ((cc->privFlags & CHANNEL_INTERFERENCE) &&
-                                   (cc->privFlags & CHANNEL_DFS))
-                                       return NULL;
-                               else
-                                       return cc;
-                       }
-                       d = flags - (cc->channelFlags & CHAN_FLAGS);
-               }
-               DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY,
-                       "channel %u/0x%x d %d\n",
-                       cc->channel, cc->channelFlags, d);
-               if (d > 0) {
-                       base = cc + 1;
-                       lim--;
-               }
-       }
-       DPRINTF(ah->ah_sc, ATH_DBG_REGULATORY, "no match for %u/0x%x\n",
-               c->channel, c->channelFlags);
-       return NULL;
-}
-
-u32
-ath9k_regd_get_antenna_allowed(struct ath_hal *ah,
-                              struct ath9k_channel *chan)
-{
-       struct ath9k_channel *ichan = NULL;
-
-       ichan = ath9k_regd_check_channel(ah, chan);
-       if (!ichan)
-               return 0;
-
-       return ichan->antennaMax;
+       return 0;
 }
 
-u32 ath9k_regd_get_ctl(struct ath_hal *ah, struct ath9k_channel *chan)
+u32 ath9k_regd_get_ctl(struct ath_hw *ah, struct ath9k_channel *chan)
 {
        u32 ctl = NO_CTL;
-       struct ath9k_channel *ichan;
 
-       if (ah->ah_countryCode == CTRY_DEFAULT && isWwrSKU(ah)) {
+       if (!ah->regulatory.regpair ||
+           (ah->regulatory.country_code == CTRY_DEFAULT && isWwrSKU(ah))) {
                if (IS_CHAN_B(chan))
                        ctl = SD_NO_CTL | CTL_11B;
                else if (IS_CHAN_G(chan))
                        ctl = SD_NO_CTL | CTL_11G;
                else
                        ctl = SD_NO_CTL | CTL_11A;
-       } else {
-               ichan = ath9k_regd_check_channel(ah, chan);
-               if (ichan != NULL) {
-                       /* FIXME */
-                       if (IS_CHAN_A(ichan))
-                               ctl = ichan->conformanceTestLimit[0];
-                       else if (IS_CHAN_B(ichan))
-                               ctl = ichan->conformanceTestLimit[1];
-                       else if (IS_CHAN_G(ichan))
-                               ctl = ichan->conformanceTestLimit[2];
-
-                       if (IS_CHAN_G(chan) && (ctl & 0xf) == CTL_11B)
-                               ctl = (ctl & ~0xf) | CTL_11G;
-               }
+               return ctl;
        }
-       return ctl;
-}
 
-void ath9k_regd_get_current_country(struct ath_hal *ah,
-                                   struct ath9k_country_entry *ctry)
-{
-       u16 rd = ath9k_regd_get_eepromRD(ah);
+       if (IS_CHAN_B(chan))
+               ctl = ah->regulatory.regpair->reg_2ghz_ctl | CTL_11B;
+       else if (IS_CHAN_G(chan))
+               ctl = ah->regulatory.regpair->reg_5ghz_ctl | CTL_11G;
+       else
+               ctl = ah->regulatory.regpair->reg_5ghz_ctl | CTL_11A;
 
-       ctry->isMultidomain = false;
-       if (rd == CTRY_DEFAULT)
-               ctry->isMultidomain = true;
-       else if (!(rd & COUNTRY_ERD_FLAG))
-               ctry->isMultidomain = isWwrSKU(ah);
-
-       ctry->countryCode = ah->ah_countryCode;
-       ctry->regDmnEnum = ah->ah_currentRD;
-       ctry->regDmn5G = ah->ah_currentRD5G;
-       ctry->regDmn2G = ah->ah_currentRD2G;
-       ctry->iso[0] = ah->ah_iso[0];
-       ctry->iso[1] = ah->ah_iso[1];
-       ctry->iso[2] = ah->ah_iso[2];
+       return ctl;
 }
index 512d990aa7ea352e44452158cb04742689add545..39420de818f8c57b78645943ce319631ffe18534 100644 (file)
 #ifndef REGD_H
 #define REGD_H
 
-#include "ath9k.h"
-
-#define BMLEN 2
-#define BMZERO {(u64) 0, (u64) 0}
-
-#define BM(_fa, _fb, _fc, _fd, _fe, _ff, _fg, _fh, _fi, _fj, _fk, _fl) \
-       {((((_fa >= 0) && (_fa < 64)) ? \
-               (((u64) 1) << _fa) : (u64) 0) | \
-       (((_fb >= 0) && (_fb < 64)) ? \
-               (((u64) 1) << _fb) : (u64) 0) | \
-       (((_fc >= 0) && (_fc < 64)) ? \
-               (((u64) 1) << _fc) : (u64) 0) | \
-       (((_fd >= 0) && (_fd < 64)) ? \
-               (((u64) 1) << _fd) : (u64) 0) | \
-       (((_fe >= 0) && (_fe < 64)) ? \
-               (((u64) 1) << _fe) : (u64) 0) | \
-       (((_ff >= 0) && (_ff < 64)) ? \
-               (((u64) 1) << _ff) : (u64) 0) | \
-       (((_fg >= 0) && (_fg < 64)) ? \
-               (((u64) 1) << _fg) : (u64) 0) | \
-       (((_fh >= 0) && (_fh < 64)) ? \
-               (((u64) 1) << _fh) : (u64) 0) | \
-       (((_fi >= 0) && (_fi < 64)) ? \
-               (((u64) 1) << _fi) : (u64) 0) | \
-       (((_fj >= 0) && (_fj < 64)) ? \
-               (((u64) 1) << _fj) : (u64) 0) | \
-       (((_fk >= 0) && (_fk < 64)) ? \
-               (((u64) 1) << _fk) : (u64) 0) | \
-       (((_fl >= 0) && (_fl < 64)) ? \
-               (((u64) 1) << _fl) : (u64) 0) | \
-                       ((((_fa > 63) && (_fa < 128)) ? \
-                       (((u64) 1) << (_fa - 64)) : (u64) 0) | \
-       (((_fb > 63) && (_fb < 128)) ? \
-               (((u64) 1) << (_fb - 64)) : (u64) 0) | \
-       (((_fc > 63) && (_fc < 128)) ? \
-               (((u64) 1) << (_fc - 64)) : (u64) 0) | \
-       (((_fd > 63) && (_fd < 128)) ? \
-               (((u64) 1) << (_fd - 64)) : (u64) 0) | \
-       (((_fe > 63) && (_fe < 128)) ? \
-               (((u64) 1) << (_fe - 64)) : (u64) 0) | \
-       (((_ff > 63) && (_ff < 128)) ? \
-               (((u64) 1) << (_ff - 64)) : (u64) 0) | \
-       (((_fg > 63) && (_fg < 128)) ? \
-               (((u64) 1) << (_fg - 64)) : (u64) 0) | \
-       (((_fh > 63) && (_fh < 128)) ? \
-               (((u64) 1) << (_fh - 64)) : (u64) 0) | \
-       (((_fi > 63) && (_fi < 128)) ? \
-               (((u64) 1) << (_fi - 64)) : (u64) 0) | \
-       (((_fj > 63) && (_fj < 128)) ? \
-               (((u64) 1) << (_fj - 64)) : (u64) 0) | \
-       (((_fk > 63) && (_fk < 128)) ? \
-               (((u64) 1) << (_fk - 64)) : (u64) 0) | \
-       (((_fl > 63) && (_fl < 128)) ? \
-               (((u64) 1) << (_fl - 64)) : (u64) 0)))}
-
-#define DEF_REGDMN      FCC1_FCCA
-#define DEF_DMN_5       FCC1
-#define DEF_DMN_2       FCCA
 #define COUNTRY_ERD_FLAG        0x8000
 #define WORLDWIDE_ROAMING_FLAG  0x4000
-#define SUPER_DOMAIN_MASK   0x0fff
-#define COUNTRY_CODE_MASK   0x3fff
-#define CF_INTERFERENCE     (CHANNEL_CW_INT | CHANNEL_RADAR_INT)
-#define CHANNEL_14      (2484)
-#define IS_11G_CH14(_ch,_cf) \
-    (((_ch) == CHANNEL_14) && ((_cf) == CHANNEL_G))
-
-#define NO_PSCAN    0x0ULL
-#define PSCAN_FCC   0x0000000000000001ULL
-#define PSCAN_FCC_T 0x0000000000000002ULL
-#define PSCAN_ETSI  0x0000000000000004ULL
-#define PSCAN_MKK1  0x0000000000000008ULL
-#define PSCAN_MKK2  0x0000000000000010ULL
-#define PSCAN_MKKA  0x0000000000000020ULL
-#define PSCAN_MKKA_G    0x0000000000000040ULL
-#define PSCAN_ETSIA 0x0000000000000080ULL
-#define PSCAN_ETSIB 0x0000000000000100ULL
-#define PSCAN_ETSIC 0x0000000000000200ULL
-#define PSCAN_WWR   0x0000000000000400ULL
-#define PSCAN_MKKA1 0x0000000000000800ULL
-#define PSCAN_MKKA1_G   0x0000000000001000ULL
-#define PSCAN_MKKA2 0x0000000000002000ULL
-#define PSCAN_MKKA2_G   0x0000000000004000ULL
-#define PSCAN_MKK3  0x0000000000008000ULL
-#define PSCAN_DEFER 0x7FFFFFFFFFFFFFFFULL
-#define IS_ECM_CHAN 0x8000000000000000ULL
 
 #define isWwrSKU(_ah) \
        (((ath9k_regd_get_eepromRD((_ah)) & WORLD_SKU_MASK) == \
                WORLD_SKU_PREFIX) || \
                (ath9k_regd_get_eepromRD(_ah) == WORLD))
 
-#define isWwrSKU_NoMidband(_ah) \
-       ((ath9k_regd_get_eepromRD((_ah)) == WOR3_WORLD) || \
-       (ath9k_regd_get_eepromRD(_ah) == WOR4_WORLD) || \
-       (ath9k_regd_get_eepromRD(_ah) == WOR5_ETSIC))
-
-#define isUNII1OddChan(ch) \
-       ((ch == 5170) || (ch == 5190) || (ch == 5210) || (ch == 5230))
-
-#define IS_HT40_MODE(_mode)                                    \
-       (((_mode == ATH9K_MODE_11NA_HT40PLUS  ||                \
-          _mode == ATH9K_MODE_11NG_HT40PLUS    ||              \
-          _mode == ATH9K_MODE_11NA_HT40MINUS   ||              \
-          _mode == ATH9K_MODE_11NG_HT40MINUS) ? true : false))
-
-#define CHAN_FLAGS      (CHANNEL_ALL|CHANNEL_HALF|CHANNEL_QUARTER)
-
-#define swap_array(_a, _b, _size) {                   \
-       u8 *s = _b;                       \
-       int i = _size;                          \
-       do {                                    \
-               u8 tmp = *_a;             \
-               *_a++ = *s;                     \
-               *s++ = tmp;                     \
-       } while (--i);                          \
-       _a -= _size;                            \
-}
-
-
-#define HALF_MAXCHANBW          10
-
 #define MULTI_DOMAIN_MASK 0xFF00
 
 #define WORLD_SKU_MASK          0x00F0
 #define CHANNEL_HALF_BW         10
 #define CHANNEL_QUARTER_BW      5
 
-typedef int ath_hal_cmp_t(const void *, const void *);
-
 struct reg_dmn_pair_mapping {
        u16 regDmnEnum;
-       u16 regDmn5GHz;
-       u16 regDmn2GHz;
-       u32 flags5GHz;
-       u32 flags2GHz;
-       u64 pscanMask;
-       u16 singleCC;
-};
-
-struct ccmap {
-       char isoName[3];
-       u16 countryCode;
+       u16 reg_5ghz_ctl;
+       u16 reg_2ghz_ctl;
 };
 
 struct country_code_to_enum_rd {
        u16 countryCode;
        u16 regDmnEnum;
        const char *isoName;
-       const char *name;
-       bool allow11g;
-       bool allow11aTurbo;
-       bool allow11gTurbo;
-       bool allow11ng20;
-       bool allow11ng40;
-       bool allow11na20;
-       bool allow11na40;
-       u16 outdoorChanStart;
-};
-
-struct RegDmnFreqBand {
-       u16 lowChannel;
-       u16 highChannel;
-       u8 powerDfs;
-       u8 antennaMax;
-       u8 channelBW;
-       u8 channelSep;
-       u64 useDfs;
-       u64 usePassScan;
-       u8 regClassId;
-};
-
-struct regDomain {
-       u16 regDmnEnum;
-       u8 conformanceTestLimit;
-       u64 dfsMask;
-       u64 pscan;
-       u32 flags;
-       u64 chan11a[BMLEN];
-       u64 chan11a_turbo[BMLEN];
-       u64 chan11a_dyn_turbo[BMLEN];
-       u64 chan11b[BMLEN];
-       u64 chan11g[BMLEN];
-       u64 chan11g_turbo[BMLEN];
-};
-
-struct cmode {
-       u32 mode;
-       u32 flags;
-};
-
-#define YES true
-#define NO  false
-
-struct japan_bandcheck {
-       u16 freqbandbit;
-       u32 eepromflagtocheck;
 };
 
-struct common_mode_power {
-       u16 lchan;
-       u16 hchan;
-       u8 pwrlvl;
+struct ath9k_regulatory {
+       char alpha2[2];
+       u16 country_code;
+       u16 max_power_level;
+       u32 tp_scale;
+       u16 current_rd;
+       u16 current_rd_ext;
+       u16 current_rd_inuse;
+       int16_t power_limit;
+       struct reg_dmn_pair_mapping *regpair;
 };
 
 enum CountryCode {
@@ -406,7 +239,17 @@ enum CountryCode {
        CTRY_BELGIUM2 = 5002
 };
 
-void ath9k_regd_get_current_country(struct ath_hal *ah,
+u16 ath9k_regd_get_rd(struct ath_hw *ah);
+bool ath9k_is_world_regd(struct ath_hw *ah);
+const struct ieee80211_regdomain *ath9k_world_regdomain(struct ath_hw *ah);
+const struct ieee80211_regdomain *ath9k_default_world_regdomain(void);
+void ath9k_reg_apply_world_flags(struct wiphy *wiphy, enum reg_set_by setby);
+void ath9k_reg_apply_radar_flags(struct wiphy *wiphy);
+int ath9k_regd_init(struct ath_hw *ah);
+bool ath9k_regd_is_eeprom_valid(struct ath_hw *ah);
+u32 ath9k_regd_get_ctl(struct ath_hw *ah, struct ath9k_channel *chan);
+int ath9k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *request);
+void ath9k_regd_get_current_country(struct ath_hw *ah,
                                    struct ath9k_country_entry *ctry);
 
 #endif
index 6df1b3b77c253730a8e234ea954ae9ea568028cf..b41d0002f3fef4bad462be9ac2aa1544216d42e0 100644 (file)
@@ -150,1766 +150,324 @@ enum EnumRd {
        MKK9_MKKC = 0xFE,
        MKK9_MKKA2 = 0xFF,
 
-       APL1 = 0x0150,
-       APL2 = 0x0250,
-       APL3 = 0x0350,
-       APL4 = 0x0450,
-       APL5 = 0x0550,
-       APL6 = 0x0650,
-       APL7 = 0x0750,
-       APL8 = 0x0850,
-       APL9 = 0x0950,
-       APL10 = 0x1050,
-
-       ETSI1 = 0x0130,
-       ETSI2 = 0x0230,
-       ETSI3 = 0x0330,
-       ETSI4 = 0x0430,
-       ETSI5 = 0x0530,
-       ETSI6 = 0x0630,
-       ETSIA = 0x0A30,
-       ETSIB = 0x0B30,
-       ETSIC = 0x0C30,
-
-       FCC1 = 0x0110,
-       FCC2 = 0x0120,
-       FCC3 = 0x0160,
-       FCC4 = 0x0165,
-       FCC5 = 0x0510,
-       FCC6 = 0x0610,
-       FCCA = 0x0A10,
-
-       APLD = 0x0D50,
-
-       MKK1 = 0x0140,
-       MKK2 = 0x0240,
-       MKK3 = 0x0340,
-       MKK4 = 0x0440,
-       MKK5 = 0x0540,
-       MKK6 = 0x0640,
-       MKK7 = 0x0740,
-       MKK8 = 0x0840,
-       MKK9 = 0x0940,
-       MKK10 = 0x0B40,
-       MKK11 = 0x1140,
-       MKK12 = 0x1240,
-       MKK13 = 0x0C40,
-       MKK14 = 0x1440,
-       MKK15 = 0x1540,
-       MKKA = 0x0A40,
-       MKKC = 0x0A50,
-
-       NULL1 = 0x0198,
        WORLD = 0x0199,
        DEBUG_REG_DMN = 0x01ff,
 };
 
-enum {
-       FCC = 0x10,
-       MKK = 0x40,
-       ETSI = 0x30,
-};
-
-enum {
-       NO_REQ = 0x00000000,
-       DISALLOW_ADHOC_11A = 0x00000001,
-       DISALLOW_ADHOC_11A_TURB = 0x00000002,
-       NEED_NFC = 0x00000004,
-
-       ADHOC_PER_11D = 0x00000008,
-       ADHOC_NO_11A = 0x00000010,
-
-       PUBLIC_SAFETY_DOMAIN = 0x00000020,
-       LIMIT_FRAME_4MS = 0x00000040,
-
-       NO_HOSTAP = 0x00000080,
-
-       REQ_MASK = 0x000000FF,
+enum ctl_group {
+       CTL_FCC = 0x10,
+       CTL_MKK = 0x40,
+       CTL_ETSI = 0x30,
 };
 
-#define REG_DOMAIN_2GHZ_MASK    (REQ_MASK & \
-       (~(ADHOC_NO_11A | DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB)))
-#define REG_DOMAIN_5GHZ_MASK    REQ_MASK
-
+/* Regpair to CTL band mapping */
 static struct reg_dmn_pair_mapping regDomainPairs[] = {
-       {NO_ENUMRD, DEBUG_REG_DMN, DEBUG_REG_DMN, NO_REQ, NO_REQ,
-        PSCAN_DEFER, 0},
-       {NULL1_WORLD, NULL1, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {NULL1_ETSIB, NULL1, ETSIB, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {NULL1_ETSIC, NULL1, ETSIC, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-
-       {FCC2_FCCA, FCC2, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {FCC2_WORLD, FCC2, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {FCC2_ETSIC, FCC2, ETSIC, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {FCC3_FCCA, FCC3, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {FCC3_WORLD, FCC3, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {FCC4_FCCA, FCC4, FCCA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {FCC5_FCCA, FCC5, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {FCC6_FCCA, FCC6, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {FCC6_WORLD, FCC6, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-
-       {ETSI1_WORLD, ETSI1, WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {ETSI2_WORLD, ETSI2, WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {ETSI3_WORLD, ETSI3, WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {ETSI4_WORLD, ETSI4, WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {ETSI5_WORLD, ETSI5, WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {ETSI6_WORLD, ETSI6, WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-
-       {ETSI3_ETSIA, ETSI3, WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {FRANCE_RES, ETSI3, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-
-       {FCC1_WORLD, FCC1, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {FCC1_FCCA, FCC1, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL1_WORLD, APL1, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL2_WORLD, APL2, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL3_WORLD, APL3, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL4_WORLD, APL4, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL5_WORLD, APL5, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL6_WORLD, APL6, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL8_WORLD, APL8, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL9_WORLD, APL9, WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-
-       {APL3_FCCA, APL3, FCCA, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL1_ETSIC, APL1, ETSIC, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL2_ETSIC, APL2, ETSIC, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {APL2_APLD, APL2, APLD, NO_REQ, NO_REQ, PSCAN_DEFER,},
-
-       {MKK1_MKKA, MKK1, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA, CTRY_JAPAN},
-       {MKK1_MKKB, MKK1, MKKA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC |
-        LIMIT_FRAME_4MS, NEED_NFC, PSCAN_MKK1 | PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN1},
-       {MKK1_FCCA, MKK1, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1, CTRY_JAPAN2},
-       {MKK1_MKKA1, MKK1, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN4},
-       {MKK1_MKKA2, MKK1, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN5},
-       {MKK1_MKKC, MKK1, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1, CTRY_JAPAN6},
-
-       {MKK2_MKKA, MKK2, MKKA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC |
-        LIMIT_FRAME_4MS, NEED_NFC, PSCAN_MKK2 | PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN3},
-
-       {MKK3_MKKA, MKK3, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKKA, CTRY_JAPAN25},
-       {MKK3_MKKB, MKK3, MKKA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC |
-        LIMIT_FRAME_4MS, NEED_NFC, PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN7},
-       {MKK3_MKKA1, MKK3, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN26},
-       {MKK3_MKKA2, MKK3, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN8},
-       {MKK3_MKKC, MKK3, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        NO_PSCAN, CTRY_JAPAN9},
-       {MKK3_FCCA, MKK3, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        NO_PSCAN, CTRY_JAPAN27},
-
-       {MKK4_MKKA, MKK4, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3, CTRY_JAPAN36},
-       {MKK4_MKKB, MKK4, MKKA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC |
-        LIMIT_FRAME_4MS, NEED_NFC, PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN10},
-       {MKK4_MKKA1, MKK4, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN28},
-       {MKK4_MKKA2, MKK4, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN11},
-       {MKK4_MKKC, MKK4, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3, CTRY_JAPAN12},
-       {MKK4_FCCA, MKK4, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3, CTRY_JAPAN29},
-
-       {MKK5_MKKB, MKK5, MKKA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC |
-        LIMIT_FRAME_4MS, NEED_NFC, PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN13},
-       {MKK5_MKKA2, MKK5, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN14},
-       {MKK5_MKKC, MKK5, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3, CTRY_JAPAN15},
-
-       {MKK6_MKKB, MKK6, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA | PSCAN_MKKA_G, CTRY_JAPAN16},
-       {MKK6_MKKA1, MKK6, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN30},
-       {MKK6_MKKA2, MKK6, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN17},
-       {MKK6_MKKC, MKK6, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1, CTRY_JAPAN18},
-       {MKK6_FCCA, MKK6, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        NO_PSCAN, CTRY_JAPAN31},
-
-       {MKK7_MKKB, MKK7, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN19},
-       {MKK7_MKKA1, MKK7, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN32},
-       {MKK7_MKKA2, MKK7, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G,
-        CTRY_JAPAN20},
-       {MKK7_MKKC, MKK7, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3, CTRY_JAPAN21},
-       {MKK7_FCCA, MKK7, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3, CTRY_JAPAN33},
-
-       {MKK8_MKKB, MKK8, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN22},
-       {MKK8_MKKA2, MKK8, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G,
-        CTRY_JAPAN23},
-       {MKK8_MKKC, MKK8, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3, CTRY_JAPAN24},
-
-       {MKK9_MKKA, MKK9, MKKA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC |
-        LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK2 | PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN34},
-       {MKK9_FCCA, MKK9, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        NO_PSCAN, CTRY_JAPAN37},
-       {MKK9_MKKA1, MKK9, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN38},
-       {MKK9_MKKA2, MKK9, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN40},
-       {MKK9_MKKC, MKK9, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        NO_PSCAN, CTRY_JAPAN39},
-
-       {MKK10_MKKA, MKK10, MKKA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC |
-        LIMIT_FRAME_4MS, NEED_NFC, PSCAN_MKK2 | PSCAN_MKK3, CTRY_JAPAN35},
-       {MKK10_FCCA, MKK10, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        NO_PSCAN, CTRY_JAPAN41},
-       {MKK10_MKKA1, MKK10, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN42},
-       {MKK10_MKKA2, MKK10, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN44},
-       {MKK10_MKKC, MKK10, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        NO_PSCAN, CTRY_JAPAN43},
-
-       {MKK11_MKKA, MKK11, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3, CTRY_JAPAN45},
-       {MKK11_FCCA, MKK11, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3, CTRY_JAPAN46},
-       {MKK11_MKKA1, MKK11, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN47},
-       {MKK11_MKKA2, MKK11, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G, CTRY_JAPAN49},
-       {MKK11_MKKC, MKK11, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK3, CTRY_JAPAN48},
-
-       {MKK12_MKKA, MKK12, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3, CTRY_JAPAN50},
-       {MKK12_FCCA, MKK12, FCCA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3, CTRY_JAPAN51},
-       {MKK12_MKKA1, MKK12, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA1 | PSCAN_MKKA1_G,
-        CTRY_JAPAN52},
-       {MKK12_MKKA2, MKK12, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA2 | PSCAN_MKKA2_G,
-        CTRY_JAPAN54},
-       {MKK12_MKKC, MKK12, MKKC,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3, CTRY_JAPAN53},
-
-       {MKK13_MKKB, MKK13, MKKA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB | NEED_NFC |
-        LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKK3 | PSCAN_MKKA | PSCAN_MKKA_G,
-        CTRY_JAPAN57},
-
-       {MKK14_MKKA1, MKK14, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN58},
-       {MKK15_MKKA1, MKK15, MKKA,
-        DISALLOW_ADHOC_11A_TURB | NEED_NFC | LIMIT_FRAME_4MS, NEED_NFC,
-        PSCAN_MKK1 | PSCAN_MKKA1 | PSCAN_MKKA1_G, CTRY_JAPAN59},
-
-       {WOR0_WORLD, WOR0_WORLD, WOR0_WORLD, NO_REQ, NO_REQ, PSCAN_DEFER,
-        0},
-       {WOR1_WORLD, WOR1_WORLD, WOR1_WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {WOR2_WORLD, WOR2_WORLD, WOR2_WORLD, DISALLOW_ADHOC_11A_TURB,
-        NO_REQ, PSCAN_DEFER, 0},
-       {WOR3_WORLD, WOR3_WORLD, WOR3_WORLD, NO_REQ, NO_REQ, PSCAN_DEFER,
-        0},
-       {WOR4_WORLD, WOR4_WORLD, WOR4_WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {WOR5_ETSIC, WOR5_ETSIC, WOR5_ETSIC,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {WOR01_WORLD, WOR01_WORLD, WOR01_WORLD, NO_REQ, NO_REQ,
-        PSCAN_DEFER, 0},
-       {WOR02_WORLD, WOR02_WORLD, WOR02_WORLD, NO_REQ, NO_REQ,
-        PSCAN_DEFER, 0},
-       {EU1_WORLD, EU1_WORLD, EU1_WORLD, NO_REQ, NO_REQ, PSCAN_DEFER, 0},
-       {WOR9_WORLD, WOR9_WORLD, WOR9_WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {WORA_WORLD, WORA_WORLD, WORA_WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
-       {WORB_WORLD, WORB_WORLD, WORB_WORLD,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB, NO_REQ, PSCAN_DEFER,
-        0},
+       /* regpair, 5 GHz CTL, 2 GHz CTL */
+       {NO_ENUMRD, DEBUG_REG_DMN, DEBUG_REG_DMN},
+       {NULL1_WORLD, NO_CTL, CTL_ETSI},
+       {NULL1_ETSIB, NO_CTL, CTL_ETSI},
+       {NULL1_ETSIC, NO_CTL, CTL_ETSI},
+
+       {FCC2_FCCA, CTL_FCC, CTL_FCC},
+       {FCC2_WORLD, CTL_FCC, CTL_ETSI},
+       {FCC2_ETSIC, CTL_FCC, CTL_ETSI},
+       {FCC3_FCCA, CTL_FCC, CTL_FCC},
+       {FCC3_WORLD, CTL_FCC, CTL_ETSI},
+       {FCC4_FCCA, CTL_FCC, CTL_FCC},
+       {FCC5_FCCA, CTL_FCC, CTL_FCC},
+       {FCC6_FCCA, CTL_FCC, CTL_FCC},
+       {FCC6_WORLD, CTL_FCC, CTL_ETSI},
+
+       {ETSI1_WORLD, CTL_ETSI, CTL_ETSI},
+       {ETSI2_WORLD, CTL_ETSI, CTL_ETSI},
+       {ETSI3_WORLD, CTL_ETSI, CTL_ETSI},
+       {ETSI4_WORLD, CTL_ETSI, CTL_ETSI},
+       {ETSI5_WORLD, CTL_ETSI, CTL_ETSI},
+       {ETSI6_WORLD, CTL_ETSI, CTL_ETSI},
+
+       /* XXX: For ETSI3_ETSIA, Was NO_CTL meant for the 2 GHz band ? */
+       {ETSI3_ETSIA, CTL_ETSI, CTL_ETSI},
+       {FRANCE_RES, CTL_ETSI, CTL_ETSI},
+
+       {FCC1_WORLD, CTL_FCC, CTL_ETSI},
+       {FCC1_FCCA, CTL_FCC, CTL_FCC},
+       {APL1_WORLD, CTL_FCC, CTL_ETSI},
+       {APL2_WORLD, CTL_FCC, CTL_ETSI},
+       {APL3_WORLD, CTL_FCC, CTL_ETSI},
+       {APL4_WORLD, CTL_FCC, CTL_ETSI},
+       {APL5_WORLD, CTL_FCC, CTL_ETSI},
+       {APL6_WORLD, CTL_ETSI, CTL_ETSI},
+       {APL8_WORLD, CTL_ETSI, CTL_ETSI},
+       {APL9_WORLD, CTL_ETSI, CTL_ETSI},
+
+       {APL3_FCCA, CTL_FCC, CTL_FCC},
+       {APL1_ETSIC, CTL_FCC, CTL_ETSI},
+       {APL2_ETSIC, CTL_FCC, CTL_ETSI},
+       {APL2_APLD, CTL_FCC, NO_CTL},
+
+       {MKK1_MKKA, CTL_MKK, CTL_MKK},
+       {MKK1_MKKB, CTL_MKK, CTL_MKK},
+       {MKK1_FCCA, CTL_MKK, CTL_FCC},
+       {MKK1_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK1_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK1_MKKC, CTL_MKK, CTL_MKK},
+
+       {MKK2_MKKA, CTL_MKK, CTL_MKK},
+       {MKK3_MKKA, CTL_MKK, CTL_MKK},
+       {MKK3_MKKB, CTL_MKK, CTL_MKK},
+       {MKK3_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK3_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK3_MKKC, CTL_MKK, CTL_MKK},
+       {MKK3_FCCA, CTL_MKK, CTL_FCC},
+
+       {MKK4_MKKA, CTL_MKK, CTL_MKK},
+       {MKK4_MKKB, CTL_MKK, CTL_MKK},
+       {MKK4_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK4_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK4_MKKC, CTL_MKK, CTL_MKK},
+       {MKK4_FCCA, CTL_MKK, CTL_FCC},
+
+       {MKK5_MKKB, CTL_MKK, CTL_MKK},
+       {MKK5_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK5_MKKC, CTL_MKK, CTL_MKK},
+
+       {MKK6_MKKB, CTL_MKK, CTL_MKK},
+       {MKK6_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK6_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK6_MKKC, CTL_MKK, CTL_MKK},
+       {MKK6_FCCA, CTL_MKK, CTL_FCC},
+
+       {MKK7_MKKB, CTL_MKK, CTL_MKK},
+       {MKK7_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK7_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK7_MKKC, CTL_MKK, CTL_MKK},
+       {MKK7_FCCA, CTL_MKK, CTL_FCC},
+
+       {MKK8_MKKB, CTL_MKK, CTL_MKK},
+       {MKK8_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK8_MKKC, CTL_MKK, CTL_MKK},
+
+       {MKK9_MKKA, CTL_MKK, CTL_MKK},
+       {MKK9_FCCA, CTL_MKK, CTL_FCC},
+       {MKK9_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK9_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK9_MKKC, CTL_MKK, CTL_MKK},
+
+       {MKK10_MKKA, CTL_MKK, CTL_MKK},
+       {MKK10_FCCA, CTL_MKK, CTL_FCC},
+       {MKK10_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK10_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK10_MKKC, CTL_MKK, CTL_MKK},
+
+       {MKK11_MKKA, CTL_MKK, CTL_MKK},
+       {MKK11_FCCA, CTL_MKK, CTL_FCC},
+       {MKK11_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK11_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK11_MKKC, CTL_MKK, CTL_MKK},
+
+       {MKK12_MKKA, CTL_MKK, CTL_MKK},
+       {MKK12_FCCA, CTL_MKK, CTL_FCC},
+       {MKK12_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK12_MKKA2, CTL_MKK, CTL_MKK},
+       {MKK12_MKKC, CTL_MKK, CTL_MKK},
+
+       {MKK13_MKKB, CTL_MKK, CTL_MKK},
+       {MKK14_MKKA1, CTL_MKK, CTL_MKK},
+       {MKK15_MKKA1, CTL_MKK, CTL_MKK},
+
+       {WOR0_WORLD, NO_CTL, NO_CTL},
+       {WOR1_WORLD, NO_CTL, NO_CTL},
+       {WOR2_WORLD, NO_CTL, NO_CTL},
+       {WOR3_WORLD, NO_CTL, NO_CTL},
+       {WOR4_WORLD, NO_CTL, NO_CTL},
+       {WOR5_ETSIC, NO_CTL, NO_CTL},
+       {WOR01_WORLD, NO_CTL, NO_CTL},
+       {WOR02_WORLD, NO_CTL, NO_CTL},
+       {EU1_WORLD, NO_CTL, NO_CTL},
+       {WOR9_WORLD, NO_CTL, NO_CTL},
+       {WORA_WORLD, NO_CTL, NO_CTL},
+       {WORB_WORLD, NO_CTL, NO_CTL},
 };
 
-#define        NO_INTERSECT_REQ        0xFFFFFFFF
-#define        NO_UNION_REQ            0
-
 static struct country_code_to_enum_rd allCountries[] = {
-       {CTRY_DEBUG, NO_ENUMRD, "DB", "DEBUG", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_DEFAULT, DEF_REGDMN, "NA", "NO_COUNTRY_SET", YES, YES, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_ALBANIA, NULL1_WORLD, "AL", "ALBANIA", YES, NO, YES, YES, NO,
-        NO, NO, 7000},
-       {CTRY_ALGERIA, NULL1_WORLD, "DZ", "ALGERIA", YES, NO, YES, YES, NO,
-        NO, NO, 7000},
-       {CTRY_ARGENTINA, APL3_WORLD, "AR", "ARGENTINA", YES, NO, NO, YES,
-        NO, YES, NO, 7000},
-       {CTRY_ARMENIA, ETSI4_WORLD, "AM", "ARMENIA", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_AUSTRALIA, FCC2_WORLD, "AU", "AUSTRALIA", YES, YES, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_AUSTRALIA2, FCC6_WORLD, "AU", "AUSTRALIA2", YES, YES, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_AUSTRIA, ETSI1_WORLD, "AT", "AUSTRIA", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ", "AZERBAIJAN", YES, YES, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_BAHRAIN, APL6_WORLD, "BH", "BAHRAIN", YES, NO, YES, YES, YES,
-        YES, NO, 7000},
-       {CTRY_BELARUS, ETSI1_WORLD, "BY", "BELARUS", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_BELGIUM, ETSI1_WORLD, "BE", "BELGIUM", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_BELGIUM2, ETSI4_WORLD, "BL", "BELGIUM", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_BELIZE, APL1_ETSIC, "BZ", "BELIZE", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_BOLIVIA, APL1_ETSIC, "BO", "BOLVIA", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_BOSNIA_HERZ, ETSI1_WORLD, "BA", "BOSNIA_HERZGOWINA", YES, NO,
-        YES, YES, YES, YES, NO, 7000},
-       {CTRY_BRAZIL, FCC3_WORLD, "BR", "BRAZIL", YES, NO, NO, YES, NO,
-        YES, NO, 7000},
-       {CTRY_BRUNEI_DARUSSALAM, APL1_WORLD, "BN", "BRUNEI DARUSSALAM",
-        YES, YES, YES, YES, YES, YES, YES, 7000},
-       {CTRY_BULGARIA, ETSI6_WORLD, "BG", "BULGARIA", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_CANADA, FCC2_FCCA, "CA", "CANADA", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_CANADA2, FCC6_FCCA, "CA", "CANADA2", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_CHILE, APL6_WORLD, "CL", "CHILE", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_CHINA, APL1_WORLD, "CN", "CHINA", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_COLOMBIA, FCC1_FCCA, "CO", "COLOMBIA", YES, NO, YES, YES,
-        YES, YES, NO, 7000},
-       {CTRY_COSTA_RICA, FCC1_WORLD, "CR", "COSTA RICA", YES, NO, YES,
-        YES, YES, YES, NO, 7000},
-       {CTRY_CROATIA, ETSI3_WORLD, "HR", "CROATIA", YES, NO, YES, YES,
-        YES, YES, NO, 7000},
-       {CTRY_CYPRUS, ETSI1_WORLD, "CY", "CYPRUS", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_CZECH, ETSI3_WORLD, "CZ", "CZECH REPUBLIC", YES, NO, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_DENMARK, ETSI1_WORLD, "DK", "DENMARK", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_DOMINICAN_REPUBLIC, FCC1_FCCA, "DO", "DOMINICAN REPUBLIC",
-        YES, YES, YES, YES, YES, YES, YES, 7000},
-       {CTRY_ECUADOR, FCC1_WORLD, "EC", "ECUADOR", YES, NO, NO, YES, YES,
-        YES, NO, 7000},
-       {CTRY_EGYPT, ETSI3_WORLD, "EG", "EGYPT", YES, NO, YES, YES, YES,
-        YES, NO, 7000},
-       {CTRY_EL_SALVADOR, FCC1_WORLD, "SV", "EL SALVADOR", YES, NO, YES,
-        YES, YES, YES, NO, 7000},
-       {CTRY_ESTONIA, ETSI1_WORLD, "EE", "ESTONIA", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_FINLAND, ETSI1_WORLD, "FI", "FINLAND", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_FRANCE, ETSI1_WORLD, "FR", "FRANCE", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_GEORGIA, ETSI4_WORLD, "GE", "GEORGIA", YES, YES, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_GERMANY, ETSI1_WORLD, "DE", "GERMANY", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_GREECE, ETSI1_WORLD, "GR", "GREECE", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_GUATEMALA, FCC1_FCCA, "GT", "GUATEMALA", YES, YES, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_HONDURAS, NULL1_WORLD, "HN", "HONDURAS", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_HONG_KONG, FCC2_WORLD, "HK", "HONG KONG", YES, YES, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_HUNGARY, ETSI1_WORLD, "HU", "HUNGARY", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_ICELAND, ETSI1_WORLD, "IS", "ICELAND", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_INDIA, APL6_WORLD, "IN", "INDIA", YES, NO, YES, YES, YES,
-        YES, NO, 7000},
-       {CTRY_INDONESIA, APL1_WORLD, "ID", "INDONESIA", YES, NO, YES, YES,
-        YES, YES, NO, 7000},
-       {CTRY_IRAN, APL1_WORLD, "IR", "IRAN", YES, YES, YES, YES, YES, YES,
-        YES, 7000},
-       {CTRY_IRELAND, ETSI1_WORLD, "IE", "IRELAND", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_ISRAEL, NULL1_WORLD, "IL", "ISRAEL", YES, NO, YES, YES, YES,
-        NO, NO, 7000},
-       {CTRY_ITALY, ETSI1_WORLD, "IT", "ITALY", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAMAICA, ETSI1_WORLD, "JM", "JAMAICA", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-
-       {CTRY_JAPAN, MKK1_MKKA, "JP", "JAPAN", YES, NO, NO, YES, YES, YES,
-        YES, 7000},
-       {CTRY_JAPAN1, MKK1_MKKB, "JP", "JAPAN1", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN2, MKK1_FCCA, "JP", "JAPAN2", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN3, MKK2_MKKA, "JP", "JAPAN3", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN4, MKK1_MKKA1, "JP", "JAPAN4", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN5, MKK1_MKKA2, "JP", "JAPAN5", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN6, MKK1_MKKC, "JP", "JAPAN6", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JAPAN7, MKK3_MKKB, "JP", "JAPAN7", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN8, MKK3_MKKA2, "JP", "JAPAN8", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN9, MKK3_MKKC, "JP", "JAPAN9", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JAPAN10, MKK4_MKKB, "JP", "JAPAN10", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN11, MKK4_MKKA2, "JP", "JAPAN11", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN12, MKK4_MKKC, "JP", "JAPAN12", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JAPAN13, MKK5_MKKB, "JP", "JAPAN13", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN14, MKK5_MKKA2, "JP", "JAPAN14", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN15, MKK5_MKKC, "JP", "JAPAN15", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JAPAN16, MKK6_MKKB, "JP", "JAPAN16", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN17, MKK6_MKKA2, "JP", "JAPAN17", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN18, MKK6_MKKC, "JP", "JAPAN18", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JAPAN19, MKK7_MKKB, "JP", "JAPAN19", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN20, MKK7_MKKA2, "JP", "JAPAN20", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN21, MKK7_MKKC, "JP", "JAPAN21", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JAPAN22, MKK8_MKKB, "JP", "JAPAN22", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN23, MKK8_MKKA2, "JP", "JAPAN23", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN24, MKK8_MKKC, "JP", "JAPAN24", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JAPAN25, MKK3_MKKA, "JP", "JAPAN25", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN26, MKK3_MKKA1, "JP", "JAPAN26", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN27, MKK3_FCCA, "JP", "JAPAN27", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN28, MKK4_MKKA1, "JP", "JAPAN28", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN29, MKK4_FCCA, "JP", "JAPAN29", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN30, MKK6_MKKA1, "JP", "JAPAN30", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN31, MKK6_FCCA, "JP", "JAPAN31", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN32, MKK7_MKKA1, "JP", "JAPAN32", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN33, MKK7_FCCA, "JP", "JAPAN33", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN34, MKK9_MKKA, "JP", "JAPAN34", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN35, MKK10_MKKA, "JP", "JAPAN35", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN36, MKK4_MKKA, "JP", "JAPAN36", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN37, MKK9_FCCA, "JP", "JAPAN37", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN38, MKK9_MKKA1, "JP", "JAPAN38", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN39, MKK9_MKKC, "JP", "JAPAN39", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN40, MKK9_MKKA2, "JP", "JAPAN40", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN41, MKK10_FCCA, "JP", "JAPAN41", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN42, MKK10_MKKA1, "JP", "JAPAN42", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN43, MKK10_MKKC, "JP", "JAPAN43", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN44, MKK10_MKKA2, "JP", "JAPAN44", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN45, MKK11_MKKA, "JP", "JAPAN45", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN46, MKK11_FCCA, "JP", "JAPAN46", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN47, MKK11_MKKA1, "JP", "JAPAN47", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN48, MKK11_MKKC, "JP", "JAPAN48", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN49, MKK11_MKKA2, "JP", "JAPAN49", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN50, MKK12_MKKA, "JP", "JAPAN50", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN51, MKK12_FCCA, "JP", "JAPAN51", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN52, MKK12_MKKA1, "JP", "JAPAN52", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN53, MKK12_MKKC, "JP", "JAPAN53", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN54, MKK12_MKKA2, "JP", "JAPAN54", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JAPAN57, MKK13_MKKB, "JP", "JAPAN57", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN58, MKK14_MKKA1, "JP", "JAPAN58", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-       {CTRY_JAPAN59, MKK15_MKKA1, "JP", "JAPAN59", YES, NO, NO, YES, YES,
-        YES, YES, 7000},
-
-       {CTRY_JORDAN, ETSI2_WORLD, "JO", "JORDAN", YES, NO, YES, YES, YES,
-        YES, NO, 7000},
-       {CTRY_KAZAKHSTAN, NULL1_WORLD, "KZ", "KAZAKHSTAN", YES, NO, YES,
-        YES, YES, NO, NO, 7000},
-       {CTRY_KOREA_NORTH, APL9_WORLD, "KP", "NORTH KOREA", YES, NO, NO,
-        YES, YES, YES, YES, 7000},
-       {CTRY_KOREA_ROC, APL9_WORLD, "KR", "KOREA REPUBLIC", YES, NO, NO,
-        YES, NO, YES, NO, 7000},
-       {CTRY_KOREA_ROC2, APL2_WORLD, "K2", "KOREA REPUBLIC2", YES, NO, NO,
-        YES, NO, YES, NO, 7000},
-       {CTRY_KOREA_ROC3, APL9_WORLD, "K3", "KOREA REPUBLIC3", YES, NO, NO,
-        YES, NO, YES, NO, 7000},
-       {CTRY_KUWAIT, NULL1_WORLD, "KW", "KUWAIT", YES, NO, YES, YES, YES,
-        NO, NO, 7000},
-       {CTRY_LATVIA, ETSI1_WORLD, "LV", "LATVIA", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_LEBANON, NULL1_WORLD, "LB", "LEBANON", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_LIECHTENSTEIN, ETSI1_WORLD, "LI", "LIECHTENSTEIN", YES, NO,
-        YES, YES, YES, YES, YES, 7000},
-       {CTRY_LITHUANIA, ETSI1_WORLD, "LT", "LITHUANIA", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_LUXEMBOURG, ETSI1_WORLD, "LU", "LUXEMBOURG", YES, NO, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_MACAU, FCC2_WORLD, "MO", "MACAU", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_MACEDONIA, NULL1_WORLD, "MK", "MACEDONIA", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_MALAYSIA, APL8_WORLD, "MY", "MALAYSIA", YES, NO, NO, YES, NO,
-        YES, NO, 7000},
-       {CTRY_MALTA, ETSI1_WORLD, "MT", "MALTA", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_MEXICO, FCC1_FCCA, "MX", "MEXICO", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_MONACO, ETSI4_WORLD, "MC", "MONACO", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_MOROCCO, NULL1_WORLD, "MA", "MOROCCO", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_NEPAL, APL1_WORLD, "NP", "NEPAL", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_NETHERLANDS, ETSI1_WORLD, "NL", "NETHERLANDS", YES, NO, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_NETHERLANDS_ANTILLES, ETSI1_WORLD, "AN",
-        "NETHERLANDS-ANTILLES", YES, NO, YES, YES, YES, YES, YES, 7000},
-       {CTRY_NEW_ZEALAND, FCC2_ETSIC, "NZ", "NEW ZEALAND", YES, NO, YES,
-        YES, YES, YES, NO, 7000},
-       {CTRY_NORWAY, ETSI1_WORLD, "NO", "NORWAY", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_OMAN, APL6_WORLD, "OM", "OMAN", YES, NO, YES, YES, YES, YES,
-        NO, 7000},
-       {CTRY_PAKISTAN, NULL1_WORLD, "PK", "PAKISTAN", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_PANAMA, FCC1_FCCA, "PA", "PANAMA", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_PAPUA_NEW_GUINEA, FCC1_WORLD, "PG", "PAPUA NEW GUINEA", YES,
-        YES, YES, YES, YES, YES, YES, 7000},
-       {CTRY_PERU, APL1_WORLD, "PE", "PERU", YES, NO, YES, YES, YES, YES,
-        NO, 7000},
-       {CTRY_PHILIPPINES, APL1_WORLD, "PH", "PHILIPPINES", YES, YES, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_POLAND, ETSI1_WORLD, "PL", "POLAND", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_PORTUGAL, ETSI1_WORLD, "PT", "PORTUGAL", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_PUERTO_RICO, FCC1_FCCA, "PR", "PUERTO RICO", YES, YES, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_QATAR, NULL1_WORLD, "QA", "QATAR", YES, NO, YES, YES, YES,
-        NO, NO, 7000},
-       {CTRY_ROMANIA, NULL1_WORLD, "RO", "ROMANIA", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_RUSSIA, NULL1_WORLD, "RU", "RUSSIA", YES, NO, YES, YES, YES,
-        NO, NO, 7000},
-       {CTRY_SAUDI_ARABIA, NULL1_WORLD, "SA", "SAUDI ARABIA", YES, NO,
-        YES, YES, YES, NO, NO, 7000},
-       {CTRY_SERBIA_MONTENEGRO, ETSI1_WORLD, "CS", "SERBIA & MONTENEGRO",
-        YES, NO, YES, YES, YES, YES, YES, 7000},
-       {CTRY_SINGAPORE, APL6_WORLD, "SG", "SINGAPORE", YES, YES, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_SLOVAKIA, ETSI1_WORLD, "SK", "SLOVAK REPUBLIC", YES, NO, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_SLOVENIA, ETSI1_WORLD, "SI", "SLOVENIA", YES, NO, YES, YES,
-        YES, YES, YES, 7000},
-       {CTRY_SOUTH_AFRICA, FCC3_WORLD, "ZA", "SOUTH AFRICA", YES, NO, YES,
-        YES, YES, YES, NO, 7000},
-       {CTRY_SPAIN, ETSI1_WORLD, "ES", "SPAIN", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_SRI_LANKA, FCC3_WORLD, "LK", "SRI LANKA", YES, NO, YES, YES,
-        YES, YES, NO, 7000},
-       {CTRY_SWEDEN, ETSI1_WORLD, "SE", "SWEDEN", YES, NO, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_SWITZERLAND, ETSI1_WORLD, "CH", "SWITZERLAND", YES, NO, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_SYRIA, NULL1_WORLD, "SY", "SYRIA", YES, NO, YES, YES, YES,
-        NO, NO, 7000},
-       {CTRY_TAIWAN, APL3_FCCA, "TW", "TAIWAN", YES, YES, YES, YES, YES,
-        YES, YES, 7000},
-       {CTRY_THAILAND, NULL1_WORLD, "TH", "THAILAND", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_TRINIDAD_Y_TOBAGO, ETSI4_WORLD, "TT", "TRINIDAD & TOBAGO",
-        YES, NO, YES, YES, YES, YES, NO, 7000},
-       {CTRY_TUNISIA, ETSI3_WORLD, "TN", "TUNISIA", YES, NO, YES, YES,
-        YES, YES, NO, 7000},
-       {CTRY_TURKEY, ETSI3_WORLD, "TR", "TURKEY", YES, NO, YES, YES, YES,
-        YES, NO, 7000},
-       {CTRY_UKRAINE, NULL1_WORLD, "UA", "UKRAINE", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_UAE, NULL1_WORLD, "AE", "UNITED ARAB EMIRATES", YES, NO, YES,
-        YES, YES, NO, NO, 7000},
-       {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB", "UNITED KINGDOM", YES, NO,
-        YES, YES, YES, YES, YES, 7000},
-       {CTRY_UNITED_STATES, FCC3_FCCA, "US", "UNITED STATES", YES, YES,
-        YES, YES, YES, YES, YES, 5825},
-       {CTRY_UNITED_STATES_FCC49, FCC4_FCCA, "PS",
-        "UNITED STATES (PUBLIC SAFETY)", YES, YES, YES, YES, YES, YES,
-        YES, 7000},
-       {CTRY_URUGUAY, APL2_WORLD, "UY", "URUGUAY", YES, NO, YES, YES, YES,
-        YES, NO, 7000},
-       {CTRY_UZBEKISTAN, FCC3_FCCA, "UZ", "UZBEKISTAN", YES, YES, YES,
-        YES, YES, YES, YES, 7000},
-       {CTRY_VENEZUELA, APL2_ETSIC, "VE", "VENEZUELA", YES, NO, YES, YES,
-        YES, YES, NO, 7000},
-       {CTRY_VIET_NAM, NULL1_WORLD, "VN", "VIET NAM", YES, NO, YES, YES,
-        YES, NO, NO, 7000},
-       {CTRY_YEMEN, NULL1_WORLD, "YE", "YEMEN", YES, NO, YES, YES, YES,
-        NO, NO, 7000},
-       {CTRY_ZIMBABWE, NULL1_WORLD, "ZW", "ZIMBABWE", YES, NO, YES, YES,
-        YES, NO, NO, 7000}
-};
-
-enum {
-       NO_DFS = 0x0000000000000000ULL,
-       DFS_FCC3 = 0x0000000000000001ULL,
-       DFS_ETSI = 0x0000000000000002ULL,
-       DFS_MKK4 = 0x0000000000000004ULL,
-};
-
-enum {
-       F1_4915_4925,
-       F1_4935_4945,
-       F1_4920_4980,
-       F1_4942_4987,
-       F1_4945_4985,
-       F1_4950_4980,
-       F1_5035_5040,
-       F1_5040_5080,
-       F1_5055_5055,
-
-       F1_5120_5240,
-
-       F1_5170_5230,
-       F2_5170_5230,
-
-       F1_5180_5240,
-       F2_5180_5240,
-       F3_5180_5240,
-       F4_5180_5240,
-       F5_5180_5240,
-       F6_5180_5240,
-       F7_5180_5240,
-       F8_5180_5240,
-
-       F1_5180_5320,
-
-       F1_5240_5280,
-
-       F1_5260_5280,
-
-       F1_5260_5320,
-       F2_5260_5320,
-       F3_5260_5320,
-       F4_5260_5320,
-       F5_5260_5320,
-       F6_5260_5320,
-
-       F1_5260_5700,
-
-       F1_5280_5320,
-
-       F1_5500_5580,
-
-       F1_5500_5620,
-
-       F1_5500_5700,
-       F2_5500_5700,
-       F3_5500_5700,
-       F4_5500_5700,
-       F5_5500_5700,
-
-       F1_5660_5700,
-
-       F1_5745_5805,
-       F2_5745_5805,
-       F3_5745_5805,
-
-       F1_5745_5825,
-       F2_5745_5825,
-       F3_5745_5825,
-       F4_5745_5825,
-       F5_5745_5825,
-       F6_5745_5825,
-
-       W1_4920_4980,
-       W1_5040_5080,
-       W1_5170_5230,
-       W1_5180_5240,
-       W1_5260_5320,
-       W1_5745_5825,
-       W1_5500_5700,
-       A_DEMO_ALL_CHANNELS
-};
-
-static struct RegDmnFreqBand regDmn5GhzFreq[] = {
-       {4915, 4925, 23, 0, 10, 5, NO_DFS, PSCAN_MKK2, 16},
-       {4935, 4945, 23, 0, 10, 5, NO_DFS, PSCAN_MKK2, 16},
-       {4920, 4980, 23, 0, 20, 20, NO_DFS, PSCAN_MKK2, 7},
-       {4942, 4987, 27, 6, 5, 5, NO_DFS, PSCAN_FCC, 0},
-       {4945, 4985, 30, 6, 10, 5, NO_DFS, PSCAN_FCC, 0},
-       {4950, 4980, 33, 6, 20, 5, NO_DFS, PSCAN_FCC, 0},
-       {5035, 5040, 23, 0, 10, 5, NO_DFS, PSCAN_MKK2, 12},
-       {5040, 5080, 23, 0, 20, 20, NO_DFS, PSCAN_MKK2, 2},
-       {5055, 5055, 23, 0, 10, 5, NO_DFS, PSCAN_MKK2, 12},
-
-       {5120, 5240, 5, 6, 20, 20, NO_DFS, NO_PSCAN, 0},
-
-       {5170, 5230, 23, 0, 20, 20, NO_DFS, PSCAN_MKK1 | PSCAN_MKK2, 1},
-       {5170, 5230, 20, 0, 20, 20, NO_DFS, PSCAN_MKK1 | PSCAN_MKK2, 1},
-
-       {5180, 5240, 15, 0, 20, 20, NO_DFS, PSCAN_FCC | PSCAN_ETSI, 0},
-       {5180, 5240, 17, 6, 20, 20, NO_DFS, NO_PSCAN, 1},
-       {5180, 5240, 18, 0, 20, 20, NO_DFS, PSCAN_FCC | PSCAN_ETSI, 0},
-       {5180, 5240, 20, 0, 20, 20, NO_DFS, PSCAN_FCC | PSCAN_ETSI, 0},
-       {5180, 5240, 23, 0, 20, 20, NO_DFS, PSCAN_FCC | PSCAN_ETSI, 0},
-       {5180, 5240, 23, 6, 20, 20, NO_DFS, PSCAN_FCC, 0},
-       {5180, 5240, 20, 0, 20, 20, NO_DFS, PSCAN_MKK1 | PSCAN_MKK3, 0},
-       {5180, 5240, 23, 6, 20, 20, NO_DFS, NO_PSCAN, 0},
-
-       {5180, 5320, 20, 6, 20, 20, NO_DFS, PSCAN_ETSI, 0},
-
-       {5240, 5280, 23, 0, 20, 20, DFS_FCC3, PSCAN_FCC | PSCAN_ETSI, 0},
-
-       {5260, 5280, 23, 0, 20, 20, DFS_FCC3 | DFS_ETSI,
-        PSCAN_FCC | PSCAN_ETSI, 0},
-
-       {5260, 5320, 18, 0, 20, 20, DFS_FCC3 | DFS_ETSI,
-        PSCAN_FCC | PSCAN_ETSI, 0},
-
-       {5260, 5320, 20, 0, 20, 20, DFS_FCC3 | DFS_ETSI | DFS_MKK4,
-        PSCAN_FCC | PSCAN_ETSI | PSCAN_MKK3, 0},
-
-
-       {5260, 5320, 20, 6, 20, 20, DFS_FCC3 | DFS_ETSI,
-        PSCAN_FCC | PSCAN_ETSI, 2},
-       {5260, 5320, 23, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 2},
-       {5260, 5320, 23, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 0},
-       {5260, 5320, 30, 0, 20, 20, NO_DFS, NO_PSCAN, 0},
-
-       {5260, 5700, 5, 6, 20, 20, DFS_FCC3 | DFS_ETSI, NO_PSCAN, 0},
-
-       {5280, 5320, 17, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 0},
-
-       {5500, 5580, 23, 6, 20, 20, DFS_FCC3, PSCAN_FCC, 0},
-
-       {5500, 5620, 30, 6, 20, 20, DFS_ETSI, PSCAN_ETSI, 0},
-
-       {5500, 5700, 20, 6, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_FCC, 4},
-       {5500, 5700, 27, 0, 20, 20, DFS_FCC3 | DFS_ETSI,
-        PSCAN_FCC | PSCAN_ETSI, 0},
-       {5500, 5700, 30, 0, 20, 20, DFS_FCC3 | DFS_ETSI,
-        PSCAN_FCC | PSCAN_ETSI, 0},
-       {5500, 5700, 23, 0, 20, 20, DFS_FCC3 | DFS_ETSI | DFS_MKK4,
-        PSCAN_MKK3 | PSCAN_FCC, 0},
-       {5500, 5700, 30, 6, 20, 20, DFS_ETSI, PSCAN_ETSI, 0},
-
-       {5660, 5700, 23, 6, 20, 20, DFS_FCC3, PSCAN_FCC, 0},
-
-       {5745, 5805, 23, 0, 20, 20, NO_DFS, NO_PSCAN, 0},
-       {5745, 5805, 30, 6, 20, 20, NO_DFS, NO_PSCAN, 0},
-       {5745, 5805, 30, 6, 20, 20, NO_DFS, PSCAN_ETSI, 0},
-       {5745, 5825, 5, 6, 20, 20, NO_DFS, NO_PSCAN, 0},
-       {5745, 5825, 17, 0, 20, 20, NO_DFS, NO_PSCAN, 0},
-       {5745, 5825, 20, 0, 20, 20, NO_DFS, NO_PSCAN, 0},
-       {5745, 5825, 30, 0, 20, 20, NO_DFS, NO_PSCAN, 0},
-       {5745, 5825, 30, 6, 20, 20, NO_DFS, NO_PSCAN, 3},
-       {5745, 5825, 30, 6, 20, 20, NO_DFS, NO_PSCAN, 0},
-
-
-       {4920, 4980, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0},
-       {5040, 5080, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0},
-       {5170, 5230, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0},
-       {5180, 5240, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0},
-       {5260, 5320, 30, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0},
-       {5745, 5825, 30, 0, 20, 20, NO_DFS, PSCAN_WWR, 0},
-       {5500, 5700, 30, 0, 20, 20, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, 0},
-       {4920, 6100, 30, 6, 20, 20, NO_DFS, NO_PSCAN, 0},
-};
-
-enum {
-       T1_5130_5650,
-       T1_5150_5670,
-
-       T1_5200_5200,
-       T2_5200_5200,
-       T3_5200_5200,
-       T4_5200_5200,
-       T5_5200_5200,
-       T6_5200_5200,
-       T7_5200_5200,
-       T8_5200_5200,
-
-       T1_5200_5280,
-       T2_5200_5280,
-       T3_5200_5280,
-       T4_5200_5280,
-       T5_5200_5280,
-       T6_5200_5280,
-
-       T1_5200_5240,
-       T1_5210_5210,
-       T2_5210_5210,
-       T3_5210_5210,
-       T4_5210_5210,
-       T5_5210_5210,
-       T6_5210_5210,
-       T7_5210_5210,
-       T8_5210_5210,
-       T9_5210_5210,
-       T10_5210_5210,
-       T1_5240_5240,
-
-       T1_5210_5250,
-       T1_5210_5290,
-       T2_5210_5290,
-       T3_5210_5290,
-
-       T1_5280_5280,
-       T2_5280_5280,
-       T1_5290_5290,
-       T2_5290_5290,
-       T3_5290_5290,
-       T1_5250_5290,
-       T2_5250_5290,
-       T3_5250_5290,
-       T4_5250_5290,
-
-       T1_5540_5660,
-       T2_5540_5660,
-       T3_5540_5660,
-       T1_5760_5800,
-       T2_5760_5800,
-       T3_5760_5800,
-       T4_5760_5800,
-       T5_5760_5800,
-       T6_5760_5800,
-       T7_5760_5800,
-
-       T1_5765_5805,
-       T2_5765_5805,
-       T3_5765_5805,
-       T4_5765_5805,
-       T5_5765_5805,
-       T6_5765_5805,
-       T7_5765_5805,
-       T8_5765_5805,
-       T9_5765_5805,
-
-       WT1_5210_5250,
-       WT1_5290_5290,
-       WT1_5540_5660,
-       WT1_5760_5800,
-};
-
-enum {
-       F1_2312_2372,
-       F2_2312_2372,
-
-       F1_2412_2472,
-       F2_2412_2472,
-       F3_2412_2472,
-
-       F1_2412_2462,
-       F2_2412_2462,
-
-       F1_2432_2442,
-
-       F1_2457_2472,
-
-       F1_2467_2472,
-
-       F1_2484_2484,
-       F2_2484_2484,
-
-       F1_2512_2732,
-
-       W1_2312_2372,
-       W1_2412_2412,
-       W1_2417_2432,
-       W1_2437_2442,
-       W1_2447_2457,
-       W1_2462_2462,
-       W1_2467_2467,
-       W2_2467_2467,
-       W1_2472_2472,
-       W2_2472_2472,
-       W1_2484_2484,
-       W2_2484_2484,
-};
-
-static struct RegDmnFreqBand regDmn2GhzFreq[] = {
-       {2312, 2372, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2312, 2372, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2412, 2472, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2412, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA, 0},
-       {2412, 2472, 30, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2412, 2462, 27, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2412, 2462, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA, 0},
-
-       {2432, 2442, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2457, 2472, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2467, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA2 | PSCAN_MKKA, 0},
-
-       {2484, 2484, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2484, 2484, 20, 0, 20, 5, NO_DFS,
-        PSCAN_MKKA | PSCAN_MKKA1 | PSCAN_MKKA2, 0},
-
-       {2512, 2732, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2312, 2372, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2412, 2412, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2417, 2432, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2437, 2442, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2447, 2457, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2462, 2462, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2467, 2467, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0},
-       {2467, 2467, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0},
-       {2472, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0},
-       {2472, 2472, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0},
-       {2484, 2484, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0},
-       {2484, 2484, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0},
-};
-
-enum {
-       G1_2312_2372,
-       G2_2312_2372,
-
-       G1_2412_2472,
-       G2_2412_2472,
-       G3_2412_2472,
-
-       G1_2412_2462,
-       G2_2412_2462,
-
-       G1_2432_2442,
-
-       G1_2457_2472,
-
-       G1_2512_2732,
-
-       G1_2467_2472,
-
-       WG1_2312_2372,
-       WG1_2412_2462,
-       WG1_2467_2472,
-       WG2_2467_2472,
-       G_DEMO_ALL_CHANNELS
-};
-
-static struct RegDmnFreqBand regDmn2Ghz11gFreq[] = {
-       {2312, 2372, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2312, 2372, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2412, 2472, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2412, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA_G, 0},
-       {2412, 2472, 30, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2412, 2462, 27, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2412, 2462, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA_G, 0},
-
-       {2432, 2442, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2457, 2472, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2512, 2732, 5, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-
-       {2467, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_MKKA2 | PSCAN_MKKA, 0},
-
-       {2312, 2372, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2412, 2462, 20, 0, 20, 5, NO_DFS, NO_PSCAN, 0},
-       {2467, 2472, 20, 0, 20, 5, NO_DFS, PSCAN_WWR | IS_ECM_CHAN, 0},
-       {2467, 2472, 20, 0, 20, 5, NO_DFS, NO_PSCAN | IS_ECM_CHAN, 0},
-       {2312, 2732, 27, 6, 20, 5, NO_DFS, NO_PSCAN, 0},
-};
-
-enum {
-       T1_2312_2372,
-       T1_2437_2437,
-       T2_2437_2437,
-       T3_2437_2437,
-       T1_2512_2732
+       {CTRY_DEBUG, NO_ENUMRD, "DB"},
+       {CTRY_DEFAULT, FCC1_FCCA, "CO"},
+       {CTRY_ALBANIA, NULL1_WORLD, "AL"},
+       {CTRY_ALGERIA, NULL1_WORLD, "DZ"},
+       {CTRY_ARGENTINA, APL3_WORLD, "AR"},
+       {CTRY_ARMENIA, ETSI4_WORLD, "AM"},
+       {CTRY_AUSTRALIA, FCC2_WORLD, "AU"},
+       {CTRY_AUSTRALIA2, FCC6_WORLD, "AU"},
+       {CTRY_AUSTRIA, ETSI1_WORLD, "AT"},
+       {CTRY_AZERBAIJAN, ETSI4_WORLD, "AZ"},
+       {CTRY_BAHRAIN, APL6_WORLD, "BH"},
+       {CTRY_BELARUS, ETSI1_WORLD, "BY"},
+       {CTRY_BELGIUM, ETSI1_WORLD, "BE"},
+       {CTRY_BELGIUM2, ETSI4_WORLD, "BL"},
+       {CTRY_BELIZE, APL1_ETSIC, "BZ"},
+       {CTRY_BOLIVIA, APL1_ETSIC, "BO"},
+       {CTRY_BOSNIA_HERZ, ETSI1_WORLD, "BA"},
+       {CTRY_BRAZIL, FCC3_WORLD, "BR"},
+       {CTRY_BRUNEI_DARUSSALAM, APL1_WORLD, "BN"},
+       {CTRY_BULGARIA, ETSI6_WORLD, "BG"},
+       {CTRY_CANADA, FCC2_FCCA, "CA"},
+       {CTRY_CANADA2, FCC6_FCCA, "CA"},
+       {CTRY_CHILE, APL6_WORLD, "CL"},
+       {CTRY_CHINA, APL1_WORLD, "CN"},
+       {CTRY_COLOMBIA, FCC1_FCCA, "CO"},
+       {CTRY_COSTA_RICA, FCC1_WORLD, "CR"},
+       {CTRY_CROATIA, ETSI3_WORLD, "HR"},
+       {CTRY_CYPRUS, ETSI1_WORLD, "CY"},
+       {CTRY_CZECH, ETSI3_WORLD, "CZ"},
+       {CTRY_DENMARK, ETSI1_WORLD, "DK"},
+       {CTRY_DOMINICAN_REPUBLIC, FCC1_FCCA, "DO"},
+       {CTRY_ECUADOR, FCC1_WORLD, "EC"},
+       {CTRY_EGYPT, ETSI3_WORLD, "EG"},
+       {CTRY_EL_SALVADOR, FCC1_WORLD, "SV"},
+       {CTRY_ESTONIA, ETSI1_WORLD, "EE"},
+       {CTRY_FINLAND, ETSI1_WORLD, "FI"},
+       {CTRY_FRANCE, ETSI1_WORLD, "FR"},
+       {CTRY_GEORGIA, ETSI4_WORLD, "GE"},
+       {CTRY_GERMANY, ETSI1_WORLD, "DE"},
+       {CTRY_GREECE, ETSI1_WORLD, "GR"},
+       {CTRY_GUATEMALA, FCC1_FCCA, "GT"},
+       {CTRY_HONDURAS, NULL1_WORLD, "HN"},
+       {CTRY_HONG_KONG, FCC2_WORLD, "HK"},
+       {CTRY_HUNGARY, ETSI1_WORLD, "HU"},
+       {CTRY_ICELAND, ETSI1_WORLD, "IS"},
+       {CTRY_INDIA, APL6_WORLD, "IN"},
+       {CTRY_INDONESIA, APL1_WORLD, "ID"},
+       {CTRY_IRAN, APL1_WORLD, "IR"},
+       {CTRY_IRELAND, ETSI1_WORLD, "IE"},
+       {CTRY_ISRAEL, NULL1_WORLD, "IL"},
+       {CTRY_ITALY, ETSI1_WORLD, "IT"},
+       {CTRY_JAMAICA, ETSI1_WORLD, "JM"},
+
+       {CTRY_JAPAN, MKK1_MKKA, "JP"},
+       {CTRY_JAPAN1, MKK1_MKKB, "JP"},
+       {CTRY_JAPAN2, MKK1_FCCA, "JP"},
+       {CTRY_JAPAN3, MKK2_MKKA, "JP"},
+       {CTRY_JAPAN4, MKK1_MKKA1, "JP"},
+       {CTRY_JAPAN5, MKK1_MKKA2, "JP"},
+       {CTRY_JAPAN6, MKK1_MKKC, "JP"},
+       {CTRY_JAPAN7, MKK3_MKKB, "JP"},
+       {CTRY_JAPAN8, MKK3_MKKA2, "JP"},
+       {CTRY_JAPAN9, MKK3_MKKC, "JP"},
+       {CTRY_JAPAN10, MKK4_MKKB, "JP"},
+       {CTRY_JAPAN11, MKK4_MKKA2, "JP"},
+       {CTRY_JAPAN12, MKK4_MKKC, "JP"},
+       {CTRY_JAPAN13, MKK5_MKKB, "JP"},
+       {CTRY_JAPAN14, MKK5_MKKA2, "JP"},
+       {CTRY_JAPAN15, MKK5_MKKC, "JP"},
+       {CTRY_JAPAN16, MKK6_MKKB, "JP"},
+       {CTRY_JAPAN17, MKK6_MKKA2, "JP"},
+       {CTRY_JAPAN18, MKK6_MKKC, "JP"},
+       {CTRY_JAPAN19, MKK7_MKKB, "JP"},
+       {CTRY_JAPAN20, MKK7_MKKA2, "JP"},
+       {CTRY_JAPAN21, MKK7_MKKC, "JP"},
+       {CTRY_JAPAN22, MKK8_MKKB, "JP"},
+       {CTRY_JAPAN23, MKK8_MKKA2, "JP"},
+       {CTRY_JAPAN24, MKK8_MKKC, "JP"},
+       {CTRY_JAPAN25, MKK3_MKKA, "JP"},
+       {CTRY_JAPAN26, MKK3_MKKA1, "JP"},
+       {CTRY_JAPAN27, MKK3_FCCA, "JP"},
+       {CTRY_JAPAN28, MKK4_MKKA1, "JP"},
+       {CTRY_JAPAN29, MKK4_FCCA, "JP"},
+       {CTRY_JAPAN30, MKK6_MKKA1, "JP"},
+       {CTRY_JAPAN31, MKK6_FCCA, "JP"},
+       {CTRY_JAPAN32, MKK7_MKKA1, "JP"},
+       {CTRY_JAPAN33, MKK7_FCCA, "JP"},
+       {CTRY_JAPAN34, MKK9_MKKA, "JP"},
+       {CTRY_JAPAN35, MKK10_MKKA, "JP"},
+       {CTRY_JAPAN36, MKK4_MKKA, "JP"},
+       {CTRY_JAPAN37, MKK9_FCCA, "JP"},
+       {CTRY_JAPAN38, MKK9_MKKA1, "JP"},
+       {CTRY_JAPAN39, MKK9_MKKC, "JP"},
+       {CTRY_JAPAN40, MKK9_MKKA2, "JP"},
+       {CTRY_JAPAN41, MKK10_FCCA, "JP"},
+       {CTRY_JAPAN42, MKK10_MKKA1, "JP"},
+       {CTRY_JAPAN43, MKK10_MKKC, "JP"},
+       {CTRY_JAPAN44, MKK10_MKKA2, "JP"},
+       {CTRY_JAPAN45, MKK11_MKKA, "JP"},
+       {CTRY_JAPAN46, MKK11_FCCA, "JP"},
+       {CTRY_JAPAN47, MKK11_MKKA1, "JP"},
+       {CTRY_JAPAN48, MKK11_MKKC, "JP"},
+       {CTRY_JAPAN49, MKK11_MKKA2, "JP"},
+       {CTRY_JAPAN50, MKK12_MKKA, "JP"},
+       {CTRY_JAPAN51, MKK12_FCCA, "JP"},
+       {CTRY_JAPAN52, MKK12_MKKA1, "JP"},
+       {CTRY_JAPAN53, MKK12_MKKC, "JP"},
+       {CTRY_JAPAN54, MKK12_MKKA2, "JP"},
+       {CTRY_JAPAN57, MKK13_MKKB, "JP"},
+       {CTRY_JAPAN58, MKK14_MKKA1, "JP"},
+       {CTRY_JAPAN59, MKK15_MKKA1, "JP"},
+
+       {CTRY_JORDAN, ETSI2_WORLD, "JO"},
+       {CTRY_KAZAKHSTAN, NULL1_WORLD, "KZ"},
+       {CTRY_KOREA_NORTH, APL9_WORLD, "KP"},
+       {CTRY_KOREA_ROC, APL9_WORLD, "KR"},
+       {CTRY_KOREA_ROC2, APL2_WORLD, "K2"},
+       {CTRY_KOREA_ROC3, APL9_WORLD, "K3"},
+       {CTRY_KUWAIT, NULL1_WORLD, "KW"},
+       {CTRY_LATVIA, ETSI1_WORLD, "LV"},
+       {CTRY_LEBANON, NULL1_WORLD, "LB"},
+       {CTRY_LIECHTENSTEIN, ETSI1_WORLD, "LI"},
+       {CTRY_LITHUANIA, ETSI1_WORLD, "LT"},
+       {CTRY_LUXEMBOURG, ETSI1_WORLD, "LU"},
+       {CTRY_MACAU, FCC2_WORLD, "MO"},
+       {CTRY_MACEDONIA, NULL1_WORLD, "MK"},
+       {CTRY_MALAYSIA, APL8_WORLD, "MY"},
+       {CTRY_MALTA, ETSI1_WORLD, "MT"},
+       {CTRY_MEXICO, FCC1_FCCA, "MX"},
+       {CTRY_MONACO, ETSI4_WORLD, "MC"},
+       {CTRY_MOROCCO, NULL1_WORLD, "MA"},
+       {CTRY_NEPAL, APL1_WORLD, "NP"},
+       {CTRY_NETHERLANDS, ETSI1_WORLD, "NL"},
+       {CTRY_NETHERLANDS_ANTILLES, ETSI1_WORLD, "AN"},
+       {CTRY_NEW_ZEALAND, FCC2_ETSIC, "NZ"},
+       {CTRY_NORWAY, ETSI1_WORLD, "NO"},
+       {CTRY_OMAN, APL6_WORLD, "OM"},
+       {CTRY_PAKISTAN, NULL1_WORLD, "PK"},
+       {CTRY_PANAMA, FCC1_FCCA, "PA"},
+       {CTRY_PAPUA_NEW_GUINEA, FCC1_WORLD, "PG"},
+       {CTRY_PERU, APL1_WORLD, "PE"},
+       {CTRY_PHILIPPINES, APL1_WORLD, "PH"},
+       {CTRY_POLAND, ETSI1_WORLD, "PL"},
+       {CTRY_PORTUGAL, ETSI1_WORLD, "PT"},
+       {CTRY_PUERTO_RICO, FCC1_FCCA, "PR"},
+       {CTRY_QATAR, NULL1_WORLD, "QA"},
+       {CTRY_ROMANIA, NULL1_WORLD, "RO"},
+       {CTRY_RUSSIA, NULL1_WORLD, "RU"},
+       {CTRY_SAUDI_ARABIA, NULL1_WORLD, "SA"},
+       {CTRY_SERBIA_MONTENEGRO, ETSI1_WORLD, "CS"},
+       {CTRY_SINGAPORE, APL6_WORLD, "SG"},
+       {CTRY_SLOVAKIA, ETSI1_WORLD, "SK"},
+       {CTRY_SLOVENIA, ETSI1_WORLD, "SI"},
+       {CTRY_SOUTH_AFRICA, FCC3_WORLD, "ZA"},
+       {CTRY_SPAIN, ETSI1_WORLD, "ES"},
+       {CTRY_SRI_LANKA, FCC3_WORLD, "LK"},
+       {CTRY_SWEDEN, ETSI1_WORLD, "SE"},
+       {CTRY_SWITZERLAND, ETSI1_WORLD, "CH"},
+       {CTRY_SYRIA, NULL1_WORLD, "SY"},
+       {CTRY_TAIWAN, APL3_FCCA, "TW"},
+       {CTRY_THAILAND, NULL1_WORLD, "TH"},
+       {CTRY_TRINIDAD_Y_TOBAGO, ETSI4_WORLD, "TT"},
+       {CTRY_TUNISIA, ETSI3_WORLD, "TN"},
+       {CTRY_TURKEY, ETSI3_WORLD, "TR"},
+       {CTRY_UKRAINE, NULL1_WORLD, "UA"},
+       {CTRY_UAE, NULL1_WORLD, "AE"},
+       {CTRY_UNITED_KINGDOM, ETSI1_WORLD, "GB"},
+       {CTRY_UNITED_STATES, FCC3_FCCA, "US"},
+       /* This "PS" is for US public safety actually... to support this we
+        * would need to assign new special alpha2 to CRDA db as with the world
+        * regdomain and use another alpha2 */
+       {CTRY_UNITED_STATES_FCC49, FCC4_FCCA, "PS"},
+       {CTRY_URUGUAY, APL2_WORLD, "UY"},
+       {CTRY_UZBEKISTAN, FCC3_FCCA, "UZ"},
+       {CTRY_VENEZUELA, APL2_ETSIC, "VE"},
+       {CTRY_VIET_NAM, NULL1_WORLD, "VN"},
+       {CTRY_YEMEN, NULL1_WORLD, "YE"},
+       {CTRY_ZIMBABWE, NULL1_WORLD, "ZW"},
 };
 
-static struct regDomain regDomains[] = {
-
-       {DEBUG_REG_DMN, FCC, DFS_FCC3, NO_PSCAN, NO_REQ,
-        BM(A_DEMO_ALL_CHANNELS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5130_5650, T1_5150_5670, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5200_5240, T1_5280_5280, T1_5540_5660, T1_5765_5805, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BM(F1_2312_2372, F1_2412_2472, F1_2484_2484, F1_2512_2732, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BM(G_DEMO_ALL_CHANNELS, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_2312_2372, T1_2437_2437, T1_2512_2732, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1)},
-
-       {APL1, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BM(F4_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T1_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL2, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BM(F1_5745_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL3, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BM(F1_5280_5320, F2_5745_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5290_5290, T1_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL4, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BM(F4_5180_5240, F3_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5210_5210, T3_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5200_5200, T3_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL5, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BM(F2_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T4_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T4_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL6, ETSI, DFS_ETSI, PSCAN_FCC_T | PSCAN_FCC, NO_REQ,
-        BM(F4_5180_5240, F2_5260_5320, F3_5745_5825, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T2_5210_5210, T1_5250_5290, T1_5760_5800, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T1_5200_5280, T5_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL7, ETSI, DFS_ETSI, PSCAN_ETSI, NO_REQ,
-        BM(F1_5280_5320, F5_5500_5700, F3_5745_5805, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T3_5290_5290, T5_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5540_5660, T6_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL8, ETSI, NO_DFS, NO_PSCAN,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F6_5260_5320, F4_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T2_5290_5290, T2_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5280_5280, T1_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL9, ETSI, DFS_ETSI, PSCAN_ETSI,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F1_5180_5320, F1_5500_5620, F3_5745_5805, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T3_5290_5290, T5_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5540_5660, T6_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {APL10, ETSI, DFS_ETSI, PSCAN_ETSI,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F1_5180_5320, F5_5500_5700, F3_5745_5805, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T3_5290_5290, T5_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5540_5660, T6_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {ETSI1, ETSI, DFS_ETSI, PSCAN_ETSI,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F4_5180_5240, F2_5260_5320, F2_5500_5700, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T1_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_5200_5280, T2_5540_5660, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {ETSI2, ETSI, DFS_ETSI, PSCAN_ETSI,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F3_5180_5240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T3_5210_5210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_5200_5200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {ETSI3, ETSI, DFS_ETSI, PSCAN_ETSI,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F4_5180_5240, F2_5260_5320, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T1_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_5200_5280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {ETSI4, ETSI, DFS_ETSI, PSCAN_ETSI,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F3_5180_5240, F1_5260_5320, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T2_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T3_5200_5280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {ETSI5, ETSI, DFS_ETSI, PSCAN_ETSI,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F1_5180_5240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T4_5210_5210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T3_5200_5200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {ETSI6, ETSI, DFS_ETSI, PSCAN_ETSI,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F5_5180_5240, F1_5260_5280, F3_5500_5700, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T1_5210_5250, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T4_5200_5280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {FCC1, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BM(F2_5180_5240, F4_5260_5320, F5_5745_5825, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T6_5210_5210, T2_5250_5290, T6_5760_5800, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T1_5200_5240, T2_5280_5280, T7_5765_5805, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {FCC2, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BM(F6_5180_5240, F5_5260_5320, F6_5745_5825, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T7_5210_5210, T3_5250_5290, T2_5760_5800, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T7_5200_5200, T1_5240_5240, T2_5280_5280, T1_5765_5805, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {FCC3, FCC, DFS_FCC3, PSCAN_FCC | PSCAN_FCC_T, NO_REQ,
-        BM(F2_5180_5240, F3_5260_5320, F1_5500_5700, F5_5745_5825, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BM(T6_5210_5210, T2_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T4_5200_5200, T8_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {FCC4, FCC, DFS_FCC3, PSCAN_FCC | PSCAN_FCC_T, NO_REQ,
-        BM(F1_4942_4987, F1_4945_4985, F1_4950_4980, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T8_5210_5210, T4_5250_5290, T7_5760_5800, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T1_5200_5240, T1_5280_5280, T9_5765_5805, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {FCC5, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BM(F2_5180_5240, F6_5745_5825, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T6_5210_5210, T2_5760_5800, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T8_5200_5200, T7_5765_5805, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {FCC6, FCC, DFS_FCC3, PSCAN_FCC, NO_REQ,
-        BM(F8_5180_5240, F5_5260_5320, F1_5500_5580, F1_5660_5700,
-           F6_5745_5825, -1, -1, -1, -1, -1, -1, -1),
-        BM(T7_5210_5210, T3_5250_5290, T2_5760_5800, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T7_5200_5200, T1_5240_5240, T2_5280_5280, T1_5765_5805, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {MKK1, MKK, NO_DFS, PSCAN_MKK1, DISALLOW_ADHOC_11A_TURB,
-        BM(F1_5170_5230, F4_5180_5240, F2_5260_5320, F4_5500_5700, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BM(T7_5210_5210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T5_5200_5200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-       {MKK2, MKK, NO_DFS, PSCAN_MKK2, DISALLOW_ADHOC_11A_TURB,
-        BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040,
-           F1_5055_5055, F1_5040_5080, F1_5170_5230, F4_5180_5240,
-           F2_5260_5320, F4_5500_5700, -1, -1),
-        BM(T7_5210_5210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T5_5200_5200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK3, MKK, NO_DFS, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
-        BM(F4_5180_5240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T9_5210_5210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T1_5200_5200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK4, MKK, DFS_MKK4, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
-        BM(F4_5180_5240, F2_5260_5320, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T10_5210_5210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T6_5200_5200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK5, MKK, DFS_MKK4, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
-        BM(F4_5180_5240, F2_5260_5320, F4_5500_5700, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T3_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T5_5200_5280, T3_5540_5660, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK6, MKK, NO_DFS, PSCAN_MKK1, DISALLOW_ADHOC_11A_TURB,
-        BM(F2_5170_5230, F4_5180_5240, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T3_5210_5210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T6_5200_5200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK7, MKK, DFS_MKK4, PSCAN_MKK1 | PSCAN_MKK3,
-        DISALLOW_ADHOC_11A_TURB,
-        BM(F1_5170_5230, F4_5180_5240, F2_5260_5320, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(T3_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T5_5200_5280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK8, MKK, DFS_MKK4, PSCAN_MKK1 | PSCAN_MKK3,
-        DISALLOW_ADHOC_11A_TURB,
-        BM(F1_5170_5230, F4_5180_5240, F2_5260_5320, F4_5500_5700, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BM(T3_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T5_5200_5280, T3_5540_5660, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK9, MKK, NO_DFS, PSCAN_MKK2 | PSCAN_MKK3,
-        DISALLOW_ADHOC_11A_TURB,
-        BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040,
-           F1_5055_5055, F1_5040_5080, F4_5180_5240, -1, -1, -1, -1, -1),
-        BM(T9_5210_5210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T1_5200_5200, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK10, MKK, DFS_MKK4, PSCAN_MKK2 | PSCAN_MKK3,
-        DISALLOW_ADHOC_11A_TURB,
-        BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040,
-           F1_5055_5055, F1_5040_5080, F4_5180_5240, F2_5260_5320, -1, -1,
-           -1, -1),
-        BM(T3_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T1_5200_5280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK11, MKK, DFS_MKK4, PSCAN_MKK3, DISALLOW_ADHOC_11A_TURB,
-        BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040,
-           F1_5055_5055, F1_5040_5080, F4_5180_5240, F2_5260_5320,
-           F4_5500_5700, -1, -1, -1),
-        BM(T3_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T1_5200_5280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK12, MKK, DFS_MKK4, PSCAN_MKK1 | PSCAN_MKK3,
-        DISALLOW_ADHOC_11A_TURB,
-        BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040,
-           F1_5055_5055, F1_5040_5080, F1_5170_5230, F4_5180_5240,
-           F2_5260_5320, F4_5500_5700, -1, -1),
-        BM(T3_5210_5290, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T1_5200_5280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK13, MKK, DFS_MKK4, PSCAN_MKK1 | PSCAN_MKK3,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BM(F1_5170_5230, F7_5180_5240, F2_5260_5320, F4_5500_5700, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK14, MKK, DFS_MKK4, PSCAN_MKK1, DISALLOW_ADHOC_11A_TURB,
-        BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040,
-           F1_5040_5080, F1_5055_5055, F1_5170_5230, F4_5180_5240, -1, -1,
-           -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {MKK15, MKK, DFS_MKK4, PSCAN_MKK1, DISALLOW_ADHOC_11A_TURB,
-        BM(F1_4915_4925, F1_4935_4945, F1_4920_4980, F1_5035_5040,
-           F1_5040_5080, F1_5055_5055, F1_5170_5230, F4_5180_5240,
-           F2_5260_5320, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO},
-
-
-       {APLD, NO_CTL, NO_DFS, NO_PSCAN, NO_REQ,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BM(F2_2312_2372, F2_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(G2_2312_2372, G2_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BMZERO},
-
-       {ETSIA, NO_CTL, NO_DFS, PSCAN_ETSIA,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BM(F1_2457_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(G1_2457_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {ETSIB, ETSI, NO_DFS, PSCAN_ETSIB,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BM(F1_2432_2442, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(G1_2432_2442, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {ETSIC, ETSI, NO_DFS, PSCAN_ETSIC,
-        DISALLOW_ADHOC_11A | DISALLOW_ADHOC_11A_TURB,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BM(F3_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(G3_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {FCCA, FCC, NO_DFS, NO_PSCAN, NO_REQ,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BM(F1_2412_2462, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(G1_2412_2462, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {MKKA, MKK, NO_DFS,
-        PSCAN_MKKA | PSCAN_MKKA_G | PSCAN_MKKA1 | PSCAN_MKKA1_G |
-        PSCAN_MKKA2 | PSCAN_MKKA2_G, DISALLOW_ADHOC_11A_TURB,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BM(F2_2412_2462, F1_2467_2472, F2_2484_2484, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(G2_2412_2462, G1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1),
-        BM(T2_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {MKKC, MKK, NO_DFS, NO_PSCAN, NO_REQ,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BM(F2_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(G2_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WORLD, ETSI, NO_DFS, NO_PSCAN, NO_REQ,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BM(F2_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(G2_2412_2472, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T2_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR0_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_PER_11D,
-        BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825,
-           W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
-        BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1,
-           -1, -1, -1, -1, -1),
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472,
-           W1_2417_2432, W1_2447_2457, W1_2467_2467, W1_2484_2484, -1, -1,
-           -1, -1),
-        BM(WG1_2412_2462, WG1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR01_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR,
-        ADHOC_PER_11D,
-        BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825,
-           W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
-        BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1,
-           -1, -1, -1, -1, -1),
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2417_2432,
-           W1_2447_2457, -1, -1, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR02_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR,
-        ADHOC_PER_11D,
-        BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825,
-           W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
-        BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1,
-           -1, -1, -1, -1, -1),
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472,
-           W1_2417_2432, W1_2447_2457, W1_2467_2467, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, WG1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {EU1_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_PER_11D,
-        BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825,
-           W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
-        BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1,
-           -1, -1, -1, -1, -1),
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W2_2472_2472,
-           W1_2417_2432, W1_2447_2457, W2_2467_2467, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, WG2_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR1_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
-        BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825,
-           W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472,
-           W1_2417_2432, W1_2447_2457, W1_2467_2467, W1_2484_2484, -1, -1,
-           -1, -1),
-        BM(WG1_2412_2462, WG1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR2_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
-        BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825,
-           W1_5500_5700, -1, -1, -1, -1, -1, -1, -1),
-        BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1,
-           -1, -1, -1, -1, -1),
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472,
-           W1_2417_2432, W1_2447_2457, W1_2467_2467, W1_2484_2484, -1, -1,
-           -1, -1),
-        BM(WG1_2412_2462, WG1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR3_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_PER_11D,
-        BM(W1_5260_5320, W1_5180_5240, W1_5170_5230, W1_5745_5825, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1,
-           -1, -1, -1, -1, -1),
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472,
-           W1_2417_2432, W1_2447_2457, W1_2467_2467, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, WG2_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR4_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
-        BM(W1_5260_5320, W1_5180_5240, W1_5745_5825, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1,
-           -1, -1, -1, -1, -1),
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2417_2432,
-           W1_2447_2457, -1, -1, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR5_ETSIC, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
-        BM(W1_5260_5320, W1_5180_5240, W1_5745_5825, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472,
-           W1_2417_2432, W1_2447_2457, W1_2467_2467, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, WG1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WOR9_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
-        BM(W1_5260_5320, W1_5180_5240, W1_5745_5825, W1_5500_5700, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BM(WT1_5210_5250, WT1_5290_5290, WT1_5760_5800, -1, -1, -1, -1,
-           -1, -1, -1, -1, -1),
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2417_2432,
-           W1_2447_2457, -1, -1, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WORA_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
-        BM(W1_5260_5320, W1_5180_5240, W1_5745_5825, W1_5500_5700, -1, -1,
-           -1, -1, -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472,
-           W1_2417_2432, W1_2447_2457, W1_2467_2467, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, WG1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {WORB_WORLD, NO_CTL, DFS_FCC3 | DFS_ETSI, PSCAN_WWR, ADHOC_NO_11A,
-        BM(W1_5260_5320, W1_5180_5240, W1_5500_5700, -1, -1, -1, -1, -1,
-           -1, -1, -1, -1),
-        BMZERO,
-        BMZERO,
-        BM(W1_2412_2412, W1_2437_2442, W1_2462_2462, W1_2472_2472,
-           W1_2417_2432, W1_2447_2457, W1_2467_2467, -1, -1, -1, -1, -1),
-        BM(WG1_2412_2462, WG1_2467_2472, -1, -1, -1, -1, -1, -1, -1, -1,
-           -1, -1),
-        BM(T3_2437_2437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1)},
-
-       {NULL1, NO_CTL, NO_DFS, NO_PSCAN, NO_REQ,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO,
-        BMZERO}
-};
-
-static const struct cmode modes[] = {
-       {ATH9K_MODE_11A, CHANNEL_A},
-       {ATH9K_MODE_11B, CHANNEL_B},
-       {ATH9K_MODE_11G, CHANNEL_G},
-       {ATH9K_MODE_11NG_HT20, CHANNEL_G_HT20},
-       {ATH9K_MODE_11NG_HT40PLUS, CHANNEL_G_HT40PLUS},
-       {ATH9K_MODE_11NG_HT40MINUS, CHANNEL_G_HT40MINUS},
-       {ATH9K_MODE_11NA_HT20, CHANNEL_A_HT20},
-       {ATH9K_MODE_11NA_HT40PLUS, CHANNEL_A_HT40PLUS},
-       {ATH9K_MODE_11NA_HT40MINUS, CHANNEL_A_HT40MINUS},
-};
-
-static struct japan_bandcheck j_bandcheck[] = {
-       {F1_5170_5230, AR_EEPROM_EEREGCAP_EN_KK_U1_ODD},
-       {F4_5180_5240, AR_EEPROM_EEREGCAP_EN_KK_U1_EVEN},
-       {F2_5260_5320, AR_EEPROM_EEREGCAP_EN_KK_U2},
-       {F4_5500_5700, AR_EEPROM_EEREGCAP_EN_KK_MIDBAND}
-};
-
-
 #endif
index c92f0c6e4adcd1ac64bf0975f5a1f32ed3bf0bfd..3f70b1e58ae4c13159c329b359ead33bf1d096ab 100644 (file)
@@ -14,7 +14,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "core.h"
+#include "ath9k.h"
 
 #define BITS_PER_BYTE           8
 #define OFDM_PLCP_BITS          22
@@ -55,94 +55,19 @@ static u32 bits_per_symbol[][2] = {
 
 #define IS_HT_RATE(_rate)     ((_rate) & 0x80)
 
-/*
- * Insert a chain of ath_buf (descriptors) on a txq and
- * assume the descriptors are already chained together by caller.
- * NB: must be called with txq lock held
- */
-
+static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
+                              struct ath_atx_tid *tid,
+                              struct list_head *bf_head);
+static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
+                               struct list_head *bf_q,
+                               int txok, int sendbar);
 static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
-                            struct list_head *head)
-{
-       struct ath_hal *ah = sc->sc_ah;
-       struct ath_buf *bf;
-
-       /*
-        * Insert the frame on the outbound list and
-        * pass it on to the hardware.
-        */
-
-       if (list_empty(head))
-               return;
-
-       bf = list_first_entry(head, struct ath_buf, list);
-
-       list_splice_tail_init(head, &txq->axq_q);
-       txq->axq_depth++;
-       txq->axq_totalqueued++;
-       txq->axq_linkbuf = list_entry(txq->axq_q.prev, struct ath_buf, list);
-
-       DPRINTF(sc, ATH_DBG_QUEUE,
-               "qnum: %d, txq depth: %d\n", txq->axq_qnum, txq->axq_depth);
-
-       if (txq->axq_link == NULL) {
-               ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
-               DPRINTF(sc, ATH_DBG_XMIT,
-                       "TXDP[%u] = %llx (%p)\n",
-                       txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
-       } else {
-               *txq->axq_link = bf->bf_daddr;
-               DPRINTF(sc, ATH_DBG_XMIT, "link[%u] (%p)=%llx (%p)\n",
-                       txq->axq_qnum, txq->axq_link,
-                       ito64(bf->bf_daddr), bf->bf_desc);
-       }
-       txq->axq_link = &(bf->bf_lastbf->bf_desc->ds_link);
-       ath9k_hw_txstart(ah, txq->axq_qnum);
-}
-
-static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
-                           struct ath_xmit_status *tx_status)
-{
-       struct ieee80211_hw *hw = sc->hw;
-       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-       struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
-       int hdrlen, padsize;
-
-       DPRINTF(sc, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb);
-
-       if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK ||
-           tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
-               kfree(tx_info_priv);
-               tx_info->rate_driver_data[0] = NULL;
-       }
-
-       if (tx_status->flags & ATH_TX_BAR) {
-               tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
-               tx_status->flags &= ~ATH_TX_BAR;
-       }
-
-       if (!(tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY))) {
-               /* Frame was ACKed */
-               tx_info->flags |= IEEE80211_TX_STAT_ACK;
-       }
-
-       tx_info->status.rates[0].count = tx_status->retries + 1;
-
-       hdrlen = ieee80211_get_hdrlen_from_skb(skb);
-       padsize = hdrlen & 3;
-       if (padsize && hdrlen >= 24) {
-               /*
-                * Remove MAC header padding before giving the frame back to
-                * mac80211.
-                */
-               memmove(skb->data + padsize, skb->data, hdrlen);
-               skb_pull(skb, padsize);
-       }
-
-       ieee80211_tx_status(hw, skb);
-}
+                            struct list_head *head);
+static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf);
 
-/* Check if it's okay to send out aggregates */
+/*********************/
+/* Aggregation logic */
+/*********************/
 
 static int ath_aggr_query(struct ath_softc *sc, struct ath_node *an, u8 tidno)
 {
@@ -156,309 +81,151 @@ static int ath_aggr_query(struct ath_softc *sc, struct ath_node *an, u8 tidno)
                return 0;
 }
 
-static void ath_get_beaconconfig(struct ath_softc *sc, int if_id,
-                                struct ath_beacon_config *conf)
+static void ath_tx_queue_tid(struct ath_txq *txq, struct ath_atx_tid *tid)
 {
-       struct ieee80211_hw *hw = sc->hw;
+       struct ath_atx_ac *ac = tid->ac;
 
-       /* fill in beacon config data */
+       if (tid->paused)
+               return;
 
-       conf->beacon_interval = hw->conf.beacon_int;
-       conf->listen_interval = 100;
-       conf->dtim_count = 1;
-       conf->bmiss_timeout = ATH_DEFAULT_BMISS_LIMIT * conf->listen_interval;
-}
+       if (tid->sched)
+               return;
 
-/* Calculate Atheros packet type from IEEE80211 packet header */
+       tid->sched = true;
+       list_add_tail(&tid->list, &ac->tid_q);
 
-static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb)
-{
-       struct ieee80211_hdr *hdr;
-       enum ath9k_pkt_type htype;
-       __le16 fc;
+       if (ac->sched)
+               return;
 
-       hdr = (struct ieee80211_hdr *)skb->data;
-       fc = hdr->frame_control;
+       ac->sched = true;
+       list_add_tail(&ac->list, &txq->axq_acq);
+}
 
-       if (ieee80211_is_beacon(fc))
-               htype = ATH9K_PKT_TYPE_BEACON;
-       else if (ieee80211_is_probe_resp(fc))
-               htype = ATH9K_PKT_TYPE_PROBE_RESP;
-       else if (ieee80211_is_atim(fc))
-               htype = ATH9K_PKT_TYPE_ATIM;
-       else if (ieee80211_is_pspoll(fc))
-               htype = ATH9K_PKT_TYPE_PSPOLL;
-       else
-               htype = ATH9K_PKT_TYPE_NORMAL;
+static void ath_tx_pause_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
+{
+       struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
 
-       return htype;
+       spin_lock_bh(&txq->axq_lock);
+       tid->paused++;
+       spin_unlock_bh(&txq->axq_lock);
 }
 
-static bool is_pae(struct sk_buff *skb)
+static void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
 {
-       struct ieee80211_hdr *hdr;
-       __le16 fc;
-
-       hdr = (struct ieee80211_hdr *)skb->data;
-       fc = hdr->frame_control;
+       struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
 
-       if (ieee80211_is_data(fc)) {
-               if (ieee80211_is_nullfunc(fc) ||
-                   /* Port Access Entity (IEEE 802.1X) */
-                   (skb->protocol == cpu_to_be16(ETH_P_PAE))) {
-                       return true;
-               }
-       }
+       ASSERT(tid->paused > 0);
+       spin_lock_bh(&txq->axq_lock);
 
-       return false;
-}
+       tid->paused--;
 
-static int get_hw_crypto_keytype(struct sk_buff *skb)
-{
-       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+       if (tid->paused > 0)
+               goto unlock;
 
-       if (tx_info->control.hw_key) {
-               if (tx_info->control.hw_key->alg == ALG_WEP)
-                       return ATH9K_KEY_TYPE_WEP;
-               else if (tx_info->control.hw_key->alg == ALG_TKIP)
-                       return ATH9K_KEY_TYPE_TKIP;
-               else if (tx_info->control.hw_key->alg == ALG_CCMP)
-                       return ATH9K_KEY_TYPE_AES;
-       }
+       if (list_empty(&tid->buf_q))
+               goto unlock;
 
-       return ATH9K_KEY_TYPE_CLEAR;
+       ath_tx_queue_tid(txq, tid);
+       ath_txq_schedule(sc, txq);
+unlock:
+       spin_unlock_bh(&txq->axq_lock);
 }
 
-/* Called only when tx aggregation is enabled and HT is supported */
-
-static void assign_aggr_tid_seqno(struct sk_buff *skb,
-                                 struct ath_buf *bf)
+static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
 {
-       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-       struct ieee80211_hdr *hdr;
-       struct ath_node *an;
-       struct ath_atx_tid *tid;
-       __le16 fc;
-       u8 *qc;
+       struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
+       struct ath_buf *bf;
+       struct list_head bf_head;
+       INIT_LIST_HEAD(&bf_head);
 
-       if (!tx_info->control.sta)
-               return;
+       ASSERT(tid->paused > 0);
+       spin_lock_bh(&txq->axq_lock);
 
-       an = (struct ath_node *)tx_info->control.sta->drv_priv;
-       hdr = (struct ieee80211_hdr *)skb->data;
-       fc = hdr->frame_control;
+       tid->paused--;
 
-       /* Get tidno */
+       if (tid->paused > 0) {
+               spin_unlock_bh(&txq->axq_lock);
+               return;
+       }
 
-       if (ieee80211_is_data_qos(fc)) {
-               qc = ieee80211_get_qos_ctl(hdr);
-               bf->bf_tidno = qc[0] & 0xf;
+       while (!list_empty(&tid->buf_q)) {
+               bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
+               ASSERT(!bf_isretried(bf));
+               list_move_tail(&bf->list, &bf_head);
+               ath_tx_send_normal(sc, txq, tid, &bf_head);
        }
 
-       /* Get seqno */
-       /* For HT capable stations, we save tidno for later use.
-        * We also override seqno set by upper layer with the one
-        * in tx aggregation state.
-        *
-        * If fragmentation is on, the sequence number is
-        * not overridden, since it has been
-        * incremented by the fragmentation routine.
-        *
-        * FIXME: check if the fragmentation threshold exceeds
-        * IEEE80211 max.
-        */
-       tid = ATH_AN_2_TID(an, bf->bf_tidno);
-       hdr->seq_ctrl = cpu_to_le16(tid->seq_next <<
-                       IEEE80211_SEQ_SEQ_SHIFT);
-       bf->bf_seqno = tid->seq_next;
-       INCR(tid->seq_next, IEEE80211_SEQ_MAX);
+       spin_unlock_bh(&txq->axq_lock);
 }
 
-static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb,
-                         struct ath_txq *txq)
+static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
+                             int seqno)
 {
-       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-       int flags = 0;
+       int index, cindex;
 
-       flags |= ATH9K_TXDESC_CLRDMASK; /* needed for crypto errors */
-       flags |= ATH9K_TXDESC_INTREQ;
+       index  = ATH_BA_INDEX(tid->seq_start, seqno);
+       cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
 
-       if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
-               flags |= ATH9K_TXDESC_NOACK;
-       if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
-               flags |= ATH9K_TXDESC_RTSENA;
+       tid->tx_buf[cindex] = NULL;
 
-       return flags;
+       while (tid->baw_head != tid->baw_tail && !tid->tx_buf[tid->baw_head]) {
+               INCR(tid->seq_start, IEEE80211_SEQ_MAX);
+               INCR(tid->baw_head, ATH_TID_MAX_BUFS);
+       }
 }
 
-static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc)
+static void ath_tx_addto_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
+                            struct ath_buf *bf)
 {
-       struct ath_buf *bf = NULL;
-
-       spin_lock_bh(&sc->tx.txbuflock);
+       int index, cindex;
 
-       if (unlikely(list_empty(&sc->tx.txbuf))) {
-               spin_unlock_bh(&sc->tx.txbuflock);
-               return NULL;
-       }
+       if (bf_isretried(bf))
+               return;
 
-       bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
-       list_del(&bf->list);
+       index  = ATH_BA_INDEX(tid->seq_start, bf->bf_seqno);
+       cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
 
-       spin_unlock_bh(&sc->tx.txbuflock);
+       ASSERT(tid->tx_buf[cindex] == NULL);
+       tid->tx_buf[cindex] = bf;
 
-       return bf;
-}
-
-/* To complete a chain of buffers associated a frame */
-
-static void ath_tx_complete_buf(struct ath_softc *sc,
-                               struct ath_buf *bf,
-                               struct list_head *bf_q,
-                               int txok, int sendbar)
-{
-       struct sk_buff *skb = bf->bf_mpdu;
-       struct ath_xmit_status tx_status;
-       unsigned long flags;
-
-       /*
-        * Set retry information.
-        * NB: Don't use the information in the descriptor, because the frame
-        * could be software retried.
-        */
-       tx_status.retries = bf->bf_retries;
-       tx_status.flags = 0;
-
-       if (sendbar)
-               tx_status.flags = ATH_TX_BAR;
-
-       if (!txok) {
-               tx_status.flags |= ATH_TX_ERROR;
-
-               if (bf_isxretried(bf))
-                       tx_status.flags |= ATH_TX_XRETRY;
+       if (index >= ((tid->baw_tail - tid->baw_head) &
+               (ATH_TID_MAX_BUFS - 1))) {
+               tid->baw_tail = cindex;
+               INCR(tid->baw_tail, ATH_TID_MAX_BUFS);
        }
-
-       /* Unmap this frame */
-       pci_unmap_single(sc->pdev,
-                        bf->bf_dmacontext,
-                        skb->len,
-                        PCI_DMA_TODEVICE);
-       /* complete this frame */
-       ath_tx_complete(sc, skb, &tx_status);
-
-       /*
-        * Return the list of ath_buf of this mpdu to free queue
-        */
-       spin_lock_irqsave(&sc->tx.txbuflock, flags);
-       list_splice_tail_init(bf_q, &sc->tx.txbuf);
-       spin_unlock_irqrestore(&sc->tx.txbuflock, flags);
 }
 
 /*
- * queue up a dest/ac pair for tx scheduling
- * NB: must be called with txq lock held
+ * TODO: For frame(s) that are in the retry state, we will reuse the
+ * sequence number(s) without setting the retry bit. The
+ * alternative is to give up on these and BAR the receiver's window
+ * forward.
  */
+static void ath_tid_drain(struct ath_softc *sc, struct ath_txq *txq,
+                         struct ath_atx_tid *tid)
 
-static void ath_tx_queue_tid(struct ath_txq *txq, struct ath_atx_tid *tid)
-{
-       struct ath_atx_ac *ac = tid->ac;
-
-       /*
-        * if tid is paused, hold off
-        */
-       if (tid->paused)
-               return;
-
-       /*
-        * add tid to ac atmost once
-        */
-       if (tid->sched)
-               return;
-
-       tid->sched = true;
-       list_add_tail(&tid->list, &ac->tid_q);
-
-       /*
-        * add node ac to txq atmost once
-        */
-       if (ac->sched)
-               return;
-
-       ac->sched = true;
-       list_add_tail(&ac->list, &txq->axq_acq);
-}
-
-/* pause a tid */
-
-static void ath_tx_pause_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
-{
-       struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
-
-       spin_lock_bh(&txq->axq_lock);
-
-       tid->paused++;
-
-       spin_unlock_bh(&txq->axq_lock);
-}
-
-/* resume a tid and schedule aggregate */
-
-void ath_tx_resume_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
-{
-       struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
-
-       ASSERT(tid->paused > 0);
-       spin_lock_bh(&txq->axq_lock);
-
-       tid->paused--;
-
-       if (tid->paused > 0)
-               goto unlock;
-
-       if (list_empty(&tid->buf_q))
-               goto unlock;
-
-       /*
-        * Add this TID to scheduler and try to send out aggregates
-        */
-       ath_tx_queue_tid(txq, tid);
-       ath_txq_schedule(sc, txq);
-unlock:
-       spin_unlock_bh(&txq->axq_lock);
-}
-
-/* Compute the number of bad frames */
-
-static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf,
-                             int txok)
 {
-       struct ath_buf *bf_last = bf->bf_lastbf;
-       struct ath_desc *ds = bf_last->bf_desc;
-       u16 seq_st = 0;
-       u32 ba[WME_BA_BMP_SIZE >> 5];
-       int ba_index;
-       int nbad = 0;
-       int isaggr = 0;
+       struct ath_buf *bf;
+       struct list_head bf_head;
+       INIT_LIST_HEAD(&bf_head);
 
-       if (ds->ds_txstat.ts_flags == ATH9K_TX_SW_ABORTED)
-               return 0;
+       for (;;) {
+               if (list_empty(&tid->buf_q))
+                       break;
 
-       isaggr = bf_isaggr(bf);
-       if (isaggr) {
-               seq_st = ATH_DS_BA_SEQ(ds);
-               memcpy(ba, ATH_DS_BA_BITMAP(ds), WME_BA_BMP_SIZE >> 3);
-       }
+               bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
+               list_move_tail(&bf->list, &bf_head);
 
-       while (bf) {
-               ba_index = ATH_BA_INDEX(seq_st, bf->bf_seqno);
-               if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index)))
-                       nbad++;
+               if (bf_isretried(bf))
+                       ath_tx_update_baw(sc, tid, bf->bf_seqno);
 
-               bf = bf->bf_next;
+               spin_unlock(&txq->axq_lock);
+               ath_tx_complete_buf(sc, bf, &bf_head, 0, 0);
+               spin_lock(&txq->axq_lock);
        }
 
-       return nbad;
+       tid->seq_next = tid->seq_start;
+       tid->baw_tail = tid->baw_head;
 }
 
 static void ath_tx_set_retry(struct ath_softc *sc, struct ath_buf *bf)
@@ -474,317 +241,84 @@ static void ath_tx_set_retry(struct ath_softc *sc, struct ath_buf *bf)
        hdr->frame_control |= cpu_to_le16(IEEE80211_FCTL_RETRY);
 }
 
-/* Update block ack window */
-
-static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
-                             int seqno)
-{
-       int index, cindex;
-
-       index  = ATH_BA_INDEX(tid->seq_start, seqno);
-       cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
-
-       tid->tx_buf[cindex] = NULL;
-
-       while (tid->baw_head != tid->baw_tail && !tid->tx_buf[tid->baw_head]) {
-               INCR(tid->seq_start, IEEE80211_SEQ_MAX);
-               INCR(tid->baw_head, ATH_TID_MAX_BUFS);
-       }
-}
-
-/*
- * ath_pkt_dur - compute packet duration (NB: not NAV)
- *
- * rix - rate index
- * pktlen - total bytes (delims + data + fcs + pads + pad delims)
- * width  - 0 for 20 MHz, 1 for 40 MHz
- * half_gi - to use 4us v/s 3.6 us for symbol time
- */
-static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, struct ath_buf *bf,
-                           int width, int half_gi, bool shortPreamble)
+static struct ath_buf* ath_clone_txbuf(struct ath_softc *sc, struct ath_buf *bf)
 {
-       struct ath_rate_table *rate_table = sc->cur_rate_table;
-       u32 nbits, nsymbits, duration, nsymbols;
-       u8 rc;
-       int streams, pktlen;
-
-       pktlen = bf_isaggr(bf) ? bf->bf_al : bf->bf_frmlen;
-       rc = rate_table->info[rix].ratecode;
-
-       /* for legacy rates, use old function to compute packet duration */
-       if (!IS_HT_RATE(rc))
-               return ath9k_hw_computetxtime(sc->sc_ah, rate_table, pktlen,
-                                             rix, shortPreamble);
+       struct ath_buf *tbf;
 
-       /* find number of symbols: PLCP + data */
-       nbits = (pktlen << 3) + OFDM_PLCP_BITS;
-       nsymbits = bits_per_symbol[HT_RC_2_MCS(rc)][width];
-       nsymbols = (nbits + nsymbits - 1) / nsymbits;
+       spin_lock_bh(&sc->tx.txbuflock);
+       ASSERT(!list_empty((&sc->tx.txbuf)));
+       tbf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
+       list_del(&tbf->list);
+       spin_unlock_bh(&sc->tx.txbuflock);
 
-       if (!half_gi)
-               duration = SYMBOL_TIME(nsymbols);
-       else
-               duration = SYMBOL_TIME_HALFGI(nsymbols);
+       ATH_TXBUF_RESET(tbf);
 
-       /* addup duration for legacy/ht training and signal fields */
-       streams = HT_RC_2_STREAMS(rc);
-       duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams);
+       tbf->bf_mpdu = bf->bf_mpdu;
+       tbf->bf_buf_addr = bf->bf_buf_addr;
+       *(tbf->bf_desc) = *(bf->bf_desc);
+       tbf->bf_state = bf->bf_state;
+       tbf->bf_dmacontext = bf->bf_dmacontext;
 
-       return duration;
+       return tbf;
 }
 
-/* Rate module function to set rate related fields in tx descriptor */
-
-static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
+static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
+                                struct ath_buf *bf, struct list_head *bf_q,
+                                int txok)
 {
-       struct ath_hal *ah = sc->sc_ah;
-       struct ath_rate_table *rt;
-       struct ath_desc *ds = bf->bf_desc;
-       struct ath_desc *lastds = bf->bf_lastbf->bf_desc;
-       struct ath9k_11n_rate_series series[4];
+       struct ath_node *an = NULL;
        struct sk_buff *skb;
-       struct ieee80211_tx_info *tx_info;
-       struct ieee80211_tx_rate *rates;
+       struct ieee80211_sta *sta;
        struct ieee80211_hdr *hdr;
-       int i, flags, rtsctsena = 0;
-       u32 ctsduration = 0;
-       u8 rix = 0, cix, ctsrate = 0;
-       __le16 fc;
-
-       memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
+       struct ath_atx_tid *tid = NULL;
+       struct ath_buf *bf_next, *bf_last = bf->bf_lastbf;
+       struct ath_desc *ds = bf_last->bf_desc;
+       struct list_head bf_head, bf_pending;
+       u16 seq_st = 0;
+       u32 ba[WME_BA_BMP_SIZE >> 5];
+       int isaggr, txfail, txpending, sendbar = 0, needreset = 0;
 
        skb = (struct sk_buff *)bf->bf_mpdu;
        hdr = (struct ieee80211_hdr *)skb->data;
-       fc = hdr->frame_control;
-       tx_info = IEEE80211_SKB_CB(skb);
-       rates = tx_info->control.rates;
 
-       if (ieee80211_has_morefrags(fc) ||
-           (le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG)) {
-               rates[1].count = rates[2].count = rates[3].count = 0;
-               rates[1].idx = rates[2].idx = rates[3].idx = 0;
-               rates[0].count = ATH_TXMAXTRY;
-       }
+       rcu_read_lock();
 
-       /* get the cix for the lowest valid rix */
-       rt = sc->cur_rate_table;
-       for (i = 3; i >= 0; i--) {
-               if (rates[i].count && (rates[i].idx >= 0)) {
-                       rix = rates[i].idx;
-                       break;
-               }
+       sta = ieee80211_find_sta(sc->hw, hdr->addr1);
+       if (!sta) {
+               rcu_read_unlock();
+               return;
        }
 
-       flags = (bf->bf_flags & (ATH9K_TXDESC_RTSENA | ATH9K_TXDESC_CTSENA));
-       cix = rt->info[rix].ctrl_rate;
-
-       /*
-        * If 802.11g protection is enabled, determine whether to use RTS/CTS or
-        * just CTS.  Note that this is only done for OFDM/HT unicast frames.
-        */
-       if (sc->sc_protmode != PROT_M_NONE && !(bf->bf_flags & ATH9K_TXDESC_NOACK)
-           && (rt->info[rix].phy == WLAN_RC_PHY_OFDM ||
-               WLAN_RC_PHY_HT(rt->info[rix].phy))) {
-               if (sc->sc_protmode == PROT_M_RTSCTS)
-                       flags = ATH9K_TXDESC_RTSENA;
-               else if (sc->sc_protmode == PROT_M_CTSONLY)
-                       flags = ATH9K_TXDESC_CTSENA;
-
-               cix = rt->info[sc->sc_protrix].ctrl_rate;
-               rtsctsena = 1;
-       }
+       an = (struct ath_node *)sta->drv_priv;
+       tid = ATH_AN_2_TID(an, bf->bf_tidno);
 
-       /* For 11n, the default behavior is to enable RTS for hw retried frames.
-        * We enable the global flag here and let rate series flags determine
-        * which rates will actually use RTS.
-        */
-       if ((ah->ah_caps.hw_caps & ATH9K_HW_CAP_HT) && bf_isdata(bf)) {
-               /* 802.11g protection not needed, use our default behavior */
-               if (!rtsctsena)
-                       flags = ATH9K_TXDESC_RTSENA;
-       }
+       isaggr = bf_isaggr(bf);
+       memset(ba, 0, WME_BA_BMP_SIZE >> 3);
 
-       /* Set protection if aggregate protection on */
-       if (sc->sc_config.ath_aggr_prot &&
-           (!bf_isaggr(bf) || (bf_isaggr(bf) && bf->bf_al < 8192))) {
-               flags = ATH9K_TXDESC_RTSENA;
-               cix = rt->info[sc->sc_protrix].ctrl_rate;
-               rtsctsena = 1;
+       if (isaggr && txok) {
+               if (ATH_DS_TX_BA(ds)) {
+                       seq_st = ATH_DS_BA_SEQ(ds);
+                       memcpy(ba, ATH_DS_BA_BITMAP(ds),
+                              WME_BA_BMP_SIZE >> 3);
+               } else {
+                       /*
+                        * AR5416 can become deaf/mute when BA
+                        * issue happens. Chip needs to be reset.
+                        * But AP code may have sychronization issues
+                        * when perform internal reset in this routine.
+                        * Only enable reset in STA mode for now.
+                        */
+                       if (sc->sc_ah->opmode == NL80211_IFTYPE_STATION)
+                               needreset = 1;
+               }
        }
 
-       /* For AR5416 - RTS cannot be followed by a frame larger than 8K */
-       if (bf_isaggr(bf) && (bf->bf_al > ah->ah_caps.rts_aggr_limit))
-               flags &= ~(ATH9K_TXDESC_RTSENA);
-
-       /*
-        * CTS transmit rate is derived from the transmit rate by looking in the
-        * h/w rate table.  We must also factor in whether or not a short
-        * preamble is to be used. NB: cix is set above where RTS/CTS is enabled
-        */
-       ctsrate = rt->info[cix].ratecode |
-               (bf_isshpreamble(bf) ? rt->info[cix].short_preamble : 0);
-
-       for (i = 0; i < 4; i++) {
-               if (!rates[i].count || (rates[i].idx < 0))
-                       continue;
-
-               rix = rates[i].idx;
-
-               series[i].Rate = rt->info[rix].ratecode |
-                       (bf_isshpreamble(bf) ? rt->info[rix].short_preamble : 0);
-
-               series[i].Tries = rates[i].count;
-
-               series[i].RateFlags = (
-                       (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS) ?
-                               ATH9K_RATESERIES_RTS_CTS : 0) |
-                       ((rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) ?
-                               ATH9K_RATESERIES_2040 : 0) |
-                       ((rates[i].flags & IEEE80211_TX_RC_SHORT_GI) ?
-                               ATH9K_RATESERIES_HALFGI : 0);
-
-               series[i].PktDuration = ath_pkt_duration(sc, rix, bf,
-                        (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) != 0,
-                        (rates[i].flags & IEEE80211_TX_RC_SHORT_GI),
-                        bf_isshpreamble(bf));
-
-               series[i].ChSel = sc->sc_tx_chainmask;
+       INIT_LIST_HEAD(&bf_pending);
+       INIT_LIST_HEAD(&bf_head);
 
-               if (rtsctsena)
-                       series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
-       }
-
-       /* set dur_update_en for l-sig computation except for PS-Poll frames */
-       ath9k_hw_set11n_ratescenario(ah, ds, lastds, !bf_ispspoll(bf),
-                                    ctsrate, ctsduration,
-                                    series, 4, flags);
-
-       if (sc->sc_config.ath_aggr_prot && flags)
-               ath9k_hw_set11n_burstduration(ah, ds, 8192);
-}
-
-/*
- * Function to send a normal HT (non-AMPDU) frame
- * NB: must be called with txq lock held
- */
-static int ath_tx_send_normal(struct ath_softc *sc,
-                             struct ath_txq *txq,
-                             struct ath_atx_tid *tid,
-                             struct list_head *bf_head)
-{
-       struct ath_buf *bf;
-
-       BUG_ON(list_empty(bf_head));
-
-       bf = list_first_entry(bf_head, struct ath_buf, list);
-       bf->bf_state.bf_type &= ~BUF_AMPDU; /* regular HT frame */
-
-       /* update starting sequence number for subsequent ADDBA request */
-       INCR(tid->seq_start, IEEE80211_SEQ_MAX);
-
-       /* Queue to h/w without aggregation */
-       bf->bf_nframes = 1;
-       bf->bf_lastbf = bf->bf_lastfrm; /* one single frame */
-       ath_buf_set_rate(sc, bf);
-       ath_tx_txqaddbuf(sc, txq, bf_head);
-
-       return 0;
-}
-
-/* flush tid's software queue and send frames as non-ampdu's */
-
-static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
-{
-       struct ath_txq *txq = &sc->tx.txq[tid->ac->qnum];
-       struct ath_buf *bf;
-       struct list_head bf_head;
-       INIT_LIST_HEAD(&bf_head);
-
-       ASSERT(tid->paused > 0);
-       spin_lock_bh(&txq->axq_lock);
-
-       tid->paused--;
-
-       if (tid->paused > 0) {
-               spin_unlock_bh(&txq->axq_lock);
-               return;
-       }
-
-       while (!list_empty(&tid->buf_q)) {
-               bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
-               ASSERT(!bf_isretried(bf));
-               list_cut_position(&bf_head, &tid->buf_q, &bf->bf_lastfrm->list);
-               ath_tx_send_normal(sc, txq, tid, &bf_head);
-       }
-
-       spin_unlock_bh(&txq->axq_lock);
-}
-
-/* Completion routine of an aggregate */
-
-static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
-                                     struct ath_txq *txq,
-                                     struct ath_buf *bf,
-                                     struct list_head *bf_q,
-                                     int txok)
-{
-       struct ath_node *an = NULL;
-       struct sk_buff *skb;
-       struct ieee80211_tx_info *tx_info;
-       struct ath_atx_tid *tid = NULL;
-       struct ath_buf *bf_last = bf->bf_lastbf;
-       struct ath_desc *ds = bf_last->bf_desc;
-       struct ath_buf *bf_next, *bf_lastq = NULL;
-       struct list_head bf_head, bf_pending;
-       u16 seq_st = 0;
-       u32 ba[WME_BA_BMP_SIZE >> 5];
-       int isaggr, txfail, txpending, sendbar = 0, needreset = 0;
-
-       skb = (struct sk_buff *)bf->bf_mpdu;
-       tx_info = IEEE80211_SKB_CB(skb);
-
-       if (tx_info->control.sta) {
-               an = (struct ath_node *)tx_info->control.sta->drv_priv;
-               tid = ATH_AN_2_TID(an, bf->bf_tidno);
-       }
-
-       isaggr = bf_isaggr(bf);
-       if (isaggr) {
-               if (txok) {
-                       if (ATH_DS_TX_BA(ds)) {
-                               /*
-                                * extract starting sequence and
-                                * block-ack bitmap
-                                */
-                               seq_st = ATH_DS_BA_SEQ(ds);
-                               memcpy(ba,
-                                       ATH_DS_BA_BITMAP(ds),
-                                       WME_BA_BMP_SIZE >> 3);
-                       } else {
-                               memset(ba, 0, WME_BA_BMP_SIZE >> 3);
-
-                               /*
-                                * AR5416 can become deaf/mute when BA
-                                * issue happens. Chip needs to be reset.
-                                * But AP code may have sychronization issues
-                                * when perform internal reset in this routine.
-                                * Only enable reset in STA mode for now.
-                                */
-                               if (sc->sc_ah->ah_opmode ==
-                                           NL80211_IFTYPE_STATION)
-                                       needreset = 1;
-                       }
-               } else {
-                       memset(ba, 0, WME_BA_BMP_SIZE >> 3);
-               }
-       }
-
-       INIT_LIST_HEAD(&bf_pending);
-       INIT_LIST_HEAD(&bf_head);
-
-       while (bf) {
-               txfail = txpending = 0;
-               bf_next = bf->bf_next;
+       while (bf) {
+               txfail = txpending = 0;
+               bf_next = bf->bf_next;
 
                if (ATH_BA_ISSET(ba, ATH_BA_INDEX(seq_st, bf->bf_seqno))) {
                        /* transmit completion, subframe is
@@ -792,7 +326,6 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
                } else if (!isaggr && txok) {
                        /* transmit completion */
                } else {
-
                        if (!(tid->state & AGGR_CLEANUP) &&
                            ds->ds_txstat.ts_flags != ATH9K_TX_SW_ABORTED) {
                                if (bf->bf_retries < ATH_MAX_SW_RETRIES) {
@@ -811,37 +344,12 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
                                txfail = 1;
                        }
                }
-               /*
-                * Remove ath_buf's of this sub-frame from aggregate queue.
-                */
-               if (bf_next == NULL) {  /* last subframe in the aggregate */
-                       ASSERT(bf->bf_lastfrm == bf_last);
 
-                       /*
-                        * The last descriptor of the last sub frame could be
-                        * a holding descriptor for h/w. If that's the case,
-                        * bf->bf_lastfrm won't be in the bf_q.
-                        * Make sure we handle bf_q properly here.
-                        */
-
-                       if (!list_empty(bf_q)) {
-                               bf_lastq = list_entry(bf_q->prev,
-                                       struct ath_buf, list);
-                               list_cut_position(&bf_head,
-                                       bf_q, &bf_lastq->list);
-                       } else {
-                               /*
-                                * XXX: if the last subframe only has one
-                                * descriptor which is also being used as
-                                * a holding descriptor. Then the ath_buf
-                                * is not in the bf_q at all.
-                                */
-                               INIT_LIST_HEAD(&bf_head);
-                       }
+               if (bf_next == NULL) {
+                       INIT_LIST_HEAD(&bf_head);
                } else {
                        ASSERT(!list_empty(bf_q));
-                       list_cut_position(&bf_head,
-                               bf_q, &bf->bf_lastfrm->list);
+                       list_move_tail(&bf->list, &bf_head);
                }
 
                if (!txpending) {
@@ -853,62 +361,22 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
                        ath_tx_update_baw(sc, tid, bf->bf_seqno);
                        spin_unlock_bh(&txq->axq_lock);
 
-                       /* complete this sub-frame */
                        ath_tx_complete_buf(sc, bf, &bf_head, !txfail, sendbar);
                } else {
-                       /*
-                        * retry the un-acked ones
-                        */
-                       /*
-                        * XXX: if the last descriptor is holding descriptor,
-                        * in order to requeue the frame to software queue, we
-                        * need to allocate a new descriptor and
-                        * copy the content of holding descriptor to it.
-                        */
+                       /* retry the un-acked ones */
                        if (bf->bf_next == NULL &&
                            bf_last->bf_status & ATH_BUFSTATUS_STALE) {
                                struct ath_buf *tbf;
 
-                               /* allocate new descriptor */
-                               spin_lock_bh(&sc->tx.txbuflock);
-                               ASSERT(!list_empty((&sc->tx.txbuf)));
-                               tbf = list_first_entry(&sc->tx.txbuf,
-                                               struct ath_buf, list);
-                               list_del(&tbf->list);
-                               spin_unlock_bh(&sc->tx.txbuflock);
-
-                               ATH_TXBUF_RESET(tbf);
-
-                               /* copy descriptor content */
-                               tbf->bf_mpdu = bf_last->bf_mpdu;
-                               tbf->bf_buf_addr = bf_last->bf_buf_addr;
-                               *(tbf->bf_desc) = *(bf_last->bf_desc);
-
-                               /* link it to the frame */
-                               if (bf_lastq) {
-                                       bf_lastq->bf_desc->ds_link =
-                                               tbf->bf_daddr;
-                                       bf->bf_lastfrm = tbf;
-                                       ath9k_hw_cleartxdesc(sc->sc_ah,
-                                               bf->bf_lastfrm->bf_desc);
-                               } else {
-                                       tbf->bf_state = bf_last->bf_state;
-                                       tbf->bf_lastfrm = tbf;
-                                       ath9k_hw_cleartxdesc(sc->sc_ah,
-                                               tbf->bf_lastfrm->bf_desc);
-
-                                       /* copy the DMA context */
-                                       tbf->bf_dmacontext =
-                                               bf_last->bf_dmacontext;
-                               }
+                               tbf = ath_clone_txbuf(sc, bf_last);
+                               ath9k_hw_cleartxdesc(sc->sc_ah, tbf->bf_desc);
                                list_add_tail(&tbf->list, &bf_head);
                        } else {
                                /*
                                 * Clear descriptor status words for
                                 * software retry
                                 */
-                               ath9k_hw_cleartxdesc(sc->sc_ah,
-                                                    bf->bf_lastfrm->bf_desc);
+                               ath9k_hw_cleartxdesc(sc->sc_ah, bf->bf_desc);
                        }
 
                        /*
@@ -922,401 +390,97 @@ static void ath_tx_complete_aggr_rifs(struct ath_softc *sc,
        }
 
        if (tid->state & AGGR_CLEANUP) {
-               /* check to see if we're done with cleaning the h/w queue */
-               spin_lock_bh(&txq->axq_lock);
-
                if (tid->baw_head == tid->baw_tail) {
                        tid->state &= ~AGGR_ADDBA_COMPLETE;
                        tid->addba_exchangeattempts = 0;
-                       spin_unlock_bh(&txq->axq_lock);
-
                        tid->state &= ~AGGR_CLEANUP;
 
                        /* send buffered frames as singles */
                        ath_tx_flush_tid(sc, tid);
-               } else
-                       spin_unlock_bh(&txq->axq_lock);
-
+               }
+               rcu_read_unlock();
                return;
        }
 
-       /*
-        * prepend un-acked frames to the beginning of the pending frame queue
-        */
+       /* prepend un-acked frames to the beginning of the pending frame queue */
        if (!list_empty(&bf_pending)) {
                spin_lock_bh(&txq->axq_lock);
-               /* Note: we _prepend_, we _do_not_ at to
-                * the end of the queue ! */
                list_splice(&bf_pending, &tid->buf_q);
                ath_tx_queue_tid(txq, tid);
                spin_unlock_bh(&txq->axq_lock);
        }
 
+       rcu_read_unlock();
+
        if (needreset)
                ath_reset(sc, false);
-
-       return;
-}
-
-static void ath_tx_rc_status(struct ath_buf *bf, struct ath_desc *ds, int nbad)
-{
-       struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu;
-       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
-       struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
-
-       tx_info_priv->update_rc = false;
-       if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT)
-               tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
-
-       if ((ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) == 0 &&
-           (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0) {
-               if (bf_isdata(bf)) {
-                       memcpy(&tx_info_priv->tx, &ds->ds_txstat,
-                              sizeof(tx_info_priv->tx));
-                       tx_info_priv->n_frames = bf->bf_nframes;
-                       tx_info_priv->n_bad_frames = nbad;
-                       tx_info_priv->update_rc = true;
-               }
-       }
 }
 
-/* Process completed xmit descriptors from the specified queue */
-
-static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
+static u32 ath_lookup_rate(struct ath_softc *sc, struct ath_buf *bf,
+                          struct ath_atx_tid *tid)
 {
-       struct ath_hal *ah = sc->sc_ah;
-       struct ath_buf *bf, *lastbf, *bf_held = NULL;
-       struct list_head bf_head;
-       struct ath_desc *ds;
-       int txok, nbad = 0;
-       int status;
+       struct ath_rate_table *rate_table = sc->cur_rate_table;
+       struct sk_buff *skb;
+       struct ieee80211_tx_info *tx_info;
+       struct ieee80211_tx_rate *rates;
+       struct ath_tx_info_priv *tx_info_priv;
+       u32 max_4ms_framelen, frmlen;
+       u16 aggr_limit, legacy = 0, maxampdu;
+       int i;
 
-       DPRINTF(sc, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n",
-               txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
-               txq->axq_link);
+       skb = (struct sk_buff *)bf->bf_mpdu;
+       tx_info = IEEE80211_SKB_CB(skb);
+       rates = tx_info->control.rates;
+       tx_info_priv = (struct ath_tx_info_priv *)tx_info->rate_driver_data[0];
 
-       for (;;) {
-               spin_lock_bh(&txq->axq_lock);
-               if (list_empty(&txq->axq_q)) {
-                       txq->axq_link = NULL;
-                       txq->axq_linkbuf = NULL;
-                       spin_unlock_bh(&txq->axq_lock);
-                       break;
-               }
-               bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
+       /*
+        * Find the lowest frame length among the rate series that will have a
+        * 4ms transmit duration.
+        * TODO - TXOP limit needs to be considered.
+        */
+       max_4ms_framelen = ATH_AMPDU_LIMIT_MAX;
 
-               /*
-                * There is a race condition that a BH gets scheduled
-                * after sw writes TxE and before hw re-load the last
-                * descriptor to get the newly chained one.
-                * Software must keep the last DONE descriptor as a
-                * holding descriptor - software does so by marking
-                * it with the STALE flag.
-                */
-               bf_held = NULL;
-               if (bf->bf_status & ATH_BUFSTATUS_STALE) {
-                       bf_held = bf;
-                       if (list_is_last(&bf_held->list, &txq->axq_q)) {
-                               /* FIXME:
-                                * The holding descriptor is the last
-                                * descriptor in queue. It's safe to remove
-                                * the last holding descriptor in BH context.
-                                */
-                               spin_unlock_bh(&txq->axq_lock);
+       for (i = 0; i < 4; i++) {
+               if (rates[i].count) {
+                       if (!WLAN_RC_PHY_HT(rate_table->info[rates[i].idx].phy)) {
+                               legacy = 1;
                                break;
-                       } else {
-                               /* Lets work with the next buffer now */
-                               bf = list_entry(bf_held->list.next,
-                                       struct ath_buf, list);
                        }
-               }
-
-               lastbf = bf->bf_lastbf;
-               ds = lastbf->bf_desc;    /* NB: last decriptor */
 
-               status = ath9k_hw_txprocdesc(ah, ds);
-               if (status == -EINPROGRESS) {
-                       spin_unlock_bh(&txq->axq_lock);
-                       break;
+                       frmlen = rate_table->info[rates[i].idx].max_4ms_framelen;
+                       max_4ms_framelen = min(max_4ms_framelen, frmlen);
                }
-               if (bf->bf_desc == txq->axq_lastdsWithCTS)
-                       txq->axq_lastdsWithCTS = NULL;
-               if (ds == txq->axq_gatingds)
-                       txq->axq_gatingds = NULL;
-
-               /*
-                * Remove ath_buf's of the same transmit unit from txq,
-                * however leave the last descriptor back as the holding
-                * descriptor for hw.
-                */
-               lastbf->bf_status |= ATH_BUFSTATUS_STALE;
-               INIT_LIST_HEAD(&bf_head);
-
-               if (!list_is_singular(&lastbf->list))
-                       list_cut_position(&bf_head,
-                               &txq->axq_q, lastbf->list.prev);
-
-               txq->axq_depth--;
+       }
 
-               if (bf_isaggr(bf))
-                       txq->axq_aggr_depth--;
+       /*
+        * limit aggregate size by the minimum rate if rate selected is
+        * not a probe rate, if rate selected is a probe rate then
+        * avoid aggregation of this packet.
+        */
+       if (tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE || legacy)
+               return 0;
 
-               txok = (ds->ds_txstat.ts_status == 0);
+       aggr_limit = min(max_4ms_framelen, (u32)ATH_AMPDU_LIMIT_DEFAULT);
 
-               spin_unlock_bh(&txq->axq_lock);
+       /*
+        * h/w can accept aggregates upto 16 bit lengths (65535).
+        * The IE, however can hold upto 65536, which shows up here
+        * as zero. Ignore 65536 since we  are constrained by hw.
+        */
+       maxampdu = tid->an->maxampdu;
+       if (maxampdu)
+               aggr_limit = min(aggr_limit, maxampdu);
 
-               if (bf_held) {
-                       list_del(&bf_held->list);
-                       spin_lock_bh(&sc->tx.txbuflock);
-                       list_add_tail(&bf_held->list, &sc->tx.txbuf);
-                       spin_unlock_bh(&sc->tx.txbuflock);
-               }
-
-               if (!bf_isampdu(bf)) {
-                       /*
-                        * This frame is sent out as a single frame.
-                        * Use hardware retry status for this frame.
-                        */
-                       bf->bf_retries = ds->ds_txstat.ts_longretry;
-                       if (ds->ds_txstat.ts_status & ATH9K_TXERR_XRETRY)
-                               bf->bf_state.bf_type |= BUF_XRETRY;
-                       nbad = 0;
-               } else {
-                       nbad = ath_tx_num_badfrms(sc, bf, txok);
-               }
-
-               ath_tx_rc_status(bf, ds, nbad);
-
-               /*
-                * Complete this transmit unit
-                */
-               if (bf_isampdu(bf))
-                       ath_tx_complete_aggr_rifs(sc, txq, bf, &bf_head, txok);
-               else
-                       ath_tx_complete_buf(sc, bf, &bf_head, txok, 0);
-
-               /* Wake up mac80211 queue */
-
-               spin_lock_bh(&txq->axq_lock);
-               if (txq->stopped && ath_txq_depth(sc, txq->axq_qnum) <=
-                               (ATH_TXBUF - 20)) {
-                       int qnum;
-                       qnum = ath_get_mac80211_qnum(txq->axq_qnum, sc);
-                       if (qnum != -1) {
-                               ieee80211_wake_queue(sc->hw, qnum);
-                               txq->stopped = 0;
-                       }
-
-               }
-
-               /*
-                * schedule any pending packets if aggregation is enabled
-                */
-               if (sc->sc_flags & SC_OP_TXAGGR)
-                       ath_txq_schedule(sc, txq);
-               spin_unlock_bh(&txq->axq_lock);
-       }
-}
-
-static void ath_tx_stopdma(struct ath_softc *sc, struct ath_txq *txq)
-{
-       struct ath_hal *ah = sc->sc_ah;
-
-       (void) ath9k_hw_stoptxdma(ah, txq->axq_qnum);
-       DPRINTF(sc, ATH_DBG_XMIT, "tx queue [%u] %x, link %p\n",
-               txq->axq_qnum, ath9k_hw_gettxbuf(ah, txq->axq_qnum),
-               txq->axq_link);
-}
-
-/* Drain only the data queues */
-
-static void ath_drain_txdataq(struct ath_softc *sc, bool retry_tx)
-{
-       struct ath_hal *ah = sc->sc_ah;
-       int i, status, npend = 0;
-
-       if (!(sc->sc_flags & SC_OP_INVALID)) {
-               for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
-                       if (ATH_TXQ_SETUP(sc, i)) {
-                               ath_tx_stopdma(sc, &sc->tx.txq[i]);
-                               /* The TxDMA may not really be stopped.
-                                * Double check the hal tx pending count */
-                               npend += ath9k_hw_numtxpending(ah,
-                                                      sc->tx.txq[i].axq_qnum);
-                       }
-               }
-       }
-
-       if (npend) {
-               /* TxDMA not stopped, reset the hal */
-               DPRINTF(sc, ATH_DBG_XMIT, "Unable to stop TxDMA. Reset HAL!\n");
-
-               spin_lock_bh(&sc->sc_resetlock);
-               if (!ath9k_hw_reset(ah,
-                                   sc->sc_ah->ah_curchan,
-                                   sc->tx_chan_width,
-                                   sc->sc_tx_chainmask, sc->sc_rx_chainmask,
-                                   sc->sc_ht_extprotspacing, true, &status)) {
-
-                       DPRINTF(sc, ATH_DBG_FATAL,
-                               "Unable to reset hardware; hal status %u\n",
-                               status);
-               }
-               spin_unlock_bh(&sc->sc_resetlock);
-       }
-
-       for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
-               if (ATH_TXQ_SETUP(sc, i))
-                       ath_tx_draintxq(sc, &sc->tx.txq[i], retry_tx);
-       }
-}
-
-/* Add a sub-frame to block ack window */
-
-static void ath_tx_addto_baw(struct ath_softc *sc,
-                            struct ath_atx_tid *tid,
-                            struct ath_buf *bf)
-{
-       int index, cindex;
-
-       if (bf_isretried(bf))
-               return;
-
-       index  = ATH_BA_INDEX(tid->seq_start, bf->bf_seqno);
-       cindex = (tid->baw_head + index) & (ATH_TID_MAX_BUFS - 1);
-
-       ASSERT(tid->tx_buf[cindex] == NULL);
-       tid->tx_buf[cindex] = bf;
-
-       if (index >= ((tid->baw_tail - tid->baw_head) &
-               (ATH_TID_MAX_BUFS - 1))) {
-               tid->baw_tail = cindex;
-               INCR(tid->baw_tail, ATH_TID_MAX_BUFS);
-       }
-}
-
-/*
- * Function to send an A-MPDU
- * NB: must be called with txq lock held
- */
-static int ath_tx_send_ampdu(struct ath_softc *sc,
-                            struct ath_atx_tid *tid,
-                            struct list_head *bf_head,
-                            struct ath_tx_control *txctl)
-{
-       struct ath_buf *bf;
-
-       BUG_ON(list_empty(bf_head));
-
-       bf = list_first_entry(bf_head, struct ath_buf, list);
-       bf->bf_state.bf_type |= BUF_AMPDU;
-
-       /*
-        * Do not queue to h/w when any of the following conditions is true:
-        * - there are pending frames in software queue
-        * - the TID is currently paused for ADDBA/BAR request
-        * - seqno is not within block-ack window
-        * - h/w queue depth exceeds low water mark
-        */
-       if (!list_empty(&tid->buf_q) || tid->paused ||
-           !BAW_WITHIN(tid->seq_start, tid->baw_size, bf->bf_seqno) ||
-           txctl->txq->axq_depth >= ATH_AGGR_MIN_QDEPTH) {
-               /*
-                * Add this frame to software queue for scheduling later
-                * for aggregation.
-                */
-               list_splice_tail_init(bf_head, &tid->buf_q);
-               ath_tx_queue_tid(txctl->txq, tid);
-               return 0;
-       }
-
-       /* Add sub-frame to BAW */
-       ath_tx_addto_baw(sc, tid, bf);
-
-       /* Queue to h/w without aggregation */
-       bf->bf_nframes = 1;
-       bf->bf_lastbf = bf->bf_lastfrm; /* one single frame */
-       ath_buf_set_rate(sc, bf);
-       ath_tx_txqaddbuf(sc, txctl->txq, bf_head);
-
-       return 0;
-}
-
-/*
- * looks up the rate
- * returns aggr limit based on lowest of the rates
- */
-static u32 ath_lookup_rate(struct ath_softc *sc,
-                          struct ath_buf *bf,
-                          struct ath_atx_tid *tid)
-{
-       struct ath_rate_table *rate_table = sc->cur_rate_table;
-       struct sk_buff *skb;
-       struct ieee80211_tx_info *tx_info;
-       struct ieee80211_tx_rate *rates;
-       struct ath_tx_info_priv *tx_info_priv;
-       u32 max_4ms_framelen, frame_length;
-       u16 aggr_limit, legacy = 0, maxampdu;
-       int i;
-
-       skb = (struct sk_buff *)bf->bf_mpdu;
-       tx_info = IEEE80211_SKB_CB(skb);
-       rates = tx_info->control.rates;
-       tx_info_priv =
-               (struct ath_tx_info_priv *)tx_info->rate_driver_data[0];
-
-       /*
-        * Find the lowest frame length among the rate series that will have a
-        * 4ms transmit duration.
-        * TODO - TXOP limit needs to be considered.
-        */
-       max_4ms_framelen = ATH_AMPDU_LIMIT_MAX;
-
-       for (i = 0; i < 4; i++) {
-               if (rates[i].count) {
-                       if (!WLAN_RC_PHY_HT(rate_table->info[rates[i].idx].phy)) {
-                               legacy = 1;
-                               break;
-                       }
-
-                       frame_length =
-                               rate_table->info[rates[i].idx].max_4ms_framelen;
-                       max_4ms_framelen = min(max_4ms_framelen, frame_length);
-               }
-       }
-
-       /*
-        * limit aggregate size by the minimum rate if rate selected is
-        * not a probe rate, if rate selected is a probe rate then
-        * avoid aggregation of this packet.
-        */
-       if (tx_info->flags & IEEE80211_TX_CTL_RATE_CTRL_PROBE || legacy)
-               return 0;
-
-       aggr_limit = min(max_4ms_framelen,
-               (u32)ATH_AMPDU_LIMIT_DEFAULT);
-
-       /*
-        * h/w can accept aggregates upto 16 bit lengths (65535).
-        * The IE, however can hold upto 65536, which shows up here
-        * as zero. Ignore 65536 since we  are constrained by hw.
-        */
-       maxampdu = tid->an->maxampdu;
-       if (maxampdu)
-               aggr_limit = min(aggr_limit, maxampdu);
-
-       return aggr_limit;
-}
+       return aggr_limit;
+}
 
 /*
- * returns the number of delimiters to be added to
+ * Returns the number of delimiters to be added to
  * meet the minimum required mpdudensity.
- * caller should make sure that the rate is  HT rate .
+ * caller should make sure that the rate is HT rate .
  */
-static int ath_compute_num_delims(struct ath_softc *sc,
-                                 struct ath_atx_tid *tid,
-                                 struct ath_buf *bf,
-                                 u16 frmlen)
+static int ath_compute_num_delims(struct ath_softc *sc, struct ath_atx_tid *tid,
+                                 struct ath_buf *bf, u16 frmlen)
 {
        struct ath_rate_table *rt = sc->cur_rate_table;
        struct sk_buff *skb = bf->bf_mpdu;
@@ -1370,9 +534,7 @@ static int ath_compute_num_delims(struct ath_softc *sc,
        nsymbits = bits_per_symbol[HT_RC_2_MCS(rc)][width];
        minlen = (nsymbols * nsymbits) / BITS_PER_BYTE;
 
-       /* Is frame shorter than required minimum length? */
        if (frmlen < minlen) {
-               /* Get the minimum number of delimiters required. */
                mindelim = (minlen - frmlen) / ATH_AGGR_DELIM_SZ;
                ndelim = max(mindelim, ndelim);
        }
@@ -1380,37 +542,23 @@ static int ath_compute_num_delims(struct ath_softc *sc,
        return ndelim;
 }
 
-/*
- * For aggregation from software buffer queue.
- * NB: must be called with txq lock held
- */
 static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
-                                       struct ath_atx_tid *tid,
-                                       struct list_head *bf_q,
-                                       struct ath_buf **bf_last,
-                                       struct aggr_rifs_param *param,
-                                       int *prev_frames)
+                                            struct ath_atx_tid *tid,
+                                            struct list_head *bf_q)
 {
 #define PADBYTES(_len) ((4 - ((_len) % 4)) % 4)
-       struct ath_buf *bf, *tbf, *bf_first, *bf_prev = NULL;
-       struct list_head bf_head;
-       int rl = 0, nframes = 0, ndelim;
+       struct ath_buf *bf, *bf_first, *bf_prev = NULL;
+       int rl = 0, nframes = 0, ndelim, prev_al = 0;
        u16 aggr_limit = 0, al = 0, bpad = 0,
                al_delta, h_baw = tid->baw_size / 2;
        enum ATH_AGGR_STATUS status = ATH_AGGR_DONE;
-       int prev_al = 0;
-       INIT_LIST_HEAD(&bf_head);
-
-       BUG_ON(list_empty(&tid->buf_q));
 
        bf_first = list_first_entry(&tid->buf_q, struct ath_buf, list);
 
        do {
                bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
 
-               /*
-                * do not step over block-ack window
-                */
+               /* do not step over block-ack window */
                if (!BAW_WITHIN(tid->seq_start, tid->baw_size, bf->bf_seqno)) {
                        status = ATH_AGGR_BAW_CLOSED;
                        break;
@@ -1421,29 +569,23 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
                        rl = 1;
                }
 
-               /*
-                * do not exceed aggregation limit
-                */
+               /* do not exceed aggregation limit */
                al_delta = ATH_AGGR_DELIM_SZ + bf->bf_frmlen;
 
-               if (nframes && (aggr_limit <
-                       (al + bpad + al_delta + prev_al))) {
+               if (nframes &&
+                   (aggr_limit < (al + bpad + al_delta + prev_al))) {
                        status = ATH_AGGR_LIMITED;
                        break;
                }
 
-               /*
-                * do not exceed subframe limit
-                */
-               if ((nframes + *prev_frames) >=
-                   min((int)h_baw, ATH_AMPDU_SUBFRAME_DEFAULT)) {
+               /* do not exceed subframe limit */
+               if (nframes >= min((int)h_baw, ATH_AMPDU_SUBFRAME_DEFAULT)) {
                        status = ATH_AGGR_LIMITED;
                        break;
                }
+               nframes++;
 
-               /*
-                * add padding for previous frame to aggregation length
-                */
+               /* add padding for previous frame to aggregation length */
                al += bpad + al_delta;
 
                /*
@@ -1451,69 +593,35 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
                 * density for this node.
                 */
                ndelim = ath_compute_num_delims(sc, tid, bf_first, bf->bf_frmlen);
-
                bpad = PADBYTES(al_delta) + (ndelim << 2);
 
                bf->bf_next = NULL;
-               bf->bf_lastfrm->bf_desc->ds_link = 0;
+               bf->bf_desc->ds_link = 0;
 
-               /*
-                * this packet is part of an aggregate
-                * - remove all descriptors belonging to this frame from
-                *   software queue
-                * - add it to block ack window
-                * - set up descriptors for aggregation
-                */
-               list_cut_position(&bf_head, &tid->buf_q, &bf->bf_lastfrm->list);
+               /* link buffers of this frame to the aggregate */
                ath_tx_addto_baw(sc, tid, bf);
-
-               list_for_each_entry(tbf, &bf_head, list) {
-                       ath9k_hw_set11n_aggr_middle(sc->sc_ah,
-                               tbf->bf_desc, ndelim);
-               }
-
-               /*
-                * link buffers of this frame to the aggregate
-                */
-               list_splice_tail_init(&bf_head, bf_q);
-               nframes++;
-
+               ath9k_hw_set11n_aggr_middle(sc->sc_ah, bf->bf_desc, ndelim);
+               list_move_tail(&bf->list, bf_q);
                if (bf_prev) {
                        bf_prev->bf_next = bf;
-                       bf_prev->bf_lastfrm->bf_desc->ds_link = bf->bf_daddr;
+                       bf_prev->bf_desc->ds_link = bf->bf_daddr;
                }
                bf_prev = bf;
-
-#ifdef AGGR_NOSHORT
-               /*
-                * terminate aggregation on a small packet boundary
-                */
-               if (bf->bf_frmlen < ATH_AGGR_MINPLEN) {
-                       status = ATH_AGGR_SHORTPKT;
-                       break;
-               }
-#endif
        } while (!list_empty(&tid->buf_q));
 
        bf_first->bf_al = al;
        bf_first->bf_nframes = nframes;
-       *bf_last = bf_prev;
+
        return status;
 #undef PADBYTES
 }
 
-/*
- * process pending frames possibly doing a-mpdu aggregation
- * NB: must be called with txq lock held
- */
-static void ath_tx_sched_aggr(struct ath_softc *sc,
-       struct ath_txq *txq, struct ath_atx_tid *tid)
+static void ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq,
+                             struct ath_atx_tid *tid)
 {
-       struct ath_buf *bf, *tbf, *bf_last, *bf_lastaggr = NULL;
+       struct ath_buf *bf;
        enum ATH_AGGR_STATUS status;
        struct list_head bf_q;
-       struct aggr_rifs_param param = {0, 0, 0, 0, NULL};
-       int prev_frames = 0;
 
        do {
                if (list_empty(&tid->buf_q))
@@ -1521,135 +629,892 @@ static void ath_tx_sched_aggr(struct ath_softc *sc,
 
                INIT_LIST_HEAD(&bf_q);
 
-               status = ath_tx_form_aggr(sc, tid, &bf_q, &bf_lastaggr, &param,
-                                         &prev_frames);
+               status = ath_tx_form_aggr(sc, tid, &bf_q);
 
                /*
-                * no frames picked up to be aggregated; block-ack
-                * window is not open
+                * no frames picked up to be aggregated;
+                * block-ack window is not open.
                 */
                if (list_empty(&bf_q))
                        break;
 
                bf = list_first_entry(&bf_q, struct ath_buf, list);
-               bf_last = list_entry(bf_q.prev, struct ath_buf, list);
-               bf->bf_lastbf = bf_last;
+               bf->bf_lastbf = list_entry(bf_q.prev, struct ath_buf, list);
 
-               /*
-                * if only one frame, send as non-aggregate
-                */
+               /* if only one frame, send as non-aggregate */
                if (bf->bf_nframes == 1) {
-                       ASSERT(bf->bf_lastfrm == bf_last);
-
                        bf->bf_state.bf_type &= ~BUF_AGGR;
-                       /*
-                        * clear aggr bits for every descriptor
-                        * XXX TODO: is there a way to optimize it?
-                        */
-                       list_for_each_entry(tbf, &bf_q, list) {
-                               ath9k_hw_clr11n_aggr(sc->sc_ah, tbf->bf_desc);
-                       }
-
+                       ath9k_hw_clr11n_aggr(sc->sc_ah, bf->bf_desc);
                        ath_buf_set_rate(sc, bf);
                        ath_tx_txqaddbuf(sc, txq, &bf_q);
                        continue;
                }
 
-               /*
-                * setup first desc with rate and aggr info
-                */
+               /* setup first desc of aggregate */
                bf->bf_state.bf_type |= BUF_AGGR;
                ath_buf_set_rate(sc, bf);
                ath9k_hw_set11n_aggr_first(sc->sc_ah, bf->bf_desc, bf->bf_al);
 
-               /*
-                * anchor last frame of aggregate correctly
-                */
-               ASSERT(bf_lastaggr);
-               ASSERT(bf_lastaggr->bf_lastfrm == bf_last);
-               tbf = bf_lastaggr;
-               ath9k_hw_set11n_aggr_last(sc->sc_ah, tbf->bf_desc);
-
-               /* XXX: We don't enter into this loop, consider removing this */
-               while (!list_empty(&bf_q) && !list_is_last(&tbf->list, &bf_q)) {
-                       tbf = list_entry(tbf->list.next, struct ath_buf, list);
-                       ath9k_hw_set11n_aggr_last(sc->sc_ah, tbf->bf_desc);
-               }
+               /* anchor last desc of aggregate */
+               ath9k_hw_set11n_aggr_last(sc->sc_ah, bf->bf_lastbf->bf_desc);
 
                txq->axq_aggr_depth++;
-
-               /*
-                * Normal aggregate, queue to hardware
-                */
                ath_tx_txqaddbuf(sc, txq, &bf_q);
 
        } while (txq->axq_depth < ATH_AGGR_MIN_QDEPTH &&
                 status != ATH_AGGR_BAW_CLOSED);
 }
 
-/* Called with txq lock held */
+int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
+                     u16 tid, u16 *ssn)
+{
+       struct ath_atx_tid *txtid;
+       struct ath_node *an;
+
+       an = (struct ath_node *)sta->drv_priv;
+
+       if (sc->sc_flags & SC_OP_TXAGGR) {
+               txtid = ATH_AN_2_TID(an, tid);
+               txtid->state |= AGGR_ADDBA_PROGRESS;
+               ath_tx_pause_tid(sc, txtid);
+               *ssn = txtid->seq_start;
+       }
+
+       return 0;
+}
+
+int ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
+{
+       struct ath_node *an = (struct ath_node *)sta->drv_priv;
+       struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
+       struct ath_txq *txq = &sc->tx.txq[txtid->ac->qnum];
+       struct ath_buf *bf;
+       struct list_head bf_head;
+       INIT_LIST_HEAD(&bf_head);
+
+       if (txtid->state & AGGR_CLEANUP)
+               return 0;
+
+       if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
+               txtid->addba_exchangeattempts = 0;
+               return 0;
+       }
+
+       ath_tx_pause_tid(sc, txtid);
+
+       /* drop all software retried frames and mark this TID */
+       spin_lock_bh(&txq->axq_lock);
+       while (!list_empty(&txtid->buf_q)) {
+               bf = list_first_entry(&txtid->buf_q, struct ath_buf, list);
+               if (!bf_isretried(bf)) {
+                       /*
+                        * NB: it's based on the assumption that
+                        * software retried frame will always stay
+                        * at the head of software queue.
+                        */
+                       break;
+               }
+               list_move_tail(&bf->list, &bf_head);
+               ath_tx_update_baw(sc, txtid, bf->bf_seqno);
+               ath_tx_complete_buf(sc, bf, &bf_head, 0, 0);
+       }
+       spin_unlock_bh(&txq->axq_lock);
+
+       if (txtid->baw_head != txtid->baw_tail) {
+               txtid->state |= AGGR_CLEANUP;
+       } else {
+               txtid->state &= ~AGGR_ADDBA_COMPLETE;
+               txtid->addba_exchangeattempts = 0;
+               ath_tx_flush_tid(sc, txtid);
+       }
+
+       return 0;
+}
+
+void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
+{
+       struct ath_atx_tid *txtid;
+       struct ath_node *an;
+
+       an = (struct ath_node *)sta->drv_priv;
+
+       if (sc->sc_flags & SC_OP_TXAGGR) {
+               txtid = ATH_AN_2_TID(an, tid);
+               txtid->baw_size =
+                       IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
+               txtid->state |= AGGR_ADDBA_COMPLETE;
+               txtid->state &= ~AGGR_ADDBA_PROGRESS;
+               ath_tx_resume_tid(sc, txtid);
+       }
+}
+
+bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno)
+{
+       struct ath_atx_tid *txtid;
+
+       if (!(sc->sc_flags & SC_OP_TXAGGR))
+               return false;
+
+       txtid = ATH_AN_2_TID(an, tidno);
+
+       if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
+               if (!(txtid->state & AGGR_ADDBA_PROGRESS) &&
+                   (txtid->addba_exchangeattempts < ADDBA_EXCHANGE_ATTEMPTS)) {
+                       txtid->addba_exchangeattempts++;
+                       return true;
+               }
+       }
+
+       return false;
+}
+
+/********************/
+/* Queue Management */
+/********************/
+
+static u32 ath_txq_depth(struct ath_softc *sc, int qnum)
+{
+       return sc->tx.txq[qnum].axq_depth;
+}
+
+static void ath_get_beaconconfig(struct ath_softc *sc, int if_id,
+                                struct ath_beacon_config *conf)
+{
+       struct ieee80211_hw *hw = sc->hw;
+
+       /* fill in beacon config data */
+
+       conf->beacon_interval = hw->conf.beacon_int;
+       conf->listen_interval = 100;
+       conf->dtim_count = 1;
+       conf->bmiss_timeout = ATH_DEFAULT_BMISS_LIMIT * conf->listen_interval;
+}
+
+static void ath_txq_drain_pending_buffers(struct ath_softc *sc,
+                                         struct ath_txq *txq)
+{
+       struct ath_atx_ac *ac, *ac_tmp;
+       struct ath_atx_tid *tid, *tid_tmp;
+
+       list_for_each_entry_safe(ac, ac_tmp, &txq->axq_acq, list) {
+               list_del(&ac->list);
+               ac->sched = false;
+               list_for_each_entry_safe(tid, tid_tmp, &ac->tid_q, list) {
+                       list_del(&tid->list);
+                       tid->sched = false;
+                       ath_tid_drain(sc, txq, tid);
+               }
+       }
+}
+
+struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype)
+{
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath9k_tx_queue_info qi;
+       int qnum;
+
+       memset(&qi, 0, sizeof(qi));
+       qi.tqi_subtype = subtype;
+       qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT;
+       qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT;
+       qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT;
+       qi.tqi_physCompBuf = 0;
+
+       /*
+        * Enable interrupts only for EOL and DESC conditions.
+        * We mark tx descriptors to receive a DESC interrupt
+        * when a tx queue gets deep; otherwise waiting for the
+        * EOL to reap descriptors.  Note that this is done to
+        * reduce interrupt load and this only defers reaping
+        * descriptors, never transmitting frames.  Aside from
+        * reducing interrupts this also permits more concurrency.
+        * The only potential downside is if the tx queue backs
+        * up in which case the top half of the kernel may backup
+        * due to a lack of tx descriptors.
+        *
+        * The UAPSD queue is an exception, since we take a desc-
+        * based intr on the EOSP frames.
+        */
+       if (qtype == ATH9K_TX_QUEUE_UAPSD)
+               qi.tqi_qflags = TXQ_FLAG_TXDESCINT_ENABLE;
+       else
+               qi.tqi_qflags = TXQ_FLAG_TXEOLINT_ENABLE |
+                       TXQ_FLAG_TXDESCINT_ENABLE;
+       qnum = ath9k_hw_setuptxqueue(ah, qtype, &qi);
+       if (qnum == -1) {
+               /*
+                * NB: don't print a message, this happens
+                * normally on parts with too few tx queues
+                */
+               return NULL;
+       }
+       if (qnum >= ARRAY_SIZE(sc->tx.txq)) {
+               DPRINTF(sc, ATH_DBG_FATAL,
+                       "qnum %u out of range, max %u!\n",
+                       qnum, (unsigned int)ARRAY_SIZE(sc->tx.txq));
+               ath9k_hw_releasetxqueue(ah, qnum);
+               return NULL;
+       }
+       if (!ATH_TXQ_SETUP(sc, qnum)) {
+               struct ath_txq *txq = &sc->tx.txq[qnum];
+
+               txq->axq_qnum = qnum;
+               txq->axq_link = NULL;
+               INIT_LIST_HEAD(&txq->axq_q);
+               INIT_LIST_HEAD(&txq->axq_acq);
+               spin_lock_init(&txq->axq_lock);
+               txq->axq_depth = 0;
+               txq->axq_aggr_depth = 0;
+               txq->axq_totalqueued = 0;
+               txq->axq_linkbuf = NULL;
+               sc->tx.txqsetup |= 1<<qnum;
+       }
+       return &sc->tx.txq[qnum];
+}
+
+static int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype)
+{
+       int qnum;
+
+       switch (qtype) {
+       case ATH9K_TX_QUEUE_DATA:
+               if (haltype >= ARRAY_SIZE(sc->tx.hwq_map)) {
+                       DPRINTF(sc, ATH_DBG_FATAL,
+                               "HAL AC %u out of range, max %zu!\n",
+                               haltype, ARRAY_SIZE(sc->tx.hwq_map));
+                       return -1;
+               }
+               qnum = sc->tx.hwq_map[haltype];
+               break;
+       case ATH9K_TX_QUEUE_BEACON:
+               qnum = sc->beacon.beaconq;
+               break;
+       case ATH9K_TX_QUEUE_CAB:
+               qnum = sc->beacon.cabq->axq_qnum;
+               break;
+       default:
+               qnum = -1;
+       }
+       return qnum;
+}
+
+struct ath_txq *ath_test_get_txq(struct ath_softc *sc, struct sk_buff *skb)
+{
+       struct ath_txq *txq = NULL;
+       int qnum;
+
+       qnum = ath_get_hal_qnum(skb_get_queue_mapping(skb), sc);
+       txq = &sc->tx.txq[qnum];
+
+       spin_lock_bh(&txq->axq_lock);
+
+       if (txq->axq_depth >= (ATH_TXBUF - 20)) {
+               DPRINTF(sc, ATH_DBG_FATAL,
+                       "TX queue: %d is full, depth: %d\n",
+                       qnum, txq->axq_depth);
+               ieee80211_stop_queue(sc->hw, skb_get_queue_mapping(skb));
+               txq->stopped = 1;
+               spin_unlock_bh(&txq->axq_lock);
+               return NULL;
+       }
+
+       spin_unlock_bh(&txq->axq_lock);
+
+       return txq;
+}
+
+int ath_txq_update(struct ath_softc *sc, int qnum,
+                  struct ath9k_tx_queue_info *qinfo)
+{
+       struct ath_hw *ah = sc->sc_ah;
+       int error = 0;
+       struct ath9k_tx_queue_info qi;
+
+       if (qnum == sc->beacon.beaconq) {
+               /*
+                * XXX: for beacon queue, we just save the parameter.
+                * It will be picked up by ath_beaconq_config when
+                * it's necessary.
+                */
+               sc->beacon.beacon_qi = *qinfo;
+               return 0;
+       }
+
+       ASSERT(sc->tx.txq[qnum].axq_qnum == qnum);
+
+       ath9k_hw_get_txq_props(ah, qnum, &qi);
+       qi.tqi_aifs = qinfo->tqi_aifs;
+       qi.tqi_cwmin = qinfo->tqi_cwmin;
+       qi.tqi_cwmax = qinfo->tqi_cwmax;
+       qi.tqi_burstTime = qinfo->tqi_burstTime;
+       qi.tqi_readyTime = qinfo->tqi_readyTime;
+
+       if (!ath9k_hw_set_txq_props(ah, qnum, &qi)) {
+               DPRINTF(sc, ATH_DBG_FATAL,
+                       "Unable to update hardware queue %u!\n", qnum);
+               error = -EIO;
+       } else {
+               ath9k_hw_resettxqueue(ah, qnum);
+       }
+
+       return error;
+}
+
+int ath_cabq_update(struct ath_softc *sc)
+{
+       struct ath9k_tx_queue_info qi;
+       int qnum = sc->beacon.cabq->axq_qnum;
+       struct ath_beacon_config conf;
+
+       ath9k_hw_get_txq_props(sc->sc_ah, qnum, &qi);
+       /*
+        * Ensure the readytime % is within the bounds.
+        */
+       if (sc->config.cabqReadytime < ATH9K_READY_TIME_LO_BOUND)
+               sc->config.cabqReadytime = ATH9K_READY_TIME_LO_BOUND;
+       else if (sc->config.cabqReadytime > ATH9K_READY_TIME_HI_BOUND)
+               sc->config.cabqReadytime = ATH9K_READY_TIME_HI_BOUND;
+
+       ath_get_beaconconfig(sc, ATH_IF_ID_ANY, &conf);
+       qi.tqi_readyTime =
+               (conf.beacon_interval * sc->config.cabqReadytime) / 100;
+       ath_txq_update(sc, qnum, &qi);
+
+       return 0;
+}
+
+/*
+ * Drain a given TX queue (could be Beacon or Data)
+ *
+ * This assumes output has been stopped and
+ * we do not need to block ath_tx_tasklet.
+ */
+void ath_draintxq(struct ath_softc *sc, struct ath_txq *txq, bool retry_tx)
+{
+       struct ath_buf *bf, *lastbf;
+       struct list_head bf_head;
+
+       INIT_LIST_HEAD(&bf_head);
+
+       for (;;) {
+               spin_lock_bh(&txq->axq_lock);
+
+               if (list_empty(&txq->axq_q)) {
+                       txq->axq_link = NULL;
+                       txq->axq_linkbuf = NULL;
+                       spin_unlock_bh(&txq->axq_lock);
+                       break;
+               }
+
+               bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
+
+               if (bf->bf_status & ATH_BUFSTATUS_STALE) {
+                       list_del(&bf->list);
+                       spin_unlock_bh(&txq->axq_lock);
+
+                       spin_lock_bh(&sc->tx.txbuflock);
+                       list_add_tail(&bf->list, &sc->tx.txbuf);
+                       spin_unlock_bh(&sc->tx.txbuflock);
+                       continue;
+               }
+
+               lastbf = bf->bf_lastbf;
+               if (!retry_tx)
+                       lastbf->bf_desc->ds_txstat.ts_flags =
+                               ATH9K_TX_SW_ABORTED;
+
+               /* remove ath_buf's of the same mpdu from txq */
+               list_cut_position(&bf_head, &txq->axq_q, &lastbf->list);
+               txq->axq_depth--;
+
+               spin_unlock_bh(&txq->axq_lock);
+
+               if (bf_isampdu(bf))
+                       ath_tx_complete_aggr(sc, txq, bf, &bf_head, 0);
+               else
+                       ath_tx_complete_buf(sc, bf, &bf_head, 0, 0);
+       }
+
+       /* flush any pending frames if aggregation is enabled */
+       if (sc->sc_flags & SC_OP_TXAGGR) {
+               if (!retry_tx) {
+                       spin_lock_bh(&txq->axq_lock);
+                       ath_txq_drain_pending_buffers(sc, txq);
+                       spin_unlock_bh(&txq->axq_lock);
+               }
+       }
+}
+
+void ath_drain_all_txq(struct ath_softc *sc, bool retry_tx)
+{
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath_txq *txq;
+       int i, npend = 0;
+
+       if (sc->sc_flags & SC_OP_INVALID)
+               return;
+
+       /* Stop beacon queue */
+       ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
+
+       /* Stop data queues */
+       for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
+               if (ATH_TXQ_SETUP(sc, i)) {
+                       txq = &sc->tx.txq[i];
+                       ath9k_hw_stoptxdma(ah, txq->axq_qnum);
+                       npend += ath9k_hw_numtxpending(ah, txq->axq_qnum);
+               }
+       }
+
+       if (npend) {
+               int r;
+
+               DPRINTF(sc, ATH_DBG_XMIT, "Unable to stop TxDMA. Reset HAL!\n");
+
+               spin_lock_bh(&sc->sc_resetlock);
+               r = ath9k_hw_reset(ah, sc->sc_ah->curchan, true);
+               if (r)
+                       DPRINTF(sc, ATH_DBG_FATAL,
+                               "Unable to reset hardware; reset status %u\n",
+                               r);
+               spin_unlock_bh(&sc->sc_resetlock);
+       }
+
+       for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
+               if (ATH_TXQ_SETUP(sc, i))
+                       ath_draintxq(sc, &sc->tx.txq[i], retry_tx);
+       }
+}
+
+void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq)
+{
+       ath9k_hw_releasetxqueue(sc->sc_ah, txq->axq_qnum);
+       sc->tx.txqsetup &= ~(1<<txq->axq_qnum);
+}
+
+void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
+{
+       struct ath_atx_ac *ac;
+       struct ath_atx_tid *tid;
+
+       if (list_empty(&txq->axq_acq))
+               return;
+
+       ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, list);
+       list_del(&ac->list);
+       ac->sched = false;
+
+       do {
+               if (list_empty(&ac->tid_q))
+                       return;
+
+               tid = list_first_entry(&ac->tid_q, struct ath_atx_tid, list);
+               list_del(&tid->list);
+               tid->sched = false;
+
+               if (tid->paused)
+                       continue;
+
+               if ((txq->axq_depth % 2) == 0)
+                       ath_tx_sched_aggr(sc, txq, tid);
+
+               /*
+                * add tid to round-robin queue if more frames
+                * are pending for the tid
+                */
+               if (!list_empty(&tid->buf_q))
+                       ath_tx_queue_tid(txq, tid);
+
+               break;
+       } while (!list_empty(&ac->tid_q));
+
+       if (!list_empty(&ac->tid_q)) {
+               if (!ac->sched) {
+                       ac->sched = true;
+                       list_add_tail(&ac->list, &txq->axq_acq);
+               }
+       }
+}
+
+int ath_tx_setup(struct ath_softc *sc, int haltype)
+{
+       struct ath_txq *txq;
+
+       if (haltype >= ARRAY_SIZE(sc->tx.hwq_map)) {
+               DPRINTF(sc, ATH_DBG_FATAL,
+                       "HAL AC %u out of range, max %zu!\n",
+                        haltype, ARRAY_SIZE(sc->tx.hwq_map));
+               return 0;
+       }
+       txq = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, haltype);
+       if (txq != NULL) {
+               sc->tx.hwq_map[haltype] = txq->axq_qnum;
+               return 1;
+       } else
+               return 0;
+}
+
+/***********/
+/* TX, DMA */
+/***********/
+
+/*
+ * Insert a chain of ath_buf (descriptors) on a txq and
+ * assume the descriptors are already chained together by caller.
+ */
+static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
+                            struct list_head *head)
+{
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath_buf *bf;
+
+       /*
+        * Insert the frame on the outbound list and
+        * pass it on to the hardware.
+        */
+
+       if (list_empty(head))
+               return;
+
+       bf = list_first_entry(head, struct ath_buf, list);
+
+       list_splice_tail_init(head, &txq->axq_q);
+       txq->axq_depth++;
+       txq->axq_totalqueued++;
+       txq->axq_linkbuf = list_entry(txq->axq_q.prev, struct ath_buf, list);
+
+       DPRINTF(sc, ATH_DBG_QUEUE,
+               "qnum: %d, txq depth: %d\n", txq->axq_qnum, txq->axq_depth);
+
+       if (txq->axq_link == NULL) {
+               ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
+               DPRINTF(sc, ATH_DBG_XMIT,
+                       "TXDP[%u] = %llx (%p)\n",
+                       txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
+       } else {
+               *txq->axq_link = bf->bf_daddr;
+               DPRINTF(sc, ATH_DBG_XMIT, "link[%u] (%p)=%llx (%p)\n",
+                       txq->axq_qnum, txq->axq_link,
+                       ito64(bf->bf_daddr), bf->bf_desc);
+       }
+       txq->axq_link = &(bf->bf_lastbf->bf_desc->ds_link);
+       ath9k_hw_txstart(ah, txq->axq_qnum);
+}
+
+static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc)
+{
+       struct ath_buf *bf = NULL;
+
+       spin_lock_bh(&sc->tx.txbuflock);
+
+       if (unlikely(list_empty(&sc->tx.txbuf))) {
+               spin_unlock_bh(&sc->tx.txbuflock);
+               return NULL;
+       }
+
+       bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
+       list_del(&bf->list);
+
+       spin_unlock_bh(&sc->tx.txbuflock);
+
+       return bf;
+}
+
+static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
+                             struct list_head *bf_head,
+                             struct ath_tx_control *txctl)
+{
+       struct ath_buf *bf;
+
+       bf = list_first_entry(bf_head, struct ath_buf, list);
+       bf->bf_state.bf_type |= BUF_AMPDU;
+
+       /*
+        * Do not queue to h/w when any of the following conditions is true:
+        * - there are pending frames in software queue
+        * - the TID is currently paused for ADDBA/BAR request
+        * - seqno is not within block-ack window
+        * - h/w queue depth exceeds low water mark
+        */
+       if (!list_empty(&tid->buf_q) || tid->paused ||
+           !BAW_WITHIN(tid->seq_start, tid->baw_size, bf->bf_seqno) ||
+           txctl->txq->axq_depth >= ATH_AGGR_MIN_QDEPTH) {
+               /*
+                * Add this frame to software queue for scheduling later
+                * for aggregation.
+                */
+               list_move_tail(&bf->list, &tid->buf_q);
+               ath_tx_queue_tid(txctl->txq, tid);
+               return;
+       }
+
+       /* Add sub-frame to BAW */
+       ath_tx_addto_baw(sc, tid, bf);
+
+       /* Queue to h/w without aggregation */
+       bf->bf_nframes = 1;
+       bf->bf_lastbf = bf;
+       ath_buf_set_rate(sc, bf);
+       ath_tx_txqaddbuf(sc, txctl->txq, bf_head);
+}
+
+static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
+                              struct ath_atx_tid *tid,
+                              struct list_head *bf_head)
+{
+       struct ath_buf *bf;
+
+       bf = list_first_entry(bf_head, struct ath_buf, list);
+       bf->bf_state.bf_type &= ~BUF_AMPDU;
+
+       /* update starting sequence number for subsequent ADDBA request */
+       INCR(tid->seq_start, IEEE80211_SEQ_MAX);
+
+       bf->bf_nframes = 1;
+       bf->bf_lastbf = bf;
+       ath_buf_set_rate(sc, bf);
+       ath_tx_txqaddbuf(sc, txq, bf_head);
+}
+
+static enum ath9k_pkt_type get_hw_packet_type(struct sk_buff *skb)
+{
+       struct ieee80211_hdr *hdr;
+       enum ath9k_pkt_type htype;
+       __le16 fc;
+
+       hdr = (struct ieee80211_hdr *)skb->data;
+       fc = hdr->frame_control;
+
+       if (ieee80211_is_beacon(fc))
+               htype = ATH9K_PKT_TYPE_BEACON;
+       else if (ieee80211_is_probe_resp(fc))
+               htype = ATH9K_PKT_TYPE_PROBE_RESP;
+       else if (ieee80211_is_atim(fc))
+               htype = ATH9K_PKT_TYPE_ATIM;
+       else if (ieee80211_is_pspoll(fc))
+               htype = ATH9K_PKT_TYPE_PSPOLL;
+       else
+               htype = ATH9K_PKT_TYPE_NORMAL;
+
+       return htype;
+}
+
+static bool is_pae(struct sk_buff *skb)
+{
+       struct ieee80211_hdr *hdr;
+       __le16 fc;
+
+       hdr = (struct ieee80211_hdr *)skb->data;
+       fc = hdr->frame_control;
+
+       if (ieee80211_is_data(fc)) {
+               if (ieee80211_is_nullfunc(fc) ||
+                   /* Port Access Entity (IEEE 802.1X) */
+                   (skb->protocol == cpu_to_be16(ETH_P_PAE))) {
+                       return true;
+               }
+       }
+
+       return false;
+}
+
+static int get_hw_crypto_keytype(struct sk_buff *skb)
+{
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+
+       if (tx_info->control.hw_key) {
+               if (tx_info->control.hw_key->alg == ALG_WEP)
+                       return ATH9K_KEY_TYPE_WEP;
+               else if (tx_info->control.hw_key->alg == ALG_TKIP)
+                       return ATH9K_KEY_TYPE_TKIP;
+               else if (tx_info->control.hw_key->alg == ALG_CCMP)
+                       return ATH9K_KEY_TYPE_AES;
+       }
+
+       return ATH9K_KEY_TYPE_CLEAR;
+}
+
+static void assign_aggr_tid_seqno(struct sk_buff *skb,
+                                 struct ath_buf *bf)
+{
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_hdr *hdr;
+       struct ath_node *an;
+       struct ath_atx_tid *tid;
+       __le16 fc;
+       u8 *qc;
+
+       if (!tx_info->control.sta)
+               return;
+
+       an = (struct ath_node *)tx_info->control.sta->drv_priv;
+       hdr = (struct ieee80211_hdr *)skb->data;
+       fc = hdr->frame_control;
+
+       if (ieee80211_is_data_qos(fc)) {
+               qc = ieee80211_get_qos_ctl(hdr);
+               bf->bf_tidno = qc[0] & 0xf;
+       }
+
+       /*
+        * For HT capable stations, we save tidno for later use.
+        * We also override seqno set by upper layer with the one
+        * in tx aggregation state.
+        *
+        * If fragmentation is on, the sequence number is
+        * not overridden, since it has been
+        * incremented by the fragmentation routine.
+        *
+        * FIXME: check if the fragmentation threshold exceeds
+        * IEEE80211 max.
+        */
+       tid = ATH_AN_2_TID(an, bf->bf_tidno);
+       hdr->seq_ctrl = cpu_to_le16(tid->seq_next <<
+                       IEEE80211_SEQ_SEQ_SHIFT);
+       bf->bf_seqno = tid->seq_next;
+       INCR(tid->seq_next, IEEE80211_SEQ_MAX);
+}
+
+static int setup_tx_flags(struct ath_softc *sc, struct sk_buff *skb,
+                         struct ath_txq *txq)
+{
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+       int flags = 0;
+
+       flags |= ATH9K_TXDESC_CLRDMASK; /* needed for crypto errors */
+       flags |= ATH9K_TXDESC_INTREQ;
+
+       if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK)
+               flags |= ATH9K_TXDESC_NOACK;
+
+       return flags;
+}
+
+/*
+ * rix - rate index
+ * pktlen - total bytes (delims + data + fcs + pads + pad delims)
+ * width  - 0 for 20 MHz, 1 for 40 MHz
+ * half_gi - to use 4us v/s 3.6 us for symbol time
+ */
+static u32 ath_pkt_duration(struct ath_softc *sc, u8 rix, struct ath_buf *bf,
+                           int width, int half_gi, bool shortPreamble)
+{
+       struct ath_rate_table *rate_table = sc->cur_rate_table;
+       u32 nbits, nsymbits, duration, nsymbols;
+       u8 rc;
+       int streams, pktlen;
+
+       pktlen = bf_isaggr(bf) ? bf->bf_al : bf->bf_frmlen;
+       rc = rate_table->info[rix].ratecode;
+
+       /* for legacy rates, use old function to compute packet duration */
+       if (!IS_HT_RATE(rc))
+               return ath9k_hw_computetxtime(sc->sc_ah, rate_table, pktlen,
+                                             rix, shortPreamble);
+
+       /* find number of symbols: PLCP + data */
+       nbits = (pktlen << 3) + OFDM_PLCP_BITS;
+       nsymbits = bits_per_symbol[HT_RC_2_MCS(rc)][width];
+       nsymbols = (nbits + nsymbits - 1) / nsymbits;
+
+       if (!half_gi)
+               duration = SYMBOL_TIME(nsymbols);
+       else
+               duration = SYMBOL_TIME_HALFGI(nsymbols);
+
+       /* addup duration for legacy/ht training and signal fields */
+       streams = HT_RC_2_STREAMS(rc);
+       duration += L_STF + L_LTF + L_SIG + HT_SIG + HT_STF + HT_LTF(streams);
+
+       return duration;
+}
+
+static void ath_buf_set_rate(struct ath_softc *sc, struct ath_buf *bf)
+{
+       struct ath_rate_table *rt = sc->cur_rate_table;
+       struct ath9k_11n_rate_series series[4];
+       struct sk_buff *skb;
+       struct ieee80211_tx_info *tx_info;
+       struct ieee80211_tx_rate *rates;
+       struct ieee80211_hdr *hdr;
+       int i, flags = 0;
+       u8 rix = 0, ctsrate = 0;
+       bool is_pspoll;
+
+       memset(series, 0, sizeof(struct ath9k_11n_rate_series) * 4);
+
+       skb = (struct sk_buff *)bf->bf_mpdu;
+       tx_info = IEEE80211_SKB_CB(skb);
+       rates = tx_info->control.rates;
+       hdr = (struct ieee80211_hdr *)skb->data;
+       is_pspoll = ieee80211_is_pspoll(hdr->frame_control);
+
+       /*
+        * We check if Short Preamble is needed for the CTS rate by
+        * checking the BSS's global flag.
+        * But for the rate series, IEEE80211_TX_RC_USE_SHORT_PREAMBLE is used.
+        */
+       if (sc->sc_flags & SC_OP_PREAMBLE_SHORT)
+               ctsrate = rt->info[tx_info->control.rts_cts_rate_idx].ratecode |
+                       rt->info[tx_info->control.rts_cts_rate_idx].short_preamble;
+       else
+               ctsrate = rt->info[tx_info->control.rts_cts_rate_idx].ratecode;
 
-static void ath_tid_drain(struct ath_softc *sc,
-                         struct ath_txq *txq,
-                         struct ath_atx_tid *tid)
+       /*
+        * ATH9K_TXDESC_RTSENA and ATH9K_TXDESC_CTSENA are mutually exclusive.
+        * Check the first rate in the series to decide whether RTS/CTS
+        * or CTS-to-self has to be used.
+        */
+       if (rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
+               flags = ATH9K_TXDESC_CTSENA;
+       else if (rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS)
+               flags = ATH9K_TXDESC_RTSENA;
 
-{
-       struct ath_buf *bf;
-       struct list_head bf_head;
-       INIT_LIST_HEAD(&bf_head);
+       /* FIXME: Handle aggregation protection */
+       if (sc->config.ath_aggr_prot &&
+           (!bf_isaggr(bf) || (bf_isaggr(bf) && bf->bf_al < 8192))) {
+               flags = ATH9K_TXDESC_RTSENA;
+       }
 
-       for (;;) {
-               if (list_empty(&tid->buf_q))
-                       break;
-               bf = list_first_entry(&tid->buf_q, struct ath_buf, list);
+       /* For AR5416 - RTS cannot be followed by a frame larger than 8K */
+       if (bf_isaggr(bf) && (bf->bf_al > sc->sc_ah->caps.rts_aggr_limit))
+               flags &= ~(ATH9K_TXDESC_RTSENA);
 
-               list_cut_position(&bf_head, &tid->buf_q, &bf->bf_lastfrm->list);
+       for (i = 0; i < 4; i++) {
+               if (!rates[i].count || (rates[i].idx < 0))
+                       continue;
 
-               /* update baw for software retried frame */
-               if (bf_isretried(bf))
-                       ath_tx_update_baw(sc, tid, bf->bf_seqno);
+               rix = rates[i].idx;
+               series[i].Tries = rates[i].count;
+               series[i].ChSel = sc->tx_chainmask;
 
-               /*
-                * do not indicate packets while holding txq spinlock.
-                * unlock is intentional here
-                */
-               spin_unlock(&txq->axq_lock);
+               if (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
+                       series[i].Rate = rt->info[rix].ratecode |
+                               rt->info[rix].short_preamble;
+               else
+                       series[i].Rate = rt->info[rix].ratecode;
 
-               /* complete this sub-frame */
-               ath_tx_complete_buf(sc, bf, &bf_head, 0, 0);
+               if (rates[i].flags & IEEE80211_TX_RC_USE_RTS_CTS)
+                       series[i].RateFlags |= ATH9K_RATESERIES_RTS_CTS;
+               if (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
+                       series[i].RateFlags |= ATH9K_RATESERIES_2040;
+               if (rates[i].flags & IEEE80211_TX_RC_SHORT_GI)
+                       series[i].RateFlags |= ATH9K_RATESERIES_HALFGI;
 
-               spin_lock(&txq->axq_lock);
+               series[i].PktDuration = ath_pkt_duration(sc, rix, bf,
+                        (rates[i].flags & IEEE80211_TX_RC_40_MHZ_WIDTH) != 0,
+                        (rates[i].flags & IEEE80211_TX_RC_SHORT_GI),
+                        (rates[i].flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE));
        }
 
-       /*
-        * TODO: For frame(s) that are in the retry state, we will reuse the
-        * sequence number(s) without setting the retry bit. The
-        * alternative is to give up on these and BAR the receiver's window
-        * forward.
-        */
-       tid->seq_next = tid->seq_start;
-       tid->baw_tail = tid->baw_head;
-}
-
-/*
- * Drain all pending buffers
- * NB: must be called with txq lock held
- */
-static void ath_txq_drain_pending_buffers(struct ath_softc *sc,
-                                         struct ath_txq *txq)
-{
-       struct ath_atx_ac *ac, *ac_tmp;
-       struct ath_atx_tid *tid, *tid_tmp;
+       /* set dur_update_en for l-sig computation except for PS-Poll frames */
+       ath9k_hw_set11n_ratescenario(sc->sc_ah, bf->bf_desc,
+                                    bf->bf_lastbf->bf_desc,
+                                    !is_pspoll, ctsrate,
+                                    0, series, 4, flags);
 
-       list_for_each_entry_safe(ac, ac_tmp, &txq->axq_acq, list) {
-               list_del(&ac->list);
-               ac->sched = false;
-               list_for_each_entry_safe(tid, tid_tmp, &ac->tid_q, list) {
-                       list_del(&tid->list);
-                       tid->sched = false;
-                       ath_tid_drain(sc, txq, tid);
-               }
-       }
+       if (sc->config.ath_aggr_prot && flags)
+               ath9k_hw_set11n_burstduration(sc->sc_ah, bf->bf_desc, 8192);
 }
 
 static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf,
@@ -1671,33 +1536,15 @@ static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf,
 
        ATH_TXBUF_RESET(bf);
 
-       /* Frame type */
-
        bf->bf_frmlen = skb->len + FCS_LEN - (hdrlen & 3);
 
-       ieee80211_is_data(fc) ?
-               (bf->bf_state.bf_type |= BUF_DATA) :
-               (bf->bf_state.bf_type &= ~BUF_DATA);
-       ieee80211_is_back_req(fc) ?
-               (bf->bf_state.bf_type |= BUF_BAR) :
-               (bf->bf_state.bf_type &= ~BUF_BAR);
-       ieee80211_is_pspoll(fc) ?
-               (bf->bf_state.bf_type |= BUF_PSPOLL) :
-               (bf->bf_state.bf_type &= ~BUF_PSPOLL);
-       (sc->sc_flags & SC_OP_PREAMBLE_SHORT) ?
-               (bf->bf_state.bf_type |= BUF_SHORT_PREAMBLE) :
-               (bf->bf_state.bf_type &= ~BUF_SHORT_PREAMBLE);
-       (sc->hw->conf.ht.enabled && !is_pae(skb) &&
-        (tx_info->flags & IEEE80211_TX_CTL_AMPDU)) ?
-               (bf->bf_state.bf_type |= BUF_HT) :
-               (bf->bf_state.bf_type &= ~BUF_HT);
+       if ((conf_is_ht(&sc->hw->conf) && !is_pae(skb) &&
+            (tx_info->flags & IEEE80211_TX_CTL_AMPDU)))
+               bf->bf_state.bf_type |= BUF_HT;
 
        bf->bf_flags = setup_tx_flags(sc, skb, txctl->txq);
 
-       /* Crypto */
-
        bf->bf_keytype = get_hw_crypto_keytype(skb);
-
        if (bf->bf_keytype != ATH9K_KEY_TYPE_CLEAR) {
                bf->bf_frmlen += tx_info->control.hw_key->icv_len;
                bf->bf_keyix = tx_info->control.hw_key->hw_key_idx;
@@ -1705,20 +1552,17 @@ static int ath_tx_setup_buffer(struct ath_softc *sc, struct ath_buf *bf,
                bf->bf_keyix = ATH9K_TXKEYIX_INVALID;
        }
 
-       /* Assign seqno, tidno */
-
        if (ieee80211_is_data_qos(fc) && (sc->sc_flags & SC_OP_TXAGGR))
                assign_aggr_tid_seqno(skb, bf);
 
-       /* DMA setup */
        bf->bf_mpdu = skb;
 
-       bf->bf_dmacontext = pci_map_single(sc->pdev, skb->data,
-                                          skb->len, PCI_DMA_TODEVICE);
-       if (unlikely(pci_dma_mapping_error(sc->pdev, bf->bf_dmacontext))) {
+       bf->bf_dmacontext = dma_map_single(sc->dev, skb->data,
+                                          skb->len, DMA_TO_DEVICE);
+       if (unlikely(dma_mapping_error(sc->dev, bf->bf_dmacontext))) {
                bf->bf_mpdu = NULL;
                DPRINTF(sc, ATH_DBG_CONFIG,
-                       "pci_dma_mapping_error() on TX\n");
+                       "dma_mapping_error() on TX\n");
                return -ENOMEM;
        }
 
@@ -1736,7 +1580,7 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
        struct list_head bf_head;
        struct ath_desc *ds;
        struct ath_atx_tid *tid;
-       struct ath_hal *ah = sc->sc_ah;
+       struct ath_hw *ah = sc->sc_ah;
        int frm_type;
 
        frm_type = get_hw_packet_type(skb);
@@ -1744,14 +1588,10 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
        INIT_LIST_HEAD(&bf_head);
        list_add_tail(&bf->list, &bf_head);
 
-       /* setup descriptor */
-
        ds = bf->bf_desc;
        ds->ds_link = 0;
        ds->ds_data = bf->bf_buf_addr;
 
-       /* Formulate first tx descriptor with tx controls */
-
        ath9k_hw_set11n_txdesc(ah, ds, bf->bf_frmlen, frm_type, MAX_RATE_POWER,
                               bf->bf_keyix, bf->bf_keytype, bf->bf_flags);
 
@@ -1761,8 +1601,6 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct ath_buf *bf,
                            true,       /* last segment */
                            ds);        /* first descriptor */
 
-       bf->bf_lastfrm = bf;
-
        spin_lock_bh(&txctl->txq->axq_lock);
 
        if (bf_isht(bf) && (sc->sc_flags & SC_OP_TXAGGR) &&
@@ -1802,8 +1640,6 @@ int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb,
        struct ath_buf *bf;
        int r;
 
-       /* Check if a tx buffer is available */
-
        bf = ath_tx_get_buffer(sc);
        if (!bf) {
                DPRINTF(sc, ATH_DBG_XMIT, "TX buffers are full\n");
@@ -1840,580 +1676,396 @@ int ath_tx_start(struct ath_softc *sc, struct sk_buff *skb,
        return 0;
 }
 
-/* Initialize TX queue and h/w */
-
-int ath_tx_init(struct ath_softc *sc, int nbufs)
+void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb)
 {
-       int error = 0;
+       int hdrlen, padsize;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ath_tx_control txctl;
 
-       do {
-               spin_lock_init(&sc->tx.txbuflock);
+       memset(&txctl, 0, sizeof(struct ath_tx_control));
 
-               /* Setup tx descriptors */
-               error = ath_descdma_setup(sc, &sc->tx.txdma, &sc->tx.txbuf,
-                       "tx", nbufs, 1);
-               if (error != 0) {
-                       DPRINTF(sc, ATH_DBG_FATAL,
-                               "Failed to allocate tx descriptors: %d\n",
-                               error);
-                       break;
-               }
+       /*
+        * As a temporary workaround, assign seq# here; this will likely need
+        * to be cleaned up to work better with Beacon transmission and virtual
+        * BSSes.
+        */
+       if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
+               struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+               if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
+                       sc->tx.seq_no += 0x10;
+               hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+               hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no);
+       }
 
-               /* XXX allocate beacon state together with vap */
-               error = ath_descdma_setup(sc, &sc->beacon.bdma, &sc->beacon.bbuf,
-                                         "beacon", ATH_BCBUF, 1);
-               if (error != 0) {
-                       DPRINTF(sc, ATH_DBG_FATAL,
-                               "Failed to allocate beacon descriptors: %d\n",
-                               error);
-                       break;
+       /* Add the padding after the header if this is not already done */
+       hdrlen = ieee80211_get_hdrlen_from_skb(skb);
+       if (hdrlen & 3) {
+               padsize = hdrlen % 4;
+               if (skb_headroom(skb) < padsize) {
+                       DPRINTF(sc, ATH_DBG_XMIT, "TX CABQ padding failed\n");
+                       dev_kfree_skb_any(skb);
+                       return;
                }
+               skb_push(skb, padsize);
+               memmove(skb->data, skb->data + padsize, hdrlen);
+       }
 
-       } while (0);
-
-       if (error != 0)
-               ath_tx_cleanup(sc);
-
-       return error;
-}
-
-/* Reclaim all tx queue resources */
-
-int ath_tx_cleanup(struct ath_softc *sc)
-{
-       /* cleanup beacon descriptors */
-       if (sc->beacon.bdma.dd_desc_len != 0)
-               ath_descdma_cleanup(sc, &sc->beacon.bdma, &sc->beacon.bbuf);
-
-       /* cleanup tx descriptors */
-       if (sc->tx.txdma.dd_desc_len != 0)
-               ath_descdma_cleanup(sc, &sc->tx.txdma, &sc->tx.txbuf);
-
-       return 0;
-}
-
-/* Setup a h/w transmit queue */
-
-struct ath_txq *ath_txq_setup(struct ath_softc *sc, int qtype, int subtype)
-{
-       struct ath_hal *ah = sc->sc_ah;
-       struct ath9k_tx_queue_info qi;
-       int qnum;
+       txctl.txq = sc->beacon.cabq;
 
-       memset(&qi, 0, sizeof(qi));
-       qi.tqi_subtype = subtype;
-       qi.tqi_aifs = ATH9K_TXQ_USEDEFAULT;
-       qi.tqi_cwmin = ATH9K_TXQ_USEDEFAULT;
-       qi.tqi_cwmax = ATH9K_TXQ_USEDEFAULT;
-       qi.tqi_physCompBuf = 0;
+       DPRINTF(sc, ATH_DBG_XMIT, "transmitting CABQ packet, skb: %p\n", skb);
 
-       /*
-        * Enable interrupts only for EOL and DESC conditions.
-        * We mark tx descriptors to receive a DESC interrupt
-        * when a tx queue gets deep; otherwise waiting for the
-        * EOL to reap descriptors.  Note that this is done to
-        * reduce interrupt load and this only defers reaping
-        * descriptors, never transmitting frames.  Aside from
-        * reducing interrupts this also permits more concurrency.
-        * The only potential downside is if the tx queue backs
-        * up in which case the top half of the kernel may backup
-        * due to a lack of tx descriptors.
-        *
-        * The UAPSD queue is an exception, since we take a desc-
-        * based intr on the EOSP frames.
-        */
-       if (qtype == ATH9K_TX_QUEUE_UAPSD)
-               qi.tqi_qflags = TXQ_FLAG_TXDESCINT_ENABLE;
-       else
-               qi.tqi_qflags = TXQ_FLAG_TXEOLINT_ENABLE |
-                       TXQ_FLAG_TXDESCINT_ENABLE;
-       qnum = ath9k_hw_setuptxqueue(ah, qtype, &qi);
-       if (qnum == -1) {
-               /*
-                * NB: don't print a message, this happens
-                * normally on parts with too few tx queues
-                */
-               return NULL;
-       }
-       if (qnum >= ARRAY_SIZE(sc->tx.txq)) {
-               DPRINTF(sc, ATH_DBG_FATAL,
-                       "qnum %u out of range, max %u!\n",
-                       qnum, (unsigned int)ARRAY_SIZE(sc->tx.txq));
-               ath9k_hw_releasetxqueue(ah, qnum);
-               return NULL;
+       if (ath_tx_start(sc, skb, &txctl) != 0) {
+               DPRINTF(sc, ATH_DBG_XMIT, "CABQ TX failed\n");
+               goto exit;
        }
-       if (!ATH_TXQ_SETUP(sc, qnum)) {
-               struct ath_txq *txq = &sc->tx.txq[qnum];
 
-               txq->axq_qnum = qnum;
-               txq->axq_link = NULL;
-               INIT_LIST_HEAD(&txq->axq_q);
-               INIT_LIST_HEAD(&txq->axq_acq);
-               spin_lock_init(&txq->axq_lock);
-               txq->axq_depth = 0;
-               txq->axq_aggr_depth = 0;
-               txq->axq_totalqueued = 0;
-               txq->axq_linkbuf = NULL;
-               sc->tx.txqsetup |= 1<<qnum;
-       }
-       return &sc->tx.txq[qnum];
+       return;
+exit:
+       dev_kfree_skb_any(skb);
 }
 
-/* Reclaim resources for a setup queue */
+/*****************/
+/* TX Completion */
+/*****************/
 
-void ath_tx_cleanupq(struct ath_softc *sc, struct ath_txq *txq)
+static void ath_tx_complete(struct ath_softc *sc, struct sk_buff *skb,
+                           struct ath_xmit_status *tx_status)
 {
-       ath9k_hw_releasetxqueue(sc->sc_ah, txq->axq_qnum);
-       sc->tx.txqsetup &= ~(1<<txq->axq_qnum);
-}
-
-/*
- * Setup a hardware data transmit queue for the specified
- * access control.  The hal may not support all requested
- * queues in which case it will return a reference to a
- * previously setup queue.  We record the mapping from ac's
- * to h/w queues for use by ath_tx_start and also track
- * the set of h/w queues being used to optimize work in the
- * transmit interrupt handler and related routines.
- */
+       struct ieee80211_hw *hw = sc->hw;
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+       struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
+       int hdrlen, padsize;
 
-int ath_tx_setup(struct ath_softc *sc, int haltype)
-{
-       struct ath_txq *txq;
+       DPRINTF(sc, ATH_DBG_XMIT, "TX complete: skb: %p\n", skb);
 
-       if (haltype >= ARRAY_SIZE(sc->tx.hwq_map)) {
-               DPRINTF(sc, ATH_DBG_FATAL,
-                       "HAL AC %u out of range, max %zu!\n",
-                        haltype, ARRAY_SIZE(sc->tx.hwq_map));
-               return 0;
+       if (tx_info->flags & IEEE80211_TX_CTL_NO_ACK ||
+           tx_info->flags & IEEE80211_TX_STAT_TX_FILTERED) {
+               kfree(tx_info_priv);
+               tx_info->rate_driver_data[0] = NULL;
        }
-       txq = ath_txq_setup(sc, ATH9K_TX_QUEUE_DATA, haltype);
-       if (txq != NULL) {
-               sc->tx.hwq_map[haltype] = txq->axq_qnum;
-               return 1;
-       } else
-               return 0;
-}
-
-int ath_tx_get_qnum(struct ath_softc *sc, int qtype, int haltype)
-{
-       int qnum;
-
-       switch (qtype) {
-       case ATH9K_TX_QUEUE_DATA:
-               if (haltype >= ARRAY_SIZE(sc->tx.hwq_map)) {
-                       DPRINTF(sc, ATH_DBG_FATAL,
-                               "HAL AC %u out of range, max %zu!\n",
-                               haltype, ARRAY_SIZE(sc->tx.hwq_map));
-                       return -1;
-               }
-               qnum = sc->tx.hwq_map[haltype];
-               break;
-       case ATH9K_TX_QUEUE_BEACON:
-               qnum = sc->beacon.beaconq;
-               break;
-       case ATH9K_TX_QUEUE_CAB:
-               qnum = sc->beacon.cabq->axq_qnum;
-               break;
-       default:
-               qnum = -1;
+
+       if (tx_status->flags & ATH_TX_BAR) {
+               tx_info->flags |= IEEE80211_TX_STAT_AMPDU_NO_BACK;
+               tx_status->flags &= ~ATH_TX_BAR;
+       }
+
+       if (!(tx_status->flags & (ATH_TX_ERROR | ATH_TX_XRETRY))) {
+               /* Frame was ACKed */
+               tx_info->flags |= IEEE80211_TX_STAT_ACK;
        }
-       return qnum;
-}
 
-/* Get a transmit queue, if available */
+       tx_info->status.rates[0].count = tx_status->retries + 1;
 
-struct ath_txq *ath_test_get_txq(struct ath_softc *sc, struct sk_buff *skb)
+       hdrlen = ieee80211_get_hdrlen_from_skb(skb);
+       padsize = hdrlen & 3;
+       if (padsize && hdrlen >= 24) {
+               /*
+                * Remove MAC header padding before giving the frame back to
+                * mac80211.
+                */
+               memmove(skb->data + padsize, skb->data, hdrlen);
+               skb_pull(skb, padsize);
+       }
+
+       ieee80211_tx_status(hw, skb);
+}
+
+static void ath_tx_complete_buf(struct ath_softc *sc, struct ath_buf *bf,
+                               struct list_head *bf_q,
+                               int txok, int sendbar)
 {
-       struct ath_txq *txq = NULL;
-       int qnum;
+       struct sk_buff *skb = bf->bf_mpdu;
+       struct ath_xmit_status tx_status;
+       unsigned long flags;
 
-       qnum = ath_get_hal_qnum(skb_get_queue_mapping(skb), sc);
-       txq = &sc->tx.txq[qnum];
+       /*
+        * Set retry information.
+        * NB: Don't use the information in the descriptor, because the frame
+        * could be software retried.
+        */
+       tx_status.retries = bf->bf_retries;
+       tx_status.flags = 0;
 
-       spin_lock_bh(&txq->axq_lock);
+       if (sendbar)
+               tx_status.flags = ATH_TX_BAR;
 
-       /* Try to avoid running out of descriptors */
-       if (txq->axq_depth >= (ATH_TXBUF - 20)) {
-               DPRINTF(sc, ATH_DBG_FATAL,
-                       "TX queue: %d is full, depth: %d\n",
-                       qnum, txq->axq_depth);
-               ieee80211_stop_queue(sc->hw, skb_get_queue_mapping(skb));
-               txq->stopped = 1;
-               spin_unlock_bh(&txq->axq_lock);
-               return NULL;
+       if (!txok) {
+               tx_status.flags |= ATH_TX_ERROR;
+
+               if (bf_isxretried(bf))
+                       tx_status.flags |= ATH_TX_XRETRY;
        }
 
-       spin_unlock_bh(&txq->axq_lock);
+       dma_unmap_single(sc->dev, bf->bf_dmacontext, skb->len, DMA_TO_DEVICE);
+       ath_tx_complete(sc, skb, &tx_status);
 
-       return txq;
+       /*
+        * Return the list of ath_buf of this mpdu to free queue
+        */
+       spin_lock_irqsave(&sc->tx.txbuflock, flags);
+       list_splice_tail_init(bf_q, &sc->tx.txbuf);
+       spin_unlock_irqrestore(&sc->tx.txbuflock, flags);
 }
 
-/* Update parameters for a transmit queue */
-
-int ath_txq_update(struct ath_softc *sc, int qnum,
-                  struct ath9k_tx_queue_info *qinfo)
+static int ath_tx_num_badfrms(struct ath_softc *sc, struct ath_buf *bf,
+                             int txok)
 {
-       struct ath_hal *ah = sc->sc_ah;
-       int error = 0;
-       struct ath9k_tx_queue_info qi;
+       struct ath_buf *bf_last = bf->bf_lastbf;
+       struct ath_desc *ds = bf_last->bf_desc;
+       u16 seq_st = 0;
+       u32 ba[WME_BA_BMP_SIZE >> 5];
+       int ba_index;
+       int nbad = 0;
+       int isaggr = 0;
 
-       if (qnum == sc->beacon.beaconq) {
-               /*
-                * XXX: for beacon queue, we just save the parameter.
-                * It will be picked up by ath_beaconq_config when
-                * it's necessary.
-                */
-               sc->beacon.beacon_qi = *qinfo;
+       if (ds->ds_txstat.ts_flags == ATH9K_TX_SW_ABORTED)
                return 0;
-       }
 
-       ASSERT(sc->tx.txq[qnum].axq_qnum == qnum);
+       isaggr = bf_isaggr(bf);
+       if (isaggr) {
+               seq_st = ATH_DS_BA_SEQ(ds);
+               memcpy(ba, ATH_DS_BA_BITMAP(ds), WME_BA_BMP_SIZE >> 3);
+       }
 
-       ath9k_hw_get_txq_props(ah, qnum, &qi);
-       qi.tqi_aifs = qinfo->tqi_aifs;
-       qi.tqi_cwmin = qinfo->tqi_cwmin;
-       qi.tqi_cwmax = qinfo->tqi_cwmax;
-       qi.tqi_burstTime = qinfo->tqi_burstTime;
-       qi.tqi_readyTime = qinfo->tqi_readyTime;
+       while (bf) {
+               ba_index = ATH_BA_INDEX(seq_st, bf->bf_seqno);
+               if (!txok || (isaggr && !ATH_BA_ISSET(ba, ba_index)))
+                       nbad++;
 
-       if (!ath9k_hw_set_txq_props(ah, qnum, &qi)) {
-               DPRINTF(sc, ATH_DBG_FATAL,
-                       "Unable to update hardware queue %u!\n", qnum);
-               error = -EIO;
-       } else {
-               ath9k_hw_resettxqueue(ah, qnum); /* push to h/w */
+               bf = bf->bf_next;
        }
 
-       return error;
+       return nbad;
 }
 
-int ath_cabq_update(struct ath_softc *sc)
+static void ath_tx_rc_status(struct ath_buf *bf, struct ath_desc *ds, int nbad)
 {
-       struct ath9k_tx_queue_info qi;
-       int qnum = sc->beacon.cabq->axq_qnum;
-       struct ath_beacon_config conf;
-
-       ath9k_hw_get_txq_props(sc->sc_ah, qnum, &qi);
-       /*
-        * Ensure the readytime % is within the bounds.
-        */
-       if (sc->sc_config.cabqReadytime < ATH9K_READY_TIME_LO_BOUND)
-               sc->sc_config.cabqReadytime = ATH9K_READY_TIME_LO_BOUND;
-       else if (sc->sc_config.cabqReadytime > ATH9K_READY_TIME_HI_BOUND)
-               sc->sc_config.cabqReadytime = ATH9K_READY_TIME_HI_BOUND;
+       struct sk_buff *skb = (struct sk_buff *)bf->bf_mpdu;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
+       struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info);
 
-       ath_get_beaconconfig(sc, ATH_IF_ID_ANY, &conf);
-       qi.tqi_readyTime =
-               (conf.beacon_interval * sc->sc_config.cabqReadytime) / 100;
-       ath_txq_update(sc, qnum, &qi);
+       tx_info_priv->update_rc = false;
+       if (ds->ds_txstat.ts_status & ATH9K_TXERR_FILT)
+               tx_info->flags |= IEEE80211_TX_STAT_TX_FILTERED;
 
-       return 0;
+       if ((ds->ds_txstat.ts_status & ATH9K_TXERR_FILT) == 0 &&
+           (bf->bf_flags & ATH9K_TXDESC_NOACK) == 0) {
+               if (ieee80211_is_data(hdr->frame_control)) {
+                       memcpy(&tx_info_priv->tx, &ds->ds_txstat,
+                              sizeof(tx_info_priv->tx));
+                       tx_info_priv->n_frames = bf->bf_nframes;
+                       tx_info_priv->n_bad_frames = nbad;
+                       tx_info_priv->update_rc = true;
+               }
+       }
 }
 
-/* Deferred processing of transmit interrupt */
-
-void ath_tx_tasklet(struct ath_softc *sc)
+static void ath_wake_mac80211_queue(struct ath_softc *sc, struct ath_txq *txq)
 {
-       int i;
-       u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1);
-
-       ath9k_hw_gettxintrtxqs(sc->sc_ah, &qcumask);
+       int qnum;
 
-       /*
-        * Process each active queue.
-        */
-       for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
-               if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i)))
-                       ath_tx_processq(sc, &sc->tx.txq[i]);
+       spin_lock_bh(&txq->axq_lock);
+       if (txq->stopped &&
+           ath_txq_depth(sc, txq->axq_qnum) <= (ATH_TXBUF - 20)) {
+               qnum = ath_get_mac80211_qnum(txq->axq_qnum, sc);
+               if (qnum != -1) {
+                       ieee80211_wake_queue(sc->hw, qnum);
+                       txq->stopped = 0;
+               }
        }
+       spin_unlock_bh(&txq->axq_lock);
 }
 
-void ath_tx_draintxq(struct ath_softc *sc,
-       struct ath_txq *txq, bool retry_tx)
+static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
 {
-       struct ath_buf *bf, *lastbf;
+       struct ath_hw *ah = sc->sc_ah;
+       struct ath_buf *bf, *lastbf, *bf_held = NULL;
        struct list_head bf_head;
+       struct ath_desc *ds;
+       int txok, nbad = 0;
+       int status;
 
-       INIT_LIST_HEAD(&bf_head);
+       DPRINTF(sc, ATH_DBG_QUEUE, "tx queue %d (%x), link %p\n",
+               txq->axq_qnum, ath9k_hw_gettxbuf(sc->sc_ah, txq->axq_qnum),
+               txq->axq_link);
 
-       /*
-        * NB: this assumes output has been stopped and
-        *     we do not need to block ath_tx_tasklet
-        */
        for (;;) {
                spin_lock_bh(&txq->axq_lock);
-
                if (list_empty(&txq->axq_q)) {
                        txq->axq_link = NULL;
                        txq->axq_linkbuf = NULL;
                        spin_unlock_bh(&txq->axq_lock);
                        break;
                }
-
                bf = list_first_entry(&txq->axq_q, struct ath_buf, list);
 
+               /*
+                * There is a race condition that a BH gets scheduled
+                * after sw writes TxE and before hw re-load the last
+                * descriptor to get the newly chained one.
+                * Software must keep the last DONE descriptor as a
+                * holding descriptor - software does so by marking
+                * it with the STALE flag.
+                */
+               bf_held = NULL;
                if (bf->bf_status & ATH_BUFSTATUS_STALE) {
-                       list_del(&bf->list);
-                       spin_unlock_bh(&txq->axq_lock);
-
-                       spin_lock_bh(&sc->tx.txbuflock);
-                       list_add_tail(&bf->list, &sc->tx.txbuf);
-                       spin_unlock_bh(&sc->tx.txbuflock);
-                       continue;
-               }
-
-               lastbf = bf->bf_lastbf;
-               if (!retry_tx)
-                       lastbf->bf_desc->ds_txstat.ts_flags =
-                               ATH9K_TX_SW_ABORTED;
-
-               /* remove ath_buf's of the same mpdu from txq */
-               list_cut_position(&bf_head, &txq->axq_q, &lastbf->list);
-               txq->axq_depth--;
-
-               spin_unlock_bh(&txq->axq_lock);
+                       bf_held = bf;
+                       if (list_is_last(&bf_held->list, &txq->axq_q)) {
+                               txq->axq_link = NULL;
+                               txq->axq_linkbuf = NULL;
+                               spin_unlock_bh(&txq->axq_lock);
 
-               if (bf_isampdu(bf))
-                       ath_tx_complete_aggr_rifs(sc, txq, bf, &bf_head, 0);
-               else
-                       ath_tx_complete_buf(sc, bf, &bf_head, 0, 0);
-       }
+                               /*
+                                * The holding descriptor is the last
+                                * descriptor in queue. It's safe to remove
+                                * the last holding descriptor in BH context.
+                                */
+                               spin_lock_bh(&sc->tx.txbuflock);
+                               list_move_tail(&bf_held->list, &sc->tx.txbuf);
+                               spin_unlock_bh(&sc->tx.txbuflock);
 
-       /* flush any pending frames if aggregation is enabled */
-       if (sc->sc_flags & SC_OP_TXAGGR) {
-               if (!retry_tx) {
-                       spin_lock_bh(&txq->axq_lock);
-                       ath_txq_drain_pending_buffers(sc, txq);
-                       spin_unlock_bh(&txq->axq_lock);
+                               break;
+                       } else {
+                               bf = list_entry(bf_held->list.next,
+                                               struct ath_buf, list);
+                       }
                }
-       }
-}
-
-/* Drain the transmit queues and reclaim resources */
-
-void ath_draintxq(struct ath_softc *sc, bool retry_tx)
-{
-       /* stop beacon queue. The beacon will be freed when
-        * we go to INIT state */
-       if (!(sc->sc_flags & SC_OP_INVALID)) {
-               (void) ath9k_hw_stoptxdma(sc->sc_ah, sc->beacon.beaconq);
-               DPRINTF(sc, ATH_DBG_XMIT, "beacon queue %x\n",
-                       ath9k_hw_gettxbuf(sc->sc_ah, sc->beacon.beaconq));
-       }
-
-       ath_drain_txdataq(sc, retry_tx);
-}
-
-u32 ath_txq_depth(struct ath_softc *sc, int qnum)
-{
-       return sc->tx.txq[qnum].axq_depth;
-}
-
-u32 ath_txq_aggr_depth(struct ath_softc *sc, int qnum)
-{
-       return sc->tx.txq[qnum].axq_aggr_depth;
-}
-
-bool ath_tx_aggr_check(struct ath_softc *sc, struct ath_node *an, u8 tidno)
-{
-       struct ath_atx_tid *txtid;
-
-       if (!(sc->sc_flags & SC_OP_TXAGGR))
-               return false;
 
-       txtid = ATH_AN_2_TID(an, tidno);
+               lastbf = bf->bf_lastbf;
+               ds = lastbf->bf_desc;
 
-       if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
-               if (!(txtid->state & AGGR_ADDBA_PROGRESS) &&
-                   (txtid->addba_exchangeattempts < ADDBA_EXCHANGE_ATTEMPTS)) {
-                       txtid->addba_exchangeattempts++;
-                       return true;
+               status = ath9k_hw_txprocdesc(ah, ds);
+               if (status == -EINPROGRESS) {
+                       spin_unlock_bh(&txq->axq_lock);
+                       break;
                }
-       }
+               if (bf->bf_desc == txq->axq_lastdsWithCTS)
+                       txq->axq_lastdsWithCTS = NULL;
+               if (ds == txq->axq_gatingds)
+                       txq->axq_gatingds = NULL;
 
-       return false;
-}
+               /*
+                * Remove ath_buf's of the same transmit unit from txq,
+                * however leave the last descriptor back as the holding
+                * descriptor for hw.
+                */
+               lastbf->bf_status |= ATH_BUFSTATUS_STALE;
+               INIT_LIST_HEAD(&bf_head);
+               if (!list_is_singular(&lastbf->list))
+                       list_cut_position(&bf_head,
+                               &txq->axq_q, lastbf->list.prev);
 
-/* Start TX aggregation */
+               txq->axq_depth--;
+               if (bf_isaggr(bf))
+                       txq->axq_aggr_depth--;
 
-int ath_tx_aggr_start(struct ath_softc *sc, struct ieee80211_sta *sta,
-                     u16 tid, u16 *ssn)
-{
-       struct ath_atx_tid *txtid;
-       struct ath_node *an;
+               txok = (ds->ds_txstat.ts_status == 0);
+               spin_unlock_bh(&txq->axq_lock);
 
-       an = (struct ath_node *)sta->drv_priv;
+               if (bf_held) {
+                       spin_lock_bh(&sc->tx.txbuflock);
+                       list_move_tail(&bf_held->list, &sc->tx.txbuf);
+                       spin_unlock_bh(&sc->tx.txbuflock);
+               }
 
-       if (sc->sc_flags & SC_OP_TXAGGR) {
-               txtid = ATH_AN_2_TID(an, tid);
-               txtid->state |= AGGR_ADDBA_PROGRESS;
-               ath_tx_pause_tid(sc, txtid);
-       }
+               if (!bf_isampdu(bf)) {
+                       /*
+                        * This frame is sent out as a single frame.
+                        * Use hardware retry status for this frame.
+                        */
+                       bf->bf_retries = ds->ds_txstat.ts_longretry;
+                       if (ds->ds_txstat.ts_status & ATH9K_TXERR_XRETRY)
+                               bf->bf_state.bf_type |= BUF_XRETRY;
+                       nbad = 0;
+               } else {
+                       nbad = ath_tx_num_badfrms(sc, bf, txok);
+               }
 
-       return 0;
-}
+               ath_tx_rc_status(bf, ds, nbad);
 
-/* Stop tx aggregation */
+               if (bf_isampdu(bf))
+                       ath_tx_complete_aggr(sc, txq, bf, &bf_head, txok);
+               else
+                       ath_tx_complete_buf(sc, bf, &bf_head, txok, 0);
 
-int ath_tx_aggr_stop(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
-{
-       struct ath_node *an = (struct ath_node *)sta->drv_priv;
+               ath_wake_mac80211_queue(sc, txq);
 
-       ath_tx_aggr_teardown(sc, an, tid);
-       return 0;
+               spin_lock_bh(&txq->axq_lock);
+               if (sc->sc_flags & SC_OP_TXAGGR)
+                       ath_txq_schedule(sc, txq);
+               spin_unlock_bh(&txq->axq_lock);
+       }
 }
 
-/* Resume tx aggregation */
 
-void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tid)
+void ath_tx_tasklet(struct ath_softc *sc)
 {
-       struct ath_atx_tid *txtid;
-       struct ath_node *an;
+       int i;
+       u32 qcumask = ((1 << ATH9K_NUM_TX_QUEUES) - 1);
 
-       an = (struct ath_node *)sta->drv_priv;
+       ath9k_hw_gettxintrtxqs(sc->sc_ah, &qcumask);
 
-       if (sc->sc_flags & SC_OP_TXAGGR) {
-               txtid = ATH_AN_2_TID(an, tid);
-               txtid->baw_size =
-                       IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor;
-               txtid->state |= AGGR_ADDBA_COMPLETE;
-               txtid->state &= ~AGGR_ADDBA_PROGRESS;
-               ath_tx_resume_tid(sc, txtid);
+       for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
+               if (ATH_TXQ_SETUP(sc, i) && (qcumask & (1 << i)))
+                       ath_tx_processq(sc, &sc->tx.txq[i]);
        }
 }
 
-/*
- * Performs transmit side cleanup when TID changes from aggregated to
- * unaggregated.
- * - Pause the TID and mark cleanup in progress
- * - Discard all retry frames from the s/w queue.
- */
+/*****************/
+/* Init, Cleanup */
+/*****************/
 
-void ath_tx_aggr_teardown(struct ath_softc *sc, struct ath_node *an, u8 tid)
+int ath_tx_init(struct ath_softc *sc, int nbufs)
 {
-       struct ath_atx_tid *txtid = ATH_AN_2_TID(an, tid);
-       struct ath_txq *txq = &sc->tx.txq[txtid->ac->qnum];
-       struct ath_buf *bf;
-       struct list_head bf_head;
-       INIT_LIST_HEAD(&bf_head);
-
-       if (txtid->state & AGGR_CLEANUP) /* cleanup is in progress */
-               return;
+       int error = 0;
 
-       if (!(txtid->state & AGGR_ADDBA_COMPLETE)) {
-               txtid->addba_exchangeattempts = 0;
-               return;
-       }
+       do {
+               spin_lock_init(&sc->tx.txbuflock);
 
-       /* TID must be paused first */
-       ath_tx_pause_tid(sc, txtid);
+               error = ath_descdma_setup(sc, &sc->tx.txdma, &sc->tx.txbuf,
+                       "tx", nbufs, 1);
+               if (error != 0) {
+                       DPRINTF(sc, ATH_DBG_FATAL,
+                               "Failed to allocate tx descriptors: %d\n",
+                               error);
+                       break;
+               }
 
-       /* drop all software retried frames and mark this TID */
-       spin_lock_bh(&txq->axq_lock);
-       while (!list_empty(&txtid->buf_q)) {
-               bf = list_first_entry(&txtid->buf_q, struct ath_buf, list);
-               if (!bf_isretried(bf)) {
-                       /*
-                        * NB: it's based on the assumption that
-                        * software retried frame will always stay
-                        * at the head of software queue.
-                        */
+               error = ath_descdma_setup(sc, &sc->beacon.bdma, &sc->beacon.bbuf,
+                                         "beacon", ATH_BCBUF, 1);
+               if (error != 0) {
+                       DPRINTF(sc, ATH_DBG_FATAL,
+                               "Failed to allocate beacon descriptors: %d\n",
+                               error);
                        break;
                }
-               list_cut_position(&bf_head,
-                       &txtid->buf_q, &bf->bf_lastfrm->list);
-               ath_tx_update_baw(sc, txtid, bf->bf_seqno);
 
-               /* complete this sub-frame */
-               ath_tx_complete_buf(sc, bf, &bf_head, 0, 0);
-       }
+       } while (0);
 
-       if (txtid->baw_head != txtid->baw_tail) {
-               spin_unlock_bh(&txq->axq_lock);
-               txtid->state |= AGGR_CLEANUP;
-       } else {
-               txtid->state &= ~AGGR_ADDBA_COMPLETE;
-               txtid->addba_exchangeattempts = 0;
-               spin_unlock_bh(&txq->axq_lock);
-               ath_tx_flush_tid(sc, txtid);
-       }
-}
+       if (error != 0)
+               ath_tx_cleanup(sc);
 
-/*
- * Tx scheduling logic
- * NB: must be called with txq lock held
- */
+       return error;
+}
 
-void ath_txq_schedule(struct ath_softc *sc, struct ath_txq *txq)
+int ath_tx_cleanup(struct ath_softc *sc)
 {
-       struct ath_atx_ac *ac;
-       struct ath_atx_tid *tid;
-
-       /* nothing to schedule */
-       if (list_empty(&txq->axq_acq))
-               return;
-       /*
-        * get the first node/ac pair on the queue
-        */
-       ac = list_first_entry(&txq->axq_acq, struct ath_atx_ac, list);
-       list_del(&ac->list);
-       ac->sched = false;
-
-       /*
-        * process a single tid per destination
-        */
-       do {
-               /* nothing to schedule */
-               if (list_empty(&ac->tid_q))
-                       return;
-
-               tid = list_first_entry(&ac->tid_q, struct ath_atx_tid, list);
-               list_del(&tid->list);
-               tid->sched = false;
-
-               if (tid->paused)    /* check next tid to keep h/w busy */
-                       continue;
-
-               if ((txq->axq_depth % 2) == 0)
-                       ath_tx_sched_aggr(sc, txq, tid);
-
-               /*
-                * add tid to round-robin queue if more frames
-                * are pending for the tid
-                */
-               if (!list_empty(&tid->buf_q))
-                       ath_tx_queue_tid(txq, tid);
+       if (sc->beacon.bdma.dd_desc_len != 0)
+               ath_descdma_cleanup(sc, &sc->beacon.bdma, &sc->beacon.bbuf);
 
-               /* only schedule one TID at a time */
-               break;
-       } while (!list_empty(&ac->tid_q));
+       if (sc->tx.txdma.dd_desc_len != 0)
+               ath_descdma_cleanup(sc, &sc->tx.txdma, &sc->tx.txbuf);
 
-       /*
-        * schedule AC if more TIDs need processing
-        */
-       if (!list_empty(&ac->tid_q)) {
-               /*
-                * add dest ac to txq if not already added
-                */
-               if (!ac->sched) {
-                       ac->sched = true;
-                       list_add_tail(&ac->list, &txq->axq_acq);
-               }
-       }
+       return 0;
 }
 
-/* Initialize per-node transmit state */
-
 void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
 {
        struct ath_atx_tid *tid;
        struct ath_atx_ac *ac;
        int tidno, acno;
 
-       /*
-        * Init per tid tx state
-        */
        for (tidno = 0, tid = &an->tid[tidno];
             tidno < WME_NUM_TID;
             tidno++, tid++) {
@@ -2423,22 +2075,16 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
                tid->baw_size  = WME_MAX_BA;
                tid->baw_head  = tid->baw_tail = 0;
                tid->sched     = false;
-               tid->paused = false;
+               tid->paused    = false;
                tid->state &= ~AGGR_CLEANUP;
                INIT_LIST_HEAD(&tid->buf_q);
-
                acno = TID_TO_WME_AC(tidno);
                tid->ac = &an->ac[acno];
-
-               /* ADDBA state */
                tid->state &= ~AGGR_ADDBA_COMPLETE;
                tid->state &= ~AGGR_ADDBA_PROGRESS;
                tid->addba_exchangeattempts = 0;
        }
 
-       /*
-        * Init per ac tx state
-        */
        for (acno = 0, ac = &an->ac[acno];
             acno < WME_NUM_AC; acno++, ac++) {
                ac->sched    = false;
@@ -2465,14 +2111,13 @@ void ath_tx_node_init(struct ath_softc *sc, struct ath_node *an)
        }
 }
 
-/* Cleanupthe pending buffers for the node. */
-
 void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
 {
        int i;
        struct ath_atx_ac *ac, *ac_tmp;
        struct ath_atx_tid *tid, *tid_tmp;
        struct ath_txq *txq;
+
        for (i = 0; i < ATH9K_NUM_TX_QUEUES; i++) {
                if (ATH_TXQ_SETUP(sc, i)) {
                        txq = &sc->tx.txq[i];
@@ -2503,51 +2148,3 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
                }
        }
 }
-
-void ath_tx_cabq(struct ath_softc *sc, struct sk_buff *skb)
-{
-       int hdrlen, padsize;
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct ath_tx_control txctl;
-
-       memset(&txctl, 0, sizeof(struct ath_tx_control));
-
-       /*
-        * As a temporary workaround, assign seq# here; this will likely need
-        * to be cleaned up to work better with Beacon transmission and virtual
-        * BSSes.
-        */
-       if (info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
-               struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
-               if (info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT)
-                       sc->tx.seq_no += 0x10;
-               hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
-               hdr->seq_ctrl |= cpu_to_le16(sc->tx.seq_no);
-       }
-
-       /* Add the padding after the header if this is not already done */
-       hdrlen = ieee80211_get_hdrlen_from_skb(skb);
-       if (hdrlen & 3) {
-               padsize = hdrlen % 4;
-               if (skb_headroom(skb) < padsize) {
-                       DPRINTF(sc, ATH_DBG_XMIT, "TX CABQ padding failed\n");
-                       dev_kfree_skb_any(skb);
-                       return;
-               }
-               skb_push(skb, padsize);
-               memmove(skb->data, skb->data + padsize, hdrlen);
-       }
-
-       txctl.txq = sc->beacon.cabq;
-
-       DPRINTF(sc, ATH_DBG_XMIT, "transmitting CABQ packet, skb: %p\n", skb);
-
-       if (ath_tx_start(sc, skb, &txctl) != 0) {
-               DPRINTF(sc, ATH_DBG_XMIT, "CABQ TX failed\n");
-               goto exit;
-       }
-
-       return;
-exit:
-       dev_kfree_skb_any(skb);
-}
index 4223672c4432a5784befad643e91b0f74e41cbb2..91930a2c3c6b61f0c5eddd0cc56b3320a7bf1f48 100644 (file)
@@ -2204,9 +2204,6 @@ static int atmel_get_frag(struct net_device *dev,
        return 0;
 }
 
-static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442,
-                               2447, 2452, 2457, 2462, 2467, 2472, 2484 };
-
 static int atmel_set_freq(struct net_device *dev,
                          struct iw_request_info *info,
                          struct iw_freq *fwrq,
@@ -2216,16 +2213,12 @@ static int atmel_set_freq(struct net_device *dev,
        int rc = -EINPROGRESS;          /* Call commit handler */
 
        /* If setting by frequency, convert to a channel */
-       if ((fwrq->e == 1) &&
-           (fwrq->m >= (int) 241200000) &&
-           (fwrq->m <= (int) 248700000)) {
+       if (fwrq->e == 1) {
                int f = fwrq->m / 100000;
-               int c = 0;
-               while ((c < 14) && (f != frequency_list[c]))
-                       c++;
+
                /* Hack to fall through... */
                fwrq->e = 0;
-               fwrq->m = c + 1;
+               fwrq->m = ieee80211_freq_to_dsss_chan(f);
        }
        /* Setting by channel number */
        if ((fwrq->m > 1000) || (fwrq->e > 0))
@@ -2384,8 +2377,11 @@ static int atmel_get_range(struct net_device *dev,
        if (range->num_channels != 0) {
                for (k = 0, i = channel_table[j].min; i <= channel_table[j].max; i++) {
                        range->freq[k].i = i; /* List index */
-                       range->freq[k].m = frequency_list[i - 1] * 100000;
-                       range->freq[k++].e = 1; /* Values in table in MHz -> * 10^5 * 10 */
+
+                       /* Values in MHz -> * 10^5 * 10 */
+                       range->freq[k].m = (ieee80211_dsss_chan_to_freq(i) *
+                                           100000);
+                       range->freq[k++].e = 1;
                }
                range->num_frequency = k;
        }
index 1f81d36f87c5e6cf8d254f87a8a161e987d2ef49..aab71a70ba788070b21a1452ba22478b0bbd5cd2 100644 (file)
@@ -110,10 +110,18 @@ config B43_DEBUG
        bool "Broadcom 43xx debugging"
        depends on B43
        ---help---
-         Broadcom 43xx debugging messages.
+         Broadcom 43xx debugging.
 
-         Say Y, if you want to find out why the driver does not
-         work for you.
+         This adds additional runtime sanity checks and statistics to the driver.
+         These checks and statistics might me expensive and hurt runtime performance
+         of your system.
+         This also adds the b43 debugfs interface.
+
+         Do not enable this, unless you are debugging the driver.
+
+         Say N, if you are a distributor or user building a release kernel
+         for production use.
+         Only say Y, if you are debugging a problem in the b43 driver sourcecode.
 
 config B43_FORCE_PIO
        bool "Force usage of PIO instead of DMA"
index 14a02b3aea539237226a393284b77c1719ce5abf..281ef8310350e559752f0a44a6d9f0744cbd466c 100644 (file)
@@ -6,6 +6,7 @@ b43-y                           += phy_g.o
 b43-y                          += phy_a.o
 b43-$(CONFIG_B43_NPHY)         += phy_n.o
 b43-$(CONFIG_B43_PHY_LP)       += phy_lp.o
+b43-$(CONFIG_B43_PHY_LP)       += tables_lpphy.o
 b43-y                          += sysfs.o
 b43-y                          += xmit.o
 b43-y                          += lo.o
index a53c378e74844ebdca86dd83fb3b5c9104511b27..b45731012782db3f58d54ccd97c496ff57a92627 100644 (file)
 #define B43_MMIO_IFSCTL                        0x688 /* Interframe space control */
 #define  B43_MMIO_IFSCTL_USE_EDCF      0x0004
 #define B43_MMIO_POWERUP_DELAY         0x6A8
+#define B43_MMIO_BTCOEX_CTL            0x6B4 /* Bluetooth Coexistence Control */
+#define B43_MMIO_BTCOEX_STAT           0x6B6 /* Bluetooth Coexistence Status */
+#define B43_MMIO_BTCOEX_TXCTL          0x6B8 /* Bluetooth Coexistence Transmit Control */
 
 /* SPROM boardflags_lo values */
 #define B43_BFL_BTCOEXIST              0x0001  /* implements Bluetooth coexistance */
@@ -655,10 +658,39 @@ struct b43_wl {
        struct work_struct txpower_adjust_work;
 };
 
+/* The type of the firmware file. */
+enum b43_firmware_file_type {
+       B43_FWTYPE_PROPRIETARY,
+       B43_FWTYPE_OPENSOURCE,
+       B43_NR_FWTYPES,
+};
+
+/* Context data for fetching firmware. */
+struct b43_request_fw_context {
+       /* The device we are requesting the fw for. */
+       struct b43_wldev *dev;
+       /* The type of firmware to request. */
+       enum b43_firmware_file_type req_type;
+       /* Error messages for each firmware type. */
+       char errors[B43_NR_FWTYPES][128];
+       /* Temporary buffer for storing the firmware name. */
+       char fwname[64];
+       /* A fatal error occured while requesting. Firmware reqest
+        * can not continue, as any other reqest will also fail. */
+       int fatal_failure;
+};
+
 /* In-memory representation of a cached microcode file. */
 struct b43_firmware_file {
        const char *filename;
        const struct firmware *data;
+       /* Type of the firmware file name. Note that this does only indicate
+        * the type by the firmware name. NOT the file contents.
+        * If you want to check for proprietary vs opensource, use (struct b43_firmware)->opensource
+        * instead! The (struct b43_firmware)->opensource flag is derived from the actual firmware
+        * binary code, not just the filename.
+        */
+       enum b43_firmware_file_type type;
 };
 
 /* Pointers to the firmware data and meta information about it. */
@@ -677,7 +709,8 @@ struct b43_firmware {
        /* Firmware patchlevel */
        u16 patch;
 
-       /* Set to true, if we are using an opensource firmware. */
+       /* Set to true, if we are using an opensource firmware.
+        * Use this to check for proprietary vs opensource. */
        bool opensource;
        /* Set to true, if the core needs a PCM firmware, but
         * we failed to load one. This is always false for
@@ -848,12 +881,9 @@ void b43err(struct b43_wl *wl, const char *fmt, ...)
     __attribute__ ((format(printf, 2, 3)));
 void b43warn(struct b43_wl *wl, const char *fmt, ...)
     __attribute__ ((format(printf, 2, 3)));
-#if B43_DEBUG
 void b43dbg(struct b43_wl *wl, const char *fmt, ...)
     __attribute__ ((format(printf, 2, 3)));
-#else /* DEBUG */
-# define b43dbg(wl, fmt...) do { /* nothing */ } while (0)
-#endif /* DEBUG */
+
 
 /* A WARN_ON variant that vanishes when b43 debugging is disabled.
  * This _also_ evaluates the arg with debugging disabled. */
index e04fc91f569ea573f3c9d3dfad8551b710d98c32..bc2767da46e8ba2c56d80c19f966f2d5dd753e97 100644 (file)
@@ -367,34 +367,6 @@ static int mmio32write__write_file(struct b43_wldev *dev,
        return 0;
 }
 
-/* wl->irq_lock is locked */
-static ssize_t tsf_read_file(struct b43_wldev *dev,
-                            char *buf, size_t bufsize)
-{
-       ssize_t count = 0;
-       u64 tsf;
-
-       b43_tsf_read(dev, &tsf);
-       fappend("0x%08x%08x\n",
-               (unsigned int)((tsf & 0xFFFFFFFF00000000ULL) >> 32),
-               (unsigned int)(tsf & 0xFFFFFFFFULL));
-
-       return count;
-}
-
-/* wl->irq_lock is locked */
-static int tsf_write_file(struct b43_wldev *dev,
-                         const char *buf, size_t count)
-{
-       u64 tsf;
-
-       if (sscanf(buf, "%llu", (unsigned long long *)(&tsf)) != 1)
-               return -EINVAL;
-       b43_tsf_write(dev, tsf);
-
-       return 0;
-}
-
 static ssize_t txstat_read_file(struct b43_wldev *dev,
                                char *buf, size_t bufsize)
 {
@@ -691,15 +663,23 @@ B43_DEBUGFS_FOPS(mmio16read, mmio16read__read_file, mmio16read__write_file, 1);
 B43_DEBUGFS_FOPS(mmio16write, NULL, mmio16write__write_file, 1);
 B43_DEBUGFS_FOPS(mmio32read, mmio32read__read_file, mmio32read__write_file, 1);
 B43_DEBUGFS_FOPS(mmio32write, NULL, mmio32write__write_file, 1);
-B43_DEBUGFS_FOPS(tsf, tsf_read_file, tsf_write_file, 1);
 B43_DEBUGFS_FOPS(txstat, txstat_read_file, NULL, 0);
 B43_DEBUGFS_FOPS(restart, NULL, restart_write_file, 1);
 B43_DEBUGFS_FOPS(loctls, loctls_read_file, NULL, 0);
 
 
-int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
+bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
 {
-       return !!(dev->dfsentry && dev->dfsentry->dyn_debug[feature]);
+       bool enabled;
+
+       enabled = (dev->dfsentry && dev->dfsentry->dyn_debug[feature]);
+       if (unlikely(enabled)) {
+               /* Force full debugging messages, if the user enabled
+                * some dynamic debugging feature. */
+               b43_modparam_verbose = B43_VERBOSITY_MAX;
+       }
+
+       return enabled;
 }
 
 static void b43_remove_dynamic_debug(struct b43_wldev *dev)
@@ -805,7 +785,6 @@ void b43_debugfs_add_device(struct b43_wldev *dev)
        ADD_FILE(mmio16write, 0200);
        ADD_FILE(mmio32read, 0600);
        ADD_FILE(mmio32write, 0200);
-       ADD_FILE(tsf, 0600);
        ADD_FILE(txstat, 0400);
        ADD_FILE(restart, 0200);
        ADD_FILE(loctls, 0400);
@@ -834,7 +813,6 @@ void b43_debugfs_remove_device(struct b43_wldev *dev)
        debugfs_remove(e->file_mmio16write.dentry);
        debugfs_remove(e->file_mmio32read.dentry);
        debugfs_remove(e->file_mmio32write.dentry);
-       debugfs_remove(e->file_tsf.dentry);
        debugfs_remove(e->file_txstat.dentry);
        debugfs_remove(e->file_restart.dentry);
        debugfs_remove(e->file_loctls.dentry);
index 7886cbe2d1d19276f22e3a974dd4d7e44a55347b..b9d4de4a979c7a9188858729ab41a58fcdae7eba 100644 (file)
@@ -46,7 +46,6 @@ struct b43_dfsentry {
        struct b43_dfs_file file_mmio16write;
        struct b43_dfs_file file_mmio32read;
        struct b43_dfs_file file_mmio32write;
-       struct b43_dfs_file file_tsf;
        struct b43_dfs_file file_txstat;
        struct b43_dfs_file file_txpower_g;
        struct b43_dfs_file file_restart;
@@ -72,7 +71,7 @@ struct b43_dfsentry {
        struct dentry *dyn_debug_dentries[__B43_NR_DYNDBG];
 };
 
-int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
+bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature);
 
 void b43_debugfs_init(void);
 void b43_debugfs_exit(void);
@@ -83,7 +82,7 @@ void b43_debugfs_log_txstat(struct b43_wldev *dev,
 
 #else /* CONFIG_B43_DEBUG */
 
-static inline int b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
+static inline bool b43_debug(struct b43_wldev *dev, enum b43_dyndbg feature)
 {
        return 0;
 }
index c788bad10661b5fa2442d37ea636561e95258688..7116ab6eccfadfc11da321e1541278619020a55a 100644 (file)
@@ -4,7 +4,7 @@
 
   Copyright (c) 2005 Martin Langer <martin-langer@gmx.de>
   Copyright (c) 2005 Stefano Brivio <stefano.brivio@polimi.it>
-  Copyright (c) 2005, 2006 Michael Buesch <mb@bu3sch.de>
+  Copyright (c) 2005-2009 Michael Buesch <mb@bu3sch.de>
   Copyright (c) 2005 Danny van Dyk <kugelfang@gentoo.org>
   Copyright (c) 2005 Andreas Jaggi <andreas.jaggi@waterwave.ch>
 
@@ -88,6 +88,10 @@ static int modparam_btcoex = 1;
 module_param_named(btcoex, modparam_btcoex, int, 0444);
 MODULE_PARM_DESC(btcoex, "Enable Bluetooth coexistance (default on)");
 
+int b43_modparam_verbose = B43_VERBOSITY_DEFAULT;
+module_param_named(verbose, b43_modparam_verbose, int, 0644);
+MODULE_PARM_DESC(verbose, "Log message verbosity: 0=error, 1=warn, 2=info(default), 3=debug");
+
 
 static const struct ssb_device_id b43_ssb_tbl[] = {
        SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 5),
@@ -97,6 +101,8 @@ static const struct ssb_device_id b43_ssb_tbl[] = {
        SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 10),
        SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 11),
        SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 13),
+       SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 15),
+       SSB_DEVICE(SSB_VENDOR_BROADCOM, SSB_DEV_80211, 16),
        SSB_DEVTABLE_END
 };
 
@@ -298,6 +304,8 @@ void b43info(struct b43_wl *wl, const char *fmt, ...)
 {
        va_list args;
 
+       if (b43_modparam_verbose < B43_VERBOSITY_INFO)
+               return;
        if (!b43_ratelimit(wl))
                return;
        va_start(args, fmt);
@@ -311,6 +319,8 @@ void b43err(struct b43_wl *wl, const char *fmt, ...)
 {
        va_list args;
 
+       if (b43_modparam_verbose < B43_VERBOSITY_ERROR)
+               return;
        if (!b43_ratelimit(wl))
                return;
        va_start(args, fmt);
@@ -324,6 +334,8 @@ void b43warn(struct b43_wl *wl, const char *fmt, ...)
 {
        va_list args;
 
+       if (b43_modparam_verbose < B43_VERBOSITY_WARN)
+               return;
        if (!b43_ratelimit(wl))
                return;
        va_start(args, fmt);
@@ -333,18 +345,18 @@ void b43warn(struct b43_wl *wl, const char *fmt, ...)
        va_end(args);
 }
 
-#if B43_DEBUG
 void b43dbg(struct b43_wl *wl, const char *fmt, ...)
 {
        va_list args;
 
+       if (b43_modparam_verbose < B43_VERBOSITY_DEBUG)
+               return;
        va_start(args, fmt);
        printk(KERN_DEBUG "b43-%s debug: ",
               (wl && wl->hw) ? wiphy_name(wl->hw->wiphy) : "wlan");
        vprintk(fmt, args);
        va_end(args);
 }
-#endif /* DEBUG */
 
 static void b43_ram_write(struct b43_wldev *dev, u16 offset, u32 val)
 {
@@ -526,52 +538,20 @@ void b43_hf_write(struct b43_wldev *dev, u64 value)
        b43_shm_write16(dev, B43_SHM_SHARED, B43_SHM_SH_HOSTFHI, hi);
 }
 
-void b43_tsf_read(struct b43_wldev *dev, u64 * tsf)
+void b43_tsf_read(struct b43_wldev *dev, u64 *tsf)
 {
-       /* We need to be careful. As we read the TSF from multiple
-        * registers, we should take care of register overflows.
-        * In theory, the whole tsf read process should be atomic.
-        * We try to be atomic here, by restaring the read process,
-        * if any of the high registers changed (overflew).
-        */
-       if (dev->dev->id.revision >= 3) {
-               u32 low, high, high2;
+       u32 low, high;
 
-               do {
-                       high = b43_read32(dev, B43_MMIO_REV3PLUS_TSF_HIGH);
-                       low = b43_read32(dev, B43_MMIO_REV3PLUS_TSF_LOW);
-                       high2 = b43_read32(dev, B43_MMIO_REV3PLUS_TSF_HIGH);
-               } while (unlikely(high != high2));
+       B43_WARN_ON(dev->dev->id.revision < 3);
 
-               *tsf = high;
-               *tsf <<= 32;
-               *tsf |= low;
-       } else {
-               u64 tmp;
-               u16 v0, v1, v2, v3;
-               u16 test1, test2, test3;
-
-               do {
-                       v3 = b43_read16(dev, B43_MMIO_TSF_3);
-                       v2 = b43_read16(dev, B43_MMIO_TSF_2);
-                       v1 = b43_read16(dev, B43_MMIO_TSF_1);
-                       v0 = b43_read16(dev, B43_MMIO_TSF_0);
+       /* The hardware guarantees us an atomic read, if we
+        * read the low register first. */
+       low = b43_read32(dev, B43_MMIO_REV3PLUS_TSF_LOW);
+       high = b43_read32(dev, B43_MMIO_REV3PLUS_TSF_HIGH);
 
-                       test3 = b43_read16(dev, B43_MMIO_TSF_3);
-                       test2 = b43_read16(dev, B43_MMIO_TSF_2);
-                       test1 = b43_read16(dev, B43_MMIO_TSF_1);
-               } while (v3 != test3 || v2 != test2 || v1 != test1);
-
-               *tsf = v3;
-               *tsf <<= 48;
-               tmp = v2;
-               tmp <<= 32;
-               *tsf |= tmp;
-               tmp = v1;
-               tmp <<= 16;
-               *tsf |= tmp;
-               *tsf |= v0;
-       }
+       *tsf = high;
+       *tsf <<= 32;
+       *tsf |= low;
 }
 
 static void b43_time_lock(struct b43_wldev *dev)
@@ -598,35 +578,18 @@ static void b43_time_unlock(struct b43_wldev *dev)
 
 static void b43_tsf_write_locked(struct b43_wldev *dev, u64 tsf)
 {
-       /* Be careful with the in-progress timer.
-        * First zero out the low register, so we have a full
-        * register-overflow duration to complete the operation.
-        */
-       if (dev->dev->id.revision >= 3) {
-               u32 lo = (tsf & 0x00000000FFFFFFFFULL);
-               u32 hi = (tsf & 0xFFFFFFFF00000000ULL) >> 32;
+       u32 low, high;
 
-               b43_write32(dev, B43_MMIO_REV3PLUS_TSF_LOW, 0);
-               mmiowb();
-               b43_write32(dev, B43_MMIO_REV3PLUS_TSF_HIGH, hi);
-               mmiowb();
-               b43_write32(dev, B43_MMIO_REV3PLUS_TSF_LOW, lo);
-       } else {
-               u16 v0 = (tsf & 0x000000000000FFFFULL);
-               u16 v1 = (tsf & 0x00000000FFFF0000ULL) >> 16;
-               u16 v2 = (tsf & 0x0000FFFF00000000ULL) >> 32;
-               u16 v3 = (tsf & 0xFFFF000000000000ULL) >> 48;
+       B43_WARN_ON(dev->dev->id.revision < 3);
 
-               b43_write16(dev, B43_MMIO_TSF_0, 0);
-               mmiowb();
-               b43_write16(dev, B43_MMIO_TSF_3, v3);
-               mmiowb();
-               b43_write16(dev, B43_MMIO_TSF_2, v2);
-               mmiowb();
-               b43_write16(dev, B43_MMIO_TSF_1, v1);
-               mmiowb();
-               b43_write16(dev, B43_MMIO_TSF_0, v0);
-       }
+       low = tsf;
+       high = (tsf >> 32);
+       /* The hardware guarantees us an atomic write, if we
+        * write the low register first. */
+       b43_write32(dev, B43_MMIO_REV3PLUS_TSF_LOW, low);
+       mmiowb();
+       b43_write32(dev, B43_MMIO_REV3PLUS_TSF_HIGH, high);
+       mmiowb();
 }
 
 void b43_tsf_write(struct b43_wldev *dev, u64 tsf)
@@ -937,8 +900,7 @@ static int b43_key_write(struct b43_wldev *dev,
                B43_WARN_ON(dev->key[i].keyconf == keyconf);
        }
        if (index < 0) {
-               /* Either pairwise key or address is 00:00:00:00:00:00
-                * for transmit-only keys. Search the index. */
+               /* Pairwise key. Get an empty slot for the key. */
                if (b43_new_kidx_api(dev))
                        sta_keys_start = 4;
                else
@@ -951,7 +913,7 @@ static int b43_key_write(struct b43_wldev *dev,
                        }
                }
                if (index < 0) {
-                       b43err(dev->wl, "Out of hardware key memory\n");
+                       b43warn(dev->wl, "Out of hardware key memory\n");
                        return -ENOSPC;
                }
        } else
@@ -1982,7 +1944,7 @@ static irqreturn_t b43_interrupt_handler(int irq, void *dev_id)
        return ret;
 }
 
-static void do_release_fw(struct b43_firmware_file *fw)
+void b43_do_release_fw(struct b43_firmware_file *fw)
 {
        release_firmware(fw->data);
        fw->data = NULL;
@@ -1991,31 +1953,30 @@ static void do_release_fw(struct b43_firmware_file *fw)
 
 static void b43_release_firmware(struct b43_wldev *dev)
 {
-       do_release_fw(&dev->fw.ucode);
-       do_release_fw(&dev->fw.pcm);
-       do_release_fw(&dev->fw.initvals);
-       do_release_fw(&dev->fw.initvals_band);
+       b43_do_release_fw(&dev->fw.ucode);
+       b43_do_release_fw(&dev->fw.pcm);
+       b43_do_release_fw(&dev->fw.initvals);
+       b43_do_release_fw(&dev->fw.initvals_band);
 }
 
 static void b43_print_fw_helptext(struct b43_wl *wl, bool error)
 {
-       const char *text;
+       const char text[] =
+               "You must go to " \
+               "http://wireless.kernel.org/en/users/Drivers/b43#devicefirmware " \
+               "and download the correct firmware for this driver version. " \
+               "Please carefully read all instructions on this website.\n";
 
-       text = "You must go to "
-              "http://linuxwireless.org/en/users/Drivers/b43#devicefirmware "
-              "and download the latest firmware (version 4).\n";
        if (error)
                b43err(wl, text);
        else
                b43warn(wl, text);
 }
 
-static int do_request_fw(struct b43_wldev *dev,
-                        const char *name,
-                        struct b43_firmware_file *fw,
-                        bool silent)
+int b43_do_request_fw(struct b43_request_fw_context *ctx,
+                     const char *name,
+                     struct b43_firmware_file *fw)
 {
-       char path[sizeof(modparam_fwpostfix) + 32];
        const struct firmware *blob;
        struct b43_fw_header *hdr;
        u32 size;
@@ -2023,29 +1984,49 @@ static int do_request_fw(struct b43_wldev *dev,
 
        if (!name) {
                /* Don't fetch anything. Free possibly cached firmware. */
-               do_release_fw(fw);
+               /* FIXME: We should probably keep it anyway, to save some headache
+                * on suspend/resume with multiband devices. */
+               b43_do_release_fw(fw);
                return 0;
        }
        if (fw->filename) {
-               if (strcmp(fw->filename, name) == 0)
+               if ((fw->type == ctx->req_type) &&
+                   (strcmp(fw->filename, name) == 0))
                        return 0; /* Already have this fw. */
                /* Free the cached firmware first. */
-               do_release_fw(fw);
+               /* FIXME: We should probably do this later after we successfully
+                * got the new fw. This could reduce headache with multiband devices.
+                * We could also redesign this to cache the firmware for all possible
+                * bands all the time. */
+               b43_do_release_fw(fw);
+       }
+
+       switch (ctx->req_type) {
+       case B43_FWTYPE_PROPRIETARY:
+               snprintf(ctx->fwname, sizeof(ctx->fwname),
+                        "b43%s/%s.fw",
+                        modparam_fwpostfix, name);
+               break;
+       case B43_FWTYPE_OPENSOURCE:
+               snprintf(ctx->fwname, sizeof(ctx->fwname),
+                        "b43-open%s/%s.fw",
+                        modparam_fwpostfix, name);
+               break;
+       default:
+               B43_WARN_ON(1);
+               return -ENOSYS;
        }
-
-       snprintf(path, ARRAY_SIZE(path),
-                "b43%s/%s.fw",
-                modparam_fwpostfix, name);
-       err = request_firmware(&blob, path, dev->dev->dev);
+       err = request_firmware(&blob, ctx->fwname, ctx->dev->dev->dev);
        if (err == -ENOENT) {
-               if (!silent) {
-                       b43err(dev->wl, "Firmware file \"%s\" not found\n",
-                              path);
-               }
+               snprintf(ctx->errors[ctx->req_type],
+                        sizeof(ctx->errors[ctx->req_type]),
+                        "Firmware file \"%s\" not found\n", ctx->fwname);
                return err;
        } else if (err) {
-               b43err(dev->wl, "Firmware file \"%s\" request failed (err=%d)\n",
-                      path, err);
+               snprintf(ctx->errors[ctx->req_type],
+                        sizeof(ctx->errors[ctx->req_type]),
+                        "Firmware file \"%s\" request failed (err=%d)\n",
+                        ctx->fwname, err);
                return err;
        }
        if (blob->size < sizeof(struct b43_fw_header))
@@ -2068,20 +2049,24 @@ static int do_request_fw(struct b43_wldev *dev,
 
        fw->data = blob;
        fw->filename = name;
+       fw->type = ctx->req_type;
 
        return 0;
 
 err_format:
-       b43err(dev->wl, "Firmware file \"%s\" format error.\n", path);
+       snprintf(ctx->errors[ctx->req_type],
+                sizeof(ctx->errors[ctx->req_type]),
+                "Firmware file \"%s\" format error.\n", ctx->fwname);
        release_firmware(blob);
 
        return -EPROTO;
 }
 
-static int b43_request_firmware(struct b43_wldev *dev)
+static int b43_try_request_fw(struct b43_request_fw_context *ctx)
 {
-       struct b43_firmware *fw = &dev->fw;
-       const u8 rev = dev->dev->id.revision;
+       struct b43_wldev *dev = ctx->dev;
+       struct b43_firmware *fw = &ctx->dev->fw;
+       const u8 rev = ctx->dev->dev->id.revision;
        const char *filename;
        u32 tmshigh;
        int err;
@@ -2096,7 +2081,7 @@ static int b43_request_firmware(struct b43_wldev *dev)
                filename = "ucode13";
        else
                goto err_no_ucode;
-       err = do_request_fw(dev, filename, &fw->ucode, 0);
+       err = b43_do_request_fw(ctx, filename, &fw->ucode);
        if (err)
                goto err_load;
 
@@ -2108,7 +2093,7 @@ static int b43_request_firmware(struct b43_wldev *dev)
        else
                goto err_no_pcm;
        fw->pcm_request_failed = 0;
-       err = do_request_fw(dev, filename, &fw->pcm, 1);
+       err = b43_do_request_fw(ctx, filename, &fw->pcm);
        if (err == -ENOENT) {
                /* We did not find a PCM file? Not fatal, but
                 * core rev <= 10 must do without hwcrypto then. */
@@ -2144,7 +2129,7 @@ static int b43_request_firmware(struct b43_wldev *dev)
        default:
                goto err_no_initvals;
        }
-       err = do_request_fw(dev, filename, &fw->initvals, 0);
+       err = b43_do_request_fw(ctx, filename, &fw->initvals);
        if (err)
                goto err_load;
 
@@ -2178,30 +2163,34 @@ static int b43_request_firmware(struct b43_wldev *dev)
        default:
                goto err_no_initvals;
        }
-       err = do_request_fw(dev, filename, &fw->initvals_band, 0);
+       err = b43_do_request_fw(ctx, filename, &fw->initvals_band);
        if (err)
                goto err_load;
 
        return 0;
 
-err_load:
-       b43_print_fw_helptext(dev->wl, 1);
-       goto error;
-
 err_no_ucode:
-       err = -ENODEV;
-       b43err(dev->wl, "No microcode available for core rev %u\n", rev);
+       err = ctx->fatal_failure = -EOPNOTSUPP;
+       b43err(dev->wl, "The driver does not know which firmware (ucode) "
+              "is required for your device (wl-core rev %u)\n", rev);
        goto error;
 
 err_no_pcm:
-       err = -ENODEV;
-       b43err(dev->wl, "No PCM available for core rev %u\n", rev);
+       err = ctx->fatal_failure = -EOPNOTSUPP;
+       b43err(dev->wl, "The driver does not know which firmware (PCM) "
+              "is required for your device (wl-core rev %u)\n", rev);
        goto error;
 
 err_no_initvals:
-       err = -ENODEV;
-       b43err(dev->wl, "No Initial Values firmware file for PHY %u, "
-              "core rev %u\n", dev->phy.type, rev);
+       err = ctx->fatal_failure = -EOPNOTSUPP;
+       b43err(dev->wl, "The driver does not know which firmware (initvals) "
+              "is required for your device (wl-core rev %u)\n", rev);
+       goto error;
+
+err_load:
+       /* We failed to load this firmware image. The error message
+        * already is in ctx->errors. Return and let our caller decide
+        * what to do. */
        goto error;
 
 error:
@@ -2209,6 +2198,48 @@ error:
        return err;
 }
 
+static int b43_request_firmware(struct b43_wldev *dev)
+{
+       struct b43_request_fw_context *ctx;
+       unsigned int i;
+       int err;
+       const char *errmsg;
+
+       ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
+       if (!ctx)
+               return -ENOMEM;
+       ctx->dev = dev;
+
+       ctx->req_type = B43_FWTYPE_PROPRIETARY;
+       err = b43_try_request_fw(ctx);
+       if (!err)
+               goto out; /* Successfully loaded it. */
+       err = ctx->fatal_failure;
+       if (err)
+               goto out;
+
+       ctx->req_type = B43_FWTYPE_OPENSOURCE;
+       err = b43_try_request_fw(ctx);
+       if (!err)
+               goto out; /* Successfully loaded it. */
+       err = ctx->fatal_failure;
+       if (err)
+               goto out;
+
+       /* Could not find a usable firmware. Print the errors. */
+       for (i = 0; i < B43_NR_FWTYPES; i++) {
+               errmsg = ctx->errors[i];
+               if (strlen(errmsg))
+                       b43err(dev->wl, errmsg);
+       }
+       b43_print_fw_helptext(dev->wl, 1);
+       err = -ENOENT;
+
+out:
+       kfree(ctx);
+       return err;
+}
+
 static int b43_upload_microcode(struct b43_wldev *dev)
 {
        const size_t hdr_len = sizeof(struct b43_fw_header);
@@ -2319,8 +2350,11 @@ static int b43_upload_microcode(struct b43_wldev *dev)
        }
 
        if (b43_is_old_txhdr_format(dev)) {
+               /* We're over the deadline, but we keep support for old fw
+                * until it turns out to be in major conflict with something new. */
                b43warn(dev->wl, "You are using an old firmware image. "
-                       "Support for old firmware will be removed in July 2008.\n");
+                       "Support for old firmware will be removed soon "
+                       "(official deadline was July 2008).\n");
                b43_print_fw_helptext(dev->wl, 0);
        }
 
@@ -3221,6 +3255,43 @@ static int b43_op_get_stats(struct ieee80211_hw *hw,
        return 0;
 }
 
+static u64 b43_op_get_tsf(struct ieee80211_hw *hw)
+{
+       struct b43_wl *wl = hw_to_b43_wl(hw);
+       struct b43_wldev *dev;
+       u64 tsf;
+
+       mutex_lock(&wl->mutex);
+       spin_lock_irq(&wl->irq_lock);
+       dev = wl->current_dev;
+
+       if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED))
+               b43_tsf_read(dev, &tsf);
+       else
+               tsf = 0;
+
+       spin_unlock_irq(&wl->irq_lock);
+       mutex_unlock(&wl->mutex);
+
+       return tsf;
+}
+
+static void b43_op_set_tsf(struct ieee80211_hw *hw, u64 tsf)
+{
+       struct b43_wl *wl = hw_to_b43_wl(hw);
+       struct b43_wldev *dev;
+
+       mutex_lock(&wl->mutex);
+       spin_lock_irq(&wl->irq_lock);
+       dev = wl->current_dev;
+
+       if (dev && (b43_status(dev) >= B43_STAT_INITIALIZED))
+               b43_tsf_write(dev, tsf);
+
+       spin_unlock_irq(&wl->irq_lock);
+       mutex_unlock(&wl->mutex);
+}
+
 static void b43_put_phy_into_reset(struct b43_wldev *dev)
 {
        struct ssb_device *sdev = dev->dev;
@@ -3442,7 +3513,7 @@ out_unlock_mutex:
        return err;
 }
 
-static void b43_update_basic_rates(struct b43_wldev *dev, u64 brates)
+static void b43_update_basic_rates(struct b43_wldev *dev, u32 brates)
 {
        struct ieee80211_supported_band *sband =
                dev->wl->hw->wiphy->bands[b43_current_band(dev->wl)];
@@ -3520,21 +3591,29 @@ out_unlock_mutex:
 }
 
 static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                          const u8 *local_addr, const u8 *addr,
-                          struct ieee80211_key_conf *key)
+                         struct ieee80211_vif *vif, struct ieee80211_sta *sta,
+                         struct ieee80211_key_conf *key)
 {
        struct b43_wl *wl = hw_to_b43_wl(hw);
        struct b43_wldev *dev;
-       unsigned long flags;
        u8 algorithm;
        u8 index;
        int err;
+       static const u8 bcast_addr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
 
        if (modparam_nohwcrypt)
                return -ENOSPC; /* User disabled HW-crypto */
 
        mutex_lock(&wl->mutex);
-       spin_lock_irqsave(&wl->irq_lock, flags);
+       spin_lock_irq(&wl->irq_lock);
+       write_lock(&wl->tx_lock);
+       /* Why do we need all this locking here?
+        * mutex     -> Every config operation must take it.
+        * irq_lock  -> We modify the dev->key array, which is accessed
+        *              in the IRQ handlers.
+        * tx_lock   -> We modify the dev->key array, which is accessed
+        *              in the TX handler.
+        */
 
        dev = wl->current_dev;
        err = -ENODEV;
@@ -3551,7 +3630,7 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        err = -EINVAL;
        switch (key->alg) {
        case ALG_WEP:
-               if (key->keylen == 5)
+               if (key->keylen == LEN_WEP40)
                        algorithm = B43_SEC_ALGO_WEP40;
                else
                        algorithm = B43_SEC_ALGO_WEP104;
@@ -3578,17 +3657,19 @@ static int b43_op_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                        goto out_unlock;
                }
 
-               if (is_broadcast_ether_addr(addr)) {
-                       /* addr is FF:FF:FF:FF:FF:FF for default keys */
+               if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) {
+                       if (WARN_ON(!sta)) {
+                               err = -EOPNOTSUPP;
+                               goto out_unlock;
+                       }
+                       /* Pairwise key with an assigned MAC address. */
+                       err = b43_key_write(dev, -1, algorithm,
+                                           key->key, key->keylen,
+                                           sta->addr, key);
+               } else {
+                       /* Group key */
                        err = b43_key_write(dev, index, algorithm,
                                            key->key, key->keylen, NULL, key);
-               } else {
-                       /*
-                        * either pairwise key or address is 00:00:00:00:00:00
-                        * for transmit-only keys
-                        */
-                       err = b43_key_write(dev, -1, algorithm,
-                                           key->key, key->keylen, addr, key);
                }
                if (err)
                        goto out_unlock;
@@ -3617,10 +3698,11 @@ out_unlock:
                b43dbg(wl, "%s hardware based encryption for keyidx: %d, "
                       "mac: %pM\n",
                       cmd == SET_KEY ? "Using" : "Disabling", key->keyidx,
-                      addr);
+                      sta ? sta->addr : bcast_addr);
                b43_dump_keymemory(dev);
        }
-       spin_unlock_irqrestore(&wl->irq_lock, flags);
+       write_unlock(&wl->tx_lock);
+       spin_unlock_irq(&wl->irq_lock);
        mutex_unlock(&wl->mutex);
 
        return err;
@@ -3796,6 +3878,12 @@ static int b43_phy_versioning(struct b43_wldev *dev)
                break;
 #ifdef CONFIG_B43_NPHY
        case B43_PHYTYPE_N:
+               if (phy_rev > 4)
+                       unsupported = 1;
+               break;
+#endif
+#ifdef CONFIG_B43_PHY_LP
+       case B43_PHYTYPE_LP:
                if (phy_rev > 1)
                        unsupported = 1;
                break;
@@ -3849,7 +3937,11 @@ static int b43_phy_versioning(struct b43_wldev *dev)
                        unsupported = 1;
                break;
        case B43_PHYTYPE_N:
-               if (radio_ver != 0x2055)
+               if (radio_ver != 0x2055 && radio_ver != 0x2056)
+                       unsupported = 1;
+               break;
+       case B43_PHYTYPE_LP:
+               if (radio_ver != 0x2062)
                        unsupported = 1;
                break;
        default:
@@ -4317,6 +4409,8 @@ static const struct ieee80211_ops b43_hw_ops = {
        .set_key                = b43_op_set_key,
        .get_stats              = b43_op_get_stats,
        .get_tx_stats           = b43_op_get_tx_stats,
+       .get_tsf                = b43_op_get_tsf,
+       .set_tsf                = b43_op_set_tsf,
        .start                  = b43_op_start,
        .stop                   = b43_op_stop,
        .set_tim                = b43_op_beacon_set_tim,
@@ -4446,6 +4540,7 @@ static int b43_wireless_core_attach(struct b43_wldev *dev)
                        break;
                case B43_PHYTYPE_G:
                case B43_PHYTYPE_N:
+               case B43_PHYTYPE_LP:
                        have_2ghz_phy = 1;
                        break;
                default:
@@ -4657,9 +4752,10 @@ static int b43_wireless_init(struct ssb_device *dev)
        INIT_WORK(&wl->txpower_adjust_work, b43_phy_txpower_adjust_work);
 
        ssb_set_devtypedata(dev, wl);
-       b43info(wl, "Broadcom %04X WLAN found\n", dev->bus->chip_id);
+       b43info(wl, "Broadcom %04X WLAN found (core revision %u)\n",
+               dev->bus->chip_id, dev->id.revision);
        err = 0;
-      out:
+out:
        return err;
 }
 
index f871a252cb555f7c00ae767e73bde8d38f019f17..40abcf5d1b4307d27fb0c6d8d48cb29fda85ee15 100644 (file)
 
 
 extern int b43_modparam_qos;
+extern int b43_modparam_verbose;
+
+/* Logmessage verbosity levels. Update the b43_modparam_verbose helptext, if
+ * you add or remove levels. */
+enum b43_verbosity {
+       B43_VERBOSITY_ERROR,
+       B43_VERBOSITY_WARN,
+       B43_VERBOSITY_INFO,
+       B43_VERBOSITY_DEBUG,
+       __B43_VERBOSITY_AFTERLAST, /* keep last */
+
+       B43_VERBOSITY_MAX = __B43_VERBOSITY_AFTERLAST - 1,
+#if B43_DEBUG
+       B43_VERBOSITY_DEFAULT = B43_VERBOSITY_DEBUG,
+#else
+       B43_VERBOSITY_DEFAULT = B43_VERBOSITY_INFO,
+#endif
+};
 
 
 /* Lightweight function to convert a frequency (in Mhz) to a channel number. */
@@ -121,4 +139,11 @@ void b43_power_saving_ctl_bits(struct b43_wldev *dev, unsigned int ps_flags);
 void b43_mac_suspend(struct b43_wldev *dev);
 void b43_mac_enable(struct b43_wldev *dev);
 
+
+struct b43_request_fw_context;
+int b43_do_request_fw(struct b43_request_fw_context *ctx,
+                     const char *name,
+                     struct b43_firmware_file *fw);
+void b43_do_release_fw(struct b43_firmware_file *fw);
+
 #endif /* B43_MAIN_H_ */
index caac4a45f0bf799bcf576c4ec0ede550008bc6ad..88bb303ae9d5907524f839b6d59afbbfd67fee0d 100644 (file)
@@ -3191,6 +3191,7 @@ static enum b43_txpwr_result b43_gphy_op_recalc_txpower(struct b43_wldev *dev,
         * Baseband attennuation. Subtract it. */
        bbatt_delta -= 4 * rfatt_delta;
 
+#if B43_DEBUG
        if (b43_debug(dev, B43_DBG_XMITPOWER)) {
                int dbm = pwr_adjust < 0 ? -pwr_adjust : pwr_adjust;
                b43dbg(dev->wl,
@@ -3199,6 +3200,8 @@ static enum b43_txpwr_result b43_gphy_op_recalc_txpower(struct b43_wldev *dev,
                       (pwr_adjust < 0 ? "-" : ""), Q52_ARG(dbm),
                       bbatt_delta, rfatt_delta);
        }
+#endif /* DEBUG */
+
        /* So do we finally need to adjust something in hardware? */
        if ((rfatt_delta == 0) && (bbatt_delta == 0))
                goto no_adjustment_needed;
index c5d9dc3667c0bad186bf6c556394e13ae24a7cb0..58e319d6b1ed567c6846b6cd8430f999efd0e65f 100644 (file)
@@ -3,7 +3,7 @@
   Broadcom B43 wireless driver
   IEEE 802.11g LP-PHY driver
 
-  Copyright (c) 2008 Michael Buesch <mb@bu3sch.de>
+  Copyright (c) 2008-2009 Michael Buesch <mb@bu3sch.de>
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
 */
 
 #include "b43.h"
+#include "main.h"
 #include "phy_lp.h"
 #include "phy_common.h"
+#include "tables_lpphy.h"
 
 
 static int b43_lpphy_op_allocate(struct b43_wldev *dev)
@@ -57,9 +59,394 @@ static void b43_lpphy_op_free(struct b43_wldev *dev)
        dev->phy.lp = NULL;
 }
 
-static int b43_lpphy_op_init(struct b43_wldev *dev)
+static void lpphy_table_init(struct b43_wldev *dev)
+{
+       //TODO
+}
+
+static void lpphy_baseband_rev0_1_init(struct b43_wldev *dev)
+{
+       B43_WARN_ON(1);//TODO rev < 2 not supported, yet.
+}
+
+static void lpphy_baseband_rev2plus_init(struct b43_wldev *dev)
+{
+       struct ssb_bus *bus = dev->dev->bus;
+       struct b43_phy_lp *lpphy = dev->phy.lp;
+
+       b43_phy_write(dev, B43_LPPHY_AFE_DAC_CTL, 0x50);
+       b43_phy_write(dev, B43_LPPHY_AFE_CTL, 0x8800);
+       b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVR, 0);
+       b43_phy_write(dev, B43_LPPHY_AFE_CTL_OVRVAL, 0);
+       b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_0, 0);
+       b43_phy_write(dev, B43_LPPHY_RF_OVERRIDE_2, 0);
+       b43_phy_write(dev, B43_PHY_OFDM(0xF9), 0);
+       b43_phy_write(dev, B43_LPPHY_TR_LOOKUP_1, 0);
+       b43_phy_set(dev, B43_LPPHY_ADC_COMPENSATION_CTL, 0x10);
+       b43_phy_maskset(dev, B43_LPPHY_OFDMSYNCTHRESH0, 0xFF00, 0x78);
+       b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xF8FF, 0x200);
+       b43_phy_maskset(dev, B43_LPPHY_DCOFFSETTRANSIENT, 0xFF00, 0x7F);
+       b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xFF0F, 0x40);
+       b43_phy_maskset(dev, B43_LPPHY_PREAMBLECONFIRMTO, 0xFF00, 0x2);
+       b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x4000);
+       b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x2000);
+       b43_phy_set(dev, B43_PHY_OFDM(0x10A), 0x1);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0x10A), 0xFF01, 0x10);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0xFF00, 0xF4);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0xDF), 0x00FF, 0xF100);
+       b43_phy_write(dev, B43_LPPHY_CLIPTHRESH, 0x48);
+       b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0xFF00, 0x46);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0xE4), 0xFF00, 0x10);
+       b43_phy_maskset(dev, B43_LPPHY_PWR_THRESH1, 0xFFF0, 0x9);
+       b43_phy_mask(dev, B43_LPPHY_GAINDIRECTMISMATCH, ~0xF);
+       b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0x00FF, 0x5500);
+       b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xF81F, 0xA0);
+       b43_phy_maskset(dev, B43_LPPHY_GAINDIRECTMISMATCH, 0xE0FF, 0x300);
+       b43_phy_maskset(dev, B43_LPPHY_HIGAINDB, 0x00FF, 0x2A00);
+       if ((bus->chip_id == 0x4325) && (bus->chip_rev == 0)) {
+               b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x2100);
+               b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xA);
+       } else {
+               b43_phy_maskset(dev, B43_LPPHY_LOWGAINDB, 0x00FF, 0x1E00);
+               b43_phy_maskset(dev, B43_LPPHY_VERYLOWGAINDB, 0xFF00, 0xD);
+       }
+       b43_phy_maskset(dev, B43_PHY_OFDM(0xFE), 0xFFE0, 0x1F);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0xFFE0, 0xC);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0x100), 0xFF00, 0x19);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0x03FF, 0x3C00);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0xFE), 0xFC1F, 0x3E0);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0xFF), 0xFFE0, 0xC);
+       b43_phy_maskset(dev, B43_PHY_OFDM(0x100), 0x00FF, 0x1900);
+       b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0x83FF, 0x5800);
+       b43_phy_maskset(dev, B43_LPPHY_CLIPCTRTHRESH, 0xFFE0, 0x12);
+       b43_phy_maskset(dev, B43_LPPHY_GAINMISMATCH, 0x0FFF, 0x9000);
+
+       b43_lptab_write(dev, B43_LPTAB16(0x08, 0x14), 0);
+       b43_lptab_write(dev, B43_LPTAB16(0x08, 0x12), 0x40);
+
+       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+               b43_phy_set(dev, B43_LPPHY_CRSGAIN_CTL, 0x40);
+               b43_phy_maskset(dev, B43_LPPHY_CRSGAIN_CTL, 0xF0FF, 0xB00);
+               b43_phy_maskset(dev, B43_LPPHY_SYNCPEAKCNT, 0xFFF8, 0x6);
+               b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0x00FF, 0x9D00);
+               b43_phy_maskset(dev, B43_LPPHY_MINPWR_LEVEL, 0xFF00, 0xA1);
+       } else /* 5GHz */
+               b43_phy_mask(dev, B43_LPPHY_CRSGAIN_CTL, ~0x40);
+
+       b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0xFF00, 0xB3);
+       b43_phy_maskset(dev, B43_LPPHY_CRS_ED_THRESH, 0x00FF, 0xAD00);
+       b43_phy_maskset(dev, B43_LPPHY_INPUT_PWRDB, 0xFF00, lpphy->rx_pwr_offset);
+       b43_phy_set(dev, B43_LPPHY_RESET_CTL, 0x44);
+       b43_phy_write(dev, B43_LPPHY_RESET_CTL, 0x80);
+       b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_0, 0xA954);
+       b43_phy_write(dev, B43_LPPHY_AFE_RSSI_CTL_1,
+                     0x2000 | ((u16)lpphy->rssi_gs << 10) |
+                     ((u16)lpphy->rssi_vc << 4) | lpphy->rssi_vf);
+}
+
+static void lpphy_baseband_init(struct b43_wldev *dev)
+{
+       lpphy_table_init(dev);
+       if (dev->phy.rev >= 2)
+               lpphy_baseband_rev2plus_init(dev);
+       else
+               lpphy_baseband_rev0_1_init(dev);
+}
+
+struct b2062_freqdata {
+       u16 freq;
+       u8 data[6];
+};
+
+/* Initialize the 2062 radio. */
+static void lpphy_2062_init(struct b43_wldev *dev)
+{
+       struct ssb_bus *bus = dev->dev->bus;
+       u32 crystalfreq, pdiv, tmp, ref;
+       unsigned int i;
+       const struct b2062_freqdata *fd = NULL;
+
+       static const struct b2062_freqdata freqdata_tab[] = {
+               { .freq = 12000, .data[0] =  6, .data[1] =  6, .data[2] =  6,
+                                .data[3] =  6, .data[4] = 10, .data[5] =  6, },
+               { .freq = 13000, .data[0] =  4, .data[1] =  4, .data[2] =  4,
+                                .data[3] =  4, .data[4] = 11, .data[5] =  7, },
+               { .freq = 14400, .data[0] =  3, .data[1] =  3, .data[2] =  3,
+                                .data[3] =  3, .data[4] = 12, .data[5] =  7, },
+               { .freq = 16200, .data[0] =  3, .data[1] =  3, .data[2] =  3,
+                                .data[3] =  3, .data[4] = 13, .data[5] =  8, },
+               { .freq = 18000, .data[0] =  2, .data[1] =  2, .data[2] =  2,
+                                .data[3] =  2, .data[4] = 14, .data[5] =  8, },
+               { .freq = 19200, .data[0] =  1, .data[1] =  1, .data[2] =  1,
+                                .data[3] =  1, .data[4] = 14, .data[5] =  9, },
+       };
+
+       b2062_upload_init_table(dev);
+
+       b43_radio_write(dev, B2062_N_TX_CTL3, 0);
+       b43_radio_write(dev, B2062_N_TX_CTL4, 0);
+       b43_radio_write(dev, B2062_N_TX_CTL5, 0);
+       b43_radio_write(dev, B2062_N_PDN_CTL0, 0x40);
+       b43_radio_write(dev, B2062_N_PDN_CTL0, 0);
+       b43_radio_write(dev, B2062_N_CALIB_TS, 0x10);
+       b43_radio_write(dev, B2062_N_CALIB_TS, 0);
+       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               b43_radio_set(dev, B2062_N_TSSI_CTL0, 0x1);
+       else
+               b43_radio_mask(dev, B2062_N_TSSI_CTL0, ~0x1);
+
+       /* Get the crystal freq, in Hz. */
+       crystalfreq = bus->chipco.pmu.crystalfreq * 1000;
+
+       B43_WARN_ON(!(bus->chipco.capabilities & SSB_CHIPCO_CAP_PMU));
+       B43_WARN_ON(crystalfreq == 0);
+
+       if (crystalfreq >= 30000000) {
+               pdiv = 1;
+               b43_radio_mask(dev, B2062_S_RFPLL_CTL1, 0xFFFB);
+       } else {
+               pdiv = 2;
+               b43_radio_set(dev, B2062_S_RFPLL_CTL1, 0x4);
+       }
+
+       tmp = (800000000 * pdiv + crystalfreq) / (32000000 * pdiv);
+       tmp = (tmp - 1) & 0xFF;
+       b43_radio_write(dev, B2062_S_RFPLL_CTL18, tmp);
+
+       tmp = (2 * crystalfreq + 1000000 * pdiv) / (2000000 * pdiv);
+       tmp = ((tmp & 0xFF) - 1) & 0xFFFF;
+       b43_radio_write(dev, B2062_S_RFPLL_CTL19, tmp);
+
+       ref = (1000 * pdiv + 2 * crystalfreq) / (2000 * pdiv);
+       ref &= 0xFFFF;
+       for (i = 0; i < ARRAY_SIZE(freqdata_tab); i++) {
+               if (ref < freqdata_tab[i].freq) {
+                       fd = &freqdata_tab[i];
+                       break;
+               }
+       }
+       if (!fd)
+               fd = &freqdata_tab[ARRAY_SIZE(freqdata_tab) - 1];
+       b43dbg(dev->wl, "b2062: Using crystal tab entry %u kHz.\n",
+              fd->freq); /* FIXME: Keep this printk until the code is fully debugged. */
+
+       b43_radio_write(dev, B2062_S_RFPLL_CTL8,
+                       ((u16)(fd->data[1]) << 4) | fd->data[0]);
+       b43_radio_write(dev, B2062_S_RFPLL_CTL9,
+                       ((u16)(fd->data[3]) << 4) | fd->data[2]);
+       b43_radio_write(dev, B2062_S_RFPLL_CTL10, fd->data[4]);
+       b43_radio_write(dev, B2062_S_RFPLL_CTL11, fd->data[5]);
+}
+
+/* Initialize the 2063 radio. */
+static void lpphy_2063_init(struct b43_wldev *dev)
 {
        //TODO
+}
+
+static void lpphy_sync_stx(struct b43_wldev *dev)
+{
+       //TODO
+}
+
+static void lpphy_radio_init(struct b43_wldev *dev)
+{
+       /* The radio is attached through the 4wire bus. */
+       b43_phy_set(dev, B43_LPPHY_FOURWIRE_CTL, 0x2);
+       udelay(1);
+       b43_phy_mask(dev, B43_LPPHY_FOURWIRE_CTL, 0xFFFD);
+       udelay(1);
+
+       if (dev->phy.rev < 2) {
+               lpphy_2062_init(dev);
+       } else {
+               lpphy_2063_init(dev);
+               lpphy_sync_stx(dev);
+               b43_phy_write(dev, B43_PHY_OFDM(0xF0), 0x5F80);
+               b43_phy_write(dev, B43_PHY_OFDM(0xF1), 0);
+               //TODO Do something on the backplane
+       }
+}
+
+/* Read the TX power control mode from hardware. */
+static void lpphy_read_tx_pctl_mode_from_hardware(struct b43_wldev *dev)
+{
+       struct b43_phy_lp *lpphy = dev->phy.lp;
+       u16 ctl;
+
+       ctl = b43_phy_read(dev, B43_LPPHY_TX_PWR_CTL_CMD);
+       switch (ctl & B43_LPPHY_TX_PWR_CTL_CMD_MODE) {
+       case B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF:
+               lpphy->txpctl_mode = B43_LPPHY_TXPCTL_OFF;
+               break;
+       case B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW:
+               lpphy->txpctl_mode = B43_LPPHY_TXPCTL_SW;
+               break;
+       case B43_LPPHY_TX_PWR_CTL_CMD_MODE_HW:
+               lpphy->txpctl_mode = B43_LPPHY_TXPCTL_HW;
+               break;
+       default:
+               lpphy->txpctl_mode = B43_LPPHY_TXPCTL_UNKNOWN;
+               B43_WARN_ON(1);
+               break;
+       }
+}
+
+/* Set the TX power control mode in hardware. */
+static void lpphy_write_tx_pctl_mode_to_hardware(struct b43_wldev *dev)
+{
+       struct b43_phy_lp *lpphy = dev->phy.lp;
+       u16 ctl;
+
+       switch (lpphy->txpctl_mode) {
+       case B43_LPPHY_TXPCTL_OFF:
+               ctl = B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF;
+               break;
+       case B43_LPPHY_TXPCTL_HW:
+               ctl = B43_LPPHY_TX_PWR_CTL_CMD_MODE_HW;
+               break;
+       case B43_LPPHY_TXPCTL_SW:
+               ctl = B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW;
+               break;
+       default:
+               ctl = 0;
+               B43_WARN_ON(1);
+       }
+       b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD,
+                       (u16)~B43_LPPHY_TX_PWR_CTL_CMD_MODE, ctl);
+}
+
+static void lpphy_set_tx_power_control(struct b43_wldev *dev,
+                                      enum b43_lpphy_txpctl_mode mode)
+{
+       struct b43_phy_lp *lpphy = dev->phy.lp;
+       enum b43_lpphy_txpctl_mode oldmode;
+
+       oldmode = lpphy->txpctl_mode;
+       lpphy_read_tx_pctl_mode_from_hardware(dev);
+       if (lpphy->txpctl_mode == mode)
+               return;
+       lpphy->txpctl_mode = mode;
+
+       if (oldmode == B43_LPPHY_TXPCTL_HW) {
+               //TODO Update TX Power NPT
+               //TODO Clear all TX Power offsets
+       } else {
+               if (mode == B43_LPPHY_TXPCTL_HW) {
+                       //TODO Recalculate target TX power
+                       b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_CMD,
+                                       0xFF80, lpphy->tssi_idx);
+                       b43_phy_maskset(dev, B43_LPPHY_TX_PWR_CTL_NNUM,
+                                       0x8FFF, ((u16)lpphy->tssi_npt << 16));
+                       //TODO Set "TSSI Transmit Count" variable to total transmitted frame count
+                       //TODO Disable TX gain override
+                       lpphy->tx_pwr_idx_over = -1;
+               }
+       }
+       if (dev->phy.rev >= 2) {
+               if (mode == B43_LPPHY_TXPCTL_HW)
+                       b43_phy_maskset(dev, B43_PHY_OFDM(0xD0), 0xFD, 0x2);
+               else
+                       b43_phy_maskset(dev, B43_PHY_OFDM(0xD0), 0xFD, 0);
+       }
+       lpphy_write_tx_pctl_mode_to_hardware(dev);
+}
+
+static void lpphy_set_tx_power_by_index(struct b43_wldev *dev, u8 index)
+{
+       struct b43_phy_lp *lpphy = dev->phy.lp;
+
+       lpphy->tx_pwr_idx_over = index;
+       if (lpphy->txpctl_mode != B43_LPPHY_TXPCTL_OFF)
+               lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_SW);
+
+       //TODO
+}
+
+static void lpphy_btcoex_override(struct b43_wldev *dev)
+{
+       b43_write16(dev, B43_MMIO_BTCOEX_CTL, 0x3);
+       b43_write16(dev, B43_MMIO_BTCOEX_TXCTL, 0xFF);
+}
+
+static void lpphy_pr41573_workaround(struct b43_wldev *dev)
+{
+       struct b43_phy_lp *lpphy = dev->phy.lp;
+       u32 *saved_tab;
+       const unsigned int saved_tab_size = 256;
+       enum b43_lpphy_txpctl_mode txpctl_mode;
+       s8 tx_pwr_idx_over;
+       u16 tssi_npt, tssi_idx;
+
+       saved_tab = kcalloc(saved_tab_size, sizeof(saved_tab[0]), GFP_KERNEL);
+       if (!saved_tab) {
+               b43err(dev->wl, "PR41573 failed. Out of memory!\n");
+               return;
+       }
+
+       lpphy_read_tx_pctl_mode_from_hardware(dev);
+       txpctl_mode = lpphy->txpctl_mode;
+       tx_pwr_idx_over = lpphy->tx_pwr_idx_over;
+       tssi_npt = lpphy->tssi_npt;
+       tssi_idx = lpphy->tssi_idx;
+
+       if (dev->phy.rev < 2) {
+               b43_lptab_read_bulk(dev, B43_LPTAB32(10, 0x140),
+                                   saved_tab_size, saved_tab);
+       } else {
+               b43_lptab_read_bulk(dev, B43_LPTAB32(7, 0x140),
+                                   saved_tab_size, saved_tab);
+       }
+       //TODO
+
+       kfree(saved_tab);
+}
+
+static void lpphy_calibration(struct b43_wldev *dev)
+{
+       struct b43_phy_lp *lpphy = dev->phy.lp;
+       enum b43_lpphy_txpctl_mode saved_pctl_mode;
+
+       b43_mac_suspend(dev);
+
+       lpphy_btcoex_override(dev);
+       lpphy_read_tx_pctl_mode_from_hardware(dev);
+       saved_pctl_mode = lpphy->txpctl_mode;
+       lpphy_set_tx_power_control(dev, B43_LPPHY_TXPCTL_OFF);
+       //TODO Perform transmit power table I/Q LO calibration
+       if ((dev->phy.rev == 0) && (saved_pctl_mode != B43_LPPHY_TXPCTL_OFF))
+               lpphy_pr41573_workaround(dev);
+       //TODO If a full calibration has not been performed on this channel yet, perform PAPD TX-power calibration
+       lpphy_set_tx_power_control(dev, saved_pctl_mode);
+       //TODO Perform I/Q calibration with a single control value set
+
+       b43_mac_enable(dev);
+}
+
+/* Initialize TX power control */
+static void lpphy_tx_pctl_init(struct b43_wldev *dev)
+{
+       if (0/*FIXME HWPCTL capable */) {
+               //TODO
+       } else { /* This device is only software TX power control capable. */
+               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+                       //TODO
+               } else {
+                       //TODO
+               }
+               //TODO set BB multiplier to 0x0096
+       }
+}
+
+static int b43_lpphy_op_init(struct b43_wldev *dev)
+{
+       /* TODO: band SPROM */
+       lpphy_baseband_init(dev);
+       lpphy_radio_init(dev);
+       //TODO calibrate RC
+       //TODO set channel
+       lpphy_tx_pctl_init(dev);
+       //TODO full calib
 
        return 0;
 }
@@ -115,7 +502,9 @@ static int b43_lpphy_op_switch_channel(struct b43_wldev *dev,
 
 static unsigned int b43_lpphy_op_get_default_chan(struct b43_wldev *dev)
 {
-       return 1; /* Default to channel 1 */
+       if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ)
+               return 1;
+       return 36;
 }
 
 static void b43_lpphy_op_set_rx_antenna(struct b43_wldev *dev, int antenna)
index b0b5357abf932562dc56c706ff5ace81a6cdf886..18370b4ac38e60126d11b7f014bd097020965f04 100644 (file)
@@ -4,8 +4,285 @@
 /* Definitions for the LP-PHY */
 
 
+/* The CCK PHY register range. */
+#define B43_LPPHY_B_VERSION                    B43_PHY_CCK(0x00) /* B PHY version */
+#define B43_LPPHY_B_BBCONFIG                   B43_PHY_CCK(0x01) /* B PHY BBConfig */
+#define B43_LPPHY_B_RX_STAT0                   B43_PHY_CCK(0x04) /* B PHY RX Status0 */
+#define B43_LPPHY_B_RX_STAT1                   B43_PHY_CCK(0x05) /* B PHY RX Status1 */
+#define B43_LPPHY_B_CRS_THRESH                 B43_PHY_CCK(0x06) /* B PHY CRS Thresh */
+#define B43_LPPHY_B_TXERROR                    B43_PHY_CCK(0x07) /* B PHY TxError */
+#define B43_LPPHY_B_CHANNEL                    B43_PHY_CCK(0x08) /* B PHY Channel */
+#define B43_LPPHY_B_WORKAROUND                 B43_PHY_CCK(0x09) /* B PHY workaround */
+#define B43_LPPHY_B_TEST                       B43_PHY_CCK(0x0A) /* B PHY Test */
+#define B43_LPPHY_B_FOURWIRE_ADDR              B43_PHY_CCK(0x0B) /* B PHY Fourwire Address */
+#define B43_LPPHY_B_FOURWIRE_DATA_HI           B43_PHY_CCK(0x0C) /* B PHY Fourwire Data Hi */
+#define B43_LPPHY_B_FOURWIRE_DATA_LO           B43_PHY_CCK(0x0D) /* B PHY Fourwire Data Lo */
+#define B43_LPPHY_B_BIST_STAT                  B43_PHY_CCK(0x0E) /* B PHY Bist Status */
+#define B43_LPPHY_PA_RAMP_TX_TO                        B43_PHY_CCK(0x10) /* PA Ramp TX Timeout */
+#define B43_LPPHY_RF_SYNTH_DC_TIMER            B43_PHY_CCK(0x11) /* RF Synth DC Timer */
+#define B43_LPPHY_PA_RAMP_TX_TIME_IN           B43_PHY_CCK(0x12) /* PA ramp TX Time in */
+#define B43_LPPHY_RX_FILTER_TIME_IN            B43_PHY_CCK(0x13) /* RX Filter Time in */
+#define B43_LPPHY_PLL_COEFF_S                  B43_PHY_CCK(0x18) /* PLL Coefficient(s) */
+#define B43_LPPHY_PLL_OUT                      B43_PHY_CCK(0x19) /* PLL Out */
+#define B43_LPPHY_RSSI_THRES                   B43_PHY_CCK(0x20) /* RSSI Threshold */
+#define B43_LPPHY_IQ_THRES_HH                  B43_PHY_CCK(0x21) /* IQ Threshold HH */
+#define B43_LPPHY_IQ_THRES_H                   B43_PHY_CCK(0x22) /* IQ Threshold H */
+#define B43_LPPHY_IQ_THRES_L                   B43_PHY_CCK(0x23) /* IQ Threshold L */
+#define B43_LPPHY_IQ_THRES_LL                  B43_PHY_CCK(0x24) /* IQ Threshold LL */
+#define B43_LPPHY_AGC_GAIN                     B43_PHY_CCK(0x25) /* AGC Gain */
+#define B43_LPPHY_LNA_GAIN_RANGE               B43_PHY_CCK(0x26) /* LNA Gain Range */
+#define B43_LPPHY_JSSI                         B43_PHY_CCK(0x27) /* JSSI */
+#define B43_LPPHY_TSSI_CTL                     B43_PHY_CCK(0x28) /* TSSI Control */
+#define B43_LPPHY_TSSI                         B43_PHY_CCK(0x29) /* TSSI */
+#define B43_LPPHY_TR_LOSS                      B43_PHY_CCK(0x2A) /* TR Loss */
+#define B43_LPPHY_LO_LEAKAGE                   B43_PHY_CCK(0x2B) /* LO Leakage */
+#define B43_LPPHY_LO_RSSIACC                   B43_PHY_CCK(0x2C) /* LO RSSIAcc */
+#define B43_LPPHY_LO_IQ_MAG_ACC                        B43_PHY_CCK(0x2D) /* LO IQ Mag Acc */
+#define B43_LPPHY_TX_DCOFFSET1                 B43_PHY_CCK(0x2E) /* TX DCOffset1 */
+#define B43_LPPHY_TX_DCOFFSET2                 B43_PHY_CCK(0x2F) /* TX DCOffset2 */
+#define B43_LPPHY_SYNCPEAKCNT                  B43_PHY_CCK(0x30) /* SyncPeakCnt */
+#define B43_LPPHY_SYNCFREQ                     B43_PHY_CCK(0x31) /* SyncFreq */
+#define B43_LPPHY_SYNCDIVERSITYCTL             B43_PHY_CCK(0x32) /* SyncDiversityControl */
+#define B43_LPPHY_PEAKENERGYL                  B43_PHY_CCK(0x33) /* PeakEnergyL */
+#define B43_LPPHY_PEAKENERGYH                  B43_PHY_CCK(0x34) /* PeakEnergyH */
+#define B43_LPPHY_SYNCCTL                      B43_PHY_CCK(0x35) /* SyncControl */
+#define B43_LPPHY_DSSSSTEP                     B43_PHY_CCK(0x38) /* DsssStep */
+#define B43_LPPHY_DSSSWARMUP                   B43_PHY_CCK(0x39) /* DsssWarmup */
+#define B43_LPPHY_DSSSSIGPOW                   B43_PHY_CCK(0x3D) /* DsssSigPow */
+#define B43_LPPHY_SFDDETECTBLOCKTIME           B43_PHY_CCK(0x40) /* SfdDetectBlockTIme */
+#define B43_LPPHY_SFDTO                                B43_PHY_CCK(0x41) /* SFDTimeOut */
+#define B43_LPPHY_SFDCTL                       B43_PHY_CCK(0x42) /* SFDControl */
+#define B43_LPPHY_RXDBG                                B43_PHY_CCK(0x43) /* rxDebug */
+#define B43_LPPHY_RX_DELAYCOMP                 B43_PHY_CCK(0x44) /* RX DelayComp */
+#define B43_LPPHY_CRSDROPOUTTO                 B43_PHY_CCK(0x45) /* CRSDropoutTimeout */
+#define B43_LPPHY_PSEUDOSHORTTO                        B43_PHY_CCK(0x46) /* PseudoShortTimeout */
+#define B43_LPPHY_PR3931                       B43_PHY_CCK(0x47) /* PR3931 */
+#define B43_LPPHY_DSSSCOEFF1                   B43_PHY_CCK(0x48) /* DSSSCoeff1 */
+#define B43_LPPHY_DSSSCOEFF2                   B43_PHY_CCK(0x49) /* DSSSCoeff2 */
+#define B43_LPPHY_CCKCOEFF1                    B43_PHY_CCK(0x4A) /* CCKCoeff1 */
+#define B43_LPPHY_CCKCOEFF2                    B43_PHY_CCK(0x4B) /* CCKCoeff2 */
+#define B43_LPPHY_TRCORR                       B43_PHY_CCK(0x4C) /* TRCorr */
+#define B43_LPPHY_ANGLESCALE                   B43_PHY_CCK(0x4D) /* AngleScale */
+#define B43_LPPHY_OPTIONALMODES2               B43_PHY_CCK(0x4F) /* OptionalModes2 */
+#define B43_LPPHY_CCKLMSSTEPSIZE               B43_PHY_CCK(0x50) /* CCKLMSStepSize */
+#define B43_LPPHY_DFEBYPASS                    B43_PHY_CCK(0x51) /* DFEBypass */
+#define B43_LPPHY_CCKSTARTDELAYLONG            B43_PHY_CCK(0x52) /* CCKStartDelayLong */
+#define B43_LPPHY_CCKSTARTDELAYSHORT           B43_PHY_CCK(0x53) /* CCKStartDelayShort */
+#define B43_LPPHY_PPROCCHDELAY                 B43_PHY_CCK(0x54) /* PprocChDelay */
+#define B43_LPPHY_PPROCONOFF                   B43_PHY_CCK(0x55) /* PProcOnOff */
+#define B43_LPPHY_LNAGAINTWOBIT10              B43_PHY_CCK(0x5B) /* LNAGainTwoBit10 */
+#define B43_LPPHY_LNAGAINTWOBIT32              B43_PHY_CCK(0x5C) /* LNAGainTwoBit32 */
+#define B43_LPPHY_OPTIONALMODES                        B43_PHY_CCK(0x5D) /* OptionalModes */
+#define B43_LPPHY_B_RX_STAT2                   B43_PHY_CCK(0x5E) /* B PHY RX Status2 */
+#define B43_LPPHY_B_RX_STAT3                   B43_PHY_CCK(0x5F) /* B PHY RX Status3 */
+#define B43_LPPHY_PWDNDACDELAY                 B43_PHY_CCK(0x63) /* pwdnDacDelay */
+#define B43_LPPHY_FINEDIGIGAIN_CTL             B43_PHY_CCK(0x67) /* FineDigiGain Control */
+#define B43_LPPHY_LG2GAINTBLLNA8               B43_PHY_CCK(0x68) /* Lg2GainTblLNA8 */
+#define B43_LPPHY_LG2GAINTBLLNA28              B43_PHY_CCK(0x69) /* Lg2GainTblLNA28 */
+#define B43_LPPHY_GAINTBLLNATRSW               B43_PHY_CCK(0x6A) /* GainTblLNATrSw */
+#define B43_LPPHY_PEAKENERGY                   B43_PHY_CCK(0x6B) /* PeakEnergy */
+#define B43_LPPHY_LG2INITGAIN                  B43_PHY_CCK(0x6C) /* lg2InitGain */
+#define B43_LPPHY_BLANKCOUNTLNAPGA             B43_PHY_CCK(0x6D) /* BlankCountLnaPga */
+#define B43_LPPHY_LNAGAINTWOBIT54              B43_PHY_CCK(0x6E) /* LNAGainTwoBit54 */
+#define B43_LPPHY_LNAGAINTWOBIT76              B43_PHY_CCK(0x6F) /* LNAGainTwoBit76 */
+#define B43_LPPHY_JSSICTL                      B43_PHY_CCK(0x70) /* JSSIControl */
+#define B43_LPPHY_LG2GAINTBLLNA44              B43_PHY_CCK(0x71) /* Lg2GainTblLNA44 */
+#define B43_LPPHY_LG2GAINTBLLNA62              B43_PHY_CCK(0x72) /* Lg2GainTblLNA62 */
 
+/* The OFDM PHY register range. */
+#define B43_LPPHY_VERSION                      B43_PHY_OFDM(0x00) /* Version */
+#define B43_LPPHY_BBCONFIG                     B43_PHY_OFDM(0x01) /* BBConfig */
+#define B43_LPPHY_RX_STAT0                     B43_PHY_OFDM(0x04) /* RX Status0 */
+#define B43_LPPHY_RX_STAT1                     B43_PHY_OFDM(0x05) /* RX Status1 */
+#define B43_LPPHY_TX_ERROR                     B43_PHY_OFDM(0x07) /* TX Error */
+#define B43_LPPHY_CHANNEL                      B43_PHY_OFDM(0x08) /* Channel */
+#define B43_LPPHY_WORKAROUND                   B43_PHY_OFDM(0x09) /* workaround */
+#define B43_LPPHY_FOURWIRE_ADDR                        B43_PHY_OFDM(0x0B) /* Fourwire Address */
+#define B43_LPPHY_FOURWIREDATAHI               B43_PHY_OFDM(0x0C) /* FourwireDataHi */
+#define B43_LPPHY_FOURWIREDATALO               B43_PHY_OFDM(0x0D) /* FourwireDataLo */
+#define B43_LPPHY_BISTSTAT0                    B43_PHY_OFDM(0x0E) /* BistStatus0 */
+#define B43_LPPHY_BISTSTAT1                    B43_PHY_OFDM(0x0F) /* BistStatus1 */
+#define B43_LPPHY_CRSGAIN_CTL                  B43_PHY_OFDM(0x10) /* crsgain Control */
+#define B43_LPPHY_OFDMPWR_THRESH0              B43_PHY_OFDM(0x11) /* ofdmPower Thresh0 */
+#define B43_LPPHY_OFDMPWR_THRESH1              B43_PHY_OFDM(0x12) /* ofdmPower Thresh1 */
+#define B43_LPPHY_OFDMPWR_THRESH2              B43_PHY_OFDM(0x13) /* ofdmPower Thresh2 */
+#define B43_LPPHY_DSSSPWR_THRESH0              B43_PHY_OFDM(0x14) /* dsssPower Thresh0 */
+#define B43_LPPHY_DSSSPWR_THRESH1              B43_PHY_OFDM(0x15) /* dsssPower Thresh1 */
+#define B43_LPPHY_MINPWR_LEVEL                 B43_PHY_OFDM(0x16) /* MinPower Level */
+#define B43_LPPHY_OFDMSYNCTHRESH0              B43_PHY_OFDM(0x17) /* ofdmSyncThresh0 */
+#define B43_LPPHY_OFDMSYNCTHRESH1              B43_PHY_OFDM(0x18) /* ofdmSyncThresh1 */
+#define B43_LPPHY_FINEFREQEST                  B43_PHY_OFDM(0x19) /* FineFreqEst */
+#define B43_LPPHY_IDLEAFTERPKTRXTO             B43_PHY_OFDM(0x1A) /* IDLEafterPktRXTimeout */
+#define B43_LPPHY_LTRN_CTL                     B43_PHY_OFDM(0x1B) /* LTRN Control */
+#define B43_LPPHY_DCOFFSETTRANSIENT            B43_PHY_OFDM(0x1C) /* DCOffsetTransient */
+#define B43_LPPHY_PREAMBLEINTO                 B43_PHY_OFDM(0x1D) /* PreambleInTimeout */
+#define B43_LPPHY_PREAMBLECONFIRMTO            B43_PHY_OFDM(0x1E) /* PreambleConfirmTimeout */
+#define B43_LPPHY_CLIPTHRESH                   B43_PHY_OFDM(0x1F) /* ClipThresh */
+#define B43_LPPHY_CLIPCTRTHRESH                        B43_PHY_OFDM(0x20) /* ClipCtrThresh */
+#define B43_LPPHY_OFDMSYNCTIMER_CTL            B43_PHY_OFDM(0x21) /* ofdmSyncTimer Control */
+#define B43_LPPHY_WAITFORPHYSELTO              B43_PHY_OFDM(0x22) /* WaitforPHYSelTimeout */
+#define B43_LPPHY_HIGAINDB                     B43_PHY_OFDM(0x23) /* HiGainDB */
+#define B43_LPPHY_LOWGAINDB                    B43_PHY_OFDM(0x24) /* LowGainDB */
+#define B43_LPPHY_VERYLOWGAINDB                        B43_PHY_OFDM(0x25) /* VeryLowGainDB */
+#define B43_LPPHY_GAINMISMATCH                 B43_PHY_OFDM(0x26) /* gainMismatch */
+#define B43_LPPHY_GAINDIRECTMISMATCH           B43_PHY_OFDM(0x27) /* gaindirectMismatch */
+#define B43_LPPHY_PWR_THRESH0                  B43_PHY_OFDM(0x28) /* Power Thresh0 */
+#define B43_LPPHY_PWR_THRESH1                  B43_PHY_OFDM(0x29) /* Power Thresh1 */
+#define B43_LPPHY_DETECTOR_DELAY_ADJUST                B43_PHY_OFDM(0x2A) /* Detector Delay Adjust */
+#define B43_LPPHY_REDUCED_DETECTOR_DELAY       B43_PHY_OFDM(0x2B) /* Reduced Detector Delay */
+#define B43_LPPHY_DATA_TO                      B43_PHY_OFDM(0x2C) /* data Timeout */
+#define B43_LPPHY_CORRELATOR_DIS_DELAY         B43_PHY_OFDM(0x2D) /* correlator Dis Delay */
+#define B43_LPPHY_DIVERSITY_GAINBACK           B43_PHY_OFDM(0x2E) /* Diversity GainBack */
+#define B43_LPPHY_DSSS_CONFIRM_CNT             B43_PHY_OFDM(0x2F) /* DSSS Confirm Cnt */
+#define B43_LPPHY_DC_BLANK_INT                 B43_PHY_OFDM(0x30) /* DC Blank Interval */
+#define B43_LPPHY_GAIN_MISMATCH_LIMIT          B43_PHY_OFDM(0x31) /* gain Mismatch Limit */
+#define B43_LPPHY_CRS_ED_THRESH                        B43_PHY_OFDM(0x32) /* crs ed thresh */
+#define B43_LPPHY_PHASE_SHIFT_CTL              B43_PHY_OFDM(0x33) /* phase shift Control */
+#define B43_LPPHY_INPUT_PWRDB                  B43_PHY_OFDM(0x34) /* Input PowerDB */
+#define B43_LPPHY_OFDM_SYNC_CTL                        B43_PHY_OFDM(0x35) /* ofdm sync Control */
+#define B43_LPPHY_AFE_ADC_CTL_0                        B43_PHY_OFDM(0x36) /* Afe ADC Control 0 */
+#define B43_LPPHY_AFE_ADC_CTL_1                        B43_PHY_OFDM(0x37) /* Afe ADC Control 1 */
+#define B43_LPPHY_AFE_ADC_CTL_2                        B43_PHY_OFDM(0x38) /* Afe ADC Control 2 */
+#define B43_LPPHY_AFE_DAC_CTL                  B43_PHY_OFDM(0x39) /* Afe DAC Control */
+#define B43_LPPHY_AFE_CTL                      B43_PHY_OFDM(0x3A) /* Afe Control */
+#define B43_LPPHY_AFE_CTL_OVR                  B43_PHY_OFDM(0x3B) /* Afe Control Ovr */
+#define B43_LPPHY_AFE_CTL_OVRVAL               B43_PHY_OFDM(0x3C) /* Afe Control OvrVal */
+#define B43_LPPHY_AFE_RSSI_CTL_0               B43_PHY_OFDM(0x3D) /* Afe RSSI Control 0 */
+#define B43_LPPHY_AFE_RSSI_CTL_1               B43_PHY_OFDM(0x3E) /* Afe RSSI Control 1 */
+#define B43_LPPHY_AFE_RSSI_SEL                 B43_PHY_OFDM(0x3F) /* Afe RSSI Sel */
+#define B43_LPPHY_RADAR_THRESH                 B43_PHY_OFDM(0x40) /* Radar Thresh */
+#define B43_LPPHY_RADAR_BLANK_INT              B43_PHY_OFDM(0x41) /* Radar blank Interval */
+#define B43_LPPHY_RADAR_MIN_FM_INT             B43_PHY_OFDM(0x42) /* Radar min fm Interval */
+#define B43_LPPHY_RADAR_GAIN_TO                        B43_PHY_OFDM(0x43) /* Radar gain timeout */
+#define B43_LPPHY_RADAR_PULSE_TO               B43_PHY_OFDM(0x44) /* Radar pulse timeout */
+#define B43_LPPHY_RADAR_DETECT_FM_CTL          B43_PHY_OFDM(0x45) /* Radar detect FM Control */
+#define B43_LPPHY_RADAR_DETECT_EN              B43_PHY_OFDM(0x46) /* Radar detect En */
+#define B43_LPPHY_RADAR_RD_DATA_REG            B43_PHY_OFDM(0x47) /* Radar Rd Data Reg */
+#define B43_LPPHY_LP_PHY_CTL                   B43_PHY_OFDM(0x48) /* LP PHY Control */
+#define B43_LPPHY_CLASSIFIER_CTL               B43_PHY_OFDM(0x49) /* classifier Control */
+#define B43_LPPHY_RESET_CTL                    B43_PHY_OFDM(0x4A) /* reset Control */
+#define B43_LPPHY_CLKEN_CTL                    B43_PHY_OFDM(0x4B) /* ClkEn Control */
+#define B43_LPPHY_RF_OVERRIDE_0                        B43_PHY_OFDM(0x4C) /* RF Override 0 */
+#define B43_LPPHY_RF_OVERRIDE_VAL_0            B43_PHY_OFDM(0x4D) /* RF Override Val 0 */
+#define B43_LPPHY_TR_LOOKUP_1                  B43_PHY_OFDM(0x4E) /* TR Lookup 1 */
+#define B43_LPPHY_TR_LOOKUP_2                  B43_PHY_OFDM(0x4F) /* TR Lookup 2 */
+#define B43_LPPHY_RSSISELLOOKUP1               B43_PHY_OFDM(0x50) /* RssiSelLookup1 */
+#define B43_LPPHY_IQLO_CAL_CMD                 B43_PHY_OFDM(0x51) /* iqlo Cal Cmd */
+#define B43_LPPHY_IQLO_CAL_CMD_N_NUM           B43_PHY_OFDM(0x52) /* iqlo Cal Cmd N num */
+#define B43_LPPHY_IQLO_CAL_CMD_G_CTL           B43_PHY_OFDM(0x53) /* iqlo Cal Cmd G control */
+#define B43_LPPHY_MACINT_DBG_REGISTER          B43_PHY_OFDM(0x54) /* macint Debug Register */
+#define B43_LPPHY_TABLE_ADDR                   B43_PHY_OFDM(0x55) /* Table Address */
+#define B43_LPPHY_TABLEDATALO                  B43_PHY_OFDM(0x56) /* TabledataLo */
+#define B43_LPPHY_TABLEDATAHI                  B43_PHY_OFDM(0x57) /* TabledataHi */
+#define B43_LPPHY_PHY_CRS_ENABLE_ADDR          B43_PHY_OFDM(0x58) /* phy CRS Enable Address */
+#define B43_LPPHY_IDLETIME_CTL                 B43_PHY_OFDM(0x59) /* Idletime Control */
+#define B43_LPPHY_IDLETIME_CRS_ON_LO           B43_PHY_OFDM(0x5A) /* Idletime CRS On Lo */
+#define B43_LPPHY_IDLETIME_CRS_ON_HI           B43_PHY_OFDM(0x5B) /* Idletime CRS On Hi */
+#define B43_LPPHY_IDLETIME_MEAS_TIME_LO                B43_PHY_OFDM(0x5C) /* Idletime Meas Time Lo */
+#define B43_LPPHY_IDLETIME_MEAS_TIME_HI                B43_PHY_OFDM(0x5D) /* Idletime Meas Time Hi */
+#define B43_LPPHY_RESET_LEN_OFDM_TX_ADDR       B43_PHY_OFDM(0x5E) /* Reset len Ofdm TX Address */
+#define B43_LPPHY_RESET_LEN_OFDM_RX_ADDR       B43_PHY_OFDM(0x5F) /* Reset len Ofdm RX Address */
+#define B43_LPPHY_REG_CRS_ENABLE               B43_PHY_OFDM(0x60) /* reg crs enable */
+#define B43_LPPHY_PLCP_TMT_STR0_CTR_MIN                B43_PHY_OFDM(0x61) /* PLCP Tmt Str0 Ctr Min */
+#define B43_LPPHY_PKT_FSM_RESET_LEN_VAL                B43_PHY_OFDM(0x62) /* Pkt fsm Reset Len Value */
+#define B43_LPPHY_READSYM2RESET_CTL            B43_PHY_OFDM(0x63) /* readsym2reset Control */
+#define B43_LPPHY_DC_FILTER_DELAY1             B43_PHY_OFDM(0x64) /* Dc filter delay1 */
+#define B43_LPPHY_PACKET_RX_ACTIVE_TO          B43_PHY_OFDM(0x65) /* packet rx Active timeout */
+#define B43_LPPHY_ED_TOVAL                     B43_PHY_OFDM(0x66) /* ed timeoutValue */
+#define B43_LPPHY_HOLD_CRS_ON_VAL              B43_PHY_OFDM(0x67) /* hold CRS On Value */
+#define B43_LPPHY_OFDM_TX_PHY_CRS_DELAY_VAL    B43_PHY_OFDM(0x69) /* ofdm tx phy CRS Delay Value */
+#define B43_LPPHY_CCK_TX_PHY_CRS_DELAY_VAL     B43_PHY_OFDM(0x6A) /* cck tx phy CRS Delay Value */
+#define B43_LPPHY_ED_ON_CONFIRM_TIMER_VAL      B43_PHY_OFDM(0x6B) /* Ed on confirm Timer Value */
+#define B43_LPPHY_ED_OFFSET_CONFIRM_TIMER_VAL  B43_PHY_OFDM(0x6C) /* Ed offset confirm Timer Value */
+#define B43_LPPHY_PHY_CRS_OFFSET_TIMER_VAL     B43_PHY_OFDM(0x6D) /* phy CRS offset Timer Value */
+#define B43_LPPHY_ADC_COMPENSATION_CTL         B43_PHY_OFDM(0x70) /* ADC Compensation Control */
+#define B43_LPPHY_LOG2_RBPSK_ADDR              B43_PHY_OFDM(0x71) /* log2 RBPSK Address */
+#define B43_LPPHY_LOG2_RQPSK_ADDR              B43_PHY_OFDM(0x72) /* log2 RQPSK Address */
+#define B43_LPPHY_LOG2_R16QAM_ADDR             B43_PHY_OFDM(0x73) /* log2 R16QAM Address */
+#define B43_LPPHY_LOG2_R64QAM_ADDR             B43_PHY_OFDM(0x74) /* log2 R64QAM Address */
+#define B43_LPPHY_OFFSET_BPSK_ADDR             B43_PHY_OFDM(0x75) /* offset BPSK Address */
+#define B43_LPPHY_OFFSET_QPSK_ADDR             B43_PHY_OFDM(0x76) /* offset QPSK Address */
+#define B43_LPPHY_OFFSET_16QAM_ADDR            B43_PHY_OFDM(0x77) /* offset 16QAM Address */
+#define B43_LPPHY_OFFSET_64QAM_ADDR            B43_PHY_OFDM(0x78) /* offset 64QAM Address */
+#define B43_LPPHY_ALPHA1                       B43_PHY_OFDM(0x79) /* Alpha1 */
+#define B43_LPPHY_ALPHA2                       B43_PHY_OFDM(0x7A) /* Alpha2 */
+#define B43_LPPHY_BETA1                                B43_PHY_OFDM(0x7B) /* Beta1 */
+#define B43_LPPHY_BETA2                                B43_PHY_OFDM(0x7C) /* Beta2 */
+#define B43_LPPHY_LOOP_NUM_ADDR                        B43_PHY_OFDM(0x7D) /* Loop Num Address */
+#define B43_LPPHY_STR_COLLMAX_SMPL_ADDR                B43_PHY_OFDM(0x7E) /* Str Collmax Sample Address */
+#define B43_LPPHY_MAX_SMPL_COARSE_FINE_ADDR    B43_PHY_OFDM(0x7F) /* Max Sample Coarse/Fine Address */
+#define B43_LPPHY_MAX_SMPL_COARSE_STR0CTR_ADDR B43_PHY_OFDM(0x80) /* Max Sample Coarse/Str0Ctr Address */
+#define B43_LPPHY_IQ_ENABLE_WAIT_TIME_ADDR     B43_PHY_OFDM(0x81) /* IQ Enable Wait Time Address */
+#define B43_LPPHY_IQ_NUM_SMPLS_ADDR            B43_PHY_OFDM(0x82) /* IQ Num Samples Address */
+#define B43_LPPHY_IQ_ACC_HI_ADDR               B43_PHY_OFDM(0x83) /* IQ Acc Hi Address */
+#define B43_LPPHY_IQ_ACC_LO_ADDR               B43_PHY_OFDM(0x84) /* IQ Acc Lo Address */
+#define B43_LPPHY_IQ_I_PWR_ACC_HI_ADDR         B43_PHY_OFDM(0x85) /* IQ I PWR Acc Hi Address */
+#define B43_LPPHY_IQ_I_PWR_ACC_LO_ADDR         B43_PHY_OFDM(0x86) /* IQ I PWR Acc Lo Address */
+#define B43_LPPHY_IQ_Q_PWR_ACC_HI_ADDR         B43_PHY_OFDM(0x87) /* IQ Q PWR Acc Hi Address */
+#define B43_LPPHY_IQ_Q_PWR_ACC_LO_ADDR         B43_PHY_OFDM(0x88) /* IQ Q PWR Acc Lo Address */
+#define B43_LPPHY_MAXNUMSTEPS                  B43_PHY_OFDM(0x89) /* MaxNumsteps */
+#define B43_LPPHY_ROTORPHASE_ADDR              B43_PHY_OFDM(0x8A) /* RotorPhase Address */
+#define B43_LPPHY_ADVANCEDRETARDROTOR_ADDR     B43_PHY_OFDM(0x8B) /* AdvancedRetardRotor Address */
+#define B43_LPPHY_RSSIADCDELAY_CTL_ADDR                B43_PHY_OFDM(0x8D) /* rssiAdcdelay Control Address */
+#define B43_LPPHY_TSSISTAT_ADDR                        B43_PHY_OFDM(0x8E) /* tssiStatus Address */
+#define B43_LPPHY_TEMPSENSESTAT_ADDR           B43_PHY_OFDM(0x8F) /* tempsenseStatus Address */
+#define B43_LPPHY_TEMPSENSE_CTL_ADDR           B43_PHY_OFDM(0x90) /* tempsense Control Address */
+#define B43_LPPHY_WRSSISTAT_ADDR               B43_PHY_OFDM(0x91) /* wrssistatus Address */
+#define B43_LPPHY_MUFACTORADDR                 B43_PHY_OFDM(0x92) /* mufactoraddr */
+#define B43_LPPHY_SCRAMSTATE_ADDR              B43_PHY_OFDM(0x93) /* scramstate Address */
+#define B43_LPPHY_TXHOLDOFFADDR                        B43_PHY_OFDM(0x94) /* txholdoffaddr */
+#define B43_LPPHY_PKTGAINVAL_ADDR              B43_PHY_OFDM(0x95) /* pktgainval Address */
+#define B43_LPPHY_COARSEESTIM_ADDR             B43_PHY_OFDM(0x96) /* Coarseestim Address */
+#define B43_LPPHY_STATE_TRANSITION_ADDR                B43_PHY_OFDM(0x97) /* state Transition Address */
+#define B43_LPPHY_TRN_OFFSET_ADDR              B43_PHY_OFDM(0x98) /* TRN offset Address */
+#define B43_LPPHY_NUM_ROTOR_ADDR               B43_PHY_OFDM(0x99) /* Num Rotor Address */
+#define B43_LPPHY_VITERBI_OFFSET_ADDR          B43_PHY_OFDM(0x9A) /* Viterbi Offset Address */
+#define B43_LPPHY_SMPL_COLLECT_WAIT_ADDR       B43_PHY_OFDM(0x9B) /* Sample collect wait Address */
+#define B43_LPPHY_A_PHY_CTL_ADDR               B43_PHY_OFDM(0x9C) /* A PHY Control Address */
+#define B43_LPPHY_NUM_PASS_THROUGH_ADDR                B43_PHY_OFDM(0x9D) /* Num Pass Through Address */
+#define B43_LPPHY_RX_COMP_COEFF_S              B43_PHY_OFDM(0x9E) /* RX Comp coefficient(s) */
+#define B43_LPPHY_CPAROTATEVAL                 B43_PHY_OFDM(0x9F) /* cpaRotateValue */
+#define B43_LPPHY_SMPL_PLAY_COUNT              B43_PHY_OFDM(0xA0) /* Sample play count */
+#define B43_LPPHY_SMPL_PLAY_BUFFER_CTL         B43_PHY_OFDM(0xA1) /* Sample play Buffer Control */
+#define B43_LPPHY_FOURWIRE_CTL                 B43_PHY_OFDM(0xA2) /* fourwire Control */
+#define B43_LPPHY_CPA_TAILCOUNT_VAL            B43_PHY_OFDM(0xA3) /* CPA TailCount Value */
+#define B43_LPPHY_TX_PWR_CTL_CMD               B43_PHY_OFDM(0xA4) /* TX Power Control Cmd */
+#define  B43_LPPHY_TX_PWR_CTL_CMD_MODE         0xE000 /* TX power control mode mask */
+#define   B43_LPPHY_TX_PWR_CTL_CMD_MODE_OFF    0x0000 /* TX power control is OFF */
+#define   B43_LPPHY_TX_PWR_CTL_CMD_MODE_SW     0x8000 /* TX power control is SOFTWARE */
+#define   B43_LPPHY_TX_PWR_CTL_CMD_MODE_HW     0xE000 /* TX power control is HARDWARE */
+#define B43_LPPHY_TX_PWR_CTL_NNUM              B43_PHY_OFDM(0xA5) /* TX Power Control Nnum */
+#define B43_LPPHY_TX_PWR_CTL_IDLETSSI          B43_PHY_OFDM(0xA6) /* TX Power Control IdleTssi */
+#define B43_LPPHY_TX_PWR_CTL_TARGETPWR         B43_PHY_OFDM(0xA7) /* TX Power Control TargetPower */
+#define B43_LPPHY_TX_PWR_CTL_DELTAPWR_LIMIT    B43_PHY_OFDM(0xA8) /* TX Power Control DeltaPower Limit */
+#define B43_LPPHY_TX_PWR_CTL_BASEINDEX         B43_PHY_OFDM(0xA9) /* TX Power Control BaseIndex */
+#define B43_LPPHY_TX_PWR_CTL_PWR_INDEX         B43_PHY_OFDM(0xAA) /* TX Power Control Power Index */
+#define B43_LPPHY_TX_PWR_CTL_STAT              B43_PHY_OFDM(0xAB) /* TX Power Control Status */
+#define B43_LPPHY_LP_RF_SIGNAL_LUT             B43_PHY_OFDM(0xAC) /* LP RF signal LUT */
+#define B43_LPPHY_RX_RADIO_CTL_FILTER_STATE    B43_PHY_OFDM(0xAD) /* RX Radio Control Filter State */
+#define B43_LPPHY_RX_RADIO_CTL                 B43_PHY_OFDM(0xAE) /* RX Radio Control */
+#define B43_LPPHY_NRSSI_STAT_ADDR              B43_PHY_OFDM(0xAF) /* NRSSI status Address */
+#define B43_LPPHY_RF_OVERRIDE_2                        B43_PHY_OFDM(0xB0) /* RF override 2 */
+#define B43_LPPHY_RF_OVERRIDE_2_VAL            B43_PHY_OFDM(0xB1) /* RF override 2 val */
+#define B43_LPPHY_PS_CTL_OVERRIDE_VAL0         B43_PHY_OFDM(0xB2) /* PS Control override val0 */
+#define B43_LPPHY_PS_CTL_OVERRIDE_VAL1         B43_PHY_OFDM(0xB3) /* PS Control override val1 */
+#define B43_LPPHY_PS_CTL_OVERRIDE_VAL2         B43_PHY_OFDM(0xB4) /* PS Control override val2 */
+#define B43_LPPHY_TX_GAIN_CTL_OVERRIDE_VAL     B43_PHY_OFDM(0xB5) /* TX gain Control override val */
+#define B43_LPPHY_RX_GAIN_CTL_OVERRIDE_VAL     B43_PHY_OFDM(0xB6) /* RX gain Control override val */
+#define B43_LPPHY_AFE_DDFS                     B43_PHY_OFDM(0xB7) /* AFE DDFS */
+#define B43_LPPHY_AFE_DDFS_POINTER_INIT                B43_PHY_OFDM(0xB8) /* AFE DDFS pointer init */
+#define B43_LPPHY_AFE_DDFS_INCR_INIT           B43_PHY_OFDM(0xB9) /* AFE DDFS incr init */
+#define B43_LPPHY_MRCNOISEREDUCTION            B43_PHY_OFDM(0xBA) /* mrcNoiseReduction */
+#define B43_LPPHY_TRLOOKUP3                    B43_PHY_OFDM(0xBB) /* TRLookup3 */
+#define B43_LPPHY_TRLOOKUP4                    B43_PHY_OFDM(0xBC) /* TRLookup4 */
+#define B43_LPPHY_RADAR_FIFO_STAT              B43_PHY_OFDM(0xBD) /* Radar FIFO Status */
+#define B43_LPPHY_GPIO_OUTEN                   B43_PHY_OFDM(0xBE) /* GPIO Out enable */
+#define B43_LPPHY_GPIO_SELECT                  B43_PHY_OFDM(0xBF) /* GPIO Select */
+#define B43_LPPHY_GPIO_OUT                     B43_PHY_OFDM(0xC0) /* GPIO Out */
 
+
+
+/* Radio register access decorators. */
 #define B43_LP_RADIO(radio_reg)                        (radio_reg)
 #define B43_LP_NORTH(radio_reg)                        B43_LP_RADIO(radio_reg)
 #define B43_LP_SOUTH(radio_reg)                        B43_LP_RADIO((radio_reg) | 0x4000)
 
 
 
+enum b43_lpphy_txpctl_mode {
+       B43_LPPHY_TXPCTL_UNKNOWN = 0,
+       B43_LPPHY_TXPCTL_OFF,   /* TX power control is OFF */
+       B43_LPPHY_TXPCTL_SW,    /* TX power control is set to Software */
+       B43_LPPHY_TXPCTL_HW,    /* TX power control is set to Hardware */
+};
+
 struct b43_phy_lp {
-       //TODO
+       /* Current TX power control mode. */
+       enum b43_lpphy_txpctl_mode txpctl_mode;
+
+       /* Transmit isolation medium band */
+       u8 tx_isolation_med_band; /* FIXME initial value? */
+       /* Transmit isolation low band */
+       u8 tx_isolation_low_band; /* FIXME initial value? */
+       /* Transmit isolation high band */
+       u8 tx_isolation_hi_band; /* FIXME initial value? */
+
+       /* Receive power offset */
+       u8 rx_pwr_offset; /* FIXME initial value? */
+
+       /* TSSI transmit count */
+       u16 tssi_tx_count;
+       /* TSSI index */
+       u16 tssi_idx; /* FIXME initial value? */
+       /* TSSI npt */
+       u16 tssi_npt; /* FIXME initial value? */
+
+       /* Target TX frequency */
+       u16 tgt_tx_freq; /* FIXME initial value? */
+
+       /* Transmit power index override */
+       s8 tx_pwr_idx_over; /* FIXME initial value? */
+
+       /* RSSI vf */
+       u8 rssi_vf; /* FIXME initial value? */
+       /* RSSI vc */
+       u8 rssi_vc; /* FIXME initial value? */
+       /* RSSI gs */
+       u8 rssi_gs; /* FIXME initial value? */
+
+       /* RC cap */
+       u8 rc_cap; /* FIXME initial value? */
+       /* BX arch */
+       u8 bx_arch; /* FIXME initial value? */
+
+       /* Full calibration channel */
+       u8 full_calib_chan; /* FIXME initial value? */
+
+       /* Transmit iqlocal best coeffs */
+       bool tx_iqloc_best_coeffs_valid;
+       u8 tx_iqloc_best_coeffs[11];
 };
 
 
diff --git a/drivers/net/wireless/b43/tables_lpphy.c b/drivers/net/wireless/b43/tables_lpphy.c
new file mode 100644 (file)
index 0000000..4ea734d
--- /dev/null
@@ -0,0 +1,394 @@
+/*
+
+  Broadcom B43 wireless driver
+  IEEE 802.11g LP-PHY and radio device data tables
+
+  Copyright (c) 2009 Michael Buesch <mb@bu3sch.de>
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; see the file COPYING.  If not, write to
+  the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
+  Boston, MA 02110-1301, USA.
+
+*/
+
+#include "b43.h"
+#include "tables_lpphy.h"
+#include "phy_common.h"
+#include "phy_lp.h"
+
+
+/* Entry of the 2062 radio init table */
+struct b2062_init_tab_entry {
+       u16 offset;
+       u16 value_a;
+       u16 value_g;
+       u8 flags;
+};
+#define B2062_FLAG_A   0x01 /* Flag: Init in A mode */
+#define B2062_FLAG_G   0x02 /* Flag: Init in G mode */
+
+static const struct b2062_init_tab_entry b2062_init_tab[] = {
+       /* { .offset = B2062_N_COMM1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = 0x0001, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_N_COMM4, .value_a = 0x0001, .value_g = 0x0000, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_COMM5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM10, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM11, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM12, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM13, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM14, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_COMM15, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_PDN_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_N_PDN_CTL1, .value_a = 0x0000, .value_g = 0x00CA, .flags = B2062_FLAG_G, },
+       /* { .offset = B2062_N_PDN_CTL2, .value_a = 0x0018, .value_g = 0x0018, .flags = 0, }, */
+       { .offset = B2062_N_PDN_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_N_PDN_CTL4, .value_a = 0x0015, .value_g = 0x002A, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_GEN_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_IQ_CALIB, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */
+       { .offset = B2062_N_LGENC, .value_a = 0x00DB, .value_g = 0x00FF, .flags = B2062_FLAG_A, },
+       /* { .offset = B2062_N_LGENA_LPF, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */
+       /* { .offset = B2062_N_LGENA_BIAS0, .value_a = 0x0041, .value_g = 0x0041, .flags = 0, }, */
+       /* { .offset = B2062_N_LGNEA_BIAS1, .value_a = 0x0002, .value_g = 0x0002, .flags = 0, }, */
+       /* { .offset = B2062_N_LGENA_CTL0, .value_a = 0x0032, .value_g = 0x0032, .flags = 0, }, */
+       /* { .offset = B2062_N_LGENA_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_LGENA_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_N_LGENA_TUNE0, .value_a = 0x00DD, .value_g = 0x0000, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_LGENA_TUNE1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_N_LGENA_TUNE2, .value_a = 0x00DD, .value_g = 0x0000, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_N_LGENA_TUNE3, .value_a = 0x0077, .value_g = 0x00B5, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_N_LGENA_CTL3, .value_a = 0x0000, .value_g = 0x00FF, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_LGENA_CTL4, .value_a = 0x001F, .value_g = 0x001F, .flags = 0, }, */
+       /* { .offset = B2062_N_LGENA_CTL5, .value_a = 0x0032, .value_g = 0x0032, .flags = 0, }, */
+       /* { .offset = B2062_N_LGENA_CTL6, .value_a = 0x0032, .value_g = 0x0032, .flags = 0, }, */
+       { .offset = B2062_N_LGENA_CTL7, .value_a = 0x0033, .value_g = 0x0033, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_RXA_CTL0, .value_a = 0x0009, .value_g = 0x0009, .flags = 0, }, */
+       { .offset = B2062_N_RXA_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = B2062_FLAG_G, },
+       /* { .offset = B2062_N_RXA_CTL2, .value_a = 0x0018, .value_g = 0x0018, .flags = 0, }, */
+       /* { .offset = B2062_N_RXA_CTL3, .value_a = 0x0027, .value_g = 0x0027, .flags = 0, }, */
+       /* { .offset = B2062_N_RXA_CTL4, .value_a = 0x0028, .value_g = 0x0028, .flags = 0, }, */
+       /* { .offset = B2062_N_RXA_CTL5, .value_a = 0x0007, .value_g = 0x0007, .flags = 0, }, */
+       /* { .offset = B2062_N_RXA_CTL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_RXA_CTL7, .value_a = 0x0008, .value_g = 0x0008, .flags = 0, }, */
+       { .offset = B2062_N_RXBB_CTL0, .value_a = 0x0082, .value_g = 0x0080, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_RXBB_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_GAIN0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_N_RXBB_GAIN1, .value_a = 0x0004, .value_g = 0x0004, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_N_RXBB_GAIN2, .value_a = 0x0000, .value_g = 0x0000, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_RXBB_GAIN3, .value_a = 0x0011, .value_g = 0x0011, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_RSSI0, .value_a = 0x0043, .value_g = 0x0043, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_RSSI1, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_CALIB0, .value_a = 0x0010, .value_g = 0x0010, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_CALIB1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_CALIB2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_BIAS0, .value_a = 0x0006, .value_g = 0x0006, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_BIAS1, .value_a = 0x002A, .value_g = 0x002A, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_BIAS2, .value_a = 0x00AA, .value_g = 0x00AA, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_BIAS3, .value_a = 0x0021, .value_g = 0x0021, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_BIAS4, .value_a = 0x00AA, .value_g = 0x00AA, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_BIAS5, .value_a = 0x0022, .value_g = 0x0022, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_RSSI2, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_RSSI3, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_RSSI4, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */
+       /* { .offset = B2062_N_RXBB_RSSI5, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_CTL0, .value_a = 0x0001, .value_g = 0x0001, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_CTL2, .value_a = 0x0084, .value_g = 0x0084, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_N_TX_CTL4, .value_a = 0x0003, .value_g = 0x0003, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_N_TX_CTL5, .value_a = 0x0002, .value_g = 0x0002, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_TX_CTL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_CTL7, .value_a = 0x0058, .value_g = 0x0058, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_CTL8, .value_a = 0x0082, .value_g = 0x0082, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_CTL9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_CTL_A, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_GC2G, .value_a = 0x00FF, .value_g = 0x00FF, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_GC5G, .value_a = 0x00FF, .value_g = 0x00FF, .flags = 0, }, */
+       { .offset = B2062_N_TX_TUNE, .value_a = 0x0088, .value_g = 0x001B, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_N_TX_PAD, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_PGA, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_PADAUX, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */
+       /* { .offset = B2062_N_TX_PGAAUX, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */
+       /* { .offset = B2062_N_TSSI_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_TSSI_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_TSSI_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_IQ_CALIB_CTL0, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */
+       /* { .offset = B2062_N_IQ_CALIB_CTL1, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */
+       /* { .offset = B2062_N_IQ_CALIB_CTL2, .value_a = 0x0032, .value_g = 0x0032, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_TS, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_CTL1, .value_a = 0x0015, .value_g = 0x0015, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_CTL2, .value_a = 0x000F, .value_g = 0x000F, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_CTL4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_DBG0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_DBG1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_DBG2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_CALIB_DBG3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_PSENSE_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_PSENSE_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_PSENSE_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_N_TEST_BUF0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RADIO_ID_CODE, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_COMM4, .value_a = 0x0001, .value_g = 0x0000, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_COMM5, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM8, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM10, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM11, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM12, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM13, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM14, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_COMM15, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_PDS_CTL0, .value_a = 0x00FF, .value_g = 0x00FF, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_PDS_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_PDS_CTL2, .value_a = 0x008E, .value_g = 0x008E, .flags = 0, }, */
+       /* { .offset = B2062_S_PDS_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_BG_CTL0, .value_a = 0x0006, .value_g = 0x0006, .flags = 0, }, */
+       /* { .offset = B2062_S_BG_CTL1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_BG_CTL2, .value_a = 0x0011, .value_g = 0x0011, .flags = 0, }, */
+       { .offset = B2062_S_LGENG_CTL0, .value_a = 0x00F8, .value_g = 0x00D8, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_LGENG_CTL1, .value_a = 0x003C, .value_g = 0x0024, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_LGENG_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_LGENG_CTL3, .value_a = 0x0041, .value_g = 0x0041, .flags = 0, }, */
+       /* { .offset = B2062_S_LGENG_CTL4, .value_a = 0x0002, .value_g = 0x0002, .flags = 0, }, */
+       /* { .offset = B2062_S_LGENG_CTL5, .value_a = 0x0033, .value_g = 0x0033, .flags = 0, }, */
+       /* { .offset = B2062_S_LGENG_CTL6, .value_a = 0x0022, .value_g = 0x0022, .flags = 0, }, */
+       /* { .offset = B2062_S_LGENG_CTL7, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_LGENG_CTL8, .value_a = 0x0088, .value_g = 0x0080, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_LGENG_CTL9, .value_a = 0x0088, .value_g = 0x0088, .flags = 0, }, */
+       { .offset = B2062_S_LGENG_CTL10, .value_a = 0x0088, .value_g = 0x0080, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_LGENG_CTL11, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL0, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL1, .value_a = 0x0007, .value_g = 0x0007, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL2, .value_a = 0x00AF, .value_g = 0x00AF, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL3, .value_a = 0x0012, .value_g = 0x0012, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL4, .value_a = 0x000B, .value_g = 0x000B, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL5, .value_a = 0x005F, .value_g = 0x005F, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL6, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL7, .value_a = 0x0040, .value_g = 0x0040, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL8, .value_a = 0x0052, .value_g = 0x0052, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL9, .value_a = 0x0026, .value_g = 0x0026, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL10, .value_a = 0x0003, .value_g = 0x0003, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL11, .value_a = 0x0036, .value_g = 0x0036, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL12, .value_a = 0x0057, .value_g = 0x0057, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL13, .value_a = 0x0011, .value_g = 0x0011, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL14, .value_a = 0x0075, .value_g = 0x0075, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL15, .value_a = 0x00B4, .value_g = 0x00B4, .flags = 0, }, */
+       /* { .offset = B2062_S_REFPLL_CTL16, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_RFPLL_CTL0, .value_a = 0x0098, .value_g = 0x0098, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL1, .value_a = 0x0010, .value_g = 0x0010, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_RFPLL_CTL2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RFPLL_CTL3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RFPLL_CTL4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_RFPLL_CTL5, .value_a = 0x0043, .value_g = 0x0043, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL6, .value_a = 0x0047, .value_g = 0x0047, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL7, .value_a = 0x000C, .value_g = 0x000C, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL8, .value_a = 0x0011, .value_g = 0x0011, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL9, .value_a = 0x0011, .value_g = 0x0011, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL10, .value_a = 0x000E, .value_g = 0x000E, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL11, .value_a = 0x0008, .value_g = 0x0008, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL12, .value_a = 0x0033, .value_g = 0x0033, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL13, .value_a = 0x000A, .value_g = 0x000A, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL14, .value_a = 0x0006, .value_g = 0x0006, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_RFPLL_CTL15, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RFPLL_CTL16, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RFPLL_CTL17, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_RFPLL_CTL18, .value_a = 0x003E, .value_g = 0x003E, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL19, .value_a = 0x0013, .value_g = 0x0013, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_RFPLL_CTL20, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_RFPLL_CTL21, .value_a = 0x0062, .value_g = 0x0062, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL22, .value_a = 0x0007, .value_g = 0x0007, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL23, .value_a = 0x0016, .value_g = 0x0016, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL24, .value_a = 0x005C, .value_g = 0x005C, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL25, .value_a = 0x0095, .value_g = 0x0095, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_RFPLL_CTL26, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RFPLL_CTL27, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RFPLL_CTL28, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RFPLL_CTL29, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_RFPLL_CTL30, .value_a = 0x00A0, .value_g = 0x00A0, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL31, .value_a = 0x0004, .value_g = 0x0004, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_RFPLL_CTL32, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       { .offset = B2062_S_RFPLL_CTL33, .value_a = 0x00CC, .value_g = 0x00CC, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       { .offset = B2062_S_RFPLL_CTL34, .value_a = 0x0007, .value_g = 0x0007, .flags = B2062_FLAG_A | B2062_FLAG_G, },
+       /* { .offset = B2062_S_RXG_CNT0, .value_a = 0x0010, .value_g = 0x0010, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT1, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT2, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT3, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT4, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT5, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT6, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT7, .value_a = 0x0005, .value_g = 0x0005, .flags = 0, }, */
+       { .offset = B2062_S_RXG_CNT8, .value_a = 0x000F, .value_g = 0x000F, .flags = B2062_FLAG_A, },
+       /* { .offset = B2062_S_RXG_CNT9, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT10, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT11, .value_a = 0x0066, .value_g = 0x0066, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT12, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT13, .value_a = 0x0044, .value_g = 0x0044, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT14, .value_a = 0x00A0, .value_g = 0x00A0, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT15, .value_a = 0x0004, .value_g = 0x0004, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT16, .value_a = 0x0000, .value_g = 0x0000, .flags = 0, }, */
+       /* { .offset = B2062_S_RXG_CNT17, .value_a = 0x0055, .value_g = 0x0055, .flags = 0, }, */
+};
+
+void b2062_upload_init_table(struct b43_wldev *dev)
+{
+       const struct b2062_init_tab_entry *e;
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(b2062_init_tab); i++) {
+               e = &b2062_init_tab[i];
+               if (b43_current_band(dev->wl) == IEEE80211_BAND_2GHZ) {
+                       if (!(e->flags & B2062_FLAG_G))
+                               continue;
+                       b43_radio_write(dev, e->offset, e->value_g);
+               } else {
+                       if (!(e->flags & B2062_FLAG_A))
+                               continue;
+                       b43_radio_write(dev, e->offset, e->value_a);
+               }
+       }
+}
+
+u32 b43_lptab_read(struct b43_wldev *dev, u32 offset)
+{
+       u32 type, value;
+
+       type = offset & B43_LPTAB_TYPEMASK;
+       offset &= ~B43_LPTAB_TYPEMASK;
+       B43_WARN_ON(offset > 0xFFFF);
+
+       switch (type) {
+       case B43_LPTAB_8BIT:
+               b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset);
+               value = b43_phy_read(dev, B43_LPPHY_TABLEDATALO) & 0xFF;
+               break;
+       case B43_LPTAB_16BIT:
+               b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset);
+               value = b43_phy_read(dev, B43_LPPHY_TABLEDATALO);
+               break;
+       case B43_LPTAB_32BIT:
+               b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset);
+               value = b43_phy_read(dev, B43_LPPHY_TABLEDATAHI);
+               value <<= 16;
+               value |= b43_phy_read(dev, B43_LPPHY_TABLEDATALO);
+               break;
+       default:
+               B43_WARN_ON(1);
+               value = 0;
+       }
+
+       return value;
+}
+
+void b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset,
+                        unsigned int nr_elements, void *_data)
+{
+       u32 type, value;
+       u8 *data = _data;
+       unsigned int i;
+
+       type = offset & B43_LPTAB_TYPEMASK;
+       for (i = 0; i < nr_elements; i++) {
+               value = b43_lptab_read(dev, offset);
+               switch (type) {
+               case B43_LPTAB_8BIT:
+                       *data = value;
+                       data++;
+                       break;
+               case B43_LPTAB_16BIT:
+                       *((u16 *)data) = value;
+                       data += 2;
+                       break;
+               case B43_LPTAB_32BIT:
+                       *((u32 *)data) = value;
+                       data += 4;
+                       break;
+               default:
+                       B43_WARN_ON(1);
+               }
+               offset++;
+       }
+}
+
+void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value)
+{
+       u32 type;
+
+       type = offset & B43_LPTAB_TYPEMASK;
+       offset &= ~B43_LPTAB_TYPEMASK;
+       B43_WARN_ON(offset > 0xFFFF);
+
+       switch (type) {
+       case B43_LPTAB_8BIT:
+               B43_WARN_ON(value & ~0xFF);
+               b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset);
+               b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value);
+               break;
+       case B43_LPTAB_16BIT:
+               B43_WARN_ON(value & ~0xFFFF);
+               b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset);
+               b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value);
+               break;
+       case B43_LPTAB_32BIT:
+               b43_phy_write(dev, B43_LPPHY_TABLE_ADDR, offset);
+               b43_phy_write(dev, B43_LPPHY_TABLEDATAHI, value >> 16);
+               b43_phy_write(dev, B43_LPPHY_TABLEDATALO, value);
+               break;
+       default:
+               B43_WARN_ON(1);
+       }
+}
+
+void b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset,
+                         unsigned int nr_elements, const void *_data)
+{
+       u32 type, value;
+       const u8 *data = _data;
+       unsigned int i;
+
+       type = offset & B43_LPTAB_TYPEMASK;
+       for (i = 0; i < nr_elements; i++) {
+               switch (type) {
+               case B43_LPTAB_8BIT:
+                       value = *data;
+                       data++;
+                       break;
+               case B43_LPTAB_16BIT:
+                       value = *((u16 *)data);
+                       data += 2;
+                       break;
+               case B43_LPTAB_32BIT:
+                       value = *((u32 *)data);
+                       data += 4;
+                       break;
+               default:
+                       B43_WARN_ON(1);
+                       value = 0;
+               }
+               b43_lptab_write(dev, offset, value);
+               offset++;
+       }
+}
diff --git a/drivers/net/wireless/b43/tables_lpphy.h b/drivers/net/wireless/b43/tables_lpphy.h
new file mode 100644 (file)
index 0000000..0b8d028
--- /dev/null
@@ -0,0 +1,31 @@
+#ifndef B43_TABLES_LPPHY_H_
+#define B43_TABLES_LPPHY_H_
+
+
+#define B43_LPTAB_TYPEMASK             0xF0000000
+#define B43_LPTAB_8BIT                 0x10000000
+#define B43_LPTAB_16BIT                        0x20000000
+#define B43_LPTAB_32BIT                        0x30000000
+#define B43_LPTAB8(table, offset)      (((table) << 10) | (offset) | B43_LPTAB_8BIT)
+#define B43_LPTAB16(table, offset)     (((table) << 10) | (offset) | B43_LPTAB_16BIT)
+#define B43_LPTAB32(table, offset)     (((table) << 10) | (offset) | B43_LPTAB_32BIT)
+
+/* Table definitions */
+#define B43_LPTAB_TXPWR_R2PLUS         B43_LPTAB32(0x07, 0) /* TX power lookup table (rev >= 2) */
+#define B43_LPTAB_TXPWR_R0_1           B43_LPTAB32(0xA0, 0) /* TX power lookup table (rev < 2) */
+
+u32 b43_lptab_read(struct b43_wldev *dev, u32 offset);
+void b43_lptab_write(struct b43_wldev *dev, u32 offset, u32 value);
+
+/* Bulk table access. Note that these functions return the bulk data in
+ * host endianness! The returned data is _not_ a bytearray, but an array
+ * consisting of nr_elements of the data type. */
+void b43_lptab_read_bulk(struct b43_wldev *dev, u32 offset,
+                        unsigned int nr_elements, void *data);
+void b43_lptab_write_bulk(struct b43_wldev *dev, u32 offset,
+                         unsigned int nr_elements, const void *data);
+
+void b2062_upload_init_table(struct b43_wldev *dev);
+
+
+#endif /* B43_TABLES_LPPHY_H_ */
index cacb786d97136498f645e10859cd7e9af8df4fee..3ea55b18c7001d60518ad46b840faea9590d5ba5 100644 (file)
@@ -146,12 +146,12 @@ static void b43legacy_map_led(struct b43legacy_wldev *dev,
        case B43legacy_LED_TRANSFER:
        case B43legacy_LED_APTRANSFER:
                snprintf(name, sizeof(name),
-                        "b43legacy-%s:tx", wiphy_name(hw->wiphy));
+                        "b43legacy-%s::tx", wiphy_name(hw->wiphy));
                b43legacy_register_led(dev, &dev->led_tx, name,
                                 ieee80211_get_tx_led_name(hw),
                                 led_index, activelow);
                snprintf(name, sizeof(name),
-                        "b43legacy-%s:rx", wiphy_name(hw->wiphy));
+                        "b43legacy-%s::rx", wiphy_name(hw->wiphy));
                b43legacy_register_led(dev, &dev->led_rx, name,
                                 ieee80211_get_rx_led_name(hw),
                                 led_index, activelow);
@@ -161,7 +161,7 @@ static void b43legacy_map_led(struct b43legacy_wldev *dev,
        case B43legacy_LED_RADIO_B:
        case B43legacy_LED_MODE_BG:
                snprintf(name, sizeof(name),
-                        "b43legacy-%s:radio", wiphy_name(hw->wiphy));
+                        "b43legacy-%s::radio", wiphy_name(hw->wiphy));
                b43legacy_register_led(dev, &dev->led_radio, name,
                                 b43legacy_rfkill_led_name(dev),
                                 led_index, activelow);
@@ -172,7 +172,7 @@ static void b43legacy_map_led(struct b43legacy_wldev *dev,
        case B43legacy_LED_WEIRD:
        case B43legacy_LED_ASSOC:
                snprintf(name, sizeof(name),
-                        "b43legacy-%s:assoc", wiphy_name(hw->wiphy));
+                        "b43legacy-%s::assoc", wiphy_name(hw->wiphy));
                b43legacy_register_led(dev, &dev->led_assoc, name,
                                 ieee80211_get_assoc_led_name(hw),
                                 led_index, activelow);
index fb996c27a19b4b3340b7e682f319eae0a627631e..879edc786713710fdde14c61257a61e5c4798645 100644 (file)
@@ -2650,7 +2650,7 @@ out_unlock_mutex:
        return err;
 }
 
-static void b43legacy_update_basic_rates(struct b43legacy_wldev *dev, u64 brates)
+static void b43legacy_update_basic_rates(struct b43legacy_wldev *dev, u32 brates)
 {
        struct ieee80211_supported_band *sband =
                dev->wl->hw->wiphy->bands[IEEE80211_BAND_2GHZ];
index 19b1bf0478bd62ae4e34c23a44f6cfb9a7c947f8..241756318da481c0f038f55b9b395ef4222b9022 100644 (file)
@@ -193,7 +193,7 @@ hdr->f.status = s; hdr->f.len = l; hdr->f.data = d
        if (prism_header)
                skb_pull(skb, phdrlen);
        skb->pkt_type = PACKET_OTHERHOST;
-       skb->protocol = __constant_htons(ETH_P_802_2);
+       skb->protocol = cpu_to_be16(ETH_P_802_2);
        memset(skb->cb, 0, sizeof(skb->cb));
        netif_rx(skb);
 
@@ -1094,7 +1094,7 @@ void hostap_80211_rx(struct net_device *dev, struct sk_buff *skb,
        if (skb2 != NULL) {
                /* send to wireless media */
                skb2->dev = dev;
-               skb2->protocol = __constant_htons(ETH_P_802_3);
+               skb2->protocol = cpu_to_be16(ETH_P_802_3);
                skb_reset_mac_header(skb2);
                skb_reset_network_header(skb2);
                /* skb2->network_header += ETH_HLEN; */
index 0903db786d5f94d565e67ed82d7a42216eb41cf9..0a4bf94dddfbd00f92195df9bd9ec5d396b33795 100644 (file)
@@ -609,7 +609,7 @@ static void hostap_ap_tx_cb(struct sk_buff *skb, int ok, void *data)
        skb->dev = ap->local->apdev;
        skb_pull(skb, hostap_80211_get_hdrlen(fc));
        skb->pkt_type = PACKET_OTHERHOST;
-       skb->protocol = __constant_htons(ETH_P_802_2);
+       skb->protocol = cpu_to_be16(ETH_P_802_2);
        memset(skb->cb, 0, sizeof(skb->cb));
        netif_rx(skb);
 }
@@ -2281,7 +2281,7 @@ void hostap_rx(struct net_device *dev, struct sk_buff *skb,
            WLAN_FC_GET_STYPE(fc) == IEEE80211_STYPE_BEACON)
                goto drop;
 
-       skb->protocol = __constant_htons(ETH_P_HOSTAP);
+       skb->protocol = cpu_to_be16(ETH_P_HOSTAP);
        handle_ap_item(local, skb, rx_stats);
        return;
 
@@ -2310,7 +2310,7 @@ static void schedule_packet_send(local_info_t *local, struct sta_info *sta)
        hdr = (struct ieee80211_hdr_4addr *) skb_put(skb, 16);
 
        /* Generate a fake pspoll frame to start packet delivery */
-       hdr->frame_ctl = __constant_cpu_to_le16(
+       hdr->frame_ctl = cpu_to_le16(
                IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
        memcpy(hdr->addr1, local->dev->dev_addr, ETH_ALEN);
        memcpy(hdr->addr2, sta->addr, ETH_ALEN);
@@ -2754,7 +2754,7 @@ ap_tx_ret hostap_handle_sta_tx(local_info_t *local, struct hostap_tx_data *tx)
        if (meta->flags & HOSTAP_TX_FLAGS_ADD_MOREDATA) {
                /* indicate to STA that more frames follow */
                hdr->frame_ctl |=
-                       __constant_cpu_to_le16(IEEE80211_FCTL_MOREDATA);
+                       cpu_to_le16(IEEE80211_FCTL_MOREDATA);
        }
 
        if (meta->flags & HOSTAP_TX_FLAGS_BUFFERED_FRAME) {
index c40fdf4c79de8af8193c78d7c8340641b1ddf724..8618b3355eb4ad058a9d4ee931d617f6badb800f 100644 (file)
@@ -1638,7 +1638,7 @@ static int prism2_request_hostscan(struct net_device *dev,
        memset(&scan_req, 0, sizeof(scan_req));
        scan_req.channel_list = cpu_to_le16(local->channel_mask &
                                            local->scan_channel_mask);
-       scan_req.txrate = __constant_cpu_to_le16(HFA384X_RATES_1MBPS);
+       scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS);
        if (ssid) {
                if (ssid_len > 32)
                        return -EINVAL;
@@ -1668,7 +1668,7 @@ static int prism2_request_scan(struct net_device *dev)
        memset(&scan_req, 0, sizeof(scan_req));
        scan_req.channel_list = cpu_to_le16(local->channel_mask &
                                            local->scan_channel_mask);
-       scan_req.txrate = __constant_cpu_to_le16(HFA384X_RATES_1MBPS);
+       scan_req.txrate = cpu_to_le16(HFA384X_RATES_1MBPS);
 
        /* FIX:
         * It seems to be enough to set roaming mode for a short moment to
@@ -2514,7 +2514,7 @@ static int prism2_ioctl_priv_prism2_param(struct net_device *dev,
                u16 rate;
 
                memset(&scan_req, 0, sizeof(scan_req));
-               scan_req.channel_list = __constant_cpu_to_le16(0x3fff);
+               scan_req.channel_list = cpu_to_le16(0x3fff);
                switch (value) {
                case 1: rate = HFA384X_RATES_1MBPS; break;
                case 2: rate = HFA384X_RATES_2MBPS; break;
index 3d5cc4463d4d5e641601aa3fbc4eb3438007da0f..1d5dc3e9c5fbfb930e60c68ee2515f4cf4f23d49 100644 (file)
@@ -150,6 +150,7 @@ config IPW2200_DEBUG
 
 config LIBIPW
        tristate
+       depends on PCI && WLAN_80211
        select WIRELESS_EXT
        select CRYPTO
        select CRYPTO_ARC4
index 823c2bf5e31efeacde5f3f2a1bbce9a6d70ea924..52b1cf5160f7c1cf40e8ebce5b19a507303d5b8a 100644 (file)
@@ -1910,7 +1910,8 @@ static void isr_indicate_associated(struct ipw2100_priv *priv, u32 status)
 {
 
 #define MAC_ASSOCIATION_READ_DELAY (HZ)
-       int ret, len, essid_len;
+       int ret;
+       unsigned int len, essid_len;
        char essid[IW_ESSID_MAX_SIZE];
        u32 txrate;
        u32 chan;
@@ -4058,7 +4059,7 @@ static ssize_t show_bssinfo(struct device *d, struct device_attribute *attr,
        u8 bssid[ETH_ALEN];
        u32 chan = 0;
        char *out = buf;
-       int length;
+       unsigned int length;
        int ret;
 
        if (priv->status & STATUS_RF_KILL_MASK)
@@ -7122,7 +7123,7 @@ static int ipw2100_wx_get_rate(struct net_device *dev,
 {
        struct ipw2100_priv *priv = ieee80211_priv(dev);
        int val;
-       int len = sizeof(val);
+       unsigned int len = sizeof(val);
        int err = 0;
 
        if (!(priv->status & STATUS_ENABLED) ||
@@ -8297,7 +8298,7 @@ static void ipw2100_wx_event_work(struct work_struct *work)
        struct ipw2100_priv *priv =
                container_of(work, struct ipw2100_priv, wx_event_work.work);
        union iwreq_data wrqu;
-       int len = ETH_ALEN;
+       unsigned int len = ETH_ALEN;
 
        if (priv->status & STATUS_STOPPING)
                return;
index 625f2cf99fa9f9a7bf4976aeb460523e18b1b920..0420d3d35dd4c15c7ff3194f55fa11c5026ebb66 100644 (file)
@@ -8272,7 +8272,7 @@ static void ipw_handle_mgmt_packet(struct ipw_priv *priv,
                skb_reset_mac_header(skb);
 
                skb->pkt_type = PACKET_OTHERHOST;
-               skb->protocol = __constant_htons(ETH_P_80211_STATS);
+               skb->protocol = cpu_to_be16(ETH_P_80211_STATS);
                memset(skb->cb, 0, sizeof(rxb->skb->cb));
                netif_rx(skb);
                rxb->skb = NULL;
index 47bee0ee0a7c3b1a040f477f450a2ecd4692e4ee..7b3bad1796c7f12250057eeb0a9de0a0b7cc1be0 100644 (file)
@@ -1,25 +1,26 @@
 config IWLWIFI
-       tristate
+       bool "Intel Wireless Wifi"
+       depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
+       default y
 
 config IWLCORE
        tristate "Intel Wireless Wifi Core"
-       depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
+       depends on IWLWIFI
        select LIB80211
-       select IWLWIFI
        select MAC80211_LEDS if IWLWIFI_LEDS
        select LEDS_CLASS if IWLWIFI_LEDS
        select RFKILL if IWLWIFI_RFKILL
 
 config IWLWIFI_LEDS
-       bool
-       default n
+       bool "Enable LED support in iwlagn driver"
+       depends on IWLCORE
 
 config IWLWIFI_RFKILL
-       boolean "Iwlwifi RF kill support"
+       bool "Enable RF kill support in iwlagn driver"
        depends on IWLCORE
 
 config IWLWIFI_DEBUG
-       bool "Enable full debugging output in iwlagn driver"
+       bool "Enable full debugging output in iwlagn and iwl3945 drivers"
        depends on IWLCORE
        ---help---
          This option will enable debug tracing output for the iwlwifi drivers
@@ -51,7 +52,7 @@ config IWLWIFI_DEBUGFS
 
 config IWLAGN
        tristate "Intel Wireless WiFi Next Gen AGN"
-       depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
+       depends on IWLWIFI
        select FW_LOADER
        select IWLCORE
        ---help---
@@ -104,13 +105,12 @@ config IWL5000
 
 config IWL3945
        tristate "Intel PRO/Wireless 3945ABG/BG Network Connection"
-       depends on PCI && MAC80211 && WLAN_80211 && EXPERIMENTAL
+       depends on IWLWIFI
        select FW_LOADER
        select LIB80211
-       select IWLWIFI
        select MAC80211_LEDS if IWL3945_LEDS
        select LEDS_CLASS if IWL3945_LEDS
-       select RFKILL if IWL3945_RFKILL
+       select RFKILL if IWLWIFI_RFKILL
        ---help---
          Select to build the driver supporting the:
 
@@ -133,10 +133,6 @@ config IWL3945
          say M here and read <file:Documentation/kbuild/modules.txt>.  The
          module will be called iwl3945.ko.
 
-config IWL3945_RFKILL
-       bool "Enable RF kill support in iwl3945 drivers"
-       depends on IWL3945
-
 config IWL3945_SPECTRUM_MEASUREMENT
        bool "Enable Spectrum Measurement in iwl3945 drivers"
        depends on IWL3945
@@ -148,30 +144,3 @@ config IWL3945_LEDS
        depends on IWL3945
        ---help---
          This option enables LEDS for the iwl3945 driver.
-
-config IWL3945_DEBUG
-       bool "Enable full debugging output in iwl3945 driver"
-       depends on IWL3945
-       ---help---
-         This option will enable debug tracing output for the iwl3945
-         driver.
-
-         This will result in the kernel module being ~100k larger.  You can
-         control which debug output is sent to the kernel log by setting the
-         value in
-
-                 /sys/bus/pci/drivers/${DRIVER}/debug_level
-
-         This entry will only exist if this option is enabled.
-
-         To set a value, simply echo an 8-byte hex value to the same file:
-
-                 % echo 0x43fff > /sys/bus/pci/drivers/${DRIVER}/debug_level
-
-         You can find the list of debug mask values in:
-                 drivers/net/wireless/iwlwifi/iwl-3945-debug.h
-
-         If this is your first time using this driver, you should say Y here
-         as the debug information can assist others in helping you resolve
-         any problems you may encounter.
-
index 0be9e6b66aa0f0187b8072dbf1c5879b0b3f8b58..ddc8b31b2608db960327ca24c9a1d8db326bd328 100644 (file)
@@ -8,10 +8,12 @@ iwlcore-$(CONFIG_IWLWIFI_RFKILL) += iwl-rfkill.o
 iwlcore-$(CONFIG_IWLAGN_SPECTRUM_MEASUREMENT) += iwl-spectrum.o
 
 obj-$(CONFIG_IWLAGN)   += iwlagn.o
-iwlagn-objs            := iwl-agn.o iwl-agn-rs.o iwl-agn-hcmd-check.o
+iwlagn-objs            := iwl-agn.o iwl-agn-rs.o
 
 iwlagn-$(CONFIG_IWL4965) += iwl-4965.o
 iwlagn-$(CONFIG_IWL5000) += iwl-5000.o
+iwlagn-$(CONFIG_IWL5000) += iwl-6000.o
+iwlagn-$(CONFIG_IWL5000) += iwl-100.o
 
 obj-$(CONFIG_IWL3945)  += iwl3945.o
 iwl3945-objs           := iwl3945-base.o iwl-3945.o iwl-3945-rs.o
diff --git a/drivers/net/wireless/iwlwifi/iwl-100.c b/drivers/net/wireless/iwlwifi/iwl-100.c
new file mode 100644 (file)
index 0000000..11d206a
--- /dev/null
@@ -0,0 +1,73 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2008-2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless <ilw@linux.intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ *****************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/dma-mapping.h>
+#include <linux/delay.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/wireless.h>
+#include <net/mac80211.h>
+#include <linux/etherdevice.h>
+#include <asm/unaligned.h>
+
+#include "iwl-eeprom.h"
+#include "iwl-dev.h"
+#include "iwl-core.h"
+#include "iwl-io.h"
+#include "iwl-sta.h"
+#include "iwl-helpers.h"
+#include "iwl-5000-hw.h"
+
+/* Highest firmware API version supported */
+#define IWL100_UCODE_API_MAX 2
+
+/* Lowest firmware API version supported */
+#define IWL100_UCODE_API_MIN 1
+
+#define IWL100_FW_PRE "iwlwifi-100-"
+#define _IWL100_MODULE_FIRMWARE(api) IWL100_FW_PRE #api ".ucode"
+#define IWL100_MODULE_FIRMWARE(api) _IWL100_MODULE_FIRMWARE(api)
+
+struct iwl_cfg iwl100_bgn_cfg = {
+       .name = "100 Series BGN",
+       .fw_name_pre = IWL100_FW_PRE,
+       .ucode_api_max = IWL100_UCODE_API_MAX,
+       .ucode_api_min = IWL100_UCODE_API_MIN,
+       .sku = IWL_SKU_G|IWL_SKU_N,
+       .ops = &iwl5000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+       .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
+       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_A,
+       .valid_rx_ant = ANT_AB,
+       .need_pll_cfg = true,
+};
+
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-commands.h b/drivers/net/wireless/iwlwifi/iwl-3945-commands.h
deleted file mode 100644 (file)
index c6f4eb5..0000000
+++ /dev/null
@@ -1,1702 +0,0 @@
-/******************************************************************************
- *
- * This file is provided under a dual BSD/GPLv2 license.  When using or
- * redistributing this file, you may do so under either license.
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
- * USA
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * Contact Information:
- *  Intel Linux Wireless <ilw@linux.intel.com>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- * BSD LICENSE
- *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *  * Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- *  * Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *  * Neither the name Intel Corporation nor the names of its
- *    contributors may be used to endorse or promote products derived
- *    from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *****************************************************************************/
-/*
- * Please use this file (iwl-3945-commands.h) only for uCode API definitions.
- * Please use iwl-3945-hw.h for hardware-related definitions.
- * Please use iwl-3945.h for driver implementation definitions.
- */
-
-#ifndef __iwl_3945_commands_h__
-#define __iwl_3945_commands_h__
-
-/* uCode version contains 4 values: Major/Minor/API/Serial */
-#define IWL_UCODE_MAJOR(ver)   (((ver) & 0xFF000000) >> 24)
-#define IWL_UCODE_MINOR(ver)   (((ver) & 0x00FF0000) >> 16)
-#define IWL_UCODE_API(ver)     (((ver) & 0x0000FF00) >> 8)
-#define IWL_UCODE_SERIAL(ver)  ((ver) & 0x000000FF)
-
-enum {
-       REPLY_ALIVE = 0x1,
-       REPLY_ERROR = 0x2,
-
-       /* RXON and QOS commands */
-       REPLY_RXON = 0x10,
-       REPLY_RXON_ASSOC = 0x11,
-       REPLY_QOS_PARAM = 0x13,
-       REPLY_RXON_TIMING = 0x14,
-
-       /* Multi-Station support */
-       REPLY_ADD_STA = 0x18,
-       REPLY_REMOVE_STA = 0x19,        /* not used */
-       REPLY_REMOVE_ALL_STA = 0x1a,    /* not used */
-
-       /* RX, TX, LEDs */
-       REPLY_3945_RX = 0x1b,           /* 3945 only */
-       REPLY_TX = 0x1c,
-       REPLY_RATE_SCALE = 0x47,        /* 3945 only */
-       REPLY_LEDS_CMD = 0x48,
-       REPLY_TX_LINK_QUALITY_CMD = 0x4e, /* 4965 only */
-
-       /* 802.11h related */
-       RADAR_NOTIFICATION = 0x70,      /* not used */
-       REPLY_QUIET_CMD = 0x71,         /* not used */
-       REPLY_CHANNEL_SWITCH = 0x72,
-       CHANNEL_SWITCH_NOTIFICATION = 0x73,
-       REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74,
-       SPECTRUM_MEASURE_NOTIFICATION = 0x75,
-
-       /* Power Management */
-       POWER_TABLE_CMD = 0x77,
-       PM_SLEEP_NOTIFICATION = 0x7A,
-       PM_DEBUG_STATISTIC_NOTIFIC = 0x7B,
-
-       /* Scan commands and notifications */
-       REPLY_SCAN_CMD = 0x80,
-       REPLY_SCAN_ABORT_CMD = 0x81,
-       SCAN_START_NOTIFICATION = 0x82,
-       SCAN_RESULTS_NOTIFICATION = 0x83,
-       SCAN_COMPLETE_NOTIFICATION = 0x84,
-
-       /* IBSS/AP commands */
-       BEACON_NOTIFICATION = 0x90,
-       REPLY_TX_BEACON = 0x91,
-       WHO_IS_AWAKE_NOTIFICATION = 0x94,       /* not used */
-
-       /* Miscellaneous commands */
-       QUIET_NOTIFICATION = 0x96,              /* not used */
-       REPLY_TX_PWR_TABLE_CMD = 0x97,
-       MEASURE_ABORT_NOTIFICATION = 0x99,      /* not used */
-
-       /* Bluetooth device coexistence config command */
-       REPLY_BT_CONFIG = 0x9b,
-
-       /* Statistics */
-       REPLY_STATISTICS_CMD = 0x9c,
-       STATISTICS_NOTIFICATION = 0x9d,
-
-       /* RF-KILL commands and notifications */
-       REPLY_CARD_STATE_CMD = 0xa0,
-       CARD_STATE_NOTIFICATION = 0xa1,
-
-       /* Missed beacons notification */
-       MISSED_BEACONS_NOTIFICATION = 0xa2,
-
-       REPLY_MAX = 0xff
-};
-
-/******************************************************************************
- * (0)
- * Commonly used structures and definitions:
- * Command header, txpower
- *
- *****************************************************************************/
-
-/* iwl3945_cmd_header flags value */
-#define IWL_CMD_FAILED_MSK 0x40
-
-/**
- * struct iwl3945_cmd_header
- *
- * This header format appears in the beginning of each command sent from the
- * driver, and each response/notification received from uCode.
- */
-struct iwl3945_cmd_header {
-       u8 cmd;         /* Command ID:  REPLY_RXON, etc. */
-       u8 flags;       /* IWL_CMD_* */
-       /*
-        * The driver sets up the sequence number to values of its choosing.
-        * uCode does not use this value, but passes it back to the driver
-        * when sending the response to each driver-originated command, so
-        * the driver can match the response to the command.  Since the values
-        * don't get used by uCode, the driver may set up an arbitrary format.
-        *
-        * There is one exception:  uCode sets bit 15 when it originates
-        * the response/notification, i.e. when the response/notification
-        * is not a direct response to a command sent by the driver.  For
-        * example, uCode issues REPLY_3945_RX when it sends a received frame
-        * to the driver; it is not a direct response to any driver command.
-        *
-        * The Linux driver uses the following format:
-        *
-        *  0:7    index/position within Tx queue
-        *  8:13   Tx queue selection
-        * 14:14   driver sets this to indicate command is in the 'huge'
-        *         storage at the end of the command buffers, i.e. scan cmd
-        * 15:15   uCode sets this in uCode-originated response/notification
-        */
-       __le16 sequence;
-
-       /* command or response/notification data follows immediately */
-       u8 data[0];
-} __attribute__ ((packed));
-
-/**
- * struct iwl3945_tx_power
- *
- * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
- *
- * Each entry contains two values:
- * 1)  DSP gain (or sometimes called DSP attenuation).  This is a fine-grained
- *     linear value that multiplies the output of the digital signal processor,
- *     before being sent to the analog radio.
- * 2)  Radio gain.  This sets the analog gain of the radio Tx path.
- *     It is a coarser setting, and behaves in a logarithmic (dB) fashion.
- *
- * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
- */
-struct iwl3945_tx_power {
-       u8 tx_gain;             /* gain for analog radio */
-       u8 dsp_atten;           /* gain for DSP */
-} __attribute__ ((packed));
-
-/**
- * struct iwl3945_power_per_rate
- *
- * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
- */
-struct iwl3945_power_per_rate {
-       u8 rate;                /* plcp */
-       struct iwl3945_tx_power tpc;
-       u8 reserved;
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (0a)
- * Alive and Error Commands & Responses:
- *
- *****************************************************************************/
-
-#define UCODE_VALID_OK cpu_to_le32(0x1)
-#define INITIALIZE_SUBTYPE    (9)
-
-/*
- * ("Initialize") REPLY_ALIVE = 0x1 (response only, not a command)
- *
- * uCode issues this "initialize alive" notification once the initialization
- * uCode image has completed its work, and is ready to load the runtime image.
- * This is the *first* "alive" notification that the driver will receive after
- * rebooting uCode; the "initialize" alive is indicated by subtype field == 9.
- *
- * See comments documenting "BSM" (bootstrap state machine).
- */
-struct iwl3945_init_alive_resp {
-       u8 ucode_minor;
-       u8 ucode_major;
-       __le16 reserved1;
-       u8 sw_rev[8];
-       u8 ver_type;
-       u8 ver_subtype;                 /* "9" for initialize alive */
-       __le16 reserved2;
-       __le32 log_event_table_ptr;
-       __le32 error_event_table_ptr;
-       __le32 timestamp;
-       __le32 is_valid;
-} __attribute__ ((packed));
-
-
-/**
- * REPLY_ALIVE = 0x1 (response only, not a command)
- *
- * uCode issues this "alive" notification once the runtime image is ready
- * to receive commands from the driver.  This is the *second* "alive"
- * notification that the driver will receive after rebooting uCode;
- * this "alive" is indicated by subtype field != 9.
- *
- * See comments documenting "BSM" (bootstrap state machine).
- *
- * This response includes two pointers to structures within the device's
- * data SRAM (access via HBUS_TARG_MEM_* regs) that are useful for debugging:
- *
- * 1)  log_event_table_ptr indicates base of the event log.  This traces
- *     a 256-entry history of uCode execution within a circular buffer.
- *
- * 2)  error_event_table_ptr indicates base of the error log.  This contains
- *     information about any uCode error that occurs.
- *
- * The Linux driver can print both logs to the system log when a uCode error
- * occurs.
- */
-struct iwl3945_alive_resp {
-       u8 ucode_minor;
-       u8 ucode_major;
-       __le16 reserved1;
-       u8 sw_rev[8];
-       u8 ver_type;
-       u8 ver_subtype;                 /* not "9" for runtime alive */
-       __le16 reserved2;
-       __le32 log_event_table_ptr;     /* SRAM address for event log */
-       __le32 error_event_table_ptr;   /* SRAM address for error log */
-       __le32 timestamp;
-       __le32 is_valid;
-} __attribute__ ((packed));
-
-union tsf {
-       u8 byte[8];
-       __le16 word[4];
-       __le32 dw[2];
-};
-
-/*
- * REPLY_ERROR = 0x2 (response only, not a command)
- */
-struct iwl3945_error_resp {
-       __le32 error_type;
-       u8 cmd_id;
-       u8 reserved1;
-       __le16 bad_cmd_seq_num;
-       __le16 reserved2;
-       __le32 error_info;
-       union tsf timestamp;
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (1)
- * RXON Commands & Responses:
- *
- *****************************************************************************/
-
-/*
- * Rx config defines & structure
- */
-/* rx_config device types  */
-enum {
-       RXON_DEV_TYPE_AP = 1,
-       RXON_DEV_TYPE_ESS = 3,
-       RXON_DEV_TYPE_IBSS = 4,
-       RXON_DEV_TYPE_SNIFFER = 6,
-};
-
-/* rx_config flags */
-/* band & modulation selection */
-#define RXON_FLG_BAND_24G_MSK           cpu_to_le32(1 << 0)
-#define RXON_FLG_CCK_MSK                cpu_to_le32(1 << 1)
-/* auto detection enable */
-#define RXON_FLG_AUTO_DETECT_MSK        cpu_to_le32(1 << 2)
-/* TGg protection when tx */
-#define RXON_FLG_TGG_PROTECT_MSK        cpu_to_le32(1 << 3)
-/* cck short slot & preamble */
-#define RXON_FLG_SHORT_SLOT_MSK          cpu_to_le32(1 << 4)
-#define RXON_FLG_SHORT_PREAMBLE_MSK     cpu_to_le32(1 << 5)
-/* antenna selection */
-#define RXON_FLG_DIS_DIV_MSK            cpu_to_le32(1 << 7)
-#define RXON_FLG_ANT_SEL_MSK            cpu_to_le32(0x0f00)
-#define RXON_FLG_ANT_A_MSK              cpu_to_le32(1 << 8)
-#define RXON_FLG_ANT_B_MSK              cpu_to_le32(1 << 9)
-/* radar detection enable */
-#define RXON_FLG_RADAR_DETECT_MSK       cpu_to_le32(1 << 12)
-#define RXON_FLG_TGJ_NARROW_BAND_MSK    cpu_to_le32(1 << 13)
-/* rx response to host with 8-byte TSF
-* (according to ON_AIR deassertion) */
-#define RXON_FLG_TSF2HOST_MSK           cpu_to_le32(1 << 15)
-
-/* rx_config filter flags */
-/* accept all data frames */
-#define RXON_FILTER_PROMISC_MSK         cpu_to_le32(1 << 0)
-/* pass control & management to host */
-#define RXON_FILTER_CTL2HOST_MSK        cpu_to_le32(1 << 1)
-/* accept multi-cast */
-#define RXON_FILTER_ACCEPT_GRP_MSK      cpu_to_le32(1 << 2)
-/* don't decrypt uni-cast frames */
-#define RXON_FILTER_DIS_DECRYPT_MSK     cpu_to_le32(1 << 3)
-/* don't decrypt multi-cast frames */
-#define RXON_FILTER_DIS_GRP_DECRYPT_MSK cpu_to_le32(1 << 4)
-/* STA is associated */
-#define RXON_FILTER_ASSOC_MSK           cpu_to_le32(1 << 5)
-/* transfer to host non bssid beacons in associated state */
-#define RXON_FILTER_BCON_AWARE_MSK      cpu_to_le32(1 << 6)
-
-/**
- * REPLY_RXON = 0x10 (command, has simple generic response)
- *
- * RXON tunes the radio tuner to a service channel, and sets up a number
- * of parameters that are used primarily for Rx, but also for Tx operations.
- *
- * NOTE:  When tuning to a new channel, driver must set the
- *        RXON_FILTER_ASSOC_MSK to 0.  This will clear station-dependent
- *        info within the device, including the station tables, tx retry
- *        rate tables, and txpower tables.  Driver must build a new station
- *        table and txpower table before transmitting anything on the RXON
- *        channel.
- *
- * NOTE:  All RXONs wipe clean the internal txpower table.  Driver must
- *        issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
- *        regardless of whether RXON_FILTER_ASSOC_MSK is set.
- */
-struct iwl3945_rxon_cmd {
-       u8 node_addr[6];
-       __le16 reserved1;
-       u8 bssid_addr[6];
-       __le16 reserved2;
-       u8 wlap_bssid_addr[6];
-       __le16 reserved3;
-       u8 dev_type;
-       u8 air_propagation;
-       __le16 reserved4;
-       u8 ofdm_basic_rates;
-       u8 cck_basic_rates;
-       __le16 assoc_id;
-       __le32 flags;
-       __le32 filter_flags;
-       __le16 channel;
-       __le16 reserved5;
-} __attribute__ ((packed));
-
-/*
- * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
- */
-struct iwl3945_rxon_assoc_cmd {
-       __le32 flags;
-       __le32 filter_flags;
-       u8 ofdm_basic_rates;
-       u8 cck_basic_rates;
-       __le16 reserved;
-} __attribute__ ((packed));
-
-/*
- * REPLY_RXON_TIMING = 0x14 (command, has simple generic response)
- */
-struct iwl3945_rxon_time_cmd {
-       union tsf timestamp;
-       __le16 beacon_interval;
-       __le16 atim_window;
-       __le32 beacon_init_val;
-       __le16 listen_interval;
-       __le16 reserved;
-} __attribute__ ((packed));
-
-/*
- * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
- */
-struct iwl3945_channel_switch_cmd {
-       u8 band;
-       u8 expect_beacon;
-       __le16 channel;
-       __le32 rxon_flags;
-       __le32 rxon_filter_flags;
-       __le32 switch_time;
-       struct iwl3945_power_per_rate power[IWL_MAX_RATES];
-} __attribute__ ((packed));
-
-/*
- * CHANNEL_SWITCH_NOTIFICATION = 0x73 (notification only, not a command)
- */
-struct iwl3945_csa_notification {
-       __le16 band;
-       __le16 channel;
-       __le32 status;          /* 0 - OK, 1 - fail */
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (2)
- * Quality-of-Service (QOS) Commands & Responses:
- *
- *****************************************************************************/
-
-/**
- * struct iwl_ac_qos -- QOS timing params for REPLY_QOS_PARAM
- * One for each of 4 EDCA access categories in struct iwl_qosparam_cmd
- *
- * @cw_min: Contention window, start value in numbers of slots.
- *          Should be a power-of-2, minus 1.  Device's default is 0x0f.
- * @cw_max: Contention window, max value in numbers of slots.
- *          Should be a power-of-2, minus 1.  Device's default is 0x3f.
- * @aifsn:  Number of slots in Arbitration Interframe Space (before
- *          performing random backoff timing prior to Tx).  Device default 1.
- * @edca_txop:  Length of Tx opportunity, in uSecs.  Device default is 0.
- *
- * Device will automatically increase contention window by (2*CW) + 1 for each
- * transmission retry.  Device uses cw_max as a bit mask, ANDed with new CW
- * value, to cap the CW value.
- */
-struct iwl3945_ac_qos {
-       __le16 cw_min;
-       __le16 cw_max;
-       u8 aifsn;
-       u8 reserved1;
-       __le16 edca_txop;
-} __attribute__ ((packed));
-
-/* QoS flags defines */
-#define QOS_PARAM_FLG_UPDATE_EDCA_MSK  cpu_to_le32(0x01)
-#define QOS_PARAM_FLG_TGN_MSK          cpu_to_le32(0x02)
-#define QOS_PARAM_FLG_TXOP_TYPE_MSK    cpu_to_le32(0x10)
-
-/* Number of Access Categories (AC) (EDCA), queues 0..3 */
-#define AC_NUM                4
-
-/*
- * REPLY_QOS_PARAM = 0x13 (command, has simple generic response)
- *
- * This command sets up timings for each of the 4 prioritized EDCA Tx FIFOs
- * 0: Background, 1: Best Effort, 2: Video, 3: Voice.
- */
-struct iwl3945_qosparam_cmd {
-       __le32 qos_flags;
-       struct iwl3945_ac_qos ac[AC_NUM];
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (3)
- * Add/Modify Stations Commands & Responses:
- *
- *****************************************************************************/
-/*
- * Multi station support
- */
-
-/* Special, dedicated locations within device's station table */
-#define        IWL_AP_ID               0
-#define IWL_MULTICAST_ID       1
-#define        IWL_STA_ID              2
-#define        IWL3945_BROADCAST_ID    24
-#define IWL3945_STATION_COUNT  25
-
-#define        IWL_STATION_COUNT       32      /* MAX(3945,4965)*/
-#define        IWL_INVALID_STATION     255
-
-#define STA_FLG_TX_RATE_MSK            cpu_to_le32(1 << 2);
-#define STA_FLG_PWR_SAVE_MSK           cpu_to_le32(1 << 8);
-
-/* Use in mode field.  1: modify existing entry, 0: add new station entry */
-#define STA_CONTROL_MODIFY_MSK         0x01
-
-/* key flags __le16*/
-#define STA_KEY_FLG_ENCRYPT_MSK        cpu_to_le16(0x0007)
-#define STA_KEY_FLG_NO_ENC     cpu_to_le16(0x0000)
-#define STA_KEY_FLG_WEP                cpu_to_le16(0x0001)
-#define STA_KEY_FLG_CCMP       cpu_to_le16(0x0002)
-#define STA_KEY_FLG_TKIP       cpu_to_le16(0x0003)
-
-#define STA_KEY_FLG_KEYID_POS  8
-#define STA_KEY_FLG_INVALID    cpu_to_le16(0x0800)
-/* wep key is either from global key (0) or from station info array (1) */
-#define STA_KEY_FLG_WEP_KEY_MAP_MSK  cpu_to_le16(0x0008)
-
-/* wep key in STA: 5-bytes (0) or 13-bytes (1) */
-#define STA_KEY_FLG_KEY_SIZE_MSK     cpu_to_le16(0x1000)
-#define STA_KEY_MULTICAST_MSK        cpu_to_le16(0x4000)
-
-/* Flags indicate whether to modify vs. don't change various station params */
-#define        STA_MODIFY_KEY_MASK             0x01
-#define        STA_MODIFY_TID_DISABLE_TX       0x02
-#define        STA_MODIFY_TX_RATE_MSK          0x04
-
-/*
- * Antenna masks:
- * bit14:15 01 B inactive, A active
- *          10 B active, A inactive
- *          11 Both active
- */
-#define RATE_MCS_ANT_A_POS     14
-#define RATE_MCS_ANT_B_POS     15
-#define RATE_MCS_ANT_A_MSK     0x4000
-#define RATE_MCS_ANT_B_MSK     0x8000
-#define RATE_MCS_ANT_AB_MSK    0xc000
-
-struct iwl3945_keyinfo {
-       __le16 key_flags;
-       u8 tkip_rx_tsc_byte2;   /* TSC[2] for key mix ph1 detection */
-       u8 reserved1;
-       __le16 tkip_rx_ttak[5]; /* 10-byte unicast TKIP TTAK */
-       u8 key_offset;
-       u8 reserved2;
-       u8 key[16];             /* 16-byte unicast decryption key */
-} __attribute__ ((packed));
-
-/**
- * struct sta_id_modify
- * @addr[ETH_ALEN]: station's MAC address
- * @sta_id: index of station in uCode's station table
- * @modify_mask: STA_MODIFY_*, 1: modify, 0: don't change
- *
- * Driver selects unused table index when adding new station,
- * or the index to a pre-existing station entry when modifying that station.
- * Some indexes have special purposes (IWL_AP_ID, index 0, is for AP).
- *
- * modify_mask flags select which parameters to modify vs. leave alone.
- */
-struct sta_id_modify {
-       u8 addr[ETH_ALEN];
-       __le16 reserved1;
-       u8 sta_id;
-       u8 modify_mask;
-       __le16 reserved2;
-} __attribute__ ((packed));
-
-/*
- * REPLY_ADD_STA = 0x18 (command)
- *
- * The device contains an internal table of per-station information,
- * with info on security keys, aggregation parameters, and Tx rates for
- * initial Tx attempt and any retries (4965 uses REPLY_TX_LINK_QUALITY_CMD,
- * 3945 uses REPLY_RATE_SCALE to set up rate tables).
- *
- * REPLY_ADD_STA sets up the table entry for one station, either creating
- * a new entry, or modifying a pre-existing one.
- *
- * NOTE:  RXON command (without "associated" bit set) wipes the station table
- *        clean.  Moving into RF_KILL state does this also.  Driver must set up
- *        new station table before transmitting anything on the RXON channel
- *        (except active scans or active measurements; those commands carry
- *        their own txpower/rate setup data).
- *
- *        When getting started on a new channel, driver must set up the
- *        IWL_BROADCAST_ID entry (last entry in the table).  For a client
- *        station in a BSS, once an AP is selected, driver sets up the AP STA
- *        in the IWL_AP_ID entry (1st entry in the table).  BROADCAST and AP
- *        are all that are needed for a BSS client station.  If the device is
- *        used as AP, or in an IBSS network, driver must set up station table
- *        entries for all STAs in network, starting with index IWL_STA_ID.
- */
-struct iwl3945_addsta_cmd {
-       u8 mode;                /* 1: modify existing, 0: add new station */
-       u8 reserved[3];
-       struct sta_id_modify sta;
-       struct iwl3945_keyinfo key;
-       __le32 station_flags;           /* STA_FLG_* */
-       __le32 station_flags_msk;       /* STA_FLG_* */
-
-       /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
-        * corresponding to bit (e.g. bit 5 controls TID 5).
-        * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
-       __le16 tid_disable_tx;
-
-       __le16 rate_n_flags;
-
-       /* TID for which to add block-ack support.
-        * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
-       u8 add_immediate_ba_tid;
-
-       /* TID for which to remove block-ack support.
-        * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
-       u8 remove_immediate_ba_tid;
-
-       /* Starting Sequence Number for added block-ack support.
-        * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
-       __le16 add_immediate_ba_ssn;
-} __attribute__ ((packed));
-
-#define ADD_STA_SUCCESS_MSK            0x1
-#define ADD_STA_NO_ROOM_IN_TABLE       0x2
-#define ADD_STA_NO_BLOCK_ACK_RESOURCE  0x4
-/*
- * REPLY_ADD_STA = 0x18 (response)
- */
-struct iwl3945_add_sta_resp {
-       u8 status;      /* ADD_STA_* */
-} __attribute__ ((packed));
-
-
-/******************************************************************************
- * (4)
- * Rx Responses:
- *
- *****************************************************************************/
-
-struct iwl3945_rx_frame_stats {
-       u8 phy_count;
-       u8 id;
-       u8 rssi;
-       u8 agc;
-       __le16 sig_avg;
-       __le16 noise_diff;
-       u8 payload[0];
-} __attribute__ ((packed));
-
-struct iwl3945_rx_frame_hdr {
-       __le16 channel;
-       __le16 phy_flags;
-       u8 reserved1;
-       u8 rate;
-       __le16 len;
-       u8 payload[0];
-} __attribute__ ((packed));
-
-#define RX_RES_STATUS_NO_CRC32_ERROR   cpu_to_le32(1 << 0)
-#define RX_RES_STATUS_NO_RXE_OVERFLOW  cpu_to_le32(1 << 1)
-
-#define RX_RES_PHY_FLAGS_BAND_24_MSK   cpu_to_le16(1 << 0)
-#define RX_RES_PHY_FLAGS_MOD_CCK_MSK           cpu_to_le16(1 << 1)
-#define RX_RES_PHY_FLAGS_SHORT_PREAMBLE_MSK    cpu_to_le16(1 << 2)
-#define RX_RES_PHY_FLAGS_NARROW_BAND_MSK       cpu_to_le16(1 << 3)
-#define RX_RES_PHY_FLAGS_ANTENNA_MSK           cpu_to_le16(0xf0)
-
-#define RX_RES_STATUS_SEC_TYPE_MSK     (0x7 << 8)
-#define RX_RES_STATUS_SEC_TYPE_NONE    (0x0 << 8)
-#define RX_RES_STATUS_SEC_TYPE_WEP     (0x1 << 8)
-#define RX_RES_STATUS_SEC_TYPE_CCMP    (0x2 << 8)
-#define RX_RES_STATUS_SEC_TYPE_TKIP    (0x3 << 8)
-
-#define RX_RES_STATUS_DECRYPT_TYPE_MSK (0x3 << 11)
-#define RX_RES_STATUS_NOT_DECRYPT      (0x0 << 11)
-#define RX_RES_STATUS_DECRYPT_OK       (0x3 << 11)
-#define RX_RES_STATUS_BAD_ICV_MIC      (0x1 << 11)
-#define RX_RES_STATUS_BAD_KEY_TTAK     (0x2 << 11)
-
-struct iwl3945_rx_frame_end {
-       __le32 status;
-       __le64 timestamp;
-       __le32 beacon_timestamp;
-} __attribute__ ((packed));
-
-/*
- * REPLY_3945_RX = 0x1b (response only, not a command)
- *
- * NOTE:  DO NOT dereference from casts to this structure
- * It is provided only for calculating minimum data set size.
- * The actual offsets of the hdr and end are dynamic based on
- * stats.phy_count
- */
-struct iwl3945_rx_frame {
-       struct iwl3945_rx_frame_stats stats;
-       struct iwl3945_rx_frame_hdr hdr;
-       struct iwl3945_rx_frame_end end;
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (5)
- * Tx Commands & Responses:
- *
- * Driver must place each REPLY_TX command into one of the prioritized Tx
- * queues in host DRAM, shared between driver and device.  When the device's
- * Tx scheduler and uCode are preparing to transmit, the device pulls the
- * Tx command over the PCI bus via one of the device's Tx DMA channels,
- * to fill an internal FIFO from which data will be transmitted.
- *
- * uCode handles all timing and protocol related to control frames
- * (RTS/CTS/ACK), based on flags in the Tx command.
- *
- * uCode handles retrying Tx when an ACK is expected but not received.
- * This includes trying lower data rates than the one requested in the Tx
- * command, as set up by the REPLY_RATE_SCALE (for 3945) or
- * REPLY_TX_LINK_QUALITY_CMD (4965).
- *
- * Driver sets up transmit power for various rates via REPLY_TX_PWR_TABLE_CMD.
- * This command must be executed after every RXON command, before Tx can occur.
- *****************************************************************************/
-
-/* REPLY_TX Tx flags field */
-
-/* 1: Use Request-To-Send protocol before this frame.
- * Mutually exclusive vs. TX_CMD_FLG_CTS_MSK. */
-#define TX_CMD_FLG_RTS_MSK cpu_to_le32(1 << 1)
-
-/* 1: Transmit Clear-To-Send to self before this frame.
- * Driver should set this for AUTH/DEAUTH/ASSOC-REQ/REASSOC mgmnt frames.
- * Mutually exclusive vs. TX_CMD_FLG_RTS_MSK. */
-#define TX_CMD_FLG_CTS_MSK cpu_to_le32(1 << 2)
-
-/* 1: Expect ACK from receiving station
- * 0: Don't expect ACK (MAC header's duration field s/b 0)
- * Set this for unicast frames, but not broadcast/multicast. */
-#define TX_CMD_FLG_ACK_MSK cpu_to_le32(1 << 3)
-
-/* 1: Use rate scale table (see REPLY_TX_LINK_QUALITY_CMD).
- *    Tx command's initial_rate_index indicates first rate to try;
- *    uCode walks through table for additional Tx attempts.
- * 0: Use Tx rate/MCS from Tx command's rate_n_flags field.
- *    This rate will be used for all Tx attempts; it will not be scaled. */
-#define TX_CMD_FLG_STA_RATE_MSK cpu_to_le32(1 << 4)
-
-/* 1: Expect immediate block-ack.
- * Set when Txing a block-ack request frame.  Also set TX_CMD_FLG_ACK_MSK. */
-#define TX_CMD_FLG_IMM_BA_RSP_MASK  cpu_to_le32(1 << 6)
-
-/* 1: Frame requires full Tx-Op protection.
- * Set this if either RTS or CTS Tx Flag gets set. */
-#define TX_CMD_FLG_FULL_TXOP_PROT_MSK cpu_to_le32(1 << 7)
-
-/* Tx antenna selection field; used only for 3945, reserved (0) for 4965.
- * Set field to "0" to allow 3945 uCode to select antenna (normal usage). */
-#define TX_CMD_FLG_ANT_SEL_MSK cpu_to_le32(0xf00)
-#define TX_CMD_FLG_ANT_A_MSK cpu_to_le32(1 << 8)
-#define TX_CMD_FLG_ANT_B_MSK cpu_to_le32(1 << 9)
-
-/* 1: Ignore Bluetooth priority for this frame.
- * 0: Delay Tx until Bluetooth device is done (normal usage). */
-#define TX_CMD_FLG_BT_DIS_MSK cpu_to_le32(1 << 12)
-
-/* 1: uCode overrides sequence control field in MAC header.
- * 0: Driver provides sequence control field in MAC header.
- * Set this for management frames, non-QOS data frames, non-unicast frames,
- * and also in Tx command embedded in REPLY_SCAN_CMD for active scans. */
-#define TX_CMD_FLG_SEQ_CTL_MSK cpu_to_le32(1 << 13)
-
-/* 1: This frame is non-last MPDU; more fragments are coming.
- * 0: Last fragment, or not using fragmentation. */
-#define TX_CMD_FLG_MORE_FRAG_MSK cpu_to_le32(1 << 14)
-
-/* 1: uCode calculates and inserts Timestamp Function (TSF) in outgoing frame.
- * 0: No TSF required in outgoing frame.
- * Set this for transmitting beacons and probe responses. */
-#define TX_CMD_FLG_TSF_MSK cpu_to_le32(1 << 16)
-
-/* 1: Driver inserted 2 bytes pad after the MAC header, for (required) dword
- *    alignment of frame's payload data field.
- * 0: No pad
- * Set this for MAC headers with 26 or 30 bytes, i.e. those with QOS or ADDR4
- * field (but not both).  Driver must align frame data (i.e. data following
- * MAC header) to DWORD boundary. */
-#define TX_CMD_FLG_MH_PAD_MSK cpu_to_le32(1 << 20)
-
-/* HCCA-AP - disable duration overwriting. */
-#define TX_CMD_FLG_DUR_MSK cpu_to_le32(1 << 25)
-
-/*
- * TX command security control
- */
-#define TX_CMD_SEC_WEP         0x01
-#define TX_CMD_SEC_CCM         0x02
-#define TX_CMD_SEC_TKIP                0x03
-#define TX_CMD_SEC_MSK         0x03
-#define TX_CMD_SEC_SHIFT       6
-#define TX_CMD_SEC_KEY128      0x08
-
-/*
- * REPLY_TX = 0x1c (command)
- */
-struct iwl3945_tx_cmd {
-       /*
-        * MPDU byte count:
-        * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
-        * + 8 byte IV for CCM or TKIP (not used for WEP)
-        * + Data payload
-        * + 8-byte MIC (not used for CCM/WEP)
-        * NOTE:  Does not include Tx command bytes, post-MAC pad bytes,
-        *        MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
-        * Range: 14-2342 bytes.
-        */
-       __le16 len;
-
-       /*
-        * MPDU or MSDU byte count for next frame.
-        * Used for fragmentation and bursting, but not 11n aggregation.
-        * Same as "len", but for next frame.  Set to 0 if not applicable.
-        */
-       __le16 next_frame_len;
-
-       __le32 tx_flags;        /* TX_CMD_FLG_* */
-
-       u8 rate;
-
-       /* Index of recipient station in uCode's station table */
-       u8 sta_id;
-       u8 tid_tspec;
-       u8 sec_ctl;
-       u8 key[16];
-       union {
-               u8 byte[8];
-               __le16 word[4];
-               __le32 dw[2];
-       } tkip_mic;
-       __le32 next_frame_info;
-       union {
-               __le32 life_time;
-               __le32 attempt;
-       } stop_time;
-       u8 supp_rates[2];
-       u8 rts_retry_limit;     /*byte 50 */
-       u8 data_retry_limit;    /*byte 51 */
-       union {
-               __le16 pm_frame_timeout;
-               __le16 attempt_duration;
-       } timeout;
-
-       /*
-        * Duration of EDCA burst Tx Opportunity, in 32-usec units.
-        * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
-        */
-       __le16 driver_txop;
-
-       /*
-        * MAC header goes here, followed by 2 bytes padding if MAC header
-        * length is 26 or 30 bytes, followed by payload data
-        */
-       u8 payload[0];
-       struct ieee80211_hdr hdr[0];
-} __attribute__ ((packed));
-
-/* TX command response is sent after *all* transmission attempts.
- *
- * NOTES:
- *
- * TX_STATUS_FAIL_NEXT_FRAG
- *
- * If the fragment flag in the MAC header for the frame being transmitted
- * is set and there is insufficient time to transmit the next frame, the
- * TX status will be returned with 'TX_STATUS_FAIL_NEXT_FRAG'.
- *
- * TX_STATUS_FIFO_UNDERRUN
- *
- * Indicates the host did not provide bytes to the FIFO fast enough while
- * a TX was in progress.
- *
- * TX_STATUS_FAIL_MGMNT_ABORT
- *
- * This status is only possible if the ABORT ON MGMT RX parameter was
- * set to true with the TX command.
- *
- * If the MSB of the status parameter is set then an abort sequence is
- * required.  This sequence consists of the host activating the TX Abort
- * control line, and then waiting for the TX Abort command response.  This
- * indicates that a the device is no longer in a transmit state, and that the
- * command FIFO has been cleared.  The host must then deactivate the TX Abort
- * control line.  Receiving is still allowed in this case.
- */
-enum {
-       TX_STATUS_SUCCESS = 0x01,
-       TX_STATUS_DIRECT_DONE = 0x02,
-       TX_STATUS_FAIL_SHORT_LIMIT = 0x82,
-       TX_STATUS_FAIL_LONG_LIMIT = 0x83,
-       TX_STATUS_FAIL_FIFO_UNDERRUN = 0x84,
-       TX_STATUS_FAIL_MGMNT_ABORT = 0x85,
-       TX_STATUS_FAIL_NEXT_FRAG = 0x86,
-       TX_STATUS_FAIL_LIFE_EXPIRE = 0x87,
-       TX_STATUS_FAIL_DEST_PS = 0x88,
-       TX_STATUS_FAIL_ABORTED = 0x89,
-       TX_STATUS_FAIL_BT_RETRY = 0x8a,
-       TX_STATUS_FAIL_STA_INVALID = 0x8b,
-       TX_STATUS_FAIL_FRAG_DROPPED = 0x8c,
-       TX_STATUS_FAIL_TID_DISABLE = 0x8d,
-       TX_STATUS_FAIL_FRAME_FLUSHED = 0x8e,
-       TX_STATUS_FAIL_INSUFFICIENT_CF_POLL = 0x8f,
-       TX_STATUS_FAIL_TX_LOCKED = 0x90,
-       TX_STATUS_FAIL_NO_BEACON_ON_RADAR = 0x91,
-};
-
-#define        TX_PACKET_MODE_REGULAR          0x0000
-#define        TX_PACKET_MODE_BURST_SEQ        0x0100
-#define        TX_PACKET_MODE_BURST_FIRST      0x0200
-
-enum {
-       TX_POWER_PA_NOT_ACTIVE = 0x0,
-};
-
-enum {
-       TX_STATUS_MSK = 0x000000ff,     /* bits 0:7 */
-       TX_STATUS_DELAY_MSK = 0x00000040,
-       TX_STATUS_ABORT_MSK = 0x00000080,
-       TX_PACKET_MODE_MSK = 0x0000ff00,        /* bits 8:15 */
-       TX_FIFO_NUMBER_MSK = 0x00070000,        /* bits 16:18 */
-       TX_RESERVED = 0x00780000,       /* bits 19:22 */
-       TX_POWER_PA_DETECT_MSK = 0x7f800000,    /* bits 23:30 */
-       TX_ABORT_REQUIRED_MSK = 0x80000000,     /* bits 31:31 */
-};
-
-/*
- * REPLY_TX = 0x1c (response)
- */
-struct iwl3945_tx_resp {
-       u8 failure_rts;
-       u8 failure_frame;
-       u8 bt_kill_count;
-       u8 rate;
-       __le32 wireless_media_time;
-       __le32 status;          /* TX status */
-} __attribute__ ((packed));
-
-/*
- * REPLY_TX_PWR_TABLE_CMD = 0x97 (command, has simple generic response)
- */
-struct iwl3945_txpowertable_cmd {
-       u8 band;                /* 0: 5 GHz, 1: 2.4 GHz */
-       u8 reserved;
-       __le16 channel;
-       struct iwl3945_power_per_rate power[IWL_MAX_RATES];
-} __attribute__ ((packed));
-
-struct iwl3945_rate_scaling_info {
-       __le16 rate_n_flags;
-       u8 try_cnt;
-       u8 next_rate_index;
-} __attribute__ ((packed));
-
-/**
- * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
- *
- * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
- *
- * NOTE: The table of rates passed to the uCode via the
- * RATE_SCALE command sets up the corresponding order of
- * rates used for all related commands, including rate
- * masks, etc.
- *
- * For example, if you set 9MB (PLCP 0x0f) as the first
- * rate in the rate table, the bit mask for that rate
- * when passed through ofdm_basic_rates on the REPLY_RXON
- * command would be bit 0 (1 << 0)
- */
-struct iwl3945_rate_scaling_cmd {
-       u8 table_id;
-       u8 reserved[3];
-       struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
-} __attribute__ ((packed));
-
-/*
- * REPLY_BT_CONFIG = 0x9b (command, has simple generic response)
- *
- * 3945 and 4965 support hardware handshake with Bluetooth device on
- * same platform.  Bluetooth device alerts wireless device when it will Tx;
- * wireless device can delay or kill its own Tx to accommodate.
- */
-struct iwl3945_bt_cmd {
-       u8 flags;
-       u8 lead_time;
-       u8 max_kill;
-       u8 reserved;
-       __le32 kill_ack_mask;
-       __le32 kill_cts_mask;
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (6)
- * Spectrum Management (802.11h) Commands, Responses, Notifications:
- *
- *****************************************************************************/
-
-/*
- * Spectrum Management
- */
-#define MEASUREMENT_FILTER_FLAG (RXON_FILTER_PROMISC_MSK         | \
-                                RXON_FILTER_CTL2HOST_MSK        | \
-                                RXON_FILTER_ACCEPT_GRP_MSK      | \
-                                RXON_FILTER_DIS_DECRYPT_MSK     | \
-                                RXON_FILTER_DIS_GRP_DECRYPT_MSK | \
-                                RXON_FILTER_ASSOC_MSK           | \
-                                RXON_FILTER_BCON_AWARE_MSK)
-
-struct iwl3945_measure_channel {
-       __le32 duration;        /* measurement duration in extended beacon
-                                * format */
-       u8 channel;             /* channel to measure */
-       u8 type;                /* see enum iwl3945_measure_type */
-       __le16 reserved;
-} __attribute__ ((packed));
-
-/*
- * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (command)
- */
-struct iwl3945_spectrum_cmd {
-       __le16 len;             /* number of bytes starting from token */
-       u8 token;               /* token id */
-       u8 id;                  /* measurement id -- 0 or 1 */
-       u8 origin;              /* 0 = TGh, 1 = other, 2 = TGk */
-       u8 periodic;            /* 1 = periodic */
-       __le16 path_loss_timeout;
-       __le32 start_time;      /* start time in extended beacon format */
-       __le32 reserved2;
-       __le32 flags;           /* rxon flags */
-       __le32 filter_flags;    /* rxon filter flags */
-       __le16 channel_count;   /* minimum 1, maximum 10 */
-       __le16 reserved3;
-       struct iwl3945_measure_channel channels[10];
-} __attribute__ ((packed));
-
-/*
- * REPLY_SPECTRUM_MEASUREMENT_CMD = 0x74 (response)
- */
-struct iwl3945_spectrum_resp {
-       u8 token;
-       u8 id;                  /* id of the prior command replaced, or 0xff */
-       __le16 status;          /* 0 - command will be handled
-                                * 1 - cannot handle (conflicts with another
-                                *     measurement) */
-} __attribute__ ((packed));
-
-enum iwl3945_measurement_state {
-       IWL_MEASUREMENT_START = 0,
-       IWL_MEASUREMENT_STOP = 1,
-};
-
-enum iwl3945_measurement_status {
-       IWL_MEASUREMENT_OK = 0,
-       IWL_MEASUREMENT_CONCURRENT = 1,
-       IWL_MEASUREMENT_CSA_CONFLICT = 2,
-       IWL_MEASUREMENT_TGH_CONFLICT = 3,
-       /* 4-5 reserved */
-       IWL_MEASUREMENT_STOPPED = 6,
-       IWL_MEASUREMENT_TIMEOUT = 7,
-       IWL_MEASUREMENT_PERIODIC_FAILED = 8,
-};
-
-#define NUM_ELEMENTS_IN_HISTOGRAM 8
-
-struct iwl3945_measurement_histogram {
-       __le32 ofdm[NUM_ELEMENTS_IN_HISTOGRAM]; /* in 0.8usec counts */
-       __le32 cck[NUM_ELEMENTS_IN_HISTOGRAM];  /* in 1usec counts */
-} __attribute__ ((packed));
-
-/* clear channel availability counters */
-struct iwl3945_measurement_cca_counters {
-       __le32 ofdm;
-       __le32 cck;
-} __attribute__ ((packed));
-
-enum iwl3945_measure_type {
-       IWL_MEASURE_BASIC = (1 << 0),
-       IWL_MEASURE_CHANNEL_LOAD = (1 << 1),
-       IWL_MEASURE_HISTOGRAM_RPI = (1 << 2),
-       IWL_MEASURE_HISTOGRAM_NOISE = (1 << 3),
-       IWL_MEASURE_FRAME = (1 << 4),
-       /* bits 5:6 are reserved */
-       IWL_MEASURE_IDLE = (1 << 7),
-};
-
-/*
- * SPECTRUM_MEASURE_NOTIFICATION = 0x75 (notification only, not a command)
- */
-struct iwl3945_spectrum_notification {
-       u8 id;                  /* measurement id -- 0 or 1 */
-       u8 token;
-       u8 channel_index;       /* index in measurement channel list */
-       u8 state;               /* 0 - start, 1 - stop */
-       __le32 start_time;      /* lower 32-bits of TSF */
-       u8 band;                /* 0 - 5.2GHz, 1 - 2.4GHz */
-       u8 channel;
-       u8 type;                /* see enum iwl3945_measurement_type */
-       u8 reserved1;
-       /* NOTE:  cca_ofdm, cca_cck, basic_type, and histogram are only only
-        * valid if applicable for measurement type requested. */
-       __le32 cca_ofdm;        /* cca fraction time in 40Mhz clock periods */
-       __le32 cca_cck;         /* cca fraction time in 44Mhz clock periods */
-       __le32 cca_time;        /* channel load time in usecs */
-       u8 basic_type;          /* 0 - bss, 1 - ofdm preamble, 2 -
-                                * unidentified */
-       u8 reserved2[3];
-       struct iwl3945_measurement_histogram histogram;
-       __le32 stop_time;       /* lower 32-bits of TSF */
-       __le32 status;          /* see iwl3945_measurement_status */
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (7)
- * Power Management Commands, Responses, Notifications:
- *
- *****************************************************************************/
-
-/**
- * struct iwl3945_powertable_cmd - Power Table Command
- * @flags: See below:
- *
- * POWER_TABLE_CMD = 0x77 (command, has simple generic response)
- *
- * PM allow:
- *   bit 0 - '0' Driver not allow power management
- *           '1' Driver allow PM (use rest of parameters)
- * uCode send sleep notifications:
- *   bit 1 - '0' Don't send sleep notification
- *           '1' send sleep notification (SEND_PM_NOTIFICATION)
- * Sleep over DTIM
- *   bit 2 - '0' PM have to walk up every DTIM
- *           '1' PM could sleep over DTIM till listen Interval.
- * PCI power managed
- *   bit 3 - '0' (PCI_LINK_CTRL & 0x1)
- *           '1' !(PCI_LINK_CTRL & 0x1)
- * Force sleep Modes
- *   bit 31/30- '00' use both mac/xtal sleeps
- *              '01' force Mac sleep
- *              '10' force xtal sleep
- *              '11' Illegal set
- *
- * NOTE: if sleep_interval[SLEEP_INTRVL_TABLE_SIZE-1] > DTIM period then
- * ucode assume sleep over DTIM is allowed and we don't need to wakeup
- * for every DTIM.
- */
-#define IWL_POWER_VEC_SIZE 5
-
-#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK       cpu_to_le32(1 << 0)
-#define IWL_POWER_SLEEP_OVER_DTIM_MSK          cpu_to_le32(1 << 2)
-#define IWL_POWER_PCI_PM_MSK                   cpu_to_le32(1 << 3)
-struct iwl3945_powertable_cmd {
-       __le32 flags;
-       __le32 rx_data_timeout;
-       __le32 tx_data_timeout;
-       __le32 sleep_interval[IWL_POWER_VEC_SIZE];
-} __attribute__((packed));
-
-/*
- * PM_SLEEP_NOTIFICATION = 0x7A (notification only, not a command)
- * 3945 and 4965 identical.
- */
-struct iwl3945_sleep_notification {
-       u8 pm_sleep_mode;
-       u8 pm_wakeup_src;
-       __le16 reserved;
-       __le32 sleep_time;
-       __le32 tsf_low;
-       __le32 bcon_timer;
-} __attribute__ ((packed));
-
-/* Sleep states.  3945 and 4965 identical. */
-enum {
-       IWL_PM_NO_SLEEP = 0,
-       IWL_PM_SLP_MAC = 1,
-       IWL_PM_SLP_FULL_MAC_UNASSOCIATE = 2,
-       IWL_PM_SLP_FULL_MAC_CARD_STATE = 3,
-       IWL_PM_SLP_PHY = 4,
-       IWL_PM_SLP_REPENT = 5,
-       IWL_PM_WAKEUP_BY_TIMER = 6,
-       IWL_PM_WAKEUP_BY_DRIVER = 7,
-       IWL_PM_WAKEUP_BY_RFKILL = 8,
-       /* 3 reserved */
-       IWL_PM_NUM_OF_MODES = 12,
-};
-
-/*
- * REPLY_CARD_STATE_CMD = 0xa0 (command, has simple generic response)
- */
-#define CARD_STATE_CMD_DISABLE 0x00    /* Put card to sleep */
-#define CARD_STATE_CMD_ENABLE  0x01    /* Wake up card */
-#define CARD_STATE_CMD_HALT    0x02    /* Power down permanently */
-struct iwl3945_card_state_cmd {
-       __le32 status;          /* CARD_STATE_CMD_* request new power state */
-} __attribute__ ((packed));
-
-/*
- * CARD_STATE_NOTIFICATION = 0xa1 (notification only, not a command)
- */
-struct iwl3945_card_state_notif {
-       __le32 flags;
-} __attribute__ ((packed));
-
-#define HW_CARD_DISABLED   0x01
-#define SW_CARD_DISABLED   0x02
-#define RF_CARD_DISABLED   0x04
-#define RXON_CARD_DISABLED 0x10
-
-struct iwl3945_ct_kill_config {
-       __le32   reserved;
-       __le32   critical_temperature_M;
-       __le32   critical_temperature_R;
-}  __attribute__ ((packed));
-
-/******************************************************************************
- * (8)
- * Scan Commands, Responses, Notifications:
- *
- *****************************************************************************/
-
-/**
- * struct iwl3945_scan_channel - entry in REPLY_SCAN_CMD channel table
- *
- * One for each channel in the scan list.
- * Each channel can independently select:
- * 1)  SSID for directed active scans
- * 2)  Txpower setting (for rate specified within Tx command)
- * 3)  How long to stay on-channel (behavior may be modified by quiet_time,
- *     quiet_plcp_th, good_CRC_th)
- *
- * To avoid uCode errors, make sure the following are true (see comments
- * under struct iwl3945_scan_cmd about max_out_time and quiet_time):
- * 1)  If using passive_dwell (i.e. passive_dwell != 0):
- *     active_dwell <= passive_dwell (< max_out_time if max_out_time != 0)
- * 2)  quiet_time <= active_dwell
- * 3)  If restricting off-channel time (i.e. max_out_time !=0):
- *     passive_dwell < max_out_time
- *     active_dwell < max_out_time
- */
-struct iwl3945_scan_channel {
-       /*
-        * type is defined as:
-        * 0:0 1 = active, 0 = passive
-        * 1:4 SSID direct bit map; if a bit is set, then corresponding
-        *     SSID IE is transmitted in probe request.
-        * 5:7 reserved
-        */
-       u8 type;
-       u8 channel;     /* band is selected by iwl3945_scan_cmd "flags" field */
-       struct iwl3945_tx_power tpc;
-       __le16 active_dwell;    /* in 1024-uSec TU (time units), typ 5-50 */
-       __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
-} __attribute__ ((packed));
-
-/**
- * struct iwl3945_ssid_ie - directed scan network information element
- *
- * Up to 4 of these may appear in REPLY_SCAN_CMD, selected by "type" field
- * in struct iwl3945_scan_channel; each channel may select different ssids from
- * among the 4 entries.  SSID IEs get transmitted in reverse order of entry.
- */
-struct iwl3945_ssid_ie {
-       u8 id;
-       u8 len;
-       u8 ssid[32];
-} __attribute__ ((packed));
-
-#define PROBE_OPTION_MAX        0x4
-#define TX_CMD_LIFE_TIME_INFINITE      cpu_to_le32(0xFFFFFFFF)
-#define IWL_GOOD_CRC_TH                cpu_to_le16(1)
-#define IWL_MAX_SCAN_SIZE 1024
-
-/*
- * REPLY_SCAN_CMD = 0x80 (command)
- *
- * The hardware scan command is very powerful; the driver can set it up to
- * maintain (relatively) normal network traffic while doing a scan in the
- * background.  The max_out_time and suspend_time control the ratio of how
- * long the device stays on an associated network channel ("service channel")
- * vs. how long it's away from the service channel, tuned to other channels
- * for scanning.
- *
- * max_out_time is the max time off-channel (in usec), and suspend_time
- * is how long (in "extended beacon" format) that the scan is "suspended"
- * after returning to the service channel.  That is, suspend_time is the
- * time that we stay on the service channel, doing normal work, between
- * scan segments.  The driver may set these parameters differently to support
- * scanning when associated vs. not associated, and light vs. heavy traffic
- * loads when associated.
- *
- * After receiving this command, the device's scan engine does the following;
- *
- * 1)  Sends SCAN_START notification to driver
- * 2)  Checks to see if it has time to do scan for one channel
- * 3)  Sends NULL packet, with power-save (PS) bit set to 1,
- *     to tell AP that we're going off-channel
- * 4)  Tunes to first channel in scan list, does active or passive scan
- * 5)  Sends SCAN_RESULT notification to driver
- * 6)  Checks to see if it has time to do scan on *next* channel in list
- * 7)  Repeats 4-6 until it no longer has time to scan the next channel
- *     before max_out_time expires
- * 8)  Returns to service channel
- * 9)  Sends NULL packet with PS=0 to tell AP that we're back
- * 10) Stays on service channel until suspend_time expires
- * 11) Repeats entire process 2-10 until list is complete
- * 12) Sends SCAN_COMPLETE notification
- *
- * For fast, efficient scans, the scan command also has support for staying on
- * a channel for just a short time, if doing active scanning and getting no
- * responses to the transmitted probe request.  This time is controlled by
- * quiet_time, and the number of received packets below which a channel is
- * considered "quiet" is controlled by quiet_plcp_threshold.
- *
- * For active scanning on channels that have regulatory restrictions against
- * blindly transmitting, the scan can listen before transmitting, to make sure
- * that there is already legitimate activity on the channel.  If enough
- * packets are cleanly received on the channel (controlled by good_CRC_th,
- * typical value 1), the scan engine starts transmitting probe requests.
- *
- * Driver must use separate scan commands for 2.4 vs. 5 GHz bands.
- *
- * To avoid uCode errors, see timing restrictions described under
- * struct iwl3945_scan_channel.
- */
-struct iwl3945_scan_cmd {
-       __le16 len;
-       u8 reserved0;
-       u8 channel_count;       /* # channels in channel list */
-       __le16 quiet_time;      /* dwell only this # millisecs on quiet channel
-                                * (only for active scan) */
-       __le16 quiet_plcp_th;   /* quiet chnl is < this # pkts (typ. 1) */
-       __le16 good_CRC_th;     /* passive -> active promotion threshold */
-       __le16 reserved1;
-       __le32 max_out_time;    /* max usec to be away from associated (service)
-                                * channel */
-       __le32 suspend_time;    /* pause scan this long (in "extended beacon
-                                * format") when returning to service channel:
-                                * 3945; 31:24 # beacons, 19:0 additional usec,
-                                * 4965; 31:22 # beacons, 21:0 additional usec.
-                                */
-       __le32 flags;           /* RXON_FLG_* */
-       __le32 filter_flags;    /* RXON_FILTER_* */
-
-       /* For active scans (set to all-0s for passive scans).
-        * Does not include payload.  Must specify Tx rate; no rate scaling. */
-       struct iwl3945_tx_cmd tx_cmd;
-
-       /* For directed active scans (set to all-0s otherwise) */
-       struct iwl3945_ssid_ie direct_scan[PROBE_OPTION_MAX];
-
-       /*
-        * Probe request frame, followed by channel list.
-        *
-        * Size of probe request frame is specified by byte count in tx_cmd.
-        * Channel list follows immediately after probe request frame.
-        * Number of channels in list is specified by channel_count.
-        * Each channel in list is of type:
-        *
-        * struct iwl3945_scan_channel channels[0];
-        *
-        * NOTE:  Only one band of channels can be scanned per pass.  You
-        * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
-        * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
-        * before requesting another scan.
-        */
-       u8 data[0];
-} __attribute__ ((packed));
-
-/* Can abort will notify by complete notification with abort status. */
-#define CAN_ABORT_STATUS       cpu_to_le32(0x1)
-/* complete notification statuses */
-#define ABORT_STATUS            0x2
-
-/*
- * REPLY_SCAN_CMD = 0x80 (response)
- */
-struct iwl3945_scanreq_notification {
-       __le32 status;          /* 1: okay, 2: cannot fulfill request */
-} __attribute__ ((packed));
-
-/*
- * SCAN_START_NOTIFICATION = 0x82 (notification only, not a command)
- */
-struct iwl3945_scanstart_notification {
-       __le32 tsf_low;
-       __le32 tsf_high;
-       __le32 beacon_timer;
-       u8 channel;
-       u8 band;
-       u8 reserved[2];
-       __le32 status;
-} __attribute__ ((packed));
-
-#define  SCAN_OWNER_STATUS 0x1;
-#define  MEASURE_OWNER_STATUS 0x2;
-
-#define NUMBER_OF_STATISTICS 1 /* first __le32 is good CRC */
-/*
- * SCAN_RESULTS_NOTIFICATION = 0x83 (notification only, not a command)
- */
-struct iwl3945_scanresults_notification {
-       u8 channel;
-       u8 band;
-       u8 reserved[2];
-       __le32 tsf_low;
-       __le32 tsf_high;
-       __le32 statistics[NUMBER_OF_STATISTICS];
-} __attribute__ ((packed));
-
-/*
- * SCAN_COMPLETE_NOTIFICATION = 0x84 (notification only, not a command)
- */
-struct iwl3945_scancomplete_notification {
-       u8 scanned_channels;
-       u8 status;
-       u8 reserved;
-       u8 last_channel;
-       __le32 tsf_low;
-       __le32 tsf_high;
-} __attribute__ ((packed));
-
-
-/******************************************************************************
- * (9)
- * IBSS/AP Commands and Notifications:
- *
- *****************************************************************************/
-
-/*
- * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
- */
-struct iwl3945_beacon_notif {
-       struct iwl3945_tx_resp beacon_notify_hdr;
-       __le32 low_tsf;
-       __le32 high_tsf;
-       __le32 ibss_mgr_status;
-} __attribute__ ((packed));
-
-/*
- * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
- */
-struct iwl3945_tx_beacon_cmd {
-       struct iwl3945_tx_cmd tx;
-       __le16 tim_idx;
-       u8 tim_size;
-       u8 reserved1;
-       struct ieee80211_hdr frame[0];  /* beacon frame */
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (10)
- * Statistics Commands and Notifications:
- *
- *****************************************************************************/
-
-#define IWL_TEMP_CONVERT 260
-
-#define SUP_RATE_11A_MAX_NUM_CHANNELS  8
-#define SUP_RATE_11B_MAX_NUM_CHANNELS  4
-#define SUP_RATE_11G_MAX_NUM_CHANNELS  12
-
-/* Used for passing to driver number of successes and failures per rate */
-struct rate_histogram {
-       union {
-               __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
-               __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
-               __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
-       } success;
-       union {
-               __le32 a[SUP_RATE_11A_MAX_NUM_CHANNELS];
-               __le32 b[SUP_RATE_11B_MAX_NUM_CHANNELS];
-               __le32 g[SUP_RATE_11G_MAX_NUM_CHANNELS];
-       } failed;
-} __attribute__ ((packed));
-
-/* statistics command response */
-
-struct statistics_rx_phy {
-       __le32 ina_cnt;
-       __le32 fina_cnt;
-       __le32 plcp_err;
-       __le32 crc32_err;
-       __le32 overrun_err;
-       __le32 early_overrun_err;
-       __le32 crc32_good;
-       __le32 false_alarm_cnt;
-       __le32 fina_sync_err_cnt;
-       __le32 sfd_timeout;
-       __le32 fina_timeout;
-       __le32 unresponded_rts;
-       __le32 rxe_frame_limit_overrun;
-       __le32 sent_ack_cnt;
-       __le32 sent_cts_cnt;
-} __attribute__ ((packed));
-
-struct statistics_rx_non_phy {
-       __le32 bogus_cts;       /* CTS received when not expecting CTS */
-       __le32 bogus_ack;       /* ACK received when not expecting ACK */
-       __le32 non_bssid_frames;        /* number of frames with BSSID that
-                                        * doesn't belong to the STA BSSID */
-       __le32 filtered_frames; /* count frames that were dumped in the
-                                * filtering process */
-       __le32 non_channel_beacons;     /* beacons with our bss id but not on
-                                        * our serving channel */
-} __attribute__ ((packed));
-
-struct statistics_rx {
-       struct statistics_rx_phy ofdm;
-       struct statistics_rx_phy cck;
-       struct statistics_rx_non_phy general;
-} __attribute__ ((packed));
-
-struct statistics_tx {
-       __le32 preamble_cnt;
-       __le32 rx_detected_cnt;
-       __le32 bt_prio_defer_cnt;
-       __le32 bt_prio_kill_cnt;
-       __le32 few_bytes_cnt;
-       __le32 cts_timeout;
-       __le32 ack_timeout;
-       __le32 expected_ack_cnt;
-       __le32 actual_ack_cnt;
-} __attribute__ ((packed));
-
-struct statistics_dbg {
-       __le32 burst_check;
-       __le32 burst_count;
-       __le32 reserved[4];
-} __attribute__ ((packed));
-
-struct statistics_div {
-       __le32 tx_on_a;
-       __le32 tx_on_b;
-       __le32 exec_time;
-       __le32 probe_time;
-} __attribute__ ((packed));
-
-struct statistics_general {
-       __le32 temperature;
-       struct statistics_dbg dbg;
-       __le32 sleep_time;
-       __le32 slots_out;
-       __le32 slots_idle;
-       __le32 ttl_timestamp;
-       struct statistics_div div;
-} __attribute__ ((packed));
-
-/*
- * REPLY_STATISTICS_CMD = 0x9c,
- * 3945 and 4965 identical.
- *
- * This command triggers an immediate response containing uCode statistics.
- * The response is in the same format as STATISTICS_NOTIFICATION 0x9d, below.
- *
- * If the CLEAR_STATS configuration flag is set, uCode will clear its
- * internal copy of the statistics (counters) after issuing the response.
- * This flag does not affect STATISTICS_NOTIFICATIONs after beacons (see below).
- *
- * If the DISABLE_NOTIF configuration flag is set, uCode will not issue
- * STATISTICS_NOTIFICATIONs after received beacons (see below).  This flag
- * does not affect the response to the REPLY_STATISTICS_CMD 0x9c itself.
- */
-#define IWL_STATS_CONF_CLEAR_STATS cpu_to_le32(0x1)    /* see above */
-#define IWL_STATS_CONF_DISABLE_NOTIF cpu_to_le32(0x2)/* see above */
-struct iwl3945_statistics_cmd {
-       __le32 configuration_flags;     /* IWL_STATS_CONF_* */
-} __attribute__ ((packed));
-
-/*
- * STATISTICS_NOTIFICATION = 0x9d (notification only, not a command)
- *
- * By default, uCode issues this notification after receiving a beacon
- * while associated.  To disable this behavior, set DISABLE_NOTIF flag in the
- * REPLY_STATISTICS_CMD 0x9c, above.
- *
- * Statistics counters continue to increment beacon after beacon, but are
- * cleared when changing channels or when driver issues REPLY_STATISTICS_CMD
- * 0x9c with CLEAR_STATS bit set (see above).
- *
- * uCode also issues this notification during scans.  uCode clears statistics
- * appropriately so that each notification contains statistics for only the
- * one channel that has just been scanned.
- */
-#define STATISTICS_REPLY_FLG_BAND_24G_MSK         cpu_to_le32(0x2)
-#define STATISTICS_REPLY_FLG_FAT_MODE_MSK         cpu_to_le32(0x8)
-struct iwl3945_notif_statistics {
-       __le32 flag;
-       struct statistics_rx rx;
-       struct statistics_tx tx;
-       struct statistics_general general;
-} __attribute__ ((packed));
-
-
-/*
- * MISSED_BEACONS_NOTIFICATION = 0xa2 (notification only, not a command)
- */
-/* if ucode missed CONSECUTIVE_MISSED_BCONS_TH beacons in a row,
- * then this notification will be sent. */
-#define CONSECUTIVE_MISSED_BCONS_TH 20
-
-struct iwl3945_missed_beacon_notif {
-       __le32 consequtive_missed_beacons;
-       __le32 total_missed_becons;
-       __le32 num_expected_beacons;
-       __le32 num_recvd_beacons;
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (11)
- * Rx Calibration Commands:
- *
- *****************************************************************************/
-
-#define PHY_CALIBRATE_DIFF_GAIN_CMD (7)
-#define HD_TABLE_SIZE  (11)
-
-struct iwl3945_sensitivity_cmd {
-       __le16 control;
-       __le16 table[HD_TABLE_SIZE];
-} __attribute__ ((packed));
-
-struct iwl3945_calibration_cmd {
-       u8 opCode;
-       u8 flags;
-       __le16 reserved;
-       s8 diff_gain_a;
-       s8 diff_gain_b;
-       s8 diff_gain_c;
-       u8 reserved1;
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (12)
- * Miscellaneous Commands:
- *
- *****************************************************************************/
-
-/*
- * LEDs Command & Response
- * REPLY_LEDS_CMD = 0x48 (command, has simple generic response)
- *
- * For each of 3 possible LEDs (Activity/Link/Tech, selected by "id" field),
- * this command turns it on or off, or sets up a periodic blinking cycle.
- */
-struct iwl3945_led_cmd {
-       __le32 interval;        /* "interval" in uSec */
-       u8 id;                  /* 1: Activity, 2: Link, 3: Tech */
-       u8 off;                 /* # intervals off while blinking;
-                                * "0", with >0 "on" value, turns LED on */
-       u8 on;                  /* # intervals on while blinking;
-                                * "0", regardless of "off", turns LED off */
-       u8 reserved;
-} __attribute__ ((packed));
-
-/******************************************************************************
- * (13)
- * Union of all expected notifications/responses:
- *
- *****************************************************************************/
-
-struct iwl3945_rx_packet {
-       __le32 len;
-       struct iwl3945_cmd_header hdr;
-       union {
-               struct iwl3945_alive_resp alive_frame;
-               struct iwl3945_rx_frame rx_frame;
-               struct iwl3945_tx_resp tx_resp;
-               struct iwl3945_spectrum_notification spectrum_notif;
-               struct iwl3945_csa_notification csa_notif;
-               struct iwl3945_error_resp err_resp;
-               struct iwl3945_card_state_notif card_state_notif;
-               struct iwl3945_beacon_notif beacon_status;
-               struct iwl3945_add_sta_resp add_sta;
-               struct iwl3945_sleep_notification sleep_notif;
-               struct iwl3945_spectrum_resp spectrum;
-               struct iwl3945_notif_statistics stats;
-               __le32 status;
-               u8 raw[0];
-       } u;
-} __attribute__ ((packed));
-
-#define IWL_RX_FRAME_SIZE        (4 + sizeof(struct iwl3945_rx_frame))
-
-#endif                         /* __iwl3945_3945_commands_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-debug.h b/drivers/net/wireless/iwlwifi/iwl-3945-debug.h
deleted file mode 100644 (file)
index 85eb778..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
- *
- * Portions of this file are derived from the ipw3945 project.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
- * Contact Information:
- *  Intel Linux Wireless <ilw@linux.intel.com>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- *****************************************************************************/
-
-#ifndef __iwl3945_debug_h__
-#define __iwl3945_debug_h__
-
-#ifdef CONFIG_IWL3945_DEBUG
-extern u32 iwl3945_debug_level;
-#define IWL_DEBUG(level, fmt, args...) \
-do { if (iwl3945_debug_level & (level)) \
-  printk(KERN_ERR DRV_NAME": %c %s " fmt, \
-        in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
-
-#define IWL_DEBUG_LIMIT(level, fmt, args...) \
-do { if ((iwl3945_debug_level & (level)) && net_ratelimit()) \
-  printk(KERN_ERR DRV_NAME": %c %s " fmt, \
-        in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
-
-static inline void iwl3945_print_hex_dump(int level, void *p, u32 len)
-{
-       if (!(iwl3945_debug_level & level))
-               return;
-
-       print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
-                       p, len, 1);
-}
-#else
-static inline void IWL_DEBUG(int level, const char *fmt, ...)
-{
-}
-static inline void IWL_DEBUG_LIMIT(int level, const char *fmt, ...)
-{
-}
-static inline void iwl3945_print_hex_dump(int level, void *p, u32 len)
-{
-}
-#endif /* CONFIG_IWL3945_DEBUG */
-
-
-
-/*
- * To use the debug system;
- *
- * If you are defining a new debug classification, simply add it to the #define
- * list here in the form of:
- *
- * #define IWL_DL_xxxx VALUE
- *
- * shifting value to the left one bit from the previous entry.  xxxx should be
- * the name of the classification (for example, WEP)
- *
- * You then need to either add a IWL_xxxx_DEBUG() macro definition for your
- * classification, or use IWL_DEBUG(IWL_DL_xxxx, ...) whenever you want
- * to send output to that classification.
- *
- * To add your debug level to the list of levels seen when you perform
- *
- * % cat /proc/net/iwl/debug_level
- *
- * you simply need to add your entry to the iwl3945_debug_levels array.
- *
- * If you do not see debug_level in /proc/net/iwl then you do not have
- * CONFIG_IWL3945_DEBUG defined in your kernel configuration
- *
- */
-
-#define IWL_DL_INFO          (1 << 0)
-#define IWL_DL_MAC80211      (1 << 1)
-#define IWL_DL_HOST_COMMAND  (1 << 2)
-#define IWL_DL_STATE         (1 << 3)
-
-#define IWL_DL_RADIO         (1 << 7)
-#define IWL_DL_POWER         (1 << 8)
-#define IWL_DL_TEMP          (1 << 9)
-
-#define IWL_DL_NOTIF         (1 << 10)
-#define IWL_DL_SCAN          (1 << 11)
-#define IWL_DL_ASSOC         (1 << 12)
-#define IWL_DL_DROP          (1 << 13)
-
-#define IWL_DL_TXPOWER       (1 << 14)
-
-#define IWL_DL_AP            (1 << 15)
-
-#define IWL_DL_FW            (1 << 16)
-#define IWL_DL_RF_KILL       (1 << 17)
-#define IWL_DL_FW_ERRORS     (1 << 18)
-
-#define IWL_DL_LED           (1 << 19)
-
-#define IWL_DL_RATE          (1 << 20)
-
-#define IWL_DL_CALIB         (1 << 21)
-#define IWL_DL_WEP           (1 << 22)
-#define IWL_DL_TX            (1 << 23)
-#define IWL_DL_RX            (1 << 24)
-#define IWL_DL_ISR           (1 << 25)
-#define IWL_DL_HT            (1 << 26)
-#define IWL_DL_IO            (1 << 27)
-#define IWL_DL_11H           (1 << 28)
-
-#define IWL_DL_STATS         (1 << 29)
-#define IWL_DL_TX_REPLY      (1 << 30)
-#define IWL_DL_QOS           (1 << 31)
-
-#define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
-#define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
-#define IWL_DEBUG_INFO(f, a...)    IWL_DEBUG(IWL_DL_INFO, f, ## a)
-
-#define IWL_DEBUG_MAC80211(f, a...)     IWL_DEBUG(IWL_DL_MAC80211, f, ## a)
-#define IWL_DEBUG_TEMP(f, a...)   IWL_DEBUG(IWL_DL_TEMP, f, ## a)
-#define IWL_DEBUG_SCAN(f, a...)   IWL_DEBUG(IWL_DL_SCAN, f, ## a)
-#define IWL_DEBUG_RX(f, a...)     IWL_DEBUG(IWL_DL_RX, f, ## a)
-#define IWL_DEBUG_TX(f, a...)     IWL_DEBUG(IWL_DL_TX, f, ## a)
-#define IWL_DEBUG_ISR(f, a...)    IWL_DEBUG(IWL_DL_ISR, f, ## a)
-#define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a)
-#define IWL_DEBUG_WEP(f, a...)    IWL_DEBUG(IWL_DL_WEP, f, ## a)
-#define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HOST_COMMAND, f, ## a)
-#define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a)
-#define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a)
-#define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a)
-#define IWL_DEBUG_DROP(f, a...) IWL_DEBUG(IWL_DL_DROP, f, ## a)
-#define IWL_DEBUG_DROP_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_DROP, f, ## a)
-#define IWL_DEBUG_AP(f, a...) IWL_DEBUG(IWL_DL_AP, f, ## a)
-#define IWL_DEBUG_TXPOWER(f, a...) IWL_DEBUG(IWL_DL_TXPOWER, f, ## a)
-#define IWL_DEBUG_IO(f, a...) IWL_DEBUG(IWL_DL_IO, f, ## a)
-#define IWL_DEBUG_RATE(f, a...) IWL_DEBUG(IWL_DL_RATE, f, ## a)
-#define IWL_DEBUG_RATE_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_RATE, f, ## a)
-#define IWL_DEBUG_NOTIF(f, a...) IWL_DEBUG(IWL_DL_NOTIF, f, ## a)
-#define IWL_DEBUG_ASSOC(f, a...) IWL_DEBUG(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
-#define IWL_DEBUG_ASSOC_LIMIT(f, a...) \
-       IWL_DEBUG_LIMIT(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
-#define IWL_DEBUG_HT(f, a...) IWL_DEBUG(IWL_DL_HT, f, ## a)
-#define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a)
-#define IWL_DEBUG_STATS_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_STATS, f, ## a)
-#define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a)
-#define IWL_DEBUG_QOS(f, a...)   IWL_DEBUG(IWL_DL_QOS, f, ## a)
-#define IWL_DEBUG_RADIO(f, a...)  IWL_DEBUG(IWL_DL_RADIO, f, ## a)
-#define IWL_DEBUG_POWER(f, a...)  IWL_DEBUG(IWL_DL_POWER, f, ## a)
-#define IWL_DEBUG_11H(f, a...)  IWL_DEBUG(IWL_DL_11H, f, ## a)
-
-#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-fh.h b/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
new file mode 100644 (file)
index 0000000..08ce259
--- /dev/null
@@ -0,0 +1,188 @@
+/******************************************************************************
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
+ * USA
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless <ilw@linux.intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name Intel Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+#ifndef __iwl_3945_fh_h__
+#define __iwl_3945_fh_h__
+
+/************************************/
+/* iwl3945 Flow Handler Definitions */
+/************************************/
+
+/**
+ * This I/O area is directly read/writable by driver (e.g. Linux uses writel())
+ * Addresses are offsets from device's PCI hardware base address.
+ */
+#define FH39_MEM_LOWER_BOUND                   (0x0800)
+#define FH39_MEM_UPPER_BOUND                   (0x1000)
+
+#define FH39_CBCC_TABLE                (FH39_MEM_LOWER_BOUND + 0x140)
+#define FH39_TFDB_TABLE                (FH39_MEM_LOWER_BOUND + 0x180)
+#define FH39_RCSR_TABLE                (FH39_MEM_LOWER_BOUND + 0x400)
+#define FH39_RSSR_TABLE                (FH39_MEM_LOWER_BOUND + 0x4c0)
+#define FH39_TCSR_TABLE                (FH39_MEM_LOWER_BOUND + 0x500)
+#define FH39_TSSR_TABLE                (FH39_MEM_LOWER_BOUND + 0x680)
+
+/* TFDB (Transmit Frame Buffer Descriptor) */
+#define FH39_TFDB(_ch, buf)                    (FH39_TFDB_TABLE + \
+                                                ((_ch) * 2 + (buf)) * 0x28)
+#define FH39_TFDB_CHNL_BUF_CTRL_REG(_ch)       (FH39_TFDB_TABLE + 0x50 * (_ch))
+
+/* CBCC channel is [0,2] */
+#define FH39_CBCC(_ch)         (FH39_CBCC_TABLE + (_ch) * 0x8)
+#define FH39_CBCC_CTRL(_ch)    (FH39_CBCC(_ch) + 0x00)
+#define FH39_CBCC_BASE(_ch)    (FH39_CBCC(_ch) + 0x04)
+
+/* RCSR channel is [0,2] */
+#define FH39_RCSR(_ch)                 (FH39_RCSR_TABLE + (_ch) * 0x40)
+#define FH39_RCSR_CONFIG(_ch)          (FH39_RCSR(_ch) + 0x00)
+#define FH39_RCSR_RBD_BASE(_ch)                (FH39_RCSR(_ch) + 0x04)
+#define FH39_RCSR_WPTR(_ch)            (FH39_RCSR(_ch) + 0x20)
+#define FH39_RCSR_RPTR_ADDR(_ch)       (FH39_RCSR(_ch) + 0x24)
+
+#define FH39_RSCSR_CHNL0_WPTR          (FH39_RCSR_WPTR(0))
+
+/* RSSR */
+#define FH39_RSSR_CTRL                 (FH39_RSSR_TABLE + 0x000)
+#define FH39_RSSR_STATUS               (FH39_RSSR_TABLE + 0x004)
+
+/* TCSR */
+#define FH39_TCSR(_ch)                 (FH39_TCSR_TABLE + (_ch) * 0x20)
+#define FH39_TCSR_CONFIG(_ch)          (FH39_TCSR(_ch) + 0x00)
+#define FH39_TCSR_CREDIT(_ch)          (FH39_TCSR(_ch) + 0x04)
+#define FH39_TCSR_BUFF_STTS(_ch)       (FH39_TCSR(_ch) + 0x08)
+
+/* TSSR */
+#define FH39_TSSR_CBB_BASE        (FH39_TSSR_TABLE + 0x000)
+#define FH39_TSSR_MSG_CONFIG      (FH39_TSSR_TABLE + 0x008)
+#define FH39_TSSR_TX_STATUS       (FH39_TSSR_TABLE + 0x010)
+
+
+/* DBM */
+
+#define FH39_SRVC_CHNL                            (6)
+
+#define FH39_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE     (20)
+#define FH39_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH      (4)
+
+#define FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN    (0x08000000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE        (0x80000000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE           (0x20000000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128          (0x01000000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST          (0x00001000)
+
+#define FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH                        (0x00000000)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF               (0x00000000)
+#define FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER            (0x00000001)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL     (0x00000000)
+#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL      (0x00000008)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD            (0x00200000)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT             (0x00000000)
+
+#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE             (0x00000000)
+#define FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE            (0x80000000)
+
+#define FH39_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID           (0x00004000)
+
+#define FH39_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR            (0x00000001)
+
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON       (0xFF000000)
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON       (0x00FF0000)
+
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B     (0x00000400)
+
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON                (0x00000100)
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON                (0x00000080)
+
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH      (0x00000020)
+#define FH39_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH            (0x00000005)
+
+#define FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch)    (BIT(_ch) << 24)
+#define FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch)   (BIT(_ch) << 16)
+
+#define FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_ch) \
+       (FH39_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_ch) | \
+        FH39_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_ch))
+
+#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE                    (0x01000000)
+
+struct iwl3945_tfd_tb {
+       __le32 addr;
+       __le32 len;
+} __attribute__ ((packed));
+
+struct iwl3945_tfd {
+       __le32 control_flags;
+       struct iwl3945_tfd_tb tbs[4];
+       u8 __pad[28];
+} __attribute__ ((packed));
+
+
+#endif /* __iwl_3945_fh_h__ */
+
index 94ea0e60c41076d9d5fa6a656595bc4bbda57cf8..205603d082aa2bf75598249f0d1f3df3a7b4d94c 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #ifndef __iwl_3945_hw__
 #define __iwl_3945_hw__
 
+#include "iwl-eeprom.h"
+
 /*
  * uCode queue management definitions ...
  * Queue #4 is the command queue for 3945 and 4965.
  */
-#define IWL_CMD_QUEUE_NUM       4
-
-/* Tx rates */
-#define IWL_CCK_RATES 4
-#define IWL_OFDM_RATES 8
-#define IWL_HT_RATES 0
-#define IWL_MAX_RATES  (IWL_CCK_RATES+IWL_OFDM_RATES+IWL_HT_RATES)
+#define IWL_CMD_QUEUE_NUM      4
 
 /* Time constants */
 #define SHORT_SLOT_TIME 9
 #define LONG_SLOT_TIME 20
 
 /* RSSI to dBm */
-#define IWL_RSSI_OFFSET        95
+#define IWL39_RSSI_OFFSET      95
 
 /*
  * EEPROM related constants, enums, and structures.
  */
-
-/*
- * EEPROM access time values:
- *
- * Driver initiates EEPROM read by writing byte address << 1 to CSR_EEPROM_REG,
- *   then clearing (with subsequent read/modify/write) CSR_EEPROM_REG bit
- *   CSR_EEPROM_REG_BIT_CMD (0x2).
- * Driver then polls CSR_EEPROM_REG for CSR_EEPROM_REG_READ_VALID_MSK (0x1).
- * When polling, wait 10 uSec between polling loops, up to a maximum 5000 uSec.
- * Driver reads 16-bit value from bits 31-16 of CSR_EEPROM_REG.
- */
-#define IWL_EEPROM_ACCESS_TIMEOUT      5000 /* uSec */
-
-/*
- * Regulatory channel usage flags in EEPROM struct iwl_eeprom_channel.flags.
- *
- * IBSS and/or AP operation is allowed *only* on those channels with
- * (VALID && IBSS && ACTIVE && !RADAR).  This restriction is in place because
- * RADAR detection is not supported by the 3945 driver, but is a
- * requirement for establishing a new network for legal operation on channels
- * requiring RADAR detection or restricting ACTIVE scanning.
- *
- * NOTE:  "WIDE" flag indicates that 20 MHz channel is supported;
- *        3945 does not support FAT 40 MHz-wide channels.
- *
- * NOTE:  Using a channel inappropriately will result in a uCode error!
- */
-enum {
-       EEPROM_CHANNEL_VALID = (1 << 0),        /* usable for this SKU/geo */
-       EEPROM_CHANNEL_IBSS = (1 << 1),         /* usable as an IBSS channel */
-       /* Bit 2 Reserved */
-       EEPROM_CHANNEL_ACTIVE = (1 << 3),       /* active scanning allowed */
-       EEPROM_CHANNEL_RADAR = (1 << 4),        /* radar detection required */
-       EEPROM_CHANNEL_WIDE = (1 << 5),         /* 20 MHz channel okay */
-       /* Bit 6 Reserved (was Narrow Channel) */
-       EEPROM_CHANNEL_DFS = (1 << 7),  /* dynamic freq selection candidate */
-};
-
-/* SKU Capabilities */
-#define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE                (1 << 0)
-#define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE                (1 << 1)
 #define EEPROM_SKU_CAP_OP_MODE_MRC                      (1 << 7)
 
-/* *regulatory* channel data from eeprom, one for each channel */
-struct iwl3945_eeprom_channel {
-       u8 flags;               /* flags copied from EEPROM */
-       s8 max_power_avg;       /* max power (dBm) on this chnl, limit 31 */
-} __attribute__ ((packed));
-
 /*
  * Mapping of a Tx power level, at factory calibration temperature,
  *   to a radio/DSP gain table index.
@@ -233,7 +182,7 @@ struct iwl3945_eeprom {
  * 2.4 GHz channels 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
  */
        u16 band_1_count;       /* abs.ofs: 196 */
-       struct iwl3945_eeprom_channel band_1_channels[14];  /* abs.ofs: 196 */
+       struct iwl_eeprom_channel band_1_channels[14];  /* abs.ofs: 198 */
 
 /*
  * 4.9 GHz channels 183, 184, 185, 187, 188, 189, 192, 196,
@@ -241,28 +190,28 @@ struct iwl3945_eeprom {
  * (4915-5080MHz) (none of these is ever supported)
  */
        u16 band_2_count;       /* abs.ofs: 226 */
-       struct iwl3945_eeprom_channel band_2_channels[13];  /* abs.ofs: 228 */
+       struct iwl_eeprom_channel band_2_channels[13];  /* abs.ofs: 228 */
 
 /*
  * 5.2 GHz channels 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
  * (5170-5320MHz)
  */
        u16 band_3_count;       /* abs.ofs: 254 */
-       struct iwl3945_eeprom_channel band_3_channels[12];  /* abs.ofs: 256 */
+       struct iwl_eeprom_channel band_3_channels[12];  /* abs.ofs: 256 */
 
 /*
  * 5.5 GHz channels 100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
  * (5500-5700MHz)
  */
        u16 band_4_count;       /* abs.ofs: 280 */
-       struct iwl3945_eeprom_channel band_4_channels[11];  /* abs.ofs: 282 */
+       struct iwl_eeprom_channel band_4_channels[11];  /* abs.ofs: 282 */
 
 /*
  * 5.7 GHz channels 145, 149, 153, 157, 161, 165
  * (5725-5825MHz)
  */
        u16 band_5_count;       /* abs.ofs: 304 */
-       struct iwl3945_eeprom_channel band_5_channels[6];  /* abs.ofs: 306 */
+       struct iwl_eeprom_channel band_5_channels[6];  /* abs.ofs: 306 */
 
        u8 reserved9[194];
 
@@ -276,125 +225,15 @@ struct iwl3945_eeprom {
        u8 reserved16[172];     /* fill out to full 1024 byte block */
 } __attribute__ ((packed));
 
-#define IWL_EEPROM_IMAGE_SIZE 1024
+#define IWL3945_EEPROM_IMG_SIZE 1024
 
 /* End of EEPROM */
 
-
-#include "iwl-3945-commands.h"
-
-#define PCI_LINK_CTRL      0x0F0
-#define PCI_POWER_SOURCE   0x0C8
-#define PCI_REG_WUM8       0x0E8
-#define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT         (0x80000000)
-
-/*=== FH (data Flow Handler) ===*/
-#define FH_BASE     (0x800)
-
-#define FH_CBCC_TABLE           (FH_BASE+0x140)
-#define FH_TFDB_TABLE           (FH_BASE+0x180)
-#define FH_RCSR_TABLE           (FH_BASE+0x400)
-#define FH_RSSR_TABLE           (FH_BASE+0x4c0)
-#define FH_TCSR_TABLE           (FH_BASE+0x500)
-#define FH_TSSR_TABLE           (FH_BASE+0x680)
-
-/* TFDB (Transmit Frame Buffer Descriptor) */
-#define FH_TFDB(_channel, buf) \
-       (FH_TFDB_TABLE+((_channel)*2+(buf))*0x28)
-#define ALM_FH_TFDB_CHNL_BUF_CTRL_REG(_channel) \
-       (FH_TFDB_TABLE + 0x50 * _channel)
-/* CBCC _channel is [0,2] */
-#define FH_CBCC(_channel)           (FH_CBCC_TABLE+(_channel)*0x8)
-#define FH_CBCC_CTRL(_channel)      (FH_CBCC(_channel)+0x00)
-#define FH_CBCC_BASE(_channel)      (FH_CBCC(_channel)+0x04)
-
-/* RCSR _channel is [0,2] */
-#define FH_RCSR(_channel)           (FH_RCSR_TABLE+(_channel)*0x40)
-#define FH_RCSR_CONFIG(_channel)    (FH_RCSR(_channel)+0x00)
-#define FH_RCSR_RBD_BASE(_channel)  (FH_RCSR(_channel)+0x04)
-#define FH_RCSR_WPTR(_channel)      (FH_RCSR(_channel)+0x20)
-#define FH_RCSR_RPTR_ADDR(_channel) (FH_RCSR(_channel)+0x24)
-
-#define FH_RSCSR_CHNL0_WPTR        (FH_RCSR_WPTR(0))
-
-/* RSSR */
-#define FH_RSSR_CTRL            (FH_RSSR_TABLE+0x000)
-#define FH_RSSR_STATUS          (FH_RSSR_TABLE+0x004)
-#define FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE      (0x01000000)
-/* TCSR */
-#define FH_TCSR(_channel)           (FH_TCSR_TABLE+(_channel)*0x20)
-#define FH_TCSR_CONFIG(_channel)    (FH_TCSR(_channel)+0x00)
-#define FH_TCSR_CREDIT(_channel)    (FH_TCSR(_channel)+0x04)
-#define FH_TCSR_BUFF_STTS(_channel) (FH_TCSR(_channel)+0x08)
-/* TSSR */
-#define FH_TSSR_CBB_BASE        (FH_TSSR_TABLE+0x000)
-#define FH_TSSR_MSG_CONFIG      (FH_TSSR_TABLE+0x008)
-#define FH_TSSR_TX_STATUS       (FH_TSSR_TABLE+0x010)
-
-
-/* DBM */
-
-#define ALM_FH_SRVC_CHNL                            (6)
-
-#define ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE     (20)
-#define ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH      (4)
-
-#define ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN    (0x08000000)
-
-#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE        (0x80000000)
-
-#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE           (0x20000000)
-
-#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128         (0x01000000)
-
-#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST         (0x00001000)
-
-#define ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH               (0x00000000)
-
-#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF              (0x00000000)
-#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_DRIVER           (0x00000001)
-
-#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_DISABLE_VAL    (0x00000000)
-#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL     (0x00000008)
-
-#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD           (0x00200000)
-
-#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT            (0x00000000)
-
-#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_PAUSE            (0x00000000)
-#define ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE           (0x80000000)
-
-#define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_VAL_TFDB_VALID          (0x00004000)
-
-#define ALM_FH_TCSR_CHNL_TX_BUF_STS_REG_BIT_TFDB_WPTR           (0x00000001)
-
-#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON      (0xFF000000)
-#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON      (0x00FF0000)
-
-#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B    (0x00000400)
-
-#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON       (0x00000100)
-#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON       (0x00000080)
-
-#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH     (0x00000020)
-#define ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH           (0x00000005)
-
-#define ALM_TB_MAX_BYTES_COUNT      (0xFFF0)
-
-#define ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) \
-       ((1LU << _channel) << 24)
-#define ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel) \
-       ((1LU << _channel) << 16)
-
-#define ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(_channel) \
-       (ALM_FH_TSSR_TX_STATUS_REG_BIT_BUFS_EMPTY(_channel) | \
-        ALM_FH_TSSR_TX_STATUS_REG_BIT_NO_PEND_REQ(_channel))
 #define PCI_CFG_REV_ID_BIT_BASIC_SKU                (0x40)     /* bit 6    */
 #define PCI_CFG_REV_ID_BIT_RTP                      (0x80)     /* bit 7    */
 
 #define TFD_QUEUE_MIN           0
 #define TFD_QUEUE_MAX           6
-#define TFD_QUEUE_SIZE_MAX      (256)
 
 #define IWL_NUM_SCAN_RATES         (2)
 
@@ -416,12 +255,6 @@ struct iwl3945_eeprom {
 #define TFD_CTL_PAD_SET(n)         (n << 28)
 #define TFD_CTL_PAD_GET(ctl)       (ctl >> 28)
 
-#define TFD_TX_CMD_SLOTS 256
-#define TFD_CMD_SLOTS 32
-
-#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
-                             sizeof(struct iwl3945_cmd_meta))
-
 /*
  * RX related structures and functions
  */
@@ -430,45 +263,35 @@ struct iwl3945_eeprom {
 
 /* Sizes and addresses for instruction and data memory (SRAM) in
  * 3945's embedded processor.  Driver access is via HBUS_TARG_MEM_* regs. */
-#define RTC_INST_LOWER_BOUND                   (0x000000)
-#define ALM_RTC_INST_UPPER_BOUND               (0x014000)
+#define IWL39_RTC_INST_LOWER_BOUND             (0x000000)
+#define IWL39_RTC_INST_UPPER_BOUND             (0x014000)
 
-#define RTC_DATA_LOWER_BOUND                   (0x800000)
-#define ALM_RTC_DATA_UPPER_BOUND               (0x808000)
+#define IWL39_RTC_DATA_LOWER_BOUND             (0x800000)
+#define IWL39_RTC_DATA_UPPER_BOUND             (0x808000)
 
-#define ALM_RTC_INST_SIZE (ALM_RTC_INST_UPPER_BOUND - RTC_INST_LOWER_BOUND)
-#define ALM_RTC_DATA_SIZE (ALM_RTC_DATA_UPPER_BOUND - RTC_DATA_LOWER_BOUND)
+#define IWL39_RTC_INST_SIZE (IWL39_RTC_INST_UPPER_BOUND - \
+                               IWL39_RTC_INST_LOWER_BOUND)
+#define IWL39_RTC_DATA_SIZE (IWL39_RTC_DATA_UPPER_BOUND - \
+                               IWL39_RTC_DATA_LOWER_BOUND)
 
-#define IWL_MAX_INST_SIZE ALM_RTC_INST_SIZE
-#define IWL_MAX_DATA_SIZE ALM_RTC_DATA_SIZE
+#define IWL39_MAX_INST_SIZE IWL39_RTC_INST_SIZE
+#define IWL39_MAX_DATA_SIZE IWL39_RTC_DATA_SIZE
 
 /* Size of uCode instruction memory in bootstrap state machine */
-#define IWL_MAX_BSM_SIZE ALM_RTC_INST_SIZE
+#define IWL39_MAX_BSM_SIZE IWL39_RTC_INST_SIZE
 
 #define IWL39_MAX_NUM_QUEUES   8
 
 static inline int iwl3945_hw_valid_rtc_data_addr(u32 addr)
 {
-       return (addr >= RTC_DATA_LOWER_BOUND) &&
-              (addr < ALM_RTC_DATA_UPPER_BOUND);
+       return (addr >= IWL39_RTC_DATA_LOWER_BOUND) &&
+              (addr < IWL39_RTC_DATA_UPPER_BOUND);
 }
 
 /* Base physical address of iwl3945_shared is provided to FH_TSSR_CBB_BASE
  * and &iwl3945_shared.rx_read_ptr[0] is provided to FH_RCSR_RPTR_ADDR(0) */
 struct iwl3945_shared {
        __le32 tx_base_ptr[8];
-       __le32 rx_read_ptr[3];
-} __attribute__ ((packed));
-
-struct iwl3945_tfd_frame_data {
-       __le32 addr;
-       __le32 len;
-} __attribute__ ((packed));
-
-struct iwl3945_tfd_frame {
-       __le32 control_flags;
-       struct iwl3945_tfd_frame_data pa[4];
-       u8 reserved[28];
 } __attribute__ ((packed));
 
 static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-io.h b/drivers/net/wireless/iwlwifi/iwl-3945-io.h
deleted file mode 100644 (file)
index 2440fd6..0000000
+++ /dev/null
@@ -1,404 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
- *
- * Portions of this file are derived from the ipw3945 project.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
- * Contact Information:
- *  Intel Linux Wireless <ilw@linux.intel.com>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- *****************************************************************************/
-
-#ifndef __iwl3945_io_h__
-#define __iwl3945_io_h__
-
-#include <linux/io.h>
-
-#include "iwl-3945-debug.h"
-
-/*
- * IO, register, and NIC memory access functions
- *
- * NOTE on naming convention and macro usage for these
- *
- * A single _ prefix before a an access function means that no state
- * check or debug information is printed when that function is called.
- *
- * A double __ prefix before an access function means that state is checked
- * and the current line number is printed in addition to any other debug output.
- *
- * The non-prefixed name is the #define that maps the caller into a
- * #define that provides the caller's __LINE__ to the double prefix version.
- *
- * If you wish to call the function without any debug or state checking,
- * you should use the single _ prefix version (as is used by dependent IO
- * routines, for example _iwl3945_read_direct32 calls the non-check version of
- * _iwl3945_read32.)
- *
- * These declarations are *extremely* useful in quickly isolating code deltas
- * which result in misconfiguration of the hardware I/O.  In combination with
- * git-bisect and the IO debug level you can quickly determine the specific
- * commit which breaks the IO sequence to the hardware.
- *
- */
-
-#define _iwl3945_write32(priv, ofs, val) iowrite32((val), (priv)->hw_base + (ofs))
-#ifdef CONFIG_IWL3945_DEBUG
-static inline void __iwl3945_write32(const char *f, u32 l, struct iwl3945_priv *priv,
-                                u32 ofs, u32 val)
-{
-       IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
-       _iwl3945_write32(priv, ofs, val);
-}
-#define iwl3945_write32(priv, ofs, val) \
-       __iwl3945_write32(__FILE__, __LINE__, priv, ofs, val)
-#else
-#define iwl3945_write32(priv, ofs, val) _iwl3945_write32(priv, ofs, val)
-#endif
-
-#define _iwl3945_read32(priv, ofs) ioread32((priv)->hw_base + (ofs))
-#ifdef CONFIG_IWL3945_DEBUG
-static inline u32 __iwl3945_read32(char *f, u32 l, struct iwl3945_priv *priv, u32 ofs)
-{
-       IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l);
-       return _iwl3945_read32(priv, ofs);
-}
-#define iwl3945_read32(priv, ofs)__iwl3945_read32(__FILE__, __LINE__, priv, ofs)
-#else
-#define iwl3945_read32(p, o) _iwl3945_read32(p, o)
-#endif
-
-static inline int _iwl3945_poll_bit(struct iwl3945_priv *priv, u32 addr,
-                               u32 bits, u32 mask, int timeout)
-{
-       int i = 0;
-
-       do {
-               if ((_iwl3945_read32(priv, addr) & mask) == (bits & mask))
-                       return i;
-               udelay(10);
-               i += 10;
-       } while (i < timeout);
-
-       return -ETIMEDOUT;
-}
-#ifdef CONFIG_IWL3945_DEBUG
-static inline int __iwl3945_poll_bit(const char *f, u32 l,
-                                struct iwl3945_priv *priv, u32 addr,
-                                u32 bits, u32 mask, int timeout)
-{
-       int ret = _iwl3945_poll_bit(priv, addr, bits, mask, timeout);
-       IWL_DEBUG_IO("poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n",
-                     addr, bits, mask,
-                     unlikely(ret  == -ETIMEDOUT) ? "timeout" : "", f, l);
-       return ret;
-}
-#define iwl3945_poll_bit(priv, addr, bits, mask, timeout) \
-       __iwl3945_poll_bit(__FILE__, __LINE__, priv, addr, bits, mask, timeout)
-#else
-#define iwl3945_poll_bit(p, a, b, m, t) _iwl3945_poll_bit(p, a, b, m, t)
-#endif
-
-static inline void _iwl3945_set_bit(struct iwl3945_priv *priv, u32 reg, u32 mask)
-{
-       _iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) | mask);
-}
-#ifdef CONFIG_IWL3945_DEBUG
-static inline void __iwl3945_set_bit(const char *f, u32 l,
-                                struct iwl3945_priv *priv, u32 reg, u32 mask)
-{
-       u32 val = _iwl3945_read32(priv, reg) | mask;
-       IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
-       _iwl3945_write32(priv, reg, val);
-}
-#define iwl3945_set_bit(p, r, m) __iwl3945_set_bit(__FILE__, __LINE__, p, r, m)
-#else
-#define iwl3945_set_bit(p, r, m) _iwl3945_set_bit(p, r, m)
-#endif
-
-static inline void _iwl3945_clear_bit(struct iwl3945_priv *priv, u32 reg, u32 mask)
-{
-       _iwl3945_write32(priv, reg, _iwl3945_read32(priv, reg) & ~mask);
-}
-#ifdef CONFIG_IWL3945_DEBUG
-static inline void __iwl3945_clear_bit(const char *f, u32 l,
-                                  struct iwl3945_priv *priv, u32 reg, u32 mask)
-{
-       u32 val = _iwl3945_read32(priv, reg) & ~mask;
-       IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
-       _iwl3945_write32(priv, reg, val);
-}
-#define iwl3945_clear_bit(p, r, m) __iwl3945_clear_bit(__FILE__, __LINE__, p, r, m)
-#else
-#define iwl3945_clear_bit(p, r, m) _iwl3945_clear_bit(p, r, m)
-#endif
-
-static inline int _iwl3945_grab_nic_access(struct iwl3945_priv *priv)
-{
-       int ret;
-#ifdef CONFIG_IWL3945_DEBUG
-       if (atomic_read(&priv->restrict_refcnt))
-               return 0;
-#endif
-       /* this bit wakes up the NIC */
-       _iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-       ret = _iwl3945_poll_bit(priv, CSR_GP_CNTRL,
-                          CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN,
-                          (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
-                           CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50);
-       if (ret < 0) {
-               IWL_ERROR("MAC is in deep sleep!\n");
-               return -EIO;
-       }
-
-#ifdef CONFIG_IWL3945_DEBUG
-       atomic_inc(&priv->restrict_refcnt);
-#endif
-       return 0;
-}
-
-#ifdef CONFIG_IWL3945_DEBUG
-static inline int __iwl3945_grab_nic_access(const char *f, u32 l,
-                                              struct iwl3945_priv *priv)
-{
-       if (atomic_read(&priv->restrict_refcnt))
-               IWL_DEBUG_INFO("Grabbing access while already held at "
-                              "line %d.\n", l);
-
-       IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l);
-       return _iwl3945_grab_nic_access(priv);
-}
-#define iwl3945_grab_nic_access(priv) \
-       __iwl3945_grab_nic_access(__FILE__, __LINE__, priv)
-#else
-#define iwl3945_grab_nic_access(priv) \
-       _iwl3945_grab_nic_access(priv)
-#endif
-
-static inline void _iwl3945_release_nic_access(struct iwl3945_priv *priv)
-{
-#ifdef CONFIG_IWL3945_DEBUG
-       if (atomic_dec_and_test(&priv->restrict_refcnt))
-#endif
-               _iwl3945_clear_bit(priv, CSR_GP_CNTRL,
-                              CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-}
-#ifdef CONFIG_IWL3945_DEBUG
-static inline void __iwl3945_release_nic_access(const char *f, u32 l,
-                                           struct iwl3945_priv *priv)
-{
-       if (atomic_read(&priv->restrict_refcnt) <= 0)
-               IWL_ERROR("Release unheld nic access at line %d.\n", l);
-
-       IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l);
-       _iwl3945_release_nic_access(priv);
-}
-#define iwl3945_release_nic_access(priv) \
-       __iwl3945_release_nic_access(__FILE__, __LINE__, priv)
-#else
-#define iwl3945_release_nic_access(priv) \
-       _iwl3945_release_nic_access(priv)
-#endif
-
-static inline u32 _iwl3945_read_direct32(struct iwl3945_priv *priv, u32 reg)
-{
-       return _iwl3945_read32(priv, reg);
-}
-#ifdef CONFIG_IWL3945_DEBUG
-static inline u32 __iwl3945_read_direct32(const char *f, u32 l,
-                                       struct iwl3945_priv *priv, u32 reg)
-{
-       u32 value = _iwl3945_read_direct32(priv, reg);
-       if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from %s %d\n", f, l);
-       IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value,
-                    f, l);
-       return value;
-}
-#define iwl3945_read_direct32(priv, reg) \
-       __iwl3945_read_direct32(__FILE__, __LINE__, priv, reg)
-#else
-#define iwl3945_read_direct32 _iwl3945_read_direct32
-#endif
-
-static inline void _iwl3945_write_direct32(struct iwl3945_priv *priv,
-                                        u32 reg, u32 value)
-{
-       _iwl3945_write32(priv, reg, value);
-}
-#ifdef CONFIG_IWL3945_DEBUG
-static void __iwl3945_write_direct32(u32 line,
-                                  struct iwl3945_priv *priv, u32 reg, u32 value)
-{
-       if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from line %d\n", line);
-       _iwl3945_write_direct32(priv, reg, value);
-}
-#define iwl3945_write_direct32(priv, reg, value) \
-       __iwl3945_write_direct32(__LINE__, priv, reg, value)
-#else
-#define iwl3945_write_direct32 _iwl3945_write_direct32
-#endif
-
-static inline void iwl3945_write_reg_buf(struct iwl3945_priv *priv,
-                                              u32 reg, u32 len, u32 *values)
-{
-       u32 count = sizeof(u32);
-
-       if ((priv != NULL) && (values != NULL)) {
-               for (; 0 < len; len -= count, reg += count, values++)
-                       _iwl3945_write_direct32(priv, reg, *values);
-       }
-}
-
-static inline int _iwl3945_poll_direct_bit(struct iwl3945_priv *priv,
-                                          u32 addr, u32 mask, int timeout)
-{
-       return _iwl3945_poll_bit(priv, addr, mask, mask, timeout);
-}
-
-#ifdef CONFIG_IWL3945_DEBUG
-static inline int __iwl3945_poll_direct_bit(const char *f, u32 l,
-                                           struct iwl3945_priv *priv,
-                                           u32 addr, u32 mask, int timeout)
-{
-       int ret  = _iwl3945_poll_direct_bit(priv, addr, mask, timeout);
-
-       if (unlikely(ret == -ETIMEDOUT))
-               IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - "
-                            "timedout - %s %d\n", addr, mask, f, l);
-       else
-               IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) = 0x%08X "
-                            "- %s %d\n", addr, mask, ret, f, l);
-       return ret;
-}
-#define iwl3945_poll_direct_bit(priv, addr, mask, timeout) \
-       __iwl3945_poll_direct_bit(__FILE__, __LINE__, priv, addr, mask, timeout)
-#else
-#define iwl3945_poll_direct_bit _iwl3945_poll_direct_bit
-#endif
-
-static inline u32 _iwl3945_read_prph(struct iwl3945_priv *priv, u32 reg)
-{
-       _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_RADDR, reg | (3 << 24));
-       rmb();
-       return _iwl3945_read_direct32(priv, HBUS_TARG_PRPH_RDAT);
-}
-#ifdef CONFIG_IWL3945_DEBUG
-static inline u32 __iwl3945_read_prph(u32 line, struct iwl3945_priv *priv, u32 reg)
-{
-       if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from line %d\n", line);
-       return _iwl3945_read_prph(priv, reg);
-}
-
-#define iwl3945_read_prph(priv, reg) \
-       __iwl3945_read_prph(__LINE__, priv, reg)
-#else
-#define iwl3945_read_prph _iwl3945_read_prph
-#endif
-
-static inline void _iwl3945_write_prph(struct iwl3945_priv *priv,
-                                            u32 addr, u32 val)
-{
-       _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WADDR,
-                             ((addr & 0x0000FFFF) | (3 << 24)));
-       wmb();
-       _iwl3945_write_direct32(priv, HBUS_TARG_PRPH_WDAT, val);
-}
-#ifdef CONFIG_IWL3945_DEBUG
-static inline void __iwl3945_write_prph(u32 line, struct iwl3945_priv *priv,
-                                             u32 addr, u32 val)
-{
-       if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access from line %d\n", line);
-       _iwl3945_write_prph(priv, addr, val);
-}
-
-#define iwl3945_write_prph(priv, addr, val) \
-       __iwl3945_write_prph(__LINE__, priv, addr, val);
-#else
-#define iwl3945_write_prph _iwl3945_write_prph
-#endif
-
-#define _iwl3945_set_bits_prph(priv, reg, mask) \
-       _iwl3945_write_prph(priv, reg, (_iwl3945_read_prph(priv, reg) | mask))
-#ifdef CONFIG_IWL3945_DEBUG
-static inline void __iwl3945_set_bits_prph(u32 line, struct iwl3945_priv *priv,
-                                       u32 reg, u32 mask)
-{
-       if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from line %d\n", line);
-
-       _iwl3945_set_bits_prph(priv, reg, mask);
-}
-#define iwl3945_set_bits_prph(priv, reg, mask) \
-       __iwl3945_set_bits_prph(__LINE__, priv, reg, mask)
-#else
-#define iwl3945_set_bits_prph _iwl3945_set_bits_prph
-#endif
-
-#define _iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \
-       _iwl3945_write_prph(priv, reg, ((_iwl3945_read_prph(priv, reg) & mask) | bits))
-
-#ifdef CONFIG_IWL3945_DEBUG
-static inline void __iwl3945_set_bits_mask_prph(u32 line,
-               struct iwl3945_priv *priv, u32 reg, u32 bits, u32 mask)
-{
-       if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from line %d\n", line);
-       _iwl3945_set_bits_mask_prph(priv, reg, bits, mask);
-}
-#define iwl3945_set_bits_mask_prph(priv, reg, bits, mask) \
-       __iwl3945_set_bits_mask_prph(__LINE__, priv, reg, bits, mask)
-#else
-#define iwl3945_set_bits_mask_prph _iwl3945_set_bits_mask_prph
-#endif
-
-static inline void iwl3945_clear_bits_prph(struct iwl3945_priv
-                                                *priv, u32 reg, u32 mask)
-{
-       u32 val = _iwl3945_read_prph(priv, reg);
-       _iwl3945_write_prph(priv, reg, (val & ~mask));
-}
-
-static inline u32 iwl3945_read_targ_mem(struct iwl3945_priv *priv, u32 addr)
-{
-       iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, addr);
-       rmb();
-       return iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
-}
-
-static inline void iwl3945_write_targ_mem(struct iwl3945_priv *priv, u32 addr, u32 val)
-{
-       iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
-       wmb();
-       iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, val);
-}
-
-static inline void iwl3945_write_targ_mem_buf(struct iwl3945_priv *priv, u32 addr,
-                                         u32 len, u32 *values)
-{
-       iwl3945_write_direct32(priv, HBUS_TARG_MEM_WADDR, addr);
-       wmb();
-       for (; 0 < len; len -= sizeof(u32), values++)
-               iwl3945_write_direct32(priv, HBUS_TARG_MEM_WDAT, *values);
-}
-#endif
index 4c638909a7db325bd6314c3f2f065824f8d66f0a..a973ac13a1d547113b3cb2b4910c08ac518d7b4a 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 #include <linux/etherdevice.h>
 #include <asm/unaligned.h>
 
+#include "iwl-commands.h"
 #include "iwl-3945.h"
-#include "iwl-helpers.h"
+#include "iwl-core.h"
+#include "iwl-dev.h"
 
 
 static const struct {
@@ -67,8 +69,8 @@ static const struct {
 #define IWL_MAX_BLINK_TBL (ARRAY_SIZE(blink_tbl) - 1) /*Exclude Solid on*/
 #define IWL_SOLID_BLINK_IDX (ARRAY_SIZE(blink_tbl) - 1)
 
-static int iwl3945_led_cmd_callback(struct iwl3945_priv *priv,
-                                   struct iwl3945_cmd *cmd,
+static int iwl3945_led_cmd_callback(struct iwl_priv *priv,
+                                   struct iwl_cmd *cmd,
                                    struct sk_buff *skb)
 {
        return 1;
@@ -80,27 +82,27 @@ static inline int iwl3945_brightness_to_idx(enum led_brightness brightness)
 }
 
 /* Send led command */
-static int iwl_send_led_cmd(struct iwl3945_priv *priv,
-                           struct iwl3945_led_cmd *led_cmd)
+static int iwl_send_led_cmd(struct iwl_priv *priv,
+                           struct iwl_led_cmd *led_cmd)
 {
-       struct iwl3945_host_cmd cmd = {
+       struct iwl_host_cmd cmd = {
                .id = REPLY_LEDS_CMD,
-               .len = sizeof(struct iwl3945_led_cmd),
+               .len = sizeof(struct iwl_led_cmd),
                .data = led_cmd,
                .meta.flags = CMD_ASYNC,
                .meta.u.callback = iwl3945_led_cmd_callback,
        };
 
-       return iwl3945_send_cmd(priv, &cmd);
+       return iwl_send_cmd(priv, &cmd);
 }
 
 
 
 /* Set led on command */
-static int iwl3945_led_pattern(struct iwl3945_priv *priv, int led_id,
+static int iwl3945_led_pattern(struct iwl_priv *priv, int led_id,
                               unsigned int idx)
 {
-       struct iwl3945_led_cmd led_cmd = {
+       struct iwl_led_cmd led_cmd = {
                .id = led_id,
                .interval = IWL_DEF_LED_INTRVL
        };
@@ -114,11 +116,10 @@ static int iwl3945_led_pattern(struct iwl3945_priv *priv, int led_id,
 }
 
 
-#if 1
 /* Set led on command */
-static int iwl3945_led_on(struct iwl3945_priv *priv, int led_id)
+static int iwl3945_led_on(struct iwl_priv *priv, int led_id)
 {
-       struct iwl3945_led_cmd led_cmd = {
+       struct iwl_led_cmd led_cmd = {
                .id = led_id,
                .on = IWL_LED_SOLID,
                .off = 0,
@@ -128,24 +129,22 @@ static int iwl3945_led_on(struct iwl3945_priv *priv, int led_id)
 }
 
 /* Set led off command */
-static int iwl3945_led_off(struct iwl3945_priv *priv, int led_id)
+static int iwl3945_led_off(struct iwl_priv *priv, int led_id)
 {
-       struct iwl3945_led_cmd led_cmd = {
+       struct iwl_led_cmd led_cmd = {
                .id = led_id,
                .on = 0,
                .off = 0,
                .interval = IWL_DEF_LED_INTRVL
        };
-       IWL_DEBUG_LED("led off %d\n", led_id);
+       IWL_DEBUG_LED(priv, "led off %d\n", led_id);
        return iwl_send_led_cmd(priv, &led_cmd);
 }
-#endif
-
 
 /*
  * brightness call back function for Tx/Rx LED
  */
-static int iwl3945_led_associated(struct iwl3945_priv *priv, int led_id)
+static int iwl3945_led_associated(struct iwl_priv *priv, int led_id)
 {
        if (test_bit(STATUS_EXIT_PENDING, &priv->status) ||
            !test_bit(STATUS_READY, &priv->status))
@@ -166,7 +165,7 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
 {
        struct iwl3945_led *led = container_of(led_cdev,
                                               struct iwl3945_led, led_dev);
-       struct iwl3945_priv *priv = led->priv;
+       struct iwl_priv *priv = led->priv;
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
@@ -175,7 +174,7 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
        case LED_FULL:
                if (led->type == IWL_LED_TRG_ASSOC) {
                        priv->allow_blinking = 1;
-                       IWL_DEBUG_LED("MAC is  associated\n");
+                       IWL_DEBUG_LED(priv, "MAC is  associated\n");
                }
                if (led->led_on)
                        led->led_on(priv, IWL_LED_LINK);
@@ -183,7 +182,7 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
        case LED_OFF:
                if (led->type == IWL_LED_TRG_ASSOC) {
                        priv->allow_blinking = 0;
-                       IWL_DEBUG_LED("MAC is disassociated\n");
+                       IWL_DEBUG_LED(priv, "MAC is disassociated\n");
                }
                if (led->led_off)
                        led->led_off(priv, IWL_LED_LINK);
@@ -202,7 +201,7 @@ static void iwl3945_led_brightness_set(struct led_classdev *led_cdev,
 /*
  * Register led class with the system
  */
-static int iwl3945_led_register_led(struct iwl3945_priv *priv,
+static int iwl3945_led_register_led(struct iwl_priv *priv,
                                   struct iwl3945_led *led,
                                   enum led_type type, u8 set_led,
                                   char *trigger)
@@ -219,7 +218,7 @@ static int iwl3945_led_register_led(struct iwl3945_priv *priv,
 
        ret = led_classdev_register(device, &led->led_dev);
        if (ret) {
-               IWL_ERROR("Error: failed to register led handler.\n");
+               IWL_ERR(priv, "Error: failed to register led handler.\n");
                return ret;
        }
 
@@ -234,7 +233,7 @@ static int iwl3945_led_register_led(struct iwl3945_priv *priv,
 /*
  * calculate blink rate according to last 2 sec Tx/Rx activities
  */
-static inline u8 get_blink_rate(struct iwl3945_priv *priv)
+static inline u8 get_blink_rate(struct iwl_priv *priv)
 {
        int index;
        u64 current_tpt = priv->rxtxpackets;
@@ -253,7 +252,7 @@ static inline u8 get_blink_rate(struct iwl3945_priv *priv)
        return index;
 }
 
-static inline int is_rf_kill(struct iwl3945_priv *priv)
+static inline int is_rf_kill(struct iwl_priv *priv)
 {
        return test_bit(STATUS_RF_KILL_HW, &priv->status) ||
                test_bit(STATUS_RF_KILL_SW, &priv->status);
@@ -264,7 +263,7 @@ static inline int is_rf_kill(struct iwl3945_priv *priv)
  * happen very frequent we postpone led command to be called from
  * REPLY handler so we know ucode is up
  */
-void iwl3945_led_background(struct iwl3945_priv *priv)
+void iwl3945_led_background(struct iwl_priv *priv)
 {
        u8 blink_idx;
 
@@ -304,7 +303,7 @@ void iwl3945_led_background(struct iwl3945_priv *priv)
 
 
 /* Register all led handler */
-int iwl3945_led_register(struct iwl3945_priv *priv)
+int iwl3945_led_register(struct iwl_priv *priv)
 {
        char *trigger;
        int ret;
@@ -316,66 +315,66 @@ int iwl3945_led_register(struct iwl3945_priv *priv)
        priv->allow_blinking = 0;
 
        trigger = ieee80211_get_radio_led_name(priv->hw);
-       snprintf(priv->led[IWL_LED_TRG_RADIO].name,
-                sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio",
+       snprintf(priv->led39[IWL_LED_TRG_RADIO].name,
+                sizeof(priv->led39[IWL_LED_TRG_RADIO].name), "iwl-%s::radio",
                 wiphy_name(priv->hw->wiphy));
 
-       priv->led[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on;
-       priv->led[IWL_LED_TRG_RADIO].led_off = iwl3945_led_off;
-       priv->led[IWL_LED_TRG_RADIO].led_pattern = NULL;
+       priv->led39[IWL_LED_TRG_RADIO].led_on = iwl3945_led_on;
+       priv->led39[IWL_LED_TRG_RADIO].led_off = iwl3945_led_off;
+       priv->led39[IWL_LED_TRG_RADIO].led_pattern = NULL;
 
        ret = iwl3945_led_register_led(priv,
-                                  &priv->led[IWL_LED_TRG_RADIO],
+                                  &priv->led39[IWL_LED_TRG_RADIO],
                                   IWL_LED_TRG_RADIO, 1, trigger);
 
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_assoc_led_name(priv->hw);
-       snprintf(priv->led[IWL_LED_TRG_ASSOC].name,
-                sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc",
+       snprintf(priv->led39[IWL_LED_TRG_ASSOC].name,
+                sizeof(priv->led39[IWL_LED_TRG_ASSOC].name), "iwl-%s::assoc",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl3945_led_register_led(priv,
-                                  &priv->led[IWL_LED_TRG_ASSOC],
+                                  &priv->led39[IWL_LED_TRG_ASSOC],
                                   IWL_LED_TRG_ASSOC, 0, trigger);
 
        /* for assoc always turn led on */
-       priv->led[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on;
-       priv->led[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on;
-       priv->led[IWL_LED_TRG_ASSOC].led_pattern = NULL;
+       priv->led39[IWL_LED_TRG_ASSOC].led_on = iwl3945_led_on;
+       priv->led39[IWL_LED_TRG_ASSOC].led_off = iwl3945_led_on;
+       priv->led39[IWL_LED_TRG_ASSOC].led_pattern = NULL;
 
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_rx_led_name(priv->hw);
-       snprintf(priv->led[IWL_LED_TRG_RX].name,
-                sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX",
+       snprintf(priv->led39[IWL_LED_TRG_RX].name,
+                sizeof(priv->led39[IWL_LED_TRG_RX].name), "iwl-%s::RX",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl3945_led_register_led(priv,
-                                  &priv->led[IWL_LED_TRG_RX],
+                                  &priv->led39[IWL_LED_TRG_RX],
                                   IWL_LED_TRG_RX, 0, trigger);
 
-       priv->led[IWL_LED_TRG_RX].led_on = iwl3945_led_associated;
-       priv->led[IWL_LED_TRG_RX].led_off = iwl3945_led_associated;
-       priv->led[IWL_LED_TRG_RX].led_pattern = iwl3945_led_pattern;
+       priv->led39[IWL_LED_TRG_RX].led_on = iwl3945_led_associated;
+       priv->led39[IWL_LED_TRG_RX].led_off = iwl3945_led_associated;
+       priv->led39[IWL_LED_TRG_RX].led_pattern = iwl3945_led_pattern;
 
        if (ret)
                goto exit_fail;
 
        trigger = ieee80211_get_tx_led_name(priv->hw);
-       snprintf(priv->led[IWL_LED_TRG_TX].name,
-                sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX",
+       snprintf(priv->led39[IWL_LED_TRG_TX].name,
+                sizeof(priv->led39[IWL_LED_TRG_TX].name), "iwl-%s::TX",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl3945_led_register_led(priv,
-                                  &priv->led[IWL_LED_TRG_TX],
+                                  &priv->led39[IWL_LED_TRG_TX],
                                   IWL_LED_TRG_TX, 0, trigger);
 
-       priv->led[IWL_LED_TRG_TX].led_on = iwl3945_led_associated;
-       priv->led[IWL_LED_TRG_TX].led_off = iwl3945_led_associated;
-       priv->led[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
+       priv->led39[IWL_LED_TRG_TX].led_on = iwl3945_led_associated;
+       priv->led39[IWL_LED_TRG_TX].led_off = iwl3945_led_associated;
+       priv->led39[IWL_LED_TRG_TX].led_pattern = iwl3945_led_pattern;
 
        if (ret)
                goto exit_fail;
@@ -402,11 +401,11 @@ static void iwl3945_led_unregister_led(struct iwl3945_led *led, u8 set_led)
 }
 
 /* Unregister all led handlers */
-void iwl3945_led_unregister(struct iwl3945_priv *priv)
+void iwl3945_led_unregister(struct iwl_priv *priv)
 {
-       iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_ASSOC], 0);
-       iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_RX], 0);
-       iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_TX], 0);
-       iwl3945_led_unregister_led(&priv->led[IWL_LED_TRG_RADIO], 1);
+       iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_ASSOC], 0);
+       iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RX], 0);
+       iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_TX], 0);
+       iwl3945_led_unregister_led(&priv->led39[IWL_LED_TRG_RADIO], 1);
 }
 
index 749ac035fd6aa3a20d4a7c85b8778f2084dc11e1..88185a6ccd6aca02677b468ba42e3c1834ed2e8b 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 #ifndef IWL3945_LEDS_H
 #define IWL3945_LEDS_H
 
-struct iwl3945_priv;
+struct iwl_priv;
 
 #ifdef CONFIG_IWL3945_LEDS
-#define IWL_LED_SOLID 11
-#define IWL_LED_NAME_LEN 31
-#define IWL_DEF_LED_INTRVL __constant_cpu_to_le32(1000)
 
-#define IWL_LED_ACTIVITY       (0<<1)
-#define IWL_LED_LINK           (1<<1)
-
-enum led_type {
-       IWL_LED_TRG_TX,
-       IWL_LED_TRG_RX,
-       IWL_LED_TRG_ASSOC,
-       IWL_LED_TRG_RADIO,
-       IWL_LED_TRG_MAX,
-};
-
-#include <linux/leds.h>
+#include "iwl-led.h"
 
 struct iwl3945_led {
-       struct iwl3945_priv *priv;
+       struct iwl_priv *priv;
        struct led_classdev led_dev;
        char name[32];
 
-       int (*led_on) (struct iwl3945_priv *priv, int led_id);
-       int (*led_off) (struct iwl3945_priv *priv, int led_id);
-       int (*led_pattern) (struct iwl3945_priv *priv, int led_id,
+       int (*led_on) (struct iwl_priv *priv, int led_id);
+       int (*led_off) (struct iwl_priv *priv, int led_id);
+       int (*led_pattern) (struct iwl_priv *priv, int led_id,
                            unsigned int idx);
 
        enum led_type type;
        unsigned int registered;
 };
 
-extern int iwl3945_led_register(struct iwl3945_priv *priv);
-extern void iwl3945_led_unregister(struct iwl3945_priv *priv);
-extern void iwl3945_led_background(struct iwl3945_priv *priv);
+extern int iwl3945_led_register(struct iwl_priv *priv);
+extern void iwl3945_led_unregister(struct iwl_priv *priv);
+extern void iwl3945_led_background(struct iwl_priv *priv);
 
 #else
-static inline int iwl3945_led_register(struct iwl3945_priv *priv) { return 0; }
-static inline void iwl3945_led_unregister(struct iwl3945_priv *priv) {}
-static inline void iwl3945_led_background(struct iwl3945_priv *priv) {}
+static inline int iwl3945_led_register(struct iwl_priv *priv) { return 0; }
+static inline void iwl3945_led_unregister(struct iwl_priv *priv) {}
+static inline void iwl3945_led_background(struct iwl_priv *priv) {}
 #endif /* CONFIG_IWL3945_LEDS */
 
 #endif /* IWL3945_LEDS_H */
index 21c841847d886022072f44fea41792ae64227d0c..7db8198c6253752d4b9313ece41b3e148af3c155 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -36,6 +36,7 @@
 
 #include <linux/workqueue.h>
 
+#include "iwl-commands.h"
 #include "iwl-3945.h"
 
 #define RS_NAME "iwl-3945-rs"
@@ -51,6 +52,7 @@ struct iwl3945_rate_scale_data {
 
 struct iwl3945_rs_sta {
        spinlock_t lock;
+       struct iwl_priv *priv;
        s32 *expected_tpt;
        unsigned long last_partial_flush;
        unsigned long last_flush;
@@ -62,7 +64,7 @@ struct iwl3945_rs_sta {
        u8 start_rate;
        u8 ibss_sta_added;
        struct timer_list rate_scale_flush;
-       struct iwl3945_rate_scale_data win[IWL_RATE_COUNT];
+       struct iwl3945_rate_scale_data win[IWL_RATE_COUNT_3945];
 #ifdef CONFIG_MAC80211_DEBUGFS
        struct dentry *rs_sta_dbgfs_stats_table_file;
 #endif
@@ -71,19 +73,19 @@ struct iwl3945_rs_sta {
        int last_txrate_idx;
 };
 
-static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT] = {
+static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = {
        7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202
 };
 
-static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT] = {
+static s32 iwl3945_expected_tpt_g_prot[IWL_RATE_COUNT_3945] = {
        7, 13, 35, 58, 0, 0, 0, 80, 93, 113, 123, 125
 };
 
-static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT] = {
+static s32 iwl3945_expected_tpt_a[IWL_RATE_COUNT_3945] = {
        0, 0, 0, 0, 40, 57, 72, 98, 121, 154, 177, 186
 };
 
-static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT] = {
+static s32 iwl3945_expected_tpt_b[IWL_RATE_COUNT_3945] = {
        7, 13, 35, 58, 0, 0, 0, 0, 0, 0, 0, 0
 };
 
@@ -119,7 +121,7 @@ static struct iwl3945_tpt_entry iwl3945_tpt_table_g[] = {
 #define IWL_RATE_MAX_WINDOW          62
 #define IWL_RATE_FLUSH          (3*HZ)
 #define IWL_RATE_WIN_FLUSH       (HZ/2)
-#define IWL_RATE_HIGH_TH          11520
+#define IWL39_RATE_HIGH_TH          11520
 #define IWL_SUCCESS_UP_TH         8960
 #define IWL_SUCCESS_DOWN_TH      10880
 #define IWL_RATE_MIN_FAILURE_TH       8
@@ -165,7 +167,7 @@ static void iwl3945_clear_window(struct iwl3945_rate_scale_data *window)
        window->success_counter = 0;
        window->success_ratio = -1;
        window->counter = 0;
-       window->average_tpt = IWL_INV_TPT;
+       window->average_tpt = IWL_INVALID_VALUE;
        window->stamp = 0;
 }
 
@@ -181,20 +183,21 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta)
        int unflushed = 0;
        int i;
        unsigned long flags;
+       struct iwl_priv *priv __maybe_unused = rs_sta->priv;
 
        /*
         * For each rate, if we have collected data on that rate
         * and it has been more than IWL_RATE_WIN_FLUSH
         * since we flushed, clear out the gathered statistics
         */
-       for (i = 0; i < IWL_RATE_COUNT; i++) {
+       for (i = 0; i < IWL_RATE_COUNT_3945; i++) {
                if (!rs_sta->win[i].counter)
                        continue;
 
                spin_lock_irqsave(&rs_sta->lock, flags);
                if (time_after(jiffies, rs_sta->win[i].stamp +
                               IWL_RATE_WIN_FLUSH)) {
-                       IWL_DEBUG_RATE("flushing %d samples of rate "
+                       IWL_DEBUG_RATE(priv, "flushing %d samples of rate "
                                       "index %d\n",
                                       rs_sta->win[i].counter, i);
                        iwl3945_clear_window(&rs_sta->win[i]);
@@ -213,11 +216,12 @@ static int iwl3945_rate_scale_flush_windows(struct iwl3945_rs_sta *rs_sta)
 static void iwl3945_bg_rate_scale_flush(unsigned long data)
 {
        struct iwl3945_rs_sta *rs_sta = (void *)data;
+       struct iwl_priv *priv __maybe_unused = rs_sta->priv;
        int unflushed = 0;
        unsigned long flags;
        u32 packet_count, duration, pps;
 
-       IWL_DEBUG_RATE("enter\n");
+       IWL_DEBUG_RATE(priv, "enter\n");
 
        unflushed = iwl3945_rate_scale_flush_windows(rs_sta);
 
@@ -232,7 +236,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
                duration =
                    jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);
 
-               IWL_DEBUG_RATE("Tx'd %d packets in %dms\n",
+               IWL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n",
                               packet_count, duration);
 
                /* Determine packets per second */
@@ -252,7 +256,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
 
                rs_sta->flush_time = msecs_to_jiffies(duration);
 
-               IWL_DEBUG_RATE("new flush period: %d msec ave %d\n",
+               IWL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n",
                               duration, packet_count);
 
                mod_timer(&rs_sta->rate_scale_flush, jiffies +
@@ -270,7 +274,7 @@ static void iwl3945_bg_rate_scale_flush(unsigned long data)
 
        spin_unlock_irqrestore(&rs_sta->lock, flags);
 
-       IWL_DEBUG_RATE("leave\n");
+       IWL_DEBUG_RATE(priv, "leave\n");
 }
 
 /**
@@ -286,9 +290,10 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
 {
        unsigned long flags;
        s32 fail_count;
+       struct iwl_priv *priv __maybe_unused = rs_sta->priv;
 
        if (!retries) {
-               IWL_DEBUG_RATE("leave: retries == 0 -- should be at least 1\n");
+               IWL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n");
                return;
        }
 
@@ -329,7 +334,7 @@ static void iwl3945_collect_tx_data(struct iwl3945_rs_sta *rs_sta,
                window->average_tpt = ((window->success_ratio *
                                rs_sta->expected_tpt[index] + 64) / 128);
        else
-               window->average_tpt = IWL_INV_TPT;
+               window->average_tpt = IWL_INVALID_VALUE;
 
        spin_unlock_irqrestore(&rs_sta->lock, flags);
 
@@ -339,10 +344,10 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
                         struct ieee80211_sta *sta, void *priv_sta)
 {
        struct iwl3945_rs_sta *rs_sta = priv_sta;
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r;
+       struct iwl_priv *priv = (struct iwl_priv *)priv_r;
        int i;
 
-       IWL_DEBUG_RATE("enter\n");
+       IWL_DEBUG_RATE(priv, "enter\n");
 
        /* TODO: what is a good starting rate for STA? About middle? Maybe not
         * the lowest or the highest rate.. Could consider using RSSI from
@@ -365,7 +370,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
        }
 
 
-       IWL_DEBUG_RATE("leave\n");
+       IWL_DEBUG_RATE(priv, "leave\n");
 }
 
 static void *rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
@@ -379,10 +384,11 @@ static void rs_free(void *priv)
        return;
 }
 
-static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
+static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp)
 {
        struct iwl3945_rs_sta *rs_sta;
        struct iwl3945_sta_priv *psta = (void *) sta->drv_priv;
+       struct iwl_priv *priv = iwl_priv;
        int i;
 
        /*
@@ -390,11 +396,11 @@ static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
         *      as well just put all the information there.
         */
 
-       IWL_DEBUG_RATE("enter\n");
+       IWL_DEBUG_RATE(priv, "enter\n");
 
        rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp);
        if (!rs_sta) {
-               IWL_DEBUG_RATE("leave: ENOMEM\n");
+               IWL_DEBUG_RATE(priv, "leave: ENOMEM\n");
                return NULL;
        }
 
@@ -402,6 +408,8 @@ static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
 
        spin_lock_init(&rs_sta->lock);
 
+       rs_sta->priv = priv;
+
        rs_sta->start_rate = IWL_RATE_INVALID;
 
        /* default to just 802.11b */
@@ -417,33 +425,34 @@ static void *rs_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
        rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
        rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush;
 
-       for (i = 0; i < IWL_RATE_COUNT; i++)
+       for (i = 0; i < IWL_RATE_COUNT_3945; i++)
                iwl3945_clear_window(&rs_sta->win[i]);
 
-       IWL_DEBUG_RATE("leave\n");
+       IWL_DEBUG_RATE(priv, "leave\n");
 
        return rs_sta;
 }
 
-static void rs_free_sta(void *priv, struct ieee80211_sta *sta,
+static void rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta,
                        void *priv_sta)
 {
        struct iwl3945_sta_priv *psta = (void *) sta->drv_priv;
        struct iwl3945_rs_sta *rs_sta = priv_sta;
+       struct iwl_priv *priv __maybe_unused = rs_sta->priv;
 
        psta->rs_sta = NULL;
 
-       IWL_DEBUG_RATE("enter\n");
+       IWL_DEBUG_RATE(priv, "enter\n");
        del_timer_sync(&rs_sta->rate_scale_flush);
        kfree(rs_sta);
-       IWL_DEBUG_RATE("leave\n");
+       IWL_DEBUG_RATE(priv, "leave\n");
 }
 
 
 /**
  * rs_tx_status - Update rate control values based on Tx results
  *
- * NOTE: Uses iwl3945_priv->retry_rate for the # of retries attempted by
+ * NOTE: Uses iwl_priv->retry_rate for the # of retries attempted by
  * the hardware for each rate.
  */
 static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband,
@@ -453,22 +462,22 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
        s8 retries = 0, current_count;
        int scale_rate_index, first_index, last_index;
        unsigned long flags;
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_rate;
+       struct iwl_priv *priv = (struct iwl_priv *)priv_rate;
        struct iwl3945_rs_sta *rs_sta = priv_sta;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 
-       IWL_DEBUG_RATE("enter\n");
+       IWL_DEBUG_RATE(priv, "enter\n");
 
        retries = info->status.rates[0].count;
 
        first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
-       if ((first_index < 0) || (first_index >= IWL_RATE_COUNT)) {
-               IWL_DEBUG_RATE("leave: Rate out of bounds: %d\n", first_index);
+       if ((first_index < 0) || (first_index >= IWL_RATE_COUNT_3945)) {
+               IWL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index);
                return;
        }
 
        if (!priv_sta) {
-               IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
+               IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
                return;
        }
 
@@ -502,7 +511,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
                iwl3945_collect_tx_data(rs_sta,
                                    &rs_sta->win[scale_rate_index],
                                    0, current_count, scale_rate_index);
-               IWL_DEBUG_RATE("Update rate %d for %d retries.\n",
+               IWL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n",
                               scale_rate_index, current_count);
 
                retries -= current_count;
@@ -512,7 +521,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
 
 
        /* Update the last index window with success/failure based on ACK */
-       IWL_DEBUG_RATE("Update rate %d with %s.\n",
+       IWL_DEBUG_RATE(priv, "Update rate %d with %s.\n",
                       last_index,
                       (info->flags & IEEE80211_TX_STAT_ACK) ?
                       "success" : "failure");
@@ -537,7 +546,7 @@ static void rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband
 
        spin_unlock_irqrestore(&rs_sta->lock, flags);
 
-       IWL_DEBUG_RATE("leave\n");
+       IWL_DEBUG_RATE(priv, "leave\n");
 
        return;
 }
@@ -547,6 +556,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
 {
        u8 high = IWL_RATE_INVALID;
        u8 low = IWL_RATE_INVALID;
+       struct iwl_priv *priv __maybe_unused = rs_sta->priv;
 
        /* 802.11A walks to the next literal adjacent rate in
         * the rate table */
@@ -565,7 +575,8 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
 
                /* Find the next rate that is in the rate mask */
                i = index + 1;
-               for (mask = (1 << i); i < IWL_RATE_COUNT; i++, mask <<= 1) {
+               for (mask = (1 << i); i < IWL_RATE_COUNT_3945;
+                    i++, mask <<= 1) {
                        if (rate_mask & mask) {
                                high = i;
                                break;
@@ -585,7 +596,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
                        break;
                if (rate_mask & (1 << low))
                        break;
-               IWL_DEBUG_RATE("Skipping masked lower rate: %d\n", low);
+               IWL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low);
        }
 
        high = index;
@@ -598,7 +609,7 @@ static u16 iwl3945_get_adjacent_rate(struct iwl3945_rs_sta *rs_sta,
                        break;
                if (rate_mask & (1 << high))
                        break;
-               IWL_DEBUG_RATE("Skipping masked higher rate: %d\n", high);
+               IWL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high);
        }
 
        return (high << 8) | low;
@@ -631,19 +642,20 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
        int index;
        struct iwl3945_rs_sta *rs_sta = priv_sta;
        struct iwl3945_rate_scale_data *window = NULL;
-       int current_tpt = IWL_INV_TPT;
-       int low_tpt = IWL_INV_TPT;
-       int high_tpt = IWL_INV_TPT;
+       int current_tpt = IWL_INVALID_VALUE;
+       int low_tpt = IWL_INVALID_VALUE;
+       int high_tpt = IWL_INVALID_VALUE;
        u32 fail_count;
        s8 scale_action = 0;
        unsigned long flags;
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
        u16 fc;
        u16 rate_mask = 0;
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)priv_r;
+       s8 max_rate_idx = -1;
+       struct iwl_priv *priv = (struct iwl_priv *)priv_r;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
 
-       IWL_DEBUG_RATE("enter\n");
+       IWL_DEBUG_RATE(priv, "enter\n");
 
        if (sta)
                rate_mask = sta->supp_rates[sband->band];
@@ -654,7 +666,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
        if ((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA ||
            is_multicast_ether_addr(hdr->addr1) ||
            !sta || !priv_sta) {
-               IWL_DEBUG_RATE("leave: No STA priv data to update!\n");
+               IWL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
                if (!rate_mask)
                        info->control.rates[0].idx =
                                        rate_lowest_index(sband, NULL);
@@ -664,7 +676,14 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
                return;
        }
 
-       index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT - 1);
+       /* get user max rate if set */
+       max_rate_idx = txrc->max_rate_idx;
+       if ((sband->band == IEEE80211_BAND_5GHZ) && (max_rate_idx != -1))
+               max_rate_idx += IWL_FIRST_OFDM_RATE;
+       if ((max_rate_idx < 0) || (max_rate_idx >= IWL_RATE_COUNT))
+               max_rate_idx = -1;
+
+       index = min(rs_sta->last_txrate_idx & 0xffff, IWL_RATE_COUNT_3945 - 1);
 
        if (sband->band == IEEE80211_BAND_5GHZ)
                rate_mask = rate_mask << IWL_FIRST_OFDM_RATE;
@@ -674,7 +693,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
                u8 sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
 
                if (sta_id == IWL_INVALID_STATION) {
-                       IWL_DEBUG_RATE("LQ: ADD station %pm\n",
+                       IWL_DEBUG_RATE(priv, "LQ: ADD station %pm\n",
                                       hdr->addr1);
                        sta_id = iwl3945_add_station(priv,
                                    hdr->addr1, 0, CMD_ASYNC);
@@ -695,6 +714,12 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
                rs_sta->start_rate = IWL_RATE_INVALID;
        }
 
+       /* force user max rate if set by user */
+       if ((max_rate_idx != -1) && (max_rate_idx < index)) {
+               if (rate_mask & (1 << max_rate_idx))
+                       index = max_rate_idx;
+       }
+
        window = &(rs_sta->win[index]);
 
        fail_count = window->counter - window->success_counter;
@@ -703,7 +728,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
             (window->success_counter < IWL_RATE_MIN_SUCCESS_TH))) {
                spin_unlock_irqrestore(&rs_sta->lock, flags);
 
-               IWL_DEBUG_RATE("Invalid average_tpt on rate %d: "
+               IWL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: "
                               "counter: %d, success_counter: %d, "
                               "expected_tpt is %sNULL\n",
                               index,
@@ -721,6 +746,10 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
        low = high_low & 0xff;
        high = (high_low >> 8) & 0xff;
 
+       /* If user set max rate, dont allow higher than user constrain */
+       if ((max_rate_idx != -1) && (max_rate_idx < high))
+               high = IWL_RATE_INVALID;
+
        if (low != IWL_RATE_INVALID)
                low_tpt = rs_sta->win[low].average_tpt;
 
@@ -732,29 +761,31 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
        scale_action = 1;
 
        if ((window->success_ratio < IWL_RATE_DECREASE_TH) || !current_tpt) {
-               IWL_DEBUG_RATE("decrease rate because of low success_ratio\n");
+               IWL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n");
                scale_action = -1;
-       } else if ((low_tpt == IWL_INV_TPT) && (high_tpt == IWL_INV_TPT))
+       } else if ((low_tpt == IWL_INVALID_VALUE) &&
+                  (high_tpt == IWL_INVALID_VALUE))
                scale_action = 1;
-       else if ((low_tpt != IWL_INV_TPT) && (high_tpt != IWL_INV_TPT) &&
+       else if ((low_tpt != IWL_INVALID_VALUE) &&
+                (high_tpt != IWL_INVALID_VALUE) &&
                 (low_tpt < current_tpt) && (high_tpt < current_tpt)) {
-               IWL_DEBUG_RATE("No action -- low [%d] & high [%d] < "
+               IWL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < "
                               "current_tpt [%d]\n",
                               low_tpt, high_tpt, current_tpt);
                scale_action = 0;
        } else {
-               if (high_tpt != IWL_INV_TPT) {
+               if (high_tpt != IWL_INVALID_VALUE) {
                        if (high_tpt > current_tpt)
                                scale_action = 1;
                        else {
-                               IWL_DEBUG_RATE
-                                   ("decrease rate because of high tpt\n");
+                               IWL_DEBUG_RATE(priv,
+                                   "decrease rate because of high tpt\n");
                                scale_action = -1;
                        }
-               } else if (low_tpt != IWL_INV_TPT) {
+               } else if (low_tpt != IWL_INVALID_VALUE) {
                        if (low_tpt > current_tpt) {
-                               IWL_DEBUG_RATE
-                                   ("decrease rate because of low tpt\n");
+                               IWL_DEBUG_RATE(priv,
+                                   "decrease rate because of low tpt\n");
                                scale_action = -1;
                        } else
                                scale_action = 1;
@@ -766,7 +797,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
                        scale_action = 0;
        } else if (scale_action == 1) {
                if (window->success_ratio < IWL_SUCCESS_UP_TH) {
-                       IWL_DEBUG_RATE("No action -- success_ratio [%d] < "
+                       IWL_DEBUG_RATE(priv, "No action -- success_ratio [%d] < "
                               "SUCCESS UP\n", window->success_ratio);
                        scale_action = 0;
                }
@@ -789,7 +820,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
                break;
        }
 
-       IWL_DEBUG_RATE("Selected %d (action %d) - low %d high %d\n",
+       IWL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n",
                       index, scale_action, low, high);
 
  out:
@@ -801,7 +832,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
        else
                info->control.rates[0].idx = rs_sta->last_txrate_idx;
 
-       IWL_DEBUG_RATE("leave: %d\n", index);
+       IWL_DEBUG_RATE(priv, "leave: %d\n", index);
 }
 
 #ifdef CONFIG_MAC80211_DEBUGFS
@@ -825,7 +856,7 @@ static ssize_t iwl3945_sta_dbgfs_stats_table_read(struct file *file,
                        lq_sta->tx_packets,
                        lq_sta->last_txrate_idx,
                        lq_sta->start_rate, jiffies_to_msecs(lq_sta->flush_time));
-       for (j = 0; j < IWL_RATE_COUNT; j++) {
+       for (j = 0; j < IWL_RATE_COUNT_3945; j++) {
                desc += sprintf(buff+desc,
                                "counter=%d success=%d %%=%d\n",
                                lq_sta->win[j].counter,
@@ -877,18 +908,18 @@ static struct rate_control_ops rs_ops = {
 
 void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
        s32 rssi = 0;
        unsigned long flags;
        struct iwl3945_rs_sta *rs_sta;
        struct ieee80211_sta *sta;
        struct iwl3945_sta_priv *psta;
 
-       IWL_DEBUG_RATE("enter\n");
+       IWL_DEBUG_RATE(priv, "enter\n");
 
        rcu_read_lock();
 
-       sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr);
+       sta = ieee80211_find_sta(hw, priv->stations_39[sta_id].sta.sta.addr);
        if (!sta) {
                rcu_read_unlock();
                return;
@@ -924,11 +955,11 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
        if (rssi == 0)
                rssi = IWL_MIN_RSSI_VAL;
 
-       IWL_DEBUG(IWL_DL_INFO | IWL_DL_RATE, "Network RSSI: %d\n", rssi);
+       IWL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi);
 
        rs_sta->start_rate = iwl3945_get_rate_index_by_rssi(rssi, priv->band);
 
-       IWL_DEBUG_RATE("leave: rssi %d assign rate index: "
+       IWL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: "
                       "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
                       iwl3945_rates[rs_sta->start_rate].plcp);
        rcu_read_unlock();
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
deleted file mode 100644 (file)
index b5a6613..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/******************************************************************************
- *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
- * Contact Information:
- *  Intel Linux Wireless <ilw@linux.intel.com>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *
- *****************************************************************************/
-
-#ifndef __iwl_3945_rs_h__
-#define __iwl_3945_rs_h__
-
-struct iwl3945_rate_info {
-       u8 plcp;                /* uCode API:  IWL_RATE_6M_PLCP, etc. */
-       u8 ieee;                /* MAC header:  IWL_RATE_6M_IEEE, etc. */
-       u8 prev_ieee;           /* previous rate in IEEE speeds */
-       u8 next_ieee;           /* next rate in IEEE speeds */
-       u8 prev_rs;             /* previous rate used in rs algo */
-       u8 next_rs;             /* next rate used in rs algo */
-       u8 prev_rs_tgg;         /* previous rate used in TGG rs algo */
-       u8 next_rs_tgg;         /* next rate used in TGG rs algo */
-       u8 table_rs_index;      /* index in rate scale table cmd */
-       u8 prev_table_rs;       /* prev in rate table cmd */
-};
-
-/*
- * These serve as indexes into
- * struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT];
- */
-enum {
-       IWL_RATE_1M_INDEX = 0,
-       IWL_RATE_2M_INDEX,
-       IWL_RATE_5M_INDEX,
-       IWL_RATE_11M_INDEX,
-       IWL_RATE_6M_INDEX,
-       IWL_RATE_9M_INDEX,
-       IWL_RATE_12M_INDEX,
-       IWL_RATE_18M_INDEX,
-       IWL_RATE_24M_INDEX,
-       IWL_RATE_36M_INDEX,
-       IWL_RATE_48M_INDEX,
-       IWL_RATE_54M_INDEX,
-       IWL_RATE_COUNT,
-       IWL_RATE_INVM_INDEX,
-       IWL_RATE_INVALID = IWL_RATE_INVM_INDEX
-};
-
-enum {
-       IWL_RATE_6M_INDEX_TABLE = 0,
-       IWL_RATE_9M_INDEX_TABLE,
-       IWL_RATE_12M_INDEX_TABLE,
-       IWL_RATE_18M_INDEX_TABLE,
-       IWL_RATE_24M_INDEX_TABLE,
-       IWL_RATE_36M_INDEX_TABLE,
-       IWL_RATE_48M_INDEX_TABLE,
-       IWL_RATE_54M_INDEX_TABLE,
-       IWL_RATE_1M_INDEX_TABLE,
-       IWL_RATE_2M_INDEX_TABLE,
-       IWL_RATE_5M_INDEX_TABLE,
-       IWL_RATE_11M_INDEX_TABLE,
-       IWL_RATE_INVM_INDEX_TABLE = IWL_RATE_INVM_INDEX,
-};
-
-enum {
-       IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX,
-       IWL_LAST_OFDM_RATE = IWL_RATE_54M_INDEX,
-       IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX,
-       IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX,
-};
-
-/* #define vs. enum to keep from defaulting to 'large integer' */
-#define        IWL_RATE_6M_MASK   (1 << IWL_RATE_6M_INDEX)
-#define        IWL_RATE_9M_MASK   (1 << IWL_RATE_9M_INDEX)
-#define        IWL_RATE_12M_MASK  (1 << IWL_RATE_12M_INDEX)
-#define        IWL_RATE_18M_MASK  (1 << IWL_RATE_18M_INDEX)
-#define        IWL_RATE_24M_MASK  (1 << IWL_RATE_24M_INDEX)
-#define        IWL_RATE_36M_MASK  (1 << IWL_RATE_36M_INDEX)
-#define        IWL_RATE_48M_MASK  (1 << IWL_RATE_48M_INDEX)
-#define        IWL_RATE_54M_MASK  (1 << IWL_RATE_54M_INDEX)
-#define        IWL_RATE_1M_MASK   (1 << IWL_RATE_1M_INDEX)
-#define        IWL_RATE_2M_MASK   (1 << IWL_RATE_2M_INDEX)
-#define        IWL_RATE_5M_MASK   (1 << IWL_RATE_5M_INDEX)
-#define        IWL_RATE_11M_MASK  (1 << IWL_RATE_11M_INDEX)
-
-/* 3945 uCode API values for (legacy) bit rates, both OFDM and CCK */
-enum {
-       IWL_RATE_6M_PLCP = 13,
-       IWL_RATE_9M_PLCP = 15,
-       IWL_RATE_12M_PLCP = 5,
-       IWL_RATE_18M_PLCP = 7,
-       IWL_RATE_24M_PLCP = 9,
-       IWL_RATE_36M_PLCP = 11,
-       IWL_RATE_48M_PLCP = 1,
-       IWL_RATE_54M_PLCP = 3,
-       IWL_RATE_1M_PLCP = 10,
-       IWL_RATE_2M_PLCP = 20,
-       IWL_RATE_5M_PLCP = 55,
-       IWL_RATE_11M_PLCP = 110,
-};
-
-/* MAC header values for bit rates */
-enum {
-       IWL_RATE_6M_IEEE = 12,
-       IWL_RATE_9M_IEEE = 18,
-       IWL_RATE_12M_IEEE = 24,
-       IWL_RATE_18M_IEEE = 36,
-       IWL_RATE_24M_IEEE = 48,
-       IWL_RATE_36M_IEEE = 72,
-       IWL_RATE_48M_IEEE = 96,
-       IWL_RATE_54M_IEEE = 108,
-       IWL_RATE_1M_IEEE = 2,
-       IWL_RATE_2M_IEEE = 4,
-       IWL_RATE_5M_IEEE = 11,
-       IWL_RATE_11M_IEEE = 22,
-};
-
-#define IWL_CCK_BASIC_RATES_MASK    \
-       (IWL_RATE_1M_MASK          | \
-       IWL_RATE_2M_MASK)
-
-#define IWL_CCK_RATES_MASK          \
-       (IWL_BASIC_RATES_MASK      | \
-       IWL_RATE_5M_MASK          | \
-       IWL_RATE_11M_MASK)
-
-#define IWL_OFDM_BASIC_RATES_MASK   \
-       (IWL_RATE_6M_MASK         | \
-       IWL_RATE_12M_MASK         | \
-       IWL_RATE_24M_MASK)
-
-#define IWL_OFDM_RATES_MASK         \
-       (IWL_OFDM_BASIC_RATES_MASK | \
-       IWL_RATE_9M_MASK          | \
-       IWL_RATE_18M_MASK         | \
-       IWL_RATE_36M_MASK         | \
-       IWL_RATE_48M_MASK         | \
-       IWL_RATE_54M_MASK)
-
-#define IWL_BASIC_RATES_MASK         \
-       (IWL_OFDM_BASIC_RATES_MASK | \
-        IWL_CCK_BASIC_RATES_MASK)
-
-#define IWL_RATES_MASK ((1 << IWL_RATE_COUNT) - 1)
-
-#define IWL_INV_TPT    -1
-
-#define IWL_MIN_RSSI_VAL                 -100
-#define IWL_MAX_RSSI_VAL                    0
-
-extern const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT];
-
-static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index)
-{
-       u8 rate = iwl3945_rates[rate_index].prev_ieee;
-
-       if (rate == IWL_RATE_INVALID)
-               rate = rate_index;
-       return rate;
-}
-
-/**
- * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info
- *
- * The specific throughput table used is based on the type of network
- * the associated with, including A, B, G, and G w/ TGG protection
- */
-extern void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
-
-/**
- * iwl3945_rate_control_register - Register the rate control algorithm callbacks
- *
- * Since the rate control algorithm is hardware specific, there is no need
- * or reason to place it as a stand alone module.  The driver can call
- * iwl3945_rate_control_register in order to register the rate control callbacks
- * with the mac80211 subsystem.  This should be performed prior to calling
- * ieee80211_register_hw
- *
- */
-extern int iwl3945_rate_control_register(void);
-
-/**
- * iwl3945_rate_control_unregister - Unregister the rate control callbacks
- *
- * This should be called after calling ieee80211_unregister_hw, but before
- * the driver is unloaded.
- */
-extern void iwl3945_rate_control_unregister(void);
-
-#endif
index 45cfa1cf194a2d3218efe4cb2a9ba8e03adc9df3..d49e48b9b037b7b74f5368639900d7ed24ea922d 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 #include <asm/unaligned.h>
 #include <net/mac80211.h>
 
-#include "iwl-3945-core.h"
+#include "iwl-fh.h"
+#include "iwl-3945-fh.h"
+#include "iwl-commands.h"
+#include "iwl-sta.h"
 #include "iwl-3945.h"
+#include "iwl-eeprom.h"
 #include "iwl-helpers.h"
-#include "iwl-3945-rs.h"
+#include "iwl-core.h"
+#include "iwl-agn-rs.h"
 
 #define IWL_DECLARE_RATE_INFO(r, ip, in, rp, rn, pp, np)    \
        [IWL_RATE_##r##M_INDEX] = { IWL_RATE_##r##M_PLCP,   \
@@ -63,7 +68,7 @@
  * maps to IWL_RATE_INVALID
  *
  */
-const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT] = {
+const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT_3945] = {
        IWL_DECLARE_RATE_INFO(1, INV, 2, INV, 2, INV, 2),    /*  1mbps */
        IWL_DECLARE_RATE_INFO(2, 1, 5, 1, 5, 1, 5),          /*  2mbps */
        IWL_DECLARE_RATE_INFO(5, 2, 6, 2, 11, 2, 11),        /*5.5mbps */
@@ -91,7 +96,7 @@ const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT] = {
  * Use for only special debugging.  This function is just a placeholder as-is,
  *   you'll need to provide the special bits! ...
  *   ... and set IWL_EVT_DISABLE to 1. */
-void iwl3945_disable_events(struct iwl3945_priv *priv)
+void iwl3945_disable_events(struct iwl_priv *priv)
 {
        int ret;
        int i;
@@ -150,34 +155,34 @@ void iwl3945_disable_events(struct iwl3945_priv *priv)
 
        base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
        if (!iwl3945_hw_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
+               IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
                return;
        }
 
-       ret = iwl3945_grab_nic_access(priv);
+       ret = iwl_grab_nic_access(priv);
        if (ret) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
+               IWL_WARN(priv, "Can not read from adapter at this time.\n");
                return;
        }
 
-       disable_ptr = iwl3945_read_targ_mem(priv, base + (4 * sizeof(u32)));
-       array_size = iwl3945_read_targ_mem(priv, base + (5 * sizeof(u32)));
-       iwl3945_release_nic_access(priv);
+       disable_ptr = iwl_read_targ_mem(priv, base + (4 * sizeof(u32)));
+       array_size = iwl_read_targ_mem(priv, base + (5 * sizeof(u32)));
+       iwl_release_nic_access(priv);
 
        if (IWL_EVT_DISABLE && (array_size == IWL_EVT_DISABLE_SIZE)) {
-               IWL_DEBUG_INFO("Disabling selected uCode log events at 0x%x\n",
+               IWL_DEBUG_INFO(priv, "Disabling selected uCode log events at 0x%x\n",
                               disable_ptr);
-               ret = iwl3945_grab_nic_access(priv);
+               ret = iwl_grab_nic_access(priv);
                for (i = 0; i < IWL_EVT_DISABLE_SIZE; i++)
-                       iwl3945_write_targ_mem(priv,
+                       iwl_write_targ_mem(priv,
                                           disable_ptr + (i * sizeof(u32)),
                                           evt_disable[i]);
 
-               iwl3945_release_nic_access(priv);
+               iwl_release_nic_access(priv);
        } else {
-               IWL_DEBUG_INFO("Selected uCode log events may be disabled\n");
-               IWL_DEBUG_INFO("  by writing \"1\"s into disable bitmap\n");
-               IWL_DEBUG_INFO("  in SRAM at 0x%x, size %d u32s\n",
+               IWL_DEBUG_INFO(priv, "Selected uCode log events may be disabled\n");
+               IWL_DEBUG_INFO(priv, "  by writing \"1\"s into disable bitmap\n");
+               IWL_DEBUG_INFO(priv, "  in SRAM at 0x%x, size %d u32s\n",
                               disable_ptr, array_size);
        }
 
@@ -193,40 +198,7 @@ static int iwl3945_hwrate_to_plcp_idx(u8 plcp)
        return -1;
 }
 
-/**
- * iwl3945_get_antenna_flags - Get antenna flags for RXON command
- * @priv: eeprom and antenna fields are used to determine antenna flags
- *
- * priv->eeprom  is used to determine if antenna AUX/MAIN are reversed
- * priv->antenna specifies the antenna diversity mode:
- *
- * IWL_ANTENNA_DIVERSITY - NIC selects best antenna by itself
- * IWL_ANTENNA_MAIN      - Force MAIN antenna
- * IWL_ANTENNA_AUX       - Force AUX antenna
- */
-__le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv)
-{
-       switch (priv->antenna) {
-       case IWL_ANTENNA_DIVERSITY:
-               return 0;
-
-       case IWL_ANTENNA_MAIN:
-               if (priv->eeprom.antenna_switch_type)
-                       return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK;
-               return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK;
-
-       case IWL_ANTENNA_AUX:
-               if (priv->eeprom.antenna_switch_type)
-                       return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK;
-               return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK;
-       }
-
-       /* bad antenna selector value */
-       IWL_ERROR("Bad antenna selector value (0x%x)\n", priv->antenna);
-       return 0;               /* "diversity" is default if error */
-}
-
-#ifdef CONFIG_IWL3945_DEBUG
+#ifdef CONFIG_IWLWIFI_DEBUG
 #define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
 
 static const char *iwl3945_get_tx_fail_reason(u32 status)
@@ -266,7 +238,7 @@ static inline const char *iwl3945_get_tx_fail_reason(u32 status)
  * for A and B mode we need to overright prev
  * value
  */
-int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate)
+int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate)
 {
        int next_rate = iwl3945_get_prev_ieee_rate(rate);
 
@@ -279,7 +251,7 @@ int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate)
                break;
        case IEEE80211_BAND_2GHZ:
                if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) &&
-                   iwl3945_is_associated(priv)) {
+                   iwl_is_associated(priv)) {
                        if (rate == IWL_RATE_11M_INDEX)
                                next_rate = IWL_RATE_5M_INDEX;
                }
@@ -300,12 +272,12 @@ int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate)
  * need to be reclaimed. As result, some free space forms. If there is
  * enough free space (> low mark), wake the stack that feeds us.
  */
-static void iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv,
+static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
                                     int txq_id, int index)
 {
-       struct iwl3945_tx_queue *txq = &priv->txq[txq_id];
-       struct iwl3945_queue *q = &txq->q;
-       struct iwl3945_tx_info *tx_info;
+       struct iwl_tx_queue *txq = &priv->txq[txq_id];
+       struct iwl_queue *q = &txq->q;
+       struct iwl_tx_info *tx_info;
 
        BUG_ON(txq_id == IWL_CMD_QUEUE_NUM);
 
@@ -315,10 +287,10 @@ static void iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv,
                tx_info = &txq->txb[txq->q.read_ptr];
                ieee80211_tx_status_irqsafe(priv->hw, tx_info->skb[0]);
                tx_info->skb[0] = NULL;
-               iwl3945_hw_txq_free_tfd(priv, txq);
+               priv->cfg->ops->lib->txq_free_tfd(priv, txq);
        }
 
-       if (iwl3945_queue_space(q) > q->low_mark && (txq_id >= 0) &&
+       if (iwl_queue_space(q) > q->low_mark && (txq_id >= 0) &&
                        (txq_id != IWL_CMD_QUEUE_NUM) &&
                        priv->mac80211_registered)
                ieee80211_wake_queue(priv->hw, txq_id);
@@ -327,22 +299,22 @@ static void iwl3945_tx_queue_reclaim(struct iwl3945_priv *priv,
 /**
  * iwl3945_rx_reply_tx - Handle Tx response
  */
-static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
-                           struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_reply_tx(struct iwl_priv *priv,
+                           struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
        u16 sequence = le16_to_cpu(pkt->hdr.sequence);
        int txq_id = SEQ_TO_QUEUE(sequence);
        int index = SEQ_TO_INDEX(sequence);
-       struct iwl3945_tx_queue *txq = &priv->txq[txq_id];
+       struct iwl_tx_queue *txq = &priv->txq[txq_id];
        struct ieee80211_tx_info *info;
        struct iwl3945_tx_resp *tx_resp = (void *)&pkt->u.raw[0];
        u32  status = le32_to_cpu(tx_resp->status);
        int rate_idx;
        int fail;
 
-       if ((index >= txq->q.n_bd) || (iwl3945_x2_queue_used(&txq->q, index) == 0)) {
-               IWL_ERROR("Read index for DMA queue txq_id (%d) index %d "
+       if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
+               IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
                          "is out of range [0-%d] %d %d\n", txq_id,
                          index, txq->q.n_bd, txq->q.write_ptr,
                          txq->q.read_ptr);
@@ -366,15 +338,15 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
        info->flags |= ((status & TX_STATUS_MSK) == TX_STATUS_SUCCESS) ?
                                IEEE80211_TX_STAT_ACK : 0;
 
-       IWL_DEBUG_TX("Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n",
+       IWL_DEBUG_TX(priv, "Tx queue %d Status %s (0x%08x) plcp rate %d retries %d\n",
                        txq_id, iwl3945_get_tx_fail_reason(status), status,
                        tx_resp->rate, tx_resp->failure_frame);
 
-       IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
+       IWL_DEBUG_TX_REPLY(priv, "Tx queue reclaim %d\n", index);
        iwl3945_tx_queue_reclaim(priv, txq_id, index);
 
        if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
-               IWL_ERROR("TODO:  Implement Tx ABORT REQUIRED!!!\n");
+               IWL_ERR(priv, "TODO:  Implement Tx ABORT REQUIRED!!!\n");
 }
 
 
@@ -387,14 +359,14 @@ static void iwl3945_rx_reply_tx(struct iwl3945_priv *priv,
  *
  *****************************************************************************/
 
-void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
+void iwl3945_hw_rx_statistics(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n",
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
                     (int)sizeof(struct iwl3945_notif_statistics),
                     le32_to_cpu(pkt->len));
 
-       memcpy(&priv->statistics, pkt->u.raw, sizeof(priv->statistics));
+       memcpy(&priv->statistics_39, pkt->u.raw, sizeof(priv->statistics_39));
 
        iwl3945_led_background(priv);
 
@@ -406,7 +378,7 @@ void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_b
  * Misc. internal state and helper functions
  *
  ******************************************************************************/
-#ifdef CONFIG_IWL3945_DEBUG
+#ifdef CONFIG_IWLWIFI_DEBUG
 
 /**
  * iwl3945_report_frame - dump frame to syslog during debug sessions
@@ -415,8 +387,8 @@ void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, struct iwl3945_rx_mem_b
  * including selective frame dumps.
  * group100 parameter selects whether to show 1 out of 100 good frames.
  */
-static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
-                     struct iwl3945_rx_packet *pkt,
+static void _iwl3945_dbg_report_frame(struct iwl_priv *priv,
+                     struct iwl_rx_packet *pkt,
                      struct ieee80211_hdr *header, int group100)
 {
        u32 to_us;
@@ -524,13 +496,13 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
                 * MAC addresses show just the last byte (for brevity),
                 *    but you can hack it to show more, if you'd like to. */
                if (dataframe)
-                       IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, "
+                       IWL_DEBUG_RX(priv, "%s: mhd=0x%04x, dst=0x%02x, "
                                     "len=%u, rssi=%d, chnl=%d, rate=%d, \n",
                                     title, le16_to_cpu(fc), header->addr1[5],
                                     length, rssi, channel, rate);
                else {
                        /* src/dst addresses assume managed mode */
-                       IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, "
+                       IWL_DEBUG_RX(priv, "%s: 0x%04x, dst=0x%02x, "
                                     "src=0x%02x, rssi=%u, tim=%lu usec, "
                                     "phy=0x%02x, chnl=%d\n",
                                     title, le16_to_cpu(fc), header->addr1[5],
@@ -540,18 +512,27 @@ static void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
                }
        }
        if (print_dump)
-               iwl3945_print_hex_dump(IWL_DL_RX, data, length);
+               iwl_print_hex_dump(priv, IWL_DL_RX, data, length);
+}
+
+static void iwl3945_dbg_report_frame(struct iwl_priv *priv,
+                     struct iwl_rx_packet *pkt,
+                     struct ieee80211_hdr *header, int group100)
+{
+       if (priv->debug_level & IWL_DL_RX)
+               _iwl3945_dbg_report_frame(priv, pkt, header, group100);
 }
+
 #else
-static inline void iwl3945_dbg_report_frame(struct iwl3945_priv *priv,
-                     struct iwl3945_rx_packet *pkt,
+static inline void iwl3945_dbg_report_frame(struct iwl_priv *priv,
+                     struct iwl_rx_packet *pkt,
                      struct ieee80211_hdr *header, int group100)
 {
 }
 #endif
 
 /* This is necessary only for a number of statistics, see the caller. */
-static int iwl3945_is_network_packet(struct iwl3945_priv *priv,
+static int iwl3945_is_network_packet(struct iwl_priv *priv,
                struct ieee80211_hdr *header)
 {
        /* Filter incoming packets to determine if they are targeted toward
@@ -568,11 +549,11 @@ static int iwl3945_is_network_packet(struct iwl3945_priv *priv,
        }
 }
 
-static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
-                                  struct iwl3945_rx_mem_buffer *rxb,
+static void iwl3945_pass_packet_to_mac80211(struct iwl_priv *priv,
+                                  struct iwl_rx_mem_buffer *rxb,
                                   struct ieee80211_rx_status *stats)
 {
-       struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
 #ifdef CONFIG_IWL3945_LEDS
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)IWL_RX_DATA(pkt);
 #endif
@@ -581,15 +562,15 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
        short len = le16_to_cpu(rx_hdr->len);
 
        /* We received data from the HW, so stop the watchdog */
-       if (unlikely((len + IWL_RX_FRAME_SIZE) > skb_tailroom(rxb->skb))) {
-               IWL_DEBUG_DROP("Corruption detected!\n");
+       if (unlikely((len + IWL39_RX_FRAME_SIZE) > skb_tailroom(rxb->skb))) {
+               IWL_DEBUG_DROP(priv, "Corruption detected!\n");
                return;
        }
 
        /* We only process data packets if the interface is open */
        if (unlikely(!priv->is_open)) {
-               IWL_DEBUG_DROP_LIMIT
-                   ("Dropping packet while interface is not open.\n");
+               IWL_DEBUG_DROP_LIMIT(priv,
+                       "Dropping packet while interface is not open.\n");
                return;
        }
 
@@ -597,8 +578,9 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
        /* Set the size of the skb to the size of the frame */
        skb_put(rxb->skb, le16_to_cpu(rx_hdr->len));
 
-       if (iwl3945_param_hwcrypto)
-               iwl3945_set_decrypted_flag(priv, rxb->skb,
+       if (!iwl3945_mod_params.sw_crypto)
+               iwl_set_decrypted_flag(priv,
+                                      (struct ieee80211_hdr *)rxb->skb->data,
                                       le32_to_cpu(rx_end->status), stats);
 
 #ifdef CONFIG_IWL3945_LEDS
@@ -611,12 +593,12 @@ static void iwl3945_pass_packet_to_mac80211(struct iwl3945_priv *priv,
 
 #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
 
-static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
-                               struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_reply_rx(struct iwl_priv *priv,
+                               struct iwl_rx_mem_buffer *rxb)
 {
        struct ieee80211_hdr *header;
        struct ieee80211_rx_status rx_status;
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
        struct iwl3945_rx_frame_stats *rx_stats = IWL_RX_STATS(pkt);
        struct iwl3945_rx_frame_hdr *rx_hdr = IWL_RX_HDR(pkt);
        struct iwl3945_rx_frame_end *rx_end = IWL_RX_END(pkt);
@@ -644,22 +626,21 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
                rx_status.flag |= RX_FLAG_SHORTPRE;
 
        if ((unlikely(rx_stats->phy_count > 20))) {
-               IWL_DEBUG_DROP
-                   ("dsp size out of range [0,20]: "
-                    "%d/n", rx_stats->phy_count);
+               IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n",
+                               rx_stats->phy_count);
                return;
        }
 
        if (!(rx_end->status & RX_RES_STATUS_NO_CRC32_ERROR)
            || !(rx_end->status & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
-               IWL_DEBUG_RX("Bad CRC or FIFO: 0x%08X.\n", rx_end->status);
+               IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n", rx_end->status);
                return;
        }
 
 
 
        /* Convert 3945's rssi indicator to dBm */
-       rx_status.signal = rx_stats->rssi - IWL_RSSI_OFFSET;
+       rx_status.signal = rx_stats->rssi - IWL39_RSSI_OFFSET;
 
        /* Set default noise value to -127 */
        if (priv->last_rx_noise == 0)
@@ -691,7 +672,7 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
        }
 
 
-       IWL_DEBUG_STATS("Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n",
+       IWL_DEBUG_STATS(priv, "Rssi %d noise %d qual %d sig_avg %d noise_diff %d\n",
                        rx_status.signal, rx_status.noise, rx_status.qual,
                        rx_stats_sig_avg, rx_stats_noise_diff);
 
@@ -699,17 +680,14 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
 
        network_packet = iwl3945_is_network_packet(priv, header);
 
-       IWL_DEBUG_STATS_LIMIT("[%c] %d RSSI:%d Signal:%u, Noise:%u, Rate:%u\n",
+       IWL_DEBUG_STATS_LIMIT(priv, "[%c] %d RSSI:%d Signal:%u, Noise:%u, Rate:%u\n",
                              network_packet ? '*' : ' ',
                              le16_to_cpu(rx_hdr->channel),
                              rx_status.signal, rx_status.signal,
                              rx_status.noise, rx_status.rate_idx);
 
-#ifdef CONFIG_IWL3945_DEBUG
-       if (iwl3945_debug_level & (IWL_DL_RX))
-               /* Set "1" to report good data frames in groups of 100 */
-               iwl3945_dbg_report_frame(priv, pkt, header, 1);
-#endif
+       /* Set "1" to report good data frames in groups of 100 */
+       iwl3945_dbg_report_frame(priv, pkt, header, 1);
 
        if (network_packet) {
                priv->last_beacon_time = le32_to_cpu(rx_end->beacon_timestamp);
@@ -721,24 +699,31 @@ static void iwl3945_rx_reply_rx(struct iwl3945_priv *priv,
        iwl3945_pass_packet_to_mac80211(priv, rxb, &rx_status);
 }
 
-int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *ptr,
-                                dma_addr_t addr, u16 len)
+int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
+                                    struct iwl_tx_queue *txq,
+                                    dma_addr_t addr, u16 len, u8 reset, u8 pad)
 {
        int count;
-       u32 pad;
-       struct iwl3945_tfd_frame *tfd = (struct iwl3945_tfd_frame *)ptr;
+       struct iwl_queue *q;
+       struct iwl3945_tfd *tfd, *tfd_tmp;
+
+       q = &txq->q;
+       tfd_tmp = (struct iwl3945_tfd *)txq->tfds;
+       tfd = &tfd_tmp[q->write_ptr];
+
+       if (reset)
+               memset(tfd, 0, sizeof(*tfd));
 
        count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
-       pad = TFD_CTL_PAD_GET(le32_to_cpu(tfd->control_flags));
 
        if ((count >= NUM_TFD_CHUNKS) || (count < 0)) {
-               IWL_ERROR("Error can not send more than %d chunks\n",
+               IWL_ERR(priv, "Error can not send more than %d chunks\n",
                          NUM_TFD_CHUNKS);
                return -EINVAL;
        }
 
-       tfd->pa[count].addr = cpu_to_le32(addr);
-       tfd->pa[count].len = cpu_to_le32(len);
+       tfd->tbs[count].addr = cpu_to_le32(addr);
+       tfd->tbs[count].len = cpu_to_le32(len);
 
        count++;
 
@@ -753,10 +738,10 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *ptr,
  *
  * Does NOT advance any indexes
  */
-int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
+void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
 {
-       struct iwl3945_tfd_frame *bd_tmp = (struct iwl3945_tfd_frame *)&txq->bd[0];
-       struct iwl3945_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
+       struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)txq->tfds;
+       struct iwl3945_tfd *tfd = &tfd_tmp[txq->q.read_ptr];
        struct pci_dev *dev = priv->pci_dev;
        int i;
        int counter;
@@ -764,21 +749,21 @@ int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *
        /* classify bd */
        if (txq->q.id == IWL_CMD_QUEUE_NUM)
                /* nothing to cleanup after for host commands */
-               return 0;
+               return;
 
        /* sanity check */
-       counter = TFD_CTL_COUNT_GET(le32_to_cpu(bd->control_flags));
+       counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
        if (counter > NUM_TFD_CHUNKS) {
-               IWL_ERROR("Too many chunks: %i\n", counter);
+               IWL_ERR(priv, "Too many chunks: %i\n", counter);
                /* @todo issue fatal error, it is quite serious situation */
-               return 0;
+               return;
        }
 
        /* unmap chunks if any */
 
        for (i = 1; i < counter; i++) {
-               pci_unmap_single(dev, le32_to_cpu(bd->pa[i].addr),
-                                le32_to_cpu(bd->pa[i].len), PCI_DMA_TODEVICE);
+               pci_unmap_single(dev, le32_to_cpu(tfd->tbs[i].addr),
+                        le32_to_cpu(tfd->tbs[i].len), PCI_DMA_TODEVICE);
                if (txq->txb[txq->q.read_ptr].skb[0]) {
                        struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[0];
                        if (txq->txb[txq->q.read_ptr].skb[0]) {
@@ -788,10 +773,10 @@ int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *
                        }
                }
        }
-       return 0;
+       return ;
 }
 
-u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr)
+u8 iwl3945_hw_find_station(struct iwl_priv *priv, const u8 *addr)
 {
        int i, start = IWL_AP_ID;
        int ret = IWL_INVALID_STATION;
@@ -802,18 +787,18 @@ u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr)
                start = IWL_STA_ID;
 
        if (is_broadcast_ether_addr(addr))
-               return priv->hw_setting.bcast_sta_id;
+               return priv->hw_params.bcast_sta_id;
 
        spin_lock_irqsave(&priv->sta_lock, flags);
-       for (i = start; i < priv->hw_setting.max_stations; i++)
-               if ((priv->stations[i].used) &&
+       for (i = start; i < priv->hw_params.max_stations; i++)
+               if ((priv->stations_39[i].used) &&
                    (!compare_ether_addr
-                    (priv->stations[i].sta.sta.addr, addr))) {
+                    (priv->stations_39[i].sta.sta.addr, addr))) {
                        ret = i;
                        goto out;
                }
 
-       IWL_DEBUG_INFO("can not find STA %pM (total %d)\n",
+       IWL_DEBUG_INFO(priv, "can not find STA %pM (total %d)\n",
                       addr, priv->num_stations);
  out:
        spin_unlock_irqrestore(&priv->sta_lock, flags);
@@ -824,12 +809,10 @@ u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *addr)
  * iwl3945_hw_build_tx_cmd_rate - Add rate portion to TX_CMD:
  *
 */
-void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
-                             struct iwl3945_cmd *cmd,
+void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, struct iwl_cmd *cmd,
                              struct ieee80211_tx_info *info,
                              struct ieee80211_hdr *hdr, int sta_id, int tx_id)
 {
-       unsigned long flags;
        u16 hw_value = ieee80211_get_tx_rate(priv->hw, info)->hw_value;
        u16 rate_index = min(hw_value & 0xffff, IWL_RATE_COUNT - 1);
        u16 rate_mask;
@@ -838,25 +821,15 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
        u8 data_retry_limit;
        __le32 tx_flags;
        __le16 fc = hdr->frame_control;
+       struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
 
        rate = iwl3945_rates[rate_index].plcp;
-       tx_flags = cmd->cmd.tx.tx_flags;
+       tx_flags = tx->tx_flags;
 
        /* We need to figure out how to get the sta->supp_rates while
         * in this running context */
        rate_mask = IWL_RATES_MASK;
 
-       spin_lock_irqsave(&priv->sta_lock, flags);
-
-       priv->stations[sta_id].current_rate.rate_n_flags = rate;
-
-       if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
-           (sta_id != priv->hw_setting.bcast_sta_id) &&
-               (sta_id != IWL_MULTICAST_ID))
-               priv->stations[IWL_STA_ID].current_rate.rate_n_flags = rate;
-
-       spin_unlock_irqrestore(&priv->sta_lock, flags);
-
        if (tx_id >= IWL_CMD_QUEUE_NUM)
                rts_retry_limit = 3;
        else
@@ -888,25 +861,25 @@ void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
                }
        }
 
-       cmd->cmd.tx.rts_retry_limit = rts_retry_limit;
-       cmd->cmd.tx.data_retry_limit = data_retry_limit;
-       cmd->cmd.tx.rate = rate;
-       cmd->cmd.tx.tx_flags = tx_flags;
+       tx->rts_retry_limit = rts_retry_limit;
+       tx->data_retry_limit = data_retry_limit;
+       tx->rate = rate;
+       tx->tx_flags = tx_flags;
 
        /* OFDM */
-       cmd->cmd.tx.supp_rates[0] =
+       tx->supp_rates[0] =
           ((rate_mask & IWL_OFDM_RATES_MASK) >> IWL_FIRST_OFDM_RATE) & 0xFF;
 
        /* CCK */
-       cmd->cmd.tx.supp_rates[1] = (rate_mask & 0xF);
+       tx->supp_rates[1] = (rate_mask & 0xF);
 
-       IWL_DEBUG_RATE("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X "
+       IWL_DEBUG_RATE(priv, "Tx sta id: %d, rate: %d (plcp), flags: 0x%4X "
                       "cck/ofdm mask: 0x%x/0x%x\n", sta_id,
-                      cmd->cmd.tx.rate, le32_to_cpu(cmd->cmd.tx.tx_flags),
-                      cmd->cmd.tx.supp_rates[1], cmd->cmd.tx.supp_rates[0]);
+                      tx->rate, le32_to_cpu(tx->tx_flags),
+                      tx->supp_rates[1], tx->supp_rates[0]);
 }
 
-u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, u16 tx_rate, u8 flags)
+u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id, u16 tx_rate, u8 flags)
 {
        unsigned long flags_spin;
        struct iwl3945_station_entry *station;
@@ -915,138 +888,133 @@ u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, u16 tx_rate, u8 flags
                return IWL_INVALID_STATION;
 
        spin_lock_irqsave(&priv->sta_lock, flags_spin);
-       station = &priv->stations[sta_id];
+       station = &priv->stations_39[sta_id];
 
        station->sta.sta.modify_mask = STA_MODIFY_TX_RATE_MSK;
        station->sta.rate_n_flags = cpu_to_le16(tx_rate);
-       station->current_rate.rate_n_flags = tx_rate;
        station->sta.mode = STA_CONTROL_MODIFY_MSK;
 
        spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
 
-       iwl3945_send_add_station(priv, &station->sta, flags);
-       IWL_DEBUG_RATE("SCALE sync station %d to rate %d\n",
+       iwl_send_add_sta(priv,
+                        (struct iwl_addsta_cmd *)&station->sta, flags);
+       IWL_DEBUG_RATE(priv, "SCALE sync station %d to rate %d\n",
                        sta_id, tx_rate);
        return sta_id;
 }
 
-static int iwl3945_nic_set_pwr_src(struct iwl3945_priv *priv, int pwr_max)
+static int iwl3945_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
 {
-       int rc;
+       int ret;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
-       rc = iwl3945_grab_nic_access(priv);
-       if (rc) {
+       ret = iwl_grab_nic_access(priv);
+       if (ret) {
                spin_unlock_irqrestore(&priv->lock, flags);
-               return rc;
+               return ret;
        }
 
-       if (!pwr_max) {
-               u32 val;
-
-               rc = pci_read_config_dword(priv->pci_dev,
-                               PCI_POWER_SOURCE, &val);
-               if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT) {
-                       iwl3945_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+       if (src == IWL_PWR_SRC_VAUX) {
+               if (pci_pme_capable(priv->pci_dev, PCI_D3cold)) {
+                       iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
                                        APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
                                        ~APMG_PS_CTRL_MSK_PWR_SRC);
-                       iwl3945_release_nic_access(priv);
+                       iwl_release_nic_access(priv);
 
-                       iwl3945_poll_bit(priv, CSR_GPIO_IN,
+                       iwl_poll_bit(priv, CSR_GPIO_IN,
                                     CSR_GPIO_IN_VAL_VAUX_PWR_SRC,
                                     CSR_GPIO_IN_BIT_AUX_POWER, 5000);
-               } else
-                       iwl3945_release_nic_access(priv);
+               } else {
+                       iwl_release_nic_access(priv);
+               }
        } else {
-               iwl3945_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
+               iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
                                APMG_PS_CTRL_VAL_PWR_SRC_VMAIN,
                                ~APMG_PS_CTRL_MSK_PWR_SRC);
 
-               iwl3945_release_nic_access(priv);
-               iwl3945_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC,
+               iwl_release_nic_access(priv);
+               iwl_poll_bit(priv, CSR_GPIO_IN, CSR_GPIO_IN_VAL_VMAIN_PWR_SRC,
                             CSR_GPIO_IN_BIT_AUX_POWER, 5000);  /* uS */
        }
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       return rc;
+       return ret;
 }
 
-static int iwl3945_rx_init(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
+static int iwl3945_rx_init(struct iwl_priv *priv, struct iwl_rx_queue *rxq)
 {
        int rc;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
                spin_unlock_irqrestore(&priv->lock, flags);
                return rc;
        }
 
-       iwl3945_write_direct32(priv, FH_RCSR_RBD_BASE(0), rxq->dma_addr);
-       iwl3945_write_direct32(priv, FH_RCSR_RPTR_ADDR(0),
-                            priv->hw_setting.shared_phys +
-                            offsetof(struct iwl3945_shared, rx_read_ptr[0]));
-       iwl3945_write_direct32(priv, FH_RCSR_WPTR(0), 0);
-       iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0),
-               ALM_FH_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE |
-               ALM_FH_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE |
-               ALM_FH_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN |
-               ALM_FH_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 |
-               (RX_QUEUE_SIZE_LOG << ALM_FH_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE) |
-               ALM_FH_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST |
-               (1 << ALM_FH_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH) |
-               ALM_FH_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH);
+       iwl_write_direct32(priv, FH39_RCSR_RBD_BASE(0), rxq->dma_addr);
+       iwl_write_direct32(priv, FH39_RCSR_RPTR_ADDR(0), rxq->rb_stts_dma);
+       iwl_write_direct32(priv, FH39_RCSR_WPTR(0), 0);
+       iwl_write_direct32(priv, FH39_RCSR_CONFIG(0),
+               FH39_RCSR_RX_CONFIG_REG_VAL_DMA_CHNL_EN_ENABLE |
+               FH39_RCSR_RX_CONFIG_REG_VAL_RDRBD_EN_ENABLE |
+               FH39_RCSR_RX_CONFIG_REG_BIT_WR_STTS_EN |
+               FH39_RCSR_RX_CONFIG_REG_VAL_MAX_FRAG_SIZE_128 |
+               (RX_QUEUE_SIZE_LOG << FH39_RCSR_RX_CONFIG_REG_POS_RBDC_SIZE) |
+               FH39_RCSR_RX_CONFIG_REG_VAL_IRQ_DEST_INT_HOST |
+               (1 << FH39_RCSR_RX_CONFIG_REG_POS_IRQ_RBTH) |
+               FH39_RCSR_RX_CONFIG_REG_VAL_MSG_MODE_FH);
 
        /* fake read to flush all prev I/O */
-       iwl3945_read_direct32(priv, FH_RSSR_CTRL);
+       iwl_read_direct32(priv, FH39_RSSR_CTRL);
 
-       iwl3945_release_nic_access(priv);
+       iwl_release_nic_access(priv);
        spin_unlock_irqrestore(&priv->lock, flags);
 
        return 0;
 }
 
-static int iwl3945_tx_reset(struct iwl3945_priv *priv)
+static int iwl3945_tx_reset(struct iwl_priv *priv)
 {
        int rc;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
                spin_unlock_irqrestore(&priv->lock, flags);
                return rc;
        }
 
        /* bypass mode */
-       iwl3945_write_prph(priv, ALM_SCD_MODE_REG, 0x2);
+       iwl_write_prph(priv, ALM_SCD_MODE_REG, 0x2);
 
        /* RA 0 is active */
-       iwl3945_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01);
+       iwl_write_prph(priv, ALM_SCD_ARASTAT_REG, 0x01);
 
        /* all 6 fifo are active */
-       iwl3945_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f);
-
-       iwl3945_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
-       iwl3945_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
-       iwl3945_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004);
-       iwl3945_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
-
-       iwl3945_write_direct32(priv, FH_TSSR_CBB_BASE,
-                            priv->hw_setting.shared_phys);
-
-       iwl3945_write_direct32(priv, FH_TSSR_MSG_CONFIG,
-               ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON |
-               ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON |
-               ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B |
-               ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON |
-               ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON |
-               ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH |
-               ALM_FH_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH);
-
-       iwl3945_release_nic_access(priv);
+       iwl_write_prph(priv, ALM_SCD_TXFACT_REG, 0x3f);
+
+       iwl_write_prph(priv, ALM_SCD_SBYP_MODE_1_REG, 0x010000);
+       iwl_write_prph(priv, ALM_SCD_SBYP_MODE_2_REG, 0x030002);
+       iwl_write_prph(priv, ALM_SCD_TXF4MF_REG, 0x000004);
+       iwl_write_prph(priv, ALM_SCD_TXF5MF_REG, 0x000005);
+
+       iwl_write_direct32(priv, FH39_TSSR_CBB_BASE,
+                            priv->shared_phys);
+
+       iwl_write_direct32(priv, FH39_TSSR_MSG_CONFIG,
+               FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TXPD_ON |
+               FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_TXPD_ON |
+               FH39_TSSR_TX_MSG_CONFIG_REG_VAL_MAX_FRAG_SIZE_128B |
+               FH39_TSSR_TX_MSG_CONFIG_REG_VAL_SNOOP_RD_TFD_ON |
+               FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RD_CBB_ON |
+               FH39_TSSR_TX_MSG_CONFIG_REG_VAL_ORDER_RSP_WAIT_TH |
+               FH39_TSSR_TX_MSG_CONFIG_REG_VAL_RSP_WAIT_TH);
+
+       iwl_release_nic_access(priv);
        spin_unlock_irqrestore(&priv->lock, flags);
 
        return 0;
@@ -1057,7 +1025,7 @@ static int iwl3945_tx_reset(struct iwl3945_priv *priv)
  *
  * Destroys all DMA structures and initialize them again
  */
-static int iwl3945_txq_ctx_reset(struct iwl3945_priv *priv)
+static int iwl3945_txq_ctx_reset(struct iwl_priv *priv)
 {
        int rc;
        int txq_id, slots_num;
@@ -1073,10 +1041,10 @@ static int iwl3945_txq_ctx_reset(struct iwl3945_priv *priv)
        for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
                slots_num = (txq_id == IWL_CMD_QUEUE_NUM) ?
                                TFD_CMD_SLOTS : TFD_TX_CMD_SLOTS;
-               rc = iwl3945_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
-                               txq_id);
+               rc = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
+                                      txq_id);
                if (rc) {
-                       IWL_ERROR("Tx %d queue init failed\n", txq_id);
+                       IWL_ERR(priv, "Tx %d queue init failed\n", txq_id);
                        goto error;
                }
        }
@@ -1088,111 +1056,140 @@ static int iwl3945_txq_ctx_reset(struct iwl3945_priv *priv)
        return rc;
 }
 
-int iwl3945_hw_nic_init(struct iwl3945_priv *priv)
+static int iwl3945_apm_init(struct iwl_priv *priv)
 {
-       u8 rev_id;
-       int rc;
-       unsigned long flags;
-       struct iwl3945_rx_queue *rxq = &priv->rxq;
+       int ret = 0;
 
-       iwl3945_power_init_handle(priv);
+       iwl_power_initialize(priv);
 
-       spin_lock_irqsave(&priv->lock, flags);
-       iwl3945_set_bit(priv, CSR_ANA_PLL_CFG, CSR39_ANA_PLL_CFG_VAL);
-       iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS,
-                   CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
-
-       iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
-       rc = iwl3945_poll_direct_bit(priv, CSR_GP_CNTRL,
-                       CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
-       if (rc < 0) {
-               spin_unlock_irqrestore(&priv->lock, flags);
-               IWL_DEBUG_INFO("Failed to init the card\n");
-               return rc;
-       }
+       iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
+                         CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
 
-       rc = iwl3945_grab_nic_access(priv);
-       if (rc) {
-               spin_unlock_irqrestore(&priv->lock, flags);
-               return rc;
+       /* disable L0s without affecting L1 :don't wait for ICH L0s bug W/A) */
+       iwl_set_bit(priv, CSR_GIO_CHICKEN_BITS,
+                         CSR_GIO_CHICKEN_BITS_REG_BIT_L1A_NO_L0S_RX);
+
+       /* set "initialization complete" bit to move adapter
+       * D0U* --> D0A* state */
+       iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+
+       iwl_poll_direct_bit(priv, CSR_GP_CNTRL,
+                           CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
+       if (ret < 0) {
+               IWL_DEBUG_INFO(priv, "Failed to init the card\n");
+               goto out;
        }
-       iwl3945_write_prph(priv, APMG_CLK_EN_REG,
-                                APMG_CLK_VAL_DMA_CLK_RQT |
-                                APMG_CLK_VAL_BSM_CLK_RQT);
+
+       ret = iwl_grab_nic_access(priv);
+       if (ret)
+               goto out;
+
+       /* enable DMA */
+       iwl_write_prph(priv, APMG_CLK_CTRL_REG, APMG_CLK_VAL_DMA_CLK_RQT |
+                                               APMG_CLK_VAL_BSM_CLK_RQT);
+
        udelay(20);
-       iwl3945_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
-                                   APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
-       iwl3945_release_nic_access(priv);
-       spin_unlock_irqrestore(&priv->lock, flags);
 
-       /* Determine HW type */
-       rc = pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id);
-       if (rc)
-               return rc;
-       IWL_DEBUG_INFO("HW Revision ID = 0x%X\n", rev_id);
+       /* disable L1-Active */
+       iwl_set_bits_prph(priv, APMG_PCIDEV_STT_REG,
+                         APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
+
+       iwl_release_nic_access(priv);
+out:
+       return ret;
+}
+
+static void iwl3945_nic_config(struct iwl_priv *priv)
+{
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
+       unsigned long flags;
+       u8 rev_id = 0;
 
-       iwl3945_nic_set_pwr_src(priv, 1);
        spin_lock_irqsave(&priv->lock, flags);
 
        if (rev_id & PCI_CFG_REV_ID_BIT_RTP)
-               IWL_DEBUG_INFO("RTP type \n");
+               IWL_DEBUG_INFO(priv, "RTP type \n");
        else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) {
-               IWL_DEBUG_INFO("3945 RADIO-MB type\n");
-               iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               IWL_DEBUG_INFO(priv, "3945 RADIO-MB type\n");
+               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BIT_3945_MB);
        } else {
-               IWL_DEBUG_INFO("3945 RADIO-MM type\n");
-               iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               IWL_DEBUG_INFO(priv, "3945 RADIO-MM type\n");
+               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BIT_3945_MM);
        }
 
-       if (EEPROM_SKU_CAP_OP_MODE_MRC == priv->eeprom.sku_cap) {
-               IWL_DEBUG_INFO("SKU OP mode is mrc\n");
-               iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+       if (EEPROM_SKU_CAP_OP_MODE_MRC == eeprom->sku_cap) {
+               IWL_DEBUG_INFO(priv, "SKU OP mode is mrc\n");
+               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BIT_SKU_MRC);
        } else
-               IWL_DEBUG_INFO("SKU OP mode is basic\n");
+               IWL_DEBUG_INFO(priv, "SKU OP mode is basic\n");
 
-       if ((priv->eeprom.board_revision & 0xF0) == 0xD0) {
-               IWL_DEBUG_INFO("3945ABG revision is 0x%X\n",
-                              priv->eeprom.board_revision);
-               iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+       if ((eeprom->board_revision & 0xF0) == 0xD0) {
+               IWL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n",
+                              eeprom->board_revision);
+               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
        } else {
-               IWL_DEBUG_INFO("3945ABG revision is 0x%X\n",
-                              priv->eeprom.board_revision);
-               iwl3945_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
+               IWL_DEBUG_INFO(priv, "3945ABG revision is 0x%X\n",
+                              eeprom->board_revision);
+               iwl_clear_bit(priv, CSR_HW_IF_CONFIG_REG,
                              CSR39_HW_IF_CONFIG_REG_BIT_BOARD_TYPE);
        }
 
-       if (priv->eeprom.almgor_m_version <= 1) {
-               iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+       if (eeprom->almgor_m_version <= 1) {
+               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_A);
-               IWL_DEBUG_INFO("Card M type A version is 0x%X\n",
-                              priv->eeprom.almgor_m_version);
+               IWL_DEBUG_INFO(priv, "Card M type A version is 0x%X\n",
+                              eeprom->almgor_m_version);
        } else {
-               IWL_DEBUG_INFO("Card M type B version is 0x%X\n",
-                              priv->eeprom.almgor_m_version);
-               iwl3945_set_bit(priv, CSR_HW_IF_CONFIG_REG,
+               IWL_DEBUG_INFO(priv, "Card M type B version is 0x%X\n",
+                              eeprom->almgor_m_version);
+               iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                            CSR39_HW_IF_CONFIG_REG_BITS_SILICON_TYPE_B);
        }
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       if (priv->eeprom.sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE)
-               IWL_DEBUG_RF_KILL("SW RF KILL supported in EEPROM.\n");
+       if (eeprom->sku_cap & EEPROM_SKU_CAP_SW_RF_KILL_ENABLE)
+               IWL_DEBUG_RF_KILL(priv, "SW RF KILL supported in EEPROM.\n");
+
+       if (eeprom->sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE)
+               IWL_DEBUG_RF_KILL(priv, "HW RF KILL supported in EEPROM.\n");
+}
+
+int iwl3945_hw_nic_init(struct iwl_priv *priv)
+{
+       u8 rev_id;
+       int rc;
+       unsigned long flags;
+       struct iwl_rx_queue *rxq = &priv->rxq;
+
+       spin_lock_irqsave(&priv->lock, flags);
+       priv->cfg->ops->lib->apm_ops.init(priv);
+       spin_unlock_irqrestore(&priv->lock, flags);
+
+       /* Determine HW type */
+       rc = pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id);
+       if (rc)
+               return rc;
+       IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id);
+
+       rc = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN);
+       if(rc)
+               return rc;
 
-       if (priv->eeprom.sku_cap & EEPROM_SKU_CAP_HW_RF_KILL_ENABLE)
-               IWL_DEBUG_RF_KILL("HW RF KILL supported in EEPROM.\n");
+       priv->cfg->ops->lib->apm_ops.config(priv);
 
        /* Allocate the RX queue, or reset if it is already allocated */
        if (!rxq->bd) {
-               rc = iwl3945_rx_queue_alloc(priv);
+               rc = iwl_rx_queue_alloc(priv);
                if (rc) {
-                       IWL_ERROR("Unable to initialize Rx queue\n");
+                       IWL_ERR(priv, "Unable to initialize Rx queue\n");
                        return -ENOMEM;
                }
        } else
-               iwl3945_rx_queue_reset(priv, rxq);
+               iwl_rx_queue_reset(priv, rxq);
 
        iwl3945_rx_replenish(priv);
 
@@ -1202,16 +1199,16 @@ int iwl3945_hw_nic_init(struct iwl3945_priv *priv)
 
        /* Look at using this instead:
        rxq->need_update = 1;
-       iwl3945_rx_queue_update_write_ptr(priv, rxq);
+       iwl_rx_queue_update_write_ptr(priv, rxq);
        */
 
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
                spin_unlock_irqrestore(&priv->lock, flags);
                return rc;
        }
-       iwl3945_write_direct32(priv, FH_RCSR_WPTR(0), rxq->write & ~7);
-       iwl3945_release_nic_access(priv);
+       iwl_write_direct32(priv, FH39_RCSR_WPTR(0), rxq->write & ~7);
+       iwl_release_nic_access(priv);
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
@@ -1229,116 +1226,121 @@ int iwl3945_hw_nic_init(struct iwl3945_priv *priv)
  *
  * Destroy all TX DMA queues and structures
  */
-void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv)
+void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv)
 {
        int txq_id;
 
        /* Tx queues */
        for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++)
-               iwl3945_tx_queue_free(priv, &priv->txq[txq_id]);
+               iwl_tx_queue_free(priv, txq_id);
 }
 
-void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv)
+void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv)
 {
-       int queue;
+       int txq_id;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
-       if (iwl3945_grab_nic_access(priv)) {
+       if (iwl_grab_nic_access(priv)) {
                spin_unlock_irqrestore(&priv->lock, flags);
                iwl3945_hw_txq_ctx_free(priv);
                return;
        }
 
        /* stop SCD */
-       iwl3945_write_prph(priv, ALM_SCD_MODE_REG, 0);
+       iwl_write_prph(priv, ALM_SCD_MODE_REG, 0);
 
        /* reset TFD queues */
-       for (queue = TFD_QUEUE_MIN; queue < TFD_QUEUE_MAX; queue++) {
-               iwl3945_write_direct32(priv, FH_TCSR_CONFIG(queue), 0x0);
-               iwl3945_poll_direct_bit(priv, FH_TSSR_TX_STATUS,
-                               ALM_FH_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(queue),
+       for (txq_id = 0; txq_id < TFD_QUEUE_MAX; txq_id++) {
+               iwl_write_direct32(priv, FH39_TCSR_CONFIG(txq_id), 0x0);
+               iwl_poll_direct_bit(priv, FH39_TSSR_TX_STATUS,
+                               FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE(txq_id),
                                1000);
        }
 
-       iwl3945_release_nic_access(priv);
+       iwl_release_nic_access(priv);
        spin_unlock_irqrestore(&priv->lock, flags);
 
        iwl3945_hw_txq_ctx_free(priv);
 }
 
-int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv)
+static int iwl3945_apm_stop_master(struct iwl_priv *priv)
 {
-       int rc = 0;
-       u32 reg_val;
+       int ret = 0;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
 
        /* set stop master bit */
-       iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
+       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_STOP_MASTER);
 
-       reg_val = iwl3945_read32(priv, CSR_GP_CNTRL);
+       iwl_poll_direct_bit(priv, CSR_RESET,
+                           CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
 
-       if (CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE ==
-           (reg_val & CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE))
-               IWL_DEBUG_INFO("Card in power save, master is already "
-                              "stopped\n");
-       else {
-               rc = iwl3945_poll_direct_bit(priv, CSR_RESET,
-                                 CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
-               if (rc < 0) {
-                       spin_unlock_irqrestore(&priv->lock, flags);
-                       return rc;
-               }
-       }
+       if (ret < 0)
+               goto out;
 
+out:
        spin_unlock_irqrestore(&priv->lock, flags);
-       IWL_DEBUG_INFO("stop master\n");
+       IWL_DEBUG_INFO(priv, "stop master\n");
 
-       return rc;
+       return ret;
 }
 
-int iwl3945_hw_nic_reset(struct iwl3945_priv *priv)
+static void iwl3945_apm_stop(struct iwl_priv *priv)
+{
+       unsigned long flags;
+
+       iwl3945_apm_stop_master(priv);
+
+       spin_lock_irqsave(&priv->lock, flags);
+
+       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
+
+       udelay(10);
+       /* clear "init complete"  move adapter D0A* --> D0U state */
+       iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+       spin_unlock_irqrestore(&priv->lock, flags);
+}
+
+static int iwl3945_apm_reset(struct iwl_priv *priv)
 {
        int rc;
        unsigned long flags;
 
-       iwl3945_hw_nic_stop_master(priv);
+       iwl3945_apm_stop_master(priv);
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
+       iwl_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
+       udelay(10);
+
+       iwl_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
 
-       iwl3945_poll_direct_bit(priv, CSR_GP_CNTRL,
+       iwl_poll_direct_bit(priv, CSR_GP_CNTRL,
                         CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
 
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (!rc) {
-               iwl3945_write_prph(priv, APMG_CLK_CTRL_REG,
+               iwl_write_prph(priv, APMG_CLK_CTRL_REG,
                                         APMG_CLK_VAL_BSM_CLK_RQT);
 
-               udelay(10);
-
-               iwl3945_set_bit(priv, CSR_GP_CNTRL,
-                           CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
-
-               iwl3945_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0);
-               iwl3945_write_prph(priv, APMG_RTC_INT_STT_REG,
+               iwl_write_prph(priv, APMG_RTC_INT_MSK_REG, 0x0);
+               iwl_write_prph(priv, APMG_RTC_INT_STT_REG,
                                        0xFFFFFFFF);
 
                /* enable DMA */
-               iwl3945_write_prph(priv, APMG_CLK_EN_REG,
+               iwl_write_prph(priv, APMG_CLK_EN_REG,
                                         APMG_CLK_VAL_DMA_CLK_RQT |
                                         APMG_CLK_VAL_BSM_CLK_RQT);
                udelay(10);
 
-               iwl3945_set_bits_prph(priv, APMG_PS_CTRL_REG,
+               iwl_set_bits_prph(priv, APMG_PS_CTRL_REG,
                                APMG_PS_CTRL_VAL_RESET_REQ);
                udelay(5);
-               iwl3945_clear_bits_prph(priv, APMG_PS_CTRL_REG,
+               iwl_clear_bits_prph(priv, APMG_PS_CTRL_REG,
                                APMG_PS_CTRL_VAL_RESET_REQ);
-               iwl3945_release_nic_access(priv);
+               iwl_release_nic_access(priv);
        }
 
        /* Clear the 'host command active' bit... */
@@ -1367,33 +1369,34 @@ static inline int iwl3945_hw_reg_temp_out_of_range(int temperature)
        return ((temperature < -260) || (temperature > 25)) ? 1 : 0;
 }
 
-int iwl3945_hw_get_temperature(struct iwl3945_priv *priv)
+int iwl3945_hw_get_temperature(struct iwl_priv *priv)
 {
-       return iwl3945_read32(priv, CSR_UCODE_DRV_GP2);
+       return iwl_read32(priv, CSR_UCODE_DRV_GP2);
 }
 
 /**
  * iwl3945_hw_reg_txpower_get_temperature
  * get the current temperature by reading from NIC
 */
-static int iwl3945_hw_reg_txpower_get_temperature(struct iwl3945_priv *priv)
+static int iwl3945_hw_reg_txpower_get_temperature(struct iwl_priv *priv)
 {
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
        int temperature;
 
        temperature = iwl3945_hw_get_temperature(priv);
 
        /* driver's okay range is -260 to +25.
         *   human readable okay range is 0 to +285 */
-       IWL_DEBUG_INFO("Temperature: %d\n", temperature + IWL_TEMP_CONVERT);
+       IWL_DEBUG_INFO(priv, "Temperature: %d\n", temperature + IWL_TEMP_CONVERT);
 
        /* handle insane temp reading */
        if (iwl3945_hw_reg_temp_out_of_range(temperature)) {
-               IWL_ERROR("Error bad temperature value  %d\n", temperature);
+               IWL_ERR(priv, "Error bad temperature value  %d\n", temperature);
 
                /* if really really hot(?),
                 *   substitute the 3rd band/group's temp measured at factory */
                if (priv->last_temperature > 100)
-                       temperature = priv->eeprom.groups[2].temperature;
+                       temperature = eeprom->groups[2].temperature;
                else /* else use most recent "sane" value from driver */
                        temperature = priv->last_temperature;
        }
@@ -1412,7 +1415,7 @@ static int iwl3945_hw_reg_txpower_get_temperature(struct iwl3945_priv *priv)
  * records new temperature in tx_mgr->temperature.
  * replaces tx_mgr->last_temperature *only* if calib needed
  *    (assumes caller will actually do the calibration!). */
-static int is_temp_calib_needed(struct iwl3945_priv *priv)
+static int is_temp_calib_needed(struct iwl_priv *priv)
 {
        int temp_diff;
 
@@ -1421,20 +1424,20 @@ static int is_temp_calib_needed(struct iwl3945_priv *priv)
 
        /* get absolute value */
        if (temp_diff < 0) {
-               IWL_DEBUG_POWER("Getting cooler, delta %d,\n", temp_diff);
+               IWL_DEBUG_POWER(priv, "Getting cooler, delta %d,\n", temp_diff);
                temp_diff = -temp_diff;
        } else if (temp_diff == 0)
-               IWL_DEBUG_POWER("Same temp,\n");
+               IWL_DEBUG_POWER(priv, "Same temp,\n");
        else
-               IWL_DEBUG_POWER("Getting warmer, delta %d,\n", temp_diff);
+               IWL_DEBUG_POWER(priv, "Getting warmer, delta %d,\n", temp_diff);
 
        /* if we don't need calibration, *don't* update last_temperature */
        if (temp_diff < IWL_TEMPERATURE_LIMIT_TIMER) {
-               IWL_DEBUG_POWER("Timed thermal calib not needed\n");
+               IWL_DEBUG_POWER(priv, "Timed thermal calib not needed\n");
                return 0;
        }
 
-       IWL_DEBUG_POWER("Timed thermal calib needed\n");
+       IWL_DEBUG_POWER(priv, "Timed thermal calib needed\n");
 
        /* assume that caller will actually do calib ...
         *   update the "last temperature" value */
@@ -1627,9 +1630,9 @@ static inline u8 iwl3945_hw_reg_fix_power_index(int index)
  * Set (in our channel info database) the direct scan Tx power for 1 Mbit (CCK)
  * or 6 Mbit (OFDM) rates.
  */
-static void iwl3945_hw_reg_set_scan_power(struct iwl3945_priv *priv, u32 scan_tbl_index,
+static void iwl3945_hw_reg_set_scan_power(struct iwl_priv *priv, u32 scan_tbl_index,
                               s32 rate_index, const s8 *clip_pwrs,
-                              struct iwl3945_channel_info *ch_info,
+                              struct iwl_channel_info *ch_info,
                               int band_index)
 {
        struct iwl3945_scan_power_info *scan_power_info;
@@ -1646,7 +1649,7 @@ static void iwl3945_hw_reg_set_scan_power(struct iwl3945_priv *priv, u32 scan_tb
        /* further limit to user's max power preference.
         * FIXME:  Other spectrum management power limitations do not
         *   seem to apply?? */
-       power = min(power, priv->user_txpower_limit);
+       power = min(power, priv->tx_power_user_lmt);
        scan_power_info->requested_power = power;
 
        /* find difference between new scan *power* and current "normal"
@@ -1678,32 +1681,32 @@ static void iwl3945_hw_reg_set_scan_power(struct iwl3945_priv *priv, u32 scan_tb
 }
 
 /**
- * iwl3945_hw_reg_send_txpower - fill in Tx Power command with gain settings
+ * iwl3945_send_tx_power - fill in Tx Power command with gain settings
  *
  * Configures power settings for all rates for the current channel,
  * using values from channel info struct, and send to NIC
  */
-int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv)
+static int iwl3945_send_tx_power(struct iwl_priv *priv)
 {
        int rate_idx, i;
-       const struct iwl3945_channel_info *ch_info = NULL;
+       const struct iwl_channel_info *ch_info = NULL;
        struct iwl3945_txpowertable_cmd txpower = {
                .channel = priv->active_rxon.channel,
        };
 
        txpower.band = (priv->band == IEEE80211_BAND_5GHZ) ? 0 : 1;
-       ch_info = iwl3945_get_channel_info(priv,
+       ch_info = iwl_get_channel_info(priv,
                                       priv->band,
                                       le16_to_cpu(priv->active_rxon.channel));
        if (!ch_info) {
-               IWL_ERROR
-                   ("Failed to get channel info for channel %d [%d]\n",
-                    le16_to_cpu(priv->active_rxon.channel), priv->band);
+               IWL_ERR(priv,
+                       "Failed to get channel info for channel %d [%d]\n",
+                       le16_to_cpu(priv->active_rxon.channel), priv->band);
                return -EINVAL;
        }
 
        if (!is_channel_valid(ch_info)) {
-               IWL_DEBUG_POWER("Not calling TX_PWR_TABLE_CMD on "
+               IWL_DEBUG_POWER(priv, "Not calling TX_PWR_TABLE_CMD on "
                                "non-Tx channel.\n");
                return 0;
        }
@@ -1711,12 +1714,12 @@ int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv)
        /* fill cmd with power settings for all rates for current channel */
        /* Fill OFDM rate */
        for (rate_idx = IWL_FIRST_OFDM_RATE, i = 0;
-            rate_idx <= IWL_LAST_OFDM_RATE; rate_idx++, i++) {
+            rate_idx <= IWL39_LAST_OFDM_RATE; rate_idx++, i++) {
 
                txpower.power[i].tpc = ch_info->power_info[i].tpc;
                txpower.power[i].rate = iwl3945_rates[rate_idx].plcp;
 
-               IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
+               IWL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
                                le16_to_cpu(txpower.channel),
                                txpower.band,
                                txpower.power[i].tpc.tx_gain,
@@ -1729,7 +1732,7 @@ int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv)
                txpower.power[i].tpc = ch_info->power_info[i].tpc;
                txpower.power[i].rate = iwl3945_rates[rate_idx].plcp;
 
-               IWL_DEBUG_POWER("ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
+               IWL_DEBUG_POWER(priv, "ch %d:%d rf %d dsp %3d rate code 0x%02x\n",
                                le16_to_cpu(txpower.channel),
                                txpower.band,
                                txpower.power[i].tpc.tx_gain,
@@ -1737,8 +1740,9 @@ int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv)
                                txpower.power[i].rate);
        }
 
-       return iwl3945_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
-                       sizeof(struct iwl3945_txpowertable_cmd), &txpower);
+       return iwl_send_cmd_pdu(priv, REPLY_TX_PWR_TABLE_CMD,
+                               sizeof(struct iwl3945_txpowertable_cmd),
+                               &txpower);
 
 }
 
@@ -1758,8 +1762,8 @@ int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv)
  *      properly fill out the scan powers, and actual h/w gain settings,
  *      and send changes to NIC
  */
-static int iwl3945_hw_reg_set_new_power(struct iwl3945_priv *priv,
-                            struct iwl3945_channel_info *ch_info)
+static int iwl3945_hw_reg_set_new_power(struct iwl_priv *priv,
+                            struct iwl_channel_info *ch_info)
 {
        struct iwl3945_channel_power_info *power_info;
        int power_changed = 0;
@@ -1768,7 +1772,7 @@ static int iwl3945_hw_reg_set_new_power(struct iwl3945_priv *priv,
        int power;
 
        /* Get this chnlgrp's rate-to-max/clip-powers table */
-       clip_pwrs = priv->clip_groups[ch_info->group_index].clip_powers;
+       clip_pwrs = priv->clip39_groups[ch_info->group_index].clip_powers;
 
        /* Get this channel's rate-to-current-power settings table */
        power_info = ch_info->power_info;
@@ -1821,7 +1825,7 @@ static int iwl3945_hw_reg_set_new_power(struct iwl3945_priv *priv,
  *      based strictly on regulatory (eeprom and spectrum mgt) limitations
  *      (no consideration for h/w clipping limitations).
  */
-static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl3945_channel_info *ch_info)
+static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl_channel_info *ch_info)
 {
        s8 max_power;
 
@@ -1849,9 +1853,10 @@ static int iwl3945_hw_reg_get_ch_txpower_limit(struct iwl3945_channel_info *ch_i
  *
  * If RxOn is "associated", this sends the new Txpower to NIC!
  */
-static int iwl3945_hw_reg_comp_txpower_temp(struct iwl3945_priv *priv)
+static int iwl3945_hw_reg_comp_txpower_temp(struct iwl_priv *priv)
 {
-       struct iwl3945_channel_info *ch_info = NULL;
+       struct iwl_channel_info *ch_info = NULL;
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
        int delta_index;
        const s8 *clip_pwrs; /* array of h/w max power levels for each rate */
        u8 a_band;
@@ -1867,7 +1872,7 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl3945_priv *priv)
                a_band = is_channel_a_band(ch_info);
 
                /* Get this chnlgrp's factory calibration temperature */
-               ref_temp = (s16)priv->eeprom.groups[ch_info->group_index].
+               ref_temp = (s16)eeprom->groups[ch_info->group_index].
                    temperature;
 
                /* get power index adjustment based on current and factory
@@ -1893,7 +1898,7 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl3945_priv *priv)
                }
 
                /* Get this chnlgrp's rate-to-max/clip-powers table */
-               clip_pwrs = priv->clip_groups[ch_info->group_index].clip_powers;
+               clip_pwrs = priv->clip39_groups[ch_info->group_index].clip_powers;
 
                /* set scan tx power, 1Mbit for CCK, 6Mbit for OFDM */
                for (scan_tbl_index = 0;
@@ -1907,24 +1912,24 @@ static int iwl3945_hw_reg_comp_txpower_temp(struct iwl3945_priv *priv)
        }
 
        /* send Txpower command for current channel to ucode */
-       return iwl3945_hw_reg_send_txpower(priv);
+       return priv->cfg->ops->lib->send_tx_power(priv);
 }
 
-int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power)
+int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)
 {
-       struct iwl3945_channel_info *ch_info;
+       struct iwl_channel_info *ch_info;
        s8 max_power;
        u8 a_band;
        u8 i;
 
-       if (priv->user_txpower_limit == power) {
-               IWL_DEBUG_POWER("Requested Tx power same as current "
+       if (priv->tx_power_user_lmt == power) {
+               IWL_DEBUG_POWER(priv, "Requested Tx power same as current "
                                "limit: %ddBm.\n", power);
                return 0;
        }
 
-       IWL_DEBUG_POWER("Setting upper limit clamp to %ddBm.\n", power);
-       priv->user_txpower_limit = power;
+       IWL_DEBUG_POWER(priv, "Setting upper limit clamp to %ddBm.\n", power);
+       priv->tx_power_user_lmt = power;
 
        /* set up new Tx powers for each and every channel, 2.4 and 5.x */
 
@@ -1953,7 +1958,7 @@ int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power)
 }
 
 /* will add 3945 channel switch cmd handling later */
-int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel)
+int iwl3945_hw_channel_switch(struct iwl_priv *priv, u16 channel)
 {
        return 0;
 }
@@ -1968,7 +1973,7 @@ int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel)
  *     -- send new set of gain settings to NIC
  * NOTE:  This should continue working, even when we're not associated,
  *   so we can keep our internal table of scan powers current. */
-void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv)
+void iwl3945_reg_txpower_periodic(struct iwl_priv *priv)
 {
        /* This will kick in the "brute force"
         * iwl3945_hw_reg_comp_txpower_temp() below */
@@ -1987,7 +1992,7 @@ void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv)
 
 static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
 {
-       struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv,
+       struct iwl_priv *priv = container_of(work, struct iwl_priv,
                                             thermal_periodic.work);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -2009,10 +2014,11 @@ static void iwl3945_bg_reg_txpower_periodic(struct work_struct *work)
  *      on A-band, EEPROM's "group frequency" entries represent the top
  *      channel in each group 1-4.  Group 5 All B/G channels are in group 0.
  */
-static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl3945_priv *priv,
-                                      const struct iwl3945_channel_info *ch_info)
+static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl_priv *priv,
+                                      const struct iwl_channel_info *ch_info)
 {
-       struct iwl3945_eeprom_txpower_group *ch_grp = &priv->eeprom.groups[0];
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
+       struct iwl3945_eeprom_txpower_group *ch_grp = &eeprom->groups[0];
        u8 group;
        u16 group_index = 0;    /* based on factory calib frequencies */
        u8 grp_channel;
@@ -2032,7 +2038,7 @@ static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl3945_priv *priv,
        } else
                group_index = 0;        /* 2.4 GHz, group 0 */
 
-       IWL_DEBUG_POWER("Chnl %d mapped to grp %d\n", ch_info->channel,
+       IWL_DEBUG_POWER(priv, "Chnl %d mapped to grp %d\n", ch_info->channel,
                        group_index);
        return group_index;
 }
@@ -2043,11 +2049,12 @@ static u16 iwl3945_hw_reg_get_ch_grp_index(struct iwl3945_priv *priv,
  * Interpolate to get nominal (i.e. at factory calibration temperature) index
  *   into radio/DSP gain settings table for requested power.
  */
-static int iwl3945_hw_reg_get_matched_power_index(struct iwl3945_priv *priv,
+static int iwl3945_hw_reg_get_matched_power_index(struct iwl_priv *priv,
                                       s8 requested_power,
                                       s32 setting_index, s32 *new_index)
 {
        const struct iwl3945_eeprom_txpower_group *chnl_grp = NULL;
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
        s32 index0, index1;
        s32 power = 2 * requested_power;
        s32 i;
@@ -2056,7 +2063,7 @@ static int iwl3945_hw_reg_get_matched_power_index(struct iwl3945_priv *priv,
        s32 res;
        s32 denominator;
 
-       chnl_grp = &priv->eeprom.groups[setting_index];
+       chnl_grp = &eeprom->groups[setting_index];
        samples = chnl_grp->samples;
        for (i = 0; i < 5; i++) {
                if (power == samples[i].power) {
@@ -2091,22 +2098,23 @@ static int iwl3945_hw_reg_get_matched_power_index(struct iwl3945_priv *priv,
        return 0;
 }
 
-static void iwl3945_hw_reg_init_channel_groups(struct iwl3945_priv *priv)
+static void iwl3945_hw_reg_init_channel_groups(struct iwl_priv *priv)
 {
        u32 i;
        s32 rate_index;
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
        const struct iwl3945_eeprom_txpower_group *group;
 
-       IWL_DEBUG_POWER("Initializing factory calib info from EEPROM\n");
+       IWL_DEBUG_POWER(priv, "Initializing factory calib info from EEPROM\n");
 
        for (i = 0; i < IWL_NUM_TX_CALIB_GROUPS; i++) {
                s8 *clip_pwrs;  /* table of power levels for each rate */
                s8 satur_pwr;   /* saturation power for each chnl group */
-               group = &priv->eeprom.groups[i];
+               group = &eeprom->groups[i];
 
                /* sanity check on factory saturation power value */
                if (group->saturation_power < 40) {
-                       IWL_WARNING("Error: saturation power is %d, "
+                       IWL_WARN(priv, "Error: saturation power is %d, "
                                    "less than minimum expected 40\n",
                                    group->saturation_power);
                        return;
@@ -2121,7 +2129,7 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl3945_priv *priv)
                 *   power peaks, without too much distortion (clipping).
                 */
                /* we'll fill in this array with h/w max power levels */
-               clip_pwrs = (s8 *) priv->clip_groups[i].clip_powers;
+               clip_pwrs = (s8 *) priv->clip39_groups[i].clip_powers;
 
                /* divide factory saturation power by 2 to find -3dB level */
                satur_pwr = (s8) (group->saturation_power >> 1);
@@ -2171,10 +2179,11 @@ static void iwl3945_hw_reg_init_channel_groups(struct iwl3945_priv *priv)
  *
  * This does *not* write values to NIC, just sets up our internal table.
  */
-int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv)
+int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv)
 {
-       struct iwl3945_channel_info *ch_info = NULL;
+       struct iwl_channel_info *ch_info = NULL;
        struct iwl3945_channel_power_info *pwr_info;
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
        int delta_index;
        u8 rate_index;
        u8 scan_tbl_index;
@@ -2204,15 +2213,15 @@ int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv)
                        iwl3945_hw_reg_get_ch_grp_index(priv, ch_info);
 
                /* Get this chnlgrp's rate->max/clip-powers table */
-               clip_pwrs = priv->clip_groups[ch_info->group_index].clip_powers;
+               clip_pwrs = priv->clip39_groups[ch_info->group_index].clip_powers;
 
                /* calculate power index *adjustment* value according to
                 *  diff between current temperature and factory temperature */
                delta_index = iwl3945_hw_reg_adjust_power_by_temp(temperature,
-                               priv->eeprom.groups[ch_info->group_index].
+                               eeprom->groups[ch_info->group_index].
                                temperature);
 
-               IWL_DEBUG_POWER("Delta index for channel %d: %d [%d]\n",
+               IWL_DEBUG_POWER(priv, "Delta index for channel %d: %d [%d]\n",
                                ch_info->channel, delta_index, temperature +
                                IWL_TEMP_CONVERT);
 
@@ -2235,7 +2244,7 @@ int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv)
                                                         ch_info->group_index,
                                                         &power_idx);
                        if (rc) {
-                               IWL_ERROR("Invalid power index\n");
+                               IWL_ERR(priv, "Invalid power index\n");
                                return rc;
                        }
                        pwr_info->base_power_index = (u8) power_idx;
@@ -2295,75 +2304,90 @@ int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv)
        return 0;
 }
 
-int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv)
+int iwl3945_hw_rxq_stop(struct iwl_priv *priv)
 {
        int rc;
        unsigned long flags;
 
        spin_lock_irqsave(&priv->lock, flags);
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
                spin_unlock_irqrestore(&priv->lock, flags);
                return rc;
        }
 
-       iwl3945_write_direct32(priv, FH_RCSR_CONFIG(0), 0);
-       rc = iwl3945_poll_direct_bit(priv, FH_RSSR_STATUS,
-                       FH_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
+       iwl_write_direct32(priv, FH39_RCSR_CONFIG(0), 0);
+       rc = iwl_poll_direct_bit(priv, FH39_RSSR_STATUS,
+                       FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE, 1000);
        if (rc < 0)
-               IWL_ERROR("Can't stop Rx DMA.\n");
+               IWL_ERR(priv, "Can't stop Rx DMA.\n");
 
-       iwl3945_release_nic_access(priv);
+       iwl_release_nic_access(priv);
        spin_unlock_irqrestore(&priv->lock, flags);
 
        return 0;
 }
 
-int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
+int iwl3945_hw_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq)
 {
        int rc;
        unsigned long flags;
        int txq_id = txq->q.id;
 
-       struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt;
+       struct iwl3945_shared *shared_data = priv->shared_virt;
 
        shared_data->tx_base_ptr[txq_id] = cpu_to_le32((u32)txq->q.dma_addr);
 
        spin_lock_irqsave(&priv->lock, flags);
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
                spin_unlock_irqrestore(&priv->lock, flags);
                return rc;
        }
-       iwl3945_write_direct32(priv, FH_CBCC_CTRL(txq_id), 0);
-       iwl3945_write_direct32(priv, FH_CBCC_BASE(txq_id), 0);
+       iwl_write_direct32(priv, FH39_CBCC_CTRL(txq_id), 0);
+       iwl_write_direct32(priv, FH39_CBCC_BASE(txq_id), 0);
 
-       iwl3945_write_direct32(priv, FH_TCSR_CONFIG(txq_id),
-               ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT |
-               ALM_FH_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF |
-               ALM_FH_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD |
-               ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL |
-               ALM_FH_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE);
-       iwl3945_release_nic_access(priv);
+       iwl_write_direct32(priv, FH39_TCSR_CONFIG(txq_id),
+               FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_RTC_NOINT |
+               FH39_TCSR_TX_CONFIG_REG_VAL_MSG_MODE_TXF |
+               FH39_TCSR_TX_CONFIG_REG_VAL_CIRQ_HOST_IFTFD |
+               FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CREDIT_ENABLE_VAL |
+               FH39_TCSR_TX_CONFIG_REG_VAL_DMA_CHNL_ENABLE);
+       iwl_release_nic_access(priv);
 
        /* fake read to flush all prev. writes */
-       iwl3945_read32(priv, FH_TSSR_CBB_BASE);
+       iwl_read32(priv, FH39_TSSR_CBB_BASE);
        spin_unlock_irqrestore(&priv->lock, flags);
 
        return 0;
 }
 
-int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv)
+/*
+ * HCMD utils
+ */
+static u16 iwl3945_get_hcmd_size(u8 cmd_id, u16 len)
 {
-       struct iwl3945_shared *shared_data = priv->hw_setting.shared_virt;
+       switch (cmd_id) {
+       case REPLY_RXON:
+               return sizeof(struct iwl3945_rxon_cmd);
+       case POWER_TABLE_CMD:
+               return sizeof(struct iwl3945_powertable_cmd);
+       default:
+               return len;
+       }
+}
 
-       return le32_to_cpu(shared_data->rx_read_ptr[0]);
+static u16 iwl3945_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
+{
+       u16 size = (u16)sizeof(struct iwl3945_addsta_cmd);
+       memcpy(data, cmd, size);
+       return size;
 }
 
 /**
  * iwl3945_init_hw_rate_table - Initialize the hardware rate fallback table
  */
-int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv)
+int iwl3945_init_hw_rate_table(struct iwl_priv *priv)
 {
        int rc, i, index, prev_index;
        struct iwl3945_rate_scaling_cmd rate_cmd = {
@@ -2384,7 +2408,7 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv)
 
        switch (priv->band) {
        case IEEE80211_BAND_5GHZ:
-               IWL_DEBUG_RATE("Select A mode rate scale\n");
+               IWL_DEBUG_RATE(priv, "Select A mode rate scale\n");
                /* If one of the following CCK rates is used,
                 * have it fall back to the 6M OFDM rate */
                for (i = IWL_RATE_1M_INDEX_TABLE;
@@ -2402,12 +2426,12 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv)
                break;
 
        case IEEE80211_BAND_2GHZ:
-               IWL_DEBUG_RATE("Select B/G mode rate scale\n");
+               IWL_DEBUG_RATE(priv, "Select B/G mode rate scale\n");
                /* If an OFDM rate is used, have it fall back to the
                 * 1M CCK rates */
 
                if (!(priv->sta_supp_rates & IWL_OFDM_RATES_MASK) &&
-                   iwl3945_is_associated(priv)) {
+                   iwl_is_associated(priv)) {
 
                        index = IWL_FIRST_CCK_RATE;
                        for (i = IWL_RATE_6M_INDEX_TABLE;
@@ -2428,47 +2452,48 @@ int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv)
 
        /* Update the rate scaling for control frame Tx */
        rate_cmd.table_id = 0;
-       rc = iwl3945_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
+       rc = iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
                              &rate_cmd);
        if (rc)
                return rc;
 
        /* Update the rate scaling for data frame Tx */
        rate_cmd.table_id = 1;
-       return iwl3945_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
+       return iwl_send_cmd_pdu(priv, REPLY_RATE_SCALE, sizeof(rate_cmd),
                                &rate_cmd);
 }
 
 /* Called when initializing driver */
-int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv)
+int iwl3945_hw_set_hw_params(struct iwl_priv *priv)
 {
-       memset((void *)&priv->hw_setting, 0,
-              sizeof(struct iwl3945_driver_hw_info));
+       memset((void *)&priv->hw_params, 0,
+              sizeof(struct iwl_hw_params));
 
-       priv->hw_setting.shared_virt =
+       priv->shared_virt =
            pci_alloc_consistent(priv->pci_dev,
                                 sizeof(struct iwl3945_shared),
-                                &priv->hw_setting.shared_phys);
+                                &priv->shared_phys);
 
-       if (!priv->hw_setting.shared_virt) {
-               IWL_ERROR("failed to allocate pci memory\n");
+       if (!priv->shared_virt) {
+               IWL_ERR(priv, "failed to allocate pci memory\n");
                mutex_unlock(&priv->mutex);
                return -ENOMEM;
        }
 
-       priv->hw_setting.rx_buf_size = IWL_RX_BUF_SIZE;
-       priv->hw_setting.max_pkt_size = 2342;
-       priv->hw_setting.tx_cmd_len = sizeof(struct iwl3945_tx_cmd);
-       priv->hw_setting.max_rxq_size = RX_QUEUE_SIZE;
-       priv->hw_setting.max_rxq_log = RX_QUEUE_SIZE_LOG;
-       priv->hw_setting.max_stations = IWL3945_STATION_COUNT;
-       priv->hw_setting.bcast_sta_id = IWL3945_BROADCAST_ID;
+       priv->hw_params.tfd_size = sizeof(struct iwl3945_tfd);
+       priv->hw_params.rx_buf_size = IWL_RX_BUF_SIZE_3K;
+       priv->hw_params.max_pkt_size = 2342;
+       priv->hw_params.max_rxq_size = RX_QUEUE_SIZE;
+       priv->hw_params.max_rxq_log = RX_QUEUE_SIZE_LOG;
+       priv->hw_params.max_stations = IWL3945_STATION_COUNT;
+       priv->hw_params.bcast_sta_id = IWL3945_BROADCAST_ID;
+
+       priv->hw_params.rx_wrt_ptr_reg = FH39_RSCSR_CHNL0_WPTR;
 
-       priv->hw_setting.tx_ant_num = 2;
        return 0;
 }
 
-unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
+unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv,
                          struct iwl3945_frame *frame, u8 rate)
 {
        struct iwl3945_tx_beacon_cmd *tx_beacon_cmd;
@@ -2477,7 +2502,7 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
        tx_beacon_cmd = (struct iwl3945_tx_beacon_cmd *)&frame->u;
        memset(tx_beacon_cmd, 0, sizeof(*tx_beacon_cmd));
 
-       tx_beacon_cmd->tx.sta_id = priv->hw_setting.bcast_sta_id;
+       tx_beacon_cmd->tx.sta_id = priv->hw_params.bcast_sta_id;
        tx_beacon_cmd->tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
 
        frame_size = iwl3945_fill_beacon_frame(priv,
@@ -2501,37 +2526,261 @@ unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
        return sizeof(struct iwl3945_tx_beacon_cmd) + frame_size;
 }
 
-void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv)
+void iwl3945_hw_rx_handler_setup(struct iwl_priv *priv)
 {
        priv->rx_handlers[REPLY_TX] = iwl3945_rx_reply_tx;
        priv->rx_handlers[REPLY_3945_RX] = iwl3945_rx_reply_rx;
 }
 
-void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv)
+void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv)
 {
        INIT_DELAYED_WORK(&priv->thermal_periodic,
                          iwl3945_bg_reg_txpower_periodic);
 }
 
-void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv)
+void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv)
 {
        cancel_delayed_work(&priv->thermal_periodic);
 }
 
-static struct iwl_3945_cfg iwl3945_bg_cfg = {
+/* check contents of special bootstrap uCode SRAM */
+static int iwl3945_verify_bsm(struct iwl_priv *priv)
+ {
+       __le32 *image = priv->ucode_boot.v_addr;
+       u32 len = priv->ucode_boot.len;
+       u32 reg;
+       u32 val;
+
+       IWL_DEBUG_INFO(priv, "Begin verify bsm\n");
+
+       /* verify BSM SRAM contents */
+       val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG);
+       for (reg = BSM_SRAM_LOWER_BOUND;
+            reg < BSM_SRAM_LOWER_BOUND + len;
+            reg += sizeof(u32), image++) {
+               val = iwl_read_prph(priv, reg);
+               if (val != le32_to_cpu(*image)) {
+                       IWL_ERR(priv, "BSM uCode verification failed at "
+                                 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
+                                 BSM_SRAM_LOWER_BOUND,
+                                 reg - BSM_SRAM_LOWER_BOUND, len,
+                                 val, le32_to_cpu(*image));
+                       return -EIO;
+               }
+       }
+
+       IWL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n");
+
+       return 0;
+}
+
+
+/******************************************************************************
+ *
+ * EEPROM related functions
+ *
+ ******************************************************************************/
+
+/*
+ * Clear the OWNER_MSK, to establish driver (instead of uCode running on
+ * embedded controller) as EEPROM reader; each read is a series of pulses
+ * to/from the EEPROM chip, not a single event, so even reads could conflict
+ * if they weren't arbitrated by some ownership mechanism.  Here, the driver
+ * simply claims ownership, which should be safe when this function is called
+ * (i.e. before loading uCode!).
+ */
+static int iwl3945_eeprom_acquire_semaphore(struct iwl_priv *priv)
+{
+       _iwl_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
+       return 0;
+}
+
+
+static void iwl3945_eeprom_release_semaphore(struct iwl_priv *priv)
+{
+       return;
+}
+
+ /**
+  * iwl3945_load_bsm - Load bootstrap instructions
+  *
+  * BSM operation:
+  *
+  * The Bootstrap State Machine (BSM) stores a short bootstrap uCode program
+  * in special SRAM that does not power down during RFKILL.  When powering back
+  * up after power-saving sleeps (or during initial uCode load), the BSM loads
+  * the bootstrap program into the on-board processor, and starts it.
+  *
+  * The bootstrap program loads (via DMA) instructions and data for a new
+  * program from host DRAM locations indicated by the host driver in the
+  * BSM_DRAM_* registers.  Once the new program is loaded, it starts
+  * automatically.
+  *
+  * When initializing the NIC, the host driver points the BSM to the
+  * "initialize" uCode image.  This uCode sets up some internal data, then
+  * notifies host via "initialize alive" that it is complete.
+  *
+  * The host then replaces the BSM_DRAM_* pointer values to point to the
+  * normal runtime uCode instructions and a backup uCode data cache buffer
+  * (filled initially with starting data values for the on-board processor),
+  * then triggers the "initialize" uCode to load and launch the runtime uCode,
+  * which begins normal operation.
+  *
+  * When doing a power-save shutdown, runtime uCode saves data SRAM into
+  * the backup data cache in DRAM before SRAM is powered down.
+  *
+  * When powering back up, the BSM loads the bootstrap program.  This reloads
+  * the runtime uCode instructions and the backup data cache into SRAM,
+  * and re-launches the runtime uCode from where it left off.
+  */
+static int iwl3945_load_bsm(struct iwl_priv *priv)
+{
+       __le32 *image = priv->ucode_boot.v_addr;
+       u32 len = priv->ucode_boot.len;
+       dma_addr_t pinst;
+       dma_addr_t pdata;
+       u32 inst_len;
+       u32 data_len;
+       int rc;
+       int i;
+       u32 done;
+       u32 reg_offset;
+
+       IWL_DEBUG_INFO(priv, "Begin load bsm\n");
+
+       /* make sure bootstrap program is no larger than BSM's SRAM size */
+       if (len > IWL39_MAX_BSM_SIZE)
+               return -EINVAL;
+
+       /* Tell bootstrap uCode where to find the "Initialize" uCode
+       *   in host DRAM ... host DRAM physical address bits 31:0 for 3945.
+       * NOTE:  iwl3945_initialize_alive_start() will replace these values,
+       *        after the "initialize" uCode has run, to point to
+       *        runtime/protocol instructions and backup data cache. */
+       pinst = priv->ucode_init.p_addr;
+       pdata = priv->ucode_init_data.p_addr;
+       inst_len = priv->ucode_init.len;
+       data_len = priv->ucode_init_data.len;
+
+       rc = iwl_grab_nic_access(priv);
+       if (rc)
+               return rc;
+
+       iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
+       iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
+       iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
+       iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
+
+       /* Fill BSM memory with bootstrap instructions */
+       for (reg_offset = BSM_SRAM_LOWER_BOUND;
+            reg_offset < BSM_SRAM_LOWER_BOUND + len;
+            reg_offset += sizeof(u32), image++)
+               _iwl_write_prph(priv, reg_offset,
+                                         le32_to_cpu(*image));
+
+       rc = iwl3945_verify_bsm(priv);
+       if (rc) {
+               iwl_release_nic_access(priv);
+               return rc;
+       }
+
+       /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
+       iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
+       iwl_write_prph(priv, BSM_WR_MEM_DST_REG,
+                                IWL39_RTC_INST_LOWER_BOUND);
+       iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
+
+       /* Load bootstrap code into instruction SRAM now,
+        *   to prepare to load "initialize" uCode */
+       iwl_write_prph(priv, BSM_WR_CTRL_REG,
+               BSM_WR_CTRL_REG_BIT_START);
+
+       /* Wait for load of bootstrap uCode to finish */
+       for (i = 0; i < 100; i++) {
+               done = iwl_read_prph(priv, BSM_WR_CTRL_REG);
+               if (!(done & BSM_WR_CTRL_REG_BIT_START))
+                       break;
+               udelay(10);
+       }
+       if (i < 100)
+               IWL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i);
+       else {
+               IWL_ERR(priv, "BSM write did not complete!\n");
+               return -EIO;
+       }
+
+       /* Enable future boot loads whenever power management unit triggers it
+        *   (e.g. when powering back up after power-save shutdown) */
+       iwl_write_prph(priv, BSM_WR_CTRL_REG,
+               BSM_WR_CTRL_REG_BIT_START_EN);
+
+       iwl_release_nic_access(priv);
+
+       return 0;
+}
+
+static struct iwl_lib_ops iwl3945_lib = {
+       .txq_attach_buf_to_tfd = iwl3945_hw_txq_attach_buf_to_tfd,
+       .txq_free_tfd = iwl3945_hw_txq_free_tfd,
+       .txq_init = iwl3945_hw_tx_queue_init,
+       .load_ucode = iwl3945_load_bsm,
+       .apm_ops = {
+               .init = iwl3945_apm_init,
+               .reset = iwl3945_apm_reset,
+               .stop = iwl3945_apm_stop,
+               .config = iwl3945_nic_config,
+               .set_pwr_src = iwl3945_set_pwr_src,
+       },
+       .eeprom_ops = {
+               .regulatory_bands = {
+                       EEPROM_REGULATORY_BAND_1_CHANNELS,
+                       EEPROM_REGULATORY_BAND_2_CHANNELS,
+                       EEPROM_REGULATORY_BAND_3_CHANNELS,
+                       EEPROM_REGULATORY_BAND_4_CHANNELS,
+                       EEPROM_REGULATORY_BAND_5_CHANNELS,
+                       EEPROM_REGULATORY_BAND_NO_FAT,
+                       EEPROM_REGULATORY_BAND_NO_FAT,
+               },
+               .verify_signature  = iwlcore_eeprom_verify_signature,
+               .acquire_semaphore = iwl3945_eeprom_acquire_semaphore,
+               .release_semaphore = iwl3945_eeprom_release_semaphore,
+               .query_addr = iwlcore_eeprom_query_addr,
+       },
+       .send_tx_power  = iwl3945_send_tx_power,
+};
+
+static struct iwl_hcmd_utils_ops iwl3945_hcmd_utils = {
+       .get_hcmd_size = iwl3945_get_hcmd_size,
+       .build_addsta_hcmd = iwl3945_build_addsta_hcmd,
+};
+
+static struct iwl_ops iwl3945_ops = {
+       .lib = &iwl3945_lib,
+       .utils = &iwl3945_hcmd_utils,
+};
+
+static struct iwl_cfg iwl3945_bg_cfg = {
        .name = "3945BG",
        .fw_name_pre = IWL3945_FW_PRE,
        .ucode_api_max = IWL3945_UCODE_API_MAX,
        .ucode_api_min = IWL3945_UCODE_API_MIN,
        .sku = IWL_SKU_G,
+       .eeprom_size = IWL3945_EEPROM_IMG_SIZE,
+       .eeprom_ver = EEPROM_3945_EEPROM_VERSION,
+       .ops = &iwl3945_ops,
+       .mod_params = &iwl3945_mod_params
 };
 
-static struct iwl_3945_cfg iwl3945_abg_cfg = {
+static struct iwl_cfg iwl3945_abg_cfg = {
        .name = "3945ABG",
        .fw_name_pre = IWL3945_FW_PRE,
        .ucode_api_max = IWL3945_UCODE_API_MAX,
        .ucode_api_min = IWL3945_UCODE_API_MIN,
        .sku = IWL_SKU_A|IWL_SKU_G,
+       .eeprom_size = IWL3945_EEPROM_IMG_SIZE,
+       .eeprom_ver = EEPROM_3945_EEPROM_VERSION,
+       .ops = &iwl3945_ops,
+       .mod_params = &iwl3945_mod_params
 };
 
 struct pci_device_id iwl3945_hw_card_ids[] = {
index 2c0ddc5110c6b1611e631239a8ef84a16c8e0539..ab7aaf6872c75a52979a7af4f6595ef6baf3d7bb 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 /* Hardware specific file defines the PCI IDs table for that hardware module */
 extern struct pci_device_id iwl3945_hw_card_ids[];
 
-#define DRV_NAME       "iwl3945"
 #include "iwl-csr.h"
 #include "iwl-prph.h"
+#include "iwl-fh.h"
 #include "iwl-3945-hw.h"
-#include "iwl-3945-debug.h"
+#include "iwl-debug.h"
+#include "iwl-power.h"
+#include "iwl-dev.h"
 #include "iwl-3945-led.h"
 
 /* Highest firmware API version supported */
@@ -74,8 +76,7 @@ extern struct pci_device_id iwl3945_hw_card_ids[];
 #define IWL_NOISE_MEAS_NOT_AVAILABLE (-127)
 
 /* Module parameters accessible from iwl-*.c */
-extern int iwl3945_param_hwcrypto;
-extern int iwl3945_param_queues_num;
+extern struct iwl_mod_params iwl3945_mod_params;
 
 struct iwl3945_sta_priv {
        struct iwl3945_rs_sta *rs_sta;
@@ -95,7 +96,6 @@ enum iwl3945_antenna {
  * else RTS for data/management frames where MPDU is larger
  *   than RTS value.
  */
-#define IWL_RX_BUF_SIZE           3000U
 #define DEFAULT_RTS_THRESHOLD     2347U
 #define MIN_RTS_THRESHOLD         0U
 #define MAX_RTS_THRESHOLD         2347U
@@ -105,136 +105,7 @@ enum iwl3945_antenna {
 #define        DEFAULT_SHORT_RETRY_LIMIT 7U
 #define        DEFAULT_LONG_RETRY_LIMIT  4U
 
-struct iwl3945_rx_mem_buffer {
-       dma_addr_t dma_addr;
-       struct sk_buff *skb;
-       struct list_head list;
-};
-
-/*
- * Generic queue structure
- *
- * Contains common data for Rx and Tx queues
- */
-struct iwl3945_queue {
-       int n_bd;              /* number of BDs in this queue */
-       int write_ptr;       /* 1-st empty entry (index) host_w*/
-       int read_ptr;         /* last used entry (index) host_r*/
-       dma_addr_t dma_addr;   /* physical addr for BD's */
-       int n_window;          /* safe queue window */
-       u32 id;
-       int low_mark;          /* low watermark, resume queue if free
-                               * space more than this */
-       int high_mark;         /* high watermark, stop queue if free
-                               * space less than this */
-} __attribute__ ((packed));
-
-int iwl3945_queue_space(const struct iwl3945_queue *q);
-int iwl3945_x2_queue_used(const struct iwl3945_queue *q, int i);
-
-#define MAX_NUM_OF_TBS          (20)
-
-/* One for each TFD */
-struct iwl3945_tx_info {
-       struct sk_buff *skb[MAX_NUM_OF_TBS];
-};
-
-/**
- * struct iwl3945_tx_queue - Tx Queue for DMA
- * @q: generic Rx/Tx queue descriptor
- * @bd: base of circular buffer of TFDs
- * @cmd: array of command/Tx buffers
- * @dma_addr_cmd: physical address of cmd/tx buffer array
- * @txb: array of per-TFD driver data
- * @need_update: indicates need to update read/write index
- *
- * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
- * descriptors) and required locking structures.
- */
-struct iwl3945_tx_queue {
-       struct iwl3945_queue q;
-       struct iwl3945_tfd_frame *bd;
-       struct iwl3945_cmd *cmd;
-       dma_addr_t dma_addr_cmd;
-       struct iwl3945_tx_info *txb;
-       int need_update;
-       int active;
-};
-
-#define IWL_NUM_SCAN_RATES         (2)
-
-struct iwl3945_channel_tgd_info {
-       u8 type;
-       s8 max_power;
-};
-
-struct iwl3945_channel_tgh_info {
-       s64 last_radar_time;
-};
-
-/* current Tx power values to use, one for each rate for each channel.
- * requested power is limited by:
- * -- regulatory EEPROM limits for this channel
- * -- hardware capabilities (clip-powers)
- * -- spectrum management
- * -- user preference (e.g. iwconfig)
- * when requested power is set, base power index must also be set. */
-struct iwl3945_channel_power_info {
-       struct iwl3945_tx_power tpc;    /* actual radio and DSP gain settings */
-       s8 power_table_index;   /* actual (compenst'd) index into gain table */
-       s8 base_power_index;    /* gain index for power at factory temp. */
-       s8 requested_power;     /* power (dBm) requested for this chnl/rate */
-};
-
-/* current scan Tx power values to use, one for each scan rate for each
- * channel. */
-struct iwl3945_scan_power_info {
-       struct iwl3945_tx_power tpc;    /* actual radio and DSP gain settings */
-       s8 power_table_index;   /* actual (compenst'd) index into gain table */
-       s8 requested_power;     /* scan pwr (dBm) requested for chnl/rate */
-};
-
-/*
- * One for each channel, holds all channel setup data
- * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
- *     with one another!
- */
-#define IWL4965_MAX_RATE (33)
-
-struct iwl3945_channel_info {
-       struct iwl3945_channel_tgd_info tgd;
-       struct iwl3945_channel_tgh_info tgh;
-       struct iwl3945_eeprom_channel eeprom;   /* EEPROM regulatory limit */
-       struct iwl3945_eeprom_channel fat_eeprom;       /* EEPROM regulatory limit for
-                                                * FAT channel */
-
-       u8 channel;       /* channel number */
-       u8 flags;         /* flags copied from EEPROM */
-       s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
-       s8 curr_txpow;    /* (dBm) regulatory/spectrum/user (not h/w) */
-       s8 min_power;     /* always 0 */
-       s8 scan_power;    /* (dBm) regul. eeprom, direct scans, any rate */
-
-       u8 group_index;   /* 0-4, maps channel to group1/2/3/4/5 */
-       u8 band_index;    /* 0-4, maps channel to band1/2/3/4/5 */
-       enum ieee80211_band band;
-
-       /* Radio/DSP gain settings for each "normal" data Tx rate.
-        * These include, in addition to RF and DSP gain, a few fields for
-        *   remembering/modifying gain settings (indexes). */
-       struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE];
-
-       /* Radio/DSP gain settings for each scan rate, for directed scans. */
-       struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
-};
-
-struct iwl3945_clip_group {
-       /* maximum power level to prevent clipping for each rate, derived by
-        *   us from this band's saturation power in EEPROM */
-       const s8 clip_powers[IWL_MAX_RATES];
-};
-
-#include "iwl-3945-rs.h"
+#include "iwl-agn-rs.h"
 
 #define IWL_TX_FIFO_AC0        0
 #define IWL_TX_FIFO_AC1        1
@@ -247,33 +118,6 @@ struct iwl3945_clip_group {
 /* Minimum number of queues. MAX_NUM is defined in hw specific files */
 #define IWL_MIN_NUM_QUEUES     4
 
-/* Power management (not Tx power) structures */
-
-struct iwl3945_power_vec_entry {
-       struct iwl3945_powertable_cmd cmd;
-       u8 no_dtim;
-};
-#define IWL_POWER_RANGE_0  (0)
-#define IWL_POWER_RANGE_1  (1)
-
-#define IWL_POWER_MODE_CAM     0x00    /* Continuously Aware Mode, always on */
-#define IWL_POWER_INDEX_3      0x03
-#define IWL_POWER_INDEX_5      0x05
-#define IWL_POWER_AC           0x06
-#define IWL_POWER_BATTERY      0x07
-#define IWL_POWER_LIMIT                0x07
-#define IWL_POWER_MASK         0x0F
-#define IWL_POWER_ENABLED      0x10
-#define IWL_POWER_LEVEL(x)     ((x) & IWL_POWER_MASK)
-
-struct iwl3945_power_mgr {
-       spinlock_t lock;
-       struct iwl3945_power_vec_entry pwr_range_0[IWL_POWER_AC];
-       struct iwl3945_power_vec_entry pwr_range_1[IWL_POWER_AC];
-       u8 active_index;
-       u32 dtim_val;
-};
-
 #define IEEE80211_DATA_LEN              2304
 #define IEEE80211_4ADDR_LEN             30
 #define IEEE80211_HLEN                  (IEEE80211_4ADDR_LEN)
@@ -289,81 +133,10 @@ struct iwl3945_frame {
        struct list_head list;
 };
 
-#define SEQ_TO_QUEUE(x)  ((x >> 8) & 0xbf)
-#define QUEUE_TO_SEQ(x)  ((x & 0xbf) << 8)
-#define SEQ_TO_INDEX(x) ((u8)(x & 0xff))
-#define INDEX_TO_SEQ(x) ((u8)(x & 0xff))
-#define SEQ_HUGE_FRAME  (0x4000)
-#define SEQ_RX_FRAME    __constant_cpu_to_le16(0x8000)
 #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
 #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
 #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
 
-enum {
-       /* CMD_SIZE_NORMAL = 0, */
-       CMD_SIZE_HUGE = (1 << 0),
-       /* CMD_SYNC = 0, */
-       CMD_ASYNC = (1 << 1),
-       /* CMD_NO_SKB = 0, */
-       CMD_WANT_SKB = (1 << 2),
-};
-
-struct iwl3945_cmd;
-struct iwl3945_priv;
-
-struct iwl3945_cmd_meta {
-       struct iwl3945_cmd_meta *source;
-       union {
-               struct sk_buff *skb;
-               int (*callback)(struct iwl3945_priv *priv,
-                               struct iwl3945_cmd *cmd, struct sk_buff *skb);
-       } __attribute__ ((packed)) u;
-
-       /* The CMD_SIZE_HUGE flag bit indicates that the command
-        * structure is stored at the end of the shared queue memory. */
-       u32 flags;
-
-} __attribute__ ((packed));
-
-/**
- * struct iwl3945_cmd
- *
- * For allocation of the command and tx queues, this establishes the overall
- * size of the largest command we send to uCode, except for a scan command
- * (which is relatively huge; space is allocated separately).
- */
-struct iwl3945_cmd {
-       struct iwl3945_cmd_meta meta;
-       struct iwl3945_cmd_header hdr;
-       union {
-               struct iwl3945_addsta_cmd addsta;
-               struct iwl3945_led_cmd led;
-               u32 flags;
-               u8 val8;
-               u16 val16;
-               u32 val32;
-               struct iwl3945_bt_cmd bt;
-               struct iwl3945_rxon_time_cmd rxon_time;
-               struct iwl3945_powertable_cmd powertable;
-               struct iwl3945_qosparam_cmd qosparam;
-               struct iwl3945_tx_cmd tx;
-               struct iwl3945_tx_beacon_cmd tx_beacon;
-               struct iwl3945_rxon_assoc_cmd rxon_assoc;
-               u8 *indirect;
-               u8 payload[360];
-       } __attribute__ ((packed)) cmd;
-} __attribute__ ((packed));
-
-struct iwl3945_host_cmd {
-       u8 id;
-       u16 len;
-       struct iwl3945_cmd_meta meta;
-       const void *data;
-};
-
-#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl3945_cmd) - \
-                             sizeof(struct iwl3945_cmd_meta))
-
 /*
  * RX related structures and functions
  */
@@ -374,33 +147,6 @@ struct iwl3945_host_cmd {
 #define SUP_RATE_11B_MAX_NUM_CHANNELS  4
 #define SUP_RATE_11G_MAX_NUM_CHANNELS  12
 
-/**
- * struct iwl3945_rx_queue - Rx queue
- * @processed: Internal index to last handled Rx packet
- * @read: Shared index to newest available Rx buffer
- * @write: Shared index to oldest written Rx packet
- * @free_count: Number of pre-allocated buffers in rx_free
- * @rx_free: list of free SKBs for use
- * @rx_used: List of Rx buffers with no SKB
- * @need_update: flag to indicate we need to update read/write index
- *
- * NOTE:  rx_free and rx_used are used as a FIFO for iwl3945_rx_mem_buffers
- */
-struct iwl3945_rx_queue {
-       __le32 *bd;
-       dma_addr_t dma_addr;
-       struct iwl3945_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
-       struct iwl3945_rx_mem_buffer *queue[RX_QUEUE_SIZE];
-       u32 processed;
-       u32 read;
-       u32 write;
-       u32 free_count;
-       struct list_head rx_free;
-       struct list_head rx_used;
-       int need_update;
-       spinlock_t lock;
-};
-
 #define IWL_SUPPORTED_RATES_IE_LEN         8
 
 #define SCAN_INTERVAL 100
@@ -430,87 +176,9 @@ struct iwl3945_rx_queue {
 #define IWL_INVALID_RATE     0xFF
 #define IWL_INVALID_VALUE    -1
 
-struct iwl3945_tid_data {
-       u16 seq_number;
-};
-
-struct iwl3945_hw_key {
-       enum ieee80211_key_alg alg;
-       int keylen;
-       u8 key[32];
-};
-
-union iwl3945_ht_rate_supp {
-       u16 rates;
-       struct {
-               u8 siso_rate;
-               u8 mimo_rate;
-       };
-};
-
-union iwl3945_qos_capabity {
-       struct {
-               u8 edca_count:4;        /* bit 0-3 */
-               u8 q_ack:1;             /* bit 4 */
-               u8 queue_request:1;     /* bit 5 */
-               u8 txop_request:1;      /* bit 6 */
-               u8 reserved:1;          /* bit 7 */
-       } q_AP;
-       struct {
-               u8 acvo_APSD:1;         /* bit 0 */
-               u8 acvi_APSD:1;         /* bit 1 */
-               u8 ac_bk_APSD:1;        /* bit 2 */
-               u8 ac_be_APSD:1;        /* bit 3 */
-               u8 q_ack:1;             /* bit 4 */
-               u8 max_len:2;           /* bit 5-6 */
-               u8 more_data_ack:1;     /* bit 7 */
-       } q_STA;
-       u8 val;
-};
-
-/* QoS structures */
-struct iwl3945_qos_info {
-       int qos_active;
-       union iwl3945_qos_capabity qos_cap;
-       struct iwl3945_qosparam_cmd def_qos_parm;
-};
-
 #define STA_PS_STATUS_WAKE             0
 #define STA_PS_STATUS_SLEEP            1
 
-struct iwl3945_station_entry {
-       struct iwl3945_addsta_cmd sta;
-       struct iwl3945_tid_data tid[MAX_TID_COUNT];
-       union {
-               struct {
-                       u8 rate;
-                       u8 flags;
-               } s;
-               u16 rate_n_flags;
-       } current_rate;
-       u8 used;
-       u8 ps_status;
-       struct iwl3945_hw_key keyinfo;
-};
-
-/* one for each uCode image (inst/data, boot/init/runtime) */
-struct fw_desc {
-       void *v_addr;           /* access by driver */
-       dma_addr_t p_addr;      /* access by card's busmaster DMA */
-       u32 len;                /* bytes */
-};
-
-/* uCode file layout */
-struct iwl3945_ucode {
-       __le32 ver;             /* major/minor/API/serial */
-       __le32 inst_size;       /* bytes of runtime instructions */
-       __le32 data_size;       /* bytes of runtime data */
-       __le32 init_size;       /* bytes of initialization instructions */
-       __le32 init_data_size;  /* bytes of initialization data */
-       __le32 boot_size;       /* bytes of bootstrap instructions */
-       u8 data[0];             /* data in same order as "size" elements */
-};
-
 struct iwl3945_ibss_seq {
        u8 mac[ETH_ALEN];
        u16 seq_num;
@@ -519,34 +187,6 @@ struct iwl3945_ibss_seq {
        struct list_head list;
 };
 
-/**
- * struct iwl3945_driver_hw_info
- * @max_txq_num: Max # Tx queues supported
- * @tx_cmd_len: Size of Tx command (but not including frame itself)
- * @tx_ant_num: Number of TX antennas
- * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
- * @rx_buf_size:
- * @max_pkt_size:
- * @max_rxq_log: Log-base-2 of max_rxq_size
- * @max_stations:
- * @bcast_sta_id:
- * @shared_virt: Pointer to driver/uCode shared Tx Byte Counts and Rx status
- * @shared_phys: Physical Pointer to Tx Byte Counts and Rx status
- */
-struct iwl3945_driver_hw_info {
-       u16 max_txq_num;
-       u16 tx_cmd_len;
-       u16 tx_ant_num;
-       u16 max_rxq_size;
-       u32 rx_buf_size;
-       u32 max_pkt_size;
-       u16 max_rxq_log;
-       u8  max_stations;
-       u8  bcast_sta_id;
-       void *shared_virt;
-       dma_addr_t shared_phys;
-};
-
 #define IWL_RX_HDR(x) ((struct iwl3945_rx_frame_hdr *)(\
                       x->u.rx_frame.stats.payload + \
                       x->u.rx_frame.stats.phy_count))
@@ -564,40 +204,30 @@ struct iwl3945_driver_hw_info {
  *
  *****************************************************************************/
 struct iwl3945_addsta_cmd;
-extern int iwl3945_send_add_station(struct iwl3945_priv *priv,
+extern int iwl3945_send_add_station(struct iwl_priv *priv,
                                struct iwl3945_addsta_cmd *sta, u8 flags);
-extern u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *bssid,
+extern u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *bssid,
                          int is_ap, u8 flags);
-extern int iwl3945_power_init_handle(struct iwl3945_priv *priv);
-extern int iwl3945_eeprom_init(struct iwl3945_priv *priv);
-extern int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv);
-extern void iwl3945_rx_queue_reset(struct iwl3945_priv *priv,
-                              struct iwl3945_rx_queue *rxq);
+extern int iwl3945_power_init_handle(struct iwl_priv *priv);
+extern int iwl3945_eeprom_init(struct iwl_priv *priv);
 extern int iwl3945_calc_db_from_ratio(int sig_ratio);
 extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
-extern int iwl3945_tx_queue_init(struct iwl3945_priv *priv,
-                            struct iwl3945_tx_queue *txq, int count, u32 id);
+extern int iwl3945_tx_queue_init(struct iwl_priv *priv,
+                            struct iwl_tx_queue *txq, int count, u32 id);
 extern void iwl3945_rx_replenish(void *data);
-extern void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq);
-extern int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len,
+extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq);
+extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,
                            const void *data);
-extern int __must_check iwl3945_send_cmd(struct iwl3945_priv *priv,
-               struct iwl3945_host_cmd *cmd);
-extern unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
+extern int __must_check iwl3945_send_cmd(struct iwl_priv *priv,
+                                        struct iwl_host_cmd *cmd);
+extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
                                        struct ieee80211_hdr *hdr,int left);
-extern int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv,
-                                        struct iwl3945_rx_queue *q);
-extern int iwl3945_send_statistics_request(struct iwl3945_priv *priv);
-extern void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb,
-                                  u32 decrypt_res,
-                                  struct ieee80211_rx_status *stats);
-extern const u8 iwl3945_broadcast_addr[ETH_ALEN];
 
 /*
  * Currently used by iwl-3945-rs... look at restructuring so that it doesn't
  * call this... todo... fix that.
 */
-extern u8 iwl3945_sync_station(struct iwl3945_priv *priv, int sta_id,
+extern u8 iwl3945_sync_station(struct iwl_priv *priv, int sta_id,
                           u16 tx_rate, u8 flags);
 
 /******************************************************************************
@@ -616,36 +246,37 @@ extern u8 iwl3945_sync_station(struct iwl3945_priv *priv, int sta_id,
  * iwl3945_mac_     <-- mac80211 callback
  *
  ****************************************************************************/
-extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv);
-extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv);
-extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv);
-extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv);
-extern int iwl3945_hw_set_hw_setting(struct iwl3945_priv *priv);
-extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv);
-extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv);
-extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv);
-extern void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv);
-extern int iwl3945_hw_nic_reset(struct iwl3945_priv *priv);
-extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *tfd,
-                                       dma_addr_t addr, u16 len);
-extern int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq);
-extern int iwl3945_hw_get_temperature(struct iwl3945_priv *priv);
-extern int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv,
-                               struct iwl3945_tx_queue *txq);
-extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv,
+extern void iwl3945_hw_rx_handler_setup(struct iwl_priv *priv);
+extern void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv);
+extern void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv);
+extern int iwl3945_hw_rxq_stop(struct iwl_priv *priv);
+extern int iwl3945_hw_set_hw_params(struct iwl_priv *priv);
+extern int iwl3945_hw_nic_init(struct iwl_priv *priv);
+extern int iwl3945_hw_nic_stop_master(struct iwl_priv *priv);
+extern void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv);
+extern void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv);
+extern int iwl3945_hw_nic_reset(struct iwl_priv *priv);
+extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
+                                           struct iwl_tx_queue *txq,
+                                           dma_addr_t addr, u16 len,
+                                           u8 reset, u8 pad);
+extern void iwl3945_hw_txq_free_tfd(struct iwl_priv *priv,
+                                   struct iwl_tx_queue *txq);
+extern int iwl3945_hw_get_temperature(struct iwl_priv *priv);
+extern int iwl3945_hw_tx_queue_init(struct iwl_priv *priv,
+                               struct iwl_tx_queue *txq);
+extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv,
                                 struct iwl3945_frame *frame, u8 rate);
-extern int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv);
-extern void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv,
-                                    struct iwl3945_cmd *cmd,
+void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv, struct iwl_cmd *cmd,
                                     struct ieee80211_tx_info *info,
                                     struct ieee80211_hdr *hdr,
                                     int sta_id, int tx_id);
-extern int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv);
-extern int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power);
-extern void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv,
-                                struct iwl3945_rx_mem_buffer *rxb);
-extern void iwl3945_disable_events(struct iwl3945_priv *priv);
-extern int iwl4965_get_temperature(const struct iwl3945_priv *priv);
+extern int iwl3945_hw_reg_send_txpower(struct iwl_priv *priv);
+extern int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
+extern void iwl3945_hw_rx_statistics(struct iwl_priv *priv,
+                                struct iwl_rx_mem_buffer *rxb);
+extern void iwl3945_disable_events(struct iwl_priv *priv);
+extern int iwl4965_get_temperature(const struct iwl_priv *priv);
 
 /**
  * iwl3945_hw_find_station - Find station id for a given BSSID
@@ -655,302 +286,26 @@ extern int iwl4965_get_temperature(const struct iwl3945_priv *priv);
  * not yet been merged into a single common layer for managing the
  * station tables.
  */
-extern u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *bssid);
+extern u8 iwl3945_hw_find_station(struct iwl_priv *priv, const u8 *bssid);
 
-extern int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel);
+extern int iwl3945_hw_channel_switch(struct iwl_priv *priv, u16 channel);
 
 /*
  * Forward declare iwl-3945.c functions for iwl-base.c
  */
-extern __le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv);
-extern int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv);
-extern void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv);
-extern int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv);
-extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id,
+extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv);
+extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv);
+extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv);
+extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv);
+extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id,
                 u16 tx_rate, u8 flags);
 
+extern const struct iwl_channel_info *iwl3945_get_channel_info(
+       const struct iwl_priv *priv, enum ieee80211_band band, u16 channel);
 
-#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
-
-enum {
-       MEASUREMENT_READY = (1 << 0),
-       MEASUREMENT_ACTIVE = (1 << 1),
-};
-
-#endif
-
-#ifdef CONFIG_IWL3945_RFKILL
-struct iwl3945_priv;
-
-void iwl3945_rfkill_set_hw_state(struct iwl3945_priv *priv);
-void iwl3945_rfkill_unregister(struct iwl3945_priv *priv);
-int iwl3945_rfkill_init(struct iwl3945_priv *priv);
-#else
-static inline void iwl3945_rfkill_set_hw_state(struct iwl3945_priv *priv) {}
-static inline void iwl3945_rfkill_unregister(struct iwl3945_priv *priv) {}
-static inline int iwl3945_rfkill_init(struct iwl3945_priv *priv) { return 0; }
-#endif
-
-#define IWL_MAX_NUM_QUEUES IWL39_MAX_NUM_QUEUES
-
-struct iwl3945_priv {
-
-       /* ieee device used by generic ieee processing code */
-       struct ieee80211_hw *hw;
-       struct ieee80211_channel *ieee_channels;
-       struct ieee80211_rate *ieee_rates;
-       struct iwl_3945_cfg *cfg; /* device configuration */
-
-       /* temporary frame storage list */
-       struct list_head free_frames;
-       int frames_count;
-
-       enum ieee80211_band band;
-       int alloc_rxb_skb;
-
-       void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv,
-                                      struct iwl3945_rx_mem_buffer *rxb);
-
-       struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
-
-#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
-       /* spectrum measurement report caching */
-       struct iwl3945_spectrum_notification measure_report;
-       u8 measurement_status;
-#endif
-       /* ucode beacon time */
-       u32 ucode_beacon_time;
-
-       /* we allocate array of iwl3945_channel_info for NIC's valid channels.
-        *    Access via channel # using indirect index array */
-       struct iwl3945_channel_info *channel_info;      /* channel info array */
-       u8 channel_count;       /* # of channels */
-
-       /* each calibration channel group in the EEPROM has a derived
-        * clip setting for each rate. */
-       const struct iwl3945_clip_group clip_groups[5];
-
-       /* thermal calibration */
-       s32 temperature;        /* degrees Kelvin */
-       s32 last_temperature;
-
-       /* Scan related variables */
-       unsigned long last_scan_jiffies;
-       unsigned long next_scan_jiffies;
-       unsigned long scan_start;
-       unsigned long scan_pass_start;
-       unsigned long scan_start_tsf;
-       int scan_bands;
-       int one_direct_scan;
-       u8 direct_ssid_len;
-       u8 direct_ssid[IW_ESSID_MAX_SIZE];
-       struct iwl3945_scan_cmd *scan;
-
-       /* spinlock */
-       spinlock_t lock;        /* protect general shared data */
-       spinlock_t hcmd_lock;   /* protect hcmd */
-       struct mutex mutex;
-
-       /* basic pci-network driver stuff */
-       struct pci_dev *pci_dev;
-
-       /* pci hardware address support */
-       void __iomem *hw_base;
-
-       /* uCode images, save to reload in case of failure */
-       u32 ucode_ver;                  /* ucode version, copy of
-                                          iwl3945_ucode.ver */
-       struct fw_desc ucode_code;      /* runtime inst */
-       struct fw_desc ucode_data;      /* runtime data original */
-       struct fw_desc ucode_data_backup;       /* runtime data save/restore */
-       struct fw_desc ucode_init;      /* initialization inst */
-       struct fw_desc ucode_init_data; /* initialization data */
-       struct fw_desc ucode_boot;      /* bootstrap inst */
-
-
-       struct iwl3945_rxon_time_cmd rxon_timing;
-
-       /* We declare this const so it can only be
-        * changed via explicit cast within the
-        * routines that actually update the physical
-        * hardware */
-       const struct iwl3945_rxon_cmd active_rxon;
-       struct iwl3945_rxon_cmd staging_rxon;
-
-       int error_recovering;
-       struct iwl3945_rxon_cmd recovery_rxon;
-
-       /* 1st responses from initialize and runtime uCode images.
-        * 4965's initialize alive response contains some calibration data. */
-       struct iwl3945_init_alive_resp card_alive_init;
-       struct iwl3945_alive_resp card_alive;
-
-#ifdef CONFIG_IWL3945_RFKILL
-       struct rfkill *rfkill;
-#endif
-
-#ifdef CONFIG_IWL3945_LEDS
-       struct iwl3945_led led[IWL_LED_TRG_MAX];
-       unsigned long last_blink_time;
-       u8 last_blink_rate;
-       u8 allow_blinking;
-       unsigned int rxtxpackets;
-       u64 led_tpt;
-#endif
-
-
-       u16 active_rate;
-       u16 active_rate_basic;
-
-       u32 sta_supp_rates;
-
-       u8 call_post_assoc_from_beacon;
-       /* Rate scaling data */
-       s8 data_retry_limit;
-       u8 retry_rate;
-
-       wait_queue_head_t wait_command_queue;
-
-       int activity_timer_active;
-
-       /* Rx and Tx DMA processing queues */
-       struct iwl3945_rx_queue rxq;
-       struct iwl3945_tx_queue txq[IWL_MAX_NUM_QUEUES];
-
-       unsigned long status;
-
-       int last_rx_rssi;       /* From Rx packet statisitics */
-       int last_rx_noise;      /* From beacon statistics */
-
-       struct iwl3945_power_mgr power_data;
-
-       struct iwl3945_notif_statistics statistics;
-       unsigned long last_statistics_time;
-
-       /* context information */
-       u16 rates_mask;
-
-       u32 power_mode;
-       u32 antenna;
-       u8 bssid[ETH_ALEN];
-       u16 rts_threshold;
-       u8 mac_addr[ETH_ALEN];
-
-       /*station table variables */
-       spinlock_t sta_lock;
-       int num_stations;
-       struct iwl3945_station_entry stations[IWL_STATION_COUNT];
-
-       /* Indication if ieee80211_ops->open has been called */
-       u8 is_open;
+extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate);
 
-       u8 mac80211_registered;
-
-       /* Rx'd packet timing information */
-       u32 last_beacon_time;
-       u64 last_tsf;
-
-       /* eeprom */
-       struct iwl3945_eeprom eeprom;
-
-       enum nl80211_iftype iw_mode;
-
-       struct sk_buff *ibss_beacon;
-
-       /* Last Rx'd beacon timestamp */
-       u32 timestamp0;
-       u32 timestamp1;
-       u16 beacon_int;
-       struct iwl3945_driver_hw_info hw_setting;
-       struct ieee80211_vif *vif;
-
-       /* Current association information needed to configure the
-        * hardware */
-       u16 assoc_id;
-       u16 assoc_capability;
-       u8 ps_mode;
-
-       struct iwl3945_qos_info qos_data;
-
-       struct workqueue_struct *workqueue;
-
-       struct work_struct up;
-       struct work_struct restart;
-       struct work_struct calibrated_work;
-       struct work_struct scan_completed;
-       struct work_struct rx_replenish;
-       struct work_struct rf_kill;
-       struct work_struct abort_scan;
-       struct work_struct update_link_led;
-       struct work_struct auth_work;
-       struct work_struct report_work;
-       struct work_struct request_scan;
-       struct work_struct beacon_update;
-
-       struct tasklet_struct irq_tasklet;
-
-       struct delayed_work init_alive_start;
-       struct delayed_work alive_start;
-       struct delayed_work activity_timer;
-       struct delayed_work thermal_periodic;
-       struct delayed_work gather_stats;
-       struct delayed_work scan_check;
-
-#define IWL_DEFAULT_TX_POWER 0x0F
-       s8 user_txpower_limit;
-       s8 max_channel_txpower_limit;
-
-
-#ifdef CONFIG_IWL3945_DEBUG
-       /* debugging info */
-       u32 framecnt_to_us;
-       atomic_t restrict_refcnt;
-#endif
-};                             /*iwl3945_priv */
-
-static inline int iwl3945_is_associated(struct iwl3945_priv *priv)
-{
-       return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
-}
-
-static inline int is_channel_valid(const struct iwl3945_channel_info *ch_info)
-{
-       if (ch_info == NULL)
-               return 0;
-       return (ch_info->flags & EEPROM_CHANNEL_VALID) ? 1 : 0;
-}
-
-static inline int is_channel_radar(const struct iwl3945_channel_info *ch_info)
-{
-       return (ch_info->flags & EEPROM_CHANNEL_RADAR) ? 1 : 0;
-}
-
-static inline u8 is_channel_a_band(const struct iwl3945_channel_info *ch_info)
-{
-       return ch_info->band == IEEE80211_BAND_5GHZ;
-}
-
-static inline u8 is_channel_bg_band(const struct iwl3945_channel_info *ch_info)
-{
-       return ch_info->band == IEEE80211_BAND_2GHZ;
-}
-
-static inline int is_channel_passive(const struct iwl3945_channel_info *ch)
-{
-       return (!(ch->flags & EEPROM_CHANNEL_ACTIVE)) ? 1 : 0;
-}
-
-static inline int is_channel_ibss(const struct iwl3945_channel_info *ch)
-{
-       return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
-}
-
-extern const struct iwl3945_channel_info *iwl3945_get_channel_info(
-       const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel);
-
-extern int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate);
-
-/* Requires full declaration of iwl3945_priv before including */
-#include "iwl-3945-io.h"
+/* Requires full declaration of iwl_priv before including */
+#include "iwl-io.h"
 
 #endif
index 6649f7b55650012ef01310bab088fc2f56455526..a71a489096ff07304ae45f073481f1a89b2a7dd1 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #define LONG_SLOT_TIME 20
 
 /* RSSI to dBm */
-#define IWL_RSSI_OFFSET        44
-
+#define IWL49_RSSI_OFFSET      44
 
 
 /* PCI registers */
 #define PCI_CFG_RETRY_TIMEOUT  0x041
-#define PCI_CFG_POWER_SOURCE   0x0C8
-#define PCI_REG_WUM8           0x0E8
-#define PCI_CFG_LINK_CTRL      0x0F0
 
 /* PCI register values */
 #define PCI_CFG_LINK_CTRL_VAL_L0S_EN   0x01
 #define PCI_CFG_LINK_CTRL_VAL_L1_EN    0x02
-#define PCI_CFG_CMD_REG_INT_DIS_MSK    0x04
-#define PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT         (0x80000000)
-
 
 #define IWL_NUM_SCAN_RATES         (2)
 
 #define IWL_DEFAULT_TX_RETRY  15
 
-#define RX_QUEUE_SIZE                         256
-#define RX_QUEUE_MASK                         255
-#define RX_QUEUE_SIZE_LOG                     8
-
-#define TFD_TX_CMD_SLOTS 256
-#define TFD_CMD_SLOTS 32
-
-/*
- * RX related structures and functions
- */
-#define RX_FREE_BUFFERS 64
-#define RX_LOW_WATERMARK 8
-
-/* Size of one Rx buffer in host DRAM */
-#define IWL_RX_BUF_SIZE_4K (4 * 1024)
-#define IWL_RX_BUF_SIZE_8K (8 * 1024)
 
 /* Sizes and addresses for instruction and data memory (SRAM) in
  * 4965's embedded processor.  Driver access is via HBUS_TARG_MEM_* regs. */
-#define RTC_INST_LOWER_BOUND                   (0x000000)
+#define IWL49_RTC_INST_LOWER_BOUND             (0x000000)
 #define IWL49_RTC_INST_UPPER_BOUND             (0x018000)
 
-#define RTC_DATA_LOWER_BOUND                   (0x800000)
+#define IWL49_RTC_DATA_LOWER_BOUND             (0x800000)
 #define IWL49_RTC_DATA_UPPER_BOUND             (0x80A000)
 
-#define IWL49_RTC_INST_SIZE  (IWL49_RTC_INST_UPPER_BOUND - RTC_INST_LOWER_BOUND)
-#define IWL49_RTC_DATA_SIZE  (IWL49_RTC_DATA_UPPER_BOUND - RTC_DATA_LOWER_BOUND)
+#define IWL49_RTC_INST_SIZE  (IWL49_RTC_INST_UPPER_BOUND - \
+                               IWL49_RTC_INST_LOWER_BOUND)
+#define IWL49_RTC_DATA_SIZE  (IWL49_RTC_DATA_UPPER_BOUND - \
+                               IWL49_RTC_DATA_LOWER_BOUND)
 
-#define IWL_MAX_INST_SIZE IWL49_RTC_INST_SIZE
-#define IWL_MAX_DATA_SIZE IWL49_RTC_DATA_SIZE
+#define IWL49_MAX_INST_SIZE IWL49_RTC_INST_SIZE
+#define IWL49_MAX_DATA_SIZE IWL49_RTC_DATA_SIZE
 
 /* Size of uCode instruction memory in bootstrap state machine */
-#define IWL_MAX_BSM_SIZE BSM_SRAM_SIZE
+#define IWL49_MAX_BSM_SIZE BSM_SRAM_SIZE
 
 static inline int iwl4965_hw_valid_rtc_data_addr(u32 addr)
 {
-       return (addr >= RTC_DATA_LOWER_BOUND) &&
+       return (addr >= IWL49_RTC_DATA_LOWER_BOUND) &&
               (addr < IWL49_RTC_DATA_UPPER_BOUND);
 }
 
index 5a72bc0377ded292dcfd7048b9fbfc86373eab4e..bd0140be774e4320435850b2095dcbc78a7c462b 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -76,7 +76,7 @@ static int iwl4965_verify_bsm(struct iwl_priv *priv)
        u32 reg;
        u32 val;
 
-       IWL_DEBUG_INFO("Begin verify bsm\n");
+       IWL_DEBUG_INFO(priv, "Begin verify bsm\n");
 
        /* verify BSM SRAM contents */
        val = iwl_read_prph(priv, BSM_WR_DWCOUNT_REG);
@@ -85,7 +85,7 @@ static int iwl4965_verify_bsm(struct iwl_priv *priv)
             reg += sizeof(u32), image++) {
                val = iwl_read_prph(priv, reg);
                if (val != le32_to_cpu(*image)) {
-                       IWL_ERROR("BSM uCode verification failed at "
+                       IWL_ERR(priv, "BSM uCode verification failed at "
                                  "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
                                  BSM_SRAM_LOWER_BOUND,
                                  reg - BSM_SRAM_LOWER_BOUND, len,
@@ -94,7 +94,7 @@ static int iwl4965_verify_bsm(struct iwl_priv *priv)
                }
        }
 
-       IWL_DEBUG_INFO("BSM bootstrap uCode image OK\n");
+       IWL_DEBUG_INFO(priv, "BSM bootstrap uCode image OK\n");
 
        return 0;
 }
@@ -144,12 +144,12 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
        u32 reg_offset;
        int ret;
 
-       IWL_DEBUG_INFO("Begin load bsm\n");
+       IWL_DEBUG_INFO(priv, "Begin load bsm\n");
 
        priv->ucode_type = UCODE_RT;
 
        /* make sure bootstrap program is no larger than BSM's SRAM size */
-       if (len > IWL_MAX_BSM_SIZE)
+       if (len > IWL49_MAX_BSM_SIZE)
                return -EINVAL;
 
        /* Tell bootstrap uCode where to find the "Initialize" uCode
@@ -186,7 +186,7 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
 
        /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
        iwl_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
-       iwl_write_prph(priv, BSM_WR_MEM_DST_REG, RTC_INST_LOWER_BOUND);
+       iwl_write_prph(priv, BSM_WR_MEM_DST_REG, IWL49_RTC_INST_LOWER_BOUND);
        iwl_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
 
        /* Load bootstrap code into instruction SRAM now,
@@ -201,9 +201,9 @@ static int iwl4965_load_bsm(struct iwl_priv *priv)
                udelay(10);
        }
        if (i < 100)
-               IWL_DEBUG_INFO("BSM write complete, poll %d iterations\n", i);
+               IWL_DEBUG_INFO(priv, "BSM write complete, poll %d iterations\n", i);
        else {
-               IWL_ERROR("BSM write did not complete!\n");
+               IWL_ERR(priv, "BSM write did not complete!\n");
                return -EIO;
        }
 
@@ -257,7 +257,7 @@ static int iwl4965_set_ucode_ptrs(struct iwl_priv *priv)
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       IWL_DEBUG_INFO("Runtime uCode pointers are set.\n");
+       IWL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n");
 
        return ret;
 }
@@ -279,7 +279,7 @@ static void iwl4965_init_alive_start(struct iwl_priv *priv)
        if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
                /* We had an error bringing up the hardware, so take it
                 * all the way back down so we can try again */
-               IWL_DEBUG_INFO("Initialize Alive failed.\n");
+               IWL_DEBUG_INFO(priv, "Initialize Alive failed.\n");
                goto restart;
        }
 
@@ -289,7 +289,7 @@ static void iwl4965_init_alive_start(struct iwl_priv *priv)
        if (iwl_verify_ucode(priv)) {
                /* Runtime instruction load was bad;
                 * take it all the way back down so we can try again */
-               IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
+               IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n");
                goto restart;
        }
 
@@ -299,11 +299,11 @@ static void iwl4965_init_alive_start(struct iwl_priv *priv)
        /* Send pointers to protocol/runtime uCode image ... init code will
         * load and launch runtime uCode, which will send us another "Alive"
         * notification. */
-       IWL_DEBUG_INFO("Initialization Alive received.\n");
+       IWL_DEBUG_INFO(priv, "Initialization Alive received.\n");
        if (iwl4965_set_ucode_ptrs(priv)) {
                /* Runtime instruction load won't happen;
                 * take it all the way back down so we can try again */
-               IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n");
+               IWL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n");
                goto restart;
        }
        return;
@@ -354,7 +354,7 @@ static int iwl4965_apm_init(struct iwl_priv *priv)
        ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL,
                        CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
        if (ret < 0) {
-               IWL_DEBUG_INFO("Failed to init the card\n");
+               IWL_DEBUG_INFO(priv, "Failed to init the card\n");
                goto out;
        }
 
@@ -381,27 +381,20 @@ out:
 static void iwl4965_nic_config(struct iwl_priv *priv)
 {
        unsigned long flags;
-       u32 val;
        u16 radio_cfg;
-       u16 link;
+       u16 lctl;
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       if ((priv->rev_id & 0x80) == 0x80 && (priv->rev_id & 0x7f) < 8) {
-               pci_read_config_dword(priv->pci_dev, PCI_REG_WUM8, &val);
-               /* Enable No Snoop field */
-               pci_write_config_dword(priv->pci_dev, PCI_REG_WUM8,
-                                      val & ~(1 << 11));
-       }
-
-       pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &link);
+       lctl = iwl_pcie_link_ctl(priv);
 
-       /* L1 is enabled by BIOS */
-       if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN)
-               /* disable L0S disabled L1A enabled */
+       /* HW bug W/A - negligible power consumption */
+       /* L1-ASPM is enabled by BIOS */
+       if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN)
+               /* L1-ASPM enabled: disable L0S  */
                iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
        else
-               /* L0S enabled L1A disabled */
+               /* L1-ASPM disabled: enable L0S */
                iwl_clear_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
 
        radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
@@ -437,7 +430,7 @@ static int iwl4965_apm_stop_master(struct iwl_priv *priv)
                        CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
 
        spin_unlock_irqrestore(&priv->lock, flags);
-       IWL_DEBUG_INFO("stop master\n");
+       IWL_DEBUG_INFO(priv, "stop master\n");
 
        return 0;
 }
@@ -523,9 +516,10 @@ static void iwl4965_chain_noise_reset(struct iwl_priv *priv)
                cmd.diff_gain_c = 0;
                if (iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
                                 sizeof(cmd), &cmd))
-                       IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n");
+                       IWL_ERR(priv,
+                               "Could not send REPLY_PHY_CALIBRATION_CMD\n");
                data->state = IWL_CHAIN_NOISE_ACCUMULATE;
-               IWL_DEBUG_CALIB("Run chain_noise_calibrate\n");
+               IWL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n");
        }
 }
 
@@ -557,7 +551,7 @@ static void iwl4965_gain_computation(struct iwl_priv *priv,
                        data->delta_gain_code[i] = 0;
                }
        }
-       IWL_DEBUG_CALIB("delta_gain_codes: a %d b %d c %d\n",
+       IWL_DEBUG_CALIB(priv, "delta_gain_codes: a %d b %d c %d\n",
                     data->delta_gain_code[0],
                     data->delta_gain_code[1],
                     data->delta_gain_code[2]);
@@ -575,7 +569,7 @@ static void iwl4965_gain_computation(struct iwl_priv *priv,
                ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
                                      sizeof(cmd), &cmd);
                if (ret)
-                       IWL_DEBUG_CALIB("fail sending cmd "
+                       IWL_DEBUG_CALIB(priv, "fail sending cmd "
                                     "REPLY_PHY_CALIBRATION_CMD \n");
 
                /* TODO we might want recalculate
@@ -668,7 +662,7 @@ static void iwl4965_tx_queue_set_status(struct iwl_priv *priv,
 
        txq->sched_retry = scd_retry;
 
-       IWL_DEBUG_INFO("%s %s Queue %d on AC %d\n",
+       IWL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n",
                       active ? "Activate" : "Deactivate",
                       scd_retry ? "BA" : "AC", txq_id, tx_fifo_id);
 }
@@ -804,8 +798,9 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
 
        if ((priv->cfg->mod_params->num_of_queues > IWL49_NUM_QUEUES) ||
            (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) {
-               IWL_ERROR("invalid queues_num, should be between %d and %d\n",
-                         IWL_MIN_NUM_QUEUES, IWL49_NUM_QUEUES);
+               IWL_ERR(priv,
+                       "invalid queues_num, should be between %d and %d\n",
+                       IWL_MIN_NUM_QUEUES, IWL49_NUM_QUEUES);
                return -EINVAL;
        }
 
@@ -813,6 +808,7 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
        priv->hw_params.dma_chnl_num = FH49_TCSR_CHNL_NUM;
        priv->hw_params.scd_bc_tbls_size =
                        IWL49_NUM_QUEUES * sizeof(struct iwl4965_scd_bc_tbl);
+       priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
        priv->hw_params.max_stations = IWL4965_STATION_COUNT;
        priv->hw_params.bcast_sta_id = IWL4965_BROADCAST_ID;
        priv->hw_params.max_data_size = IWL49_RTC_DATA_SIZE;
@@ -820,6 +816,8 @@ static int iwl4965_hw_set_hw_params(struct iwl_priv *priv)
        priv->hw_params.max_bsm_size = BSM_SRAM_SIZE;
        priv->hw_params.fat_channel = BIT(IEEE80211_BAND_5GHZ);
 
+       priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
+
        priv->hw_params.tx_chains_num = 2;
        priv->hw_params.rx_chains_num = 2;
        priv->hw_params.valid_tx_ant = ANT_A | ANT_B;
@@ -902,7 +900,6 @@ static s32 iwl4965_get_tx_atten_grp(u16 channel)
            channel <= CALIB_IWL_TX_ATTEN_GR4_LCH)
                return CALIB_CH_GROUP_4;
 
-       IWL_ERROR("Can't find txatten group for channel %d.\n", channel);
        return -1;
 }
 
@@ -956,7 +953,7 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
 
        s = iwl4965_get_sub_band(priv, channel);
        if (s >= EEPROM_TX_POWER_BANDS) {
-               IWL_ERROR("Tx Power can not find channel %d\n", channel);
+               IWL_ERR(priv, "Tx Power can not find channel %d\n", channel);
                return -1;
        }
 
@@ -964,7 +961,7 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
        ch_i2 = priv->calib_info->band_info[s].ch2.ch_num;
        chan_info->ch_num = (u8) channel;
 
-       IWL_DEBUG_TXPOWER("channel %d subband %d factory cal ch %d & %d\n",
+       IWL_DEBUG_TXPOWER(priv, "channel %d subband %d factory cal ch %d & %d\n",
                          channel, s, ch_i1, ch_i2);
 
        for (c = 0; c < EEPROM_TX_POWER_TX_CHAINS; c++) {
@@ -994,19 +991,19 @@ static int iwl4965_interpolate_chan(struct iwl_priv *priv, u32 channel,
                                                           m1->pa_det, ch_i2,
                                                           m2->pa_det);
 
-                       IWL_DEBUG_TXPOWER
-                           ("chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, m,
-                            m1->actual_pow, m2->actual_pow, omeas->actual_pow);
-                       IWL_DEBUG_TXPOWER
-                           ("chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, m,
-                            m1->gain_idx, m2->gain_idx, omeas->gain_idx);
-                       IWL_DEBUG_TXPOWER
-                           ("chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, m,
-                            m1->pa_det, m2->pa_det, omeas->pa_det);
-                       IWL_DEBUG_TXPOWER
-                           ("chain %d meas %d  T1=%d  T2=%d  T=%d\n", c, m,
-                            m1->temperature, m2->temperature,
-                            omeas->temperature);
+                       IWL_DEBUG_TXPOWER(priv,
+                               "chain %d meas %d AP1=%d AP2=%d AP=%d\n", c, m,
+                               m1->actual_pow, m2->actual_pow, omeas->actual_pow);
+                       IWL_DEBUG_TXPOWER(priv,
+                               "chain %d meas %d NI1=%d NI2=%d NI=%d\n", c, m,
+                               m1->gain_idx, m2->gain_idx, omeas->gain_idx);
+                       IWL_DEBUG_TXPOWER(priv,
+                               "chain %d meas %d PA1=%d PA2=%d PA=%d\n", c, m,
+                               m1->pa_det, m2->pa_det, omeas->pa_det);
+                       IWL_DEBUG_TXPOWER(priv,
+                               "chain %d meas %d  T1=%d  T2=%d  T=%d\n", c, m,
+                               m1->temperature, m2->temperature,
+                               omeas->temperature);
                }
        }
 
@@ -1303,12 +1300,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
        s32 factory_actual_pwr[2];
        s32 power_index;
 
-       /* user_txpower_limit is in dBm, convert to half-dBm (half-dB units
+       /* tx_power_user_lmt is in dBm, convert to half-dBm (half-dB units
         *   are used for indexing into txpower table) */
        user_target_power = 2 * priv->tx_power_user_lmt;
 
        /* Get current (RXON) channel, band, width */
-       IWL_DEBUG_TXPOWER("chan %d band %d is_fat %d\n", channel, band,
+       IWL_DEBUG_TXPOWER(priv, "chan %d band %d is_fat %d\n", channel, band,
                          is_fat);
 
        ch_info = iwl_get_channel_info(priv, priv->band, channel);
@@ -1319,10 +1316,13 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
        /* get txatten group, used to select 1) thermal txpower adjustment
         *   and 2) mimo txpower balance between Tx chains. */
        txatten_grp = iwl4965_get_tx_atten_grp(channel);
-       if (txatten_grp < 0)
+       if (txatten_grp < 0) {
+               IWL_ERR(priv, "Can't find txatten group for channel %d.\n",
+                         channel);
                return -EINVAL;
+       }
 
-       IWL_DEBUG_TXPOWER("channel %d belongs to txatten group %d\n",
+       IWL_DEBUG_TXPOWER(priv, "channel %d belongs to txatten group %d\n",
                          channel, txatten_grp);
 
        if (is_fat) {
@@ -1372,7 +1372,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
        voltage_compensation =
            iwl4965_get_voltage_compensation(voltage, init_voltage);
 
-       IWL_DEBUG_TXPOWER("curr volt %d eeprom volt %d volt comp %d\n",
+       IWL_DEBUG_TXPOWER(priv, "curr volt %d eeprom volt %d volt comp %d\n",
                          init_voltage,
                          voltage, voltage_compensation);
 
@@ -1403,13 +1403,13 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
                factory_gain_index[c] = measurement->gain_idx;
                factory_actual_pwr[c] = measurement->actual_pow;
 
-               IWL_DEBUG_TXPOWER("chain = %d\n", c);
-               IWL_DEBUG_TXPOWER("fctry tmp %d, "
+               IWL_DEBUG_TXPOWER(priv, "chain = %d\n", c);
+               IWL_DEBUG_TXPOWER(priv, "fctry tmp %d, "
                                  "curr tmp %d, comp %d steps\n",
                                  factory_temp, current_temp,
                                  temperature_comp[c]);
 
-               IWL_DEBUG_TXPOWER("fctry idx %d, fctry pwr %d\n",
+               IWL_DEBUG_TXPOWER(priv, "fctry idx %d, fctry pwr %d\n",
                                  factory_gain_index[c],
                                  factory_actual_pwr[c]);
        }
@@ -1442,7 +1442,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
                if (target_power > power_limit)
                        target_power = power_limit;
 
-               IWL_DEBUG_TXPOWER("rate %d sat %d reg %d usr %d tgt %d\n",
+               IWL_DEBUG_TXPOWER(priv, "rate %d sat %d reg %d usr %d tgt %d\n",
                                  i, saturation_power - back_off_table[i],
                                  current_regulatory, user_target_power,
                                  target_power);
@@ -1466,7 +1466,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
                                            voltage_compensation +
                                            atten_value);
 
-/*                     IWL_DEBUG_TXPOWER("calculated txpower index %d\n",
+/*                     IWL_DEBUG_TXPOWER(priv, "calculated txpower index %d\n",
                                                power_index); */
 
                        if (power_index < get_min_power_index(i, band))
@@ -1483,12 +1483,12 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
 
                        /* stay within the table! */
                        if (power_index > 107) {
-                               IWL_WARNING("txpower index %d > 107\n",
+                               IWL_WARN(priv, "txpower index %d > 107\n",
                                            power_index);
                                power_index = 107;
                        }
                        if (power_index < 0) {
-                               IWL_WARNING("txpower index %d < 0\n",
+                               IWL_WARN(priv, "txpower index %d < 0\n",
                                            power_index);
                                power_index = 0;
                        }
@@ -1499,7 +1499,7 @@ static int iwl4965_fill_txpower_tbl(struct iwl_priv *priv, u8 band, u16 channel,
                        tx_power.s.dsp_predis_atten[c] =
                                gain_table[band][power_index].dsp;
 
-                       IWL_DEBUG_TXPOWER("chain %d mimo %d index %d "
+                       IWL_DEBUG_TXPOWER(priv, "chain %d mimo %d index %d "
                                          "gain 0x%02x dsp %d\n",
                                          c, atten_value, power_index,
                                        tx_power.s.radio_tx_gain[c],
@@ -1531,7 +1531,7 @@ static int iwl4965_send_tx_power(struct iwl_priv *priv)
                /* If this gets hit a lot, switch it to a BUG() and catch
                 * the stack trace to find out who is calling this during
                 * a scan. */
-               IWL_WARNING("TX Power requested while scanning!\n");
+               IWL_WARN(priv, "TX Power requested while scanning!\n");
                return -EAGAIN;
        }
 
@@ -1574,7 +1574,7 @@ static int iwl4965_send_rxon_assoc(struct iwl_priv *priv)
             rxon2->ofdm_ht_dual_stream_basic_rates) &&
            (rxon1->rx_chain == rxon2->rx_chain) &&
            (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
-               IWL_DEBUG_INFO("Using current RXON_ASSOC.  Not resending.\n");
+               IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC.  Not resending.\n");
                return 0;
        }
 
@@ -1631,7 +1631,7 @@ static int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel)
        rc = iwl4965_fill_txpower_tbl(priv, band, channel, is_fat,
                                      ctrl_chan_high, &cmd.tx_power);
        if (rc) {
-               IWL_DEBUG_11H("error:%d  fill txpower_tbl\n", rc);
+               IWL_DEBUG_11H(priv, "error:%d  fill txpower_tbl\n", rc);
                return rc;
        }
 
@@ -1696,13 +1696,13 @@ static int iwl4965_hw_get_temperature(const struct iwl_priv *priv)
 
        if (test_bit(STATUS_TEMPERATURE, &priv->status) &&
                (priv->statistics.flag & STATISTICS_REPLY_FLG_FAT_MODE_MSK)) {
-               IWL_DEBUG_TEMP("Running FAT temperature calibration\n");
+               IWL_DEBUG_TEMP(priv, "Running FAT temperature calibration\n");
                R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[1]);
                R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[1]);
                R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[1]);
                R4 = le32_to_cpu(priv->card_alive_init.therm_r4[1]);
        } else {
-               IWL_DEBUG_TEMP("Running temperature calibration\n");
+               IWL_DEBUG_TEMP(priv, "Running temperature calibration\n");
                R1 = (s32)le32_to_cpu(priv->card_alive_init.therm_r1[0]);
                R2 = (s32)le32_to_cpu(priv->card_alive_init.therm_r2[0]);
                R3 = (s32)le32_to_cpu(priv->card_alive_init.therm_r3[0]);
@@ -1722,10 +1722,10 @@ static int iwl4965_hw_get_temperature(const struct iwl_priv *priv)
                vt = sign_extend(
                        le32_to_cpu(priv->statistics.general.temperature), 23);
 
-       IWL_DEBUG_TEMP("Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);
+       IWL_DEBUG_TEMP(priv, "Calib values R[1-3]: %d %d %d R4: %d\n", R1, R2, R3, vt);
 
        if (R3 == R1) {
-               IWL_ERROR("Calibration conflict R1 == R3\n");
+               IWL_ERR(priv, "Calibration conflict R1 == R3\n");
                return -1;
        }
 
@@ -1735,7 +1735,7 @@ static int iwl4965_hw_get_temperature(const struct iwl_priv *priv)
        temperature /= (R3 - R1);
        temperature = (temperature * 97) / 100 + TEMPERATURE_CALIB_KELVIN_OFFSET;
 
-       IWL_DEBUG_TEMP("Calibrated temperature: %dK, %dC\n",
+       IWL_DEBUG_TEMP(priv, "Calibrated temperature: %dK, %dC\n",
                        temperature, KELVIN_TO_CELSIUS(temperature));
 
        return temperature;
@@ -1758,7 +1758,7 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv)
        int temp_diff;
 
        if (!test_bit(STATUS_STATISTICS, &priv->status)) {
-               IWL_DEBUG_TEMP("Temperature not updated -- no statistics.\n");
+               IWL_DEBUG_TEMP(priv, "Temperature not updated -- no statistics.\n");
                return 0;
        }
 
@@ -1766,19 +1766,19 @@ static int iwl4965_is_temp_calib_needed(struct iwl_priv *priv)
 
        /* get absolute value */
        if (temp_diff < 0) {
-               IWL_DEBUG_POWER("Getting cooler, delta %d, \n", temp_diff);
+               IWL_DEBUG_POWER(priv, "Getting cooler, delta %d, \n", temp_diff);
                temp_diff = -temp_diff;
        } else if (temp_diff == 0)
-               IWL_DEBUG_POWER("Same temp, \n");
+               IWL_DEBUG_POWER(priv, "Same temp, \n");
        else
-               IWL_DEBUG_POWER("Getting warmer, delta %d, \n", temp_diff);
+               IWL_DEBUG_POWER(priv, "Getting warmer, delta %d, \n", temp_diff);
 
        if (temp_diff < IWL_TEMPERATURE_THRESHOLD) {
-               IWL_DEBUG_POWER("Thermal txpower calib not needed\n");
+               IWL_DEBUG_POWER(priv, "Thermal txpower calib not needed\n");
                return 0;
        }
 
-       IWL_DEBUG_POWER("Thermal txpower calib needed\n");
+       IWL_DEBUG_POWER(priv, "Thermal txpower calib needed\n");
 
        return 1;
 }
@@ -1793,12 +1793,12 @@ static void iwl4965_temperature_calib(struct iwl_priv *priv)
 
        if (priv->temperature != temp) {
                if (priv->temperature)
-                       IWL_DEBUG_TEMP("Temperature changed "
+                       IWL_DEBUG_TEMP(priv, "Temperature changed "
                                       "from %dC to %dC\n",
                                       KELVIN_TO_CELSIUS(priv->temperature),
                                       KELVIN_TO_CELSIUS(temp));
                else
-                       IWL_DEBUG_TEMP("Temperature "
+                       IWL_DEBUG_TEMP(priv, "Temperature "
                                       "initialized to %dC\n",
                                       KELVIN_TO_CELSIUS(temp));
        }
@@ -1837,7 +1837,8 @@ static int iwl4965_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
 
        if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
            (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) {
-               IWL_WARNING("queue number out of range: %d, must be %d to %d\n",
+               IWL_WARN(priv,
+                       "queue number out of range: %d, must be %d to %d\n",
                        txq_id, IWL49_FIRST_AMPDU_QUEUE,
                        IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1);
                return -EINVAL;
@@ -1908,7 +1909,8 @@ static int iwl4965_txq_agg_enable(struct iwl_priv *priv, int txq_id,
 
        if ((IWL49_FIRST_AMPDU_QUEUE > txq_id) ||
            (IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES <= txq_id)) {
-               IWL_WARNING("queue number out of range: %d, must be %d to %d\n",
+               IWL_WARN(priv,
+                       "queue number out of range: %d, must be %d to %d\n",
                        txq_id, IWL49_FIRST_AMPDU_QUEUE,
                        IWL49_FIRST_AMPDU_QUEUE + IWL49_NUM_AMPDU_QUEUES - 1);
                return -EINVAL;
@@ -1986,8 +1988,8 @@ static u16 iwl4965_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
        addsta->add_immediate_ba_tid = cmd->add_immediate_ba_tid;
        addsta->remove_immediate_ba_tid = cmd->remove_immediate_ba_tid;
        addsta->add_immediate_ba_ssn = cmd->add_immediate_ba_ssn;
-       addsta->reserved1 = __constant_cpu_to_le16(0);
-       addsta->reserved2 = __constant_cpu_to_le32(0);
+       addsta->reserved1 = cpu_to_le16(0);
+       addsta->reserved2 = cpu_to_le32(0);
 
        return (u16)sizeof(struct iwl4965_addsta_cmd);
 }
@@ -2013,7 +2015,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
        int i, sh, idx;
        u16 seq;
        if (agg->wait_for_ba)
-               IWL_DEBUG_TX_REPLY("got tx response w/o block-ack\n");
+               IWL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n");
 
        agg->frame_count = tx_resp->frame_count;
        agg->start_idx = start_idx;
@@ -2027,7 +2029,7 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
                idx = start_idx;
 
                /* FIXME: code repetition */
-               IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n",
+               IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n",
                                   agg->frame_count, agg->start_idx, idx);
 
                info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
@@ -2038,9 +2040,9 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
                iwl_hwrate_to_tx_control(priv, rate_n_flags, info);
                /* FIXME: code repetition end */
 
-               IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
+               IWL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n",
                                    status & 0xff, tx_resp->failure_frame);
-               IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", rate_n_flags);
+               IWL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags);
 
                agg->wait_for_ba = 0;
        } else {
@@ -2060,21 +2062,21 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
                                      AGG_TX_STATE_ABORT_MSK))
                                continue;
 
-                       IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n",
+                       IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n",
                                           agg->frame_count, txq_id, idx);
 
                        hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx);
 
                        sc = le16_to_cpu(hdr->seq_ctrl);
                        if (idx != (SEQ_TO_SN(sc) & 0xff)) {
-                               IWL_ERROR("BUG_ON idx doesn't match seq control"
-                                         " idx=%d, seq_idx=%d, seq=%d\n",
-                                         idx, SEQ_TO_SN(sc),
-                                         hdr->seq_ctrl);
+                               IWL_ERR(priv,
+                                       "BUG_ON idx doesn't match seq control"
+                                       " idx=%d, seq_idx=%d, seq=%d\n",
+                                       idx, SEQ_TO_SN(sc), hdr->seq_ctrl);
                                return -1;
                        }
 
-                       IWL_DEBUG_TX_REPLY("AGG Frame i=%d idx %d seq=%d\n",
+                       IWL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n",
                                           i, idx, SEQ_TO_SN(sc));
 
                        sh = idx - start;
@@ -2092,13 +2094,13 @@ static int iwl4965_tx_status_reply_tx(struct iwl_priv *priv,
                                sh = 0;
                        }
                        bitmap |= 1ULL << sh;
-                       IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n",
+                       IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n",
                                           start, (unsigned long long)bitmap);
                }
 
                agg->bitmap = bitmap;
                agg->start_idx = start;
-               IWL_DEBUG_TX_REPLY("Frames %d start_idx=%d bitmap=0x%llx\n",
+               IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n",
                                   agg->frame_count, agg->start_idx,
                                   (unsigned long long)agg->bitmap);
 
@@ -2129,7 +2131,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
        u8 *qc = NULL;
 
        if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
-               IWL_ERROR("Read index for DMA queue txq_id (%d) index %d "
+               IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
                          "is out of range [0-%d] %d %d\n", txq_id,
                          index, txq->q.n_bd, txq->q.write_ptr,
                          txq->q.read_ptr);
@@ -2147,7 +2149,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
 
        sta_id = iwl_get_ra_sta_id(priv, hdr);
        if (txq->sched_retry && unlikely(sta_id == IWL_INVALID_STATION)) {
-               IWL_ERROR("Station not known\n");
+               IWL_ERR(priv, "Station not known\n");
                return;
        }
 
@@ -2167,7 +2169,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
 
                if (txq->q.read_ptr != (scd_ssn & 0xff)) {
                        index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd);
-                       IWL_DEBUG_TX_REPLY("Retry scheduler reclaim scd_ssn "
+                       IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim scd_ssn "
                                           "%d index %d\n", scd_ssn , index);
                        freed = iwl_tx_queue_reclaim(priv, txq_id, index);
                        priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
@@ -2190,7 +2192,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
                                        le32_to_cpu(tx_resp->rate_n_flags),
                                        info);
 
-               IWL_DEBUG_TX_REPLY("TXQ %d status %s (0x%08x) "
+               IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) "
                                   "rate_n_flags 0x%x retries %d\n",
                                   txq_id,
                                   iwl_get_tx_fail_reason(status), status,
@@ -2210,7 +2212,7 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
                iwl_txq_check_empty(priv, sta_id, tid, txq_id);
 
        if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
-               IWL_ERROR("TODO:  Implement Tx ABORT REQUIRED!!!\n");
+               IWL_ERR(priv, "TODO:  Implement Tx ABORT REQUIRED!!!\n");
 }
 
 static int iwl4965_calc_rssi(struct iwl_priv *priv,
@@ -2238,13 +2240,13 @@ static int iwl4965_calc_rssi(struct iwl_priv *priv,
                if (valid_antennae & (1 << i))
                        max_rssi = max(ncphy->rssi_info[i << 1], max_rssi);
 
-       IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n",
+       IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
                ncphy->rssi_info[0], ncphy->rssi_info[2], ncphy->rssi_info[4],
                max_rssi, agc);
 
        /* dBm = max_rssi dB - agc dB - constant.
         * Higher AGC (higher radio gain) means lower signal. */
-       return max_rssi - agc - IWL_RSSI_OFFSET;
+       return max_rssi - agc - IWL49_RSSI_OFFSET;
 }
 
 
@@ -2287,6 +2289,9 @@ static struct iwl_lib_ops iwl4965_lib = {
        .txq_set_sched = iwl4965_txq_set_sched,
        .txq_agg_enable = iwl4965_txq_agg_enable,
        .txq_agg_disable = iwl4965_txq_agg_disable,
+       .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
+       .txq_free_tfd = iwl_hw_txq_free_tfd,
+       .txq_init = iwl_hw_tx_queue_init,
        .rx_handler_setup = iwl4965_rx_handler_setup,
        .setup_deferred_work = iwl4965_setup_deferred_work,
        .cancel_deferred_work = iwl4965_cancel_deferred_work,
index 82c3859ce0f8bf8fb95ac751ef53810984986458..15cac70e36e2d202d17419e36bc86414f8ace6e0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2007 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #ifndef __iwl_5000_hw_h__
 #define __iwl_5000_hw_h__
 
+#define IWL50_RTC_INST_LOWER_BOUND             (0x000000)
 #define IWL50_RTC_INST_UPPER_BOUND             (0x020000)
+
+#define IWL50_RTC_DATA_LOWER_BOUND             (0x800000)
 #define IWL50_RTC_DATA_UPPER_BOUND             (0x80C000)
-#define IWL50_RTC_INST_SIZE (IWL50_RTC_INST_UPPER_BOUND - RTC_INST_LOWER_BOUND)
-#define IWL50_RTC_DATA_SIZE (IWL50_RTC_DATA_UPPER_BOUND - RTC_DATA_LOWER_BOUND)
+
+#define IWL50_RTC_INST_SIZE (IWL50_RTC_INST_UPPER_BOUND - \
+                               IWL50_RTC_INST_LOWER_BOUND)
+#define IWL50_RTC_DATA_SIZE (IWL50_RTC_DATA_UPPER_BOUND - \
+                               IWL50_RTC_DATA_LOWER_BOUND)
 
 /* EEPROM */
 #define IWL_5000_EEPROM_IMG_SIZE                       2048
index 66d053d28a7470dbb395dd57202edb224cd36b15..ab39f4ae8e324985b1861b6151b6de5200c59a45 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2007-2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -43,6 +43,7 @@
 #include "iwl-sta.h"
 #include "iwl-helpers.h"
 #include "iwl-5000-hw.h"
+#include "iwl-6000-hw.h"
 
 /* Highest firmware API version supported */
 #define IWL5000_UCODE_API_MAX 1
@@ -84,7 +85,7 @@ static int iwl5000_apm_stop_master(struct iwl_priv *priv)
                                  CSR_RESET_REG_FLAG_MASTER_DISABLED, 100);
 
        spin_unlock_irqrestore(&priv->lock, flags);
-       IWL_DEBUG_INFO("stop master\n");
+       IWL_DEBUG_INFO(priv, "stop master\n");
 
        return 0;
 }
@@ -108,7 +109,8 @@ static int iwl5000_apm_init(struct iwl_priv *priv)
        iwl_set_bit(priv, CSR_HW_IF_CONFIG_REG,
                    CSR_HW_IF_CONFIG_REG_BIT_HAP_WAKE_L1A);
 
-       iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
+       if (priv->cfg->need_pll_cfg)
+               iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
 
        /* set "initialization complete" bit to move adapter
         * D0U* --> D0A* state */
@@ -118,7 +120,7 @@ static int iwl5000_apm_init(struct iwl_priv *priv)
        ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL,
                        CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
        if (ret < 0) {
-               IWL_DEBUG_INFO("Failed to init the card\n");
+               IWL_DEBUG_INFO(priv, "Failed to init the card\n");
                return ret;
        }
 
@@ -176,7 +178,8 @@ static int iwl5000_apm_reset(struct iwl_priv *priv)
 
        /* FIXME: put here L1A -L0S w/a */
 
-       iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
+       if (priv->cfg->need_pll_cfg)
+               iwl_set_bit(priv, CSR_ANA_PLL_CFG, CSR50_ANA_PLL_CFG_VAL);
 
        /* set "initialization complete" bit to move adapter
         * D0U* --> D0A* state */
@@ -186,7 +189,7 @@ static int iwl5000_apm_reset(struct iwl_priv *priv)
        ret = iwl_poll_direct_bit(priv, CSR_GP_CNTRL,
                        CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
        if (ret < 0) {
-               IWL_DEBUG_INFO("Failed to init the card\n");
+               IWL_DEBUG_INFO(priv, "Failed to init the card\n");
                goto out;
        }
 
@@ -216,18 +219,19 @@ static void iwl5000_nic_config(struct iwl_priv *priv)
 {
        unsigned long flags;
        u16 radio_cfg;
-       u16 link;
+       u16 lctl;
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &link);
+       lctl = iwl_pcie_link_ctl(priv);
 
-       /* L1 is enabled by BIOS */
-       if ((link & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN)
-               /* disable L0S disabled L1A enabled */
+       /* HW bug W/A */
+       /* L1-ASPM is enabled by BIOS */
+       if ((lctl & PCI_CFG_LINK_CTRL_VAL_L1_EN) == PCI_CFG_LINK_CTRL_VAL_L1_EN)
+               /* L1-APSM enabled: disable L0S  */
                iwl_set_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
        else
-               /* L0S enabled L1A disabled */
+               /* L1-ASPM disabled: enable L0S */
                iwl_clear_bit(priv, CSR_GIO_REG, CSR_GIO_REG_VAL_L0S_ENABLED);
 
        radio_cfg = iwl_eeprom_query16(priv, EEPROM_RADIO_CONFIG);
@@ -289,7 +293,7 @@ static u32 eeprom_indirect_address(const struct iwl_priv *priv, u32 address)
                offset = iwl_eeprom_query16(priv, EEPROM_5000_LINK_OTHERS);
                break;
        default:
-               IWL_ERROR("illegal indirect type: 0x%X\n",
+               IWL_ERR(priv, "illegal indirect type: 0x%X\n",
                address & INDIRECT_TYPE_MSK);
                break;
        }
@@ -338,7 +342,7 @@ static void iwl5000_gain_computation(struct iwl_priv *priv,
                        data->delta_gain_code[i] |= (1 << 2);
        }
 
-       IWL_DEBUG_CALIB("Delta gains: ANT_B = %d  ANT_C = %d\n",
+       IWL_DEBUG_CALIB(priv, "Delta gains: ANT_B = %d  ANT_C = %d\n",
                        data->delta_gain_code[1], data->delta_gain_code[2]);
 
        if (!data->radio_write) {
@@ -384,13 +388,14 @@ static void iwl5000_chain_noise_reset(struct iwl_priv *priv)
                ret = iwl_send_cmd_pdu(priv, REPLY_PHY_CALIBRATION_CMD,
                                        sizeof(cmd), &cmd);
                if (ret)
-                       IWL_ERROR("Could not send REPLY_PHY_CALIBRATION_CMD\n");
+                       IWL_ERR(priv,
+                               "Could not send REPLY_PHY_CALIBRATION_CMD\n");
                data->state = IWL_CHAIN_NOISE_ACCUMULATE;
-               IWL_DEBUG_CALIB("Run chain_noise_calibrate\n");
+               IWL_DEBUG_CALIB(priv, "Run chain_noise_calibrate\n");
        }
 }
 
-static void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
+void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
                        __le32 *tx_flags)
 {
        if ((info->control.rates[0].flags & IEEE80211_TX_RC_USE_RTS_CTS) ||
@@ -507,7 +512,7 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv,
                index = IWL_CALIB_BASE_BAND;
                break;
        default:
-               IWL_ERROR("Unknown calibration notification %d\n",
+               IWL_ERR(priv, "Unknown calibration notification %d\n",
                          hdr->op_code);
                return;
        }
@@ -517,7 +522,7 @@ static void iwl5000_rx_calib_result(struct iwl_priv *priv,
 static void iwl5000_rx_calib_complete(struct iwl_priv *priv,
                               struct iwl_rx_mem_buffer *rxb)
 {
-       IWL_DEBUG_INFO("Init. calibration is completed, restarting fw.\n");
+       IWL_DEBUG_INFO(priv, "Init. calibration is completed, restarting fw.\n");
        queue_work(priv->workqueue, &priv->restart);
 }
 
@@ -580,40 +585,41 @@ static int iwl5000_load_given_ucode(struct iwl_priv *priv,
 {
        int ret = 0;
 
-       ret = iwl5000_load_section(priv, inst_image, RTC_INST_LOWER_BOUND);
+       ret = iwl5000_load_section(priv, inst_image,
+                                  IWL50_RTC_INST_LOWER_BOUND);
        if (ret)
                return ret;
 
-       IWL_DEBUG_INFO("INST uCode section being loaded...\n");
+       IWL_DEBUG_INFO(priv, "INST uCode section being loaded...\n");
        ret = wait_event_interruptible_timeout(priv->wait_command_queue,
                                        priv->ucode_write_complete, 5 * HZ);
        if (ret == -ERESTARTSYS) {
-               IWL_ERROR("Could not load the INST uCode section due "
+               IWL_ERR(priv, "Could not load the INST uCode section due "
                        "to interrupt\n");
                return ret;
        }
        if (!ret) {
-               IWL_ERROR("Could not load the INST uCode section\n");
+               IWL_ERR(priv, "Could not load the INST uCode section\n");
                return -ETIMEDOUT;
        }
 
        priv->ucode_write_complete = 0;
 
        ret = iwl5000_load_section(
-               priv, data_image, RTC_DATA_LOWER_BOUND);
+               priv, data_image, IWL50_RTC_DATA_LOWER_BOUND);
        if (ret)
                return ret;
 
-       IWL_DEBUG_INFO("DATA uCode section being loaded...\n");
+       IWL_DEBUG_INFO(priv, "DATA uCode section being loaded...\n");
 
        ret = wait_event_interruptible_timeout(priv->wait_command_queue,
                                priv->ucode_write_complete, 5 * HZ);
        if (ret == -ERESTARTSYS) {
-               IWL_ERROR("Could not load the INST uCode section due "
+               IWL_ERR(priv, "Could not load the INST uCode section due "
                        "to interrupt\n");
                return ret;
        } else if (!ret) {
-               IWL_ERROR("Could not load the DATA uCode section\n");
+               IWL_ERR(priv, "Could not load the DATA uCode section\n");
                return -ETIMEDOUT;
        } else
                ret = 0;
@@ -629,20 +635,20 @@ static int iwl5000_load_ucode(struct iwl_priv *priv)
 
        /* check whether init ucode should be loaded, or rather runtime ucode */
        if (priv->ucode_init.len && (priv->ucode_type == UCODE_NONE)) {
-               IWL_DEBUG_INFO("Init ucode found. Loading init ucode...\n");
+               IWL_DEBUG_INFO(priv, "Init ucode found. Loading init ucode...\n");
                ret = iwl5000_load_given_ucode(priv,
                        &priv->ucode_init, &priv->ucode_init_data);
                if (!ret) {
-                       IWL_DEBUG_INFO("Init ucode load complete.\n");
+                       IWL_DEBUG_INFO(priv, "Init ucode load complete.\n");
                        priv->ucode_type = UCODE_INIT;
                }
        } else {
-               IWL_DEBUG_INFO("Init ucode not found, or already loaded. "
+               IWL_DEBUG_INFO(priv, "Init ucode not found, or already loaded. "
                        "Loading runtime ucode...\n");
                ret = iwl5000_load_given_ucode(priv,
                        &priv->ucode_code, &priv->ucode_data);
                if (!ret) {
-                       IWL_DEBUG_INFO("Runtime ucode load complete.\n");
+                       IWL_DEBUG_INFO(priv, "Runtime ucode load complete.\n");
                        priv->ucode_type = UCODE_RT;
                }
        }
@@ -658,7 +664,7 @@ static void iwl5000_init_alive_start(struct iwl_priv *priv)
        if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
                /* We had an error bringing up the hardware, so take it
                 * all the way back down so we can try again */
-               IWL_DEBUG_INFO("Initialize Alive failed.\n");
+               IWL_DEBUG_INFO(priv, "Initialize Alive failed.\n");
                goto restart;
        }
 
@@ -668,14 +674,15 @@ static void iwl5000_init_alive_start(struct iwl_priv *priv)
        if (iwl_verify_ucode(priv)) {
                /* Runtime instruction load was bad;
                 * take it all the way back down so we can try again */
-               IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
+               IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n");
                goto restart;
        }
 
        iwl_clear_stations_table(priv);
        ret = priv->cfg->ops->lib->alive_notify(priv);
        if (ret) {
-               IWL_WARNING("Could not complete ALIVE transition: %d\n", ret);
+               IWL_WARN(priv,
+                       "Could not complete ALIVE transition: %d\n", ret);
                goto restart;
        }
 
@@ -710,7 +717,7 @@ static void iwl5000_tx_queue_set_status(struct iwl_priv *priv,
 
        txq->sched_retry = scd_retry;
 
-       IWL_DEBUG_INFO("%s %s Queue %d on AC %d\n",
+       IWL_DEBUG_INFO(priv, "%s %s Queue %d on AC %d\n",
                       active ? "Activate" : "Deactivate",
                       scd_retry ? "BA" : "AC", txq_id, tx_fifo_id);
 }
@@ -824,8 +831,9 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
 {
        if ((priv->cfg->mod_params->num_of_queues > IWL50_NUM_QUEUES) ||
            (priv->cfg->mod_params->num_of_queues < IWL_MIN_NUM_QUEUES)) {
-               IWL_ERROR("invalid queues_num, should be between %d and %d\n",
-                         IWL_MIN_NUM_QUEUES, IWL50_NUM_QUEUES);
+               IWL_ERR(priv,
+                       "invalid queues_num, should be between %d and %d\n",
+                       IWL_MIN_NUM_QUEUES, IWL50_NUM_QUEUES);
                return -EINVAL;
        }
 
@@ -833,70 +841,62 @@ static int iwl5000_hw_set_hw_params(struct iwl_priv *priv)
        priv->hw_params.dma_chnl_num = FH50_TCSR_CHNL_NUM;
        priv->hw_params.scd_bc_tbls_size =
                        IWL50_NUM_QUEUES * sizeof(struct iwl5000_scd_bc_tbl);
+       priv->hw_params.tfd_size = sizeof(struct iwl_tfd);
        priv->hw_params.max_stations = IWL5000_STATION_COUNT;
        priv->hw_params.bcast_sta_id = IWL5000_BROADCAST_ID;
-       priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
-       priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
+
+       switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
+       case CSR_HW_REV_TYPE_6x00:
+       case CSR_HW_REV_TYPE_6x50:
+               priv->hw_params.max_data_size = IWL60_RTC_DATA_SIZE;
+               priv->hw_params.max_inst_size = IWL60_RTC_INST_SIZE;
+               break;
+       default:
+               priv->hw_params.max_data_size = IWL50_RTC_DATA_SIZE;
+               priv->hw_params.max_inst_size = IWL50_RTC_INST_SIZE;
+       }
+
        priv->hw_params.max_bsm_size = 0;
        priv->hw_params.fat_channel =  BIT(IEEE80211_BAND_2GHZ) |
                                        BIT(IEEE80211_BAND_5GHZ);
+       priv->hw_params.rx_wrt_ptr_reg = FH_RSCSR_CHNL0_WPTR;
+
        priv->hw_params.sens = &iwl5000_sensitivity;
 
-       switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-       case CSR_HW_REV_TYPE_5100:
-               priv->hw_params.tx_chains_num = 1;
-               priv->hw_params.rx_chains_num = 2;
-               priv->hw_params.valid_tx_ant = ANT_B;
-               priv->hw_params.valid_rx_ant = ANT_AB;
-               break;
-       case CSR_HW_REV_TYPE_5150:
-               priv->hw_params.tx_chains_num = 1;
-               priv->hw_params.rx_chains_num = 2;
-               priv->hw_params.valid_tx_ant = ANT_A;
-               priv->hw_params.valid_rx_ant = ANT_AB;
-               break;
-       case CSR_HW_REV_TYPE_5300:
-       case CSR_HW_REV_TYPE_5350:
-               priv->hw_params.tx_chains_num = 3;
-               priv->hw_params.rx_chains_num = 3;
-               priv->hw_params.valid_tx_ant = ANT_ABC;
-               priv->hw_params.valid_rx_ant = ANT_ABC;
-               break;
-       }
+       priv->hw_params.tx_chains_num = num_of_ant(priv->cfg->valid_tx_ant);
+       priv->hw_params.rx_chains_num = num_of_ant(priv->cfg->valid_rx_ant);
+       priv->hw_params.valid_tx_ant = priv->cfg->valid_tx_ant;
+       priv->hw_params.valid_rx_ant = priv->cfg->valid_rx_ant;
 
        switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-       case CSR_HW_REV_TYPE_5100:
-       case CSR_HW_REV_TYPE_5300:
-       case CSR_HW_REV_TYPE_5350:
-               /* 5X00 and 5350 wants in Celsius */
-               priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
-               break;
        case CSR_HW_REV_TYPE_5150:
                /* 5150 wants in Kelvin */
                priv->hw_params.ct_kill_threshold =
                                iwl5150_get_ct_threshold(priv);
                break;
+       default:
+               /* all others want Celsius */
+               priv->hw_params.ct_kill_threshold = CT_KILL_THRESHOLD;
+               break;
        }
 
        /* Set initial calibration set */
        switch (priv->hw_rev & CSR_HW_REV_TYPE_MSK) {
-       case CSR_HW_REV_TYPE_5100:
-       case CSR_HW_REV_TYPE_5300:
-       case CSR_HW_REV_TYPE_5350:
+       case CSR_HW_REV_TYPE_5150:
                priv->hw_params.calib_init_cfg =
-                       BIT(IWL_CALIB_XTAL)             |
+                       BIT(IWL_CALIB_DC)               |
                        BIT(IWL_CALIB_LO)               |
                        BIT(IWL_CALIB_TX_IQ)            |
-                       BIT(IWL_CALIB_TX_IQ_PERD)       |
                        BIT(IWL_CALIB_BASE_BAND);
+
                break;
-       case CSR_HW_REV_TYPE_5150:
+       default:
                priv->hw_params.calib_init_cfg =
-                       BIT(IWL_CALIB_DC)               |
+                       BIT(IWL_CALIB_XTAL)             |
                        BIT(IWL_CALIB_LO)               |
                        BIT(IWL_CALIB_TX_IQ)            |
+                       BIT(IWL_CALIB_TX_IQ_PERD)       |
                        BIT(IWL_CALIB_BASE_BAND);
-
                break;
        }
 
@@ -1011,7 +1011,8 @@ static int iwl5000_txq_agg_enable(struct iwl_priv *priv, int txq_id,
 
        if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) ||
            (IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES <= txq_id)) {
-               IWL_WARNING("queue number out of range: %d, must be %d to %d\n",
+               IWL_WARN(priv,
+                       "queue number out of range: %d, must be %d to %d\n",
                        txq_id, IWL50_FIRST_AMPDU_QUEUE,
                        IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES - 1);
                return -EINVAL;
@@ -1076,7 +1077,8 @@ static int iwl5000_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
 
        if ((IWL50_FIRST_AMPDU_QUEUE > txq_id) ||
            (IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES <= txq_id)) {
-               IWL_WARNING("queue number out of range: %d, must be %d to %d\n",
+               IWL_WARN(priv,
+                       "queue number out of range: %d, must be %d to %d\n",
                        txq_id, IWL50_FIRST_AMPDU_QUEUE,
                        IWL50_FIRST_AMPDU_QUEUE + IWL50_NUM_AMPDU_QUEUES - 1);
                return -EINVAL;
@@ -1104,7 +1106,7 @@ static int iwl5000_txq_agg_disable(struct iwl_priv *priv, u16 txq_id,
        return 0;
 }
 
-static u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
+u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd, u8 *data)
 {
        u16 size = (u16)sizeof(struct iwl_addsta_cmd);
        memcpy(data, cmd, size);
@@ -1142,7 +1144,7 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
        u16 seq;
 
        if (agg->wait_for_ba)
-               IWL_DEBUG_TX_REPLY("got tx response w/o block-ack\n");
+               IWL_DEBUG_TX_REPLY(priv, "got tx response w/o block-ack\n");
 
        agg->frame_count = tx_resp->frame_count;
        agg->start_idx = start_idx;
@@ -1156,7 +1158,7 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
                idx = start_idx;
 
                /* FIXME: code repetition */
-               IWL_DEBUG_TX_REPLY("FrameCnt = %d, StartIdx=%d idx=%d\n",
+               IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, StartIdx=%d idx=%d\n",
                                   agg->frame_count, agg->start_idx, idx);
 
                info = IEEE80211_SKB_CB(priv->txq[txq_id].txb[idx].skb[0]);
@@ -1168,9 +1170,9 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
 
                /* FIXME: code repetition end */
 
-               IWL_DEBUG_TX_REPLY("1 Frame 0x%x failure :%d\n",
+               IWL_DEBUG_TX_REPLY(priv, "1 Frame 0x%x failure :%d\n",
                                    status & 0xff, tx_resp->failure_frame);
-               IWL_DEBUG_TX_REPLY("Rate Info rate_n_flags=%x\n", rate_n_flags);
+               IWL_DEBUG_TX_REPLY(priv, "Rate Info rate_n_flags=%x\n", rate_n_flags);
 
                agg->wait_for_ba = 0;
        } else {
@@ -1190,21 +1192,22 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
                                      AGG_TX_STATE_ABORT_MSK))
                                continue;
 
-                       IWL_DEBUG_TX_REPLY("FrameCnt = %d, txq_id=%d idx=%d\n",
+                       IWL_DEBUG_TX_REPLY(priv, "FrameCnt = %d, txq_id=%d idx=%d\n",
                                           agg->frame_count, txq_id, idx);
 
                        hdr = iwl_tx_queue_get_hdr(priv, txq_id, idx);
 
                        sc = le16_to_cpu(hdr->seq_ctrl);
                        if (idx != (SEQ_TO_SN(sc) & 0xff)) {
-                               IWL_ERROR("BUG_ON idx doesn't match seq control"
-                                         " idx=%d, seq_idx=%d, seq=%d\n",
+                               IWL_ERR(priv,
+                                       "BUG_ON idx doesn't match seq control"
+                                       " idx=%d, seq_idx=%d, seq=%d\n",
                                          idx, SEQ_TO_SN(sc),
                                          hdr->seq_ctrl);
                                return -1;
                        }
 
-                       IWL_DEBUG_TX_REPLY("AGG Frame i=%d idx %d seq=%d\n",
+                       IWL_DEBUG_TX_REPLY(priv, "AGG Frame i=%d idx %d seq=%d\n",
                                           i, idx, SEQ_TO_SN(sc));
 
                        sh = idx - start;
@@ -1222,13 +1225,13 @@ static int iwl5000_tx_status_reply_tx(struct iwl_priv *priv,
                                sh = 0;
                        }
                        bitmap |= 1ULL << sh;
-                       IWL_DEBUG_TX_REPLY("start=%d bitmap=0x%llx\n",
+                       IWL_DEBUG_TX_REPLY(priv, "start=%d bitmap=0x%llx\n",
                                           start, (unsigned long long)bitmap);
                }
 
                agg->bitmap = bitmap;
                agg->start_idx = start;
-               IWL_DEBUG_TX_REPLY("Frames %d start_idx=%d bitmap=0x%llx\n",
+               IWL_DEBUG_TX_REPLY(priv, "Frames %d start_idx=%d bitmap=0x%llx\n",
                                   agg->frame_count, agg->start_idx,
                                   (unsigned long long)agg->bitmap);
 
@@ -1254,7 +1257,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
        int freed;
 
        if ((index >= txq->q.n_bd) || (iwl_queue_used(&txq->q, index) == 0)) {
-               IWL_ERROR("Read index for DMA queue txq_id (%d) index %d "
+               IWL_ERR(priv, "Read index for DMA queue txq_id (%d) index %d "
                          "is out of range [0-%d] %d %d\n", txq_id,
                          index, txq->q.n_bd, txq->q.write_ptr,
                          txq->q.read_ptr);
@@ -1281,7 +1284,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
 
                if (txq->q.read_ptr != (scd_ssn & 0xff)) {
                        index = iwl_queue_dec_wrap(scd_ssn & 0xff, txq->q.n_bd);
-                       IWL_DEBUG_TX_REPLY("Retry scheduler reclaim "
+                       IWL_DEBUG_TX_REPLY(priv, "Retry scheduler reclaim "
                                        "scd_ssn=%d idx=%d txq=%d swq=%d\n",
                                        scd_ssn , index, txq_id, txq->swq_id);
 
@@ -1308,7 +1311,7 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
                                        le32_to_cpu(tx_resp->rate_n_flags),
                                        info);
 
-               IWL_DEBUG_TX_REPLY("TXQ %d status %s (0x%08x) rate_n_flags "
+               IWL_DEBUG_TX_REPLY(priv, "TXQ %d status %s (0x%08x) rate_n_flags "
                                   "0x%x retries %d\n",
                                   txq_id,
                                   iwl_get_tx_fail_reason(status), status,
@@ -1328,11 +1331,11 @@ static void iwl5000_rx_reply_tx(struct iwl_priv *priv,
                iwl_txq_check_empty(priv, sta_id, tid, txq_id);
 
        if (iwl_check_bits(status, TX_ABORT_REQUIRED_MSK))
-               IWL_ERROR("TODO:  Implement Tx ABORT REQUIRED!!!\n");
+               IWL_ERR(priv, "TODO:  Implement Tx ABORT REQUIRED!!!\n");
 }
 
 /* Currently 5000 is the superset of everything */
-static u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len)
+u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len)
 {
        return len;
 }
@@ -1356,7 +1359,7 @@ static void iwl5000_rx_handler_setup(struct iwl_priv *priv)
 
 static int iwl5000_hw_valid_rtc_data_addr(u32 addr)
 {
-       return (addr >= RTC_DATA_LOWER_BOUND) &&
+       return (addr >= IWL50_RTC_DATA_LOWER_BOUND) &&
                (addr < IWL50_RTC_DATA_UPPER_BOUND);
 }
 
@@ -1379,7 +1382,7 @@ static int iwl5000_send_rxon_assoc(struct iwl_priv *priv)
            (rxon1->acquisition_data == rxon2->acquisition_data) &&
            (rxon1->rx_chain == rxon2->rx_chain) &&
            (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
-               IWL_DEBUG_INFO("Using current RXON_ASSOC.  Not resending.\n");
+               IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC.  Not resending.\n");
                return 0;
        }
 
@@ -1409,12 +1412,19 @@ static int iwl5000_send_rxon_assoc(struct iwl_priv *priv)
 static int  iwl5000_send_tx_power(struct iwl_priv *priv)
 {
        struct iwl5000_tx_power_dbm_cmd tx_power_cmd;
+       u8 tx_ant_cfg_cmd;
 
        /* half dBm need to multiply */
        tx_power_cmd.global_lmt = (s8)(2 * priv->tx_power_user_lmt);
        tx_power_cmd.flags = IWL50_TX_POWER_NO_CLOSED;
        tx_power_cmd.srv_chan_lmt = IWL50_TX_POWER_AUTO;
-       return  iwl_send_cmd_pdu_async(priv, REPLY_TX_POWER_DBM_CMD,
+
+       if (IWL_UCODE_API(priv->ucode_ver) == 1)
+               tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD_V1;
+       else
+               tx_ant_cfg_cmd = REPLY_TX_POWER_DBM_CMD;
+
+       return  iwl_send_cmd_pdu_async(priv, tx_ant_cfg_cmd,
                                       sizeof(tx_power_cmd), &tx_power_cmd,
                                       NULL);
 }
@@ -1426,7 +1436,7 @@ static void iwl5000_temperature(struct iwl_priv *priv)
 }
 
 /* Calc max signal level (dBm) among 3 possible receivers */
-static int iwl5000_calc_rssi(struct iwl_priv *priv,
+int iwl5000_calc_rssi(struct iwl_priv *priv,
                             struct iwl_rx_phy_res *rx_resp)
 {
        /* data from PHY/DSP regarding signal strength, etc.,
@@ -1455,19 +1465,19 @@ static int iwl5000_calc_rssi(struct iwl_priv *priv,
        max_rssi = max_t(u32, rssi_a, rssi_b);
        max_rssi = max_t(u32, max_rssi, rssi_c);
 
-       IWL_DEBUG_STATS("Rssi In A %d B %d C %d Max %d AGC dB %d\n",
+       IWL_DEBUG_STATS(priv, "Rssi In A %d B %d C %d Max %d AGC dB %d\n",
                rssi_a, rssi_b, rssi_c, max_rssi, agc);
 
        /* dBm = max_rssi dB - agc dB - constant.
         * Higher AGC (higher radio gain) means lower signal. */
-       return max_rssi - agc - IWL_RSSI_OFFSET;
+       return max_rssi - agc - IWL49_RSSI_OFFSET;
 }
 
-static struct iwl_hcmd_ops iwl5000_hcmd = {
+struct iwl_hcmd_ops iwl5000_hcmd = {
        .rxon_assoc = iwl5000_send_rxon_assoc,
 };
 
-static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
+struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
        .get_hcmd_size = iwl5000_get_hcmd_size,
        .build_addsta_hcmd = iwl5000_build_addsta_hcmd,
        .gain_computation = iwl5000_gain_computation,
@@ -1476,13 +1486,16 @@ static struct iwl_hcmd_utils_ops iwl5000_hcmd_utils = {
        .calc_rssi = iwl5000_calc_rssi,
 };
 
-static struct iwl_lib_ops iwl5000_lib = {
+struct iwl_lib_ops iwl5000_lib = {
        .set_hw_params = iwl5000_hw_set_hw_params,
        .txq_update_byte_cnt_tbl = iwl5000_txq_update_byte_cnt_tbl,
        .txq_inval_byte_cnt_tbl = iwl5000_txq_inval_byte_cnt_tbl,
        .txq_set_sched = iwl5000_txq_set_sched,
        .txq_agg_enable = iwl5000_txq_agg_enable,
        .txq_agg_disable = iwl5000_txq_agg_disable,
+       .txq_attach_buf_to_tfd = iwl_hw_txq_attach_buf_to_tfd,
+       .txq_free_tfd = iwl_hw_txq_free_tfd,
+       .txq_init = iwl_hw_tx_queue_init,
        .rx_handler_setup = iwl5000_rx_handler_setup,
        .setup_deferred_work = iwl5000_setup_deferred_work,
        .is_valid_rtc_data_addr = iwl5000_hw_valid_rtc_data_addr,
@@ -1517,13 +1530,13 @@ static struct iwl_lib_ops iwl5000_lib = {
        },
 };
 
-static struct iwl_ops iwl5000_ops = {
+struct iwl_ops iwl5000_ops = {
        .lib = &iwl5000_lib,
        .hcmd = &iwl5000_hcmd,
        .utils = &iwl5000_hcmd_utils,
 };
 
-static struct iwl_mod_params iwl50_mod_params = {
+struct iwl_mod_params iwl50_mod_params = {
        .num_of_queues = IWL50_NUM_QUEUES,
        .num_of_ampdu_queues = IWL50_NUM_AMPDU_QUEUES,
        .amsdu_size_8K = 1,
@@ -1543,6 +1556,9 @@ struct iwl_cfg iwl5300_agn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_ABC,
+       .valid_rx_ant = ANT_ABC,
+       .need_pll_cfg = true,
 };
 
 struct iwl_cfg iwl5100_bg_cfg = {
@@ -1556,6 +1572,9 @@ struct iwl_cfg iwl5100_bg_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_B,
+       .valid_rx_ant = ANT_AB,
+       .need_pll_cfg = true,
 };
 
 struct iwl_cfg iwl5100_abg_cfg = {
@@ -1569,6 +1588,9 @@ struct iwl_cfg iwl5100_abg_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_B,
+       .valid_rx_ant = ANT_AB,
+       .need_pll_cfg = true,
 };
 
 struct iwl_cfg iwl5100_agn_cfg = {
@@ -1582,6 +1604,9 @@ struct iwl_cfg iwl5100_agn_cfg = {
        .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_B,
+       .valid_rx_ant = ANT_AB,
+       .need_pll_cfg = true,
 };
 
 struct iwl_cfg iwl5350_agn_cfg = {
@@ -1595,6 +1620,9 @@ struct iwl_cfg iwl5350_agn_cfg = {
        .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_ABC,
+       .valid_rx_ant = ANT_ABC,
+       .need_pll_cfg = true,
 };
 
 struct iwl_cfg iwl5150_agn_cfg = {
@@ -1608,6 +1636,9 @@ struct iwl_cfg iwl5150_agn_cfg = {
        .eeprom_ver = EEPROM_5050_EEPROM_VERSION,
        .eeprom_calib_ver = EEPROM_5050_TX_POWER_VERSION,
        .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_A,
+       .valid_rx_ant = ANT_AB,
+       .need_pll_cfg = true,
 };
 
 MODULE_FIRMWARE(IWL5000_MODULE_FIRMWARE(IWL5000_UCODE_API_MAX));
similarity index 64%
rename from drivers/net/wireless/iwlwifi/iwl-3945-core.h
rename to drivers/net/wireless/iwlwifi/iwl-6000-hw.h
index 6f463555402c7bb1b751d1ec9846730efca355bc..90185777d98bcb05745edb0fa2317a0ea9c131c8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
  *****************************************************************************/
+/*
+ * Please use this file (iwl-6000-hw.h) only for hardware-related definitions.
+ * Use iwl-5000-commands.h for uCode API definitions.
+ */
 
-#ifndef __iwl_3945_dev_h__
-#define __iwl_3945_dev_h__
-
-#define IWL_PCI_DEVICE(dev, subdev, cfg) \
-       .vendor = PCI_VENDOR_ID_INTEL,  .device = (dev), \
-       .subvendor = PCI_ANY_ID, .subdevice = (subdev), \
-       .driver_data = (kernel_ulong_t)&(cfg)
+#ifndef __iwl_6000_hw_h__
+#define __iwl_6000_hw_h__
 
-#define IWL_SKU_G       0x1
-#define IWL_SKU_A       0x2
+#define IWL60_RTC_INST_LOWER_BOUND             (0x000000)
+#define IWL60_RTC_INST_UPPER_BOUND             (0x040000)
+#define IWL60_RTC_DATA_LOWER_BOUND             (0x800000)
+#define IWL60_RTC_DATA_UPPER_BOUND             (0x814000)
+#define IWL60_RTC_INST_SIZE \
+       (IWL60_RTC_INST_UPPER_BOUND - IWL60_RTC_INST_LOWER_BOUND)
+#define IWL60_RTC_DATA_SIZE \
+       (IWL60_RTC_DATA_UPPER_BOUND - IWL60_RTC_DATA_LOWER_BOUND)
 
-/**
- * struct iwl_3945_cfg
- * @fw_name_pre: Firmware filename prefix. The api version and extension
- *     (.ucode) will be added to filename before loading from disk. The
- *     filename is constructed as fw_name_pre<api>.ucode.
- * @ucode_api_max: Highest version of uCode API supported by driver.
- * @ucode_api_min: Lowest version of uCode API supported by driver.
- *
- * We enable the driver to be backward compatible wrt API version. The
- * driver specifies which APIs it supports (with @ucode_api_max being the
- * highest and @ucode_api_min the lowest). Firmware will only be loaded if
- * it has a supported API version. The firmware's API version will be
- * stored in @iwl_priv, enabling the driver to make runtime changes based
- * on firmware version used.
- *
- * For example,
- * if (IWL_UCODE_API(priv->ucode_ver) >= 2) {
- *     Driver interacts with Firmware API version >= 2.
- * } else {
- *     Driver interacts with Firmware API version 1.
- * }
- */
-struct iwl_3945_cfg {
-       const char *name;
-       const char *fw_name_pre;
-       const unsigned int ucode_api_max;
-       const unsigned int ucode_api_min;
-       unsigned int sku;
-};
+#endif /* __iwl_6000_hw_h__ */
 
-#endif /* __iwl_dev_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-6000.c b/drivers/net/wireless/iwlwifi/iwl-6000.c
new file mode 100644 (file)
index 0000000..edfa5e1
--- /dev/null
@@ -0,0 +1,158 @@
+/******************************************************************************
+ *
+ * Copyright(c) 2008-2009 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
+ *
+ * The full GNU General Public License is included in this distribution in the
+ * file called LICENSE.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless <ilw@linux.intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ *****************************************************************************/
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/dma-mapping.h>
+#include <linux/delay.h>
+#include <linux/skbuff.h>
+#include <linux/netdevice.h>
+#include <linux/wireless.h>
+#include <net/mac80211.h>
+#include <linux/etherdevice.h>
+#include <asm/unaligned.h>
+
+#include "iwl-eeprom.h"
+#include "iwl-dev.h"
+#include "iwl-core.h"
+#include "iwl-io.h"
+#include "iwl-sta.h"
+#include "iwl-helpers.h"
+#include "iwl-5000-hw.h"
+
+/* Highest firmware API version supported */
+#define IWL6000_UCODE_API_MAX 2
+#define IWL6050_UCODE_API_MAX 2
+
+/* Lowest firmware API version supported */
+#define IWL6000_UCODE_API_MIN 1
+#define IWL6050_UCODE_API_MIN 1
+
+#define IWL6000_FW_PRE "iwlwifi-6000-"
+#define _IWL6000_MODULE_FIRMWARE(api) IWL6000_FW_PRE #api ".ucode"
+#define IWL6000_MODULE_FIRMWARE(api) _IWL6000_MODULE_FIRMWARE(api)
+
+#define IWL6050_FW_PRE "iwlwifi-6050-"
+#define _IWL6050_MODULE_FIRMWARE(api) IWL6050_FW_PRE #api ".ucode"
+#define IWL6050_MODULE_FIRMWARE(api) _IWL6050_MODULE_FIRMWARE(api)
+
+static struct iwl_hcmd_utils_ops iwl6000_hcmd_utils = {
+       .get_hcmd_size = iwl5000_get_hcmd_size,
+       .build_addsta_hcmd = iwl5000_build_addsta_hcmd,
+       .rts_tx_cmd_flag = iwl5000_rts_tx_cmd_flag,
+       .calc_rssi = iwl5000_calc_rssi,
+};
+
+static struct iwl_ops iwl6000_ops = {
+       .lib = &iwl5000_lib,
+       .hcmd = &iwl5000_hcmd,
+       .utils = &iwl6000_hcmd_utils,
+};
+
+struct iwl_cfg iwl6000_2ag_cfg = {
+       .name = "6000 Series 2x2 AG",
+       .fw_name_pre = IWL6000_FW_PRE,
+       .ucode_api_max = IWL6000_UCODE_API_MAX,
+       .ucode_api_min = IWL6000_UCODE_API_MIN,
+       .sku = IWL_SKU_A|IWL_SKU_G,
+       .ops = &iwl6000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+       .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
+       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_BC,
+       .valid_rx_ant = ANT_BC,
+       .need_pll_cfg = false,
+};
+
+struct iwl_cfg iwl6000_2agn_cfg = {
+       .name = "6000 Series 2x2 AGN",
+       .fw_name_pre = IWL6000_FW_PRE,
+       .ucode_api_max = IWL6000_UCODE_API_MAX,
+       .ucode_api_min = IWL6000_UCODE_API_MIN,
+       .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
+       .ops = &iwl6000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+       .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
+       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_BC,
+       .valid_rx_ant = ANT_BC,
+       .need_pll_cfg = false,
+};
+
+struct iwl_cfg iwl6050_2agn_cfg = {
+       .name = "6050 Series 2x2 AGN",
+       .fw_name_pre = IWL6050_FW_PRE,
+       .ucode_api_max = IWL6050_UCODE_API_MAX,
+       .ucode_api_min = IWL6050_UCODE_API_MIN,
+       .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
+       .ops = &iwl6000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+       .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
+       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_BC,
+       .valid_rx_ant = ANT_BC,
+       .need_pll_cfg = false,
+};
+
+struct iwl_cfg iwl6000_3agn_cfg = {
+       .name = "6000 Series 3x3 AGN",
+       .fw_name_pre = IWL6000_FW_PRE,
+       .ucode_api_max = IWL6000_UCODE_API_MAX,
+       .ucode_api_min = IWL6000_UCODE_API_MIN,
+       .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
+       .ops = &iwl6000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+       .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
+       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_ABC,
+       .valid_rx_ant = ANT_ABC,
+       .need_pll_cfg = false,
+};
+
+struct iwl_cfg iwl6050_3agn_cfg = {
+       .name = "6050 Series 3x3 AGN",
+       .fw_name_pre = IWL6050_FW_PRE,
+       .ucode_api_max = IWL6050_UCODE_API_MAX,
+       .ucode_api_min = IWL6050_UCODE_API_MIN,
+       .sku = IWL_SKU_A|IWL_SKU_G|IWL_SKU_N,
+       .ops = &iwl6000_ops,
+       .eeprom_size = IWL_5000_EEPROM_IMG_SIZE,
+       .eeprom_ver = EEPROM_5000_EEPROM_VERSION,
+       .eeprom_calib_ver = EEPROM_5000_TX_POWER_VERSION,
+       .mod_params = &iwl50_mod_params,
+       .valid_tx_ant = ANT_ABC,
+       .valid_rx_ant = ANT_ABC,
+       .need_pll_cfg = false,
+};
+
+MODULE_FIRMWARE(IWL6000_MODULE_FIRMWARE(IWL6000_UCODE_API_MAX));
+MODULE_FIRMWARE(IWL6050_MODULE_FIRMWARE(IWL6050_UCODE_API_MAX));
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c b/drivers/net/wireless/iwlwifi/iwl-agn-hcmd-check.c
deleted file mode 100644 (file)
index b8137ee..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/******************************************************************************
- *
- * GPL LICENSE SUMMARY
- *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of version 2 of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
- * USA
- *
- * The full GNU General Public License is included in this distribution
- * in the file called LICENSE.GPL.
- *
- * Contact Information:
- *  Intel Linux Wireless <ilw@linux.intel.com>
- * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
- *****************************************************************************/
-
-#include <linux/kernel.h>
-#include <net/mac80211.h>
-#include "iwl-dev.h"
-#include "iwl-debug.h"
-#include "iwl-commands.h"
-
-
-/**
- * iwl_check_rxon_cmd - validate RXON structure is valid
- *
- * NOTE:  This is really only useful during development and can eventually
- * be #ifdef'd out once the driver is stable and folks aren't actively
- * making changes
- */
-int iwl_agn_check_rxon_cmd(struct iwl_rxon_cmd *rxon)
-{
-       int error = 0;
-       int counter = 1;
-
-       if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
-               error |= le32_to_cpu(rxon->flags &
-                               (RXON_FLG_TGJ_NARROW_BAND_MSK |
-                                RXON_FLG_RADAR_DETECT_MSK));
-               if (error)
-                       IWL_WARNING("check 24G fields %d | %d\n",
-                                   counter++, error);
-       } else {
-               error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
-                               0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
-               if (error)
-                       IWL_WARNING("check 52 fields %d | %d\n",
-                                   counter++, error);
-               error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
-               if (error)
-                       IWL_WARNING("check 52 CCK %d | %d\n",
-                                   counter++, error);
-       }
-       error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
-       if (error)
-               IWL_WARNING("check mac addr %d | %d\n", counter++, error);
-
-       /* make sure basic rates 6Mbps and 1Mbps are supported */
-       error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
-                 ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
-       if (error)
-               IWL_WARNING("check basic rate %d | %d\n", counter++, error);
-
-       error |= (le16_to_cpu(rxon->assoc_id) > 2007);
-       if (error)
-               IWL_WARNING("check assoc id %d | %d\n", counter++, error);
-
-       error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
-                       == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
-       if (error)
-               IWL_WARNING("check CCK and short slot %d | %d\n",
-                           counter++, error);
-
-       error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
-                       == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
-       if (error)
-               IWL_WARNING("check CCK & auto detect %d | %d\n",
-                           counter++, error);
-
-       error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
-                       RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
-       if (error)
-               IWL_WARNING("check TGG and auto detect %d | %d\n",
-                           counter++, error);
-
-       if (error)
-               IWL_WARNING("Tuning to channel %d\n",
-                           le16_to_cpu(rxon->channel));
-
-       if (error) {
-               IWL_ERROR("Not a valid iwl4965_rxon_assoc_cmd field values\n");
-               return -1;
-       }
-       return 0;
-}
-
index 27f50471aed8fd0f4e0349975705b6b06c9e9066..04b42c8a77053d101c82d85a5b44dbfeb3fc973d 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -49,6 +49,8 @@
 #define IWL_RATE_MIN_FAILURE_TH                6       /* min failures to calc tpt */
 #define IWL_RATE_MIN_SUCCESS_TH                8       /* min successes to calc tpt */
 
+/* max allowed rate miss before sync LQ cmd */
+#define IWL_MISSED_RATE_MAX            15
 /* max time to accum history 2 seconds */
 #define IWL_RATE_SCALE_FLUSH_INTVL   (2*HZ)
 
@@ -148,6 +150,8 @@ struct iwl_lq_sta {
        u16 active_mimo2_rate;
        u16 active_mimo3_rate;
        u16 active_rate_basic;
+       s8 max_rate_idx;     /* Max rate set by user */
+       u8 missed_rate_counter;
 
        struct iwl_link_quality_cmd lq;
        struct iwl_scale_tbl_info lq_info[LQ_SIZE]; /* "active", "search" */
@@ -356,7 +360,7 @@ static void rs_tl_turn_on_agg_for_tid(struct iwl_priv *priv,
                                      struct ieee80211_sta *sta)
 {
        if (rs_tl_get_load(lq_data, tid) > IWL_AGG_LOAD_THRESHOLD) {
-               IWL_DEBUG_HT("Starting Tx agg: STA: %pM tid: %d\n",
+               IWL_DEBUG_HT(priv, "Starting Tx agg: STA: %pM tid: %d\n",
                                sta->addr, tid);
                ieee80211_start_tx_ba_session(priv->hw, sta->addr, tid);
        }
@@ -463,8 +467,9 @@ static int rs_collect_tx_data(struct iwl_rate_scale_data *windows,
  * Fill uCode API rate_n_flags field, based on "search" or "active" table.
  */
 /* FIXME:RS:remove this function and put the flags statically in the table */
-static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,
-                                      int index, u8 use_green)
+static u32 rate_n_flags_from_tbl(struct iwl_priv *priv,
+                                struct iwl_scale_tbl_info *tbl,
+                                int index, u8 use_green)
 {
        u32 rate_n_flags = 0;
 
@@ -475,7 +480,7 @@ static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,
 
        } else if (is_Ht(tbl->lq_type)) {
                if (index > IWL_LAST_OFDM_RATE) {
-                       IWL_ERROR("invalid HT rate index %d\n", index);
+                       IWL_ERR(priv, "Invalid HT rate index %d\n", index);
                        index = IWL_LAST_OFDM_RATE;
                }
                rate_n_flags = RATE_MCS_HT_MSK;
@@ -487,7 +492,7 @@ static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,
                else
                        rate_n_flags |= iwl_rates[index].plcp_mimo3;
        } else {
-               IWL_ERROR("Invalid tbl->lq_type %d\n", tbl->lq_type);
+               IWL_ERR(priv, "Invalid tbl->lq_type %d\n", tbl->lq_type);
        }
 
        rate_n_flags |= ((tbl->ant_type << RATE_MCS_ANT_POS) &
@@ -507,7 +512,7 @@ static u32 rate_n_flags_from_tbl(struct iwl_scale_tbl_info *tbl,
                        rate_n_flags |= RATE_MCS_GF_MSK;
                        if (is_siso(tbl->lq_type) && tbl->is_SGI) {
                                rate_n_flags &= ~RATE_MCS_SGI_MSK;
-                               IWL_ERROR("GF was set with SGI:SISO\n");
+                               IWL_ERR(priv, "GF was set with SGI:SISO\n");
                        }
                }
        }
@@ -688,7 +693,7 @@ static u16 rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask,
                        break;
                if (rate_mask & (1 << low))
                        break;
-               IWL_DEBUG_RATE("Skipping masked lower rate: %d\n", low);
+               IWL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low);
        }
 
        high = index;
@@ -698,7 +703,7 @@ static u16 rs_get_adjacent_rate(struct iwl_priv *priv, u8 index, u16 rate_mask,
                        break;
                if (rate_mask & (1 << high))
                        break;
-               IWL_DEBUG_RATE("Skipping masked higher rate: %d\n", high);
+               IWL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high);
        }
 
        return (high << 8) | low;
@@ -758,7 +763,7 @@ static u32 rs_get_lower_rate(struct iwl_lq_sta *lq_sta,
                low = scale_index;
 
 out:
-       return rate_n_flags_from_tbl(tbl, low, is_green);
+       return rate_n_flags_from_tbl(lq_sta->drv, tbl, low, is_green);
 }
 
 /*
@@ -785,7 +790,7 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
        u8 active_index = 0;
        s32 tpt = 0;
 
-       IWL_DEBUG_RATE_LIMIT("get frame ack response, update rate scale window\n");
+       IWL_DEBUG_RATE_LIMIT(priv, "get frame ack response, update rate scale window\n");
 
        if (!ieee80211_is_data(hdr->frame_control) ||
            is_multicast_ether_addr(hdr->addr1))
@@ -835,14 +840,19 @@ static void rs_tx_status(void *priv_r, struct ieee80211_supported_band *sband,
            (!!(tx_rate & RATE_MCS_GF_MSK) != !!(info->status.rates[0].flags & IEEE80211_TX_RC_GREEN_FIELD)) ||
            (hw->wiphy->bands[priv->band]->bitrates[rs_index].bitrate !=
             hw->wiphy->bands[info->band]->bitrates[info->status.rates[0].idx].bitrate)) {
-               IWL_DEBUG_RATE("initial rate does not match 0x%x\n", tx_rate);
+               IWL_DEBUG_RATE(priv, "initial rate does not match 0x%x\n", tx_rate);
                /* the last LQ command could failed so the LQ in ucode not
                 * the same in driver sync up
                 */
-               iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
+               lq_sta->missed_rate_counter++;
+               if (lq_sta->missed_rate_counter > IWL_MISSED_RATE_MAX) {
+                       lq_sta->missed_rate_counter = 0;
+                       iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
+               }
                goto out;
        }
 
+       lq_sta->missed_rate_counter = 0;
        /* Update frame history window with "failure" for each Tx retry. */
        while (retries) {
                /* Look up the rate and other info used for each tx attempt.
@@ -961,7 +971,7 @@ out:
 static void rs_set_stay_in_table(struct iwl_priv *priv, u8 is_legacy,
                                 struct iwl_lq_sta *lq_sta)
 {
-       IWL_DEBUG_RATE("we are staying in the same table\n");
+       IWL_DEBUG_RATE(priv, "we are staying in the same table\n");
        lq_sta->stay_in_tbl = 1;        /* only place this gets set */
        if (is_legacy) {
                lq_sta->table_count_limit = IWL_LEGACY_TABLE_COUNT;
@@ -1129,7 +1139,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
        s32 rate;
        s8 is_green = lq_sta->is_green;
 
-       if (!conf->ht.enabled || !sta->ht_cap.ht_supported)
+       if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
                return -1;
 
        if (((sta->ht_cap.cap & IEEE80211_HT_CAP_SM_PS) >> 2)
@@ -1140,7 +1150,7 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
        if (priv->hw_params.tx_chains_num < 2)
                return -1;
 
-       IWL_DEBUG_RATE("LQ: try to switch to MIMO2\n");
+       IWL_DEBUG_RATE(priv, "LQ: try to switch to MIMO2\n");
 
        tbl->lq_type = LQ_MIMO2;
        tbl->is_dup = lq_sta->is_dup;
@@ -1169,16 +1179,16 @@ static int rs_switch_to_mimo2(struct iwl_priv *priv,
 
        rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index);
 
-       IWL_DEBUG_RATE("LQ: MIMO2 best rate %d mask %X\n", rate, rate_mask);
+       IWL_DEBUG_RATE(priv, "LQ: MIMO2 best rate %d mask %X\n", rate, rate_mask);
 
        if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) {
-               IWL_DEBUG_RATE("Can't switch with index %d rate mask %x\n",
+               IWL_DEBUG_RATE(priv, "Can't switch with index %d rate mask %x\n",
                                                rate, rate_mask);
                return -1;
        }
-       tbl->current_rate = rate_n_flags_from_tbl(tbl, rate, is_green);
+       tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, rate, is_green);
 
-       IWL_DEBUG_RATE("LQ: Switch to new mcs %X index is green %X\n",
+       IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n",
                     tbl->current_rate, is_green);
        return 0;
 }
@@ -1196,10 +1206,10 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
        u8 is_green = lq_sta->is_green;
        s32 rate;
 
-       if (!conf->ht.enabled || !sta->ht_cap.ht_supported)
+       if (!conf_is_ht(conf) || !sta->ht_cap.ht_supported)
                return -1;
 
-       IWL_DEBUG_RATE("LQ: try to switch to SISO\n");
+       IWL_DEBUG_RATE(priv, "LQ: try to switch to SISO\n");
 
        tbl->is_dup = lq_sta->is_dup;
        tbl->lq_type = LQ_SISO;
@@ -1230,14 +1240,14 @@ static int rs_switch_to_siso(struct iwl_priv *priv,
        rs_set_expected_tpt_table(lq_sta, tbl);
        rate = rs_get_best_rate(priv, lq_sta, tbl, rate_mask, index);
 
-       IWL_DEBUG_RATE("LQ: get best rate %d mask %X\n", rate, rate_mask);
+       IWL_DEBUG_RATE(priv, "LQ: get best rate %d mask %X\n", rate, rate_mask);
        if ((rate == IWL_RATE_INVALID) || !((1 << rate) & rate_mask)) {
-               IWL_DEBUG_RATE("can not switch with index %d rate mask %x\n",
+               IWL_DEBUG_RATE(priv, "can not switch with index %d rate mask %x\n",
                             rate, rate_mask);
                return -1;
        }
-       tbl->current_rate = rate_n_flags_from_tbl(tbl, rate, is_green);
-       IWL_DEBUG_RATE("LQ: Switch to new mcs %X index is green %X\n",
+       tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, rate, is_green);
+       IWL_DEBUG_RATE(priv, "LQ: Switch to new mcs %X index is green %X\n",
                     tbl->current_rate, is_green);
        return 0;
 }
@@ -1266,7 +1276,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
                switch (tbl->action) {
                case IWL_LEGACY_SWITCH_ANTENNA1:
                case IWL_LEGACY_SWITCH_ANTENNA2:
-                       IWL_DEBUG_RATE("LQ: Legacy toggle Antenna\n");
+                       IWL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n");
 
                        lq_sta->action_counter++;
 
@@ -1290,7 +1300,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
                        }
                        break;
                case IWL_LEGACY_SWITCH_SISO:
-                       IWL_DEBUG_RATE("LQ: Legacy switch to SISO\n");
+                       IWL_DEBUG_RATE(priv, "LQ: Legacy switch to SISO\n");
 
                        /* Set up search table to try SISO */
                        memcpy(search_tbl, tbl, sz);
@@ -1306,7 +1316,7 @@ static int rs_move_legacy_other(struct iwl_priv *priv,
                case IWL_LEGACY_SWITCH_MIMO2_AB:
                case IWL_LEGACY_SWITCH_MIMO2_AC:
                case IWL_LEGACY_SWITCH_MIMO2_BC:
-                       IWL_DEBUG_RATE("LQ: Legacy switch to MIMO2\n");
+                       IWL_DEBUG_RATE(priv, "LQ: Legacy switch to MIMO2\n");
 
                        /* Set up search table to try MIMO */
                        memcpy(search_tbl, tbl, sz);
@@ -1375,7 +1385,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
                switch (tbl->action) {
                case IWL_SISO_SWITCH_ANTENNA1:
                case IWL_SISO_SWITCH_ANTENNA2:
-                       IWL_DEBUG_RATE("LQ: SISO toggle Antenna\n");
+                       IWL_DEBUG_RATE(priv, "LQ: SISO toggle Antenna\n");
 
                        if ((tbl->action == IWL_SISO_SWITCH_ANTENNA1 &&
                                                        tx_chains_num <= 1) ||
@@ -1394,7 +1404,7 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
                case IWL_SISO_SWITCH_MIMO2_AB:
                case IWL_SISO_SWITCH_MIMO2_AC:
                case IWL_SISO_SWITCH_MIMO2_BC:
-                       IWL_DEBUG_RATE("LQ: SISO switch to MIMO2\n");
+                       IWL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO2\n");
                        memcpy(search_tbl, tbl, sz);
                        search_tbl->is_SGI = 0;
 
@@ -1423,14 +1433,15 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
                                                HT_SHORT_GI_40MHZ))
                                break;
 
-                       IWL_DEBUG_RATE("LQ: SISO toggle SGI/NGI\n");
+                       IWL_DEBUG_RATE(priv, "LQ: SISO toggle SGI/NGI\n");
 
                        memcpy(search_tbl, tbl, sz);
                        if (is_green) {
                                if (!tbl->is_SGI)
                                        break;
                                else
-                                       IWL_ERROR("SGI was set in GF+SISO\n");
+                                       IWL_ERR(priv,
+                                               "SGI was set in GF+SISO\n");
                        }
                        search_tbl->is_SGI = !tbl->is_SGI;
                        rs_set_expected_tpt_table(lq_sta, search_tbl);
@@ -1439,8 +1450,9 @@ static int rs_move_siso_to_other(struct iwl_priv *priv,
                                if (tpt >= search_tbl->expected_tpt[index])
                                        break;
                        }
-                       search_tbl->current_rate = rate_n_flags_from_tbl(
-                                               search_tbl, index, is_green);
+                       search_tbl->current_rate =
+                               rate_n_flags_from_tbl(priv, search_tbl,
+                                                     index, is_green);
                        goto out;
                }
                tbl->action++;
@@ -1486,7 +1498,7 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
                switch (tbl->action) {
                case IWL_MIMO2_SWITCH_ANTENNA1:
                case IWL_MIMO2_SWITCH_ANTENNA2:
-                       IWL_DEBUG_RATE("LQ: MIMO toggle Antennas\n");
+                       IWL_DEBUG_RATE(priv, "LQ: MIMO toggle Antennas\n");
 
                        if (tx_chains_num <= 2)
                                break;
@@ -1502,7 +1514,7 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
                case IWL_MIMO2_SWITCH_SISO_A:
                case IWL_MIMO2_SWITCH_SISO_B:
                case IWL_MIMO2_SWITCH_SISO_C:
-                       IWL_DEBUG_RATE("LQ: MIMO2 switch to SISO\n");
+                       IWL_DEBUG_RATE(priv, "LQ: MIMO2 switch to SISO\n");
 
                        /* Set up new search table for SISO */
                        memcpy(search_tbl, tbl, sz);
@@ -1534,7 +1546,7 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
                                                HT_SHORT_GI_40MHZ))
                                break;
 
-                       IWL_DEBUG_RATE("LQ: MIMO toggle SGI/NGI\n");
+                       IWL_DEBUG_RATE(priv, "LQ: MIMO toggle SGI/NGI\n");
 
                        /* Set up new search table for MIMO */
                        memcpy(search_tbl, tbl, sz);
@@ -1551,8 +1563,9 @@ static int rs_move_mimo_to_other(struct iwl_priv *priv,
                                if (tpt >= search_tbl->expected_tpt[index])
                                        break;
                        }
-                       search_tbl->current_rate = rate_n_flags_from_tbl(
-                                               search_tbl, index, is_green);
+                       search_tbl->current_rate =
+                               rate_n_flags_from_tbl(priv, search_tbl,
+                                                     index, is_green);
                        goto out;
 
                }
@@ -1616,7 +1629,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta)
                    (lq_sta->total_success > lq_sta->max_success_limit) ||
                    ((!lq_sta->search_better_tbl) && (lq_sta->flush_timer)
                     && (flush_interval_passed))) {
-                       IWL_DEBUG_RATE("LQ: stay is expired %d %d %d\n:",
+                       IWL_DEBUG_RATE(priv, "LQ: stay is expired %d %d %d\n:",
                                     lq_sta->total_failed,
                                     lq_sta->total_success,
                                     flush_interval_passed);
@@ -1639,7 +1652,7 @@ static void rs_stay_in_table(struct iwl_lq_sta *lq_sta)
                            lq_sta->table_count_limit) {
                                lq_sta->table_count = 0;
 
-                               IWL_DEBUG_RATE("LQ: stay in table clear win\n");
+                               IWL_DEBUG_RATE(priv, "LQ: stay in table clear win\n");
                                for (i = 0; i < IWL_RATE_COUNT; i++)
                                        rs_rate_scale_clear_window(
                                                &(tbl->win[i]));
@@ -1688,7 +1701,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        s32 sr;
        u8 tid = MAX_TID_COUNT;
 
-       IWL_DEBUG_RATE("rate scale calculate new rate for skb\n");
+       IWL_DEBUG_RATE(priv, "rate scale calculate new rate for skb\n");
 
        /* Send management frames and broadcast/multicast data using
         * lowest rate. */
@@ -1720,13 +1733,13 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        /* current tx rate */
        index = lq_sta->last_txrate_idx;
 
-       IWL_DEBUG_RATE("Rate scale index %d for type %d\n", index,
+       IWL_DEBUG_RATE(priv, "Rate scale index %d for type %d\n", index,
                       tbl->lq_type);
 
        /* rates available for this association, and for modulation mode */
        rate_mask = rs_get_supported_rates(lq_sta, hdr, tbl->lq_type);
 
-       IWL_DEBUG_RATE("mask 0x%04X \n", rate_mask);
+       IWL_DEBUG_RATE(priv, "mask 0x%04X \n", rate_mask);
 
        /* mask with station rate restriction */
        if (is_legacy(tbl->lq_type)) {
@@ -1745,16 +1758,25 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
                rate_scale_index_msk = rate_mask;
 
        if (!((1 << index) & rate_scale_index_msk)) {
-               IWL_ERROR("Current Rate is not valid\n");
+               IWL_ERR(priv, "Current Rate is not valid\n");
                return;
        }
 
        /* Get expected throughput table and history window for current rate */
        if (!tbl->expected_tpt) {
-               IWL_ERROR("tbl->expected_tpt is NULL\n");
+               IWL_ERR(priv, "tbl->expected_tpt is NULL\n");
                return;
        }
 
+       /* force user max rate if set by user */
+       if ((lq_sta->max_rate_idx != -1) &&
+           (lq_sta->max_rate_idx < index)) {
+               index = lq_sta->max_rate_idx;
+               update_lq = 1;
+               window = &(tbl->win[index]);
+               goto lq_update;
+       }
+
        window = &(tbl->win[index]);
 
        /*
@@ -1767,7 +1789,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        fail_count = window->counter - window->success_counter;
        if ((fail_count < IWL_RATE_MIN_FAILURE_TH) &&
                        (window->success_counter < IWL_RATE_MIN_SUCCESS_TH)) {
-               IWL_DEBUG_RATE("LQ: still below TH. succ=%d total=%d "
+               IWL_DEBUG_RATE(priv, "LQ: still below TH. succ=%d total=%d "
                               "for index %d\n",
                               window->success_counter, window->counter, index);
 
@@ -1795,7 +1817,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
                 * continuing to use the setup that we've been trying. */
                if (window->average_tpt > lq_sta->last_tpt) {
 
-                       IWL_DEBUG_RATE("LQ: SWITCHING TO NEW TABLE "
+                       IWL_DEBUG_RATE(priv, "LQ: SWITCHING TO NEW TABLE "
                                        "suc=%d cur-tpt=%d old-tpt=%d\n",
                                        window->success_ratio,
                                        window->average_tpt,
@@ -1811,7 +1833,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
                /* Else poor success; go back to mode in "active" table */
                } else {
 
-                       IWL_DEBUG_RATE("LQ: GOING BACK TO THE OLD TABLE "
+                       IWL_DEBUG_RATE(priv, "LQ: GOING BACK TO THE OLD TABLE "
                                        "suc=%d cur-tpt=%d old-tpt=%d\n",
                                        window->success_ratio,
                                        window->average_tpt,
@@ -1846,6 +1868,11 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
        low = high_low & 0xff;
        high = (high_low >> 8) & 0xff;
 
+       /* If user set max rate, dont allow higher than user constrain */
+       if ((lq_sta->max_rate_idx != -1) &&
+           (lq_sta->max_rate_idx < high))
+               high = IWL_RATE_INVALID;
+
        sr = window->success_ratio;
 
        /* Collect measured throughputs for current and adjacent rates */
@@ -1859,7 +1886,7 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
 
        /* Too many failures, decrease rate */
        if ((sr <= IWL_RATE_DECREASE_TH) || (current_tpt == 0)) {
-               IWL_DEBUG_RATE("decrease rate because of low success_ratio\n");
+               IWL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n");
                scale_action = -1;
 
        /* No throughput measured yet for adjacent rates; try increase. */
@@ -1890,8 +1917,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
                                        sr >= IWL_RATE_INCREASE_TH) {
                                scale_action = 1;
                        } else {
-                               IWL_DEBUG_RATE
-                                   ("decrease rate because of high tpt\n");
+                               IWL_DEBUG_RATE(priv,
+                                   "decrease rate because of high tpt\n");
                                scale_action = -1;
                        }
 
@@ -1899,8 +1926,8 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
                } else if (low_tpt != IWL_INVALID_VALUE) {
                        /* Lower rate has better throughput */
                        if (low_tpt > current_tpt) {
-                               IWL_DEBUG_RATE
-                                   ("decrease rate because of low tpt\n");
+                               IWL_DEBUG_RATE(priv,
+                                   "decrease rate because of low tpt\n");
                                scale_action = -1;
                        } else if (sr >= IWL_RATE_INCREASE_TH) {
                                scale_action = 1;
@@ -1937,14 +1964,14 @@ static void rs_rate_scale_perform(struct iwl_priv *priv,
                break;
        }
 
-       IWL_DEBUG_RATE("choose rate scale index %d action %d low %d "
+       IWL_DEBUG_RATE(priv, "choose rate scale index %d action %d low %d "
                    "high %d type %d\n",
                     index, scale_action, low, high, tbl->lq_type);
 
 lq_update:
        /* Replace uCode's rate table for the destination station. */
        if (update_lq) {
-               rate = rate_n_flags_from_tbl(tbl, index, is_green);
+               rate = rate_n_flags_from_tbl(priv, tbl, index, is_green);
                rs_fill_link_cmd(priv, lq_sta, rate);
                iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
        }
@@ -1981,7 +2008,7 @@ lq_update:
                        /* Use new "search" start rate */
                        index = iwl_hwrate_to_plcp_idx(tbl->current_rate);
 
-                       IWL_DEBUG_RATE("Switch current  mcs: %X index: %d\n",
+                       IWL_DEBUG_RATE(priv, "Switch current  mcs: %X index: %d\n",
                                     tbl->current_rate, index);
                        rs_fill_link_cmd(priv, lq_sta, tbl->current_rate);
                        iwl_send_lq_cmd(priv, &lq_sta->lq, CMD_ASYNC);
@@ -1993,10 +2020,10 @@ lq_update:
                 * stay with best antenna legacy modulation for a while
                 * before next round of mode comparisons. */
                tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]);
-               if (is_legacy(tbl1->lq_type) && !conf->ht.enabled &&
+               if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) &&
                    lq_sta->action_counter >= 1) {
                        lq_sta->action_counter = 0;
-                       IWL_DEBUG_RATE("LQ: STAY in legacy table\n");
+                       IWL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n");
                        rs_set_stay_in_table(priv, 1, lq_sta);
                }
 
@@ -2008,7 +2035,7 @@ lq_update:
                        if ((lq_sta->last_tpt > IWL_AGG_TPT_THREHOLD) &&
                            (lq_sta->tx_agg_tid_en & (1 << tid)) &&
                            (tid != MAX_TID_COUNT)) {
-                               IWL_DEBUG_RATE("try to aggregate tid %d\n", tid);
+                               IWL_DEBUG_RATE(priv, "try to aggregate tid %d\n", tid);
                                rs_tl_turn_on_agg(priv, tid, lq_sta, sta);
                        }
                        lq_sta->action_counter = 0;
@@ -2028,7 +2055,7 @@ lq_update:
        }
 
 out:
-       tbl->current_rate = rate_n_flags_from_tbl(tbl, index, is_green);
+       tbl->current_rate = rate_n_flags_from_tbl(priv, tbl, index, is_green);
        i = index;
        lq_sta->last_txrate_idx = i;
 
@@ -2081,7 +2108,7 @@ static void rs_initialize_lq(struct iwl_priv *priv,
        if (!rs_is_valid_ant(valid_tx_ant, tbl->ant_type))
            rs_toggle_antenna(valid_tx_ant, &rate, tbl);
 
-       rate = rate_n_flags_from_tbl(tbl, rate_idx, use_green);
+       rate = rate_n_flags_from_tbl(priv, tbl, rate_idx, use_green);
        tbl->current_rate = rate;
        rs_set_expected_tpt_table(lq_sta, tbl);
        rs_fill_link_cmd(NULL, lq_sta, rate);
@@ -2104,7 +2131,18 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
        int rate_idx;
        u64 mask_bit = 0;
 
-       IWL_DEBUG_RATE_LIMIT("rate scale calculate new rate for skb\n");
+       IWL_DEBUG_RATE_LIMIT(priv, "rate scale calculate new rate for skb\n");
+
+       /* Get max rate if user set max rate */
+       if (lq_sta) {
+               lq_sta->max_rate_idx = txrc->max_rate_idx;
+               if ((sband->band == IEEE80211_BAND_5GHZ) &&
+                   (lq_sta->max_rate_idx != -1))
+                       lq_sta->max_rate_idx += IWL_FIRST_OFDM_RATE;
+               if ((lq_sta->max_rate_idx < 0) ||
+                   (lq_sta->max_rate_idx >= IWL_RATE_COUNT))
+                       lq_sta->max_rate_idx = -1;
+       }
 
        if (sta)
                mask_bit = sta->supp_rates[sband->band];
@@ -2129,7 +2167,7 @@ static void rs_get_rate(void *priv_r, struct ieee80211_sta *sta, void *priv_sta,
                u8 sta_id = iwl_find_station(priv, hdr->addr1);
 
                if (sta_id == IWL_INVALID_STATION) {
-                       IWL_DEBUG_RATE("LQ: ADD station %pM\n",
+                       IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n",
                                       hdr->addr1);
                        sta_id = iwl_add_station_flags(priv, hdr->addr1,
                                                        0, CMD_ASYNC, NULL);
@@ -2158,7 +2196,7 @@ static void *rs_alloc_sta(void *priv_rate, struct ieee80211_sta *sta,
        int i, j;
 
        priv = (struct iwl_priv *)priv_rate;
-       IWL_DEBUG_RATE("create station rate scale window\n");
+       IWL_DEBUG_RATE(priv, "create station rate scale window\n");
 
        lq_sta = kzalloc(sizeof(struct iwl_lq_sta), gfp);
 
@@ -2182,6 +2220,8 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
        struct ieee80211_conf *conf = &priv->hw->conf;
        struct iwl_lq_sta *lq_sta = priv_sta;
        u16 mask_bit = 0;
+       int count;
+       int start_rate = 0;
 
        lq_sta->flush_timer = 0;
        lq_sta->supp_rates = sta->supp_rates[sband->band];
@@ -2189,7 +2229,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
                for (i = 0; i < IWL_RATE_COUNT; i++)
                        rs_rate_scale_clear_window(&lq_sta->lq_info[j].win[i]);
 
-       IWL_DEBUG_RATE("LQ: *** rate scale station global init ***\n");
+       IWL_DEBUG_RATE(priv, "LQ: *** rate scale station global init ***\n");
        /* TODO: what is a good starting rate for STA? About middle? Maybe not
         * the lowest or the highest rate.. Could consider using RSSI from
         * previous packets? Need to have IEEE 802.1X auth succeed immediately
@@ -2200,10 +2240,10 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
                u8 sta_id = iwl_find_station(priv, sta->addr);
 
                /* for IBSS the call are from tasklet */
-               IWL_DEBUG_RATE("LQ: ADD station %pM\n", sta->addr);
+               IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr);
 
                if (sta_id == IWL_INVALID_STATION) {
-                       IWL_DEBUG_RATE("LQ: ADD station %pM\n", sta->addr);
+                       IWL_DEBUG_RATE(priv, "LQ: ADD station %pM\n", sta->addr);
                        sta_id = iwl_add_station_flags(priv, sta->addr,
                                                        0, CMD_ASYNC, NULL);
                }
@@ -2216,6 +2256,8 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
        }
 
        lq_sta->is_dup = 0;
+       lq_sta->max_rate_idx = -1;
+       lq_sta->missed_rate_counter = IWL_MISSED_RATE_MAX;
        lq_sta->is_green = rs_use_green(priv, conf);
        lq_sta->active_legacy_rate = priv->active_rate & ~(0x1000);
        lq_sta->active_rate_basic = priv->active_rate_basic;
@@ -2240,7 +2282,7 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
        lq_sta->active_mimo3_rate &= ~((u16)0x2);
        lq_sta->active_mimo3_rate <<= IWL_FIRST_OFDM_RATE;
 
-       IWL_DEBUG_RATE("SISO-RATE=%X MIMO2-RATE=%X MIMO3-RATE=%X\n",
+       IWL_DEBUG_RATE(priv, "SISO-RATE=%X MIMO2-RATE=%X MIMO3-RATE=%X\n",
                     lq_sta->active_siso_rate,
                     lq_sta->active_mimo2_rate,
                     lq_sta->active_mimo3_rate);
@@ -2254,16 +2296,20 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,
        lq_sta->drv = priv;
 
        /* Find highest tx rate supported by hardware and destination station */
-       mask_bit = sta->supp_rates[sband->band] & lq_sta->active_legacy_rate;
-       lq_sta->last_txrate_idx = 3;
-       for (i = 0; i < sband->n_bitrates; i++)
+       mask_bit = sta->supp_rates[sband->band];
+       count = sband->n_bitrates;
+       if (sband->band == IEEE80211_BAND_5GHZ) {
+               count += IWL_FIRST_OFDM_RATE;
+               start_rate = IWL_FIRST_OFDM_RATE;
+               mask_bit <<= IWL_FIRST_OFDM_RATE;
+       }
+
+       mask_bit = mask_bit & lq_sta->active_legacy_rate;
+       lq_sta->last_txrate_idx = 4;
+       for (i = start_rate; i < count; i++)
                if (mask_bit & BIT(i))
                        lq_sta->last_txrate_idx = i;
 
-       /* For MODE_IEEE80211A, skip over cck rates in global rate table */
-       if (sband->band == IEEE80211_BAND_5GHZ)
-               lq_sta->last_txrate_idx += IWL_FIRST_OFDM_RATE;
-
        rs_initialize_lq(priv, conf, sta, lq_sta);
 }
 
@@ -2402,9 +2448,9 @@ static void rs_free_sta(void *priv_r, struct ieee80211_sta *sta,
        struct iwl_lq_sta *lq_sta = priv_sta;
        struct iwl_priv *priv __maybe_unused = priv_r;
 
-       IWL_DEBUG_RATE("enter\n");
+       IWL_DEBUG_RATE(priv, "enter\n");
        kfree(lq_sta);
-       IWL_DEBUG_RATE("leave\n");
+       IWL_DEBUG_RATE(priv, "leave\n");
 }
 
 
@@ -2429,9 +2475,9 @@ static void rs_dbgfs_set_mcs(struct iwl_lq_sta *lq_sta,
                        else
                                *rate_n_flags = 0x820A;
                }
-               IWL_DEBUG_RATE("Fixed rate ON\n");
+               IWL_DEBUG_RATE(priv, "Fixed rate ON\n");
        } else {
-               IWL_DEBUG_RATE("Fixed rate OFF\n");
+               IWL_DEBUG_RATE(priv, "Fixed rate OFF\n");
        }
 }
 
@@ -2460,7 +2506,7 @@ static ssize_t rs_sta_dbgfs_scale_table_write(struct file *file,
        lq_sta->active_mimo2_rate  = 0x1FD0;    /* 6 - 60 MBits, no 9, no CCK */
        lq_sta->active_mimo3_rate  = 0x1FD0;    /* 6 - 60 MBits, no 9, no CCK */
 
-       IWL_DEBUG_RATE("sta_id %d rate 0x%X\n",
+       IWL_DEBUG_RATE(priv, "sta_id %d rate 0x%X\n",
                lq_sta->lq.sta_id, lq_sta->dbg_fixed_rate);
 
        if (lq_sta->dbg_fixed_rate) {
index 78ee83adf742d632c440710d4bdd7ec056ffb6f6..345806dd8870b74d1ff792b72be3f797d4af4c07 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -27,8 +27,6 @@
 #ifndef __iwl_agn_rs_h__
 #define __iwl_agn_rs_h__
 
-#include "iwl-dev.h"
-
 struct iwl_rate_info {
        u8 plcp;        /* uCode API:  IWL_RATE_6M_PLCP, etc. */
        u8 plcp_siso;   /* uCode API:  IWL_RATE_SISO_6M_PLCP, etc. */
@@ -43,6 +41,19 @@ struct iwl_rate_info {
        u8 next_rs_tgg;  /* next rate used in TGG rs algo */
 };
 
+struct iwl3945_rate_info {
+       u8 plcp;                /* uCode API:  IWL_RATE_6M_PLCP, etc. */
+       u8 ieee;                /* MAC header:  IWL_RATE_6M_IEEE, etc. */
+       u8 prev_ieee;           /* previous rate in IEEE speeds */
+       u8 next_ieee;           /* next rate in IEEE speeds */
+       u8 prev_rs;             /* previous rate used in rs algo */
+       u8 next_rs;             /* next rate used in rs algo */
+       u8 prev_rs_tgg;         /* previous rate used in TGG rs algo */
+       u8 next_rs_tgg;         /* next rate used in TGG rs algo */
+       u8 table_rs_index;      /* index in rate scale table cmd */
+       u8 prev_table_rs;       /* prev in rate table cmd */
+};
+
 /*
  * These serve as indexes into
  * struct iwl_rate_info iwl_rates[IWL_RATE_COUNT];
@@ -62,12 +73,30 @@ enum {
        IWL_RATE_54M_INDEX,
        IWL_RATE_60M_INDEX,
        IWL_RATE_COUNT, /*FIXME:RS:change to IWL_RATE_INDEX_COUNT,*/
+       IWL_RATE_COUNT_3945 = IWL_RATE_COUNT - 1,
        IWL_RATE_INVM_INDEX = IWL_RATE_COUNT,
        IWL_RATE_INVALID = IWL_RATE_COUNT,
 };
 
+enum {
+       IWL_RATE_6M_INDEX_TABLE = 0,
+       IWL_RATE_9M_INDEX_TABLE,
+       IWL_RATE_12M_INDEX_TABLE,
+       IWL_RATE_18M_INDEX_TABLE,
+       IWL_RATE_24M_INDEX_TABLE,
+       IWL_RATE_36M_INDEX_TABLE,
+       IWL_RATE_48M_INDEX_TABLE,
+       IWL_RATE_54M_INDEX_TABLE,
+       IWL_RATE_1M_INDEX_TABLE,
+       IWL_RATE_2M_INDEX_TABLE,
+       IWL_RATE_5M_INDEX_TABLE,
+       IWL_RATE_11M_INDEX_TABLE,
+       IWL_RATE_INVM_INDEX_TABLE = IWL_RATE_INVM_INDEX - 1,
+};
+
 enum {
        IWL_FIRST_OFDM_RATE = IWL_RATE_6M_INDEX,
+       IWL39_LAST_OFDM_RATE = IWL_RATE_54M_INDEX,
        IWL_LAST_OFDM_RATE = IWL_RATE_60M_INDEX,
        IWL_FIRST_CCK_RATE = IWL_RATE_1M_INDEX,
        IWL_LAST_CCK_RATE = IWL_RATE_11M_INDEX,
@@ -248,6 +277,7 @@ enum {
 #define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y))
 
 extern const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT];
+extern const struct iwl3945_rate_info iwl3945_rates[IWL_RATE_COUNT_3945];
 
 enum iwl_table_type {
        LQ_NONE,
@@ -303,6 +333,23 @@ static inline u8 iwl_get_prev_ieee_rate(u8 rate_index)
        return rate;
 }
 
+static inline u8 iwl3945_get_prev_ieee_rate(u8 rate_index)
+{
+       u8 rate = iwl3945_rates[rate_index].prev_ieee;
+
+       if (rate == IWL_RATE_INVALID)
+               rate = rate_index;
+       return rate;
+}
+
+/**
+ * iwl3945_rate_scale_init - Initialize the rate scale table based on assoc info
+ *
+ * The specific throughput table used is based on the type of network
+ * the associated with, including A, B, G, and G w/ TGG protection
+ */
+extern void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
+
 /**
  * iwl_rate_control_register - Register the rate control algorithm callbacks
  *
@@ -314,6 +361,7 @@ static inline u8 iwl_get_prev_ieee_rate(u8 rate_index)
  *
  */
 extern int iwlagn_rate_control_register(void);
+extern int iwl3945_rate_control_register(void);
 
 /**
  * iwl_rate_control_unregister - Unregister the rate control callbacks
@@ -322,5 +370,6 @@ extern int iwlagn_rate_control_register(void);
  * the driver is unloaded.
  */
 extern void iwlagn_rate_control_unregister(void);
+extern void iwl3945_rate_control_unregister(void);
 
 #endif /* __iwl_agn__rs__ */
index 36bafeb353cefa07e1b4597b247abe3574204315..397577c06c923a33514e6d545744e41b4c8f8330 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -44,6 +44,8 @@
 
 #include <asm/div64.h>
 
+#define DRV_NAME        "iwlagn"
+
 #include "iwl-eeprom.h"
 #include "iwl-dev.h"
 #include "iwl-core.h"
@@ -61,9 +63,7 @@
 
 /*
  * module name, copyright, version, etc.
- * NOTE: DRV_NAME is defined in iwlwifi.h for use by iwl-debug.h and printk
  */
-
 #define DRV_DESCRIPTION        "Intel(R) Wireless WiFi Link AGN driver for Linux"
 
 #ifdef CONFIG_IWLWIFI_DEBUG
@@ -94,66 +94,6 @@ MODULE_ALIAS("iwl4965");
 
 /**************************************************************/
 
-
-
-static void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
-{
-       struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
-
-       if (hw_decrypt)
-               rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
-       else
-               rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK;
-
-}
-
-/**
- * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
- * @priv: staging_rxon is compared to active_rxon
- *
- * If the RXON structure is changing enough to require a new tune,
- * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
- * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
- */
-static int iwl_full_rxon_required(struct iwl_priv *priv)
-{
-
-       /* These items are only settable from the full RXON command */
-       if (!(iwl_is_associated(priv)) ||
-           compare_ether_addr(priv->staging_rxon.bssid_addr,
-                              priv->active_rxon.bssid_addr) ||
-           compare_ether_addr(priv->staging_rxon.node_addr,
-                              priv->active_rxon.node_addr) ||
-           compare_ether_addr(priv->staging_rxon.wlap_bssid_addr,
-                              priv->active_rxon.wlap_bssid_addr) ||
-           (priv->staging_rxon.dev_type != priv->active_rxon.dev_type) ||
-           (priv->staging_rxon.channel != priv->active_rxon.channel) ||
-           (priv->staging_rxon.air_propagation !=
-            priv->active_rxon.air_propagation) ||
-           (priv->staging_rxon.ofdm_ht_single_stream_basic_rates !=
-            priv->active_rxon.ofdm_ht_single_stream_basic_rates) ||
-           (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates !=
-            priv->active_rxon.ofdm_ht_dual_stream_basic_rates) ||
-           (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id))
-               return 1;
-
-       /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can
-        * be updated with the RXON_ASSOC command -- however only some
-        * flag transitions are allowed using RXON_ASSOC */
-
-       /* Check if we are not switching bands */
-       if ((priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) !=
-           (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK))
-               return 1;
-
-       /* Check if we are switching association toggle */
-       if ((priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) !=
-               (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK))
-               return 1;
-
-       return 0;
-}
-
 /**
  * iwl_commit_rxon - commit staging_rxon to hardware
  *
@@ -179,9 +119,9 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
         * 5000, but will not damage 4965 */
        priv->staging_rxon.flags |= RXON_FLG_SELF_CTS_EN;
 
-       ret = iwl_agn_check_rxon_cmd(&priv->staging_rxon);
+       ret = iwl_check_rxon_cmd(priv);
        if (ret) {
-               IWL_ERROR("Invalid RXON configuration.  Not committing.\n");
+               IWL_ERR(priv, "Invalid RXON configuration.  Not committing.\n");
                return -EINVAL;
        }
 
@@ -191,7 +131,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
        if (!iwl_full_rxon_required(priv)) {
                ret = iwl_send_rxon_assoc(priv);
                if (ret) {
-                       IWL_ERROR("Error setting RXON_ASSOC (%d)\n", ret);
+                       IWL_ERR(priv, "Error setting RXON_ASSOC (%d)\n", ret);
                        return ret;
                }
 
@@ -207,7 +147,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
         * we must clear the associated from the active configuration
         * before we apply the new config */
        if (iwl_is_associated(priv) && new_assoc) {
-               IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
+               IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n");
                active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
 
                ret = iwl_send_cmd_pdu(priv, REPLY_RXON,
@@ -218,12 +158,12 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
                 * active_rxon back to what it was previously */
                if (ret) {
                        active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK;
-                       IWL_ERROR("Error clearing ASSOC_MSK (%d)\n", ret);
+                       IWL_ERR(priv, "Error clearing ASSOC_MSK (%d)\n", ret);
                        return ret;
                }
        }
 
-       IWL_DEBUG_INFO("Sending RXON\n"
+       IWL_DEBUG_INFO(priv, "Sending RXON\n"
                       "* with%s RXON_FILTER_ASSOC_MSK\n"
                       "* channel = %d\n"
                       "* bssid = %pM\n",
@@ -242,7 +182,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
                ret = iwl_send_cmd_pdu(priv, REPLY_RXON,
                              sizeof(struct iwl_rxon_cmd), &priv->staging_rxon);
                if (ret) {
-                       IWL_ERROR("Error setting new RXON (%d)\n", ret);
+                       IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
                        return ret;
                }
                memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
@@ -256,7 +196,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
        /* Add the broadcast address so we can send broadcast frames */
        if (iwl_rxon_add_station(priv, iwl_bcast_addr, 0) ==
                                                IWL_INVALID_STATION) {
-               IWL_ERROR("Error adding BROADCAST address for transmit.\n");
+               IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n");
                return -EIO;
        }
 
@@ -267,13 +207,15 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
                        ret = iwl_rxon_add_station(priv,
                                           priv->active_rxon.bssid_addr, 1);
                        if (ret == IWL_INVALID_STATION) {
-                               IWL_ERROR("Error adding AP address for TX.\n");
+                               IWL_ERR(priv,
+                                       "Error adding AP address for TX.\n");
                                return -EIO;
                        }
                        priv->assoc_station_added = 1;
                        if (priv->default_wep_key &&
                            iwl_send_static_wepkey_cmd(priv, 0))
-                               IWL_ERROR("Could not send WEP static key.\n");
+                               IWL_ERR(priv,
+                                       "Could not send WEP static key.\n");
                }
 
                /* Apply the new configuration
@@ -282,7 +224,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
                ret = iwl_send_cmd_pdu(priv, REPLY_RXON,
                              sizeof(struct iwl_rxon_cmd), &priv->staging_rxon);
                if (ret) {
-                       IWL_ERROR("Error setting new RXON (%d)\n", ret);
+                       IWL_ERR(priv, "Error setting new RXON (%d)\n", ret);
                        return ret;
                }
                memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
@@ -294,7 +236,7 @@ static int iwl_commit_rxon(struct iwl_priv *priv)
         * send a new TXPOWER command or we won't be able to Tx any frames */
        ret = iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
        if (ret) {
-               IWL_ERROR("Error sending TX power (%d)\n", ret);
+               IWL_ERR(priv, "Error sending TX power (%d)\n", ret);
                return ret;
        }
 
@@ -308,25 +250,11 @@ void iwl_update_chain_flags(struct iwl_priv *priv)
        iwl_commit_rxon(priv);
 }
 
-static int iwl_send_bt_config(struct iwl_priv *priv)
-{
-       struct iwl_bt_cmd bt_cmd = {
-               .flags = 3,
-               .lead_time = 0xAA,
-               .max_kill = 1,
-               .kill_ack_mask = 0,
-               .kill_cts_mask = 0,
-       };
-
-       return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
-                               sizeof(struct iwl_bt_cmd), &bt_cmd);
-}
-
 static void iwl_clear_free_frames(struct iwl_priv *priv)
 {
        struct list_head *element;
 
-       IWL_DEBUG_INFO("%d frames on pre-allocated heap on clear.\n",
+       IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n",
                       priv->frames_count);
 
        while (!list_empty(&priv->free_frames)) {
@@ -337,7 +265,7 @@ static void iwl_clear_free_frames(struct iwl_priv *priv)
        }
 
        if (priv->frames_count) {
-               IWL_WARNING("%d frames still in use.  Did we lose one?\n",
+               IWL_WARN(priv, "%d frames still in use.  Did we lose one?\n",
                            priv->frames_count);
                priv->frames_count = 0;
        }
@@ -350,7 +278,7 @@ static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv)
        if (list_empty(&priv->free_frames)) {
                frame = kzalloc(sizeof(*frame), GFP_KERNEL);
                if (!frame) {
-                       IWL_ERROR("Could not allocate frame!\n");
+                       IWL_ERR(priv, "Could not allocate frame!\n");
                        return NULL;
                }
 
@@ -386,31 +314,6 @@ static unsigned int iwl_fill_beacon_frame(struct iwl_priv *priv,
        return priv->ibss_beacon->len;
 }
 
-static u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv)
-{
-       int i;
-       int rate_mask;
-
-       /* Set rate mask*/
-       if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
-               rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK;
-       else
-               rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK;
-
-       /* Find lowest valid rate */
-       for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
-                                       i = iwl_rates[i].next_ieee) {
-               if (rate_mask & (1 << i))
-                       return iwl_rates[i].plcp;
-       }
-
-       /* No valid rate was found. Assign the lowest one */
-       if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
-               return IWL_RATE_1M_PLCP;
-       else
-               return IWL_RATE_6M_PLCP;
-}
-
 static unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
                                       struct iwl_frame *frame, u8 rate)
 {
@@ -452,7 +355,7 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
        frame = iwl_get_free_frame(priv);
 
        if (!frame) {
-               IWL_ERROR("Could not obtain free frame buffer for beacon "
+               IWL_ERR(priv, "Could not obtain free frame buffer for beacon "
                          "command.\n");
                return -ENOMEM;
        }
@@ -469,6 +372,159 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv)
        return rc;
 }
 
+static inline dma_addr_t iwl_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx)
+{
+       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
+
+       dma_addr_t addr = get_unaligned_le32(&tb->lo);
+       if (sizeof(dma_addr_t) > sizeof(u32))
+               addr |=
+               ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16;
+
+       return addr;
+}
+
+static inline u16 iwl_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx)
+{
+       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
+
+       return le16_to_cpu(tb->hi_n_len) >> 4;
+}
+
+static inline void iwl_tfd_set_tb(struct iwl_tfd *tfd, u8 idx,
+                                 dma_addr_t addr, u16 len)
+{
+       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
+       u16 hi_n_len = len << 4;
+
+       put_unaligned_le32(addr, &tb->lo);
+       if (sizeof(dma_addr_t) > sizeof(u32))
+               hi_n_len |= ((addr >> 16) >> 16) & 0xF;
+
+       tb->hi_n_len = cpu_to_le16(hi_n_len);
+
+       tfd->num_tbs = idx + 1;
+}
+
+static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
+{
+       return tfd->num_tbs & 0x1f;
+}
+
+/**
+ * iwl_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
+ * @priv - driver private data
+ * @txq - tx queue
+ *
+ * Does NOT advance any TFD circular buffer read/write indexes
+ * Does NOT free the TFD itself (which is within circular buffer)
+ */
+void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
+{
+       struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)txq->tfds;
+       struct iwl_tfd *tfd;
+       struct pci_dev *dev = priv->pci_dev;
+       int index = txq->q.read_ptr;
+       int i;
+       int num_tbs;
+
+       tfd = &tfd_tmp[index];
+
+       /* Sanity check on number of chunks */
+       num_tbs = iwl_tfd_get_num_tbs(tfd);
+
+       if (num_tbs >= IWL_NUM_OF_TBS) {
+               IWL_ERR(priv, "Too many chunks: %i\n", num_tbs);
+               /* @todo issue fatal error, it is quite serious situation */
+               return;
+       }
+
+       /* Unmap tx_cmd */
+       if (num_tbs)
+               pci_unmap_single(dev,
+                               pci_unmap_addr(&txq->cmd[index]->meta, mapping),
+                               pci_unmap_len(&txq->cmd[index]->meta, len),
+                               PCI_DMA_TODEVICE);
+
+       /* Unmap chunks, if any. */
+       for (i = 1; i < num_tbs; i++) {
+               pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i),
+                               iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE);
+
+               if (txq->txb) {
+                       dev_kfree_skb(txq->txb[txq->q.read_ptr].skb[i - 1]);
+                       txq->txb[txq->q.read_ptr].skb[i - 1] = NULL;
+               }
+       }
+}
+
+int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
+                                struct iwl_tx_queue *txq,
+                                dma_addr_t addr, u16 len,
+                                u8 reset, u8 pad)
+{
+       struct iwl_queue *q;
+       struct iwl_tfd *tfd, *tfd_tmp;
+       u32 num_tbs;
+
+       q = &txq->q;
+       tfd_tmp = (struct iwl_tfd *)txq->tfds;
+       tfd = &tfd_tmp[q->write_ptr];
+
+       if (reset)
+               memset(tfd, 0, sizeof(*tfd));
+
+       num_tbs = iwl_tfd_get_num_tbs(tfd);
+
+       /* Each TFD can point to a maximum 20 Tx buffers */
+       if (num_tbs >= IWL_NUM_OF_TBS) {
+               IWL_ERR(priv, "Error can not send more than %d chunks\n",
+                         IWL_NUM_OF_TBS);
+               return -EINVAL;
+       }
+
+       BUG_ON(addr & ~DMA_BIT_MASK(36));
+       if (unlikely(addr & ~IWL_TX_DMA_MASK))
+               IWL_ERR(priv, "Unaligned address = %llx\n",
+                         (unsigned long long)addr);
+
+       iwl_tfd_set_tb(tfd, num_tbs, addr, len);
+
+       return 0;
+}
+
+/*
+ * Tell nic where to find circular buffer of Tx Frame Descriptors for
+ * given Tx queue, and enable the DMA channel used for that queue.
+ *
+ * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA
+ * channels supported in hardware.
+ */
+int iwl_hw_tx_queue_init(struct iwl_priv *priv,
+                        struct iwl_tx_queue *txq)
+{
+       int ret;
+       unsigned long flags;
+       int txq_id = txq->q.id;
+
+       spin_lock_irqsave(&priv->lock, flags);
+       ret = iwl_grab_nic_access(priv);
+       if (ret) {
+               spin_unlock_irqrestore(&priv->lock, flags);
+               return ret;
+       }
+
+       /* Circular buffer (TFD queue in DRAM) physical base address */
+       iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id),
+                            txq->q.dma_addr >> 8);
+
+       iwl_release_nic_access(priv);
+       spin_unlock_irqrestore(&priv->lock, flags);
+
+       return 0;
+}
+
+
 /******************************************************************************
  *
  * Misc. internal state and helper functions
@@ -482,7 +538,7 @@ static void iwl_ht_conf(struct iwl_priv *priv,
        struct iwl_ht_info *iwl_conf = &priv->current_ht_config;
        struct ieee80211_sta *sta;
 
-       IWL_DEBUG_MAC80211("enter: \n");
+       IWL_DEBUG_MAC80211(priv, "enter: \n");
 
        if (!iwl_conf->is_ht)
                return;
@@ -520,9 +576,9 @@ static void iwl_ht_conf(struct iwl_priv *priv,
         */
 
        iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_NONE;
-       if (priv->hw->conf.ht.channel_type == NL80211_CHAN_HT40MINUS)
+       if (conf_is_ht40_minus(&priv->hw->conf))
                iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_BELOW;
-       else if(priv->hw->conf.ht.channel_type == NL80211_CHAN_HT40PLUS)
+       else if (conf_is_ht40_plus(&priv->hw->conf))
                iwl_conf->extension_chan_offset = IEEE80211_HT_PARAM_CHA_SEC_ABOVE;
 
        /* If no above or below channel supplied disable FAT channel */
@@ -542,7 +598,7 @@ static void iwl_ht_conf(struct iwl_priv *priv,
 
        rcu_read_unlock();
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
 /*
@@ -567,7 +623,7 @@ static void iwl_activate_qos(struct iwl_priv *priv, u8 force)
                priv->qos_data.def_qos_parm.qos_flags |= QOS_PARAM_FLG_TGN_MSK;
 
        if (force || iwl_is_associated(priv)) {
-               IWL_DEBUG_QOS("send QoS cmd with Qos active=%d FLAGS=0x%X\n",
+               IWL_DEBUG_QOS(priv, "send QoS cmd with Qos active=%d FLAGS=0x%X\n",
                                priv->qos_data.qos_active,
                                priv->qos_data.def_qos_parm.qos_flags);
 
@@ -624,117 +680,16 @@ static void iwl_setup_rxon_timing(struct iwl_priv *priv)
        priv->rxon_timing.beacon_init_val = cpu_to_le32(interval_tm - rem);
 
        spin_unlock_irqrestore(&priv->lock, flags);
-       IWL_DEBUG_ASSOC("beacon interval %d beacon timer %d beacon tim %d\n",
+       IWL_DEBUG_ASSOC(priv, "beacon interval %d beacon timer %d beacon tim %d\n",
                        le16_to_cpu(priv->rxon_timing.beacon_interval),
                        le32_to_cpu(priv->rxon_timing.beacon_init_val),
                        le16_to_cpu(priv->rxon_timing.atim_window));
 }
 
-static void iwl_set_flags_for_band(struct iwl_priv *priv,
-                                  enum ieee80211_band band)
-{
-       if (band == IEEE80211_BAND_5GHZ) {
-               priv->staging_rxon.flags &=
-                   ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK
-                     | RXON_FLG_CCK_MSK);
-               priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
-       } else {
-               /* Copied from iwl_post_associate() */
-               if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
-                       priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
-               else
-                       priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
-
-               if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
-                       priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
-
-               priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK;
-               priv->staging_rxon.flags |= RXON_FLG_AUTO_DETECT_MSK;
-               priv->staging_rxon.flags &= ~RXON_FLG_CCK_MSK;
-       }
-}
-
-/*
- * initialize rxon structure with default values from eeprom
- */
-static void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode)
-{
-       const struct iwl_channel_info *ch_info;
-
-       memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
-
-       switch (mode) {
-       case NL80211_IFTYPE_AP:
-               priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP;
-               break;
-
-       case NL80211_IFTYPE_STATION:
-               priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS;
-               priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
-               break;
-
-       case NL80211_IFTYPE_ADHOC:
-               priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS;
-               priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
-               priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK |
-                                                 RXON_FILTER_ACCEPT_GRP_MSK;
-               break;
-
-       case NL80211_IFTYPE_MONITOR:
-               priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER;
-               priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK |
-                   RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
-               break;
-       default:
-               IWL_ERROR("Unsupported interface type %d\n", mode);
-               break;
-       }
-
-#if 0
-       /* TODO:  Figure out when short_preamble would be set and cache from
-        * that */
-       if (!hw_to_local(priv->hw)->short_preamble)
-               priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
-       else
-               priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
-#endif
-
-       ch_info = iwl_get_channel_info(priv, priv->band,
-                                      le16_to_cpu(priv->active_rxon.channel));
-
-       if (!ch_info)
-               ch_info = &priv->channel_info[0];
-
-       /*
-        * in some case A channels are all non IBSS
-        * in this case force B/G channel
-        */
-       if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
-           !(is_channel_ibss(ch_info)))
-               ch_info = &priv->channel_info[0];
-
-       priv->staging_rxon.channel = cpu_to_le16(ch_info->channel);
-       priv->band = ch_info->band;
-
-       iwl_set_flags_for_band(priv, priv->band);
-
-       priv->staging_rxon.ofdm_basic_rates =
-           (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
-       priv->staging_rxon.cck_basic_rates =
-           (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
-
-       priv->staging_rxon.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK |
-                                       RXON_FLG_CHANNEL_MODE_PURE_40_MSK);
-       memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
-       memcpy(priv->staging_rxon.wlap_bssid_addr, priv->mac_addr, ETH_ALEN);
-       priv->staging_rxon.ofdm_ht_single_stream_basic_rates = 0xff;
-       priv->staging_rxon.ofdm_ht_dual_stream_basic_rates = 0xff;
-       iwl_set_rxon_chain(priv);
-}
-
 static int iwl_set_mode(struct iwl_priv *priv, int mode)
 {
        iwl_connection_init_rx_config(priv, mode);
+       iwl_set_rxon_chain(priv);
        memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
 
        iwl_clear_stations_table(priv);
@@ -745,8 +700,8 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
 
        cancel_delayed_work(&priv->scan_check);
        if (iwl_scan_cancel_timeout(priv, 100)) {
-               IWL_WARNING("Aborted scan still in progress after 100ms\n");
-               IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
+               IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
+               IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
                return -EAGAIN;
        }
 
@@ -755,54 +710,6 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)
        return 0;
 }
 
-static void iwl_set_rate(struct iwl_priv *priv)
-{
-       const struct ieee80211_supported_band *hw = NULL;
-       struct ieee80211_rate *rate;
-       int i;
-
-       hw = iwl_get_hw_mode(priv, priv->band);
-       if (!hw) {
-               IWL_ERROR("Failed to set rate: unable to get hw mode\n");
-               return;
-       }
-
-       priv->active_rate = 0;
-       priv->active_rate_basic = 0;
-
-       for (i = 0; i < hw->n_bitrates; i++) {
-               rate = &(hw->bitrates[i]);
-               if (rate->hw_value < IWL_RATE_COUNT)
-                       priv->active_rate |= (1 << rate->hw_value);
-       }
-
-       IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
-                      priv->active_rate, priv->active_rate_basic);
-
-       /*
-        * If a basic rate is configured, then use it (adding IWL_RATE_1M_MASK)
-        * otherwise set it to the default of all CCK rates and 6, 12, 24 for
-        * OFDM
-        */
-       if (priv->active_rate_basic & IWL_CCK_BASIC_RATES_MASK)
-               priv->staging_rxon.cck_basic_rates =
-                   ((priv->active_rate_basic &
-                     IWL_CCK_RATES_MASK) >> IWL_FIRST_CCK_RATE) & 0xF;
-       else
-               priv->staging_rxon.cck_basic_rates =
-                   (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
-
-       if (priv->active_rate_basic & IWL_OFDM_BASIC_RATES_MASK)
-               priv->staging_rxon.ofdm_basic_rates =
-                   ((priv->active_rate_basic &
-                     (IWL_OFDM_BASIC_RATES_MASK | IWL_RATE_6M_MASK)) >>
-                     IWL_FIRST_OFDM_RATE) & 0xFF;
-       else
-               priv->staging_rxon.ofdm_basic_rates =
-                  (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
-}
-
-
 /******************************************************************************
  *
  * Generic RX handler implementations
@@ -817,19 +724,19 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
 
        palive = &pkt->u.alive_frame;
 
-       IWL_DEBUG_INFO("Alive ucode status 0x%08X revision "
+       IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision "
                       "0x%01X 0x%01X\n",
                       palive->is_valid, palive->ver_type,
                       palive->ver_subtype);
 
        if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
-               IWL_DEBUG_INFO("Initialization Alive received.\n");
+               IWL_DEBUG_INFO(priv, "Initialization Alive received.\n");
                memcpy(&priv->card_alive_init,
                       &pkt->u.alive_frame,
                       sizeof(struct iwl_init_alive_resp));
                pwork = &priv->init_alive_start;
        } else {
-               IWL_DEBUG_INFO("Runtime Alive received.\n");
+               IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
                memcpy(&priv->card_alive, &pkt->u.alive_frame,
                       sizeof(struct iwl_alive_resp));
                pwork = &priv->alive_start;
@@ -841,7 +748,7 @@ static void iwl_rx_reply_alive(struct iwl_priv *priv,
                queue_delayed_work(priv->workqueue, pwork,
                                   msecs_to_jiffies(5));
        else
-               IWL_WARNING("uCode did not respond OK.\n");
+               IWL_WARN(priv, "uCode did not respond OK.\n");
 }
 
 static void iwl_rx_reply_error(struct iwl_priv *priv,
@@ -849,7 +756,7 @@ static void iwl_rx_reply_error(struct iwl_priv *priv,
 {
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
 
-       IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) "
+       IWL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) "
                "seq 0x%04X ser 0x%08X\n",
                le32_to_cpu(pkt->u.err_resp.error_type),
                get_cmd_string(pkt->u.err_resp.cmd_id),
@@ -858,26 +765,13 @@ static void iwl_rx_reply_error(struct iwl_priv *priv,
                le32_to_cpu(pkt->u.err_resp.error_info));
 }
 
-#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
-
-static void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
-{
-       struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
-       struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon;
-       struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
-       IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
-                     le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
-       rxon->channel = csa->channel;
-       priv->staging_rxon.channel = csa->channel;
-}
-
 static void iwl_rx_pm_sleep_notif(struct iwl_priv *priv,
                                      struct iwl_rx_mem_buffer *rxb)
 {
 #ifdef CONFIG_IWLWIFI_DEBUG
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
        struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif);
-       IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
+       IWL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n",
                     sleep->pm_sleep_mode, sleep->pm_wakeup_src);
 #endif
 }
@@ -886,7 +780,7 @@ static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
                                             struct iwl_rx_mem_buffer *rxb)
 {
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
-       IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
+       IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled "
                        "notification for %s:\n",
                        le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
        iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
@@ -902,7 +796,7 @@ static void iwl_bg_beacon_update(struct work_struct *work)
        beacon = ieee80211_beacon_get(priv->hw, priv->vif);
 
        if (!beacon) {
-               IWL_ERROR("update beacon failed\n");
+               IWL_ERR(priv, "update beacon failed\n");
                return;
        }
 
@@ -950,7 +844,7 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv,
                (struct iwl4965_beacon_notif *)pkt->u.raw;
        u8 rate = iwl_hw_get_rate(beacon->beacon_notify_hdr.rate_n_flags);
 
-       IWL_DEBUG_RX("beacon status %x retries %d iss %d "
+       IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d "
                "tsf %d %d rate %d\n",
                le32_to_cpu(beacon->beacon_notify_hdr.u.status) & TX_STATUS_MSK,
                beacon->beacon_notify_hdr.failure_frame,
@@ -973,7 +867,7 @@ static void iwl_rx_card_state_notif(struct iwl_priv *priv,
        u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
        unsigned long status = priv->status;
 
-       IWL_DEBUG_RF_KILL("Card state received: HW:%s SW:%s\n",
+       IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s\n",
                          (flags & HW_CARD_DISABLED) ? "Kill" : "On",
                          (flags & SW_CARD_DISABLED) ? "Kill" : "On");
 
@@ -1046,11 +940,7 @@ int iwl_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src)
                goto err;
 
        if (src == IWL_PWR_SRC_VAUX) {
-               u32 val;
-               ret = pci_read_config_dword(priv->pci_dev, PCI_CFG_POWER_SOURCE,
-                                           &val);
-
-               if (val & PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT)
+               if (pci_pme_capable(priv->pci_dev, PCI_D3cold))
                        iwl_set_bits_mask_prph(priv, APMG_PS_CTRL_REG,
                                               APMG_PS_CTRL_VAL_PWR_SRC_VAUX,
                                               ~APMG_PS_CTRL_MSK_PWR_SRC);
@@ -1135,7 +1025,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
 
        /* Rx interrupt, but nothing sent from uCode */
        if (i == r)
-               IWL_DEBUG(IWL_DL_RX, "r = %d, i = %d\n", r, i);
+               IWL_DEBUG_RX(priv, "r = %d, i = %d\n", r, i);
 
        if (iwl_rx_queue_space(rxq) > (RX_QUEUE_SIZE / 2))
                fill_rx = 1;
@@ -1175,12 +1065,12 @@ void iwl_rx_handle(struct iwl_priv *priv)
                 *   handle those that need handling via function in
                 *   rx_handlers table.  See iwl_setup_rx_handlers() */
                if (priv->rx_handlers[pkt->hdr.cmd]) {
-                       IWL_DEBUG(IWL_DL_RX, "r = %d, i = %d, %s, 0x%02x\n", r,
+                       IWL_DEBUG_RX(priv, "r = %d, i = %d, %s, 0x%02x\n", r,
                                i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
                        priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
                } else {
                        /* No handling needed */
-                       IWL_DEBUG(IWL_DL_RX,
+                       IWL_DEBUG_RX(priv,
                                "r %d i %d No handler needed for %s, 0x%02x\n",
                                r, i, get_cmd_string(pkt->hdr.cmd),
                                pkt->hdr.cmd);
@@ -1193,7 +1083,7 @@ void iwl_rx_handle(struct iwl_priv *priv)
                        if (rxb && rxb->skb)
                                iwl_tx_cmd_complete(priv, rxb);
                        else
-                               IWL_WARNING("Claim null rxb?\n");
+                               IWL_WARN(priv, "Claim null rxb?\n");
                }
 
                /* For now we just don't re-use anything.  We can tweak this
@@ -1229,27 +1119,6 @@ void iwl_rx_handle(struct iwl_priv *priv)
        iwl_rx_queue_restock(priv);
 }
 
-#ifdef CONFIG_IWLWIFI_DEBUG
-static void iwl_print_rx_config_cmd(struct iwl_priv *priv)
-{
-       struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
-
-       IWL_DEBUG_RADIO("RX CONFIG:\n");
-       iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
-       IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
-       IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
-       IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
-                       le32_to_cpu(rxon->filter_flags));
-       IWL_DEBUG_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type);
-       IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n",
-                       rxon->ofdm_basic_rates);
-       IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates);
-       IWL_DEBUG_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr);
-       IWL_DEBUG_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr);
-       IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id));
-}
-#endif
-
 /* call this function to flush any scheduled tasklet */
 static inline void iwl_synchronize_irq(struct iwl_priv *priv)
 {
@@ -1258,45 +1127,6 @@ static inline void iwl_synchronize_irq(struct iwl_priv *priv)
        tasklet_kill(&priv->irq_tasklet);
 }
 
-/**
- * iwl_irq_handle_error - called for HW or SW error interrupt from card
- */
-static void iwl_irq_handle_error(struct iwl_priv *priv)
-{
-       /* Set the FW error flag -- cleared on iwl_down */
-       set_bit(STATUS_FW_ERROR, &priv->status);
-
-       /* Cancel currently queued command. */
-       clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
-
-#ifdef CONFIG_IWLWIFI_DEBUG
-       if (priv->debug_level & IWL_DL_FW_ERRORS) {
-               iwl_dump_nic_error_log(priv);
-               iwl_dump_nic_event_log(priv);
-               iwl_print_rx_config_cmd(priv);
-       }
-#endif
-
-       wake_up_interruptible(&priv->wait_command_queue);
-
-       /* Keep the restart process from trying to send host
-        * commands by clearing the INIT status bit */
-       clear_bit(STATUS_READY, &priv->status);
-
-       if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-               IWL_DEBUG(IWL_DL_FW_ERRORS,
-                         "Restarting adapter due to uCode error.\n");
-
-               if (iwl_is_associated(priv)) {
-                       memcpy(&priv->recovery_rxon, &priv->active_rxon,
-                              sizeof(priv->recovery_rxon));
-                       priv->error_recovering = 1;
-               }
-               if (priv->cfg->mod_params->restart_fw)
-                       queue_work(priv->workqueue, &priv->restart);
-       }
-}
-
 static void iwl_error_recovery(struct iwl_priv *priv)
 {
        unsigned long flags;
@@ -1341,7 +1171,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
        if (priv->debug_level & IWL_DL_ISR) {
                /* just for debug */
                inta_mask = iwl_read32(priv, CSR_INT_MASK);
-               IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
+               IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
                              inta, inta_mask, inta_fh);
        }
 #endif
@@ -1357,7 +1187,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
 
        /* Now service all interrupt bits discovered above. */
        if (inta & CSR_INT_BIT_HW_ERR) {
-               IWL_ERROR("Microcode HW error detected.  Restarting.\n");
+               IWL_ERR(priv, "Microcode HW error detected.  Restarting.\n");
 
                /* Tell the device to stop sending interrupts */
                iwl_disable_interrupts(priv);
@@ -1375,12 +1205,12 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
        if (priv->debug_level & (IWL_DL_ISR)) {
                /* NIC fires this, but we don't use it, redundant with WAKEUP */
                if (inta & CSR_INT_BIT_SCD)
-                       IWL_DEBUG_ISR("Scheduler finished to transmit "
+                       IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
                                      "the frame/frames.\n");
 
                /* Alive notification via Rx interrupt will do the real work */
                if (inta & CSR_INT_BIT_ALIVE)
-                       IWL_DEBUG_ISR("Alive interrupt\n");
+                       IWL_DEBUG_ISR(priv, "Alive interrupt\n");
        }
 #endif
        /* Safely ignore these bits for debug checks below */
@@ -1393,17 +1223,20 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
                                CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW))
                        hw_rf_kill = 1;
 
-               IWL_DEBUG(IWL_DL_RF_KILL, "RF_KILL bit toggled to %s.\n",
+               IWL_DEBUG_RF_KILL(priv, "RF_KILL bit toggled to %s.\n",
                                hw_rf_kill ? "disable radio" : "enable radio");
 
                /* driver only loads ucode once setting the interface up.
-                * the driver as well won't allow loading if RFKILL is set
-                * therefore no need to restart the driver from this handler
+                * the driver allows loading the ucode even if the radio
+                * is killed. Hence update the killswitch state here. The
+                * rfkill handler will care about restarting if needed.
                 */
-               if (!hw_rf_kill && !test_bit(STATUS_ALIVE, &priv->status)) {
-                       clear_bit(STATUS_RF_KILL_HW, &priv->status);
-                       if (priv->is_open && !iwl_is_rfkill(priv))
-                               queue_work(priv->workqueue, &priv->up);
+               if (!test_bit(STATUS_ALIVE, &priv->status)) {
+                       if (hw_rf_kill)
+                               set_bit(STATUS_RF_KILL_HW, &priv->status);
+                       else
+                               clear_bit(STATUS_RF_KILL_HW, &priv->status);
+                       queue_work(priv->workqueue, &priv->rf_kill);
                }
 
                handled |= CSR_INT_BIT_RF_KILL;
@@ -1411,21 +1244,21 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
 
        /* Chip got too hot and stopped itself */
        if (inta & CSR_INT_BIT_CT_KILL) {
-               IWL_ERROR("Microcode CT kill error detected.\n");
+               IWL_ERR(priv, "Microcode CT kill error detected.\n");
                handled |= CSR_INT_BIT_CT_KILL;
        }
 
        /* Error detected by uCode */
        if (inta & CSR_INT_BIT_SW_ERR) {
-               IWL_ERROR("Microcode SW error detected.  Restarting 0x%X.\n",
-                         inta);
+               IWL_ERR(priv, "Microcode SW error detected. "
+                       " Restarting 0x%X.\n", inta);
                iwl_irq_handle_error(priv);
                handled |= CSR_INT_BIT_SW_ERR;
        }
 
        /* uCode wakes up after power-down sleep */
        if (inta & CSR_INT_BIT_WAKEUP) {
-               IWL_DEBUG_ISR("Wakeup interrupt\n");
+               IWL_DEBUG_ISR(priv, "Wakeup interrupt\n");
                iwl_rx_queue_update_write_ptr(priv, &priv->rxq);
                iwl_txq_update_write_ptr(priv, &priv->txq[0]);
                iwl_txq_update_write_ptr(priv, &priv->txq[1]);
@@ -1446,7 +1279,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
        }
 
        if (inta & CSR_INT_BIT_FH_TX) {
-               IWL_DEBUG_ISR("Tx interrupt\n");
+               IWL_DEBUG_ISR(priv, "Tx interrupt\n");
                handled |= CSR_INT_BIT_FH_TX;
                /* FH finished to write, send event */
                priv->ucode_write_complete = 1;
@@ -1454,12 +1287,12 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
        }
 
        if (inta & ~handled)
-               IWL_ERROR("Unhandled INTA bits 0x%08x\n", inta & ~handled);
+               IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled);
 
        if (inta & ~CSR_INI_SET_MASK) {
-               IWL_WARNING("Disabled INTA bits 0x%08x were pending\n",
+               IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n",
                         inta & ~CSR_INI_SET_MASK);
-               IWL_WARNING("   with FH_INT = 0x%08x\n", inta_fh);
+               IWL_WARN(priv, "   with FH_INT = 0x%08x\n", inta_fh);
        }
 
        /* Re-enable all interrupts */
@@ -1472,7 +1305,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)
                inta = iwl_read32(priv, CSR_INT);
                inta_mask = iwl_read32(priv, CSR_INT_MASK);
                inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
-               IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
+               IWL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
                        "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
        }
 #endif
@@ -1504,18 +1337,18 @@ static irqreturn_t iwl_isr(int irq, void *data)
         * This may be due to IRQ shared with another device,
         * or due to sporadic interrupts thrown from our NIC. */
        if (!inta && !inta_fh) {
-               IWL_DEBUG_ISR("Ignore interrupt, inta == 0, inta_fh == 0\n");
+               IWL_DEBUG_ISR(priv, "Ignore interrupt, inta == 0, inta_fh == 0\n");
                goto none;
        }
 
        if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
                /* Hardware disappeared. It might have already raised
                 * an interrupt */
-               IWL_WARNING("HARDWARE GONE?? INTA == 0x%08x\n", inta);
+               IWL_WARN(priv, "HARDWARE GONE?? INTA == 0x%08x\n", inta);
                goto unplugged;
        }
 
-       IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
+       IWL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
                      inta, inta_mask, inta_fh);
 
        inta &= ~CSR_INT_BIT_SCD;
@@ -1584,7 +1417,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
                sprintf(buf, "%s%d%s", name_pre, index, ".ucode");
                ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev);
                if (ret < 0) {
-                       IWL_ERROR("%s firmware file req failed: Reason %d\n",
+                       IWL_ERR(priv, "%s firmware file req failed: %d\n",
                                  buf, ret);
                        if (ret == -ENOENT)
                                continue;
@@ -1592,9 +1425,12 @@ static int iwl_read_ucode(struct iwl_priv *priv)
                                goto error;
                } else {
                        if (index < api_max)
-                               IWL_ERROR("Loaded firmware %s, which is deprecated. Please use API v%u instead.\n",
+                               IWL_ERR(priv, "Loaded firmware %s, "
+                                       "which is deprecated. "
+                                       "Please use API v%u instead.\n",
                                          buf, api_max);
-                       IWL_DEBUG_INFO("Got firmware '%s' file (%zd bytes) from disk\n",
+
+                       IWL_DEBUG_INFO(priv, "Got firmware '%s' file (%zd bytes) from disk\n",
                                       buf, ucode_raw->size);
                        break;
                }
@@ -1605,7 +1441,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
 
        /* Make sure that we got at least our header! */
        if (ucode_raw->size < sizeof(*ucode)) {
-               IWL_ERROR("File size way too small!\n");
+               IWL_ERR(priv, "File size way too small!\n");
                ret = -EINVAL;
                goto err_release;
        }
@@ -1626,7 +1462,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
         * on the API version read from firware header from here on forward */
 
        if (api_ver < api_min || api_ver > api_max) {
-               IWL_ERROR("Driver unable to support your firmware API. "
+               IWL_ERR(priv, "Driver unable to support your firmware API. "
                          "Driver supports v%u, firmware is v%u.\n",
                          api_max, api_ver);
                priv->ucode_ver = 0;
@@ -1634,28 +1470,28 @@ static int iwl_read_ucode(struct iwl_priv *priv)
                goto err_release;
        }
        if (api_ver != api_max)
-               IWL_ERROR("Firmware has old API version. Expected v%u, "
+               IWL_ERR(priv, "Firmware has old API version. Expected v%u, "
                          "got v%u. New firmware can be obtained "
                          "from http://www.intellinuxwireless.org.\n",
                          api_max, api_ver);
 
-       printk(KERN_INFO DRV_NAME " loaded firmware version %u.%u.%u.%u\n",
-                      IWL_UCODE_MAJOR(priv->ucode_ver),
-                      IWL_UCODE_MINOR(priv->ucode_ver),
-                      IWL_UCODE_API(priv->ucode_ver),
-                      IWL_UCODE_SERIAL(priv->ucode_ver));
+       IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n",
+              IWL_UCODE_MAJOR(priv->ucode_ver),
+              IWL_UCODE_MINOR(priv->ucode_ver),
+              IWL_UCODE_API(priv->ucode_ver),
+              IWL_UCODE_SERIAL(priv->ucode_ver));
 
-       IWL_DEBUG_INFO("f/w package hdr ucode version raw = 0x%x\n",
+       IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n",
                       priv->ucode_ver);
-       IWL_DEBUG_INFO("f/w package hdr runtime inst size = %u\n",
+       IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n",
                       inst_size);
-       IWL_DEBUG_INFO("f/w package hdr runtime data size = %u\n",
+       IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n",
                       data_size);
-       IWL_DEBUG_INFO("f/w package hdr init inst size = %u\n",
+       IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n",
                       init_size);
-       IWL_DEBUG_INFO("f/w package hdr init data size = %u\n",
+       IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n",
                       init_data_size);
-       IWL_DEBUG_INFO("f/w package hdr boot inst size = %u\n",
+       IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n",
                       boot_size);
 
        /* Verify size of file vs. image size info in file's header */
@@ -1663,7 +1499,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
                inst_size + data_size + init_size +
                init_data_size + boot_size) {
 
-               IWL_DEBUG_INFO("uCode file size %d too small\n",
+               IWL_DEBUG_INFO(priv, "uCode file size %d too small\n",
                               (int)ucode_raw->size);
                ret = -EINVAL;
                goto err_release;
@@ -1671,36 +1507,33 @@ static int iwl_read_ucode(struct iwl_priv *priv)
 
        /* Verify that uCode images will fit in card's SRAM */
        if (inst_size > priv->hw_params.max_inst_size) {
-               IWL_DEBUG_INFO("uCode instr len %d too large to fit in\n",
+               IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n",
                               inst_size);
                ret = -EINVAL;
                goto err_release;
        }
 
        if (data_size > priv->hw_params.max_data_size) {
-               IWL_DEBUG_INFO("uCode data len %d too large to fit in\n",
+               IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n",
                                data_size);
                ret = -EINVAL;
                goto err_release;
        }
        if (init_size > priv->hw_params.max_inst_size) {
-               IWL_DEBUG_INFO
-                   ("uCode init instr len %d too large to fit in\n",
-                     init_size);
+               IWL_INFO(priv, "uCode init instr len %d too large to fit in\n",
+                       init_size);
                ret = -EINVAL;
                goto err_release;
        }
        if (init_data_size > priv->hw_params.max_data_size) {
-               IWL_DEBUG_INFO
-                   ("uCode init data len %d too large to fit in\n",
+               IWL_INFO(priv, "uCode init data len %d too large to fit in\n",
                      init_data_size);
                ret = -EINVAL;
                goto err_release;
        }
        if (boot_size > priv->hw_params.max_bsm_size) {
-               IWL_DEBUG_INFO
-                   ("uCode boot instr len %d too large to fit in\n",
-                     boot_size);
+               IWL_INFO(priv, "uCode boot instr len %d too large to fit in\n",
+                       boot_size);
                ret = -EINVAL;
                goto err_release;
        }
@@ -1749,16 +1582,16 @@ static int iwl_read_ucode(struct iwl_priv *priv)
        /* Runtime instructions (first block of data in file) */
        src = &ucode->data[0];
        len = priv->ucode_code.len;
-       IWL_DEBUG_INFO("Copying (but not loading) uCode instr len %Zd\n", len);
+       IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode instr len %Zd\n", len);
        memcpy(priv->ucode_code.v_addr, src, len);
-       IWL_DEBUG_INFO("uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
+       IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
                priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
 
        /* Runtime data (2nd block)
         * NOTE:  Copy into backup buffer will be done in iwl_up()  */
        src = &ucode->data[inst_size];
        len = priv->ucode_data.len;
-       IWL_DEBUG_INFO("Copying (but not loading) uCode data len %Zd\n", len);
+       IWL_DEBUG_INFO(priv, "Copying (but not loading) uCode data len %Zd\n", len);
        memcpy(priv->ucode_data.v_addr, src, len);
        memcpy(priv->ucode_data_backup.v_addr, src, len);
 
@@ -1766,7 +1599,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
        if (init_size) {
                src = &ucode->data[inst_size + data_size];
                len = priv->ucode_init.len;
-               IWL_DEBUG_INFO("Copying (but not loading) init instr len %Zd\n",
+               IWL_DEBUG_INFO(priv, "Copying (but not loading) init instr len %Zd\n",
                                len);
                memcpy(priv->ucode_init.v_addr, src, len);
        }
@@ -1775,7 +1608,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
        if (init_data_size) {
                src = &ucode->data[inst_size + data_size + init_size];
                len = priv->ucode_init_data.len;
-               IWL_DEBUG_INFO("Copying (but not loading) init data len %Zd\n",
+               IWL_DEBUG_INFO(priv, "Copying (but not loading) init data len %Zd\n",
                               len);
                memcpy(priv->ucode_init_data.v_addr, src, len);
        }
@@ -1783,7 +1616,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
        /* Bootstrap instructions (5th block) */
        src = &ucode->data[inst_size + data_size + init_size + init_data_size];
        len = priv->ucode_boot.len;
-       IWL_DEBUG_INFO("Copying (but not loading) boot instr len %Zd\n", len);
+       IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", len);
        memcpy(priv->ucode_boot.v_addr, src, len);
 
        /* We have our copies now, allow OS release its copies */
@@ -1791,7 +1624,7 @@ static int iwl_read_ucode(struct iwl_priv *priv)
        return 0;
 
  err_pci_alloc:
-       IWL_ERROR("failed to allocate pci memory\n");
+       IWL_ERR(priv, "failed to allocate pci memory\n");
        ret = -ENOMEM;
        iwl_dealloc_ucode_pci(priv);
 
@@ -1815,12 +1648,12 @@ static void iwl_alive_start(struct iwl_priv *priv)
 {
        int ret = 0;
 
-       IWL_DEBUG_INFO("Runtime Alive received.\n");
+       IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
 
        if (priv->card_alive.is_valid != UCODE_VALID_OK) {
                /* We had an error bringing up the hardware, so take it
                 * all the way back down so we can try again */
-               IWL_DEBUG_INFO("Alive failed.\n");
+               IWL_DEBUG_INFO(priv, "Alive failed.\n");
                goto restart;
        }
 
@@ -1830,15 +1663,15 @@ static void iwl_alive_start(struct iwl_priv *priv)
        if (iwl_verify_ucode(priv)) {
                /* Runtime instruction load was bad;
                 * take it all the way back down so we can try again */
-               IWL_DEBUG_INFO("Bad runtime uCode load.\n");
+               IWL_DEBUG_INFO(priv, "Bad runtime uCode load.\n");
                goto restart;
        }
 
        iwl_clear_stations_table(priv);
        ret = priv->cfg->ops->lib->alive_notify(priv);
        if (ret) {
-               IWL_WARNING("Could not complete ALIVE transition [ntf]: %d\n",
-                           ret);
+               IWL_WARN(priv,
+                       "Could not complete ALIVE transition [ntf]: %d\n", ret);
                goto restart;
        }
 
@@ -1863,6 +1696,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
        } else {
                /* Initialize our rx_config data */
                iwl_connection_init_rx_config(priv, priv->iw_mode);
+               iwl_set_rxon_chain(priv);
                memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
        }
 
@@ -1879,7 +1713,7 @@ static void iwl_alive_start(struct iwl_priv *priv)
 
        iwl_leds_register(priv);
 
-       IWL_DEBUG_INFO("ALIVE processing complete.\n");
+       IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
        set_bit(STATUS_READY, &priv->status);
        wake_up_interruptible(&priv->wait_command_queue);
 
@@ -1913,7 +1747,7 @@ static void __iwl_down(struct iwl_priv *priv)
        unsigned long flags;
        int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status);
 
-       IWL_DEBUG_INFO(DRV_NAME " is going down\n");
+       IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
 
        if (!exit_pending)
                set_bit(STATUS_EXIT_PENDING, &priv->status);
@@ -2024,12 +1858,12 @@ static int __iwl_up(struct iwl_priv *priv)
        int ret;
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-               IWL_WARNING("Exit pending; will not bring the NIC up\n");
+               IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
                return -EIO;
        }
 
        if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
-               IWL_ERROR("ucode not available for device bringup\n");
+               IWL_ERR(priv, "ucode not available for device bringup\n");
                return -EIO;
        }
 
@@ -2041,7 +1875,7 @@ static int __iwl_up(struct iwl_priv *priv)
 
        if (iwl_is_rfkill(priv)) {
                iwl_enable_interrupts(priv);
-               IWL_WARNING("Radio disabled by %s RF Kill switch\n",
+               IWL_WARN(priv, "Radio disabled by %s RF Kill switch\n",
                    test_bit(STATUS_RF_KILL_HW, &priv->status) ? "HW" : "SW");
                return 0;
        }
@@ -2050,7 +1884,7 @@ static int __iwl_up(struct iwl_priv *priv)
 
        ret = iwl_hw_nic_init(priv);
        if (ret) {
-               IWL_ERROR("Unable to init nic\n");
+               IWL_ERR(priv, "Unable to init nic\n");
                return ret;
        }
 
@@ -2083,7 +1917,8 @@ static int __iwl_up(struct iwl_priv *priv)
                ret = priv->cfg->ops->lib->load_ucode(priv);
 
                if (ret) {
-                       IWL_ERROR("Unable to set up bootstrap uCode: %d\n", ret);
+                       IWL_ERR(priv, "Unable to set up bootstrap uCode: %d\n",
+                               ret);
                        continue;
                }
 
@@ -2093,7 +1928,7 @@ static int __iwl_up(struct iwl_priv *priv)
                /* start card; "initialize" will load runtime ucode */
                iwl_nic_start(priv);
 
-               IWL_DEBUG_INFO(DRV_NAME " is coming up\n");
+               IWL_DEBUG_INFO(priv, DRV_NAME " is coming up\n");
 
                return 0;
        }
@@ -2104,7 +1939,7 @@ static int __iwl_up(struct iwl_priv *priv)
 
        /* tried to restart and config the device for as long as our
         * patience could withstand */
-       IWL_ERROR("Unable to initialize device after %d attempts.\n", i);
+       IWL_ERR(priv, "Unable to initialize device after %d attempts.\n", i);
        return -EIO;
 }
 
@@ -2141,40 +1976,6 @@ static void iwl_bg_alive_start(struct work_struct *data)
        mutex_unlock(&priv->mutex);
 }
 
-static void iwl_bg_rf_kill(struct work_struct *work)
-{
-       struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill);
-
-       wake_up_interruptible(&priv->wait_command_queue);
-
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
-               return;
-
-       mutex_lock(&priv->mutex);
-
-       if (!iwl_is_rfkill(priv)) {
-               IWL_DEBUG(IWL_DL_RF_KILL,
-                         "HW and/or SW RF Kill no longer active, restarting "
-                         "device\n");
-               if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
-                       queue_work(priv->workqueue, &priv->restart);
-       } else {
-               /* make sure mac80211 stop sending Tx frame */
-               if (priv->mac80211_registered)
-                       ieee80211_stop_queues(priv->hw);
-
-               if (!test_bit(STATUS_RF_KILL_HW, &priv->status))
-                       IWL_DEBUG_RF_KILL("Can not turn radio back on - "
-                                         "disabled by SW switch\n");
-               else
-                       IWL_WARNING("Radio Frequency Kill Switch is On:\n"
-                                   "Kill switch must be turned off for "
-                                   "wireless networking to work.\n");
-       }
-       mutex_unlock(&priv->mutex);
-       iwl_rfkill_set_hw_state(priv);
-}
-
 static void iwl_bg_run_time_calib_work(struct work_struct *work)
 {
        struct iwl_priv *priv = container_of(work, struct iwl_priv,
@@ -2244,11 +2045,11 @@ static void iwl_post_associate(struct iwl_priv *priv)
        unsigned long flags;
 
        if (priv->iw_mode == NL80211_IFTYPE_AP) {
-               IWL_ERROR("%s Should not be called in AP mode\n", __func__);
+               IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__);
                return;
        }
 
-       IWL_DEBUG_ASSOC("Associated as %d to: %pM\n",
+       IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n",
                        priv->assoc_id, priv->active_rxon.bssid_addr);
 
 
@@ -2271,7 +2072,7 @@ static void iwl_post_associate(struct iwl_priv *priv)
        ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
                              sizeof(priv->rxon_timing), &priv->rxon_timing);
        if (ret)
-               IWL_WARNING("REPLY_RXON_TIMING failed - "
+               IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
                            "Attempting to continue.\n");
 
        priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
@@ -2281,7 +2082,7 @@ static void iwl_post_associate(struct iwl_priv *priv)
        iwl_set_rxon_chain(priv);
        priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id);
 
-       IWL_DEBUG_ASSOC("assoc id %d beacon interval %d\n",
+       IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n",
                        priv->assoc_id, priv->beacon_int);
 
        if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
@@ -2317,7 +2118,7 @@ static void iwl_post_associate(struct iwl_priv *priv)
                break;
 
        default:
-               IWL_ERROR("%s Should not be called in %d mode\n",
+               IWL_ERR(priv, "%s Should not be called in %d mode\n",
                          __func__, priv->iw_mode);
                break;
        }
@@ -2353,30 +2154,8 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
 {
        struct iwl_priv *priv = hw->priv;
        int ret;
-       u16 pci_cmd;
 
-       IWL_DEBUG_MAC80211("enter\n");
-
-       if (pci_enable_device(priv->pci_dev)) {
-               IWL_ERROR("Fail to pci_enable_device\n");
-               return -ENODEV;
-       }
-       pci_restore_state(priv->pci_dev);
-       pci_enable_msi(priv->pci_dev);
-
-       /* enable interrupts if needed: hw bug w/a */
-       pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
-       if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
-               pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
-               pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
-       }
-
-       ret = request_irq(priv->pci_dev->irq, iwl_isr, IRQF_SHARED,
-                         DRV_NAME, priv);
-       if (ret) {
-               IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq);
-               goto out_disable_msi;
-       }
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        /* we should be verifying the device is ready to be opened */
        mutex_lock(&priv->mutex);
@@ -2388,9 +2167,9 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
        if (!priv->ucode_code.len) {
                ret = iwl_read_ucode(priv);
                if (ret) {
-                       IWL_ERROR("Could not read microcode: %d\n", ret);
+                       IWL_ERR(priv, "Could not read microcode: %d\n", ret);
                        mutex_unlock(&priv->mutex);
-                       goto out_release_irq;
+                       return ret;
                }
        }
 
@@ -2401,12 +2180,12 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
        iwl_rfkill_set_hw_state(priv);
 
        if (ret)
-               goto out_release_irq;
+               return ret;
 
        if (iwl_is_rfkill(priv))
                goto out;
 
-       IWL_DEBUG_INFO("Start UP work done.\n");
+       IWL_DEBUG_INFO(priv, "Start UP work done.\n");
 
        if (test_bit(STATUS_IN_SUSPEND, &priv->status))
                return 0;
@@ -2418,36 +2197,26 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
                        UCODE_READY_TIMEOUT);
        if (!ret) {
                if (!test_bit(STATUS_READY, &priv->status)) {
-                       IWL_ERROR("START_ALIVE timeout after %dms.\n",
+                       IWL_ERR(priv, "START_ALIVE timeout after %dms.\n",
                                jiffies_to_msecs(UCODE_READY_TIMEOUT));
-                       ret = -ETIMEDOUT;
-                       goto out_release_irq;
+                       return -ETIMEDOUT;
                }
        }
 
 out:
        priv->is_open = 1;
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        return 0;
-
-out_release_irq:
-       free_irq(priv->pci_dev->irq, priv);
-out_disable_msi:
-       pci_disable_msi(priv->pci_dev);
-       pci_disable_device(priv->pci_dev);
-       priv->is_open = 0;
-       IWL_DEBUG_MAC80211("leave - failed\n");
-       return ret;
 }
 
 static void iwl_mac_stop(struct ieee80211_hw *hw)
 {
        struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        if (!priv->is_open) {
-               IWL_DEBUG_MAC80211("leave - skip\n");
+               IWL_DEBUG_MAC80211(priv, "leave - skip\n");
                return;
        }
 
@@ -2465,27 +2234,27 @@ static void iwl_mac_stop(struct ieee80211_hw *hw)
        iwl_down(priv);
 
        flush_workqueue(priv->workqueue);
-       free_irq(priv->pci_dev->irq, priv);
-       pci_disable_msi(priv->pci_dev);
-       pci_save_state(priv->pci_dev);
-       pci_disable_device(priv->pci_dev);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       /* enable interrupts again in order to receive rfkill changes */
+       iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
+       iwl_enable_interrupts(priv);
+
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
 static int iwl_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
        struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_MACDUMP("enter\n");
+       IWL_DEBUG_MACDUMP(priv, "enter\n");
 
-       IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
+       IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
                     ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
 
        if (iwl_tx_skb(priv, skb))
                dev_kfree_skb_any(skb);
 
-       IWL_DEBUG_MACDUMP("leave\n");
+       IWL_DEBUG_MACDUMP(priv, "leave\n");
        return NETDEV_TX_OK;
 }
 
@@ -2495,10 +2264,10 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
        struct iwl_priv *priv = hw->priv;
        unsigned long flags;
 
-       IWL_DEBUG_MAC80211("enter: type %d\n", conf->type);
+       IWL_DEBUG_MAC80211(priv, "enter: type %d\n", conf->type);
 
        if (priv->vif) {
-               IWL_DEBUG_MAC80211("leave - vif != NULL\n");
+               IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n");
                return -EOPNOTSUPP;
        }
 
@@ -2511,7 +2280,7 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
        mutex_lock(&priv->mutex);
 
        if (conf->mac_addr) {
-               IWL_DEBUG_MAC80211("Set %pM\n", conf->mac_addr);
+               IWL_DEBUG_MAC80211(priv, "Set %pM\n", conf->mac_addr);
                memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
        }
 
@@ -2521,7 +2290,7 @@ static int iwl_mac_add_interface(struct ieee80211_hw *hw,
 
        mutex_unlock(&priv->mutex);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        return 0;
 }
 
@@ -2542,12 +2311,12 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
        u16 channel;
 
        mutex_lock(&priv->mutex);
-       IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value);
+       IWL_DEBUG_MAC80211(priv, "enter to channel %d\n", conf->channel->hw_value);
 
-       priv->current_ht_config.is_ht = conf->ht.enabled;
+       priv->current_ht_config.is_ht = conf_is_ht(conf);
 
        if (conf->radio_enabled && iwl_radio_kill_sw_enable_radio(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF-KILL - waiting for uCode\n");
+               IWL_DEBUG_MAC80211(priv, "leave - RF-KILL - waiting for uCode\n");
                goto out;
        }
 
@@ -2555,14 +2324,14 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
                iwl_radio_kill_sw_disable_radio(priv);
 
        if (!iwl_is_ready(priv)) {
-               IWL_DEBUG_MAC80211("leave - not ready\n");
+               IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
                ret = -EIO;
                goto out;
        }
 
        if (unlikely(!priv->cfg->mod_params->disable_hw_scan &&
                     test_bit(STATUS_SCANNING, &priv->status))) {
-               IWL_DEBUG_MAC80211("leave - scanning\n");
+               IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
                mutex_unlock(&priv->mutex);
                return 0;
        }
@@ -2570,14 +2339,14 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
        channel = ieee80211_frequency_to_channel(conf->channel->center_freq);
        ch_info = iwl_get_channel_info(priv, conf->channel->band, channel);
        if (!is_channel_valid(ch_info)) {
-               IWL_DEBUG_MAC80211("leave - invalid channel\n");
+               IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
                ret = -EINVAL;
                goto out;
        }
 
        if (priv->iw_mode == NL80211_IFTYPE_ADHOC &&
            !is_channel_ibss(ch_info)) {
-               IWL_ERROR("channel %d in band %d not IBSS channel\n",
+               IWL_ERR(priv, "channel %d in band %d not IBSS channel\n",
                        conf->channel->hw_value, conf->channel->band);
                ret = -EINVAL;
                goto out;
@@ -2615,12 +2384,12 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
 #endif
 
        if (!conf->radio_enabled) {
-               IWL_DEBUG_MAC80211("leave - radio disabled\n");
+               IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
                goto out;
        }
 
        if (iwl_is_rfkill(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF kill\n");
+               IWL_DEBUG_MAC80211(priv, "leave - RF kill\n");
                ret = -EIO;
                goto out;
        }
@@ -2630,22 +2399,25 @@ static int iwl_mac_config(struct ieee80211_hw *hw, u32 changed)
        else
                ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM);
        if (ret)
-               IWL_DEBUG_MAC80211("Error setting power level\n");
+               IWL_DEBUG_MAC80211(priv, "Error setting power level\n");
 
-       IWL_DEBUG_MAC80211("TX Power old=%d new=%d\n",
+       IWL_DEBUG_MAC80211(priv, "TX Power old=%d new=%d\n",
                           priv->tx_power_user_lmt, conf->power_level);
 
        iwl_set_tx_power(priv, conf->power_level, false);
 
        iwl_set_rate(priv);
 
+       /* call to ensure that 4965 rx_chain is set properly in monitor mode */
+       iwl_set_rxon_chain(priv);
+
        if (memcmp(&priv->active_rxon,
                   &priv->staging_rxon, sizeof(priv->staging_rxon)))
                iwl_commit_rxon(priv);
        else
-               IWL_DEBUG_INFO("No re-sending same RXON configuration.\n");
+               IWL_DEBUG_INFO(priv, "No re-sending same RXON configuration.\n");
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
 out:
        mutex_unlock(&priv->mutex);
@@ -2672,7 +2444,7 @@ static void iwl_config_ap(struct iwl_priv *priv)
                ret = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
                                sizeof(priv->rxon_timing), &priv->rxon_timing);
                if (ret)
-                       IWL_WARNING("REPLY_RXON_TIMING failed - "
+                       IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
                                        "Attempting to continue.\n");
 
                iwl_set_rxon_chain(priv);
@@ -2726,7 +2498,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw,
                return -EIO;
 
        if (priv->vif != vif) {
-               IWL_DEBUG_MAC80211("leave - priv->vif != vif\n");
+               IWL_DEBUG_MAC80211(priv, "leave - priv->vif != vif\n");
                return 0;
        }
 
@@ -2748,7 +2520,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw,
        mutex_lock(&priv->mutex);
 
        if (conf->bssid)
-               IWL_DEBUG_MAC80211("bssid: %pM\n", conf->bssid);
+               IWL_DEBUG_MAC80211(priv, "bssid: %pM\n", conf->bssid);
 
 /*
  * very dubious code was here; the probe filtering flag is never set:
@@ -2761,7 +2533,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw,
                if (!conf->bssid) {
                        conf->bssid = priv->mac_addr;
                        memcpy(priv->bssid, priv->mac_addr, ETH_ALEN);
-                       IWL_DEBUG_MAC80211("bssid was set to: %pM\n",
+                       IWL_DEBUG_MAC80211(priv, "bssid was set to: %pM\n",
                                           conf->bssid);
                }
                if (priv->ibss_beacon)
@@ -2778,9 +2550,9 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw,
                /* If there is currently a HW scan going on in the background
                 * then we need to cancel it else the RXON below will fail. */
                if (iwl_scan_cancel_timeout(priv, 100)) {
-                       IWL_WARNING("Aborted scan still in progress "
+                       IWL_WARN(priv, "Aborted scan still in progress "
                                    "after 100ms\n");
-                       IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
+                       IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
                        mutex_unlock(&priv->mutex);
                        return -EAGAIN;
                }
@@ -2808,64 +2580,18 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw,
        }
 
  done:
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        mutex_unlock(&priv->mutex);
 
        return 0;
 }
 
-static void iwl_configure_filter(struct ieee80211_hw *hw,
-                                unsigned int changed_flags,
-                                unsigned int *total_flags,
-                                int mc_count, struct dev_addr_list *mc_list)
-{
-       struct iwl_priv *priv = hw->priv;
-       __le32 *filter_flags = &priv->staging_rxon.filter_flags;
-
-       IWL_DEBUG_MAC80211("Enter: changed: 0x%x, total: 0x%x\n",
-                       changed_flags, *total_flags);
-
-       if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) {
-               if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS))
-                       *filter_flags |= RXON_FILTER_PROMISC_MSK;
-               else
-                       *filter_flags &= ~RXON_FILTER_PROMISC_MSK;
-       }
-       if (changed_flags & FIF_ALLMULTI) {
-               if (*total_flags & FIF_ALLMULTI)
-                       *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK;
-               else
-                       *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK;
-       }
-       if (changed_flags & FIF_CONTROL) {
-               if (*total_flags & FIF_CONTROL)
-                       *filter_flags |= RXON_FILTER_CTL2HOST_MSK;
-               else
-                       *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK;
-       }
-       if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
-               if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
-                       *filter_flags |= RXON_FILTER_BCON_AWARE_MSK;
-               else
-                       *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK;
-       }
-
-       /* We avoid iwl_commit_rxon here to commit the new filter flags
-        * since mac80211 will call ieee80211_hw_config immediately.
-        * (mc_list is not supported at this time). Otherwise, we need to
-        * queue a background iwl_commit_rxon work.
-        */
-
-       *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
-                       FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
-}
-
 static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
                                     struct ieee80211_if_init_conf *conf)
 {
        struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        mutex_lock(&priv->mutex);
 
@@ -2880,7 +2606,7 @@ static void iwl_mac_remove_interface(struct ieee80211_hw *hw,
        }
        mutex_unlock(&priv->mutex);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
 }
 
@@ -2892,10 +2618,10 @@ static void iwl_bss_info_changed(struct ieee80211_hw *hw,
 {
        struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_MAC80211("changes = 0x%X\n", changes);
+       IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes);
 
        if (changes & BSS_CHANGED_ERP_PREAMBLE) {
-               IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n",
+               IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n",
                                   bss_conf->use_short_preamble);
                if (bss_conf->use_short_preamble)
                        priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
@@ -2904,7 +2630,7 @@ static void iwl_bss_info_changed(struct ieee80211_hw *hw,
        }
 
        if (changes & BSS_CHANGED_ERP_CTS_PROT) {
-               IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot);
+               IWL_DEBUG_MAC80211(priv, "ERP_CTS %d\n", bss_conf->use_cts_prot);
                if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
                        priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK;
                else
@@ -2917,7 +2643,7 @@ static void iwl_bss_info_changed(struct ieee80211_hw *hw,
        }
 
        if (changes & BSS_CHANGED_ASSOC) {
-               IWL_DEBUG_MAC80211("ASSOC %d\n", bss_conf->assoc);
+               IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc);
                /* This should never happen as this function should
                 * never be called from interrupt context. */
                if (WARN_ON_ONCE(in_interrupt()))
@@ -2939,29 +2665,37 @@ static void iwl_bss_info_changed(struct ieee80211_hw *hw,
                        mutex_unlock(&priv->mutex);
                } else {
                        priv->assoc_id = 0;
-                       IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc);
+                       IWL_DEBUG_MAC80211(priv, "DISASSOC %d\n", bss_conf->assoc);
                }
        } else if (changes && iwl_is_associated(priv) && priv->assoc_id) {
-                       IWL_DEBUG_MAC80211("Associated Changes %d\n", changes);
+                       IWL_DEBUG_MAC80211(priv, "Associated Changes %d\n", changes);
                        iwl_send_rxon_assoc(priv);
        }
 
 }
 
-static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len)
+static int iwl_mac_hw_scan(struct ieee80211_hw *hw,
+                          struct cfg80211_scan_request *req)
 {
        unsigned long flags;
        struct iwl_priv *priv = hw->priv;
        int ret;
+       u8 *ssid = NULL;
+       size_t ssid_len = 0;
+
+       if (req->n_ssids) {
+               ssid = req->ssids[0].ssid;
+               ssid_len = req->ssids[0].ssid_len;
+       }
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        mutex_lock(&priv->mutex);
        spin_lock_irqsave(&priv->lock, flags);
 
        if (!iwl_is_ready_rf(priv)) {
                ret = -EIO;
-               IWL_DEBUG_MAC80211("leave - not ready or exit pending\n");
+               IWL_DEBUG_MAC80211(priv, "leave - not ready or exit pending\n");
                goto out_unlock;
        }
 
@@ -2971,7 +2705,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len)
         */
        if (priv->next_scan_jiffies &&
            time_after(priv->next_scan_jiffies, jiffies)) {
-               IWL_DEBUG_SCAN("scan rejected: within next scan period\n");
+               IWL_DEBUG_SCAN(priv, "scan rejected: within next scan period\n");
                queue_work(priv->workqueue, &priv->scan_completed);
                ret = 0;
                goto out_unlock;
@@ -2980,7 +2714,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len)
        /* if we just finished scan ask for delay */
        if (iwl_is_associated(priv) && priv->last_scan_jiffies &&
            time_after(priv->last_scan_jiffies + IWL_DELAY_NEXT_SCAN, jiffies)) {
-               IWL_DEBUG_SCAN("scan rejected: within previous scan period\n");
+               IWL_DEBUG_SCAN(priv, "scan rejected: within previous scan period\n");
                queue_work(priv->workqueue, &priv->scan_completed);
                ret = 0;
                goto out_unlock;
@@ -2988,7 +2722,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len)
 
        if (ssid_len) {
                priv->one_direct_scan = 1;
-               priv->direct_ssid_len =  min_t(u8, ssid_len, IW_ESSID_MAX_SIZE);
+               priv->direct_ssid_len = ssid_len;
                memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
        } else {
                priv->one_direct_scan = 0;
@@ -2996,7 +2730,7 @@ static int iwl_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t ssid_len)
 
        ret = iwl_scan_initiate(priv);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
 out_unlock:
        spin_unlock_irqrestore(&priv->lock, flags);
@@ -3011,36 +2745,34 @@ static void iwl_mac_update_tkip_key(struct ieee80211_hw *hw,
 {
 
        struct iwl_priv *priv = hw->priv;
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        iwl_update_tkip_key(priv, keyconf, addr, iv32, phase1key);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
 static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                          const u8 *local_addr, const u8 *addr,
+                          struct ieee80211_vif *vif,
+                          struct ieee80211_sta *sta,
                           struct ieee80211_key_conf *key)
 {
        struct iwl_priv *priv = hw->priv;
-       int ret = 0;
-       u8 sta_id = IWL_INVALID_STATION;
-       u8 is_default_wep_key = 0;
+       const u8 *addr;
+       int ret;
+       u8 sta_id;
+       bool is_default_wep_key = false;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        if (priv->hw_params.sw_crypto) {
-               IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n");
+               IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n");
                return -EOPNOTSUPP;
        }
-
-       if (is_zero_ether_addr(addr))
-               /* only support pairwise keys */
-               return -EOPNOTSUPP;
-
+       addr = sta ? sta->addr : iwl_bcast_addr;
        sta_id = iwl_find_station(priv, addr);
        if (sta_id == IWL_INVALID_STATION) {
-               IWL_DEBUG_MAC80211("leave - %pM not in station map.\n",
+               IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
                                   addr);
                return -EINVAL;
 
@@ -3070,7 +2802,7 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                else
                        ret = iwl_set_dynamic_key(priv, key, sta_id);
 
-               IWL_DEBUG_MAC80211("enable hwcrypto key\n");
+               IWL_DEBUG_MAC80211(priv, "enable hwcrypto key\n");
                break;
        case DISABLE_KEY:
                if (is_default_wep_key)
@@ -3078,13 +2810,13 @@ static int iwl_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
                else
                        ret = iwl_remove_dynamic_key(priv, key, sta_id);
 
-               IWL_DEBUG_MAC80211("disable hwcrypto key\n");
+               IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n");
                break;
        default:
                ret = -EINVAL;
        }
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
        return ret;
 }
@@ -3096,15 +2828,15 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
        unsigned long flags;
        int q;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        if (!iwl_is_ready_rf(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF not ready\n");
+               IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
                return -EIO;
        }
 
        if (queue >= AC_NUM) {
-               IWL_DEBUG_MAC80211("leave - queue >= AC_NUM %d\n", queue);
+               IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue);
                return 0;
        }
 
@@ -3128,7 +2860,7 @@ static int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        return 0;
 }
 
@@ -3138,7 +2870,7 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
 {
        struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_HT("A-MPDU action on addr %pM tid %d\n",
+       IWL_DEBUG_HT(priv, "A-MPDU action on addr %pM tid %d\n",
                     sta->addr, tid);
 
        if (!(priv->cfg->sku & IWL_SKU_N))
@@ -3146,19 +2878,19 @@ static int iwl_mac_ampdu_action(struct ieee80211_hw *hw,
 
        switch (action) {
        case IEEE80211_AMPDU_RX_START:
-               IWL_DEBUG_HT("start Rx\n");
+               IWL_DEBUG_HT(priv, "start Rx\n");
                return iwl_sta_rx_agg_start(priv, sta->addr, tid, *ssn);
        case IEEE80211_AMPDU_RX_STOP:
-               IWL_DEBUG_HT("stop Rx\n");
+               IWL_DEBUG_HT(priv, "stop Rx\n");
                return iwl_sta_rx_agg_stop(priv, sta->addr, tid);
        case IEEE80211_AMPDU_TX_START:
-               IWL_DEBUG_HT("start Tx\n");
+               IWL_DEBUG_HT(priv, "start Tx\n");
                return iwl_tx_agg_start(priv, sta->addr, tid, ssn);
        case IEEE80211_AMPDU_TX_STOP:
-               IWL_DEBUG_HT("stop Tx\n");
+               IWL_DEBUG_HT(priv, "stop Tx\n");
                return iwl_tx_agg_stop(priv, sta->addr, tid);
        default:
-               IWL_DEBUG_HT("unknown\n");
+               IWL_DEBUG_HT(priv, "unknown\n");
                return -EINVAL;
                break;
        }
@@ -3174,10 +2906,10 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
        struct iwl_queue *q;
        unsigned long flags;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        if (!iwl_is_ready_rf(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF not ready\n");
+               IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
                return -EIO;
        }
 
@@ -3195,7 +2927,7 @@ static int iwl_mac_get_tx_stats(struct ieee80211_hw *hw,
        }
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
        return 0;
 }
@@ -3206,8 +2938,8 @@ static int iwl_mac_get_stats(struct ieee80211_hw *hw,
        struct iwl_priv *priv = hw->priv;
 
        priv = hw->priv;
-       IWL_DEBUG_MAC80211("enter\n");
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
        return 0;
 }
@@ -3218,7 +2950,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
        unsigned long flags;
 
        mutex_lock(&priv->mutex);
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        spin_lock_irqsave(&priv->lock, flags);
        memset(&priv->current_ht_config, 0, sizeof(struct iwl_ht_info));
@@ -3245,7 +2977,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
        spin_unlock_irqrestore(&priv->lock, flags);
 
        if (!iwl_is_ready_rf(priv)) {
-               IWL_DEBUG_MAC80211("leave - not ready\n");
+               IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
                mutex_unlock(&priv->mutex);
                return;
        }
@@ -3274,7 +3006,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
                                                     IEEE80211_CHAN_RADAR))
                                iwl_power_disable_management(priv, 3000);
 
-               IWL_DEBUG_MAC80211("leave - not in IBSS\n");
+               IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n");
                mutex_unlock(&priv->mutex);
                return;
        }
@@ -3283,7 +3015,7 @@ static void iwl_mac_reset_tsf(struct ieee80211_hw *hw)
 
        mutex_unlock(&priv->mutex);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
 static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
@@ -3292,15 +3024,15 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
        unsigned long flags;
        __le64 timestamp;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        if (!iwl_is_ready_rf(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF not ready\n");
+               IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
                return -EIO;
        }
 
        if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {
-               IWL_DEBUG_MAC80211("leave - not IBSS\n");
+               IWL_DEBUG_MAC80211(priv, "leave - not IBSS\n");
                return -EIO;
        }
 
@@ -3315,7 +3047,7 @@ static int iwl_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
        timestamp = ((struct ieee80211_mgmt *)skb->data)->u.beacon.timestamp;
        priv->timestamp = le64_to_cpu(timestamp);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        spin_unlock_irqrestore(&priv->lock, flags);
 
        iwl_reset_qos(priv);
@@ -3359,8 +3091,7 @@ static ssize_t store_debug_level(struct device *d,
 
        ret = strict_strtoul(buf, 0, &val);
        if (ret)
-               printk(KERN_INFO DRV_NAME
-                      ": %s is not in hex or decimal form.\n", buf);
+               IWL_ERR(priv, "%s is not in hex or decimal form.\n", buf);
        else
                priv->debug_level = val;
 
@@ -3439,8 +3170,7 @@ static ssize_t store_tx_power(struct device *d,
 
        ret = strict_strtoul(buf, 10, &val);
        if (ret)
-               printk(KERN_INFO DRV_NAME
-                      ": %s is not in decimal form.\n", buf);
+               IWL_INFO(priv, "%s is not in decimal form.\n", buf);
        else
                iwl_set_tx_power(priv, val, false);
 
@@ -3473,9 +3203,9 @@ static ssize_t store_flags(struct device *d,
        if (le32_to_cpu(priv->staging_rxon.flags) != flags) {
                /* Cancel any currently running scans... */
                if (iwl_scan_cancel_timeout(priv, 100))
-                       IWL_WARNING("Could not cancel scan.\n");
+                       IWL_WARN(priv, "Could not cancel scan.\n");
                else {
-                       IWL_DEBUG_INFO("Commit rxon.flags = 0x%04X\n", flags);
+                       IWL_DEBUG_INFO(priv, "Commit rxon.flags = 0x%04X\n", flags);
                        priv->staging_rxon.flags = cpu_to_le32(flags);
                        iwl_commit_rxon(priv);
                }
@@ -3512,9 +3242,9 @@ static ssize_t store_filter_flags(struct device *d,
        if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) {
                /* Cancel any currently running scans... */
                if (iwl_scan_cancel_timeout(priv, 100))
-                       IWL_WARNING("Could not cancel scan.\n");
+                       IWL_WARN(priv, "Could not cancel scan.\n");
                else {
-                       IWL_DEBUG_INFO("Committing rxon.filter_flags = "
+                       IWL_DEBUG_INFO(priv, "Committing rxon.filter_flags = "
                                       "0x%04X\n", filter_flags);
                        priv->staging_rxon.filter_flags =
                                cpu_to_le32(filter_flags);
@@ -3529,31 +3259,6 @@ static ssize_t store_filter_flags(struct device *d,
 static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags,
                   store_filter_flags);
 
-static ssize_t store_retry_rate(struct device *d,
-                               struct device_attribute *attr,
-                               const char *buf, size_t count)
-{
-       struct iwl_priv *priv = dev_get_drvdata(d);
-       long val;
-       int ret  = strict_strtol(buf, 10, &val);
-       if (!ret)
-               return ret;
-
-       priv->retry_rate = (val > 0) ? val : 1;
-
-       return count;
-}
-
-static ssize_t show_retry_rate(struct device *d,
-                              struct device_attribute *attr, char *buf)
-{
-       struct iwl_priv *priv = dev_get_drvdata(d);
-       return sprintf(buf, "%d", priv->retry_rate);
-}
-
-static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, show_retry_rate,
-                  store_retry_rate);
-
 static ssize_t store_power_level(struct device *d,
                                 struct device_attribute *attr,
                                 const char *buf, size_t count)
@@ -3576,7 +3281,7 @@ static ssize_t store_power_level(struct device *d,
 
        ret = iwl_power_set_user_mode(priv, mode);
        if (ret) {
-               IWL_DEBUG_MAC80211("failed setting power mode.\n");
+               IWL_DEBUG_MAC80211(priv, "failed setting power mode.\n");
                goto out;
        }
        ret = count;
@@ -3656,16 +3361,6 @@ static ssize_t show_statistics(struct device *d,
 
 static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);
 
-static ssize_t show_status(struct device *d,
-                          struct device_attribute *attr, char *buf)
-{
-       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
-       if (!iwl_is_alive(priv))
-               return -EAGAIN;
-       return sprintf(buf, "0x%08x\n", (int)priv->status);
-}
-
-static DEVICE_ATTR(status, S_IRUGO, show_status, NULL);
 
 /*****************************************************************************
  *
@@ -3719,9 +3414,7 @@ static struct attribute *iwl_sysfs_entries[] = {
        &dev_attr_flags.attr,
        &dev_attr_filter_flags.attr,
        &dev_attr_power_level.attr,
-       &dev_attr_retry_rate.attr,
        &dev_attr_statistics.attr,
-       &dev_attr_status.attr,
        &dev_attr_temperature.attr,
        &dev_attr_tx_power.attr,
 #ifdef CONFIG_IWLWIFI_DEBUG
@@ -3764,6 +3457,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        struct ieee80211_hw *hw;
        struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
        unsigned long flags;
+       u16 pci_cmd;
 
        /************************
         * 1. Allocating HW data
@@ -3788,7 +3482,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        SET_IEEE80211_DEV(hw, &pdev->dev);
 
-       IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
+       IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
        priv->cfg = cfg;
        priv->pci_dev = pdev;
 
@@ -3816,8 +3510,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                        err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32));
                /* both attempts failed: */
                if (err) {
-                       printk(KERN_WARNING "%s: No suitable DMA available.\n",
-                               DRV_NAME);
+                       IWL_WARN(priv, "No suitable DMA available.\n");
                        goto out_pci_disable_device;
                }
        }
@@ -3838,13 +3531,12 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
                goto out_pci_release_regions;
        }
 
-       IWL_DEBUG_INFO("pci_resource_len = 0x%08llx\n",
+       IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n",
                (unsigned long long) pci_resource_len(pdev, 0));
-       IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base);
+       IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base);
 
        iwl_hw_detect(priv);
-       printk(KERN_INFO DRV_NAME
-               ": Detected Intel Wireless WiFi Link %s REV=0x%X\n",
+       IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s REV=0x%X\n",
                priv->cfg->name, priv->hw_rev);
 
        /* We disable the RETRY_TIMEOUT register (0x41) to keep
@@ -3854,7 +3546,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        /* amp init */
        err = priv->cfg->ops->lib->apm_ops.init(priv);
        if (err < 0) {
-               IWL_DEBUG_INFO("Failed to init APMG\n");
+               IWL_DEBUG_INFO(priv, "Failed to init APMG\n");
                goto out_iounmap;
        }
        /*****************
@@ -3863,7 +3555,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        /* Read the EEPROM */
        err = iwl_eeprom_init(priv);
        if (err) {
-               IWL_ERROR("Unable to init EEPROM\n");
+               IWL_ERR(priv, "Unable to init EEPROM\n");
                goto out_iounmap;
        }
        err = iwl_eeprom_check_version(priv);
@@ -3872,14 +3564,14 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        /* extract MAC Address */
        iwl_eeprom_get_mac(priv, priv->mac_addr);
-       IWL_DEBUG_INFO("MAC address: %pM\n", priv->mac_addr);
+       IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->mac_addr);
        SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
 
        /************************
         * 5. Setup HW constants
         ************************/
        if (iwl_set_hw_params(priv)) {
-               IWL_ERROR("failed to set hw parameters\n");
+               IWL_ERR(priv, "failed to set hw parameters\n");
                goto out_free_eeprom;
        }
 
@@ -3899,7 +3591,7 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        /* Disable radio (SW RF KILL) via parameter when loading driver */
        if (priv->cfg->mod_params->disable) {
                set_bit(STATUS_RF_KILL_SW, &priv->status);
-               IWL_DEBUG_INFO("Radio disabled.\n");
+               IWL_DEBUG_INFO(priv, "Radio disabled.\n");
        }
 
        /********************
@@ -3909,43 +3601,65 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        iwl_disable_interrupts(priv);
        spin_unlock_irqrestore(&priv->lock, flags);
 
+       pci_enable_msi(priv->pci_dev);
+
+       err = request_irq(priv->pci_dev->irq, iwl_isr, IRQF_SHARED,
+                         DRV_NAME, priv);
+       if (err) {
+               IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);
+               goto out_disable_msi;
+       }
        err = sysfs_create_group(&pdev->dev.kobj, &iwl_attribute_group);
        if (err) {
-               IWL_ERROR("failed to create sysfs device attributes\n");
+               IWL_ERR(priv, "failed to create sysfs device attributes\n");
                goto out_uninit_drv;
        }
 
-
        iwl_setup_deferred_work(priv);
        iwl_setup_rx_handlers(priv);
 
-       /********************
-        * 9. Conclude
-        ********************/
-       pci_save_state(pdev);
-       pci_disable_device(pdev);
-
        /**********************************
-        * 10. Setup and register mac80211
+        * 9. Setup and register mac80211
         **********************************/
 
+       /* enable interrupts if needed: hw bug w/a */
+       pci_read_config_word(priv->pci_dev, PCI_COMMAND, &pci_cmd);
+       if (pci_cmd & PCI_COMMAND_INTX_DISABLE) {
+               pci_cmd &= ~PCI_COMMAND_INTX_DISABLE;
+               pci_write_config_word(priv->pci_dev, PCI_COMMAND, pci_cmd);
+       }
+
+       iwl_enable_interrupts(priv);
+
        err = iwl_setup_mac(priv);
        if (err)
                goto out_remove_sysfs;
 
        err = iwl_dbgfs_register(priv, DRV_NAME);
        if (err)
-               IWL_ERROR("failed to create debugfs files\n");
+               IWL_ERR(priv, "failed to create debugfs files\n");
+
+       /* If platform's RF_KILL switch is NOT set to KILL */
+       if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
+               clear_bit(STATUS_RF_KILL_HW, &priv->status);
+       else
+               set_bit(STATUS_RF_KILL_HW, &priv->status);
 
        err = iwl_rfkill_init(priv);
        if (err)
-               IWL_ERROR("Unable to initialize RFKILL system. "
+               IWL_ERR(priv, "Unable to initialize RFKILL system. "
                                  "Ignoring error: %d\n", err);
+       else
+               iwl_rfkill_set_hw_state(priv);
+
        iwl_power_initialize(priv);
        return 0;
 
  out_remove_sysfs:
        sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
+ out_disable_msi:
+       pci_disable_msi(priv->pci_dev);
+       pci_disable_device(priv->pci_dev);
  out_uninit_drv:
        iwl_uninit_drv(priv);
  out_free_eeprom:
@@ -3971,7 +3685,7 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
        if (!priv)
                return;
 
-       IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
+       IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
 
        iwl_dbgfs_unregister(priv);
        sysfs_remove_group(&pdev->dev.kobj, &iwl_attribute_group);
@@ -4017,6 +3731,8 @@ static void __devexit iwl_pci_remove(struct pci_dev *pdev)
        destroy_workqueue(priv->workqueue);
        priv->workqueue = NULL;
 
+       free_irq(priv->pci_dev->irq, priv);
+       pci_disable_msi(priv->pci_dev);
        pci_iounmap(pdev, priv->hw_base);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
@@ -4042,19 +3758,8 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
                priv->is_open = 1;
        }
 
-       /* pci driver assumes state will be saved in this function.
-        * pci state is saved and device disabled when interface is
-        * stopped, so at this time pci device will always be disabled -
-        * whether interface was started or not. saving pci state now will
-        * cause saved state be that of a disabled device, which will cause
-        * problems during resume in that we will end up with a disabled device.
-        *
-        * indicate that the current saved state (from when interface was
-        * stopped) is valid. if interface was never up at time of suspend
-        * then the saved state will still be valid as it was saved during
-        * .probe. */
-       pdev->state_saved = true;
-
+       pci_save_state(pdev);
+       pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
        return 0;
@@ -4063,8 +3768,14 @@ static int iwl_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 static int iwl_pci_resume(struct pci_dev *pdev)
 {
        struct iwl_priv *priv = pci_get_drvdata(pdev);
+       int ret;
 
        pci_set_power_state(pdev, PCI_D0);
+       ret = pci_enable_device(pdev);
+       if (ret)
+               return ret;
+       pci_restore_state(pdev);
+       iwl_enable_interrupts(priv);
 
        if (priv->is_open)
                iwl_mac_start(priv->hw);
@@ -4105,6 +3816,21 @@ static struct pci_device_id iwl_hw_card_ids[] = {
 /* 5150 Wifi/WiMax */
        {IWL_PCI_DEVICE(0x423C, PCI_ANY_ID, iwl5150_agn_cfg)},
        {IWL_PCI_DEVICE(0x423D, PCI_ANY_ID, iwl5150_agn_cfg)},
+/* 6000/6050 Series */
+       {IWL_PCI_DEVICE(0x0082, 0x1102, iwl6000_2ag_cfg)},
+       {IWL_PCI_DEVICE(0x0085, 0x1112, iwl6000_2ag_cfg)},
+       {IWL_PCI_DEVICE(0x0082, 0x1122, iwl6000_2ag_cfg)},
+       {IWL_PCI_DEVICE(0x422B, PCI_ANY_ID, iwl6000_3agn_cfg)},
+       {IWL_PCI_DEVICE(0x4238, PCI_ANY_ID, iwl6000_3agn_cfg)},
+       {IWL_PCI_DEVICE(0x0082, PCI_ANY_ID, iwl6000_2agn_cfg)},
+       {IWL_PCI_DEVICE(0x0085, PCI_ANY_ID, iwl6000_3agn_cfg)},
+       {IWL_PCI_DEVICE(0x0086, PCI_ANY_ID, iwl6050_3agn_cfg)},
+       {IWL_PCI_DEVICE(0x0087, PCI_ANY_ID, iwl6050_2agn_cfg)},
+       {IWL_PCI_DEVICE(0x0088, PCI_ANY_ID, iwl6050_3agn_cfg)},
+       {IWL_PCI_DEVICE(0x0089, PCI_ANY_ID, iwl6050_2agn_cfg)},
+/* 100 Series WiFi */
+       {IWL_PCI_DEVICE(0x0083, PCI_ANY_ID, iwl100_bgn_cfg)},
+       {IWL_PCI_DEVICE(0x0084, PCI_ANY_ID, iwl100_bgn_cfg)},
 #endif /* CONFIG_IWL5000 */
 
        {0}
@@ -4131,13 +3857,14 @@ static int __init iwl_init(void)
 
        ret = iwlagn_rate_control_register();
        if (ret) {
-               IWL_ERROR("Unable to register rate control algorithm: %d\n", ret);
+               printk(KERN_ERR DRV_NAME
+                      "Unable to register rate control algorithm: %d\n", ret);
                return ret;
        }
 
        ret = pci_register_driver(&iwl_driver);
        if (ret) {
-               IWL_ERROR("Unable to initialize PCI module\n");
+               printk(KERN_ERR DRV_NAME "Unable to initialize PCI module\n");
                goto error_register;
        }
 
index f836ecc55758a4d4ab12bf0a796fbd17b9ef2556..735f3f19928cb87f9f975cd7c231ca96f100b290 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -102,7 +102,7 @@ int iwl_send_calib_results(struct iwl_priv *priv)
 
        return 0;
 err:
-       IWL_ERROR("Error %d iteration %d\n", ret, i);
+       IWL_ERR(priv, "Error %d iteration %d\n", ret, i);
        return ret;
 }
 EXPORT_SYMBOL(iwl_send_calib_results);
@@ -202,7 +202,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
                val = data->nrg_silence_rssi[i];
                silence_ref = max(silence_ref, val);
        }
-       IWL_DEBUG_CALIB("silence a %u, b %u, c %u, 20-bcn max %u\n",
+       IWL_DEBUG_CALIB(priv, "silence a %u, b %u, c %u, 20-bcn max %u\n",
                        silence_rssi_a, silence_rssi_b, silence_rssi_c,
                        silence_ref);
 
@@ -226,7 +226,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
                max_nrg_cck = (u32) max(max_nrg_cck, (data->nrg_value[i]));
        max_nrg_cck += 6;
 
-       IWL_DEBUG_CALIB("rx energy a %u, b %u, c %u, 10-bcn max/min %u\n",
+       IWL_DEBUG_CALIB(priv, "rx energy a %u, b %u, c %u, 10-bcn max/min %u\n",
                        rx_info->beacon_energy_a, rx_info->beacon_energy_b,
                        rx_info->beacon_energy_c, max_nrg_cck - 6);
 
@@ -236,15 +236,15 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
                data->num_in_cck_no_fa++;
        else
                data->num_in_cck_no_fa = 0;
-       IWL_DEBUG_CALIB("consecutive bcns with few false alarms = %u\n",
+       IWL_DEBUG_CALIB(priv, "consecutive bcns with few false alarms = %u\n",
                        data->num_in_cck_no_fa);
 
        /* If we got too many false alarms this time, reduce sensitivity */
        if ((false_alarms > max_false_alarms) &&
                (data->auto_corr_cck > AUTO_CORR_MAX_TH_CCK)) {
-               IWL_DEBUG_CALIB("norm FA %u > max FA %u\n",
+               IWL_DEBUG_CALIB(priv, "norm FA %u > max FA %u\n",
                     false_alarms, max_false_alarms);
-               IWL_DEBUG_CALIB("... reducing sensitivity\n");
+               IWL_DEBUG_CALIB(priv, "... reducing sensitivity\n");
                data->nrg_curr_state = IWL_FA_TOO_MANY;
                /* Store for "fewer than desired" on later beacon */
                data->nrg_silence_ref = silence_ref;
@@ -266,7 +266,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
                data->nrg_auto_corr_silence_diff = (s32)data->nrg_silence_ref -
                                                   (s32)silence_ref;
 
-               IWL_DEBUG_CALIB("norm FA %u < min FA %u, silence diff %d\n",
+               IWL_DEBUG_CALIB(priv, "norm FA %u < min FA %u, silence diff %d\n",
                         false_alarms, min_false_alarms,
                         data->nrg_auto_corr_silence_diff);
 
@@ -280,17 +280,17 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
                        ((data->nrg_auto_corr_silence_diff > NRG_DIFF) ||
                        (data->num_in_cck_no_fa > MAX_NUMBER_CCK_NO_FA))) {
 
-                       IWL_DEBUG_CALIB("... increasing sensitivity\n");
+                       IWL_DEBUG_CALIB(priv, "... increasing sensitivity\n");
                        /* Increase nrg value to increase sensitivity */
                        val = data->nrg_th_cck + NRG_STEP_CCK;
                        data->nrg_th_cck = min((u32)ranges->min_nrg_cck, val);
                } else {
-                       IWL_DEBUG_CALIB("... but not changing sensitivity\n");
+                       IWL_DEBUG_CALIB(priv, "... but not changing sensitivity\n");
                }
 
        /* Else we got a healthy number of false alarms, keep status quo */
        } else {
-               IWL_DEBUG_CALIB(" FA in safe zone\n");
+               IWL_DEBUG_CALIB(priv, " FA in safe zone\n");
                data->nrg_curr_state = IWL_FA_GOOD_RANGE;
 
                /* Store for use in "fewer than desired" with later beacon */
@@ -300,7 +300,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
                 *   give it some extra margin by reducing sensitivity again
                 *   (but don't go below measured energy of desired Rx) */
                if (IWL_FA_TOO_MANY == data->nrg_prev_state) {
-                       IWL_DEBUG_CALIB("... increasing margin\n");
+                       IWL_DEBUG_CALIB(priv, "... increasing margin\n");
                        if (data->nrg_th_cck > (max_nrg_cck + NRG_MARGIN))
                                data->nrg_th_cck -= NRG_MARGIN;
                        else
@@ -314,7 +314,7 @@ static int iwl_sens_energy_cck(struct iwl_priv *priv,
         * Lower value is higher energy, so we use max()!
         */
        data->nrg_th_cck = max(max_nrg_cck, data->nrg_th_cck);
-       IWL_DEBUG_CALIB("new nrg_th_cck %u\n", data->nrg_th_cck);
+       IWL_DEBUG_CALIB(priv, "new nrg_th_cck %u\n", data->nrg_th_cck);
 
        data->nrg_prev_state = data->nrg_curr_state;
 
@@ -367,7 +367,7 @@ static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv,
        /* If we got too many false alarms this time, reduce sensitivity */
        if (false_alarms > max_false_alarms) {
 
-               IWL_DEBUG_CALIB("norm FA %u > max FA %u)\n",
+               IWL_DEBUG_CALIB(priv, "norm FA %u > max FA %u)\n",
                             false_alarms, max_false_alarms);
 
                val = data->auto_corr_ofdm + AUTO_CORR_STEP_OFDM;
@@ -390,7 +390,7 @@ static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv,
        /* Else if we got fewer than desired, increase sensitivity */
        else if (false_alarms < min_false_alarms) {
 
-               IWL_DEBUG_CALIB("norm FA %u < min FA %u\n",
+               IWL_DEBUG_CALIB(priv, "norm FA %u < min FA %u\n",
                             false_alarms, min_false_alarms);
 
                val = data->auto_corr_ofdm - AUTO_CORR_STEP_OFDM;
@@ -409,7 +409,7 @@ static int iwl_sens_auto_corr_ofdm(struct iwl_priv *priv,
                data->auto_corr_ofdm_mrc_x1 =
                        max((u32)ranges->auto_corr_min_ofdm_mrc_x1, val);
        } else {
-               IWL_DEBUG_CALIB("min FA %u < norm FA %u < max FA %u OK\n",
+               IWL_DEBUG_CALIB(priv, "min FA %u < norm FA %u < max FA %u OK\n",
                         min_false_alarms, false_alarms, max_false_alarms);
        }
        return 0;
@@ -452,18 +452,18 @@ static int iwl_sensitivity_write(struct iwl_priv *priv)
                                cpu_to_le16((u16)data->nrg_th_ofdm);
 
        cmd.table[HD_BARKER_CORR_TH_ADD_MIN_INDEX] =
-                               __constant_cpu_to_le16(190);
+                               cpu_to_le16(190);
        cmd.table[HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX] =
-                               __constant_cpu_to_le16(390);
+                               cpu_to_le16(390);
        cmd.table[HD_OFDM_ENERGY_TH_IN_INDEX] =
-                               __constant_cpu_to_le16(62);
+                               cpu_to_le16(62);
 
-       IWL_DEBUG_CALIB("ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n",
+       IWL_DEBUG_CALIB(priv, "ofdm: ac %u mrc %u x1 %u mrc_x1 %u thresh %u\n",
                        data->auto_corr_ofdm, data->auto_corr_ofdm_mrc,
                        data->auto_corr_ofdm_x1, data->auto_corr_ofdm_mrc_x1,
                        data->nrg_th_ofdm);
 
-       IWL_DEBUG_CALIB("cck: ac %u mrc %u thresh %u\n",
+       IWL_DEBUG_CALIB(priv, "cck: ac %u mrc %u thresh %u\n",
                        data->auto_corr_cck, data->auto_corr_cck_mrc,
                        data->nrg_th_cck);
 
@@ -473,7 +473,7 @@ static int iwl_sensitivity_write(struct iwl_priv *priv)
        /* Don't send command to uCode if nothing has changed */
        if (!memcmp(&cmd.table[0], &(priv->sensitivity_tbl[0]),
                    sizeof(u16)*HD_TABLE_SIZE)) {
-               IWL_DEBUG_CALIB("No change in SENSITIVITY_CMD\n");
+               IWL_DEBUG_CALIB(priv, "No change in SENSITIVITY_CMD\n");
                return 0;
        }
 
@@ -483,7 +483,7 @@ static int iwl_sensitivity_write(struct iwl_priv *priv)
 
        ret = iwl_send_cmd(priv, &cmd_out);
        if (ret)
-               IWL_ERROR("SENSITIVITY_CMD failed\n");
+               IWL_ERR(priv, "SENSITIVITY_CMD failed\n");
 
        return ret;
 }
@@ -498,7 +498,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
        if (priv->disable_sens_cal)
                return;
 
-       IWL_DEBUG_CALIB("Start iwl_init_sensitivity\n");
+       IWL_DEBUG_CALIB(priv, "Start iwl_init_sensitivity\n");
 
        /* Clear driver's sensitivity algo data */
        data = &(priv->sensitivity_data);
@@ -536,7 +536,7 @@ void iwl_init_sensitivity(struct iwl_priv *priv)
        data->last_fa_cnt_cck = 0;
 
        ret |= iwl_sensitivity_write(priv);
-       IWL_DEBUG_CALIB("<<return 0x%X\n", ret);
+       IWL_DEBUG_CALIB(priv, "<<return 0x%X\n", ret);
 }
 EXPORT_SYMBOL(iwl_init_sensitivity);
 
@@ -562,13 +562,13 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv,
        data = &(priv->sensitivity_data);
 
        if (!iwl_is_associated(priv)) {
-               IWL_DEBUG_CALIB("<< - not associated\n");
+               IWL_DEBUG_CALIB(priv, "<< - not associated\n");
                return;
        }
 
        spin_lock_irqsave(&priv->lock, flags);
        if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
-               IWL_DEBUG_CALIB("<< invalid data.\n");
+               IWL_DEBUG_CALIB(priv, "<< invalid data.\n");
                spin_unlock_irqrestore(&priv->lock, flags);
                return;
        }
@@ -595,10 +595,10 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv,
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       IWL_DEBUG_CALIB("rx_enable_time = %u usecs\n", rx_enable_time);
+       IWL_DEBUG_CALIB(priv, "rx_enable_time = %u usecs\n", rx_enable_time);
 
        if (!rx_enable_time) {
-               IWL_DEBUG_CALIB("<< RX Enable Time == 0! \n");
+               IWL_DEBUG_CALIB(priv, "<< RX Enable Time == 0! \n");
                return;
        }
 
@@ -637,7 +637,7 @@ void iwl_sensitivity_calibration(struct iwl_priv *priv,
        norm_fa_ofdm = fa_ofdm + bad_plcp_ofdm;
        norm_fa_cck = fa_cck + bad_plcp_cck;
 
-       IWL_DEBUG_CALIB("cck: fa %u badp %u  ofdm: fa %u badp %u\n", fa_cck,
+       IWL_DEBUG_CALIB(priv, "cck: fa %u badp %u  ofdm: fa %u badp %u\n", fa_cck,
                        bad_plcp_cck, fa_ofdm, bad_plcp_ofdm);
 
        iwl_sens_auto_corr_ofdm(priv, norm_fa_ofdm, rx_enable_time);
@@ -690,13 +690,13 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
         *   then we're done forever. */
        if (data->state != IWL_CHAIN_NOISE_ACCUMULATE) {
                if (data->state == IWL_CHAIN_NOISE_ALIVE)
-                       IWL_DEBUG_CALIB("Wait for noise calib reset\n");
+                       IWL_DEBUG_CALIB(priv, "Wait for noise calib reset\n");
                return;
        }
 
        spin_lock_irqsave(&priv->lock, flags);
        if (rx_info->interference_data_flag != INTERFERENCE_DATA_AVAILABLE) {
-               IWL_DEBUG_CALIB(" << Interference data unavailable\n");
+               IWL_DEBUG_CALIB(priv, " << Interference data unavailable\n");
                spin_unlock_irqrestore(&priv->lock, flags);
                return;
        }
@@ -709,7 +709,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
        /* Make sure we accumulate data for just the associated channel
         *   (even if scanning). */
        if ((rxon_chnum != stat_chnum) || (rxon_band24 != stat_band24)) {
-               IWL_DEBUG_CALIB("Stats not from chan=%d, band24=%d\n",
+               IWL_DEBUG_CALIB(priv, "Stats not from chan=%d, band24=%d\n",
                                rxon_chnum, rxon_band24);
                spin_unlock_irqrestore(&priv->lock, flags);
                return;
@@ -739,11 +739,11 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
        data->chain_signal_b = (chain_sig_b + data->chain_signal_b);
        data->chain_signal_c = (chain_sig_c + data->chain_signal_c);
 
-       IWL_DEBUG_CALIB("chan=%d, band24=%d, beacon=%d\n",
+       IWL_DEBUG_CALIB(priv, "chan=%d, band24=%d, beacon=%d\n",
                        rxon_chnum, rxon_band24, data->beacon_count);
-       IWL_DEBUG_CALIB("chain_sig: a %d b %d c %d\n",
+       IWL_DEBUG_CALIB(priv, "chain_sig: a %d b %d c %d\n",
                        chain_sig_a, chain_sig_b, chain_sig_c);
-       IWL_DEBUG_CALIB("chain_noise: a %d b %d c %d\n",
+       IWL_DEBUG_CALIB(priv, "chain_noise: a %d b %d c %d\n",
                        chain_noise_a, chain_noise_b, chain_noise_c);
 
        /* If this is the 20th beacon, determine:
@@ -773,9 +773,9 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
                active_chains = (1 << max_average_sig_antenna_i);
        }
 
-       IWL_DEBUG_CALIB("average_sig: a %d b %d c %d\n",
+       IWL_DEBUG_CALIB(priv, "average_sig: a %d b %d c %d\n",
                     average_sig[0], average_sig[1], average_sig[2]);
-       IWL_DEBUG_CALIB("max_average_sig = %d, antenna %d\n",
+       IWL_DEBUG_CALIB(priv, "max_average_sig = %d, antenna %d\n",
                     max_average_sig, max_average_sig_antenna_i);
 
        /* Compare signal strengths for all 3 receivers. */
@@ -789,7 +789,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
                                data->disconn_array[i] = 1;
                        else
                                active_chains |= (1 << i);
-                       IWL_DEBUG_CALIB("i = %d  rssiDelta = %d  "
+                       IWL_DEBUG_CALIB(priv, "i = %d  rssiDelta = %d  "
                             "disconn_array[i] = %d\n",
                             i, rssi_delta, data->disconn_array[i]);
                }
@@ -813,7 +813,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
                         * disconnected connect it anyway */
                        data->disconn_array[i] = 0;
                        active_chains |= ant_msk;
-                       IWL_DEBUG_CALIB("All Tx chains are disconnected W/A - "
+                       IWL_DEBUG_CALIB(priv, "All Tx chains are disconnected W/A - "
                                "declare %d as connected\n", i);
                        break;
                }
@@ -821,7 +821,7 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
 
        /* Save for use within RXON, TX, SCAN commands, etc. */
        priv->chain_noise_data.active_chains = active_chains;
-       IWL_DEBUG_CALIB("active_chains (bitwise) = 0x%x\n",
+       IWL_DEBUG_CALIB(priv, "active_chains (bitwise) = 0x%x\n",
                        active_chains);
 
        /* Analyze noise for rx balance */
@@ -839,15 +839,16 @@ void iwl_chain_noise_calibration(struct iwl_priv *priv,
                }
        }
 
-       IWL_DEBUG_CALIB("average_noise: a %d b %d c %d\n",
+       IWL_DEBUG_CALIB(priv, "average_noise: a %d b %d c %d\n",
                        average_noise[0], average_noise[1],
                        average_noise[2]);
 
-       IWL_DEBUG_CALIB("min_average_noise = %d, antenna %d\n",
+       IWL_DEBUG_CALIB(priv, "min_average_noise = %d, antenna %d\n",
                        min_average_noise, min_average_noise_antenna_i);
 
-       priv->cfg->ops->utils->gain_computation(priv, average_noise,
-               min_average_noise_antenna_i, min_average_noise);
+       if (priv->cfg->ops->utils->gain_computation)
+               priv->cfg->ops->utils->gain_computation(priv, average_noise,
+                       min_average_noise_antenna_i, min_average_noise);
 
        /* Some power changes may have been made during the calibration.
         * Update and commit the RXON
index 1abe84bb74ad0bd022e3a7318160f3c2e31c8c21..b6cef989a7965beb98a150d8702819d8381c4fbf 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index ba997204c8d4482a219128428629b8eebca4974f..29d40746da6a3112c34cb3997d4788607a6b2744 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #ifndef __iwl_commands_h__
 #define __iwl_commands_h__
 
+struct iwl_priv;
+
 /* uCode version contains 4 values: Major/Minor/API/Serial */
 #define IWL_UCODE_MAJOR(ver)   (((ver) & 0xFF000000) >> 24)
 #define IWL_UCODE_MINOR(ver)   (((ver) & 0x00FF0000) >> 16)
 #define IWL_UCODE_API(ver)     (((ver) & 0x0000FF00) >> 8)
 #define IWL_UCODE_SERIAL(ver)  ((ver) & 0x000000FF)
 
+
+/* Tx rates */
+#define IWL_CCK_RATES  4
+#define IWL_OFDM_RATES 8
+#define IWL_MAX_RATES  (IWL_CCK_RATES + IWL_OFDM_RATES)
+
 enum {
        REPLY_ALIVE = 0x1,
        REPLY_ERROR = 0x2,
@@ -136,9 +144,11 @@ enum {
        WHO_IS_AWAKE_NOTIFICATION = 0x94,       /* not used */
 
        /* Miscellaneous commands */
+       REPLY_TX_POWER_DBM_CMD = 0x95,
        QUIET_NOTIFICATION = 0x96,              /* not used */
        REPLY_TX_PWR_TABLE_CMD = 0x97,
-       REPLY_TX_POWER_DBM_CMD = 0x98,
+       REPLY_TX_POWER_DBM_CMD_V1 = 0x98,       /* old version of API */
+       TX_ANT_CONFIGURATION_CMD = 0x98,        /* not used */
        MEASURE_ABORT_NOTIFICATION = 0x99,      /* not used */
 
        /* Bluetooth device coexistence config command */
@@ -219,6 +229,37 @@ struct iwl_cmd_header {
        u8 data[0];
 } __attribute__ ((packed));
 
+
+/**
+ * struct iwl3945_tx_power
+ *
+ * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_SCAN_CMD, REPLY_CHANNEL_SWITCH
+ *
+ * Each entry contains two values:
+ * 1)  DSP gain (or sometimes called DSP attenuation).  This is a fine-grained
+ *     linear value that multiplies the output of the digital signal processor,
+ *     before being sent to the analog radio.
+ * 2)  Radio gain.  This sets the analog gain of the radio Tx path.
+ *     It is a coarser setting, and behaves in a logarithmic (dB) fashion.
+ *
+ * Driver obtains values from struct iwl3945_tx_power power_gain_table[][].
+ */
+struct iwl3945_tx_power {
+       u8 tx_gain;             /* gain for analog radio */
+       u8 dsp_atten;           /* gain for DSP */
+} __attribute__ ((packed));
+
+/**
+ * struct iwl3945_power_per_rate
+ *
+ * Used in REPLY_TX_PWR_TABLE_CMD, REPLY_CHANNEL_SWITCH
+ */
+struct iwl3945_power_per_rate {
+       u8 rate;                /* plcp */
+       struct iwl3945_tx_power tpc;
+       u8 reserved;
+} __attribute__ ((packed));
+
 /**
  * iwlagn rate_n_flags bit fields
  *
@@ -300,11 +341,12 @@ struct iwl_cmd_header {
  * 5350 has 3 transmitters
  * bit14:16
  */
-#define RATE_MCS_ANT_POS      14
-#define RATE_MCS_ANT_A_MSK    0x04000
-#define RATE_MCS_ANT_B_MSK    0x08000
-#define RATE_MCS_ANT_C_MSK    0x10000
-#define RATE_MCS_ANT_ABC_MSK  0x1C000
+#define RATE_MCS_ANT_POS       14
+#define RATE_MCS_ANT_A_MSK     0x04000
+#define RATE_MCS_ANT_B_MSK     0x08000
+#define RATE_MCS_ANT_C_MSK     0x10000
+#define RATE_MCS_ANT_AB_MSK    (RATE_MCS_ANT_A_MSK | RATE_MCS_ANT_B_MSK)
+#define RATE_MCS_ANT_ABC_MSK   (RATE_MCS_ANT_AB_MSK | RATE_MCS_ANT_C_MSK)
 #define RATE_ANT_NUM 3
 
 #define POWER_TABLE_NUM_ENTRIES                        33
@@ -492,8 +534,6 @@ struct iwl_alive_resp {
        __le32 is_valid;
 } __attribute__ ((packed));
 
-
-
 /*
  * REPLY_ERROR = 0x2 (response only, not a command)
  */
@@ -525,6 +565,7 @@ enum {
 
 
 #define RXON_RX_CHAIN_DRIVER_FORCE_MSK         cpu_to_le16(0x1 << 0)
+#define RXON_RX_CHAIN_DRIVER_FORCE_POS         (0)
 #define RXON_RX_CHAIN_VALID_MSK                        cpu_to_le16(0x7 << 1)
 #define RXON_RX_CHAIN_VALID_POS                        (1)
 #define RXON_RX_CHAIN_FORCE_SEL_MSK            cpu_to_le16(0x7 << 4)
@@ -611,6 +652,26 @@ enum {
  *        issue a new REPLY_TX_PWR_TABLE_CMD after each REPLY_RXON (0x10),
  *        regardless of whether RXON_FILTER_ASSOC_MSK is set.
  */
+
+struct iwl3945_rxon_cmd {
+       u8 node_addr[6];
+       __le16 reserved1;
+       u8 bssid_addr[6];
+       __le16 reserved2;
+       u8 wlap_bssid_addr[6];
+       __le16 reserved3;
+       u8 dev_type;
+       u8 air_propagation;
+       __le16 reserved4;
+       u8 ofdm_basic_rates;
+       u8 cck_basic_rates;
+       __le16 assoc_id;
+       __le32 flags;
+       __le32 filter_flags;
+       __le16 channel;
+       __le16 reserved5;
+} __attribute__ ((packed));
+
 struct iwl4965_rxon_cmd {
        u8 node_addr[6];
        __le16 reserved1;
@@ -656,33 +717,41 @@ struct iwl_rxon_cmd {
        __le16 reserved6;
 } __attribute__ ((packed));
 
-struct iwl5000_rxon_assoc_cmd {
+/*
+ * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
+ */
+struct iwl3945_rxon_assoc_cmd {
+       __le32 flags;
+       __le32 filter_flags;
+       u8 ofdm_basic_rates;
+       u8 cck_basic_rates;
+       __le16 reserved;
+} __attribute__ ((packed));
+
+struct iwl4965_rxon_assoc_cmd {
        __le32 flags;
        __le32 filter_flags;
        u8 ofdm_basic_rates;
        u8 cck_basic_rates;
-       __le16 reserved1;
        u8 ofdm_ht_single_stream_basic_rates;
        u8 ofdm_ht_dual_stream_basic_rates;
-       u8 ofdm_ht_triple_stream_basic_rates;
-       u8 reserved2;
        __le16 rx_chain_select_flags;
-       __le16 acquisition_data;
-       __le32 reserved3;
+       __le16 reserved;
 } __attribute__ ((packed));
 
-/*
- * REPLY_RXON_ASSOC = 0x11 (command, has simple generic response)
- */
-struct iwl4965_rxon_assoc_cmd {
+struct iwl5000_rxon_assoc_cmd {
        __le32 flags;
        __le32 filter_flags;
        u8 ofdm_basic_rates;
        u8 cck_basic_rates;
+       __le16 reserved1;
        u8 ofdm_ht_single_stream_basic_rates;
        u8 ofdm_ht_dual_stream_basic_rates;
+       u8 ofdm_ht_triple_stream_basic_rates;
+       u8 reserved2;
        __le16 rx_chain_select_flags;
-       __le16 reserved;
+       __le16 acquisition_data;
+       __le32 reserved3;
 } __attribute__ ((packed));
 
 #define IWL_CONN_MAX_LISTEN_INTERVAL   10
@@ -702,6 +771,16 @@ struct iwl_rxon_time_cmd {
 /*
  * REPLY_CHANNEL_SWITCH = 0x72 (command, has simple generic response)
  */
+struct iwl3945_channel_switch_cmd {
+       u8 band;
+       u8 expect_beacon;
+       __le16 channel;
+       __le32 rxon_flags;
+       __le32 rxon_filter_flags;
+       __le32 switch_time;
+       struct iwl3945_power_per_rate power[IWL_MAX_RATES];
+} __attribute__ ((packed));
+
 struct iwl_channel_switch_cmd {
        u8 band;
        u8 expect_beacon;
@@ -783,6 +862,8 @@ struct iwl_qosparam_cmd {
 #define        IWL_AP_ID               0
 #define IWL_MULTICAST_ID       1
 #define        IWL_STA_ID              2
+#define        IWL3945_BROADCAST_ID    24
+#define IWL3945_STATION_COUNT  25
 #define IWL4965_BROADCAST_ID   31
 #define        IWL4965_STATION_COUNT   32
 #define IWL5000_BROADCAST_ID   15
@@ -791,6 +872,8 @@ struct iwl_qosparam_cmd {
 #define        IWL_STATION_COUNT       32      /* MAX(3945,4965)*/
 #define        IWL_INVALID_STATION     255
 
+#define STA_FLG_TX_RATE_MSK            cpu_to_le32(1 << 2);
+#define STA_FLG_PWR_SAVE_MSK           cpu_to_le32(1 << 8);
 #define STA_FLG_PWR_SAVE_MSK           cpu_to_le32(1 << 8);
 #define STA_FLG_RTS_MIMO_PROT_MSK      cpu_to_le32(1 << 17)
 #define STA_FLG_AGG_MPDU_8US_MSK       cpu_to_le32(1 << 18)
@@ -901,6 +984,35 @@ struct sta_id_modify {
  *        used as AP, or in an IBSS network, driver must set up station table
  *        entries for all STAs in network, starting with index IWL_STA_ID.
  */
+
+struct iwl3945_addsta_cmd {
+       u8 mode;                /* 1: modify existing, 0: add new station */
+       u8 reserved[3];
+       struct sta_id_modify sta;
+       struct iwl4965_keyinfo key;
+       __le32 station_flags;           /* STA_FLG_* */
+       __le32 station_flags_msk;       /* STA_FLG_* */
+
+       /* bit field to disable (1) or enable (0) Tx for Traffic ID (TID)
+        * corresponding to bit (e.g. bit 5 controls TID 5).
+        * Set modify_mask bit STA_MODIFY_TID_DISABLE_TX to use this field. */
+       __le16 tid_disable_tx;
+
+       __le16 rate_n_flags;
+
+       /* TID for which to add block-ack support.
+        * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+       u8 add_immediate_ba_tid;
+
+       /* TID for which to remove block-ack support.
+        * Set modify_mask bit STA_MODIFY_DELBA_TID_MSK to use this field. */
+       u8 remove_immediate_ba_tid;
+
+       /* Starting Sequence Number for added block-ack support.
+        * Set modify_mask bit STA_MODIFY_ADDBA_TID_MSK to use this field. */
+       __le16 add_immediate_ba_ssn;
+} __attribute__ ((packed));
+
 struct iwl4965_addsta_cmd {
        u8 mode;                /* 1: modify existing, 0: add new station */
        u8 reserved[3];
@@ -1054,6 +1166,48 @@ struct iwl_wep_cmd {
 #define RX_MPDU_RES_STATUS_TTAK_OK     (1 << 7)
 #define RX_MPDU_RES_STATUS_DEC_DONE_MSK        (0x800)
 
+
+struct iwl3945_rx_frame_stats {
+       u8 phy_count;
+       u8 id;
+       u8 rssi;
+       u8 agc;
+       __le16 sig_avg;
+       __le16 noise_diff;
+       u8 payload[0];
+} __attribute__ ((packed));
+
+struct iwl3945_rx_frame_hdr {
+       __le16 channel;
+       __le16 phy_flags;
+       u8 reserved1;
+       u8 rate;
+       __le16 len;
+       u8 payload[0];
+} __attribute__ ((packed));
+
+struct iwl3945_rx_frame_end {
+       __le32 status;
+       __le64 timestamp;
+       __le32 beacon_timestamp;
+} __attribute__ ((packed));
+
+/*
+ * REPLY_3945_RX = 0x1b (response only, not a command)
+ *
+ * NOTE:  DO NOT dereference from casts to this structure
+ * It is provided only for calculating minimum data set size.
+ * The actual offsets of the hdr and end are dynamic based on
+ * stats.phy_count
+ */
+struct iwl3945_rx_frame {
+       struct iwl3945_rx_frame_stats stats;
+       struct iwl3945_rx_frame_hdr hdr;
+       struct iwl3945_rx_frame_end end;
+} __attribute__ ((packed));
+
+#define IWL39_RX_FRAME_SIZE    (4 + sizeof(struct iwl3945_rx_frame))
+
 /* Fixed (non-configurable) rx data from phy */
 
 #define IWL49_RX_RES_PHY_CNT 14
@@ -1233,6 +1387,84 @@ struct iwl4965_rx_mpdu_res_start {
 #define CCMP_MIC_LEN 8
 #define TKIP_ICV_LEN 4
 
+/*
+ * REPLY_TX = 0x1c (command)
+ */
+
+struct iwl3945_tx_cmd {
+       /*
+        * MPDU byte count:
+        * MAC header (24/26/30/32 bytes) + 2 bytes pad if 26/30 header size,
+        * + 8 byte IV for CCM or TKIP (not used for WEP)
+        * + Data payload
+        * + 8-byte MIC (not used for CCM/WEP)
+        * NOTE:  Does not include Tx command bytes, post-MAC pad bytes,
+        *        MIC (CCM) 8 bytes, ICV (WEP/TKIP/CKIP) 4 bytes, CRC 4 bytes.i
+        * Range: 14-2342 bytes.
+        */
+       __le16 len;
+
+       /*
+        * MPDU or MSDU byte count for next frame.
+        * Used for fragmentation and bursting, but not 11n aggregation.
+        * Same as "len", but for next frame.  Set to 0 if not applicable.
+        */
+       __le16 next_frame_len;
+
+       __le32 tx_flags;        /* TX_CMD_FLG_* */
+
+       u8 rate;
+
+       /* Index of recipient station in uCode's station table */
+       u8 sta_id;
+       u8 tid_tspec;
+       u8 sec_ctl;
+       u8 key[16];
+       union {
+               u8 byte[8];
+               __le16 word[4];
+               __le32 dw[2];
+       } tkip_mic;
+       __le32 next_frame_info;
+       union {
+               __le32 life_time;
+               __le32 attempt;
+       } stop_time;
+       u8 supp_rates[2];
+       u8 rts_retry_limit;     /*byte 50 */
+       u8 data_retry_limit;    /*byte 51 */
+       union {
+               __le16 pm_frame_timeout;
+               __le16 attempt_duration;
+       } timeout;
+
+       /*
+        * Duration of EDCA burst Tx Opportunity, in 32-usec units.
+        * Set this if txop time is not specified by HCCA protocol (e.g. by AP).
+        */
+       __le16 driver_txop;
+
+       /*
+        * MAC header goes here, followed by 2 bytes padding if MAC header
+        * length is 26 or 30 bytes, followed by payload data
+        */
+       u8 payload[0];
+       struct ieee80211_hdr hdr[0];
+} __attribute__ ((packed));
+
+/*
+ * REPLY_TX = 0x1c (response)
+ */
+struct iwl3945_tx_resp {
+       u8 failure_rts;
+       u8 failure_frame;
+       u8 bt_kill_count;
+       u8 rate;
+       __le32 wireless_media_time;
+       __le32 status;          /* TX status */
+} __attribute__ ((packed));
+
+
 /*
  * 4965 uCode updates these Tx attempt count values in host DRAM.
  * Used for managing Tx retries when expecting block-acks.
@@ -1244,9 +1476,6 @@ struct iwl_dram_scratch {
        __le16 reserved;
 } __attribute__ ((packed));
 
-/*
- * REPLY_TX = 0x1c (command)
- */
 struct iwl_tx_cmd {
        /*
         * MPDU byte count:
@@ -1584,6 +1813,14 @@ struct iwl_compressed_ba_resp {
  *
  * See details under "TXPOWER" in iwl-4965-hw.h.
  */
+
+struct iwl3945_txpowertable_cmd {
+       u8 band;                /* 0: 5 GHz, 1: 2.4 GHz */
+       u8 reserved;
+       __le16 channel;
+       struct iwl3945_power_per_rate power[IWL_MAX_RATES];
+} __attribute__ ((packed));
+
 struct iwl4965_txpowertable_cmd {
        u8 band;                /* 0: 5 GHz, 1: 2.4 GHz */
        u8 reserved;
@@ -1591,6 +1828,35 @@ struct iwl4965_txpowertable_cmd {
        struct iwl4965_tx_power_db tx_power;
 } __attribute__ ((packed));
 
+
+/**
+ * struct iwl3945_rate_scaling_cmd - Rate Scaling Command & Response
+ *
+ * REPLY_RATE_SCALE = 0x47 (command, has simple generic response)
+ *
+ * NOTE: The table of rates passed to the uCode via the
+ * RATE_SCALE command sets up the corresponding order of
+ * rates used for all related commands, including rate
+ * masks, etc.
+ *
+ * For example, if you set 9MB (PLCP 0x0f) as the first
+ * rate in the rate table, the bit mask for that rate
+ * when passed through ofdm_basic_rates on the REPLY_RXON
+ * command would be bit 0 (1 << 0)
+ */
+struct iwl3945_rate_scaling_info {
+       __le16 rate_n_flags;
+       u8 try_cnt;
+       u8 next_rate_index;
+} __attribute__ ((packed));
+
+struct iwl3945_rate_scaling_cmd {
+       u8 table_id;
+       u8 reserved[3];
+       struct iwl3945_rate_scaling_info table[IWL_MAX_RATES];
+} __attribute__ ((packed));
+
+
 /*RS_NEW_API: only TLC_RTS remains and moved to bit 0 */
 #define  LINK_QUAL_FLAGS_SET_STA_TLC_RTS_MSK   (1 << 0)
 
@@ -2044,15 +2310,23 @@ struct iwl_spectrum_notification {
  */
 #define IWL_POWER_VEC_SIZE 5
 
-#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK       cpu_to_le16(1 << 0)
-#define IWL_POWER_SLEEP_OVER_DTIM_MSK          cpu_to_le16(1 << 2)
-#define IWL_POWER_PCI_PM_MSK                   cpu_to_le16(1 << 3)
-#define IWL_POWER_FAST_PD                      cpu_to_le16(1 << 4)
+#define IWL_POWER_DRIVER_ALLOW_SLEEP_MSK       cpu_to_le16(BIT(0))
+#define IWL_POWER_SLEEP_OVER_DTIM_MSK          cpu_to_le16(BIT(2))
+#define IWL_POWER_PCI_PM_MSK                   cpu_to_le16(BIT(3))
+#define IWL_POWER_FAST_PD                      cpu_to_le16(BIT(4))
+
+struct iwl3945_powertable_cmd {
+       __le16 flags;
+       u8 reserved[2];
+       __le32 rx_data_timeout;
+       __le32 tx_data_timeout;
+       __le32 sleep_interval[IWL_POWER_VEC_SIZE];
+} __attribute__ ((packed));
 
 struct iwl_powertable_cmd {
        __le16 flags;
-       u8 keep_alive_seconds;
-       u8 debug_flags;
+       u8 keep_alive_seconds;          /* 3945 reserved */
+       u8 debug_flags;                 /* 3945 reserved */
        __le32 rx_data_timeout;
        __le32 tx_data_timeout;
        __le32 sleep_interval[IWL_POWER_VEC_SIZE];
@@ -2143,6 +2417,26 @@ struct iwl_ct_kill_config {
  *     passive_dwell < max_out_time
  *     active_dwell < max_out_time
  */
+
+/* FIXME: rename to AP1, remove tpc */
+struct iwl3945_scan_channel {
+       /*
+        * type is defined as:
+        * 0:0 1 = active, 0 = passive
+        * 1:4 SSID direct bit map; if a bit is set, then corresponding
+        *     SSID IE is transmitted in probe request.
+        * 5:7 reserved
+        */
+       u8 type;
+       u8 channel;     /* band is selected by iwl3945_scan_cmd "flags" field */
+       struct iwl3945_tx_power tpc;
+       __le16 active_dwell;    /* in 1024-uSec TU (time units), typ 5-50 */
+       __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
+} __attribute__ ((packed));
+
+/* set number of direct probes u8 type */
+#define IWL39_SCAN_PROBE_MASK(n) ((BIT(n) | (BIT(n) - BIT(1))))
+
 struct iwl_scan_channel {
        /*
         * type is defined as:
@@ -2159,6 +2453,9 @@ struct iwl_scan_channel {
        __le16 passive_dwell;   /* in 1024-uSec TU (time units), typ 20-500 */
 } __attribute__ ((packed));
 
+/* set number of direct probes __le32 type */
+#define IWL_SCAN_PROBE_MASK(n)         cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
+
 /**
  * struct iwl_ssid_ie - directed scan network information element
  *
@@ -2172,6 +2469,7 @@ struct iwl_ssid_ie {
        u8 ssid[32];
 } __attribute__ ((packed));
 
+#define PROBE_OPTION_MAX_API1          0x4
 #define PROBE_OPTION_MAX               0x14
 #define TX_CMD_LIFE_TIME_INFINITE      cpu_to_le32(0xFFFFFFFF)
 #define IWL_GOOD_CRC_TH                        cpu_to_le16(1)
@@ -2229,6 +2527,51 @@ struct iwl_ssid_ie {
  * To avoid uCode errors, see timing restrictions described under
  * struct iwl_scan_channel.
  */
+
+struct iwl3945_scan_cmd {
+       __le16 len;
+       u8 reserved0;
+       u8 channel_count;       /* # channels in channel list */
+       __le16 quiet_time;      /* dwell only this # millisecs on quiet channel
+                                * (only for active scan) */
+       __le16 quiet_plcp_th;   /* quiet chnl is < this # pkts (typ. 1) */
+       __le16 good_CRC_th;     /* passive -> active promotion threshold */
+       __le16 reserved1;
+       __le32 max_out_time;    /* max usec to be away from associated (service)
+                                * channel */
+       __le32 suspend_time;    /* pause scan this long (in "extended beacon
+                                * format") when returning to service channel:
+                                * 3945; 31:24 # beacons, 19:0 additional usec,
+                                * 4965; 31:22 # beacons, 21:0 additional usec.
+                                */
+       __le32 flags;           /* RXON_FLG_* */
+       __le32 filter_flags;    /* RXON_FILTER_* */
+
+       /* For active scans (set to all-0s for passive scans).
+        * Does not include payload.  Must specify Tx rate; no rate scaling. */
+       struct iwl3945_tx_cmd tx_cmd;
+
+       /* For directed active scans (set to all-0s otherwise) */
+       struct iwl_ssid_ie direct_scan[PROBE_OPTION_MAX_API1];
+
+       /*
+        * Probe request frame, followed by channel list.
+        *
+        * Size of probe request frame is specified by byte count in tx_cmd.
+        * Channel list follows immediately after probe request frame.
+        * Number of channels in list is specified by channel_count.
+        * Each channel in list is of type:
+        *
+        * struct iwl3945_scan_channel channels[0];
+        *
+        * NOTE:  Only one band of channels can be scanned per pass.  You
+        * must not mix 2.4GHz channels and 5.2GHz channels, and you must wait
+        * for one scan to complete (i.e. receive SCAN_COMPLETE_NOTIFICATION)
+        * before requesting another scan.
+        */
+       u8 data[0];
+} __attribute__ ((packed));
+
 struct iwl_scan_cmd {
        __le16 len;
        u8 reserved0;
@@ -2336,6 +2679,14 @@ struct iwl_scancomplete_notification {
 /*
  * BEACON_NOTIFICATION = 0x90 (notification only, not a command)
  */
+
+struct iwl3945_beacon_notif {
+       struct iwl3945_tx_resp beacon_notify_hdr;
+       __le32 low_tsf;
+       __le32 high_tsf;
+       __le32 ibss_mgr_status;
+} __attribute__ ((packed));
+
 struct iwl4965_beacon_notif {
        struct iwl4965_tx_resp beacon_notify_hdr;
        __le32 low_tsf;
@@ -2346,6 +2697,15 @@ struct iwl4965_beacon_notif {
 /*
  * REPLY_TX_BEACON = 0x91 (command, has simple generic response)
  */
+
+struct iwl3945_tx_beacon_cmd {
+       struct iwl3945_tx_cmd tx;
+       __le16 tim_idx;
+       u8 tim_size;
+       u8 reserved1;
+       struct ieee80211_hdr frame[0];  /* beacon frame */
+} __attribute__ ((packed));
+
 struct iwl_tx_beacon_cmd {
        struct iwl_tx_cmd tx;
        __le16 tim_idx;
@@ -2382,6 +2742,76 @@ struct rate_histogram {
 
 /* statistics command response */
 
+struct iwl39_statistics_rx_phy {
+       __le32 ina_cnt;
+       __le32 fina_cnt;
+       __le32 plcp_err;
+       __le32 crc32_err;
+       __le32 overrun_err;
+       __le32 early_overrun_err;
+       __le32 crc32_good;
+       __le32 false_alarm_cnt;
+       __le32 fina_sync_err_cnt;
+       __le32 sfd_timeout;
+       __le32 fina_timeout;
+       __le32 unresponded_rts;
+       __le32 rxe_frame_limit_overrun;
+       __le32 sent_ack_cnt;
+       __le32 sent_cts_cnt;
+} __attribute__ ((packed));
+
+struct iwl39_statistics_rx_non_phy {
+       __le32 bogus_cts;       /* CTS received when not expecting CTS */
+       __le32 bogus_ack;       /* ACK received when not expecting ACK */
+       __le32 non_bssid_frames;        /* number of frames with BSSID that
+                                        * doesn't belong to the STA BSSID */
+       __le32 filtered_frames; /* count frames that were dumped in the
+                                * filtering process */
+       __le32 non_channel_beacons;     /* beacons with our bss id but not on
+                                        * our serving channel */
+} __attribute__ ((packed));
+
+struct iwl39_statistics_rx {
+       struct iwl39_statistics_rx_phy ofdm;
+       struct iwl39_statistics_rx_phy cck;
+       struct iwl39_statistics_rx_non_phy general;
+} __attribute__ ((packed));
+
+struct iwl39_statistics_tx {
+       __le32 preamble_cnt;
+       __le32 rx_detected_cnt;
+       __le32 bt_prio_defer_cnt;
+       __le32 bt_prio_kill_cnt;
+       __le32 few_bytes_cnt;
+       __le32 cts_timeout;
+       __le32 ack_timeout;
+       __le32 expected_ack_cnt;
+       __le32 actual_ack_cnt;
+} __attribute__ ((packed));
+
+struct statistics_dbg {
+       __le32 burst_check;
+       __le32 burst_count;
+       __le32 reserved[4];
+} __attribute__ ((packed));
+
+struct iwl39_statistics_div {
+       __le32 tx_on_a;
+       __le32 tx_on_b;
+       __le32 exec_time;
+       __le32 probe_time;
+} __attribute__ ((packed));
+
+struct iwl39_statistics_general {
+       __le32 temperature;
+       struct statistics_dbg dbg;
+       __le32 sleep_time;
+       __le32 slots_out;
+       __le32 slots_idle;
+       __le32 ttl_timestamp;
+       struct iwl39_statistics_div div;
+} __attribute__ ((packed));
+
 struct statistics_rx_phy {
        __le32 ina_cnt;
        __le32 fina_cnt;
@@ -2418,7 +2848,7 @@ struct statistics_rx_ht_phy {
        __le32 reserved2;
 } __attribute__ ((packed));
 
-#define INTERFERENCE_DATA_AVAILABLE      __constant_cpu_to_le32(1)
+#define INTERFERENCE_DATA_AVAILABLE      cpu_to_le32(1)
 
 struct statistics_rx_non_phy {
        __le32 bogus_cts;       /* CTS received when not expecting CTS */
@@ -2493,11 +2923,6 @@ struct statistics_tx {
        struct statistics_tx_non_phy_agg agg;
 } __attribute__ ((packed));
 
-struct statistics_dbg {
-       __le32 burst_check;
-       __le32 burst_count;
-       __le32 reserved[4];
-} __attribute__ ((packed));
 
 struct statistics_div {
        __le32 tx_on_a;
@@ -2561,6 +2986,14 @@ struct iwl_statistics_cmd {
  */
 #define STATISTICS_REPLY_FLG_BAND_24G_MSK         cpu_to_le32(0x2)
 #define STATISTICS_REPLY_FLG_FAT_MODE_MSK         cpu_to_le32(0x8)
+
+struct iwl3945_notif_statistics {
+       __le32 flag;
+       struct iwl39_statistics_rx rx;
+       struct iwl39_statistics_tx tx;
+       struct iwl39_statistics_general general;
+} __attribute__ ((packed));
+
 struct iwl_notif_statistics {
        __le32 flag;
        struct statistics_rx rx;
@@ -3012,6 +3445,10 @@ struct iwl_rx_packet {
        __le32 len;
        struct iwl_cmd_header hdr;
        union {
+               struct iwl3945_rx_frame rx_frame;
+               struct iwl3945_tx_resp tx_resp;
+               struct iwl3945_beacon_notif beacon_status;
+
                struct iwl_alive_resp alive_frame;
                struct iwl_spectrum_notification spectrum_notif;
                struct iwl_csa_notification csa_notif;
@@ -3029,6 +3466,6 @@ struct iwl_rx_packet {
        } u;
 } __attribute__ ((packed));
 
-int iwl_agn_check_rxon_cmd(struct iwl_rxon_cmd *rxon);
+int iwl_agn_check_rxon_cmd(struct iwl_priv *priv);
 
 #endif                         /* __iwl_commands_h__ */
index 73d7973707eb023243dccc545a9bc0f29570e291..260bf903cb71ae36e3f2e24cc9c1db0fa5d4738e 100644 (file)
@@ -2,7 +2,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -28,6 +28,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/etherdevice.h>
 #include <net/mac80211.h>
 
 #include "iwl-eeprom.h"
@@ -170,7 +171,8 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
        struct ieee80211_hw *hw =
                ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops);
        if (hw == NULL) {
-               IWL_ERROR("Can not allocate network device\n");
+               printk(KERN_ERR "%s: Can not allocate network device\n",
+                      cfg->name);
                goto out;
        }
 
@@ -210,7 +212,7 @@ int iwl_hw_nic_init(struct iwl_priv *priv)
        if (!rxq->bd) {
                ret = iwl_rx_queue_alloc(priv);
                if (ret) {
-                       IWL_ERROR("Unable to initialize Rx queue\n");
+                       IWL_ERR(priv, "Unable to initialize Rx queue\n");
                        return -ENOMEM;
                }
        } else
@@ -321,7 +323,7 @@ void iwl_reset_qos(struct iwl_priv *priv)
                        priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
                }
        }
-       IWL_DEBUG_QOS("set QoS to default \n");
+       IWL_DEBUG_QOS(priv, "set QoS to default \n");
 
        spin_unlock_irqrestore(&priv->lock, flags);
 }
@@ -402,10 +404,11 @@ static void iwlcore_init_hw_rates(struct iwl_priv *priv,
        }
 }
 
+
 /**
  * iwlcore_init_geos - Initialize mac80211's geo/channel info based from eeprom
  */
-static int iwlcore_init_geos(struct iwl_priv *priv)
+int iwlcore_init_geos(struct iwl_priv *priv)
 {
        struct iwl_channel_info *ch;
        struct ieee80211_supported_band *sband;
@@ -416,7 +419,7 @@ static int iwlcore_init_geos(struct iwl_priv *priv)
 
        if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
            priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
-               IWL_DEBUG_INFO("Geography modes already initialized.\n");
+               IWL_DEBUG_INFO(priv, "Geography modes already initialized.\n");
                set_bit(STATUS_GEO_CONFIGURED, &priv->status);
                return 0;
        }
@@ -457,8 +460,6 @@ static int iwlcore_init_geos(struct iwl_priv *priv)
        priv->ieee_channels = channels;
        priv->ieee_rates = rates;
 
-       iwlcore_init_hw_rates(priv, rates);
-
        for (i = 0;  i < priv->channel_count; i++) {
                ch = &priv->channel_info[i];
 
@@ -500,7 +501,7 @@ static int iwlcore_init_geos(struct iwl_priv *priv)
                /* Save flags for reg domain usage */
                geo_ch->orig_flags = geo_ch->flags;
 
-               IWL_DEBUG_INFO("Channel %d Freq=%d[%sGHz] %s flag=0x%X\n",
+               IWL_DEBUG_INFO(priv, "Channel %d Freq=%d[%sGHz] %s flag=0x%X\n",
                                ch->channel, geo_ch->center_freq,
                                is_channel_a_band(ch) ?  "5.2" : "2.4",
                                geo_ch->flags & IEEE80211_CHAN_DISABLED ?
@@ -510,33 +511,33 @@ static int iwlcore_init_geos(struct iwl_priv *priv)
 
        if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
             priv->cfg->sku & IWL_SKU_A) {
-               printk(KERN_INFO DRV_NAME
-                      ": Incorrectly detected BG card as ABG.  Please send "
-                      "your PCI ID 0x%04X:0x%04X to maintainer.\n",
-                      priv->pci_dev->device, priv->pci_dev->subsystem_device);
+               IWL_INFO(priv, "Incorrectly detected BG card as ABG. "
+                       "Please send your PCI ID 0x%04X:0x%04X to maintainer.\n",
+                          priv->pci_dev->device,
+                          priv->pci_dev->subsystem_device);
                priv->cfg->sku &= ~IWL_SKU_A;
        }
 
-       printk(KERN_INFO DRV_NAME
-              ": Tunable channels: %d 802.11bg, %d 802.11a channels\n",
-              priv->bands[IEEE80211_BAND_2GHZ].n_channels,
-              priv->bands[IEEE80211_BAND_5GHZ].n_channels);
-
+       IWL_INFO(priv, "Tunable channels: %d 802.11bg, %d 802.11a channels\n",
+                  priv->bands[IEEE80211_BAND_2GHZ].n_channels,
+                  priv->bands[IEEE80211_BAND_5GHZ].n_channels);
 
        set_bit(STATUS_GEO_CONFIGURED, &priv->status);
 
        return 0;
 }
+EXPORT_SYMBOL(iwlcore_init_geos);
 
 /*
  * iwlcore_free_geos - undo allocations in iwlcore_init_geos
  */
-static void iwlcore_free_geos(struct iwl_priv *priv)
+void iwlcore_free_geos(struct iwl_priv *priv)
 {
        kfree(priv->ieee_channels);
        kfree(priv->ieee_rates);
        clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
 }
+EXPORT_SYMBOL(iwlcore_free_geos);
 
 static bool is_single_rx_stream(struct iwl_priv *priv)
 {
@@ -587,6 +588,167 @@ u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
 }
 EXPORT_SYMBOL(iwl_is_fat_tx_allowed);
 
+void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt)
+{
+       struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
+
+       if (hw_decrypt)
+               rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
+       else
+               rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK;
+
+}
+EXPORT_SYMBOL(iwl_set_rxon_hwcrypto);
+
+/**
+ * iwl_check_rxon_cmd - validate RXON structure is valid
+ *
+ * NOTE:  This is really only useful during development and can eventually
+ * be #ifdef'd out once the driver is stable and folks aren't actively
+ * making changes
+ */
+int iwl_check_rxon_cmd(struct iwl_priv *priv)
+{
+       int error = 0;
+       int counter = 1;
+       struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
+
+       if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
+               error |= le32_to_cpu(rxon->flags &
+                               (RXON_FLG_TGJ_NARROW_BAND_MSK |
+                                RXON_FLG_RADAR_DETECT_MSK));
+               if (error)
+                       IWL_WARN(priv, "check 24G fields %d | %d\n",
+                                   counter++, error);
+       } else {
+               error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
+                               0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
+               if (error)
+                       IWL_WARN(priv, "check 52 fields %d | %d\n",
+                                   counter++, error);
+               error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
+               if (error)
+                       IWL_WARN(priv, "check 52 CCK %d | %d\n",
+                                   counter++, error);
+       }
+       error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
+       if (error)
+               IWL_WARN(priv, "check mac addr %d | %d\n", counter++, error);
+
+       /* make sure basic rates 6Mbps and 1Mbps are supported */
+       error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
+                 ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
+       if (error)
+               IWL_WARN(priv, "check basic rate %d | %d\n", counter++, error);
+
+       error |= (le16_to_cpu(rxon->assoc_id) > 2007);
+       if (error)
+               IWL_WARN(priv, "check assoc id %d | %d\n", counter++, error);
+
+       error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
+                       == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
+       if (error)
+               IWL_WARN(priv, "check CCK and short slot %d | %d\n",
+                           counter++, error);
+
+       error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
+                       == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
+       if (error)
+               IWL_WARN(priv, "check CCK & auto detect %d | %d\n",
+                           counter++, error);
+
+       error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
+                       RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
+       if (error)
+               IWL_WARN(priv, "check TGG and auto detect %d | %d\n",
+                           counter++, error);
+
+       if (error)
+               IWL_WARN(priv, "Tuning to channel %d\n",
+                           le16_to_cpu(rxon->channel));
+
+       if (error) {
+               IWL_ERR(priv, "Not a valid iwl_rxon_assoc_cmd field values\n");
+               return -1;
+       }
+       return 0;
+}
+EXPORT_SYMBOL(iwl_check_rxon_cmd);
+
+/**
+ * iwl_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
+ * @priv: staging_rxon is compared to active_rxon
+ *
+ * If the RXON structure is changing enough to require a new tune,
+ * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
+ * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
+ */
+int iwl_full_rxon_required(struct iwl_priv *priv)
+{
+
+       /* These items are only settable from the full RXON command */
+       if (!(iwl_is_associated(priv)) ||
+           compare_ether_addr(priv->staging_rxon.bssid_addr,
+                              priv->active_rxon.bssid_addr) ||
+           compare_ether_addr(priv->staging_rxon.node_addr,
+                              priv->active_rxon.node_addr) ||
+           compare_ether_addr(priv->staging_rxon.wlap_bssid_addr,
+                              priv->active_rxon.wlap_bssid_addr) ||
+           (priv->staging_rxon.dev_type != priv->active_rxon.dev_type) ||
+           (priv->staging_rxon.channel != priv->active_rxon.channel) ||
+           (priv->staging_rxon.air_propagation !=
+            priv->active_rxon.air_propagation) ||
+           (priv->staging_rxon.ofdm_ht_single_stream_basic_rates !=
+            priv->active_rxon.ofdm_ht_single_stream_basic_rates) ||
+           (priv->staging_rxon.ofdm_ht_dual_stream_basic_rates !=
+            priv->active_rxon.ofdm_ht_dual_stream_basic_rates) ||
+           (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id))
+               return 1;
+
+       /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can
+        * be updated with the RXON_ASSOC command -- however only some
+        * flag transitions are allowed using RXON_ASSOC */
+
+       /* Check if we are not switching bands */
+       if ((priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) !=
+           (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK))
+               return 1;
+
+       /* Check if we are switching association toggle */
+       if ((priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) !=
+               (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK))
+               return 1;
+
+       return 0;
+}
+EXPORT_SYMBOL(iwl_full_rxon_required);
+
+u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv)
+{
+       int i;
+       int rate_mask;
+
+       /* Set rate mask*/
+       if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
+               rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK;
+       else
+               rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK;
+
+       /* Find lowest valid rate */
+       for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
+                                       i = iwl_rates[i].next_ieee) {
+               if (rate_mask & (1 << i))
+                       return iwl_rates[i].plcp;
+       }
+
+       /* No valid rate was found. Assign the lowest one */
+       if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
+               return IWL_RATE_1M_PLCP;
+       else
+               return IWL_RATE_6M_PLCP;
+}
+EXPORT_SYMBOL(iwl_rate_get_lowest_plcp);
+
 void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
 {
        struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
@@ -628,7 +790,7 @@ void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info)
 
        iwl_set_rxon_chain(priv);
 
-       IWL_DEBUG_ASSOC("supported HT rate 0x%X 0x%X 0x%X "
+       IWL_DEBUG_ASSOC(priv, "supported HT rate 0x%X 0x%X 0x%X "
                        "rxon flags 0x%X operation mode :0x%X "
                        "extension channel offset 0x%x\n",
                        ht_info->mcs.rx_mask[0],
@@ -679,7 +841,7 @@ static int iwl_get_idle_rx_chain_count(struct iwl_priv *priv, int active_cnt)
                break;
        case WLAN_HT_CAP_SM_PS_INVALID:
        default:
-               IWL_ERROR("invalid mimo ps mode %d\n",
+               IWL_ERR(priv, "invalid mimo ps mode %d\n",
                           priv->current_ht_config.sm_ps);
                WARN_ON(1);
                idle_cnt = -1;
@@ -699,6 +861,18 @@ static u8 iwl_count_chain_bitmap(u32 chain_bitmap)
        return res;
 }
 
+/**
+ * iwl_is_monitor_mode - Determine if interface in monitor mode
+ *
+ * priv->iw_mode is set in add_interface, but add_interface is
+ * never called for monitor mode. The only way mac80211 informs us about
+ * monitor mode is through configuring filters (call to configure_filter).
+ */
+static bool iwl_is_monitor_mode(struct iwl_priv *priv)
+{
+       return !!(priv->staging_rxon.filter_flags & RXON_FILTER_PROMISC_MSK);
+}
+
 /**
  * iwl_set_rxon_chain - Set up Rx chain usage in "staging" RXON image
  *
@@ -742,6 +916,19 @@ void iwl_set_rxon_chain(struct iwl_priv *priv)
        rx_chain |= active_rx_cnt << RXON_RX_CHAIN_MIMO_CNT_POS;
        rx_chain |= idle_rx_cnt  << RXON_RX_CHAIN_CNT_POS;
 
+       /* copied from 'iwl_bg_request_scan()' */
+       /* Force use of chains B and C (0x6) for Rx for 4965
+        * Avoid A (0x1) because of its off-channel reception on A-band.
+        * MIMO is not used here, but value is required */
+       if (iwl_is_monitor_mode(priv) &&
+           !(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) &&
+           ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)) {
+               rx_chain = 0x07 << RXON_RX_CHAIN_VALID_POS;
+               rx_chain |= 0x06 << RXON_RX_CHAIN_FORCE_SEL_POS;
+               rx_chain |= 0x07 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS;
+               rx_chain |= 0x01 << RXON_RX_CHAIN_DRIVER_FORCE_POS;
+       }
+
        priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain);
 
        if (!is_single && (active_rx_cnt >= IWL_NUM_RX_CHAINS_SINGLE) && is_cam)
@@ -749,7 +936,7 @@ void iwl_set_rxon_chain(struct iwl_priv *priv)
        else
                priv->staging_rxon.rx_chain &= ~RXON_RX_CHAIN_MIMO_FORCE_MSK;
 
-       IWL_DEBUG_ASSOC("rx_chain=0x%X active=%d idle=%d\n",
+       IWL_DEBUG_ASSOC(priv, "rx_chain=0x%X active=%d idle=%d\n",
                        priv->staging_rxon.rx_chain,
                        active_rx_cnt, idle_rx_cnt);
 
@@ -774,7 +961,7 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch)
        u16 channel = ieee80211_frequency_to_channel(ch->center_freq);
 
        if (!iwl_get_channel_info(priv, band, channel)) {
-               IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
+               IWL_DEBUG_INFO(priv, "Could not set channel to %d [%d]\n",
                               channel, band);
                return -EINVAL;
        }
@@ -791,12 +978,283 @@ int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch)
 
        priv->band = band;
 
-       IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band);
+       IWL_DEBUG_INFO(priv, "Staging channel set to %d [%d]\n", channel, band);
 
        return 0;
 }
 EXPORT_SYMBOL(iwl_set_rxon_channel);
 
+void iwl_set_flags_for_band(struct iwl_priv *priv,
+                           enum ieee80211_band band)
+{
+       if (band == IEEE80211_BAND_5GHZ) {
+               priv->staging_rxon.flags &=
+                   ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK
+                     | RXON_FLG_CCK_MSK);
+               priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
+       } else {
+               /* Copied from iwl_post_associate() */
+               if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
+                       priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
+               else
+                       priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
+
+               if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
+                       priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
+
+               priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK;
+               priv->staging_rxon.flags |= RXON_FLG_AUTO_DETECT_MSK;
+               priv->staging_rxon.flags &= ~RXON_FLG_CCK_MSK;
+       }
+}
+EXPORT_SYMBOL(iwl_set_flags_for_band);
+
+/*
+ * initialize rxon structure with default values from eeprom
+ */
+void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode)
+{
+       const struct iwl_channel_info *ch_info;
+
+       memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
+
+       switch (mode) {
+       case NL80211_IFTYPE_AP:
+               priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP;
+               break;
+
+       case NL80211_IFTYPE_STATION:
+               priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS;
+               priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
+               break;
+
+       case NL80211_IFTYPE_ADHOC:
+               priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS;
+               priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
+               priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK |
+                                                 RXON_FILTER_ACCEPT_GRP_MSK;
+               break;
+
+       case NL80211_IFTYPE_MONITOR:
+               priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER;
+               priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK |
+                   RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
+               break;
+       default:
+               IWL_ERR(priv, "Unsupported interface type %d\n", mode);
+               break;
+       }
+
+#if 0
+       /* TODO:  Figure out when short_preamble would be set and cache from
+        * that */
+       if (!hw_to_local(priv->hw)->short_preamble)
+               priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
+       else
+               priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
+#endif
+
+       ch_info = iwl_get_channel_info(priv, priv->band,
+                                      le16_to_cpu(priv->active_rxon.channel));
+
+       if (!ch_info)
+               ch_info = &priv->channel_info[0];
+
+       /*
+        * in some case A channels are all non IBSS
+        * in this case force B/G channel
+        */
+       if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) &&
+           !(is_channel_ibss(ch_info)))
+               ch_info = &priv->channel_info[0];
+
+       priv->staging_rxon.channel = cpu_to_le16(ch_info->channel);
+       priv->band = ch_info->band;
+
+       iwl_set_flags_for_band(priv, priv->band);
+
+       priv->staging_rxon.ofdm_basic_rates =
+           (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
+       priv->staging_rxon.cck_basic_rates =
+           (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
+
+       priv->staging_rxon.flags &= ~(RXON_FLG_CHANNEL_MODE_MIXED_MSK |
+                                       RXON_FLG_CHANNEL_MODE_PURE_40_MSK);
+       memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
+       memcpy(priv->staging_rxon.wlap_bssid_addr, priv->mac_addr, ETH_ALEN);
+       priv->staging_rxon.ofdm_ht_single_stream_basic_rates = 0xff;
+       priv->staging_rxon.ofdm_ht_dual_stream_basic_rates = 0xff;
+}
+EXPORT_SYMBOL(iwl_connection_init_rx_config);
+
+void iwl_set_rate(struct iwl_priv *priv)
+{
+       const struct ieee80211_supported_band *hw = NULL;
+       struct ieee80211_rate *rate;
+       int i;
+
+       hw = iwl_get_hw_mode(priv, priv->band);
+       if (!hw) {
+               IWL_ERR(priv, "Failed to set rate: unable to get hw mode\n");
+               return;
+       }
+
+       priv->active_rate = 0;
+       priv->active_rate_basic = 0;
+
+       for (i = 0; i < hw->n_bitrates; i++) {
+               rate = &(hw->bitrates[i]);
+               if (rate->hw_value < IWL_RATE_COUNT)
+                       priv->active_rate |= (1 << rate->hw_value);
+       }
+
+       IWL_DEBUG_RATE(priv, "Set active_rate = %0x, active_rate_basic = %0x\n",
+                      priv->active_rate, priv->active_rate_basic);
+
+       /*
+        * If a basic rate is configured, then use it (adding IWL_RATE_1M_MASK)
+        * otherwise set it to the default of all CCK rates and 6, 12, 24 for
+        * OFDM
+        */
+       if (priv->active_rate_basic & IWL_CCK_BASIC_RATES_MASK)
+               priv->staging_rxon.cck_basic_rates =
+                   ((priv->active_rate_basic &
+                     IWL_CCK_RATES_MASK) >> IWL_FIRST_CCK_RATE) & 0xF;
+       else
+               priv->staging_rxon.cck_basic_rates =
+                   (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
+
+       if (priv->active_rate_basic & IWL_OFDM_BASIC_RATES_MASK)
+               priv->staging_rxon.ofdm_basic_rates =
+                   ((priv->active_rate_basic &
+                     (IWL_OFDM_BASIC_RATES_MASK | IWL_RATE_6M_MASK)) >>
+                     IWL_FIRST_OFDM_RATE) & 0xFF;
+       else
+               priv->staging_rxon.ofdm_basic_rates =
+                  (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
+}
+EXPORT_SYMBOL(iwl_set_rate);
+
+void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb)
+{
+       struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
+       struct iwl_rxon_cmd *rxon = (void *)&priv->active_rxon;
+       struct iwl_csa_notification *csa = &(pkt->u.csa_notif);
+       IWL_DEBUG_11H(priv, "CSA notif: channel %d, status %d\n",
+                     le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
+       rxon->channel = csa->channel;
+       priv->staging_rxon.channel = csa->channel;
+}
+EXPORT_SYMBOL(iwl_rx_csa);
+
+#ifdef CONFIG_IWLWIFI_DEBUG
+static void iwl_print_rx_config_cmd(struct iwl_priv *priv)
+{
+       struct iwl_rxon_cmd *rxon = &priv->staging_rxon;
+
+       IWL_DEBUG_RADIO(priv, "RX CONFIG:\n");
+       iwl_print_hex_dump(priv, IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
+       IWL_DEBUG_RADIO(priv, "u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
+       IWL_DEBUG_RADIO(priv, "u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
+       IWL_DEBUG_RADIO(priv, "u32 filter_flags: 0x%08x\n",
+                       le32_to_cpu(rxon->filter_flags));
+       IWL_DEBUG_RADIO(priv, "u8 dev_type: 0x%x\n", rxon->dev_type);
+       IWL_DEBUG_RADIO(priv, "u8 ofdm_basic_rates: 0x%02x\n",
+                       rxon->ofdm_basic_rates);
+       IWL_DEBUG_RADIO(priv, "u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates);
+       IWL_DEBUG_RADIO(priv, "u8[6] node_addr: %pM\n", rxon->node_addr);
+       IWL_DEBUG_RADIO(priv, "u8[6] bssid_addr: %pM\n", rxon->bssid_addr);
+       IWL_DEBUG_RADIO(priv, "u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id));
+}
+#endif
+
+/**
+ * iwl_irq_handle_error - called for HW or SW error interrupt from card
+ */
+void iwl_irq_handle_error(struct iwl_priv *priv)
+{
+       /* Set the FW error flag -- cleared on iwl_down */
+       set_bit(STATUS_FW_ERROR, &priv->status);
+
+       /* Cancel currently queued command. */
+       clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
+
+#ifdef CONFIG_IWLWIFI_DEBUG
+       if (priv->debug_level & IWL_DL_FW_ERRORS) {
+               iwl_dump_nic_error_log(priv);
+               iwl_dump_nic_event_log(priv);
+               iwl_print_rx_config_cmd(priv);
+       }
+#endif
+
+       wake_up_interruptible(&priv->wait_command_queue);
+
+       /* Keep the restart process from trying to send host
+        * commands by clearing the INIT status bit */
+       clear_bit(STATUS_READY, &priv->status);
+
+       if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
+               IWL_DEBUG(priv, IWL_DL_FW_ERRORS,
+                         "Restarting adapter due to uCode error.\n");
+
+               if (iwl_is_associated(priv)) {
+                       memcpy(&priv->recovery_rxon, &priv->active_rxon,
+                              sizeof(priv->recovery_rxon));
+                       priv->error_recovering = 1;
+               }
+               if (priv->cfg->mod_params->restart_fw)
+                       queue_work(priv->workqueue, &priv->restart);
+       }
+}
+EXPORT_SYMBOL(iwl_irq_handle_error);
+
+void iwl_configure_filter(struct ieee80211_hw *hw,
+                         unsigned int changed_flags,
+                         unsigned int *total_flags,
+                         int mc_count, struct dev_addr_list *mc_list)
+{
+       struct iwl_priv *priv = hw->priv;
+       __le32 *filter_flags = &priv->staging_rxon.filter_flags;
+
+       IWL_DEBUG_MAC80211(priv, "Enter: changed: 0x%x, total: 0x%x\n",
+                       changed_flags, *total_flags);
+
+       if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) {
+               if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS))
+                       *filter_flags |= RXON_FILTER_PROMISC_MSK;
+               else
+                       *filter_flags &= ~RXON_FILTER_PROMISC_MSK;
+       }
+       if (changed_flags & FIF_ALLMULTI) {
+               if (*total_flags & FIF_ALLMULTI)
+                       *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK;
+               else
+                       *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK;
+       }
+       if (changed_flags & FIF_CONTROL) {
+               if (*total_flags & FIF_CONTROL)
+                       *filter_flags |= RXON_FILTER_CTL2HOST_MSK;
+               else
+                       *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK;
+       }
+       if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
+               if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
+                       *filter_flags |= RXON_FILTER_BCON_AWARE_MSK;
+               else
+                       *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK;
+       }
+
+       /* We avoid iwl_commit_rxon here to commit the new filter flags
+        * since mac80211 will call ieee80211_hw_config immediately.
+        * (mc_list is not supported at this time). Otherwise, we need to
+        * queue a background iwl_commit_rxon work.
+        */
+
+       *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
+                       FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
+}
+EXPORT_SYMBOL(iwl_configure_filter);
+
 int iwl_setup_mac(struct iwl_priv *priv)
 {
        int ret;
@@ -806,12 +1264,14 @@ int iwl_setup_mac(struct iwl_priv *priv)
        /* Tell mac80211 our characteristics */
        hw->flags = IEEE80211_HW_SIGNAL_DBM |
                    IEEE80211_HW_NOISE_DBM |
-                   IEEE80211_HW_AMPDU_AGGREGATION;
+                   IEEE80211_HW_AMPDU_AGGREGATION |
+                   IEEE80211_HW_SUPPORTS_PS;
        hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_ADHOC);
 
-       hw->wiphy->fw_handles_regulatory = true;
+       hw->wiphy->custom_regulatory = true;
+       hw->wiphy->max_scan_ssids = 1;
 
        /* Default value; 4 EDCA QOS priorities */
        hw->queues = 4;
@@ -831,7 +1291,7 @@ int iwl_setup_mac(struct iwl_priv *priv)
 
        ret = ieee80211_register_hw(priv->hw);
        if (ret) {
-               IWL_ERROR("Failed to register hw (error %d)\n", ret);
+               IWL_ERR(priv, "Failed to register hw (error %d)\n", ret);
                return ret;
        }
        priv->mac80211_registered = 1;
@@ -863,7 +1323,6 @@ int iwl_init_drv(struct iwl_priv *priv)
 {
        int ret;
 
-       priv->retry_rate = 1;
        priv->ibss_beacon = NULL;
 
        spin_lock_init(&priv->lock);
@@ -897,21 +1356,22 @@ int iwl_init_drv(struct iwl_priv *priv)
        priv->qos_data.qos_cap.val = 0;
 
        priv->rates_mask = IWL_RATES_MASK;
-       /* If power management is turned on, default to AC mode */
-       priv->power_mode = IWL_POWER_AC;
+       /* If power management is turned on, default to CAM mode */
+       priv->power_mode = IWL_POWER_MODE_CAM;
        priv->tx_power_user_lmt = IWL_TX_POWER_TARGET_POWER_MAX;
 
        ret = iwl_init_channel_map(priv);
        if (ret) {
-               IWL_ERROR("initializing regulatory failed: %d\n", ret);
+               IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
                goto err;
        }
 
        ret = iwlcore_init_geos(priv);
        if (ret) {
-               IWL_ERROR("initializing geos failed: %d\n", ret);
+               IWL_ERR(priv, "initializing geos failed: %d\n", ret);
                goto err_free_channel_map;
        }
+       iwlcore_init_hw_rates(priv, priv->ieee_rates);
 
        return 0;
 
@@ -926,13 +1386,13 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force)
 {
        int ret = 0;
        if (tx_power < IWL_TX_POWER_TARGET_POWER_MIN) {
-               IWL_WARNING("Requested user TXPOWER %d below limit.\n",
+               IWL_WARN(priv, "Requested user TXPOWER %d below limit.\n",
                            priv->tx_power_user_lmt);
                return -EINVAL;
        }
 
        if (tx_power > IWL_TX_POWER_TARGET_POWER_MAX) {
-               IWL_WARNING("Requested user TXPOWER %d above limit.\n",
+               IWL_WARN(priv, "Requested user TXPOWER %d above limit.\n",
                            priv->tx_power_user_lmt);
                return -EINVAL;
        }
@@ -970,18 +1430,33 @@ void iwl_disable_interrupts(struct iwl_priv *priv)
         * from uCode or flow handler (Rx/Tx DMA) */
        iwl_write32(priv, CSR_INT, 0xffffffff);
        iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
-       IWL_DEBUG_ISR("Disabled interrupts\n");
+       IWL_DEBUG_ISR(priv, "Disabled interrupts\n");
 }
 EXPORT_SYMBOL(iwl_disable_interrupts);
 
 void iwl_enable_interrupts(struct iwl_priv *priv)
 {
-       IWL_DEBUG_ISR("Enabling interrupts\n");
+       IWL_DEBUG_ISR(priv, "Enabling interrupts\n");
        set_bit(STATUS_INT_ENABLED, &priv->status);
        iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK);
 }
 EXPORT_SYMBOL(iwl_enable_interrupts);
 
+int iwl_send_bt_config(struct iwl_priv *priv)
+{
+       struct iwl_bt_cmd bt_cmd = {
+               .flags = 3,
+               .lead_time = 0xAA,
+               .max_kill = 1,
+               .kill_ack_mask = 0,
+               .kill_cts_mask = 0,
+       };
+
+       return iwl_send_cmd_pdu(priv, REPLY_BT_CONFIG,
+                               sizeof(struct iwl_bt_cmd), &bt_cmd);
+}
+EXPORT_SYMBOL(iwl_send_bt_config);
+
 int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags)
 {
        u32 stat_flags = 0;
@@ -1007,7 +1482,7 @@ static int iwlcore_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32
        u32 errcnt = 0;
        u32 i;
 
-       IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
+       IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
 
        ret = iwl_grab_nic_access(priv);
        if (ret)
@@ -1018,7 +1493,7 @@ static int iwlcore_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32
                /* NOTE: Use the debugless read so we don't flood kernel log
                 * if IWL_DL_IO is set */
                iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR,
-                       i + RTC_INST_LOWER_BOUND);
+                       i + IWL49_RTC_INST_LOWER_BOUND);
                val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
                if (val != le32_to_cpu(*image)) {
                        ret = -EIO;
@@ -1045,13 +1520,14 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 *image,
        int ret = 0;
        u32 errcnt;
 
-       IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
+       IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
 
        ret = iwl_grab_nic_access(priv);
        if (ret)
                return ret;
 
-       iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND);
+       iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR,
+                          IWL49_RTC_INST_LOWER_BOUND);
 
        errcnt = 0;
        for (; len > 0; len -= sizeof(u32), image++) {
@@ -1060,7 +1536,7 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 *image,
                 * if IWL_DL_IO is set */
                val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
                if (val != le32_to_cpu(*image)) {
-                       IWL_ERROR("uCode INST section is invalid at "
+                       IWL_ERR(priv, "uCode INST section is invalid at "
                                  "offset 0x%x, is 0x%x, s/b 0x%x\n",
                                  save_len - len, val, le32_to_cpu(*image));
                        ret = -EIO;
@@ -1073,8 +1549,8 @@ static int iwl_verify_inst_full(struct iwl_priv *priv, __le32 *image,
        iwl_release_nic_access(priv);
 
        if (!errcnt)
-               IWL_DEBUG_INFO
-                   ("ucode image in INSTRUCTION memory is good\n");
+               IWL_DEBUG_INFO(priv,
+                   "ucode image in INSTRUCTION memory is good\n");
 
        return ret;
 }
@@ -1094,7 +1570,7 @@ int iwl_verify_ucode(struct iwl_priv *priv)
        len = priv->ucode_boot.len;
        ret = iwlcore_verify_inst_sparse(priv, image, len);
        if (!ret) {
-               IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n");
+               IWL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n");
                return 0;
        }
 
@@ -1103,7 +1579,7 @@ int iwl_verify_ucode(struct iwl_priv *priv)
        len = priv->ucode_init.len;
        ret = iwlcore_verify_inst_sparse(priv, image, len);
        if (!ret) {
-               IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n");
+               IWL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n");
                return 0;
        }
 
@@ -1112,11 +1588,11 @@ int iwl_verify_ucode(struct iwl_priv *priv)
        len = priv->ucode_code.len;
        ret = iwlcore_verify_inst_sparse(priv, image, len);
        if (!ret) {
-               IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n");
+               IWL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n");
                return 0;
        }
 
-       IWL_ERROR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
+       IWL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
 
        /* Since nothing seems to match, show first several data entries in
         * instruction SRAM, so maybe visual inspection will give a clue.
@@ -1188,21 +1664,22 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
                base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
 
        if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Not valid error log pointer 0x%08X\n", base);
+               IWL_ERR(priv, "Not valid error log pointer 0x%08X\n", base);
                return;
        }
 
        ret = iwl_grab_nic_access(priv);
        if (ret) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
+               IWL_WARN(priv, "Can not read from adapter at this time.\n");
                return;
        }
 
        count = iwl_read_targ_mem(priv, base);
 
        if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
-               IWL_ERROR("Start IWL Error Log Dump:\n");
-               IWL_ERROR("Status: 0x%08lX, count: %d\n", priv->status, count);
+               IWL_ERR(priv, "Start IWL Error Log Dump:\n");
+               IWL_ERR(priv, "Status: 0x%08lX, count: %d\n",
+                       priv->status, count);
        }
 
        desc = iwl_read_targ_mem(priv, base + 1 * sizeof(u32));
@@ -1215,12 +1692,12 @@ void iwl_dump_nic_error_log(struct iwl_priv *priv)
        line = iwl_read_targ_mem(priv, base + 9 * sizeof(u32));
        time = iwl_read_targ_mem(priv, base + 11 * sizeof(u32));
 
-       IWL_ERROR("Desc                               Time       "
+       IWL_ERR(priv, "Desc                               Time       "
                "data1      data2      line\n");
-       IWL_ERROR("%-28s (#%02d) %010u 0x%08X 0x%08X %u\n",
+       IWL_ERR(priv, "%-28s (#%02d) %010u 0x%08X 0x%08X %u\n",
                desc_lookup(desc), desc, time, data1, data2, line);
-       IWL_ERROR("blink1  blink2  ilink1  ilink2\n");
-       IWL_ERROR("0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2,
+       IWL_ERR(priv, "blink1  blink2  ilink1  ilink2\n");
+       IWL_ERR(priv, "0x%05X 0x%05X 0x%05X 0x%05X\n", blink1, blink2,
                ilink1, ilink2);
 
        iwl_release_nic_access(priv);
@@ -1266,11 +1743,11 @@ static void iwl_print_event_log(struct iwl_priv *priv, u32 start_idx,
                ptr += sizeof(u32);
                if (mode == 0) {
                        /* data, ev */
-                       IWL_ERROR("EVT_LOG:0x%08x:%04u\n", time, ev);
+                       IWL_ERR(priv, "EVT_LOG:0x%08x:%04u\n", time, ev);
                } else {
                        data = iwl_read_targ_mem(priv, ptr);
                        ptr += sizeof(u32);
-                       IWL_ERROR("EVT_LOGT:%010u:0x%08x:%04u\n",
+                       IWL_ERR(priv, "EVT_LOGT:%010u:0x%08x:%04u\n",
                                        time, data, ev);
                }
        }
@@ -1292,13 +1769,13 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv)
                base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
 
        if (!priv->cfg->ops->lib->is_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
+               IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
                return;
        }
 
        ret = iwl_grab_nic_access(priv);
        if (ret) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
+               IWL_WARN(priv, "Can not read from adapter at this time.\n");
                return;
        }
 
@@ -1312,12 +1789,12 @@ void iwl_dump_nic_event_log(struct iwl_priv *priv)
 
        /* bail out if nothing in log */
        if (size == 0) {
-               IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
+               IWL_ERR(priv, "Start IWL Event Log Dump: nothing in log\n");
                iwl_release_nic_access(priv);
                return;
        }
 
-       IWL_ERROR("Start IWL Event Log Dump: display count %d, wraps %d\n",
+       IWL_ERR(priv, "Start IWL Event Log Dump: display count %d, wraps %d\n",
                        size, num_wraps);
 
        /* if uCode has wrapped back to top of log, start at the oldest entry,
@@ -1349,9 +1826,9 @@ void iwl_rf_kill_ct_config(struct iwl_priv *priv)
        ret = iwl_send_cmd_pdu(priv, REPLY_CT_KILL_CONFIG_CMD,
                               sizeof(cmd), &cmd);
        if (ret)
-               IWL_ERROR("REPLY_CT_KILL_CONFIG_CMD failed\n");
+               IWL_ERR(priv, "REPLY_CT_KILL_CONFIG_CMD failed\n");
        else
-               IWL_DEBUG_INFO("REPLY_CT_KILL_CONFIG_CMD succeeded, "
+               IWL_DEBUG_INFO(priv, "REPLY_CT_KILL_CONFIG_CMD succeeded, "
                        "critical temperature is %d\n",
                        cmd.critical_temperature_R);
 }
@@ -1368,7 +1845,7 @@ EXPORT_SYMBOL(iwl_rf_kill_ct_config);
  * When in the 'halt' state, the card is shut down and must be fully
  * restarted to come back on.
  */
-static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
+int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
 {
        struct iwl_host_cmd cmd = {
                .id = REPLY_CARD_STATE_CMD,
@@ -1379,6 +1856,7 @@ static int iwl_send_card_state(struct iwl_priv *priv, u32 flags, u8 meta_flag)
 
        return iwl_send_cmd(priv, &cmd);
 }
+EXPORT_SYMBOL(iwl_send_card_state);
 
 void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv)
 {
@@ -1387,7 +1865,7 @@ void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv)
        if (test_bit(STATUS_RF_KILL_SW, &priv->status))
                return;
 
-       IWL_DEBUG_RF_KILL("Manual SW RF KILL set to: RADIO OFF\n");
+       IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO OFF\n");
 
        iwl_scan_cancel(priv);
        /* FIXME: This is a workaround for AP */
@@ -1416,7 +1894,7 @@ int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv)
        if (!test_bit(STATUS_RF_KILL_SW, &priv->status))
                return 0;
 
-       IWL_DEBUG_RF_KILL("Manual SW RF KILL set to: RADIO ON\n");
+       IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO ON\n");
 
        spin_lock_irqsave(&priv->lock, flags);
        iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
@@ -1441,7 +1919,7 @@ int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv)
        spin_unlock_irqrestore(&priv->lock, flags);
 
        if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
-               IWL_DEBUG_RF_KILL("Can not turn radio back on - "
+               IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - "
                                  "disabled by HW switch\n");
                return 0;
        }
@@ -1463,3 +1941,39 @@ int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv)
        return 1;
 }
 EXPORT_SYMBOL(iwl_radio_kill_sw_enable_radio);
+
+void iwl_bg_rf_kill(struct work_struct *work)
+{
+       struct iwl_priv *priv = container_of(work, struct iwl_priv, rf_kill);
+
+       wake_up_interruptible(&priv->wait_command_queue);
+
+       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+               return;
+
+       mutex_lock(&priv->mutex);
+
+       if (!iwl_is_rfkill(priv)) {
+               IWL_DEBUG_RF_KILL(priv,
+                         "HW and/or SW RF Kill no longer active, restarting "
+                         "device\n");
+               if (!test_bit(STATUS_EXIT_PENDING, &priv->status) &&
+                   test_bit(STATUS_ALIVE, &priv->status))
+                       queue_work(priv->workqueue, &priv->restart);
+       } else {
+               /* make sure mac80211 stop sending Tx frame */
+               if (priv->mac80211_registered)
+                       ieee80211_stop_queues(priv->hw);
+
+               if (!test_bit(STATUS_RF_KILL_HW, &priv->status))
+                       IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - "
+                                         "disabled by SW switch\n");
+               else
+                       IWL_WARN(priv, "Radio Frequency Kill Switch is On:\n"
+                                   "Kill switch must be turned off for "
+                                   "wireless networking to work.\n");
+       }
+       mutex_unlock(&priv->mutex);
+       iwl_rfkill_set_hw_state(priv);
+}
+EXPORT_SYMBOL(iwl_bg_rf_kill);
index 7c3a20a986bbd3567a6ed7c9102206e0d81e9aa1..9d464ec99dd51417e920b2f7c4acd4e57bd9f2a7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -71,7 +71,7 @@ struct iwl_cmd;
 
 
 #define IWLWIFI_VERSION "1.3.27k"
-#define DRV_COPYRIGHT  "Copyright(c) 2003-2008 Intel Corporation"
+#define DRV_COPYRIGHT  "Copyright(c) 2003-2009 Intel Corporation"
 #define DRV_AUTHOR     "<ilw@linux.intel.com>"
 
 #define IWL_PCI_DEVICE(dev, subdev, cfg) \
@@ -110,6 +110,14 @@ struct iwl_lib_ops {
        void (*txq_inval_byte_cnt_tbl)(struct iwl_priv *priv,
                                       struct iwl_tx_queue *txq);
        void (*txq_set_sched)(struct iwl_priv *priv, u32 mask);
+       int (*txq_attach_buf_to_tfd)(struct iwl_priv *priv,
+                                    struct iwl_tx_queue *txq,
+                                    dma_addr_t addr,
+                                    u16 len, u8 reset, u8 pad);
+       void (*txq_free_tfd)(struct iwl_priv *priv,
+                            struct iwl_tx_queue *txq);
+       int (*txq_init)(struct iwl_priv *priv,
+                       struct iwl_tx_queue *txq);
        /* aggregations */
        int (*txq_agg_enable)(struct iwl_priv *priv, int txq_id, int tx_fifo,
                              int sta_id, int tid, u16 ssn_idx);
@@ -203,6 +211,9 @@ struct iwl_cfg {
        u16  eeprom_calib_ver;
        const struct iwl_ops *ops;
        const struct iwl_mod_params *mod_params;
+       u8   valid_tx_ant;
+       u8   valid_rx_ant;
+       bool need_pll_cfg;
 };
 
 /***************************
@@ -213,11 +224,25 @@ struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
                struct ieee80211_ops *hw_ops);
 void iwl_hw_detect(struct iwl_priv *priv);
 void iwl_reset_qos(struct iwl_priv *priv);
+void iwl_set_rxon_hwcrypto(struct iwl_priv *priv, int hw_decrypt);
+int iwl_check_rxon_cmd(struct iwl_priv *priv);
+int iwl_full_rxon_required(struct iwl_priv *priv);
 void iwl_set_rxon_chain(struct iwl_priv *priv);
 int iwl_set_rxon_channel(struct iwl_priv *priv, struct ieee80211_channel *ch);
 void iwl_set_rxon_ht(struct iwl_priv *priv, struct iwl_ht_info *ht_info);
 u8 iwl_is_fat_tx_allowed(struct iwl_priv *priv,
                         struct ieee80211_sta_ht_cap *sta_ht_inf);
+void iwl_set_flags_for_band(struct iwl_priv *priv, enum ieee80211_band band);
+void iwl_connection_init_rx_config(struct iwl_priv *priv, int mode);
+int iwl_set_decrypted_flag(struct iwl_priv *priv,
+                          struct ieee80211_hdr *hdr,
+                          u32 decrypt_res,
+                          struct ieee80211_rx_status *stats);
+void iwl_irq_handle_error(struct iwl_priv *priv);
+void iwl_configure_filter(struct ieee80211_hw *hw,
+                         unsigned int changed_flags,
+                         unsigned int *total_flags,
+                         int mc_count, struct dev_addr_list *mc_list);
 int iwl_hw_nic_init(struct iwl_priv *priv);
 int iwl_setup_mac(struct iwl_priv *priv);
 int iwl_set_hw_params(struct iwl_priv *priv);
@@ -245,6 +270,7 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
                               struct iwl_rx_mem_buffer *rxb);
 void iwl_rx_statistics(struct iwl_priv *priv,
                              struct iwl_rx_mem_buffer *rxb);
+void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
 
 /* TX helpers */
 
@@ -252,9 +278,18 @@ void iwl_rx_statistics(struct iwl_priv *priv,
 * TX
 ******************************************************/
 int iwl_txq_ctx_reset(struct iwl_priv *priv);
+void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq);
+int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
+                                struct iwl_tx_queue *txq,
+                                dma_addr_t addr, u16 len, u8 reset, u8 pad);
 int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb);
 void iwl_hw_txq_ctx_free(struct iwl_priv *priv);
+int iwl_hw_tx_queue_init(struct iwl_priv *priv,
+                        struct iwl_tx_queue *txq);
 int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq);
+int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
+                     int slots_num, u32 txq_id);
+void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id);
 int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn);
 int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid);
 int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id);
@@ -267,7 +302,7 @@ int iwl_set_tx_power(struct iwl_priv *priv, s8 tx_power, bool force);
  * RF -Kill - here and not in iwl-rfkill.h to be available when
  * RF-kill subsystem is not compiled.
  ****************************************************/
-void iwl_rf_kill(struct iwl_priv *priv);
+void iwl_bg_rf_kill(struct work_struct *work);
 void iwl_radio_kill_sw_disable_radio(struct iwl_priv *priv);
 int iwl_radio_kill_sw_enable_radio(struct iwl_priv *priv);
 
@@ -279,6 +314,10 @@ void iwl_hwrate_to_tx_control(struct iwl_priv *priv, u32 rate_n_flags,
                              struct ieee80211_tx_info *info);
 int iwl_hwrate_to_plcp_idx(u32 rate_n_flags);
 
+u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv);
+
+void iwl_set_rate(struct iwl_priv *priv);
+
 u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx);
 
 static inline u32 iwl_ant_idx_to_flags(u8 ant_idx)
@@ -306,8 +345,29 @@ void iwl_init_scan_params(struct iwl_priv *priv);
 int iwl_scan_cancel(struct iwl_priv *priv);
 int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms);
 int iwl_scan_initiate(struct iwl_priv *priv);
+u16 iwl_fill_probe_req(struct iwl_priv *priv, enum ieee80211_band band,
+                      struct ieee80211_mgmt *frame, int left);
 void iwl_setup_rx_scan_handlers(struct iwl_priv *priv);
+u16 iwl_get_active_dwell_time(struct iwl_priv *priv,
+                             enum ieee80211_band band,
+                             u8 n_probes);
+u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
+                              enum ieee80211_band band);
+void iwl_bg_scan_check(struct work_struct *data);
+void iwl_bg_abort_scan(struct work_struct *work);
+void iwl_bg_scan_completed(struct work_struct *work);
 void iwl_setup_scan_deferred_work(struct iwl_priv *priv);
+int iwl_send_scan_abort(struct iwl_priv *priv);
+
+/* For faster active scanning, scan will move to the next channel if fewer than
+ * PLCP_QUIET_THRESH packets are heard on this channel within
+ * ACTIVE_QUIET_TIME after sending probe request.  This shortens the dwell
+ * time if it's a quiet channel (nothing responded to our probe, and there's
+ * no other traffic).
+ * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */
+#define IWL_ACTIVE_QUIET_TIME       cpu_to_le16(10)  /* msec */
+#define IWL_PLCP_QUIET_THRESH       cpu_to_le16(1)  /* packets */
+
 
 /*******************************************************************************
  * Calibrations - implemented in iwl-calib.c
@@ -342,11 +402,22 @@ int iwl_send_cmd_pdu_async(struct iwl_priv *priv, u8 id, u16 len,
 
 int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
 
+int iwl_send_card_state(struct iwl_priv *priv, u32 flags,
+                       u8 meta_flag);
+
 /*****************************************************
  * PCI                                              *
  *****************************************************/
 void iwl_disable_interrupts(struct iwl_priv *priv);
 void iwl_enable_interrupts(struct iwl_priv *priv);
+static inline u16 iwl_pcie_link_ctl(struct iwl_priv *priv)
+{
+       int pos;
+       u16 pci_lnk_ctl;
+       pos = pci_find_capability(priv->pci_dev, PCI_CAP_ID_EXP);
+       pci_read_config_word(priv->pci_dev, pos + PCI_EXP_LNKCTL, &pci_lnk_ctl);
+       return pci_lnk_ctl;
+}
 
 /*****************************************************
 *  Error Handling Debugging
@@ -354,6 +425,11 @@ void iwl_enable_interrupts(struct iwl_priv *priv);
 void iwl_dump_nic_error_log(struct iwl_priv *priv);
 void iwl_dump_nic_event_log(struct iwl_priv *priv);
 
+/*****************************************************
+*  GEOS
+******************************************************/
+int iwlcore_init_geos(struct iwl_priv *priv);
+void iwlcore_free_geos(struct iwl_priv *priv);
 
 /*************** DRIVER STATUS FUNCTIONS   *****/
 
@@ -422,6 +498,7 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv)
 }
 
 extern void iwl_rf_kill_ct_config(struct iwl_priv *priv);
+extern int iwl_send_bt_config(struct iwl_priv *priv);
 extern int iwl_send_statistics_request(struct iwl_priv *priv, u8 flags);
 extern int iwl_verify_ucode(struct iwl_priv *priv);
 extern int iwl_send_lq_cmd(struct iwl_priv *priv,
index f34ede44ed109604d0463fac8a39d0a2ae9b483b..5028c781275b9a3d2f597afe94afaefd1150d057 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #define CSR_HW_REV_TYPE_5350           (0x0000030)
 #define CSR_HW_REV_TYPE_5100           (0x0000050)
 #define CSR_HW_REV_TYPE_5150           (0x0000040)
+#define CSR_HW_REV_TYPE_100            (0x0000060)
+#define CSR_HW_REV_TYPE_6x00           (0x0000070)
+#define CSR_HW_REV_TYPE_6x50           (0x0000080)
 #define CSR_HW_REV_TYPE_NONE           (0x00000F0)
 
 /* EEPROM REG */
index 56c13b458de7fc7571298591ec3d2eb2b20bfc27..65d1a7f2db9e73365199fc27e9a765b0fa7dd464 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project.
  *
 #ifndef __iwl_debug_h__
 #define __iwl_debug_h__
 
+struct iwl_priv;
+
+#define IWL_ERR(p, f, a...) dev_err(&((p)->pci_dev->dev), f, ## a)
+#define IWL_WARN(p, f, a...) dev_warn(&((p)->pci_dev->dev), f, ## a)
+#define IWL_INFO(p, f, a...) dev_info(&((p)->pci_dev->dev), f, ## a)
+#define IWL_CRIT(p, f, a...) dev_crit(&((p)->pci_dev->dev), f, ## a)
+
 #ifdef CONFIG_IWLWIFI_DEBUG
-#define IWL_DEBUG(level, fmt, args...) \
-do { if (priv->debug_level & (level)) \
-  dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \
-        in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
+#define IWL_DEBUG(__priv, level, fmt, args...)                         \
+do {                                                                   \
+       if (__priv->debug_level & (level))                              \
+               dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev),         \
+                        "%c %s " fmt, in_interrupt() ? 'I' : 'U',      \
+                       __func__ , ## args);                            \
+} while (0)
 
-#define IWL_DEBUG_LIMIT(level, fmt, args...) \
-do { if ((priv->debug_level & (level)) && net_ratelimit()) \
-  dev_printk(KERN_ERR, &(priv->hw->wiphy->dev), "%c %s " fmt, \
-        in_interrupt() ? 'I' : 'U', __func__ , ## args); } while (0)
+#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...)                   \
+do {                                                                   \
+       if ((__priv->debug_level & (level)) && net_ratelimit())         \
+               dev_printk(KERN_ERR, &(__priv->hw->wiphy->dev),         \
+                       "%c %s " fmt, in_interrupt() ? 'I' : 'U',       \
+                        __func__ , ## args);                           \
+} while (0)
 
 #define iwl_print_hex_dump(priv, level, p, len)                        \
 do {                                                                   \
@@ -61,6 +74,7 @@ struct iwl_debugfs {
                struct dentry *file_tx_statistics;
                struct dentry *file_log_event;
                struct dentry *file_channels;
+               struct dentry *file_status;
        } dbgfs_data_files;
        struct dir_rf_files {
                struct dentry *file_disable_sensitivity;
@@ -76,8 +90,8 @@ void iwl_dbgfs_unregister(struct iwl_priv *priv);
 #endif
 
 #else
-#define IWL_DEBUG(level, fmt, args...)
-#define IWL_DEBUG_LIMIT(level, fmt, args...)
+#define IWL_DEBUG(__priv, level, fmt, args...)
+#define IWL_DEBUG_LIMIT(__priv, level, fmt, args...)
 static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
                                      void *p, u32 len)
 {}
@@ -117,84 +131,85 @@ static inline void iwl_dbgfs_unregister(struct iwl_priv *priv)
  * when CONFIG_IWLWIFI_DEBUG=y.
  */
 
+/* 0x0000000F - 0x00000001 */
 #define IWL_DL_INFO            (1 << 0)
 #define IWL_DL_MAC80211                (1 << 1)
 #define IWL_DL_HCMD            (1 << 2)
 #define IWL_DL_STATE           (1 << 3)
+/* 0x000000F0 - 0x00000010 */
 #define IWL_DL_MACDUMP         (1 << 4)
 #define IWL_DL_HCMD_DUMP       (1 << 5)
-#define IWL_DL_RADIO         (1 << 7)
-#define IWL_DL_POWER         (1 << 8)
-#define IWL_DL_TEMP          (1 << 9)
-
-#define IWL_DL_NOTIF         (1 << 10)
-#define IWL_DL_SCAN          (1 << 11)
-#define IWL_DL_ASSOC         (1 << 12)
-#define IWL_DL_DROP          (1 << 13)
-
-#define IWL_DL_TXPOWER       (1 << 14)
-
-#define IWL_DL_AP            (1 << 15)
-
-#define IWL_DL_FW            (1 << 16)
-#define IWL_DL_RF_KILL       (1 << 17)
-#define IWL_DL_FW_ERRORS     (1 << 18)
-
-#define IWL_DL_LED           (1 << 19)
-
-#define IWL_DL_RATE          (1 << 20)
-
-#define IWL_DL_CALIB         (1 << 21)
-#define IWL_DL_WEP           (1 << 22)
-#define IWL_DL_TX            (1 << 23)
-#define IWL_DL_RX            (1 << 24)
-#define IWL_DL_ISR           (1 << 25)
-#define IWL_DL_HT            (1 << 26)
-#define IWL_DL_IO            (1 << 27)
-#define IWL_DL_11H           (1 << 28)
-
-#define IWL_DL_STATS         (1 << 29)
-#define IWL_DL_TX_REPLY      (1 << 30)
-#define IWL_DL_QOS           (1 << 31)
-
-#define IWL_ERROR(f, a...) printk(KERN_ERR DRV_NAME ": " f, ## a)
-#define IWL_WARNING(f, a...) printk(KERN_WARNING DRV_NAME ": " f, ## a)
-#define IWL_DEBUG_INFO(f, a...)    IWL_DEBUG(IWL_DL_INFO, f, ## a)
-
-#define IWL_DEBUG_MAC80211(f, a...)     IWL_DEBUG(IWL_DL_MAC80211, f, ## a)
-#define IWL_DEBUG_MACDUMP(f, a...)     IWL_DEBUG(IWL_DL_MACDUMP, f, ## a)
-#define IWL_DEBUG_TEMP(f, a...)   IWL_DEBUG(IWL_DL_TEMP, f, ## a)
-#define IWL_DEBUG_SCAN(f, a...)   IWL_DEBUG(IWL_DL_SCAN, f, ## a)
-#define IWL_DEBUG_RX(f, a...)     IWL_DEBUG(IWL_DL_RX, f, ## a)
-#define IWL_DEBUG_TX(f, a...)     IWL_DEBUG(IWL_DL_TX, f, ## a)
-#define IWL_DEBUG_ISR(f, a...)    IWL_DEBUG(IWL_DL_ISR, f, ## a)
-#define IWL_DEBUG_LED(f, a...) IWL_DEBUG(IWL_DL_LED, f, ## a)
-#define IWL_DEBUG_WEP(f, a...)    IWL_DEBUG(IWL_DL_WEP, f, ## a)
-#define IWL_DEBUG_HC(f, a...) IWL_DEBUG(IWL_DL_HCMD, f, ## a)
-#define IWL_DEBUG_HC_DUMP(f, a...) IWL_DEBUG(IWL_DL_HCMD_DUMP, f, ## a)
-#define IWL_DEBUG_CALIB(f, a...) IWL_DEBUG(IWL_DL_CALIB, f, ## a)
-#define IWL_DEBUG_FW(f, a...) IWL_DEBUG(IWL_DL_FW, f, ## a)
-#define IWL_DEBUG_RF_KILL(f, a...) IWL_DEBUG(IWL_DL_RF_KILL, f, ## a)
-#define IWL_DEBUG_DROP(f, a...) IWL_DEBUG(IWL_DL_DROP, f, ## a)
-#define IWL_DEBUG_DROP_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_DROP, f, ## a)
-#define IWL_DEBUG_AP(f, a...) IWL_DEBUG(IWL_DL_AP, f, ## a)
-#define IWL_DEBUG_TXPOWER(f, a...) IWL_DEBUG(IWL_DL_TXPOWER, f, ## a)
-#define IWL_DEBUG_IO(f, a...) IWL_DEBUG(IWL_DL_IO, f, ## a)
-#define IWL_DEBUG_RATE(f, a...) IWL_DEBUG(IWL_DL_RATE, f, ## a)
-#define IWL_DEBUG_RATE_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_RATE, f, ## a)
-#define IWL_DEBUG_NOTIF(f, a...) IWL_DEBUG(IWL_DL_NOTIF, f, ## a)
-#define IWL_DEBUG_ASSOC(f, a...) IWL_DEBUG(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
-#define IWL_DEBUG_ASSOC_LIMIT(f, a...) \
-       IWL_DEBUG_LIMIT(IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
-#define IWL_DEBUG_HT(f, a...) IWL_DEBUG(IWL_DL_HT, f, ## a)
-#define IWL_DEBUG_STATS(f, a...) IWL_DEBUG(IWL_DL_STATS, f, ## a)
-#define IWL_DEBUG_STATS_LIMIT(f, a...) IWL_DEBUG_LIMIT(IWL_DL_STATS, f, ## a)
-#define IWL_DEBUG_TX_REPLY(f, a...) IWL_DEBUG(IWL_DL_TX_REPLY, f, ## a)
-#define IWL_DEBUG_TX_REPLY_LIMIT(f, a...) \
-       IWL_DEBUG_LIMIT(IWL_DL_TX_REPLY, f, ## a)
-#define IWL_DEBUG_QOS(f, a...)   IWL_DEBUG(IWL_DL_QOS, f, ## a)
-#define IWL_DEBUG_RADIO(f, a...)  IWL_DEBUG(IWL_DL_RADIO, f, ## a)
-#define IWL_DEBUG_POWER(f, a...)  IWL_DEBUG(IWL_DL_POWER, f, ## a)
-#define IWL_DEBUG_11H(f, a...)  IWL_DEBUG(IWL_DL_11H, f, ## a)
+#define IWL_DL_RADIO           (1 << 7)
+/* 0x00000F00 - 0x00000100 */
+#define IWL_DL_POWER           (1 << 8)
+#define IWL_DL_TEMP            (1 << 9)
+#define IWL_DL_NOTIF           (1 << 10)
+#define IWL_DL_SCAN            (1 << 11)
+/* 0x0000F000 - 0x00001000 */
+#define IWL_DL_ASSOC           (1 << 12)
+#define IWL_DL_DROP            (1 << 13)
+#define IWL_DL_TXPOWER         (1 << 14)
+#define IWL_DL_AP              (1 << 15)
+/* 0x000F0000 - 0x00010000 */
+#define IWL_DL_FW              (1 << 16)
+#define IWL_DL_RF_KILL         (1 << 17)
+#define IWL_DL_FW_ERRORS       (1 << 18)
+#define IWL_DL_LED             (1 << 19)
+/* 0x00F00000 - 0x00100000 */
+#define IWL_DL_RATE            (1 << 20)
+#define IWL_DL_CALIB           (1 << 21)
+#define IWL_DL_WEP             (1 << 22)
+#define IWL_DL_TX              (1 << 23)
+/* 0x0F000000 - 0x01000000 */
+#define IWL_DL_RX              (1 << 24)
+#define IWL_DL_ISR             (1 << 25)
+#define IWL_DL_HT              (1 << 26)
+#define IWL_DL_IO              (1 << 27)
+/* 0xF0000000 - 0x10000000 */
+#define IWL_DL_11H             (1 << 28)
+#define IWL_DL_STATS           (1 << 29)
+#define IWL_DL_TX_REPLY                (1 << 30)
+#define IWL_DL_QOS             (1 << 31)
+
+#define IWL_DEBUG_INFO(p, f, a...)     IWL_DEBUG(p, IWL_DL_INFO, f, ## a)
+#define IWL_DEBUG_MAC80211(p, f, a...) IWL_DEBUG(p, IWL_DL_MAC80211, f, ## a)
+#define IWL_DEBUG_MACDUMP(p, f, a...)  IWL_DEBUG(p, IWL_DL_MACDUMP, f, ## a)
+#define IWL_DEBUG_TEMP(p, f, a...)     IWL_DEBUG(p, IWL_DL_TEMP, f, ## a)
+#define IWL_DEBUG_SCAN(p, f, a...)     IWL_DEBUG(p, IWL_DL_SCAN, f, ## a)
+#define IWL_DEBUG_RX(p, f, a...)       IWL_DEBUG(p, IWL_DL_RX, f, ## a)
+#define IWL_DEBUG_TX(p, f, a...)       IWL_DEBUG(p, IWL_DL_TX, f, ## a)
+#define IWL_DEBUG_ISR(p, f, a...)      IWL_DEBUG(p, IWL_DL_ISR, f, ## a)
+#define IWL_DEBUG_LED(p, f, a...)      IWL_DEBUG(p, IWL_DL_LED, f, ## a)
+#define IWL_DEBUG_WEP(p, f, a...)      IWL_DEBUG(p, IWL_DL_WEP, f, ## a)
+#define IWL_DEBUG_HC(p, f, a...)       IWL_DEBUG(p, IWL_DL_HCMD, f, ## a)
+#define IWL_DEBUG_HC_DUMP(p, f, a...)  IWL_DEBUG(p, IWL_DL_HCMD_DUMP, f, ## a)
+#define IWL_DEBUG_CALIB(p, f, a...)    IWL_DEBUG(p, IWL_DL_CALIB, f, ## a)
+#define IWL_DEBUG_FW(p, f, a...)       IWL_DEBUG(p, IWL_DL_FW, f, ## a)
+#define IWL_DEBUG_RF_KILL(p, f, a...)  IWL_DEBUG(p, IWL_DL_RF_KILL, f, ## a)
+#define IWL_DEBUG_DROP(p, f, a...)     IWL_DEBUG(p, IWL_DL_DROP, f, ## a)
+#define IWL_DEBUG_DROP_LIMIT(p, f, a...)       \
+               IWL_DEBUG_LIMIT(p, IWL_DL_DROP, f, ## a)
+#define IWL_DEBUG_AP(p, f, a...)       IWL_DEBUG(p, IWL_DL_AP, f, ## a)
+#define IWL_DEBUG_TXPOWER(p, f, a...)  IWL_DEBUG(p, IWL_DL_TXPOWER, f, ## a)
+#define IWL_DEBUG_IO(p, f, a...)       IWL_DEBUG(p, IWL_DL_IO, f, ## a)
+#define IWL_DEBUG_RATE(p, f, a...)     IWL_DEBUG(p, IWL_DL_RATE, f, ## a)
+#define IWL_DEBUG_RATE_LIMIT(p, f, a...)       \
+               IWL_DEBUG_LIMIT(p, IWL_DL_RATE, f, ## a)
+#define IWL_DEBUG_NOTIF(p, f, a...)    IWL_DEBUG(p, IWL_DL_NOTIF, f, ## a)
+#define IWL_DEBUG_ASSOC(p, f, a...)    \
+               IWL_DEBUG(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
+#define IWL_DEBUG_ASSOC_LIMIT(p, f, a...)      \
+               IWL_DEBUG_LIMIT(p, IWL_DL_ASSOC | IWL_DL_INFO, f, ## a)
+#define IWL_DEBUG_HT(p, f, a...)       IWL_DEBUG(p, IWL_DL_HT, f, ## a)
+#define IWL_DEBUG_STATS(p, f, a...)    IWL_DEBUG(p, IWL_DL_STATS, f, ## a)
+#define IWL_DEBUG_STATS_LIMIT(p, f, a...)      \
+               IWL_DEBUG_LIMIT(p, IWL_DL_STATS, f, ## a)
+#define IWL_DEBUG_TX_REPLY(p, f, a...) IWL_DEBUG(p, IWL_DL_TX_REPLY, f, ## a)
+#define IWL_DEBUG_TX_REPLY_LIMIT(p, f, a...) \
+               IWL_DEBUG_LIMIT(p, IWL_DL_TX_REPLY, f, ## a)
+#define IWL_DEBUG_QOS(p, f, a...)      IWL_DEBUG(p, IWL_DL_QOS, f, ## a)
+#define IWL_DEBUG_RADIO(p, f, a...)    IWL_DEBUG(p, IWL_DL_RADIO, f, ## a)
+#define IWL_DEBUG_POWER(p, f, a...)    IWL_DEBUG(p, IWL_DL_POWER, f, ## a)
+#define IWL_DEBUG_11H(p, f, a...)      IWL_DEBUG(p, IWL_DL_11H, f, ## a)
 
 #endif
index d5253a179dec6fd35cd37a4d9687046899ca782a..36cfeccfafbcde17933cba2a1e6261a7c6023d04 100644 (file)
@@ -2,7 +2,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
                goto err;                                               \
 } while (0)
 
+#define DEBUGFS_ADD_X32(name, parent, ptr) do {                        \
+       dbgfs->dbgfs_##parent##_files.file_##name =                     \
+       debugfs_create_x32(#name, 0444, dbgfs->dir_##parent, ptr);     \
+       if (IS_ERR(dbgfs->dbgfs_##parent##_files.file_##name)           \
+                       || !dbgfs->dbgfs_##parent##_files.file_##name)  \
+               goto err;                                               \
+} while (0)
+
 #define DEBUGFS_REMOVE(name)  do {              \
        debugfs_remove(name);                   \
        name = NULL;                            \
@@ -164,9 +172,6 @@ static ssize_t iwl_dbgfs_sram_read(struct file *file,
        struct iwl_priv *priv = (struct iwl_priv *)file->private_data;
        const size_t bufsz = sizeof(buf);
 
-       printk(KERN_DEBUG "offset is: 0x%x\tlen is: 0x%x\n",
-       priv->dbgfs->sram_offset, priv->dbgfs->sram_len);
-
        iwl_grab_nic_access(priv);
        for (i = priv->dbgfs->sram_len; i > 0; i -= 4) {
                val = iwl_read_targ_mem(priv, priv->dbgfs->sram_offset + \
@@ -301,14 +306,14 @@ static ssize_t iwl_dbgfs_eeprom_read(struct file *file,
        buf_size = 4 * eeprom_len + 256;
 
        if (eeprom_len % 16) {
-               IWL_ERROR("EEPROM size is not multiple of 16.\n");
+               IWL_ERR(priv, "EEPROM size is not multiple of 16.\n");
                return -ENODATA;
        }
 
        /* 4 characters for byte 0xYY */
        buf = kzalloc(buf_size, GFP_KERNEL);
        if (!buf) {
-               IWL_ERROR("Can not allocate Buffer\n");
+               IWL_ERR(priv, "Can not allocate Buffer\n");
                return -ENOMEM;
        }
 
@@ -365,7 +370,7 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
 
        buf = kzalloc(bufsz, GFP_KERNEL);
        if (!buf) {
-               IWL_ERROR("Can not allocate Buffer\n");
+               IWL_ERR(priv, "Can not allocate Buffer\n");
                return -ENOMEM;
        }
 
@@ -420,7 +425,6 @@ static ssize_t iwl_dbgfs_channels_read(struct file *file, char __user *user_buf,
        return ret;
 }
 
-
 DEBUGFS_READ_WRITE_FILE_OPS(sram);
 DEBUGFS_WRITE_FILE_OPS(log_event);
 DEBUGFS_READ_FILE_OPS(eeprom);
@@ -462,6 +466,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
        DEBUGFS_ADD_FILE(rx_statistics, data);
        DEBUGFS_ADD_FILE(tx_statistics, data);
        DEBUGFS_ADD_FILE(channels, data);
+       DEBUGFS_ADD_X32(status, data, (u32 *)&priv->status);
        DEBUGFS_ADD_BOOL(disable_sensitivity, rf, &priv->disable_sens_cal);
        DEBUGFS_ADD_BOOL(disable_chain_noise, rf,
                         &priv->disable_chain_noise_cal);
@@ -469,7 +474,7 @@ int iwl_dbgfs_register(struct iwl_priv *priv, const char *name)
        return 0;
 
 err:
-       IWL_ERROR("Can't open the debugfs directory\n");
+       IWL_ERR(priv, "Can't open the debugfs directory\n");
        iwl_dbgfs_unregister(priv);
        return ret;
 }
index 0468fcc1ea98ed58d42e6988cb248a7a162a3589..afde713c806f53556a201c577eeae9727dae047a 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 #include <linux/kernel.h>
 #include <net/ieee80211_radiotap.h>
 
-#define DRV_NAME        "iwlagn"
-#include "iwl-rfkill.h"
 #include "iwl-eeprom.h"
-#include "iwl-4965-hw.h"
 #include "iwl-csr.h"
 #include "iwl-prph.h"
+#include "iwl-fh.h"
 #include "iwl-debug.h"
+#include "iwl-rfkill.h"
+#include "iwl-4965-hw.h"
+#include "iwl-3945-hw.h"
+#include "iwl-3945-led.h"
 #include "iwl-led.h"
 #include "iwl-power.h"
 #include "iwl-agn-rs.h"
@@ -55,6 +57,28 @@ extern struct iwl_cfg iwl5350_agn_cfg;
 extern struct iwl_cfg iwl5100_bg_cfg;
 extern struct iwl_cfg iwl5100_abg_cfg;
 extern struct iwl_cfg iwl5150_agn_cfg;
+extern struct iwl_cfg iwl6000_2ag_cfg;
+extern struct iwl_cfg iwl6000_2agn_cfg;
+extern struct iwl_cfg iwl6000_3agn_cfg;
+extern struct iwl_cfg iwl6050_2agn_cfg;
+extern struct iwl_cfg iwl6050_3agn_cfg;
+extern struct iwl_cfg iwl100_bgn_cfg;
+
+/* shared structures from iwl-5000.c */
+extern struct iwl_mod_params iwl50_mod_params;
+extern struct iwl_ops iwl5000_ops;
+extern struct iwl_lib_ops iwl5000_lib;
+extern struct iwl_hcmd_ops iwl5000_hcmd;
+extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils;
+
+/* shared functions from iwl-5000.c */
+extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len);
+extern u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd,
+                                    u8 *data);
+extern void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
+                                   __le32 *tx_flags);
+extern int iwl5000_calc_rssi(struct iwl_priv *priv,
+                            struct iwl_rx_phy_res *rx_resp);
 
 /* CT-KILL constants */
 #define CT_KILL_THRESHOLD      110 /* in Celsius */
@@ -132,9 +156,12 @@ struct iwl_tx_info {
  * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
  * descriptors) and required locking structures.
  */
+#define TFD_TX_CMD_SLOTS 256
+#define TFD_CMD_SLOTS 32
+
 struct iwl_tx_queue {
        struct iwl_queue q;
-       struct iwl_tfd *tfds;
+       void *tfds;
        struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
        struct iwl_tx_info *txb;
        u8 need_update;
@@ -154,6 +181,36 @@ struct iwl4965_channel_tgh_info {
        s64 last_radar_time;
 };
 
+#define IWL4965_MAX_RATE (33)
+
+struct iwl3945_clip_group {
+       /* maximum power level to prevent clipping for each rate, derived by
+        *   us from this band's saturation power in EEPROM */
+       const s8 clip_powers[IWL_MAX_RATES];
+};
+
+/* current Tx power values to use, one for each rate for each channel.
+ * requested power is limited by:
+ * -- regulatory EEPROM limits for this channel
+ * -- hardware capabilities (clip-powers)
+ * -- spectrum management
+ * -- user preference (e.g. iwconfig)
+ * when requested power is set, base power index must also be set. */
+struct iwl3945_channel_power_info {
+       struct iwl3945_tx_power tpc;    /* actual radio and DSP gain settings */
+       s8 power_table_index;   /* actual (compenst'd) index into gain table */
+       s8 base_power_index;    /* gain index for power at factory temp. */
+       s8 requested_power;     /* power (dBm) requested for this chnl/rate */
+};
+
+/* current scan Tx power values to use, one for each scan rate for each
+ * channel. */
+struct iwl3945_scan_power_info {
+       struct iwl3945_tx_power tpc;    /* actual radio and DSP gain settings */
+       s8 power_table_index;   /* actual (compenst'd) index into gain table */
+       s8 requested_power;     /* scan pwr (dBm) requested for chnl/rate */
+};
+
 /*
  * One for each channel, holds all channel setup data
  * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
@@ -184,8 +241,15 @@ struct iwl_channel_info {
        s8 fat_scan_power;      /* (dBm) eeprom, direct scans, any rate */
        u8 fat_flags;           /* flags copied from EEPROM */
        u8 fat_extension_channel; /* HT_IE_EXT_CHANNEL_* */
-};
 
+       /* Radio/DSP gain settings for each "normal" data Tx rate.
+        * These include, in addition to RF and DSP gain, a few fields for
+        *   remembering/modifying gain settings (indexes). */
+       struct iwl3945_channel_power_info power_info[IWL4965_MAX_RATE];
+
+       /* Radio/DSP gain settings for each scan rate, for directed scans. */
+       struct iwl3945_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
+};
 
 #define IWL_TX_FIFO_AC0        0
 #define IWL_TX_FIFO_AC1        1
@@ -370,7 +434,7 @@ struct iwl_hw_key {
        u8 key[32];
 };
 
-union iwl4965_ht_rate_supp {
+union iwl_ht_rate_supp {
        u16 rates;
        struct {
                u8 siso_rate;
@@ -430,6 +494,24 @@ struct iwl_qos_info {
 #define STA_PS_STATUS_WAKE             0
 #define STA_PS_STATUS_SLEEP            1
 
+struct iwl3945_tid_data {
+       u16 seq_number;
+};
+
+struct iwl3945_hw_key {
+       enum ieee80211_key_alg alg;
+       int keylen;
+       u8 key[32];
+};
+
+struct iwl3945_station_entry {
+       struct iwl3945_addsta_cmd sta;
+       struct iwl3945_tid_data tid[MAX_TID_COUNT];
+       u8 used;
+       u8 ps_status;
+       struct iwl3945_hw_key keyinfo;
+};
+
 struct iwl_station_entry {
        struct iwl_addsta_cmd sta;
        struct iwl_tid_data tid[MAX_TID_COUNT];
@@ -497,11 +579,13 @@ struct iwl_sensitivity_ranges {
  * @max_txq_num: Max # Tx queues supported
  * @dma_chnl_num: Number of Tx DMA/FIFO channels
  * @scd_bc_tbls_size: size of scheduler byte count tables
+ * @tfd_size: TFD size
  * @tx/rx_chains_num: Number of TX/RX chains
  * @valid_tx/rx_ant: usable antennas
  * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
  * @max_rxq_log: Log-base-2 of max_rxq_size
  * @rx_buf_size: Rx buffer size
+ * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
  * @max_stations:
  * @bcast_sta_id:
  * @fat_channel: is 40MHz width possible in band 2.4
@@ -516,6 +600,7 @@ struct iwl_hw_params {
        u8 max_txq_num;
        u8 dma_chnl_num;
        u16 scd_bc_tbls_size;
+       u32 tfd_size;
        u8  tx_chains_num;
        u8  rx_chains_num;
        u8  valid_tx_ant;
@@ -523,6 +608,7 @@ struct iwl_hw_params {
        u16 max_rxq_size;
        u16 max_rxq_log;
        u32 rx_buf_size;
+       u32 rx_wrt_ptr_reg;
        u32 max_pkt_size;
        u8  max_stations;
        u8  bcast_sta_id;
@@ -755,7 +841,7 @@ struct iwl_priv {
 
        struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
 
-#ifdef CONFIG_IWLAGN_SPECTRUM_MEASUREMENT
+#if defined(CONFIG_IWLAGN_SPECTRUM_MEASUREMENT) || defined(CONFIG_IWL3945_SPECTRUM_MEASUREMENT)
        /* spectrum measurement report caching */
        struct iwl_spectrum_notification measure_report;
        u8 measurement_status;
@@ -768,6 +854,10 @@ struct iwl_priv {
        struct iwl_channel_info *channel_info;  /* channel info array */
        u8 channel_count;       /* # of channels */
 
+       /* each calibration channel group in the EEPROM has a derived
+        * clip setting for each rate. 3945 only.*/
+       const struct iwl3945_clip_group clip39_groups[5];
+
        /* thermal calibration */
        s32 temperature;        /* degrees Kelvin */
        s32 last_temperature;
@@ -781,7 +871,7 @@ struct iwl_priv {
        unsigned long scan_start;
        unsigned long scan_pass_start;
        unsigned long scan_start_tsf;
-       struct iwl_scan_cmd *scan;
+       void *scan;
        int scan_bands;
        int one_direct_scan;
        u8 direct_ssid_len;
@@ -832,18 +922,25 @@ struct iwl_priv {
         * 4965's initialize alive response contains some calibration data. */
        struct iwl_init_alive_resp card_alive_init;
        struct iwl_alive_resp card_alive;
-#ifdef CONFIG_IWLWIFI_RFKILL
+#if defined(CONFIG_IWLWIFI_RFKILL) || defined(CONFIG_IWL3945_RFKILL)
        struct rfkill *rfkill;
 #endif
 
-#ifdef CONFIG_IWLWIFI_LEDS
-       struct iwl_led led[IWL_LED_TRG_MAX];
+#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS)
        unsigned long last_blink_time;
        u8 last_blink_rate;
        u8 allow_blinking;
        u64 led_tpt;
 #endif
 
+#ifdef CONFIG_IWLWIFI_LEDS
+       struct iwl_led led[IWL_LED_TRG_MAX];
+#endif
+
+#ifdef CONFIG_IWL3945_LEDS
+       struct iwl3945_led led39[IWL_LED_TRG_MAX];
+       unsigned int rxtxpackets;
+#endif
        u16 active_rate;
        u16 active_rate_basic;
 
@@ -893,7 +990,6 @@ struct iwl_priv {
        u16 rates_mask;
 
        u32 power_mode;
-       u32 antenna;
        u8 bssid[ETH_ALEN];
        u16 rts_threshold;
        u8 mac_addr[ETH_ALEN];
@@ -929,6 +1025,10 @@ struct iwl_priv {
        u16 beacon_int;
        struct ieee80211_vif *vif;
 
+       /*Added for 3945 */
+       void *shared_virt;
+       dma_addr_t shared_phys;
+       /*End*/
        struct iwl_hw_params hw_params;
 
 
@@ -960,6 +1060,11 @@ struct iwl_priv {
        struct delayed_work init_alive_start;
        struct delayed_work alive_start;
        struct delayed_work scan_check;
+
+       /*For 3945 only*/
+       struct delayed_work thermal_periodic;
+       struct delayed_work rfkill_poll;
+
        /* TX Power */
        s8 tx_power_user_lmt;
        s8 tx_power_channel_lmt;
@@ -982,6 +1087,15 @@ struct iwl_priv {
        u32 disable_tx_power_cal;
        struct work_struct run_time_calib_work;
        struct timer_list statistics_periodic;
+
+       /*For 3945*/
+#define IWL_DEFAULT_TX_POWER 0x0F
+
+       struct iwl3945_notif_statistics statistics_39;
+
+       struct iwl3945_station_entry stations_39[IWL_STATION_COUNT];
+
+       u32 sta_supp_rates;
 }; /*iwl_priv */
 
 static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
index ce2f47306cea3bce863d7a87de4728d629c5c664..75517d05df0833fee49564672336785abaa2adf5 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -145,7 +145,7 @@ int iwlcore_eeprom_verify_signature(struct iwl_priv *priv)
 {
        u32 gp = iwl_read32(priv, CSR_EEPROM_GP);
        if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) {
-               IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
+               IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
                return -ENOENT;
        }
        return 0;
@@ -173,7 +173,7 @@ int iwlcore_eeprom_acquire_semaphore(struct iwl_priv *priv)
                                CSR_HW_IF_CONFIG_REG_BIT_EEPROM_OWN_SEM,
                                EEPROM_SEM_TIMEOUT);
                if (ret >= 0) {
-                       IWL_DEBUG_IO("Acquired semaphore after %d tries.\n",
+                       IWL_DEBUG_IO(priv, "Acquired semaphore after %d tries.\n",
                                count+1);
                        return ret;
                }
@@ -223,7 +223,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
 
        ret = priv->cfg->ops->lib->eeprom_ops.verify_signature(priv);
        if (ret < 0) {
-               IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
+               IWL_ERR(priv, "EEPROM not found, EEPROM_GP=0x%08x\n", gp);
                ret = -ENOENT;
                goto err;
        }
@@ -231,7 +231,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
        /* Make sure driver (instead of uCode) is allowed to read EEPROM */
        ret = priv->cfg->ops->lib->eeprom_ops.acquire_semaphore(priv);
        if (ret < 0) {
-               IWL_ERROR("Failed to acquire EEPROM semaphore.\n");
+               IWL_ERR(priv, "Failed to acquire EEPROM semaphore.\n");
                ret = -ENOENT;
                goto err;
        }
@@ -247,7 +247,7 @@ int iwl_eeprom_init(struct iwl_priv *priv)
                                          CSR_EEPROM_REG_READ_VALID_MSK,
                                          IWL_EEPROM_ACCESS_TIMEOUT);
                if (ret < 0) {
-                       IWL_ERROR("Time out reading EEPROM[%d]\n", addr);
+                       IWL_ERR(priv, "Time out reading EEPROM[%d]\n", addr);
                        goto done;
                }
                r = _iwl_read_direct32(priv, CSR_EEPROM_REG);
@@ -285,7 +285,7 @@ int iwl_eeprom_check_version(struct iwl_priv *priv)
 
        return 0;
 err:
-       IWL_ERROR("Unsupported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
+       IWL_ERR(priv, "Unsupported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n",
                  eeprom_ver, priv->cfg->eeprom_ver,
                  calib_ver,  priv->cfg->eeprom_calib_ver);
        return -EINVAL;
@@ -390,7 +390,7 @@ static int iwl_set_fat_chan_info(struct iwl_priv *priv,
        if (!is_channel_valid(ch_info))
                return -1;
 
-       IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):"
+       IWL_DEBUG_INFO(priv, "FAT Ch. %d [%sGHz] %s%s%s%s%s(0x%02x %ddBm):"
                        " Ad-Hoc %ssupported\n",
                        ch_info->channel,
                        is_channel_a_band(ch_info) ?
@@ -432,11 +432,11 @@ int iwl_init_channel_map(struct iwl_priv *priv)
        struct iwl_channel_info *ch_info;
 
        if (priv->channel_count) {
-               IWL_DEBUG_INFO("Channel map already initialized.\n");
+               IWL_DEBUG_INFO(priv, "Channel map already initialized.\n");
                return 0;
        }
 
-       IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n");
+       IWL_DEBUG_INFO(priv, "Initializing regulatory info from EEPROM\n");
 
        priv->channel_count =
            ARRAY_SIZE(iwl_eeprom_band_1) +
@@ -445,12 +445,12 @@ int iwl_init_channel_map(struct iwl_priv *priv)
            ARRAY_SIZE(iwl_eeprom_band_4) +
            ARRAY_SIZE(iwl_eeprom_band_5);
 
-       IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count);
+       IWL_DEBUG_INFO(priv, "Parsing data for %d channels.\n", priv->channel_count);
 
        priv->channel_info = kzalloc(sizeof(struct iwl_channel_info) *
                                     priv->channel_count, GFP_KERNEL);
        if (!priv->channel_info) {
-               IWL_ERROR("Could not allocate channel_info\n");
+               IWL_ERR(priv, "Could not allocate channel_info\n");
                priv->channel_count = 0;
                return -ENOMEM;
        }
@@ -485,7 +485,7 @@ int iwl_init_channel_map(struct iwl_priv *priv)
                                 IEEE80211_CHAN_NO_FAT_BELOW);
 
                        if (!(is_channel_valid(ch_info))) {
-                               IWL_DEBUG_INFO("Ch. %d Flags %x [%sGHz] - "
+                               IWL_DEBUG_INFO(priv, "Ch. %d Flags %x [%sGHz] - "
                                               "No traffic\n",
                                               ch_info->channel,
                                               ch_info->flags,
@@ -501,7 +501,7 @@ int iwl_init_channel_map(struct iwl_priv *priv)
                        ch_info->scan_power = eeprom_ch_info[ch].max_power_avg;
                        ch_info->min_power = 0;
 
-                       IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x %ddBm):"
+                       IWL_DEBUG_INFO(priv, "Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x %ddBm):"
                                       " Ad-Hoc %ssupported\n",
                                       ch_info->channel,
                                       is_channel_a_band(ch_info) ?
@@ -520,7 +520,7 @@ int iwl_init_channel_map(struct iwl_priv *priv)
                                             flags & EEPROM_CHANNEL_RADAR))
                                       ? "" : "not ");
 
-                       /* Set the user_txpower_limit to the highest power
+                       /* Set the tx_power_user_lmt to the highest power
                         * supported by any channel */
                        if (eeprom_ch_info[ch].max_power_avg >
                                                priv->tx_power_user_lmt)
@@ -531,6 +531,13 @@ int iwl_init_channel_map(struct iwl_priv *priv)
                }
        }
 
+       /* Check if we do have FAT channels */
+       if (priv->cfg->ops->lib->eeprom_ops.regulatory_bands[5] ==
+           EEPROM_REGULATORY_BAND_NO_FAT &&
+           priv->cfg->ops->lib->eeprom_ops.regulatory_bands[6] ==
+           EEPROM_REGULATORY_BAND_NO_FAT)
+               return 0;
+
        /* Two additional EEPROM bands for 2.4 and 5 GHz FAT channels */
        for (band = 6; band <= 7; band++) {
                enum ieee80211_band ieeeband;
@@ -582,6 +589,7 @@ void iwl_free_channel_map(struct iwl_priv *priv)
        kfree(priv->channel_info);
        priv->channel_count = 0;
 }
+EXPORT_SYMBOL(iwl_free_channel_map);
 
 /**
  * iwl_get_channel_info - Find driver's private channel info
index 603c84bed6300b2e195082377c242f48b4a90930..3479153d96ca1cd164855725292d6a2287cf6ba0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -118,6 +118,9 @@ struct iwl_eeprom_channel {
        s8 max_power_avg;       /* max power (dBm) on this chnl, limit 31 */
 } __attribute__ ((packed));
 
+/* 3945 Specific */
+#define EEPROM_3945_EEPROM_VERSION     (0x2f)
+
 /* 4965 has two radio transmitters (and 3 radio receivers) */
 #define EEPROM_TX_POWER_TX_CHAINS      (2)
 
@@ -367,6 +370,8 @@ struct iwl_eeprom_calib_info {
  */
 #define EEPROM_4965_REGULATORY_BAND_52_FAT_CHANNELS (2*0xA8)   /* 22 bytes */
 
+#define EEPROM_REGULATORY_BAND_NO_FAT                  (0)
+
 struct iwl_eeprom_ops {
        const u32 regulatory_bands[7];
        int (*verify_signature) (struct iwl_priv *priv);
index d7da1986455092ac6b5cfe47582630f436caeffb..65fa8a69fd5ab65fba6322182db3773804d4c3f6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  */
 #define FH_TX_CHICKEN_BITS_SCD_AUTO_RETRY_EN   (0x00000002)
 
+#define RX_QUEUE_SIZE                         256
+#define RX_QUEUE_MASK                         255
+#define RX_QUEUE_SIZE_LOG                     8
+
+/*
+ * RX related structures and functions
+ */
+#define RX_FREE_BUFFERS 64
+#define RX_LOW_WATERMARK 8
+
+/* Size of one Rx buffer in host DRAM */
+#define IWL_RX_BUF_SIZE_3K (3 * 1000) /* 3945 only */
+#define IWL_RX_BUF_SIZE_4K (4 * 1024)
+#define IWL_RX_BUF_SIZE_8K (8 * 1024)
+
 /**
  * struct iwl_rb_status - reseve buffer status
  *     host memory mapped FH registers
@@ -414,6 +429,7 @@ struct iwl_rb_status {
        __le16 closed_fr_num;
        __le16 finished_rb_num;
        __le16 finished_fr_nam;
+       __le32 __unused; /* 3945 only */
 } __attribute__ ((packed));
 
 
@@ -477,7 +493,6 @@ struct iwl_tfd {
        __le32 __pad;
 } __attribute__ ((packed));
 
-
 /* Keep Warm Size */
 #define IWL_KW_SIZE 0x1000     /* 4k */
 
index 4b35b30e493e8abc82a90aa393d018683fa2359b..17d61ac8ed61e446c8558c432707de77cd61d568 100644 (file)
@@ -2,7 +2,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -109,14 +109,14 @@ static int iwl_generic_cmd_callback(struct iwl_priv *priv,
        struct iwl_rx_packet *pkt = NULL;
 
        if (!skb) {
-               IWL_ERROR("Error: Response NULL in %s.\n",
+               IWL_ERR(priv, "Error: Response NULL in %s.\n",
                                get_cmd_string(cmd->hdr.cmd));
                return 1;
        }
 
        pkt = (struct iwl_rx_packet *)skb->data;
        if (pkt->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from %s (0x%08X)\n",
+               IWL_ERR(priv, "Bad return from %s (0x%08X)\n",
                        get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
                return 1;
        }
@@ -125,11 +125,11 @@ static int iwl_generic_cmd_callback(struct iwl_priv *priv,
        switch (cmd->hdr.cmd) {
        case REPLY_TX_LINK_QUALITY_CMD:
        case SENSITIVITY_CMD:
-               IWL_DEBUG_HC_DUMP("back from %s (0x%08X)\n",
+               IWL_DEBUG_HC_DUMP(priv, "back from %s (0x%08X)\n",
                                get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
                                break;
        default:
-               IWL_DEBUG_HC("back from %s (0x%08X)\n",
+               IWL_DEBUG_HC(priv, "back from %s (0x%08X)\n",
                                get_cmd_string(cmd->hdr.cmd), pkt->hdr.flags);
        }
 #endif
@@ -156,7 +156,7 @@ static int iwl_send_cmd_async(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 
        ret = iwl_enqueue_hcmd(priv, cmd);
        if (ret < 0) {
-               IWL_ERROR("Error sending %s: enqueue_hcmd failed: %d\n",
+               IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n",
                          get_cmd_string(cmd->id), ret);
                return ret;
        }
@@ -174,8 +174,9 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        BUG_ON(cmd->meta.u.callback != NULL);
 
        if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) {
-               IWL_ERROR("Error sending %s: Already sending a host command\n",
-                         get_cmd_string(cmd->id));
+               IWL_ERR(priv,
+                       "Error sending %s: Already sending a host command\n",
+                       get_cmd_string(cmd->id));
                ret = -EBUSY;
                goto out;
        }
@@ -188,7 +189,7 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        cmd_idx = iwl_enqueue_hcmd(priv, cmd);
        if (cmd_idx < 0) {
                ret = cmd_idx;
-               IWL_ERROR("Error sending %s: enqueue_hcmd failed: %d\n",
+               IWL_ERR(priv, "Error sending %s: enqueue_hcmd failed: %d\n",
                          get_cmd_string(cmd->id), ret);
                goto out;
        }
@@ -198,9 +199,10 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
                        HOST_COMPLETE_TIMEOUT);
        if (!ret) {
                if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
-                       IWL_ERROR("Error sending %s: time out after %dms.\n",
-                                 get_cmd_string(cmd->id),
-                                 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
+                       IWL_ERR(priv,
+                               "Error sending %s: time out after %dms.\n",
+                               get_cmd_string(cmd->id),
+                               jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
 
                        clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
                        ret = -ETIMEDOUT;
@@ -209,19 +211,19 @@ int iwl_send_cmd_sync(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        }
 
        if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
-               IWL_DEBUG_INFO("Command %s aborted: RF KILL Switch\n",
+               IWL_DEBUG_INFO(priv, "Command %s aborted: RF KILL Switch\n",
                               get_cmd_string(cmd->id));
                ret = -ECANCELED;
                goto fail;
        }
        if (test_bit(STATUS_FW_ERROR, &priv->status)) {
-               IWL_DEBUG_INFO("Command %s failed: FW Error\n",
+               IWL_DEBUG_INFO(priv, "Command %s failed: FW Error\n",
                               get_cmd_string(cmd->id));
                ret = -EIO;
                goto fail;
        }
        if ((cmd->meta.flags & CMD_WANT_SKB) && !cmd->meta.u.skb) {
-               IWL_ERROR("Error: Response NULL in '%s'\n",
+               IWL_ERR(priv, "Error: Response NULL in '%s'\n",
                          get_cmd_string(cmd->id));
                ret = -EIO;
                goto cancel;
index ca4f638ab9d0e8f4cd7b26712191c5162961d166..fb64d297dd4eb6e2cefdc68f90bdb4a216495c8f 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
index 0a92e7431adaa023cc6a6916cdf454406c0ca6fc..c7b8e5bb4e427e1d79d0ed229682c887e30780c6 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project.
  *
@@ -66,7 +66,7 @@
 static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv,
                                 u32 ofs, u32 val)
 {
-       IWL_DEBUG_IO("write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
+       IWL_DEBUG_IO(priv, "write32(0x%08X, 0x%08X) - %s %d\n", ofs, val, f, l);
        _iwl_write32(priv, ofs, val);
 }
 #define iwl_write32(priv, ofs, val) \
@@ -79,7 +79,7 @@ static inline void __iwl_write32(const char *f, u32 l, struct iwl_priv *priv,
 #ifdef CONFIG_IWLWIFI_DEBUG
 static inline u32 __iwl_read32(char *f, u32 l, struct iwl_priv *priv, u32 ofs)
 {
-       IWL_DEBUG_IO("read_direct32(0x%08X) - %s %d\n", ofs, f, l);
+       IWL_DEBUG_IO(priv, "read_direct32(0x%08X) - %s %d\n", ofs, f, l);
        return _iwl_read32(priv, ofs);
 }
 #define iwl_read32(priv, ofs) __iwl_read32(__FILE__, __LINE__, priv, ofs)
@@ -108,7 +108,7 @@ static inline int __iwl_poll_bit(const char *f, u32 l,
                                 u32 bits, u32 mask, int timeout)
 {
        int ret = _iwl_poll_bit(priv, addr, bits, mask, timeout);
-       IWL_DEBUG_IO("poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n",
+       IWL_DEBUG_IO(priv, "poll_bit(0x%08X, 0x%08X, 0x%08X) - %s- %s %d\n",
                     addr, bits, mask,
                     unlikely(ret  == -ETIMEDOUT) ? "timeout" : "", f, l);
        return ret;
@@ -128,7 +128,7 @@ static inline void __iwl_set_bit(const char *f, u32 l,
                                 struct iwl_priv *priv, u32 reg, u32 mask)
 {
        u32 val = _iwl_read32(priv, reg) | mask;
-       IWL_DEBUG_IO("set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
+       IWL_DEBUG_IO(priv, "set_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
        _iwl_write32(priv, reg, val);
 }
 #define iwl_set_bit(p, r, m) __iwl_set_bit(__FILE__, __LINE__, p, r, m)
@@ -145,7 +145,7 @@ static inline void __iwl_clear_bit(const char *f, u32 l,
                                   struct iwl_priv *priv, u32 reg, u32 mask)
 {
        u32 val = _iwl_read32(priv, reg) & ~mask;
-       IWL_DEBUG_IO("clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
+       IWL_DEBUG_IO(priv, "clear_bit(0x%08X, 0x%08X) = 0x%08X\n", reg, mask, val);
        _iwl_write32(priv, reg, val);
 }
 #define iwl_clear_bit(p, r, m) __iwl_clear_bit(__FILE__, __LINE__, p, r, m)
@@ -165,9 +165,9 @@ static inline int _iwl_grab_nic_access(struct iwl_priv *priv)
        ret = _iwl_poll_bit(priv, CSR_GP_CNTRL,
                           CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN,
                           (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |
-                           CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 50);
+                           CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP), 15000);
        if (ret < 0) {
-               IWL_ERROR("MAC is in deep sleep!\n");
+               IWL_ERR(priv, "MAC is in deep sleep!\n");
                return -EIO;
        }
 
@@ -182,9 +182,9 @@ static inline int __iwl_grab_nic_access(const char *f, u32 l,
                                               struct iwl_priv *priv)
 {
        if (atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Grabbing access while already held %s %d.\n", f, l);
+               IWL_ERR(priv, "Grabbing access while already held %s %d.\n", f, l);
 
-       IWL_DEBUG_IO("grabbing nic access - %s %d\n", f, l);
+       IWL_DEBUG_IO(priv, "grabbing nic access - %s %d\n", f, l);
        return _iwl_grab_nic_access(priv);
 }
 #define iwl_grab_nic_access(priv) \
@@ -207,9 +207,9 @@ static inline void __iwl_release_nic_access(const char *f, u32 l,
                                            struct iwl_priv *priv)
 {
        if (atomic_read(&priv->restrict_refcnt) <= 0)
-               IWL_ERROR("Release unheld nic access at line %s %d.\n", f, l);
+               IWL_ERR(priv, "Release unheld nic access at line %s %d.\n", f, l);
 
-       IWL_DEBUG_IO("releasing nic access - %s %d\n", f, l);
+       IWL_DEBUG_IO(priv, "releasing nic access - %s %d\n", f, l);
        _iwl_release_nic_access(priv);
 }
 #define iwl_release_nic_access(priv) \
@@ -229,8 +229,8 @@ static inline u32 __iwl_read_direct32(const char *f, u32 l,
 {
        u32 value = _iwl_read_direct32(priv, reg);
        if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from %s %d\n", f, l);
-       IWL_DEBUG_IO("read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value,
+               IWL_ERR(priv, "Nic access not held from %s %d\n", f, l);
+       IWL_DEBUG_IO(priv, "read_direct32(0x%4X) = 0x%08x - %s %d \n", reg, value,
                     f, l);
        return value;
 }
@@ -250,7 +250,7 @@ static void __iwl_write_direct32(const char *f , u32 line,
                                   struct iwl_priv *priv, u32 reg, u32 value)
 {
        if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from %s line %d\n", f, line);
+               IWL_ERR(priv, "Nic access not held from %s line %d\n", f, line);
        _iwl_write_direct32(priv, reg, value);
 }
 #define iwl_write_direct32(priv, reg, value) \
@@ -284,10 +284,10 @@ static inline int __iwl_poll_direct_bit(const char *f, u32 l,
        int ret  = _iwl_poll_direct_bit(priv, addr, mask, timeout);
 
        if (unlikely(ret == -ETIMEDOUT))
-               IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) - "
+               IWL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) - "
                             "timedout - %s %d\n", addr, mask, f, l);
        else
-               IWL_DEBUG_IO("poll_direct_bit(0x%08X, 0x%08X) = 0x%08X "
+               IWL_DEBUG_IO(priv, "poll_direct_bit(0x%08X, 0x%08X) = 0x%08X "
                             "- %s %d\n", addr, mask, ret, f, l);
        return ret;
 }
@@ -308,7 +308,7 @@ static inline u32 __iwl_read_prph(const char *f, u32 line,
                                  struct iwl_priv *priv, u32 reg)
 {
        if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from %s line %d\n", f, line);
+               IWL_ERR(priv, "Nic access not held from %s line %d\n", f, line);
        return _iwl_read_prph(priv, reg);
 }
 
@@ -331,7 +331,7 @@ static inline void __iwl_write_prph(const char *f, u32 line,
                                    struct iwl_priv *priv, u32 addr, u32 val)
 {
        if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from %s line %d\n", f, line);
+               IWL_ERR(priv, "Nic access not held from %s line %d\n", f, line);
        _iwl_write_prph(priv, addr, val);
 }
 
@@ -349,7 +349,7 @@ static inline void __iwl_set_bits_prph(const char *f, u32 line,
                                       u32 reg, u32 mask)
 {
        if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from %s line %d\n", f, line);
+               IWL_ERR(priv, "Nic access not held from %s line %d\n", f, line);
 
        _iwl_set_bits_prph(priv, reg, mask);
 }
@@ -367,7 +367,7 @@ static inline void __iwl_set_bits_mask_prph(const char *f, u32 line,
                struct iwl_priv *priv, u32 reg, u32 bits, u32 mask)
 {
        if (!atomic_read(&priv->restrict_refcnt))
-               IWL_ERROR("Nic access not held from %s line %d\n", f, line);
+               IWL_ERR(priv, "Nic access not held from %s line %d\n", f, line);
        _iwl_set_bits_mask_prph(priv, reg, bits, mask);
 }
 #define iwl_set_bits_mask_prph(priv, reg, bits, mask) \
index 11eccd7d268c2946cc13715ee93160314b8fa48a..19680f72087fc5d84bf100fce29365043689b754 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -123,7 +123,7 @@ static int iwl4965_led_pattern(struct iwl_priv *priv, int led_id,
 /* Set led register off */
 static int iwl4965_led_on_reg(struct iwl_priv *priv, int led_id)
 {
-       IWL_DEBUG_LED("led on %d\n", led_id);
+       IWL_DEBUG_LED(priv, "led on %d\n", led_id);
        iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_ON);
        return 0;
 }
@@ -150,7 +150,7 @@ int iwl4965_led_off(struct iwl_priv *priv, int led_id)
                .off = 0,
                .interval = IWL_DEF_LED_INTRVL
        };
-       IWL_DEBUG_LED("led off %d\n", led_id);
+       IWL_DEBUG_LED(priv, "led off %d\n", led_id);
        return iwl_send_led_cmd(priv, &led_cmd);
 }
 #endif
@@ -159,7 +159,7 @@ int iwl4965_led_off(struct iwl_priv *priv, int led_id)
 /* Set led register off */
 static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id)
 {
-       IWL_DEBUG_LED("LED Reg off\n");
+       IWL_DEBUG_LED(priv, "LED Reg off\n");
        iwl_write32(priv, CSR_LED_REG, CSR_LED_REG_TRUN_OFF);
        return 0;
 }
@@ -169,7 +169,7 @@ static int iwl4965_led_off_reg(struct iwl_priv *priv, int led_id)
  */
 static int iwl_led_associate(struct iwl_priv *priv, int led_id)
 {
-       IWL_DEBUG_LED("Associated\n");
+       IWL_DEBUG_LED(priv, "Associated\n");
        priv->allow_blinking = 1;
        return iwl4965_led_on_reg(priv, led_id);
 }
@@ -213,7 +213,7 @@ static void iwl_led_brightness_set(struct led_classdev *led_cdev,
                return;
 
 
-       IWL_DEBUG_LED("Led type = %s brightness = %d\n",
+       IWL_DEBUG_LED(priv, "Led type = %s brightness = %d\n",
                        led_type_str[led->type], brightness);
        switch (brightness) {
        case LED_FULL:
@@ -254,7 +254,7 @@ static int iwl_leds_register_led(struct iwl_priv *priv, struct iwl_led *led,
 
        ret = led_classdev_register(device, &led->led_dev);
        if (ret) {
-               IWL_ERROR("Error: failed to register led handler.\n");
+               IWL_ERR(priv, "Error: failed to register led handler.\n");
                return ret;
        }
 
@@ -280,7 +280,7 @@ static int iwl_get_blink_rate(struct iwl_priv *priv)
        if (tpt < 0) /* wraparound */
                tpt = -tpt;
 
-       IWL_DEBUG_LED("tpt %lld current_tpt %llu\n",
+       IWL_DEBUG_LED(priv, "tpt %lld current_tpt %llu\n",
                (long long)tpt,
                (unsigned long long)current_tpt);
        priv->led_tpt = current_tpt;
@@ -292,7 +292,7 @@ static int iwl_get_blink_rate(struct iwl_priv *priv)
                        if (tpt  > (blink_tbl[i].tpt * IWL_1MB_RATE))
                                break;
 
-       IWL_DEBUG_LED("LED BLINK IDX=%d\n", i);
+       IWL_DEBUG_LED(priv, "LED BLINK IDX=%d\n", i);
        return i;
 }
 
@@ -352,7 +352,7 @@ int iwl_leds_register(struct iwl_priv *priv)
 
        trigger = ieee80211_get_radio_led_name(priv->hw);
        snprintf(priv->led[IWL_LED_TRG_RADIO].name,
-                sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s:radio",
+                sizeof(priv->led[IWL_LED_TRG_RADIO].name), "iwl-%s::radio",
                 wiphy_name(priv->hw->wiphy));
 
        priv->led[IWL_LED_TRG_RADIO].led_on = iwl4965_led_on_reg;
@@ -366,7 +366,7 @@ int iwl_leds_register(struct iwl_priv *priv)
 
        trigger = ieee80211_get_assoc_led_name(priv->hw);
        snprintf(priv->led[IWL_LED_TRG_ASSOC].name,
-                sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s:assoc",
+                sizeof(priv->led[IWL_LED_TRG_ASSOC].name), "iwl-%s::assoc",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_ASSOC],
@@ -382,7 +382,7 @@ int iwl_leds_register(struct iwl_priv *priv)
 
        trigger = ieee80211_get_rx_led_name(priv->hw);
        snprintf(priv->led[IWL_LED_TRG_RX].name,
-                sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s:RX",
+                sizeof(priv->led[IWL_LED_TRG_RX].name), "iwl-%s::RX",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_RX],
@@ -397,7 +397,7 @@ int iwl_leds_register(struct iwl_priv *priv)
 
        trigger = ieee80211_get_tx_led_name(priv->hw);
        snprintf(priv->led[IWL_LED_TRG_TX].name,
-                sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s:TX",
+                sizeof(priv->led[IWL_LED_TRG_TX].name), "iwl-%s::TX",
                 wiphy_name(priv->hw->wiphy));
 
        ret = iwl_leds_register_led(priv, &priv->led[IWL_LED_TRG_TX],
index 021e00bcd1be1af1fa3296875ae5cba2fbe42365..140fd8fa4855713bed968b01d5162565d632d471 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
 
 struct iwl_priv;
 
-#ifdef CONFIG_IWLWIFI_LEDS
+#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS)
 #include <linux/leds.h>
 
 #define IWL_LED_SOLID 11
 #define IWL_LED_NAME_LEN 31
-#define IWL_DEF_LED_INTRVL __constant_cpu_to_le32(1000)
+#define IWL_DEF_LED_INTRVL cpu_to_le32(1000)
 
 #define IWL_LED_ACTIVITY       (0<<1)
 #define IWL_LED_LINK           (1<<1)
@@ -47,7 +47,9 @@ enum led_type {
        IWL_LED_TRG_RADIO,
        IWL_LED_TRG_MAX,
 };
+#endif
 
+#ifdef CONFIG_IWLWIFI_LEDS
 
 struct iwl_led {
        struct iwl_priv *priv;
index 75ca6a542174fd9ef847697b96605ea00403088a..18b7e4195ea1c77de594b4528eac72159088001c 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2007 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
 #define IWL_POWER_RANGE_1_MAX  (10)
 
 
-#define NOSLP __constant_cpu_to_le16(0), 0, 0
-#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0
-#define SLP_TOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC)
-#define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \
-                                    __constant_cpu_to_le32(X1), \
-                                    __constant_cpu_to_le32(X2), \
-                                    __constant_cpu_to_le32(X3), \
-                                    __constant_cpu_to_le32(X4)}
 
 #define IWL_POWER_ON_BATTERY           IWL_POWER_INDEX_5
 #define IWL_POWER_ON_AC_DISASSOC       IWL_POWER_MODE_CAM
@@ -110,6 +102,7 @@ static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = {
        {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
 };
 
+
 /* set card power command */
 static int iwl_set_power(struct iwl_priv *priv, void *cmd)
 {
@@ -134,13 +127,6 @@ static u16 iwl_get_auto_power_mode(struct iwl_priv *priv)
                else
                        mode = IWL_POWER_ON_AC_DISASSOC;
                break;
-       /* FIXME: remove battery and ac from here */
-       case IWL_POWER_BATTERY:
-               mode = IWL_POWER_INDEX_3;
-               break;
-       case IWL_POWER_AC:
-               mode = IWL_POWER_MODE_CAM;
-               break;
        default:
                mode = priv->power_data.user_power_setting;
                break;
@@ -149,17 +135,17 @@ static u16 iwl_get_auto_power_mode(struct iwl_priv *priv)
 }
 
 /* initialize to default */
-static int iwl_power_init_handle(struct iwl_priv *priv)
+static void iwl_power_init_handle(struct iwl_priv *priv)
 {
        struct iwl_power_mgr *pow_data;
        int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX;
        struct iwl_powertable_cmd *cmd;
        int i;
-       u16 pci_pm;
+       u16 lctl;
 
-       IWL_DEBUG_POWER("Initialize power \n");
+       IWL_DEBUG_POWER(priv, "Initialize power \n");
 
-       pow_data = &(priv->power_data);
+       pow_data = &priv->power_data;
 
        memset(pow_data, 0, sizeof(*pow_data));
 
@@ -167,38 +153,37 @@ static int iwl_power_init_handle(struct iwl_priv *priv)
        memcpy(&pow_data->pwr_range_1[0], &range_1[0], size);
        memcpy(&pow_data->pwr_range_2[0], &range_2[0], size);
 
-       pci_read_config_word(priv->pci_dev, PCI_CFG_LINK_CTRL, &pci_pm);
+       lctl = iwl_pcie_link_ctl(priv);
 
-       IWL_DEBUG_POWER("adjust power command flags\n");
+       IWL_DEBUG_POWER(priv, "adjust power command flags\n");
 
        for (i = 0; i < IWL_POWER_MAX; i++) {
                cmd = &pow_data->pwr_range_0[i].cmd;
 
-               if (pci_pm & PCI_CFG_LINK_CTRL_VAL_L0S_EN)
+               if (lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN)
                        cmd->flags &= ~IWL_POWER_PCI_PM_MSK;
                else
                        cmd->flags |= IWL_POWER_PCI_PM_MSK;
        }
-       return 0;
 }
 
 /* adjust power command according to DTIM period and power level*/
-static int iwl_update_power_command(struct iwl_priv *priv,
-                                   struct iwl_powertable_cmd *cmd,
-                                   u16 mode)
+static int iwl_update_power_cmd(struct iwl_priv *priv,
+                               struct iwl_powertable_cmd *cmd, u16 mode)
 {
-       int ret = 0, i;
-       u8 skip;
-       u32 max_sleep = 0;
        struct iwl_power_vec_entry *range;
-       u8 period = 0;
        struct iwl_power_mgr *pow_data;
+       int i;
+       u32 max_sleep = 0;
+       u8 period;
+       bool skip;
 
        if (mode > IWL_POWER_INDEX_5) {
-               IWL_DEBUG_POWER("Error invalid power mode \n");
-               return -1;
+               IWL_DEBUG_POWER(priv, "Error invalid power mode \n");
+               return -EINVAL;
        }
-       pow_data = &(priv->power_data);
+
+       pow_data = &priv->power_data;
 
        if (pow_data->dtim_period <= IWL_POWER_RANGE_0_MAX)
                range = &pow_data->pwr_range_0[0];
@@ -212,14 +197,12 @@ static int iwl_update_power_command(struct iwl_priv *priv,
 
        if (period == 0) {
                period = 1;
-               skip = 0;
-       } else
-               skip = range[mode].no_dtim;
-
-       if (skip == 0) {
-               max_sleep = period;
-               cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK;
+               skip = false;
        } else {
+               skip = !!range[mode].no_dtim;
+       }
+
+       if (skip) {
                __le32 slp_itrvl = cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1];
                max_sleep = le32_to_cpu(slp_itrvl);
                if (max_sleep == 0xFF)
@@ -227,24 +210,26 @@ static int iwl_update_power_command(struct iwl_priv *priv,
                else if (max_sleep >  period)
                        max_sleep = (le32_to_cpu(slp_itrvl) / period) * period;
                cmd->flags |= IWL_POWER_SLEEP_OVER_DTIM_MSK;
+       } else {
+               max_sleep = period;
+               cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK;
        }
 
-       for (i = 0; i < IWL_POWER_VEC_SIZE; i++) {
+       for (i = 0; i < IWL_POWER_VEC_SIZE; i++)
                if (le32_to_cpu(cmd->sleep_interval[i]) > max_sleep)
                        cmd->sleep_interval[i] = cpu_to_le32(max_sleep);
-       }
 
-       IWL_DEBUG_POWER("Flags value = 0x%08X\n", cmd->flags);
-       IWL_DEBUG_POWER("Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout));
-       IWL_DEBUG_POWER("Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout));
-       IWL_DEBUG_POWER("Sleep interval vector = { %d , %d , %d , %d , %d }\n",
+       IWL_DEBUG_POWER(priv, "Flags value = 0x%08X\n", cmd->flags);
+       IWL_DEBUG_POWER(priv, "Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout));
+       IWL_DEBUG_POWER(priv, "Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout));
+       IWL_DEBUG_POWER(priv, "Sleep interval vector = { %d , %d , %d , %d , %d }\n",
                        le32_to_cpu(cmd->sleep_interval[0]),
                        le32_to_cpu(cmd->sleep_interval[1]),
                        le32_to_cpu(cmd->sleep_interval[2]),
                        le32_to_cpu(cmd->sleep_interval[3]),
                        le32_to_cpu(cmd->sleep_interval[4]));
 
-       return ret;
+       return 0;
 }
 
 
@@ -295,7 +280,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
                if (final_mode != IWL_POWER_MODE_CAM)
                        set_bit(STATUS_POWER_PMI, &priv->status);
 
-               iwl_update_power_command(priv, &cmd, final_mode);
+               iwl_update_power_cmd(priv, &cmd, final_mode);
                cmd.keep_alive_beacons = 0;
 
                if (final_mode == IWL_POWER_INDEX_5)
@@ -311,7 +296,7 @@ int iwl_power_update_mode(struct iwl_priv *priv, bool force)
                if (priv->cfg->ops->lib->update_chain_flags && update_chains)
                        priv->cfg->ops->lib->update_chain_flags(priv);
                else
-                       IWL_DEBUG_POWER("Cannot update the power, chain noise "
+                       IWL_DEBUG_POWER(priv, "Cannot update the power, chain noise "
                                        "calibration running: %d\n",
                                        priv->chain_noise_data.state);
                if (!ret)
@@ -366,7 +351,7 @@ EXPORT_SYMBOL(iwl_power_enable_management);
 /* set user_power_setting */
 int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode)
 {
-       if (mode > IWL_POWER_LIMIT)
+       if (mode > IWL_POWER_MAX)
                return -EINVAL;
 
        priv->power_data.user_power_setting = mode;
@@ -380,11 +365,10 @@ EXPORT_SYMBOL(iwl_power_set_user_mode);
  */
 int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode)
 {
-       if (mode > IWL_POWER_LIMIT)
+       if (mode < IWL_POWER_SYS_MAX)
+               priv->power_data.system_power_setting = mode;
+       else
                return -EINVAL;
-
-       priv->power_data.system_power_setting = mode;
-
        return iwl_power_update_mode(priv, 0);
 }
 EXPORT_SYMBOL(iwl_power_set_system_mode);
@@ -392,13 +376,11 @@ EXPORT_SYMBOL(iwl_power_set_system_mode);
 /* initialize to default */
 void iwl_power_initialize(struct iwl_priv *priv)
 {
-
        iwl_power_init_handle(priv);
        priv->power_data.user_power_setting = IWL_POWER_AUTO;
-       priv->power_data.power_disabled = 0;
        priv->power_data.system_power_setting = IWL_POWER_SYS_AUTO;
-       priv->power_data.is_battery_active = 0;
        priv->power_data.power_disabled = 0;
+       priv->power_data.is_battery_active = 0;
        priv->power_data.critical_power_setting = 0;
 }
 EXPORT_SYMBOL(iwl_power_initialize);
@@ -407,8 +389,8 @@ EXPORT_SYMBOL(iwl_power_initialize);
 int iwl_power_temperature_change(struct iwl_priv *priv)
 {
        int ret = 0;
-       u16 new_critical = priv->power_data.critical_power_setting;
        s32 temperature = KELVIN_TO_CELSIUS(priv->last_temperature);
+       u16 new_critical = priv->power_data.critical_power_setting;
 
        if (temperature > IWL_CT_KILL_TEMPERATURE)
                return 0;
@@ -434,7 +416,7 @@ static void iwl_bg_set_power_save(struct work_struct *work)
 {
        struct iwl_priv *priv = container_of(work,
                                struct iwl_priv, set_power_save.work);
-       IWL_DEBUG(IWL_DL_STATE, "update power\n");
+       IWL_DEBUG_POWER(priv, "update power\n");
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
index fa098d8975cec38d84161e51a1f5db3a9ea006ad..18963392121e9606b258d6764491e72282d1d2e5 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2007 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -42,22 +42,26 @@ enum {
        IWL_POWER_INDEX_5,
        IWL_POWER_AUTO,
        IWL_POWER_MAX = IWL_POWER_AUTO,
-       IWL_POWER_AC,
-       IWL_POWER_BATTERY,
 };
 
 enum {
        IWL_POWER_SYS_AUTO,
        IWL_POWER_SYS_AC,
        IWL_POWER_SYS_BATTERY,
+       IWL_POWER_SYS_MAX,
 };
 
-#define IWL_POWER_LIMIT                0x08
-#define IWL_POWER_MASK         0x0F
-#define IWL_POWER_ENABLED      0x10
 
 /* Power management (not Tx power) structures */
 
+#define NOSLP cpu_to_le16(0), 0, 0
+#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0
+#define SLP_TOUT(T) cpu_to_le32((T) * MSEC_TO_USEC)
+#define SLP_VEC(X0, X1, X2, X3, X4) {cpu_to_le32(X0), \
+                                    cpu_to_le32(X1), \
+                                    cpu_to_le32(X2), \
+                                    cpu_to_le32(X3), \
+                                    cpu_to_le32(X4)}
 struct iwl_power_vec_entry {
        struct iwl_powertable_cmd cmd;
        u8 no_dtim;
index b7a5f23351c303c994a835124d5add570bb99ec6..3b9cac3fd216701e3d8b0e8e62f8bbffe1d53ab7 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -30,7 +30,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2005 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
index 4b69da30665c3b1bd74c93f0dd516aaf4e89809e..2ad9faf1508a702e23462891355abdfc07cf69c7 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -47,7 +47,7 @@ static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state)
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return 0;
 
-       IWL_DEBUG_RF_KILL("we received soft RFKILL set to state %d\n", state);
+       IWL_DEBUG_RF_KILL(priv, "we received soft RFKILL set to state %d\n", state);
        mutex_lock(&priv->mutex);
 
        switch (state) {
@@ -62,7 +62,8 @@ static int iwl_rfkill_soft_rf_kill(void *data, enum rfkill_state state)
                iwl_radio_kill_sw_disable_radio(priv);
                break;
        default:
-               IWL_WARNING("we received unexpected RFKILL state %d\n", state);
+               IWL_WARN(priv, "we received unexpected RFKILL state %d\n",
+                       state);
                break;
        }
 out_unlock:
@@ -78,10 +79,10 @@ int iwl_rfkill_init(struct iwl_priv *priv)
 
        BUG_ON(device == NULL);
 
-       IWL_DEBUG_RF_KILL("Initializing RFKILL.\n");
+       IWL_DEBUG_RF_KILL(priv, "Initializing RFKILL.\n");
        priv->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN);
        if (!priv->rfkill) {
-               IWL_ERROR("Unable to allocate RFKILL device.\n");
+               IWL_ERR(priv, "Unable to allocate RFKILL device.\n");
                ret = -ENOMEM;
                goto error;
        }
@@ -97,11 +98,11 @@ int iwl_rfkill_init(struct iwl_priv *priv)
 
        ret = rfkill_register(priv->rfkill);
        if (ret) {
-               IWL_ERROR("Unable to register RFKILL: %d\n", ret);
+               IWL_ERR(priv, "Unable to register RFKILL: %d\n", ret);
                goto free_rfkill;
        }
 
-       IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n");
+       IWL_DEBUG_RF_KILL(priv, "RFKILL initialization complete.\n");
        return ret;
 
 free_rfkill:
@@ -110,7 +111,7 @@ free_rfkill:
        priv->rfkill = NULL;
 
 error:
-       IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n");
+       IWL_DEBUG_RF_KILL(priv, "RFKILL initialization complete.\n");
        return ret;
 }
 EXPORT_SYMBOL(iwl_rfkill_init);
index 86dc055a2e9400cf684ea212935789309c6ffa60..633dafb4bf1bac7b5126bd742418b7e802767f3e 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2007 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2007 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
index c5f1aa0feac8c49ecb635e44b7b89e1c98681158..8f65908f66f1498f4e1c1ca3b3414815b1e75e22 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -125,9 +125,10 @@ EXPORT_SYMBOL(iwl_rx_queue_space);
  */
 int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)
 {
-       u32 reg = 0;
-       int ret = 0;
        unsigned long flags;
+       u32 rx_wrt_ptr_reg = priv->hw_params.rx_wrt_ptr_reg;
+       u32 reg;
+       int ret = 0;
 
        spin_lock_irqsave(&q->lock, flags);
 
@@ -149,15 +150,14 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)
                        goto exit_unlock;
 
                /* Device expects a multiple of 8 */
-               iwl_write_direct32(priv, FH_RSCSR_CHNL0_WPTR,
-                                    q->write & ~0x7);
+               iwl_write_direct32(priv, rx_wrt_ptr_reg, q->write & ~0x7);
                iwl_release_nic_access(priv);
 
        /* Else device is assumed to be awake */
-       } else
+       } else {
                /* Device expects a multiple of 8 */
-               iwl_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7);
-
+               iwl_write32(priv, rx_wrt_ptr_reg, q->write & ~0x7);
+       }
 
        q->need_update = 0;
 
@@ -262,8 +262,7 @@ void iwl_rx_allocate(struct iwl_priv *priv)
                rxb->skb = alloc_skb(priv->hw_params.rx_buf_size + 256,
                                     GFP_KERNEL);
                if (!rxb->skb) {
-                       printk(KERN_CRIT DRV_NAME
-                                  "Can not allocate SKB buffers\n");
+                       IWL_CRIT(priv, "Can not allocate SKB buffers\n");
                        /* We don't reschedule replenish work here -- we will
                         * call the restock method and if it still needs
                         * more buffers it will schedule replenish */
@@ -495,7 +494,7 @@ void iwl_rx_missed_beacon_notif(struct iwl_priv *priv,
 
        missed_beacon = &pkt->u.missed_beacon;
        if (le32_to_cpu(missed_beacon->consequtive_missed_beacons) > 5) {
-               IWL_DEBUG_CALIB("missed bcn cnsq %d totl %d rcd %d expctd %d\n",
+               IWL_DEBUG_CALIB(priv, "missed bcn cnsq %d totl %d rcd %d expctd %d\n",
                    le32_to_cpu(missed_beacon->consequtive_missed_beacons),
                    le32_to_cpu(missed_beacon->total_missed_becons),
                    le32_to_cpu(missed_beacon->num_recvd_beacons),
@@ -542,7 +541,7 @@ static void iwl_rx_calc_noise(struct iwl_priv *priv)
        else
                priv->last_rx_noise = IWL_NOISE_MEAS_NOT_AVAILABLE;
 
-       IWL_DEBUG_CALIB("inband silence a %u, b %u, c %u, dBm %d\n",
+       IWL_DEBUG_CALIB(priv, "inband silence a %u, b %u, c %u, dBm %d\n",
                        bcn_silence_a, bcn_silence_b, bcn_silence_c,
                        priv->last_rx_noise);
 }
@@ -555,7 +554,7 @@ void iwl_rx_statistics(struct iwl_priv *priv,
        int change;
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
 
-       IWL_DEBUG_RX("Statistics notification received (%d vs %d).\n",
+       IWL_DEBUG_RX(priv, "Statistics notification received (%d vs %d).\n",
                     (int)sizeof(priv->statistics), pkt->len);
 
        change = ((priv->statistics.general.temperature !=
@@ -742,13 +741,13 @@ static void iwl_dbg_report_frame(struct iwl_priv *priv,
                 * MAC addresses show just the last byte (for brevity),
                 *    but you can hack it to show more, if you'd like to. */
                if (dataframe)
-                       IWL_DEBUG_RX("%s: mhd=0x%04x, dst=0x%02x, "
+                       IWL_DEBUG_RX(priv, "%s: mhd=0x%04x, dst=0x%02x, "
                                     "len=%u, rssi=%d, chnl=%d, rate=%u, \n",
                                     title, le16_to_cpu(fc), header->addr1[5],
                                     length, rssi, channel, bitrate);
                else {
                        /* src/dst addresses assume managed mode */
-                       IWL_DEBUG_RX("%s: 0x%04x, dst=0x%02x, src=0x%02x, "
+                       IWL_DEBUG_RX(priv, "%s: 0x%04x, dst=0x%02x, src=0x%02x, "
                                     "len=%u, rssi=%d, tim=%lu usec, "
                                     "phy=0x%02x, chnl=%d\n",
                                     title, le16_to_cpu(fc), header->addr1[5],
@@ -773,10 +772,10 @@ static void iwl_update_rx_stats(struct iwl_priv *priv, u16 fc, u16 len)
 /*
  * returns non-zero if packet should be dropped
  */
-static int iwl_set_decrypted_flag(struct iwl_priv *priv,
-                                     struct ieee80211_hdr *hdr,
-                                     u32 decrypt_res,
-                                     struct ieee80211_rx_status *stats)
+int iwl_set_decrypted_flag(struct iwl_priv *priv,
+                          struct ieee80211_hdr *hdr,
+                          u32 decrypt_res,
+                          struct ieee80211_rx_status *stats)
 {
        u16 fc = le16_to_cpu(hdr->frame_control);
 
@@ -786,7 +785,7 @@ static int iwl_set_decrypted_flag(struct iwl_priv *priv,
        if (!(fc & IEEE80211_FCTL_PROTECTED))
                return 0;
 
-       IWL_DEBUG_RX("decrypt_res:0x%x\n", decrypt_res);
+       IWL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res);
        switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) {
        case RX_RES_STATUS_SEC_TYPE_TKIP:
                /* The uCode has got a bad phase 1 Key, pushes the packet.
@@ -800,13 +799,13 @@ static int iwl_set_decrypted_flag(struct iwl_priv *priv,
                    RX_RES_STATUS_BAD_ICV_MIC) {
                        /* bad ICV, the packet is destroyed since the
                         * decryption is inplace, drop it */
-                       IWL_DEBUG_RX("Packet destroyed\n");
+                       IWL_DEBUG_RX(priv, "Packet destroyed\n");
                        return -1;
                }
        case RX_RES_STATUS_SEC_TYPE_CCMP:
                if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
                    RX_RES_STATUS_DECRYPT_OK) {
-                       IWL_DEBUG_RX("hw decrypt successfully!!!\n");
+                       IWL_DEBUG_RX(priv, "hw decrypt successfully!!!\n");
                        stats->flag |= RX_FLAG_DECRYPTED;
                }
                break;
@@ -816,6 +815,7 @@ static int iwl_set_decrypted_flag(struct iwl_priv *priv,
        }
        return 0;
 }
+EXPORT_SYMBOL(iwl_set_decrypted_flag);
 
 static u32 iwl_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
 {
@@ -870,7 +870,7 @@ static u32 iwl_translate_rx_status(struct iwl_priv *priv, u32 decrypt_in)
                break;
        };
 
-       IWL_DEBUG_RX("decrypt_in:0x%x  decrypt_out = 0x%x\n",
+       IWL_DEBUG_RX(priv, "decrypt_in:0x%x  decrypt_out = 0x%x\n",
                                        decrypt_in, decrypt_out);
 
        return decrypt_out;
@@ -895,7 +895,7 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
                rx_start = (struct iwl_rx_phy_res *)&priv->last_phy_res[1];
 
        if (!rx_start) {
-               IWL_ERROR("MPDU frame without a PHY data\n");
+               IWL_ERR(priv, "MPDU frame without a PHY data\n");
                return;
        }
        if (include_phy) {
@@ -934,8 +934,8 @@ static void iwl_pass_packet_to_mac80211(struct iwl_priv *priv,
 
        /* We only process data packets if the interface is open */
        if (unlikely(!priv->is_open)) {
-               IWL_DEBUG_DROP_LIMIT
-                   ("Dropping packet while interface is not open.\n");
+               IWL_DEBUG_DROP_LIMIT(priv,
+                   "Dropping packet while interface is not open.\n");
                return;
        }
 
@@ -1007,7 +1007,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
        /*rx_status.flag |= RX_FLAG_TSFT;*/
 
        if ((unlikely(rx_start->cfg_phy_cnt > 20))) {
-               IWL_DEBUG_DROP("dsp size out of range [0,20]: %d/n",
+               IWL_DEBUG_DROP(priv, "dsp size out of range [0,20]: %d/n",
                                rx_start->cfg_phy_cnt);
                return;
        }
@@ -1021,7 +1021,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
        }
 
        if (!rx_start) {
-               IWL_ERROR("MPDU frame without a PHY data\n");
+               IWL_ERR(priv, "MPDU frame without a PHY data\n");
                return;
        }
 
@@ -1045,7 +1045,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
 
        if (!(*rx_end & RX_RES_STATUS_NO_CRC32_ERROR) ||
            !(*rx_end & RX_RES_STATUS_NO_RXE_OVERFLOW)) {
-               IWL_DEBUG_RX("Bad CRC or FIFO: 0x%08X.\n",
+               IWL_DEBUG_RX(priv, "Bad CRC or FIFO: 0x%08X.\n",
                                le32_to_cpu(*rx_end));
                return;
        }
@@ -1078,7 +1078,7 @@ void iwl_rx_reply_rx(struct iwl_priv *priv,
        if (unlikely(priv->debug_level & IWL_DL_RX))
                iwl_dbg_report_frame(priv, rx_start, len, header, 1);
 #endif
-       IWL_DEBUG_STATS_LIMIT("Rssi %d, noise %d, qual %d, TSF %llu\n",
+       IWL_DEBUG_STATS_LIMIT(priv, "Rssi %d, noise %d, qual %d, TSF %llu\n",
                rx_status.signal, rx_status.noise, rx_status.signal,
                (unsigned long long)rx_status.mactime);
 
index 3c803f6922efe0a03c498fe2efc53c78c4db5c50..1ec2b20eb37c27f245a850442e1433a524752f74 100644 (file)
@@ -2,7 +2,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2008 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
 #define IWL_ACTIVE_DWELL_FACTOR_24GHZ (3)
 #define IWL_ACTIVE_DWELL_FACTOR_52GHZ (2)
 
-/* For faster active scanning, scan will move to the next channel if fewer than
- * PLCP_QUIET_THRESH packets are heard on this channel within
- * ACTIVE_QUIET_TIME after sending probe request.  This shortens the dwell
- * time if it's a quiet channel (nothing responded to our probe, and there's
- * no other traffic).
- * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */
-#define IWL_PLCP_QUIET_THRESH       __constant_cpu_to_le16(1)  /* packets */
-#define IWL_ACTIVE_QUIET_TIME       __constant_cpu_to_le16(10)  /* msec */
-
 /* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel.
  * Must be set longer than active dwell time.
  * For the most reliable scan, set > AP beacon interval (typically 100msec). */
@@ -63,7 +54,6 @@
 #define IWL_PASSIVE_DWELL_BASE      (100)
 #define IWL_CHANNEL_TUNE_TIME       5
 
-#define IWL_SCAN_PROBE_MASK(n)         cpu_to_le32((BIT(n) | (BIT(n) - BIT(1))))
 
 
 /**
@@ -80,12 +70,12 @@ int iwl_scan_cancel(struct iwl_priv *priv)
 
        if (test_bit(STATUS_SCANNING, &priv->status)) {
                if (!test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-                       IWL_DEBUG_SCAN("Queuing scan abort.\n");
+                       IWL_DEBUG_SCAN(priv, "Queuing scan abort.\n");
                        set_bit(STATUS_SCAN_ABORTING, &priv->status);
                        queue_work(priv->workqueue, &priv->abort_scan);
 
                } else
-                       IWL_DEBUG_SCAN("Scan abort already in progress.\n");
+                       IWL_DEBUG_SCAN(priv, "Scan abort already in progress.\n");
 
                return test_bit(STATUS_SCANNING, &priv->status);
        }
@@ -119,7 +109,7 @@ int iwl_scan_cancel_timeout(struct iwl_priv *priv, unsigned long ms)
 }
 EXPORT_SYMBOL(iwl_scan_cancel_timeout);
 
-static int iwl_send_scan_abort(struct iwl_priv *priv)
+int iwl_send_scan_abort(struct iwl_priv *priv)
 {
        int ret = 0;
        struct iwl_rx_packet *res;
@@ -150,7 +140,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
                 * can occur if we send the scan abort before we
                 * the microcode has notified us that a scan is
                 * completed. */
-               IWL_DEBUG_INFO("SCAN_ABORT returned %d.\n", res->u.status);
+               IWL_DEBUG_INFO(priv, "SCAN_ABORT returned %d.\n", res->u.status);
                clear_bit(STATUS_SCAN_ABORTING, &priv->status);
                clear_bit(STATUS_SCAN_HW, &priv->status);
        }
@@ -160,7 +150,7 @@ static int iwl_send_scan_abort(struct iwl_priv *priv)
 
        return ret;
 }
-
+EXPORT_SYMBOL(iwl_send_scan_abort);
 
 /* Service response to REPLY_SCAN_CMD (0x80) */
 static void iwl_rx_reply_scan(struct iwl_priv *priv,
@@ -171,7 +161,7 @@ static void iwl_rx_reply_scan(struct iwl_priv *priv,
        struct iwl_scanreq_notification *notif =
            (struct iwl_scanreq_notification *)pkt->u.raw;
 
-       IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status);
+       IWL_DEBUG_RX(priv, "Scan request status = 0x%x\n", notif->status);
 #endif
 }
 
@@ -183,7 +173,7 @@ static void iwl_rx_scan_start_notif(struct iwl_priv *priv,
        struct iwl_scanstart_notification *notif =
            (struct iwl_scanstart_notification *)pkt->u.raw;
        priv->scan_start_tsf = le32_to_cpu(notif->tsf_low);
-       IWL_DEBUG_SCAN("Scan start: "
+       IWL_DEBUG_SCAN(priv, "Scan start: "
                       "%d [802.11%s] "
                       "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n",
                       notif->channel,
@@ -202,7 +192,7 @@ static void iwl_rx_scan_results_notif(struct iwl_priv *priv,
        struct iwl_scanresults_notification *notif =
            (struct iwl_scanresults_notification *)pkt->u.raw;
 
-       IWL_DEBUG_SCAN("Scan ch.res: "
+       IWL_DEBUG_SCAN(priv, "Scan ch.res: "
                       "%d [802.11%s] "
                       "(TSF: 0x%08X:%08X) - %d "
                       "elapsed=%lu usec (%dms since last)\n",
@@ -228,7 +218,7 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
        struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
        struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
 
-       IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
+       IWL_DEBUG_SCAN(priv, "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
                       scan_notif->scanned_channels,
                       scan_notif->tsf_low,
                       scan_notif->tsf_high, scan_notif->status);
@@ -240,7 +230,7 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
        /* The scan completion notification came in, so kill that timer... */
        cancel_delayed_work(&priv->scan_check);
 
-       IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n",
+       IWL_DEBUG_INFO(priv, "Scan pass on %sGHz took %dms\n",
                       (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ?
                                                "2.4" : "5.2",
                       jiffies_to_msecs(elapsed_jiffies
@@ -258,7 +248,7 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
         * then we reset the scan state machine and terminate,
         * re-queuing another scan if one has been requested */
        if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG_INFO("Aborted scan completed.\n");
+               IWL_DEBUG_INFO(priv, "Aborted scan completed.\n");
                clear_bit(STATUS_SCAN_ABORTING, &priv->status);
        } else {
                /* If there are more bands on this scan pass reschedule */
@@ -268,11 +258,11 @@ static void iwl_rx_scan_complete_notif(struct iwl_priv *priv,
 
        priv->last_scan_jiffies = jiffies;
        priv->next_scan_jiffies = 0;
-       IWL_DEBUG_INFO("Setting scan to off\n");
+       IWL_DEBUG_INFO(priv, "Setting scan to off\n");
 
        clear_bit(STATUS_SCANNING, &priv->status);
 
-       IWL_DEBUG_INFO("Scan took %dms\n",
+       IWL_DEBUG_INFO(priv, "Scan took %dms\n",
                jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies)));
 
        queue_work(priv->workqueue, &priv->scan_completed);
@@ -296,9 +286,9 @@ void iwl_setup_rx_scan_handlers(struct iwl_priv *priv)
 }
 EXPORT_SYMBOL(iwl_setup_rx_scan_handlers);
 
-static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv,
-                                           enum ieee80211_band band,
-                                           u8 n_probes)
+inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv,
+                                    enum ieee80211_band band,
+                                    u8 n_probes)
 {
        if (band == IEEE80211_BAND_5GHZ)
                return IWL_ACTIVE_DWELL_TIME_52 +
@@ -307,9 +297,10 @@ static inline u16 iwl_get_active_dwell_time(struct iwl_priv *priv,
                return IWL_ACTIVE_DWELL_TIME_24 +
                        IWL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1);
 }
+EXPORT_SYMBOL(iwl_get_active_dwell_time);
 
-static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
-                                     enum ieee80211_band band)
+u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
+                              enum ieee80211_band band)
 {
        u16 passive = (band == IEEE80211_BAND_2GHZ) ?
            IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
@@ -327,6 +318,7 @@ static u16 iwl_get_passive_dwell_time(struct iwl_priv *priv,
 
        return passive;
 }
+EXPORT_SYMBOL(iwl_get_passive_dwell_time);
 
 static int iwl_get_channels_for_scan(struct iwl_priv *priv,
                                     enum ieee80211_band band,
@@ -363,7 +355,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
 
                ch_info = iwl_get_channel_info(priv, band, channel);
                if (!is_channel_valid(ch_info)) {
-                       IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n",
+                       IWL_DEBUG_SCAN(priv, "Channel %d is INVALID for this band.\n",
                                        channel);
                        continue;
                }
@@ -392,7 +384,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
                else
                        scan_ch->tx_gain = ((1 << 5) | (5 << 3));
 
-               IWL_DEBUG_SCAN("Scanning ch=%d prob=0x%X [%s %d]\n",
+               IWL_DEBUG_SCAN(priv, "Scanning ch=%d prob=0x%X [%s %d]\n",
                               channel, le32_to_cpu(scan_ch->type),
                               (scan_ch->type & SCAN_CHANNEL_TYPE_ACTIVE) ?
                                "ACTIVE" : "PASSIVE",
@@ -403,7 +395,7 @@ static int iwl_get_channels_for_scan(struct iwl_priv *priv,
                added++;
        }
 
-       IWL_DEBUG_SCAN("total channels to scan %d \n", added);
+       IWL_DEBUG_SCAN(priv, "total channels to scan %d \n", added);
        return added;
 }
 
@@ -419,21 +411,21 @@ void iwl_init_scan_params(struct iwl_priv *priv)
 int iwl_scan_initiate(struct iwl_priv *priv)
 {
        if (!iwl_is_ready_rf(priv)) {
-               IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
+               IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n");
                return -EIO;
        }
 
        if (test_bit(STATUS_SCANNING, &priv->status)) {
-               IWL_DEBUG_SCAN("Scan already in progress.\n");
+               IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
                return -EAGAIN;
        }
 
        if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG_SCAN("Scan request while abort pending\n");
+               IWL_DEBUG_SCAN(priv, "Scan request while abort pending\n");
                return -EAGAIN;
        }
 
-       IWL_DEBUG_INFO("Starting scan...\n");
+       IWL_DEBUG_INFO(priv, "Starting scan...\n");
        if (priv->cfg->sku & IWL_SKU_G)
                priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
        if (priv->cfg->sku & IWL_SKU_A)
@@ -450,7 +442,7 @@ EXPORT_SYMBOL(iwl_scan_initiate);
 
 #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
 
-static void iwl_bg_scan_check(struct work_struct *data)
+void iwl_bg_scan_check(struct work_struct *data)
 {
        struct iwl_priv *priv =
            container_of(data, struct iwl_priv, scan_check.work);
@@ -461,7 +453,7 @@ static void iwl_bg_scan_check(struct work_struct *data)
        mutex_lock(&priv->mutex);
        if (test_bit(STATUS_SCANNING, &priv->status) ||
            test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG(IWL_DL_SCAN, "Scan completion watchdog resetting "
+               IWL_DEBUG_SCAN(priv, "Scan completion watchdog resetting "
                        "adapter (%dms)\n",
                        jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
 
@@ -470,6 +462,8 @@ static void iwl_bg_scan_check(struct work_struct *data)
        }
        mutex_unlock(&priv->mutex);
 }
+EXPORT_SYMBOL(iwl_bg_scan_check);
+
 /**
  * iwl_supported_rate_to_ie - fill in the supported rate in IE field
  *
@@ -527,10 +521,10 @@ static void iwl_ht_cap_to_ie(const struct ieee80211_supported_band *sband,
  * iwl_fill_probe_req - fill in all required fields and IE for probe request
  */
 
-static u16 iwl_fill_probe_req(struct iwl_priv *priv,
-                                 enum ieee80211_band band,
-                                 struct ieee80211_mgmt *frame,
-                                 int left)
+u16 iwl_fill_probe_req(struct iwl_priv *priv,
+                      enum ieee80211_band band,
+                      struct ieee80211_mgmt *frame,
+                      int left)
 {
        int len = 0;
        u8 *pos = NULL;
@@ -624,6 +618,7 @@ static u16 iwl_fill_probe_req(struct iwl_priv *priv,
 
        return (u16)len;
 }
+EXPORT_SYMBOL(iwl_fill_probe_req);
 
 static void iwl_bg_request_scan(struct work_struct *data)
 {
@@ -650,7 +645,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
        mutex_lock(&priv->mutex);
 
        if (!iwl_is_ready(priv)) {
-               IWL_WARNING("request scan called when driver not ready.\n");
+               IWL_WARN(priv, "request scan called when driver not ready.\n");
                goto done;
        }
 
@@ -662,34 +657,34 @@ static void iwl_bg_request_scan(struct work_struct *data)
        /* This should never be called or scheduled if there is currently
         * a scan active in the hardware. */
        if (test_bit(STATUS_SCAN_HW, &priv->status)) {
-               IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. "
+               IWL_DEBUG_INFO(priv, "Multiple concurrent scan requests in parallel. "
                               "Ignoring second request.\n");
                ret = -EIO;
                goto done;
        }
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-               IWL_DEBUG_SCAN("Aborting scan due to device shutdown\n");
+               IWL_DEBUG_SCAN(priv, "Aborting scan due to device shutdown\n");
                goto done;
        }
 
        if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG_HC("Scan request while abort pending.  Queuing.\n");
+               IWL_DEBUG_HC(priv, "Scan request while abort pending.  Queuing.\n");
                goto done;
        }
 
        if (iwl_is_rfkill(priv)) {
-               IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n");
+               IWL_DEBUG_HC(priv, "Aborting scan due to RF Kill activation\n");
                goto done;
        }
 
        if (!test_bit(STATUS_READY, &priv->status)) {
-               IWL_DEBUG_HC("Scan request while uninitialized.  Queuing.\n");
+               IWL_DEBUG_HC(priv, "Scan request while uninitialized.  Queuing.\n");
                goto done;
        }
 
        if (!priv->scan_bands) {
-               IWL_DEBUG_HC("Aborting scan due to no requested bands\n");
+               IWL_DEBUG_HC(priv, "Aborting scan due to no requested bands\n");
                goto done;
        }
 
@@ -714,7 +709,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
                u32 scan_suspend_time = 100;
                unsigned long flags;
 
-               IWL_DEBUG_INFO("Scanning while associated...\n");
+               IWL_DEBUG_INFO(priv, "Scanning while associated...\n");
 
                spin_lock_irqsave(&priv->lock, flags);
                interval = priv->beacon_int;
@@ -729,13 +724,13 @@ static void iwl_bg_request_scan(struct work_struct *data)
                scan_suspend_time = (extra |
                    ((suspend_time % interval) * 1024));
                scan->suspend_time = cpu_to_le32(scan_suspend_time);
-               IWL_DEBUG_SCAN("suspend_time 0x%X beacon interval %d\n",
+               IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
                               scan_suspend_time, interval);
        }
 
        /* We should add the ability for user to lock to PASSIVE ONLY */
        if (priv->one_direct_scan) {
-               IWL_DEBUG_SCAN("Start direct scan for '%s'\n",
+               IWL_DEBUG_SCAN(priv, "Start direct scan for '%s'\n",
                                print_ssid(ssid, priv->direct_ssid,
                                           priv->direct_ssid_len));
                scan->direct_scan[0].id = WLAN_EID_SSID;
@@ -744,7 +739,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
                       priv->direct_ssid, priv->direct_ssid_len);
                n_probes++;
        } else {
-               IWL_DEBUG_SCAN("Start indirect scan.\n");
+               IWL_DEBUG_SCAN(priv, "Start indirect scan.\n");
        }
 
        scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
@@ -773,7 +768,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
                if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)
                        rx_chain = 0x6;
        } else {
-               IWL_WARNING("Invalid scan band count\n");
+               IWL_WARN(priv, "Invalid scan band count\n");
                goto done;
        }
 
@@ -806,7 +801,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
                        (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
 
        if (scan->channel_count == 0) {
-               IWL_DEBUG_SCAN("channel count %d\n", scan->channel_count);
+               IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
                goto done;
        }
 
@@ -839,7 +834,7 @@ static void iwl_bg_request_scan(struct work_struct *data)
        mutex_unlock(&priv->mutex);
 }
 
-static void iwl_bg_abort_scan(struct work_struct *work)
+void iwl_bg_abort_scan(struct work_struct *work)
 {
        struct iwl_priv *priv = container_of(work, struct iwl_priv, abort_scan);
 
@@ -853,18 +848,19 @@ static void iwl_bg_abort_scan(struct work_struct *work)
 
        mutex_unlock(&priv->mutex);
 }
+EXPORT_SYMBOL(iwl_bg_abort_scan);
 
-static void iwl_bg_scan_completed(struct work_struct *work)
+void iwl_bg_scan_completed(struct work_struct *work)
 {
        struct iwl_priv *priv =
            container_of(work, struct iwl_priv, scan_completed);
 
-       IWL_DEBUG_SCAN("SCAN complete scan\n");
+       IWL_DEBUG_SCAN(priv, "SCAN complete scan\n");
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
 
-       ieee80211_scan_completed(priv->hw);
+       ieee80211_scan_completed(priv->hw, false);
 
        /* Since setting the TXPOWER may have been deferred while
         * performing the scan, fire one off */
@@ -872,7 +868,7 @@ static void iwl_bg_scan_completed(struct work_struct *work)
        iwl_set_tx_power(priv, priv->tx_power_user_lmt, true);
        mutex_unlock(&priv->mutex);
 }
-
+EXPORT_SYMBOL(iwl_bg_scan_completed);
 
 void iwl_setup_scan_deferred_work(struct iwl_priv *priv)
 {
index 836c3c80b69ebbe712a9bd09c6cb3596eb2c1d95..022bcf115731858bdbe0b25d7bfaf78914174e50 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -146,7 +146,7 @@ static int iwl_get_measurement(struct iwl_priv *priv,
 
        res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n");
+               IWL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n");
                rc = -EIO;
        }
 
@@ -154,9 +154,9 @@ static int iwl_get_measurement(struct iwl_priv *priv,
        switch (spectrum_resp_status) {
        case 0:         /* Command will be handled */
                if (res->u.spectrum.id != 0xff) {
-                       IWL_DEBUG_INFO
-                           ("Replaced existing measurement: %d\n",
-                            res->u.spectrum.id);
+                       IWL_DEBUG_INFO(priv,
+                               "Replaced existing measurement: %d\n",
+                               res->u.spectrum.id);
                        priv->measurement_status &= ~MEASUREMENT_READY;
                }
                priv->measurement_status |= MEASUREMENT_ACTIVE;
@@ -181,7 +181,7 @@ static void iwl_rx_spectrum_measure_notif(struct iwl_priv *priv,
        struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif);
 
        if (!report->state) {
-               IWL_DEBUG(IWL_DL_11H,
+               IWL_DEBUG_11H(priv,
                        "Spectrum Measure Notification: Start\n");
                return;
        }
index b7d7943e476b055ad7d6204b0fbd8f3ad7e342e5..a77c1e6190623bd536e287a2a762b5b464ee0ffa 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ieee80211 subsystem header files.
  *
index 70a8b21ca39b91216fe0c535a06021dfd9e30d2a..1fae3a6bd8d56f15dc1ec351f081852cc390a3c3 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -60,7 +60,7 @@ u8 iwl_find_station(struct iwl_priv *priv, const u8 *addr)
                        goto out;
                }
 
-       IWL_DEBUG_ASSOC_LIMIT("can not find STA %pM total %d\n",
+       IWL_DEBUG_ASSOC_LIMIT(priv, "can not find STA %pM total %d\n",
                              addr, priv->num_stations);
 
  out:
@@ -86,11 +86,13 @@ static void iwl_sta_ucode_activate(struct iwl_priv *priv, u8 sta_id)
 
        spin_lock_irqsave(&priv->sta_lock, flags);
 
-       if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE))
-               IWL_ERROR("ACTIVATE a non DRIVER active station %d\n", sta_id);
+       if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE) &&
+           !(priv->stations_39[sta_id].used & IWL_STA_DRIVER_ACTIVE))
+               IWL_ERR(priv, "ACTIVATE a non DRIVER active station %d\n",
+                       sta_id);
 
        priv->stations[sta_id].used |= IWL_STA_UCODE_ACTIVE;
-       IWL_DEBUG_ASSOC("Added STA to Ucode: %pM\n",
+       IWL_DEBUG_ASSOC(priv, "Added STA to Ucode: %pM\n",
                        priv->stations[sta_id].sta.sta.addr);
 
        spin_unlock_irqrestore(&priv->sta_lock, flags);
@@ -105,13 +107,13 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
        u8 sta_id = addsta->sta.sta_id;
 
        if (!skb) {
-               IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
+               IWL_ERR(priv, "Error: Response NULL in REPLY_ADD_STA.\n");
                return 1;
        }
 
        res = (struct iwl_rx_packet *)skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
+               IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
                          res->hdr.flags);
                return 1;
        }
@@ -121,7 +123,7 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
                iwl_sta_ucode_activate(priv, sta_id);
                 /* fall through */
        default:
-               IWL_DEBUG_HC("Received REPLY_ADD_STA:(0x%08X)\n",
+               IWL_DEBUG_HC(priv, "Received REPLY_ADD_STA:(0x%08X)\n",
                             res->u.add_sta.status);
                break;
        }
@@ -130,7 +132,7 @@ static int iwl_add_sta_callback(struct iwl_priv *priv,
        return 1;
 }
 
-static int iwl_send_add_sta(struct iwl_priv *priv,
+int iwl_send_add_sta(struct iwl_priv *priv,
                     struct iwl_addsta_cmd *sta, u8 flags)
 {
        struct iwl_rx_packet *res = NULL;
@@ -155,7 +157,7 @@ static int iwl_send_add_sta(struct iwl_priv *priv,
 
        res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
+               IWL_ERR(priv, "Bad return from REPLY_ADD_STA (0x%08X)\n",
                          res->hdr.flags);
                ret = -EIO;
        }
@@ -164,11 +166,11 @@ static int iwl_send_add_sta(struct iwl_priv *priv,
                switch (res->u.add_sta.status) {
                case ADD_STA_SUCCESS_MSK:
                        iwl_sta_ucode_activate(priv, sta->sta.sta_id);
-                       IWL_DEBUG_INFO("REPLY_ADD_STA PASSED\n");
+                       IWL_DEBUG_INFO(priv, "REPLY_ADD_STA PASSED\n");
                        break;
                default:
                        ret = -EIO;
-                       IWL_WARNING("REPLY_ADD_STA failed\n");
+                       IWL_WARN(priv, "REPLY_ADD_STA failed\n");
                        break;
                }
        }
@@ -178,6 +180,7 @@ static int iwl_send_add_sta(struct iwl_priv *priv,
 
        return ret;
 }
+EXPORT_SYMBOL(iwl_send_add_sta);
 
 static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
                                   struct ieee80211_sta_ht_cap *sta_ht_inf)
@@ -204,7 +207,7 @@ static void iwl_set_ht_add_station(struct iwl_priv *priv, u8 index,
        case WLAN_HT_CAP_SM_PS_DISABLED:
                break;
        default:
-               IWL_WARNING("Invalid MIMO PS mode %d\n", mimo_ps_mode);
+               IWL_WARN(priv, "Invalid MIMO PS mode %d\n", mimo_ps_mode);
                break;
        }
 
@@ -269,7 +272,7 @@ u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
 
        station = &priv->stations[sta_id];
        station->used = IWL_STA_DRIVER_ACTIVE;
-       IWL_DEBUG_ASSOC("Add STA to driver ID %d: %pM\n",
+       IWL_DEBUG_ASSOC(priv, "Add STA to driver ID %d: %pM\n",
                        sta_id, addr);
        priv->num_stations++;
 
@@ -301,13 +304,13 @@ static void iwl_sta_ucode_deactivate(struct iwl_priv *priv, const char *addr)
 
        BUG_ON(sta_id == IWL_INVALID_STATION);
 
-       IWL_DEBUG_ASSOC("Removed STA from Ucode: %pM\n", addr);
+       IWL_DEBUG_ASSOC(priv, "Removed STA from Ucode: %pM\n", addr);
 
        spin_lock_irqsave(&priv->sta_lock, flags);
 
        /* Ucode must be active and driver must be non active */
        if (priv->stations[sta_id].used != IWL_STA_UCODE_ACTIVE)
-               IWL_ERROR("removed non active STA %d\n", sta_id);
+               IWL_ERR(priv, "removed non active STA %d\n", sta_id);
 
        priv->stations[sta_id].used &= ~IWL_STA_UCODE_ACTIVE;
 
@@ -324,13 +327,13 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv,
        const char *addr = rm_sta->addr;
 
        if (!skb) {
-               IWL_ERROR("Error: Response NULL in REPLY_REMOVE_STA.\n");
+               IWL_ERR(priv, "Error: Response NULL in REPLY_REMOVE_STA.\n");
                return 1;
        }
 
        res = (struct iwl_rx_packet *)skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_REMOVE_STA (0x%08X)\n",
+               IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
                res->hdr.flags);
                return 1;
        }
@@ -340,7 +343,7 @@ static int iwl_remove_sta_callback(struct iwl_priv *priv,
                iwl_sta_ucode_deactivate(priv, addr);
                break;
        default:
-               IWL_ERROR("REPLY_REMOVE_STA failed\n");
+               IWL_ERR(priv, "REPLY_REMOVE_STA failed\n");
                break;
        }
 
@@ -378,7 +381,7 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
 
        res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_REMOVE_STA (0x%08X)\n",
+               IWL_ERR(priv, "Bad return from REPLY_REMOVE_STA (0x%08X)\n",
                          res->hdr.flags);
                ret = -EIO;
        }
@@ -387,11 +390,11 @@ static int iwl_send_remove_station(struct iwl_priv *priv, const u8 *addr,
                switch (res->u.rem_sta.status) {
                case REM_STA_SUCCESS_MSK:
                        iwl_sta_ucode_deactivate(priv, addr);
-                       IWL_DEBUG_ASSOC("REPLY_REMOVE_STA PASSED\n");
+                       IWL_DEBUG_ASSOC(priv, "REPLY_REMOVE_STA PASSED\n");
                        break;
                default:
                        ret = -EIO;
-                       IWL_ERROR("REPLY_REMOVE_STA failed\n");
+                       IWL_ERR(priv, "REPLY_REMOVE_STA failed\n");
                        break;
                }
        }
@@ -429,17 +432,17 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
        if (unlikely(sta_id == IWL_INVALID_STATION))
                goto out;
 
-       IWL_DEBUG_ASSOC("Removing STA from driver:%d  %pM\n",
+       IWL_DEBUG_ASSOC(priv, "Removing STA from driver:%d  %pM\n",
                sta_id, addr);
 
        if (!(priv->stations[sta_id].used & IWL_STA_DRIVER_ACTIVE)) {
-               IWL_ERROR("Removing %pM but non DRIVER active\n",
+               IWL_ERR(priv, "Removing %pM but non DRIVER active\n",
                                addr);
                goto out;
        }
 
        if (!(priv->stations[sta_id].used & IWL_STA_UCODE_ACTIVE)) {
-               IWL_ERROR("Removing %pM but non UCODE active\n",
+               IWL_ERR(priv, "Removing %pM but non UCODE active\n",
                                addr);
                goto out;
        }
@@ -475,7 +478,7 @@ void iwl_clear_stations_table(struct iwl_priv *priv)
        if (iwl_is_alive(priv) &&
           !test_bit(STATUS_EXIT_PENDING, &priv->status) &&
           iwl_send_cmd_pdu_async(priv, REPLY_REMOVE_ALL_STA, 0, NULL, NULL))
-               IWL_ERROR("Couldn't clear the station table\n");
+               IWL_ERR(priv, "Couldn't clear the station table\n");
 
        priv->num_stations = 0;
        memset(priv->stations, 0, sizeof(priv->stations));
@@ -551,13 +554,13 @@ int iwl_remove_default_wep_key(struct iwl_priv *priv,
        spin_lock_irqsave(&priv->sta_lock, flags);
 
        if (!test_and_clear_bit(keyconf->keyidx, &priv->ucode_key_table))
-               IWL_ERROR("index %d not used in uCode key table.\n",
+               IWL_ERR(priv, "index %d not used in uCode key table.\n",
                          keyconf->keyidx);
 
        priv->default_wep_key--;
        memset(&priv->wep_keys[keyconf->keyidx], 0, sizeof(priv->wep_keys[0]));
        ret = iwl_send_static_wepkey_cmd(priv, 1);
-       IWL_DEBUG_WEP("Remove default WEP key: idx=%d ret=%d\n",
+       IWL_DEBUG_WEP(priv, "Remove default WEP key: idx=%d ret=%d\n",
                      keyconf->keyidx, ret);
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 
@@ -573,7 +576,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
 
        if (keyconf->keylen != WEP_KEY_LEN_128 &&
            keyconf->keylen != WEP_KEY_LEN_64) {
-               IWL_DEBUG_WEP("Bad WEP key length %d\n", keyconf->keylen);
+               IWL_DEBUG_WEP(priv, "Bad WEP key length %d\n", keyconf->keylen);
                return -EINVAL;
        }
 
@@ -585,7 +588,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
        priv->default_wep_key++;
 
        if (test_and_set_bit(keyconf->keyidx, &priv->ucode_key_table))
-               IWL_ERROR("index %d already used in uCode key table.\n",
+               IWL_ERR(priv, "index %d already used in uCode key table.\n",
                        keyconf->keyidx);
 
        priv->wep_keys[keyconf->keyidx].key_size = keyconf->keylen;
@@ -593,7 +596,7 @@ int iwl_set_default_wep_key(struct iwl_priv *priv,
                                                        keyconf->keylen);
 
        ret = iwl_send_static_wepkey_cmd(priv, 0);
-       IWL_DEBUG_WEP("Set default WEP key: len=%d idx=%d ret=%d\n",
+       IWL_DEBUG_WEP(priv, "Set default WEP key: len=%d idx=%d ret=%d\n",
                keyconf->keylen, keyconf->keyidx, ret);
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 
@@ -641,7 +644,7 @@ static int iwl_set_wep_dynamic_key_info(struct iwl_priv *priv,
         * in uCode. */
 
        WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
-               "no space for new kew");
+               "no space for a new key");
 
        priv->stations[sta_id].sta.key.key_flags = key_flags;
        priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
@@ -689,7 +692,7 @@ static int iwl_set_ccmp_dynamic_key_info(struct iwl_priv *priv,
         * in uCode. */
 
        WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
-               "no space for new kew");
+               "no space for a new key");
 
        priv->stations[sta_id].sta.key.key_flags = key_flags;
        priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
@@ -725,7 +728,7 @@ static int iwl_set_tkip_dynamic_key_info(struct iwl_priv *priv,
         * in uCode. */
 
        WARN(priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET,
-               "no space for new kew");
+               "no space for a new key");
 
        /* This copy is acutally not needed: we get the key with each TX */
        memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key, 16);
@@ -749,7 +752,7 @@ void iwl_update_tkip_key(struct iwl_priv *priv,
 
        sta_id = iwl_find_station(priv, addr);
        if (sta_id == IWL_INVALID_STATION) {
-               IWL_DEBUG_MAC80211("leave - %pM not in station map.\n",
+               IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
                                   addr);
                return;
        }
@@ -801,7 +804,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
        key_flags = le16_to_cpu(priv->stations[sta_id].sta.key.key_flags);
        keyidx = (key_flags >> STA_KEY_FLG_KEYID_POS) & 0x3;
 
-       IWL_DEBUG_WEP("Remove dynamic key: idx=%d sta=%d\n",
+       IWL_DEBUG_WEP(priv, "Remove dynamic key: idx=%d sta=%d\n",
                      keyconf->keyidx, sta_id);
 
        if (keyconf->keyidx != keyidx) {
@@ -815,7 +818,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
        }
 
        if (priv->stations[sta_id].sta.key.key_offset == WEP_INVALID_OFFSET) {
-               IWL_WARNING("Removing wrong key %d 0x%x\n",
+               IWL_WARN(priv, "Removing wrong key %d 0x%x\n",
                            keyconf->keyidx, key_flags);
                spin_unlock_irqrestore(&priv->sta_lock, flags);
                return 0;
@@ -823,7 +826,7 @@ int iwl_remove_dynamic_key(struct iwl_priv *priv,
 
        if (!test_and_clear_bit(priv->stations[sta_id].sta.key.key_offset,
                &priv->ucode_key_table))
-               IWL_ERROR("index %d not used in uCode key table.\n",
+               IWL_ERR(priv, "index %d not used in uCode key table.\n",
                        priv->stations[sta_id].sta.key.key_offset);
        memset(&priv->stations[sta_id].keyinfo, 0,
                                        sizeof(struct iwl_hw_key));
@@ -860,11 +863,12 @@ int iwl_set_dynamic_key(struct iwl_priv *priv,
                ret = iwl_set_wep_dynamic_key_info(priv, keyconf, sta_id);
                break;
        default:
-               IWL_ERROR("Unknown alg: %s alg = %d\n", __func__, keyconf->alg);
+               IWL_ERR(priv,
+                       "Unknown alg: %s alg = %d\n", __func__, keyconf->alg);
                ret = -EINVAL;
        }
 
-       IWL_DEBUG_WEP("Set dynamic key: alg= %d len=%d idx=%d sta=%d ret=%d\n",
+       IWL_DEBUG_WEP(priv, "Set dynamic key: alg= %d len=%d idx=%d sta=%d ret=%d\n",
                      keyconf->alg, keyconf->keylen, keyconf->keyidx,
                      sta_id, ret);
 
@@ -877,13 +881,13 @@ static void iwl_dump_lq_cmd(struct iwl_priv *priv,
                           struct iwl_link_quality_cmd *lq)
 {
        int i;
-       IWL_DEBUG_RATE("lq station id 0x%x\n", lq->sta_id);
-       IWL_DEBUG_RATE("lq ant 0x%X 0x%X\n",
+       IWL_DEBUG_RATE(priv, "lq station id 0x%x\n", lq->sta_id);
+       IWL_DEBUG_RATE(priv, "lq ant 0x%X 0x%X\n",
                       lq->general_params.single_stream_ant_msk,
                       lq->general_params.dual_stream_ant_msk);
 
        for (i = 0; i < LINK_QUAL_MAX_RETRY_NUM; i++)
-               IWL_DEBUG_RATE("lq index %d 0x%X\n",
+               IWL_DEBUG_RATE(priv, "lq index %d 0x%X\n",
                               i, lq->rs_table[i].rate_n_flags);
 }
 #else
@@ -1060,7 +1064,7 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
                if (sta_id != IWL_INVALID_STATION)
                        return sta_id;
 
-               IWL_DEBUG_DROP("Station %pM not in station map. "
+               IWL_DEBUG_DROP(priv, "Station %pM not in station map. "
                               "Defaulting to broadcast...\n",
                               hdr->addr1);
                iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
@@ -1072,7 +1076,8 @@ int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
                return priv->hw_params.bcast_sta_id;
 
        default:
-               IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
+               IWL_WARN(priv, "Unknown mode of operation: %d\n",
+                       priv->iw_mode);
                return priv->hw_params.bcast_sta_id;
        }
 }
index 9bb7cefc1f3cd2fc2157831c7958024ef5c7214e..97f6169007f8f282f75f082f2e03a70507b98db5 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -56,6 +56,8 @@ int iwl_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap);
 void iwl_clear_stations_table(struct iwl_priv *priv);
 int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr);
 int iwl_get_ra_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr);
+int iwl_send_add_sta(struct iwl_priv *priv,
+                    struct iwl_addsta_cmd *sta, u8 flags);
 u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr,
                        int is_ap, u8 flags,
                        struct ieee80211_sta_ht_cap *ht_info);
index b0ee86c6268501754651206d88b87fdcfceb2401..ae04c2086f70004f3aabb26d8044d5c832c26db7 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -76,116 +76,6 @@ static inline void iwl_free_dma_ptr(struct iwl_priv *priv,
        memset(ptr, 0, sizeof(*ptr));
 }
 
-static inline dma_addr_t iwl_tfd_tb_get_addr(struct iwl_tfd *tfd, u8 idx)
-{
-       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
-
-       dma_addr_t addr = get_unaligned_le32(&tb->lo);
-       if (sizeof(dma_addr_t) > sizeof(u32))
-               addr |=
-               ((dma_addr_t)(le16_to_cpu(tb->hi_n_len) & 0xF) << 16) << 16;
-
-       return addr;
-}
-
-static inline u16 iwl_tfd_tb_get_len(struct iwl_tfd *tfd, u8 idx)
-{
-       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
-
-       return le16_to_cpu(tb->hi_n_len) >> 4;
-}
-
-static inline void iwl_tfd_set_tb(struct iwl_tfd *tfd, u8 idx,
-                                 dma_addr_t addr, u16 len)
-{
-       struct iwl_tfd_tb *tb = &tfd->tbs[idx];
-       u16 hi_n_len = len << 4;
-
-       put_unaligned_le32(addr, &tb->lo);
-       if (sizeof(dma_addr_t) > sizeof(u32))
-               hi_n_len |= ((addr >> 16) >> 16) & 0xF;
-
-       tb->hi_n_len = cpu_to_le16(hi_n_len);
-
-       tfd->num_tbs = idx + 1;
-}
-
-static inline u8 iwl_tfd_get_num_tbs(struct iwl_tfd *tfd)
-{
-       return tfd->num_tbs & 0x1f;
-}
-
-/**
- * iwl_hw_txq_free_tfd - Free all chunks referenced by TFD [txq->q.read_ptr]
- * @priv - driver private data
- * @txq - tx queue
- *
- * Does NOT advance any TFD circular buffer read/write indexes
- * Does NOT free the TFD itself (which is within circular buffer)
- */
-static void iwl_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq)
-{
-       struct iwl_tfd *tfd_tmp = (struct iwl_tfd *)&txq->tfds[0];
-       struct iwl_tfd *tfd;
-       struct pci_dev *dev = priv->pci_dev;
-       int index = txq->q.read_ptr;
-       int i;
-       int num_tbs;
-
-       tfd = &tfd_tmp[index];
-
-       /* Sanity check on number of chunks */
-       num_tbs = iwl_tfd_get_num_tbs(tfd);
-
-       if (num_tbs >= IWL_NUM_OF_TBS) {
-               IWL_ERROR("Too many chunks: %i\n", num_tbs);
-               /* @todo issue fatal error, it is quite serious situation */
-               return;
-       }
-
-       /* Unmap tx_cmd */
-       if (num_tbs)
-               pci_unmap_single(dev,
-                               pci_unmap_addr(&txq->cmd[index]->meta, mapping),
-                               pci_unmap_len(&txq->cmd[index]->meta, len),
-                               PCI_DMA_TODEVICE);
-
-       /* Unmap chunks, if any. */
-       for (i = 1; i < num_tbs; i++) {
-               pci_unmap_single(dev, iwl_tfd_tb_get_addr(tfd, i),
-                               iwl_tfd_tb_get_len(tfd, i), PCI_DMA_TODEVICE);
-
-               if (txq->txb) {
-                       dev_kfree_skb(txq->txb[txq->q.read_ptr].skb[i - 1]);
-                       txq->txb[txq->q.read_ptr].skb[i - 1] = NULL;
-               }
-       }
-}
-
-static int iwl_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv,
-                                       struct iwl_tfd *tfd,
-                                       dma_addr_t addr, u16 len)
-{
-
-       u32 num_tbs = iwl_tfd_get_num_tbs(tfd);
-
-       /* Each TFD can point to a maximum 20 Tx buffers */
-       if (num_tbs >= IWL_NUM_OF_TBS) {
-               IWL_ERROR("Error can not send more than %d chunks\n",
-                         IWL_NUM_OF_TBS);
-               return -EINVAL;
-       }
-
-       BUG_ON(addr & ~DMA_BIT_MASK(36));
-       if (unlikely(addr & ~IWL_TX_DMA_MASK))
-               IWL_ERROR("Unaligned address = %llx\n",
-                         (unsigned long long)addr);
-
-       iwl_tfd_set_tb(tfd, num_tbs, addr, len);
-
-       return 0;
-}
-
 /**
  * iwl_txq_update_write_ptr - Send new write index to hardware
  */
@@ -206,7 +96,7 @@ int iwl_txq_update_write_ptr(struct iwl_priv *priv, struct iwl_tx_queue *txq)
                reg = iwl_read32(priv, CSR_UCODE_DRV_GP1);
 
                if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
-                       IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg);
+                       IWL_DEBUG_INFO(priv, "Requesting wakeup, GP1 = 0x%x\n", reg);
                        iwl_set_bit(priv, CSR_GP_CNTRL,
                                    CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
                        return ret;
@@ -241,7 +131,7 @@ EXPORT_SYMBOL(iwl_txq_update_write_ptr);
  * Free all buffers.
  * 0-fill, but do not free "txq" descriptor structure.
  */
-static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
+void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
 {
        struct iwl_tx_queue *txq = &priv->txq[txq_id];
        struct iwl_queue *q = &txq->q;
@@ -254,7 +144,7 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
        /* first, empty all BD's */
        for (; q->write_ptr != q->read_ptr;
             q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd))
-               iwl_hw_txq_free_tfd(priv, txq);
+               priv->cfg->ops->lib->txq_free_tfd(priv, txq);
 
        len = sizeof(struct iwl_cmd) * q->n_window;
 
@@ -264,7 +154,7 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
 
        /* De-alloc circular buffer of TFDs */
        if (txq->q.n_bd)
-               pci_free_consistent(dev, sizeof(struct iwl_tfd) *
+               pci_free_consistent(dev, priv->hw_params.tfd_size *
                                    txq->q.n_bd, txq->tfds, txq->q.dma_addr);
 
        /* De-alloc array of per-TFD driver data */
@@ -274,7 +164,7 @@ static void iwl_tx_queue_free(struct iwl_priv *priv, int txq_id)
        /* 0-fill queue descriptor structure */
        memset(txq, 0, sizeof(*txq));
 }
-
+EXPORT_SYMBOL(iwl_tx_queue_free);
 
 /**
  * iwl_cmd_queue_free - Deallocate DMA queue.
@@ -388,6 +278,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
                              struct iwl_tx_queue *txq, u32 id)
 {
        struct pci_dev *dev = priv->pci_dev;
+       size_t tfd_sz = priv->hw_params.tfd_size * TFD_QUEUE_SIZE_MAX;
 
        /* Driver private data, only for Tx (not command) queues,
         * not shared with device. */
@@ -395,22 +286,20 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
                txq->txb = kmalloc(sizeof(txq->txb[0]) *
                                   TFD_QUEUE_SIZE_MAX, GFP_KERNEL);
                if (!txq->txb) {
-                       IWL_ERROR("kmalloc for auxiliary BD "
+                       IWL_ERR(priv, "kmalloc for auxiliary BD "
                                  "structures failed\n");
                        goto error;
                }
-       } else
+       } else {
                txq->txb = NULL;
+       }
 
        /* Circular buffer of transmit frame descriptors (TFDs),
         * shared with device */
-       txq->tfds = pci_alloc_consistent(dev,
-                       sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX,
-                       &txq->q.dma_addr);
+       txq->tfds = pci_alloc_consistent(dev, tfd_sz, &txq->q.dma_addr);
 
        if (!txq->tfds) {
-               IWL_ERROR("pci_alloc_consistent(%zd) failed\n",
-                         sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX);
+               IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", tfd_sz);
                goto error;
        }
        txq->q.id = id;
@@ -424,42 +313,11 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,
        return -ENOMEM;
 }
 
-/*
- * Tell nic where to find circular buffer of Tx Frame Descriptors for
- * given Tx queue, and enable the DMA channel used for that queue.
- *
- * 4965 supports up to 16 Tx queues in DRAM, mapped to up to 8 Tx DMA
- * channels supported in hardware.
- */
-static int iwl_hw_tx_queue_init(struct iwl_priv *priv,
-                               struct iwl_tx_queue *txq)
-{
-       int ret;
-       unsigned long flags;
-       int txq_id = txq->q.id;
-
-       spin_lock_irqsave(&priv->lock, flags);
-       ret = iwl_grab_nic_access(priv);
-       if (ret) {
-               spin_unlock_irqrestore(&priv->lock, flags);
-               return ret;
-       }
-
-       /* Circular buffer (TFD queue in DRAM) physical base address */
-       iwl_write_direct32(priv, FH_MEM_CBBC_QUEUE(txq_id),
-                            txq->q.dma_addr >> 8);
-
-       iwl_release_nic_access(priv);
-       spin_unlock_irqrestore(&priv->lock, flags);
-
-       return 0;
-}
-
 /**
  * iwl_tx_queue_init - Allocate and initialize one tx/cmd queue
  */
-static int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
-                            int slots_num, u32 txq_id)
+int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
+                     int slots_num, u32 txq_id)
 {
        int i, len;
        int ret;
@@ -501,7 +359,7 @@ static int iwl_tx_queue_init(struct iwl_priv *priv, struct iwl_tx_queue *txq,
        iwl_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
 
        /* Tell device where to find queue */
-       iwl_hw_tx_queue_init(priv, txq);
+       priv->cfg->ops->lib->txq_init(priv, txq);
 
        return 0;
 err:
@@ -516,6 +374,8 @@ err:
        }
        return -ENOMEM;
 }
+EXPORT_SYMBOL(iwl_tx_queue_init);
+
 /**
  * iwl_hw_txq_ctx_free - Free TXQ Context
  *
@@ -557,13 +417,13 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv)
        ret = iwl_alloc_dma_ptr(priv, &priv->scd_bc_tbls,
                                priv->hw_params.scd_bc_tbls_size);
        if (ret) {
-               IWL_ERROR("Scheduler BC Table allocation failed\n");
+               IWL_ERR(priv, "Scheduler BC Table allocation failed\n");
                goto error_bc_tbls;
        }
        /* Alloc keep-warm buffer */
        ret = iwl_alloc_dma_ptr(priv, &priv->kw, IWL_KW_SIZE);
        if (ret) {
-               IWL_ERROR("Keep Warm allocation failed\n");
+               IWL_ERR(priv, "Keep Warm allocation failed\n");
                goto error_kw;
        }
        spin_lock_irqsave(&priv->lock, flags);
@@ -589,7 +449,7 @@ int iwl_txq_ctx_reset(struct iwl_priv *priv)
                ret = iwl_tx_queue_init(priv, &priv->txq[txq_id], slots_num,
                                       txq_id);
                if (ret) {
-                       IWL_ERROR("Tx %d queue init failed\n", txq_id);
+                       IWL_ERR(priv, "Tx %d queue init failed\n", txq_id);
                        goto error;
                }
        }
@@ -778,14 +638,14 @@ static void iwl_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
                memcpy(tx_cmd->key, keyconf->key, keyconf->keylen);
                if (info->flags & IEEE80211_TX_CTL_AMPDU)
                        tx_cmd->tx_flags |= TX_CMD_FLG_AGG_CCMP_MSK;
-               IWL_DEBUG_TX("tx_cmd with AES hwcrypto\n");
+               IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
                break;
 
        case ALG_TKIP:
                tx_cmd->sec_ctl = TX_CMD_SEC_TKIP;
                ieee80211_get_tkip_key(keyconf, skb_frag,
                        IEEE80211_TKIP_P2_KEY, tx_cmd->key);
-               IWL_DEBUG_TX("tx_cmd with tkip hwcrypto\n");
+               IWL_DEBUG_TX(priv, "tx_cmd with tkip hwcrypto\n");
                break;
 
        case ALG_WEP:
@@ -797,12 +657,12 @@ static void iwl_tx_cmd_build_hwcrypto(struct iwl_priv *priv,
 
                memcpy(&tx_cmd->key[3], keyconf->key, keyconf->keylen);
 
-               IWL_DEBUG_TX("Configuring packet for WEP encryption "
+               IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
                             "with key %d\n", keyconf->keyidx);
                break;
 
        default:
-               printk(KERN_ERR "Unknown encode alg %d\n", keyconf->alg);
+               IWL_ERR(priv, "Unknown encode alg %d\n", keyconf->alg);
                break;
        }
 }
@@ -822,7 +682,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct iwl_tfd *tfd;
        struct iwl_tx_queue *txq;
        struct iwl_queue *q;
        struct iwl_cmd *out_cmd;
@@ -844,13 +703,13 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 
        spin_lock_irqsave(&priv->lock, flags);
        if (iwl_is_rfkill(priv)) {
-               IWL_DEBUG_DROP("Dropping - RF KILL\n");
+               IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
                goto drop_unlock;
        }
 
        if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) ==
             IWL_INVALID_RATE) {
-               IWL_ERROR("ERROR: No TX rate available.\n");
+               IWL_ERR(priv, "ERROR: No TX rate available.\n");
                goto drop_unlock;
        }
 
@@ -858,11 +717,11 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 
 #ifdef CONFIG_IWLWIFI_DEBUG
        if (ieee80211_is_auth(fc))
-               IWL_DEBUG_TX("Sending AUTH frame\n");
+               IWL_DEBUG_TX(priv, "Sending AUTH frame\n");
        else if (ieee80211_is_assoc_req(fc))
-               IWL_DEBUG_TX("Sending ASSOC frame\n");
+               IWL_DEBUG_TX(priv, "Sending ASSOC frame\n");
        else if (ieee80211_is_reassoc_req(fc))
-               IWL_DEBUG_TX("Sending REASSOC frame\n");
+               IWL_DEBUG_TX(priv, "Sending REASSOC frame\n");
 #endif
 
        /* drop all data frame if we are not associated */
@@ -872,7 +731,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
            (!iwl_is_associated(priv) ||
             ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id) ||
             !priv->assoc_station_added)) {
-               IWL_DEBUG_DROP("Dropping - !iwl_is_associated\n");
+               IWL_DEBUG_DROP(priv, "Dropping - !iwl_is_associated\n");
                goto drop_unlock;
        }
 
@@ -883,12 +742,12 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
        /* Find (or create) index into station table for destination station */
        sta_id = iwl_get_sta_id(priv, hdr);
        if (sta_id == IWL_INVALID_STATION) {
-               IWL_DEBUG_DROP("Dropping - INVALID STATION: %pM\n",
+               IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
                               hdr->addr1);
                goto drop;
        }
 
-       IWL_DEBUG_TX("station Id %d\n", sta_id);
+       IWL_DEBUG_TX(priv, "station Id %d\n", sta_id);
 
        swq_id = skb_get_queue_mapping(skb);
        txq_id = swq_id;
@@ -898,7 +757,7 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
                seq_number = priv->stations[sta_id].tid[tid].seq_number;
                seq_number &= IEEE80211_SCTL_SEQ;
                hdr->seq_ctrl = hdr->seq_ctrl &
-                               __constant_cpu_to_le16(IEEE80211_SCTL_FRAG);
+                               cpu_to_le16(IEEE80211_SCTL_FRAG);
                hdr->seq_ctrl |= cpu_to_le16(seq_number);
                seq_number += 0x10;
                /* aggregation is on for this <sta,tid> */
@@ -913,10 +772,6 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       /* Set up first empty TFD within this queue's circular TFD buffer */
-       tfd = &txq->tfds[q->write_ptr];
-       memset(tfd, 0, sizeof(*tfd));
-
        /* Set up driver data for this TFD */
        memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
        txq->txb[q->write_ptr].skb[0] = skb;
@@ -970,7 +825,8 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
        /* Add buffer containing Tx command and MAC(!) header to TFD's
         * first entry */
        txcmd_phys += offsetof(struct iwl_cmd, hdr);
-       iwl_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
+       priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
+                                                  txcmd_phys, len, 1, 0);
 
        if (info->control.hw_key)
                iwl_tx_cmd_build_hwcrypto(priv, info, tx_cmd, skb, sta_id);
@@ -981,7 +837,9 @@ int iwl_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
        if (len) {
                phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
                                           len, PCI_DMA_TODEVICE);
-               iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len);
+               priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
+                                                          phys_addr, len,
+                                                          0, 0);
        }
 
        /* Tell NIC about any 2-byte padding after MAC header */
@@ -1063,7 +921,6 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 {
        struct iwl_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
        struct iwl_queue *q = &txq->q;
-       struct iwl_tfd *tfd;
        struct iwl_cmd *out_cmd;
        dma_addr_t phys_addr;
        unsigned long flags;
@@ -1081,21 +938,17 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
               !(cmd->meta.flags & CMD_SIZE_HUGE));
 
        if (iwl_is_rfkill(priv)) {
-               IWL_DEBUG_INFO("Not sending command - RF KILL");
+               IWL_DEBUG_INFO(priv, "Not sending command - RF KILL");
                return -EIO;
        }
 
        if (iwl_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
-               IWL_ERROR("No space for Tx\n");
+               IWL_ERR(priv, "No space for Tx\n");
                return -ENOSPC;
        }
 
        spin_lock_irqsave(&priv->hcmd_lock, flags);
 
-       tfd = &txq->tfds[q->write_ptr];
-       memset(tfd, 0, sizeof(*tfd));
-
-
        idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE);
        out_cmd = txq->cmd[idx];
 
@@ -1120,13 +973,15 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
        pci_unmap_len_set(&out_cmd->meta, len, len);
        phys_addr += offsetof(struct iwl_cmd, hdr);
 
-       iwl_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
+       priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
+                                                  phys_addr, fix_size, 1,
+                                                  U32_PAD(cmd->len));
 
 #ifdef CONFIG_IWLWIFI_DEBUG
        switch (out_cmd->hdr.cmd) {
        case REPLY_TX_LINK_QUALITY_CMD:
        case SENSITIVITY_CMD:
-               IWL_DEBUG_HC_DUMP("Sending command %s (#%x), seq: 0x%04X, "
+               IWL_DEBUG_HC_DUMP(priv, "Sending command %s (#%x), seq: 0x%04X, "
                                "%d bytes at %d[%d]:%d\n",
                                get_cmd_string(out_cmd->hdr.cmd),
                                out_cmd->hdr.cmd,
@@ -1134,7 +989,7 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
                                q->write_ptr, idx, IWL_CMD_QUEUE_NUM);
                                break;
        default:
-               IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, "
+               IWL_DEBUG_HC(priv, "Sending command %s (#%x), seq: 0x%04X, "
                                "%d bytes at %d[%d]:%d\n",
                                get_cmd_string(out_cmd->hdr.cmd),
                                out_cmd->hdr.cmd,
@@ -1144,8 +999,9 @@ int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
 #endif
        txq->need_update = 1;
 
-       /* Set up entry in queue's byte count circular buffer */
-       priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0);
+       if (priv->cfg->ops->lib->txq_update_byte_cnt_tbl)
+               /* Set up entry in queue's byte count circular buffer */
+               priv->cfg->ops->lib->txq_update_byte_cnt_tbl(priv, txq, 0);
 
        /* Increment and update queue's write index */
        q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
@@ -1163,7 +1019,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
        int nfreed = 0;
 
        if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
-               IWL_ERROR("Read index for DMA queue txq id (%d), index %d, "
+               IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
                          "is out of range [0-%d] %d %d.\n", txq_id,
                          index, q->n_bd, q->write_ptr, q->read_ptr);
                return 0;
@@ -1180,7 +1036,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)
                if (priv->cfg->ops->lib->txq_inval_byte_cnt_tbl)
                        priv->cfg->ops->lib->txq_inval_byte_cnt_tbl(priv, txq);
 
-               iwl_hw_txq_free_tfd(priv, txq);
+               priv->cfg->ops->lib->txq_free_tfd(priv, txq);
                nfreed++;
        }
        return nfreed;
@@ -1203,7 +1059,7 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id,
        int nfreed = 0;
 
        if ((idx >= q->n_bd) || (iwl_queue_used(q, idx) == 0)) {
-               IWL_ERROR("Read index for DMA queue txq id (%d), index %d, "
+               IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
                          "is out of range [0-%d] %d %d.\n", txq_id,
                          idx, q->n_bd, q->write_ptr, q->read_ptr);
                return;
@@ -1218,7 +1074,7 @@ static void iwl_hcmd_queue_reclaim(struct iwl_priv *priv, int txq_id,
             q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
 
                if (nfreed++ > 0) {
-                       IWL_ERROR("HCMD skipped: index (%d) %d %d\n", idx,
+                       IWL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", idx,
                                        q->write_ptr, q->read_ptr);
                        queue_work(priv->workqueue, &priv->restart);
                }
@@ -1306,7 +1162,7 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
        else
                return -EINVAL;
 
-       IWL_WARNING("%s on ra = %pM tid = %d\n",
+       IWL_WARN(priv, "%s on ra = %pM tid = %d\n",
                        __func__, ra, tid);
 
        sta_id = iwl_find_station(priv, ra);
@@ -1314,7 +1170,7 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
                return -ENXIO;
 
        if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_OFF) {
-               IWL_ERROR("Start AGG when state is not IWL_AGG_OFF !\n");
+               IWL_ERR(priv, "Start AGG when state is not IWL_AGG_OFF !\n");
                return -ENXIO;
        }
 
@@ -1334,11 +1190,11 @@ int iwl_tx_agg_start(struct iwl_priv *priv, const u8 *ra, u16 tid, u16 *ssn)
                return ret;
 
        if (tid_data->tfds_in_queue == 0) {
-               printk(KERN_ERR "HW queue is empty\n");
+               IWL_ERR(priv, "HW queue is empty\n");
                tid_data->agg.state = IWL_AGG_ON;
                ieee80211_start_tx_ba_cb_irqsafe(priv->hw, ra, tid);
        } else {
-               IWL_DEBUG_HT("HW queue is NOT empty: %d packets in HW queue\n",
+               IWL_DEBUG_HT(priv, "HW queue is NOT empty: %d packets in HW queue\n",
                             tid_data->tfds_in_queue);
                tid_data->agg.state = IWL_EMPTYING_HW_QUEUE_ADDBA;
        }
@@ -1354,7 +1210,7 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
        unsigned long flags;
 
        if (!ra) {
-               IWL_ERROR("ra = NULL\n");
+               IWL_ERR(priv, "ra = NULL\n");
                return -EINVAL;
        }
 
@@ -1369,7 +1225,7 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
                return -ENXIO;
 
        if (priv->stations[sta_id].tid[tid].agg.state != IWL_AGG_ON)
-               IWL_WARNING("Stopping AGG while state not IWL_AGG_ON\n");
+               IWL_WARN(priv, "Stopping AGG while state not IWL_AGG_ON\n");
 
        tid_data = &priv->stations[sta_id].tid[tid];
        ssn = (tid_data->seq_number & IEEE80211_SCTL_SEQ) >> 4;
@@ -1379,13 +1235,13 @@ int iwl_tx_agg_stop(struct iwl_priv *priv , const u8 *ra, u16 tid)
 
        /* The queue is not empty */
        if (write_ptr != read_ptr) {
-               IWL_DEBUG_HT("Stopping a non empty AGG HW QUEUE\n");
+               IWL_DEBUG_HT(priv, "Stopping a non empty AGG HW QUEUE\n");
                priv->stations[sta_id].tid[tid].agg.state =
                                IWL_EMPTYING_HW_QUEUE_DELBA;
                return 0;
        }
 
-       IWL_DEBUG_HT("HW queue is empty\n");
+       IWL_DEBUG_HT(priv, "HW queue is empty\n");
        priv->stations[sta_id].tid[tid].agg.state = IWL_AGG_OFF;
 
        spin_lock_irqsave(&priv->lock, flags);
@@ -1416,7 +1272,7 @@ int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id)
                    (q->read_ptr == q->write_ptr)) {
                        u16 ssn = SEQ_TO_SN(tid_data->seq_number);
                        int tx_fifo = default_tid_to_tx_fifo[tid];
-                       IWL_DEBUG_HT("HW queue empty: continue DELBA flow\n");
+                       IWL_DEBUG_HT(priv, "HW queue empty: continue DELBA flow\n");
                        priv->cfg->ops->lib->txq_agg_disable(priv, txq_id,
                                                             ssn, tx_fifo);
                        tid_data->agg.state = IWL_AGG_OFF;
@@ -1426,7 +1282,7 @@ int iwl_txq_check_empty(struct iwl_priv *priv, int sta_id, u8 tid, int txq_id)
        case IWL_EMPTYING_HW_QUEUE_ADDBA:
                /* We are reclaiming the last packet of the queue */
                if (tid_data->tfds_in_queue == 0) {
-                       IWL_DEBUG_HT("HW queue empty: continue ADDBA flow\n");
+                       IWL_DEBUG_HT(priv, "HW queue empty: continue ADDBA flow\n");
                        tid_data->agg.state = IWL_AGG_ON;
                        ieee80211_start_tx_ba_cb_irqsafe(priv->hw, addr, tid);
                }
@@ -1455,13 +1311,13 @@ static int iwl_tx_status_reply_compressed_ba(struct iwl_priv *priv,
        struct ieee80211_tx_info *info;
 
        if (unlikely(!agg->wait_for_ba))  {
-               IWL_ERROR("Received BA when not expected\n");
+               IWL_ERR(priv, "Received BA when not expected\n");
                return -EINVAL;
        }
 
        /* Mark that the expected block-ack response arrived */
        agg->wait_for_ba = 0;
-       IWL_DEBUG_TX_REPLY("BA %d %d\n", agg->start_idx, ba_resp->seq_ctl);
+       IWL_DEBUG_TX_REPLY(priv, "BA %d %d\n", agg->start_idx, ba_resp->seq_ctl);
 
        /* Calculate shift to align block-ack bits with our Tx window bits */
        sh = agg->start_idx - SEQ_TO_INDEX(seq_ctl >> 4);
@@ -1472,7 +1328,7 @@ static int iwl_tx_status_reply_compressed_ba(struct iwl_priv *priv,
        bitmap = le64_to_cpu(ba_resp->bitmap) >> sh;
 
        if (agg->frame_count > (64 - sh)) {
-               IWL_DEBUG_TX_REPLY("more frames than bitmap size");
+               IWL_DEBUG_TX_REPLY(priv, "more frames than bitmap size");
                return -1;
        }
 
@@ -1485,7 +1341,7 @@ static int iwl_tx_status_reply_compressed_ba(struct iwl_priv *priv,
        for (i = 0; i < agg->frame_count ; i++) {
                ack = bitmap & (1ULL << i);
                successes += !!ack;
-               IWL_DEBUG_TX_REPLY("%s ON i=%d idx=%d raw=%d\n",
+               IWL_DEBUG_TX_REPLY(priv, "%s ON i=%d idx=%d raw=%d\n",
                        ack ? "ACK" : "NACK", i, (agg->start_idx + i) & 0xff,
                        agg->start_idx + i);
        }
@@ -1498,7 +1354,7 @@ static int iwl_tx_status_reply_compressed_ba(struct iwl_priv *priv,
        info->status.ampdu_ack_len = agg->frame_count;
        iwl_hwrate_to_tx_control(priv, agg->rate_n_flags, info);
 
-       IWL_DEBUG_TX_REPLY("Bitmap %llx\n", (unsigned long long)bitmap);
+       IWL_DEBUG_TX_REPLY(priv, "Bitmap %llx\n", (unsigned long long)bitmap);
 
        return 0;
 }
@@ -1528,7 +1384,8 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
        u16 ba_resp_scd_ssn = le16_to_cpu(ba_resp->scd_ssn);
 
        if (scd_flow >= priv->hw_params.max_txq_num) {
-               IWL_ERROR("BUG_ON scd_flow is bigger than number of queues\n");
+               IWL_ERR(priv,
+                       "BUG_ON scd_flow is bigger than number of queues\n");
                return;
        }
 
@@ -1542,19 +1399,19 @@ void iwl_rx_reply_compressed_ba(struct iwl_priv *priv,
 
        /* TODO: Need to get this copy more safely - now good for debug */
 
-       IWL_DEBUG_TX_REPLY("REPLY_COMPRESSED_BA [%d] Received from %pM, "
+       IWL_DEBUG_TX_REPLY(priv, "REPLY_COMPRESSED_BA [%d] Received from %pM, "
                           "sta_id = %d\n",
                           agg->wait_for_ba,
                           (u8 *) &ba_resp->sta_addr_lo32,
                           ba_resp->sta_id);
-       IWL_DEBUG_TX_REPLY("TID = %d, SeqCtl = %d, bitmap = 0x%llx, scd_flow = "
+       IWL_DEBUG_TX_REPLY(priv, "TID = %d, SeqCtl = %d, bitmap = 0x%llx, scd_flow = "
                           "%d, scd_ssn = %d\n",
                           ba_resp->tid,
                           ba_resp->seq_ctl,
                           (unsigned long long)le64_to_cpu(ba_resp->bitmap),
                           ba_resp->scd_flow,
                           ba_resp->scd_ssn);
-       IWL_DEBUG_TX_REPLY("DAT start_idx = %d, bitmap = 0x%llx \n",
+       IWL_DEBUG_TX_REPLY(priv, "DAT start_idx = %d, bitmap = 0x%llx \n",
                           agg->start_idx,
                           (unsigned long long)agg->bitmap);
 
index 93be74a1f1398a4ab98430facbfe8f5544fbf42f..0cd8cb96a5ef03d6e319007c90693bf9e4f84388 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
 
 #include <asm/div64.h>
 
-#include "iwl-3945-core.h"
+#define DRV_NAME       "iwl3945"
+
+#include "iwl-fh.h"
+#include "iwl-3945-fh.h"
+#include "iwl-commands.h"
+#include "iwl-sta.h"
 #include "iwl-3945.h"
 #include "iwl-helpers.h"
-
-#ifdef CONFIG_IWL3945_DEBUG
-u32 iwl3945_debug_level;
-#endif
-
-static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
-                                 struct iwl3945_tx_queue *txq);
-
-/******************************************************************************
- *
- * module boiler plate
- *
- ******************************************************************************/
-
-/* module parameters */
-static int iwl3945_param_disable_hw_scan; /* def: 0 = use 3945's h/w scan */
-static u32 iwl3945_param_debug;    /* def: 0 = minimal debug log messages */
-static int iwl3945_param_disable;  /* def: 0 = enable radio */
-static int iwl3945_param_antenna;  /* def: 0 = both antennas (use diversity) */
-int iwl3945_param_hwcrypto;        /* def: 0 = use software encryption */
-int iwl3945_param_queues_num = IWL39_MAX_NUM_QUEUES; /* def: 8 Tx queues */
+#include "iwl-core.h"
+#include "iwl-dev.h"
 
 /*
  * module name, copyright, version, etc.
- * NOTE: DRV_NAME is defined in iwlwifi.h for use by iwl-debug.h and printk
  */
 
 #define DRV_DESCRIPTION        \
 "Intel(R) PRO/Wireless 3945ABG/BG Network Connection driver for Linux"
 
-#ifdef CONFIG_IWL3945_DEBUG
+#ifdef CONFIG_IWLWIFI_DEBUG
 #define VD "d"
 #else
 #define VD
@@ -91,10 +76,10 @@ int iwl3945_param_queues_num = IWL39_MAX_NUM_QUEUES; /* def: 8 Tx queues */
 #define VS
 #endif
 
-#define IWLWIFI_VERSION "1.2.26k" VD VS
-#define DRV_COPYRIGHT  "Copyright(c) 2003-2008 Intel Corporation"
+#define IWL39_VERSION "1.2.26k" VD VS
+#define DRV_COPYRIGHT  "Copyright(c) 2003-2009 Intel Corporation"
 #define DRV_AUTHOR     "<ilw@linux.intel.com>"
-#define DRV_VERSION     IWLWIFI_VERSION
+#define DRV_VERSION     IWL39_VERSION
 
 
 MODULE_DESCRIPTION(DRV_DESCRIPTION);
@@ -102,235 +87,13 @@ MODULE_VERSION(DRV_VERSION);
 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
 MODULE_LICENSE("GPL");
 
-static const struct ieee80211_supported_band *iwl3945_get_band(
-               struct iwl3945_priv *priv, enum ieee80211_band band)
-{
-       return priv->hw->wiphy->bands[band];
-}
-
-/*************** DMA-QUEUE-GENERAL-FUNCTIONS  *****
- * DMA services
- *
- * Theory of operation
- *
- * A Tx or Rx queue resides in host DRAM, and is comprised of a circular buffer
- * of buffer descriptors, each of which points to one or more data buffers for
- * the device to read from or fill.  Driver and device exchange status of each
- * queue via "read" and "write" pointers.  Driver keeps minimum of 2 empty
- * entries in each circular buffer, to protect against confusing empty and full
- * queue states.
- *
- * The device reads or writes the data in the queues via the device's several
- * DMA/FIFO channels.  Each queue is mapped to a single DMA channel.
- *
- * For Tx queue, there are low mark and high mark limits. If, after queuing
- * the packet for Tx, free space become < low mark, Tx queue stopped. When
- * reclaiming packets (on 'tx done IRQ), if free space become > high mark,
- * Tx queue resumed.
- *
- * The 3945 operates with six queues:  One receive queue, one transmit queue
- * (#4) for sending commands to the device firmware, and four transmit queues
- * (#0-3) for data tx via EDCA.  An additional 2 HCCA queues are unused.
- ***************************************************/
-
-int iwl3945_queue_space(const struct iwl3945_queue *q)
-{
-       int s = q->read_ptr - q->write_ptr;
-
-       if (q->read_ptr > q->write_ptr)
-               s -= q->n_bd;
-
-       if (s <= 0)
-               s += q->n_window;
-       /* keep some reserve to not confuse empty and full situations */
-       s -= 2;
-       if (s < 0)
-               s = 0;
-       return s;
-}
-
-int iwl3945_x2_queue_used(const struct iwl3945_queue *q, int i)
-{
-       return q->write_ptr > q->read_ptr ?
-               (i >= q->read_ptr && i < q->write_ptr) :
-               !(i < q->read_ptr && i >= q->write_ptr);
-}
-
-
-static inline u8 get_cmd_index(struct iwl3945_queue *q, u32 index, int is_huge)
-{
-       /* This is for scan command, the big buffer at end of command array */
-       if (is_huge)
-               return q->n_window;     /* must be power of 2 */
-
-       /* Otherwise, use normal size buffers */
-       return index & (q->n_window - 1);
-}
-
-/**
- * iwl3945_queue_init - Initialize queue's high/low-water and read/write indexes
- */
-static int iwl3945_queue_init(struct iwl3945_priv *priv, struct iwl3945_queue *q,
-                         int count, int slots_num, u32 id)
-{
-       q->n_bd = count;
-       q->n_window = slots_num;
-       q->id = id;
-
-       /* count must be power-of-two size, otherwise iwl_queue_inc_wrap
-        * and iwl_queue_dec_wrap are broken. */
-       BUG_ON(!is_power_of_2(count));
-
-       /* slots_num must be power-of-two size, otherwise
-        * get_cmd_index is broken. */
-       BUG_ON(!is_power_of_2(slots_num));
-
-       q->low_mark = q->n_window / 4;
-       if (q->low_mark < 4)
-               q->low_mark = 4;
-
-       q->high_mark = q->n_window / 8;
-       if (q->high_mark < 2)
-               q->high_mark = 2;
-
-       q->write_ptr = q->read_ptr = 0;
-
-       return 0;
-}
-
-/**
- * iwl3945_tx_queue_alloc - Alloc driver data and TFD CB for one Tx/cmd queue
- */
-static int iwl3945_tx_queue_alloc(struct iwl3945_priv *priv,
-                             struct iwl3945_tx_queue *txq, u32 id)
-{
-       struct pci_dev *dev = priv->pci_dev;
-
-       /* Driver private data, only for Tx (not command) queues,
-        * not shared with device. */
-       if (id != IWL_CMD_QUEUE_NUM) {
-               txq->txb = kmalloc(sizeof(txq->txb[0]) *
-                                  TFD_QUEUE_SIZE_MAX, GFP_KERNEL);
-               if (!txq->txb) {
-                       IWL_ERROR("kmalloc for auxiliary BD "
-                                 "structures failed\n");
-                       goto error;
-               }
-       } else
-               txq->txb = NULL;
-
-       /* Circular buffer of transmit frame descriptors (TFDs),
-        * shared with device */
-       txq->bd = pci_alloc_consistent(dev,
-                       sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX,
-                       &txq->q.dma_addr);
-
-       if (!txq->bd) {
-               IWL_ERROR("pci_alloc_consistent(%zd) failed\n",
-                         sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX);
-               goto error;
-       }
-       txq->q.id = id;
-
-       return 0;
-
- error:
-       kfree(txq->txb);
-       txq->txb = NULL;
-
-       return -ENOMEM;
-}
-
-/**
- * iwl3945_tx_queue_init - Allocate and initialize one tx/cmd queue
- */
-int iwl3945_tx_queue_init(struct iwl3945_priv *priv,
-                     struct iwl3945_tx_queue *txq, int slots_num, u32 txq_id)
-{
-       struct pci_dev *dev = priv->pci_dev;
-       int len;
-       int rc = 0;
-
-       /*
-        * Alloc buffer array for commands (Tx or other types of commands).
-        * For the command queue (#4), allocate command space + one big
-        * command for scan, since scan command is very huge; the system will
-        * not have two scans at the same time, so only one is needed.
-        * For data Tx queues (all other queues), no super-size command
-        * space is needed.
-        */
-       len = sizeof(struct iwl3945_cmd) * slots_num;
-       if (txq_id == IWL_CMD_QUEUE_NUM)
-               len +=  IWL_MAX_SCAN_SIZE;
-       txq->cmd = pci_alloc_consistent(dev, len, &txq->dma_addr_cmd);
-       if (!txq->cmd)
-               return -ENOMEM;
-
-       /* Alloc driver data array and TFD circular buffer */
-       rc = iwl3945_tx_queue_alloc(priv, txq, txq_id);
-       if (rc) {
-               pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
-
-               return -ENOMEM;
-       }
-       txq->need_update = 0;
-
-       /* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise
-        * iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */
-       BUILD_BUG_ON(TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX - 1));
-
-       /* Initialize queue high/low-water, head/tail indexes */
-       iwl3945_queue_init(priv, &txq->q, TFD_QUEUE_SIZE_MAX, slots_num, txq_id);
-
-       /* Tell device where to find queue, enable DMA channel. */
-       iwl3945_hw_tx_queue_init(priv, txq);
-
-       return 0;
-}
-
-/**
- * iwl3945_tx_queue_free - Deallocate DMA queue.
- * @txq: Transmit queue to deallocate.
- *
- * Empty queue by removing and destroying all BD's.
- * Free all buffers.
- * 0-fill, but do not free "txq" descriptor structure.
- */
-void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq)
-{
-       struct iwl3945_queue *q = &txq->q;
-       struct pci_dev *dev = priv->pci_dev;
-       int len;
-
-       if (q->n_bd == 0)
-               return;
-
-       /* first, empty all BD's */
-       for (; q->write_ptr != q->read_ptr;
-            q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd))
-               iwl3945_hw_txq_free_tfd(priv, txq);
-
-       len = sizeof(struct iwl3945_cmd) * q->n_window;
-       if (q->id == IWL_CMD_QUEUE_NUM)
-               len += IWL_MAX_SCAN_SIZE;
-
-       /* De-alloc array of command/tx buffers */
-       pci_free_consistent(dev, len, txq->cmd, txq->dma_addr_cmd);
-
-       /* De-alloc circular buffer of TFDs */
-       if (txq->q.n_bd)
-               pci_free_consistent(dev, sizeof(struct iwl3945_tfd_frame) *
-                                   txq->q.n_bd, txq->bd, txq->q.dma_addr);
-
-       /* De-alloc array of per-TFD driver data */
-       kfree(txq->txb);
-       txq->txb = NULL;
-
-       /* 0-fill queue descriptor structure */
-       memset(txq, 0, sizeof(*txq));
-}
-
-const u8 iwl3945_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
+ /* module parameters */
+struct iwl_mod_params iwl3945_mod_params = {
+       .num_of_queues = IWL39_MAX_NUM_QUEUES,
+       .sw_crypto = 1,
+       .restart_fw = 1,
+       /* the rest are 0 by default */
+};
 
 /*************** STATION TABLE MANAGEMENT ****
  * mac80211 should be examined to determine if sta_info is duplicating
@@ -344,7 +107,7 @@ const u8 iwl3945_broadcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF
  *
  * NOTE:  This does not remove station from device's station table.
  */
-static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap)
+static u8 iwl3945_remove_station(struct iwl_priv *priv, const u8 *addr, int is_ap)
 {
        int index = IWL_INVALID_STATION;
        int i;
@@ -355,11 +118,11 @@ static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int
        if (is_ap)
                index = IWL_AP_ID;
        else if (is_broadcast_ether_addr(addr))
-               index = priv->hw_setting.bcast_sta_id;
+               index = priv->hw_params.bcast_sta_id;
        else
-               for (i = IWL_STA_ID; i < priv->hw_setting.max_stations; i++)
-                       if (priv->stations[i].used &&
-                           !compare_ether_addr(priv->stations[i].sta.sta.addr,
+               for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++)
+                       if (priv->stations_39[i].used &&
+                           !compare_ether_addr(priv->stations_39[i].sta.sta.addr,
                                                addr)) {
                                index = i;
                                break;
@@ -368,8 +131,8 @@ static u8 iwl3945_remove_station(struct iwl3945_priv *priv, const u8 *addr, int
        if (unlikely(index == IWL_INVALID_STATION))
                goto out;
 
-       if (priv->stations[index].used) {
-               priv->stations[index].used = 0;
+       if (priv->stations_39[index].used) {
+               priv->stations_39[index].used = 0;
                priv->num_stations--;
        }
 
@@ -386,14 +149,14 @@ out:
  *
  * NOTE:  This does not clear or otherwise alter the device's station table.
  */
-static void iwl3945_clear_stations_table(struct iwl3945_priv *priv)
+static void iwl3945_clear_stations_table(struct iwl_priv *priv)
 {
        unsigned long flags;
 
        spin_lock_irqsave(&priv->sta_lock, flags);
 
        priv->num_stations = 0;
-       memset(priv->stations, 0, sizeof(priv->stations));
+       memset(priv->stations_39, 0, sizeof(priv->stations_39));
 
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 }
@@ -401,7 +164,7 @@ static void iwl3945_clear_stations_table(struct iwl3945_priv *priv)
 /**
  * iwl3945_add_station - Add station to station tables in driver and device
  */
-u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8 flags)
+u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap, u8 flags)
 {
        int i;
        int index = IWL_INVALID_STATION;
@@ -413,16 +176,16 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8
        if (is_ap)
                index = IWL_AP_ID;
        else if (is_broadcast_ether_addr(addr))
-               index = priv->hw_setting.bcast_sta_id;
+               index = priv->hw_params.bcast_sta_id;
        else
-               for (i = IWL_STA_ID; i < priv->hw_setting.max_stations; i++) {
-                       if (!compare_ether_addr(priv->stations[i].sta.sta.addr,
+               for (i = IWL_STA_ID; i < priv->hw_params.max_stations; i++) {
+                       if (!compare_ether_addr(priv->stations_39[i].sta.sta.addr,
                                                addr)) {
                                index = i;
                                break;
                        }
 
-                       if (!priv->stations[i].used &&
+                       if (!priv->stations_39[i].used &&
                            index == IWL_INVALID_STATION)
                                index = i;
                }
@@ -434,14 +197,14 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8
                return index;
        }
 
-       if (priv->stations[index].used &&
-          !compare_ether_addr(priv->stations[index].sta.sta.addr, addr)) {
+       if (priv->stations_39[index].used &&
+          !compare_ether_addr(priv->stations_39[index].sta.sta.addr, addr)) {
                spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
                return index;
        }
 
-       IWL_DEBUG_ASSOC("Add STA ID %d: %pM\n", index, addr);
-       station = &priv->stations[index];
+       IWL_DEBUG_ASSOC(priv, "Add STA ID %d: %pM\n", index, addr);
+       station = &priv->stations_39[index];
        station->used = 1;
        priv->num_stations++;
 
@@ -460,531 +223,35 @@ u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *addr, int is_ap, u8
        /* Turn on both antennas for the station... */
        station->sta.rate_n_flags =
                        iwl3945_hw_set_rate_n_flags(rate, RATE_MCS_ANT_AB_MSK);
-       station->current_rate.rate_n_flags =
-                       le16_to_cpu(station->sta.rate_n_flags);
 
        spin_unlock_irqrestore(&priv->sta_lock, flags_spin);
 
        /* Add station to device's station table */
-       iwl3945_send_add_station(priv, &station->sta, flags);
+       iwl_send_add_sta(priv,
+                        (struct iwl_addsta_cmd *)&station->sta, flags);
        return index;
 
 }
 
-/*************** DRIVER STATUS FUNCTIONS   *****/
-
-static inline int iwl3945_is_ready(struct iwl3945_priv *priv)
-{
-       /* The adapter is 'ready' if READY and GEO_CONFIGURED bits are
-        * set but EXIT_PENDING is not */
-       return test_bit(STATUS_READY, &priv->status) &&
-              test_bit(STATUS_GEO_CONFIGURED, &priv->status) &&
-              !test_bit(STATUS_EXIT_PENDING, &priv->status);
-}
-
-static inline int iwl3945_is_alive(struct iwl3945_priv *priv)
-{
-       return test_bit(STATUS_ALIVE, &priv->status);
-}
-
-static inline int iwl3945_is_init(struct iwl3945_priv *priv)
-{
-       return test_bit(STATUS_INIT, &priv->status);
-}
-
-static inline int iwl3945_is_rfkill_sw(struct iwl3945_priv *priv)
-{
-       return test_bit(STATUS_RF_KILL_SW, &priv->status);
-}
-
-static inline int iwl3945_is_rfkill_hw(struct iwl3945_priv *priv)
-{
-       return test_bit(STATUS_RF_KILL_HW, &priv->status);
-}
-
-static inline int iwl3945_is_rfkill(struct iwl3945_priv *priv)
-{
-       return iwl3945_is_rfkill_hw(priv) ||
-               iwl3945_is_rfkill_sw(priv);
-}
-
-static inline int iwl3945_is_ready_rf(struct iwl3945_priv *priv)
-{
-
-       if (iwl3945_is_rfkill(priv))
-               return 0;
-
-       return iwl3945_is_ready(priv);
-}
-
-/*************** HOST COMMAND QUEUE FUNCTIONS   *****/
-
-#define IWL_CMD(x) case x: return #x
-
-static const char *get_cmd_string(u8 cmd)
-{
-       switch (cmd) {
-               IWL_CMD(REPLY_ALIVE);
-               IWL_CMD(REPLY_ERROR);
-               IWL_CMD(REPLY_RXON);
-               IWL_CMD(REPLY_RXON_ASSOC);
-               IWL_CMD(REPLY_QOS_PARAM);
-               IWL_CMD(REPLY_RXON_TIMING);
-               IWL_CMD(REPLY_ADD_STA);
-               IWL_CMD(REPLY_REMOVE_STA);
-               IWL_CMD(REPLY_REMOVE_ALL_STA);
-               IWL_CMD(REPLY_3945_RX);
-               IWL_CMD(REPLY_TX);
-               IWL_CMD(REPLY_RATE_SCALE);
-               IWL_CMD(REPLY_LEDS_CMD);
-               IWL_CMD(REPLY_TX_LINK_QUALITY_CMD);
-               IWL_CMD(RADAR_NOTIFICATION);
-               IWL_CMD(REPLY_QUIET_CMD);
-               IWL_CMD(REPLY_CHANNEL_SWITCH);
-               IWL_CMD(CHANNEL_SWITCH_NOTIFICATION);
-               IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD);
-               IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION);
-               IWL_CMD(POWER_TABLE_CMD);
-               IWL_CMD(PM_SLEEP_NOTIFICATION);
-               IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC);
-               IWL_CMD(REPLY_SCAN_CMD);
-               IWL_CMD(REPLY_SCAN_ABORT_CMD);
-               IWL_CMD(SCAN_START_NOTIFICATION);
-               IWL_CMD(SCAN_RESULTS_NOTIFICATION);
-               IWL_CMD(SCAN_COMPLETE_NOTIFICATION);
-               IWL_CMD(BEACON_NOTIFICATION);
-               IWL_CMD(REPLY_TX_BEACON);
-               IWL_CMD(WHO_IS_AWAKE_NOTIFICATION);
-               IWL_CMD(QUIET_NOTIFICATION);
-               IWL_CMD(REPLY_TX_PWR_TABLE_CMD);
-               IWL_CMD(MEASURE_ABORT_NOTIFICATION);
-               IWL_CMD(REPLY_BT_CONFIG);
-               IWL_CMD(REPLY_STATISTICS_CMD);
-               IWL_CMD(STATISTICS_NOTIFICATION);
-               IWL_CMD(REPLY_CARD_STATE_CMD);
-               IWL_CMD(CARD_STATE_NOTIFICATION);
-               IWL_CMD(MISSED_BEACONS_NOTIFICATION);
-       default:
-               return "UNKNOWN";
-
-       }
-}
-
-#define HOST_COMPLETE_TIMEOUT (HZ / 2)
-
-/**
- * iwl3945_enqueue_hcmd - enqueue a uCode command
- * @priv: device private data point
- * @cmd: a point to the ucode command structure
- *
- * The function returns < 0 values to indicate the operation is
- * failed. On success, it turns the index (> 0) of command in the
- * command queue.
- */
-static int iwl3945_enqueue_hcmd(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
-{
-       struct iwl3945_tx_queue *txq = &priv->txq[IWL_CMD_QUEUE_NUM];
-       struct iwl3945_queue *q = &txq->q;
-       struct iwl3945_tfd_frame *tfd;
-       u32 *control_flags;
-       struct iwl3945_cmd *out_cmd;
-       u32 idx;
-       u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
-       dma_addr_t phys_addr;
-       int pad;
-       u16 count;
-       int ret;
-       unsigned long flags;
-
-       /* If any of the command structures end up being larger than
-        * the TFD_MAX_PAYLOAD_SIZE, and it sent as a 'small' command then
-        * we will need to increase the size of the TFD entries */
-       BUG_ON((fix_size > TFD_MAX_PAYLOAD_SIZE) &&
-              !(cmd->meta.flags & CMD_SIZE_HUGE));
-
-
-       if (iwl3945_is_rfkill(priv)) {
-               IWL_DEBUG_INFO("Not sending command - RF KILL");
-               return -EIO;
-       }
-
-       if (iwl3945_queue_space(q) < ((cmd->meta.flags & CMD_ASYNC) ? 2 : 1)) {
-               IWL_ERROR("No space for Tx\n");
-               return -ENOSPC;
-       }
-
-       spin_lock_irqsave(&priv->hcmd_lock, flags);
-
-       tfd = &txq->bd[q->write_ptr];
-       memset(tfd, 0, sizeof(*tfd));
-
-       control_flags = (u32 *) tfd;
-
-       idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE);
-       out_cmd = &txq->cmd[idx];
-
-       out_cmd->hdr.cmd = cmd->id;
-       memcpy(&out_cmd->meta, &cmd->meta, sizeof(cmd->meta));
-       memcpy(&out_cmd->cmd.payload, cmd->data, cmd->len);
-
-       /* At this point, the out_cmd now has all of the incoming cmd
-        * information */
-
-       out_cmd->hdr.flags = 0;
-       out_cmd->hdr.sequence = cpu_to_le16(QUEUE_TO_SEQ(IWL_CMD_QUEUE_NUM) |
-                       INDEX_TO_SEQ(q->write_ptr));
-       if (out_cmd->meta.flags & CMD_SIZE_HUGE)
-               out_cmd->hdr.sequence |= cpu_to_le16(SEQ_HUGE_FRAME);
-
-       phys_addr = txq->dma_addr_cmd + sizeof(txq->cmd[0]) * idx +
-                       offsetof(struct iwl3945_cmd, hdr);
-       iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
-
-       pad = U32_PAD(cmd->len);
-       count = TFD_CTL_COUNT_GET(*control_flags);
-       *control_flags = TFD_CTL_COUNT_SET(count) | TFD_CTL_PAD_SET(pad);
-
-       IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, "
-                    "%d bytes at %d[%d]:%d\n",
-                    get_cmd_string(out_cmd->hdr.cmd),
-                    out_cmd->hdr.cmd, le16_to_cpu(out_cmd->hdr.sequence),
-                    fix_size, q->write_ptr, idx, IWL_CMD_QUEUE_NUM);
-
-       txq->need_update = 1;
-
-       /* Increment and update queue's write index */
-       q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
-       ret = iwl3945_tx_queue_update_write_ptr(priv, txq);
-
-       spin_unlock_irqrestore(&priv->hcmd_lock, flags);
-       return ret ? ret : idx;
-}
-
-static int iwl3945_send_cmd_async(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
-{
-       int ret;
-
-       BUG_ON(!(cmd->meta.flags & CMD_ASYNC));
-
-       /* An asynchronous command can not expect an SKB to be set. */
-       BUG_ON(cmd->meta.flags & CMD_WANT_SKB);
-
-       /* An asynchronous command MUST have a callback. */
-       BUG_ON(!cmd->meta.u.callback);
-
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
-               return -EBUSY;
-
-       ret = iwl3945_enqueue_hcmd(priv, cmd);
-       if (ret < 0) {
-               IWL_ERROR("Error sending %s: iwl3945_enqueue_hcmd failed: %d\n",
-                         get_cmd_string(cmd->id), ret);
-               return ret;
-       }
-       return 0;
-}
-
-static int iwl3945_send_cmd_sync(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
-{
-       int cmd_idx;
-       int ret;
-
-       BUG_ON(cmd->meta.flags & CMD_ASYNC);
-
-        /* A synchronous command can not have a callback set. */
-       BUG_ON(cmd->meta.u.callback != NULL);
-
-       if (test_and_set_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status)) {
-               IWL_ERROR("Error sending %s: Already sending a host command\n",
-                         get_cmd_string(cmd->id));
-               ret = -EBUSY;
-               goto out;
-       }
-
-       set_bit(STATUS_HCMD_ACTIVE, &priv->status);
-
-       if (cmd->meta.flags & CMD_WANT_SKB)
-               cmd->meta.source = &cmd->meta;
-
-       cmd_idx = iwl3945_enqueue_hcmd(priv, cmd);
-       if (cmd_idx < 0) {
-               ret = cmd_idx;
-               IWL_ERROR("Error sending %s: iwl3945_enqueue_hcmd failed: %d\n",
-                         get_cmd_string(cmd->id), ret);
-               goto out;
-       }
-
-       ret = wait_event_interruptible_timeout(priv->wait_command_queue,
-                       !test_bit(STATUS_HCMD_ACTIVE, &priv->status),
-                       HOST_COMPLETE_TIMEOUT);
-       if (!ret) {
-               if (test_bit(STATUS_HCMD_ACTIVE, &priv->status)) {
-                       IWL_ERROR("Error sending %s: time out after %dms.\n",
-                                 get_cmd_string(cmd->id),
-                                 jiffies_to_msecs(HOST_COMPLETE_TIMEOUT));
-
-                       clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
-                       ret = -ETIMEDOUT;
-                       goto cancel;
-               }
-       }
-
-       if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
-               IWL_DEBUG_INFO("Command %s aborted: RF KILL Switch\n",
-                              get_cmd_string(cmd->id));
-               ret = -ECANCELED;
-               goto fail;
-       }
-       if (test_bit(STATUS_FW_ERROR, &priv->status)) {
-               IWL_DEBUG_INFO("Command %s failed: FW Error\n",
-                              get_cmd_string(cmd->id));
-               ret = -EIO;
-               goto fail;
-       }
-       if ((cmd->meta.flags & CMD_WANT_SKB) && !cmd->meta.u.skb) {
-               IWL_ERROR("Error: Response NULL in '%s'\n",
-                         get_cmd_string(cmd->id));
-               ret = -EIO;
-               goto cancel;
-       }
-
-       ret = 0;
-       goto out;
-
-cancel:
-       if (cmd->meta.flags & CMD_WANT_SKB) {
-               struct iwl3945_cmd *qcmd;
-
-               /* Cancel the CMD_WANT_SKB flag for the cmd in the
-                * TX cmd queue. Otherwise in case the cmd comes
-                * in later, it will possibly set an invalid
-                * address (cmd->meta.source). */
-               qcmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_idx];
-               qcmd->meta.flags &= ~CMD_WANT_SKB;
-       }
-fail:
-       if (cmd->meta.u.skb) {
-               dev_kfree_skb_any(cmd->meta.u.skb);
-               cmd->meta.u.skb = NULL;
-       }
-out:
-       clear_bit(STATUS_HCMD_SYNC_ACTIVE, &priv->status);
-       return ret;
-}
-
-int iwl3945_send_cmd(struct iwl3945_priv *priv, struct iwl3945_host_cmd *cmd)
-{
-       if (cmd->meta.flags & CMD_ASYNC)
-               return iwl3945_send_cmd_async(priv, cmd);
-
-       return iwl3945_send_cmd_sync(priv, cmd);
-}
-
-int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len, const void *data)
-{
-       struct iwl3945_host_cmd cmd = {
-               .id = id,
-               .len = len,
-               .data = data,
-       };
-
-       return iwl3945_send_cmd_sync(priv, &cmd);
-}
-
-static int __must_check iwl3945_send_cmd_u32(struct iwl3945_priv *priv, u8 id, u32 val)
-{
-       struct iwl3945_host_cmd cmd = {
-               .id = id,
-               .len = sizeof(val),
-               .data = &val,
-       };
-
-       return iwl3945_send_cmd_sync(priv, &cmd);
-}
-
-int iwl3945_send_statistics_request(struct iwl3945_priv *priv)
-{
-       return iwl3945_send_cmd_u32(priv, REPLY_STATISTICS_CMD, 0);
-}
-
-/**
- * iwl3945_set_rxon_channel - Set the phymode and channel values in staging RXON
- * @band: 2.4 or 5 GHz band
- * @channel: Any channel valid for the requested band
-
- * In addition to setting the staging RXON, priv->band is also set.
- *
- * NOTE:  Does not commit to the hardware; it sets appropriate bit fields
- * in the staging RXON flag structure based on the band
- */
-static int iwl3945_set_rxon_channel(struct iwl3945_priv *priv,
-                                   enum ieee80211_band band,
-                                   u16 channel)
-{
-       if (!iwl3945_get_channel_info(priv, band, channel)) {
-               IWL_DEBUG_INFO("Could not set channel to %d [%d]\n",
-                              channel, band);
-               return -EINVAL;
-       }
-
-       if ((le16_to_cpu(priv->staging_rxon.channel) == channel) &&
-           (priv->band == band))
-               return 0;
-
-       priv->staging_rxon.channel = cpu_to_le16(channel);
-       if (band == IEEE80211_BAND_5GHZ)
-               priv->staging_rxon.flags &= ~RXON_FLG_BAND_24G_MSK;
-       else
-               priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK;
-
-       priv->band = band;
-
-       IWL_DEBUG_INFO("Staging channel set to %d [%d]\n", channel, band);
-
-       return 0;
-}
-
-/**
- * iwl3945_check_rxon_cmd - validate RXON structure is valid
- *
- * NOTE:  This is really only useful during development and can eventually
- * be #ifdef'd out once the driver is stable and folks aren't actively
- * making changes
- */
-static int iwl3945_check_rxon_cmd(struct iwl3945_rxon_cmd *rxon)
-{
-       int error = 0;
-       int counter = 1;
-
-       if (rxon->flags & RXON_FLG_BAND_24G_MSK) {
-               error |= le32_to_cpu(rxon->flags &
-                               (RXON_FLG_TGJ_NARROW_BAND_MSK |
-                                RXON_FLG_RADAR_DETECT_MSK));
-               if (error)
-                       IWL_WARNING("check 24G fields %d | %d\n",
-                                   counter++, error);
-       } else {
-               error |= (rxon->flags & RXON_FLG_SHORT_SLOT_MSK) ?
-                               0 : le32_to_cpu(RXON_FLG_SHORT_SLOT_MSK);
-               if (error)
-                       IWL_WARNING("check 52 fields %d | %d\n",
-                                   counter++, error);
-               error |= le32_to_cpu(rxon->flags & RXON_FLG_CCK_MSK);
-               if (error)
-                       IWL_WARNING("check 52 CCK %d | %d\n",
-                                   counter++, error);
-       }
-       error |= (rxon->node_addr[0] | rxon->bssid_addr[0]) & 0x1;
-       if (error)
-               IWL_WARNING("check mac addr %d | %d\n", counter++, error);
-
-       /* make sure basic rates 6Mbps and 1Mbps are supported */
-       error |= (((rxon->ofdm_basic_rates & IWL_RATE_6M_MASK) == 0) &&
-                 ((rxon->cck_basic_rates & IWL_RATE_1M_MASK) == 0));
-       if (error)
-               IWL_WARNING("check basic rate %d | %d\n", counter++, error);
-
-       error |= (le16_to_cpu(rxon->assoc_id) > 2007);
-       if (error)
-               IWL_WARNING("check assoc id %d | %d\n", counter++, error);
-
-       error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK))
-                       == (RXON_FLG_CCK_MSK | RXON_FLG_SHORT_SLOT_MSK));
-       if (error)
-               IWL_WARNING("check CCK and short slot %d | %d\n",
-                           counter++, error);
-
-       error |= ((rxon->flags & (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK))
-                       == (RXON_FLG_CCK_MSK | RXON_FLG_AUTO_DETECT_MSK));
-       if (error)
-               IWL_WARNING("check CCK & auto detect %d | %d\n",
-                           counter++, error);
-
-       error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK |
-                       RXON_FLG_TGG_PROTECT_MSK)) == RXON_FLG_TGG_PROTECT_MSK);
-       if (error)
-               IWL_WARNING("check TGG and auto detect %d | %d\n",
-                           counter++, error);
-
-       if ((rxon->flags & RXON_FLG_DIS_DIV_MSK))
-               error |= ((rxon->flags & (RXON_FLG_ANT_B_MSK |
-                               RXON_FLG_ANT_A_MSK)) == 0);
-       if (error)
-               IWL_WARNING("check antenna %d %d\n", counter++, error);
-
-       if (error)
-               IWL_WARNING("Tuning to channel %d\n",
-                           le16_to_cpu(rxon->channel));
-
-       if (error) {
-               IWL_ERROR("Not a valid iwl3945_rxon_assoc_cmd field values\n");
-               return -1;
-       }
-       return 0;
-}
-
-/**
- * iwl3945_full_rxon_required - check if full RXON (vs RXON_ASSOC) cmd is needed
- * @priv: staging_rxon is compared to active_rxon
- *
- * If the RXON structure is changing enough to require a new tune,
- * or is clearing the RXON_FILTER_ASSOC_MSK, then return 1 to indicate that
- * a new tune (full RXON command, rather than RXON_ASSOC cmd) is required.
- */
-static int iwl3945_full_rxon_required(struct iwl3945_priv *priv)
-{
-
-       /* These items are only settable from the full RXON command */
-       if (!(iwl3945_is_associated(priv)) ||
-           compare_ether_addr(priv->staging_rxon.bssid_addr,
-                              priv->active_rxon.bssid_addr) ||
-           compare_ether_addr(priv->staging_rxon.node_addr,
-                              priv->active_rxon.node_addr) ||
-           compare_ether_addr(priv->staging_rxon.wlap_bssid_addr,
-                              priv->active_rxon.wlap_bssid_addr) ||
-           (priv->staging_rxon.dev_type != priv->active_rxon.dev_type) ||
-           (priv->staging_rxon.channel != priv->active_rxon.channel) ||
-           (priv->staging_rxon.air_propagation !=
-            priv->active_rxon.air_propagation) ||
-           (priv->staging_rxon.assoc_id != priv->active_rxon.assoc_id))
-               return 1;
-
-       /* flags, filter_flags, ofdm_basic_rates, and cck_basic_rates can
-        * be updated with the RXON_ASSOC command -- however only some
-        * flag transitions are allowed using RXON_ASSOC */
-
-       /* Check if we are not switching bands */
-       if ((priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) !=
-           (priv->active_rxon.flags & RXON_FLG_BAND_24G_MSK))
-               return 1;
-
-       /* Check if we are switching association toggle */
-       if ((priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) !=
-               (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK))
-               return 1;
-
-       return 0;
-}
-
-static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
+static int iwl3945_send_rxon_assoc(struct iwl_priv *priv)
 {
        int rc = 0;
-       struct iwl3945_rx_packet *res = NULL;
+       struct iwl_rx_packet *res = NULL;
        struct iwl3945_rxon_assoc_cmd rxon_assoc;
-       struct iwl3945_host_cmd cmd = {
+       struct iwl_host_cmd cmd = {
                .id = REPLY_RXON_ASSOC,
                .len = sizeof(rxon_assoc),
                .meta.flags = CMD_WANT_SKB,
                .data = &rxon_assoc,
        };
-       const struct iwl3945_rxon_cmd *rxon1 = &priv->staging_rxon;
-       const struct iwl3945_rxon_cmd *rxon2 = &priv->active_rxon;
+       const struct iwl_rxon_cmd *rxon1 = &priv->staging_rxon;
+       const struct iwl_rxon_cmd *rxon2 = &priv->active_rxon;
 
        if ((rxon1->flags == rxon2->flags) &&
            (rxon1->filter_flags == rxon2->filter_flags) &&
            (rxon1->cck_basic_rates == rxon2->cck_basic_rates) &&
            (rxon1->ofdm_basic_rates == rxon2->ofdm_basic_rates)) {
-               IWL_DEBUG_INFO("Using current RXON_ASSOC.  Not resending.\n");
+               IWL_DEBUG_INFO(priv, "Using current RXON_ASSOC.  Not resending.\n");
                return 0;
        }
 
@@ -994,13 +261,13 @@ static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
        rxon_assoc.cck_basic_rates = priv->staging_rxon.cck_basic_rates;
        rxon_assoc.reserved = 0;
 
-       rc = iwl3945_send_cmd_sync(priv, &cmd);
+       rc = iwl_send_cmd_sync(priv, &cmd);
        if (rc)
                return rc;
 
-       res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
+       res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_RXON_ASSOC command\n");
+               IWL_ERR(priv, "Bad return from REPLY_RXON_ASSOC command\n");
                rc = -EIO;
        }
 
@@ -1010,6 +277,43 @@ static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
        return rc;
 }
 
+/**
+ * iwl3945_get_antenna_flags - Get antenna flags for RXON command
+ * @priv: eeprom and antenna fields are used to determine antenna flags
+ *
+ * priv->eeprom39  is used to determine if antenna AUX/MAIN are reversed
+ * iwl3945_mod_params.antenna specifies the antenna diversity mode:
+ *
+ * IWL_ANTENNA_DIVERSITY - NIC selects best antenna by itself
+ * IWL_ANTENNA_MAIN      - Force MAIN antenna
+ * IWL_ANTENNA_AUX       - Force AUX antenna
+ */
+__le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv)
+{
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
+
+       switch (iwl3945_mod_params.antenna) {
+       case IWL_ANTENNA_DIVERSITY:
+               return 0;
+
+       case IWL_ANTENNA_MAIN:
+               if (eeprom->antenna_switch_type)
+                       return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK;
+               return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK;
+
+       case IWL_ANTENNA_AUX:
+               if (eeprom->antenna_switch_type)
+                       return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_A_MSK;
+               return RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_B_MSK;
+       }
+
+       /* bad antenna selector value */
+       IWL_ERR(priv, "Bad antenna selector value (0x%x)\n",
+               iwl3945_mod_params.antenna);
+
+       return 0;               /* "diversity" is default if error */
+}
+
 /**
  * iwl3945_commit_rxon - commit staging_rxon to hardware
  *
@@ -1018,41 +322,42 @@ static int iwl3945_send_rxon_assoc(struct iwl3945_priv *priv)
  * function correctly transitions out of the RXON_ASSOC_MSK state if
  * a HW tune is required based on the RXON structure changes.
  */
-static int iwl3945_commit_rxon(struct iwl3945_priv *priv)
+static int iwl3945_commit_rxon(struct iwl_priv *priv)
 {
        /* cast away the const for active_rxon in this function */
        struct iwl3945_rxon_cmd *active_rxon = (void *)&priv->active_rxon;
+       struct iwl3945_rxon_cmd *staging_rxon = (void *)&priv->staging_rxon;
        int rc = 0;
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -1;
 
        /* always get timestamp with Rx frame */
-       priv->staging_rxon.flags |= RXON_FLG_TSF2HOST_MSK;
+       staging_rxon->flags |= RXON_FLG_TSF2HOST_MSK;
 
        /* select antenna */
-       priv->staging_rxon.flags &=
+       staging_rxon->flags &=
            ~(RXON_FLG_DIS_DIV_MSK | RXON_FLG_ANT_SEL_MSK);
-       priv->staging_rxon.flags |= iwl3945_get_antenna_flags(priv);
+       staging_rxon->flags |= iwl3945_get_antenna_flags(priv);
 
-       rc = iwl3945_check_rxon_cmd(&priv->staging_rxon);
+       rc = iwl_check_rxon_cmd(priv);
        if (rc) {
-               IWL_ERROR("Invalid RXON configuration.  Not committing.\n");
+               IWL_ERR(priv, "Invalid RXON configuration.  Not committing.\n");
                return -EINVAL;
        }
 
        /* If we don't need to send a full RXON, we can use
         * iwl3945_rxon_assoc_cmd which is used to reconfigure filter
         * and other flags for the current radio configuration. */
-       if (!iwl3945_full_rxon_required(priv)) {
+       if (!iwl_full_rxon_required(priv)) {
                rc = iwl3945_send_rxon_assoc(priv);
                if (rc) {
-                       IWL_ERROR("Error setting RXON_ASSOC "
+                       IWL_ERR(priv, "Error setting RXON_ASSOC "
                                  "configuration (%d).\n", rc);
                        return rc;
                }
 
-               memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
+               memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
 
                return 0;
        }
@@ -1061,12 +366,18 @@ static int iwl3945_commit_rxon(struct iwl3945_priv *priv)
         * an RXON_ASSOC and the new config wants the associated mask enabled,
         * we must clear the associated from the active configuration
         * before we apply the new config */
-       if (iwl3945_is_associated(priv) &&
-           (priv->staging_rxon.filter_flags & RXON_FILTER_ASSOC_MSK)) {
-               IWL_DEBUG_INFO("Toggling associated bit on current RXON\n");
+       if (iwl_is_associated(priv) &&
+           (staging_rxon->filter_flags & RXON_FILTER_ASSOC_MSK)) {
+               IWL_DEBUG_INFO(priv, "Toggling associated bit on current RXON\n");
                active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
 
-               rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON,
+               /*
+                * reserved4 and 5 could have been filled by the iwlcore code.
+                * Let's clear them before pushing to the 3945.
+                */
+               active_rxon->reserved4 = 0;
+               active_rxon->reserved5 = 0;
+               rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
                                      sizeof(struct iwl3945_rxon_cmd),
                                      &priv->active_rxon);
 
@@ -1074,231 +385,78 @@ static int iwl3945_commit_rxon(struct iwl3945_priv *priv)
                 * active_rxon back to what it was previously */
                if (rc) {
                        active_rxon->filter_flags |= RXON_FILTER_ASSOC_MSK;
-                       IWL_ERROR("Error clearing ASSOC_MSK on current "
+                       IWL_ERR(priv, "Error clearing ASSOC_MSK on current "
                                  "configuration (%d).\n", rc);
                        return rc;
                }
        }
 
-       IWL_DEBUG_INFO("Sending RXON\n"
+       IWL_DEBUG_INFO(priv, "Sending RXON\n"
                       "* with%s RXON_FILTER_ASSOC_MSK\n"
                       "* channel = %d\n"
                       "* bssid = %pM\n",
                       ((priv->staging_rxon.filter_flags &
                         RXON_FILTER_ASSOC_MSK) ? "" : "out"),
-                      le16_to_cpu(priv->staging_rxon.channel),
-                      priv->staging_rxon.bssid_addr);
+                      le16_to_cpu(staging_rxon->channel),
+                      staging_rxon->bssid_addr);
+
+       /*
+        * reserved4 and 5 could have been filled by the iwlcore code.
+        * Let's clear them before pushing to the 3945.
+        */
+       staging_rxon->reserved4 = 0;
+       staging_rxon->reserved5 = 0;
 
        /* Apply the new configuration */
-       rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON,
-                             sizeof(struct iwl3945_rxon_cmd), &priv->staging_rxon);
+       rc = iwl_send_cmd_pdu(priv, REPLY_RXON,
+                             sizeof(struct iwl3945_rxon_cmd),
+                             staging_rxon);
        if (rc) {
-               IWL_ERROR("Error setting new configuration (%d).\n", rc);
+               IWL_ERR(priv, "Error setting new configuration (%d).\n", rc);
                return rc;
        }
 
-       memcpy(active_rxon, &priv->staging_rxon, sizeof(*active_rxon));
+       memcpy(active_rxon, staging_rxon, sizeof(*active_rxon));
 
        iwl3945_clear_stations_table(priv);
 
        /* If we issue a new RXON command which required a tune then we must
         * send a new TXPOWER command or we won't be able to Tx any frames */
-       rc = iwl3945_hw_reg_send_txpower(priv);
+       rc = priv->cfg->ops->lib->send_tx_power(priv);
        if (rc) {
-               IWL_ERROR("Error setting Tx power (%d).\n", rc);
+               IWL_ERR(priv, "Error setting Tx power (%d).\n", rc);
                return rc;
        }
 
        /* Add the broadcast address so we can send broadcast frames */
-       if (iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0) ==
+       if (iwl3945_add_station(priv, iwl_bcast_addr, 0, 0) ==
            IWL_INVALID_STATION) {
-               IWL_ERROR("Error adding BROADCAST address for transmit.\n");
+               IWL_ERR(priv, "Error adding BROADCAST address for transmit.\n");
                return -EIO;
        }
 
        /* If we have set the ASSOC_MSK and we are in BSS mode then
         * add the IWL_AP_ID to the station rate table */
-       if (iwl3945_is_associated(priv) &&
+       if (iwl_is_associated(priv) &&
            (priv->iw_mode == NL80211_IFTYPE_STATION))
-               if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr, 1, 0)
+               if (iwl3945_add_station(priv, priv->active_rxon.bssid_addr,
+                                       1, 0)
                    == IWL_INVALID_STATION) {
-                       IWL_ERROR("Error adding AP address for transmit.\n");
+                       IWL_ERR(priv, "Error adding AP address for transmit\n");
                        return -EIO;
                }
 
        /* Init the hardware's rate fallback order based on the band */
        rc = iwl3945_init_hw_rate_table(priv);
        if (rc) {
-               IWL_ERROR("Error setting HW rate table: %02X\n", rc);
+               IWL_ERR(priv, "Error setting HW rate table: %02X\n", rc);
                return -EIO;
        }
 
        return 0;
 }
 
-static int iwl3945_send_bt_config(struct iwl3945_priv *priv)
-{
-       struct iwl3945_bt_cmd bt_cmd = {
-               .flags = 3,
-               .lead_time = 0xAA,
-               .max_kill = 1,
-               .kill_ack_mask = 0,
-               .kill_cts_mask = 0,
-       };
-
-       return iwl3945_send_cmd_pdu(priv, REPLY_BT_CONFIG,
-                               sizeof(struct iwl3945_bt_cmd), &bt_cmd);
-}
-
-static int iwl3945_send_scan_abort(struct iwl3945_priv *priv)
-{
-       int rc = 0;
-       struct iwl3945_rx_packet *res;
-       struct iwl3945_host_cmd cmd = {
-               .id = REPLY_SCAN_ABORT_CMD,
-               .meta.flags = CMD_WANT_SKB,
-       };
-
-       /* If there isn't a scan actively going on in the hardware
-        * then we are in between scan bands and not actually
-        * actively scanning, so don't send the abort command */
-       if (!test_bit(STATUS_SCAN_HW, &priv->status)) {
-               clear_bit(STATUS_SCAN_ABORTING, &priv->status);
-               return 0;
-       }
-
-       rc = iwl3945_send_cmd_sync(priv, &cmd);
-       if (rc) {
-               clear_bit(STATUS_SCAN_ABORTING, &priv->status);
-               return rc;
-       }
-
-       res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
-       if (res->u.status != CAN_ABORT_STATUS) {
-               /* The scan abort will return 1 for success or
-                * 2 for "failure".  A failure condition can be
-                * due to simply not being in an active scan which
-                * can occur if we send the scan abort before we
-                * the microcode has notified us that a scan is
-                * completed. */
-               IWL_DEBUG_INFO("SCAN_ABORT returned %d.\n", res->u.status);
-               clear_bit(STATUS_SCAN_ABORTING, &priv->status);
-               clear_bit(STATUS_SCAN_HW, &priv->status);
-       }
-
-       dev_kfree_skb_any(cmd.meta.u.skb);
-
-       return rc;
-}
-
-static int iwl3945_card_state_sync_callback(struct iwl3945_priv *priv,
-                                       struct iwl3945_cmd *cmd,
-                                       struct sk_buff *skb)
-{
-       return 1;
-}
-
-/*
- * CARD_STATE_CMD
- *
- * Use: Sets the device's internal card state to enable, disable, or halt
- *
- * When in the 'enable' state the card operates as normal.
- * When in the 'disable' state, the card enters into a low power mode.
- * When in the 'halt' state, the card is shut down and must be fully
- * restarted to come back on.
- */
-static int iwl3945_send_card_state(struct iwl3945_priv *priv, u32 flags, u8 meta_flag)
-{
-       struct iwl3945_host_cmd cmd = {
-               .id = REPLY_CARD_STATE_CMD,
-               .len = sizeof(u32),
-               .data = &flags,
-               .meta.flags = meta_flag,
-       };
-
-       if (meta_flag & CMD_ASYNC)
-               cmd.meta.u.callback = iwl3945_card_state_sync_callback;
-
-       return iwl3945_send_cmd(priv, &cmd);
-}
-
-static int iwl3945_add_sta_sync_callback(struct iwl3945_priv *priv,
-                                    struct iwl3945_cmd *cmd, struct sk_buff *skb)
-{
-       struct iwl3945_rx_packet *res = NULL;
-
-       if (!skb) {
-               IWL_ERROR("Error: Response NULL in REPLY_ADD_STA.\n");
-               return 1;
-       }
-
-       res = (struct iwl3945_rx_packet *)skb->data;
-       if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
-                         res->hdr.flags);
-               return 1;
-       }
-
-       switch (res->u.add_sta.status) {
-       case ADD_STA_SUCCESS_MSK:
-               break;
-       default:
-               break;
-       }
-
-       /* We didn't cache the SKB; let the caller free it */
-       return 1;
-}
-
-int iwl3945_send_add_station(struct iwl3945_priv *priv,
-                        struct iwl3945_addsta_cmd *sta, u8 flags)
-{
-       struct iwl3945_rx_packet *res = NULL;
-       int rc = 0;
-       struct iwl3945_host_cmd cmd = {
-               .id = REPLY_ADD_STA,
-               .len = sizeof(struct iwl3945_addsta_cmd),
-               .meta.flags = flags,
-               .data = sta,
-       };
-
-       if (flags & CMD_ASYNC)
-               cmd.meta.u.callback = iwl3945_add_sta_sync_callback;
-       else
-               cmd.meta.flags |= CMD_WANT_SKB;
-
-       rc = iwl3945_send_cmd(priv, &cmd);
-
-       if (rc || (flags & CMD_ASYNC))
-               return rc;
-
-       res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
-       if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_ADD_STA (0x%08X)\n",
-                         res->hdr.flags);
-               rc = -EIO;
-       }
-
-       if (rc == 0) {
-               switch (res->u.add_sta.status) {
-               case ADD_STA_SUCCESS_MSK:
-                       IWL_DEBUG_INFO("REPLY_ADD_STA PASSED\n");
-                       break;
-               default:
-                       rc = -EIO;
-                       IWL_WARNING("REPLY_ADD_STA failed\n");
-                       break;
-               }
-       }
-
-       priv->alloc_rxb_skb--;
-       dev_kfree_skb_any(cmd.meta.u.skb);
-
-       return rc;
-}
-
-static int iwl3945_update_sta_key_info(struct iwl3945_priv *priv,
+static int iwl3945_update_sta_key_info(struct iwl_priv *priv,
                                   struct ieee80211_key_conf *keyconf,
                                   u8 sta_id)
 {
@@ -1318,46 +476,49 @@ static int iwl3945_update_sta_key_info(struct iwl3945_priv *priv,
                return -EINVAL;
        }
        spin_lock_irqsave(&priv->sta_lock, flags);
-       priv->stations[sta_id].keyinfo.alg = keyconf->alg;
-       priv->stations[sta_id].keyinfo.keylen = keyconf->keylen;
-       memcpy(priv->stations[sta_id].keyinfo.key, keyconf->key,
+       priv->stations_39[sta_id].keyinfo.alg = keyconf->alg;
+       priv->stations_39[sta_id].keyinfo.keylen = keyconf->keylen;
+       memcpy(priv->stations_39[sta_id].keyinfo.key, keyconf->key,
               keyconf->keylen);
 
-       memcpy(priv->stations[sta_id].sta.key.key, keyconf->key,
+       memcpy(priv->stations_39[sta_id].sta.key.key, keyconf->key,
               keyconf->keylen);
-       priv->stations[sta_id].sta.key.key_flags = key_flags;
-       priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
-       priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+       priv->stations_39[sta_id].sta.key.key_flags = key_flags;
+       priv->stations_39[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
+       priv->stations_39[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
 
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 
-       IWL_DEBUG_INFO("hwcrypto: modify ucode station key info\n");
-       iwl3945_send_add_station(priv, &priv->stations[sta_id].sta, 0);
+       IWL_DEBUG_INFO(priv, "hwcrypto: modify ucode station key info\n");
+       iwl_send_add_sta(priv,
+               (struct iwl_addsta_cmd *)&priv->stations_39[sta_id].sta, 0);
        return 0;
 }
 
-static int iwl3945_clear_sta_key_info(struct iwl3945_priv *priv, u8 sta_id)
+static int iwl3945_clear_sta_key_info(struct iwl_priv *priv, u8 sta_id)
 {
        unsigned long flags;
 
        spin_lock_irqsave(&priv->sta_lock, flags);
-       memset(&priv->stations[sta_id].keyinfo, 0, sizeof(struct iwl3945_hw_key));
-       memset(&priv->stations[sta_id].sta.key, 0, sizeof(struct iwl3945_keyinfo));
-       priv->stations[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
-       priv->stations[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
-       priv->stations[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
+       memset(&priv->stations_39[sta_id].keyinfo, 0, sizeof(struct iwl3945_hw_key));
+       memset(&priv->stations_39[sta_id].sta.key, 0,
+               sizeof(struct iwl4965_keyinfo));
+       priv->stations_39[sta_id].sta.key.key_flags = STA_KEY_FLG_NO_ENC;
+       priv->stations_39[sta_id].sta.sta.modify_mask = STA_MODIFY_KEY_MASK;
+       priv->stations_39[sta_id].sta.mode = STA_CONTROL_MODIFY_MSK;
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 
-       IWL_DEBUG_INFO("hwcrypto: clear ucode station key info\n");
-       iwl3945_send_add_station(priv, &priv->stations[sta_id].sta, 0);
+       IWL_DEBUG_INFO(priv, "hwcrypto: clear ucode station key info\n");
+       iwl_send_add_sta(priv,
+               (struct iwl_addsta_cmd *)&priv->stations_39[sta_id].sta, 0);
        return 0;
 }
 
-static void iwl3945_clear_free_frames(struct iwl3945_priv *priv)
+static void iwl3945_clear_free_frames(struct iwl_priv *priv)
 {
        struct list_head *element;
 
-       IWL_DEBUG_INFO("%d frames on pre-allocated heap on clear.\n",
+       IWL_DEBUG_INFO(priv, "%d frames on pre-allocated heap on clear.\n",
                       priv->frames_count);
 
        while (!list_empty(&priv->free_frames)) {
@@ -1368,20 +529,20 @@ static void iwl3945_clear_free_frames(struct iwl3945_priv *priv)
        }
 
        if (priv->frames_count) {
-               IWL_WARNING("%d frames still in use.  Did we lose one?\n",
+               IWL_WARN(priv, "%d frames still in use.  Did we lose one?\n",
                            priv->frames_count);
                priv->frames_count = 0;
        }
 }
 
-static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl3945_priv *priv)
+static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl_priv *priv)
 {
        struct iwl3945_frame *frame;
        struct list_head *element;
        if (list_empty(&priv->free_frames)) {
                frame = kzalloc(sizeof(*frame), GFP_KERNEL);
                if (!frame) {
-                       IWL_ERROR("Could not allocate frame!\n");
+                       IWL_ERR(priv, "Could not allocate frame!\n");
                        return NULL;
                }
 
@@ -1394,18 +555,18 @@ static struct iwl3945_frame *iwl3945_get_free_frame(struct iwl3945_priv *priv)
        return list_entry(element, struct iwl3945_frame, list);
 }
 
-static void iwl3945_free_frame(struct iwl3945_priv *priv, struct iwl3945_frame *frame)
+static void iwl3945_free_frame(struct iwl_priv *priv, struct iwl3945_frame *frame)
 {
        memset(frame, 0, sizeof(*frame));
        list_add(&frame->list, &priv->free_frames);
 }
 
-unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
+unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
                                struct ieee80211_hdr *hdr,
                                int left)
 {
 
-       if (!iwl3945_is_associated(priv) || !priv->ibss_beacon ||
+       if (!iwl_is_associated(priv) || !priv->ibss_beacon ||
            ((priv->iw_mode != NL80211_IFTYPE_ADHOC) &&
             (priv->iw_mode != NL80211_IFTYPE_AP)))
                return 0;
@@ -1418,31 +579,7 @@ unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv,
        return priv->ibss_beacon->len;
 }
 
-static u8 iwl3945_rate_get_lowest_plcp(struct iwl3945_priv *priv)
-{
-       u8 i;
-       int rate_mask;
-
-       /* Set rate mask*/
-       if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
-               rate_mask = priv->active_rate_basic & IWL_CCK_RATES_MASK;
-       else
-               rate_mask = priv->active_rate_basic & IWL_OFDM_RATES_MASK;
-
-       for (i = IWL_RATE_1M_INDEX; i != IWL_RATE_INVALID;
-            i = iwl3945_rates[i].next_ieee) {
-               if (rate_mask & (1 << i))
-                       return iwl3945_rates[i].plcp;
-       }
-
-       /* No valid rate was found. Assign the lowest one */
-       if (priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK)
-               return IWL_RATE_1M_PLCP;
-       else
-               return IWL_RATE_6M_PLCP;
-}
-
-static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv)
+static int iwl3945_send_beacon_cmd(struct iwl_priv *priv)
 {
        struct iwl3945_frame *frame;
        unsigned int frame_size;
@@ -1452,16 +589,16 @@ static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv)
        frame = iwl3945_get_free_frame(priv);
 
        if (!frame) {
-               IWL_ERROR("Could not obtain free frame buffer for beacon "
+               IWL_ERR(priv, "Could not obtain free frame buffer for beacon "
                          "command.\n");
                return -ENOMEM;
        }
 
-       rate = iwl3945_rate_get_lowest_plcp(priv);
+       rate = iwl_rate_get_lowest_plcp(priv);
 
        frame_size = iwl3945_hw_get_beacon_cmd(priv, frame, rate);
 
-       rc = iwl3945_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
+       rc = iwl_send_cmd_pdu(priv, REPLY_TX_BEACON, frame_size,
                              &frame->u.cmd[0]);
 
        iwl3945_free_frame(priv, frame);
@@ -1469,307 +606,27 @@ static int iwl3945_send_beacon_cmd(struct iwl3945_priv *priv)
        return rc;
 }
 
-/******************************************************************************
- *
- * EEPROM related functions
- *
- ******************************************************************************/
-
-static void get_eeprom_mac(struct iwl3945_priv *priv, u8 *mac)
-{
-       memcpy(mac, priv->eeprom.mac_address, 6);
-}
-
-/*
- * Clear the OWNER_MSK, to establish driver (instead of uCode running on
- * embedded controller) as EEPROM reader; each read is a series of pulses
- * to/from the EEPROM chip, not a single event, so even reads could conflict
- * if they weren't arbitrated by some ownership mechanism.  Here, the driver
- * simply claims ownership, which should be safe when this function is called
- * (i.e. before loading uCode!).
- */
-static inline int iwl3945_eeprom_acquire_semaphore(struct iwl3945_priv *priv)
-{
-       _iwl3945_clear_bit(priv, CSR_EEPROM_GP, CSR_EEPROM_GP_IF_OWNER_MSK);
-       return 0;
-}
-
-/**
- * iwl3945_eeprom_init - read EEPROM contents
- *
- * Load the EEPROM contents from adapter into priv->eeprom
- *
- * NOTE:  This routine uses the non-debug IO access functions.
- */
-int iwl3945_eeprom_init(struct iwl3945_priv *priv)
-{
-       u16 *e = (u16 *)&priv->eeprom;
-       u32 gp = iwl3945_read32(priv, CSR_EEPROM_GP);
-       int sz = sizeof(priv->eeprom);
-       int ret;
-       u16 addr;
-
-       /* The EEPROM structure has several padding buffers within it
-        * and when adding new EEPROM maps is subject to programmer errors
-        * which may be very difficult to identify without explicitly
-        * checking the resulting size of the eeprom map. */
-       BUILD_BUG_ON(sizeof(priv->eeprom) != IWL_EEPROM_IMAGE_SIZE);
-
-       if ((gp & CSR_EEPROM_GP_VALID_MSK) == CSR_EEPROM_GP_BAD_SIGNATURE) {
-               IWL_ERROR("EEPROM not found, EEPROM_GP=0x%08x\n", gp);
-               return -ENOENT;
-       }
-
-       /* Make sure driver (instead of uCode) is allowed to read EEPROM */
-       ret = iwl3945_eeprom_acquire_semaphore(priv);
-       if (ret < 0) {
-               IWL_ERROR("Failed to acquire EEPROM semaphore.\n");
-               return -ENOENT;
-       }
-
-       /* eeprom is an array of 16bit values */
-       for (addr = 0; addr < sz; addr += sizeof(u16)) {
-               u32 r;
-
-               _iwl3945_write32(priv, CSR_EEPROM_REG,
-                                CSR_EEPROM_REG_MSK_ADDR & (addr << 1));
-               _iwl3945_clear_bit(priv, CSR_EEPROM_REG, CSR_EEPROM_REG_BIT_CMD);
-               ret = iwl3945_poll_direct_bit(priv, CSR_EEPROM_REG,
-                                             CSR_EEPROM_REG_READ_VALID_MSK,
-                                             IWL_EEPROM_ACCESS_TIMEOUT);
-               if (ret < 0) {
-                       IWL_ERROR("Time out reading EEPROM[%d]\n", addr);
-                       return ret;
-               }
-
-               r = _iwl3945_read_direct32(priv, CSR_EEPROM_REG);
-               e[addr / 2] = le16_to_cpu((__force __le16)(r >> 16));
-       }
-
-       return 0;
-}
-
-static void iwl3945_unset_hw_setting(struct iwl3945_priv *priv)
+static void iwl3945_unset_hw_params(struct iwl_priv *priv)
 {
-       if (priv->hw_setting.shared_virt)
+       if (priv->shared_virt)
                pci_free_consistent(priv->pci_dev,
                                    sizeof(struct iwl3945_shared),
-                                   priv->hw_setting.shared_virt,
-                                   priv->hw_setting.shared_phys);
-}
-
-/**
- * iwl3945_supported_rate_to_ie - fill in the supported rate in IE field
- *
- * return : set the bit for each supported rate insert in ie
- */
-static u16 iwl3945_supported_rate_to_ie(u8 *ie, u16 supported_rate,
-                                   u16 basic_rate, int *left)
-{
-       u16 ret_rates = 0, bit;
-       int i;
-       u8 *cnt = ie;
-       u8 *rates = ie + 1;
-
-       for (bit = 1, i = 0; i < IWL_RATE_COUNT; i++, bit <<= 1) {
-               if (bit & supported_rate) {
-                       ret_rates |= bit;
-                       rates[*cnt] = iwl3945_rates[i].ieee |
-                               ((bit & basic_rate) ? 0x80 : 0x00);
-                       (*cnt)++;
-                       (*left)--;
-                       if ((*left <= 0) ||
-                           (*cnt >= IWL_SUPPORTED_RATES_IE_LEN))
-                               break;
-               }
-       }
-
-       return ret_rates;
-}
-
-/**
- * iwl3945_fill_probe_req - fill in all required fields and IE for probe request
- */
-static u16 iwl3945_fill_probe_req(struct iwl3945_priv *priv,
-                             struct ieee80211_mgmt *frame,
-                             int left)
-{
-       int len = 0;
-       u8 *pos = NULL;
-       u16 active_rates, ret_rates, cck_rates;
-
-       /* Make sure there is enough space for the probe request,
-        * two mandatory IEs and the data */
-       left -= 24;
-       if (left < 0)
-               return 0;
-       len += 24;
-
-       frame->frame_control = cpu_to_le16(IEEE80211_STYPE_PROBE_REQ);
-       memcpy(frame->da, iwl3945_broadcast_addr, ETH_ALEN);
-       memcpy(frame->sa, priv->mac_addr, ETH_ALEN);
-       memcpy(frame->bssid, iwl3945_broadcast_addr, ETH_ALEN);
-       frame->seq_ctrl = 0;
-
-       /* fill in our indirect SSID IE */
-       /* ...next IE... */
-
-       left -= 2;
-       if (left < 0)
-               return 0;
-       len += 2;
-       pos = &(frame->u.probe_req.variable[0]);
-       *pos++ = WLAN_EID_SSID;
-       *pos++ = 0;
-
-       /* fill in supported rate */
-       /* ...next IE... */
-       left -= 2;
-       if (left < 0)
-               return 0;
-
-       /* ... fill it in... */
-       *pos++ = WLAN_EID_SUPP_RATES;
-       *pos = 0;
-
-       priv->active_rate = priv->rates_mask;
-       active_rates = priv->active_rate;
-       priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
-
-       cck_rates = IWL_CCK_RATES_MASK & active_rates;
-       ret_rates = iwl3945_supported_rate_to_ie(pos, cck_rates,
-                       priv->active_rate_basic, &left);
-       active_rates &= ~ret_rates;
-
-       ret_rates = iwl3945_supported_rate_to_ie(pos, active_rates,
-                                priv->active_rate_basic, &left);
-       active_rates &= ~ret_rates;
-
-       len += 2 + *pos;
-       pos += (*pos) + 1;
-       if (active_rates == 0)
-               goto fill_end;
-
-       /* fill in supported extended rate */
-       /* ...next IE... */
-       left -= 2;
-       if (left < 0)
-               return 0;
-       /* ... fill it in... */
-       *pos++ = WLAN_EID_EXT_SUPP_RATES;
-       *pos = 0;
-       iwl3945_supported_rate_to_ie(pos, active_rates,
-                                priv->active_rate_basic, &left);
-       if (*pos > 0)
-               len += 2 + *pos;
-
- fill_end:
-       return (u16)len;
+                                   priv->shared_virt,
+                                   priv->shared_phys);
 }
 
 /*
  * QoS  support
 */
-static int iwl3945_send_qos_params_command(struct iwl3945_priv *priv,
-                                      struct iwl3945_qosparam_cmd *qos)
-{
-
-       return iwl3945_send_cmd_pdu(priv, REPLY_QOS_PARAM,
-                               sizeof(struct iwl3945_qosparam_cmd), qos);
-}
-
-static void iwl3945_reset_qos(struct iwl3945_priv *priv)
+static int iwl3945_send_qos_params_command(struct iwl_priv *priv,
+                                      struct iwl_qosparam_cmd *qos)
 {
-       u16 cw_min = 15;
-       u16 cw_max = 1023;
-       u8 aifs = 2;
-       u8 is_legacy = 0;
-       unsigned long flags;
-       int i;
-
-       spin_lock_irqsave(&priv->lock, flags);
-       priv->qos_data.qos_active = 0;
-
-       /* QoS always active in AP and ADHOC mode
-        * In STA mode wait for association
-        */
-       if (priv->iw_mode == NL80211_IFTYPE_ADHOC ||
-           priv->iw_mode == NL80211_IFTYPE_AP)
-               priv->qos_data.qos_active = 1;
-       else
-               priv->qos_data.qos_active = 0;
-
-
-       /* check for legacy mode */
-       if ((priv->iw_mode == NL80211_IFTYPE_ADHOC &&
-            (priv->active_rate & IWL_OFDM_RATES_MASK) == 0) ||
-           (priv->iw_mode == NL80211_IFTYPE_STATION &&
-            (priv->staging_rxon.flags & RXON_FLG_SHORT_SLOT_MSK) == 0)) {
-               cw_min = 31;
-               is_legacy = 1;
-       }
-
-       if (priv->qos_data.qos_active)
-               aifs = 3;
-
-       priv->qos_data.def_qos_parm.ac[0].cw_min = cpu_to_le16(cw_min);
-       priv->qos_data.def_qos_parm.ac[0].cw_max = cpu_to_le16(cw_max);
-       priv->qos_data.def_qos_parm.ac[0].aifsn = aifs;
-       priv->qos_data.def_qos_parm.ac[0].edca_txop = 0;
-       priv->qos_data.def_qos_parm.ac[0].reserved1 = 0;
-
-       if (priv->qos_data.qos_active) {
-               i = 1;
-               priv->qos_data.def_qos_parm.ac[i].cw_min = cpu_to_le16(cw_min);
-               priv->qos_data.def_qos_parm.ac[i].cw_max = cpu_to_le16(cw_max);
-               priv->qos_data.def_qos_parm.ac[i].aifsn = 7;
-               priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
-               priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
-
-               i = 2;
-               priv->qos_data.def_qos_parm.ac[i].cw_min =
-                       cpu_to_le16((cw_min + 1) / 2 - 1);
-               priv->qos_data.def_qos_parm.ac[i].cw_max =
-                       cpu_to_le16(cw_max);
-               priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
-               if (is_legacy)
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop =
-                               cpu_to_le16(6016);
-               else
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop =
-                               cpu_to_le16(3008);
-               priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
-
-               i = 3;
-               priv->qos_data.def_qos_parm.ac[i].cw_min =
-                       cpu_to_le16((cw_min + 1) / 4 - 1);
-               priv->qos_data.def_qos_parm.ac[i].cw_max =
-                       cpu_to_le16((cw_max + 1) / 2 - 1);
-               priv->qos_data.def_qos_parm.ac[i].aifsn = 2;
-               priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
-               if (is_legacy)
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop =
-                               cpu_to_le16(3264);
-               else
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop =
-                               cpu_to_le16(1504);
-       } else {
-               for (i = 1; i < 4; i++) {
-                       priv->qos_data.def_qos_parm.ac[i].cw_min =
-                               cpu_to_le16(cw_min);
-                       priv->qos_data.def_qos_parm.ac[i].cw_max =
-                               cpu_to_le16(cw_max);
-                       priv->qos_data.def_qos_parm.ac[i].aifsn = aifs;
-                       priv->qos_data.def_qos_parm.ac[i].edca_txop = 0;
-                       priv->qos_data.def_qos_parm.ac[i].reserved1 = 0;
-               }
-       }
-       IWL_DEBUG_QOS("set QoS to default \n");
 
-       spin_unlock_irqrestore(&priv->lock, flags);
+       return iwl_send_cmd_pdu(priv, REPLY_QOS_PARAM,
+                               sizeof(struct iwl_qosparam_cmd), qos);
 }
 
-static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
+static void iwl3945_activate_qos(struct iwl_priv *priv, u8 force)
 {
        unsigned long flags;
 
@@ -1790,8 +647,8 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       if (force || iwl3945_is_associated(priv)) {
-               IWL_DEBUG_QOS("send QoS cmd with QoS active %d \n",
+       if (force || iwl_is_associated(priv)) {
+               IWL_DEBUG_QOS(priv, "send QoS cmd with QoS active %d \n",
                              priv->qos_data.qos_active);
 
                iwl3945_send_qos_params_command(priv,
@@ -1799,236 +656,9 @@ static void iwl3945_activate_qos(struct iwl3945_priv *priv, u8 force)
        }
 }
 
-/*
- * Power management (not Tx power!) functions
- */
-#define MSEC_TO_USEC 1024
-
-#define NOSLP __constant_cpu_to_le32(0)
-#define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK
-#define SLP_TIMEOUT(T) __constant_cpu_to_le32((T) * MSEC_TO_USEC)
-#define SLP_VEC(X0, X1, X2, X3, X4) {__constant_cpu_to_le32(X0), \
-                                    __constant_cpu_to_le32(X1), \
-                                    __constant_cpu_to_le32(X2), \
-                                    __constant_cpu_to_le32(X3), \
-                                    __constant_cpu_to_le32(X4)}
-
-
-/* default power management (not Tx power) table values */
-/* for TIM  0-10 */
-static struct iwl3945_power_vec_entry range_0[IWL_POWER_AC] = {
-       {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
-       {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0},
-       {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300), SLP_VEC(2, 4, 6, 7, 7)}, 0},
-       {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(100), SLP_VEC(2, 6, 9, 9, 10)}, 0},
-       {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(25), SLP_VEC(2, 7, 9, 9, 10)}, 1},
-       {{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25), SLP_VEC(4, 7, 10, 10, 10)}, 1}
-};
-
-/* for TIM > 10 */
-static struct iwl3945_power_vec_entry range_1[IWL_POWER_AC] = {
-       {{NOSLP, SLP_TIMEOUT(0), SLP_TIMEOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0},
-       {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(500),
-                SLP_VEC(1, 2, 3, 4, 0xFF)}, 0},
-       {{SLP, SLP_TIMEOUT(200), SLP_TIMEOUT(300),
-                SLP_VEC(2, 4, 6, 7, 0xFF)}, 0},
-       {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(100),
-                SLP_VEC(2, 6, 9, 9, 0xFF)}, 0},
-       {{SLP, SLP_TIMEOUT(50), SLP_TIMEOUT(25), SLP_VEC(2, 7, 9, 9, 0xFF)}, 0},
-       {{SLP, SLP_TIMEOUT(25), SLP_TIMEOUT(25),
-                SLP_VEC(4, 7, 10, 10, 0xFF)}, 0}
-};
-
-int iwl3945_power_init_handle(struct iwl3945_priv *priv)
-{
-       int rc = 0, i;
-       struct iwl3945_power_mgr *pow_data;
-       int size = sizeof(struct iwl3945_power_vec_entry) * IWL_POWER_AC;
-       u16 pci_pm;
-
-       IWL_DEBUG_POWER("Initialize power \n");
-
-       pow_data = &(priv->power_data);
-
-       memset(pow_data, 0, sizeof(*pow_data));
-
-       pow_data->active_index = IWL_POWER_RANGE_0;
-       pow_data->dtim_val = 0xffff;
-
-       memcpy(&pow_data->pwr_range_0[0], &range_0[0], size);
-       memcpy(&pow_data->pwr_range_1[0], &range_1[0], size);
-
-       rc = pci_read_config_word(priv->pci_dev, PCI_LINK_CTRL, &pci_pm);
-       if (rc != 0)
-               return 0;
-       else {
-               struct iwl3945_powertable_cmd *cmd;
-
-               IWL_DEBUG_POWER("adjust power command flags\n");
-
-               for (i = 0; i < IWL_POWER_AC; i++) {
-                       cmd = &pow_data->pwr_range_0[i].cmd;
-
-                       if (pci_pm & 0x1)
-                               cmd->flags &= ~IWL_POWER_PCI_PM_MSK;
-                       else
-                               cmd->flags |= IWL_POWER_PCI_PM_MSK;
-               }
-       }
-       return rc;
-}
-
-static int iwl3945_update_power_cmd(struct iwl3945_priv *priv,
-                               struct iwl3945_powertable_cmd *cmd, u32 mode)
-{
-       int rc = 0, i;
-       u8 skip;
-       u32 max_sleep = 0;
-       struct iwl3945_power_vec_entry *range;
-       u8 period = 0;
-       struct iwl3945_power_mgr *pow_data;
-
-       if (mode > IWL_POWER_INDEX_5) {
-               IWL_DEBUG_POWER("Error invalid power mode \n");
-               return -1;
-       }
-       pow_data = &(priv->power_data);
-
-       if (pow_data->active_index == IWL_POWER_RANGE_0)
-               range = &pow_data->pwr_range_0[0];
-       else
-               range = &pow_data->pwr_range_1[1];
-
-       memcpy(cmd, &range[mode].cmd, sizeof(struct iwl3945_powertable_cmd));
-
-#ifdef IWL_MAC80211_DISABLE
-       if (priv->assoc_network != NULL) {
-               unsigned long flags;
-
-               period = priv->assoc_network->tim.tim_period;
-       }
-#endif /*IWL_MAC80211_DISABLE */
-       skip = range[mode].no_dtim;
-
-       if (period == 0) {
-               period = 1;
-               skip = 0;
-       }
-
-       if (skip == 0) {
-               max_sleep = period;
-               cmd->flags &= ~IWL_POWER_SLEEP_OVER_DTIM_MSK;
-       } else {
-               __le32 slp_itrvl = cmd->sleep_interval[IWL_POWER_VEC_SIZE - 1];
-               max_sleep = (le32_to_cpu(slp_itrvl) / period) * period;
-               cmd->flags |= IWL_POWER_SLEEP_OVER_DTIM_MSK;
-       }
-
-       for (i = 0; i < IWL_POWER_VEC_SIZE; i++) {
-               if (le32_to_cpu(cmd->sleep_interval[i]) > max_sleep)
-                       cmd->sleep_interval[i] = cpu_to_le32(max_sleep);
-       }
-
-       IWL_DEBUG_POWER("Flags value = 0x%08X\n", cmd->flags);
-       IWL_DEBUG_POWER("Tx timeout = %u\n", le32_to_cpu(cmd->tx_data_timeout));
-       IWL_DEBUG_POWER("Rx timeout = %u\n", le32_to_cpu(cmd->rx_data_timeout));
-       IWL_DEBUG_POWER("Sleep interval vector = { %d , %d , %d , %d , %d }\n",
-                       le32_to_cpu(cmd->sleep_interval[0]),
-                       le32_to_cpu(cmd->sleep_interval[1]),
-                       le32_to_cpu(cmd->sleep_interval[2]),
-                       le32_to_cpu(cmd->sleep_interval[3]),
-                       le32_to_cpu(cmd->sleep_interval[4]));
-
-       return rc;
-}
-
-static int iwl3945_send_power_mode(struct iwl3945_priv *priv, u32 mode)
-{
-       u32 uninitialized_var(final_mode);
-       int rc;
-       struct iwl3945_powertable_cmd cmd;
-
-       /* If on battery, set to 3,
-        * if plugged into AC power, set to CAM ("continuously aware mode"),
-        * else user level */
-       switch (mode) {
-       case IWL_POWER_BATTERY:
-               final_mode = IWL_POWER_INDEX_3;
-               break;
-       case IWL_POWER_AC:
-               final_mode = IWL_POWER_MODE_CAM;
-               break;
-       default:
-               final_mode = mode;
-               break;
-       }
-
-       iwl3945_update_power_cmd(priv, &cmd, final_mode);
-
-       rc = iwl3945_send_cmd_pdu(priv, POWER_TABLE_CMD, sizeof(cmd), &cmd);
-
-       if (final_mode == IWL_POWER_MODE_CAM)
-               clear_bit(STATUS_POWER_PMI, &priv->status);
-       else
-               set_bit(STATUS_POWER_PMI, &priv->status);
-
-       return rc;
-}
-
-/**
- * iwl3945_scan_cancel - Cancel any currently executing HW scan
- *
- * NOTE: priv->mutex is not required before calling this function
- */
-static int iwl3945_scan_cancel(struct iwl3945_priv *priv)
-{
-       if (!test_bit(STATUS_SCAN_HW, &priv->status)) {
-               clear_bit(STATUS_SCANNING, &priv->status);
-               return 0;
-       }
-
-       if (test_bit(STATUS_SCANNING, &priv->status)) {
-               if (!test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-                       IWL_DEBUG_SCAN("Queuing scan abort.\n");
-                       set_bit(STATUS_SCAN_ABORTING, &priv->status);
-                       queue_work(priv->workqueue, &priv->abort_scan);
-
-               } else
-                       IWL_DEBUG_SCAN("Scan abort already in progress.\n");
-
-               return test_bit(STATUS_SCANNING, &priv->status);
-       }
-
-       return 0;
-}
-
-/**
- * iwl3945_scan_cancel_timeout - Cancel any currently executing HW scan
- * @ms: amount of time to wait (in milliseconds) for scan to abort
- *
- * NOTE: priv->mutex must be held before calling this function
- */
-static int iwl3945_scan_cancel_timeout(struct iwl3945_priv *priv, unsigned long ms)
-{
-       unsigned long now = jiffies;
-       int ret;
-
-       ret = iwl3945_scan_cancel(priv);
-       if (ret && ms) {
-               mutex_unlock(&priv->mutex);
-               while (!time_after(jiffies, now + msecs_to_jiffies(ms)) &&
-                               test_bit(STATUS_SCANNING, &priv->status))
-                       msleep(1);
-               mutex_lock(&priv->mutex);
-
-               return test_bit(STATUS_SCANNING, &priv->status);
-       }
-
-       return ret;
-}
 
 #define MAX_UCODE_BEACON_INTERVAL      1024
-#define INTEL_CONN_LISTEN_INTERVAL     __constant_cpu_to_le16(0xA)
+#define INTEL_CONN_LISTEN_INTERVAL     cpu_to_le16(0xA)
 
 static __le16 iwl3945_adjust_beacon_interval(u16 beacon_val)
 {
@@ -2043,7 +673,7 @@ static __le16 iwl3945_adjust_beacon_interval(u16 beacon_val)
        return cpu_to_le16(new_val);
 }
 
-static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv)
+static void iwl3945_setup_rxon_timing(struct iwl_priv *priv)
 {
        u64 interval_tm_unit;
        u64 tsf, result;
@@ -2054,13 +684,10 @@ static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv)
        conf = ieee80211_get_hw_conf(priv->hw);
 
        spin_lock_irqsave(&priv->lock, flags);
-       priv->rxon_timing.timestamp.dw[1] = cpu_to_le32(priv->timestamp1);
-       priv->rxon_timing.timestamp.dw[0] = cpu_to_le32(priv->timestamp0);
-
+       priv->rxon_timing.timestamp = cpu_to_le64(priv->timestamp);
        priv->rxon_timing.listen_interval = INTEL_CONN_LISTEN_INTERVAL;
 
-       tsf = priv->timestamp1;
-       tsf = ((tsf << 32) | priv->timestamp0);
+       tsf = priv->timestamp;
 
        beacon_int = priv->beacon_int;
        spin_unlock_irqrestore(&priv->lock, flags);
@@ -2092,183 +719,73 @@ static void iwl3945_setup_rxon_timing(struct iwl3945_priv *priv)
        priv->rxon_timing.beacon_init_val =
            cpu_to_le32((u32) ((u64) interval_tm_unit - result));
 
-       IWL_DEBUG_ASSOC
-           ("beacon interval %d beacon timer %d beacon tim %d\n",
+       IWL_DEBUG_ASSOC(priv,
+               "beacon interval %d beacon timer %d beacon tim %d\n",
                le16_to_cpu(priv->rxon_timing.beacon_interval),
                le32_to_cpu(priv->rxon_timing.beacon_init_val),
                le16_to_cpu(priv->rxon_timing.atim_window));
 }
 
-static int iwl3945_scan_initiate(struct iwl3945_priv *priv)
+static int iwl3945_scan_initiate(struct iwl_priv *priv)
 {
-       if (!iwl3945_is_ready_rf(priv)) {
-               IWL_DEBUG_SCAN("Aborting scan due to not ready.\n");
+       if (!iwl_is_ready_rf(priv)) {
+               IWL_DEBUG_SCAN(priv, "Aborting scan due to not ready.\n");
                return -EIO;
        }
 
        if (test_bit(STATUS_SCANNING, &priv->status)) {
-               IWL_DEBUG_SCAN("Scan already in progress.\n");
+               IWL_DEBUG_SCAN(priv, "Scan already in progress.\n");
                return -EAGAIN;
        }
 
        if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG_SCAN("Scan request while abort pending.  "
+               IWL_DEBUG_SCAN(priv, "Scan request while abort pending.  "
                               "Queuing.\n");
-               return -EAGAIN;
-       }
-
-       IWL_DEBUG_INFO("Starting scan...\n");
-       if (priv->cfg->sku & IWL_SKU_G)
-               priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
-       if (priv->cfg->sku & IWL_SKU_A)
-               priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
-       set_bit(STATUS_SCANNING, &priv->status);
-       priv->scan_start = jiffies;
-       priv->scan_pass_start = priv->scan_start;
-
-       queue_work(priv->workqueue, &priv->request_scan);
-
-       return 0;
-}
-
-static int iwl3945_set_rxon_hwcrypto(struct iwl3945_priv *priv, int hw_decrypt)
-{
-       struct iwl3945_rxon_cmd *rxon = &priv->staging_rxon;
-
-       if (hw_decrypt)
-               rxon->filter_flags &= ~RXON_FILTER_DIS_DECRYPT_MSK;
-       else
-               rxon->filter_flags |= RXON_FILTER_DIS_DECRYPT_MSK;
-
-       return 0;
-}
-
-static void iwl3945_set_flags_for_phymode(struct iwl3945_priv *priv,
-                                         enum ieee80211_band band)
-{
-       if (band == IEEE80211_BAND_5GHZ) {
-               priv->staging_rxon.flags &=
-                   ~(RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK
-                     | RXON_FLG_CCK_MSK);
-               priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
-       } else {
-               /* Copied from iwl3945_bg_post_associate() */
-               if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_SLOT_TIME)
-                       priv->staging_rxon.flags |= RXON_FLG_SHORT_SLOT_MSK;
-               else
-                       priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
-
-               if (priv->iw_mode == NL80211_IFTYPE_ADHOC)
-                       priv->staging_rxon.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
-
-               priv->staging_rxon.flags |= RXON_FLG_BAND_24G_MSK;
-               priv->staging_rxon.flags |= RXON_FLG_AUTO_DETECT_MSK;
-               priv->staging_rxon.flags &= ~RXON_FLG_CCK_MSK;
-       }
-}
-
-/*
- * initialize rxon structure with default values from eeprom
- */
-static void iwl3945_connection_init_rx_config(struct iwl3945_priv *priv,
-                                             int mode)
-{
-       const struct iwl3945_channel_info *ch_info;
-
-       memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
-
-       switch (mode) {
-       case NL80211_IFTYPE_AP:
-               priv->staging_rxon.dev_type = RXON_DEV_TYPE_AP;
-               break;
-
-       case NL80211_IFTYPE_STATION:
-               priv->staging_rxon.dev_type = RXON_DEV_TYPE_ESS;
-               priv->staging_rxon.filter_flags = RXON_FILTER_ACCEPT_GRP_MSK;
-               break;
-
-       case NL80211_IFTYPE_ADHOC:
-               priv->staging_rxon.dev_type = RXON_DEV_TYPE_IBSS;
-               priv->staging_rxon.flags = RXON_FLG_SHORT_PREAMBLE_MSK;
-               priv->staging_rxon.filter_flags = RXON_FILTER_BCON_AWARE_MSK |
-                                                 RXON_FILTER_ACCEPT_GRP_MSK;
-               break;
-
-       case NL80211_IFTYPE_MONITOR:
-               priv->staging_rxon.dev_type = RXON_DEV_TYPE_SNIFFER;
-               priv->staging_rxon.filter_flags = RXON_FILTER_PROMISC_MSK |
-                   RXON_FILTER_CTL2HOST_MSK | RXON_FILTER_ACCEPT_GRP_MSK;
-               break;
-       default:
-               IWL_ERROR("Unsupported interface type %d\n", mode);
-               break;
-       }
-
-#if 0
-       /* TODO:  Figure out when short_preamble would be set and cache from
-        * that */
-       if (!hw_to_local(priv->hw)->short_preamble)
-               priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
-       else
-               priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
-#endif
-
-       ch_info = iwl3945_get_channel_info(priv, priv->band,
-                                      le16_to_cpu(priv->active_rxon.channel));
-
-       if (!ch_info)
-               ch_info = &priv->channel_info[0];
-
-       /*
-        * in some case A channels are all non IBSS
-        * in this case force B/G channel
-        */
-       if ((mode == NL80211_IFTYPE_ADHOC) && !(is_channel_ibss(ch_info)))
-               ch_info = &priv->channel_info[0];
+               return -EAGAIN;
+       }
 
-       priv->staging_rxon.channel = cpu_to_le16(ch_info->channel);
-       if (is_channel_a_band(ch_info))
-               priv->band = IEEE80211_BAND_5GHZ;
-       else
-               priv->band = IEEE80211_BAND_2GHZ;
+       IWL_DEBUG_INFO(priv, "Starting scan...\n");
+       if (priv->cfg->sku & IWL_SKU_G)
+               priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
+       if (priv->cfg->sku & IWL_SKU_A)
+               priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
+       set_bit(STATUS_SCANNING, &priv->status);
+       priv->scan_start = jiffies;
+       priv->scan_pass_start = priv->scan_start;
 
-       iwl3945_set_flags_for_phymode(priv, priv->band);
+       queue_work(priv->workqueue, &priv->request_scan);
 
-       priv->staging_rxon.ofdm_basic_rates =
-           (IWL_OFDM_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
-       priv->staging_rxon.cck_basic_rates =
-           (IWL_CCK_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
+       return 0;
 }
 
-static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
+static int iwl3945_set_mode(struct iwl_priv *priv, int mode)
 {
        if (mode == NL80211_IFTYPE_ADHOC) {
-               const struct iwl3945_channel_info *ch_info;
+               const struct iwl_channel_info *ch_info;
 
-               ch_info = iwl3945_get_channel_info(priv,
+               ch_info = iwl_get_channel_info(priv,
                        priv->band,
                        le16_to_cpu(priv->staging_rxon.channel));
 
                if (!ch_info || !is_channel_ibss(ch_info)) {
-                       IWL_ERROR("channel %d not IBSS channel\n",
+                       IWL_ERR(priv, "channel %d not IBSS channel\n",
                                  le16_to_cpu(priv->staging_rxon.channel));
                        return -EINVAL;
                }
        }
 
-       iwl3945_connection_init_rx_config(priv, mode);
-       memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
+       iwl_connection_init_rx_config(priv, mode);
 
        iwl3945_clear_stations_table(priv);
 
        /* don't commit rxon if rf-kill is on*/
-       if (!iwl3945_is_ready_rf(priv))
+       if (!iwl_is_ready_rf(priv))
                return -EAGAIN;
 
        cancel_delayed_work(&priv->scan_check);
-       if (iwl3945_scan_cancel_timeout(priv, 100)) {
-               IWL_WARNING("Aborted scan still in progress after 100ms\n");
-               IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
+       if (iwl_scan_cancel_timeout(priv, 100)) {
+               IWL_WARN(priv, "Aborted scan still in progress after 100ms\n");
+               IWL_DEBUG_MAC80211(priv, "leaving - scan abort failed.\n");
                return -EAGAIN;
        }
 
@@ -2277,49 +794,50 @@ static int iwl3945_set_mode(struct iwl3945_priv *priv, int mode)
        return 0;
 }
 
-static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
+static void iwl3945_build_tx_cmd_hwcrypto(struct iwl_priv *priv,
                                      struct ieee80211_tx_info *info,
-                                     struct iwl3945_cmd *cmd,
+                                     struct iwl_cmd *cmd,
                                      struct sk_buff *skb_frag,
                                      int last_frag)
 {
+       struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
        struct iwl3945_hw_key *keyinfo =
-           &priv->stations[info->control.hw_key->hw_key_idx].keyinfo;
+           &priv->stations_39[info->control.hw_key->hw_key_idx].keyinfo;
 
        switch (keyinfo->alg) {
        case ALG_CCMP:
-               cmd->cmd.tx.sec_ctl = TX_CMD_SEC_CCM;
-               memcpy(cmd->cmd.tx.key, keyinfo->key, keyinfo->keylen);
-               IWL_DEBUG_TX("tx_cmd with AES hwcrypto\n");
+               tx->sec_ctl = TX_CMD_SEC_CCM;
+               memcpy(tx->key, keyinfo->key, keyinfo->keylen);
+               IWL_DEBUG_TX(priv, "tx_cmd with AES hwcrypto\n");
                break;
 
        case ALG_TKIP:
 #if 0
-               cmd->cmd.tx.sec_ctl = TX_CMD_SEC_TKIP;
+               tx->sec_ctl = TX_CMD_SEC_TKIP;
 
                if (last_frag)
-                       memcpy(cmd->cmd.tx.tkip_mic.byte, skb_frag->tail - 8,
+                       memcpy(tx->tkip_mic.byte, skb_frag->tail - 8,
                               8);
                else
-                       memset(cmd->cmd.tx.tkip_mic.byte, 0, 8);
+                       memset(tx->tkip_mic.byte, 0, 8);
 #endif
                break;
 
        case ALG_WEP:
-               cmd->cmd.tx.sec_ctl = TX_CMD_SEC_WEP |
+               tx->sec_ctl = TX_CMD_SEC_WEP |
                    (info->control.hw_key->hw_key_idx & TX_CMD_SEC_MSK) << TX_CMD_SEC_SHIFT;
 
                if (keyinfo->keylen == 13)
-                       cmd->cmd.tx.sec_ctl |= TX_CMD_SEC_KEY128;
+                       tx->sec_ctl |= TX_CMD_SEC_KEY128;
 
-               memcpy(&cmd->cmd.tx.key[3], keyinfo->key, keyinfo->keylen);
+               memcpy(&tx->key[3], keyinfo->key, keyinfo->keylen);
 
-               IWL_DEBUG_TX("Configuring packet for WEP encryption "
+               IWL_DEBUG_TX(priv, "Configuring packet for WEP encryption "
                             "with key %d\n", info->control.hw_key->hw_key_idx);
                break;
 
        default:
-               printk(KERN_ERR "Unknown encode alg %d\n", keyinfo->alg);
+               IWL_ERR(priv, "Unknown encode alg %d\n", keyinfo->alg);
                break;
        }
 }
@@ -2327,17 +845,17 @@ static void iwl3945_build_tx_cmd_hwcrypto(struct iwl3945_priv *priv,
 /*
  * handle build REPLY_TX command notification.
  */
-static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
-                                 struct iwl3945_cmd *cmd,
+static void iwl3945_build_tx_cmd_basic(struct iwl_priv *priv,
+                                 struct iwl_cmd *cmd,
                                  struct ieee80211_tx_info *info,
-                                 struct ieee80211_hdr *hdr,
-                                 int is_unicast, u8 std_id)
+                                 struct ieee80211_hdr *hdr, u8 std_id)
 {
+       struct iwl3945_tx_cmd *tx = (struct iwl3945_tx_cmd *)cmd->cmd.payload;
+       __le32 tx_flags = tx->tx_flags;
        __le16 fc = hdr->frame_control;
-       __le32 tx_flags = cmd->cmd.tx.tx_flags;
        u8 rc_flags = info->control.rates[0].flags;
 
-       cmd->cmd.tx.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
+       tx->stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
        if (!(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
                tx_flags |= TX_CMD_FLG_ACK_MSK;
                if (ieee80211_is_mgmt(fc))
@@ -2350,13 +868,13 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
                tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
        }
 
-       cmd->cmd.tx.sta_id = std_id;
+       tx->sta_id = std_id;
        if (ieee80211_has_morefrags(fc))
                tx_flags |= TX_CMD_FLG_MORE_FRAG_MSK;
 
        if (ieee80211_is_data_qos(fc)) {
                u8 *qc = ieee80211_get_qos_ctl(hdr);
-               cmd->cmd.tx.tid_tspec = qc[0] & 0xf;
+               tx->tid_tspec = qc[0] & 0xf;
                tx_flags &= ~TX_CMD_FLG_SEQ_CTL_MSK;
        } else {
                tx_flags |= TX_CMD_FLG_SEQ_CTL_MSK;
@@ -2376,25 +894,25 @@ static void iwl3945_build_tx_cmd_basic(struct iwl3945_priv *priv,
        tx_flags &= ~(TX_CMD_FLG_ANT_SEL_MSK);
        if (ieee80211_is_mgmt(fc)) {
                if (ieee80211_is_assoc_req(fc) || ieee80211_is_reassoc_req(fc))
-                       cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(3);
+                       tx->timeout.pm_frame_timeout = cpu_to_le16(3);
                else
-                       cmd->cmd.tx.timeout.pm_frame_timeout = cpu_to_le16(2);
+                       tx->timeout.pm_frame_timeout = cpu_to_le16(2);
        } else {
-               cmd->cmd.tx.timeout.pm_frame_timeout = 0;
+               tx->timeout.pm_frame_timeout = 0;
 #ifdef CONFIG_IWL3945_LEDS
                priv->rxtxpackets += le16_to_cpu(cmd->cmd.tx.len);
 #endif
        }
 
-       cmd->cmd.tx.driver_txop = 0;
-       cmd->cmd.tx.tx_flags = tx_flags;
-       cmd->cmd.tx.next_frame_len = 0;
+       tx->driver_txop = 0;
+       tx->tx_flags = tx_flags;
+       tx->next_frame_len = 0;
 }
 
 /**
  * iwl3945_get_sta_id - Find station's index within station table
  */
-static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *hdr)
+static int iwl3945_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)
 {
        int sta_id;
        u16 fc = le16_to_cpu(hdr->frame_control);
@@ -2402,7 +920,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
        /* If this frame is broadcast or management, use broadcast station id */
        if (((fc & IEEE80211_FCTL_FTYPE) != IEEE80211_FTYPE_DATA) ||
            is_multicast_ether_addr(hdr->addr1))
-               return priv->hw_setting.bcast_sta_id;
+               return priv->hw_params.bcast_sta_id;
 
        switch (priv->iw_mode) {
 
@@ -2416,7 +934,7 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
                sta_id = iwl3945_hw_find_station(priv, hdr->addr1);
                if (sta_id != IWL_INVALID_STATION)
                        return sta_id;
-               return priv->hw_setting.bcast_sta_id;
+               return priv->hw_params.bcast_sta_id;
 
        /* If this frame is going out to an IBSS network, find the station,
         * or create a new station table entry */
@@ -2431,38 +949,38 @@ static int iwl3945_get_sta_id(struct iwl3945_priv *priv, struct ieee80211_hdr *h
                if (sta_id != IWL_INVALID_STATION)
                        return sta_id;
 
-               IWL_DEBUG_DROP("Station %pM not in station map. "
+               IWL_DEBUG_DROP(priv, "Station %pM not in station map. "
                               "Defaulting to broadcast...\n",
                               hdr->addr1);
-               iwl3945_print_hex_dump(IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
-               return priv->hw_setting.bcast_sta_id;
+               iwl_print_hex_dump(priv, IWL_DL_DROP, (u8 *) hdr, sizeof(*hdr));
+               return priv->hw_params.bcast_sta_id;
        }
        /* If we are in monitor mode, use BCAST. This is required for
         * packet injection. */
        case NL80211_IFTYPE_MONITOR:
-               return priv->hw_setting.bcast_sta_id;
+               return priv->hw_params.bcast_sta_id;
 
        default:
-               IWL_WARNING("Unknown mode of operation: %d\n", priv->iw_mode);
-               return priv->hw_setting.bcast_sta_id;
+               IWL_WARN(priv, "Unknown mode of operation: %d\n",
+                       priv->iw_mode);
+               return priv->hw_params.bcast_sta_id;
        }
 }
 
 /*
  * start REPLY_TX command process
  */
-static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
+static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct iwl3945_tfd_frame *tfd;
-       u32 *control_flags;
-       int txq_id = skb_get_queue_mapping(skb);
-       struct iwl3945_tx_queue *txq = NULL;
-       struct iwl3945_queue *q = NULL;
+       struct iwl3945_tx_cmd *tx;
+       struct iwl_tx_queue *txq = NULL;
+       struct iwl_queue *q = NULL;
+       struct iwl_cmd *out_cmd = NULL;
        dma_addr_t phys_addr;
        dma_addr_t txcmd_phys;
-       struct iwl3945_cmd *out_cmd = NULL;
+       int txq_id = skb_get_queue_mapping(skb);
        u16 len, idx, len_org, hdr_len;
        u8 id;
        u8 unicast;
@@ -2476,13 +994,13 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
        int rc;
 
        spin_lock_irqsave(&priv->lock, flags);
-       if (iwl3945_is_rfkill(priv)) {
-               IWL_DEBUG_DROP("Dropping - RF KILL\n");
+       if (iwl_is_rfkill(priv)) {
+               IWL_DEBUG_DROP(priv, "Dropping - RF KILL\n");
                goto drop_unlock;
        }
 
        if ((ieee80211_get_tx_rate(priv->hw, info)->hw_value & 0xFF) == IWL_INVALID_RATE) {
-               IWL_ERROR("ERROR: No TX rate available.\n");
+               IWL_ERR(priv, "ERROR: No TX rate available.\n");
                goto drop_unlock;
        }
 
@@ -2491,21 +1009,21 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
 
        fc = hdr->frame_control;
 
-#ifdef CONFIG_IWL3945_DEBUG
+#ifdef CONFIG_IWLWIFI_DEBUG
        if (ieee80211_is_auth(fc))
-               IWL_DEBUG_TX("Sending AUTH frame\n");
+               IWL_DEBUG_TX(priv, "Sending AUTH frame\n");
        else if (ieee80211_is_assoc_req(fc))
-               IWL_DEBUG_TX("Sending ASSOC frame\n");
+               IWL_DEBUG_TX(priv, "Sending ASSOC frame\n");
        else if (ieee80211_is_reassoc_req(fc))
-               IWL_DEBUG_TX("Sending REASSOC frame\n");
+               IWL_DEBUG_TX(priv, "Sending REASSOC frame\n");
 #endif
 
        /* drop all data frame if we are not associated */
        if (ieee80211_is_data(fc) &&
            (priv->iw_mode != NL80211_IFTYPE_MONITOR) && /* packet injection */
-           (!iwl3945_is_associated(priv) ||
+           (!iwl_is_associated(priv) ||
             ((priv->iw_mode == NL80211_IFTYPE_STATION) && !priv->assoc_id))) {
-               IWL_DEBUG_DROP("Dropping - !iwl3945_is_associated\n");
+               IWL_DEBUG_DROP(priv, "Dropping - !iwl_is_associated\n");
                goto drop_unlock;
        }
 
@@ -2516,21 +1034,21 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
        /* Find (or create) index into station table for destination station */
        sta_id = iwl3945_get_sta_id(priv, hdr);
        if (sta_id == IWL_INVALID_STATION) {
-               IWL_DEBUG_DROP("Dropping - INVALID STATION: %pM\n",
+               IWL_DEBUG_DROP(priv, "Dropping - INVALID STATION: %pM\n",
                               hdr->addr1);
                goto drop;
        }
 
-       IWL_DEBUG_RATE("station Id %d\n", sta_id);
+       IWL_DEBUG_RATE(priv, "station Id %d\n", sta_id);
 
        if (ieee80211_is_data_qos(fc)) {
                qc = ieee80211_get_qos_ctl(hdr);
                tid = qc[0] & IEEE80211_QOS_CTL_TID_MASK;
-               seq_number = priv->stations[sta_id].tid[tid].seq_number &
+               seq_number = priv->stations_39[sta_id].tid[tid].seq_number &
                                IEEE80211_SCTL_SEQ;
                hdr->seq_ctrl = cpu_to_le16(seq_number) |
                        (hdr->seq_ctrl &
-                               __constant_cpu_to_le16(IEEE80211_SCTL_FRAG));
+                               cpu_to_le16(IEEE80211_SCTL_FRAG));
                seq_number += 0x10;
        }
 
@@ -2540,20 +1058,17 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       /* Set up first empty TFD within this queue's circular TFD buffer */
-       tfd = &txq->bd[q->write_ptr];
-       memset(tfd, 0, sizeof(*tfd));
-       control_flags = (u32 *) tfd;
        idx = get_cmd_index(q, q->write_ptr, 0);
 
        /* Set up driver data for this TFD */
-       memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info));
+       memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
        txq->txb[q->write_ptr].skb[0] = skb;
 
        /* Init first empty entry in queue's array of Tx/cmd buffers */
-       out_cmd = &txq->cmd[idx];
+       out_cmd = txq->cmd[idx];
+       tx = (struct iwl3945_tx_cmd *)out_cmd->cmd.payload;
        memset(&out_cmd->hdr, 0, sizeof(out_cmd->hdr));
-       memset(&out_cmd->cmd.tx, 0, sizeof(out_cmd->cmd.tx));
+       memset(tx, 0, sizeof(*tx));
 
        /*
         * Set up the Tx-command (not MAC!) header.
@@ -2566,7 +1081,7 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
                                INDEX_TO_SEQ(q->write_ptr)));
 
        /* Copy MAC header from skb into command buffer */
-       memcpy(out_cmd->cmd.tx.hdr, hdr, hdr_len);
+       memcpy(tx->hdr, hdr, hdr_len);
 
        /*
         * Use the first empty entry in this queue's command buffer array
@@ -2577,8 +1092,8 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
         * of the MAC header (device reads on dword boundaries).
         * We'll tell device about this padding later.
         */
-       len = priv->hw_setting.tx_cmd_len +
-               sizeof(struct iwl3945_cmd_header) + hdr_len;
+       len = sizeof(struct iwl3945_tx_cmd) +
+                       sizeof(struct iwl_cmd_header) + hdr_len;
 
        len_org = len;
        len = (len + 3) & ~3;
@@ -2590,12 +1105,19 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
 
        /* Physical address of this Tx command's header (not MAC header!),
         * within command buffer array. */
-       txcmd_phys = txq->dma_addr_cmd + sizeof(struct iwl3945_cmd) * idx +
-                    offsetof(struct iwl3945_cmd, hdr);
+       txcmd_phys = pci_map_single(priv->pci_dev,
+                                   out_cmd, sizeof(struct iwl_cmd),
+                                   PCI_DMA_TODEVICE);
+       pci_unmap_addr_set(&out_cmd->meta, mapping, txcmd_phys);
+       pci_unmap_len_set(&out_cmd->meta, len, sizeof(struct iwl_cmd));
+       /* Add buffer containing Tx command and MAC(!) header to TFD's
+        * first entry */
+       txcmd_phys += offsetof(struct iwl_cmd, hdr);
 
        /* Add buffer containing Tx command and MAC(!) header to TFD's
         * first entry */
-       iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, txcmd_phys, len);
+       priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
+                                                  txcmd_phys, len, 1, 0);
 
        if (info->control.hw_key)
                iwl3945_build_tx_cmd_hwcrypto(priv, info, out_cmd, skb, 0);
@@ -2606,60 +1128,52 @@ static int iwl3945_tx_skb(struct iwl3945_priv *priv, struct sk_buff *skb)
        if (len) {
                phys_addr = pci_map_single(priv->pci_dev, skb->data + hdr_len,
                                           len, PCI_DMA_TODEVICE);
-               iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, len);
+               priv->cfg->ops->lib->txq_attach_buf_to_tfd(priv, txq,
+                                                          phys_addr, len,
+                                                          0, U32_PAD(len));
        }
 
-       if (!len)
-               /* If there is no payload, then we use only one Tx buffer */
-               *control_flags = TFD_CTL_COUNT_SET(1);
-       else
-               /* Else use 2 buffers.
-                * Tell 3945 about any padding after MAC header */
-               *control_flags = TFD_CTL_COUNT_SET(2) |
-                       TFD_CTL_PAD_SET(U32_PAD(len));
-
        /* Total # bytes to be transmitted */
        len = (u16)skb->len;
-       out_cmd->cmd.tx.len = cpu_to_le16(len);
+       tx->len = cpu_to_le16(len);
 
        /* TODO need this for burst mode later on */
-       iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, unicast, sta_id);
+       iwl3945_build_tx_cmd_basic(priv, out_cmd, info, hdr, sta_id);
 
        /* set is_hcca to 0; it probably will never be implemented */
        iwl3945_hw_build_tx_cmd_rate(priv, out_cmd, info, hdr, sta_id, 0);
 
-       out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
-       out_cmd->cmd.tx.tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
+       tx->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
+       tx->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
 
        if (!ieee80211_has_morefrags(hdr->frame_control)) {
                txq->need_update = 1;
                if (qc)
-                       priv->stations[sta_id].tid[tid].seq_number = seq_number;
+                       priv->stations_39[sta_id].tid[tid].seq_number = seq_number;
        } else {
                wait_write_ptr = 1;
                txq->need_update = 0;
        }
 
-       iwl3945_print_hex_dump(IWL_DL_TX, out_cmd->cmd.payload,
-                          sizeof(out_cmd->cmd.tx));
+       iwl_print_hex_dump(priv, IWL_DL_TX, tx, sizeof(*tx));
 
-       iwl3945_print_hex_dump(IWL_DL_TX, (u8 *)out_cmd->cmd.tx.hdr,
+       iwl_print_hex_dump(priv, IWL_DL_TX, (u8 *)tx->hdr,
                           ieee80211_hdrlen(fc));
 
        /* Tell device the write index *just past* this latest filled TFD */
        q->write_ptr = iwl_queue_inc_wrap(q->write_ptr, q->n_bd);
-       rc = iwl3945_tx_queue_update_write_ptr(priv, txq);
+       rc = iwl_txq_update_write_ptr(priv, txq);
        spin_unlock_irqrestore(&priv->lock, flags);
 
        if (rc)
                return rc;
 
-       if ((iwl3945_queue_space(q) < q->high_mark)
+       if ((iwl_queue_space(q) < q->high_mark)
            && priv->mac80211_registered) {
                if (wait_write_ptr) {
                        spin_lock_irqsave(&priv->lock, flags);
                        txq->need_update = 1;
-                       iwl3945_tx_queue_update_write_ptr(priv, txq);
+                       iwl_txq_update_write_ptr(priv, txq);
                        spin_unlock_irqrestore(&priv->lock, flags);
                }
 
@@ -2674,86 +1188,32 @@ drop:
        return -1;
 }
 
-static void iwl3945_set_rate(struct iwl3945_priv *priv)
-{
-       const struct ieee80211_supported_band *sband = NULL;
-       struct ieee80211_rate *rate;
-       int i;
-
-       sband = iwl3945_get_band(priv, priv->band);
-       if (!sband) {
-               IWL_ERROR("Failed to set rate: unable to get hw mode\n");
-               return;
-       }
-
-       priv->active_rate = 0;
-       priv->active_rate_basic = 0;
-
-       IWL_DEBUG_RATE("Setting rates for %s GHz\n",
-                      sband->band == IEEE80211_BAND_2GHZ ? "2.4" : "5");
-
-       for (i = 0; i < sband->n_bitrates; i++) {
-               rate = &sband->bitrates[i];
-               if ((rate->hw_value < IWL_RATE_COUNT) &&
-                   !(rate->flags & IEEE80211_CHAN_DISABLED)) {
-                       IWL_DEBUG_RATE("Adding rate index %d (plcp %d)\n",
-                                      rate->hw_value, iwl3945_rates[rate->hw_value].plcp);
-                       priv->active_rate |= (1 << rate->hw_value);
-               }
-       }
-
-       IWL_DEBUG_RATE("Set active_rate = %0x, active_rate_basic = %0x\n",
-                      priv->active_rate, priv->active_rate_basic);
-
-       /*
-        * If a basic rate is configured, then use it (adding IWL_RATE_1M_MASK)
-        * otherwise set it to the default of all CCK rates and 6, 12, 24 for
-        * OFDM
-        */
-       if (priv->active_rate_basic & IWL_CCK_BASIC_RATES_MASK)
-               priv->staging_rxon.cck_basic_rates =
-                   ((priv->active_rate_basic &
-                     IWL_CCK_RATES_MASK) >> IWL_FIRST_CCK_RATE) & 0xF;
-       else
-               priv->staging_rxon.cck_basic_rates =
-                   (IWL_CCK_BASIC_RATES_MASK >> IWL_FIRST_CCK_RATE) & 0xF;
-
-       if (priv->active_rate_basic & IWL_OFDM_BASIC_RATES_MASK)
-               priv->staging_rxon.ofdm_basic_rates =
-                   ((priv->active_rate_basic &
-                     (IWL_OFDM_BASIC_RATES_MASK | IWL_RATE_6M_MASK)) >>
-                     IWL_FIRST_OFDM_RATE) & 0xFF;
-       else
-               priv->staging_rxon.ofdm_basic_rates =
-                  (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF;
-}
-
-static void iwl3945_radio_kill_sw(struct iwl3945_priv *priv, int disable_radio)
+static void iwl3945_radio_kill_sw(struct iwl_priv *priv, int disable_radio)
 {
        unsigned long flags;
 
        if (!!disable_radio == test_bit(STATUS_RF_KILL_SW, &priv->status))
                return;
 
-       IWL_DEBUG_RF_KILL("Manual SW RF KILL set to: RADIO %s\n",
+       IWL_DEBUG_RF_KILL(priv, "Manual SW RF KILL set to: RADIO %s\n",
                          disable_radio ? "OFF" : "ON");
 
        if (disable_radio) {
-               iwl3945_scan_cancel(priv);
+               iwl_scan_cancel(priv);
                /* FIXME: This is a workaround for AP */
                if (priv->iw_mode != NL80211_IFTYPE_AP) {
                        spin_lock_irqsave(&priv->lock, flags);
-                       iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET,
+                       iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
                                    CSR_UCODE_SW_BIT_RFKILL);
                        spin_unlock_irqrestore(&priv->lock, flags);
-                       iwl3945_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0);
+                       iwl_send_card_state(priv, CARD_STATE_CMD_DISABLE, 0);
                        set_bit(STATUS_RF_KILL_SW, &priv->status);
                }
                return;
        }
 
        spin_lock_irqsave(&priv->lock, flags);
-       iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
+       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
 
        clear_bit(STATUS_RF_KILL_SW, &priv->status);
        spin_unlock_irqrestore(&priv->lock, flags);
@@ -2762,13 +1222,13 @@ static void iwl3945_radio_kill_sw(struct iwl3945_priv *priv, int disable_radio)
        msleep(10);
 
        spin_lock_irqsave(&priv->lock, flags);
-       iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
-       if (!iwl3945_grab_nic_access(priv))
-               iwl3945_release_nic_access(priv);
+       iwl_read32(priv, CSR_UCODE_DRV_GP1);
+       if (!iwl_grab_nic_access(priv))
+               iwl_release_nic_access(priv);
        spin_unlock_irqrestore(&priv->lock, flags);
 
        if (test_bit(STATUS_RF_KILL_HW, &priv->status)) {
-               IWL_DEBUG_RF_KILL("Can not turn radio back on - "
+               IWL_DEBUG_RF_KILL(priv, "Can not turn radio back on - "
                                  "disabled by HW switch\n");
                return;
        }
@@ -2778,38 +1238,6 @@ static void iwl3945_radio_kill_sw(struct iwl3945_priv *priv, int disable_radio)
        return;
 }
 
-void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb,
-                           u32 decrypt_res, struct ieee80211_rx_status *stats)
-{
-       u16 fc =
-           le16_to_cpu(((struct ieee80211_hdr *)skb->data)->frame_control);
-
-       if (priv->active_rxon.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK)
-               return;
-
-       if (!(fc & IEEE80211_FCTL_PROTECTED))
-               return;
-
-       IWL_DEBUG_RX("decrypt_res:0x%x\n", decrypt_res);
-       switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) {
-       case RX_RES_STATUS_SEC_TYPE_TKIP:
-               if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
-                   RX_RES_STATUS_BAD_ICV_MIC)
-                       stats->flag |= RX_FLAG_MMIC_ERROR;
-       case RX_RES_STATUS_SEC_TYPE_WEP:
-       case RX_RES_STATUS_SEC_TYPE_CCMP:
-               if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) ==
-                   RX_RES_STATUS_DECRYPT_OK) {
-                       IWL_DEBUG_RX("hw decrypt successfully!!!\n");
-                       stats->flag |= RX_FLAG_DECRYPTED;
-               }
-               break;
-
-       default:
-               break;
-       }
-}
-
 #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
 
 #include "iwl-spectrum.h"
@@ -2863,13 +1291,13 @@ static __le32 iwl3945_add_beacon_time(u32 base, u32 addon, u32 beacon_interval)
        return cpu_to_le32(res);
 }
 
-static int iwl3945_get_measurement(struct iwl3945_priv *priv,
+static int iwl3945_get_measurement(struct iwl_priv *priv,
                               struct ieee80211_measurement_params *params,
                               u8 type)
 {
-       struct iwl3945_spectrum_cmd spectrum;
-       struct iwl3945_rx_packet *res;
-       struct iwl3945_host_cmd cmd = {
+       struct iwl_spectrum_cmd spectrum;
+       struct iwl_rx_packet *res;
+       struct iwl_host_cmd cmd = {
                .id = REPLY_SPECTRUM_MEASUREMENT_CMD,
                .data = (void *)&spectrum,
                .meta.flags = CMD_WANT_SKB,
@@ -2879,7 +1307,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
        int spectrum_resp_status;
        int duration = le16_to_cpu(params->duration);
 
-       if (iwl3945_is_associated(priv))
+       if (iwl_is_associated(priv))
                add_time =
                    iwl3945_usecs_to_beacons(
                        le64_to_cpu(params->start_time) - priv->last_tsf,
@@ -2894,7 +1322,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
        cmd.len = sizeof(spectrum);
        spectrum.len = cpu_to_le16(cmd.len - sizeof(spectrum.len));
 
-       if (iwl3945_is_associated(priv))
+       if (iwl_is_associated(priv))
                spectrum.start_time =
                    iwl3945_add_beacon_time(priv->last_beacon_time,
                                add_time,
@@ -2909,13 +1337,13 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
                spectrum.flags |= RXON_FLG_BAND_24G_MSK |
                    RXON_FLG_AUTO_DETECT_MSK | RXON_FLG_TGG_PROTECT_MSK;
 
-       rc = iwl3945_send_cmd_sync(priv, &cmd);
+       rc = iwl_send_cmd_sync(priv, &cmd);
        if (rc)
                return rc;
 
-       res = (struct iwl3945_rx_packet *)cmd.meta.u.skb->data;
+       res = (struct iwl_rx_packet *)cmd.meta.u.skb->data;
        if (res->hdr.flags & IWL_CMD_FAILED_MSK) {
-               IWL_ERROR("Bad return from REPLY_RX_ON_ASSOC command\n");
+               IWL_ERR(priv, "Bad return from REPLY_RX_ON_ASSOC command\n");
                rc = -EIO;
        }
 
@@ -2923,7 +1351,7 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
        switch (spectrum_resp_status) {
        case 0:         /* Command will be handled */
                if (res->u.spectrum.id != 0xff) {
-                       IWL_DEBUG_INFO("Replaced existing measurement: %d\n",
+                       IWL_DEBUG_INFO(priv, "Replaced existing measurement: %d\n",
                                                res->u.spectrum.id);
                        priv->measurement_status &= ~MEASUREMENT_READY;
                }
@@ -2942,30 +1370,29 @@ static int iwl3945_get_measurement(struct iwl3945_priv *priv,
 }
 #endif
 
-static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
-                              struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_reply_alive(struct iwl_priv *priv,
+                              struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_alive_resp *palive;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_alive_resp *palive;
        struct delayed_work *pwork;
 
        palive = &pkt->u.alive_frame;
 
-       IWL_DEBUG_INFO("Alive ucode status 0x%08X revision "
+       IWL_DEBUG_INFO(priv, "Alive ucode status 0x%08X revision "
                       "0x%01X 0x%01X\n",
                       palive->is_valid, palive->ver_type,
                       palive->ver_subtype);
 
        if (palive->ver_subtype == INITIALIZE_SUBTYPE) {
-               IWL_DEBUG_INFO("Initialization Alive received.\n");
-               memcpy(&priv->card_alive_init,
-                      &pkt->u.alive_frame,
-                      sizeof(struct iwl3945_init_alive_resp));
+               IWL_DEBUG_INFO(priv, "Initialization Alive received.\n");
+               memcpy(&priv->card_alive_init, &pkt->u.alive_frame,
+                      sizeof(struct iwl_alive_resp));
                pwork = &priv->init_alive_start;
        } else {
-               IWL_DEBUG_INFO("Runtime Alive received.\n");
+               IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
                memcpy(&priv->card_alive, &pkt->u.alive_frame,
-                      sizeof(struct iwl3945_alive_resp));
+                      sizeof(struct iwl_alive_resp));
                pwork = &priv->alive_start;
                iwl3945_disable_events(priv);
        }
@@ -2976,24 +1403,26 @@ static void iwl3945_rx_reply_alive(struct iwl3945_priv *priv,
                queue_delayed_work(priv->workqueue, pwork,
                                   msecs_to_jiffies(5));
        else
-               IWL_WARNING("uCode did not respond OK.\n");
+               IWL_WARN(priv, "uCode did not respond OK.\n");
 }
 
-static void iwl3945_rx_reply_add_sta(struct iwl3945_priv *priv,
-                                struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_reply_add_sta(struct iwl_priv *priv,
+                                struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+#ifdef CONFIG_IWLWIFI_DEBUG
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+#endif
 
-       IWL_DEBUG_RX("Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
+       IWL_DEBUG_RX(priv, "Received REPLY_ADD_STA: 0x%02X\n", pkt->u.status);
        return;
 }
 
-static void iwl3945_rx_reply_error(struct iwl3945_priv *priv,
-                              struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_reply_error(struct iwl_priv *priv,
+                              struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
 
-       IWL_ERROR("Error Reply type 0x%08X cmd %s (0x%02X) "
+       IWL_ERR(priv, "Error Reply type 0x%08X cmd %s (0x%02X) "
                "seq 0x%04X ser 0x%08X\n",
                le32_to_cpu(pkt->u.err_resp.error_type),
                get_cmd_string(pkt->u.err_resp.cmd_id),
@@ -3002,28 +1431,15 @@ static void iwl3945_rx_reply_error(struct iwl3945_priv *priv,
                le32_to_cpu(pkt->u.err_resp.error_info));
 }
 
-#define TX_STATUS_ENTRY(x) case TX_STATUS_FAIL_ ## x: return #x
-
-static void iwl3945_rx_csa(struct iwl3945_priv *priv, struct iwl3945_rx_mem_buffer *rxb)
-{
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_rxon_cmd *rxon = (void *)&priv->active_rxon;
-       struct iwl3945_csa_notification *csa = &(pkt->u.csa_notif);
-       IWL_DEBUG_11H("CSA notif: channel %d, status %d\n",
-                     le16_to_cpu(csa->channel), le32_to_cpu(csa->status));
-       rxon->channel = csa->channel;
-       priv->staging_rxon.channel = csa->channel;
-}
-
-static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv,
-                                         struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_spectrum_measure_notif(struct iwl_priv *priv,
+                                         struct iwl_rx_mem_buffer *rxb)
 {
 #ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_spectrum_notification *report = &(pkt->u.spectrum_notif);
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif);
 
        if (!report->state) {
-               IWL_DEBUG(IWL_DL_11H | IWL_DL_INFO,
+               IWL_DEBUG(priv, IWL_DL_11H | IWL_DL_INFO,
                          "Spectrum Measure Notification: Start\n");
                return;
        }
@@ -3033,38 +1449,39 @@ static void iwl3945_rx_spectrum_measure_notif(struct iwl3945_priv *priv,
 #endif
 }
 
-static void iwl3945_rx_pm_sleep_notif(struct iwl3945_priv *priv,
-                                 struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_pm_sleep_notif(struct iwl_priv *priv,
+                                 struct iwl_rx_mem_buffer *rxb)
 {
-#ifdef CONFIG_IWL3945_DEBUG
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_sleep_notification *sleep = &(pkt->u.sleep_notif);
-       IWL_DEBUG_RX("sleep mode: %d, src: %d\n",
+#ifdef CONFIG_IWLWIFI_DEBUG
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_sleep_notification *sleep = &(pkt->u.sleep_notif);
+       IWL_DEBUG_RX(priv, "sleep mode: %d, src: %d\n",
                     sleep->pm_sleep_mode, sleep->pm_wakeup_src);
 #endif
 }
 
-static void iwl3945_rx_pm_debug_statistics_notif(struct iwl3945_priv *priv,
-                                            struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_pm_debug_statistics_notif(struct iwl_priv *priv,
+                                            struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       IWL_DEBUG_RADIO("Dumping %d bytes of unhandled "
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       IWL_DEBUG_RADIO(priv, "Dumping %d bytes of unhandled "
                        "notification for %s:\n",
                        le32_to_cpu(pkt->len), get_cmd_string(pkt->hdr.cmd));
-       iwl3945_print_hex_dump(IWL_DL_RADIO, pkt->u.raw, le32_to_cpu(pkt->len));
+       iwl_print_hex_dump(priv, IWL_DL_RADIO, pkt->u.raw,
+                          le32_to_cpu(pkt->len));
 }
 
 static void iwl3945_bg_beacon_update(struct work_struct *work)
 {
-       struct iwl3945_priv *priv =
-               container_of(work, struct iwl3945_priv, beacon_update);
+       struct iwl_priv *priv =
+               container_of(work, struct iwl_priv, beacon_update);
        struct sk_buff *beacon;
 
        /* Pull updated AP beacon from mac80211. will fail if not in AP mode */
        beacon = ieee80211_beacon_get(priv->hw, priv->vif);
 
        if (!beacon) {
-               IWL_ERROR("update beacon failed\n");
+               IWL_ERR(priv, "update beacon failed\n");
                return;
        }
 
@@ -3079,15 +1496,15 @@ static void iwl3945_bg_beacon_update(struct work_struct *work)
        iwl3945_send_beacon_cmd(priv);
 }
 
-static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv,
-                               struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_beacon_notif(struct iwl_priv *priv,
+                               struct iwl_rx_mem_buffer *rxb)
 {
-#ifdef CONFIG_IWL3945_DEBUG
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+#ifdef CONFIG_IWLWIFI_DEBUG
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
        struct iwl3945_beacon_notif *beacon = &(pkt->u.beacon_status);
        u8 rate = beacon->beacon_notify_hdr.rate;
 
-       IWL_DEBUG_RX("beacon status %x retries %d iss %d "
+       IWL_DEBUG_RX(priv, "beacon status %x retries %d iss %d "
                "tsf %d %d rate %d\n",
                le32_to_cpu(beacon->beacon_notify_hdr.status) & TX_STATUS_MSK,
                beacon->beacon_notify_hdr.failure_frame,
@@ -3102,27 +1519,27 @@ static void iwl3945_rx_beacon_notif(struct iwl3945_priv *priv,
 }
 
 /* Service response to REPLY_SCAN_CMD (0x80) */
-static void iwl3945_rx_reply_scan(struct iwl3945_priv *priv,
-                             struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_reply_scan(struct iwl_priv *priv,
+                             struct iwl_rx_mem_buffer *rxb)
 {
-#ifdef CONFIG_IWL3945_DEBUG
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_scanreq_notification *notif =
-           (struct iwl3945_scanreq_notification *)pkt->u.raw;
+#ifdef CONFIG_IWLWIFI_DEBUG
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_scanreq_notification *notif =
+           (struct iwl_scanreq_notification *)pkt->u.raw;
 
-       IWL_DEBUG_RX("Scan request status = 0x%x\n", notif->status);
+       IWL_DEBUG_RX(priv, "Scan request status = 0x%x\n", notif->status);
 #endif
 }
 
 /* Service SCAN_START_NOTIFICATION (0x82) */
-static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv,
-                                   struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_scan_start_notif(struct iwl_priv *priv,
+                                   struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_scanstart_notification *notif =
-           (struct iwl3945_scanstart_notification *)pkt->u.raw;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_scanstart_notification *notif =
+           (struct iwl_scanstart_notification *)pkt->u.raw;
        priv->scan_start_tsf = le32_to_cpu(notif->tsf_low);
-       IWL_DEBUG_SCAN("Scan start: "
+       IWL_DEBUG_SCAN(priv, "Scan start: "
                       "%d [802.11%s] "
                       "(TSF: 0x%08X:%08X) - %d (beacon timer %u)\n",
                       notif->channel,
@@ -3132,14 +1549,16 @@ static void iwl3945_rx_scan_start_notif(struct iwl3945_priv *priv,
 }
 
 /* Service SCAN_RESULTS_NOTIFICATION (0x83) */
-static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
-                                     struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_scan_results_notif(struct iwl_priv *priv,
+                                     struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_scanresults_notification *notif =
-           (struct iwl3945_scanresults_notification *)pkt->u.raw;
+#ifdef CONFIG_IWLWIFI_DEBUG
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_scanresults_notification *notif =
+           (struct iwl_scanresults_notification *)pkt->u.raw;
+#endif
 
-       IWL_DEBUG_SCAN("Scan ch.res: "
+       IWL_DEBUG_SCAN(priv, "Scan ch.res: "
                       "%d [802.11%s] "
                       "(TSF: 0x%08X:%08X) - %d "
                       "elapsed=%lu usec (%dms since last)\n",
@@ -3157,13 +1576,15 @@ static void iwl3945_rx_scan_results_notif(struct iwl3945_priv *priv,
 }
 
 /* Service SCAN_COMPLETE_NOTIFICATION (0x84) */
-static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
-                                      struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_scan_complete_notif(struct iwl_priv *priv,
+                                      struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
-       struct iwl3945_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
+#ifdef CONFIG_IWLWIFI_DEBUG
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_scancomplete_notification *scan_notif = (void *)pkt->u.raw;
+#endif
 
-       IWL_DEBUG_SCAN("Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
+       IWL_DEBUG_SCAN(priv, "Scan complete: %d channels (TSF 0x%08X:%08X) - %d\n",
                       scan_notif->scanned_channels,
                       scan_notif->tsf_low,
                       scan_notif->tsf_high, scan_notif->status);
@@ -3174,7 +1595,7 @@ static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
        /* The scan completion notification came in, so kill that timer... */
        cancel_delayed_work(&priv->scan_check);
 
-       IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n",
+       IWL_DEBUG_INFO(priv, "Scan pass on %sGHz took %dms\n",
                       (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ?
                                                        "2.4" : "5.2",
                       jiffies_to_msecs(elapsed_jiffies
@@ -3192,7 +1613,7 @@ static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
         * then we reset the scan state machine and terminate,
         * re-queuing another scan if one has been requested */
        if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG_INFO("Aborted scan completed.\n");
+               IWL_DEBUG_INFO(priv, "Aborted scan completed.\n");
                clear_bit(STATUS_SCAN_ABORTING, &priv->status);
        } else {
                /* If there are more bands on this scan pass reschedule */
@@ -3202,11 +1623,11 @@ static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
 
        priv->last_scan_jiffies = jiffies;
        priv->next_scan_jiffies = 0;
-       IWL_DEBUG_INFO("Setting scan to off\n");
+       IWL_DEBUG_INFO(priv, "Setting scan to off\n");
 
        clear_bit(STATUS_SCANNING, &priv->status);
 
-       IWL_DEBUG_INFO("Scan took %dms\n",
+       IWL_DEBUG_INFO(priv, "Scan took %dms\n",
                jiffies_to_msecs(elapsed_jiffies(priv->scan_start, jiffies)));
 
        queue_work(priv->workqueue, &priv->scan_completed);
@@ -3220,18 +1641,18 @@ reschedule:
 
 /* Handle notification from uCode that card's power state is changing
  * due to software, hardware, or critical temperature RFKILL */
-static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv,
-                                   struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_rx_card_state_notif(struct iwl_priv *priv,
+                                   struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (void *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (void *)rxb->skb->data;
        u32 flags = le32_to_cpu(pkt->u.card_state_notif.flags);
        unsigned long status = priv->status;
 
-       IWL_DEBUG_RF_KILL("Card state received: HW:%s SW:%s\n",
+       IWL_DEBUG_RF_KILL(priv, "Card state received: HW:%s SW:%s\n",
                          (flags & HW_CARD_DISABLED) ? "Kill" : "On",
                          (flags & SW_CARD_DISABLED) ? "Kill" : "On");
 
-       iwl3945_write32(priv, CSR_UCODE_DRV_GP1_SET,
+       iwl_write32(priv, CSR_UCODE_DRV_GP1_SET,
                    CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
 
        if (flags & HW_CARD_DISABLED)
@@ -3245,7 +1666,7 @@ static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv,
        else
                clear_bit(STATUS_RF_KILL_SW, &priv->status);
 
-       iwl3945_scan_cancel(priv);
+       iwl_scan_cancel(priv);
 
        if ((test_bit(STATUS_RF_KILL_HW, &status) !=
             test_bit(STATUS_RF_KILL_HW, &priv->status)) ||
@@ -3265,12 +1686,12 @@ static void iwl3945_rx_card_state_notif(struct iwl3945_priv *priv,
  * This function chains into the hardware specific files for them to setup
  * any hardware specific handlers as well.
  */
-static void iwl3945_setup_rx_handlers(struct iwl3945_priv *priv)
+static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
 {
        priv->rx_handlers[REPLY_ALIVE] = iwl3945_rx_reply_alive;
        priv->rx_handlers[REPLY_ADD_STA] = iwl3945_rx_reply_add_sta;
        priv->rx_handlers[REPLY_ERROR] = iwl3945_rx_reply_error;
-       priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl3945_rx_csa;
+       priv->rx_handlers[CHANNEL_SWITCH_NOTIFICATION] = iwl_rx_csa;
        priv->rx_handlers[SPECTRUM_MEASURE_NOTIFICATION] =
            iwl3945_rx_spectrum_measure_notif;
        priv->rx_handlers[PM_SLEEP_NOTIFICATION] = iwl3945_rx_pm_sleep_notif;
@@ -3303,15 +1724,15 @@ static void iwl3945_setup_rx_handlers(struct iwl3945_priv *priv)
  * When FW advances 'R' index, all entries between old and new 'R' index
  * need to be reclaimed.
  */
-static void iwl3945_cmd_queue_reclaim(struct iwl3945_priv *priv,
+static void iwl3945_cmd_queue_reclaim(struct iwl_priv *priv,
                                      int txq_id, int index)
 {
-       struct iwl3945_tx_queue *txq = &priv->txq[txq_id];
-       struct iwl3945_queue *q = &txq->q;
+       struct iwl_tx_queue *txq = &priv->txq[txq_id];
+       struct iwl_queue *q = &txq->q;
        int nfreed = 0;
 
-       if ((index >= q->n_bd) || (iwl3945_x2_queue_used(q, index) == 0)) {
-               IWL_ERROR("Read index for DMA queue txq id (%d), index %d, "
+       if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
+               IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
                          "is out of range [0-%d] %d %d.\n", txq_id,
                          index, q->n_bd, q->write_ptr, q->read_ptr);
                return;
@@ -3320,7 +1741,7 @@ static void iwl3945_cmd_queue_reclaim(struct iwl3945_priv *priv,
        for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index;
                q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
                if (nfreed > 1) {
-                       IWL_ERROR("HCMD skipped: index (%d) %d %d\n", index,
+                       IWL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", index,
                                        q->write_ptr, q->read_ptr);
                        queue_work(priv->workqueue, &priv->restart);
                        break;
@@ -3338,21 +1759,28 @@ static void iwl3945_cmd_queue_reclaim(struct iwl3945_priv *priv,
  * will be executed.  The attached skb (if present) will only be freed
  * if the callback returns 1
  */
-static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
-                               struct iwl3945_rx_mem_buffer *rxb)
+static void iwl3945_tx_cmd_complete(struct iwl_priv *priv,
+                               struct iwl_rx_mem_buffer *rxb)
 {
-       struct iwl3945_rx_packet *pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
+       struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
        u16 sequence = le16_to_cpu(pkt->hdr.sequence);
        int txq_id = SEQ_TO_QUEUE(sequence);
        int index = SEQ_TO_INDEX(sequence);
-       int huge = sequence & SEQ_HUGE_FRAME;
+       int huge =  !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
        int cmd_index;
-       struct iwl3945_cmd *cmd;
-
-       BUG_ON(txq_id != IWL_CMD_QUEUE_NUM);
+       struct iwl_cmd *cmd;
+
+       if (WARN(txq_id != IWL_CMD_QUEUE_NUM,
+                "wrong command queue %d, sequence 0x%X readp=%d writep=%d\n",
+                 txq_id, sequence,
+                 priv->txq[IWL_CMD_QUEUE_NUM].q.read_ptr,
+                 priv->txq[IWL_CMD_QUEUE_NUM].q.write_ptr)) {
+               iwl_print_hex_dump(priv, IWL_DL_INFO , rxb, 32);
+               return;
+       }
 
        cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge);
-       cmd = &priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index];
+       cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index];
 
        /* Input error checking is done when commands are added to queue. */
        if (cmd->meta.flags & CMD_WANT_SKB) {
@@ -3417,7 +1845,6 @@ static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
  *
  * Driver sequence:
  *
- * iwl3945_rx_queue_alloc()   Allocates rx_free
  * iwl3945_rx_replenish()     Replenishes rx_free list from rx_used, and calls
  *                            iwl3945_rx_queue_restock
  * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx
@@ -3426,7 +1853,7 @@ static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
  *                            are available, schedules iwl3945_rx_replenish
  *
  * -- enable interrupts --
- * ISR - iwl3945_rx()         Detach iwl3945_rx_mem_buffers from pool up to the
+ * ISR - iwl3945_rx()         Detach iwl_rx_mem_buffers from pool up to the
  *                            READ INDEX, detaching the SKB from the pool.
  *                            Moves the packet buffer from queue to rx_used.
  *                            Calls iwl3945_rx_queue_restock to refill any empty
@@ -3435,71 +1862,10 @@ static void iwl3945_tx_cmd_complete(struct iwl3945_priv *priv,
  *
  */
 
-/**
- * iwl3945_rx_queue_space - Return number of free slots available in queue.
- */
-static int iwl3945_rx_queue_space(const struct iwl3945_rx_queue *q)
-{
-       int s = q->read - q->write;
-       if (s <= 0)
-               s += RX_QUEUE_SIZE;
-       /* keep some buffer to not confuse full and empty queue */
-       s -= 2;
-       if (s < 0)
-               s = 0;
-       return s;
-}
-
-/**
- * iwl3945_rx_queue_update_write_ptr - Update the write pointer for the RX queue
- */
-int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, struct iwl3945_rx_queue *q)
-{
-       u32 reg = 0;
-       int rc = 0;
-       unsigned long flags;
-
-       spin_lock_irqsave(&q->lock, flags);
-
-       if (q->need_update == 0)
-               goto exit_unlock;
-
-       /* If power-saving is in use, make sure device is awake */
-       if (test_bit(STATUS_POWER_PMI, &priv->status)) {
-               reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
-
-               if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
-                       iwl3945_set_bit(priv, CSR_GP_CNTRL,
-                                   CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-                       goto exit_unlock;
-               }
-
-               rc = iwl3945_grab_nic_access(priv);
-               if (rc)
-                       goto exit_unlock;
-
-               /* Device expects a multiple of 8 */
-               iwl3945_write_direct32(priv, FH_RSCSR_CHNL0_WPTR,
-                                    q->write & ~0x7);
-               iwl3945_release_nic_access(priv);
-
-       /* Else device is assumed to be awake */
-       } else
-               /* Device expects a multiple of 8 */
-               iwl3945_write32(priv, FH_RSCSR_CHNL0_WPTR, q->write & ~0x7);
-
-
-       q->need_update = 0;
-
- exit_unlock:
-       spin_unlock_irqrestore(&q->lock, flags);
-       return rc;
-}
-
 /**
  * iwl3945_dma_addr2rbd_ptr - convert a DMA address to a uCode read buffer ptr
  */
-static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl3945_priv *priv,
+static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl_priv *priv,
                                          dma_addr_t dma_addr)
 {
        return cpu_to_le32((u32)dma_addr);
@@ -3516,24 +1882,24 @@ static inline __le32 iwl3945_dma_addr2rbd_ptr(struct iwl3945_priv *priv,
  * also updates the memory address in the firmware to reference the new
  * target buffer.
  */
-static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv)
+static int iwl3945_rx_queue_restock(struct iwl_priv *priv)
 {
-       struct iwl3945_rx_queue *rxq = &priv->rxq;
+       struct iwl_rx_queue *rxq = &priv->rxq;
        struct list_head *element;
-       struct iwl3945_rx_mem_buffer *rxb;
+       struct iwl_rx_mem_buffer *rxb;
        unsigned long flags;
        int write, rc;
 
        spin_lock_irqsave(&rxq->lock, flags);
        write = rxq->write & ~0x7;
-       while ((iwl3945_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
+       while ((iwl_rx_queue_space(rxq) > 0) && (rxq->free_count)) {
                /* Get next free Rx buffer, remove from free list */
                element = rxq->rx_free.next;
-               rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list);
+               rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
                list_del(element);
 
                /* Point to Rx buffer via next RBD in circular buffer */
-               rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->dma_addr);
+               rxq->bd[rxq->write] = iwl3945_dma_addr2rbd_ptr(priv, rxb->real_dma_addr);
                rxq->queue[rxq->write] = rxb;
                rxq->write = (rxq->write + 1) & RX_QUEUE_MASK;
                rxq->free_count--;
@@ -3552,7 +1918,7 @@ static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv)
                spin_lock_irqsave(&rxq->lock, flags);
                rxq->need_update = 1;
                spin_unlock_irqrestore(&rxq->lock, flags);
-               rc = iwl3945_rx_queue_update_write_ptr(priv, rxq);
+               rc = iwl_rx_queue_update_write_ptr(priv, rxq);
                if (rc)
                        return rc;
        }
@@ -3568,24 +1934,24 @@ static int iwl3945_rx_queue_restock(struct iwl3945_priv *priv)
  * Also restock the Rx queue via iwl3945_rx_queue_restock.
  * This is called as a scheduled work item (except for during initialization)
  */
-static void iwl3945_rx_allocate(struct iwl3945_priv *priv)
+static void iwl3945_rx_allocate(struct iwl_priv *priv)
 {
-       struct iwl3945_rx_queue *rxq = &priv->rxq;
+       struct iwl_rx_queue *rxq = &priv->rxq;
        struct list_head *element;
-       struct iwl3945_rx_mem_buffer *rxb;
+       struct iwl_rx_mem_buffer *rxb;
        unsigned long flags;
        spin_lock_irqsave(&rxq->lock, flags);
        while (!list_empty(&rxq->rx_used)) {
                element = rxq->rx_used.next;
-               rxb = list_entry(element, struct iwl3945_rx_mem_buffer, list);
+               rxb = list_entry(element, struct iwl_rx_mem_buffer, list);
 
                /* Alloc a new receive buffer */
                rxb->skb =
-                   alloc_skb(IWL_RX_BUF_SIZE, __GFP_NOWARN | GFP_ATOMIC);
+                   alloc_skb(priv->hw_params.rx_buf_size,
+                               __GFP_NOWARN | GFP_ATOMIC);
                if (!rxb->skb) {
                        if (net_ratelimit())
-                               printk(KERN_CRIT DRV_NAME
-                                      ": Can not allocate SKB buffers\n");
+                               IWL_CRIT(priv, ": Can not allocate SKB buffers\n");
                        /* We don't reschedule replenish work here -- we will
                         * call the restock method and if it still needs
                         * more buffers it will schedule replenish */
@@ -3604,9 +1970,10 @@ static void iwl3945_rx_allocate(struct iwl3945_priv *priv)
                list_del(element);
 
                /* Get physical address of RB/SKB */
-               rxb->dma_addr =
-                   pci_map_single(priv->pci_dev, rxb->skb->data,
-                                  IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+               rxb->real_dma_addr = pci_map_single(priv->pci_dev,
+                                               rxb->skb->data,
+                                               priv->hw_params.rx_buf_size,
+                                               PCI_DMA_FROMDEVICE);
                list_add_tail(&rxb->list, &rxq->rx_free);
                rxq->free_count++;
        }
@@ -3618,7 +1985,7 @@ static void iwl3945_rx_allocate(struct iwl3945_priv *priv)
  */
 static void __iwl3945_rx_replenish(void *data)
 {
-       struct iwl3945_priv *priv = data;
+       struct iwl_priv *priv = data;
 
        iwl3945_rx_allocate(priv);
        iwl3945_rx_queue_restock(priv);
@@ -3627,7 +1994,7 @@ static void __iwl3945_rx_replenish(void *data)
 
 void iwl3945_rx_replenish(void *data)
 {
-       struct iwl3945_priv *priv = data;
+       struct iwl_priv *priv = data;
        unsigned long flags;
 
        iwl3945_rx_allocate(priv);
@@ -3637,84 +2004,6 @@ void iwl3945_rx_replenish(void *data)
        spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-/* Assumes that the skb field of the buffers in 'pool' is kept accurate.
- * If an SKB has been detached, the POOL needs to have its SKB set to NULL
- * This free routine walks the list of POOL entries and if SKB is set to
- * non NULL it is unmapped and freed
- */
-static void iwl3945_rx_queue_free(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
-{
-       int i;
-       for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) {
-               if (rxq->pool[i].skb != NULL) {
-                       pci_unmap_single(priv->pci_dev,
-                                        rxq->pool[i].dma_addr,
-                                        IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
-                       dev_kfree_skb(rxq->pool[i].skb);
-               }
-       }
-
-       pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd,
-                           rxq->dma_addr);
-       rxq->bd = NULL;
-}
-
-int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv)
-{
-       struct iwl3945_rx_queue *rxq = &priv->rxq;
-       struct pci_dev *dev = priv->pci_dev;
-       int i;
-
-       spin_lock_init(&rxq->lock);
-       INIT_LIST_HEAD(&rxq->rx_free);
-       INIT_LIST_HEAD(&rxq->rx_used);
-
-       /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */
-       rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr);
-       if (!rxq->bd)
-               return -ENOMEM;
-
-       /* Fill the rx_used queue with _all_ of the Rx buffers */
-       for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++)
-               list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
-
-       /* Set us so that we have processed and used all buffers, but have
-        * not restocked the Rx queue with fresh buffers */
-       rxq->read = rxq->write = 0;
-       rxq->free_count = 0;
-       rxq->need_update = 0;
-       return 0;
-}
-
-void iwl3945_rx_queue_reset(struct iwl3945_priv *priv, struct iwl3945_rx_queue *rxq)
-{
-       unsigned long flags;
-       int i;
-       spin_lock_irqsave(&rxq->lock, flags);
-       INIT_LIST_HEAD(&rxq->rx_free);
-       INIT_LIST_HEAD(&rxq->rx_used);
-       /* Fill the rx_used queue with _all_ of the Rx buffers */
-       for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) {
-               /* In the reset function, these buffers may have been allocated
-                * to an SKB, so we need to unmap and free potential storage */
-               if (rxq->pool[i].skb != NULL) {
-                       pci_unmap_single(priv->pci_dev,
-                                        rxq->pool[i].dma_addr,
-                                        IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
-                       priv->alloc_rxb_skb--;
-                       dev_kfree_skb(rxq->pool[i].skb);
-                       rxq->pool[i].skb = NULL;
-               }
-               list_add_tail(&rxq->pool[i].list, &rxq->rx_used);
-       }
-
-       /* Set us so that we have processed and used all buffers, but have
-        * not restocked the Rx queue with fresh buffers */
-       rxq->read = rxq->write = 0;
-       rxq->free_count = 0;
-       spin_unlock_irqrestore(&rxq->lock, flags);
-}
-
 /* Convert linear signal-to-noise ratio into dB */
 static u8 ratio2dB[100] = {
 /*      0   1   2   3   4   5   6   7   8   9 */
@@ -3800,11 +2089,11 @@ int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm)
  * the appropriate handlers, including command responses,
  * frame-received notifications, and other notifications.
  */
-static void iwl3945_rx_handle(struct iwl3945_priv *priv)
+static void iwl3945_rx_handle(struct iwl_priv *priv)
 {
-       struct iwl3945_rx_mem_buffer *rxb;
-       struct iwl3945_rx_packet *pkt;
-       struct iwl3945_rx_queue *rxq = &priv->rxq;
+       struct iwl_rx_mem_buffer *rxb;
+       struct iwl_rx_packet *pkt;
+       struct iwl_rx_queue *rxq = &priv->rxq;
        u32 r, i;
        int reclaim;
        unsigned long flags;
@@ -3813,14 +2102,14 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
 
        /* uCode's read index (stored in shared DRAM) indicates the last Rx
         * buffer that the driver may process (last buffer filled by ucode). */
-       r = iwl3945_hw_get_rx_read(priv);
+       r = le16_to_cpu(rxq->rb_stts->closed_rb_num) &  0x0FFF;
        i = rxq->read;
 
-       if (iwl3945_rx_queue_space(rxq) > (RX_QUEUE_SIZE / 2))
+       if (iwl_rx_queue_space(rxq) > (RX_QUEUE_SIZE / 2))
                fill_rx = 1;
        /* Rx interrupt, but nothing sent from uCode */
        if (i == r)
-               IWL_DEBUG(IWL_DL_RX | IWL_DL_ISR, "r = %d, i = %d\n", r, i);
+               IWL_DEBUG(priv, IWL_DL_RX | IWL_DL_ISR, "r = %d, i = %d\n", r, i);
 
        while (i != r) {
                rxb = rxq->queue[i];
@@ -3832,10 +2121,10 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
 
                rxq->queue[i] = NULL;
 
-               pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->dma_addr,
-                                           IWL_RX_BUF_SIZE,
+               pci_dma_sync_single_for_cpu(priv->pci_dev, rxb->real_dma_addr,
+                                           priv->hw_params.rx_buf_size,
                                            PCI_DMA_FROMDEVICE);
-               pkt = (struct iwl3945_rx_packet *)rxb->skb->data;
+               pkt = (struct iwl_rx_packet *)rxb->skb->data;
 
                /* Reclaim a command buffer only if this packet is a response
                 *   to a (driver-originated) command.
@@ -3851,13 +2140,13 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
                 *   handle those that need handling via function in
                 *   rx_handlers table.  See iwl3945_setup_rx_handlers() */
                if (priv->rx_handlers[pkt->hdr.cmd]) {
-                       IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR,
+                       IWL_DEBUG(priv, IWL_DL_HCMD | IWL_DL_RX | IWL_DL_ISR,
                                "r = %d, i = %d, %s, 0x%02x\n", r, i,
                                get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
                        priv->rx_handlers[pkt->hdr.cmd] (priv, rxb);
                } else {
                        /* No handling needed */
-                       IWL_DEBUG(IWL_DL_HOST_COMMAND | IWL_DL_RX | IWL_DL_ISR,
+                       IWL_DEBUG(priv, IWL_DL_HCMD | IWL_DL_RX | IWL_DL_ISR,
                                "r %d i %d No handler needed for %s, 0x%02x\n",
                                r, i, get_cmd_string(pkt->hdr.cmd),
                                pkt->hdr.cmd);
@@ -3865,12 +2154,12 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
 
                if (reclaim) {
                        /* Invoke any callbacks, transfer the skb to caller, and
-                        * fire off the (possibly) blocking iwl3945_send_cmd()
+                        * fire off the (possibly) blocking iwl_send_cmd()
                         * as we reclaim the driver command queue */
                        if (rxb && rxb->skb)
                                iwl3945_tx_cmd_complete(priv, rxb);
                        else
-                               IWL_WARNING("Claim null rxb?\n");
+                               IWL_WARN(priv, "Claim null rxb?\n");
                }
 
                /* For now we just don't re-use anything.  We can tweak this
@@ -3882,8 +2171,9 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
                        rxb->skb = NULL;
                }
 
-               pci_unmap_single(priv->pci_dev, rxb->dma_addr,
-                                IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
+               pci_unmap_single(priv->pci_dev, rxb->real_dma_addr,
+                               priv->hw_params.rx_buf_size,
+                               PCI_DMA_FROMDEVICE);
                spin_lock_irqsave(&rxq->lock, flags);
                list_add_tail(&rxb->list, &priv->rxq.rx_used);
                spin_unlock_irqrestore(&rxq->lock, flags);
@@ -3905,81 +2195,16 @@ static void iwl3945_rx_handle(struct iwl3945_priv *priv)
        iwl3945_rx_queue_restock(priv);
 }
 
-/**
- * iwl3945_tx_queue_update_write_ptr - Send new write index to hardware
- */
-static int iwl3945_tx_queue_update_write_ptr(struct iwl3945_priv *priv,
-                                 struct iwl3945_tx_queue *txq)
-{
-       u32 reg = 0;
-       int rc = 0;
-       int txq_id = txq->q.id;
-
-       if (txq->need_update == 0)
-               return rc;
-
-       /* if we're trying to save power */
-       if (test_bit(STATUS_POWER_PMI, &priv->status)) {
-               /* wake up nic if it's powered down ...
-                * uCode will wake up, and interrupt us again, so next
-                * time we'll skip this part. */
-               reg = iwl3945_read32(priv, CSR_UCODE_DRV_GP1);
-
-               if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) {
-                       IWL_DEBUG_INFO("Requesting wakeup, GP1 = 0x%x\n", reg);
-                       iwl3945_set_bit(priv, CSR_GP_CNTRL,
-                                   CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
-                       return rc;
-               }
-
-               /* restore this queue's parameters in nic hardware. */
-               rc = iwl3945_grab_nic_access(priv);
-               if (rc)
-                       return rc;
-               iwl3945_write_direct32(priv, HBUS_TARG_WRPTR,
-                                    txq->q.write_ptr | (txq_id << 8));
-               iwl3945_release_nic_access(priv);
-
-       /* else not in power-save mode, uCode will never sleep when we're
-        * trying to tx (during RFKILL, we're not trying to tx). */
-       } else
-               iwl3945_write32(priv, HBUS_TARG_WRPTR,
-                           txq->q.write_ptr | (txq_id << 8));
-
-       txq->need_update = 0;
-
-       return rc;
-}
-
-#ifdef CONFIG_IWL3945_DEBUG
-static void iwl3945_print_rx_config_cmd(struct iwl3945_rxon_cmd *rxon)
-{
-       IWL_DEBUG_RADIO("RX CONFIG:\n");
-       iwl3945_print_hex_dump(IWL_DL_RADIO, (u8 *) rxon, sizeof(*rxon));
-       IWL_DEBUG_RADIO("u16 channel: 0x%x\n", le16_to_cpu(rxon->channel));
-       IWL_DEBUG_RADIO("u32 flags: 0x%08X\n", le32_to_cpu(rxon->flags));
-       IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
-                       le32_to_cpu(rxon->filter_flags));
-       IWL_DEBUG_RADIO("u8 dev_type: 0x%x\n", rxon->dev_type);
-       IWL_DEBUG_RADIO("u8 ofdm_basic_rates: 0x%02x\n",
-                       rxon->ofdm_basic_rates);
-       IWL_DEBUG_RADIO("u8 cck_basic_rates: 0x%02x\n", rxon->cck_basic_rates);
-       IWL_DEBUG_RADIO("u8[6] node_addr: %pM\n", rxon->node_addr);
-       IWL_DEBUG_RADIO("u8[6] bssid_addr: %pM\n", rxon->bssid_addr);
-       IWL_DEBUG_RADIO("u16 assoc_id: 0x%x\n", le16_to_cpu(rxon->assoc_id));
-}
-#endif
-
-static void iwl3945_enable_interrupts(struct iwl3945_priv *priv)
+static void iwl3945_enable_interrupts(struct iwl_priv *priv)
 {
-       IWL_DEBUG_ISR("Enabling interrupts\n");
+       IWL_DEBUG_ISR(priv, "Enabling interrupts\n");
        set_bit(STATUS_INT_ENABLED, &priv->status);
-       iwl3945_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK);
+       iwl_write32(priv, CSR_INT_MASK, CSR_INI_SET_MASK);
 }
 
 
 /* call this function to flush any scheduled tasklet */
-static inline void iwl_synchronize_irq(struct iwl3945_priv *priv)
+static inline void iwl_synchronize_irq(struct iwl_priv *priv)
 {
        /* wait to make sure we flush pending tasklet*/
        synchronize_irq(priv->pci_dev->irq);
@@ -3987,18 +2212,18 @@ static inline void iwl_synchronize_irq(struct iwl3945_priv *priv)
 }
 
 
-static inline void iwl3945_disable_interrupts(struct iwl3945_priv *priv)
+static inline void iwl3945_disable_interrupts(struct iwl_priv *priv)
 {
        clear_bit(STATUS_INT_ENABLED, &priv->status);
 
        /* disable interrupts from uCode/NIC to host */
-       iwl3945_write32(priv, CSR_INT_MASK, 0x00000000);
+       iwl_write32(priv, CSR_INT_MASK, 0x00000000);
 
        /* acknowledge/clear/reset any interrupts still pending
         * from uCode or flow handler (Rx/Tx DMA) */
-       iwl3945_write32(priv, CSR_INT, 0xffffffff);
-       iwl3945_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
-       IWL_DEBUG_ISR("Disabled interrupts\n");
+       iwl_write32(priv, CSR_INT, 0xffffffff);
+       iwl_write32(priv, CSR_FH_INT_STATUS, 0xffffffff);
+       IWL_DEBUG_ISR(priv, "Disabled interrupts\n");
 }
 
 static const char *desc_lookup(int i)
@@ -4024,7 +2249,7 @@ static const char *desc_lookup(int i)
 #define ERROR_START_OFFSET  (1 * sizeof(u32))
 #define ERROR_ELEM_SIZE     (7 * sizeof(u32))
 
-static void iwl3945_dump_nic_error_log(struct iwl3945_priv *priv)
+static void iwl3945_dump_nic_error_log(struct iwl_priv *priv)
 {
        u32 i;
        u32 desc, time, count, base, data1;
@@ -4034,49 +2259,50 @@ static void iwl3945_dump_nic_error_log(struct iwl3945_priv *priv)
        base = le32_to_cpu(priv->card_alive.error_event_table_ptr);
 
        if (!iwl3945_hw_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Not valid error log pointer 0x%08X\n", base);
+               IWL_ERR(priv, "Not valid error log pointer 0x%08X\n", base);
                return;
        }
 
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
+               IWL_WARN(priv, "Can not read from adapter at this time.\n");
                return;
        }
 
-       count = iwl3945_read_targ_mem(priv, base);
+       count = iwl_read_targ_mem(priv, base);
 
        if (ERROR_START_OFFSET <= count * ERROR_ELEM_SIZE) {
-               IWL_ERROR("Start IWL Error Log Dump:\n");
-               IWL_ERROR("Status: 0x%08lX, count: %d\n", priv->status, count);
+               IWL_ERR(priv, "Start IWL Error Log Dump:\n");
+               IWL_ERR(priv, "Status: 0x%08lX, count: %d\n",
+                       priv->status, count);
        }
 
-       IWL_ERROR("Desc       Time       asrtPC  blink2 "
+       IWL_ERR(priv, "Desc       Time       asrtPC  blink2 "
                  "ilink1  nmiPC   Line\n");
        for (i = ERROR_START_OFFSET;
             i < (count * ERROR_ELEM_SIZE) + ERROR_START_OFFSET;
             i += ERROR_ELEM_SIZE) {
-               desc = iwl3945_read_targ_mem(priv, base + i);
+               desc = iwl_read_targ_mem(priv, base + i);
                time =
-                   iwl3945_read_targ_mem(priv, base + i + 1 * sizeof(u32));
+                   iwl_read_targ_mem(priv, base + i + 1 * sizeof(u32));
                blink1 =
-                   iwl3945_read_targ_mem(priv, base + i + 2 * sizeof(u32));
+                   iwl_read_targ_mem(priv, base + i + 2 * sizeof(u32));
                blink2 =
-                   iwl3945_read_targ_mem(priv, base + i + 3 * sizeof(u32));
+                   iwl_read_targ_mem(priv, base + i + 3 * sizeof(u32));
                ilink1 =
-                   iwl3945_read_targ_mem(priv, base + i + 4 * sizeof(u32));
+                   iwl_read_targ_mem(priv, base + i + 4 * sizeof(u32));
                ilink2 =
-                   iwl3945_read_targ_mem(priv, base + i + 5 * sizeof(u32));
+                   iwl_read_targ_mem(priv, base + i + 5 * sizeof(u32));
                data1 =
-                   iwl3945_read_targ_mem(priv, base + i + 6 * sizeof(u32));
+                   iwl_read_targ_mem(priv, base + i + 6 * sizeof(u32));
 
-               IWL_ERROR
-                   ("%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
-                    desc_lookup(desc), desc, time, blink1, blink2,
-                    ilink1, ilink2, data1);
+               IWL_ERR(priv,
+                       "%-13s (#%d) %010u 0x%05X 0x%05X 0x%05X 0x%05X %u\n\n",
+                       desc_lookup(desc), desc, time, blink1, blink2,
+                       ilink1, ilink2, data1);
        }
 
-       iwl3945_release_nic_access(priv);
+       iwl_release_nic_access(priv);
 
 }
 
@@ -4085,9 +2311,9 @@ static void iwl3945_dump_nic_error_log(struct iwl3945_priv *priv)
 /**
  * iwl3945_print_event_log - Dump error event log to syslog
  *
- * NOTE: Must be called with iwl3945_grab_nic_access() already obtained!
+ * NOTE: Must be called with iwl_grab_nic_access() already obtained!
  */
-static void iwl3945_print_event_log(struct iwl3945_priv *priv, u32 start_idx,
+static void iwl3945_print_event_log(struct iwl_priv *priv, u32 start_idx,
                                u32 num_events, u32 mode)
 {
        u32 i;
@@ -4111,21 +2337,22 @@ static void iwl3945_print_event_log(struct iwl3945_priv *priv, u32 start_idx,
        /* "time" is actually "data" for mode 0 (no timestamp).
         * place event id # at far right for easier visual parsing. */
        for (i = 0; i < num_events; i++) {
-               ev = iwl3945_read_targ_mem(priv, ptr);
+               ev = iwl_read_targ_mem(priv, ptr);
                ptr += sizeof(u32);
-               time = iwl3945_read_targ_mem(priv, ptr);
+               time = iwl_read_targ_mem(priv, ptr);
                ptr += sizeof(u32);
-               if (mode == 0)
-                       IWL_ERROR("0x%08x\t%04u\n", time, ev); /* data, ev */
-               else {
-                       data = iwl3945_read_targ_mem(priv, ptr);
+               if (mode == 0) {
+                       /* data, ev */
+                       IWL_ERR(priv, "0x%08x\t%04u\n", time, ev);
+               } else {
+                       data = iwl_read_targ_mem(priv, ptr);
                        ptr += sizeof(u32);
-                       IWL_ERROR("%010u\t0x%08x\t%04u\n", time, data, ev);
+                       IWL_ERR(priv, "%010u\t0x%08x\t%04u\n", time, data, ev);
                }
        }
 }
 
-static void iwl3945_dump_nic_event_log(struct iwl3945_priv *priv)
+static void iwl3945_dump_nic_event_log(struct iwl_priv *priv)
 {
        int rc;
        u32 base;       /* SRAM byte address of event log header */
@@ -4137,32 +2364,32 @@ static void iwl3945_dump_nic_event_log(struct iwl3945_priv *priv)
 
        base = le32_to_cpu(priv->card_alive.log_event_table_ptr);
        if (!iwl3945_hw_valid_rtc_data_addr(base)) {
-               IWL_ERROR("Invalid event log pointer 0x%08X\n", base);
+               IWL_ERR(priv, "Invalid event log pointer 0x%08X\n", base);
                return;
        }
 
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
-               IWL_WARNING("Can not read from adapter at this time.\n");
+               IWL_WARN(priv, "Can not read from adapter at this time.\n");
                return;
        }
 
        /* event log header */
-       capacity = iwl3945_read_targ_mem(priv, base);
-       mode = iwl3945_read_targ_mem(priv, base + (1 * sizeof(u32)));
-       num_wraps = iwl3945_read_targ_mem(priv, base + (2 * sizeof(u32)));
-       next_entry = iwl3945_read_targ_mem(priv, base + (3 * sizeof(u32)));
+       capacity = iwl_read_targ_mem(priv, base);
+       mode = iwl_read_targ_mem(priv, base + (1 * sizeof(u32)));
+       num_wraps = iwl_read_targ_mem(priv, base + (2 * sizeof(u32)));
+       next_entry = iwl_read_targ_mem(priv, base + (3 * sizeof(u32)));
 
        size = num_wraps ? capacity : next_entry;
 
        /* bail out if nothing in log */
        if (size == 0) {
-               IWL_ERROR("Start IWL Event Log Dump: nothing in log\n");
-               iwl3945_release_nic_access(priv);
+               IWL_ERR(priv, "Start IWL Event Log Dump: nothing in log\n");
+               iwl_release_nic_access(priv);
                return;
        }
 
-       IWL_ERROR("Start IWL Event Log Dump: display count %d, wraps %d\n",
+       IWL_ERR(priv, "Start IWL Event Log Dump: display count %d, wraps %d\n",
                  size, num_wraps);
 
        /* if uCode has wrapped back to top of log, start at the oldest entry,
@@ -4174,48 +2401,10 @@ static void iwl3945_dump_nic_event_log(struct iwl3945_priv *priv)
        /* (then/else) start at top of log */
        iwl3945_print_event_log(priv, 0, next_entry, mode);
 
-       iwl3945_release_nic_access(priv);
-}
-
-/**
- * iwl3945_irq_handle_error - called for HW or SW error interrupt from card
- */
-static void iwl3945_irq_handle_error(struct iwl3945_priv *priv)
-{
-       /* Set the FW error flag -- cleared on iwl3945_down */
-       set_bit(STATUS_FW_ERROR, &priv->status);
-
-       /* Cancel currently queued command. */
-       clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
-
-#ifdef CONFIG_IWL3945_DEBUG
-       if (iwl3945_debug_level & IWL_DL_FW_ERRORS) {
-               iwl3945_dump_nic_error_log(priv);
-               iwl3945_dump_nic_event_log(priv);
-               iwl3945_print_rx_config_cmd(&priv->staging_rxon);
-       }
-#endif
-
-       wake_up_interruptible(&priv->wait_command_queue);
-
-       /* Keep the restart process from trying to send host
-        * commands by clearing the INIT status bit */
-       clear_bit(STATUS_READY, &priv->status);
-
-       if (!test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-               IWL_DEBUG(IWL_DL_INFO | IWL_DL_FW_ERRORS,
-                         "Restarting adapter due to uCode error.\n");
-
-               if (iwl3945_is_associated(priv)) {
-                       memcpy(&priv->recovery_rxon, &priv->active_rxon,
-                              sizeof(priv->recovery_rxon));
-                       priv->error_recovering = 1;
-               }
-               queue_work(priv->workqueue, &priv->restart);
-       }
+       iwl_release_nic_access(priv);
 }
 
-static void iwl3945_error_recovery(struct iwl3945_priv *priv)
+static void iwl3945_error_recovery(struct iwl_priv *priv)
 {
        unsigned long flags;
 
@@ -4232,12 +2421,12 @@ static void iwl3945_error_recovery(struct iwl3945_priv *priv)
        spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
+static void iwl3945_irq_tasklet(struct iwl_priv *priv)
 {
        u32 inta, handled = 0;
        u32 inta_fh;
        unsigned long flags;
-#ifdef CONFIG_IWL3945_DEBUG
+#ifdef CONFIG_IWLWIFI_DEBUG
        u32 inta_mask;
 #endif
 
@@ -4246,20 +2435,20 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
        /* Ack/clear/reset pending uCode interrupts.
         * Note:  Some bits in CSR_INT are "OR" of bits in CSR_FH_INT_STATUS,
         *  and will clear only when CSR_FH_INT_STATUS gets cleared. */
-       inta = iwl3945_read32(priv, CSR_INT);
-       iwl3945_write32(priv, CSR_INT, inta);
+       inta = iwl_read32(priv, CSR_INT);
+       iwl_write32(priv, CSR_INT, inta);
 
        /* Ack/clear/reset pending flow-handler (DMA) interrupts.
         * Any new interrupts that happen after this, either while we're
         * in this tasklet, or later, will show up in next ISR/tasklet. */
-       inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
-       iwl3945_write32(priv, CSR_FH_INT_STATUS, inta_fh);
+       inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
+       iwl_write32(priv, CSR_FH_INT_STATUS, inta_fh);
 
-#ifdef CONFIG_IWL3945_DEBUG
-       if (iwl3945_debug_level & IWL_DL_ISR) {
+#ifdef CONFIG_IWLWIFI_DEBUG
+       if (priv->debug_level & IWL_DL_ISR) {
                /* just for debug */
-               inta_mask = iwl3945_read32(priv, CSR_INT_MASK);
-               IWL_DEBUG_ISR("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
+               inta_mask = iwl_read32(priv, CSR_INT_MASK);
+               IWL_DEBUG_ISR(priv, "inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
                              inta, inta_mask, inta_fh);
        }
 #endif
@@ -4275,12 +2464,12 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
 
        /* Now service all interrupt bits discovered above. */
        if (inta & CSR_INT_BIT_HW_ERR) {
-               IWL_ERROR("Microcode HW error detected.  Restarting.\n");
+               IWL_ERR(priv, "Microcode HW error detected.  Restarting.\n");
 
                /* Tell the device to stop sending interrupts */
                iwl3945_disable_interrupts(priv);
 
-               iwl3945_irq_handle_error(priv);
+               iwl_irq_handle_error(priv);
 
                handled |= CSR_INT_BIT_HW_ERR;
 
@@ -4289,16 +2478,16 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
                return;
        }
 
-#ifdef CONFIG_IWL3945_DEBUG
-       if (iwl3945_debug_level & (IWL_DL_ISR)) {
+#ifdef CONFIG_IWLWIFI_DEBUG
+       if (priv->debug_level & (IWL_DL_ISR)) {
                /* NIC fires this, but we don't use it, redundant with WAKEUP */
                if (inta & CSR_INT_BIT_SCD)
-                       IWL_DEBUG_ISR("Scheduler finished to transmit "
+                       IWL_DEBUG_ISR(priv, "Scheduler finished to transmit "
                                      "the frame/frames.\n");
 
                /* Alive notification via Rx interrupt will do the real work */
                if (inta & CSR_INT_BIT_ALIVE)
-                       IWL_DEBUG_ISR("Alive interrupt\n");
+                       IWL_DEBUG_ISR(priv, "Alive interrupt\n");
        }
 #endif
        /* Safely ignore these bits for debug checks below */
@@ -4306,22 +2495,22 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
 
        /* Error detected by uCode */
        if (inta & CSR_INT_BIT_SW_ERR) {
-               IWL_ERROR("Microcode SW error detected.  Restarting 0x%X.\n",
-                         inta);
-               iwl3945_irq_handle_error(priv);
+               IWL_ERR(priv, "Microcode SW error detected. "
+                       "Restarting 0x%X.\n", inta);
+               iwl_irq_handle_error(priv);
                handled |= CSR_INT_BIT_SW_ERR;
        }
 
        /* uCode wakes up after power-down sleep */
        if (inta & CSR_INT_BIT_WAKEUP) {
-               IWL_DEBUG_ISR("Wakeup interrupt\n");
-               iwl3945_rx_queue_update_write_ptr(priv, &priv->rxq);
-               iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[0]);
-               iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[1]);
-               iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[2]);
-               iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[3]);
-               iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[4]);
-               iwl3945_tx_queue_update_write_ptr(priv, &priv->txq[5]);
+               IWL_DEBUG_ISR(priv, "Wakeup interrupt\n");
+               iwl_rx_queue_update_write_ptr(priv, &priv->rxq);
+               iwl_txq_update_write_ptr(priv, &priv->txq[0]);
+               iwl_txq_update_write_ptr(priv, &priv->txq[1]);
+               iwl_txq_update_write_ptr(priv, &priv->txq[2]);
+               iwl_txq_update_write_ptr(priv, &priv->txq[3]);
+               iwl_txq_update_write_ptr(priv, &priv->txq[4]);
+               iwl_txq_update_write_ptr(priv, &priv->txq[5]);
 
                handled |= CSR_INT_BIT_WAKEUP;
        }
@@ -4335,25 +2524,24 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
        }
 
        if (inta & CSR_INT_BIT_FH_TX) {
-               IWL_DEBUG_ISR("Tx interrupt\n");
-
-               iwl3945_write32(priv, CSR_FH_INT_STATUS, (1 << 6));
-               if (!iwl3945_grab_nic_access(priv)) {
-                       iwl3945_write_direct32(priv,
-                                            FH_TCSR_CREDIT
-                                            (ALM_FH_SRVC_CHNL), 0x0);
-                       iwl3945_release_nic_access(priv);
+               IWL_DEBUG_ISR(priv, "Tx interrupt\n");
+
+               iwl_write32(priv, CSR_FH_INT_STATUS, (1 << 6));
+               if (!iwl_grab_nic_access(priv)) {
+                       iwl_write_direct32(priv, FH39_TCSR_CREDIT
+                                            (FH39_SRVC_CHNL), 0x0);
+                       iwl_release_nic_access(priv);
                }
                handled |= CSR_INT_BIT_FH_TX;
        }
 
        if (inta & ~handled)
-               IWL_ERROR("Unhandled INTA bits 0x%08x\n", inta & ~handled);
+               IWL_ERR(priv, "Unhandled INTA bits 0x%08x\n", inta & ~handled);
 
        if (inta & ~CSR_INI_SET_MASK) {
-               IWL_WARNING("Disabled INTA bits 0x%08x were pending\n",
+               IWL_WARN(priv, "Disabled INTA bits 0x%08x were pending\n",
                         inta & ~CSR_INI_SET_MASK);
-               IWL_WARNING("   with FH_INT = 0x%08x\n", inta_fh);
+               IWL_WARN(priv, "   with FH_INT = 0x%08x\n", inta_fh);
        }
 
        /* Re-enable all interrupts */
@@ -4361,12 +2549,12 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
        if (test_bit(STATUS_INT_ENABLED, &priv->status))
                iwl3945_enable_interrupts(priv);
 
-#ifdef CONFIG_IWL3945_DEBUG
-       if (iwl3945_debug_level & (IWL_DL_ISR)) {
-               inta = iwl3945_read32(priv, CSR_INT);
-               inta_mask = iwl3945_read32(priv, CSR_INT_MASK);
-               inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
-               IWL_DEBUG_ISR("End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
+#ifdef CONFIG_IWLWIFI_DEBUG
+       if (priv->debug_level & (IWL_DL_ISR)) {
+               inta = iwl_read32(priv, CSR_INT);
+               inta_mask = iwl_read32(priv, CSR_INT_MASK);
+               inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
+               IWL_DEBUG_ISR(priv, "End inta 0x%08x, enabled 0x%08x, fh 0x%08x, "
                        "flags 0x%08lx\n", inta, inta_mask, inta_fh, flags);
        }
 #endif
@@ -4375,7 +2563,7 @@ static void iwl3945_irq_tasklet(struct iwl3945_priv *priv)
 
 static irqreturn_t iwl3945_isr(int irq, void *data)
 {
-       struct iwl3945_priv *priv = data;
+       struct iwl_priv *priv = data;
        u32 inta, inta_mask;
        u32 inta_fh;
        if (!priv)
@@ -4387,380 +2575,69 @@ static irqreturn_t iwl3945_isr(int irq, void *data)
         *    back-to-back ISRs and sporadic interrupts from our NIC.
         * If we have something to service, the tasklet will re-enable ints.
         * If we *don't* have something, we'll re-enable before leaving here. */
-       inta_mask = iwl3945_read32(priv, CSR_INT_MASK);  /* just for debug */
-       iwl3945_write32(priv, CSR_INT_MASK, 0x00000000);
+       inta_mask = iwl_read32(priv, CSR_INT_MASK);  /* just for debug */
+       iwl_write32(priv, CSR_INT_MASK, 0x00000000);
 
        /* Discover which interrupts are active/pending */
-       inta = iwl3945_read32(priv, CSR_INT);
-       inta_fh = iwl3945_read32(priv, CSR_FH_INT_STATUS);
+       inta = iwl_read32(priv, CSR_INT);
+       inta_fh = iwl_read32(priv, CSR_FH_INT_STATUS);
 
        /* Ignore interrupt if there's nothing in NIC to service.
         * This may be due to IRQ shared with another device,
         * or due to sporadic interrupts thrown from our NIC. */
        if (!inta && !inta_fh) {
-               IWL_DEBUG_ISR("Ignore interrupt, inta == 0, inta_fh == 0\n");
-               goto none;
-       }
-
-       if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
-               /* Hardware disappeared */
-               IWL_WARNING("HARDWARE GONE?? INTA == 0x%08x\n", inta);
-               goto unplugged;
-       }
-
-       IWL_DEBUG_ISR("ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
-                     inta, inta_mask, inta_fh);
-
-       inta &= ~CSR_INT_BIT_SCD;
-
-       /* iwl3945_irq_tasklet() will service interrupts and re-enable them */
-       if (likely(inta || inta_fh))
-               tasklet_schedule(&priv->irq_tasklet);
-unplugged:
-       spin_unlock(&priv->lock);
-
-       return IRQ_HANDLED;
-
- none:
-       /* re-enable interrupts here since we don't have anything to service. */
-       /* only Re-enable if disabled by irq */
-       if (test_bit(STATUS_INT_ENABLED, &priv->status))
-               iwl3945_enable_interrupts(priv);
-       spin_unlock(&priv->lock);
-       return IRQ_NONE;
-}
-
-/************************** EEPROM BANDS ****************************
- *
- * The iwl3945_eeprom_band definitions below provide the mapping from the
- * EEPROM contents to the specific channel number supported for each
- * band.
- *
- * For example, iwl3945_priv->eeprom.band_3_channels[4] from the band_3
- * definition below maps to physical channel 42 in the 5.2GHz spectrum.
- * The specific geography and calibration information for that channel
- * is contained in the eeprom map itself.
- *
- * During init, we copy the eeprom information and channel map
- * information into priv->channel_info_24/52 and priv->channel_map_24/52
- *
- * channel_map_24/52 provides the index in the channel_info array for a
- * given channel.  We have to have two separate maps as there is channel
- * overlap with the 2.4GHz and 5.2GHz spectrum as seen in band_1 and
- * band_2
- *
- * A value of 0xff stored in the channel_map indicates that the channel
- * is not supported by the hardware at all.
- *
- * A value of 0xfe in the channel_map indicates that the channel is not
- * valid for Tx with the current hardware.  This means that
- * while the system can tune and receive on a given channel, it may not
- * be able to associate or transmit any frames on that
- * channel.  There is no corresponding channel information for that
- * entry.
- *
- *********************************************************************/
-
-/* 2.4 GHz */
-static const u8 iwl3945_eeprom_band_1[14] = {
-       1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14
-};
-
-/* 5.2 GHz bands */
-static const u8 iwl3945_eeprom_band_2[] = {    /* 4915-5080MHz */
-       183, 184, 185, 187, 188, 189, 192, 196, 7, 8, 11, 12, 16
-};
-
-static const u8 iwl3945_eeprom_band_3[] = {    /* 5170-5320MHz */
-       34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64
-};
-
-static const u8 iwl3945_eeprom_band_4[] = {    /* 5500-5700MHz */
-       100, 104, 108, 112, 116, 120, 124, 128, 132, 136, 140
-};
-
-static const u8 iwl3945_eeprom_band_5[] = {    /* 5725-5825MHz */
-       145, 149, 153, 157, 161, 165
-};
-
-static void iwl3945_init_band_reference(const struct iwl3945_priv *priv, int band,
-                                   int *eeprom_ch_count,
-                                   const struct iwl3945_eeprom_channel
-                                   **eeprom_ch_info,
-                                   const u8 **eeprom_ch_index)
-{
-       switch (band) {
-       case 1:         /* 2.4GHz band */
-               *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_1);
-               *eeprom_ch_info = priv->eeprom.band_1_channels;
-               *eeprom_ch_index = iwl3945_eeprom_band_1;
-               break;
-       case 2:         /* 4.9GHz band */
-               *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_2);
-               *eeprom_ch_info = priv->eeprom.band_2_channels;
-               *eeprom_ch_index = iwl3945_eeprom_band_2;
-               break;
-       case 3:         /* 5.2GHz band */
-               *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_3);
-               *eeprom_ch_info = priv->eeprom.band_3_channels;
-               *eeprom_ch_index = iwl3945_eeprom_band_3;
-               break;
-       case 4:         /* 5.5GHz band */
-               *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_4);
-               *eeprom_ch_info = priv->eeprom.band_4_channels;
-               *eeprom_ch_index = iwl3945_eeprom_band_4;
-               break;
-       case 5:         /* 5.7GHz band */
-               *eeprom_ch_count = ARRAY_SIZE(iwl3945_eeprom_band_5);
-               *eeprom_ch_info = priv->eeprom.band_5_channels;
-               *eeprom_ch_index = iwl3945_eeprom_band_5;
-               break;
-       default:
-               BUG();
-               return;
-       }
-}
-
-/**
- * iwl3945_get_channel_info - Find driver's private channel info
- *
- * Based on band and channel number.
- */
-const struct iwl3945_channel_info *iwl3945_get_channel_info(const struct iwl3945_priv *priv,
-                                                   enum ieee80211_band band, u16 channel)
-{
-       int i;
-
-       switch (band) {
-       case IEEE80211_BAND_5GHZ:
-               for (i = 14; i < priv->channel_count; i++) {
-                       if (priv->channel_info[i].channel == channel)
-                               return &priv->channel_info[i];
-               }
-               break;
-
-       case IEEE80211_BAND_2GHZ:
-               if (channel >= 1 && channel <= 14)
-                       return &priv->channel_info[channel - 1];
-               break;
-       case IEEE80211_NUM_BANDS:
-               WARN_ON(1);
-       }
-
-       return NULL;
-}
-
-#define CHECK_AND_PRINT(x) ((eeprom_ch_info[ch].flags & EEPROM_CHANNEL_##x) \
-                           ? # x " " : "")
-
-/**
- * iwl3945_init_channel_map - Set up driver's info for all possible channels
- */
-static int iwl3945_init_channel_map(struct iwl3945_priv *priv)
-{
-       int eeprom_ch_count = 0;
-       const u8 *eeprom_ch_index = NULL;
-       const struct iwl3945_eeprom_channel *eeprom_ch_info = NULL;
-       int band, ch;
-       struct iwl3945_channel_info *ch_info;
-
-       if (priv->channel_count) {
-               IWL_DEBUG_INFO("Channel map already initialized.\n");
-               return 0;
-       }
-
-       if (priv->eeprom.version < 0x2f) {
-               IWL_WARNING("Unsupported EEPROM version: 0x%04X\n",
-                           priv->eeprom.version);
-               return -EINVAL;
-       }
-
-       IWL_DEBUG_INFO("Initializing regulatory info from EEPROM\n");
-
-       priv->channel_count =
-           ARRAY_SIZE(iwl3945_eeprom_band_1) +
-           ARRAY_SIZE(iwl3945_eeprom_band_2) +
-           ARRAY_SIZE(iwl3945_eeprom_band_3) +
-           ARRAY_SIZE(iwl3945_eeprom_band_4) +
-           ARRAY_SIZE(iwl3945_eeprom_band_5);
-
-       IWL_DEBUG_INFO("Parsing data for %d channels.\n", priv->channel_count);
-
-       priv->channel_info = kzalloc(sizeof(struct iwl3945_channel_info) *
-                                    priv->channel_count, GFP_KERNEL);
-       if (!priv->channel_info) {
-               IWL_ERROR("Could not allocate channel_info\n");
-               priv->channel_count = 0;
-               return -ENOMEM;
-       }
-
-       ch_info = priv->channel_info;
-
-       /* Loop through the 5 EEPROM bands adding them in order to the
-        * channel map we maintain (that contains additional information than
-        * what just in the EEPROM) */
-       for (band = 1; band <= 5; band++) {
-
-               iwl3945_init_band_reference(priv, band, &eeprom_ch_count,
-                                       &eeprom_ch_info, &eeprom_ch_index);
-
-               /* Loop through each band adding each of the channels */
-               for (ch = 0; ch < eeprom_ch_count; ch++) {
-                       ch_info->channel = eeprom_ch_index[ch];
-                       ch_info->band = (band == 1) ? IEEE80211_BAND_2GHZ :
-                           IEEE80211_BAND_5GHZ;
-
-                       /* permanently store EEPROM's channel regulatory flags
-                        *   and max power in channel info database. */
-                       ch_info->eeprom = eeprom_ch_info[ch];
-
-                       /* Copy the run-time flags so they are there even on
-                        * invalid channels */
-                       ch_info->flags = eeprom_ch_info[ch].flags;
-
-                       if (!(is_channel_valid(ch_info))) {
-                               IWL_DEBUG_INFO("Ch. %d Flags %x [%sGHz] - "
-                                              "No traffic\n",
-                                              ch_info->channel,
-                                              ch_info->flags,
-                                              is_channel_a_band(ch_info) ?
-                                              "5.2" : "2.4");
-                               ch_info++;
-                               continue;
-                       }
-
-                       /* Initialize regulatory-based run-time data */
-                       ch_info->max_power_avg = ch_info->curr_txpow =
-                           eeprom_ch_info[ch].max_power_avg;
-                       ch_info->scan_power = eeprom_ch_info[ch].max_power_avg;
-                       ch_info->min_power = 0;
-
-                       IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x"
-                                      " %ddBm): Ad-Hoc %ssupported\n",
-                                      ch_info->channel,
-                                      is_channel_a_band(ch_info) ?
-                                      "5.2" : "2.4",
-                                      CHECK_AND_PRINT(VALID),
-                                      CHECK_AND_PRINT(IBSS),
-                                      CHECK_AND_PRINT(ACTIVE),
-                                      CHECK_AND_PRINT(RADAR),
-                                      CHECK_AND_PRINT(WIDE),
-                                      CHECK_AND_PRINT(DFS),
-                                      eeprom_ch_info[ch].flags,
-                                      eeprom_ch_info[ch].max_power_avg,
-                                      ((eeprom_ch_info[ch].
-                                        flags & EEPROM_CHANNEL_IBSS)
-                                       && !(eeprom_ch_info[ch].
-                                            flags & EEPROM_CHANNEL_RADAR))
-                                      ? "" : "not ");
-
-                       /* Set the user_txpower_limit to the highest power
-                        * supported by any channel */
-                       if (eeprom_ch_info[ch].max_power_avg >
-                           priv->user_txpower_limit)
-                               priv->user_txpower_limit =
-                                   eeprom_ch_info[ch].max_power_avg;
-
-                       ch_info++;
-               }
+               IWL_DEBUG_ISR(priv, "Ignore interrupt, inta == 0, inta_fh == 0\n");
+               goto none;
        }
 
-       /* Set up txpower settings in driver for all channels */
-       if (iwl3945_txpower_set_from_eeprom(priv))
-               return -EIO;
+       if ((inta == 0xFFFFFFFF) || ((inta & 0xFFFFFFF0) == 0xa5a5a5a0)) {
+               /* Hardware disappeared */
+               IWL_WARN(priv, "HARDWARE GONE?? INTA == 0x%08x\n", inta);
+               goto unplugged;
+       }
 
-       return 0;
-}
+       IWL_DEBUG_ISR(priv, "ISR inta 0x%08x, enabled 0x%08x, fh 0x%08x\n",
+                     inta, inta_mask, inta_fh);
 
-/*
- * iwl3945_free_channel_map - undo allocations in iwl3945_init_channel_map
- */
-static void iwl3945_free_channel_map(struct iwl3945_priv *priv)
-{
-       kfree(priv->channel_info);
-       priv->channel_count = 0;
-}
-
-/* For active scan, listen ACTIVE_DWELL_TIME (msec) on each channel after
- * sending probe req.  This should be set long enough to hear probe responses
- * from more than one AP.  */
-#define IWL_ACTIVE_DWELL_TIME_24    (30)       /* all times in msec */
-#define IWL_ACTIVE_DWELL_TIME_52    (20)
-
-#define IWL_ACTIVE_DWELL_FACTOR_24GHZ (3)
-#define IWL_ACTIVE_DWELL_FACTOR_52GHZ (2)
-
-/* For faster active scanning, scan will move to the next channel if fewer than
- * PLCP_QUIET_THRESH packets are heard on this channel within
- * ACTIVE_QUIET_TIME after sending probe request.  This shortens the dwell
- * time if it's a quiet channel (nothing responded to our probe, and there's
- * no other traffic).
- * Disable "quiet" feature by setting PLCP_QUIET_THRESH to 0. */
-#define IWL_PLCP_QUIET_THRESH       __constant_cpu_to_le16(1)  /* packets */
-#define IWL_ACTIVE_QUIET_TIME       __constant_cpu_to_le16(10) /* msec */
-
-/* For passive scan, listen PASSIVE_DWELL_TIME (msec) on each channel.
- * Must be set longer than active dwell time.
- * For the most reliable scan, set > AP beacon interval (typically 100msec). */
-#define IWL_PASSIVE_DWELL_TIME_24   (20)       /* all times in msec */
-#define IWL_PASSIVE_DWELL_TIME_52   (10)
-#define IWL_PASSIVE_DWELL_BASE      (100)
-#define IWL_CHANNEL_TUNE_TIME       5
-
-#define IWL_SCAN_PROBE_MASK(n)  (BIT(n) | (BIT(n) - BIT(1)))
-
-static inline u16 iwl3945_get_active_dwell_time(struct iwl3945_priv *priv,
-                                               enum ieee80211_band band,
-                                               u8 n_probes)
-{
-       if (band == IEEE80211_BAND_5GHZ)
-               return IWL_ACTIVE_DWELL_TIME_52 +
-                       IWL_ACTIVE_DWELL_FACTOR_52GHZ * (n_probes + 1);
-       else
-               return IWL_ACTIVE_DWELL_TIME_24 +
-                       IWL_ACTIVE_DWELL_FACTOR_24GHZ * (n_probes + 1);
-}
+       inta &= ~CSR_INT_BIT_SCD;
 
-static u16 iwl3945_get_passive_dwell_time(struct iwl3945_priv *priv,
-                                         enum ieee80211_band band)
-{
-       u16 passive = (band == IEEE80211_BAND_2GHZ) ?
-           IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_24 :
-           IWL_PASSIVE_DWELL_BASE + IWL_PASSIVE_DWELL_TIME_52;
+       /* iwl3945_irq_tasklet() will service interrupts and re-enable them */
+       if (likely(inta || inta_fh))
+               tasklet_schedule(&priv->irq_tasklet);
+unplugged:
+       spin_unlock(&priv->lock);
 
-       if (iwl3945_is_associated(priv)) {
-               /* If we're associated, we clamp the maximum passive
-                * dwell time to be 98% of the beacon interval (minus
-                * 2 * channel tune time) */
-               passive = priv->beacon_int;
-               if ((passive > IWL_PASSIVE_DWELL_BASE) || !passive)
-                       passive = IWL_PASSIVE_DWELL_BASE;
-               passive = (passive * 98) / 100 - IWL_CHANNEL_TUNE_TIME * 2;
-       }
+       return IRQ_HANDLED;
 
-       return passive;
+ none:
+       /* re-enable interrupts here since we don't have anything to service. */
+       /* only Re-enable if disabled by irq */
+       if (test_bit(STATUS_INT_ENABLED, &priv->status))
+               iwl3945_enable_interrupts(priv);
+       spin_unlock(&priv->lock);
+       return IRQ_NONE;
 }
 
-static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
+static int iwl3945_get_channels_for_scan(struct iwl_priv *priv,
                                         enum ieee80211_band band,
                                     u8 is_active, u8 n_probes,
                                     struct iwl3945_scan_channel *scan_ch)
 {
        const struct ieee80211_channel *channels = NULL;
        const struct ieee80211_supported_band *sband;
-       const struct iwl3945_channel_info *ch_info;
+       const struct iwl_channel_info *ch_info;
        u16 passive_dwell = 0;
        u16 active_dwell = 0;
        int added, i;
 
-       sband = iwl3945_get_band(priv, band);
+       sband = iwl_get_hw_mode(priv, band);
        if (!sband)
                return 0;
 
        channels = sband->channels;
 
-       active_dwell = iwl3945_get_active_dwell_time(priv, band, n_probes);
-       passive_dwell = iwl3945_get_passive_dwell_time(priv, band);
+       active_dwell = iwl_get_active_dwell_time(priv, band, n_probes);
+       passive_dwell = iwl_get_passive_dwell_time(priv, band);
 
        if (passive_dwell <= active_dwell)
                passive_dwell = active_dwell + 1;
@@ -4771,9 +2648,9 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
 
                scan_ch->channel = channels[i].hw_value;
 
-               ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel);
+               ch_info = iwl_get_channel_info(priv, band, scan_ch->channel);
                if (!is_channel_valid(ch_info)) {
-                       IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n",
+                       IWL_DEBUG_SCAN(priv, "Channel %d is INVALID for this band.\n",
                                       scan_ch->channel);
                        continue;
                }
@@ -4798,12 +2675,12 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
                 * hearing clear Rx packet).*/
                if (IWL_UCODE_API(priv->ucode_ver) >= 2) {
                        if (n_probes)
-                               scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);
+                               scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes);
                } else {
                        /* uCode v1 does not allow setting direct probe bits on
                         * passive channel. */
                        if ((scan_ch->type & 1) && n_probes)
-                               scan_ch->type |= IWL_SCAN_PROBE_MASK(n_probes);
+                               scan_ch->type |= IWL39_SCAN_PROBE_MASK(n_probes);
                }
 
                /* Set txpower levels to defaults */
@@ -4821,7 +2698,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
                         */
                }
 
-               IWL_DEBUG_SCAN("Scanning %d [%s %d]\n",
+               IWL_DEBUG_SCAN(priv, "Scanning %d [%s %d]\n",
                               scan_ch->channel,
                               (scan_ch->type & 1) ? "ACTIVE" : "PASSIVE",
                               (scan_ch->type & 1) ?
@@ -4831,11 +2708,11 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
                added++;
        }
 
-       IWL_DEBUG_SCAN("total channels to scan %d \n", added);
+       IWL_DEBUG_SCAN(priv, "total channels to scan %d \n", added);
        return added;
 }
 
-static void iwl3945_init_hw_rates(struct iwl3945_priv *priv,
+static void iwl3945_init_hw_rates(struct iwl_priv *priv,
                              struct ieee80211_rate *rates)
 {
        int i;
@@ -4845,7 +2722,7 @@ static void iwl3945_init_hw_rates(struct iwl3945_priv *priv,
                rates[i].hw_value = i; /* Rate scaling will work on indexes */
                rates[i].hw_value_short = i;
                rates[i].flags = 0;
-               if ((i > IWL_LAST_OFDM_RATE) || (i < IWL_FIRST_OFDM_RATE)) {
+               if ((i > IWL39_LAST_OFDM_RATE) || (i < IWL_FIRST_OFDM_RATE)) {
                        /*
                         * If CCK != 1M then set short preamble rate flag.
                         */
@@ -4855,145 +2732,13 @@ static void iwl3945_init_hw_rates(struct iwl3945_priv *priv,
        }
 }
 
-/**
- * iwl3945_init_geos - Initialize mac80211's geo/channel info based from eeprom
- */
-static int iwl3945_init_geos(struct iwl3945_priv *priv)
-{
-       struct iwl3945_channel_info *ch;
-       struct ieee80211_supported_band *sband;
-       struct ieee80211_channel *channels;
-       struct ieee80211_channel *geo_ch;
-       struct ieee80211_rate *rates;
-       int i = 0;
-
-       if (priv->bands[IEEE80211_BAND_2GHZ].n_bitrates ||
-           priv->bands[IEEE80211_BAND_5GHZ].n_bitrates) {
-               IWL_DEBUG_INFO("Geography modes already initialized.\n");
-               set_bit(STATUS_GEO_CONFIGURED, &priv->status);
-               return 0;
-       }
-
-       channels = kzalloc(sizeof(struct ieee80211_channel) *
-                          priv->channel_count, GFP_KERNEL);
-       if (!channels)
-               return -ENOMEM;
-
-       rates = kzalloc((sizeof(struct ieee80211_rate) * (IWL_RATE_COUNT + 1)),
-                       GFP_KERNEL);
-       if (!rates) {
-               kfree(channels);
-               return -ENOMEM;
-       }
-
-       /* 5.2GHz channels start after the 2.4GHz channels */
-       sband = &priv->bands[IEEE80211_BAND_5GHZ];
-       sband->channels = &channels[ARRAY_SIZE(iwl3945_eeprom_band_1)];
-       /* just OFDM */
-       sband->bitrates = &rates[IWL_FIRST_OFDM_RATE];
-       sband->n_bitrates = IWL_RATE_COUNT - IWL_FIRST_OFDM_RATE;
-
-       sband = &priv->bands[IEEE80211_BAND_2GHZ];
-       sband->channels = channels;
-       /* OFDM & CCK */
-       sband->bitrates = rates;
-       sband->n_bitrates = IWL_RATE_COUNT;
-
-       priv->ieee_channels = channels;
-       priv->ieee_rates = rates;
-
-       iwl3945_init_hw_rates(priv, rates);
-
-       for (i = 0;  i < priv->channel_count; i++) {
-               ch = &priv->channel_info[i];
-
-               /* FIXME: might be removed if scan is OK*/
-               if (!is_channel_valid(ch))
-                       continue;
-
-               if (is_channel_a_band(ch))
-                       sband =  &priv->bands[IEEE80211_BAND_5GHZ];
-               else
-                       sband =  &priv->bands[IEEE80211_BAND_2GHZ];
-
-               geo_ch = &sband->channels[sband->n_channels++];
-
-               geo_ch->center_freq = ieee80211_channel_to_frequency(ch->channel);
-               geo_ch->max_power = ch->max_power_avg;
-               geo_ch->max_antenna_gain = 0xff;
-               geo_ch->hw_value = ch->channel;
-
-               if (is_channel_valid(ch)) {
-                       if (!(ch->flags & EEPROM_CHANNEL_IBSS))
-                               geo_ch->flags |= IEEE80211_CHAN_NO_IBSS;
-
-                       if (!(ch->flags & EEPROM_CHANNEL_ACTIVE))
-                               geo_ch->flags |= IEEE80211_CHAN_PASSIVE_SCAN;
-
-                       if (ch->flags & EEPROM_CHANNEL_RADAR)
-                               geo_ch->flags |= IEEE80211_CHAN_RADAR;
-
-                       if (ch->max_power_avg > priv->max_channel_txpower_limit)
-                               priv->max_channel_txpower_limit =
-                                   ch->max_power_avg;
-               } else {
-                       geo_ch->flags |= IEEE80211_CHAN_DISABLED;
-               }
-
-               /* Save flags for reg domain usage */
-               geo_ch->orig_flags = geo_ch->flags;
-
-               IWL_DEBUG_INFO("Channel %d Freq=%d[%sGHz] %s flag=0%X\n",
-                               ch->channel, geo_ch->center_freq,
-                               is_channel_a_band(ch) ?  "5.2" : "2.4",
-                               geo_ch->flags & IEEE80211_CHAN_DISABLED ?
-                               "restricted" : "valid",
-                                geo_ch->flags);
-       }
-
-       if ((priv->bands[IEEE80211_BAND_5GHZ].n_channels == 0) &&
-            priv->cfg->sku & IWL_SKU_A) {
-               printk(KERN_INFO DRV_NAME
-                      ": Incorrectly detected BG card as ABG.  Please send "
-                      "your PCI ID 0x%04X:0x%04X to maintainer.\n",
-                      priv->pci_dev->device, priv->pci_dev->subsystem_device);
-                priv->cfg->sku &= ~IWL_SKU_A;
-       }
-
-       printk(KERN_INFO DRV_NAME
-              ": Tunable channels: %d 802.11bg, %d 802.11a channels\n",
-              priv->bands[IEEE80211_BAND_2GHZ].n_channels,
-              priv->bands[IEEE80211_BAND_5GHZ].n_channels);
-
-       if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
-               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
-                       &priv->bands[IEEE80211_BAND_2GHZ];
-       if (priv->bands[IEEE80211_BAND_5GHZ].n_channels)
-               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
-                       &priv->bands[IEEE80211_BAND_5GHZ];
-
-       set_bit(STATUS_GEO_CONFIGURED, &priv->status);
-
-       return 0;
-}
-
-/*
- * iwl3945_free_geos - undo allocations in iwl3945_init_geos
- */
-static void iwl3945_free_geos(struct iwl3945_priv *priv)
-{
-       kfree(priv->ieee_channels);
-       kfree(priv->ieee_rates);
-       clear_bit(STATUS_GEO_CONFIGURED, &priv->status);
-}
-
 /******************************************************************************
  *
  * uCode download functions
  *
  ******************************************************************************/
 
-static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv)
+static void iwl3945_dealloc_ucode_pci(struct iwl_priv *priv)
 {
        iwl_free_fw_desc(priv->pci_dev, &priv->ucode_code);
        iwl_free_fw_desc(priv->pci_dev, &priv->ucode_data);
@@ -5007,29 +2752,30 @@ static void iwl3945_dealloc_ucode_pci(struct iwl3945_priv *priv)
  * iwl3945_verify_inst_full - verify runtime uCode image in card vs. host,
  *     looking at all data.
  */
-static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 *image, u32 len)
+static int iwl3945_verify_inst_full(struct iwl_priv *priv, __le32 *image, u32 len)
 {
        u32 val;
        u32 save_len = len;
        int rc = 0;
        u32 errcnt;
 
-       IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
+       IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
 
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc)
                return rc;
 
-       iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR, RTC_INST_LOWER_BOUND);
+       iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR,
+                              IWL39_RTC_INST_LOWER_BOUND);
 
        errcnt = 0;
        for (; len > 0; len -= sizeof(u32), image++) {
                /* read data comes through single port, auto-incr addr */
                /* NOTE: Use the debugless read so we don't flood kernel log
                 * if IWL_DL_IO is set */
-               val = _iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
+               val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
                if (val != le32_to_cpu(*image)) {
-                       IWL_ERROR("uCode INST section is invalid at "
+                       IWL_ERR(priv, "uCode INST section is invalid at "
                                  "offset 0x%x, is 0x%x, s/b 0x%x\n",
                                  save_len - len, val, le32_to_cpu(*image));
                        rc = -EIO;
@@ -5039,10 +2785,11 @@ static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 *image, u3
                }
        }
 
-       iwl3945_release_nic_access(priv);
+       iwl_release_nic_access(priv);
 
        if (!errcnt)
-               IWL_DEBUG_INFO("ucode image in INSTRUCTION memory is good\n");
+               IWL_DEBUG_INFO(priv,
+                       "ucode image in INSTRUCTION memory is good\n");
 
        return rc;
 }
@@ -5053,16 +2800,16 @@ static int iwl3945_verify_inst_full(struct iwl3945_priv *priv, __le32 *image, u3
  *   using sample data 100 bytes apart.  If these sample points are good,
  *   it's a pretty good bet that everything between them is good, too.
  */
-static int iwl3945_verify_inst_sparse(struct iwl3945_priv *priv, __le32 *image, u32 len)
+static int iwl3945_verify_inst_sparse(struct iwl_priv *priv, __le32 *image, u32 len)
 {
        u32 val;
        int rc = 0;
        u32 errcnt = 0;
        u32 i;
 
-       IWL_DEBUG_INFO("ucode inst image size is %u\n", len);
+       IWL_DEBUG_INFO(priv, "ucode inst image size is %u\n", len);
 
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc)
                return rc;
 
@@ -5070,12 +2817,12 @@ static int iwl3945_verify_inst_sparse(struct iwl3945_priv *priv, __le32 *image,
                /* read data comes through single port, auto-incr addr */
                /* NOTE: Use the debugless read so we don't flood kernel log
                 * if IWL_DL_IO is set */
-               iwl3945_write_direct32(priv, HBUS_TARG_MEM_RADDR,
-                       i + RTC_INST_LOWER_BOUND);
-               val = _iwl3945_read_direct32(priv, HBUS_TARG_MEM_RDAT);
+               iwl_write_direct32(priv, HBUS_TARG_MEM_RADDR,
+                       i + IWL39_RTC_INST_LOWER_BOUND);
+               val = _iwl_read_direct32(priv, HBUS_TARG_MEM_RDAT);
                if (val != le32_to_cpu(*image)) {
 #if 0 /* Enable this if you want to see details */
-                       IWL_ERROR("uCode INST section is invalid at "
+                       IWL_ERR(priv, "uCode INST section is invalid at "
                                  "offset 0x%x, is 0x%x, s/b 0x%x\n",
                                  i, val, *image);
 #endif
@@ -5086,7 +2833,7 @@ static int iwl3945_verify_inst_sparse(struct iwl3945_priv *priv, __le32 *image,
                }
        }
 
-       iwl3945_release_nic_access(priv);
+       iwl_release_nic_access(priv);
 
        return rc;
 }
@@ -5096,7 +2843,7 @@ static int iwl3945_verify_inst_sparse(struct iwl3945_priv *priv, __le32 *image,
  * iwl3945_verify_ucode - determine which instruction image is in SRAM,
  *    and verify its contents
  */
-static int iwl3945_verify_ucode(struct iwl3945_priv *priv)
+static int iwl3945_verify_ucode(struct iwl_priv *priv)
 {
        __le32 *image;
        u32 len;
@@ -5107,7 +2854,7 @@ static int iwl3945_verify_ucode(struct iwl3945_priv *priv)
        len = priv->ucode_boot.len;
        rc = iwl3945_verify_inst_sparse(priv, image, len);
        if (rc == 0) {
-               IWL_DEBUG_INFO("Bootstrap uCode is good in inst SRAM\n");
+               IWL_DEBUG_INFO(priv, "Bootstrap uCode is good in inst SRAM\n");
                return 0;
        }
 
@@ -5116,7 +2863,7 @@ static int iwl3945_verify_ucode(struct iwl3945_priv *priv)
        len = priv->ucode_init.len;
        rc = iwl3945_verify_inst_sparse(priv, image, len);
        if (rc == 0) {
-               IWL_DEBUG_INFO("Initialize uCode is good in inst SRAM\n");
+               IWL_DEBUG_INFO(priv, "Initialize uCode is good in inst SRAM\n");
                return 0;
        }
 
@@ -5125,11 +2872,11 @@ static int iwl3945_verify_ucode(struct iwl3945_priv *priv)
        len = priv->ucode_code.len;
        rc = iwl3945_verify_inst_sparse(priv, image, len);
        if (rc == 0) {
-               IWL_DEBUG_INFO("Runtime uCode is good in inst SRAM\n");
+               IWL_DEBUG_INFO(priv, "Runtime uCode is good in inst SRAM\n");
                return 0;
        }
 
-       IWL_ERROR("NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
+       IWL_ERR(priv, "NO VALID UCODE IMAGE IN INSTRUCTION SRAM!!\n");
 
        /* Since nothing seems to match, show first several data entries in
         * instruction SRAM, so maybe visual inspection will give a clue.
@@ -5141,160 +2888,10 @@ static int iwl3945_verify_ucode(struct iwl3945_priv *priv)
        return rc;
 }
 
-
-/* check contents of special bootstrap uCode SRAM */
-static int iwl3945_verify_bsm(struct iwl3945_priv *priv)
-{
-       __le32 *image = priv->ucode_boot.v_addr;
-       u32 len = priv->ucode_boot.len;
-       u32 reg;
-       u32 val;
-
-       IWL_DEBUG_INFO("Begin verify bsm\n");
-
-       /* verify BSM SRAM contents */
-       val = iwl3945_read_prph(priv, BSM_WR_DWCOUNT_REG);
-       for (reg = BSM_SRAM_LOWER_BOUND;
-            reg < BSM_SRAM_LOWER_BOUND + len;
-            reg += sizeof(u32), image++) {
-               val = iwl3945_read_prph(priv, reg);
-               if (val != le32_to_cpu(*image)) {
-                       IWL_ERROR("BSM uCode verification failed at "
-                                 "addr 0x%08X+%u (of %u), is 0x%x, s/b 0x%x\n",
-                                 BSM_SRAM_LOWER_BOUND,
-                                 reg - BSM_SRAM_LOWER_BOUND, len,
-                                 val, le32_to_cpu(*image));
-                       return -EIO;
-               }
-       }
-
-       IWL_DEBUG_INFO("BSM bootstrap uCode image OK\n");
-
-       return 0;
-}
-
-/**
- * iwl3945_load_bsm - Load bootstrap instructions
- *
- * BSM operation:
- *
- * The Bootstrap State Machine (BSM) stores a short bootstrap uCode program
- * in special SRAM that does not power down during RFKILL.  When powering back
- * up after power-saving sleeps (or during initial uCode load), the BSM loads
- * the bootstrap program into the on-board processor, and starts it.
- *
- * The bootstrap program loads (via DMA) instructions and data for a new
- * program from host DRAM locations indicated by the host driver in the
- * BSM_DRAM_* registers.  Once the new program is loaded, it starts
- * automatically.
- *
- * When initializing the NIC, the host driver points the BSM to the
- * "initialize" uCode image.  This uCode sets up some internal data, then
- * notifies host via "initialize alive" that it is complete.
- *
- * The host then replaces the BSM_DRAM_* pointer values to point to the
- * normal runtime uCode instructions and a backup uCode data cache buffer
- * (filled initially with starting data values for the on-board processor),
- * then triggers the "initialize" uCode to load and launch the runtime uCode,
- * which begins normal operation.
- *
- * When doing a power-save shutdown, runtime uCode saves data SRAM into
- * the backup data cache in DRAM before SRAM is powered down.
- *
- * When powering back up, the BSM loads the bootstrap program.  This reloads
- * the runtime uCode instructions and the backup data cache into SRAM,
- * and re-launches the runtime uCode from where it left off.
- */
-static int iwl3945_load_bsm(struct iwl3945_priv *priv)
-{
-       __le32 *image = priv->ucode_boot.v_addr;
-       u32 len = priv->ucode_boot.len;
-       dma_addr_t pinst;
-       dma_addr_t pdata;
-       u32 inst_len;
-       u32 data_len;
-       int rc;
-       int i;
-       u32 done;
-       u32 reg_offset;
-
-       IWL_DEBUG_INFO("Begin load bsm\n");
-
-       /* make sure bootstrap program is no larger than BSM's SRAM size */
-       if (len > IWL_MAX_BSM_SIZE)
-               return -EINVAL;
-
-       /* Tell bootstrap uCode where to find the "Initialize" uCode
-        *   in host DRAM ... host DRAM physical address bits 31:0 for 3945.
-        * NOTE:  iwl3945_initialize_alive_start() will replace these values,
-        *        after the "initialize" uCode has run, to point to
-        *        runtime/protocol instructions and backup data cache. */
-       pinst = priv->ucode_init.p_addr;
-       pdata = priv->ucode_init_data.p_addr;
-       inst_len = priv->ucode_init.len;
-       data_len = priv->ucode_init_data.len;
-
-       rc = iwl3945_grab_nic_access(priv);
-       if (rc)
-               return rc;
-
-       iwl3945_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
-       iwl3945_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
-       iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG, inst_len);
-       iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG, data_len);
-
-       /* Fill BSM memory with bootstrap instructions */
-       for (reg_offset = BSM_SRAM_LOWER_BOUND;
-            reg_offset < BSM_SRAM_LOWER_BOUND + len;
-            reg_offset += sizeof(u32), image++)
-               _iwl3945_write_prph(priv, reg_offset,
-                                         le32_to_cpu(*image));
-
-       rc = iwl3945_verify_bsm(priv);
-       if (rc) {
-               iwl3945_release_nic_access(priv);
-               return rc;
-       }
-
-       /* Tell BSM to copy from BSM SRAM into instruction SRAM, when asked */
-       iwl3945_write_prph(priv, BSM_WR_MEM_SRC_REG, 0x0);
-       iwl3945_write_prph(priv, BSM_WR_MEM_DST_REG,
-                                RTC_INST_LOWER_BOUND);
-       iwl3945_write_prph(priv, BSM_WR_DWCOUNT_REG, len / sizeof(u32));
-
-       /* Load bootstrap code into instruction SRAM now,
-        *   to prepare to load "initialize" uCode */
-       iwl3945_write_prph(priv, BSM_WR_CTRL_REG,
-               BSM_WR_CTRL_REG_BIT_START);
-
-       /* Wait for load of bootstrap uCode to finish */
-       for (i = 0; i < 100; i++) {
-               done = iwl3945_read_prph(priv, BSM_WR_CTRL_REG);
-               if (!(done & BSM_WR_CTRL_REG_BIT_START))
-                       break;
-               udelay(10);
-       }
-       if (i < 100)
-               IWL_DEBUG_INFO("BSM write complete, poll %d iterations\n", i);
-       else {
-               IWL_ERROR("BSM write did not complete!\n");
-               return -EIO;
-       }
-
-       /* Enable future boot loads whenever power management unit triggers it
-        *   (e.g. when powering back up after power-save shutdown) */
-       iwl3945_write_prph(priv, BSM_WR_CTRL_REG,
-               BSM_WR_CTRL_REG_BIT_START_EN);
-
-       iwl3945_release_nic_access(priv);
-
-       return 0;
-}
-
-static void iwl3945_nic_start(struct iwl3945_priv *priv)
+static void iwl3945_nic_start(struct iwl_priv *priv)
 {
        /* Remove all resets to allow NIC to operate */
-       iwl3945_write32(priv, CSR_RESET, 0);
+       iwl_write32(priv, CSR_RESET, 0);
 }
 
 /**
@@ -5302,9 +2899,9 @@ static void iwl3945_nic_start(struct iwl3945_priv *priv)
  *
  * Copy into buffers for card to fetch via bus-mastering
  */
-static int iwl3945_read_ucode(struct iwl3945_priv *priv)
+static int iwl3945_read_ucode(struct iwl_priv *priv)
 {
-       struct iwl3945_ucode *ucode;
+       struct iwl_ucode *ucode;
        int ret = -EINVAL, index;
        const struct firmware *ucode_raw;
        /* firmware file name contains uCode/driver compatibility version */
@@ -5322,7 +2919,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
                sprintf(buf, "%s%u%s", name_pre, index, ".ucode");
                ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev);
                if (ret < 0) {
-                       IWL_ERROR("%s firmware file req failed: Reason %d\n",
+                       IWL_ERR(priv, "%s firmware file req failed: %d\n",
                                  buf, ret);
                        if (ret == -ENOENT)
                                continue;
@@ -5330,9 +2927,12 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
                                goto error;
                } else {
                        if (index < api_max)
-                               IWL_ERROR("Loaded firmware %s, which is deprecated. Please use API v%u instead.\n",
+                               IWL_ERR(priv, "Loaded firmware %s, "
+                                       "which is deprecated. "
+                                       " Please use API v%u instead.\n",
                                          buf, api_max);
-                       IWL_DEBUG_INFO("Got firmware '%s' file (%zd bytes) from disk\n",
+                       IWL_DEBUG_INFO(priv, "Got firmware '%s' file "
+                                      "(%zd bytes) from disk\n",
                                       buf, ucode_raw->size);
                        break;
                }
@@ -5343,7 +2943,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
 
        /* Make sure that we got at least our header! */
        if (ucode_raw->size < sizeof(*ucode)) {
-               IWL_ERROR("File size way too small!\n");
+               IWL_ERR(priv, "File size way too small!\n");
                ret = -EINVAL;
                goto err_release;
        }
@@ -5364,7 +2964,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
         * on the API version read from firware header from here on forward */
 
        if (api_ver < api_min || api_ver > api_max) {
-               IWL_ERROR("Driver unable to support your firmware API. "
+               IWL_ERR(priv, "Driver unable to support your firmware API. "
                          "Driver supports v%u, firmware is v%u.\n",
                          api_max, api_ver);
                priv->ucode_ver = 0;
@@ -5372,23 +2972,29 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
                goto err_release;
        }
        if (api_ver != api_max)
-               IWL_ERROR("Firmware has old API version. Expected %u, "
+               IWL_ERR(priv, "Firmware has old API version. Expected %u, "
                          "got %u. New firmware can be obtained "
                          "from http://www.intellinuxwireless.org.\n",
                          api_max, api_ver);
 
-       printk(KERN_INFO DRV_NAME " loaded firmware version %u.%u.%u.%u\n",
-                      IWL_UCODE_MAJOR(priv->ucode_ver),
-                      IWL_UCODE_MINOR(priv->ucode_ver),
-                      IWL_UCODE_API(priv->ucode_ver),
-                      IWL_UCODE_SERIAL(priv->ucode_ver));
-       IWL_DEBUG_INFO("f/w package hdr ucode version raw = 0x%x\n",
+       IWL_INFO(priv, "loaded firmware version %u.%u.%u.%u\n",
+               IWL_UCODE_MAJOR(priv->ucode_ver),
+               IWL_UCODE_MINOR(priv->ucode_ver),
+               IWL_UCODE_API(priv->ucode_ver),
+               IWL_UCODE_SERIAL(priv->ucode_ver));
+
+       IWL_DEBUG_INFO(priv, "f/w package hdr ucode version raw = 0x%x\n",
                       priv->ucode_ver);
-       IWL_DEBUG_INFO("f/w package hdr runtime inst size = %u\n", inst_size);
-       IWL_DEBUG_INFO("f/w package hdr runtime data size = %u\n", data_size);
-       IWL_DEBUG_INFO("f/w package hdr init inst size = %u\n", init_size);
-       IWL_DEBUG_INFO("f/w package hdr init data size = %u\n", init_data_size);
-       IWL_DEBUG_INFO("f/w package hdr boot inst size = %u\n", boot_size);
+       IWL_DEBUG_INFO(priv, "f/w package hdr runtime inst size = %u\n",
+                      inst_size);
+       IWL_DEBUG_INFO(priv, "f/w package hdr runtime data size = %u\n",
+                      data_size);
+       IWL_DEBUG_INFO(priv, "f/w package hdr init inst size = %u\n",
+                      init_size);
+       IWL_DEBUG_INFO(priv, "f/w package hdr init data size = %u\n",
+                      init_data_size);
+       IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n",
+                      boot_size);
 
 
        /* Verify size of file vs. image size info in file's header */
@@ -5396,40 +3002,43 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
                inst_size + data_size + init_size +
                init_data_size + boot_size) {
 
-               IWL_DEBUG_INFO("uCode file size %d too small\n",
-                              (int)ucode_raw->size);
+               IWL_DEBUG_INFO(priv, "uCode file size %zd too small\n",
+                              ucode_raw->size);
                ret = -EINVAL;
                goto err_release;
        }
 
        /* Verify that uCode images will fit in card's SRAM */
-       if (inst_size > IWL_MAX_INST_SIZE) {
-               IWL_DEBUG_INFO("uCode instr len %d too large to fit in\n",
+       if (inst_size > IWL39_MAX_INST_SIZE) {
+               IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n",
                               inst_size);
                ret = -EINVAL;
                goto err_release;
        }
 
-       if (data_size > IWL_MAX_DATA_SIZE) {
-               IWL_DEBUG_INFO("uCode data len %d too large to fit in\n",
+       if (data_size > IWL39_MAX_DATA_SIZE) {
+               IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n",
                               data_size);
                ret = -EINVAL;
                goto err_release;
        }
-       if (init_size > IWL_MAX_INST_SIZE) {
-               IWL_DEBUG_INFO("uCode init instr len %d too large to fit in\n",
+       if (init_size > IWL39_MAX_INST_SIZE) {
+               IWL_DEBUG_INFO(priv,
+                               "uCode init instr len %d too large to fit in\n",
                                init_size);
                ret = -EINVAL;
                goto err_release;
        }
-       if (init_data_size > IWL_MAX_DATA_SIZE) {
-               IWL_DEBUG_INFO("uCode init data len %d too large to fit in\n",
+       if (init_data_size > IWL39_MAX_DATA_SIZE) {
+               IWL_DEBUG_INFO(priv,
+                               "uCode init data len %d too large to fit in\n",
                                init_data_size);
                ret = -EINVAL;
                goto err_release;
        }
-       if (boot_size > IWL_MAX_BSM_SIZE) {
-               IWL_DEBUG_INFO("uCode boot instr len %d too large to fit in\n",
+       if (boot_size > IWL39_MAX_BSM_SIZE) {
+               IWL_DEBUG_INFO(priv,
+                               "uCode boot instr len %d too large to fit in\n",
                                boot_size);
                ret = -EINVAL;
                goto err_release;
@@ -5479,16 +3088,18 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
        /* Runtime instructions (first block of data in file) */
        src = &ucode->data[0];
        len = priv->ucode_code.len;
-       IWL_DEBUG_INFO("Copying (but not loading) uCode instr len %Zd\n", len);
+       IWL_DEBUG_INFO(priv,
+               "Copying (but not loading) uCode instr len %zd\n", len);
        memcpy(priv->ucode_code.v_addr, src, len);
-       IWL_DEBUG_INFO("uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
+       IWL_DEBUG_INFO(priv, "uCode instr buf vaddr = 0x%p, paddr = 0x%08x\n",
                priv->ucode_code.v_addr, (u32)priv->ucode_code.p_addr);
 
        /* Runtime data (2nd block)
         * NOTE:  Copy into backup buffer will be done in iwl3945_up()  */
        src = &ucode->data[inst_size];
        len = priv->ucode_data.len;
-       IWL_DEBUG_INFO("Copying (but not loading) uCode data len %Zd\n", len);
+       IWL_DEBUG_INFO(priv,
+               "Copying (but not loading) uCode data len %zd\n", len);
        memcpy(priv->ucode_data.v_addr, src, len);
        memcpy(priv->ucode_data_backup.v_addr, src, len);
 
@@ -5496,8 +3107,8 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
        if (init_size) {
                src = &ucode->data[inst_size + data_size];
                len = priv->ucode_init.len;
-               IWL_DEBUG_INFO("Copying (but not loading) init instr len %Zd\n",
-                              len);
+               IWL_DEBUG_INFO(priv,
+                       "Copying (but not loading) init instr len %zd\n", len);
                memcpy(priv->ucode_init.v_addr, src, len);
        }
 
@@ -5505,16 +3116,16 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
        if (init_data_size) {
                src = &ucode->data[inst_size + data_size + init_size];
                len = priv->ucode_init_data.len;
-               IWL_DEBUG_INFO("Copying (but not loading) init data len %d\n",
-                              (int)len);
+               IWL_DEBUG_INFO(priv,
+                       "Copying (but not loading) init data len %zd\n", len);
                memcpy(priv->ucode_init_data.v_addr, src, len);
        }
 
        /* Bootstrap instructions (5th block) */
        src = &ucode->data[inst_size + data_size + init_size + init_data_size];
        len = priv->ucode_boot.len;
-       IWL_DEBUG_INFO("Copying (but not loading) boot instr len %d\n",
-                      (int)len);
+       IWL_DEBUG_INFO(priv,
+               "Copying (but not loading) boot instr len %zd\n", len);
        memcpy(priv->ucode_boot.v_addr, src, len);
 
        /* We have our copies now, allow OS release its copies */
@@ -5522,7 +3133,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
        return 0;
 
  err_pci_alloc:
-       IWL_ERROR("failed to allocate pci memory\n");
+       IWL_ERR(priv, "failed to allocate pci memory\n");
        ret = -ENOMEM;
        iwl3945_dealloc_ucode_pci(priv);
 
@@ -5543,7 +3154,7 @@ static int iwl3945_read_ucode(struct iwl3945_priv *priv)
  * We need to replace them to load runtime uCode inst and data,
  * and to save runtime data when powering down.
  */
-static int iwl3945_set_ucode_ptrs(struct iwl3945_priv *priv)
+static int iwl3945_set_ucode_ptrs(struct iwl_priv *priv)
 {
        dma_addr_t pinst;
        dma_addr_t pdata;
@@ -5555,28 +3166,28 @@ static int iwl3945_set_ucode_ptrs(struct iwl3945_priv *priv)
        pdata = priv->ucode_data_backup.p_addr;
 
        spin_lock_irqsave(&priv->lock, flags);
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
                spin_unlock_irqrestore(&priv->lock, flags);
                return rc;
        }
 
        /* Tell bootstrap uCode where to find image to load */
-       iwl3945_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
-       iwl3945_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
-       iwl3945_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
+       iwl_write_prph(priv, BSM_DRAM_INST_PTR_REG, pinst);
+       iwl_write_prph(priv, BSM_DRAM_DATA_PTR_REG, pdata);
+       iwl_write_prph(priv, BSM_DRAM_DATA_BYTECOUNT_REG,
                                 priv->ucode_data.len);
 
        /* Inst byte count must be last to set up, bit 31 signals uCode
         *   that all new ptr/size info is in place */
-       iwl3945_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
+       iwl_write_prph(priv, BSM_DRAM_INST_BYTECOUNT_REG,
                                 priv->ucode_code.len | BSM_DRAM_INST_LOAD);
 
-       iwl3945_release_nic_access(priv);
+       iwl_release_nic_access(priv);
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       IWL_DEBUG_INFO("Runtime uCode pointers are set.\n");
+       IWL_DEBUG_INFO(priv, "Runtime uCode pointers are set.\n");
 
        return rc;
 }
@@ -5588,13 +3199,13 @@ static int iwl3945_set_ucode_ptrs(struct iwl3945_priv *priv)
  *
  * Tell "initialize" uCode to go ahead and load the runtime uCode.
  */
-static void iwl3945_init_alive_start(struct iwl3945_priv *priv)
+static void iwl3945_init_alive_start(struct iwl_priv *priv)
 {
        /* Check alive response for "valid" sign from uCode */
        if (priv->card_alive_init.is_valid != UCODE_VALID_OK) {
                /* We had an error bringing up the hardware, so take it
                 * all the way back down so we can try again */
-               IWL_DEBUG_INFO("Initialize Alive failed.\n");
+               IWL_DEBUG_INFO(priv, "Initialize Alive failed.\n");
                goto restart;
        }
 
@@ -5604,18 +3215,18 @@ static void iwl3945_init_alive_start(struct iwl3945_priv *priv)
        if (iwl3945_verify_ucode(priv)) {
                /* Runtime instruction load was bad;
                 * take it all the way back down so we can try again */
-               IWL_DEBUG_INFO("Bad \"initialize\" uCode load.\n");
+               IWL_DEBUG_INFO(priv, "Bad \"initialize\" uCode load.\n");
                goto restart;
        }
 
        /* Send pointers to protocol/runtime uCode image ... init code will
         * load and launch runtime uCode, which will send us another "Alive"
         * notification. */
-       IWL_DEBUG_INFO("Initialization Alive received.\n");
+       IWL_DEBUG_INFO(priv, "Initialization Alive received.\n");
        if (iwl3945_set_ucode_ptrs(priv)) {
                /* Runtime instruction load won't happen;
                 * take it all the way back down so we can try again */
-               IWL_DEBUG_INFO("Couldn't set up uCode pointers.\n");
+               IWL_DEBUG_INFO(priv, "Couldn't set up uCode pointers.\n");
                goto restart;
        }
        return;
@@ -5634,18 +3245,18 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw,
  *                   from protocol/runtime uCode (initialization uCode's
  *                   Alive gets handled by iwl3945_init_alive_start()).
  */
-static void iwl3945_alive_start(struct iwl3945_priv *priv)
+static void iwl3945_alive_start(struct iwl_priv *priv)
 {
        int rc = 0;
        int thermal_spin = 0;
        u32 rfkill;
 
-       IWL_DEBUG_INFO("Runtime Alive received.\n");
+       IWL_DEBUG_INFO(priv, "Runtime Alive received.\n");
 
        if (priv->card_alive.is_valid != UCODE_VALID_OK) {
                /* We had an error bringing up the hardware, so take it
                 * all the way back down so we can try again */
-               IWL_DEBUG_INFO("Alive failed.\n");
+               IWL_DEBUG_INFO(priv, "Alive failed.\n");
                goto restart;
        }
 
@@ -5655,21 +3266,21 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
        if (iwl3945_verify_ucode(priv)) {
                /* Runtime instruction load was bad;
                 * take it all the way back down so we can try again */
-               IWL_DEBUG_INFO("Bad runtime uCode load.\n");
+               IWL_DEBUG_INFO(priv, "Bad runtime uCode load.\n");
                goto restart;
        }
 
        iwl3945_clear_stations_table(priv);
 
-       rc = iwl3945_grab_nic_access(priv);
+       rc = iwl_grab_nic_access(priv);
        if (rc) {
-               IWL_WARNING("Can not read RFKILL status from adapter\n");
+               IWL_WARN(priv, "Can not read RFKILL status from adapter\n");
                return;
        }
 
-       rfkill = iwl3945_read_prph(priv, APMG_RFKILL_REG);
-       IWL_DEBUG_INFO("RFKILL status: 0x%x\n", rfkill);
-       iwl3945_release_nic_access(priv);
+       rfkill = iwl_read_prph(priv, APMG_RFKILL_REG);
+       IWL_DEBUG_INFO(priv, "RFKILL status: 0x%x\n", rfkill);
+       iwl_release_nic_access(priv);
 
        if (rfkill & 0x1) {
                clear_bit(STATUS_RF_KILL_HW, &priv->status);
@@ -5681,7 +3292,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
                }
 
                if (thermal_spin)
-                       IWL_DEBUG_INFO("Thermal calibration took %dus\n",
+                       IWL_DEBUG_INFO(priv, "Thermal calibration took %dus\n",
                                       thermal_spin * 10);
        } else
                set_bit(STATUS_RF_KILL_HW, &priv->status);
@@ -5692,7 +3303,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
        /* Clear out the uCode error bit if it is set */
        clear_bit(STATUS_FW_ERROR, &priv->status);
 
-       if (iwl3945_is_rfkill(priv))
+       if (iwl_is_rfkill(priv))
                return;
 
        ieee80211_wake_queues(priv->hw);
@@ -5700,9 +3311,9 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
        priv->active_rate = priv->rates_mask;
        priv->active_rate_basic = priv->rates_mask & IWL_BASIC_RATES_MASK;
 
-       iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(priv->power_mode));
+       iwl_power_update_mode(priv, false);
 
-       if (iwl3945_is_associated(priv)) {
+       if (iwl_is_associated(priv)) {
                struct iwl3945_rxon_cmd *active_rxon =
                                (struct iwl3945_rxon_cmd *)(&priv->active_rxon);
 
@@ -5711,12 +3322,11 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
                active_rxon->filter_flags &= ~RXON_FILTER_ASSOC_MSK;
        } else {
                /* Initialize our rx_config data */
-               iwl3945_connection_init_rx_config(priv, priv->iw_mode);
-               memcpy(priv->staging_rxon.node_addr, priv->mac_addr, ETH_ALEN);
+               iwl_connection_init_rx_config(priv, priv->iw_mode);
        }
 
        /* Configure Bluetooth device coexistence support */
-       iwl3945_send_bt_config(priv);
+       iwl_send_bt_config(priv);
 
        /* Configure the adapter for unassociated operation */
        iwl3945_commit_rxon(priv);
@@ -5725,7 +3335,7 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
 
        iwl3945_led_register(priv);
 
-       IWL_DEBUG_INFO("ALIVE processing complete.\n");
+       IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n");
        set_bit(STATUS_READY, &priv->status);
        wake_up_interruptible(&priv->wait_command_queue);
 
@@ -5746,15 +3356,15 @@ static void iwl3945_alive_start(struct iwl3945_priv *priv)
        queue_work(priv->workqueue, &priv->restart);
 }
 
-static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv);
+static void iwl3945_cancel_deferred_work(struct iwl_priv *priv);
 
-static void __iwl3945_down(struct iwl3945_priv *priv)
+static void __iwl3945_down(struct iwl_priv *priv)
 {
        unsigned long flags;
        int exit_pending = test_bit(STATUS_EXIT_PENDING, &priv->status);
        struct ieee80211_conf *conf = NULL;
 
-       IWL_DEBUG_INFO(DRV_NAME " is going down\n");
+       IWL_DEBUG_INFO(priv, DRV_NAME " is going down\n");
 
        conf = ieee80211_get_hw_conf(priv->hw);
 
@@ -5773,7 +3383,7 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
                clear_bit(STATUS_EXIT_PENDING, &priv->status);
 
        /* stop and reset the on-board processor */
-       iwl3945_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
+       iwl_write32(priv, CSR_RESET, CSR_RESET_REG_FLAG_NEVO_RESET);
 
        /* tell the device to stop sending interrupts */
        spin_lock_irqsave(&priv->lock, flags);
@@ -5786,7 +3396,7 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
 
        /* If we have not previously called iwl3945_init() then
         * clear all bits but the RF Kill and SUSPEND bits and return */
-       if (!iwl3945_is_init(priv)) {
+       if (!iwl_is_init(priv)) {
                priv->status = test_bit(STATUS_RF_KILL_HW, &priv->status) <<
                                        STATUS_RF_KILL_HW |
                               test_bit(STATUS_RF_KILL_SW, &priv->status) <<
@@ -5815,29 +3425,31 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
                        test_bit(STATUS_EXIT_PENDING, &priv->status) <<
                                STATUS_EXIT_PENDING;
 
+       priv->cfg->ops->lib->apm_ops.reset(priv);
        spin_lock_irqsave(&priv->lock, flags);
-       iwl3945_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
+       iwl_clear_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ);
        spin_unlock_irqrestore(&priv->lock, flags);
 
        iwl3945_hw_txq_ctx_stop(priv);
        iwl3945_hw_rxq_stop(priv);
 
        spin_lock_irqsave(&priv->lock, flags);
-       if (!iwl3945_grab_nic_access(priv)) {
-               iwl3945_write_prph(priv, APMG_CLK_DIS_REG,
+       if (!iwl_grab_nic_access(priv)) {
+               iwl_write_prph(priv, APMG_CLK_DIS_REG,
                                         APMG_CLK_VAL_DMA_CLK_RQT);
-               iwl3945_release_nic_access(priv);
+               iwl_release_nic_access(priv);
        }
        spin_unlock_irqrestore(&priv->lock, flags);
 
        udelay(5);
 
-       iwl3945_hw_nic_stop_master(priv);
-       iwl3945_set_bit(priv, CSR_RESET, CSR_RESET_REG_FLAG_SW_RESET);
-       iwl3945_hw_nic_reset(priv);
+       if (exit_pending || test_bit(STATUS_IN_SUSPEND, &priv->status))
+               priv->cfg->ops->lib->apm_ops.stop(priv);
+       else
+               priv->cfg->ops->lib->apm_ops.reset(priv);
 
  exit:
-       memset(&priv->card_alive, 0, sizeof(struct iwl3945_alive_resp));
+       memset(&priv->card_alive, 0, sizeof(struct iwl_alive_resp));
 
        if (priv->ibss_beacon)
                dev_kfree_skb(priv->ibss_beacon);
@@ -5847,7 +3459,7 @@ static void __iwl3945_down(struct iwl3945_priv *priv)
        iwl3945_clear_free_frames(priv);
 }
 
-static void iwl3945_down(struct iwl3945_priv *priv)
+static void iwl3945_down(struct iwl_priv *priv)
 {
        mutex_lock(&priv->mutex);
        __iwl3945_down(priv);
@@ -5858,58 +3470,58 @@ static void iwl3945_down(struct iwl3945_priv *priv)
 
 #define MAX_HW_RESTARTS 5
 
-static int __iwl3945_up(struct iwl3945_priv *priv)
+static int __iwl3945_up(struct iwl_priv *priv)
 {
        int rc, i;
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-               IWL_WARNING("Exit pending; will not bring the NIC up\n");
+               IWL_WARN(priv, "Exit pending; will not bring the NIC up\n");
                return -EIO;
        }
 
        if (test_bit(STATUS_RF_KILL_SW, &priv->status)) {
-               IWL_WARNING("Radio disabled by SW RF kill (module "
+               IWL_WARN(priv, "Radio disabled by SW RF kill (module "
                            "parameter)\n");
                return -ENODEV;
        }
 
        if (!priv->ucode_data_backup.v_addr || !priv->ucode_data.v_addr) {
-               IWL_ERROR("ucode not available for device bring up\n");
+               IWL_ERR(priv, "ucode not available for device bring up\n");
                return -EIO;
        }
 
        /* If platform's RF_KILL switch is NOT set to KILL */
-       if (iwl3945_read32(priv, CSR_GP_CNTRL) &
+       if (iwl_read32(priv, CSR_GP_CNTRL) &
                                CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
                clear_bit(STATUS_RF_KILL_HW, &priv->status);
        else {
                set_bit(STATUS_RF_KILL_HW, &priv->status);
                if (!test_bit(STATUS_IN_SUSPEND, &priv->status)) {
-                       IWL_WARNING("Radio disabled by HW RF Kill switch\n");
+                       IWL_WARN(priv, "Radio disabled by HW RF Kill switch\n");
                        return -ENODEV;
                }
        }
 
-       iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
+       iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
 
        rc = iwl3945_hw_nic_init(priv);
        if (rc) {
-               IWL_ERROR("Unable to int nic\n");
+               IWL_ERR(priv, "Unable to int nic\n");
                return rc;
        }
 
        /* make sure rfkill handshake bits are cleared */
-       iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
-       iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR,
+       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
+       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR,
                    CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED);
 
        /* clear (again), then enable host interrupts */
-       iwl3945_write32(priv, CSR_INT, 0xFFFFFFFF);
+       iwl_write32(priv, CSR_INT, 0xFFFFFFFF);
        iwl3945_enable_interrupts(priv);
 
        /* really make sure rfkill handshake bits are cleared */
-       iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
-       iwl3945_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
+       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
+       iwl_write32(priv, CSR_UCODE_DRV_GP1_CLR, CSR_UCODE_SW_BIT_RFKILL);
 
        /* Copy original ucode data image from disk into backup cache.
         * This will be used to initialize the on-board processor's
@@ -5928,17 +3540,18 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
                /* load bootstrap state machine,
                 * load bootstrap program into processor's memory,
                 * prepare to load the "initialize" uCode */
-               rc = iwl3945_load_bsm(priv);
+               priv->cfg->ops->lib->load_ucode(priv);
 
                if (rc) {
-                       IWL_ERROR("Unable to set up bootstrap uCode: %d\n", rc);
+                       IWL_ERR(priv,
+                               "Unable to set up bootstrap uCode: %d\n", rc);
                        continue;
                }
 
                /* start card; "initialize" will load runtime ucode */
                iwl3945_nic_start(priv);
 
-               IWL_DEBUG_INFO(DRV_NAME " is coming up\n");
+               IWL_DEBUG_INFO(priv, DRV_NAME " is coming up\n");
 
                return 0;
        }
@@ -5949,7 +3562,7 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
 
        /* tried to restart and config the device for as long as our
         * patience could withstand */
-       IWL_ERROR("Unable to initialize device after %d attempts.\n", i);
+       IWL_ERR(priv, "Unable to initialize device after %d attempts.\n", i);
        return -EIO;
 }
 
@@ -5962,8 +3575,8 @@ static int __iwl3945_up(struct iwl3945_priv *priv)
 
 static void iwl3945_bg_init_alive_start(struct work_struct *data)
 {
-       struct iwl3945_priv *priv =
-           container_of(data, struct iwl3945_priv, init_alive_start.work);
+       struct iwl_priv *priv =
+           container_of(data, struct iwl_priv, init_alive_start.work);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
@@ -5975,8 +3588,8 @@ static void iwl3945_bg_init_alive_start(struct work_struct *data)
 
 static void iwl3945_bg_alive_start(struct work_struct *data)
 {
-       struct iwl3945_priv *priv =
-           container_of(data, struct iwl3945_priv, alive_start.work);
+       struct iwl_priv *priv =
+           container_of(data, struct iwl_priv, alive_start.work);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
@@ -5986,66 +3599,31 @@ static void iwl3945_bg_alive_start(struct work_struct *data)
        mutex_unlock(&priv->mutex);
 }
 
-static void iwl3945_bg_rf_kill(struct work_struct *work)
+static void iwl3945_rfkill_poll(struct work_struct *data)
 {
-       struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, rf_kill);
-
-       wake_up_interruptible(&priv->wait_command_queue);
-
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
-               return;
+       struct iwl_priv *priv =
+           container_of(data, struct iwl_priv, rfkill_poll.work);
+       unsigned long status = priv->status;
 
-       mutex_lock(&priv->mutex);
+       if (iwl_read32(priv, CSR_GP_CNTRL) & CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW)
+               clear_bit(STATUS_RF_KILL_HW, &priv->status);
+       else
+               set_bit(STATUS_RF_KILL_HW, &priv->status);
 
-       if (!iwl3945_is_rfkill(priv)) {
-               IWL_DEBUG(IWL_DL_INFO | IWL_DL_RF_KILL,
-                         "HW and/or SW RF Kill no longer active, restarting "
-                         "device\n");
-               if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
-                       queue_work(priv->workqueue, &priv->restart);
-       } else {
+       if (test_bit(STATUS_RF_KILL_HW, &status) != test_bit(STATUS_RF_KILL_HW, &priv->status))
+               queue_work(priv->workqueue, &priv->rf_kill);
 
-               if (!test_bit(STATUS_RF_KILL_HW, &priv->status))
-                       IWL_DEBUG_RF_KILL("Can not turn radio back on - "
-                                         "disabled by SW switch\n");
-               else
-                       IWL_WARNING("Radio Frequency Kill Switch is On:\n"
-                                   "Kill switch must be turned off for "
-                                   "wireless networking to work.\n");
-       }
+       queue_delayed_work(priv->workqueue, &priv->rfkill_poll,
+                          round_jiffies_relative(2 * HZ));
 
-       mutex_unlock(&priv->mutex);
-       iwl3945_rfkill_set_hw_state(priv);
 }
 
 #define IWL_SCAN_CHECK_WATCHDOG (7 * HZ)
-
-static void iwl3945_bg_scan_check(struct work_struct *data)
-{
-       struct iwl3945_priv *priv =
-           container_of(data, struct iwl3945_priv, scan_check.work);
-
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
-               return;
-
-       mutex_lock(&priv->mutex);
-       if (test_bit(STATUS_SCANNING, &priv->status) ||
-           test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN,
-                         "Scan completion watchdog resetting adapter (%dms)\n",
-                         jiffies_to_msecs(IWL_SCAN_CHECK_WATCHDOG));
-
-               if (!test_bit(STATUS_EXIT_PENDING, &priv->status))
-                       iwl3945_send_scan_abort(priv);
-       }
-       mutex_unlock(&priv->mutex);
-}
-
 static void iwl3945_bg_request_scan(struct work_struct *data)
 {
-       struct iwl3945_priv *priv =
-           container_of(data, struct iwl3945_priv, request_scan);
-       struct iwl3945_host_cmd cmd = {
+       struct iwl_priv *priv =
+           container_of(data, struct iwl_priv, request_scan);
+       struct iwl_host_cmd cmd = {
                .id = REPLY_SCAN_CMD,
                .len = sizeof(struct iwl3945_scan_cmd),
                .meta.flags = CMD_SIZE_HUGE,
@@ -6061,8 +3639,8 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 
        mutex_lock(&priv->mutex);
 
-       if (!iwl3945_is_ready(priv)) {
-               IWL_WARNING("request scan called when driver not ready.\n");
+       if (!iwl_is_ready(priv)) {
+               IWL_WARN(priv, "request scan called when driver not ready.\n");
                goto done;
        }
 
@@ -6074,34 +3652,36 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
        /* This should never be called or scheduled if there is currently
         * a scan active in the hardware. */
        if (test_bit(STATUS_SCAN_HW, &priv->status)) {
-               IWL_DEBUG_INFO("Multiple concurrent scan requests in parallel. "
-                              "Ignoring second request.\n");
+               IWL_DEBUG_INFO(priv, "Multiple concurrent scan requests  "
+                               "Ignoring second request.\n");
                rc = -EIO;
                goto done;
        }
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
-               IWL_DEBUG_SCAN("Aborting scan due to device shutdown\n");
+               IWL_DEBUG_SCAN(priv, "Aborting scan due to device shutdown\n");
                goto done;
        }
 
        if (test_bit(STATUS_SCAN_ABORTING, &priv->status)) {
-               IWL_DEBUG_HC("Scan request while abort pending.  Queuing.\n");
+               IWL_DEBUG_HC(priv,
+                       "Scan request while abort pending. Queuing.\n");
                goto done;
        }
 
-       if (iwl3945_is_rfkill(priv)) {
-               IWL_DEBUG_HC("Aborting scan due to RF Kill activation\n");
+       if (iwl_is_rfkill(priv)) {
+               IWL_DEBUG_HC(priv, "Aborting scan due to RF Kill activation\n");
                goto done;
        }
 
        if (!test_bit(STATUS_READY, &priv->status)) {
-               IWL_DEBUG_HC("Scan request while uninitialized.  Queuing.\n");
+               IWL_DEBUG_HC(priv,
+                       "Scan request while uninitialized. Queuing.\n");
                goto done;
        }
 
        if (!priv->scan_bands) {
-               IWL_DEBUG_HC("Aborting scan due to no requested bands\n");
+               IWL_DEBUG_HC(priv, "Aborting scan due to no requested bands\n");
                goto done;
        }
 
@@ -6119,14 +3699,14 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
        scan->quiet_plcp_th = IWL_PLCP_QUIET_THRESH;
        scan->quiet_time = IWL_ACTIVE_QUIET_TIME;
 
-       if (iwl3945_is_associated(priv)) {
+       if (iwl_is_associated(priv)) {
                u16 interval = 0;
                u32 extra;
                u32 suspend_time = 100;
                u32 scan_suspend_time = 100;
                unsigned long flags;
 
-               IWL_DEBUG_INFO("Scanning while associated...\n");
+               IWL_DEBUG_INFO(priv, "Scanning while associated...\n");
 
                spin_lock_irqsave(&priv->lock, flags);
                interval = priv->beacon_int;
@@ -6148,15 +3728,14 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
                    (extra | ((suspend_time % interval) * 1024));
 
                scan->suspend_time = cpu_to_le32(scan_suspend_time);
-               IWL_DEBUG_SCAN("suspend_time 0x%X beacon interval %d\n",
+               IWL_DEBUG_SCAN(priv, "suspend_time 0x%X beacon interval %d\n",
                               scan_suspend_time, interval);
        }
 
        /* We should add the ability for user to lock to PASSIVE ONLY */
        if (priv->one_direct_scan) {
-               IWL_DEBUG_SCAN
-                   ("Kicking off one direct scan for '%s'\n",
-                    print_ssid(ssid, priv->direct_ssid,
+               IWL_DEBUG_SCAN(priv, "Kicking off one direct scan for '%s'\n",
+                               print_ssid(ssid, priv->direct_ssid,
                                priv->direct_ssid_len));
                scan->direct_scan[0].id = WLAN_EID_SSID;
                scan->direct_scan[0].len = priv->direct_ssid_len;
@@ -6164,15 +3743,12 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
                       priv->direct_ssid, priv->direct_ssid_len);
                n_probes++;
        } else
-               IWL_DEBUG_SCAN("Kicking off one indirect scan.\n");
+               IWL_DEBUG_SCAN(priv, "Kicking off one indirect scan.\n");
 
        /* We don't build a direct scan probe request; the uCode will do
         * that based on the direct_mask added to each channel entry */
-       scan->tx_cmd.len = cpu_to_le16(
-               iwl3945_fill_probe_req(priv, (struct ieee80211_mgmt *)scan->data,
-                       IWL_MAX_SCAN_SIZE - sizeof(*scan)));
        scan->tx_cmd.tx_flags = TX_CMD_FLG_SEQ_CTL_MSK;
-       scan->tx_cmd.sta_id = priv->hw_setting.bcast_sta_id;
+       scan->tx_cmd.sta_id = priv->hw_params.bcast_sta_id;
        scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
 
        /* flags + rate selection */
@@ -6187,10 +3763,15 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
                scan->good_CRC_th = IWL_GOOD_CRC_TH;
                band = IEEE80211_BAND_5GHZ;
        } else {
-               IWL_WARNING("Invalid scan band count\n");
+               IWL_WARN(priv, "Invalid scan band count\n");
                goto done;
        }
 
+       scan->tx_cmd.len = cpu_to_le16(
+               iwl_fill_probe_req(priv, band,
+                                  (struct ieee80211_mgmt *)scan->data,
+                                  IWL_MAX_SCAN_SIZE - sizeof(*scan)));
+
        /* select Rx antennas */
        scan->flags |= iwl3945_get_antenna_flags(priv);
 
@@ -6203,7 +3784,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
                        (void *)&scan->data[le16_to_cpu(scan->tx_cmd.len)]);
 
        if (scan->channel_count == 0) {
-               IWL_DEBUG_SCAN("channel count %d\n", scan->channel_count);
+               IWL_DEBUG_SCAN(priv, "channel count %d\n", scan->channel_count);
                goto done;
        }
 
@@ -6213,7 +3794,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
        scan->len = cpu_to_le16(cmd.len);
 
        set_bit(STATUS_SCAN_HW, &priv->status);
-       rc = iwl3945_send_cmd_sync(priv, &cmd);
+       rc = iwl_send_cmd_sync(priv, &cmd);
        if (rc)
                goto done;
 
@@ -6239,7 +3820,7 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
 
 static void iwl3945_bg_up(struct work_struct *data)
 {
-       struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, up);
+       struct iwl_priv *priv = container_of(data, struct iwl_priv, up);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
@@ -6247,12 +3828,12 @@ static void iwl3945_bg_up(struct work_struct *data)
        mutex_lock(&priv->mutex);
        __iwl3945_up(priv);
        mutex_unlock(&priv->mutex);
-       iwl3945_rfkill_set_hw_state(priv);
+       iwl_rfkill_set_hw_state(priv);
 }
 
 static void iwl3945_bg_restart(struct work_struct *data)
 {
-       struct iwl3945_priv *priv = container_of(data, struct iwl3945_priv, restart);
+       struct iwl_priv *priv = container_of(data, struct iwl_priv, restart);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
@@ -6263,8 +3844,8 @@ static void iwl3945_bg_restart(struct work_struct *data)
 
 static void iwl3945_bg_rx_replenish(struct work_struct *data)
 {
-       struct iwl3945_priv *priv =
-           container_of(data, struct iwl3945_priv, rx_replenish);
+       struct iwl_priv *priv =
+           container_of(data, struct iwl_priv, rx_replenish);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
                return;
@@ -6276,18 +3857,18 @@ static void iwl3945_bg_rx_replenish(struct work_struct *data)
 
 #define IWL_DELAY_NEXT_SCAN (HZ*2)
 
-static void iwl3945_post_associate(struct iwl3945_priv *priv)
+static void iwl3945_post_associate(struct iwl_priv *priv)
 {
        int rc = 0;
        struct ieee80211_conf *conf = NULL;
 
        if (priv->iw_mode == NL80211_IFTYPE_AP) {
-               IWL_ERROR("%s Should not be called in AP mode\n", __func__);
+               IWL_ERR(priv, "%s Should not be called in AP mode\n", __func__);
                return;
        }
 
 
-       IWL_DEBUG_ASSOC("Associated as %d to: %pM\n",
+       IWL_DEBUG_ASSOC(priv, "Associated as %d to: %pM\n",
                        priv->assoc_id, priv->active_rxon.bssid_addr);
 
        if (test_bit(STATUS_EXIT_PENDING, &priv->status))
@@ -6296,26 +3877,26 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv)
        if (!priv->vif || !priv->is_open)
                return;
 
-       iwl3945_scan_cancel_timeout(priv, 200);
+       iwl_scan_cancel_timeout(priv, 200);
 
        conf = ieee80211_get_hw_conf(priv->hw);
 
        priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
        iwl3945_commit_rxon(priv);
 
-       memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd));
+       memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
        iwl3945_setup_rxon_timing(priv);
-       rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING,
+       rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
                              sizeof(priv->rxon_timing), &priv->rxon_timing);
        if (rc)
-               IWL_WARNING("REPLY_RXON_TIMING failed - "
+               IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
                            "Attempting to continue.\n");
 
        priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
 
        priv->staging_rxon.assoc_id = cpu_to_le16(priv->assoc_id);
 
-       IWL_DEBUG_ASSOC("assoc id %d beacon interval %d\n",
+       IWL_DEBUG_ASSOC(priv, "assoc id %d beacon interval %d\n",
                        priv->assoc_id, priv->beacon_int);
 
        if (priv->assoc_capability & WLAN_CAPABILITY_SHORT_PREAMBLE)
@@ -6355,7 +3936,7 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv)
                break;
 
        default:
-                IWL_ERROR("%s Should not be called in %d mode\n",
+                IWL_ERR(priv, "%s Should not be called in %d mode\n",
                           __func__, priv->iw_mode);
                break;
        }
@@ -6366,45 +3947,8 @@ static void iwl3945_post_associate(struct iwl3945_priv *priv)
        priv->next_scan_jiffies = jiffies + IWL_DELAY_NEXT_SCAN;
 }
 
-static void iwl3945_bg_abort_scan(struct work_struct *work)
-{
-       struct iwl3945_priv *priv = container_of(work, struct iwl3945_priv, abort_scan);
-
-       if (!iwl3945_is_ready(priv))
-               return;
-
-       mutex_lock(&priv->mutex);
-
-       set_bit(STATUS_SCAN_ABORTING, &priv->status);
-       iwl3945_send_scan_abort(priv);
-
-       mutex_unlock(&priv->mutex);
-}
-
 static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed);
 
-static void iwl3945_bg_scan_completed(struct work_struct *work)
-{
-       struct iwl3945_priv *priv =
-           container_of(work, struct iwl3945_priv, scan_completed);
-
-       IWL_DEBUG(IWL_DL_INFO | IWL_DL_SCAN, "SCAN complete scan\n");
-
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
-               return;
-
-       if (test_bit(STATUS_CONF_PENDING, &priv->status))
-               iwl3945_mac_config(priv->hw, 0);
-
-       ieee80211_scan_completed(priv->hw);
-
-       /* Since setting the TXPOWER may have been deferred while
-        * performing the scan, fire one off */
-       mutex_lock(&priv->mutex);
-       iwl3945_hw_reg_send_txpower(priv);
-       mutex_unlock(&priv->mutex);
-}
-
 /*****************************************************************************
  *
  * mac80211 entry point functions
@@ -6415,36 +3959,22 @@ static void iwl3945_bg_scan_completed(struct work_struct *work)
 
 static int iwl3945_mac_start(struct ieee80211_hw *hw)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
        int ret;
 
-       IWL_DEBUG_MAC80211("enter\n");
-
-       if (pci_enable_device(priv->pci_dev)) {
-               IWL_ERROR("Fail to pci_enable_device\n");
-               return -ENODEV;
-       }
-       pci_restore_state(priv->pci_dev);
-       pci_enable_msi(priv->pci_dev);
-
-       ret = request_irq(priv->pci_dev->irq, iwl3945_isr, IRQF_SHARED,
-                         DRV_NAME, priv);
-       if (ret) {
-               IWL_ERROR("Error allocating IRQ %d\n", priv->pci_dev->irq);
-               goto out_disable_msi;
-       }
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        /* we should be verifying the device is ready to be opened */
        mutex_lock(&priv->mutex);
 
-       memset(&priv->staging_rxon, 0, sizeof(struct iwl3945_rxon_cmd));
+       memset(&priv->staging_rxon, 0, sizeof(priv->staging_rxon));
        /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
         * ucode filename and max sizes are card-specific. */
 
        if (!priv->ucode_code.len) {
                ret = iwl3945_read_ucode(priv);
                if (ret) {
-                       IWL_ERROR("Could not read microcode: %d\n", ret);
+                       IWL_ERR(priv, "Could not read microcode: %d\n", ret);
                        mutex_unlock(&priv->mutex);
                        goto out_release_irq;
                }
@@ -6454,12 +3984,12 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
 
        mutex_unlock(&priv->mutex);
 
-       iwl3945_rfkill_set_hw_state(priv);
+       iwl_rfkill_set_hw_state(priv);
 
        if (ret)
                goto out_release_irq;
 
-       IWL_DEBUG_INFO("Start UP work.\n");
+       IWL_DEBUG_INFO(priv, "Start UP work.\n");
 
        if (test_bit(STATUS_IN_SUSPEND, &priv->status))
                return 0;
@@ -6471,86 +4001,87 @@ static int iwl3945_mac_start(struct ieee80211_hw *hw)
                        UCODE_READY_TIMEOUT);
        if (!ret) {
                if (!test_bit(STATUS_READY, &priv->status)) {
-                       IWL_ERROR("Wait for START_ALIVE timeout after %dms.\n",
-                                 jiffies_to_msecs(UCODE_READY_TIMEOUT));
+                       IWL_ERR(priv,
+                               "Wait for START_ALIVE timeout after %dms.\n",
+                               jiffies_to_msecs(UCODE_READY_TIMEOUT));
                        ret = -ETIMEDOUT;
                        goto out_release_irq;
                }
        }
 
+       /* ucode is running and will send rfkill notifications,
+        * no need to poll the killswitch state anymore */
+       cancel_delayed_work(&priv->rfkill_poll);
+
        priv->is_open = 1;
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        return 0;
 
 out_release_irq:
-       free_irq(priv->pci_dev->irq, priv);
-out_disable_msi:
-       pci_disable_msi(priv->pci_dev);
-       pci_disable_device(priv->pci_dev);
        priv->is_open = 0;
-       IWL_DEBUG_MAC80211("leave - failed\n");
+       IWL_DEBUG_MAC80211(priv, "leave - failed\n");
        return ret;
 }
 
 static void iwl3945_mac_stop(struct ieee80211_hw *hw)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        if (!priv->is_open) {
-               IWL_DEBUG_MAC80211("leave - skip\n");
+               IWL_DEBUG_MAC80211(priv, "leave - skip\n");
                return;
        }
 
        priv->is_open = 0;
 
-       if (iwl3945_is_ready_rf(priv)) {
+       if (iwl_is_ready_rf(priv)) {
                /* stop mac, cancel any scan request and clear
                 * RXON_FILTER_ASSOC_MSK BIT
                 */
                mutex_lock(&priv->mutex);
-               iwl3945_scan_cancel_timeout(priv, 100);
+               iwl_scan_cancel_timeout(priv, 100);
                mutex_unlock(&priv->mutex);
        }
 
        iwl3945_down(priv);
 
        flush_workqueue(priv->workqueue);
-       free_irq(priv->pci_dev->irq, priv);
-       pci_disable_msi(priv->pci_dev);
-       pci_save_state(priv->pci_dev);
-       pci_disable_device(priv->pci_dev);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       /* start polling the killswitch state again */
+       queue_delayed_work(priv->workqueue, &priv->rfkill_poll,
+                          round_jiffies_relative(2 * HZ));
+
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
 static int iwl3945_mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       IWL_DEBUG_TX("dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
+       IWL_DEBUG_TX(priv, "dev->xmit(%d bytes) at rate 0x%02x\n", skb->len,
                     ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
 
        if (iwl3945_tx_skb(priv, skb))
                dev_kfree_skb_any(skb);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        return NETDEV_TX_OK;
 }
 
 static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
                                 struct ieee80211_if_init_conf *conf)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
        unsigned long flags;
 
-       IWL_DEBUG_MAC80211("enter: type %d\n", conf->type);
+       IWL_DEBUG_MAC80211(priv, "enter: type %d\n", conf->type);
 
        if (priv->vif) {
-               IWL_DEBUG_MAC80211("leave - vif != NULL\n");
+               IWL_DEBUG_MAC80211(priv, "leave - vif != NULL\n");
                return -EOPNOTSUPP;
        }
 
@@ -6563,16 +4094,16 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
        mutex_lock(&priv->mutex);
 
        if (conf->mac_addr) {
-               IWL_DEBUG_MAC80211("Set: %pM\n", conf->mac_addr);
+               IWL_DEBUG_MAC80211(priv, "Set: %pM\n", conf->mac_addr);
                memcpy(priv->mac_addr, conf->mac_addr, ETH_ALEN);
        }
 
-       if (iwl3945_is_ready(priv))
+       if (iwl_is_ready(priv))
                iwl3945_set_mode(priv, conf->type);
 
        mutex_unlock(&priv->mutex);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        return 0;
 }
 
@@ -6585,24 +4116,25 @@ static int iwl3945_mac_add_interface(struct ieee80211_hw *hw,
  */
 static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
 {
-       struct iwl3945_priv *priv = hw->priv;
-       const struct iwl3945_channel_info *ch_info;
+       struct iwl_priv *priv = hw->priv;
+       const struct iwl_channel_info *ch_info;
        struct ieee80211_conf *conf = &hw->conf;
        unsigned long flags;
        int ret = 0;
 
        mutex_lock(&priv->mutex);
-       IWL_DEBUG_MAC80211("enter to channel %d\n", conf->channel->hw_value);
+       IWL_DEBUG_MAC80211(priv, "enter to channel %d\n",
+                               conf->channel->hw_value);
 
-       if (!iwl3945_is_ready(priv)) {
-               IWL_DEBUG_MAC80211("leave - not ready\n");
+       if (!iwl_is_ready(priv)) {
+               IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
                ret = -EIO;
                goto out;
        }
 
-       if (unlikely(!iwl3945_param_disable_hw_scan &&
+       if (unlikely(!iwl3945_mod_params.disable_hw_scan &&
                     test_bit(STATUS_SCANNING, &priv->status))) {
-               IWL_DEBUG_MAC80211("leave - scanning\n");
+               IWL_DEBUG_MAC80211(priv, "leave - scanning\n");
                set_bit(STATUS_CONF_PENDING, &priv->status);
                mutex_unlock(&priv->mutex);
                return 0;
@@ -6610,25 +4142,26 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
 
        spin_lock_irqsave(&priv->lock, flags);
 
-       ch_info = iwl3945_get_channel_info(priv, conf->channel->band,
-                                          conf->channel->hw_value);
+       ch_info = iwl_get_channel_info(priv, conf->channel->band,
+                                      conf->channel->hw_value);
        if (!is_channel_valid(ch_info)) {
-               IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this band.\n",
-                              conf->channel->hw_value, conf->channel->band);
-               IWL_DEBUG_MAC80211("leave - invalid channel\n");
+               IWL_DEBUG_SCAN(priv,
+                               "Channel %d [%d] is INVALID for this band.\n",
+                               conf->channel->hw_value, conf->channel->band);
+               IWL_DEBUG_MAC80211(priv, "leave - invalid channel\n");
                spin_unlock_irqrestore(&priv->lock, flags);
                ret = -EINVAL;
                goto out;
        }
 
-       iwl3945_set_rxon_channel(priv, conf->channel->band, conf->channel->hw_value);
+       iwl_set_rxon_channel(priv, conf->channel);
 
-       iwl3945_set_flags_for_phymode(priv, conf->channel->band);
+       iwl_set_flags_for_band(priv, conf->channel->band);
 
        /* The list of supported rates and rate mask can be different
         * for each phymode; since the phymode may have changed, reset
         * the rate mask to what mac80211 lists */
-       iwl3945_set_rate(priv);
+       iwl_set_rate(priv);
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
@@ -6642,25 +4175,25 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, u32 changed)
        iwl3945_radio_kill_sw(priv, !conf->radio_enabled);
 
        if (!conf->radio_enabled) {
-               IWL_DEBUG_MAC80211("leave - radio disabled\n");
+               IWL_DEBUG_MAC80211(priv, "leave - radio disabled\n");
                goto out;
        }
 
-       if (iwl3945_is_rfkill(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF kill\n");
+       if (iwl_is_rfkill(priv)) {
+               IWL_DEBUG_MAC80211(priv, "leave - RF kill\n");
                ret = -EIO;
                goto out;
        }
 
-       iwl3945_set_rate(priv);
+       iwl_set_rate(priv);
 
        if (memcmp(&priv->active_rxon,
                   &priv->staging_rxon, sizeof(priv->staging_rxon)))
                iwl3945_commit_rxon(priv);
        else
-               IWL_DEBUG_INFO("No re-sending same RXON configuration.\n");
+               IWL_DEBUG_INFO(priv, "Not re-sending same RXON configuration\n");
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
 out:
        clear_bit(STATUS_CONF_PENDING, &priv->status);
@@ -6668,7 +4201,7 @@ out:
        return ret;
 }
 
-static void iwl3945_config_ap(struct iwl3945_priv *priv)
+static void iwl3945_config_ap(struct iwl_priv *priv)
 {
        int rc = 0;
 
@@ -6676,19 +4209,20 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv)
                return;
 
        /* The following should be done only at AP bring up */
-       if (!(iwl3945_is_associated(priv))) {
+       if (!(iwl_is_associated(priv))) {
 
                /* RXON - unassoc (to set timing command) */
                priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
                iwl3945_commit_rxon(priv);
 
                /* RXON Timing */
-               memset(&priv->rxon_timing, 0, sizeof(struct iwl3945_rxon_time_cmd));
+               memset(&priv->rxon_timing, 0, sizeof(struct iwl_rxon_time_cmd));
                iwl3945_setup_rxon_timing(priv);
-               rc = iwl3945_send_cmd_pdu(priv, REPLY_RXON_TIMING,
-                               sizeof(priv->rxon_timing), &priv->rxon_timing);
+               rc = iwl_send_cmd_pdu(priv, REPLY_RXON_TIMING,
+                                     sizeof(priv->rxon_timing),
+                                     &priv->rxon_timing);
                if (rc)
-                       IWL_WARNING("REPLY_RXON_TIMING failed - "
+                       IWL_WARN(priv, "REPLY_RXON_TIMING failed - "
                                        "Attempting to continue.\n");
 
                /* FIXME: what should be the assoc_id for AP? */
@@ -6716,7 +4250,7 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv)
                /* restore RXON assoc */
                priv->staging_rxon.filter_flags |= RXON_FILTER_ASSOC_MSK;
                iwl3945_commit_rxon(priv);
-               iwl3945_add_station(priv, iwl3945_broadcast_addr, 0, 0);
+               iwl3945_add_station(priv, iwl_bcast_addr, 0, 0);
        }
        iwl3945_send_beacon_cmd(priv);
 
@@ -6727,16 +4261,16 @@ static void iwl3945_config_ap(struct iwl3945_priv *priv)
 
 static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
                                        struct ieee80211_vif *vif,
-                                   struct ieee80211_if_conf *conf)
+                                       struct ieee80211_if_conf *conf)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
        int rc;
 
        if (conf == NULL)
                return -EIO;
 
        if (priv->vif != vif) {
-               IWL_DEBUG_MAC80211("leave - priv->vif != vif\n");
+               IWL_DEBUG_MAC80211(priv, "leave - priv->vif != vif\n");
                return 0;
        }
 
@@ -6753,13 +4287,13 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
                        return rc;
        }
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        mutex_lock(&priv->mutex);
 
        if (conf->bssid)
-               IWL_DEBUG_MAC80211("bssid: %pM\n", conf->bssid);
+               IWL_DEBUG_MAC80211(priv, "bssid: %pM\n", conf->bssid);
 
 /*
  * very dubious code was here; the probe filtering flag is never set:
@@ -6772,7 +4306,7 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
                if (!conf->bssid) {
                        conf->bssid = priv->mac_addr;
                        memcpy(priv->bssid, priv->mac_addr, ETH_ALEN);
-                       IWL_DEBUG_MAC80211("bssid was set to: %pM\n",
+                       IWL_DEBUG_MAC80211(priv, "bssid was set to: %pM\n",
                                           conf->bssid);
                }
                if (priv->ibss_beacon)
@@ -6781,17 +4315,17 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
                priv->ibss_beacon = ieee80211_beacon_get(hw, vif);
        }
 
-       if (iwl3945_is_rfkill(priv))
+       if (iwl_is_rfkill(priv))
                goto done;
 
        if (conf->bssid && !is_zero_ether_addr(conf->bssid) &&
            !is_multicast_ether_addr(conf->bssid)) {
                /* If there is currently a HW scan going on in the background
                 * then we need to cancel it else the RXON below will fail. */
-               if (iwl3945_scan_cancel_timeout(priv, 100)) {
-                       IWL_WARNING("Aborted scan still in progress "
+               if (iwl_scan_cancel_timeout(priv, 100)) {
+                       IWL_WARN(priv, "Aborted scan still in progress "
                                    "after 100ms\n");
-                       IWL_DEBUG_MAC80211("leaving - scan abort failed.\n");
+                       IWL_DEBUG_MAC80211(priv, "leaving:scan abort failed\n");
                        mutex_unlock(&priv->mutex);
                        return -EAGAIN;
                }
@@ -6813,75 +4347,29 @@ static int iwl3945_mac_config_interface(struct ieee80211_hw *hw,
                }
 
        } else {
-               iwl3945_scan_cancel_timeout(priv, 100);
+               iwl_scan_cancel_timeout(priv, 100);
                priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
                iwl3945_commit_rxon(priv);
        }
 
  done:
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        mutex_unlock(&priv->mutex);
 
        return 0;
 }
 
-static void iwl3945_configure_filter(struct ieee80211_hw *hw,
-                                unsigned int changed_flags,
-                                unsigned int *total_flags,
-                                int mc_count, struct dev_addr_list *mc_list)
-{
-       struct iwl3945_priv *priv = hw->priv;
-       __le32 *filter_flags = &priv->staging_rxon.filter_flags;
-
-       IWL_DEBUG_MAC80211("Enter: changed: 0x%x, total: 0x%x\n",
-                       changed_flags, *total_flags);
-
-       if (changed_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS)) {
-               if (*total_flags & (FIF_OTHER_BSS | FIF_PROMISC_IN_BSS))
-                       *filter_flags |= RXON_FILTER_PROMISC_MSK;
-               else
-                       *filter_flags &= ~RXON_FILTER_PROMISC_MSK;
-       }
-       if (changed_flags & FIF_ALLMULTI) {
-               if (*total_flags & FIF_ALLMULTI)
-                       *filter_flags |= RXON_FILTER_ACCEPT_GRP_MSK;
-               else
-                       *filter_flags &= ~RXON_FILTER_ACCEPT_GRP_MSK;
-       }
-       if (changed_flags & FIF_CONTROL) {
-               if (*total_flags & FIF_CONTROL)
-                       *filter_flags |= RXON_FILTER_CTL2HOST_MSK;
-               else
-                       *filter_flags &= ~RXON_FILTER_CTL2HOST_MSK;
-       }
-       if (changed_flags & FIF_BCN_PRBRESP_PROMISC) {
-               if (*total_flags & FIF_BCN_PRBRESP_PROMISC)
-                       *filter_flags |= RXON_FILTER_BCON_AWARE_MSK;
-               else
-                       *filter_flags &= ~RXON_FILTER_BCON_AWARE_MSK;
-       }
-
-       /* We avoid iwl_commit_rxon here to commit the new filter flags
-        * since mac80211 will call ieee80211_hw_config immediately.
-        * (mc_list is not supported at this time). Otherwise, we need to
-        * queue a background iwl_commit_rxon work.
-        */
-
-       *total_flags &= FIF_OTHER_BSS | FIF_ALLMULTI | FIF_PROMISC_IN_BSS |
-                       FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
-}
-
 static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
                                     struct ieee80211_if_init_conf *conf)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
        mutex_lock(&priv->mutex);
 
-       if (iwl3945_is_ready_rf(priv)) {
-               iwl3945_scan_cancel_timeout(priv, 100);
+       if (iwl_is_ready_rf(priv)) {
+               iwl_scan_cancel_timeout(priv, 100);
                priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
                iwl3945_commit_rxon(priv);
        }
@@ -6891,7 +4379,7 @@ static void iwl3945_mac_remove_interface(struct ieee80211_hw *hw,
        }
        mutex_unlock(&priv->mutex);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 }
 
 #define IWL_DELAY_NEXT_SCAN_AFTER_ASSOC (HZ*6)
@@ -6901,21 +4389,23 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
                                     struct ieee80211_bss_conf *bss_conf,
                                     u32 changes)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
 
-       IWL_DEBUG_MAC80211("changes = 0x%X\n", changes);
+       IWL_DEBUG_MAC80211(priv, "changes = 0x%X\n", changes);
 
        if (changes & BSS_CHANGED_ERP_PREAMBLE) {
-               IWL_DEBUG_MAC80211("ERP_PREAMBLE %d\n",
+               IWL_DEBUG_MAC80211(priv, "ERP_PREAMBLE %d\n",
                                   bss_conf->use_short_preamble);
                if (bss_conf->use_short_preamble)
                        priv->staging_rxon.flags |= RXON_FLG_SHORT_PREAMBLE_MSK;
                else
-                       priv->staging_rxon.flags &= ~RXON_FLG_SHORT_PREAMBLE_MSK;
+                       priv->staging_rxon.flags &=
+                               ~RXON_FLG_SHORT_PREAMBLE_MSK;
        }
 
        if (changes & BSS_CHANGED_ERP_CTS_PROT) {
-               IWL_DEBUG_MAC80211("ERP_CTS %d\n", bss_conf->use_cts_prot);
+               IWL_DEBUG_MAC80211(priv, "ERP_CTS %d\n",
+                                  bss_conf->use_cts_prot);
                if (bss_conf->use_cts_prot && (priv->band != IEEE80211_BAND_5GHZ))
                        priv->staging_rxon.flags |= RXON_FLG_TGG_PROTECT_MSK;
                else
@@ -6923,7 +4413,7 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
        }
 
        if (changes & BSS_CHANGED_ASSOC) {
-               IWL_DEBUG_MAC80211("ASSOC %d\n", bss_conf->assoc);
+               IWL_DEBUG_MAC80211(priv, "ASSOC %d\n", bss_conf->assoc);
                /* This should never happen as this function should
                 * never be called from interrupt context. */
                if (WARN_ON_ONCE(in_interrupt()))
@@ -6931,10 +4421,9 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
                if (bss_conf->assoc) {
                        priv->assoc_id = bss_conf->aid;
                        priv->beacon_int = bss_conf->beacon_int;
-                       priv->timestamp0 = bss_conf->timestamp & 0xFFFFFFFF;
-                       priv->timestamp1 = (bss_conf->timestamp >> 32) &
-                                            0xFFFFFFFF;
+                       priv->timestamp = bss_conf->timestamp;
                        priv->assoc_capability = bss_conf->assoc_capability;
+                       priv->power_data.dtim_period = bss_conf->dtim_period;
                        priv->next_scan_jiffies = jiffies +
                                        IWL_DELAY_NEXT_SCAN_AFTER_ASSOC;
                        mutex_lock(&priv->mutex);
@@ -6942,30 +4431,40 @@ static void iwl3945_bss_info_changed(struct ieee80211_hw *hw,
                        mutex_unlock(&priv->mutex);
                } else {
                        priv->assoc_id = 0;
-                       IWL_DEBUG_MAC80211("DISASSOC %d\n", bss_conf->assoc);
+                       IWL_DEBUG_MAC80211(priv,
+                                       "DISASSOC %d\n", bss_conf->assoc);
                }
-       } else if (changes && iwl3945_is_associated(priv) && priv->assoc_id) {
-                       IWL_DEBUG_MAC80211("Associated Changes %d\n", changes);
+       } else if (changes && iwl_is_associated(priv) && priv->assoc_id) {
+                       IWL_DEBUG_MAC80211(priv,
+                                       "Associated Changes %d\n", changes);
                        iwl3945_send_rxon_assoc(priv);
        }
 
 }
 
-static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
+static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw,
+                              struct cfg80211_scan_request *req)
 {
        int rc = 0;
        unsigned long flags;
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
+       size_t len = 0;
+       u8 *ssid = NULL;
        DECLARE_SSID_BUF(ssid_buf);
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
+
+       if (req->n_ssids) {
+               ssid = req->ssids[0].ssid;
+               len = req->ssids[0].ssid_len;
+       }
 
        mutex_lock(&priv->mutex);
        spin_lock_irqsave(&priv->lock, flags);
 
-       if (!iwl3945_is_ready_rf(priv)) {
+       if (!iwl_is_ready_rf(priv)) {
                rc = -EIO;
-               IWL_DEBUG_MAC80211("leave - not ready or exit pending\n");
+               IWL_DEBUG_MAC80211(priv, "leave - not ready or exit pending\n");
                goto out_unlock;
        }
 
@@ -6983,19 +4482,18 @@ static int iwl3945_mac_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
                goto out_unlock;
        }
        if (len) {
-               IWL_DEBUG_SCAN("direct scan for %s [%d]\n ",
-                              print_ssid(ssid_buf, ssid, len), (int)len);
+               IWL_DEBUG_SCAN(priv, "direct scan for %s [%zd]\n ",
+                              print_ssid(ssid_buf, ssid, len), len);
 
                priv->one_direct_scan = 1;
-               priv->direct_ssid_len = (u8)
-                   min((u8) len, (u8) IW_ESSID_MAX_SIZE);
-               memcpy(priv->direct_ssid, ssid, priv->direct_ssid_len);
+               priv->direct_ssid_len = len;
+               memcpy(priv->direct_ssid, ssid, len);
        } else
                priv->one_direct_scan = 0;
 
        rc = iwl3945_scan_initiate(priv);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
 out_unlock:
        spin_unlock_irqrestore(&priv->lock, flags);
@@ -7005,80 +4503,80 @@ out_unlock:
 }
 
 static int iwl3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                          const u8 *local_addr, const u8 *addr,
-                          struct ieee80211_key_conf *key)
+                              struct ieee80211_vif *vif,
+                              struct ieee80211_sta *sta,
+                              struct ieee80211_key_conf *key)
 {
-       struct iwl3945_priv *priv = hw->priv;
-       int rc = 0;
+       struct iwl_priv *priv = hw->priv;
+       const u8 *addr;
+       int ret;
        u8 sta_id;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       if (!iwl3945_param_hwcrypto) {
-               IWL_DEBUG_MAC80211("leave - hwcrypto disabled\n");
+       if (iwl3945_mod_params.sw_crypto) {
+               IWL_DEBUG_MAC80211(priv, "leave - hwcrypto disabled\n");
                return -EOPNOTSUPP;
        }
 
-       if (is_zero_ether_addr(addr))
-               /* only support pairwise keys */
-               return -EOPNOTSUPP;
-
+       addr = sta ? sta->addr : iwl_bcast_addr;
        sta_id = iwl3945_hw_find_station(priv, addr);
        if (sta_id == IWL_INVALID_STATION) {
-               IWL_DEBUG_MAC80211("leave - %pM not in station map.\n",
+               IWL_DEBUG_MAC80211(priv, "leave - %pM not in station map.\n",
                                   addr);
                return -EINVAL;
        }
 
        mutex_lock(&priv->mutex);
 
-       iwl3945_scan_cancel_timeout(priv, 100);
+       iwl_scan_cancel_timeout(priv, 100);
 
        switch (cmd) {
        case  SET_KEY:
-               rc = iwl3945_update_sta_key_info(priv, key, sta_id);
-               if (!rc) {
-                       iwl3945_set_rxon_hwcrypto(priv, 1);
+               ret = iwl3945_update_sta_key_info(priv, key, sta_id);
+               if (!ret) {
+                       iwl_set_rxon_hwcrypto(priv, 1);
                        iwl3945_commit_rxon(priv);
                        key->hw_key_idx = sta_id;
-                       IWL_DEBUG_MAC80211("set_key success, using hwcrypto\n");
+                       IWL_DEBUG_MAC80211(priv,
+                               "set_key success, using hwcrypto\n");
                        key->flags |= IEEE80211_KEY_FLAG_GENERATE_IV;
                }
                break;
        case DISABLE_KEY:
-               rc = iwl3945_clear_sta_key_info(priv, sta_id);
-               if (!rc) {
-                       iwl3945_set_rxon_hwcrypto(priv, 0);
+               ret = iwl3945_clear_sta_key_info(priv, sta_id);
+               if (!ret) {
+                       iwl_set_rxon_hwcrypto(priv, 0);
                        iwl3945_commit_rxon(priv);
-                       IWL_DEBUG_MAC80211("disable hwcrypto key\n");
+                       IWL_DEBUG_MAC80211(priv, "disable hwcrypto key\n");
                }
                break;
        default:
-               rc = -EINVAL;
+               ret = -EINVAL;
        }
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        mutex_unlock(&priv->mutex);
 
-       return rc;
+       return ret;
 }
 
 static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
                           const struct ieee80211_tx_queue_params *params)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
        unsigned long flags;
        int q;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       if (!iwl3945_is_ready_rf(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF not ready\n");
+       if (!iwl_is_ready_rf(priv)) {
+               IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
                return -EIO;
        }
 
        if (queue >= AC_NUM) {
-               IWL_DEBUG_MAC80211("leave - queue >= AC_NUM %d\n", queue);
+               IWL_DEBUG_MAC80211(priv, "leave - queue >= AC_NUM %d\n", queue);
                return 0;
        }
 
@@ -7100,28 +4598,28 @@ static int iwl3945_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
        mutex_lock(&priv->mutex);
        if (priv->iw_mode == NL80211_IFTYPE_AP)
                iwl3945_activate_qos(priv, 1);
-       else if (priv->assoc_id && iwl3945_is_associated(priv))
+       else if (priv->assoc_id && iwl_is_associated(priv))
                iwl3945_activate_qos(priv, 0);
 
        mutex_unlock(&priv->mutex);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        return 0;
 }
 
 static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
                                struct ieee80211_tx_queue_stats *stats)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
        int i, avail;
-       struct iwl3945_tx_queue *txq;
-       struct iwl3945_queue *q;
+       struct iwl_tx_queue *txq;
+       struct iwl_queue *q;
        unsigned long flags;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       if (!iwl3945_is_ready_rf(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF not ready\n");
+       if (!iwl_is_ready_rf(priv)) {
+               IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
                return -EIO;
        }
 
@@ -7130,7 +4628,7 @@ static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
        for (i = 0; i < AC_NUM; i++) {
                txq = &priv->txq[i];
                q = &txq->q;
-               avail = iwl3945_queue_space(q);
+               avail = iwl_queue_space(q);
 
                stats[i].len = q->n_window - avail;
                stats[i].limit = q->n_window - q->high_mark;
@@ -7139,34 +4637,24 @@ static int iwl3945_mac_get_tx_stats(struct ieee80211_hw *hw,
        }
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       IWL_DEBUG_MAC80211("leave\n");
-
-       return 0;
-}
-
-static int iwl3945_mac_get_stats(struct ieee80211_hw *hw,
-                            struct ieee80211_low_level_stats *stats)
-{
-       IWL_DEBUG_MAC80211("enter\n");
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
        return 0;
 }
 
 static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
        unsigned long flags;
 
        mutex_lock(&priv->mutex);
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       iwl3945_reset_qos(priv);
+       iwl_reset_qos(priv);
 
        spin_lock_irqsave(&priv->lock, flags);
        priv->assoc_id = 0;
        priv->assoc_capability = 0;
-       priv->call_post_assoc_from_beacon = 0;
 
        /* new association get rid of ibss beacon skb */
        if (priv->ibss_beacon)
@@ -7175,15 +4663,14 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
        priv->ibss_beacon = NULL;
 
        priv->beacon_int = priv->hw->conf.beacon_int;
-       priv->timestamp1 = 0;
-       priv->timestamp0 = 0;
+       priv->timestamp = 0;
        if ((priv->iw_mode == NL80211_IFTYPE_STATION))
                priv->beacon_int = 0;
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       if (!iwl3945_is_ready_rf(priv)) {
-               IWL_DEBUG_MAC80211("leave - not ready\n");
+       if (!iwl_is_ready_rf(priv)) {
+               IWL_DEBUG_MAC80211(priv, "leave - not ready\n");
                mutex_unlock(&priv->mutex);
                return;
        }
@@ -7192,7 +4679,7 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
         * clear RXON_FILTER_ASSOC_MSK bit
        */
        if (priv->iw_mode != NL80211_IFTYPE_AP) {
-               iwl3945_scan_cancel_timeout(priv, 100);
+               iwl_scan_cancel_timeout(priv, 100);
                priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK;
                iwl3945_commit_rxon(priv);
        }
@@ -7200,33 +4687,33 @@ static void iwl3945_mac_reset_tsf(struct ieee80211_hw *hw)
        /* Per mac80211.h: This is only used in IBSS mode... */
        if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {
 
-               IWL_DEBUG_MAC80211("leave - not in IBSS\n");
+               IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n");
                mutex_unlock(&priv->mutex);
                return;
        }
 
-       iwl3945_set_rate(priv);
+       iwl_set_rate(priv);
 
        mutex_unlock(&priv->mutex);
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
 
 }
 
 static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
-       struct iwl3945_priv *priv = hw->priv;
+       struct iwl_priv *priv = hw->priv;
        unsigned long flags;
 
-       IWL_DEBUG_MAC80211("enter\n");
+       IWL_DEBUG_MAC80211(priv, "enter\n");
 
-       if (!iwl3945_is_ready_rf(priv)) {
-               IWL_DEBUG_MAC80211("leave - RF not ready\n");
+       if (!iwl_is_ready_rf(priv)) {
+               IWL_DEBUG_MAC80211(priv, "leave - RF not ready\n");
                return -EIO;
        }
 
        if (priv->iw_mode != NL80211_IFTYPE_ADHOC) {
-               IWL_DEBUG_MAC80211("leave - not IBSS\n");
+               IWL_DEBUG_MAC80211(priv, "leave - not IBSS\n");
                return -EIO;
        }
 
@@ -7239,10 +4726,10 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
 
        priv->assoc_id = 0;
 
-       IWL_DEBUG_MAC80211("leave\n");
+       IWL_DEBUG_MAC80211(priv, "leave\n");
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       iwl3945_reset_qos(priv);
+       iwl_reset_qos(priv);
 
        iwl3945_post_associate(priv);
 
@@ -7256,7 +4743,7 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
  *
  *****************************************************************************/
 
-#ifdef CONFIG_IWL3945_DEBUG
+#ifdef CONFIG_IWLWIFI_DEBUG
 
 /*
  * The following adds a new attribute to the sysfs representation
@@ -7265,38 +4752,41 @@ static int iwl3945_mac_beacon_update(struct ieee80211_hw *hw, struct sk_buff *sk
  *
  * See the level definitions in iwl for details.
  */
-
-static ssize_t show_debug_level(struct device_driver *d, char *buf)
+static ssize_t show_debug_level(struct device *d,
+                               struct device_attribute *attr, char *buf)
 {
-       return sprintf(buf, "0x%08X\n", iwl3945_debug_level);
+       struct iwl_priv *priv = d->driver_data;
+
+       return sprintf(buf, "0x%08X\n", priv->debug_level);
 }
-static ssize_t store_debug_level(struct device_driver *d,
+static ssize_t store_debug_level(struct device *d,
+                               struct device_attribute *attr,
                                 const char *buf, size_t count)
 {
-       char *p = (char *)buf;
-       u32 val;
+       struct iwl_priv *priv = d->driver_data;
+       unsigned long val;
+       int ret;
 
-       val = simple_strtoul(p, &p, 0);
-       if (p == buf)
-               printk(KERN_INFO DRV_NAME
-                      ": %s is not in hex or decimal form.\n", buf);
+       ret = strict_strtoul(buf, 0, &val);
+       if (ret)
+               IWL_INFO(priv, "%s is not in hex or decimal form.\n", buf);
        else
-               iwl3945_debug_level = val;
+               priv->debug_level = val;
 
        return strnlen(buf, count);
 }
 
-static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
-                  show_debug_level, store_debug_level);
+static DEVICE_ATTR(debug_level, S_IWUSR | S_IRUGO,
+                       show_debug_level, store_debug_level);
 
-#endif /* CONFIG_IWL3945_DEBUG */
+#endif /* CONFIG_IWLWIFI_DEBUG */
 
 static ssize_t show_temperature(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
+       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        return sprintf(buf, "%d\n", iwl3945_hw_get_temperature(priv));
@@ -7307,22 +4797,21 @@ static DEVICE_ATTR(temperature, S_IRUGO, show_temperature, NULL);
 static ssize_t show_tx_power(struct device *d,
                             struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
-       return sprintf(buf, "%d\n", priv->user_txpower_limit);
+       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       return sprintf(buf, "%d\n", priv->tx_power_user_lmt);
 }
 
 static ssize_t store_tx_power(struct device *d,
                              struct device_attribute *attr,
                              const char *buf, size_t count)
 {
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
+       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
        char *p = (char *)buf;
        u32 val;
 
        val = simple_strtoul(p, &p, 10);
        if (p == buf)
-               printk(KERN_INFO DRV_NAME
-                      ": %s is not in decimal form.\n", buf);
+               IWL_INFO(priv, ": %s is not in decimal form.\n", buf);
        else
                iwl3945_hw_reg_set_txpower(priv, val);
 
@@ -7334,7 +4823,7 @@ static DEVICE_ATTR(tx_power, S_IWUSR | S_IRUGO, show_tx_power, store_tx_power);
 static ssize_t show_flags(struct device *d,
                          struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
+       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
 
        return sprintf(buf, "0x%04X\n", priv->active_rxon.flags);
 }
@@ -7343,16 +4832,16 @@ static ssize_t store_flags(struct device *d,
                           struct device_attribute *attr,
                           const char *buf, size_t count)
 {
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
+       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
        u32 flags = simple_strtoul(buf, NULL, 0);
 
        mutex_lock(&priv->mutex);
        if (le32_to_cpu(priv->staging_rxon.flags) != flags) {
                /* Cancel any currently running scans... */
-               if (iwl3945_scan_cancel_timeout(priv, 100))
-                       IWL_WARNING("Could not cancel scan.\n");
+               if (iwl_scan_cancel_timeout(priv, 100))
+                       IWL_WARN(priv, "Could not cancel scan.\n");
                else {
-                       IWL_DEBUG_INFO("Committing rxon.flags = 0x%04X\n",
+                       IWL_DEBUG_INFO(priv, "Committing rxon.flags = 0x%04X\n",
                                       flags);
                        priv->staging_rxon.flags = cpu_to_le32(flags);
                        iwl3945_commit_rxon(priv);
@@ -7368,7 +4857,7 @@ static DEVICE_ATTR(flags, S_IWUSR | S_IRUGO, show_flags, store_flags);
 static ssize_t show_filter_flags(struct device *d,
                                 struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
+       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
 
        return sprintf(buf, "0x%04X\n",
                le32_to_cpu(priv->active_rxon.filter_flags));
@@ -7378,16 +4867,16 @@ static ssize_t store_filter_flags(struct device *d,
                                  struct device_attribute *attr,
                                  const char *buf, size_t count)
 {
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
+       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
        u32 filter_flags = simple_strtoul(buf, NULL, 0);
 
        mutex_lock(&priv->mutex);
        if (le32_to_cpu(priv->staging_rxon.filter_flags) != filter_flags) {
                /* Cancel any currently running scans... */
-               if (iwl3945_scan_cancel_timeout(priv, 100))
-                       IWL_WARNING("Could not cancel scan.\n");
+               if (iwl_scan_cancel_timeout(priv, 100))
+                       IWL_WARN(priv, "Could not cancel scan.\n");
                else {
-                       IWL_DEBUG_INFO("Committing rxon.filter_flags = "
+                       IWL_DEBUG_INFO(priv, "Committing rxon.filter_flags = "
                                       "0x%04X\n", filter_flags);
                        priv->staging_rxon.filter_flags =
                                cpu_to_le32(filter_flags);
@@ -7407,8 +4896,8 @@ static DEVICE_ATTR(filter_flags, S_IWUSR | S_IRUGO, show_filter_flags,
 static ssize_t show_measurement(struct device *d,
                                struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
-       struct iwl3945_spectrum_notification measure_report;
+       struct iwl_priv *priv = dev_get_drvdata(d);
+       struct iwl_spectrum_notification measure_report;
        u32 size = sizeof(measure_report), len = 0, ofs = 0;
        u8 *data = (u8 *)&measure_report;
        unsigned long flags;
@@ -7440,7 +4929,7 @@ static ssize_t store_measurement(struct device *d,
                                 struct device_attribute *attr,
                                 const char *buf, size_t count)
 {
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
+       struct iwl_priv *priv = dev_get_drvdata(d);
        struct ieee80211_measurement_params params = {
                .channel = le16_to_cpu(priv->active_rxon.channel),
                .start_time = cpu_to_le64(priv->last_tsf),
@@ -7464,7 +4953,7 @@ static ssize_t store_measurement(struct device *d,
                        type = simple_strtoul(p + 1, NULL, 0);
        }
 
-       IWL_DEBUG_INFO("Invoking measurement of type %d on "
+       IWL_DEBUG_INFO(priv, "Invoking measurement of type %d on "
                       "channel %d (for '%s')\n", type, params.channel, buf);
        iwl3945_get_measurement(priv, &params, type);
 
@@ -7479,7 +4968,7 @@ static ssize_t store_retry_rate(struct device *d,
                                struct device_attribute *attr,
                                const char *buf, size_t count)
 {
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
        priv->retry_rate = simple_strtoul(buf, NULL, 0);
        if (priv->retry_rate <= 0)
@@ -7491,50 +4980,77 @@ static ssize_t store_retry_rate(struct device *d,
 static ssize_t show_retry_rate(struct device *d,
                               struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
+       struct iwl_priv *priv = dev_get_drvdata(d);
        return sprintf(buf, "%d", priv->retry_rate);
 }
 
 static DEVICE_ATTR(retry_rate, S_IWUSR | S_IRUSR, show_retry_rate,
                   store_retry_rate);
 
+
 static ssize_t store_power_level(struct device *d,
                                 struct device_attribute *attr,
                                 const char *buf, size_t count)
 {
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
-       int rc;
-       int mode;
+       struct iwl_priv *priv = dev_get_drvdata(d);
+       int ret;
+       unsigned long mode;
+
 
-       mode = simple_strtoul(buf, NULL, 0);
        mutex_lock(&priv->mutex);
 
-       if (!iwl3945_is_ready(priv)) {
-               rc = -EAGAIN;
+       if (!iwl_is_ready(priv)) {
+               ret = -EAGAIN;
                goto out;
        }
 
-       if ((mode < 1) || (mode > IWL_POWER_LIMIT) || (mode == IWL_POWER_AC))
-               mode = IWL_POWER_AC;
-       else
-               mode |= IWL_POWER_ENABLED;
-
-       if (mode != priv->power_mode) {
-               rc = iwl3945_send_power_mode(priv, IWL_POWER_LEVEL(mode));
-               if (rc) {
-                       IWL_DEBUG_MAC80211("failed setting power mode.\n");
-                       goto out;
-               }
-               priv->power_mode = mode;
-       }
+       ret = strict_strtoul(buf, 10, &mode);
+       if (ret)
+               goto out;
 
-       rc = count;
+       ret = iwl_power_set_user_mode(priv, mode);
+       if (ret) {
+               IWL_DEBUG_MAC80211(priv, "failed setting power mode.\n");
+               goto out;
+       }
+       ret = count;
 
  out:
        mutex_unlock(&priv->mutex);
-       return rc;
+       return ret;
+}
+
+static ssize_t show_power_level(struct device *d,
+                               struct device_attribute *attr, char *buf)
+{
+       struct iwl_priv *priv = dev_get_drvdata(d);
+       int mode = priv->power_data.user_power_setting;
+       int system = priv->power_data.system_power_setting;
+       int level = priv->power_data.power_mode;
+       char *p = buf;
+
+       switch (system) {
+       case IWL_POWER_SYS_AUTO:
+               p += sprintf(p, "SYSTEM:auto");
+               break;
+       case IWL_POWER_SYS_AC:
+               p += sprintf(p, "SYSTEM:ac");
+               break;
+       case IWL_POWER_SYS_BATTERY:
+               p += sprintf(p, "SYSTEM:battery");
+               break;
+       }
+
+       p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO) ?
+                       "fixed" : "auto");
+       p += sprintf(p, "\tINDEX:%d", level);
+       p += sprintf(p, "\n");
+       return p - buf + 1;
 }
 
+static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR,
+                  show_power_level, store_power_level);
+
 #define MAX_WX_STRING 80
 
 /* Values are in microsecond */
@@ -7553,41 +5069,6 @@ static const s32 period_duration[] = {
        1000000
 };
 
-static ssize_t show_power_level(struct device *d,
-                               struct device_attribute *attr, char *buf)
-{
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
-       int level = IWL_POWER_LEVEL(priv->power_mode);
-       char *p = buf;
-
-       p += sprintf(p, "%d ", level);
-       switch (level) {
-       case IWL_POWER_MODE_CAM:
-       case IWL_POWER_AC:
-               p += sprintf(p, "(AC)");
-               break;
-       case IWL_POWER_BATTERY:
-               p += sprintf(p, "(BATTERY)");
-               break;
-       default:
-               p += sprintf(p,
-                            "(Timeout %dms, Period %dms)",
-                            timeout_duration[level - 1] / 1000,
-                            period_duration[level - 1] / 1000);
-       }
-
-       if (!(priv->power_mode & IWL_POWER_ENABLED))
-               p += sprintf(p, " OFF\n");
-       else
-               p += sprintf(p, " \n");
-
-       return p - buf + 1;
-
-}
-
-static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level,
-                  store_power_level);
-
 static ssize_t show_channels(struct device *d,
                             struct device_attribute *attr, char *buf)
 {
@@ -7600,17 +5081,17 @@ static DEVICE_ATTR(channels, S_IRUSR, show_channels, NULL);
 static ssize_t show_statistics(struct device *d,
                               struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
+       struct iwl_priv *priv = dev_get_drvdata(d);
        u32 size = sizeof(struct iwl3945_notif_statistics);
        u32 len = 0, ofs = 0;
-       u8 *data = (u8 *)&priv->statistics;
+       u8 *data = (u8 *)&priv->statistics_39;
        int rc = 0;
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
        mutex_lock(&priv->mutex);
-       rc = iwl3945_send_statistics_request(priv);
+       rc = iwl_send_statistics_request(priv, 0);
        mutex_unlock(&priv->mutex);
 
        if (rc) {
@@ -7638,34 +5119,34 @@ static DEVICE_ATTR(statistics, S_IRUGO, show_statistics, NULL);
 static ssize_t show_antenna(struct device *d,
                            struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
+       struct iwl_priv *priv = dev_get_drvdata(d);
 
-       if (!iwl3945_is_alive(priv))
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
 
-       return sprintf(buf, "%d\n", priv->antenna);
+       return sprintf(buf, "%d\n", iwl3945_mod_params.antenna);
 }
 
 static ssize_t store_antenna(struct device *d,
                             struct device_attribute *attr,
                             const char *buf, size_t count)
 {
+       struct iwl_priv *priv __maybe_unused = dev_get_drvdata(d);
        int ant;
-       struct iwl3945_priv *priv = dev_get_drvdata(d);
 
        if (count == 0)
                return 0;
 
        if (sscanf(buf, "%1i", &ant) != 1) {
-               IWL_DEBUG_INFO("not in hex or decimal form.\n");
+               IWL_DEBUG_INFO(priv, "not in hex or decimal form.\n");
                return count;
        }
 
        if ((ant >= 0) && (ant <= 2)) {
-               IWL_DEBUG_INFO("Setting antenna select to %d.\n", ant);
-               priv->antenna = (enum iwl3945_antenna)ant;
+               IWL_DEBUG_INFO(priv, "Setting antenna select to %d.\n", ant);
+               iwl3945_mod_params.antenna = (enum iwl3945_antenna)ant;
        } else
-               IWL_DEBUG_INFO("Bad antenna select value %d.\n", ant);
+               IWL_DEBUG_INFO(priv, "Bad antenna select value %d.\n", ant);
 
 
        return count;
@@ -7676,8 +5157,8 @@ static DEVICE_ATTR(antenna, S_IWUSR | S_IRUGO, show_antenna, store_antenna);
 static ssize_t show_status(struct device *d,
                           struct device_attribute *attr, char *buf)
 {
-       struct iwl3945_priv *priv = (struct iwl3945_priv *)d->driver_data;
-       if (!iwl3945_is_alive(priv))
+       struct iwl_priv *priv = (struct iwl_priv *)d->driver_data;
+       if (!iwl_is_alive(priv))
                return -EAGAIN;
        return sprintf(buf, "0x%08x\n", (int)priv->status);
 }
@@ -7691,7 +5172,7 @@ static ssize_t dump_error_log(struct device *d,
        char *p = (char *)buf;
 
        if (p[0] == '1')
-               iwl3945_dump_nic_error_log((struct iwl3945_priv *)d->driver_data);
+               iwl3945_dump_nic_error_log((struct iwl_priv *)d->driver_data);
 
        return strnlen(buf, count);
 }
@@ -7705,7 +5186,7 @@ static ssize_t dump_event_log(struct device *d,
        char *p = (char *)buf;
 
        if (p[0] == '1')
-               iwl3945_dump_nic_event_log((struct iwl3945_priv *)d->driver_data);
+               iwl3945_dump_nic_event_log((struct iwl_priv *)d->driver_data);
 
        return strnlen(buf, count);
 }
@@ -7718,7 +5199,7 @@ static DEVICE_ATTR(dump_events, S_IWUSR, NULL, dump_event_log);
  *
  *****************************************************************************/
 
-static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv)
+static void iwl3945_setup_deferred_work(struct iwl_priv *priv)
 {
        priv->workqueue = create_workqueue(DRV_NAME);
 
@@ -7727,14 +5208,15 @@ static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv)
        INIT_WORK(&priv->up, iwl3945_bg_up);
        INIT_WORK(&priv->restart, iwl3945_bg_restart);
        INIT_WORK(&priv->rx_replenish, iwl3945_bg_rx_replenish);
-       INIT_WORK(&priv->scan_completed, iwl3945_bg_scan_completed);
-       INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan);
-       INIT_WORK(&priv->abort_scan, iwl3945_bg_abort_scan);
-       INIT_WORK(&priv->rf_kill, iwl3945_bg_rf_kill);
+       INIT_WORK(&priv->rf_kill, iwl_bg_rf_kill);
        INIT_WORK(&priv->beacon_update, iwl3945_bg_beacon_update);
        INIT_DELAYED_WORK(&priv->init_alive_start, iwl3945_bg_init_alive_start);
        INIT_DELAYED_WORK(&priv->alive_start, iwl3945_bg_alive_start);
-       INIT_DELAYED_WORK(&priv->scan_check, iwl3945_bg_scan_check);
+       INIT_DELAYED_WORK(&priv->rfkill_poll, iwl3945_rfkill_poll);
+       INIT_WORK(&priv->scan_completed, iwl_bg_scan_completed);
+       INIT_WORK(&priv->request_scan, iwl3945_bg_request_scan);
+       INIT_WORK(&priv->abort_scan, iwl_bg_abort_scan);
+       INIT_DELAYED_WORK(&priv->scan_check, iwl_bg_scan_check);
 
        iwl3945_hw_setup_deferred_work(priv);
 
@@ -7742,7 +5224,7 @@ static void iwl3945_setup_deferred_work(struct iwl3945_priv *priv)
                     iwl3945_irq_tasklet, (unsigned long)priv);
 }
 
-static void iwl3945_cancel_deferred_work(struct iwl3945_priv *priv)
+static void iwl3945_cancel_deferred_work(struct iwl_priv *priv)
 {
        iwl3945_hw_cancel_deferred_work(priv);
 
@@ -7768,7 +5250,9 @@ static struct attribute *iwl3945_sysfs_entries[] = {
        &dev_attr_status.attr,
        &dev_attr_temperature.attr,
        &dev_attr_tx_power.attr,
-
+#ifdef CONFIG_IWLWIFI_DEBUG
+       &dev_attr_debug_level.attr,
+#endif
        NULL
 };
 
@@ -7785,9 +5269,8 @@ static struct ieee80211_ops iwl3945_hw_ops = {
        .remove_interface = iwl3945_mac_remove_interface,
        .config = iwl3945_mac_config,
        .config_interface = iwl3945_mac_config_interface,
-       .configure_filter = iwl3945_configure_filter,
+       .configure_filter = iwl_configure_filter,
        .set_key = iwl3945_mac_set_key,
-       .get_stats = iwl3945_mac_get_stats,
        .get_tx_stats = iwl3945_mac_get_tx_stats,
        .conf_tx = iwl3945_mac_conf_tx,
        .reset_tsf = iwl3945_mac_reset_tsf,
@@ -7795,59 +5278,136 @@ static struct ieee80211_ops iwl3945_hw_ops = {
        .hw_scan = iwl3945_mac_hw_scan
 };
 
+static int iwl3945_init_drv(struct iwl_priv *priv)
+{
+       int ret;
+       struct iwl3945_eeprom *eeprom = (struct iwl3945_eeprom *)priv->eeprom;
+
+       priv->retry_rate = 1;
+       priv->ibss_beacon = NULL;
+
+       spin_lock_init(&priv->lock);
+       spin_lock_init(&priv->power_data.lock);
+       spin_lock_init(&priv->sta_lock);
+       spin_lock_init(&priv->hcmd_lock);
+
+       INIT_LIST_HEAD(&priv->free_frames);
+
+       mutex_init(&priv->mutex);
+
+       /* Clear the driver's (not device's) station table */
+       iwl3945_clear_stations_table(priv);
+
+       priv->data_retry_limit = -1;
+       priv->ieee_channels = NULL;
+       priv->ieee_rates = NULL;
+       priv->band = IEEE80211_BAND_2GHZ;
+
+       priv->iw_mode = NL80211_IFTYPE_STATION;
+
+       iwl_reset_qos(priv);
+
+       priv->qos_data.qos_active = 0;
+       priv->qos_data.qos_cap.val = 0;
+
+       priv->rates_mask = IWL_RATES_MASK;
+       /* If power management is turned on, default to CAM mode */
+       priv->power_mode = IWL_POWER_MODE_CAM;
+       priv->tx_power_user_lmt = IWL_DEFAULT_TX_POWER;
+
+       if (eeprom->version < EEPROM_3945_EEPROM_VERSION) {
+               IWL_WARN(priv, "Unsupported EEPROM version: 0x%04X\n",
+                        eeprom->version);
+               ret = -EINVAL;
+               goto err;
+       }
+       ret = iwl_init_channel_map(priv);
+       if (ret) {
+               IWL_ERR(priv, "initializing regulatory failed: %d\n", ret);
+               goto err;
+       }
+
+       /* Set up txpower settings in driver for all channels */
+       if (iwl3945_txpower_set_from_eeprom(priv)) {
+               ret = -EIO;
+               goto err_free_channel_map;
+       }
+
+       ret = iwlcore_init_geos(priv);
+       if (ret) {
+               IWL_ERR(priv, "initializing geos failed: %d\n", ret);
+               goto err_free_channel_map;
+       }
+       iwl3945_init_hw_rates(priv, priv->ieee_rates);
+
+       if (priv->bands[IEEE80211_BAND_2GHZ].n_channels)
+               priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] =
+                       &priv->bands[IEEE80211_BAND_2GHZ];
+       if (priv->bands[IEEE80211_BAND_5GHZ].n_channels)
+               priv->hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
+                       &priv->bands[IEEE80211_BAND_5GHZ];
+
+       return 0;
+
+err_free_channel_map:
+       iwl_free_channel_map(priv);
+err:
+       return ret;
+}
+
 static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 {
        int err = 0;
-       struct iwl3945_priv *priv;
+       struct iwl_priv *priv;
        struct ieee80211_hw *hw;
-       struct iwl_3945_cfg *cfg = (struct iwl_3945_cfg *)(ent->driver_data);
+       struct iwl_cfg *cfg = (struct iwl_cfg *)(ent->driver_data);
+       struct iwl3945_eeprom *eeprom;
        unsigned long flags;
 
        /***********************
         * 1. Allocating HW data
         * ********************/
 
-       /* Disabling hardware scan means that mac80211 will perform scans
-        * "the hard way", rather than using device's scan. */
-       if (iwl3945_param_disable_hw_scan) {
-               IWL_DEBUG_INFO("Disabling hw_scan\n");
-               iwl3945_hw_ops.hw_scan = NULL;
+       /* mac80211 allocates memory for this device instance, including
+        *   space for this driver's private structure */
+       hw = iwl_alloc_all(cfg, &iwl3945_hw_ops);
+       if (hw == NULL) {
+               printk(KERN_ERR DRV_NAME "Can not allocate network device\n");
+               err = -ENOMEM;
+               goto out;
        }
+       priv = hw->priv;
+       SET_IEEE80211_DEV(hw, &pdev->dev);
 
-       if ((iwl3945_param_queues_num > IWL39_MAX_NUM_QUEUES) ||
-           (iwl3945_param_queues_num < IWL_MIN_NUM_QUEUES)) {
-               IWL_ERROR("invalid queues_num, should be between %d and %d\n",
-                         IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES);
+       if ((iwl3945_mod_params.num_of_queues > IWL39_MAX_NUM_QUEUES) ||
+            (iwl3945_mod_params.num_of_queues < IWL_MIN_NUM_QUEUES)) {
+               IWL_ERR(priv,
+                       "invalid queues_num, should be between %d and %d\n",
+                       IWL_MIN_NUM_QUEUES, IWL39_MAX_NUM_QUEUES);
                err = -EINVAL;
                goto out;
        }
 
-       /* mac80211 allocates memory for this device instance, including
-        *   space for this driver's private structure */
-       hw = ieee80211_alloc_hw(sizeof(struct iwl3945_priv), &iwl3945_hw_ops);
-       if (hw == NULL) {
-               IWL_ERROR("Can not allocate network device\n");
-               err = -ENOMEM;
-               goto out;
+       /*
+        * Disabling hardware scan means that mac80211 will perform scans
+        * "the hard way", rather than using device's scan.
+        */
+       if (iwl3945_mod_params.disable_hw_scan) {
+               IWL_DEBUG_INFO(priv, "Disabling hw_scan\n");
+               iwl3945_hw_ops.hw_scan = NULL;
        }
 
-       SET_IEEE80211_DEV(hw, &pdev->dev);
 
-       priv = hw->priv;
-       priv->hw = hw;
-       priv->pci_dev = pdev;
+       IWL_DEBUG_INFO(priv, "*** LOAD DRIVER ***\n");
        priv->cfg = cfg;
+       priv->pci_dev = pdev;
 
-       IWL_DEBUG_INFO("*** LOAD DRIVER ***\n");
-       hw->rate_control_algorithm = "iwl-3945-rs";
-       hw->sta_data_size = sizeof(struct iwl3945_sta_priv);
-
-       /* Select antenna (may be helpful if only one antenna is connected) */
-       priv->antenna = (enum iwl3945_antenna)iwl3945_param_antenna;
-#ifdef CONFIG_IWL3945_DEBUG
-       iwl3945_debug_level = iwl3945_param_debug;
+#ifdef CONFIG_IWLWIFI_DEBUG
+       priv->debug_level = iwl3945_mod_params.debug;
        atomic_set(&priv->restrict_refcnt, 0);
 #endif
+       hw->rate_control_algorithm = "iwl-3945-rs";
+       hw->sta_data_size = sizeof(struct iwl3945_sta_priv);
 
        /* Tell mac80211 our characteristics */
        hw->flags = IEEE80211_HW_SIGNAL_DBM |
@@ -7857,7 +5417,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
                BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_ADHOC);
 
-       hw->wiphy->fw_handles_regulatory = true;
+       hw->wiphy->custom_regulatory = true;
+
+       hw->wiphy->max_scan_ssids = 1;
 
        /* 4 EDCA QOS priorities */
        hw->queues = 4;
@@ -7876,7 +5438,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        if (!err)
                err = pci_set_consistent_dma_mask(pdev, DMA_32BIT_MASK);
        if (err) {
-               printk(KERN_WARNING DRV_NAME ": No suitable DMA available.\n");
+               IWL_WARN(priv, "No suitable DMA available.\n");
                goto out_pci_disable_device;
        }
 
@@ -7894,98 +5456,58 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
                goto out_pci_release_regions;
        }
 
-       IWL_DEBUG_INFO("pci_resource_len = 0x%08llx\n",
+       IWL_DEBUG_INFO(priv, "pci_resource_len = 0x%08llx\n",
                        (unsigned long long) pci_resource_len(pdev, 0));
-       IWL_DEBUG_INFO("pci_resource_base = %p\n", priv->hw_base);
+       IWL_DEBUG_INFO(priv, "pci_resource_base = %p\n", priv->hw_base);
 
        /* We disable the RETRY_TIMEOUT register (0x41) to keep
         * PCI Tx retries from interfering with C3 CPU state */
        pci_write_config_byte(pdev, 0x41, 0x00);
 
-       /* nic init */
-       iwl3945_set_bit(priv, CSR_GIO_CHICKEN_BITS,
-                       CSR_GIO_CHICKEN_BITS_REG_BIT_DIS_L0S_EXIT_TIMER);
-
-       iwl3945_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
-       err = iwl3945_poll_direct_bit(priv, CSR_GP_CNTRL,
-                               CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY, 25000);
+       /* amp init */
+       err = priv->cfg->ops->lib->apm_ops.init(priv);
        if (err < 0) {
-               IWL_DEBUG_INFO("Failed to init the card\n");
-               goto out_remove_sysfs;
+               IWL_DEBUG_INFO(priv, "Failed to init APMG\n");
+               goto out_iounmap;
        }
 
        /***********************
         * 4. Read EEPROM
         * ********************/
+
        /* Read the EEPROM */
-       err = iwl3945_eeprom_init(priv);
+       err = iwl_eeprom_init(priv);
        if (err) {
-               IWL_ERROR("Unable to init EEPROM\n");
+               IWL_ERR(priv, "Unable to init EEPROM\n");
                goto out_remove_sysfs;
        }
        /* MAC Address location in EEPROM same for 3945/4965 */
-       get_eeprom_mac(priv, priv->mac_addr);
-       IWL_DEBUG_INFO("MAC address: %pM\n", priv->mac_addr);
+       eeprom = (struct iwl3945_eeprom *)priv->eeprom;
+       memcpy(priv->mac_addr, eeprom->mac_address, ETH_ALEN);
+       IWL_DEBUG_INFO(priv, "MAC address: %pM\n", priv->mac_addr);
        SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
 
        /***********************
         * 5. Setup HW Constants
         * ********************/
        /* Device-specific setup */
-       if (iwl3945_hw_set_hw_setting(priv)) {
-               IWL_ERROR("failed to set hw settings\n");
+       if (iwl3945_hw_set_hw_params(priv)) {
+               IWL_ERR(priv, "failed to set hw settings\n");
                goto out_iounmap;
        }
 
        /***********************
         * 6. Setup priv
         * ********************/
-       priv->retry_rate = 1;
-       priv->ibss_beacon = NULL;
 
-       spin_lock_init(&priv->lock);
-       spin_lock_init(&priv->power_data.lock);
-       spin_lock_init(&priv->sta_lock);
-       spin_lock_init(&priv->hcmd_lock);
-
-       INIT_LIST_HEAD(&priv->free_frames);
-       mutex_init(&priv->mutex);
-
-       /* Clear the driver's (not device's) station table */
-       iwl3945_clear_stations_table(priv);
-
-       priv->data_retry_limit = -1;
-       priv->ieee_channels = NULL;
-       priv->ieee_rates = NULL;
-       priv->band = IEEE80211_BAND_2GHZ;
-
-       priv->iw_mode = NL80211_IFTYPE_STATION;
-
-       iwl3945_reset_qos(priv);
-
-       priv->qos_data.qos_active = 0;
-       priv->qos_data.qos_cap.val = 0;
-
-
-       priv->rates_mask = IWL_RATES_MASK;
-       /* If power management is turned on, default to AC mode */
-       priv->power_mode = IWL_POWER_AC;
-       priv->user_txpower_limit = IWL_DEFAULT_TX_POWER;
-
-       err = iwl3945_init_channel_map(priv);
-       if (err) {
-               IWL_ERROR("initializing regulatory failed: %d\n", err);
-               goto out_release_irq;
-       }
-
-       err = iwl3945_init_geos(priv);
+       err = iwl3945_init_drv(priv);
        if (err) {
-               IWL_ERROR("initializing geos failed: %d\n", err);
-               goto out_free_channel_map;
+               IWL_ERR(priv, "initializing driver failed\n");
+               goto out_free_geos;
        }
 
-       printk(KERN_INFO DRV_NAME
-               ": Detected Intel Wireless WiFi Link %s\n", priv->cfg->name);
+       IWL_INFO(priv, "Detected Intel Wireless WiFi Link %s\n",
+               priv->cfg->name);
 
        /***********************************
         * 7. Initialize Module Parameters
@@ -7993,9 +5515,9 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
 
        /* Initialize module parameter values here */
        /* Disable radio (SW RF KILL) via parameter when loading driver */
-       if (iwl3945_param_disable) {
+       if (iwl3945_mod_params.disable) {
                set_bit(STATUS_RF_KILL_SW, &priv->status);
-               IWL_DEBUG_INFO("Radio disabled.\n");
+               IWL_DEBUG_INFO(priv, "Radio disabled.\n");
        }
 
 
@@ -8007,56 +5529,62 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
        iwl3945_disable_interrupts(priv);
        spin_unlock_irqrestore(&priv->lock, flags);
 
+       pci_enable_msi(priv->pci_dev);
+
+       err = request_irq(priv->pci_dev->irq, iwl3945_isr, IRQF_SHARED,
+                         DRV_NAME, priv);
+       if (err) {
+               IWL_ERR(priv, "Error allocating IRQ %d\n", priv->pci_dev->irq);
+               goto out_disable_msi;
+       }
+
        err = sysfs_create_group(&pdev->dev.kobj, &iwl3945_attribute_group);
        if (err) {
-               IWL_ERROR("failed to create sysfs device attributes\n");
-               goto out_free_geos;
+               IWL_ERR(priv, "failed to create sysfs device attributes\n");
+               goto out_release_irq;
        }
 
-       iwl3945_set_rxon_channel(priv, IEEE80211_BAND_2GHZ, 6);
+       iwl_set_rxon_channel(priv,
+                            &priv->bands[IEEE80211_BAND_2GHZ].channels[5]);
        iwl3945_setup_deferred_work(priv);
        iwl3945_setup_rx_handlers(priv);
 
-       /***********************
-        * 9. Conclude
-        * ********************/
-       pci_save_state(pdev);
-       pci_disable_device(pdev);
-
        /*********************************
-        * 10. Setup and Register mac80211
+        * 9. Setup and Register mac80211
         * *******************************/
 
        err = ieee80211_register_hw(priv->hw);
        if (err) {
-               IWL_ERROR("Failed to register network device (error %d)\n", err);
+               IWL_ERR(priv, "Failed to register network device: %d\n", err);
                goto  out_remove_sysfs;
        }
 
        priv->hw->conf.beacon_int = 100;
        priv->mac80211_registered = 1;
 
-
-       err = iwl3945_rfkill_init(priv);
+       err = iwl_rfkill_init(priv);
        if (err)
-               IWL_ERROR("Unable to initialize RFKILL system. "
+               IWL_ERR(priv, "Unable to initialize RFKILL system. "
                                  "Ignoring error: %d\n", err);
 
+       /* Start monitoring the killswitch */
+       queue_delayed_work(priv->workqueue, &priv->rfkill_poll,
+                          2 * HZ);
+
        return 0;
 
  out_remove_sysfs:
        sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
  out_free_geos:
-       iwl3945_free_geos(priv);
- out_free_channel_map:
-       iwl3945_free_channel_map(priv);
-
+       iwlcore_free_geos(priv);
 
  out_release_irq:
+       free_irq(priv->pci_dev->irq, priv);
        destroy_workqueue(priv->workqueue);
        priv->workqueue = NULL;
-       iwl3945_unset_hw_setting(priv);
-
+       iwl3945_unset_hw_params(priv);
+ out_disable_msi:
+       pci_disable_msi(priv->pci_dev);
  out_iounmap:
        pci_iounmap(pdev, priv->hw_base);
  out_pci_release_regions:
@@ -8072,17 +5600,22 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
 
 static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
 {
-       struct iwl3945_priv *priv = pci_get_drvdata(pdev);
+       struct iwl_priv *priv = pci_get_drvdata(pdev);
        unsigned long flags;
 
        if (!priv)
                return;
 
-       IWL_DEBUG_INFO("*** UNLOAD DRIVER ***\n");
+       IWL_DEBUG_INFO(priv, "*** UNLOAD DRIVER ***\n");
 
        set_bit(STATUS_EXIT_PENDING, &priv->status);
 
-       iwl3945_down(priv);
+       if (priv->mac80211_registered) {
+               ieee80211_unregister_hw(priv->hw);
+               priv->mac80211_registered = 0;
+       } else {
+               iwl3945_down(priv);
+       }
 
        /* make sure we flush any pending irq or
         * tasklet for the driver
@@ -8095,19 +5628,18 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
 
        sysfs_remove_group(&pdev->dev.kobj, &iwl3945_attribute_group);
 
-       iwl3945_rfkill_unregister(priv);
+       iwl_rfkill_unregister(priv);
+       cancel_delayed_work(&priv->rfkill_poll);
+
        iwl3945_dealloc_ucode_pci(priv);
 
        if (priv->rxq.bd)
-               iwl3945_rx_queue_free(priv, &priv->rxq);
+               iwl_rx_queue_free(priv, &priv->rxq);
        iwl3945_hw_txq_ctx_free(priv);
 
-       iwl3945_unset_hw_setting(priv);
+       iwl3945_unset_hw_params(priv);
        iwl3945_clear_stations_table(priv);
 
-       if (priv->mac80211_registered)
-               ieee80211_unregister_hw(priv->hw);
-
        /*netif_stop_queue(dev); */
        flush_workqueue(priv->workqueue);
 
@@ -8117,13 +5649,16 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
        destroy_workqueue(priv->workqueue);
        priv->workqueue = NULL;
 
+       free_irq(pdev->irq, priv);
+       pci_disable_msi(pdev);
+
        pci_iounmap(pdev, priv->hw_base);
        pci_release_regions(pdev);
        pci_disable_device(pdev);
        pci_set_drvdata(pdev, NULL);
 
-       iwl3945_free_channel_map(priv);
-       iwl3945_free_geos(priv);
+       iwl_free_channel_map(priv);
+       iwlcore_free_geos(priv);
        kfree(priv->scan);
        if (priv->ibss_beacon)
                dev_kfree_skb(priv->ibss_beacon);
@@ -8135,27 +5670,15 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
 
 static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
-       struct iwl3945_priv *priv = pci_get_drvdata(pdev);
+       struct iwl_priv *priv = pci_get_drvdata(pdev);
 
        if (priv->is_open) {
                set_bit(STATUS_IN_SUSPEND, &priv->status);
                iwl3945_mac_stop(priv->hw);
                priv->is_open = 1;
        }
-
-       /* pci driver assumes state will be saved in this function.
-        * pci state is saved and device disabled when interface is
-        * stopped, so at this time pci device will always be disabled -
-        * whether interface was started or not. saving pci state now will
-        * cause saved state be that of a disabled device, which will cause
-        * problems during resume in that we will end up with a disabled device.
-        *
-        * indicate that the current saved state (from when interface was
-        * stopped) is valid. if interface was never up at time of suspend
-        * then the saved state will still be valid as it was saved during
-        * .probe. */
-       pdev->state_saved = true;
-
+       pci_save_state(pdev);
+       pci_disable_device(pdev);
        pci_set_power_state(pdev, PCI_D3hot);
 
        return 0;
@@ -8163,9 +5686,14 @@ static int iwl3945_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 
 static int iwl3945_pci_resume(struct pci_dev *pdev)
 {
-       struct iwl3945_priv *priv = pci_get_drvdata(pdev);
+       struct iwl_priv *priv = pci_get_drvdata(pdev);
+       int ret;
 
        pci_set_power_state(pdev, PCI_D0);
+       ret = pci_enable_device(pdev);
+       if (ret)
+               return ret;
+       pci_restore_state(pdev);
 
        if (priv->is_open)
                iwl3945_mac_start(priv->hw);
@@ -8176,114 +5704,6 @@ static int iwl3945_pci_resume(struct pci_dev *pdev)
 
 #endif /* CONFIG_PM */
 
-/*************** RFKILL FUNCTIONS **********/
-#ifdef CONFIG_IWL3945_RFKILL
-/* software rf-kill from user */
-static int iwl3945_rfkill_soft_rf_kill(void *data, enum rfkill_state state)
-{
-       struct iwl3945_priv *priv = data;
-       int err = 0;
-
-       if (!priv->rfkill)
-       return 0;
-
-       if (test_bit(STATUS_EXIT_PENDING, &priv->status))
-               return 0;
-
-       IWL_DEBUG_RF_KILL("we received soft RFKILL set to state %d\n", state);
-       mutex_lock(&priv->mutex);
-
-       switch (state) {
-       case RFKILL_STATE_UNBLOCKED:
-               if (iwl3945_is_rfkill_hw(priv)) {
-                       err = -EBUSY;
-                       goto out_unlock;
-               }
-               iwl3945_radio_kill_sw(priv, 0);
-               break;
-       case RFKILL_STATE_SOFT_BLOCKED:
-               iwl3945_radio_kill_sw(priv, 1);
-               break;
-       default:
-               IWL_WARNING("we received unexpected RFKILL state %d\n", state);
-               break;
-       }
-out_unlock:
-       mutex_unlock(&priv->mutex);
-
-       return err;
-}
-
-int iwl3945_rfkill_init(struct iwl3945_priv *priv)
-{
-       struct device *device = wiphy_dev(priv->hw->wiphy);
-       int ret = 0;
-
-       BUG_ON(device == NULL);
-
-       IWL_DEBUG_RF_KILL("Initializing RFKILL.\n");
-       priv->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN);
-       if (!priv->rfkill) {
-               IWL_ERROR("Unable to allocate rfkill device.\n");
-               ret = -ENOMEM;
-               goto error;
-       }
-
-       priv->rfkill->name = priv->cfg->name;
-       priv->rfkill->data = priv;
-       priv->rfkill->state = RFKILL_STATE_UNBLOCKED;
-       priv->rfkill->toggle_radio = iwl3945_rfkill_soft_rf_kill;
-       priv->rfkill->user_claim_unsupported = 1;
-
-       priv->rfkill->dev.class->suspend = NULL;
-       priv->rfkill->dev.class->resume = NULL;
-
-       ret = rfkill_register(priv->rfkill);
-       if (ret) {
-               IWL_ERROR("Unable to register rfkill: %d\n", ret);
-               goto freed_rfkill;
-       }
-
-       IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n");
-       return ret;
-
-freed_rfkill:
-       if (priv->rfkill != NULL)
-               rfkill_free(priv->rfkill);
-       priv->rfkill = NULL;
-
-error:
-       IWL_DEBUG_RF_KILL("RFKILL initialization complete.\n");
-       return ret;
-}
-
-void iwl3945_rfkill_unregister(struct iwl3945_priv *priv)
-{
-       if (priv->rfkill)
-               rfkill_unregister(priv->rfkill);
-
-       priv->rfkill = NULL;
-}
-
-/* set rf-kill to the right state. */
-void iwl3945_rfkill_set_hw_state(struct iwl3945_priv *priv)
-{
-
-       if (!priv->rfkill)
-               return;
-
-       if (iwl3945_is_rfkill_hw(priv)) {
-               rfkill_force_state(priv->rfkill, RFKILL_STATE_HARD_BLOCKED);
-               return;
-       }
-
-       if (!iwl3945_is_rfkill_sw(priv))
-               rfkill_force_state(priv->rfkill, RFKILL_STATE_UNBLOCKED);
-       else
-               rfkill_force_state(priv->rfkill, RFKILL_STATE_SOFT_BLOCKED);
-}
-#endif
-
 /*****************************************************************************
  *
  * driver and module entry point
@@ -8310,29 +5730,19 @@ static int __init iwl3945_init(void)
 
        ret = iwl3945_rate_control_register();
        if (ret) {
-               IWL_ERROR("Unable to register rate control algorithm: %d\n", ret);
+               printk(KERN_ERR DRV_NAME
+                      "Unable to register rate control algorithm: %d\n", ret);
                return ret;
        }
 
        ret = pci_register_driver(&iwl3945_driver);
        if (ret) {
-               IWL_ERROR("Unable to initialize PCI module\n");
+               printk(KERN_ERR DRV_NAME "Unable to initialize PCI module\n");
                goto error_register;
        }
-#ifdef CONFIG_IWL3945_DEBUG
-       ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level);
-       if (ret) {
-               IWL_ERROR("Unable to create driver sysfs file\n");
-               goto error_debug;
-       }
-#endif
 
        return ret;
 
-#ifdef CONFIG_IWL3945_DEBUG
-error_debug:
-       pci_unregister_driver(&iwl3945_driver);
-#endif
 error_register:
        iwl3945_rate_control_unregister();
        return ret;
@@ -8340,29 +5750,29 @@ error_register:
 
 static void __exit iwl3945_exit(void)
 {
-#ifdef CONFIG_IWL3945_DEBUG
-       driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level);
-#endif
        pci_unregister_driver(&iwl3945_driver);
        iwl3945_rate_control_unregister();
 }
 
 MODULE_FIRMWARE(IWL3945_MODULE_FIRMWARE(IWL3945_UCODE_API_MAX));
 
-module_param_named(antenna, iwl3945_param_antenna, int, 0444);
+module_param_named(antenna, iwl3945_mod_params.antenna, int, 0444);
 MODULE_PARM_DESC(antenna, "select antenna (1=Main, 2=Aux, default 0 [both])");
-module_param_named(disable, iwl3945_param_disable, int, 0444);
+module_param_named(disable, iwl3945_mod_params.disable, int, 0444);
 MODULE_PARM_DESC(disable, "manually disable the radio (default 0 [radio on])");
-module_param_named(hwcrypto, iwl3945_param_hwcrypto, int, 0444);
-MODULE_PARM_DESC(hwcrypto,
-                "using hardware crypto engine (default 0 [software])\n");
-module_param_named(debug, iwl3945_param_debug, uint, 0444);
+module_param_named(swcrypto, iwl3945_mod_params.sw_crypto, int, 0444);
+MODULE_PARM_DESC(swcrypto,
+                "using software crypto (default 1 [software])\n");
+module_param_named(debug, iwl3945_mod_params.debug, uint, 0444);
 MODULE_PARM_DESC(debug, "debug output mask");
-module_param_named(disable_hw_scan, iwl3945_param_disable_hw_scan, int, 0444);
+module_param_named(disable_hw_scan, iwl3945_mod_params.disable_hw_scan, int, 0444);
 MODULE_PARM_DESC(disable_hw_scan, "disable hardware scanning (default 0)");
 
-module_param_named(queues_num, iwl3945_param_queues_num, int, 0444);
+module_param_named(queues_num, iwl3945_mod_params.num_of_queues, int, 0444);
 MODULE_PARM_DESC(queues_num, "number of hw queues.");
 
+module_param_named(fw_restart3945, iwl3945_mod_params.restart_fw, int, 0444);
+MODULE_PARM_DESC(fw_restart3945, "restart firmware in case of error");
+
 module_exit(iwl3945_exit);
 module_init(iwl3945_init);
index 02080a3682a91787a6e5dffb2986d826f97272b9..0b6918584503b836d2cc49196f09e81725f31977 100644 (file)
@@ -4,8 +4,10 @@ libertas-objs := main.o wext.o rx.o tx.o cmd.o cmdresp.o scan.o 11d.o  \
 usb8xxx-objs += if_usb.o
 libertas_cs-objs += if_cs.o
 libertas_sdio-objs += if_sdio.o
+libertas_spi-objs += if_spi.o
 
 obj-$(CONFIG_LIBERTAS)     += libertas.o
 obj-$(CONFIG_LIBERTAS_USB) += usb8xxx.o
 obj-$(CONFIG_LIBERTAS_CS)  += libertas_cs.o
 obj-$(CONFIG_LIBERTAS_SDIO) += libertas_sdio.o
+obj-$(CONFIG_LIBERTAS_SPI) += libertas_spi.o
index ec4efd7ff3c85064929fe67a6dee3c10f3c2148a..50e28a0cdfeeb0fc60397a146a14c2edad97f1f9 100644 (file)
@@ -629,7 +629,7 @@ static ssize_t lbs_rdrf_write(struct file *file,
                res = -EFAULT;
                goto out_unlock;
        }
-       priv->rf_offset = simple_strtoul((char *)buf, NULL, 16);
+       priv->rf_offset = simple_strtoul(buf, NULL, 16);
        res = count;
 out_unlock:
        free_page(addr);
@@ -680,12 +680,12 @@ out_unlock:
 }
 
 struct lbs_debugfs_files {
-       char *name;
+       const char *name;
        int perm;
        struct file_operations fops;
 };
 
-static struct lbs_debugfs_files debugfs_files[] = {
+static const struct lbs_debugfs_files debugfs_files[] = {
        { "info", 0444, FOPS(lbs_dev_info, write_file_dummy), },
        { "getscantable", 0444, FOPS(lbs_getscantable,
                                        write_file_dummy), },
@@ -693,7 +693,7 @@ static struct lbs_debugfs_files debugfs_files[] = {
                                lbs_sleepparams_write), },
 };
 
-static struct lbs_debugfs_files debugfs_events_files[] = {
+static const struct lbs_debugfs_files debugfs_events_files[] = {
        {"low_rssi", 0644, FOPS(lbs_lowrssi_read,
                                lbs_lowrssi_write), },
        {"low_snr", 0644, FOPS(lbs_lowsnr_read,
@@ -708,7 +708,7 @@ static struct lbs_debugfs_files debugfs_events_files[] = {
                                lbs_highsnr_write), },
 };
 
-static struct lbs_debugfs_files debugfs_regs_files[] = {
+static const struct lbs_debugfs_files debugfs_regs_files[] = {
        {"rdmac", 0644, FOPS(lbs_rdmac_read, lbs_rdmac_write), },
        {"wrmac", 0600, FOPS(NULL, lbs_wrmac_write), },
        {"rdbbp", 0644, FOPS(lbs_rdbbp_read, lbs_rdbbp_write), },
@@ -735,7 +735,7 @@ void lbs_debugfs_remove(void)
 void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev)
 {
        int i;
-       struct lbs_debugfs_files *files;
+       const struct lbs_debugfs_files *files;
        if (!lbs_dir)
                goto exit;
 
@@ -938,7 +938,7 @@ static ssize_t lbs_debugfs_write(struct file *f, const char __user *buf,
        return (ssize_t)cnt;
 }
 
-static struct file_operations lbs_debug_fops = {
+static const struct file_operations lbs_debug_fops = {
        .owner = THIS_MODULE,
        .open = open_file_generic,
        .write = lbs_debugfs_write,
index c364e4c01d1b7183f53290206a997e41051b6135..6388b05df4fcdd9f7da04bc5aaaaf79b4852178c 100644 (file)
@@ -41,6 +41,7 @@
 #define LBS_DEB_HEX    0x00200000
 #define LBS_DEB_SDIO   0x00400000
 #define LBS_DEB_SYSFS  0x00800000
+#define LBS_DEB_SPI    0x01000000
 
 extern unsigned int lbs_debug;
 
@@ -84,6 +85,7 @@ do { if ((lbs_debug & (grp)) == (grp)) \
 #define lbs_deb_thread(fmt, args...)    LBS_DEB_LL(LBS_DEB_THREAD, " thread", fmt, ##args)
 #define lbs_deb_sdio(fmt, args...)      LBS_DEB_LL(LBS_DEB_SDIO, " sdio", fmt, ##args)
 #define lbs_deb_sysfs(fmt, args...)     LBS_DEB_LL(LBS_DEB_SYSFS, " sysfs", fmt, ##args)
+#define lbs_deb_spi(fmt, args...)       LBS_DEB_LL(LBS_DEB_SPI, " spi", fmt, ##args)
 
 #define lbs_pr_info(format, args...) \
        printk(KERN_INFO DRV_NAME": " format, ## args)
index 277ff1975bde8e22ea1009268cf45f94920f39f5..d4457ef808a647c8c174de7d015b27ec01622127 100644 (file)
@@ -66,6 +66,7 @@
 #define CMD_802_11_LED_GPIO_CTRL               0x004e
 #define CMD_802_11_EEPROM_ACCESS               0x0059
 #define CMD_802_11_BAND_CONFIG                 0x0058
+#define CMD_GSPI_BUS_CONFIG                    0x005a
 #define CMD_802_11D_DOMAIN_INFO                        0x005b
 #define CMD_802_11_KEY_MATERIAL                        0x005e
 #define CMD_802_11_SLEEP_PARAMS                        0x0066
index f6a79a653b7ba5bfb00e14588963ae6692429221..a899aeb676bbbeb744dadb0bc313fe427611fd86 100644 (file)
@@ -221,6 +221,14 @@ struct cmd_ds_mac_multicast_adr {
        u8 maclist[ETH_ALEN * MRVDRV_MAX_MULTICAST_LIST_SIZE];
 } __attribute__ ((packed));
 
+struct cmd_ds_gspi_bus_config {
+       struct cmd_header hdr;
+       __le16 action;
+       __le16 bus_delay_mode;
+       __le16 host_time_delay_to_read_port;
+       __le16 host_time_delay_to_read_register;
+} __attribute__ ((packed));
+
 struct cmd_ds_802_11_authenticate {
        u8 macaddr[ETH_ALEN];
        u8 authtype;
index 842a08d1f1063427a1550062c436b62e2fde8701..8f8934a5ba3a9954b255437e0244f2135168abaf 100644 (file)
@@ -151,7 +151,7 @@ static int if_cs_poll_while_fw_download(struct if_cs_card *card, uint addr, u8 r
        for (i = 0; i < 100000; i++) {
                u8 val = if_cs_read8(card, addr);
                if (val == reg)
-                       return i;
+                       return 0;
                udelay(5);
        }
        return -ETIME;
diff --git a/drivers/net/wireless/libertas/if_spi.c b/drivers/net/wireless/libertas/if_spi.c
new file mode 100644 (file)
index 0000000..07311e7
--- /dev/null
@@ -0,0 +1,1218 @@
+/*
+ *     linux/drivers/net/wireless/libertas/if_spi.c
+ *
+ *     Driver for Marvell SPI WLAN cards.
+ *
+ *     Copyright 2008 Analog Devices Inc.
+ *
+ *     Authors:
+ *     Andrey Yurovsky <andrey@cozybit.com>
+ *     Colin McCabe <colin@cozybit.com>
+ *
+ *     Inspired by if_sdio.c, Copyright 2007-2008 Pierre Ossman
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include <linux/moduleparam.h>
+#include <linux/firmware.h>
+#include <linux/gpio.h>
+#include <linux/jiffies.h>
+#include <linux/kthread.h>
+#include <linux/list.h>
+#include <linux/netdevice.h>
+#include <linux/spi/libertas_spi.h>
+#include <linux/spi/spi.h>
+
+#include "host.h"
+#include "decl.h"
+#include "defs.h"
+#include "dev.h"
+#include "if_spi.h"
+
+struct if_spi_packet {
+       struct list_head                list;
+       u16                             blen;
+       u8                              buffer[0] __attribute__((aligned(4)));
+};
+
+struct if_spi_card {
+       struct spi_device               *spi;
+       struct lbs_private              *priv;
+       struct libertas_spi_platform_data *pdata;
+
+       char                            helper_fw_name[FIRMWARE_NAME_MAX];
+       char                            main_fw_name[FIRMWARE_NAME_MAX];
+
+       /* The card ID and card revision, as reported by the hardware. */
+       u16                             card_id;
+       u8                              card_rev;
+
+       /* Pin number for our GPIO chip-select. */
+       /* TODO: Once the generic SPI layer has some additional features, we
+        * should take this out and use the normal chip select here.
+        * We need support for chip select delays, and not dropping chipselect
+        * after each word. */
+       int                             gpio_cs;
+
+       /* The last time that we initiated an SPU operation */
+       unsigned long                   prev_xfer_time;
+
+       int                             use_dummy_writes;
+       unsigned long                   spu_port_delay;
+       unsigned long                   spu_reg_delay;
+
+       /* Handles all SPI communication (except for FW load) */
+       struct task_struct              *spi_thread;
+       int                             run_thread;
+
+       /* Used to wake up the spi_thread */
+       struct semaphore                spi_ready;
+       struct semaphore                spi_thread_terminated;
+
+       u8                              cmd_buffer[IF_SPI_CMD_BUF_SIZE];
+
+       /* A buffer of incoming packets from libertas core.
+        * Since we can't sleep in hw_host_to_card, we have to buffer
+        * them. */
+       struct list_head                cmd_packet_list;
+       struct list_head                data_packet_list;
+
+       /* Protects cmd_packet_list and data_packet_list */
+       spinlock_t                      buffer_lock;
+};
+
+static void free_if_spi_card(struct if_spi_card *card)
+{
+       struct list_head *cursor, *next;
+       struct if_spi_packet *packet;
+
+       BUG_ON(card->run_thread);
+       list_for_each_safe(cursor, next, &card->cmd_packet_list) {
+               packet = container_of(cursor, struct if_spi_packet, list);
+               list_del(&packet->list);
+               kfree(packet);
+       }
+       list_for_each_safe(cursor, next, &card->data_packet_list) {
+               packet = container_of(cursor, struct if_spi_packet, list);
+               list_del(&packet->list);
+               kfree(packet);
+       }
+       spi_set_drvdata(card->spi, NULL);
+       kfree(card);
+}
+
+static struct chip_ident chip_id_to_device_name[] = {
+       { .chip_id = 0x04, .name = 8385 },
+       { .chip_id = 0x0b, .name = 8686 },
+};
+
+/*
+ * SPI Interface Unit Routines
+ *
+ * The SPU sits between the host and the WLAN module.
+ * All communication with the firmware is through SPU transactions.
+ *
+ * First we have to put a SPU register name on the bus. Then we can
+ * either read from or write to that register.
+ *
+ * For 16-bit transactions, byte order on the bus is big-endian.
+ * We don't have to worry about that here, though.
+ * The translation takes place in the SPI routines.
+ */
+
+static void spu_transaction_init(struct if_spi_card *card)
+{
+       if (!time_after(jiffies, card->prev_xfer_time + 1)) {
+               /* Unfortunately, the SPU requires a delay between successive
+                * transactions. If our last transaction was more than a jiffy
+                * ago, we have obviously already delayed enough.
+                * If not, we have to busy-wait to be on the safe side. */
+               ndelay(400);
+       }
+       gpio_set_value(card->gpio_cs, 0); /* assert CS */
+}
+
+static void spu_transaction_finish(struct if_spi_card *card)
+{
+       gpio_set_value(card->gpio_cs, 1); /* drop CS */
+       card->prev_xfer_time = jiffies;
+}
+
+/* Write out a byte buffer to an SPI register,
+ * using a series of 16-bit transfers. */
+static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len)
+{
+       int err = 0;
+       u16 reg_out = reg | IF_SPI_WRITE_OPERATION_MASK;
+
+       /* You must give an even number of bytes to the SPU, even if it
+        * doesn't care about the last one.  */
+       BUG_ON(len & 0x1);
+
+       spu_transaction_init(card);
+
+       /* write SPU register index */
+       err = spi_write(card->spi, (u8 *)&reg_out, sizeof(u16));
+       if (err)
+               goto out;
+
+       err = spi_write(card->spi, buf, len);
+
+out:
+       spu_transaction_finish(card);
+       return err;
+}
+
+static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val)
+{
+       return spu_write(card, reg, (u8 *)&val, sizeof(u16));
+}
+
+static inline int spu_write_u32(struct if_spi_card *card, u16 reg, u32 val)
+{
+       /* The lower 16 bits are written first. */
+       u16 out[2];
+       out[0] = val & 0xffff;
+       out[1] = (val & 0xffff0000) >> 16;
+       return spu_write(card, reg, (u8 *)&out, sizeof(u32));
+}
+
+static inline int spu_reg_is_port_reg(u16 reg)
+{
+       switch (reg) {
+       case IF_SPI_IO_RDWRPORT_REG:
+       case IF_SPI_CMD_RDWRPORT_REG:
+       case IF_SPI_DATA_RDWRPORT_REG:
+               return 1;
+       default:
+               return 0;
+       }
+}
+
+static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len)
+{
+       unsigned int i, delay;
+       int err = 0;
+       u16 zero = 0;
+       u16 reg_out = reg | IF_SPI_READ_OPERATION_MASK;
+
+       /* You must take an even number of bytes from the SPU, even if you
+        * don't care about the last one.  */
+       BUG_ON(len & 0x1);
+
+       spu_transaction_init(card);
+
+       /* write SPU register index */
+       err = spi_write(card->spi, (u8 *)&reg_out, sizeof(u16));
+       if (err)
+               goto out;
+
+       delay = spu_reg_is_port_reg(reg) ? card->spu_port_delay :
+                                               card->spu_reg_delay;
+       if (card->use_dummy_writes) {
+               /* Clock in dummy cycles while the SPU fills the FIFO */
+               for (i = 0; i < delay / 16; ++i) {
+                       err = spi_write(card->spi, (u8 *)&zero, sizeof(u16));
+                       if (err)
+                               return err;
+               }
+       } else {
+               /* Busy-wait while the SPU fills the FIFO */
+               ndelay(100 + (delay * 10));
+       }
+
+       /* read in data */
+       err = spi_read(card->spi, buf, len);
+
+out:
+       spu_transaction_finish(card);
+       return err;
+}
+
+/* Read 16 bits from an SPI register */
+static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val)
+{
+       return spu_read(card, reg, (u8 *)val, sizeof(u16));
+}
+
+/* Read 32 bits from an SPI register.
+ * The low 16 bits are read first. */
+static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val)
+{
+       u16 buf[2];
+       int err;
+       err = spu_read(card, reg, (u8 *)buf, sizeof(u32));
+       if (!err)
+               *val = buf[0] | (buf[1] << 16);
+       return err;
+}
+
+/* Keep reading 16 bits from an SPI register until you get the correct result.
+ *
+ * If mask = 0, the correct result is any non-zero number.
+ * If mask != 0, the correct result is any number where
+ * number & target_mask == target
+ *
+ * Returns -ETIMEDOUT if a second passes without the correct result. */
+static int spu_wait_for_u16(struct if_spi_card *card, u16 reg,
+                       u16 target_mask, u16 target)
+{
+       int err;
+       unsigned long timeout = jiffies + 5*HZ;
+       while (1) {
+               u16 val;
+               err = spu_read_u16(card, reg, &val);
+               if (err)
+                       return err;
+               if (target_mask) {
+                       if ((val & target_mask) == target)
+                               return 0;
+               } else {
+                       if (val)
+                               return 0;
+               }
+               udelay(100);
+               if (time_after(jiffies, timeout)) {
+                       lbs_pr_err("%s: timeout with val=%02x, "
+                              "target_mask=%02x, target=%02x\n",
+                              __func__, val, target_mask, target);
+                       return -ETIMEDOUT;
+               }
+       }
+}
+
+/* Read 16 bits from an SPI register until you receive a specific value.
+ * Returns -ETIMEDOUT if a 4 tries pass without success. */
+static int spu_wait_for_u32(struct if_spi_card *card, u32 reg, u32 target)
+{
+       int err, try;
+       for (try = 0; try < 4; ++try) {
+               u32 val = 0;
+               err = spu_read_u32(card, reg, &val);
+               if (err)
+                       return err;
+               if (val == target)
+                       return 0;
+               mdelay(100);
+       }
+       return -ETIMEDOUT;
+}
+
+static int spu_set_interrupt_mode(struct if_spi_card *card,
+                          int suppress_host_int,
+                          int auto_int)
+{
+       int err = 0;
+
+       /* We can suppress a host interrupt by clearing the appropriate
+        * bit in the "host interrupt status mask" register */
+       if (suppress_host_int) {
+               err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_MASK_REG, 0);
+               if (err)
+                       return err;
+       } else {
+               err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_MASK_REG,
+                             IF_SPI_HISM_TX_DOWNLOAD_RDY |
+                             IF_SPI_HISM_RX_UPLOAD_RDY |
+                             IF_SPI_HISM_CMD_DOWNLOAD_RDY |
+                             IF_SPI_HISM_CARDEVENT |
+                             IF_SPI_HISM_CMD_UPLOAD_RDY);
+               if (err)
+                       return err;
+       }
+
+       /* If auto-interrupts are on, the completion of certain transactions
+        * will trigger an interrupt automatically. If auto-interrupts
+        * are off, we need to set the "Card Interrupt Cause" register to
+        * trigger a card interrupt. */
+       if (auto_int) {
+               err = spu_write_u16(card, IF_SPI_HOST_INT_CTRL_REG,
+                               IF_SPI_HICT_TX_DOWNLOAD_OVER_AUTO |
+                               IF_SPI_HICT_RX_UPLOAD_OVER_AUTO |
+                               IF_SPI_HICT_CMD_DOWNLOAD_OVER_AUTO |
+                               IF_SPI_HICT_CMD_UPLOAD_OVER_AUTO);
+               if (err)
+                       return err;
+       } else {
+               err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_MASK_REG, 0);
+               if (err)
+                       return err;
+       }
+       return err;
+}
+
+static int spu_get_chip_revision(struct if_spi_card *card,
+                                 u16 *card_id, u8 *card_rev)
+{
+       int err = 0;
+       u32 dev_ctrl;
+       err = spu_read_u32(card, IF_SPI_DEVICEID_CTRL_REG, &dev_ctrl);
+       if (err)
+               return err;
+       *card_id = IF_SPI_DEVICEID_CTRL_REG_TO_CARD_ID(dev_ctrl);
+       *card_rev = IF_SPI_DEVICEID_CTRL_REG_TO_CARD_REV(dev_ctrl);
+       return err;
+}
+
+static int spu_set_bus_mode(struct if_spi_card *card, u16 mode)
+{
+       int err = 0;
+       u16 rval;
+       /* set bus mode */
+       err = spu_write_u16(card, IF_SPI_SPU_BUS_MODE_REG, mode);
+       if (err)
+               return err;
+       /* Check that we were able to read back what we just wrote. */
+       err = spu_read_u16(card, IF_SPI_SPU_BUS_MODE_REG, &rval);
+       if (err)
+               return err;
+       if (rval != mode) {
+               lbs_pr_err("Can't read bus mode register.\n");
+               return -EIO;
+       }
+       return 0;
+}
+
+static int spu_init(struct if_spi_card *card, int use_dummy_writes)
+{
+       int err = 0;
+       u32 delay;
+
+       /* We have to start up in timed delay mode so that we can safely
+        * read the Delay Read Register. */
+       card->use_dummy_writes = 0;
+       err = spu_set_bus_mode(card,
+                               IF_SPI_BUS_MODE_SPI_CLOCK_PHASE_RISING |
+                               IF_SPI_BUS_MODE_DELAY_METHOD_TIMED |
+                               IF_SPI_BUS_MODE_16_BIT_ADDRESS_16_BIT_DATA);
+       if (err)
+               return err;
+       card->spu_port_delay = 1000;
+       card->spu_reg_delay = 1000;
+       err = spu_read_u32(card, IF_SPI_DELAY_READ_REG, &delay);
+       if (err)
+               return err;
+       card->spu_port_delay = delay & 0x0000ffff;
+       card->spu_reg_delay = (delay & 0xffff0000) >> 16;
+
+       /* If dummy clock delay mode has been requested, switch to it now */
+       if (use_dummy_writes) {
+               card->use_dummy_writes = 1;
+               err = spu_set_bus_mode(card,
+                               IF_SPI_BUS_MODE_SPI_CLOCK_PHASE_RISING |
+                               IF_SPI_BUS_MODE_DELAY_METHOD_DUMMY_CLOCK |
+                               IF_SPI_BUS_MODE_16_BIT_ADDRESS_16_BIT_DATA);
+               if (err)
+                       return err;
+       }
+
+       lbs_deb_spi("Initialized SPU unit. "
+                   "spu_port_delay=0x%04lx, spu_reg_delay=0x%04lx\n",
+                   card->spu_port_delay, card->spu_reg_delay);
+       return err;
+}
+
+/*
+ * Firmware Loading
+ */
+
+static int if_spi_prog_helper_firmware(struct if_spi_card *card)
+{
+       int err = 0;
+       const struct firmware *firmware = NULL;
+       int bytes_remaining;
+       const u8 *fw;
+       u8 temp[HELPER_FW_LOAD_CHUNK_SZ];
+       struct spi_device *spi = card->spi;
+
+       lbs_deb_enter(LBS_DEB_SPI);
+
+       err = spu_set_interrupt_mode(card, 1, 0);
+       if (err)
+               goto out;
+       /* Get helper firmware image */
+       err = request_firmware(&firmware, card->helper_fw_name, &spi->dev);
+       if (err) {
+               lbs_pr_err("request_firmware failed with err = %d\n", err);
+               goto out;
+       }
+       bytes_remaining = firmware->size;
+       fw = firmware->data;
+
+       /* Load helper firmware image */
+       while (bytes_remaining > 0) {
+               /* Scratch pad 1 should contain the number of bytes we
+                * want to download to the firmware */
+               err = spu_write_u16(card, IF_SPI_SCRATCH_1_REG,
+                                       HELPER_FW_LOAD_CHUNK_SZ);
+               if (err)
+                       goto release_firmware;
+
+               err = spu_wait_for_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+                                       IF_SPI_HIST_CMD_DOWNLOAD_RDY,
+                                       IF_SPI_HIST_CMD_DOWNLOAD_RDY);
+               if (err)
+                       goto release_firmware;
+
+               /* Feed the data into the command read/write port reg
+                * in chunks of 64 bytes */
+               memset(temp, 0, sizeof(temp));
+               memcpy(temp, fw,
+                      min(bytes_remaining, HELPER_FW_LOAD_CHUNK_SZ));
+               mdelay(10);
+               err = spu_write(card, IF_SPI_CMD_RDWRPORT_REG,
+                                       temp, HELPER_FW_LOAD_CHUNK_SZ);
+               if (err)
+                       goto release_firmware;
+
+               /* Interrupt the boot code */
+               err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG, 0);
+               if (err)
+                       goto release_firmware;
+               err = spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG,
+                                      IF_SPI_CIC_CMD_DOWNLOAD_OVER);
+               if (err)
+                       goto release_firmware;
+               bytes_remaining -= HELPER_FW_LOAD_CHUNK_SZ;
+               fw += HELPER_FW_LOAD_CHUNK_SZ;
+       }
+
+       /* Once the helper / single stage firmware download is complete,
+        * write 0 to scratch pad 1 and interrupt the
+        * bootloader. This completes the helper download. */
+       err = spu_write_u16(card, IF_SPI_SCRATCH_1_REG, FIRMWARE_DNLD_OK);
+       if (err)
+               goto release_firmware;
+       err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG, 0);
+       if (err)
+               goto release_firmware;
+       err = spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG,
+                               IF_SPI_CIC_CMD_DOWNLOAD_OVER);
+               goto release_firmware;
+
+       lbs_deb_spi("waiting for helper to boot...\n");
+
+release_firmware:
+       release_firmware(firmware);
+out:
+       if (err)
+               lbs_pr_err("failed to load helper firmware (err=%d)\n", err);
+       lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err);
+       return err;
+}
+
+/* Returns the length of the next packet the firmware expects us to send
+ * Sets crc_err if the previous transfer had a CRC error. */
+static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card,
+                                               int *crc_err)
+{
+       u16 len;
+       int err = 0;
+
+       /* wait until the host interrupt status register indicates
+        * that we are ready to download */
+       err = spu_wait_for_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+                               IF_SPI_HIST_CMD_DOWNLOAD_RDY,
+                               IF_SPI_HIST_CMD_DOWNLOAD_RDY);
+       if (err) {
+               lbs_pr_err("timed out waiting for host_int_status\n");
+               return err;
+       }
+
+       /* Ask the device how many bytes of firmware it wants. */
+       err = spu_read_u16(card, IF_SPI_SCRATCH_1_REG, &len);
+       if (err)
+               return err;
+
+       if (len > IF_SPI_CMD_BUF_SIZE) {
+               lbs_pr_err("firmware load device requested a larger "
+                          "tranfer than we are prepared to "
+                          "handle. (len = %d)\n", len);
+               return -EIO;
+       }
+       if (len & 0x1) {
+               lbs_deb_spi("%s: crc error\n", __func__);
+               len &= ~0x1;
+               *crc_err = 1;
+       } else
+               *crc_err = 0;
+
+       return len;
+}
+
+static int if_spi_prog_main_firmware(struct if_spi_card *card)
+{
+       int len, prev_len;
+       int bytes, crc_err = 0, err = 0;
+       const struct firmware *firmware = NULL;
+       const u8 *fw;
+       struct spi_device *spi = card->spi;
+       u16 num_crc_errs;
+
+       lbs_deb_enter(LBS_DEB_SPI);
+
+       err = spu_set_interrupt_mode(card, 1, 0);
+       if (err)
+               goto out;
+
+       /* Get firmware image */
+       err = request_firmware(&firmware, card->main_fw_name, &spi->dev);
+       if (err) {
+               lbs_pr_err("%s: can't get firmware '%s' from kernel. "
+                       "err = %d\n", __func__, card->main_fw_name, err);
+               goto out;
+       }
+
+       err = spu_wait_for_u16(card, IF_SPI_SCRATCH_1_REG, 0, 0);
+       if (err) {
+               lbs_pr_err("%s: timed out waiting for initial "
+                          "scratch reg = 0\n", __func__);
+               goto release_firmware;
+       }
+
+       num_crc_errs = 0;
+       prev_len = 0;
+       bytes = firmware->size;
+       fw = firmware->data;
+       while ((len = if_spi_prog_main_firmware_check_len(card, &crc_err))) {
+               if (len < 0) {
+                       err = len;
+                       goto release_firmware;
+               }
+               if (bytes < 0) {
+                       /* If there are no more bytes left, we would normally
+                        * expect to have terminated with len = 0 */
+                       lbs_pr_err("Firmware load wants more bytes "
+                                  "than we have to offer.\n");
+                       break;
+               }
+               if (crc_err) {
+                       /* Previous transfer failed. */
+                       if (++num_crc_errs > MAX_MAIN_FW_LOAD_CRC_ERR) {
+                               lbs_pr_err("Too many CRC errors encountered "
+                                          "in firmware load.\n");
+                               err = -EIO;
+                               goto release_firmware;
+                       }
+               } else {
+                       /* Previous transfer succeeded. Advance counters. */
+                       bytes -= prev_len;
+                       fw += prev_len;
+               }
+               if (bytes < len) {
+                       memset(card->cmd_buffer, 0, len);
+                       memcpy(card->cmd_buffer, fw, bytes);
+               } else
+                       memcpy(card->cmd_buffer, fw, len);
+
+               err = spu_write_u16(card, IF_SPI_HOST_INT_STATUS_REG, 0);
+               if (err)
+                       goto release_firmware;
+               err = spu_write(card, IF_SPI_CMD_RDWRPORT_REG,
+                               card->cmd_buffer, len);
+               if (err)
+                       goto release_firmware;
+               err = spu_write_u16(card, IF_SPI_CARD_INT_CAUSE_REG ,
+                                       IF_SPI_CIC_CMD_DOWNLOAD_OVER);
+               if (err)
+                       goto release_firmware;
+               prev_len = len;
+       }
+       if (bytes > prev_len) {
+               lbs_pr_err("firmware load wants fewer bytes than "
+                          "we have to offer.\n");
+       }
+
+       /* Confirm firmware download */
+       err = spu_wait_for_u32(card, IF_SPI_SCRATCH_4_REG,
+                                       SUCCESSFUL_FW_DOWNLOAD_MAGIC);
+       if (err) {
+               lbs_pr_err("failed to confirm the firmware download\n");
+               goto release_firmware;
+       }
+
+release_firmware:
+       release_firmware(firmware);
+
+out:
+       if (err)
+               lbs_pr_err("failed to load firmware (err=%d)\n", err);
+       lbs_deb_leave_args(LBS_DEB_SPI, "err %d", err);
+       return err;
+}
+
+/*
+ * SPI Transfer Thread
+ *
+ * The SPI thread handles all SPI transfers, so there is no need for a lock.
+ */
+
+/* Move a command from the card to the host */
+static int if_spi_c2h_cmd(struct if_spi_card *card)
+{
+       struct lbs_private *priv = card->priv;
+       unsigned long flags;
+       int err = 0;
+       u16 len;
+       u8 i;
+
+       /* We need a buffer big enough to handle whatever people send to
+        * hw_host_to_card */
+       BUILD_BUG_ON(IF_SPI_CMD_BUF_SIZE < LBS_CMD_BUFFER_SIZE);
+       BUILD_BUG_ON(IF_SPI_CMD_BUF_SIZE < LBS_UPLD_SIZE);
+
+       /* It's just annoying if the buffer size isn't a multiple of 4, because
+        * then we might have len <  IF_SPI_CMD_BUF_SIZE but
+        * ALIGN(len, 4) > IF_SPI_CMD_BUF_SIZE */
+       BUILD_BUG_ON(IF_SPI_CMD_BUF_SIZE % 4 != 0);
+
+       lbs_deb_enter(LBS_DEB_SPI);
+
+       /* How many bytes are there to read? */
+       err = spu_read_u16(card, IF_SPI_SCRATCH_2_REG, &len);
+       if (err)
+               goto out;
+       if (!len) {
+               lbs_pr_err("%s: error: card has no data for host\n",
+                          __func__);
+               err = -EINVAL;
+               goto out;
+       } else if (len > IF_SPI_CMD_BUF_SIZE) {
+               lbs_pr_err("%s: error: response packet too large: "
+                          "%d bytes, but maximum is %d\n",
+                          __func__, len, IF_SPI_CMD_BUF_SIZE);
+               err = -EINVAL;
+               goto out;
+       }
+
+       /* Read the data from the WLAN module into our command buffer */
+       err = spu_read(card, IF_SPI_CMD_RDWRPORT_REG,
+                               card->cmd_buffer, ALIGN(len, 4));
+       if (err)
+               goto out;
+
+       spin_lock_irqsave(&priv->driver_lock, flags);
+       i = (priv->resp_idx == 0) ? 1 : 0;
+       BUG_ON(priv->resp_len[i]);
+       priv->resp_len[i] = len;
+       memcpy(priv->resp_buf[i], card->cmd_buffer, len);
+       lbs_notify_command_response(priv, i);
+       spin_unlock_irqrestore(&priv->driver_lock, flags);
+
+out:
+       if (err)
+               lbs_pr_err("%s: err=%d\n", __func__, err);
+       lbs_deb_leave(LBS_DEB_SPI);
+       return err;
+}
+
+/* Move data from the card to the host */
+static int if_spi_c2h_data(struct if_spi_card *card)
+{
+       struct sk_buff *skb;
+       char *data;
+       u16 len;
+       int err = 0;
+
+       lbs_deb_enter(LBS_DEB_SPI);
+
+       /* How many bytes are there to read? */
+       err = spu_read_u16(card, IF_SPI_SCRATCH_1_REG, &len);
+       if (err)
+               goto out;
+       if (!len) {
+               lbs_pr_err("%s: error: card has no data for host\n",
+                          __func__);
+               err = -EINVAL;
+               goto out;
+       } else if (len > MRVDRV_ETH_RX_PACKET_BUFFER_SIZE) {
+               lbs_pr_err("%s: error: card has %d bytes of data, but "
+                          "our maximum skb size is %u\n",
+                          __func__, len, MRVDRV_ETH_RX_PACKET_BUFFER_SIZE);
+               err = -EINVAL;
+               goto out;
+       }
+
+       /* TODO: should we allocate a smaller skb if we have less data? */
+       skb = dev_alloc_skb(MRVDRV_ETH_RX_PACKET_BUFFER_SIZE);
+       if (!skb) {
+               err = -ENOBUFS;
+               goto out;
+       }
+       skb_reserve(skb, IPFIELD_ALIGN_OFFSET);
+       data = skb_put(skb, len);
+
+       /* Read the data from the WLAN module into our skb... */
+       err = spu_read(card, IF_SPI_DATA_RDWRPORT_REG, data, ALIGN(len, 4));
+       if (err)
+               goto free_skb;
+
+       /* pass the SKB to libertas */
+       err = lbs_process_rxed_packet(card->priv, skb);
+       if (err)
+               goto free_skb;
+
+       /* success */
+       goto out;
+
+free_skb:
+       dev_kfree_skb(skb);
+out:
+       if (err)
+               lbs_pr_err("%s: err=%d\n", __func__, err);
+       lbs_deb_leave(LBS_DEB_SPI);
+       return err;
+}
+
+/* Move data or a command from the host to the card. */
+static void if_spi_h2c(struct if_spi_card *card,
+                       struct if_spi_packet *packet, int type)
+{
+       int err = 0;
+       u16 int_type, port_reg;
+
+       switch (type) {
+       case MVMS_DAT:
+               int_type = IF_SPI_CIC_TX_DOWNLOAD_OVER;
+               port_reg = IF_SPI_DATA_RDWRPORT_REG;
+               break;
+       case MVMS_CMD:
+               int_type = IF_SPI_CIC_CMD_DOWNLOAD_OVER;
+               port_reg = IF_SPI_CMD_RDWRPORT_REG;
+               break;
+       default:
+               lbs_pr_err("can't transfer buffer of type %d\n", type);
+               err = -EINVAL;
+               goto out;
+       }
+
+       /* Write the data to the card */
+       err = spu_write(card, port_reg, packet->buffer, packet->blen);
+       if (err)
+               goto out;
+
+out:
+       kfree(packet);
+
+       if (err)
+               lbs_pr_err("%s: error %d\n", __func__, err);
+}
+
+/* Inform the host about a card event */
+static void if_spi_e2h(struct if_spi_card *card)
+{
+       int err = 0;
+       unsigned long flags;
+       u32 cause;
+       struct lbs_private *priv = card->priv;
+
+       err = spu_read_u32(card, IF_SPI_SCRATCH_3_REG, &cause);
+       if (err)
+               goto out;
+
+       spin_lock_irqsave(&priv->driver_lock, flags);
+       lbs_queue_event(priv, cause & 0xff);
+       spin_unlock_irqrestore(&priv->driver_lock, flags);
+
+out:
+       if (err)
+               lbs_pr_err("%s: error %d\n", __func__, err);
+}
+
+static int lbs_spi_thread(void *data)
+{
+       int err;
+       struct if_spi_card *card = data;
+       u16 hiStatus;
+       unsigned long flags;
+       struct if_spi_packet *packet;
+
+       while (1) {
+               /* Wait to be woken up by one of two things.  First, our ISR
+                * could tell us that something happened on the WLAN.
+                * Secondly, libertas could call hw_host_to_card with more
+                * data, which we might be able to send.
+                */
+               do {
+                       err = down_interruptible(&card->spi_ready);
+                       if (!card->run_thread) {
+                               up(&card->spi_thread_terminated);
+                               do_exit(0);
+                       }
+               } while (err == EINTR);
+
+               /* Read the host interrupt status register to see what we
+                * can do. */
+               err = spu_read_u16(card, IF_SPI_HOST_INT_STATUS_REG,
+                                       &hiStatus);
+               if (err) {
+                       lbs_pr_err("I/O error\n");
+                       goto err;
+               }
+
+               if (hiStatus & IF_SPI_HIST_CMD_UPLOAD_RDY)
+                       err = if_spi_c2h_cmd(card);
+                       if (err)
+                               goto err;
+               if (hiStatus & IF_SPI_HIST_RX_UPLOAD_RDY)
+                       err = if_spi_c2h_data(card);
+                       if (err)
+                               goto err;
+               if (hiStatus & IF_SPI_HIST_CMD_DOWNLOAD_RDY) {
+                       /* This means two things. First of all,
+                        * if there was a previous command sent, the card has
+                        * successfully received it.
+                        * Secondly, it is now ready to download another
+                        * command.
+                        */
+                       lbs_host_to_card_done(card->priv);
+
+                       /* Do we have any command packets from the host to
+                        * send? */
+                       packet = NULL;
+                       spin_lock_irqsave(&card->buffer_lock, flags);
+                       if (!list_empty(&card->cmd_packet_list)) {
+                               packet = (struct if_spi_packet *)(card->
+                                               cmd_packet_list.next);
+                               list_del(&packet->list);
+                       }
+                       spin_unlock_irqrestore(&card->buffer_lock, flags);
+
+                       if (packet)
+                               if_spi_h2c(card, packet, MVMS_CMD);
+               }
+               if (hiStatus & IF_SPI_HIST_TX_DOWNLOAD_RDY) {
+                       /* Do we have any data packets from the host to
+                        * send? */
+                       packet = NULL;
+                       spin_lock_irqsave(&card->buffer_lock, flags);
+                       if (!list_empty(&card->data_packet_list)) {
+                               packet = (struct if_spi_packet *)(card->
+                                               data_packet_list.next);
+                               list_del(&packet->list);
+                       }
+                       spin_unlock_irqrestore(&card->buffer_lock, flags);
+
+                       if (packet)
+                               if_spi_h2c(card, packet, MVMS_DAT);
+               }
+               if (hiStatus & IF_SPI_HIST_CARD_EVENT)
+                       if_spi_e2h(card);
+
+err:
+               if (err)
+                       lbs_pr_err("%s: got error %d\n", __func__, err);
+       }
+}
+
+/* Block until lbs_spi_thread thread has terminated */
+static void if_spi_terminate_spi_thread(struct if_spi_card *card)
+{
+       /* It would be nice to use kthread_stop here, but that function
+        * can't wake threads waiting for a semaphore. */
+       card->run_thread = 0;
+       up(&card->spi_ready);
+       down(&card->spi_thread_terminated);
+}
+
+/*
+ * Host to Card
+ *
+ * Called from Libertas to transfer some data to the WLAN device
+ * We can't sleep here. */
+static int if_spi_host_to_card(struct lbs_private *priv,
+                               u8 type, u8 *buf, u16 nb)
+{
+       int err = 0;
+       unsigned long flags;
+       struct if_spi_card *card = priv->card;
+       struct if_spi_packet *packet;
+       u16 blen;
+
+       lbs_deb_enter_args(LBS_DEB_SPI, "type %d, bytes %d", type, nb);
+
+       if (nb == 0) {
+               lbs_pr_err("%s: invalid size requested: %d\n", __func__, nb);
+               err = -EINVAL;
+               goto out;
+       }
+       blen = ALIGN(nb, 4);
+       packet = kzalloc(sizeof(struct if_spi_packet) + blen, GFP_ATOMIC);
+       if (!packet) {
+               err = -ENOMEM;
+               goto out;
+       }
+       packet->blen = blen;
+       memcpy(packet->buffer, buf, nb);
+       memset(packet->buffer + nb, 0, blen - nb);
+
+       switch (type) {
+       case MVMS_CMD:
+               priv->dnld_sent = DNLD_CMD_SENT;
+               spin_lock_irqsave(&card->buffer_lock, flags);
+               list_add_tail(&packet->list, &card->cmd_packet_list);
+               spin_unlock_irqrestore(&card->buffer_lock, flags);
+               break;
+       case MVMS_DAT:
+               priv->dnld_sent = DNLD_DATA_SENT;
+               spin_lock_irqsave(&card->buffer_lock, flags);
+               list_add_tail(&packet->list, &card->data_packet_list);
+               spin_unlock_irqrestore(&card->buffer_lock, flags);
+               break;
+       default:
+               lbs_pr_err("can't transfer buffer of type %d", type);
+               err = -EINVAL;
+               break;
+       }
+
+       /* Wake up the spi thread */
+       up(&card->spi_ready);
+out:
+       lbs_deb_leave_args(LBS_DEB_SPI, "err=%d", err);
+       return err;
+}
+
+/*
+ * Host Interrupts
+ *
+ * Service incoming interrupts from the WLAN device. We can't sleep here, so
+ * don't try to talk on the SPI bus, just wake up the SPI thread.
+ */
+static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id)
+{
+       struct if_spi_card *card = dev_id;
+
+       up(&card->spi_ready);
+       return IRQ_HANDLED;
+}
+
+/*
+ * SPI callbacks
+ */
+
+static int if_spi_calculate_fw_names(u16 card_id,
+                             char *helper_fw, char *main_fw)
+{
+       int i;
+       for (i = 0; i < ARRAY_SIZE(chip_id_to_device_name); ++i) {
+               if (card_id == chip_id_to_device_name[i].chip_id)
+                       break;
+       }
+       if (i == ARRAY_SIZE(chip_id_to_device_name)) {
+               lbs_pr_err("Unsupported chip_id: 0x%02x\n", card_id);
+               return -EAFNOSUPPORT;
+       }
+       snprintf(helper_fw, FIRMWARE_NAME_MAX, "libertas/gspi%d_hlp.bin",
+                chip_id_to_device_name[i].name);
+       snprintf(main_fw, FIRMWARE_NAME_MAX, "libertas/gspi%d.bin",
+                chip_id_to_device_name[i].name);
+       return 0;
+}
+
+static int __devinit if_spi_probe(struct spi_device *spi)
+{
+       struct if_spi_card *card;
+       struct lbs_private *priv = NULL;
+       struct libertas_spi_platform_data *pdata = spi->dev.platform_data;
+       int err = 0;
+       u32 scratch;
+
+       lbs_deb_enter(LBS_DEB_SPI);
+
+       if (!pdata) {
+               err = -EINVAL;
+               goto out;
+       }
+
+       if (pdata->setup) {
+               err = pdata->setup(spi);
+               if (err)
+                       goto out;
+       }
+
+       /* Allocate card structure to represent this specific device */
+       card = kzalloc(sizeof(struct if_spi_card), GFP_KERNEL);
+       if (!card) {
+               err = -ENOMEM;
+               goto out;
+       }
+       spi_set_drvdata(spi, card);
+       card->pdata = pdata;
+       card->spi = spi;
+       card->gpio_cs = pdata->gpio_cs;
+       card->prev_xfer_time = jiffies;
+
+       sema_init(&card->spi_ready, 0);
+       sema_init(&card->spi_thread_terminated, 0);
+       INIT_LIST_HEAD(&card->cmd_packet_list);
+       INIT_LIST_HEAD(&card->data_packet_list);
+       spin_lock_init(&card->buffer_lock);
+
+       /* set up GPIO CS line. TODO: use  regular CS line */
+       err = gpio_request(card->gpio_cs, "if_spi_gpio_chip_select");
+       if (err)
+               goto free_card;
+       err = gpio_direction_output(card->gpio_cs, 1);
+       if (err)
+               goto free_gpio;
+
+       /* Initialize the SPI Interface Unit */
+       err = spu_init(card, pdata->use_dummy_writes);
+       if (err)
+               goto free_gpio;
+       err = spu_get_chip_revision(card, &card->card_id, &card->card_rev);
+       if (err)
+               goto free_gpio;
+
+       /* Firmware load */
+       err = spu_read_u32(card, IF_SPI_SCRATCH_4_REG, &scratch);
+       if (err)
+               goto free_gpio;
+       if (scratch == SUCCESSFUL_FW_DOWNLOAD_MAGIC)
+               lbs_deb_spi("Firmware is already loaded for "
+                           "Marvell WLAN 802.11 adapter\n");
+       else {
+               err = if_spi_calculate_fw_names(card->card_id,
+                               card->helper_fw_name, card->main_fw_name);
+               if (err)
+                       goto free_gpio;
+
+               lbs_deb_spi("Initializing FW for Marvell WLAN 802.11 adapter "
+                               "(chip_id = 0x%04x, chip_rev = 0x%02x) "
+                               "attached to SPI bus_num %d, chip_select %d. "
+                               "spi->max_speed_hz=%d\n",
+                               card->card_id, card->card_rev,
+                               spi->master->bus_num, spi->chip_select,
+                               spi->max_speed_hz);
+               err = if_spi_prog_helper_firmware(card);
+               if (err)
+                       goto free_gpio;
+               err = if_spi_prog_main_firmware(card);
+               if (err)
+                       goto free_gpio;
+               lbs_deb_spi("loaded FW for Marvell WLAN 802.11 adapter\n");
+       }
+
+       err = spu_set_interrupt_mode(card, 0, 1);
+       if (err)
+               goto free_gpio;
+
+       /* Register our card with libertas.
+        * This will call alloc_etherdev */
+       priv = lbs_add_card(card, &spi->dev);
+       if (!priv) {
+               err = -ENOMEM;
+               goto free_gpio;
+       }
+       card->priv = priv;
+       priv->card = card;
+       priv->hw_host_to_card = if_spi_host_to_card;
+       priv->fw_ready = 1;
+       priv->ps_supported = 1;
+
+       /* Initialize interrupt handling stuff. */
+       card->run_thread = 1;
+       card->spi_thread = kthread_run(lbs_spi_thread, card, "lbs_spi_thread");
+       if (IS_ERR(card->spi_thread)) {
+               card->run_thread = 0;
+               err = PTR_ERR(card->spi_thread);
+               lbs_pr_err("error creating SPI thread: err=%d\n", err);
+               goto remove_card;
+       }
+       err = request_irq(spi->irq, if_spi_host_interrupt,
+                       IRQF_TRIGGER_FALLING, "libertas_spi", card);
+       if (err) {
+               lbs_pr_err("can't get host irq line-- request_irq failed\n");
+               goto terminate_thread;
+       }
+
+       /* Start the card.
+        * This will call register_netdev, and we'll start
+        * getting interrupts... */
+       err = lbs_start_card(priv);
+       if (err)
+               goto release_irq;
+
+       lbs_deb_spi("Finished initializing WLAN module.\n");
+
+       /* successful exit */
+       goto out;
+
+release_irq:
+       free_irq(spi->irq, card);
+terminate_thread:
+       if_spi_terminate_spi_thread(card);
+remove_card:
+       lbs_remove_card(priv); /* will call free_netdev */
+free_gpio:
+       gpio_free(card->gpio_cs);
+free_card:
+       free_if_spi_card(card);
+out:
+       lbs_deb_leave_args(LBS_DEB_SPI, "err %d\n", err);
+       return err;
+}
+
+static int __devexit libertas_spi_remove(struct spi_device *spi)
+{
+       struct if_spi_card *card = spi_get_drvdata(spi);
+       struct lbs_private *priv = card->priv;
+
+       lbs_deb_spi("libertas_spi_remove\n");
+       lbs_deb_enter(LBS_DEB_SPI);
+       priv->surpriseremoved = 1;
+
+       lbs_stop_card(priv);
+       free_irq(spi->irq, card);
+       if_spi_terminate_spi_thread(card);
+       lbs_remove_card(priv); /* will call free_netdev */
+       gpio_free(card->gpio_cs);
+       if (card->pdata->teardown)
+               card->pdata->teardown(spi);
+       free_if_spi_card(card);
+       lbs_deb_leave(LBS_DEB_SPI);
+       return 0;
+}
+
+static struct spi_driver libertas_spi_driver = {
+       .probe  = if_spi_probe,
+       .remove = __devexit_p(libertas_spi_remove),
+       .driver = {
+               .name   = "libertas_spi",
+               .bus    = &spi_bus_type,
+               .owner  = THIS_MODULE,
+       },
+};
+
+/*
+ * Module functions
+ */
+
+static int __init if_spi_init_module(void)
+{
+       int ret = 0;
+       lbs_deb_enter(LBS_DEB_SPI);
+       printk(KERN_INFO "libertas_spi: Libertas SPI driver\n");
+       ret = spi_register_driver(&libertas_spi_driver);
+       lbs_deb_leave(LBS_DEB_SPI);
+       return ret;
+}
+
+static void __exit if_spi_exit_module(void)
+{
+       lbs_deb_enter(LBS_DEB_SPI);
+       spi_unregister_driver(&libertas_spi_driver);
+       lbs_deb_leave(LBS_DEB_SPI);
+}
+
+module_init(if_spi_init_module);
+module_exit(if_spi_exit_module);
+
+MODULE_DESCRIPTION("Libertas SPI WLAN Driver");
+MODULE_AUTHOR("Andrey Yurovsky <andrey@cozybit.com>, "
+             "Colin McCabe <colin@cozybit.com>");
+MODULE_LICENSE("GPL");
diff --git a/drivers/net/wireless/libertas/if_spi.h b/drivers/net/wireless/libertas/if_spi.h
new file mode 100644 (file)
index 0000000..2103869
--- /dev/null
@@ -0,0 +1,208 @@
+/*
+ *     linux/drivers/net/wireless/libertas/if_spi.c
+ *
+ *     Driver for Marvell SPI WLAN cards.
+ *
+ *     Copyright 2008 Analog Devices Inc.
+ *
+ *     Authors:
+ *     Andrey Yurovsky <andrey@cozybit.com>
+ *     Colin McCabe <colin@cozybit.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+#ifndef _LBS_IF_SPI_H_
+#define _LBS_IF_SPI_H_
+
+#define IPFIELD_ALIGN_OFFSET 2
+#define IF_SPI_CMD_BUF_SIZE 2400
+
+/***************** Firmware *****************/
+struct chip_ident {
+       u16 chip_id;
+       u16 name;
+};
+
+#define MAX_MAIN_FW_LOAD_CRC_ERR 10
+
+/* Chunk size when loading the helper firmware */
+#define HELPER_FW_LOAD_CHUNK_SZ 64
+
+/* Value to write to indicate end of helper firmware dnld */
+#define FIRMWARE_DNLD_OK 0x0000
+
+/* Value to check once the main firmware is downloaded */
+#define SUCCESSFUL_FW_DOWNLOAD_MAGIC 0x88888888
+
+/***************** SPI Interface Unit *****************/
+/* Masks used in SPI register read/write operations */
+#define IF_SPI_READ_OPERATION_MASK 0x0
+#define IF_SPI_WRITE_OPERATION_MASK 0x8000
+
+/* SPI register offsets. 4-byte aligned. */
+#define IF_SPI_DEVICEID_CTRL_REG 0x00  /* DeviceID controller reg */
+#define IF_SPI_IO_READBASE_REG 0x04    /* Read I/O base reg */
+#define IF_SPI_IO_WRITEBASE_REG 0x08   /* Write I/O base reg */
+#define IF_SPI_IO_RDWRPORT_REG 0x0C    /* Read/Write I/O port reg */
+
+#define IF_SPI_CMD_READBASE_REG 0x10   /* Read command base reg */
+#define IF_SPI_CMD_WRITEBASE_REG 0x14  /* Write command base reg */
+#define IF_SPI_CMD_RDWRPORT_REG 0x18   /* Read/Write command port reg */
+
+#define IF_SPI_DATA_READBASE_REG 0x1C  /* Read data base reg */
+#define IF_SPI_DATA_WRITEBASE_REG 0x20 /* Write data base reg */
+#define IF_SPI_DATA_RDWRPORT_REG 0x24  /* Read/Write data port reg */
+
+#define IF_SPI_SCRATCH_1_REG 0x28      /* Scratch reg 1 */
+#define IF_SPI_SCRATCH_2_REG 0x2C      /* Scratch reg 2 */
+#define IF_SPI_SCRATCH_3_REG 0x30      /* Scratch reg 3 */
+#define IF_SPI_SCRATCH_4_REG 0x34      /* Scratch reg 4 */
+
+#define IF_SPI_TX_FRAME_SEQ_NUM_REG 0x38 /* Tx frame sequence number reg */
+#define IF_SPI_TX_FRAME_STATUS_REG 0x3C        /* Tx frame status reg */
+
+#define IF_SPI_HOST_INT_CTRL_REG 0x40  /* Host interrupt controller reg */
+
+#define IF_SPI_CARD_INT_CAUSE_REG 0x44 /* Card interrupt cause reg */
+#define IF_SPI_CARD_INT_STATUS_REG 0x48 /* Card interupt status reg */
+#define IF_SPI_CARD_INT_EVENT_MASK_REG 0x4C /* Card interrupt event mask */
+#define IF_SPI_CARD_INT_STATUS_MASK_REG        0x50 /* Card interrupt status mask */
+
+#define IF_SPI_CARD_INT_RESET_SELECT_REG 0x54 /* Card interrupt reset select */
+
+#define IF_SPI_HOST_INT_CAUSE_REG 0x58 /* Host interrupt cause reg */
+#define IF_SPI_HOST_INT_STATUS_REG 0x5C        /* Host interrupt status reg */
+#define IF_SPI_HOST_INT_EVENT_MASK_REG 0x60 /* Host interrupt event mask */
+#define IF_SPI_HOST_INT_STATUS_MASK_REG        0x64 /* Host interrupt status mask */
+#define IF_SPI_HOST_INT_RESET_SELECT_REG 0x68 /* Host interrupt reset select */
+
+#define IF_SPI_DELAY_READ_REG 0x6C     /* Delay read reg */
+#define IF_SPI_SPU_BUS_MODE_REG 0x70   /* SPU BUS mode reg */
+
+/***************** IF_SPI_DEVICEID_CTRL_REG *****************/
+#define IF_SPI_DEVICEID_CTRL_REG_TO_CARD_ID(dc) ((dc & 0xffff0000)>>16)
+#define IF_SPI_DEVICEID_CTRL_REG_TO_CARD_REV(dc) (dc & 0x000000ff)
+
+/***************** IF_SPI_HOST_INT_CTRL_REG *****************/
+/** Host Interrupt Control bit : Wake up */
+#define IF_SPI_HICT_WAKE_UP                            (1<<0)
+/** Host Interrupt Control bit : WLAN ready */
+#define IF_SPI_HICT_WLAN_READY                         (1<<1)
+/*#define IF_SPI_HICT_FIFO_FIRST_HALF_EMPTY            (1<<2) */
+/*#define IF_SPI_HICT_FIFO_SECOND_HALF_EMPTY           (1<<3) */
+/*#define IF_SPI_HICT_IRQSRC_WLAN                      (1<<4) */
+/** Host Interrupt Control bit : Tx auto download */
+#define IF_SPI_HICT_TX_DOWNLOAD_OVER_AUTO              (1<<5)
+/** Host Interrupt Control bit : Rx auto upload */
+#define IF_SPI_HICT_RX_UPLOAD_OVER_AUTO                        (1<<6)
+/** Host Interrupt Control bit : Command auto download */
+#define IF_SPI_HICT_CMD_DOWNLOAD_OVER_AUTO             (1<<7)
+/** Host Interrupt Control bit : Command auto upload */
+#define IF_SPI_HICT_CMD_UPLOAD_OVER_AUTO               (1<<8)
+
+/***************** IF_SPI_CARD_INT_CAUSE_REG *****************/
+/** Card Interrupt Case bit : Tx download over */
+#define IF_SPI_CIC_TX_DOWNLOAD_OVER                    (1<<0)
+/** Card Interrupt Case bit : Rx upload over */
+#define IF_SPI_CIC_RX_UPLOAD_OVER                      (1<<1)
+/** Card Interrupt Case bit : Command download over */
+#define IF_SPI_CIC_CMD_DOWNLOAD_OVER                   (1<<2)
+/** Card Interrupt Case bit : Host event */
+#define IF_SPI_CIC_HOST_EVENT                          (1<<3)
+/** Card Interrupt Case bit : Command upload over */
+#define IF_SPI_CIC_CMD_UPLOAD_OVER                     (1<<4)
+/** Card Interrupt Case bit : Power down */
+#define IF_SPI_CIC_POWER_DOWN                          (1<<5)
+
+/***************** IF_SPI_CARD_INT_STATUS_REG *****************/
+#define IF_SPI_CIS_TX_DOWNLOAD_OVER                    (1<<0)
+#define IF_SPI_CIS_RX_UPLOAD_OVER                      (1<<1)
+#define IF_SPI_CIS_CMD_DOWNLOAD_OVER                   (1<<2)
+#define IF_SPI_CIS_HOST_EVENT                          (1<<3)
+#define IF_SPI_CIS_CMD_UPLOAD_OVER                     (1<<4)
+#define IF_SPI_CIS_POWER_DOWN                          (1<<5)
+
+/***************** IF_SPI_HOST_INT_CAUSE_REG *****************/
+#define IF_SPI_HICU_TX_DOWNLOAD_RDY                    (1<<0)
+#define IF_SPI_HICU_RX_UPLOAD_RDY                      (1<<1)
+#define IF_SPI_HICU_CMD_DOWNLOAD_RDY                   (1<<2)
+#define IF_SPI_HICU_CARD_EVENT                         (1<<3)
+#define IF_SPI_HICU_CMD_UPLOAD_RDY                     (1<<4)
+#define IF_SPI_HICU_IO_WR_FIFO_OVERFLOW                        (1<<5)
+#define IF_SPI_HICU_IO_RD_FIFO_UNDERFLOW               (1<<6)
+#define IF_SPI_HICU_DATA_WR_FIFO_OVERFLOW              (1<<7)
+#define IF_SPI_HICU_DATA_RD_FIFO_UNDERFLOW             (1<<8)
+#define IF_SPI_HICU_CMD_WR_FIFO_OVERFLOW               (1<<9)
+#define IF_SPI_HICU_CMD_RD_FIFO_UNDERFLOW              (1<<10)
+
+/***************** IF_SPI_HOST_INT_STATUS_REG *****************/
+/** Host Interrupt Status bit : Tx download ready */
+#define IF_SPI_HIST_TX_DOWNLOAD_RDY                    (1<<0)
+/** Host Interrupt Status bit : Rx upload ready */
+#define IF_SPI_HIST_RX_UPLOAD_RDY                      (1<<1)
+/** Host Interrupt Status bit : Command download ready */
+#define IF_SPI_HIST_CMD_DOWNLOAD_RDY                   (1<<2)
+/** Host Interrupt Status bit : Card event */
+#define IF_SPI_HIST_CARD_EVENT                         (1<<3)
+/** Host Interrupt Status bit : Command upload ready */
+#define IF_SPI_HIST_CMD_UPLOAD_RDY                     (1<<4)
+/** Host Interrupt Status bit : I/O write FIFO overflow */
+#define IF_SPI_HIST_IO_WR_FIFO_OVERFLOW                        (1<<5)
+/** Host Interrupt Status bit : I/O read FIFO underflow */
+#define IF_SPI_HIST_IO_RD_FIFO_UNDRFLOW                        (1<<6)
+/** Host Interrupt Status bit : Data write FIFO overflow */
+#define IF_SPI_HIST_DATA_WR_FIFO_OVERFLOW              (1<<7)
+/** Host Interrupt Status bit : Data read FIFO underflow */
+#define IF_SPI_HIST_DATA_RD_FIFO_UNDERFLOW             (1<<8)
+/** Host Interrupt Status bit : Command write FIFO overflow */
+#define IF_SPI_HIST_CMD_WR_FIFO_OVERFLOW               (1<<9)
+/** Host Interrupt Status bit : Command read FIFO underflow */
+#define IF_SPI_HIST_CMD_RD_FIFO_UNDERFLOW              (1<<10)
+
+/***************** IF_SPI_HOST_INT_STATUS_MASK_REG *****************/
+/** Host Interrupt Status Mask bit : Tx download ready */
+#define IF_SPI_HISM_TX_DOWNLOAD_RDY                    (1<<0)
+/** Host Interrupt Status Mask bit : Rx upload ready */
+#define IF_SPI_HISM_RX_UPLOAD_RDY                      (1<<1)
+/** Host Interrupt Status Mask bit : Command download ready */
+#define IF_SPI_HISM_CMD_DOWNLOAD_RDY                   (1<<2)
+/** Host Interrupt Status Mask bit : Card event */
+#define IF_SPI_HISM_CARDEVENT                          (1<<3)
+/** Host Interrupt Status Mask bit : Command upload ready */
+#define IF_SPI_HISM_CMD_UPLOAD_RDY                     (1<<4)
+/** Host Interrupt Status Mask bit : I/O write FIFO overflow */
+#define IF_SPI_HISM_IO_WR_FIFO_OVERFLOW                        (1<<5)
+/** Host Interrupt Status Mask bit : I/O read FIFO underflow */
+#define IF_SPI_HISM_IO_RD_FIFO_UNDERFLOW               (1<<6)
+/** Host Interrupt Status Mask bit : Data write FIFO overflow */
+#define IF_SPI_HISM_DATA_WR_FIFO_OVERFLOW              (1<<7)
+/** Host Interrupt Status Mask bit : Data write FIFO underflow */
+#define IF_SPI_HISM_DATA_RD_FIFO_UNDERFLOW             (1<<8)
+/** Host Interrupt Status Mask bit : Command write FIFO overflow */
+#define IF_SPI_HISM_CMD_WR_FIFO_OVERFLOW               (1<<9)
+/** Host Interrupt Status Mask bit : Command write FIFO underflow */
+#define IF_SPI_HISM_CMD_RD_FIFO_UNDERFLOW              (1<<10)
+
+/***************** IF_SPI_SPU_BUS_MODE_REG *****************/
+/* SCK edge on which the WLAN module outputs data on MISO */
+#define IF_SPI_BUS_MODE_SPI_CLOCK_PHASE_FALLING 0x8
+#define IF_SPI_BUS_MODE_SPI_CLOCK_PHASE_RISING 0x0
+
+/* In a SPU read operation, there is a delay between writing the SPU
+ * register name and getting back data from the WLAN module.
+ * This can be specified in terms of nanoseconds or in terms of dummy
+ * clock cycles which the master must output before receiving a response. */
+#define IF_SPI_BUS_MODE_DELAY_METHOD_DUMMY_CLOCK 0x4
+#define IF_SPI_BUS_MODE_DELAY_METHOD_TIMED 0x0
+
+/* Some different modes of SPI operation */
+#define IF_SPI_BUS_MODE_8_BIT_ADDRESS_16_BIT_DATA 0x00
+#define IF_SPI_BUS_MODE_8_BIT_ADDRESS_32_BIT_DATA 0x01
+#define IF_SPI_BUS_MODE_16_BIT_ADDRESS_16_BIT_DATA 0x02
+#define IF_SPI_BUS_MODE_16_BIT_ADDRESS_32_BIT_DATA 0x03
+
+#endif
index 4e0007d200308d72741d5580eb0396684e636524..8a7eb2778eb680c5f17d5c5ed5b9840745b3825c 100644 (file)
@@ -1006,9 +1006,8 @@ void lbs_resume(struct lbs_private *priv)
 EXPORT_SYMBOL_GPL(lbs_resume);
 
 /**
- *  @brief This function downloads firmware image, gets
- *  HW spec from firmware and set basic parameters to
- *  firmware.
+ * @brief This function gets the HW spec from the firmware and sets
+ *        some basic parameters.
  *
  *  @param priv    A pointer to struct lbs_private structure
  *  @return       0 or -1
index 57f6c12cda2085a902a8fae4e1e950c138f34475..00a57ed78afcf3685ce937413b261b376b3c4db8 100644 (file)
@@ -692,7 +692,7 @@ static int lbs_process_bss(struct bss_descriptor *bss,
                                            bss->wpa_ie_len);
                        } else if (pos[1] >= MARVELL_MESH_IE_LENGTH &&
                                   pos[2] == 0x00 && pos[3] == 0x50 &&
-                                  pos[4] == 0x43 && pos[4] == 0x04) {
+                                  pos[4] == 0x43 && pos[5] == 0x04) {
                                lbs_deb_scan("got mesh IE\n");
                                bss->mesh = 1;
                        } else {
index 3d3914c83b145388c6d2afc6c6c6fc124f8b2469..28790e03dc43ef797a2150d9cbb48a1afdf99a76 100644 (file)
@@ -286,7 +286,7 @@ void lbtf_set_mode(struct lbtf_private *priv, enum lbtf_mode mode)
        lbtf_cmd_async(priv, CMD_802_11_SET_MODE, &cmd.hdr, sizeof(cmd));
 }
 
-void lbtf_set_bssid(struct lbtf_private *priv, bool activate, u8 *bssid)
+void lbtf_set_bssid(struct lbtf_private *priv, bool activate, const u8 *bssid)
 {
        struct cmd_ds_set_bssid cmd;
 
index 8995cd7c29bf4ce1ef15cc95c5e614a43e456f4a..4cc42dd5a005258f10055bcaae3e61617e3bb2e9 100644 (file)
@@ -463,7 +463,7 @@ int lbtf_set_radio_control(struct lbtf_private *priv);
 int lbtf_update_hw_spec(struct lbtf_private *priv);
 int lbtf_cmd_set_mac_multicast_addr(struct lbtf_private *priv);
 void lbtf_set_mode(struct lbtf_private *priv, enum lbtf_mode mode);
-void lbtf_set_bssid(struct lbtf_private *priv, bool activate, u8 *bssid);
+void lbtf_set_bssid(struct lbtf_private *priv, bool activate, const u8 *bssid);
 int lbtf_set_mac_address(struct lbtf_private *priv, uint8_t *mac_addr);
 
 int lbtf_set_channel(struct lbtf_private *priv, u8 channel);
index f83d69e813d3a23cf46c8aefd94833147ab05d9f..fce49ba061d55cb57166b4935ef9de275f7b25cb 100644 (file)
@@ -779,6 +779,8 @@ static int __init init_mac80211_hwsim(void)
                        BIT(NL80211_IFTYPE_MESH_POINT);
                hw->ampdu_queues = 1;
 
+               hw->flags = IEEE80211_HW_MFP_CAPABLE;
+
                /* ask mac80211 to reserve space for magic */
                hw->vif_data_size = sizeof(struct hwsim_vif_priv);
                hw->sta_data_size = sizeof(struct hwsim_sta_priv);
diff --git a/drivers/net/wireless/orinoco/Kconfig b/drivers/net/wireless/orinoco/Kconfig
new file mode 100644 (file)
index 0000000..44411eb
--- /dev/null
@@ -0,0 +1,120 @@
+config HERMES
+       tristate "Hermes chipset 802.11b support (Orinoco/Prism2/Symbol)"
+       depends on (PPC_PMAC || PCI || PCMCIA) && WLAN_80211
+       select WIRELESS_EXT
+       select FW_LOADER
+       select CRYPTO
+       select CRYPTO_MICHAEL_MIC
+       ---help---
+         A driver for 802.11b wireless cards based on the "Hermes" or
+         Intersil HFA384x (Prism 2) MAC controller.  This includes the vast
+         majority of the PCMCIA 802.11b cards (which are nearly all rebadges)
+         - except for the Cisco/Aironet cards.  Cards supported include the
+         Apple Airport (not a PCMCIA card), WavelanIEEE/Orinoco,
+         Cabletron/EnteraSys Roamabout, ELSA AirLancer, MELCO Buffalo, Avaya,
+         IBM High Rate Wireless, Farralon Syyline, Samsung MagicLAN, Netgear
+         MA401, LinkSys WPC-11, D-Link DWL-650, 3Com AirConnect, Intel
+         IPW2011, and Symbol Spectrum24 High Rate amongst others.
+
+         This option includes the guts of the driver, but in order to
+         actually use a card you will also need to enable support for PCMCIA
+         Hermes cards, PLX9052 based PCI adaptors or the Apple Airport below.
+
+         You will also very likely also need the Wireless Tools in order to
+         configure your card and that /etc/pcmcia/wireless.opts works :
+         <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>
+
+config HERMES_CACHE_FW_ON_INIT
+       bool "Cache Hermes firmware on driver initialisation"
+       depends on HERMES
+       default y
+       ---help---
+         Say Y to cache any firmware required by the Hermes drivers
+         on startup.  The firmware will remain cached until the
+         driver is unloaded.  The cache uses 64K of RAM.
+
+         Otherwise load the firmware from userspace as required.  In
+         this case the driver should be unloaded and restarted
+         whenever the firmware is changed.
+
+         If you are not sure, say Y.
+
+config APPLE_AIRPORT
+       tristate "Apple Airport support (built-in)"
+       depends on PPC_PMAC && HERMES
+       help
+         Say Y here to support the Airport 802.11b wireless Ethernet hardware
+         built into the Macintosh iBook and other recent PowerPC-based
+         Macintosh machines. This is essentially a Lucent Orinoco card with
+         a non-standard interface.
+
+         This driver does not support the Airport Extreme (802.11b/g). Use
+         the BCM43xx driver for Airport Extreme cards.
+
+config PLX_HERMES
+       tristate "Hermes in PLX9052 based PCI adaptor support (Netgear MA301 etc.)"
+       depends on PCI && HERMES
+       help
+         Enable support for PCMCIA cards supported by the "Hermes" (aka
+         orinoco) driver when used in PLX9052 based PCI adaptors.  These
+         adaptors are not a full PCMCIA controller but act as a more limited
+         PCI <-> PCMCIA bridge.  Several vendors sell such adaptors so that
+         802.11b PCMCIA cards can be used in desktop machines.  The Netgear
+         MA301 is such an adaptor.
+
+config TMD_HERMES
+       tristate "Hermes in TMD7160 based PCI adaptor support"
+       depends on PCI && HERMES
+       help
+         Enable support for PCMCIA cards supported by the "Hermes" (aka
+         orinoco) driver when used in TMD7160 based PCI adaptors.  These
+         adaptors are not a full PCMCIA controller but act as a more limited
+         PCI <-> PCMCIA bridge.  Several vendors sell such adaptors so that
+         802.11b PCMCIA cards can be used in desktop machines.
+
+config NORTEL_HERMES
+       tristate "Nortel emobility PCI adaptor support"
+       depends on PCI && HERMES
+       help
+         Enable support for PCMCIA cards supported by the "Hermes" (aka
+         orinoco) driver when used in Nortel emobility PCI adaptors.  These
+         adaptors are not full PCMCIA controllers, but act as a more limited
+         PCI <-> PCMCIA bridge.
+
+config PCI_HERMES
+       tristate "Prism 2.5 PCI 802.11b adaptor support"
+       depends on PCI && HERMES
+       help
+         Enable support for PCI and mini-PCI 802.11b wireless NICs based on
+         the Prism 2.5 chipset.  These are true PCI cards, not the 802.11b
+         PCMCIA cards bundled with PCI<->PCMCIA adaptors which are also
+         common.  Some of the built-in wireless adaptors in laptops are of
+         this variety.
+
+config PCMCIA_HERMES
+       tristate "Hermes PCMCIA card support"
+       depends on PCMCIA && HERMES
+       ---help---
+         A driver for "Hermes" chipset based PCMCIA wireless adaptors, such
+         as the Lucent WavelanIEEE/Orinoco cards and their OEM (Cabletron/
+         EnteraSys RoamAbout 802.11, ELSA Airlancer, Melco Buffalo and
+         others).  It should also be usable on various Prism II based cards
+         such as the Linksys, D-Link and Farallon Skyline.  It should also
+         work on Symbol cards such as the 3Com AirConnect and Ericsson WLAN.
+
+         You will very likely need the Wireless Tools in order to
+         configure your card and that /etc/pcmcia/wireless.opts works:
+         <http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/Tools.html>.
+
+config PCMCIA_SPECTRUM
+       tristate "Symbol Spectrum24 Trilogy PCMCIA card support"
+       depends on PCMCIA && HERMES
+       ---help---
+
+         This is a driver for 802.11b cards using RAM-loadable Symbol
+         firmware, such as Symbol Wireless Networker LA4100, CompactFlash
+         cards by Socket Communications and Intel PRO/Wireless 2011B.
+
+         This driver requires firmware download on startup.  Utilities
+         for downloading Symbol firmware are available at
+         <http://sourceforge.net/projects/orinoco/>
index 791366e08c501dac79c1becf88e056d8afa5c7df..1fc7409d66991f2e1e71e5b968b2d644f79dbcc4 100644 (file)
@@ -1,8 +1,9 @@
 #
 # Makefile for the orinoco wireless device drivers.
 #
+orinoco-objs := main.o fw.o hw.o mic.o scan.o wext.o hermes_dld.o hermes.o
 
-obj-$(CONFIG_HERMES)           += orinoco.o hermes.o hermes_dld.o
+obj-$(CONFIG_HERMES)           += orinoco.o
 obj-$(CONFIG_PCMCIA_HERMES)    += orinoco_cs.o
 obj-$(CONFIG_APPLE_AIRPORT)    += airport.o
 obj-$(CONFIG_PLX_HERMES)       += orinoco_plx.o
index 28f1cae48439ec787b13fdd424c2e4f065455fd1..8c4065f1b0d0a01f84516179adb3b887601af272 100644 (file)
@@ -3,10 +3,10 @@
  * A driver for "Hermes" chipset based Apple Airport wireless
  * card.
  *
- * Copyright notice & release notes in file orinoco.c
- * 
+ * Copyright notice & release notes in file main.c
+ *
  * Note specific to airport stub:
- * 
+ *
  *  0.05 : first version of the new split driver
  *  0.06 : fix possible hang on powerup, add sleep support
  */
@@ -60,7 +60,8 @@ airport_suspend(struct macio_dev *mdev, pm_message_t state)
        orinoco_unlock(priv, &flags);
 
        disable_irq(dev->irq);
-       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 0);
+       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
+                         macio_get_of_node(mdev), 0, 0);
 
        return 0;
 }
@@ -75,7 +76,8 @@ airport_resume(struct macio_dev *mdev)
 
        printk(KERN_DEBUG "%s: Airport waking up\n", dev->name);
 
-       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1);
+       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
+                         macio_get_of_node(mdev), 0, 1);
        msleep(200);
 
        enable_irq(dev->irq);
@@ -93,7 +95,7 @@ airport_resume(struct macio_dev *mdev)
 
        priv->hw_unavailable--;
 
-       if (priv->open && (! priv->hw_unavailable)) {
+       if (priv->open && (!priv->hw_unavailable)) {
                err = __orinoco_up(dev);
                if (err)
                        printk(KERN_ERR "%s: Error %d restarting card on PBOOK_WAKE\n",
@@ -127,7 +129,8 @@ airport_detach(struct macio_dev *mdev)
 
        macio_release_resource(mdev, 0);
 
-       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 0);
+       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
+                         macio_get_of_node(mdev), 0, 0);
        ssleep(1);
 
        macio_set_drvdata(mdev, NULL);
@@ -153,9 +156,11 @@ static int airport_hard_reset(struct orinoco_private *priv)
         * off. */
        disable_irq(dev->irq);
 
-       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(card->mdev), 0, 0);
+       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
+                         macio_get_of_node(card->mdev), 0, 0);
        ssleep(1);
-       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(card->mdev), 0, 1);
+       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
+                         macio_get_of_node(card->mdev), 0, 1);
        ssleep(1);
 
        enable_irq(dev->irq);
@@ -182,7 +187,7 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
        /* Allocate space for private device-specific data */
        dev = alloc_orinocodev(sizeof(*card), &mdev->ofdev.dev,
                               airport_hard_reset, NULL);
-       if (! dev) {
+       if (!dev) {
                printk(KERN_ERR PFX "Cannot allocate network device\n");
                return -ENODEV;
        }
@@ -214,9 +219,10 @@ airport_attach(struct macio_dev *mdev, const struct of_device_id *match)
        }
 
        hermes_struct_init(hw, card->vaddr, HERMES_16BIT_REGSPACING);
-               
+
        /* Power up card */
-       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE, macio_get_of_node(mdev), 0, 1);
+       pmac_call_feature(PMAC_FTR_AIRPORT_ENABLE,
+                         macio_get_of_node(mdev), 0, 1);
        ssleep(1);
 
        /* Reset it before we get the interrupt */
@@ -248,7 +254,7 @@ MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
 MODULE_DESCRIPTION("Driver for the Apple Airport wireless card.");
 MODULE_LICENSE("Dual MPL/GPL");
 
-static struct of_device_id airport_match[] = 
+static struct of_device_id airport_match[] =
 {
        {
        .name           = "radio",
@@ -256,10 +262,9 @@ static struct of_device_id airport_match[] =
        {},
 };
 
-MODULE_DEVICE_TABLE (of, airport_match);
+MODULE_DEVICE_TABLE(of, airport_match);
 
-static struct macio_driver airport_driver = 
-{
+static struct macio_driver airport_driver = {
        .name           = DRIVER_NAME,
        .match_table    = airport_match,
        .probe          = airport_attach,
diff --git a/drivers/net/wireless/orinoco/fw.c b/drivers/net/wireless/orinoco/fw.c
new file mode 100644 (file)
index 0000000..7d2292d
--- /dev/null
@@ -0,0 +1,340 @@
+/* Firmware file reading and download helpers
+ *
+ * See copyright notice in main.c
+ */
+#include <linux/kernel.h>
+#include <linux/firmware.h>
+
+#include "hermes.h"
+#include "hermes_dld.h"
+#include "orinoco.h"
+
+#include "fw.h"
+
+/* End markers (for Symbol firmware only) */
+#define TEXT_END       0x1A            /* End of text header */
+
+struct fw_info {
+       char *pri_fw;
+       char *sta_fw;
+       char *ap_fw;
+       u32 pda_addr;
+       u16 pda_size;
+};
+
+static const struct fw_info orinoco_fw[] = {
+       { NULL, "agere_sta_fw.bin", "agere_ap_fw.bin", 0x00390000, 1000 },
+       { NULL, "prism_sta_fw.bin", "prism_ap_fw.bin", 0, 1024 },
+       { "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", NULL, 0x00003100, 512 }
+};
+
+/* Structure used to access fields in FW
+ * Make sure LE decoding macros are used
+ */
+struct orinoco_fw_header {
+       char hdr_vers[6];       /* ASCII string for header version */
+       __le16 headersize;      /* Total length of header */
+       __le32 entry_point;     /* NIC entry point */
+       __le32 blocks;          /* Number of blocks to program */
+       __le32 block_offset;    /* Offset of block data from eof header */
+       __le32 pdr_offset;      /* Offset to PDR data from eof header */
+       __le32 pri_offset;      /* Offset to primary plug data */
+       __le32 compat_offset;   /* Offset to compatibility data*/
+       char signature[0];      /* FW signature length headersize-20 */
+} __attribute__ ((packed));
+
+/* Download either STA or AP firmware into the card. */
+static int
+orinoco_dl_firmware(struct orinoco_private *priv,
+                   const struct fw_info *fw,
+                   int ap)
+{
+       /* Plug Data Area (PDA) */
+       __le16 *pda;
+
+       hermes_t *hw = &priv->hw;
+       const struct firmware *fw_entry;
+       const struct orinoco_fw_header *hdr;
+       const unsigned char *first_block;
+       const unsigned char *end;
+       const char *firmware;
+       struct net_device *dev = priv->ndev;
+       int err = 0;
+
+       pda = kzalloc(fw->pda_size, GFP_KERNEL);
+       if (!pda)
+               return -ENOMEM;
+
+       if (ap)
+               firmware = fw->ap_fw;
+       else
+               firmware = fw->sta_fw;
+
+       printk(KERN_DEBUG "%s: Attempting to download firmware %s\n",
+              dev->name, firmware);
+
+       /* Read current plug data */
+       err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0);
+       printk(KERN_DEBUG "%s: Read PDA returned %d\n", dev->name, err);
+       if (err)
+               goto free;
+
+       if (!priv->cached_fw) {
+               err = request_firmware(&fw_entry, firmware, priv->dev);
+
+               if (err) {
+                       printk(KERN_ERR "%s: Cannot find firmware %s\n",
+                              dev->name, firmware);
+                       err = -ENOENT;
+                       goto free;
+               }
+       } else
+               fw_entry = priv->cached_fw;
+
+       hdr = (const struct orinoco_fw_header *) fw_entry->data;
+
+       /* Enable aux port to allow programming */
+       err = hermesi_program_init(hw, le32_to_cpu(hdr->entry_point));
+       printk(KERN_DEBUG "%s: Program init returned %d\n", dev->name, err);
+       if (err != 0)
+               goto abort;
+
+       /* Program data */
+       first_block = (fw_entry->data +
+                      le16_to_cpu(hdr->headersize) +
+                      le32_to_cpu(hdr->block_offset));
+       end = fw_entry->data + fw_entry->size;
+
+       err = hermes_program(hw, first_block, end);
+       printk(KERN_DEBUG "%s: Program returned %d\n", dev->name, err);
+       if (err != 0)
+               goto abort;
+
+       /* Update production data */
+       first_block = (fw_entry->data +
+                      le16_to_cpu(hdr->headersize) +
+                      le32_to_cpu(hdr->pdr_offset));
+
+       err = hermes_apply_pda_with_defaults(hw, first_block, pda);
+       printk(KERN_DEBUG "%s: Apply PDA returned %d\n", dev->name, err);
+       if (err)
+               goto abort;
+
+       /* Tell card we've finished */
+       err = hermesi_program_end(hw);
+       printk(KERN_DEBUG "%s: Program end returned %d\n", dev->name, err);
+       if (err != 0)
+               goto abort;
+
+       /* Check if we're running */
+       printk(KERN_DEBUG "%s: hermes_present returned %d\n",
+              dev->name, hermes_present(hw));
+
+abort:
+       /* If we requested the firmware, release it. */
+       if (!priv->cached_fw)
+               release_firmware(fw_entry);
+
+free:
+       kfree(pda);
+       return err;
+}
+
+/*
+ * Process a firmware image - stop the card, load the firmware, reset
+ * the card and make sure it responds.  For the secondary firmware take
+ * care of the PDA - read it and then write it on top of the firmware.
+ */
+static int
+symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
+               const unsigned char *image, const unsigned char *end,
+               int secondary)
+{
+       hermes_t *hw = &priv->hw;
+       int ret = 0;
+       const unsigned char *ptr;
+       const unsigned char *first_block;
+
+       /* Plug Data Area (PDA) */
+       __le16 *pda = NULL;
+
+       /* Binary block begins after the 0x1A marker */
+       ptr = image;
+       while (*ptr++ != TEXT_END);
+       first_block = ptr;
+
+       /* Read the PDA from EEPROM */
+       if (secondary) {
+               pda = kzalloc(fw->pda_size, GFP_KERNEL);
+               if (!pda)
+                       return -ENOMEM;
+
+               ret = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 1);
+               if (ret)
+                       goto free;
+       }
+
+       /* Stop the firmware, so that it can be safely rewritten */
+       if (priv->stop_fw) {
+               ret = priv->stop_fw(priv, 1);
+               if (ret)
+                       goto free;
+       }
+
+       /* Program the adapter with new firmware */
+       ret = hermes_program(hw, first_block, end);
+       if (ret)
+               goto free;
+
+       /* Write the PDA to the adapter */
+       if (secondary) {
+               size_t len = hermes_blocks_length(first_block);
+               ptr = first_block + len;
+               ret = hermes_apply_pda(hw, ptr, pda);
+               kfree(pda);
+               if (ret)
+                       return ret;
+       }
+
+       /* Run the firmware */
+       if (priv->stop_fw) {
+               ret = priv->stop_fw(priv, 0);
+               if (ret)
+                       return ret;
+       }
+
+       /* Reset hermes chip and make sure it responds */
+       ret = hermes_init(hw);
+
+       /* hermes_reset() should return 0 with the secondary firmware */
+       if (secondary && ret != 0)
+               return -ENODEV;
+
+       /* And this should work with any firmware */
+       if (!hermes_present(hw))
+               return -ENODEV;
+
+       return 0;
+
+free:
+       kfree(pda);
+       return ret;
+}
+
+
+/*
+ * Download the firmware into the card, this also does a PCMCIA soft
+ * reset on the card, to make sure it's in a sane state.
+ */
+static int
+symbol_dl_firmware(struct orinoco_private *priv,
+                  const struct fw_info *fw)
+{
+       struct net_device *dev = priv->ndev;
+       int ret;
+       const struct firmware *fw_entry;
+
+       if (!priv->cached_pri_fw) {
+               if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) {
+                       printk(KERN_ERR "%s: Cannot find firmware: %s\n",
+                              dev->name, fw->pri_fw);
+                       return -ENOENT;
+               }
+       } else
+               fw_entry = priv->cached_pri_fw;
+
+       /* Load primary firmware */
+       ret = symbol_dl_image(priv, fw, fw_entry->data,
+                             fw_entry->data + fw_entry->size, 0);
+
+       if (!priv->cached_pri_fw)
+               release_firmware(fw_entry);
+       if (ret) {
+               printk(KERN_ERR "%s: Primary firmware download failed\n",
+                      dev->name);
+               return ret;
+       }
+
+       if (!priv->cached_fw) {
+               if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) {
+                       printk(KERN_ERR "%s: Cannot find firmware: %s\n",
+                              dev->name, fw->sta_fw);
+                       return -ENOENT;
+               }
+       } else
+               fw_entry = priv->cached_fw;
+
+       /* Load secondary firmware */
+       ret = symbol_dl_image(priv, fw, fw_entry->data,
+                             fw_entry->data + fw_entry->size, 1);
+       if (!priv->cached_fw)
+               release_firmware(fw_entry);
+       if (ret) {
+               printk(KERN_ERR "%s: Secondary firmware download failed\n",
+                      dev->name);
+       }
+
+       return ret;
+}
+
+int orinoco_download(struct orinoco_private *priv)
+{
+       int err = 0;
+       /* Reload firmware */
+       switch (priv->firmware_type) {
+       case FIRMWARE_TYPE_AGERE:
+               /* case FIRMWARE_TYPE_INTERSIL: */
+               err = orinoco_dl_firmware(priv,
+                                         &orinoco_fw[priv->firmware_type], 0);
+               break;
+
+       case FIRMWARE_TYPE_SYMBOL:
+               err = symbol_dl_firmware(priv,
+                                        &orinoco_fw[priv->firmware_type]);
+               break;
+       case FIRMWARE_TYPE_INTERSIL:
+               break;
+       }
+       /* TODO: if we fail we probably need to reinitialise
+        * the driver */
+
+       return err;
+}
+
+void orinoco_cache_fw(struct orinoco_private *priv, int ap)
+{
+#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
+       const struct firmware *fw_entry = NULL;
+       const char *pri_fw;
+       const char *fw;
+
+       pri_fw = orinoco_fw[priv->firmware_type].pri_fw;
+       if (ap)
+               fw = orinoco_fw[priv->firmware_type].ap_fw;
+       else
+               fw = orinoco_fw[priv->firmware_type].sta_fw;
+
+       if (pri_fw) {
+               if (request_firmware(&fw_entry, pri_fw, priv->dev) == 0)
+                       priv->cached_pri_fw = fw_entry;
+       }
+
+       if (fw) {
+               if (request_firmware(&fw_entry, fw, priv->dev) == 0)
+                       priv->cached_fw = fw_entry;
+       }
+#endif
+}
+
+void orinoco_uncache_fw(struct orinoco_private *priv)
+{
+#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
+       if (priv->cached_pri_fw)
+               release_firmware(priv->cached_pri_fw);
+       if (priv->cached_fw)
+               release_firmware(priv->cached_fw);
+
+       priv->cached_pri_fw = NULL;
+       priv->cached_fw = NULL;
+#endif
+}
diff --git a/drivers/net/wireless/orinoco/fw.h b/drivers/net/wireless/orinoco/fw.h
new file mode 100644 (file)
index 0000000..2290f08
--- /dev/null
@@ -0,0 +1,16 @@
+/* Firmware file reading and download helpers
+ *
+ * See copyright notice in main.c
+ */
+#ifndef _ORINOCO_FW_H_
+#define _ORINOCO_FW_H_
+
+/* Forward declations */
+struct orinoco_private;
+
+int orinoco_download(struct orinoco_private *priv);
+
+void orinoco_cache_fw(struct orinoco_private *priv, int ap);
+void orinoco_uncache_fw(struct orinoco_private *priv);
+
+#endif /* _ORINOCO_FW_H_ */
index bfa375369df3fc517cd639c2db190b7518b9d782..f2c918c2572da5a21ab3ae7e8d4620b723aa4577 100644 (file)
@@ -15,7 +15,7 @@
  *
  * Copyright (C) 2000, David Gibson, Linuxcare Australia.
  * (C) Copyright David Gibson, IBM Corp. 2001-2003.
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License
  * Version 1.1 (the "License"); you may not use this file except in
  * compliance with the License. You may obtain a copy of the License
 
 #include "hermes.h"
 
-MODULE_DESCRIPTION("Low-level driver helper for Lucent Hermes chipset and Prism II HFA384x wireless MAC controller");
-MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>"
-       " & David Gibson <hermes@gibson.dropbear.id.au>");
-MODULE_LICENSE("Dual MPL/GPL");
-
 /* These are maximum timeouts. Most often, card wil react much faster */
 #define CMD_BUSY_TIMEOUT (100) /* In iterations of ~1us */
 #define CMD_INIT_TIMEOUT (50000) /* in iterations of ~10us */
@@ -61,13 +56,13 @@ MODULE_LICENSE("Dual MPL/GPL");
  */
 
 #define DMSG(stuff...) do {printk(KERN_DEBUG "hermes @ %p: " , hw->iobase); \
-                       printk(stuff);} while (0)
+                       printk(stuff); } while (0)
 
 #undef HERMES_DEBUG
 #ifdef HERMES_DEBUG
 #include <stdarg.h>
 
-#define DEBUG(lvl, stuff...) if ( (lvl) <= HERMES_DEBUG) DMSG(stuff)
+#define DEBUG(lvl, stuff...) if ((lvl) <= HERMES_DEBUG) DMSG(stuff)
 
 #else /* ! HERMES_DEBUG */
 
@@ -95,20 +90,19 @@ static int hermes_issue_cmd(hermes_t *hw, u16 cmd, u16 param0,
 
        /* First wait for the command register to unbusy */
        reg = hermes_read_regn(hw, CMD);
-       while ( (reg & HERMES_CMD_BUSY) && k ) {
+       while ((reg & HERMES_CMD_BUSY) && k) {
                k--;
                udelay(1);
                reg = hermes_read_regn(hw, CMD);
        }
-       if (reg & HERMES_CMD_BUSY) {
+       if (reg & HERMES_CMD_BUSY)
                return -EBUSY;
-       }
 
        hermes_write_regn(hw, PARAM2, param2);
        hermes_write_regn(hw, PARAM1, param1);
        hermes_write_regn(hw, PARAM0, param0);
        hermes_write_regn(hw, CMD, cmd);
-       
+
        return 0;
 }
 
@@ -191,23 +185,23 @@ int hermes_init(hermes_t *hw)
        hermes_write_regn(hw, EVACK, 0xffff);
 
        /* Normally it's a "can't happen" for the command register to
-           be busy when we go to issue a command because we are
-           serializing all commands.  However we want to have some
-           chance of resetting the card even if it gets into a stupid
-           state, so we actually wait to see if the command register
-           will unbusy itself here. */
+          be busy when we go to issue a command because we are
+          serializing all commands.  However we want to have some
+          chance of resetting the card even if it gets into a stupid
+          state, so we actually wait to see if the command register
+          will unbusy itself here. */
        k = CMD_BUSY_TIMEOUT;
        reg = hermes_read_regn(hw, CMD);
        while (k && (reg & HERMES_CMD_BUSY)) {
-               if (reg == 0xffff) /* Special case - the card has probably been removed,
-                                     so don't wait for the timeout */
+               if (reg == 0xffff) /* Special case - the card has probably been
+                                     removed, so don't wait for the timeout */
                        return -ENODEV;
 
                k--;
                udelay(1);
                reg = hermes_read_regn(hw, CMD);
        }
-       
+
        /* No need to explicitly handle the timeout - if we've timed
           out hermes_issue_cmd() will probably return -EBUSY below */
 
@@ -228,7 +222,10 @@ EXPORT_SYMBOL(hermes_init);
 /* Issue a command to the chip, and (busy!) wait for it to
  * complete.
  *
- * Returns: < 0 on internal error, 0 on success, > 0 on error returned by the firmware
+ * Returns:
+ *     < 0 on internal error
+ *       0 on success
+ *     > 0 on error returned by the firmware
  *
  * Callable from any context, but locking is your problem. */
 int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
@@ -241,13 +238,13 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
 
        err = hermes_issue_cmd(hw, cmd, parm0, 0, 0);
        if (err) {
-               if (! hermes_present(hw)) {
+               if (!hermes_present(hw)) {
                        if (net_ratelimit())
                                printk(KERN_WARNING "hermes @ %p: "
                                       "Card removed while issuing command "
                                       "0x%04x.\n", hw->iobase, cmd);
                        err = -ENODEV;
-               } else 
+               } else
                        if (net_ratelimit())
                                printk(KERN_ERR "hermes @ %p: "
                                       "Error %d issuing command 0x%04x.\n",
@@ -257,21 +254,21 @@ int hermes_docmd_wait(hermes_t *hw, u16 cmd, u16 parm0,
 
        reg = hermes_read_regn(hw, EVSTAT);
        k = CMD_COMPL_TIMEOUT;
-       while ( (! (reg & HERMES_EV_CMD)) && k) {
+       while ((!(reg & HERMES_EV_CMD)) && k) {
                k--;
                udelay(10);
                reg = hermes_read_regn(hw, EVSTAT);
        }
 
-       if (! hermes_present(hw)) {
+       if (!hermes_present(hw)) {
                printk(KERN_WARNING "hermes @ %p: Card removed "
                       "while waiting for command 0x%04x completion.\n",
                       hw->iobase, cmd);
                err = -ENODEV;
                goto out;
        }
-               
-       if (! (reg & HERMES_EV_CMD)) {
+
+       if (!(reg & HERMES_EV_CMD)) {
                printk(KERN_ERR "hermes @ %p: Timeout waiting for "
                       "command 0x%04x completion.\n", hw->iobase, cmd);
                err = -ETIMEDOUT;
@@ -301,31 +298,30 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
        int err = 0;
        int k;
        u16 reg;
-       
-       if ( (size < HERMES_ALLOC_LEN_MIN) || (size > HERMES_ALLOC_LEN_MAX) )
+
+       if ((size < HERMES_ALLOC_LEN_MIN) || (size > HERMES_ALLOC_LEN_MAX))
                return -EINVAL;
 
        err = hermes_docmd_wait(hw, HERMES_CMD_ALLOC, size, NULL);
-       if (err) {
+       if (err)
                return err;
-       }
 
        reg = hermes_read_regn(hw, EVSTAT);
        k = ALLOC_COMPL_TIMEOUT;
-       while ( (! (reg & HERMES_EV_ALLOC)) && k) {
+       while ((!(reg & HERMES_EV_ALLOC)) && k) {
                k--;
                udelay(10);
                reg = hermes_read_regn(hw, EVSTAT);
        }
-       
-       if (! hermes_present(hw)) {
+
+       if (!hermes_present(hw)) {
                printk(KERN_WARNING "hermes @ %p: "
                       "Card removed waiting for frame allocation.\n",
                       hw->iobase);
                return -ENODEV;
        }
-               
-       if (! (reg & HERMES_EV_ALLOC)) {
+
+       if (!(reg & HERMES_EV_ALLOC)) {
                printk(KERN_ERR "hermes @ %p: "
                       "Timeout waiting for frame allocation\n",
                       hw->iobase);
@@ -334,14 +330,17 @@ int hermes_allocate(hermes_t *hw, u16 size, u16 *fid)
 
        *fid = hermes_read_regn(hw, ALLOCFID);
        hermes_write_regn(hw, EVACK, HERMES_EV_ALLOC);
-       
+
        return 0;
 }
 EXPORT_SYMBOL(hermes_allocate);
 
 /* Set up a BAP to read a particular chunk of data from card's internal buffer.
  *
- * Returns: < 0 on internal failure (errno), 0 on success, >0 on error
+ * Returns:
+ *     < 0 on internal failure (errno)
+ *       0 on success
+ *     > 0 on error
  * from firmware
  *
  * Callable from any context */
@@ -353,7 +352,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
        u16 reg;
 
        /* Paranoia.. */
-       if ( (offset > HERMES_BAP_OFFSET_MAX) || (offset % 2) )
+       if ((offset > HERMES_BAP_OFFSET_MAX) || (offset % 2))
                return -EINVAL;
 
        k = HERMES_BAP_BUSY_TIMEOUT;
@@ -374,7 +373,7 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
        /* Wait for the BAP to be ready */
        k = HERMES_BAP_BUSY_TIMEOUT;
        reg = hermes_read_reg(hw, oreg);
-       while ( (reg & (HERMES_OFFSET_BUSY | HERMES_OFFSET_ERR)) && k) {
+       while ((reg & (HERMES_OFFSET_BUSY | HERMES_OFFSET_ERR)) && k) {
                k--;
                udelay(1);
                reg = hermes_read_reg(hw, oreg);
@@ -386,9 +385,8 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
                       (reg & HERMES_OFFSET_BUSY) ? "timeout" : "error",
                       reg, id, offset);
 
-               if (reg & HERMES_OFFSET_BUSY) {
+               if (reg & HERMES_OFFSET_BUSY)
                        return -ETIMEDOUT;
-               }
 
                return -EIO;            /* error or wrong offset */
        }
@@ -400,7 +398,10 @@ static int hermes_bap_seek(hermes_t *hw, int bap, u16 id, u16 offset)
  * BAP. Synchronization/serialization is the caller's problem.  len
  * must be even.
  *
- * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware
+ * Returns:
+ *     < 0 on internal failure (errno)
+ *       0 on success
+ *     > 0 on error from firmware
  */
 int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
                     u16 id, u16 offset)
@@ -408,7 +409,7 @@ int hermes_bap_pread(hermes_t *hw, int bap, void *buf, int len,
        int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
        int err = 0;
 
-       if ( (len < 0) || (len % 2) )
+       if ((len < 0) || (len % 2))
                return -EINVAL;
 
        err = hermes_bap_seek(hw, bap, id, offset);
@@ -426,7 +427,10 @@ EXPORT_SYMBOL(hermes_bap_pread);
 /* Write a block of data to the chip's buffer, via the
  * BAP. Synchronization/serialization is the caller's problem.
  *
- * Returns: < 0 on internal failure (errno), 0 on success, > 0 on error from firmware
+ * Returns:
+ *     < 0 on internal failure (errno)
+ *       0 on success
+ *     > 0 on error from firmware
  */
 int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
                      u16 id, u16 offset)
@@ -440,11 +444,11 @@ int hermes_bap_pwrite(hermes_t *hw, int bap, const void *buf, int len,
        err = hermes_bap_seek(hw, bap, id, offset);
        if (err)
                goto out;
-       
+
        /* Actually do the transfer */
        hermes_write_bytes(hw, dreg, buf, len);
 
- out:  
+ out:
        return err;
 }
 EXPORT_SYMBOL(hermes_bap_pwrite);
@@ -465,7 +469,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
        u16 rlength, rtype;
        unsigned nwords;
 
-       if ( (bufsize < 0) || (bufsize % 2) )
+       if ((bufsize < 0) || (bufsize % 2))
                return -EINVAL;
 
        err = hermes_docmd_wait(hw, HERMES_CMD_ACCESS, rid, NULL);
@@ -478,7 +482,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
 
        rlength = hermes_read_reg(hw, dreg);
 
-       if (! rlength)
+       if (!rlength)
                return -ENODATA;
 
        rtype = hermes_read_reg(hw, dreg);
@@ -503,7 +507,7 @@ int hermes_read_ltv(hermes_t *hw, int bap, u16 rid, unsigned bufsize,
 }
 EXPORT_SYMBOL(hermes_read_ltv);
 
-int hermes_write_ltv(hermes_t *hw, int bap, u16 rid, 
+int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
                     u16 length, const void *value)
 {
        int dreg = bap ? HERMES_DATA1 : HERMES_DATA0;
@@ -530,15 +534,3 @@ int hermes_write_ltv(hermes_t *hw, int bap, u16 rid,
        return err;
 }
 EXPORT_SYMBOL(hermes_write_ltv);
-
-static int __init init_hermes(void)
-{
-       return 0;
-}
-
-static void __exit exit_hermes(void)
-{
-}
-
-module_init(init_hermes);
-module_exit(exit_hermes);
index 8b13c8fef3dcf49f4ebfe976362ca173c9a5edf6..c78c442a02c885d87537c2b166945bfb6269c1e3 100644 (file)
@@ -15,7 +15,8 @@
  * Copyright (C) 2000, David Gibson, Linuxcare Australia.
  * (C) Copyright David Gibson, IBM Corp. 2001-2003.
  *
- * Portions taken from hfa384x.h, Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
+ * Portions taken from hfa384x.h.
+ * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
  *
  * This file distributed under the GPL, version 2.
  */
@@ -31,7 +32,7 @@
 */
 
 #include <linux/if_ether.h>
-#include <asm/io.h>
+#include <linux/io.h>
 
 /*
  * Limits and constants
@@ -203,7 +204,7 @@ struct hermes_tx_descriptor {
        __le32 sw_support;
        u8 retry_count;
        u8 tx_rate;
-       __le16 tx_control;      
+       __le16 tx_control;
 } __attribute__ ((packed));
 
 #define HERMES_TXSTAT_RETRYERR         (0x0001)
@@ -298,7 +299,7 @@ struct symbol_scan_apinfo {
        /* bits: 0-ess, 1-ibss, 4-privacy [wep] */
        __le16 essid_len;       /* ESSID length */
        u8 essid[32];           /* ESSID of the network */
-       __le16 rates[5];        /* Bit rate supported */
+       __le16 rates[5];        /* Bit rate supported */
        __le16 basic_rates;     /* Basic rates bitmask */
        u8 unknown2[6];         /* Always FF:FF:FF:FF:00:00 */
        u8 unknown3[8];         /* Always 0, appeared in f/w 3.91-68 */
@@ -344,14 +345,14 @@ struct agere_ext_scan_info {
        u8      data[316];
 } __attribute__ ((packed));
 
-#define HERMES_LINKSTATUS_NOT_CONNECTED   (0x0000)  
+#define HERMES_LINKSTATUS_NOT_CONNECTED   (0x0000)
 #define HERMES_LINKSTATUS_CONNECTED       (0x0001)
 #define HERMES_LINKSTATUS_DISCONNECTED    (0x0002)
 #define HERMES_LINKSTATUS_AP_CHANGE       (0x0003)
 #define HERMES_LINKSTATUS_AP_OUT_OF_RANGE (0x0004)
 #define HERMES_LINKSTATUS_AP_IN_RANGE     (0x0005)
 #define HERMES_LINKSTATUS_ASSOC_FAILED    (0x0006)
-  
+
 struct hermes_linkstatus {
        __le16 linkstatus;         /* Link status */
 } __attribute__ ((packed));
@@ -384,11 +385,12 @@ typedef struct hermes {
 
 /* Register access convenience macros */
 #define hermes_read_reg(hw, off) \
-       (ioread16((hw)->iobase + ( (off) << (hw)->reg_spacing )))
+       (ioread16((hw)->iobase + ((off) << (hw)->reg_spacing)))
 #define hermes_write_reg(hw, off, val) \
        (iowrite16((val), (hw)->iobase + ((off) << (hw)->reg_spacing)))
 #define hermes_read_regn(hw, name) hermes_read_reg((hw), HERMES_##name)
-#define hermes_write_regn(hw, name, val) hermes_write_reg((hw), HERMES_##name, (val))
+#define hermes_write_regn(hw, name, val) \
+       hermes_write_reg((hw), HERMES_##name, (val))
 
 /* Function prototypes */
 void hermes_struct_init(hermes_t *hw, void __iomem *address, int reg_spacing);
@@ -430,7 +432,7 @@ static inline int hermes_enable_port(hermes_t *hw, int port)
 
 static inline int hermes_disable_port(hermes_t *hw, int port)
 {
-       return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8), 
+       return hermes_docmd_wait(hw, HERMES_CMD_DISABLE | (port << 8),
                                 0, NULL);
 }
 
@@ -441,11 +443,12 @@ static inline int hermes_inquire(hermes_t *hw, u16 rid)
        return hermes_docmd_wait(hw, HERMES_CMD_INQUIRE, rid, NULL);
 }
 
-#define HERMES_BYTES_TO_RECLEN(n) ( (((n)+1)/2) + 1 )
-#define HERMES_RECLEN_TO_BYTES(n) ( ((n)-1) * 2 )
+#define HERMES_BYTES_TO_RECLEN(n) ((((n)+1)/2) + 1)
+#define HERMES_RECLEN_TO_BYTES(n) (((n)-1) * 2)
 
 /* Note that for the next two, the count is in 16-bit words, not bytes */
-static inline void hermes_read_words(struct hermes *hw, int off, void *buf, unsigned count)
+static inline void hermes_read_words(struct hermes *hw, int off,
+                                    void *buf, unsigned count)
 {
        off = off << hw->reg_spacing;
        ioread16_rep(hw->iobase + off, buf, count);
@@ -460,7 +463,8 @@ static inline void hermes_write_bytes(struct hermes *hw, int off,
                iowrite8(buf[count - 1], hw->iobase + off);
 }
 
-static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count)
+static inline void hermes_clear_words(struct hermes *hw, int off,
+                                     unsigned count)
 {
        unsigned i;
 
@@ -471,9 +475,10 @@ static inline void hermes_clear_words(struct hermes *hw, int off, unsigned count
 }
 
 #define HERMES_READ_RECORD(hw, bap, rid, buf) \
-       (hermes_read_ltv((hw),(bap),(rid), sizeof(*buf), NULL, (buf)))
+       (hermes_read_ltv((hw), (bap), (rid), sizeof(*buf), NULL, (buf)))
 #define HERMES_WRITE_RECORD(hw, bap, rid, buf) \
-       (hermes_write_ltv((hw),(bap),(rid),HERMES_BYTES_TO_RECLEN(sizeof(*buf)),(buf)))
+       (hermes_write_ltv((hw), (bap), (rid), \
+                         HERMES_BYTES_TO_RECLEN(sizeof(*buf)), (buf)))
 
 static inline int hermes_read_wordrec(hermes_t *hw, int bap, u16 rid, u16 *word)
 {
index d8c626e61a3ad603d6e18bf902806ffb3aa62052..5260ceb5cfecae7e98244196e51041daced6c006 100644 (file)
@@ -1,13 +1,7 @@
 /*
- * Hermes download helper driver.
+ * Hermes download helper.
  *
- * This could be entirely merged into hermes.c.
- *
- * I'm keeping it separate to minimise the amount of merging between
- * kernel upgrades. It also means the memory overhead for drivers that
- * don't need firmware download low.
- *
- * This driver:
+ * This helper:
  *  - is capable of writing to the volatile area of the hermes device
  *  - is currently not capable of writing to non-volatile areas
  *  - provide helpers to identify and update plugin data
 #include "hermes.h"
 #include "hermes_dld.h"
 
-MODULE_DESCRIPTION("Download helper for Lucent Hermes chipset");
-MODULE_AUTHOR("David Kilroy <kilroyd@gmail.com>");
-MODULE_LICENSE("Dual MPL/GPL");
-
 #define PFX "hermes_dld: "
 
 /*
@@ -347,7 +337,6 @@ int hermes_read_pda(hermes_t *hw,
 
        return 0;
 }
-EXPORT_SYMBOL(hermes_read_pda);
 
 /* Parse PDA and write the records into the adapter
  *
@@ -376,7 +365,6 @@ int hermes_apply_pda(hermes_t *hw,
        }
        return 0;
 }
-EXPORT_SYMBOL(hermes_apply_pda);
 
 /* Identify the total number of bytes in all blocks
  * including the header data.
@@ -398,7 +386,6 @@ hermes_blocks_length(const char *first_block)
 
        return total_len;
 }
-EXPORT_SYMBOL(hermes_blocks_length);
 
 /*** Hermes programming ***/
 
@@ -452,7 +439,6 @@ int hermesi_program_init(hermes_t *hw, u32 offset)
 
        return err;
 }
-EXPORT_SYMBOL(hermesi_program_init);
 
 /* Done programming data (Hermes I)
  *
@@ -488,7 +474,6 @@ int hermesi_program_end(hermes_t *hw)
 
        return rc ? rc : err;
 }
-EXPORT_SYMBOL(hermesi_program_end);
 
 /* Program the data blocks */
 int hermes_program(hermes_t *hw, const char *first_block, const char *end)
@@ -550,19 +535,6 @@ int hermes_program(hermes_t *hw, const char *first_block, const char *end)
        }
        return 0;
 }
-EXPORT_SYMBOL(hermes_program);
-
-static int __init init_hermes_dld(void)
-{
-       return 0;
-}
-
-static void __exit exit_hermes_dld(void)
-{
-}
-
-module_init(init_hermes_dld);
-module_exit(exit_hermes_dld);
 
 /*** Default plugging data for Hermes I ***/
 /* Values from wl_lkm_718/hcf/dhf.c */
@@ -573,9 +545,9 @@ static const struct {                                                       \
        __le16 id;                                                      \
        u8 val[length];                                                 \
 } __attribute__ ((packed)) default_pdr_data_##pid = {                  \
-       __constant_cpu_to_le16((sizeof(default_pdr_data_##pid)/         \
+       cpu_to_le16((sizeof(default_pdr_data_##pid)/            \
                                sizeof(__le16)) - 1),                   \
-       __constant_cpu_to_le16(pid),                                    \
+       cpu_to_le16(pid),                                       \
        data                                                            \
 }
 
@@ -727,4 +699,3 @@ int hermes_apply_pda_with_defaults(hermes_t *hw,
        }
        return 0;
 }
-EXPORT_SYMBOL(hermes_apply_pda_with_defaults);
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c
new file mode 100644 (file)
index 0000000..081428d
--- /dev/null
@@ -0,0 +1,586 @@
+/* Encapsulate basic setting changes and retrieval on Hermes hardware
+ *
+ * See copyright notice in main.c
+ */
+#include <linux/kernel.h>
+#include <linux/if_arp.h>
+#include <linux/ieee80211.h>
+#include <linux/wireless.h>
+
+#include "hermes.h"
+#include "hermes_rid.h"
+#include "orinoco.h"
+
+#include "hw.h"
+
+/********************************************************************/
+/* Data tables                                                      */
+/********************************************************************/
+
+/* This tables gives the actual meanings of the bitrate IDs returned
+ * by the firmware. */
+static const struct {
+       int bitrate; /* in 100s of kilobits */
+       int automatic;
+       u16 agere_txratectrl;
+       u16 intersil_txratectrl;
+} bitrate_table[] = {
+       {110, 1,  3, 15}, /* Entry 0 is the default */
+       {10,  0,  1,  1},
+       {10,  1,  1,  1},
+       {20,  0,  2,  2},
+       {20,  1,  6,  3},
+       {55,  0,  4,  4},
+       {55,  1,  7,  7},
+       {110, 0,  5,  8},
+};
+#define BITRATE_TABLE_SIZE ARRAY_SIZE(bitrate_table)
+
+int orinoco_get_bitratemode(int bitrate, int automatic)
+{
+       int ratemode = -1;
+       int i;
+
+       if ((bitrate != 10) && (bitrate != 20) &&
+           (bitrate != 55) && (bitrate != 110))
+               return ratemode;
+
+       for (i = 0; i < BITRATE_TABLE_SIZE; i++) {
+               if ((bitrate_table[i].bitrate == bitrate) &&
+                   (bitrate_table[i].automatic == automatic)) {
+                       ratemode = i;
+                       break;
+               }
+       }
+       return ratemode;
+}
+
+void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic)
+{
+       BUG_ON((ratemode < 0) || (ratemode >= BITRATE_TABLE_SIZE));
+
+       *bitrate = bitrate_table[ratemode].bitrate * 100000;
+       *automatic = bitrate_table[ratemode].automatic;
+}
+
+/* Get tsc from the firmware */
+int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc)
+{
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       u8 tsc_arr[4][IW_ENCODE_SEQ_MAX_SIZE];
+
+       if ((key < 0) || (key > 4))
+               return -EINVAL;
+
+       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV,
+                             sizeof(tsc_arr), NULL, &tsc_arr);
+       if (!err)
+               memcpy(tsc, &tsc_arr[key][0], sizeof(tsc_arr[0]));
+
+       return err;
+}
+
+int __orinoco_hw_set_bitrate(struct orinoco_private *priv)
+{
+       hermes_t *hw = &priv->hw;
+       int ratemode = priv->bitratemode;
+       int err = 0;
+
+       if (ratemode >= BITRATE_TABLE_SIZE) {
+               printk(KERN_ERR "%s: BUG: Invalid bitrate mode %d\n",
+                      priv->ndev->name, ratemode);
+               return -EINVAL;
+       }
+
+       switch (priv->firmware_type) {
+       case FIRMWARE_TYPE_AGERE:
+               err = hermes_write_wordrec(hw, USER_BAP,
+                               HERMES_RID_CNFTXRATECONTROL,
+                               bitrate_table[ratemode].agere_txratectrl);
+               break;
+       case FIRMWARE_TYPE_INTERSIL:
+       case FIRMWARE_TYPE_SYMBOL:
+               err = hermes_write_wordrec(hw, USER_BAP,
+                               HERMES_RID_CNFTXRATECONTROL,
+                               bitrate_table[ratemode].intersil_txratectrl);
+               break;
+       default:
+               BUG();
+       }
+
+       return err;
+}
+
+int orinoco_hw_get_act_bitrate(struct orinoco_private *priv, int *bitrate)
+{
+       hermes_t *hw = &priv->hw;
+       int i;
+       int err = 0;
+       u16 val;
+
+       err = hermes_read_wordrec(hw, USER_BAP,
+                                 HERMES_RID_CURRENTTXRATE, &val);
+       if (err)
+               return err;
+
+       switch (priv->firmware_type) {
+       case FIRMWARE_TYPE_AGERE: /* Lucent style rate */
+               /* Note : in Lucent firmware, the return value of
+                * HERMES_RID_CURRENTTXRATE is the bitrate in Mb/s,
+                * and therefore is totally different from the
+                * encoding of HERMES_RID_CNFTXRATECONTROL.
+                * Don't forget that 6Mb/s is really 5.5Mb/s */
+               if (val == 6)
+                       *bitrate = 5500000;
+               else
+                       *bitrate = val * 1000000;
+               break;
+       case FIRMWARE_TYPE_INTERSIL: /* Intersil style rate */
+       case FIRMWARE_TYPE_SYMBOL: /* Symbol style rate */
+               for (i = 0; i < BITRATE_TABLE_SIZE; i++)
+                       if (bitrate_table[i].intersil_txratectrl == val)
+                               break;
+
+               if (i >= BITRATE_TABLE_SIZE)
+                       printk(KERN_INFO "%s: Unable to determine current bitrate (0x%04hx)\n",
+                              priv->ndev->name, val);
+
+               *bitrate = bitrate_table[i].bitrate * 100000;
+               break;
+       default:
+               BUG();
+       }
+
+       return err;
+}
+
+/* Set fixed AP address */
+int __orinoco_hw_set_wap(struct orinoco_private *priv)
+{
+       int roaming_flag;
+       int err = 0;
+       hermes_t *hw = &priv->hw;
+
+       switch (priv->firmware_type) {
+       case FIRMWARE_TYPE_AGERE:
+               /* not supported */
+               break;
+       case FIRMWARE_TYPE_INTERSIL:
+               if (priv->bssid_fixed)
+                       roaming_flag = 2;
+               else
+                       roaming_flag = 1;
+
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFROAMINGMODE,
+                                          roaming_flag);
+               break;
+       case FIRMWARE_TYPE_SYMBOL:
+               err = HERMES_WRITE_RECORD(hw, USER_BAP,
+                                         HERMES_RID_CNFMANDATORYBSSID_SYMBOL,
+                                         &priv->desired_bssid);
+               break;
+       }
+       return err;
+}
+
+/* Change the WEP keys and/or the current keys.  Can be called
+ * either from __orinoco_hw_setup_enc() or directly from
+ * orinoco_ioctl_setiwencode().  In the later case the association
+ * with the AP is not broken (if the firmware can handle it),
+ * which is needed for 802.1x implementations. */
+int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv)
+{
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+
+       switch (priv->firmware_type) {
+       case FIRMWARE_TYPE_AGERE:
+               err = HERMES_WRITE_RECORD(hw, USER_BAP,
+                                         HERMES_RID_CNFWEPKEYS_AGERE,
+                                         &priv->keys);
+               if (err)
+                       return err;
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFTXKEY_AGERE,
+                                          priv->tx_key);
+               if (err)
+                       return err;
+               break;
+       case FIRMWARE_TYPE_INTERSIL:
+       case FIRMWARE_TYPE_SYMBOL:
+               {
+                       int keylen;
+                       int i;
+
+                       /* Force uniform key length to work around
+                        * firmware bugs */
+                       keylen = le16_to_cpu(priv->keys[priv->tx_key].len);
+
+                       if (keylen > LARGE_KEY_SIZE) {
+                               printk(KERN_ERR "%s: BUG: Key %d has oversize length %d.\n",
+                                      priv->ndev->name, priv->tx_key, keylen);
+                               return -E2BIG;
+                       }
+
+                       /* Write all 4 keys */
+                       for (i = 0; i < ORINOCO_MAX_KEYS; i++) {
+                               err = hermes_write_ltv(hw, USER_BAP,
+                                               HERMES_RID_CNFDEFAULTKEY0 + i,
+                                               HERMES_BYTES_TO_RECLEN(keylen),
+                                               priv->keys[i].data);
+                               if (err)
+                                       return err;
+                       }
+
+                       /* Write the index of the key used in transmission */
+                       err = hermes_write_wordrec(hw, USER_BAP,
+                                               HERMES_RID_CNFWEPDEFAULTKEYID,
+                                               priv->tx_key);
+                       if (err)
+                               return err;
+               }
+               break;
+       }
+
+       return 0;
+}
+
+int __orinoco_hw_setup_enc(struct orinoco_private *priv)
+{
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       int master_wep_flag;
+       int auth_flag;
+       int enc_flag;
+
+       /* Setup WEP keys for WEP and WPA */
+       if (priv->encode_alg)
+               __orinoco_hw_setup_wepkeys(priv);
+
+       if (priv->wep_restrict)
+               auth_flag = HERMES_AUTH_SHARED_KEY;
+       else
+               auth_flag = HERMES_AUTH_OPEN;
+
+       if (priv->wpa_enabled)
+               enc_flag = 2;
+       else if (priv->encode_alg == IW_ENCODE_ALG_WEP)
+               enc_flag = 1;
+       else
+               enc_flag = 0;
+
+       switch (priv->firmware_type) {
+       case FIRMWARE_TYPE_AGERE: /* Agere style WEP */
+               if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
+                       /* Enable the shared-key authentication. */
+                       err = hermes_write_wordrec(hw, USER_BAP,
+                                       HERMES_RID_CNFAUTHENTICATION_AGERE,
+                                       auth_flag);
+               }
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFWEPENABLED_AGERE,
+                                          enc_flag);
+               if (err)
+                       return err;
+
+               if (priv->has_wpa) {
+                       /* Set WPA key management */
+                       err = hermes_write_wordrec(hw, USER_BAP,
+                                 HERMES_RID_CNFSETWPAAUTHMGMTSUITE_AGERE,
+                                 priv->key_mgmt);
+                       if (err)
+                               return err;
+               }
+
+               break;
+
+       case FIRMWARE_TYPE_INTERSIL: /* Intersil style WEP */
+       case FIRMWARE_TYPE_SYMBOL: /* Symbol style WEP */
+               if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
+                       if (priv->wep_restrict ||
+                           (priv->firmware_type == FIRMWARE_TYPE_SYMBOL))
+                               master_wep_flag = HERMES_WEP_PRIVACY_INVOKED |
+                                                 HERMES_WEP_EXCL_UNENCRYPTED;
+                       else
+                               master_wep_flag = HERMES_WEP_PRIVACY_INVOKED;
+
+                       err = hermes_write_wordrec(hw, USER_BAP,
+                                                  HERMES_RID_CNFAUTHENTICATION,
+                                                  auth_flag);
+                       if (err)
+                               return err;
+               } else
+                       master_wep_flag = 0;
+
+               if (priv->iw_mode == IW_MODE_MONITOR)
+                       master_wep_flag |= HERMES_WEP_HOST_DECRYPT;
+
+               /* Master WEP setting : on/off */
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFWEPFLAGS_INTERSIL,
+                                          master_wep_flag);
+               if (err)
+                       return err;
+
+               break;
+       }
+
+       return 0;
+}
+
+/* key must be 32 bytes, including the tx and rx MIC keys.
+ * rsc must be 8 bytes
+ * tsc must be 8 bytes or NULL
+ */
+int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx,
+                             u8 *key, u8 *rsc, u8 *tsc)
+{
+       struct {
+               __le16 idx;
+               u8 rsc[IW_ENCODE_SEQ_MAX_SIZE];
+               u8 key[TKIP_KEYLEN];
+               u8 tx_mic[MIC_KEYLEN];
+               u8 rx_mic[MIC_KEYLEN];
+               u8 tsc[IW_ENCODE_SEQ_MAX_SIZE];
+       } __attribute__ ((packed)) buf;
+       int ret;
+       int err;
+       int k;
+       u16 xmitting;
+
+       key_idx &= 0x3;
+
+       if (set_tx)
+               key_idx |= 0x8000;
+
+       buf.idx = cpu_to_le16(key_idx);
+       memcpy(buf.key, key,
+              sizeof(buf.key) + sizeof(buf.tx_mic) + sizeof(buf.rx_mic));
+
+       if (rsc == NULL)
+               memset(buf.rsc, 0, sizeof(buf.rsc));
+       else
+               memcpy(buf.rsc, rsc, sizeof(buf.rsc));
+
+       if (tsc == NULL) {
+               memset(buf.tsc, 0, sizeof(buf.tsc));
+               buf.tsc[4] = 0x10;
+       } else {
+               memcpy(buf.tsc, tsc, sizeof(buf.tsc));
+       }
+
+       /* Wait upto 100ms for tx queue to empty */
+       k = 100;
+       do {
+               k--;
+               udelay(1000);
+               ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY,
+                                         &xmitting);
+               if (ret)
+                       break;
+       } while ((k > 0) && xmitting);
+
+       if (k == 0)
+               ret = -ETIMEDOUT;
+
+       err = HERMES_WRITE_RECORD(hw, USER_BAP,
+                                 HERMES_RID_CNFADDDEFAULTTKIPKEY_AGERE,
+                                 &buf);
+
+       return ret ? ret : err;
+}
+
+int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx)
+{
+       hermes_t *hw = &priv->hw;
+       int err;
+
+       memset(&priv->tkip_key[key_idx], 0, sizeof(priv->tkip_key[key_idx]));
+       err = hermes_write_wordrec(hw, USER_BAP,
+                                  HERMES_RID_CNFREMDEFAULTTKIPKEY_AGERE,
+                                  key_idx);
+       if (err)
+               printk(KERN_WARNING "%s: Error %d clearing TKIP key %d\n",
+                      priv->ndev->name, err, key_idx);
+       return err;
+}
+
+int __orinoco_hw_set_multicast_list(struct orinoco_private *priv,
+                                   struct dev_addr_list *mc_list,
+                                   int mc_count, int promisc)
+{
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+
+       if (promisc != priv->promiscuous) {
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFPROMISCUOUSMODE,
+                                          promisc);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d setting PROMISCUOUSMODE to 1.\n",
+                              priv->ndev->name, err);
+               } else
+                       priv->promiscuous = promisc;
+       }
+
+       /* If we're not in promiscuous mode, then we need to set the
+        * group address if either we want to multicast, or if we were
+        * multicasting and want to stop */
+       if (!promisc && (mc_count || priv->mc_count)) {
+               struct dev_mc_list *p = mc_list;
+               struct hermes_multicast mclist;
+               int i;
+
+               for (i = 0; i < mc_count; i++) {
+                       /* paranoia: is list shorter than mc_count? */
+                       BUG_ON(!p);
+                       /* paranoia: bad address size in list? */
+                       BUG_ON(p->dmi_addrlen != ETH_ALEN);
+
+                       memcpy(mclist.addr[i], p->dmi_addr, ETH_ALEN);
+                       p = p->next;
+               }
+
+               if (p)
+                       printk(KERN_WARNING "%s: Multicast list is "
+                              "longer than mc_count\n", priv->ndev->name);
+
+               err = hermes_write_ltv(hw, USER_BAP,
+                                  HERMES_RID_CNFGROUPADDRESSES,
+                                  HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN),
+                                  &mclist);
+               if (err)
+                       printk(KERN_ERR "%s: Error %d setting multicast list.\n",
+                              priv->ndev->name, err);
+               else
+                       priv->mc_count = mc_count;
+       }
+       return err;
+}
+
+/* Return : < 0 -> error code ; >= 0 -> length */
+int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,
+                        char buf[IW_ESSID_MAX_SIZE+1])
+{
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       struct hermes_idstring essidbuf;
+       char *p = (char *)(&essidbuf.val);
+       int len;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       if (strlen(priv->desired_essid) > 0) {
+               /* We read the desired SSID from the hardware rather
+                  than from priv->desired_essid, just in case the
+                  firmware is allowed to change it on us. I'm not
+                  sure about this */
+               /* My guess is that the OWNSSID should always be whatever
+                * we set to the card, whereas CURRENT_SSID is the one that
+                * may change... - Jean II */
+               u16 rid;
+
+               *active = 1;
+
+               rid = (priv->port_type == 3) ? HERMES_RID_CNFOWNSSID :
+                       HERMES_RID_CNFDESIREDSSID;
+
+               err = hermes_read_ltv(hw, USER_BAP, rid, sizeof(essidbuf),
+                                     NULL, &essidbuf);
+               if (err)
+                       goto fail_unlock;
+       } else {
+               *active = 0;
+
+               err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTSSID,
+                                     sizeof(essidbuf), NULL, &essidbuf);
+               if (err)
+                       goto fail_unlock;
+       }
+
+       len = le16_to_cpu(essidbuf.len);
+       BUG_ON(len > IW_ESSID_MAX_SIZE);
+
+       memset(buf, 0, IW_ESSID_MAX_SIZE);
+       memcpy(buf, p, len);
+       err = len;
+
+ fail_unlock:
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+int orinoco_hw_get_freq(struct orinoco_private *priv)
+{
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       u16 channel;
+       int freq = 0;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CURRENTCHANNEL,
+                                 &channel);
+       if (err)
+               goto out;
+
+       /* Intersil firmware 1.3.5 returns 0 when the interface is down */
+       if (channel == 0) {
+               err = -EBUSY;
+               goto out;
+       }
+
+       if ((channel < 1) || (channel > NUM_CHANNELS)) {
+               printk(KERN_WARNING "%s: Channel out of range (%d)!\n",
+                      priv->ndev->name, channel);
+               err = -EBUSY;
+               goto out;
+
+       }
+       freq = ieee80211_dsss_chan_to_freq(channel);
+
+ out:
+       orinoco_unlock(priv, &flags);
+
+       if (err > 0)
+               err = -EBUSY;
+       return err ? err : freq;
+}
+
+int orinoco_hw_get_bitratelist(struct orinoco_private *priv,
+                              int *numrates, s32 *rates, int max)
+{
+       hermes_t *hw = &priv->hw;
+       struct hermes_idstring list;
+       unsigned char *p = (unsigned char *)&list.val;
+       int err = 0;
+       int num;
+       int i;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_SUPPORTEDDATARATES,
+                             sizeof(list), NULL, &list);
+       orinoco_unlock(priv, &flags);
+
+       if (err)
+               return err;
+
+       num = le16_to_cpu(list.len);
+       *numrates = num;
+       num = min(num, max);
+
+       for (i = 0; i < num; i++)
+               rates[i] = (p[i] & 0x7f) * 500000; /* convert to bps */
+
+       return 0;
+}
diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h
new file mode 100644 (file)
index 0000000..dc3f23a
--- /dev/null
@@ -0,0 +1,47 @@
+/* Encapsulate basic setting changes on Hermes hardware
+ *
+ * See copyright notice in main.c
+ */
+#ifndef _ORINOCO_HW_H_
+#define _ORINOCO_HW_H_
+
+#include <linux/types.h>
+#include <linux/wireless.h>
+
+/* Hardware BAPs */
+#define USER_BAP 0
+#define IRQ_BAP  1
+
+/* WEP key sizes */
+#define SMALL_KEY_SIZE 5
+#define LARGE_KEY_SIZE 13
+
+/* Number of supported channels */
+#define NUM_CHANNELS 14
+
+/* Forward declarations */
+struct orinoco_private;
+struct dev_addr_list;
+
+int orinoco_get_bitratemode(int bitrate, int automatic);
+void orinoco_get_ratemode_cfg(int ratemode, int *bitrate, int *automatic);
+
+int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key, u8 *tsc);
+int __orinoco_hw_set_bitrate(struct orinoco_private *priv);
+int orinoco_hw_get_act_bitrate(struct orinoco_private *priv, int *bitrate);
+int __orinoco_hw_set_wap(struct orinoco_private *priv);
+int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv);
+int __orinoco_hw_setup_enc(struct orinoco_private *priv);
+int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx,
+                             u8 *key, u8 *rsc, u8 *tsc);
+int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx);
+int __orinoco_hw_set_multicast_list(struct orinoco_private *priv,
+                                   struct dev_addr_list *mc_list,
+                                   int mc_count, int promisc);
+int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,
+                        char buf[IW_ESSID_MAX_SIZE+1]);
+int orinoco_hw_get_freq(struct orinoco_private *priv);
+int orinoco_hw_get_bitratelist(struct orinoco_private *priv,
+                              int *numrates, s32 *rates, int max);
+
+#endif /* _ORINOCO_HW_H_ */
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c
new file mode 100644 (file)
index 0000000..54dfc45
--- /dev/null
@@ -0,0 +1,2654 @@
+/* main.c - (formerly known as dldwd_cs.c, orinoco_cs.c and orinoco.c)
+ *
+ * A driver for Hermes or Prism 2 chipset based PCMCIA wireless
+ * adaptors, with Lucent/Agere, Intersil or Symbol firmware.
+ *
+ * Current maintainers (as of 29 September 2003) are:
+ *     Pavel Roskin <proski AT gnu.org>
+ * and David Gibson <hermes AT gibson.dropbear.id.au>
+ *
+ * (C) Copyright David Gibson, IBM Corporation 2001-2003.
+ * Copyright (C) 2000 David Gibson, Linuxcare Australia.
+ *     With some help from :
+ * Copyright (C) 2001 Jean Tourrilhes, HP Labs
+ * Copyright (C) 2001 Benjamin Herrenschmidt
+ *
+ * Based on dummy_cs.c 1.27 2000/06/12 21:27:25
+ *
+ * Portions based on wvlan_cs.c 1.0.6, Copyright Andreas Neuhaus <andy
+ * AT fasta.fh-dortmund.de>
+ *      http://www.stud.fh-dortmund.de/~andy/wvlan/
+ *
+ * The contents of this file are subject to the Mozilla Public License
+ * Version 1.1 (the "License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License
+ * at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and
+ * limitations under the License.
+ *
+ * The initial developer of the original code is David A. Hinds
+ * <dahinds AT users.sourceforge.net>.  Portions created by David
+ * A. Hinds are Copyright (C) 1999 David A. Hinds.  All Rights
+ * Reserved.
+ *
+ * Alternatively, the contents of this file may be used under the
+ * terms of the GNU General Public License version 2 (the "GPL"), in
+ * which case the provisions of the GPL are applicable instead of the
+ * above.  If you wish to allow the use of your version of this file
+ * only under the terms of the GPL and not to allow others to use your
+ * version of this file under the MPL, indicate your decision by
+ * deleting the provisions above and replace them with the notice and
+ * other provisions required by the GPL.  If you do not delete the
+ * provisions above, a recipient may use your version of this file
+ * under either the MPL or the GPL.  */
+
+/*
+ * TODO
+ *     o Handle de-encapsulation within network layer, provide 802.11
+ *       headers (patch from Thomas 'Dent' Mirlacher)
+ *     o Fix possible races in SPY handling.
+ *     o Disconnect wireless extensions from fundamental configuration.
+ *     o (maybe) Software WEP support (patch from Stano Meduna).
+ *     o (maybe) Use multiple Tx buffers - driver handling queue
+ *       rather than firmware.
+ */
+
+/* Locking and synchronization:
+ *
+ * The basic principle is that everything is serialized through a
+ * single spinlock, priv->lock.  The lock is used in user, bh and irq
+ * context, so when taken outside hardirq context it should always be
+ * taken with interrupts disabled.  The lock protects both the
+ * hardware and the struct orinoco_private.
+ *
+ * Another flag, priv->hw_unavailable indicates that the hardware is
+ * unavailable for an extended period of time (e.g. suspended, or in
+ * the middle of a hard reset).  This flag is protected by the
+ * spinlock.  All code which touches the hardware should check the
+ * flag after taking the lock, and if it is set, give up on whatever
+ * they are doing and drop the lock again.  The orinoco_lock()
+ * function handles this (it unlocks and returns -EBUSY if
+ * hw_unavailable is non-zero).
+ */
+
+#define DRIVER_NAME "orinoco"
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/delay.h>
+#include <linux/netdevice.h>
+#include <linux/etherdevice.h>
+#include <linux/ethtool.h>
+#include <linux/suspend.h>
+#include <linux/if_arp.h>
+#include <linux/wireless.h>
+#include <linux/ieee80211.h>
+#include <net/iw_handler.h>
+
+#include "hermes_rid.h"
+#include "hermes_dld.h"
+#include "hw.h"
+#include "scan.h"
+#include "mic.h"
+#include "fw.h"
+#include "wext.h"
+#include "main.h"
+
+#include "orinoco.h"
+
+/********************************************************************/
+/* Module information                                               */
+/********************************************************************/
+
+MODULE_AUTHOR("Pavel Roskin <proski@gnu.org> & "
+             "David Gibson <hermes@gibson.dropbear.id.au>");
+MODULE_DESCRIPTION("Driver for Lucent Orinoco, Prism II based "
+                  "and similar wireless cards");
+MODULE_LICENSE("Dual MPL/GPL");
+
+/* Level of debugging. Used in the macros in orinoco.h */
+#ifdef ORINOCO_DEBUG
+int orinoco_debug = ORINOCO_DEBUG;
+EXPORT_SYMBOL(orinoco_debug);
+module_param(orinoco_debug, int, 0644);
+MODULE_PARM_DESC(orinoco_debug, "Debug level");
+#endif
+
+static int suppress_linkstatus; /* = 0 */
+module_param(suppress_linkstatus, bool, 0644);
+MODULE_PARM_DESC(suppress_linkstatus, "Don't log link status changes");
+
+static int ignore_disconnect; /* = 0 */
+module_param(ignore_disconnect, int, 0644);
+MODULE_PARM_DESC(ignore_disconnect,
+                "Don't report lost link to the network layer");
+
+int force_monitor; /* = 0 */
+module_param(force_monitor, int, 0644);
+MODULE_PARM_DESC(force_monitor, "Allow monitor mode for all firmware versions");
+
+/********************************************************************/
+/* Internal constants                                               */
+/********************************************************************/
+
+/* 802.2 LLC/SNAP header used for Ethernet encapsulation over 802.11 */
+static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
+#define ENCAPS_OVERHEAD                (sizeof(encaps_hdr) + 2)
+
+#define ORINOCO_MIN_MTU                256
+#define ORINOCO_MAX_MTU                (IEEE80211_MAX_DATA_LEN - ENCAPS_OVERHEAD)
+
+#define SYMBOL_MAX_VER_LEN     (14)
+#define MAX_IRQLOOPS_PER_IRQ   10
+#define MAX_IRQLOOPS_PER_JIFFY (20000/HZ) /* Based on a guestimate of
+                                           * how many events the
+                                           * device could
+                                           * legitimately generate */
+#define TX_NICBUF_SIZE_BUG     1585            /* Bug in Symbol firmware */
+
+#define DUMMY_FID              0xFFFF
+
+/*#define MAX_MULTICAST(priv)  (priv->firmware_type == FIRMWARE_TYPE_AGERE ? \
+  HERMES_MAX_MULTICAST : 0)*/
+#define MAX_MULTICAST(priv)    (HERMES_MAX_MULTICAST)
+
+#define ORINOCO_INTEN          (HERMES_EV_RX | HERMES_EV_ALLOC \
+                                | HERMES_EV_TX | HERMES_EV_TXEXC \
+                                | HERMES_EV_WTERR | HERMES_EV_INFO \
+                                | HERMES_EV_INFDROP)
+
+static const struct ethtool_ops orinoco_ethtool_ops;
+
+/********************************************************************/
+/* Data types                                                       */
+/********************************************************************/
+
+/* Beginning of the Tx descriptor, used in TxExc handling */
+struct hermes_txexc_data {
+       struct hermes_tx_descriptor desc;
+       __le16 frame_ctl;
+       __le16 duration_id;
+       u8 addr1[ETH_ALEN];
+} __attribute__ ((packed));
+
+/* Rx frame header except compatibility 802.3 header */
+struct hermes_rx_descriptor {
+       /* Control */
+       __le16 status;
+       __le32 time;
+       u8 silence;
+       u8 signal;
+       u8 rate;
+       u8 rxflow;
+       __le32 reserved;
+
+       /* 802.11 header */
+       __le16 frame_ctl;
+       __le16 duration_id;
+       u8 addr1[ETH_ALEN];
+       u8 addr2[ETH_ALEN];
+       u8 addr3[ETH_ALEN];
+       __le16 seq_ctl;
+       u8 addr4[ETH_ALEN];
+
+       /* Data length */
+       __le16 data_len;
+} __attribute__ ((packed));
+
+struct orinoco_rx_data {
+       struct hermes_rx_descriptor *desc;
+       struct sk_buff *skb;
+       struct list_head list;
+};
+
+/********************************************************************/
+/* Function prototypes                                              */
+/********************************************************************/
+
+static void __orinoco_set_multicast_list(struct net_device *dev);
+
+/********************************************************************/
+/* Internal helper functions                                        */
+/********************************************************************/
+
+void set_port_type(struct orinoco_private *priv)
+{
+       switch (priv->iw_mode) {
+       case IW_MODE_INFRA:
+               priv->port_type = 1;
+               priv->createibss = 0;
+               break;
+       case IW_MODE_ADHOC:
+               if (priv->prefer_port3) {
+                       priv->port_type = 3;
+                       priv->createibss = 0;
+               } else {
+                       priv->port_type = priv->ibss_port;
+                       priv->createibss = 1;
+               }
+               break;
+       case IW_MODE_MONITOR:
+               priv->port_type = 3;
+               priv->createibss = 0;
+               break;
+       default:
+               printk(KERN_ERR "%s: Invalid priv->iw_mode in set_port_type()\n",
+                      priv->ndev->name);
+       }
+}
+
+/********************************************************************/
+/* Device methods                                                   */
+/********************************************************************/
+
+static int orinoco_open(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       unsigned long flags;
+       int err;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       err = __orinoco_up(dev);
+
+       if (!err)
+               priv->open = 1;
+
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_stop(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = 0;
+
+       /* We mustn't use orinoco_lock() here, because we need to be
+          able to close the interface even if hw_unavailable is set
+          (e.g. as we're released after a PC Card removal) */
+       spin_lock_irq(&priv->lock);
+
+       priv->open = 0;
+
+       err = __orinoco_down(dev);
+
+       spin_unlock_irq(&priv->lock);
+
+       return err;
+}
+
+static struct net_device_stats *orinoco_get_stats(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+
+       return &priv->stats;
+}
+
+static void orinoco_set_multicast_list(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0) {
+               printk(KERN_DEBUG "%s: orinoco_set_multicast_list() "
+                      "called when hw_unavailable\n", dev->name);
+               return;
+       }
+
+       __orinoco_set_multicast_list(dev);
+       orinoco_unlock(priv, &flags);
+}
+
+static int orinoco_change_mtu(struct net_device *dev, int new_mtu)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+
+       if ((new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU))
+               return -EINVAL;
+
+       /* MTU + encapsulation + header length */
+       if ((new_mtu + ENCAPS_OVERHEAD + sizeof(struct ieee80211_hdr)) >
+            (priv->nicbuf_size - ETH_HLEN))
+               return -EINVAL;
+
+       dev->mtu = new_mtu;
+
+       return 0;
+}
+
+/********************************************************************/
+/* Tx path                                                          */
+/********************************************************************/
+
+static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct net_device_stats *stats = &priv->stats;
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       u16 txfid = priv->txfid;
+       struct ethhdr *eh;
+       int tx_control;
+       unsigned long flags;
+
+       if (!netif_running(dev)) {
+               printk(KERN_ERR "%s: Tx on stopped device!\n",
+                      dev->name);
+               return NETDEV_TX_BUSY;
+       }
+
+       if (netif_queue_stopped(dev)) {
+               printk(KERN_DEBUG "%s: Tx while transmitter busy!\n",
+                      dev->name);
+               return NETDEV_TX_BUSY;
+       }
+
+       if (orinoco_lock(priv, &flags) != 0) {
+               printk(KERN_ERR "%s: orinoco_xmit() called while hw_unavailable\n",
+                      dev->name);
+               return NETDEV_TX_BUSY;
+       }
+
+       if (!netif_carrier_ok(dev) || (priv->iw_mode == IW_MODE_MONITOR)) {
+               /* Oops, the firmware hasn't established a connection,
+                  silently drop the packet (this seems to be the
+                  safest approach). */
+               goto drop;
+       }
+
+       /* Check packet length */
+       if (skb->len < ETH_HLEN)
+               goto drop;
+
+       tx_control = HERMES_TXCTRL_TX_OK | HERMES_TXCTRL_TX_EX;
+
+       if (priv->encode_alg == IW_ENCODE_ALG_TKIP)
+               tx_control |= (priv->tx_key << HERMES_MIC_KEY_ID_SHIFT) |
+                       HERMES_TXCTRL_MIC;
+
+       if (priv->has_alt_txcntl) {
+               /* WPA enabled firmwares have tx_cntl at the end of
+                * the 802.11 header.  So write zeroed descriptor and
+                * 802.11 header at the same time
+                */
+               char desc[HERMES_802_3_OFFSET];
+               __le16 *txcntl = (__le16 *) &desc[HERMES_TXCNTL2_OFFSET];
+
+               memset(&desc, 0, sizeof(desc));
+
+               *txcntl = cpu_to_le16(tx_control);
+               err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc),
+                                       txfid, 0);
+               if (err) {
+                       if (net_ratelimit())
+                               printk(KERN_ERR "%s: Error %d writing Tx "
+                                      "descriptor to BAP\n", dev->name, err);
+                       goto busy;
+               }
+       } else {
+               struct hermes_tx_descriptor desc;
+
+               memset(&desc, 0, sizeof(desc));
+
+               desc.tx_control = cpu_to_le16(tx_control);
+               err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc),
+                                       txfid, 0);
+               if (err) {
+                       if (net_ratelimit())
+                               printk(KERN_ERR "%s: Error %d writing Tx "
+                                      "descriptor to BAP\n", dev->name, err);
+                       goto busy;
+               }
+
+               /* Clear the 802.11 header and data length fields - some
+                * firmwares (e.g. Lucent/Agere 8.xx) appear to get confused
+                * if this isn't done. */
+               hermes_clear_words(hw, HERMES_DATA0,
+                                  HERMES_802_3_OFFSET - HERMES_802_11_OFFSET);
+       }
+
+       eh = (struct ethhdr *)skb->data;
+
+       /* Encapsulate Ethernet-II frames */
+       if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
+               struct header_struct {
+                       struct ethhdr eth;      /* 802.3 header */
+                       u8 encap[6];            /* 802.2 header */
+               } __attribute__ ((packed)) hdr;
+
+               /* Strip destination and source from the data */
+               skb_pull(skb, 2 * ETH_ALEN);
+
+               /* And move them to a separate header */
+               memcpy(&hdr.eth, eh, 2 * ETH_ALEN);
+               hdr.eth.h_proto = htons(sizeof(encaps_hdr) + skb->len);
+               memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr));
+
+               /* Insert the SNAP header */
+               if (skb_headroom(skb) < sizeof(hdr)) {
+                       printk(KERN_ERR
+                              "%s: Not enough headroom for 802.2 headers %d\n",
+                              dev->name, skb_headroom(skb));
+                       goto drop;
+               }
+               eh = (struct ethhdr *) skb_push(skb, sizeof(hdr));
+               memcpy(eh, &hdr, sizeof(hdr));
+       }
+
+       err = hermes_bap_pwrite(hw, USER_BAP, skb->data, skb->len,
+                               txfid, HERMES_802_3_OFFSET);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
+                      dev->name, err);
+               goto busy;
+       }
+
+       /* Calculate Michael MIC */
+       if (priv->encode_alg == IW_ENCODE_ALG_TKIP) {
+               u8 mic_buf[MICHAEL_MIC_LEN + 1];
+               u8 *mic;
+               size_t offset;
+               size_t len;
+
+               if (skb->len % 2) {
+                       /* MIC start is on an odd boundary */
+                       mic_buf[0] = skb->data[skb->len - 1];
+                       mic = &mic_buf[1];
+                       offset = skb->len - 1;
+                       len = MICHAEL_MIC_LEN + 1;
+               } else {
+                       mic = &mic_buf[0];
+                       offset = skb->len;
+                       len = MICHAEL_MIC_LEN;
+               }
+
+               orinoco_mic(priv->tx_tfm_mic,
+                           priv->tkip_key[priv->tx_key].tx_mic,
+                           eh->h_dest, eh->h_source, 0 /* priority */,
+                           skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic);
+
+               /* Write the MIC */
+               err = hermes_bap_pwrite(hw, USER_BAP, &mic_buf[0], len,
+                                       txfid, HERMES_802_3_OFFSET + offset);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d writing MIC to BAP\n",
+                              dev->name, err);
+                       goto busy;
+               }
+       }
+
+       /* Finally, we actually initiate the send */
+       netif_stop_queue(dev);
+
+       err = hermes_docmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL,
+                               txfid, NULL);
+       if (err) {
+               netif_start_queue(dev);
+               if (net_ratelimit())
+                       printk(KERN_ERR "%s: Error %d transmitting packet\n",
+                               dev->name, err);
+               goto busy;
+       }
+
+       dev->trans_start = jiffies;
+       stats->tx_bytes += HERMES_802_3_OFFSET + skb->len;
+       goto ok;
+
+ drop:
+       stats->tx_errors++;
+       stats->tx_dropped++;
+
+ ok:
+       orinoco_unlock(priv, &flags);
+       dev_kfree_skb(skb);
+       return NETDEV_TX_OK;
+
+ busy:
+       if (err == -EIO)
+               schedule_work(&priv->reset_work);
+       orinoco_unlock(priv, &flags);
+       return NETDEV_TX_BUSY;
+}
+
+static void __orinoco_ev_alloc(struct net_device *dev, hermes_t *hw)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       u16 fid = hermes_read_regn(hw, ALLOCFID);
+
+       if (fid != priv->txfid) {
+               if (fid != DUMMY_FID)
+                       printk(KERN_WARNING "%s: Allocate event on unexpected fid (%04X)\n",
+                              dev->name, fid);
+               return;
+       }
+
+       hermes_write_regn(hw, ALLOCFID, DUMMY_FID);
+}
+
+static void __orinoco_ev_tx(struct net_device *dev, hermes_t *hw)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct net_device_stats *stats = &priv->stats;
+
+       stats->tx_packets++;
+
+       netif_wake_queue(dev);
+
+       hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
+}
+
+static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct net_device_stats *stats = &priv->stats;
+       u16 fid = hermes_read_regn(hw, TXCOMPLFID);
+       u16 status;
+       struct hermes_txexc_data hdr;
+       int err = 0;
+
+       if (fid == DUMMY_FID)
+               return; /* Nothing's really happened */
+
+       /* Read part of the frame header - we need status and addr1 */
+       err = hermes_bap_pread(hw, IRQ_BAP, &hdr,
+                              sizeof(struct hermes_txexc_data),
+                              fid, 0);
+
+       hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
+       stats->tx_errors++;
+
+       if (err) {
+               printk(KERN_WARNING "%s: Unable to read descriptor on Tx error "
+                      "(FID=%04X error %d)\n",
+                      dev->name, fid, err);
+               return;
+       }
+
+       DEBUG(1, "%s: Tx error, err %d (FID=%04X)\n", dev->name,
+             err, fid);
+
+       /* We produce a TXDROP event only for retry or lifetime
+        * exceeded, because that's the only status that really mean
+        * that this particular node went away.
+        * Other errors means that *we* screwed up. - Jean II */
+       status = le16_to_cpu(hdr.desc.status);
+       if (status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) {
+               union iwreq_data        wrqu;
+
+               /* Copy 802.11 dest address.
+                * We use the 802.11 header because the frame may
+                * not be 802.3 or may be mangled...
+                * In Ad-Hoc mode, it will be the node address.
+                * In managed mode, it will be most likely the AP addr
+                * User space will figure out how to convert it to
+                * whatever it needs (IP address or else).
+                * - Jean II */
+               memcpy(wrqu.addr.sa_data, hdr.addr1, ETH_ALEN);
+               wrqu.addr.sa_family = ARPHRD_ETHER;
+
+               /* Send event to user space */
+               wireless_send_event(dev, IWEVTXDROP, &wrqu, NULL);
+       }
+
+       netif_wake_queue(dev);
+}
+
+static void orinoco_tx_timeout(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct net_device_stats *stats = &priv->stats;
+       struct hermes *hw = &priv->hw;
+
+       printk(KERN_WARNING "%s: Tx timeout! "
+              "ALLOCFID=%04x, TXCOMPLFID=%04x, EVSTAT=%04x\n",
+              dev->name, hermes_read_regn(hw, ALLOCFID),
+              hermes_read_regn(hw, TXCOMPLFID), hermes_read_regn(hw, EVSTAT));
+
+       stats->tx_errors++;
+
+       schedule_work(&priv->reset_work);
+}
+
+/********************************************************************/
+/* Rx path (data frames)                                            */
+/********************************************************************/
+
+/* Does the frame have a SNAP header indicating it should be
+ * de-encapsulated to Ethernet-II? */
+static inline int is_ethersnap(void *_hdr)
+{
+       u8 *hdr = _hdr;
+
+       /* We de-encapsulate all packets which, a) have SNAP headers
+        * (i.e. SSAP=DSAP=0xaa and CTRL=0x3 in the 802.2 LLC header
+        * and where b) the OUI of the SNAP header is 00:00:00 or
+        * 00:00:f8 - we need both because different APs appear to use
+        * different OUIs for some reason */
+       return (memcmp(hdr, &encaps_hdr, 5) == 0)
+               && ((hdr[5] == 0x00) || (hdr[5] == 0xf8));
+}
+
+static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac,
+                                     int level, int noise)
+{
+       struct iw_quality wstats;
+       wstats.level = level - 0x95;
+       wstats.noise = noise - 0x95;
+       wstats.qual = (level > noise) ? (level - noise) : 0;
+       wstats.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
+       /* Update spy records */
+       wireless_spy_update(dev, mac, &wstats);
+}
+
+static void orinoco_stat_gather(struct net_device *dev,
+                               struct sk_buff *skb,
+                               struct hermes_rx_descriptor *desc)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+
+       /* Using spy support with lots of Rx packets, like in an
+        * infrastructure (AP), will really slow down everything, because
+        * the MAC address must be compared to each entry of the spy list.
+        * If the user really asks for it (set some address in the
+        * spy list), we do it, but he will pay the price.
+        * Note that to get here, you need both WIRELESS_SPY
+        * compiled in AND some addresses in the list !!!
+        */
+       /* Note : gcc will optimise the whole section away if
+        * WIRELESS_SPY is not defined... - Jean II */
+       if (SPY_NUMBER(priv)) {
+               orinoco_spy_gather(dev, skb_mac_header(skb) + ETH_ALEN,
+                                  desc->signal, desc->silence);
+       }
+}
+
+/*
+ * orinoco_rx_monitor - handle received monitor frames.
+ *
+ * Arguments:
+ *     dev             network device
+ *     rxfid           received FID
+ *     desc            rx descriptor of the frame
+ *
+ * Call context: interrupt
+ */
+static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid,
+                              struct hermes_rx_descriptor *desc)
+{
+       u32 hdrlen = 30;        /* return full header by default */
+       u32 datalen = 0;
+       u16 fc;
+       int err;
+       int len;
+       struct sk_buff *skb;
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct net_device_stats *stats = &priv->stats;
+       hermes_t *hw = &priv->hw;
+
+       len = le16_to_cpu(desc->data_len);
+
+       /* Determine the size of the header and the data */
+       fc = le16_to_cpu(desc->frame_ctl);
+       switch (fc & IEEE80211_FCTL_FTYPE) {
+       case IEEE80211_FTYPE_DATA:
+               if ((fc & IEEE80211_FCTL_TODS)
+                   && (fc & IEEE80211_FCTL_FROMDS))
+                       hdrlen = 30;
+               else
+                       hdrlen = 24;
+               datalen = len;
+               break;
+       case IEEE80211_FTYPE_MGMT:
+               hdrlen = 24;
+               datalen = len;
+               break;
+       case IEEE80211_FTYPE_CTL:
+               switch (fc & IEEE80211_FCTL_STYPE) {
+               case IEEE80211_STYPE_PSPOLL:
+               case IEEE80211_STYPE_RTS:
+               case IEEE80211_STYPE_CFEND:
+               case IEEE80211_STYPE_CFENDACK:
+                       hdrlen = 16;
+                       break;
+               case IEEE80211_STYPE_CTS:
+               case IEEE80211_STYPE_ACK:
+                       hdrlen = 10;
+                       break;
+               }
+               break;
+       default:
+               /* Unknown frame type */
+               break;
+       }
+
+       /* sanity check the length */
+       if (datalen > IEEE80211_MAX_DATA_LEN + 12) {
+               printk(KERN_DEBUG "%s: oversized monitor frame, "
+                      "data length = %d\n", dev->name, datalen);
+               stats->rx_length_errors++;
+               goto update_stats;
+       }
+
+       skb = dev_alloc_skb(hdrlen + datalen);
+       if (!skb) {
+               printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n",
+                      dev->name);
+               goto update_stats;
+       }
+
+       /* Copy the 802.11 header to the skb */
+       memcpy(skb_put(skb, hdrlen), &(desc->frame_ctl), hdrlen);
+       skb_reset_mac_header(skb);
+
+       /* If any, copy the data from the card to the skb */
+       if (datalen > 0) {
+               err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, datalen),
+                                      ALIGN(datalen, 2), rxfid,
+                                      HERMES_802_2_OFFSET);
+               if (err) {
+                       printk(KERN_ERR "%s: error %d reading monitor frame\n",
+                              dev->name, err);
+                       goto drop;
+               }
+       }
+
+       skb->dev = dev;
+       skb->ip_summed = CHECKSUM_NONE;
+       skb->pkt_type = PACKET_OTHERHOST;
+       skb->protocol = cpu_to_be16(ETH_P_802_2);
+
+       stats->rx_packets++;
+       stats->rx_bytes += skb->len;
+
+       netif_rx(skb);
+       return;
+
+ drop:
+       dev_kfree_skb_irq(skb);
+ update_stats:
+       stats->rx_errors++;
+       stats->rx_dropped++;
+}
+
+static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct net_device_stats *stats = &priv->stats;
+       struct iw_statistics *wstats = &priv->wstats;
+       struct sk_buff *skb = NULL;
+       u16 rxfid, status;
+       int length;
+       struct hermes_rx_descriptor *desc;
+       struct orinoco_rx_data *rx_data;
+       int err;
+
+       desc = kmalloc(sizeof(*desc), GFP_ATOMIC);
+       if (!desc) {
+               printk(KERN_WARNING
+                      "%s: Can't allocate space for RX descriptor\n",
+                      dev->name);
+               goto update_stats;
+       }
+
+       rxfid = hermes_read_regn(hw, RXFID);
+
+       err = hermes_bap_pread(hw, IRQ_BAP, desc, sizeof(*desc),
+                              rxfid, 0);
+       if (err) {
+               printk(KERN_ERR "%s: error %d reading Rx descriptor. "
+                      "Frame dropped.\n", dev->name, err);
+               goto update_stats;
+       }
+
+       status = le16_to_cpu(desc->status);
+
+       if (status & HERMES_RXSTAT_BADCRC) {
+               DEBUG(1, "%s: Bad CRC on Rx. Frame dropped.\n",
+                     dev->name);
+               stats->rx_crc_errors++;
+               goto update_stats;
+       }
+
+       /* Handle frames in monitor mode */
+       if (priv->iw_mode == IW_MODE_MONITOR) {
+               orinoco_rx_monitor(dev, rxfid, desc);
+               goto out;
+       }
+
+       if (status & HERMES_RXSTAT_UNDECRYPTABLE) {
+               DEBUG(1, "%s: Undecryptable frame on Rx. Frame dropped.\n",
+                     dev->name);
+               wstats->discard.code++;
+               goto update_stats;
+       }
+
+       length = le16_to_cpu(desc->data_len);
+
+       /* Sanity checks */
+       if (length < 3) { /* No for even an 802.2 LLC header */
+               /* At least on Symbol firmware with PCF we get quite a
+                  lot of these legitimately - Poll frames with no
+                  data. */
+               goto out;
+       }
+       if (length > IEEE80211_MAX_DATA_LEN) {
+               printk(KERN_WARNING "%s: Oversized frame received (%d bytes)\n",
+                      dev->name, length);
+               stats->rx_length_errors++;
+               goto update_stats;
+       }
+
+       /* Payload size does not include Michael MIC. Increase payload
+        * size to read it together with the data. */
+       if (status & HERMES_RXSTAT_MIC)
+               length += MICHAEL_MIC_LEN;
+
+       /* We need space for the packet data itself, plus an ethernet
+          header, plus 2 bytes so we can align the IP header on a
+          32bit boundary, plus 1 byte so we can read in odd length
+          packets from the card, which has an IO granularity of 16
+          bits */
+       skb = dev_alloc_skb(length+ETH_HLEN+2+1);
+       if (!skb) {
+               printk(KERN_WARNING "%s: Can't allocate skb for Rx\n",
+                      dev->name);
+               goto update_stats;
+       }
+
+       /* We'll prepend the header, so reserve space for it.  The worst
+          case is no decapsulation, when 802.3 header is prepended and
+          nothing is removed.  2 is for aligning the IP header.  */
+       skb_reserve(skb, ETH_HLEN + 2);
+
+       err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, length),
+                              ALIGN(length, 2), rxfid,
+                              HERMES_802_2_OFFSET);
+       if (err) {
+               printk(KERN_ERR "%s: error %d reading frame. "
+                      "Frame dropped.\n", dev->name, err);
+               goto drop;
+       }
+
+       /* Add desc and skb to rx queue */
+       rx_data = kzalloc(sizeof(*rx_data), GFP_ATOMIC);
+       if (!rx_data) {
+               printk(KERN_WARNING "%s: Can't allocate RX packet\n",
+                       dev->name);
+               goto drop;
+       }
+       rx_data->desc = desc;
+       rx_data->skb = skb;
+       list_add_tail(&rx_data->list, &priv->rx_list);
+       tasklet_schedule(&priv->rx_tasklet);
+
+       return;
+
+drop:
+       dev_kfree_skb_irq(skb);
+update_stats:
+       stats->rx_errors++;
+       stats->rx_dropped++;
+out:
+       kfree(desc);
+}
+
+static void orinoco_rx(struct net_device *dev,
+                      struct hermes_rx_descriptor *desc,
+                      struct sk_buff *skb)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct net_device_stats *stats = &priv->stats;
+       u16 status, fc;
+       int length;
+       struct ethhdr *hdr;
+
+       status = le16_to_cpu(desc->status);
+       length = le16_to_cpu(desc->data_len);
+       fc = le16_to_cpu(desc->frame_ctl);
+
+       /* Calculate and check MIC */
+       if (status & HERMES_RXSTAT_MIC) {
+               int key_id = ((status & HERMES_RXSTAT_MIC_KEY_ID) >>
+                             HERMES_MIC_KEY_ID_SHIFT);
+               u8 mic[MICHAEL_MIC_LEN];
+               u8 *rxmic;
+               u8 *src = (fc & IEEE80211_FCTL_FROMDS) ?
+                       desc->addr3 : desc->addr2;
+
+               /* Extract Michael MIC from payload */
+               rxmic = skb->data + skb->len - MICHAEL_MIC_LEN;
+
+               skb_trim(skb, skb->len - MICHAEL_MIC_LEN);
+               length -= MICHAEL_MIC_LEN;
+
+               orinoco_mic(priv->rx_tfm_mic,
+                           priv->tkip_key[key_id].rx_mic,
+                           desc->addr1,
+                           src,
+                           0, /* priority or QoS? */
+                           skb->data,
+                           skb->len,
+                           &mic[0]);
+
+               if (memcmp(mic, rxmic,
+                          MICHAEL_MIC_LEN)) {
+                       union iwreq_data wrqu;
+                       struct iw_michaelmicfailure wxmic;
+
+                       printk(KERN_WARNING "%s: "
+                              "Invalid Michael MIC in data frame from %pM, "
+                              "using key %i\n",
+                              dev->name, src, key_id);
+
+                       /* TODO: update stats */
+
+                       /* Notify userspace */
+                       memset(&wxmic, 0, sizeof(wxmic));
+                       wxmic.flags = key_id & IW_MICFAILURE_KEY_ID;
+                       wxmic.flags |= (desc->addr1[0] & 1) ?
+                               IW_MICFAILURE_GROUP : IW_MICFAILURE_PAIRWISE;
+                       wxmic.src_addr.sa_family = ARPHRD_ETHER;
+                       memcpy(wxmic.src_addr.sa_data, src, ETH_ALEN);
+
+                       (void) orinoco_hw_get_tkip_iv(priv, key_id,
+                                                     &wxmic.tsc[0]);
+
+                       memset(&wrqu, 0, sizeof(wrqu));
+                       wrqu.data.length = sizeof(wxmic);
+                       wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu,
+                                           (char *) &wxmic);
+
+                       goto drop;
+               }
+       }
+
+       /* Handle decapsulation
+        * In most cases, the firmware tell us about SNAP frames.
+        * For some reason, the SNAP frames sent by LinkSys APs
+        * are not properly recognised by most firmwares.
+        * So, check ourselves */
+       if (length >= ENCAPS_OVERHEAD &&
+           (((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_1042) ||
+            ((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_TUNNEL) ||
+            is_ethersnap(skb->data))) {
+               /* These indicate a SNAP within 802.2 LLC within
+                  802.11 frame which we'll need to de-encapsulate to
+                  the original EthernetII frame. */
+               hdr = (struct ethhdr *)skb_push(skb,
+                                               ETH_HLEN - ENCAPS_OVERHEAD);
+       } else {
+               /* 802.3 frame - prepend 802.3 header as is */
+               hdr = (struct ethhdr *)skb_push(skb, ETH_HLEN);
+               hdr->h_proto = htons(length);
+       }
+       memcpy(hdr->h_dest, desc->addr1, ETH_ALEN);
+       if (fc & IEEE80211_FCTL_FROMDS)
+               memcpy(hdr->h_source, desc->addr3, ETH_ALEN);
+       else
+               memcpy(hdr->h_source, desc->addr2, ETH_ALEN);
+
+       skb->protocol = eth_type_trans(skb, dev);
+       skb->ip_summed = CHECKSUM_NONE;
+       if (fc & IEEE80211_FCTL_TODS)
+               skb->pkt_type = PACKET_OTHERHOST;
+
+       /* Process the wireless stats if needed */
+       orinoco_stat_gather(dev, skb, desc);
+
+       /* Pass the packet to the networking stack */
+       netif_rx(skb);
+       stats->rx_packets++;
+       stats->rx_bytes += length;
+
+       return;
+
+ drop:
+       dev_kfree_skb(skb);
+       stats->rx_errors++;
+       stats->rx_dropped++;
+}
+
+static void orinoco_rx_isr_tasklet(unsigned long data)
+{
+       struct net_device *dev = (struct net_device *) data;
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct orinoco_rx_data *rx_data, *temp;
+       struct hermes_rx_descriptor *desc;
+       struct sk_buff *skb;
+       unsigned long flags;
+
+       /* orinoco_rx requires the driver lock, and we also need to
+        * protect priv->rx_list, so just hold the lock over the
+        * lot.
+        *
+        * If orinoco_lock fails, we've unplugged the card. In this
+        * case just abort. */
+       if (orinoco_lock(priv, &flags) != 0)
+               return;
+
+       /* extract desc and skb from queue */
+       list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) {
+               desc = rx_data->desc;
+               skb = rx_data->skb;
+               list_del(&rx_data->list);
+               kfree(rx_data);
+
+               orinoco_rx(dev, desc, skb);
+
+               kfree(desc);
+       }
+
+       orinoco_unlock(priv, &flags);
+}
+
+/********************************************************************/
+/* Rx path (info frames)                                            */
+/********************************************************************/
+
+static void print_linkstatus(struct net_device *dev, u16 status)
+{
+       char *s;
+
+       if (suppress_linkstatus)
+               return;
+
+       switch (status) {
+       case HERMES_LINKSTATUS_NOT_CONNECTED:
+               s = "Not Connected";
+               break;
+       case HERMES_LINKSTATUS_CONNECTED:
+               s = "Connected";
+               break;
+       case HERMES_LINKSTATUS_DISCONNECTED:
+               s = "Disconnected";
+               break;
+       case HERMES_LINKSTATUS_AP_CHANGE:
+               s = "AP Changed";
+               break;
+       case HERMES_LINKSTATUS_AP_OUT_OF_RANGE:
+               s = "AP Out of Range";
+               break;
+       case HERMES_LINKSTATUS_AP_IN_RANGE:
+               s = "AP In Range";
+               break;
+       case HERMES_LINKSTATUS_ASSOC_FAILED:
+               s = "Association Failed";
+               break;
+       default:
+               s = "UNKNOWN";
+       }
+
+       printk(KERN_DEBUG "%s: New link status: %s (%04x)\n",
+              dev->name, s, status);
+}
+
+/* Search scan results for requested BSSID, join it if found */
+static void orinoco_join_ap(struct work_struct *work)
+{
+       struct orinoco_private *priv =
+               container_of(work, struct orinoco_private, join_work);
+       struct net_device *dev = priv->ndev;
+       struct hermes *hw = &priv->hw;
+       int err;
+       unsigned long flags;
+       struct join_req {
+               u8 bssid[ETH_ALEN];
+               __le16 channel;
+       } __attribute__ ((packed)) req;
+       const int atom_len = offsetof(struct prism2_scan_apinfo, atim);
+       struct prism2_scan_apinfo *atom = NULL;
+       int offset = 4;
+       int found = 0;
+       u8 *buf;
+       u16 len;
+
+       /* Allocate buffer for scan results */
+       buf = kmalloc(MAX_SCAN_LEN, GFP_KERNEL);
+       if (!buf)
+               return;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               goto fail_lock;
+
+       /* Sanity checks in case user changed something in the meantime */
+       if (!priv->bssid_fixed)
+               goto out;
+
+       if (strlen(priv->desired_essid) == 0)
+               goto out;
+
+       /* Read scan results from the firmware */
+       err = hermes_read_ltv(hw, USER_BAP,
+                             HERMES_RID_SCANRESULTSTABLE,
+                             MAX_SCAN_LEN, &len, buf);
+       if (err) {
+               printk(KERN_ERR "%s: Cannot read scan results\n",
+                      dev->name);
+               goto out;
+       }
+
+       len = HERMES_RECLEN_TO_BYTES(len);
+
+       /* Go through the scan results looking for the channel of the AP
+        * we were requested to join */
+       for (; offset + atom_len <= len; offset += atom_len) {
+               atom = (struct prism2_scan_apinfo *) (buf + offset);
+               if (memcmp(&atom->bssid, priv->desired_bssid, ETH_ALEN) == 0) {
+                       found = 1;
+                       break;
+               }
+       }
+
+       if (!found) {
+               DEBUG(1, "%s: Requested AP not found in scan results\n",
+                     dev->name);
+               goto out;
+       }
+
+       memcpy(req.bssid, priv->desired_bssid, ETH_ALEN);
+       req.channel = atom->channel;    /* both are little-endian */
+       err = HERMES_WRITE_RECORD(hw, USER_BAP, HERMES_RID_CNFJOINREQUEST,
+                                 &req);
+       if (err)
+               printk(KERN_ERR "%s: Error issuing join request\n", dev->name);
+
+ out:
+       orinoco_unlock(priv, &flags);
+
+ fail_lock:
+       kfree(buf);
+}
+
+/* Send new BSSID to userspace */
+static void orinoco_send_bssid_wevent(struct orinoco_private *priv)
+{
+       struct net_device *dev = priv->ndev;
+       struct hermes *hw = &priv->hw;
+       union iwreq_data wrqu;
+       int err;
+
+       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID,
+                             ETH_ALEN, NULL, wrqu.ap_addr.sa_data);
+       if (err != 0)
+               return;
+
+       wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+
+       /* Send event to user space */
+       wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
+}
+
+static void orinoco_send_assocreqie_wevent(struct orinoco_private *priv)
+{
+       struct net_device *dev = priv->ndev;
+       struct hermes *hw = &priv->hw;
+       union iwreq_data wrqu;
+       int err;
+       u8 buf[88];
+       u8 *ie;
+
+       if (!priv->has_wpa)
+               return;
+
+       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO,
+                             sizeof(buf), NULL, &buf);
+       if (err != 0)
+               return;
+
+       ie = orinoco_get_wpa_ie(buf, sizeof(buf));
+       if (ie) {
+               int rem = sizeof(buf) - (ie - &buf[0]);
+               wrqu.data.length = ie[1] + 2;
+               if (wrqu.data.length > rem)
+                       wrqu.data.length = rem;
+
+               if (wrqu.data.length)
+                       /* Send event to user space */
+                       wireless_send_event(dev, IWEVASSOCREQIE, &wrqu, ie);
+       }
+}
+
+static void orinoco_send_assocrespie_wevent(struct orinoco_private *priv)
+{
+       struct net_device *dev = priv->ndev;
+       struct hermes *hw = &priv->hw;
+       union iwreq_data wrqu;
+       int err;
+       u8 buf[88]; /* TODO: verify max size or IW_GENERIC_IE_MAX */
+       u8 *ie;
+
+       if (!priv->has_wpa)
+               return;
+
+       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_RESP_INFO,
+                             sizeof(buf), NULL, &buf);
+       if (err != 0)
+               return;
+
+       ie = orinoco_get_wpa_ie(buf, sizeof(buf));
+       if (ie) {
+               int rem = sizeof(buf) - (ie - &buf[0]);
+               wrqu.data.length = ie[1] + 2;
+               if (wrqu.data.length > rem)
+                       wrqu.data.length = rem;
+
+               if (wrqu.data.length)
+                       /* Send event to user space */
+                       wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, ie);
+       }
+}
+
+static void orinoco_send_wevents(struct work_struct *work)
+{
+       struct orinoco_private *priv =
+               container_of(work, struct orinoco_private, wevent_work);
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return;
+
+       orinoco_send_assocreqie_wevent(priv);
+       orinoco_send_assocrespie_wevent(priv);
+       orinoco_send_bssid_wevent(priv);
+
+       orinoco_unlock(priv, &flags);
+}
+
+static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       u16 infofid;
+       struct {
+               __le16 len;
+               __le16 type;
+       } __attribute__ ((packed)) info;
+       int len, type;
+       int err;
+
+       /* This is an answer to an INQUIRE command that we did earlier,
+        * or an information "event" generated by the card
+        * The controller return to us a pseudo frame containing
+        * the information in question - Jean II */
+       infofid = hermes_read_regn(hw, INFOFID);
+
+       /* Read the info frame header - don't try too hard */
+       err = hermes_bap_pread(hw, IRQ_BAP, &info, sizeof(info),
+                              infofid, 0);
+       if (err) {
+               printk(KERN_ERR "%s: error %d reading info frame. "
+                      "Frame dropped.\n", dev->name, err);
+               return;
+       }
+
+       len = HERMES_RECLEN_TO_BYTES(le16_to_cpu(info.len));
+       type = le16_to_cpu(info.type);
+
+       switch (type) {
+       case HERMES_INQ_TALLIES: {
+               struct hermes_tallies_frame tallies;
+               struct iw_statistics *wstats = &priv->wstats;
+
+               if (len > sizeof(tallies)) {
+                       printk(KERN_WARNING "%s: Tallies frame too long (%d bytes)\n",
+                              dev->name, len);
+                       len = sizeof(tallies);
+               }
+
+               err = hermes_bap_pread(hw, IRQ_BAP, &tallies, len,
+                                      infofid, sizeof(info));
+               if (err)
+                       break;
+
+               /* Increment our various counters */
+               /* wstats->discard.nwid - no wrong BSSID stuff */
+               wstats->discard.code +=
+                       le16_to_cpu(tallies.RxWEPUndecryptable);
+               if (len == sizeof(tallies))
+                       wstats->discard.code +=
+                               le16_to_cpu(tallies.RxDiscards_WEPICVError) +
+                               le16_to_cpu(tallies.RxDiscards_WEPExcluded);
+               wstats->discard.misc +=
+                       le16_to_cpu(tallies.TxDiscardsWrongSA);
+               wstats->discard.fragment +=
+                       le16_to_cpu(tallies.RxMsgInBadMsgFragments);
+               wstats->discard.retries +=
+                       le16_to_cpu(tallies.TxRetryLimitExceeded);
+               /* wstats->miss.beacon - no match */
+       }
+       break;
+       case HERMES_INQ_LINKSTATUS: {
+               struct hermes_linkstatus linkstatus;
+               u16 newstatus;
+               int connected;
+
+               if (priv->iw_mode == IW_MODE_MONITOR)
+                       break;
+
+               if (len != sizeof(linkstatus)) {
+                       printk(KERN_WARNING "%s: Unexpected size for linkstatus frame (%d bytes)\n",
+                              dev->name, len);
+                       break;
+               }
+
+               err = hermes_bap_pread(hw, IRQ_BAP, &linkstatus, len,
+                                      infofid, sizeof(info));
+               if (err)
+                       break;
+               newstatus = le16_to_cpu(linkstatus.linkstatus);
+
+               /* Symbol firmware uses "out of range" to signal that
+                * the hostscan frame can be requested.  */
+               if (newstatus == HERMES_LINKSTATUS_AP_OUT_OF_RANGE &&
+                   priv->firmware_type == FIRMWARE_TYPE_SYMBOL &&
+                   priv->has_hostscan && priv->scan_inprogress) {
+                       hermes_inquire(hw, HERMES_INQ_HOSTSCAN_SYMBOL);
+                       break;
+               }
+
+               connected = (newstatus == HERMES_LINKSTATUS_CONNECTED)
+                       || (newstatus == HERMES_LINKSTATUS_AP_CHANGE)
+                       || (newstatus == HERMES_LINKSTATUS_AP_IN_RANGE);
+
+               if (connected)
+                       netif_carrier_on(dev);
+               else if (!ignore_disconnect)
+                       netif_carrier_off(dev);
+
+               if (newstatus != priv->last_linkstatus) {
+                       priv->last_linkstatus = newstatus;
+                       print_linkstatus(dev, newstatus);
+                       /* The info frame contains only one word which is the
+                        * status (see hermes.h). The status is pretty boring
+                        * in itself, that's why we export the new BSSID...
+                        * Jean II */
+                       schedule_work(&priv->wevent_work);
+               }
+       }
+       break;
+       case HERMES_INQ_SCAN:
+               if (!priv->scan_inprogress && priv->bssid_fixed &&
+                   priv->firmware_type == FIRMWARE_TYPE_INTERSIL) {
+                       schedule_work(&priv->join_work);
+                       break;
+               }
+               /* fall through */
+       case HERMES_INQ_HOSTSCAN:
+       case HERMES_INQ_HOSTSCAN_SYMBOL: {
+               /* Result of a scanning. Contains information about
+                * cells in the vicinity - Jean II */
+               union iwreq_data        wrqu;
+               unsigned char *buf;
+
+               /* Scan is no longer in progress */
+               priv->scan_inprogress = 0;
+
+               /* Sanity check */
+               if (len > 4096) {
+                       printk(KERN_WARNING "%s: Scan results too large (%d bytes)\n",
+                              dev->name, len);
+                       break;
+               }
+
+               /* Allocate buffer for results */
+               buf = kmalloc(len, GFP_ATOMIC);
+               if (buf == NULL)
+                       /* No memory, so can't printk()... */
+                       break;
+
+               /* Read scan data */
+               err = hermes_bap_pread(hw, IRQ_BAP, (void *) buf, len,
+                                      infofid, sizeof(info));
+               if (err) {
+                       kfree(buf);
+                       break;
+               }
+
+#ifdef ORINOCO_DEBUG
+               {
+                       int     i;
+                       printk(KERN_DEBUG "Scan result [%02X", buf[0]);
+                       for (i = 1; i < (len * 2); i++)
+                               printk(":%02X", buf[i]);
+                       printk("]\n");
+               }
+#endif /* ORINOCO_DEBUG */
+
+               if (orinoco_process_scan_results(priv, buf, len) == 0) {
+                       /* Send an empty event to user space.
+                        * We don't send the received data on the event because
+                        * it would require us to do complex transcoding, and
+                        * we want to minimise the work done in the irq handler
+                        * Use a request to extract the data - Jean II */
+                       wrqu.data.length = 0;
+                       wrqu.data.flags = 0;
+                       wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
+               }
+               kfree(buf);
+       }
+       break;
+       case HERMES_INQ_CHANNELINFO:
+       {
+               struct agere_ext_scan_info *bss;
+
+               if (!priv->scan_inprogress) {
+                       printk(KERN_DEBUG "%s: Got chaninfo without scan, "
+                              "len=%d\n", dev->name, len);
+                       break;
+               }
+
+               /* An empty result indicates that the scan is complete */
+               if (len == 0) {
+                       union iwreq_data        wrqu;
+
+                       /* Scan is no longer in progress */
+                       priv->scan_inprogress = 0;
+
+                       wrqu.data.length = 0;
+                       wrqu.data.flags = 0;
+                       wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
+                       break;
+               }
+
+               /* Sanity check */
+               else if (len > sizeof(*bss)) {
+                       printk(KERN_WARNING
+                              "%s: Ext scan results too large (%d bytes). "
+                              "Truncating results to %zd bytes.\n",
+                              dev->name, len, sizeof(*bss));
+                       len = sizeof(*bss);
+               } else if (len < (offsetof(struct agere_ext_scan_info,
+                                          data) + 2)) {
+                       /* Drop this result now so we don't have to
+                        * keep checking later */
+                       printk(KERN_WARNING
+                              "%s: Ext scan results too short (%d bytes)\n",
+                              dev->name, len);
+                       break;
+               }
+
+               bss = kmalloc(sizeof(*bss), GFP_ATOMIC);
+               if (bss == NULL)
+                       break;
+
+               /* Read scan data */
+               err = hermes_bap_pread(hw, IRQ_BAP, (void *) bss, len,
+                                      infofid, sizeof(info));
+               if (err) {
+                       kfree(bss);
+                       break;
+               }
+
+               orinoco_add_ext_scan_result(priv, bss);
+
+               kfree(bss);
+               break;
+       }
+       case HERMES_INQ_SEC_STAT_AGERE:
+               /* Security status (Agere specific) */
+               /* Ignore this frame for now */
+               if (priv->firmware_type == FIRMWARE_TYPE_AGERE)
+                       break;
+               /* fall through */
+       default:
+               printk(KERN_DEBUG "%s: Unknown information frame received: "
+                      "type 0x%04x, length %d\n", dev->name, type, len);
+               /* We don't actually do anything about it */
+               break;
+       }
+}
+
+static void __orinoco_ev_infdrop(struct net_device *dev, hermes_t *hw)
+{
+       if (net_ratelimit())
+               printk(KERN_DEBUG "%s: Information frame lost.\n", dev->name);
+}
+
+/********************************************************************/
+/* Internal hardware control routines                               */
+/********************************************************************/
+
+int __orinoco_up(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct hermes *hw = &priv->hw;
+       int err;
+
+       netif_carrier_off(dev); /* just to make sure */
+
+       err = __orinoco_program_rids(dev);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d configuring card\n",
+                      dev->name, err);
+               return err;
+       }
+
+       /* Fire things up again */
+       hermes_set_irqmask(hw, ORINOCO_INTEN);
+       err = hermes_enable_port(hw, 0);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d enabling MAC port\n",
+                      dev->name, err);
+               return err;
+       }
+
+       netif_start_queue(dev);
+
+       return 0;
+}
+EXPORT_SYMBOL(__orinoco_up);
+
+int __orinoco_down(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct hermes *hw = &priv->hw;
+       int err;
+
+       netif_stop_queue(dev);
+
+       if (!priv->hw_unavailable) {
+               if (!priv->broken_disableport) {
+                       err = hermes_disable_port(hw, 0);
+                       if (err) {
+                               /* Some firmwares (e.g. Intersil 1.3.x) seem
+                                * to have problems disabling the port, oh
+                                * well, too bad. */
+                               printk(KERN_WARNING "%s: Error %d disabling MAC port\n",
+                                      dev->name, err);
+                               priv->broken_disableport = 1;
+                       }
+               }
+               hermes_set_irqmask(hw, 0);
+               hermes_write_regn(hw, EVACK, 0xffff);
+       }
+
+       /* firmware will have to reassociate */
+       netif_carrier_off(dev);
+       priv->last_linkstatus = 0xffff;
+
+       return 0;
+}
+EXPORT_SYMBOL(__orinoco_down);
+
+static int orinoco_allocate_fid(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct hermes *hw = &priv->hw;
+       int err;
+
+       err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
+       if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) {
+               /* Try workaround for old Symbol firmware bug */
+               priv->nicbuf_size = TX_NICBUF_SIZE_BUG;
+               err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
+
+               printk(KERN_WARNING "%s: firmware ALLOC bug detected "
+                      "(old Symbol firmware?). Work around %s\n",
+                      dev->name, err ? "failed!" : "ok.");
+       }
+
+       return err;
+}
+
+int orinoco_reinit_firmware(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct hermes *hw = &priv->hw;
+       int err;
+
+       err = hermes_init(hw);
+       if (priv->do_fw_download && !err) {
+               err = orinoco_download(priv);
+               if (err)
+                       priv->do_fw_download = 0;
+       }
+       if (!err)
+               err = orinoco_allocate_fid(dev);
+
+       return err;
+}
+EXPORT_SYMBOL(orinoco_reinit_firmware);
+
+int __orinoco_program_rids(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       int err;
+       struct hermes_idstring idbuf;
+
+       /* Set the MAC address */
+       err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR,
+                              HERMES_BYTES_TO_RECLEN(ETH_ALEN), dev->dev_addr);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting MAC address\n",
+                      dev->name, err);
+               return err;
+       }
+
+       /* Set up the link mode */
+       err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNFPORTTYPE,
+                                  priv->port_type);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting port type\n",
+                      dev->name, err);
+               return err;
+       }
+       /* Set the channel/frequency */
+       if (priv->channel != 0 && priv->iw_mode != IW_MODE_INFRA) {
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFOWNCHANNEL,
+                                          priv->channel);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d setting channel %d\n",
+                              dev->name, err, priv->channel);
+                       return err;
+               }
+       }
+
+       if (priv->has_ibss) {
+               u16 createibss;
+
+               if ((strlen(priv->desired_essid) == 0) && (priv->createibss)) {
+                       printk(KERN_WARNING "%s: This firmware requires an "
+                              "ESSID in IBSS-Ad-Hoc mode.\n", dev->name);
+                       /* With wvlan_cs, in this case, we would crash.
+                        * hopefully, this driver will behave better...
+                        * Jean II */
+                       createibss = 0;
+               } else {
+                       createibss = priv->createibss;
+               }
+
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFCREATEIBSS,
+                                          createibss);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d setting CREATEIBSS\n",
+                              dev->name, err);
+                       return err;
+               }
+       }
+
+       /* Set the desired BSSID */
+       err = __orinoco_hw_set_wap(priv);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting AP address\n",
+                      dev->name, err);
+               return err;
+       }
+       /* Set the desired ESSID */
+       idbuf.len = cpu_to_le16(strlen(priv->desired_essid));
+       memcpy(&idbuf.val, priv->desired_essid, sizeof(idbuf.val));
+       /* WinXP wants partner to configure OWNSSID even in IBSS mode. (jimc) */
+       err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNSSID,
+                       HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid)+2),
+                       &idbuf);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting OWNSSID\n",
+                      dev->name, err);
+               return err;
+       }
+       err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFDESIREDSSID,
+                       HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid)+2),
+                       &idbuf);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting DESIREDSSID\n",
+                      dev->name, err);
+               return err;
+       }
+
+       /* Set the station name */
+       idbuf.len = cpu_to_le16(strlen(priv->nick));
+       memcpy(&idbuf.val, priv->nick, sizeof(idbuf.val));
+       err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME,
+                              HERMES_BYTES_TO_RECLEN(strlen(priv->nick)+2),
+                              &idbuf);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting nickname\n",
+                      dev->name, err);
+               return err;
+       }
+
+       /* Set AP density */
+       if (priv->has_sensitivity) {
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFSYSTEMSCALE,
+                                          priv->ap_density);
+               if (err) {
+                       printk(KERN_WARNING "%s: Error %d setting SYSTEMSCALE. "
+                              "Disabling sensitivity control\n",
+                              dev->name, err);
+
+                       priv->has_sensitivity = 0;
+               }
+       }
+
+       /* Set RTS threshold */
+       err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD,
+                                  priv->rts_thresh);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting RTS threshold\n",
+                      dev->name, err);
+               return err;
+       }
+
+       /* Set fragmentation threshold or MWO robustness */
+       if (priv->has_mwo)
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFMWOROBUST_AGERE,
+                                          priv->mwo_robust);
+       else
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
+                                          priv->frag_thresh);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting fragmentation\n",
+                      dev->name, err);
+               return err;
+       }
+
+       /* Set bitrate */
+       err = __orinoco_hw_set_bitrate(priv);
+       if (err) {
+               printk(KERN_ERR "%s: Error %d setting bitrate\n",
+                      dev->name, err);
+               return err;
+       }
+
+       /* Set power management */
+       if (priv->has_pm) {
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFPMENABLED,
+                                          priv->pm_on);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d setting up PM\n",
+                              dev->name, err);
+                       return err;
+               }
+
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFMULTICASTRECEIVE,
+                                          priv->pm_mcast);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d setting up PM\n",
+                              dev->name, err);
+                       return err;
+               }
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFMAXSLEEPDURATION,
+                                          priv->pm_period);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d setting up PM\n",
+                              dev->name, err);
+                       return err;
+               }
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFPMHOLDOVERDURATION,
+                                          priv->pm_timeout);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d setting up PM\n",
+                              dev->name, err);
+                       return err;
+               }
+       }
+
+       /* Set preamble - only for Symbol so far... */
+       if (priv->has_preamble) {
+               err = hermes_write_wordrec(hw, USER_BAP,
+                                          HERMES_RID_CNFPREAMBLE_SYMBOL,
+                                          priv->preamble);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d setting preamble\n",
+                              dev->name, err);
+                       return err;
+               }
+       }
+
+       /* Set up encryption */
+       if (priv->has_wep || priv->has_wpa) {
+               err = __orinoco_hw_setup_enc(priv);
+               if (err) {
+                       printk(KERN_ERR "%s: Error %d activating encryption\n",
+                              dev->name, err);
+                       return err;
+               }
+       }
+
+       if (priv->iw_mode == IW_MODE_MONITOR) {
+               /* Enable monitor mode */
+               dev->type = ARPHRD_IEEE80211;
+               err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
+                                           HERMES_TEST_MONITOR, 0, NULL);
+       } else {
+               /* Disable monitor mode */
+               dev->type = ARPHRD_ETHER;
+               err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
+                                           HERMES_TEST_STOP, 0, NULL);
+       }
+       if (err)
+               return err;
+
+       /* Set promiscuity / multicast*/
+       priv->promiscuous = 0;
+       priv->mc_count = 0;
+
+       /* FIXME: what about netif_tx_lock */
+       __orinoco_set_multicast_list(dev);
+
+       return 0;
+}
+
+/* FIXME: return int? */
+static void
+__orinoco_set_multicast_list(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = 0;
+       int promisc, mc_count;
+
+       /* The Hermes doesn't seem to have an allmulti mode, so we go
+        * into promiscuous mode and let the upper levels deal. */
+       if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI) ||
+           (dev->mc_count > MAX_MULTICAST(priv))) {
+               promisc = 1;
+               mc_count = 0;
+       } else {
+               promisc = 0;
+               mc_count = dev->mc_count;
+       }
+
+       err = __orinoco_hw_set_multicast_list(priv, dev->mc_list, mc_count,
+                                             promisc);
+}
+
+/* This must be called from user context, without locks held - use
+ * schedule_work() */
+void orinoco_reset(struct work_struct *work)
+{
+       struct orinoco_private *priv =
+               container_of(work, struct orinoco_private, reset_work);
+       struct net_device *dev = priv->ndev;
+       struct hermes *hw = &priv->hw;
+       int err;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               /* When the hardware becomes available again, whatever
+                * detects that is responsible for re-initializing
+                * it. So no need for anything further */
+               return;
+
+       netif_stop_queue(dev);
+
+       /* Shut off interrupts.  Depending on what state the hardware
+        * is in, this might not work, but we'll try anyway */
+       hermes_set_irqmask(hw, 0);
+       hermes_write_regn(hw, EVACK, 0xffff);
+
+       priv->hw_unavailable++;
+       priv->last_linkstatus = 0xffff; /* firmware will have to reassociate */
+       netif_carrier_off(dev);
+
+       orinoco_unlock(priv, &flags);
+
+       /* Scanning support: Cleanup of driver struct */
+       orinoco_clear_scan_results(priv, 0);
+       priv->scan_inprogress = 0;
+
+       if (priv->hard_reset) {
+               err = (*priv->hard_reset)(priv);
+               if (err) {
+                       printk(KERN_ERR "%s: orinoco_reset: Error %d "
+                              "performing hard reset\n", dev->name, err);
+                       goto disable;
+               }
+       }
+
+       err = orinoco_reinit_firmware(dev);
+       if (err) {
+               printk(KERN_ERR "%s: orinoco_reset: Error %d re-initializing firmware\n",
+                      dev->name, err);
+               goto disable;
+       }
+
+       /* This has to be called from user context */
+       spin_lock_irq(&priv->lock);
+
+       priv->hw_unavailable--;
+
+       /* priv->open or priv->hw_unavailable might have changed while
+        * we dropped the lock */
+       if (priv->open && (!priv->hw_unavailable)) {
+               err = __orinoco_up(dev);
+               if (err) {
+                       printk(KERN_ERR "%s: orinoco_reset: Error %d reenabling card\n",
+                              dev->name, err);
+               } else
+                       dev->trans_start = jiffies;
+       }
+
+       spin_unlock_irq(&priv->lock);
+
+       return;
+ disable:
+       hermes_set_irqmask(hw, 0);
+       netif_device_detach(dev);
+       printk(KERN_ERR "%s: Device has been disabled!\n", dev->name);
+}
+
+/********************************************************************/
+/* Interrupt handler                                                */
+/********************************************************************/
+
+static void __orinoco_ev_tick(struct net_device *dev, hermes_t *hw)
+{
+       printk(KERN_DEBUG "%s: TICK\n", dev->name);
+}
+
+static void __orinoco_ev_wterr(struct net_device *dev, hermes_t *hw)
+{
+       /* This seems to happen a fair bit under load, but ignoring it
+          seems to work fine...*/
+       printk(KERN_DEBUG "%s: MAC controller error (WTERR). Ignoring.\n",
+              dev->name);
+}
+
+irqreturn_t orinoco_interrupt(int irq, void *dev_id)
+{
+       struct net_device *dev = dev_id;
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       int count = MAX_IRQLOOPS_PER_IRQ;
+       u16 evstat, events;
+       /* These are used to detect a runaway interrupt situation.
+        *
+        * If we get more than MAX_IRQLOOPS_PER_JIFFY iterations in a jiffy,
+        * we panic and shut down the hardware
+        */
+       /* jiffies value the last time we were called */
+       static int last_irq_jiffy; /* = 0 */
+       static int loops_this_jiffy; /* = 0 */
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0) {
+               /* If hw is unavailable - we don't know if the irq was
+                * for us or not */
+               return IRQ_HANDLED;
+       }
+
+       evstat = hermes_read_regn(hw, EVSTAT);
+       events = evstat & hw->inten;
+       if (!events) {
+               orinoco_unlock(priv, &flags);
+               return IRQ_NONE;
+       }
+
+       if (jiffies != last_irq_jiffy)
+               loops_this_jiffy = 0;
+       last_irq_jiffy = jiffies;
+
+       while (events && count--) {
+               if (++loops_this_jiffy > MAX_IRQLOOPS_PER_JIFFY) {
+                       printk(KERN_WARNING "%s: IRQ handler is looping too "
+                              "much! Resetting.\n", dev->name);
+                       /* Disable interrupts for now */
+                       hermes_set_irqmask(hw, 0);
+                       schedule_work(&priv->reset_work);
+                       break;
+               }
+
+               /* Check the card hasn't been removed */
+               if (!hermes_present(hw)) {
+                       DEBUG(0, "orinoco_interrupt(): card removed\n");
+                       break;
+               }
+
+               if (events & HERMES_EV_TICK)
+                       __orinoco_ev_tick(dev, hw);
+               if (events & HERMES_EV_WTERR)
+                       __orinoco_ev_wterr(dev, hw);
+               if (events & HERMES_EV_INFDROP)
+                       __orinoco_ev_infdrop(dev, hw);
+               if (events & HERMES_EV_INFO)
+                       __orinoco_ev_info(dev, hw);
+               if (events & HERMES_EV_RX)
+                       __orinoco_ev_rx(dev, hw);
+               if (events & HERMES_EV_TXEXC)
+                       __orinoco_ev_txexc(dev, hw);
+               if (events & HERMES_EV_TX)
+                       __orinoco_ev_tx(dev, hw);
+               if (events & HERMES_EV_ALLOC)
+                       __orinoco_ev_alloc(dev, hw);
+
+               hermes_write_regn(hw, EVACK, evstat);
+
+               evstat = hermes_read_regn(hw, EVSTAT);
+               events = evstat & hw->inten;
+       };
+
+       orinoco_unlock(priv, &flags);
+       return IRQ_HANDLED;
+}
+EXPORT_SYMBOL(orinoco_interrupt);
+
+/********************************************************************/
+/* Power management                                                 */
+/********************************************************************/
+#if defined(CONFIG_PM_SLEEP) && !defined(CONFIG_HERMES_CACHE_FW_ON_INIT)
+static int orinoco_pm_notifier(struct notifier_block *notifier,
+                              unsigned long pm_event,
+                              void *unused)
+{
+       struct orinoco_private *priv = container_of(notifier,
+                                                   struct orinoco_private,
+                                                   pm_notifier);
+
+       /* All we need to do is cache the firmware before suspend, and
+        * release it when we come out.
+        *
+        * Only need to do this if we're downloading firmware. */
+       if (!priv->do_fw_download)
+               return NOTIFY_DONE;
+
+       switch (pm_event) {
+       case PM_HIBERNATION_PREPARE:
+       case PM_SUSPEND_PREPARE:
+               orinoco_cache_fw(priv, 0);
+               break;
+
+       case PM_POST_RESTORE:
+               /* Restore from hibernation failed. We need to clean
+                * up in exactly the same way, so fall through. */
+       case PM_POST_HIBERNATION:
+       case PM_POST_SUSPEND:
+               orinoco_uncache_fw(priv);
+               break;
+
+       case PM_RESTORE_PREPARE:
+       default:
+               break;
+       }
+
+       return NOTIFY_DONE;
+}
+#else /* !PM_SLEEP || HERMES_CACHE_FW_ON_INIT */
+#define orinoco_pm_notifier NULL
+#endif
+
+/********************************************************************/
+/* Initialization                                                   */
+/********************************************************************/
+
+struct comp_id {
+       u16 id, variant, major, minor;
+} __attribute__ ((packed));
+
+static inline fwtype_t determine_firmware_type(struct comp_id *nic_id)
+{
+       if (nic_id->id < 0x8000)
+               return FIRMWARE_TYPE_AGERE;
+       else if (nic_id->id == 0x8000 && nic_id->major == 0)
+               return FIRMWARE_TYPE_SYMBOL;
+       else
+               return FIRMWARE_TYPE_INTERSIL;
+}
+
+/* Set priv->firmware type, determine firmware properties */
+static int determine_firmware(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       int err;
+       struct comp_id nic_id, sta_id;
+       unsigned int firmver;
+       char tmp[SYMBOL_MAX_VER_LEN+1] __attribute__((aligned(2)));
+
+       /* Get the hardware version */
+       err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_NICID, &nic_id);
+       if (err) {
+               printk(KERN_ERR "%s: Cannot read hardware identity: error %d\n",
+                      dev->name, err);
+               return err;
+       }
+
+       le16_to_cpus(&nic_id.id);
+       le16_to_cpus(&nic_id.variant);
+       le16_to_cpus(&nic_id.major);
+       le16_to_cpus(&nic_id.minor);
+       printk(KERN_DEBUG "%s: Hardware identity %04x:%04x:%04x:%04x\n",
+              dev->name, nic_id.id, nic_id.variant,
+              nic_id.major, nic_id.minor);
+
+       priv->firmware_type = determine_firmware_type(&nic_id);
+
+       /* Get the firmware version */
+       err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_STAID, &sta_id);
+       if (err) {
+               printk(KERN_ERR "%s: Cannot read station identity: error %d\n",
+                      dev->name, err);
+               return err;
+       }
+
+       le16_to_cpus(&sta_id.id);
+       le16_to_cpus(&sta_id.variant);
+       le16_to_cpus(&sta_id.major);
+       le16_to_cpus(&sta_id.minor);
+       printk(KERN_DEBUG "%s: Station identity  %04x:%04x:%04x:%04x\n",
+              dev->name, sta_id.id, sta_id.variant,
+              sta_id.major, sta_id.minor);
+
+       switch (sta_id.id) {
+       case 0x15:
+               printk(KERN_ERR "%s: Primary firmware is active\n",
+                      dev->name);
+               return -ENODEV;
+       case 0x14b:
+               printk(KERN_ERR "%s: Tertiary firmware is active\n",
+                      dev->name);
+               return -ENODEV;
+       case 0x1f:      /* Intersil, Agere, Symbol Spectrum24 */
+       case 0x21:      /* Symbol Spectrum24 Trilogy */
+               break;
+       default:
+               printk(KERN_NOTICE "%s: Unknown station ID, please report\n",
+                      dev->name);
+               break;
+       }
+
+       /* Default capabilities */
+       priv->has_sensitivity = 1;
+       priv->has_mwo = 0;
+       priv->has_preamble = 0;
+       priv->has_port3 = 1;
+       priv->has_ibss = 1;
+       priv->has_wep = 0;
+       priv->has_big_wep = 0;
+       priv->has_alt_txcntl = 0;
+       priv->has_ext_scan = 0;
+       priv->has_wpa = 0;
+       priv->do_fw_download = 0;
+
+       /* Determine capabilities from the firmware version */
+       switch (priv->firmware_type) {
+       case FIRMWARE_TYPE_AGERE:
+               /* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout,
+                  ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */
+               snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
+                        "Lucent/Agere %d.%02d", sta_id.major, sta_id.minor);
+
+               firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor;
+
+               priv->has_ibss = (firmver >= 0x60006);
+               priv->has_wep = (firmver >= 0x40020);
+               priv->has_big_wep = 1; /* FIXME: this is wrong - how do we tell
+                                         Gold cards from the others? */
+               priv->has_mwo = (firmver >= 0x60000);
+               priv->has_pm = (firmver >= 0x40020); /* Don't work in 7.52 ? */
+               priv->ibss_port = 1;
+               priv->has_hostscan = (firmver >= 0x8000a);
+               priv->do_fw_download = 1;
+               priv->broken_monitor = (firmver >= 0x80000);
+               priv->has_alt_txcntl = (firmver >= 0x90000); /* All 9.x ? */
+               priv->has_ext_scan = (firmver >= 0x90000); /* All 9.x ? */
+               priv->has_wpa = (firmver >= 0x9002a);
+               /* Tested with Agere firmware :
+                *      1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 ; 7.28 => Jean II
+                * Tested CableTron firmware : 4.32 => Anton */
+               break;
+       case FIRMWARE_TYPE_SYMBOL:
+               /* Symbol , 3Com AirConnect, Intel, Ericsson WLAN */
+               /* Intel MAC : 00:02:B3:* */
+               /* 3Com MAC : 00:50:DA:* */
+               memset(tmp, 0, sizeof(tmp));
+               /* Get the Symbol firmware version */
+               err = hermes_read_ltv(hw, USER_BAP,
+                                     HERMES_RID_SECONDARYVERSION_SYMBOL,
+                                     SYMBOL_MAX_VER_LEN, NULL, &tmp);
+               if (err) {
+                       printk(KERN_WARNING
+                              "%s: Error %d reading Symbol firmware info. "
+                              "Wildly guessing capabilities...\n",
+                              dev->name, err);
+                       firmver = 0;
+                       tmp[0] = '\0';
+               } else {
+                       /* The firmware revision is a string, the format is
+                        * something like : "V2.20-01".
+                        * Quick and dirty parsing... - Jean II
+                        */
+                       firmver = ((tmp[1] - '0') << 16)
+                               | ((tmp[3] - '0') << 12)
+                               | ((tmp[4] - '0') << 8)
+                               | ((tmp[6] - '0') << 4)
+                               | (tmp[7] - '0');
+
+                       tmp[SYMBOL_MAX_VER_LEN] = '\0';
+               }
+
+               snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
+                        "Symbol %s", tmp);
+
+               priv->has_ibss = (firmver >= 0x20000);
+               priv->has_wep = (firmver >= 0x15012);
+               priv->has_big_wep = (firmver >= 0x20000);
+               priv->has_pm = (firmver >= 0x20000 && firmver < 0x22000) ||
+                              (firmver >= 0x29000 && firmver < 0x30000) ||
+                              firmver >= 0x31000;
+               priv->has_preamble = (firmver >= 0x20000);
+               priv->ibss_port = 4;
+
+               /* Symbol firmware is found on various cards, but
+                * there has been no attempt to check firmware
+                * download on non-spectrum_cs based cards.
+                *
+                * Given that the Agere firmware download works
+                * differently, we should avoid doing a firmware
+                * download with the Symbol algorithm on non-spectrum
+                * cards.
+                *
+                * For now we can identify a spectrum_cs based card
+                * because it has a firmware reset function.
+                */
+               priv->do_fw_download = (priv->stop_fw != NULL);
+
+               priv->broken_disableport = (firmver == 0x25013) ||
+                               (firmver >= 0x30000 && firmver <= 0x31000);
+               priv->has_hostscan = (firmver >= 0x31001) ||
+                                    (firmver >= 0x29057 && firmver < 0x30000);
+               /* Tested with Intel firmware : 0x20015 => Jean II */
+               /* Tested with 3Com firmware : 0x15012 & 0x22001 => Jean II */
+               break;
+       case FIRMWARE_TYPE_INTERSIL:
+               /* D-Link, Linksys, Adtron, ZoomAir, and many others...
+                * Samsung, Compaq 100/200 and Proxim are slightly
+                * different and less well tested */
+               /* D-Link MAC : 00:40:05:* */
+               /* Addtron MAC : 00:90:D1:* */
+               snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
+                        "Intersil %d.%d.%d", sta_id.major, sta_id.minor,
+                        sta_id.variant);
+
+               firmver = ((unsigned long)sta_id.major << 16) |
+                       ((unsigned long)sta_id.minor << 8) | sta_id.variant;
+
+               priv->has_ibss = (firmver >= 0x000700); /* FIXME */
+               priv->has_big_wep = priv->has_wep = (firmver >= 0x000800);
+               priv->has_pm = (firmver >= 0x000700);
+               priv->has_hostscan = (firmver >= 0x010301);
+
+               if (firmver >= 0x000800)
+                       priv->ibss_port = 0;
+               else {
+                       printk(KERN_NOTICE "%s: Intersil firmware earlier "
+                              "than v0.8.x - several features not supported\n",
+                              dev->name);
+                       priv->ibss_port = 1;
+               }
+               break;
+       }
+       printk(KERN_DEBUG "%s: Firmware determined as %s\n", dev->name,
+              priv->fw_name);
+
+       return 0;
+}
+
+static int orinoco_init(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       struct hermes_idstring nickbuf;
+       u16 reclen;
+       int len;
+
+       /* No need to lock, the hw_unavailable flag is already set in
+        * alloc_orinocodev() */
+       priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN;
+
+       /* Initialize the firmware */
+       err = hermes_init(hw);
+       if (err != 0) {
+               printk(KERN_ERR "%s: failed to initialize firmware (err = %d)\n",
+                      dev->name, err);
+               goto out;
+       }
+
+       err = determine_firmware(dev);
+       if (err != 0) {
+               printk(KERN_ERR "%s: Incompatible firmware, aborting\n",
+                      dev->name);
+               goto out;
+       }
+
+       if (priv->do_fw_download) {
+#ifdef CONFIG_HERMES_CACHE_FW_ON_INIT
+               orinoco_cache_fw(priv, 0);
+#endif
+
+               err = orinoco_download(priv);
+               if (err)
+                       priv->do_fw_download = 0;
+
+               /* Check firmware version again */
+               err = determine_firmware(dev);
+               if (err != 0) {
+                       printk(KERN_ERR "%s: Incompatible firmware, aborting\n",
+                              dev->name);
+                       goto out;
+               }
+       }
+
+       if (priv->has_port3)
+               printk(KERN_DEBUG "%s: Ad-hoc demo mode supported\n",
+                      dev->name);
+       if (priv->has_ibss)
+               printk(KERN_DEBUG "%s: IEEE standard IBSS ad-hoc mode supported\n",
+                      dev->name);
+       if (priv->has_wep) {
+               printk(KERN_DEBUG "%s: WEP supported, %s-bit key\n", dev->name,
+                      priv->has_big_wep ? "104" : "40");
+       }
+       if (priv->has_wpa) {
+               printk(KERN_DEBUG "%s: WPA-PSK supported\n", dev->name);
+               if (orinoco_mic_init(priv)) {
+                       printk(KERN_ERR "%s: Failed to setup MIC crypto "
+                              "algorithm. Disabling WPA support\n", dev->name);
+                       priv->has_wpa = 0;
+               }
+       }
+
+       /* Now we have the firmware capabilities, allocate appropiate
+        * sized scan buffers */
+       if (orinoco_bss_data_allocate(priv))
+               goto out;
+       orinoco_bss_data_init(priv);
+
+       /* Get the MAC address */
+       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR,
+                             ETH_ALEN, NULL, dev->dev_addr);
+       if (err) {
+               printk(KERN_WARNING "%s: failed to read MAC address!\n",
+                      dev->name);
+               goto out;
+       }
+
+       printk(KERN_DEBUG "%s: MAC address %pM\n",
+              dev->name, dev->dev_addr);
+
+       /* Get the station name */
+       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME,
+                             sizeof(nickbuf), &reclen, &nickbuf);
+       if (err) {
+               printk(KERN_ERR "%s: failed to read station name\n",
+                      dev->name);
+               goto out;
+       }
+       if (nickbuf.len)
+               len = min(IW_ESSID_MAX_SIZE, (int)le16_to_cpu(nickbuf.len));
+       else
+               len = min(IW_ESSID_MAX_SIZE, 2 * reclen);
+       memcpy(priv->nick, &nickbuf.val, len);
+       priv->nick[len] = '\0';
+
+       printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick);
+
+       err = orinoco_allocate_fid(dev);
+       if (err) {
+               printk(KERN_ERR "%s: failed to allocate NIC buffer!\n",
+                      dev->name);
+               goto out;
+       }
+
+       /* Get allowed channels */
+       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST,
+                                 &priv->channel_mask);
+       if (err) {
+               printk(KERN_ERR "%s: failed to read channel list!\n",
+                      dev->name);
+               goto out;
+       }
+
+       /* Get initial AP density */
+       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFSYSTEMSCALE,
+                                 &priv->ap_density);
+       if (err || priv->ap_density < 1 || priv->ap_density > 3)
+               priv->has_sensitivity = 0;
+
+       /* Get initial RTS threshold */
+       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD,
+                                 &priv->rts_thresh);
+       if (err) {
+               printk(KERN_ERR "%s: failed to read RTS threshold!\n",
+                      dev->name);
+               goto out;
+       }
+
+       /* Get initial fragmentation settings */
+       if (priv->has_mwo)
+               err = hermes_read_wordrec(hw, USER_BAP,
+                                         HERMES_RID_CNFMWOROBUST_AGERE,
+                                         &priv->mwo_robust);
+       else
+               err = hermes_read_wordrec(hw, USER_BAP,
+                                         HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
+                                         &priv->frag_thresh);
+       if (err) {
+               printk(KERN_ERR "%s: failed to read fragmentation settings!\n",
+                      dev->name);
+               goto out;
+       }
+
+       /* Power management setup */
+       if (priv->has_pm) {
+               priv->pm_on = 0;
+               priv->pm_mcast = 1;
+               err = hermes_read_wordrec(hw, USER_BAP,
+                                         HERMES_RID_CNFMAXSLEEPDURATION,
+                                         &priv->pm_period);
+               if (err) {
+                       printk(KERN_ERR "%s: failed to read power management period!\n",
+                              dev->name);
+                       goto out;
+               }
+               err = hermes_read_wordrec(hw, USER_BAP,
+                                         HERMES_RID_CNFPMHOLDOVERDURATION,
+                                         &priv->pm_timeout);
+               if (err) {
+                       printk(KERN_ERR "%s: failed to read power management timeout!\n",
+                              dev->name);
+                       goto out;
+               }
+       }
+
+       /* Preamble setup */
+       if (priv->has_preamble) {
+               err = hermes_read_wordrec(hw, USER_BAP,
+                                         HERMES_RID_CNFPREAMBLE_SYMBOL,
+                                         &priv->preamble);
+               if (err)
+                       goto out;
+       }
+
+       /* Set up the default configuration */
+       priv->iw_mode = IW_MODE_INFRA;
+       /* By default use IEEE/IBSS ad-hoc mode if we have it */
+       priv->prefer_port3 = priv->has_port3 && (!priv->has_ibss);
+       set_port_type(priv);
+       priv->channel = 0; /* use firmware default */
+
+       priv->promiscuous = 0;
+       priv->encode_alg = IW_ENCODE_ALG_NONE;
+       priv->tx_key = 0;
+       priv->wpa_enabled = 0;
+       priv->tkip_cm_active = 0;
+       priv->key_mgmt = 0;
+       priv->wpa_ie_len = 0;
+       priv->wpa_ie = NULL;
+
+       /* Make the hardware available, as long as it hasn't been
+        * removed elsewhere (e.g. by PCMCIA hot unplug) */
+       spin_lock_irq(&priv->lock);
+       priv->hw_unavailable--;
+       spin_unlock_irq(&priv->lock);
+
+       printk(KERN_DEBUG "%s: ready\n", dev->name);
+
+ out:
+       return err;
+}
+
+static const struct net_device_ops orinoco_netdev_ops = {
+       .ndo_init               = orinoco_init,
+       .ndo_open               = orinoco_open,
+       .ndo_stop               = orinoco_stop,
+       .ndo_start_xmit         = orinoco_xmit,
+       .ndo_set_multicast_list = orinoco_set_multicast_list,
+       .ndo_change_mtu         = orinoco_change_mtu,
+       .ndo_tx_timeout         = orinoco_tx_timeout,
+       .ndo_get_stats          = orinoco_get_stats,
+};
+
+struct net_device
+*alloc_orinocodev(int sizeof_card,
+                 struct device *device,
+                 int (*hard_reset)(struct orinoco_private *),
+                 int (*stop_fw)(struct orinoco_private *, int))
+{
+       struct net_device *dev;
+       struct orinoco_private *priv;
+
+       dev = alloc_etherdev(sizeof(struct orinoco_private) + sizeof_card);
+       if (!dev)
+               return NULL;
+       priv = netdev_priv(dev);
+       priv->ndev = dev;
+       if (sizeof_card)
+               priv->card = (void *)((unsigned long)priv
+                                     + sizeof(struct orinoco_private));
+       else
+               priv->card = NULL;
+       priv->dev = device;
+
+       /* Setup / override net_device fields */
+       dev->netdev_ops = &orinoco_netdev_ops;
+       dev->watchdog_timeo = HZ; /* 1 second timeout */
+       dev->ethtool_ops = &orinoco_ethtool_ops;
+       dev->wireless_handlers = &orinoco_handler_def;
+#ifdef WIRELESS_SPY
+       priv->wireless_data.spy_data = &priv->spy_data;
+       dev->wireless_data = &priv->wireless_data;
+#endif
+       /* we use the default eth_mac_addr for setting the MAC addr */
+
+       /* Reserve space in skb for the SNAP header */
+       dev->hard_header_len += ENCAPS_OVERHEAD;
+
+       /* Set up default callbacks */
+       priv->hard_reset = hard_reset;
+       priv->stop_fw = stop_fw;
+
+       spin_lock_init(&priv->lock);
+       priv->open = 0;
+       priv->hw_unavailable = 1; /* orinoco_init() must clear this
+                                  * before anything else touches the
+                                  * hardware */
+       INIT_WORK(&priv->reset_work, orinoco_reset);
+       INIT_WORK(&priv->join_work, orinoco_join_ap);
+       INIT_WORK(&priv->wevent_work, orinoco_send_wevents);
+
+       INIT_LIST_HEAD(&priv->rx_list);
+       tasklet_init(&priv->rx_tasklet, orinoco_rx_isr_tasklet,
+                    (unsigned long) dev);
+
+       netif_carrier_off(dev);
+       priv->last_linkstatus = 0xffff;
+
+       priv->cached_pri_fw = NULL;
+       priv->cached_fw = NULL;
+
+       /* Register PM notifiers */
+       priv->pm_notifier.notifier_call = orinoco_pm_notifier;
+       register_pm_notifier(&priv->pm_notifier);
+
+       return dev;
+}
+EXPORT_SYMBOL(alloc_orinocodev);
+
+void free_orinocodev(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct orinoco_rx_data *rx_data, *temp;
+
+       /* If the tasklet is scheduled when we call tasklet_kill it
+        * will run one final time. However the tasklet will only
+        * drain priv->rx_list if the hw is still available. */
+       tasklet_kill(&priv->rx_tasklet);
+
+       /* Explicitly drain priv->rx_list */
+       list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) {
+               list_del(&rx_data->list);
+
+               dev_kfree_skb(rx_data->skb);
+               kfree(rx_data->desc);
+               kfree(rx_data);
+       }
+
+       unregister_pm_notifier(&priv->pm_notifier);
+       orinoco_uncache_fw(priv);
+
+       priv->wpa_ie_len = 0;
+       kfree(priv->wpa_ie);
+       orinoco_mic_free(priv);
+       orinoco_bss_data_free(priv);
+       free_netdev(dev);
+}
+EXPORT_SYMBOL(free_orinocodev);
+
+static void orinoco_get_drvinfo(struct net_device *dev,
+                               struct ethtool_drvinfo *info)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+
+       strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
+       strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
+       strncpy(info->fw_version, priv->fw_name, sizeof(info->fw_version) - 1);
+       if (dev->dev.parent)
+               strncpy(info->bus_info, dev_name(dev->dev.parent),
+                       sizeof(info->bus_info) - 1);
+       else
+               snprintf(info->bus_info, sizeof(info->bus_info) - 1,
+                        "PCMCIA %p", priv->hw.iobase);
+}
+
+static const struct ethtool_ops orinoco_ethtool_ops = {
+       .get_drvinfo = orinoco_get_drvinfo,
+       .get_link = ethtool_op_get_link,
+};
+
+/********************************************************************/
+/* Module initialization                                            */
+/********************************************************************/
+
+/* Can't be declared "const" or the whole __initdata section will
+ * become const */
+static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
+       " (David Gibson <hermes@gibson.dropbear.id.au>, "
+       "Pavel Roskin <proski@gnu.org>, et al)";
+
+static int __init init_orinoco(void)
+{
+       printk(KERN_DEBUG "%s\n", version);
+       return 0;
+}
+
+static void __exit exit_orinoco(void)
+{
+}
+
+module_init(init_orinoco);
+module_exit(exit_orinoco);
diff --git a/drivers/net/wireless/orinoco/main.h b/drivers/net/wireless/orinoco/main.h
new file mode 100644 (file)
index 0000000..af2bae4
--- /dev/null
@@ -0,0 +1,63 @@
+/* Exports from main to helper modules
+ *
+ * See copyright notice in main.c
+ */
+#ifndef _ORINOCO_MAIN_H_
+#define _ORINOCO_MAIN_H_
+
+#include <linux/ieee80211.h>
+#include "orinoco.h"
+
+/********************************************************************/
+/* Compile time configuration and compatibility stuff               */
+/********************************************************************/
+
+/* We do this this way to avoid ifdefs in the actual code */
+#ifdef WIRELESS_SPY
+#define SPY_NUMBER(priv)       (priv->spy_data.spy_number)
+#else
+#define SPY_NUMBER(priv)       0
+#endif /* WIRELESS_SPY */
+
+/********************************************************************/
+
+/* Export module parameter */
+extern int force_monitor;
+
+/* Forward declarations */
+struct net_device;
+struct work_struct;
+
+void set_port_type(struct orinoco_private *priv);
+int __orinoco_program_rids(struct net_device *dev);
+void orinoco_reset(struct work_struct *work);
+
+
+/* Information element helpers - find a home for these... */
+static inline u8 *orinoco_get_ie(u8 *data, size_t len,
+                                enum ieee80211_eid eid)
+{
+       u8 *p = data;
+       while ((p + 2) < (data + len)) {
+               if (p[0] == eid)
+                       return p;
+               p += p[1] + 2;
+       }
+       return NULL;
+}
+
+#define WPA_OUI_TYPE   "\x00\x50\xF2\x01"
+#define WPA_SELECTOR_LEN 4
+static inline u8 *orinoco_get_wpa_ie(u8 *data, size_t len)
+{
+       u8 *p = data;
+       while ((p + 2 + WPA_SELECTOR_LEN) < (data + len)) {
+               if ((p[0] == WLAN_EID_GENERIC) &&
+                   (memcmp(&p[2], WPA_OUI_TYPE, WPA_SELECTOR_LEN) == 0))
+                       return p;
+               p += p[1] + 2;
+       }
+       return NULL;
+}
+
+#endif /* _ORINOCO_MAIN_H_ */
diff --git a/drivers/net/wireless/orinoco/mic.c b/drivers/net/wireless/orinoco/mic.c
new file mode 100644 (file)
index 0000000..c03e7f5
--- /dev/null
@@ -0,0 +1,79 @@
+/* Orinoco MIC helpers
+ *
+ * See copyright notice in main.c
+ */
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/if_ether.h>
+#include <linux/scatterlist.h>
+#include <linux/crypto.h>
+
+#include "orinoco.h"
+#include "mic.h"
+
+/********************************************************************/
+/* Michael MIC crypto setup                                         */
+/********************************************************************/
+int orinoco_mic_init(struct orinoco_private *priv)
+{
+       priv->tx_tfm_mic = crypto_alloc_hash("michael_mic", 0, 0);
+       if (IS_ERR(priv->tx_tfm_mic)) {
+               printk(KERN_DEBUG "orinoco_mic_init: could not allocate "
+                      "crypto API michael_mic\n");
+               priv->tx_tfm_mic = NULL;
+               return -ENOMEM;
+       }
+
+       priv->rx_tfm_mic = crypto_alloc_hash("michael_mic", 0, 0);
+       if (IS_ERR(priv->rx_tfm_mic)) {
+               printk(KERN_DEBUG "orinoco_mic_init: could not allocate "
+                      "crypto API michael_mic\n");
+               priv->rx_tfm_mic = NULL;
+               return -ENOMEM;
+       }
+
+       return 0;
+}
+
+void orinoco_mic_free(struct orinoco_private *priv)
+{
+       if (priv->tx_tfm_mic)
+               crypto_free_hash(priv->tx_tfm_mic);
+       if (priv->rx_tfm_mic)
+               crypto_free_hash(priv->rx_tfm_mic);
+}
+
+int orinoco_mic(struct crypto_hash *tfm_michael, u8 *key,
+               u8 *da, u8 *sa, u8 priority,
+               u8 *data, size_t data_len, u8 *mic)
+{
+       struct hash_desc desc;
+       struct scatterlist sg[2];
+       u8 hdr[ETH_HLEN + 2]; /* size of header + padding */
+
+       if (tfm_michael == NULL) {
+               printk(KERN_WARNING "orinoco_mic: tfm_michael == NULL\n");
+               return -1;
+       }
+
+       /* Copy header into buffer. We need the padding on the end zeroed */
+       memcpy(&hdr[0], da, ETH_ALEN);
+       memcpy(&hdr[ETH_ALEN], sa, ETH_ALEN);
+       hdr[ETH_ALEN*2] = priority;
+       hdr[ETH_ALEN*2+1] = 0;
+       hdr[ETH_ALEN*2+2] = 0;
+       hdr[ETH_ALEN*2+3] = 0;
+
+       /* Use scatter gather to MIC header and data in one go */
+       sg_init_table(sg, 2);
+       sg_set_buf(&sg[0], hdr, sizeof(hdr));
+       sg_set_buf(&sg[1], data, data_len);
+
+       if (crypto_hash_setkey(tfm_michael, key, MIC_KEYLEN))
+               return -1;
+
+       desc.tfm = tfm_michael;
+       desc.flags = 0;
+       return crypto_hash_digest(&desc, sg, data_len + sizeof(hdr),
+                                 mic);
+}
diff --git a/drivers/net/wireless/orinoco/mic.h b/drivers/net/wireless/orinoco/mic.h
new file mode 100644 (file)
index 0000000..04d05bc
--- /dev/null
@@ -0,0 +1,22 @@
+/* Orinoco MIC helpers
+ *
+ * See copyright notice in main.c
+ */
+#ifndef _ORINOCO_MIC_H_
+#define _ORINOCO_MIC_H_
+
+#include <linux/types.h>
+
+#define MICHAEL_MIC_LEN 8
+
+/* Forward declarations */
+struct orinoco_private;
+struct crypto_hash;
+
+int orinoco_mic_init(struct orinoco_private *priv);
+void orinoco_mic_free(struct orinoco_private *priv);
+int orinoco_mic(struct crypto_hash *tfm_michael, u8 *key,
+               u8 *da, u8 *sa, u8 priority,
+               u8 *data, size_t data_len, u8 *mic);
+
+#endif /* ORINOCO_MIC_H */
diff --git a/drivers/net/wireless/orinoco/orinoco.c b/drivers/net/wireless/orinoco/orinoco.c
deleted file mode 100644 (file)
index 45a04fa..0000000
+++ /dev/null
@@ -1,6148 +0,0 @@
-/* orinoco.c - (formerly known as dldwd_cs.c and orinoco_cs.c)
- *
- * A driver for Hermes or Prism 2 chipset based PCMCIA wireless
- * adaptors, with Lucent/Agere, Intersil or Symbol firmware.
- *
- * Current maintainers (as of 29 September 2003) are:
- *     Pavel Roskin <proski AT gnu.org>
- * and David Gibson <hermes AT gibson.dropbear.id.au>
- *
- * (C) Copyright David Gibson, IBM Corporation 2001-2003.
- * Copyright (C) 2000 David Gibson, Linuxcare Australia.
- *     With some help from :
- * Copyright (C) 2001 Jean Tourrilhes, HP Labs
- * Copyright (C) 2001 Benjamin Herrenschmidt
- *
- * Based on dummy_cs.c 1.27 2000/06/12 21:27:25
- *
- * Portions based on wvlan_cs.c 1.0.6, Copyright Andreas Neuhaus <andy
- * AT fasta.fh-dortmund.de>
- *      http://www.stud.fh-dortmund.de/~andy/wvlan/
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.1 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License
- * at http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and
- * limitations under the License.
- *
- * The initial developer of the original code is David A. Hinds
- * <dahinds AT users.sourceforge.net>.  Portions created by David
- * A. Hinds are Copyright (C) 1999 David A. Hinds.  All Rights
- * Reserved.
- *
- * Alternatively, the contents of this file may be used under the
- * terms of the GNU General Public License version 2 (the "GPL"), in
- * which case the provisions of the GPL are applicable instead of the
- * above.  If you wish to allow the use of your version of this file
- * only under the terms of the GPL and not to allow others to use your
- * version of this file under the MPL, indicate your decision by
- * deleting the provisions above and replace them with the notice and
- * other provisions required by the GPL.  If you do not delete the
- * provisions above, a recipient may use your version of this file
- * under either the MPL or the GPL.  */
-
-/*
- * TODO
- *     o Handle de-encapsulation within network layer, provide 802.11
- *       headers (patch from Thomas 'Dent' Mirlacher)
- *     o Fix possible races in SPY handling.
- *     o Disconnect wireless extensions from fundamental configuration.
- *     o (maybe) Software WEP support (patch from Stano Meduna).
- *     o (maybe) Use multiple Tx buffers - driver handling queue
- *       rather than firmware.
- */
-
-/* Locking and synchronization:
- *
- * The basic principle is that everything is serialized through a
- * single spinlock, priv->lock.  The lock is used in user, bh and irq
- * context, so when taken outside hardirq context it should always be
- * taken with interrupts disabled.  The lock protects both the
- * hardware and the struct orinoco_private.
- *
- * Another flag, priv->hw_unavailable indicates that the hardware is
- * unavailable for an extended period of time (e.g. suspended, or in
- * the middle of a hard reset).  This flag is protected by the
- * spinlock.  All code which touches the hardware should check the
- * flag after taking the lock, and if it is set, give up on whatever
- * they are doing and drop the lock again.  The orinoco_lock()
- * function handles this (it unlocks and returns -EBUSY if
- * hw_unavailable is non-zero).
- */
-
-#define DRIVER_NAME "orinoco"
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/delay.h>
-#include <linux/netdevice.h>
-#include <linux/etherdevice.h>
-#include <linux/ethtool.h>
-#include <linux/firmware.h>
-#include <linux/suspend.h>
-#include <linux/if_arp.h>
-#include <linux/wireless.h>
-#include <linux/ieee80211.h>
-#include <net/iw_handler.h>
-
-#include <linux/scatterlist.h>
-#include <linux/crypto.h>
-
-#include "hermes_rid.h"
-#include "hermes_dld.h"
-#include "orinoco.h"
-
-/********************************************************************/
-/* Module information                                               */
-/********************************************************************/
-
-MODULE_AUTHOR("Pavel Roskin <proski@gnu.org> & David Gibson <hermes@gibson.dropbear.id.au>");
-MODULE_DESCRIPTION("Driver for Lucent Orinoco, Prism II based and similar wireless cards");
-MODULE_LICENSE("Dual MPL/GPL");
-
-/* Level of debugging. Used in the macros in orinoco.h */
-#ifdef ORINOCO_DEBUG
-int orinoco_debug = ORINOCO_DEBUG;
-module_param(orinoco_debug, int, 0644);
-MODULE_PARM_DESC(orinoco_debug, "Debug level");
-EXPORT_SYMBOL(orinoco_debug);
-#endif
-
-static int suppress_linkstatus; /* = 0 */
-module_param(suppress_linkstatus, bool, 0644);
-MODULE_PARM_DESC(suppress_linkstatus, "Don't log link status changes");
-static int ignore_disconnect; /* = 0 */
-module_param(ignore_disconnect, int, 0644);
-MODULE_PARM_DESC(ignore_disconnect, "Don't report lost link to the network layer");
-
-static int force_monitor; /* = 0 */
-module_param(force_monitor, int, 0644);
-MODULE_PARM_DESC(force_monitor, "Allow monitor mode for all firmware versions");
-
-/********************************************************************/
-/* Compile time configuration and compatibility stuff               */
-/********************************************************************/
-
-/* We do this this way to avoid ifdefs in the actual code */
-#ifdef WIRELESS_SPY
-#define SPY_NUMBER(priv)       (priv->spy_data.spy_number)
-#else
-#define SPY_NUMBER(priv)       0
-#endif /* WIRELESS_SPY */
-
-/********************************************************************/
-/* Internal constants                                               */
-/********************************************************************/
-
-/* 802.2 LLC/SNAP header used for Ethernet encapsulation over 802.11 */
-static const u8 encaps_hdr[] = {0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00};
-#define ENCAPS_OVERHEAD                (sizeof(encaps_hdr) + 2)
-
-#define ORINOCO_MIN_MTU                256
-#define ORINOCO_MAX_MTU                (IEEE80211_MAX_DATA_LEN - ENCAPS_OVERHEAD)
-
-#define SYMBOL_MAX_VER_LEN     (14)
-#define USER_BAP               0
-#define IRQ_BAP                        1
-#define MAX_IRQLOOPS_PER_IRQ   10
-#define MAX_IRQLOOPS_PER_JIFFY (20000/HZ) /* Based on a guestimate of
-                                           * how many events the
-                                           * device could
-                                           * legitimately generate */
-#define SMALL_KEY_SIZE         5
-#define LARGE_KEY_SIZE         13
-#define TX_NICBUF_SIZE_BUG     1585            /* Bug in Symbol firmware */
-
-#define DUMMY_FID              0xFFFF
-
-/*#define MAX_MULTICAST(priv)  (priv->firmware_type == FIRMWARE_TYPE_AGERE ? \
-  HERMES_MAX_MULTICAST : 0)*/
-#define MAX_MULTICAST(priv)    (HERMES_MAX_MULTICAST)
-
-#define ORINOCO_INTEN          (HERMES_EV_RX | HERMES_EV_ALLOC \
-                                | HERMES_EV_TX | HERMES_EV_TXEXC \
-                                | HERMES_EV_WTERR | HERMES_EV_INFO \
-                                | HERMES_EV_INFDROP )
-
-#define MAX_RID_LEN 1024
-
-static const struct iw_handler_def orinoco_handler_def;
-static const struct ethtool_ops orinoco_ethtool_ops;
-
-/********************************************************************/
-/* Data tables                                                      */
-/********************************************************************/
-
-/* The frequency of each channel in MHz */
-static const long channel_frequency[] = {
-       2412, 2417, 2422, 2427, 2432, 2437, 2442,
-       2447, 2452, 2457, 2462, 2467, 2472, 2484
-};
-#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
-
-/* This tables gives the actual meanings of the bitrate IDs returned
- * by the firmware. */
-static struct {
-       int bitrate; /* in 100s of kilobits */
-       int automatic;
-       u16 agere_txratectrl;
-       u16 intersil_txratectrl;
-} bitrate_table[] = {
-       {110, 1,  3, 15}, /* Entry 0 is the default */
-       {10,  0,  1,  1},
-       {10,  1,  1,  1},
-       {20,  0,  2,  2},
-       {20,  1,  6,  3},
-       {55,  0,  4,  4},
-       {55,  1,  7,  7},
-       {110, 0,  5,  8},
-};
-#define BITRATE_TABLE_SIZE ARRAY_SIZE(bitrate_table)
-
-/********************************************************************/
-/* Data types                                                       */
-/********************************************************************/
-
-/* Beginning of the Tx descriptor, used in TxExc handling */
-struct hermes_txexc_data {
-       struct hermes_tx_descriptor desc;
-       __le16 frame_ctl;
-       __le16 duration_id;
-       u8 addr1[ETH_ALEN];
-} __attribute__ ((packed));
-
-/* Rx frame header except compatibility 802.3 header */
-struct hermes_rx_descriptor {
-       /* Control */
-       __le16 status;
-       __le32 time;
-       u8 silence;
-       u8 signal;
-       u8 rate;
-       u8 rxflow;
-       __le32 reserved;
-
-       /* 802.11 header */
-       __le16 frame_ctl;
-       __le16 duration_id;
-       u8 addr1[ETH_ALEN];
-       u8 addr2[ETH_ALEN];
-       u8 addr3[ETH_ALEN];
-       __le16 seq_ctl;
-       u8 addr4[ETH_ALEN];
-
-       /* Data length */
-       __le16 data_len;
-} __attribute__ ((packed));
-
-/********************************************************************/
-/* Function prototypes                                              */
-/********************************************************************/
-
-static int __orinoco_program_rids(struct net_device *dev);
-static void __orinoco_set_multicast_list(struct net_device *dev);
-
-/********************************************************************/
-/* Michael MIC crypto setup                                         */
-/********************************************************************/
-#define MICHAEL_MIC_LEN 8
-static int orinoco_mic_init(struct orinoco_private *priv)
-{
-       priv->tx_tfm_mic = crypto_alloc_hash("michael_mic", 0, 0);
-       if (IS_ERR(priv->tx_tfm_mic)) {
-               printk(KERN_DEBUG "orinoco_mic_init: could not allocate "
-                      "crypto API michael_mic\n");
-               priv->tx_tfm_mic = NULL;
-               return -ENOMEM;
-       }
-
-       priv->rx_tfm_mic = crypto_alloc_hash("michael_mic", 0, 0);
-       if (IS_ERR(priv->rx_tfm_mic)) {
-               printk(KERN_DEBUG "orinoco_mic_init: could not allocate "
-                      "crypto API michael_mic\n");
-               priv->rx_tfm_mic = NULL;
-               return -ENOMEM;
-       }
-
-       return 0;
-}
-
-static void orinoco_mic_free(struct orinoco_private *priv)
-{
-       if (priv->tx_tfm_mic)
-               crypto_free_hash(priv->tx_tfm_mic);
-       if (priv->rx_tfm_mic)
-               crypto_free_hash(priv->rx_tfm_mic);
-}
-
-static int michael_mic(struct crypto_hash *tfm_michael, u8 *key,
-                      u8 *da, u8 *sa, u8 priority,
-                      u8 *data, size_t data_len, u8 *mic)
-{
-       struct hash_desc desc;
-       struct scatterlist sg[2];
-       u8 hdr[ETH_HLEN + 2]; /* size of header + padding */
-
-       if (tfm_michael == NULL) {
-               printk(KERN_WARNING "michael_mic: tfm_michael == NULL\n");
-               return -1;
-       }
-
-       /* Copy header into buffer. We need the padding on the end zeroed */
-       memcpy(&hdr[0], da, ETH_ALEN);
-       memcpy(&hdr[ETH_ALEN], sa, ETH_ALEN);
-       hdr[ETH_ALEN*2] = priority;
-       hdr[ETH_ALEN*2+1] = 0;
-       hdr[ETH_ALEN*2+2] = 0;
-       hdr[ETH_ALEN*2+3] = 0;
-
-       /* Use scatter gather to MIC header and data in one go */
-       sg_init_table(sg, 2);
-       sg_set_buf(&sg[0], hdr, sizeof(hdr));
-       sg_set_buf(&sg[1], data, data_len);
-
-       if (crypto_hash_setkey(tfm_michael, key, MIC_KEYLEN))
-               return -1;
-
-       desc.tfm = tfm_michael;
-       desc.flags = 0;
-       return crypto_hash_digest(&desc, sg, data_len + sizeof(hdr),
-                                 mic);
-}
-
-/********************************************************************/
-/* Internal helper functions                                        */
-/********************************************************************/
-
-static inline void set_port_type(struct orinoco_private *priv)
-{
-       switch (priv->iw_mode) {
-       case IW_MODE_INFRA:
-               priv->port_type = 1;
-               priv->createibss = 0;
-               break;
-       case IW_MODE_ADHOC:
-               if (priv->prefer_port3) {
-                       priv->port_type = 3;
-                       priv->createibss = 0;
-               } else {
-                       priv->port_type = priv->ibss_port;
-                       priv->createibss = 1;
-               }
-               break;
-       case IW_MODE_MONITOR:
-               priv->port_type = 3;
-               priv->createibss = 0;
-               break;
-       default:
-               printk(KERN_ERR "%s: Invalid priv->iw_mode in set_port_type()\n",
-                      priv->ndev->name);
-       }
-}
-
-#define ORINOCO_MAX_BSS_COUNT  64
-static int orinoco_bss_data_allocate(struct orinoco_private *priv)
-{
-       if (priv->bss_xbss_data)
-               return 0;
-
-       if (priv->has_ext_scan)
-               priv->bss_xbss_data = kzalloc(ORINOCO_MAX_BSS_COUNT *
-                                             sizeof(struct xbss_element),
-                                             GFP_KERNEL);
-       else
-               priv->bss_xbss_data = kzalloc(ORINOCO_MAX_BSS_COUNT *
-                                             sizeof(struct bss_element),
-                                             GFP_KERNEL);
-
-       if (!priv->bss_xbss_data) {
-               printk(KERN_WARNING "Out of memory allocating beacons");
-               return -ENOMEM;
-       }
-       return 0;
-}
-
-static void orinoco_bss_data_free(struct orinoco_private *priv)
-{
-       kfree(priv->bss_xbss_data);
-       priv->bss_xbss_data = NULL;
-}
-
-#define PRIV_BSS       ((struct bss_element *)priv->bss_xbss_data)
-#define PRIV_XBSS      ((struct xbss_element *)priv->bss_xbss_data)
-static void orinoco_bss_data_init(struct orinoco_private *priv)
-{
-       int i;
-
-       INIT_LIST_HEAD(&priv->bss_free_list);
-       INIT_LIST_HEAD(&priv->bss_list);
-       if (priv->has_ext_scan)
-               for (i = 0; i < ORINOCO_MAX_BSS_COUNT; i++)
-                       list_add_tail(&(PRIV_XBSS[i].list),
-                                     &priv->bss_free_list);
-       else
-               for (i = 0; i < ORINOCO_MAX_BSS_COUNT; i++)
-                       list_add_tail(&(PRIV_BSS[i].list),
-                                     &priv->bss_free_list);
-
-}
-
-static inline u8 *orinoco_get_ie(u8 *data, size_t len,
-                                enum ieee80211_eid eid)
-{
-       u8 *p = data;
-       while ((p + 2) < (data + len)) {
-               if (p[0] == eid)
-                       return p;
-               p += p[1] + 2;
-       }
-       return NULL;
-}
-
-#define WPA_OUI_TYPE   "\x00\x50\xF2\x01"
-#define WPA_SELECTOR_LEN 4
-static inline u8 *orinoco_get_wpa_ie(u8 *data, size_t len)
-{
-       u8 *p = data;
-       while ((p + 2 + WPA_SELECTOR_LEN) < (data + len)) {
-               if ((p[0] == WLAN_EID_GENERIC) &&
-                   (memcmp(&p[2], WPA_OUI_TYPE, WPA_SELECTOR_LEN) == 0))
-                       return p;
-               p += p[1] + 2;
-       }
-       return NULL;
-}
-
-
-/********************************************************************/
-/* Download functionality                                           */
-/********************************************************************/
-
-struct fw_info {
-       char *pri_fw;
-       char *sta_fw;
-       char *ap_fw;
-       u32 pda_addr;
-       u16 pda_size;
-};
-
-const static struct fw_info orinoco_fw[] = {
-       { NULL, "agere_sta_fw.bin", "agere_ap_fw.bin", 0x00390000, 1000 },
-       { NULL, "prism_sta_fw.bin", "prism_ap_fw.bin", 0, 1024 },
-       { "symbol_sp24t_prim_fw", "symbol_sp24t_sec_fw", NULL, 0x00003100, 512 }
-};
-
-/* Structure used to access fields in FW
- * Make sure LE decoding macros are used
- */
-struct orinoco_fw_header {
-       char hdr_vers[6];       /* ASCII string for header version */
-       __le16 headersize;      /* Total length of header */
-       __le32 entry_point;     /* NIC entry point */
-       __le32 blocks;          /* Number of blocks to program */
-       __le32 block_offset;    /* Offset of block data from eof header */
-       __le32 pdr_offset;      /* Offset to PDR data from eof header */
-       __le32 pri_offset;      /* Offset to primary plug data */
-       __le32 compat_offset;   /* Offset to compatibility data*/
-       char signature[0];      /* FW signature length headersize-20 */
-} __attribute__ ((packed));
-
-/* Download either STA or AP firmware into the card. */
-static int
-orinoco_dl_firmware(struct orinoco_private *priv,
-                   const struct fw_info *fw,
-                   int ap)
-{
-       /* Plug Data Area (PDA) */
-       __le16 *pda;
-
-       hermes_t *hw = &priv->hw;
-       const struct firmware *fw_entry;
-       const struct orinoco_fw_header *hdr;
-       const unsigned char *first_block;
-       const unsigned char *end;
-       const char *firmware;
-       struct net_device *dev = priv->ndev;
-       int err = 0;
-
-       pda = kzalloc(fw->pda_size, GFP_KERNEL);
-       if (!pda)
-               return -ENOMEM;
-
-       if (ap)
-               firmware = fw->ap_fw;
-       else
-               firmware = fw->sta_fw;
-
-       printk(KERN_DEBUG "%s: Attempting to download firmware %s\n",
-              dev->name, firmware);
-
-       /* Read current plug data */
-       err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0);
-       printk(KERN_DEBUG "%s: Read PDA returned %d\n", dev->name, err);
-       if (err)
-               goto free;
-
-       if (!priv->cached_fw) {
-               err = request_firmware(&fw_entry, firmware, priv->dev);
-
-               if (err) {
-                       printk(KERN_ERR "%s: Cannot find firmware %s\n",
-                              dev->name, firmware);
-                       err = -ENOENT;
-                       goto free;
-               }
-       } else
-               fw_entry = priv->cached_fw;
-
-       hdr = (const struct orinoco_fw_header *) fw_entry->data;
-
-       /* Enable aux port to allow programming */
-       err = hermesi_program_init(hw, le32_to_cpu(hdr->entry_point));
-       printk(KERN_DEBUG "%s: Program init returned %d\n", dev->name, err);
-       if (err != 0)
-               goto abort;
-
-       /* Program data */
-       first_block = (fw_entry->data +
-                      le16_to_cpu(hdr->headersize) +
-                      le32_to_cpu(hdr->block_offset));
-       end = fw_entry->data + fw_entry->size;
-
-       err = hermes_program(hw, first_block, end);
-       printk(KERN_DEBUG "%s: Program returned %d\n", dev->name, err);
-       if (err != 0)
-               goto abort;
-
-       /* Update production data */
-       first_block = (fw_entry->data +
-                      le16_to_cpu(hdr->headersize) +
-                      le32_to_cpu(hdr->pdr_offset));
-
-       err = hermes_apply_pda_with_defaults(hw, first_block, pda);
-       printk(KERN_DEBUG "%s: Apply PDA returned %d\n", dev->name, err);
-       if (err)
-               goto abort;
-
-       /* Tell card we've finished */
-       err = hermesi_program_end(hw);
-       printk(KERN_DEBUG "%s: Program end returned %d\n", dev->name, err);
-       if (err != 0)
-               goto abort;
-
-       /* Check if we're running */
-       printk(KERN_DEBUG "%s: hermes_present returned %d\n",
-              dev->name, hermes_present(hw));
-
-abort:
-       /* If we requested the firmware, release it. */
-       if (!priv->cached_fw)
-               release_firmware(fw_entry);
-
-free:
-       kfree(pda);
-       return err;
-}
-
-/* End markers */
-#define TEXT_END       0x1A            /* End of text header */
-
-/*
- * Process a firmware image - stop the card, load the firmware, reset
- * the card and make sure it responds.  For the secondary firmware take
- * care of the PDA - read it and then write it on top of the firmware.
- */
-static int
-symbol_dl_image(struct orinoco_private *priv, const struct fw_info *fw,
-               const unsigned char *image, const unsigned char *end,
-               int secondary)
-{
-       hermes_t *hw = &priv->hw;
-       int ret = 0;
-       const unsigned char *ptr;
-       const unsigned char *first_block;
-
-       /* Plug Data Area (PDA) */
-       __le16 *pda = NULL;
-
-       /* Binary block begins after the 0x1A marker */
-       ptr = image;
-       while (*ptr++ != TEXT_END);
-       first_block = ptr;
-
-       /* Read the PDA from EEPROM */
-       if (secondary) {
-               pda = kzalloc(fw->pda_size, GFP_KERNEL);
-               if (!pda)
-                       return -ENOMEM;
-
-               ret = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 1);
-               if (ret)
-                       goto free;
-       }
-
-       /* Stop the firmware, so that it can be safely rewritten */
-       if (priv->stop_fw) {
-               ret = priv->stop_fw(priv, 1);
-               if (ret)
-                       goto free;
-       }
-
-       /* Program the adapter with new firmware */
-       ret = hermes_program(hw, first_block, end);
-       if (ret)
-               goto free;
-
-       /* Write the PDA to the adapter */
-       if (secondary) {
-               size_t len = hermes_blocks_length(first_block);
-               ptr = first_block + len;
-               ret = hermes_apply_pda(hw, ptr, pda);
-               kfree(pda);
-               if (ret)
-                       return ret;
-       }
-
-       /* Run the firmware */
-       if (priv->stop_fw) {
-               ret = priv->stop_fw(priv, 0);
-               if (ret)
-                       return ret;
-       }
-
-       /* Reset hermes chip and make sure it responds */
-       ret = hermes_init(hw);
-
-       /* hermes_reset() should return 0 with the secondary firmware */
-       if (secondary && ret != 0)
-               return -ENODEV;
-
-       /* And this should work with any firmware */
-       if (!hermes_present(hw))
-               return -ENODEV;
-
-       return 0;
-
-free:
-       kfree(pda);
-       return ret;
-}
-
-
-/*
- * Download the firmware into the card, this also does a PCMCIA soft
- * reset on the card, to make sure it's in a sane state.
- */
-static int
-symbol_dl_firmware(struct orinoco_private *priv,
-                  const struct fw_info *fw)
-{
-       struct net_device *dev = priv->ndev;
-       int ret;
-       const struct firmware *fw_entry;
-
-       if (!priv->cached_pri_fw) {
-               if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) {
-                       printk(KERN_ERR "%s: Cannot find firmware: %s\n",
-                              dev->name, fw->pri_fw);
-                       return -ENOENT;
-               }
-       } else
-               fw_entry = priv->cached_pri_fw;
-
-       /* Load primary firmware */
-       ret = symbol_dl_image(priv, fw, fw_entry->data,
-                             fw_entry->data + fw_entry->size, 0);
-
-       if (!priv->cached_pri_fw)
-               release_firmware(fw_entry);
-       if (ret) {
-               printk(KERN_ERR "%s: Primary firmware download failed\n",
-                      dev->name);
-               return ret;
-       }
-
-       if (!priv->cached_fw) {
-               if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) {
-                       printk(KERN_ERR "%s: Cannot find firmware: %s\n",
-                              dev->name, fw->sta_fw);
-                       return -ENOENT;
-               }
-       } else
-               fw_entry = priv->cached_fw;
-
-       /* Load secondary firmware */
-       ret = symbol_dl_image(priv, fw, fw_entry->data,
-                             fw_entry->data + fw_entry->size, 1);
-       if (!priv->cached_fw)
-               release_firmware(fw_entry);
-       if (ret) {
-               printk(KERN_ERR "%s: Secondary firmware download failed\n",
-                      dev->name);
-       }
-
-       return ret;
-}
-
-static int orinoco_download(struct orinoco_private *priv)
-{
-       int err = 0;
-       /* Reload firmware */
-       switch (priv->firmware_type) {
-       case FIRMWARE_TYPE_AGERE:
-               /* case FIRMWARE_TYPE_INTERSIL: */
-               err = orinoco_dl_firmware(priv,
-                                         &orinoco_fw[priv->firmware_type], 0);
-               break;
-
-       case FIRMWARE_TYPE_SYMBOL:
-               err = symbol_dl_firmware(priv,
-                                        &orinoco_fw[priv->firmware_type]);
-               break;
-       case FIRMWARE_TYPE_INTERSIL:
-               break;
-       }
-       /* TODO: if we fail we probably need to reinitialise
-        * the driver */
-
-       return err;
-}
-
-#if defined(CONFIG_HERMES_CACHE_FW_ON_INIT) || defined(CONFIG_PM_SLEEP)
-static void orinoco_cache_fw(struct orinoco_private *priv, int ap)
-{
-       const struct firmware *fw_entry = NULL;
-       const char *pri_fw;
-       const char *fw;
-
-       pri_fw = orinoco_fw[priv->firmware_type].pri_fw;
-       if (ap)
-               fw = orinoco_fw[priv->firmware_type].ap_fw;
-       else
-               fw = orinoco_fw[priv->firmware_type].sta_fw;
-
-       if (pri_fw) {
-               if (request_firmware(&fw_entry, pri_fw, priv->dev) == 0)
-                       priv->cached_pri_fw = fw_entry;
-       }
-
-       if (fw) {
-               if (request_firmware(&fw_entry, fw, priv->dev) == 0)
-                       priv->cached_fw = fw_entry;
-       }
-}
-
-static void orinoco_uncache_fw(struct orinoco_private *priv)
-{
-       if (priv->cached_pri_fw)
-               release_firmware(priv->cached_pri_fw);
-       if (priv->cached_fw)
-               release_firmware(priv->cached_fw);
-
-       priv->cached_pri_fw = NULL;
-       priv->cached_fw = NULL;
-}
-#else
-#define orinoco_cache_fw(priv, ap)
-#define orinoco_uncache_fw(priv)
-#endif
-
-/********************************************************************/
-/* Device methods                                                   */
-/********************************************************************/
-
-static int orinoco_open(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       unsigned long flags;
-       int err;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       err = __orinoco_up(dev);
-
-       if (! err)
-               priv->open = 1;
-
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_stop(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int err = 0;
-
-       /* We mustn't use orinoco_lock() here, because we need to be
-          able to close the interface even if hw_unavailable is set
-          (e.g. as we're released after a PC Card removal) */
-       spin_lock_irq(&priv->lock);
-
-       priv->open = 0;
-
-       err = __orinoco_down(dev);
-
-       spin_unlock_irq(&priv->lock);
-
-       return err;
-}
-
-static struct net_device_stats *orinoco_get_stats(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       
-       return &priv->stats;
-}
-
-static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       struct iw_statistics *wstats = &priv->wstats;
-       int err;
-       unsigned long flags;
-
-       if (! netif_device_present(dev)) {
-               printk(KERN_WARNING "%s: get_wireless_stats() called while device not present\n",
-                      dev->name);
-               return NULL; /* FIXME: Can we do better than this? */
-       }
-
-       /* If busy, return the old stats.  Returning NULL may cause
-        * the interface to disappear from /proc/net/wireless */
-       if (orinoco_lock(priv, &flags) != 0)
-               return wstats;
-
-       /* We can't really wait for the tallies inquiry command to
-        * complete, so we just use the previous results and trigger
-        * a new tallies inquiry command for next time - Jean II */
-       /* FIXME: Really we should wait for the inquiry to come back -
-        * as it is the stats we give don't make a whole lot of sense.
-        * Unfortunately, it's not clear how to do that within the
-        * wireless extensions framework: I think we're in user
-        * context, but a lock seems to be held by the time we get in
-        * here so we're not safe to sleep here. */
-       hermes_inquire(hw, HERMES_INQ_TALLIES);
-
-       if (priv->iw_mode == IW_MODE_ADHOC) {
-               memset(&wstats->qual, 0, sizeof(wstats->qual));
-               /* If a spy address is defined, we report stats of the
-                * first spy address - Jean II */
-               if (SPY_NUMBER(priv)) {
-                       wstats->qual.qual = priv->spy_data.spy_stat[0].qual;
-                       wstats->qual.level = priv->spy_data.spy_stat[0].level;
-                       wstats->qual.noise = priv->spy_data.spy_stat[0].noise;
-                       wstats->qual.updated = priv->spy_data.spy_stat[0].updated;
-               }
-       } else {
-               struct {
-                       __le16 qual, signal, noise, unused;
-               } __attribute__ ((packed)) cq;
-
-               err = HERMES_READ_RECORD(hw, USER_BAP,
-                                        HERMES_RID_COMMSQUALITY, &cq);
-
-               if (!err) {
-                       wstats->qual.qual = (int)le16_to_cpu(cq.qual);
-                       wstats->qual.level = (int)le16_to_cpu(cq.signal) - 0x95;
-                       wstats->qual.noise = (int)le16_to_cpu(cq.noise) - 0x95;
-                       wstats->qual.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
-               }
-       }
-
-       orinoco_unlock(priv, &flags);
-       return wstats;
-}
-
-static void orinoco_set_multicast_list(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0) {
-               printk(KERN_DEBUG "%s: orinoco_set_multicast_list() "
-                      "called when hw_unavailable\n", dev->name);
-               return;
-       }
-
-       __orinoco_set_multicast_list(dev);
-       orinoco_unlock(priv, &flags);
-}
-
-static int orinoco_change_mtu(struct net_device *dev, int new_mtu)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-
-       if ( (new_mtu < ORINOCO_MIN_MTU) || (new_mtu > ORINOCO_MAX_MTU) )
-               return -EINVAL;
-
-       /* MTU + encapsulation + header length */
-       if ( (new_mtu + ENCAPS_OVERHEAD + sizeof(struct ieee80211_hdr)) >
-            (priv->nicbuf_size - ETH_HLEN) )
-               return -EINVAL;
-
-       dev->mtu = new_mtu;
-
-       return 0;
-}
-
-/********************************************************************/
-/* Tx path                                                          */
-/********************************************************************/
-
-static int orinoco_xmit(struct sk_buff *skb, struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct net_device_stats *stats = &priv->stats;
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       u16 txfid = priv->txfid;
-       struct ethhdr *eh;
-       int tx_control;
-       unsigned long flags;
-
-       if (! netif_running(dev)) {
-               printk(KERN_ERR "%s: Tx on stopped device!\n",
-                      dev->name);
-               return NETDEV_TX_BUSY;
-       }
-       
-       if (netif_queue_stopped(dev)) {
-               printk(KERN_DEBUG "%s: Tx while transmitter busy!\n", 
-                      dev->name);
-               return NETDEV_TX_BUSY;
-       }
-       
-       if (orinoco_lock(priv, &flags) != 0) {
-               printk(KERN_ERR "%s: orinoco_xmit() called while hw_unavailable\n",
-                      dev->name);
-               return NETDEV_TX_BUSY;
-       }
-
-       if (! netif_carrier_ok(dev) || (priv->iw_mode == IW_MODE_MONITOR)) {
-               /* Oops, the firmware hasn't established a connection,
-                   silently drop the packet (this seems to be the
-                   safest approach). */
-               goto drop;
-       }
-
-       /* Check packet length */
-       if (skb->len < ETH_HLEN)
-               goto drop;
-
-       tx_control = HERMES_TXCTRL_TX_OK | HERMES_TXCTRL_TX_EX;
-
-       if (priv->encode_alg == IW_ENCODE_ALG_TKIP)
-               tx_control |= (priv->tx_key << HERMES_MIC_KEY_ID_SHIFT) |
-                       HERMES_TXCTRL_MIC;
-
-       if (priv->has_alt_txcntl) {
-               /* WPA enabled firmwares have tx_cntl at the end of
-                * the 802.11 header.  So write zeroed descriptor and
-                * 802.11 header at the same time
-                */
-               char desc[HERMES_802_3_OFFSET];
-               __le16 *txcntl = (__le16 *) &desc[HERMES_TXCNTL2_OFFSET];
-
-               memset(&desc, 0, sizeof(desc));
-
-               *txcntl = cpu_to_le16(tx_control);
-               err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc),
-                                       txfid, 0);
-               if (err) {
-                       if (net_ratelimit())
-                               printk(KERN_ERR "%s: Error %d writing Tx "
-                                      "descriptor to BAP\n", dev->name, err);
-                       goto busy;
-               }
-       } else {
-               struct hermes_tx_descriptor desc;
-
-               memset(&desc, 0, sizeof(desc));
-
-               desc.tx_control = cpu_to_le16(tx_control);
-               err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc),
-                                       txfid, 0);
-               if (err) {
-                       if (net_ratelimit())
-                               printk(KERN_ERR "%s: Error %d writing Tx "
-                                      "descriptor to BAP\n", dev->name, err);
-                       goto busy;
-               }
-
-               /* Clear the 802.11 header and data length fields - some
-                * firmwares (e.g. Lucent/Agere 8.xx) appear to get confused
-                * if this isn't done. */
-               hermes_clear_words(hw, HERMES_DATA0,
-                                  HERMES_802_3_OFFSET - HERMES_802_11_OFFSET);
-       }
-
-       eh = (struct ethhdr *)skb->data;
-
-       /* Encapsulate Ethernet-II frames */
-       if (ntohs(eh->h_proto) > ETH_DATA_LEN) { /* Ethernet-II frame */
-               struct header_struct {
-                       struct ethhdr eth;      /* 802.3 header */
-                       u8 encap[6];            /* 802.2 header */
-               } __attribute__ ((packed)) hdr;
-
-               /* Strip destination and source from the data */
-               skb_pull(skb, 2 * ETH_ALEN);
-
-               /* And move them to a separate header */
-               memcpy(&hdr.eth, eh, 2 * ETH_ALEN);
-               hdr.eth.h_proto = htons(sizeof(encaps_hdr) + skb->len);
-               memcpy(hdr.encap, encaps_hdr, sizeof(encaps_hdr));
-
-               /* Insert the SNAP header */
-               if (skb_headroom(skb) < sizeof(hdr)) {
-                       printk(KERN_ERR
-                              "%s: Not enough headroom for 802.2 headers %d\n",
-                              dev->name, skb_headroom(skb));
-                       goto drop;
-               }
-               eh = (struct ethhdr *) skb_push(skb, sizeof(hdr));
-               memcpy(eh, &hdr, sizeof(hdr));
-       }
-
-       err = hermes_bap_pwrite(hw, USER_BAP, skb->data, skb->len,
-                               txfid, HERMES_802_3_OFFSET);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d writing packet to BAP\n",
-                      dev->name, err);
-               goto busy;
-       }
-
-       /* Calculate Michael MIC */
-       if (priv->encode_alg == IW_ENCODE_ALG_TKIP) {
-               u8 mic_buf[MICHAEL_MIC_LEN + 1];
-               u8 *mic;
-               size_t offset;
-               size_t len;
-
-               if (skb->len % 2) {
-                       /* MIC start is on an odd boundary */
-                       mic_buf[0] = skb->data[skb->len - 1];
-                       mic = &mic_buf[1];
-                       offset = skb->len - 1;
-                       len = MICHAEL_MIC_LEN + 1;
-               } else {
-                       mic = &mic_buf[0];
-                       offset = skb->len;
-                       len = MICHAEL_MIC_LEN;
-               }
-
-               michael_mic(priv->tx_tfm_mic,
-                           priv->tkip_key[priv->tx_key].tx_mic,
-                           eh->h_dest, eh->h_source, 0 /* priority */,
-                           skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic);
-
-               /* Write the MIC */
-               err = hermes_bap_pwrite(hw, USER_BAP, &mic_buf[0], len,
-                                       txfid, HERMES_802_3_OFFSET + offset);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d writing MIC to BAP\n",
-                              dev->name, err);
-                       goto busy;
-               }
-       }
-
-       /* Finally, we actually initiate the send */
-       netif_stop_queue(dev);
-
-       err = hermes_docmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL,
-                               txfid, NULL);
-       if (err) {
-               netif_start_queue(dev);
-               if (net_ratelimit())
-                       printk(KERN_ERR "%s: Error %d transmitting packet\n",
-                               dev->name, err);
-               goto busy;
-       }
-
-       dev->trans_start = jiffies;
-       stats->tx_bytes += HERMES_802_3_OFFSET + skb->len;
-       goto ok;
-
- drop:
-       stats->tx_errors++;
-       stats->tx_dropped++;
-
- ok:
-       orinoco_unlock(priv, &flags);
-       dev_kfree_skb(skb);
-       return NETDEV_TX_OK;
-
- busy:
-       if (err == -EIO)
-               schedule_work(&priv->reset_work);
-       orinoco_unlock(priv, &flags);
-       return NETDEV_TX_BUSY;
-}
-
-static void __orinoco_ev_alloc(struct net_device *dev, hermes_t *hw)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       u16 fid = hermes_read_regn(hw, ALLOCFID);
-
-       if (fid != priv->txfid) {
-               if (fid != DUMMY_FID)
-                       printk(KERN_WARNING "%s: Allocate event on unexpected fid (%04X)\n",
-                              dev->name, fid);
-               return;
-       }
-
-       hermes_write_regn(hw, ALLOCFID, DUMMY_FID);
-}
-
-static void __orinoco_ev_tx(struct net_device *dev, hermes_t *hw)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct net_device_stats *stats = &priv->stats;
-
-       stats->tx_packets++;
-
-       netif_wake_queue(dev);
-
-       hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
-}
-
-static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct net_device_stats *stats = &priv->stats;
-       u16 fid = hermes_read_regn(hw, TXCOMPLFID);
-       u16 status;
-       struct hermes_txexc_data hdr;
-       int err = 0;
-
-       if (fid == DUMMY_FID)
-               return; /* Nothing's really happened */
-
-       /* Read part of the frame header - we need status and addr1 */
-       err = hermes_bap_pread(hw, IRQ_BAP, &hdr,
-                              sizeof(struct hermes_txexc_data),
-                              fid, 0);
-
-       hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID);
-       stats->tx_errors++;
-
-       if (err) {
-               printk(KERN_WARNING "%s: Unable to read descriptor on Tx error "
-                      "(FID=%04X error %d)\n",
-                      dev->name, fid, err);
-               return;
-       }
-       
-       DEBUG(1, "%s: Tx error, err %d (FID=%04X)\n", dev->name,
-             err, fid);
-    
-       /* We produce a TXDROP event only for retry or lifetime
-        * exceeded, because that's the only status that really mean
-        * that this particular node went away.
-        * Other errors means that *we* screwed up. - Jean II */
-       status = le16_to_cpu(hdr.desc.status);
-       if (status & (HERMES_TXSTAT_RETRYERR | HERMES_TXSTAT_AGEDERR)) {
-               union iwreq_data        wrqu;
-
-               /* Copy 802.11 dest address.
-                * We use the 802.11 header because the frame may
-                * not be 802.3 or may be mangled...
-                * In Ad-Hoc mode, it will be the node address.
-                * In managed mode, it will be most likely the AP addr
-                * User space will figure out how to convert it to
-                * whatever it needs (IP address or else).
-                * - Jean II */
-               memcpy(wrqu.addr.sa_data, hdr.addr1, ETH_ALEN);
-               wrqu.addr.sa_family = ARPHRD_ETHER;
-
-               /* Send event to user space */
-               wireless_send_event(dev, IWEVTXDROP, &wrqu, NULL);
-       }
-
-       netif_wake_queue(dev);
-}
-
-static void orinoco_tx_timeout(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct net_device_stats *stats = &priv->stats;
-       struct hermes *hw = &priv->hw;
-
-       printk(KERN_WARNING "%s: Tx timeout! "
-              "ALLOCFID=%04x, TXCOMPLFID=%04x, EVSTAT=%04x\n",
-              dev->name, hermes_read_regn(hw, ALLOCFID),
-              hermes_read_regn(hw, TXCOMPLFID), hermes_read_regn(hw, EVSTAT));
-
-       stats->tx_errors++;
-
-       schedule_work(&priv->reset_work);
-}
-
-/********************************************************************/
-/* Rx path (data frames)                                            */
-/********************************************************************/
-
-/* Does the frame have a SNAP header indicating it should be
- * de-encapsulated to Ethernet-II? */
-static inline int is_ethersnap(void *_hdr)
-{
-       u8 *hdr = _hdr;
-
-       /* We de-encapsulate all packets which, a) have SNAP headers
-        * (i.e. SSAP=DSAP=0xaa and CTRL=0x3 in the 802.2 LLC header
-        * and where b) the OUI of the SNAP header is 00:00:00 or
-        * 00:00:f8 - we need both because different APs appear to use
-        * different OUIs for some reason */
-       return (memcmp(hdr, &encaps_hdr, 5) == 0)
-               && ( (hdr[5] == 0x00) || (hdr[5] == 0xf8) );
-}
-
-static inline void orinoco_spy_gather(struct net_device *dev, u_char *mac,
-                                     int level, int noise)
-{
-       struct iw_quality wstats;
-       wstats.level = level - 0x95;
-       wstats.noise = noise - 0x95;
-       wstats.qual = (level > noise) ? (level - noise) : 0;
-       wstats.updated = IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
-       /* Update spy records */
-       wireless_spy_update(dev, mac, &wstats);
-}
-
-static void orinoco_stat_gather(struct net_device *dev,
-                               struct sk_buff *skb,
-                               struct hermes_rx_descriptor *desc)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-
-       /* Using spy support with lots of Rx packets, like in an
-        * infrastructure (AP), will really slow down everything, because
-        * the MAC address must be compared to each entry of the spy list.
-        * If the user really asks for it (set some address in the
-        * spy list), we do it, but he will pay the price.
-        * Note that to get here, you need both WIRELESS_SPY
-        * compiled in AND some addresses in the list !!!
-        */
-       /* Note : gcc will optimise the whole section away if
-        * WIRELESS_SPY is not defined... - Jean II */
-       if (SPY_NUMBER(priv)) {
-               orinoco_spy_gather(dev, skb_mac_header(skb) + ETH_ALEN,
-                                  desc->signal, desc->silence);
-       }
-}
-
-/*
- * orinoco_rx_monitor - handle received monitor frames.
- *
- * Arguments:
- *     dev             network device
- *     rxfid           received FID
- *     desc            rx descriptor of the frame
- *
- * Call context: interrupt
- */
-static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid,
-                              struct hermes_rx_descriptor *desc)
-{
-       u32 hdrlen = 30;        /* return full header by default */
-       u32 datalen = 0;
-       u16 fc;
-       int err;
-       int len;
-       struct sk_buff *skb;
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct net_device_stats *stats = &priv->stats;
-       hermes_t *hw = &priv->hw;
-
-       len = le16_to_cpu(desc->data_len);
-
-       /* Determine the size of the header and the data */
-       fc = le16_to_cpu(desc->frame_ctl);
-       switch (fc & IEEE80211_FCTL_FTYPE) {
-       case IEEE80211_FTYPE_DATA:
-               if ((fc & IEEE80211_FCTL_TODS)
-                   && (fc & IEEE80211_FCTL_FROMDS))
-                       hdrlen = 30;
-               else
-                       hdrlen = 24;
-               datalen = len;
-               break;
-       case IEEE80211_FTYPE_MGMT:
-               hdrlen = 24;
-               datalen = len;
-               break;
-       case IEEE80211_FTYPE_CTL:
-               switch (fc & IEEE80211_FCTL_STYPE) {
-               case IEEE80211_STYPE_PSPOLL:
-               case IEEE80211_STYPE_RTS:
-               case IEEE80211_STYPE_CFEND:
-               case IEEE80211_STYPE_CFENDACK:
-                       hdrlen = 16;
-                       break;
-               case IEEE80211_STYPE_CTS:
-               case IEEE80211_STYPE_ACK:
-                       hdrlen = 10;
-                       break;
-               }
-               break;
-       default:
-               /* Unknown frame type */
-               break;
-       }
-
-       /* sanity check the length */
-       if (datalen > IEEE80211_MAX_DATA_LEN + 12) {
-               printk(KERN_DEBUG "%s: oversized monitor frame, "
-                      "data length = %d\n", dev->name, datalen);
-               stats->rx_length_errors++;
-               goto update_stats;
-       }
-
-       skb = dev_alloc_skb(hdrlen + datalen);
-       if (!skb) {
-               printk(KERN_WARNING "%s: Cannot allocate skb for monitor frame\n",
-                      dev->name);
-               goto update_stats;
-       }
-
-       /* Copy the 802.11 header to the skb */
-       memcpy(skb_put(skb, hdrlen), &(desc->frame_ctl), hdrlen);
-       skb_reset_mac_header(skb);
-
-       /* If any, copy the data from the card to the skb */
-       if (datalen > 0) {
-               err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, datalen),
-                                      ALIGN(datalen, 2), rxfid,
-                                      HERMES_802_2_OFFSET);
-               if (err) {
-                       printk(KERN_ERR "%s: error %d reading monitor frame\n",
-                              dev->name, err);
-                       goto drop;
-               }
-       }
-
-       skb->dev = dev;
-       skb->ip_summed = CHECKSUM_NONE;
-       skb->pkt_type = PACKET_OTHERHOST;
-       skb->protocol = __constant_htons(ETH_P_802_2);
-       
-       stats->rx_packets++;
-       stats->rx_bytes += skb->len;
-
-       netif_rx(skb);
-       return;
-
- drop:
-       dev_kfree_skb_irq(skb);
- update_stats:
-       stats->rx_errors++;
-       stats->rx_dropped++;
-}
-
-/* Get tsc from the firmware */
-static int orinoco_hw_get_tkip_iv(struct orinoco_private *priv, int key,
-                                 u8 *tsc)
-{
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       u8 tsc_arr[4][IW_ENCODE_SEQ_MAX_SIZE];
-
-       if ((key < 0) || (key > 4))
-               return -EINVAL;
-
-       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_TKIP_IV,
-                             sizeof(tsc_arr), NULL, &tsc_arr);
-       if (!err)
-               memcpy(tsc, &tsc_arr[key][0], sizeof(tsc_arr[0]));
-
-       return err;
-}
-
-static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct net_device_stats *stats = &priv->stats;
-       struct iw_statistics *wstats = &priv->wstats;
-       struct sk_buff *skb = NULL;
-       u16 rxfid, status;
-       int length;
-       struct hermes_rx_descriptor *desc;
-       struct orinoco_rx_data *rx_data;
-       int err;
-
-       desc = kmalloc(sizeof(*desc), GFP_ATOMIC);
-       if (!desc) {
-               printk(KERN_WARNING
-                      "%s: Can't allocate space for RX descriptor\n",
-                      dev->name);
-               goto update_stats;
-       }
-
-       rxfid = hermes_read_regn(hw, RXFID);
-
-       err = hermes_bap_pread(hw, IRQ_BAP, desc, sizeof(*desc),
-                              rxfid, 0);
-       if (err) {
-               printk(KERN_ERR "%s: error %d reading Rx descriptor. "
-                      "Frame dropped.\n", dev->name, err);
-               goto update_stats;
-       }
-
-       status = le16_to_cpu(desc->status);
-
-       if (status & HERMES_RXSTAT_BADCRC) {
-               DEBUG(1, "%s: Bad CRC on Rx. Frame dropped.\n",
-                     dev->name);
-               stats->rx_crc_errors++;
-               goto update_stats;
-       }
-
-       /* Handle frames in monitor mode */
-       if (priv->iw_mode == IW_MODE_MONITOR) {
-               orinoco_rx_monitor(dev, rxfid, desc);
-               goto out;
-       }
-
-       if (status & HERMES_RXSTAT_UNDECRYPTABLE) {
-               DEBUG(1, "%s: Undecryptable frame on Rx. Frame dropped.\n",
-                     dev->name);
-               wstats->discard.code++;
-               goto update_stats;
-       }
-
-       length = le16_to_cpu(desc->data_len);
-
-       /* Sanity checks */
-       if (length < 3) { /* No for even an 802.2 LLC header */
-               /* At least on Symbol firmware with PCF we get quite a
-                   lot of these legitimately - Poll frames with no
-                   data. */
-               goto out;
-       }
-       if (length > IEEE80211_MAX_DATA_LEN) {
-               printk(KERN_WARNING "%s: Oversized frame received (%d bytes)\n",
-                      dev->name, length);
-               stats->rx_length_errors++;
-               goto update_stats;
-       }
-
-       /* Payload size does not include Michael MIC. Increase payload
-        * size to read it together with the data. */
-       if (status & HERMES_RXSTAT_MIC)
-               length += MICHAEL_MIC_LEN;
-
-       /* We need space for the packet data itself, plus an ethernet
-          header, plus 2 bytes so we can align the IP header on a
-          32bit boundary, plus 1 byte so we can read in odd length
-          packets from the card, which has an IO granularity of 16
-          bits */  
-       skb = dev_alloc_skb(length+ETH_HLEN+2+1);
-       if (!skb) {
-               printk(KERN_WARNING "%s: Can't allocate skb for Rx\n",
-                      dev->name);
-               goto update_stats;
-       }
-
-       /* We'll prepend the header, so reserve space for it.  The worst
-          case is no decapsulation, when 802.3 header is prepended and
-          nothing is removed.  2 is for aligning the IP header.  */
-       skb_reserve(skb, ETH_HLEN + 2);
-
-       err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, length),
-                              ALIGN(length, 2), rxfid,
-                              HERMES_802_2_OFFSET);
-       if (err) {
-               printk(KERN_ERR "%s: error %d reading frame. "
-                      "Frame dropped.\n", dev->name, err);
-               goto drop;
-       }
-
-       /* Add desc and skb to rx queue */
-       rx_data = kzalloc(sizeof(*rx_data), GFP_ATOMIC);
-       if (!rx_data) {
-               printk(KERN_WARNING "%s: Can't allocate RX packet\n",
-                       dev->name);
-               goto drop;
-       }
-       rx_data->desc = desc;
-       rx_data->skb = skb;
-       list_add_tail(&rx_data->list, &priv->rx_list);
-       tasklet_schedule(&priv->rx_tasklet);
-
-       return;
-
-drop:
-       dev_kfree_skb_irq(skb);
-update_stats:
-       stats->rx_errors++;
-       stats->rx_dropped++;
-out:
-       kfree(desc);
-}
-
-static void orinoco_rx(struct net_device *dev,
-                      struct hermes_rx_descriptor *desc,
-                      struct sk_buff *skb)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct net_device_stats *stats = &priv->stats;
-       u16 status, fc;
-       int length;
-       struct ethhdr *hdr;
-
-       status = le16_to_cpu(desc->status);
-       length = le16_to_cpu(desc->data_len);
-       fc = le16_to_cpu(desc->frame_ctl);
-
-       /* Calculate and check MIC */
-       if (status & HERMES_RXSTAT_MIC) {
-               int key_id = ((status & HERMES_RXSTAT_MIC_KEY_ID) >>
-                             HERMES_MIC_KEY_ID_SHIFT);
-               u8 mic[MICHAEL_MIC_LEN];
-               u8 *rxmic;
-               u8 *src = (fc & IEEE80211_FCTL_FROMDS) ?
-                       desc->addr3 : desc->addr2;
-
-               /* Extract Michael MIC from payload */
-               rxmic = skb->data + skb->len - MICHAEL_MIC_LEN;
-
-               skb_trim(skb, skb->len - MICHAEL_MIC_LEN);
-               length -= MICHAEL_MIC_LEN;
-
-               michael_mic(priv->rx_tfm_mic,
-                           priv->tkip_key[key_id].rx_mic,
-                           desc->addr1,
-                           src,
-                           0, /* priority or QoS? */
-                           skb->data,
-                           skb->len,
-                           &mic[0]);
-
-               if (memcmp(mic, rxmic,
-                          MICHAEL_MIC_LEN)) {
-                       union iwreq_data wrqu;
-                       struct iw_michaelmicfailure wxmic;
-
-                       printk(KERN_WARNING "%s: "
-                              "Invalid Michael MIC in data frame from %pM, "
-                              "using key %i\n",
-                              dev->name, src, key_id);
-
-                       /* TODO: update stats */
-
-                       /* Notify userspace */
-                       memset(&wxmic, 0, sizeof(wxmic));
-                       wxmic.flags = key_id & IW_MICFAILURE_KEY_ID;
-                       wxmic.flags |= (desc->addr1[0] & 1) ?
-                               IW_MICFAILURE_GROUP : IW_MICFAILURE_PAIRWISE;
-                       wxmic.src_addr.sa_family = ARPHRD_ETHER;
-                       memcpy(wxmic.src_addr.sa_data, src, ETH_ALEN);
-
-                       (void) orinoco_hw_get_tkip_iv(priv, key_id,
-                                                     &wxmic.tsc[0]);
-
-                       memset(&wrqu, 0, sizeof(wrqu));
-                       wrqu.data.length = sizeof(wxmic);
-                       wireless_send_event(dev, IWEVMICHAELMICFAILURE, &wrqu,
-                                           (char *) &wxmic);
-
-                       goto drop;
-               }
-       }
-
-       /* Handle decapsulation
-        * In most cases, the firmware tell us about SNAP frames.
-        * For some reason, the SNAP frames sent by LinkSys APs
-        * are not properly recognised by most firmwares.
-        * So, check ourselves */
-       if (length >= ENCAPS_OVERHEAD &&
-           (((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_1042) ||
-            ((status & HERMES_RXSTAT_MSGTYPE) == HERMES_RXSTAT_TUNNEL) ||
-            is_ethersnap(skb->data))) {
-               /* These indicate a SNAP within 802.2 LLC within
-                  802.11 frame which we'll need to de-encapsulate to
-                  the original EthernetII frame. */
-               hdr = (struct ethhdr *)skb_push(skb, ETH_HLEN - ENCAPS_OVERHEAD);
-       } else {
-               /* 802.3 frame - prepend 802.3 header as is */
-               hdr = (struct ethhdr *)skb_push(skb, ETH_HLEN);
-               hdr->h_proto = htons(length);
-       }
-       memcpy(hdr->h_dest, desc->addr1, ETH_ALEN);
-       if (fc & IEEE80211_FCTL_FROMDS)
-               memcpy(hdr->h_source, desc->addr3, ETH_ALEN);
-       else
-               memcpy(hdr->h_source, desc->addr2, ETH_ALEN);
-
-       skb->protocol = eth_type_trans(skb, dev);
-       skb->ip_summed = CHECKSUM_NONE;
-       if (fc & IEEE80211_FCTL_TODS)
-               skb->pkt_type = PACKET_OTHERHOST;
-       
-       /* Process the wireless stats if needed */
-       orinoco_stat_gather(dev, skb, desc);
-
-       /* Pass the packet to the networking stack */
-       netif_rx(skb);
-       stats->rx_packets++;
-       stats->rx_bytes += length;
-
-       return;
-
- drop:
-       dev_kfree_skb(skb);
-       stats->rx_errors++;
-       stats->rx_dropped++;
-}
-
-static void orinoco_rx_isr_tasklet(unsigned long data)
-{
-       struct net_device *dev = (struct net_device *) data;
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct orinoco_rx_data *rx_data, *temp;
-       struct hermes_rx_descriptor *desc;
-       struct sk_buff *skb;
-       unsigned long flags;
-
-       /* orinoco_rx requires the driver lock, and we also need to
-        * protect priv->rx_list, so just hold the lock over the
-        * lot.
-        *
-        * If orinoco_lock fails, we've unplugged the card. In this
-        * case just abort. */
-       if (orinoco_lock(priv, &flags) != 0)
-               return;
-
-       /* extract desc and skb from queue */
-       list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) {
-               desc = rx_data->desc;
-               skb = rx_data->skb;
-               list_del(&rx_data->list);
-               kfree(rx_data);
-
-               orinoco_rx(dev, desc, skb);
-
-               kfree(desc);
-       }
-
-       orinoco_unlock(priv, &flags);
-}
-
-/********************************************************************/
-/* Rx path (info frames)                                            */
-/********************************************************************/
-
-static void print_linkstatus(struct net_device *dev, u16 status)
-{
-       char * s;
-
-       if (suppress_linkstatus)
-               return;
-
-       switch (status) {
-       case HERMES_LINKSTATUS_NOT_CONNECTED:
-               s = "Not Connected";
-               break;
-       case HERMES_LINKSTATUS_CONNECTED:
-               s = "Connected";
-               break;
-       case HERMES_LINKSTATUS_DISCONNECTED:
-               s = "Disconnected";
-               break;
-       case HERMES_LINKSTATUS_AP_CHANGE:
-               s = "AP Changed";
-               break;
-       case HERMES_LINKSTATUS_AP_OUT_OF_RANGE:
-               s = "AP Out of Range";
-               break;
-       case HERMES_LINKSTATUS_AP_IN_RANGE:
-               s = "AP In Range";
-               break;
-       case HERMES_LINKSTATUS_ASSOC_FAILED:
-               s = "Association Failed";
-               break;
-       default:
-               s = "UNKNOWN";
-       }
-       
-       printk(KERN_DEBUG "%s: New link status: %s (%04x)\n",
-              dev->name, s, status);
-}
-
-/* Search scan results for requested BSSID, join it if found */
-static void orinoco_join_ap(struct work_struct *work)
-{
-       struct orinoco_private *priv =
-               container_of(work, struct orinoco_private, join_work);
-       struct net_device *dev = priv->ndev;
-       struct hermes *hw = &priv->hw;
-       int err;
-       unsigned long flags;
-       struct join_req {
-               u8 bssid[ETH_ALEN];
-               __le16 channel;
-       } __attribute__ ((packed)) req;
-       const int atom_len = offsetof(struct prism2_scan_apinfo, atim);
-       struct prism2_scan_apinfo *atom = NULL;
-       int offset = 4;
-       int found = 0;
-       u8 *buf;
-       u16 len;
-
-       /* Allocate buffer for scan results */
-       buf = kmalloc(MAX_SCAN_LEN, GFP_KERNEL);
-       if (! buf)
-               return;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               goto fail_lock;
-
-       /* Sanity checks in case user changed something in the meantime */
-       if (! priv->bssid_fixed)
-               goto out;
-
-       if (strlen(priv->desired_essid) == 0)
-               goto out;
-
-       /* Read scan results from the firmware */
-       err = hermes_read_ltv(hw, USER_BAP,
-                             HERMES_RID_SCANRESULTSTABLE,
-                             MAX_SCAN_LEN, &len, buf);
-       if (err) {
-               printk(KERN_ERR "%s: Cannot read scan results\n",
-                      dev->name);
-               goto out;
-       }
-
-       len = HERMES_RECLEN_TO_BYTES(len);
-
-       /* Go through the scan results looking for the channel of the AP
-        * we were requested to join */
-       for (; offset + atom_len <= len; offset += atom_len) {
-               atom = (struct prism2_scan_apinfo *) (buf + offset);
-               if (memcmp(&atom->bssid, priv->desired_bssid, ETH_ALEN) == 0) {
-                       found = 1;
-                       break;
-               }
-       }
-
-       if (! found) {
-               DEBUG(1, "%s: Requested AP not found in scan results\n",
-                     dev->name);
-               goto out;
-       }
-
-       memcpy(req.bssid, priv->desired_bssid, ETH_ALEN);
-       req.channel = atom->channel;    /* both are little-endian */
-       err = HERMES_WRITE_RECORD(hw, USER_BAP, HERMES_RID_CNFJOINREQUEST,
-                                 &req);
-       if (err)
-               printk(KERN_ERR "%s: Error issuing join request\n", dev->name);
-
- out:
-       orinoco_unlock(priv, &flags);
-
- fail_lock:
-       kfree(buf);
-}
-
-/* Send new BSSID to userspace */
-static void orinoco_send_bssid_wevent(struct orinoco_private *priv)
-{
-       struct net_device *dev = priv->ndev;
-       struct hermes *hw = &priv->hw;
-       union iwreq_data wrqu;
-       int err;
-
-       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID,
-                             ETH_ALEN, NULL, wrqu.ap_addr.sa_data);
-       if (err != 0)
-               return;
-
-       wrqu.ap_addr.sa_family = ARPHRD_ETHER;
-
-       /* Send event to user space */
-       wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
-}
-
-static void orinoco_send_assocreqie_wevent(struct orinoco_private *priv)
-{
-       struct net_device *dev = priv->ndev;
-       struct hermes *hw = &priv->hw;
-       union iwreq_data wrqu;
-       int err;
-       u8 buf[88];
-       u8 *ie;
-
-       if (!priv->has_wpa)
-               return;
-
-       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO,
-                             sizeof(buf), NULL, &buf);
-       if (err != 0)
-               return;
-
-       ie = orinoco_get_wpa_ie(buf, sizeof(buf));
-       if (ie) {
-               int rem = sizeof(buf) - (ie - &buf[0]);
-               wrqu.data.length = ie[1] + 2;
-               if (wrqu.data.length > rem)
-                       wrqu.data.length = rem;
-
-               if (wrqu.data.length)
-                       /* Send event to user space */
-                       wireless_send_event(dev, IWEVASSOCREQIE, &wrqu, ie);
-       }
-}
-
-static void orinoco_send_assocrespie_wevent(struct orinoco_private *priv)
-{
-       struct net_device *dev = priv->ndev;
-       struct hermes *hw = &priv->hw;
-       union iwreq_data wrqu;
-       int err;
-       u8 buf[88]; /* TODO: verify max size or IW_GENERIC_IE_MAX */
-       u8 *ie;
-
-       if (!priv->has_wpa)
-               return;
-
-       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_RESP_INFO,
-                             sizeof(buf), NULL, &buf);
-       if (err != 0)
-               return;
-
-       ie = orinoco_get_wpa_ie(buf, sizeof(buf));
-       if (ie) {
-               int rem = sizeof(buf) - (ie - &buf[0]);
-               wrqu.data.length = ie[1] + 2;
-               if (wrqu.data.length > rem)
-                       wrqu.data.length = rem;
-
-               if (wrqu.data.length)
-                       /* Send event to user space */
-                       wireless_send_event(dev, IWEVASSOCRESPIE, &wrqu, ie);
-       }
-}
-
-static void orinoco_send_wevents(struct work_struct *work)
-{
-       struct orinoco_private *priv =
-               container_of(work, struct orinoco_private, wevent_work);
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return;
-
-       orinoco_send_assocreqie_wevent(priv);
-       orinoco_send_assocrespie_wevent(priv);
-       orinoco_send_bssid_wevent(priv);
-
-       orinoco_unlock(priv, &flags);
-}
-
-static inline void orinoco_clear_scan_results(struct orinoco_private *priv,
-                                             unsigned long scan_age)
-{
-       if (priv->has_ext_scan) {
-               struct xbss_element *bss;
-               struct xbss_element *tmp_bss;
-
-               /* Blow away current list of scan results */
-               list_for_each_entry_safe(bss, tmp_bss, &priv->bss_list, list) {
-                       if (!scan_age ||
-                           time_after(jiffies, bss->last_scanned + scan_age)) {
-                               list_move_tail(&bss->list,
-                                              &priv->bss_free_list);
-                               /* Don't blow away ->list, just BSS data */
-                               memset(&bss->bss, 0, sizeof(bss->bss));
-                               bss->last_scanned = 0;
-                       }
-               }
-       } else {
-               struct bss_element *bss;
-               struct bss_element *tmp_bss;
-
-               /* Blow away current list of scan results */
-               list_for_each_entry_safe(bss, tmp_bss, &priv->bss_list, list) {
-                       if (!scan_age ||
-                           time_after(jiffies, bss->last_scanned + scan_age)) {
-                               list_move_tail(&bss->list,
-                                              &priv->bss_free_list);
-                               /* Don't blow away ->list, just BSS data */
-                               memset(&bss->bss, 0, sizeof(bss->bss));
-                               bss->last_scanned = 0;
-                       }
-               }
-       }
-}
-
-static void orinoco_add_ext_scan_result(struct orinoco_private *priv,
-                                       struct agere_ext_scan_info *atom)
-{
-       struct xbss_element *bss = NULL;
-       int found = 0;
-
-       /* Try to update an existing bss first */
-       list_for_each_entry(bss, &priv->bss_list, list) {
-               if (compare_ether_addr(bss->bss.bssid, atom->bssid))
-                       continue;
-               /* ESSID lengths */
-               if (bss->bss.data[1] != atom->data[1])
-                       continue;
-               if (memcmp(&bss->bss.data[2], &atom->data[2],
-                          atom->data[1]))
-                       continue;
-               found = 1;
-               break;
-       }
-
-       /* Grab a bss off the free list */
-       if (!found && !list_empty(&priv->bss_free_list)) {
-               bss = list_entry(priv->bss_free_list.next,
-                                struct xbss_element, list);
-               list_del(priv->bss_free_list.next);
-
-               list_add_tail(&bss->list, &priv->bss_list);
-       }
-
-       if (bss) {
-               /* Always update the BSS to get latest beacon info */
-               memcpy(&bss->bss, atom, sizeof(bss->bss));
-               bss->last_scanned = jiffies;
-       }
-}
-
-static int orinoco_process_scan_results(struct net_device *dev,
-                                       unsigned char *buf,
-                                       int len)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int                     offset;         /* In the scan data */
-       union hermes_scan_info *atom;
-       int                     atom_len;
-
-       switch (priv->firmware_type) {
-       case FIRMWARE_TYPE_AGERE:
-               atom_len = sizeof(struct agere_scan_apinfo);
-               offset = 0;
-               break;
-       case FIRMWARE_TYPE_SYMBOL:
-               /* Lack of documentation necessitates this hack.
-                * Different firmwares have 68 or 76 byte long atoms.
-                * We try modulo first.  If the length divides by both,
-                * we check what would be the channel in the second
-                * frame for a 68-byte atom.  76-byte atoms have 0 there.
-                * Valid channel cannot be 0.  */
-               if (len % 76)
-                       atom_len = 68;
-               else if (len % 68)
-                       atom_len = 76;
-               else if (len >= 1292 && buf[68] == 0)
-                       atom_len = 76;
-               else
-                       atom_len = 68;
-               offset = 0;
-               break;
-       case FIRMWARE_TYPE_INTERSIL:
-               offset = 4;
-               if (priv->has_hostscan) {
-                       atom_len = le16_to_cpup((__le16 *)buf);
-                       /* Sanity check for atom_len */
-                       if (atom_len < sizeof(struct prism2_scan_apinfo)) {
-                               printk(KERN_ERR "%s: Invalid atom_len in scan "
-                                      "data: %d\n", dev->name, atom_len);
-                               return -EIO;
-                       }
-               } else
-                       atom_len = offsetof(struct prism2_scan_apinfo, atim);
-               break;
-       default:
-               return -EOPNOTSUPP;
-       }
-
-       /* Check that we got an whole number of atoms */
-       if ((len - offset) % atom_len) {
-               printk(KERN_ERR "%s: Unexpected scan data length %d, "
-                      "atom_len %d, offset %d\n", dev->name, len,
-                      atom_len, offset);
-               return -EIO;
-       }
-
-       orinoco_clear_scan_results(priv, msecs_to_jiffies(15000));
-
-       /* Read the entries one by one */
-       for (; offset + atom_len <= len; offset += atom_len) {
-               int found = 0;
-               struct bss_element *bss = NULL;
-
-               /* Get next atom */
-               atom = (union hermes_scan_info *) (buf + offset);
-
-               /* Try to update an existing bss first */
-               list_for_each_entry(bss, &priv->bss_list, list) {
-                       if (compare_ether_addr(bss->bss.a.bssid, atom->a.bssid))
-                               continue;
-                       if (le16_to_cpu(bss->bss.a.essid_len) !=
-                             le16_to_cpu(atom->a.essid_len))
-                               continue;
-                       if (memcmp(bss->bss.a.essid, atom->a.essid,
-                             le16_to_cpu(atom->a.essid_len)))
-                               continue;
-                       found = 1;
-                       break;
-               }
-
-               /* Grab a bss off the free list */
-               if (!found && !list_empty(&priv->bss_free_list)) {
-                       bss = list_entry(priv->bss_free_list.next,
-                                        struct bss_element, list);
-                       list_del(priv->bss_free_list.next);
-
-                       list_add_tail(&bss->list, &priv->bss_list);
-               }
-
-               if (bss) {
-                       /* Always update the BSS to get latest beacon info */
-                       memcpy(&bss->bss, atom, sizeof(bss->bss));
-                       bss->last_scanned = jiffies;
-               }
-       }
-
-       return 0;
-}
-
-static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       u16 infofid;
-       struct {
-               __le16 len;
-               __le16 type;
-       } __attribute__ ((packed)) info;
-       int len, type;
-       int err;
-
-       /* This is an answer to an INQUIRE command that we did earlier,
-        * or an information "event" generated by the card
-        * The controller return to us a pseudo frame containing
-        * the information in question - Jean II */
-       infofid = hermes_read_regn(hw, INFOFID);
-
-       /* Read the info frame header - don't try too hard */
-       err = hermes_bap_pread(hw, IRQ_BAP, &info, sizeof(info),
-                              infofid, 0);
-       if (err) {
-               printk(KERN_ERR "%s: error %d reading info frame. "
-                      "Frame dropped.\n", dev->name, err);
-               return;
-       }
-       
-       len = HERMES_RECLEN_TO_BYTES(le16_to_cpu(info.len));
-       type = le16_to_cpu(info.type);
-
-       switch (type) {
-       case HERMES_INQ_TALLIES: {
-               struct hermes_tallies_frame tallies;
-               struct iw_statistics *wstats = &priv->wstats;
-               
-               if (len > sizeof(tallies)) {
-                       printk(KERN_WARNING "%s: Tallies frame too long (%d bytes)\n",
-                              dev->name, len);
-                       len = sizeof(tallies);
-               }
-               
-               err = hermes_bap_pread(hw, IRQ_BAP, &tallies, len,
-                                      infofid, sizeof(info));
-               if (err)
-                       break;
-               
-               /* Increment our various counters */
-               /* wstats->discard.nwid - no wrong BSSID stuff */
-               wstats->discard.code +=
-                       le16_to_cpu(tallies.RxWEPUndecryptable);
-               if (len == sizeof(tallies))  
-                       wstats->discard.code +=
-                               le16_to_cpu(tallies.RxDiscards_WEPICVError) +
-                               le16_to_cpu(tallies.RxDiscards_WEPExcluded);
-               wstats->discard.misc +=
-                       le16_to_cpu(tallies.TxDiscardsWrongSA);
-               wstats->discard.fragment +=
-                       le16_to_cpu(tallies.RxMsgInBadMsgFragments);
-               wstats->discard.retries +=
-                       le16_to_cpu(tallies.TxRetryLimitExceeded);
-               /* wstats->miss.beacon - no match */
-       }
-       break;
-       case HERMES_INQ_LINKSTATUS: {
-               struct hermes_linkstatus linkstatus;
-               u16 newstatus;
-               int connected;
-
-               if (priv->iw_mode == IW_MODE_MONITOR)
-                       break;
-
-               if (len != sizeof(linkstatus)) {
-                       printk(KERN_WARNING "%s: Unexpected size for linkstatus frame (%d bytes)\n",
-                              dev->name, len);
-                       break;
-               }
-
-               err = hermes_bap_pread(hw, IRQ_BAP, &linkstatus, len,
-                                      infofid, sizeof(info));
-               if (err)
-                       break;
-               newstatus = le16_to_cpu(linkstatus.linkstatus);
-
-               /* Symbol firmware uses "out of range" to signal that
-                * the hostscan frame can be requested.  */
-               if (newstatus == HERMES_LINKSTATUS_AP_OUT_OF_RANGE &&
-                   priv->firmware_type == FIRMWARE_TYPE_SYMBOL &&
-                   priv->has_hostscan && priv->scan_inprogress) {
-                       hermes_inquire(hw, HERMES_INQ_HOSTSCAN_SYMBOL);
-                       break;
-               }
-
-               connected = (newstatus == HERMES_LINKSTATUS_CONNECTED)
-                       || (newstatus == HERMES_LINKSTATUS_AP_CHANGE)
-                       || (newstatus == HERMES_LINKSTATUS_AP_IN_RANGE);
-
-               if (connected)
-                       netif_carrier_on(dev);
-               else if (!ignore_disconnect)
-                       netif_carrier_off(dev);
-
-               if (newstatus != priv->last_linkstatus) {
-                       priv->last_linkstatus = newstatus;
-                       print_linkstatus(dev, newstatus);
-                       /* The info frame contains only one word which is the
-                        * status (see hermes.h). The status is pretty boring
-                        * in itself, that's why we export the new BSSID...
-                        * Jean II */
-                       schedule_work(&priv->wevent_work);
-               }
-       }
-       break;
-       case HERMES_INQ_SCAN:
-               if (!priv->scan_inprogress && priv->bssid_fixed &&
-                   priv->firmware_type == FIRMWARE_TYPE_INTERSIL) {
-                       schedule_work(&priv->join_work);
-                       break;
-               }
-               /* fall through */
-       case HERMES_INQ_HOSTSCAN:
-       case HERMES_INQ_HOSTSCAN_SYMBOL: {
-               /* Result of a scanning. Contains information about
-                * cells in the vicinity - Jean II */
-               union iwreq_data        wrqu;
-               unsigned char *buf;
-
-               /* Scan is no longer in progress */
-               priv->scan_inprogress = 0;
-
-               /* Sanity check */
-               if (len > 4096) {
-                       printk(KERN_WARNING "%s: Scan results too large (%d bytes)\n",
-                              dev->name, len);
-                       break;
-               }
-
-               /* Allocate buffer for results */
-               buf = kmalloc(len, GFP_ATOMIC);
-               if (buf == NULL)
-                       /* No memory, so can't printk()... */
-                       break;
-
-               /* Read scan data */
-               err = hermes_bap_pread(hw, IRQ_BAP, (void *) buf, len,
-                                      infofid, sizeof(info));
-               if (err) {
-                       kfree(buf);
-                       break;
-               }
-
-#ifdef ORINOCO_DEBUG
-               {
-                       int     i;
-                       printk(KERN_DEBUG "Scan result [%02X", buf[0]);
-                       for(i = 1; i < (len * 2); i++)
-                               printk(":%02X", buf[i]);
-                       printk("]\n");
-               }
-#endif /* ORINOCO_DEBUG */
-
-               if (orinoco_process_scan_results(dev, buf, len) == 0) {
-                       /* Send an empty event to user space.
-                        * We don't send the received data on the event because
-                        * it would require us to do complex transcoding, and
-                        * we want to minimise the work done in the irq handler
-                        * Use a request to extract the data - Jean II */
-                       wrqu.data.length = 0;
-                       wrqu.data.flags = 0;
-                       wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
-               }
-               kfree(buf);
-       }
-       break;
-       case HERMES_INQ_CHANNELINFO:
-       {
-               struct agere_ext_scan_info *bss;
-
-               if (!priv->scan_inprogress) {
-                       printk(KERN_DEBUG "%s: Got chaninfo without scan, "
-                              "len=%d\n", dev->name, len);
-                       break;
-               }
-
-               /* An empty result indicates that the scan is complete */
-               if (len == 0) {
-                       union iwreq_data        wrqu;
-
-                       /* Scan is no longer in progress */
-                       priv->scan_inprogress = 0;
-
-                       wrqu.data.length = 0;
-                       wrqu.data.flags = 0;
-                       wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
-                       break;
-               }
-
-               /* Sanity check */
-               else if (len > sizeof(*bss)) {
-                       printk(KERN_WARNING
-                              "%s: Ext scan results too large (%d bytes). "
-                              "Truncating results to %zd bytes.\n",
-                              dev->name, len, sizeof(*bss));
-                       len = sizeof(*bss);
-               } else if (len < (offsetof(struct agere_ext_scan_info,
-                                          data) + 2)) {
-                       /* Drop this result now so we don't have to
-                        * keep checking later */
-                       printk(KERN_WARNING
-                              "%s: Ext scan results too short (%d bytes)\n",
-                              dev->name, len);
-                       break;
-               }
-
-               bss = kmalloc(sizeof(*bss), GFP_ATOMIC);
-               if (bss == NULL)
-                       break;
-
-               /* Read scan data */
-               err = hermes_bap_pread(hw, IRQ_BAP, (void *) bss, len,
-                                      infofid, sizeof(info));
-               if (err) {
-                       kfree(bss);
-                       break;
-               }
-
-               orinoco_add_ext_scan_result(priv, bss);
-
-               kfree(bss);
-               break;
-       }
-       case HERMES_INQ_SEC_STAT_AGERE:
-               /* Security status (Agere specific) */
-               /* Ignore this frame for now */
-               if (priv->firmware_type == FIRMWARE_TYPE_AGERE)
-                       break;
-               /* fall through */
-       default:
-               printk(KERN_DEBUG "%s: Unknown information frame received: "
-                      "type 0x%04x, length %d\n", dev->name, type, len);
-               /* We don't actually do anything about it */
-               break;
-       }
-}
-
-static void __orinoco_ev_infdrop(struct net_device *dev, hermes_t *hw)
-{
-       if (net_ratelimit())
-               printk(KERN_DEBUG "%s: Information frame lost.\n", dev->name);
-}
-
-/********************************************************************/
-/* Internal hardware control routines                               */
-/********************************************************************/
-
-int __orinoco_up(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct hermes *hw = &priv->hw;
-       int err;
-
-       netif_carrier_off(dev); /* just to make sure */
-
-       err = __orinoco_program_rids(dev);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d configuring card\n",
-                      dev->name, err);
-               return err;
-       }
-
-       /* Fire things up again */
-       hermes_set_irqmask(hw, ORINOCO_INTEN);
-       err = hermes_enable_port(hw, 0);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d enabling MAC port\n",
-                      dev->name, err);
-               return err;
-       }
-
-       netif_start_queue(dev);
-
-       return 0;
-}
-
-int __orinoco_down(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct hermes *hw = &priv->hw;
-       int err;
-
-       netif_stop_queue(dev);
-
-       if (! priv->hw_unavailable) {
-               if (! priv->broken_disableport) {
-                       err = hermes_disable_port(hw, 0);
-                       if (err) {
-                               /* Some firmwares (e.g. Intersil 1.3.x) seem
-                                * to have problems disabling the port, oh
-                                * well, too bad. */
-                               printk(KERN_WARNING "%s: Error %d disabling MAC port\n",
-                                      dev->name, err);
-                               priv->broken_disableport = 1;
-                       }
-               }
-               hermes_set_irqmask(hw, 0);
-               hermes_write_regn(hw, EVACK, 0xffff);
-       }
-       
-       /* firmware will have to reassociate */
-       netif_carrier_off(dev);
-       priv->last_linkstatus = 0xffff;
-
-       return 0;
-}
-
-static int orinoco_allocate_fid(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct hermes *hw = &priv->hw;
-       int err;
-
-       err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
-       if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) {
-               /* Try workaround for old Symbol firmware bug */
-               printk(KERN_WARNING "%s: firmware ALLOC bug detected "
-                      "(old Symbol firmware?). Trying to work around... ",
-                      dev->name);
-               
-               priv->nicbuf_size = TX_NICBUF_SIZE_BUG;
-               err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid);
-               if (err)
-                       printk("failed!\n");
-               else
-                       printk("ok.\n");
-       }
-
-       return err;
-}
-
-int orinoco_reinit_firmware(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct hermes *hw = &priv->hw;
-       int err;
-
-       err = hermes_init(hw);
-       if (priv->do_fw_download && !err) {
-               err = orinoco_download(priv);
-               if (err)
-                       priv->do_fw_download = 0;
-       }
-       if (!err)
-               err = orinoco_allocate_fid(dev);
-
-       return err;
-}
-
-static int __orinoco_hw_set_bitrate(struct orinoco_private *priv)
-{
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-
-       if (priv->bitratemode >= BITRATE_TABLE_SIZE) {
-               printk(KERN_ERR "%s: BUG: Invalid bitrate mode %d\n",
-                      priv->ndev->name, priv->bitratemode);
-               return -EINVAL;
-       }
-
-       switch (priv->firmware_type) {
-       case FIRMWARE_TYPE_AGERE:
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFTXRATECONTROL,
-                                          bitrate_table[priv->bitratemode].agere_txratectrl);
-               break;
-       case FIRMWARE_TYPE_INTERSIL:
-       case FIRMWARE_TYPE_SYMBOL:
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFTXRATECONTROL,
-                                          bitrate_table[priv->bitratemode].intersil_txratectrl);
-               break;
-       default:
-               BUG();
-       }
-
-       return err;
-}
-
-/* Set fixed AP address */
-static int __orinoco_hw_set_wap(struct orinoco_private *priv)
-{
-       int roaming_flag;
-       int err = 0;
-       hermes_t *hw = &priv->hw;
-
-       switch (priv->firmware_type) {
-       case FIRMWARE_TYPE_AGERE:
-               /* not supported */
-               break;
-       case FIRMWARE_TYPE_INTERSIL:
-               if (priv->bssid_fixed)
-                       roaming_flag = 2;
-               else
-                       roaming_flag = 1;
-
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFROAMINGMODE,
-                                          roaming_flag);
-               break;
-       case FIRMWARE_TYPE_SYMBOL:
-               err = HERMES_WRITE_RECORD(hw, USER_BAP,
-                                         HERMES_RID_CNFMANDATORYBSSID_SYMBOL,
-                                         &priv->desired_bssid);
-               break;
-       }
-       return err;
-}
-
-/* Change the WEP keys and/or the current keys.  Can be called
- * either from __orinoco_hw_setup_enc() or directly from
- * orinoco_ioctl_setiwencode().  In the later case the association
- * with the AP is not broken (if the firmware can handle it),
- * which is needed for 802.1x implementations. */
-static int __orinoco_hw_setup_wepkeys(struct orinoco_private *priv)
-{
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-
-       switch (priv->firmware_type) {
-       case FIRMWARE_TYPE_AGERE:
-               err = HERMES_WRITE_RECORD(hw, USER_BAP,
-                                         HERMES_RID_CNFWEPKEYS_AGERE,
-                                         &priv->keys);
-               if (err)
-                       return err;
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFTXKEY_AGERE,
-                                          priv->tx_key);
-               if (err)
-                       return err;
-               break;
-       case FIRMWARE_TYPE_INTERSIL:
-       case FIRMWARE_TYPE_SYMBOL:
-               {
-                       int keylen;
-                       int i;
-
-                       /* Force uniform key length to work around firmware bugs */
-                       keylen = le16_to_cpu(priv->keys[priv->tx_key].len);
-                       
-                       if (keylen > LARGE_KEY_SIZE) {
-                               printk(KERN_ERR "%s: BUG: Key %d has oversize length %d.\n",
-                                      priv->ndev->name, priv->tx_key, keylen);
-                               return -E2BIG;
-                       }
-
-                       /* Write all 4 keys */
-                       for(i = 0; i < ORINOCO_MAX_KEYS; i++) {
-                               err = hermes_write_ltv(hw, USER_BAP,
-                                                      HERMES_RID_CNFDEFAULTKEY0 + i,
-                                                      HERMES_BYTES_TO_RECLEN(keylen),
-                                                      priv->keys[i].data);
-                               if (err)
-                                       return err;
-                       }
-
-                       /* Write the index of the key used in transmission */
-                       err = hermes_write_wordrec(hw, USER_BAP,
-                                                  HERMES_RID_CNFWEPDEFAULTKEYID,
-                                                  priv->tx_key);
-                       if (err)
-                               return err;
-               }
-               break;
-       }
-
-       return 0;
-}
-
-static int __orinoco_hw_setup_enc(struct orinoco_private *priv)
-{
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       int master_wep_flag;
-       int auth_flag;
-       int enc_flag;
-
-       /* Setup WEP keys for WEP and WPA */
-       if (priv->encode_alg)
-               __orinoco_hw_setup_wepkeys(priv);
-
-       if (priv->wep_restrict)
-               auth_flag = HERMES_AUTH_SHARED_KEY;
-       else
-               auth_flag = HERMES_AUTH_OPEN;
-
-       if (priv->wpa_enabled)
-               enc_flag = 2;
-       else if (priv->encode_alg == IW_ENCODE_ALG_WEP)
-               enc_flag = 1;
-       else
-               enc_flag = 0;
-
-       switch (priv->firmware_type) {
-       case FIRMWARE_TYPE_AGERE: /* Agere style WEP */
-               if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
-                       /* Enable the shared-key authentication. */
-                       err = hermes_write_wordrec(hw, USER_BAP,
-                                                  HERMES_RID_CNFAUTHENTICATION_AGERE,
-                                                  auth_flag);
-               }
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFWEPENABLED_AGERE,
-                                          enc_flag);
-               if (err)
-                       return err;
-
-               if (priv->has_wpa) {
-                       /* Set WPA key management */
-                       err = hermes_write_wordrec(hw, USER_BAP,
-                                 HERMES_RID_CNFSETWPAAUTHMGMTSUITE_AGERE,
-                                 priv->key_mgmt);
-                       if (err)
-                               return err;
-               }
-
-               break;
-
-       case FIRMWARE_TYPE_INTERSIL: /* Intersil style WEP */
-       case FIRMWARE_TYPE_SYMBOL: /* Symbol style WEP */
-               if (priv->encode_alg == IW_ENCODE_ALG_WEP) {
-                       if (priv->wep_restrict ||
-                           (priv->firmware_type == FIRMWARE_TYPE_SYMBOL))
-                               master_wep_flag = HERMES_WEP_PRIVACY_INVOKED |
-                                                 HERMES_WEP_EXCL_UNENCRYPTED;
-                       else
-                               master_wep_flag = HERMES_WEP_PRIVACY_INVOKED;
-
-                       err = hermes_write_wordrec(hw, USER_BAP,
-                                                  HERMES_RID_CNFAUTHENTICATION,
-                                                  auth_flag);
-                       if (err)
-                               return err;
-               } else
-                       master_wep_flag = 0;
-
-               if (priv->iw_mode == IW_MODE_MONITOR)
-                       master_wep_flag |= HERMES_WEP_HOST_DECRYPT;
-
-               /* Master WEP setting : on/off */
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFWEPFLAGS_INTERSIL,
-                                          master_wep_flag);
-               if (err)
-                       return err;     
-
-               break;
-       }
-
-       return 0;
-}
-
-/* key must be 32 bytes, including the tx and rx MIC keys.
- * rsc must be 8 bytes
- * tsc must be 8 bytes or NULL
- */
-static int __orinoco_hw_set_tkip_key(hermes_t *hw, int key_idx, int set_tx,
-                                    u8 *key, u8 *rsc, u8 *tsc)
-{
-       struct {
-               __le16 idx;
-               u8 rsc[IW_ENCODE_SEQ_MAX_SIZE];
-               u8 key[TKIP_KEYLEN];
-               u8 tx_mic[MIC_KEYLEN];
-               u8 rx_mic[MIC_KEYLEN];
-               u8 tsc[IW_ENCODE_SEQ_MAX_SIZE];
-       } __attribute__ ((packed)) buf;
-       int ret;
-       int err;
-       int k;
-       u16 xmitting;
-
-       key_idx &= 0x3;
-
-       if (set_tx)
-               key_idx |= 0x8000;
-
-       buf.idx = cpu_to_le16(key_idx);
-       memcpy(buf.key, key,
-              sizeof(buf.key) + sizeof(buf.tx_mic) + sizeof(buf.rx_mic));
-
-       if (rsc == NULL)
-               memset(buf.rsc, 0, sizeof(buf.rsc));
-       else
-               memcpy(buf.rsc, rsc, sizeof(buf.rsc));
-
-       if (tsc == NULL) {
-               memset(buf.tsc, 0, sizeof(buf.tsc));
-               buf.tsc[4] = 0x10;
-       } else {
-               memcpy(buf.tsc, tsc, sizeof(buf.tsc));
-       }
-
-       /* Wait upto 100ms for tx queue to empty */
-       k = 100;
-       do {
-               k--;
-               udelay(1000);
-               ret = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_TXQUEUEEMPTY,
-                                         &xmitting);
-               if (ret)
-                       break;
-       } while ((k > 0) && xmitting);
-
-       if (k == 0)
-               ret = -ETIMEDOUT;
-
-       err = HERMES_WRITE_RECORD(hw, USER_BAP,
-                                 HERMES_RID_CNFADDDEFAULTTKIPKEY_AGERE,
-                                 &buf);
-
-       return ret ? ret : err;
-}
-
-static int orinoco_clear_tkip_key(struct orinoco_private *priv,
-                                 int key_idx)
-{
-       hermes_t *hw = &priv->hw;
-       int err;
-
-       memset(&priv->tkip_key[key_idx], 0, sizeof(priv->tkip_key[key_idx]));
-       err = hermes_write_wordrec(hw, USER_BAP,
-                                  HERMES_RID_CNFREMDEFAULTTKIPKEY_AGERE,
-                                  key_idx);
-       if (err)
-               printk(KERN_WARNING "%s: Error %d clearing TKIP key %d\n",
-                      priv->ndev->name, err, key_idx);
-       return err;
-}
-
-static int __orinoco_program_rids(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int err;
-       struct hermes_idstring idbuf;
-
-       /* Set the MAC address */
-       err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR,
-                              HERMES_BYTES_TO_RECLEN(ETH_ALEN), dev->dev_addr);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting MAC address\n",
-                      dev->name, err);
-               return err;
-       }
-
-       /* Set up the link mode */
-       err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNFPORTTYPE,
-                                  priv->port_type);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting port type\n",
-                      dev->name, err);
-               return err;
-       }
-       /* Set the channel/frequency */
-       if (priv->channel != 0 && priv->iw_mode != IW_MODE_INFRA) {
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFOWNCHANNEL,
-                                          priv->channel);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d setting channel %d\n",
-                              dev->name, err, priv->channel);
-                       return err;
-               }
-       }
-
-       if (priv->has_ibss) {
-               u16 createibss;
-
-               if ((strlen(priv->desired_essid) == 0) && (priv->createibss)) {
-                       printk(KERN_WARNING "%s: This firmware requires an "
-                              "ESSID in IBSS-Ad-Hoc mode.\n", dev->name);
-                       /* With wvlan_cs, in this case, we would crash.
-                        * hopefully, this driver will behave better...
-                        * Jean II */
-                       createibss = 0;
-               } else {
-                       createibss = priv->createibss;
-               }
-               
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFCREATEIBSS,
-                                          createibss);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d setting CREATEIBSS\n",
-                              dev->name, err);
-                       return err;
-               }
-       }
-
-       /* Set the desired BSSID */
-       err = __orinoco_hw_set_wap(priv);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting AP address\n",
-                      dev->name, err);
-               return err;
-       }
-       /* Set the desired ESSID */
-       idbuf.len = cpu_to_le16(strlen(priv->desired_essid));
-       memcpy(&idbuf.val, priv->desired_essid, sizeof(idbuf.val));
-       /* WinXP wants partner to configure OWNSSID even in IBSS mode. (jimc) */
-       err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNSSID,
-                              HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid)+2),
-                              &idbuf);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting OWNSSID\n",
-                      dev->name, err);
-               return err;
-       }
-       err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFDESIREDSSID,
-                              HERMES_BYTES_TO_RECLEN(strlen(priv->desired_essid)+2),
-                              &idbuf);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting DESIREDSSID\n",
-                      dev->name, err);
-               return err;
-       }
-
-       /* Set the station name */
-       idbuf.len = cpu_to_le16(strlen(priv->nick));
-       memcpy(&idbuf.val, priv->nick, sizeof(idbuf.val));
-       err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME,
-                              HERMES_BYTES_TO_RECLEN(strlen(priv->nick)+2),
-                              &idbuf);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting nickname\n",
-                      dev->name, err);
-               return err;
-       }
-
-       /* Set AP density */
-       if (priv->has_sensitivity) {
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFSYSTEMSCALE,
-                                          priv->ap_density);
-               if (err) {
-                       printk(KERN_WARNING "%s: Error %d setting SYSTEMSCALE.  "
-                              "Disabling sensitivity control\n",
-                              dev->name, err);
-
-                       priv->has_sensitivity = 0;
-               }
-       }
-
-       /* Set RTS threshold */
-       err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD,
-                                  priv->rts_thresh);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting RTS threshold\n",
-                      dev->name, err);
-               return err;
-       }
-
-       /* Set fragmentation threshold or MWO robustness */
-       if (priv->has_mwo)
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFMWOROBUST_AGERE,
-                                          priv->mwo_robust);
-       else
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
-                                          priv->frag_thresh);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting fragmentation\n",
-                      dev->name, err);
-               return err;
-       }
-
-       /* Set bitrate */
-       err = __orinoco_hw_set_bitrate(priv);
-       if (err) {
-               printk(KERN_ERR "%s: Error %d setting bitrate\n",
-                      dev->name, err);
-               return err;
-       }
-
-       /* Set power management */
-       if (priv->has_pm) {
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFPMENABLED,
-                                          priv->pm_on);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d setting up PM\n",
-                              dev->name, err);
-                       return err;
-               }
-
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFMULTICASTRECEIVE,
-                                          priv->pm_mcast);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d setting up PM\n",
-                              dev->name, err);
-                       return err;
-               }
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFMAXSLEEPDURATION,
-                                          priv->pm_period);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d setting up PM\n",
-                              dev->name, err);
-                       return err;
-               }
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFPMHOLDOVERDURATION,
-                                          priv->pm_timeout);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d setting up PM\n",
-                              dev->name, err);
-                       return err;
-               }
-       }
-
-       /* Set preamble - only for Symbol so far... */
-       if (priv->has_preamble) {
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFPREAMBLE_SYMBOL,
-                                          priv->preamble);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d setting preamble\n",
-                              dev->name, err);
-                       return err;
-               }
-       }
-
-       /* Set up encryption */
-       if (priv->has_wep || priv->has_wpa) {
-               err = __orinoco_hw_setup_enc(priv);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d activating encryption\n",
-                              dev->name, err);
-                       return err;
-               }
-       }
-
-       if (priv->iw_mode == IW_MODE_MONITOR) {
-               /* Enable monitor mode */
-               dev->type = ARPHRD_IEEE80211;
-               err = hermes_docmd_wait(hw, HERMES_CMD_TEST | 
-                                           HERMES_TEST_MONITOR, 0, NULL);
-       } else {
-               /* Disable monitor mode */
-               dev->type = ARPHRD_ETHER;
-               err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
-                                           HERMES_TEST_STOP, 0, NULL);
-       }
-       if (err)
-               return err;
-
-       /* Set promiscuity / multicast*/
-       priv->promiscuous = 0;
-       priv->mc_count = 0;
-
-       /* FIXME: what about netif_tx_lock */
-       __orinoco_set_multicast_list(dev);
-
-       return 0;
-}
-
-/* FIXME: return int? */
-static void
-__orinoco_set_multicast_list(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       int promisc, mc_count;
-
-       /* The Hermes doesn't seem to have an allmulti mode, so we go
-        * into promiscuous mode and let the upper levels deal. */
-       if ( (dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI) ||
-            (dev->mc_count > MAX_MULTICAST(priv)) ) {
-               promisc = 1;
-               mc_count = 0;
-       } else {
-               promisc = 0;
-               mc_count = dev->mc_count;
-       }
-
-       if (promisc != priv->promiscuous) {
-               err = hermes_write_wordrec(hw, USER_BAP,
-                                          HERMES_RID_CNFPROMISCUOUSMODE,
-                                          promisc);
-               if (err) {
-                       printk(KERN_ERR "%s: Error %d setting PROMISCUOUSMODE to 1.\n",
-                              dev->name, err);
-               } else 
-                       priv->promiscuous = promisc;
-       }
-
-       /* If we're not in promiscuous mode, then we need to set the
-        * group address if either we want to multicast, or if we were
-        * multicasting and want to stop */
-       if (! promisc && (mc_count || priv->mc_count) ) {
-               struct dev_mc_list *p = dev->mc_list;
-               struct hermes_multicast mclist;
-               int i;
-
-               for (i = 0; i < mc_count; i++) {
-                       /* paranoia: is list shorter than mc_count? */
-                       BUG_ON(! p);
-                       /* paranoia: bad address size in list? */
-                       BUG_ON(p->dmi_addrlen != ETH_ALEN);
-                       
-                       memcpy(mclist.addr[i], p->dmi_addr, ETH_ALEN);
-                       p = p->next;
-               }
-               
-               if (p)
-                       printk(KERN_WARNING "%s: Multicast list is "
-                              "longer than mc_count\n", dev->name);
-
-               err = hermes_write_ltv(hw, USER_BAP,
-                                  HERMES_RID_CNFGROUPADDRESSES,
-                                  HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN),
-                                  &mclist);
-               if (err)
-                       printk(KERN_ERR "%s: Error %d setting multicast list.\n",
-                              dev->name, err);
-               else
-                       priv->mc_count = mc_count;
-       }
-}
-
-/* This must be called from user context, without locks held - use
- * schedule_work() */
-static void orinoco_reset(struct work_struct *work)
-{
-       struct orinoco_private *priv =
-               container_of(work, struct orinoco_private, reset_work);
-       struct net_device *dev = priv->ndev;
-       struct hermes *hw = &priv->hw;
-       int err;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               /* When the hardware becomes available again, whatever
-                * detects that is responsible for re-initializing
-                * it. So no need for anything further */
-               return;
-
-       netif_stop_queue(dev);
-
-       /* Shut off interrupts.  Depending on what state the hardware
-        * is in, this might not work, but we'll try anyway */
-       hermes_set_irqmask(hw, 0);
-       hermes_write_regn(hw, EVACK, 0xffff);
-
-       priv->hw_unavailable++;
-       priv->last_linkstatus = 0xffff; /* firmware will have to reassociate */
-       netif_carrier_off(dev);
-
-       orinoco_unlock(priv, &flags);
-
-       /* Scanning support: Cleanup of driver struct */
-       orinoco_clear_scan_results(priv, 0);
-       priv->scan_inprogress = 0;
-
-       if (priv->hard_reset) {
-               err = (*priv->hard_reset)(priv);
-               if (err) {
-                       printk(KERN_ERR "%s: orinoco_reset: Error %d "
-                              "performing hard reset\n", dev->name, err);
-                       goto disable;
-               }
-       }
-
-       err = orinoco_reinit_firmware(dev);
-       if (err) {
-               printk(KERN_ERR "%s: orinoco_reset: Error %d re-initializing firmware\n",
-                      dev->name, err);
-               goto disable;
-       }
-
-       spin_lock_irq(&priv->lock); /* This has to be called from user context */
-
-       priv->hw_unavailable--;
-
-       /* priv->open or priv->hw_unavailable might have changed while
-        * we dropped the lock */
-       if (priv->open && (! priv->hw_unavailable)) {
-               err = __orinoco_up(dev);
-               if (err) {
-                       printk(KERN_ERR "%s: orinoco_reset: Error %d reenabling card\n",
-                              dev->name, err);
-               } else
-                       dev->trans_start = jiffies;
-       }
-
-       spin_unlock_irq(&priv->lock);
-
-       return;
- disable:
-       hermes_set_irqmask(hw, 0);
-       netif_device_detach(dev);
-       printk(KERN_ERR "%s: Device has been disabled!\n", dev->name);
-}
-
-/********************************************************************/
-/* Interrupt handler                                                */
-/********************************************************************/
-
-static void __orinoco_ev_tick(struct net_device *dev, hermes_t *hw)
-{
-       printk(KERN_DEBUG "%s: TICK\n", dev->name);
-}
-
-static void __orinoco_ev_wterr(struct net_device *dev, hermes_t *hw)
-{
-       /* This seems to happen a fair bit under load, but ignoring it
-          seems to work fine...*/
-       printk(KERN_DEBUG "%s: MAC controller error (WTERR). Ignoring.\n",
-              dev->name);
-}
-
-irqreturn_t orinoco_interrupt(int irq, void *dev_id)
-{
-       struct net_device *dev = dev_id;
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int count = MAX_IRQLOOPS_PER_IRQ;
-       u16 evstat, events;
-       /* These are used to detect a runaway interrupt situation */
-       /* If we get more than MAX_IRQLOOPS_PER_JIFFY iterations in a jiffy,
-        * we panic and shut down the hardware */
-       static int last_irq_jiffy = 0; /* jiffies value the last time
-                                       * we were called */
-       static int loops_this_jiffy = 0;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0) {
-               /* If hw is unavailable - we don't know if the irq was
-                * for us or not */
-               return IRQ_HANDLED;
-       }
-
-       evstat = hermes_read_regn(hw, EVSTAT);
-       events = evstat & hw->inten;
-       if (! events) {
-               orinoco_unlock(priv, &flags);
-               return IRQ_NONE;
-       }
-       
-       if (jiffies != last_irq_jiffy)
-               loops_this_jiffy = 0;
-       last_irq_jiffy = jiffies;
-
-       while (events && count--) {
-               if (++loops_this_jiffy > MAX_IRQLOOPS_PER_JIFFY) {
-                       printk(KERN_WARNING "%s: IRQ handler is looping too "
-                              "much! Resetting.\n", dev->name);
-                       /* Disable interrupts for now */
-                       hermes_set_irqmask(hw, 0);
-                       schedule_work(&priv->reset_work);
-                       break;
-               }
-
-               /* Check the card hasn't been removed */
-               if (! hermes_present(hw)) {
-                       DEBUG(0, "orinoco_interrupt(): card removed\n");
-                       break;
-               }
-
-               if (events & HERMES_EV_TICK)
-                       __orinoco_ev_tick(dev, hw);
-               if (events & HERMES_EV_WTERR)
-                       __orinoco_ev_wterr(dev, hw);
-               if (events & HERMES_EV_INFDROP)
-                       __orinoco_ev_infdrop(dev, hw);
-               if (events & HERMES_EV_INFO)
-                       __orinoco_ev_info(dev, hw);
-               if (events & HERMES_EV_RX)
-                       __orinoco_ev_rx(dev, hw);
-               if (events & HERMES_EV_TXEXC)
-                       __orinoco_ev_txexc(dev, hw);
-               if (events & HERMES_EV_TX)
-                       __orinoco_ev_tx(dev, hw);
-               if (events & HERMES_EV_ALLOC)
-                       __orinoco_ev_alloc(dev, hw);
-               
-               hermes_write_regn(hw, EVACK, evstat);
-
-               evstat = hermes_read_regn(hw, EVSTAT);
-               events = evstat & hw->inten;
-       };
-
-       orinoco_unlock(priv, &flags);
-       return IRQ_HANDLED;
-}
-
-/********************************************************************/
-/* Power management                                                 */
-/********************************************************************/
-#if defined(CONFIG_PM_SLEEP) && !defined(CONFIG_HERMES_CACHE_FW_ON_INIT)
-static int orinoco_pm_notifier(struct notifier_block *notifier,
-                              unsigned long pm_event,
-                              void *unused)
-{
-       struct orinoco_private *priv = container_of(notifier,
-                                                   struct orinoco_private,
-                                                   pm_notifier);
-
-       /* All we need to do is cache the firmware before suspend, and
-        * release it when we come out.
-        *
-        * Only need to do this if we're downloading firmware. */
-       if (!priv->do_fw_download)
-               return NOTIFY_DONE;
-
-       switch (pm_event) {
-       case PM_HIBERNATION_PREPARE:
-       case PM_SUSPEND_PREPARE:
-               orinoco_cache_fw(priv, 0);
-               break;
-
-       case PM_POST_RESTORE:
-               /* Restore from hibernation failed. We need to clean
-                * up in exactly the same way, so fall through. */
-       case PM_POST_HIBERNATION:
-       case PM_POST_SUSPEND:
-               orinoco_uncache_fw(priv);
-               break;
-
-       case PM_RESTORE_PREPARE:
-       default:
-               break;
-       }
-
-       return NOTIFY_DONE;
-}
-#else /* !PM_SLEEP || HERMES_CACHE_FW_ON_INIT */
-#define orinoco_pm_notifier NULL
-#endif
-
-/********************************************************************/
-/* Initialization                                                   */
-/********************************************************************/
-
-struct comp_id {
-       u16 id, variant, major, minor;
-} __attribute__ ((packed));
-
-static inline fwtype_t determine_firmware_type(struct comp_id *nic_id)
-{
-       if (nic_id->id < 0x8000)
-               return FIRMWARE_TYPE_AGERE;
-       else if (nic_id->id == 0x8000 && nic_id->major == 0)
-               return FIRMWARE_TYPE_SYMBOL;
-       else
-               return FIRMWARE_TYPE_INTERSIL;
-}
-
-/* Set priv->firmware type, determine firmware properties */
-static int determine_firmware(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int err;
-       struct comp_id nic_id, sta_id;
-       unsigned int firmver;
-       char tmp[SYMBOL_MAX_VER_LEN+1] __attribute__((aligned(2)));
-
-       /* Get the hardware version */
-       err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_NICID, &nic_id);
-       if (err) {
-               printk(KERN_ERR "%s: Cannot read hardware identity: error %d\n",
-                      dev->name, err);
-               return err;
-       }
-
-       le16_to_cpus(&nic_id.id);
-       le16_to_cpus(&nic_id.variant);
-       le16_to_cpus(&nic_id.major);
-       le16_to_cpus(&nic_id.minor);
-       printk(KERN_DEBUG "%s: Hardware identity %04x:%04x:%04x:%04x\n",
-              dev->name, nic_id.id, nic_id.variant,
-              nic_id.major, nic_id.minor);
-
-       priv->firmware_type = determine_firmware_type(&nic_id);
-
-       /* Get the firmware version */
-       err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_STAID, &sta_id);
-       if (err) {
-               printk(KERN_ERR "%s: Cannot read station identity: error %d\n",
-                      dev->name, err);
-               return err;
-       }
-
-       le16_to_cpus(&sta_id.id);
-       le16_to_cpus(&sta_id.variant);
-       le16_to_cpus(&sta_id.major);
-       le16_to_cpus(&sta_id.minor);
-       printk(KERN_DEBUG "%s: Station identity  %04x:%04x:%04x:%04x\n",
-              dev->name, sta_id.id, sta_id.variant,
-              sta_id.major, sta_id.minor);
-
-       switch (sta_id.id) {
-       case 0x15:
-               printk(KERN_ERR "%s: Primary firmware is active\n",
-                      dev->name);
-               return -ENODEV;
-       case 0x14b:
-               printk(KERN_ERR "%s: Tertiary firmware is active\n",
-                      dev->name);
-               return -ENODEV;
-       case 0x1f:      /* Intersil, Agere, Symbol Spectrum24 */
-       case 0x21:      /* Symbol Spectrum24 Trilogy */
-               break;
-       default:
-               printk(KERN_NOTICE "%s: Unknown station ID, please report\n",
-                      dev->name);
-               break;
-       }
-
-       /* Default capabilities */
-       priv->has_sensitivity = 1;
-       priv->has_mwo = 0;
-       priv->has_preamble = 0;
-       priv->has_port3 = 1;
-       priv->has_ibss = 1;
-       priv->has_wep = 0;
-       priv->has_big_wep = 0;
-       priv->has_alt_txcntl = 0;
-       priv->has_ext_scan = 0;
-       priv->has_wpa = 0;
-       priv->do_fw_download = 0;
-
-       /* Determine capabilities from the firmware version */
-       switch (priv->firmware_type) {
-       case FIRMWARE_TYPE_AGERE:
-               /* Lucent Wavelan IEEE, Lucent Orinoco, Cabletron RoamAbout,
-                  ELSA, Melco, HP, IBM, Dell 1150, Compaq 110/210 */
-               snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
-                        "Lucent/Agere %d.%02d", sta_id.major, sta_id.minor);
-
-               firmver = ((unsigned long)sta_id.major << 16) | sta_id.minor;
-
-               priv->has_ibss = (firmver >= 0x60006);
-               priv->has_wep = (firmver >= 0x40020);
-               priv->has_big_wep = 1; /* FIXME: this is wrong - how do we tell
-                                         Gold cards from the others? */
-               priv->has_mwo = (firmver >= 0x60000);
-               priv->has_pm = (firmver >= 0x40020); /* Don't work in 7.52 ? */
-               priv->ibss_port = 1;
-               priv->has_hostscan = (firmver >= 0x8000a);
-               priv->do_fw_download = 1;
-               priv->broken_monitor = (firmver >= 0x80000);
-               priv->has_alt_txcntl = (firmver >= 0x90000); /* All 9.x ? */
-               priv->has_ext_scan = (firmver >= 0x90000); /* All 9.x ? */
-               priv->has_wpa = (firmver >= 0x9002a);
-               /* Tested with Agere firmware :
-                *      1.16 ; 4.08 ; 4.52 ; 6.04 ; 6.16 ; 7.28 => Jean II
-                * Tested CableTron firmware : 4.32 => Anton */
-               break;
-       case FIRMWARE_TYPE_SYMBOL:
-               /* Symbol , 3Com AirConnect, Intel, Ericsson WLAN */
-               /* Intel MAC : 00:02:B3:* */
-               /* 3Com MAC : 00:50:DA:* */
-               memset(tmp, 0, sizeof(tmp));
-               /* Get the Symbol firmware version */
-               err = hermes_read_ltv(hw, USER_BAP,
-                                     HERMES_RID_SECONDARYVERSION_SYMBOL,
-                                     SYMBOL_MAX_VER_LEN, NULL, &tmp);
-               if (err) {
-                       printk(KERN_WARNING
-                              "%s: Error %d reading Symbol firmware info. Wildly guessing capabilities...\n",
-                              dev->name, err);
-                       firmver = 0;
-                       tmp[0] = '\0';
-               } else {
-                       /* The firmware revision is a string, the format is
-                        * something like : "V2.20-01".
-                        * Quick and dirty parsing... - Jean II
-                        */
-                       firmver = ((tmp[1] - '0') << 16) | ((tmp[3] - '0') << 12)
-                               | ((tmp[4] - '0') << 8) | ((tmp[6] - '0') << 4)
-                               | (tmp[7] - '0');
-
-                       tmp[SYMBOL_MAX_VER_LEN] = '\0';
-               }
-
-               snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
-                        "Symbol %s", tmp);
-
-               priv->has_ibss = (firmver >= 0x20000);
-               priv->has_wep = (firmver >= 0x15012);
-               priv->has_big_wep = (firmver >= 0x20000);
-               priv->has_pm = (firmver >= 0x20000 && firmver < 0x22000) || 
-                              (firmver >= 0x29000 && firmver < 0x30000) ||
-                              firmver >= 0x31000;
-               priv->has_preamble = (firmver >= 0x20000);
-               priv->ibss_port = 4;
-
-               /* Symbol firmware is found on various cards, but
-                * there has been no attempt to check firmware
-                * download on non-spectrum_cs based cards.
-                *
-                * Given that the Agere firmware download works
-                * differently, we should avoid doing a firmware
-                * download with the Symbol algorithm on non-spectrum
-                * cards.
-                *
-                * For now we can identify a spectrum_cs based card
-                * because it has a firmware reset function.
-                */
-               priv->do_fw_download = (priv->stop_fw != NULL);
-
-               priv->broken_disableport = (firmver == 0x25013) ||
-                                          (firmver >= 0x30000 && firmver <= 0x31000);
-               priv->has_hostscan = (firmver >= 0x31001) ||
-                                    (firmver >= 0x29057 && firmver < 0x30000);
-               /* Tested with Intel firmware : 0x20015 => Jean II */
-               /* Tested with 3Com firmware : 0x15012 & 0x22001 => Jean II */
-               break;
-       case FIRMWARE_TYPE_INTERSIL:
-               /* D-Link, Linksys, Adtron, ZoomAir, and many others...
-                * Samsung, Compaq 100/200 and Proxim are slightly
-                * different and less well tested */
-               /* D-Link MAC : 00:40:05:* */
-               /* Addtron MAC : 00:90:D1:* */
-               snprintf(priv->fw_name, sizeof(priv->fw_name) - 1,
-                        "Intersil %d.%d.%d", sta_id.major, sta_id.minor,
-                        sta_id.variant);
-
-               firmver = ((unsigned long)sta_id.major << 16) |
-                       ((unsigned long)sta_id.minor << 8) | sta_id.variant;
-
-               priv->has_ibss = (firmver >= 0x000700); /* FIXME */
-               priv->has_big_wep = priv->has_wep = (firmver >= 0x000800);
-               priv->has_pm = (firmver >= 0x000700);
-               priv->has_hostscan = (firmver >= 0x010301);
-
-               if (firmver >= 0x000800)
-                       priv->ibss_port = 0;
-               else {
-                       printk(KERN_NOTICE "%s: Intersil firmware earlier "
-                              "than v0.8.x - several features not supported\n",
-                              dev->name);
-                       priv->ibss_port = 1;
-               }
-               break;
-       }
-       printk(KERN_DEBUG "%s: Firmware determined as %s\n", dev->name,
-              priv->fw_name);
-
-       return 0;
-}
-
-static int orinoco_init(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       struct hermes_idstring nickbuf;
-       u16 reclen;
-       int len;
-
-       /* No need to lock, the hw_unavailable flag is already set in
-        * alloc_orinocodev() */
-       priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN;
-
-       /* Initialize the firmware */
-       err = hermes_init(hw);
-       if (err != 0) {
-               printk(KERN_ERR "%s: failed to initialize firmware (err = %d)\n",
-                      dev->name, err);
-               goto out;
-       }
-
-       err = determine_firmware(dev);
-       if (err != 0) {
-               printk(KERN_ERR "%s: Incompatible firmware, aborting\n",
-                      dev->name);
-               goto out;
-       }
-
-       if (priv->do_fw_download) {
-#ifdef CONFIG_HERMES_CACHE_FW_ON_INIT
-               orinoco_cache_fw(priv, 0);
-#endif
-
-               err = orinoco_download(priv);
-               if (err)
-                       priv->do_fw_download = 0;
-
-               /* Check firmware version again */
-               err = determine_firmware(dev);
-               if (err != 0) {
-                       printk(KERN_ERR "%s: Incompatible firmware, aborting\n",
-                              dev->name);
-                       goto out;
-               }
-       }
-
-       if (priv->has_port3)
-               printk(KERN_DEBUG "%s: Ad-hoc demo mode supported\n", dev->name);
-       if (priv->has_ibss)
-               printk(KERN_DEBUG "%s: IEEE standard IBSS ad-hoc mode supported\n",
-                      dev->name);
-       if (priv->has_wep) {
-               printk(KERN_DEBUG "%s: WEP supported, ", dev->name);
-               if (priv->has_big_wep)
-                       printk("104-bit key\n");
-               else
-                       printk("40-bit key\n");
-       }
-       if (priv->has_wpa) {
-               printk(KERN_DEBUG "%s: WPA-PSK supported\n", dev->name);
-               if (orinoco_mic_init(priv)) {
-                       printk(KERN_ERR "%s: Failed to setup MIC crypto "
-                              "algorithm. Disabling WPA support\n", dev->name);
-                       priv->has_wpa = 0;
-               }
-       }
-
-       /* Now we have the firmware capabilities, allocate appropiate
-        * sized scan buffers */
-       if (orinoco_bss_data_allocate(priv))
-               goto out;
-       orinoco_bss_data_init(priv);
-
-       /* Get the MAC address */
-       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR,
-                             ETH_ALEN, NULL, dev->dev_addr);
-       if (err) {
-               printk(KERN_WARNING "%s: failed to read MAC address!\n",
-                      dev->name);
-               goto out;
-       }
-
-       printk(KERN_DEBUG "%s: MAC address %pM\n",
-              dev->name, dev->dev_addr);
-
-       /* Get the station name */
-       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME,
-                             sizeof(nickbuf), &reclen, &nickbuf);
-       if (err) {
-               printk(KERN_ERR "%s: failed to read station name\n",
-                      dev->name);
-               goto out;
-       }
-       if (nickbuf.len)
-               len = min(IW_ESSID_MAX_SIZE, (int)le16_to_cpu(nickbuf.len));
-       else
-               len = min(IW_ESSID_MAX_SIZE, 2 * reclen);
-       memcpy(priv->nick, &nickbuf.val, len);
-       priv->nick[len] = '\0';
-
-       printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick);
-
-       err = orinoco_allocate_fid(dev);
-       if (err) {
-               printk(KERN_ERR "%s: failed to allocate NIC buffer!\n",
-                      dev->name);
-               goto out;
-       }
-
-       /* Get allowed channels */
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST,
-                                 &priv->channel_mask);
-       if (err) {
-               printk(KERN_ERR "%s: failed to read channel list!\n",
-                      dev->name);
-               goto out;
-       }
-
-       /* Get initial AP density */
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFSYSTEMSCALE,
-                                 &priv->ap_density);
-       if (err || priv->ap_density < 1 || priv->ap_density > 3) {
-               priv->has_sensitivity = 0;
-       }
-
-       /* Get initial RTS threshold */
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD,
-                                 &priv->rts_thresh);
-       if (err) {
-               printk(KERN_ERR "%s: failed to read RTS threshold!\n",
-                      dev->name);
-               goto out;
-       }
-
-       /* Get initial fragmentation settings */
-       if (priv->has_mwo)
-               err = hermes_read_wordrec(hw, USER_BAP,
-                                         HERMES_RID_CNFMWOROBUST_AGERE,
-                                         &priv->mwo_robust);
-       else
-               err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
-                                         &priv->frag_thresh);
-       if (err) {
-               printk(KERN_ERR "%s: failed to read fragmentation settings!\n",
-                      dev->name);
-               goto out;
-       }
-
-       /* Power management setup */
-       if (priv->has_pm) {
-               priv->pm_on = 0;
-               priv->pm_mcast = 1;
-               err = hermes_read_wordrec(hw, USER_BAP,
-                                         HERMES_RID_CNFMAXSLEEPDURATION,
-                                         &priv->pm_period);
-               if (err) {
-                       printk(KERN_ERR "%s: failed to read power management period!\n",
-                              dev->name);
-                       goto out;
-               }
-               err = hermes_read_wordrec(hw, USER_BAP,
-                                         HERMES_RID_CNFPMHOLDOVERDURATION,
-                                         &priv->pm_timeout);
-               if (err) {
-                       printk(KERN_ERR "%s: failed to read power management timeout!\n",
-                              dev->name);
-                       goto out;
-               }
-       }
-
-       /* Preamble setup */
-       if (priv->has_preamble) {
-               err = hermes_read_wordrec(hw, USER_BAP,
-                                         HERMES_RID_CNFPREAMBLE_SYMBOL,
-                                         &priv->preamble);
-               if (err)
-                       goto out;
-       }
-               
-       /* Set up the default configuration */
-       priv->iw_mode = IW_MODE_INFRA;
-       /* By default use IEEE/IBSS ad-hoc mode if we have it */
-       priv->prefer_port3 = priv->has_port3 && (! priv->has_ibss);
-       set_port_type(priv);
-       priv->channel = 0; /* use firmware default */
-
-       priv->promiscuous = 0;
-       priv->encode_alg = IW_ENCODE_ALG_NONE;
-       priv->tx_key = 0;
-       priv->wpa_enabled = 0;
-       priv->tkip_cm_active = 0;
-       priv->key_mgmt = 0;
-       priv->wpa_ie_len = 0;
-       priv->wpa_ie = NULL;
-
-       /* Make the hardware available, as long as it hasn't been
-        * removed elsewhere (e.g. by PCMCIA hot unplug) */
-       spin_lock_irq(&priv->lock);
-       priv->hw_unavailable--;
-       spin_unlock_irq(&priv->lock);
-
-       printk(KERN_DEBUG "%s: ready\n", dev->name);
-
- out:
-       return err;
-}
-
-struct net_device
-*alloc_orinocodev(int sizeof_card,
-                 struct device *device,
-                 int (*hard_reset)(struct orinoco_private *),
-                 int (*stop_fw)(struct orinoco_private *, int))
-{
-       struct net_device *dev;
-       struct orinoco_private *priv;
-
-       dev = alloc_etherdev(sizeof(struct orinoco_private) + sizeof_card);
-       if (! dev)
-               return NULL;
-       priv = netdev_priv(dev);
-       priv->ndev = dev;
-       if (sizeof_card)
-               priv->card = (void *)((unsigned long)priv
-                                     + sizeof(struct orinoco_private));
-       else
-               priv->card = NULL;
-       priv->dev = device;
-
-       /* Setup / override net_device fields */
-       dev->init = orinoco_init;
-       dev->hard_start_xmit = orinoco_xmit;
-       dev->tx_timeout = orinoco_tx_timeout;
-       dev->watchdog_timeo = HZ; /* 1 second timeout */
-       dev->get_stats = orinoco_get_stats;
-       dev->ethtool_ops = &orinoco_ethtool_ops;
-       dev->wireless_handlers = (struct iw_handler_def *)&orinoco_handler_def;
-#ifdef WIRELESS_SPY
-       priv->wireless_data.spy_data = &priv->spy_data;
-       dev->wireless_data = &priv->wireless_data;
-#endif
-       dev->change_mtu = orinoco_change_mtu;
-       dev->set_multicast_list = orinoco_set_multicast_list;
-       /* we use the default eth_mac_addr for setting the MAC addr */
-
-       /* Reserve space in skb for the SNAP header */
-       dev->hard_header_len += ENCAPS_OVERHEAD;
-
-       /* Set up default callbacks */
-       dev->open = orinoco_open;
-       dev->stop = orinoco_stop;
-       priv->hard_reset = hard_reset;
-       priv->stop_fw = stop_fw;
-
-       spin_lock_init(&priv->lock);
-       priv->open = 0;
-       priv->hw_unavailable = 1; /* orinoco_init() must clear this
-                                  * before anything else touches the
-                                  * hardware */
-       INIT_WORK(&priv->reset_work, orinoco_reset);
-       INIT_WORK(&priv->join_work, orinoco_join_ap);
-       INIT_WORK(&priv->wevent_work, orinoco_send_wevents);
-
-       INIT_LIST_HEAD(&priv->rx_list);
-       tasklet_init(&priv->rx_tasklet, orinoco_rx_isr_tasklet,
-                    (unsigned long) dev);
-
-       netif_carrier_off(dev);
-       priv->last_linkstatus = 0xffff;
-
-       priv->cached_pri_fw = NULL;
-       priv->cached_fw = NULL;
-
-       /* Register PM notifiers */
-       priv->pm_notifier.notifier_call = orinoco_pm_notifier;
-       register_pm_notifier(&priv->pm_notifier);
-
-       return dev;
-}
-
-void free_orinocodev(struct net_device *dev)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct orinoco_rx_data *rx_data, *temp;
-
-       /* If the tasklet is scheduled when we call tasklet_kill it
-        * will run one final time. However the tasklet will only
-        * drain priv->rx_list if the hw is still available. */
-       tasklet_kill(&priv->rx_tasklet);
-
-       /* Explicitly drain priv->rx_list */
-       list_for_each_entry_safe(rx_data, temp, &priv->rx_list, list) {
-               list_del(&rx_data->list);
-
-               dev_kfree_skb(rx_data->skb);
-               kfree(rx_data->desc);
-               kfree(rx_data);
-       }
-
-       unregister_pm_notifier(&priv->pm_notifier);
-       orinoco_uncache_fw(priv);
-
-       priv->wpa_ie_len = 0;
-       kfree(priv->wpa_ie);
-       orinoco_mic_free(priv);
-       orinoco_bss_data_free(priv);
-       free_netdev(dev);
-}
-
-/********************************************************************/
-/* Wireless extensions                                              */
-/********************************************************************/
-
-/* Return : < 0 -> error code ; >= 0 -> length */
-static int orinoco_hw_get_essid(struct orinoco_private *priv, int *active,
-                               char buf[IW_ESSID_MAX_SIZE+1])
-{
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       struct hermes_idstring essidbuf;
-       char *p = (char *)(&essidbuf.val);
-       int len;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       if (strlen(priv->desired_essid) > 0) {
-               /* We read the desired SSID from the hardware rather
-                  than from priv->desired_essid, just in case the
-                  firmware is allowed to change it on us. I'm not
-                  sure about this */
-               /* My guess is that the OWNSSID should always be whatever
-                * we set to the card, whereas CURRENT_SSID is the one that
-                * may change... - Jean II */
-               u16 rid;
-
-               *active = 1;
-
-               rid = (priv->port_type == 3) ? HERMES_RID_CNFOWNSSID :
-                       HERMES_RID_CNFDESIREDSSID;
-               
-               err = hermes_read_ltv(hw, USER_BAP, rid, sizeof(essidbuf),
-                                     NULL, &essidbuf);
-               if (err)
-                       goto fail_unlock;
-       } else {
-               *active = 0;
-
-               err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTSSID,
-                                     sizeof(essidbuf), NULL, &essidbuf);
-               if (err)
-                       goto fail_unlock;
-       }
-
-       len = le16_to_cpu(essidbuf.len);
-       BUG_ON(len > IW_ESSID_MAX_SIZE);
-
-       memset(buf, 0, IW_ESSID_MAX_SIZE);
-       memcpy(buf, p, len);
-       err = len;
-
- fail_unlock:
-       orinoco_unlock(priv, &flags);
-
-       return err;       
-}
-
-static long orinoco_hw_get_freq(struct orinoco_private *priv)
-{
-       
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       u16 channel;
-       long freq = 0;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-       
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CURRENTCHANNEL, &channel);
-       if (err)
-               goto out;
-
-       /* Intersil firmware 1.3.5 returns 0 when the interface is down */
-       if (channel == 0) {
-               err = -EBUSY;
-               goto out;
-       }
-
-       if ( (channel < 1) || (channel > NUM_CHANNELS) ) {
-               printk(KERN_WARNING "%s: Channel out of range (%d)!\n",
-                      priv->ndev->name, channel);
-               err = -EBUSY;
-               goto out;
-
-       }
-       freq = channel_frequency[channel-1] * 100000;
-
- out:
-       orinoco_unlock(priv, &flags);
-
-       if (err > 0)
-               err = -EBUSY;
-       return err ? err : freq;
-}
-
-static int orinoco_hw_get_bitratelist(struct orinoco_private *priv,
-                                     int *numrates, s32 *rates, int max)
-{
-       hermes_t *hw = &priv->hw;
-       struct hermes_idstring list;
-       unsigned char *p = (unsigned char *)&list.val;
-       int err = 0;
-       int num;
-       int i;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_SUPPORTEDDATARATES,
-                             sizeof(list), NULL, &list);
-       orinoco_unlock(priv, &flags);
-
-       if (err)
-               return err;
-       
-       num = le16_to_cpu(list.len);
-       *numrates = num;
-       num = min(num, max);
-
-       for (i = 0; i < num; i++) {
-               rates[i] = (p[i] & 0x7f) * 500000; /* convert to bps */
-       }
-
-       return 0;
-}
-
-static int orinoco_ioctl_getname(struct net_device *dev,
-                                struct iw_request_info *info,
-                                char *name,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int numrates;
-       int err;
-
-       err = orinoco_hw_get_bitratelist(priv, &numrates, NULL, 0);
-
-       if (!err && (numrates > 2))
-               strcpy(name, "IEEE 802.11b");
-       else
-               strcpy(name, "IEEE 802.11-DS");
-
-       return 0;
-}
-
-static int orinoco_ioctl_setwap(struct net_device *dev,
-                               struct iw_request_info *info,
-                               struct sockaddr *ap_addr,
-                               char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int err = -EINPROGRESS;         /* Call commit handler */
-       unsigned long flags;
-       static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
-       static const u8 any_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       /* Enable automatic roaming - no sanity checks are needed */
-       if (memcmp(&ap_addr->sa_data, off_addr, ETH_ALEN) == 0 ||
-           memcmp(&ap_addr->sa_data, any_addr, ETH_ALEN) == 0) {
-               priv->bssid_fixed = 0;
-               memset(priv->desired_bssid, 0, ETH_ALEN);
-
-               /* "off" means keep existing connection */
-               if (ap_addr->sa_data[0] == 0) {
-                       __orinoco_hw_set_wap(priv);
-                       err = 0;
-               }
-               goto out;
-       }
-
-       if (priv->firmware_type == FIRMWARE_TYPE_AGERE) {
-               printk(KERN_WARNING "%s: Lucent/Agere firmware doesn't "
-                      "support manual roaming\n",
-                      dev->name);
-               err = -EOPNOTSUPP;
-               goto out;
-       }
-
-       if (priv->iw_mode != IW_MODE_INFRA) {
-               printk(KERN_WARNING "%s: Manual roaming supported only in "
-                      "managed mode\n", dev->name);
-               err = -EOPNOTSUPP;
-               goto out;
-       }
-
-       /* Intersil firmware hangs without Desired ESSID */
-       if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL &&
-           strlen(priv->desired_essid) == 0) {
-               printk(KERN_WARNING "%s: Desired ESSID must be set for "
-                      "manual roaming\n", dev->name);
-               err = -EOPNOTSUPP;
-               goto out;
-       }
-
-       /* Finally, enable manual roaming */
-       priv->bssid_fixed = 1;
-       memcpy(priv->desired_bssid, &ap_addr->sa_data, ETH_ALEN);
-
- out:
-       orinoco_unlock(priv, &flags);
-       return err;
-}
-
-static int orinoco_ioctl_getwap(struct net_device *dev,
-                               struct iw_request_info *info,
-                               struct sockaddr *ap_addr,
-                               char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       ap_addr->sa_family = ARPHRD_ETHER;
-       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID,
-                             ETH_ALEN, NULL, ap_addr->sa_data);
-
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_setmode(struct net_device *dev,
-                                struct iw_request_info *info,
-                                u32 *mode,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int err = -EINPROGRESS;         /* Call commit handler */
-       unsigned long flags;
-
-       if (priv->iw_mode == *mode)
-               return 0;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       switch (*mode) {
-       case IW_MODE_ADHOC:
-               if (!priv->has_ibss && !priv->has_port3)
-                       err = -EOPNOTSUPP;
-               break;
-
-       case IW_MODE_INFRA:
-               break;
-
-       case IW_MODE_MONITOR:
-               if (priv->broken_monitor && !force_monitor) {
-                       printk(KERN_WARNING "%s: Monitor mode support is "
-                              "buggy in this firmware, not enabling\n",
-                              dev->name);
-                       err = -EOPNOTSUPP;
-               }
-               break;
-
-       default:
-               err = -EOPNOTSUPP;
-               break;
-       }
-
-       if (err == -EINPROGRESS) {
-               priv->iw_mode = *mode;
-               set_port_type(priv);
-       }
-
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_getmode(struct net_device *dev,
-                                struct iw_request_info *info,
-                                u32 *mode,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-
-       *mode = priv->iw_mode;
-       return 0;
-}
-
-static int orinoco_ioctl_getiwrange(struct net_device *dev,
-                                   struct iw_request_info *info,
-                                   struct iw_point *rrq,
-                                   char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int err = 0;
-       struct iw_range *range = (struct iw_range *) extra;
-       int numrates;
-       int i, k;
-
-       rrq->length = sizeof(struct iw_range);
-       memset(range, 0, sizeof(struct iw_range));
-
-       range->we_version_compiled = WIRELESS_EXT;
-       range->we_version_source = 22;
-
-       /* Set available channels/frequencies */
-       range->num_channels = NUM_CHANNELS;
-       k = 0;
-       for (i = 0; i < NUM_CHANNELS; i++) {
-               if (priv->channel_mask & (1 << i)) {
-                       range->freq[k].i = i + 1;
-                       range->freq[k].m = channel_frequency[i] * 100000;
-                       range->freq[k].e = 1;
-                       k++;
-               }
-               
-               if (k >= IW_MAX_FREQUENCIES)
-                       break;
-       }
-       range->num_frequency = k;
-       range->sensitivity = 3;
-
-       if (priv->has_wep) {
-               range->max_encoding_tokens = ORINOCO_MAX_KEYS;
-               range->encoding_size[0] = SMALL_KEY_SIZE;
-               range->num_encoding_sizes = 1;
-
-               if (priv->has_big_wep) {
-                       range->encoding_size[1] = LARGE_KEY_SIZE;
-                       range->num_encoding_sizes = 2;
-               }
-       }
-
-       if (priv->has_wpa)
-               range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_CIPHER_TKIP;
-
-       if ((priv->iw_mode == IW_MODE_ADHOC) && (!SPY_NUMBER(priv))){
-               /* Quality stats meaningless in ad-hoc mode */
-       } else {
-               range->max_qual.qual = 0x8b - 0x2f;
-               range->max_qual.level = 0x2f - 0x95 - 1;
-               range->max_qual.noise = 0x2f - 0x95 - 1;
-               /* Need to get better values */
-               range->avg_qual.qual = 0x24;
-               range->avg_qual.level = 0xC2;
-               range->avg_qual.noise = 0x9E;
-       }
-
-       err = orinoco_hw_get_bitratelist(priv, &numrates,
-                                        range->bitrate, IW_MAX_BITRATES);
-       if (err)
-               return err;
-       range->num_bitrates = numrates;
-
-       /* Set an indication of the max TCP throughput in bit/s that we can
-        * expect using this interface. May be use for QoS stuff...
-        * Jean II */
-       if (numrates > 2)
-               range->throughput = 5 * 1000 * 1000;    /* ~5 Mb/s */
-       else
-               range->throughput = 1.5 * 1000 * 1000;  /* ~1.5 Mb/s */
-
-       range->min_rts = 0;
-       range->max_rts = 2347;
-       range->min_frag = 256;
-       range->max_frag = 2346;
-
-       range->min_pmp = 0;
-       range->max_pmp = 65535000;
-       range->min_pmt = 0;
-       range->max_pmt = 65535 * 1000;  /* ??? */
-       range->pmp_flags = IW_POWER_PERIOD;
-       range->pmt_flags = IW_POWER_TIMEOUT;
-       range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_UNICAST_R;
-
-       range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
-       range->retry_flags = IW_RETRY_LIMIT;
-       range->r_time_flags = IW_RETRY_LIFETIME;
-       range->min_retry = 0;
-       range->max_retry = 65535;       /* ??? */
-       range->min_r_time = 0;
-       range->max_r_time = 65535 * 1000;       /* ??? */
-
-       if (priv->firmware_type == FIRMWARE_TYPE_AGERE)
-               range->scan_capa = IW_SCAN_CAPA_ESSID;
-       else
-               range->scan_capa = IW_SCAN_CAPA_NONE;
-
-       /* Event capability (kernel) */
-       IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
-       /* Event capability (driver) */
-       IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY);
-       IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
-       IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
-       IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP);
-
-       return 0;
-}
-
-static int orinoco_ioctl_setiwencode(struct net_device *dev,
-                                    struct iw_request_info *info,
-                                    struct iw_point *erq,
-                                    char *keybuf)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int index = (erq->flags & IW_ENCODE_INDEX) - 1;
-       int setindex = priv->tx_key;
-       int encode_alg = priv->encode_alg;
-       int restricted = priv->wep_restrict;
-       u16 xlen = 0;
-       int err = -EINPROGRESS;         /* Call commit handler */
-       unsigned long flags;
-
-       if (! priv->has_wep)
-               return -EOPNOTSUPP;
-
-       if (erq->pointer) {
-               /* We actually have a key to set - check its length */
-               if (erq->length > LARGE_KEY_SIZE)
-                       return -E2BIG;
-
-               if ( (erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep )
-                       return -E2BIG;
-       }
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       /* Clear any TKIP key we have */
-       if ((priv->has_wpa) && (priv->encode_alg == IW_ENCODE_ALG_TKIP))
-               (void) orinoco_clear_tkip_key(priv, setindex);
-
-       if (erq->length > 0) {
-               if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
-                       index = priv->tx_key;
-
-               /* Adjust key length to a supported value */
-               if (erq->length > SMALL_KEY_SIZE) {
-                       xlen = LARGE_KEY_SIZE;
-               } else if (erq->length > 0) {
-                       xlen = SMALL_KEY_SIZE;
-               } else
-                       xlen = 0;
-
-               /* Switch on WEP if off */
-               if ((encode_alg != IW_ENCODE_ALG_WEP) && (xlen > 0)) {
-                       setindex = index;
-                       encode_alg = IW_ENCODE_ALG_WEP;
-               }
-       } else {
-               /* Important note : if the user do "iwconfig eth0 enc off",
-                * we will arrive there with an index of -1. This is valid
-                * but need to be taken care off... Jean II */
-               if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) {
-                       if((index != -1) || (erq->flags == 0)) {
-                               err = -EINVAL;
-                               goto out;
-                       }
-               } else {
-                       /* Set the index : Check that the key is valid */
-                       if(priv->keys[index].len == 0) {
-                               err = -EINVAL;
-                               goto out;
-                       }
-                       setindex = index;
-               }
-       }
-
-       if (erq->flags & IW_ENCODE_DISABLED)
-               encode_alg = IW_ENCODE_ALG_NONE;
-       if (erq->flags & IW_ENCODE_OPEN)
-               restricted = 0;
-       if (erq->flags & IW_ENCODE_RESTRICTED)
-               restricted = 1;
-
-       if (erq->pointer && erq->length > 0) {
-               priv->keys[index].len = cpu_to_le16(xlen);
-               memset(priv->keys[index].data, 0,
-                      sizeof(priv->keys[index].data));
-               memcpy(priv->keys[index].data, keybuf, erq->length);
-       }
-       priv->tx_key = setindex;
-
-       /* Try fast key change if connected and only keys are changed */
-       if ((priv->encode_alg == encode_alg) &&
-           (priv->wep_restrict == restricted) &&
-           netif_carrier_ok(dev)) {
-               err = __orinoco_hw_setup_wepkeys(priv);
-               /* No need to commit if successful */
-               goto out;
-       }
-
-       priv->encode_alg = encode_alg;
-       priv->wep_restrict = restricted;
-
- out:
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_getiwencode(struct net_device *dev,
-                                    struct iw_request_info *info,
-                                    struct iw_point *erq,
-                                    char *keybuf)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int index = (erq->flags & IW_ENCODE_INDEX) - 1;
-       u16 xlen = 0;
-       unsigned long flags;
-
-       if (! priv->has_wep)
-               return -EOPNOTSUPP;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
-               index = priv->tx_key;
-
-       erq->flags = 0;
-       if (!priv->encode_alg)
-               erq->flags |= IW_ENCODE_DISABLED;
-       erq->flags |= index + 1;
-
-       if (priv->wep_restrict)
-               erq->flags |= IW_ENCODE_RESTRICTED;
-       else
-               erq->flags |= IW_ENCODE_OPEN;
-
-       xlen = le16_to_cpu(priv->keys[index].len);
-
-       erq->length = xlen;
-
-       memcpy(keybuf, priv->keys[index].data, ORINOCO_MAX_KEY_SIZE);
-
-       orinoco_unlock(priv, &flags);
-       return 0;
-}
-
-static int orinoco_ioctl_setessid(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 struct iw_point *erq,
-                                 char *essidbuf)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       unsigned long flags;
-
-       /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it
-        * anyway... - Jean II */
-
-       /* Hum... Should not use Wireless Extension constant (may change),
-        * should use our own... - Jean II */
-       if (erq->length > IW_ESSID_MAX_SIZE)
-               return -E2BIG;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       /* NULL the string (for NULL termination & ESSID = ANY) - Jean II */
-       memset(priv->desired_essid, 0, sizeof(priv->desired_essid));
-
-       /* If not ANY, get the new ESSID */
-       if (erq->flags) {
-               memcpy(priv->desired_essid, essidbuf, erq->length);
-       }
-
-       orinoco_unlock(priv, &flags);
-
-       return -EINPROGRESS;            /* Call commit handler */
-}
-
-static int orinoco_ioctl_getessid(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 struct iw_point *erq,
-                                 char *essidbuf)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int active;
-       int err = 0;
-       unsigned long flags;
-
-       if (netif_running(dev)) {
-               err = orinoco_hw_get_essid(priv, &active, essidbuf);
-               if (err < 0)
-                       return err;
-               erq->length = err;
-       } else {
-               if (orinoco_lock(priv, &flags) != 0)
-                       return -EBUSY;
-               memcpy(essidbuf, priv->desired_essid, IW_ESSID_MAX_SIZE);
-               erq->length = strlen(priv->desired_essid);
-               orinoco_unlock(priv, &flags);
-       }
-
-       erq->flags = 1;
-
-       return 0;
-}
-
-static int orinoco_ioctl_setnick(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_point *nrq,
-                                char *nickbuf)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       unsigned long flags;
-
-       if (nrq->length > IW_ESSID_MAX_SIZE)
-               return -E2BIG;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       memset(priv->nick, 0, sizeof(priv->nick));
-       memcpy(priv->nick, nickbuf, nrq->length);
-
-       orinoco_unlock(priv, &flags);
-
-       return -EINPROGRESS;            /* Call commit handler */
-}
-
-static int orinoco_ioctl_getnick(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_point *nrq,
-                                char *nickbuf)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       memcpy(nickbuf, priv->nick, IW_ESSID_MAX_SIZE);
-       orinoco_unlock(priv, &flags);
-
-       nrq->length = strlen(priv->nick);
-
-       return 0;
-}
-
-static int orinoco_ioctl_setfreq(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_freq *frq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int chan = -1;
-       unsigned long flags;
-       int err = -EINPROGRESS;         /* Call commit handler */
-
-       /* In infrastructure mode the AP sets the channel */
-       if (priv->iw_mode == IW_MODE_INFRA)
-               return -EBUSY;
-
-       if ( (frq->e == 0) && (frq->m <= 1000) ) {
-               /* Setting by channel number */
-               chan = frq->m;
-       } else {
-               /* Setting by frequency - search the table */
-               int mult = 1;
-               int i;
-
-               for (i = 0; i < (6 - frq->e); i++)
-                       mult *= 10;
-
-               for (i = 0; i < NUM_CHANNELS; i++)
-                       if (frq->m == (channel_frequency[i] * mult))
-                               chan = i+1;
-       }
-
-       if ( (chan < 1) || (chan > NUM_CHANNELS) ||
-            ! (priv->channel_mask & (1 << (chan-1)) ) )
-               return -EINVAL;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       priv->channel = chan;
-       if (priv->iw_mode == IW_MODE_MONITOR) {
-               /* Fast channel change - no commit if successful */
-               hermes_t *hw = &priv->hw;
-               err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
-                                           HERMES_TEST_SET_CHANNEL,
-                                       chan, NULL);
-       }
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_getfreq(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_freq *frq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int tmp;
-
-       /* Locking done in there */
-       tmp = orinoco_hw_get_freq(priv);
-       if (tmp < 0) {
-               return tmp;
-       }
-
-       frq->m = tmp;
-       frq->e = 1;
-
-       return 0;
-}
-
-static int orinoco_ioctl_getsens(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_param *srq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       u16 val;
-       int err;
-       unsigned long flags;
-
-       if (!priv->has_sensitivity)
-               return -EOPNOTSUPP;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-       err = hermes_read_wordrec(hw, USER_BAP,
-                                 HERMES_RID_CNFSYSTEMSCALE, &val);
-       orinoco_unlock(priv, &flags);
-
-       if (err)
-               return err;
-
-       srq->value = val;
-       srq->fixed = 0; /* auto */
-
-       return 0;
-}
-
-static int orinoco_ioctl_setsens(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_param *srq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int val = srq->value;
-       unsigned long flags;
-
-       if (!priv->has_sensitivity)
-               return -EOPNOTSUPP;
-
-       if ((val < 1) || (val > 3))
-               return -EINVAL;
-       
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-       priv->ap_density = val;
-       orinoco_unlock(priv, &flags);
-
-       return -EINPROGRESS;            /* Call commit handler */
-}
-
-static int orinoco_ioctl_setrts(struct net_device *dev,
-                               struct iw_request_info *info,
-                               struct iw_param *rrq,
-                               char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int val = rrq->value;
-       unsigned long flags;
-
-       if (rrq->disabled)
-               val = 2347;
-
-       if ( (val < 0) || (val > 2347) )
-               return -EINVAL;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       priv->rts_thresh = val;
-       orinoco_unlock(priv, &flags);
-
-       return -EINPROGRESS;            /* Call commit handler */
-}
-
-static int orinoco_ioctl_getrts(struct net_device *dev,
-                               struct iw_request_info *info,
-                               struct iw_param *rrq,
-                               char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-
-       rrq->value = priv->rts_thresh;
-       rrq->disabled = (rrq->value == 2347);
-       rrq->fixed = 1;
-
-       return 0;
-}
-
-static int orinoco_ioctl_setfrag(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_param *frq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int err = -EINPROGRESS;         /* Call commit handler */
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       if (priv->has_mwo) {
-               if (frq->disabled)
-                       priv->mwo_robust = 0;
-               else {
-                       if (frq->fixed)
-                               printk(KERN_WARNING "%s: Fixed fragmentation is "
-                                      "not supported on this firmware. "
-                                      "Using MWO robust instead.\n", dev->name);
-                       priv->mwo_robust = 1;
-               }
-       } else {
-               if (frq->disabled)
-                       priv->frag_thresh = 2346;
-               else {
-                       if ( (frq->value < 256) || (frq->value > 2346) )
-                               err = -EINVAL;
-                       else
-                               priv->frag_thresh = frq->value & ~0x1; /* must be even */
-               }
-       }
-
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_getfrag(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_param *frq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int err;
-       u16 val;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-       
-       if (priv->has_mwo) {
-               err = hermes_read_wordrec(hw, USER_BAP,
-                                         HERMES_RID_CNFMWOROBUST_AGERE,
-                                         &val);
-               if (err)
-                       val = 0;
-
-               frq->value = val ? 2347 : 0;
-               frq->disabled = ! val;
-               frq->fixed = 0;
-       } else {
-               err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
-                                         &val);
-               if (err)
-                       val = 0;
-
-               frq->value = val;
-               frq->disabled = (val >= 2346);
-               frq->fixed = 1;
-       }
-
-       orinoco_unlock(priv, &flags);
-       
-       return err;
-}
-
-static int orinoco_ioctl_setrate(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_param *rrq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int ratemode = -1;
-       int bitrate; /* 100s of kilobits */
-       int i;
-       unsigned long flags;
-       
-       /* As the user space doesn't know our highest rate, it uses -1
-        * to ask us to set the highest rate.  Test it using "iwconfig
-        * ethX rate auto" - Jean II */
-       if (rrq->value == -1)
-               bitrate = 110;
-       else {
-               if (rrq->value % 100000)
-                       return -EINVAL;
-               bitrate = rrq->value / 100000;
-       }
-
-       if ( (bitrate != 10) && (bitrate != 20) &&
-            (bitrate != 55) && (bitrate != 110) )
-               return -EINVAL;
-
-       for (i = 0; i < BITRATE_TABLE_SIZE; i++)
-               if ( (bitrate_table[i].bitrate == bitrate) &&
-                    (bitrate_table[i].automatic == ! rrq->fixed) ) {
-                       ratemode = i;
-                       break;
-               }
-       
-       if (ratemode == -1)
-               return -EINVAL;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-       priv->bitratemode = ratemode;
-       orinoco_unlock(priv, &flags);
-
-       return -EINPROGRESS;
-}
-
-static int orinoco_ioctl_getrate(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_param *rrq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       int ratemode;
-       int i;
-       u16 val;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       ratemode = priv->bitratemode;
-
-       BUG_ON((ratemode < 0) || (ratemode >= BITRATE_TABLE_SIZE));
-
-       rrq->value = bitrate_table[ratemode].bitrate * 100000;
-       rrq->fixed = ! bitrate_table[ratemode].automatic;
-       rrq->disabled = 0;
-
-       /* If the interface is running we try to find more about the
-          current mode */
-       if (netif_running(dev)) {
-               err = hermes_read_wordrec(hw, USER_BAP,
-                                         HERMES_RID_CURRENTTXRATE, &val);
-               if (err)
-                       goto out;
-               
-               switch (priv->firmware_type) {
-               case FIRMWARE_TYPE_AGERE: /* Lucent style rate */
-                       /* Note : in Lucent firmware, the return value of
-                        * HERMES_RID_CURRENTTXRATE is the bitrate in Mb/s,
-                        * and therefore is totally different from the
-                        * encoding of HERMES_RID_CNFTXRATECONTROL.
-                        * Don't forget that 6Mb/s is really 5.5Mb/s */
-                       if (val == 6)
-                               rrq->value = 5500000;
-                       else
-                               rrq->value = val * 1000000;
-                       break;
-               case FIRMWARE_TYPE_INTERSIL: /* Intersil style rate */
-               case FIRMWARE_TYPE_SYMBOL: /* Symbol style rate */
-                       for (i = 0; i < BITRATE_TABLE_SIZE; i++)
-                               if (bitrate_table[i].intersil_txratectrl == val) {
-                                       ratemode = i;
-                                       break;
-                               }
-                       if (i >= BITRATE_TABLE_SIZE)
-                               printk(KERN_INFO "%s: Unable to determine current bitrate (0x%04hx)\n",
-                                      dev->name, val);
-
-                       rrq->value = bitrate_table[ratemode].bitrate * 100000;
-                       break;
-               default:
-                       BUG();
-               }
-       }
-
- out:
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_setpower(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 struct iw_param *prq,
-                                 char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int err = -EINPROGRESS;         /* Call commit handler */
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       if (prq->disabled) {
-               priv->pm_on = 0;
-       } else {
-               switch (prq->flags & IW_POWER_MODE) {
-               case IW_POWER_UNICAST_R:
-                       priv->pm_mcast = 0;
-                       priv->pm_on = 1;
-                       break;
-               case IW_POWER_ALL_R:
-                       priv->pm_mcast = 1;
-                       priv->pm_on = 1;
-                       break;
-               case IW_POWER_ON:
-                       /* No flags : but we may have a value - Jean II */
-                       break;
-               default:
-                       err = -EINVAL;
-                       goto out;
-               }
-               
-               if (prq->flags & IW_POWER_TIMEOUT) {
-                       priv->pm_on = 1;
-                       priv->pm_timeout = prq->value / 1000;
-               }
-               if (prq->flags & IW_POWER_PERIOD) {
-                       priv->pm_on = 1;
-                       priv->pm_period = prq->value / 1000;
-               }
-               /* It's valid to not have a value if we are just toggling
-                * the flags... Jean II */
-               if(!priv->pm_on) {
-                       err = -EINVAL;
-                       goto out;
-               }                       
-       }
-
- out:
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_getpower(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 struct iw_param *prq,
-                                 char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       u16 enable, period, timeout, mcast;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-       
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFPMENABLED, &enable);
-       if (err)
-               goto out;
-
-       err = hermes_read_wordrec(hw, USER_BAP,
-                                 HERMES_RID_CNFMAXSLEEPDURATION, &period);
-       if (err)
-               goto out;
-
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFPMHOLDOVERDURATION, &timeout);
-       if (err)
-               goto out;
-
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFMULTICASTRECEIVE, &mcast);
-       if (err)
-               goto out;
-
-       prq->disabled = !enable;
-       /* Note : by default, display the period */
-       if ((prq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
-               prq->flags = IW_POWER_TIMEOUT;
-               prq->value = timeout * 1000;
-       } else {
-               prq->flags = IW_POWER_PERIOD;
-               prq->value = period * 1000;
-       }
-       if (mcast)
-               prq->flags |= IW_POWER_ALL_R;
-       else
-               prq->flags |= IW_POWER_UNICAST_R;
-
- out:
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_set_encodeext(struct net_device *dev,
-                                      struct iw_request_info *info,
-                                      union iwreq_data *wrqu,
-                                      char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct iw_point *encoding = &wrqu->encoding;
-       struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
-       int idx, alg = ext->alg, set_key = 1;
-       unsigned long flags;
-       int err = -EINVAL;
-       u16 key_len;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       /* Determine and validate the key index */
-       idx = encoding->flags & IW_ENCODE_INDEX;
-       if (idx) {
-               if ((idx < 1) || (idx > 4))
-                       goto out;
-               idx--;
-       } else
-               idx = priv->tx_key;
-
-       if (encoding->flags & IW_ENCODE_DISABLED)
-           alg = IW_ENCODE_ALG_NONE;
-
-       if (priv->has_wpa && (alg != IW_ENCODE_ALG_TKIP)) {
-               /* Clear any TKIP TX key we had */
-               (void) orinoco_clear_tkip_key(priv, priv->tx_key);
-       }
-
-       if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
-               priv->tx_key = idx;
-               set_key = ((alg == IW_ENCODE_ALG_TKIP) ||
-                          (ext->key_len > 0)) ? 1 : 0;
-       }
-
-       if (set_key) {
-               /* Set the requested key first */
-               switch (alg) {
-               case IW_ENCODE_ALG_NONE:
-                       priv->encode_alg = alg;
-                       priv->keys[idx].len = 0;
-                       break;
-
-               case IW_ENCODE_ALG_WEP:
-                       if (ext->key_len > SMALL_KEY_SIZE)
-                               key_len = LARGE_KEY_SIZE;
-                       else if (ext->key_len > 0)
-                               key_len = SMALL_KEY_SIZE;
-                       else
-                               goto out;
-
-                       priv->encode_alg = alg;
-                       priv->keys[idx].len = cpu_to_le16(key_len);
-
-                       key_len = min(ext->key_len, key_len);
-
-                       memset(priv->keys[idx].data, 0, ORINOCO_MAX_KEY_SIZE);
-                       memcpy(priv->keys[idx].data, ext->key, key_len);
-                       break;
-
-               case IW_ENCODE_ALG_TKIP:
-               {
-                       hermes_t *hw = &priv->hw;
-                       u8 *tkip_iv = NULL;
-
-                       if (!priv->has_wpa ||
-                           (ext->key_len > sizeof(priv->tkip_key[0])))
-                               goto out;
-
-                       priv->encode_alg = alg;
-                       memset(&priv->tkip_key[idx], 0,
-                              sizeof(priv->tkip_key[idx]));
-                       memcpy(&priv->tkip_key[idx], ext->key, ext->key_len);
-
-                       if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID)
-                               tkip_iv = &ext->rx_seq[0];
-
-                       err = __orinoco_hw_set_tkip_key(hw, idx,
-                                ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY,
-                                (u8 *) &priv->tkip_key[idx],
-                                tkip_iv, NULL);
-                       if (err)
-                               printk(KERN_ERR "%s: Error %d setting TKIP key"
-                                      "\n", dev->name, err);
-
-                       goto out;
-               }
-               default:
-                       goto out;
-               }
-       }
-       err = -EINPROGRESS;
- out:
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_get_encodeext(struct net_device *dev,
-                                      struct iw_request_info *info,
-                                      union iwreq_data *wrqu,
-                                      char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct iw_point *encoding = &wrqu->encoding;
-       struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
-       int idx, max_key_len;
-       unsigned long flags;
-       int err;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       err = -EINVAL;
-       max_key_len = encoding->length - sizeof(*ext);
-       if (max_key_len < 0)
-               goto out;
-
-       idx = encoding->flags & IW_ENCODE_INDEX;
-       if (idx) {
-               if ((idx < 1) || (idx > 4))
-                       goto out;
-               idx--;
-       } else
-               idx = priv->tx_key;
-
-       encoding->flags = idx + 1;
-       memset(ext, 0, sizeof(*ext));
-
-       ext->alg = priv->encode_alg;
-       switch (priv->encode_alg) {
-       case IW_ENCODE_ALG_NONE:
-               ext->key_len = 0;
-               encoding->flags |= IW_ENCODE_DISABLED;
-               break;
-       case IW_ENCODE_ALG_WEP:
-               ext->key_len = min_t(u16, le16_to_cpu(priv->keys[idx].len),
-                                    max_key_len);
-               memcpy(ext->key, priv->keys[idx].data, ext->key_len);
-               encoding->flags |= IW_ENCODE_ENABLED;
-               break;
-       case IW_ENCODE_ALG_TKIP:
-               ext->key_len = min_t(u16, sizeof(struct orinoco_tkip_key),
-                                    max_key_len);
-               memcpy(ext->key, &priv->tkip_key[idx], ext->key_len);
-               encoding->flags |= IW_ENCODE_ENABLED;
-               break;
-       }
-
-       err = 0;
- out:
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_set_auth(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 union iwreq_data *wrqu, char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       struct iw_param *param = &wrqu->param;
-       unsigned long flags;
-       int ret = -EINPROGRESS;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       switch (param->flags & IW_AUTH_INDEX) {
-       case IW_AUTH_WPA_VERSION:
-       case IW_AUTH_CIPHER_PAIRWISE:
-       case IW_AUTH_CIPHER_GROUP:
-       case IW_AUTH_RX_UNENCRYPTED_EAPOL:
-       case IW_AUTH_PRIVACY_INVOKED:
-       case IW_AUTH_DROP_UNENCRYPTED:
-               /*
-                * orinoco does not use these parameters
-                */
-               break;
-
-       case IW_AUTH_KEY_MGMT:
-               /* wl_lkm implies value 2 == PSK for Hermes I
-                * which ties in with WEXT
-                * no other hints tho :(
-                */
-               priv->key_mgmt = param->value;
-               break;
-
-       case IW_AUTH_TKIP_COUNTERMEASURES:
-               /* When countermeasures are enabled, shut down the
-                * card; when disabled, re-enable the card. This must
-                * take effect immediately.
-                *
-                * TODO: Make sure that the EAPOL message is getting
-                *       out before card disabled
-                */
-               if (param->value) {
-                       priv->tkip_cm_active = 1;
-                       ret = hermes_enable_port(hw, 0);
-               } else {
-                       priv->tkip_cm_active = 0;
-                       ret = hermes_disable_port(hw, 0);
-               }
-               break;
-
-       case IW_AUTH_80211_AUTH_ALG:
-               if (param->value & IW_AUTH_ALG_SHARED_KEY)
-                       priv->wep_restrict = 1;
-               else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM)
-                       priv->wep_restrict = 0;
-               else
-                       ret = -EINVAL;
-               break;
-
-       case IW_AUTH_WPA_ENABLED:
-               if (priv->has_wpa) {
-                       priv->wpa_enabled = param->value ? 1 : 0;
-               } else {
-                       if (param->value)
-                               ret = -EOPNOTSUPP;
-                       /* else silently accept disable of WPA */
-                       priv->wpa_enabled = 0;
-               }
-               break;
-
-       default:
-               ret = -EOPNOTSUPP;
-       }
-
-       orinoco_unlock(priv, &flags);
-       return ret;
-}
-
-static int orinoco_ioctl_get_auth(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 union iwreq_data *wrqu, char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct iw_param *param = &wrqu->param;
-       unsigned long flags;
-       int ret = 0;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       switch (param->flags & IW_AUTH_INDEX) {
-       case IW_AUTH_KEY_MGMT:
-               param->value = priv->key_mgmt;
-               break;
-
-       case IW_AUTH_TKIP_COUNTERMEASURES:
-               param->value = priv->tkip_cm_active;
-               break;
-
-       case IW_AUTH_80211_AUTH_ALG:
-               if (priv->wep_restrict)
-                       param->value = IW_AUTH_ALG_SHARED_KEY;
-               else
-                       param->value = IW_AUTH_ALG_OPEN_SYSTEM;
-               break;
-
-       case IW_AUTH_WPA_ENABLED:
-               param->value = priv->wpa_enabled;
-               break;
-
-       default:
-               ret = -EOPNOTSUPP;
-       }
-
-       orinoco_unlock(priv, &flags);
-       return ret;
-}
-
-static int orinoco_ioctl_set_genie(struct net_device *dev,
-                                  struct iw_request_info *info,
-                                  union iwreq_data *wrqu, char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       u8 *buf;
-       unsigned long flags;
-
-       /* cut off at IEEE80211_MAX_DATA_LEN */
-       if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) ||
-           (wrqu->data.length && (extra == NULL)))
-               return -EINVAL;
-
-       if (wrqu->data.length) {
-               buf = kmalloc(wrqu->data.length, GFP_KERNEL);
-               if (buf == NULL)
-                       return -ENOMEM;
-
-               memcpy(buf, extra, wrqu->data.length);
-       } else
-               buf = NULL;
-
-       if (orinoco_lock(priv, &flags) != 0) {
-               kfree(buf);
-               return -EBUSY;
-       }
-
-       kfree(priv->wpa_ie);
-       priv->wpa_ie = buf;
-       priv->wpa_ie_len = wrqu->data.length;
-
-       if (priv->wpa_ie) {
-               /* Looks like wl_lkm wants to check the auth alg, and
-                * somehow pass it to the firmware.
-                * Instead it just calls the key mgmt rid
-                *   - we do this in set auth.
-                */
-       }
-
-       orinoco_unlock(priv, &flags);
-       return 0;
-}
-
-static int orinoco_ioctl_get_genie(struct net_device *dev,
-                                  struct iw_request_info *info,
-                                  union iwreq_data *wrqu, char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       unsigned long flags;
-       int err = 0;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       if ((priv->wpa_ie_len == 0) || (priv->wpa_ie == NULL)) {
-               wrqu->data.length = 0;
-               goto out;
-       }
-
-       if (wrqu->data.length < priv->wpa_ie_len) {
-               err = -E2BIG;
-               goto out;
-       }
-
-       wrqu->data.length = priv->wpa_ie_len;
-       memcpy(extra, priv->wpa_ie, priv->wpa_ie_len);
-
-out:
-       orinoco_unlock(priv, &flags);
-       return err;
-}
-
-static int orinoco_ioctl_set_mlme(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 union iwreq_data *wrqu, char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       struct iw_mlme *mlme = (struct iw_mlme *)extra;
-       unsigned long flags;
-       int ret = 0;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       switch (mlme->cmd) {
-       case IW_MLME_DEAUTH:
-               /* silently ignore */
-               break;
-
-       case IW_MLME_DISASSOC:
-       {
-               struct {
-                       u8 addr[ETH_ALEN];
-                       __le16 reason_code;
-               } __attribute__ ((packed)) buf;
-
-               memcpy(buf.addr, mlme->addr.sa_data, ETH_ALEN);
-               buf.reason_code = cpu_to_le16(mlme->reason_code);
-               ret = HERMES_WRITE_RECORD(hw, USER_BAP,
-                                         HERMES_RID_CNFDISASSOCIATE,
-                                         &buf);
-               break;
-       }
-       default:
-               ret = -EOPNOTSUPP;
-       }
-
-       orinoco_unlock(priv, &flags);
-       return ret;
-}
-
-static int orinoco_ioctl_getretry(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 struct iw_param *rrq,
-                                 char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int err = 0;
-       u16 short_limit, long_limit, lifetime;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-       
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORTRETRYLIMIT,
-                                 &short_limit);
-       if (err)
-               goto out;
-
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONGRETRYLIMIT,
-                                 &long_limit);
-       if (err)
-               goto out;
-
-       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAXTRANSMITLIFETIME,
-                                 &lifetime);
-       if (err)
-               goto out;
-
-       rrq->disabled = 0;              /* Can't be disabled */
-
-       /* Note : by default, display the retry number */
-       if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
-               rrq->flags = IW_RETRY_LIFETIME;
-               rrq->value = lifetime * 1000;   /* ??? */
-       } else {
-               /* By default, display the min number */
-               if ((rrq->flags & IW_RETRY_LONG)) {
-                       rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
-                       rrq->value = long_limit;
-               } else {
-                       rrq->flags = IW_RETRY_LIMIT;
-                       rrq->value = short_limit;
-                       if(short_limit != long_limit)
-                               rrq->flags |= IW_RETRY_SHORT;
-               }
-       }
-
- out:
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_reset(struct net_device *dev,
-                              struct iw_request_info *info,
-                              void *wrqu,
-                              char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-
-       if (! capable(CAP_NET_ADMIN))
-               return -EPERM;
-
-       if (info->cmd == (SIOCIWFIRSTPRIV + 0x1)) {
-               printk(KERN_DEBUG "%s: Forcing reset!\n", dev->name);
-
-               /* Firmware reset */
-               orinoco_reset(&priv->reset_work);
-       } else {
-               printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name);
-
-               schedule_work(&priv->reset_work);
-       }
-
-       return 0;
-}
-
-static int orinoco_ioctl_setibssport(struct net_device *dev,
-                                    struct iw_request_info *info,
-                                    void *wrqu,
-                                    char *extra)
-
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int val = *( (int *) extra );
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       priv->ibss_port = val ;
-
-       /* Actually update the mode we are using */
-       set_port_type(priv);
-
-       orinoco_unlock(priv, &flags);
-       return -EINPROGRESS;            /* Call commit handler */
-}
-
-static int orinoco_ioctl_getibssport(struct net_device *dev,
-                                    struct iw_request_info *info,
-                                    void *wrqu,
-                                    char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int *val = (int *) extra;
-
-       *val = priv->ibss_port;
-       return 0;
-}
-
-static int orinoco_ioctl_setport3(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 void *wrqu,
-                                 char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int val = *( (int *) extra );
-       int err = 0;
-       unsigned long flags;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       switch (val) {
-       case 0: /* Try to do IEEE ad-hoc mode */
-               if (! priv->has_ibss) {
-                       err = -EINVAL;
-                       break;
-               }
-               priv->prefer_port3 = 0;
-                       
-               break;
-
-       case 1: /* Try to do Lucent proprietary ad-hoc mode */
-               if (! priv->has_port3) {
-                       err = -EINVAL;
-                       break;
-               }
-               priv->prefer_port3 = 1;
-               break;
-
-       default:
-               err = -EINVAL;
-       }
-
-       if (! err) {
-               /* Actually update the mode we are using */
-               set_port_type(priv);
-               err = -EINPROGRESS;
-       }
-
-       orinoco_unlock(priv, &flags);
-
-       return err;
-}
-
-static int orinoco_ioctl_getport3(struct net_device *dev,
-                                 struct iw_request_info *info,
-                                 void *wrqu,
-                                 char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int *val = (int *) extra;
-
-       *val = priv->prefer_port3;
-       return 0;
-}
-
-static int orinoco_ioctl_setpreamble(struct net_device *dev,
-                                    struct iw_request_info *info,
-                                    void *wrqu,
-                                    char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       unsigned long flags;
-       int val;
-
-       if (! priv->has_preamble)
-               return -EOPNOTSUPP;
-
-       /* 802.11b has recently defined some short preamble.
-        * Basically, the Phy header has been reduced in size.
-        * This increase performance, especially at high rates
-        * (the preamble is transmitted at 1Mb/s), unfortunately
-        * this give compatibility troubles... - Jean II */
-       val = *( (int *) extra );
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       if (val)
-               priv->preamble = 1;
-       else
-               priv->preamble = 0;
-
-       orinoco_unlock(priv, &flags);
-
-       return -EINPROGRESS;            /* Call commit handler */
-}
-
-static int orinoco_ioctl_getpreamble(struct net_device *dev,
-                                    struct iw_request_info *info,
-                                    void *wrqu,
-                                    char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int *val = (int *) extra;
-
-       if (! priv->has_preamble)
-               return -EOPNOTSUPP;
-
-       *val = priv->preamble;
-       return 0;
-}
-
-/* ioctl interface to hermes_read_ltv()
- * To use with iwpriv, pass the RID as the token argument, e.g.
- * iwpriv get_rid [0xfc00]
- * At least Wireless Tools 25 is required to use iwpriv.
- * For Wireless Tools 25 and 26 append "dummy" are the end. */
-static int orinoco_ioctl_getrid(struct net_device *dev,
-                               struct iw_request_info *info,
-                               struct iw_point *data,
-                               char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       int rid = data->flags;
-       u16 length;
-       int err;
-       unsigned long flags;
-
-       /* It's a "get" function, but we don't want users to access the
-        * WEP key and other raw firmware data */
-       if (! capable(CAP_NET_ADMIN))
-               return -EPERM;
-
-       if (rid < 0xfc00 || rid > 0xffff)
-               return -EINVAL;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       err = hermes_read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length,
-                             extra);
-       if (err)
-               goto out;
-
-       data->length = min_t(u16, HERMES_RECLEN_TO_BYTES(length),
-                            MAX_RID_LEN);
-
- out:
-       orinoco_unlock(priv, &flags);
-       return err;
-}
-
-/* Trigger a scan (look for other cells in the vicinity) */
-static int orinoco_ioctl_setscan(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_point *srq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       hermes_t *hw = &priv->hw;
-       struct iw_scan_req *si = (struct iw_scan_req *) extra;
-       int err = 0;
-       unsigned long flags;
-
-       /* Note : you may have realised that, as this is a SET operation,
-        * this is privileged and therefore a normal user can't
-        * perform scanning.
-        * This is not an error, while the device perform scanning,
-        * traffic doesn't flow, so it's a perfect DoS...
-        * Jean II */
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       /* Scanning with port 0 disabled would fail */
-       if (!netif_running(dev)) {
-               err = -ENETDOWN;
-               goto out;
-       }
-
-       /* In monitor mode, the scan results are always empty.
-        * Probe responses are passed to the driver as received
-        * frames and could be processed in software. */
-       if (priv->iw_mode == IW_MODE_MONITOR) {
-               err = -EOPNOTSUPP;
-               goto out;
-       }
-
-       /* Note : because we don't lock out the irq handler, the way
-        * we access scan variables in priv is critical.
-        *      o scan_inprogress : not touched by irq handler
-        *      o scan_mode : not touched by irq handler
-        * Before modifying anything on those variables, please think hard !
-        * Jean II */
-
-       /* Save flags */
-       priv->scan_mode = srq->flags;
-
-       /* Always trigger scanning, even if it's in progress.
-        * This way, if the info frame get lost, we will recover somewhat
-        * gracefully  - Jean II */
-
-       if (priv->has_hostscan) {
-               switch (priv->firmware_type) {
-               case FIRMWARE_TYPE_SYMBOL:
-                       err = hermes_write_wordrec(hw, USER_BAP,
-                                                  HERMES_RID_CNFHOSTSCAN_SYMBOL,
-                                                  HERMES_HOSTSCAN_SYMBOL_ONCE |
-                                                  HERMES_HOSTSCAN_SYMBOL_BCAST);
-                       break;
-               case FIRMWARE_TYPE_INTERSIL: {
-                       __le16 req[3];
-
-                       req[0] = cpu_to_le16(0x3fff);   /* All channels */
-                       req[1] = cpu_to_le16(0x0001);   /* rate 1 Mbps */
-                       req[2] = 0;                     /* Any ESSID */
-                       err = HERMES_WRITE_RECORD(hw, USER_BAP,
-                                                 HERMES_RID_CNFHOSTSCAN, &req);
-               }
-               break;
-               case FIRMWARE_TYPE_AGERE:
-                       if (priv->scan_mode & IW_SCAN_THIS_ESSID) {
-                               struct hermes_idstring idbuf;
-                               size_t len = min(sizeof(idbuf.val),
-                                                (size_t) si->essid_len);
-                               idbuf.len = cpu_to_le16(len);
-                               memcpy(idbuf.val, si->essid, len);
-
-                               err = hermes_write_ltv(hw, USER_BAP,
-                                              HERMES_RID_CNFSCANSSID_AGERE,
-                                              HERMES_BYTES_TO_RECLEN(len + 2),
-                                              &idbuf);
-                       } else
-                               err = hermes_write_wordrec(hw, USER_BAP,
-                                                  HERMES_RID_CNFSCANSSID_AGERE,
-                                                  0);  /* Any ESSID */
-                       if (err)
-                               break;
-
-                       if (priv->has_ext_scan) {
-                               /* Clear scan results at the start of
-                                * an extended scan */
-                               orinoco_clear_scan_results(priv,
-                                               msecs_to_jiffies(15000));
-
-                               /* TODO: Is this available on older firmware?
-                                *   Can we use it to scan specific channels
-                                *   for IW_SCAN_THIS_FREQ? */
-                               err = hermes_write_wordrec(hw, USER_BAP,
-                                               HERMES_RID_CNFSCANCHANNELS2GHZ,
-                                               0x7FFF);
-                               if (err)
-                                       goto out;
-
-                               err = hermes_inquire(hw,
-                                                    HERMES_INQ_CHANNELINFO);
-                       } else
-                               err = hermes_inquire(hw, HERMES_INQ_SCAN);
-                       break;
-               }
-       } else
-               err = hermes_inquire(hw, HERMES_INQ_SCAN);
-
-       /* One more client */
-       if (! err)
-               priv->scan_inprogress = 1;
-
- out:
-       orinoco_unlock(priv, &flags);
-       return err;
-}
-
-#define MAX_CUSTOM_LEN 64
-
-/* Translate scan data returned from the card to a card independant
- * format that the Wireless Tools will understand - Jean II */
-static inline char *orinoco_translate_scan(struct net_device *dev,
-                                          struct iw_request_info *info,
-                                          char *current_ev,
-                                          char *end_buf,
-                                          union hermes_scan_info *bss,
-                                          unsigned long last_scanned)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       u16                     capabilities;
-       u16                     channel;
-       struct iw_event         iwe;            /* Temporary buffer */
-       char custom[MAX_CUSTOM_LEN];
-
-       memset(&iwe, 0, sizeof(iwe));
-
-       /* First entry *MUST* be the AP MAC address */
-       iwe.cmd = SIOCGIWAP;
-       iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
-       memcpy(iwe.u.ap_addr.sa_data, bss->a.bssid, ETH_ALEN);
-       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                         &iwe, IW_EV_ADDR_LEN);
-
-       /* Other entries will be displayed in the order we give them */
-
-       /* Add the ESSID */
-       iwe.u.data.length = le16_to_cpu(bss->a.essid_len);
-       if (iwe.u.data.length > 32)
-               iwe.u.data.length = 32;
-       iwe.cmd = SIOCGIWESSID;
-       iwe.u.data.flags = 1;
-       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                         &iwe, bss->a.essid);
-
-       /* Add mode */
-       iwe.cmd = SIOCGIWMODE;
-       capabilities = le16_to_cpu(bss->a.capabilities);
-       if (capabilities & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
-               if (capabilities & WLAN_CAPABILITY_ESS)
-                       iwe.u.mode = IW_MODE_MASTER;
-               else
-                       iwe.u.mode = IW_MODE_ADHOC;
-               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                                 &iwe, IW_EV_UINT_LEN);
-       }
-
-       channel = bss->s.channel;
-       if ((channel >= 1) && (channel <= NUM_CHANNELS)) {
-               /* Add channel and frequency */
-               iwe.cmd = SIOCGIWFREQ;
-               iwe.u.freq.m = channel;
-               iwe.u.freq.e = 0;
-               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                                 &iwe, IW_EV_FREQ_LEN);
-
-               iwe.u.freq.m = channel_frequency[channel-1] * 100000;
-               iwe.u.freq.e = 1;
-               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                                 &iwe, IW_EV_FREQ_LEN);
-       }
-
-       /* Add quality statistics. level and noise in dB. No link quality */
-       iwe.cmd = IWEVQUAL;
-       iwe.u.qual.updated = IW_QUAL_DBM | IW_QUAL_QUAL_INVALID;
-       iwe.u.qual.level = (__u8) le16_to_cpu(bss->a.level) - 0x95;
-       iwe.u.qual.noise = (__u8) le16_to_cpu(bss->a.noise) - 0x95;
-       /* Wireless tools prior to 27.pre22 will show link quality
-        * anyway, so we provide a reasonable value. */
-       if (iwe.u.qual.level > iwe.u.qual.noise)
-               iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
-       else
-               iwe.u.qual.qual = 0;
-       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                         &iwe, IW_EV_QUAL_LEN);
-
-       /* Add encryption capability */
-       iwe.cmd = SIOCGIWENCODE;
-       if (capabilities & WLAN_CAPABILITY_PRIVACY)
-               iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
-       else
-               iwe.u.data.flags = IW_ENCODE_DISABLED;
-       iwe.u.data.length = 0;
-       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                         &iwe, NULL);
-
-       /* Bit rate is not available in Lucent/Agere firmwares */
-       if (priv->firmware_type != FIRMWARE_TYPE_AGERE) {
-               char *current_val = current_ev + iwe_stream_lcp_len(info);
-               int i;
-               int step;
-
-               if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL)
-                       step = 2;
-               else
-                       step = 1;
-
-               iwe.cmd = SIOCGIWRATE;
-               /* Those two flags are ignored... */
-               iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
-               /* Max 10 values */
-               for (i = 0; i < 10; i += step) {
-                       /* NULL terminated */
-                       if (bss->p.rates[i] == 0x0)
-                               break;
-                       /* Bit rate given in 500 kb/s units (+ 0x80) */
-                       iwe.u.bitrate.value =
-                               ((bss->p.rates[i] & 0x7f) * 500000);
-                       current_val = iwe_stream_add_value(info, current_ev,
-                                                          current_val,
-                                                          end_buf, &iwe,
-                                                          IW_EV_PARAM_LEN);
-               }
-               /* Check if we added any event */
-               if ((current_val - current_ev) > iwe_stream_lcp_len(info))
-                       current_ev = current_val;
-       }
-
-       /* Beacon interval */
-       iwe.cmd = IWEVCUSTOM;
-       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
-                                    "bcn_int=%d",
-                                    le16_to_cpu(bss->a.beacon_interv));
-       if (iwe.u.data.length)
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, custom);
-
-       /* Capabilites */
-       iwe.cmd = IWEVCUSTOM;
-       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
-                                    "capab=0x%04x",
-                                    capabilities);
-       if (iwe.u.data.length)
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, custom);
-
-       /* Add EXTRA: Age to display seconds since last beacon/probe response
-        * for given network. */
-       iwe.cmd = IWEVCUSTOM;
-       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
-                                    " Last beacon: %dms ago",
-                                    jiffies_to_msecs(jiffies - last_scanned));
-       if (iwe.u.data.length)
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, custom);
-
-       return current_ev;
-}
-
-static inline char *orinoco_translate_ext_scan(struct net_device *dev,
-                                              struct iw_request_info *info,
-                                              char *current_ev,
-                                              char *end_buf,
-                                              struct agere_ext_scan_info *bss,
-                                              unsigned long last_scanned)
-{
-       u16                     capabilities;
-       u16                     channel;
-       struct iw_event         iwe;            /* Temporary buffer */
-       char custom[MAX_CUSTOM_LEN];
-       u8 *ie;
-
-       memset(&iwe, 0, sizeof(iwe));
-
-       /* First entry *MUST* be the AP MAC address */
-       iwe.cmd = SIOCGIWAP;
-       iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
-       memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN);
-       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                         &iwe, IW_EV_ADDR_LEN);
-
-       /* Other entries will be displayed in the order we give them */
-
-       /* Add the ESSID */
-       ie = bss->data;
-       iwe.u.data.length = ie[1];
-       if (iwe.u.data.length) {
-               if (iwe.u.data.length > 32)
-                       iwe.u.data.length = 32;
-               iwe.cmd = SIOCGIWESSID;
-               iwe.u.data.flags = 1;
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, &ie[2]);
-       }
-
-       /* Add mode */
-       capabilities = le16_to_cpu(bss->capabilities);
-       if (capabilities & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
-               iwe.cmd = SIOCGIWMODE;
-               if (capabilities & WLAN_CAPABILITY_ESS)
-                       iwe.u.mode = IW_MODE_MASTER;
-               else
-                       iwe.u.mode = IW_MODE_ADHOC;
-               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                                 &iwe, IW_EV_UINT_LEN);
-       }
-
-       ie = orinoco_get_ie(bss->data, sizeof(bss->data), WLAN_EID_DS_PARAMS);
-       channel = ie ? ie[2] : 0;
-       if ((channel >= 1) && (channel <= NUM_CHANNELS)) {
-               /* Add channel and frequency */
-               iwe.cmd = SIOCGIWFREQ;
-               iwe.u.freq.m = channel;
-               iwe.u.freq.e = 0;
-               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                                 &iwe, IW_EV_FREQ_LEN);
-
-               iwe.u.freq.m = channel_frequency[channel-1] * 100000;
-               iwe.u.freq.e = 1;
-               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                                 &iwe, IW_EV_FREQ_LEN);
-       }
-
-       /* Add quality statistics. level and noise in dB. No link quality */
-       iwe.cmd = IWEVQUAL;
-       iwe.u.qual.updated = IW_QUAL_DBM | IW_QUAL_QUAL_INVALID;
-       iwe.u.qual.level = bss->level - 0x95;
-       iwe.u.qual.noise = bss->noise - 0x95;
-       /* Wireless tools prior to 27.pre22 will show link quality
-        * anyway, so we provide a reasonable value. */
-       if (iwe.u.qual.level > iwe.u.qual.noise)
-               iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
-       else
-               iwe.u.qual.qual = 0;
-       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                         &iwe, IW_EV_QUAL_LEN);
-
-       /* Add encryption capability */
-       iwe.cmd = SIOCGIWENCODE;
-       if (capabilities & WLAN_CAPABILITY_PRIVACY)
-               iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
-       else
-               iwe.u.data.flags = IW_ENCODE_DISABLED;
-       iwe.u.data.length = 0;
-       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                         &iwe, NULL);
-
-       /* WPA IE */
-       ie = orinoco_get_wpa_ie(bss->data, sizeof(bss->data));
-       if (ie) {
-               iwe.cmd = IWEVGENIE;
-               iwe.u.data.length = ie[1] + 2;
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, ie);
-       }
-
-       /* RSN IE */
-       ie = orinoco_get_ie(bss->data, sizeof(bss->data), WLAN_EID_RSN);
-       if (ie) {
-               iwe.cmd = IWEVGENIE;
-               iwe.u.data.length = ie[1] + 2;
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, ie);
-       }
-
-       ie = orinoco_get_ie(bss->data, sizeof(bss->data), WLAN_EID_SUPP_RATES);
-       if (ie) {
-               char *p = current_ev + iwe_stream_lcp_len(info);
-               int i;
-
-               iwe.cmd = SIOCGIWRATE;
-               /* Those two flags are ignored... */
-               iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
-
-               for (i = 2; i < (ie[1] + 2); i++) {
-                       iwe.u.bitrate.value = ((ie[i] & 0x7F) * 500000);
-                       p = iwe_stream_add_value(info, current_ev, p, end_buf,
-                                                &iwe, IW_EV_PARAM_LEN);
-               }
-               /* Check if we added any event */
-               if (p > (current_ev + iwe_stream_lcp_len(info)))
-                       current_ev = p;
-       }
-
-       /* Timestamp */
-       iwe.cmd = IWEVCUSTOM;
-       iwe.u.data.length =
-               snprintf(custom, MAX_CUSTOM_LEN, "tsf=%016llx",
-                        (unsigned long long) le64_to_cpu(bss->timestamp));
-       if (iwe.u.data.length)
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, custom);
-
-       /* Beacon interval */
-       iwe.cmd = IWEVCUSTOM;
-       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
-                                    "bcn_int=%d",
-                                    le16_to_cpu(bss->beacon_interval));
-       if (iwe.u.data.length)
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, custom);
-
-       /* Capabilites */
-       iwe.cmd = IWEVCUSTOM;
-       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
-                                    "capab=0x%04x",
-                                    capabilities);
-       if (iwe.u.data.length)
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, custom);
-
-       /* Add EXTRA: Age to display seconds since last beacon/probe response
-        * for given network. */
-       iwe.cmd = IWEVCUSTOM;
-       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
-                                    " Last beacon: %dms ago",
-                                    jiffies_to_msecs(jiffies - last_scanned));
-       if (iwe.u.data.length)
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, custom);
-
-       return current_ev;
-}
-
-/* Return results of a scan */
-static int orinoco_ioctl_getscan(struct net_device *dev,
-                                struct iw_request_info *info,
-                                struct iw_point *srq,
-                                char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       int err = 0;
-       unsigned long flags;
-       char *current_ev = extra;
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return -EBUSY;
-
-       if (priv->scan_inprogress) {
-               /* Important note : we don't want to block the caller
-                * until results are ready for various reasons.
-                * First, managing wait queues is complex and racy.
-                * Second, we grab some rtnetlink lock before comming
-                * here (in dev_ioctl()).
-                * Third, we generate an Wireless Event, so the
-                * caller can wait itself on that - Jean II */
-               err = -EAGAIN;
-               goto out;
-       }
-
-       if (priv->has_ext_scan) {
-               struct xbss_element *bss;
-
-               list_for_each_entry(bss, &priv->bss_list, list) {
-                       /* Translate this entry to WE format */
-                       current_ev =
-                               orinoco_translate_ext_scan(dev, info,
-                                                          current_ev,
-                                                          extra + srq->length,
-                                                          &bss->bss,
-                                                          bss->last_scanned);
-
-                       /* Check if there is space for one more entry */
-                       if ((extra + srq->length - current_ev)
-                           <= IW_EV_ADDR_LEN) {
-                               /* Ask user space to try again with a
-                                * bigger buffer */
-                               err = -E2BIG;
-                               goto out;
-                       }
-               }
-
-       } else {
-               struct bss_element *bss;
-
-               list_for_each_entry(bss, &priv->bss_list, list) {
-                       /* Translate this entry to WE format */
-                       current_ev = orinoco_translate_scan(dev, info,
-                                                           current_ev,
-                                                           extra + srq->length,
-                                                           &bss->bss,
-                                                           bss->last_scanned);
-
-                       /* Check if there is space for one more entry */
-                       if ((extra + srq->length - current_ev)
-                           <= IW_EV_ADDR_LEN) {
-                               /* Ask user space to try again with a
-                                * bigger buffer */
-                               err = -E2BIG;
-                               goto out;
-                       }
-               }
-       }
-
-       srq->length = (current_ev - extra);
-       srq->flags = (__u16) priv->scan_mode;
-
-out:
-       orinoco_unlock(priv, &flags);
-       return err;
-}
-
-/* Commit handler, called after set operations */
-static int orinoco_ioctl_commit(struct net_device *dev,
-                               struct iw_request_info *info,
-                               void *wrqu,
-                               char *extra)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-       struct hermes *hw = &priv->hw;
-       unsigned long flags;
-       int err = 0;
-
-       if (!priv->open)
-               return 0;
-
-       if (priv->broken_disableport) {
-               orinoco_reset(&priv->reset_work);
-               return 0;
-       }
-
-       if (orinoco_lock(priv, &flags) != 0)
-               return err;
-
-       err = hermes_disable_port(hw, 0);
-       if (err) {
-               printk(KERN_WARNING "%s: Unable to disable port "
-                      "while reconfiguring card\n", dev->name);
-               priv->broken_disableport = 1;
-               goto out;
-       }
-
-       err = __orinoco_program_rids(dev);
-       if (err) {
-               printk(KERN_WARNING "%s: Unable to reconfigure card\n",
-                      dev->name);
-               goto out;
-       }
-
-       err = hermes_enable_port(hw, 0);
-       if (err) {
-               printk(KERN_WARNING "%s: Unable to enable port while reconfiguring card\n",
-                      dev->name);
-               goto out;
-       }
-
- out:
-       if (err) {
-               printk(KERN_WARNING "%s: Resetting instead...\n", dev->name);
-               schedule_work(&priv->reset_work);
-               err = 0;
-       }
-
-       orinoco_unlock(priv, &flags);
-       return err;
-}
-
-static const struct iw_priv_args orinoco_privtab[] = {
-       { SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" },
-       { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" },
-       { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-         0, "set_port3" },
-       { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-         "get_port3" },
-       { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-         0, "set_preamble" },
-       { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-         "get_preamble" },
-       { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-         0, "set_ibssport" },
-       { SIOCIWFIRSTPRIV + 0x7, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
-         "get_ibssport" },
-       { SIOCIWFIRSTPRIV + 0x9, 0, IW_PRIV_TYPE_BYTE | MAX_RID_LEN,
-         "get_rid" },
-};
-
-
-/*
- * Structures to export the Wireless Handlers
- */
-
-#define STD_IW_HANDLER(id, func) \
-       [IW_IOCTL_IDX(id)] = (iw_handler) func
-static const iw_handler        orinoco_handler[] = {
-       STD_IW_HANDLER(SIOCSIWCOMMIT,   orinoco_ioctl_commit),
-       STD_IW_HANDLER(SIOCGIWNAME,     orinoco_ioctl_getname),
-       STD_IW_HANDLER(SIOCSIWFREQ,     orinoco_ioctl_setfreq),
-       STD_IW_HANDLER(SIOCGIWFREQ,     orinoco_ioctl_getfreq),
-       STD_IW_HANDLER(SIOCSIWMODE,     orinoco_ioctl_setmode),
-       STD_IW_HANDLER(SIOCGIWMODE,     orinoco_ioctl_getmode),
-       STD_IW_HANDLER(SIOCSIWSENS,     orinoco_ioctl_setsens),
-       STD_IW_HANDLER(SIOCGIWSENS,     orinoco_ioctl_getsens),
-       STD_IW_HANDLER(SIOCGIWRANGE,    orinoco_ioctl_getiwrange),
-       STD_IW_HANDLER(SIOCSIWSPY,      iw_handler_set_spy),
-       STD_IW_HANDLER(SIOCGIWSPY,      iw_handler_get_spy),
-       STD_IW_HANDLER(SIOCSIWTHRSPY,   iw_handler_set_thrspy),
-       STD_IW_HANDLER(SIOCGIWTHRSPY,   iw_handler_get_thrspy),
-       STD_IW_HANDLER(SIOCSIWAP,       orinoco_ioctl_setwap),
-       STD_IW_HANDLER(SIOCGIWAP,       orinoco_ioctl_getwap),
-       STD_IW_HANDLER(SIOCSIWSCAN,     orinoco_ioctl_setscan),
-       STD_IW_HANDLER(SIOCGIWSCAN,     orinoco_ioctl_getscan),
-       STD_IW_HANDLER(SIOCSIWESSID,    orinoco_ioctl_setessid),
-       STD_IW_HANDLER(SIOCGIWESSID,    orinoco_ioctl_getessid),
-       STD_IW_HANDLER(SIOCSIWNICKN,    orinoco_ioctl_setnick),
-       STD_IW_HANDLER(SIOCGIWNICKN,    orinoco_ioctl_getnick),
-       STD_IW_HANDLER(SIOCSIWRATE,     orinoco_ioctl_setrate),
-       STD_IW_HANDLER(SIOCGIWRATE,     orinoco_ioctl_getrate),
-       STD_IW_HANDLER(SIOCSIWRTS,      orinoco_ioctl_setrts),
-       STD_IW_HANDLER(SIOCGIWRTS,      orinoco_ioctl_getrts),
-       STD_IW_HANDLER(SIOCSIWFRAG,     orinoco_ioctl_setfrag),
-       STD_IW_HANDLER(SIOCGIWFRAG,     orinoco_ioctl_getfrag),
-       STD_IW_HANDLER(SIOCGIWRETRY,    orinoco_ioctl_getretry),
-       STD_IW_HANDLER(SIOCSIWENCODE,   orinoco_ioctl_setiwencode),
-       STD_IW_HANDLER(SIOCGIWENCODE,   orinoco_ioctl_getiwencode),
-       STD_IW_HANDLER(SIOCSIWPOWER,    orinoco_ioctl_setpower),
-       STD_IW_HANDLER(SIOCGIWPOWER,    orinoco_ioctl_getpower),
-       STD_IW_HANDLER(SIOCSIWGENIE,    orinoco_ioctl_set_genie),
-       STD_IW_HANDLER(SIOCGIWGENIE,    orinoco_ioctl_get_genie),
-       STD_IW_HANDLER(SIOCSIWMLME,     orinoco_ioctl_set_mlme),
-       STD_IW_HANDLER(SIOCSIWAUTH,     orinoco_ioctl_set_auth),
-       STD_IW_HANDLER(SIOCGIWAUTH,     orinoco_ioctl_get_auth),
-       STD_IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext),
-       STD_IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext),
-};
-
-
-/*
-  Added typecasting since we no longer use iwreq_data -- Moustafa
- */
-static const iw_handler        orinoco_private_handler[] = {
-       [0] = (iw_handler) orinoco_ioctl_reset,
-       [1] = (iw_handler) orinoco_ioctl_reset,
-       [2] = (iw_handler) orinoco_ioctl_setport3,
-       [3] = (iw_handler) orinoco_ioctl_getport3,
-       [4] = (iw_handler) orinoco_ioctl_setpreamble,
-       [5] = (iw_handler) orinoco_ioctl_getpreamble,
-       [6] = (iw_handler) orinoco_ioctl_setibssport,
-       [7] = (iw_handler) orinoco_ioctl_getibssport,
-       [9] = (iw_handler) orinoco_ioctl_getrid,
-};
-
-static const struct iw_handler_def orinoco_handler_def = {
-       .num_standard = ARRAY_SIZE(orinoco_handler),
-       .num_private = ARRAY_SIZE(orinoco_private_handler),
-       .num_private_args = ARRAY_SIZE(orinoco_privtab),
-       .standard = orinoco_handler,
-       .private = orinoco_private_handler,
-       .private_args = orinoco_privtab,
-       .get_wireless_stats = orinoco_get_wireless_stats,
-};
-
-static void orinoco_get_drvinfo(struct net_device *dev,
-                               struct ethtool_drvinfo *info)
-{
-       struct orinoco_private *priv = netdev_priv(dev);
-
-       strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
-       strncpy(info->version, DRIVER_VERSION, sizeof(info->version) - 1);
-       strncpy(info->fw_version, priv->fw_name, sizeof(info->fw_version) - 1);
-       if (dev->dev.parent)
-               strncpy(info->bus_info, dev_name(dev->dev.parent),
-                       sizeof(info->bus_info) - 1);
-       else
-               snprintf(info->bus_info, sizeof(info->bus_info) - 1,
-                        "PCMCIA %p", priv->hw.iobase);
-}
-
-static const struct ethtool_ops orinoco_ethtool_ops = {
-       .get_drvinfo = orinoco_get_drvinfo,
-       .get_link = ethtool_op_get_link,
-};
-
-/********************************************************************/
-/* Module initialization                                            */
-/********************************************************************/
-
-EXPORT_SYMBOL(alloc_orinocodev);
-EXPORT_SYMBOL(free_orinocodev);
-
-EXPORT_SYMBOL(__orinoco_up);
-EXPORT_SYMBOL(__orinoco_down);
-EXPORT_SYMBOL(orinoco_reinit_firmware);
-
-EXPORT_SYMBOL(orinoco_interrupt);
-
-/* Can't be declared "const" or the whole __initdata section will
- * become const */
-static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
-       " (David Gibson <hermes@gibson.dropbear.id.au>, "
-       "Pavel Roskin <proski@gnu.org>, et al)";
-
-static int __init init_orinoco(void)
-{
-       printk(KERN_DEBUG "%s\n", version);
-       return 0;
-}
-
-static void __exit exit_orinoco(void)
-{
-}
-
-module_init(init_orinoco);
-module_exit(exit_orinoco);
index 00750c8ba7db4019a5ea36a6c46632cbd1aad1db..f3f94b28ce6df3b57b3f65f48e77aac2163abd22 100644 (file)
@@ -1,5 +1,5 @@
 /* orinoco.h
- * 
+ *
  * Common definitions to all pieces of the various orinoco
  * drivers
  */
@@ -18,9 +18,9 @@
 #include "hermes.h"
 
 /* To enable debug messages */
-//#define ORINOCO_DEBUG                3
+/*#define ORINOCO_DEBUG                3*/
 
-#define WIRELESS_SPY           // enable iwspy support
+#define WIRELESS_SPY           /* enable iwspy support */
 
 #define MAX_SCAN_LEN           4096
 
@@ -59,14 +59,6 @@ struct xbss_element {
        struct list_head list;
 };
 
-struct hermes_rx_descriptor;
-
-struct orinoco_rx_data {
-       struct hermes_rx_descriptor *desc;
-       struct sk_buff *skb;
-       struct list_head list;
-};
-
 struct firmware;
 
 struct orinoco_private {
@@ -83,7 +75,6 @@ struct orinoco_private {
        /* Interrupt tasklets */
        struct tasklet_struct rx_tasklet;
        struct list_head rx_list;
-       struct orinoco_rx_data *rx_data;
 
        /* driver state */
        int open;
@@ -130,7 +121,7 @@ struct orinoco_private {
        u16 encode_alg, wep_restrict, tx_key;
        struct orinoco_key keys[ORINOCO_MAX_KEYS];
        int bitratemode;
-       char nick[IW_ESSID_MAX_SIZE+1];
+       char nick[IW_ESSID_MAX_SIZE+1];
        char desired_essid[IW_ESSID_MAX_SIZE+1];
        char desired_bssid[ETH_ALEN];
        int bssid_fixed;
@@ -140,7 +131,7 @@ struct orinoco_private {
        u16 pm_on, pm_mcast, pm_period, pm_timeout;
        u16 preamble;
 #ifdef WIRELESS_SPY
-       struct iw_spy_data spy_data; /* iwspy support */
+       struct iw_spy_data spy_data; /* iwspy support */
        struct iw_public_data   wireless_data;
 #endif
 
@@ -177,7 +168,10 @@ struct orinoco_private {
 
 #ifdef ORINOCO_DEBUG
 extern int orinoco_debug;
-#define DEBUG(n, args...) do { if (orinoco_debug>(n)) printk(KERN_DEBUG args); } while(0)
+#define DEBUG(n, args...) do { \
+       if (orinoco_debug > (n)) \
+               printk(KERN_DEBUG args); \
+} while (0)
 #else
 #define DEBUG(n, args...) do { } while (0)
 #endif /* ORINOCO_DEBUG */
@@ -194,7 +188,7 @@ extern void free_orinocodev(struct net_device *dev);
 extern int __orinoco_up(struct net_device *dev);
 extern int __orinoco_down(struct net_device *dev);
 extern int orinoco_reinit_firmware(struct net_device *dev);
-extern irqreturn_t orinoco_interrupt(int irq, void * dev_id);
+extern irqreturn_t orinoco_interrupt(int irq, void *dev_id);
 
 /********************************************************************/
 /* Locking and synchronization functions                            */
index 0b32215d3f5d3ec4498b8ce2e957ea8c6b4b5628..b381aed24d73132e577f39d3427dcbec1e98cf1a 100644 (file)
@@ -6,8 +6,8 @@
  * It should also be usable on various Prism II based cards such as the
  * Linksys, D-Link and Farallon Skyline. It should also work on Symbol
  * cards such as the 3Com AirConnect and Ericsson WLAN.
- * 
- * Copyright notice & release notes in file orinoco.c
+ *
+ * Copyright notice & release notes in file main.c
  */
 
 #define DRIVER_NAME "orinoco_cs"
@@ -30,7 +30,8 @@
 /********************************************************************/
 
 MODULE_AUTHOR("David Gibson <hermes@gibson.dropbear.id.au>");
-MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco, Prism II based and similar wireless cards");
+MODULE_DESCRIPTION("Driver for PCMCIA Lucent Orinoco,"
+                  " Prism II based and similar wireless cards");
 MODULE_LICENSE("Dual MPL/GPL");
 
 /* Module parameters */
@@ -53,8 +54,8 @@ struct orinoco_pccard {
 
        /* Used to handle hard reset */
        /* yuck, we need this hack to work around the insanity of the
-         * PCMCIA layer */
-       unsigned long hard_reset_in_progress; 
+        * PCMCIA layer */
+       unsigned long hard_reset_in_progress;
 };
 
 
@@ -98,7 +99,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv)
  * This creates an "instance" of the driver, allocating local data
  * structures for one device.  The device is registered with Card
  * Services.
- * 
+ *
  * The dev_link structure is initialized, but we don't actually
  * configure the card at this point -- we wait until we receive a card
  * insertion event.  */
@@ -111,7 +112,7 @@ orinoco_cs_probe(struct pcmcia_device *link)
 
        dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link),
                               orinoco_cs_hard_reset, NULL);
-       if (! dev)
+       if (!dev)
                return -ENOMEM;
        priv = netdev_priv(dev);
        card = priv->card;
@@ -124,7 +125,7 @@ orinoco_cs_probe(struct pcmcia_device *link)
        link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
        link->irq.IRQInfo1 = IRQ_LEVEL_ID;
        link->irq.Handler = orinoco_interrupt;
-       link->irq.Instance = dev; 
+       link->irq.Instance = dev;
 
        /* General socket configuration defaults can go here.  In this
         * client, we assume very little, and rely on the CIS for
@@ -162,8 +163,10 @@ static void orinoco_cs_detach(struct pcmcia_device *link)
  */
 
 #define CS_CHECK(fn, ret) do { \
-               last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \
-       } while (0)
+       last_fn = (fn); \
+       if ((last_ret = (ret)) != 0) \
+               goto cs_failed; \
+} while (0)
 
 static int orinoco_cs_config_check(struct pcmcia_device *p_dev,
                                   cistpl_cftable_entry_t *cfg,
@@ -307,8 +310,8 @@ orinoco_cs_config(struct pcmcia_device *link)
         * initialized and arranged in a linked list at link->dev_node. */
        strcpy(card->node.dev_name, dev->name);
        link->dev_node = &card->node; /* link->dev_node being non-NULL is also
-                                    used to indicate that the
-                                    net_device has been registered */
+                                      * used to indicate that the
+                                      * net_device has been registered */
 
        /* Finally, report what we've done */
        printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "
@@ -359,7 +362,7 @@ static int orinoco_cs_suspend(struct pcmcia_device *link)
        /* This is probably racy, but I can't think of
           a better way, short of rewriting the PCMCIA
           layer to not suck :-( */
-       if (! test_bit(0, &card->hard_reset_in_progress)) {
+       if (!test_bit(0, &card->hard_reset_in_progress)) {
                spin_lock_irqsave(&priv->lock, flags);
 
                err = __orinoco_down(dev);
@@ -384,7 +387,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
        int err = 0;
        unsigned long flags;
 
-       if (! test_bit(0, &card->hard_reset_in_progress)) {
+       if (!test_bit(0, &card->hard_reset_in_progress)) {
                err = orinoco_reinit_firmware(dev);
                if (err) {
                        printk(KERN_ERR "%s: Error %d re-initializing firmware\n",
@@ -397,7 +400,7 @@ static int orinoco_cs_resume(struct pcmcia_device *link)
                netif_device_attach(dev);
                priv->hw_unavailable--;
 
-               if (priv->open && ! priv->hw_unavailable) {
+               if (priv->open && !priv->hw_unavailable) {
                        err = __orinoco_up(dev);
                        if (err)
                                printk(KERN_ERR "%s: Error %d restarting card\n",
index 2fc86596302e6bc1adb099a3bd35373b51d5bf86..b01726255c6fbacaf1930be1599e5779990290cb 100644 (file)
@@ -9,12 +9,12 @@
  *
  * Some of this code is borrowed from orinoco_plx.c
  *     Copyright (C) 2001 Daniel Barlow
- * Some of this code is borrowed from orinoco_pci.c 
+ * Some of this code is borrowed from orinoco_pci.c
  *  Copyright (C) 2001 Jean Tourrilhes
  * Some of this code is "inspired" by linux-wlan-ng-0.1.10, but nothing
  * has been copied from it. linux-wlan-ng-0.1.10 is originally :
  *     Copyright (C) 1999 AbsoluteValue Systems, Inc.  All Rights Reserved.
- * 
+ *
  * The contents of this file are subject to the Mozilla Public License
  * Version 1.1 (the "License"); you may not use this file except in
  * compliance with the License. You may obtain a copy of the License
@@ -103,9 +103,8 @@ static int orinoco_nortel_hw_init(struct orinoco_pci_card *card)
        iowrite16(0x8, card->bridge_io + 2);
        for (i = 0; i < 30; i++) {
                mdelay(30);
-               if (ioread16(card->bridge_io) & 0x10) {
+               if (ioread16(card->bridge_io) & 0x10)
                        break;
-               }
        }
        if (i == 30) {
                printk(KERN_ERR PFX "brg1 timed out\n");
index 4ebd638a073ebe568e137321b7c56644d4ebf2a2..78cafff1fb2e754f8711965d4ddc9b064e9ce94a 100644 (file)
@@ -1,5 +1,5 @@
 /* orinoco_pci.c
- * 
+ *
  * Driver for Prism 2.5/3 devices that have a direct PCI interface
  * (i.e. these are not PCMCIA cards in a PCMCIA-to-PCI bridge).
  * The card contains only one PCI region, which contains all the usual
@@ -237,7 +237,8 @@ static char version[] __initdata = DRIVER_NAME " " DRIVER_VERSION
        " (Pavel Roskin <proski@gnu.org>,"
        " David Gibson <hermes@gibson.dropbear.id.au> &"
        " Jean Tourrilhes <jt@hpl.hp.com>)";
-MODULE_AUTHOR("Pavel Roskin <proski@gnu.org> & David Gibson <hermes@gibson.dropbear.id.au>");
+MODULE_AUTHOR("Pavel Roskin <proski@gnu.org> &"
+             " David Gibson <hermes@gibson.dropbear.id.au>");
 MODULE_DESCRIPTION("Driver for wireless LAN cards using direct PCI interface");
 MODULE_LICENSE("Dual MPL/GPL");
 
index f4e5e06760c1fa882b2b6d300748dd0df5598cd3..c655b4a3de165f4c9e383a3f22c84058fcea325e 100644 (file)
@@ -1,10 +1,10 @@
 /* orinoco_pci.h
- * 
+ *
  * Common code for all Orinoco drivers for PCI devices, including
  * both native PCI and PCMCIA-to-PCI bridges.
  *
  * Copyright (C) 2005, Pavel Roskin.
- * See orinoco.c for license.
+ * See main.c for license.
  */
 
 #ifndef _ORINOCO_PCI_H
@@ -37,11 +37,11 @@ static int orinoco_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        if (err)
                printk(KERN_WARNING "%s: error %d bringing interface down "
                       "for suspend\n", dev->name, err);
-       
+
        netif_device_detach(dev);
 
        priv->hw_unavailable++;
-       
+
        orinoco_unlock(priv, &flags);
 
        free_irq(pdev->irq, dev);
@@ -90,13 +90,13 @@ static int orinoco_pci_resume(struct pci_dev *pdev)
 
        priv->hw_unavailable--;
 
-       if (priv->open && (! priv->hw_unavailable)) {
+       if (priv->open && (!priv->hw_unavailable)) {
                err = __orinoco_up(dev);
                if (err)
                        printk(KERN_ERR "%s: Error %d restarting card on resume\n",
                               dev->name, err);
        }
-       
+
        spin_unlock_irqrestore(&priv->lock, flags);
 
        return 0;
index ef761857bb381bd15a75aacbf88b7e8207d4e419..a2a4471c0337191e24cad5f81dd063a59b4df8ed 100644 (file)
@@ -146,9 +146,8 @@ static int orinoco_plx_hw_init(struct orinoco_pci_card *card)
        };
 
        printk(KERN_DEBUG PFX "CIS: ");
-       for (i = 0; i < 16; i++) {
+       for (i = 0; i < 16; i++)
                printk("%02X:", ioread8(card->attr_io + (i << 1)));
-       }
        printk("\n");
 
        /* Verify whether a supported PC card is present */
index ede24ec309c0f9d71a34b119376f6576dcdc97d2..cda0e6e4d7a15f821c2d251c09d54d78b8ae17e5 100644 (file)
@@ -1,7 +1,7 @@
 /* orinoco_tmd.c
  *
  * Driver for Prism II devices which would usually be driven by orinoco_cs,
- * but are connected to the PCI bus by a TMD7160. 
+ * but are connected to the PCI bus by a TMD7160.
  *
  * Copyright (C) 2003 Joerg Dorchain <joerg AT dorchain.net>
  * based heavily upon orinoco_plx.c Copyright (C) 2001 Daniel Barlow
@@ -27,7 +27,7 @@
  * provisions above, a recipient may use your version of this file
  * under either the MPL or the GPL.
  *
- * The actual driving is done by orinoco.c, this is just resource
+ * The actual driving is done by main.c, this is just resource
  * allocation stuff.
  *
  * This driver is modeled after the orinoco_plx driver. The main
diff --git a/drivers/net/wireless/orinoco/scan.c b/drivers/net/wireless/orinoco/scan.c
new file mode 100644 (file)
index 0000000..89d699d
--- /dev/null
@@ -0,0 +1,233 @@
+/* Helpers for managing scan queues
+ *
+ * See copyright notice in main.c
+ */
+
+#include <linux/kernel.h>
+#include <linux/string.h>
+#include <linux/etherdevice.h>
+
+#include "hermes.h"
+#include "orinoco.h"
+
+#include "scan.h"
+
+#define ORINOCO_MAX_BSS_COUNT  64
+
+#define PRIV_BSS       ((struct bss_element *)priv->bss_xbss_data)
+#define PRIV_XBSS      ((struct xbss_element *)priv->bss_xbss_data)
+
+int orinoco_bss_data_allocate(struct orinoco_private *priv)
+{
+       if (priv->bss_xbss_data)
+               return 0;
+
+       if (priv->has_ext_scan)
+               priv->bss_xbss_data = kzalloc(ORINOCO_MAX_BSS_COUNT *
+                                             sizeof(struct xbss_element),
+                                             GFP_KERNEL);
+       else
+               priv->bss_xbss_data = kzalloc(ORINOCO_MAX_BSS_COUNT *
+                                             sizeof(struct bss_element),
+                                             GFP_KERNEL);
+
+       if (!priv->bss_xbss_data) {
+               printk(KERN_WARNING "Out of memory allocating beacons");
+               return -ENOMEM;
+       }
+       return 0;
+}
+
+void orinoco_bss_data_free(struct orinoco_private *priv)
+{
+       kfree(priv->bss_xbss_data);
+       priv->bss_xbss_data = NULL;
+}
+
+void orinoco_bss_data_init(struct orinoco_private *priv)
+{
+       int i;
+
+       INIT_LIST_HEAD(&priv->bss_free_list);
+       INIT_LIST_HEAD(&priv->bss_list);
+       if (priv->has_ext_scan)
+               for (i = 0; i < ORINOCO_MAX_BSS_COUNT; i++)
+                       list_add_tail(&(PRIV_XBSS[i].list),
+                                     &priv->bss_free_list);
+       else
+               for (i = 0; i < ORINOCO_MAX_BSS_COUNT; i++)
+                       list_add_tail(&(PRIV_BSS[i].list),
+                                     &priv->bss_free_list);
+
+}
+
+void orinoco_clear_scan_results(struct orinoco_private *priv,
+                               unsigned long scan_age)
+{
+       if (priv->has_ext_scan) {
+               struct xbss_element *bss;
+               struct xbss_element *tmp_bss;
+
+               /* Blow away current list of scan results */
+               list_for_each_entry_safe(bss, tmp_bss, &priv->bss_list, list) {
+                       if (!scan_age ||
+                           time_after(jiffies, bss->last_scanned + scan_age)) {
+                               list_move_tail(&bss->list,
+                                              &priv->bss_free_list);
+                               /* Don't blow away ->list, just BSS data */
+                               memset(&bss->bss, 0, sizeof(bss->bss));
+                               bss->last_scanned = 0;
+                       }
+               }
+       } else {
+               struct bss_element *bss;
+               struct bss_element *tmp_bss;
+
+               /* Blow away current list of scan results */
+               list_for_each_entry_safe(bss, tmp_bss, &priv->bss_list, list) {
+                       if (!scan_age ||
+                           time_after(jiffies, bss->last_scanned + scan_age)) {
+                               list_move_tail(&bss->list,
+                                              &priv->bss_free_list);
+                               /* Don't blow away ->list, just BSS data */
+                               memset(&bss->bss, 0, sizeof(bss->bss));
+                               bss->last_scanned = 0;
+                       }
+               }
+       }
+}
+
+void orinoco_add_ext_scan_result(struct orinoco_private *priv,
+                                struct agere_ext_scan_info *atom)
+{
+       struct xbss_element *bss = NULL;
+       int found = 0;
+
+       /* Try to update an existing bss first */
+       list_for_each_entry(bss, &priv->bss_list, list) {
+               if (compare_ether_addr(bss->bss.bssid, atom->bssid))
+                       continue;
+               /* ESSID lengths */
+               if (bss->bss.data[1] != atom->data[1])
+                       continue;
+               if (memcmp(&bss->bss.data[2], &atom->data[2],
+                          atom->data[1]))
+                       continue;
+               found = 1;
+               break;
+       }
+
+       /* Grab a bss off the free list */
+       if (!found && !list_empty(&priv->bss_free_list)) {
+               bss = list_entry(priv->bss_free_list.next,
+                                struct xbss_element, list);
+               list_del(priv->bss_free_list.next);
+
+               list_add_tail(&bss->list, &priv->bss_list);
+       }
+
+       if (bss) {
+               /* Always update the BSS to get latest beacon info */
+               memcpy(&bss->bss, atom, sizeof(bss->bss));
+               bss->last_scanned = jiffies;
+       }
+}
+
+int orinoco_process_scan_results(struct orinoco_private *priv,
+                                unsigned char *buf,
+                                int len)
+{
+       int                     offset;         /* In the scan data */
+       union hermes_scan_info *atom;
+       int                     atom_len;
+
+       switch (priv->firmware_type) {
+       case FIRMWARE_TYPE_AGERE:
+               atom_len = sizeof(struct agere_scan_apinfo);
+               offset = 0;
+               break;
+       case FIRMWARE_TYPE_SYMBOL:
+               /* Lack of documentation necessitates this hack.
+                * Different firmwares have 68 or 76 byte long atoms.
+                * We try modulo first.  If the length divides by both,
+                * we check what would be the channel in the second
+                * frame for a 68-byte atom.  76-byte atoms have 0 there.
+                * Valid channel cannot be 0.  */
+               if (len % 76)
+                       atom_len = 68;
+               else if (len % 68)
+                       atom_len = 76;
+               else if (len >= 1292 && buf[68] == 0)
+                       atom_len = 76;
+               else
+                       atom_len = 68;
+               offset = 0;
+               break;
+       case FIRMWARE_TYPE_INTERSIL:
+               offset = 4;
+               if (priv->has_hostscan) {
+                       atom_len = le16_to_cpup((__le16 *)buf);
+                       /* Sanity check for atom_len */
+                       if (atom_len < sizeof(struct prism2_scan_apinfo)) {
+                               printk(KERN_ERR "%s: Invalid atom_len in scan "
+                                      "data: %d\n", priv->ndev->name,
+                                      atom_len);
+                               return -EIO;
+                       }
+               } else
+                       atom_len = offsetof(struct prism2_scan_apinfo, atim);
+               break;
+       default:
+               return -EOPNOTSUPP;
+       }
+
+       /* Check that we got an whole number of atoms */
+       if ((len - offset) % atom_len) {
+               printk(KERN_ERR "%s: Unexpected scan data length %d, "
+                      "atom_len %d, offset %d\n", priv->ndev->name, len,
+                      atom_len, offset);
+               return -EIO;
+       }
+
+       orinoco_clear_scan_results(priv, msecs_to_jiffies(15000));
+
+       /* Read the entries one by one */
+       for (; offset + atom_len <= len; offset += atom_len) {
+               int found = 0;
+               struct bss_element *bss = NULL;
+
+               /* Get next atom */
+               atom = (union hermes_scan_info *) (buf + offset);
+
+               /* Try to update an existing bss first */
+               list_for_each_entry(bss, &priv->bss_list, list) {
+                       if (compare_ether_addr(bss->bss.a.bssid, atom->a.bssid))
+                               continue;
+                       if (le16_to_cpu(bss->bss.a.essid_len) !=
+                             le16_to_cpu(atom->a.essid_len))
+                               continue;
+                       if (memcmp(bss->bss.a.essid, atom->a.essid,
+                             le16_to_cpu(atom->a.essid_len)))
+                               continue;
+                       found = 1;
+                       break;
+               }
+
+               /* Grab a bss off the free list */
+               if (!found && !list_empty(&priv->bss_free_list)) {
+                       bss = list_entry(priv->bss_free_list.next,
+                                        struct bss_element, list);
+                       list_del(priv->bss_free_list.next);
+
+                       list_add_tail(&bss->list, &priv->bss_list);
+               }
+
+               if (bss) {
+                       /* Always update the BSS to get latest beacon info */
+                       memcpy(&bss->bss, atom, sizeof(bss->bss));
+                       bss->last_scanned = jiffies;
+               }
+       }
+
+       return 0;
+}
diff --git a/drivers/net/wireless/orinoco/scan.h b/drivers/net/wireless/orinoco/scan.h
new file mode 100644 (file)
index 0000000..f319f74
--- /dev/null
@@ -0,0 +1,29 @@
+/* Helpers for managing scan queues
+ *
+ * See copyright notice in main.c
+ */
+#ifndef _ORINOCO_SCAN_H_
+#define _ORINOCO_SCAN_H_
+
+/* Forward declarations */
+struct orinoco_private;
+struct agere_ext_scan_info;
+
+/* Setup and free memory for scan results */
+int orinoco_bss_data_allocate(struct orinoco_private *priv);
+void orinoco_bss_data_free(struct orinoco_private *priv);
+void orinoco_bss_data_init(struct orinoco_private *priv);
+
+/* Add scan results */
+void orinoco_add_ext_scan_result(struct orinoco_private *priv,
+                                struct agere_ext_scan_info *atom);
+int orinoco_process_scan_results(struct orinoco_private *dev,
+                                unsigned char *buf,
+                                int len);
+
+/* Clear scan results */
+void orinoco_clear_scan_results(struct orinoco_private *priv,
+                               unsigned long scan_age);
+
+
+#endif /* _ORINOCO_SCAN_H_ */
index b2ca2e39c2cbd41943ca878895f7e55001cd4b13..38e5198e44c7c204186f41600c894f0daec805b9 100644 (file)
@@ -4,7 +4,7 @@
  * Communications and Intel PRO/Wireless 2011B.
  *
  * The driver implements Symbol firmware download.  The rest is handled
- * in hermes.c and orinoco.c.
+ * in hermes.c and main.c.
  *
  * Utilities for downloading the Symbol firmware are available at
  * http://sourceforge.net/projects/orinoco/
@@ -15,7 +15,7 @@
  * Portions based on Spectrum24tDnld.c from original spectrum24 driver:
  *     Copyright (C) Symbol Technologies.
  *
- * See copyright notice in file orinoco.c.
+ * See copyright notice in file main.c.
  */
 
 #define DRIVER_NAME "spectrum_cs"
@@ -133,7 +133,7 @@ spectrum_reset(struct pcmcia_device *link, int idle)
        udelay(1000);
        return 0;
 
-      cs_failed:
+cs_failed:
        cs_error(link, last_fn, last_ret);
        return -ENODEV;
 }
@@ -171,7 +171,7 @@ spectrum_cs_stop_firmware(struct orinoco_private *priv, int idle)
  * This creates an "instance" of the driver, allocating local data
  * structures for one device.  The device is registered with Card
  * Services.
- * 
+ *
  * The dev_link structure is initialized, but we don't actually
  * configure the card at this point -- we wait until we receive a card
  * insertion event.  */
@@ -185,7 +185,7 @@ spectrum_cs_probe(struct pcmcia_device *link)
        dev = alloc_orinocodev(sizeof(*card), &handle_to_dev(link),
                               spectrum_cs_hard_reset,
                               spectrum_cs_stop_firmware);
-       if (! dev)
+       if (!dev)
                return -ENOMEM;
        priv = netdev_priv(dev);
        card = priv->card;
@@ -198,7 +198,7 @@ spectrum_cs_probe(struct pcmcia_device *link)
        link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT;
        link->irq.IRQInfo1 = IRQ_LEVEL_ID;
        link->irq.Handler = orinoco_interrupt;
-       link->irq.Instance = dev; 
+       link->irq.Instance = dev;
 
        /* General socket configuration defaults can go here.  In this
         * client, we assume very little, and rely on the CIS for
@@ -367,9 +367,8 @@ spectrum_cs_config(struct pcmcia_device *link)
        card->node.major = card->node.minor = 0;
 
        /* Reset card */
-       if (spectrum_cs_hard_reset(priv) != 0) {
+       if (spectrum_cs_hard_reset(priv) != 0)
                goto failed;
-       }
 
        SET_NETDEV_DEV(dev, &handle_to_dev(link));
        /* Tell the stack we exist */
@@ -382,8 +381,8 @@ spectrum_cs_config(struct pcmcia_device *link)
         * initialized and arranged in a linked list at link->dev_node. */
        strcpy(card->node.dev_name, dev->name);
        link->dev_node = &card->node; /* link->dev_node being non-NULL is also
-                                    used to indicate that the
-                                    net_device has been registered */
+                                      * used to indicate that the
+                                      * net_device has been registered */
 
        /* Finally, report what we've done */
        printk(KERN_DEBUG "%s: " DRIVER_NAME " at %s, irq %d, io "
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
new file mode 100644 (file)
index 0000000..3f08142
--- /dev/null
@@ -0,0 +1,2325 @@
+/* Wireless extensions support.
+ *
+ * See copyright notice in main.c
+ */
+#include <linux/kernel.h>
+#include <linux/if_arp.h>
+#include <linux/wireless.h>
+#include <linux/ieee80211.h>
+#include <net/iw_handler.h>
+
+#include "hermes.h"
+#include "hermes_rid.h"
+#include "orinoco.h"
+
+#include "hw.h"
+#include "mic.h"
+#include "scan.h"
+#include "main.h"
+
+#include "wext.h"
+
+#define MAX_RID_LEN 1024
+
+static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       struct iw_statistics *wstats = &priv->wstats;
+       int err;
+       unsigned long flags;
+
+       if (!netif_device_present(dev)) {
+               printk(KERN_WARNING "%s: get_wireless_stats() called while device not present\n",
+                      dev->name);
+               return NULL; /* FIXME: Can we do better than this? */
+       }
+
+       /* If busy, return the old stats.  Returning NULL may cause
+        * the interface to disappear from /proc/net/wireless */
+       if (orinoco_lock(priv, &flags) != 0)
+               return wstats;
+
+       /* We can't really wait for the tallies inquiry command to
+        * complete, so we just use the previous results and trigger
+        * a new tallies inquiry command for next time - Jean II */
+       /* FIXME: Really we should wait for the inquiry to come back -
+        * as it is the stats we give don't make a whole lot of sense.
+        * Unfortunately, it's not clear how to do that within the
+        * wireless extensions framework: I think we're in user
+        * context, but a lock seems to be held by the time we get in
+        * here so we're not safe to sleep here. */
+       hermes_inquire(hw, HERMES_INQ_TALLIES);
+
+       if (priv->iw_mode == IW_MODE_ADHOC) {
+               memset(&wstats->qual, 0, sizeof(wstats->qual));
+               /* If a spy address is defined, we report stats of the
+                * first spy address - Jean II */
+               if (SPY_NUMBER(priv)) {
+                       wstats->qual.qual = priv->spy_data.spy_stat[0].qual;
+                       wstats->qual.level = priv->spy_data.spy_stat[0].level;
+                       wstats->qual.noise = priv->spy_data.spy_stat[0].noise;
+                       wstats->qual.updated =
+                               priv->spy_data.spy_stat[0].updated;
+               }
+       } else {
+               struct {
+                       __le16 qual, signal, noise, unused;
+               } __attribute__ ((packed)) cq;
+
+               err = HERMES_READ_RECORD(hw, USER_BAP,
+                                        HERMES_RID_COMMSQUALITY, &cq);
+
+               if (!err) {
+                       wstats->qual.qual = (int)le16_to_cpu(cq.qual);
+                       wstats->qual.level = (int)le16_to_cpu(cq.signal) - 0x95;
+                       wstats->qual.noise = (int)le16_to_cpu(cq.noise) - 0x95;
+                       wstats->qual.updated =
+                               IW_QUAL_ALL_UPDATED | IW_QUAL_DBM;
+               }
+       }
+
+       orinoco_unlock(priv, &flags);
+       return wstats;
+}
+
+/********************************************************************/
+/* Wireless extensions                                              */
+/********************************************************************/
+
+static int orinoco_ioctl_getname(struct net_device *dev,
+                                struct iw_request_info *info,
+                                char *name,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int numrates;
+       int err;
+
+       err = orinoco_hw_get_bitratelist(priv, &numrates, NULL, 0);
+
+       if (!err && (numrates > 2))
+               strcpy(name, "IEEE 802.11b");
+       else
+               strcpy(name, "IEEE 802.11-DS");
+
+       return 0;
+}
+
+static int orinoco_ioctl_setwap(struct net_device *dev,
+                               struct iw_request_info *info,
+                               struct sockaddr *ap_addr,
+                               char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = -EINPROGRESS;         /* Call commit handler */
+       unsigned long flags;
+       static const u8 off_addr[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+       static const u8 any_addr[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       /* Enable automatic roaming - no sanity checks are needed */
+       if (memcmp(&ap_addr->sa_data, off_addr, ETH_ALEN) == 0 ||
+           memcmp(&ap_addr->sa_data, any_addr, ETH_ALEN) == 0) {
+               priv->bssid_fixed = 0;
+               memset(priv->desired_bssid, 0, ETH_ALEN);
+
+               /* "off" means keep existing connection */
+               if (ap_addr->sa_data[0] == 0) {
+                       __orinoco_hw_set_wap(priv);
+                       err = 0;
+               }
+               goto out;
+       }
+
+       if (priv->firmware_type == FIRMWARE_TYPE_AGERE) {
+               printk(KERN_WARNING "%s: Lucent/Agere firmware doesn't "
+                      "support manual roaming\n",
+                      dev->name);
+               err = -EOPNOTSUPP;
+               goto out;
+       }
+
+       if (priv->iw_mode != IW_MODE_INFRA) {
+               printk(KERN_WARNING "%s: Manual roaming supported only in "
+                      "managed mode\n", dev->name);
+               err = -EOPNOTSUPP;
+               goto out;
+       }
+
+       /* Intersil firmware hangs without Desired ESSID */
+       if (priv->firmware_type == FIRMWARE_TYPE_INTERSIL &&
+           strlen(priv->desired_essid) == 0) {
+               printk(KERN_WARNING "%s: Desired ESSID must be set for "
+                      "manual roaming\n", dev->name);
+               err = -EOPNOTSUPP;
+               goto out;
+       }
+
+       /* Finally, enable manual roaming */
+       priv->bssid_fixed = 1;
+       memcpy(priv->desired_bssid, &ap_addr->sa_data, ETH_ALEN);
+
+ out:
+       orinoco_unlock(priv, &flags);
+       return err;
+}
+
+static int orinoco_ioctl_getwap(struct net_device *dev,
+                               struct iw_request_info *info,
+                               struct sockaddr *ap_addr,
+                               char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       ap_addr->sa_family = ARPHRD_ETHER;
+       err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID,
+                             ETH_ALEN, NULL, ap_addr->sa_data);
+
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_setmode(struct net_device *dev,
+                                struct iw_request_info *info,
+                                u32 *mode,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = -EINPROGRESS;         /* Call commit handler */
+       unsigned long flags;
+
+       if (priv->iw_mode == *mode)
+               return 0;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       switch (*mode) {
+       case IW_MODE_ADHOC:
+               if (!priv->has_ibss && !priv->has_port3)
+                       err = -EOPNOTSUPP;
+               break;
+
+       case IW_MODE_INFRA:
+               break;
+
+       case IW_MODE_MONITOR:
+               if (priv->broken_monitor && !force_monitor) {
+                       printk(KERN_WARNING "%s: Monitor mode support is "
+                              "buggy in this firmware, not enabling\n",
+                              dev->name);
+                       err = -EOPNOTSUPP;
+               }
+               break;
+
+       default:
+               err = -EOPNOTSUPP;
+               break;
+       }
+
+       if (err == -EINPROGRESS) {
+               priv->iw_mode = *mode;
+               set_port_type(priv);
+       }
+
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_getmode(struct net_device *dev,
+                                struct iw_request_info *info,
+                                u32 *mode,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+
+       *mode = priv->iw_mode;
+       return 0;
+}
+
+static int orinoco_ioctl_getiwrange(struct net_device *dev,
+                                   struct iw_request_info *info,
+                                   struct iw_point *rrq,
+                                   char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = 0;
+       struct iw_range *range = (struct iw_range *) extra;
+       int numrates;
+       int i, k;
+
+       rrq->length = sizeof(struct iw_range);
+       memset(range, 0, sizeof(struct iw_range));
+
+       range->we_version_compiled = WIRELESS_EXT;
+       range->we_version_source = 22;
+
+       /* Set available channels/frequencies */
+       range->num_channels = NUM_CHANNELS;
+       k = 0;
+       for (i = 0; i < NUM_CHANNELS; i++) {
+               if (priv->channel_mask & (1 << i)) {
+                       range->freq[k].i = i + 1;
+                       range->freq[k].m = (ieee80211_dsss_chan_to_freq(i + 1) *
+                                           100000);
+                       range->freq[k].e = 1;
+                       k++;
+               }
+
+               if (k >= IW_MAX_FREQUENCIES)
+                       break;
+       }
+       range->num_frequency = k;
+       range->sensitivity = 3;
+
+       if (priv->has_wep) {
+               range->max_encoding_tokens = ORINOCO_MAX_KEYS;
+               range->encoding_size[0] = SMALL_KEY_SIZE;
+               range->num_encoding_sizes = 1;
+
+               if (priv->has_big_wep) {
+                       range->encoding_size[1] = LARGE_KEY_SIZE;
+                       range->num_encoding_sizes = 2;
+               }
+       }
+
+       if (priv->has_wpa)
+               range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_CIPHER_TKIP;
+
+       if ((priv->iw_mode == IW_MODE_ADHOC) && (!SPY_NUMBER(priv))) {
+               /* Quality stats meaningless in ad-hoc mode */
+       } else {
+               range->max_qual.qual = 0x8b - 0x2f;
+               range->max_qual.level = 0x2f - 0x95 - 1;
+               range->max_qual.noise = 0x2f - 0x95 - 1;
+               /* Need to get better values */
+               range->avg_qual.qual = 0x24;
+               range->avg_qual.level = 0xC2;
+               range->avg_qual.noise = 0x9E;
+       }
+
+       err = orinoco_hw_get_bitratelist(priv, &numrates,
+                                        range->bitrate, IW_MAX_BITRATES);
+       if (err)
+               return err;
+       range->num_bitrates = numrates;
+
+       /* Set an indication of the max TCP throughput in bit/s that we can
+        * expect using this interface. May be use for QoS stuff...
+        * Jean II */
+       if (numrates > 2)
+               range->throughput = 5 * 1000 * 1000;    /* ~5 Mb/s */
+       else
+               range->throughput = 1.5 * 1000 * 1000;  /* ~1.5 Mb/s */
+
+       range->min_rts = 0;
+       range->max_rts = 2347;
+       range->min_frag = 256;
+       range->max_frag = 2346;
+
+       range->min_pmp = 0;
+       range->max_pmp = 65535000;
+       range->min_pmt = 0;
+       range->max_pmt = 65535 * 1000;  /* ??? */
+       range->pmp_flags = IW_POWER_PERIOD;
+       range->pmt_flags = IW_POWER_TIMEOUT;
+       range->pm_capa = (IW_POWER_PERIOD | IW_POWER_TIMEOUT |
+                         IW_POWER_UNICAST_R);
+
+       range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
+       range->retry_flags = IW_RETRY_LIMIT;
+       range->r_time_flags = IW_RETRY_LIFETIME;
+       range->min_retry = 0;
+       range->max_retry = 65535;       /* ??? */
+       range->min_r_time = 0;
+       range->max_r_time = 65535 * 1000;       /* ??? */
+
+       if (priv->firmware_type == FIRMWARE_TYPE_AGERE)
+               range->scan_capa = IW_SCAN_CAPA_ESSID;
+       else
+               range->scan_capa = IW_SCAN_CAPA_NONE;
+
+       /* Event capability (kernel) */
+       IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
+       /* Event capability (driver) */
+       IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY);
+       IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
+       IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
+       IW_EVENT_CAPA_SET(range->event_capa, IWEVTXDROP);
+
+       return 0;
+}
+
+static int orinoco_ioctl_setiwencode(struct net_device *dev,
+                                    struct iw_request_info *info,
+                                    struct iw_point *erq,
+                                    char *keybuf)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int index = (erq->flags & IW_ENCODE_INDEX) - 1;
+       int setindex = priv->tx_key;
+       int encode_alg = priv->encode_alg;
+       int restricted = priv->wep_restrict;
+       u16 xlen = 0;
+       int err = -EINPROGRESS;         /* Call commit handler */
+       unsigned long flags;
+
+       if (!priv->has_wep)
+               return -EOPNOTSUPP;
+
+       if (erq->pointer) {
+               /* We actually have a key to set - check its length */
+               if (erq->length > LARGE_KEY_SIZE)
+                       return -E2BIG;
+
+               if ((erq->length > SMALL_KEY_SIZE) && !priv->has_big_wep)
+                       return -E2BIG;
+       }
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       /* Clear any TKIP key we have */
+       if ((priv->has_wpa) && (priv->encode_alg == IW_ENCODE_ALG_TKIP))
+               (void) orinoco_clear_tkip_key(priv, setindex);
+
+       if (erq->length > 0) {
+               if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
+                       index = priv->tx_key;
+
+               /* Adjust key length to a supported value */
+               if (erq->length > SMALL_KEY_SIZE)
+                       xlen = LARGE_KEY_SIZE;
+               else if (erq->length > 0)
+                       xlen = SMALL_KEY_SIZE;
+               else
+                       xlen = 0;
+
+               /* Switch on WEP if off */
+               if ((encode_alg != IW_ENCODE_ALG_WEP) && (xlen > 0)) {
+                       setindex = index;
+                       encode_alg = IW_ENCODE_ALG_WEP;
+               }
+       } else {
+               /* Important note : if the user do "iwconfig eth0 enc off",
+                * we will arrive there with an index of -1. This is valid
+                * but need to be taken care off... Jean II */
+               if ((index < 0) || (index >= ORINOCO_MAX_KEYS)) {
+                       if ((index != -1) || (erq->flags == 0)) {
+                               err = -EINVAL;
+                               goto out;
+                       }
+               } else {
+                       /* Set the index : Check that the key is valid */
+                       if (priv->keys[index].len == 0) {
+                               err = -EINVAL;
+                               goto out;
+                       }
+                       setindex = index;
+               }
+       }
+
+       if (erq->flags & IW_ENCODE_DISABLED)
+               encode_alg = IW_ENCODE_ALG_NONE;
+       if (erq->flags & IW_ENCODE_OPEN)
+               restricted = 0;
+       if (erq->flags & IW_ENCODE_RESTRICTED)
+               restricted = 1;
+
+       if (erq->pointer && erq->length > 0) {
+               priv->keys[index].len = cpu_to_le16(xlen);
+               memset(priv->keys[index].data, 0,
+                      sizeof(priv->keys[index].data));
+               memcpy(priv->keys[index].data, keybuf, erq->length);
+       }
+       priv->tx_key = setindex;
+
+       /* Try fast key change if connected and only keys are changed */
+       if ((priv->encode_alg == encode_alg) &&
+           (priv->wep_restrict == restricted) &&
+           netif_carrier_ok(dev)) {
+               err = __orinoco_hw_setup_wepkeys(priv);
+               /* No need to commit if successful */
+               goto out;
+       }
+
+       priv->encode_alg = encode_alg;
+       priv->wep_restrict = restricted;
+
+ out:
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_getiwencode(struct net_device *dev,
+                                    struct iw_request_info *info,
+                                    struct iw_point *erq,
+                                    char *keybuf)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int index = (erq->flags & IW_ENCODE_INDEX) - 1;
+       u16 xlen = 0;
+       unsigned long flags;
+
+       if (!priv->has_wep)
+               return -EOPNOTSUPP;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       if ((index < 0) || (index >= ORINOCO_MAX_KEYS))
+               index = priv->tx_key;
+
+       erq->flags = 0;
+       if (!priv->encode_alg)
+               erq->flags |= IW_ENCODE_DISABLED;
+       erq->flags |= index + 1;
+
+       if (priv->wep_restrict)
+               erq->flags |= IW_ENCODE_RESTRICTED;
+       else
+               erq->flags |= IW_ENCODE_OPEN;
+
+       xlen = le16_to_cpu(priv->keys[index].len);
+
+       erq->length = xlen;
+
+       memcpy(keybuf, priv->keys[index].data, ORINOCO_MAX_KEY_SIZE);
+
+       orinoco_unlock(priv, &flags);
+       return 0;
+}
+
+static int orinoco_ioctl_setessid(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 struct iw_point *erq,
+                                 char *essidbuf)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       unsigned long flags;
+
+       /* Note : ESSID is ignored in Ad-Hoc demo mode, but we can set it
+        * anyway... - Jean II */
+
+       /* Hum... Should not use Wireless Extension constant (may change),
+        * should use our own... - Jean II */
+       if (erq->length > IW_ESSID_MAX_SIZE)
+               return -E2BIG;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       /* NULL the string (for NULL termination & ESSID = ANY) - Jean II */
+       memset(priv->desired_essid, 0, sizeof(priv->desired_essid));
+
+       /* If not ANY, get the new ESSID */
+       if (erq->flags)
+               memcpy(priv->desired_essid, essidbuf, erq->length);
+
+       orinoco_unlock(priv, &flags);
+
+       return -EINPROGRESS;            /* Call commit handler */
+}
+
+static int orinoco_ioctl_getessid(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 struct iw_point *erq,
+                                 char *essidbuf)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int active;
+       int err = 0;
+       unsigned long flags;
+
+       if (netif_running(dev)) {
+               err = orinoco_hw_get_essid(priv, &active, essidbuf);
+               if (err < 0)
+                       return err;
+               erq->length = err;
+       } else {
+               if (orinoco_lock(priv, &flags) != 0)
+                       return -EBUSY;
+               memcpy(essidbuf, priv->desired_essid, IW_ESSID_MAX_SIZE);
+               erq->length = strlen(priv->desired_essid);
+               orinoco_unlock(priv, &flags);
+       }
+
+       erq->flags = 1;
+
+       return 0;
+}
+
+static int orinoco_ioctl_setnick(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_point *nrq,
+                                char *nickbuf)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       unsigned long flags;
+
+       if (nrq->length > IW_ESSID_MAX_SIZE)
+               return -E2BIG;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       memset(priv->nick, 0, sizeof(priv->nick));
+       memcpy(priv->nick, nickbuf, nrq->length);
+
+       orinoco_unlock(priv, &flags);
+
+       return -EINPROGRESS;            /* Call commit handler */
+}
+
+static int orinoco_ioctl_getnick(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_point *nrq,
+                                char *nickbuf)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       memcpy(nickbuf, priv->nick, IW_ESSID_MAX_SIZE);
+       orinoco_unlock(priv, &flags);
+
+       nrq->length = strlen(priv->nick);
+
+       return 0;
+}
+
+static int orinoco_ioctl_setfreq(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_freq *frq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int chan = -1;
+       unsigned long flags;
+       int err = -EINPROGRESS;         /* Call commit handler */
+
+       /* In infrastructure mode the AP sets the channel */
+       if (priv->iw_mode == IW_MODE_INFRA)
+               return -EBUSY;
+
+       if ((frq->e == 0) && (frq->m <= 1000)) {
+               /* Setting by channel number */
+               chan = frq->m;
+       } else {
+               /* Setting by frequency */
+               int denom = 1;
+               int i;
+
+               /* Calculate denominator to rescale to MHz */
+               for (i = 0; i < (6 - frq->e); i++)
+                       denom *= 10;
+
+               chan = ieee80211_freq_to_dsss_chan(frq->m / denom);
+       }
+
+       if ((chan < 1) || (chan > NUM_CHANNELS) ||
+            !(priv->channel_mask & (1 << (chan-1))))
+               return -EINVAL;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       priv->channel = chan;
+       if (priv->iw_mode == IW_MODE_MONITOR) {
+               /* Fast channel change - no commit if successful */
+               hermes_t *hw = &priv->hw;
+               err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
+                                           HERMES_TEST_SET_CHANNEL,
+                                       chan, NULL);
+       }
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_getfreq(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_freq *frq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int tmp;
+
+       /* Locking done in there */
+       tmp = orinoco_hw_get_freq(priv);
+       if (tmp < 0)
+               return tmp;
+
+       frq->m = tmp * 100000;
+       frq->e = 1;
+
+       return 0;
+}
+
+static int orinoco_ioctl_getsens(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_param *srq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       u16 val;
+       int err;
+       unsigned long flags;
+
+       if (!priv->has_sensitivity)
+               return -EOPNOTSUPP;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+       err = hermes_read_wordrec(hw, USER_BAP,
+                                 HERMES_RID_CNFSYSTEMSCALE, &val);
+       orinoco_unlock(priv, &flags);
+
+       if (err)
+               return err;
+
+       srq->value = val;
+       srq->fixed = 0; /* auto */
+
+       return 0;
+}
+
+static int orinoco_ioctl_setsens(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_param *srq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int val = srq->value;
+       unsigned long flags;
+
+       if (!priv->has_sensitivity)
+               return -EOPNOTSUPP;
+
+       if ((val < 1) || (val > 3))
+               return -EINVAL;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+       priv->ap_density = val;
+       orinoco_unlock(priv, &flags);
+
+       return -EINPROGRESS;            /* Call commit handler */
+}
+
+static int orinoco_ioctl_setrts(struct net_device *dev,
+                               struct iw_request_info *info,
+                               struct iw_param *rrq,
+                               char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int val = rrq->value;
+       unsigned long flags;
+
+       if (rrq->disabled)
+               val = 2347;
+
+       if ((val < 0) || (val > 2347))
+               return -EINVAL;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       priv->rts_thresh = val;
+       orinoco_unlock(priv, &flags);
+
+       return -EINPROGRESS;            /* Call commit handler */
+}
+
+static int orinoco_ioctl_getrts(struct net_device *dev,
+                               struct iw_request_info *info,
+                               struct iw_param *rrq,
+                               char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+
+       rrq->value = priv->rts_thresh;
+       rrq->disabled = (rrq->value == 2347);
+       rrq->fixed = 1;
+
+       return 0;
+}
+
+static int orinoco_ioctl_setfrag(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_param *frq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = -EINPROGRESS;         /* Call commit handler */
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       if (priv->has_mwo) {
+               if (frq->disabled)
+                       priv->mwo_robust = 0;
+               else {
+                       if (frq->fixed)
+                               printk(KERN_WARNING "%s: Fixed fragmentation "
+                                      "is not supported on this firmware. "
+                                      "Using MWO robust instead.\n",
+                                      dev->name);
+                       priv->mwo_robust = 1;
+               }
+       } else {
+               if (frq->disabled)
+                       priv->frag_thresh = 2346;
+               else {
+                       if ((frq->value < 256) || (frq->value > 2346))
+                               err = -EINVAL;
+                       else
+                               /* must be even */
+                               priv->frag_thresh = frq->value & ~0x1;
+               }
+       }
+
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_getfrag(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_param *frq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       int err;
+       u16 val;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       if (priv->has_mwo) {
+               err = hermes_read_wordrec(hw, USER_BAP,
+                                         HERMES_RID_CNFMWOROBUST_AGERE,
+                                         &val);
+               if (err)
+                       val = 0;
+
+               frq->value = val ? 2347 : 0;
+               frq->disabled = !val;
+               frq->fixed = 0;
+       } else {
+               err = hermes_read_wordrec(hw, USER_BAP,
+                                         HERMES_RID_CNFFRAGMENTATIONTHRESHOLD,
+                                         &val);
+               if (err)
+                       val = 0;
+
+               frq->value = val;
+               frq->disabled = (val >= 2346);
+               frq->fixed = 1;
+       }
+
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_setrate(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_param *rrq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int ratemode;
+       int bitrate; /* 100s of kilobits */
+       unsigned long flags;
+
+       /* As the user space doesn't know our highest rate, it uses -1
+        * to ask us to set the highest rate.  Test it using "iwconfig
+        * ethX rate auto" - Jean II */
+       if (rrq->value == -1)
+               bitrate = 110;
+       else {
+               if (rrq->value % 100000)
+                       return -EINVAL;
+               bitrate = rrq->value / 100000;
+       }
+
+       ratemode = orinoco_get_bitratemode(bitrate, !rrq->fixed);
+
+       if (ratemode == -1)
+               return -EINVAL;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+       priv->bitratemode = ratemode;
+       orinoco_unlock(priv, &flags);
+
+       return -EINPROGRESS;
+}
+
+static int orinoco_ioctl_getrate(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_param *rrq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = 0;
+       int bitrate, automatic;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       orinoco_get_ratemode_cfg(priv->bitratemode, &bitrate, &automatic);
+
+       /* If the interface is running we try to find more about the
+          current mode */
+       if (netif_running(dev))
+               err = orinoco_hw_get_act_bitrate(priv, &bitrate);
+
+       orinoco_unlock(priv, &flags);
+
+       rrq->value = bitrate;
+       rrq->fixed = !automatic;
+       rrq->disabled = 0;
+
+       return err;
+}
+
+static int orinoco_ioctl_setpower(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 struct iw_param *prq,
+                                 char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = -EINPROGRESS;         /* Call commit handler */
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       if (prq->disabled) {
+               priv->pm_on = 0;
+       } else {
+               switch (prq->flags & IW_POWER_MODE) {
+               case IW_POWER_UNICAST_R:
+                       priv->pm_mcast = 0;
+                       priv->pm_on = 1;
+                       break;
+               case IW_POWER_ALL_R:
+                       priv->pm_mcast = 1;
+                       priv->pm_on = 1;
+                       break;
+               case IW_POWER_ON:
+                       /* No flags : but we may have a value - Jean II */
+                       break;
+               default:
+                       err = -EINVAL;
+                       goto out;
+               }
+
+               if (prq->flags & IW_POWER_TIMEOUT) {
+                       priv->pm_on = 1;
+                       priv->pm_timeout = prq->value / 1000;
+               }
+               if (prq->flags & IW_POWER_PERIOD) {
+                       priv->pm_on = 1;
+                       priv->pm_period = prq->value / 1000;
+               }
+               /* It's valid to not have a value if we are just toggling
+                * the flags... Jean II */
+               if (!priv->pm_on) {
+                       err = -EINVAL;
+                       goto out;
+               }
+       }
+
+ out:
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_getpower(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 struct iw_param *prq,
+                                 char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       u16 enable, period, timeout, mcast;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       err = hermes_read_wordrec(hw, USER_BAP,
+                                 HERMES_RID_CNFPMENABLED, &enable);
+       if (err)
+               goto out;
+
+       err = hermes_read_wordrec(hw, USER_BAP,
+                                 HERMES_RID_CNFMAXSLEEPDURATION, &period);
+       if (err)
+               goto out;
+
+       err = hermes_read_wordrec(hw, USER_BAP,
+                                 HERMES_RID_CNFPMHOLDOVERDURATION, &timeout);
+       if (err)
+               goto out;
+
+       err = hermes_read_wordrec(hw, USER_BAP,
+                                 HERMES_RID_CNFMULTICASTRECEIVE, &mcast);
+       if (err)
+               goto out;
+
+       prq->disabled = !enable;
+       /* Note : by default, display the period */
+       if ((prq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
+               prq->flags = IW_POWER_TIMEOUT;
+               prq->value = timeout * 1000;
+       } else {
+               prq->flags = IW_POWER_PERIOD;
+               prq->value = period * 1000;
+       }
+       if (mcast)
+               prq->flags |= IW_POWER_ALL_R;
+       else
+               prq->flags |= IW_POWER_UNICAST_R;
+
+ out:
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_set_encodeext(struct net_device *dev,
+                                      struct iw_request_info *info,
+                                      union iwreq_data *wrqu,
+                                      char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct iw_point *encoding = &wrqu->encoding;
+       struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
+       int idx, alg = ext->alg, set_key = 1;
+       unsigned long flags;
+       int err = -EINVAL;
+       u16 key_len;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       /* Determine and validate the key index */
+       idx = encoding->flags & IW_ENCODE_INDEX;
+       if (idx) {
+               if ((idx < 1) || (idx > 4))
+                       goto out;
+               idx--;
+       } else
+               idx = priv->tx_key;
+
+       if (encoding->flags & IW_ENCODE_DISABLED)
+               alg = IW_ENCODE_ALG_NONE;
+
+       if (priv->has_wpa && (alg != IW_ENCODE_ALG_TKIP)) {
+               /* Clear any TKIP TX key we had */
+               (void) orinoco_clear_tkip_key(priv, priv->tx_key);
+       }
+
+       if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
+               priv->tx_key = idx;
+               set_key = ((alg == IW_ENCODE_ALG_TKIP) ||
+                          (ext->key_len > 0)) ? 1 : 0;
+       }
+
+       if (set_key) {
+               /* Set the requested key first */
+               switch (alg) {
+               case IW_ENCODE_ALG_NONE:
+                       priv->encode_alg = alg;
+                       priv->keys[idx].len = 0;
+                       break;
+
+               case IW_ENCODE_ALG_WEP:
+                       if (ext->key_len > SMALL_KEY_SIZE)
+                               key_len = LARGE_KEY_SIZE;
+                       else if (ext->key_len > 0)
+                               key_len = SMALL_KEY_SIZE;
+                       else
+                               goto out;
+
+                       priv->encode_alg = alg;
+                       priv->keys[idx].len = cpu_to_le16(key_len);
+
+                       key_len = min(ext->key_len, key_len);
+
+                       memset(priv->keys[idx].data, 0, ORINOCO_MAX_KEY_SIZE);
+                       memcpy(priv->keys[idx].data, ext->key, key_len);
+                       break;
+
+               case IW_ENCODE_ALG_TKIP:
+               {
+                       hermes_t *hw = &priv->hw;
+                       u8 *tkip_iv = NULL;
+
+                       if (!priv->has_wpa ||
+                           (ext->key_len > sizeof(priv->tkip_key[0])))
+                               goto out;
+
+                       priv->encode_alg = alg;
+                       memset(&priv->tkip_key[idx], 0,
+                              sizeof(priv->tkip_key[idx]));
+                       memcpy(&priv->tkip_key[idx], ext->key, ext->key_len);
+
+                       if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID)
+                               tkip_iv = &ext->rx_seq[0];
+
+                       err = __orinoco_hw_set_tkip_key(hw, idx,
+                                ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY,
+                                (u8 *) &priv->tkip_key[idx],
+                                tkip_iv, NULL);
+                       if (err)
+                               printk(KERN_ERR "%s: Error %d setting TKIP key"
+                                      "\n", dev->name, err);
+
+                       goto out;
+               }
+               default:
+                       goto out;
+               }
+       }
+       err = -EINPROGRESS;
+ out:
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_get_encodeext(struct net_device *dev,
+                                      struct iw_request_info *info,
+                                      union iwreq_data *wrqu,
+                                      char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct iw_point *encoding = &wrqu->encoding;
+       struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
+       int idx, max_key_len;
+       unsigned long flags;
+       int err;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       err = -EINVAL;
+       max_key_len = encoding->length - sizeof(*ext);
+       if (max_key_len < 0)
+               goto out;
+
+       idx = encoding->flags & IW_ENCODE_INDEX;
+       if (idx) {
+               if ((idx < 1) || (idx > 4))
+                       goto out;
+               idx--;
+       } else
+               idx = priv->tx_key;
+
+       encoding->flags = idx + 1;
+       memset(ext, 0, sizeof(*ext));
+
+       ext->alg = priv->encode_alg;
+       switch (priv->encode_alg) {
+       case IW_ENCODE_ALG_NONE:
+               ext->key_len = 0;
+               encoding->flags |= IW_ENCODE_DISABLED;
+               break;
+       case IW_ENCODE_ALG_WEP:
+               ext->key_len = min_t(u16, le16_to_cpu(priv->keys[idx].len),
+                                    max_key_len);
+               memcpy(ext->key, priv->keys[idx].data, ext->key_len);
+               encoding->flags |= IW_ENCODE_ENABLED;
+               break;
+       case IW_ENCODE_ALG_TKIP:
+               ext->key_len = min_t(u16, sizeof(struct orinoco_tkip_key),
+                                    max_key_len);
+               memcpy(ext->key, &priv->tkip_key[idx], ext->key_len);
+               encoding->flags |= IW_ENCODE_ENABLED;
+               break;
+       }
+
+       err = 0;
+ out:
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_set_auth(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 union iwreq_data *wrqu, char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       struct iw_param *param = &wrqu->param;
+       unsigned long flags;
+       int ret = -EINPROGRESS;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       switch (param->flags & IW_AUTH_INDEX) {
+       case IW_AUTH_WPA_VERSION:
+       case IW_AUTH_CIPHER_PAIRWISE:
+       case IW_AUTH_CIPHER_GROUP:
+       case IW_AUTH_RX_UNENCRYPTED_EAPOL:
+       case IW_AUTH_PRIVACY_INVOKED:
+       case IW_AUTH_DROP_UNENCRYPTED:
+               /*
+                * orinoco does not use these parameters
+                */
+               break;
+
+       case IW_AUTH_KEY_MGMT:
+               /* wl_lkm implies value 2 == PSK for Hermes I
+                * which ties in with WEXT
+                * no other hints tho :(
+                */
+               priv->key_mgmt = param->value;
+               break;
+
+       case IW_AUTH_TKIP_COUNTERMEASURES:
+               /* When countermeasures are enabled, shut down the
+                * card; when disabled, re-enable the card. This must
+                * take effect immediately.
+                *
+                * TODO: Make sure that the EAPOL message is getting
+                *       out before card disabled
+                */
+               if (param->value) {
+                       priv->tkip_cm_active = 1;
+                       ret = hermes_enable_port(hw, 0);
+               } else {
+                       priv->tkip_cm_active = 0;
+                       ret = hermes_disable_port(hw, 0);
+               }
+               break;
+
+       case IW_AUTH_80211_AUTH_ALG:
+               if (param->value & IW_AUTH_ALG_SHARED_KEY)
+                       priv->wep_restrict = 1;
+               else if (param->value & IW_AUTH_ALG_OPEN_SYSTEM)
+                       priv->wep_restrict = 0;
+               else
+                       ret = -EINVAL;
+               break;
+
+       case IW_AUTH_WPA_ENABLED:
+               if (priv->has_wpa) {
+                       priv->wpa_enabled = param->value ? 1 : 0;
+               } else {
+                       if (param->value)
+                               ret = -EOPNOTSUPP;
+                       /* else silently accept disable of WPA */
+                       priv->wpa_enabled = 0;
+               }
+               break;
+
+       default:
+               ret = -EOPNOTSUPP;
+       }
+
+       orinoco_unlock(priv, &flags);
+       return ret;
+}
+
+static int orinoco_ioctl_get_auth(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 union iwreq_data *wrqu, char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct iw_param *param = &wrqu->param;
+       unsigned long flags;
+       int ret = 0;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       switch (param->flags & IW_AUTH_INDEX) {
+       case IW_AUTH_KEY_MGMT:
+               param->value = priv->key_mgmt;
+               break;
+
+       case IW_AUTH_TKIP_COUNTERMEASURES:
+               param->value = priv->tkip_cm_active;
+               break;
+
+       case IW_AUTH_80211_AUTH_ALG:
+               if (priv->wep_restrict)
+                       param->value = IW_AUTH_ALG_SHARED_KEY;
+               else
+                       param->value = IW_AUTH_ALG_OPEN_SYSTEM;
+               break;
+
+       case IW_AUTH_WPA_ENABLED:
+               param->value = priv->wpa_enabled;
+               break;
+
+       default:
+               ret = -EOPNOTSUPP;
+       }
+
+       orinoco_unlock(priv, &flags);
+       return ret;
+}
+
+static int orinoco_ioctl_set_genie(struct net_device *dev,
+                                  struct iw_request_info *info,
+                                  union iwreq_data *wrqu, char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       u8 *buf;
+       unsigned long flags;
+
+       /* cut off at IEEE80211_MAX_DATA_LEN */
+       if ((wrqu->data.length > IEEE80211_MAX_DATA_LEN) ||
+           (wrqu->data.length && (extra == NULL)))
+               return -EINVAL;
+
+       if (wrqu->data.length) {
+               buf = kmalloc(wrqu->data.length, GFP_KERNEL);
+               if (buf == NULL)
+                       return -ENOMEM;
+
+               memcpy(buf, extra, wrqu->data.length);
+       } else
+               buf = NULL;
+
+       if (orinoco_lock(priv, &flags) != 0) {
+               kfree(buf);
+               return -EBUSY;
+       }
+
+       kfree(priv->wpa_ie);
+       priv->wpa_ie = buf;
+       priv->wpa_ie_len = wrqu->data.length;
+
+       if (priv->wpa_ie) {
+               /* Looks like wl_lkm wants to check the auth alg, and
+                * somehow pass it to the firmware.
+                * Instead it just calls the key mgmt rid
+                *   - we do this in set auth.
+                */
+       }
+
+       orinoco_unlock(priv, &flags);
+       return 0;
+}
+
+static int orinoco_ioctl_get_genie(struct net_device *dev,
+                                  struct iw_request_info *info,
+                                  union iwreq_data *wrqu, char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       unsigned long flags;
+       int err = 0;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       if ((priv->wpa_ie_len == 0) || (priv->wpa_ie == NULL)) {
+               wrqu->data.length = 0;
+               goto out;
+       }
+
+       if (wrqu->data.length < priv->wpa_ie_len) {
+               err = -E2BIG;
+               goto out;
+       }
+
+       wrqu->data.length = priv->wpa_ie_len;
+       memcpy(extra, priv->wpa_ie, priv->wpa_ie_len);
+
+out:
+       orinoco_unlock(priv, &flags);
+       return err;
+}
+
+static int orinoco_ioctl_set_mlme(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 union iwreq_data *wrqu, char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       struct iw_mlme *mlme = (struct iw_mlme *)extra;
+       unsigned long flags;
+       int ret = 0;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       switch (mlme->cmd) {
+       case IW_MLME_DEAUTH:
+               /* silently ignore */
+               break;
+
+       case IW_MLME_DISASSOC:
+       {
+               struct {
+                       u8 addr[ETH_ALEN];
+                       __le16 reason_code;
+               } __attribute__ ((packed)) buf;
+
+               memcpy(buf.addr, mlme->addr.sa_data, ETH_ALEN);
+               buf.reason_code = cpu_to_le16(mlme->reason_code);
+               ret = HERMES_WRITE_RECORD(hw, USER_BAP,
+                                         HERMES_RID_CNFDISASSOCIATE,
+                                         &buf);
+               break;
+       }
+       default:
+               ret = -EOPNOTSUPP;
+       }
+
+       orinoco_unlock(priv, &flags);
+       return ret;
+}
+
+static int orinoco_ioctl_getretry(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 struct iw_param *rrq,
+                                 char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       int err = 0;
+       u16 short_limit, long_limit, lifetime;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_SHORTRETRYLIMIT,
+                                 &short_limit);
+       if (err)
+               goto out;
+
+       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_LONGRETRYLIMIT,
+                                 &long_limit);
+       if (err)
+               goto out;
+
+       err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_MAXTRANSMITLIFETIME,
+                                 &lifetime);
+       if (err)
+               goto out;
+
+       rrq->disabled = 0;              /* Can't be disabled */
+
+       /* Note : by default, display the retry number */
+       if ((rrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
+               rrq->flags = IW_RETRY_LIFETIME;
+               rrq->value = lifetime * 1000;   /* ??? */
+       } else {
+               /* By default, display the min number */
+               if ((rrq->flags & IW_RETRY_LONG)) {
+                       rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
+                       rrq->value = long_limit;
+               } else {
+                       rrq->flags = IW_RETRY_LIMIT;
+                       rrq->value = short_limit;
+                       if (short_limit != long_limit)
+                               rrq->flags |= IW_RETRY_SHORT;
+               }
+       }
+
+ out:
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_reset(struct net_device *dev,
+                              struct iw_request_info *info,
+                              void *wrqu,
+                              char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
+       if (info->cmd == (SIOCIWFIRSTPRIV + 0x1)) {
+               printk(KERN_DEBUG "%s: Forcing reset!\n", dev->name);
+
+               /* Firmware reset */
+               orinoco_reset(&priv->reset_work);
+       } else {
+               printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name);
+
+               schedule_work(&priv->reset_work);
+       }
+
+       return 0;
+}
+
+static int orinoco_ioctl_setibssport(struct net_device *dev,
+                                    struct iw_request_info *info,
+                                    void *wrqu,
+                                    char *extra)
+
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int val = *((int *) extra);
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       priv->ibss_port = val ;
+
+       /* Actually update the mode we are using */
+       set_port_type(priv);
+
+       orinoco_unlock(priv, &flags);
+       return -EINPROGRESS;            /* Call commit handler */
+}
+
+static int orinoco_ioctl_getibssport(struct net_device *dev,
+                                    struct iw_request_info *info,
+                                    void *wrqu,
+                                    char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int *val = (int *) extra;
+
+       *val = priv->ibss_port;
+       return 0;
+}
+
+static int orinoco_ioctl_setport3(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 void *wrqu,
+                                 char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int val = *((int *) extra);
+       int err = 0;
+       unsigned long flags;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       switch (val) {
+       case 0: /* Try to do IEEE ad-hoc mode */
+               if (!priv->has_ibss) {
+                       err = -EINVAL;
+                       break;
+               }
+               priv->prefer_port3 = 0;
+
+               break;
+
+       case 1: /* Try to do Lucent proprietary ad-hoc mode */
+               if (!priv->has_port3) {
+                       err = -EINVAL;
+                       break;
+               }
+               priv->prefer_port3 = 1;
+               break;
+
+       default:
+               err = -EINVAL;
+       }
+
+       if (!err) {
+               /* Actually update the mode we are using */
+               set_port_type(priv);
+               err = -EINPROGRESS;
+       }
+
+       orinoco_unlock(priv, &flags);
+
+       return err;
+}
+
+static int orinoco_ioctl_getport3(struct net_device *dev,
+                                 struct iw_request_info *info,
+                                 void *wrqu,
+                                 char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int *val = (int *) extra;
+
+       *val = priv->prefer_port3;
+       return 0;
+}
+
+static int orinoco_ioctl_setpreamble(struct net_device *dev,
+                                    struct iw_request_info *info,
+                                    void *wrqu,
+                                    char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       unsigned long flags;
+       int val;
+
+       if (!priv->has_preamble)
+               return -EOPNOTSUPP;
+
+       /* 802.11b has recently defined some short preamble.
+        * Basically, the Phy header has been reduced in size.
+        * This increase performance, especially at high rates
+        * (the preamble is transmitted at 1Mb/s), unfortunately
+        * this give compatibility troubles... - Jean II */
+       val = *((int *) extra);
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       if (val)
+               priv->preamble = 1;
+       else
+               priv->preamble = 0;
+
+       orinoco_unlock(priv, &flags);
+
+       return -EINPROGRESS;            /* Call commit handler */
+}
+
+static int orinoco_ioctl_getpreamble(struct net_device *dev,
+                                    struct iw_request_info *info,
+                                    void *wrqu,
+                                    char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int *val = (int *) extra;
+
+       if (!priv->has_preamble)
+               return -EOPNOTSUPP;
+
+       *val = priv->preamble;
+       return 0;
+}
+
+/* ioctl interface to hermes_read_ltv()
+ * To use with iwpriv, pass the RID as the token argument, e.g.
+ * iwpriv get_rid [0xfc00]
+ * At least Wireless Tools 25 is required to use iwpriv.
+ * For Wireless Tools 25 and 26 append "dummy" are the end. */
+static int orinoco_ioctl_getrid(struct net_device *dev,
+                               struct iw_request_info *info,
+                               struct iw_point *data,
+                               char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       int rid = data->flags;
+       u16 length;
+       int err;
+       unsigned long flags;
+
+       /* It's a "get" function, but we don't want users to access the
+        * WEP key and other raw firmware data */
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
+       if (rid < 0xfc00 || rid > 0xffff)
+               return -EINVAL;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       err = hermes_read_ltv(hw, USER_BAP, rid, MAX_RID_LEN, &length,
+                             extra);
+       if (err)
+               goto out;
+
+       data->length = min_t(u16, HERMES_RECLEN_TO_BYTES(length),
+                            MAX_RID_LEN);
+
+ out:
+       orinoco_unlock(priv, &flags);
+       return err;
+}
+
+/* Trigger a scan (look for other cells in the vicinity) */
+static int orinoco_ioctl_setscan(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_point *srq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       hermes_t *hw = &priv->hw;
+       struct iw_scan_req *si = (struct iw_scan_req *) extra;
+       int err = 0;
+       unsigned long flags;
+
+       /* Note : you may have realised that, as this is a SET operation,
+        * this is privileged and therefore a normal user can't
+        * perform scanning.
+        * This is not an error, while the device perform scanning,
+        * traffic doesn't flow, so it's a perfect DoS...
+        * Jean II */
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       /* Scanning with port 0 disabled would fail */
+       if (!netif_running(dev)) {
+               err = -ENETDOWN;
+               goto out;
+       }
+
+       /* In monitor mode, the scan results are always empty.
+        * Probe responses are passed to the driver as received
+        * frames and could be processed in software. */
+       if (priv->iw_mode == IW_MODE_MONITOR) {
+               err = -EOPNOTSUPP;
+               goto out;
+       }
+
+       /* Note : because we don't lock out the irq handler, the way
+        * we access scan variables in priv is critical.
+        *      o scan_inprogress : not touched by irq handler
+        *      o scan_mode : not touched by irq handler
+        * Before modifying anything on those variables, please think hard !
+        * Jean II */
+
+       /* Save flags */
+       priv->scan_mode = srq->flags;
+
+       /* Always trigger scanning, even if it's in progress.
+        * This way, if the info frame get lost, we will recover somewhat
+        * gracefully  - Jean II */
+
+       if (priv->has_hostscan) {
+               switch (priv->firmware_type) {
+               case FIRMWARE_TYPE_SYMBOL:
+                       err = hermes_write_wordrec(hw, USER_BAP,
+                                               HERMES_RID_CNFHOSTSCAN_SYMBOL,
+                                               HERMES_HOSTSCAN_SYMBOL_ONCE |
+                                               HERMES_HOSTSCAN_SYMBOL_BCAST);
+                       break;
+               case FIRMWARE_TYPE_INTERSIL: {
+                       __le16 req[3];
+
+                       req[0] = cpu_to_le16(0x3fff);   /* All channels */
+                       req[1] = cpu_to_le16(0x0001);   /* rate 1 Mbps */
+                       req[2] = 0;                     /* Any ESSID */
+                       err = HERMES_WRITE_RECORD(hw, USER_BAP,
+                                                 HERMES_RID_CNFHOSTSCAN, &req);
+               }
+               break;
+               case FIRMWARE_TYPE_AGERE:
+                       if (priv->scan_mode & IW_SCAN_THIS_ESSID) {
+                               struct hermes_idstring idbuf;
+                               size_t len = min(sizeof(idbuf.val),
+                                                (size_t) si->essid_len);
+                               idbuf.len = cpu_to_le16(len);
+                               memcpy(idbuf.val, si->essid, len);
+
+                               err = hermes_write_ltv(hw, USER_BAP,
+                                              HERMES_RID_CNFSCANSSID_AGERE,
+                                              HERMES_BYTES_TO_RECLEN(len + 2),
+                                              &idbuf);
+                       } else
+                               err = hermes_write_wordrec(hw, USER_BAP,
+                                                  HERMES_RID_CNFSCANSSID_AGERE,
+                                                  0);  /* Any ESSID */
+                       if (err)
+                               break;
+
+                       if (priv->has_ext_scan) {
+                               /* Clear scan results at the start of
+                                * an extended scan */
+                               orinoco_clear_scan_results(priv,
+                                               msecs_to_jiffies(15000));
+
+                               /* TODO: Is this available on older firmware?
+                                *   Can we use it to scan specific channels
+                                *   for IW_SCAN_THIS_FREQ? */
+                               err = hermes_write_wordrec(hw, USER_BAP,
+                                               HERMES_RID_CNFSCANCHANNELS2GHZ,
+                                               0x7FFF);
+                               if (err)
+                                       goto out;
+
+                               err = hermes_inquire(hw,
+                                                    HERMES_INQ_CHANNELINFO);
+                       } else
+                               err = hermes_inquire(hw, HERMES_INQ_SCAN);
+                       break;
+               }
+       } else
+               err = hermes_inquire(hw, HERMES_INQ_SCAN);
+
+       /* One more client */
+       if (!err)
+               priv->scan_inprogress = 1;
+
+ out:
+       orinoco_unlock(priv, &flags);
+       return err;
+}
+
+#define MAX_CUSTOM_LEN 64
+
+/* Translate scan data returned from the card to a card independant
+ * format that the Wireless Tools will understand - Jean II */
+static inline char *orinoco_translate_scan(struct net_device *dev,
+                                          struct iw_request_info *info,
+                                          char *current_ev,
+                                          char *end_buf,
+                                          union hermes_scan_info *bss,
+                                          unsigned long last_scanned)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       u16                     capabilities;
+       u16                     channel;
+       struct iw_event         iwe;            /* Temporary buffer */
+       char custom[MAX_CUSTOM_LEN];
+
+       memset(&iwe, 0, sizeof(iwe));
+
+       /* First entry *MUST* be the AP MAC address */
+       iwe.cmd = SIOCGIWAP;
+       iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
+       memcpy(iwe.u.ap_addr.sa_data, bss->a.bssid, ETH_ALEN);
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_ADDR_LEN);
+
+       /* Other entries will be displayed in the order we give them */
+
+       /* Add the ESSID */
+       iwe.u.data.length = le16_to_cpu(bss->a.essid_len);
+       if (iwe.u.data.length > 32)
+               iwe.u.data.length = 32;
+       iwe.cmd = SIOCGIWESSID;
+       iwe.u.data.flags = 1;
+       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                         &iwe, bss->a.essid);
+
+       /* Add mode */
+       iwe.cmd = SIOCGIWMODE;
+       capabilities = le16_to_cpu(bss->a.capabilities);
+       if (capabilities & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
+               if (capabilities & WLAN_CAPABILITY_ESS)
+                       iwe.u.mode = IW_MODE_MASTER;
+               else
+                       iwe.u.mode = IW_MODE_ADHOC;
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_UINT_LEN);
+       }
+
+       channel = bss->s.channel;
+       if ((channel >= 1) && (channel <= NUM_CHANNELS)) {
+               /* Add channel and frequency */
+               iwe.cmd = SIOCGIWFREQ;
+               iwe.u.freq.m = channel;
+               iwe.u.freq.e = 0;
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_FREQ_LEN);
+
+               iwe.u.freq.m = ieee80211_dsss_chan_to_freq(channel) * 100000;
+               iwe.u.freq.e = 1;
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_FREQ_LEN);
+       }
+
+       /* Add quality statistics. level and noise in dB. No link quality */
+       iwe.cmd = IWEVQUAL;
+       iwe.u.qual.updated = IW_QUAL_DBM | IW_QUAL_QUAL_INVALID;
+       iwe.u.qual.level = (__u8) le16_to_cpu(bss->a.level) - 0x95;
+       iwe.u.qual.noise = (__u8) le16_to_cpu(bss->a.noise) - 0x95;
+       /* Wireless tools prior to 27.pre22 will show link quality
+        * anyway, so we provide a reasonable value. */
+       if (iwe.u.qual.level > iwe.u.qual.noise)
+               iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
+       else
+               iwe.u.qual.qual = 0;
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_QUAL_LEN);
+
+       /* Add encryption capability */
+       iwe.cmd = SIOCGIWENCODE;
+       if (capabilities & WLAN_CAPABILITY_PRIVACY)
+               iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+       else
+               iwe.u.data.flags = IW_ENCODE_DISABLED;
+       iwe.u.data.length = 0;
+       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                         &iwe, NULL);
+
+       /* Bit rate is not available in Lucent/Agere firmwares */
+       if (priv->firmware_type != FIRMWARE_TYPE_AGERE) {
+               char *current_val = current_ev + iwe_stream_lcp_len(info);
+               int i;
+               int step;
+
+               if (priv->firmware_type == FIRMWARE_TYPE_SYMBOL)
+                       step = 2;
+               else
+                       step = 1;
+
+               iwe.cmd = SIOCGIWRATE;
+               /* Those two flags are ignored... */
+               iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+               /* Max 10 values */
+               for (i = 0; i < 10; i += step) {
+                       /* NULL terminated */
+                       if (bss->p.rates[i] == 0x0)
+                               break;
+                       /* Bit rate given in 500 kb/s units (+ 0x80) */
+                       iwe.u.bitrate.value =
+                               ((bss->p.rates[i] & 0x7f) * 500000);
+                       current_val = iwe_stream_add_value(info, current_ev,
+                                                          current_val,
+                                                          end_buf, &iwe,
+                                                          IW_EV_PARAM_LEN);
+               }
+               /* Check if we added any event */
+               if ((current_val - current_ev) > iwe_stream_lcp_len(info))
+                       current_ev = current_val;
+       }
+
+       /* Beacon interval */
+       iwe.cmd = IWEVCUSTOM;
+       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
+                                    "bcn_int=%d",
+                                    le16_to_cpu(bss->a.beacon_interv));
+       if (iwe.u.data.length)
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, custom);
+
+       /* Capabilites */
+       iwe.cmd = IWEVCUSTOM;
+       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
+                                    "capab=0x%04x",
+                                    capabilities);
+       if (iwe.u.data.length)
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, custom);
+
+       /* Add EXTRA: Age to display seconds since last beacon/probe response
+        * for given network. */
+       iwe.cmd = IWEVCUSTOM;
+       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
+                                    " Last beacon: %dms ago",
+                                    jiffies_to_msecs(jiffies - last_scanned));
+       if (iwe.u.data.length)
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, custom);
+
+       return current_ev;
+}
+
+static inline char *orinoco_translate_ext_scan(struct net_device *dev,
+                                              struct iw_request_info *info,
+                                              char *current_ev,
+                                              char *end_buf,
+                                              struct agere_ext_scan_info *bss,
+                                              unsigned long last_scanned)
+{
+       u16                     capabilities;
+       u16                     channel;
+       struct iw_event         iwe;            /* Temporary buffer */
+       char custom[MAX_CUSTOM_LEN];
+       u8 *ie;
+
+       memset(&iwe, 0, sizeof(iwe));
+
+       /* First entry *MUST* be the AP MAC address */
+       iwe.cmd = SIOCGIWAP;
+       iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
+       memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN);
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_ADDR_LEN);
+
+       /* Other entries will be displayed in the order we give them */
+
+       /* Add the ESSID */
+       ie = bss->data;
+       iwe.u.data.length = ie[1];
+       if (iwe.u.data.length) {
+               if (iwe.u.data.length > 32)
+                       iwe.u.data.length = 32;
+               iwe.cmd = SIOCGIWESSID;
+               iwe.u.data.flags = 1;
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, &ie[2]);
+       }
+
+       /* Add mode */
+       capabilities = le16_to_cpu(bss->capabilities);
+       if (capabilities & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)) {
+               iwe.cmd = SIOCGIWMODE;
+               if (capabilities & WLAN_CAPABILITY_ESS)
+                       iwe.u.mode = IW_MODE_MASTER;
+               else
+                       iwe.u.mode = IW_MODE_ADHOC;
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_UINT_LEN);
+       }
+
+       ie = orinoco_get_ie(bss->data, sizeof(bss->data), WLAN_EID_DS_PARAMS);
+       channel = ie ? ie[2] : 0;
+       if ((channel >= 1) && (channel <= NUM_CHANNELS)) {
+               /* Add channel and frequency */
+               iwe.cmd = SIOCGIWFREQ;
+               iwe.u.freq.m = channel;
+               iwe.u.freq.e = 0;
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_FREQ_LEN);
+
+               iwe.u.freq.m = ieee80211_dsss_chan_to_freq(channel) * 100000;
+               iwe.u.freq.e = 1;
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_FREQ_LEN);
+       }
+
+       /* Add quality statistics. level and noise in dB. No link quality */
+       iwe.cmd = IWEVQUAL;
+       iwe.u.qual.updated = IW_QUAL_DBM | IW_QUAL_QUAL_INVALID;
+       iwe.u.qual.level = bss->level - 0x95;
+       iwe.u.qual.noise = bss->noise - 0x95;
+       /* Wireless tools prior to 27.pre22 will show link quality
+        * anyway, so we provide a reasonable value. */
+       if (iwe.u.qual.level > iwe.u.qual.noise)
+               iwe.u.qual.qual = iwe.u.qual.level - iwe.u.qual.noise;
+       else
+               iwe.u.qual.qual = 0;
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                         &iwe, IW_EV_QUAL_LEN);
+
+       /* Add encryption capability */
+       iwe.cmd = SIOCGIWENCODE;
+       if (capabilities & WLAN_CAPABILITY_PRIVACY)
+               iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+       else
+               iwe.u.data.flags = IW_ENCODE_DISABLED;
+       iwe.u.data.length = 0;
+       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                         &iwe, NULL);
+
+       /* WPA IE */
+       ie = orinoco_get_wpa_ie(bss->data, sizeof(bss->data));
+       if (ie) {
+               iwe.cmd = IWEVGENIE;
+               iwe.u.data.length = ie[1] + 2;
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, ie);
+       }
+
+       /* RSN IE */
+       ie = orinoco_get_ie(bss->data, sizeof(bss->data), WLAN_EID_RSN);
+       if (ie) {
+               iwe.cmd = IWEVGENIE;
+               iwe.u.data.length = ie[1] + 2;
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, ie);
+       }
+
+       ie = orinoco_get_ie(bss->data, sizeof(bss->data), WLAN_EID_SUPP_RATES);
+       if (ie) {
+               char *p = current_ev + iwe_stream_lcp_len(info);
+               int i;
+
+               iwe.cmd = SIOCGIWRATE;
+               /* Those two flags are ignored... */
+               iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+
+               for (i = 2; i < (ie[1] + 2); i++) {
+                       iwe.u.bitrate.value = ((ie[i] & 0x7F) * 500000);
+                       p = iwe_stream_add_value(info, current_ev, p, end_buf,
+                                                &iwe, IW_EV_PARAM_LEN);
+               }
+               /* Check if we added any event */
+               if (p > (current_ev + iwe_stream_lcp_len(info)))
+                       current_ev = p;
+       }
+
+       /* Timestamp */
+       iwe.cmd = IWEVCUSTOM;
+       iwe.u.data.length =
+               snprintf(custom, MAX_CUSTOM_LEN, "tsf=%016llx",
+                        (unsigned long long) le64_to_cpu(bss->timestamp));
+       if (iwe.u.data.length)
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, custom);
+
+       /* Beacon interval */
+       iwe.cmd = IWEVCUSTOM;
+       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
+                                    "bcn_int=%d",
+                                    le16_to_cpu(bss->beacon_interval));
+       if (iwe.u.data.length)
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, custom);
+
+       /* Capabilites */
+       iwe.cmd = IWEVCUSTOM;
+       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
+                                    "capab=0x%04x",
+                                    capabilities);
+       if (iwe.u.data.length)
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, custom);
+
+       /* Add EXTRA: Age to display seconds since last beacon/probe response
+        * for given network. */
+       iwe.cmd = IWEVCUSTOM;
+       iwe.u.data.length = snprintf(custom, MAX_CUSTOM_LEN,
+                                    " Last beacon: %dms ago",
+                                    jiffies_to_msecs(jiffies - last_scanned));
+       if (iwe.u.data.length)
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, custom);
+
+       return current_ev;
+}
+
+/* Return results of a scan */
+static int orinoco_ioctl_getscan(struct net_device *dev,
+                                struct iw_request_info *info,
+                                struct iw_point *srq,
+                                char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       int err = 0;
+       unsigned long flags;
+       char *current_ev = extra;
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return -EBUSY;
+
+       if (priv->scan_inprogress) {
+               /* Important note : we don't want to block the caller
+                * until results are ready for various reasons.
+                * First, managing wait queues is complex and racy.
+                * Second, we grab some rtnetlink lock before comming
+                * here (in dev_ioctl()).
+                * Third, we generate an Wireless Event, so the
+                * caller can wait itself on that - Jean II */
+               err = -EAGAIN;
+               goto out;
+       }
+
+       if (priv->has_ext_scan) {
+               struct xbss_element *bss;
+
+               list_for_each_entry(bss, &priv->bss_list, list) {
+                       /* Translate this entry to WE format */
+                       current_ev =
+                               orinoco_translate_ext_scan(dev, info,
+                                                          current_ev,
+                                                          extra + srq->length,
+                                                          &bss->bss,
+                                                          bss->last_scanned);
+
+                       /* Check if there is space for one more entry */
+                       if ((extra + srq->length - current_ev)
+                           <= IW_EV_ADDR_LEN) {
+                               /* Ask user space to try again with a
+                                * bigger buffer */
+                               err = -E2BIG;
+                               goto out;
+                       }
+               }
+
+       } else {
+               struct bss_element *bss;
+
+               list_for_each_entry(bss, &priv->bss_list, list) {
+                       /* Translate this entry to WE format */
+                       current_ev = orinoco_translate_scan(dev, info,
+                                                           current_ev,
+                                                           extra + srq->length,
+                                                           &bss->bss,
+                                                           bss->last_scanned);
+
+                       /* Check if there is space for one more entry */
+                       if ((extra + srq->length - current_ev)
+                           <= IW_EV_ADDR_LEN) {
+                               /* Ask user space to try again with a
+                                * bigger buffer */
+                               err = -E2BIG;
+                               goto out;
+                       }
+               }
+       }
+
+       srq->length = (current_ev - extra);
+       srq->flags = (__u16) priv->scan_mode;
+
+out:
+       orinoco_unlock(priv, &flags);
+       return err;
+}
+
+/* Commit handler, called after set operations */
+static int orinoco_ioctl_commit(struct net_device *dev,
+                               struct iw_request_info *info,
+                               void *wrqu,
+                               char *extra)
+{
+       struct orinoco_private *priv = netdev_priv(dev);
+       struct hermes *hw = &priv->hw;
+       unsigned long flags;
+       int err = 0;
+
+       if (!priv->open)
+               return 0;
+
+       if (priv->broken_disableport) {
+               orinoco_reset(&priv->reset_work);
+               return 0;
+       }
+
+       if (orinoco_lock(priv, &flags) != 0)
+               return err;
+
+       err = hermes_disable_port(hw, 0);
+       if (err) {
+               printk(KERN_WARNING "%s: Unable to disable port "
+                      "while reconfiguring card\n", dev->name);
+               priv->broken_disableport = 1;
+               goto out;
+       }
+
+       err = __orinoco_program_rids(dev);
+       if (err) {
+               printk(KERN_WARNING "%s: Unable to reconfigure card\n",
+                      dev->name);
+               goto out;
+       }
+
+       err = hermes_enable_port(hw, 0);
+       if (err) {
+               printk(KERN_WARNING "%s: Unable to enable port while reconfiguring card\n",
+                      dev->name);
+               goto out;
+       }
+
+ out:
+       if (err) {
+               printk(KERN_WARNING "%s: Resetting instead...\n", dev->name);
+               schedule_work(&priv->reset_work);
+               err = 0;
+       }
+
+       orinoco_unlock(priv, &flags);
+       return err;
+}
+
+static const struct iw_priv_args orinoco_privtab[] = {
+       { SIOCIWFIRSTPRIV + 0x0, 0, 0, "force_reset" },
+       { SIOCIWFIRSTPRIV + 0x1, 0, 0, "card_reset" },
+       { SIOCIWFIRSTPRIV + 0x2, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+         0, "set_port3" },
+       { SIOCIWFIRSTPRIV + 0x3, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+         "get_port3" },
+       { SIOCIWFIRSTPRIV + 0x4, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+         0, "set_preamble" },
+       { SIOCIWFIRSTPRIV + 0x5, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+         "get_preamble" },
+       { SIOCIWFIRSTPRIV + 0x6, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+         0, "set_ibssport" },
+       { SIOCIWFIRSTPRIV + 0x7, 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+         "get_ibssport" },
+       { SIOCIWFIRSTPRIV + 0x9, 0, IW_PRIV_TYPE_BYTE | MAX_RID_LEN,
+         "get_rid" },
+};
+
+
+/*
+ * Structures to export the Wireless Handlers
+ */
+
+#define STD_IW_HANDLER(id, func) \
+       [IW_IOCTL_IDX(id)] = (iw_handler) func
+static const iw_handler        orinoco_handler[] = {
+       STD_IW_HANDLER(SIOCSIWCOMMIT,   orinoco_ioctl_commit),
+       STD_IW_HANDLER(SIOCGIWNAME,     orinoco_ioctl_getname),
+       STD_IW_HANDLER(SIOCSIWFREQ,     orinoco_ioctl_setfreq),
+       STD_IW_HANDLER(SIOCGIWFREQ,     orinoco_ioctl_getfreq),
+       STD_IW_HANDLER(SIOCSIWMODE,     orinoco_ioctl_setmode),
+       STD_IW_HANDLER(SIOCGIWMODE,     orinoco_ioctl_getmode),
+       STD_IW_HANDLER(SIOCSIWSENS,     orinoco_ioctl_setsens),
+       STD_IW_HANDLER(SIOCGIWSENS,     orinoco_ioctl_getsens),
+       STD_IW_HANDLER(SIOCGIWRANGE,    orinoco_ioctl_getiwrange),
+       STD_IW_HANDLER(SIOCSIWSPY,      iw_handler_set_spy),
+       STD_IW_HANDLER(SIOCGIWSPY,      iw_handler_get_spy),
+       STD_IW_HANDLER(SIOCSIWTHRSPY,   iw_handler_set_thrspy),
+       STD_IW_HANDLER(SIOCGIWTHRSPY,   iw_handler_get_thrspy),
+       STD_IW_HANDLER(SIOCSIWAP,       orinoco_ioctl_setwap),
+       STD_IW_HANDLER(SIOCGIWAP,       orinoco_ioctl_getwap),
+       STD_IW_HANDLER(SIOCSIWSCAN,     orinoco_ioctl_setscan),
+       STD_IW_HANDLER(SIOCGIWSCAN,     orinoco_ioctl_getscan),
+       STD_IW_HANDLER(SIOCSIWESSID,    orinoco_ioctl_setessid),
+       STD_IW_HANDLER(SIOCGIWESSID,    orinoco_ioctl_getessid),
+       STD_IW_HANDLER(SIOCSIWNICKN,    orinoco_ioctl_setnick),
+       STD_IW_HANDLER(SIOCGIWNICKN,    orinoco_ioctl_getnick),
+       STD_IW_HANDLER(SIOCSIWRATE,     orinoco_ioctl_setrate),
+       STD_IW_HANDLER(SIOCGIWRATE,     orinoco_ioctl_getrate),
+       STD_IW_HANDLER(SIOCSIWRTS,      orinoco_ioctl_setrts),
+       STD_IW_HANDLER(SIOCGIWRTS,      orinoco_ioctl_getrts),
+       STD_IW_HANDLER(SIOCSIWFRAG,     orinoco_ioctl_setfrag),
+       STD_IW_HANDLER(SIOCGIWFRAG,     orinoco_ioctl_getfrag),
+       STD_IW_HANDLER(SIOCGIWRETRY,    orinoco_ioctl_getretry),
+       STD_IW_HANDLER(SIOCSIWENCODE,   orinoco_ioctl_setiwencode),
+       STD_IW_HANDLER(SIOCGIWENCODE,   orinoco_ioctl_getiwencode),
+       STD_IW_HANDLER(SIOCSIWPOWER,    orinoco_ioctl_setpower),
+       STD_IW_HANDLER(SIOCGIWPOWER,    orinoco_ioctl_getpower),
+       STD_IW_HANDLER(SIOCSIWGENIE,    orinoco_ioctl_set_genie),
+       STD_IW_HANDLER(SIOCGIWGENIE,    orinoco_ioctl_get_genie),
+       STD_IW_HANDLER(SIOCSIWMLME,     orinoco_ioctl_set_mlme),
+       STD_IW_HANDLER(SIOCSIWAUTH,     orinoco_ioctl_set_auth),
+       STD_IW_HANDLER(SIOCGIWAUTH,     orinoco_ioctl_get_auth),
+       STD_IW_HANDLER(SIOCSIWENCODEEXT, orinoco_ioctl_set_encodeext),
+       STD_IW_HANDLER(SIOCGIWENCODEEXT, orinoco_ioctl_get_encodeext),
+};
+
+
+/*
+  Added typecasting since we no longer use iwreq_data -- Moustafa
+ */
+static const iw_handler        orinoco_private_handler[] = {
+       [0] = (iw_handler) orinoco_ioctl_reset,
+       [1] = (iw_handler) orinoco_ioctl_reset,
+       [2] = (iw_handler) orinoco_ioctl_setport3,
+       [3] = (iw_handler) orinoco_ioctl_getport3,
+       [4] = (iw_handler) orinoco_ioctl_setpreamble,
+       [5] = (iw_handler) orinoco_ioctl_getpreamble,
+       [6] = (iw_handler) orinoco_ioctl_setibssport,
+       [7] = (iw_handler) orinoco_ioctl_getibssport,
+       [9] = (iw_handler) orinoco_ioctl_getrid,
+};
+
+const struct iw_handler_def orinoco_handler_def = {
+       .num_standard = ARRAY_SIZE(orinoco_handler),
+       .num_private = ARRAY_SIZE(orinoco_private_handler),
+       .num_private_args = ARRAY_SIZE(orinoco_privtab),
+       .standard = orinoco_handler,
+       .private = orinoco_private_handler,
+       .private_args = orinoco_privtab,
+       .get_wireless_stats = orinoco_get_wireless_stats,
+};
diff --git a/drivers/net/wireless/orinoco/wext.h b/drivers/net/wireless/orinoco/wext.h
new file mode 100644 (file)
index 0000000..1479f4e
--- /dev/null
@@ -0,0 +1,13 @@
+/* Wireless extensions support.
+ *
+ * See copyright notice in main.c
+ */
+#ifndef _ORINOCO_WEXT_H_
+#define _ORINOCO_WEXT_H_
+
+#include <net/iw_handler.h>
+
+/* Structure defining all our WEXT handlers */
+extern const struct iw_handler_def orinoco_handler_def;
+
+#endif /* _ORINOCO_WEXT_H_ */
index d3469d08f966961599789772b97d0827491254a7..cfc5f41aa1361e31a5ec5bfefe131eb41bdd713a 100644 (file)
@@ -61,3 +61,13 @@ config P54_PCI
          http://prism54.org/
 
          If you choose to build a module, it'll be called p54pci.
+
+config P54_SPI
+       tristate "Prism54 SPI (stlc45xx) support"
+       depends on P54_COMMON && SPI_MASTER
+       ---help---
+         This driver is for stlc4550 or stlc4560 based wireless chips.
+         This driver is experimental, untested and will probably only work on
+         Nokia's N800/N810 Portable Internet Tablet.
+
+         If you choose to build a module, it'll be called p54spi.
index 4fa9ce7173602a7df09abf1c7698c861d3104397..c2050dee62937abd8a5f41dbade4112753665213 100644 (file)
@@ -1,3 +1,4 @@
 obj-$(CONFIG_P54_COMMON)       += p54common.o
 obj-$(CONFIG_P54_USB)          += p54usb.o
 obj-$(CONFIG_P54_PCI)          += p54pci.o
+obj-$(CONFIG_P54_SPI)          += p54spi.o
index ab79e32f0b27c495c3c20eb43310882ff1aaa8b9..94c3acd1fcaf41e0058e53e79537b39c3296df5c 100644 (file)
@@ -44,6 +44,18 @@ enum p54_control_frame_types {
        P54_CONTROL_TYPE_BT_OPTIONS = 35
 };
 
+/* provide 16 bytes for the transport back-end */
+#define P54_TX_INFO_DATA_SIZE          16
+
+/* stored in ieee80211_tx_info's rate_driver_data */
+struct p54_tx_info {
+       u32 start_addr;
+       u32 end_addr;
+       void *data[P54_TX_INFO_DATA_SIZE / sizeof(void *)];
+};
+
+#define P54_MAX_CTRL_FRAME_LEN         0x1000
+
 #define P54_HDR_FLAG_CONTROL           BIT(15)
 #define P54_HDR_FLAG_CONTROL_OPSET     (BIT(15) + BIT(0))
 
@@ -75,6 +87,14 @@ struct p54_rssi_linear_approximation {
        s16 longbow_unk2;
 };
 
+struct p54_cal_database {
+       size_t entries;
+       size_t entry_size;
+       size_t offset;
+       size_t len;
+       u8 data[0];
+};
+
 #define EEPROM_READBACK_LEN 0x3fc
 
 #define ISL38XX_DEV_FIRMWARE_ADDR 0x20000
@@ -84,6 +104,14 @@ struct p54_rssi_linear_approximation {
 #define FW_LM87 0x4c4d3837
 #define FW_LM20 0x4c4d3230
 
+enum fw_state {
+       FW_STATE_OFF,
+       FW_STATE_BOOTING,
+       FW_STATE_READY,
+       FW_STATE_RESET,
+       FW_STATE_RESETTING,
+};
+
 struct p54_common {
        struct ieee80211_hw *hw;
        u32 rx_start;
@@ -99,11 +127,12 @@ struct p54_common {
        struct mutex conf_mutex;
        u8 mac_addr[ETH_ALEN];
        u8 bssid[ETH_ALEN];
+       u8 rx_diversity_mask;
+       u8 tx_diversity_mask;
        struct pda_iq_autocal_entry *iq_autocal;
        unsigned int iq_autocal_len;
-       struct pda_channel_output_limit *output_limit;
-       unsigned int output_limit_len;
-       struct pda_pa_curve_data *curve_data;
+       struct p54_cal_database *output_limit;
+       struct p54_cal_database *curve_data;
        struct p54_rssi_linear_approximation rssical_db[IEEE80211_NUM_BANDS];
        unsigned int filter_flags;
        bool use_short_slot;
@@ -115,7 +144,7 @@ struct p54_common {
        unsigned int output_power;
        u32 tsf_low32;
        u32 tsf_high32;
-       u64 basic_rate_mask;
+       u32 basic_rate_mask;
        u16 wakeup_timer;
        u16 aid;
        struct ieee80211_tx_queue_stats tx_stats[8];
@@ -133,6 +162,7 @@ struct p54_common {
 int p54_rx(struct ieee80211_hw *dev, struct sk_buff *skb);
 void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb);
 int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw);
+int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len);
 int p54_read_eeprom(struct ieee80211_hw *dev);
 struct ieee80211_hw *p54_init_common(size_t priv_data_len);
 void p54_free_common(struct ieee80211_hw *dev);
index 34561e6e816be3dcefcf6f63caa709a9b9673b8e..45c2e7ad3acdfb83e0921ab8428a7aa90de45590 100644 (file)
@@ -239,11 +239,11 @@ int p54_parse_firmware(struct ieee80211_hw *dev, const struct firmware *fw)
 
        if (priv->fw_var >= 0x300) {
                /* Firmware supports QoS, use it! */
-               priv->tx_stats[4].limit = 3;            /* AC_VO */
-               priv->tx_stats[5].limit = 4;            /* AC_VI */
-               priv->tx_stats[6].limit = 3;            /* AC_BE */
-               priv->tx_stats[7].limit = 2;            /* AC_BK */
-               dev->queues = 4;
+               priv->tx_stats[P54_QUEUE_AC_VO].limit = 3;
+               priv->tx_stats[P54_QUEUE_AC_VI].limit = 4;
+               priv->tx_stats[P54_QUEUE_AC_BE].limit = 3;
+               priv->tx_stats[P54_QUEUE_AC_BK].limit = 2;
+               dev->queues = P54_QUEUE_AC_NUM;
        }
 
        if (!modparam_nohwcrypt)
@@ -272,13 +272,19 @@ static int p54_convert_rev0(struct ieee80211_hw *dev,
        unsigned int i, j;
        void *source, *target;
 
-       priv->curve_data = kmalloc(cd_len, GFP_KERNEL);
+       priv->curve_data = kmalloc(sizeof(*priv->curve_data) + cd_len,
+                                  GFP_KERNEL);
        if (!priv->curve_data)
                return -ENOMEM;
 
-       memcpy(priv->curve_data, curve_data, sizeof(*curve_data));
+       priv->curve_data->entries = curve_data->channels;
+       priv->curve_data->entry_size = sizeof(__le16) +
+               sizeof(*dst) * curve_data->points_per_channel;
+       priv->curve_data->offset = offsetof(struct pda_pa_curve_data, data);
+       priv->curve_data->len = cd_len;
+       memcpy(priv->curve_data->data, curve_data, sizeof(*curve_data));
        source = curve_data->data;
-       target = priv->curve_data->data;
+       target = ((struct pda_pa_curve_data *) priv->curve_data->data)->data;
        for (i = 0; i < curve_data->channels; i++) {
                __le16 *freq = source;
                source += sizeof(__le16);
@@ -318,13 +324,19 @@ static int p54_convert_rev1(struct ieee80211_hw *dev,
        unsigned int i, j;
        void *source, *target;
 
-       priv->curve_data = kmalloc(cd_len, GFP_KERNEL);
+       priv->curve_data = kzalloc(cd_len + sizeof(*priv->curve_data),
+                                  GFP_KERNEL);
        if (!priv->curve_data)
                return -ENOMEM;
 
-       memcpy(priv->curve_data, curve_data, sizeof(*curve_data));
+       priv->curve_data->entries = curve_data->channels;
+       priv->curve_data->entry_size = sizeof(__le16) +
+               sizeof(*dst) * curve_data->points_per_channel;
+       priv->curve_data->offset = offsetof(struct pda_pa_curve_data, data);
+       priv->curve_data->len = cd_len;
+       memcpy(priv->curve_data->data, curve_data, sizeof(*curve_data));
        source = curve_data->data;
-       target = priv->curve_data->data;
+       target = ((struct pda_pa_curve_data *) priv->curve_data->data)->data;
        for (i = 0; i < curve_data->channels; i++) {
                __le16 *freq = source;
                source += sizeof(__le16);
@@ -376,7 +388,102 @@ static void p54_parse_rssical(struct ieee80211_hw *dev, void *data, int len,
        }
 }
 
-static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
+static void p54_parse_default_country(struct ieee80211_hw *dev,
+                                     void *data, int len)
+{
+       struct pda_country *country;
+
+       if (len != sizeof(*country)) {
+               printk(KERN_ERR "%s: found possible invalid default country "
+                               "eeprom entry. (entry size: %d)\n",
+                      wiphy_name(dev->wiphy), len);
+
+               print_hex_dump_bytes("country:", DUMP_PREFIX_NONE,
+                                    data, len);
+
+               printk(KERN_ERR "%s: please report this issue.\n",
+                       wiphy_name(dev->wiphy));
+               return;
+       }
+
+       country = (struct pda_country *) data;
+       if (country->flags == PDR_COUNTRY_CERT_CODE_PSEUDO)
+               regulatory_hint(dev->wiphy, country->alpha2);
+       else {
+               /* TODO:
+                * write a shared/common function that converts
+                * "Regulatory domain codes" (802.11-2007 14.8.2.2)
+                * into ISO/IEC 3166-1 alpha2 for regulatory_hint.
+                */
+       }
+}
+
+static int p54_convert_output_limits(struct ieee80211_hw *dev,
+                                    u8 *data, size_t len)
+{
+       struct p54_common *priv = dev->priv;
+
+       if (len < 2)
+               return -EINVAL;
+
+       if (data[0] != 0) {
+               printk(KERN_ERR "%s: unknown output power db revision:%x\n",
+                      wiphy_name(dev->wiphy), data[0]);
+               return -EINVAL;
+       }
+
+       if (2 + data[1] * sizeof(struct pda_channel_output_limit) > len)
+               return -EINVAL;
+
+       priv->output_limit = kmalloc(data[1] *
+               sizeof(struct pda_channel_output_limit) +
+               sizeof(*priv->output_limit), GFP_KERNEL);
+
+       if (!priv->output_limit)
+               return -ENOMEM;
+
+       priv->output_limit->offset = 0;
+       priv->output_limit->entries = data[1];
+       priv->output_limit->entry_size =
+               sizeof(struct pda_channel_output_limit);
+       priv->output_limit->len = priv->output_limit->entry_size *
+                                 priv->output_limit->entries +
+                                 priv->output_limit->offset;
+
+       memcpy(priv->output_limit->data, &data[2],
+              data[1] * sizeof(struct pda_channel_output_limit));
+
+       return 0;
+}
+
+static struct p54_cal_database *p54_convert_db(struct pda_custom_wrapper *src,
+                                              size_t total_len)
+{
+       struct p54_cal_database *dst;
+       size_t payload_len, entries, entry_size, offset;
+
+       payload_len = le16_to_cpu(src->len);
+       entries = le16_to_cpu(src->entries);
+       entry_size = le16_to_cpu(src->entry_size);
+       offset = le16_to_cpu(src->offset);
+       if (((entries * entry_size + offset) != payload_len) ||
+            (payload_len + sizeof(*src) != total_len))
+               return NULL;
+
+       dst = kmalloc(sizeof(*dst) + payload_len, GFP_KERNEL);
+       if (!dst)
+               return NULL;
+
+       dst->entries = entries;
+       dst->entry_size = entry_size;
+       dst->offset = offset;
+       dst->len = payload_len;
+
+       memcpy(dst->data, src->data, payload_len);
+       return dst;
+}
+
+int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
 {
        struct p54_common *priv = dev->priv;
        struct eeprom_pda_wrap *wrap = NULL;
@@ -401,30 +508,17 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
 
                switch (le16_to_cpu(entry->code)) {
                case PDR_MAC_ADDRESS:
+                       if (data_len != ETH_ALEN)
+                               break;
                        SET_IEEE80211_PERM_ADDR(dev, entry->data);
                        break;
                case PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS:
-                       if (data_len < 2) {
-                               err = -EINVAL;
-                               goto err;
-                       }
-
-                       if (2 + entry->data[1]*sizeof(*priv->output_limit) > data_len) {
-                               err = -EINVAL;
-                               goto err;
-                       }
-
-                       priv->output_limit = kmalloc(entry->data[1] *
-                               sizeof(*priv->output_limit), GFP_KERNEL);
-
-                       if (!priv->output_limit) {
-                               err = -ENOMEM;
+                       if (priv->output_limit)
+                               break;
+                       err = p54_convert_output_limits(dev, entry->data,
+                                                       data_len);
+                       if (err)
                                goto err;
-                       }
-
-                       memcpy(priv->output_limit, &entry->data[2],
-                              entry->data[1]*sizeof(*priv->output_limit));
-                       priv->output_limit_len = entry->data[1];
                        break;
                case PDR_PRISM_PA_CAL_CURVE_DATA: {
                        struct pda_pa_curve_data *curve_data =
@@ -463,6 +557,9 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
                        memcpy(priv->iq_autocal, entry->data, data_len);
                        priv->iq_autocal_len = data_len / sizeof(struct pda_iq_autocal_entry);
                        break;
+               case PDR_DEFAULT_COUNTRY:
+                       p54_parse_default_country(dev, entry->data, data_len);
+                       break;
                case PDR_INTERFACE_LIST:
                        tmp = entry->data;
                        while ((u8 *)tmp < entry->data + data_len) {
@@ -473,6 +570,8 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
                        }
                        break;
                case PDR_HARDWARE_PLATFORM_COMPONENT_ID:
+                       if (data_len < 2)
+                               break;
                        priv->version = *(u8 *)(entry->data + 1);
                        break;
                case PDR_RSSI_LINEAR_APPROXIMATION:
@@ -481,6 +580,34 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
                        p54_parse_rssical(dev, entry->data, data_len,
                                          le16_to_cpu(entry->code));
                        break;
+               case PDR_RSSI_LINEAR_APPROXIMATION_CUSTOM: {
+                       __le16 *src = (void *) entry->data;
+                       s16 *dst = (void *) &priv->rssical_db;
+                       int i;
+
+                       if (data_len != sizeof(priv->rssical_db)) {
+                               err = -EINVAL;
+                               goto err;
+                       }
+                       for (i = 0; i < sizeof(priv->rssical_db) /
+                                       sizeof(*src); i++)
+                               *(dst++) = (s16) le16_to_cpu(*(src++));
+                       }
+                       break;
+               case PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS_CUSTOM: {
+                       struct pda_custom_wrapper *pda = (void *) entry->data;
+                       if (priv->output_limit || data_len < sizeof(*pda))
+                               break;
+                       priv->output_limit = p54_convert_db(pda, data_len);
+                       }
+                       break;
+               case PDR_PRISM_PA_CAL_CURVE_DATA_CUSTOM: {
+                       struct pda_custom_wrapper *pda = (void *) entry->data;
+                       if (priv->curve_data || data_len < sizeof(*pda))
+                               break;
+                       priv->curve_data = p54_convert_db(pda, data_len);
+                       }
+                       break;
                case PDR_END:
                        /* make it overrun */
                        entry_len = len;
@@ -497,7 +624,6 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
                case PDR_UTF8_OEM_NAME:
                case PDR_UTF8_PRODUCT_NAME:
                case PDR_COUNTRY_LIST:
-               case PDR_DEFAULT_COUNTRY:
                case PDR_ANTENNA_GAIN:
                case PDR_PRISM_INDIGO_PA_CALIBRATION_DATA:
                case PDR_REGULATORY_POWER_LIMITS:
@@ -525,12 +651,16 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
        }
 
        priv->rxhw = synth & PDR_SYNTH_FRONTEND_MASK;
-       if (priv->rxhw == 4)
+       if (priv->rxhw == PDR_SYNTH_FRONTEND_XBOW)
                p54_init_xbow_synth(dev);
        if (!(synth & PDR_SYNTH_24_GHZ_DISABLED))
                dev->wiphy->bands[IEEE80211_BAND_2GHZ] = &band_2GHz;
        if (!(synth & PDR_SYNTH_5_GHZ_DISABLED))
                dev->wiphy->bands[IEEE80211_BAND_5GHZ] = &band_5GHz;
+       if ((synth & PDR_SYNTH_RX_DIV_MASK) == PDR_SYNTH_RX_DIV_SUPPORTED)
+               priv->rx_diversity_mask = 3;
+       if ((synth & PDR_SYNTH_TX_DIV_MASK) == PDR_SYNTH_TX_DIV_SUPPORTED)
+               priv->tx_diversity_mask = 3;
 
        if (!is_valid_ether_addr(dev->wiphy->perm_addr)) {
                u8 perm_addr[ETH_ALEN];
@@ -568,13 +698,21 @@ static int p54_parse_eeprom(struct ieee80211_hw *dev, void *eeprom, int len)
                wiphy_name(dev->wiphy));
        return err;
 }
+EXPORT_SYMBOL_GPL(p54_parse_eeprom);
 
 static int p54_rssi_to_dbm(struct ieee80211_hw *dev, int rssi)
 {
        struct p54_common *priv = dev->priv;
        int band = dev->conf.channel->band;
 
-       return ((rssi * priv->rssical_db[band].mul) / 64 +
+       if (priv->rxhw != PDR_SYNTH_FRONTEND_LONGBOW)
+               return ((rssi * priv->rssical_db[band].mul) / 64 +
+                        priv->rssical_db[band].add) / 4;
+       else
+               /*
+                * TODO: find the correct formula
+                */
+               return ((rssi * priv->rssical_db[band].mul) / 64 +
                         priv->rssical_db[band].add) / 4;
 }
 
@@ -655,7 +793,8 @@ static void inline p54_wake_free_queues(struct ieee80211_hw *dev)
                return ;
 
        for (i = 0; i < dev->queues; i++)
-               if (priv->tx_stats[i + 4].len < priv->tx_stats[i + 4].limit)
+               if (priv->tx_stats[i + P54_QUEUE_DATA].len <
+                   priv->tx_stats[i + P54_QUEUE_DATA].limit)
                        ieee80211_wake_queue(dev, i);
 }
 
@@ -663,7 +802,7 @@ void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb)
 {
        struct p54_common *priv = dev->priv;
        struct ieee80211_tx_info *info;
-       struct memrecord *range;
+       struct p54_tx_info *range;
        unsigned long flags;
        u32 freed = 0, last_addr = priv->rx_start;
 
@@ -681,18 +820,18 @@ void p54_free_skb(struct ieee80211_hw *dev, struct sk_buff *skb)
        range = (void *)info->rate_driver_data;
        if (skb->prev != (struct sk_buff *)&priv->tx_queue) {
                struct ieee80211_tx_info *ni;
-               struct memrecord *mr;
+               struct p54_tx_info *mr;
 
                ni = IEEE80211_SKB_CB(skb->prev);
-               mr = (struct memrecord *)ni->rate_driver_data;
+               mr = (struct p54_tx_info *)ni->rate_driver_data;
                last_addr = mr->end_addr;
        }
        if (skb->next != (struct sk_buff *)&priv->tx_queue) {
                struct ieee80211_tx_info *ni;
-               struct memrecord *mr;
+               struct p54_tx_info *mr;
 
                ni = IEEE80211_SKB_CB(skb->next);
-               mr = (struct memrecord *)ni->rate_driver_data;
+               mr = (struct p54_tx_info *)ni->rate_driver_data;
                freed = mr->start_addr - last_addr;
        } else
                freed = priv->rx_end - last_addr;
@@ -734,7 +873,7 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
        struct p54_frame_sent *payload = (struct p54_frame_sent *) hdr->data;
        struct sk_buff *entry = (struct sk_buff *) priv->tx_queue.next;
        u32 addr = le32_to_cpu(hdr->req_id) - priv->headroom;
-       struct memrecord *range = NULL;
+       struct p54_tx_info *range = NULL;
        u32 freed = 0;
        u32 last_addr = priv->rx_start;
        unsigned long flags;
@@ -756,10 +895,10 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
 
                if (entry->next != (struct sk_buff *)&priv->tx_queue) {
                        struct ieee80211_tx_info *ni;
-                       struct memrecord *mr;
+                       struct p54_tx_info *mr;
 
                        ni = IEEE80211_SKB_CB(entry->next);
-                       mr = (struct memrecord *)ni->rate_driver_data;
+                       mr = (struct p54_tx_info *)ni->rate_driver_data;
                        freed = mr->start_addr - last_addr;
                } else
                        freed = priv->rx_end - last_addr;
@@ -774,9 +913,16 @@ static void p54_rx_frame_sent(struct ieee80211_hw *dev, struct sk_buff *skb)
                priv->tx_stats[entry_data->hw_queue].len--;
                priv->stats.dot11ACKFailureCount += payload->tries - 1;
 
-               if (unlikely(entry == priv->cached_beacon)) {
+               /*
+                * Frames in P54_QUEUE_FWSCAN and P54_QUEUE_BEACON are
+                * generated by the driver. Therefore tx_status is bogus
+                * and we don't want to confuse the mac80211 stack.
+                */
+               if (unlikely(entry_data->hw_queue < P54_QUEUE_FWSCAN)) {
+                       if (entry_data->hw_queue == P54_QUEUE_BEACON)
+                               priv->cached_beacon = NULL;
+
                        kfree_skb(entry);
-                       priv->cached_beacon = NULL;
                        goto out;
                }
 
@@ -969,8 +1115,8 @@ EXPORT_SYMBOL_GPL(p54_rx);
  * can find some unused memory to upload our packets to. However, data that we
  * want the card to TX needs to stay intact until the card has told us that
  * it is done with it. This function finds empty places we can upload to and
- * marks allocated areas as reserved if necessary. p54_rx_frame_sent frees
- * allocated areas.
+ * marks allocated areas as reserved if necessary. p54_rx_frame_sent or
+ * p54_free_skb frees allocated areas.
  */
 static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
                               struct p54_hdr *data, u32 len)
@@ -979,7 +1125,7 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
        struct sk_buff *entry = priv->tx_queue.next;
        struct sk_buff *target_skb = NULL;
        struct ieee80211_tx_info *info;
-       struct memrecord *range;
+       struct p54_tx_info *range;
        u32 last_addr = priv->rx_start;
        u32 largest_hole = 0;
        u32 target_addr = priv->rx_start;
@@ -1060,25 +1206,29 @@ static int p54_assign_address(struct ieee80211_hw *dev, struct sk_buff *skb,
        return 0;
 }
 
-static struct sk_buff *p54_alloc_skb(struct ieee80211_hw *dev,
-               u16 hdr_flags, u16 len, u16 type, gfp_t memflags)
+static struct sk_buff *p54_alloc_skb(struct ieee80211_hw *dev, u16 hdr_flags,
+                                    u16 payload_len, u16 type, gfp_t memflags)
 {
        struct p54_common *priv = dev->priv;
        struct p54_hdr *hdr;
        struct sk_buff *skb;
+       size_t frame_len = sizeof(*hdr) + payload_len;
+
+       if (frame_len > P54_MAX_CTRL_FRAME_LEN)
+               return NULL;
 
-       skb = __dev_alloc_skb(len + priv->tx_hdr_len, memflags);
+       skb = __dev_alloc_skb(priv->tx_hdr_len + frame_len, memflags);
        if (!skb)
                return NULL;
        skb_reserve(skb, priv->tx_hdr_len);
 
        hdr = (struct p54_hdr *) skb_put(skb, sizeof(*hdr));
        hdr->flags = cpu_to_le16(hdr_flags);
-       hdr->len = cpu_to_le16(len - sizeof(*hdr));
+       hdr->len = cpu_to_le16(payload_len);
        hdr->type = cpu_to_le16(type);
        hdr->tries = hdr->rts_tries = 0;
 
-       if (unlikely(p54_assign_address(dev, skb, hdr, len))) {
+       if (p54_assign_address(dev, skb, hdr, frame_len)) {
                kfree_skb(skb);
                return NULL;
        }
@@ -1088,7 +1238,6 @@ static struct sk_buff *p54_alloc_skb(struct ieee80211_hw *dev,
 int p54_read_eeprom(struct ieee80211_hw *dev)
 {
        struct p54_common *priv = dev->priv;
-       struct p54_hdr *hdr = NULL;
        struct p54_eeprom_lm86 *eeprom_hdr;
        struct sk_buff *skb;
        size_t eeprom_size = 0x2020, offset = 0, blocksize, maxblocksize;
@@ -1101,9 +1250,9 @@ int p54_read_eeprom(struct ieee80211_hw *dev)
        else
                maxblocksize -= 0x4;
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL, sizeof(*hdr) +
-                           sizeof(*eeprom_hdr) + maxblocksize,
-                           P54_CONTROL_TYPE_EEPROM_READBACK, GFP_KERNEL);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL, sizeof(*eeprom_hdr) +
+                           maxblocksize, P54_CONTROL_TYPE_EEPROM_READBACK,
+                           GFP_KERNEL);
        if (!skb)
                goto free;
        priv->eeprom = kzalloc(EEPROM_READBACK_LEN, GFP_KERNEL);
@@ -1159,9 +1308,8 @@ static int p54_set_tim(struct ieee80211_hw *dev, struct ieee80211_sta *sta,
        struct sk_buff *skb;
        struct p54_tim *tim;
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET,
-                     sizeof(struct p54_hdr) + sizeof(*tim),
-                     P54_CONTROL_TYPE_TIM, GFP_ATOMIC);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*tim),
+                           P54_CONTROL_TYPE_TIM, GFP_ATOMIC);
        if (!skb)
                return -ENOMEM;
 
@@ -1178,9 +1326,8 @@ static int p54_sta_unlock(struct ieee80211_hw *dev, u8 *addr)
        struct sk_buff *skb;
        struct p54_sta_unlock *sta;
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET,
-               sizeof(struct p54_hdr) + sizeof(*sta),
-               P54_CONTROL_TYPE_PSM_STA_UNLOCK, GFP_ATOMIC);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*sta),
+                           P54_CONTROL_TYPE_PSM_STA_UNLOCK, GFP_ATOMIC);
        if (!skb)
                return -ENOMEM;
 
@@ -1220,9 +1367,8 @@ static int p54_tx_cancel(struct ieee80211_hw *dev, struct sk_buff *entry)
        struct p54_hdr *hdr;
        struct p54_txcancel *cancel;
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET,
-               sizeof(struct p54_hdr) + sizeof(*cancel),
-               P54_CONTROL_TYPE_TXCANCEL, GFP_ATOMIC);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*cancel),
+                           P54_CONTROL_TYPE_TXCANCEL, GFP_ATOMIC);
        if (!skb)
                return -ENOMEM;
 
@@ -1239,46 +1385,73 @@ static int p54_tx_fill(struct ieee80211_hw *dev, struct sk_buff *skb,
 {
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
        struct p54_common *priv = dev->priv;
-       int ret = 0;
-
-       if (unlikely(ieee80211_is_mgmt(hdr->frame_control))) {
-               if (ieee80211_is_beacon(hdr->frame_control)) {
-                       *aid = 0;
-                       *queue = 0;
-                       *extra_len = IEEE80211_MAX_TIM_LEN;
-                       *flags = P54_HDR_FLAG_DATA_OUT_TIMESTAMP;
-                       return 0;
-               } else if (ieee80211_is_probe_resp(hdr->frame_control)) {
-                       *aid = 0;
-                       *queue = 2;
-                       *flags = P54_HDR_FLAG_DATA_OUT_TIMESTAMP |
-                                P54_HDR_FLAG_DATA_OUT_NOCANCEL;
-                       return 0;
-               } else {
-                       *queue = 2;
-                       ret = 0;
-               }
-       } else {
-               *queue += 4;
-               ret = 1;
-       }
+       int ret = 1;
 
        switch (priv->mode) {
+       case NL80211_IFTYPE_MONITOR:
+               /*
+                * We have to set P54_HDR_FLAG_DATA_OUT_PROMISC for
+                * every frame in promiscuous/monitor mode.
+                * see STSW45x0C LMAC API - page 12.
+                */
+               *aid = 0;
+               *flags = P54_HDR_FLAG_DATA_OUT_PROMISC;
+               *queue += P54_QUEUE_DATA;
+               break;
        case NL80211_IFTYPE_STATION:
                *aid = 1;
+               if (unlikely(ieee80211_is_mgmt(hdr->frame_control))) {
+                       *queue = P54_QUEUE_MGMT;
+                       ret = 0;
+               } else
+                       *queue += P54_QUEUE_DATA;
                break;
        case NL80211_IFTYPE_AP:
        case NL80211_IFTYPE_ADHOC:
        case NL80211_IFTYPE_MESH_POINT:
                if (info->flags & IEEE80211_TX_CTL_SEND_AFTER_DTIM) {
                        *aid = 0;
-                       *queue = 3;
+                       *queue = P54_QUEUE_CAB;
                        return 0;
                }
+
+               if (unlikely(ieee80211_is_mgmt(hdr->frame_control))) {
+                       if (ieee80211_is_probe_resp(hdr->frame_control)) {
+                               *aid = 0;
+                               *queue = P54_QUEUE_MGMT;
+                               *flags = P54_HDR_FLAG_DATA_OUT_TIMESTAMP |
+                                        P54_HDR_FLAG_DATA_OUT_NOCANCEL;
+                               return 0;
+                       } else if (ieee80211_is_beacon(hdr->frame_control)) {
+                               *aid = 0;
+
+                               if (info->flags & IEEE80211_TX_CTL_INJECTED) {
+                                       /*
+                                        * Injecting beacons on top of a AP is
+                                        * not a good idea... nevertheless,
+                                        * it should be doable.
+                                        */
+
+                                       *queue += P54_QUEUE_DATA;
+                                       return 1;
+                               }
+
+                               *flags = P54_HDR_FLAG_DATA_OUT_TIMESTAMP;
+                               *queue = P54_QUEUE_BEACON;
+                               *extra_len = IEEE80211_MAX_TIM_LEN;
+                               return 0;
+                       } else {
+                               *queue = P54_QUEUE_MGMT;
+                               ret = 0;
+                       }
+               } else
+                       *queue += P54_QUEUE_DATA;
+
                if (info->control.sta)
                        *aid = info->control.sta->aid;
                else
                        *flags |= P54_HDR_FLAG_DATA_OUT_NOCANCEL;
+               break;
        }
        return ret;
 }
@@ -1300,7 +1473,7 @@ static u8 p54_convert_algo(enum ieee80211_key_alg alg)
 static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
 {
        struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       struct ieee80211_tx_queue_stats *current_queue = NULL;
+       struct ieee80211_tx_queue_stats *current_queue;
        struct p54_common *priv = dev->priv;
        struct p54_hdr *hdr;
        struct p54_tx_data *txhdr;
@@ -1443,15 +1616,17 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
        }
        txhdr->crypt_offset = crypt_offset;
        txhdr->hw_queue = queue;
-       if (current_queue)
-               txhdr->backlog = current_queue->len;
-       else
-               txhdr->backlog = 0;
+       txhdr->backlog = current_queue->len;
        memset(txhdr->durations, 0, sizeof(txhdr->durations));
-       txhdr->tx_antenna = (info->antenna_sel_tx == 0) ?
-               2 : info->antenna_sel_tx - 1;
-       txhdr->output_power = priv->output_power;
-       txhdr->cts_rate = cts_rate;
+       txhdr->tx_antenna = ((info->antenna_sel_tx == 0) ?
+               2 : info->antenna_sel_tx - 1) & priv->tx_diversity_mask;
+       if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) {
+               txhdr->longbow.cts_rate = cts_rate;
+               txhdr->longbow.output_power = cpu_to_le16(priv->output_power);
+       } else {
+               txhdr->normal.output_power = priv->output_power;
+               txhdr->normal.cts_rate = cts_rate;
+       }
        if (padding)
                txhdr->align[0] = padding;
 
@@ -1464,14 +1639,12 @@ static int p54_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
        queue_delayed_work(dev->workqueue, &priv->work,
                           msecs_to_jiffies(P54_TX_FRAME_LIFETIME));
 
-       return 0;
+       return NETDEV_TX_OK;
 
  err:
        skb_pull(skb, sizeof(*hdr) + sizeof(*txhdr) + padding);
-       if (current_queue) {
-               current_queue->len--;
-               current_queue->count--;
-       }
+       current_queue->len--;
+       current_queue->count--;
        return NETDEV_TX_BUSY;
 }
 
@@ -1482,9 +1655,8 @@ static int p54_setup_mac(struct ieee80211_hw *dev)
        struct p54_setup_mac *setup;
        u16 mode;
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*setup) +
-                           sizeof(struct p54_hdr), P54_CONTROL_TYPE_SETUP,
-                           GFP_ATOMIC);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*setup),
+                           P54_CONTROL_TYPE_SETUP, GFP_ATOMIC);
        if (!skb)
                return -ENOMEM;
 
@@ -1501,11 +1673,21 @@ static int p54_setup_mac(struct ieee80211_hw *dev)
                case NL80211_IFTYPE_MESH_POINT:
                        mode = P54_FILTER_TYPE_IBSS;
                        break;
+               case NL80211_IFTYPE_MONITOR:
+                       mode = P54_FILTER_TYPE_PROMISCUOUS;
+                       break;
                default:
                        mode = P54_FILTER_TYPE_NONE;
                        break;
                }
-               if (priv->filter_flags & FIF_PROMISC_IN_BSS)
+
+               /*
+                * "TRANSPARENT and PROMISCUOUS are mutually exclusive"
+                * STSW45X0C LMAC API - page 12
+                */
+               if (((priv->filter_flags & FIF_PROMISC_IN_BSS) ||
+                    (priv->filter_flags & FIF_OTHER_BSS)) &&
+                   (mode != P54_FILTER_TYPE_PROMISCUOUS))
                        mode |= P54_FILTER_TYPE_TRANSPARENT;
        } else
                mode = P54_FILTER_TYPE_RX_DISABLED;
@@ -1513,7 +1695,7 @@ static int p54_setup_mac(struct ieee80211_hw *dev)
        setup->mac_mode = cpu_to_le16(mode);
        memcpy(setup->mac_addr, priv->mac_addr, ETH_ALEN);
        memcpy(setup->bssid, priv->bssid, ETH_ALEN);
-       setup->rx_antenna = 2; /* automatic */
+       setup->rx_antenna = 2 & priv->rx_diversity_mask; /* automatic */
        setup->rx_align = 0;
        if (priv->fw_var < 0x500) {
                setup->v1.basic_rate_mask = cpu_to_le32(priv->basic_rate_mask);
@@ -1546,79 +1728,137 @@ static int p54_scan(struct ieee80211_hw *dev, u16 mode, u16 dwell)
 {
        struct p54_common *priv = dev->priv;
        struct sk_buff *skb;
-       struct p54_scan *chan;
+       struct p54_hdr *hdr;
+       struct p54_scan_head *head;
+       struct p54_iq_autocal_entry *iq_autocal;
+       union p54_scan_body_union *body;
+       struct p54_scan_tail_rate *rate;
+       struct pda_rssi_cal_entry *rssi;
        unsigned int i;
        void *entry;
-       __le16 freq = cpu_to_le16(dev->conf.channel->center_freq);
        int band = dev->conf.channel->band;
+       __le16 freq = cpu_to_le16(dev->conf.channel->center_freq);
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*chan) +
-                           sizeof(struct p54_hdr), P54_CONTROL_TYPE_SCAN,
-                           GFP_ATOMIC);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*head) +
+                           2 + sizeof(*iq_autocal) + sizeof(*body) +
+                           sizeof(*rate) + 2 * sizeof(*rssi),
+                           P54_CONTROL_TYPE_SCAN, GFP_ATOMIC);
        if (!skb)
                return -ENOMEM;
 
-       chan = (struct p54_scan *) skb_put(skb, sizeof(*chan));
-       memset(chan->padding1, 0, sizeof(chan->padding1));
-       chan->mode = cpu_to_le16(mode);
-       chan->dwell = cpu_to_le16(dwell);
+       head = (struct p54_scan_head *) skb_put(skb, sizeof(*head));
+       memset(head->scan_params, 0, sizeof(head->scan_params));
+       head->mode = cpu_to_le16(mode);
+       head->dwell = cpu_to_le16(dwell);
+       head->freq = freq;
+
+       if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) {
+               __le16 *pa_power_points = (__le16 *) skb_put(skb, 2);
+               *pa_power_points = cpu_to_le16(0x0c);
+       }
 
+       iq_autocal = (void *) skb_put(skb, sizeof(*iq_autocal));
        for (i = 0; i < priv->iq_autocal_len; i++) {
                if (priv->iq_autocal[i].freq != freq)
                        continue;
 
-               memcpy(&chan->iq_autocal, &priv->iq_autocal[i],
-                      sizeof(*priv->iq_autocal));
+               memcpy(iq_autocal, &priv->iq_autocal[i].params,
+                      sizeof(struct p54_iq_autocal_entry));
                break;
        }
        if (i == priv->iq_autocal_len)
                goto err;
 
-       for (i = 0; i < priv->output_limit_len; i++) {
-               if (priv->output_limit[i].freq != freq)
+       if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW)
+               body = (void *) skb_put(skb, sizeof(body->longbow));
+       else
+               body = (void *) skb_put(skb, sizeof(body->normal));
+
+       for (i = 0; i < priv->output_limit->entries; i++) {
+               __le16 *entry_freq = (void *) (priv->output_limit->data +
+                                    priv->output_limit->entry_size * i);
+
+               if (*entry_freq != freq)
                        continue;
 
-               chan->val_barker = 0x38;
-               chan->val_bpsk = chan->dup_bpsk =
-                       priv->output_limit[i].val_bpsk;
-               chan->val_qpsk = chan->dup_qpsk =
-                       priv->output_limit[i].val_qpsk;
-               chan->val_16qam = chan->dup_16qam =
-                       priv->output_limit[i].val_16qam;
-               chan->val_64qam = chan->dup_64qam =
-                       priv->output_limit[i].val_64qam;
+               if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) {
+                       memcpy(&body->longbow.power_limits,
+                              (void *) entry_freq + sizeof(__le16),
+                              priv->output_limit->entry_size);
+               } else {
+                       struct pda_channel_output_limit *limits =
+                              (void *) entry_freq;
+
+                       body->normal.val_barker = 0x38;
+                       body->normal.val_bpsk = body->normal.dup_bpsk =
+                               limits->val_bpsk;
+                       body->normal.val_qpsk = body->normal.dup_qpsk =
+                               limits->val_qpsk;
+                       body->normal.val_16qam = body->normal.dup_16qam =
+                               limits->val_16qam;
+                       body->normal.val_64qam = body->normal.dup_64qam =
+                               limits->val_64qam;
+               }
                break;
        }
-       if (i == priv->output_limit_len)
+       if (i == priv->output_limit->entries)
                goto err;
 
-       entry = priv->curve_data->data;
-       for (i = 0; i < priv->curve_data->channels; i++) {
+       entry = (void *)(priv->curve_data->data + priv->curve_data->offset);
+       for (i = 0; i < priv->curve_data->entries; i++) {
                if (*((__le16 *)entry) != freq) {
-                       entry += sizeof(__le16);
-                       entry += sizeof(struct p54_pa_curve_data_sample) *
-                                priv->curve_data->points_per_channel;
+                       entry += priv->curve_data->entry_size;
                        continue;
                }
 
-               entry += sizeof(__le16);
-               chan->pa_points_per_curve = 8;
-               memset(chan->curve_data, 0, sizeof(*chan->curve_data));
-               memcpy(chan->curve_data, entry,
-                      sizeof(struct p54_pa_curve_data_sample) *
-                      min((u8)8, priv->curve_data->points_per_channel));
+               if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) {
+                       memcpy(&body->longbow.curve_data,
+                               (void *) entry + sizeof(__le16),
+                               priv->curve_data->entry_size);
+               } else {
+                       struct p54_scan_body *chan = &body->normal;
+                       struct pda_pa_curve_data *curve_data =
+                               (void *) priv->curve_data->data;
+
+                       entry += sizeof(__le16);
+                       chan->pa_points_per_curve = 8;
+                       memset(chan->curve_data, 0, sizeof(*chan->curve_data));
+                       memcpy(chan->curve_data, entry,
+                              sizeof(struct p54_pa_curve_data_sample) *
+                              min((u8)8, curve_data->points_per_channel));
+               }
                break;
        }
+       if (i == priv->curve_data->entries)
+               goto err;
 
-       if (priv->fw_var < 0x500) {
-               chan->v1_rssi.mul = cpu_to_le16(priv->rssical_db[band].mul);
-               chan->v1_rssi.add = cpu_to_le16(priv->rssical_db[band].add);
-       } else {
-               chan->v2.rssi.mul = cpu_to_le16(priv->rssical_db[band].mul);
-               chan->v2.rssi.add = cpu_to_le16(priv->rssical_db[band].add);
-               chan->v2.basic_rate_mask = cpu_to_le32(priv->basic_rate_mask);
-               memset(chan->v2.rts_rates, 0, 8);
+       if ((priv->fw_var >= 0x500) && (priv->fw_var < 0x509)) {
+               rate = (void *) skb_put(skb, sizeof(*rate));
+               rate->basic_rate_mask = cpu_to_le32(priv->basic_rate_mask);
+               for (i = 0; i < sizeof(rate->rts_rates); i++)
+                       rate->rts_rates[i] = i;
        }
+
+       rssi = (struct pda_rssi_cal_entry *) skb_put(skb, sizeof(*rssi));
+       rssi->mul = cpu_to_le16(priv->rssical_db[band].mul);
+       rssi->add = cpu_to_le16(priv->rssical_db[band].add);
+       if (priv->rxhw == PDR_SYNTH_FRONTEND_LONGBOW) {
+               /* Longbow frontend needs ever more */
+               rssi = (void *) skb_put(skb, sizeof(*rssi));
+               rssi->mul = cpu_to_le16(priv->rssical_db[band].longbow_unkn);
+               rssi->add = cpu_to_le16(priv->rssical_db[band].longbow_unk2);
+       }
+
+       if (priv->fw_var >= 0x509) {
+               rate = (void *) skb_put(skb, sizeof(*rate));
+               rate->basic_rate_mask = cpu_to_le32(priv->basic_rate_mask);
+               for (i = 0; i < sizeof(rate->rts_rates); i++)
+                       rate->rts_rates[i] = i;
+       }
+
+       hdr = (struct p54_hdr *) skb->data;
+       hdr->len = cpu_to_le16(skb->len - sizeof(*hdr));
+
        priv->tx(dev, skb);
        return 0;
 
@@ -1634,9 +1874,8 @@ static int p54_set_leds(struct ieee80211_hw *dev, int mode, int link, int act)
        struct sk_buff *skb;
        struct p54_led *led;
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*led) +
-                       sizeof(struct p54_hdr), P54_CONTROL_TYPE_LED,
-                       GFP_ATOMIC);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*led),
+                           P54_CONTROL_TYPE_LED, GFP_ATOMIC);
        if (!skb)
                return -ENOMEM;
 
@@ -1663,9 +1902,8 @@ static int p54_set_edcf(struct ieee80211_hw *dev)
        struct sk_buff *skb;
        struct p54_edcf *edcf;
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*edcf) +
-                       sizeof(struct p54_hdr), P54_CONTROL_TYPE_DCFINIT,
-                       GFP_ATOMIC);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*edcf),
+                           P54_CONTROL_TYPE_DCFINIT, GFP_ATOMIC);
        if (!skb)
                return -ENOMEM;
 
@@ -1689,6 +1927,42 @@ static int p54_set_edcf(struct ieee80211_hw *dev)
        return 0;
 }
 
+static int p54_set_ps(struct ieee80211_hw *dev)
+{
+       struct p54_common *priv = dev->priv;
+       struct sk_buff *skb;
+       struct p54_psm *psm;
+       u16 mode;
+       int i;
+
+       if (dev->conf.flags & IEEE80211_CONF_PS)
+               mode = P54_PSM | P54_PSM_DTIM | P54_PSM_MCBC;
+       else
+               mode = P54_PSM_CAM;
+
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*psm),
+                           P54_CONTROL_TYPE_PSM, GFP_ATOMIC);
+       if (!skb)
+               return -ENOMEM;
+
+       psm = (struct p54_psm *)skb_put(skb, sizeof(*psm));
+       psm->mode = cpu_to_le16(mode);
+       psm->aid = cpu_to_le16(priv->aid);
+       for (i = 0; i < ARRAY_SIZE(psm->intervals); i++) {
+               psm->intervals[i].interval =
+                       cpu_to_le16(dev->conf.listen_interval);
+               psm->intervals[i].periods = cpu_to_le16(1);
+       }
+
+       psm->beacon_rssi_skip_max = 60;
+       psm->rssi_delta_threshold = 0;
+       psm->nr = 0;
+
+       priv->tx(dev, skb);
+
+       return 0;
+}
+
 static int p54_beacon_tim(struct sk_buff *skb)
 {
        /*
@@ -1881,6 +2155,11 @@ static int p54_config(struct ieee80211_hw *dev, u32 changed)
                if (ret)
                        goto out;
        }
+       if (changed & IEEE80211_CONF_CHANGE_PS) {
+               ret = p54_set_ps(dev);
+               if (ret)
+                       goto out;
+       }
 
 out:
        mutex_unlock(&priv->conf_mutex);
@@ -1932,12 +2211,13 @@ static void p54_configure_filter(struct ieee80211_hw *dev,
        struct p54_common *priv = dev->priv;
 
        *total_flags &= FIF_PROMISC_IN_BSS |
+                       FIF_OTHER_BSS |
                        (*total_flags & FIF_PROMISC_IN_BSS) ?
                                FIF_FCSFAIL : 0;
 
        priv->filter_flags = *total_flags;
 
-       if (changed_flags & FIF_PROMISC_IN_BSS)
+       if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS))
                p54_setup_mac(dev);
 }
 
@@ -1964,10 +2244,8 @@ static int p54_init_xbow_synth(struct ieee80211_hw *dev)
        struct sk_buff *skb;
        struct p54_xbow_synth *xbow;
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*xbow) +
-                           sizeof(struct p54_hdr),
-                           P54_CONTROL_TYPE_XBOW_SYNTH_CFG,
-                           GFP_KERNEL);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*xbow),
+                           P54_CONTROL_TYPE_XBOW_SYNTH_CFG, GFP_KERNEL);
        if (!skb)
                return -ENOMEM;
 
@@ -1996,7 +2274,7 @@ static void p54_work(struct work_struct *work)
         *      2. cancel stuck frames / reset the device if necessary.
         */
 
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL, sizeof(struct p54_hdr) +
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL,
                            sizeof(struct p54_statistics),
                            P54_CONTROL_TYPE_STAT_READBACK, GFP_KERNEL);
        if (!skb)
@@ -2019,8 +2297,8 @@ static int p54_get_tx_stats(struct ieee80211_hw *dev,
 {
        struct p54_common *priv = dev->priv;
 
-       memcpy(stats, &priv->tx_stats[4], sizeof(stats[0]) * dev->queues);
-
+       memcpy(stats, &priv->tx_stats[P54_QUEUE_DATA],
+              sizeof(stats[0]) * dev->queues);
        return 0;
 }
 
@@ -2056,7 +2334,7 @@ static void p54_bss_info_changed(struct ieee80211_hw *dev,
 }
 
 static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
-                      const u8 *local_address, const u8 *address,
+                      struct ieee80211_vif *vif, struct ieee80211_sta *sta,
                       struct ieee80211_key_conf *key)
 {
        struct p54_common *priv = dev->priv;
@@ -2107,9 +2385,8 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
        }
 
        mutex_lock(&priv->conf_mutex);
-       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*rxkey) +
-                       sizeof(struct p54_hdr), P54_CONTROL_TYPE_RX_KEYCACHE,
-                       GFP_ATOMIC);
+       skb = p54_alloc_skb(dev, P54_HDR_FLAG_CONTROL_OPSET, sizeof(*rxkey),
+                           P54_CONTROL_TYPE_RX_KEYCACHE, GFP_ATOMIC);
        if (!skb) {
                mutex_unlock(&priv->conf_mutex);
                return -ENOMEM;
@@ -2120,8 +2397,8 @@ static int p54_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,
        rxkey->entry = key->keyidx;
        rxkey->key_id = key->keyidx;
        rxkey->key_type = algo;
-       if (address)
-               memcpy(rxkey->mac, address, ETH_ALEN);
+       if (sta)
+               memcpy(rxkey->mac, sta->addr, ETH_ALEN);
        else
                memset(rxkey->mac, ~0, ETH_ALEN);
        if (key->alg != ALG_TKIP) {
@@ -2181,11 +2458,11 @@ struct ieee80211_hw *p54_init_common(size_t priv_data_len)
                                      BIT(NL80211_IFTYPE_MESH_POINT);
 
        dev->channel_change_time = 1000;        /* TODO: find actual value */
-       priv->tx_stats[0].limit = 1;            /* Beacon queue */
-       priv->tx_stats[1].limit = 1;            /* Probe queue for HW scan */
-       priv->tx_stats[2].limit = 3;            /* queue for MLMEs */
-       priv->tx_stats[3].limit = 3;            /* Broadcast / MC queue */
-       priv->tx_stats[4].limit = 5;            /* Data */
+       priv->tx_stats[P54_QUEUE_BEACON].limit = 1;
+       priv->tx_stats[P54_QUEUE_FWSCAN].limit = 1;
+       priv->tx_stats[P54_QUEUE_MGMT].limit = 3;
+       priv->tx_stats[P54_QUEUE_CAB].limit = 3;
+       priv->tx_stats[P54_QUEUE_DATA].limit = 5;
        dev->queues = 1;
        priv->noise = -94;
        /*
index f5729de83fe118eaeb36ea55c9f9cecdacd2c40b..def23b1f49ec4c261b40ca0fac5fde6053e775ca 100644 (file)
@@ -26,12 +26,17 @@ struct bootrec {
 } __attribute__((packed));
 
 #define PDR_SYNTH_FRONTEND_MASK                0x0007
+#define PDR_SYNTH_FRONTEND_DUETTE3     0x0001
+#define PDR_SYNTH_FRONTEND_DUETTE2     0x0002
+#define PDR_SYNTH_FRONTEND_FRISBEE     0x0003
+#define PDR_SYNTH_FRONTEND_XBOW                0x0004
+#define PDR_SYNTH_FRONTEND_LONGBOW     0x0005
 #define PDR_SYNTH_IQ_CAL_MASK          0x0018
 #define PDR_SYNTH_IQ_CAL_PA_DETECTOR   0x0000
 #define PDR_SYNTH_IQ_CAL_DISABLED      0x0008
 #define PDR_SYNTH_IQ_CAL_ZIF           0x0010
 #define PDR_SYNTH_FAA_SWITCH_MASK      0x0020
-#define PDR_SYNTH_FAA_SWITCH_ENABLED   0x0001
+#define PDR_SYNTH_FAA_SWITCH_ENABLED   0x0020
 #define PDR_SYNTH_24_GHZ_MASK          0x0040
 #define PDR_SYNTH_24_GHZ_DISABLED      0x0040
 #define PDR_SYNTH_5_GHZ_MASK           0x0080
@@ -125,9 +130,13 @@ struct eeprom_pda_wrap {
        u8 data[0];
 } __attribute__ ((packed));
 
+struct p54_iq_autocal_entry {
+       __le16 iq_param[4];
+} __attribute__ ((packed));
+
 struct pda_iq_autocal_entry {
         __le16 freq;
-        __le16 iq_param[4];
+       struct p54_iq_autocal_entry params;
 } __attribute__ ((packed));
 
 struct pda_channel_output_limit {
@@ -180,6 +189,35 @@ struct pda_rssi_cal_entry {
        __le16 add;
 } __attribute__ ((packed));
 
+struct pda_country {
+       u8 regdomain;
+       u8 alpha2[2];
+       u8 flags;
+} __attribute__ ((packed));
+
+/*
+ * Warning: Longbow's structures are bogus.
+ */
+struct p54_channel_output_limit_longbow {
+       __le16 rf_power_points[12];
+} __attribute__ ((packed));
+
+struct p54_pa_curve_data_sample_longbow {
+       __le16 rf_power;
+       __le16 pa_detector;
+       struct {
+               __le16 data[4];
+       } points[3] __attribute__ ((packed));
+} __attribute__ ((packed));
+
+struct pda_custom_wrapper {
+       __le16 entries;
+       __le16 entry_size;
+       __le16 offset;
+       __le16 len;
+       u8 data[0];
+} __attribute__ ((packed));
+
 /*
  * this defines the PDR codes used to build PDAs as defined in document
  * number 553155. The current implementation mirrors version 1.1 of the
@@ -225,8 +263,13 @@ struct pda_rssi_cal_entry {
 /* reserved range (0x2000 - 0x7fff) */
 
 /* customer range (0x8000 - 0xffff) */
-#define PDR_BASEBAND_REGISTERS                 0x8000
-#define PDR_PER_CHANNEL_BASEBAND_REGISTERS     0x8001
+#define PDR_BASEBAND_REGISTERS                         0x8000
+#define PDR_PER_CHANNEL_BASEBAND_REGISTERS             0x8001
+
+/* used by our modificated eeprom image */
+#define PDR_RSSI_LINEAR_APPROXIMATION_CUSTOM           0xDEAD
+#define PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS_CUSTOM    0xBEEF
+#define PDR_PRISM_PA_CAL_CURVE_DATA_CUSTOM             0xB05D
 
 /* PDR definitions for default country & country list */
 #define PDR_COUNTRY_CERT_CODE          0x80
@@ -241,12 +284,6 @@ struct pda_rssi_cal_entry {
 #define PDR_COUNTRY_CERT_IODOOR_OUTDOOR        0x30
 #define PDR_COUNTRY_CERT_INDEX         0x0F
 
-/* stored in skb->cb */
-struct memrecord {
-       u32 start_addr;
-       u32 end_addr;
-};
-
 struct p54_eeprom_lm86 {
        union {
                struct {
@@ -329,7 +366,7 @@ struct p54_frame_sent {
        u8 padding;
 } __attribute__ ((packed));
 
-enum  p54_tx_data_crypt {
+enum p54_tx_data_crypt {
        P54_CRYPTO_NONE = 0,
        P54_CRYPTO_WEP,
        P54_CRYPTO_TKIP,
@@ -340,6 +377,23 @@ enum  p54_tx_data_crypt {
        P54_CRYPTO_AESCCMP
 };
 
+enum p54_tx_data_queue {
+       P54_QUEUE_BEACON        = 0,
+       P54_QUEUE_FWSCAN        = 1,
+       P54_QUEUE_MGMT          = 2,
+       P54_QUEUE_CAB           = 3,
+       P54_QUEUE_DATA          = 4,
+
+       P54_QUEUE_AC_NUM        = 4,
+       P54_QUEUE_AC_VO         = 4,
+       P54_QUEUE_AC_VI         = 5,
+       P54_QUEUE_AC_BE         = 6,
+       P54_QUEUE_AC_BK         = 7,
+
+       /* keep last */
+       P54_QUEUE_NUM           = 8,
+};
+
 struct p54_tx_data {
        u8 rateset[8];
        u8 rts_rate_idx;
@@ -351,9 +405,18 @@ struct p54_tx_data {
        u8 backlog;
        __le16 durations[4];
        u8 tx_antenna;
-       u8 output_power;
-       u8 cts_rate;
-       u8 unalloc2[3];
+       union {
+               struct {
+                       u8 cts_rate;
+                       __le16 output_power;
+               } __attribute__((packed)) longbow;
+               struct {
+                       u8 output_power;
+                       u8 cts_rate;
+                       u8 unalloc;
+               } __attribute__ ((packed)) normal;
+       } __attribute__ ((packed));
+       u8 unalloc2[2];
        u8 align[0];
 } __attribute__ ((packed));
 
@@ -414,11 +477,14 @@ struct p54_setup_mac {
 #define P54_SCAN_ACTIVE BIT(2)
 #define P54_SCAN_FILTER BIT(3)
 
-struct p54_scan {
+struct p54_scan_head {
        __le16 mode;
        __le16 dwell;
-       u8 padding1[20];
-       struct pda_iq_autocal_entry iq_autocal;
+       u8 scan_params[20];
+       __le16 freq;
+} __attribute__ ((packed));
+
+struct p54_scan_body {
        u8 pa_points_per_curve;
        u8 val_barker;
        u8 val_bpsk;
@@ -430,19 +496,23 @@ struct p54_scan {
        u8 dup_qpsk;
        u8 dup_16qam;
        u8 dup_64qam;
-       union {
-               struct pda_rssi_cal_entry v1_rssi;
+} __attribute__ ((packed));
 
-               struct {
-                       __le32 basic_rate_mask;
-                       u8 rts_rates[8];
-                       struct pda_rssi_cal_entry rssi;
-               } v2 __attribute__ ((packed));
-       } __attribute__ ((packed));
+struct p54_scan_body_longbow {
+       struct p54_channel_output_limit_longbow power_limits;
+       struct p54_pa_curve_data_sample_longbow curve_data[8];
+       __le16 unkn[6];         /* maybe more power_limits or rate_mask */
+} __attribute__ ((packed));
+
+union p54_scan_body_union {
+       struct p54_scan_body normal;
+       struct p54_scan_body_longbow longbow;
 } __attribute__ ((packed));
 
-#define P54_SCAN_V1_LEN 0x70
-#define P54_SCAN_V2_LEN 0x7c
+struct p54_scan_tail_rate {
+       __le32 basic_rate_mask;
+       u8 rts_rates[8];
+} __attribute__ ((packed));
 
 struct p54_led {
        __le16 mode;
@@ -511,6 +581,7 @@ struct p54_psm_interval {
        __le16 periods;
 } __attribute__ ((packed));
 
+#define P54_PSM_CAM                    0
 #define P54_PSM                                BIT(0)
 #define P54_PSM_DTIM                   BIT(1)
 #define P54_PSM_MCBC                   BIT(2)
index aa367a0ddc49139ac51a097730a0f464d97c24e0..3f9a6b04ea95f34a7f1b5e8e57be4c2ead029bfe 100644 (file)
@@ -79,6 +79,12 @@ static int p54p_upload_firmware(struct ieee80211_hw *dev)
        if (err)
                return err;
 
+       if (priv->common.fw_interface != FW_LM86) {
+               dev_err(&priv->pdev->dev, "wrong firmware, "
+                       "please get a LM86(PCI) firmware a try again.\n");
+               return -EINVAL;
+       }
+
        data = (__le32 *) priv->firmware->data;
        remains = priv->firmware->size;
        device_addr = ISL38XX_DEV_FIRMWARE_ADDR;
diff --git a/drivers/net/wireless/p54/p54spi.c b/drivers/net/wireless/p54/p54spi.c
new file mode 100644 (file)
index 0000000..7fde243
--- /dev/null
@@ -0,0 +1,770 @@
+/*
+ * Copyright (C) 2008 Christian Lamparter <chunkeey@web.de>
+ * Copyright 2008       Johannes Berg <johannes@sipsolutions.net>
+ *
+ * This driver is a port from stlc45xx:
+ *     Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/interrupt.h>
+#include <linux/firmware.h>
+#include <linux/delay.h>
+#include <linux/irq.h>
+#include <linux/spi/spi.h>
+#include <linux/etherdevice.h>
+#include <linux/gpio.h>
+
+#include "p54spi.h"
+#include "p54spi_eeprom.h"
+#include "p54.h"
+
+#include "p54common.h"
+
+MODULE_FIRMWARE("3826.arm");
+MODULE_ALIAS("stlc45xx");
+
+/*
+ * gpios should be handled in board files and provided via platform data,
+ * but because it's currently impossible for p54spi to have a header file
+ * in include/linux, let's use module paramaters for now
+ */
+
+static int p54spi_gpio_power = 97;
+module_param(p54spi_gpio_power, int, 0444);
+MODULE_PARM_DESC(p54spi_gpio_power, "gpio number for power line");
+
+static int p54spi_gpio_irq = 87;
+module_param(p54spi_gpio_irq, int, 0444);
+MODULE_PARM_DESC(p54spi_gpio_irq, "gpio number for irq line");
+
+static void p54spi_spi_read(struct p54s_priv *priv, u8 address,
+                             void *buf, size_t len)
+{
+       struct spi_transfer t[2];
+       struct spi_message m;
+       __le16 addr;
+
+       /* We first push the address */
+       addr = cpu_to_le16(address << 8 | SPI_ADRS_READ_BIT_15);
+
+       spi_message_init(&m);
+       memset(t, 0, sizeof(t));
+
+       t[0].tx_buf = &addr;
+       t[0].len = sizeof(addr);
+       spi_message_add_tail(&t[0], &m);
+
+       t[1].rx_buf = buf;
+       t[1].len = len;
+       spi_message_add_tail(&t[1], &m);
+
+       spi_sync(priv->spi, &m);
+}
+
+
+static void p54spi_spi_write(struct p54s_priv *priv, u8 address,
+                            const void *buf, size_t len)
+{
+       struct spi_transfer t[3];
+       struct spi_message m;
+       __le16 addr;
+
+       /* We first push the address */
+       addr = cpu_to_le16(address << 8);
+
+       spi_message_init(&m);
+       memset(t, 0, sizeof(t));
+
+       t[0].tx_buf = &addr;
+       t[0].len = sizeof(addr);
+       spi_message_add_tail(&t[0], &m);
+
+       t[1].tx_buf = buf;
+       t[1].len = len;
+       spi_message_add_tail(&t[1], &m);
+
+       if (len % 2) {
+               __le16 last_word;
+               last_word = cpu_to_le16(((u8 *)buf)[len - 1]);
+
+               t[2].tx_buf = &last_word;
+               t[2].len = sizeof(last_word);
+               spi_message_add_tail(&t[2], &m);
+       }
+
+       spi_sync(priv->spi, &m);
+}
+
+static u16 p54spi_read16(struct p54s_priv *priv, u8 addr)
+{
+       __le16 val;
+
+       p54spi_spi_read(priv, addr, &val, sizeof(val));
+
+       return le16_to_cpu(val);
+}
+
+static u32 p54spi_read32(struct p54s_priv *priv, u8 addr)
+{
+       __le32 val;
+
+       p54spi_spi_read(priv, addr, &val, sizeof(val));
+
+       return le32_to_cpu(val);
+}
+
+static inline void p54spi_write16(struct p54s_priv *priv, u8 addr, __le16 val)
+{
+       p54spi_spi_write(priv, addr, &val, sizeof(val));
+}
+
+static inline void p54spi_write32(struct p54s_priv *priv, u8 addr, __le32 val)
+{
+       p54spi_spi_write(priv, addr, &val, sizeof(val));
+}
+
+struct p54spi_spi_reg {
+       u16 address;            /* __le16 ? */
+       u16 length;
+       char *name;
+};
+
+static const struct p54spi_spi_reg p54spi_registers_array[] =
+{
+       { SPI_ADRS_ARM_INTERRUPTS,      32, "ARM_INT     " },
+       { SPI_ADRS_ARM_INT_EN,          32, "ARM_INT_ENA " },
+       { SPI_ADRS_HOST_INTERRUPTS,     32, "HOST_INT    " },
+       { SPI_ADRS_HOST_INT_EN,         32, "HOST_INT_ENA" },
+       { SPI_ADRS_HOST_INT_ACK,        32, "HOST_INT_ACK" },
+       { SPI_ADRS_GEN_PURP_1,          32, "GP1_COMM    " },
+       { SPI_ADRS_GEN_PURP_2,          32, "GP2_COMM    " },
+       { SPI_ADRS_DEV_CTRL_STAT,       32, "DEV_CTRL_STA" },
+       { SPI_ADRS_DMA_DATA,            16, "DMA_DATA    " },
+       { SPI_ADRS_DMA_WRITE_CTRL,      16, "DMA_WR_CTRL " },
+       { SPI_ADRS_DMA_WRITE_LEN,       16, "DMA_WR_LEN  " },
+       { SPI_ADRS_DMA_WRITE_BASE,      32, "DMA_WR_BASE " },
+       { SPI_ADRS_DMA_READ_CTRL,       16, "DMA_RD_CTRL " },
+       { SPI_ADRS_DMA_READ_LEN,        16, "DMA_RD_LEN  " },
+       { SPI_ADRS_DMA_WRITE_BASE,      32, "DMA_RD_BASE " }
+};
+
+static int p54spi_wait_bit(struct p54s_priv *priv, u16 reg, __le32 bits)
+{
+       int i;
+       __le32 buffer;
+
+       for (i = 0; i < 2000; i++) {
+               p54spi_spi_read(priv, reg, &buffer, sizeof(buffer));
+               if (buffer == bits)
+                       return 1;
+
+               msleep(1);
+       }
+       return 0;
+}
+
+static int p54spi_request_firmware(struct ieee80211_hw *dev)
+{
+       struct p54s_priv *priv = dev->priv;
+       int ret;
+
+       /* FIXME: should driver use it's own struct device? */
+       ret = request_firmware(&priv->firmware, "3826.arm", &priv->spi->dev);
+
+       if (ret < 0) {
+               dev_err(&priv->spi->dev, "request_firmware() failed: %d", ret);
+               return ret;
+       }
+
+       ret = p54_parse_firmware(dev, priv->firmware);
+       if (ret) {
+               release_firmware(priv->firmware);
+               return ret;
+       }
+
+       return 0;
+}
+
+static int p54spi_request_eeprom(struct ieee80211_hw *dev)
+{
+       struct p54s_priv *priv = dev->priv;
+       const struct firmware *eeprom;
+       int ret;
+
+       /*
+        * allow users to customize their eeprom.
+        */
+
+       ret = request_firmware(&eeprom, "3826.eeprom", &priv->spi->dev);
+       if (ret < 0) {
+               dev_info(&priv->spi->dev, "loading default eeprom...\n");
+               ret = p54_parse_eeprom(dev, (void *) p54spi_eeprom,
+                                      sizeof(p54spi_eeprom));
+       } else {
+               dev_info(&priv->spi->dev, "loading user eeprom...\n");
+               ret = p54_parse_eeprom(dev, (void *) eeprom->data,
+                                      (int)eeprom->size);
+               release_firmware(eeprom);
+       }
+       return ret;
+}
+
+static int p54spi_upload_firmware(struct ieee80211_hw *dev)
+{
+       struct p54s_priv *priv = dev->priv;
+       unsigned long fw_len, fw_addr;
+       long _fw_len;
+
+       /* stop the device */
+       p54spi_write16(priv, SPI_ADRS_DEV_CTRL_STAT, cpu_to_le16(
+                      SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_HOST_RESET |
+                      SPI_CTRL_STAT_START_HALTED));
+
+       msleep(TARGET_BOOT_SLEEP);
+
+       p54spi_write16(priv, SPI_ADRS_DEV_CTRL_STAT, cpu_to_le16(
+                      SPI_CTRL_STAT_HOST_OVERRIDE |
+                      SPI_CTRL_STAT_START_HALTED));
+
+       msleep(TARGET_BOOT_SLEEP);
+
+       fw_addr = ISL38XX_DEV_FIRMWARE_ADDR;
+       fw_len = priv->firmware->size;
+
+       while (fw_len > 0) {
+               _fw_len = min_t(long, fw_len, SPI_MAX_PACKET_SIZE);
+
+               p54spi_write16(priv, SPI_ADRS_DMA_WRITE_CTRL,
+                              cpu_to_le16(SPI_DMA_WRITE_CTRL_ENABLE));
+
+               if (p54spi_wait_bit(priv, SPI_ADRS_DMA_WRITE_CTRL,
+                                   cpu_to_le32(HOST_ALLOWED)) == 0) {
+                       dev_err(&priv->spi->dev, "fw_upload not allowed "
+                               "to DMA write.");
+                       return -EAGAIN;
+               }
+
+               p54spi_write16(priv, SPI_ADRS_DMA_WRITE_LEN,
+                              cpu_to_le16(_fw_len));
+               p54spi_write32(priv, SPI_ADRS_DMA_WRITE_BASE,
+                              cpu_to_le32(fw_addr));
+
+               p54spi_spi_write(priv, SPI_ADRS_DMA_DATA,
+                                &priv->firmware->data, _fw_len);
+
+               fw_len -= _fw_len;
+               fw_addr += _fw_len;
+
+               /* FIXME: I think this doesn't work if firmware is large,
+                * this loop goes to second round. fw->data is not
+                * increased at all! */
+       }
+
+       BUG_ON(fw_len != 0);
+
+       /* enable host interrupts */
+       p54spi_write32(priv, SPI_ADRS_HOST_INT_EN,
+                      cpu_to_le32(SPI_HOST_INTS_DEFAULT));
+
+       /* boot the device */
+       p54spi_write16(priv, SPI_ADRS_DEV_CTRL_STAT, cpu_to_le16(
+                      SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_HOST_RESET |
+                      SPI_CTRL_STAT_RAM_BOOT));
+
+       msleep(TARGET_BOOT_SLEEP);
+
+       p54spi_write16(priv, SPI_ADRS_DEV_CTRL_STAT, cpu_to_le16(
+                      SPI_CTRL_STAT_HOST_OVERRIDE | SPI_CTRL_STAT_RAM_BOOT));
+       msleep(TARGET_BOOT_SLEEP);
+       return 0;
+}
+
+static void p54spi_power_off(struct p54s_priv *priv)
+{
+       disable_irq(gpio_to_irq(p54spi_gpio_irq));
+       gpio_set_value(p54spi_gpio_power, 0);
+}
+
+static void p54spi_power_on(struct p54s_priv *priv)
+{
+       gpio_set_value(p54spi_gpio_power, 1);
+       enable_irq(gpio_to_irq(p54spi_gpio_irq));
+
+       /*
+        * need to wait a while before device can be accessed, the lenght
+        * is just a guess
+        */
+       msleep(10);
+}
+
+static inline void p54spi_int_ack(struct p54s_priv *priv, u32 val)
+{
+       p54spi_write32(priv, SPI_ADRS_HOST_INT_ACK, cpu_to_le32(val));
+}
+
+static void p54spi_wakeup(struct p54s_priv *priv)
+{
+       unsigned long timeout;
+       u32 ints;
+
+       /* wake the chip */
+       p54spi_write32(priv, SPI_ADRS_ARM_INTERRUPTS,
+                      cpu_to_le32(SPI_TARGET_INT_WAKEUP));
+
+       /* And wait for the READY interrupt */
+       timeout = jiffies + HZ;
+
+       ints =  p54spi_read32(priv, SPI_ADRS_HOST_INTERRUPTS);
+       while (!(ints & SPI_HOST_INT_READY)) {
+               if (time_after(jiffies, timeout))
+                               goto out;
+               ints = p54spi_read32(priv, SPI_ADRS_HOST_INTERRUPTS);
+       }
+
+       p54spi_int_ack(priv, SPI_HOST_INT_READY);
+
+out:
+       return;
+}
+
+static inline void p54spi_sleep(struct p54s_priv *priv)
+{
+       p54spi_write32(priv, SPI_ADRS_ARM_INTERRUPTS,
+                      cpu_to_le32(SPI_TARGET_INT_SLEEP));
+}
+
+static void p54spi_int_ready(struct p54s_priv *priv)
+{
+       p54spi_write32(priv, SPI_ADRS_HOST_INT_EN, cpu_to_le32(
+                      SPI_HOST_INT_UPDATE | SPI_HOST_INT_SW_UPDATE));
+
+       switch (priv->fw_state) {
+       case FW_STATE_BOOTING:
+               priv->fw_state = FW_STATE_READY;
+               complete(&priv->fw_comp);
+               break;
+       case FW_STATE_RESETTING:
+               priv->fw_state = FW_STATE_READY;
+               /* TODO: reinitialize state */
+               break;
+       default:
+               break;
+       }
+}
+
+static int p54spi_rx(struct p54s_priv *priv)
+{
+       struct sk_buff *skb;
+       u16 len;
+
+       p54spi_wakeup(priv);
+
+       /* dummy read to flush SPI DMA controller bug */
+       p54spi_read16(priv, SPI_ADRS_GEN_PURP_1);
+
+       len = p54spi_read16(priv, SPI_ADRS_DMA_DATA);
+
+       if (len == 0) {
+               dev_err(&priv->spi->dev, "rx request of zero bytes");
+               return 0;
+       }
+
+       skb = dev_alloc_skb(len);
+       if (!skb) {
+               dev_err(&priv->spi->dev, "could not alloc skb");
+               return 0;
+       }
+
+       p54spi_spi_read(priv, SPI_ADRS_DMA_DATA, skb_put(skb, len), len);
+       p54spi_sleep(priv);
+
+       if (p54_rx(priv->hw, skb) == 0)
+               dev_kfree_skb(skb);
+
+       return 0;
+}
+
+
+static irqreturn_t p54spi_interrupt(int irq, void *config)
+{
+       struct spi_device *spi = config;
+       struct p54s_priv *priv = dev_get_drvdata(&spi->dev);
+
+       queue_work(priv->hw->workqueue, &priv->work);
+
+       return IRQ_HANDLED;
+}
+
+static int p54spi_tx_frame(struct p54s_priv *priv, struct sk_buff *skb)
+{
+       struct p54_hdr *hdr = (struct p54_hdr *) skb->data;
+       struct p54s_dma_regs dma_regs;
+       unsigned long timeout;
+       int ret = 0;
+       u32 ints;
+
+       p54spi_wakeup(priv);
+
+       dma_regs.cmd = cpu_to_le16(SPI_DMA_WRITE_CTRL_ENABLE);
+       dma_regs.len = cpu_to_le16(skb->len);
+       dma_regs.addr = hdr->req_id;
+
+       p54spi_spi_write(priv, SPI_ADRS_DMA_WRITE_CTRL, &dma_regs,
+                          sizeof(dma_regs));
+
+       p54spi_spi_write(priv, SPI_ADRS_DMA_DATA, skb->data, skb->len);
+
+       timeout = jiffies + 2 * HZ;
+       ints = p54spi_read32(priv, SPI_ADRS_HOST_INTERRUPTS);
+       while (!(ints & SPI_HOST_INT_WR_READY)) {
+               if (time_after(jiffies, timeout)) {
+                       dev_err(&priv->spi->dev, "WR_READY timeout");
+                       ret = -1;
+                       goto out;
+               }
+               ints = p54spi_read32(priv, SPI_ADRS_HOST_INTERRUPTS);
+       }
+
+       p54spi_int_ack(priv, SPI_HOST_INT_WR_READY);
+       p54spi_sleep(priv);
+
+out:
+       if (FREE_AFTER_TX(skb))
+               p54_free_skb(priv->hw, skb);
+       return ret;
+}
+
+static int p54spi_wq_tx(struct p54s_priv *priv)
+{
+       struct p54s_tx_info *entry;
+       struct sk_buff *skb;
+       struct ieee80211_tx_info *info;
+       struct p54_tx_info *minfo;
+       struct p54s_tx_info *dinfo;
+       int ret = 0;
+
+       spin_lock_bh(&priv->tx_lock);
+
+       while (!list_empty(&priv->tx_pending)) {
+               entry = list_entry(priv->tx_pending.next,
+                                  struct p54s_tx_info, tx_list);
+
+               list_del_init(&entry->tx_list);
+
+               spin_unlock_bh(&priv->tx_lock);
+
+               dinfo = container_of((void *) entry, struct p54s_tx_info,
+                                    tx_list);
+               minfo = container_of((void *) dinfo, struct p54_tx_info,
+                                    data);
+               info = container_of((void *) minfo, struct ieee80211_tx_info,
+                                   rate_driver_data);
+               skb = container_of((void *) info, struct sk_buff, cb);
+
+               ret = p54spi_tx_frame(priv, skb);
+
+               spin_lock_bh(&priv->tx_lock);
+
+               if (ret < 0) {
+                       p54_free_skb(priv->hw, skb);
+                       goto out;
+               }
+       }
+
+out:
+       spin_unlock_bh(&priv->tx_lock);
+       return ret;
+}
+
+static void p54spi_op_tx(struct ieee80211_hw *dev, struct sk_buff *skb)
+{
+       struct p54s_priv *priv = dev->priv;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct p54_tx_info *mi = (struct p54_tx_info *) info->rate_driver_data;
+       struct p54s_tx_info *di = (struct p54s_tx_info *) mi->data;
+
+       BUILD_BUG_ON(sizeof(*di) > sizeof((mi->data)));
+
+       spin_lock_bh(&priv->tx_lock);
+       list_add_tail(&di->tx_list, &priv->tx_pending);
+       spin_unlock_bh(&priv->tx_lock);
+
+       queue_work(priv->hw->workqueue, &priv->work);
+}
+
+static void p54spi_work(struct work_struct *work)
+{
+       struct p54s_priv *priv = container_of(work, struct p54s_priv, work);
+       u32 ints;
+       int ret;
+
+       mutex_lock(&priv->mutex);
+
+       if (priv->fw_state == FW_STATE_OFF &&
+           priv->fw_state == FW_STATE_RESET)
+               goto out;
+
+       ints = p54spi_read32(priv, SPI_ADRS_HOST_INTERRUPTS);
+
+       if (ints & SPI_HOST_INT_READY) {
+               p54spi_int_ready(priv);
+               p54spi_int_ack(priv, SPI_HOST_INT_READY);
+       }
+
+       if (priv->fw_state != FW_STATE_READY)
+               goto out;
+
+       if (ints & SPI_HOST_INT_UPDATE) {
+               p54spi_int_ack(priv, SPI_HOST_INT_UPDATE);
+               ret = p54spi_rx(priv);
+               if (ret < 0)
+                       goto out;
+       }
+       if (ints & SPI_HOST_INT_SW_UPDATE) {
+               p54spi_int_ack(priv, SPI_HOST_INT_SW_UPDATE);
+               ret = p54spi_rx(priv);
+               if (ret < 0)
+                       goto out;
+       }
+
+       ret = p54spi_wq_tx(priv);
+       if (ret < 0)
+               goto out;
+
+       ints = p54spi_read32(priv, SPI_ADRS_HOST_INTERRUPTS);
+
+out:
+       mutex_unlock(&priv->mutex);
+}
+
+static int p54spi_op_start(struct ieee80211_hw *dev)
+{
+       struct p54s_priv *priv = dev->priv;
+       unsigned long timeout;
+       int ret = 0;
+
+       if (mutex_lock_interruptible(&priv->mutex)) {
+               ret = -EINTR;
+               goto out;
+       }
+
+       priv->fw_state = FW_STATE_BOOTING;
+
+       p54spi_power_on(priv);
+
+       ret = p54spi_upload_firmware(dev);
+       if (ret < 0) {
+               p54spi_power_off(priv);
+               goto out_unlock;
+       }
+
+       mutex_unlock(&priv->mutex);
+
+       timeout = msecs_to_jiffies(2000);
+       timeout = wait_for_completion_interruptible_timeout(&priv->fw_comp,
+                                                           timeout);
+       if (!timeout) {
+               dev_err(&priv->spi->dev, "firmware boot failed");
+               p54spi_power_off(priv);
+               ret = -1;
+               goto out;
+       }
+
+       if (mutex_lock_interruptible(&priv->mutex)) {
+               ret = -EINTR;
+               p54spi_power_off(priv);
+               goto out;
+       }
+
+       WARN_ON(priv->fw_state != FW_STATE_READY);
+
+out_unlock:
+       mutex_unlock(&priv->mutex);
+
+out:
+       return ret;
+}
+
+static void p54spi_op_stop(struct ieee80211_hw *dev)
+{
+       struct p54s_priv *priv = dev->priv;
+
+       if (mutex_lock_interruptible(&priv->mutex)) {
+               /* FIXME: how to handle this error? */
+               return;
+       }
+
+       WARN_ON(priv->fw_state != FW_STATE_READY);
+
+       cancel_work_sync(&priv->work);
+
+       p54spi_power_off(priv);
+       spin_lock_bh(&priv->tx_lock);
+       INIT_LIST_HEAD(&priv->tx_pending);
+       spin_unlock_bh(&priv->tx_lock);
+
+       priv->fw_state = FW_STATE_OFF;
+       mutex_unlock(&priv->mutex);
+}
+
+static int __devinit p54spi_probe(struct spi_device *spi)
+{
+       struct p54s_priv *priv = NULL;
+       struct ieee80211_hw *hw;
+       int ret = -EINVAL;
+
+       hw = p54_init_common(sizeof(*priv));
+       if (!hw) {
+               dev_err(&priv->spi->dev, "could not alloc ieee80211_hw");
+               return -ENOMEM;
+       }
+
+       priv = hw->priv;
+       priv->hw = hw;
+       dev_set_drvdata(&spi->dev, priv);
+       priv->spi = spi;
+
+       spi->bits_per_word = 16;
+       spi->max_speed_hz = 24000000;
+
+       ret = spi_setup(spi);
+       if (ret < 0) {
+               dev_err(&priv->spi->dev, "spi_setup failed");
+               goto err_free_common;
+       }
+
+       ret = gpio_request(p54spi_gpio_power, "p54spi power");
+       if (ret < 0) {
+               dev_err(&priv->spi->dev, "power GPIO request failed: %d", ret);
+               goto err_free_common;
+       }
+
+       ret = gpio_request(p54spi_gpio_irq, "p54spi irq");
+       if (ret < 0) {
+               dev_err(&priv->spi->dev, "irq GPIO request failed: %d", ret);
+               goto err_free_common;
+       }
+
+       gpio_direction_output(p54spi_gpio_power, 0);
+       gpio_direction_input(p54spi_gpio_irq);
+
+       ret = request_irq(gpio_to_irq(p54spi_gpio_irq),
+                         p54spi_interrupt, IRQF_DISABLED, "p54spi",
+                         priv->spi);
+       if (ret < 0) {
+               dev_err(&priv->spi->dev, "request_irq() failed");
+               goto err_free_common;
+       }
+
+       set_irq_type(gpio_to_irq(p54spi_gpio_irq),
+                    IRQ_TYPE_EDGE_RISING);
+
+       disable_irq(gpio_to_irq(p54spi_gpio_irq));
+
+       INIT_WORK(&priv->work, p54spi_work);
+       init_completion(&priv->fw_comp);
+       INIT_LIST_HEAD(&priv->tx_pending);
+       mutex_init(&priv->mutex);
+       SET_IEEE80211_DEV(hw, &spi->dev);
+       priv->common.open = p54spi_op_start;
+       priv->common.stop = p54spi_op_stop;
+       priv->common.tx = p54spi_op_tx;
+
+       ret = p54spi_request_firmware(hw);
+       if (ret < 0)
+               goto err_free_common;
+
+       ret = p54spi_request_eeprom(hw);
+       if (ret)
+               goto err_free_common;
+
+       ret = ieee80211_register_hw(hw);
+       if (ret) {
+               dev_err(&priv->spi->dev, "unable to register "
+                                        "mac80211 hw: %d", ret);
+               goto err_free_common;
+       }
+
+       dev_info(&priv->spi->dev, "device is bound to %s\n",
+                wiphy_name(hw->wiphy));
+       return 0;
+
+err_free_common:
+       p54_free_common(priv->hw);
+       return ret;
+}
+
+static int __devexit p54spi_remove(struct spi_device *spi)
+{
+       struct p54s_priv *priv = dev_get_drvdata(&spi->dev);
+
+       ieee80211_unregister_hw(priv->hw);
+
+       free_irq(gpio_to_irq(p54spi_gpio_irq), spi);
+
+       gpio_free(p54spi_gpio_power);
+       gpio_free(p54spi_gpio_irq);
+       release_firmware(priv->firmware);
+
+       mutex_destroy(&priv->mutex);
+
+       p54_free_common(priv->hw);
+       ieee80211_free_hw(priv->hw);
+
+       return 0;
+}
+
+
+static struct spi_driver p54spi_driver = {
+       .driver = {
+               /* use cx3110x name because board-n800.c uses that for the
+                * SPI port */
+               .name           = "cx3110x",
+               .bus            = &spi_bus_type,
+               .owner          = THIS_MODULE,
+       },
+
+       .probe          = p54spi_probe,
+       .remove         = __devexit_p(p54spi_remove),
+};
+
+static int __init p54spi_init(void)
+{
+       int ret;
+
+       ret = spi_register_driver(&p54spi_driver);
+       if (ret < 0) {
+               printk(KERN_ERR "failed to register SPI driver: %d", ret);
+               goto out;
+       }
+
+out:
+       return ret;
+}
+
+static void __exit p54spi_exit(void)
+{
+       spi_unregister_driver(&p54spi_driver);
+}
+
+module_init(p54spi_init);
+module_exit(p54spi_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_AUTHOR("Christian Lamparter <chunkeey@web.de>");
diff --git a/drivers/net/wireless/p54/p54spi.h b/drivers/net/wireless/p54/p54spi.h
new file mode 100644 (file)
index 0000000..7fbe8d8
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2008 Christian Lamparter <chunkeey@web.de>
+ *
+ * This driver is a port from stlc45xx:
+ *     Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef P54SPI_H
+#define P54SPI_H
+
+#include <linux/mutex.h>
+#include <linux/list.h>
+#include <net/mac80211.h>
+
+#include "p54.h"
+
+/* Bit 15 is read/write bit; ON = READ, OFF = WRITE */
+#define SPI_ADRS_READ_BIT_15           0x8000
+
+#define SPI_ADRS_ARM_INTERRUPTS                0x00
+#define SPI_ADRS_ARM_INT_EN            0x04
+
+#define SPI_ADRS_HOST_INTERRUPTS       0x08
+#define SPI_ADRS_HOST_INT_EN           0x0c
+#define SPI_ADRS_HOST_INT_ACK          0x10
+
+#define SPI_ADRS_GEN_PURP_1            0x14
+#define SPI_ADRS_GEN_PURP_2            0x18
+
+#define SPI_ADRS_DEV_CTRL_STAT         0x26    /* high word */
+
+#define SPI_ADRS_DMA_DATA              0x28
+
+#define SPI_ADRS_DMA_WRITE_CTRL                0x2c
+#define SPI_ADRS_DMA_WRITE_LEN         0x2e
+#define SPI_ADRS_DMA_WRITE_BASE                0x30
+
+#define SPI_ADRS_DMA_READ_CTRL         0x34
+#define SPI_ADRS_DMA_READ_LEN          0x36
+#define SPI_ADRS_DMA_READ_BASE         0x38
+
+#define SPI_CTRL_STAT_HOST_OVERRIDE    0x8000
+#define SPI_CTRL_STAT_START_HALTED     0x4000
+#define SPI_CTRL_STAT_RAM_BOOT         0x2000
+#define SPI_CTRL_STAT_HOST_RESET       0x1000
+#define SPI_CTRL_STAT_HOST_CPU_EN      0x0800
+
+#define SPI_DMA_WRITE_CTRL_ENABLE      0x0001
+#define SPI_DMA_READ_CTRL_ENABLE       0x0001
+#define HOST_ALLOWED                   (1 << 7)
+
+#define SPI_TIMEOUT                    100         /* msec */
+
+#define SPI_MAX_TX_PACKETS             32
+
+#define SPI_MAX_PACKET_SIZE            32767
+
+#define SPI_TARGET_INT_WAKEUP          0x00000001
+#define SPI_TARGET_INT_SLEEP           0x00000002
+#define SPI_TARGET_INT_RDDONE          0x00000004
+
+#define SPI_TARGET_INT_CTS             0x00004000
+#define SPI_TARGET_INT_DR              0x00008000
+
+#define SPI_HOST_INT_READY             0x00000001
+#define SPI_HOST_INT_WR_READY          0x00000002
+#define SPI_HOST_INT_SW_UPDATE         0x00000004
+#define SPI_HOST_INT_UPDATE            0x10000000
+
+/* clear to send */
+#define SPI_HOST_INT_CR                        0x00004000
+
+/* data ready */
+#define SPI_HOST_INT_DR                        0x00008000
+
+#define SPI_HOST_INTS_DEFAULT                                              \
+       (SPI_HOST_INT_READY | SPI_HOST_INT_UPDATE | SPI_HOST_INT_SW_UPDATE)
+
+#define TARGET_BOOT_SLEEP 50
+
+struct p54s_dma_regs {
+       __le16 cmd;
+       __le16 len;
+       __le32 addr;
+} __attribute__ ((packed));
+
+struct p54s_tx_info {
+       struct list_head tx_list;
+};
+
+struct p54s_priv {
+       /* p54_common has to be the first entry */
+       struct p54_common common;
+       struct ieee80211_hw *hw;
+       struct spi_device *spi;
+
+       struct work_struct work;
+
+       struct mutex mutex;
+       struct completion fw_comp;
+
+       spinlock_t tx_lock;
+
+       /* protected by tx_lock */
+       struct list_head tx_pending;
+
+       enum fw_state fw_state;
+       const struct firmware *firmware;
+};
+
+#endif /* P54SPI_H */
diff --git a/drivers/net/wireless/p54/p54spi_eeprom.h b/drivers/net/wireless/p54/p54spi_eeprom.h
new file mode 100644 (file)
index 0000000..1ea1050
--- /dev/null
@@ -0,0 +1,678 @@
+/*
+ * Copyright (C) 2003 Conexant Americas Inc. All Rights Reserved.
+ * Copyright (C) 2004, 2005, 2006 Nokia Corporation
+ * Copyright 2008 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2008 Christian Lamparter <chunkeey@web.de>
+ *
+ * based on:
+ *  - cx3110x's pda.h from Nokia
+ *  - cx3110-transfer.log by Johannes Berg
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#ifndef P54SPI_EEPROM_H
+#define P54SPI_EEPROM_H
+
+static unsigned char p54spi_eeprom[] = {
+
+/* struct eeprom_pda_wrap */
+0x47, 0x4d, 0x55, 0xaa,        /* magic */
+0x00, 0x00,            /* pad */
+0x00, 0x00,            /* eeprom_pda_data_wrap length */
+0x00, 0x00, 0x00, 0x00,        /* arm opcode */
+
+/* bogus MAC address */
+0x04, 0x00, 0x01, 0x01,                /* PDR_MAC_ADDRESS */
+       0x00, 0x02, 0xee, 0xc0, 0xff, 0xee,
+
+/* struct bootrec_exp_if */
+0x06, 0x00, 0x01, 0x10,                /* PDR_INTERFACE_LIST */
+       0x00, 0x00,                     /* role */
+       0x0f, 0x00,                     /* if_id */
+       0x85, 0x00,                     /* variant = Longbow RF, 2GHz */
+       0x01, 0x00,                     /* btm_compat */
+       0x1f, 0x00,                     /* top_compat */
+
+0x03, 0x00, 0x02, 0x10,                /* PDR_HARDWARE_PLATFORM_COMPONENT_ID */
+       0x03, 0x20, 0x00, 0x43,
+
+/* struct pda_country[6] */
+0x0d, 0x00, 0x07, 0x10,                /* PDR_COUNTRY_LIST */
+       0x10, 0x00, 0x00, 0x00,
+       0x20, 0x00, 0x00, 0x00,
+       0x30, 0x00, 0x00, 0x00,
+       0x31, 0x00, 0x00, 0x00,
+       0x32, 0x00, 0x00, 0x00,
+       0x40, 0x00, 0x00, 0x00,
+
+/* struct pda_country */
+0x03, 0x00, 0x08, 0x10,                /* PDR_DEFAULT_COUNTRY */
+       0x30, 0x00, 0x00, 0x00,         /* ETSI */
+
+0x03, 0x00, 0x00, 0x11,                /* PDR_ANTENNA_GAIN */
+       0x08, 0x08, 0x08, 0x08,
+
+0x09, 0x00, 0xad, 0xde,                /* PDR_RSSI_LINEAR_APPROXIMATION_CUSTOM */
+       0x0a, 0x01, 0x72, 0xfe, 0x1a, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
+/* struct pda_custom_wrapper */
+0x10, 0x06, 0x5d, 0xb0,                /* PDR_PRISM_PA_CAL_CURVE_DATA_CUSTOM */
+       0x0d, 0x00, 0xee, 0x00,         /* 13 entries, 238 bytes per entry */
+       0x00, 0x00, 0x16, 0x0c,         /* no offset, 3094 total len */
+               /* 2412 MHz */
+               0x6c, 0x09,
+                       0x10, 0x01, 0x9a, 0x84,
+                               0xaa, 0x8a, 0xaa, 0x8a, 0xaa, 0x8a, 0xaa, 0x8a,
+                               0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6,
+                               0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6, 0x3c, 0xb6,
+                       0xf0, 0x00, 0x94, 0x6c,
+                               0x99, 0x82, 0x99, 0x82, 0x99, 0x82, 0x99, 0x82,
+                               0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae,
+                               0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae, 0x2b, 0xae,
+                       0xd0, 0x00, 0xaa, 0x5a,
+                               0x88, 0x7a, 0x88, 0x7a, 0x88, 0x7a, 0x88, 0x7a,
+                               0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6,
+                               0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6, 0x1a, 0xa6,
+                       0xa0, 0x00, 0xf3, 0x47,
+                               0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e, 0x6e,
+                               0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a,
+                               0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a, 0x00, 0x9a,
+                       0x50, 0x00, 0x59, 0x36,
+                               0x43, 0x5a, 0x43, 0x5a, 0x43, 0x5a, 0x43, 0x5a,
+                               0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85,
+                               0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85, 0xd5, 0x85,
+                       0x00, 0x00, 0xe4, 0x2d,
+                               0x18, 0x46, 0x18, 0x46, 0x18, 0x46, 0x18, 0x46,
+                               0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71,
+                               0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71, 0xaa, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2417 MHz */
+               0x71, 0x09,
+                       0x10, 0x01, 0xb9, 0x83,
+                               0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a,
+                               0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6,
+                               0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6,
+                       0xf0, 0x00, 0x2e, 0x6c,
+                               0x68, 0x82, 0x68, 0x82, 0x68, 0x82, 0x68, 0x82,
+                               0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad,
+                               0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad,
+                       0xd0, 0x00, 0x8d, 0x5a,
+                               0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a,
+                               0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5,
+                               0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5,
+                       0xa0, 0x00, 0x0a, 0x48,
+                               0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e,
+                               0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99,
+                               0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99,
+                       0x50, 0x00, 0x7c, 0x36,
+                               0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59,
+                               0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85,
+                               0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85,
+                       0x00, 0x00, 0xf5, 0x2d,
+                               0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45,
+                               0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71,
+                               0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2422 MHz */
+               0x76, 0x09,
+                       0x10, 0x01, 0xb9, 0x83,
+                               0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a, 0x7d, 0x8a,
+                               0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6,
+                               0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6, 0x0f, 0xb6,
+                       0xf0, 0x00, 0x2e, 0x6c,
+                               0x68, 0x82, 0x68, 0x82, 0x68, 0x82, 0x68, 0x82,
+                               0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad,
+                               0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad, 0xfa, 0xad,
+                       0xd0, 0x00, 0x8d, 0x5a,
+                               0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a, 0x52, 0x7a,
+                               0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5,
+                               0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5, 0xe4, 0xa5,
+                       0xa0, 0x00, 0x0a, 0x48,
+                               0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e, 0x32, 0x6e,
+                               0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99,
+                               0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99, 0xc4, 0x99,
+                       0x50, 0x00, 0x7c, 0x36,
+                               0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59, 0xfc, 0x59,
+                               0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85,
+                               0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85, 0x8e, 0x85,
+                       0x00, 0x00, 0xf5, 0x2d,
+                               0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45, 0xc6, 0x45,
+                               0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71,
+                               0x58, 0x71, 0x58, 0x71, 0x58, 0x71, 0x58, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2427 MHz */
+               0x7b, 0x09,
+                       0x10, 0x01, 0x48, 0x83,
+                               0x67, 0x8a, 0x67, 0x8a, 0x67, 0x8a, 0x67, 0x8a,
+                               0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5,
+                               0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5, 0xf9, 0xb5,
+                       0xf0, 0x00, 0xfb, 0x6b,
+                               0x50, 0x82, 0x50, 0x82, 0x50, 0x82, 0x50, 0x82,
+                               0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad,
+                               0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad, 0xe2, 0xad,
+                       0xd0, 0x00, 0x7e, 0x5a,
+                               0x38, 0x7a, 0x38, 0x7a, 0x38, 0x7a, 0x38, 0x7a,
+                               0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5,
+                               0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5, 0xca, 0xa5,
+                       0xa0, 0x00, 0x15, 0x48,
+                               0x14, 0x6e, 0x14, 0x6e, 0x14, 0x6e, 0x14, 0x6e,
+                               0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99,
+                               0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99, 0xa6, 0x99,
+                       0x50, 0x00, 0x8e, 0x36,
+                               0xd9, 0x59, 0xd9, 0x59, 0xd9, 0x59, 0xd9, 0x59,
+                               0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85,
+                               0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85, 0x6b, 0x85,
+                       0x00, 0x00, 0xfe, 0x2d,
+                               0x9d, 0x45, 0x9d, 0x45, 0x9d, 0x45, 0x9d, 0x45,
+                               0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71,
+                               0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71, 0x2f, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2432 MHz */
+               0x80, 0x09,
+                       0x10, 0x01, 0xd7, 0x82,
+                               0x51, 0x8a, 0x51, 0x8a, 0x51, 0x8a, 0x51, 0x8a,
+                               0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5,
+                               0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5, 0xe3, 0xb5,
+                       0xf0, 0x00, 0xc8, 0x6b,
+                               0x37, 0x82, 0x37, 0x82, 0x37, 0x82, 0x37, 0x82,
+                               0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad,
+                               0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad, 0xc9, 0xad,
+                       0xd0, 0x00, 0x6f, 0x5a,
+                               0x1d, 0x7a, 0x1d, 0x7a, 0x1d, 0x7a, 0x1d, 0x7a,
+                               0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5,
+                               0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5, 0xaf, 0xa5,
+                       0xa0, 0x00, 0x20, 0x48,
+                               0xf6, 0x6d, 0xf6, 0x6d, 0xf6, 0x6d, 0xf6, 0x6d,
+                               0x88, 0x99, 0x88, 0x99, 0x88, 0x99, 0x88, 0x99,
+                               0x88, 0x99, 0x88, 0x99, 0x88, 0x99, 0x88, 0x99,
+                       0x50, 0x00, 0x9f, 0x36,
+                               0xb5, 0x59, 0xb5, 0x59, 0xb5, 0x59, 0xb5, 0x59,
+                               0x47, 0x85, 0x47, 0x85, 0x47, 0x85, 0x47, 0x85,
+                               0x47, 0x85, 0x47, 0x85, 0x47, 0x85, 0x47, 0x85,
+                       0x00, 0x00, 0x06, 0x2e,
+                               0x74, 0x45, 0x74, 0x45, 0x74, 0x45, 0x74, 0x45,
+                               0x06, 0x71, 0x06, 0x71, 0x06, 0x71, 0x06, 0x71,
+                               0x06, 0x71, 0x06, 0x71, 0x06, 0x71, 0x06, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2437 MHz */
+               0x85, 0x09,
+                       0x10, 0x01, 0x67, 0x82,
+                               0x3a, 0x8a, 0x3a, 0x8a, 0x3a, 0x8a, 0x3a, 0x8a,
+                               0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5,
+                               0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5, 0xcc, 0xb5,
+                       0xf0, 0x00, 0x95, 0x6b,
+                               0x1f, 0x82, 0x1f, 0x82, 0x1f, 0x82, 0x1f, 0x82,
+                               0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad,
+                               0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad, 0xb1, 0xad,
+                       0xd0, 0x00, 0x61, 0x5a,
+                               0x02, 0x7a, 0x02, 0x7a, 0x02, 0x7a, 0x02, 0x7a,
+                               0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5,
+                               0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5, 0x94, 0xa5,
+                       0xa0, 0x00, 0x2c, 0x48,
+                               0xd8, 0x6d, 0xd8, 0x6d, 0xd8, 0x6d, 0xd8, 0x6d,
+                               0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99,
+                               0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99, 0x6a, 0x99,
+                       0x50, 0x00, 0xb1, 0x36,
+                               0x92, 0x59, 0x92, 0x59, 0x92, 0x59, 0x92, 0x59,
+                               0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85,
+                               0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85,
+                       0x00, 0x00, 0x0f, 0x2e,
+                               0x4b, 0x45, 0x4b, 0x45, 0x4b, 0x45, 0x4b, 0x45,
+                               0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70,
+                               0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70, 0xdd, 0x70,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2442 MHz */
+               0x8a, 0x09,
+                       0x10, 0x01, 0xf6, 0x81,
+                               0x24, 0x8a, 0x24, 0x8a, 0x24, 0x8a, 0x24, 0x8a,
+                               0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5,
+                               0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5, 0xb6, 0xb5,
+                       0xf0, 0x00, 0x62, 0x6b,
+                               0x06, 0x82, 0x06, 0x82, 0x06, 0x82, 0x06, 0x82,
+                               0x98, 0xad, 0x98, 0xad, 0x98, 0xad, 0x98, 0xad,
+                               0x98, 0xad, 0x98, 0xad, 0x98, 0xad, 0x98, 0xad,
+                       0xd0, 0x00, 0x52, 0x5a,
+                               0xe7, 0x79, 0xe7, 0x79, 0xe7, 0x79, 0xe7, 0x79,
+                               0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5,
+                               0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5, 0x79, 0xa5,
+                       0xa0, 0x00, 0x37, 0x48,
+                               0xba, 0x6d, 0xba, 0x6d, 0xba, 0x6d, 0xba, 0x6d,
+                               0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99,
+                               0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99, 0x4c, 0x99,
+                       0x50, 0x00, 0xc2, 0x36,
+                               0x6e, 0x59, 0x6e, 0x59, 0x6e, 0x59, 0x6e, 0x59,
+                               0x00, 0x85, 0x00, 0x85, 0x00, 0x85, 0x00, 0x85,
+                               0x00, 0x85, 0x00, 0x85, 0x00, 0x85, 0x00, 0x85,
+                       0x00, 0x00, 0x17, 0x2e,
+                               0x22, 0x45, 0x22, 0x45, 0x22, 0x45, 0x22, 0x45,
+                               0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70,
+                               0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70, 0xb4, 0x70,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2447 MHz */
+               0x8f, 0x09,
+                       0x10, 0x01, 0x75, 0x83,
+                               0x61, 0x8a, 0x61, 0x8a, 0x61, 0x8a, 0x61, 0x8a,
+                               0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5,
+                               0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5, 0xf3, 0xb5,
+                       0xf0, 0x00, 0x4b, 0x6c,
+                               0x3f, 0x82, 0x3f, 0x82, 0x3f, 0x82, 0x3f, 0x82,
+                               0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad,
+                               0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad, 0xd1, 0xad,
+                       0xd0, 0x00, 0xda, 0x5a,
+                               0x1c, 0x7a, 0x1c, 0x7a, 0x1c, 0x7a, 0x1c, 0x7a,
+                               0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5,
+                               0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5, 0xae, 0xa5,
+                       0xa0, 0x00, 0x6d, 0x48,
+                               0xe9, 0x6d, 0xe9, 0x6d, 0xe9, 0x6d, 0xe9, 0x6d,
+                               0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99,
+                               0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99, 0x7b, 0x99,
+                       0x50, 0x00, 0xc6, 0x36,
+                               0x92, 0x59, 0x92, 0x59, 0x92, 0x59, 0x92, 0x59,
+                               0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85,
+                               0x24, 0x85, 0x24, 0x85, 0x24, 0x85, 0x24, 0x85,
+                       0x00, 0x00, 0x15, 0x2e,
+                               0x3c, 0x45, 0x3c, 0x45, 0x3c, 0x45, 0x3c, 0x45,
+                               0xce, 0x70, 0xce, 0x70, 0xce, 0x70, 0xce, 0x70,
+                               0xce, 0x70, 0xce, 0x70, 0xce, 0x70, 0xce, 0x70,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2452 MHz */
+               0x94, 0x09,
+                       0x10, 0x01, 0xf4, 0x84,
+                               0x9e, 0x8a, 0x9e, 0x8a, 0x9e, 0x8a, 0x9e, 0x8a,
+                               0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6,
+                               0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6, 0x30, 0xb6,
+                       0xf0, 0x00, 0x34, 0x6d,
+                               0x77, 0x82, 0x77, 0x82, 0x77, 0x82, 0x77, 0x82,
+                               0x09, 0xae, 0x09, 0xae, 0x09, 0xae, 0x09, 0xae,
+                               0x09, 0xae, 0x09, 0xae, 0x09, 0xae, 0x09, 0xae,
+                       0xd0, 0x00, 0x62, 0x5b,
+                               0x50, 0x7a, 0x50, 0x7a, 0x50, 0x7a, 0x50, 0x7a,
+                               0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5,
+                               0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5, 0xe2, 0xa5,
+                       0xa0, 0x00, 0xa2, 0x48,
+                               0x17, 0x6e, 0x17, 0x6e, 0x17, 0x6e, 0x17, 0x6e,
+                               0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99,
+                               0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99, 0xa9, 0x99,
+                       0x50, 0x00, 0xc9, 0x36,
+                               0xb7, 0x59, 0xb7, 0x59, 0xb7, 0x59, 0xb7, 0x59,
+                               0x49, 0x85, 0x49, 0x85, 0x49, 0x85, 0x49, 0x85,
+                               0x49, 0x85, 0x49, 0x85, 0x49, 0x85, 0x49, 0x85,
+                       0x00, 0x00, 0x12, 0x2e,
+                               0x57, 0x45, 0x57, 0x45, 0x57, 0x45, 0x57, 0x45,
+                               0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70,
+                               0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70, 0xe9, 0x70,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2452 MHz */
+               0x99, 0x09,
+                       0x10, 0x01, 0x74, 0x86,
+                               0xdb, 0x8a, 0xdb, 0x8a, 0xdb, 0x8a, 0xdb, 0x8a,
+                               0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6,
+                               0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6, 0x6d, 0xb6,
+                       0xf0, 0x00, 0x1e, 0x6e,
+                               0xb0, 0x82, 0xb0, 0x82, 0xb0, 0x82, 0xb0, 0x82,
+                               0x42, 0xae, 0x42, 0xae, 0x42, 0xae, 0x42, 0xae,
+                               0x42, 0xae, 0x42, 0xae, 0x42, 0xae, 0x42, 0xae,
+                       0xd0, 0x00, 0xeb, 0x5b,
+                               0x85, 0x7a, 0x85, 0x7a, 0x85, 0x7a, 0x85, 0x7a,
+                               0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6,
+                               0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6, 0x17, 0xa6,
+                       0xa0, 0x00, 0xd8, 0x48,
+                               0x46, 0x6e, 0x46, 0x6e, 0x46, 0x6e, 0x46, 0x6e,
+                               0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99,
+                               0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99, 0xd8, 0x99,
+                       0x50, 0x00, 0xcd, 0x36,
+                               0xdb, 0x59, 0xdb, 0x59, 0xdb, 0x59, 0xdb, 0x59,
+                               0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85,
+                               0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85, 0x6d, 0x85,
+                       0x00, 0x00, 0x10, 0x2e,
+                               0x71, 0x45, 0x71, 0x45, 0x71, 0x45, 0x71, 0x45,
+                               0x03, 0x71, 0x03, 0x71, 0x03, 0x71, 0x03, 0x71,
+                               0x03, 0x71, 0x03, 0x71, 0x03, 0x71, 0x03, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2557 MHz */
+               0x9e, 0x09,
+                       0x10, 0x01, 0xf3, 0x87,
+                               0x17, 0x8b, 0x17, 0x8b, 0x17, 0x8b, 0x17, 0x8b,
+                               0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6,
+                               0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6, 0xa9, 0xb6,
+                       0xf0, 0x00, 0x07, 0x6f,
+                               0xe9, 0x82, 0xe9, 0x82, 0xe9, 0x82, 0xe9, 0x82,
+                               0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae,
+                               0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae, 0x7b, 0xae,
+                       0xd0, 0x00, 0x73, 0x5c,
+                               0xba, 0x7a, 0xba, 0x7a, 0xba, 0x7a, 0xba, 0x7a,
+                               0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6,
+                               0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6, 0x4c, 0xa6,
+                       0xa0, 0x00, 0x0d, 0x49,
+                               0x74, 0x6e, 0x74, 0x6e, 0x74, 0x6e, 0x74, 0x6e,
+                               0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a,
+                               0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a, 0x06, 0x9a,
+                       0x50, 0x00, 0xd1, 0x36,
+                               0xff, 0x59, 0xff, 0x59, 0xff, 0x59, 0xff, 0x59,
+                               0x91, 0x85, 0x91, 0x85, 0x91, 0x85, 0x91, 0x85,
+                               0x91, 0x85, 0x91, 0x85, 0x91, 0x85, 0x91, 0x85,
+                       0x00, 0x00, 0x0e, 0x2e,
+                               0x8b, 0x45, 0x8b, 0x45, 0x8b, 0x45, 0x8b, 0x45,
+                               0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71,
+                               0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71, 0x1d, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2562 MHz */
+               0xa3, 0x09,
+                       0x10, 0x01, 0x72, 0x89,
+                               0x54, 0x8b, 0x54, 0x8b, 0x54, 0x8b, 0x54, 0x8b,
+                               0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6,
+                               0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6, 0xe6, 0xb6,
+                       0xf0, 0x00, 0xf0, 0x6f,
+                               0x21, 0x83, 0x21, 0x83, 0x21, 0x83, 0x21, 0x83,
+                               0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae,
+                               0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae, 0xb3, 0xae,
+                       0xd0, 0x00, 0xfb, 0x5c,
+                               0xee, 0x7a, 0xee, 0x7a, 0xee, 0x7a, 0xee, 0x7a,
+                               0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6,
+                               0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6, 0x80, 0xa6,
+                       0xa0, 0x00, 0x43, 0x49,
+                               0xa3, 0x6e, 0xa3, 0x6e, 0xa3, 0x6e, 0xa3, 0x6e,
+                               0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a,
+                               0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a, 0x35, 0x9a,
+                       0x50, 0x00, 0xd4, 0x36,
+                               0x24, 0x5a, 0x24, 0x5a, 0x24, 0x5a, 0x24, 0x5a,
+                               0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85,
+                               0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85, 0xb6, 0x85,
+                       0x00, 0x00, 0x0b, 0x2e,
+                               0xa6, 0x45, 0xa6, 0x45, 0xa6, 0x45, 0xa6, 0x45,
+                               0x38, 0x71, 0x38, 0x71, 0x38, 0x71, 0x38, 0x71,
+                               0x38, 0x71, 0x38, 0x71, 0x38, 0x71, 0x38, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+               /* 2572 MHz */
+               0xa8, 0x09,
+                       0x10, 0x01, 0xf1, 0x8a,
+                               0x91, 0x8b, 0x91, 0x8b, 0x91, 0x8b, 0x91, 0x8b,
+                               0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7,
+                               0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7, 0x23, 0xb7,
+                       0xf0, 0x00, 0xd9, 0x70,
+                               0x5a, 0x83, 0x5a, 0x83, 0x5a, 0x83, 0x5a, 0x83,
+                               0xec, 0xae, 0xec, 0xae, 0xec, 0xae, 0xec, 0xae,
+                               0xec, 0xae, 0xec, 0xae, 0xec, 0xae, 0xec, 0xae,
+                       0xd0, 0x00, 0x83, 0x5d,
+                               0x23, 0x7b, 0x23, 0x7b, 0x23, 0x7b, 0x23, 0x7b,
+                               0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6,
+                               0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6, 0xb5, 0xa6,
+                       0xa0, 0x00, 0x78, 0x49,
+                               0xd1, 0x6e, 0xd1, 0x6e, 0xd1, 0x6e, 0xd1, 0x6e,
+                               0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a,
+                               0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a, 0x63, 0x9a,
+                       0x50, 0x00, 0xd8, 0x36,
+                               0x48, 0x5a, 0x48, 0x5a, 0x48, 0x5a, 0x48, 0x5a,
+                               0xda, 0x85, 0xda, 0x85, 0xda, 0x85, 0xda, 0x85,
+                               0xda, 0x85, 0xda, 0x85, 0xda, 0x85, 0xda, 0x85,
+                       0x00, 0x00, 0x09, 0x2e,
+                               0xc0, 0x45, 0xc0, 0x45, 0xc0, 0x45, 0xc0, 0x45,
+                               0x52, 0x71, 0x52, 0x71, 0x52, 0x71, 0x52, 0x71,
+                               0x52, 0x71, 0x52, 0x71, 0x52, 0x71, 0x52, 0x71,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x80, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x00, 0x00,
+                               0x00, 0x00, 0x00, 0x00, 0x06, 0x80, 0x80, 0x00,
+
+/*
+ * Not really sure if this is actually the power_limit database,
+ * it looks a bit "related" to PDR_PRISM_ZIF_TX_IQ_CALIBRATION
+ */
+/* struct pda_custom_wrapper */
+0xae, 0x00, 0xef, 0xbe,      /* PDR_PRISM_PA_CAL_OUTPUT_POWER_LIMITS_CUSTOM */
+       0x0d, 0x00, 0x1a, 0x00,         /* 13 entries, 26 bytes per entry */
+       0x00, 0x00, 0x52, 0x01,         /* no offset, 338 bytes total */
+
+               /* 2412 MHz */
+               0x6c, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00, 0xe0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2417 MHz */
+               0x71, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2422 MHz */
+               0x76, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2427 MHz */
+               0x7b, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2432 MHz */
+               0x80, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2437 MHz */
+               0x85, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2442 MHz */
+               0x8a, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2447 MHz */
+               0x8f, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2452 MHz */
+               0x94, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2457 MHz */
+               0x99, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2462 MHz */
+               0x9e, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2467 MHz */
+               0xa3, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+               /* 2472 MHz */
+               0xa8, 0x09,
+                       0x10, 0x01, 0x10, 0x01, 0x10, 0x01, 0x10, 0x01,
+                       0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00, 0xf0, 0x00,
+                       0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00, 0xd0, 0x00,
+
+/* struct pda_iq_autocal_entry[13] */
+0x42, 0x00, 0x06, 0x19,                /* PDR_PRISM_ZIF_TX_IQ_CALIBRATION */
+       /* 2412 MHz */
+       0x6c, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2417 MHz */
+       0x71, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2422 MHz */
+       0x76, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2427 MHz */
+       0x7b, 0x09, 0x26, 0x00, 0xf8, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2432 MHz */
+       0x80, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2437 MHz */
+       0x85, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2442 MHz */
+       0x8a, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2447 MHz */
+       0x8f, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2452 MHz */
+       0x94, 0x09, 0x25, 0x00, 0xf7, 0xff, 0xf7, 0xff, 0xff, 0x00,
+       /* 2457 MHz */
+       0x99, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01,
+       /* 2462 MHz */
+       0x9e, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01,
+       /* 2467 MHz */
+       0xa3, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01,
+       /* 2472 MHz */
+       0xa8, 0x09, 0x25, 0x00, 0xf5, 0xff, 0xf9, 0xff, 0x00, 0x01,
+
+0x02, 0x00, 0x00, 0x00,                /* PDR_END */
+       0xa8, 0xf5                      /* bogus data */
+};
+
+#endif /* P54SPI_EEPROM_H */
+
index 5de2ebfb28c7ef9b722c3a4028a2c6e5c7c25497..9539ddcf379ff08cedc0a2b93daf05594a97f425 100644 (file)
@@ -424,9 +424,46 @@ static int p54u_bulk_msg(struct p54u_priv *priv, unsigned int ep,
                            data, len, &alen, 2000);
 }
 
+static const char p54u_romboot_3887[] = "~~~~";
+static const char p54u_firmware_upload_3887[] = "<\r";
+
+static int p54u_device_reset_3887(struct ieee80211_hw *dev)
+{
+       struct p54u_priv *priv = dev->priv;
+       int ret, lock = (priv->intf->condition != USB_INTERFACE_BINDING);
+       u8 buf[4];
+
+       if (lock) {
+               ret = usb_lock_device_for_reset(priv->udev, priv->intf);
+               if (ret < 0) {
+                       dev_err(&priv->udev->dev, "(p54usb) unable to lock "
+                               " device for reset: %d\n", ret);
+                       return ret;
+               }
+       }
+
+       ret = usb_reset_device(priv->udev);
+       if (lock)
+               usb_unlock_device(priv->udev);
+
+       if (ret) {
+               dev_err(&priv->udev->dev, "(p54usb) unable to reset "
+                       "device: %d\n", ret);
+               return ret;
+       }
+
+       memcpy(&buf, p54u_romboot_3887, sizeof(buf));
+       ret = p54u_bulk_msg(priv, P54U_PIPE_DATA,
+                           buf, sizeof(buf));
+       if (ret)
+               dev_err(&priv->udev->dev, "(p54usb) unable to jump to "
+                       "boot ROM: %d\n", ret);
+
+       return ret;
+}
+
 static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
 {
-       static char start_string[] = "~~~~<\r";
        struct p54u_priv *priv = dev->priv;
        const struct firmware *fw_entry = NULL;
        int err, alen;
@@ -445,12 +482,9 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
                goto err_bufalloc;
        }
 
-       memcpy(buf, start_string, 4);
-       err = p54u_bulk_msg(priv, P54U_PIPE_DATA, buf, 4);
-       if (err) {
-               dev_err(&priv->udev->dev, "(p54usb) reset failed! (%d)\n", err);
+       err = p54u_device_reset_3887(dev);
+       if (err)
                goto err_reset;
-       }
 
        err = request_firmware(&fw_entry, "isl3887usb", &priv->udev->dev);
        if (err) {
@@ -466,15 +500,22 @@ static int p54u_upload_firmware_3887(struct ieee80211_hw *dev)
        if (err)
                goto err_upload_failed;
 
+       if (priv->common.fw_interface != FW_LM87) {
+               dev_err(&priv->udev->dev, "wrong firmware, "
+                       "please get a LM87 firmware and try again.\n");
+               err = -EINVAL;
+               goto err_upload_failed;
+       }
+
        left = block_size = min((size_t)P54U_FW_BLOCK, fw_entry->size);
-       strcpy(buf, start_string);
-       left -= strlen(start_string);
-       tmp += strlen(start_string);
+       strcpy(buf, p54u_firmware_upload_3887);
+       left -= strlen(p54u_firmware_upload_3887);
+       tmp += strlen(p54u_firmware_upload_3887);
 
        data = fw_entry->data;
        remains = fw_entry->size;
 
-       hdr = (struct x2_header *)(buf + strlen(start_string));
+       hdr = (struct x2_header *)(buf + strlen(p54u_firmware_upload_3887));
        memcpy(hdr->signature, X2_SIGNATURE, X2_SIGNATURE_SIZE);
        hdr->fw_load_addr = cpu_to_le32(ISL38XX_DEV_FIRMWARE_ADDR);
        hdr->fw_length = cpu_to_le32(fw_entry->size);
@@ -616,6 +657,14 @@ static int p54u_upload_firmware_net2280(struct ieee80211_hw *dev)
                return err;
        }
 
+       if (priv->common.fw_interface != FW_LM86) {
+               dev_err(&priv->udev->dev, "wrong firmware, "
+                       "please get a LM86(USB) firmware and try again.\n");
+               kfree(buf);
+               release_firmware(fw_entry);
+               return -EINVAL;
+       }
+
 #define P54U_WRITE(type, addr, data) \
        do {\
                err = p54u_write(priv, buf, type,\
@@ -876,6 +925,9 @@ static int __devinit p54u_probe(struct usb_interface *intf,
        SET_IEEE80211_DEV(dev, &intf->dev);
        usb_set_intfdata(intf, dev);
        priv->udev = udev;
+       priv->intf = intf;
+       skb_queue_head_init(&priv->rx_queue);
+       init_usb_anchor(&priv->submitted);
 
        usb_get_dev(udev);
 
@@ -918,9 +970,6 @@ static int __devinit p54u_probe(struct usb_interface *intf,
        if (err)
                goto err_free_dev;
 
-       skb_queue_head_init(&priv->rx_queue);
-       init_usb_anchor(&priv->submitted);
-
        p54u_open(dev);
        err = p54_read_eeprom(dev);
        p54u_stop(dev);
@@ -958,11 +1007,23 @@ static void __devexit p54u_disconnect(struct usb_interface *intf)
        ieee80211_free_hw(dev);
 }
 
+static int p54u_pre_reset(struct usb_interface *intf)
+{
+       return 0;
+}
+
+static int p54u_post_reset(struct usb_interface *intf)
+{
+       return 0;
+}
+
 static struct usb_driver p54u_driver = {
        .name   = "p54usb",
        .id_table = p54u_table,
        .probe = p54u_probe,
        .disconnect = p54u_disconnect,
+       .pre_reset = p54u_pre_reset,
+       .post_reset = p54u_post_reset,
 };
 
 static int __init p54u_init(void)
index 54ee738bf2af66c8503ea549d21ff1797b0de4b7..8bc58982d8dd703ea3478882920dd1adcae68d71 100644 (file)
@@ -126,6 +126,7 @@ struct p54u_rx_info {
 struct p54u_priv {
        struct p54_common common;
        struct usb_device *udev;
+       struct usb_interface *intf;
        enum {
                P54U_NET2280 = 0,
                P54U_3887
index 57a150a22de5c6544bee00f7799e5b2caf9164e6..4c97c6ad6f5dea80cfee1869551e1ea32d50818d 100644 (file)
@@ -2981,7 +2981,8 @@ prism54_set_spy(struct net_device *ndev,
                union iwreq_data *uwrq, char *extra)
 {
        islpci_private *priv = netdev_priv(ndev);
-       u32 u, oid = OID_INL_CONFIG;
+       u32 u;
+       enum oid_num_t oid = OID_INL_CONFIG;
 
        down_write(&priv->mib_sem);
        mgt_get(priv, OID_INL_CONFIG, &u);
index e43bae97ed8f66a6bc9ccb9eeb86a66a6db0302c..88895bd9e495b024847ba2ed221224c79328a454 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/if_arp.h>
+#include <asm/byteorder.h>
 
 #include "prismcompat.h"
 #include "isl_38xx.h"
@@ -471,8 +472,8 @@ islpci_eth_receive(islpci_private *priv)
                wmb();
 
                /* increment the driver read pointer */
-               add_le32p(&control_block->
-                         driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1);
+               le32_add_cpu(&control_block->
+                            driver_curr_frag[ISL38XX_CB_RX_DATA_LQ], 1);
        }
 
        /* trigger the device */
index f91a88fc1e35b0023faf78daf85780fafb17f495..87a1734663dac15fb91b5ce599e20970cf3a1d8a 100644 (file)
@@ -85,12 +85,6 @@ extern int pc_debug;
 #define PIMFOR_FLAG_APPLIC_ORIGIN               0x01
 #define PIMFOR_FLAG_LITTLE_ENDIAN               0x02
 
-static inline void
-add_le32p(__le32 * le_number, u32 add)
-{
-       *le_number = cpu_to_le32(le32_to_cpup(le_number) + add);
-}
-
 void display_buffer(char *, int);
 
 /*
index 57a4ac34bed6cd2eefcb9034ae5a85ec75bfc642..1187e6112a641ee1de6cbc6c8ac80d1cee4a40d9 100644 (file)
@@ -698,7 +698,7 @@ int
 mgt_commit(islpci_private *priv)
 {
        int rvalue;
-       u32 u;
+       enum oid_num_t u;
 
        if (islpci_get_state(priv) < PRV_STATE_INIT)
                return 0;
index ed93ac41297f036caf6c7cff6d7ad797008007d4..82af21eeb5921c461056a2f9bbd91e024e640c82 100644 (file)
@@ -90,44 +90,44 @@ MODULE_PARM_DESC(workaround_interval,
 
 
 /* various RNDIS OID defs */
-#define OID_GEN_LINK_SPEED                     ccpu2(0x00010107)
-#define OID_GEN_RNDIS_CONFIG_PARAMETER         ccpu2(0x0001021b)
-
-#define OID_GEN_XMIT_OK                                ccpu2(0x00020101)
-#define OID_GEN_RCV_OK                         ccpu2(0x00020102)
-#define OID_GEN_XMIT_ERROR                     ccpu2(0x00020103)
-#define OID_GEN_RCV_ERROR                      ccpu2(0x00020104)
-#define OID_GEN_RCV_NO_BUFFER                  ccpu2(0x00020105)
-
-#define OID_802_3_PERMANENT_ADDRESS            ccpu2(0x01010101)
-#define OID_802_3_CURRENT_ADDRESS              ccpu2(0x01010102)
-#define OID_802_3_MULTICAST_LIST               ccpu2(0x01010103)
-#define OID_802_3_MAXIMUM_LIST_SIZE            ccpu2(0x01010104)
-
-#define OID_802_11_BSSID                       ccpu2(0x0d010101)
-#define OID_802_11_SSID                                ccpu2(0x0d010102)
-#define OID_802_11_INFRASTRUCTURE_MODE         ccpu2(0x0d010108)
-#define OID_802_11_ADD_WEP                     ccpu2(0x0d010113)
-#define OID_802_11_REMOVE_WEP                  ccpu2(0x0d010114)
-#define OID_802_11_DISASSOCIATE                        ccpu2(0x0d010115)
-#define OID_802_11_AUTHENTICATION_MODE         ccpu2(0x0d010118)
-#define OID_802_11_PRIVACY_FILTER              ccpu2(0x0d010119)
-#define OID_802_11_BSSID_LIST_SCAN             ccpu2(0x0d01011a)
-#define OID_802_11_ENCRYPTION_STATUS           ccpu2(0x0d01011b)
-#define OID_802_11_ADD_KEY                     ccpu2(0x0d01011d)
-#define OID_802_11_REMOVE_KEY                  ccpu2(0x0d01011e)
-#define OID_802_11_ASSOCIATION_INFORMATION     ccpu2(0x0d01011f)
-#define OID_802_11_PMKID                       ccpu2(0x0d010123)
-#define OID_802_11_NETWORK_TYPES_SUPPORTED     ccpu2(0x0d010203)
-#define OID_802_11_NETWORK_TYPE_IN_USE         ccpu2(0x0d010204)
-#define OID_802_11_TX_POWER_LEVEL              ccpu2(0x0d010205)
-#define OID_802_11_RSSI                                ccpu2(0x0d010206)
-#define OID_802_11_RSSI_TRIGGER                        ccpu2(0x0d010207)
-#define OID_802_11_FRAGMENTATION_THRESHOLD     ccpu2(0x0d010209)
-#define OID_802_11_RTS_THRESHOLD               ccpu2(0x0d01020a)
-#define OID_802_11_SUPPORTED_RATES             ccpu2(0x0d01020e)
-#define OID_802_11_CONFIGURATION               ccpu2(0x0d010211)
-#define OID_802_11_BSSID_LIST                  ccpu2(0x0d010217)
+#define OID_GEN_LINK_SPEED                     cpu_to_le32(0x00010107)
+#define OID_GEN_RNDIS_CONFIG_PARAMETER         cpu_to_le32(0x0001021b)
+
+#define OID_GEN_XMIT_OK                                cpu_to_le32(0x00020101)
+#define OID_GEN_RCV_OK                         cpu_to_le32(0x00020102)
+#define OID_GEN_XMIT_ERROR                     cpu_to_le32(0x00020103)
+#define OID_GEN_RCV_ERROR                      cpu_to_le32(0x00020104)
+#define OID_GEN_RCV_NO_BUFFER                  cpu_to_le32(0x00020105)
+
+#define OID_802_3_PERMANENT_ADDRESS            cpu_to_le32(0x01010101)
+#define OID_802_3_CURRENT_ADDRESS              cpu_to_le32(0x01010102)
+#define OID_802_3_MULTICAST_LIST               cpu_to_le32(0x01010103)
+#define OID_802_3_MAXIMUM_LIST_SIZE            cpu_to_le32(0x01010104)
+
+#define OID_802_11_BSSID                       cpu_to_le32(0x0d010101)
+#define OID_802_11_SSID                                cpu_to_le32(0x0d010102)
+#define OID_802_11_INFRASTRUCTURE_MODE         cpu_to_le32(0x0d010108)
+#define OID_802_11_ADD_WEP                     cpu_to_le32(0x0d010113)
+#define OID_802_11_REMOVE_WEP                  cpu_to_le32(0x0d010114)
+#define OID_802_11_DISASSOCIATE                        cpu_to_le32(0x0d010115)
+#define OID_802_11_AUTHENTICATION_MODE         cpu_to_le32(0x0d010118)
+#define OID_802_11_PRIVACY_FILTER              cpu_to_le32(0x0d010119)
+#define OID_802_11_BSSID_LIST_SCAN             cpu_to_le32(0x0d01011a)
+#define OID_802_11_ENCRYPTION_STATUS           cpu_to_le32(0x0d01011b)
+#define OID_802_11_ADD_KEY                     cpu_to_le32(0x0d01011d)
+#define OID_802_11_REMOVE_KEY                  cpu_to_le32(0x0d01011e)
+#define OID_802_11_ASSOCIATION_INFORMATION     cpu_to_le32(0x0d01011f)
+#define OID_802_11_PMKID                       cpu_to_le32(0x0d010123)
+#define OID_802_11_NETWORK_TYPES_SUPPORTED     cpu_to_le32(0x0d010203)
+#define OID_802_11_NETWORK_TYPE_IN_USE         cpu_to_le32(0x0d010204)
+#define OID_802_11_TX_POWER_LEVEL              cpu_to_le32(0x0d010205)
+#define OID_802_11_RSSI                                cpu_to_le32(0x0d010206)
+#define OID_802_11_RSSI_TRIGGER                        cpu_to_le32(0x0d010207)
+#define OID_802_11_FRAGMENTATION_THRESHOLD     cpu_to_le32(0x0d010209)
+#define OID_802_11_RTS_THRESHOLD               cpu_to_le32(0x0d01020a)
+#define OID_802_11_SUPPORTED_RATES             cpu_to_le32(0x0d01020e)
+#define OID_802_11_CONFIGURATION               cpu_to_le32(0x0d010211)
+#define OID_802_11_BSSID_LIST                  cpu_to_le32(0x0d010217)
 
 
 /* Typical noise/maximum signal level values taken from ndiswrapper iw_ndis.h */
@@ -144,8 +144,8 @@ MODULE_PARM_DESC(workaround_interval,
 
 
 /* codes for "status" field of completion messages */
-#define RNDIS_STATUS_ADAPTER_NOT_READY         ccpu2(0xc0010011)
-#define RNDIS_STATUS_ADAPTER_NOT_OPEN          ccpu2(0xc0010012)
+#define RNDIS_STATUS_ADAPTER_NOT_READY         cpu_to_le32(0xc0010011)
+#define RNDIS_STATUS_ADAPTER_NOT_OPEN          cpu_to_le32(0xc0010012)
 
 
 /* NDIS data structures. Taken from wpa_supplicant driver_ndis.c
@@ -369,9 +369,6 @@ struct rndis_wext_private {
 };
 
 
-static const int freq_chan[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442,
-                               2447, 2452, 2457, 2462, 2467, 2472, 2484 };
-
 static const int rates_80211g[8] = { 6, 9, 12, 18, 24, 36, 48, 54 };
 
 static const int bcm4320_power_output[4] = { 25, 50, 75, 100 };
@@ -445,7 +442,7 @@ static int rndis_query_oid(struct usbnet *dev, __le32 oid, void *data, int *len)
 
        memset(u.get, 0, sizeof *u.get);
        u.get->msg_type = RNDIS_MSG_QUERY;
-       u.get->msg_len = ccpu2(sizeof *u.get);
+       u.get->msg_len = cpu_to_le32(sizeof *u.get);
        u.get->oid = oid;
 
        ret = rndis_command(dev, u.header, buflen);
@@ -494,8 +491,8 @@ static int rndis_set_oid(struct usbnet *dev, __le32 oid, void *data, int len)
        u.set->msg_len = cpu_to_le32(sizeof(*u.set) + len);
        u.set->oid = oid;
        u.set->len = cpu_to_le32(len);
-       u.set->offset = ccpu2(sizeof(*u.set) - 8);
-       u.set->handle = ccpu2(0);
+       u.set->offset = cpu_to_le32(sizeof(*u.set) - 8);
+       u.set->handle = cpu_to_le32(0);
        memcpy(u.buf + sizeof(*u.set), data, len);
 
        ret = rndis_command(dev, u.header, buflen);
@@ -640,8 +637,8 @@ static void dsconfig_to_freq(unsigned int dsconfig, struct iw_freq *freq)
 static int freq_to_dsconfig(struct iw_freq *freq, unsigned int *dsconfig)
 {
        if (freq->m < 1000 && freq->e == 0) {
-               if (freq->m >= 1 && freq->m <= ARRAY_SIZE(freq_chan))
-                       *dsconfig = freq_chan[freq->m - 1] * 1000;
+               if (freq->m >= 1 && freq->m <= 14)
+                       *dsconfig = ieee80211_dsss_chan_to_freq(freq->m) * 1000;
                else
                        return -1;
        } else {
@@ -1178,11 +1175,11 @@ static int rndis_iw_get_range(struct net_device *dev,
                range->throughput = 11 * 1000 * 1000 / 2;
        }
 
-       range->num_channels = ARRAY_SIZE(freq_chan);
+       range->num_channels = 14;
 
-       for (i = 0; i < ARRAY_SIZE(freq_chan) && i < IW_MAX_FREQUENCIES; i++) {
+       for (i = 0; (i < 14) && (i < IW_MAX_FREQUENCIES); i++) {
                range->freq[i].i = i + 1;
-               range->freq[i].m = freq_chan[i] * 100000;
+               range->freq[i].m = ieee80211_dsss_chan_to_freq(i + 1) * 100000;
                range->freq[i].e = 1;
        }
        range->num_frequency = i;
@@ -1633,7 +1630,7 @@ static int rndis_iw_set_scan(struct net_device *dev,
        devdbg(usbdev, "SIOCSIWSCAN");
 
        if (wrqu->data.flags == 0) {
-               tmp = ccpu2(1);
+               tmp = cpu_to_le32(1);
                ret = rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp,
                                                                sizeof(tmp));
                evt.data.flags = 0;
@@ -2431,7 +2428,7 @@ static void rndis_update_wireless_stats(struct work_struct *work)
                /* Send scan OID. Use of both OIDs is required to get device
                 * working.
                 */
-               tmp = ccpu2(1);
+               tmp = cpu_to_le32(1);
                rndis_set_oid(usbdev, OID_802_11_BSSID_LIST_SCAN, &tmp,
                                                                sizeof(tmp));
 
index 178b313293b4537a45d3f00f7e6a9b6078802439..bfc5d9cf716e83b52e5c5a5aa749ff1491dfb15f 100644 (file)
@@ -97,10 +97,11 @@ config RT2X00_LIB_CRYPTO
 
 config RT2X00_LIB_RFKILL
        boolean
-       default y if (RT2X00_LIB=y && RFKILL=y) || (RT2X00_LIB=m && RFKILL!=n)
+       default y if (RT2X00_LIB=y && INPUT=y) || (RT2X00_LIB=m && INPUT!=n)
+       select INPUT_POLLDEV
 
-comment "rt2x00 rfkill support disabled due to modularized RFKILL and built-in rt2x00"
-       depends on RT2X00_LIB=y && RFKILL=m
+comment "rt2x00 rfkill support disabled due to modularized INPUT and built-in rt2x00"
+       depends on RT2X00_LIB=y && INPUT=m
 
 config RT2X00_LIB_LEDS
        boolean
index 917cb4f3b038948792bd241dc3c1ce3b49e130d2..f22d808d8c511bb8958d1f52268b0db02af3f823 100644 (file)
@@ -2,6 +2,7 @@ rt2x00lib-y                             += rt2x00dev.o
 rt2x00lib-y                            += rt2x00mac.o
 rt2x00lib-y                            += rt2x00config.o
 rt2x00lib-y                            += rt2x00queue.o
+rt2x00lib-y                            += rt2x00link.o
 rt2x00lib-$(CONFIG_RT2X00_LIB_DEBUGFS) += rt2x00debug.o
 rt2x00lib-$(CONFIG_RT2X00_LIB_CRYPTO)  += rt2x00crypto.o
 rt2x00lib-$(CONFIG_RT2X00_LIB_RFKILL)  += rt2x00rfkill.o
index 6a977679124d549a954eb78a27b89b9cf7c304c3..b0848259b45553ab7d8aa132f6e51ef874b7858b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -524,6 +524,32 @@ static void rt2400pci_config_duration(struct rt2x00_dev *rt2x00dev,
        rt2x00pci_register_write(rt2x00dev, CSR12, reg);
 }
 
+static void rt2400pci_config_ps(struct rt2x00_dev *rt2x00dev,
+                               struct rt2x00lib_conf *libconf)
+{
+       enum dev_state state =
+           (libconf->conf->flags & IEEE80211_CONF_PS) ?
+               STATE_SLEEP : STATE_AWAKE;
+       u32 reg;
+
+       if (state == STATE_SLEEP) {
+               rt2x00pci_register_read(rt2x00dev, CSR20, &reg);
+               rt2x00_set_field32(&reg, CSR20_DELAY_AFTER_TBCN,
+                                  (libconf->conf->beacon_int - 20) * 16);
+               rt2x00_set_field32(&reg, CSR20_TBCN_BEFORE_WAKEUP,
+                                  libconf->conf->listen_interval - 1);
+
+               /* We must first disable autowake before it can be enabled */
+               rt2x00_set_field32(&reg, CSR20_AUTOWAKE, 0);
+               rt2x00pci_register_write(rt2x00dev, CSR20, reg);
+
+               rt2x00_set_field32(&reg, CSR20_AUTOWAKE, 1);
+               rt2x00pci_register_write(rt2x00dev, CSR20, reg);
+       }
+
+       rt2x00dev->ops->lib->set_device_state(rt2x00dev, state);
+}
+
 static void rt2400pci_config(struct rt2x00_dev *rt2x00dev,
                             struct rt2x00lib_conf *libconf,
                             const unsigned int flags)
@@ -537,6 +563,8 @@ static void rt2400pci_config(struct rt2x00_dev *rt2x00dev,
                rt2400pci_config_retry_limit(rt2x00dev, libconf);
        if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
                rt2400pci_config_duration(rt2x00dev, libconf);
+       if (flags & IEEE80211_CONF_CHANGE_PS)
+               rt2400pci_config_ps(rt2x00dev, libconf);
 }
 
 static void rt2400pci_config_cw(struct rt2x00_dev *rt2x00dev,
@@ -572,35 +600,37 @@ static void rt2400pci_link_stats(struct rt2x00_dev *rt2x00dev,
        qual->false_cca = bbp;
 }
 
-static void rt2400pci_reset_tuner(struct rt2x00_dev *rt2x00dev)
+static inline void rt2400pci_set_vgc(struct rt2x00_dev *rt2x00dev,
+                                    struct link_qual *qual, u8 vgc_level)
 {
-       rt2400pci_bbp_write(rt2x00dev, 13, 0x08);
-       rt2x00dev->link.vgc_level = 0x08;
+       rt2400pci_bbp_write(rt2x00dev, 13, vgc_level);
+       qual->vgc_level = vgc_level;
+       qual->vgc_level_reg = vgc_level;
 }
 
-static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev)
+static void rt2400pci_reset_tuner(struct rt2x00_dev *rt2x00dev,
+                                 struct link_qual *qual)
 {
-       u8 reg;
+       rt2400pci_set_vgc(rt2x00dev, qual, 0x08);
+}
 
+static void rt2400pci_link_tuner(struct rt2x00_dev *rt2x00dev,
+                                struct link_qual *qual, const u32 count)
+{
        /*
         * The link tuner should not run longer then 60 seconds,
         * and should run once every 2 seconds.
         */
-       if (rt2x00dev->link.count > 60 || !(rt2x00dev->link.count & 1))
+       if (count > 60 || !(count & 1))
                return;
 
        /*
         * Base r13 link tuning on the false cca count.
         */
-       rt2400pci_bbp_read(rt2x00dev, 13, &reg);
-
-       if (rt2x00dev->link.qual.false_cca > 512 && reg < 0x20) {
-               rt2400pci_bbp_write(rt2x00dev, 13, ++reg);
-               rt2x00dev->link.vgc_level = reg;
-       } else if (rt2x00dev->link.qual.false_cca < 100 && reg > 0x08) {
-               rt2400pci_bbp_write(rt2x00dev, 13, --reg);
-               rt2x00dev->link.vgc_level = reg;
-       }
+       if ((qual->false_cca > 512) && (qual->vgc_level < 0x20))
+               rt2400pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level);
+       else if ((qual->false_cca < 100) && (qual->vgc_level > 0x08))
+               rt2400pci_set_vgc(rt2x00dev, qual, --qual->vgc_level);
 }
 
 /*
@@ -904,21 +934,10 @@ static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev)
 
 static void rt2400pci_disable_radio(struct rt2x00_dev *rt2x00dev)
 {
-       u32 reg;
-
-       rt2x00pci_register_write(rt2x00dev, PWRCSR0, 0);
-
-       /*
-        * Disable synchronisation.
-        */
-       rt2x00pci_register_write(rt2x00dev, CSR14, 0);
-
        /*
-        * Cancel RX and TX.
+        * Disable power
         */
-       rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
-       rt2x00_set_field32(&reg, TXCSR0_ABORT, 1);
-       rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
+       rt2x00pci_register_write(rt2x00dev, PWRCSR0, 0);
 }
 
 static int rt2400pci_set_state(struct rt2x00_dev *rt2x00dev,
@@ -1115,6 +1134,20 @@ static void rt2400pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
        rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
 }
 
+static void rt2400pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev,
+                                   const enum data_queue_qid qid)
+{
+       u32 reg;
+
+       if (qid == QID_BEACON) {
+               rt2x00pci_register_write(rt2x00dev, CSR14, 0);
+       } else {
+               rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
+               rt2x00_set_field32(&reg, TXCSR0_ABORT, 1);
+               rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
+       }
+}
+
 /*
  * RX control handlers
  */
@@ -1365,7 +1398,9 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
        value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE);
 
        rt2400pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
-       if (value == LED_MODE_TXRX_ACTIVITY)
+       if (value == LED_MODE_TXRX_ACTIVITY ||
+           value == LED_MODE_DEFAULT ||
+           value == LED_MODE_ASUS)
                rt2400pci_init_led(rt2x00dev, &rt2x00dev->led_qual,
                                   LED_TYPE_ACTIVITY);
 #endif /* CONFIG_RT2X00_LIB_LEDS */
@@ -1419,7 +1454,9 @@ static int rt2400pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
         * Initialize all hw fields.
         */
        rt2x00dev->hw->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-                              IEEE80211_HW_SIGNAL_DBM;
+                              IEEE80211_HW_SIGNAL_DBM |
+                              IEEE80211_HW_SUPPORTS_PS |
+                              IEEE80211_HW_PS_NULLFUNC_STACK;
        rt2x00dev->hw->extra_tx_headroom = 0;
 
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
@@ -1572,6 +1609,7 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = {
        .write_tx_data          = rt2x00pci_write_tx_data,
        .write_beacon           = rt2400pci_write_beacon,
        .kick_tx_queue          = rt2400pci_kick_tx_queue,
+       .kill_tx_queue          = rt2400pci_kill_tx_queue,
        .fill_rxdone            = rt2400pci_fill_rxdone,
        .config_filter          = rt2400pci_config_filter,
        .config_intf            = rt2400pci_config_intf,
index 9aefda4ab3c263c4163543fff32a7853b8139ec8..72ac31c3cb759db0672024cdbfec2248ceaa9db4 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
index d3bc218ec85cc2debcd5dfd52e8c00fcdf4124bf..eb82860c54f9e49a068c58af7c3cd22394c138d6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -573,6 +573,32 @@ static void rt2500pci_config_duration(struct rt2x00_dev *rt2x00dev,
        rt2x00pci_register_write(rt2x00dev, CSR12, reg);
 }
 
+static void rt2500pci_config_ps(struct rt2x00_dev *rt2x00dev,
+                               struct rt2x00lib_conf *libconf)
+{
+       enum dev_state state =
+           (libconf->conf->flags & IEEE80211_CONF_PS) ?
+               STATE_SLEEP : STATE_AWAKE;
+       u32 reg;
+
+       if (state == STATE_SLEEP) {
+               rt2x00pci_register_read(rt2x00dev, CSR20, &reg);
+               rt2x00_set_field32(&reg, CSR20_DELAY_AFTER_TBCN,
+                                  (libconf->conf->beacon_int - 20) * 16);
+               rt2x00_set_field32(&reg, CSR20_TBCN_BEFORE_WAKEUP,
+                                  libconf->conf->listen_interval - 1);
+
+               /* We must first disable autowake before it can be enabled */
+               rt2x00_set_field32(&reg, CSR20_AUTOWAKE, 0);
+               rt2x00pci_register_write(rt2x00dev, CSR20, reg);
+
+               rt2x00_set_field32(&reg, CSR20_AUTOWAKE, 1);
+               rt2x00pci_register_write(rt2x00dev, CSR20, reg);
+       }
+
+       rt2x00dev->ops->lib->set_device_state(rt2x00dev, state);
+}
+
 static void rt2500pci_config(struct rt2x00_dev *rt2x00dev,
                             struct rt2x00lib_conf *libconf,
                             const unsigned int flags)
@@ -588,6 +614,8 @@ static void rt2500pci_config(struct rt2x00_dev *rt2x00dev,
                rt2500pci_config_retry_limit(rt2x00dev, libconf);
        if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
                rt2500pci_config_duration(rt2x00dev, libconf);
+       if (flags & IEEE80211_CONF_CHANGE_PS)
+               rt2500pci_config_ps(rt2x00dev, libconf);
 }
 
 /*
@@ -611,29 +639,33 @@ static void rt2500pci_link_stats(struct rt2x00_dev *rt2x00dev,
        qual->false_cca = rt2x00_get_field32(reg, CNT3_FALSE_CCA);
 }
 
-static void rt2500pci_reset_tuner(struct rt2x00_dev *rt2x00dev)
+static inline void rt2500pci_set_vgc(struct rt2x00_dev *rt2x00dev,
+                                    struct link_qual *qual, u8 vgc_level)
 {
-       rt2500pci_bbp_write(rt2x00dev, 17, 0x48);
-       rt2x00dev->link.vgc_level = 0x48;
+       if (qual->vgc_level_reg != vgc_level) {
+               rt2500pci_bbp_write(rt2x00dev, 17, vgc_level);
+               qual->vgc_level_reg = vgc_level;
+       }
 }
 
-static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)
+static void rt2500pci_reset_tuner(struct rt2x00_dev *rt2x00dev,
+                                 struct link_qual *qual)
 {
-       int rssi = rt2x00_get_link_rssi(&rt2x00dev->link);
-       u8 r17;
+       rt2500pci_set_vgc(rt2x00dev, qual, 0x48);
+}
 
+static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev,
+                                struct link_qual *qual, const u32 count)
+{
        /*
         * To prevent collisions with MAC ASIC on chipsets
         * up to version C the link tuning should halt after 20
         * seconds while being associated.
         */
        if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D &&
-           rt2x00dev->intf_associated &&
-           rt2x00dev->link.count > 20)
+           rt2x00dev->intf_associated && count > 20)
                return;
 
-       rt2500pci_bbp_read(rt2x00dev, 17, &r17);
-
        /*
         * Chipset versions C and lower should directly continue
         * to the dynamic CCA tuning. Chipset version D and higher
@@ -649,29 +681,25 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)
         * then corrupt the R17 tuning. To remidy this the tuning should
         * be stopped (While making sure the R17 value will not exceed limits)
         */
-       if (rssi < -80 && rt2x00dev->link.count > 20) {
-               if (r17 >= 0x41) {
-                       r17 = rt2x00dev->link.vgc_level;
-                       rt2500pci_bbp_write(rt2x00dev, 17, r17);
-               }
+       if (qual->rssi < -80 && count > 20) {
+               if (qual->vgc_level_reg >= 0x41)
+                       rt2500pci_set_vgc(rt2x00dev, qual, qual->vgc_level);
                return;
        }
 
        /*
         * Special big-R17 for short distance
         */
-       if (rssi >= -58) {
-               if (r17 != 0x50)
-                       rt2500pci_bbp_write(rt2x00dev, 17, 0x50);
+       if (qual->rssi >= -58) {
+               rt2500pci_set_vgc(rt2x00dev, qual, 0x50);
                return;
        }
 
        /*
         * Special mid-R17 for middle distance
         */
-       if (rssi >= -74) {
-               if (r17 != 0x41)
-                       rt2500pci_bbp_write(rt2x00dev, 17, 0x41);
+       if (qual->rssi >= -74) {
+               rt2500pci_set_vgc(rt2x00dev, qual, 0x41);
                return;
        }
 
@@ -679,8 +707,8 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev)
         * Leave short or middle distance condition, restore r17
         * to the dynamic tuning range.
         */
-       if (r17 >= 0x41) {
-               rt2500pci_bbp_write(rt2x00dev, 17, rt2x00dev->link.vgc_level);
+       if (qual->vgc_level_reg >= 0x41) {
+               rt2500pci_set_vgc(rt2x00dev, qual, qual->vgc_level);
                return;
        }
 
@@ -690,12 +718,12 @@ dynamic_cca_tune:
         * R17 is inside the dynamic tuning range,
         * start tuning the link based on the false cca counter.
         */
-       if (rt2x00dev->link.qual.false_cca > 512 && r17 < 0x40) {
-               rt2500pci_bbp_write(rt2x00dev, 17, ++r17);
-               rt2x00dev->link.vgc_level = r17;
-       } else if (rt2x00dev->link.qual.false_cca < 100 && r17 > 0x32) {
-               rt2500pci_bbp_write(rt2x00dev, 17, --r17);
-               rt2x00dev->link.vgc_level = r17;
+       if (qual->false_cca > 512 && qual->vgc_level_reg < 0x40) {
+               rt2500pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level_reg);
+               qual->vgc_level = qual->vgc_level_reg;
+       } else if (qual->false_cca < 100 && qual->vgc_level_reg > 0x32) {
+               rt2500pci_set_vgc(rt2x00dev, qual, --qual->vgc_level_reg);
+               qual->vgc_level = qual->vgc_level_reg;
        }
 }
 
@@ -1065,21 +1093,10 @@ static int rt2500pci_enable_radio(struct rt2x00_dev *rt2x00dev)
 
 static void rt2500pci_disable_radio(struct rt2x00_dev *rt2x00dev)
 {
-       u32 reg;
-
-       rt2x00pci_register_write(rt2x00dev, PWRCSR0, 0);
-
-       /*
-        * Disable synchronisation.
-        */
-       rt2x00pci_register_write(rt2x00dev, CSR14, 0);
-
        /*
-        * Cancel RX and TX.
+        * Disable power
         */
-       rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
-       rt2x00_set_field32(&reg, TXCSR0_ABORT, 1);
-       rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
+       rt2x00pci_register_write(rt2x00dev, PWRCSR0, 0);
 }
 
 static int rt2500pci_set_state(struct rt2x00_dev *rt2x00dev,
@@ -1205,7 +1222,7 @@ static void rt2500pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags));
        rt2x00_set_field32(&word, TXD_W0_OFDM,
-                          test_bit(ENTRY_TXD_OFDM_RATE, &txdesc->flags));
+                          (txdesc->rate_mode == RATE_MODE_OFDM));
        rt2x00_set_field32(&word, TXD_W0_CIPHER_OWNER, 1);
        rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs);
        rt2x00_set_field32(&word, TXD_W0_RETRY_MODE,
@@ -1275,6 +1292,20 @@ static void rt2500pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
        rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
 }
 
+static void rt2500pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev,
+                                   const enum data_queue_qid qid)
+{
+       u32 reg;
+
+       if (qid == QID_BEACON) {
+               rt2x00pci_register_write(rt2x00dev, CSR14, 0);
+       } else {
+               rt2x00pci_register_read(rt2x00dev, TXCSR0, &reg);
+               rt2x00_set_field32(&reg, TXCSR0_ABORT, 1);
+               rt2x00pci_register_write(rt2x00dev, TXCSR0, reg);
+       }
+}
+
 /*
  * RX control handlers
  */
@@ -1524,7 +1555,9 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
        value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE);
 
        rt2500pci_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
-       if (value == LED_MODE_TXRX_ACTIVITY)
+       if (value == LED_MODE_TXRX_ACTIVITY ||
+           value == LED_MODE_DEFAULT ||
+           value == LED_MODE_ASUS)
                rt2500pci_init_led(rt2x00dev, &rt2x00dev->led_qual,
                                   LED_TYPE_ACTIVITY);
 #endif /* CONFIG_RT2X00_LIB_LEDS */
@@ -1721,7 +1754,9 @@ static int rt2500pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
         * Initialize all hw fields.
         */
        rt2x00dev->hw->flags = IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-                              IEEE80211_HW_SIGNAL_DBM;
+                              IEEE80211_HW_SIGNAL_DBM |
+                              IEEE80211_HW_SUPPORTS_PS |
+                              IEEE80211_HW_PS_NULLFUNC_STACK;
 
        rt2x00dev->hw->extra_tx_headroom = 0;
 
@@ -1873,6 +1908,7 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = {
        .write_tx_data          = rt2x00pci_write_tx_data,
        .write_beacon           = rt2500pci_write_beacon,
        .kick_tx_queue          = rt2500pci_kick_tx_queue,
+       .kill_tx_queue          = rt2500pci_kill_tx_queue,
        .fill_rxdone            = rt2500pci_fill_rxdone,
        .config_filter          = rt2500pci_config_filter,
        .config_intf            = rt2500pci_config_intf,
index e135247f7f89d6aae25fefc4bdb7673e54bfc706..17a0c9c8c18468e7592ed341ef9296e46db7711b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
index af6b5847be5ce4362a5c4256ad64d35238d9433b..270691ac23618295eca217ff1561b78b5e89bc5d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -280,6 +280,18 @@ static const struct rt2x00debug rt2500usb_rt2x00debug = {
 };
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 
+#ifdef CONFIG_RT2X00_LIB_RFKILL
+static int rt2500usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)
+{
+       u16 reg;
+
+       rt2500usb_register_read(rt2x00dev, MAC_CSR19, &reg);
+       return rt2x00_get_field32(reg, MAC_CSR19_BIT7);
+}
+#else
+#define rt2500usb_rfkill_poll  NULL
+#endif /* CONFIG_RT2X00_LIB_RFKILL */
+
 #ifdef CONFIG_RT2X00_LIB_LEDS
 static void rt2500usb_brightness_set(struct led_classdev *led_cdev,
                                     enum led_brightness brightness)
@@ -634,6 +646,32 @@ static void rt2500usb_config_duration(struct rt2x00_dev *rt2x00dev,
        rt2500usb_register_write(rt2x00dev, TXRX_CSR18, reg);
 }
 
+static void rt2500usb_config_ps(struct rt2x00_dev *rt2x00dev,
+                               struct rt2x00lib_conf *libconf)
+{
+       enum dev_state state =
+           (libconf->conf->flags & IEEE80211_CONF_PS) ?
+               STATE_SLEEP : STATE_AWAKE;
+       u16 reg;
+
+       if (state == STATE_SLEEP) {
+               rt2500usb_register_read(rt2x00dev, MAC_CSR18, &reg);
+               rt2x00_set_field16(&reg, MAC_CSR18_DELAY_AFTER_BEACON,
+                                  libconf->conf->beacon_int - 20);
+               rt2x00_set_field16(&reg, MAC_CSR18_BEACONS_BEFORE_WAKEUP,
+                                  libconf->conf->listen_interval - 1);
+
+               /* We must first disable autowake before it can be enabled */
+               rt2x00_set_field16(&reg, MAC_CSR18_AUTO_WAKE, 0);
+               rt2500usb_register_write(rt2x00dev, MAC_CSR18, reg);
+
+               rt2x00_set_field16(&reg, MAC_CSR18_AUTO_WAKE, 1);
+               rt2500usb_register_write(rt2x00dev, MAC_CSR18, reg);
+       }
+
+       rt2x00dev->ops->lib->set_device_state(rt2x00dev, state);
+}
+
 static void rt2500usb_config(struct rt2x00_dev *rt2x00dev,
                             struct rt2x00lib_conf *libconf,
                             const unsigned int flags)
@@ -647,6 +685,8 @@ static void rt2500usb_config(struct rt2x00_dev *rt2x00dev,
                                         libconf->conf->power_level);
        if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
                rt2500usb_config_duration(rt2x00dev, libconf);
+       if (flags & IEEE80211_CONF_CHANGE_PS)
+               rt2500usb_config_ps(rt2x00dev, libconf);
 }
 
 /*
@@ -670,7 +710,8 @@ static void rt2500usb_link_stats(struct rt2x00_dev *rt2x00dev,
        qual->false_cca = rt2x00_get_field16(reg, STA_CSR3_FALSE_CCA_ERROR);
 }
 
-static void rt2500usb_reset_tuner(struct rt2x00_dev *rt2x00dev)
+static void rt2500usb_reset_tuner(struct rt2x00_dev *rt2x00dev,
+                                 struct link_qual *qual)
 {
        u16 eeprom;
        u16 value;
@@ -691,7 +732,7 @@ static void rt2500usb_reset_tuner(struct rt2x00_dev *rt2x00dev)
        value = rt2x00_get_field16(eeprom, EEPROM_BBPTUNE_VGCUPPER);
        rt2500usb_bbp_write(rt2x00dev, 17, value);
 
-       rt2x00dev->link.vgc_level = value;
+       qual->vgc_level = value;
 }
 
 /*
@@ -1176,7 +1217,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags));
        rt2x00_set_field32(&word, TXD_W0_OFDM,
-                          test_bit(ENTRY_TXD_OFDM_RATE, &txdesc->flags));
+                          (txdesc->rate_mode == RATE_MODE_OFDM));
        rt2x00_set_field32(&word, TXD_W0_NEW_SEQ,
                           test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags));
        rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs);
@@ -1562,11 +1603,21 @@ static int rt2500usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
        value = rt2x00_get_field16(eeprom, EEPROM_ANTENNA_LED_MODE);
 
        rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_radio, LED_TYPE_RADIO);
-       if (value == LED_MODE_TXRX_ACTIVITY)
+       if (value == LED_MODE_TXRX_ACTIVITY ||
+           value == LED_MODE_DEFAULT ||
+           value == LED_MODE_ASUS)
                rt2500usb_init_led(rt2x00dev, &rt2x00dev->led_qual,
                                   LED_TYPE_ACTIVITY);
 #endif /* CONFIG_RT2X00_LIB_LEDS */
 
+       /*
+        * Detect if this device has an hardware controlled radio.
+        */
+#ifdef CONFIG_RT2X00_LIB_RFKILL
+       if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
+               __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+#endif /* CONFIG_RT2X00_LIB_RFKILL */
+
        /*
         * Check if the BBP tuning should be disabled.
         */
@@ -1752,7 +1803,9 @@ static int rt2500usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
        rt2x00dev->hw->flags =
            IEEE80211_HW_RX_INCLUDES_FCS |
            IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-           IEEE80211_HW_SIGNAL_DBM;
+           IEEE80211_HW_SIGNAL_DBM |
+           IEEE80211_HW_SUPPORTS_PS |
+           IEEE80211_HW_PS_NULLFUNC_STACK;
 
        rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
 
@@ -1839,7 +1892,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev)
        __set_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags);
        if (!modparam_nohwcrypt) {
                __set_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags);
-               __set_bit(CONFIG_CRYPTO_COPY_IV, &rt2x00dev->flags);
+               __set_bit(DRIVER_REQUIRE_COPY_IV, &rt2x00dev->flags);
        }
        __set_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags);
 
@@ -1873,6 +1926,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
        .uninitialize           = rt2x00usb_uninitialize,
        .clear_entry            = rt2x00usb_clear_entry,
        .set_device_state       = rt2500usb_set_device_state,
+       .rfkill_poll            = rt2500usb_rfkill_poll,
        .link_stats             = rt2500usb_link_stats,
        .reset_tuner            = rt2500usb_reset_tuner,
        .link_tuner             = rt2500usb_link_tuner,
@@ -1881,6 +1935,7 @@ static const struct rt2x00lib_ops rt2500usb_rt2x00_ops = {
        .write_beacon           = rt2500usb_write_beacon,
        .get_tx_data_len        = rt2500usb_get_tx_data_len,
        .kick_tx_queue          = rt2500usb_kick_tx_queue,
+       .kill_tx_queue          = rt2x00usb_kill_tx_queue,
        .fill_rxdone            = rt2500usb_fill_rxdone,
        .config_shared_key      = rt2500usb_config_key,
        .config_pairwise_key    = rt2500usb_config_key,
index 4347dfdabcd4f0525a1e9f2cbed5457848cf1d2b..afce0e0322c3e5a74438c742ee319b683bccb7d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
  * MAC_CSR19: GPIO control register.
  */
 #define MAC_CSR19                      0x0426
+#define MAC_CSR19_BIT0                 FIELD32(0x0001)
+#define MAC_CSR19_BIT1                 FIELD32(0x0002)
+#define MAC_CSR19_BIT2                 FIELD32(0x0004)
+#define MAC_CSR19_BIT3                 FIELD32(0x0008)
+#define MAC_CSR19_BIT4                 FIELD32(0x0010)
+#define MAC_CSR19_BIT5                 FIELD32(0x0020)
+#define MAC_CSR19_BIT6                 FIELD32(0x0040)
+#define MAC_CSR19_BIT7                 FIELD32(0x0080)
 
 /*
  * MAC_CSR20: LED control register.
index 39ecf3b82ca1ca0b6895be3eb266c883b9e2e42f..84bd6f19acb0749be1dd6200a99fbe595ca8da49 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,7 @@
 #include <linux/leds.h>
 #include <linux/mutex.h>
 #include <linux/etherdevice.h>
+#include <linux/input-polldev.h>
 
 #include <net/mac80211.h>
 
@@ -44,7 +45,7 @@
 /*
  * Module information.
  */
-#define DRV_VERSION    "2.2.3"
+#define DRV_VERSION    "2.3.0"
 #define DRV_PROJECT    "http://rt2x00.serialmonkey.com"
 
 /*
@@ -177,52 +178,41 @@ struct antenna_setup {
  */
 struct link_qual {
        /*
-        * Statistics required for Link tuning.
-        * For the average RSSI value we use the "Walking average" approach.
-        * When adding RSSI to the average value the following calculation
-        * is needed:
-        *
-        *        avg_rssi = ((avg_rssi * 7) + rssi) / 8;
-        *
-        * The advantage of this approach is that we only need 1 variable
-        * to store the average in (No need for a count and a total).
-        * But more importantly, normal average values will over time
-        * move less and less towards newly added values this results
-        * that with link tuning, the device can have a very good RSSI
-        * for a few minutes but when the device is moved away from the AP
-        * the average will not decrease fast enough to compensate.
-        * The walking average compensates this and will move towards
-        * the new values correctly allowing a effective link tuning.
+        * Statistics required for Link tuning by driver
+        * The rssi value is provided by rt2x00lib during the
+        * link_tuner() callback function.
+        * The false_cca field is filled during the link_stats()
+        * callback function and could be used during the
+        * link_tuner() callback function.
         */
-       int avg_rssi;
+       int rssi;
        int false_cca;
 
        /*
-        * Statistics required for Signal quality calculation.
-        * For calculating the Signal quality we have to determine
-        * the total number of success and failed RX and TX frames.
-        * After that we also use the average RSSI value to help
-        * determining the signal quality.
-        * For the calculation we will use the following algorithm:
-        *
-        *         rssi_percentage = (avg_rssi * 100) / rssi_offset
-        *         rx_percentage = (rx_success * 100) / rx_total
-        *         tx_percentage = (tx_success * 100) / tx_total
-        *         avg_signal = ((WEIGHT_RSSI * avg_rssi) +
-        *                       (WEIGHT_TX * tx_percentage) +
-        *                       (WEIGHT_RX * rx_percentage)) / 100
+        * VGC levels
+        * Hardware driver will tune the VGC level during each call
+        * to the link_tuner() callback function. This vgc_level is
+        * is determined based on the link quality statistics like
+        * average RSSI and the false CCA count.
         *
-        * This value should then be checked to not be greated then 100.
+        * In some cases the drivers need to differentiate between
+        * the currently "desired" VGC level and the level configured
+        * in the hardware. The latter is important to reduce the
+        * number of BBP register reads to reduce register access
+        * overhead. For this reason we store both values here.
+        */
+       u8 vgc_level;
+       u8 vgc_level_reg;
+
+       /*
+        * Statistics required for Signal quality calculation.
+        * These fields might be changed during the link_stats()
+        * callback function.
         */
-       int rx_percentage;
        int rx_success;
        int rx_failed;
-       int tx_percentage;
        int tx_success;
        int tx_failed;
-#define WEIGHT_RSSI    20
-#define WEIGHT_RX      40
-#define WEIGHT_TX      40
 };
 
 /*
@@ -286,9 +276,16 @@ struct link {
        struct link_ant ant;
 
        /*
-        * Active VGC level
+        * Currently active average RSSI value
         */
-       int vgc_level;
+       int avg_rssi;
+
+       /*
+        * Currently precalculated percentages of successful
+        * TX and RX frames.
+        */
+       int rx_percentage;
+       int tx_percentage;
 
        /*
         * Work structure for scheduling periodic link tuning.
@@ -296,55 +293,6 @@ struct link {
        struct delayed_work work;
 };
 
-/*
- * Small helper macro to work with moving/walking averages.
- */
-#define MOVING_AVERAGE(__avg, __val, __samples) \
-       ( (((__avg) * ((__samples) - 1)) + (__val)) / (__samples) )
-
-/*
- * When we lack RSSI information return something less then -80 to
- * tell the driver to tune the device to maximum sensitivity.
- */
-#define DEFAULT_RSSI   ( -128 )
-
-/*
- * Link quality access functions.
- */
-static inline int rt2x00_get_link_rssi(struct link *link)
-{
-       if (link->qual.avg_rssi && link->qual.rx_success)
-               return link->qual.avg_rssi;
-       return DEFAULT_RSSI;
-}
-
-static inline int rt2x00_get_link_ant_rssi(struct link *link)
-{
-       if (link->ant.rssi_ant && link->qual.rx_success)
-               return link->ant.rssi_ant;
-       return DEFAULT_RSSI;
-}
-
-static inline void rt2x00_reset_link_ant_rssi(struct link *link)
-{
-       link->ant.rssi_ant = 0;
-}
-
-static inline int rt2x00_get_link_ant_rssi_history(struct link *link,
-                                                  enum antenna ant)
-{
-       if (link->ant.rssi_history[ant - ANTENNA_A])
-               return link->ant.rssi_history[ant - ANTENNA_A];
-       return DEFAULT_RSSI;
-}
-
-static inline int rt2x00_update_ant_rssi(struct link *link, int rssi)
-{
-       int old_rssi = link->ant.rssi_history[link->ant.active.rx - ANTENNA_A];
-       link->ant.rssi_history[link->ant.active.rx - ANTENNA_A] = rssi;
-       return old_rssi;
-}
-
 /*
  * Interface structure
  * Per interface configuration details, this structure
@@ -448,7 +396,7 @@ struct rt2x00lib_erp {
        int ack_timeout;
        int ack_consume_time;
 
-       u64 basic_rates;
+       u32 basic_rates;
 
        int slot_time;
 
@@ -520,9 +468,10 @@ struct rt2x00lib_ops {
         */
        int (*probe_hw) (struct rt2x00_dev *rt2x00dev);
        char *(*get_firmware_name) (struct rt2x00_dev *rt2x00dev);
-       u16 (*get_firmware_crc) (const void *data, const size_t len);
-       int (*load_firmware) (struct rt2x00_dev *rt2x00dev, const void *data,
-                             const size_t len);
+       int (*check_firmware) (struct rt2x00_dev *rt2x00dev,
+                              const u8 *data, const size_t len);
+       int (*load_firmware) (struct rt2x00_dev *rt2x00dev,
+                             const u8 *data, const size_t len);
 
        /*
         * Device initialization/deinitialization handlers.
@@ -544,8 +493,10 @@ struct rt2x00lib_ops {
        int (*rfkill_poll) (struct rt2x00_dev *rt2x00dev);
        void (*link_stats) (struct rt2x00_dev *rt2x00dev,
                            struct link_qual *qual);
-       void (*reset_tuner) (struct rt2x00_dev *rt2x00dev);
-       void (*link_tuner) (struct rt2x00_dev *rt2x00dev);
+       void (*reset_tuner) (struct rt2x00_dev *rt2x00dev,
+                            struct link_qual *qual);
+       void (*link_tuner) (struct rt2x00_dev *rt2x00dev,
+                           struct link_qual *qual, const u32 count);
 
        /*
         * TX control handlers
@@ -558,6 +509,8 @@ struct rt2x00lib_ops {
        int (*get_tx_data_len) (struct queue_entry *entry);
        void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev,
                               const enum data_queue_qid queue);
+       void (*kill_tx_queue) (struct rt2x00_dev *rt2x00dev,
+                              const enum data_queue_qid queue);
 
        /*
         * RX control handlers
@@ -625,7 +578,6 @@ enum rt2x00_flags {
        DEVICE_STATE_REGISTERED_HW,
        DEVICE_STATE_INITIALIZED,
        DEVICE_STATE_STARTED,
-       DEVICE_STATE_STARTED_SUSPEND,
        DEVICE_STATE_ENABLED_RADIO,
        DEVICE_STATE_DISABLED_RADIO_HW,
 
@@ -637,6 +589,7 @@ enum rt2x00_flags {
        DRIVER_REQUIRE_ATIM_QUEUE,
        DRIVER_REQUIRE_SCHEDULED,
        DRIVER_REQUIRE_DMA,
+       DRIVER_REQUIRE_COPY_IV,
 
        /*
         * Driver features
@@ -653,7 +606,6 @@ enum rt2x00_flags {
        CONFIG_EXTERNAL_LNA_BG,
        CONFIG_DOUBLE_ANTENNA,
        CONFIG_DISABLE_LINK_TUNING,
-       CONFIG_CRYPTO_COPY_IV,
 };
 
 /*
@@ -689,8 +641,8 @@ struct rt2x00_dev {
        unsigned long rfkill_state;
 #define RFKILL_STATE_ALLOCATED         1
 #define RFKILL_STATE_REGISTERED                2
-       struct rfkill *rfkill;
-       struct delayed_work rfkill_work;
+#define RFKILL_STATE_BLOCKED           3
+       struct input_polled_dev *rfkill_poll_dev;
 #endif /* CONFIG_RT2X00_LIB_RFKILL */
 
        /*
@@ -918,7 +870,7 @@ static inline char rt2x00_rf(const struct rt2x00_chip *chipset, const u16 chip)
        return (chipset->rf == chip);
 }
 
-static inline u16 rt2x00_rev(const struct rt2x00_chip *chipset)
+static inline u32 rt2x00_rev(const struct rt2x00_chip *chipset)
 {
        return chipset->rev;
 }
@@ -982,7 +934,7 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
                                int mc_count, struct dev_addr_list *mc_list);
 #ifdef CONFIG_RT2X00_LIB_CRYPTO
 int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                     const u8 *local_address, const u8 *address,
+                     struct ieee80211_vif *vif, struct ieee80211_sta *sta,
                      struct ieee80211_key_conf *key);
 #else
 #define rt2x00mac_set_key      NULL
index e66fb316cd61fda7fae8add82217d06e01213628..9c2f5517af2a453784dc8cd6e96a92279ff6311d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -32,7 +32,7 @@
 void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
                           struct rt2x00_intf *intf,
                           enum nl80211_iftype type,
-                          u8 *mac, u8 *bssid)
+                          const u8 *mac, const u8 *bssid)
 {
        struct rt2x00intf_conf conf;
        unsigned int flags = 0;
@@ -42,6 +42,8 @@ void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
        switch (type) {
        case NL80211_IFTYPE_ADHOC:
        case NL80211_IFTYPE_AP:
+       case NL80211_IFTYPE_MESH_POINT:
+       case NL80211_IFTYPE_WDS:
                conf.sync = TSF_SYNC_BEACON;
                break;
        case NL80211_IFTYPE_STATION:
@@ -152,8 +154,7 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev,
         */
        rt2x00dev->ops->lib->config_ant(rt2x00dev, ant);
 
-       rt2x00lib_reset_link_tuner(rt2x00dev);
-       rt2x00_reset_link_ant_rssi(&rt2x00dev->link);
+       rt2x00link_reset_tuner(rt2x00dev, true);
 
        memcpy(active, ant, sizeof(*ant));
 
@@ -191,7 +192,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
         * which means we need to reset the link tuner.
         */
        if (ieee80211_flags & IEEE80211_CONF_CHANGE_CHANNEL)
-               rt2x00lib_reset_link_tuner(rt2x00dev);
+               rt2x00link_reset_tuner(rt2x00dev, false);
 
        rt2x00dev->curr_band = conf->channel->band;
        rt2x00dev->tx_power = conf->power_level;
index aee9cba13eb3c3e97ea816841d0ed84059b3fbca..0b41845d9543a1653d3893e22d7f4c56d1719c35 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -49,9 +49,14 @@ enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key)
 void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
                                       struct txentry_desc *txdesc)
 {
+       struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
        struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
 
+       if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) ||
+           !hw_key || entry->skb->do_not_encrypt)
+               return;
+
        __set_bit(ENTRY_TXD_ENCRYPT, &txdesc->flags);
 
        txdesc->cipher = rt2x00crypto_key_to_cipher(hw_key);
@@ -69,11 +74,17 @@ void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
                __set_bit(ENTRY_TXD_ENCRYPT_MMIC, &txdesc->flags);
 }
 
-unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info)
+unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
+                                     struct sk_buff *skb)
 {
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
        struct ieee80211_key_conf *key = tx_info->control.hw_key;
        unsigned int overhead = 0;
 
+       if (!test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) ||
+           !key || skb->do_not_encrypt)
+               return overhead;
+
        /*
         * Extend frame length to include IV/EIV/ICV/MMIC,
         * note that these lengths should only be added when
index 54dd10060bf1a56a8b318ee5e135463b796cc358..dcdce7f746b5eb5db8d83abba464cd8e2de90f7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -130,9 +130,11 @@ struct rt2x00debug_intf {
 };
 
 void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
-                              enum cipher cipher, enum rx_crypto status)
+                              struct rxdone_entry_desc *rxdesc)
 {
        struct rt2x00debug_intf *intf = rt2x00dev->debugfs_intf;
+       enum cipher cipher = rxdesc->cipher;
+       enum rx_crypto status = rxdesc->cipher_status;
 
        if (cipher == CIPHER_TKIP_NO_MIC)
                cipher = CIPHER_TKIP;
index a92104dfee9a6836d90b7ee2270b3c407fc873e8..035cbc98c59344a3f75beb2cff6023a9ee20db7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
index 87c0f2c8307752be2521032a6904b82ce9530942..05f94e21b42389c2fc4560cee44274671442e882 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
 #include "rt2x00.h"
 #include "rt2x00lib.h"
 
-/*
- * Link tuning handlers
- */
-void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev)
-{
-       if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
-               return;
-
-       /*
-        * Reset link information.
-        * Both the currently active vgc level as well as
-        * the link tuner counter should be reset. Resetting
-        * the counter is important for devices where the
-        * device should only perform link tuning during the
-        * first minute after being enabled.
-        */
-       rt2x00dev->link.count = 0;
-       rt2x00dev->link.vgc_level = 0;
-
-       /*
-        * Reset the link tuner.
-        */
-       rt2x00dev->ops->lib->reset_tuner(rt2x00dev);
-}
-
-static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev)
-{
-       /*
-        * Clear all (possibly) pre-existing quality statistics.
-        */
-       memset(&rt2x00dev->link.qual, 0, sizeof(rt2x00dev->link.qual));
-
-       /*
-        * The RX and TX percentage should start at 50%
-        * this will assure we will get at least get some
-        * decent value when the link tuner starts.
-        * The value will be dropped and overwritten with
-        * the correct (measured )value anyway during the
-        * first run of the link tuner.
-        */
-       rt2x00dev->link.qual.rx_percentage = 50;
-       rt2x00dev->link.qual.tx_percentage = 50;
-
-       rt2x00lib_reset_link_tuner(rt2x00dev);
-
-       queue_delayed_work(rt2x00dev->hw->workqueue,
-                          &rt2x00dev->link.work, LINK_TUNE_INTERVAL);
-}
-
-static void rt2x00lib_stop_link_tuner(struct rt2x00_dev *rt2x00dev)
-{
-       cancel_delayed_work_sync(&rt2x00dev->link.work);
-}
-
 /*
  * Radio control handlers.
  */
@@ -137,9 +83,10 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
                return;
 
        /*
-        * Stop the TX queues.
+        * Stop the TX queues in mac80211.
         */
        ieee80211_stop_queues(rt2x00dev->hw);
+       rt2x00queue_stop_queues(rt2x00dev);
 
        /*
         * Disable RX.
@@ -161,238 +108,15 @@ void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state)
         * When we are disabling the RX, we should also stop the link tuner.
         */
        if (state == STATE_RADIO_RX_OFF)
-               rt2x00lib_stop_link_tuner(rt2x00dev);
+               rt2x00link_stop_tuner(rt2x00dev);
 
        rt2x00dev->ops->lib->set_device_state(rt2x00dev, state);
 
        /*
         * When we are enabling the RX, we should also start the link tuner.
         */
-       if (state == STATE_RADIO_RX_ON &&
-           (rt2x00dev->intf_ap_count || rt2x00dev->intf_sta_count))
-               rt2x00lib_start_link_tuner(rt2x00dev);
-}
-
-static void rt2x00lib_evaluate_antenna_sample(struct rt2x00_dev *rt2x00dev)
-{
-       struct antenna_setup ant;
-       int sample_a =
-           rt2x00_get_link_ant_rssi_history(&rt2x00dev->link, ANTENNA_A);
-       int sample_b =
-           rt2x00_get_link_ant_rssi_history(&rt2x00dev->link, ANTENNA_B);
-
-       memcpy(&ant, &rt2x00dev->link.ant.active, sizeof(ant));
-
-       /*
-        * We are done sampling. Now we should evaluate the results.
-        */
-       rt2x00dev->link.ant.flags &= ~ANTENNA_MODE_SAMPLE;
-
-       /*
-        * During the last period we have sampled the RSSI
-        * from both antenna's. It now is time to determine
-        * which antenna demonstrated the best performance.
-        * When we are already on the antenna with the best
-        * performance, then there really is nothing for us
-        * left to do.
-        */
-       if (sample_a == sample_b)
-               return;
-
-       if (rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY)
-               ant.rx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B;
-
-       if (rt2x00dev->link.ant.flags & ANTENNA_TX_DIVERSITY)
-               ant.tx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B;
-
-       rt2x00lib_config_antenna(rt2x00dev, &ant);
-}
-
-static void rt2x00lib_evaluate_antenna_eval(struct rt2x00_dev *rt2x00dev)
-{
-       struct antenna_setup ant;
-       int rssi_curr = rt2x00_get_link_ant_rssi(&rt2x00dev->link);
-       int rssi_old = rt2x00_update_ant_rssi(&rt2x00dev->link, rssi_curr);
-
-       memcpy(&ant, &rt2x00dev->link.ant.active, sizeof(ant));
-
-       /*
-        * Legacy driver indicates that we should swap antenna's
-        * when the difference in RSSI is greater that 5. This
-        * also should be done when the RSSI was actually better
-        * then the previous sample.
-        * When the difference exceeds the threshold we should
-        * sample the rssi from the other antenna to make a valid
-        * comparison between the 2 antennas.
-        */
-       if (abs(rssi_curr - rssi_old) < 5)
-               return;
-
-       rt2x00dev->link.ant.flags |= ANTENNA_MODE_SAMPLE;
-
-       if (rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY)
-               ant.rx = (ant.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
-
-       if (rt2x00dev->link.ant.flags & ANTENNA_TX_DIVERSITY)
-               ant.tx = (ant.tx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
-
-       rt2x00lib_config_antenna(rt2x00dev, &ant);
-}
-
-static void rt2x00lib_evaluate_antenna(struct rt2x00_dev *rt2x00dev)
-{
-       /*
-        * Determine if software diversity is enabled for
-        * either the TX or RX antenna (or both).
-        * Always perform this check since within the link
-        * tuner interval the configuration might have changed.
-        */
-       rt2x00dev->link.ant.flags &= ~ANTENNA_RX_DIVERSITY;
-       rt2x00dev->link.ant.flags &= ~ANTENNA_TX_DIVERSITY;
-
-       if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
-               rt2x00dev->link.ant.flags |= ANTENNA_RX_DIVERSITY;
-       if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
-               rt2x00dev->link.ant.flags |= ANTENNA_TX_DIVERSITY;
-
-       if (!(rt2x00dev->link.ant.flags & ANTENNA_RX_DIVERSITY) &&
-           !(rt2x00dev->link.ant.flags & ANTENNA_TX_DIVERSITY)) {
-               rt2x00dev->link.ant.flags = 0;
-               return;
-       }
-
-       /*
-        * If we have only sampled the data over the last period
-        * we should now harvest the data. Otherwise just evaluate
-        * the data. The latter should only be performed once
-        * every 2 seconds.
-        */
-       if (rt2x00dev->link.ant.flags & ANTENNA_MODE_SAMPLE)
-               rt2x00lib_evaluate_antenna_sample(rt2x00dev);
-       else if (rt2x00dev->link.count & 1)
-               rt2x00lib_evaluate_antenna_eval(rt2x00dev);
-}
-
-static void rt2x00lib_update_link_stats(struct link *link, int rssi)
-{
-       int avg_rssi = rssi;
-
-       /*
-        * Update global RSSI
-        */
-       if (link->qual.avg_rssi)
-               avg_rssi = MOVING_AVERAGE(link->qual.avg_rssi, rssi, 8);
-       link->qual.avg_rssi = avg_rssi;
-
-       /*
-        * Update antenna RSSI
-        */
-       if (link->ant.rssi_ant)
-               rssi = MOVING_AVERAGE(link->ant.rssi_ant, rssi, 8);
-       link->ant.rssi_ant = rssi;
-}
-
-static void rt2x00lib_precalculate_link_signal(struct link_qual *qual)
-{
-       if (qual->rx_failed || qual->rx_success)
-               qual->rx_percentage =
-                   (qual->rx_success * 100) /
-                   (qual->rx_failed + qual->rx_success);
-       else
-               qual->rx_percentage = 50;
-
-       if (qual->tx_failed || qual->tx_success)
-               qual->tx_percentage =
-                   (qual->tx_success * 100) /
-                   (qual->tx_failed + qual->tx_success);
-       else
-               qual->tx_percentage = 50;
-
-       qual->rx_success = 0;
-       qual->rx_failed = 0;
-       qual->tx_success = 0;
-       qual->tx_failed = 0;
-}
-
-static int rt2x00lib_calculate_link_signal(struct rt2x00_dev *rt2x00dev,
-                                          int rssi)
-{
-       int rssi_percentage = 0;
-       int signal;
-
-       /*
-        * We need a positive value for the RSSI.
-        */
-       if (rssi < 0)
-               rssi += rt2x00dev->rssi_offset;
-
-       /*
-        * Calculate the different percentages,
-        * which will be used for the signal.
-        */
-       if (rt2x00dev->rssi_offset)
-               rssi_percentage = (rssi * 100) / rt2x00dev->rssi_offset;
-
-       /*
-        * Add the individual percentages and use the WEIGHT
-        * defines to calculate the current link signal.
-        */
-       signal = ((WEIGHT_RSSI * rssi_percentage) +
-                 (WEIGHT_TX * rt2x00dev->link.qual.tx_percentage) +
-                 (WEIGHT_RX * rt2x00dev->link.qual.rx_percentage)) / 100;
-
-       return (signal > 100) ? 100 : signal;
-}
-
-static void rt2x00lib_link_tuner(struct work_struct *work)
-{
-       struct rt2x00_dev *rt2x00dev =
-           container_of(work, struct rt2x00_dev, link.work.work);
-
-       /*
-        * When the radio is shutting down we should
-        * immediately cease all link tuning.
-        */
-       if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
-               return;
-
-       /*
-        * Update statistics.
-        */
-       rt2x00dev->ops->lib->link_stats(rt2x00dev, &rt2x00dev->link.qual);
-       rt2x00dev->low_level_stats.dot11FCSErrorCount +=
-           rt2x00dev->link.qual.rx_failed;
-
-       /*
-        * Only perform the link tuning when Link tuning
-        * has been enabled (This could have been disabled from the EEPROM).
-        */
-       if (!test_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags))
-               rt2x00dev->ops->lib->link_tuner(rt2x00dev);
-
-       /*
-        * Precalculate a portion of the link signal which is
-        * in based on the tx/rx success/failure counters.
-        */
-       rt2x00lib_precalculate_link_signal(&rt2x00dev->link.qual);
-
-       /*
-        * Send a signal to the led to update the led signal strength.
-        */
-       rt2x00leds_led_quality(rt2x00dev, rt2x00dev->link.qual.avg_rssi);
-
-       /*
-        * Evaluate antenna setup, make this the last step since this could
-        * possibly reset some statistics.
-        */
-       rt2x00lib_evaluate_antenna(rt2x00dev);
-
-       /*
-        * Increase tuner counter, and reschedule the next link tuner run.
-        */
-       rt2x00dev->link.count++;
-       queue_delayed_work(rt2x00dev->hw->workqueue,
-                          &rt2x00dev->link.work, LINK_TUNE_INTERVAL);
+       if (state == STATE_RADIO_RX_ON)
+               rt2x00link_start_tuner(rt2x00dev);
 }
 
 static void rt2x00lib_packetfilter_scheduled(struct work_struct *work)
@@ -434,7 +158,7 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
                return;
 
        if (delayed_flags & DELAYED_UPDATE_BEACON)
-               rt2x00queue_update_beacon(rt2x00dev, vif);
+               rt2x00queue_update_beacon(rt2x00dev, vif, true);
 
        if (delayed_flags & DELAYED_CONFIG_ERP)
                rt2x00lib_config_erp(rt2x00dev, intf, &conf);
@@ -467,7 +191,9 @@ static void rt2x00lib_beacondone_iter(void *data, u8 *mac,
        struct rt2x00_intf *intf = vif_to_intf(vif);
 
        if (vif->type != NL80211_IFTYPE_AP &&
-           vif->type != NL80211_IFTYPE_ADHOC)
+           vif->type != NL80211_IFTYPE_ADHOC &&
+           vif->type != NL80211_IFTYPE_MESH_POINT &&
+           vif->type != NL80211_IFTYPE_WDS)
                return;
 
        /*
@@ -490,7 +216,7 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
                                                   rt2x00lib_beacondone_iter,
                                                   rt2x00dev);
 
-       schedule_work(&rt2x00dev->intf_work);
+       queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work);
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_beacondone);
 
@@ -597,7 +323,6 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev,
        struct sk_buff *skb;
        struct ieee80211_rx_status *rx_status = &rt2x00dev->rx_status;
        struct ieee80211_supported_band *sband;
-       struct ieee80211_hdr *hdr;
        const struct rt2x00_rate *rate;
        unsigned int header_length;
        unsigned int align;
@@ -668,30 +393,22 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev,
 
        if (idx < 0) {
                WARNING(rt2x00dev, "Frame received with unrecognized signal,"
-                       "signal=0x%.2x, plcp=%d.\n", rxdesc.signal,
-                       !!(rxdesc.dev_flags & RXDONE_SIGNAL_PLCP));
+                       "signal=0x%.2x, type=%d.\n", rxdesc.signal,
+                       (rxdesc.dev_flags & RXDONE_SIGNAL_MASK));
                idx = 0;
        }
 
        /*
-        * Only update link status if this is a beacon frame carrying our bssid.
+        * Update extra components
         */
-       hdr = (struct ieee80211_hdr *)entry->skb->data;
-       if (ieee80211_is_beacon(hdr->frame_control) &&
-           (rxdesc.dev_flags & RXDONE_MY_BSS))
-               rt2x00lib_update_link_stats(&rt2x00dev->link, rxdesc.rssi);
-
-       rt2x00debug_update_crypto(rt2x00dev,
-                                 rxdesc.cipher,
-                                 rxdesc.cipher_status);
-
-       rt2x00dev->link.qual.rx_success++;
+       rt2x00link_update_stats(rt2x00dev, entry->skb, &rxdesc);
+       rt2x00debug_update_crypto(rt2x00dev, &rxdesc);
 
        rx_status->mactime = rxdesc.timestamp;
        rx_status->rate_idx = idx;
-       rx_status->qual =
-           rt2x00lib_calculate_link_signal(rt2x00dev, rxdesc.rssi);
+       rx_status->qual = rt2x00link_calculate_signal(rt2x00dev, rxdesc.rssi);
        rx_status->signal = rxdesc.rssi;
+       rx_status->noise = rxdesc.noise;
        rx_status->flag = rxdesc.flags;
        rx_status->antenna = rt2x00dev->link.ant.active.rx;
 
@@ -1067,7 +784,9 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
        if (rt2x00dev->ops->bcn->entry_num > 0)
                rt2x00dev->hw->wiphy->interface_modes |=
                    BIT(NL80211_IFTYPE_ADHOC) |
-                   BIT(NL80211_IFTYPE_AP);
+                   BIT(NL80211_IFTYPE_AP) |
+                   BIT(NL80211_IFTYPE_MESH_POINT) |
+                   BIT(NL80211_IFTYPE_WDS);
 
        /*
         * Let the driver probe the device to detect the capabilities.
@@ -1083,7 +802,6 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
         */
        INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
        INIT_WORK(&rt2x00dev->filter_work, rt2x00lib_packetfilter_scheduled);
-       INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00lib_link_tuner);
 
        /*
         * Allocate queue array.
@@ -1104,6 +822,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
        /*
         * Register extra components.
         */
+       rt2x00link_register(rt2x00dev);
        rt2x00leds_register(rt2x00dev);
        rt2x00rfkill_allocate(rt2x00dev);
        rt2x00debug_register(rt2x00dev);
@@ -1163,23 +882,17 @@ EXPORT_SYMBOL_GPL(rt2x00lib_remove_dev);
 #ifdef CONFIG_PM
 int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
 {
-       int retval;
-
        NOTICE(rt2x00dev, "Going to sleep.\n");
 
        /*
-        * Only continue if mac80211 has open interfaces.
+        * Prevent mac80211 from accessing driver while suspended.
         */
-       if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) ||
-           !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
-               goto exit;
-
-       set_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags);
+       if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
+               return 0;
 
        /*
-        * Disable radio.
+        * Cleanup as much as possible.
         */
-       rt2x00lib_stop(rt2x00dev);
        rt2x00lib_uninitialize(rt2x00dev);
 
        /*
@@ -1188,7 +901,6 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state)
        rt2x00leds_suspend(rt2x00dev);
        rt2x00debug_deregister(rt2x00dev);
 
-exit:
        /*
         * Set device mode to sleep for power management,
         * on some hardware this call seems to consistently fail.
@@ -1200,8 +912,7 @@ exit:
         * the radio and the other components already disabled the
         * device is as good as disabled.
         */
-       retval = rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP);
-       if (retval)
+       if (rt2x00dev->ops->lib->set_device_state(rt2x00dev, STATE_SLEEP))
                WARNING(rt2x00dev, "Device failed to enter sleep state, "
                        "continue suspending.\n");
 
@@ -1209,32 +920,8 @@ exit:
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_suspend);
 
-static void rt2x00lib_resume_intf(void *data, u8 *mac,
-                                 struct ieee80211_vif *vif)
-{
-       struct rt2x00_dev *rt2x00dev = data;
-       struct rt2x00_intf *intf = vif_to_intf(vif);
-
-       spin_lock(&intf->lock);
-
-       rt2x00lib_config_intf(rt2x00dev, intf,
-                             vif->type, intf->mac, intf->bssid);
-
-
-       /*
-        * Master or Ad-hoc mode require a new beacon update.
-        */
-       if (vif->type == NL80211_IFTYPE_AP ||
-           vif->type == NL80211_IFTYPE_ADHOC)
-               intf->delayed_flags |= DELAYED_UPDATE_BEACON;
-
-       spin_unlock(&intf->lock);
-}
-
 int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
 {
-       int retval;
-
        NOTICE(rt2x00dev, "Waking up.\n");
 
        /*
@@ -1243,61 +930,12 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev)
        rt2x00debug_register(rt2x00dev);
        rt2x00leds_resume(rt2x00dev);
 
-       /*
-        * Only continue if mac80211 had open interfaces.
-        */
-       if (!test_and_clear_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags))
-               return 0;
-
-       /*
-        * Reinitialize device and all active interfaces.
-        */
-       retval = rt2x00lib_start(rt2x00dev);
-       if (retval)
-               goto exit;
-
-       /*
-        * Reconfigure device.
-        */
-       retval = rt2x00mac_config(rt2x00dev->hw, ~0);
-       if (retval)
-               goto exit;
-
-       /*
-        * Iterator over each active interface to
-        * reconfigure the hardware.
-        */
-       ieee80211_iterate_active_interfaces(rt2x00dev->hw,
-                                           rt2x00lib_resume_intf, rt2x00dev);
-
        /*
         * We are ready again to receive requests from mac80211.
         */
        set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
 
-       /*
-        * It is possible that during that mac80211 has attempted
-        * to send frames while we were suspending or resuming.
-        * In that case we have disabled the TX queue and should
-        * now enable it again
-        */
-       ieee80211_wake_queues(rt2x00dev->hw);
-
-       /*
-        * During interface iteration we might have changed the
-        * delayed_flags, time to handles the event by calling
-        * the work handler directly.
-        */
-       rt2x00lib_intf_scheduled(&rt2x00dev->intf_work);
-
        return 0;
-
-exit:
-       rt2x00lib_stop(rt2x00dev);
-       rt2x00lib_uninitialize(rt2x00dev);
-       rt2x00debug_deregister(rt2x00dev);
-
-       return retval;
 }
 EXPORT_SYMBOL_GPL(rt2x00lib_resume);
 #endif /* CONFIG_PM */
index 7169c222a4860b94fc5657a2e544870fd991f9e6..fdedb512292814bd8d6ac3b5c479ffc7b1f980a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
index bab05a56e7a0f2f9f2679cb220a72b2fca771775..d2deea2f2679423952dd19b3324e94042857713c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -35,7 +35,6 @@ static int rt2x00lib_request_firmware(struct rt2x00_dev *rt2x00dev)
        const struct firmware *fw;
        char *fw_name;
        int retval;
-       u16 crc;
 
        /*
         * Read correct firmware from harddisk.
@@ -61,16 +60,26 @@ static int rt2x00lib_request_firmware(struct rt2x00_dev *rt2x00dev)
                return -ENOENT;
        }
 
-       crc = rt2x00dev->ops->lib->get_firmware_crc(fw->data, fw->size);
-       if (crc != (fw->data[fw->size - 2] << 8 | fw->data[fw->size - 1])) {
-               ERROR(rt2x00dev, "Firmware checksum error.\n");
-               retval = -ENOENT;
-               goto exit;
-       }
-
        INFO(rt2x00dev, "Firmware detected - version: %d.%d.\n",
             fw->data[fw->size - 4], fw->data[fw->size - 3]);
 
+       retval = rt2x00dev->ops->lib->check_firmware(rt2x00dev, fw->data, fw->size);
+       switch (retval) {
+       case FW_OK:
+               break;
+       case FW_BAD_CRC:
+               ERROR(rt2x00dev, "Firmware checksum error.\n");
+               goto exit;
+       case FW_BAD_LENGTH:
+               ERROR(rt2x00dev,
+                     "Invalid firmware file length (len=%zu)\n", fw->size);
+               goto exit;
+       case FW_BAD_VERSION:
+               ERROR(rt2x00dev,
+                     "Current firmware does not support detected chipset.\n");
+               goto exit;
+       };
+
        rt2x00dev->fw = fw;
 
        return 0;
@@ -78,7 +87,7 @@ static int rt2x00lib_request_firmware(struct rt2x00_dev *rt2x00dev)
 exit:
        release_firmware(fw);
 
-       return retval;
+       return -ENOENT;
 }
 
 int rt2x00lib_load_firmware(struct rt2x00_dev *rt2x00dev)
index a0cd35b6beb5a5f1a1865dff5e89456a4f435d17..49671fed91d73711ef533b0126994635795b70a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -134,7 +134,7 @@ void rt2x00leds_register(struct rt2x00_dev *rt2x00dev)
                 rt2x00dev->ops->name, wiphy_name(rt2x00dev->hw->wiphy));
 
        if (rt2x00dev->led_radio.flags & LED_INITIALIZED) {
-               snprintf(name, sizeof(name), "%s:radio", dev_name);
+               snprintf(name, sizeof(name), "%s::radio", dev_name);
 
                retval = rt2x00leds_register_led(rt2x00dev,
                                                 &rt2x00dev->led_radio,
@@ -144,7 +144,7 @@ void rt2x00leds_register(struct rt2x00_dev *rt2x00dev)
        }
 
        if (rt2x00dev->led_assoc.flags & LED_INITIALIZED) {
-               snprintf(name, sizeof(name), "%s:assoc", dev_name);
+               snprintf(name, sizeof(name), "%s::assoc", dev_name);
 
                retval = rt2x00leds_register_led(rt2x00dev,
                                                 &rt2x00dev->led_assoc,
@@ -154,7 +154,7 @@ void rt2x00leds_register(struct rt2x00_dev *rt2x00dev)
        }
 
        if (rt2x00dev->led_qual.flags & LED_INITIALIZED) {
-               snprintf(name, sizeof(name), "%s:quality", dev_name);
+               snprintf(name, sizeof(name), "%s::quality", dev_name);
 
                retval = rt2x00leds_register_led(rt2x00dev,
                                                 &rt2x00dev->led_qual,
index 9df4a49bdcad22660adf0f16feb13192e0b97a35..1046977e6a124833ecf4231bb63cbfa07b6b9f21 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
index 86cd26fbf76922a429ad5b0424e80504ec92d776..a631613177d037b744e8f866bfde1cf6e2f491e0 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -33,7 +33,7 @@
  * Both the link tuner as the rfkill will be called once per second.
  */
 #define LINK_TUNE_INTERVAL     ( round_jiffies_relative(HZ) )
-#define RFKILL_POLL_INTERVAL   ( round_jiffies_relative(HZ) )
+#define RFKILL_POLL_INTERVAL   ( 1000 )
 
 /*
  * rt2x00_rate: Per rate device information
@@ -63,7 +63,6 @@ static inline const struct rt2x00_rate *rt2x00_get_rate(const u16 hw_value)
 int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev);
 void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev);
 void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, enum dev_state state);
-void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev);
 
 /*
  * Initialization handlers.
@@ -77,7 +76,7 @@ void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev);
 void rt2x00lib_config_intf(struct rt2x00_dev *rt2x00dev,
                           struct rt2x00_intf *intf,
                           enum nl80211_iftype type,
-                          u8 *mac, u8 *bssid);
+                          const u8 *mac, const u8 *bssid);
 void rt2x00lib_config_erp(struct rt2x00_dev *rt2x00dev,
                          struct rt2x00_intf *intf,
                          struct ieee80211_bss_conf *conf);
@@ -124,9 +123,11 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb);
  * rt2x00queue_update_beacon - Send new beacon from mac80211 to hardware
  * @rt2x00dev: Pointer to &struct rt2x00_dev.
  * @vif: Interface for which the beacon should be updated.
+ * @enable_beacon: Enable beaconing
  */
 int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
-                             struct ieee80211_vif *vif);
+                             struct ieee80211_vif *vif,
+                             const bool enable_beacon);
 
 /**
  * rt2x00queue_index_inc - Index incrementation function
@@ -139,6 +140,15 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
  */
 void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index);
 
+/**
+ * rt2x00queue_stop_queues - Halt all data queues
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ *
+ * This function will loop through all available queues to stop
+ * any pending outgoing frames.
+ */
+void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev);
+
 /**
  * rt2x00queue_init_queues - Initialize all data queues
  * @rt2x00dev: Pointer to &struct rt2x00_dev.
@@ -154,6 +164,81 @@ void rt2x00queue_uninitialize(struct rt2x00_dev *rt2x00dev);
 int rt2x00queue_allocate(struct rt2x00_dev *rt2x00dev);
 void rt2x00queue_free(struct rt2x00_dev *rt2x00dev);
 
+/**
+ * rt2x00link_update_stats - Update link statistics from RX frame
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ * @skb: Received frame
+ * @rxdesc: Received frame descriptor
+ *
+ * Update link statistics based on the information from the
+ * received frame descriptor.
+ */
+void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
+                            struct sk_buff *skb,
+                            struct rxdone_entry_desc *rxdesc);
+
+/**
+ * rt2x00link_calculate_signal - Calculate signal quality
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ * @rssi: RX Frame RSSI
+ *
+ * Calculate the signal quality of a frame based on the rssi
+ * measured during the receiving of the frame and the global
+ * link quality statistics measured since the start of the
+ * link tuning. The result is a value between 0 and 100 which
+ * is an indication of the signal quality.
+ */
+int rt2x00link_calculate_signal(struct rt2x00_dev *rt2x00dev, int rssi);
+
+/**
+ * rt2x00link_start_tuner - Start periodic link tuner work
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ *
+ * This start the link tuner periodic work, this work will
+ * be executed periodically until &rt2x00link_stop_tuner has
+ * been called.
+ */
+void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev);
+
+/**
+ * rt2x00link_stop_tuner - Stop periodic link tuner work
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ *
+ * After this function completed the link tuner will not
+ * be running until &rt2x00link_start_tuner is called.
+ */
+void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev);
+
+/**
+ * rt2x00link_reset_tuner - Reset periodic link tuner work
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ * @antenna: Should the antenna tuning also be reset
+ *
+ * The VGC limit configured in the hardware will be reset to 0
+ * which forces the driver to rediscover the correct value for
+ * the current association. This is needed when configuration
+ * options have changed which could drastically change the
+ * SNR level or link quality (i.e. changing the antenna setting).
+ *
+ * Resetting the link tuner will also cause the periodic work counter
+ * to be reset. Any driver which has a fixed limit on the number
+ * of rounds the link tuner is supposed to work will accept the
+ * tuner actions again if this limit was previously reached.
+ *
+ * If @antenna is set to true a the software antenna diversity
+ * tuning will also be reset.
+ */
+void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna);
+
+/**
+ * rt2x00link_register - Initialize link tuning functionality
+ * @rt2x00dev: Pointer to &struct rt2x00_dev.
+ *
+ * Initialize work structure and all link tuning related
+ * paramters. This will not start the link tuning process itself.
+ */
+void rt2x00link_register(struct rt2x00_dev *rt2x00dev);
+
 /*
  * Firmware handlers.
  */
@@ -179,7 +264,7 @@ void rt2x00debug_deregister(struct rt2x00_dev *rt2x00dev);
 void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
                            enum rt2x00_dump_type type, struct sk_buff *skb);
 void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
-                              enum cipher cipher, enum rx_crypto status);
+                              struct rxdone_entry_desc *rxdesc);
 #else
 static inline void rt2x00debug_register(struct rt2x00_dev *rt2x00dev)
 {
@@ -196,8 +281,7 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev,
 }
 
 static inline void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
-                                            enum cipher cipher,
-                                            enum rx_crypto status)
+                                            struct rxdone_entry_desc *rxdesc)
 {
 }
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
@@ -209,7 +293,8 @@ static inline void rt2x00debug_update_crypto(struct rt2x00_dev *rt2x00dev,
 enum cipher rt2x00crypto_key_to_cipher(struct ieee80211_key_conf *key);
 void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
                                       struct txentry_desc *txdesc);
-unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info);
+unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
+                                     struct sk_buff *skb);
 void rt2x00crypto_tx_copy_iv(struct sk_buff *skb, unsigned int iv_len);
 void rt2x00crypto_tx_remove_iv(struct sk_buff *skb, unsigned int iv_len);
 void rt2x00crypto_tx_insert_iv(struct sk_buff *skb);
@@ -227,7 +312,8 @@ static inline void rt2x00crypto_create_tx_descriptor(struct queue_entry *entry,
 {
 }
 
-static inline unsigned int rt2x00crypto_tx_overhead(struct ieee80211_tx_info *tx_info)
+static inline unsigned int rt2x00crypto_tx_overhead(struct rt2x00_dev *rt2x00dev,
+                                                   struct sk_buff *skb)
 {
        return 0;
 }
diff --git a/drivers/net/wireless/rt2x00/rt2x00link.c b/drivers/net/wireless/rt2x00/rt2x00link.c
new file mode 100644 (file)
index 0000000..9223a6d
--- /dev/null
@@ -0,0 +1,461 @@
+/*
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
+       <http://rt2x00.serialmonkey.com>
+
+       This program is free software; you can redistribute it and/or modify
+       it under the terms of the GNU General Public License as published by
+       the Free Software Foundation; either version 2 of the License, or
+       (at your option) any later version.
+
+       This program is distributed in the hope that it will be useful,
+       but WITHOUT ANY WARRANTY; without even the implied warranty of
+       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+       GNU General Public License for more details.
+
+       You should have received a copy of the GNU General Public License
+       along with this program; if not, write to the
+       Free Software Foundation, Inc.,
+       59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+/*
+       Module: rt2x00lib
+       Abstract: rt2x00 generic link tuning routines.
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+
+#include "rt2x00.h"
+#include "rt2x00lib.h"
+
+/*
+ * When we lack RSSI information return something less then -80 to
+ * tell the driver to tune the device to maximum sensitivity.
+ */
+#define DEFAULT_RSSI           -128
+
+/*
+ * When no TX/RX percentage could be calculated due to lack of
+ * frames on the air, we fallback to a percentage of 50%.
+ * This will assure we will get at least get some decent value
+ * when the link tuner starts.
+ * The value will be dropped and overwritten with the correct (measured)
+ * value anyway during the first run of the link tuner.
+ */
+#define DEFAULT_PERCENTAGE     50
+
+/*
+ * Small helper macro to work with moving/walking averages.
+ * When adding a value to the average value the following calculation
+ * is needed:
+ *
+ *        avg_rssi = ((avg_rssi * 7) + rssi) / 8;
+ *
+ * The advantage of this approach is that we only need 1 variable
+ * to store the average in (No need for a count and a total).
+ * But more importantly, normal average values will over time
+ * move less and less towards newly added values this results
+ * that with link tuning, the device can have a very good RSSI
+ * for a few minutes but when the device is moved away from the AP
+ * the average will not decrease fast enough to compensate.
+ * The walking average compensates this and will move towards
+ * the new values correctly allowing a effective link tuning.
+ */
+#define MOVING_AVERAGE(__avg, __val, __samples) \
+       ( (((__avg) * ((__samples) - 1)) + (__val)) / (__samples) )
+
+/*
+ * Small helper macro for percentage calculation
+ * This is a very simple macro with the only catch that it will
+ * produce a default value in case no total value was provided.
+ */
+#define PERCENTAGE(__value, __total) \
+       ( (__total) ? (((__value) * 100) / (__total)) : (DEFAULT_PERCENTAGE) )
+
+/*
+ * For calculating the Signal quality we have determined
+ * the total number of success and failed RX and TX frames.
+ * With the addition of the average RSSI value we can determine
+ * the link quality using the following algorithm:
+ *
+ *         rssi_percentage = (avg_rssi * 100) / rssi_offset
+ *         rx_percentage = (rx_success * 100) / rx_total
+ *         tx_percentage = (tx_success * 100) / tx_total
+ *         avg_signal = ((WEIGHT_RSSI * avg_rssi) +
+ *                       (WEIGHT_TX * tx_percentage) +
+ *                       (WEIGHT_RX * rx_percentage)) / 100
+ *
+ * This value should then be checked to not be greater then 100.
+ * This means the values of WEIGHT_RSSI, WEIGHT_RX, WEIGHT_TX must
+ * sum up to 100 as well.
+ */
+#define WEIGHT_RSSI    20
+#define WEIGHT_RX      40
+#define WEIGHT_TX      40
+
+static int rt2x00link_antenna_get_link_rssi(struct rt2x00_dev *rt2x00dev)
+{
+       struct link_ant *ant = &rt2x00dev->link.ant;
+
+       if (ant->rssi_ant && rt2x00dev->link.qual.rx_success)
+               return ant->rssi_ant;
+       return DEFAULT_RSSI;
+}
+
+static int rt2x00link_antenna_get_rssi_history(struct rt2x00_dev *rt2x00dev,
+                                              enum antenna antenna)
+{
+       struct link_ant *ant = &rt2x00dev->link.ant;
+
+       if (ant->rssi_history[antenna - ANTENNA_A])
+               return ant->rssi_history[antenna - ANTENNA_A];
+       return DEFAULT_RSSI;
+}
+/* Small wrapper for rt2x00link_antenna_get_rssi_history() */
+#define rt2x00link_antenna_get_rssi_rx_history(__dev) \
+       rt2x00link_antenna_get_rssi_history((__dev), \
+                                           (__dev)->link.ant.active.rx)
+#define rt2x00link_antenna_get_rssi_tx_history(__dev) \
+       rt2x00link_antenna_get_rssi_history((__dev), \
+                                           (__dev)->link.ant.active.tx)
+
+static void rt2x00link_antenna_update_rssi_history(struct rt2x00_dev *rt2x00dev,
+                                                  enum antenna antenna,
+                                                  int rssi)
+{
+       struct link_ant *ant = &rt2x00dev->link.ant;
+       ant->rssi_history[ant->active.rx - ANTENNA_A] = rssi;
+}
+/* Small wrapper for rt2x00link_antenna_get_rssi_history() */
+#define rt2x00link_antenna_update_rssi_rx_history(__dev, __rssi) \
+       rt2x00link_antenna_update_rssi_history((__dev), \
+                                              (__dev)->link.ant.active.rx, \
+                                              (__rssi))
+#define rt2x00link_antenna_update_rssi_tx_history(__dev, __rssi) \
+       rt2x00link_antenna_update_rssi_history((__dev), \
+                                              (__dev)->link.ant.active.tx, \
+                                              (__rssi))
+
+static void rt2x00link_antenna_reset(struct rt2x00_dev *rt2x00dev)
+{
+       rt2x00dev->link.ant.rssi_ant = 0;
+}
+
+static void rt2x00lib_antenna_diversity_sample(struct rt2x00_dev *rt2x00dev)
+{
+       struct link_ant *ant = &rt2x00dev->link.ant;
+       struct antenna_setup new_ant;
+       int sample_a = rt2x00link_antenna_get_rssi_history(rt2x00dev, ANTENNA_A);
+       int sample_b = rt2x00link_antenna_get_rssi_history(rt2x00dev, ANTENNA_B);
+
+       memcpy(&new_ant, &ant->active, sizeof(new_ant));
+
+       /*
+        * We are done sampling. Now we should evaluate the results.
+        */
+       ant->flags &= ~ANTENNA_MODE_SAMPLE;
+
+       /*
+        * During the last period we have sampled the RSSI
+        * from both antenna's. It now is time to determine
+        * which antenna demonstrated the best performance.
+        * When we are already on the antenna with the best
+        * performance, then there really is nothing for us
+        * left to do.
+        */
+       if (sample_a == sample_b)
+               return;
+
+       if (ant->flags & ANTENNA_RX_DIVERSITY)
+               new_ant.rx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B;
+
+       if (ant->flags & ANTENNA_TX_DIVERSITY)
+               new_ant.tx = (sample_a > sample_b) ? ANTENNA_A : ANTENNA_B;
+
+       rt2x00lib_config_antenna(rt2x00dev, &new_ant);
+}
+
+static void rt2x00lib_antenna_diversity_eval(struct rt2x00_dev *rt2x00dev)
+{
+       struct link_ant *ant = &rt2x00dev->link.ant;
+       struct antenna_setup new_ant;
+       int rssi_curr;
+       int rssi_old;
+
+       memcpy(&new_ant, &ant->active, sizeof(new_ant));
+
+       /*
+        * Get current RSSI value along with the historical value,
+        * after that update the history with the current value.
+        */
+       rssi_curr = rt2x00link_antenna_get_link_rssi(rt2x00dev);
+       rssi_old = rt2x00link_antenna_get_rssi_rx_history(rt2x00dev);
+       rt2x00link_antenna_update_rssi_rx_history(rt2x00dev, rssi_curr);
+
+       /*
+        * Legacy driver indicates that we should swap antenna's
+        * when the difference in RSSI is greater that 5. This
+        * also should be done when the RSSI was actually better
+        * then the previous sample.
+        * When the difference exceeds the threshold we should
+        * sample the rssi from the other antenna to make a valid
+        * comparison between the 2 antennas.
+        */
+       if (abs(rssi_curr - rssi_old) < 5)
+               return;
+
+       ant->flags |= ANTENNA_MODE_SAMPLE;
+
+       if (ant->flags & ANTENNA_RX_DIVERSITY)
+               new_ant.rx = (new_ant.rx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
+
+       if (ant->flags & ANTENNA_TX_DIVERSITY)
+               new_ant.tx = (new_ant.tx == ANTENNA_A) ? ANTENNA_B : ANTENNA_A;
+
+       rt2x00lib_config_antenna(rt2x00dev, &new_ant);
+}
+
+static void rt2x00lib_antenna_diversity(struct rt2x00_dev *rt2x00dev)
+{
+       struct link_ant *ant = &rt2x00dev->link.ant;
+
+       /*
+        * Determine if software diversity is enabled for
+        * either the TX or RX antenna (or both).
+        * Always perform this check since within the link
+        * tuner interval the configuration might have changed.
+        */
+       ant->flags &= ~ANTENNA_RX_DIVERSITY;
+       ant->flags &= ~ANTENNA_TX_DIVERSITY;
+
+       if (rt2x00dev->default_ant.rx == ANTENNA_SW_DIVERSITY)
+               ant->flags |= ANTENNA_RX_DIVERSITY;
+       if (rt2x00dev->default_ant.tx == ANTENNA_SW_DIVERSITY)
+               ant->flags |= ANTENNA_TX_DIVERSITY;
+
+       if (!(ant->flags & ANTENNA_RX_DIVERSITY) &&
+           !(ant->flags & ANTENNA_TX_DIVERSITY)) {
+               ant->flags = 0;
+               return;
+       }
+
+       /*
+        * If we have only sampled the data over the last period
+        * we should now harvest the data. Otherwise just evaluate
+        * the data. The latter should only be performed once
+        * every 2 seconds.
+        */
+       if (ant->flags & ANTENNA_MODE_SAMPLE)
+               rt2x00lib_antenna_diversity_sample(rt2x00dev);
+       else if (rt2x00dev->link.count & 1)
+               rt2x00lib_antenna_diversity_eval(rt2x00dev);
+}
+
+void rt2x00link_update_stats(struct rt2x00_dev *rt2x00dev,
+                            struct sk_buff *skb,
+                            struct rxdone_entry_desc *rxdesc)
+{
+       struct link *link = &rt2x00dev->link;
+       struct link_qual *qual = &rt2x00dev->link.qual;
+       struct link_ant *ant = &rt2x00dev->link.ant;
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
+       int avg_rssi = rxdesc->rssi;
+       int ant_rssi = rxdesc->rssi;
+
+       /*
+        * Frame was received successfully since non-succesfull
+        * frames would have been dropped by the hardware.
+        */
+       qual->rx_success++;
+
+       /*
+        * We are only interested in quality statistics from
+        * beacons which came from the BSS which we are
+        * associated with.
+        */
+       if (!ieee80211_is_beacon(hdr->frame_control) ||
+           !(rxdesc->dev_flags & RXDONE_MY_BSS))
+               return;
+
+       /*
+        * Update global RSSI
+        */
+       if (link->avg_rssi)
+               avg_rssi = MOVING_AVERAGE(link->avg_rssi, rxdesc->rssi, 8);
+       link->avg_rssi = avg_rssi;
+
+       /*
+        * Update antenna RSSI
+        */
+       if (ant->rssi_ant)
+               ant_rssi = MOVING_AVERAGE(ant->rssi_ant, rxdesc->rssi, 8);
+       ant->rssi_ant = ant_rssi;
+}
+
+static void rt2x00link_precalculate_signal(struct rt2x00_dev *rt2x00dev)
+{
+       struct link *link = &rt2x00dev->link;
+       struct link_qual *qual = &rt2x00dev->link.qual;
+
+       link->rx_percentage =
+           PERCENTAGE(qual->rx_success, qual->rx_failed + qual->rx_success);
+       link->tx_percentage =
+           PERCENTAGE(qual->tx_success, qual->tx_failed + qual->tx_success);
+
+       qual->rx_success = 0;
+       qual->rx_failed = 0;
+       qual->tx_success = 0;
+       qual->tx_failed = 0;
+}
+
+int rt2x00link_calculate_signal(struct rt2x00_dev *rt2x00dev, int rssi)
+{
+       struct link *link = &rt2x00dev->link;
+       int rssi_percentage = 0;
+       int signal;
+
+       /*
+        * We need a positive value for the RSSI.
+        */
+       if (rssi < 0)
+               rssi += rt2x00dev->rssi_offset;
+
+       /*
+        * Calculate the different percentages,
+        * which will be used for the signal.
+        */
+       rssi_percentage = PERCENTAGE(rssi, rt2x00dev->rssi_offset);
+
+       /*
+        * Add the individual percentages and use the WEIGHT
+        * defines to calculate the current link signal.
+        */
+       signal = ((WEIGHT_RSSI * rssi_percentage) +
+                 (WEIGHT_TX * link->tx_percentage) +
+                 (WEIGHT_RX * link->rx_percentage)) / 100;
+
+       return max_t(int, signal, 100);
+}
+
+void rt2x00link_start_tuner(struct rt2x00_dev *rt2x00dev)
+{
+       struct link *link = &rt2x00dev->link;
+
+       /*
+        * Link tuning should only be performed when
+        * an active sta or master interface exists.
+        * Single monitor mode interfaces should never have
+        * work with link tuners.
+        */
+       if (!rt2x00dev->intf_ap_count && !rt2x00dev->intf_sta_count)
+               return;
+
+       link->rx_percentage = DEFAULT_PERCENTAGE;
+       link->tx_percentage = DEFAULT_PERCENTAGE;
+
+       rt2x00link_reset_tuner(rt2x00dev, false);
+
+       queue_delayed_work(rt2x00dev->hw->workqueue,
+                          &link->work, LINK_TUNE_INTERVAL);
+}
+
+void rt2x00link_stop_tuner(struct rt2x00_dev *rt2x00dev)
+{
+       cancel_delayed_work_sync(&rt2x00dev->link.work);
+}
+
+void rt2x00link_reset_tuner(struct rt2x00_dev *rt2x00dev, bool antenna)
+{
+       struct link_qual *qual = &rt2x00dev->link.qual;
+
+       if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
+               return;
+
+       /*
+        * Reset link information.
+        * Both the currently active vgc level as well as
+        * the link tuner counter should be reset. Resetting
+        * the counter is important for devices where the
+        * device should only perform link tuning during the
+        * first minute after being enabled.
+        */
+       rt2x00dev->link.count = 0;
+       memset(qual, 0, sizeof(*qual));
+
+       /*
+        * Reset the link tuner.
+        */
+       rt2x00dev->ops->lib->reset_tuner(rt2x00dev, qual);
+
+       if (antenna)
+               rt2x00link_antenna_reset(rt2x00dev);
+}
+
+static void rt2x00link_tuner(struct work_struct *work)
+{
+       struct rt2x00_dev *rt2x00dev =
+           container_of(work, struct rt2x00_dev, link.work.work);
+       struct link *link = &rt2x00dev->link;
+       struct link_qual *qual = &rt2x00dev->link.qual;
+
+       /*
+        * When the radio is shutting down we should
+        * immediately cease all link tuning.
+        */
+       if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags))
+               return;
+
+       /*
+        * Update statistics.
+        */
+       rt2x00dev->ops->lib->link_stats(rt2x00dev, qual);
+       rt2x00dev->low_level_stats.dot11FCSErrorCount += qual->rx_failed;
+
+       /*
+        * Update quality RSSI for link tuning,
+        * when we have received some frames and we managed to
+        * collect the RSSI data we could use this. Otherwise we
+        * must fallback to the default RSSI value.
+        */
+       if (!link->avg_rssi || !qual->rx_success)
+               qual->rssi = DEFAULT_RSSI;
+       else
+               qual->rssi = link->avg_rssi;
+
+       /*
+        * Only perform the link tuning when Link tuning
+        * has been enabled (This could have been disabled from the EEPROM).
+        */
+       if (!test_bit(CONFIG_DISABLE_LINK_TUNING, &rt2x00dev->flags))
+               rt2x00dev->ops->lib->link_tuner(rt2x00dev, qual, link->count);
+
+       /*
+        * Precalculate a portion of the link signal which is
+        * in based on the tx/rx success/failure counters.
+        */
+       rt2x00link_precalculate_signal(rt2x00dev);
+
+       /*
+        * Send a signal to the led to update the led signal strength.
+        */
+       rt2x00leds_led_quality(rt2x00dev, link->avg_rssi);
+
+       /*
+        * Evaluate antenna setup, make this the last step since this could
+        * possibly reset some statistics.
+        */
+       rt2x00lib_antenna_diversity(rt2x00dev);
+
+       /*
+        * Increase tuner counter, and reschedule the next link tuner run.
+        */
+       link->count++;
+       queue_delayed_work(rt2x00dev->hw->workqueue,
+                          &link->work, LINK_TUNE_INTERVAL);
+}
+
+void rt2x00link_register(struct rt2x00_dev *rt2x00dev)
+{
+       INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00link_tuner);
+}
index 38edee5fe1683c1022e3739efa808e0292f61eea..c41a0b9e473dc90e95a597a8a8d7ee404a64001c 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -79,8 +79,7 @@ static int rt2x00mac_tx_rts_cts(struct rt2x00_dev *rt2x00dev,
         * RTS/CTS frame should use the length of the frame plus any
         * encryption overhead that will be added by the hardware.
         */
-       if (!frag_skb->do_not_encrypt)
-               data_length += rt2x00crypto_tx_overhead(tx_info);
+       data_length += rt2x00crypto_tx_overhead(rt2x00dev, skb);
 
        if (tx_info->control.rates[0].flags & IEEE80211_TX_RC_USE_CTS_PROTECT)
                ieee80211_ctstoself_get(rt2x00dev->hw, tx_info->control.vif,
@@ -226,6 +225,8 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw,
                break;
        case NL80211_IFTYPE_STATION:
        case NL80211_IFTYPE_ADHOC:
+       case NL80211_IFTYPE_MESH_POINT:
+       case NL80211_IFTYPE_WDS:
                /*
                 * We don't support mixed combinations of
                 * sta and ap interfaces.
@@ -430,8 +431,10 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw,
        /*
         * Update the beacon.
         */
-       if (conf->changed & IEEE80211_IFCC_BEACON)
-               status = rt2x00queue_update_beacon(rt2x00dev, vif);
+       if (conf->changed & (IEEE80211_IFCC_BEACON |
+                            IEEE80211_IFCC_BEACON_ENABLED))
+               status = rt2x00queue_update_beacon(rt2x00dev, vif,
+                                                  conf->enable_beacon);
 
        return status;
 }
@@ -482,16 +485,36 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
 EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter);
 
 #ifdef CONFIG_RT2X00_LIB_CRYPTO
+static void memcpy_tkip(struct rt2x00lib_crypto *crypto, u8 *key, u8 key_len)
+{
+       if (key_len > NL80211_TKIP_DATA_OFFSET_ENCR_KEY)
+               memcpy(&crypto->key,
+                      &key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY],
+                      sizeof(crypto->key));
+
+       if (key_len > NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY)
+               memcpy(&crypto->tx_mic,
+                      &key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY],
+                      sizeof(crypto->tx_mic));
+
+       if (key_len > NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY)
+               memcpy(&crypto->rx_mic,
+                      &key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY],
+                      sizeof(crypto->rx_mic));
+}
+
 int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                     const u8 *local_address, const u8 *address,
+                     struct ieee80211_vif *vif, struct ieee80211_sta *sta,
                      struct ieee80211_key_conf *key)
 {
        struct rt2x00_dev *rt2x00dev = hw->priv;
-       struct ieee80211_sta *sta;
+       struct rt2x00_intf *intf = vif_to_intf(vif);
        int (*set_key) (struct rt2x00_dev *rt2x00dev,
                        struct rt2x00lib_crypto *crypto,
                        struct ieee80211_key_conf *key);
        struct rt2x00lib_crypto crypto;
+       static const u8 bcast_addr[ETH_ALEN] =
+               { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, };
 
        if (!test_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags))
                return 0;
@@ -509,45 +532,25 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
        if (rt2x00dev->intf_sta_count)
                crypto.bssidx = 0;
        else
-               crypto.bssidx =
-                   local_address[5] & (rt2x00dev->ops->max_ap_intf - 1);
+               crypto.bssidx = intf->mac[5] & (rt2x00dev->ops->max_ap_intf - 1);
 
        crypto.cipher = rt2x00crypto_key_to_cipher(key);
        if (crypto.cipher == CIPHER_NONE)
                return -EOPNOTSUPP;
 
        crypto.cmd = cmd;
-       crypto.address = address;
-
-       if (crypto.cipher == CIPHER_TKIP) {
-               if (key->keylen > NL80211_TKIP_DATA_OFFSET_ENCR_KEY)
-                       memcpy(&crypto.key,
-                              &key->key[NL80211_TKIP_DATA_OFFSET_ENCR_KEY],
-                              sizeof(crypto.key));
-
-               if (key->keylen > NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY)
-                       memcpy(&crypto.tx_mic,
-                              &key->key[NL80211_TKIP_DATA_OFFSET_TX_MIC_KEY],
-                              sizeof(crypto.tx_mic));
-
-               if (key->keylen > NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY)
-                       memcpy(&crypto.rx_mic,
-                              &key->key[NL80211_TKIP_DATA_OFFSET_RX_MIC_KEY],
-                              sizeof(crypto.rx_mic));
-       } else
-               memcpy(&crypto.key, &key->key[0], key->keylen);
 
-       /*
-        * Discover the Association ID from mac80211.
-        * Some drivers need this information when updating the
-        * hardware key (either adding or removing).
-        */
-       rcu_read_lock();
-       sta = ieee80211_find_sta(hw, address);
-       if (sta)
+       if (sta) {
+               /* some drivers need the AID */
                crypto.aid = sta->aid;
-       rcu_read_unlock();
+               crypto.address = sta->addr;
+       } else
+               crypto.address = bcast_addr;
 
+       if (crypto.cipher == CIPHER_TKIP)
+               memcpy_tkip(&crypto, &key->key[0], key->keylen);
+       else
+               memcpy(&crypto.key, &key->key[0], key->keylen);
        /*
         * Each BSS has a maximum of 4 shared keys.
         * Shared key index values:
index d52b22b82d1fb4662184b653efe50f99b43fec13..e616c20d4a782c4dd014927057342e779396548a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
index 9c0a4d77bc1be1e16ab79940c3c2cb0aa65859c2..15a12487e04b024cfde0400d407d11b67fa95a27 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
index 0709decec9c237aa93dcb79052a0b8f5d3d61e3a..a5664bd8493e878062e32bd4e0ec055800faad79 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -148,20 +148,105 @@ void rt2x00queue_free_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb)
        dev_kfree_skb_any(skb);
 }
 
+static void rt2x00queue_create_tx_descriptor_seq(struct queue_entry *entry,
+                                                struct txentry_desc *txdesc)
+{
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
+       struct rt2x00_intf *intf = vif_to_intf(tx_info->control.vif);
+       unsigned long irqflags;
+
+       if (!(tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) ||
+           unlikely(!tx_info->control.vif))
+               return;
+
+       /*
+        * Hardware should insert sequence counter.
+        * FIXME: We insert a software sequence counter first for
+        * hardware that doesn't support hardware sequence counting.
+        *
+        * This is wrong because beacons are not getting sequence
+        * numbers assigned properly.
+        *
+        * A secondary problem exists for drivers that cannot toggle
+        * sequence counting per-frame, since those will override the
+        * sequence counter given by mac80211.
+        */
+       spin_lock_irqsave(&intf->seqlock, irqflags);
+
+       if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
+               intf->seqno += 0x10;
+       hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
+       hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
+
+       spin_unlock_irqrestore(&intf->seqlock, irqflags);
+
+       __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
+}
+
+static void rt2x00queue_create_tx_descriptor_plcp(struct queue_entry *entry,
+                                                 struct txentry_desc *txdesc,
+                                                 const struct rt2x00_rate *hwrate)
+{
+       struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
+       struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
+       struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
+       unsigned int data_length;
+       unsigned int duration;
+       unsigned int residual;
+
+       /* Data length + CRC + Crypto overhead (IV/EIV/ICV/MIC) */
+       data_length = entry->skb->len + 4;
+       data_length += rt2x00crypto_tx_overhead(rt2x00dev, entry->skb);
+
+       /*
+        * PLCP setup
+        * Length calculation depends on OFDM/CCK rate.
+        */
+       txdesc->signal = hwrate->plcp;
+       txdesc->service = 0x04;
+
+       if (hwrate->flags & DEV_RATE_OFDM) {
+               txdesc->length_high = (data_length >> 6) & 0x3f;
+               txdesc->length_low = data_length & 0x3f;
+       } else {
+               /*
+                * Convert length to microseconds.
+                */
+               residual = GET_DURATION_RES(data_length, hwrate->bitrate);
+               duration = GET_DURATION(data_length, hwrate->bitrate);
+
+               if (residual != 0) {
+                       duration++;
+
+                       /*
+                        * Check if we need to set the Length Extension
+                        */
+                       if (hwrate->bitrate == 110 && residual <= 30)
+                               txdesc->service |= 0x80;
+               }
+
+               txdesc->length_high = (duration >> 8) & 0xff;
+               txdesc->length_low = duration & 0xff;
+
+               /*
+                * When preamble is enabled we should set the
+                * preamble bit for the signal.
+                */
+               if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
+                       txdesc->signal |= 0x08;
+       }
+}
+
 static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
                                             struct txentry_desc *txdesc)
 {
        struct rt2x00_dev *rt2x00dev = entry->queue->rt2x00dev;
        struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(entry->skb);
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)entry->skb->data;
-       struct ieee80211_tx_rate *txrate = &tx_info->control.rates[0];
        struct ieee80211_rate *rate =
            ieee80211_get_tx_rate(rt2x00dev->hw, tx_info);
        const struct rt2x00_rate *hwrate;
-       unsigned int data_length;
-       unsigned int duration;
-       unsigned int residual;
-       unsigned long irqflags;
 
        memset(txdesc, 0, sizeof(*txdesc));
 
@@ -173,27 +258,12 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
        txdesc->cw_max = entry->queue->cw_max;
        txdesc->aifs = entry->queue->aifs;
 
-       /* Data length + CRC */
-       data_length = entry->skb->len + 4;
-
        /*
         * Check whether this frame is to be acked.
         */
        if (!(tx_info->flags & IEEE80211_TX_CTL_NO_ACK))
                __set_bit(ENTRY_TXD_ACK, &txdesc->flags);
 
-       if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags) &&
-           !entry->skb->do_not_encrypt) {
-               /* Apply crypto specific descriptor information */
-               rt2x00crypto_create_tx_descriptor(entry, txdesc);
-
-               /*
-                * Extend frame length to include all encryption overhead
-                * that will be added by the hardware.
-                */
-               data_length += rt2x00crypto_tx_overhead(tx_info);
-       }
-
        /*
         * Check if this is a RTS/CTS frame
         */
@@ -237,86 +307,27 @@ static void rt2x00queue_create_tx_descriptor(struct queue_entry *entry,
         * Set ifs to IFS_SIFS when the this is not the first fragment,
         * or this fragment came after RTS/CTS.
         */
-       if (test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)) {
-               txdesc->ifs = IFS_SIFS;
-       } else if (tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) {
+       if ((tx_info->flags & IEEE80211_TX_CTL_FIRST_FRAGMENT) &&
+           !test_bit(ENTRY_TXD_RTS_FRAME, &txdesc->flags)) {
                __set_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags);
                txdesc->ifs = IFS_BACKOFF;
-       } else {
+       } else
                txdesc->ifs = IFS_SIFS;
-       }
 
        /*
-        * Hardware should insert sequence counter.
-        * FIXME: We insert a software sequence counter first for
-        * hardware that doesn't support hardware sequence counting.
-        *
-        * This is wrong because beacons are not getting sequence
-        * numbers assigned properly.
-        *
-        * A secondary problem exists for drivers that cannot toggle
-        * sequence counting per-frame, since those will override the
-        * sequence counter given by mac80211.
+        * Determine rate modulation.
         */
-       if (tx_info->flags & IEEE80211_TX_CTL_ASSIGN_SEQ) {
-               if (likely(tx_info->control.vif)) {
-                       struct rt2x00_intf *intf;
-
-                       intf = vif_to_intf(tx_info->control.vif);
-
-                       spin_lock_irqsave(&intf->seqlock, irqflags);
-
-                       if (test_bit(ENTRY_TXD_FIRST_FRAGMENT, &txdesc->flags))
-                               intf->seqno += 0x10;
-                       hdr->seq_ctrl &= cpu_to_le16(IEEE80211_SCTL_FRAG);
-                       hdr->seq_ctrl |= cpu_to_le16(intf->seqno);
-
-                       spin_unlock_irqrestore(&intf->seqlock, irqflags);
-
-                       __set_bit(ENTRY_TXD_GENERATE_SEQ, &txdesc->flags);
-               }
-       }
+       hwrate = rt2x00_get_rate(rate->hw_value);
+       txdesc->rate_mode = RATE_MODE_CCK;
+       if (hwrate->flags & DEV_RATE_OFDM)
+               txdesc->rate_mode = RATE_MODE_OFDM;
 
        /*
-        * PLCP setup
-        * Length calculation depends on OFDM/CCK rate.
+        * Apply TX descriptor handling by components
         */
-       hwrate = rt2x00_get_rate(rate->hw_value);
-       txdesc->signal = hwrate->plcp;
-       txdesc->service = 0x04;
-
-       if (hwrate->flags & DEV_RATE_OFDM) {
-               __set_bit(ENTRY_TXD_OFDM_RATE, &txdesc->flags);
-
-               txdesc->length_high = (data_length >> 6) & 0x3f;
-               txdesc->length_low = data_length & 0x3f;
-       } else {
-               /*
-                * Convert length to microseconds.
-                */
-               residual = GET_DURATION_RES(data_length, hwrate->bitrate);
-               duration = GET_DURATION(data_length, hwrate->bitrate);
-
-               if (residual != 0) {
-                       duration++;
-
-                       /*
-                        * Check if we need to set the Length Extension
-                        */
-                       if (hwrate->bitrate == 110 && residual <= 30)
-                               txdesc->service |= 0x80;
-               }
-
-               txdesc->length_high = (duration >> 8) & 0xff;
-               txdesc->length_low = duration & 0xff;
-
-               /*
-                * When preamble is enabled we should set the
-                * preamble bit for the signal.
-                */
-               if (txrate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE)
-                       txdesc->signal |= 0x08;
-       }
+       rt2x00crypto_create_tx_descriptor(entry, txdesc);
+       rt2x00queue_create_tx_descriptor_seq(entry, txdesc);
+       rt2x00queue_create_tx_descriptor_plcp(entry, txdesc, hwrate);
 }
 
 static void rt2x00queue_write_tx_descriptor(struct queue_entry *entry,
@@ -403,7 +414,7 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
         */
        if (test_bit(ENTRY_TXD_ENCRYPT, &txdesc.flags) &&
            !test_bit(ENTRY_TXD_ENCRYPT_IV, &txdesc.flags)) {
-               if (test_bit(CONFIG_CRYPTO_COPY_IV, &queue->rt2x00dev->flags))
+               if (test_bit(DRIVER_REQUIRE_COPY_IV, &queue->rt2x00dev->flags))
                        rt2x00crypto_tx_copy_iv(skb, iv_len);
                else
                        rt2x00crypto_tx_remove_iv(skb, iv_len);
@@ -432,7 +443,8 @@ int rt2x00queue_write_tx_frame(struct data_queue *queue, struct sk_buff *skb)
 }
 
 int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
-                             struct ieee80211_vif *vif)
+                             struct ieee80211_vif *vif,
+                             const bool enable_beacon)
 {
        struct rt2x00_intf *intf = vif_to_intf(vif);
        struct skb_frame_desc *skbdesc;
@@ -442,6 +454,11 @@ int rt2x00queue_update_beacon(struct rt2x00_dev *rt2x00dev,
        if (unlikely(!intf->beacon))
                return -ENOBUFS;
 
+       if (!enable_beacon) {
+               rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, QID_BEACON);
+               return 0;
+       }
+
        intf->beacon->skb = ieee80211_beacon_get(rt2x00dev->hw, vif);
        if (!intf->beacon->skb)
                return -ENOMEM;
@@ -490,6 +507,9 @@ struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev,
 {
        int atim = test_bit(DRIVER_REQUIRE_ATIM_QUEUE, &rt2x00dev->flags);
 
+       if (queue == QID_RX)
+               return rt2x00dev->rx;
+
        if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx)
                return &rt2x00dev->tx[queue];
 
@@ -566,6 +586,14 @@ static void rt2x00queue_reset(struct data_queue *queue)
        spin_unlock_irqrestore(&queue->lock, irqflags);
 }
 
+void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev)
+{
+       struct data_queue *queue;
+
+       txall_queue_for_each(rt2x00dev, queue)
+               rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, queue->qid);
+}
+
 void rt2x00queue_init_queues(struct rt2x00_dev *rt2x00dev)
 {
        struct data_queue *queue;
index 28293715340849363aa98eeb480f18f593fae7ec..97e2ab08f080153bf1576d14701d4b18e1650437 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -157,6 +157,14 @@ enum rxdone_entry_desc_flags {
        RXDONE_CRYPTO_ICV = 1 << 4,
 };
 
+/**
+ * RXDONE_SIGNAL_MASK - Define to mask off all &rxdone_entry_desc_flags flags
+ * except for the RXDONE_SIGNAL_* flags. This is useful to convert the dev_flags
+ * from &rxdone_entry_desc to a signal value type.
+ */
+#define RXDONE_SIGNAL_MASK \
+       ( RXDONE_SIGNAL_PLCP | RXDONE_SIGNAL_BITRATE )
+
 /**
  * struct rxdone_entry_desc: RX Entry descriptor
  *
@@ -165,6 +173,7 @@ enum rxdone_entry_desc_flags {
  * @timestamp: RX Timestamp
  * @signal: Signal of the received frame.
  * @rssi: RSSI of the received frame.
+ * @noise: Measured noise during frame reception.
  * @size: Data size of the received frame.
  * @flags: MAC80211 receive flags (See &enum mac80211_rx_flags).
  * @dev_flags: Ralink receive flags (See &enum rxdone_entry_desc_flags).
@@ -177,6 +186,7 @@ struct rxdone_entry_desc {
        u64 timestamp;
        int signal;
        int rssi;
+       int noise;
        int size;
        int flags;
        int dev_flags;
@@ -222,7 +232,6 @@ struct txdone_entry_desc {
  *
  * @ENTRY_TXD_RTS_FRAME: This frame is a RTS frame.
  * @ENTRY_TXD_CTS_FRAME: This frame is a CTS-to-self frame.
- * @ENTRY_TXD_OFDM_RATE: This frame is send out with an OFDM rate.
  * @ENTRY_TXD_GENERATE_SEQ: This frame requires sequence counter.
  * @ENTRY_TXD_FIRST_FRAGMENT: This is the first frame.
  * @ENTRY_TXD_MORE_FRAG: This frame is followed by another fragment.
@@ -238,7 +247,6 @@ struct txdone_entry_desc {
 enum txentry_desc_flags {
        ENTRY_TXD_RTS_FRAME,
        ENTRY_TXD_CTS_FRAME,
-       ENTRY_TXD_OFDM_RATE,
        ENTRY_TXD_GENERATE_SEQ,
        ENTRY_TXD_FIRST_FRAGMENT,
        ENTRY_TXD_MORE_FRAG,
@@ -263,6 +271,7 @@ enum txentry_desc_flags {
  * @length_low: PLCP length low word.
  * @signal: PLCP signal.
  * @service: PLCP service.
+ * @rate_mode: Rate mode (See @enum rate_modulation).
  * @retry_limit: Max number of retries.
  * @aifs: AIFS value.
  * @ifs: IFS value.
@@ -282,6 +291,8 @@ struct txentry_desc {
        u16 signal;
        u16 service;
 
+       u16 rate_mode;
+
        short retry_limit;
        short aifs;
        short ifs;
index c2fba7c9f05cc86c6fccc2dfadb8a23daa1beb93..861322d97fceef064cb46d137bca42e288d75dd6 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -124,6 +124,26 @@ enum cipher {
        CIPHER_MAX = 4,
 };
 
+/*
+ * Rate modulations
+ */
+enum rate_modulation {
+       RATE_MODE_CCK = 0,
+       RATE_MODE_OFDM = 1,
+       RATE_MODE_HT_MIX = 2,
+       RATE_MODE_HT_GREENFIELD = 3,
+};
+
+/*
+ * Firmware validation error codes
+ */
+enum firmware_errors {
+       FW_OK,
+       FW_BAD_CRC,
+       FW_BAD_LENGTH,
+       FW_BAD_VERSION,
+};
+
 /*
  * Register handlers.
  * We store the position of a register field inside a field structure,
index 3298cae1e12d50056aa2b22896dea537a9ab9e67..b6d4c6700bf3f8c7342354805287333462f46c9f 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
 
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/rfkill.h>
 
 #include "rt2x00.h"
 #include "rt2x00lib.h"
 
-static int rt2x00rfkill_toggle_radio(void *data, enum rfkill_state state)
+static void rt2x00rfkill_poll(struct input_polled_dev *poll_dev)
 {
-       struct rt2x00_dev *rt2x00dev = data;
-       int retval = 0;
-
-       if (unlikely(!rt2x00dev))
-               return 0;
-
-       /*
-        * Only continue if there are enabled interfaces.
-        */
-       if (!test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags))
-               return 0;
-
-       if (state == RFKILL_STATE_UNBLOCKED) {
-               INFO(rt2x00dev, "RFKILL event: enabling radio.\n");
-               clear_bit(DEVICE_STATE_DISABLED_RADIO_HW, &rt2x00dev->flags);
-               retval = rt2x00lib_enable_radio(rt2x00dev);
-       } else if (state == RFKILL_STATE_SOFT_BLOCKED) {
-               INFO(rt2x00dev, "RFKILL event: disabling radio.\n");
-               set_bit(DEVICE_STATE_DISABLED_RADIO_HW, &rt2x00dev->flags);
-               rt2x00lib_disable_radio(rt2x00dev);
-       } else {
-               WARNING(rt2x00dev, "RFKILL event: unknown state %d.\n", state);
-       }
-
-       return retval;
-}
-
-static int rt2x00rfkill_get_state(void *data, enum rfkill_state *state)
-{
-       struct rt2x00_dev *rt2x00dev = data;
-
-       /*
-        * rfkill_poll reports 1 when the key has been pressed and the
-        * radio should be blocked.
-        */
-       *state = rt2x00dev->ops->lib->rfkill_poll(rt2x00dev) ?
-           RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_UNBLOCKED;
-
-       return 0;
-}
-
-static void rt2x00rfkill_poll(struct work_struct *work)
-{
-       struct rt2x00_dev *rt2x00dev =
-           container_of(work, struct rt2x00_dev, rfkill_work.work);
-       enum rfkill_state state;
+       struct rt2x00_dev *rt2x00dev = poll_dev->private;
+       int state, old_state;
 
        if (!test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state) ||
            !test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
                return;
 
        /*
-        * Poll latest state and report it to rfkill who should sort
-        * out if the state should be toggled or not.
+        * Poll latest state, if the state is different then the previous state,
+        * we should generate an input event.
         */
-       if (!rt2x00rfkill_get_state(rt2x00dev, &state))
-               rfkill_force_state(rt2x00dev->rfkill, state);
+       state = !!rt2x00dev->ops->lib->rfkill_poll(rt2x00dev);
+       old_state = !!test_bit(RFKILL_STATE_BLOCKED, &rt2x00dev->rfkill_state);
 
-       queue_delayed_work(rt2x00dev->hw->workqueue,
-                          &rt2x00dev->rfkill_work, RFKILL_POLL_INTERVAL);
+       if (old_state != state) {
+               input_report_switch(poll_dev->input, SW_RFKILL_ALL, state);
+               change_bit(RFKILL_STATE_BLOCKED, &rt2x00dev->rfkill_state);
+       }
 }
 
 void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
@@ -100,8 +57,8 @@ void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
            test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state))
                return;
 
-       if (rfkill_register(rt2x00dev->rfkill)) {
-               ERROR(rt2x00dev, "Failed to register rfkill handler.\n");
+       if (input_register_polled_device(rt2x00dev->rfkill_poll_dev)) {
+               ERROR(rt2x00dev, "Failed to register polled device.\n");
                return;
        }
 
@@ -109,10 +66,10 @@ void rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev)
 
        /*
         * Force initial poll which will detect the initial device state,
-        * and correctly sends the signal to the rfkill layer about this
+        * and correctly sends the signal to the input layer about this
         * state.
         */
-       rt2x00rfkill_poll(&rt2x00dev->rfkill_work.work);
+       rt2x00rfkill_poll(rt2x00dev->rfkill_poll_dev);
 }
 
 void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
@@ -121,52 +78,50 @@ void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev)
            !test_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state))
                return;
 
-       cancel_delayed_work_sync(&rt2x00dev->rfkill_work);
-
-       rfkill_unregister(rt2x00dev->rfkill);
+       input_unregister_polled_device(rt2x00dev->rfkill_poll_dev);
 
        __clear_bit(RFKILL_STATE_REGISTERED, &rt2x00dev->rfkill_state);
 }
 
 void rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev)
 {
-       struct device *dev = wiphy_dev(rt2x00dev->hw->wiphy);
+       struct input_polled_dev *poll_dev;
 
-       if (test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
+       if (test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state) ||
+           !test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags))
                return;
 
-       rt2x00dev->rfkill = rfkill_allocate(dev, RFKILL_TYPE_WLAN);
-       if (!rt2x00dev->rfkill) {
-               ERROR(rt2x00dev, "Failed to allocate rfkill handler.\n");
+       poll_dev = input_allocate_polled_device();
+       if (!poll_dev) {
+               ERROR(rt2x00dev, "Failed to allocate polled device.\n");
                return;
        }
 
-       __set_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state);
+       poll_dev->private = rt2x00dev;
+       poll_dev->poll = rt2x00rfkill_poll;
+       poll_dev->poll_interval = RFKILL_POLL_INTERVAL;
 
-       rt2x00dev->rfkill->name = rt2x00dev->ops->name;
-       rt2x00dev->rfkill->data = rt2x00dev;
-       rt2x00dev->rfkill->toggle_radio = rt2x00rfkill_toggle_radio;
-       if (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) {
-               rt2x00dev->rfkill->get_state = rt2x00rfkill_get_state;
-               rt2x00dev->rfkill->state =
-                       rt2x00dev->ops->lib->rfkill_poll(rt2x00dev) ?
-                           RFKILL_STATE_SOFT_BLOCKED : RFKILL_STATE_UNBLOCKED;
-       } else {
-               rt2x00dev->rfkill->state = RFKILL_STATE_UNBLOCKED;
-       }
+       poll_dev->input->name = rt2x00dev->ops->name;
+       poll_dev->input->phys = wiphy_name(rt2x00dev->hw->wiphy);
+       poll_dev->input->id.bustype = BUS_HOST;
+       poll_dev->input->id.vendor = 0x1814;
+       poll_dev->input->id.product = rt2x00dev->chip.rt;
+       poll_dev->input->id.version = rt2x00dev->chip.rev;
+       poll_dev->input->dev.parent = wiphy_dev(rt2x00dev->hw->wiphy);
+       poll_dev->input->evbit[0] = BIT(EV_SW);
+       poll_dev->input->swbit[0] = BIT(SW_RFKILL_ALL);
 
-       INIT_DELAYED_WORK(&rt2x00dev->rfkill_work, rt2x00rfkill_poll);
+       rt2x00dev->rfkill_poll_dev = poll_dev;
 
-       return;
+       __set_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state);
 }
 
 void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev)
 {
-       if (!test_bit(RFKILL_STATE_ALLOCATED, &rt2x00dev->rfkill_state))
+       if (!__test_and_clear_bit(RFKILL_STATE_ALLOCATED,
+                                 &rt2x00dev->rfkill_state))
                return;
 
-       cancel_delayed_work_sync(&rt2x00dev->rfkill_work);
-
-       rfkill_free(rt2x00dev->rfkill);
-       rt2x00dev->rfkill = NULL;
+       input_free_polled_device(rt2x00dev->rfkill_poll_dev);
+       rt2x00dev->rfkill_poll_dev = NULL;
 }
index 0b29d767a2582296d0e7d22ea22b24fb02dae543..7d50ca82375eb1bd1b75a1f845fcc1e3121cdf85 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -296,6 +296,41 @@ void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_kick_tx_queue);
 
+void rt2x00usb_kill_tx_queue(struct rt2x00_dev *rt2x00dev,
+                            const enum data_queue_qid qid)
+{
+       struct data_queue *queue = rt2x00queue_get_queue(rt2x00dev, qid);
+       struct queue_entry_priv_usb *entry_priv;
+       struct queue_entry_priv_usb_bcn *bcn_priv;
+       unsigned int i;
+       bool kill_guard;
+
+       /*
+        * When killing the beacon queue, we must also kill
+        * the beacon guard byte.
+        */
+       kill_guard =
+           (qid == QID_BEACON) &&
+           (test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags));
+
+       /*
+        * Cancel all entries.
+        */
+       for (i = 0; i < queue->limit; i++) {
+               entry_priv = queue->entries[i].priv_data;
+               usb_kill_urb(entry_priv->urb);
+
+               /*
+                * Kill guardian urb (if required by driver).
+                */
+               if (kill_guard) {
+                       bcn_priv = queue->entries[i].priv_data;
+                       usb_kill_urb(bcn_priv->guardian_urb);
+               }
+       }
+}
+EXPORT_SYMBOL_GPL(rt2x00usb_kill_tx_queue);
+
 /*
  * RX data handlers.
  */
@@ -338,35 +373,14 @@ static void rt2x00usb_interrupt_rxdone(struct urb *urb)
  */
 void rt2x00usb_disable_radio(struct rt2x00_dev *rt2x00dev)
 {
-       struct queue_entry_priv_usb *entry_priv;
-       struct queue_entry_priv_usb_bcn *bcn_priv;
-       struct data_queue *queue;
-       unsigned int i;
-
        rt2x00usb_vendor_request_sw(rt2x00dev, USB_RX_CONTROL, 0, 0,
                                    REGISTER_TIMEOUT);
 
        /*
-        * Cancel all queues.
+        * The USB version of kill_tx_queue also works
+        * on the RX queue.
         */
-       queue_for_each(rt2x00dev, queue) {
-               for (i = 0; i < queue->limit; i++) {
-                       entry_priv = queue->entries[i].priv_data;
-                       usb_kill_urb(entry_priv->urb);
-               }
-       }
-
-       /*
-        * Kill guardian urb (if required by driver).
-        */
-       if (!test_bit(DRIVER_REQUIRE_BEACON_GUARD, &rt2x00dev->flags))
-               return;
-
-       for (i = 0; i < rt2x00dev->bcn->limit; i++) {
-               bcn_priv = rt2x00dev->bcn->entries[i].priv_data;
-               if (bcn_priv->guardian_urb)
-                       usb_kill_urb(bcn_priv->guardian_urb);
-       }
+       rt2x00dev->ops->lib->kill_tx_queue(rt2x00dev, QID_RX);
 }
 EXPORT_SYMBOL_GPL(rt2x00usb_disable_radio);
 
index 2bd4ac855f528db67f60879ee2166a7b280b037f..bd2d59c85f1b89dbd84d4dac4d5bc3c7e12cf579 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -419,6 +419,17 @@ struct queue_entry_priv_usb_bcn {
 void rt2x00usb_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
                             const enum data_queue_qid qid);
 
+/**
+ * rt2x00usb_kill_tx_queue - Kill data queue
+ * @rt2x00dev: Pointer to &struct rt2x00_dev
+ * @qid: Data queue to kill
+ *
+ * This will walk through all entries of the queue and kill all
+ * previously kicked frames before they can be send.
+ */
+void rt2x00usb_kill_tx_queue(struct rt2x00_dev *rt2x00dev,
+                             const enum data_queue_qid qid);
+
 /*
  * Device initialization handlers.
  */
index 987e89009f74ed36debc32498783d57812b68916..0be147f364e718271539b4f17adf03291a25d37a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -146,12 +146,6 @@ static void rt61pci_rf_write(struct rt2x00_dev *rt2x00dev,
        mutex_unlock(&rt2x00dev->csr_mutex);
 }
 
-#ifdef CONFIG_RT2X00_LIB_LEDS
-/*
- * This function is only called from rt61pci_led_brightness()
- * make gcc happy by placing this function inside the
- * same ifdef statement as the caller.
- */
 static void rt61pci_mcu_request(struct rt2x00_dev *rt2x00dev,
                                const u8 command, const u8 token,
                                const u8 arg0, const u8 arg1)
@@ -180,7 +174,6 @@ static void rt61pci_mcu_request(struct rt2x00_dev *rt2x00dev,
        mutex_unlock(&rt2x00dev->csr_mutex);
 
 }
-#endif /* CONFIG_RT2X00_LIB_LEDS */
 
 static void rt61pci_eepromregister_read(struct eeprom_93cx6 *eeprom)
 {
@@ -967,6 +960,50 @@ static void rt61pci_config_duration(struct rt2x00_dev *rt2x00dev,
        rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, reg);
 }
 
+static void rt61pci_config_ps(struct rt2x00_dev *rt2x00dev,
+                               struct rt2x00lib_conf *libconf)
+{
+       enum dev_state state =
+           (libconf->conf->flags & IEEE80211_CONF_PS) ?
+               STATE_SLEEP : STATE_AWAKE;
+       u32 reg;
+
+       if (state == STATE_SLEEP) {
+               rt2x00pci_register_read(rt2x00dev, MAC_CSR11, &reg);
+               rt2x00_set_field32(&reg, MAC_CSR11_DELAY_AFTER_TBCN,
+                                  libconf->conf->beacon_int - 10);
+               rt2x00_set_field32(&reg, MAC_CSR11_TBCN_BEFORE_WAKEUP,
+                                  libconf->conf->listen_interval - 1);
+               rt2x00_set_field32(&reg, MAC_CSR11_WAKEUP_LATENCY, 5);
+
+               /* We must first disable autowake before it can be enabled */
+               rt2x00_set_field32(&reg, MAC_CSR11_AUTOWAKE, 0);
+               rt2x00pci_register_write(rt2x00dev, MAC_CSR11, reg);
+
+               rt2x00_set_field32(&reg, MAC_CSR11_AUTOWAKE, 1);
+               rt2x00pci_register_write(rt2x00dev, MAC_CSR11, reg);
+
+               rt2x00pci_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000005);
+               rt2x00pci_register_write(rt2x00dev, IO_CNTL_CSR, 0x0000001c);
+               rt2x00pci_register_write(rt2x00dev, PCI_USEC_CSR, 0x00000060);
+
+               rt61pci_mcu_request(rt2x00dev, MCU_SLEEP, 0xff, 0, 0);
+       } else {
+               rt2x00pci_register_read(rt2x00dev, MAC_CSR11, &reg);
+               rt2x00_set_field32(&reg, MAC_CSR11_DELAY_AFTER_TBCN, 0);
+               rt2x00_set_field32(&reg, MAC_CSR11_TBCN_BEFORE_WAKEUP, 0);
+               rt2x00_set_field32(&reg, MAC_CSR11_AUTOWAKE, 0);
+               rt2x00_set_field32(&reg, MAC_CSR11_WAKEUP_LATENCY, 0);
+               rt2x00pci_register_write(rt2x00dev, MAC_CSR11, reg);
+
+               rt2x00pci_register_write(rt2x00dev, SOFT_RESET_CSR, 0x00000007);
+               rt2x00pci_register_write(rt2x00dev, IO_CNTL_CSR, 0x00000018);
+               rt2x00pci_register_write(rt2x00dev, PCI_USEC_CSR, 0x00000020);
+
+               rt61pci_mcu_request(rt2x00dev, MCU_WAKEUP, 0xff, 0, 0);
+       }
+}
+
 static void rt61pci_config(struct rt2x00_dev *rt2x00dev,
                           struct rt2x00lib_conf *libconf,
                           const unsigned int flags)
@@ -984,6 +1021,8 @@ static void rt61pci_config(struct rt2x00_dev *rt2x00dev,
                rt61pci_config_retry_limit(rt2x00dev, libconf);
        if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
                rt61pci_config_duration(rt2x00dev, libconf);
+       if (flags & IEEE80211_CONF_CHANGE_PS)
+               rt61pci_config_ps(rt2x00dev, libconf);
 }
 
 /*
@@ -1007,21 +1046,28 @@ static void rt61pci_link_stats(struct rt2x00_dev *rt2x00dev,
        qual->false_cca = rt2x00_get_field32(reg, STA_CSR1_FALSE_CCA_ERROR);
 }
 
-static void rt61pci_reset_tuner(struct rt2x00_dev *rt2x00dev)
+static inline void rt61pci_set_vgc(struct rt2x00_dev *rt2x00dev,
+                                  struct link_qual *qual, u8 vgc_level)
 {
-       rt61pci_bbp_write(rt2x00dev, 17, 0x20);
-       rt2x00dev->link.vgc_level = 0x20;
+       if (qual->vgc_level != vgc_level) {
+               rt61pci_bbp_write(rt2x00dev, 17, vgc_level);
+               qual->vgc_level = vgc_level;
+               qual->vgc_level_reg = vgc_level;
+       }
+}
+
+static void rt61pci_reset_tuner(struct rt2x00_dev *rt2x00dev,
+                               struct link_qual *qual)
+{
+       rt61pci_set_vgc(rt2x00dev, qual, 0x20);
 }
 
-static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev)
+static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev,
+                              struct link_qual *qual, const u32 count)
 {
-       int rssi = rt2x00_get_link_rssi(&rt2x00dev->link);
-       u8 r17;
        u8 up_bound;
        u8 low_bound;
 
-       rt61pci_bbp_read(rt2x00dev, 17, &r17);
-
        /*
         * Determine r17 bounds.
         */
@@ -1051,38 +1097,32 @@ static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev)
        /*
         * Special big-R17 for very short distance
         */
-       if (rssi >= -35) {
-               if (r17 != 0x60)
-                       rt61pci_bbp_write(rt2x00dev, 17, 0x60);
+       if (qual->rssi >= -35) {
+               rt61pci_set_vgc(rt2x00dev, qual, 0x60);
                return;
        }
 
        /*
         * Special big-R17 for short distance
         */
-       if (rssi >= -58) {
-               if (r17 != up_bound)
-                       rt61pci_bbp_write(rt2x00dev, 17, up_bound);
+       if (qual->rssi >= -58) {
+               rt61pci_set_vgc(rt2x00dev, qual, up_bound);
                return;
        }
 
        /*
         * Special big-R17 for middle-short distance
         */
-       if (rssi >= -66) {
-               low_bound += 0x10;
-               if (r17 != low_bound)
-                       rt61pci_bbp_write(rt2x00dev, 17, low_bound);
+       if (qual->rssi >= -66) {
+               rt61pci_set_vgc(rt2x00dev, qual, low_bound + 0x10);
                return;
        }
 
        /*
         * Special mid-R17 for middle distance
         */
-       if (rssi >= -74) {
-               low_bound += 0x08;
-               if (r17 != low_bound)
-                       rt61pci_bbp_write(rt2x00dev, 17, low_bound);
+       if (qual->rssi >= -74) {
+               rt61pci_set_vgc(rt2x00dev, qual, low_bound + 0x08);
                return;
        }
 
@@ -1090,12 +1130,12 @@ static void rt61pci_link_tuner(struct rt2x00_dev *rt2x00dev)
         * Special case: Change up_bound based on the rssi.
         * Lower up_bound when rssi is weaker then -74 dBm.
         */
-       up_bound -= 2 * (-74 - rssi);
+       up_bound -= 2 * (-74 - qual->rssi);
        if (low_bound > up_bound)
                up_bound = low_bound;
 
-       if (r17 > up_bound) {
-               rt61pci_bbp_write(rt2x00dev, 17, up_bound);
+       if (qual->vgc_level > up_bound) {
+               rt61pci_set_vgc(rt2x00dev, qual, up_bound);
                return;
        }
 
@@ -1105,15 +1145,10 @@ dynamic_cca_tune:
         * r17 does not yet exceed upper limit, continue and base
         * the r17 tuning on the false CCA count.
         */
-       if (rt2x00dev->link.qual.false_cca > 512 && r17 < up_bound) {
-               if (++r17 > up_bound)
-                       r17 = up_bound;
-               rt61pci_bbp_write(rt2x00dev, 17, r17);
-       } else if (rt2x00dev->link.qual.false_cca < 100 && r17 > low_bound) {
-               if (--r17 < low_bound)
-                       r17 = low_bound;
-               rt61pci_bbp_write(rt2x00dev, 17, r17);
-       }
+       if ((qual->false_cca > 512) && (qual->vgc_level < up_bound))
+               rt61pci_set_vgc(rt2x00dev, qual, ++qual->vgc_level);
+       else if ((qual->false_cca < 100) && (qual->vgc_level > low_bound))
+               rt61pci_set_vgc(rt2x00dev, qual, --qual->vgc_level);
 }
 
 /*
@@ -1141,25 +1176,37 @@ static char *rt61pci_get_firmware_name(struct rt2x00_dev *rt2x00dev)
        return fw_name;
 }
 
-static u16 rt61pci_get_firmware_crc(const void *data, const size_t len)
+static int rt61pci_check_firmware(struct rt2x00_dev *rt2x00dev,
+                                 const u8 *data, const size_t len)
 {
+       u16 fw_crc;
        u16 crc;
 
        /*
-        * Use the crc itu-t algorithm.
+        * Only support 8kb firmware files.
+        */
+       if (len != 8192)
+               return FW_BAD_LENGTH;
+
+       /*
         * The last 2 bytes in the firmware array are the crc checksum itself,
         * this means that we should never pass those 2 bytes to the crc
         * algorithm.
         */
+       fw_crc = (data[len - 2] << 8 | data[len - 1]);
+
+       /*
+        * Use the crc itu-t algorithm.
+        */
        crc = crc_itu_t(0, data, len - 2);
        crc = crc_itu_t_byte(crc, 0);
        crc = crc_itu_t_byte(crc, 0);
 
-       return crc;
+       return (fw_crc == crc) ? FW_OK : FW_BAD_CRC;
 }
 
-static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
-                                const size_t len)
+static int rt61pci_load_firmware(struct rt2x00_dev *rt2x00dev,
+                                const u8 *data, const size_t len)
 {
        int i;
        u32 reg;
@@ -1656,24 +1703,10 @@ static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev)
 
 static void rt61pci_disable_radio(struct rt2x00_dev *rt2x00dev)
 {
-       u32 reg;
-
-       rt2x00pci_register_write(rt2x00dev, MAC_CSR10, 0x00001818);
-
-       /*
-        * Disable synchronisation.
-        */
-       rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, 0);
-
        /*
-        * Cancel RX and TX.
+        * Disable power
         */
-       rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg);
-       rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC0, 1);
-       rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC1, 1);
-       rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC2, 1);
-       rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC3, 1);
-       rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg);
+       rt2x00pci_register_write(rt2x00dev, MAC_CSR10, 0x00001818);
 }
 
 static int rt61pci_set_state(struct rt2x00_dev *rt2x00dev, enum dev_state state)
@@ -1812,7 +1845,7 @@ static void rt61pci_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags));
        rt2x00_set_field32(&word, TXD_W0_OFDM,
-                          test_bit(ENTRY_TXD_OFDM_RATE, &txdesc->flags));
+                          (txdesc->rate_mode == RATE_MODE_OFDM));
        rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs);
        rt2x00_set_field32(&word, TXD_W0_RETRY_MODE,
                           test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags));
@@ -1896,6 +1929,24 @@ static void rt61pci_kick_tx_queue(struct rt2x00_dev *rt2x00dev,
        rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg);
 }
 
+static void rt61pci_kill_tx_queue(struct rt2x00_dev *rt2x00dev,
+                                 const enum data_queue_qid qid)
+{
+       u32 reg;
+
+       if (qid == QID_BEACON) {
+               rt2x00pci_register_write(rt2x00dev, TXRX_CSR9, 0);
+               return;
+       }
+
+       rt2x00pci_register_read(rt2x00dev, TX_CNTL_CSR, &reg);
+       rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC0, (qid == QID_AC_BE));
+       rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC1, (qid == QID_AC_BK));
+       rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC2, (qid == QID_AC_VI));
+       rt2x00_set_field32(&reg, TX_CNTL_CSR_ABORT_TX_AC3, (qid == QID_AC_VO));
+       rt2x00pci_register_write(rt2x00dev, TX_CNTL_CSR, reg);
+}
+
 /*
  * RX control handlers
  */
@@ -2195,7 +2246,8 @@ static int rt61pci_validate_eeprom(struct rt2x00_dev *rt2x00dev)
        if (word == 0xffff) {
                rt2x00_set_field16(&word, EEPROM_NIC_ENABLE_DIVERSITY, 0);
                rt2x00_set_field16(&word, EEPROM_NIC_TX_DIVERSITY, 0);
-               rt2x00_set_field16(&word, EEPROM_NIC_TX_RX_FIXED, 0);
+               rt2x00_set_field16(&word, EEPROM_NIC_RX_FIXED, 0);
+               rt2x00_set_field16(&word, EEPROM_NIC_TX_FIXED, 0);
                rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_BG, 0);
                rt2x00_set_field16(&word, EEPROM_NIC_CARDBUS_ACCEL, 0);
                rt2x00_set_field16(&word, EEPROM_NIC_EXTERNAL_LNA_A, 0);
@@ -2339,24 +2391,10 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev)
         */
        if (rt2x00_rf(&rt2x00dev->chip, RF2529) &&
            !test_bit(CONFIG_DOUBLE_ANTENNA, &rt2x00dev->flags)) {
-               switch (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_RX_FIXED)) {
-               case 0:
-                       rt2x00dev->default_ant.tx = ANTENNA_B;
-                       rt2x00dev->default_ant.rx = ANTENNA_A;
-                       break;
-               case 1:
-                       rt2x00dev->default_ant.tx = ANTENNA_B;
-                       rt2x00dev->default_ant.rx = ANTENNA_B;
-                       break;
-               case 2:
-                       rt2x00dev->default_ant.tx = ANTENNA_A;
-                       rt2x00dev->default_ant.rx = ANTENNA_A;
-                       break;
-               case 3:
-                       rt2x00dev->default_ant.tx = ANTENNA_A;
-                       rt2x00dev->default_ant.rx = ANTENNA_B;
-                       break;
-               }
+               rt2x00dev->default_ant.rx =
+                   ANTENNA_A + rt2x00_get_field16(eeprom, EEPROM_NIC_RX_FIXED);
+               rt2x00dev->default_ant.tx =
+                   ANTENNA_B - rt2x00_get_field16(eeprom, EEPROM_NIC_TX_FIXED);
 
                if (rt2x00_get_field16(eeprom, EEPROM_NIC_TX_DIVERSITY))
                        rt2x00dev->default_ant.tx = ANTENNA_SW_DIVERSITY;
@@ -2534,7 +2572,9 @@ static int rt61pci_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
         */
        rt2x00dev->hw->flags =
            IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-           IEEE80211_HW_SIGNAL_DBM;
+           IEEE80211_HW_SIGNAL_DBM |
+           IEEE80211_HW_SUPPORTS_PS |
+           IEEE80211_HW_PS_NULLFUNC_STACK;
        rt2x00dev->hw->extra_tx_headroom = 0;
 
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
@@ -2633,6 +2673,7 @@ static int rt61pci_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
        struct rt2x00_field32 field;
        int retval;
        u32 reg;
+       u32 offset;
 
        /*
         * First pass the configuration through rt2x00lib, that will
@@ -2644,24 +2685,23 @@ static int rt61pci_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
        if (retval)
                return retval;
 
+       /*
+        * We only need to perform additional register initialization
+        * for WMM queues/
+        */
+       if (queue_idx >= 4)
+               return 0;
+
        queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
 
        /* Update WMM TXOP register */
-       if (queue_idx < 2) {
-               field.bit_offset = queue_idx * 16;
-               field.bit_mask = 0xffff << field.bit_offset;
-
-               rt2x00pci_register_read(rt2x00dev, AC_TXOP_CSR0, &reg);
-               rt2x00_set_field32(&reg, field, queue->txop);
-               rt2x00pci_register_write(rt2x00dev, AC_TXOP_CSR0, reg);
-       } else if (queue_idx < 4) {
-               field.bit_offset = (queue_idx - 2) * 16;
-               field.bit_mask = 0xffff << field.bit_offset;
-
-               rt2x00pci_register_read(rt2x00dev, AC_TXOP_CSR1, &reg);
-               rt2x00_set_field32(&reg, field, queue->txop);
-               rt2x00pci_register_write(rt2x00dev, AC_TXOP_CSR1, reg);
-       }
+       offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2)));
+       field.bit_offset = (queue_idx & 1) * 16;
+       field.bit_mask = 0xffff << field.bit_offset;
+
+       rt2x00pci_register_read(rt2x00dev, offset, &reg);
+       rt2x00_set_field32(&reg, field, queue->txop);
+       rt2x00pci_register_write(rt2x00dev, offset, reg);
 
        /* Update WMM registers */
        field.bit_offset = queue_idx * 4;
@@ -2717,7 +2757,7 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
        .irq_handler            = rt61pci_interrupt,
        .probe_hw               = rt61pci_probe_hw,
        .get_firmware_name      = rt61pci_get_firmware_name,
-       .get_firmware_crc       = rt61pci_get_firmware_crc,
+       .check_firmware         = rt61pci_check_firmware,
        .load_firmware          = rt61pci_load_firmware,
        .initialize             = rt2x00pci_initialize,
        .uninitialize           = rt2x00pci_uninitialize,
@@ -2732,6 +2772,7 @@ static const struct rt2x00lib_ops rt61pci_rt2x00_ops = {
        .write_tx_data          = rt2x00pci_write_tx_data,
        .write_beacon           = rt61pci_write_beacon,
        .kick_tx_queue          = rt61pci_kick_tx_queue,
+       .kill_tx_queue          = rt61pci_kill_tx_queue,
        .fill_rxdone            = rt61pci_fill_rxdone,
        .config_shared_key      = rt61pci_config_shared_key,
        .config_pairwise_key    = rt61pci_config_pairwise_key,
index 65fe3332364aa8cb414793ec0f0a057e40038252..2f97fee7a8de84b4cbae8231452ac7220a8a5f44 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
 
 /*
  * SOFT_RESET_CSR
+ * FORCE_CLOCK_ON: Host force MAC clock ON
  */
 #define SOFT_RESET_CSR                 0x0010
+#define SOFT_RESET_CSR_FORCE_CLOCK_ON  FIELD32(0x00000002)
 
 /*
  * MCU_INT_SOURCE_CSR: MCU interrupt source/mask register.
@@ -1054,8 +1056,10 @@ struct hw_pairwise_ta_entry {
 
 /*
  * IO_CNTL_CSR
+ * RF_PS: Set RF interface value to power save
  */
 #define IO_CNTL_CSR                    0x3498
+#define IO_CNTL_CSR_RF_PS              FIELD32(0x00000004)
 
 /*
  * UART_INT_SOURCE_CSR
@@ -1186,7 +1190,8 @@ struct hw_pairwise_ta_entry {
 #define EEPROM_NIC                     0x0011
 #define EEPROM_NIC_ENABLE_DIVERSITY    FIELD16(0x0001)
 #define EEPROM_NIC_TX_DIVERSITY                FIELD16(0x0002)
-#define EEPROM_NIC_TX_RX_FIXED         FIELD16(0x000c)
+#define EEPROM_NIC_RX_FIXED            FIELD16(0x0004)
+#define EEPROM_NIC_TX_FIXED            FIELD16(0x0008)
 #define EEPROM_NIC_EXTERNAL_LNA_BG     FIELD16(0x0010)
 #define EEPROM_NIC_CARDBUS_ACCEL       FIELD16(0x0020)
 #define EEPROM_NIC_EXTERNAL_LNA_A      FIELD16(0x0040)
index 96a8d69f8790480b8fee654beebf60b4e5efbda2..6521dac7ec4a45fa4b271ee389cf0ca81ca2bc0a 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -186,6 +186,18 @@ static const struct rt2x00debug rt73usb_rt2x00debug = {
 };
 #endif /* CONFIG_RT2X00_LIB_DEBUGFS */
 
+#ifdef CONFIG_RT2X00_LIB_RFKILL
+static int rt73usb_rfkill_poll(struct rt2x00_dev *rt2x00dev)
+{
+       u32 reg;
+
+       rt2x00usb_register_read(rt2x00dev, MAC_CSR13, &reg);
+       return rt2x00_get_field32(reg, MAC_CSR13_BIT7);
+}
+#else
+#define rt73usb_rfkill_poll    NULL
+#endif /* CONFIG_RT2X00_LIB_RFKILL */
+
 #ifdef CONFIG_RT2X00_LIB_LEDS
 static void rt73usb_brightness_set(struct led_classdev *led_cdev,
                                   enum led_brightness brightness)
@@ -844,6 +856,44 @@ static void rt73usb_config_duration(struct rt2x00_dev *rt2x00dev,
        rt2x00usb_register_write(rt2x00dev, TXRX_CSR9, reg);
 }
 
+static void rt73usb_config_ps(struct rt2x00_dev *rt2x00dev,
+                               struct rt2x00lib_conf *libconf)
+{
+       enum dev_state state =
+           (libconf->conf->flags & IEEE80211_CONF_PS) ?
+               STATE_SLEEP : STATE_AWAKE;
+       u32 reg;
+
+       if (state == STATE_SLEEP) {
+               rt2x00usb_register_read(rt2x00dev, MAC_CSR11, &reg);
+               rt2x00_set_field32(&reg, MAC_CSR11_DELAY_AFTER_TBCN,
+                                  libconf->conf->beacon_int - 10);
+               rt2x00_set_field32(&reg, MAC_CSR11_TBCN_BEFORE_WAKEUP,
+                                  libconf->conf->listen_interval - 1);
+               rt2x00_set_field32(&reg, MAC_CSR11_WAKEUP_LATENCY, 5);
+
+               /* We must first disable autowake before it can be enabled */
+               rt2x00_set_field32(&reg, MAC_CSR11_AUTOWAKE, 0);
+               rt2x00usb_register_write(rt2x00dev, MAC_CSR11, reg);
+
+               rt2x00_set_field32(&reg, MAC_CSR11_AUTOWAKE, 1);
+               rt2x00usb_register_write(rt2x00dev, MAC_CSR11, reg);
+
+               rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
+                                           USB_MODE_SLEEP, REGISTER_TIMEOUT);
+       } else {
+               rt2x00usb_vendor_request_sw(rt2x00dev, USB_DEVICE_MODE, 0,
+                                           USB_MODE_WAKEUP, REGISTER_TIMEOUT);
+
+               rt2x00usb_register_read(rt2x00dev, MAC_CSR11, &reg);
+               rt2x00_set_field32(&reg, MAC_CSR11_DELAY_AFTER_TBCN, 0);
+               rt2x00_set_field32(&reg, MAC_CSR11_TBCN_BEFORE_WAKEUP, 0);
+               rt2x00_set_field32(&reg, MAC_CSR11_AUTOWAKE, 0);
+               rt2x00_set_field32(&reg, MAC_CSR11_WAKEUP_LATENCY, 0);
+               rt2x00usb_register_write(rt2x00dev, MAC_CSR11, reg);
+       }
+}
+
 static void rt73usb_config(struct rt2x00_dev *rt2x00dev,
                           struct rt2x00lib_conf *libconf,
                           const unsigned int flags)
@@ -861,6 +911,8 @@ static void rt73usb_config(struct rt2x00_dev *rt2x00dev,
                rt73usb_config_retry_limit(rt2x00dev, libconf);
        if (flags & IEEE80211_CONF_CHANGE_BEACON_INTERVAL)
                rt73usb_config_duration(rt2x00dev, libconf);
+       if (flags & IEEE80211_CONF_CHANGE_PS)
+               rt73usb_config_ps(rt2x00dev, libconf);
 }
 
 /*
@@ -884,21 +936,28 @@ static void rt73usb_link_stats(struct rt2x00_dev *rt2x00dev,
        qual->false_cca = rt2x00_get_field32(reg, STA_CSR1_FALSE_CCA_ERROR);
 }
 
-static void rt73usb_reset_tuner(struct rt2x00_dev *rt2x00dev)
+static inline void rt73usb_set_vgc(struct rt2x00_dev *rt2x00dev,
+                                  struct link_qual *qual, u8 vgc_level)
+{
+       if (qual->vgc_level != vgc_level) {
+               rt73usb_bbp_write(rt2x00dev, 17, vgc_level);
+               qual->vgc_level = vgc_level;
+               qual->vgc_level_reg = vgc_level;
+       }
+}
+
+static void rt73usb_reset_tuner(struct rt2x00_dev *rt2x00dev,
+                               struct link_qual *qual)
 {
-       rt73usb_bbp_write(rt2x00dev, 17, 0x20);
-       rt2x00dev->link.vgc_level = 0x20;
+       rt73usb_set_vgc(rt2x00dev, qual, 0x20);
 }
 
-static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev)
+static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev,
+                              struct link_qual *qual, const u32 count)
 {
-       int rssi = rt2x00_get_link_rssi(&rt2x00dev->link);
-       u8 r17;
        u8 up_bound;
        u8 low_bound;
 
-       rt73usb_bbp_read(rt2x00dev, 17, &r17);
-
        /*
         * Determine r17 bounds.
         */
@@ -911,10 +970,10 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev)
                        up_bound += 0x10;
                }
        } else {
-               if (rssi > -82) {
+               if (qual->rssi > -82) {
                        low_bound = 0x1c;
                        up_bound = 0x40;
-               } else if (rssi > -84) {
+               } else if (qual->rssi > -84) {
                        low_bound = 0x1c;
                        up_bound = 0x20;
                } else {
@@ -938,37 +997,32 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev)
        /*
         * Special big-R17 for very short distance
         */
-       if (rssi > -35) {
-               if (r17 != 0x60)
-                       rt73usb_bbp_write(rt2x00dev, 17, 0x60);
+       if (qual->rssi > -35) {
+               rt73usb_set_vgc(rt2x00dev, qual, 0x60);
                return;
        }
 
        /*
         * Special big-R17 for short distance
         */
-       if (rssi >= -58) {
-               if (r17 != up_bound)
-                       rt73usb_bbp_write(rt2x00dev, 17, up_bound);
+       if (qual->rssi >= -58) {
+               rt73usb_set_vgc(rt2x00dev, qual, up_bound);
                return;
        }
 
        /*
         * Special big-R17 for middle-short distance
         */
-       if (rssi >= -66) {
-               low_bound += 0x10;
-               if (r17 != low_bound)
-                       rt73usb_bbp_write(rt2x00dev, 17, low_bound);
+       if (qual->rssi >= -66) {
+               rt73usb_set_vgc(rt2x00dev, qual, low_bound + 0x10);
                return;
        }
 
        /*
         * Special mid-R17 for middle distance
         */
-       if (rssi >= -74) {
-               if (r17 != (low_bound + 0x10))
-                       rt73usb_bbp_write(rt2x00dev, 17, low_bound + 0x08);
+       if (qual->rssi >= -74) {
+               rt73usb_set_vgc(rt2x00dev, qual, low_bound + 0x08);
                return;
        }
 
@@ -976,12 +1030,12 @@ static void rt73usb_link_tuner(struct rt2x00_dev *rt2x00dev)
         * Special case: Change up_bound based on the rssi.
         * Lower up_bound when rssi is weaker then -74 dBm.
         */
-       up_bound -= 2 * (-74 - rssi);
+       up_bound -= 2 * (-74 - qual->rssi);
        if (low_bound > up_bound)
                up_bound = low_bound;
 
-       if (r17 > up_bound) {
-               rt73usb_bbp_write(rt2x00dev, 17, up_bound);
+       if (qual->vgc_level > up_bound) {
+               rt73usb_set_vgc(rt2x00dev, qual, up_bound);
                return;
        }
 
@@ -991,17 +1045,12 @@ dynamic_cca_tune:
         * r17 does not yet exceed upper limit, continue and base
         * the r17 tuning on the false CCA count.
         */
-       if (rt2x00dev->link.qual.false_cca > 512 && r17 < up_bound) {
-               r17 += 4;
-               if (r17 > up_bound)
-                       r17 = up_bound;
-               rt73usb_bbp_write(rt2x00dev, 17, r17);
-       } else if (rt2x00dev->link.qual.false_cca < 100 && r17 > low_bound) {
-               r17 -= 4;
-               if (r17 < low_bound)
-                       r17 = low_bound;
-               rt73usb_bbp_write(rt2x00dev, 17, r17);
-       }
+       if ((qual->false_cca > 512) && (qual->vgc_level < up_bound))
+               rt73usb_set_vgc(rt2x00dev, qual,
+                               min_t(u8, qual->vgc_level + 4, up_bound));
+       else if ((qual->false_cca < 100) && (qual->vgc_level > low_bound))
+               rt73usb_set_vgc(rt2x00dev, qual,
+                               max_t(u8, qual->vgc_level - 4, low_bound));
 }
 
 /*
@@ -1012,25 +1061,37 @@ static char *rt73usb_get_firmware_name(struct rt2x00_dev *rt2x00dev)
        return FIRMWARE_RT2571;
 }
 
-static u16 rt73usb_get_firmware_crc(const void *data, const size_t len)
+static int rt73usb_check_firmware(struct rt2x00_dev *rt2x00dev,
+                                 const u8 *data, const size_t len)
 {
+       u16 fw_crc;
        u16 crc;
 
        /*
-        * Use the crc itu-t algorithm.
+        * Only support 2kb firmware files.
+        */
+       if (len != 2048)
+               return FW_BAD_LENGTH;
+
+       /*
         * The last 2 bytes in the firmware array are the crc checksum itself,
         * this means that we should never pass those 2 bytes to the crc
         * algorithm.
         */
+       fw_crc = (data[len - 2] << 8 | data[len - 1]);
+
+       /*
+        * Use the crc itu-t algorithm.
+        */
        crc = crc_itu_t(0, data, len - 2);
        crc = crc_itu_t_byte(crc, 0);
        crc = crc_itu_t_byte(crc, 0);
 
-       return crc;
+       return (fw_crc == crc) ? FW_OK : FW_BAD_CRC;
 }
 
-static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev, const void *data,
-                                const size_t len)
+static int rt73usb_load_firmware(struct rt2x00_dev *rt2x00dev,
+                                const u8 *data, const size_t len)
 {
        unsigned int i;
        int status;
@@ -1449,7 +1510,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev,
        rt2x00_set_field32(&word, TXD_W0_TIMESTAMP,
                           test_bit(ENTRY_TXD_REQ_TIMESTAMP, &txdesc->flags));
        rt2x00_set_field32(&word, TXD_W0_OFDM,
-                          test_bit(ENTRY_TXD_OFDM_RATE, &txdesc->flags));
+                          (txdesc->rate_mode == RATE_MODE_OFDM));
        rt2x00_set_field32(&word, TXD_W0_IFS, txdesc->ifs);
        rt2x00_set_field32(&word, TXD_W0_RETRY_MODE,
                           test_bit(ENTRY_TXD_RETRY_MODE, &txdesc->flags));
@@ -1815,6 +1876,14 @@ static int rt73usb_init_eeprom(struct rt2x00_dev *rt2x00dev)
        if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_FRAME_TYPE))
                __set_bit(CONFIG_FRAME_TYPE, &rt2x00dev->flags);
 
+       /*
+        * Detect if this device has an hardware controlled radio.
+        */
+#ifdef CONFIG_RT2X00_LIB_RFKILL
+       if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO))
+               __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags);
+#endif /* CONFIG_RT2X00_LIB_RFKILL */
+
        /*
         * Read frequency offset.
         */
@@ -2020,7 +2089,9 @@ static int rt73usb_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
         */
        rt2x00dev->hw->flags =
            IEEE80211_HW_HOST_BROADCAST_PS_BUFFERING |
-           IEEE80211_HW_SIGNAL_DBM;
+           IEEE80211_HW_SIGNAL_DBM |
+           IEEE80211_HW_SUPPORTS_PS |
+           IEEE80211_HW_PS_NULLFUNC_STACK;
        rt2x00dev->hw->extra_tx_headroom = TXD_DESC_SIZE;
 
        SET_IEEE80211_DEV(rt2x00dev->hw, rt2x00dev->dev);
@@ -2121,6 +2192,7 @@ static int rt73usb_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
        struct rt2x00_field32 field;
        int retval;
        u32 reg;
+       u32 offset;
 
        /*
         * First pass the configuration through rt2x00lib, that will
@@ -2132,24 +2204,23 @@ static int rt73usb_conf_tx(struct ieee80211_hw *hw, u16 queue_idx,
        if (retval)
                return retval;
 
+       /*
+        * We only need to perform additional register initialization
+        * for WMM queues/
+        */
+       if (queue_idx >= 4)
+               return 0;
+
        queue = rt2x00queue_get_queue(rt2x00dev, queue_idx);
 
        /* Update WMM TXOP register */
-       if (queue_idx < 2) {
-               field.bit_offset = queue_idx * 16;
-               field.bit_mask = 0xffff << field.bit_offset;
-
-               rt2x00usb_register_read(rt2x00dev, AC_TXOP_CSR0, &reg);
-               rt2x00_set_field32(&reg, field, queue->txop);
-               rt2x00usb_register_write(rt2x00dev, AC_TXOP_CSR0, reg);
-       } else if (queue_idx < 4) {
-               field.bit_offset = (queue_idx - 2) * 16;
-               field.bit_mask = 0xffff << field.bit_offset;
-
-               rt2x00usb_register_read(rt2x00dev, AC_TXOP_CSR1, &reg);
-               rt2x00_set_field32(&reg, field, queue->txop);
-               rt2x00usb_register_write(rt2x00dev, AC_TXOP_CSR1, reg);
-       }
+       offset = AC_TXOP_CSR0 + (sizeof(u32) * (!!(queue_idx & 2)));
+       field.bit_offset = (queue_idx & 1) * 16;
+       field.bit_mask = 0xffff << field.bit_offset;
+
+       rt2x00usb_register_read(rt2x00dev, offset, &reg);
+       rt2x00_set_field32(&reg, field, queue->txop);
+       rt2x00usb_register_write(rt2x00dev, offset, reg);
 
        /* Update WMM registers */
        field.bit_offset = queue_idx * 4;
@@ -2214,12 +2285,13 @@ static const struct ieee80211_ops rt73usb_mac80211_ops = {
 static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
        .probe_hw               = rt73usb_probe_hw,
        .get_firmware_name      = rt73usb_get_firmware_name,
-       .get_firmware_crc       = rt73usb_get_firmware_crc,
+       .check_firmware         = rt73usb_check_firmware,
        .load_firmware          = rt73usb_load_firmware,
        .initialize             = rt2x00usb_initialize,
        .uninitialize           = rt2x00usb_uninitialize,
        .clear_entry            = rt2x00usb_clear_entry,
        .set_device_state       = rt73usb_set_device_state,
+       .rfkill_poll            = rt73usb_rfkill_poll,
        .link_stats             = rt73usb_link_stats,
        .reset_tuner            = rt73usb_reset_tuner,
        .link_tuner             = rt73usb_link_tuner,
@@ -2228,6 +2300,7 @@ static const struct rt2x00lib_ops rt73usb_rt2x00_ops = {
        .write_beacon           = rt73usb_write_beacon,
        .get_tx_data_len        = rt73usb_get_tx_data_len,
        .kick_tx_queue          = rt73usb_kick_tx_queue,
+       .kill_tx_queue          = rt2x00usb_kill_tx_queue,
        .fill_rxdone            = rt73usb_fill_rxdone,
        .config_shared_key      = rt73usb_config_shared_key,
        .config_pairwise_key    = rt73usb_config_pairwise_key,
@@ -2295,6 +2368,7 @@ static struct usb_device_id rt73usb_device_table[] = {
        /* Billionton */
        { USB_DEVICE(0x1631, 0xc019), USB_DEVICE_DATA(&rt73usb_ops) },
        /* Buffalo */
+       { USB_DEVICE(0x0411, 0x00d8), USB_DEVICE_DATA(&rt73usb_ops) },
        { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
        /* CNet */
        { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) },
index 46e1405eb0e21ae7d643e5b6d17a011101199d30..834b28ce6cde569b8c93f7140b2a27e9ef7127d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
-       Copyright (C) 2004 - 2008 rt2x00 SourceForge Project
+       Copyright (C) 2004 - 2009 rt2x00 SourceForge Project
        <http://rt2x00.serialmonkey.com>
 
        This program is free software; you can redistribute it and/or modify
@@ -267,6 +267,19 @@ struct hw_pairwise_ta_entry {
  * MAC_CSR13: GPIO.
  */
 #define MAC_CSR13                      0x3034
+#define MAC_CSR13_BIT0                 FIELD32(0x00000001)
+#define MAC_CSR13_BIT1                 FIELD32(0x00000002)
+#define MAC_CSR13_BIT2                 FIELD32(0x00000004)
+#define MAC_CSR13_BIT3                 FIELD32(0x00000008)
+#define MAC_CSR13_BIT4                 FIELD32(0x00000010)
+#define MAC_CSR13_BIT5                 FIELD32(0x00000020)
+#define MAC_CSR13_BIT6                 FIELD32(0x00000040)
+#define MAC_CSR13_BIT7                 FIELD32(0x00000080)
+#define MAC_CSR13_BIT8                 FIELD32(0x00000100)
+#define MAC_CSR13_BIT9                 FIELD32(0x00000200)
+#define MAC_CSR13_BIT10                        FIELD32(0x00000400)
+#define MAC_CSR13_BIT11                        FIELD32(0x00000800)
+#define MAC_CSR13_BIT12                        FIELD32(0x00001000)
 
 /*
  * MAC_CSR14: LED control register.
index 3b1e1c2aad26cb35e18167eb7da16e5e354b98b4..9718f61809cfd9b343be23063fb2a6345426b8b3 100644 (file)
@@ -100,6 +100,8 @@ struct rtl8187_priv {
        struct usb_device *udev;
        u32 rx_conf;
        struct usb_anchor anchored;
+       struct delayed_work work;
+       struct ieee80211_hw *dev;
        u16 txpwr_base;
        u8 asic_rev;
        u8 is_rtl8187b;
@@ -117,7 +119,7 @@ struct rtl8187_priv {
        struct {
                __le64 buf;
                struct sk_buff_head queue;
-       } b_tx_status;
+       } b_tx_status; /* This queue is used by both -b and non-b devices */
 };
 
 void rtl8187_write_phy(struct ieee80211_hw *dev, u8 addr, u32 data);
index 22bc07ef2f3784f70d3588d0a481993dde08a9b8..82bd47e7c617795045a6d3f0b9d9c4590b2d7a53 100644 (file)
@@ -177,25 +177,33 @@ static void rtl8187_tx_cb(struct urb *urb)
                                          sizeof(struct rtl8187_tx_hdr));
        ieee80211_tx_info_clear_status(info);
 
-       if (!urb->status &&
-           !(info->flags & IEEE80211_TX_CTL_NO_ACK) &&
-           priv->is_rtl8187b) {
-               skb_queue_tail(&priv->b_tx_status.queue, skb);
+       if (!(urb->status) && !(info->flags & IEEE80211_TX_CTL_NO_ACK)) {
+               if (priv->is_rtl8187b) {
+                       skb_queue_tail(&priv->b_tx_status.queue, skb);
 
-               /* queue is "full", discard last items */
-               while (skb_queue_len(&priv->b_tx_status.queue) > 5) {
-                       struct sk_buff *old_skb;
+                       /* queue is "full", discard last items */
+                       while (skb_queue_len(&priv->b_tx_status.queue) > 5) {
+                               struct sk_buff *old_skb;
 
-                       dev_dbg(&priv->udev->dev,
-                               "transmit status queue full\n");
+                               dev_dbg(&priv->udev->dev,
+                                       "transmit status queue full\n");
 
-                       old_skb = skb_dequeue(&priv->b_tx_status.queue);
-                       ieee80211_tx_status_irqsafe(hw, old_skb);
-               }
-       } else {
-               if (!(info->flags & IEEE80211_TX_CTL_NO_ACK) && !urb->status)
+                               old_skb = skb_dequeue(&priv->b_tx_status.queue);
+                               ieee80211_tx_status_irqsafe(hw, old_skb);
+                       }
+                       return;
+               } else {
                        info->flags |= IEEE80211_TX_STAT_ACK;
+               }
+       }
+       if (priv->is_rtl8187b)
                ieee80211_tx_status_irqsafe(hw, skb);
+       else {
+               /* Retry information for the RTI8187 is only available by
+                * reading a register in the device. We are in interrupt mode
+                * here, thus queue the skb and finish on a work queue. */
+               skb_queue_tail(&priv->b_tx_status.queue, skb);
+               queue_delayed_work(hw->workqueue, &priv->work, 0);
        }
 }
 
@@ -391,7 +399,7 @@ static int rtl8187_init_urbs(struct ieee80211_hw *dev)
        struct rtl8187_rx_info *info;
        int ret = 0;
 
-       while (skb_queue_len(&priv->rx_queue) < 8) {
+       while (skb_queue_len(&priv->rx_queue) < 16) {
                skb = __dev_alloc_skb(RTL8187_MAX_RX, GFP_KERNEL);
                if (!skb) {
                        ret = -ENOMEM;
@@ -645,7 +653,7 @@ static int rtl8187_init_hw(struct ieee80211_hw *dev)
 
        rtl818x_iowrite32(priv, &priv->map->INT_TIMEOUT, 0);
        rtl818x_iowrite8(priv, &priv->map->WPA_CONF, 0);
-       rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0x81);
+       rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, 0);
 
        // TODO: set RESP_RATE and BRSR properly
        rtl818x_iowrite8(priv, &priv->map->RESP_RATE, (8 << 4) | 0);
@@ -765,9 +773,6 @@ static int rtl8187b_init_hw(struct ieee80211_hw *dev)
        rtl818x_iowrite8(priv, &priv->map->TX_AGC_CTL, reg);
 
        rtl818x_iowrite16_idx(priv, (__le16 *)0xFFE0, 0x0FFF, 1);
-       reg = rtl818x_ioread8(priv, &priv->map->RATE_FALLBACK);
-       reg |= RTL818X_RATE_FALLBACK_ENABLE;
-       rtl818x_iowrite8(priv, &priv->map->RATE_FALLBACK, reg);
 
        rtl818x_iowrite16(priv, &priv->map->BEACON_INTERVAL, 100);
        rtl818x_iowrite16(priv, &priv->map->ATIM_WND, 2);
@@ -855,6 +860,34 @@ static int rtl8187b_init_hw(struct ieee80211_hw *dev)
        return 0;
 }
 
+static void rtl8187_work(struct work_struct *work)
+{
+       /* The RTL8187 returns the retry count through register 0xFFFA. In
+        * addition, it appears to be a cumulative retry count, not the
+        * value for the current TX packet. When multiple TX entries are
+        * queued, the retry count will be valid for the last one in the queue.
+        * The "error" should not matter for purposes of rate setting. */
+       struct rtl8187_priv *priv = container_of(work, struct rtl8187_priv,
+                                   work.work);
+       struct ieee80211_tx_info *info;
+       struct ieee80211_hw *dev = priv->dev;
+       static u16 retry;
+       u16 tmp;
+
+       mutex_lock(&priv->conf_mutex);
+       tmp = rtl818x_ioread16(priv, (__le16 *)0xFFFA);
+       while (skb_queue_len(&priv->b_tx_status.queue) > 0) {
+               struct sk_buff *old_skb;
+
+               old_skb = skb_dequeue(&priv->b_tx_status.queue);
+               info = IEEE80211_SKB_CB(old_skb);
+               info->status.rates[0].count = tmp - retry + 1;
+               ieee80211_tx_status_irqsafe(dev, old_skb);
+       }
+       retry = tmp;
+       mutex_unlock(&priv->conf_mutex);
+}
+
 static int rtl8187_start(struct ieee80211_hw *dev)
 {
        struct rtl8187_priv *priv = dev->priv;
@@ -869,6 +902,7 @@ static int rtl8187_start(struct ieee80211_hw *dev)
        mutex_lock(&priv->conf_mutex);
 
        init_usb_anchor(&priv->anchored);
+       priv->dev = dev;
 
        if (priv->is_rtl8187b) {
                reg = RTL818X_RX_CONF_MGMT |
@@ -936,6 +970,7 @@ static int rtl8187_start(struct ieee80211_hw *dev)
        reg |= RTL818X_CMD_TX_ENABLE;
        reg |= RTL818X_CMD_RX_ENABLE;
        rtl818x_iowrite8(priv, &priv->map->CMD, reg);
+       INIT_DELAYED_WORK(&priv->work, rtl8187_work);
        mutex_unlock(&priv->conf_mutex);
 
        return 0;
@@ -966,6 +1001,8 @@ static void rtl8187_stop(struct ieee80211_hw *dev)
                dev_kfree_skb_any(skb);
 
        usb_kill_anchored_urbs(&priv->anchored);
+       if (!priv->is_rtl8187b)
+               cancel_delayed_work_sync(&priv->work);
        mutex_unlock(&priv->conf_mutex);
 }
 
@@ -974,19 +1011,21 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
 {
        struct rtl8187_priv *priv = dev->priv;
        int i;
+       int ret = -EOPNOTSUPP;
 
+       mutex_lock(&priv->conf_mutex);
        if (priv->mode != NL80211_IFTYPE_MONITOR)
-               return -EOPNOTSUPP;
+               goto exit;
 
        switch (conf->type) {
        case NL80211_IFTYPE_STATION:
                priv->mode = conf->type;
                break;
        default:
-               return -EOPNOTSUPP;
+               goto exit;
        }
 
-       mutex_lock(&priv->conf_mutex);
+       ret = 0;
        priv->vif = conf->vif;
 
        rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_CONFIG);
@@ -995,8 +1034,9 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
                                 ((u8 *)conf->mac_addr)[i]);
        rtl818x_iowrite8(priv, &priv->map->EEPROM_CMD, RTL818X_EEPROM_CMD_NORMAL);
 
+exit:
        mutex_unlock(&priv->conf_mutex);
-       return 0;
+       return ret;
 }
 
 static void rtl8187_remove_interface(struct ieee80211_hw *dev,
index 7015f2480550faf6145cb175780217538e6a5a88..39f525efdc8d90af46b572e60b749386d9f31919 100644 (file)
@@ -950,6 +950,7 @@ static struct strip *strip_get_idx(loff_t pos)
 }
 
 static void *strip_seq_start(struct seq_file *seq, loff_t *pos)
+       __acquires(RCU)
 {
        rcu_read_lock();
        return *pos ? strip_get_idx(*pos - 1) : SEQ_START_TOKEN;
@@ -973,6 +974,7 @@ static void *strip_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 }
 
 static void strip_seq_stop(struct seq_file *seq, void *v)
+       __releases(RCU)
 {
        rcu_read_unlock();
 }
@@ -1125,7 +1127,7 @@ static int strip_seq_show(struct seq_file *seq, void *v)
 }
 
 
-static struct seq_operations strip_seq_ops = {
+static const struct seq_operations strip_seq_ops = {
        .start = strip_seq_start,
        .next  = strip_seq_next,
        .stop  = strip_seq_stop,
index 832679396b6cbc14a23124d35abd2ae389de83b6..688bdea8f13a8cc1b74c025e7bdd4acb40528699 100644 (file)
@@ -40,11 +40,11 @@ static u8 wv_irq_to_psa(int irq)
  */
 static int __init wv_psa_to_irq(u8 irqval)
 {
-       int irq;
+       int i;
 
-       for (irq = 0; irq < ARRAY_SIZE(irqvals); irq++)
-               if (irqvals[irq] == irqval)
-                       return irq;
+       for (i = 0; i < ARRAY_SIZE(irqvals); i++)
+               if (irqvals[i] == irqval)
+                       return i;
 
        return -1;
 }
index c99a1b6b948fca668dfbf31b82ace895bb005de7..c8d5c34e8ddffb6943120423040e2d669a85cce7 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/wireless.h>
+#include <linux/ieee80211.h>
 
 #include <net/iw_handler.h>
 
@@ -111,12 +112,6 @@ static void wl3501_release(struct pcmcia_device *link);
  */
 static dev_info_t wl3501_dev_info = "wl3501_cs";
 
-static int wl3501_chan2freq[] = {
-       [0]  = 2412, [1]  = 2417, [2]  = 2422, [3]  = 2427, [4] = 2432,
-       [5]  = 2437, [6]  = 2442, [7]  = 2447, [8]  = 2452, [9] = 2457,
-       [10] = 2462, [11] = 2467, [12] = 2472, [13] = 2477,
-};
-
 static const struct {
        int reg_domain;
        int min, max, deflt;
@@ -1510,7 +1505,7 @@ static int wl3501_get_freq(struct net_device *dev, struct iw_request_info *info,
 {
        struct wl3501_card *this = netdev_priv(dev);
 
-       wrqu->freq.m = wl3501_chan2freq[this->chan - 1] * 100000;
+       wrqu->freq.m = ieee80211_dsss_chan_to_freq(this->chan) * 100000;
        wrqu->freq.e = 1;
        return 0;
 }
index b45c27d42fd83f98ac6a5f3479b0251f40443e7b..6226ac2357f82a308c6efa7d42daab08d4122a91 100644 (file)
@@ -919,10 +919,9 @@ static int zd1201_set_freq(struct net_device *dev,
        if (freq->e == 0)
                channel = freq->m;
        else {
-               if (freq->m >= 2482)
-                       channel = 14;
-               if (freq->m >= 2407)
-                       channel = (freq->m-2407)/5;
+               channel = ieee80211_freq_to_dsss_chan(freq->m);
+               if (channel < 0)
+                       channel = 0;
        }
 
        err = zd1201_setconfig16(zd, ZD1201_RID_CNFOWNCHANNEL, channel);
index 5200db405610709508c91f5c1d04ab4c2f4de022..6ac597ffd3b9031e73b8229ef91b5e1f4520cc44 100644 (file)
@@ -33,8 +33,13 @@ typedef u16 __nocast zd_addr_t;
 #ifdef DEBUG
 #  define dev_dbg_f(dev, fmt, args...) \
          dev_printk_f(KERN_DEBUG, dev, fmt, ## args)
+#  define dev_dbg_f_limit(dev, fmt, args...) do { \
+       if (net_ratelimit()) \
+               dev_printk_f(KERN_DEBUG, dev, fmt, ## args); \
+} while (0)
 #else
 #  define dev_dbg_f(dev, fmt, args...) do { (void)(dev); } while (0)
+#  define dev_dbg_f_limit(dev, fmt, args...) do { (void)(dev); } while (0)
 #endif /* DEBUG */
 
 #ifdef DEBUG
index a611ad8579832ad3451faec3dac6b96a4355fa6c..7579af27edbd6e6d639ac2644267fb9333299b4f 100644 (file)
@@ -768,13 +768,23 @@ static int zd_op_config_interface(struct ieee80211_hw *hw,
                        if (!beacon)
                                return -ENOMEM;
                        r = zd_mac_config_beacon(hw, beacon);
+                       kfree_skb(beacon);
+
                        if (r < 0)
                                return r;
-                       r = zd_set_beacon_interval(&mac->chip, BCN_MODE_IBSS |
-                                       hw->conf.beacon_int);
+               }
+
+               if (conf->changed & IEEE80211_IFCC_BEACON_ENABLED) {
+                       u32 interval;
+
+                       if (conf->enable_beacon)
+                               interval = BCN_MODE_IBSS | hw->conf.beacon_int;
+                       else
+                               interval = 0;
+
+                       r = zd_set_beacon_interval(&mac->chip, interval);
                        if (r < 0)
                                return r;
-                       kfree_skb(beacon);
                }
        } else
                associated = is_valid_ether_addr(conf->bssid);
@@ -793,10 +803,9 @@ static void zd_process_intr(struct work_struct *work)
        struct zd_mac *mac = container_of(work, struct zd_mac, process_intr);
 
        int_status = le16_to_cpu(*(__le16 *)(mac->intr_buffer+4));
-       if (int_status & INT_CFG_NEXT_BCN) {
-               if (net_ratelimit())
-                       dev_dbg_f(zd_mac_dev(mac), "INT_CFG_NEXT_BCN\n");
-       } else
+       if (int_status & INT_CFG_NEXT_BCN)
+               dev_dbg_f_limit(zd_mac_dev(mac), "INT_CFG_NEXT_BCN\n");
+       else
                dev_dbg_f(zd_mac_dev(mac), "Unsupported interrupt\n");
 
        zd_chip_enable_hwint(&mac->chip);
@@ -967,7 +976,7 @@ struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf)
        hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &mac->band;
 
        hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
-                   IEEE80211_HW_SIGNAL_DB;
+                   IEEE80211_HW_SIGNAL_UNSPEC;
 
        hw->wiphy->interface_modes =
                BIT(NL80211_IFTYPE_MESH_POINT) |
index cd6184ee08ee473b01631a5b50dbb30dae521e89..9f102a6535c4976b6a7451a75bcdb19386d5d718 100644 (file)
@@ -196,7 +196,7 @@ static void rx_refill_timeout(unsigned long data)
 {
        struct net_device *dev = (struct net_device *)data;
        struct netfront_info *np = netdev_priv(dev);
-       netif_rx_schedule(&np->napi);
+       napi_schedule(&np->napi);
 }
 
 static int netfront_tx_slot_available(struct netfront_info *np)
@@ -328,7 +328,7 @@ static int xennet_open(struct net_device *dev)
                xennet_alloc_rx_buffers(dev);
                np->rx.sring->rsp_event = np->rx.rsp_cons + 1;
                if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx))
-                       netif_rx_schedule(&np->napi);
+                       napi_schedule(&np->napi);
        }
        spin_unlock_bh(&np->rx_lock);
 
@@ -979,7 +979,7 @@ err:
 
                RING_FINAL_CHECK_FOR_RESPONSES(&np->rx, more_to_do);
                if (!more_to_do)
-                       __netif_rx_complete(napi);
+                       __napi_complete(napi);
 
                local_irq_restore(flags);
        }
@@ -1317,7 +1317,7 @@ static irqreturn_t xennet_interrupt(int irq, void *dev_id)
                xennet_tx_buf_gc(dev);
                /* Under tx_lock: protects access to rx shared-ring indexes. */
                if (RING_HAS_UNCONSUMED_RESPONSES(&np->rx))
-                       netif_rx_schedule(&np->napi);
+                       napi_schedule(&np->napi);
        }
 
        spin_unlock_irqrestore(&np->tx_lock, flags);
index 03a3f34e90393c43202db9731caac53cd25ed40a..a12a7211c982fc7284b8cb2a01b0c52c966a2718 100644 (file)
@@ -183,7 +183,7 @@ static int __init sonic_probe1(struct net_device *dev)
 
        if (lp->descriptors == NULL) {
                printk(KERN_ERR "%s: couldn't alloc DMA memory for "
-                               " descriptors.\n", lp->device->bus_id);
+                               " descriptors.\n", dev_name(lp->device));
                goto out;
        }
 
index f0b15c9347d0dae517497544ef629b9e0f8d80c1..0a6992d8611b6178cbc1a29b94914fd57148d3a4 100644 (file)
@@ -358,6 +358,17 @@ static void znet_set_multicast_list (struct net_device *dev)
         * multicast address configured isn't equal to IFF_ALLMULTI */
 }
 
+static const struct net_device_ops znet_netdev_ops = {
+       .ndo_open               = znet_open,
+       .ndo_stop               = znet_close,
+       .ndo_start_xmit         = znet_send_packet,
+       .ndo_set_multicast_list = znet_set_multicast_list,
+       .ndo_tx_timeout         = znet_tx_timeout,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 /* The Z-Note probe is pretty easy.  The NETIDBLK exists in the safe-to-probe
    BIOS area.  We just scan for the signature, and pull the vital parameters
    out of the structure. */
@@ -440,11 +451,7 @@ static int __init znet_probe (void)
        znet->tx_end = znet->tx_start + znet->tx_buf_len;
 
        /* The ZNET-specific entries in the device structure. */
-       dev->open = &znet_open;
-       dev->hard_start_xmit = &znet_send_packet;
-       dev->stop = &znet_close;
-       dev->set_multicast_list = &znet_set_multicast_list;
-       dev->tx_timeout = znet_tx_timeout;
+       dev->netdev_ops = &znet_netdev_ops;
        dev->watchdog_timeo = TX_TIMEOUT;
        err = register_netdev(dev);
        if (err)
index ad4cdd25613771f60857d4900a77d15f81c454a5..0b28fccec03f4a43ff09811a90db88b5b22bd8a4 100644 (file)
@@ -84,7 +84,7 @@ parport_atari_frob_control(struct parport *p, unsigned char mask,
 static unsigned char
 parport_atari_read_status(struct parport *p)
 {
-       return ((mfp.par_dt_reg & 1 ? 0 : PARPORT_STATUS_BUSY) |
+       return ((st_mfp.par_dt_reg & 1 ? 0 : PARPORT_STATUS_BUSY) |
                PARPORT_STATUS_SELECT | PARPORT_STATUS_ERROR);
 }
 
@@ -193,9 +193,9 @@ static int __init parport_atari_init(void)
                sound_ym.wd_data = sound_ym.rd_data_reg_sel | (1 << 5);
                local_irq_restore(flags);
                /* MFP port I0 as input. */
-               mfp.data_dir &= ~1;
+               st_mfp.data_dir &= ~1;
                /* MFP port I0 interrupt on high->low edge. */
-               mfp.active_edge &= ~1;
+               st_mfp.active_edge &= ~1;
                p = parport_register_port((unsigned long)&sound_ym.wd_data,
                                          IRQ_MFP_BUSY, PARPORT_DMA_NONE,
                                          &parport_atari_ops);
index 101ed49a2d15609937acbcf964274ed3f12d8360..032db815b0f9784f6835548d68333edc4c376022 100644 (file)
@@ -64,6 +64,11 @@ struct parport_pc_pci {
 
 static int __devinit netmos_parallel_init(struct pci_dev *dev, struct parport_pc_pci *card, int autoirq, int autodma)
 {
+       /* the rule described below doesn't hold for this device */
+       if (dev->device == PCI_DEVICE_ID_NETMOS_9835 &&
+                       dev->subsystem_vendor == PCI_VENDOR_ID_IBM &&
+                       dev->subsystem_device == 0x0299)
+               return -ENODEV;
        /*
         * Netmos uses the subdevice ID to indicate the number of parallel
         * and serial ports.  The form is 0x00PS, where <P> is the number of
index 3dfecb20d5e7949953e7fefa2796af4b48bef88f..f3f686581a9026685dc3e6c994b00e88ed88486c 100644 (file)
@@ -61,6 +61,8 @@
 /* global iommu list, set NULL for ignored DMAR units */
 static struct intel_iommu **g_iommus;
 
+static int rwbf_quirk;
+
 /*
  * 0: Present
  * 1-11: Reserved
@@ -268,7 +270,12 @@ static long list_size;
 
 static void domain_remove_dev_info(struct dmar_domain *domain);
 
-int dmar_disabled;
+#ifdef CONFIG_DMAR_DEFAULT_ON
+int dmar_disabled = 0;
+#else
+int dmar_disabled = 1;
+#endif /*CONFIG_DMAR_DEFAULT_ON*/
+
 static int __initdata dmar_map_gfx = 1;
 static int dmar_forcedac;
 static int intel_iommu_strict;
@@ -284,9 +291,12 @@ static int __init intel_iommu_setup(char *str)
        if (!str)
                return -EINVAL;
        while (*str) {
-               if (!strncmp(str, "off", 3)) {
+               if (!strncmp(str, "on", 2)) {
+                       dmar_disabled = 0;
+                       printk(KERN_INFO "Intel-IOMMU: enabled\n");
+               } else if (!strncmp(str, "off", 3)) {
                        dmar_disabled = 1;
-                       printk(KERN_INFO"Intel-IOMMU: disabled\n");
+                       printk(KERN_INFO "Intel-IOMMU: disabled\n");
                } else if (!strncmp(str, "igfx_off", 8)) {
                        dmar_map_gfx = 0;
                        printk(KERN_INFO
@@ -777,7 +787,7 @@ static void iommu_flush_write_buffer(struct intel_iommu *iommu)
        u32 val;
        unsigned long flag;
 
-       if (!cap_rwbf(iommu->cap))
+       if (!rwbf_quirk && !cap_rwbf(iommu->cap))
                return;
        val = iommu->gcmd | DMA_GCMD_WBF;
 
@@ -3129,3 +3139,15 @@ static struct iommu_ops intel_iommu_ops = {
        .unmap          = intel_iommu_unmap_range,
        .iova_to_phys   = intel_iommu_iova_to_phys,
 };
+
+static void __devinit quirk_iommu_rwbf(struct pci_dev *dev)
+{
+       /*
+        * Mobile 4 Series Chipset neglects to set RWBF capability,
+        * but needs it:
+        */
+       printk(KERN_INFO "DMAR: Forcing write-buffer flush capability\n");
+       rwbf_quirk = 1;
+}
+
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x2a40, quirk_iommu_rwbf);
index 44f15ff70c1d4f5f6c135d68367cbfb57b31783e..baba2eb5367df54bcc947333beda7e56332f3785 100644 (file)
@@ -103,14 +103,12 @@ static void msix_set_enable(struct pci_dev *dev, int enable)
        }
 }
 
-/*
- * Essentially, this is ((1 << (1 << x)) - 1), but without the
- * undefinedness of a << 32.
- */
 static inline __attribute_const__ u32 msi_mask(unsigned x)
 {
-       static const u32 mask[] = { 1, 2, 4, 0xf, 0xff, 0xffff, 0xffffffff };
-       return mask[x];
+       /* Don't shift by >= width of type */
+       if (x >= 5)
+               return 0xffffffff;
+       return (1 << (1 << x)) - 1;
 }
 
 static void msix_flush_writes(struct irq_desc *desc)
index ab1d615425a8858248b61efe4a5ed22fcfa764db..93eac14235854c648e6e895c51f063b8af68e152 100644 (file)
@@ -355,6 +355,8 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
        int i = 0;
 
        if (drv && drv->suspend) {
+               pci_power_t prev = pci_dev->current_state;
+
                pci_dev->state_saved = false;
 
                i = drv->suspend(pci_dev, state);
@@ -365,12 +367,16 @@ static int pci_legacy_suspend(struct device *dev, pm_message_t state)
                if (pci_dev->state_saved)
                        goto Fixup;
 
-               if (WARN_ON_ONCE(pci_dev->current_state != PCI_D0))
+               if (pci_dev->current_state != PCI_D0
+                   && pci_dev->current_state != PCI_UNKNOWN) {
+                       WARN_ONCE(pci_dev->current_state != prev,
+                               "PCI PM: Device state not saved by %pF\n",
+                               drv->suspend);
                        goto Fixup;
+               }
        }
 
        pci_save_state(pci_dev);
-       pci_dev->state_saved = true;
        /*
         * This is for compatibility with existing code with legacy PM support.
         */
@@ -424,35 +430,20 @@ static void pci_pm_default_resume_noirq(struct pci_dev *pci_dev)
        pci_fixup_device(pci_fixup_resume_early, pci_dev);
 }
 
-static int pci_pm_default_resume(struct pci_dev *pci_dev)
+static void pci_pm_default_resume(struct pci_dev *pci_dev)
 {
        pci_fixup_device(pci_fixup_resume, pci_dev);
 
        if (!pci_is_bridge(pci_dev))
                pci_enable_wake(pci_dev, PCI_D0, false);
-
-       return pci_pm_reenable_device(pci_dev);
-}
-
-static void pci_pm_default_suspend_generic(struct pci_dev *pci_dev)
-{
-       /* If device is enabled at this point, disable it */
-       pci_disable_enabled_device(pci_dev);
-       /*
-        * Save state with interrupts enabled, because in principle the bus the
-        * device is on may be put into a low power state after this code runs.
-        */
-       pci_save_state(pci_dev);
 }
 
 static void pci_pm_default_suspend(struct pci_dev *pci_dev)
 {
-       pci_pm_default_suspend_generic(pci_dev);
-
+       /* Disable non-bridge devices without PM support */
        if (!pci_is_bridge(pci_dev))
-               pci_prepare_to_sleep(pci_dev);
-
-       pci_fixup_device(pci_fixup_suspend, pci_dev);
+               pci_disable_enabled_device(pci_dev);
+       pci_save_state(pci_dev);
 }
 
 static bool pci_has_legacy_pm_support(struct pci_dev *pci_dev)
@@ -497,21 +488,49 @@ static void pci_pm_complete(struct device *dev)
 static int pci_pm_suspend(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
-       int error = 0;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_SUSPEND);
 
-       if (drv && drv->pm && drv->pm->suspend) {
-               error = drv->pm->suspend(dev);
-               suspend_report_result(drv->pm->suspend, error);
+       if (!pm) {
+               pci_pm_default_suspend(pci_dev);
+               goto Fixup;
        }
 
-       if (!error)
-               pci_pm_default_suspend(pci_dev);
+       pci_dev->state_saved = false;
 
-       return error;
+       if (pm->suspend) {
+               pci_power_t prev = pci_dev->current_state;
+               int error;
+
+               error = pm->suspend(dev);
+               suspend_report_result(pm->suspend, error);
+               if (error)
+                       return error;
+
+               if (pci_dev->state_saved)
+                       goto Fixup;
+
+               if (pci_dev->current_state != PCI_D0
+                   && pci_dev->current_state != PCI_UNKNOWN) {
+                       WARN_ONCE(pci_dev->current_state != prev,
+                               "PCI PM: State of device not saved by %pF\n",
+                               pm->suspend);
+                       goto Fixup;
+               }
+       }
+
+       if (!pci_dev->state_saved) {
+               pci_save_state(pci_dev);
+               if (!pci_is_bridge(pci_dev))
+                       pci_prepare_to_sleep(pci_dev);
+       }
+
+ Fixup:
+       pci_fixup_device(pci_fixup_suspend, pci_dev);
+
+       return 0;
 }
 
 static int pci_pm_suspend_noirq(struct device *dev)
@@ -554,7 +573,7 @@ static int pci_pm_resume_noirq(struct device *dev)
 static int pci_pm_resume(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
        /*
@@ -567,12 +586,16 @@ static int pci_pm_resume(struct device *dev)
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);
 
-       error = pci_pm_default_resume(pci_dev);
+       pci_pm_default_resume(pci_dev);
 
-       if (!error && drv && drv->pm && drv->pm->resume)
-               error = drv->pm->resume(dev);
+       if (pm) {
+               if (pm->resume)
+                       error = pm->resume(dev);
+       } else {
+               pci_pm_reenable_device(pci_dev);
+       }
 
-       return error;
+       return 0;
 }
 
 #else /* !CONFIG_SUSPEND */
@@ -589,21 +612,31 @@ static int pci_pm_resume(struct device *dev)
 static int pci_pm_freeze(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
-       int error = 0;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_FREEZE);
 
-       if (drv && drv->pm && drv->pm->freeze) {
-               error = drv->pm->freeze(dev);
-               suspend_report_result(drv->pm->freeze, error);
+       if (!pm) {
+               pci_pm_default_suspend(pci_dev);
+               return 0;
        }
 
-       if (!error)
-               pci_pm_default_suspend_generic(pci_dev);
+       pci_dev->state_saved = false;
 
-       return error;
+       if (pm->freeze) {
+               int error;
+
+               error = pm->freeze(dev);
+               suspend_report_result(pm->freeze, error);
+               if (error)
+                       return error;
+       }
+
+       if (!pci_dev->state_saved)
+               pci_save_state(pci_dev);
+
+       return 0;
 }
 
 static int pci_pm_freeze_noirq(struct device *dev)
@@ -646,16 +679,18 @@ static int pci_pm_thaw_noirq(struct device *dev)
 static int pci_pm_thaw(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);
 
-       pci_pm_reenable_device(pci_dev);
-
-       if (drv && drv->pm && drv->pm->thaw)
-               error =  drv->pm->thaw(dev);
+       if (pm) {
+               if (pm->thaw)
+                       error = pm->thaw(dev);
+       } else {
+               pci_pm_reenable_device(pci_dev);
+       }
 
        return error;
 }
@@ -663,22 +698,29 @@ static int pci_pm_thaw(struct device *dev)
 static int pci_pm_poweroff(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_suspend(dev, PMSG_HIBERNATE);
 
-       if (!drv || !drv->pm)
-               return 0;
+       if (!pm) {
+               pci_pm_default_suspend(pci_dev);
+               goto Fixup;
+       }
+
+       pci_dev->state_saved = false;
 
-       if (drv->pm->poweroff) {
-               error = drv->pm->poweroff(dev);
-               suspend_report_result(drv->pm->poweroff, error);
+       if (pm->poweroff) {
+               error = pm->poweroff(dev);
+               suspend_report_result(pm->poweroff, error);
        }
 
-       if (!error)
-               pci_pm_default_suspend(pci_dev);
+       if (!pci_dev->state_saved && !pci_is_bridge(pci_dev))
+               pci_prepare_to_sleep(pci_dev);
+
+ Fixup:
+       pci_fixup_device(pci_fixup_suspend, pci_dev);
 
        return error;
 }
@@ -719,7 +761,7 @@ static int pci_pm_restore_noirq(struct device *dev)
 static int pci_pm_restore(struct device *dev)
 {
        struct pci_dev *pci_dev = to_pci_dev(dev);
-       struct device_driver *drv = dev->driver;
+       struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL;
        int error = 0;
 
        /*
@@ -732,10 +774,14 @@ static int pci_pm_restore(struct device *dev)
        if (pci_has_legacy_pm_support(pci_dev))
                return pci_legacy_resume(dev);
 
-       error = pci_pm_default_resume(pci_dev);
+       pci_pm_default_resume(pci_dev);
 
-       if (!error && drv && drv->pm && drv->pm->restore)
-               error = drv->pm->restore(dev);
+       if (pm) {
+               if (pm->restore)
+                       error = pm->restore(dev);
+       } else {
+               pci_pm_reenable_device(pci_dev);
+       }
 
        return error;
 }
index db7ec14fa7191828d91f58eb903bfc94cd60ef8c..dfc4e0ddf241b57a93c8e94d3f81a583a772074c 100644 (file)
@@ -768,8 +768,8 @@ pci_read_rom(struct kobject *kobj, struct bin_attribute *bin_attr,
                return -EINVAL;
        
        rom = pci_map_rom(pdev, &size); /* size starts out as PCI window size */
-       if (!rom)
-               return 0;
+       if (!rom || !size)
+               return -EIO;
                
        if (off >= size)
                count = 0;
index 48807556b47a3346781e05153021a36e8adcca3b..6d6120007af4ed01d5fdc39331bff59349b1ed00 100644 (file)
@@ -1418,10 +1418,10 @@ int pci_restore_standard_config(struct pci_dev *dev)
                break;
        }
 
-       dev->current_state = PCI_D0;
+       pci_update_current_state(dev, PCI_D0);
 
  Restore:
-       return pci_restore_state(dev);
+       return dev->state_saved ? pci_restore_state(dev) : 0;
 }
 
 /**
@@ -1540,16 +1540,21 @@ void pci_release_region(struct pci_dev *pdev, int bar)
 }
 
 /**
- *     pci_request_region - Reserved PCI I/O and memory resource
+ *     __pci_request_region - Reserved PCI I/O and memory resource
  *     @pdev: PCI device whose resources are to be reserved
  *     @bar: BAR to be reserved
  *     @res_name: Name to be associated with resource.
+ *     @exclusive: whether the region access is exclusive or not
  *
  *     Mark the PCI region associated with PCI device @pdev BR @bar as
  *     being reserved by owner @res_name.  Do not access any
  *     address inside the PCI regions unless this call returns
  *     successfully.
  *
+ *     If @exclusive is set, then the region is marked so that userspace
+ *     is explicitly not allowed to map the resource via /dev/mem or
+ *     sysfs MMIO access.
+ *
  *     Returns 0 on success, or %EBUSY on error.  A warning
  *     message is also printed on failure.
  */
@@ -1588,12 +1593,12 @@ err_out:
 }
 
 /**
- *     pci_request_region - Reserved PCI I/O and memory resource
+ *     pci_request_region - Reserve PCI I/O and memory resource
  *     @pdev: PCI device whose resources are to be reserved
  *     @bar: BAR to be reserved
- *     @res_name: Name to be associated with resource.
+ *     @res_name: Name to be associated with resource
  *
- *     Mark the PCI region associated with PCI device @pdev BR @bar as
+ *     Mark the PCI region associated with PCI device @pdev BAR @bar as
  *     being reserved by owner @res_name.  Do not access any
  *     address inside the PCI regions unless this call returns
  *     successfully.
index 26ddf78ac30049ddb3fd0203828519689dfc886b..07c0aa5275e6edf33ab1914761d6acb3113f1741 100644 (file)
@@ -16,21 +16,21 @@ extern int pci_mmap_fits(struct pci_dev *pdev, int resno,
 #endif
 
 /**
- * Firmware PM callbacks
+ * struct pci_platform_pm_ops - Firmware PM callbacks
  *
- * @is_manageable - returns 'true' if given device is power manageable by the
- *                  platform firmware
+ * @is_manageable: returns 'true' if given device is power manageable by the
+ *                 platform firmware
  *
- * @set_state - invokes the platform firmware to set the device's power state
+ * @set_state: invokes the platform firmware to set the device's power state
  *
- * @choose_state - returns PCI power state of given device preferred by the
- *                 platform; to be used during system-wide transitions from a
- *                 sleeping state to the working state and vice versa
+ * @choose_state: returns PCI power state of given device preferred by the
+ *                platform; to be used during system-wide transitions from a
+ *                sleeping state to the working state and vice versa
  *
- * @can_wakeup - returns 'true' if given device is capable of waking up the
- *               system from a sleeping state
+ * @can_wakeup: returns 'true' if given device is capable of waking up the
+ *              system from a sleeping state
  *
- * @sleep_wake - enables/disables the system wake up capability of given device
+ * @sleep_wake: enables/disables the system wake up capability of given device
  *
  * If given platform is generally capable of power managing PCI devices, all of
  * these callbacks are mandatory.
index 586b6f75910da268b3a90e462ca470f010d73e76..b0367f168af4b95ff549bdad6b31fa1a9548e113 100644 (file)
@@ -718,9 +718,9 @@ void pcie_aspm_exit_link_state(struct pci_dev *pdev)
 
        /*
         * All PCIe functions are in one slot, remove one function will remove
-        * the the whole slot, so just wait
+        * the whole slot, so just wait until we are the last function left.
         */
-       if (!list_empty(&parent->subordinate->devices))
+       if (!list_is_last(&pdev->bus_list, &parent->subordinate->devices))
                goto out;
 
        /* All functions are removed, so just disable ASPM for the link */
index 99a914a027f8530dc3abe923d3edf33d46bd1a3b..f9b874eaeb9f80daea9f7eff884574cf7f749008 100644 (file)
@@ -55,25 +55,13 @@ static int pcie_portdrv_suspend(struct pci_dev *dev, pm_message_t state)
 
 }
 
-static int pcie_portdrv_suspend_late(struct pci_dev *dev, pm_message_t state)
-{
-       return pci_save_state(dev);
-}
-
-static int pcie_portdrv_resume_early(struct pci_dev *dev)
-{
-       return pci_restore_state(dev);
-}
-
 static int pcie_portdrv_resume(struct pci_dev *dev)
 {
-       pcie_portdrv_restore_config(dev);
+       pci_set_master(dev);
        return pcie_port_device_resume(dev);
 }
 #else
 #define pcie_portdrv_suspend NULL
-#define pcie_portdrv_suspend_late NULL
-#define pcie_portdrv_resume_early NULL
 #define pcie_portdrv_resume NULL
 #endif
 
@@ -292,8 +280,6 @@ static struct pci_driver pcie_portdriver = {
        .remove         = pcie_portdrv_remove,
 
        .suspend        = pcie_portdrv_suspend,
-       .suspend_late   = pcie_portdrv_suspend_late,
-       .resume_early   = pcie_portdrv_resume_early,
        .resume         = pcie_portdrv_resume,
 
        .err_handler    = &pcie_portdrv_err_handler,
index 132a78159b60e51bc988dc17acbaec5725e0ed98..36864a935d687bb732f9c09b45f2c647d6dca54c 100644 (file)
@@ -55,6 +55,7 @@ void pci_disable_rom(struct pci_dev *pdev)
 
 /**
  * pci_get_rom_size - obtain the actual size of the ROM image
+ * @pdev: target PCI device
  * @rom: kernel virtual pointer to image of ROM
  * @size: size of PCI window
  *  return: size of actual ROM image
@@ -63,7 +64,7 @@ void pci_disable_rom(struct pci_dev *pdev)
  * The PCI window size could be much larger than the
  * actual image size.
  */
-size_t pci_get_rom_size(void __iomem *rom, size_t size)
+size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
 {
        void __iomem *image;
        int last_image;
@@ -72,8 +73,10 @@ size_t pci_get_rom_size(void __iomem *rom, size_t size)
        do {
                void __iomem *pds;
                /* Standard PCI ROMs start out with these bytes 55 AA */
-               if (readb(image) != 0x55)
+               if (readb(image) != 0x55) {
+                       dev_err(&pdev->dev, "Invalid ROM contents\n");
                        break;
+               }
                if (readb(image + 1) != 0xAA)
                        break;
                /* get the PCI data structure and check its signature */
@@ -159,7 +162,7 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size)
         * size is much larger than the actual size of the ROM.
         * True size is important if the ROM is going to be copied.
         */
-       *size = pci_get_rom_size(rom, *size);
+       *size = pci_get_rom_size(pdev, rom, *size);
        return rom;
 }
 
index 1a266d4ab5f18ec52d8451185adcf66a3cd892d6..b3866ad502273bc23545305745863e800336b87a 100644 (file)
@@ -42,6 +42,7 @@ config ASUS_LAPTOP
        depends on LEDS_CLASS
        depends on NEW_LEDS
        depends on BACKLIGHT_CLASS_DEVICE
+       depends on INPUT
        ---help---
          This is the new Linux driver for Asus laptops. It may also support some
          MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate
@@ -61,6 +62,7 @@ config DELL_LAPTOP
        depends on EXPERIMENTAL
        depends on BACKLIGHT_CLASS_DEVICE
        depends on RFKILL
+       depends on POWER_SUPPLY
        default n
        ---help---
        This driver adds support for rfkill and backlight control to Dell
@@ -300,6 +302,7 @@ config INTEL_MENLOW
 config EEEPC_LAPTOP
        tristate "Eee PC Hotkey Driver (EXPERIMENTAL)"
        depends on ACPI
+       depends on INPUT
        depends on EXPERIMENTAL
        select BACKLIGHT_CLASS_DEVICE
        select HWMON
index 8fb8b35910482dc796841a410f01b47c7db8736d..56af6cf385b0ec0bb05c2e2789cd740c5f75ad69 100644 (file)
@@ -46,6 +46,7 @@
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_bus.h>
 #include <asm/uaccess.h>
+#include <linux/input.h>
 
 #define ASUS_LAPTOP_VERSION "0.42"
 
@@ -181,6 +182,8 @@ struct asus_hotk {
        u8 light_level;         //light sensor level
        u8 light_switch;        //light sensor switch value
        u16 event_count[128];   //count for each event TODO make this better
+       struct input_dev *inputdev;
+       u16 *keycode_map;
 };
 
 /*
@@ -250,6 +253,37 @@ ASUS_LED(rled, "record");
 ASUS_LED(pled, "phone");
 ASUS_LED(gled, "gaming");
 
+struct key_entry {
+       char type;
+       u8 code;
+       u16 keycode;
+};
+
+enum { KE_KEY, KE_END };
+
+static struct key_entry asus_keymap[] = {
+       {KE_KEY, 0x30, KEY_VOLUMEUP},
+       {KE_KEY, 0x31, KEY_VOLUMEDOWN},
+       {KE_KEY, 0x32, KEY_MUTE},
+       {KE_KEY, 0x33, KEY_SWITCHVIDEOMODE},
+       {KE_KEY, 0x34, KEY_SWITCHVIDEOMODE},
+       {KE_KEY, 0x40, KEY_PREVIOUSSONG},
+       {KE_KEY, 0x41, KEY_NEXTSONG},
+       {KE_KEY, 0x43, KEY_STOP},
+       {KE_KEY, 0x45, KEY_PLAYPAUSE},
+       {KE_KEY, 0x50, KEY_EMAIL},
+       {KE_KEY, 0x51, KEY_WWW},
+       {KE_KEY, 0x5C, BTN_EXTRA},  /* Performance */
+       {KE_KEY, 0x5D, KEY_WLAN},
+       {KE_KEY, 0x61, KEY_SWITCHVIDEOMODE},
+       {KE_KEY, 0x6B, BTN_TOUCH}, /* Lock Mouse */
+       {KE_KEY, 0x82, KEY_CAMERA},
+       {KE_KEY, 0x8A, KEY_TV},
+       {KE_KEY, 0x95, KEY_MEDIA},
+       {KE_KEY, 0x99, KEY_PHONE},
+       {KE_END, 0},
+};
+
 /*
  * This function evaluates an ACPI method, given an int as parameter, the
  * method is searched within the scope of the handle, can be NULL. The output
@@ -720,8 +754,68 @@ static ssize_t store_gps(struct device *dev, struct device_attribute *attr,
        return store_status(buf, count, NULL, GPS_ON);
 }
 
+/*
+ * Hotkey functions
+ */
+static struct key_entry *asus_get_entry_by_scancode(int code)
+{
+       struct key_entry *key;
+
+       for (key = asus_keymap; key->type != KE_END; key++)
+               if (code == key->code)
+                       return key;
+
+       return NULL;
+}
+
+static struct key_entry *asus_get_entry_by_keycode(int code)
+{
+       struct key_entry *key;
+
+       for (key = asus_keymap; key->type != KE_END; key++)
+               if (code == key->keycode && key->type == KE_KEY)
+                       return key;
+
+       return NULL;
+}
+
+static int asus_getkeycode(struct input_dev *dev, int scancode, int *keycode)
+{
+       struct key_entry *key = asus_get_entry_by_scancode(scancode);
+
+       if (key && key->type == KE_KEY) {
+               *keycode = key->keycode;
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
+static int asus_setkeycode(struct input_dev *dev, int scancode, int keycode)
+{
+       struct key_entry *key;
+       int old_keycode;
+
+       if (keycode < 0 || keycode > KEY_MAX)
+               return -EINVAL;
+
+       key = asus_get_entry_by_scancode(scancode);
+       if (key && key->type == KE_KEY) {
+               old_keycode = key->keycode;
+               key->keycode = keycode;
+               set_bit(keycode, dev->keybit);
+               if (!asus_get_entry_by_keycode(old_keycode))
+                       clear_bit(old_keycode, dev->keybit);
+               return 0;
+       }
+
+       return -EINVAL;
+}
+
 static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
 {
+       static struct key_entry *key;
+
        /* TODO Find a better way to handle events count. */
        if (!hotk)
                return;
@@ -738,10 +832,24 @@ static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
                lcd_blank(FB_BLANK_POWERDOWN);
        }
 
-       acpi_bus_generate_proc_event(hotk->device, event,
-                               hotk->event_count[event % 128]++);
-
-       return;
+       acpi_bus_generate_netlink_event(hotk->device->pnp.device_class,
+                                       dev_name(&hotk->device->dev), event,
+                                       hotk->event_count[event % 128]++);
+
+       if (hotk->inputdev) {
+               key = asus_get_entry_by_scancode(event);
+               if (!key)
+                       return ;
+
+               switch (key->type) {
+               case KE_KEY:
+                       input_report_key(hotk->inputdev, key->keycode, 1);
+                       input_sync(hotk->inputdev);
+                       input_report_key(hotk->inputdev, key->keycode, 0);
+                       input_sync(hotk->inputdev);
+                       break;
+               }
+       }
 }
 
 #define ASUS_CREATE_DEVICE_ATTR(_name)                                 \
@@ -959,6 +1067,38 @@ static int asus_hotk_get_info(void)
        return AE_OK;
 }
 
+static int asus_input_init(void)
+{
+       const struct key_entry *key;
+       int result;
+
+       hotk->inputdev = input_allocate_device();
+       if (!hotk->inputdev) {
+               printk(ASUS_INFO "Unable to allocate input device\n");
+               return 0;
+       }
+       hotk->inputdev->name = "Asus Laptop extra buttons";
+       hotk->inputdev->phys = ASUS_HOTK_FILE "/input0";
+       hotk->inputdev->id.bustype = BUS_HOST;
+       hotk->inputdev->getkeycode = asus_getkeycode;
+       hotk->inputdev->setkeycode = asus_setkeycode;
+
+       for (key = asus_keymap; key->type != KE_END; key++) {
+               switch (key->type) {
+               case KE_KEY:
+                       set_bit(EV_KEY, hotk->inputdev->evbit);
+                       set_bit(key->keycode, hotk->inputdev->keybit);
+                       break;
+               }
+       }
+       result = input_register_device(hotk->inputdev);
+       if (result) {
+               printk(ASUS_INFO "Unable to register input device\n");
+               input_free_device(hotk->inputdev);
+       }
+       return result;
+}
+
 static int asus_hotk_check(void)
 {
        int result = 0;
@@ -1044,7 +1184,7 @@ static int asus_hotk_add(struct acpi_device *device)
        /* GPS is on by default */
        write_status(NULL, 1, GPS_ON);
 
-      end:
+end:
        if (result) {
                kfree(hotk->name);
                kfree(hotk);
@@ -1091,10 +1231,17 @@ static void asus_led_exit(void)
        ASUS_LED_UNREGISTER(gled);
 }
 
+static void asus_input_exit(void)
+{
+       if (hotk->inputdev)
+               input_unregister_device(hotk->inputdev);
+}
+
 static void __exit asus_laptop_exit(void)
 {
        asus_backlight_exit();
        asus_led_exit();
+       asus_input_exit();
 
        acpi_bus_unregister_driver(&asus_hotk_driver);
        sysfs_remove_group(&asuspf_device->dev.kobj, &asuspf_attribute_group);
@@ -1216,6 +1363,10 @@ static int __init asus_laptop_init(void)
                printk(ASUS_INFO "Brightness ignored, must be controlled by "
                       "ACPI video driver\n");
 
+       result = asus_input_init();
+       if (result)
+               goto fail_input;
+
        result = asus_led_init(dev);
        if (result)
                goto fail_led;
@@ -1242,22 +1393,25 @@ static int __init asus_laptop_init(void)
 
        return 0;
 
-      fail_sysfs:
+fail_sysfs:
        platform_device_del(asuspf_device);
 
-      fail_platform_device2:
+fail_platform_device2:
        platform_device_put(asuspf_device);
 
-      fail_platform_device1:
+fail_platform_device1:
        platform_driver_unregister(&asuspf_driver);
 
-      fail_platform_driver:
+fail_platform_driver:
        asus_led_exit();
 
-      fail_led:
+fail_led:
+       asus_input_exit();
+
+fail_input:
        asus_backlight_exit();
 
-      fail_backlight:
+fail_backlight:
 
        return result;
 }
index 1e74988c7b2d2859871ca335d16af235a3ca7e6f..d63f26e666a4c0c369d340f7f90646d48a814c59 100644 (file)
@@ -143,6 +143,7 @@ struct asus_hotk {
                                                         S1300N, S5200N*/
                A4S,            /* Z81sp */
                F3Sa,           /* (Centrino) */
+               R1F,
                END_MODEL
        } model;                /* Models currently supported */
        u16 event_count[128];   /* Count for each event TODO make this better */
@@ -420,7 +421,18 @@ static struct model_data model_conf[END_MODEL] = {
                .display_get    = "\\ADVG",
                .display_set    = "SDSP",
        },
-
+       {
+               .name = "R1F",
+               .mt_bt_switch = "BLED",
+               .mt_mled = "MLED",
+               .mt_wled = "WLED",
+               .mt_lcd_switch = "\\Q10",
+               .lcd_status = "\\GP06",
+               .brightness_set = "SPLV",
+               .brightness_get = "GPLV",
+               .display_set = "SDSP",
+               .display_get = "\\INFB"
+       }
 };
 
 /* procdir we use */
@@ -1165,6 +1177,8 @@ static int asus_model_match(char *model)
                return W3V;
        else if (strncmp(model, "W5A", 3) == 0)
                return W5A;
+       else if (strncmp(model, "R1F", 3) == 0)
+               return R1F;
        else if (strncmp(model, "A4S", 3) == 0)
                return A4S;
        else if (strncmp(model, "F3Sa", 4) == 0)
index 9d93cb971e59a16df9ff014844d6a250983d6cd9..786ed8661cb08bb51e5f373904c5cc00fbf28159 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/uaccess.h>
 #include <linux/input.h>
 #include <linux/rfkill.h>
+#include <linux/pci.h>
 
 #define EEEPC_LAPTOP_VERSION   "0.1"
 
@@ -161,6 +162,10 @@ static struct key_entry eeepc_keymap[] = {
        {KE_KEY, 0x13, KEY_MUTE },
        {KE_KEY, 0x14, KEY_VOLUMEDOWN },
        {KE_KEY, 0x15, KEY_VOLUMEUP },
+       {KE_KEY, 0x1a, KEY_COFFEE },
+       {KE_KEY, 0x1b, KEY_ZOOM },
+       {KE_KEY, 0x1c, KEY_PROG2 },
+       {KE_KEY, 0x1d, KEY_PROG3 },
        {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE },
        {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE },
        {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE },
@@ -510,7 +515,43 @@ static int eeepc_hotk_check(void)
 static void notify_brn(void)
 {
        struct backlight_device *bd = eeepc_backlight_device;
-       bd->props.brightness = read_brightness(bd);
+       if (bd)
+               bd->props.brightness = read_brightness(bd);
+}
+
+static void eeepc_rfkill_notify(acpi_handle handle, u32 event, void *data)
+{
+       struct pci_dev *dev;
+       struct pci_bus *bus = pci_find_bus(0, 1);
+
+       if (event != ACPI_NOTIFY_BUS_CHECK)
+               return;
+
+       if (!bus) {
+               printk(EEEPC_WARNING "Unable to find PCI bus 1?\n");
+               return;
+       }
+
+       if (get_acpi(CM_ASL_WLAN) == 1) {
+               dev = pci_get_slot(bus, 0);
+               if (dev) {
+                       /* Device already present */
+                       pci_dev_put(dev);
+                       return;
+               }
+               dev = pci_scan_single_device(bus, 0);
+               if (dev) {
+                       pci_bus_assign_resources(bus);
+                       if (pci_bus_add_device(dev))
+                               printk(EEEPC_ERR "Unable to hotplug wifi\n");
+               }
+       } else {
+               dev = pci_get_slot(bus, 0);
+               if (dev) {
+                       pci_remove_bus_device(dev);
+                       pci_dev_put(dev);
+               }
+       }
 }
 
 static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
@@ -520,8 +561,9 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
                return;
        if (event >= NOTIFY_BRN_MIN && event <= NOTIFY_BRN_MAX)
                notify_brn();
-       acpi_bus_generate_proc_event(ehotk->device, event,
-                                    ehotk->event_count[event % 128]++);
+       acpi_bus_generate_netlink_event(ehotk->device->pnp.device_class,
+                                       dev_name(&ehotk->device->dev), event,
+                                       ehotk->event_count[event % 128]++);
        if (ehotk->inputdev) {
                key = eepc_get_entry_by_scancode(event);
                if (key) {
@@ -539,6 +581,45 @@ static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data)
        }
 }
 
+static int eeepc_register_rfkill_notifier(char *node)
+{
+       acpi_status status = AE_OK;
+       acpi_handle handle;
+
+       status = acpi_get_handle(NULL, node, &handle);
+
+       if (ACPI_SUCCESS(status)) {
+               status = acpi_install_notify_handler(handle,
+                                                    ACPI_SYSTEM_NOTIFY,
+                                                    eeepc_rfkill_notify,
+                                                    NULL);
+               if (ACPI_FAILURE(status))
+                       printk(EEEPC_WARNING
+                              "Failed to register notify on %s\n", node);
+       } else
+               return -ENODEV;
+
+       return 0;
+}
+
+static void eeepc_unregister_rfkill_notifier(char *node)
+{
+       acpi_status status = AE_OK;
+       acpi_handle handle;
+
+       status = acpi_get_handle(NULL, node, &handle);
+
+       if (ACPI_SUCCESS(status)) {
+               status = acpi_remove_notify_handler(handle,
+                                                    ACPI_SYSTEM_NOTIFY,
+                                                    eeepc_rfkill_notify);
+               if (ACPI_FAILURE(status))
+                       printk(EEEPC_ERR
+                              "Error removing rfkill notify handler %s\n",
+                               node);
+       }
+}
+
 static int eeepc_hotk_add(struct acpi_device *device)
 {
        acpi_status status = AE_OK;
@@ -558,7 +639,7 @@ static int eeepc_hotk_add(struct acpi_device *device)
        ehotk->device = device;
        result = eeepc_hotk_check();
        if (result)
-               goto end;
+               goto ehotk_fail;
        status = acpi_install_notify_handler(ehotk->handle, ACPI_SYSTEM_NOTIFY,
                                             eeepc_hotk_notify, ehotk);
        if (ACPI_FAILURE(status))
@@ -569,18 +650,25 @@ static int eeepc_hotk_add(struct acpi_device *device)
                                                           RFKILL_TYPE_WLAN);
 
                if (!ehotk->eeepc_wlan_rfkill)
-                       goto end;
+                       goto wlan_fail;
 
                ehotk->eeepc_wlan_rfkill->name = "eeepc-wlan";
                ehotk->eeepc_wlan_rfkill->toggle_radio = eeepc_wlan_rfkill_set;
                ehotk->eeepc_wlan_rfkill->get_state = eeepc_wlan_rfkill_state;
-               if (get_acpi(CM_ASL_WLAN) == 1)
+               if (get_acpi(CM_ASL_WLAN) == 1) {
                        ehotk->eeepc_wlan_rfkill->state =
                                RFKILL_STATE_UNBLOCKED;
-               else
+                       rfkill_set_default(RFKILL_TYPE_WLAN,
+                                          RFKILL_STATE_UNBLOCKED);
+               } else {
                        ehotk->eeepc_wlan_rfkill->state =
                                RFKILL_STATE_SOFT_BLOCKED;
-               rfkill_register(ehotk->eeepc_wlan_rfkill);
+                       rfkill_set_default(RFKILL_TYPE_WLAN,
+                                          RFKILL_STATE_SOFT_BLOCKED);
+               }
+               result = rfkill_register(ehotk->eeepc_wlan_rfkill);
+               if (result)
+                       goto wlan_fail;
        }
 
        if (get_acpi(CM_ASL_BLUETOOTH) != -1) {
@@ -588,27 +676,47 @@ static int eeepc_hotk_add(struct acpi_device *device)
                        rfkill_allocate(&device->dev, RFKILL_TYPE_BLUETOOTH);
 
                if (!ehotk->eeepc_bluetooth_rfkill)
-                       goto end;
+                       goto bluetooth_fail;
 
                ehotk->eeepc_bluetooth_rfkill->name = "eeepc-bluetooth";
                ehotk->eeepc_bluetooth_rfkill->toggle_radio =
                        eeepc_bluetooth_rfkill_set;
                ehotk->eeepc_bluetooth_rfkill->get_state =
                        eeepc_bluetooth_rfkill_state;
-               if (get_acpi(CM_ASL_BLUETOOTH) == 1)
+               if (get_acpi(CM_ASL_BLUETOOTH) == 1) {
                        ehotk->eeepc_bluetooth_rfkill->state =
                                RFKILL_STATE_UNBLOCKED;
-               else
+                       rfkill_set_default(RFKILL_TYPE_BLUETOOTH,
+                                          RFKILL_STATE_UNBLOCKED);
+               } else {
                        ehotk->eeepc_bluetooth_rfkill->state =
                                RFKILL_STATE_SOFT_BLOCKED;
-               rfkill_register(ehotk->eeepc_bluetooth_rfkill);
-       }
+                       rfkill_set_default(RFKILL_TYPE_BLUETOOTH,
+                                          RFKILL_STATE_SOFT_BLOCKED);
+               }
 
- end:
-       if (result) {
-               kfree(ehotk);
-               ehotk = NULL;
+               result = rfkill_register(ehotk->eeepc_bluetooth_rfkill);
+               if (result)
+                       goto bluetooth_fail;
        }
+
+       eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P6");
+       eeepc_register_rfkill_notifier("\\_SB.PCI0.P0P7");
+
+       return 0;
+
+ bluetooth_fail:
+       if (ehotk->eeepc_bluetooth_rfkill)
+               rfkill_free(ehotk->eeepc_bluetooth_rfkill);
+       rfkill_unregister(ehotk->eeepc_wlan_rfkill);
+       ehotk->eeepc_wlan_rfkill = NULL;
+ wlan_fail:
+       if (ehotk->eeepc_wlan_rfkill)
+               rfkill_free(ehotk->eeepc_wlan_rfkill);
+ ehotk_fail:
+       kfree(ehotk);
+       ehotk = NULL;
+
        return result;
 }
 
@@ -622,6 +730,10 @@ static int eeepc_hotk_remove(struct acpi_device *device, int type)
                                            eeepc_hotk_notify);
        if (ACPI_FAILURE(status))
                printk(EEEPC_ERR "Error removing notify handler\n");
+
+       eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P6");
+       eeepc_unregister_rfkill_notifier("\\_SB.PCI0.P0P7");
+
        kfree(ehotk);
        return 0;
 }
@@ -737,13 +849,21 @@ static void eeepc_backlight_exit(void)
 {
        if (eeepc_backlight_device)
                backlight_device_unregister(eeepc_backlight_device);
-       if (ehotk->inputdev)
-               input_unregister_device(ehotk->inputdev);
+       eeepc_backlight_device = NULL;
+}
+
+static void eeepc_rfkill_exit(void)
+{
        if (ehotk->eeepc_wlan_rfkill)
                rfkill_unregister(ehotk->eeepc_wlan_rfkill);
        if (ehotk->eeepc_bluetooth_rfkill)
                rfkill_unregister(ehotk->eeepc_bluetooth_rfkill);
-       eeepc_backlight_device = NULL;
+}
+
+static void eeepc_input_exit(void)
+{
+       if (ehotk->inputdev)
+               input_unregister_device(ehotk->inputdev);
 }
 
 static void eeepc_hwmon_exit(void)
@@ -762,6 +882,8 @@ static void eeepc_hwmon_exit(void)
 static void __exit eeepc_laptop_exit(void)
 {
        eeepc_backlight_exit();
+       eeepc_rfkill_exit();
+       eeepc_input_exit();
        eeepc_hwmon_exit();
        acpi_bus_unregister_driver(&eeepc_hotk_driver);
        sysfs_remove_group(&platform_device->dev.kobj,
@@ -865,6 +987,8 @@ fail_platform_driver:
 fail_hwmon:
        eeepc_backlight_exit();
 fail_backlight:
+       eeepc_input_exit();
+       eeepc_rfkill_exit();
        return result;
 }
 
index 65dc41540c62bdbe72bd0a68f88c042a7f06fd12..45940f31fe9e57642b08bbdb4aa8dc45d8d5d798 100644 (file)
@@ -166,6 +166,7 @@ struct fujitsu_hotkey_t {
        struct platform_device *pf_device;
        struct kfifo *fifo;
        spinlock_t fifo_lock;
+       int rfkill_supported;
        int rfkill_state;
        int logolamp_registered;
        int kblamps_registered;
@@ -526,7 +527,7 @@ static ssize_t
 show_lid_state(struct device *dev,
                        struct device_attribute *attr, char *buf)
 {
-       if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+       if (!(fujitsu_hotkey->rfkill_supported & 0x100))
                return sprintf(buf, "unknown\n");
        if (fujitsu_hotkey->rfkill_state & 0x100)
                return sprintf(buf, "open\n");
@@ -538,7 +539,7 @@ static ssize_t
 show_dock_state(struct device *dev,
                        struct device_attribute *attr, char *buf)
 {
-       if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+       if (!(fujitsu_hotkey->rfkill_supported & 0x200))
                return sprintf(buf, "unknown\n");
        if (fujitsu_hotkey->rfkill_state & 0x200)
                return sprintf(buf, "docked\n");
@@ -550,7 +551,7 @@ static ssize_t
 show_radios_state(struct device *dev,
                        struct device_attribute *attr, char *buf)
 {
-       if (fujitsu_hotkey->rfkill_state == UNSUPPORTED_CMD)
+       if (!(fujitsu_hotkey->rfkill_supported & 0x20))
                return sprintf(buf, "unknown\n");
        if (fujitsu_hotkey->rfkill_state & 0x20)
                return sprintf(buf, "on\n");
@@ -928,8 +929,17 @@ static int acpi_fujitsu_hotkey_add(struct acpi_device *device)
                ; /* No action, result is discarded */
        vdbg_printk(FUJLAPTOP_DBG_INFO, "Discarded %i ringbuffer entries\n", i);
 
-       fujitsu_hotkey->rfkill_state =
-               call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
+       fujitsu_hotkey->rfkill_supported =
+               call_fext_func(FUNC_RFKILL, 0x0, 0x0, 0x0);
+
+       /* Make sure our bitmask of supported functions is cleared if the
+          RFKILL function block is not implemented, like on the S7020. */
+       if (fujitsu_hotkey->rfkill_supported == UNSUPPORTED_CMD)
+               fujitsu_hotkey->rfkill_supported = 0;
+
+       if (fujitsu_hotkey->rfkill_supported)
+               fujitsu_hotkey->rfkill_state =
+                       call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
 
        /* Suspect this is a keymap of the application panel, print it */
        printk(KERN_INFO "fujitsu-laptop: BTNI: [0x%x]\n",
@@ -1005,8 +1015,9 @@ static void acpi_fujitsu_hotkey_notify(acpi_handle handle, u32 event,
 
        input = fujitsu_hotkey->input;
 
-       fujitsu_hotkey->rfkill_state =
-               call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
+       if (fujitsu_hotkey->rfkill_supported)
+               fujitsu_hotkey->rfkill_state =
+                       call_fext_func(FUNC_RFKILL, 0x4, 0x0, 0x0);
 
        switch (event) {
        case ACPI_FUJITSU_NOTIFY_CODE1:
index de91ddab0a86091fc353938125b04a69893c8554..f41135f2fb299dea3efbd6cc68a6479ce7a5002a 100644 (file)
@@ -463,9 +463,11 @@ static int __init hp_wmi_bios_setup(struct platform_device *device)
 
        return 0;
 register_wwan_err:
-       rfkill_unregister(bluetooth_rfkill);
+       if (bluetooth_rfkill)
+               rfkill_unregister(bluetooth_rfkill);
 register_bluetooth_error:
-       rfkill_unregister(wifi_rfkill);
+       if (wifi_rfkill)
+               rfkill_unregister(wifi_rfkill);
 add_sysfs_error:
        cleanup_sysfs(device);
        return err;
index f30db367c82eed36540b9db55f7e6b9abb72267b..c47a44dcb702abf97f52ce86fec941a9f5a17318 100644 (file)
@@ -507,7 +507,7 @@ static void acpi_pcc_generate_keyinput(struct pcc_acpi *pcc)
 
        hkey_num = result & 0xf;
 
-       if (hkey_num < 0 || hkey_num > ARRAY_SIZE(pcc->keymap)) {
+       if (hkey_num < 0 || hkey_num >= ARRAY_SIZE(pcc->keymap)) {
                ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
                                  "hotkey number out of range: %d\n",
                                  hkey_num));
index e988ec130fcd72fe5e267b3399775d109e663cd3..41aec2acbb916ceb3d5c6ce0072408f91075bec2 100644 (file)
@@ -199,7 +199,8 @@ static int adapter_get_property(struct power_supply *psy,
                        enum power_supply_property psp,
                        union power_supply_propval *val)
 {
-       struct pcf50633_mbc *mbc = container_of(psy, struct pcf50633_mbc, usb);
+       struct pcf50633_mbc *mbc = container_of(psy,
+                               struct pcf50633_mbc, adapter);
        int ret = 0;
 
        switch (psp) {
index cced4d108319600c24321021a3740a003df4cf84..81450fbd8b1246c3bca1841f8cd314af79264081 100644 (file)
@@ -241,6 +241,12 @@ config RTC_DRV_M41T80_WDT
          If you say Y here you will get support for the
          watchdog timer in the ST M41T60 and M41T80 RTC chips series.
 
+config RTC_DRV_DM355EVM
+       tristate "TI DaVinci DM355 EVM RTC"
+       depends on MFD_DM355EVM_MSP
+       help
+         Supports the RTC firmware in the MSP430 on the DM355 EVM.
+
 config RTC_DRV_TWL92330
        boolean "TI TWL92330/Menelaus"
        depends on MENELAUS
index 6e28021abb9d9494cf65b839de6f23a07014df91..0e697aa51caa5a2d8f891772ed793dd1d69d2f45 100644 (file)
@@ -23,6 +23,7 @@ obj-$(CONFIG_RTC_DRV_AT91SAM9)        += rtc-at91sam9.o
 obj-$(CONFIG_RTC_DRV_AU1XXX)   += rtc-au1xxx.o
 obj-$(CONFIG_RTC_DRV_BFIN)     += rtc-bfin.o
 obj-$(CONFIG_RTC_DRV_CMOS)     += rtc-cmos.o
+obj-$(CONFIG_RTC_DRV_DM355EVM) += rtc-dm355evm.o
 obj-$(CONFIG_RTC_DRV_DS1216)   += rtc-ds1216.o
 obj-$(CONFIG_RTC_DRV_DS1286)   += rtc-ds1286.o
 obj-$(CONFIG_RTC_DRV_DS1302)   += rtc-ds1302.o
index 8906a688e6a6fb2fec33f8d31de205f6b83bed2e..979ed0406ce9141557bb4eaba23daca9b1fb1f32 100644 (file)
@@ -81,7 +81,7 @@ static int __devinit au1xtoy_rtc_probe(struct platform_device *pdev)
        if (au_readl(SYS_TOYTRIM) != 32767) {
                /* wait until hardware gives access to TRIM register */
                t = 0x00100000;
-               while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T0S) && t--)
+               while ((au_readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_T0S) && --t)
                        msleep(1);
 
                if (!t) {
diff --git a/drivers/rtc/rtc-dm355evm.c b/drivers/rtc/rtc-dm355evm.c
new file mode 100644 (file)
index 0000000..58d4e18
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * rtc-dm355evm.c - access battery-backed counter in MSP430 firmware
+ *
+ * Copyright (c) 2008 by David Brownell
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/rtc.h>
+#include <linux/platform_device.h>
+
+#include <linux/i2c/dm355evm_msp.h>
+
+
+/*
+ * The MSP430 firmware on the DM355 EVM uses a watch crystal to feed
+ * a 1 Hz counter.  When a backup battery is supplied, that makes a
+ * reasonable RTC for applications where alarms and non-NTP drift
+ * compensation aren't important.
+ *
+ * The only real glitch is the inability to read or write all four
+ * counter bytes atomically:  the count may increment in the middle
+ * of an operation, causing trouble when the LSB rolls over.
+ *
+ * This driver was tested with firmware revision A4.
+ */
+union evm_time {
+       u8      bytes[4];
+       u32     value;
+};
+
+static int dm355evm_rtc_read_time(struct device *dev, struct rtc_time *tm)
+{
+       union evm_time  time;
+       int             status;
+       int             tries = 0;
+
+       do {
+               /*
+                * Read LSB(0) to MSB(3) bytes.  Defend against the counter
+                * rolling over by re-reading until the value is stable,
+                * and assuming the four reads take at most a few seconds.
+                */
+               status = dm355evm_msp_read(DM355EVM_MSP_RTC_0);
+               if (status < 0)
+                       return status;
+               if (tries && time.bytes[0] == status)
+                       break;
+               time.bytes[0] = status;
+
+               status = dm355evm_msp_read(DM355EVM_MSP_RTC_1);
+               if (status < 0)
+                       return status;
+               if (tries && time.bytes[1] == status)
+                       break;
+               time.bytes[1] = status;
+
+               status = dm355evm_msp_read(DM355EVM_MSP_RTC_2);
+               if (status < 0)
+                       return status;
+               if (tries && time.bytes[2] == status)
+                       break;
+               time.bytes[2] = status;
+
+               status = dm355evm_msp_read(DM355EVM_MSP_RTC_3);
+               if (status < 0)
+                       return status;
+               if (tries && time.bytes[3] == status)
+                       break;
+               time.bytes[3] = status;
+
+       } while (++tries < 5);
+
+       dev_dbg(dev, "read timestamp %08x\n", time.value);
+
+       rtc_time_to_tm(le32_to_cpu(time.value), tm);
+       return 0;
+}
+
+static int dm355evm_rtc_set_time(struct device *dev, struct rtc_time *tm)
+{
+       union evm_time  time;
+       unsigned long   value;
+       int             status;
+
+       rtc_tm_to_time(tm, &value);
+       time.value = cpu_to_le32(value);
+
+       dev_dbg(dev, "write timestamp %08x\n", time.value);
+
+       /*
+        * REVISIT handle non-atomic writes ... maybe just retry until
+        * byte[1] sticks (no rollover)?
+        */
+       status = dm355evm_msp_write(time.bytes[0], DM355EVM_MSP_RTC_0);
+       if (status < 0)
+               return status;
+
+       status = dm355evm_msp_write(time.bytes[1], DM355EVM_MSP_RTC_1);
+       if (status < 0)
+               return status;
+
+       status = dm355evm_msp_write(time.bytes[2], DM355EVM_MSP_RTC_2);
+       if (status < 0)
+               return status;
+
+       status = dm355evm_msp_write(time.bytes[3], DM355EVM_MSP_RTC_3);
+       if (status < 0)
+               return status;
+
+       return 0;
+}
+
+static struct rtc_class_ops dm355evm_rtc_ops = {
+       .read_time      = dm355evm_rtc_read_time,
+       .set_time       = dm355evm_rtc_set_time,
+};
+
+/*----------------------------------------------------------------------*/
+
+static int __devinit dm355evm_rtc_probe(struct platform_device *pdev)
+{
+       struct rtc_device *rtc;
+
+       rtc = rtc_device_register(pdev->name,
+                                 &pdev->dev, &dm355evm_rtc_ops, THIS_MODULE);
+       if (IS_ERR(rtc)) {
+               dev_err(&pdev->dev, "can't register RTC device, err %ld\n",
+                       PTR_ERR(rtc));
+               return PTR_ERR(rtc);
+       }
+       platform_set_drvdata(pdev, rtc);
+
+       return 0;
+}
+
+static int __devexit dm355evm_rtc_remove(struct platform_device *pdev)
+{
+       struct rtc_device *rtc = platform_get_drvdata(pdev);
+
+       rtc_device_unregister(rtc);
+       platform_set_drvdata(pdev, NULL);
+       return 0;
+}
+
+/*
+ * I2C is used to talk to the MSP430, but this platform device is
+ * exposed by an MFD driver that manages I2C communications.
+ */
+static struct platform_driver rtc_dm355evm_driver = {
+       .probe          = dm355evm_rtc_probe,
+       .remove         = __devexit_p(dm355evm_rtc_remove),
+       .driver         = {
+               .owner  = THIS_MODULE,
+               .name   = "rtc-dm355evm",
+       },
+};
+
+static int __init dm355evm_rtc_init(void)
+{
+       return platform_driver_register(&rtc_dm355evm_driver);
+}
+module_init(dm355evm_rtc_init);
+
+static void __exit dm355evm_rtc_exit(void)
+{
+       platform_driver_unregister(&rtc_dm355evm_driver);
+}
+module_exit(dm355evm_rtc_exit);
+
+MODULE_LICENSE("GPL");
index e54b5c619bdf9827734194b474204da0cdff4fbe..e01b955db077e6be2a60387ec9a4b6777dd80692 100644 (file)
@@ -122,7 +122,6 @@ static const struct rtc_class_ops ds1390_rtc_ops = {
 
 static int __devinit ds1390_probe(struct spi_device *spi)
 {
-       struct rtc_device *rtc;
        unsigned char tmp;
        struct ds1390 *chip;
        int res;
index bd56a033bfd06b9ff5babaa175bdcc0f7a54f373..bb8cc05605acdeec83c1d1a66f6207d40e91d8a8 100644 (file)
@@ -485,7 +485,7 @@ static void __exit pxa_rtc_exit(void)
 module_init(pxa_rtc_init);
 module_exit(pxa_rtc_exit);
 
-MODULE_AUTHOR("Robert Jarzmik");
+MODULE_AUTHOR("Robert Jarzmik <robert.jarzmik@free.fr>");
 MODULE_DESCRIPTION("PXA27x/PXA3xx Realtime Clock Driver (RTC)");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:pxa-rtc");
index bd5914994142707556b36b95fcb8b3e7042899fd..08c23a921012d4a771b2171b712fdd1b8f653c0f 100644 (file)
@@ -57,6 +57,8 @@ static void dasd_device_tasklet(struct dasd_device *);
 static void dasd_block_tasklet(struct dasd_block *);
 static void do_kick_device(struct work_struct *);
 static void dasd_return_cqr_cb(struct dasd_ccw_req *, void *);
+static void dasd_device_timeout(unsigned long);
+static void dasd_block_timeout(unsigned long);
 
 /*
  * SECTION: Operations on the device structure.
@@ -99,6 +101,8 @@ struct dasd_device *dasd_alloc_device(void)
                     (unsigned long) device);
        INIT_LIST_HEAD(&device->ccw_queue);
        init_timer(&device->timer);
+       device->timer.function = dasd_device_timeout;
+       device->timer.data = (unsigned long) device;
        INIT_WORK(&device->kick_work, do_kick_device);
        device->state = DASD_STATE_NEW;
        device->target = DASD_STATE_NEW;
@@ -138,6 +142,8 @@ struct dasd_block *dasd_alloc_block(void)
        INIT_LIST_HEAD(&block->ccw_queue);
        spin_lock_init(&block->queue_lock);
        init_timer(&block->timer);
+       block->timer.function = dasd_block_timeout;
+       block->timer.data = (unsigned long) block;
 
        return block;
 }
@@ -915,19 +921,10 @@ static void dasd_device_timeout(unsigned long ptr)
  */
 void dasd_device_set_timer(struct dasd_device *device, int expires)
 {
-       if (expires == 0) {
-               if (timer_pending(&device->timer))
-                       del_timer(&device->timer);
-               return;
-       }
-       if (timer_pending(&device->timer)) {
-               if (mod_timer(&device->timer, jiffies + expires))
-                       return;
-       }
-       device->timer.function = dasd_device_timeout;
-       device->timer.data = (unsigned long) device;
-       device->timer.expires = jiffies + expires;
-       add_timer(&device->timer);
+       if (expires == 0)
+               del_timer(&device->timer);
+       else
+               mod_timer(&device->timer, jiffies + expires);
 }
 
 /*
@@ -935,8 +932,7 @@ void dasd_device_set_timer(struct dasd_device *device, int expires)
  */
 void dasd_device_clear_timer(struct dasd_device *device)
 {
-       if (timer_pending(&device->timer))
-               del_timer(&device->timer);
+       del_timer(&device->timer);
 }
 
 static void dasd_handle_killed_request(struct ccw_device *cdev,
@@ -1586,19 +1582,10 @@ static void dasd_block_timeout(unsigned long ptr)
  */
 void dasd_block_set_timer(struct dasd_block *block, int expires)
 {
-       if (expires == 0) {
-               if (timer_pending(&block->timer))
-                       del_timer(&block->timer);
-               return;
-       }
-       if (timer_pending(&block->timer)) {
-               if (mod_timer(&block->timer, jiffies + expires))
-                       return;
-       }
-       block->timer.function = dasd_block_timeout;
-       block->timer.data = (unsigned long) block;
-       block->timer.expires = jiffies + expires;
-       add_timer(&block->timer);
+       if (expires == 0)
+               del_timer(&block->timer);
+       else
+               mod_timer(&block->timer, jiffies + expires);
 }
 
 /*
@@ -1606,8 +1593,7 @@ void dasd_block_set_timer(struct dasd_block *block, int expires)
  */
 void dasd_block_clear_timer(struct dasd_block *block)
 {
-       if (timer_pending(&block->timer))
-               del_timer(&block->timer);
+       del_timer(&block->timer);
 }
 
 /*
index 300e28a531f80c938f880b68c246f921686c63bb..34339902efb9efd2ed64f9ca6515141b0b85c9cb 100644 (file)
@@ -677,7 +677,7 @@ static ssize_t dasd_ff_show(struct device *dev, struct device_attribute *attr,
        struct dasd_devmap *devmap;
        int ff_flag;
 
-       devmap = dasd_find_busid(dev->bus_id);
+       devmap = dasd_find_busid(dev_name(dev));
        if (!IS_ERR(devmap))
                ff_flag = (devmap->features & DASD_FEATURE_FAILFAST) != 0;
        else
index 1fd8f2193ed853b143cdd25d1792224c91f4f1b9..4377e93a43d7f97b7087ed5164967743337fc8a5 100644 (file)
@@ -280,8 +280,11 @@ sclp_dispatch_evbufs(struct sccb_header *sccb)
        rc = 0;
        for (offset = sizeof(struct sccb_header); offset < sccb->length;
             offset += evbuf->length) {
-               /* Search for event handler */
                evbuf = (struct evbuf_header *) ((addr_t) sccb + offset);
+               /* Check for malformed hardware response */
+               if (evbuf->length == 0)
+                       break;
+               /* Search for event handler */
                reg = NULL;
                list_for_each(l, &sclp_reg_list) {
                        reg = list_entry(l, struct sclp_register, list);
index 506390496416ea1163d12919042a6f0d0d34df34..77ab6e34a100b758bc3047888e78f1962a90146d 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/memory.h>
 #include <asm/chpid.h>
 #include <asm/sclp.h>
+#include <asm/setup.h>
 
 #include "sclp.h"
 
@@ -474,6 +475,10 @@ static void __init add_memory_merged(u16 rn)
                goto skip_add;
        if (start + size > VMEM_MAX_PHYS)
                size = VMEM_MAX_PHYS - start;
+       if (memory_end_set && (start >= memory_end))
+               goto skip_add;
+       if (memory_end_set && (start + size > memory_end))
+               size = memory_end - start;
        add_memory(0, start, size);
 skip_add:
        first_rn = rn;
index f5e618562c5ff9b1be02d014a022ca13e98e10ef..6669adf355befa399496f26bcd15f12018a82eee 100644 (file)
@@ -60,6 +60,9 @@
  *    1.25  Added Packing support
  *    1.5
  */
+
+#define KMSG_COMPONENT "claw"
+
 #include <asm/ccwdev.h>
 #include <asm/ccwgroup.h>
 #include <asm/debug.h>
@@ -94,7 +97,7 @@
    CLAW uses the s390dbf file system  see claw_trace and claw_setup
 */
 
-
+static char version[] __initdata = "CLAW driver";
 static char debug_buffer[255];
 /**
  * Debug Facility Stuff
@@ -206,20 +209,30 @@ static struct net_device_stats *claw_stats(struct net_device *dev);
 static int pages_to_order_of_mag(int num_of_pages);
 static struct sk_buff *claw_pack_skb(struct claw_privbk *privptr);
 /* sysfs Functions */
-static ssize_t claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_hname_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_hname_show(struct device *dev,
+       struct device_attribute *attr, char *buf);
+static ssize_t claw_hname_write(struct device *dev,
+       struct device_attribute *attr,
        const char *buf, size_t count);
-static ssize_t claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_adname_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_adname_show(struct device *dev,
+       struct device_attribute *attr, char *buf);
+static ssize_t claw_adname_write(struct device *dev,
+       struct device_attribute *attr,
        const char *buf, size_t count);
-static ssize_t claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_apname_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_apname_show(struct device *dev,
+       struct device_attribute *attr, char *buf);
+static ssize_t claw_apname_write(struct device *dev,
+       struct device_attribute *attr,
        const char *buf, size_t count);
-static ssize_t claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_wbuff_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_wbuff_show(struct device *dev,
+       struct device_attribute *attr, char *buf);
+static ssize_t claw_wbuff_write(struct device *dev,
+       struct device_attribute *attr,
        const char *buf, size_t count);
-static ssize_t claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf);
-static ssize_t claw_rbuff_write(struct device *dev, struct device_attribute *attr,
+static ssize_t claw_rbuff_show(struct device *dev,
+       struct device_attribute *attr, char *buf);
+static ssize_t claw_rbuff_write(struct device *dev,
+       struct device_attribute *attr,
        const char *buf, size_t count);
 static int claw_add_files(struct device *dev);
 static void claw_remove_files(struct device *dev);
@@ -298,8 +311,8 @@ claw_probe(struct ccwgroup_device *cgdev)
        if (rc) {
                probe_error(cgdev);
                put_device(&cgdev->dev);
-               printk(KERN_WARNING "add_files failed %s %s Exit Line %d \n",
-                       dev_name(&cgdev->cdev[0]->dev), __func__, __LINE__);
+               dev_err(&cgdev->dev, "Creating the /proc files for a new"
+               " CLAW device failed\n");
                CLAW_DBF_TEXT_(2, setup, "probex%d", rc);
                return rc;
        }
@@ -496,7 +509,8 @@ claw_open(struct net_device *dev)
            ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) ||
            (((privptr->channel[READ].flag |
                privptr->channel[WRITE].flag) & CLAW_TIMER) != 0x00)) {
-                printk(KERN_INFO "%s: remote side is not ready\n", dev->name);
+               dev_info(&privptr->channel[READ].cdev->dev,
+                       "%s: remote side is not ready\n", dev->name);
                CLAW_DBF_TEXT(2, trace, "notrdy");
 
                 for ( i = 0; i < 2;  i++) {
@@ -582,10 +596,9 @@ claw_irq_handler(struct ccw_device *cdev,
        CLAW_DBF_TEXT(4, trace, "clawirq");
         /* Bypass all 'unsolicited interrupts' */
        if (!cdev->dev.driver_data) {
-                printk(KERN_WARNING "claw: unsolicited interrupt for device:"
-                       "%s received c-%02x d-%02x\n",
-                      dev_name(&cdev->dev), irb->scsw.cmd.cstat,
-                      irb->scsw.cmd.dstat);
+               dev_warn(&cdev->dev, "An uninitialized CLAW device received an"
+                       " IRQ, c-%02x d-%02x\n",
+                       irb->scsw.cmd.cstat, irb->scsw.cmd.dstat);
                CLAW_DBF_TEXT(2, trace, "badirq");
                 return;
         }
@@ -597,8 +610,7 @@ claw_irq_handler(struct ccw_device *cdev,
        else if (privptr->channel[WRITE].cdev == cdev)
                p_ch = &privptr->channel[WRITE];
        else {
-               printk(KERN_WARNING "claw: Can't determine channel for "
-                       "interrupt, device %s\n", dev_name(&cdev->dev));
+               dev_warn(&cdev->dev, "The device is not a CLAW device\n");
                CLAW_DBF_TEXT(2, trace, "badchan");
                return;
        }
@@ -612,7 +624,8 @@ claw_irq_handler(struct ccw_device *cdev,
 
        /* Check for good subchannel return code, otherwise info message */
        if (irb->scsw.cmd.cstat && !(irb->scsw.cmd.cstat & SCHN_STAT_PCI)) {
-                printk(KERN_INFO "%s: subchannel check for device: %04x -"
+               dev_info(&cdev->dev,
+                       "%s: subchannel check for device: %04x -"
                        " Sch Stat %02x  Dev Stat %02x CPA - %04x\n",
                         dev->name, p_ch->devno,
                        irb->scsw.cmd.cstat, irb->scsw.cmd.dstat,
@@ -651,7 +664,7 @@ claw_irq_handler(struct ccw_device *cdev,
                        wake_up(&p_ch->wait); /* wake claw_open (READ)*/
                } else if (p_ch->flag == CLAW_WRITE) {
                        p_ch->claw_state = CLAW_START_WRITE;
-                       /*      send SYSTEM_VALIDATE                    */
+                       /*      send SYSTEM_VALIDATE                    */
                        claw_strt_read(dev, LOCK_NO);
                        claw_send_control(dev,
                                SYSTEM_VALIDATE_REQUEST,
@@ -659,10 +672,9 @@ claw_irq_handler(struct ccw_device *cdev,
                                p_env->host_name,
                                p_env->adapter_name);
                } else {
-                       printk(KERN_WARNING "claw: unsolicited "
-                               "interrupt for device:"
-                               "%s received c-%02x d-%02x\n",
-                               dev_name(&cdev->dev),
+                       dev_warn(&cdev->dev, "The CLAW device received"
+                               " an unexpected IRQ, "
+                               "c-%02x d-%02x\n",
                                irb->scsw.cmd.cstat,
                                irb->scsw.cmd.dstat);
                        return;
@@ -677,8 +689,8 @@ claw_irq_handler(struct ccw_device *cdev,
                            (p_ch->irb->ecw[0] & 0x40) == 0x40 ||
                            (p_ch->irb->ecw[0])        == 0) {
                                privptr->stats.rx_errors++;
-                               printk(KERN_INFO "%s: Restart is "
-                                       "required after remote "
+                               dev_info(&cdev->dev,
+                                       "%s: Restart is required after remote "
                                        "side recovers \n",
                                        dev->name);
                        }
@@ -713,11 +725,13 @@ claw_irq_handler(struct ccw_device *cdev,
                return;
        case CLAW_START_WRITE:
                if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) {
-                       printk(KERN_INFO "%s: Unit Check Occured in "
+                       dev_info(&cdev->dev,
+                               "%s: Unit Check Occured in "
                                "write channel\n", dev->name);
                        clear_bit(0, (void *)&p_ch->IO_active);
                        if (p_ch->irb->ecw[0] & 0x80) {
-                               printk(KERN_INFO "%s: Resetting Event "
+                               dev_info(&cdev->dev,
+                                       "%s: Resetting Event "
                                        "occurred:\n", dev->name);
                                init_timer(&p_ch->timer);
                                p_ch->timer.function =
@@ -725,7 +739,8 @@ claw_irq_handler(struct ccw_device *cdev,
                                p_ch->timer.data = (unsigned long)p_ch;
                                p_ch->timer.expires = jiffies + 10*HZ;
                                add_timer(&p_ch->timer);
-                               printk(KERN_INFO "%s: write connection "
+                               dev_info(&cdev->dev,
+                                       "%s: write connection "
                                        "restarting\n", dev->name);
                        }
                        CLAW_DBF_TEXT(4, trace, "rstrtwrt");
@@ -733,9 +748,10 @@ claw_irq_handler(struct ccw_device *cdev,
                }
                if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) {
                        clear_bit(0, (void *)&p_ch->IO_active);
-                       printk(KERN_INFO "%s: Unit Exception "
-                              "Occured in write channel\n",
-                              dev->name);
+                       dev_info(&cdev->dev,
+                               "%s: Unit Exception "
+                               "occurred in write channel\n",
+                               dev->name);
                }
                if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) ||
                (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) ||
@@ -757,8 +773,9 @@ claw_irq_handler(struct ccw_device *cdev,
                CLAW_DBF_TEXT(4, trace, "StWtExit");
                return;
        default:
-               printk(KERN_WARNING "%s: wrong selection code - irq "
-                       "state=%d\n", dev->name, p_ch->claw_state);
+               dev_warn(&cdev->dev,
+                       "The CLAW device for %s received an unexpected IRQ\n",
+                        dev->name);
                CLAW_DBF_TEXT(2, trace, "badIRQ");
                return;
         }
@@ -910,8 +927,10 @@ claw_release(struct net_device *dev)
         if (((privptr->channel[READ].last_dstat |
                privptr->channel[WRITE].last_dstat) &
                ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) {
-                printk(KERN_WARNING "%s: channel problems during close - "
-                       "read: %02x -  write: %02x\n",
+               dev_warn(&privptr->channel[READ].cdev->dev,
+                       "Deactivating %s completed with incorrect"
+                       " subchannel status "
+                       "(read %02x, write %02x)\n",
                 dev->name,
                privptr->channel[READ].last_dstat,
                privptr->channel[WRITE].last_dstat);
@@ -1076,8 +1095,8 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first,
         }
 
         if ( privptr-> p_read_active_first ==NULL ) {
-                privptr-> p_read_active_first= p_first;  /*    set new first */
-                privptr-> p_read_active_last = p_last;   /*    set new last  */
+               privptr->p_read_active_first = p_first;  /*  set new first */
+               privptr->p_read_active_last  = p_last;   /*  set new last  */
         }
         else {
 
@@ -1113,7 +1132,7 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first,
                         privptr->p_read_active_last->r_TIC_2.cda=
                                (__u32)__pa(&p_first->read);
                 }
-                /*      chain in new set of blocks                              */
+               /*      chain in new set of blocks                         */
                 privptr->p_read_active_last->next = p_first;
                 privptr->p_read_active_last=p_last;
         } /* end of if ( privptr-> p_read_active_first ==NULL)  */
@@ -1135,21 +1154,18 @@ ccw_check_return_code(struct ccw_device *cdev, int return_code)
                case -EBUSY: /* BUSY is a transient state no action needed */
                        break;
                case -ENODEV:
-                       printk(KERN_EMERG "%s: Missing device called "
-                               "for IO ENODEV\n", dev_name(&cdev->dev));
-                       break;
-               case -EIO:
-                       printk(KERN_EMERG "%s: Status pending... EIO \n",
-                               dev_name(&cdev->dev));
+                       dev_err(&cdev->dev, "The remote channel adapter is not"
+                               " available\n");
                        break;
                case -EINVAL:
-                       printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n",
-                               dev_name(&cdev->dev));
+                       dev_err(&cdev->dev,
+                               "The status of the remote channel adapter"
+                               " is not valid\n");
                        break;
                default:
-                       printk(KERN_EMERG "%s: Unknown error in "
-                                "Do_IO %d\n", dev_name(&cdev->dev),
-                              return_code);
+                       dev_err(&cdev->dev, "The common device layer"
+                               " returned error code %d\n",
+                                 return_code);
                }
        }
        CLAW_DBF_TEXT(4, trace, "ccwret");
@@ -1163,40 +1179,41 @@ static void
 ccw_check_unit_check(struct chbk * p_ch, unsigned char sense )
 {
        struct net_device *ndev = p_ch->ndev;
+       struct device *dev = &p_ch->cdev->dev;
 
        CLAW_DBF_TEXT(4, trace, "unitchek");
-        printk(KERN_INFO "%s: Unit Check with sense byte:0x%04x\n",
-              ndev->name, sense);
+       dev_warn(dev, "The communication peer of %s disconnected\n",
+               ndev->name);
 
         if (sense & 0x40) {
                 if (sense & 0x01) {
-                        printk(KERN_WARNING "%s: Interface disconnect or "
-                               "Selective reset "
-                               "occurred (remote side)\n", ndev->name);
-                }
-                else {
-                        printk(KERN_WARNING "%s: System reset occured"
-                               " (remote side)\n", ndev->name);
+                       dev_warn(dev, "The remote channel adapter for"
+                               " %s has been reset\n",
+                               ndev->name);
                 }
         }
         else if (sense & 0x20) {
                 if (sense & 0x04) {
-                        printk(KERN_WARNING "%s: Data-streaming "
-                               "timeout)\n", ndev->name);
+                       dev_warn(dev, "A data streaming timeout occurred"
+                               " for %s\n",
+                               ndev->name);
                 }
                 else  {
-                        printk(KERN_WARNING "%s: Data-transfer parity"
-                               " error\n", ndev->name);
+                       dev_warn(dev, "A data transfer parity error occurred"
+                               " for %s\n",
+                               ndev->name);
                 }
         }
         else if (sense & 0x10) {
                 if (sense & 0x20) {
-                        printk(KERN_WARNING "%s: Hardware malfunction "
-                               "(remote side)\n", ndev->name);
+                       dev_warn(dev, "The remote channel adapter for %s"
+                               " is faulty\n",
+                               ndev->name);
                 }
                 else {
-                        printk(KERN_WARNING "%s: read-data parity error "
-                               "(remote side)\n", ndev->name);
+                       dev_warn(dev, "A read data parity error occurred"
+                               " for %s\n",
+                               ndev->name);
                 }
         }
 
@@ -1375,7 +1392,7 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid)
         */
 
         if (p_first_ccw!=NULL) {
-                /*      setup ending ccw sequence for this segment              */
+               /*      setup ending ccw sequence for this segment           */
                 pEnd=privptr->p_end_ccw;
                 if (pEnd->write1) {
                         pEnd->write1=0x00;   /* second end ccw is now active */
@@ -1697,10 +1714,11 @@ init_ccw_bk(struct net_device *dev)
                         p_buf-> w_TIC_1.flags      = 0;
                         p_buf-> w_TIC_1.count      = 0;
 
-                        if (((unsigned long)p_buff+privptr->p_env->write_size) >=
+                       if (((unsigned long)p_buff +
+                                           privptr->p_env->write_size) >=
                           ((unsigned long)(p_buff+2*
-                               (privptr->p_env->write_size) -1) & PAGE_MASK)) {
-                        p_buff= p_buff+privptr->p_env->write_size;
+                           (privptr->p_env->write_size) - 1) & PAGE_MASK)) {
+                               p_buff = p_buff+privptr->p_env->write_size;
                         }
                 }
            }
@@ -1840,15 +1858,16 @@ init_ccw_bk(struct net_device *dev)
                         p_buf->header.opcode=0xff;
                         p_buf->header.flag=CLAW_PENDING;
 
-                        if (((unsigned long)p_buff+privptr->p_env->read_size) >=
-                               ((unsigned long)(p_buff+2*(privptr->p_env->read_size) -1)
-                                & PAGE_MASK) ) {
+                       if (((unsigned long)p_buff+privptr->p_env->read_size) >=
+                         ((unsigned long)(p_buff+2*(privptr->p_env->read_size)
+                                -1)
+                          & PAGE_MASK)) {
                                 p_buff= p_buff+privptr->p_env->read_size;
                         }
                         else {
                                 p_buff=
                                (void *)((unsigned long)
-                                       (p_buff+2*(privptr->p_env->read_size) -1)
+                                       (p_buff+2*(privptr->p_env->read_size)-1)
                                         & PAGE_MASK) ;
                         }
                 }   /* for read_buffers   */
@@ -1856,24 +1875,28 @@ init_ccw_bk(struct net_device *dev)
           else {  /* read Size >= PAGE_SIZE  */
                 for (i=0 ; i< privptr->p_env->read_buffers ; i++) {
                         p_buff = (void *)__get_free_pages(__GFP_DMA,
-                               (int)pages_to_order_of_mag(privptr->p_buff_pages_perread) );
+                               (int)pages_to_order_of_mag(
+                                       privptr->p_buff_pages_perread));
                         if (p_buff==NULL) {
                                 free_pages((unsigned long)privptr->p_buff_ccw,
-                                       (int)pages_to_order_of_mag(privptr->p_buff_ccw_num));
+                                       (int)pages_to_order_of_mag(privptr->
+                                       p_buff_ccw_num));
                                /* free the write pages  */
                                p_buf=privptr->p_buff_write;
                                 while (p_buf!=NULL) {
-                                        free_pages((unsigned long)p_buf->p_buffer,
-                                               (int)pages_to_order_of_mag(
-                                               privptr->p_buff_pages_perwrite ));
+                                       free_pages(
+                                           (unsigned long)p_buf->p_buffer,
+                                           (int)pages_to_order_of_mag(
+                                           privptr->p_buff_pages_perwrite));
                                         p_buf=p_buf->next;
                                 }
                                /* free any read pages already alloc  */
                                p_buf=privptr->p_buff_read;
                                 while (p_buf!=NULL) {
-                                        free_pages((unsigned long)p_buf->p_buffer,
-                                               (int)pages_to_order_of_mag(
-                                               privptr->p_buff_pages_perread ));
+                                       free_pages(
+                                           (unsigned long)p_buf->p_buffer,
+                                           (int)pages_to_order_of_mag(
+                                            privptr->p_buff_pages_perread));
                                         p_buf=p_buf->next;
                                 }
                                 privptr->p_buff_ccw=NULL;
@@ -2003,7 +2026,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
        tdev = &privptr->channel[READ].cdev->dev;
        memcpy( &temp_host_name, p_env->host_name, 8);
         memcpy( &temp_ws_name, p_env->adapter_name , 8);
-        printk(KERN_INFO "%s: CLAW device %.8s: "
+       dev_info(tdev, "%s: CLAW device %.8s: "
                "Received Control Packet\n",
                dev->name, temp_ws_name);
         if (privptr->release_pend==1) {
@@ -2022,32 +2045,30 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                if (p_ctlbk->version != CLAW_VERSION_ID) {
                        claw_snd_sys_validate_rsp(dev, p_ctlbk,
                                CLAW_RC_WRONG_VERSION);
-                       printk("%s: %d is wrong version id. "
-                              "Expected %d\n",
-                              dev->name, p_ctlbk->version,
-                              CLAW_VERSION_ID);
+                       dev_warn(tdev, "The communication peer of %s"
+                               " uses an incorrect API version %d\n",
+                               dev->name, p_ctlbk->version);
                }
                p_sysval = (struct sysval *)&(p_ctlbk->data);
-               printk("%s: Recv Sys Validate Request: "
-                      "Vers=%d,link_id=%d,Corr=%d,WS name=%."
-                      "8s,Host name=%.8s\n",
-                      dev->name, p_ctlbk->version,
-                      p_ctlbk->linkid,
-                      p_ctlbk->correlator,
-                      p_sysval->WS_name,
-                      p_sysval->host_name);
+               dev_info(tdev, "%s: Recv Sys Validate Request: "
+                       "Vers=%d,link_id=%d,Corr=%d,WS name=%.8s,"
+                       "Host name=%.8s\n",
+                       dev->name, p_ctlbk->version,
+                       p_ctlbk->linkid,
+                       p_ctlbk->correlator,
+                       p_sysval->WS_name,
+                       p_sysval->host_name);
                if (memcmp(temp_host_name, p_sysval->host_name, 8)) {
                        claw_snd_sys_validate_rsp(dev, p_ctlbk,
                                CLAW_RC_NAME_MISMATCH);
                        CLAW_DBF_TEXT(2, setup, "HSTBAD");
                        CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->host_name);
                        CLAW_DBF_TEXT_(2, setup, "%s", temp_host_name);
-                       printk(KERN_INFO "%s:  Host name mismatch\n",
-                               dev->name);
-                       printk(KERN_INFO "%s: Received :%s: "
-                               "expected :%s: \n",
-                               dev->name,
+                       dev_warn(tdev,
+                               "Host name %s for %s does not match the"
+                               " remote adapter name %s\n",
                                p_sysval->host_name,
+                               dev->name,
                                temp_host_name);
                }
                if (memcmp(temp_ws_name, p_sysval->WS_name, 8)) {
@@ -2056,35 +2077,38 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                        CLAW_DBF_TEXT(2, setup, "WSNBAD");
                        CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->WS_name);
                        CLAW_DBF_TEXT_(2, setup, "%s", temp_ws_name);
-                       printk(KERN_INFO "%s: WS name mismatch\n",
-                               dev->name);
-                       printk(KERN_INFO "%s: Received :%s: "
-                              "expected :%s: \n",
-                              dev->name,
-                              p_sysval->WS_name,
-                              temp_ws_name);
+                       dev_warn(tdev, "Adapter name %s for %s does not match"
+                               " the remote host name %s\n",
+                               p_sysval->WS_name,
+                               dev->name,
+                               temp_ws_name);
                }
                if ((p_sysval->write_frame_size < p_env->write_size) &&
                    (p_env->packing == 0)) {
                        claw_snd_sys_validate_rsp(dev, p_ctlbk,
                                CLAW_RC_HOST_RCV_TOO_SMALL);
-                       printk(KERN_INFO "%s: host write size is too "
-                               "small\n", dev->name);
+                       dev_warn(tdev,
+                               "The local write buffer is smaller than the"
+                               " remote read buffer\n");
                        CLAW_DBF_TEXT(2, setup, "wrtszbad");
                }
                if ((p_sysval->read_frame_size < p_env->read_size) &&
                    (p_env->packing == 0)) {
                        claw_snd_sys_validate_rsp(dev, p_ctlbk,
                                CLAW_RC_HOST_RCV_TOO_SMALL);
-                       printk(KERN_INFO "%s: host read size is too "
-                               "small\n", dev->name);
+                       dev_warn(tdev,
+                               "The local read buffer is smaller than the"
+                               " remote write buffer\n");
                        CLAW_DBF_TEXT(2, setup, "rdsizbad");
                }
                claw_snd_sys_validate_rsp(dev, p_ctlbk, 0);
-               printk(KERN_INFO "%s: CLAW device %.8s: System validate "
-                       "completed.\n", dev->name, temp_ws_name);
-               printk("%s: sys Validate Rsize:%d Wsize:%d\n", dev->name,
-                       p_sysval->read_frame_size, p_sysval->write_frame_size);
+               dev_info(tdev,
+                       "CLAW device %.8s: System validate"
+                       " completed.\n", temp_ws_name);
+               dev_info(tdev,
+                       "%s: sys Validate Rsize:%d Wsize:%d\n",
+                       dev->name, p_sysval->read_frame_size,
+                       p_sysval->write_frame_size);
                privptr->system_validate_comp = 1;
                if (strncmp(p_env->api_type, WS_APPL_NAME_PACKED, 6) == 0)
                        p_env->packing = PACKING_ASK;
@@ -2092,8 +2116,10 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                break;
        case SYSTEM_VALIDATE_RESPONSE:
                p_sysval = (struct sysval *)&(p_ctlbk->data);
-               printk("%s: Recv Sys Validate Resp: Vers=%d,Corr=%d,RC=%d,"
-                       "WS name=%.8s,Host name=%.8s\n",
+               dev_info(tdev,
+                       "Settings for %s validated (version=%d, "
+                       "remote device=%d, rc=%d, adapter name=%.8s, "
+                       "host name=%.8s)\n",
                        dev->name,
                        p_ctlbk->version,
                        p_ctlbk->correlator,
@@ -2102,41 +2128,39 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                        p_sysval->host_name);
                switch (p_ctlbk->rc) {
                case 0:
-                       printk(KERN_INFO "%s: CLAW device "
-                               "%.8s: System validate "
-                               "completed.\n",
-                              dev->name, temp_ws_name);
+                       dev_info(tdev, "%s: CLAW device "
+                               "%.8s: System validate completed.\n",
+                               dev->name, temp_ws_name);
                        if (privptr->system_validate_comp == 0)
                                claw_strt_conn_req(dev);
                        privptr->system_validate_comp = 1;
                        break;
                case CLAW_RC_NAME_MISMATCH:
-                       printk(KERN_INFO "%s: Sys Validate "
-                               "Resp : Host, WS name is "
-                               "mismatch\n",
-                              dev->name);
+                       dev_warn(tdev, "Validating %s failed because of"
+                               " a host or adapter name mismatch\n",
+                               dev->name);
                        break;
                case CLAW_RC_WRONG_VERSION:
-                       printk(KERN_INFO "%s: Sys Validate "
-                               "Resp : Wrong version\n",
+                       dev_warn(tdev, "Validating %s failed because of a"
+                               " version conflict\n",
                                dev->name);
                        break;
                case CLAW_RC_HOST_RCV_TOO_SMALL:
-                       printk(KERN_INFO "%s: Sys Validate "
-                               "Resp : bad frame size\n",
+                       dev_warn(tdev, "Validating %s failed because of a"
+                               " frame size conflict\n",
                                dev->name);
                        break;
                default:
-                       printk(KERN_INFO "%s: Sys Validate "
-                               "error code=%d \n",
-                                dev->name, p_ctlbk->rc);
+                       dev_warn(tdev, "The communication peer of %s rejected"
+                               " the connection\n",
+                                dev->name);
                        break;
                }
                break;
 
        case CONNECTION_REQUEST:
                p_connect = (struct conncmd *)&(p_ctlbk->data);
-               printk(KERN_INFO "%s: Recv Conn Req: Vers=%d,link_id=%d,"
+               dev_info(tdev, "%s: Recv Conn Req: Vers=%d,link_id=%d,"
                        "Corr=%d,HOST appl=%.8s,WS appl=%.8s\n",
                        dev->name,
                        p_ctlbk->version,
@@ -2146,21 +2170,21 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                        p_connect->WS_name);
                if (privptr->active_link_ID != 0) {
                        claw_snd_disc(dev, p_ctlbk);
-                       printk(KERN_INFO "%s: Conn Req error : "
-                               "already logical link is active \n",
+                       dev_info(tdev, "%s rejected a connection request"
+                               " because it is already active\n",
                                dev->name);
                }
                if (p_ctlbk->linkid != 1) {
                        claw_snd_disc(dev, p_ctlbk);
-                       printk(KERN_INFO "%s: Conn Req error : "
-                               "req logical link id is not 1\n",
+                       dev_info(tdev, "%s rejected a request to open multiple"
+                               " connections\n",
                                dev->name);
                }
                rc = find_link(dev, p_connect->host_name, p_connect->WS_name);
                if (rc != 0) {
                        claw_snd_disc(dev, p_ctlbk);
-                       printk(KERN_INFO "%s: Conn Resp error: "
-                               "req appl name does not match\n",
+                       dev_info(tdev, "%s rejected a connection request"
+                               " because of a type mismatch\n",
                                dev->name);
                }
                claw_send_control(dev,
@@ -2172,7 +2196,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                        p_env->packing = PACK_SEND;
                        claw_snd_conn_req(dev, 0);
                }
-               printk(KERN_INFO "%s: CLAW device %.8s: Connection "
+               dev_info(tdev, "%s: CLAW device %.8s: Connection "
                        "completed link_id=%d.\n",
                        dev->name, temp_ws_name,
                        p_ctlbk->linkid);
@@ -2182,7 +2206,7 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                break;
        case CONNECTION_RESPONSE:
                p_connect = (struct conncmd *)&(p_ctlbk->data);
-               printk(KERN_INFO "%s: Revc Conn Resp: Vers=%d,link_id=%d,"
+               dev_info(tdev, "%s: Recv Conn Resp: Vers=%d,link_id=%d,"
                        "Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n",
                        dev->name,
                        p_ctlbk->version,
@@ -2193,16 +2217,18 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                        p_connect->WS_name);
 
                if (p_ctlbk->rc != 0) {
-                       printk(KERN_INFO "%s: Conn Resp error: rc=%d \n",
-                               dev->name, p_ctlbk->rc);
+                       dev_warn(tdev, "The communication peer of %s rejected"
+                               " a connection request\n",
+                               dev->name);
                        return 1;
                }
                rc = find_link(dev,
                        p_connect->host_name, p_connect->WS_name);
                if (rc != 0) {
                        claw_snd_disc(dev, p_ctlbk);
-                       printk(KERN_INFO "%s: Conn Resp error: "
-                               "req appl name does not match\n",
+                       dev_warn(tdev, "The communication peer of %s"
+                               " rejected a connection "
+                               "request because of a type mismatch\n",
                                 dev->name);
                }
                /* should be until CONNECTION_CONFIRM */
@@ -2210,7 +2236,8 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                break;
        case CONNECTION_CONFIRM:
                p_connect = (struct conncmd *)&(p_ctlbk->data);
-               printk(KERN_INFO "%s: Recv Conn Confirm:Vers=%d,link_id=%d,"
+               dev_info(tdev,
+                       "%s: Recv Conn Confirm:Vers=%d,link_id=%d,"
                        "Corr=%d,Host appl=%.8s,WS appl=%.8s\n",
                        dev->name,
                        p_ctlbk->version,
@@ -2221,21 +2248,21 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                if (p_ctlbk->linkid == -(privptr->active_link_ID)) {
                        privptr->active_link_ID = p_ctlbk->linkid;
                        if (p_env->packing > PACKING_ASK) {
-                               printk(KERN_INFO "%s: Confirmed Now packing\n",
-                                       dev->name);
+                               dev_info(tdev,
+                               "%s: Confirmed Now packing\n", dev->name);
                                p_env->packing = DO_PACKED;
                        }
                        p_ch = &privptr->channel[WRITE];
                        wake_up(&p_ch->wait);
                } else {
-                      printk(KERN_INFO "%s: Conn confirm: "
-                               "unexpected linkid=%d \n",
+                       dev_warn(tdev, "Activating %s failed because of"
+                               " an incorrect link ID=%d\n",
                                dev->name, p_ctlbk->linkid);
                        claw_snd_disc(dev, p_ctlbk);
                }
                break;
        case DISCONNECT:
-               printk(KERN_INFO "%s: Disconnect: "
+               dev_info(tdev, "%s: Disconnect: "
                        "Vers=%d,link_id=%d,Corr=%d\n",
                        dev->name, p_ctlbk->version,
                        p_ctlbk->linkid, p_ctlbk->correlator);
@@ -2247,12 +2274,13 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw)
                        privptr->active_link_ID = 0;
                break;
        case CLAW_ERROR:
-               printk(KERN_INFO "%s: CLAW ERROR detected\n",
+               dev_warn(tdev, "The communication peer of %s failed\n",
                        dev->name);
                break;
        default:
-               printk(KERN_INFO "%s:  Unexpected command code=%d \n",
-                       dev->name,  p_ctlbk->command);
+               dev_warn(tdev, "The communication peer of %s sent"
+                       " an unknown command code\n",
+                       dev->name);
                break;
         }
 
@@ -2294,12 +2322,14 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link,
                         memcpy(&p_sysval->host_name, local_name, 8);
                         memcpy(&p_sysval->WS_name, remote_name, 8);
                        if (privptr->p_env->packing > 0) {
-                               p_sysval->read_frame_size=DEF_PACK_BUFSIZE;
-                               p_sysval->write_frame_size=DEF_PACK_BUFSIZE;
+                               p_sysval->read_frame_size = DEF_PACK_BUFSIZE;
+                               p_sysval->write_frame_size = DEF_PACK_BUFSIZE;
                        } else {
                                /* how big is the biggest group of packets */
-                               p_sysval->read_frame_size=privptr->p_env->read_size;
-                               p_sysval->write_frame_size=privptr->p_env->write_size;
+                          p_sysval->read_frame_size =
+                               privptr->p_env->read_size;
+                          p_sysval->write_frame_size =
+                               privptr->p_env->write_size;
                        }
                         memset(&p_sysval->reserved, 0x00, 4);
                         break;
@@ -2511,8 +2541,10 @@ unpack_read(struct net_device *dev )
                         mtc_this_frm=1;
                         if (p_this_ccw->header.length!=
                                privptr->p_env->read_size ) {
-                                printk(KERN_INFO " %s: Invalid frame detected "
-                                       "length is %02x\n" ,
+                               dev_warn(p_dev,
+                                       "The communication peer of %s"
+                                       " sent a faulty"
+                                       " frame of length %02x\n",
                                         dev->name, p_this_ccw->header.length);
                         }
                 }
@@ -2544,7 +2576,7 @@ unpack_next:
                                goto NextFrame;
                        p_packd = p_this_ccw->p_buffer+pack_off;
                        p_packh = (struct clawph *) p_packd;
-                       if ((p_packh->len == 0) || /* all done with this frame? */
+                       if ((p_packh->len == 0) || /* done with this frame? */
                            (p_packh->flag != 0))
                                goto NextFrame;
                        bytes_to_mov = p_packh->len;
@@ -2594,9 +2626,9 @@ unpack_next:
                                 netif_rx(skb);
                         }
                         else {
+                               dev_info(p_dev, "Allocating a buffer for"
+                                       " incoming data failed\n");
                                 privptr->stats.rx_dropped++;
-                                printk(KERN_WARNING "%s: %s() low on memory\n",
-                               dev->name,__func__);
                         }
                         privptr->mtc_offset=0;
                         privptr->mtc_logical_link=-1;
@@ -2720,8 +2752,8 @@ claw_strt_out_IO( struct net_device *dev )
         if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) {
                 parm = (unsigned long) p_ch;
                CLAW_DBF_TEXT(2, trace, "StWrtIO");
-                rc = ccw_device_start (p_ch->cdev,&p_first_ccw->write, parm,
-                                      0xff, 0);
+               rc = ccw_device_start(p_ch->cdev, &p_first_ccw->write, parm,
+                                     0xff, 0);
                 if (rc != 0) {
                         ccw_check_return_code(p_ch->cdev, rc);
                 }
@@ -2816,22 +2848,26 @@ claw_free_netdevice(struct net_device * dev, int free_dev)
  * Initialize everything of the net device except the name and the
  * channel structs.
  */
+static const struct net_device_ops claw_netdev_ops = {
+       .ndo_open               = claw_open,
+       .ndo_stop               = claw_release,
+       .ndo_get_stats          = claw_stats,
+       .ndo_start_xmit         = claw_tx,
+       .ndo_change_mtu         = claw_change_mtu,
+};
+
 static void
 claw_init_netdevice(struct net_device * dev)
 {
        CLAW_DBF_TEXT(2, setup, "init_dev");
        CLAW_DBF_TEXT_(2, setup, "%s", dev->name);
        dev->mtu = CLAW_DEFAULT_MTU_SIZE;
-       dev->hard_start_xmit = claw_tx;
-       dev->open = claw_open;
-       dev->stop = claw_release;
-       dev->get_stats = claw_stats;
-       dev->change_mtu = claw_change_mtu;
        dev->hard_header_len = 0;
        dev->addr_len = 0;
        dev->type = ARPHRD_SLIP;
        dev->tx_queue_len = 1300;
        dev->flags = IFF_POINTOPOINT | IFF_NOARP;
+       dev->netdev_ops = &claw_netdev_ops;
        CLAW_DBF_TEXT(2, setup, "initok");
        return;
 }
@@ -2880,8 +2916,8 @@ claw_new_device(struct ccwgroup_device *cgdev)
        int ret;
        struct ccw_dev_id dev_id;
 
-       printk(KERN_INFO "claw: add for %s\n",
-              dev_name(&cgdev->cdev[READ]->dev));
+       dev_info(&cgdev->dev, "add for %s\n",
+                dev_name(&cgdev->cdev[READ]->dev));
        CLAW_DBF_TEXT(2, setup, "new_dev");
        privptr = cgdev->dev.driver_data;
        cgdev->cdev[READ]->dev.driver_data = privptr;
@@ -2897,29 +2933,28 @@ claw_new_device(struct ccwgroup_device *cgdev)
        if (ret == 0)
                ret = add_channel(cgdev->cdev[1],1,privptr);
        if (ret != 0) {
-               printk(KERN_WARNING
-                       "add channel failed with ret = %d\n", ret);
+               dev_warn(&cgdev->dev, "Creating a CLAW group device"
+                       " failed with error code %d\n", ret);
                goto out;
        }
        ret = ccw_device_set_online(cgdev->cdev[READ]);
        if (ret != 0) {
-               printk(KERN_WARNING
-                       "claw: ccw_device_set_online %s READ failed "
-                      "with ret = %d\n", dev_name(&cgdev->cdev[READ]->dev),
-                      ret);
+               dev_warn(&cgdev->dev,
+                       "Setting the read subchannel online"
+                       " failed with error code %d\n", ret);
                goto out;
        }
        ret = ccw_device_set_online(cgdev->cdev[WRITE]);
        if (ret != 0) {
-               printk(KERN_WARNING
-                       "claw: ccw_device_set_online %s WRITE failed "
-                      "with ret = %d\n", dev_name(&cgdev->cdev[WRITE]->dev),
-                      ret);
+               dev_warn(&cgdev->dev,
+                       "Setting the write subchannel online "
+                       "failed with error code %d\n", ret);
                goto out;
        }
        dev = alloc_netdev(0,"claw%d",claw_init_netdevice);
        if (!dev) {
-               printk(KERN_WARNING "%s:alloc_netdev failed\n",__func__);
+               dev_warn(&cgdev->dev,
+                       "Activating the CLAW device failed\n");
                goto out;
        }
        dev->ml_priv = privptr;
@@ -2947,13 +2982,13 @@ claw_new_device(struct ccwgroup_device *cgdev)
        privptr->channel[WRITE].ndev = dev;
        privptr->p_env->ndev = dev;
 
-       printk(KERN_INFO "%s:readsize=%d  writesize=%d "
+       dev_info(&cgdev->dev, "%s:readsize=%d  writesize=%d "
                "readbuffer=%d writebuffer=%d read=0x%04x write=0x%04x\n",
                 dev->name, p_env->read_size,
                p_env->write_size, p_env->read_buffers,
                 p_env->write_buffers, p_env->devno[READ],
                p_env->devno[WRITE]);
-        printk(KERN_INFO "%s:host_name:%.8s, adapter_name "
+       dev_info(&cgdev->dev, "%s:host_name:%.8s, adapter_name "
                ":%.8s api_type: %.8s\n",
                 dev->name, p_env->host_name,
                p_env->adapter_name , p_env->api_type);
@@ -2997,8 +3032,8 @@ claw_shutdown_device(struct ccwgroup_device *cgdev)
        ndev = priv->channel[READ].ndev;
        if (ndev) {
                /* Close the device */
-               printk(KERN_INFO
-                       "%s: shuting down \n",ndev->name);
+               dev_info(&cgdev->dev, "%s: shutting down \n",
+                       ndev->name);
                if (ndev->flags & IFF_RUNNING)
                        ret = claw_release(ndev);
                ndev->flags &=~IFF_RUNNING;
@@ -3023,8 +3058,7 @@ claw_remove_device(struct ccwgroup_device *cgdev)
        CLAW_DBF_TEXT_(2, setup, "%s", dev_name(&cgdev->dev));
        priv = cgdev->dev.driver_data;
        BUG_ON(!priv);
-       printk(KERN_INFO "claw: %s() called %s will be removed.\n",
-                       __func__, dev_name(&cgdev->cdev[0]->dev));
+       dev_info(&cgdev->dev, " will be removed.\n");
        if (cgdev->state == CCWGROUP_ONLINE)
                claw_shutdown_device(cgdev);
        claw_remove_files(&cgdev->dev);
@@ -3063,7 +3097,8 @@ claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 
 static ssize_t
-claw_hname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_hname_write(struct device *dev, struct device_attribute *attr,
+        const char *buf, size_t count)
 {
        struct claw_privbk *priv;
        struct claw_env *  p_env;
@@ -3100,7 +3135,8 @@ claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 
 static ssize_t
-claw_adname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_adname_write(struct device *dev, struct device_attribute *attr,
+        const char *buf, size_t count)
 {
        struct claw_privbk *priv;
        struct claw_env *  p_env;
@@ -3138,7 +3174,8 @@ claw_apname_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 
 static ssize_t
-claw_apname_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_apname_write(struct device *dev, struct device_attribute *attr,
+       const char *buf, size_t count)
 {
        struct claw_privbk *priv;
        struct claw_env *  p_env;
@@ -3185,7 +3222,8 @@ claw_wbuff_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 
 static ssize_t
-claw_wbuff_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_wbuff_write(struct device *dev, struct device_attribute *attr,
+       const char *buf, size_t count)
 {
        struct claw_privbk *priv;
        struct claw_env *  p_env;
@@ -3226,7 +3264,8 @@ claw_rbuff_show(struct device *dev, struct device_attribute *attr, char *buf)
 }
 
 static ssize_t
-claw_rbuff_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
+claw_rbuff_write(struct device *dev, struct device_attribute *attr,
+       const char *buf, size_t count)
 {
        struct claw_privbk *priv;
        struct claw_env *p_env;
@@ -3289,7 +3328,7 @@ claw_cleanup(void)
 {
        unregister_cu3088_discipline(&claw_group_driver);
        claw_unregister_debug_facility();
-       printk(KERN_INFO "claw: Driver unloaded\n");
+       pr_info("Driver unloaded\n");
 
 }
 
@@ -3303,12 +3342,12 @@ static int __init
 claw_init(void)
 {
        int ret = 0;
-       printk(KERN_INFO "claw: starting driver\n");
 
+       pr_info("Loading %s\n", version);
        ret = claw_register_debug_facility();
        if (ret) {
-               printk(KERN_WARNING "claw: %s() debug_register failed %d\n",
-                       __func__,ret);
+               pr_err("Registering with the S/390 debug feature"
+                       " failed with error code %d\n", ret);
                return ret;
        }
        CLAW_DBF_TEXT(2, setup, "init_mod");
@@ -3316,8 +3355,8 @@ claw_init(void)
        if (ret) {
                CLAW_DBF_TEXT(2, setup, "init_bad");
                claw_unregister_debug_facility();
-               printk(KERN_WARNING "claw; %s() cu3088 register failed %d\n",
-                       __func__,ret);
+               pr_err("Registering with the cu3088 device driver failed "
+                          "with error code %d\n", ret);
        }
        return ret;
 }
index 2678573becec0f625cf58ea92ba904a1128a22d7..8f2a888d0a0ac7226ec61f06ac7da2893c1f876e 100644 (file)
@@ -1099,12 +1099,24 @@ static void ctcm_free_netdevice(struct net_device *dev)
 
 struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv);
 
+static const struct net_device_ops ctcm_netdev_ops = {
+       .ndo_open               = ctcm_open,
+       .ndo_stop               = ctcm_close,
+       .ndo_get_stats          = ctcm_stats,
+       .ndo_change_mtu         = ctcm_change_mtu,
+       .ndo_start_xmit         = ctcm_tx,
+};
+
+static const struct net_device_ops ctcm_mpc_netdev_ops = {
+       .ndo_open               = ctcm_open,
+       .ndo_stop               = ctcm_close,
+       .ndo_get_stats          = ctcm_stats,
+       .ndo_change_mtu         = ctcm_change_mtu,
+       .ndo_start_xmit         = ctcmpc_tx,
+};
+
 void static ctcm_dev_setup(struct net_device *dev)
 {
-       dev->open = ctcm_open;
-       dev->stop = ctcm_close;
-       dev->get_stats = ctcm_stats;
-       dev->change_mtu = ctcm_change_mtu;
        dev->type = ARPHRD_SLIP;
        dev->tx_queue_len = 100;
        dev->flags = IFF_POINTOPOINT | IFF_NOARP;
@@ -1157,12 +1169,12 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv)
                dev->mtu = MPC_BUFSIZE_DEFAULT -
                                TH_HEADER_LENGTH - PDU_HEADER_LENGTH;
 
-               dev->hard_start_xmit = ctcmpc_tx;
+               dev->netdev_ops = &ctcm_mpc_netdev_ops;
                dev->hard_header_len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH;
                priv->buffer_size = MPC_BUFSIZE_DEFAULT;
        } else {
                dev->mtu = CTCM_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
-               dev->hard_start_xmit = ctcm_tx;
+               dev->netdev_ops = &ctcm_netdev_ops;
                dev->hard_header_len = LL_HEADER_LENGTH + 2;
        }
 
index 49c3bfa1afd7c364eea57e017f0e35be84ccf8e7..083f787d260d6f51d2ab807f5a9b9f1fb5a003f0 100644 (file)
@@ -2101,6 +2101,20 @@ lcs_register_netdev(struct ccwgroup_device *ccwgdev)
 /**
  * lcs_new_device will be called by setting the group device online.
  */
+static const struct net_device_ops lcs_netdev_ops = {
+       .ndo_open               = lcs_open_device,
+       .ndo_stop               = lcs_stop_device,
+       .ndo_get_stats          = lcs_getstats,
+       .ndo_start_xmit         = lcs_start_xmit,
+};
+
+static const struct net_device_ops lcs_mc_netdev_ops = {
+       .ndo_open               = lcs_open_device,
+       .ndo_stop               = lcs_stop_device,
+       .ndo_get_stats          = lcs_getstats,
+       .ndo_start_xmit         = lcs_start_xmit,
+       .ndo_set_multicast_list = lcs_set_multicast_list,
+};
 
 static int
 lcs_new_device(struct ccwgroup_device *ccwgdev)
@@ -2168,14 +2182,11 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
                goto out;
        card->dev = dev;
        card->dev->ml_priv = card;
-       card->dev->open = lcs_open_device;
-       card->dev->stop = lcs_stop_device;
-       card->dev->hard_start_xmit = lcs_start_xmit;
-       card->dev->get_stats = lcs_getstats;
+       card->dev->netdev_ops = &lcs_netdev_ops;
        memcpy(card->dev->dev_addr, card->mac, LCS_MAC_LENGTH);
 #ifdef CONFIG_IP_MULTICAST
        if (!lcs_check_multicast_support(card))
-               card->dev->set_multicast_list = lcs_set_multicast_list;
+               card->dev->netdev_ops = &lcs_mc_netdev_ops;
 #endif
 netdev_out:
        lcs_set_allowed_threads(card,0xffffffff);
index 930e2fc2a011a39fea837fa8435d3b1622e31fac..1ba4509435f8fbfc2f021eea0575956ae1068906 100644 (file)
@@ -1876,20 +1876,24 @@ static void netiucv_free_netdevice(struct net_device *dev)
 /**
  * Initialize a net device. (Called from kernel in alloc_netdev())
  */
+static const struct net_device_ops netiucv_netdev_ops = {
+       .ndo_open               = netiucv_open,
+       .ndo_stop               = netiucv_close,
+       .ndo_get_stats          = netiucv_stats,
+       .ndo_start_xmit         = netiucv_tx,
+       .ndo_change_mtu         = netiucv_change_mtu,
+};
+
 static void netiucv_setup_netdevice(struct net_device *dev)
 {
        dev->mtu                 = NETIUCV_MTU_DEFAULT;
-       dev->hard_start_xmit     = netiucv_tx;
-       dev->open                = netiucv_open;
-       dev->stop                = netiucv_close;
-       dev->get_stats           = netiucv_stats;
-       dev->change_mtu          = netiucv_change_mtu;
        dev->destructor          = netiucv_free_netdevice;
        dev->hard_header_len     = NETIUCV_HDRLEN;
        dev->addr_len            = 0;
        dev->type                = ARPHRD_SLIP;
        dev->tx_queue_len        = NETIUCV_QUEUELEN_DEFAULT;
        dev->flags               = IFF_POINTOPOINT | IFF_NOARP;
+       dev->netdev_ops          = &netiucv_netdev_ops;
 }
 
 /**
index 5c7c4d95c493c044141a38281e3a06b98f09464f..f675807cc48f1391413023eedd707727fbe64cea 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef __CXGB3I_ULP2_DDP_H__
 #define __CXGB3I_ULP2_DDP_H__
 
+#include <linux/vmalloc.h>
+
 /**
  * struct cxgb3i_tag_format - cxgb3i ulp tag format for an iscsi entity
  *
index a1a511bdec8cb87961023da3bbf487de6d9a580e..ed1e728763a2192c14acfe1322ef227ddc01f129 100644 (file)
@@ -1573,9 +1573,6 @@ static int ibmvfc_queuecommand(struct scsi_cmnd *cmnd,
        vfc_cmd->resp_len = sizeof(vfc_cmd->rsp);
        vfc_cmd->cancel_key = (unsigned long)cmnd->device->hostdata;
        vfc_cmd->tgt_scsi_id = rport->port_id;
-       if ((rport->supported_classes & FC_COS_CLASS3) &&
-           (fc_host_supported_classes(vhost->host) & FC_COS_CLASS3))
-               vfc_cmd->flags = IBMVFC_CLASS_3_ERR;
        vfc_cmd->iu.xfer_len = scsi_bufflen(cmnd);
        int_to_scsilun(cmnd->device->lun, &vfc_cmd->iu.lun);
        memcpy(vfc_cmd->iu.cdb, cmnd->cmnd, cmnd->cmd_len);
@@ -3266,6 +3263,7 @@ static int ibmvfc_alloc_target(struct ibmvfc_host *vhost, u64 scsi_id)
                return -ENOMEM;
        }
 
+       memset(tgt, 0, sizeof(*tgt));
        tgt->scsi_id = scsi_id;
        tgt->new_scsi_id = scsi_id;
        tgt->vhost = vhost;
@@ -3576,9 +3574,18 @@ static void ibmvfc_log_ae(struct ibmvfc_host *vhost, int events)
 static void ibmvfc_tgt_add_rport(struct ibmvfc_target *tgt)
 {
        struct ibmvfc_host *vhost = tgt->vhost;
-       struct fc_rport *rport;
+       struct fc_rport *rport = tgt->rport;
        unsigned long flags;
 
+       if (rport) {
+               tgt_dbg(tgt, "Setting rport roles\n");
+               fc_remote_port_rolechg(rport, tgt->ids.roles);
+               spin_lock_irqsave(vhost->host->host_lock, flags);
+               ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_NONE);
+               spin_unlock_irqrestore(vhost->host->host_lock, flags);
+               return;
+       }
+
        tgt_dbg(tgt, "Adding rport\n");
        rport = fc_remote_port_add(vhost->host, 0, &tgt->ids);
        spin_lock_irqsave(vhost->host->host_lock, flags);
index 87dafd0f8d4416b48e27bf08b3673d391a670abe..b21e071b986214875074ea35748e775a4ec51469 100644 (file)
@@ -32,7 +32,7 @@
 #define IBMVFC_DRIVER_VERSION          "1.0.4"
 #define IBMVFC_DRIVER_DATE             "(November 14, 2008)"
 
-#define IBMVFC_DEFAULT_TIMEOUT 15
+#define IBMVFC_DEFAULT_TIMEOUT 60
 #define IBMVFC_INIT_TIMEOUT            120
 #define IBMVFC_MAX_REQUESTS_DEFAULT    100
 
index 74d07d137daeb75b038071f6fe9a279b927243e1..c9aa7611e40824142534d21aa46fc4461936ba33 100644 (file)
@@ -432,6 +432,7 @@ static int map_sg_data(struct scsi_cmnd *cmd,
                                sdev_printk(KERN_ERR, cmd->device,
                                            "Can't allocate memory "
                                            "for indirect table\n");
+                       scsi_dma_unmap(cmd);
                        return 0;
                }
        }
index 257c24115de9108132d955ab5e488cf0b6c37c3e..809d32d95c76e6457a33469c8a43bf7246ef44e0 100644 (file)
@@ -1998,6 +1998,8 @@ int iscsi_host_add(struct Scsi_Host *shost, struct device *pdev)
        if (!shost->can_queue)
                shost->can_queue = ISCSI_DEF_XMIT_CMDS_MAX;
 
+       if (!shost->transportt->eh_timed_out)
+               shost->transportt->eh_timed_out = iscsi_eh_cmd_timed_out;
        return scsi_add_host(shost, pdev);
 }
 EXPORT_SYMBOL_GPL(iscsi_host_add);
@@ -2020,7 +2022,6 @@ struct Scsi_Host *iscsi_host_alloc(struct scsi_host_template *sht,
        shost = scsi_host_alloc(sht, sizeof(struct iscsi_host) + dd_data_size);
        if (!shost)
                return NULL;
-       shost->transportt->eh_timed_out = iscsi_eh_cmd_timed_out;
 
        if (qdepth > ISCSI_MAX_CMD_PER_LUN || qdepth < 1) {
                if (qdepth != 0)
index a8f30bdaff69a2e1203297a5bbbb7caa823cf550..a7302480bc4a7fb3605f6317631de89e5a9303d4 100644 (file)
@@ -5258,6 +5258,7 @@ lpfc_send_els_event(struct lpfc_vport *vport,
                        sizeof(struct lpfc_name));
                break;
        default:
+               kfree(els_data);
                return;
        }
        memcpy(els_data->wwpn, &ndlp->nlp_portname, sizeof(struct lpfc_name));
index 33a3c13fd8936b717fb3cec81258a76e88478094..f4c57227ec185cf2a6357ebc24bccf674e7e36cf 100644 (file)
@@ -1265,13 +1265,6 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
            test_bit(FCPORT_UPDATE_NEEDED, &vha->dpc_flags))
                msleep(1000);
 
-       if (ha->mqenable) {
-               if (qla25xx_delete_queues(vha, 0) != QLA_SUCCESS)
-                       qla_printk(KERN_WARNING, ha,
-                               "Queue delete failed.\n");
-               vha->req_ques[0] = ha->req_q_map[0]->id;
-       }
-
        qla24xx_disable_vp(vha);
 
        fc_remove_host(vha->host);
@@ -1293,6 +1286,12 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
                    vha->host_no, vha->vp_idx, vha));
         }
 
+       if (ha->mqenable) {
+               if (qla25xx_delete_queues(vha, 0) != QLA_SUCCESS)
+                       qla_printk(KERN_WARNING, ha,
+                               "Queue delete failed.\n");
+       }
+
        scsi_host_put(vha->host);
        qla_printk(KERN_INFO, ha, "vport %d deleted\n", id);
        return 0;
index 023ee77fb027beddfacc5005d2372f0f3a3d584e..e0c5bb54b258a492e9ceb641cada66b07d4785f8 100644 (file)
@@ -2135,6 +2135,7 @@ struct qla_msix_entry {
 /* Work events.  */
 enum qla_work_type {
        QLA_EVT_AEN,
+       QLA_EVT_IDC_ACK,
 };
 
 
@@ -2149,6 +2150,10 @@ struct qla_work_evt {
                        enum fc_host_event_code code;
                        u32 data;
                } aen;
+               struct {
+#define QLA_IDC_ACK_REGS       7
+                       uint16_t mb[QLA_IDC_ACK_REGS];
+               } idc_ack;
        } u;
 };
 
index d78d35e681ab3413f5b3835d1671709ca76e8753..d6ea69df7c5cf584ae21ab4c210c05a0873f1422 100644 (file)
@@ -72,7 +72,7 @@ static char *qla2x00_model_name[QLA_MODEL_NAMES*2] = {
        "QLA2462",      "Sun PCI-X 2.0 to 4Gb FC, Dual Channel",        /* 0x141 */
        "QLE2460",      "Sun PCI-Express to 2Gb FC, Single Channel",    /* 0x142 */
        "QLE2462",      "Sun PCI-Express to 4Gb FC, Single Channel",    /* 0x143 */
-       "QEM2462"       "Server I/O Module 4Gb FC, Dual Channel",       /* 0x144 */
+       "QEM2462",      "Server I/O Module 4Gb FC, Dual Channel",       /* 0x144 */
        "QLE2440",      "PCI-Express to 4Gb FC, Single Channel",        /* 0x145 */
        "QLE2464",      "PCI-Express to 4Gb FC, Quad Channel",          /* 0x146 */
        "QLA2440",      "PCI-X 2.0 to 4Gb FC, Single Channel",          /* 0x147 */
index 7abb045a0410e4eed6624af160188bff170ec797..ffff4255408784ffe24c1a2753a9654950e5ca6d 100644 (file)
@@ -1402,6 +1402,8 @@ struct access_chip_rsp_84xx {
 #define MBA_IDC_NOTIFY         0x8101
 #define MBA_IDC_TIME_EXT       0x8102
 
+#define MBC_IDC_ACK            0x101
+
 struct nvram_81xx {
        /* NVRAM header. */
        uint8_t id[4];
index a336b4bc81a7e50b5d1407ba249c0c5944615a6f..6de283f8f111d0a2a30056594e02b6e410add6f1 100644 (file)
@@ -72,6 +72,7 @@ extern int qla2x00_loop_reset(scsi_qla_host_t *);
 extern void qla2x00_abort_all_cmds(scsi_qla_host_t *, int);
 extern int qla2x00_post_aen_work(struct scsi_qla_host *, enum
     fc_host_event_code, u32);
+extern int qla2x00_post_idc_ack_work(struct scsi_qla_host *, uint16_t *);
 
 extern void qla2x00_abort_fcport_cmds(fc_port_t *);
 extern struct scsi_qla_host *qla2x00_create_host(struct scsi_host_template *,
@@ -266,6 +267,8 @@ qla2x00_set_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t *);
 
 extern int qla84xx_verify_chip(struct scsi_qla_host *, uint16_t *);
 
+extern int qla81xx_idc_ack(scsi_qla_host_t *, uint16_t *);
+
 /*
  * Global Function Prototypes in qla_isr.c source file.
  */
@@ -376,10 +379,8 @@ extern int qla2x00_dfs_remove(scsi_qla_host_t *);
 
 /* Globa function prototypes for multi-q */
 extern int qla25xx_request_irq(struct rsp_que *);
-extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *,
-       uint8_t);
-extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *,
-       uint8_t);
+extern int qla25xx_init_req_que(struct scsi_qla_host *, struct req_que *);
+extern int qla25xx_init_rsp_que(struct scsi_qla_host *, struct rsp_que *);
 extern int qla25xx_create_req_que(struct qla_hw_data *, uint16_t, uint8_t,
        uint16_t, uint8_t, uint8_t);
 extern int qla25xx_create_rsp_que(struct qla_hw_data *, uint16_t, uint8_t,
index f6368a1d3021e1e4e2f2c569d5742683cab61d47..986501759ad4910fa6b93c7db75d355001c47ad8 100644 (file)
@@ -1226,9 +1226,8 @@ qla24xx_config_rings(struct scsi_qla_host *vha)
                        icb->firmware_options_2 |=
                                __constant_cpu_to_le32(BIT_18);
 
-               icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_22);
+               icb->firmware_options_2 &= __constant_cpu_to_le32(~BIT_22);
                icb->firmware_options_2 |= __constant_cpu_to_le32(BIT_23);
-               ha->rsp_q_map[0]->options = icb->firmware_options_2;
 
                WRT_REG_DWORD(&reg->isp25mq.req_q_in, 0);
                WRT_REG_DWORD(&reg->isp25mq.req_q_out, 0);
@@ -3493,7 +3492,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
                rsp = ha->rsp_q_map[i];
                if (rsp) {
                        rsp->options &= ~BIT_0;
-                       ret = qla25xx_init_rsp_que(base_vha, rsp, rsp->options);
+                       ret = qla25xx_init_rsp_que(base_vha, rsp);
                        if (ret != QLA_SUCCESS)
                                DEBUG2_17(printk(KERN_WARNING
                                        "%s Rsp que:%d init failed\n", __func__,
@@ -3507,7 +3506,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
                if (req) {
                /* Clear outstanding commands array. */
                        req->options &= ~BIT_0;
-                       ret = qla25xx_init_req_que(base_vha, req, req->options);
+                       ret = qla25xx_init_req_que(base_vha, req);
                        if (ret != QLA_SUCCESS)
                                DEBUG2_17(printk(KERN_WARNING
                                        "%s Req que:%d init failed\n", __func__,
index e28ad81baf1e09d84edcbfef99e1ce945c2264b3..f250e5b7897cf7387f14579d50dd9462c2b0dc28 100644 (file)
@@ -266,6 +266,40 @@ qla2x00_mbx_completion(scsi_qla_host_t *vha, uint16_t mb0)
        }
 }
 
+static void
+qla81xx_idc_event(scsi_qla_host_t *vha, uint16_t aen, uint16_t descr)
+{
+       static char *event[] =
+               { "Complete", "Request Notification", "Time Extension" };
+       int rval;
+       struct device_reg_24xx __iomem *reg24 = &vha->hw->iobase->isp24;
+       uint16_t __iomem *wptr;
+       uint16_t cnt, timeout, mb[QLA_IDC_ACK_REGS];
+
+       /* Seed data -- mailbox1 -> mailbox7. */
+       wptr = (uint16_t __iomem *)&reg24->mailbox1;
+       for (cnt = 0; cnt < QLA_IDC_ACK_REGS; cnt++, wptr++)
+               mb[cnt] = RD_REG_WORD(wptr);
+
+       DEBUG2(printk("scsi(%ld): Inter-Driver Commucation %s -- "
+           "%04x %04x %04x %04x %04x %04x %04x.\n", vha->host_no,
+           event[aen & 0xff],
+           mb[0], mb[1], mb[2], mb[3], mb[4], mb[5], mb[6]));
+
+       /* Acknowledgement needed? [Notify && non-zero timeout]. */
+       timeout = (descr >> 8) & 0xf;
+       if (aen != MBA_IDC_NOTIFY || !timeout)
+               return;
+
+       DEBUG2(printk("scsi(%ld): Inter-Driver Commucation %s -- "
+           "ACK timeout=%d.\n", vha->host_no, event[aen & 0xff], timeout));
+
+       rval = qla2x00_post_idc_ack_work(vha, mb);
+       if (rval != QLA_SUCCESS)
+               qla_printk(KERN_WARNING, vha->hw,
+                   "IDC failed to post ACK.\n");
+}
+
 /**
  * qla2x00_async_event() - Process aynchronous events.
  * @ha: SCSI driver HA context
@@ -714,21 +748,9 @@ skip_rio:
                    "%04x %04x %04x\n", vha->host_no, mb[1], mb[2], mb[3]));
                break;
        case MBA_IDC_COMPLETE:
-               DEBUG2(printk("scsi(%ld): Inter-Driver Commucation "
-                   "Complete -- %04x %04x %04x\n", vha->host_no, mb[1], mb[2],
-                   mb[3]));
-               break;
        case MBA_IDC_NOTIFY:
-               DEBUG2(printk("scsi(%ld): Inter-Driver Commucation "
-                   "Request Notification -- %04x %04x %04x\n", vha->host_no,
-                   mb[1], mb[2], mb[3]));
-               /**** Mailbox registers 4 - 7 valid!!! */
-               break;
        case MBA_IDC_TIME_EXT:
-               DEBUG2(printk("scsi(%ld): Inter-Driver Commucation "
-                   "Time Extension -- %04x %04x %04x\n", vha->host_no, mb[1],
-                   mb[2], mb[3]));
-               /**** Mailbox registers 4 - 7 valid!!! */
+               qla81xx_idc_event(vha, mb[0], mb[1]);
                break;
        }
 
@@ -1707,7 +1729,6 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
        struct qla_hw_data *ha;
        struct rsp_que *rsp;
        struct device_reg_24xx __iomem *reg;
-       uint16_t msix_disabled_hccr = 0;
 
        rsp = (struct rsp_que *) dev_id;
        if (!rsp) {
@@ -1720,17 +1741,8 @@ qla25xx_msix_rsp_q(int irq, void *dev_id)
 
        spin_lock_irq(&ha->hardware_lock);
 
-       msix_disabled_hccr = rsp->options;
-       if (!rsp->id)
-               msix_disabled_hccr &= __constant_cpu_to_le32(BIT_22);
-       else
-               msix_disabled_hccr &= __constant_cpu_to_le32(BIT_6);
-
        qla24xx_process_response_queue(rsp);
 
-       if (!msix_disabled_hccr)
-               WRT_REG_DWORD(&reg->hccr, HCCRX_CLR_RISC_INT);
-
        spin_unlock_irq(&ha->hardware_lock);
 
        return IRQ_HANDLED;
index f94ffbb98e95f2a53918888ed76ebf235b3aa5cc..4c7504cb3990490830e89c85edeea9df7bf004db 100644 (file)
@@ -3090,8 +3090,7 @@ verify_done:
 }
 
 int
-qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req,
-       uint8_t options)
+qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req)
 {
        int rval;
        unsigned long flags;
@@ -3101,7 +3100,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req,
        struct qla_hw_data *ha = vha->hw;
 
        mcp->mb[0] = MBC_INITIALIZE_MULTIQ;
-       mcp->mb[1] = options;
+       mcp->mb[1] = req->options;
        mcp->mb[2] = MSW(LSD(req->dma));
        mcp->mb[3] = LSW(LSD(req->dma));
        mcp->mb[6] = MSW(MSD(req->dma));
@@ -3128,7 +3127,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req,
        mcp->tov = 60;
 
        spin_lock_irqsave(&ha->hardware_lock, flags);
-       if (!(options & BIT_0)) {
+       if (!(req->options & BIT_0)) {
                WRT_REG_DWORD(&reg->req_q_in, 0);
                WRT_REG_DWORD(&reg->req_q_out, 0);
        }
@@ -3142,8 +3141,7 @@ qla25xx_init_req_que(struct scsi_qla_host *vha, struct req_que *req,
 }
 
 int
-qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp,
-       uint8_t options)
+qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
 {
        int rval;
        unsigned long flags;
@@ -3153,7 +3151,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp,
        struct qla_hw_data *ha = vha->hw;
 
        mcp->mb[0] = MBC_INITIALIZE_MULTIQ;
-       mcp->mb[1] = options;
+       mcp->mb[1] = rsp->options;
        mcp->mb[2] = MSW(LSD(rsp->dma));
        mcp->mb[3] = LSW(LSD(rsp->dma));
        mcp->mb[6] = MSW(MSD(rsp->dma));
@@ -3178,7 +3176,7 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp,
        mcp->tov = 60;
 
        spin_lock_irqsave(&ha->hardware_lock, flags);
-       if (!(options & BIT_0)) {
+       if (!(rsp->options & BIT_0)) {
                WRT_REG_DWORD(&reg->rsp_q_out, 0);
                WRT_REG_DWORD(&reg->rsp_q_in, 0);
        }
@@ -3193,3 +3191,29 @@ qla25xx_init_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp,
        return rval;
 }
 
+int
+qla81xx_idc_ack(scsi_qla_host_t *vha, uint16_t *mb)
+{
+       int rval;
+       mbx_cmd_t mc;
+       mbx_cmd_t *mcp = &mc;
+
+       DEBUG11(printk("%s(%ld): entered.\n", __func__, vha->host_no));
+
+       mcp->mb[0] = MBC_IDC_ACK;
+       memcpy(&mcp->mb[1], mb, QLA_IDC_ACK_REGS * sizeof(uint16_t));
+       mcp->out_mb = MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2|MBX_1|MBX_0;
+       mcp->in_mb = MBX_0;
+       mcp->tov = MBX_TOV_SECONDS;
+       mcp->flags = 0;
+       rval = qla2x00_mailbox_command(vha, mcp);
+
+       if (rval != QLA_SUCCESS) {
+               DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__,
+                   vha->host_no, rval, mcp->mb[0]));
+       } else {
+               DEBUG11(printk("%s(%ld): done.\n", __func__, vha->host_no));
+       }
+
+       return rval;
+}
index f53179c46423adb449c2480aa205bcd2b868c17a..3f23932210c4231a38c7c8ccd9ccd77a85951e91 100644 (file)
@@ -396,7 +396,7 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
 
        qla2x00_start_timer(vha, qla2x00_timer, WATCH_INTERVAL);
 
-       memset(vha->req_ques, 0, sizeof(vha->req_ques) * QLA_MAX_HOST_QUES);
+       memset(vha->req_ques, 0, sizeof(vha->req_ques));
        vha->req_ques[0] = ha->req_q_map[0]->id;
        host->can_queue = ha->req_q_map[0]->length + 128;
        host->this_id = 255;
@@ -471,7 +471,7 @@ qla25xx_delete_req_que(struct scsi_qla_host *vha, struct req_que *req)
 
        if (req) {
                req->options |= BIT_0;
-               ret = qla25xx_init_req_que(vha, req, req->options);
+               ret = qla25xx_init_req_que(vha, req);
        }
        if (ret == QLA_SUCCESS)
                qla25xx_free_req_que(vha, req);
@@ -486,7 +486,7 @@ qla25xx_delete_rsp_que(struct scsi_qla_host *vha, struct rsp_que *rsp)
 
        if (rsp) {
                rsp->options |= BIT_0;
-               ret = qla25xx_init_rsp_que(vha, rsp, rsp->options);
+               ret = qla25xx_init_rsp_que(vha, rsp);
        }
        if (ret == QLA_SUCCESS)
                qla25xx_free_rsp_que(vha, rsp);
@@ -502,7 +502,7 @@ int qla25xx_update_req_que(struct scsi_qla_host *vha, uint8_t que, uint8_t qos)
 
        req->options |= BIT_3;
        req->qos = qos;
-       ret = qla25xx_init_req_que(vha, req, req->options);
+       ret = qla25xx_init_req_que(vha, req);
        if (ret != QLA_SUCCESS)
                DEBUG2_17(printk(KERN_WARNING "%s failed\n", __func__));
        /* restore options bit */
@@ -632,7 +632,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
        req->max_q_depth = ha->req_q_map[0]->max_q_depth;
        mutex_unlock(&ha->vport_lock);
 
-       ret = qla25xx_init_req_que(base_vha, req, options);
+       ret = qla25xx_init_req_que(base_vha, req);
        if (ret != QLA_SUCCESS) {
                qla_printk(KERN_WARNING, ha, "%s failed\n", __func__);
                mutex_lock(&ha->vport_lock);
@@ -710,7 +710,7 @@ qla25xx_create_rsp_que(struct qla_hw_data *ha, uint16_t options,
        if (ret)
                goto que_failed;
 
-       ret = qla25xx_init_rsp_que(base_vha, rsp, options);
+       ret = qla25xx_init_rsp_que(base_vha, rsp);
        if (ret != QLA_SUCCESS) {
                qla_printk(KERN_WARNING, ha, "%s failed\n", __func__);
                mutex_lock(&ha->vport_lock);
index c11f872d3e105776f76b9fe566f24289bb87d331..2f5f72531e23108acde73b9174d22af9e584e83c 100644 (file)
@@ -2522,6 +2522,19 @@ qla2x00_post_aen_work(struct scsi_qla_host *vha, enum fc_host_event_code code,
        return qla2x00_post_work(vha, e, 1);
 }
 
+int
+qla2x00_post_idc_ack_work(struct scsi_qla_host *vha, uint16_t *mb)
+{
+       struct qla_work_evt *e;
+
+       e = qla2x00_alloc_work(vha, QLA_EVT_IDC_ACK, 1);
+       if (!e)
+               return QLA_FUNCTION_FAILED;
+
+       memcpy(e->u.idc_ack.mb, mb, QLA_IDC_ACK_REGS * sizeof(uint16_t));
+       return qla2x00_post_work(vha, e, 1);
+}
+
 static void
 qla2x00_do_work(struct scsi_qla_host *vha)
 {
@@ -2539,6 +2552,9 @@ qla2x00_do_work(struct scsi_qla_host *vha)
                        fc_host_post_event(vha->host, fc_get_event_number(),
                            e->u.aen.code, e->u.aen.data);
                        break;
+               case QLA_EVT_IDC_ACK:
+                       qla81xx_idc_ack(vha, e->u.idc_ack.mb);
+                       break;
                }
                if (e->flags & QLA_EVT_FLAG_FREE)
                        kfree(e);
index 9c3b694c049dad0695a4d99d59de28d3a57493ce..284827926effc096155dd3e755a2348fb03631d6 100644 (file)
@@ -684,7 +684,7 @@ qla2xxx_get_flt_info(scsi_qla_host_t *vha, uint32_t flt_addr)
                    "end=0x%x size=0x%x.\n", le32_to_cpu(region->code), start,
                    le32_to_cpu(region->end) >> 2, le32_to_cpu(region->size)));
 
-               switch (le32_to_cpu(region->code)) {
+               switch (le32_to_cpu(region->code) & 0xff) {
                case FLT_REG_FW:
                        ha->flt_region_fw = start;
                        break;
index cfa4c11a4797abf8a8a2e9b7ee1669ca6d3705ac..79f7053da99b47bec9478f5454d01dcf20685403 100644 (file)
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "8.03.00-k2"
+#define QLA2XXX_VERSION      "8.03.00-k3"
 
 #define QLA_DRIVER_MAJOR_VER   8
 #define QLA_DRIVER_MINOR_VER   3
index 66505bb794100320f03aa43344be94284c22dcfd..8f4de20c9deb061266b41f18866931523e93241a 100644 (file)
@@ -317,6 +317,7 @@ static struct scsi_device *scsi_alloc_sdev(struct scsi_target *starget,
        return sdev;
 
 out_device_destroy:
+       scsi_device_set_state(sdev, SDEV_DEL);
        transport_destroy_device(&sdev->sdev_gendev);
        put_device(&sdev->sdev_gendev);
 out:
index 5f77417ed5859117019fac4278e8e1fc1e8f12b6..3ee4eb40abcfa1c33a6f5a17e349182e63bf0a3b 100644 (file)
@@ -533,12 +533,8 @@ fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
        event->event_code = event_code;
        event->event_data = event_data;
 
-       err = nlmsg_multicast(scsi_nl_sock, skb, 0, SCSI_NL_GRP_FC_EVENTS,
-                             GFP_KERNEL);
-       if (err && (err != -ESRCH))     /* filter no recipient errors */
-               /* nlmsg_multicast already kfree_skb'd */
-               goto send_fail;
-
+       nlmsg_multicast(scsi_nl_sock, skb, 0, SCSI_NL_GRP_FC_EVENTS,
+                       GFP_KERNEL);
        return;
 
 send_fail_skb:
@@ -607,12 +603,8 @@ fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
        event->event_code = FCH_EVT_VENDOR_UNIQUE;
        memcpy(&event->event_data, data_buf, data_len);
 
-       err = nlmsg_multicast(scsi_nl_sock, skb, 0, SCSI_NL_GRP_FC_EVENTS,
-                             GFP_KERNEL);
-       if (err && (err != -ESRCH))     /* filter no recipient errors */
-               /* nlmsg_multicast already kfree_skb'd */
-               goto send_vendor_fail;
-
+       nlmsg_multicast(scsi_nl_sock, skb, 0, SCSI_NL_GRP_FC_EVENTS,
+                       GFP_KERNEL);
        return;
 
 send_vendor_fail_skb:
index 75c9297694cbf7e8b262095bbe41a25263935bf3..2adfab8c11c1bd541e840094aa6730823a5d18b5 100644 (file)
@@ -966,15 +966,7 @@ iscsi_if_transport_lookup(struct iscsi_transport *tt)
 static int
 iscsi_broadcast_skb(struct sk_buff *skb, gfp_t gfp)
 {
-       int rc;
-
-       rc = netlink_broadcast(nls, skb, 0, 1, gfp);
-       if (rc < 0) {
-               printk(KERN_ERR "iscsi: can not broadcast skb (%d)\n", rc);
-               return rc;
-       }
-
-       return 0;
+       return netlink_broadcast(nls, skb, 0, 1, gfp);
 }
 
 static int
@@ -1207,7 +1199,7 @@ int iscsi_session_event(struct iscsi_cls_session *session,
         * the user and when the daemon is restarted it will handle it
         */
        rc = iscsi_broadcast_skb(skb, GFP_KERNEL);
-       if (rc < 0)
+       if (rc == -ESRCH)
                iscsi_cls_session_printk(KERN_ERR, session,
                                         "Cannot notify userspace of session "
                                         "event %u. Check iscsi daemon\n",
index 8f0bd3f7a59fdbc9b8c50ab69904d388b4ce24c5..516925d8b570c3fab05d5d1b0a6b729e0ebce395 100644 (file)
@@ -1078,7 +1078,7 @@ sg_ioctl(struct inode *inode, struct file *filp,
        case BLKTRACESETUP:
                return blk_trace_setup(sdp->device->request_queue,
                                       sdp->disk->disk_name,
-                                      sdp->device->sdev_gendev.devt,
+                                      MKDEV(SCSI_GENERIC_MAJOR, sdp->index),
                                       (char *)arg);
        case BLKTRACESTART:
                return blk_trace_startstop(sdp->device->request_queue, 1);
index 0d934bfbdd9b2ded293260968927a7de5e776f88..b4b39811b44544cc76a4c71e00c5c02567a765c2 100644 (file)
@@ -2083,6 +2083,20 @@ static int serial8250_startup(struct uart_port *port)
 
        serial8250_set_mctrl(&up->port, up->port.mctrl);
 
+       /* Serial over Lan (SoL) hack:
+          Intel 8257x Gigabit ethernet chips have a
+          16550 emulation, to be used for Serial Over Lan.
+          Those chips take a longer time than a normal
+          serial device to signalize that a transmission
+          data was queued. Due to that, the above test generally
+          fails. One solution would be to delay the reading of
+          iir. However, this is not reliable, since the timeout
+          is variable. So, let's just don't test if we receive
+          TX irq. This way, we'll never enable UART_BUG_TXEN.
+        */
+       if (up->port.flags & UPF_NO_TXEN_TEST)
+               goto dont_test_tx_en;
+
        /*
         * Do a quick test to see if we receive an
         * interrupt when we enable the TX irq.
@@ -2102,6 +2116,7 @@ static int serial8250_startup(struct uart_port *port)
                up->bugs &= ~UART_BUG_TXEN;
        }
 
+dont_test_tx_en:
        spin_unlock_irqrestore(&up->port.lock, flags);
 
        /*
index 536d8e510f66da655b9106ac7eb2e0719edce2b3..533f82025adf218e6fffbfd1730f94839924be21 100644 (file)
@@ -798,6 +798,21 @@ pci_default_setup(struct serial_private *priv,
        return setup_port(priv, port, bar, offset, board->reg_shift);
 }
 
+static int skip_tx_en_setup(struct serial_private *priv,
+                       const struct pciserial_board *board,
+                       struct uart_port *port, int idx)
+{
+       port->flags |= UPF_NO_TXEN_TEST;
+       printk(KERN_DEBUG "serial8250: skipping TxEn test for device "
+                         "[%04x:%04x] subsystem [%04x:%04x]\n",
+                         priv->dev->vendor,
+                         priv->dev->device,
+                         priv->dev->subsystem_vendor,
+                         priv->dev->subsystem_device);
+
+       return pci_default_setup(priv, board, port, idx);
+}
+
 /* This should be in linux/pci_ids.h */
 #define PCI_VENDOR_ID_SBSMODULARIO     0x124B
 #define PCI_SUBVENDOR_ID_SBSMODULARIO  0x124B
@@ -864,6 +879,27 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
                .init           = pci_inteli960ni_init,
                .setup          = pci_default_setup,
        },
+       {
+               .vendor         = PCI_VENDOR_ID_INTEL,
+               .device         = PCI_DEVICE_ID_INTEL_8257X_SOL,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = skip_tx_en_setup,
+       },
+       {
+               .vendor         = PCI_VENDOR_ID_INTEL,
+               .device         = PCI_DEVICE_ID_INTEL_82573L_SOL,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = skip_tx_en_setup,
+       },
+       {
+               .vendor         = PCI_VENDOR_ID_INTEL,
+               .device         = PCI_DEVICE_ID_INTEL_82573E_SOL,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .setup          = skip_tx_en_setup,
+       },
        /*
         * ITE
         */
index 89362d733d6230331c6bead3c8bbce3ef9d28563..8f58f7ff0dd7db29af5c749dbeda386b8c6c10b9 100644 (file)
@@ -877,6 +877,10 @@ static int atmel_startup(struct uart_port *port)
                }
        }
 
+       /* Save current CSR for comparison in atmel_tasklet_func() */
+       atmel_port->irq_status_prev = UART_GET_CSR(port);
+       atmel_port->irq_status = atmel_port->irq_status_prev;
+
        /*
         * Finally, enable the serial port
         */
index 92187e28608aeb6cb03c0a090a38db5d186bd090..ac79cbe4c2cf40e2e5512a4607d517c120784757 100644 (file)
@@ -84,6 +84,8 @@ static int jsm_probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
        brd->pci_dev = pdev;
        if (pdev->device == PCIE_DEVICE_ID_NEO_4_IBM)
                brd->maxports = 4;
+       else if (pdev->device == PCI_DEVICE_ID_DIGI_NEO_8)
+               brd->maxports = 8;
        else
                brd->maxports = 2;
 
@@ -212,6 +214,7 @@ static struct pci_device_id jsm_pci_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45), 0, 0, 2 },
        { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_NEO_2RJ45PRI), 0, 0, 3 },
        { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCIE_DEVICE_ID_NEO_4_IBM), 0, 0, 4 },
+       { PCI_DEVICE(PCI_VENDOR_ID_DIGI, PCI_DEVICE_ID_DIGI_NEO_8), 0, 0, 5 },
        { 0, }
 };
 MODULE_DEVICE_TABLE(pci, jsm_pci_tbl);
index 49698cabc30ddba88a6a6b02cb6ab3dd07da0fac..f5ed9721aabb33c24c9a75c79d58df19e595450f 100644 (file)
@@ -114,7 +114,7 @@ static inline void setmosi(const struct spi_device *spi, int is_on)
 
 static inline int getmiso(const struct spi_device *spi)
 {
-       return gpio_get_value(SPI_MISO_GPIO);
+       return !!gpio_get_value(SPI_MISO_GPIO);
 }
 
 #undef pdata
index 6f255e9c5af97d0b825cea7b13afb87225c218d9..cfbb74f2982e497b4eba0df522dedb7c877e62cc 100644 (file)
@@ -9,6 +9,7 @@ ssb-$(CONFIG_SSB_PCMCIAHOST)            += pcmcia.o
 
 # built-in drivers
 ssb-y                                  += driver_chipcommon.o
+ssb-y                                  += driver_chipcommon_pmu.o
 ssb-$(CONFIG_SSB_DRIVER_MIPS)          += driver_mipscore.o
 ssb-$(CONFIG_SSB_DRIVER_EXTIF)         += driver_extif.o
 ssb-$(CONFIG_SSB_DRIVER_PCICORE)       += driver_pcicore.o
index 2d27d6d6d08ebe40fdf4b02e4c4a66b601307e11..27a677584a4cb50f6be679628303c17a700defb0 100644 (file)
@@ -21,6 +21,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4307) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4311) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4312) },
+       { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4315) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4318) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4319) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4320) },
@@ -29,6 +30,7 @@ static const struct pci_device_id b43_pci_bridge_tbl[] = {
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4325) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4328) },
        { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x4329) },
+       { PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, 0x432b) },
        { 0, },
 };
 MODULE_DEVICE_TABLE(pci, b43_pci_bridge_tbl);
index 571f4fd5523652d8cba9cd420c0f6412387840af..9681536163caa5bdf7a36fc1dcfff9f8da3a66ec 100644 (file)
@@ -26,19 +26,6 @@ enum ssb_clksrc {
 };
 
 
-static inline u32 chipco_read32(struct ssb_chipcommon *cc,
-                               u16 offset)
-{
-       return ssb_read32(cc->dev, offset);
-}
-
-static inline void chipco_write32(struct ssb_chipcommon *cc,
-                                 u16 offset,
-                                 u32 value)
-{
-       ssb_write32(cc->dev, offset, value);
-}
-
 static inline u32 chipco_write32_masked(struct ssb_chipcommon *cc, u16 offset,
                                        u32 mask, u32 value)
 {
@@ -246,6 +233,7 @@ void ssb_chipcommon_init(struct ssb_chipcommon *cc)
 {
        if (!cc->dev)
                return; /* We don't have a ChipCommon */
+       ssb_pmu_init(cc);
        chipco_powercontrol_init(cc);
        ssb_chipco_set_clockmode(cc, SSB_CLKMODE_FAST);
        calc_fast_powerup_delay(cc);
diff --git a/drivers/ssb/driver_chipcommon_pmu.c b/drivers/ssb/driver_chipcommon_pmu.c
new file mode 100644 (file)
index 0000000..4aaddee
--- /dev/null
@@ -0,0 +1,508 @@
+/*
+ * Sonics Silicon Backplane
+ * Broadcom ChipCommon Power Management Unit driver
+ *
+ * Copyright 2009, Michael Buesch <mb@bu3sch.de>
+ * Copyright 2007, Broadcom Corporation
+ *
+ * Licensed under the GNU/GPL. See COPYING for details.
+ */
+
+#include <linux/ssb/ssb.h>
+#include <linux/ssb/ssb_regs.h>
+#include <linux/ssb/ssb_driver_chipcommon.h>
+#include <linux/delay.h>
+
+#include "ssb_private.h"
+
+static u32 ssb_chipco_pll_read(struct ssb_chipcommon *cc, u32 offset)
+{
+       chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, offset);
+       return chipco_read32(cc, SSB_CHIPCO_PLLCTL_DATA);
+}
+
+static void ssb_chipco_pll_write(struct ssb_chipcommon *cc,
+                                u32 offset, u32 value)
+{
+       chipco_write32(cc, SSB_CHIPCO_PLLCTL_ADDR, offset);
+       chipco_write32(cc, SSB_CHIPCO_PLLCTL_DATA, value);
+}
+
+struct pmu0_plltab_entry {
+       u16 freq;       /* Crystal frequency in kHz.*/
+       u8 xf;          /* Crystal frequency value for PMU control */
+       u8 wb_int;
+       u32 wb_frac;
+};
+
+static const struct pmu0_plltab_entry pmu0_plltab[] = {
+       { .freq = 12000, .xf =  1, .wb_int = 73, .wb_frac = 349525, },
+       { .freq = 13000, .xf =  2, .wb_int = 67, .wb_frac = 725937, },
+       { .freq = 14400, .xf =  3, .wb_int = 61, .wb_frac = 116508, },
+       { .freq = 15360, .xf =  4, .wb_int = 57, .wb_frac = 305834, },
+       { .freq = 16200, .xf =  5, .wb_int = 54, .wb_frac = 336579, },
+       { .freq = 16800, .xf =  6, .wb_int = 52, .wb_frac = 399457, },
+       { .freq = 19200, .xf =  7, .wb_int = 45, .wb_frac = 873813, },
+       { .freq = 19800, .xf =  8, .wb_int = 44, .wb_frac = 466033, },
+       { .freq = 20000, .xf =  9, .wb_int = 44, .wb_frac = 0,      },
+       { .freq = 25000, .xf = 10, .wb_int = 70, .wb_frac = 419430, },
+       { .freq = 26000, .xf = 11, .wb_int = 67, .wb_frac = 725937, },
+       { .freq = 30000, .xf = 12, .wb_int = 58, .wb_frac = 699050, },
+       { .freq = 38400, .xf = 13, .wb_int = 45, .wb_frac = 873813, },
+       { .freq = 40000, .xf = 14, .wb_int = 45, .wb_frac = 0,      },
+};
+#define SSB_PMU0_DEFAULT_XTALFREQ      20000
+
+static const struct pmu0_plltab_entry * pmu0_plltab_find_entry(u32 crystalfreq)
+{
+       const struct pmu0_plltab_entry *e;
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(pmu0_plltab); i++) {
+               e = &pmu0_plltab[i];
+               if (e->freq == crystalfreq)
+                       return e;
+       }
+
+       return NULL;
+}
+
+/* Tune the PLL to the crystal speed. crystalfreq is in kHz. */
+static void ssb_pmu0_pllinit_r0(struct ssb_chipcommon *cc,
+                               u32 crystalfreq)
+{
+       struct ssb_bus *bus = cc->dev->bus;
+       const struct pmu0_plltab_entry *e = NULL;
+       u32 pmuctl, tmp, pllctl;
+       unsigned int i;
+
+       if ((bus->chip_id == 0x5354) && !crystalfreq) {
+               /* The 5354 crystal freq is 25MHz */
+               crystalfreq = 25000;
+       }
+       if (crystalfreq)
+               e = pmu0_plltab_find_entry(crystalfreq);
+       if (!e)
+               e = pmu0_plltab_find_entry(SSB_PMU0_DEFAULT_XTALFREQ);
+       BUG_ON(!e);
+       crystalfreq = e->freq;
+       cc->pmu.crystalfreq = e->freq;
+
+       /* Check if the PLL already is programmed to this frequency. */
+       pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL);
+       if (((pmuctl & SSB_CHIPCO_PMU_CTL_XTALFREQ) >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) == e->xf) {
+               /* We're already there... */
+               return;
+       }
+
+       ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n",
+                  (crystalfreq / 1000), (crystalfreq % 1000));
+
+       /* First turn the PLL off. */
+       switch (bus->chip_id) {
+       case 0x4328:
+               chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK,
+                             ~(1 << SSB_PMURES_4328_BB_PLL_PU));
+               chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK,
+                             ~(1 << SSB_PMURES_4328_BB_PLL_PU));
+               break;
+       case 0x5354:
+               chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK,
+                             ~(1 << SSB_PMURES_5354_BB_PLL_PU));
+               chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK,
+                             ~(1 << SSB_PMURES_5354_BB_PLL_PU));
+               break;
+       default:
+               SSB_WARN_ON(1);
+       }
+       for (i = 1500; i; i--) {
+               tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
+               if (!(tmp & SSB_CHIPCO_CLKCTLST_HAVEHT))
+                       break;
+               udelay(10);
+       }
+       tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
+       if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)
+               ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n");
+
+       /* Set PDIV in PLL control 0. */
+       pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL0);
+       if (crystalfreq >= SSB_PMU0_PLLCTL0_PDIV_FREQ)
+               pllctl |= SSB_PMU0_PLLCTL0_PDIV_MSK;
+       else
+               pllctl &= ~SSB_PMU0_PLLCTL0_PDIV_MSK;
+       ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL0, pllctl);
+
+       /* Set WILD in PLL control 1. */
+       pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL1);
+       pllctl &= ~SSB_PMU0_PLLCTL1_STOPMOD;
+       pllctl &= ~(SSB_PMU0_PLLCTL1_WILD_IMSK | SSB_PMU0_PLLCTL1_WILD_FMSK);
+       pllctl |= ((u32)e->wb_int << SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT) & SSB_PMU0_PLLCTL1_WILD_IMSK;
+       pllctl |= ((u32)e->wb_frac << SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT) & SSB_PMU0_PLLCTL1_WILD_FMSK;
+       if (e->wb_frac == 0)
+               pllctl |= SSB_PMU0_PLLCTL1_STOPMOD;
+       ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL1, pllctl);
+
+       /* Set WILD in PLL control 2. */
+       pllctl = ssb_chipco_pll_read(cc, SSB_PMU0_PLLCTL2);
+       pllctl &= ~SSB_PMU0_PLLCTL2_WILD_IMSKHI;
+       pllctl |= (((u32)e->wb_int >> 4) << SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT) & SSB_PMU0_PLLCTL2_WILD_IMSKHI;
+       ssb_chipco_pll_write(cc, SSB_PMU0_PLLCTL2, pllctl);
+
+       /* Set the crystalfrequency and the divisor. */
+       pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL);
+       pmuctl &= ~SSB_CHIPCO_PMU_CTL_ILP_DIV;
+       pmuctl |= (((crystalfreq + 127) / 128 - 1) << SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT)
+                       & SSB_CHIPCO_PMU_CTL_ILP_DIV;
+       pmuctl &= ~SSB_CHIPCO_PMU_CTL_XTALFREQ;
+       pmuctl |= ((u32)e->xf << SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) & SSB_CHIPCO_PMU_CTL_XTALFREQ;
+       chipco_write32(cc, SSB_CHIPCO_PMU_CTL, pmuctl);
+}
+
+struct pmu1_plltab_entry {
+       u16 freq;       /* Crystal frequency in kHz.*/
+       u8 xf;          /* Crystal frequency value for PMU control */
+       u8 ndiv_int;
+       u32 ndiv_frac;
+       u8 p1div;
+       u8 p2div;
+};
+
+static const struct pmu1_plltab_entry pmu1_plltab[] = {
+       { .freq = 12000, .xf =  1, .p1div = 3, .p2div = 22, .ndiv_int =  0x9, .ndiv_frac = 0xFFFFEF, },
+       { .freq = 13000, .xf =  2, .p1div = 1, .p2div =  6, .ndiv_int =  0xb, .ndiv_frac = 0x483483, },
+       { .freq = 14400, .xf =  3, .p1div = 1, .p2div = 10, .ndiv_int =  0xa, .ndiv_frac = 0x1C71C7, },
+       { .freq = 15360, .xf =  4, .p1div = 1, .p2div =  5, .ndiv_int =  0xb, .ndiv_frac = 0x755555, },
+       { .freq = 16200, .xf =  5, .p1div = 1, .p2div = 10, .ndiv_int =  0x5, .ndiv_frac = 0x6E9E06, },
+       { .freq = 16800, .xf =  6, .p1div = 1, .p2div = 10, .ndiv_int =  0x5, .ndiv_frac = 0x3CF3CF, },
+       { .freq = 19200, .xf =  7, .p1div = 1, .p2div =  9, .ndiv_int =  0x5, .ndiv_frac = 0x17B425, },
+       { .freq = 19800, .xf =  8, .p1div = 1, .p2div = 11, .ndiv_int =  0x4, .ndiv_frac = 0xA57EB,  },
+       { .freq = 20000, .xf =  9, .p1div = 1, .p2div = 11, .ndiv_int =  0x4, .ndiv_frac = 0,        },
+       { .freq = 24000, .xf = 10, .p1div = 3, .p2div = 11, .ndiv_int =  0xa, .ndiv_frac = 0,        },
+       { .freq = 25000, .xf = 11, .p1div = 5, .p2div = 16, .ndiv_int =  0xb, .ndiv_frac = 0,        },
+       { .freq = 26000, .xf = 12, .p1div = 1, .p2div =  2, .ndiv_int = 0x10, .ndiv_frac = 0xEC4EC4, },
+       { .freq = 30000, .xf = 13, .p1div = 3, .p2div =  8, .ndiv_int =  0xb, .ndiv_frac = 0,        },
+       { .freq = 38400, .xf = 14, .p1div = 1, .p2div =  5, .ndiv_int =  0x4, .ndiv_frac = 0x955555, },
+       { .freq = 40000, .xf = 15, .p1div = 1, .p2div =  2, .ndiv_int =  0xb, .ndiv_frac = 0,        },
+};
+
+#define SSB_PMU1_DEFAULT_XTALFREQ      15360
+
+static const struct pmu1_plltab_entry * pmu1_plltab_find_entry(u32 crystalfreq)
+{
+       const struct pmu1_plltab_entry *e;
+       unsigned int i;
+
+       for (i = 0; i < ARRAY_SIZE(pmu1_plltab); i++) {
+               e = &pmu1_plltab[i];
+               if (e->freq == crystalfreq)
+                       return e;
+       }
+
+       return NULL;
+}
+
+/* Tune the PLL to the crystal speed. crystalfreq is in kHz. */
+static void ssb_pmu1_pllinit_r0(struct ssb_chipcommon *cc,
+                               u32 crystalfreq)
+{
+       struct ssb_bus *bus = cc->dev->bus;
+       const struct pmu1_plltab_entry *e = NULL;
+       u32 buffer_strength = 0;
+       u32 tmp, pllctl, pmuctl;
+       unsigned int i;
+
+       if (bus->chip_id == 0x4312) {
+               /* We do not touch the BCM4312 PLL and assume
+                * the default crystal settings work out-of-the-box. */
+               cc->pmu.crystalfreq = 20000;
+               return;
+       }
+
+       if (crystalfreq)
+               e = pmu1_plltab_find_entry(crystalfreq);
+       if (!e)
+               e = pmu1_plltab_find_entry(SSB_PMU1_DEFAULT_XTALFREQ);
+       BUG_ON(!e);
+       crystalfreq = e->freq;
+       cc->pmu.crystalfreq = e->freq;
+
+       /* Check if the PLL already is programmed to this frequency. */
+       pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL);
+       if (((pmuctl & SSB_CHIPCO_PMU_CTL_XTALFREQ) >> SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) == e->xf) {
+               /* We're already there... */
+               return;
+       }
+
+       ssb_printk(KERN_INFO PFX "Programming PLL to %u.%03u MHz\n",
+                  (crystalfreq / 1000), (crystalfreq % 1000));
+
+       /* First turn the PLL off. */
+       switch (bus->chip_id) {
+       case 0x4325:
+               chipco_mask32(cc, SSB_CHIPCO_PMU_MINRES_MSK,
+                             ~((1 << SSB_PMURES_4325_BBPLL_PWRSW_PU) |
+                               (1 << SSB_PMURES_4325_HT_AVAIL)));
+               chipco_mask32(cc, SSB_CHIPCO_PMU_MAXRES_MSK,
+                             ~((1 << SSB_PMURES_4325_BBPLL_PWRSW_PU) |
+                               (1 << SSB_PMURES_4325_HT_AVAIL)));
+               /* Adjust the BBPLL to 2 on all channels later. */
+               buffer_strength = 0x222222;
+               break;
+       default:
+               SSB_WARN_ON(1);
+       }
+       for (i = 1500; i; i--) {
+               tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
+               if (!(tmp & SSB_CHIPCO_CLKCTLST_HAVEHT))
+                       break;
+               udelay(10);
+       }
+       tmp = chipco_read32(cc, SSB_CHIPCO_CLKCTLST);
+       if (tmp & SSB_CHIPCO_CLKCTLST_HAVEHT)
+               ssb_printk(KERN_EMERG PFX "Failed to turn the PLL off!\n");
+
+       /* Set p1div and p2div. */
+       pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL0);
+       pllctl &= ~(SSB_PMU1_PLLCTL0_P1DIV | SSB_PMU1_PLLCTL0_P2DIV);
+       pllctl |= ((u32)e->p1div << SSB_PMU1_PLLCTL0_P1DIV_SHIFT) & SSB_PMU1_PLLCTL0_P1DIV;
+       pllctl |= ((u32)e->p2div << SSB_PMU1_PLLCTL0_P2DIV_SHIFT) & SSB_PMU1_PLLCTL0_P2DIV;
+       ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL0, pllctl);
+
+       /* Set ndiv int and ndiv mode */
+       pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL2);
+       pllctl &= ~(SSB_PMU1_PLLCTL2_NDIVINT | SSB_PMU1_PLLCTL2_NDIVMODE);
+       pllctl |= ((u32)e->ndiv_int << SSB_PMU1_PLLCTL2_NDIVINT_SHIFT) & SSB_PMU1_PLLCTL2_NDIVINT;
+       pllctl |= (1 << SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT) & SSB_PMU1_PLLCTL2_NDIVMODE;
+       ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL2, pllctl);
+
+       /* Set ndiv frac */
+       pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL3);
+       pllctl &= ~SSB_PMU1_PLLCTL3_NDIVFRAC;
+       pllctl |= ((u32)e->ndiv_frac << SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT) & SSB_PMU1_PLLCTL3_NDIVFRAC;
+       ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL3, pllctl);
+
+       /* Change the drive strength, if required. */
+       if (buffer_strength) {
+               pllctl = ssb_chipco_pll_read(cc, SSB_PMU1_PLLCTL5);
+               pllctl &= ~SSB_PMU1_PLLCTL5_CLKDRV;
+               pllctl |= (buffer_strength << SSB_PMU1_PLLCTL5_CLKDRV_SHIFT) & SSB_PMU1_PLLCTL5_CLKDRV;
+               ssb_chipco_pll_write(cc, SSB_PMU1_PLLCTL5, pllctl);
+       }
+
+       /* Tune the crystalfreq and the divisor. */
+       pmuctl = chipco_read32(cc, SSB_CHIPCO_PMU_CTL);
+       pmuctl &= ~(SSB_CHIPCO_PMU_CTL_ILP_DIV | SSB_CHIPCO_PMU_CTL_XTALFREQ);
+       pmuctl |= ((((u32)e->freq + 127) / 128 - 1) << SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT)
+                       & SSB_CHIPCO_PMU_CTL_ILP_DIV;
+       pmuctl |= ((u32)e->xf << SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT) & SSB_CHIPCO_PMU_CTL_XTALFREQ;
+       chipco_write32(cc, SSB_CHIPCO_PMU_CTL, pmuctl);
+}
+
+static void ssb_pmu_pll_init(struct ssb_chipcommon *cc)
+{
+       struct ssb_bus *bus = cc->dev->bus;
+       u32 crystalfreq = 0; /* in kHz. 0 = keep default freq. */
+
+       if (bus->bustype == SSB_BUSTYPE_SSB) {
+               /* TODO: The user may override the crystal frequency. */
+       }
+
+       switch (bus->chip_id) {
+       case 0x4312:
+       case 0x4325:
+               ssb_pmu1_pllinit_r0(cc, crystalfreq);
+               break;
+       case 0x4328:
+       case 0x5354:
+               ssb_pmu0_pllinit_r0(cc, crystalfreq);
+               break;
+       default:
+               ssb_printk(KERN_ERR PFX
+                          "ERROR: PLL init unknown for device %04X\n",
+                          bus->chip_id);
+       }
+}
+
+struct pmu_res_updown_tab_entry {
+       u8 resource;    /* The resource number */
+       u16 updown;     /* The updown value */
+};
+
+enum pmu_res_depend_tab_task {
+       PMU_RES_DEP_SET = 1,
+       PMU_RES_DEP_ADD,
+       PMU_RES_DEP_REMOVE,
+};
+
+struct pmu_res_depend_tab_entry {
+       u8 resource;    /* The resource number */
+       u8 task;        /* SET | ADD | REMOVE */
+       u32 depend;     /* The depend mask */
+};
+
+static const struct pmu_res_updown_tab_entry pmu_res_updown_tab_4328a0[] = {
+       { .resource = SSB_PMURES_4328_EXT_SWITCHER_PWM,         .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_BB_SWITCHER_PWM,          .updown = 0x1F01, },
+       { .resource = SSB_PMURES_4328_BB_SWITCHER_BURST,        .updown = 0x010F, },
+       { .resource = SSB_PMURES_4328_BB_EXT_SWITCHER_BURST,    .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_ILP_REQUEST,              .updown = 0x0202, },
+       { .resource = SSB_PMURES_4328_RADIO_SWITCHER_PWM,       .updown = 0x0F01, },
+       { .resource = SSB_PMURES_4328_RADIO_SWITCHER_BURST,     .updown = 0x0F01, },
+       { .resource = SSB_PMURES_4328_ROM_SWITCH,               .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_PA_REF_LDO,               .updown = 0x0F01, },
+       { .resource = SSB_PMURES_4328_RADIO_LDO,                .updown = 0x0F01, },
+       { .resource = SSB_PMURES_4328_AFE_LDO,                  .updown = 0x0F01, },
+       { .resource = SSB_PMURES_4328_PLL_LDO,                  .updown = 0x0F01, },
+       { .resource = SSB_PMURES_4328_BG_FILTBYP,               .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_TX_FILTBYP,               .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_RX_FILTBYP,               .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_XTAL_PU,                  .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_XTAL_EN,                  .updown = 0xA001, },
+       { .resource = SSB_PMURES_4328_BB_PLL_FILTBYP,           .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_RF_PLL_FILTBYP,           .updown = 0x0101, },
+       { .resource = SSB_PMURES_4328_BB_PLL_PU,                .updown = 0x0701, },
+};
+
+static const struct pmu_res_depend_tab_entry pmu_res_depend_tab_4328a0[] = {
+       {
+               /* Adjust ILP Request to avoid forcing EXT/BB into burst mode. */
+               .resource = SSB_PMURES_4328_ILP_REQUEST,
+               .task = PMU_RES_DEP_SET,
+               .depend = ((1 << SSB_PMURES_4328_EXT_SWITCHER_PWM) |
+                          (1 << SSB_PMURES_4328_BB_SWITCHER_PWM)),
+       },
+};
+
+static const struct pmu_res_updown_tab_entry pmu_res_updown_tab_4325a0[] = {
+       { .resource = SSB_PMURES_4325_XTAL_PU,                  .updown = 0x1501, },
+};
+
+static const struct pmu_res_depend_tab_entry pmu_res_depend_tab_4325a0[] = {
+       {
+               /* Adjust HT-Available dependencies. */
+               .resource = SSB_PMURES_4325_HT_AVAIL,
+               .task = PMU_RES_DEP_ADD,
+               .depend = ((1 << SSB_PMURES_4325_RX_PWRSW_PU) |
+                          (1 << SSB_PMURES_4325_TX_PWRSW_PU) |
+                          (1 << SSB_PMURES_4325_LOGEN_PWRSW_PU) |
+                          (1 << SSB_PMURES_4325_AFE_PWRSW_PU)),
+       },
+};
+
+static void ssb_pmu_resources_init(struct ssb_chipcommon *cc)
+{
+       struct ssb_bus *bus = cc->dev->bus;
+       u32 min_msk = 0, max_msk = 0;
+       unsigned int i;
+       const struct pmu_res_updown_tab_entry *updown_tab = NULL;
+       unsigned int updown_tab_size;
+       const struct pmu_res_depend_tab_entry *depend_tab = NULL;
+       unsigned int depend_tab_size;
+
+       switch (bus->chip_id) {
+       case 0x4312:
+               /* We keep the default settings:
+                * min_msk = 0xCBB
+                * max_msk = 0x7FFFF
+                */
+               break;
+       case 0x4325:
+               /* Power OTP down later. */
+               min_msk = (1 << SSB_PMURES_4325_CBUCK_BURST) |
+                         (1 << SSB_PMURES_4325_LNLDO2_PU);
+               if (chipco_read32(cc, SSB_CHIPCO_CHIPSTAT) &
+                   SSB_CHIPCO_CHST_4325_PMUTOP_2B)
+                       min_msk |= (1 << SSB_PMURES_4325_CLDO_CBUCK_BURST);
+               /* The PLL may turn on, if it decides so. */
+               max_msk = 0xFFFFF;
+               updown_tab = pmu_res_updown_tab_4325a0;
+               updown_tab_size = ARRAY_SIZE(pmu_res_updown_tab_4325a0);
+               depend_tab = pmu_res_depend_tab_4325a0;
+               depend_tab_size = ARRAY_SIZE(pmu_res_depend_tab_4325a0);
+               break;
+       case 0x4328:
+               min_msk = (1 << SSB_PMURES_4328_EXT_SWITCHER_PWM) |
+                         (1 << SSB_PMURES_4328_BB_SWITCHER_PWM) |
+                         (1 << SSB_PMURES_4328_XTAL_EN);
+               /* The PLL may turn on, if it decides so. */
+               max_msk = 0xFFFFF;
+               updown_tab = pmu_res_updown_tab_4328a0;
+               updown_tab_size = ARRAY_SIZE(pmu_res_updown_tab_4328a0);
+               depend_tab = pmu_res_depend_tab_4328a0;
+               depend_tab_size = ARRAY_SIZE(pmu_res_depend_tab_4328a0);
+               break;
+       case 0x5354:
+               /* The PLL may turn on, if it decides so. */
+               max_msk = 0xFFFFF;
+               break;
+       default:
+               ssb_printk(KERN_ERR PFX
+                          "ERROR: PMU resource config unknown for device %04X\n",
+                          bus->chip_id);
+       }
+
+       if (updown_tab) {
+               for (i = 0; i < updown_tab_size; i++) {
+                       chipco_write32(cc, SSB_CHIPCO_PMU_RES_TABSEL,
+                                      updown_tab[i].resource);
+                       chipco_write32(cc, SSB_CHIPCO_PMU_RES_UPDNTM,
+                                      updown_tab[i].updown);
+               }
+       }
+       if (depend_tab) {
+               for (i = 0; i < depend_tab_size; i++) {
+                       chipco_write32(cc, SSB_CHIPCO_PMU_RES_TABSEL,
+                                      depend_tab[i].resource);
+                       switch (depend_tab[i].task) {
+                       case PMU_RES_DEP_SET:
+                               chipco_write32(cc, SSB_CHIPCO_PMU_RES_DEPMSK,
+                                              depend_tab[i].depend);
+                               break;
+                       case PMU_RES_DEP_ADD:
+                               chipco_set32(cc, SSB_CHIPCO_PMU_RES_DEPMSK,
+                                            depend_tab[i].depend);
+                               break;
+                       case PMU_RES_DEP_REMOVE:
+                               chipco_mask32(cc, SSB_CHIPCO_PMU_RES_DEPMSK,
+                                             ~(depend_tab[i].depend));
+                               break;
+                       default:
+                               SSB_WARN_ON(1);
+                       }
+               }
+       }
+
+       /* Set the resource masks. */
+       if (min_msk)
+               chipco_write32(cc, SSB_CHIPCO_PMU_MINRES_MSK, min_msk);
+       if (max_msk)
+               chipco_write32(cc, SSB_CHIPCO_PMU_MAXRES_MSK, max_msk);
+}
+
+void ssb_pmu_init(struct ssb_chipcommon *cc)
+{
+       struct ssb_bus *bus = cc->dev->bus;
+       u32 pmucap;
+
+       if (!(cc->capabilities & SSB_CHIPCO_CAP_PMU))
+               return;
+
+       pmucap = chipco_read32(cc, SSB_CHIPCO_PMU_CAP);
+       cc->pmu.rev = (pmucap & SSB_CHIPCO_PMU_CAP_REVISION);
+
+       ssb_dprintk(KERN_DEBUG PFX "Found rev %u PMU (capabilities 0x%08X)\n",
+                   cc->pmu.rev, pmucap);
+
+       if (cc->pmu.rev >= 1) {
+               if ((bus->chip_id == 0x4325) && (bus->chip_rev < 2)) {
+                       chipco_mask32(cc, SSB_CHIPCO_PMU_CTL,
+                                     ~SSB_CHIPCO_PMU_CTL_NOILPONW);
+               } else {
+                       chipco_set32(cc, SSB_CHIPCO_PMU_CTL,
+                                    SSB_CHIPCO_PMU_CTL_NOILPONW);
+               }
+       }
+       ssb_pmu_pll_init(cc);
+       ssb_pmu_resources_init(cc);
+}
index d5cde051806b1d5c1669c7295e734ed886b2443a..c958ac16423ce68232ebf7069629cde645cb9736 100644 (file)
@@ -467,6 +467,51 @@ static void sprom_extract_r45(struct ssb_sprom *out, const u16 *in)
        /* TODO - get remaining rev 4 stuff needed */
 }
 
+static void sprom_extract_r8(struct ssb_sprom *out, const u16 *in)
+{
+       int i;
+       u16 v;
+
+       /* extract the MAC address */
+       for (i = 0; i < 3; i++) {
+               v = in[SPOFF(SSB_SPROM1_IL0MAC) + i];
+               *(((__be16 *)out->il0mac) + i) = cpu_to_be16(v);
+       }
+       SPEX(country_code, SSB_SPROM8_CCODE, 0xFFFF, 0);
+       SPEX(boardflags_lo, SSB_SPROM8_BFLLO, 0xFFFF, 0);
+       SPEX(boardflags_hi, SSB_SPROM8_BFLHI, 0xFFFF, 0);
+       SPEX(ant_available_a, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_A,
+            SSB_SPROM8_ANTAVAIL_A_SHIFT);
+       SPEX(ant_available_bg, SSB_SPROM8_ANTAVAIL, SSB_SPROM8_ANTAVAIL_BG,
+            SSB_SPROM8_ANTAVAIL_BG_SHIFT);
+       SPEX(maxpwr_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_MAXP_BG_MASK, 0);
+       SPEX(itssi_bg, SSB_SPROM8_MAXP_BG, SSB_SPROM8_ITSSI_BG,
+            SSB_SPROM8_ITSSI_BG_SHIFT);
+       SPEX(maxpwr_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_MAXP_A_MASK, 0);
+       SPEX(itssi_a, SSB_SPROM8_MAXP_A, SSB_SPROM8_ITSSI_A,
+            SSB_SPROM8_ITSSI_A_SHIFT);
+       SPEX(gpio0, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P0, 0);
+       SPEX(gpio1, SSB_SPROM8_GPIOA, SSB_SPROM8_GPIOA_P1,
+            SSB_SPROM8_GPIOA_P1_SHIFT);
+       SPEX(gpio2, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P2, 0);
+       SPEX(gpio3, SSB_SPROM8_GPIOB, SSB_SPROM8_GPIOB_P3,
+            SSB_SPROM8_GPIOB_P3_SHIFT);
+
+       /* Extract the antenna gain values. */
+       SPEX(antenna_gain.ghz24.a0, SSB_SPROM8_AGAIN01,
+            SSB_SPROM8_AGAIN0, SSB_SPROM8_AGAIN0_SHIFT);
+       SPEX(antenna_gain.ghz24.a1, SSB_SPROM8_AGAIN01,
+            SSB_SPROM8_AGAIN1, SSB_SPROM8_AGAIN1_SHIFT);
+       SPEX(antenna_gain.ghz24.a2, SSB_SPROM8_AGAIN23,
+            SSB_SPROM8_AGAIN2, SSB_SPROM8_AGAIN2_SHIFT);
+       SPEX(antenna_gain.ghz24.a3, SSB_SPROM8_AGAIN23,
+            SSB_SPROM8_AGAIN3, SSB_SPROM8_AGAIN3_SHIFT);
+       memcpy(&out->antenna_gain.ghz5, &out->antenna_gain.ghz24,
+              sizeof(out->antenna_gain.ghz5));
+
+       /* TODO - get remaining rev 8 stuff needed */
+}
+
 static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
                         const u16 *in, u16 size)
 {
@@ -487,15 +532,25 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
                out->revision = 4;
                sprom_extract_r45(out, in);
        } else {
-               if (out->revision == 0)
-                       goto unsupported;
-               if (out->revision >= 1 && out->revision <= 3) {
+               switch (out->revision) {
+               case 1:
+               case 2:
+               case 3:
                        sprom_extract_r123(out, in);
-               }
-               if (out->revision == 4 || out->revision == 5)
+                       break;
+               case 4:
+               case 5:
                        sprom_extract_r45(out, in);
-               if (out->revision > 5)
-                       goto unsupported;
+                       break;
+               case 8:
+                       sprom_extract_r8(out, in);
+                       break;
+               default:
+                       ssb_printk(KERN_WARNING PFX "Unsupported SPROM"
+                                  "  revision %d detected. Will extract"
+                                  " v1\n", out->revision);
+                       sprom_extract_r123(out, in);
+               }
        }
 
        if (out->boardflags_lo == 0xFFFF)
@@ -504,11 +559,6 @@ static int sprom_extract(struct ssb_bus *bus, struct ssb_sprom *out,
                out->boardflags_hi = 0;  /* per specs */
 
        return 0;
-unsupported:
-       ssb_printk(KERN_WARNING PFX "Unsupported SPROM revision %d "
-                  "detected. Will extract v1\n", out->revision);
-       sprom_extract_r123(out, in);
-       return 0;
 }
 
 static int ssb_pci_sprom_get(struct ssb_bus *bus,
index 6b996db0dd6a70daf8490f3229972eb2d3330202..604bd1e0d546492d5f8c758ea2ba969f1afc7427 100644 (file)
@@ -27,6 +27,7 @@ menuconfig ANDROID_RAM_CONSOLE_ERROR_CORRECTION
        bool "Android RAM Console Enable error correction"
        default n
        depends on ANDROID_RAM_CONSOLE
+       depends on !ANDROID_RAM_CONSOLE_EARLY_INIT
        select REED_SOLOMON
        select REED_SOLOMON_ENC8
        select REED_SOLOMON_DEC8
index bf006857a87ac803037d6d1cf527968035e48e8c..643ac5ce381d9baa4c1321478391a76d83383787 100644 (file)
@@ -224,9 +224,23 @@ static int __init ram_console_init(struct ram_console_buffer *buffer,
        ram_console_buffer_size =
                buffer_size - sizeof(struct ram_console_buffer);
 
+       if (ram_console_buffer_size > buffer_size) {
+               pr_err("ram_console: buffer %p, invalid size %d, datasize %d\n",
+                      buffer, buffer_size, ram_console_buffer_size);
+               return 0;
+       }
+
 #ifdef CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION
        ram_console_buffer_size -= (DIV_ROUND_UP(ram_console_buffer_size,
                                                ECC_BLOCK_SIZE) + 1) * ECC_SIZE;
+
+       if (ram_console_buffer_size > buffer_size) {
+               pr_err("ram_console: buffer %p, invalid size %d, "
+                      "non-ecc datasize %d\n",
+                      buffer, buffer_size, ram_console_buffer_size);
+               return 0;
+       }
+
        ram_console_par_buffer = buffer->data + ram_console_buffer_size;
 
 
index 903270cbbe0201d28df7cfe1ba0038249c494b21..33daff0481d265d8f9a3765e4858e877e1d38d65 100644 (file)
@@ -50,7 +50,7 @@ static ssize_t gpio_enable_show(struct device *dev, struct device_attribute *att
        if (hrtimer_active(&gpio_data->timer)) {
                ktime_t r = hrtimer_get_remaining(&gpio_data->timer);
                struct timeval t = ktime_to_timeval(r);
-               remaining = t.tv_sec * 1000 + t.tv_usec;
+               remaining = t.tv_sec * 1000 + t.tv_usec / 1000;
        } else
                remaining = 0;
 
index 4c0e55e15448948f81de57cf306ef2727f9c7e08..8606f96216248633a14edaf4d03d679314b6fb00 100644 (file)
@@ -1,6 +1,6 @@
 config USB_ATMEL
        tristate "Atmel at76c503/at76c505/at76c505a USB cards"
-       depends on MAC80211 && WLAN_80211 && USB
+       depends on WLAN_80211 && USB
        default N
        select FW_LOADER
        ---help---
index 185533e547698d20a108dfb5f19c98e82bd3f45d..c8e4d31c7df2bd98debecee0ab6ac8d51fe2befa 100644 (file)
@@ -6,7 +6,6 @@
  * Copyright (c) 2004 Nick Jones
  * Copyright (c) 2004 Balint Seeber <n0_5p4m_p13453@hotmail.com>
  * Copyright (c) 2007 Guido Guenther <agx@sigxcpu.org>
- * Copyright (c) 2007 Kalle Valo <kalle.valo@iki.fi>
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
  * Atmel AT76C503A/505/505A.
  *
  * Some iw_handler code was taken from airo.c, (C) 1999 Benjamin Reed
- *
- * TODO for the mac80211 port:
- * o adhoc support
- * o RTS/CTS support
- * o Power Save Mode support
- * o support for short/long preambles
- * o export variables through debugfs/sysfs
  */
 
 #include <linux/init.h>
@@ -44,7 +36,7 @@
 #include <net/ieee80211_radiotap.h>
 #include <linux/firmware.h>
 #include <linux/leds.h>
-#include <net/mac80211.h>
+#include <net/ieee80211.h>
 
 #include "at76_usb.h"
 
 #define DBG_WE_EVENTS          0x08000000      /* dump wireless events */
 #define DBG_FW                 0x10000000      /* firmware download */
 #define DBG_DFU                        0x20000000      /* device firmware upgrade */
-#define DBG_CMD                        0x40000000
-#define DBG_MAC80211           0x80000000
 
 #define DBG_DEFAULTS           0
 
 /* Use our own dbg macro */
 #define at76_dbg(bits, format, arg...) \
-do {   \
-       if (at76_debug & (bits))        \
-               printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \
-} while (0)
-
-#define at76_dbg_dump(bits, buf, len, format, arg...)  \
-do {   \
-       if (at76_debug & (bits)) {      \
+       do { \
+               if (at76_debug & (bits)) \
                printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \
-               print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, buf, len); \
-               }                                                       \
-} while (0)
+       } while (0)
 
 static int at76_debug = DBG_DEFAULTS;
 
-#define FIRMWARE_IS_WPA(ver) ((ver.major == 1) && (ver.minor == 103))
-
 /* Protect against concurrent firmware loading and parsing */
 static struct mutex fw_mutex;
 
 static struct fwentry firmwares[] = {
-       [0] = { "" },
-       [BOARD_503_ISL3861] = { "atmel_at76c503-i3861.bin" },
-       [BOARD_503_ISL3863] = { "atmel_at76c503-i3863.bin" },
-       [BOARD_503] = { "atmel_at76c503-rfmd.bin" },
-       [BOARD_503_ACC] = { "atmel_at76c503-rfmd-acc.bin" },
-       [BOARD_505] = { "atmel_at76c505-rfmd.bin" },
-       [BOARD_505_2958] = { "atmel_at76c505-rfmd2958.bin" },
-       [BOARD_505A] = { "atmel_at76c505a-rfmd2958.bin" },
-       [BOARD_505AMX] = { "atmel_at76c505amx-rfmd.bin" },
+       [0] = {""},
+       [BOARD_503_ISL3861] = {"atmel_at76c503-i3861.bin"},
+       [BOARD_503_ISL3863] = {"atmel_at76c503-i3863.bin"},
+       [BOARD_503] = {"atmel_at76c503-rfmd.bin"},
+       [BOARD_503_ACC] = {"atmel_at76c503-rfmd-acc.bin"},
+       [BOARD_505] = {"atmel_at76c505-rfmd.bin"},
+       [BOARD_505_2958] = {"atmel_at76c505-rfmd2958.bin"},
+       [BOARD_505A] = {"atmel_at76c505a-rfmd2958.bin"},
+       [BOARD_505AMX] = {"atmel_at76c505amx-rfmd.bin"},
 };
 
 #define USB_DEVICE_DATA(__ops) .driver_info = (kernel_ulong_t)(__ops)
@@ -130,133 +110,135 @@ static struct usb_device_id dev_table[] = {
         * at76c503-i3861
         */
        /* Generic AT76C503/3861 device */
-       { USB_DEVICE(0x03eb, 0x7603), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x03eb, 0x7603), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Linksys WUSB11 v2.1/v2.6 */
-       { USB_DEVICE(0x066b, 0x2211), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x066b, 0x2211), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Netgear MA101 rev. A */
-       { USB_DEVICE(0x0864, 0x4100), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x0864, 0x4100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Tekram U300C / Allnet ALL0193 */
-       { USB_DEVICE(0x0b3b, 0x1612), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x0b3b, 0x1612), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* HP HN210W J7801A */
-       { USB_DEVICE(0x03f0, 0x011c), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x03f0, 0x011c), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Sitecom/Z-Com/Zyxel M4Y-750 */
-       { USB_DEVICE(0x0cde, 0x0001), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x0cde, 0x0001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Dynalink/Askey WLL013 (intersil) */
-       { USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* EZ connect 11Mpbs Wireless USB Adapter SMC2662W v1 */
-       { USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* BenQ AWL300 */
-       { USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Addtron AWU-120, Compex WLU11 */
-       { USB_DEVICE(0x05dd, 0xff31), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x05dd, 0xff31), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Intel AP310 AnyPoint II USB */
-       { USB_DEVICE(0x8086, 0x0200), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x8086, 0x0200), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Dynalink L11U */
-       { USB_DEVICE(0x0d8e, 0x7100), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x0d8e, 0x7100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* Arescom WL-210, FCC id 07J-GL2411USB */
-       { USB_DEVICE(0x0d8e, 0x7110), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x0d8e, 0x7110), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* I-O DATA WN-B11/USB */
-       { USB_DEVICE(0x04bb, 0x0919), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x04bb, 0x0919), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /* BT Voyager 1010 */
-       { USB_DEVICE(0x069a, 0x0821), USB_DEVICE_DATA(BOARD_503_ISL3861) },
+       {USB_DEVICE(0x069a, 0x0821), USB_DEVICE_DATA(BOARD_503_ISL3861)},
        /*
         * at76c503-i3863
         */
        /* Generic AT76C503/3863 device */
-       { USB_DEVICE(0x03eb, 0x7604), USB_DEVICE_DATA(BOARD_503_ISL3863) },
+       {USB_DEVICE(0x03eb, 0x7604), USB_DEVICE_DATA(BOARD_503_ISL3863)},
        /* Samsung SWL-2100U */
-       { USB_DEVICE(0x055d, 0xa000), USB_DEVICE_DATA(BOARD_503_ISL3863) },
+       {USB_DEVICE(0x055d, 0xa000), USB_DEVICE_DATA(BOARD_503_ISL3863)},
        /*
         * at76c503-rfmd
         */
        /* Generic AT76C503/RFMD device */
-       { USB_DEVICE(0x03eb, 0x7605), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x03eb, 0x7605), USB_DEVICE_DATA(BOARD_503)},
        /* Dynalink/Askey WLL013 (rfmd) */
-       { USB_DEVICE(0x069a, 0x0321), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x069a, 0x0321), USB_DEVICE_DATA(BOARD_503)},
        /* Linksys WUSB11 v2.6 */
-       { USB_DEVICE(0x077b, 0x2219), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x077b, 0x2219), USB_DEVICE_DATA(BOARD_503)},
        /* Network Everywhere NWU11B */
-       { USB_DEVICE(0x077b, 0x2227), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x077b, 0x2227), USB_DEVICE_DATA(BOARD_503)},
        /* Netgear MA101 rev. B */
-       { USB_DEVICE(0x0864, 0x4102), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x0864, 0x4102), USB_DEVICE_DATA(BOARD_503)},
        /* D-Link DWL-120 rev. E */
-       { USB_DEVICE(0x2001, 0x3200), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x2001, 0x3200), USB_DEVICE_DATA(BOARD_503)},
        /* Actiontec 802UAT1, HWU01150-01UK */
-       { USB_DEVICE(0x1668, 0x7605), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x1668, 0x7605), USB_DEVICE_DATA(BOARD_503)},
        /* AirVast W-Buddie WN210 */
-       { USB_DEVICE(0x03eb, 0x4102), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x03eb, 0x4102), USB_DEVICE_DATA(BOARD_503)},
        /* Dick Smith Electronics XH1153 802.11b USB adapter */
-       { USB_DEVICE(0x1371, 0x5743), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x1371, 0x5743), USB_DEVICE_DATA(BOARD_503)},
        /* CNet CNUSB611 */
-       { USB_DEVICE(0x1371, 0x0001), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x1371, 0x0001), USB_DEVICE_DATA(BOARD_503)},
        /* FiberLine FL-WL200U */
-       { USB_DEVICE(0x1371, 0x0002), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x1371, 0x0002), USB_DEVICE_DATA(BOARD_503)},
        /* BenQ AWL400 USB stick */
-       { USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503)},
        /* 3Com 3CRSHEW696 */
-       { USB_DEVICE(0x0506, 0x0a01), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x0506, 0x0a01), USB_DEVICE_DATA(BOARD_503)},
        /* Siemens Santis ADSL WLAN USB adapter WLL 013 */
-       { USB_DEVICE(0x0681, 0x001b), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x0681, 0x001b), USB_DEVICE_DATA(BOARD_503)},
        /* Belkin F5D6050, version 2 */
-       { USB_DEVICE(0x050d, 0x0050), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x050d, 0x0050), USB_DEVICE_DATA(BOARD_503)},
        /* iBlitzz, BWU613 (not *B or *SB) */
-       { USB_DEVICE(0x07b8, 0xb000), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x07b8, 0xb000), USB_DEVICE_DATA(BOARD_503)},
        /* Gigabyte GN-WLBM101 */
-       { USB_DEVICE(0x1044, 0x8003), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x1044, 0x8003), USB_DEVICE_DATA(BOARD_503)},
        /* Planex GW-US11S */
-       { USB_DEVICE(0x2019, 0x3220), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x2019, 0x3220), USB_DEVICE_DATA(BOARD_503)},
        /* Internal WLAN adapter in h5[4,5]xx series iPAQs */
-       { USB_DEVICE(0x049f, 0x0032), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x049f, 0x0032), USB_DEVICE_DATA(BOARD_503)},
        /* Corega Wireless LAN USB-11 mini */
-       { USB_DEVICE(0x07aa, 0x0011), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x07aa, 0x0011), USB_DEVICE_DATA(BOARD_503)},
        /* Corega Wireless LAN USB-11 mini2 */
-       { USB_DEVICE(0x07aa, 0x0018), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x07aa, 0x0018), USB_DEVICE_DATA(BOARD_503)},
        /* Uniden PCW100 */
-       { USB_DEVICE(0x05dd, 0xff35), USB_DEVICE_DATA(BOARD_503) },
+       {USB_DEVICE(0x05dd, 0xff35), USB_DEVICE_DATA(BOARD_503)},
        /*
         * at76c503-rfmd-acc
         */
        /* SMC2664W */
-       { USB_DEVICE(0x083a, 0x3501), USB_DEVICE_DATA(BOARD_503_ACC) },
+       {USB_DEVICE(0x083a, 0x3501), USB_DEVICE_DATA(BOARD_503_ACC)},
        /* Belkin F5D6050, SMC2662W v2, SMC2662W-AR */
-       { USB_DEVICE(0x0d5c, 0xa002), USB_DEVICE_DATA(BOARD_503_ACC) },
+       {USB_DEVICE(0x0d5c, 0xa002), USB_DEVICE_DATA(BOARD_503_ACC)},
        /*
         * at76c505-rfmd
         */
        /* Generic AT76C505/RFMD */
-       { USB_DEVICE(0x03eb, 0x7606), USB_DEVICE_DATA(BOARD_505) },
+       {USB_DEVICE(0x03eb, 0x7606), USB_DEVICE_DATA(BOARD_505)},
        /*
         * at76c505-rfmd2958
         */
        /* Generic AT76C505/RFMD, OvisLink WL-1130USB */
-       { USB_DEVICE(0x03eb, 0x7613), USB_DEVICE_DATA(BOARD_505_2958) },
+       {USB_DEVICE(0x03eb, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)},
        /* Fiberline FL-WL240U */
-       { USB_DEVICE(0x1371, 0x0014), USB_DEVICE_DATA(BOARD_505_2958) },
+       {USB_DEVICE(0x1371, 0x0014), USB_DEVICE_DATA(BOARD_505_2958)},
        /* CNet CNUSB-611G */
-       { USB_DEVICE(0x1371, 0x0013), USB_DEVICE_DATA(BOARD_505_2958) },
+       {USB_DEVICE(0x1371, 0x0013), USB_DEVICE_DATA(BOARD_505_2958)},
        /* Linksys WUSB11 v2.8 */
-       { USB_DEVICE(0x1915, 0x2233), USB_DEVICE_DATA(BOARD_505_2958) },
+       {USB_DEVICE(0x1915, 0x2233), USB_DEVICE_DATA(BOARD_505_2958)},
        /* Xterasys XN-2122B, IBlitzz BWU613B/BWU613SB */
-       { USB_DEVICE(0x12fd, 0x1001), USB_DEVICE_DATA(BOARD_505_2958) },
+       {USB_DEVICE(0x12fd, 0x1001), USB_DEVICE_DATA(BOARD_505_2958)},
        /* Corega WLAN USB Stick 11 */
-       { USB_DEVICE(0x07aa, 0x7613), USB_DEVICE_DATA(BOARD_505_2958) },
+       {USB_DEVICE(0x07aa, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)},
        /* Microstar MSI Box MS6978 */
-       { USB_DEVICE(0x0db0, 0x1020), USB_DEVICE_DATA(BOARD_505_2958) },
+       {USB_DEVICE(0x0db0, 0x1020), USB_DEVICE_DATA(BOARD_505_2958)},
        /*
         * at76c505a-rfmd2958
         */
        /* Generic AT76C505A device */
-       { USB_DEVICE(0x03eb, 0x7614), USB_DEVICE_DATA(BOARD_505A) },
+       {USB_DEVICE(0x03eb, 0x7614), USB_DEVICE_DATA(BOARD_505A)},
        /* Generic AT76C505AS device */
-       { USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A) },
+       {USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A)},
        /* Siemens Gigaset USB WLAN Adapter 11 */
-       { USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A) },
+       {USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A)},
+       /* OQO Model 01+ Internal Wi-Fi */
+       {USB_DEVICE(0x1557, 0x0002), USB_DEVICE_DATA(BOARD_505A)},
        /*
         * at76c505amx-rfmd
         */
        /* Generic AT76C505AMX device */
-       { USB_DEVICE(0x03eb, 0x7615), USB_DEVICE_DATA(BOARD_505AMX) },
-       { }
+       {USB_DEVICE(0x03eb, 0x7615), USB_DEVICE_DATA(BOARD_505AMX)},
+       {}
 };
 
 MODULE_DEVICE_TABLE(usb, dev_table);
@@ -264,8 +246,26 @@ MODULE_DEVICE_TABLE(usb, dev_table);
 /* Supported rates of this hardware, bit 7 marks basic rates */
 static const u8 hw_rates[] = { 0x82, 0x84, 0x0b, 0x16 };
 
+/* Frequency of each channel in MHz */
+static const long channel_frequency[] = {
+       2412, 2417, 2422, 2427, 2432, 2437, 2442,
+       2447, 2452, 2457, 2462, 2467, 2472, 2484
+};
+
+#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
+
 static const char *const preambles[] = { "long", "short", "auto" };
 
+static const char *const mac_states[] = {
+       [MAC_INIT] = "INIT",
+       [MAC_SCANNING] = "SCANNING",
+       [MAC_AUTH] = "AUTH",
+       [MAC_ASSOC] = "ASSOC",
+       [MAC_JOINING] = "JOINING",
+       [MAC_CONNECTED] = "CONNECTED",
+       [MAC_OWN_IBSS] = "OWN_IBSS"
+};
+
 /* Firmware download */
 /* DFU states */
 #define STATE_IDLE                     0x00
@@ -300,30 +300,17 @@ struct dfu_status {
 
 static inline int at76_is_intersil(enum board_type board)
 {
-       if (board == BOARD_503_ISL3861 || board == BOARD_503_ISL3863)
-               return 1;
-       return 0;
+       return (board == BOARD_503_ISL3861 || board == BOARD_503_ISL3863);
 }
 
 static inline int at76_is_503rfmd(enum board_type board)
 {
-       if (board == BOARD_503 || board == BOARD_503_ACC)
-               return 1;
-       return 0;
-}
-
-static inline int at76_is_505(enum board_type board)
-{
-       if (board == BOARD_505 || board == BOARD_505_2958)
-               return 1;
-       return 0;
+       return (board == BOARD_503 || board == BOARD_503_ACC);
 }
 
 static inline int at76_is_505a(enum board_type board)
 {
-       if (board == BOARD_505A || board == BOARD_505AMX)
-               return 1;
-       return 0;
+       return (board == BOARD_505A || board == BOARD_505AMX);
 }
 
 /* Load a block of the first (internal) part of the firmware */
@@ -504,6 +491,41 @@ exit:
        return ret;
 }
 
+/* Report that the scan results are ready */
+static inline void at76_iwevent_scan_complete(struct net_device *netdev)
+{
+       union iwreq_data wrqu;
+       wrqu.data.length = 0;
+       wrqu.data.flags = 0;
+       wireless_send_event(netdev, SIOCGIWSCAN, &wrqu, NULL);
+       at76_dbg(DBG_WE_EVENTS, "%s: SIOCGIWSCAN sent", netdev->name);
+}
+
+static inline void at76_iwevent_bss_connect(struct net_device *netdev,
+                                           u8 *bssid)
+{
+       union iwreq_data wrqu;
+       wrqu.data.length = 0;
+       wrqu.data.flags = 0;
+       memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN);
+       wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+       wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL);
+       at76_dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", netdev->name,
+                __func__);
+}
+
+static inline void at76_iwevent_bss_disconnect(struct net_device *netdev)
+{
+       union iwreq_data wrqu;
+       wrqu.data.length = 0;
+       wrqu.data.flags = 0;
+       memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
+       wrqu.ap_addr.sa_family = ARPHRD_ETHER;
+       wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL);
+       at76_dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", netdev->name,
+                __func__);
+}
+
 #define HEX2STR_BUFFERS 4
 #define HEX2STR_MAX_LEN 64
 #define BIN2HEX(x) ((x) < 10 ? '0' + (x) : (x) + 'A' - 10)
@@ -575,6 +597,37 @@ static void at76_ledtrig_tx_activity(void)
                mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4);
 }
 
+/* Check if the given ssid is hidden */
+static inline int at76_is_hidden_ssid(u8 *ssid, int length)
+{
+       static const u8 zeros[32];
+
+       if (length == 0)
+               return 1;
+
+       if (length == 1 && ssid[0] == ' ')
+               return 1;
+
+       return (memcmp(ssid, zeros, length) == 0);
+}
+
+static inline void at76_free_bss_list(struct at76_priv *priv)
+{
+       struct list_head *next, *ptr;
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->bss_list_spinlock, flags);
+
+       priv->curr_bss = NULL;
+
+       list_for_each_safe(ptr, next, &priv->bss_list) {
+               list_del(ptr);
+               kfree(list_entry(ptr, struct bss_info, list));
+       }
+
+       spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
+}
+
 static int at76_remap(struct usb_device *udev)
 {
        int ret;
@@ -598,7 +651,7 @@ static int at76_get_op_mode(struct usb_device *udev)
                return -ENOMEM;
        ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x33,
                              USB_TYPE_VENDOR | USB_DIR_IN |
-                             USB_RECIP_INTERFACE, 0x01, 0, &op_mode, 1,
+                             USB_RECIP_INTERFACE, 0x01, 0, op_mode, 1,
                              USB_CTRL_GET_TIMEOUT);
        saved = *op_mode;
        kfree(op_mode);
@@ -676,7 +729,7 @@ exit:
        kfree(hwcfg);
        if (ret < 0)
                printk(KERN_ERR "%s: cannot get HW Config (error %d)\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
 
        return ret;
 }
@@ -685,15 +738,15 @@ static struct reg_domain const *at76_get_reg_domain(u16 code)
 {
        int i;
        static struct reg_domain const fd_tab[] = {
-               { 0x10, "FCC (USA)", 0x7ff },   /* ch 1-11 */
-               { 0x20, "IC (Canada)", 0x7ff }, /* ch 1-11 */
-               { 0x30, "ETSI (most of Europe)", 0x1fff },      /* ch 1-13 */
-               { 0x31, "Spain", 0x600 },       /* ch 10-11 */
-               { 0x32, "France", 0x1e00 },     /* ch 10-13 */
-               { 0x40, "MKK (Japan)", 0x2000 },        /* ch 14 */
-               { 0x41, "MKK1 (Japan)", 0x3fff },       /* ch 1-14 */
-               { 0x50, "Israel", 0x3fc },      /* ch 3-9 */
-               { 0x00, "<unknown>", 0xffffffff }       /* ch 1-32 */
+               {0x10, "FCC (USA)", 0x7ff},     /* ch 1-11 */
+               {0x20, "IC (Canada)", 0x7ff},   /* ch 1-11 */
+               {0x30, "ETSI (most of Europe)", 0x1fff},        /* ch 1-13 */
+               {0x31, "Spain", 0x600}, /* ch 10-11 */
+               {0x32, "France", 0x1e00},       /* ch 10-13 */
+               {0x40, "MKK (Japan)", 0x2000},  /* ch 14 */
+               {0x41, "MKK1 (Japan)", 0x3fff}, /* ch 1-14 */
+               {0x50, "Israel", 0x3fc},        /* ch 3-9 */
+               {0x00, "<unknown>", 0xffffffff} /* ch 1-32 */
        };
 
        /* Last entry is fallback for unknown domain code */
@@ -731,7 +784,7 @@ static inline int at76_get_cmd_status(struct usb_device *udev, u8 cmd)
        ret = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x22,
                              USB_TYPE_VENDOR | USB_DIR_IN |
                              USB_RECIP_INTERFACE, cmd, 0, stat_buf,
-                             sizeof(stat_buf), USB_CTRL_GET_TIMEOUT);
+                             40, USB_CTRL_GET_TIMEOUT);
        if (ret >= 0)
                ret = stat_buf[5];
        kfree(stat_buf);
@@ -739,24 +792,6 @@ static inline int at76_get_cmd_status(struct usb_device *udev, u8 cmd)
        return ret;
 }
 
-#define MAKE_CMD_CASE(c) case (c): return #c
-
-static const char *at76_get_cmd_string(u8 cmd_status)
-{
-       switch (cmd_status) {
-               MAKE_CMD_CASE(CMD_SET_MIB);
-               MAKE_CMD_CASE(CMD_GET_MIB);
-               MAKE_CMD_CASE(CMD_SCAN);
-               MAKE_CMD_CASE(CMD_JOIN);
-               MAKE_CMD_CASE(CMD_START_IBSS);
-               MAKE_CMD_CASE(CMD_RADIO_ON);
-               MAKE_CMD_CASE(CMD_RADIO_OFF);
-               MAKE_CMD_CASE(CMD_STARTUP);
-       }
-
-       return "UNKNOWN";
-}
-
 static int at76_set_card_command(struct usb_device *udev, u8 cmd, void *buf,
                                 int buf_size)
 {
@@ -772,10 +807,6 @@ static int at76_set_card_command(struct usb_device *udev, u8 cmd, void *buf,
        cmd_buf->size = cpu_to_le16(buf_size);
        memcpy(cmd_buf->data, buf, buf_size);
 
-       at76_dbg_dump(DBG_CMD, cmd_buf, sizeof(struct at76_command) + buf_size,
-                     "issuing command %s (0x%02x)",
-                     at76_get_cmd_string(cmd), cmd);
-
        ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x0e,
                              USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE,
                              0, 0, cmd_buf,
@@ -813,13 +844,13 @@ static int at76_wait_completion(struct at76_priv *priv, int cmd)
                status = at76_get_cmd_status(priv->udev, cmd);
                if (status < 0) {
                        printk(KERN_ERR "%s: at76_get_cmd_status failed: %d\n",
-                              wiphy_name(priv->hw->wiphy), status);
+                              priv->netdev->name, status);
                        break;
                }
 
                at76_dbg(DBG_WAIT_COMPLETE,
                         "%s: Waiting on cmd %d, status = %d (%s)",
-                        wiphy_name(priv->hw->wiphy), cmd, status,
+                        priv->netdev->name, cmd, status,
                         at76_get_cmd_status_string(status));
 
                if (status != CMD_STATUS_IN_PROGRESS
@@ -830,7 +861,7 @@ static int at76_wait_completion(struct at76_priv *priv, int cmd)
                if (time_after(jiffies, timeout)) {
                        printk(KERN_ERR
                               "%s: completion timeout for command %d\n",
-                              wiphy_name(priv->hw->wiphy), cmd);
+                              priv->netdev->name, cmd);
                        status = -ETIMEDOUT;
                        break;
                }
@@ -853,7 +884,7 @@ static int at76_set_mib(struct at76_priv *priv, struct set_mib_buffer *buf)
        if (ret != CMD_STATUS_COMPLETE) {
                printk(KERN_INFO
                       "%s: set_mib: at76_wait_completion failed "
-                      "with %d\n", wiphy_name(priv->hw->wiphy), ret);
+                      "with %d\n", priv->netdev->name, ret);
                ret = -EIO;
        }
 
@@ -874,7 +905,7 @@ static int at76_set_radio(struct at76_priv *priv, int enable)
        ret = at76_set_card_command(priv->udev, cmd, NULL, 0);
        if (ret < 0)
                printk(KERN_ERR "%s: at76_set_card_command(%d) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), cmd, ret);
+                      priv->netdev->name, cmd, ret);
        else
                ret = 1;
 
@@ -895,7 +926,44 @@ static int at76_set_pm_mode(struct at76_priv *priv)
        ret = at76_set_mib(priv, &priv->mib_buf);
        if (ret < 0)
                printk(KERN_ERR "%s: set_mib (pm_mode) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
+
+       return ret;
+}
+
+/* Set the association id for power save mode */
+static int at76_set_associd(struct at76_priv *priv, u16 id)
+{
+       int ret = 0;
+
+       priv->mib_buf.type = MIB_MAC_MGMT;
+       priv->mib_buf.size = 2;
+       priv->mib_buf.index = offsetof(struct mib_mac_mgmt, station_id);
+       priv->mib_buf.data.word = cpu_to_le16(id);
+
+       ret = at76_set_mib(priv, &priv->mib_buf);
+       if (ret < 0)
+               printk(KERN_ERR "%s: set_mib (associd) failed: %d\n",
+                      priv->netdev->name, ret);
+
+       return ret;
+}
+
+/* Set the listen interval for power save mode */
+static int at76_set_listen_interval(struct at76_priv *priv, u16 interval)
+{
+       int ret = 0;
+
+       priv->mib_buf.type = MIB_MAC;
+       priv->mib_buf.size = 2;
+       priv->mib_buf.index = offsetof(struct mib_mac, listen_interval);
+       priv->mib_buf.data.word = cpu_to_le16(interval);
+
+       ret = at76_set_mib(priv, &priv->mib_buf);
+       if (ret < 0)
+               printk(KERN_ERR
+                      "%s: set_mib (listen_interval) failed: %d\n",
+                      priv->netdev->name, ret);
 
        return ret;
 }
@@ -912,7 +980,7 @@ static int at76_set_preamble(struct at76_priv *priv, u8 type)
        ret = at76_set_mib(priv, &priv->mib_buf);
        if (ret < 0)
                printk(KERN_ERR "%s: set_mib (preamble) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
 
        return ret;
 }
@@ -929,7 +997,7 @@ static int at76_set_frag(struct at76_priv *priv, u16 size)
        ret = at76_set_mib(priv, &priv->mib_buf);
        if (ret < 0)
                printk(KERN_ERR "%s: set_mib (frag threshold) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
 
        return ret;
 }
@@ -946,7 +1014,7 @@ static int at76_set_rts(struct at76_priv *priv, u16 size)
        ret = at76_set_mib(priv, &priv->mib_buf);
        if (ret < 0)
                printk(KERN_ERR "%s: set_mib (rts) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
 
        return ret;
 }
@@ -963,41 +1031,24 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff)
        ret = at76_set_mib(priv, &priv->mib_buf);
        if (ret < 0)
                printk(KERN_ERR "%s: set_mib (autorate fallback) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
 
        return ret;
 }
 
-static int at76_set_tkip_bssid(struct at76_priv *priv, const void *addr)
+static int at76_add_mac_address(struct at76_priv *priv, void *addr)
 {
        int ret = 0;
 
-       priv->mib_buf.type = MIB_MAC_ENCRYPTION;
+       priv->mib_buf.type = MIB_MAC_ADDR;
        priv->mib_buf.size = ETH_ALEN;
-       priv->mib_buf.index = offsetof(struct mib_mac_encryption, tkip_bssid);
+       priv->mib_buf.index = offsetof(struct mib_mac_addr, mac_addr);
        memcpy(priv->mib_buf.data.addr, addr, ETH_ALEN);
 
        ret = at76_set_mib(priv, &priv->mib_buf);
        if (ret < 0)
-               printk(KERN_ERR "%s: set_mib (MAC_ENCRYPTION, tkip_bssid) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
-
-       return ret;
-}
-
-static int at76_reset_rsc(struct at76_priv *priv)
-{
-       int ret = 0;
-
-       priv->mib_buf.type = MIB_MAC_ENCRYPTION;
-       priv->mib_buf.size = 4 * 8;
-       priv->mib_buf.index = offsetof(struct mib_mac_encryption, key_rsc);
-       memset(priv->mib_buf.data.data, 0 , priv->mib_buf.size);
-
-       ret = at76_set_mib(priv, &priv->mib_buf);
-       if (ret < 0)
-               printk(KERN_ERR "%s: set_mib (MAC_ENCRYPTION, key_rsc) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+               printk(KERN_ERR "%s: set_mib (MAC_ADDR, mac_addr) failed: %d\n",
+                      priv->netdev->name, ret);
 
        return ret;
 }
@@ -1016,16 +1067,16 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv)
                           sizeof(struct mib_mac_addr));
        if (ret < 0) {
                printk(KERN_ERR "%s: at76_get_mib (MAC_ADDR) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
                goto exit;
        }
 
        at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x",
-                wiphy_name(priv->hw->wiphy),
+                priv->netdev->name,
                 mac2str(m->mac_addr), m->res[0], m->res[1]);
        for (i = 0; i < ARRAY_SIZE(m->group_addr); i++)
                at76_dbg(DBG_MIB, "%s: MIB MAC_ADDR: group addr %d: %s, "
-                        "status %d", wiphy_name(priv->hw->wiphy), i,
+                        "status %d", priv->netdev->name, i,
                         mac2str(m->group_addr[i]), m->group_addr_status[i]);
 exit:
        kfree(m);
@@ -1045,13 +1096,13 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv)
                           sizeof(struct mib_mac_wep));
        if (ret < 0) {
                printk(KERN_ERR "%s: at76_get_mib (MAC_WEP) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
                goto exit;
        }
 
        at76_dbg(DBG_MIB, "%s: MIB MAC_WEP: priv_invoked %u def_key_id %u "
                 "key_len %u excl_unencr %u wep_icv_err %u wep_excluded %u "
-                "encr_level %u key %d", wiphy_name(priv->hw->wiphy),
+                "encr_level %u key %d", priv->netdev->name,
                 m->privacy_invoked, m->wep_default_key_id,
                 m->wep_key_mapping_len, m->exclude_unencrypted,
                 le32_to_cpu(m->wep_icv_error_count),
@@ -1063,55 +1114,12 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv)
 
        for (i = 0; i < WEP_KEYS; i++)
                at76_dbg(DBG_MIB, "%s: MIB MAC_WEP: key %d: %s",
-                        wiphy_name(priv->hw->wiphy), i,
+                        priv->netdev->name, i,
                         hex2str(m->wep_default_keyvalue[i], key_len));
 exit:
        kfree(m);
 }
 
-static void at76_dump_mib_mac_encryption(struct at76_priv *priv)
-{
-       int i;
-       int ret;
-       /*int key_len;*/
-       struct mib_mac_encryption *m;
-
-       m = kmalloc(sizeof(struct mib_mac_encryption), GFP_KERNEL);
-       if (!m)
-               return;
-
-       ret = at76_get_mib(priv->udev, MIB_MAC_ENCRYPTION, m,
-                          sizeof(struct mib_mac_encryption));
-       if (ret < 0) {
-               dev_err(&priv->udev->dev,
-                       "%s: at76_get_mib (MAC_ENCRYPTION) failed: %d\n",
-                       wiphy_name(priv->hw->wiphy), ret);
-               goto exit;
-       }
-
-       at76_dbg(DBG_MIB,
-                "%s: MIB MAC_ENCRYPTION: tkip_bssid %s priv_invoked %u "
-                "ciph_key_id %u grp_key_id %u excl_unencr %u "
-                "ckip_key_perm %u wep_icv_err %u wep_excluded %u",
-                wiphy_name(priv->hw->wiphy), mac2str(m->tkip_bssid),
-                m->privacy_invoked, m->cipher_default_key_id,
-                m->cipher_default_group_key_id, m->exclude_unencrypted,
-                m->ckip_key_permutation,
-                le32_to_cpu(m->wep_icv_error_count),
-                le32_to_cpu(m->wep_excluded_count));
-
-       /*key_len = (m->encryption_level == 1) ?
-           WEP_SMALL_KEY_LEN : WEP_LARGE_KEY_LEN;*/
-
-       for (i = 0; i < CIPHER_KEYS; i++)
-               at76_dbg(DBG_MIB, "%s: MIB MAC_ENCRYPTION: key %d: %s",
-                        wiphy_name(priv->hw->wiphy), i,
-                        hex2str(m->cipher_default_keyvalue[i],
-                                CIPHER_KEY_LEN));
-exit:
-       kfree(m);
-}
-
 static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
 {
        int ret;
@@ -1125,7 +1133,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
                           sizeof(struct mib_mac_mgmt));
        if (ret < 0) {
                printk(KERN_ERR "%s: at76_get_mib (MAC_MGMT) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
                goto exit;
        }
 
@@ -1136,7 +1144,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
                 "pm_mode %d ibss_change %d res %d "
                 "multi_domain_capability_implemented %d "
                 "international_roaming %d country_string %.3s",
-                wiphy_name(priv->hw->wiphy), le16_to_cpu(m->beacon_period),
+                priv->netdev->name, le16_to_cpu(m->beacon_period),
                 le16_to_cpu(m->CFP_max_duration),
                 le16_to_cpu(m->medium_occupancy_limit),
                 le16_to_cpu(m->station_id), le16_to_cpu(m->ATIM_window),
@@ -1161,7 +1169,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv)
        ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac));
        if (ret < 0) {
                printk(KERN_ERR "%s: at76_get_mib (MAC) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
                goto exit;
        }
 
@@ -1171,8 +1179,7 @@ static void at76_dump_mib_mac(struct at76_priv *priv)
                 "scan_type %d scan_channel %d probe_delay %u "
                 "min_channel_time %d max_channel_time %d listen_int %d "
                 "desired_ssid %s desired_bssid %s desired_bsstype %d",
-                wiphy_name(priv->hw->wiphy),
-                le32_to_cpu(m->max_tx_msdu_lifetime),
+                priv->netdev->name, le32_to_cpu(m->max_tx_msdu_lifetime),
                 le32_to_cpu(m->max_rx_lifetime),
                 le16_to_cpu(m->frag_threshold), le16_to_cpu(m->rts_threshold),
                 le16_to_cpu(m->cwmin), le16_to_cpu(m->cwmax),
@@ -1198,7 +1205,7 @@ static void at76_dump_mib_phy(struct at76_priv *priv)
        ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy));
        if (ret < 0) {
                printk(KERN_ERR "%s: at76_get_mib (PHY) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
                goto exit;
        }
 
@@ -1207,7 +1214,7 @@ static void at76_dump_mib_phy(struct at76_priv *priv)
                 "mpdu_max_length %d cca_mode_supported %d operation_rate_set "
                 "0x%x 0x%x 0x%x 0x%x channel_id %d current_cca_mode %d "
                 "phy_type %d current_reg_domain %d",
-                wiphy_name(priv->hw->wiphy), le32_to_cpu(m->ed_threshold),
+                priv->netdev->name, le32_to_cpu(m->ed_threshold),
                 le16_to_cpu(m->slot_time), le16_to_cpu(m->sifs_time),
                 le16_to_cpu(m->preamble_length),
                 le16_to_cpu(m->plcp_header_length),
@@ -1231,14 +1238,13 @@ static void at76_dump_mib_local(struct at76_priv *priv)
        ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local));
        if (ret < 0) {
                printk(KERN_ERR "%s: at76_get_mib (LOCAL) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
                goto exit;
        }
 
        at76_dbg(DBG_MIB, "%s: MIB LOCAL: beacon_enable %d "
                 "txautorate_fallback %d ssid_size %d promiscuous_mode %d "
-                "preamble_type %d", wiphy_name(priv->hw->wiphy),
-                m->beacon_enable,
+                "preamble_type %d", priv->netdev->name, m->beacon_enable,
                 m->txautorate_fallback, m->ssid_size, m->promiscuous_mode,
                 m->preamble_type);
 exit:
@@ -1257,21 +1263,118 @@ static void at76_dump_mib_mdomain(struct at76_priv *priv)
                           sizeof(struct mib_mdomain));
        if (ret < 0) {
                printk(KERN_ERR "%s: at76_get_mib (MDOMAIN) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
                goto exit;
        }
 
        at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s",
-                wiphy_name(priv->hw->wiphy),
+                priv->netdev->name,
                 hex2str(m->channel_list, sizeof(m->channel_list)));
 
        at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: tx_powerlevel %s",
-                wiphy_name(priv->hw->wiphy),
+                priv->netdev->name,
                 hex2str(m->tx_powerlevel, sizeof(m->tx_powerlevel)));
 exit:
        kfree(m);
 }
 
+static int at76_get_current_bssid(struct at76_priv *priv)
+{
+       int ret = 0;
+       struct mib_mac_mgmt *mac_mgmt =
+           kmalloc(sizeof(struct mib_mac_mgmt), GFP_KERNEL);
+
+       if (!mac_mgmt) {
+               ret = -ENOMEM;
+               goto exit;
+       }
+
+       ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, mac_mgmt,
+                          sizeof(struct mib_mac_mgmt));
+       if (ret < 0) {
+               printk(KERN_ERR "%s: at76_get_mib failed: %d\n",
+                      priv->netdev->name, ret);
+               goto error;
+       }
+       memcpy(priv->bssid, mac_mgmt->current_bssid, ETH_ALEN);
+       printk(KERN_INFO "%s: using BSSID %s\n", priv->netdev->name,
+              mac2str(priv->bssid));
+error:
+       kfree(mac_mgmt);
+exit:
+       return ret;
+}
+
+static int at76_get_current_channel(struct at76_priv *priv)
+{
+       int ret = 0;
+       struct mib_phy *phy = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
+
+       if (!phy) {
+               ret = -ENOMEM;
+               goto exit;
+       }
+       ret = at76_get_mib(priv->udev, MIB_PHY, phy, sizeof(struct mib_phy));
+       if (ret < 0) {
+               printk(KERN_ERR "%s: at76_get_mib(MIB_PHY) failed: %d\n",
+                      priv->netdev->name, ret);
+               goto error;
+       }
+       priv->channel = phy->channel_id;
+error:
+       kfree(phy);
+exit:
+       return ret;
+}
+
+/**
+ * at76_start_scan - start a scan
+ *
+ * @use_essid - use the configured ESSID in non passive mode
+ */
+static int at76_start_scan(struct at76_priv *priv, int use_essid)
+{
+       struct at76_req_scan scan;
+
+       memset(&scan, 0, sizeof(struct at76_req_scan));
+       memset(scan.bssid, 0xff, ETH_ALEN);
+
+       if (use_essid) {
+               memcpy(scan.essid, priv->essid, IW_ESSID_MAX_SIZE);
+               scan.essid_size = priv->essid_size;
+       } else
+               scan.essid_size = 0;
+
+       /* jal: why should we start at a certain channel? we do scan the whole
+          range allowed by reg domain. */
+       scan.channel = priv->channel;
+
+       /* atmelwlandriver differs between scan type 0 and 1 (active/passive)
+          For ad-hoc mode, it uses type 0 only. */
+       scan.scan_type = priv->scan_mode;
+
+       /* INFO: For probe_delay, not multiplying by 1024 as this will be
+          slightly less than min_channel_time
+          (per spec: probe delay < min. channel time) */
+       scan.min_channel_time = cpu_to_le16(priv->scan_min_time);
+       scan.max_channel_time = cpu_to_le16(priv->scan_max_time);
+       scan.probe_delay = cpu_to_le16(priv->scan_min_time * 1000);
+       scan.international_scan = 0;
+
+       /* other values are set to 0 for type 0 */
+
+       at76_dbg(DBG_PROGRESS, "%s: start_scan (use_essid = %d, intl = %d, "
+                "channel = %d, probe_delay = %d, scan_min_time = %d, "
+                "scan_max_time = %d)",
+                priv->netdev->name, use_essid,
+                scan.international_scan, scan.channel,
+                le16_to_cpu(scan.probe_delay),
+                le16_to_cpu(scan.min_channel_time),
+                le16_to_cpu(scan.max_channel_time));
+
+       return at76_set_card_command(priv->udev, CMD_SCAN, &scan, sizeof(scan));
+}
+
 /* Enable monitor mode */
 static int at76_start_monitor(struct at76_priv *priv)
 {
@@ -1292,6 +1395,86 @@ static int at76_start_monitor(struct at76_priv *priv)
        return ret;
 }
 
+static int at76_start_ibss(struct at76_priv *priv)
+{
+       struct at76_req_ibss bss;
+       int ret;
+
+       WARN_ON(priv->mac_state != MAC_OWN_IBSS);
+       if (priv->mac_state != MAC_OWN_IBSS)
+               return -EBUSY;
+
+       memset(&bss, 0, sizeof(struct at76_req_ibss));
+       memset(bss.bssid, 0xff, ETH_ALEN);
+       memcpy(bss.essid, priv->essid, IW_ESSID_MAX_SIZE);
+       bss.essid_size = priv->essid_size;
+       bss.bss_type = ADHOC_MODE;
+       bss.channel = priv->channel;
+
+       ret = at76_set_card_command(priv->udev, CMD_START_IBSS, &bss,
+                                   sizeof(struct at76_req_ibss));
+       if (ret < 0) {
+               printk(KERN_ERR "%s: start_ibss failed: %d\n",
+                      priv->netdev->name, ret);
+               return ret;
+       }
+
+       ret = at76_wait_completion(priv, CMD_START_IBSS);
+       if (ret != CMD_STATUS_COMPLETE) {
+               printk(KERN_ERR "%s: start_ibss failed to complete, %d\n",
+                      priv->netdev->name, ret);
+               return ret;
+       }
+
+       ret = at76_get_current_bssid(priv);
+       if (ret < 0)
+               return ret;
+
+       ret = at76_get_current_channel(priv);
+       if (ret < 0)
+               return ret;
+
+       /* not sure what this is good for ??? */
+       priv->mib_buf.type = MIB_MAC_MGMT;
+       priv->mib_buf.size = 1;
+       priv->mib_buf.index = offsetof(struct mib_mac_mgmt, ibss_change);
+       priv->mib_buf.data.byte = 0;
+
+       ret = at76_set_mib(priv, &priv->mib_buf);
+       if (ret < 0) {
+               printk(KERN_ERR "%s: set_mib (ibss change ok) failed: %d\n",
+                      priv->netdev->name, ret);
+               return ret;
+       }
+
+       netif_carrier_on(priv->netdev);
+       netif_start_queue(priv->netdev);
+       return 0;
+}
+
+/* Request card to join BSS in managed or ad-hoc mode */
+static int at76_join_bss(struct at76_priv *priv, struct bss_info *ptr)
+{
+       struct at76_req_join join;
+
+       BUG_ON(!ptr);
+
+       memset(&join, 0, sizeof(struct at76_req_join));
+       memcpy(join.bssid, ptr->bssid, ETH_ALEN);
+       memcpy(join.essid, ptr->ssid, ptr->ssid_len);
+       join.essid_size = ptr->ssid_len;
+       join.bss_type = (priv->iw_mode == IW_MODE_ADHOC ? 1 : 2);
+       join.channel = ptr->channel;
+       join.timeout = cpu_to_le16(2000);
+
+       at76_dbg(DBG_PROGRESS,
+                "%s join addr %s ssid %s type %d ch %d timeout %d",
+                priv->netdev->name, mac2str(join.bssid), join.essid,
+                join.bss_type, join.channel, le16_to_cpu(join.timeout));
+       return at76_set_card_command(priv->udev, CMD_JOIN, &join,
+                                    sizeof(struct at76_req_join));
+}
+
 /* Calculate padding from txbuf->wlength (which excludes the USB TX header),
    likely to compensate a flaw in the AT76C503A USB part ... */
 static inline int at76_calc_padding(int wlen)
@@ -1310,6 +1493,14 @@ static inline int at76_calc_padding(int wlen)
        return 0;
 }
 
+/* We are doing a lot of things here in an interrupt. Need
+   a bh handler (Watching TV with a TV card is probably
+   a good test: if you see flickers, we are doing too much.
+   Currently I do see flickers... even with our tasklet :-( )
+   Maybe because the bttv driver and usb-uhci use the same interrupt
+*/
+/* Or maybe because our BH handler is preempting bttv's BH handler.. BHs don't
+ * solve everything.. (alex) */
 static void at76_rx_callback(struct urb *urb)
 {
        struct at76_priv *priv = urb->context;
@@ -1319,67 +1510,1911 @@ static void at76_rx_callback(struct urb *urb)
        return;
 }
 
-static int at76_submit_rx_urb(struct at76_priv *priv)
+static void at76_tx_callback(struct urb *urb)
 {
+       struct at76_priv *priv = urb->context;
+       struct net_device_stats *stats = &priv->stats;
+       unsigned long flags;
+       struct at76_tx_buffer *mgmt_buf;
        int ret;
-       int size;
-       struct sk_buff *skb = priv->rx_skb;
 
-       if (!priv->rx_urb) {
-               printk(KERN_ERR "%s: %s: priv->rx_urb is NULL\n",
-                      wiphy_name(priv->hw->wiphy), __func__);
-               return -EFAULT;
+       switch (urb->status) {
+       case 0:
+               stats->tx_packets++;
+               break;
+       case -ENOENT:
+       case -ECONNRESET:
+               /* urb has been unlinked */
+               return;
+       default:
+               at76_dbg(DBG_URB, "%s - nonzero tx status received: %d",
+                        __func__, urb->status);
+               stats->tx_errors++;
+               break;
        }
 
-       if (!skb) {
-               skb = dev_alloc_skb(sizeof(struct at76_rx_buffer));
-               if (!skb) {
-                       printk(KERN_ERR "%s: cannot allocate rx skbuff\n",
-                              wiphy_name(priv->hw->wiphy));
-                       ret = -ENOMEM;
-                       goto exit;
-               }
-               priv->rx_skb = skb;
-       } else {
-               skb_push(skb, skb_headroom(skb));
-               skb_trim(skb, 0);
-       }
+       spin_lock_irqsave(&priv->mgmt_spinlock, flags);
+       mgmt_buf = priv->next_mgmt_bulk;
+       priv->next_mgmt_bulk = NULL;
+       spin_unlock_irqrestore(&priv->mgmt_spinlock, flags);
 
-       size = skb_tailroom(skb);
-       usb_fill_bulk_urb(priv->rx_urb, priv->udev, priv->rx_pipe,
-                         skb_put(skb, size), size, at76_rx_callback, priv);
-       ret = usb_submit_urb(priv->rx_urb, GFP_ATOMIC);
-       if (ret < 0) {
-               if (ret == -ENODEV)
-                       at76_dbg(DBG_DEVSTART,
-                                "usb_submit_urb returned -ENODEV");
-               else
-                       printk(KERN_ERR "%s: rx, usb_submit_urb failed: %d\n",
-                              wiphy_name(priv->hw->wiphy), ret);
+       if (!mgmt_buf) {
+               netif_wake_queue(priv->netdev);
+               return;
        }
 
-exit:
-       if (ret < 0 && ret != -ENODEV)
-               printk(KERN_ERR "%s: cannot submit rx urb - please unload the "
-                      "driver and/or power cycle the device\n",
-                      wiphy_name(priv->hw->wiphy));
+       /* we don't copy the padding bytes, but add them
+          to the length */
+       memcpy(priv->bulk_out_buffer, mgmt_buf,
+              le16_to_cpu(mgmt_buf->wlength) + AT76_TX_HDRLEN);
+       usb_fill_bulk_urb(priv->tx_urb, priv->udev, priv->tx_pipe,
+                         priv->bulk_out_buffer,
+                         le16_to_cpu(mgmt_buf->wlength) + mgmt_buf->padding +
+                         AT76_TX_HDRLEN, at76_tx_callback, priv);
+       ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
+       if (ret)
+               printk(KERN_ERR "%s: error in tx submit urb: %d\n",
+                      priv->netdev->name, ret);
 
-       return ret;
+       kfree(mgmt_buf);
 }
 
-/* Download external firmware */
-static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
+/* Send a management frame on bulk-out.  txbuf->wlength must be set */
+static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 {
+       unsigned long flags;
        int ret;
-       int op_mode;
-       int blockno = 0;
-       int bsize;
-       u8 *block;
-       u8 *buf = fwe->extfw;
-       int size = fwe->extfw_size;
+       int urb_status;
+       void *oldbuf = NULL;
 
-       if (!buf || !size)
-               return -ENOENT;
+       netif_carrier_off(priv->netdev);        /* stop netdev watchdog */
+       netif_stop_queue(priv->netdev); /* stop tx data packets */
+
+       spin_lock_irqsave(&priv->mgmt_spinlock, flags);
+
+       urb_status = priv->tx_urb->status;
+       if (urb_status == -EINPROGRESS) {
+               /* cannot transmit now, put in the queue */
+               oldbuf = priv->next_mgmt_bulk;
+               priv->next_mgmt_bulk = txbuf;
+       }
+       spin_unlock_irqrestore(&priv->mgmt_spinlock, flags);
+
+       if (oldbuf) {
+               /* a data/mgmt tx is already pending in the URB -
+                  if this is no error in some situations we must
+                  implement a queue or silently modify the old msg */
+               printk(KERN_ERR "%s: removed pending mgmt buffer %s\n",
+                      priv->netdev->name, hex2str(oldbuf, 64));
+               kfree(oldbuf);
+               return 0;
+       }
+
+       txbuf->tx_rate = TX_RATE_1MBIT;
+       txbuf->padding = at76_calc_padding(le16_to_cpu(txbuf->wlength));
+       memset(txbuf->reserved, 0, sizeof(txbuf->reserved));
+
+       if (priv->next_mgmt_bulk)
+               printk(KERN_ERR "%s: URB status %d, but mgmt is pending\n",
+                      priv->netdev->name, urb_status);
+
+       at76_dbg(DBG_TX_MGMT,
+                "%s: tx mgmt: wlen %d tx_rate %d pad %d %s",
+                priv->netdev->name, le16_to_cpu(txbuf->wlength),
+                txbuf->tx_rate, txbuf->padding,
+                hex2str(txbuf->packet, le16_to_cpu(txbuf->wlength)));
+
+       /* txbuf was not consumed above -> send mgmt msg immediately */
+       memcpy(priv->bulk_out_buffer, txbuf,
+              le16_to_cpu(txbuf->wlength) + AT76_TX_HDRLEN);
+       usb_fill_bulk_urb(priv->tx_urb, priv->udev, priv->tx_pipe,
+                         priv->bulk_out_buffer,
+                         le16_to_cpu(txbuf->wlength) + txbuf->padding +
+                         AT76_TX_HDRLEN, at76_tx_callback, priv);
+       ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
+       if (ret)
+               printk(KERN_ERR "%s: error in tx submit urb: %d\n",
+                      priv->netdev->name, ret);
+
+       kfree(txbuf);
+
+       return ret;
+}
+
+/* Go to the next information element */
+static inline void next_ie(struct ieee80211_info_element **ie)
+{
+       *ie = (struct ieee80211_info_element *)(&(*ie)->data[(*ie)->len]);
+}
+
+/* Challenge is the challenge string (in TLV format)
+   we got with seq_nr 2 for shared secret authentication only and
+   send in seq_nr 3 WEP encrypted to prove we have the correct WEP key;
+   otherwise it is NULL */
+static int at76_auth_req(struct at76_priv *priv, struct bss_info *bss,
+                        int seq_nr, struct ieee80211_info_element *challenge)
+{
+       struct at76_tx_buffer *tx_buffer;
+       struct ieee80211_hdr_3addr *mgmt;
+       struct ieee80211_auth *req;
+       int buf_len = (seq_nr != 3 ? AUTH_FRAME_SIZE :
+                      AUTH_FRAME_SIZE + 1 + 1 + challenge->len);
+
+       BUG_ON(!bss);
+       BUG_ON(seq_nr == 3 && !challenge);
+       tx_buffer = kmalloc(buf_len + MAX_PADDING_SIZE, GFP_ATOMIC);
+       if (!tx_buffer)
+               return -ENOMEM;
+
+       req = (struct ieee80211_auth *)tx_buffer->packet;
+       mgmt = &req->header;
+
+       /* make wireless header */
+       /* first auth msg is not encrypted, only the second (seq_nr == 3) */
+       mgmt->frame_ctl =
+           cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH |
+                       (seq_nr == 3 ? IEEE80211_FCTL_PROTECTED : 0));
+
+       mgmt->duration_id = cpu_to_le16(0x8000);
+       memcpy(mgmt->addr1, bss->bssid, ETH_ALEN);
+       memcpy(mgmt->addr2, priv->netdev->dev_addr, ETH_ALEN);
+       memcpy(mgmt->addr3, bss->bssid, ETH_ALEN);
+       mgmt->seq_ctl = cpu_to_le16(0);
+
+       req->algorithm = cpu_to_le16(priv->auth_mode);
+       req->transaction = cpu_to_le16(seq_nr);
+       req->status = cpu_to_le16(0);
+
+       if (seq_nr == 3)
+               memcpy(req->info_element, challenge, 1 + 1 + challenge->len);
+
+       /* init. at76_priv tx header */
+       tx_buffer->wlength = cpu_to_le16(buf_len - AT76_TX_HDRLEN);
+       at76_dbg(DBG_TX_MGMT, "%s: AuthReq bssid %s alg %d seq_nr %d",
+                priv->netdev->name, mac2str(mgmt->addr3),
+                le16_to_cpu(req->algorithm), le16_to_cpu(req->transaction));
+       if (seq_nr == 3)
+               at76_dbg(DBG_TX_MGMT, "%s: AuthReq challenge: %s ...",
+                        priv->netdev->name, hex2str(req->info_element, 18));
+
+       /* either send immediately (if no data tx is pending
+          or put it in pending list */
+       return at76_tx_mgmt(priv, tx_buffer);
+}
+
+static int at76_assoc_req(struct at76_priv *priv, struct bss_info *bss)
+{
+       struct at76_tx_buffer *tx_buffer;
+       struct ieee80211_hdr_3addr *mgmt;
+       struct ieee80211_assoc_request *req;
+       struct ieee80211_info_element *ie;
+       char *essid;
+       int essid_len;
+       u16 capa;
+
+       BUG_ON(!bss);
+
+       tx_buffer = kmalloc(ASSOCREQ_MAX_SIZE + MAX_PADDING_SIZE, GFP_ATOMIC);
+       if (!tx_buffer)
+               return -ENOMEM;
+
+       req = (struct ieee80211_assoc_request *)tx_buffer->packet;
+       mgmt = &req->header;
+       ie = req->info_element;
+
+       /* make wireless header */
+       mgmt->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+                                     IEEE80211_STYPE_ASSOC_REQ);
+
+       mgmt->duration_id = cpu_to_le16(0x8000);
+       memcpy(mgmt->addr1, bss->bssid, ETH_ALEN);
+       memcpy(mgmt->addr2, priv->netdev->dev_addr, ETH_ALEN);
+       memcpy(mgmt->addr3, bss->bssid, ETH_ALEN);
+       mgmt->seq_ctl = cpu_to_le16(0);
+
+       /* we must set the Privacy bit in the capabilities to assure an
+          Agere-based AP with optional WEP transmits encrypted frames
+          to us.  AP only set the Privacy bit in their capabilities
+          if WEP is mandatory in the BSS! */
+       capa = bss->capa;
+       if (priv->wep_enabled)
+               capa |= WLAN_CAPABILITY_PRIVACY;
+       if (priv->preamble_type != PREAMBLE_TYPE_LONG)
+               capa |= WLAN_CAPABILITY_SHORT_PREAMBLE;
+       req->capability = cpu_to_le16(capa);
+
+       req->listen_interval = cpu_to_le16(2 * bss->beacon_interval);
+
+       /* write TLV data elements */
+
+       ie->id = MFIE_TYPE_SSID;
+       ie->len = bss->ssid_len;
+       memcpy(ie->data, bss->ssid, bss->ssid_len);
+       next_ie(&ie);
+
+       ie->id = MFIE_TYPE_RATES;
+       ie->len = sizeof(hw_rates);
+       memcpy(ie->data, hw_rates, sizeof(hw_rates));
+       next_ie(&ie);           /* ie points behind the supp_rates field */
+
+       /* init. at76_priv tx header */
+       tx_buffer->wlength = cpu_to_le16((u8 *)ie - (u8 *)mgmt);
+
+       ie = req->info_element;
+       essid = ie->data;
+       essid_len = min_t(int, IW_ESSID_MAX_SIZE, ie->len);
+
+       next_ie(&ie);           /* points to IE of rates now */
+       at76_dbg(DBG_TX_MGMT,
+                "%s: AssocReq bssid %s capa 0x%04x ssid %.*s rates %s",
+                priv->netdev->name, mac2str(mgmt->addr3),
+                le16_to_cpu(req->capability), essid_len, essid,
+                hex2str(ie->data, ie->len));
+
+       /* either send immediately (if no data tx is pending
+          or put it in pending list */
+       return at76_tx_mgmt(priv, tx_buffer);
+}
+
+/* We got to check the bss_list for old entries */
+static void at76_bss_list_timeout(unsigned long par)
+{
+       struct at76_priv *priv = (struct at76_priv *)par;
+       unsigned long flags;
+       struct list_head *lptr, *nptr;
+       struct bss_info *ptr;
+
+       spin_lock_irqsave(&priv->bss_list_spinlock, flags);
+
+       list_for_each_safe(lptr, nptr, &priv->bss_list) {
+
+               ptr = list_entry(lptr, struct bss_info, list);
+
+               if (ptr != priv->curr_bss
+                   && time_after(jiffies, ptr->last_rx + BSS_LIST_TIMEOUT)) {
+                       at76_dbg(DBG_BSS_TABLE_RM,
+                                "%s: bss_list: removing old BSS %s ch %d",
+                                priv->netdev->name, mac2str(ptr->bssid),
+                                ptr->channel);
+                       list_del(&ptr->list);
+                       kfree(ptr);
+               }
+       }
+       spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
+       /* restart the timer */
+       mod_timer(&priv->bss_list_timer, jiffies + BSS_LIST_TIMEOUT);
+}
+
+static inline void at76_set_mac_state(struct at76_priv *priv,
+                                     enum mac_state mac_state)
+{
+       at76_dbg(DBG_MAC_STATE, "%s state: %s", priv->netdev->name,
+                mac_states[mac_state]);
+       priv->mac_state = mac_state;
+}
+
+static void at76_dump_bss_table(struct at76_priv *priv)
+{
+       struct bss_info *ptr;
+       unsigned long flags;
+       struct list_head *lptr;
+
+       spin_lock_irqsave(&priv->bss_list_spinlock, flags);
+
+       at76_dbg(DBG_BSS_TABLE, "%s BSS table (curr=%p):", priv->netdev->name,
+                priv->curr_bss);
+
+       list_for_each(lptr, &priv->bss_list) {
+               ptr = list_entry(lptr, struct bss_info, list);
+               at76_dbg(DBG_BSS_TABLE, "0x%p: bssid %s channel %d ssid %.*s "
+                        "(%s) capa 0x%04x rates %s rssi %d link %d noise %d",
+                        ptr, mac2str(ptr->bssid), ptr->channel, ptr->ssid_len,
+                        ptr->ssid, hex2str(ptr->ssid, ptr->ssid_len),
+                        ptr->capa, hex2str(ptr->rates, ptr->rates_len),
+                        ptr->rssi, ptr->link_qual, ptr->noise_level);
+       }
+       spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
+}
+
+/* Called upon successful association to mark interface as connected */
+static void at76_work_assoc_done(struct work_struct *work)
+{
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             work_assoc_done);
+
+       mutex_lock(&priv->mtx);
+
+       WARN_ON(priv->mac_state != MAC_ASSOC);
+       WARN_ON(!priv->curr_bss);
+       if (priv->mac_state != MAC_ASSOC || !priv->curr_bss)
+               goto exit;
+
+       if (priv->iw_mode == IW_MODE_INFRA) {
+               if (priv->pm_mode != AT76_PM_OFF) {
+                       /* calculate the listen interval in units of
+                          beacon intervals of the curr_bss */
+                       u32 pm_period_beacon = (priv->pm_period >> 10) /
+                           priv->curr_bss->beacon_interval;
+
+                       pm_period_beacon = max(pm_period_beacon, 2u);
+                       pm_period_beacon = min(pm_period_beacon, 0xffffu);
+
+                       at76_dbg(DBG_PM,
+                                "%s: pm_mode %d assoc id 0x%x listen int %d",
+                                priv->netdev->name, priv->pm_mode,
+                                priv->assoc_id, pm_period_beacon);
+
+                       at76_set_associd(priv, priv->assoc_id);
+                       at76_set_listen_interval(priv, (u16)pm_period_beacon);
+               }
+               schedule_delayed_work(&priv->dwork_beacon, BEACON_TIMEOUT);
+       }
+       at76_set_pm_mode(priv);
+
+       netif_carrier_on(priv->netdev);
+       netif_wake_queue(priv->netdev);
+       at76_set_mac_state(priv, MAC_CONNECTED);
+       at76_iwevent_bss_connect(priv->netdev, priv->curr_bss->bssid);
+       at76_dbg(DBG_PROGRESS, "%s: connected to BSSID %s",
+                priv->netdev->name, mac2str(priv->curr_bss->bssid));
+
+exit:
+       mutex_unlock(&priv->mtx);
+}
+
+/* We only store the new mac address in netdev struct,
+   it gets set when the netdev is opened. */
+static int at76_set_mac_address(struct net_device *netdev, void *addr)
+{
+       struct sockaddr *mac = addr;
+       memcpy(netdev->dev_addr, mac->sa_data, ETH_ALEN);
+       return 1;
+}
+
+static struct net_device_stats *at76_get_stats(struct net_device *netdev)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       return &priv->stats;
+}
+
+static struct iw_statistics *at76_get_wireless_stats(struct net_device *netdev)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       at76_dbg(DBG_IOCTL, "RETURN qual %d level %d noise %d updated %d",
+                priv->wstats.qual.qual, priv->wstats.qual.level,
+                priv->wstats.qual.noise, priv->wstats.qual.updated);
+
+       return &priv->wstats;
+}
+
+static void at76_set_multicast(struct net_device *netdev)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int promisc;
+
+       promisc = ((netdev->flags & IFF_PROMISC) != 0);
+       if (promisc != priv->promisc) {
+               /* This gets called in interrupt, must reschedule */
+               priv->promisc = promisc;
+               schedule_work(&priv->work_set_promisc);
+       }
+}
+
+/* Stop all network activity, flush all pending tasks */
+static void at76_quiesce(struct at76_priv *priv)
+{
+       unsigned long flags;
+
+       netif_stop_queue(priv->netdev);
+       netif_carrier_off(priv->netdev);
+
+       at76_set_mac_state(priv, MAC_INIT);
+
+       cancel_delayed_work(&priv->dwork_get_scan);
+       cancel_delayed_work(&priv->dwork_beacon);
+       cancel_delayed_work(&priv->dwork_auth);
+       cancel_delayed_work(&priv->dwork_assoc);
+       cancel_delayed_work(&priv->dwork_restart);
+
+       spin_lock_irqsave(&priv->mgmt_spinlock, flags);
+       kfree(priv->next_mgmt_bulk);
+       priv->next_mgmt_bulk = NULL;
+       spin_unlock_irqrestore(&priv->mgmt_spinlock, flags);
+}
+
+/*******************************************************************************
+ * at76_priv implementations of iw_handler functions:
+ */
+static int at76_iw_handler_commit(struct net_device *netdev,
+                                 struct iw_request_info *info,
+                                 void *null, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       at76_dbg(DBG_IOCTL, "%s %s: restarting the device", netdev->name,
+                __func__);
+
+       if (priv->mac_state != MAC_INIT)
+               at76_quiesce(priv);
+
+       /* Wait half second before the restart to process subsequent
+        * requests from the same iwconfig in a single restart */
+       schedule_delayed_work(&priv->dwork_restart, HZ / 2);
+
+       return 0;
+}
+
+static int at76_iw_handler_get_name(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   char *name, char *extra)
+{
+       strcpy(name, "IEEE 802.11b");
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWNAME - name %s", netdev->name, name);
+       return 0;
+}
+
+static int at76_iw_handler_set_freq(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   struct iw_freq *freq, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int chan = -1;
+       int ret = -EIWCOMMIT;
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - freq.m %d freq.e %d",
+                netdev->name, freq->m, freq->e);
+
+       if ((freq->e == 0) && (freq->m <= 1000))
+               /* Setting by channel number */
+               chan = freq->m;
+       else {
+               /* Setting by frequency - search the table */
+               int mult = 1;
+               int i;
+
+               for (i = 0; i < (6 - freq->e); i++)
+                       mult *= 10;
+
+               for (i = 0; i < NUM_CHANNELS; i++) {
+                       if (freq->m == (channel_frequency[i] * mult))
+                               chan = i + 1;
+               }
+       }
+
+       if (chan < 1 || !priv->domain)
+               /* non-positive channels are invalid
+                * we need a domain info to set the channel
+                * either that or an invalid frequency was
+                * provided by the user */
+               ret = -EINVAL;
+       else if (!(priv->domain->channel_map & (1 << (chan - 1)))) {
+               printk(KERN_INFO "%s: channel %d not allowed for domain %s\n",
+                      priv->netdev->name, chan, priv->domain->name);
+               ret = -EINVAL;
+       }
+
+       if (ret == -EIWCOMMIT) {
+               priv->channel = chan;
+               at76_dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - ch %d", netdev->name,
+                        chan);
+       }
+
+       return ret;
+}
+
+static int at76_iw_handler_get_freq(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   struct iw_freq *freq, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       freq->m = priv->channel;
+       freq->e = 0;
+
+       if (priv->channel)
+               at76_dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - freq %ld x 10e%d",
+                        netdev->name, channel_frequency[priv->channel - 1], 6);
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - ch %d", netdev->name,
+                priv->channel);
+
+       return 0;
+}
+
+static int at76_iw_handler_set_mode(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   __u32 *mode, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWMODE - %d", netdev->name, *mode);
+
+       if ((*mode != IW_MODE_ADHOC) && (*mode != IW_MODE_INFRA) &&
+           (*mode != IW_MODE_MONITOR))
+               return -EINVAL;
+
+       priv->iw_mode = *mode;
+       if (priv->iw_mode != IW_MODE_INFRA)
+               priv->pm_mode = AT76_PM_OFF;
+
+       return -EIWCOMMIT;
+}
+
+static int at76_iw_handler_get_mode(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   __u32 *mode, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       *mode = priv->iw_mode;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWMODE - %d", netdev->name, *mode);
+
+       return 0;
+}
+
+static int at76_iw_handler_get_range(struct net_device *netdev,
+                                    struct iw_request_info *info,
+                                    struct iw_point *data, char *extra)
+{
+       /* inspired by atmel.c */
+       struct at76_priv *priv = netdev_priv(netdev);
+       struct iw_range *range = (struct iw_range *)extra;
+       int i;
+
+       data->length = sizeof(struct iw_range);
+       memset(range, 0, sizeof(struct iw_range));
+
+       /* TODO: range->throughput = xxxxxx; */
+
+       range->min_nwid = 0x0000;
+       range->max_nwid = 0x0000;
+
+       /* this driver doesn't maintain sensitivity information */
+       range->sensitivity = 0;
+
+       range->max_qual.qual = 100;
+       range->max_qual.level = 100;
+       range->max_qual.noise = 0;
+       range->max_qual.updated = IW_QUAL_NOISE_INVALID;
+
+       range->avg_qual.qual = 50;
+       range->avg_qual.level = 50;
+       range->avg_qual.noise = 0;
+       range->avg_qual.updated = IW_QUAL_NOISE_INVALID;
+
+       range->bitrate[0] = 1000000;
+       range->bitrate[1] = 2000000;
+       range->bitrate[2] = 5500000;
+       range->bitrate[3] = 11000000;
+       range->num_bitrates = 4;
+
+       range->min_rts = 0;
+       range->max_rts = MAX_RTS_THRESHOLD;
+
+       range->min_frag = MIN_FRAG_THRESHOLD;
+       range->max_frag = MAX_FRAG_THRESHOLD;
+
+       range->pmp_flags = IW_POWER_PERIOD;
+       range->pmt_flags = IW_POWER_ON;
+       range->pm_capa = IW_POWER_PERIOD | IW_POWER_ALL_R;
+
+       range->encoding_size[0] = WEP_SMALL_KEY_LEN;
+       range->encoding_size[1] = WEP_LARGE_KEY_LEN;
+       range->num_encoding_sizes = 2;
+       range->max_encoding_tokens = WEP_KEYS;
+
+       /* both WL-240U and Linksys WUSB11 v2.6 specify 15 dBm as output power
+          - take this for all (ignore antenna gains) */
+       range->txpower[0] = 15;
+       range->num_txpower = 1;
+       range->txpower_capa = IW_TXPOW_DBM;
+
+       range->we_version_source = WIRELESS_EXT;
+       range->we_version_compiled = WIRELESS_EXT;
+
+       /* same as the values used in atmel.c */
+       range->retry_capa = IW_RETRY_LIMIT;
+       range->retry_flags = IW_RETRY_LIMIT;
+       range->r_time_flags = 0;
+       range->min_retry = 1;
+       range->max_retry = 255;
+
+       range->num_channels = NUM_CHANNELS;
+       range->num_frequency = 0;
+
+       for (i = 0; i < NUM_CHANNELS; i++) {
+               /* test if channel map bit is raised */
+               if (priv->domain->channel_map & (0x1 << i)) {
+                       range->num_frequency += 1;
+
+                       range->freq[i].i = i + 1;
+                       range->freq[i].m = channel_frequency[i] * 100000;
+                       range->freq[i].e = 1;   /* freq * 10^1 */
+               }
+       }
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWRANGE", netdev->name);
+
+       return 0;
+}
+
+static int at76_iw_handler_set_spy(struct net_device *netdev,
+                                  struct iw_request_info *info,
+                                  struct iw_point *data, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = 0;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWSPY - number of addresses %d",
+                netdev->name, data->length);
+
+       spin_lock_bh(&priv->spy_spinlock);
+       ret = iw_handler_set_spy(priv->netdev, info, (union iwreq_data *)data,
+                                extra);
+       spin_unlock_bh(&priv->spy_spinlock);
+
+       return ret;
+}
+
+static int at76_iw_handler_get_spy(struct net_device *netdev,
+                                  struct iw_request_info *info,
+                                  struct iw_point *data, char *extra)
+{
+
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = 0;
+
+       spin_lock_bh(&priv->spy_spinlock);
+       ret = iw_handler_get_spy(priv->netdev, info,
+                                (union iwreq_data *)data, extra);
+       spin_unlock_bh(&priv->spy_spinlock);
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWSPY - number of addresses %d",
+                netdev->name, data->length);
+
+       return ret;
+}
+
+static int at76_iw_handler_set_thrspy(struct net_device *netdev,
+                                     struct iw_request_info *info,
+                                     struct iw_point *data, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWTHRSPY - number of addresses %d)",
+                netdev->name, data->length);
+
+       spin_lock_bh(&priv->spy_spinlock);
+       ret = iw_handler_set_thrspy(netdev, info, (union iwreq_data *)data,
+                                   extra);
+       spin_unlock_bh(&priv->spy_spinlock);
+
+       return ret;
+}
+
+static int at76_iw_handler_get_thrspy(struct net_device *netdev,
+                                     struct iw_request_info *info,
+                                     struct iw_point *data, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret;
+
+       spin_lock_bh(&priv->spy_spinlock);
+       ret = iw_handler_get_thrspy(netdev, info, (union iwreq_data *)data,
+                                   extra);
+       spin_unlock_bh(&priv->spy_spinlock);
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWTHRSPY - number of addresses %d)",
+                netdev->name, data->length);
+
+       return ret;
+}
+
+static int at76_iw_handler_set_wap(struct net_device *netdev,
+                                  struct iw_request_info *info,
+                                  struct sockaddr *ap_addr, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWAP - wap/bssid %s", netdev->name,
+                mac2str(ap_addr->sa_data));
+
+       /* if the incoming address == ff:ff:ff:ff:ff:ff, the user has
+          chosen any or auto AP preference */
+       if (is_broadcast_ether_addr(ap_addr->sa_data)
+           || is_zero_ether_addr(ap_addr->sa_data))
+               priv->wanted_bssid_valid = 0;
+       else {
+               /* user wants to set a preferred AP address */
+               priv->wanted_bssid_valid = 1;
+               memcpy(priv->wanted_bssid, ap_addr->sa_data, ETH_ALEN);
+       }
+
+       return -EIWCOMMIT;
+}
+
+static int at76_iw_handler_get_wap(struct net_device *netdev,
+                                  struct iw_request_info *info,
+                                  struct sockaddr *ap_addr, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       ap_addr->sa_family = ARPHRD_ETHER;
+       memcpy(ap_addr->sa_data, priv->bssid, ETH_ALEN);
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWAP - wap/bssid %s", netdev->name,
+                mac2str(ap_addr->sa_data));
+
+       return 0;
+}
+
+static int at76_iw_handler_set_scan(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   union iwreq_data *wrqu, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = 0;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWSCAN", netdev->name);
+
+       if (mutex_lock_interruptible(&priv->mtx))
+               return -EINTR;
+
+       if (!netif_running(netdev)) {
+               ret = -ENETDOWN;
+               goto exit;
+       }
+
+       /* jal: we don't allow "iwlist ethX scan" while we are
+          in monitor mode */
+       if (priv->iw_mode == IW_MODE_MONITOR) {
+               ret = -EBUSY;
+               goto exit;
+       }
+
+       /* Discard old scan results */
+       if ((jiffies - priv->last_scan) > (20 * HZ))
+               priv->scan_state = SCAN_IDLE;
+       priv->last_scan = jiffies;
+
+       /* Initiate a scan command */
+       if (priv->scan_state == SCAN_IN_PROGRESS) {
+               ret = -EBUSY;
+               goto exit;
+       }
+
+       priv->scan_state = SCAN_IN_PROGRESS;
+
+       at76_quiesce(priv);
+
+       /* Try to do passive or active scan if WE asks as. */
+       if (wrqu->data.length
+           && wrqu->data.length == sizeof(struct iw_scan_req)) {
+               struct iw_scan_req *req = (struct iw_scan_req *)extra;
+
+               if (req->scan_type == IW_SCAN_TYPE_PASSIVE)
+                       priv->scan_mode = SCAN_TYPE_PASSIVE;
+               else if (req->scan_type == IW_SCAN_TYPE_ACTIVE)
+                       priv->scan_mode = SCAN_TYPE_ACTIVE;
+
+               /* Sanity check values? */
+               if (req->min_channel_time > 0)
+                       priv->scan_min_time = req->min_channel_time;
+
+               if (req->max_channel_time > 0)
+                       priv->scan_max_time = req->max_channel_time;
+       }
+
+       /* change to scanning state */
+       at76_set_mac_state(priv, MAC_SCANNING);
+       schedule_work(&priv->work_start_scan);
+
+exit:
+       mutex_unlock(&priv->mtx);
+       return ret;
+}
+
+static int at76_iw_handler_get_scan(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   struct iw_point *data, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       unsigned long flags;
+       struct list_head *lptr, *nptr;
+       struct bss_info *curr_bss;
+       struct iw_event *iwe = kmalloc(sizeof(struct iw_event), GFP_KERNEL);
+       char *curr_val, *curr_pos = extra;
+       int i;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWSCAN", netdev->name);
+
+       if (!iwe)
+               return -ENOMEM;
+
+       if (priv->scan_state != SCAN_COMPLETED) {
+               /* scan not yet finished */
+               kfree(iwe);
+               return -EAGAIN;
+       }
+
+       spin_lock_irqsave(&priv->bss_list_spinlock, flags);
+
+       list_for_each_safe(lptr, nptr, &priv->bss_list) {
+               curr_bss = list_entry(lptr, struct bss_info, list);
+
+               iwe->cmd = SIOCGIWAP;
+               iwe->u.ap_addr.sa_family = ARPHRD_ETHER;
+               memcpy(iwe->u.ap_addr.sa_data, curr_bss->bssid, 6);
+               curr_pos = iwe_stream_add_event(info, curr_pos,
+                                               extra + IW_SCAN_MAX_DATA, iwe,
+                                               IW_EV_ADDR_LEN);
+
+               iwe->u.data.length = curr_bss->ssid_len;
+               iwe->cmd = SIOCGIWESSID;
+               iwe->u.data.flags = 1;
+
+               curr_pos = iwe_stream_add_point(info, curr_pos,
+                                               extra + IW_SCAN_MAX_DATA, iwe,
+                                               curr_bss->ssid);
+
+               iwe->cmd = SIOCGIWMODE;
+               iwe->u.mode = (curr_bss->capa & WLAN_CAPABILITY_IBSS) ?
+                   IW_MODE_ADHOC :
+                   (curr_bss->capa & WLAN_CAPABILITY_ESS) ?
+                   IW_MODE_MASTER : IW_MODE_AUTO;
+               /* IW_MODE_AUTO = 0 which I thought is
+                * the most logical value to return in this case */
+               curr_pos = iwe_stream_add_event(info, curr_pos,
+                                               extra + IW_SCAN_MAX_DATA, iwe,
+                                               IW_EV_UINT_LEN);
+
+               iwe->cmd = SIOCGIWFREQ;
+               iwe->u.freq.m = curr_bss->channel;
+               iwe->u.freq.e = 0;
+               curr_pos = iwe_stream_add_event(info, curr_pos,
+                                               extra + IW_SCAN_MAX_DATA, iwe,
+                                               IW_EV_FREQ_LEN);
+
+               iwe->cmd = SIOCGIWENCODE;
+               if (curr_bss->capa & WLAN_CAPABILITY_PRIVACY)
+                       iwe->u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+               else
+                       iwe->u.data.flags = IW_ENCODE_DISABLED;
+
+               iwe->u.data.length = 0;
+               curr_pos = iwe_stream_add_point(info, curr_pos,
+                                               extra + IW_SCAN_MAX_DATA, iwe,
+                                               NULL);
+
+               /* Add quality statistics */
+               iwe->cmd = IWEVQUAL;
+               iwe->u.qual.noise = 0;
+               iwe->u.qual.updated =
+                   IW_QUAL_NOISE_INVALID | IW_QUAL_LEVEL_UPDATED;
+               iwe->u.qual.level = (curr_bss->rssi * 100 / 42);
+               if (iwe->u.qual.level > 100)
+                       iwe->u.qual.level = 100;
+               if (at76_is_intersil(priv->board_type))
+                       iwe->u.qual.qual = curr_bss->link_qual;
+               else {
+                       iwe->u.qual.qual = 0;
+                       iwe->u.qual.updated |= IW_QUAL_QUAL_INVALID;
+               }
+               /* Add new value to event */
+               curr_pos = iwe_stream_add_event(info, curr_pos,
+                                               extra + IW_SCAN_MAX_DATA, iwe,
+                                               IW_EV_QUAL_LEN);
+
+               /* Rate: stuffing multiple values in a single event requires
+                * a bit more of magic - Jean II */
+               curr_val = curr_pos + IW_EV_LCP_LEN;
+
+               iwe->cmd = SIOCGIWRATE;
+               /* Those two flags are ignored... */
+               iwe->u.bitrate.fixed = 0;
+               iwe->u.bitrate.disabled = 0;
+               /* Max 8 values */
+               for (i = 0; i < curr_bss->rates_len; i++) {
+                       /* Bit rate given in 500 kb/s units (+ 0x80) */
+                       iwe->u.bitrate.value =
+                           ((curr_bss->rates[i] & 0x7f) * 500000);
+                       /* Add new value to event */
+                       curr_val = iwe_stream_add_value(info, curr_pos,
+                                                       curr_val,
+                                                       extra +
+                                                       IW_SCAN_MAX_DATA, iwe,
+                                                       IW_EV_PARAM_LEN);
+               }
+
+               /* Check if we added any event */
+               if ((curr_val - curr_pos) > IW_EV_LCP_LEN)
+                       curr_pos = curr_val;
+
+               /* more information may be sent back using IWECUSTOM */
+
+       }
+
+       spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
+
+       data->length = (curr_pos - extra);
+       data->flags = 0;
+
+       kfree(iwe);
+       return 0;
+}
+
+static int at76_iw_handler_set_essid(struct net_device *netdev,
+                                    struct iw_request_info *info,
+                                    struct iw_point *data, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWESSID - %s", netdev->name, extra);
+
+       if (data->flags) {
+               memcpy(priv->essid, extra, data->length);
+               priv->essid_size = data->length;
+       } else
+               priv->essid_size = 0;   /* Use any SSID */
+
+       return -EIWCOMMIT;
+}
+
+static int at76_iw_handler_get_essid(struct net_device *netdev,
+                                    struct iw_request_info *info,
+                                    struct iw_point *data, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       if (priv->essid_size) {
+               /* not the ANY ssid in priv->essid */
+               data->flags = 1;
+               data->length = priv->essid_size;
+               memcpy(extra, priv->essid, data->length);
+       } else {
+               /* the ANY ssid was specified */
+               if (priv->mac_state == MAC_CONNECTED && priv->curr_bss) {
+                       /* report the SSID we have found */
+                       data->flags = 1;
+                       data->length = priv->curr_bss->ssid_len;
+                       memcpy(extra, priv->curr_bss->ssid, data->length);
+               } else {
+                       /* report ANY back */
+                       data->flags = 0;
+                       data->length = 0;
+               }
+       }
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %.*s", netdev->name,
+                data->length, extra);
+
+       return 0;
+}
+
+static int at76_iw_handler_set_rate(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   struct iw_param *bitrate, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = -EIWCOMMIT;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWRATE - %d", netdev->name,
+                bitrate->value);
+
+       switch (bitrate->value) {
+       case -1:
+               priv->txrate = TX_RATE_AUTO;
+               break;          /* auto rate */
+       case 1000000:
+               priv->txrate = TX_RATE_1MBIT;
+               break;
+       case 2000000:
+               priv->txrate = TX_RATE_2MBIT;
+               break;
+       case 5500000:
+               priv->txrate = TX_RATE_5_5MBIT;
+               break;
+       case 11000000:
+               priv->txrate = TX_RATE_11MBIT;
+               break;
+       default:
+               ret = -EINVAL;
+       }
+
+       return ret;
+}
+
+static int at76_iw_handler_get_rate(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   struct iw_param *bitrate, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = 0;
+
+       switch (priv->txrate) {
+               /* return max rate if RATE_AUTO */
+       case TX_RATE_AUTO:
+               bitrate->value = 11000000;
+               break;
+       case TX_RATE_1MBIT:
+               bitrate->value = 1000000;
+               break;
+       case TX_RATE_2MBIT:
+               bitrate->value = 2000000;
+               break;
+       case TX_RATE_5_5MBIT:
+               bitrate->value = 5500000;
+               break;
+       case TX_RATE_11MBIT:
+               bitrate->value = 11000000;
+               break;
+       default:
+               ret = -EINVAL;
+       }
+
+       bitrate->fixed = (priv->txrate != TX_RATE_AUTO);
+       bitrate->disabled = 0;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWRATE - %d", netdev->name,
+                bitrate->value);
+
+       return ret;
+}
+
+static int at76_iw_handler_set_rts(struct net_device *netdev,
+                                  struct iw_request_info *info,
+                                  struct iw_param *rts, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = -EIWCOMMIT;
+       int rthr = rts->value;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWRTS - value %d disabled %s",
+                netdev->name, rts->value, (rts->disabled) ? "true" : "false");
+
+       if (rts->disabled)
+               rthr = MAX_RTS_THRESHOLD;
+
+       if ((rthr < 0) || (rthr > MAX_RTS_THRESHOLD))
+               ret = -EINVAL;
+       else
+               priv->rts_threshold = rthr;
+
+       return ret;
+}
+
+static int at76_iw_handler_get_rts(struct net_device *netdev,
+                                  struct iw_request_info *info,
+                                  struct iw_param *rts, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       rts->value = priv->rts_threshold;
+       rts->disabled = (rts->value >= MAX_RTS_THRESHOLD);
+       rts->fixed = 1;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWRTS - value %d disabled %s",
+                netdev->name, rts->value, (rts->disabled) ? "true" : "false");
+
+       return 0;
+}
+
+static int at76_iw_handler_set_frag(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   struct iw_param *frag, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = -EIWCOMMIT;
+       int fthr = frag->value;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWFRAG - value %d, disabled %s",
+                netdev->name, frag->value,
+                (frag->disabled) ? "true" : "false");
+
+       if (frag->disabled)
+               fthr = MAX_FRAG_THRESHOLD;
+
+       if ((fthr < MIN_FRAG_THRESHOLD) || (fthr > MAX_FRAG_THRESHOLD))
+               ret = -EINVAL;
+       else
+               priv->frag_threshold = fthr & ~0x1;     /* get an even value */
+
+       return ret;
+}
+
+static int at76_iw_handler_get_frag(struct net_device *netdev,
+                                   struct iw_request_info *info,
+                                   struct iw_param *frag, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       frag->value = priv->frag_threshold;
+       frag->disabled = (frag->value >= MAX_FRAG_THRESHOLD);
+       frag->fixed = 1;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWFRAG - value %d, disabled %s",
+                netdev->name, frag->value,
+                (frag->disabled) ? "true" : "false");
+
+       return 0;
+}
+
+static int at76_iw_handler_get_txpow(struct net_device *netdev,
+                                    struct iw_request_info *info,
+                                    struct iw_param *power, char *extra)
+{
+       power->value = 15;
+       power->fixed = 1;       /* No power control */
+       power->disabled = 0;
+       power->flags = IW_TXPOW_DBM;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWTXPOW - txpow %d dBm", netdev->name,
+                power->value);
+
+       return 0;
+}
+
+/* jal: short retry is handled by the firmware (at least 0.90.x),
+   while long retry is not (?) */
+static int at76_iw_handler_set_retry(struct net_device *netdev,
+                                    struct iw_request_info *info,
+                                    struct iw_param *retry, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = -EIWCOMMIT;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWRETRY disabled %d flags 0x%x val %d",
+                netdev->name, retry->disabled, retry->flags, retry->value);
+
+       if (!retry->disabled && (retry->flags & IW_RETRY_LIMIT)) {
+               if ((retry->flags & IW_RETRY_MIN) ||
+                   !(retry->flags & IW_RETRY_MAX))
+                       priv->short_retry_limit = retry->value;
+               else
+                       ret = -EINVAL;
+       } else
+               ret = -EINVAL;
+
+       return ret;
+}
+
+/* Adapted (ripped) from atmel.c */
+static int at76_iw_handler_get_retry(struct net_device *netdev,
+                                    struct iw_request_info *info,
+                                    struct iw_param *retry, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWRETRY", netdev->name);
+
+       retry->disabled = 0;    /* Can't be disabled */
+       retry->flags = IW_RETRY_LIMIT;
+       retry->value = priv->short_retry_limit;
+
+       return 0;
+}
+
+static int at76_iw_handler_set_encode(struct net_device *netdev,
+                                     struct iw_request_info *info,
+                                     struct iw_point *encoding, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int index = (encoding->flags & IW_ENCODE_INDEX) - 1;
+       int len = encoding->length;
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - enc.flags %08x "
+                "pointer %p len %d", netdev->name, encoding->flags,
+                encoding->pointer, encoding->length);
+       at76_dbg(DBG_IOCTL,
+                "%s: SIOCSIWENCODE - old wepstate: enabled %s key_id %d "
+                "auth_mode %s", netdev->name,
+                (priv->wep_enabled) ? "true" : "false", priv->wep_key_id,
+                (priv->auth_mode ==
+                 WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
+
+       /* take the old default key if index is invalid */
+       if ((index < 0) || (index >= WEP_KEYS))
+               index = priv->wep_key_id;
+
+       if (len > 0) {
+               if (len > WEP_LARGE_KEY_LEN)
+                       len = WEP_LARGE_KEY_LEN;
+
+               memset(priv->wep_keys[index], 0, WEP_KEY_LEN);
+               memcpy(priv->wep_keys[index], extra, len);
+               priv->wep_keys_len[index] = (len <= WEP_SMALL_KEY_LEN) ?
+                   WEP_SMALL_KEY_LEN : WEP_LARGE_KEY_LEN;
+               priv->wep_enabled = 1;
+       }
+
+       priv->wep_key_id = index;
+       priv->wep_enabled = ((encoding->flags & IW_ENCODE_DISABLED) == 0);
+
+       if (encoding->flags & IW_ENCODE_RESTRICTED)
+               priv->auth_mode = WLAN_AUTH_SHARED_KEY;
+       if (encoding->flags & IW_ENCODE_OPEN)
+               priv->auth_mode = WLAN_AUTH_OPEN;
+
+       at76_dbg(DBG_IOCTL,
+                "%s: SIOCSIWENCODE - new wepstate: enabled %s key_id %d "
+                "key_len %d auth_mode %s", netdev->name,
+                (priv->wep_enabled) ? "true" : "false", priv->wep_key_id + 1,
+                priv->wep_keys_len[priv->wep_key_id],
+                (priv->auth_mode ==
+                 WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
+
+       return -EIWCOMMIT;
+}
+
+static int at76_iw_handler_get_encode(struct net_device *netdev,
+                                     struct iw_request_info *info,
+                                     struct iw_point *encoding, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int index = (encoding->flags & IW_ENCODE_INDEX) - 1;
+
+       if ((index < 0) || (index >= WEP_KEYS))
+               index = priv->wep_key_id;
+
+       encoding->flags =
+           (priv->auth_mode == WLAN_AUTH_SHARED_KEY) ?
+           IW_ENCODE_RESTRICTED : IW_ENCODE_OPEN;
+
+       if (!priv->wep_enabled)
+               encoding->flags |= IW_ENCODE_DISABLED;
+
+       if (encoding->pointer) {
+               encoding->length = priv->wep_keys_len[index];
+
+               memcpy(extra, priv->wep_keys[index], priv->wep_keys_len[index]);
+
+               encoding->flags |= (index + 1);
+       }
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWENCODE - enc.flags %08x "
+                "pointer %p len %d", netdev->name, encoding->flags,
+                encoding->pointer, encoding->length);
+       at76_dbg(DBG_IOCTL,
+                "%s: SIOCGIWENCODE - wepstate: enabled %s key_id %d "
+                "key_len %d auth_mode %s", netdev->name,
+                (priv->wep_enabled) ? "true" : "false", priv->wep_key_id + 1,
+                priv->wep_keys_len[priv->wep_key_id],
+                (priv->auth_mode ==
+                 WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
+
+       return 0;
+}
+
+static int at76_iw_handler_set_power(struct net_device *netdev,
+                                    struct iw_request_info *info,
+                                    struct iw_param *prq, char *extra)
+{
+       int err = -EIWCOMMIT;
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       at76_dbg(DBG_IOCTL,
+                "%s: SIOCSIWPOWER - disabled %s flags 0x%x value 0x%x",
+                netdev->name, (prq->disabled) ? "true" : "false", prq->flags,
+                prq->value);
+
+       if (prq->disabled)
+               priv->pm_mode = AT76_PM_OFF;
+       else {
+               switch (prq->flags & IW_POWER_MODE) {
+               case IW_POWER_ALL_R:
+               case IW_POWER_ON:
+                       break;
+               default:
+                       err = -EINVAL;
+                       goto exit;
+               }
+               if (prq->flags & IW_POWER_PERIOD)
+                       priv->pm_period = prq->value;
+
+               if (prq->flags & IW_POWER_TIMEOUT) {
+                       err = -EINVAL;
+                       goto exit;
+               }
+               priv->pm_mode = AT76_PM_ON;
+       }
+exit:
+       return err;
+}
+
+static int at76_iw_handler_get_power(struct net_device *netdev,
+                                    struct iw_request_info *info,
+                                    struct iw_param *power, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       power->disabled = (priv->pm_mode == AT76_PM_OFF);
+       if (!power->disabled) {
+               power->flags = IW_POWER_PERIOD | IW_POWER_ALL_R;
+               power->value = priv->pm_period;
+       }
+
+       at76_dbg(DBG_IOCTL, "%s: SIOCGIWPOWER - %s flags 0x%x value 0x%x",
+                netdev->name, power->disabled ? "disabled" : "enabled",
+                power->flags, power->value);
+
+       return 0;
+}
+
+/*******************************************************************************
+ * Private IOCTLS
+ */
+static int at76_iw_set_short_preamble(struct net_device *netdev,
+                                     struct iw_request_info *info, char *name,
+                                     char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int val = *((int *)name);
+       int ret = -EIWCOMMIT;
+
+       at76_dbg(DBG_IOCTL, "%s: AT76_SET_SHORT_PREAMBLE, %d",
+                netdev->name, val);
+
+       if (val < PREAMBLE_TYPE_LONG || val > PREAMBLE_TYPE_AUTO)
+               ret = -EINVAL;
+       else
+               priv->preamble_type = val;
+
+       return ret;
+}
+
+static int at76_iw_get_short_preamble(struct net_device *netdev,
+                                     struct iw_request_info *info,
+                                     union iwreq_data *wrqu, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       snprintf(wrqu->name, sizeof(wrqu->name), "%s (%d)",
+                preambles[priv->preamble_type], priv->preamble_type);
+       return 0;
+}
+
+static int at76_iw_set_debug(struct net_device *netdev,
+                            struct iw_request_info *info,
+                            struct iw_point *data, char *extra)
+{
+       char *ptr;
+       u32 val;
+
+       if (data->length > 0) {
+               val = simple_strtol(extra, &ptr, 0);
+
+               if (ptr == extra)
+                       val = DBG_DEFAULTS;
+
+               at76_dbg(DBG_IOCTL, "%s: AT76_SET_DEBUG input %d: %s -> 0x%x",
+                        netdev->name, data->length, extra, val);
+       } else
+               val = DBG_DEFAULTS;
+
+       at76_dbg(DBG_IOCTL, "%s: AT76_SET_DEBUG, old 0x%x, new 0x%x",
+                netdev->name, at76_debug, val);
+
+       /* jal: some more output to pin down lockups */
+       at76_dbg(DBG_IOCTL, "%s: netif running %d queue_stopped %d "
+                "carrier_ok %d", netdev->name, netif_running(netdev),
+                netif_queue_stopped(netdev), netif_carrier_ok(netdev));
+
+       at76_debug = val;
+
+       return 0;
+}
+
+static int at76_iw_get_debug(struct net_device *netdev,
+                            struct iw_request_info *info,
+                            union iwreq_data *wrqu, char *extra)
+{
+       snprintf(wrqu->name, sizeof(wrqu->name), "0x%08x", at76_debug);
+       return 0;
+}
+
+static int at76_iw_set_powersave_mode(struct net_device *netdev,
+                                     struct iw_request_info *info, char *name,
+                                     char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int val = *((int *)name);
+       int ret = -EIWCOMMIT;
+
+       at76_dbg(DBG_IOCTL, "%s: AT76_SET_POWERSAVE_MODE, %d (%s)",
+                netdev->name, val,
+                val == AT76_PM_OFF ? "active" : val == AT76_PM_ON ? "save" :
+                val == AT76_PM_SMART ? "smart save" : "<invalid>");
+       if (val < AT76_PM_OFF || val > AT76_PM_SMART)
+               ret = -EINVAL;
+       else
+               priv->pm_mode = val;
+
+       return ret;
+}
+
+static int at76_iw_get_powersave_mode(struct net_device *netdev,
+                                     struct iw_request_info *info,
+                                     union iwreq_data *wrqu, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int *param = (int *)extra;
+
+       param[0] = priv->pm_mode;
+       return 0;
+}
+
+static int at76_iw_set_scan_times(struct net_device *netdev,
+                                 struct iw_request_info *info, char *name,
+                                 char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int mint = *((int *)name);
+       int maxt = *((int *)name + 1);
+       int ret = -EIWCOMMIT;
+
+       at76_dbg(DBG_IOCTL, "%s: AT76_SET_SCAN_TIMES - min %d max %d",
+                netdev->name, mint, maxt);
+       if (mint <= 0 || maxt <= 0 || mint > maxt)
+               ret = -EINVAL;
+       else {
+               priv->scan_min_time = mint;
+               priv->scan_max_time = maxt;
+       }
+
+       return ret;
+}
+
+static int at76_iw_get_scan_times(struct net_device *netdev,
+                                 struct iw_request_info *info,
+                                 union iwreq_data *wrqu, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int *param = (int *)extra;
+
+       param[0] = priv->scan_min_time;
+       param[1] = priv->scan_max_time;
+       return 0;
+}
+
+static int at76_iw_set_scan_mode(struct net_device *netdev,
+                                struct iw_request_info *info, char *name,
+                                char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int val = *((int *)name);
+       int ret = -EIWCOMMIT;
+
+       at76_dbg(DBG_IOCTL, "%s: AT76_SET_SCAN_MODE - mode %s",
+                netdev->name, (val = SCAN_TYPE_ACTIVE) ? "active" :
+                (val = SCAN_TYPE_PASSIVE) ? "passive" : "<invalid>");
+
+       if (val != SCAN_TYPE_ACTIVE && val != SCAN_TYPE_PASSIVE)
+               ret = -EINVAL;
+       else
+               priv->scan_mode = val;
+
+       return ret;
+}
+
+static int at76_iw_get_scan_mode(struct net_device *netdev,
+                                struct iw_request_info *info,
+                                union iwreq_data *wrqu, char *extra)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int *param = (int *)extra;
+
+       param[0] = priv->scan_mode;
+       return 0;
+}
+
+#define AT76_SET_HANDLER(h, f) [h - SIOCIWFIRST] = (iw_handler) f
+
+/* Standard wireless handlers */
+static const iw_handler at76_handlers[] = {
+       AT76_SET_HANDLER(SIOCSIWCOMMIT, at76_iw_handler_commit),
+       AT76_SET_HANDLER(SIOCGIWNAME, at76_iw_handler_get_name),
+       AT76_SET_HANDLER(SIOCSIWFREQ, at76_iw_handler_set_freq),
+       AT76_SET_HANDLER(SIOCGIWFREQ, at76_iw_handler_get_freq),
+       AT76_SET_HANDLER(SIOCSIWMODE, at76_iw_handler_set_mode),
+       AT76_SET_HANDLER(SIOCGIWMODE, at76_iw_handler_get_mode),
+       AT76_SET_HANDLER(SIOCGIWRANGE, at76_iw_handler_get_range),
+       AT76_SET_HANDLER(SIOCSIWSPY, at76_iw_handler_set_spy),
+       AT76_SET_HANDLER(SIOCGIWSPY, at76_iw_handler_get_spy),
+       AT76_SET_HANDLER(SIOCSIWTHRSPY, at76_iw_handler_set_thrspy),
+       AT76_SET_HANDLER(SIOCGIWTHRSPY, at76_iw_handler_get_thrspy),
+       AT76_SET_HANDLER(SIOCSIWAP, at76_iw_handler_set_wap),
+       AT76_SET_HANDLER(SIOCGIWAP, at76_iw_handler_get_wap),
+       AT76_SET_HANDLER(SIOCSIWSCAN, at76_iw_handler_set_scan),
+       AT76_SET_HANDLER(SIOCGIWSCAN, at76_iw_handler_get_scan),
+       AT76_SET_HANDLER(SIOCSIWESSID, at76_iw_handler_set_essid),
+       AT76_SET_HANDLER(SIOCGIWESSID, at76_iw_handler_get_essid),
+       AT76_SET_HANDLER(SIOCSIWRATE, at76_iw_handler_set_rate),
+       AT76_SET_HANDLER(SIOCGIWRATE, at76_iw_handler_get_rate),
+       AT76_SET_HANDLER(SIOCSIWRTS, at76_iw_handler_set_rts),
+       AT76_SET_HANDLER(SIOCGIWRTS, at76_iw_handler_get_rts),
+       AT76_SET_HANDLER(SIOCSIWFRAG, at76_iw_handler_set_frag),
+       AT76_SET_HANDLER(SIOCGIWFRAG, at76_iw_handler_get_frag),
+       AT76_SET_HANDLER(SIOCGIWTXPOW, at76_iw_handler_get_txpow),
+       AT76_SET_HANDLER(SIOCSIWRETRY, at76_iw_handler_set_retry),
+       AT76_SET_HANDLER(SIOCGIWRETRY, at76_iw_handler_get_retry),
+       AT76_SET_HANDLER(SIOCSIWENCODE, at76_iw_handler_set_encode),
+       AT76_SET_HANDLER(SIOCGIWENCODE, at76_iw_handler_get_encode),
+       AT76_SET_HANDLER(SIOCSIWPOWER, at76_iw_handler_set_power),
+       AT76_SET_HANDLER(SIOCGIWPOWER, at76_iw_handler_get_power)
+};
+
+#define AT76_SET_PRIV(h, f) [h - SIOCIWFIRSTPRIV] = (iw_handler) f
+
+/* Private wireless handlers */
+static const iw_handler at76_priv_handlers[] = {
+       AT76_SET_PRIV(AT76_SET_SHORT_PREAMBLE, at76_iw_set_short_preamble),
+       AT76_SET_PRIV(AT76_GET_SHORT_PREAMBLE, at76_iw_get_short_preamble),
+       AT76_SET_PRIV(AT76_SET_DEBUG, at76_iw_set_debug),
+       AT76_SET_PRIV(AT76_GET_DEBUG, at76_iw_get_debug),
+       AT76_SET_PRIV(AT76_SET_POWERSAVE_MODE, at76_iw_set_powersave_mode),
+       AT76_SET_PRIV(AT76_GET_POWERSAVE_MODE, at76_iw_get_powersave_mode),
+       AT76_SET_PRIV(AT76_SET_SCAN_TIMES, at76_iw_set_scan_times),
+       AT76_SET_PRIV(AT76_GET_SCAN_TIMES, at76_iw_get_scan_times),
+       AT76_SET_PRIV(AT76_SET_SCAN_MODE, at76_iw_set_scan_mode),
+       AT76_SET_PRIV(AT76_GET_SCAN_MODE, at76_iw_get_scan_mode),
+};
+
+/* Names and arguments of private wireless handlers */
+static const struct iw_priv_args at76_priv_args[] = {
+       /* 0 - long, 1 - short */
+       {AT76_SET_SHORT_PREAMBLE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"},
+
+       {AT76_GET_SHORT_PREAMBLE,
+        0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 10, "get_preamble"},
+
+       /* we must pass the new debug mask as a string, because iwpriv cannot
+        * parse hex numbers starting with 0x :-(  */
+       {AT76_SET_DEBUG,
+        IW_PRIV_TYPE_CHAR | 10, 0, "set_debug"},
+
+       {AT76_GET_DEBUG,
+        0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 10, "get_debug"},
+
+       /* 1 - active, 2 - power save, 3 - smart power save */
+       {AT76_SET_POWERSAVE_MODE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_powersave"},
+
+       {AT76_GET_POWERSAVE_MODE,
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_powersave"},
+
+       /* min_channel_time, max_channel_time */
+       {AT76_SET_SCAN_TIMES,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, 0, "set_scan_times"},
+
+       {AT76_GET_SCAN_TIMES,
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 2, "get_scan_times"},
+
+       /* 0 - active, 1 - passive scan */
+       {AT76_SET_SCAN_MODE,
+        IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_scan_mode"},
+
+       {AT76_GET_SCAN_MODE,
+        0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_scan_mode"},
+};
+
+static const struct iw_handler_def at76_handler_def = {
+       .num_standard = ARRAY_SIZE(at76_handlers),
+       .num_private = ARRAY_SIZE(at76_priv_handlers),
+       .num_private_args = ARRAY_SIZE(at76_priv_args),
+       .standard = at76_handlers,
+       .private = at76_priv_handlers,
+       .private_args = at76_priv_args,
+       .get_wireless_stats = at76_get_wireless_stats,
+};
+
+static const u8 snapsig[] = { 0xaa, 0xaa, 0x03 };
+
+/* RFC 1042 encapsulates Ethernet frames in 802.2 SNAP (0xaa, 0xaa, 0x03) with
+ * a SNAP OID of 0 (0x00, 0x00, 0x00) */
+static const u8 rfc1042sig[] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 };
+
+static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       struct net_device_stats *stats = &priv->stats;
+       int ret = 0;
+       int wlen;
+       int submit_len;
+       struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer;
+       struct ieee80211_hdr_3addr *i802_11_hdr =
+           (struct ieee80211_hdr_3addr *)tx_buffer->packet;
+       u8 *payload = i802_11_hdr->payload;
+       struct ethhdr *eh = (struct ethhdr *)skb->data;
+
+       if (netif_queue_stopped(netdev)) {
+               printk(KERN_ERR "%s: %s called while netdev is stopped\n",
+                      netdev->name, __func__);
+               /* skip this packet */
+               dev_kfree_skb(skb);
+               return 0;
+       }
+
+       if (priv->tx_urb->status == -EINPROGRESS) {
+               printk(KERN_ERR "%s: %s called while tx urb is pending\n",
+                      netdev->name, __func__);
+               /* skip this packet */
+               dev_kfree_skb(skb);
+               return 0;
+       }
+
+       if (skb->len < ETH_HLEN) {
+               printk(KERN_ERR "%s: %s: skb too short (%d)\n",
+                      netdev->name, __func__, skb->len);
+               dev_kfree_skb(skb);
+               return 0;
+       }
+
+       at76_ledtrig_tx_activity();     /* tell ledtrigger we send a packet */
+
+       /* we can get rid of memcpy if we set netdev->hard_header_len to
+          reserve enough space, but we would need to keep the skb around */
+
+       if (ntohs(eh->h_proto) <= ETH_DATA_LEN) {
+               /* this is a 802.3 packet */
+               if (skb->len >= ETH_HLEN + sizeof(rfc1042sig)
+                   && skb->data[ETH_HLEN] == rfc1042sig[0]
+                   && skb->data[ETH_HLEN + 1] == rfc1042sig[1]) {
+                       /* higher layer delivered SNAP header - keep it */
+                       memcpy(payload, skb->data + ETH_HLEN,
+                              skb->len - ETH_HLEN);
+                       wlen = IEEE80211_3ADDR_LEN + skb->len - ETH_HLEN;
+               } else {
+                       printk(KERN_ERR "%s: dropping non-SNAP 802.2 packet "
+                              "(DSAP 0x%02x SSAP 0x%02x cntrl 0x%02x)\n",
+                              priv->netdev->name, skb->data[ETH_HLEN],
+                              skb->data[ETH_HLEN + 1],
+                              skb->data[ETH_HLEN + 2]);
+                       dev_kfree_skb(skb);
+                       return 0;
+               }
+       } else {
+               /* add RFC 1042 header in front */
+               memcpy(payload, rfc1042sig, sizeof(rfc1042sig));
+               memcpy(payload + sizeof(rfc1042sig), &eh->h_proto,
+                      skb->len - offsetof(struct ethhdr, h_proto));
+               wlen = IEEE80211_3ADDR_LEN + sizeof(rfc1042sig) + skb->len -
+                   offsetof(struct ethhdr, h_proto);
+       }
+
+       /* make wireless header */
+       i802_11_hdr->frame_ctl =
+           cpu_to_le16(IEEE80211_FTYPE_DATA |
+                       (priv->wep_enabled ? IEEE80211_FCTL_PROTECTED : 0) |
+                       (priv->iw_mode ==
+                        IW_MODE_INFRA ? IEEE80211_FCTL_TODS : 0));
+
+       if (priv->iw_mode == IW_MODE_ADHOC) {
+               memcpy(i802_11_hdr->addr1, eh->h_dest, ETH_ALEN);
+               memcpy(i802_11_hdr->addr2, eh->h_source, ETH_ALEN);
+               memcpy(i802_11_hdr->addr3, priv->bssid, ETH_ALEN);
+       } else if (priv->iw_mode == IW_MODE_INFRA) {
+               memcpy(i802_11_hdr->addr1, priv->bssid, ETH_ALEN);
+               memcpy(i802_11_hdr->addr2, eh->h_source, ETH_ALEN);
+               memcpy(i802_11_hdr->addr3, eh->h_dest, ETH_ALEN);
+       }
+
+       i802_11_hdr->duration_id = cpu_to_le16(0);
+       i802_11_hdr->seq_ctl = cpu_to_le16(0);
+
+       /* setup 'Atmel' header */
+       tx_buffer->wlength = cpu_to_le16(wlen);
+       tx_buffer->tx_rate = priv->txrate;
+       /* for broadcast destination addresses, the firmware 0.100.x
+          seems to choose the highest rate set with CMD_STARTUP in
+          basic_rate_set replacing this value */
+
+       memset(tx_buffer->reserved, 0, sizeof(tx_buffer->reserved));
+
+       tx_buffer->padding = at76_calc_padding(wlen);
+       submit_len = wlen + AT76_TX_HDRLEN + tx_buffer->padding;
+
+       at76_dbg(DBG_TX_DATA_CONTENT, "%s skb->data %s", priv->netdev->name,
+                hex2str(skb->data, 32));
+       at76_dbg(DBG_TX_DATA, "%s tx: wlen 0x%x pad 0x%x rate %d hdr %s",
+                priv->netdev->name,
+                le16_to_cpu(tx_buffer->wlength),
+                tx_buffer->padding, tx_buffer->tx_rate,
+                hex2str(i802_11_hdr, sizeof(*i802_11_hdr)));
+       at76_dbg(DBG_TX_DATA_CONTENT, "%s payload %s", priv->netdev->name,
+                hex2str(payload, 48));
+
+       /* send stuff */
+       netif_stop_queue(netdev);
+       netdev->trans_start = jiffies;
+
+       usb_fill_bulk_urb(priv->tx_urb, priv->udev, priv->tx_pipe, tx_buffer,
+                         submit_len, at76_tx_callback, priv);
+       ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
+       if (ret) {
+               stats->tx_errors++;
+               printk(KERN_ERR "%s: error in tx submit urb: %d\n",
+                      netdev->name, ret);
+               if (ret == -EINVAL)
+                       printk(KERN_ERR
+                              "%s: -EINVAL: tx urb %p hcpriv %p complete %p\n",
+                              priv->netdev->name, priv->tx_urb,
+                              priv->tx_urb->hcpriv, priv->tx_urb->complete);
+       } else {
+               stats->tx_bytes += skb->len;
+               dev_kfree_skb(skb);
+       }
+
+       return ret;
+}
+
+static void at76_tx_timeout(struct net_device *netdev)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       if (!priv)
+               return;
+       dev_warn(&netdev->dev, "tx timeout.");
+
+       usb_unlink_urb(priv->tx_urb);
+       priv->stats.tx_errors++;
+}
+
+static int at76_submit_rx_urb(struct at76_priv *priv)
+{
+       int ret;
+       int size;
+       struct sk_buff *skb = priv->rx_skb;
+
+       if (!priv->rx_urb) {
+               printk(KERN_ERR "%s: %s: priv->rx_urb is NULL\n",
+                      priv->netdev->name, __func__);
+               return -EFAULT;
+       }
+
+       if (!skb) {
+               skb = dev_alloc_skb(sizeof(struct at76_rx_buffer));
+               if (!skb) {
+                       printk(KERN_ERR "%s: cannot allocate rx skbuff\n",
+                              priv->netdev->name);
+                       ret = -ENOMEM;
+                       goto exit;
+               }
+               priv->rx_skb = skb;
+       } else {
+               skb_push(skb, skb_headroom(skb));
+               skb_trim(skb, 0);
+       }
+
+       size = skb_tailroom(skb);
+       usb_fill_bulk_urb(priv->rx_urb, priv->udev, priv->rx_pipe,
+                         skb_put(skb, size), size, at76_rx_callback, priv);
+       ret = usb_submit_urb(priv->rx_urb, GFP_ATOMIC);
+       if (ret < 0) {
+               if (ret == -ENODEV)
+                       at76_dbg(DBG_DEVSTART,
+                                "usb_submit_urb returned -ENODEV");
+               else
+                       printk(KERN_ERR "%s: rx, usb_submit_urb failed: %d\n",
+                              priv->netdev->name, ret);
+       }
+
+exit:
+       if (ret < 0 && ret != -ENODEV)
+               printk(KERN_ERR "%s: cannot submit rx urb - please unload the "
+                      "driver and/or power cycle the device\n",
+                      priv->netdev->name);
+
+       return ret;
+}
+
+static int at76_open(struct net_device *netdev)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       int ret = 0;
+
+       at76_dbg(DBG_PROC_ENTRY, "%s(): entry", __func__);
+
+       if (mutex_lock_interruptible(&priv->mtx))
+               return -EINTR;
+
+       /* if netdev->dev_addr != priv->mac_addr we must
+          set the mac address in the device ! */
+       if (compare_ether_addr(netdev->dev_addr, priv->mac_addr)) {
+               if (at76_add_mac_address(priv, netdev->dev_addr) >= 0)
+                       at76_dbg(DBG_PROGRESS, "%s: set new MAC addr %s",
+                                netdev->name, mac2str(netdev->dev_addr));
+       }
+
+       priv->scan_state = SCAN_IDLE;
+       priv->last_scan = jiffies;
+
+       ret = at76_submit_rx_urb(priv);
+       if (ret < 0) {
+               printk(KERN_ERR "%s: open: submit_rx_urb failed: %d\n",
+                      netdev->name, ret);
+               goto error;
+       }
+
+       schedule_delayed_work(&priv->dwork_restart, 0);
+
+       at76_dbg(DBG_PROC_ENTRY, "%s(): end", __func__);
+error:
+       mutex_unlock(&priv->mtx);
+       return ret < 0 ? ret : 0;
+}
+
+static int at76_stop(struct net_device *netdev)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       at76_dbg(DBG_DEVSTART, "%s: ENTER", __func__);
+
+       if (mutex_lock_interruptible(&priv->mtx))
+               return -EINTR;
+
+       at76_quiesce(priv);
+
+       if (!priv->device_unplugged) {
+               /* We are called by "ifconfig ethX down", not because the
+                * device is not available anymore. */
+               at76_set_radio(priv, 0);
+
+               /* We unlink rx_urb because at76_open() re-submits it.
+                * If unplugged, at76_delete_device() takes care of it. */
+               usb_kill_urb(priv->rx_urb);
+       }
+
+       /* free the bss_list */
+       at76_free_bss_list(priv);
+
+       mutex_unlock(&priv->mtx);
+       at76_dbg(DBG_DEVSTART, "%s: EXIT", __func__);
+
+       return 0;
+}
+
+static void at76_ethtool_get_drvinfo(struct net_device *netdev,
+                                    struct ethtool_drvinfo *info)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+
+       strncpy(info->driver, DRIVER_NAME, sizeof(info->driver));
+       strncpy(info->version, DRIVER_VERSION, sizeof(info->version));
+
+       usb_make_path(priv->udev, info->bus_info, sizeof(info->bus_info));
+
+       snprintf(info->fw_version, sizeof(info->fw_version), "%d.%d.%d-%d",
+                priv->fw_version.major, priv->fw_version.minor,
+                priv->fw_version.patch, priv->fw_version.build);
+}
+
+static u32 at76_ethtool_get_link(struct net_device *netdev)
+{
+       struct at76_priv *priv = netdev_priv(netdev);
+       return priv->mac_state == MAC_CONNECTED;
+}
+
+static struct ethtool_ops at76_ethtool_ops = {
+       .get_drvinfo = at76_ethtool_get_drvinfo,
+       .get_link = at76_ethtool_get_link,
+};
+
+/* Download external firmware */
+static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
+{
+       int ret;
+       int op_mode;
+       int blockno = 0;
+       int bsize;
+       u8 *block;
+       u8 *buf = fwe->extfw;
+       int size = fwe->extfw_size;
+
+       if (!buf || !size)
+               return -ENOENT;
 
        op_mode = at76_get_op_mode(udev);
        at76_dbg(DBG_DEVSTART, "opmode %d", op_mode);
@@ -1428,39 +3463,439 @@ exit:
        return ret;
 }
 
-/* Download internal firmware */
-static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe)
+/* Download internal firmware */
+static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe)
+{
+       int ret;
+       int need_remap = !at76_is_505a(fwe->board_type);
+
+       ret = at76_usbdfu_download(udev, fwe->intfw, fwe->intfw_size,
+                                  need_remap ? 0 : 2 * HZ);
+
+       if (ret < 0) {
+               dev_printk(KERN_ERR, &udev->dev,
+                          "downloading internal fw failed with %d\n", ret);
+               goto exit;
+       }
+
+       at76_dbg(DBG_DEVSTART, "sending REMAP");
+
+       /* no REMAP for 505A (see SF driver) */
+       if (need_remap) {
+               ret = at76_remap(udev);
+               if (ret < 0) {
+                       dev_printk(KERN_ERR, &udev->dev,
+                                  "sending REMAP failed with %d\n", ret);
+                       goto exit;
+               }
+       }
+
+       at76_dbg(DBG_DEVSTART, "sleeping for 2 seconds");
+       schedule_timeout_interruptible(2 * HZ + 1);
+       usb_reset_device(udev);
+
+exit:
+       return ret;
+}
+
+static int at76_match_essid(struct at76_priv *priv, struct bss_info *ptr)
+{
+       /* common criteria for both modi */
+
+       int ret = (priv->essid_size == 0 /* ANY ssid */  ||
+                  (priv->essid_size == ptr->ssid_len &&
+                   !memcmp(priv->essid, ptr->ssid, ptr->ssid_len)));
+       if (!ret)
+               at76_dbg(DBG_BSS_MATCH,
+                        "%s bss table entry %p: essid didn't match",
+                        priv->netdev->name, ptr);
+       return ret;
+}
+
+static inline int at76_match_mode(struct at76_priv *priv, struct bss_info *ptr)
+{
+       int ret;
+
+       if (priv->iw_mode == IW_MODE_ADHOC)
+               ret = ptr->capa & WLAN_CAPABILITY_IBSS;
+       else
+               ret = ptr->capa & WLAN_CAPABILITY_ESS;
+       if (!ret)
+               at76_dbg(DBG_BSS_MATCH,
+                        "%s bss table entry %p: mode didn't match",
+                        priv->netdev->name, ptr);
+       return ret;
+}
+
+static int at76_match_rates(struct at76_priv *priv, struct bss_info *ptr)
+{
+       int i;
+
+       for (i = 0; i < ptr->rates_len; i++) {
+               u8 rate = ptr->rates[i];
+
+               if (!(rate & 0x80))
+                       continue;
+
+               /* this is a basic rate we have to support
+                  (see IEEE802.11, ch. 7.3.2.2) */
+               if (rate != (0x80 | hw_rates[0])
+                   && rate != (0x80 | hw_rates[1])
+                   && rate != (0x80 | hw_rates[2])
+                   && rate != (0x80 | hw_rates[3])) {
+                       at76_dbg(DBG_BSS_MATCH,
+                                "%s: bss table entry %p: basic rate %02x not "
+                                "supported", priv->netdev->name, ptr, rate);
+                       return 0;
+               }
+       }
+
+       /* if we use short preamble, the bss must support it */
+       if (priv->preamble_type == PREAMBLE_TYPE_SHORT &&
+           !(ptr->capa & WLAN_CAPABILITY_SHORT_PREAMBLE)) {
+               at76_dbg(DBG_BSS_MATCH,
+                        "%s: %p does not support short preamble",
+                        priv->netdev->name, ptr);
+               return 0;
+       } else
+               return 1;
+}
+
+static inline int at76_match_wep(struct at76_priv *priv, struct bss_info *ptr)
+{
+       if (!priv->wep_enabled && ptr->capa & WLAN_CAPABILITY_PRIVACY) {
+               /* we have disabled WEP, but the BSS signals privacy */
+               at76_dbg(DBG_BSS_MATCH,
+                        "%s: bss table entry %p: requires encryption",
+                        priv->netdev->name, ptr);
+               return 0;
+       }
+       /* otherwise if the BSS does not signal privacy it may well
+          accept encrypted packets from us ... */
+       return 1;
+}
+
+static inline int at76_match_bssid(struct at76_priv *priv, struct bss_info *ptr)
+{
+       if (!priv->wanted_bssid_valid ||
+           !compare_ether_addr(ptr->bssid, priv->wanted_bssid))
+               return 1;
+
+       at76_dbg(DBG_BSS_MATCH,
+                "%s: requested bssid - %s does not match",
+                priv->netdev->name, mac2str(priv->wanted_bssid));
+       at76_dbg(DBG_BSS_MATCH,
+                "      AP bssid - %s of bss table entry %p",
+                mac2str(ptr->bssid), ptr);
+       return 0;
+}
+
+/**
+ * at76_match_bss - try to find a matching bss in priv->bss
+ *
+ * last - last bss tried
+ *
+ * last == NULL signals a new round starting with priv->bss_list.next
+ * this function must be called inside an acquired priv->bss_list_spinlock
+ * otherwise the timeout on bss may remove the newly chosen entry
+ */
+static struct bss_info *at76_match_bss(struct at76_priv *priv,
+                                      struct bss_info *last)
+{
+       struct bss_info *ptr = NULL;
+       struct list_head *curr;
+
+       curr = last ? last->list.next : priv->bss_list.next;
+       while (curr != &priv->bss_list) {
+               ptr = list_entry(curr, struct bss_info, list);
+               if (at76_match_essid(priv, ptr) && at76_match_mode(priv, ptr)
+                   && at76_match_wep(priv, ptr) && at76_match_rates(priv, ptr)
+                   && at76_match_bssid(priv, ptr))
+                       break;
+               curr = curr->next;
+       }
+
+       if (curr == &priv->bss_list)
+               ptr = NULL;
+       /* otherwise ptr points to the struct bss_info we have chosen */
+
+       at76_dbg(DBG_BSS_TABLE, "%s %s: returned %p", priv->netdev->name,
+                __func__, ptr);
+       return ptr;
+}
+
+/* Start joining a matching BSS, or create own IBSS */
+static void at76_work_join(struct work_struct *work)
+{
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             work_join);
+       int ret;
+       unsigned long flags;
+
+       mutex_lock(&priv->mtx);
+
+       WARN_ON(priv->mac_state != MAC_JOINING);
+       if (priv->mac_state != MAC_JOINING)
+               goto exit;
+
+       /* secure the access to priv->curr_bss ! */
+       spin_lock_irqsave(&priv->bss_list_spinlock, flags);
+       priv->curr_bss = at76_match_bss(priv, priv->curr_bss);
+       spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
+
+       if (!priv->curr_bss) {
+               /* here we haven't found a matching (i)bss ... */
+               if (priv->iw_mode == IW_MODE_ADHOC) {
+                       at76_set_mac_state(priv, MAC_OWN_IBSS);
+                       at76_start_ibss(priv);
+                       goto exit;
+               }
+               /* haven't found a matching BSS in infra mode - try again */
+               at76_set_mac_state(priv, MAC_SCANNING);
+               schedule_work(&priv->work_start_scan);
+               goto exit;
+       }
+
+       ret = at76_join_bss(priv, priv->curr_bss);
+       if (ret < 0) {
+               printk(KERN_ERR "%s: join_bss failed with %d\n",
+                      priv->netdev->name, ret);
+               goto exit;
+       }
+
+       ret = at76_wait_completion(priv, CMD_JOIN);
+       if (ret != CMD_STATUS_COMPLETE) {
+               if (ret != CMD_STATUS_TIME_OUT)
+                       printk(KERN_ERR "%s: join_bss completed with %d\n",
+                              priv->netdev->name, ret);
+               else
+                       printk(KERN_INFO "%s: join_bss ssid %s timed out\n",
+                              priv->netdev->name,
+                              mac2str(priv->curr_bss->bssid));
+
+               /* retry next BSS immediately */
+               schedule_work(&priv->work_join);
+               goto exit;
+       }
+
+       /* here we have joined the (I)BSS */
+       if (priv->iw_mode == IW_MODE_ADHOC) {
+               struct bss_info *bptr = priv->curr_bss;
+               at76_set_mac_state(priv, MAC_CONNECTED);
+               /* get ESSID, BSSID and channel for priv->curr_bss */
+               priv->essid_size = bptr->ssid_len;
+               memcpy(priv->essid, bptr->ssid, bptr->ssid_len);
+               memcpy(priv->bssid, bptr->bssid, ETH_ALEN);
+               priv->channel = bptr->channel;
+               at76_iwevent_bss_connect(priv->netdev, bptr->bssid);
+               netif_carrier_on(priv->netdev);
+               netif_start_queue(priv->netdev);
+               /* just to be sure */
+               cancel_delayed_work(&priv->dwork_get_scan);
+               cancel_delayed_work(&priv->dwork_auth);
+               cancel_delayed_work(&priv->dwork_assoc);
+       } else {
+               /* send auth req */
+               priv->retries = AUTH_RETRIES;
+               at76_set_mac_state(priv, MAC_AUTH);
+               at76_auth_req(priv, priv->curr_bss, 1, NULL);
+               at76_dbg(DBG_MGMT_TIMER,
+                        "%s:%d: starting mgmt_timer + HZ", __func__, __LINE__);
+               schedule_delayed_work(&priv->dwork_auth, AUTH_TIMEOUT);
+       }
+
+exit:
+       mutex_unlock(&priv->mtx);
+}
+
+/* Reap scan results */
+static void at76_dwork_get_scan(struct work_struct *work)
+{
+       int status;
+       int ret;
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             dwork_get_scan.work);
+
+       mutex_lock(&priv->mtx);
+       WARN_ON(priv->mac_state != MAC_SCANNING);
+       if (priv->mac_state != MAC_SCANNING)
+               goto exit;
+
+       status = at76_get_cmd_status(priv->udev, CMD_SCAN);
+       if (status < 0) {
+               printk(KERN_ERR "%s: %s: at76_get_cmd_status failed with %d\n",
+                      priv->netdev->name, __func__, status);
+               status = CMD_STATUS_IN_PROGRESS;
+               /* INFO: Hope it was a one off error - if not, scanning
+                  further down the line and stop this cycle */
+       }
+       at76_dbg(DBG_PROGRESS,
+                "%s %s: got cmd_status %d (state %s, need_any %d)",
+                priv->netdev->name, __func__, status,
+                mac_states[priv->mac_state], priv->scan_need_any);
+
+       if (status != CMD_STATUS_COMPLETE) {
+               if ((status != CMD_STATUS_IN_PROGRESS) &&
+                   (status != CMD_STATUS_IDLE))
+                       printk(KERN_ERR "%s: %s: Bad scan status: %s\n",
+                              priv->netdev->name, __func__,
+                              at76_get_cmd_status_string(status));
+
+               /* the first cmd status after scan start is always a IDLE ->
+                  start the timer to poll again until COMPLETED */
+               at76_dbg(DBG_MGMT_TIMER,
+                        "%s:%d: starting mgmt_timer for %d ticks",
+                        __func__, __LINE__, SCAN_POLL_INTERVAL);
+               schedule_delayed_work(&priv->dwork_get_scan,
+                                     SCAN_POLL_INTERVAL);
+               goto exit;
+       }
+
+       if (at76_debug & DBG_BSS_TABLE)
+               at76_dump_bss_table(priv);
+
+       if (priv->scan_need_any) {
+               ret = at76_start_scan(priv, 0);
+               if (ret < 0)
+                       printk(KERN_ERR
+                              "%s: %s: start_scan (ANY) failed with %d\n",
+                              priv->netdev->name, __func__, ret);
+               at76_dbg(DBG_MGMT_TIMER,
+                        "%s:%d: starting mgmt_timer for %d ticks", __func__,
+                        __LINE__, SCAN_POLL_INTERVAL);
+               schedule_delayed_work(&priv->dwork_get_scan,
+                                     SCAN_POLL_INTERVAL);
+               priv->scan_need_any = 0;
+       } else {
+               priv->scan_state = SCAN_COMPLETED;
+               /* report the end of scan to user space */
+               at76_iwevent_scan_complete(priv->netdev);
+               at76_set_mac_state(priv, MAC_JOINING);
+               schedule_work(&priv->work_join);
+       }
+
+exit:
+       mutex_unlock(&priv->mtx);
+}
+
+/* Handle loss of beacons from the AP */
+static void at76_dwork_beacon(struct work_struct *work)
+{
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             dwork_beacon.work);
+
+       mutex_lock(&priv->mtx);
+       if (priv->mac_state != MAC_CONNECTED || priv->iw_mode != IW_MODE_INFRA)
+               goto exit;
+
+       /* We haven't received any beacons from out AP for BEACON_TIMEOUT */
+       printk(KERN_INFO "%s: lost beacon bssid %s\n",
+              priv->netdev->name, mac2str(priv->curr_bss->bssid));
+
+       netif_carrier_off(priv->netdev);
+       netif_stop_queue(priv->netdev);
+       at76_iwevent_bss_disconnect(priv->netdev);
+       at76_set_mac_state(priv, MAC_SCANNING);
+       schedule_work(&priv->work_start_scan);
+
+exit:
+       mutex_unlock(&priv->mtx);
+}
+
+/* Handle authentication response timeout */
+static void at76_dwork_auth(struct work_struct *work)
+{
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             dwork_auth.work);
+
+       mutex_lock(&priv->mtx);
+       WARN_ON(priv->mac_state != MAC_AUTH);
+       if (priv->mac_state != MAC_AUTH)
+               goto exit;
+
+       at76_dbg(DBG_PROGRESS, "%s: authentication response timeout",
+                priv->netdev->name);
+
+       if (priv->retries-- >= 0) {
+               at76_auth_req(priv, priv->curr_bss, 1, NULL);
+               at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+                        __func__, __LINE__);
+               schedule_delayed_work(&priv->dwork_auth, AUTH_TIMEOUT);
+       } else {
+               /* try to get next matching BSS */
+               at76_set_mac_state(priv, MAC_JOINING);
+               schedule_work(&priv->work_join);
+       }
+
+exit:
+       mutex_unlock(&priv->mtx);
+}
+
+/* Handle association response timeout */
+static void at76_dwork_assoc(struct work_struct *work)
+{
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             dwork_assoc.work);
+
+       mutex_lock(&priv->mtx);
+       WARN_ON(priv->mac_state != MAC_ASSOC);
+       if (priv->mac_state != MAC_ASSOC)
+               goto exit;
+
+       at76_dbg(DBG_PROGRESS, "%s: association response timeout",
+                priv->netdev->name);
+
+       if (priv->retries-- >= 0) {
+               at76_assoc_req(priv, priv->curr_bss);
+               at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+                        __func__, __LINE__);
+               schedule_delayed_work(&priv->dwork_assoc, ASSOC_TIMEOUT);
+       } else {
+               /* try to get next matching BSS */
+               at76_set_mac_state(priv, MAC_JOINING);
+               schedule_work(&priv->work_join);
+       }
+
+exit:
+       mutex_unlock(&priv->mtx);
+}
+
+/* Read new bssid in ad-hoc mode */
+static void at76_work_new_bss(struct work_struct *work)
 {
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             work_new_bss);
        int ret;
-       int need_remap = !at76_is_505a(fwe->board_type);
+       struct mib_mac_mgmt mac_mgmt;
 
-       ret = at76_usbdfu_download(udev, fwe->intfw, fwe->intfw_size,
-                                  need_remap ? 0 : 2 * HZ);
+       mutex_lock(&priv->mtx);
 
+       ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, &mac_mgmt,
+                          sizeof(struct mib_mac_mgmt));
        if (ret < 0) {
-               dev_printk(KERN_ERR, &udev->dev,
-                          "downloading internal fw failed with %d\n", ret);
+               printk(KERN_ERR "%s: at76_get_mib failed: %d\n",
+                      priv->netdev->name, ret);
                goto exit;
        }
 
-       at76_dbg(DBG_DEVSTART, "sending REMAP");
+       at76_dbg(DBG_PROGRESS, "ibss_change = 0x%2x", mac_mgmt.ibss_change);
+       memcpy(priv->bssid, mac_mgmt.current_bssid, ETH_ALEN);
+       at76_dbg(DBG_PROGRESS, "using BSSID %s", mac2str(priv->bssid));
 
-       /* no REMAP for 505A (see SF driver) */
-       if (need_remap) {
-               ret = at76_remap(udev);
-               if (ret < 0) {
-                       dev_printk(KERN_ERR, &udev->dev,
-                                  "sending REMAP failed with %d\n", ret);
-                       goto exit;
-               }
-       }
+       at76_iwevent_bss_connect(priv->netdev, priv->bssid);
 
-       at76_dbg(DBG_DEVSTART, "sleeping for 2 seconds");
-       schedule_timeout_interruptible(2 * HZ + 1);
-       usb_reset_device(udev);
+       priv->mib_buf.type = MIB_MAC_MGMT;
+       priv->mib_buf.size = 1;
+       priv->mib_buf.index = offsetof(struct mib_mac_mgmt, ibss_change);
+       priv->mib_buf.data.byte = 0;
+
+       ret = at76_set_mib(priv, &priv->mib_buf);
+       if (ret < 0)
+               printk(KERN_ERR "%s: set_mib (ibss change ok) failed: %d\n",
+                      priv->netdev->name, ret);
 
 exit:
-       return ret;
+       mutex_unlock(&priv->mtx);
 }
 
 static int at76_startup_device(struct at76_priv *priv)
@@ -1470,14 +3905,14 @@ static int at76_startup_device(struct at76_priv *priv)
 
        at76_dbg(DBG_PARAMS,
                 "%s param: ssid %.*s (%s) mode %s ch %d wep %s key %d "
-                "keylen %d", wiphy_name(priv->hw->wiphy), priv->essid_size,
-                priv->essid, hex2str(priv->essid, IW_ESSID_MAX_SIZE),
+                "keylen %d", priv->netdev->name, priv->essid_size, priv->essid,
+                hex2str(priv->essid, IW_ESSID_MAX_SIZE),
                 priv->iw_mode == IW_MODE_ADHOC ? "adhoc" : "infra",
                 priv->channel, priv->wep_enabled ? "enabled" : "disabled",
                 priv->wep_key_id, priv->wep_keys_len[priv->wep_key_id]);
        at76_dbg(DBG_PARAMS,
                 "%s param: preamble %s rts %d retry %d frag %d "
-                "txrate %s auth_mode %d", wiphy_name(priv->hw->wiphy),
+                "txrate %s auth_mode %d", priv->netdev->name,
                 preambles[priv->preamble_type], priv->rts_threshold,
                 priv->short_retry_limit, priv->frag_threshold,
                 priv->txrate == TX_RATE_1MBIT ? "1MBit" : priv->txrate ==
@@ -1488,7 +3923,7 @@ static int at76_startup_device(struct at76_priv *priv)
        at76_dbg(DBG_PARAMS,
                 "%s param: pm_mode %d pm_period %d auth_mode %s "
                 "scan_times %d %d scan_mode %s",
-                wiphy_name(priv->hw->wiphy), priv->pm_mode, priv->pm_period,
+                priv->netdev->name, priv->pm_mode, priv->pm_period,
                 priv->auth_mode == WLAN_AUTH_OPEN ? "open" : "shared_secret",
                 priv->scan_min_time, priv->scan_max_time,
                 priv->scan_mode == SCAN_TYPE_ACTIVE ? "active" : "passive");
@@ -1522,8 +3957,7 @@ static int at76_startup_device(struct at76_priv *priv)
        ccfg->ssid_len = priv->essid_size;
 
        ccfg->wep_default_key_id = priv->wep_key_id;
-       memcpy(ccfg->wep_default_key_value, priv->wep_keys,
-              sizeof(priv->wep_keys));
+       memcpy(ccfg->wep_default_key_value, priv->wep_keys, 4 * WEP_KEY_LEN);
 
        ccfg->short_preamble = priv->preamble_type;
        ccfg->beacon_period = cpu_to_le16(priv->beacon_period);
@@ -1532,7 +3966,7 @@ static int at76_startup_device(struct at76_priv *priv)
                                    sizeof(struct at76_card_config));
        if (ret < 0) {
                printk(KERN_ERR "%s: at76_set_card_command failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
                return ret;
        }
 
@@ -1578,6 +4012,69 @@ static int at76_startup_device(struct at76_priv *priv)
        return 0;
 }
 
+/* Restart the interface */
+static void at76_dwork_restart(struct work_struct *work)
+{
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             dwork_restart.work);
+
+       mutex_lock(&priv->mtx);
+
+       netif_carrier_off(priv->netdev);        /* stop netdev watchdog */
+       netif_stop_queue(priv->netdev); /* stop tx data packets */
+
+       at76_startup_device(priv);
+
+       if (priv->iw_mode != IW_MODE_MONITOR) {
+               priv->netdev->type = ARPHRD_ETHER;
+               at76_set_mac_state(priv, MAC_SCANNING);
+               schedule_work(&priv->work_start_scan);
+       } else {
+               priv->netdev->type = ARPHRD_IEEE80211_RADIOTAP;
+               at76_start_monitor(priv);
+       }
+
+       mutex_unlock(&priv->mtx);
+}
+
+/* Initiate scanning */
+static void at76_work_start_scan(struct work_struct *work)
+{
+       struct at76_priv *priv = container_of(work, struct at76_priv,
+                                             work_start_scan);
+       int ret;
+
+       mutex_lock(&priv->mtx);
+
+       WARN_ON(priv->mac_state != MAC_SCANNING);
+       if (priv->mac_state != MAC_SCANNING)
+               goto exit;
+
+       /* only clear the bss list when a scan is actively initiated,
+        * otherwise simply rely on at76_bss_list_timeout */
+       if (priv->scan_state == SCAN_IN_PROGRESS) {
+               at76_free_bss_list(priv);
+               priv->scan_need_any = 1;
+       } else
+               priv->scan_need_any = 0;
+
+       ret = at76_start_scan(priv, 1);
+
+       if (ret < 0)
+               printk(KERN_ERR "%s: %s: start_scan failed with %d\n",
+                      priv->netdev->name, __func__, ret);
+       else {
+               at76_dbg(DBG_MGMT_TIMER,
+                        "%s:%d: starting mgmt_timer for %d ticks",
+                        __func__, __LINE__, SCAN_POLL_INTERVAL);
+               schedule_delayed_work(&priv->dwork_get_scan,
+                                     SCAN_POLL_INTERVAL);
+       }
+
+exit:
+       mutex_unlock(&priv->mtx);
+}
+
 /* Enable or disable promiscuous mode */
 static void at76_work_set_promisc(struct work_struct *work)
 {
@@ -1595,7 +4092,7 @@ static void at76_work_set_promisc(struct work_struct *work)
        ret = at76_set_mib(priv, &priv->mib_buf);
        if (ret < 0)
                printk(KERN_ERR "%s: set_mib (promiscuous_mode) failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
+                      priv->netdev->name, ret);
 
        mutex_unlock(&priv->mtx);
 }
@@ -1611,759 +4108,1088 @@ static void at76_work_submit_rx(struct work_struct *work)
        mutex_unlock(&priv->mtx);
 }
 
-static void at76_rx_tasklet(unsigned long param)
+/* We got an association response */
+static void at76_rx_mgmt_assoc(struct at76_priv *priv,
+                              struct at76_rx_buffer *buf)
 {
-       struct urb *urb = (struct urb *)param;
-       struct at76_priv *priv = urb->context;
-       struct at76_rx_buffer *buf;
-       struct ieee80211_rx_status rx_status = { 0 };
-
-       if (priv->device_unplugged) {
-               at76_dbg(DBG_DEVSTART, "device unplugged");
-               if (urb)
-                       at76_dbg(DBG_DEVSTART, "urb status %d", urb->status);
+       struct ieee80211_assoc_response *resp =
+           (struct ieee80211_assoc_response *)buf->packet;
+       u16 assoc_id = le16_to_cpu(resp->aid);
+       u16 status = le16_to_cpu(resp->status);
+
+       at76_dbg(DBG_RX_MGMT, "%s: rx AssocResp bssid %s capa 0x%04x status "
+                "0x%04x assoc_id 0x%04x rates %s", priv->netdev->name,
+                mac2str(resp->header.addr3), le16_to_cpu(resp->capability),
+                status, assoc_id, hex2str(resp->info_element->data,
+                                          resp->info_element->len));
+
+       if (priv->mac_state != MAC_ASSOC) {
+               printk(KERN_INFO "%s: AssocResp in state %s ignored\n",
+                      priv->netdev->name, mac_states[priv->mac_state]);
                return;
        }
 
-       if (!priv->rx_skb || !priv->rx_skb->data)
-               return;
-
-       buf = (struct at76_rx_buffer *)priv->rx_skb->data;
-
-       if (urb->status != 0) {
-               if (urb->status != -ENOENT && urb->status != -ECONNRESET)
-                       at76_dbg(DBG_URB,
-                                "%s %s: - nonzero Rx bulk status received: %d",
-                                __func__, wiphy_name(priv->hw->wiphy),
-                                urb->status);
-               return;
+       BUG_ON(!priv->curr_bss);
+
+       cancel_delayed_work(&priv->dwork_assoc);
+       if (status == WLAN_STATUS_SUCCESS) {
+               struct bss_info *ptr = priv->curr_bss;
+               priv->assoc_id = assoc_id & 0x3fff;
+               /* update iwconfig params */
+               memcpy(priv->bssid, ptr->bssid, ETH_ALEN);
+               memcpy(priv->essid, ptr->ssid, ptr->ssid_len);
+               priv->essid_size = ptr->ssid_len;
+               priv->channel = ptr->channel;
+               schedule_work(&priv->work_assoc_done);
+       } else {
+               at76_set_mac_state(priv, MAC_JOINING);
+               schedule_work(&priv->work_join);
        }
+}
 
-       at76_dbg(DBG_RX_ATMEL_HDR,
-                "%s: rx frame: rate %d rssi %d noise %d link %d",
-                wiphy_name(priv->hw->wiphy), buf->rx_rate, buf->rssi,
-                buf->noise_level, buf->link_quality);
-
-       skb_trim(priv->rx_skb, le16_to_cpu(buf->wlength) + AT76_RX_HDRLEN);
-       at76_dbg_dump(DBG_RX_DATA, &priv->rx_skb->data[AT76_RX_HDRLEN],
-                     priv->rx_skb->len, "RX: len=%d",
-                     (int)(priv->rx_skb->len - AT76_RX_HDRLEN));
+/* Process disassociation request from the AP */
+static void at76_rx_mgmt_disassoc(struct at76_priv *priv,
+                                 struct at76_rx_buffer *buf)
+{
+       struct ieee80211_disassoc *resp =
+           (struct ieee80211_disassoc *)buf->packet;
+       struct ieee80211_hdr_3addr *mgmt = &resp->header;
+
+       at76_dbg(DBG_RX_MGMT,
+                "%s: rx DisAssoc bssid %s reason 0x%04x destination %s",
+                priv->netdev->name, mac2str(mgmt->addr3),
+                le16_to_cpu(resp->reason), mac2str(mgmt->addr1));
+
+       /* We are not connected, ignore */
+       if (priv->mac_state == MAC_SCANNING || priv->mac_state == MAC_INIT
+           || !priv->curr_bss)
+               return;
 
-       rx_status.signal = buf->rssi;
-       /* FIXME: is rate_idx still present in structure? */
-       rx_status.rate_idx = buf->rx_rate;
-       rx_status.flag |= RX_FLAG_DECRYPTED;
-       rx_status.flag |= RX_FLAG_IV_STRIPPED;
+       /* Not our BSSID, ignore */
+       if (compare_ether_addr(mgmt->addr3, priv->curr_bss->bssid))
+               return;
 
-       skb_pull(priv->rx_skb, AT76_RX_HDRLEN);
-       at76_dbg(DBG_MAC80211, "calling ieee80211_rx_irqsafe(): %d/%d",
-                priv->rx_skb->len, priv->rx_skb->data_len);
-       ieee80211_rx_irqsafe(priv->hw, priv->rx_skb, &rx_status);
+       /* Not for our STA and not broadcast, ignore */
+       if (compare_ether_addr(priv->netdev->dev_addr, mgmt->addr1)
+           && !is_broadcast_ether_addr(mgmt->addr1))
+               return;
 
-       /* Use a new skb for the next receive */
-       priv->rx_skb = NULL;
+       if (priv->mac_state != MAC_ASSOC && priv->mac_state != MAC_CONNECTED
+           && priv->mac_state != MAC_JOINING) {
+               printk(KERN_INFO "%s: DisAssoc in state %s ignored\n",
+                      priv->netdev->name, mac_states[priv->mac_state]);
+               return;
+       }
 
-       at76_submit_rx_urb(priv);
+       if (priv->mac_state == MAC_CONNECTED) {
+               netif_carrier_off(priv->netdev);
+               netif_stop_queue(priv->netdev);
+               at76_iwevent_bss_disconnect(priv->netdev);
+       }
+       cancel_delayed_work(&priv->dwork_get_scan);
+       cancel_delayed_work(&priv->dwork_beacon);
+       cancel_delayed_work(&priv->dwork_auth);
+       cancel_delayed_work(&priv->dwork_assoc);
+       at76_set_mac_state(priv, MAC_JOINING);
+       schedule_work(&priv->work_join);
 }
 
-/* Load firmware into kernel memory and parse it */
-static struct fwentry *at76_load_firmware(struct usb_device *udev,
-                                         enum board_type board_type)
+static void at76_rx_mgmt_auth(struct at76_priv *priv,
+                             struct at76_rx_buffer *buf)
 {
-       int ret;
-       char *str;
-       struct at76_fw_header *fwh;
-       struct fwentry *fwe = &firmwares[board_type];
-
-       mutex_lock(&fw_mutex);
-
-       if (fwe->loaded) {
-               at76_dbg(DBG_FW, "re-using previously loaded fw");
-               goto exit;
+       struct ieee80211_auth *resp = (struct ieee80211_auth *)buf->packet;
+       struct ieee80211_hdr_3addr *mgmt = &resp->header;
+       int seq_nr = le16_to_cpu(resp->transaction);
+       int alg = le16_to_cpu(resp->algorithm);
+       int status = le16_to_cpu(resp->status);
+
+       at76_dbg(DBG_RX_MGMT,
+                "%s: rx AuthFrame bssid %s alg %d seq_nr %d status %d "
+                "destination %s", priv->netdev->name, mac2str(mgmt->addr3),
+                alg, seq_nr, status, mac2str(mgmt->addr1));
+
+       if (alg == WLAN_AUTH_SHARED_KEY && seq_nr == 2)
+               at76_dbg(DBG_RX_MGMT, "%s: AuthFrame challenge %s ...",
+                        priv->netdev->name, hex2str(resp->info_element, 18));
+
+       if (priv->mac_state != MAC_AUTH) {
+               printk(KERN_INFO "%s: ignored AuthFrame in state %s\n",
+                      priv->netdev->name, mac_states[priv->mac_state]);
+               return;
        }
-
-       at76_dbg(DBG_FW, "downloading firmware %s", fwe->fwname);
-       ret = request_firmware(&fwe->fw, fwe->fwname, &udev->dev);
-       if (ret < 0) {
-               dev_printk(KERN_ERR, &udev->dev, "firmware %s not found!\n",
-                          fwe->fwname);
-               dev_printk(KERN_ERR, &udev->dev,
-                          "you may need to download the firmware from "
-                          "http://developer.berlios.de/projects/at76c503a/\n");
-               goto exit;
+       if (priv->auth_mode != alg) {
+               printk(KERN_INFO "%s: ignored AuthFrame for alg %d\n",
+                      priv->netdev->name, alg);
+               return;
        }
 
-       at76_dbg(DBG_FW, "got it.");
-       fwh = (struct at76_fw_header *)(fwe->fw->data);
+       BUG_ON(!priv->curr_bss);
 
-       if (fwe->fw->size <= sizeof(*fwh)) {
-               dev_printk(KERN_ERR, &udev->dev,
-                          "firmware is too short (0x%zx)\n", fwe->fw->size);
-               goto exit;
+       /* Not our BSSID or not for our STA, ignore */
+       if (compare_ether_addr(mgmt->addr3, priv->curr_bss->bssid)
+           || compare_ether_addr(priv->netdev->dev_addr, mgmt->addr1))
+               return;
+
+       cancel_delayed_work(&priv->dwork_auth);
+       if (status != WLAN_STATUS_SUCCESS) {
+               /* try to join next bss */
+               at76_set_mac_state(priv, MAC_JOINING);
+               schedule_work(&priv->work_join);
+               return;
        }
 
-       /* CRC currently not checked */
-       fwe->board_type = le32_to_cpu(fwh->board_type);
-       if (fwe->board_type != board_type) {
-               dev_printk(KERN_ERR, &udev->dev,
-                          "board type mismatch, requested %u, got %u\n",
-                          board_type, fwe->board_type);
-               goto exit;
+       if (priv->auth_mode == WLAN_AUTH_OPEN || seq_nr == 4) {
+               priv->retries = ASSOC_RETRIES;
+               at76_set_mac_state(priv, MAC_ASSOC);
+               at76_assoc_req(priv, priv->curr_bss);
+               at76_dbg(DBG_MGMT_TIMER,
+                        "%s:%d: starting mgmt_timer + HZ", __func__, __LINE__);
+               schedule_delayed_work(&priv->dwork_assoc, ASSOC_TIMEOUT);
+               return;
        }
 
-       fwe->fw_version.major = fwh->major;
-       fwe->fw_version.minor = fwh->minor;
-       fwe->fw_version.patch = fwh->patch;
-       fwe->fw_version.build = fwh->build;
+       WARN_ON(seq_nr != 2);
+       at76_auth_req(priv, priv->curr_bss, seq_nr + 1, resp->info_element);
+       at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ", __func__,
+                __LINE__);
+       schedule_delayed_work(&priv->dwork_auth, AUTH_TIMEOUT);
+}
 
-       str = (char *)fwh + le32_to_cpu(fwh->str_offset);
-       fwe->intfw = (u8 *)fwh + le32_to_cpu(fwh->int_fw_offset);
-       fwe->intfw_size = le32_to_cpu(fwh->int_fw_len);
-       fwe->extfw = (u8 *)fwh + le32_to_cpu(fwh->ext_fw_offset);
-       fwe->extfw_size = le32_to_cpu(fwh->ext_fw_len);
+static void at76_rx_mgmt_deauth(struct at76_priv *priv,
+                               struct at76_rx_buffer *buf)
+{
+       struct ieee80211_disassoc *resp =
+           (struct ieee80211_disassoc *)buf->packet;
+       struct ieee80211_hdr_3addr *mgmt = &resp->header;
+
+       at76_dbg(DBG_RX_MGMT | DBG_PROGRESS,
+                "%s: rx DeAuth bssid %s reason 0x%04x destination %s",
+                priv->netdev->name, mac2str(mgmt->addr3),
+                le16_to_cpu(resp->reason), mac2str(mgmt->addr1));
+
+       if (priv->mac_state != MAC_AUTH && priv->mac_state != MAC_ASSOC
+           && priv->mac_state != MAC_CONNECTED) {
+               printk(KERN_INFO "%s: DeAuth in state %s ignored\n",
+                      priv->netdev->name, mac_states[priv->mac_state]);
+               return;
+       }
 
-       fwe->loaded = 1;
+       BUG_ON(!priv->curr_bss);
 
-       dev_printk(KERN_DEBUG, &udev->dev,
-                  "using firmware %s (version %d.%d.%d-%d)\n",
-                  fwe->fwname, fwh->major, fwh->minor, fwh->patch, fwh->build);
+       /* Not our BSSID, ignore */
+       if (compare_ether_addr(mgmt->addr3, priv->curr_bss->bssid))
+               return;
 
-       at76_dbg(DBG_DEVSTART, "board %u, int %d:%d, ext %d:%d", board_type,
-                le32_to_cpu(fwh->int_fw_offset), le32_to_cpu(fwh->int_fw_len),
-                le32_to_cpu(fwh->ext_fw_offset), le32_to_cpu(fwh->ext_fw_len));
-       at76_dbg(DBG_DEVSTART, "firmware id %s", str);
+       /* Not for our STA and not broadcast, ignore */
+       if (compare_ether_addr(priv->netdev->dev_addr, mgmt->addr1)
+           && !is_broadcast_ether_addr(mgmt->addr1))
+               return;
 
-exit:
-       mutex_unlock(&fw_mutex);
+       if (priv->mac_state == MAC_CONNECTED)
+               at76_iwevent_bss_disconnect(priv->netdev);
 
-       if (fwe->loaded)
-               return fwe;
-       else
-               return NULL;
+       at76_set_mac_state(priv, MAC_JOINING);
+       schedule_work(&priv->work_join);
+       cancel_delayed_work(&priv->dwork_get_scan);
+       cancel_delayed_work(&priv->dwork_beacon);
+       cancel_delayed_work(&priv->dwork_auth);
+       cancel_delayed_work(&priv->dwork_assoc);
 }
 
-static void at76_mac80211_tx_callback(struct urb *urb)
+static void at76_rx_mgmt_beacon(struct at76_priv *priv,
+                               struct at76_rx_buffer *buf)
 {
-       struct at76_priv *priv = urb->context;
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(priv->tx_skb);
+       int varpar_len;
+       /* beacon content */
+       struct ieee80211_beacon *bdata = (struct ieee80211_beacon *)buf->packet;
+       struct ieee80211_hdr_3addr *mgmt = &bdata->header;
+
+       struct list_head *lptr;
+       struct bss_info *match; /* entry matching addr3 with its bssid */
+       int new_entry = 0;
+       int len;
+       struct ieee80211_info_element *ie;
+       int have_ssid = 0;
+       int have_rates = 0;
+       int have_channel = 0;
+       int keep_going = 1;
+       unsigned long flags;
+
+       spin_lock_irqsave(&priv->bss_list_spinlock, flags);
+       if (priv->mac_state == MAC_CONNECTED) {
+               /* in state MAC_CONNECTED we use the mgmt_timer to control
+                  the beacon of the BSS */
+               BUG_ON(!priv->curr_bss);
+
+               if (!compare_ether_addr(priv->curr_bss->bssid, mgmt->addr3)) {
+                       /* We got our AP's beacon, defer the timeout handler.
+                          Kill pending work first, as schedule_delayed_work()
+                          won't do it. */
+                       cancel_delayed_work(&priv->dwork_beacon);
+                       schedule_delayed_work(&priv->dwork_beacon,
+                                             BEACON_TIMEOUT);
+                       priv->curr_bss->rssi = buf->rssi;
+                       priv->beacons_received++;
+                       goto exit;
+               }
+       }
 
-       at76_dbg(DBG_MAC80211, "%s()", __func__);
+       /* look if we have this BSS already in the list */
+       match = NULL;
 
-       switch (urb->status) {
-       case 0:
-               /* success */
-               /* FIXME:
-                * is the frame really ACKed when tx_callback is called ? */
-               info->flags |= IEEE80211_TX_STAT_ACK;
-               break;
-       case -ENOENT:
-       case -ECONNRESET:
-               /* fail, urb has been unlinked */
-               /* FIXME: add error message */
-               break;
-       default:
-               at76_dbg(DBG_URB, "%s - nonzero tx status received: %d",
-                        __func__, urb->status);
-               break;
+       if (!list_empty(&priv->bss_list)) {
+               list_for_each(lptr, &priv->bss_list) {
+                       struct bss_info *bss_ptr =
+                           list_entry(lptr, struct bss_info, list);
+                       if (!compare_ether_addr(bss_ptr->bssid, mgmt->addr3)) {
+                               match = bss_ptr;
+                               break;
+                       }
+               }
        }
 
-       memset(&info->status, 0, sizeof(info->status));
+       if (!match) {
+               /* BSS not in the list - append it */
+               match = kzalloc(sizeof(struct bss_info), GFP_ATOMIC);
+               if (!match) {
+                       at76_dbg(DBG_BSS_TABLE,
+                                "%s: cannot kmalloc new bss info (%zd byte)",
+                                priv->netdev->name, sizeof(struct bss_info));
+                       goto exit;
+               }
+               new_entry = 1;
+               list_add_tail(&match->list, &priv->bss_list);
+       }
 
-       ieee80211_tx_status_irqsafe(priv->hw, priv->tx_skb);
+       match->capa = le16_to_cpu(bdata->capability);
+       match->beacon_interval = le16_to_cpu(bdata->beacon_interval);
+       match->rssi = buf->rssi;
+       match->link_qual = buf->link_quality;
+       match->noise_level = buf->noise_level;
+       memcpy(match->bssid, mgmt->addr3, ETH_ALEN);
+       at76_dbg(DBG_RX_BEACON, "%s: bssid %s", priv->netdev->name,
+                mac2str(match->bssid));
+
+       ie = bdata->info_element;
+
+       /* length of var length beacon parameters */
+       varpar_len = min_t(int, le16_to_cpu(buf->wlength) -
+                          sizeof(struct ieee80211_beacon),
+                          BEACON_MAX_DATA_LENGTH);
+
+       /* This routine steps through the bdata->data array to get
+        * some useful information about the access point.
+        * Currently, this implementation supports receipt of: SSID,
+        * supported transfer rates and channel, in any order, with some
+        * tolerance for intermittent unknown codes (although this
+        * functionality may not be necessary as the useful information will
+        * usually arrive in consecutively, but there have been some
+        * reports of some of the useful information fields arriving in a
+        * different order).
+        * It does not support any more IE types although MFIE_TYPE_TIM may
+        * be supported (on my AP at least).
+        * The bdata->data array is about 1500 bytes long but only ~36 of those
+        * bytes are useful, hence the have_ssid etc optimizations. */
+
+       while (keep_going &&
+              ((&ie->data[ie->len] - (u8 *)bdata->info_element) <=
+               varpar_len)) {
+
+               switch (ie->id) {
+
+               case MFIE_TYPE_SSID:
+                       if (have_ssid)
+                               break;
 
-       priv->tx_skb = NULL;
+                       len = min_t(int, IW_ESSID_MAX_SIZE, ie->len);
 
-       ieee80211_wake_queues(priv->hw);
-}
+                       /* we copy only if this is a new entry,
+                          or the incoming SSID is not a hidden SSID. This
+                          will protect us from overwriting a real SSID read
+                          in a ProbeResponse with a hidden one from a
+                          following beacon. */
+                       if (!new_entry && at76_is_hidden_ssid(ie->data, len)) {
+                               have_ssid = 1;
+                               break;
+                       }
 
-static int at76_mac80211_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
-{
-       struct at76_priv *priv = hw->priv;
-       struct at76_tx_buffer *tx_buffer = priv->bulk_out_buffer;
-       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
-       int padding, submit_len, ret;
+                       match->ssid_len = len;
+                       memcpy(match->ssid, ie->data, len);
+                       at76_dbg(DBG_RX_BEACON, "%s: SSID - %.*s",
+                                priv->netdev->name, len, match->ssid);
+                       have_ssid = 1;
+                       break;
 
-       at76_dbg(DBG_MAC80211, "%s()", __func__);
+               case MFIE_TYPE_RATES:
+                       if (have_rates)
+                               break;
 
-       if (priv->tx_urb->status == -EINPROGRESS) {
-               printk(KERN_ERR "%s: %s called while tx urb is pending\n",
-                      wiphy_name(priv->hw->wiphy), __func__);
-               return NETDEV_TX_BUSY;
-       }
+                       match->rates_len =
+                           min_t(int, sizeof(match->rates), ie->len);
+                       memcpy(match->rates, ie->data, match->rates_len);
+                       have_rates = 1;
+                       at76_dbg(DBG_RX_BEACON, "%s: SUPPORTED RATES %s",
+                                priv->netdev->name,
+                                hex2str(ie->data, ie->len));
+                       break;
 
-       ieee80211_stop_queues(hw);
+               case MFIE_TYPE_DS_SET:
+                       if (have_channel)
+                               break;
 
-       at76_ledtrig_tx_activity();     /* tell ledtrigger we send a packet */
+                       match->channel = ie->data[0];
+                       have_channel = 1;
+                       at76_dbg(DBG_RX_BEACON, "%s: CHANNEL - %d",
+                                priv->netdev->name, match->channel);
+                       break;
 
-       WARN_ON(priv->tx_skb != NULL);
+               case MFIE_TYPE_CF_SET:
+               case MFIE_TYPE_TIM:
+               case MFIE_TYPE_IBSS_SET:
+               default:
+                       at76_dbg(DBG_RX_BEACON, "%s: beacon IE id %d len %d %s",
+                                priv->netdev->name, ie->id, ie->len,
+                                hex2str(ie->data, ie->len));
+                       break;
+               }
 
-       priv->tx_skb = skb;
-       padding = at76_calc_padding(skb->len);
-       submit_len = AT76_TX_HDRLEN + skb->len + padding;
+               /* advance to the next informational element */
+               next_ie(&ie);
 
-       /* setup 'Atmel' header */
-       memset(tx_buffer, 0, sizeof(*tx_buffer));
-       tx_buffer->padding = padding;
-       tx_buffer->wlength = cpu_to_le16(skb->len);
-       tx_buffer->tx_rate = ieee80211_get_tx_rate(hw, info)->hw_value;
-       if (FIRMWARE_IS_WPA(priv->fw_version) && info->control.hw_key) {
-               tx_buffer->key_id = (info->control.hw_key->keyidx);
-               tx_buffer->cipher_type =
-                       priv->keys[info->control.hw_key->keyidx].cipher;
-               tx_buffer->cipher_length =
-                       priv->keys[info->control.hw_key->keyidx].keylen;
-               tx_buffer->reserved = 0;
-       } else {
-               tx_buffer->key_id = 0;
-               tx_buffer->cipher_type = 0;
-               tx_buffer->cipher_length = 0;
-               tx_buffer->reserved = 0;
-       };
-       /* memset(tx_buffer->reserved, 0, sizeof(tx_buffer->reserved)); */
-       memcpy(tx_buffer->packet, skb->data, skb->len);
+               /* Optimization: after all, the bdata->data array is
+                * varpar_len bytes long, whereas we get all of the useful
+                * information after only ~36 bytes, this saves us a lot of
+                * time (and trouble as the remaining portion of the array
+                * could be full of junk)
+                * Comment this out if you want to see what other information
+                * comes from the AP - although little of it may be useful */
+       }
 
-       at76_dbg(DBG_TX_DATA, "%s tx: wlen 0x%x pad 0x%x rate %d hdr",
-                wiphy_name(priv->hw->wiphy), le16_to_cpu(tx_buffer->wlength),
-                tx_buffer->padding, tx_buffer->tx_rate);
+       at76_dbg(DBG_RX_BEACON, "%s: Finished processing beacon data",
+                priv->netdev->name);
 
-       /* send stuff */
-       at76_dbg_dump(DBG_TX_DATA_CONTENT, tx_buffer, submit_len,
-                     "%s(): tx_buffer %d bytes:", __func__, submit_len);
-       usb_fill_bulk_urb(priv->tx_urb, priv->udev, priv->tx_pipe, tx_buffer,
-                         submit_len, at76_mac80211_tx_callback, priv);
-       ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
-       if (ret) {
-               printk(KERN_ERR "%s: error in tx submit urb: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
-               if (ret == -EINVAL)
-                       printk(KERN_ERR
-                              "%s: -EINVAL: tx urb %p hcpriv %p complete %p\n",
-                              wiphy_name(priv->hw->wiphy), priv->tx_urb,
-                              priv->tx_urb->hcpriv, priv->tx_urb->complete);
-       }
+       match->last_rx = jiffies;       /* record last rx of beacon */
 
-       return 0;
+exit:
+       spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
 }
 
-static int at76_mac80211_start(struct ieee80211_hw *hw)
+/* Calculate the link level from a given rx_buffer */
+static void at76_calc_level(struct at76_priv *priv, struct at76_rx_buffer *buf,
+                           struct iw_quality *qual)
 {
-       struct at76_priv *priv = hw->priv;
-       int ret;
-
-       at76_dbg(DBG_MAC80211, "%s()", __func__);
-
-       mutex_lock(&priv->mtx);
+       /* just a guess for now, might be different for other chips */
+       int max_rssi = 42;
 
-       ret = at76_submit_rx_urb(priv);
-       if (ret < 0) {
-               printk(KERN_ERR "%s: open: submit_rx_urb failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
-               goto error;
-       }
+       qual->level = (buf->rssi * 100 / max_rssi);
+       if (qual->level > 100)
+               qual->level = 100;
+       qual->updated |= IW_QUAL_LEVEL_UPDATED;
+}
 
-       at76_startup_device(priv);
+/* Calculate the link quality from a given rx_buffer */
+static void at76_calc_qual(struct at76_priv *priv, struct at76_rx_buffer *buf,
+                          struct iw_quality *qual)
+{
+       if (at76_is_intersil(priv->board_type))
+               qual->qual = buf->link_quality;
+       else {
+               unsigned long elapsed;
 
-       at76_start_monitor(priv);
+               /* Update qual at most once a second */
+               elapsed = jiffies - priv->beacons_last_qual;
+               if (elapsed < 1 * HZ)
+                       return;
 
-error:
-       mutex_unlock(&priv->mtx);
+               qual->qual = qual->level * priv->beacons_received *
+                   msecs_to_jiffies(priv->beacon_period) / elapsed;
 
-       return 0;
+               priv->beacons_last_qual = jiffies;
+               priv->beacons_received = 0;
+       }
+       qual->qual = (qual->qual > 100) ? 100 : qual->qual;
+       qual->updated |= IW_QUAL_QUAL_UPDATED;
 }
 
-static void at76_mac80211_stop(struct ieee80211_hw *hw)
+/* Calculate the noise quality from a given rx_buffer */
+static void at76_calc_noise(struct at76_priv *priv, struct at76_rx_buffer *buf,
+                           struct iw_quality *qual)
 {
-       struct at76_priv *priv = hw->priv;
-
-       at76_dbg(DBG_MAC80211, "%s()", __func__);
+       qual->noise = 0;
+       qual->updated |= IW_QUAL_NOISE_INVALID;
+}
 
-       mutex_lock(&priv->mtx);
+static void at76_update_wstats(struct at76_priv *priv,
+                              struct at76_rx_buffer *buf)
+{
+       struct iw_quality *qual = &priv->wstats.qual;
 
-       if (!priv->device_unplugged) {
-               /* We are called by "ifconfig ethX down", not because the
-                * device is not available anymore. */
-               if (at76_set_radio(priv, 0) == 1)
-                       at76_wait_completion(priv, CMD_RADIO_ON);
+       if (buf->rssi && priv->mac_state == MAC_CONNECTED) {
+               qual->updated = 0;
+               at76_calc_level(priv, buf, qual);
+               at76_calc_qual(priv, buf, qual);
+               at76_calc_noise(priv, buf, qual);
+       } else {
+               qual->qual = 0;
+               qual->level = 0;
+               qual->noise = 0;
+               qual->updated = IW_QUAL_ALL_INVALID;
+       }
+}
 
-               /* We unlink rx_urb because at76_open() re-submits it.
-                * If unplugged, at76_delete_device() takes care of it. */
-               usb_kill_urb(priv->rx_urb);
+static void at76_rx_mgmt(struct at76_priv *priv, struct at76_rx_buffer *buf)
+{
+       struct ieee80211_hdr_3addr *mgmt =
+           (struct ieee80211_hdr_3addr *)buf->packet;
+       u16 framectl = le16_to_cpu(mgmt->frame_ctl);
+
+       /* update wstats */
+       if (priv->mac_state != MAC_INIT && priv->mac_state != MAC_SCANNING) {
+               /* jal: this is a dirty hack needed by Tim in ad-hoc mode */
+               /* Data packets always seem to have a 0 link level, so we
+                  only read link quality info from management packets.
+                  Atmel driver actually averages the present, and previous
+                  values, we just present the raw value at the moment - TJS */
+               if (priv->iw_mode == IW_MODE_ADHOC
+                   || (priv->curr_bss
+                       && !compare_ether_addr(mgmt->addr3,
+                                              priv->curr_bss->bssid)))
+                       at76_update_wstats(priv, buf);
        }
 
-       mutex_unlock(&priv->mtx);
-}
+       at76_dbg(DBG_RX_MGMT_CONTENT, "%s rx mgmt framectl 0x%x %s",
+                priv->netdev->name, framectl,
+                hex2str(mgmt, le16_to_cpu(buf->wlength)));
+
+       switch (framectl & IEEE80211_FCTL_STYPE) {
+       case IEEE80211_STYPE_BEACON:
+       case IEEE80211_STYPE_PROBE_RESP:
+               at76_rx_mgmt_beacon(priv, buf);
+               break;
 
-static int at76_add_interface(struct ieee80211_hw *hw,
-                             struct ieee80211_if_init_conf *conf)
-{
-       struct at76_priv *priv = hw->priv;
-       int ret = 0;
+       case IEEE80211_STYPE_ASSOC_RESP:
+               at76_rx_mgmt_assoc(priv, buf);
+               break;
 
-       at76_dbg(DBG_MAC80211, "%s()", __func__);
+       case IEEE80211_STYPE_DISASSOC:
+               at76_rx_mgmt_disassoc(priv, buf);
+               break;
 
-       mutex_lock(&priv->mtx);
+       case IEEE80211_STYPE_AUTH:
+               at76_rx_mgmt_auth(priv, buf);
+               break;
 
-       switch (conf->type) {
-       case NL80211_IFTYPE_STATION:
-               priv->iw_mode = IW_MODE_INFRA;
+       case IEEE80211_STYPE_DEAUTH:
+               at76_rx_mgmt_deauth(priv, buf);
                break;
+
        default:
-               ret = -EOPNOTSUPP;
-               goto exit;
+               printk(KERN_DEBUG "%s: ignoring frame with framectl 0x%04x\n",
+                      priv->netdev->name, framectl);
        }
 
-exit:
-       mutex_unlock(&priv->mtx);
-
-       return ret;
+       return;
 }
 
-static void at76_remove_interface(struct ieee80211_hw *hw,
-                                 struct ieee80211_if_init_conf *conf)
+/* Convert the 802.11 header into an ethernet-style header, make skb
+ * ready for consumption by netif_rx() */
+static void at76_ieee80211_to_eth(struct sk_buff *skb, int iw_mode)
 {
-       at76_dbg(DBG_MAC80211, "%s()", __func__);
-}
+       struct ieee80211_hdr_3addr *i802_11_hdr;
+       struct ethhdr *eth_hdr_p;
+       u8 *src_addr;
+       u8 *dest_addr;
 
-static int at76_join(struct at76_priv *priv)
-{
-       struct at76_req_join join;
-       int ret;
+       i802_11_hdr = (struct ieee80211_hdr_3addr *)skb->data;
 
-       memset(&join, 0, sizeof(struct at76_req_join));
-       memcpy(join.essid, priv->essid, priv->essid_size);
-       join.essid_size = priv->essid_size;
-       memcpy(join.bssid, priv->bssid, ETH_ALEN);
-       join.bss_type = INFRASTRUCTURE_MODE;
-       join.channel = priv->channel;
-       join.timeout = cpu_to_le16(2000);
+       /* That would be the ethernet header if the hardware converted
+        * the frame for us.  Make sure the source and the destination
+        * match the 802.11 header.  Which hardware does it? */
+       eth_hdr_p = (struct ethhdr *)skb_pull(skb, IEEE80211_3ADDR_LEN);
 
-       at76_dbg(DBG_MAC80211, "%s: sending CMD_JOIN", __func__);
-       ret = at76_set_card_command(priv->udev, CMD_JOIN, &join,
-                                   sizeof(struct at76_req_join));
+       dest_addr = i802_11_hdr->addr1;
+       if (iw_mode == IW_MODE_ADHOC)
+               src_addr = i802_11_hdr->addr2;
+       else
+               src_addr = i802_11_hdr->addr3;
 
-       if (ret < 0) {
-               printk(KERN_ERR "%s: at76_set_card_command failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
-               return 0;
-       }
+       if (!compare_ether_addr(eth_hdr_p->h_source, src_addr) &&
+           !compare_ether_addr(eth_hdr_p->h_dest, dest_addr))
+               /* Yes, we already have an ethernet header */
+               skb_reset_mac_header(skb);
+       else {
+               u16 len;
+
+               /* Need to build an ethernet header */
+               if (!memcmp(skb->data, snapsig, sizeof(snapsig))) {
+                       /* SNAP frame - decapsulate, keep proto */
+                       skb_push(skb, offsetof(struct ethhdr, h_proto) -
+                                sizeof(rfc1042sig));
+                       len = 0;
+               } else {
+                       /* 802.3 frame, proto is length */
+                       len = skb->len;
+                       skb_push(skb, ETH_HLEN);
+               }
 
-       ret = at76_wait_completion(priv, CMD_JOIN);
-       at76_dbg(DBG_MAC80211, "%s: CMD_JOIN returned: 0x%02x", __func__, ret);
-       if (ret != CMD_STATUS_COMPLETE) {
-               printk(KERN_ERR "%s: at76_wait_completion failed: %d\n",
-                      wiphy_name(priv->hw->wiphy), ret);
-               return 0;
+               skb_reset_mac_header(skb);
+               eth_hdr_p = eth_hdr(skb);
+               /* This needs to be done in this order (eth_hdr_p->h_dest may
+                * overlap src_addr) */
+               memcpy(eth_hdr_p->h_source, src_addr, ETH_ALEN);
+               memcpy(eth_hdr_p->h_dest, dest_addr, ETH_ALEN);
+               if (len)
+                       eth_hdr_p->h_proto = htons(len);
        }
 
-       at76_set_tkip_bssid(priv, priv->bssid);
-       at76_set_pm_mode(priv);
-
-       return 0;
+       skb->protocol = eth_type_trans(skb, skb->dev);
 }
 
-static void at76_dwork_hw_scan(struct work_struct *work)
+/* Check for fragmented data in priv->rx_skb. If the packet was no fragment
+   or it was the last of a fragment set a skb containing the whole packet
+   is returned for further processing. Otherwise we get NULL and are
+   done and the packet is either stored inside the fragment buffer
+   or thrown away.  Every returned skb starts with the ieee802_11 header
+   and contains _no_ FCS at the end */
+static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
 {
-       struct at76_priv *priv = container_of(work, struct at76_priv,
-                                             dwork_hw_scan.work);
-       int ret;
+       struct sk_buff *skb = priv->rx_skb;
+       struct at76_rx_buffer *buf = (struct at76_rx_buffer *)skb->data;
+       struct ieee80211_hdr_3addr *i802_11_hdr =
+           (struct ieee80211_hdr_3addr *)buf->packet;
+       /* seq_ctrl, fragment_number, sequence number of new packet */
+       u16 sctl = le16_to_cpu(i802_11_hdr->seq_ctl);
+       u16 fragnr = sctl & 0xf;
+       u16 seqnr = sctl >> 4;
+       u16 frame_ctl = le16_to_cpu(i802_11_hdr->frame_ctl);
 
-       ret = at76_get_cmd_status(priv->udev, CMD_SCAN);
-       at76_dbg(DBG_MAC80211, "%s: CMD_SCAN status 0x%02x", __func__, ret);
+       /* Length including the IEEE802.11 header, but without the trailing
+        * FCS and without the Atmel Rx header */
+       int length = le16_to_cpu(buf->wlength) - IEEE80211_FCS_LEN;
 
-       /* FIXME: add maximum time for scan to complete */
+       /* where does the data payload start in skb->data ? */
+       u8 *data = i802_11_hdr->payload;
 
-       if (ret != CMD_STATUS_COMPLETE) {
-               queue_delayed_work(priv->hw->workqueue, &priv->dwork_hw_scan,
-                                  SCAN_POLL_INTERVAL);
-               goto exit;
+       /* length of payload, excl. the trailing FCS */
+       int data_len = length - IEEE80211_3ADDR_LEN;
+
+       int i;
+       struct rx_data_buf *bptr, *optr;
+       unsigned long oldest = ~0UL;
+
+       at76_dbg(DBG_RX_FRAGS,
+                "%s: rx data frame_ctl %04x addr2 %s seq/frag %d/%d "
+                "length %d data %d: %s ...", priv->netdev->name, frame_ctl,
+                mac2str(i802_11_hdr->addr2), seqnr, fragnr, length, data_len,
+                hex2str(data, 32));
+
+       at76_dbg(DBG_RX_FRAGS_SKB, "%s: incoming skb: head %p data %p "
+                "tail %p end %p len %d", priv->netdev->name, skb->head,
+                skb->data, skb_tail_pointer(skb), skb_end_pointer(skb),
+                skb->len);
+
+       if (data_len < 0) {
+               /* make sure data starts in the buffer */
+               printk(KERN_INFO "%s: data frame too short\n",
+                      priv->netdev->name);
+               return NULL;
        }
 
-       ieee80211_scan_completed(priv->hw);
+       WARN_ON(length <= AT76_RX_HDRLEN);
+       if (length <= AT76_RX_HDRLEN)
+               return NULL;
 
-       if (is_valid_ether_addr(priv->bssid)) {
-               ieee80211_wake_queues(priv->hw);
-               at76_join(priv);
+       /* remove the at76_rx_buffer header - we don't need it anymore */
+       /* we need the IEEE802.11 header (for the addresses) if this packet
+          is the first of a chain */
+       skb_pull(skb, AT76_RX_HDRLEN);
+
+       /* remove FCS at end */
+       skb_trim(skb, length);
+
+       at76_dbg(DBG_RX_FRAGS_SKB, "%s: trimmed skb: head %p data %p tail %p "
+                "end %p len %d data %p data_len %d", priv->netdev->name,
+                skb->head, skb->data, skb_tail_pointer(skb),
+                skb_end_pointer(skb), skb->len, data, data_len);
+
+       if (fragnr == 0 && !(frame_ctl & IEEE80211_FCTL_MOREFRAGS)) {
+               /* unfragmented packet received */
+               /* Use a new skb for the next receive */
+               priv->rx_skb = NULL;
+               at76_dbg(DBG_RX_FRAGS, "%s: unfragmented", priv->netdev->name);
+               return skb;
        }
 
-       ieee80211_wake_queues(priv->hw);
+       /* look if we've got a chain for the sender address.
+          afterwards optr points to first free or the oldest entry,
+          or, if i < NR_RX_DATA_BUF, bptr points to the entry for the
+          sender address */
+       /* determining the oldest entry doesn't cope with jiffies wrapping
+          but I don't care to delete a young entry at these rare moments ... */
+
+       bptr = priv->rx_data;
+       optr = NULL;
+       for (i = 0; i < NR_RX_DATA_BUF; i++, bptr++) {
+               if (!bptr->skb) {
+                       optr = bptr;
+                       oldest = 0UL;
+                       continue;
+               }
 
-exit:
-       return;
-}
+               if (!compare_ether_addr(i802_11_hdr->addr2, bptr->sender))
+                       break;
 
-static int at76_hw_scan(struct ieee80211_hw *hw, u8 *ssid, size_t len)
-{
-       struct at76_priv *priv = hw->priv;
-       struct at76_req_scan scan;
-       int ret;
+               if (!optr) {
+                       optr = bptr;
+                       oldest = bptr->last_rx;
+               } else if (bptr->last_rx < oldest)
+                       optr = bptr;
+       }
 
-       at76_dbg(DBG_MAC80211, "%s():", __func__);
-       at76_dbg_dump(DBG_MAC80211, ssid, len, "ssid %zd bytes:", len);
+       if (i < NR_RX_DATA_BUF) {
+
+               at76_dbg(DBG_RX_FRAGS, "%s: %d. cacheentry (seq/frag = %d/%d) "
+                        "matched sender addr",
+                        priv->netdev->name, i, bptr->seqnr, bptr->fragnr);
+
+               /* bptr points to an entry for the sender address */
+               if (bptr->seqnr == seqnr) {
+                       int left;
+                       /* the fragment has the current sequence number */
+                       if (((bptr->fragnr + 1) & 0xf) != fragnr) {
+                               /* wrong fragment number -> ignore it */
+                               /* is & 0xf necessary above ??? */
+                               at76_dbg(DBG_RX_FRAGS,
+                                        "%s: frag nr mismatch: %d + 1 != %d",
+                                        priv->netdev->name, bptr->fragnr,
+                                        fragnr);
+                               return NULL;
+                       }
+                       bptr->last_rx = jiffies;
+                       /* the next following fragment number ->
+                          add the data at the end */
+
+                       /* for test only ??? */
+                       left = skb_tailroom(bptr->skb);
+                       if (left < data_len)
+                               printk(KERN_INFO
+                                      "%s: only %d byte free (need %d)\n",
+                                      priv->netdev->name, left, data_len);
+                       else
+                               memcpy(skb_put(bptr->skb, data_len), data,
+                                      data_len);
+
+                       bptr->fragnr = fragnr;
+                       if (frame_ctl & IEEE80211_FCTL_MOREFRAGS)
+                               return NULL;
+
+                       /* this was the last fragment - send it */
+                       skb = bptr->skb;
+                       bptr->skb = NULL;       /* free the entry */
+                       at76_dbg(DBG_RX_FRAGS, "%s: last frag of seq %d",
+                                priv->netdev->name, seqnr);
+                       return skb;
+               }
 
-       mutex_lock(&priv->mtx);
+               /* got another sequence number */
+               if (fragnr == 0) {
+                       /* it's the start of a new chain - replace the
+                          old one by this */
+                       /* bptr->sender has the correct value already */
+                       at76_dbg(DBG_RX_FRAGS,
+                                "%s: start of new seq %d, removing old seq %d",
+                                priv->netdev->name, seqnr, bptr->seqnr);
+                       bptr->seqnr = seqnr;
+                       bptr->fragnr = 0;
+                       bptr->last_rx = jiffies;
+                       /* swap bptr->skb and priv->rx_skb */
+                       skb = bptr->skb;
+                       bptr->skb = priv->rx_skb;
+                       priv->rx_skb = skb;
+               } else {
+                       /* it from the middle of a new chain ->
+                          delete the old entry and skip the new one */
+                       at76_dbg(DBG_RX_FRAGS,
+                                "%s: middle of new seq %d (%d) "
+                                "removing old seq %d",
+                                priv->netdev->name, seqnr, fragnr,
+                                bptr->seqnr);
+                       dev_kfree_skb(bptr->skb);
+                       bptr->skb = NULL;
+               }
+               return NULL;
+       }
 
-       ieee80211_stop_queues(hw);
+       /* if we didn't find a chain for the sender address, optr
+          points either to the first free or the oldest entry */
 
-       memset(&scan, 0, sizeof(struct at76_req_scan));
-       memset(scan.bssid, 0xFF, ETH_ALEN);
-       scan.scan_type = SCAN_TYPE_ACTIVE;
-       if (priv->essid_size > 0) {
-               memcpy(scan.essid, ssid, len);
-               scan.essid_size = len;
+       if (fragnr != 0) {
+               /* this is not the begin of a fragment chain ... */
+               at76_dbg(DBG_RX_FRAGS,
+                        "%s: no chain for non-first fragment (%d)",
+                        priv->netdev->name, fragnr);
+               return NULL;
        }
-       scan.min_channel_time = cpu_to_le16(priv->scan_min_time);
-       scan.max_channel_time = cpu_to_le16(priv->scan_max_time);
-       scan.probe_delay = cpu_to_le16(priv->scan_min_time * 1000);
-       scan.international_scan = 0;
 
-       at76_dbg(DBG_MAC80211, "%s: sending CMD_SCAN", __func__);
-       ret = at76_set_card_command(priv->udev, CMD_SCAN, &scan, sizeof(scan));
+       BUG_ON(!optr);
+       if (optr->skb) {
+               /* swap the skb's */
+               skb = optr->skb;
+               optr->skb = priv->rx_skb;
+               priv->rx_skb = skb;
 
-       if (ret < 0) {
-               err("CMD_SCAN failed: %d", ret);
-               goto exit;
-       }
+               at76_dbg(DBG_RX_FRAGS,
+                        "%s: free old contents: sender %s seq/frag %d/%d",
+                        priv->netdev->name, mac2str(optr->sender),
+                        optr->seqnr, optr->fragnr);
 
-       queue_delayed_work(priv->hw->workqueue, &priv->dwork_hw_scan,
-                          SCAN_POLL_INTERVAL);
+       } else {
+               /* take the skb from priv->rx_skb */
+               optr->skb = priv->rx_skb;
+               /* let at76_submit_rx_urb() allocate a new skb */
+               priv->rx_skb = NULL;
 
-exit:
-       mutex_unlock(&priv->mtx);
+               at76_dbg(DBG_RX_FRAGS, "%s: use a free entry",
+                        priv->netdev->name);
+       }
+       memcpy(optr->sender, i802_11_hdr->addr2, ETH_ALEN);
+       optr->seqnr = seqnr;
+       optr->fragnr = 0;
+       optr->last_rx = jiffies;
 
-       return 0;
+       return NULL;
 }
 
-static int at76_config(struct ieee80211_hw *hw, u32 changed)
+/* Rx interrupt: we expect the complete data buffer in priv->rx_skb */
+static void at76_rx_data(struct at76_priv *priv)
 {
-       struct at76_priv *priv = hw->priv;
-       struct ieee80211_conf *conf = &hw->conf;
+       struct net_device *netdev = priv->netdev;
+       struct net_device_stats *stats = &priv->stats;
+       struct sk_buff *skb = priv->rx_skb;
+       struct at76_rx_buffer *buf = (struct at76_rx_buffer *)skb->data;
+       struct ieee80211_hdr_3addr *i802_11_hdr;
+       int length = le16_to_cpu(buf->wlength);
 
-       at76_dbg(DBG_MAC80211, "%s(): channel %d radio %d",
-                __func__, conf->channel->hw_value, conf->radio_enabled);
-       at76_dbg_dump(DBG_MAC80211, priv->essid, priv->essid_size, "ssid:");
-       at76_dbg_dump(DBG_MAC80211, priv->bssid, ETH_ALEN, "bssid:");
+       at76_dbg(DBG_RX_DATA, "%s received data packet: %s", netdev->name,
+                hex2str(skb->data, AT76_RX_HDRLEN));
 
-       mutex_lock(&priv->mtx);
+       at76_dbg(DBG_RX_DATA_CONTENT, "rx packet: %s",
+                hex2str(skb->data + AT76_RX_HDRLEN, length));
 
-       priv->channel = conf->channel->hw_value;
+       skb = at76_check_for_rx_frags(priv);
+       if (!skb)
+               return;
 
-       if (is_valid_ether_addr(priv->bssid)) {
-               at76_join(priv);
-               ieee80211_wake_queues(priv->hw);
-       } else {
-               ieee80211_stop_queues(priv->hw);
-               at76_start_monitor(priv);
-       };
+       /* Atmel header and the FCS are already removed */
+       i802_11_hdr = (struct ieee80211_hdr_3addr *)skb->data;
 
-       mutex_unlock(&priv->mtx);
+       skb->dev = netdev;
+       skb->ip_summed = CHECKSUM_NONE; /* TODO: should check CRC */
 
-       return 0;
-}
+       if (is_broadcast_ether_addr(i802_11_hdr->addr1)) {
+               if (!compare_ether_addr(i802_11_hdr->addr1, netdev->broadcast))
+                       skb->pkt_type = PACKET_BROADCAST;
+               else
+                       skb->pkt_type = PACKET_MULTICAST;
+       } else if (compare_ether_addr(i802_11_hdr->addr1, netdev->dev_addr))
+               skb->pkt_type = PACKET_OTHERHOST;
 
-static int at76_config_interface(struct ieee80211_hw *hw,
-                                struct ieee80211_vif *vif,
-                                struct ieee80211_if_conf *conf)
-{
-       struct at76_priv *priv = hw->priv;
+       at76_ieee80211_to_eth(skb, priv->iw_mode);
 
-       at76_dbg_dump(DBG_MAC80211, conf->bssid, ETH_ALEN, "bssid:");
+       netdev->last_rx = jiffies;
+       netif_rx(skb);
+       stats->rx_packets++;
+       stats->rx_bytes += length;
 
-       mutex_lock(&priv->mtx);
+       return;
+}
 
-       memcpy(priv->bssid, conf->bssid, ETH_ALEN);
-//     memcpy(priv->essid, conf->ssid, conf->ssid_len);
-//     priv->essid_size = conf->ssid_len;
+static void at76_rx_monitor_mode(struct at76_priv *priv)
+{
+       struct at76_rx_radiotap *rt;
+       u8 *payload;
+       int skblen;
+       struct net_device *netdev = priv->netdev;
+       struct at76_rx_buffer *buf =
+           (struct at76_rx_buffer *)priv->rx_skb->data;
+       /* length including the IEEE802.11 header and the trailing FCS,
+          but not at76_rx_buffer */
+       int length = le16_to_cpu(buf->wlength);
+       struct sk_buff *skb = priv->rx_skb;
+       struct net_device_stats *stats = &priv->stats;
 
-       if (is_valid_ether_addr(priv->bssid)) {
-               /* mac80211 is joining a bss */
-               ieee80211_wake_queues(priv->hw);
-               at76_join(priv);
-       } else
-               ieee80211_stop_queues(priv->hw);
+       if (length < IEEE80211_FCS_LEN) {
+               /* buffer contains no data */
+               at76_dbg(DBG_MONITOR_MODE,
+                        "%s: MONITOR MODE: rx skb without data",
+                        priv->netdev->name);
+               return;
+       }
 
-       mutex_unlock(&priv->mtx);
+       skblen = sizeof(struct at76_rx_radiotap) + length;
 
-       return 0;
+       skb = dev_alloc_skb(skblen);
+       if (!skb) {
+               printk(KERN_ERR "%s: MONITOR MODE: dev_alloc_skb for radiotap "
+                      "header returned NULL\n", priv->netdev->name);
+               return;
+       }
+
+       skb_put(skb, skblen);
+
+       rt = (struct at76_rx_radiotap *)skb->data;
+       payload = skb->data + sizeof(struct at76_rx_radiotap);
+
+       rt->rt_hdr.it_version = 0;
+       rt->rt_hdr.it_pad = 0;
+       rt->rt_hdr.it_len = cpu_to_le16(sizeof(struct at76_rx_radiotap));
+       rt->rt_hdr.it_present = cpu_to_le32(AT76_RX_RADIOTAP_PRESENT);
+
+       rt->rt_tsft = cpu_to_le64(le32_to_cpu(buf->rx_time));
+       rt->rt_rate = hw_rates[buf->rx_rate] & (~0x80);
+       rt->rt_signal = buf->rssi;
+       rt->rt_noise = buf->noise_level;
+       rt->rt_flags = IEEE80211_RADIOTAP_F_FCS;
+       if (buf->fragmentation)
+               rt->rt_flags |= IEEE80211_RADIOTAP_F_FRAG;
+
+       memcpy(payload, buf->packet, length);
+       skb->dev = netdev;
+       skb->ip_summed = CHECKSUM_NONE;
+       skb_reset_mac_header(skb);
+       skb->pkt_type = PACKET_OTHERHOST;
+       skb->protocol = htons(ETH_P_802_2);
+
+       netdev->last_rx = jiffies;
+       netif_rx(skb);
+       stats->rx_packets++;
+       stats->rx_bytes += length;
 }
 
-/* must be atomic */
-static void at76_configure_filter(struct ieee80211_hw *hw,
-                                 unsigned int changed_flags,
-                                 unsigned int *total_flags, int mc_count,
-                                 struct dev_addr_list *mc_list)
+/* Check if we spy on the sender address in buf and update stats */
+static void at76_iwspy_update(struct at76_priv *priv,
+                             struct at76_rx_buffer *buf)
 {
-       struct at76_priv *priv = hw->priv;
-       int flags;
-
-       at76_dbg(DBG_MAC80211, "%s(): changed_flags=0x%08x "
-                "total_flags=0x%08x mc_count=%d",
-                __func__, changed_flags, *total_flags, mc_count);
+       struct ieee80211_hdr_3addr *hdr =
+           (struct ieee80211_hdr_3addr *)buf->packet;
+       struct iw_quality qual;
 
-       flags = changed_flags & AT76_SUPPORTED_FILTERS;
-       *total_flags = AT76_SUPPORTED_FILTERS;
+       /* We can only set the level here */
+       qual.updated = IW_QUAL_QUAL_INVALID | IW_QUAL_NOISE_INVALID;
+       qual.level = 0;
+       qual.noise = 0;
+       at76_calc_level(priv, buf, &qual);
 
-       /* FIXME: access to priv->promisc should be protected with
-        * priv->mtx, but it's impossible because this function needs to be
-        * atomic */
+       spin_lock_bh(&priv->spy_spinlock);
 
-       if (flags && !priv->promisc) {
-               /* mac80211 wants us to enable promiscuous mode */
-               priv->promisc = 1;
-       } else if (!flags && priv->promisc) {
-               /* we need to disable promiscuous mode */
-               priv->promisc = 0;
-       } else
-               return;
+       if (priv->spy_data.spy_number > 0)
+               wireless_spy_update(priv->netdev, hdr->addr2, &qual);
 
-       queue_work(hw->workqueue, &priv->work_set_promisc);
+       spin_unlock_bh(&priv->spy_spinlock);
 }
 
-static int at76_set_key_oldfw(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                       const u8 *local_address, const u8 *address,
-                       struct ieee80211_key_conf *key)
+static void at76_rx_tasklet(unsigned long param)
 {
-       struct at76_priv *priv = hw->priv;
-
-       int i;
-
-       at76_dbg(DBG_MAC80211, "%s(): cmd %d key->alg %d key->keyidx %d "
-                "key->keylen %d",
-                __func__, cmd, key->alg, key->keyidx, key->keylen);
+       struct urb *urb = (struct urb *)param;
+       struct at76_priv *priv = urb->context;
+       struct net_device *netdev = priv->netdev;
+       struct at76_rx_buffer *buf;
+       struct ieee80211_hdr_3addr *i802_11_hdr;
+       u16 frame_ctl;
 
-       if (key->alg != ALG_WEP)
-               return -EOPNOTSUPP;
+       if (priv->device_unplugged) {
+               at76_dbg(DBG_DEVSTART, "device unplugged");
+               if (urb)
+                       at76_dbg(DBG_DEVSTART, "urb status %d", urb->status);
+               return;
+       }
 
-       key->hw_key_idx = key->keyidx;
+       if (!priv->rx_skb || !netdev || !priv->rx_skb->data)
+               return;
 
-       mutex_lock(&priv->mtx);
+       buf = (struct at76_rx_buffer *)priv->rx_skb->data;
 
-       switch (cmd) {
-       case SET_KEY:
-               memcpy(priv->wep_keys[key->keyidx], key->key, key->keylen);
-               priv->wep_keys_len[key->keyidx] = key->keylen;
+       i802_11_hdr = (struct ieee80211_hdr_3addr *)buf->packet;
 
-               /* FIXME: find out how to do this properly */
-               priv->wep_key_id = key->keyidx;
+       frame_ctl = le16_to_cpu(i802_11_hdr->frame_ctl);
 
-               break;
-       case DISABLE_KEY:
-       default:
-               priv->wep_keys_len[key->keyidx] = 0;
-               break;
+       if (urb->status != 0) {
+               if (urb->status != -ENOENT && urb->status != -ECONNRESET)
+                       at76_dbg(DBG_URB,
+                                "%s %s: - nonzero Rx bulk status received: %d",
+                                __func__, netdev->name, urb->status);
+               return;
        }
 
-       priv->wep_enabled = 0;
-
-       for (i = 0; i < WEP_KEYS; i++) {
-               if (priv->wep_keys_len[i] != 0)
-                       priv->wep_enabled = 1;
+       at76_dbg(DBG_RX_ATMEL_HDR,
+                "%s: rx frame: rate %d rssi %d noise %d link %d %s",
+                priv->netdev->name, buf->rx_rate, buf->rssi, buf->noise_level,
+                buf->link_quality, hex2str(i802_11_hdr, 48));
+       if (priv->iw_mode == IW_MODE_MONITOR) {
+               at76_rx_monitor_mode(priv);
+               goto exit;
        }
 
-       at76_startup_device(priv);
+       /* there is a new bssid around, accept it: */
+       if (buf->newbss && priv->iw_mode == IW_MODE_ADHOC) {
+               at76_dbg(DBG_PROGRESS, "%s: rx newbss", netdev->name);
+               schedule_work(&priv->work_new_bss);
+       }
 
-       mutex_unlock(&priv->mtx);
+       switch (frame_ctl & IEEE80211_FCTL_FTYPE) {
+       case IEEE80211_FTYPE_DATA:
+               at76_rx_data(priv);
+               break;
 
-       return 0;
-}
+       case IEEE80211_FTYPE_MGMT:
+               /* jal: TODO: find out if we can update iwspy also on
+                  other frames than management (might depend on the
+                  radio chip / firmware version !) */
 
-static int at76_set_key_newfw(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                       const u8 *local_address, const u8 *address,
-                       struct ieee80211_key_conf *key)
-{
-       struct at76_priv *priv = hw->priv;
-       int ret = -EOPNOTSUPP;
+               at76_iwspy_update(priv, buf);
 
-       at76_dbg(DBG_MAC80211, "%s(): cmd %d key->alg %d key->keyidx %d "
-                "key->keylen %d",
-                __func__, cmd, key->alg, key->keyidx, key->keylen);
+               at76_rx_mgmt(priv, buf);
+               break;
 
-       mutex_lock(&priv->mtx);
+       case IEEE80211_FTYPE_CTL:
+               at76_dbg(DBG_RX_CTRL, "%s: ignored ctrl frame: %04x",
+                        priv->netdev->name, frame_ctl);
+               break;
 
-       priv->mib_buf.type = MIB_MAC_ENCRYPTION;
+       default:
+               printk(KERN_DEBUG "%s: ignoring frame with framectl 0x%04x\n",
+                      priv->netdev->name, frame_ctl);
+       }
+exit:
+       at76_submit_rx_urb(priv);
+}
 
-       if (cmd == DISABLE_KEY) {
-               priv->mib_buf.size = CIPHER_KEY_LEN;
-               priv->mib_buf.index = offsetof(struct mib_mac_encryption,
-                               cipher_default_keyvalue[key->keyidx]);
-               memset(priv->mib_buf.data.data, 0, CIPHER_KEY_LEN);
-               if (at76_set_mib(priv, &priv->mib_buf) != CMD_STATUS_COMPLETE)
-                       ret = -EOPNOTSUPP; /* -EIO would be probably better */
-               else {
+/* Load firmware into kernel memory and parse it */
+static struct fwentry *at76_load_firmware(struct usb_device *udev,
+                                         enum board_type board_type)
+{
+       int ret;
+       char *str;
+       struct at76_fw_header *fwh;
+       struct fwentry *fwe = &firmwares[board_type];
 
-                       priv->keys[key->keyidx].cipher = CIPHER_NONE;
-                       priv->keys[key->keyidx].keylen = 0;
-               };
-               if (priv->default_group_key == key->keyidx)
-                       priv->default_group_key = 0xff;
+       mutex_lock(&fw_mutex);
 
-               if (priv->default_pairwise_key == key->keyidx)
-                       priv->default_pairwise_key = 0xff;
-               /* If default pairwise key is removed, fall back to
-                * group key? */
-               ret = 0;
+       if (fwe->loaded) {
+               at76_dbg(DBG_FW, "re-using previously loaded fw");
                goto exit;
-       };
-
-       if (cmd == SET_KEY) {
-               /* store key into MIB */
-               priv->mib_buf.size = CIPHER_KEY_LEN;
-               priv->mib_buf.index = offsetof(struct mib_mac_encryption,
-                               cipher_default_keyvalue[key->keyidx]);
-               memset(priv->mib_buf.data.data, 0, CIPHER_KEY_LEN);
-               memcpy(priv->mib_buf.data.data, key->key, key->keylen);
-
-               switch (key->alg) {
-               case ALG_WEP:
-                       if (key->keylen == 5) {
-                               priv->keys[key->keyidx].cipher =
-                                       CIPHER_WEP64;
-                               priv->keys[key->keyidx].keylen = 8;
-                       } else if (key->keylen == 13) {
-                               priv->keys[key->keyidx].cipher =
-                                       CIPHER_WEP128;
-                               /* Firmware needs this */
-                               priv->keys[key->keyidx].keylen = 8;
-                       } else {
-                               ret = -EOPNOTSUPP;
-                               goto exit;
-                       };
-                       break;
-               case ALG_TKIP:
-                       key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-                       priv->keys[key->keyidx].cipher = CIPHER_TKIP;
-                       priv->keys[key->keyidx].keylen = 12;
-                       break;
+       }
 
-               case ALG_CCMP:
-                       if (!at76_is_505a(priv->board_type)) {
-                               ret = -EOPNOTSUPP;
-                               goto exit;
-                       };
-                       key->flags |= IEEE80211_KEY_FLAG_GENERATE_MMIC;
-                       priv->keys[key->keyidx].cipher = CIPHER_CCMP;
-                       priv->keys[key->keyidx].keylen = 16;
-                       break;
+       at76_dbg(DBG_FW, "downloading firmware %s", fwe->fwname);
+       ret = request_firmware(&fwe->fw, fwe->fwname, &udev->dev);
+       if (ret < 0) {
+               dev_printk(KERN_ERR, &udev->dev, "firmware %s not found!\n",
+                          fwe->fwname);
+               dev_printk(KERN_ERR, &udev->dev,
+                          "you may need to download the firmware from "
+                          "http://developer.berlios.de/projects/at76c503a/");
+               goto exit;
+       }
 
-               default:
-                       ret = -EOPNOTSUPP;
-                       goto exit;
-               };
-
-               priv->mib_buf.data.data[38] = priv->keys[key->keyidx].cipher;
-               priv->mib_buf.data.data[39] = 1; /* Taken from atmelwlandriver,
-                                                   not documented */
-
-               if (is_valid_ether_addr(address))
-                       /* Pairwise key */
-                       priv->mib_buf.data.data[39] |= (KEY_PAIRWISE | KEY_TX);
-               else if (is_broadcast_ether_addr(address))
-                       /* Group key */
-                       priv->mib_buf.data.data[39] |= (KEY_TX);
-               else    /* Key used only for transmission ??? */
-                       priv->mib_buf.data.data[39] |= (KEY_TX);
-
-               if (at76_set_mib(priv, &priv->mib_buf) !=
-                               CMD_STATUS_COMPLETE) {
-                       ret = -EOPNOTSUPP; /* -EIO would be probably better */
-                       goto exit;
-               };
+       at76_dbg(DBG_FW, "got it.");
+       fwh = (struct at76_fw_header *)(fwe->fw->data);
 
-               if ((key->alg == ALG_TKIP) || (key->alg == ALG_CCMP))
-                       at76_reset_rsc(priv);
+       if (fwe->fw->size <= sizeof(*fwh)) {
+               dev_printk(KERN_ERR, &udev->dev,
+                          "firmware is too short (0x%zx)\n", fwe->fw->size);
+               goto exit;
+       }
 
-               key->hw_key_idx = key->keyidx;
+       /* CRC currently not checked */
+       fwe->board_type = le32_to_cpu(fwh->board_type);
+       if (fwe->board_type != board_type) {
+               dev_printk(KERN_ERR, &udev->dev,
+                          "board type mismatch, requested %u, got %u\n",
+                          board_type, fwe->board_type);
+               goto exit;
+       }
 
-               /* Set up default keys */
-               if (is_broadcast_ether_addr(address))
-                       priv->default_group_key = key->keyidx;
-               if (is_valid_ether_addr(address))
-                       priv->default_pairwise_key = key->keyidx;
+       fwe->fw_version.major = fwh->major;
+       fwe->fw_version.minor = fwh->minor;
+       fwe->fw_version.patch = fwh->patch;
+       fwe->fw_version.build = fwh->build;
 
-               /* Set up encryption MIBs */
+       str = (char *)fwh + le32_to_cpu(fwh->str_offset);
+       fwe->intfw = (u8 *)fwh + le32_to_cpu(fwh->int_fw_offset);
+       fwe->intfw_size = le32_to_cpu(fwh->int_fw_len);
+       fwe->extfw = (u8 *)fwh + le32_to_cpu(fwh->ext_fw_offset);
+       fwe->extfw_size = le32_to_cpu(fwh->ext_fw_len);
 
-               /* first block of settings */
-               priv->mib_buf.size = 3;
-               priv->mib_buf.index = offsetof(struct mib_mac_encryption,
-                               privacy_invoked);
-               priv->mib_buf.data.data[0] = 1; /* privacy_invoked */
-               priv->mib_buf.data.data[1] = priv->default_pairwise_key;
-               priv->mib_buf.data.data[2] = priv->default_group_key;
+       fwe->loaded = 1;
 
-               ret = at76_set_mib(priv, &priv->mib_buf);
-               if (ret != CMD_STATUS_COMPLETE)
-                       goto exit;
+       dev_printk(KERN_DEBUG, &udev->dev,
+                  "using firmware %s (version %d.%d.%d-%d)\n",
+                  fwe->fwname, fwh->major, fwh->minor, fwh->patch, fwh->build);
 
-               /* second block of settings */
-               priv->mib_buf.size = 3;
-               priv->mib_buf.index = offsetof(struct mib_mac_encryption,
-                               exclude_unencrypted);
-               priv->mib_buf.data.data[0] = 1; /* exclude_unencrypted */
-               priv->mib_buf.data.data[1] = 0; /* wep_encryption_type */
-               priv->mib_buf.data.data[2] = 0; /* ckip_key_permutation */
+       at76_dbg(DBG_DEVSTART, "board %u, int %d:%d, ext %d:%d", board_type,
+                le32_to_cpu(fwh->int_fw_offset), le32_to_cpu(fwh->int_fw_len),
+                le32_to_cpu(fwh->ext_fw_offset), le32_to_cpu(fwh->ext_fw_len));
+       at76_dbg(DBG_DEVSTART, "firmware id %s", str);
 
-               ret = at76_set_mib(priv, &priv->mib_buf);
-               if (ret != CMD_STATUS_COMPLETE)
-                       goto exit;
-               ret = 0;
-       };
 exit:
-       at76_dump_mib_mac_encryption(priv);
-       mutex_unlock(&priv->mtx);
-       return ret;
-}
-
-static int at76_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                       const u8 *local_address, const u8 *address,
-                       struct ieee80211_key_conf *key)
-{
-       struct at76_priv *priv = hw->priv;
-
-       at76_dbg(DBG_MAC80211, "%s(): cmd %d key->alg %d key->keyidx %d "
-                "key->keylen %d",
-                __func__, cmd, key->alg, key->keyidx, key->keylen);
+       mutex_unlock(&fw_mutex);
 
-       if (FIRMWARE_IS_WPA(priv->fw_version))
-               return at76_set_key_newfw(hw, cmd, local_address, address, key);
+       if (fwe->loaded)
+               return fwe;
        else
-               return at76_set_key_oldfw(hw, cmd, local_address, address, key);
-
+               return NULL;
 }
 
-static const struct ieee80211_ops at76_ops = {
-       .tx = at76_mac80211_tx,
-       .add_interface = at76_add_interface,
-       .remove_interface = at76_remove_interface,
-       .config = at76_config,
-       .config_interface = at76_config_interface,
-       .configure_filter = at76_configure_filter,
-       .start = at76_mac80211_start,
-       .stop = at76_mac80211_stop,
-       .hw_scan = at76_hw_scan,
-       .set_key = at76_set_key,
-};
-
 /* Allocate network device and initialize private data */
 static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
 {
-       struct ieee80211_hw *hw;
+       struct net_device *netdev;
        struct at76_priv *priv;
+       int i;
 
-       hw = ieee80211_alloc_hw(sizeof(struct at76_priv), &at76_ops);
-       if (!hw) {
-               printk(KERN_ERR DRIVER_NAME ": could not register"
-                      " ieee80211_hw\n");
+       /* allocate memory for our device state and initialize it */
+       netdev = alloc_etherdev(sizeof(struct at76_priv));
+       if (!netdev) {
+               dev_printk(KERN_ERR, &udev->dev, "out of memory\n");
                return NULL;
        }
 
-       priv = hw->priv;
-       priv->hw = hw;
+       priv = netdev_priv(netdev);
 
        priv->udev = udev;
+       priv->netdev = netdev;
 
        mutex_init(&priv->mtx);
+       INIT_WORK(&priv->work_assoc_done, at76_work_assoc_done);
+       INIT_WORK(&priv->work_join, at76_work_join);
+       INIT_WORK(&priv->work_new_bss, at76_work_new_bss);
+       INIT_WORK(&priv->work_start_scan, at76_work_start_scan);
        INIT_WORK(&priv->work_set_promisc, at76_work_set_promisc);
        INIT_WORK(&priv->work_submit_rx, at76_work_submit_rx);
-       INIT_DELAYED_WORK(&priv->dwork_hw_scan, at76_dwork_hw_scan);
+       INIT_DELAYED_WORK(&priv->dwork_restart, at76_dwork_restart);
+       INIT_DELAYED_WORK(&priv->dwork_get_scan, at76_dwork_get_scan);
+       INIT_DELAYED_WORK(&priv->dwork_beacon, at76_dwork_beacon);
+       INIT_DELAYED_WORK(&priv->dwork_auth, at76_dwork_auth);
+       INIT_DELAYED_WORK(&priv->dwork_assoc, at76_dwork_assoc);
+
+       spin_lock_init(&priv->mgmt_spinlock);
+       priv->next_mgmt_bulk = NULL;
+       priv->mac_state = MAC_INIT;
+
+       /* initialize empty BSS list */
+       priv->curr_bss = NULL;
+       INIT_LIST_HEAD(&priv->bss_list);
+       spin_lock_init(&priv->bss_list_spinlock);
+
+       init_timer(&priv->bss_list_timer);
+       priv->bss_list_timer.data = (unsigned long)priv;
+       priv->bss_list_timer.function = at76_bss_list_timeout;
+
+       spin_lock_init(&priv->spy_spinlock);
+
+       /* mark all rx data entries as unused */
+       for (i = 0; i < NR_RX_DATA_BUF; i++)
+               priv->rx_data[i].skb = NULL;
 
        priv->rx_tasklet.func = at76_rx_tasklet;
        priv->rx_tasklet.data = 0;
@@ -2371,9 +5197,6 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
        priv->pm_mode = AT76_PM_OFF;
        priv->pm_period = 0;
 
-       /* unit us */
-       priv->hw->channel_change_time = 100000;
-
        return priv;
 }
 
@@ -2436,42 +5259,11 @@ static int at76_alloc_urbs(struct at76_priv *priv,
        return 0;
 }
 
-static struct ieee80211_rate at76_rates[] = {
-       { .bitrate = 10, .hw_value = TX_RATE_1MBIT, },
-       { .bitrate = 20, .hw_value = TX_RATE_2MBIT, },
-       { .bitrate = 55, .hw_value = TX_RATE_5_5MBIT, },
-       { .bitrate = 110, .hw_value = TX_RATE_11MBIT, },
-};
-
-static struct ieee80211_channel at76_channels[] = {
-       { .center_freq = 2412, .hw_value = 1 },
-       { .center_freq = 2417, .hw_value = 2 },
-       { .center_freq = 2422, .hw_value = 3 },
-       { .center_freq = 2427, .hw_value = 4 },
-       { .center_freq = 2432, .hw_value = 5 },
-       { .center_freq = 2437, .hw_value = 6 },
-       { .center_freq = 2442, .hw_value = 7 },
-       { .center_freq = 2447, .hw_value = 8 },
-       { .center_freq = 2452, .hw_value = 9 },
-       { .center_freq = 2457, .hw_value = 10 },
-       { .center_freq = 2462, .hw_value = 11 },
-       { .center_freq = 2467, .hw_value = 12 },
-       { .center_freq = 2472, .hw_value = 13 },
-       { .center_freq = 2484, .hw_value = 14 }
-};
-
-static struct ieee80211_supported_band at76_supported_band = {
-       .channels = at76_channels,
-       .n_channels = ARRAY_SIZE(at76_channels),
-       .bitrates = at76_rates,
-       .n_bitrates = ARRAY_SIZE(at76_rates),
-};
-
 /* Register network device and initialize the hardware */
 static int at76_init_new_device(struct at76_priv *priv,
                                struct usb_interface *interface)
 {
-       struct device *dev = &interface->dev;
+       struct net_device *netdev = priv->netdev;
        int ret;
 
        /* set up the endpoint information */
@@ -2487,11 +5279,14 @@ static int at76_init_new_device(struct at76_priv *priv,
        /* MAC address */
        ret = at76_get_hw_config(priv);
        if (ret < 0) {
-               dev_err(dev, "cannot get MAC address\n");
+               dev_printk(KERN_ERR, &interface->dev,
+                          "cannot get MAC address\n");
                goto exit;
        }
 
        priv->domain = at76_get_reg_domain(priv->regulatory_domain);
+       /* init. netdev->dev_addr */
+       memcpy(netdev->dev_addr, priv->mac_addr, ETH_ALEN);
 
        priv->channel = DEF_CHANNEL;
        priv->iw_mode = IW_MODE_INFRA;
@@ -2501,54 +5296,47 @@ static int at76_init_new_device(struct at76_priv *priv,
        priv->txrate = TX_RATE_AUTO;
        priv->preamble_type = PREAMBLE_TYPE_LONG;
        priv->beacon_period = 100;
+       priv->beacons_last_qual = jiffies;
        priv->auth_mode = WLAN_AUTH_OPEN;
        priv->scan_min_time = DEF_SCAN_MIN_TIME;
        priv->scan_max_time = DEF_SCAN_MAX_TIME;
        priv->scan_mode = SCAN_TYPE_ACTIVE;
-       priv->default_pairwise_key = 0xff;
-       priv->default_group_key = 0xff;
-
-       /* mac80211 initialisation */
-       priv->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &at76_supported_band;
-
-       if (FIRMWARE_IS_WPA(priv->fw_version) &&
-               (at76_is_503rfmd(priv->board_type) ||
-                at76_is_505(priv->board_type)))
-               priv->hw->flags = IEEE80211_HW_SIGNAL_UNSPEC;
-       else
-               priv->hw->flags = IEEE80211_HW_RX_INCLUDES_FCS |
-                                 IEEE80211_HW_SIGNAL_UNSPEC;
-
-       priv->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
 
-       SET_IEEE80211_DEV(priv->hw, &interface->dev);
-       SET_IEEE80211_PERM_ADDR(priv->hw, priv->mac_addr);
-
-       ret = ieee80211_register_hw(priv->hw);
+       netdev->flags &= ~IFF_MULTICAST;        /* not yet or never */
+       netdev->open = at76_open;
+       netdev->stop = at76_stop;
+       netdev->get_stats = at76_get_stats;
+       netdev->ethtool_ops = &at76_ethtool_ops;
+
+       /* Add pointers to enable iwspy support. */
+       priv->wireless_data.spy_data = &priv->spy_data;
+       netdev->wireless_data = &priv->wireless_data;
+
+       netdev->hard_start_xmit = at76_tx;
+       netdev->tx_timeout = at76_tx_timeout;
+       netdev->watchdog_timeo = 2 * HZ;
+       netdev->wireless_handlers = &at76_handler_def;
+       netdev->set_multicast_list = at76_set_multicast;
+       netdev->set_mac_address = at76_set_mac_address;
+       dev_alloc_name(netdev, "wlan%d");
+
+       ret = register_netdev(priv->netdev);
        if (ret) {
-               dev_err(dev, "cannot register mac80211 hw (status %d)!\n", ret);
+               dev_printk(KERN_ERR, &interface->dev,
+                          "cannot register netdevice (status %d)!\n", ret);
                goto exit;
        }
+       priv->netdev_registered = 1;
 
-       priv->mac80211_registered = 1;
+       printk(KERN_INFO "%s: USB %s, MAC %s, firmware %d.%d.%d-%d\n",
+              netdev->name, dev_name(&interface->dev), mac2str(priv->mac_addr),
+              priv->fw_version.major, priv->fw_version.minor,
+              priv->fw_version.patch, priv->fw_version.build);
+       printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n", netdev->name,
+              priv->regulatory_domain, priv->domain->name);
 
-       dev_info(dev, "%s: USB %s, MAC %s, firmware %d.%d.%d-%d\n",
-                wiphy_name(priv->hw->wiphy),
-                dev_name(&interface->dev), mac2str(priv->mac_addr),
-                priv->fw_version.major, priv->fw_version.minor,
-                priv->fw_version.patch, priv->fw_version.build);
-       dev_info(dev, "%s: regulatory domain 0x%02x: %s\n",
-                wiphy_name(priv->hw->wiphy),
-                priv->regulatory_domain, priv->domain->name);
-       dev_info(dev, "%s: WPA support: ", wiphy_name(priv->hw->wiphy));
-       if (!FIRMWARE_IS_WPA(priv->fw_version))
-               printk("none\n");
-       else {
-               if (!at76_is_505a(priv->board_type))
-                       printk("TKIP\n");
-               else
-                       printk("TKIP, AES/CCMP\n");
-       };
+       /* we let this timer run the whole time this driver instance lives */
+       mod_timer(&priv->bss_list_timer, jiffies + BSS_LIST_TIMEOUT);
 
 exit:
        return ret;
@@ -2556,13 +5344,15 @@ exit:
 
 static void at76_delete_device(struct at76_priv *priv)
 {
+       int i;
+
        at76_dbg(DBG_PROC_ENTRY, "%s: ENTER", __func__);
 
        /* The device is gone, don't bother turning it off */
        priv->device_unplugged = 1;
 
-       if (priv->mac80211_registered)
-               ieee80211_unregister_hw(priv->hw);
+       if (priv->netdev_registered)
+               unregister_netdev(priv->netdev);
 
        /* assuming we used keventd, it must quiesce too */
        flush_scheduled_work();
@@ -2583,11 +5373,25 @@ static void at76_delete_device(struct at76_priv *priv)
        if (priv->rx_skb)
                kfree_skb(priv->rx_skb);
 
+       at76_free_bss_list(priv);
+       del_timer_sync(&priv->bss_list_timer);
+       cancel_delayed_work(&priv->dwork_get_scan);
+       cancel_delayed_work(&priv->dwork_beacon);
+       cancel_delayed_work(&priv->dwork_auth);
+       cancel_delayed_work(&priv->dwork_assoc);
+
+       if (priv->mac_state == MAC_CONNECTED)
+               at76_iwevent_bss_disconnect(priv->netdev);
+
+       for (i = 0; i < NR_RX_DATA_BUF; i++)
+               if (priv->rx_data[i].skb) {
+                       dev_kfree_skb(priv->rx_data[i].skb);
+                       priv->rx_data[i].skb = NULL;
+               }
        usb_put_dev(priv->udev);
 
-       at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/ieee80211_hw",
-                __func__);
-       ieee80211_free_hw(priv->hw);
+       at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/netdev", __func__);
+       free_netdev(priv->netdev);      /* priv is in netdev */
 
        at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __func__);
 }
@@ -2621,8 +5425,8 @@ static int at76_probe(struct usb_interface *interface,
           we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */
 
        if (op_mode == OPMODE_HW_CONFIG_MODE) {
-               dev_err(&interface->dev,
-                       "cannot handle a device in HW_CONFIG_MODE\n");
+               dev_printk(KERN_ERR, &interface->dev,
+                          "cannot handle a device in HW_CONFIG_MODE\n");
                ret = -EBUSY;
                goto error;
        }
@@ -2630,12 +5434,13 @@ static int at76_probe(struct usb_interface *interface,
        if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH
            && op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
                /* download internal firmware part */
-               dev_dbg(&interface->dev, "downloading internal firmware\n");
+               dev_printk(KERN_DEBUG, &interface->dev,
+                          "downloading internal firmware\n");
                ret = at76_load_internal_fw(udev, fwe);
                if (ret < 0) {
-                       dev_err(&interface->dev,
-                               "error %d downloading internal firmware\n",
-                               ret);
+                       dev_printk(KERN_ERR, &interface->dev,
+                                  "error %d downloading internal firmware\n",
+                                  ret);
                        goto error;
                }
                usb_put_dev(udev);
@@ -2660,7 +5465,8 @@ static int at76_probe(struct usb_interface *interface,
                need_ext_fw = 1;
 
        if (need_ext_fw) {
-               dev_dbg(&interface->dev, "downloading external firmware\n");
+               dev_printk(KERN_DEBUG, &interface->dev,
+                          "downloading external firmware\n");
 
                ret = at76_load_external_fw(udev, fwe);
                if (ret)
@@ -2669,8 +5475,8 @@ static int at76_probe(struct usb_interface *interface,
                /* Re-check firmware version */
                ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv));
                if (ret < 0) {
-                       dev_err(&interface->dev,
-                               "error %d getting firmware version\n", ret);
+                       dev_printk(KERN_ERR, &interface->dev,
+                                  "error %d getting firmware version\n", ret);
                        goto error;
                }
        }
@@ -2681,6 +5487,7 @@ static int at76_probe(struct usb_interface *interface,
                goto error;
        }
 
+       SET_NETDEV_DEV(priv->netdev, &interface->dev);
        usb_set_intfdata(interface, priv);
 
        memcpy(&priv->fw_version, &fwv, sizeof(struct mib_fw_version));
@@ -2708,7 +5515,7 @@ static void at76_disconnect(struct usb_interface *interface)
        if (!priv)
                return;
 
-       printk(KERN_INFO "%s: disconnecting\n", wiphy_name(priv->hw->wiphy));
+       printk(KERN_INFO "%s: disconnecting\n", priv->netdev->name);
        at76_delete_device(priv);
        dev_printk(KERN_INFO, &interface->dev, "disconnected\n");
 }
@@ -2764,8 +5571,5 @@ MODULE_AUTHOR("Alex <alex@foogod.com>");
 MODULE_AUTHOR("Nick Jones");
 MODULE_AUTHOR("Balint Seeber <n0_5p4m_p13453@hotmail.com>");
 MODULE_AUTHOR("Pavel Roskin <proski@gnu.org>");
-MODULE_AUTHOR("Guido Guenther <agx@sigxcpu.org>");
-MODULE_AUTHOR("Kalle Valo <kalle.valo@iki.fi>");
-MODULE_AUTHOR("Milan Plzik <milan.plzik@gmail.com>");
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
index 8bb352f16d4598492d074d8ed8d27751ae09af18..b20be9da1fa15608d31d71701ae7102ba3daac9f 100644 (file)
@@ -34,6 +34,23 @@ enum board_type {
        BOARD_505AMX = 8
 };
 
+/* our private ioctl's */
+/* preamble length (0 - long, 1 - short, 2 - auto) */
+#define AT76_SET_SHORT_PREAMBLE                (SIOCIWFIRSTPRIV + 0)
+#define AT76_GET_SHORT_PREAMBLE                (SIOCIWFIRSTPRIV + 1)
+/* which debug channels are enabled */
+#define AT76_SET_DEBUG                 (SIOCIWFIRSTPRIV + 2)
+#define AT76_GET_DEBUG                 (SIOCIWFIRSTPRIV + 3)
+/* power save mode (incl. the Atmel proprietary smart save mode) */
+#define AT76_SET_POWERSAVE_MODE                (SIOCIWFIRSTPRIV + 4)
+#define AT76_GET_POWERSAVE_MODE                (SIOCIWFIRSTPRIV + 5)
+/* min and max channel times for scan */
+#define AT76_SET_SCAN_TIMES            (SIOCIWFIRSTPRIV + 6)
+#define AT76_GET_SCAN_TIMES            (SIOCIWFIRSTPRIV + 7)
+/* scan mode (0 - active, 1 - passive) */
+#define AT76_SET_SCAN_MODE             (SIOCIWFIRSTPRIV + 8)
+#define AT76_GET_SCAN_MODE             (SIOCIWFIRSTPRIV + 9)
+
 #define CMD_STATUS_IDLE                                0x00
 #define CMD_STATUS_COMPLETE                    0x01
 #define CMD_STATUS_UNKNOWN                     0x02
@@ -65,7 +82,6 @@ enum board_type {
 #define MIB_MAC                        0x03
 #define MIB_MAC_MGMT           0x05
 #define MIB_MAC_WEP            0x06
-#define MIB_MAC_ENCRYPTION     0x06
 #define MIB_PHY                        0x07
 #define MIB_FW_VERSION         0x08
 #define MIB_MDOMAIN            0x09
@@ -90,26 +106,6 @@ enum board_type {
 #define AT76_PM_ON             2
 #define AT76_PM_SMART          3
 
-/* cipher values for encryption keys */
-#define CIPHER_NONE            0       /* this value is only guessed */
-#define CIPHER_WEP64           1
-#define CIPHER_TKIP            2
-#define CIPHER_CCMP            3
-#define CIPHER_CCX             4       /* for consistency sake only */
-#define CIPHER_WEP128          5
-
-/* bit flags key types for encryption keys */
-#define KEY_PAIRWISE           2
-#define KEY_TX                 4
-
-#define CIPHER_KEYS            (4)
-#define CIPHER_KEY_LEN         (40)
-
-struct key_config {
-       u8 cipher;
-       u8 keylen;
-};
-
 struct hwcfg_r505 {
        u8 cr39_values[14];
        u8 reserved1[14];
@@ -151,9 +147,6 @@ union at76_hwcfg {
 
 #define WEP_SMALL_KEY_LEN      (40 / 8)
 #define WEP_LARGE_KEY_LEN      (104 / 8)
-#define WEP_KEYS               (4)
-
-
 
 struct at76_card_config {
        u8 exclude_unencrypted;
@@ -168,7 +161,7 @@ struct at76_card_config {
        u8 privacy_invoked;
        u8 wep_default_key_id;  /* 0..3 */
        u8 current_ssid[32];
-       u8 wep_default_key_value[4][WEP_LARGE_KEY_LEN];
+       u8 wep_default_key_value[4][WEP_KEY_LEN];
        u8 ssid_len;
        u8 short_preamble;
        __le16 beacon_period;
@@ -193,7 +186,7 @@ struct at76_rx_buffer {
        u8 link_quality;
        u8 noise_level;
        __le32 rx_time;
-       u8 packet[IEEE80211_MAX_FRAG_THRESHOLD];
+       u8 packet[IEEE80211_FRAME_LEN + IEEE80211_FCS_LEN];
 } __attribute__((packed));
 
 /* Length of Atmel-specific Tx header before 802.11 frame */
@@ -203,11 +196,8 @@ struct at76_tx_buffer {
        __le16 wlength;
        u8 tx_rate;
        u8 padding;
-       u8 key_id;
-       u8 cipher_type;
-       u8 cipher_length;
-       u8 reserved;
-       u8 packet[IEEE80211_MAX_FRAG_THRESHOLD];
+       u8 reserved[4];
+       u8 packet[IEEE80211_FRAME_LEN + IEEE80211_FCS_LEN];
 } __attribute__((packed));
 
 /* defines for scan_type below */
@@ -254,7 +244,6 @@ struct set_mib_buffer {
                u8 byte;
                __le16 word;
                u8 addr[ETH_ALEN];
-               u8 data[256];   /* we need more space for mib_mac_encryption */
        } data;
 } __attribute__((packed));
 
@@ -328,24 +317,10 @@ struct mib_mac_wep {
        u8 exclude_unencrypted;
        __le32 wep_icv_error_count;
        __le32 wep_excluded_count;
-       u8 wep_default_keyvalue[WEP_KEYS][WEP_LARGE_KEY_LEN];
+       u8 wep_default_keyvalue[WEP_KEYS][WEP_KEY_LEN];
        u8 encryption_level;    /* 1 for 40bit, 2 for 104bit encryption */
 } __attribute__((packed));
 
-struct mib_mac_encryption {
-       u8 cipher_default_keyvalue[CIPHER_KEYS][CIPHER_KEY_LEN];
-       u8 tkip_bssid[6];
-       u8 privacy_invoked;
-       u8 cipher_default_key_id;
-       u8 cipher_default_group_key_id;
-       u8 exclude_unencrypted;
-       u8 wep_encryption_type;
-       u8 ckip_key_permutation;        /* bool */
-       __le32 wep_icv_error_count;
-       __le32 wep_excluded_count;
-       u8 key_rsc[CIPHER_KEYS][8];
-} __attribute__((packed));
-
 struct mib_phy {
        __le32 ed_threshold;
 
@@ -389,6 +364,16 @@ struct at76_fw_header {
        __le32 ext_fw_len;      /* external firmware image length */
 } __attribute__((packed));
 
+enum mac_state {
+       MAC_INIT,
+       MAC_SCANNING,
+       MAC_AUTH,
+       MAC_ASSOC,
+       MAC_JOINING,
+       MAC_CONNECTED,
+       MAC_OWN_IBSS
+};
+
 /* a description of a regulatory domain and the allowed channels */
 struct reg_domain {
        u16 code;
@@ -396,6 +381,47 @@ struct reg_domain {
        u32 channel_map;        /* if bit N is set, channel (N+1) is allowed */
 };
 
+/* how long do we keep a (I)BSS in the bss_list in jiffies
+   this should be long enough for the user to retrieve the table
+   (by iwlist ?) after the device started, because all entries from
+   other channels than the one the device locks on get removed, too */
+#define BSS_LIST_TIMEOUT       (120 * HZ)
+/* struct to store BSS info found during scan */
+#define BSS_LIST_MAX_RATE_LEN  32      /* 32 rates should be enough ... */
+
+struct bss_info {
+       struct list_head list;
+
+       u8 bssid[ETH_ALEN];     /* bssid */
+       u8 ssid[IW_ESSID_MAX_SIZE];     /* essid */
+       u8 ssid_len;            /* length of ssid above */
+       u8 channel;
+       u16 capa;               /* BSS capabilities */
+       u16 beacon_interval;    /* beacon interval, Kus (1024 microseconds) */
+       u8 rates[BSS_LIST_MAX_RATE_LEN];        /* supported rates in units of
+                                                  500 kbps, ORed with 0x80 for
+                                                  basic rates */
+       u8 rates_len;
+
+       /* quality of received beacon */
+       u8 rssi;
+       u8 link_qual;
+       u8 noise_level;
+
+       unsigned long last_rx;  /* time (jiffies) of last beacon received */
+};
+
+/* a rx data buffer to collect rx fragments */
+struct rx_data_buf {
+       u8 sender[ETH_ALEN];    /* sender address */
+       u16 seqnr;              /* sequence number */
+       u16 fragnr;             /* last fragment received */
+       unsigned long last_rx;  /* jiffies of last rx */
+       struct sk_buff *skb;    /* == NULL if entry is free */
+};
+
+#define NR_RX_DATA_BUF         8
+
 /* Data for one loaded firmware file */
 struct fwentry {
        const char *const fwname;
@@ -412,9 +438,11 @@ struct fwentry {
 
 struct at76_priv {
        struct usb_device *udev;        /* USB device pointer */
+       struct net_device *netdev;      /* net device pointer */
+       struct net_device_stats stats;  /* net device stats */
+       struct iw_statistics wstats;    /* wireless stats */
 
        struct sk_buff *rx_skb; /* skbuff for receiving data */
-       struct sk_buff *tx_skb; /* skbuff for transmitting data */
        void *bulk_out_buffer;  /* buffer for sending data */
 
        struct urb *tx_urb;     /* URB for sending data */
@@ -426,17 +454,26 @@ struct at76_priv {
        struct mutex mtx;       /* locks this structure */
 
        /* work queues */
+       struct work_struct work_assoc_done;
+       struct work_struct work_join;
+       struct work_struct work_new_bss;
+       struct work_struct work_start_scan;
        struct work_struct work_set_promisc;
        struct work_struct work_submit_rx;
-       struct delayed_work dwork_hw_scan;
+       struct delayed_work dwork_restart;
+       struct delayed_work dwork_get_scan;
+       struct delayed_work dwork_beacon;
+       struct delayed_work dwork_auth;
+       struct delayed_work dwork_assoc;
 
        struct tasklet_struct rx_tasklet;
 
        /* the WEP stuff */
        int wep_enabled;        /* 1 if WEP is enabled */
        int wep_key_id;         /* key id to be used */
-       u8 wep_keys[WEP_KEYS][WEP_LARGE_KEY_LEN];       /* WEP keys */
-       u8 wep_keys_len[WEP_KEYS];      /* length of WEP keys */
+       u8 wep_keys[WEP_KEYS][WEP_KEY_LEN];     /* the four WEP keys,
+                                                  5 or 13 bytes are used */
+       u8 wep_keys_len[WEP_KEYS];      /* the length of the above keys */
 
        int channel;
        int iw_mode;
@@ -458,13 +495,44 @@ struct at76_priv {
        int scan_mode;          /* SCAN_TYPE_ACTIVE, SCAN_TYPE_PASSIVE */
        int scan_need_any;      /* if set, need to scan for any ESSID */
 
+       /* the list we got from scanning */
+       spinlock_t bss_list_spinlock;   /* protects bss_list operations */
+       struct list_head bss_list;      /* list of BSS we got beacons from */
+       struct timer_list bss_list_timer;       /* timer to purge old entries
+                                                  from bss_list */
+       struct bss_info *curr_bss;      /* current BSS */
        u16 assoc_id;           /* current association ID, if associated */
 
+       u8 wanted_bssid[ETH_ALEN];
+       int wanted_bssid_valid; /* != 0 if wanted_bssid is to be used */
+
+       /* some data for infrastructure mode only */
+       spinlock_t mgmt_spinlock;       /* this spinlock protects access to
+                                          next_mgmt_bulk */
+
+       struct at76_tx_buffer *next_mgmt_bulk;  /* pending management msg to
+                                                  send via bulk out */
+       enum mac_state mac_state;
+       enum {
+               SCAN_IDLE,
+               SCAN_IN_PROGRESS,
+               SCAN_COMPLETED
+       } scan_state;
+       time_t last_scan;
+
+       int retries;            /* remaining retries in case of timeout when
+                                * sending AuthReq or AssocReq */
        u8 pm_mode;             /* power management mode */
        u32 pm_period;          /* power management period in microseconds */
 
        struct reg_domain const *domain;        /* reg domain description */
 
+       /* iwspy support */
+       spinlock_t spy_spinlock;
+       struct iw_spy_data spy_data;
+
+       struct iw_public_data wireless_data;
+
        /* These fields contain HW config provided by the device (not all of
         * these fields are used by all board types) */
        u8 mac_addr[ETH_ALEN];
@@ -472,6 +540,9 @@ struct at76_priv {
 
        struct at76_card_config card_config;
 
+       /* store rx fragments until complete */
+       struct rx_data_buf rx_data[NR_RX_DATA_BUF];
+
        enum board_type board_type;
        struct mib_fw_version fw_version;
 
@@ -479,20 +550,58 @@ struct at76_priv {
        unsigned int netdev_registered:1;
        struct set_mib_buffer mib_buf;  /* global buffer for set_mib calls */
 
+       /* beacon counting */
        int beacon_period;      /* period of mgmt beacons, Kus */
+       int beacons_received;
+       unsigned long beacons_last_qual;        /* time we restarted counting
+                                                  beacons */
+};
 
-       struct ieee80211_hw *hw;
-       int mac80211_registered;
-
-       struct key_config keys[4];      /* installed key types */
-       u8 default_pairwise_key;
-       u8 default_group_key;
+struct at76_rx_radiotap {
+       struct ieee80211_radiotap_header rt_hdr;
+       __le64 rt_tsft;
+       u8 rt_flags;
+       u8 rt_rate;
+       s8 rt_signal;
+       s8 rt_noise;
 };
 
-#define AT76_SUPPORTED_FILTERS FIF_PROMISC_IN_BSS
+#define AT76_RX_RADIOTAP_PRESENT                 \
+       ((1 << IEEE80211_RADIOTAP_TSFT)         | \
+       (1 << IEEE80211_RADIOTAP_FLAGS)         | \
+       (1 << IEEE80211_RADIOTAP_RATE)          | \
+       (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)  | \
+       (1 << IEEE80211_RADIOTAP_DB_ANTNOISE))
+
+#define BEACON_MAX_DATA_LENGTH 1500
+
+/* the maximum size of an AssocReq packet */
+#define ASSOCREQ_MAX_SIZE \
+  (AT76_TX_HDRLEN + sizeof(struct ieee80211_assoc_request) + \
+   1 + 1 + IW_ESSID_MAX_SIZE + 1 + 1 + 4)
+
+/* for shared secret auth, add the challenge text size */
+#define AUTH_FRAME_SIZE (AT76_TX_HDRLEN + sizeof(struct ieee80211_auth))
+
+/* Maximal number of AuthReq retries */
+#define AUTH_RETRIES           3
 
+/* Maximal number of AssocReq retries */
+#define ASSOC_RETRIES          3
+
+/* Beacon timeout in managed mode when we are connected */
+#define BEACON_TIMEOUT         (10 * HZ)
+
+/* Timeout for authentication response */
+#define AUTH_TIMEOUT           (1 * HZ)
+
+/* Timeout for association response */
+#define ASSOC_TIMEOUT          (1 * HZ)
+
+/* Polling interval when scan is running */
 #define SCAN_POLL_INTERVAL     (HZ / 4)
 
+/* Command completion timeout */
 #define CMD_COMPLETION_TIMEOUT (5 * HZ)
 
 #define DEF_RTS_THRESHOLD      1536
@@ -502,6 +611,8 @@ struct at76_priv {
 #define DEF_SCAN_MIN_TIME      10
 #define DEF_SCAN_MAX_TIME      120
 
+#define MAX_RTS_THRESHOLD      (MAX_FRAG_THRESHOLD + 1)
+
 /* the max padding size for tx in bytes (see calc_padding) */
 #define MAX_PADDING_SIZE       53
 
index 5ffe269c238298327f07bae3bb0b1dff6e190247..ab69c1bf36a8205fd80a2abb46cd7c16e1d9d5be 100644 (file)
@@ -622,7 +622,7 @@ static int set_ctrl_bits(void)
 }
 
 /* sets ctrl & data port bits according to current signals values */
-static void set_bits(void)
+static void panel_set_bits(void)
 {
        set_data_bits();
        set_ctrl_bits();
@@ -707,12 +707,12 @@ static void lcd_send_serial(int byte)
         */
        for (bit = 0; bit < 8; bit++) {
                bits.cl = BIT_CLR;      /* CLK low */
-               set_bits();
+               panel_set_bits();
                bits.da = byte & 1;
-               set_bits();
+               panel_set_bits();
                udelay(2);      /* maintain the data during 2 us before CLK up */
                bits.cl = BIT_SET;      /* CLK high */
-               set_bits();
+               panel_set_bits();
                udelay(1);      /* maintain the strobe during 1 us */
                byte >>= 1;
        }
@@ -727,7 +727,7 @@ static void lcd_backlight(int on)
        /* The backlight is activated by seting the AUTOFEED line to +5V  */
        spin_lock(&pprt_lock);
        bits.bl = on;
-       set_bits();
+       panel_set_bits();
        spin_unlock(&pprt_lock);
 }
 
index 8bcde8cde5547fd7daf726817ec4f54a8bf27d97..b2ceb4aff2330423150fcb48e69e637e88dca548 100644 (file)
@@ -11,6 +11,7 @@ obj-$(CONFIG_USB_MON)         += mon/
 obj-$(CONFIG_PCI)              += host/
 obj-$(CONFIG_USB_EHCI_HCD)     += host/
 obj-$(CONFIG_USB_ISP116X_HCD)  += host/
+obj-$(CONFIG_USB_ISP1760_HCD)  += host/
 obj-$(CONFIG_USB_OHCI_HCD)     += host/
 obj-$(CONFIG_USB_UHCI_HCD)     += host/
 obj-$(CONFIG_USB_FHCI_HCD)     += host/
index 97ba4a985edcbf87144562302d83ba573bd1ff8b..326dd7f65ee9aaf0b846d09c80c9d6d2b260b0d8 100644 (file)
@@ -1349,9 +1349,6 @@ static struct usb_device_id acm_ids[] = {
        { USB_DEVICE(0x0e8d, 0x0003), /* FIREFLY, MediaTek Inc; andrey.arapov@gmail.com */
        .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
        },
-       { USB_DEVICE(0x0e8d, 0x3329), /* i-blue 747, Qstarz BT-Q1000, Holux M-241 */
-       .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
-       },
        { USB_DEVICE(0x0e8d, 0x3329), /* MediaTek Inc GPS */
        .driver_info = NO_UNION_NORMAL, /* has no union descriptor */
        },
index c54fc40458b171aa863eec63aa4821a45287d4e2..a4301dc02d275c1f28c77cde42183d1a2d435792 100644 (file)
@@ -297,19 +297,6 @@ int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t message)
 }
 EXPORT_SYMBOL_GPL(usb_hcd_pci_suspend);
 
-/**
- * usb_hcd_pci_resume_early - resume a PCI-based HCD before IRQs are enabled
- * @dev: USB Host Controller being resumed
- *
- * Store this function in the HCD's struct pci_driver as .resume_early.
- */
-int usb_hcd_pci_resume_early(struct pci_dev *dev)
-{
-       pci_restore_state(dev);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(usb_hcd_pci_resume_early);
-
 /**
  * usb_hcd_pci_resume - power management resume of a PCI-based HCD
  * @dev: USB Host Controller being resumed
@@ -333,6 +320,8 @@ int usb_hcd_pci_resume(struct pci_dev *dev)
        }
 #endif
 
+       pci_restore_state(dev);
+
        hcd = pci_get_drvdata(dev);
        if (hcd->state != HC_STATE_SUSPENDED) {
                dev_dbg(hcd->self.controller,
index 5b94a56bec2356d7945ec4d56bca543d0c229a26..f750eb1ab595e926aecba81a9579f8674eae76fa 100644 (file)
@@ -257,7 +257,6 @@ extern void usb_hcd_pci_remove(struct pci_dev *dev);
 
 #ifdef CONFIG_PM
 extern int usb_hcd_pci_suspend(struct pci_dev *dev, pm_message_t msg);
-extern int usb_hcd_pci_resume_early(struct pci_dev *dev);
 extern int usb_hcd_pci_resume(struct pci_dev *dev);
 #endif /* CONFIG_PM */
 
index d6c5bcd400641730a40e88cbf31961a88cd9309f..d701bf4698d222f5b6a3ed50ff159b4de854f626 100644 (file)
@@ -1622,6 +1622,8 @@ static int qe_ep_disable(struct usb_ep *_ep)
        nuke(ep, -ESHUTDOWN);
        ep->desc = NULL;
        ep->stopped = 1;
+       ep->tx_req = NULL;
+       qe_ep_reset(udc, ep->epnum);
        spin_unlock_irqrestore(&udc->lock, flags);
 
        cpm_muram_free(cpm_muram_offset(ep->rxbase));
@@ -1681,14 +1683,11 @@ static void qe_free_request(struct usb_ep *_ep, struct usb_request *_req)
                kfree(req);
 }
 
-/* queues (submits) an I/O request to an endpoint */
-static int qe_ep_queue(struct usb_ep *_ep, struct usb_request *_req,
-                               gfp_t gfp_flags)
+static int __qe_ep_queue(struct usb_ep *_ep, struct usb_request *_req)
 {
        struct qe_ep *ep = container_of(_ep, struct qe_ep, ep);
        struct qe_req *req = container_of(_req, struct qe_req, req);
        struct qe_udc *udc;
-       unsigned long flags;
        int reval;
 
        udc = ep->udc;
@@ -1732,7 +1731,7 @@ static int qe_ep_queue(struct usb_ep *_ep, struct usb_request *_req,
        list_add_tail(&req->queue, &ep->queue);
        dev_vdbg(udc->dev, "gadget have request in %s! %d\n",
                        ep->name, req->req.length);
-       spin_lock_irqsave(&udc->lock, flags);
+
        /* push the request to device */
        if (ep_is_in(ep))
                reval = ep_req_send(ep, req);
@@ -1748,11 +1747,24 @@ static int qe_ep_queue(struct usb_ep *_ep, struct usb_request *_req,
        if (ep->dir == USB_DIR_OUT)
                reval = ep_req_receive(ep, req);
 
-       spin_unlock_irqrestore(&udc->lock, flags);
-
        return 0;
 }
 
+/* queues (submits) an I/O request to an endpoint */
+static int qe_ep_queue(struct usb_ep *_ep, struct usb_request *_req,
+                      gfp_t gfp_flags)
+{
+       struct qe_ep *ep = container_of(_ep, struct qe_ep, ep);
+       struct qe_udc *udc = ep->udc;
+       unsigned long flags;
+       int ret;
+
+       spin_lock_irqsave(&udc->lock, flags);
+       ret = __qe_ep_queue(_ep, _req);
+       spin_unlock_irqrestore(&udc->lock, flags);
+       return ret;
+}
+
 /* dequeues (cancels, unlinks) an I/O request from an endpoint */
 static int qe_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req)
 {
@@ -2008,7 +2020,7 @@ static void ch9getstatus(struct qe_udc *udc, u8 request_type, u16 value,
        udc->ep0_dir = USB_DIR_IN;
 
        /* data phase */
-       status = qe_ep_queue(&ep->ep, &req->req, GFP_ATOMIC);
+       status = __qe_ep_queue(&ep->ep, &req->req);
 
        if (status == 0)
                return;
@@ -2151,6 +2163,9 @@ static int reset_irq(struct qe_udc *udc)
 {
        unsigned char i;
 
+       if (udc->usb_state == USB_STATE_DEFAULT)
+               return 0;
+
        qe_usb_disable();
        out_8(&udc->usb_regs->usb_usadr, 0);
 
@@ -2442,8 +2457,12 @@ static int __devinit qe_udc_reg_init(struct qe_udc *udc)
        struct usb_ctlr __iomem *qe_usbregs;
        qe_usbregs = udc->usb_regs;
 
-       /* Init the usb register */
+       /* Spec says that we must enable the USB controller to change mode. */
        out_8(&qe_usbregs->usb_usmod, 0x01);
+       /* Mode changed, now disable it, since muram isn't initialized yet. */
+       out_8(&qe_usbregs->usb_usmod, 0x00);
+
+       /* Initialize the rest. */
        out_be16(&qe_usbregs->usb_usbmr, 0);
        out_8(&qe_usbregs->usb_uscom, 0);
        out_be16(&qe_usbregs->usb_usber, USBER_ALL_CLEAR);
@@ -2604,6 +2623,10 @@ static int __devinit qe_udc_probe(struct of_device *ofdev,
                        (unsigned long)udc_controller);
        /* request irq and disable DR  */
        udc_controller->usb_irq = irq_of_parse_and_map(np, 0);
+       if (!udc_controller->usb_irq) {
+               ret = -EINVAL;
+               goto err_noirq;
+       }
 
        ret = request_irq(udc_controller->usb_irq, qe_udc_irq, 0,
                                driver_name, udc_controller);
@@ -2625,6 +2648,8 @@ static int __devinit qe_udc_probe(struct of_device *ofdev,
 err6:
        free_irq(udc_controller->usb_irq, udc_controller);
 err5:
+       irq_dispose_mapping(udc_controller->usb_irq);
+err_noirq:
        if (udc_controller->nullmap) {
                dma_unmap_single(udc_controller->gadget.dev.parent,
                        udc_controller->nullp, 256,
@@ -2648,7 +2673,7 @@ err2:
        iounmap(udc_controller->usb_regs);
 err1:
        kfree(udc_controller);
-
+       udc_controller = NULL;
        return ret;
 }
 
@@ -2710,6 +2735,7 @@ static int __devexit qe_udc_remove(struct of_device *ofdev)
        kfree(ep->txframe);
 
        free_irq(udc_controller->usb_irq, udc_controller);
+       irq_dispose_mapping(udc_controller->usb_irq);
 
        tasklet_kill(&udc_controller->rx_tasklet);
 
index 9b36205c5759d3d1f8cf11b8edeba1958d1371e1..0ce4e2819847c13fb7548fcf910923495d4588ba 100644 (file)
@@ -904,8 +904,8 @@ static void pxa25x_ep_fifo_flush(struct usb_ep *_ep)
 
        /* most IN status is the same, but ISO can't stall */
        *ep->reg_udccs = UDCCS_BI_TPC|UDCCS_BI_FTF|UDCCS_BI_TUR
-               | (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC)
-                       ? 0 : UDCCS_BI_SST;
+               | (ep->bmAttributes == USB_ENDPOINT_XFER_ISOC
+                       ? 0 : UDCCS_BI_SST);
 }
 
 
index 8c26f5ea2b839070fe2afb6d8a41c66a36aeaafa..d2860a823680065859ee105872732f65445f94b1 100644 (file)
@@ -63,7 +63,7 @@ MODULE_PARM_DESC (rndis_debug, "enable debugging");
 static rndis_params rndis_per_dev_params [RNDIS_MAX_CONFIGS];
 
 /* Driver Version */
-static const __le32 rndis_driver_version = __constant_cpu_to_le32 (1);
+static const __le32 rndis_driver_version = cpu_to_le32 (1);
 
 /* Function Prototypes */
 static rndis_resp_t *rndis_add_response (int configNr, u32 length);
@@ -190,7 +190,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
 
        /* response goes here, right after the header */
        outbuf = (__le32 *) &resp[1];
-       resp->InformationBufferOffset = __constant_cpu_to_le32 (16);
+       resp->InformationBufferOffset = cpu_to_le32 (16);
 
        net = rndis_per_dev_params[configNr].dev;
        if (net->get_stats)
@@ -221,7 +221,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
                 * reddite ergo quae sunt Caesaris Caesari
                 * et quae sunt Dei Deo!
                 */
-               *outbuf = __constant_cpu_to_le32 (0);
+               *outbuf = cpu_to_le32 (0);
                retval = 0;
                break;
 
@@ -256,7 +256,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
                        pr_debug("%s: OID_GEN_LINK_SPEED\n", __func__);
                if (rndis_per_dev_params [configNr].media_state
                                == NDIS_MEDIA_STATE_DISCONNECTED)
-                       *outbuf = __constant_cpu_to_le32 (0);
+                       *outbuf = cpu_to_le32 (0);
                else
                        *outbuf = cpu_to_le32 (
                                rndis_per_dev_params [configNr].speed);
@@ -317,7 +317,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
        /* mandatory */
        case OID_GEN_MAXIMUM_TOTAL_SIZE:
                pr_debug("%s: OID_GEN_MAXIMUM_TOTAL_SIZE\n", __func__);
-               *outbuf = __constant_cpu_to_le32(RNDIS_MAX_TOTAL_SIZE);
+               *outbuf = cpu_to_le32(RNDIS_MAX_TOTAL_SIZE);
                retval = 0;
                break;
 
@@ -332,7 +332,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
 
        case OID_GEN_PHYSICAL_MEDIUM:
                pr_debug("%s: OID_GEN_PHYSICAL_MEDIUM\n", __func__);
-               *outbuf = __constant_cpu_to_le32 (0);
+               *outbuf = cpu_to_le32 (0);
                retval = 0;
                break;
 
@@ -342,7 +342,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
         */
        case OID_GEN_MAC_OPTIONS:               /* from WinME */
                pr_debug("%s: OID_GEN_MAC_OPTIONS\n", __func__);
-               *outbuf = __constant_cpu_to_le32(
+               *outbuf = cpu_to_le32(
                          NDIS_MAC_OPTION_RECEIVE_SERIALIZED
                        | NDIS_MAC_OPTION_FULL_DUPLEX);
                retval = 0;
@@ -431,7 +431,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
        case OID_802_3_MULTICAST_LIST:
                pr_debug("%s: OID_802_3_MULTICAST_LIST\n", __func__);
                /* Multicast base address only */
-               *outbuf = __constant_cpu_to_le32 (0xE0000000);
+               *outbuf = cpu_to_le32 (0xE0000000);
                retval = 0;
                break;
 
@@ -439,7 +439,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
        case OID_802_3_MAXIMUM_LIST_SIZE:
                pr_debug("%s: OID_802_3_MAXIMUM_LIST_SIZE\n", __func__);
                /* Multicast base address only */
-               *outbuf = __constant_cpu_to_le32 (1);
+               *outbuf = cpu_to_le32 (1);
                retval = 0;
                break;
 
@@ -461,14 +461,14 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len,
        /* mandatory */
        case OID_802_3_XMIT_ONE_COLLISION:
                pr_debug("%s: OID_802_3_XMIT_ONE_COLLISION\n", __func__);
-               *outbuf = __constant_cpu_to_le32 (0);
+               *outbuf = cpu_to_le32 (0);
                retval = 0;
                break;
 
        /* mandatory */
        case OID_802_3_XMIT_MORE_COLLISIONS:
                pr_debug("%s: OID_802_3_XMIT_MORE_COLLISIONS\n", __func__);
-               *outbuf = __constant_cpu_to_le32 (0);
+               *outbuf = cpu_to_le32 (0);
                retval = 0;
                break;
 
@@ -572,24 +572,24 @@ static int rndis_init_response (int configNr, rndis_init_msg_type *buf)
                return -ENOMEM;
        resp = (rndis_init_cmplt_type *) r->buf;
 
-       resp->MessageType = __constant_cpu_to_le32 (
+       resp->MessageType = cpu_to_le32 (
                        REMOTE_NDIS_INITIALIZE_CMPLT);
-       resp->MessageLength = __constant_cpu_to_le32 (52);
+       resp->MessageLength = cpu_to_le32 (52);
        resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
-       resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
-       resp->MajorVersion = __constant_cpu_to_le32 (RNDIS_MAJOR_VERSION);
-       resp->MinorVersion = __constant_cpu_to_le32 (RNDIS_MINOR_VERSION);
-       resp->DeviceFlags = __constant_cpu_to_le32 (RNDIS_DF_CONNECTIONLESS);
-       resp->Medium = __constant_cpu_to_le32 (RNDIS_MEDIUM_802_3);
-       resp->MaxPacketsPerTransfer = __constant_cpu_to_le32 (1);
+       resp->Status = cpu_to_le32 (RNDIS_STATUS_SUCCESS);
+       resp->MajorVersion = cpu_to_le32 (RNDIS_MAJOR_VERSION);
+       resp->MinorVersion = cpu_to_le32 (RNDIS_MINOR_VERSION);
+       resp->DeviceFlags = cpu_to_le32 (RNDIS_DF_CONNECTIONLESS);
+       resp->Medium = cpu_to_le32 (RNDIS_MEDIUM_802_3);
+       resp->MaxPacketsPerTransfer = cpu_to_le32 (1);
        resp->MaxTransferSize = cpu_to_le32 (
                  params->dev->mtu
                + sizeof (struct ethhdr)
                + sizeof (struct rndis_packet_msg_type)
                + 22);
-       resp->PacketAlignmentFactor = __constant_cpu_to_le32 (0);
-       resp->AFListOffset = __constant_cpu_to_le32 (0);
-       resp->AFListSize = __constant_cpu_to_le32 (0);
+       resp->PacketAlignmentFactor = cpu_to_le32 (0);
+       resp->AFListOffset = cpu_to_le32 (0);
+       resp->AFListSize = cpu_to_le32 (0);
 
        params->resp_avail(params->v);
        return 0;
@@ -617,7 +617,7 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf)
                return -ENOMEM;
        resp = (rndis_query_cmplt_type *) r->buf;
 
-       resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_QUERY_CMPLT);
+       resp->MessageType = cpu_to_le32 (REMOTE_NDIS_QUERY_CMPLT);
        resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
 
        if (gen_ndis_query_resp (configNr, le32_to_cpu (buf->OID),
@@ -626,13 +626,13 @@ static int rndis_query_response (int configNr, rndis_query_msg_type *buf)
                        le32_to_cpu(buf->InformationBufferLength),
                        r)) {
                /* OID not supported */
-               resp->Status = __constant_cpu_to_le32 (
+               resp->Status = cpu_to_le32 (
                                RNDIS_STATUS_NOT_SUPPORTED);
-               resp->MessageLength = __constant_cpu_to_le32 (sizeof *resp);
-               resp->InformationBufferLength = __constant_cpu_to_le32 (0);
-               resp->InformationBufferOffset = __constant_cpu_to_le32 (0);
+               resp->MessageLength = cpu_to_le32 (sizeof *resp);
+               resp->InformationBufferLength = cpu_to_le32 (0);
+               resp->InformationBufferOffset = cpu_to_le32 (0);
        } else
-               resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
+               resp->Status = cpu_to_le32 (RNDIS_STATUS_SUCCESS);
 
        params->resp_avail(params->v);
        return 0;
@@ -665,14 +665,14 @@ static int rndis_set_response (int configNr, rndis_set_msg_type *buf)
        pr_debug("\n");
 #endif
 
-       resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_SET_CMPLT);
-       resp->MessageLength = __constant_cpu_to_le32 (16);
+       resp->MessageType = cpu_to_le32 (REMOTE_NDIS_SET_CMPLT);
+       resp->MessageLength = cpu_to_le32 (16);
        resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
        if (gen_ndis_set_resp (configNr, le32_to_cpu (buf->OID),
                        ((u8 *) buf) + 8 + BufOffset, BufLength, r))
-               resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_NOT_SUPPORTED);
+               resp->Status = cpu_to_le32 (RNDIS_STATUS_NOT_SUPPORTED);
        else
-               resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
+               resp->Status = cpu_to_le32 (RNDIS_STATUS_SUCCESS);
 
        params->resp_avail(params->v);
        return 0;
@@ -689,11 +689,11 @@ static int rndis_reset_response (int configNr, rndis_reset_msg_type *buf)
                return -ENOMEM;
        resp = (rndis_reset_cmplt_type *) r->buf;
 
-       resp->MessageType = __constant_cpu_to_le32 (REMOTE_NDIS_RESET_CMPLT);
-       resp->MessageLength = __constant_cpu_to_le32 (16);
-       resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
+       resp->MessageType = cpu_to_le32 (REMOTE_NDIS_RESET_CMPLT);
+       resp->MessageLength = cpu_to_le32 (16);
+       resp->Status = cpu_to_le32 (RNDIS_STATUS_SUCCESS);
        /* resent information */
-       resp->AddressingReset = __constant_cpu_to_le32 (1);
+       resp->AddressingReset = cpu_to_le32 (1);
 
        params->resp_avail(params->v);
        return 0;
@@ -713,11 +713,11 @@ static int rndis_keepalive_response (int configNr,
                return -ENOMEM;
        resp = (rndis_keepalive_cmplt_type *) r->buf;
 
-       resp->MessageType = __constant_cpu_to_le32 (
+       resp->MessageType = cpu_to_le32 (
                        REMOTE_NDIS_KEEPALIVE_CMPLT);
-       resp->MessageLength = __constant_cpu_to_le32 (16);
+       resp->MessageLength = cpu_to_le32 (16);
        resp->RequestID = buf->RequestID; /* Still LE in msg buffer */
-       resp->Status = __constant_cpu_to_le32 (RNDIS_STATUS_SUCCESS);
+       resp->Status = cpu_to_le32 (RNDIS_STATUS_SUCCESS);
 
        params->resp_avail(params->v);
        return 0;
@@ -742,12 +742,12 @@ static int rndis_indicate_status_msg (int configNr, u32 status)
                return -ENOMEM;
        resp = (rndis_indicate_status_msg_type *) r->buf;
 
-       resp->MessageType = __constant_cpu_to_le32 (
+       resp->MessageType = cpu_to_le32 (
                        REMOTE_NDIS_INDICATE_STATUS_MSG);
-       resp->MessageLength = __constant_cpu_to_le32 (20);
+       resp->MessageLength = cpu_to_le32 (20);
        resp->Status = cpu_to_le32 (status);
-       resp->StatusBufferLength = __constant_cpu_to_le32 (0);
-       resp->StatusBufferOffset = __constant_cpu_to_le32 (0);
+       resp->StatusBufferLength = cpu_to_le32 (0);
+       resp->StatusBufferOffset = cpu_to_le32 (0);
 
        params->resp_avail(params->v);
        return 0;
@@ -963,9 +963,9 @@ void rndis_add_hdr (struct sk_buff *skb)
                return;
        header = (void *) skb_push (skb, sizeof *header);
        memset (header, 0, sizeof *header);
-       header->MessageType = __constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG);
+       header->MessageType = cpu_to_le32(REMOTE_NDIS_PACKET_MSG);
        header->MessageLength = cpu_to_le32(skb->len);
-       header->DataOffset = __constant_cpu_to_le32 (36);
+       header->DataOffset = cpu_to_le32 (36);
        header->DataLength = cpu_to_le32(skb->len - sizeof *header);
 }
 
@@ -1029,7 +1029,7 @@ int rndis_rm_hdr(struct sk_buff *skb)
        __le32          *tmp = (void *) skb->data;
 
        /* MessageType, MessageLength */
-       if (__constant_cpu_to_le32(REMOTE_NDIS_PACKET_MSG)
+       if (cpu_to_le32(REMOTE_NDIS_PACKET_MSG)
                        != get_unaligned(tmp++))
                return -EINVAL;
        tmp++;
index bb21fb0a4969d0bc793f22c091c5053b973ddeac..abb9a7706ec7c370dd0835db9d04b0e3f1abc6b8 100644 (file)
@@ -432,7 +432,6 @@ static struct pci_driver ehci_pci_driver = {
 
 #ifdef CONFIG_PM
        .suspend =      usb_hcd_pci_suspend,
-       .resume_early = usb_hcd_pci_resume_early,
        .resume =       usb_hcd_pci_resume,
 #endif
        .shutdown =     usb_hcd_pci_shutdown,
index 5d625c3fd4232b163699ac5975bfe6da08d639a7..f9961b4c0da3e5065f054aa7dc34a619e00b8187 100644 (file)
@@ -487,7 +487,6 @@ static struct pci_driver ohci_pci_driver = {
 
 #ifdef CONFIG_PM
        .suspend =      usb_hcd_pci_suspend,
-       .resume_early = usb_hcd_pci_resume_early,
        .resume =       usb_hcd_pci_resume,
 #endif
 
index 944f7e0ca4df1327eeb7025f706677741f462ae0..cf5e4cf7ea425828ca099af27dc6d2639ded8f9a 100644 (file)
@@ -942,7 +942,6 @@ static struct pci_driver uhci_pci_driver = {
 
 #ifdef CONFIG_PM
        .suspend =      usb_hcd_pci_suspend,
-       .resume_early = usb_hcd_pci_resume_early,
        .resume =       usb_hcd_pci_resume,
 #endif /* PM */
 };
index 2291c5f5af5152b3aadcf029f48fcc73dd05fba6..958751ccea432cd3f41bda0dbd55828f5d15efd4 100644 (file)
@@ -227,13 +227,13 @@ void scan_async_work(struct work_struct *work)
         * Now that the ASL is updated, complete the removal of any
         * removed qsets.
         */
-       spin_lock(&whc->lock);
+       spin_lock_irq(&whc->lock);
 
        list_for_each_entry_safe(qset, t, &whc->async_removed_list, list_node) {
                qset_remove_complete(whc, qset);
        }
 
-       spin_unlock(&whc->lock);
+       spin_unlock_irq(&whc->lock);
 }
 
 /**
index 7dc85a0bee7c2f563c3c89f8e7d5aa9229ffd4df..df8b85f07092e3c398a410fff318f9b9b772ba7c 100644 (file)
@@ -255,13 +255,13 @@ void scan_periodic_work(struct work_struct *work)
         * Now that the PZL is updated, complete the removal of any
         * removed qsets.
         */
-       spin_lock(&whc->lock);
+       spin_lock_irq(&whc->lock);
 
        list_for_each_entry_safe(qset, t, &whc->periodic_removed_list, list_node) {
                qset_remove_complete(whc, qset);
        }
 
-       spin_unlock(&whc->lock);
+       spin_unlock_irq(&whc->lock);
 }
 
 /**
index 537f953bd7f8013c3cd97b5fc269252e5f6e235a..6d106e74265e9d839e7a4e5123bb4ce11c97a538 100644 (file)
@@ -621,9 +621,9 @@ static int __init aircable_init(void)
                goto failed_usb_register;
        return 0;
 
-failed_serial_register:
-       usb_serial_deregister(&aircable_device);
 failed_usb_register:
+       usb_serial_deregister(&aircable_device);
+failed_serial_register:
        return retval;
 }
 
index 75597337583ee4a56766f6c45943ca834d24aba6..f92f4d77337487c76929bc58b78e85aa3a184799 100644 (file)
@@ -662,6 +662,7 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(FTDI_VID, FTDI_DOMINTELL_DUSB_PID) },
        { USB_DEVICE(ALTI2_VID, ALTI2_N3_PID) },
        { USB_DEVICE(FTDI_VID, DIEBOLD_BCS_SE923_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_NDI_HUC_PID) },
        { },                                    /* Optional parameter entry */
        { }                                     /* Terminating entry */
 };
@@ -1064,8 +1065,10 @@ static int set_serial_info(struct tty_struct *tty,
 
        if (!capable(CAP_SYS_ADMIN)) {
                if (((new_serial.flags & ~ASYNC_USR_MASK) !=
-                    (priv->flags & ~ASYNC_USR_MASK)))
+                    (priv->flags & ~ASYNC_USR_MASK))) {
+                       unlock_kernel();
                        return -EPERM;
+               }
                priv->flags = ((priv->flags & ~ASYNC_USR_MASK) |
                               (new_serial.flags & ASYNC_USR_MASK));
                priv->custom_divisor = new_serial.custom_divisor;
index 1b62eff475d275f8d743cefb193ae9f614da6f6a..e300c840f8cad0dda5d1bbe30d070212f925b6a6 100644 (file)
 #define TML_VID                        0x1B91  /* Vendor ID */
 #define TML_USB_SERIAL_PID     0x0064  /* USB - Serial Converter */
 
+/* NDI Polaris System */
+#define FTDI_NDI_HUC_PID        0xDA70
+
 /* Propox devices */
 #define FTDI_PROPOX_JTAGCABLEII_PID    0xD738
 
index 6c89da9c6fea77cd310db68572515248a4356297..bfd0b68ceccd52942b864a79dfccdbe28735f5a5 100644 (file)
@@ -199,14 +199,15 @@ static int  option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
 #define NOVATELWIRELESS_PRODUCT_MC950D         0x4400
 
 /* FUTURE NOVATEL PRODUCTS */
-#define NOVATELWIRELESS_PRODUCT_EVDO_1         0x6000
-#define NOVATELWIRELESS_PRODUCT_HSPA_1         0x7000
-#define NOVATELWIRELESS_PRODUCT_EMBEDDED_1     0x8000
-#define NOVATELWIRELESS_PRODUCT_GLOBAL_1       0x9000
-#define NOVATELWIRELESS_PRODUCT_EVDO_2         0x6001
-#define NOVATELWIRELESS_PRODUCT_HSPA_2         0x7001
-#define NOVATELWIRELESS_PRODUCT_EMBEDDED_2     0x8001
-#define NOVATELWIRELESS_PRODUCT_GLOBAL_2       0x9001
+#define NOVATELWIRELESS_PRODUCT_EVDO_FULLSPEED 0X6000
+#define NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED 0X6001
+#define NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED 0X7000
+#define NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED 0X7001
+#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED        0X8000
+#define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED        0X8001
+#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED        0X9000
+#define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED        0X9001
+#define NOVATELWIRELESS_PRODUCT_GLOBAL         0XA001
 
 /* AMOI PRODUCTS */
 #define AMOI_VENDOR_ID                         0x1614
@@ -216,6 +217,27 @@ static int  option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
 
 #define DELL_VENDOR_ID                         0x413C
 
+/* Dell modems */
+#define DELL_PRODUCT_5700_MINICARD             0x8114
+#define DELL_PRODUCT_5500_MINICARD             0x8115
+#define DELL_PRODUCT_5505_MINICARD             0x8116
+#define DELL_PRODUCT_5700_EXPRESSCARD          0x8117
+#define DELL_PRODUCT_5510_EXPRESSCARD          0x8118
+
+#define DELL_PRODUCT_5700_MINICARD_SPRINT      0x8128
+#define DELL_PRODUCT_5700_MINICARD_TELUS       0x8129
+
+#define DELL_PRODUCT_5720_MINICARD_VZW         0x8133
+#define DELL_PRODUCT_5720_MINICARD_SPRINT      0x8134
+#define DELL_PRODUCT_5720_MINICARD_TELUS       0x8135
+#define DELL_PRODUCT_5520_MINICARD_CINGULAR    0x8136
+#define DELL_PRODUCT_5520_MINICARD_GENERIC_L   0x8137
+#define DELL_PRODUCT_5520_MINICARD_GENERIC_I   0x8138
+
+#define DELL_PRODUCT_5730_MINICARD_SPRINT      0x8180
+#define DELL_PRODUCT_5730_MINICARD_TELUS       0x8181
+#define DELL_PRODUCT_5730_MINICARD_VZW         0x8182
+
 #define KYOCERA_VENDOR_ID                      0x0c88
 #define KYOCERA_PRODUCT_KPC650                 0x17da
 #define KYOCERA_PRODUCT_KPC680                 0x180a
@@ -274,12 +296,6 @@ static int  option_send_setup(struct tty_struct *tty, struct usb_serial_port *po
 #define ERICSSON_VENDOR_ID                     0x0bdb
 #define ERICSSON_PRODUCT_F3507G                        0x1900
 
-/* Pantech products */
-#define PANTECH_VENDOR_ID                      0x106c
-#define PANTECH_PRODUCT_PC5740                 0x3701
-#define PANTECH_PRODUCT_PC5750                 0x3702  /* PX-500 */
-#define PANTECH_PRODUCT_UM150                  0x3711
-
 static struct usb_device_id option_ids[] = {
        { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_COLT) },
        { USB_DEVICE(OPTION_VENDOR_ID, OPTION_PRODUCT_RICOLA) },
@@ -395,31 +411,37 @@ static struct usb_device_id option_ids[] = {
        { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EU870D) }, /* Novatel EU850D/EU860D/EU870D */
        { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC950D) }, /* Novatel MC930D/MC950D */
        { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC727) }, /* Novatel MC727/U727/USB727 */
-       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_1) }, /* Novatel EVDO product */
-       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_1) }, /* Novatel HSPA product */
-       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_1) }, /* Novatel Embedded product */
-       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_1) }, /* Novatel Global product */
-       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_2) }, /* Novatel EVDO product */
-       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_2) }, /* Novatel HSPA product */
-       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EMBEDDED_2) }, /* Novatel Embedded product */
-       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL_2) }, /* Novatel Global product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_FULLSPEED) }, /* Novatel EVDO product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_FULLSPEED) }, /* Novatel HSPA product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_FULLSPEED) }, /* Novatel EVDO Embedded product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED) }, /* Novatel HSPA Embedded product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_HIGHSPEED) }, /* Novatel EVDO product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_HIGHSPEED) }, /* Novatel HSPA product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED) }, /* Novatel EVDO Embedded product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED) }, /* Novatel HSPA Embedded product */
+       { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_GLOBAL) }, /* Novatel Global product */
 
        { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
        { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
        { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H02) },
 
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8114) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8115) }, /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8116) }, /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8117) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8118) }, /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8128) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8129) }, /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite ET620 CDMA/EV-DO */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8133) }, /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8136) }, /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8137) }, /* Dell Wireless HSDPA 5520 */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8138) }, /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
-       { USB_DEVICE(DELL_VENDOR_ID, 0x8147) }, /* Dell Wireless 5530 Mobile Broadband (3G HSPA) Mini-Card */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD) },             /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite EV620 CDMA/EV-DO */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5500_MINICARD) },             /* Dell Wireless 5500 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5505_MINICARD) },             /* Dell Wireless 5505 Mobile Broadband HSDPA Mini-Card == Novatel Expedite EU740 HSDPA/3G */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_EXPRESSCARD) },          /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO ExpressCard == Novatel Merlin XV620 CDMA/EV-DO */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5510_EXPRESSCARD) },          /* Dell Wireless 5510 Mobile Broadband HSDPA ExpressCard == Novatel Merlin XU870 HSDPA/3G */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD_SPRINT) },      /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite E720 CDMA/EV-DO */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5700_MINICARD_TELUS) },       /* Dell Wireless 5700 Mobile Broadband CDMA/EVDO Mini-Card == Novatel Expedite ET620 CDMA/EV-DO */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5720_MINICARD_VZW) },         /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5720_MINICARD_SPRINT) },      /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5720_MINICARD_TELUS) },       /* Dell Wireless 5720 == Novatel EV620 CDMA/EV-DO */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5520_MINICARD_CINGULAR) },    /* Dell Wireless HSDPA 5520 == Novatel Expedite EU860D */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5520_MINICARD_GENERIC_L) },   /* Dell Wireless HSDPA 5520 */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5520_MINICARD_GENERIC_I) },   /* Dell Wireless 5520 Voda I Mobile Broadband (3G HSDPA) Minicard */
+       { USB_DEVICE(DELL_VENDOR_ID, 0x8147) },                                 /* Dell Wireless 5530 Mobile Broadband (3G HSPA) Mini-Card */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_SPRINT) },      /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_TELUS) },       /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
+       { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) },         /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
        { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) },   /* ADU-E100, ADU-310 */
        { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
        { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -488,9 +510,6 @@ static struct usb_device_id option_ids[] = {
        { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_MF628) },
        { USB_DEVICE(ZTE_VENDOR_ID, ZTE_PRODUCT_CDMA_TECH) },
        { USB_DEVICE(ERICSSON_VENDOR_ID, ERICSSON_PRODUCT_F3507G) },
-       { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_PC5740) },
-       { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_PC5750) },
-       { USB_DEVICE(PANTECH_VENDOR_ID, PANTECH_PRODUCT_UM150) },
        { } /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(usb, option_ids);
index baf591137b806134357daeb9e1f8fb383c5eb9c1..2620bf6fe5e1bbeb3ea7e4c697a7625822d9c783 100644 (file)
@@ -176,7 +176,7 @@ static unsigned int product_5052_count;
 /* the array dimension is the number of default entries plus */
 /* TI_EXTRA_VID_PID_COUNT user defined entries plus 1 terminating */
 /* null entry */
-static struct usb_device_id ti_id_table_3410[7+TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_3410[10+TI_EXTRA_VID_PID_COUNT+1] = {
        { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
        { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
        { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -185,9 +185,11 @@ static struct usb_device_id ti_id_table_3410[7+TI_EXTRA_VID_PID_COUNT+1] = {
        { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_PRODUCT_ID) },
        { USB_DEVICE(MTS_VENDOR_ID, MTS_EDGE_PRODUCT_ID) },
        { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
+       { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
+       { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
 };
 
-static struct usb_device_id ti_id_table_5052[4+TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_5052[5+TI_EXTRA_VID_PID_COUNT+1] = {
        { USB_DEVICE(TI_VENDOR_ID, TI_5052_BOOT_PRODUCT_ID) },
        { USB_DEVICE(TI_VENDOR_ID, TI_5152_BOOT_PRODUCT_ID) },
        { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
@@ -195,7 +197,7 @@ static struct usb_device_id ti_id_table_5052[4+TI_EXTRA_VID_PID_COUNT+1] = {
        { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
 };
 
-static struct usb_device_id ti_id_table_combined[6+2*TI_EXTRA_VID_PID_COUNT+1] = {
+static struct usb_device_id ti_id_table_combined[14+2*TI_EXTRA_VID_PID_COUNT+1] = {
        { USB_DEVICE(TI_VENDOR_ID, TI_3410_PRODUCT_ID) },
        { USB_DEVICE(TI_VENDOR_ID, TI_3410_EZ430_ID) },
        { USB_DEVICE(MTS_VENDOR_ID, MTS_GSM_NO_FW_PRODUCT_ID) },
@@ -208,6 +210,8 @@ static struct usb_device_id ti_id_table_combined[6+2*TI_EXTRA_VID_PID_COUNT+1] =
        { USB_DEVICE(TI_VENDOR_ID, TI_5052_EEPROM_PRODUCT_ID) },
        { USB_DEVICE(TI_VENDOR_ID, TI_5052_FIRMWARE_PRODUCT_ID) },
        { USB_DEVICE(IBM_VENDOR_ID, IBM_4543_PRODUCT_ID) },
+       { USB_DEVICE(IBM_VENDOR_ID, IBM_454B_PRODUCT_ID) },
+       { USB_DEVICE(IBM_VENDOR_ID, IBM_454C_PRODUCT_ID) },
        { }
 };
 
index b7ea5dbadee52fc4cc7b90b54608b756162c399b..f323c6025858f6e831dd77e953d173b942d8c2ae 100644 (file)
@@ -30,6 +30,8 @@
 #define IBM_VENDOR_ID                  0x04b3
 #define TI_3410_PRODUCT_ID             0x3410
 #define IBM_4543_PRODUCT_ID            0x4543
+#define IBM_454B_PRODUCT_ID            0x454b
+#define IBM_454C_PRODUCT_ID            0x454c
 #define TI_3410_EZ430_ID               0xF430  /* TI ez430 development tool */
 #define TI_5052_BOOT_PRODUCT_ID                0x5052  /* no EEPROM, no firmware */
 #define TI_5152_BOOT_PRODUCT_ID                0x5152  /* no EEPROM, no firmware */
index 2a42b862aa9fdb0808f32cb772745512b3ca4edd..727c506417ccb1fd275fb2aab3f15037b0016fba 100644 (file)
@@ -64,6 +64,7 @@
  */
 #define VENDOR_ID_NOKIA                0x0421
 #define VENDOR_ID_NIKON                0x04b0
+#define VENDOR_ID_PENTAX       0x0a17
 #define VENDOR_ID_MOTOROLA     0x22b8
 
 /***********************************************************************
@@ -158,6 +159,7 @@ static int slave_configure(struct scsi_device *sdev)
                switch (le16_to_cpu(us->pusb_dev->descriptor.idVendor)) {
                case VENDOR_ID_NOKIA:
                case VENDOR_ID_NIKON:
+               case VENDOR_ID_PENTAX:
                case VENDOR_ID_MOTOROLA:
                        if (!(us->fflags & (US_FL_FIX_CAPACITY |
                                        US_FL_CAPACITY_OK)))
index 1d5438e6363b9c7322b2d47864c39a1cbfad9d7c..fb65d221cedf8cfaf5e6051687904dc4a12911db 100644 (file)
@@ -558,32 +558,10 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)
 
        if (srb->result == SAM_STAT_GOOD && scsi_get_resid(srb) == 0) {
 
-               /* The command succeeded.  If the capacity is odd
-                * (i.e., if the sector number is even) then the
-                * "always-even" heuristic would be wrong for this
-                * device.  Issue a WARN() so that the kerneloops.org
-                * project will be notified and we will then know to
-                * mark the device with a CAPACITY_OK flag.  Hopefully
-                * this will occur for only a few devices.
-                *
-                * Use the sign of us->last_sector_hacks to tell whether
-                * the warning has already been issued; we don't need
-                * more than one warning per device.
+               /* The command succeeded.  We know this device doesn't
+                * have the last-sector bug, so stop checking it.
                 */
-               if (!(sector & 1) && us->use_last_sector_hacks > 0) {
-                       unsigned vid = le16_to_cpu(
-                                       us->pusb_dev->descriptor.idVendor);
-                       unsigned pid = le16_to_cpu(
-                                       us->pusb_dev->descriptor.idProduct);
-                       unsigned rev = le16_to_cpu(
-                                       us->pusb_dev->descriptor.bcdDevice);
-
-                       WARN(1, "%s: Successful last sector success at %u, "
-                                       "device %04x:%04x:%04x\n",
-                                       sdkp->disk->disk_name, sector,
-                                       vid, pid, rev);
-                       us->use_last_sector_hacks = -1;
-               }
+               us->use_last_sector_hacks = 0;
 
        } else {
                /* The command failed.  Allow up to 3 retries in case this
@@ -599,14 +577,6 @@ static void last_sector_hacks(struct us_data *us, struct scsi_cmnd *srb)
                srb->result = SAM_STAT_CHECK_CONDITION;
                memcpy(srb->sense_buffer, record_not_found,
                                sizeof(record_not_found));
-
-               /* In theory we might want to issue a WARN() here if the
-                * capacity is even, since it could indicate the device
-                * has the READ CAPACITY bug _and_ the real capacity is
-                * odd.  But it could also indicate that the device
-                * simply can't access its last sector, a failure mode
-                * which is surprisingly common.  So no warning.
-                */
        }
 
  done:
index 69269f739563d7669a0ca7ba7d83b6f23e6b28bb..50dc33a6065bd01b61bac0b26da138eabd015c68 100644 (file)
@@ -1214,7 +1214,7 @@ UNUSUAL_DEV(  0x07c4, 0xa400, 0x0000, 0xffff,
                "Datafab",
                "KECF-USB",
                US_SC_DEVICE, US_PR_DEVICE, NULL,
-               US_FL_FIX_INQUIRY ),
+               US_FL_FIX_INQUIRY | US_FL_FIX_CAPACITY ),
 
 /* Reported by Rauch Wolke <rauchwolke@gmx.net> */
 UNUSUAL_DEV(  0x07c4, 0xa4a5, 0x0000, 0xffff,
@@ -1354,21 +1354,6 @@ UNUSUAL_DEV( 0x0a17, 0x0004, 0x1000, 0x1000,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_INQUIRY ),
 
-
-/* Submitted by Per Winkvist <per.winkvist@uk.com> */
-UNUSUAL_DEV( 0x0a17, 0x006, 0x0000, 0xffff,
-               "Pentax",
-               "Optio S/S4",
-               US_SC_DEVICE, US_PR_DEVICE, NULL,
-               US_FL_FIX_INQUIRY ),
-
-/* Reported by Jaak Ristioja <Ristioja@gmail.com> */
-UNUSUAL_DEV( 0x0a17, 0x006e, 0x0100, 0x0100,
-               "Pentax",
-               "K10D",
-               US_SC_DEVICE, US_PR_DEVICE, NULL,
-               US_FL_FIX_CAPACITY ),
-
 /* These are virtual windows driver CDs, which the zd1211rw driver
  * automatically converts into WLAN devices. */
 UNUSUAL_DEV( 0x0ace, 0x2011, 0x0101, 0x0101,
index f0267706cb458701ed1a754dddf73276ee28872a..fb19803060cf6c35727c9f287f5668bf670ed969 100644 (file)
@@ -1054,9 +1054,7 @@ config FB_RIVA_BACKLIGHT
 
 config FB_I810
        tristate "Intel 810/815 support (EXPERIMENTAL)"
-       depends on FB && EXPERIMENTAL && PCI && X86_32
-       select AGP
-       select AGP_INTEL
+       depends on EXPERIMENTAL && FB && PCI && X86_32 && AGP_INTEL
        select FB_MODE_HELPERS
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
@@ -1119,9 +1117,7 @@ config FB_CARILLO_RANCH
 
 config FB_INTEL
        tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support (EXPERIMENTAL)"
-       depends on FB && EXPERIMENTAL && PCI && X86
-       select AGP
-       select AGP_INTEL
+       depends on EXPERIMENTAL && FB && PCI && X86 && AGP_INTEL
        select FB_MODE_HELPERS
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
index 8058572a74283303f178d03d0e97e64632c85099..018850c116c646edbeadf5cc6e4fc828e3901eff 100644 (file)
@@ -841,7 +841,7 @@ static int tt_detect(void)
                tt_dmasnd.ctrl = DMASND_CTRL_OFF;
                udelay(20);             /* wait a while for things to settle down */
        }
-       mono_moni = (mfp.par_dt_reg & 0x80) == 0;
+       mono_moni = (st_mfp.par_dt_reg & 0x80) == 0;
 
        tt_get_par(&par);
        tt_encode_var(&atafb_predefined[0], &par);
@@ -2035,7 +2035,7 @@ static int stste_detect(void)
                tt_dmasnd.ctrl = DMASND_CTRL_OFF;
                udelay(20);             /* wait a while for things to settle down */
        }
-       mono_moni = (mfp.par_dt_reg & 0x80) == 0;
+       mono_moni = (st_mfp.par_dt_reg & 0x80) == 0;
 
        stste_get_par(&par);
        stste_encode_var(&atafb_predefined[0], &par);
@@ -2086,20 +2086,20 @@ static void st_ovsc_switch(void)
                return;
        local_irq_save(flags);
 
-       mfp.tim_ct_b = 0x10;
-       mfp.active_edge |= 8;
-       mfp.tim_ct_b = 0;
-       mfp.tim_dt_b = 0xf0;
-       mfp.tim_ct_b = 8;
-       while (mfp.tim_dt_b > 1)        /* TOS does it this way, don't ask why */
+       st_mfp.tim_ct_b = 0x10;
+       st_mfp.active_edge |= 8;
+       st_mfp.tim_ct_b = 0;
+       st_mfp.tim_dt_b = 0xf0;
+       st_mfp.tim_ct_b = 8;
+       while (st_mfp.tim_dt_b > 1)     /* TOS does it this way, don't ask why */
                ;
-       new = mfp.tim_dt_b;
+       new = st_mfp.tim_dt_b;
        do {
                udelay(LINE_DELAY);
                old = new;
-               new = mfp.tim_dt_b;
+               new = st_mfp.tim_dt_b;
        } while (old != new);
-       mfp.tim_ct_b = 0x10;
+       st_mfp.tim_ct_b = 0x10;
        udelay(SYNC_DELAY);
 
        if (atari_switches & ATARI_SWITCH_OVSC_IKBD)
index db16112cf197c0199df67949f68b3ebf07e7107c..2181ce4d7ebd4c75009683c2f50bb0d1eebcd034 100644 (file)
@@ -1475,7 +1475,7 @@ static int aty128fb_set_par(struct fb_info *info)
        aty128_set_pll(&par->pll, par);
        aty128_set_fifo(&par->fifo_reg, par);
 
-       config = aty_ld_le32(CONFIG_CNTL) & ~3;
+       config = aty_ld_le32(CNFG_CNTL) & ~3;
 
 #if defined(__BIG_ENDIAN)
        if (par->crtc.bpp == 32)
@@ -1484,7 +1484,7 @@ static int aty128fb_set_par(struct fb_info *info)
                config |= 1;    /* make aperture do 16 bit swapping */
 #endif
 
-       aty_st_le32(CONFIG_CNTL, config);
+       aty_st_le32(CNFG_CNTL, config);
        aty_st_8(CRTC_EXT_CNTL + 1, 0); /* turn the video back on */
 
        info->fix.line_length = (par->crtc.vxres * par->crtc.bpp) >> 3;
@@ -1875,7 +1875,7 @@ static int __devinit aty128_init(struct pci_dev *pdev, const struct pci_device_i
        u32 dac;
 
        /* Get the chip revision */
-       chip_rev = (aty_ld_le32(CONFIG_CNTL) >> 16) & 0x1F;
+       chip_rev = (aty_ld_le32(CNFG_CNTL) >> 16) & 0x1F;
 
        strcpy(video_card, "Rage128 XX ");
        video_card[8] = ent->device >> 8;
@@ -2057,7 +2057,7 @@ static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_
 
        /* Grab memory size from the card */
        // How does this relate to the resource length from the PCI hardware?
-       par->vram_size = aty_ld_le32(CONFIG_MEMSIZE) & 0x03FFFFFF;
+       par->vram_size = aty_ld_le32(CNFG_MEMSIZE) & 0x03FFFFFF;
 
        /* Virtualize the framebuffer */
        info->screen_base = ioremap(fb_addr, par->vram_size);
@@ -2365,7 +2365,6 @@ static void fbcon_aty128_bmove(struct display *p, int sy, int sx, int dy, int dx
 static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
 {
        u32     pmgt;
-       u16     pwr_command;
        struct pci_dev *pdev = par->pdev;
 
        if (!par->pm_reg)
@@ -2374,6 +2373,8 @@ static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
        /* Set the chip into the appropriate suspend mode (we use D2,
         * D3 would require a complete re-initialisation of the chip,
         * including PCI config registers, clocks, AGP configuration, ...)
+        *
+        * For resume, the core will have already brought us back to D0
         */
        if (suspend) {
                /* Make sure CRTC2 is reset. Remove that the day we decide to
@@ -2391,17 +2392,9 @@ static void aty128_set_suspend(struct aty128fb_par *par, int suspend)
                aty_st_le32(BUS_CNTL1, 0x00000010);
                aty_st_le32(MEM_POWER_MISC, 0x0c830000);
                mdelay(100);
-               pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
+
                /* Switch PCI power management to D2 */
-               pci_write_config_word(pdev, par->pm_reg+PCI_PM_CTRL,
-                       (pwr_command & ~PCI_PM_CTRL_STATE_MASK) | 2);
-               pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
-       } else {
-               /* Switch back PCI power management to D0 */
-               mdelay(100);
-               pci_write_config_word(pdev, par->pm_reg+PCI_PM_CTRL, 0);
-               pci_read_config_word(pdev, par->pm_reg+PCI_PM_CTRL, &pwr_command);
-               mdelay(100);
+               pci_set_power_state(pdev, PCI_D2);
        }
 }
 
@@ -2410,6 +2403,12 @@ static int aty128_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        struct fb_info *info = pci_get_drvdata(pdev);
        struct aty128fb_par *par = info->par;
 
+       /* Because we may change PCI D state ourselves, we need to
+        * first save the config space content so the core can
+        * restore it properly on resume.
+        */
+       pci_save_state(pdev);
+
        /* We don't do anything but D2, for now we return 0, but
         * we may want to change that. How do we know if the BIOS
         * can properly take care of D3 ? Also, with swsusp, we
@@ -2476,6 +2475,11 @@ static int aty128_do_resume(struct pci_dev *pdev)
        if (pdev->dev.power.power_state.event == PM_EVENT_ON)
                return 0;
 
+       /* PCI state will have been restored by the core, so
+        * we should be in D0 now with our config space fully
+        * restored
+        */
+
        /* Wakeup chip */
        aty128_set_suspend(par, 0);
        par->asleep = 0;
index cc6b470073daa3085c0694a77909fcebec10fd6e..1207c208a30b32f243a6ab4ec952d811d69fe248 100644 (file)
 #if defined(CONFIG_PM) || defined(CONFIG_PMAC_BACKLIGHT) || \
 defined (CONFIG_FB_ATY_GENERIC_LCD) || defined(CONFIG_FB_ATY_BACKLIGHT)
 static const u32 lt_lcd_regs[] = {
-       CONFIG_PANEL_LG,
+       CNFG_PANEL_LG,
        LCD_GEN_CNTL_LG,
        DSTN_CONTROL_LG,
        HFB_PITCH_ADDR_LG,
@@ -446,7 +446,7 @@ static int __devinit correct_chipset(struct atyfb_par *par)
        par->pll_limits.ecp_max = aty_chips[i].ecp_max;
        par->features = aty_chips[i].features;
 
-       chip_id = aty_ld_le32(CONFIG_CHIP_ID, par);
+       chip_id = aty_ld_le32(CNFG_CHIP_ID, par);
        type = chip_id & CFG_CHIP_TYPE;
        rev = (chip_id & CFG_CHIP_REV) >> 24;
 
@@ -629,7 +629,7 @@ static void aty_get_crtc(const struct atyfb_par *par, struct crtc *crtc)
                    crtc->lcd_index = aty_ld_le32(LCD_INDEX, par);
                    aty_st_le32(LCD_INDEX, crtc->lcd_index, par);
                }
-               crtc->lcd_config_panel = aty_ld_lcd(CONFIG_PANEL, par);
+               crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par);
                crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par);
 
 
@@ -676,7 +676,7 @@ static void aty_set_crtc(const struct atyfb_par *par, const struct crtc *crtc)
                aty_st_le32(CRTC_GEN_CNTL, crtc->gen_cntl & ~(CRTC_EXT_DISP_EN | CRTC_EN), par);
 
                /* update non-shadow registers first */
-               aty_st_lcd(CONFIG_PANEL, crtc->lcd_config_panel, par);
+               aty_st_lcd(CNFG_PANEL, crtc->lcd_config_panel, par);
                aty_st_lcd(LCD_GEN_CNTL, crtc->lcd_gen_cntl &
                        ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN), par);
 
@@ -858,7 +858,7 @@ static int aty_var_to_crtc(const struct fb_info *info,
                if (!M64_HAS(MOBIL_BUS))
                        crtc->lcd_index |= CRTC2_DISPLAY_DIS;
 
-               crtc->lcd_config_panel = aty_ld_lcd(CONFIG_PANEL, par) | 0x4000;
+               crtc->lcd_config_panel = aty_ld_lcd(CNFG_PANEL, par) | 0x4000;
                crtc->lcd_gen_cntl = aty_ld_lcd(LCD_GEN_CNTL, par) & ~CRTC_RW_SELECT;
 
                crtc->lcd_gen_cntl &=
@@ -1978,7 +1978,7 @@ static int aty_power_mgmt(int sleep, struct atyfb_par *par)
 
        return timeout ? 0 : -EIO;
 }
-#endif
+#endif /* CONFIG_PPC_PMAC */
 
 static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 {
@@ -2002,9 +2002,15 @@ static int atyfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
        par->asleep = 1;
        par->lock_blank = 1;
 
+       /* Because we may change PCI D state ourselves, we need to
+        * first save the config space content so the core can
+        * restore it properly on resume.
+        */
+       pci_save_state(pdev);
+
 #ifdef CONFIG_PPC_PMAC
        /* Set chip to "suspend" mode */
-       if (aty_power_mgmt(1, par)) {
+       if (machine_is(powermac) && aty_power_mgmt(1, par)) {
                par->asleep = 0;
                par->lock_blank = 0;
                atyfb_blank(FB_BLANK_UNBLANK, info);
@@ -2047,11 +2053,15 @@ static int atyfb_pci_resume(struct pci_dev *pdev)
 
        acquire_console_sem();
 
+       /* PCI state will have been restored by the core, so
+        * we should be in D0 now with our config space fully
+        * restored
+        */
+
 #ifdef CONFIG_PPC_PMAC
-       if (pdev->dev.power.power_state.event == 2)
+       if (machine_is(powermac) &&
+           pdev->dev.power.power_state.event == PM_EVENT_SUSPEND)
                aty_power_mgmt(0, par);
-#else
-       pci_set_power_state(pdev, PCI_D0);
 #endif
 
        aty_resume_chip(info);
@@ -2254,7 +2264,7 @@ static int __devinit aty_init(struct fb_info *info)
        if (!M64_HAS(INTEGRATED)) {
                u32 stat0;
                u8 dac_type, dac_subtype, clk_type;
-               stat0 = aty_ld_le32(CONFIG_STAT0, par);
+               stat0 = aty_ld_le32(CNFG_STAT0, par);
                par->bus_type = (stat0 >> 0) & 0x07;
                par->ram_type = (stat0 >> 3) & 0x07;
                ramname = aty_gx_ram[par->ram_type];
@@ -2324,7 +2334,7 @@ static int __devinit aty_init(struct fb_info *info)
                par->dac_ops = &aty_dac_ct;
                par->pll_ops = &aty_pll_ct;
                par->bus_type = PCI;
-               par->ram_type = (aty_ld_le32(CONFIG_STAT0, par) & 0x07);
+               par->ram_type = (aty_ld_le32(CNFG_STAT0, par) & 0x07);
                ramname = aty_ct_ram[par->ram_type];
                /* for many chips, the mclk is 67 MHz for SDRAM, 63 MHz otherwise */
                if (par->pll_limits.mclk == 67 && par->ram_type < SDRAM)
@@ -2433,7 +2443,7 @@ static int __devinit aty_init(struct fb_info *info)
                }
 
        if (M64_HAS(MAGIC_VRAM_SIZE)) {
-               if (aty_ld_le32(CONFIG_STAT1, par) & 0x40000000)
+               if (aty_ld_le32(CNFG_STAT1, par) & 0x40000000)
                        info->fix.smem_len += 0x400000;
        }
 
@@ -2946,7 +2956,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
                 * Fix PROMs idea of MEM_CNTL settings...
                 */
                mem = aty_ld_le32(MEM_CNTL, par);
-               chip_id = aty_ld_le32(CONFIG_CHIP_ID, par);
+               chip_id = aty_ld_le32(CNFG_CHIP_ID, par);
                if (((chip_id & CFG_CHIP_TYPE) == VT_CHIP_ID) && !((chip_id >> 24) & 1)) {
                        switch (mem & 0x0f) {
                        case 3:
@@ -2964,7 +2974,7 @@ static int __devinit atyfb_setup_sparc(struct pci_dev *pdev,
                        default:
                                break;
                        }
-                       if ((aty_ld_le32(CONFIG_STAT0, par) & 7) >= SDRAM)
+                       if ((aty_ld_le32(CNFG_STAT0, par) & 7) >= SDRAM)
                                mem &= ~(0x00700000);
                }
                mem &= ~(0xcf80e000);   /* Turn off all undocumented bits. */
@@ -3572,7 +3582,7 @@ static int __init atyfb_atari_probe(void)
                }
 
                /* Fake pci_id for correct_chipset() */
-               switch (aty_ld_le32(CONFIG_CHIP_ID, par) & CFG_CHIP_TYPE) {
+               switch (aty_ld_le32(CNFG_CHIP_ID, par) & CFG_CHIP_TYPE) {
                case 0x00d7:
                        par->pci_id = PCI_CHIP_MACH64GX;
                        break;
index d0f1a7fc2c9df7da492102db83247624c94dac9f..16bb7e3c0310eb83a105101fa59c22c910b9adf7 100644 (file)
@@ -1936,8 +1936,8 @@ static void fixup_memory_mappings(struct radeonfb_info *rinfo)
        OUTREG(CRTC_GEN_CNTL, save_crtc_gen_cntl | CRTC_DISP_REQ_EN_B);
        mdelay(100);
 
-       aper_base = INREG(CONFIG_APER_0_BASE);
-       aper_size = INREG(CONFIG_APER_SIZE);
+       aper_base = INREG(CNFG_APER_0_BASE);
+       aper_size = INREG(CNFG_APER_SIZE);
 
 #ifdef SET_MC_FB_FROM_APERTURE
        /* Set framebuffer to be at the same address as set in PCI BAR */
@@ -2024,11 +2024,11 @@ static void radeon_identify_vram(struct radeonfb_info *rinfo)
                      ~CRTC_H_CUTOFF_ACTIVE_EN);
           }
         } else {
-          tmp = INREG(CONFIG_MEMSIZE);
+          tmp = INREG(CNFG_MEMSIZE);
         }
 
        /* mem size is bits [28:0], mask off the rest */
-       rinfo->video_ram = tmp & CONFIG_MEMSIZE_MASK;
+       rinfo->video_ram = tmp & CNFG_MEMSIZE_MASK;
 
        /*
         * Hack to get around some busted production M6's
@@ -2228,7 +2228,7 @@ static int __devinit radeonfb_pci_register (struct pci_dev *pdev,
         */
        rinfo->errata = 0;
        if (rinfo->family == CHIP_FAMILY_R300 &&
-           (INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK)
+           (INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK)
            == CFG_ATI_REV_A11)
                rinfo->errata |= CHIP_ERRATA_R300_CG;
 
index 675abdafc2d8d047741ed3b8fdf2c0291343440c..ca5f0dc28546ec742f33d77579aa472556aa1375 100644 (file)
@@ -333,7 +333,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
        if (!rinfo->has_CRTC2) {
                 tmp = INPLL(pllSCLK_CNTL);
 
-               if ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) > CFG_ATI_REV_A13)
+               if ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) > CFG_ATI_REV_A13)
                     tmp &= ~(SCLK_CNTL__FORCE_CP       | SCLK_CNTL__FORCE_RB);
                 tmp &= ~(SCLK_CNTL__FORCE_HDP          | SCLK_CNTL__FORCE_DISP1 |
                         SCLK_CNTL__FORCE_TOP           | SCLK_CNTL__FORCE_SE   |
@@ -468,9 +468,9 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
 
        /*RAGE_6::A11 A12 A12N1 A13, RV250::A11 A12, R300*/
        if ((rinfo->family == CHIP_FAMILY_RV250 &&
-            ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) ||
+            ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) ||
            ((rinfo->family == CHIP_FAMILY_RV100) &&
-            ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) <= CFG_ATI_REV_A13))) {
+            ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) <= CFG_ATI_REV_A13))) {
                tmp |= SCLK_CNTL__FORCE_CP;
                tmp |= SCLK_CNTL__FORCE_VIP;
        }
@@ -486,7 +486,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
                /* RV200::A11 A12 RV250::A11 A12 */
                if (((rinfo->family == CHIP_FAMILY_RV200) ||
                     (rinfo->family == CHIP_FAMILY_RV250)) &&
-                   ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13))
+                   ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13))
                        tmp |= SCLK_MORE_CNTL__FORCEON;
 
                OUTPLL(pllSCLK_MORE_CNTL, tmp);
@@ -497,7 +497,7 @@ static void radeon_pm_enable_dynamic_mode(struct radeonfb_info *rinfo)
        /* RV200::A11 A12, RV250::A11 A12 */
        if (((rinfo->family == CHIP_FAMILY_RV200) ||
             (rinfo->family == CHIP_FAMILY_RV250)) &&
-           ((INREG(CONFIG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) {
+           ((INREG(CNFG_CNTL) & CFG_ATI_REV_ID_MASK) < CFG_ATI_REV_A13)) {
                tmp = INPLL(pllPLL_PWRMGT_CNTL);
                tmp |= PLL_PWRMGT_CNTL__TCL_BYPASS_DISABLE;
                OUTPLL(pllPLL_PWRMGT_CNTL, tmp);
@@ -702,7 +702,7 @@ static void radeon_pm_restore_regs(struct radeonfb_info *rinfo)
        OUTREG(DISPLAY_BASE_ADDR, rinfo->save_regs[31]);
        OUTREG(MC_AGP_LOCATION, rinfo->save_regs[32]);
        OUTREG(CRTC2_DISPLAY_BASE_ADDR, rinfo->save_regs[33]);
-       OUTREG(CONFIG_MEMSIZE, rinfo->video_ram);
+       OUTREG(CNFG_MEMSIZE, rinfo->video_ram);
 
        OUTREG(DISP_MISC_CNTL, rinfo->save_regs[9]);
        OUTREG(DISP_PWR_MAN, rinfo->save_regs[10]);
@@ -1723,7 +1723,7 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo)
        OUTREG(CRTC2_DISPLAY_BASE_ADDR, rinfo->save_regs[33]);
        OUTREG(MC_FB_LOCATION, rinfo->save_regs[30]);
        OUTREG(OV0_BASE_ADDR, rinfo->save_regs[80]);
-       OUTREG(CONFIG_MEMSIZE, rinfo->video_ram);
+       OUTREG(CNFG_MEMSIZE, rinfo->video_ram);
        OUTREG(BUS_CNTL, rinfo->save_regs[36]);
        OUTREG(BUS_CNTL1, rinfo->save_regs[14]);
        OUTREG(MPP_TB_CONFIG, rinfo->save_regs[37]);
@@ -1961,7 +1961,7 @@ static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo)
        OUTMC(rinfo, ixMC_CHP_IO_CNTL_B1, rinfo->save_regs[68] /*0x141555ff*/);
        OUTMC(rinfo, ixMC_IMP_CNTL_0, rinfo->save_regs[71] /*0x00009249*/);
        OUTREG(MC_IND_INDEX, 0);
-       OUTREG(CONFIG_MEMSIZE, rinfo->video_ram);
+       OUTREG(CNFG_MEMSIZE, rinfo->video_ram);
 
        mdelay(20);
 }
@@ -2361,7 +2361,7 @@ static void radeon_reinitialize_QW(struct radeonfb_info *rinfo)
        OUTMC(rinfo, ixMC_IMP_CNTL_0, 0x00009249);
        OUTREG(MC_IND_INDEX, 0);
 
-       OUTREG(CONFIG_MEMSIZE, rinfo->video_ram);
+       OUTREG(CNFG_MEMSIZE, rinfo->video_ram);
 
        radeon_pm_full_reset_sdram(rinfo);
 
@@ -2509,9 +2509,7 @@ static void radeon_reinitialize_QW(struct radeonfb_info *rinfo)
 
 static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
 {
-       u16 pwr_cmd;
        u32 tmp;
-       int i;
 
        if (!rinfo->pm_reg)
                return;
@@ -2557,32 +2555,14 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
                        }
                }
 
-               for (i = 0; i < 64; ++i)
-                       pci_read_config_dword(rinfo->pdev, i * 4,
-                                             &rinfo->cfg_save[i]);
-
                /* Switch PCI power management to D2. */
                pci_disable_device(rinfo->pdev);
-               for (;;) {
-                       pci_read_config_word(
-                               rinfo->pdev, rinfo->pm_reg+PCI_PM_CTRL,
-                               &pwr_cmd);
-                       if (pwr_cmd & 2)
-                               break;                  
-                       pci_write_config_word(
-                               rinfo->pdev, rinfo->pm_reg+PCI_PM_CTRL,
-                               (pwr_cmd & ~PCI_PM_CTRL_STATE_MASK) | 2);
-                       mdelay(500);
-               }
+               pci_save_state(rinfo->pdev);
+               pci_set_power_state(rinfo->pdev, PCI_D2);
        } else {
                printk(KERN_DEBUG "radeonfb (%s): switching to D0 state...\n",
                       pci_name(rinfo->pdev));
 
-               /* Switch back PCI powermanagment to D0 */
-               mdelay(200);
-               pci_write_config_word(rinfo->pdev, rinfo->pm_reg+PCI_PM_CTRL, 0);
-               mdelay(500);
-
                if (rinfo->family <= CHIP_FAMILY_RV250) {
                        /* Reset the SDRAM controller  */
                        radeon_pm_full_reset_sdram(rinfo);
@@ -2598,37 +2578,10 @@ static void radeon_set_suspend(struct radeonfb_info *rinfo, int suspend)
        }
 }
 
-static int radeon_restore_pci_cfg(struct radeonfb_info *rinfo)
-{
-       int i;
-       static u32 radeon_cfg_after_resume[64];
-
-       for (i = 0; i < 64; ++i)
-               pci_read_config_dword(rinfo->pdev, i * 4,
-                                     &radeon_cfg_after_resume[i]);
-
-       if (radeon_cfg_after_resume[PCI_BASE_ADDRESS_0/4]
-           == rinfo->cfg_save[PCI_BASE_ADDRESS_0/4])
-               return 0;       /* assume everything is ok */
-
-       for (i = PCI_BASE_ADDRESS_0/4; i < 64; ++i) {
-               if (radeon_cfg_after_resume[i] != rinfo->cfg_save[i])
-                       pci_write_config_dword(rinfo->pdev, i * 4,
-                                              rinfo->cfg_save[i]);
-       }
-       pci_write_config_word(rinfo->pdev, PCI_CACHE_LINE_SIZE,
-                             rinfo->cfg_save[PCI_CACHE_LINE_SIZE/4]);
-       pci_write_config_word(rinfo->pdev, PCI_COMMAND,
-                             rinfo->cfg_save[PCI_COMMAND/4]);
-       return 1;
-}
-
-
 int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
         struct fb_info *info = pci_get_drvdata(pdev);
         struct radeonfb_info *rinfo = info->par;
-       int i;
 
        if (mesg.event == pdev->dev.power.power_state.event)
                return 0;
@@ -2674,6 +2627,11 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
        pmac_suspend_agp_for_card(pdev);
 #endif /* CONFIG_PPC_PMAC */
 
+       /* It's unclear whether or when the generic code will do that, so let's
+        * do it ourselves. We save state before we do any power management
+        */
+       pci_save_state(pdev);
+
        /* If we support wakeup from poweroff, we save all regs we can including cfg
         * space
         */
@@ -2698,9 +2656,6 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
                        mdelay(20);
                        OUTREG(LVDS_GEN_CNTL, INREG(LVDS_GEN_CNTL) & ~(LVDS_DIGON));
                }
-               // FIXME: Use PCI layer
-               for (i = 0; i < 64; ++i)
-                       pci_read_config_dword(pdev, i * 4, &rinfo->cfg_save[i]);
                pci_disable_device(pdev);
        }
        /* If we support D2, we go to it (should be fixed later with a flag forcing
@@ -2717,6 +2672,13 @@ int radeonfb_pci_suspend(struct pci_dev *pdev, pm_message_t mesg)
        return 0;
 }
 
+static int radeon_check_power_loss(struct radeonfb_info *rinfo)
+{
+       return rinfo->save_regs[4] != INPLL(CLK_PIN_CNTL) ||
+              rinfo->save_regs[2] != INPLL(MCLK_CNTL) ||
+              rinfo->save_regs[3] != INPLL(SCLK_CNTL);
+}
+
 int radeonfb_pci_resume(struct pci_dev *pdev)
 {
         struct fb_info *info = pci_get_drvdata(pdev);
@@ -2735,20 +2697,13 @@ int radeonfb_pci_resume(struct pci_dev *pdev)
        printk(KERN_DEBUG "radeonfb (%s): resuming from state: %d...\n",
               pci_name(pdev), pdev->dev.power.power_state.event);
 
-
-       if (pci_enable_device(pdev)) {
-               rc = -ENODEV;
-               printk(KERN_ERR "radeonfb (%s): can't enable PCI device !\n",
-                      pci_name(pdev));
-               goto bail;
-       }
-       pci_set_master(pdev);
-
+       /* PCI state will have been restored by the core, so
+        * we should be in D0 now with our config space fully
+        * restored
+        */
        if (pdev->dev.power.power_state.event == PM_EVENT_SUSPEND) {
-               /* Wakeup chip. Check from config space if we were powered off
-                * (todo: additionally, check CLK_PIN_CNTL too)
-                */
-               if ((rinfo->pm_mode & radeon_pm_off) && radeon_restore_pci_cfg(rinfo)) {
+               /* Wakeup chip */
+               if ((rinfo->pm_mode & radeon_pm_off) && radeon_check_power_loss(rinfo)) {
                        if (rinfo->reinit_func != NULL)
                                rinfo->reinit_func(rinfo);
                        else {
index 3ea1b00fdd22ae66e882fc764359920ab8a609c5..7351e66c7f54e6d385740838ec4eb6f4c17af613 100644 (file)
@@ -361,8 +361,6 @@ struct radeonfb_info {
 #ifdef CONFIG_FB_RADEON_I2C
        struct radeon_i2c_chan  i2c[4];
 #endif
-
-       u32                     cfg_save[64];
 };
 
 
index 363b3cb2f01b263ffd2b14b50c8bbdd694b7656f..63d75949816544149506cd9ddd750d0793b81cf4 100644 (file)
@@ -18,7 +18,7 @@ obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o
 obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o
 obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o
 obj-$(CONFIG_BACKLIGHT_PWM)    += pwm_bl.o
-obj-$(CONFIG_BACKLIGHT_DA903X) += da903x.o
+obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o
 obj-$(CONFIG_BACKLIGHT_MBP_NVIDIA) += mbp_nvidia_bl.o
 obj-$(CONFIG_BACKLIGHT_TOSA)   += tosa_bl.o
 obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o
index 2a423d3a2a8eb8fe80436b6b2100fef8a39ad9f1..90cfddabf1f7618548275f99ec292f5f6573b8e6 100644 (file)
@@ -447,7 +447,7 @@ static irqreturn_t bfin_t350mcqb_irq_error(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static int __init bfin_t350mcqb_probe(struct platform_device *pdev)
+static int __devinit bfin_t350mcqb_probe(struct platform_device *pdev)
 {
        struct bfin_t350mcqbfb_info *info;
        struct fb_info *fbinfo;
index 91b78e691505d715b67de8c990f48ea8a1b420ea..f53b9f1d6aba23830d3b5c1a551054cf9f8b4538 100644 (file)
@@ -250,10 +250,6 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
        int rc, size = cmap->len * sizeof(u16);
        struct fb_cmap umap;
 
-       if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
-                               !info->fbops->fb_setcmap))
-               return -EINVAL;
-
        memset(&umap, 0, sizeof(struct fb_cmap));
        rc = fb_alloc_cmap(&umap, cmap->len, cmap->transp != NULL);
        if (rc)
@@ -262,11 +258,23 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
            copy_from_user(umap.green, cmap->green, size) ||
            copy_from_user(umap.blue, cmap->blue, size) ||
            (cmap->transp && copy_from_user(umap.transp, cmap->transp, size))) {
-               fb_dealloc_cmap(&umap);
-               return -EFAULT;
+               rc = -EFAULT;
+               goto out;
        }
        umap.start = cmap->start;
+       if (!lock_fb_info(info)) {
+               rc = -ENODEV;
+               goto out;
+       }
+       if (cmap->start < 0 || (!info->fbops->fb_setcolreg &&
+                               !info->fbops->fb_setcmap)) {
+               rc = -EINVAL;
+               goto out1;
+       }
        rc = fb_set_cmap(&umap, info);
+out1:
+       unlock_fb_info(info);
+out:
        fb_dealloc_cmap(&umap);
        return rc;
 }
index 756efeb91abc09bc3635387840f2b686f724d1fc..cfd9dce1ce0b666627b6306e0eb693f669e154f5 100644 (file)
@@ -1013,132 +1013,139 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,
        struct fb_var_screeninfo var;
        struct fb_fix_screeninfo fix;
        struct fb_con2fbmap con2fb;
+       struct fb_cmap cmap_from;
        struct fb_cmap_user cmap;
        struct fb_event event;
        void __user *argp = (void __user *)arg;
        long ret = 0;
 
-       fb = info->fbops;
-       if (!fb)
-               return -ENODEV;
-
        switch (cmd) {
        case FBIOGET_VSCREENINFO:
-               ret = copy_to_user(argp, &info->var,
-                                   sizeof(var)) ? -EFAULT : 0;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               var = info->var;
+               unlock_fb_info(info);
+
+               ret = copy_to_user(argp, &var, sizeof(var)) ? -EFAULT : 0;
                break;
        case FBIOPUT_VSCREENINFO:
-               if (copy_from_user(&var, argp, sizeof(var))) {
-                       ret =  -EFAULT;
-                       break;
-               }
+               if (copy_from_user(&var, argp, sizeof(var)))
+                       return -EFAULT;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
                acquire_console_sem();
                info->flags |= FBINFO_MISC_USEREVENT;
                ret = fb_set_var(info, &var);
                info->flags &= ~FBINFO_MISC_USEREVENT;
                release_console_sem();
-               if (ret == 0 && copy_to_user(argp, &var, sizeof(var)))
+               unlock_fb_info(info);
+               if (!ret && copy_to_user(argp, &var, sizeof(var)))
                        ret = -EFAULT;
                break;
        case FBIOGET_FSCREENINFO:
-               ret = copy_to_user(argp, &info->fix,
-                                   sizeof(fix)) ? -EFAULT : 0;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               fix = info->fix;
+               unlock_fb_info(info);
+
+               ret = copy_to_user(argp, &fix, sizeof(fix)) ? -EFAULT : 0;
                break;
        case FBIOPUTCMAP:
                if (copy_from_user(&cmap, argp, sizeof(cmap)))
-                       ret = -EFAULT;
-               else
-                       ret = fb_set_user_cmap(&cmap, info);
+                       return -EFAULT;
+               ret = fb_set_user_cmap(&cmap, info);
                break;
        case FBIOGETCMAP:
                if (copy_from_user(&cmap, argp, sizeof(cmap)))
-                       ret = -EFAULT;
-               else
-                       ret = fb_cmap_to_user(&info->cmap, &cmap);
+                       return -EFAULT;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               cmap_from = info->cmap;
+               unlock_fb_info(info);
+               ret = fb_cmap_to_user(&cmap_from, &cmap);
                break;
        case FBIOPAN_DISPLAY:
-               if (copy_from_user(&var, argp, sizeof(var))) {
-                       ret = -EFAULT;
-                       break;
-               }
+               if (copy_from_user(&var, argp, sizeof(var)))
+                       return -EFAULT;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
                acquire_console_sem();
                ret = fb_pan_display(info, &var);
                release_console_sem();
+               unlock_fb_info(info);
                if (ret == 0 && copy_to_user(argp, &var, sizeof(var)))
-                       ret = -EFAULT;
+                       return -EFAULT;
                break;
        case FBIO_CURSOR:
                ret = -EINVAL;
                break;
        case FBIOGET_CON2FBMAP:
                if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
-                       ret = -EFAULT;
-               else if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
-                       ret = -EINVAL;
-               else {
-                       con2fb.framebuffer = -1;
-                       event.info = info;
-                       event.data = &con2fb;
-                       fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP,
-                                                               &event);
-                       ret = copy_to_user(argp, &con2fb,
-                                   sizeof(con2fb)) ? -EFAULT : 0;
-               }
+                       return -EFAULT;
+               if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
+                       return -EINVAL;
+               con2fb.framebuffer = -1;
+               event.data = &con2fb;
+
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               event.info = info;
+               fb_notifier_call_chain(FB_EVENT_GET_CONSOLE_MAP, &event);
+               unlock_fb_info(info);
+
+               ret = copy_to_user(argp, &con2fb, sizeof(con2fb)) ? -EFAULT : 0;
                break;
        case FBIOPUT_CON2FBMAP:
-               if (copy_from_user(&con2fb, argp, sizeof(con2fb))) {
-                       ret = -EFAULT;
-                       break;
-               }
-               if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES) {
-                       ret = -EINVAL;
-                       break;
-               }
-               if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX) {
-                       ret = -EINVAL;
-                       break;
-               }
+               if (copy_from_user(&con2fb, argp, sizeof(con2fb)))
+                       return -EFAULT;
+               if (con2fb.console < 1 || con2fb.console > MAX_NR_CONSOLES)
+                       return -EINVAL;
+               if (con2fb.framebuffer < 0 || con2fb.framebuffer >= FB_MAX)
+                       return -EINVAL;
                if (!registered_fb[con2fb.framebuffer])
                        request_module("fb%d", con2fb.framebuffer);
                if (!registered_fb[con2fb.framebuffer]) {
                        ret = -EINVAL;
                        break;
                }
-               event.info = info;
                event.data = &con2fb;
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               event.info = info;
                ret = fb_notifier_call_chain(FB_EVENT_SET_CONSOLE_MAP,
                                              &event);
+               unlock_fb_info(info);
                break;
        case FBIOBLANK:
+               if (!lock_fb_info(info))
+                       return -ENODEV;
                acquire_console_sem();
                info->flags |= FBINFO_MISC_USEREVENT;
                ret = fb_blank(info, arg);
                info->flags &= ~FBINFO_MISC_USEREVENT;
                release_console_sem();
-               break;;
+               unlock_fb_info(info);
+               break;
        default:
-               if (fb->fb_ioctl == NULL)
-                       ret = -ENOTTY;
-               else
+               if (!lock_fb_info(info))
+                       return -ENODEV;
+               fb = info->fbops;
+               if (fb->fb_ioctl)
                        ret = fb->fb_ioctl(info, cmd, arg);
+               else
+                       ret = -ENOTTY;
+               unlock_fb_info(info);
        }
        return ret;
 }
 
 static long fb_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
-__acquires(&info->lock)
-__releases(&info->lock)
 {
        struct inode *inode = file->f_path.dentry->d_inode;
        int fbidx = iminor(inode);
-       struct fb_info *info;
-       long ret;
+       struct fb_info *info = registered_fb[fbidx];
 
-       info = registered_fb[fbidx];
-       mutex_lock(&info->lock);
-       ret = do_fb_ioctl(info, cmd, arg);
-       mutex_unlock(&info->lock);
-       return ret;
+       return do_fb_ioctl(info, cmd, arg);
 }
 
 #ifdef CONFIG_COMPAT
@@ -1257,8 +1264,6 @@ static int fb_get_fscreeninfo(struct fb_info *info, unsigned int cmd,
 
 static long fb_compat_ioctl(struct file *file, unsigned int cmd,
                            unsigned long arg)
-__acquires(&info->lock)
-__releases(&info->lock)
 {
        struct inode *inode = file->f_path.dentry->d_inode;
        int fbidx = iminor(inode);
@@ -1266,7 +1271,6 @@ __releases(&info->lock)
        struct fb_ops *fb = info->fbops;
        long ret = -ENOIOCTLCMD;
 
-       mutex_lock(&info->lock);
        switch(cmd) {
        case FBIOGET_VSCREENINFO:
        case FBIOPUT_VSCREENINFO:
@@ -1292,7 +1296,6 @@ __releases(&info->lock)
                        ret = fb->fb_compat_ioctl(info, cmd, arg);
                break;
        }
-       mutex_unlock(&info->lock);
        return ret;
 }
 #endif
index 751e491ca8c8ee61cdc1211f7b3548783efe853a..f20eff8c4a816e1b9751ef1110f868e788f2e6a0 100644 (file)
@@ -136,13 +136,10 @@ static int gx1fb_set_par(struct fb_info *info)
 {
        struct geodefb_par *par = info->par;
 
-       if (info->var.bits_per_pixel == 16) {
+       if (info->var.bits_per_pixel == 16)
                info->fix.visual = FB_VISUAL_TRUECOLOR;
-               fb_dealloc_cmap(&info->cmap);
-       } else {
+       else
                info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
-               fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0);
-       }
 
        info->fix.line_length = gx1_line_delta(info->var.xres, info->var.bits_per_pixel);
 
@@ -315,6 +312,10 @@ static struct fb_info * __init gx1fb_init_fbinfo(struct device *dev)
        if (!par->panel_x)
                par->enable_crt = 1; /* fall back to CRT if no panel is specified */
 
+       if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+               framebuffer_release(info);
+               return NULL;
+       }
        return info;
 }
 
@@ -374,8 +375,11 @@ static int __init gx1fb_probe(struct pci_dev *pdev, const struct pci_device_id *
                release_mem_region(gx1_gx_base() + 0x8300, 0x100);
        }
 
-       if (info)
+       if (info) {
+               fb_dealloc_cmap(&info->cmap);
                framebuffer_release(info);
+       }
+
        return ret;
 }
 
@@ -395,6 +399,7 @@ static void gx1fb_remove(struct pci_dev *pdev)
        iounmap(par->dc_regs);
        release_mem_region(gx1_gx_base() + 0x8300, 0x100);
 
+       fb_dealloc_cmap(&info->cmap);
        pci_set_drvdata(pdev, NULL);
 
        framebuffer_release(info);
index 484118926318f40b7f97fcdda06336e1cae95334..2552cac39e1c7aa99536c4563933982421f21f04 100644 (file)
@@ -171,13 +171,10 @@ static int gxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
 static int gxfb_set_par(struct fb_info *info)
 {
-       if (info->var.bits_per_pixel > 8) {
+       if (info->var.bits_per_pixel > 8)
                info->fix.visual = FB_VISUAL_TRUECOLOR;
-               fb_dealloc_cmap(&info->cmap);
-       } else {
+       else
                info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
-               fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0);
-       }
 
        info->fix.line_length = gx_line_delta(info->var.xres, info->var.bits_per_pixel);
 
@@ -331,6 +328,11 @@ static struct fb_info * __init gxfb_init_fbinfo(struct device *dev)
 
        info->var.grayscale     = 0;
 
+       if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+               framebuffer_release(info);
+               return NULL;
+       }
+
        return info;
 }
 
@@ -443,8 +445,10 @@ static int __init gxfb_probe(struct pci_dev *pdev, const struct pci_device_id *i
                pci_release_region(pdev, 1);
        }
 
-       if (info)
+       if (info) {
+               fb_dealloc_cmap(&info->cmap);
                framebuffer_release(info);
+       }
        return ret;
 }
 
@@ -467,6 +471,7 @@ static void gxfb_remove(struct pci_dev *pdev)
        iounmap(par->gp_regs);
        pci_release_region(pdev, 1);
 
+       fb_dealloc_cmap(&info->cmap);
        pci_set_drvdata(pdev, NULL);
 
        framebuffer_release(info);
index b965ecdbc604695929f4a2fde6a6764027e1028c..889cbe39e5800a27346cdc7377e6662d915bd459 100644 (file)
@@ -278,13 +278,10 @@ static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 
 static int lxfb_set_par(struct fb_info *info)
 {
-       if (info->var.bits_per_pixel > 8) {
+       if (info->var.bits_per_pixel > 8)
                info->fix.visual = FB_VISUAL_TRUECOLOR;
-               fb_dealloc_cmap(&info->cmap);
-       } else {
+       else
                info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
-               fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0);
-       }
 
        info->fix.line_length = lx_get_pitch(info->var.xres,
                info->var.bits_per_pixel);
@@ -451,6 +448,11 @@ static struct fb_info * __init lxfb_init_fbinfo(struct device *dev)
 
        info->pseudo_palette    = (void *)par + sizeof(struct lxfb_par);
 
+       if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+               framebuffer_release(info);
+               return NULL;
+       }
+
        info->var.grayscale     = 0;
 
        return info;
@@ -579,8 +581,10 @@ err:
                pci_release_region(pdev, 3);
        }
 
-       if (info)
+       if (info) {
+               fb_dealloc_cmap(&info->cmap);
                framebuffer_release(info);
+       }
 
        return ret;
 }
@@ -604,6 +608,7 @@ static void lxfb_remove(struct pci_dev *pdev)
        iounmap(par->vp_regs);
        pci_release_region(pdev, 3);
 
+       fb_dealloc_cmap(&info->cmap);
        pci_set_drvdata(pdev, NULL);
        framebuffer_release(info);
 }
index 6c2d37fdd3b91c12beed0bc5de1aaed89f066454..74ae75899009fe3ad831c37ec14868d467b97ad7 100644 (file)
@@ -204,8 +204,11 @@ static int uvesafb_exec(struct uvesafb_ktask *task)
                } else {
                        v86d_started = 1;
                        err = cn_netlink_send(m, 0, gfp_any());
+                       if (err == -ENOBUFS)
+                               err = 0;
                }
-       }
+       } else if (err == -ENOBUFS)
+               err = 0;
 
        if (!err && !(task->t.flags & TF_EXIT))
                err = !wait_for_completion_timeout(task->done,
index 2c8dff9f77da13396b0d02207e15d486ddbd5d4e..1ed3d554e3728a1f7b6fb51501b1df52d26f514d 100644 (file)
@@ -115,7 +115,7 @@ static struct w1_therm_family_converter w1_therm_families[] = {
 
 static inline int w1_DS18B20_convert_temp(u8 rom[9])
 {
-       s16 t = (rom[1] << 8) | rom[0];
+       int t = ((s16)rom[1] << 8) | rom[0];
        t = t*1000/16;
        return t;
 }
index 09a3d5522b43d9a2b6d00f3612f6c88c516068ae..325c10ff6a2cd2dc616228bead8fc5c8cdb7f034 100644 (file)
@@ -406,7 +406,7 @@ config ITCO_WDT
        ---help---
          Hardware driver for the intel TCO timer based watchdog devices.
          These drivers are included in the Intel 82801 I/O Controller
-         Hub family (from ICH0 up to ICH8) and in the Intel 6300ESB
+         Hub family (from ICH0 up to ICH10) and in the Intel 63xxESB
          controller hub.
 
          The TCO (Total Cost of Ownership) timer is a watchdog timer
index 5531691f46eaf51746db11cd23acc61dbde095ed..e35d545892325b15f1b26427bf5475728e8a8504 100644 (file)
@@ -107,10 +107,10 @@ static int at91_wdt_close(struct inode *inode, struct file *file)
 static int at91_wdt_settimeout(int new_time)
 {
        /*
-        * All counting occurs at SLOW_CLOCK / 128 = 0.256 Hz
+        * All counting occurs at SLOW_CLOCK / 128 = 256 Hz
         *
         * Since WDV is a 16-bit counter, the maximum period is
-        * 65536 / 0.256 = 256 seconds.
+        * 65536 / 256 = 256 seconds.
         */
        if ((new_time <= 0) || (new_time > WDT_MAX_TIME))
                return -EINVAL;
index b1da287f90ecc24bc5395234a5d71198f0fb630a..a56ac84381b1d3ad3a879cee04bfd657fe907565 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/errno.h>
 #include <linux/fs.h>
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/kernel.h>
 #include <linux/miscdevice.h>
 #include <linux/module.h>
index 2474ebca88f6d816837765b667bdf7e9e4ea087f..d8264ad0be41f91f8ac9cfcc8ce79faff8d0f48d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *     intel TCO vendor specific watchdog driver support
  *
- *     (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>.
+ *     (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>.
  *
  *     This program is free software; you can redistribute it and/or
  *     modify it under the terms of the GNU General Public License
@@ -19,7 +19,7 @@
 
 /* Module and version information */
 #define DRV_NAME       "iTCO_vendor_support"
-#define DRV_VERSION    "1.02"
+#define DRV_VERSION    "1.03"
 #define PFX            DRV_NAME ": "
 
 /* Includes */
@@ -77,6 +77,26 @@ MODULE_PARM_DESC(vendorsupport, "iTCO vendor specific support mode, default=0 (n
  *         20.6 seconds.
  */
 
+static void supermicro_old_pre_start(unsigned long acpibase)
+{
+       unsigned long val32;
+
+       /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */
+       val32 = inl(SMI_EN);
+       val32 &= 0xffffdfff;    /* Turn off SMI clearing watchdog */
+       outl(val32, SMI_EN);    /* Needed to activate watchdog */
+}
+
+static void supermicro_old_pre_stop(unsigned long acpibase)
+{
+       unsigned long val32;
+
+       /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */
+       val32 = inl(SMI_EN);
+       val32 |= 0x00002000;    /* Turn on SMI clearing watchdog */
+       outl(val32, SMI_EN);    /* Needed to deactivate watchdog */
+}
+
 static void supermicro_old_pre_keepalive(unsigned long acpibase)
 {
        /* Reload TCO Timer (done in iTCO_wdt_keepalive) + */
@@ -228,14 +248,18 @@ static void supermicro_new_pre_set_heartbeat(unsigned int heartbeat)
 void iTCO_vendor_pre_start(unsigned long acpibase,
                           unsigned int heartbeat)
 {
-       if (vendorsupport == SUPERMICRO_NEW_BOARD)
+       if (vendorsupport == SUPERMICRO_OLD_BOARD)
+               supermicro_old_pre_start(acpibase);
+       else if (vendorsupport == SUPERMICRO_NEW_BOARD)
                supermicro_new_pre_start(heartbeat);
 }
 EXPORT_SYMBOL(iTCO_vendor_pre_start);
 
 void iTCO_vendor_pre_stop(unsigned long acpibase)
 {
-       if (vendorsupport == SUPERMICRO_NEW_BOARD)
+       if (vendorsupport == SUPERMICRO_OLD_BOARD)
+               supermicro_old_pre_stop(acpibase);
+       else if (vendorsupport == SUPERMICRO_NEW_BOARD)
                supermicro_new_pre_stop();
 }
 EXPORT_SYMBOL(iTCO_vendor_pre_stop);
index 5b395a4ddfdfec67dbd4324acbc521258977a855..352334947ea30ba0726bdb214915494d9122ddbe 100644 (file)
@@ -1,7 +1,7 @@
 /*
- *     intel TCO Watchdog Driver (Used in i82801 and i6300ESB chipsets)
+ *     intel TCO Watchdog Driver (Used in i82801 and i63xxESB chipsets)
  *
- *     (c) Copyright 2006-2008 Wim Van Sebroeck <wim@iguana.be>.
+ *     (c) Copyright 2006-2009 Wim Van Sebroeck <wim@iguana.be>.
  *
  *     This program is free software; you can redistribute it and/or
  *     modify it under the terms of the GNU General Public License
@@ -63,7 +63,7 @@
 
 /* Module and version information */
 #define DRV_NAME       "iTCO_wdt"
-#define DRV_VERSION    "1.04"
+#define DRV_VERSION    "1.05"
 #define PFX            DRV_NAME ": "
 
 /* Includes */
@@ -236,16 +236,16 @@ MODULE_DEVICE_TABLE(pci, iTCO_wdt_pci_tbl);
 
 /* Address definitions for the TCO */
 /* TCO base address */
-#define        TCOBASE         iTCO_wdt_private.ACPIBASE + 0x60
+#define TCOBASE                iTCO_wdt_private.ACPIBASE + 0x60
 /* SMI Control and Enable Register */
-#define        SMI_EN          iTCO_wdt_private.ACPIBASE + 0x30
+#define SMI_EN         iTCO_wdt_private.ACPIBASE + 0x30
 
 #define TCO_RLD                TCOBASE + 0x00  /* TCO Timer Reload and Curr. Value */
 #define TCOv1_TMR      TCOBASE + 0x01  /* TCOv1 Timer Initial Value    */
-#define        TCO_DAT_IN      TCOBASE + 0x02  /* TCO Data In Register         */
-#define        TCO_DAT_OUT     TCOBASE + 0x03  /* TCO Data Out Register        */
-#define        TCO1_STS        TCOBASE + 0x04  /* TCO1 Status Register         */
-#define        TCO2_STS        TCOBASE + 0x06  /* TCO2 Status Register         */
+#define TCO_DAT_IN     TCOBASE + 0x02  /* TCO Data In Register         */
+#define TCO_DAT_OUT    TCOBASE + 0x03  /* TCO Data Out Register        */
+#define TCO1_STS       TCOBASE + 0x04  /* TCO1 Status Register         */
+#define TCO2_STS       TCOBASE + 0x06  /* TCO2 Status Register         */
 #define TCO1_CNT       TCOBASE + 0x08  /* TCO1 Control Register        */
 #define TCO2_CNT       TCOBASE + 0x0a  /* TCO2 Control Register        */
 #define TCOv2_TMR      TCOBASE + 0x12  /* TCOv2 Timer Initial Value    */
@@ -338,7 +338,6 @@ static int iTCO_wdt_unset_NO_REBOOT_bit(void)
 static int iTCO_wdt_start(void)
 {
        unsigned int val;
-       unsigned long val32;
 
        spin_lock(&iTCO_wdt_private.io_lock);
 
@@ -351,11 +350,6 @@ static int iTCO_wdt_start(void)
                return -EIO;
        }
 
-       /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */
-       val32 = inl(SMI_EN);
-       val32 &= 0xffffdfff;    /* Turn off SMI clearing watchdog */
-       outl(val32, SMI_EN);
-
        /* Force the timer to its reload value by writing to the TCO_RLD
           register */
        if (iTCO_wdt_private.iTCO_version == 2)
@@ -378,7 +372,6 @@ static int iTCO_wdt_start(void)
 static int iTCO_wdt_stop(void)
 {
        unsigned int val;
-       unsigned long val32;
 
        spin_lock(&iTCO_wdt_private.io_lock);
 
@@ -390,11 +383,6 @@ static int iTCO_wdt_stop(void)
        outw(val, TCO1_CNT);
        val = inw(TCO1_CNT);
 
-       /* Bit 13: TCO_EN -> 1 = Enables the TCO logic to generate SMI# */
-       val32 = inl(SMI_EN);
-       val32 |= 0x00002000;
-       outl(val32, SMI_EN);
-
        /* Set the NO_REBOOT bit to prevent later reboots, just for sure */
        iTCO_wdt_set_NO_REBOOT_bit();
 
@@ -649,6 +637,7 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
        int ret;
        u32 base_address;
        unsigned long RCBA;
+       unsigned long val32;
 
        /*
         *      Find the ACPI/PM base I/O address which is the base
@@ -695,6 +684,10 @@ static int __devinit iTCO_wdt_init(struct pci_dev *pdev,
                ret = -EIO;
                goto out;
        }
+       /* Bit 13: TCO_EN -> 0 = Disables TCO logic generating an SMI# */
+       val32 = inl(SMI_EN);
+       val32 &= 0xffffdfff;    /* Turn off SMI clearing watchdog */
+       outl(val32, SMI_EN);
 
        /* The TCO I/O registers reside in a 32-byte range pointed to
           by the TCOBASE value */
index 9b91617b9582d320b67ce6c1984663d48659e03d..56892a142ee273eef1112ea212792556ecfc806b 100644 (file)
@@ -45,6 +45,13 @@ static int xen_suspend(void *data)
                       err);
                return err;
        }
+       err = sysdev_suspend(PMSG_SUSPEND);
+       if (err) {
+               printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n",
+                       err);
+               device_power_up(PMSG_RESUME);
+               return err;
+       }
 
        xen_mm_pin_all();
        gnttab_suspend();
@@ -61,6 +68,7 @@ static int xen_suspend(void *data)
        gnttab_resume();
        xen_mm_unpin_all();
 
+       sysdev_resume();
        device_power_up(PMSG_RESUME);
 
        if (!*cancelled) {
index e3ff2b9e602fd8fc8d35b24ae5a6dad841bc05f1..33b7235f853b2d46a7a685d805163d57ee0ef505 100644 (file)
@@ -1208,9 +1208,11 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
         * check for an ELF header.  If we find one, dump the first page to
         * aid in determining what was mapped here.
         */
-       if (FILTER(ELF_HEADERS) && vma->vm_file != NULL && vma->vm_pgoff == 0) {
+       if (FILTER(ELF_HEADERS) &&
+           vma->vm_pgoff == 0 && (vma->vm_flags & VM_READ)) {
                u32 __user *header = (u32 __user *) vma->vm_start;
                u32 word;
+               mm_segment_t fs = get_fs();
                /*
                 * Doing it this way gets the constant folded by GCC.
                 */
@@ -1223,7 +1225,15 @@ static unsigned long vma_dump_size(struct vm_area_struct *vma,
                magic.elfmag[EI_MAG1] = ELFMAG1;
                magic.elfmag[EI_MAG2] = ELFMAG2;
                magic.elfmag[EI_MAG3] = ELFMAG3;
-               if (get_user(word, header) == 0 && word == magic.cmp)
+               /*
+                * Switch to the user "segment" for get_user(),
+                * then put back what elf_core_dump() had in place.
+                */
+               set_fs(USER_DS);
+               if (unlikely(get_user(word, header)))
+                       word = 0;
+               set_fs(fs);
+               if (word == magic.cmp)
                        return PAGE_SIZE;
        }
 
index 062299acbccddc2d8f808d6cb85722cdd9ef6d09..72ab251cdb9cd0c527b8c18c58f9ca6bca1ed621 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -302,9 +302,10 @@ void bio_init(struct bio *bio)
 struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
 {
        struct bio *bio = NULL;
+       void *p;
 
        if (bs) {
-               void *p = mempool_alloc(bs->bio_pool, gfp_mask);
+               p = mempool_alloc(bs->bio_pool, gfp_mask);
 
                if (p)
                        bio = p + bs->front_pad;
@@ -329,7 +330,7 @@ struct bio *bio_alloc_bioset(gfp_t gfp_mask, int nr_iovecs, struct bio_set *bs)
                        }
                        if (unlikely(!bvl)) {
                                if (bs)
-                                       mempool_free(bio, bs->bio_pool);
+                                       mempool_free(p, bs->bio_pool);
                                else
                                        kfree(bio);
                                bio = NULL;
index f8fcf999ea1b1e11d2bb92730961b764216ce1c0..7bb3c020e570d9a1e0d2d640f6c9127df8e57a01 100644 (file)
@@ -16,3 +16,16 @@ config BTRFS_FS
          module will be called btrfs.
 
          If unsure, say N.
+
+config BTRFS_FS_POSIX_ACL
+       bool "Btrfs POSIX Access Control Lists"
+       depends on BTRFS_FS
+       select FS_POSIX_ACL
+       help
+         POSIX Access Control Lists (ACLs) support permissions for users and
+         groups beyond the owner/group/world scheme.
+
+         To learn more about Access Control Lists, visit the POSIX ACLs for
+         Linux website <http://acl.bestbits.at/>.
+
+         If you don't know what Access Control Lists are, say N
index 8e2fec05dbe0c084df02625a6c0342ee2fee1176..c84ca1f5259a5408f538d8254f939677567924a4 100644 (file)
  * Boston, MA 021110-1307, USA.
  */
 
-#include <linux/version.h>
 #include <linux/kthread.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
-# include <linux/freezer.h>
+#include <linux/freezer.h>
+#include <linux/ftrace.h>
 #include "async-thread.h"
 
 #define WORK_QUEUED_BIT 0
@@ -143,6 +143,7 @@ static int worker_loop(void *arg)
        struct btrfs_work *work;
        do {
                spin_lock_irq(&worker->lock);
+again_locked:
                while (!list_empty(&worker->pending)) {
                        cur = worker->pending.next;
                        work = list_entry(cur, struct btrfs_work, list);
@@ -165,14 +166,50 @@ static int worker_loop(void *arg)
                        check_idle_worker(worker);
 
                }
-               worker->working = 0;
                if (freezing(current)) {
+                       worker->working = 0;
+                       spin_unlock_irq(&worker->lock);
                        refrigerator();
                } else {
-                       set_current_state(TASK_INTERRUPTIBLE);
                        spin_unlock_irq(&worker->lock);
-                       if (!kthread_should_stop())
+                       if (!kthread_should_stop()) {
+                               cpu_relax();
+                               /*
+                                * we've dropped the lock, did someone else
+                                * jump_in?
+                                */
+                               smp_mb();
+                               if (!list_empty(&worker->pending))
+                                       continue;
+
+                               /*
+                                * this short schedule allows more work to
+                                * come in without the queue functions
+                                * needing to go through wake_up_process()
+                                *
+                                * worker->working is still 1, so nobody
+                                * is going to try and wake us up
+                                */
+                               schedule_timeout(1);
+                               smp_mb();
+                               if (!list_empty(&worker->pending))
+                                       continue;
+
+                               /* still no more work?, sleep for real */
+                               spin_lock_irq(&worker->lock);
+                               set_current_state(TASK_INTERRUPTIBLE);
+                               if (!list_empty(&worker->pending))
+                                       goto again_locked;
+
+                               /*
+                                * this makes sure we get a wakeup when someone
+                                * adds something new to the queue
+                                */
+                               worker->working = 0;
+                               spin_unlock_irq(&worker->lock);
+
                                schedule();
+                       }
                        __set_current_state(TASK_RUNNING);
                }
        } while (!kthread_should_stop());
@@ -350,13 +387,14 @@ int btrfs_requeue_work(struct btrfs_work *work)
 {
        struct btrfs_worker_thread *worker = work->worker;
        unsigned long flags;
+       int wake = 0;
 
        if (test_and_set_bit(WORK_QUEUED_BIT, &work->flags))
                goto out;
 
        spin_lock_irqsave(&worker->lock, flags);
-       atomic_inc(&worker->num_pending);
        list_add_tail(&work->list, &worker->pending);
+       atomic_inc(&worker->num_pending);
 
        /* by definition we're busy, take ourselves off the idle
         * list
@@ -368,10 +406,16 @@ int btrfs_requeue_work(struct btrfs_work *work)
                               &worker->workers->worker_list);
                spin_unlock_irqrestore(&worker->workers->lock, flags);
        }
+       if (!worker->working) {
+               wake = 1;
+               worker->working = 1;
+       }
 
        spin_unlock_irqrestore(&worker->lock, flags);
-
+       if (wake)
+               wake_up_process(worker->task);
 out:
+
        return 0;
 }
 
@@ -398,9 +442,10 @@ int btrfs_queue_worker(struct btrfs_workers *workers, struct btrfs_work *work)
        }
 
        spin_lock_irqsave(&worker->lock, flags);
+
+       list_add_tail(&work->list, &worker->pending);
        atomic_inc(&worker->num_pending);
        check_busy_worker(worker);
-       list_add_tail(&work->list, &worker->pending);
 
        /*
         * avoid calling into wake_up_process if this thread has already
index ee848d8585d9b97be41e1d37c8363b0d31408b49..ab07627084f13c4f84c39c39d802b258dbc181ab 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/swap.h>
 #include <linux/writeback.h>
 #include <linux/bit_spinlock.h>
-#include <linux/version.h>
 #include <linux/pagevec.h>
 #include "compat.h"
 #include "ctree.h"
index 9e46c07768167f53f9ae0c9b6ffdb5ce8641f56e..42491d728e9950f9c1f6f1cc4741e2997690f05f 100644 (file)
@@ -38,22 +38,64 @@ static int balance_node_right(struct btrfs_trans_handle *trans,
 static int del_ptr(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                   struct btrfs_path *path, int level, int slot);
 
-inline void btrfs_init_path(struct btrfs_path *p)
-{
-       memset(p, 0, sizeof(*p));
-}
-
 struct btrfs_path *btrfs_alloc_path(void)
 {
        struct btrfs_path *path;
-       path = kmem_cache_alloc(btrfs_path_cachep, GFP_NOFS);
-       if (path) {
-               btrfs_init_path(path);
+       path = kmem_cache_zalloc(btrfs_path_cachep, GFP_NOFS);
+       if (path)
                path->reada = 1;
-       }
        return path;
 }
 
+/*
+ * set all locked nodes in the path to blocking locks.  This should
+ * be done before scheduling
+ */
+noinline void btrfs_set_path_blocking(struct btrfs_path *p)
+{
+       int i;
+       for (i = 0; i < BTRFS_MAX_LEVEL; i++) {
+               if (p->nodes[i] && p->locks[i])
+                       btrfs_set_lock_blocking(p->nodes[i]);
+       }
+}
+
+/*
+ * reset all the locked nodes in the patch to spinning locks.
+ *
+ * held is used to keep lockdep happy, when lockdep is enabled
+ * we set held to a blocking lock before we go around and
+ * retake all the spinlocks in the path.  You can safely use NULL
+ * for held
+ */
+noinline void btrfs_clear_path_blocking(struct btrfs_path *p,
+                                       struct extent_buffer *held)
+{
+       int i;
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+       /* lockdep really cares that we take all of these spinlocks
+        * in the right order.  If any of the locks in the path are not
+        * currently blocking, it is going to complain.  So, make really
+        * really sure by forcing the path to blocking before we clear
+        * the path blocking.
+        */
+       if (held)
+               btrfs_set_lock_blocking(held);
+       btrfs_set_path_blocking(p);
+#endif
+
+       for (i = BTRFS_MAX_LEVEL - 1; i >= 0; i--) {
+               if (p->nodes[i] && p->locks[i])
+                       btrfs_clear_lock_blocking(p->nodes[i]);
+       }
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+       if (held)
+               btrfs_clear_lock_blocking(held);
+#endif
+}
+
 /* this also releases the path */
 void btrfs_free_path(struct btrfs_path *p)
 {
@@ -261,7 +303,7 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
                                                  trans->transid, level, &ins);
                BUG_ON(ret);
                cow = btrfs_init_new_buffer(trans, root, prealloc_dest,
-                                           buf->len);
+                                           buf->len, level);
        } else {
                cow = btrfs_alloc_free_block(trans, root, buf->len,
                                             parent_start,
@@ -272,6 +314,8 @@ static noinline int __btrfs_cow_block(struct btrfs_trans_handle *trans,
        if (IS_ERR(cow))
                return PTR_ERR(cow);
 
+       /* cow is set to blocking by btrfs_init_new_buffer */
+
        copy_extent_buffer(cow, buf, 0, 0, cow->len);
        btrfs_set_header_bytenr(cow, cow->start);
        btrfs_set_header_generation(cow, trans->transid);
@@ -388,17 +432,20 @@ noinline int btrfs_cow_block(struct btrfs_trans_handle *trans,
                WARN_ON(1);
        }
 
-       spin_lock(&root->fs_info->hash_lock);
        if (btrfs_header_generation(buf) == trans->transid &&
            btrfs_header_owner(buf) == root->root_key.objectid &&
            !btrfs_header_flag(buf, BTRFS_HEADER_FLAG_WRITTEN)) {
                *cow_ret = buf;
-               spin_unlock(&root->fs_info->hash_lock);
                WARN_ON(prealloc_dest);
                return 0;
        }
-       spin_unlock(&root->fs_info->hash_lock);
+
        search_start = buf->start & ~((u64)(1024 * 1024 * 1024) - 1);
+
+       if (parent)
+               btrfs_set_lock_blocking(parent);
+       btrfs_set_lock_blocking(buf);
+
        ret = __btrfs_cow_block(trans, root, buf, parent,
                                 parent_slot, cow_ret, search_start, 0,
                                 prealloc_dest);
@@ -504,6 +551,8 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
        if (parent_nritems == 1)
                return 0;
 
+       btrfs_set_lock_blocking(parent);
+
        for (i = start_slot; i < end_slot; i++) {
                int close = 1;
 
@@ -564,6 +613,7 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
                        search_start = last_block;
 
                btrfs_tree_lock(cur);
+               btrfs_set_lock_blocking(cur);
                err = __btrfs_cow_block(trans, root, cur, parent, i,
                                        &cur, search_start,
                                        min(16 * blocksize,
@@ -862,6 +912,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
                return 0;
 
        mid = path->nodes[level];
+
        WARN_ON(!path->locks[level]);
        WARN_ON(btrfs_header_generation(mid) != trans->transid);
 
@@ -883,8 +934,9 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
 
                /* promote the child to a root */
                child = read_node_slot(root, mid, 0);
-               btrfs_tree_lock(child);
                BUG_ON(!child);
+               btrfs_tree_lock(child);
+               btrfs_set_lock_blocking(child);
                ret = btrfs_cow_block(trans, root, child, mid, 0, &child, 0);
                BUG_ON(ret);
 
@@ -900,6 +952,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
 
                add_root_to_dirty_list(root);
                btrfs_tree_unlock(child);
+
                path->locks[level] = 0;
                path->nodes[level] = NULL;
                clean_tree_block(trans, root, mid);
@@ -924,6 +977,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
        left = read_node_slot(root, parent, pslot - 1);
        if (left) {
                btrfs_tree_lock(left);
+               btrfs_set_lock_blocking(left);
                wret = btrfs_cow_block(trans, root, left,
                                       parent, pslot - 1, &left, 0);
                if (wret) {
@@ -934,6 +988,7 @@ static noinline int balance_level(struct btrfs_trans_handle *trans,
        right = read_node_slot(root, parent, pslot + 1);
        if (right) {
                btrfs_tree_lock(right);
+               btrfs_set_lock_blocking(right);
                wret = btrfs_cow_block(trans, root, right,
                                       parent, pslot + 1, &right, 0);
                if (wret) {
@@ -1109,6 +1164,8 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
                u32 left_nr;
 
                btrfs_tree_lock(left);
+               btrfs_set_lock_blocking(left);
+
                left_nr = btrfs_header_nritems(left);
                if (left_nr >= BTRFS_NODEPTRS_PER_BLOCK(root) - 1) {
                        wret = 1;
@@ -1155,7 +1212,10 @@ static noinline int push_nodes_for_insert(struct btrfs_trans_handle *trans,
         */
        if (right) {
                u32 right_nr;
+
                btrfs_tree_lock(right);
+               btrfs_set_lock_blocking(right);
+
                right_nr = btrfs_header_nritems(right);
                if (right_nr >= BTRFS_NODEPTRS_PER_BLOCK(root) - 1) {
                        wret = 1;
@@ -1210,8 +1270,7 @@ static noinline void reada_for_search(struct btrfs_root *root,
        struct btrfs_disk_key disk_key;
        u32 nritems;
        u64 search;
-       u64 lowest_read;
-       u64 highest_read;
+       u64 target;
        u64 nread = 0;
        int direction = path->reada;
        struct extent_buffer *eb;
@@ -1235,8 +1294,7 @@ static noinline void reada_for_search(struct btrfs_root *root,
                return;
        }
 
-       highest_read = search;
-       lowest_read = search;
+       target = search;
 
        nritems = btrfs_header_nritems(node);
        nr = slot;
@@ -1256,27 +1314,80 @@ static noinline void reada_for_search(struct btrfs_root *root,
                                break;
                }
                search = btrfs_node_blockptr(node, nr);
-               if ((search >= lowest_read && search <= highest_read) ||
-                   (search < lowest_read && lowest_read - search <= 16384) ||
-                   (search > highest_read && search - highest_read <= 16384)) {
+               if ((search <= target && target - search <= 65536) ||
+                   (search > target && search - target <= 65536)) {
                        readahead_tree_block(root, search, blocksize,
                                     btrfs_node_ptr_generation(node, nr));
                        nread += blocksize;
                }
                nscan++;
-               if (path->reada < 2 && (nread > (64 * 1024) || nscan > 32))
+               if ((nread > 65536 || nscan > 32))
                        break;
+       }
+}
 
-               if (nread > (256 * 1024) || nscan > 128)
-                       break;
+/*
+ * returns -EAGAIN if it had to drop the path, or zero if everything was in
+ * cache
+ */
+static noinline int reada_for_balance(struct btrfs_root *root,
+                                     struct btrfs_path *path, int level)
+{
+       int slot;
+       int nritems;
+       struct extent_buffer *parent;
+       struct extent_buffer *eb;
+       u64 gen;
+       u64 block1 = 0;
+       u64 block2 = 0;
+       int ret = 0;
+       int blocksize;
+
+       parent = path->nodes[level - 1];
+       if (!parent)
+               return 0;
 
-               if (search < lowest_read)
-                       lowest_read = search;
-               if (search > highest_read)
-                       highest_read = search;
+       nritems = btrfs_header_nritems(parent);
+       slot = path->slots[level];
+       blocksize = btrfs_level_size(root, level);
+
+       if (slot > 0) {
+               block1 = btrfs_node_blockptr(parent, slot - 1);
+               gen = btrfs_node_ptr_generation(parent, slot - 1);
+               eb = btrfs_find_tree_block(root, block1, blocksize);
+               if (eb && btrfs_buffer_uptodate(eb, gen))
+                       block1 = 0;
+               free_extent_buffer(eb);
+       }
+       if (slot < nritems) {
+               block2 = btrfs_node_blockptr(parent, slot + 1);
+               gen = btrfs_node_ptr_generation(parent, slot + 1);
+               eb = btrfs_find_tree_block(root, block2, blocksize);
+               if (eb && btrfs_buffer_uptodate(eb, gen))
+                       block2 = 0;
+               free_extent_buffer(eb);
        }
+       if (block1 || block2) {
+               ret = -EAGAIN;
+               btrfs_release_path(root, path);
+               if (block1)
+                       readahead_tree_block(root, block1, blocksize, 0);
+               if (block2)
+                       readahead_tree_block(root, block2, blocksize, 0);
+
+               if (block1) {
+                       eb = read_tree_block(root, block1, blocksize, 0);
+                       free_extent_buffer(eb);
+               }
+               if (block1) {
+                       eb = read_tree_block(root, block2, blocksize, 0);
+                       free_extent_buffer(eb);
+               }
+       }
+       return ret;
 }
 
+
 /*
  * when we walk down the tree, it is usually safe to unlock the higher layers
  * in the tree.  The exceptions are when our path goes through slot 0, because
@@ -1327,6 +1438,32 @@ static noinline void unlock_up(struct btrfs_path *path, int level,
        }
 }
 
+/*
+ * This releases any locks held in the path starting at level and
+ * going all the way up to the root.
+ *
+ * btrfs_search_slot will keep the lock held on higher nodes in a few
+ * corner cases, such as COW of the block at slot zero in the node.  This
+ * ignores those rules, and it should only be called when there are no
+ * more updates to be done higher up in the tree.
+ */
+noinline void btrfs_unlock_up_safe(struct btrfs_path *path, int level)
+{
+       int i;
+
+       if (path->keep_locks || path->lowest_level)
+               return;
+
+       for (i = level; i < BTRFS_MAX_LEVEL; i++) {
+               if (!path->nodes[i])
+                       continue;
+               if (!path->locks[i])
+                       continue;
+               btrfs_tree_unlock(path->nodes[i]);
+               path->locks[i] = 0;
+       }
+}
+
 /*
  * look for key in the tree.  path is filled in with nodes along the way
  * if key is found, we return zero and you can find the item in the leaf
@@ -1387,32 +1524,30 @@ again:
                        int wret;
 
                        /* is a cow on this block not required */
-                       spin_lock(&root->fs_info->hash_lock);
                        if (btrfs_header_generation(b) == trans->transid &&
                            btrfs_header_owner(b) == root->root_key.objectid &&
                            !btrfs_header_flag(b, BTRFS_HEADER_FLAG_WRITTEN)) {
-                               spin_unlock(&root->fs_info->hash_lock);
                                goto cow_done;
                        }
-                       spin_unlock(&root->fs_info->hash_lock);
 
                        /* ok, we have to cow, is our old prealloc the right
                         * size?
                         */
                        if (prealloc_block.objectid &&
                            prealloc_block.offset != b->len) {
+                               btrfs_release_path(root, p);
                                btrfs_free_reserved_extent(root,
                                           prealloc_block.objectid,
                                           prealloc_block.offset);
                                prealloc_block.objectid = 0;
+                               goto again;
                        }
 
                        /*
                         * for higher level blocks, try not to allocate blocks
                         * with the block and the parent locks held.
                         */
-                       if (level > 1 && !prealloc_block.objectid &&
-                           btrfs_path_lock_waiting(p, level)) {
+                       if (level > 0 && !prealloc_block.objectid) {
                                u32 size = b->len;
                                u64 hint = b->start;
 
@@ -1425,6 +1560,8 @@ again:
                                goto again;
                        }
 
+                       btrfs_set_path_blocking(p);
+
                        wret = btrfs_cow_block(trans, root, b,
                                               p->nodes[level + 1],
                                               p->slots[level + 1],
@@ -1446,6 +1583,22 @@ cow_done:
                if (!p->skip_locking)
                        p->locks[level] = 1;
 
+               btrfs_clear_path_blocking(p, NULL);
+
+               /*
+                * we have a lock on b and as long as we aren't changing
+                * the tree, there is no way to for the items in b to change.
+                * It is safe to drop the lock on our parent before we
+                * go through the expensive btree search on b.
+                *
+                * If cow is true, then we might be changing slot zero,
+                * which may require changing the parent.  So, we can't
+                * drop the lock until after we know which slot we're
+                * operating on.
+                */
+               if (!cow)
+                       btrfs_unlock_up_safe(p, level + 1);
+
                ret = check_block(root, p, level);
                if (ret) {
                        ret = -1;
@@ -1453,6 +1606,7 @@ cow_done:
                }
 
                ret = bin_search(b, key, level, &slot);
+
                if (level != 0) {
                        if (ret && slot > 0)
                                slot -= 1;
@@ -1460,7 +1614,16 @@ cow_done:
                        if ((p->search_for_split || ins_len > 0) &&
                            btrfs_header_nritems(b) >=
                            BTRFS_NODEPTRS_PER_BLOCK(root) - 3) {
-                               int sret = split_node(trans, root, p, level);
+                               int sret;
+
+                               sret = reada_for_balance(root, p, level);
+                               if (sret)
+                                       goto again;
+
+                               btrfs_set_path_blocking(p);
+                               sret = split_node(trans, root, p, level);
+                               btrfs_clear_path_blocking(p, NULL);
+
                                BUG_ON(sret > 0);
                                if (sret) {
                                        ret = sret;
@@ -1468,9 +1631,19 @@ cow_done:
                                }
                                b = p->nodes[level];
                                slot = p->slots[level];
-                       } else if (ins_len < 0) {
-                               int sret = balance_level(trans, root, p,
-                                                        level);
+                       } else if (ins_len < 0 &&
+                                  btrfs_header_nritems(b) <
+                                  BTRFS_NODEPTRS_PER_BLOCK(root) / 4) {
+                               int sret;
+
+                               sret = reada_for_balance(root, p, level);
+                               if (sret)
+                                       goto again;
+
+                               btrfs_set_path_blocking(p);
+                               sret = balance_level(trans, root, p, level);
+                               btrfs_clear_path_blocking(p, NULL);
+
                                if (sret) {
                                        ret = sret;
                                        goto done;
@@ -1504,7 +1677,7 @@ cow_done:
                                 * of the btree by dropping locks before
                                 * we read.
                                 */
-                               if (level > 1) {
+                               if (level > 0) {
                                        btrfs_release_path(NULL, p);
                                        if (tmp)
                                                free_extent_buffer(tmp);
@@ -1519,6 +1692,7 @@ cow_done:
                                                free_extent_buffer(tmp);
                                        goto again;
                                } else {
+                                       btrfs_set_path_blocking(p);
                                        if (tmp)
                                                free_extent_buffer(tmp);
                                        if (should_reada)
@@ -1528,14 +1702,29 @@ cow_done:
                                        b = read_node_slot(root, b, slot);
                                }
                        }
-                       if (!p->skip_locking)
-                               btrfs_tree_lock(b);
+                       if (!p->skip_locking) {
+                               int lret;
+
+                               btrfs_clear_path_blocking(p, NULL);
+                               lret = btrfs_try_spin_lock(b);
+
+                               if (!lret) {
+                                       btrfs_set_path_blocking(p);
+                                       btrfs_tree_lock(b);
+                                       btrfs_clear_path_blocking(p, b);
+                               }
+                       }
                } else {
                        p->slots[level] = slot;
                        if (ins_len > 0 &&
                            btrfs_leaf_free_space(root, b) < ins_len) {
-                               int sret = split_leaf(trans, root, key,
+                               int sret;
+
+                               btrfs_set_path_blocking(p);
+                               sret = split_leaf(trans, root, key,
                                                      p, ins_len, ret == 0);
+                               btrfs_clear_path_blocking(p, NULL);
+
                                BUG_ON(sret > 0);
                                if (sret) {
                                        ret = sret;
@@ -1549,12 +1738,16 @@ cow_done:
        }
        ret = 1;
 done:
+       /*
+        * we don't really know what they plan on doing with the path
+        * from here on, so for now just mark it as blocking
+        */
+       btrfs_set_path_blocking(p);
        if (prealloc_block.objectid) {
                btrfs_free_reserved_extent(root,
                           prealloc_block.objectid,
                           prealloc_block.offset);
        }
-
        return ret;
 }
 
@@ -1578,6 +1771,8 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans,
        ret = btrfs_cow_block(trans, root, eb, NULL, 0, &eb, 0);
        BUG_ON(ret);
 
+       btrfs_set_lock_blocking(eb);
+
        parent = eb;
        while (1) {
                level = btrfs_header_level(parent);
@@ -1602,6 +1797,7 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans,
                        eb = read_tree_block(root, bytenr, blocksize,
                                             generation);
                        btrfs_tree_lock(eb);
+                       btrfs_set_lock_blocking(eb);
                }
 
                /*
@@ -1626,6 +1822,7 @@ int btrfs_merge_path(struct btrfs_trans_handle *trans,
                                eb = read_tree_block(root, bytenr, blocksize,
                                                generation);
                                btrfs_tree_lock(eb);
+                               btrfs_set_lock_blocking(eb);
                        }
 
                        ret = btrfs_cow_block(trans, root, eb, parent, slot,
@@ -2172,6 +2369,8 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root
 
        right = read_node_slot(root, upper, slot + 1);
        btrfs_tree_lock(right);
+       btrfs_set_lock_blocking(right);
+
        free_space = btrfs_leaf_free_space(root, right);
        if (free_space < data_size)
                goto out_unlock;
@@ -2367,6 +2566,8 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root
 
        left = read_node_slot(root, path->nodes[1], slot - 1);
        btrfs_tree_lock(left);
+       btrfs_set_lock_blocking(left);
+
        free_space = btrfs_leaf_free_space(root, left);
        if (free_space < data_size) {
                ret = 1;
@@ -2825,6 +3026,12 @@ int btrfs_split_item(struct btrfs_trans_handle *trans,
        path->keep_locks = 0;
        BUG_ON(ret);
 
+       /*
+        * make sure any changes to the path from split_leaf leave it
+        * in a blocking state
+        */
+       btrfs_set_path_blocking(path);
+
        leaf = path->nodes[0];
        BUG_ON(btrfs_leaf_free_space(root, leaf) < sizeof(struct btrfs_item));
 
@@ -3354,6 +3561,7 @@ int btrfs_insert_empty_items(struct btrfs_trans_handle *trans,
                BUG();
        }
 out:
+       btrfs_unlock_up_safe(path, 1);
        return ret;
 }
 
@@ -3441,15 +3649,22 @@ noinline int btrfs_del_leaf(struct btrfs_trans_handle *trans,
 {
        int ret;
        u64 root_gen = btrfs_header_generation(path->nodes[1]);
+       u64 parent_start = path->nodes[1]->start;
+       u64 parent_owner = btrfs_header_owner(path->nodes[1]);
 
        ret = del_ptr(trans, root, path, 1, path->slots[1]);
        if (ret)
                return ret;
 
+       /*
+        * btrfs_free_extent is expensive, we want to make sure we
+        * aren't holding any locks when we call it
+        */
+       btrfs_unlock_up_safe(path, 0);
+
        ret = btrfs_free_extent(trans, root, bytenr,
                                btrfs_level_size(root, 0),
-                               path->nodes[1]->start,
-                               btrfs_header_owner(path->nodes[1]),
+                               parent_start, parent_owner,
                                root_gen, 0, 1);
        return ret;
 }
@@ -3721,6 +3936,7 @@ find_next_key:
                 */
                if (slot >= nritems) {
                        path->slots[level] = slot;
+                       btrfs_set_path_blocking(path);
                        sret = btrfs_find_next_key(root, path, min_key, level,
                                                  cache_only, min_trans);
                        if (sret == 0) {
@@ -3738,16 +3954,20 @@ find_next_key:
                        unlock_up(path, level, 1);
                        goto out;
                }
+               btrfs_set_path_blocking(path);
                cur = read_node_slot(root, cur, slot);
 
                btrfs_tree_lock(cur);
+
                path->locks[level - 1] = 1;
                path->nodes[level - 1] = cur;
                unlock_up(path, level, 1);
+               btrfs_clear_path_blocking(path, NULL);
        }
 out:
        if (ret == 0)
                memcpy(min_key, &found_key, sizeof(found_key));
+       btrfs_set_path_blocking(path);
        return ret;
 }
 
@@ -3843,6 +4063,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
        if (ret < 0)
                return ret;
 
+       btrfs_set_path_blocking(path);
        nritems = btrfs_header_nritems(path->nodes[0]);
        /*
         * by releasing the path above we dropped all our locks.  A balance
@@ -3873,6 +4094,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
                        free_extent_buffer(next);
                }
 
+               /* the path was set to blocking above */
                if (level == 1 && (path->locks[1] || path->skip_locking) &&
                    path->reada)
                        reada_for_search(root, path, level, slot, 0);
@@ -3881,6 +4103,7 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
                if (!path->skip_locking) {
                        WARN_ON(!btrfs_tree_locked(c));
                        btrfs_tree_lock(next);
+                       btrfs_set_lock_blocking(next);
                }
                break;
        }
@@ -3897,12 +4120,15 @@ int btrfs_next_leaf(struct btrfs_root *root, struct btrfs_path *path)
                        path->locks[level] = 1;
                if (!level)
                        break;
+
+               btrfs_set_path_blocking(path);
                if (level == 1 && path->locks[1] && path->reada)
                        reada_for_search(root, path, level, slot, 0);
                next = read_node_slot(root, next, 0);
                if (!path->skip_locking) {
                        WARN_ON(!btrfs_tree_locked(path->nodes[level]));
                        btrfs_tree_lock(next);
+                       btrfs_set_lock_blocking(next);
                }
        }
 done:
@@ -3927,6 +4153,7 @@ int btrfs_previous_item(struct btrfs_root *root,
 
        while (1) {
                if (path->slots[0] == 0) {
+                       btrfs_set_path_blocking(path);
                        ret = btrfs_prev_leaf(root, path);
                        if (ret != 0)
                                return ret;
index eee060f88113089c5243e2dc9c38e77258d58da6..766b31ae3186e46f54d5d9fbe6fed621651c6520 100644 (file)
@@ -43,11 +43,7 @@ struct btrfs_ordered_sum;
 
 #define BTRFS_ACL_NOT_CACHED    ((void *)-1)
 
-#ifdef CONFIG_LOCKDEP
-# define BTRFS_MAX_LEVEL 7
-#else
-# define BTRFS_MAX_LEVEL 8
-#endif
+#define BTRFS_MAX_LEVEL 8
 
 /* holds pointers to all of the tree roots */
 #define BTRFS_ROOT_TREE_OBJECTID 1ULL
@@ -454,17 +450,11 @@ struct btrfs_timespec {
        __le32 nsec;
 } __attribute__ ((__packed__));
 
-typedef enum {
+enum btrfs_compression_type {
        BTRFS_COMPRESS_NONE = 0,
        BTRFS_COMPRESS_ZLIB = 1,
        BTRFS_COMPRESS_LAST = 2,
-} btrfs_compression_type;
-
-/* we don't understand any encryption methods right now */
-typedef enum {
-       BTRFS_ENCRYPTION_NONE = 0,
-       BTRFS_ENCRYPTION_LAST = 1,
-} btrfs_encryption_type;
+};
 
 struct btrfs_inode_item {
        /* nfs style generation number */
@@ -701,9 +691,7 @@ struct btrfs_fs_info {
        struct btrfs_transaction *running_transaction;
        wait_queue_head_t transaction_throttle;
        wait_queue_head_t transaction_wait;
-
        wait_queue_head_t async_submit_wait;
-       wait_queue_head_t tree_log_wait;
 
        struct btrfs_super_block super_copy;
        struct btrfs_super_block super_for_commit;
@@ -711,7 +699,6 @@ struct btrfs_fs_info {
        struct super_block *sb;
        struct inode *btree_inode;
        struct backing_dev_info bdi;
-       spinlock_t hash_lock;
        struct mutex trans_mutex;
        struct mutex tree_log_mutex;
        struct mutex transaction_kthread_mutex;
@@ -730,10 +717,6 @@ struct btrfs_fs_info {
        atomic_t async_submit_draining;
        atomic_t nr_async_bios;
        atomic_t async_delalloc_pages;
-       atomic_t tree_log_writers;
-       atomic_t tree_log_commit;
-       unsigned long tree_log_batch;
-       u64 tree_log_transid;
 
        /*
         * this is used by the balancing code to wait for all the pending
@@ -833,7 +816,14 @@ struct btrfs_root {
        struct kobject root_kobj;
        struct completion kobj_unregister;
        struct mutex objectid_mutex;
+
        struct mutex log_mutex;
+       wait_queue_head_t log_writer_wait;
+       wait_queue_head_t log_commit_wait[2];
+       atomic_t log_writers;
+       atomic_t log_commit[2];
+       unsigned long log_transid;
+       unsigned long log_batch;
 
        u64 objectid;
        u64 last_trans;
@@ -1721,7 +1711,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
                                             u64 empty_size);
 struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
                                            struct btrfs_root *root,
-                                           u64 bytenr, u32 blocksize);
+                                           u64 bytenr, u32 blocksize,
+                                           int level);
 int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
                       struct btrfs_root *root,
                       u64 num_bytes, u64 parent, u64 min_bytes,
@@ -1840,7 +1831,9 @@ int btrfs_realloc_node(struct btrfs_trans_handle *trans,
 void btrfs_release_path(struct btrfs_root *root, struct btrfs_path *p);
 struct btrfs_path *btrfs_alloc_path(void);
 void btrfs_free_path(struct btrfs_path *p);
-void btrfs_init_path(struct btrfs_path *p);
+void btrfs_set_path_blocking(struct btrfs_path *p);
+void btrfs_unlock_up_safe(struct btrfs_path *p, int level);
+
 int btrfs_del_items(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                   struct btrfs_path *path, int slot, int nr);
 int btrfs_del_leaf(struct btrfs_trans_handle *trans,
index 81a313874ae577aa51370459a0e98c8e26c53c46..adda739a0215345b99476435ad35f703174b1d26 100644 (file)
@@ -16,7 +16,6 @@
  * Boston, MA 021110-1307, USA.
  */
 
-#include <linux/version.h>
 #include <linux/fs.h>
 #include <linux/blkdev.h>
 #include <linux/scatterlist.h>
@@ -76,6 +75,40 @@ struct async_submit_bio {
        struct btrfs_work work;
 };
 
+/* These are used to set the lockdep class on the extent buffer locks.
+ * The class is set by the readpage_end_io_hook after the buffer has
+ * passed csum validation but before the pages are unlocked.
+ *
+ * The lockdep class is also set by btrfs_init_new_buffer on freshly
+ * allocated blocks.
+ *
+ * The class is based on the level in the tree block, which allows lockdep
+ * to know that lower nodes nest inside the locks of higher nodes.
+ *
+ * We also add a check to make sure the highest level of the tree is
+ * the same as our lockdep setup here.  If BTRFS_MAX_LEVEL changes, this
+ * code needs update as well.
+ */
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+# if BTRFS_MAX_LEVEL != 8
+#  error
+# endif
+static struct lock_class_key btrfs_eb_class[BTRFS_MAX_LEVEL + 1];
+static const char *btrfs_eb_name[BTRFS_MAX_LEVEL + 1] = {
+       /* leaf */
+       "btrfs-extent-00",
+       "btrfs-extent-01",
+       "btrfs-extent-02",
+       "btrfs-extent-03",
+       "btrfs-extent-04",
+       "btrfs-extent-05",
+       "btrfs-extent-06",
+       "btrfs-extent-07",
+       /* highest possible level */
+       "btrfs-extent-08",
+};
+#endif
+
 /*
  * extents on the btree inode are pretty simple, there's one extent
  * that covers the entire device
@@ -348,6 +381,15 @@ static int check_tree_block_fsid(struct btrfs_root *root,
        return ret;
 }
 
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level)
+{
+       lockdep_set_class_and_name(&eb->lock,
+                          &btrfs_eb_class[level],
+                          btrfs_eb_name[level]);
+}
+#endif
+
 static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
                               struct extent_state *state)
 {
@@ -393,6 +435,8 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end,
        }
        found_level = btrfs_header_level(eb);
 
+       btrfs_set_buffer_lockdep_class(eb, found_level);
+
        ret = csum_tree_block(root, eb, 1);
        if (ret)
                ret = -EIO;
@@ -800,7 +844,7 @@ struct extent_buffer *read_tree_block(struct btrfs_root *root, u64 bytenr,
        ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid);
 
        if (ret == 0)
-               buf->flags |= EXTENT_UPTODATE;
+               set_bit(EXTENT_BUFFER_UPTODATE, &buf->bflags);
        else
                WARN_ON(1);
        return buf;
@@ -814,6 +858,10 @@ int clean_tree_block(struct btrfs_trans_handle *trans, struct btrfs_root *root,
        if (btrfs_header_generation(buf) ==
            root->fs_info->running_transaction->transid) {
                WARN_ON(!btrfs_tree_locked(buf));
+
+               /* ugh, clear_extent_buffer_dirty can be expensive */
+               btrfs_set_lock_blocking(buf);
+
                clear_extent_buffer_dirty(&BTRFS_I(btree_inode)->io_tree,
                                          buf);
        }
@@ -850,6 +898,14 @@ static int __setup_root(u32 nodesize, u32 leafsize, u32 sectorsize,
        spin_lock_init(&root->list_lock);
        mutex_init(&root->objectid_mutex);
        mutex_init(&root->log_mutex);
+       init_waitqueue_head(&root->log_writer_wait);
+       init_waitqueue_head(&root->log_commit_wait[0]);
+       init_waitqueue_head(&root->log_commit_wait[1]);
+       atomic_set(&root->log_commit[0], 0);
+       atomic_set(&root->log_commit[1], 0);
+       atomic_set(&root->log_writers, 0);
+       root->log_batch = 0;
+       root->log_transid = 0;
        extent_io_tree_init(&root->dirty_log_pages,
                             fs_info->btree_inode->i_mapping, GFP_NOFS);
 
@@ -934,15 +990,16 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans,
        return 0;
 }
 
-int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
-                            struct btrfs_fs_info *fs_info)
+static struct btrfs_root *alloc_log_tree(struct btrfs_trans_handle *trans,
+                                        struct btrfs_fs_info *fs_info)
 {
        struct btrfs_root *root;
        struct btrfs_root *tree_root = fs_info->tree_root;
+       struct extent_buffer *leaf;
 
        root = kzalloc(sizeof(*root), GFP_NOFS);
        if (!root)
-               return -ENOMEM;
+               return ERR_PTR(-ENOMEM);
 
        __setup_root(tree_root->nodesize, tree_root->leafsize,
                     tree_root->sectorsize, tree_root->stripesize,
@@ -951,12 +1008,23 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
        root->root_key.objectid = BTRFS_TREE_LOG_OBJECTID;
        root->root_key.type = BTRFS_ROOT_ITEM_KEY;
        root->root_key.offset = BTRFS_TREE_LOG_OBJECTID;
+       /*
+        * log trees do not get reference counted because they go away
+        * before a real commit is actually done.  They do store pointers
+        * to file data extents, and those reference counts still get
+        * updated (along with back refs to the log tree).
+        */
        root->ref_cows = 0;
 
-       root->node = btrfs_alloc_free_block(trans, root, root->leafsize,
-                                           0, BTRFS_TREE_LOG_OBJECTID,
-                                           trans->transid, 0, 0, 0);
+       leaf = btrfs_alloc_free_block(trans, root, root->leafsize,
+                                     0, BTRFS_TREE_LOG_OBJECTID,
+                                     trans->transid, 0, 0, 0);
+       if (IS_ERR(leaf)) {
+               kfree(root);
+               return ERR_CAST(leaf);
+       }
 
+       root->node = leaf;
        btrfs_set_header_nritems(root->node, 0);
        btrfs_set_header_level(root->node, 0);
        btrfs_set_header_bytenr(root->node, root->node->start);
@@ -968,7 +1036,48 @@ int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
                            BTRFS_FSID_SIZE);
        btrfs_mark_buffer_dirty(root->node);
        btrfs_tree_unlock(root->node);
-       fs_info->log_root_tree = root;
+       return root;
+}
+
+int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
+                            struct btrfs_fs_info *fs_info)
+{
+       struct btrfs_root *log_root;
+
+       log_root = alloc_log_tree(trans, fs_info);
+       if (IS_ERR(log_root))
+               return PTR_ERR(log_root);
+       WARN_ON(fs_info->log_root_tree);
+       fs_info->log_root_tree = log_root;
+       return 0;
+}
+
+int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
+                      struct btrfs_root *root)
+{
+       struct btrfs_root *log_root;
+       struct btrfs_inode_item *inode_item;
+
+       log_root = alloc_log_tree(trans, root->fs_info);
+       if (IS_ERR(log_root))
+               return PTR_ERR(log_root);
+
+       log_root->last_trans = trans->transid;
+       log_root->root_key.offset = root->root_key.objectid;
+
+       inode_item = &log_root->root_item.inode;
+       inode_item->generation = cpu_to_le64(1);
+       inode_item->size = cpu_to_le64(3);
+       inode_item->nlink = cpu_to_le32(1);
+       inode_item->nbytes = cpu_to_le64(root->leafsize);
+       inode_item->mode = cpu_to_le32(S_IFDIR | 0755);
+
+       btrfs_set_root_bytenr(&log_root->root_item, log_root->node->start);
+       btrfs_set_root_generation(&log_root->root_item, trans->transid);
+
+       WARN_ON(root->log_root);
+       root->log_root = log_root;
+       root->log_transid = 0;
        return 0;
 }
 
@@ -1136,7 +1245,6 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
 {
        struct btrfs_fs_info *info = (struct btrfs_fs_info *)congested_data;
        int ret = 0;
-       struct list_head *cur;
        struct btrfs_device *device;
        struct backing_dev_info *bdi;
 #if 0
@@ -1144,8 +1252,7 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
            btrfs_congested_async(info, 0))
                return 1;
 #endif
-       list_for_each(cur, &info->fs_devices->devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
                if (!device->bdev)
                        continue;
                bdi = blk_get_backing_dev_info(device->bdev);
@@ -1163,13 +1270,11 @@ static int btrfs_congested_fn(void *congested_data, int bdi_bits)
  */
 static void __unplug_io_fn(struct backing_dev_info *bdi, struct page *page)
 {
-       struct list_head *cur;
        struct btrfs_device *device;
        struct btrfs_fs_info *info;
 
        info = (struct btrfs_fs_info *)bdi->unplug_io_data;
-       list_for_each(cur, &info->fs_devices->devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, &info->fs_devices->devices, dev_list) {
                if (!device->bdev)
                        continue;
 
@@ -1447,7 +1552,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        INIT_LIST_HEAD(&fs_info->dead_roots);
        INIT_LIST_HEAD(&fs_info->hashers);
        INIT_LIST_HEAD(&fs_info->delalloc_inodes);
-       spin_lock_init(&fs_info->hash_lock);
        spin_lock_init(&fs_info->delalloc_lock);
        spin_lock_init(&fs_info->new_trans_lock);
        spin_lock_init(&fs_info->ref_cache_lock);
@@ -1535,10 +1639,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        init_waitqueue_head(&fs_info->transaction_throttle);
        init_waitqueue_head(&fs_info->transaction_wait);
        init_waitqueue_head(&fs_info->async_submit_wait);
-       init_waitqueue_head(&fs_info->tree_log_wait);
-       atomic_set(&fs_info->tree_log_commit, 0);
-       atomic_set(&fs_info->tree_log_writers, 0);
-       fs_info->tree_log_transid = 0;
 
        __setup_root(4096, 4096, 4096, 4096, tree_root,
                     fs_info, BTRFS_ROOT_TREE_OBJECTID);
@@ -1627,6 +1727,8 @@ struct btrfs_root *open_ctree(struct super_block *sb,
         * low idle thresh
         */
        fs_info->endio_workers.idle_thresh = 4;
+       fs_info->endio_meta_workers.idle_thresh = 4;
+
        fs_info->endio_write_workers.idle_thresh = 64;
        fs_info->endio_meta_write_workers.idle_thresh = 64;
 
@@ -1720,7 +1822,6 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        ret = find_and_setup_root(tree_root, fs_info,
                                  BTRFS_DEV_TREE_OBJECTID, dev_root);
        dev_root->track_dirty = 1;
-
        if (ret)
                goto fail_extent_root;
 
@@ -1740,13 +1841,13 @@ struct btrfs_root *open_ctree(struct super_block *sb,
        fs_info->system_alloc_profile = fs_info->metadata_alloc_profile;
        fs_info->cleaner_kthread = kthread_run(cleaner_kthread, tree_root,
                                               "btrfs-cleaner");
-       if (!fs_info->cleaner_kthread)
+       if (IS_ERR(fs_info->cleaner_kthread))
                goto fail_csum_root;
 
        fs_info->transaction_kthread = kthread_run(transaction_kthread,
                                                   tree_root,
                                                   "btrfs-transaction");
-       if (!fs_info->transaction_kthread)
+       if (IS_ERR(fs_info->transaction_kthread))
                goto fail_cleaner;
 
        if (btrfs_super_log_root(disk_super) != 0) {
@@ -1828,13 +1929,14 @@ fail_sb_buffer:
 fail_iput:
        invalidate_inode_pages2(fs_info->btree_inode->i_mapping);
        iput(fs_info->btree_inode);
-fail:
+
        btrfs_close_devices(fs_info->fs_devices);
        btrfs_mapping_tree_free(&fs_info->mapping_tree);
+       bdi_destroy(&fs_info->bdi);
 
+fail:
        kfree(extent_root);
        kfree(tree_root);
-       bdi_destroy(&fs_info->bdi);
        kfree(fs_info);
        kfree(chunk_root);
        kfree(dev_root);
@@ -1995,7 +2097,6 @@ static int write_dev_supers(struct btrfs_device *device,
 
 int write_all_supers(struct btrfs_root *root, int max_mirrors)
 {
-       struct list_head *cur;
        struct list_head *head = &root->fs_info->fs_devices->devices;
        struct btrfs_device *dev;
        struct btrfs_super_block *sb;
@@ -2011,8 +2112,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors)
 
        sb = &root->fs_info->super_for_commit;
        dev_item = &sb->dev_item;
-       list_for_each(cur, head) {
-               dev = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(dev, head, dev_list) {
                if (!dev->bdev) {
                        total_errors++;
                        continue;
@@ -2045,8 +2145,7 @@ int write_all_supers(struct btrfs_root *root, int max_mirrors)
        }
 
        total_errors = 0;
-       list_for_each(cur, head) {
-               dev = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(dev, head, dev_list) {
                if (!dev->bdev)
                        continue;
                if (!dev->in_fs_metadata || !dev->writeable)
@@ -2260,6 +2359,8 @@ void btrfs_mark_buffer_dirty(struct extent_buffer *buf)
        u64 transid = btrfs_header_generation(buf);
        struct inode *btree_inode = root->fs_info->btree_inode;
 
+       btrfs_set_lock_blocking(buf);
+
        WARN_ON(!btrfs_tree_locked(buf));
        if (transid != root->fs_info->generation) {
                printk(KERN_CRIT "btrfs transid mismatch buffer %llu, "
@@ -2302,14 +2403,13 @@ int btrfs_read_buffer(struct extent_buffer *buf, u64 parent_transid)
        int ret;
        ret = btree_read_extent_buffer_pages(root, buf, 0, parent_transid);
        if (ret == 0)
-               buf->flags |= EXTENT_UPTODATE;
+               set_bit(EXTENT_BUFFER_UPTODATE, &buf->bflags);
        return ret;
 }
 
 int btree_lock_page_hook(struct page *page)
 {
        struct inode *inode = page->mapping->host;
-       struct btrfs_root *root = BTRFS_I(inode)->root;
        struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree;
        struct extent_buffer *eb;
        unsigned long len;
@@ -2324,9 +2424,7 @@ int btree_lock_page_hook(struct page *page)
                goto out;
 
        btrfs_tree_lock(eb);
-       spin_lock(&root->fs_info->hash_lock);
        btrfs_set_header_flag(eb, BTRFS_HEADER_FLAG_WRITTEN);
-       spin_unlock(&root->fs_info->hash_lock);
        btrfs_tree_unlock(eb);
        free_extent_buffer(eb);
 out:
index c0ff404c31b71745b4a8b8b9addb2f9f64f02018..95029db227be5767d17eeab2a11cb36b63709849 100644 (file)
@@ -98,5 +98,17 @@ int btrfs_free_log_root_tree(struct btrfs_trans_handle *trans,
                             struct btrfs_fs_info *fs_info);
 int btrfs_init_log_root_tree(struct btrfs_trans_handle *trans,
                             struct btrfs_fs_info *fs_info);
+int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
+                      struct btrfs_root *root);
 int btree_lock_page_hook(struct page *page);
+
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb, int level);
+#else
+static inline void btrfs_set_buffer_lockdep_class(struct extent_buffer *eb,
+                                                int level)
+{
+}
+#endif
 #endif
index 293da650873f5193c726c4883bc6ecc5114b0a1a..0a5d796c9f7ee3086bd3c8bccdfc63b59d674e0f 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/pagemap.h>
 #include <linux/writeback.h>
 #include <linux/blkdev.h>
-#include <linux/version.h>
+#include <linux/sort.h>
 #include "compat.h"
 #include "hash.h"
 #include "crc32c.h"
@@ -30,7 +30,6 @@
 #include "volumes.h"
 #include "locking.h"
 #include "ref-cache.h"
-#include "compat.h"
 
 #define PENDING_EXTENT_INSERT 0
 #define PENDING_EXTENT_DELETE 1
@@ -326,10 +325,8 @@ static struct btrfs_space_info *__find_space_info(struct btrfs_fs_info *info,
                                                  u64 flags)
 {
        struct list_head *head = &info->space_info;
-       struct list_head *cur;
        struct btrfs_space_info *found;
-       list_for_each(cur, head) {
-               found = list_entry(cur, struct btrfs_space_info, list);
+       list_for_each_entry(found, head, list) {
                if (found->flags == flags)
                        return found;
        }
@@ -1326,8 +1323,25 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans,
 int btrfs_extent_post_op(struct btrfs_trans_handle *trans,
                         struct btrfs_root *root)
 {
-       finish_current_insert(trans, root->fs_info->extent_root, 1);
-       del_pending_extents(trans, root->fs_info->extent_root, 1);
+       u64 start;
+       u64 end;
+       int ret;
+
+       while(1) {
+               finish_current_insert(trans, root->fs_info->extent_root, 1);
+               del_pending_extents(trans, root->fs_info->extent_root, 1);
+
+               /* is there more work to do? */
+               ret = find_first_extent_bit(&root->fs_info->pending_del,
+                                           0, &start, &end, EXTENT_WRITEBACK);
+               if (!ret)
+                       continue;
+               ret = find_first_extent_bit(&root->fs_info->extent_ins,
+                                           0, &start, &end, EXTENT_WRITEBACK);
+               if (!ret)
+                       continue;
+               break;
+       }
        return 0;
 }
 
@@ -1525,15 +1539,55 @@ out:
        return ret;
 }
 
-int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
-                 struct extent_buffer *orig_buf, struct extent_buffer *buf,
-                 u32 *nr_extents)
+/* when a block goes through cow, we update the reference counts of
+ * everything that block points to.  The internal pointers of the block
+ * can be in just about any order, and it is likely to have clusters of
+ * things that are close together and clusters of things that are not.
+ *
+ * To help reduce the seeks that come with updating all of these reference
+ * counts, sort them by byte number before actual updates are done.
+ *
+ * struct refsort is used to match byte number to slot in the btree block.
+ * we sort based on the byte number and then use the slot to actually
+ * find the item.
+ *
+ * struct refsort is smaller than strcut btrfs_item and smaller than
+ * struct btrfs_key_ptr.  Since we're currently limited to the page size
+ * for a btree block, there's no way for a kmalloc of refsorts for a
+ * single node to be bigger than a page.
+ */
+struct refsort {
+       u64 bytenr;
+       u32 slot;
+};
+
+/*
+ * for passing into sort()
+ */
+static int refsort_cmp(const void *a_void, const void *b_void)
+{
+       const struct refsort *a = a_void;
+       const struct refsort *b = b_void;
+
+       if (a->bytenr < b->bytenr)
+               return -1;
+       if (a->bytenr > b->bytenr)
+               return 1;
+       return 0;
+}
+
+
+noinline int btrfs_inc_ref(struct btrfs_trans_handle *trans,
+                          struct btrfs_root *root,
+                          struct extent_buffer *orig_buf,
+                          struct extent_buffer *buf, u32 *nr_extents)
 {
        u64 bytenr;
        u64 ref_root;
        u64 orig_root;
        u64 ref_generation;
        u64 orig_generation;
+       struct refsort *sorted;
        u32 nritems;
        u32 nr_file_extents = 0;
        struct btrfs_key key;
@@ -1542,6 +1596,8 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
        int level;
        int ret = 0;
        int faili = 0;
+       int refi = 0;
+       int slot;
        int (*process_func)(struct btrfs_trans_handle *, struct btrfs_root *,
                            u64, u64, u64, u64, u64, u64, u64, u64);
 
@@ -1553,6 +1609,9 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
        nritems = btrfs_header_nritems(buf);
        level = btrfs_header_level(buf);
 
+       sorted = kmalloc(sizeof(struct refsort) * nritems, GFP_NOFS);
+       BUG_ON(!sorted);
+
        if (root->ref_cows) {
                process_func = __btrfs_inc_extent_ref;
        } else {
@@ -1565,6 +1624,11 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                process_func = __btrfs_update_extent_ref;
        }
 
+       /*
+        * we make two passes through the items.  In the first pass we
+        * only record the byte number and slot.  Then we sort based on
+        * byte number and do the actual work based on the sorted results
+        */
        for (i = 0; i < nritems; i++) {
                cond_resched();
                if (level == 0) {
@@ -1581,6 +1645,32 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                                continue;
 
                        nr_file_extents++;
+                       sorted[refi].bytenr = bytenr;
+                       sorted[refi].slot = i;
+                       refi++;
+               } else {
+                       bytenr = btrfs_node_blockptr(buf, i);
+                       sorted[refi].bytenr = bytenr;
+                       sorted[refi].slot = i;
+                       refi++;
+               }
+       }
+       /*
+        * if refi == 0, we didn't actually put anything into the sorted
+        * array and we're done
+        */
+       if (refi == 0)
+               goto out;
+
+       sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL);
+
+       for (i = 0; i < refi; i++) {
+               cond_resched();
+               slot = sorted[i].slot;
+               bytenr = sorted[i].bytenr;
+
+               if (level == 0) {
+                       btrfs_item_key_to_cpu(buf, &key, slot);
 
                        ret = process_func(trans, root, bytenr,
                                           orig_buf->start, buf->start,
@@ -1589,25 +1679,25 @@ int btrfs_inc_ref(struct btrfs_trans_handle *trans, struct btrfs_root *root,
                                           key.objectid);
 
                        if (ret) {
-                               faili = i;
+                               faili = slot;
                                WARN_ON(1);
                                goto fail;
                        }
                } else {
-                       bytenr = btrfs_node_blockptr(buf, i);
                        ret = process_func(trans, root, bytenr,
                                           orig_buf->start, buf->start,
                                           orig_root, ref_root,
                                           orig_generation, ref_generation,
                                           level - 1);
                        if (ret) {
-                               faili = i;
+                               faili = slot;
                                WARN_ON(1);
                                goto fail;
                        }
                }
        }
 out:
+       kfree(sorted);
        if (nr_extents) {
                if (level == 0)
                        *nr_extents = nr_file_extents;
@@ -1616,6 +1706,7 @@ out:
        }
        return 0;
 fail:
+       kfree(sorted);
        WARN_ON(1);
        return ret;
 }
@@ -2137,13 +2228,12 @@ static int finish_current_insert(struct btrfs_trans_handle *trans,
        u64 end;
        u64 priv;
        u64 search = 0;
-       u64 skipped = 0;
        struct btrfs_fs_info *info = extent_root->fs_info;
        struct btrfs_path *path;
        struct pending_extent_op *extent_op, *tmp;
        struct list_head insert_list, update_list;
        int ret;
-       int num_inserts = 0, max_inserts;
+       int num_inserts = 0, max_inserts, restart = 0;
 
        path = btrfs_alloc_path();
        INIT_LIST_HEAD(&insert_list);
@@ -2159,18 +2249,19 @@ again:
                ret = find_first_extent_bit(&info->extent_ins, search, &start,
                                            &end, EXTENT_WRITEBACK);
                if (ret) {
-                       if (skipped && all && !num_inserts) {
-                               skipped = 0;
+                       if (restart && !num_inserts &&
+                           list_empty(&update_list)) {
+                               restart = 0;
                                search = 0;
                                continue;
                        }
-                       mutex_unlock(&info->extent_ins_mutex);
                        break;
                }
 
                ret = try_lock_extent(&info->extent_ins, start, end, GFP_NOFS);
                if (!ret) {
-                       skipped = 1;
+                       if (all)
+                               restart = 1;
                        search = end + 1;
                        if (need_resched()) {
                                mutex_unlock(&info->extent_ins_mutex);
@@ -2189,7 +2280,7 @@ again:
                        list_add_tail(&extent_op->list, &insert_list);
                        search = end + 1;
                        if (num_inserts == max_inserts) {
-                               mutex_unlock(&info->extent_ins_mutex);
+                               restart = 1;
                                break;
                        }
                } else if (extent_op->type == PENDING_BACKREF_UPDATE) {
@@ -2205,7 +2296,6 @@ again:
         * somebody marked this thing for deletion then just unlock it and be
         * done, the free_extents will handle it
         */
-       mutex_lock(&info->extent_ins_mutex);
        list_for_each_entry_safe(extent_op, tmp, &update_list, list) {
                clear_extent_bits(&info->extent_ins, extent_op->bytenr,
                                  extent_op->bytenr + extent_op->num_bytes - 1,
@@ -2227,6 +2317,10 @@ again:
        if (!list_empty(&update_list)) {
                ret = update_backrefs(trans, extent_root, path, &update_list);
                BUG_ON(ret);
+
+               /* we may have COW'ed new blocks, so lets start over */
+               if (all)
+                       restart = 1;
        }
 
        /*
@@ -2234,9 +2328,9 @@ again:
         * need to make sure everything is cleaned then reset everything and
         * go back to the beginning
         */
-       if (!num_inserts && all && skipped) {
+       if (!num_inserts && restart) {
                search = 0;
-               skipped = 0;
+               restart = 0;
                INIT_LIST_HEAD(&update_list);
                INIT_LIST_HEAD(&insert_list);
                goto again;
@@ -2293,27 +2387,19 @@ again:
        BUG_ON(ret);
 
        /*
-        * if we broke out of the loop in order to insert stuff because we hit
-        * the maximum number of inserts at a time we can handle, then loop
-        * back and pick up where we left off
-        */
-       if (num_inserts == max_inserts) {
-               INIT_LIST_HEAD(&insert_list);
-               INIT_LIST_HEAD(&update_list);
-               num_inserts = 0;
-               goto again;
-       }
-
-       /*
-        * again, if we need to make absolutely sure there are no more pending
-        * extent operations left and we know that we skipped some, go back to
-        * the beginning and do it all again
+        * if restart is set for whatever reason we need to go back and start
+        * searching through the pending list again.
+        *
+        * We just inserted some extents, which could have resulted in new
+        * blocks being allocated, which would result in new blocks needing
+        * updates, so if all is set we _must_ restart to get the updated
+        * blocks.
         */
-       if (all && skipped) {
+       if (restart || all) {
                INIT_LIST_HEAD(&insert_list);
                INIT_LIST_HEAD(&update_list);
                search = 0;
-               skipped = 0;
+               restart = 0;
                num_inserts = 0;
                goto again;
        }
@@ -2547,6 +2633,7 @@ again:
                if (ret) {
                        if (all && skipped && !nr) {
                                search = 0;
+                               skipped = 0;
                                continue;
                        }
                        mutex_unlock(&info->extent_ins_mutex);
@@ -2633,6 +2720,8 @@ again:
                goto again;
        }
 
+       if (!err)
+               finish_current_insert(trans, extent_root, 0);
        return err;
 }
 
@@ -2700,13 +2789,9 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,
        /* if metadata always pin */
        if (owner_objectid < BTRFS_FIRST_FREE_OBJECTID) {
                if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) {
-                       struct btrfs_block_group_cache *cache;
-
-                       /* btrfs_free_reserved_extent */
-                       cache = btrfs_lookup_block_group(root->fs_info, bytenr);
-                       BUG_ON(!cache);
-                       btrfs_add_free_space(cache, bytenr, num_bytes);
-                       put_block_group(cache);
+                       mutex_lock(&root->fs_info->pinned_mutex);
+                       btrfs_update_pinned_extents(root, bytenr, num_bytes, 1);
+                       mutex_unlock(&root->fs_info->pinned_mutex);
                        update_reserved_extents(root, bytenr, num_bytes, 0);
                        return 0;
                }
@@ -2787,7 +2872,8 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
 
        if (data & BTRFS_BLOCK_GROUP_METADATA) {
                last_ptr = &root->fs_info->last_alloc;
-               empty_cluster = 64 * 1024;
+               if (!btrfs_test_opt(root, SSD))
+                       empty_cluster = 64 * 1024;
        }
 
        if ((data & BTRFS_BLOCK_GROUP_DATA) && btrfs_test_opt(root, SSD))
@@ -3014,7 +3100,6 @@ loop_check:
 static void dump_space_info(struct btrfs_space_info *info, u64 bytes)
 {
        struct btrfs_block_group_cache *cache;
-       struct list_head *l;
 
        printk(KERN_INFO "space_info has %llu free, is %sfull\n",
               (unsigned long long)(info->total_bytes - info->bytes_used -
@@ -3022,8 +3107,7 @@ static void dump_space_info(struct btrfs_space_info *info, u64 bytes)
               (info->full) ? "" : "not ");
 
        down_read(&info->groups_sem);
-       list_for_each(l, &info->block_groups) {
-               cache = list_entry(l, struct btrfs_block_group_cache, list);
+       list_for_each_entry(cache, &info->block_groups, list) {
                spin_lock(&cache->lock);
                printk(KERN_INFO "block group %llu has %llu bytes, %llu used "
                       "%llu pinned %llu reserved\n",
@@ -3332,7 +3416,8 @@ int btrfs_alloc_extent(struct btrfs_trans_handle *trans,
 
 struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
                                            struct btrfs_root *root,
-                                           u64 bytenr, u32 blocksize)
+                                           u64 bytenr, u32 blocksize,
+                                           int level)
 {
        struct extent_buffer *buf;
 
@@ -3340,9 +3425,13 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
        if (!buf)
                return ERR_PTR(-ENOMEM);
        btrfs_set_header_generation(buf, trans->transid);
+       btrfs_set_buffer_lockdep_class(buf, level);
        btrfs_tree_lock(buf);
        clean_tree_block(trans, root, buf);
+
+       btrfs_set_lock_blocking(buf);
        btrfs_set_buffer_uptodate(buf);
+
        if (root->root_key.objectid == BTRFS_TREE_LOG_OBJECTID) {
                set_extent_dirty(&root->dirty_log_pages, buf->start,
                         buf->start + buf->len - 1, GFP_NOFS);
@@ -3351,6 +3440,7 @@ struct extent_buffer *btrfs_init_new_buffer(struct btrfs_trans_handle *trans,
                         buf->start + buf->len - 1, GFP_NOFS);
        }
        trans->blocks_used++;
+       /* this returns a buffer locked for blocking */
        return buf;
 }
 
@@ -3379,7 +3469,8 @@ struct extent_buffer *btrfs_alloc_free_block(struct btrfs_trans_handle *trans,
                return ERR_PTR(ret);
        }
 
-       buf = btrfs_init_new_buffer(trans, root, ins.objectid, blocksize);
+       buf = btrfs_init_new_buffer(trans, root, ins.objectid,
+                                   blocksize, level);
        return buf;
 }
 
@@ -3388,36 +3479,73 @@ int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans,
 {
        u64 leaf_owner;
        u64 leaf_generation;
+       struct refsort *sorted;
        struct btrfs_key key;
        struct btrfs_file_extent_item *fi;
        int i;
        int nritems;
        int ret;
+       int refi = 0;
+       int slot;
 
        BUG_ON(!btrfs_is_leaf(leaf));
        nritems = btrfs_header_nritems(leaf);
        leaf_owner = btrfs_header_owner(leaf);
        leaf_generation = btrfs_header_generation(leaf);
 
+       sorted = kmalloc(sizeof(*sorted) * nritems, GFP_NOFS);
+       /* we do this loop twice.  The first time we build a list
+        * of the extents we have a reference on, then we sort the list
+        * by bytenr.  The second time around we actually do the
+        * extent freeing.
+        */
        for (i = 0; i < nritems; i++) {
                u64 disk_bytenr;
                cond_resched();
 
                btrfs_item_key_to_cpu(leaf, &key, i);
+
+               /* only extents have references, skip everything else */
                if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY)
                        continue;
+
                fi = btrfs_item_ptr(leaf, i, struct btrfs_file_extent_item);
+
+               /* inline extents live in the btree, they don't have refs */
                if (btrfs_file_extent_type(leaf, fi) ==
                    BTRFS_FILE_EXTENT_INLINE)
                        continue;
-               /*
-                * FIXME make sure to insert a trans record that
-                * repeats the snapshot del on crash
-                */
+
                disk_bytenr = btrfs_file_extent_disk_bytenr(leaf, fi);
+
+               /* holes don't have refs */
                if (disk_bytenr == 0)
                        continue;
 
+               sorted[refi].bytenr = disk_bytenr;
+               sorted[refi].slot = i;
+               refi++;
+       }
+
+       if (refi == 0)
+               goto out;
+
+       sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL);
+
+       for (i = 0; i < refi; i++) {
+               u64 disk_bytenr;
+
+               disk_bytenr = sorted[i].bytenr;
+               slot = sorted[i].slot;
+
+               cond_resched();
+
+               btrfs_item_key_to_cpu(leaf, &key, slot);
+               if (btrfs_key_type(&key) != BTRFS_EXTENT_DATA_KEY)
+                       continue;
+
+               fi = btrfs_item_ptr(leaf, slot, struct btrfs_file_extent_item);
+
                ret = __btrfs_free_extent(trans, root, disk_bytenr,
                                btrfs_file_extent_disk_num_bytes(leaf, fi),
                                leaf->start, leaf_owner, leaf_generation,
@@ -3428,6 +3556,8 @@ int btrfs_drop_leaf_ref(struct btrfs_trans_handle *trans,
                wake_up(&root->fs_info->transaction_throttle);
                cond_resched();
        }
+out:
+       kfree(sorted);
        return 0;
 }
 
@@ -3437,9 +3567,25 @@ static noinline int cache_drop_leaf_ref(struct btrfs_trans_handle *trans,
 {
        int i;
        int ret;
-       struct btrfs_extent_info *info = ref->extents;
+       struct btrfs_extent_info *info;
+       struct refsort *sorted;
+
+       if (ref->nritems == 0)
+               return 0;
+
+       sorted = kmalloc(sizeof(*sorted) * ref->nritems, GFP_NOFS);
+       for (i = 0; i < ref->nritems; i++) {
+               sorted[i].bytenr = ref->extents[i].bytenr;
+               sorted[i].slot = i;
+       }
+       sort(sorted, ref->nritems, sizeof(struct refsort), refsort_cmp, NULL);
 
+       /*
+        * the items in the ref were sorted when the ref was inserted
+        * into the ref cache, so this is already in order
+        */
        for (i = 0; i < ref->nritems; i++) {
+               info = ref->extents + sorted[i].slot;
                ret = __btrfs_free_extent(trans, root, info->bytenr,
                                          info->num_bytes, ref->bytenr,
                                          ref->owner, ref->generation,
@@ -3453,6 +3599,7 @@ static noinline int cache_drop_leaf_ref(struct btrfs_trans_handle *trans,
                info++;
        }
 
+       kfree(sorted);
        return 0;
 }
 
@@ -3496,6 +3643,152 @@ static int drop_snap_lookup_refcount(struct btrfs_root *root, u64 start,
        return ret;
 }
 
+/*
+ * this is used while deleting old snapshots, and it drops the refs
+ * on a whole subtree starting from a level 1 node.
+ *
+ * The idea is to sort all the leaf pointers, and then drop the
+ * ref on all the leaves in order.  Most of the time the leaves
+ * will have ref cache entries, so no leaf IOs will be required to
+ * find the extents they have references on.
+ *
+ * For each leaf, any references it has are also dropped in order
+ *
+ * This ends up dropping the references in something close to optimal
+ * order for reading and modifying the extent allocation tree.
+ */
+static noinline int drop_level_one_refs(struct btrfs_trans_handle *trans,
+                                       struct btrfs_root *root,
+                                       struct btrfs_path *path)
+{
+       u64 bytenr;
+       u64 root_owner;
+       u64 root_gen;
+       struct extent_buffer *eb = path->nodes[1];
+       struct extent_buffer *leaf;
+       struct btrfs_leaf_ref *ref;
+       struct refsort *sorted = NULL;
+       int nritems = btrfs_header_nritems(eb);
+       int ret;
+       int i;
+       int refi = 0;
+       int slot = path->slots[1];
+       u32 blocksize = btrfs_level_size(root, 0);
+       u32 refs;
+
+       if (nritems == 0)
+               goto out;
+
+       root_owner = btrfs_header_owner(eb);
+       root_gen = btrfs_header_generation(eb);
+       sorted = kmalloc(sizeof(*sorted) * nritems, GFP_NOFS);
+
+       /*
+        * step one, sort all the leaf pointers so we don't scribble
+        * randomly into the extent allocation tree
+        */
+       for (i = slot; i < nritems; i++) {
+               sorted[refi].bytenr = btrfs_node_blockptr(eb, i);
+               sorted[refi].slot = i;
+               refi++;
+       }
+
+       /*
+        * nritems won't be zero, but if we're picking up drop_snapshot
+        * after a crash, slot might be > 0, so double check things
+        * just in case.
+        */
+       if (refi == 0)
+               goto out;
+
+       sort(sorted, refi, sizeof(struct refsort), refsort_cmp, NULL);
+
+       /*
+        * the first loop frees everything the leaves point to
+        */
+       for (i = 0; i < refi; i++) {
+               u64 ptr_gen;
+
+               bytenr = sorted[i].bytenr;
+
+               /*
+                * check the reference count on this leaf.  If it is > 1
+                * we just decrement it below and don't update any
+                * of the refs the leaf points to.
+                */
+               ret = drop_snap_lookup_refcount(root, bytenr, blocksize, &refs);
+               BUG_ON(ret);
+               if (refs != 1)
+                       continue;
+
+               ptr_gen = btrfs_node_ptr_generation(eb, sorted[i].slot);
+
+               /*
+                * the leaf only had one reference, which means the
+                * only thing pointing to this leaf is the snapshot
+                * we're deleting.  It isn't possible for the reference
+                * count to increase again later
+                *
+                * The reference cache is checked for the leaf,
+                * and if found we'll be able to drop any refs held by
+                * the leaf without needing to read it in.
+                */
+               ref = btrfs_lookup_leaf_ref(root, bytenr);
+               if (ref && ref->generation != ptr_gen) {
+                       btrfs_free_leaf_ref(root, ref);
+                       ref = NULL;
+               }
+               if (ref) {
+                       ret = cache_drop_leaf_ref(trans, root, ref);
+                       BUG_ON(ret);
+                       btrfs_remove_leaf_ref(root, ref);
+                       btrfs_free_leaf_ref(root, ref);
+               } else {
+                       /*
+                        * the leaf wasn't in the reference cache, so
+                        * we have to read it.
+                        */
+                       leaf = read_tree_block(root, bytenr, blocksize,
+                                              ptr_gen);
+                       ret = btrfs_drop_leaf_ref(trans, root, leaf);
+                       BUG_ON(ret);
+                       free_extent_buffer(leaf);
+               }
+               atomic_inc(&root->fs_info->throttle_gen);
+               wake_up(&root->fs_info->transaction_throttle);
+               cond_resched();
+       }
+
+       /*
+        * run through the loop again to free the refs on the leaves.
+        * This is faster than doing it in the loop above because
+        * the leaves are likely to be clustered together.  We end up
+        * working in nice chunks on the extent allocation tree.
+        */
+       for (i = 0; i < refi; i++) {
+               bytenr = sorted[i].bytenr;
+               ret = __btrfs_free_extent(trans, root, bytenr,
+                                       blocksize, eb->start,
+                                       root_owner, root_gen, 0, 1);
+               BUG_ON(ret);
+
+               atomic_inc(&root->fs_info->throttle_gen);
+               wake_up(&root->fs_info->transaction_throttle);
+               cond_resched();
+       }
+out:
+       kfree(sorted);
+
+       /*
+        * update the path to show we've processed the entire level 1
+        * node.  This will get saved into the root's drop_snapshot_progress
+        * field so these drops are not repeated again if this transaction
+        * commits.
+        */
+       path->slots[1] = nritems;
+       return 0;
+}
+
 /*
  * helper function for drop_snapshot, this walks down the tree dropping ref
  * counts as it goes.
@@ -3511,7 +3804,6 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
        struct extent_buffer *next;
        struct extent_buffer *cur;
        struct extent_buffer *parent;
-       struct btrfs_leaf_ref *ref;
        u32 blocksize;
        int ret;
        u32 refs;
@@ -3538,17 +3830,46 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
                if (path->slots[*level] >=
                    btrfs_header_nritems(cur))
                        break;
+
+               /* the new code goes down to level 1 and does all the
+                * leaves pointed to that node in bulk.  So, this check
+                * for level 0 will always be false.
+                *
+                * But, the disk format allows the drop_snapshot_progress
+                * field in the root to leave things in a state where
+                * a leaf will need cleaning up here.  If someone crashes
+                * with the old code and then boots with the new code,
+                * we might find a leaf here.
+                */
                if (*level == 0) {
                        ret = btrfs_drop_leaf_ref(trans, root, cur);
                        BUG_ON(ret);
                        break;
                }
+
+               /*
+                * once we get to level one, process the whole node
+                * at once, including everything below it.
+                */
+               if (*level == 1) {
+                       ret = drop_level_one_refs(trans, root, path);
+                       BUG_ON(ret);
+                       break;
+               }
+
                bytenr = btrfs_node_blockptr(cur, path->slots[*level]);
                ptr_gen = btrfs_node_ptr_generation(cur, path->slots[*level]);
                blocksize = btrfs_level_size(root, *level - 1);
 
                ret = drop_snap_lookup_refcount(root, bytenr, blocksize, &refs);
                BUG_ON(ret);
+
+               /*
+                * if there is more than one reference, we don't need
+                * to read that node to drop any references it has.  We
+                * just drop the ref we hold on that node and move on to the
+                * next slot in this level.
+                */
                if (refs != 1) {
                        parent = path->nodes[*level];
                        root_owner = btrfs_header_owner(parent);
@@ -3567,46 +3888,12 @@ static noinline int walk_down_tree(struct btrfs_trans_handle *trans,
 
                        continue;
                }
+
                /*
-                * at this point, we have a single ref, and since the
-                * only place referencing this extent is a dead root
-                * the reference count should never go higher.
-                * So, we don't need to check it again
+                * we need to keep freeing things in the next level down.
+                * read the block and loop around to process it
                 */
-               if (*level == 1) {
-                       ref = btrfs_lookup_leaf_ref(root, bytenr);
-                       if (ref && ref->generation != ptr_gen) {
-                               btrfs_free_leaf_ref(root, ref);
-                               ref = NULL;
-                       }
-                       if (ref) {
-                               ret = cache_drop_leaf_ref(trans, root, ref);
-                               BUG_ON(ret);
-                               btrfs_remove_leaf_ref(root, ref);
-                               btrfs_free_leaf_ref(root, ref);
-                               *level = 0;
-                               break;
-                       }
-               }
-               next = btrfs_find_tree_block(root, bytenr, blocksize);
-               if (!next || !btrfs_buffer_uptodate(next, ptr_gen)) {
-                       free_extent_buffer(next);
-
-                       next = read_tree_block(root, bytenr, blocksize,
-                                              ptr_gen);
-                       cond_resched();
-#if 0
-                       /*
-                        * this is a debugging check and can go away
-                        * the ref should never go all the way down to 1
-                        * at this point
-                        */
-                       ret = lookup_extent_ref(NULL, root, bytenr, blocksize,
-                                               &refs);
-                       BUG_ON(ret);
-                       WARN_ON(refs != 1);
-#endif
-               }
+               next = read_tree_block(root, bytenr, blocksize, ptr_gen);
                WARN_ON(*level <= 0);
                if (path->nodes[*level-1])
                        free_extent_buffer(path->nodes[*level-1]);
@@ -3631,11 +3918,16 @@ out:
        root_owner = btrfs_header_owner(parent);
        root_gen = btrfs_header_generation(parent);
 
+       /*
+        * cleanup and free the reference on the last node
+        * we processed
+        */
        ret = __btrfs_free_extent(trans, root, bytenr, blocksize,
                                  parent->start, root_owner, root_gen,
                                  *level, 1);
        free_extent_buffer(path->nodes[*level]);
        path->nodes[*level] = NULL;
+
        *level += 1;
        BUG_ON(ret);
 
@@ -3687,6 +3979,7 @@ static noinline int walk_down_subtree(struct btrfs_trans_handle *trans,
 
                next = read_tree_block(root, bytenr, blocksize, ptr_gen);
                btrfs_tree_lock(next);
+               btrfs_set_lock_blocking(next);
 
                ret = btrfs_lookup_extent_ref(trans, root, bytenr, blocksize,
                                              &refs);
@@ -3754,6 +4047,13 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans,
                if (slot < btrfs_header_nritems(path->nodes[i]) - 1) {
                        struct extent_buffer *node;
                        struct btrfs_disk_key disk_key;
+
+                       /*
+                        * there is more work to do in this level.
+                        * Update the drop_progress marker to reflect
+                        * the work we've done so far, and then bump
+                        * the slot number
+                        */
                        node = path->nodes[i];
                        path->slots[i]++;
                        *level = i;
@@ -3765,6 +4065,11 @@ static noinline int walk_up_tree(struct btrfs_trans_handle *trans,
                        return 0;
                } else {
                        struct extent_buffer *parent;
+
+                       /*
+                        * this whole node is done, free our reference
+                        * on it and go up one level
+                        */
                        if (path->nodes[*level] == root->node)
                                parent = path->nodes[*level];
                        else
@@ -4444,7 +4749,7 @@ static noinline int replace_one_extent(struct btrfs_trans_handle *trans,
        u64 lock_end = 0;
        u64 num_bytes;
        u64 ext_offset;
-       u64 first_pos;
+       u64 search_end = (u64)-1;
        u32 nritems;
        int nr_scaned = 0;
        int extent_locked = 0;
@@ -4452,7 +4757,6 @@ static noinline int replace_one_extent(struct btrfs_trans_handle *trans,
        int ret;
 
        memcpy(&key, leaf_key, sizeof(key));
-       first_pos = INT_LIMIT(loff_t) - extent_key->offset;
        if (ref_path->owner_objectid != BTRFS_MULTIPLE_OBJECTIDS) {
                if (key.objectid < ref_path->owner_objectid ||
                    (key.objectid == ref_path->owner_objectid &&
@@ -4501,7 +4805,7 @@ next:
                        if ((key.objectid > ref_path->owner_objectid) ||
                            (key.objectid == ref_path->owner_objectid &&
                             key.type > BTRFS_EXTENT_DATA_KEY) ||
-                           (key.offset >= first_pos + extent_key->offset))
+                           key.offset >= search_end)
                                break;
                }
 
@@ -4534,8 +4838,10 @@ next:
                num_bytes = btrfs_file_extent_num_bytes(leaf, fi);
                ext_offset = btrfs_file_extent_offset(leaf, fi);
 
-               if (first_pos > key.offset - ext_offset)
-                       first_pos = key.offset - ext_offset;
+               if (search_end == (u64)-1) {
+                       search_end = key.offset - ext_offset +
+                               btrfs_file_extent_ram_bytes(leaf, fi);
+               }
 
                if (!extent_locked) {
                        lock_start = key.offset;
@@ -4724,7 +5030,7 @@ next:
                }
 skip:
                if (ref_path->owner_objectid != BTRFS_MULTIPLE_OBJECTIDS &&
-                   key.offset >= first_pos + extent_key->offset)
+                   key.offset >= search_end)
                        break;
 
                cond_resched();
@@ -4778,6 +5084,7 @@ int btrfs_reloc_tree_cache_ref(struct btrfs_trans_handle *trans,
                ref->bytenr = buf->start;
                ref->owner = btrfs_header_owner(buf);
                ref->generation = btrfs_header_generation(buf);
+
                ret = btrfs_add_leaf_ref(root, ref, 0);
                WARN_ON(ret);
                btrfs_free_leaf_ref(root, ref);
@@ -5351,7 +5658,9 @@ static noinline int relocate_one_extent(struct btrfs_root *extent_root,
                        prev_block = block_start;
                }
 
+               mutex_lock(&extent_root->fs_info->trans_mutex);
                btrfs_record_root_in_trans(found_root);
+               mutex_unlock(&extent_root->fs_info->trans_mutex);
                if (ref_path->owner_objectid >= BTRFS_FIRST_FREE_OBJECTID) {
                        /*
                         * try to update data extent references while
@@ -5957,9 +6266,11 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,
        path = btrfs_alloc_path();
        BUG_ON(!path);
 
-       btrfs_remove_free_space_cache(block_group);
+       spin_lock(&root->fs_info->block_group_cache_lock);
        rb_erase(&block_group->cache_node,
                 &root->fs_info->block_group_cache_tree);
+       spin_unlock(&root->fs_info->block_group_cache_lock);
+       btrfs_remove_free_space_cache(block_group);
        down_write(&block_group->space_info->groups_sem);
        list_del(&block_group->list);
        up_write(&block_group->space_info->groups_sem);
index e086d407f1fa8b3ad34b2c6770721e8592ca9cc1..ebe6b29e60698156250708766c70bb74b903bfb6 100644 (file)
@@ -9,7 +9,6 @@
 #include <linux/spinlock.h>
 #include <linux/blkdev.h>
 #include <linux/swap.h>
-#include <linux/version.h>
 #include <linux/writeback.h>
 #include <linux/pagevec.h>
 #include "extent_io.h"
@@ -31,7 +30,7 @@ static LIST_HEAD(buffers);
 static LIST_HEAD(states);
 
 #define LEAK_DEBUG 0
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
 static DEFINE_SPINLOCK(leak_lock);
 #endif
 
@@ -120,7 +119,7 @@ void extent_io_tree_init(struct extent_io_tree *tree,
 static struct extent_state *alloc_extent_state(gfp_t mask)
 {
        struct extent_state *state;
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
        unsigned long flags;
 #endif
 
@@ -130,7 +129,7 @@ static struct extent_state *alloc_extent_state(gfp_t mask)
        state->state = 0;
        state->private = 0;
        state->tree = NULL;
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
        spin_lock_irqsave(&leak_lock, flags);
        list_add(&state->leak_list, &states);
        spin_unlock_irqrestore(&leak_lock, flags);
@@ -145,11 +144,11 @@ static void free_extent_state(struct extent_state *state)
        if (!state)
                return;
        if (atomic_dec_and_test(&state->refs)) {
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
                unsigned long flags;
 #endif
                WARN_ON(state->tree);
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
                spin_lock_irqsave(&leak_lock, flags);
                list_del(&state->leak_list);
                spin_unlock_irqrestore(&leak_lock, flags);
@@ -416,8 +415,6 @@ static int split_state(struct extent_io_tree *tree, struct extent_state *orig,
 
        node = tree_insert(&tree->state, prealloc->end, &prealloc->rb_node);
        if (node) {
-               struct extent_state *found;
-               found = rb_entry(node, struct extent_state, rb_node);
                free_extent_state(prealloc);
                return -EEXIST;
        }
@@ -2378,11 +2375,6 @@ static int extent_write_cache_pages(struct extent_io_tree *tree,
        int scanned = 0;
        int range_whole = 0;
 
-       if (wbc->nonblocking && bdi_write_congested(bdi)) {
-               wbc->encountered_congestion = 1;
-               return 0;
-       }
-
        pagevec_init(&pvec, 0);
        if (wbc->range_cyclic) {
                index = mapping->writeback_index; /* Start from prev offset */
@@ -2855,6 +2847,98 @@ out:
        return sector;
 }
 
+int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+               __u64 start, __u64 len, get_extent_t *get_extent)
+{
+       int ret;
+       u64 off = start;
+       u64 max = start + len;
+       u32 flags = 0;
+       u64 disko = 0;
+       struct extent_map *em = NULL;
+       int end = 0;
+       u64 em_start = 0, em_len = 0;
+       unsigned long emflags;
+       ret = 0;
+
+       if (len == 0)
+               return -EINVAL;
+
+       lock_extent(&BTRFS_I(inode)->io_tree, start, start + len,
+               GFP_NOFS);
+       em = get_extent(inode, NULL, 0, off, max - off, 0);
+       if (!em)
+               goto out;
+       if (IS_ERR(em)) {
+               ret = PTR_ERR(em);
+               goto out;
+       }
+       while (!end) {
+               off = em->start + em->len;
+               if (off >= max)
+                       end = 1;
+
+               em_start = em->start;
+               em_len = em->len;
+
+               disko = 0;
+               flags = 0;
+
+               switch (em->block_start) {
+               case EXTENT_MAP_LAST_BYTE:
+                       end = 1;
+                       flags |= FIEMAP_EXTENT_LAST;
+                       break;
+               case EXTENT_MAP_HOLE:
+                       flags |= FIEMAP_EXTENT_UNWRITTEN;
+                       break;
+               case EXTENT_MAP_INLINE:
+                       flags |= (FIEMAP_EXTENT_DATA_INLINE |
+                                 FIEMAP_EXTENT_NOT_ALIGNED);
+                       break;
+               case EXTENT_MAP_DELALLOC:
+                       flags |= (FIEMAP_EXTENT_DELALLOC |
+                                 FIEMAP_EXTENT_UNKNOWN);
+                       break;
+               default:
+                       disko = em->block_start;
+                       break;
+               }
+               if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags))
+                       flags |= FIEMAP_EXTENT_ENCODED;
+
+               emflags = em->flags;
+               free_extent_map(em);
+               em = NULL;
+
+               if (!end) {
+                       em = get_extent(inode, NULL, 0, off, max - off, 0);
+                       if (!em)
+                               goto out;
+                       if (IS_ERR(em)) {
+                               ret = PTR_ERR(em);
+                               goto out;
+                       }
+                       emflags = em->flags;
+               }
+               if (test_bit(EXTENT_FLAG_VACANCY, &emflags)) {
+                       flags |= FIEMAP_EXTENT_LAST;
+                       end = 1;
+               }
+
+               ret = fiemap_fill_next_extent(fieinfo, em_start, disko,
+                                       em_len, flags);
+               if (ret)
+                       goto out_free;
+       }
+out_free:
+       free_extent_map(em);
+out:
+       unlock_extent(&BTRFS_I(inode)->io_tree, start, start + len,
+                       GFP_NOFS);
+       return ret;
+}
+
 static inline struct page *extent_buffer_page(struct extent_buffer *eb,
                                              unsigned long i)
 {
@@ -2892,15 +2976,17 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree,
                                                   gfp_t mask)
 {
        struct extent_buffer *eb = NULL;
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
        unsigned long flags;
 #endif
 
        eb = kmem_cache_zalloc(extent_buffer_cache, mask);
        eb->start = start;
        eb->len = len;
-       mutex_init(&eb->mutex);
-#ifdef LEAK_DEBUG
+       spin_lock_init(&eb->lock);
+       init_waitqueue_head(&eb->lock_wq);
+
+#if LEAK_DEBUG
        spin_lock_irqsave(&leak_lock, flags);
        list_add(&eb->leak_list, &buffers);
        spin_unlock_irqrestore(&leak_lock, flags);
@@ -2912,7 +2998,7 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree,
 
 static void __free_extent_buffer(struct extent_buffer *eb)
 {
-#ifdef LEAK_DEBUG
+#if LEAK_DEBUG
        unsigned long flags;
        spin_lock_irqsave(&leak_lock, flags);
        list_del(&eb->leak_list);
@@ -2980,8 +3066,7 @@ struct extent_buffer *alloc_extent_buffer(struct extent_io_tree *tree,
                unlock_page(p);
        }
        if (uptodate)
-               eb->flags |= EXTENT_UPTODATE;
-       eb->flags |= EXTENT_BUFFER_FILLED;
+               set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
 
        spin_lock(&tree->buffer_lock);
        exists = buffer_tree_insert(tree, start, &eb->rb_node);
@@ -3135,7 +3220,7 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
        unsigned long num_pages;
 
        num_pages = num_extent_pages(eb->start, eb->len);
-       eb->flags &= ~EXTENT_UPTODATE;
+       clear_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
 
        clear_extent_uptodate(tree, eb->start, eb->start + eb->len - 1,
                              GFP_NOFS);
@@ -3206,7 +3291,7 @@ int extent_buffer_uptodate(struct extent_io_tree *tree,
        struct page *page;
        int pg_uptodate = 1;
 
-       if (eb->flags & EXTENT_UPTODATE)
+       if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
                return 1;
 
        ret = test_range_bit(tree, eb->start, eb->start + eb->len - 1,
@@ -3242,7 +3327,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
        struct bio *bio = NULL;
        unsigned long bio_flags = 0;
 
-       if (eb->flags & EXTENT_UPTODATE)
+       if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
                return 0;
 
        if (test_range_bit(tree, eb->start, eb->start + eb->len - 1,
@@ -3273,7 +3358,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
        }
        if (all_uptodate) {
                if (start_i == 0)
-                       eb->flags |= EXTENT_UPTODATE;
+                       set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
                goto unlock_exit;
        }
 
@@ -3309,7 +3394,7 @@ int read_extent_buffer_pages(struct extent_io_tree *tree,
        }
 
        if (!ret)
-               eb->flags |= EXTENT_UPTODATE;
+               set_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags);
        return ret;
 
 unlock_exit:
@@ -3406,7 +3491,6 @@ int map_extent_buffer(struct extent_buffer *eb, unsigned long start,
                unmap_extent_buffer(eb, eb->map_token, km);
                eb->map_token = NULL;
                save = 1;
-               WARN_ON(!mutex_is_locked(&eb->mutex));
        }
        err = map_private_extent_buffer(eb, start, min_len, token, map,
                                       map_start, map_len, km);
index c5b483a791372c6b9a849b36c41e8e3dcf6437ac..1f9df88afbf6922e9f4af87972f05521ed15e862 100644 (file)
 /* flags for bio submission */
 #define EXTENT_BIO_COMPRESSED 1
 
+/* these are bit numbers for test/set bit */
+#define EXTENT_BUFFER_UPTODATE 0
+#define EXTENT_BUFFER_BLOCKING 1
+
 /*
  * page->private values.  Every page that is controlled by the extent
  * map has page->private set to one.
@@ -95,11 +99,19 @@ struct extent_buffer {
        unsigned long map_start;
        unsigned long map_len;
        struct page *first_page;
+       unsigned long bflags;
        atomic_t refs;
-       int flags;
        struct list_head leak_list;
        struct rb_node rb_node;
-       struct mutex mutex;
+
+       /* the spinlock is used to protect most operations */
+       spinlock_t lock;
+
+       /*
+        * when we keep the lock held while blocking, waiters go onto
+        * the wq
+        */
+       wait_queue_head_t lock_wq;
 };
 
 struct extent_map_tree;
@@ -193,6 +205,8 @@ int extent_commit_write(struct extent_io_tree *tree,
                        unsigned from, unsigned to);
 sector_t extent_bmap(struct address_space *mapping, sector_t iblock,
                get_extent_t *get_extent);
+int extent_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+               __u64 start, __u64 len, get_extent_t *get_extent);
 int set_range_dirty(struct extent_io_tree *tree, u64 start, u64 end);
 int set_state_private(struct extent_io_tree *tree, u64 start, u64 private);
 int get_state_private(struct extent_io_tree *tree, u64 start, u64 *private);
index 4a83e33ada32548c1970adceab67590b1747c60d..50da69da20cec141fca63ffba2a4e92b8f93f875 100644 (file)
@@ -3,7 +3,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
-#include <linux/version.h>
 #include <linux/hardirq.h>
 #include "extent_map.h"
 
index 90268334145e30e4abe0390333b98678bf47db29..872f104576e580699985fec78c19a1421b1aa46d 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/writeback.h>
 #include <linux/statfs.h>
 #include <linux/compat.h>
-#include <linux/version.h>
 #include "ctree.h"
 #include "disk-io.h"
 #include "transaction.h"
@@ -1215,15 +1214,15 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
        }
        mutex_unlock(&root->fs_info->trans_mutex);
 
-       root->fs_info->tree_log_batch++;
+       root->log_batch++;
        filemap_fdatawrite(inode->i_mapping);
        btrfs_wait_ordered_range(inode, 0, (u64)-1);
-       root->fs_info->tree_log_batch++;
+       root->log_batch++;
 
        /*
         * ok we haven't committed the transaction yet, lets do a commit
         */
-       if (file->private_data)
+       if (file && file->private_data)
                btrfs_ioctl_trans_end(file);
 
        trans = btrfs_start_transaction(root, 1);
@@ -1232,7 +1231,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
                goto out;
        }
 
-       ret = btrfs_log_dentry_safe(trans, root, file->f_dentry);
+       ret = btrfs_log_dentry_safe(trans, root, dentry);
        if (ret < 0)
                goto out;
 
@@ -1246,7 +1245,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
         * file again, but that will end up using the synchronization
         * inside btrfs_sync_log to keep things safe.
         */
-       mutex_unlock(&file->f_dentry->d_inode->i_mutex);
+       mutex_unlock(&dentry->d_inode->i_mutex);
 
        if (ret > 0) {
                ret = btrfs_commit_transaction(trans, root);
@@ -1254,7 +1253,7 @@ int btrfs_sync_file(struct file *file, struct dentry *dentry, int datasync)
                btrfs_sync_log(trans, root);
                ret = btrfs_end_transaction(trans, root);
        }
-       mutex_lock(&file->f_dentry->d_inode->i_mutex);
+       mutex_lock(&dentry->d_inode->i_mutex);
 out:
        return ret > 0 ? EIO : ret;
 }
index 2aa79873eb46a46baa00503d6682de1861db7c45..cc7334d833c9d27f4a139b6b96232e959f1458a5 100644 (file)
@@ -84,7 +84,6 @@ int btrfs_find_free_objectid(struct btrfs_trans_handle *trans,
        search_key.type = 0;
        search_key.offset = 0;
 
-       btrfs_init_path(path);
        start_found = 0;
        ret = btrfs_search_slot(trans, root, &search_key, path, 0, 0);
        if (ret < 0)
index 8adfe059ab4153f911da295a9673009965039bc2..3cee77ae03c81e0fe8340ceedb268ca96c2a1521 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/statfs.h>
 #include <linux/compat.h>
 #include <linux/bit_spinlock.h>
-#include <linux/version.h>
 #include <linux/xattr.h>
 #include <linux/posix_acl.h>
 #include <linux/falloc.h>
@@ -51,6 +50,7 @@
 #include "tree-log.h"
 #include "ref-cache.h"
 #include "compression.h"
+#include "locking.h"
 
 struct btrfs_iget_args {
        u64 ino;
@@ -91,6 +91,16 @@ static noinline int cow_file_range(struct inode *inode,
                                   u64 start, u64 end, int *page_started,
                                   unsigned long *nr_written, int unlock);
 
+static int btrfs_init_inode_security(struct inode *inode,  struct inode *dir)
+{
+       int err;
+
+       err = btrfs_init_acl(inode, dir);
+       if (!err)
+               err = btrfs_xattr_security_init(inode, dir);
+       return err;
+}
+
 /*
  * a very lame attempt at stopping writes when the FS is 85% full.  There
  * are countless ways this is incorrect, but it is better than nothing.
@@ -350,6 +360,19 @@ again:
        nr_pages = (end >> PAGE_CACHE_SHIFT) - (start >> PAGE_CACHE_SHIFT) + 1;
        nr_pages = min(nr_pages, (128 * 1024UL) / PAGE_CACHE_SIZE);
 
+       /*
+        * we don't want to send crud past the end of i_size through
+        * compression, that's just a waste of CPU time.  So, if the
+        * end of the file is before the start of our current
+        * requested range of bytes, we bail out to the uncompressed
+        * cleanup code that can deal with all of this.
+        *
+        * It isn't really the fastest way to fix things, but this is a
+        * very uncommon corner.
+        */
+       if (actual_end <= start)
+               goto cleanup_and_bail_uncompressed;
+
        total_compressed = actual_end - start;
 
        /* we want to make sure that amount of ram required to uncompress
@@ -494,6 +517,7 @@ again:
                        goto again;
                }
        } else {
+cleanup_and_bail_uncompressed:
                /*
                 * No compression, but we still need to write the pages in
                 * the file we've been given so far.  redirty the locked
@@ -1324,12 +1348,11 @@ static noinline int add_pending_csums(struct btrfs_trans_handle *trans,
                             struct inode *inode, u64 file_offset,
                             struct list_head *list)
 {
-       struct list_head *cur;
        struct btrfs_ordered_sum *sum;
 
        btrfs_set_trans_block_group(trans, inode);
-       list_for_each(cur, list) {
-               sum = list_entry(cur, struct btrfs_ordered_sum, list);
+
+       list_for_each_entry(sum, list, list) {
                btrfs_csum_file_blocks(trans,
                       BTRFS_I(inode)->root->fs_info->csum_root, sum);
        }
@@ -2013,6 +2036,7 @@ void btrfs_read_locked_inode(struct inode *inode)
        BTRFS_I(inode)->flags = btrfs_inode_flags(leaf, inode_item);
 
        alloc_group_block = btrfs_inode_block_group(leaf, inode_item);
+
        BTRFS_I(inode)->block_group = btrfs_find_block_group(root, 0,
                                                alloc_group_block, 0);
        btrfs_free_path(path);
@@ -2039,6 +2063,7 @@ void btrfs_read_locked_inode(struct inode *inode)
                inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
                break;
        default:
+               inode->i_op = &btrfs_special_inode_operations;
                init_special_inode(inode, inode->i_mode, rdev);
                break;
        }
@@ -2108,6 +2133,7 @@ noinline int btrfs_update_inode(struct btrfs_trans_handle *trans,
                goto failed;
        }
 
+       btrfs_unlock_up_safe(path, 1);
        leaf = path->nodes[0];
        inode_item = btrfs_item_ptr(leaf, path->slots[0],
                                  struct btrfs_inode_item);
@@ -2429,6 +2455,8 @@ next_node:
                        ref->generation = leaf_gen;
                        ref->nritems = 0;
 
+                       btrfs_sort_leaf_ref(ref);
+
                        ret = btrfs_add_leaf_ref(root, ref, 0);
                        WARN_ON(ret);
                        btrfs_free_leaf_ref(root, ref);
@@ -2476,7 +2504,7 @@ noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
        struct btrfs_path *path;
        struct btrfs_key key;
        struct btrfs_key found_key;
-       u32 found_type;
+       u32 found_type = (u8)-1;
        struct extent_buffer *leaf;
        struct btrfs_file_extent_item *fi;
        u64 extent_start = 0;
@@ -2503,8 +2531,6 @@ noinline int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
        key.offset = (u64)-1;
        key.type = (u8)-1;
 
-       btrfs_init_path(path);
-
 search_again:
        ret = btrfs_search_slot(trans, root, &key, path, -1, 1);
        if (ret < 0)
@@ -2663,6 +2689,8 @@ next:
                        if (pending_del_nr)
                                goto del_pending;
                        btrfs_release_path(root, path);
+                       if (found_type == BTRFS_INODE_ITEM_KEY)
+                               break;
                        goto search_again;
                }
 
@@ -2679,6 +2707,8 @@ del_pending:
                        BUG_ON(ret);
                        pending_del_nr = 0;
                        btrfs_release_path(root, path);
+                       if (found_type == BTRFS_INODE_ITEM_KEY)
+                               break;
                        goto search_again;
                }
        }
@@ -3265,7 +3295,7 @@ skip:
 
        /* Reached end of directory/root. Bump pos past the last item. */
        if (key_type == BTRFS_DIR_INDEX_KEY)
-               filp->f_pos = INT_LIMIT(typeof(filp->f_pos));
+               filp->f_pos = INT_LIMIT(off_t);
        else
                filp->f_pos++;
 nopos:
@@ -3458,7 +3488,14 @@ static struct inode *btrfs_new_inode(struct btrfs_trans_handle *trans,
                root->highest_inode = objectid;
 
        inode->i_uid = current_fsuid();
-       inode->i_gid = current_fsgid();
+
+       if (dir && (dir->i_mode & S_ISGID)) {
+               inode->i_gid = dir->i_gid;
+               if (S_ISDIR(mode))
+                       mode |= S_ISGID;
+       } else
+               inode->i_gid = current_fsgid();
+
        inode->i_mode = mode;
        inode->i_ino = objectid;
        inode_set_bytes(inode, 0);
@@ -3586,7 +3623,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
        if (IS_ERR(inode))
                goto out_unlock;
 
-       err = btrfs_init_acl(inode, dir);
+       err = btrfs_init_inode_security(inode, dir);
        if (err) {
                drop_inode = 1;
                goto out_unlock;
@@ -3649,7 +3686,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
        if (IS_ERR(inode))
                goto out_unlock;
 
-       err = btrfs_init_acl(inode, dir);
+       err = btrfs_init_inode_security(inode, dir);
        if (err) {
                drop_inode = 1;
                goto out_unlock;
@@ -3772,7 +3809,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
 
        drop_on_err = 1;
 
-       err = btrfs_init_acl(inode, dir);
+       err = btrfs_init_inode_security(inode, dir);
        if (err)
                goto out_fail;
 
@@ -4158,9 +4195,10 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
        return -EINVAL;
 }
 
-static sector_t btrfs_bmap(struct address_space *mapping, sector_t iblock)
+static int btrfs_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo,
+               __u64 start, __u64 len)
 {
-       return extent_bmap(mapping, iblock, btrfs_get_extent);
+       return extent_fiemap(inode, fieinfo, start, len, btrfs_get_extent);
 }
 
 int btrfs_readpage(struct file *file, struct page *page)
@@ -4223,7 +4261,7 @@ static int btrfs_releasepage(struct page *page, gfp_t gfp_flags)
 {
        if (PageWriteback(page) || PageDirty(page))
                return 0;
-       return __btrfs_releasepage(page, gfp_flags);
+       return __btrfs_releasepage(page, gfp_flags & GFP_NOFS);
 }
 
 static void btrfs_invalidatepage(struct page *page, unsigned long offset)
@@ -4733,7 +4771,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
        if (IS_ERR(inode))
                goto out_unlock;
 
-       err = btrfs_init_acl(inode, dir);
+       err = btrfs_init_inode_security(inode, dir);
        if (err) {
                drop_inode = 1;
                goto out_unlock;
@@ -4987,13 +5025,24 @@ static struct extent_io_ops btrfs_extent_io_ops = {
        .clear_bit_hook = btrfs_clear_bit_hook,
 };
 
+/*
+ * btrfs doesn't support the bmap operation because swapfiles
+ * use bmap to make a mapping of extents in the file.  They assume
+ * these extents won't change over the life of the file and they
+ * use the bmap result to do IO directly to the drive.
+ *
+ * the btrfs bmap call would return logical addresses that aren't
+ * suitable for IO and they also will change frequently as COW
+ * operations happen.  So, swapfile + btrfs == corruption.
+ *
+ * For now we're avoiding this by dropping bmap.
+ */
 static struct address_space_operations btrfs_aops = {
        .readpage       = btrfs_readpage,
        .writepage      = btrfs_writepage,
        .writepages     = btrfs_writepages,
        .readpages      = btrfs_readpages,
        .sync_page      = block_sync_page,
-       .bmap           = btrfs_bmap,
        .direct_IO      = btrfs_direct_IO,
        .invalidatepage = btrfs_invalidatepage,
        .releasepage    = btrfs_releasepage,
@@ -5017,6 +5066,7 @@ static struct inode_operations btrfs_file_inode_operations = {
        .removexattr    = btrfs_removexattr,
        .permission     = btrfs_permission,
        .fallocate      = btrfs_fallocate,
+       .fiemap         = btrfs_fiemap,
 };
 static struct inode_operations btrfs_special_inode_operations = {
        .getattr        = btrfs_getattr,
@@ -5032,4 +5082,8 @@ static struct inode_operations btrfs_symlink_inode_operations = {
        .follow_link    = page_follow_link_light,
        .put_link       = page_put_link,
        .permission     = btrfs_permission,
+       .setxattr       = btrfs_setxattr,
+       .getxattr       = btrfs_getxattr,
+       .listxattr      = btrfs_listxattr,
+       .removexattr    = btrfs_removexattr,
 };
index c2aa33e3feb5b40f251fcdedae4aed93b3745fc2..988fdc8b49ebb92b7ad7d5d9163f3fc23e866d16 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/compat.h>
 #include <linux/bit_spinlock.h>
 #include <linux/security.h>
-#include <linux/version.h>
 #include <linux/xattr.h>
 #include <linux/vmalloc.h>
 #include "compat.h"
index 39bae7761db6c20ae87686a70d383a12c6285ee6..85506c4a3af7406c248b575149863ccdb8eb88f0 100644 (file)
 #include "extent_io.h"
 #include "locking.h"
 
+static inline void spin_nested(struct extent_buffer *eb)
+{
+       spin_lock(&eb->lock);
+}
+
 /*
- * locks the per buffer mutex in an extent buffer.  This uses adaptive locks
- * and the spin is not tuned very extensively.  The spinning does make a big
- * difference in almost every workload, but spinning for the right amount of
- * time needs some help.
- *
- * In general, we want to spin as long as the lock holder is doing btree
- * searches, and we should give up if they are in more expensive code.
+ * Setting a lock to blocking will drop the spinlock and set the
+ * flag that forces other procs who want the lock to wait.  After
+ * this you can safely schedule with the lock held.
  */
+void btrfs_set_lock_blocking(struct extent_buffer *eb)
+{
+       if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) {
+               set_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags);
+               spin_unlock(&eb->lock);
+       }
+       /* exit with the spin lock released and the bit set */
+}
 
-int btrfs_tree_lock(struct extent_buffer *eb)
+/*
+ * clearing the blocking flag will take the spinlock again.
+ * After this you can't safely schedule
+ */
+void btrfs_clear_lock_blocking(struct extent_buffer *eb)
 {
-       int i;
+       if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) {
+               spin_nested(eb);
+               clear_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags);
+               smp_mb__after_clear_bit();
+       }
+       /* exit with the spin lock held */
+}
 
-       if (mutex_trylock(&eb->mutex))
-               return 0;
+/*
+ * unfortunately, many of the places that currently set a lock to blocking
+ * don't end up blocking for every long, and often they don't block
+ * at all.  For a dbench 50 run, if we don't spin one the blocking bit
+ * at all, the context switch rate can jump up to 400,000/sec or more.
+ *
+ * So, we're still stuck with this crummy spin on the blocking bit,
+ * at least until the most common causes of the short blocks
+ * can be dealt with.
+ */
+static int btrfs_spin_on_block(struct extent_buffer *eb)
+{
+       int i;
        for (i = 0; i < 512; i++) {
                cpu_relax();
-               if (mutex_trylock(&eb->mutex))
-                       return 0;
+               if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+                       return 1;
+               if (need_resched())
+                       break;
        }
-       cpu_relax();
-       mutex_lock_nested(&eb->mutex, BTRFS_MAX_LEVEL - btrfs_header_level(eb));
        return 0;
 }
 
-int btrfs_try_tree_lock(struct extent_buffer *eb)
+/*
+ * This is somewhat different from trylock.  It will take the
+ * spinlock but if it finds the lock is set to blocking, it will
+ * return without the lock held.
+ *
+ * returns 1 if it was able to take the lock and zero otherwise
+ *
+ * After this call, scheduling is not safe without first calling
+ * btrfs_set_lock_blocking()
+ */
+int btrfs_try_spin_lock(struct extent_buffer *eb)
 {
-       return mutex_trylock(&eb->mutex);
+       int i;
+
+       spin_nested(eb);
+       if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+               return 1;
+       spin_unlock(&eb->lock);
+
+       /* spin for a bit on the BLOCKING flag */
+       for (i = 0; i < 2; i++) {
+               if (!btrfs_spin_on_block(eb))
+                       break;
+
+               spin_nested(eb);
+               if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+                       return 1;
+               spin_unlock(&eb->lock);
+       }
+       return 0;
 }
 
-int btrfs_tree_unlock(struct extent_buffer *eb)
+/*
+ * the autoremove wake function will return 0 if it tried to wake up
+ * a process that was already awake, which means that process won't
+ * count as an exclusive wakeup.  The waitq code will continue waking
+ * procs until it finds one that was actually sleeping.
+ *
+ * For btrfs, this isn't quite what we want.  We want a single proc
+ * to be notified that the lock is ready for taking.  If that proc
+ * already happen to be awake, great, it will loop around and try for
+ * the lock.
+ *
+ * So, btrfs_wake_function always returns 1, even when the proc that we
+ * tried to wake up was already awake.
+ */
+static int btrfs_wake_function(wait_queue_t *wait, unsigned mode,
+                              int sync, void *key)
 {
-       mutex_unlock(&eb->mutex);
-       return 0;
+       autoremove_wake_function(wait, mode, sync, key);
+       return 1;
 }
 
-int btrfs_tree_locked(struct extent_buffer *eb)
+/*
+ * returns with the extent buffer spinlocked.
+ *
+ * This will spin and/or wait as required to take the lock, and then
+ * return with the spinlock held.
+ *
+ * After this call, scheduling is not safe without first calling
+ * btrfs_set_lock_blocking()
+ */
+int btrfs_tree_lock(struct extent_buffer *eb)
 {
-       return mutex_is_locked(&eb->mutex);
+       DEFINE_WAIT(wait);
+       wait.func = btrfs_wake_function;
+
+       while(1) {
+               spin_nested(eb);
+
+               /* nobody is blocking, exit with the spinlock held */
+               if (!test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+                       return 0;
+
+               /*
+                * we have the spinlock, but the real owner is blocking.
+                * wait for them
+                */
+               spin_unlock(&eb->lock);
+
+               /*
+                * spin for a bit, and if the blocking flag goes away,
+                * loop around
+                */
+               if (btrfs_spin_on_block(eb))
+                       continue;
+
+               prepare_to_wait_exclusive(&eb->lock_wq, &wait,
+                                         TASK_UNINTERRUPTIBLE);
+
+               if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+                       schedule();
+
+               finish_wait(&eb->lock_wq, &wait);
+       }
+       return 0;
 }
 
 /*
- * btrfs_search_slot uses this to decide if it should drop its locks
- * before doing something expensive like allocating free blocks for cow.
+ * Very quick trylock, this does not spin or schedule.  It returns
+ * 1 with the spinlock held if it was able to take the lock, or it
+ * returns zero if it was unable to take the lock.
+ *
+ * After this call, scheduling is not safe without first calling
+ * btrfs_set_lock_blocking()
  */
-int btrfs_path_lock_waiting(struct btrfs_path *path, int level)
+int btrfs_try_tree_lock(struct extent_buffer *eb)
 {
-       int i;
-       struct extent_buffer *eb;
-       for (i = level; i <= level + 1 && i < BTRFS_MAX_LEVEL; i++) {
-               eb = path->nodes[i];
-               if (!eb)
-                       break;
-               smp_mb();
-               if (!list_empty(&eb->mutex.wait_list))
-                       return 1;
+       if (spin_trylock(&eb->lock)) {
+               if (test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags)) {
+                       /*
+                        * we've got the spinlock, but the real owner is
+                        * blocking.  Drop the spinlock and return failure
+                        */
+                       spin_unlock(&eb->lock);
+                       return 0;
+               }
+               return 1;
        }
+       /* someone else has the spinlock giveup */
        return 0;
 }
 
+int btrfs_tree_unlock(struct extent_buffer *eb)
+{
+       /*
+        * if we were a blocking owner, we don't have the spinlock held
+        * just clear the bit and look for waiters
+        */
+       if (test_and_clear_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags))
+               smp_mb__after_clear_bit();
+       else
+               spin_unlock(&eb->lock);
+
+       if (waitqueue_active(&eb->lock_wq))
+               wake_up(&eb->lock_wq);
+       return 0;
+}
+
+int btrfs_tree_locked(struct extent_buffer *eb)
+{
+       return test_bit(EXTENT_BUFFER_BLOCKING, &eb->bflags) ||
+                       spin_is_locked(&eb->lock);
+}
index bc1faef12519451294e361becacbd9f404ac0afd..6bb0afbff9287d4e841748f02d60eae488d7de7c 100644 (file)
 int btrfs_tree_lock(struct extent_buffer *eb);
 int btrfs_tree_unlock(struct extent_buffer *eb);
 int btrfs_tree_locked(struct extent_buffer *eb);
+
 int btrfs_try_tree_lock(struct extent_buffer *eb);
-int btrfs_path_lock_waiting(struct btrfs_path *path, int level);
+int btrfs_try_spin_lock(struct extent_buffer *eb);
+
+void btrfs_set_lock_blocking(struct extent_buffer *eb);
+void btrfs_clear_lock_blocking(struct extent_buffer *eb);
 #endif
index a2094017027489a16473e03db2cddaad41c048cc..77c2411a5f0f0c59b6ab97e78b2828d94a1c7401 100644 (file)
@@ -613,7 +613,6 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
        struct btrfs_sector_sum *sector_sums;
        struct btrfs_ordered_extent *ordered;
        struct btrfs_ordered_inode_tree *tree = &BTRFS_I(inode)->ordered_tree;
-       struct list_head *cur;
        unsigned long num_sectors;
        unsigned long i;
        u32 sectorsize = BTRFS_I(inode)->root->sectorsize;
@@ -624,8 +623,7 @@ int btrfs_find_ordered_sum(struct inode *inode, u64 offset, u64 disk_bytenr,
                return 1;
 
        mutex_lock(&tree->mutex);
-       list_for_each_prev(cur, &ordered->list) {
-               ordered_sum = list_entry(cur, struct btrfs_ordered_sum, list);
+       list_for_each_entry_reverse(ordered_sum, &ordered->list, list) {
                if (disk_bytenr >= ordered_sum->bytenr) {
                        num_sectors = ordered_sum->len / sectorsize;
                        sector_sums = ordered_sum->sums;
index 6f0acc4c9eab7675dd9cacc0804bc530f3db46d3..d0cc62bccb948e776fb9845c7da1a8f2119788f6 100644 (file)
@@ -17,6 +17,7 @@
  */
 
 #include <linux/sched.h>
+#include <linux/sort.h>
 #include "ctree.h"
 #include "ref-cache.h"
 #include "transaction.h"
index 16f3183d7c59058909707d72ad16315d091bc098..bc283ad2db7364b112824ab08f44e58e37fc18cf 100644 (file)
@@ -73,5 +73,4 @@ int btrfs_add_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref,
 int btrfs_remove_leaf_refs(struct btrfs_root *root, u64 max_root_gen,
                           int shared);
 int btrfs_remove_leaf_ref(struct btrfs_root *root, struct btrfs_leaf_ref *ref);
-
 #endif
index db9fb3bc1e333c5255a92537a9891d4f8716f899..19a4daf03ccb6d7d8730d4d8c9602a24dc0c370b 100644 (file)
@@ -37,7 +37,6 @@
 #include <linux/ctype.h>
 #include <linux/namei.h>
 #include <linux/miscdevice.h>
-#include <linux/version.h>
 #include <linux/magic.h>
 #include "compat.h"
 #include "ctree.h"
@@ -380,7 +379,6 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
        btrfs_start_delalloc_inodes(root);
        btrfs_wait_ordered_extents(root, 0);
 
-       btrfs_clean_old_snapshots(root);
        trans = btrfs_start_transaction(root, 1);
        ret = btrfs_commit_transaction(trans, root);
        sb->s_dirt = 0;
@@ -512,6 +510,10 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
        struct btrfs_root *root = btrfs_sb(sb);
        int ret;
 
+       ret = btrfs_parse_options(root, data);
+       if (ret)
+               return -EINVAL;
+
        if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
                return 0;
 
@@ -583,17 +585,18 @@ static long btrfs_control_ioctl(struct file *file, unsigned int cmd,
        struct btrfs_ioctl_vol_args *vol;
        struct btrfs_fs_devices *fs_devices;
        int ret = -ENOTTY;
-       int len;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
 
        vol = kmalloc(sizeof(*vol), GFP_KERNEL);
+       if (!vol)
+               return -ENOMEM;
+
        if (copy_from_user(vol, (void __user *)arg, sizeof(*vol))) {
                ret = -EFAULT;
                goto out;
        }
-       len = strnlen(vol->name, BTRFS_PATH_NAME_MAX);
 
        switch (cmd) {
        case BTRFS_IOC_SCAN_DEV:
index 8a08f94433407e6c8ca7ce2e15285ef75115bb26..4112d53d4f4dad195636c6ffa93deaded831af6e 100644 (file)
@@ -688,7 +688,9 @@ static noinline int drop_dirty_roots(struct btrfs_root *tree_root,
                num_bytes -= btrfs_root_used(&dirty->root->root_item);
                bytes_used = btrfs_root_used(&root->root_item);
                if (num_bytes) {
+                       mutex_lock(&root->fs_info->trans_mutex);
                        btrfs_record_root_in_trans(root);
+                       mutex_unlock(&root->fs_info->trans_mutex);
                        btrfs_set_root_used(&root->root_item,
                                            bytes_used - num_bytes);
                }
@@ -852,11 +854,9 @@ static noinline int create_pending_snapshots(struct btrfs_trans_handle *trans,
 {
        struct btrfs_pending_snapshot *pending;
        struct list_head *head = &trans->transaction->pending_snapshots;
-       struct list_head *cur;
        int ret;
 
-       list_for_each(cur, head) {
-               pending = list_entry(cur, struct btrfs_pending_snapshot, list);
+       list_for_each_entry(pending, head, list) {
                ret = create_pending_snapshot(trans, fs_info, pending);
                BUG_ON(ret);
        }
index 3e8358c36165ece2969b28348c2286b1b609dcbf..98d25fa4570ea902abc4c8345ecf29f62af9013c 100644 (file)
@@ -74,6 +74,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans,
                u32 nritems;
 
                root_node = btrfs_lock_root_node(root);
+               btrfs_set_lock_blocking(root_node);
                nritems = btrfs_header_nritems(root_node);
                root->defrag_max.objectid = 0;
                /* from above we know this is not a leaf */
index d81cda2e077c9b3c4685d26a55057826d0c06b2d..9c462fbd60fac14ad17f192afb08c37794295d36 100644 (file)
@@ -77,104 +77,6 @@ static int link_to_fixup_dir(struct btrfs_trans_handle *trans,
  * and once to do all the other items.
  */
 
-/*
- * btrfs_add_log_tree adds a new per-subvolume log tree into the
- * tree of log tree roots.  This must be called with a tree log transaction
- * running (see start_log_trans).
- */
-static int btrfs_add_log_tree(struct btrfs_trans_handle *trans,
-                     struct btrfs_root *root)
-{
-       struct btrfs_key key;
-       struct btrfs_root_item root_item;
-       struct btrfs_inode_item *inode_item;
-       struct extent_buffer *leaf;
-       struct btrfs_root *new_root = root;
-       int ret;
-       u64 objectid = root->root_key.objectid;
-
-       leaf = btrfs_alloc_free_block(trans, root, root->leafsize, 0,
-                                     BTRFS_TREE_LOG_OBJECTID,
-                                     trans->transid, 0, 0, 0);
-       if (IS_ERR(leaf)) {
-               ret = PTR_ERR(leaf);
-               return ret;
-       }
-
-       btrfs_set_header_nritems(leaf, 0);
-       btrfs_set_header_level(leaf, 0);
-       btrfs_set_header_bytenr(leaf, leaf->start);
-       btrfs_set_header_generation(leaf, trans->transid);
-       btrfs_set_header_owner(leaf, BTRFS_TREE_LOG_OBJECTID);
-
-       write_extent_buffer(leaf, root->fs_info->fsid,
-                           (unsigned long)btrfs_header_fsid(leaf),
-                           BTRFS_FSID_SIZE);
-       btrfs_mark_buffer_dirty(leaf);
-
-       inode_item = &root_item.inode;
-       memset(inode_item, 0, sizeof(*inode_item));
-       inode_item->generation = cpu_to_le64(1);
-       inode_item->size = cpu_to_le64(3);
-       inode_item->nlink = cpu_to_le32(1);
-       inode_item->nbytes = cpu_to_le64(root->leafsize);
-       inode_item->mode = cpu_to_le32(S_IFDIR | 0755);
-
-       btrfs_set_root_bytenr(&root_item, leaf->start);
-       btrfs_set_root_generation(&root_item, trans->transid);
-       btrfs_set_root_level(&root_item, 0);
-       btrfs_set_root_refs(&root_item, 0);
-       btrfs_set_root_used(&root_item, 0);
-
-       memset(&root_item.drop_progress, 0, sizeof(root_item.drop_progress));
-       root_item.drop_level = 0;
-
-       btrfs_tree_unlock(leaf);
-       free_extent_buffer(leaf);
-       leaf = NULL;
-
-       btrfs_set_root_dirid(&root_item, 0);
-
-       key.objectid = BTRFS_TREE_LOG_OBJECTID;
-       key.offset = objectid;
-       btrfs_set_key_type(&key, BTRFS_ROOT_ITEM_KEY);
-       ret = btrfs_insert_root(trans, root->fs_info->log_root_tree, &key,
-                               &root_item);
-       if (ret)
-               goto fail;
-
-       new_root = btrfs_read_fs_root_no_radix(root->fs_info->log_root_tree,
-                                              &key);
-       BUG_ON(!new_root);
-
-       WARN_ON(root->log_root);
-       root->log_root = new_root;
-
-       /*
-        * log trees do not get reference counted because they go away
-        * before a real commit is actually done.  They do store pointers
-        * to file data extents, and those reference counts still get
-        * updated (along with back refs to the log tree).
-        */
-       new_root->ref_cows = 0;
-       new_root->last_trans = trans->transid;
-
-       /*
-        * we need to make sure the root block for this new tree
-        * is marked as dirty in the dirty_log_pages tree.  This
-        * is how it gets flushed down to disk at tree log commit time.
-        *
-        * the tree logging mutex keeps others from coming in and changing
-        * the new_root->node, so we can safely access it here
-        */
-       set_extent_dirty(&new_root->dirty_log_pages, new_root->node->start,
-                        new_root->node->start + new_root->node->len - 1,
-                        GFP_NOFS);
-
-fail:
-       return ret;
-}
-
 /*
  * start a sub transaction and setup the log tree
  * this increments the log tree writer count to make the people
@@ -184,6 +86,14 @@ static int start_log_trans(struct btrfs_trans_handle *trans,
                           struct btrfs_root *root)
 {
        int ret;
+
+       mutex_lock(&root->log_mutex);
+       if (root->log_root) {
+               root->log_batch++;
+               atomic_inc(&root->log_writers);
+               mutex_unlock(&root->log_mutex);
+               return 0;
+       }
        mutex_lock(&root->fs_info->tree_log_mutex);
        if (!root->fs_info->log_root_tree) {
                ret = btrfs_init_log_root_tree(trans, root->fs_info);
@@ -193,9 +103,10 @@ static int start_log_trans(struct btrfs_trans_handle *trans,
                ret = btrfs_add_log_tree(trans, root);
                BUG_ON(ret);
        }
-       atomic_inc(&root->fs_info->tree_log_writers);
-       root->fs_info->tree_log_batch++;
        mutex_unlock(&root->fs_info->tree_log_mutex);
+       root->log_batch++;
+       atomic_inc(&root->log_writers);
+       mutex_unlock(&root->log_mutex);
        return 0;
 }
 
@@ -212,13 +123,12 @@ static int join_running_log_trans(struct btrfs_root *root)
        if (!root->log_root)
                return -ENOENT;
 
-       mutex_lock(&root->fs_info->tree_log_mutex);
+       mutex_lock(&root->log_mutex);
        if (root->log_root) {
                ret = 0;
-               atomic_inc(&root->fs_info->tree_log_writers);
-               root->fs_info->tree_log_batch++;
+               atomic_inc(&root->log_writers);
        }
-       mutex_unlock(&root->fs_info->tree_log_mutex);
+       mutex_unlock(&root->log_mutex);
        return ret;
 }
 
@@ -228,10 +138,11 @@ static int join_running_log_trans(struct btrfs_root *root)
  */
 static int end_log_trans(struct btrfs_root *root)
 {
-       atomic_dec(&root->fs_info->tree_log_writers);
-       smp_mb();
-       if (waitqueue_active(&root->fs_info->tree_log_wait))
-               wake_up(&root->fs_info->tree_log_wait);
+       if (atomic_dec_and_test(&root->log_writers)) {
+               smp_mb();
+               if (waitqueue_active(&root->log_writer_wait))
+                       wake_up(&root->log_writer_wait);
+       }
        return 0;
 }
 
@@ -1704,6 +1615,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
 
                                btrfs_tree_lock(next);
                                clean_tree_block(trans, root, next);
+                               btrfs_set_lock_blocking(next);
                                btrfs_wait_tree_block_writeback(next);
                                btrfs_tree_unlock(next);
 
@@ -1750,6 +1662,7 @@ static noinline int walk_down_log_tree(struct btrfs_trans_handle *trans,
                next = path->nodes[*level];
                btrfs_tree_lock(next);
                clean_tree_block(trans, root, next);
+               btrfs_set_lock_blocking(next);
                btrfs_wait_tree_block_writeback(next);
                btrfs_tree_unlock(next);
 
@@ -1807,6 +1720,7 @@ static noinline int walk_up_log_tree(struct btrfs_trans_handle *trans,
 
                                btrfs_tree_lock(next);
                                clean_tree_block(trans, root, next);
+                               btrfs_set_lock_blocking(next);
                                btrfs_wait_tree_block_writeback(next);
                                btrfs_tree_unlock(next);
 
@@ -1879,6 +1793,7 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
 
                        btrfs_tree_lock(next);
                        clean_tree_block(trans, log, next);
+                       btrfs_set_lock_blocking(next);
                        btrfs_wait_tree_block_writeback(next);
                        btrfs_tree_unlock(next);
 
@@ -1902,26 +1817,65 @@ static int walk_log_tree(struct btrfs_trans_handle *trans,
                }
        }
        btrfs_free_path(path);
-       if (wc->free)
-               free_extent_buffer(log->node);
        return ret;
 }
 
-static int wait_log_commit(struct btrfs_root *log)
+/*
+ * helper function to update the item for a given subvolumes log root
+ * in the tree of log roots
+ */
+static int update_log_root(struct btrfs_trans_handle *trans,
+                          struct btrfs_root *log)
+{
+       int ret;
+
+       if (log->log_transid == 1) {
+               /* insert root item on the first sync */
+               ret = btrfs_insert_root(trans, log->fs_info->log_root_tree,
+                               &log->root_key, &log->root_item);
+       } else {
+               ret = btrfs_update_root(trans, log->fs_info->log_root_tree,
+                               &log->root_key, &log->root_item);
+       }
+       return ret;
+}
+
+static int wait_log_commit(struct btrfs_root *root, unsigned long transid)
 {
        DEFINE_WAIT(wait);
-       u64 transid = log->fs_info->tree_log_transid;
+       int index = transid % 2;
 
+       /*
+        * we only allow two pending log transactions at a time,
+        * so we know that if ours is more than 2 older than the
+        * current transaction, we're done
+        */
        do {
-               prepare_to_wait(&log->fs_info->tree_log_wait, &wait,
-                               TASK_UNINTERRUPTIBLE);
-               mutex_unlock(&log->fs_info->tree_log_mutex);
-               if (atomic_read(&log->fs_info->tree_log_commit))
+               prepare_to_wait(&root->log_commit_wait[index],
+                               &wait, TASK_UNINTERRUPTIBLE);
+               mutex_unlock(&root->log_mutex);
+               if (root->log_transid < transid + 2 &&
+                   atomic_read(&root->log_commit[index]))
                        schedule();
-               finish_wait(&log->fs_info->tree_log_wait, &wait);
-               mutex_lock(&log->fs_info->tree_log_mutex);
-       } while (transid == log->fs_info->tree_log_transid &&
-               atomic_read(&log->fs_info->tree_log_commit));
+               finish_wait(&root->log_commit_wait[index], &wait);
+               mutex_lock(&root->log_mutex);
+       } while (root->log_transid < transid + 2 &&
+                atomic_read(&root->log_commit[index]));
+       return 0;
+}
+
+static int wait_for_writer(struct btrfs_root *root)
+{
+       DEFINE_WAIT(wait);
+       while (atomic_read(&root->log_writers)) {
+               prepare_to_wait(&root->log_writer_wait,
+                               &wait, TASK_UNINTERRUPTIBLE);
+               mutex_unlock(&root->log_mutex);
+               if (atomic_read(&root->log_writers))
+                       schedule();
+               mutex_lock(&root->log_mutex);
+               finish_wait(&root->log_writer_wait, &wait);
+       }
        return 0;
 }
 
@@ -1933,57 +1887,114 @@ static int wait_log_commit(struct btrfs_root *log)
 int btrfs_sync_log(struct btrfs_trans_handle *trans,
                   struct btrfs_root *root)
 {
+       int index1;
+       int index2;
        int ret;
-       unsigned long batch;
        struct btrfs_root *log = root->log_root;
+       struct btrfs_root *log_root_tree = root->fs_info->log_root_tree;
 
-       mutex_lock(&log->fs_info->tree_log_mutex);
-       if (atomic_read(&log->fs_info->tree_log_commit)) {
-               wait_log_commit(log);
-               goto out;
+       mutex_lock(&root->log_mutex);
+       index1 = root->log_transid % 2;
+       if (atomic_read(&root->log_commit[index1])) {
+               wait_log_commit(root, root->log_transid);
+               mutex_unlock(&root->log_mutex);
+               return 0;
        }
-       atomic_set(&log->fs_info->tree_log_commit, 1);
+       atomic_set(&root->log_commit[index1], 1);
+
+       /* wait for previous tree log sync to complete */
+       if (atomic_read(&root->log_commit[(index1 + 1) % 2]))
+               wait_log_commit(root, root->log_transid - 1);
 
        while (1) {
-               batch = log->fs_info->tree_log_batch;
-               mutex_unlock(&log->fs_info->tree_log_mutex);
+               unsigned long batch = root->log_batch;
+               mutex_unlock(&root->log_mutex);
                schedule_timeout_uninterruptible(1);
-               mutex_lock(&log->fs_info->tree_log_mutex);
-
-               while (atomic_read(&log->fs_info->tree_log_writers)) {
-                       DEFINE_WAIT(wait);
-                       prepare_to_wait(&log->fs_info->tree_log_wait, &wait,
-                                       TASK_UNINTERRUPTIBLE);
-                       mutex_unlock(&log->fs_info->tree_log_mutex);
-                       if (atomic_read(&log->fs_info->tree_log_writers))
-                               schedule();
-                       mutex_lock(&log->fs_info->tree_log_mutex);
-                       finish_wait(&log->fs_info->tree_log_wait, &wait);
-               }
-               if (batch == log->fs_info->tree_log_batch)
+               mutex_lock(&root->log_mutex);
+               wait_for_writer(root);
+               if (batch == root->log_batch)
                        break;
        }
 
        ret = btrfs_write_and_wait_marked_extents(log, &log->dirty_log_pages);
        BUG_ON(ret);
-       ret = btrfs_write_and_wait_marked_extents(root->fs_info->log_root_tree,
-                              &root->fs_info->log_root_tree->dirty_log_pages);
+
+       btrfs_set_root_bytenr(&log->root_item, log->node->start);
+       btrfs_set_root_generation(&log->root_item, trans->transid);
+       btrfs_set_root_level(&log->root_item, btrfs_header_level(log->node));
+
+       root->log_batch = 0;
+       root->log_transid++;
+       log->log_transid = root->log_transid;
+       smp_mb();
+       /*
+        * log tree has been flushed to disk, new modifications of
+        * the log will be written to new positions. so it's safe to
+        * allow log writers to go in.
+        */
+       mutex_unlock(&root->log_mutex);
+
+       mutex_lock(&log_root_tree->log_mutex);
+       log_root_tree->log_batch++;
+       atomic_inc(&log_root_tree->log_writers);
+       mutex_unlock(&log_root_tree->log_mutex);
+
+       ret = update_log_root(trans, log);
+       BUG_ON(ret);
+
+       mutex_lock(&log_root_tree->log_mutex);
+       if (atomic_dec_and_test(&log_root_tree->log_writers)) {
+               smp_mb();
+               if (waitqueue_active(&log_root_tree->log_writer_wait))
+                       wake_up(&log_root_tree->log_writer_wait);
+       }
+
+       index2 = log_root_tree->log_transid % 2;
+       if (atomic_read(&log_root_tree->log_commit[index2])) {
+               wait_log_commit(log_root_tree, log_root_tree->log_transid);
+               mutex_unlock(&log_root_tree->log_mutex);
+               goto out;
+       }
+       atomic_set(&log_root_tree->log_commit[index2], 1);
+
+       if (atomic_read(&log_root_tree->log_commit[(index2 + 1) % 2]))
+               wait_log_commit(log_root_tree, log_root_tree->log_transid - 1);
+
+       wait_for_writer(log_root_tree);
+
+       ret = btrfs_write_and_wait_marked_extents(log_root_tree,
+                               &log_root_tree->dirty_log_pages);
        BUG_ON(ret);
 
        btrfs_set_super_log_root(&root->fs_info->super_for_commit,
-                                log->fs_info->log_root_tree->node->start);
+                               log_root_tree->node->start);
        btrfs_set_super_log_root_level(&root->fs_info->super_for_commit,
-                      btrfs_header_level(log->fs_info->log_root_tree->node));
+                               btrfs_header_level(log_root_tree->node));
+
+       log_root_tree->log_batch = 0;
+       log_root_tree->log_transid++;
+       smp_mb();
+
+       mutex_unlock(&log_root_tree->log_mutex);
+
+       /*
+        * nobody else is going to jump in and write the the ctree
+        * super here because the log_commit atomic below is protecting
+        * us.  We must be called with a transaction handle pinning
+        * the running transaction open, so a full commit can't hop
+        * in and cause problems either.
+        */
+       write_ctree_super(trans, root->fs_info->tree_root, 2);
 
-       write_ctree_super(trans, log->fs_info->tree_root, 2);
-       log->fs_info->tree_log_transid++;
-       log->fs_info->tree_log_batch = 0;
-       atomic_set(&log->fs_info->tree_log_commit, 0);
+       atomic_set(&log_root_tree->log_commit[index2], 0);
        smp_mb();
-       if (waitqueue_active(&log->fs_info->tree_log_wait))
-               wake_up(&log->fs_info->tree_log_wait);
+       if (waitqueue_active(&log_root_tree->log_commit_wait[index2]))
+               wake_up(&log_root_tree->log_commit_wait[index2]);
 out:
-       mutex_unlock(&log->fs_info->tree_log_mutex);
+       atomic_set(&root->log_commit[index1], 0);
+       smp_mb();
+       if (waitqueue_active(&root->log_commit_wait[index1]))
+               wake_up(&root->log_commit_wait[index1]);
        return 0;
 }
 
@@ -2019,37 +2030,17 @@ int btrfs_free_log(struct btrfs_trans_handle *trans, struct btrfs_root *root)
                                   start, end, GFP_NOFS);
        }
 
-       log = root->log_root;
-       ret = btrfs_del_root(trans, root->fs_info->log_root_tree,
-                            &log->root_key);
-       BUG_ON(ret);
+       if (log->log_transid > 0) {
+               ret = btrfs_del_root(trans, root->fs_info->log_root_tree,
+                                    &log->root_key);
+               BUG_ON(ret);
+       }
        root->log_root = NULL;
-       kfree(root->log_root);
+       free_extent_buffer(log->node);
+       kfree(log);
        return 0;
 }
 
-/*
- * helper function to update the item for a given subvolumes log root
- * in the tree of log roots
- */
-static int update_log_root(struct btrfs_trans_handle *trans,
-                          struct btrfs_root *log)
-{
-       u64 bytenr = btrfs_root_bytenr(&log->root_item);
-       int ret;
-
-       if (log->node->start == bytenr)
-               return 0;
-
-       btrfs_set_root_bytenr(&log->root_item, log->node->start);
-       btrfs_set_root_generation(&log->root_item, trans->transid);
-       btrfs_set_root_level(&log->root_item, btrfs_header_level(log->node));
-       ret = btrfs_update_root(trans, log->fs_info->log_root_tree,
-                               &log->root_key, &log->root_item);
-       BUG_ON(ret);
-       return ret;
-}
-
 /*
  * If both a file and directory are logged, and unlinks or renames are
  * mixed in, we have a few interesting corners:
@@ -2711,11 +2702,6 @@ next_slot:
 
        btrfs_free_path(path);
        btrfs_free_path(dst_path);
-
-       mutex_lock(&root->fs_info->tree_log_mutex);
-       ret = update_log_root(trans, log);
-       BUG_ON(ret);
-       mutex_unlock(&root->fs_info->tree_log_mutex);
 out:
        return 0;
 }
@@ -2846,7 +2832,9 @@ again:
                BUG_ON(!wc.replay_dest);
 
                wc.replay_dest->log_root = log;
+               mutex_lock(&fs_info->trans_mutex);
                btrfs_record_root_in_trans(wc.replay_dest);
+               mutex_unlock(&fs_info->trans_mutex);
                ret = walk_log_tree(trans, log, &wc);
                BUG_ON(ret);
 
index 3451e1cca2b5c77ccdfdc3f5cab713f4a02721d2..1316139bf9e8209750ba671edd042df4976307ab 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/buffer_head.h>
 #include <linux/blkdev.h>
 #include <linux/random.h>
-#include <linux/version.h>
 #include <asm/div64.h>
 #include "compat.h"
 #include "ctree.h"
@@ -104,10 +103,8 @@ static noinline struct btrfs_device *__find_device(struct list_head *head,
                                                   u64 devid, u8 *uuid)
 {
        struct btrfs_device *dev;
-       struct list_head *cur;
 
-       list_for_each(cur, head) {
-               dev = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(dev, head, dev_list) {
                if (dev->devid == devid &&
                    (!uuid || !memcmp(dev->uuid, uuid, BTRFS_UUID_SIZE))) {
                        return dev;
@@ -118,11 +115,9 @@ static noinline struct btrfs_device *__find_device(struct list_head *head,
 
 static noinline struct btrfs_fs_devices *find_fsid(u8 *fsid)
 {
-       struct list_head *cur;
        struct btrfs_fs_devices *fs_devices;
 
-       list_for_each(cur, &fs_uuids) {
-               fs_devices = list_entry(cur, struct btrfs_fs_devices, list);
+       list_for_each_entry(fs_devices, &fs_uuids, list) {
                if (memcmp(fsid, fs_devices->fsid, BTRFS_FSID_SIZE) == 0)
                        return fs_devices;
        }
@@ -159,6 +154,7 @@ static noinline int run_scheduled_bios(struct btrfs_device *device)
 loop:
        spin_lock(&device->io_lock);
 
+loop_lock:
        /* take all the bios off the list at once and process them
         * later on (without the lock held).  But, remember the
         * tail and other pointers so the bios can be properly reinserted
@@ -208,7 +204,7 @@ loop:
                 * is now congested.  Back off and let other work structs
                 * run instead
                 */
-               if (pending && bdi_write_congested(bdi) &&
+               if (pending && bdi_write_congested(bdi) && num_run > 16 &&
                    fs_info->fs_devices->open_devices > 1) {
                        struct bio *old_head;
 
@@ -220,7 +216,8 @@ loop:
                                tail->bi_next = old_head;
                        else
                                device->pending_bio_tail = tail;
-                       device->running_pending = 0;
+
+                       device->running_pending = 1;
 
                        spin_unlock(&device->io_lock);
                        btrfs_requeue_work(&device->work);
@@ -229,6 +226,11 @@ loop:
        }
        if (again)
                goto loop;
+
+       spin_lock(&device->io_lock);
+       if (device->pending_bios)
+               goto loop_lock;
+       spin_unlock(&device->io_lock);
 done:
        return 0;
 }
@@ -345,14 +347,11 @@ error:
 
 int btrfs_close_extra_devices(struct btrfs_fs_devices *fs_devices)
 {
-       struct list_head *tmp;
-       struct list_head *cur;
-       struct btrfs_device *device;
+       struct btrfs_device *device, *next;
 
        mutex_lock(&uuid_mutex);
 again:
-       list_for_each_safe(cur, tmp, &fs_devices->devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry_safe(device, next, &fs_devices->devices, dev_list) {
                if (device->in_fs_metadata)
                        continue;
 
@@ -383,14 +382,12 @@ again:
 
 static int __btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
 {
-       struct list_head *cur;
        struct btrfs_device *device;
 
        if (--fs_devices->opened > 0)
                return 0;
 
-       list_for_each(cur, &fs_devices->devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, &fs_devices->devices, dev_list) {
                if (device->bdev) {
                        close_bdev_exclusive(device->bdev, device->mode);
                        fs_devices->open_devices--;
@@ -439,7 +436,6 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
 {
        struct block_device *bdev;
        struct list_head *head = &fs_devices->devices;
-       struct list_head *cur;
        struct btrfs_device *device;
        struct block_device *latest_bdev = NULL;
        struct buffer_head *bh;
@@ -450,8 +446,7 @@ static int __btrfs_open_devices(struct btrfs_fs_devices *fs_devices,
        int seeding = 1;
        int ret = 0;
 
-       list_for_each(cur, head) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, head, dev_list) {
                if (device->bdev)
                        continue;
                if (!device->name)
@@ -578,7 +573,7 @@ int btrfs_scan_one_device(const char *path, fmode_t flags, void *holder,
                       *(unsigned long long *)disk_super->fsid,
                       *(unsigned long long *)(disk_super->fsid + 8));
        }
-       printk(KERN_INFO "devid %llu transid %llu %s\n",
+       printk(KERN_CONT "devid %llu transid %llu %s\n",
               (unsigned long long)devid, (unsigned long long)transid, path);
        ret = device_list_add(path, disk_super, devid, fs_devices_ret);
 
@@ -1017,14 +1012,12 @@ int btrfs_rm_device(struct btrfs_root *root, char *device_path)
        }
 
        if (strcmp(device_path, "missing") == 0) {
-               struct list_head *cur;
                struct list_head *devices;
                struct btrfs_device *tmp;
 
                device = NULL;
                devices = &root->fs_info->fs_devices->devices;
-               list_for_each(cur, devices) {
-                       tmp = list_entry(cur, struct btrfs_device, dev_list);
+               list_for_each_entry(tmp, devices, dev_list) {
                        if (tmp->in_fs_metadata && !tmp->bdev) {
                                device = tmp;
                                break;
@@ -1280,7 +1273,6 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
        struct btrfs_trans_handle *trans;
        struct btrfs_device *device;
        struct block_device *bdev;
-       struct list_head *cur;
        struct list_head *devices;
        struct super_block *sb = root->fs_info->sb;
        u64 total_bytes;
@@ -1304,8 +1296,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path)
        mutex_lock(&root->fs_info->volume_mutex);
 
        devices = &root->fs_info->fs_devices->devices;
-       list_for_each(cur, devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, devices, dev_list) {
                if (device->bdev == bdev) {
                        ret = -EEXIST;
                        goto error;
@@ -1704,7 +1695,6 @@ static u64 div_factor(u64 num, int factor)
 int btrfs_balance(struct btrfs_root *dev_root)
 {
        int ret;
-       struct list_head *cur;
        struct list_head *devices = &dev_root->fs_info->fs_devices->devices;
        struct btrfs_device *device;
        u64 old_size;
@@ -1723,8 +1713,7 @@ int btrfs_balance(struct btrfs_root *dev_root)
        dev_root = dev_root->fs_info->dev_root;
 
        /* step one make some room on all the devices */
-       list_for_each(cur, devices) {
-               device = list_entry(cur, struct btrfs_device, dev_list);
+       list_for_each_entry(device, devices, dev_list) {
                old_size = device->total_bytes;
                size_to_free = div_factor(old_size, 1);
                size_to_free = min(size_to_free, (u64)1 * 1024 * 1024);
@@ -2905,10 +2894,6 @@ static int read_one_chunk(struct btrfs_root *root, struct btrfs_key *key,
                free_extent_map(em);
        }
 
-       map = kzalloc(sizeof(*map), GFP_NOFS);
-       if (!map)
-               return -ENOMEM;
-
        em = alloc_extent_map(GFP_NOFS);
        if (!em)
                return -ENOMEM;
@@ -3117,6 +3102,8 @@ int btrfs_read_sys_array(struct btrfs_root *root)
        if (!sb)
                return -ENOMEM;
        btrfs_set_buffer_uptodate(sb);
+       btrfs_set_buffer_lockdep_class(sb, 0);
+
        write_extent_buffer(sb, super_copy, 0, BTRFS_SUPER_INFO_SIZE);
        array_size = btrfs_super_sys_array_size(super_copy);
 
index 7f332e2708942f95968f07d49279fc08f43e59b2..a9d3bf4d2689a5924f1de8765bc38e3c5481c215 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/slab.h>
 #include <linux/rwsem.h>
 #include <linux/xattr.h>
+#include <linux/security.h>
 #include "ctree.h"
 #include "btrfs_inode.h"
 #include "transaction.h"
@@ -45,9 +46,12 @@ ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
        /* lookup the xattr by name */
        di = btrfs_lookup_xattr(NULL, root, path, inode->i_ino, name,
                                strlen(name), 0);
-       if (!di || IS_ERR(di)) {
+       if (!di) {
                ret = -ENODATA;
                goto out;
+       } else if (IS_ERR(di)) {
+               ret = PTR_ERR(di);
+               goto out;
        }
 
        leaf = path->nodes[0];
@@ -62,6 +66,14 @@ ssize_t __btrfs_getxattr(struct inode *inode, const char *name,
                ret = -ERANGE;
                goto out;
        }
+
+       /*
+        * The way things are packed into the leaf is like this
+        * |struct btrfs_dir_item|name|data|
+        * where name is the xattr name, so security.foo, and data is the
+        * content of the xattr.  data_ptr points to the location in memory
+        * where the data starts in the in memory leaf
+        */
        data_ptr = (unsigned long)((char *)(di + 1) +
                                   btrfs_dir_name_len(leaf, di));
        read_extent_buffer(leaf, buffer, data_ptr,
@@ -86,7 +98,7 @@ int __btrfs_setxattr(struct inode *inode, const char *name,
        if (!path)
                return -ENOMEM;
 
-       trans = btrfs_start_transaction(root, 1);
+       trans = btrfs_join_transaction(root, 1);
        btrfs_set_trans_block_group(trans, inode);
 
        /* first lets see if we already have this xattr */
@@ -176,7 +188,6 @@ ssize_t btrfs_listxattr(struct dentry *dentry, char *buffer, size_t size)
        ret = btrfs_search_slot(NULL, root, &key, path, 0, 0);
        if (ret < 0)
                goto err;
-       ret = 0;
        advance = 0;
        while (1) {
                leaf = path->nodes[0];
@@ -320,3 +331,34 @@ int btrfs_removexattr(struct dentry *dentry, const char *name)
                return -EOPNOTSUPP;
        return __btrfs_setxattr(dentry->d_inode, name, NULL, 0, XATTR_REPLACE);
 }
+
+int btrfs_xattr_security_init(struct inode *inode, struct inode *dir)
+{
+       int err;
+       size_t len;
+       void *value;
+       char *suffix;
+       char *name;
+
+       err = security_inode_init_security(inode, dir, &suffix, &value, &len);
+       if (err) {
+               if (err == -EOPNOTSUPP)
+                       return 0;
+               return err;
+       }
+
+       name = kmalloc(XATTR_SECURITY_PREFIX_LEN + strlen(suffix) + 1,
+                      GFP_NOFS);
+       if (!name) {
+               err = -ENOMEM;
+       } else {
+               strcpy(name, XATTR_SECURITY_PREFIX);
+               strcpy(name + XATTR_SECURITY_PREFIX_LEN, suffix);
+               err = __btrfs_setxattr(inode, name, value, len, 0);
+               kfree(name);
+       }
+
+       kfree(suffix);
+       kfree(value);
+       return err;
+}
index 5b1d08f8e68dede07beb1dcc79f52dd8af9553c5..c71e9c3cf3f749e8981d19433bef8ada685383aa 100644 (file)
@@ -36,4 +36,6 @@ extern int btrfs_setxattr(struct dentry *dentry, const char *name,
                const void *value, size_t size, int flags);
 extern int btrfs_removexattr(struct dentry *dentry, const char *name);
 
+extern int btrfs_xattr_security_init(struct inode *inode, struct inode *dir);
+
 #endif /* __XATTR__ */
index b58208f1640a00eecbb0c760469a15b8fe31f6c3..9f697419ed8e34ec041c92d8f6794c8b4b06ab33 100644 (file)
@@ -777,6 +777,7 @@ static int __set_page_dirty(struct page *page,
                        __inc_zone_page_state(page, NR_FILE_DIRTY);
                        __inc_bdi_stat(mapping->backing_dev_info,
                                        BDI_RECLAIMABLE);
+                       task_dirty_inc(current);
                        task_io_account_write(PAGE_CACHE_SIZE);
                }
                radix_tree_tag_set(&mapping->page_tree,
@@ -2688,7 +2689,7 @@ int nobh_write_end(struct file *file, struct address_space *mapping,
        struct buffer_head *bh;
        BUG_ON(fsdata != NULL && page_has_buffers(page));
 
-       if (unlikely(copied < len) && !page_has_buffers(page))
+       if (unlikely(copied < len) && head)
                attach_nobh_buffers(page, head);
        if (page_has_buffers(page))
                return generic_write_end(file, mapping, pos, len,
@@ -3108,7 +3109,7 @@ int sync_dirty_buffer(struct buffer_head *bh)
        if (test_clear_buffer_dirty(bh)) {
                get_bh(bh);
                bh->b_end_io = end_buffer_write_sync;
-               ret = submit_bh(WRITE_SYNC, bh);
+               ret = submit_bh(WRITE, bh);
                wait_on_buffer(bh);
                if (buffer_eopnotsupp(bh)) {
                        clear_buffer_eopnotsupp(bh);
index 73ac7ebd1dfcc253db5a40d9aa91379764dbebdb..851388fafc7302dbae9d5b5f7f33da5101eed4cd 100644 (file)
@@ -1,3 +1,13 @@
+Version 1.57
+------------
+Improve support for multiple security contexts to the same server. We
+used to use the same "vcnumber" for all connections which could cause
+the server to treat subsequent connections, especially those that
+are authenticated as guest, as reconnections, invalidating the earlier
+user's smb session.  This fix allows cifs to mount multiple times to the
+same server with different userids without risking invalidating earlier
+established security contexts.
+
 Version 1.56
 ------------
 Add "forcemandatorylock" mount option to allow user to use mandatory
@@ -7,7 +17,10 @@ specified and user does not have access to query information about the
 top of the share.  Fix problem in 2.6.28 resolving DFS paths to
 Samba servers (worked to Windows).  Fix rmdir so that pending search
 (readdir) requests do not get invalid results which include the now
-removed directory.
+removed directory.  Fix oops in cifs_dfs_ref.c when prefixpath is not reachable
+when using DFS.  Add better file create support to servers which support
+the CIFS POSIX protocol extensions (this adds support for new flags
+on create, and improves semantics for write of locked ranges).
 
 Version 1.55
 ------------
index 7ac481841f8726a272068a730235d0cd322bc799..2b1d28a9ee287b6b998c034c403c240b101c682e 100644 (file)
@@ -100,5 +100,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
 extern const struct export_operations cifs_export_ops;
 #endif /* EXPERIMENTAL */
 
-#define CIFS_VERSION   "1.56"
+#define CIFS_VERSION   "1.57"
 #endif                         /* _CIFSFS_H */
index 94c1ca0ec9539ef1ee08ff9983e291b2c21e7449..e004f6db5fc87904e21d6ebc4eb0cb56ccc15d29 100644 (file)
@@ -164,9 +164,12 @@ struct TCP_Server_Info {
        /* multiplexed reads or writes */
        unsigned int maxBuf;    /* maxBuf specifies the maximum */
        /* message size the server can send or receive for non-raw SMBs */
-       unsigned int maxRw;     /* maxRw specifies the maximum */
+       unsigned int max_rw;    /* maxRw specifies the maximum */
        /* message size the server can send or receive for */
        /* SMB_COM_WRITE_RAW or SMB_COM_READ_RAW. */
+       unsigned int max_vcs;   /* maximum number of smb sessions, at least
+                                  those that can be specified uniquely with
+                                  vcnumbers */
        char sessid[4];         /* unique token id for this session */
        /* (returned on Negotiate */
        int capabilities; /* allow selective disabling of caps by smb sess */
@@ -210,6 +213,7 @@ struct cifsSesInfo {
        unsigned overrideSecFlg;  /* if non-zero override global sec flags */
        __u16 ipc_tid;          /* special tid for connection to IPC share */
        __u16 flags;
+       __u16 vcnum;
        char *serverOS;         /* name of operating system underlying server */
        char *serverNOS;        /* name of network operating system of server */
        char *serverDomain;     /* security realm of server */
index 382ba62988094b58ec396ae7872a104ff7a66104..083dfc57c7a3e53adf54f32e9af4c56a8c2eeb9f 100644 (file)
@@ -42,6 +42,7 @@ extern void _FreeXid(unsigned int);
 #define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__func__, xid,current_fsuid()));
 #define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__func__,curr_xid,(int)rc));}
 extern char *build_path_from_dentry(struct dentry *);
+extern char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb);
 extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
 /* extern void renew_parental_timestamps(struct dentry *direntry);*/
 extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
@@ -91,6 +92,9 @@ extern u64 cifs_UnixTimeToNT(struct timespec);
 extern __le64 cnvrtDosCifsTm(__u16 date, __u16 time);
 extern struct timespec cnvrtDosUnixTm(__u16 date, __u16 time);
 
+extern void posix_fill_in_inode(struct inode *tmp_inode,
+                               FILE_UNIX_BASIC_INFO *pData, int isNewInode);
+extern struct inode *cifs_new_inode(struct super_block *sb, __u64 *inum);
 extern int cifs_get_inode_info(struct inode **pinode,
                        const unsigned char *search_path,
                        FILE_ALL_INFO *pfile_info,
index 552642a507c4be6744e32a0738c07d27bd89a635..939e2f76b9596203ab68276a59aad6fd8c36981e 100644 (file)
@@ -528,14 +528,15 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
                server->maxReq = le16_to_cpu(rsp->MaxMpxCount);
                server->maxBuf = min((__u32)le16_to_cpu(rsp->MaxBufSize),
                                (__u32)CIFSMaxBufSize + MAX_CIFS_HDR_SIZE);
+               server->max_vcs = le16_to_cpu(rsp->MaxNumberVcs);
                GETU32(server->sessid) = le32_to_cpu(rsp->SessionKey);
                /* even though we do not use raw we might as well set this
                accurately, in case we ever find a need for it */
                if ((le16_to_cpu(rsp->RawMode) & RAW_ENABLE) == RAW_ENABLE) {
-                       server->maxRw = 0xFF00;
+                       server->max_rw = 0xFF00;
                        server->capabilities = CAP_MPX_MODE | CAP_RAW_MODE;
                } else {
-                       server->maxRw = 0;/* we do not need to use raw anyway */
+                       server->max_rw = 0;/* do not need to use raw anyway */
                        server->capabilities = CAP_MPX_MODE;
                }
                tmp = (__s16)le16_to_cpu(rsp->ServerTimeZone);
@@ -638,7 +639,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
        /* probably no need to store and check maxvcs */
        server->maxBuf = min(le32_to_cpu(pSMBr->MaxBufferSize),
                        (__u32) CIFSMaxBufSize + MAX_CIFS_HDR_SIZE);
-       server->maxRw = le32_to_cpu(pSMBr->MaxRawSize);
+       server->max_rw = le32_to_cpu(pSMBr->MaxRawSize);
        cFYI(DBG2, ("Max buf = %d", ses->server->maxBuf));
        GETU32(ses->server->sessid) = le32_to_cpu(pSMBr->SessionKey);
        server->capabilities = le32_to_cpu(pSMBr->Capabilities);
index 2209be94305132f375b1082193bdcf7280c312d8..da0f4ffa06132f725570a79f7e0b5fb0b65d1eb6 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/string.h>
 #include <linux/list.h>
 #include <linux/wait.h>
-#include <linux/ipv6.h>
 #include <linux/pagemap.h>
 #include <linux/ctype.h>
 #include <linux/utsname.h>
@@ -35,6 +34,7 @@
 #include <linux/freezer.h>
 #include <asm/uaccess.h>
 #include <asm/processor.h>
+#include <net/ipv6.h>
 #include "cifspdu.h"
 #include "cifsglob.h"
 #include "cifsproto.h"
@@ -1379,8 +1379,8 @@ cifs_find_tcp_session(struct sockaddr_storage *addr)
                     server->addr.sockAddr.sin_addr.s_addr))
                        continue;
                else if (addr->ss_family == AF_INET6 &&
-                        memcmp(&server->addr.sockAddr6.sin6_addr,
-                               &addr6->sin6_addr, sizeof(addr6->sin6_addr)))
+                        !ipv6_addr_equal(&server->addr.sockAddr6.sin6_addr,
+                                         &addr6->sin6_addr))
                        continue;
 
                ++server->srv_count;
@@ -2180,6 +2180,33 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info,
                           "mount option supported"));
 }
 
+static int
+is_path_accessible(int xid, struct cifsTconInfo *tcon,
+                  struct cifs_sb_info *cifs_sb, const char *full_path)
+{
+       int rc;
+       __u64 inode_num;
+       FILE_ALL_INFO *pfile_info;
+
+       rc = CIFSGetSrvInodeNumber(xid, tcon, full_path, &inode_num,
+                                  cifs_sb->local_nls,
+                                  cifs_sb->mnt_cifs_flags &
+                                               CIFS_MOUNT_MAP_SPECIAL_CHR);
+       if (rc != -EOPNOTSUPP)
+               return rc;
+
+       pfile_info = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
+       if (pfile_info == NULL)
+               return -ENOMEM;
+
+       rc = CIFSSMBQPathInfo(xid, tcon, full_path, pfile_info,
+                             0 /* not legacy */, cifs_sb->local_nls,
+                             cifs_sb->mnt_cifs_flags &
+                               CIFS_MOUNT_MAP_SPECIAL_CHR);
+       kfree(pfile_info);
+       return rc;
+}
+
 int
 cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
           char *mount_data, const char *devname)
@@ -2190,6 +2217,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
        struct cifsSesInfo *pSesInfo = NULL;
        struct cifsTconInfo *tcon = NULL;
        struct TCP_Server_Info *srvTcp = NULL;
+       char   *full_path;
 
        xid = GetXid();
 
@@ -2426,6 +2454,23 @@ mount_fail_check:
                cifs_sb->rsize = min(cifs_sb->rsize,
                               (tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE));
 
+       if (!rc && cifs_sb->prepathlen) {
+               /* build_path_to_root works only when we have a valid tcon */
+               full_path = cifs_build_path_to_root(cifs_sb);
+               if (full_path == NULL) {
+                       rc = -ENOMEM;
+                       goto mount_fail_check;
+               }
+               rc = is_path_accessible(xid, tcon, cifs_sb, full_path);
+               if (rc) {
+                       cERROR(1, ("Path %s in not accessible: %d",
+                                               full_path, rc));
+                       kfree(full_path);
+                       goto mount_fail_check;
+               }
+               kfree(full_path);
+       }
+
        /* volume_info->password is freed above when existing session found
        (in which case it is not needed anymore) but when new sesion is created
        the password ptr is put in the new session structure (in which case the
index 964aad03c5ad82d914ad504a8453f09f149d5c67..89fb728326523f6f3367a7343e057350341f423a 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   vfs operations that deal with dentries
  *
- *   Copyright (C) International Business Machines  Corp., 2002,2008
+ *   Copyright (C) International Business Machines  Corp., 2002,2009
  *   Author(s): Steve French (sfrench@us.ibm.com)
  *
  *   This library is free software; you can redistribute it and/or modify
@@ -129,6 +129,78 @@ cifs_bp_rename_retry:
        return full_path;
 }
 
+static int cifs_posix_open(char *full_path, struct inode **pinode,
+                   struct super_block *sb, int mode, int oflags,
+                   int *poplock, __u16 *pnetfid, int xid)
+{
+       int rc;
+       __u32 oplock;
+       FILE_UNIX_BASIC_INFO *presp_data;
+       __u32 posix_flags = 0;
+       struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
+
+       cFYI(1, ("posix open %s", full_path));
+
+       presp_data = kzalloc(sizeof(FILE_UNIX_BASIC_INFO), GFP_KERNEL);
+       if (presp_data == NULL)
+               return -ENOMEM;
+
+/* So far cifs posix extensions can only map the following flags.
+   There are other valid fmode oflags such as FMODE_LSEEK, FMODE_PREAD, but
+   so far we do not seem to need them, and we can treat them as local only */
+       if ((oflags & (FMODE_READ | FMODE_WRITE)) ==
+               (FMODE_READ | FMODE_WRITE))
+               posix_flags = SMB_O_RDWR;
+       else if (oflags & FMODE_READ)
+               posix_flags = SMB_O_RDONLY;
+       else if (oflags & FMODE_WRITE)
+               posix_flags = SMB_O_WRONLY;
+       if (oflags & O_CREAT)
+               posix_flags |= SMB_O_CREAT;
+       if (oflags & O_EXCL)
+               posix_flags |= SMB_O_EXCL;
+       if (oflags & O_TRUNC)
+               posix_flags |= SMB_O_TRUNC;
+       if (oflags & O_APPEND)
+               posix_flags |= SMB_O_APPEND;
+       if (oflags & O_SYNC)
+               posix_flags |= SMB_O_SYNC;
+       if (oflags & O_DIRECTORY)
+               posix_flags |= SMB_O_DIRECTORY;
+       if (oflags & O_NOFOLLOW)
+               posix_flags |= SMB_O_NOFOLLOW;
+       if (oflags & O_DIRECT)
+               posix_flags |= SMB_O_DIRECT;
+
+
+       rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode,
+                       pnetfid, presp_data, &oplock, full_path,
+                       cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
+                                       CIFS_MOUNT_MAP_SPECIAL_CHR);
+       if (rc)
+               goto posix_open_ret;
+
+       if (presp_data->Type == cpu_to_le32(-1))
+               goto posix_open_ret; /* open ok, caller does qpathinfo */
+
+       /* get new inode and set it up */
+       if (!pinode)
+               goto posix_open_ret; /* caller does not need info */
+
+       *pinode = cifs_new_inode(sb, &presp_data->UniqueId);
+
+       /* We do not need to close the file if new_inode fails since
+          the caller will retry qpathinfo as long as inode is null */
+       if (*pinode == NULL)
+               goto posix_open_ret;
+
+       posix_fill_in_inode(*pinode, presp_data, 1);
+
+posix_open_ret:
+       kfree(presp_data);
+       return rc;
+}
+
 static void setup_cifs_dentry(struct cifsTconInfo *tcon,
                              struct dentry *direntry,
                              struct inode *newinode)
@@ -150,7 +222,14 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        int xid;
        int create_options = CREATE_NOT_DIR;
        int oplock = 0;
-       /* BB below access is too much for the mknod to request */
+       int oflags;
+       /*
+        * BB below access is probably too much for mknod to request
+        *    but we have to do query and setpathinfo so requesting
+        *    less could fail (unless we want to request getatr and setatr
+        *    permissions (only).  At least for POSIX we do not have to
+        *    request so much.
+        */
        int desiredAccess = GENERIC_READ | GENERIC_WRITE;
        __u16 fileHandle;
        struct cifs_sb_info *cifs_sb;
@@ -174,13 +253,43 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        }
 
        mode &= ~current->fs->umask;
+       if (oplockEnabled)
+               oplock = REQ_OPLOCK;
 
-       if (nd && (nd->flags & LOOKUP_OPEN)) {
-               int oflags = nd->intent.open.flags;
+       if (nd && (nd->flags & LOOKUP_OPEN))
+               oflags = nd->intent.open.flags;
+       else
+               oflags = FMODE_READ;
+
+       if (tcon->unix_ext && (tcon->ses->capabilities & CAP_UNIX) &&
+           (CIFS_UNIX_POSIX_PATH_OPS_CAP &
+                       le64_to_cpu(tcon->fsUnixInfo.Capability))) {
+               rc = cifs_posix_open(full_path, &newinode, inode->i_sb,
+                                    mode, oflags, &oplock, &fileHandle, xid);
+               /* EIO could indicate that (posix open) operation is not
+                  supported, despite what server claimed in capability
+                  negotation.  EREMOTE indicates DFS junction, which is not
+                  handled in posix open */
+
+               if ((rc == 0) && (newinode == NULL))
+                       goto cifs_create_get_file_info; /* query inode info */
+               else if (rc == 0) /* success, no need to query */
+                       goto cifs_create_set_dentry;
+               else if ((rc != -EIO) && (rc != -EREMOTE) &&
+                        (rc != -EOPNOTSUPP)) /* path not found or net err */
+                       goto cifs_create_out;
+               /* else fallthrough to retry, using older open call, this is
+                  case where server does not support this SMB level, and
+                  falsely claims capability (also get here for DFS case
+                  which should be rare for path not covered on files) */
+       }
 
+       if (nd && (nd->flags & LOOKUP_OPEN)) {
+               /* if the file is going to stay open, then we
+                  need to set the desired access properly */
                desiredAccess = 0;
                if (oflags & FMODE_READ)
-                       desiredAccess |= GENERIC_READ;
+                       desiredAccess |= GENERIC_READ; /* is this too little? */
                if (oflags & FMODE_WRITE) {
                        desiredAccess |= GENERIC_WRITE;
                        if (!(oflags & FMODE_READ))
@@ -199,8 +308,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
 
        /* BB add processing to set equivalent of mode - e.g. via CreateX with
           ACLs */
-       if (oplockEnabled)
-               oplock = REQ_OPLOCK;
 
        buf = kmalloc(sizeof(FILE_ALL_INFO), GFP_KERNEL);
        if (buf == NULL) {
@@ -233,116 +340,112 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
        }
        if (rc) {
                cFYI(1, ("cifs_create returned 0x%x", rc));
-       } else {
-               /* If Open reported that we actually created a file
-               then we now have to set the mode if possible */
-               if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
-                       struct cifs_unix_set_info_args args = {
+               goto cifs_create_out;
+       }
+
+       /* If Open reported that we actually created a file
+          then we now have to set the mode if possible */
+       if ((tcon->unix_ext) && (oplock & CIFS_CREATE_ACTION)) {
+               struct cifs_unix_set_info_args args = {
                                .mode   = mode,
                                .ctime  = NO_CHANGE_64,
                                .atime  = NO_CHANGE_64,
                                .mtime  = NO_CHANGE_64,
                                .device = 0,
-                       };
+               };
 
-                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
-                               args.uid = (__u64) current_fsuid();
-                               if (inode->i_mode & S_ISGID)
-                                       args.gid = (__u64) inode->i_gid;
-                               else
-                                       args.gid = (__u64) current_fsgid();
-                       } else {
-                               args.uid = NO_CHANGE_64;
-                               args.gid = NO_CHANGE_64;
-                       }
-                       CIFSSMBUnixSetInfo(xid, tcon, full_path, &args,
-                               cifs_sb->local_nls,
-                               cifs_sb->mnt_cifs_flags &
-                                       CIFS_MOUNT_MAP_SPECIAL_CHR);
+               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+                       args.uid = (__u64) current_fsuid();
+                       if (inode->i_mode & S_ISGID)
+                               args.gid = (__u64) inode->i_gid;
+                       else
+                               args.gid = (__u64) current_fsgid();
                } else {
-                       /* BB implement mode setting via Windows security
-                          descriptors e.g. */
-                       /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/
-
-                       /* Could set r/o dos attribute if mode & 0222 == 0 */
+                       args.uid = NO_CHANGE_64;
+                       args.gid = NO_CHANGE_64;
                }
+               CIFSSMBUnixSetInfo(xid, tcon, full_path, &args,
+                       cifs_sb->local_nls,
+                       cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
+       } else {
+               /* BB implement mode setting via Windows security
+                  descriptors e.g. */
+               /* CIFSSMBWinSetPerms(xid,tcon,path,mode,-1,-1,nls);*/
 
-               /* server might mask mode so we have to query for it */
-               if (tcon->unix_ext)
-                       rc = cifs_get_inode_info_unix(&newinode, full_path,
-                                                inode->i_sb, xid);
-               else {
-                       rc = cifs_get_inode_info(&newinode, full_path,
-                                                buf, inode->i_sb, xid,
-                                                &fileHandle);
-                       if (newinode) {
-                               if (cifs_sb->mnt_cifs_flags &
-                                   CIFS_MOUNT_DYNPERM)
-                                       newinode->i_mode = mode;
-                               if ((oplock & CIFS_CREATE_ACTION) &&
-                                   (cifs_sb->mnt_cifs_flags &
-                                    CIFS_MOUNT_SET_UID)) {
-                                       newinode->i_uid = current_fsuid();
-                                       if (inode->i_mode & S_ISGID)
-                                               newinode->i_gid =
-                                                       inode->i_gid;
-                                       else
-                                               newinode->i_gid =
-                                                       current_fsgid();
-                               }
+               /* Could set r/o dos attribute if mode & 0222 == 0 */
+       }
+
+cifs_create_get_file_info:
+       /* server might mask mode so we have to query for it */
+       if (tcon->unix_ext)
+               rc = cifs_get_inode_info_unix(&newinode, full_path,
+                                             inode->i_sb, xid);
+       else {
+               rc = cifs_get_inode_info(&newinode, full_path, buf,
+                                        inode->i_sb, xid, &fileHandle);
+               if (newinode) {
+                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DYNPERM)
+                               newinode->i_mode = mode;
+                       if ((oplock & CIFS_CREATE_ACTION) &&
+                           (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID)) {
+                               newinode->i_uid = current_fsuid();
+                               if (inode->i_mode & S_ISGID)
+                                       newinode->i_gid = inode->i_gid;
+                               else
+                                       newinode->i_gid = current_fsgid();
                        }
                }
+       }
 
-               if (rc != 0) {
-                       cFYI(1, ("Create worked, get_inode_info failed rc = %d",
-                                rc));
-               } else
-                       setup_cifs_dentry(tcon, direntry, newinode);
-
-               if ((nd == NULL /* nfsd case - nfs srv does not set nd */) ||
-                       (!(nd->flags & LOOKUP_OPEN))) {
-                       /* mknod case - do not leave file open */
-                       CIFSSMBClose(xid, tcon, fileHandle);
-               } else if (newinode) {
-                       struct cifsFileInfo *pCifsFile =
-                          kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
-
-                       if (pCifsFile == NULL)
-                               goto cifs_create_out;
-                       pCifsFile->netfid = fileHandle;
-                       pCifsFile->pid = current->tgid;
-                       pCifsFile->pInode = newinode;
-                       pCifsFile->invalidHandle = false;
-                       pCifsFile->closePend     = false;
-                       init_MUTEX(&pCifsFile->fh_sem);
-                       mutex_init(&pCifsFile->lock_mutex);
-                       INIT_LIST_HEAD(&pCifsFile->llist);
-                       atomic_set(&pCifsFile->wrtPending, 0);
-
-                       /* set the following in open now
+cifs_create_set_dentry:
+       if (rc == 0)
+               setup_cifs_dentry(tcon, direntry, newinode);
+       else
+               cFYI(1, ("Create worked, get_inode_info failed rc = %d", rc));
+
+       /* nfsd case - nfs srv does not set nd */
+       if ((nd == NULL) || (!(nd->flags & LOOKUP_OPEN))) {
+               /* mknod case - do not leave file open */
+               CIFSSMBClose(xid, tcon, fileHandle);
+       } else if (newinode) {
+               struct cifsFileInfo *pCifsFile =
+                       kzalloc(sizeof(struct cifsFileInfo), GFP_KERNEL);
+
+               if (pCifsFile == NULL)
+                       goto cifs_create_out;
+               pCifsFile->netfid = fileHandle;
+               pCifsFile->pid = current->tgid;
+               pCifsFile->pInode = newinode;
+               pCifsFile->invalidHandle = false;
+               pCifsFile->closePend     = false;
+               init_MUTEX(&pCifsFile->fh_sem);
+               mutex_init(&pCifsFile->lock_mutex);
+               INIT_LIST_HEAD(&pCifsFile->llist);
+               atomic_set(&pCifsFile->wrtPending, 0);
+
+               /* set the following in open now
                                pCifsFile->pfile = file; */
-                       write_lock(&GlobalSMBSeslock);
-                       list_add(&pCifsFile->tlist, &tcon->openFileList);
-                       pCifsInode = CIFS_I(newinode);
-                       if (pCifsInode) {
-                               /* if readable file instance put first in list*/
-                               if (write_only) {
-                                       list_add_tail(&pCifsFile->flist,
-                                               &pCifsInode->openFileList);
-                               } else {
-                                       list_add(&pCifsFile->flist,
-                                               &pCifsInode->openFileList);
-                               }
-                               if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
-                                       pCifsInode->clientCanCacheAll = true;
-                                       pCifsInode->clientCanCacheRead = true;
-                                       cFYI(1, ("Exclusive Oplock inode %p",
-                                               newinode));
-                               } else if ((oplock & 0xF) == OPLOCK_READ)
-                                       pCifsInode->clientCanCacheRead = true;
+               write_lock(&GlobalSMBSeslock);
+               list_add(&pCifsFile->tlist, &tcon->openFileList);
+               pCifsInode = CIFS_I(newinode);
+               if (pCifsInode) {
+                       /* if readable file instance put first in list*/
+                       if (write_only) {
+                               list_add_tail(&pCifsFile->flist,
+                                             &pCifsInode->openFileList);
+                       } else {
+                               list_add(&pCifsFile->flist,
+                                        &pCifsInode->openFileList);
                        }
-                       write_unlock(&GlobalSMBSeslock);
+                       if ((oplock & 0xF) == OPLOCK_EXCLUSIVE) {
+                               pCifsInode->clientCanCacheAll = true;
+                               pCifsInode->clientCanCacheRead = true;
+                               cFYI(1, ("Exclusive Oplock inode %p",
+                                       newinode));
+                       } else if ((oplock & 0xF) == OPLOCK_READ)
+                               pCifsInode->clientCanCacheRead = true;
                }
+               write_unlock(&GlobalSMBSeslock);
        }
 cifs_create_out:
        kfree(buf);
index bcf7b518466413023097ba69b7a5cb8cb4c4a449..4690a360c85587ed85a76db68ab4c5afed4f998e 100644 (file)
@@ -199,6 +199,49 @@ static void fill_fake_finddataunix(FILE_UNIX_BASIC_INFO *pfnd_dat,
        pfnd_dat->Gid = cpu_to_le64(pinode->i_gid);
 }
 
+/**
+ * cifs_new inode - create new inode, initialize, and hash it
+ * @sb - pointer to superblock
+ * @inum - if valid pointer and serverino is enabled, replace i_ino with val
+ *
+ * Create a new inode, initialize it for CIFS and hash it. Returns the new
+ * inode or NULL if one couldn't be allocated.
+ *
+ * If the share isn't mounted with "serverino" or inum is a NULL pointer then
+ * we'll just use the inode number assigned by new_inode(). Note that this can
+ * mean i_ino collisions since the i_ino assigned by new_inode is not
+ * guaranteed to be unique.
+ */
+struct inode *
+cifs_new_inode(struct super_block *sb, __u64 *inum)
+{
+       struct inode *inode;
+
+       inode = new_inode(sb);
+       if (inode == NULL)
+               return NULL;
+
+       /*
+        * BB: Is i_ino == 0 legal? Here, we assume that it is. If it isn't we
+        *     stop passing inum as ptr. Are there sanity checks we can use to
+        *     ensure that the server is really filling in that field? Also,
+        *     if serverino is disabled, perhaps we should be using iunique()?
+        */
+       if (inum && (CIFS_SB(sb)->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM))
+               inode->i_ino = (unsigned long) *inum;
+
+       /*
+        * must set this here instead of cifs_alloc_inode since VFS will
+        * clobber i_flags
+        */
+       if (sb->s_flags & MS_NOATIME)
+               inode->i_flags |= S_NOATIME | S_NOCMTIME;
+
+       insert_inode_hash(inode);
+
+       return inode;
+}
+
 int cifs_get_inode_info_unix(struct inode **pinode,
        const unsigned char *full_path, struct super_block *sb, int xid)
 {
@@ -233,22 +276,11 @@ int cifs_get_inode_info_unix(struct inode **pinode,
 
        /* get new inode */
        if (*pinode == NULL) {
-               *pinode = new_inode(sb);
+               *pinode = cifs_new_inode(sb, &find_data.UniqueId);
                if (*pinode == NULL) {
                        rc = -ENOMEM;
                        goto cgiiu_exit;
                }
-               /* Is an i_ino of zero legal? */
-               /* note ino incremented to unique num in new_inode */
-               /* Are there sanity checks we can use to ensure that
-                  the server is really filling in that field? */
-               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
-                       (*pinode)->i_ino = (unsigned long)find_data.UniqueId;
-
-               if (sb->s_flags & MS_NOATIME)
-                       (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME;
-
-               insert_inode_hash(*pinode);
        }
 
        inode = *pinode;
@@ -465,11 +497,9 @@ int cifs_get_inode_info(struct inode **pinode,
 
        /* get new inode */
        if (*pinode == NULL) {
-               *pinode = new_inode(sb);
-               if (*pinode == NULL) {
-                       rc = -ENOMEM;
-                       goto cgii_exit;
-               }
+               __u64 inode_num;
+               __u64 *pinum = &inode_num;
+
                /* Is an i_ino of zero legal? Can we use that to check
                   if the server supports returning inode numbers?  Are
                   there other sanity checks we can use to ensure that
@@ -486,22 +516,26 @@ int cifs_get_inode_info(struct inode **pinode,
 
                if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
                        int rc1 = 0;
-                       __u64 inode_num;
 
                        rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
-                                       full_path, &inode_num,
+                                       full_path, pinum,
                                        cifs_sb->local_nls,
                                        cifs_sb->mnt_cifs_flags &
                                                CIFS_MOUNT_MAP_SPECIAL_CHR);
                        if (rc1) {
                                cFYI(1, ("GetSrvInodeNum rc %d", rc1));
+                               pinum = NULL;
                                /* BB EOPNOSUPP disable SERVER_INUM? */
-                       } else /* do we need cast or hash to ino? */
-                               (*pinode)->i_ino = inode_num;
-               } /* else ino incremented to unique num in new_inode*/
-               if (sb->s_flags & MS_NOATIME)
-                       (*pinode)->i_flags |= S_NOATIME | S_NOCMTIME;
-               insert_inode_hash(*pinode);
+                       }
+               } else {
+                       pinum = NULL;
+               }
+
+               *pinode = cifs_new_inode(sb, pinum);
+               if (*pinode == NULL) {
+                       rc = -ENOMEM;
+                       goto cgii_exit;
+               }
        }
        inode = *pinode;
        cifsInfo = CIFS_I(inode);
@@ -621,7 +655,7 @@ static const struct inode_operations cifs_ipc_inode_ops = {
        .lookup = cifs_lookup,
 };
 
-static char *build_path_to_root(struct cifs_sb_info *cifs_sb)
+char *cifs_build_path_to_root(struct cifs_sb_info *cifs_sb)
 {
        int pplen = cifs_sb->prepathlen;
        int dfsplen;
@@ -678,7 +712,7 @@ struct inode *cifs_iget(struct super_block *sb, unsigned long ino)
                return inode;
 
        cifs_sb = CIFS_SB(inode->i_sb);
-       full_path = build_path_to_root(cifs_sb);
+       full_path = cifs_build_path_to_root(cifs_sb);
        if (full_path == NULL)
                return ERR_PTR(-ENOMEM);
 
@@ -1017,7 +1051,7 @@ out_reval:
        return rc;
 }
 
-static void posix_fill_in_inode(struct inode *tmp_inode,
+void posix_fill_in_inode(struct inode *tmp_inode,
        FILE_UNIX_BASIC_INFO *pData, int isNewInode)
 {
        struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode);
@@ -1114,24 +1148,14 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
                        else
                                direntry->d_op = &cifs_dentry_ops;
 
-                       newinode = new_inode(inode->i_sb);
+                       newinode = cifs_new_inode(inode->i_sb,
+                                                 &pInfo->UniqueId);
                        if (newinode == NULL) {
                                kfree(pInfo);
                                goto mkdir_get_info;
                        }
 
-                       /* Is an i_ino of zero legal? */
-                       /* Are there sanity checks we can use to ensure that
-                          the server is really filling in that field? */
-                       if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
-                               newinode->i_ino =
-                                       (unsigned long)pInfo->UniqueId;
-                       } /* note ino incremented to unique num in new_inode */
-                       if (inode->i_sb->s_flags & MS_NOATIME)
-                               newinode->i_flags |= S_NOATIME | S_NOCMTIME;
                        newinode->i_nlink = 2;
-
-                       insert_inode_hash(newinode);
                        d_instantiate(direntry, newinode);
 
                        /* we already checked in POSIXCreate whether
index 9f51f9bf0292f4a67aee9ca82aae2f6d3b6cc5d0..c2c01ff4c32c1b21965ebf814ee83a93318c7a31 100644 (file)
@@ -56,35 +56,34 @@ static inline void dump_cifs_file_struct(struct file *file, char *label)
 }
 #endif /* DEBUG2 */
 
-/* Returns one if new inode created (which therefore needs to be hashed) */
+/* Returns 1 if new inode created, 2 if both dentry and inode were */
 /* Might check in the future if inode number changed so we can rehash inode */
-static int construct_dentry(struct qstr *qstring, struct file *file,
-       struct inode **ptmp_inode, struct dentry **pnew_dentry)
+static int
+construct_dentry(struct qstr *qstring, struct file *file,
+                struct inode **ptmp_inode, struct dentry **pnew_dentry,
+                __u64 *inum)
 {
-       struct dentry *tmp_dentry;
-       struct cifs_sb_info *cifs_sb;
-       struct cifsTconInfo *pTcon;
+       struct dentry *tmp_dentry = NULL;
+       struct super_block *sb = file->f_path.dentry->d_sb;
        int rc = 0;
 
        cFYI(1, ("For %s", qstring->name));
-       cifs_sb = CIFS_SB(file->f_path.dentry->d_sb);
-       pTcon = cifs_sb->tcon;
 
        qstring->hash = full_name_hash(qstring->name, qstring->len);
        tmp_dentry = d_lookup(file->f_path.dentry, qstring);
        if (tmp_dentry) {
+               /* BB: overwrite old name? i.e. tmp_dentry->d_name and
+                * tmp_dentry->d_name.len??
+                */
                cFYI(0, ("existing dentry with inode 0x%p",
                         tmp_dentry->d_inode));
                *ptmp_inode = tmp_dentry->d_inode;
-/* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/
                if (*ptmp_inode == NULL) {
-                       *ptmp_inode = new_inode(file->f_path.dentry->d_sb);
+                       *ptmp_inode = cifs_new_inode(sb, inum);
                        if (*ptmp_inode == NULL)
                                return rc;
                        rc = 1;
                }
-               if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME)
-                       (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME;
        } else {
                tmp_dentry = d_alloc(file->f_path.dentry, qstring);
                if (tmp_dentry == NULL) {
@@ -93,15 +92,14 @@ static int construct_dentry(struct qstr *qstring, struct file *file,
                        return rc;
                }
 
-               *ptmp_inode = new_inode(file->f_path.dentry->d_sb);
-               if (pTcon->nocase)
+               if (CIFS_SB(sb)->tcon->nocase)
                        tmp_dentry->d_op = &cifs_ci_dentry_ops;
                else
                        tmp_dentry->d_op = &cifs_dentry_ops;
+
+               *ptmp_inode = cifs_new_inode(sb, inum);
                if (*ptmp_inode == NULL)
                        return rc;
-               if (file->f_path.dentry->d_sb->s_flags & MS_NOATIME)
-                       (*ptmp_inode)->i_flags |= S_NOATIME | S_NOCMTIME;
                rc = 2;
        }
 
@@ -822,7 +820,7 @@ static int find_cifs_entry(const int xid, struct cifsTconInfo *pTcon,
 /* inode num, inode type and filename returned */
 static int cifs_get_name_from_search_buf(struct qstr *pqst,
        char *current_entry, __u16 level, unsigned int unicode,
-       struct cifs_sb_info *cifs_sb, int max_len, ino_t *pinum)
+       struct cifs_sb_info *cifs_sb, int max_len, __u64 *pinum)
 {
        int rc = 0;
        unsigned int len = 0;
@@ -842,9 +840,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
                        len = strnlen(filename, PATH_MAX);
                }
 
-               /* BB fixme - hash low and high 32 bits if not 64 bit arch BB */
-               if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)
-                       *pinum = pFindData->UniqueId;
+               *pinum = pFindData->UniqueId;
        } else if (level == SMB_FIND_FILE_DIRECTORY_INFO) {
                FILE_DIRECTORY_INFO *pFindData =
                        (FILE_DIRECTORY_INFO *)current_entry;
@@ -907,7 +903,7 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
        struct qstr qstring;
        struct cifsFileInfo *pCifsF;
        unsigned int obj_type;
-       ino_t  inum;
+       __u64  inum;
        struct cifs_sb_info *cifs_sb;
        struct inode *tmp_inode;
        struct dentry *tmp_dentry;
@@ -940,20 +936,18 @@ static int cifs_filldir(char *pfindEntry, struct file *file,
        if (rc)
                return rc;
 
-       rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry);
+       /* only these two infolevels return valid inode numbers */
+       if (pCifsF->srch_inf.info_level == SMB_FIND_FILE_UNIX ||
+           pCifsF->srch_inf.info_level == SMB_FIND_FILE_ID_FULL_DIR_INFO)
+               rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry,
+                                       &inum);
+       else
+               rc = construct_dentry(&qstring, file, &tmp_inode, &tmp_dentry,
+                                       NULL);
+
        if ((tmp_inode == NULL) || (tmp_dentry == NULL))
                return -ENOMEM;
 
-       if (rc) {
-               /* inode created, we need to hash it with right inode number */
-               if (inum != 0) {
-                       /* BB fixme - hash the 2 32 quantities bits together if
-                        *  necessary BB */
-                       tmp_inode->i_ino = inum;
-               }
-               insert_inode_hash(tmp_inode);
-       }
-
        /* we pass in rc below, indicating whether it is a new inode,
           so we can figure out whether to invalidate the inode cached
           data if the file has changed */
index 5f22de7b79a900fe9bbd79e68f9823da136d132e..5c68b4282be917bc48ba04e77b0af2120952d50a 100644 (file)
 extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
                         unsigned char *p24);
 
+/* Checks if this is the first smb session to be reconnected after
+   the socket has been reestablished (so we know whether to use vc 0).
+   Called while holding the cifs_tcp_ses_lock, so do not block */
+static bool is_first_ses_reconnect(struct cifsSesInfo *ses)
+{
+       struct list_head *tmp;
+       struct cifsSesInfo *tmp_ses;
+
+       list_for_each(tmp, &ses->server->smb_ses_list) {
+               tmp_ses = list_entry(tmp, struct cifsSesInfo,
+                                    smb_ses_list);
+               if (tmp_ses->need_reconnect == false)
+                       return false;
+       }
+       /* could not find a session that was already connected,
+          this must be the first one we are reconnecting */
+       return true;
+}
+
+/*
+ *     vc number 0 is treated specially by some servers, and should be the
+ *      first one we request.  After that we can use vcnumbers up to maxvcs,
+ *     one for each smb session (some Windows versions set maxvcs incorrectly
+ *     so maxvc=1 can be ignored).  If we have too many vcs, we can reuse
+ *     any vc but zero (some servers reset the connection on vcnum zero)
+ *
+ */
+static __le16 get_next_vcnum(struct cifsSesInfo *ses)
+{
+       __u16 vcnum = 0;
+       struct list_head *tmp;
+       struct cifsSesInfo *tmp_ses;
+       __u16 max_vcs = ses->server->max_vcs;
+       __u16 i;
+       int free_vc_found = 0;
+
+       /* Quoting the MS-SMB specification: "Windows-based SMB servers set this
+       field to one but do not enforce this limit, which allows an SMB client
+       to establish more virtual circuits than allowed by this value ... but
+       other server implementations can enforce this limit." */
+       if (max_vcs < 2)
+               max_vcs = 0xFFFF;
+
+       write_lock(&cifs_tcp_ses_lock);
+       if ((ses->need_reconnect) && is_first_ses_reconnect(ses))
+                       goto get_vc_num_exit;  /* vcnum will be zero */
+       for (i = ses->server->srv_count - 1; i < max_vcs; i++) {
+               if (i == 0) /* this is the only connection, use vc 0 */
+                       break;
+
+               free_vc_found = 1;
+
+               list_for_each(tmp, &ses->server->smb_ses_list) {
+                       tmp_ses = list_entry(tmp, struct cifsSesInfo,
+                                            smb_ses_list);
+                       if (tmp_ses->vcnum == i) {
+                               free_vc_found = 0;
+                               break; /* found duplicate, try next vcnum */
+                       }
+               }
+               if (free_vc_found)
+                       break; /* we found a vcnumber that will work - use it */
+       }
+
+       if (i == 0)
+               vcnum = 0; /* for most common case, ie if one smb session, use
+                             vc zero.  Also for case when no free vcnum, zero
+                             is safest to send (some clients only send zero) */
+       else if (free_vc_found == 0)
+               vcnum = 1;  /* we can not reuse vc=0 safely, since some servers
+                               reset all uids on that, but 1 is ok. */
+       else
+               vcnum = i;
+       ses->vcnum = vcnum;
+get_vc_num_exit:
+       write_unlock(&cifs_tcp_ses_lock);
+
+       return le16_to_cpu(vcnum);
+}
+
 static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
 {
        __u32 capabilities = 0;
 
        /* init fields common to all four types of SessSetup */
-       /* note that header is initialized to zero in header_assemble */
+       /* Note that offsets for first seven fields in req struct are same  */
+       /*      in CIFS Specs so does not matter which of 3 forms of struct */
+       /*      that we use in next few lines                               */
+       /* Note that header is initialized to zero in header_assemble */
        pSMB->req.AndXCommand = 0xFF;
        pSMB->req.MaxBufferSize = cpu_to_le16(ses->server->maxBuf);
        pSMB->req.MaxMpxCount = cpu_to_le16(ses->server->maxReq);
+       pSMB->req.VcNumber = get_next_vcnum(ses);
 
        /* Now no need to set SMBFLG_CASELESS or obsolete CANONICAL PATH */
 
@@ -71,7 +155,6 @@ static __u32 cifs_ssetup_hdr(struct cifsSesInfo *ses, SESSION_SETUP_ANDX *pSMB)
        if (ses->capabilities & CAP_UNIX)
                capabilities |= CAP_UNIX;
 
-       /* BB check whether to init vcnum BB */
        return capabilities;
 }
 
@@ -228,7 +311,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
 
        kfree(ses->serverOS);
        /* UTF-8 string will not grow more than four times as big as UCS-16 */
-       ses->serverOS = kzalloc(4 * len, GFP_KERNEL);
+       ses->serverOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
        if (ses->serverOS != NULL)
                cifs_strfromUCS_le(ses->serverOS, (__le16 *)data, len, nls_cp);
        data += 2 * (len + 1);
@@ -241,7 +324,7 @@ static int decode_unicode_ssetup(char **pbcc_area, int bleft,
                return rc;
 
        kfree(ses->serverNOS);
-       ses->serverNOS = kzalloc(4 * len, GFP_KERNEL); /* BB this is wrong length FIXME BB */
+       ses->serverNOS = kzalloc((4 * len) + 2 /* trailing null */, GFP_KERNEL);
        if (ses->serverNOS != NULL) {
                cifs_strfromUCS_le(ses->serverNOS, (__le16 *)data, len,
                                   nls_cp);
index 65a070e705ab1d8112ae6085c8d3e7d7c6202c90..d0145ca27572890b958765c72795a2b291628c20 100644 (file)
@@ -1407,7 +1407,7 @@ int compat_do_execve(char * filename,
        bprm->cred = prepare_exec_creds();
        if (!bprm->cred)
                goto out_unlock;
-       check_unsafe_exec(bprm);
+       check_unsafe_exec(bprm, current->files);
 
        file = open_exec(filename);
        retval = PTR_ERR(file);
index c8f8d5904f5ee377d817c16ec91ef955ad13f85f..4ea8a98b23df636503b575934838cac293796e15 100644 (file)
@@ -522,6 +522,11 @@ static int dev_ifsioc(unsigned int fd, unsigned int cmd, unsigned long arg)
                if (err)
                        return -EFAULT;
                break;
+       case SIOCSHWTSTAMP:
+               if (copy_from_user(&ifr, uifr32, sizeof(*uifr32)))
+                       return -EFAULT;
+               ifr.ifr_data = compat_ptr(uifr32->ifr_ifru.ifru_data);
+               break;
        default:
                if (copy_from_user(&ifr, uifr32, sizeof(*uifr32)))
                        return -EFAULT;
@@ -785,7 +790,7 @@ static int sg_ioctl_trans(unsigned int fd, unsigned int cmd, unsigned long arg)
 
        if (copy_in_user(&sgio->status, &sgio32->status,
                         (4 * sizeof(unsigned char)) +
-                        (2 * sizeof(unsigned (short))) +
+                        (2 * sizeof(unsigned short)) +
                         (3 * sizeof(int))))
                return -EFAULT;
 
@@ -1938,6 +1943,8 @@ ULONG_IOCTL(SET_BITMAP_FILE)
 /* Big K */
 COMPATIBLE_IOCTL(PIO_FONT)
 COMPATIBLE_IOCTL(GIO_FONT)
+COMPATIBLE_IOCTL(PIO_CMAP)
+COMPATIBLE_IOCTL(GIO_CMAP)
 ULONG_IOCTL(KDSIGACCEPT)
 COMPATIBLE_IOCTL(KDGETKEYCODE)
 COMPATIBLE_IOCTL(KDSETKEYCODE)
@@ -1988,6 +1995,8 @@ COMPATIBLE_IOCTL(TUNSETGROUP)
 COMPATIBLE_IOCTL(TUNGETFEATURES)
 COMPATIBLE_IOCTL(TUNSETOFFLOAD)
 COMPATIBLE_IOCTL(TUNSETTXFILTER)
+COMPATIBLE_IOCTL(TUNGETSNDBUF)
+COMPATIBLE_IOCTL(TUNSETSNDBUF)
 /* Big V */
 COMPATIBLE_IOCTL(VT_SETMODE)
 COMPATIBLE_IOCTL(VT_GETMODE)
@@ -2561,6 +2570,7 @@ HANDLE_IOCTL(SIOCSIFMAP, dev_ifsioc)
 HANDLE_IOCTL(SIOCGIFADDR, dev_ifsioc)
 HANDLE_IOCTL(SIOCSIFADDR, dev_ifsioc)
 HANDLE_IOCTL(SIOCSIFHWBROADCAST, dev_ifsioc)
+HANDLE_IOCTL(SIOCSHWTSTAMP, dev_ifsioc)
 
 /* ioctls used by appletalk ddp.c */
 HANDLE_IOCTL(SIOCATALKDIFADDR, dev_ifsioc)
index bca3cac4bee76e831b71f6b59c13641b91e48103..d6add0bf5ad3a9200ced2db449b0d6e1b049d146 100644 (file)
@@ -1057,10 +1057,7 @@ static void send_warning(const struct dquot *dquot, const char warntype)
                goto attr_err_out;
        genlmsg_end(skb, msg_head);
 
-       ret = genlmsg_multicast(skb, 0, quota_genl_family.id, GFP_NOFS);
-       if (ret < 0 && ret != -ESRCH)
-               printk(KERN_ERR
-                       "VFS: Failed to send notification message: %d\n", ret);
+       genlmsg_multicast(skb, 0, quota_genl_family.id, GFP_NOFS);
        return;
 attr_err_out:
        printk(KERN_ERR "VFS: Not enough space to compose quota message!\n");
index c01e043670e21300808dcd5d58e77f19bfccd076..f6caeb1d110621e7c24c1ab0b714f5774e333a93 100644 (file)
@@ -1716,7 +1716,7 @@ static int ecryptfs_copy_filename(char **copied_name, size_t *copied_name_size,
 {
        int rc = 0;
 
-       (*copied_name) = kmalloc((name_size + 2), GFP_KERNEL);
+       (*copied_name) = kmalloc((name_size + 1), GFP_KERNEL);
        if (!(*copied_name)) {
                rc = -ENOMEM;
                goto out;
@@ -1726,7 +1726,7 @@ static int ecryptfs_copy_filename(char **copied_name, size_t *copied_name_size,
                                                 * in printing out the
                                                 * string in debug
                                                 * messages */
-       (*copied_name_size) = (name_size + 1);
+       (*copied_name_size) = name_size;
 out:
        return rc;
 }
index 0dd60a01f1b4eabcd6ff2717ad2faffe099f8f61..929b58004b7eace02d784a2a4fbba17fd02b0533 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1049,16 +1049,32 @@ EXPORT_SYMBOL(install_exec_creds);
  * - the caller must hold current->cred_exec_mutex to protect against
  *   PTRACE_ATTACH
  */
-void check_unsafe_exec(struct linux_binprm *bprm)
+void check_unsafe_exec(struct linux_binprm *bprm, struct files_struct *files)
 {
-       struct task_struct *p = current;
+       struct task_struct *p = current, *t;
+       unsigned long flags;
+       unsigned n_fs, n_files, n_sighand;
 
        bprm->unsafe = tracehook_unsafe_exec(p);
 
-       if (atomic_read(&p->fs->count) > 1 ||
-           atomic_read(&p->files->count) > 1 ||
-           atomic_read(&p->sighand->count) > 1)
+       n_fs = 1;
+       n_files = 1;
+       n_sighand = 1;
+       lock_task_sighand(p, &flags);
+       for (t = next_thread(p); t != p; t = next_thread(t)) {
+               if (t->fs == p->fs)
+                       n_fs++;
+               if (t->files == files)
+                       n_files++;
+               n_sighand++;
+       }
+
+       if (atomic_read(&p->fs->count) > n_fs ||
+           atomic_read(&p->files->count) > n_files ||
+           atomic_read(&p->sighand->count) > n_sighand)
                bprm->unsafe |= LSM_UNSAFE_SHARE;
+
+       unlock_task_sighand(p, &flags);
 }
 
 /* 
@@ -1273,7 +1289,7 @@ int do_execve(char * filename,
        bprm->cred = prepare_exec_creds();
        if (!bprm->cred)
                goto out_unlock;
-       check_unsafe_exec(bprm);
+       check_unsafe_exec(bprm, displaced);
 
        file = open_exec(filename);
        retval = PTR_ERR(file);
index da8bdeaa2e6d594aec9680bcb2bcd0aca17fdecf..7c6e3606f0ecd0d4c4efc64d262b0184b392deaa 100644 (file)
@@ -1185,9 +1185,12 @@ static int ext2_remount (struct super_block * sb, int * flags, char * data)
        es = sbi->s_es;
        if (((sbi->s_mount_opt & EXT2_MOUNT_XIP) !=
            (old_mount_opt & EXT2_MOUNT_XIP)) &&
-           invalidate_inodes(sb))
-               ext2_warning(sb, __func__, "busy inodes while remounting "\
-                            "xip remain in cache (no functional problem)");
+           invalidate_inodes(sb)) {
+               ext2_warning(sb, __func__, "refusing change of xip flag "
+                            "with busy inodes while remounting");
+               sbi->s_mount_opt &= ~EXT2_MOUNT_XIP;
+               sbi->s_mount_opt |= old_mount_opt & EXT2_MOUNT_XIP;
+       }
        if ((*flags & MS_RDONLY) == (sb->s_flags & MS_RDONLY))
                return 0;
        if (*flags & MS_RDONLY) {
index b70d90e08a3c030855ba40731fc3578d2d58db2f..4a970411a458f4534c9c4a09f0c02026a9bbc61e 100644 (file)
@@ -2428,12 +2428,13 @@ static void ext3_write_super (struct super_block * sb)
 
 static int ext3_sync_fs(struct super_block *sb, int wait)
 {
-       sb->s_dirt = 0;
-       if (wait)
-               ext3_force_commit(sb);
-       else
-               journal_start_commit(EXT3_SB(sb)->s_journal, NULL);
+       tid_t target;
 
+       sb->s_dirt = 0;
+       if (journal_start_commit(EXT3_SB(sb)->s_journal, &target)) {
+               if (wait)
+                       log_wait_commit(EXT3_SB(sb)->s_journal, target);
+       }
        return 0;
 }
 
index aafc9eba1c25c8aace126bafc56e70d058695621..b0c87dce66a32e56b40b5248a0019c380818ae5b 100644 (file)
@@ -868,7 +868,7 @@ static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
 {
        unsigned len = le16_to_cpu(dlen);
 
-       if (len == EXT4_MAX_REC_LEN)
+       if (len == EXT4_MAX_REC_LEN || len == 0)
                return 1 << 16;
        return len;
 }
index 03ba20be132997140e4dcae313dadb865149427e..cbd2ca99d11351d757f36194173ee716d89bdc4f 100644 (file)
 static inline int ext4_begin_ordered_truncate(struct inode *inode,
                                              loff_t new_size)
 {
-       return jbd2_journal_begin_ordered_truncate(&EXT4_I(inode)->jinode,
-                                                  new_size);
+       return jbd2_journal_begin_ordered_truncate(
+                                       EXT4_SB(inode->i_sb)->s_journal,
+                                       &EXT4_I(inode)->jinode,
+                                       new_size);
 }
 
 static void ext4_invalidatepage(struct page *page, unsigned long offset);
@@ -2437,6 +2439,7 @@ static int ext4_da_writepages(struct address_space *mapping,
        int no_nrwrite_index_update;
        int pages_written = 0;
        long pages_skipped;
+       int range_cyclic, cycled = 1, io_done = 0;
        int needed_blocks, ret = 0, nr_to_writebump = 0;
        struct ext4_sb_info *sbi = EXT4_SB(mapping->host->i_sb);
 
@@ -2488,9 +2491,15 @@ static int ext4_da_writepages(struct address_space *mapping,
        if (wbc->range_start == 0 && wbc->range_end == LLONG_MAX)
                range_whole = 1;
 
-       if (wbc->range_cyclic)
+       range_cyclic = wbc->range_cyclic;
+       if (wbc->range_cyclic) {
                index = mapping->writeback_index;
-       else
+               if (index)
+                       cycled = 0;
+               wbc->range_start = index << PAGE_CACHE_SHIFT;
+               wbc->range_end  = LLONG_MAX;
+               wbc->range_cyclic = 0;
+       } else
                index = wbc->range_start >> PAGE_CACHE_SHIFT;
 
        mpd.wbc = wbc;
@@ -2504,6 +2513,7 @@ static int ext4_da_writepages(struct address_space *mapping,
        wbc->no_nrwrite_index_update = 1;
        pages_skipped = wbc->pages_skipped;
 
+retry:
        while (!ret && wbc->nr_to_write > 0) {
 
                /*
@@ -2546,6 +2556,7 @@ static int ext4_da_writepages(struct address_space *mapping,
                        pages_written += mpd.pages_written;
                        wbc->pages_skipped = pages_skipped;
                        ret = 0;
+                       io_done = 1;
                } else if (wbc->nr_to_write)
                        /*
                         * There is no more writeout needed
@@ -2554,6 +2565,13 @@ static int ext4_da_writepages(struct address_space *mapping,
                         */
                        break;
        }
+       if (!io_done && !cycled) {
+               cycled = 1;
+               index = 0;
+               wbc->range_start = index << PAGE_CACHE_SHIFT;
+               wbc->range_end  = mapping->writeback_index - 1;
+               goto retry;
+       }
        if (pages_skipped != wbc->pages_skipped)
                printk(KERN_EMERG "This should not happen leaving %s "
                                "with nr_to_write = %ld ret = %d\n",
@@ -2561,6 +2579,7 @@ static int ext4_da_writepages(struct address_space *mapping,
 
        /* Update index */
        index += pages_written;
+       wbc->range_cyclic = range_cyclic;
        if (wbc->range_cyclic || (range_whole && wbc->nr_to_write > 0))
                /*
                 * set the writeback_index so that range_cyclic
index deba54f6cbed2af2d504224d2910829951e98d1c..4415beeb0b620c46611348c7092fa75c42cf2337 100644 (file)
@@ -3693,6 +3693,8 @@ ext4_mb_new_inode_pa(struct ext4_allocation_context *ac)
        pa->pa_free = pa->pa_len;
        atomic_set(&pa->pa_count, 1);
        spin_lock_init(&pa->pa_lock);
+       INIT_LIST_HEAD(&pa->pa_inode_list);
+       INIT_LIST_HEAD(&pa->pa_group_list);
        pa->pa_deleted = 0;
        pa->pa_linear = 0;
 
@@ -3755,6 +3757,7 @@ ext4_mb_new_group_pa(struct ext4_allocation_context *ac)
        atomic_set(&pa->pa_count, 1);
        spin_lock_init(&pa->pa_lock);
        INIT_LIST_HEAD(&pa->pa_inode_list);
+       INIT_LIST_HEAD(&pa->pa_group_list);
        pa->pa_deleted = 0;
        pa->pa_linear = 1;
 
@@ -4476,23 +4479,26 @@ static int ext4_mb_release_context(struct ext4_allocation_context *ac)
                        pa->pa_free -= ac->ac_b_ex.fe_len;
                        pa->pa_len -= ac->ac_b_ex.fe_len;
                        spin_unlock(&pa->pa_lock);
-                       /*
-                        * We want to add the pa to the right bucket.
-                        * Remove it from the list and while adding
-                        * make sure the list to which we are adding
-                        * doesn't grow big.
-                        */
-                       if (likely(pa->pa_free)) {
-                               spin_lock(pa->pa_obj_lock);
-                               list_del_rcu(&pa->pa_inode_list);
-                               spin_unlock(pa->pa_obj_lock);
-                               ext4_mb_add_n_trim(ac);
-                       }
                }
-               ext4_mb_put_pa(ac, ac->ac_sb, pa);
        }
        if (ac->alloc_semp)
                up_read(ac->alloc_semp);
+       if (pa) {
+               /*
+                * We want to add the pa to the right bucket.
+                * Remove it from the list and while adding
+                * make sure the list to which we are adding
+                * doesn't grow big.  We need to release
+                * alloc_semp before calling ext4_mb_add_n_trim()
+                */
+               if (pa->pa_linear && likely(pa->pa_free)) {
+                       spin_lock(pa->pa_obj_lock);
+                       list_del_rcu(&pa->pa_inode_list);
+                       spin_unlock(pa->pa_obj_lock);
+                       ext4_mb_add_n_trim(ac);
+               }
+               ext4_mb_put_pa(ac, ac->ac_sb, pa);
+       }
        if (ac->ac_bitmap_page)
                page_cache_release(ac->ac_bitmap_page);
        if (ac->ac_buddy_page)
index 734abca25e359bc4b21f3e8b67674cc9c320698a..fe64d9f79852f1dc22764cfa00f261c84858107b 100644 (file)
@@ -481,7 +481,7 @@ int ext4_ext_migrate(struct inode *inode)
                                        + 1);
        if (IS_ERR(handle)) {
                retval = PTR_ERR(handle);
-               goto err_out;
+               return retval;
        }
        tmp_inode = ext4_new_inode(handle,
                                inode->i_sb->s_root->d_inode,
@@ -489,8 +489,7 @@ int ext4_ext_migrate(struct inode *inode)
        if (IS_ERR(tmp_inode)) {
                retval = -ENOMEM;
                ext4_journal_stop(handle);
-               tmp_inode = NULL;
-               goto err_out;
+               return retval;
        }
        i_size_write(tmp_inode, i_size_read(inode));
        /*
@@ -618,8 +617,7 @@ err_out:
 
        ext4_journal_stop(handle);
 
-       if (tmp_inode)
-               iput(tmp_inode);
+       iput(tmp_inode);
 
        return retval;
 }
index e5f06a5f045ee72ed825748d760485ec8739240f..a5732c58f676747554a7b1c6da9a0c5e6787eb7b 100644 (file)
@@ -3046,14 +3046,17 @@ static void ext4_write_super(struct super_block *sb)
 static int ext4_sync_fs(struct super_block *sb, int wait)
 {
        int ret = 0;
+       tid_t target;
 
        trace_mark(ext4_sync_fs, "dev %s wait %d", sb->s_id, wait);
        sb->s_dirt = 0;
        if (EXT4_SB(sb)->s_journal) {
-               if (wait)
-                       ret = ext4_force_commit(sb);
-               else
-                       jbd2_journal_start_commit(EXT4_SB(sb)->s_journal, NULL);
+               if (jbd2_journal_start_commit(EXT4_SB(sb)->s_journal,
+                                             &target)) {
+                       if (wait)
+                               jbd2_log_wait_commit(EXT4_SB(sb)->s_journal,
+                                                    target);
+               }
        } else {
                ext4_commit_super(sb, EXT4_SB(sb)->s_es, wait);
        }
index 6903d37af0371d4befd7484fbc2e747c1d6c2f51..9b800d97a68771b2299e978ebfdb003476e1c075 100644 (file)
@@ -108,7 +108,8 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
 
        if (hugetlb_reserve_pages(inode,
                                vma->vm_pgoff >> huge_page_order(h),
-                               len >> huge_page_shift(h), vma))
+                               len >> huge_page_shift(h), vma,
+                               vma->vm_flags))
                goto out;
 
        ret = 0;
@@ -947,7 +948,7 @@ static int can_do_hugetlb_shm(void)
                        can_do_mlock());
 }
 
-struct file *hugetlb_file_setup(const char *name, size_t size)
+struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag)
 {
        int error = -ENOMEM;
        struct file *file;
@@ -981,7 +982,8 @@ struct file *hugetlb_file_setup(const char *name, size_t size)
 
        error = -ENOMEM;
        if (hugetlb_reserve_pages(inode, 0,
-                       size >> huge_page_shift(hstate_inode(inode)), NULL))
+                       size >> huge_page_shift(hstate_inode(inode)), NULL,
+                       acctflag))
                goto out_inode;
 
        d_instantiate(dentry, inode);
index 53af885f173243df3a5bf0906b589edccece84db..0d8ac497b3d552315b56e53c95f3f0440f59e45d 100644 (file)
@@ -43,7 +43,7 @@ extern void __init chrdev_init(void);
 /*
  * exec.c
  */
-extern void check_unsafe_exec(struct linux_binprm *);
+extern void check_unsafe_exec(struct linux_binprm *, struct files_struct *);
 
 /*
  * namespace.c
index 9e4fa52d7dc8df62527eb1fb9b141f7db3b37d10..e79c07812afa4d044ec46bc92d77ba8f759aacb4 100644 (file)
@@ -427,7 +427,7 @@ int __log_space_left(journal_t *journal)
 }
 
 /*
- * Called under j_state_lock.  Returns true if a transaction was started.
+ * Called under j_state_lock.  Returns true if a transaction commit was started.
  */
 int __log_start_commit(journal_t *journal, tid_t target)
 {
@@ -495,7 +495,8 @@ int journal_force_commit_nested(journal_t *journal)
 
 /*
  * Start a commit of the current running transaction (if any).  Returns true
- * if a transaction was started, and fills its tid in at *ptid
+ * if a transaction is going to be committed (or is currently already
+ * committing), and fills its tid in at *ptid
  */
 int journal_start_commit(journal_t *journal, tid_t *ptid)
 {
@@ -505,15 +506,19 @@ int journal_start_commit(journal_t *journal, tid_t *ptid)
        if (journal->j_running_transaction) {
                tid_t tid = journal->j_running_transaction->t_tid;
 
-               ret = __log_start_commit(journal, tid);
-               if (ret && ptid)
+               __log_start_commit(journal, tid);
+               /* There's a running transaction and we've just made sure
+                * it's commit has been scheduled. */
+               if (ptid)
                        *ptid = tid;
-       } else if (journal->j_committing_transaction && ptid) {
+               ret = 1;
+       } else if (journal->j_committing_transaction) {
                /*
                 * If ext3_write_super() recently started a commit, then we
                 * have to wait for completion of that transaction
                 */
-               *ptid = journal->j_committing_transaction->t_tid;
+               if (ptid)
+                       *ptid = journal->j_committing_transaction->t_tid;
                ret = 1;
        }
        spin_unlock(&journal->j_state_lock);
index eb343008eded0fd86851417f60717650dda96857..58144102bf253b2244fee8fe44ce1a7c02cfbc79 100644 (file)
@@ -450,7 +450,7 @@ int __jbd2_log_space_left(journal_t *journal)
 }
 
 /*
- * Called under j_state_lock.  Returns true if a transaction was started.
+ * Called under j_state_lock.  Returns true if a transaction commit was started.
  */
 int __jbd2_log_start_commit(journal_t *journal, tid_t target)
 {
@@ -518,7 +518,8 @@ int jbd2_journal_force_commit_nested(journal_t *journal)
 
 /*
  * Start a commit of the current running transaction (if any).  Returns true
- * if a transaction was started, and fills its tid in at *ptid
+ * if a transaction is going to be committed (or is currently already
+ * committing), and fills its tid in at *ptid
  */
 int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
 {
@@ -528,15 +529,19 @@ int jbd2_journal_start_commit(journal_t *journal, tid_t *ptid)
        if (journal->j_running_transaction) {
                tid_t tid = journal->j_running_transaction->t_tid;
 
-               ret = __jbd2_log_start_commit(journal, tid);
-               if (ret && ptid)
+               __jbd2_log_start_commit(journal, tid);
+               /* There's a running transaction and we've just made sure
+                * it's commit has been scheduled. */
+               if (ptid)
                        *ptid = tid;
-       } else if (journal->j_committing_transaction && ptid) {
+               ret = 1;
+       } else if (journal->j_committing_transaction) {
                /*
                 * If ext3_write_super() recently started a commit, then we
                 * have to wait for completion of that transaction
                 */
-               *ptid = journal->j_committing_transaction->t_tid;
+               if (ptid)
+                       *ptid = journal->j_committing_transaction->t_tid;
                ret = 1;
        }
        spin_unlock(&journal->j_state_lock);
index 46b4e347ed7d9f3949df7b2b475bda7d7f2b8fef..28ce21d8598e11f16182a973d31d7e8bef83c145 100644 (file)
@@ -2129,26 +2129,46 @@ done:
 }
 
 /*
- * This function must be called when inode is journaled in ordered mode
- * before truncation happens. It starts writeout of truncated part in
- * case it is in the committing transaction so that we stand to ordered
- * mode consistency guarantees.
+ * File truncate and transaction commit interact with each other in a
+ * non-trivial way.  If a transaction writing data block A is
+ * committing, we cannot discard the data by truncate until we have
+ * written them.  Otherwise if we crashed after the transaction with
+ * write has committed but before the transaction with truncate has
+ * committed, we could see stale data in block A.  This function is a
+ * helper to solve this problem.  It starts writeout of the truncated
+ * part in case it is in the committing transaction.
+ *
+ * Filesystem code must call this function when inode is journaled in
+ * ordered mode before truncation happens and after the inode has been
+ * placed on orphan list with the new inode size. The second condition
+ * avoids the race that someone writes new data and we start
+ * committing the transaction after this function has been called but
+ * before a transaction for truncate is started (and furthermore it
+ * allows us to optimize the case where the addition to orphan list
+ * happens in the same transaction as write --- we don't have to write
+ * any data in such case).
  */
-int jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode,
+int jbd2_journal_begin_ordered_truncate(journal_t *journal,
+                                       struct jbd2_inode *jinode,
                                        loff_t new_size)
 {
-       journal_t *journal;
-       transaction_t *commit_trans;
+       transaction_t *inode_trans, *commit_trans;
        int ret = 0;
 
-       if (!inode->i_transaction && !inode->i_next_transaction)
+       /* This is a quick check to avoid locking if not necessary */
+       if (!jinode->i_transaction)
                goto out;
-       journal = inode->i_transaction->t_journal;
+       /* Locks are here just to force reading of recent values, it is
+        * enough that the transaction was not committing before we started
+        * a transaction adding the inode to orphan list */
        spin_lock(&journal->j_state_lock);
        commit_trans = journal->j_committing_transaction;
        spin_unlock(&journal->j_state_lock);
-       if (inode->i_transaction == commit_trans) {
-               ret = filemap_fdatawrite_range(inode->i_vfs_inode->i_mapping,
+       spin_lock(&journal->j_list_lock);
+       inode_trans = jinode->i_transaction;
+       spin_unlock(&journal->j_list_lock);
+       if (inode_trans == commit_trans) {
+               ret = filemap_fdatawrite_range(jinode->i_vfs_inode->i_mapping,
                        new_size, LLONG_MAX);
                if (ret)
                        jbd2_journal_abort(journal, ret);
index 6063a8e4b9f3223104843bce393882181b890539..763b78a6e9de41dc9b6c5c0fb6bd438563f14c14 100644 (file)
@@ -427,7 +427,7 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
                        goto out;
                case -EAGAIN:
                        ret = nlm_lck_denied;
-                       goto out;
+                       break;
                case FILE_LOCK_DEFERRED:
                        if (wait)
                                break;
@@ -443,6 +443,10 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
                        goto out;
        }
 
+       ret = nlm_lck_denied;
+       if (!wait)
+               goto out;
+
        ret = nlm_lck_blocked;
 
        /* Append to list of blocked */
index 228d8c4bfd18a1925fd57ac3880e2e47031470d2..06f8e63f6cb1dc929e0ad9c0627320066db57cb1 100644 (file)
@@ -614,9 +614,11 @@ static inline void __mntput(struct vfsmount *mnt)
         */
        for_each_possible_cpu(cpu) {
                struct mnt_writer *cpu_writer = &per_cpu(mnt_writers, cpu);
-               if (cpu_writer->mnt != mnt)
-                       continue;
                spin_lock(&cpu_writer->lock);
+               if (cpu_writer->mnt != mnt) {
+                       spin_unlock(&cpu_writer->lock);
+                       continue;
+               }
                atomic_add(cpu_writer->count, &mnt->__mnt_writers);
                cpu_writer->count = 0;
                /*
index dae3f28f30d4779ee69cc8780d8424818b0fbfa4..331f2e88e284e44e373cbda23ab41a024c01c6b1 100644 (file)
@@ -156,7 +156,7 @@ static int inotify_handle_get_wd(struct inotify_handle *ih,
        int ret;
 
        do {
-               if (unlikely(!idr_pre_get(&ih->idr, GFP_KERNEL)))
+               if (unlikely(!idr_pre_get(&ih->idr, GFP_NOFS)))
                        return -ENOSPC;
                ret = idr_get_new_above(&ih->idr, watch, ih->last_wd+1, &watch->wd);
        } while (ret == -EAGAIN);
index d861096c9d81cbd643618377a7b7c9831c524cd9..60fe74035db5745fb541bdcc6983d3bb442e17ce 100644 (file)
@@ -5390,6 +5390,9 @@ int ocfs2_remove_btree_range(struct inode *inode,
                goto out;
        }
 
+       vfs_dq_free_space_nodirty(inode,
+                                 ocfs2_clusters_to_bytes(inode->i_sb, len));
+
        ret = ocfs2_remove_extent(inode, et, cpos, len, handle, meta_ac,
                                  dealloc);
        if (ret) {
index b1cc7c381e889b5d898ad5f3e2a9bddeb9b39fd1..e9d7c2038c0f55c1f0cf48386a2f6eed12a2d805 100644 (file)
@@ -38,6 +38,7 @@
 #include "dlmglue.h"
 #include "file.h"
 #include "inode.h"
+#include "super.h"
 
 
 static int ocfs2_dentry_revalidate(struct dentry *dentry,
@@ -294,6 +295,34 @@ out_attach:
        return ret;
 }
 
+static DEFINE_SPINLOCK(dentry_list_lock);
+
+/* We limit the number of dentry locks to drop in one go. We have
+ * this limit so that we don't starve other users of ocfs2_wq. */
+#define DL_INODE_DROP_COUNT 64
+
+/* Drop inode references from dentry locks */
+void ocfs2_drop_dl_inodes(struct work_struct *work)
+{
+       struct ocfs2_super *osb = container_of(work, struct ocfs2_super,
+                                              dentry_lock_work);
+       struct ocfs2_dentry_lock *dl;
+       int drop_count = DL_INODE_DROP_COUNT;
+
+       spin_lock(&dentry_list_lock);
+       while (osb->dentry_lock_list && drop_count--) {
+               dl = osb->dentry_lock_list;
+               osb->dentry_lock_list = dl->dl_next;
+               spin_unlock(&dentry_list_lock);
+               iput(dl->dl_inode);
+               kfree(dl);
+               spin_lock(&dentry_list_lock);
+       }
+       if (osb->dentry_lock_list)
+               queue_work(ocfs2_wq, &osb->dentry_lock_work);
+       spin_unlock(&dentry_list_lock);
+}
+
 /*
  * ocfs2_dentry_iput() and friends.
  *
@@ -318,16 +347,23 @@ out_attach:
 static void ocfs2_drop_dentry_lock(struct ocfs2_super *osb,
                                   struct ocfs2_dentry_lock *dl)
 {
-       iput(dl->dl_inode);
        ocfs2_simple_drop_lockres(osb, &dl->dl_lockres);
        ocfs2_lock_res_free(&dl->dl_lockres);
-       kfree(dl);
+
+       /* We leave dropping of inode reference to ocfs2_wq as that can
+        * possibly lead to inode deletion which gets tricky */
+       spin_lock(&dentry_list_lock);
+       if (!osb->dentry_lock_list)
+               queue_work(ocfs2_wq, &osb->dentry_lock_work);
+       dl->dl_next = osb->dentry_lock_list;
+       osb->dentry_lock_list = dl;
+       spin_unlock(&dentry_list_lock);
 }
 
 void ocfs2_dentry_lock_put(struct ocfs2_super *osb,
                           struct ocfs2_dentry_lock *dl)
 {
-       int unlock = 0;
+       int unlock;
 
        BUG_ON(dl->dl_count == 0);
 
index c091c34d9883d25dcc2084371d664e0c93b4de2b..d06e16c0664061d7ea7bf4bb319242a890eef68a 100644 (file)
 extern struct dentry_operations ocfs2_dentry_ops;
 
 struct ocfs2_dentry_lock {
+       /* Use count of dentry lock */
        unsigned int            dl_count;
-       u64                     dl_parent_blkno;
+       union {
+               /* Linked list of dentry locks to release */
+               struct ocfs2_dentry_lock *dl_next;
+               u64                     dl_parent_blkno;
+       };
 
        /*
         * The ocfs2_dentry_lock keeps an inode reference until
@@ -47,6 +52,8 @@ int ocfs2_dentry_attach_lock(struct dentry *dentry, struct inode *inode,
 void ocfs2_dentry_lock_put(struct ocfs2_super *osb,
                           struct ocfs2_dentry_lock *dl);
 
+void ocfs2_drop_dl_inodes(struct work_struct *work);
+
 struct dentry *ocfs2_find_local_alias(struct inode *inode, u64 parent_blkno,
                                      int skip_unhashed);
 
index b0c4cadd4c45181f7d8d02f1af11a182e2f380dd..206a2370876a8c82f4c6ad04f101a7d801be6e5b 100644 (file)
@@ -2860,6 +2860,10 @@ static void ocfs2_unlock_ast(void *opaque, int error)
        case OCFS2_UNLOCK_CANCEL_CONVERT:
                mlog(0, "Cancel convert success for %s\n", lockres->l_name);
                lockres->l_action = OCFS2_AST_INVALID;
+               /* Downconvert thread may have requeued this lock, we
+                * need to wake it. */
+               if (lockres->l_flags & OCFS2_LOCK_BLOCKED)
+                       ocfs2_wake_downconvert_thread(ocfs2_get_lockres_osb(lockres));
                break;
        case OCFS2_UNLOCK_DROP_LOCK:
                lockres->l_level = DLM_LOCK_IV;
index 3c3532e1307c838495b60e52d9eb9eada0ab69fd..172850a9a12a7d78cc115e80500979673f4ae7f5 100644 (file)
@@ -513,8 +513,10 @@ static inline int ocfs2_jbd2_file_inode(handle_t *handle, struct inode *inode)
 static inline int ocfs2_begin_ordered_truncate(struct inode *inode,
                                               loff_t new_size)
 {
-       return jbd2_journal_begin_ordered_truncate(&OCFS2_I(inode)->ip_jinode,
-                                                  new_size);
+       return jbd2_journal_begin_ordered_truncate(
+                               OCFS2_SB(inode->i_sb)->journal->j_journal,
+                               &OCFS2_I(inode)->ip_jinode,
+                               new_size);
 }
 
 #endif /* OCFS2_JOURNAL_H */
index ad5c24a29edd6d91db671390922c336651bd8d40..077384135f4ea763cd30105b9df51521b9565227 100644 (file)
@@ -210,6 +210,7 @@ struct ocfs2_journal;
 struct ocfs2_slot_info;
 struct ocfs2_recovery_map;
 struct ocfs2_quota_recovery;
+struct ocfs2_dentry_lock;
 struct ocfs2_super
 {
        struct task_struct *commit_task;
@@ -325,6 +326,11 @@ struct ocfs2_super
        struct list_head blocked_lock_list;
        unsigned long blocked_lock_count;
 
+       /* List of dentry locks to release. Anyone can add locks to
+        * the list, ocfs2_wq processes the list  */
+       struct ocfs2_dentry_lock *dentry_lock_list;
+       struct work_struct dentry_lock_work;
+
        wait_queue_head_t               osb_mount_event;
 
        /* Truncate log info */
index f4efa89baee54d8493d886b9afbaec19a8e29ad4..1ed0f7c868697c47c447ee611175f067def508dd 100644 (file)
@@ -754,7 +754,9 @@ static int ocfs2_mark_dquot_dirty(struct dquot *dquot)
        if (dquot->dq_flags & mask)
                sync = 1;
        spin_unlock(&dq_data_lock);
-       if (!sync) {
+       /* This is a slight hack but we can't afford getting global quota
+        * lock if we already have a transaction started. */
+       if (!sync || journal_current_handle()) {
                status = ocfs2_write_dquot(dquot);
                goto out;
        }
index 43ed11345b59fdf7ac8c00596b14491a4e89eb20..b1cb38fbe80706817a2fdf6be8dda71f348eb568 100644 (file)
@@ -1887,6 +1887,9 @@ static int ocfs2_initialize_super(struct super_block *sb,
        INIT_WORK(&journal->j_recovery_work, ocfs2_complete_recovery);
        journal->j_state = OCFS2_JOURNAL_FREE;
 
+       INIT_WORK(&osb->dentry_lock_work, ocfs2_drop_dl_inodes);
+       osb->dentry_lock_list = NULL;
+
        /* get some pseudo constants for clustersize bits */
        osb->s_clustersize_bits =
                le32_to_cpu(di->id2.i_super.s_clustersize_bits);
index e1d638af6ac3d00d8cb72a5b9b442c3bdfb8e3f0..915039fffe6ed37149a47d1929929f79b0865d5c 100644 (file)
@@ -4729,13 +4729,6 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
        vb.vb_xv = (struct ocfs2_xattr_value_root *)
                (vb.vb_bh->b_data + offset % blocksize);
 
-       ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket,
-                                               OCFS2_JOURNAL_ACCESS_WRITE);
-       if (ret) {
-               mlog_errno(ret);
-               goto out;
-       }
-
        /*
         * From here on out we have to dirty the bucket.  The generic
         * value calls only modify one of the bucket's bhs, but we need
@@ -4748,12 +4741,18 @@ static int ocfs2_xattr_bucket_value_truncate(struct inode *inode,
        ret = ocfs2_xattr_value_truncate(inode, &vb, len, ctxt);
        if (ret) {
                mlog_errno(ret);
-               goto out_dirty;
+               goto out;
+       }
+
+       ret = ocfs2_xattr_bucket_journal_access(ctxt->handle, bucket,
+                                               OCFS2_JOURNAL_ACCESS_WRITE);
+       if (ret) {
+               mlog_errno(ret);
+               goto out;
        }
 
        xe->xe_value_size = cpu_to_le64(len);
 
-out_dirty:
        ocfs2_xattr_bucket_journal_dirty(ctxt->handle, bucket);
 
 out:
index 3e76bb9b3ad668d8ceab574a8f6d7d4a5f2e6ef6..d8bb5c671f420a83c17c740425e6f71f9d85799e 100644 (file)
@@ -485,8 +485,10 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
                        }
                }
                unlock_new_inode(inode);
-       } else
+       } else {
               module_put(de->owner);
+              de_put(de);
+       }
        return inode;
 
 out_ino:
index b569ff1c4dc81570bec822be5df54069af18a162..a1a4cfe1921040d6044657e6c235e2f5d55f8292 100644 (file)
@@ -48,12 +48,78 @@ int seq_open(struct file *file, const struct seq_operations *op)
         */
        file->f_version = 0;
 
-       /* SEQ files support lseek, but not pread/pwrite */
-       file->f_mode &= ~(FMODE_PREAD | FMODE_PWRITE);
+       /*
+        * seq_files support lseek() and pread().  They do not implement
+        * write() at all, but we clear FMODE_PWRITE here for historical
+        * reasons.
+        *
+        * If a client of seq_files a) implements file.write() and b) wishes to
+        * support pwrite() then that client will need to implement its own
+        * file.open() which calls seq_open() and then sets FMODE_PWRITE.
+        */
+       file->f_mode &= ~FMODE_PWRITE;
        return 0;
 }
 EXPORT_SYMBOL(seq_open);
 
+static int traverse(struct seq_file *m, loff_t offset)
+{
+       loff_t pos = 0, index;
+       int error = 0;
+       void *p;
+
+       m->version = 0;
+       index = 0;
+       m->count = m->from = 0;
+       if (!offset) {
+               m->index = index;
+               return 0;
+       }
+       if (!m->buf) {
+               m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
+               if (!m->buf)
+                       return -ENOMEM;
+       }
+       p = m->op->start(m, &index);
+       while (p) {
+               error = PTR_ERR(p);
+               if (IS_ERR(p))
+                       break;
+               error = m->op->show(m, p);
+               if (error < 0)
+                       break;
+               if (unlikely(error)) {
+                       error = 0;
+                       m->count = 0;
+               }
+               if (m->count == m->size)
+                       goto Eoverflow;
+               if (pos + m->count > offset) {
+                       m->from = offset - pos;
+                       m->count -= m->from;
+                       m->index = index;
+                       break;
+               }
+               pos += m->count;
+               m->count = 0;
+               if (pos == offset) {
+                       index++;
+                       m->index = index;
+                       break;
+               }
+               p = m->op->next(m, p, &index);
+       }
+       m->op->stop(m, p);
+       m->index = index;
+       return error;
+
+Eoverflow:
+       m->op->stop(m, p);
+       kfree(m->buf);
+       m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
+       return !m->buf ? -ENOMEM : -EAGAIN;
+}
+
 /**
  *     seq_read -      ->read() method for sequential files.
  *     @file: the file to read from
@@ -73,6 +139,22 @@ ssize_t seq_read(struct file *file, char __user *buf, size_t size, loff_t *ppos)
        int err = 0;
 
        mutex_lock(&m->lock);
+
+       /* Don't assume *ppos is where we left it */
+       if (unlikely(*ppos != m->read_pos)) {
+               m->read_pos = *ppos;
+               while ((err = traverse(m, *ppos)) == -EAGAIN)
+                       ;
+               if (err) {
+                       /* With prejudice... */
+                       m->read_pos = 0;
+                       m->version = 0;
+                       m->index = 0;
+                       m->count = 0;
+                       goto Done;
+               }
+       }
+
        /*
         * seq_file->op->..m_start/m_stop/m_next may do special actions
         * or optimisations based on the file->f_version, so we want to
@@ -172,8 +254,10 @@ Fill:
 Done:
        if (!copied)
                copied = err;
-       else
+       else {
                *ppos += copied;
+               m->read_pos += copied;
+       }
        file->f_version = m->version;
        mutex_unlock(&m->lock);
        return copied;
@@ -186,63 +270,6 @@ Efault:
 }
 EXPORT_SYMBOL(seq_read);
 
-static int traverse(struct seq_file *m, loff_t offset)
-{
-       loff_t pos = 0, index;
-       int error = 0;
-       void *p;
-
-       m->version = 0;
-       index = 0;
-       m->count = m->from = 0;
-       if (!offset) {
-               m->index = index;
-               return 0;
-       }
-       if (!m->buf) {
-               m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
-               if (!m->buf)
-                       return -ENOMEM;
-       }
-       p = m->op->start(m, &index);
-       while (p) {
-               error = PTR_ERR(p);
-               if (IS_ERR(p))
-                       break;
-               error = m->op->show(m, p);
-               if (error < 0)
-                       break;
-               if (unlikely(error)) {
-                       error = 0;
-                       m->count = 0;
-               }
-               if (m->count == m->size)
-                       goto Eoverflow;
-               if (pos + m->count > offset) {
-                       m->from = offset - pos;
-                       m->count -= m->from;
-                       m->index = index;
-                       break;
-               }
-               pos += m->count;
-               m->count = 0;
-               if (pos == offset) {
-                       index++;
-                       m->index = index;
-                       break;
-               }
-               p = m->op->next(m, p, &index);
-       }
-       m->op->stop(m, p);
-       return error;
-
-Eoverflow:
-       m->op->stop(m, p);
-       kfree(m->buf);
-       m->buf = kmalloc(m->size <<= 1, GFP_KERNEL);
-       return !m->buf ? -ENOMEM : -EAGAIN;
-}
-
 /**
  *     seq_lseek -     ->llseek() method for sequential files.
  *     @file: the file in question
@@ -265,16 +292,18 @@ loff_t seq_lseek(struct file *file, loff_t offset, int origin)
                        if (offset < 0)
                                break;
                        retval = offset;
-                       if (offset != file->f_pos) {
+                       if (offset != m->read_pos) {
                                while ((retval=traverse(m, offset)) == -EAGAIN)
                                        ;
                                if (retval) {
                                        /* with extreme prejudice... */
                                        file->f_pos = 0;
+                                       m->read_pos = 0;
                                        m->version = 0;
                                        m->index = 0;
                                        m->count = 0;
                                } else {
+                                       m->read_pos = offset;
                                        retval = file->f_pos = offset;
                                }
                        }
index 645e5403f2a0da0b4ed97cd6b6499791c732338d..8349ed6b1412aa13e9f23d17fad91e66c9ec1915 100644 (file)
@@ -82,7 +82,22 @@ static struct super_block *alloc_super(struct file_system_type *type)
                 * lock ordering than usbfs:
                 */
                lockdep_set_class(&s->s_lock, &type->s_lock_key);
-               down_write(&s->s_umount);
+               /*
+                * sget() can have s_umount recursion.
+                *
+                * When it cannot find a suitable sb, it allocates a new
+                * one (this one), and tries again to find a suitable old
+                * one.
+                *
+                * In case that succeeds, it will acquire the s_umount
+                * lock of the old one. Since these are clearly distrinct
+                * locks, and this object isn't exposed yet, there's no
+                * risk of deadlocks.
+                *
+                * Annotate this by putting this lock in a different
+                * subclass.
+                */
+               down_write_nested(&s->s_umount, SINGLE_DEPTH_NESTING);
                s->s_count = S_BIAS;
                atomic_set(&s->s_active, 1);
                mutex_init(&s->s_vfs_rename_mutex);
@@ -301,7 +316,7 @@ void generic_shutdown_super(struct super_block *sb)
                /*
                 * wait for asynchronous fs operations to finish before going further
                 */
-               async_synchronize_full_special(&sb->s_async_list);
+               async_synchronize_full_domain(&sb->s_async_list);
 
                /* bad name - it should be evict_inodes() */
                invalidate_inodes(sb);
@@ -470,7 +485,7 @@ restart:
                sb->s_count++;
                spin_unlock(&sb_lock);
                down_read(&sb->s_umount);
-               async_synchronize_full_special(&sb->s_async_list);
+               async_synchronize_full_domain(&sb->s_async_list);
                if (sb->s_root && (wait || sb->s_dirt))
                        sb->s_op->sync_fs(sb, wait);
                up_read(&sb->s_umount);
index 6a123b8ff3f5605735255f7ccaf084af547743dd..b042bd7034b1fc74d6cd6399e24b3a2057689a2f 100644 (file)
@@ -186,10 +186,9 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
        BUILD_BUG_ON(TFD_CLOEXEC != O_CLOEXEC);
        BUILD_BUG_ON(TFD_NONBLOCK != O_NONBLOCK);
 
-       if (flags & ~(TFD_CLOEXEC | TFD_NONBLOCK))
-               return -EINVAL;
-       if (clockid != CLOCK_MONOTONIC &&
-           clockid != CLOCK_REALTIME)
+       if ((flags & ~TFD_CREATE_FLAGS) ||
+           (clockid != CLOCK_MONOTONIC &&
+            clockid != CLOCK_REALTIME))
                return -EINVAL;
 
        ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
@@ -201,7 +200,7 @@ SYSCALL_DEFINE2(timerfd_create, int, clockid, int, flags)
        hrtimer_init(&ctx->tmr, clockid, HRTIMER_MODE_ABS);
 
        ufd = anon_inode_getfd("[timerfd]", &timerfd_fops, ctx,
-                              flags & (O_CLOEXEC | O_NONBLOCK));
+                              flags & TFD_SHARED_FCNTL_FLAGS);
        if (ufd < 0)
                kfree(ctx);
 
@@ -219,7 +218,8 @@ SYSCALL_DEFINE4(timerfd_settime, int, ufd, int, flags,
        if (copy_from_user(&ktmr, utmr, sizeof(ktmr)))
                return -EFAULT;
 
-       if (!timespec_valid(&ktmr.it_value) ||
+       if ((flags & ~TFD_SETTIME_FLAGS) ||
+           !timespec_valid(&ktmr.it_value) ||
            !timespec_valid(&ktmr.it_interval))
                return -EINVAL;
 
index 175f9c590b7717cbe0fc8170683a7edc9a602611..f393620890ee4dfd8cb4c2bde0e32dce25390635 100644 (file)
@@ -689,7 +689,7 @@ long long ubifs_reported_space(const struct ubifs_info *c, long long free)
 }
 
 /**
- * ubifs_get_free_space - return amount of free space.
+ * ubifs_get_free_space_nolock - return amount of free space.
  * @c: UBIFS file-system description object
  *
  * This function calculates amount of free space to report to user-space.
@@ -704,16 +704,14 @@ long long ubifs_reported_space(const struct ubifs_info *c, long long free)
  * traditional file-systems, because they have way less overhead than UBIFS.
  * So, to keep users happy, UBIFS tries to take the overhead into account.
  */
-long long ubifs_get_free_space(struct ubifs_info *c)
+long long ubifs_get_free_space_nolock(struct ubifs_info *c)
 {
-       int min_idx_lebs, rsvd_idx_lebs, lebs;
+       int rsvd_idx_lebs, lebs;
        long long available, outstanding, free;
 
-       spin_lock(&c->space_lock);
-       min_idx_lebs = c->min_idx_lebs;
-       ubifs_assert(min_idx_lebs == ubifs_calc_min_idx_lebs(c));
+       ubifs_assert(c->min_idx_lebs == ubifs_calc_min_idx_lebs(c));
        outstanding = c->budg_data_growth + c->budg_dd_growth;
-       available = ubifs_calc_available(c, min_idx_lebs);
+       available = ubifs_calc_available(c, c->min_idx_lebs);
 
        /*
         * When reporting free space to user-space, UBIFS guarantees that it is
@@ -726,15 +724,14 @@ long long ubifs_get_free_space(struct ubifs_info *c)
         * Note, the calculations below are similar to what we have in
         * 'do_budget_space()', so refer there for comments.
         */
-       if (min_idx_lebs > c->lst.idx_lebs)
-               rsvd_idx_lebs = min_idx_lebs - c->lst.idx_lebs;
+       if (c->min_idx_lebs > c->lst.idx_lebs)
+               rsvd_idx_lebs = c->min_idx_lebs - c->lst.idx_lebs;
        else
                rsvd_idx_lebs = 0;
        lebs = c->lst.empty_lebs + c->freeable_cnt + c->idx_gc_cnt -
               c->lst.taken_empty_lebs;
        lebs -= rsvd_idx_lebs;
        available += lebs * (c->dark_wm - c->leb_overhead);
-       spin_unlock(&c->space_lock);
 
        if (available > outstanding)
                free = ubifs_reported_space(c, available - outstanding);
@@ -742,3 +739,21 @@ long long ubifs_get_free_space(struct ubifs_info *c)
                free = 0;
        return free;
 }
+
+/**
+ * ubifs_get_free_space - return amount of free space.
+ * @c: UBIFS file-system description object
+ *
+ * This function calculates and retuns amount of free space to report to
+ * user-space.
+ */
+long long ubifs_get_free_space(struct ubifs_info *c)
+{
+       long long free;
+
+       spin_lock(&c->space_lock);
+       free = ubifs_get_free_space_nolock(c);
+       spin_unlock(&c->space_lock);
+
+       return free;
+}
index 792c5a16c182e6b4f501e85041c7144e444370e8..e975bd82f38b8d31d6a4ae4b25a587b6c5494318 100644 (file)
@@ -620,9 +620,11 @@ void dbg_dump_budg(struct ubifs_info *c)
               c->dark_wm, c->dead_wm, c->max_idx_node_sz);
        printk(KERN_DEBUG "\tgc_lnum %d, ihead_lnum %d\n",
               c->gc_lnum, c->ihead_lnum);
-       for (i = 0; i < c->jhead_cnt; i++)
-               printk(KERN_DEBUG "\tjhead %d\t LEB %d\n",
-                      c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum);
+       /* If we are in R/O mode, journal heads do not exist */
+       if (c->jheads)
+               for (i = 0; i < c->jhead_cnt; i++)
+                       printk(KERN_DEBUG "\tjhead %d\t LEB %d\n",
+                              c->jheads[i].wbuf.jhead, c->jheads[i].wbuf.lnum);
        for (rb = rb_first(&c->buds); rb; rb = rb_next(rb)) {
                bud = rb_entry(rb, struct ubifs_bud, rb);
                printk(KERN_DEBUG "\tbud LEB %d\n", bud->lnum);
@@ -637,10 +639,7 @@ void dbg_dump_budg(struct ubifs_info *c)
        /* Print budgeting predictions */
        available = ubifs_calc_available(c, c->min_idx_lebs);
        outstanding = c->budg_data_growth + c->budg_dd_growth;
-       if (available > outstanding)
-               free = ubifs_reported_space(c, available - outstanding);
-       else
-               free = 0;
+       free = ubifs_get_free_space_nolock(c);
        printk(KERN_DEBUG "Budgeting predictions:\n");
        printk(KERN_DEBUG "\tavailable: %lld, outstanding %lld, free %lld\n",
               available, outstanding, free);
@@ -860,6 +859,65 @@ void dbg_dump_index(struct ubifs_info *c)
        dbg_walk_index(c, NULL, dump_znode, NULL);
 }
 
+/**
+ * dbg_save_space_info - save information about flash space.
+ * @c: UBIFS file-system description object
+ *
+ * This function saves information about UBIFS free space, dirty space, etc, in
+ * order to check it later.
+ */
+void dbg_save_space_info(struct ubifs_info *c)
+{
+       struct ubifs_debug_info *d = c->dbg;
+
+       ubifs_get_lp_stats(c, &d->saved_lst);
+
+       spin_lock(&c->space_lock);
+       d->saved_free = ubifs_get_free_space_nolock(c);
+       spin_unlock(&c->space_lock);
+}
+
+/**
+ * dbg_check_space_info - check flash space information.
+ * @c: UBIFS file-system description object
+ *
+ * This function compares current flash space information with the information
+ * which was saved when the 'dbg_save_space_info()' function was called.
+ * Returns zero if the information has not changed, and %-EINVAL it it has
+ * changed.
+ */
+int dbg_check_space_info(struct ubifs_info *c)
+{
+       struct ubifs_debug_info *d = c->dbg;
+       struct ubifs_lp_stats lst;
+       long long avail, free;
+
+       spin_lock(&c->space_lock);
+       avail = ubifs_calc_available(c, c->min_idx_lebs);
+       spin_unlock(&c->space_lock);
+       free = ubifs_get_free_space(c);
+
+       if (free != d->saved_free) {
+               ubifs_err("free space changed from %lld to %lld",
+                         d->saved_free, free);
+               goto out;
+       }
+
+       return 0;
+
+out:
+       ubifs_msg("saved lprops statistics dump");
+       dbg_dump_lstats(&d->saved_lst);
+       ubifs_get_lp_stats(c, &lst);
+       ubifs_msg("current lprops statistics dump");
+       dbg_dump_lstats(&d->saved_lst);
+       spin_lock(&c->space_lock);
+       dbg_dump_budg(c);
+       spin_unlock(&c->space_lock);
+       dump_stack();
+       return -EINVAL;
+}
+
 /**
  * dbg_check_synced_i_size - check synchronized inode size.
  * @inode: inode to check
@@ -1349,7 +1407,7 @@ int dbg_check_tnc(struct ubifs_info *c, int extra)
  * @c: UBIFS file-system description object
  * @leaf_cb: called for each leaf node
  * @znode_cb: called for each indexing node
- * @priv: private date which is passed to callbacks
+ * @priv: private data which is passed to callbacks
  *
  * This function walks the UBIFS index and calls the @leaf_cb for each leaf
  * node and @znode_cb for each indexing node. Returns zero in case of success
@@ -2409,7 +2467,7 @@ void ubifs_debugging_exit(struct ubifs_info *c)
  * Root directory for UBIFS stuff in debugfs. Contains sub-directories which
  * contain the stuff specific to particular file-system mounts.
  */
-static struct dentry *debugfs_rootdir;
+static struct dentry *dfs_rootdir;
 
 /**
  * dbg_debugfs_init - initialize debugfs file-system.
@@ -2421,9 +2479,9 @@ static struct dentry *debugfs_rootdir;
  */
 int dbg_debugfs_init(void)
 {
-       debugfs_rootdir = debugfs_create_dir("ubifs", NULL);
-       if (IS_ERR(debugfs_rootdir)) {
-               int err = PTR_ERR(debugfs_rootdir);
+       dfs_rootdir = debugfs_create_dir("ubifs", NULL);
+       if (IS_ERR(dfs_rootdir)) {
+               int err = PTR_ERR(dfs_rootdir);
                ubifs_err("cannot create \"ubifs\" debugfs directory, "
                          "error %d\n", err);
                return err;
@@ -2437,7 +2495,7 @@ int dbg_debugfs_init(void)
  */
 void dbg_debugfs_exit(void)
 {
-       debugfs_remove(debugfs_rootdir);
+       debugfs_remove(dfs_rootdir);
 }
 
 static int open_debugfs_file(struct inode *inode, struct file *file)
@@ -2452,13 +2510,13 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf,
        struct ubifs_info *c = file->private_data;
        struct ubifs_debug_info *d = c->dbg;
 
-       if (file->f_path.dentry == d->dump_lprops)
+       if (file->f_path.dentry == d->dfs_dump_lprops)
                dbg_dump_lprops(c);
-       else if (file->f_path.dentry == d->dump_budg) {
+       else if (file->f_path.dentry == d->dfs_dump_budg) {
                spin_lock(&c->space_lock);
                dbg_dump_budg(c);
                spin_unlock(&c->space_lock);
-       } else if (file->f_path.dentry == d->dump_tnc) {
+       } else if (file->f_path.dentry == d->dfs_dump_tnc) {
                mutex_lock(&c->tnc_mutex);
                dbg_dump_tnc(c);
                mutex_unlock(&c->tnc_mutex);
@@ -2469,7 +2527,7 @@ static ssize_t write_debugfs_file(struct file *file, const char __user *buf,
        return count;
 }
 
-static const struct file_operations debugfs_fops = {
+static const struct file_operations dfs_fops = {
        .open = open_debugfs_file,
        .write = write_debugfs_file,
        .owner = THIS_MODULE,
@@ -2494,36 +2552,32 @@ int dbg_debugfs_init_fs(struct ubifs_info *c)
        struct dentry *dent;
        struct ubifs_debug_info *d = c->dbg;
 
-       sprintf(d->debugfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id);
-       d->debugfs_dir = debugfs_create_dir(d->debugfs_dir_name,
-                                             debugfs_rootdir);
-       if (IS_ERR(d->debugfs_dir)) {
-               err = PTR_ERR(d->debugfs_dir);
+       sprintf(d->dfs_dir_name, "ubi%d_%d", c->vi.ubi_num, c->vi.vol_id);
+       d->dfs_dir = debugfs_create_dir(d->dfs_dir_name, dfs_rootdir);
+       if (IS_ERR(d->dfs_dir)) {
+               err = PTR_ERR(d->dfs_dir);
                ubifs_err("cannot create \"%s\" debugfs directory, error %d\n",
-                         d->debugfs_dir_name, err);
+                         d->dfs_dir_name, err);
                goto out;
        }
 
        fname = "dump_lprops";
-       dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c,
-                                  &debugfs_fops);
+       dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
        if (IS_ERR(dent))
                goto out_remove;
-       d->dump_lprops = dent;
+       d->dfs_dump_lprops = dent;
 
        fname = "dump_budg";
-       dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c,
-                                  &debugfs_fops);
+       dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
        if (IS_ERR(dent))
                goto out_remove;
-       d->dump_budg = dent;
+       d->dfs_dump_budg = dent;
 
        fname = "dump_tnc";
-       dent = debugfs_create_file(fname, S_IWUGO, d->debugfs_dir, c,
-                                  &debugfs_fops);
+       dent = debugfs_create_file(fname, S_IWUGO, d->dfs_dir, c, &dfs_fops);
        if (IS_ERR(dent))
                goto out_remove;
-       d->dump_tnc = dent;
+       d->dfs_dump_tnc = dent;
 
        return 0;
 
@@ -2531,7 +2585,7 @@ out_remove:
        err = PTR_ERR(dent);
        ubifs_err("cannot create \"%s\" debugfs directory, error %d\n",
                  fname, err);
-       debugfs_remove_recursive(d->debugfs_dir);
+       debugfs_remove_recursive(d->dfs_dir);
 out:
        return err;
 }
@@ -2542,7 +2596,7 @@ out:
  */
 void dbg_debugfs_exit_fs(struct ubifs_info *c)
 {
-       debugfs_remove_recursive(c->dbg->debugfs_dir);
+       debugfs_remove_recursive(c->dbg->dfs_dir);
 }
 
 #endif /* CONFIG_UBIFS_FS_DEBUG */
index 9820d6999f7e0b2704325713cba2150a7c4b0cef..c1cd73b2e06e4ecc541ebf3b5f840572c8bfe282 100644 (file)
  * @chk_lpt_wastage: used by LPT tree size checker
  * @chk_lpt_lebs: used by LPT tree size checker
  * @new_nhead_offs: used by LPT tree size checker
- * @new_ihead_lnum: used by debugging to check ihead_lnum
- * @new_ihead_offs: used by debugging to check ihead_offs
+ * @new_ihead_lnum: used by debugging to check @c->ihead_lnum
+ * @new_ihead_offs: used by debugging to check @c->ihead_offs
  *
- * debugfs_dir_name: name of debugfs directory containing this file-system's
- *                   files
- * debugfs_dir: direntry object of the file-system debugfs directory
- * dump_lprops: "dump lprops" debugfs knob
- * dump_budg: "dump budgeting information" debugfs knob
- * dump_tnc: "dump TNC" debugfs knob
+ * @saved_lst: saved lprops statistics (used by 'dbg_save_space_info()')
+ * @saved_free: saved free space (used by 'dbg_save_space_info()')
+ *
+ * dfs_dir_name: name of debugfs directory containing this file-system's files
+ * dfs_dir: direntry object of the file-system debugfs directory
+ * dfs_dump_lprops: "dump lprops" debugfs knob
+ * dfs_dump_budg: "dump budgeting information" debugfs knob
+ * dfs_dump_tnc: "dump TNC" debugfs knob
  */
 struct ubifs_debug_info {
        void *buf;
@@ -69,11 +71,14 @@ struct ubifs_debug_info {
        int new_ihead_lnum;
        int new_ihead_offs;
 
-       char debugfs_dir_name[100];
-       struct dentry *debugfs_dir;
-       struct dentry *dump_lprops;
-       struct dentry *dump_budg;
-       struct dentry *dump_tnc;
+       struct ubifs_lp_stats saved_lst;
+       long long saved_free;
+
+       char dfs_dir_name[100];
+       struct dentry *dfs_dir;
+       struct dentry *dfs_dump_lprops;
+       struct dentry *dfs_dump_budg;
+       struct dentry *dfs_dump_tnc;
 };
 
 #define ubifs_assert(expr) do {                                                \
@@ -297,7 +302,8 @@ int dbg_walk_index(struct ubifs_info *c, dbg_leaf_callback leaf_cb,
                   dbg_znode_callback znode_cb, void *priv);
 
 /* Checking functions */
-
+void dbg_save_space_info(struct ubifs_info *c);
+int dbg_check_space_info(struct ubifs_info *c);
 int dbg_check_lprops(struct ubifs_info *c);
 int dbg_old_index_check_init(struct ubifs_info *c, struct ubifs_zbranch *zroot);
 int dbg_check_old_index(struct ubifs_info *c, struct ubifs_zbranch *zroot);
@@ -439,6 +445,8 @@ void dbg_debugfs_exit_fs(struct ubifs_info *c);
 
 #define dbg_walk_index(c, leaf_cb, znode_cb, priv) 0
 #define dbg_old_index_check_init(c, zroot)         0
+#define dbg_save_space_info(c)                     ({})
+#define dbg_check_space_info(c)                    0
 #define dbg_check_old_index(c, zroot)              0
 #define dbg_check_cats(c)                          0
 #define dbg_check_ltab(c)                          0
index f448ab1f9c38eb7861ec62ad998fdebce72e1aa9..f55d523c52bbd052b5600dfdc17a99706b48d823 100644 (file)
@@ -482,30 +482,29 @@ static int ubifs_dir_release(struct inode *dir, struct file *file)
 }
 
 /**
- * lock_2_inodes - lock two UBIFS inodes.
+ * lock_2_inodes - a wrapper for locking two UBIFS inodes.
  * @inode1: first inode
  * @inode2: second inode
+ *
+ * We do not implement any tricks to guarantee strict lock ordering, because
+ * VFS has already done it for us on the @i_mutex. So this is just a simple
+ * wrapper function.
  */
 static void lock_2_inodes(struct inode *inode1, struct inode *inode2)
 {
-       if (inode1->i_ino < inode2->i_ino) {
-               mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_2);
-               mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_3);
-       } else {
-               mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
-               mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_3);
-       }
+       mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
+       mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
 }
 
 /**
- * unlock_2_inodes - unlock two UBIFS inodes inodes.
+ * unlock_2_inodes - a wrapper for unlocking two UBIFS inodes.
  * @inode1: first inode
  * @inode2: second inode
  */
 static void unlock_2_inodes(struct inode *inode1, struct inode *inode2)
 {
-       mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
        mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
+       mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
 }
 
 static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
@@ -527,6 +526,8 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir,
        dbg_gen("dent '%.*s' to ino %lu (nlink %d) in dir ino %lu",
                dentry->d_name.len, dentry->d_name.name, inode->i_ino,
                inode->i_nlink, dir->i_ino);
+       ubifs_assert(mutex_is_locked(&dir->i_mutex));
+       ubifs_assert(mutex_is_locked(&inode->i_mutex));
        err = dbg_check_synced_i_size(inode);
        if (err)
                return err;
@@ -580,6 +581,8 @@ static int ubifs_unlink(struct inode *dir, struct dentry *dentry)
        dbg_gen("dent '%.*s' from ino %lu (nlink %d) in dir ino %lu",
                dentry->d_name.len, dentry->d_name.name, inode->i_ino,
                inode->i_nlink, dir->i_ino);
+       ubifs_assert(mutex_is_locked(&dir->i_mutex));
+       ubifs_assert(mutex_is_locked(&inode->i_mutex));
        err = dbg_check_synced_i_size(inode);
        if (err)
                return err;
@@ -667,7 +670,8 @@ static int ubifs_rmdir(struct inode *dir, struct dentry *dentry)
 
        dbg_gen("directory '%.*s', ino %lu in dir ino %lu", dentry->d_name.len,
                dentry->d_name.name, inode->i_ino, dir->i_ino);
-
+       ubifs_assert(mutex_is_locked(&dir->i_mutex));
+       ubifs_assert(mutex_is_locked(&inode->i_mutex));
        err = check_dir_empty(c, dentry->d_inode);
        if (err)
                return err;
@@ -922,59 +926,30 @@ out_budg:
 }
 
 /**
- * lock_3_inodes - lock three UBIFS inodes for rename.
+ * lock_3_inodes - a wrapper for locking three UBIFS inodes.
  * @inode1: first inode
  * @inode2: second inode
  * @inode3: third inode
  *
- * For 'ubifs_rename()', @inode1 may be the same as @inode2 whereas @inode3 may
- * be null.
+ * This function is used for 'ubifs_rename()' and @inode1 may be the same as
+ * @inode2 whereas @inode3 may be %NULL.
+ *
+ * We do not implement any tricks to guarantee strict lock ordering, because
+ * VFS has already done it for us on the @i_mutex. So this is just a simple
+ * wrapper function.
  */
 static void lock_3_inodes(struct inode *inode1, struct inode *inode2,
                          struct inode *inode3)
 {
-       struct inode *i1, *i2, *i3;
-
-       if (!inode3) {
-               if (inode1 != inode2) {
-                       lock_2_inodes(inode1, inode2);
-                       return;
-               }
-               mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
-               return;
-       }
-
-       if (inode1 == inode2) {
-               lock_2_inodes(inode1, inode3);
-               return;
-       }
-
-       /* 3 different inodes */
-       if (inode1 < inode2) {
-               i3 = inode2;
-               if (inode1 < inode3) {
-                       i1 = inode1;
-                       i2 = inode3;
-               } else {
-                       i1 = inode3;
-                       i2 = inode1;
-               }
-       } else {
-               i3 = inode1;
-               if (inode2 < inode3) {
-                       i1 = inode2;
-                       i2 = inode3;
-               } else {
-                       i1 = inode3;
-                       i2 = inode2;
-               }
-       }
-       mutex_lock_nested(&ubifs_inode(i1)->ui_mutex, WB_MUTEX_1);
-       lock_2_inodes(i2, i3);
+       mutex_lock_nested(&ubifs_inode(inode1)->ui_mutex, WB_MUTEX_1);
+       if (inode2 != inode1)
+               mutex_lock_nested(&ubifs_inode(inode2)->ui_mutex, WB_MUTEX_2);
+       if (inode3)
+               mutex_lock_nested(&ubifs_inode(inode3)->ui_mutex, WB_MUTEX_3);
 }
 
 /**
- * unlock_3_inodes - unlock three UBIFS inodes for rename.
+ * unlock_3_inodes - a wrapper for unlocking three UBIFS inodes for rename.
  * @inode1: first inode
  * @inode2: second inode
  * @inode3: third inode
@@ -982,11 +957,11 @@ static void lock_3_inodes(struct inode *inode1, struct inode *inode2,
 static void unlock_3_inodes(struct inode *inode1, struct inode *inode2,
                            struct inode *inode3)
 {
-       mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
-       if (inode1 != inode2)
-               mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
        if (inode3)
                mutex_unlock(&ubifs_inode(inode3)->ui_mutex);
+       if (inode1 != inode2)
+               mutex_unlock(&ubifs_inode(inode2)->ui_mutex);
+       mutex_unlock(&ubifs_inode(inode1)->ui_mutex);
 }
 
 static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
@@ -1020,6 +995,11 @@ static int ubifs_rename(struct inode *old_dir, struct dentry *old_dentry,
                "dir ino %lu", old_dentry->d_name.len, old_dentry->d_name.name,
                old_inode->i_ino, old_dir->i_ino, new_dentry->d_name.len,
                new_dentry->d_name.name, new_dir->i_ino);
+       ubifs_assert(mutex_is_locked(&old_dir->i_mutex));
+       ubifs_assert(mutex_is_locked(&new_dir->i_mutex));
+       if (unlink)
+               ubifs_assert(mutex_is_locked(&new_inode->i_mutex));
+
 
        if (unlink && is_dir) {
                err = check_dir_empty(c, new_inode);
@@ -1199,7 +1179,7 @@ int ubifs_getattr(struct vfsmount *mnt, struct dentry *dentry,
        return 0;
 }
 
-struct inode_operations ubifs_dir_inode_operations = {
+const struct inode_operations ubifs_dir_inode_operations = {
        .lookup      = ubifs_lookup,
        .create      = ubifs_create,
        .link        = ubifs_link,
@@ -1219,7 +1199,7 @@ struct inode_operations ubifs_dir_inode_operations = {
 #endif
 };
 
-struct file_operations ubifs_dir_operations = {
+const struct file_operations ubifs_dir_operations = {
        .llseek         = ubifs_dir_llseek,
        .release        = ubifs_dir_release,
        .read           = generic_read_dir,
index bf37374567fa745c63c9f4698d929811544af0e3..93b6de51f261727f2c5f4e62814a0e79d3b109b5 100644 (file)
@@ -432,7 +432,6 @@ static int ubifs_write_begin(struct file *file, struct address_space *mapping,
        int uninitialized_var(err), appending = !!(pos + len > inode->i_size);
        struct page *page;
 
-
        ubifs_assert(ubifs_inode(inode)->ui_size == inode->i_size);
 
        if (unlikely(c->ro_media))
@@ -1541,7 +1540,7 @@ static int ubifs_file_mmap(struct file *file, struct vm_area_struct *vma)
        return 0;
 }
 
-struct address_space_operations ubifs_file_address_operations = {
+const struct address_space_operations ubifs_file_address_operations = {
        .readpage       = ubifs_readpage,
        .writepage      = ubifs_writepage,
        .write_begin    = ubifs_write_begin,
@@ -1551,7 +1550,7 @@ struct address_space_operations ubifs_file_address_operations = {
        .releasepage    = ubifs_releasepage,
 };
 
-struct inode_operations ubifs_file_inode_operations = {
+const struct inode_operations ubifs_file_inode_operations = {
        .setattr     = ubifs_setattr,
        .getattr     = ubifs_getattr,
 #ifdef CONFIG_UBIFS_FS_XATTR
@@ -1562,14 +1561,14 @@ struct inode_operations ubifs_file_inode_operations = {
 #endif
 };
 
-struct inode_operations ubifs_symlink_inode_operations = {
+const struct inode_operations ubifs_symlink_inode_operations = {
        .readlink    = generic_readlink,
        .follow_link = ubifs_follow_link,
        .setattr     = ubifs_setattr,
        .getattr     = ubifs_getattr,
 };
 
-struct file_operations ubifs_file_operations = {
+const struct file_operations ubifs_file_operations = {
        .llseek         = generic_file_llseek,
        .read           = do_sync_read,
        .write          = do_sync_write,
index 9832f9abe28e08af3c444f03bb31b9bc0f84f3db..a711d33b3d3e1434f27dc763983200886155e9fd 100644 (file)
  * to be reused. Garbage collection will cause the number of dirty index nodes
  * to grow, however sufficient space is reserved for the index to ensure the
  * commit will never run out of space.
+ *
+ * Notes about dead watermark. At current UBIFS implementation we assume that
+ * LEBs which have less than @c->dead_wm bytes of free + dirty space are full
+ * and not worth garbage-collecting. The dead watermark is one min. I/O unit
+ * size, or min. UBIFS node size, depending on what is greater. Indeed, UBIFS
+ * Garbage Collector has to synchronize the GC head's write buffer before
+ * returning, so this is about wasting one min. I/O unit. However, UBIFS GC can
+ * actually reclaim even very small pieces of dirty space by garbage collecting
+ * enough dirty LEBs, but we do not bother doing this at this implementation.
+ *
+ * Notes about dark watermark. The results of GC work depends on how big are
+ * the UBIFS nodes GC deals with. Large nodes make GC waste more space. Indeed,
+ * if GC move data from LEB A to LEB B and nodes in LEB A are large, GC would
+ * have to waste large pieces of free space at the end of LEB B, because nodes
+ * from LEB A would not fit. And the worst situation is when all nodes are of
+ * maximum size. So dark watermark is the amount of free + dirty space in LEB
+ * which are guaranteed to be reclaimable. If LEB has less space, the GC migh
+ * be unable to reclaim it. So, LEBs with free + dirty greater than dark
+ * watermark are "good" LEBs from GC's point of few. The other LEBs are not so
+ * good, and GC takes extra care when moving them.
  */
 
 #include <linux/pagemap.h>
@@ -381,7 +401,7 @@ int ubifs_garbage_collect_leb(struct ubifs_info *c, struct ubifs_lprops *lp)
 
                /*
                 * Don't release the LEB until after the next commit, because
-                * it may contain date which is needed for recovery. So
+                * it may contain data which is needed for recovery. So
                 * although we freed this LEB, it will become usable only after
                 * the commit.
                 */
@@ -810,8 +830,9 @@ out:
  * ubifs_destroy_idx_gc - destroy idx_gc list.
  * @c: UBIFS file-system description object
  *
- * This function destroys the idx_gc list. It is called when unmounting or
- * remounting read-only so locks are not needed.
+ * This function destroys the @c->idx_gc list. It is called when unmounting
+ * so locks are not needed. Returns zero in case of success and a negative
+ * error code in case of failure.
  */
 void ubifs_destroy_idx_gc(struct ubifs_info *c)
 {
@@ -824,7 +845,6 @@ void ubifs_destroy_idx_gc(struct ubifs_info *c)
                list_del(&idx_gc->list);
                kfree(idx_gc);
        }
-
 }
 
 /**
index 01682713af69e9e4f20b9648cfc4f74380da2da8..e8e632a1dcdf1ea52834bf4a0441108d72e6a4a4 100644 (file)
@@ -29,7 +29,7 @@
  * would have been wasted for padding to the nearest minimal I/O unit boundary.
  * Instead, data first goes to the write-buffer and is flushed when the
  * buffer is full or when it is not used for some time (by timer). This is
- * similarto the mechanism is used by JFFS2.
+ * similar to the mechanism is used by JFFS2.
  *
  * Write-buffers are defined by 'struct ubifs_wbuf' objects and protected by
  * mutexes defined inside these objects. Since sometimes upper-level code
@@ -75,7 +75,7 @@ void ubifs_ro_mode(struct ubifs_info *c, int err)
  * @lnum: logical eraseblock number
  * @offs: offset within the logical eraseblock
  * @quiet: print no messages
- * @chk_crc: indicates whether to always check the CRC
+ * @must_chk_crc: indicates whether to always check the CRC
  *
  * This function checks node magic number and CRC checksum. This function also
  * validates node length to prevent UBIFS from becoming crazy when an attacker
@@ -83,11 +83,17 @@ void ubifs_ro_mode(struct ubifs_info *c, int err)
  * node length in the common header could cause UBIFS to read memory outside of
  * allocated buffer when checking the CRC checksum.
  *
- * This function returns zero in case of success %-EUCLEAN in case of bad CRC
- * or magic.
+ * This function may skip data nodes CRC checking if @c->no_chk_data_crc is
+ * true, which is controlled by corresponding UBIFS mount option. However, if
+ * @must_chk_crc is true, then @c->no_chk_data_crc is ignored and CRC is
+ * checked. Similarly, if @c->always_chk_crc is true, @c->no_chk_data_crc is
+ * ignored and CRC is checked.
+ *
+ * This function returns zero in case of success and %-EUCLEAN in case of bad
+ * CRC or magic.
  */
 int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
-                    int offs, int quiet, int chk_crc)
+                    int offs, int quiet, int must_chk_crc)
 {
        int err = -EINVAL, type, node_len;
        uint32_t crc, node_crc, magic;
@@ -123,9 +129,9 @@ int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
                   node_len > c->ranges[type].max_len)
                goto out_len;
 
-       if (!chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc)
-               if (c->no_chk_data_crc)
-                       return 0;
+       if (!must_chk_crc && type == UBIFS_DATA_NODE && !c->always_chk_crc &&
+            c->no_chk_data_crc)
+               return 0;
 
        crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8);
        node_crc = le32_to_cpu(ch->crc);
index 9b7c54e0cd2ae0379bba6045d0a340a7d10bf1fd..a11ca0958a238b254cf7e8e29cda17f342cf2fc3 100644 (file)
@@ -208,7 +208,7 @@ again:
        offs = 0;
 
 out:
-       err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, UBI_SHORTTERM);
+       err = ubifs_wbuf_seek_nolock(wbuf, lnum, offs, wbuf->dtype);
        if (err)
                goto out_unlock;
 
index dfd2bcece27a865de970f3d4333468c5ebb5db66..4cdd284dea5688eddf40d21eeb5f70a83e2724b9 100644 (file)
@@ -635,10 +635,10 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
  * @c: UBIFS file-system description object
  * @st: return statistics
  */
-void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *st)
+void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst)
 {
        spin_lock(&c->space_lock);
-       memcpy(st, &c->lst, sizeof(struct ubifs_lp_stats));
+       memcpy(lst, &c->lst, sizeof(struct ubifs_lp_stats));
        spin_unlock(&c->space_lock);
 }
 
@@ -678,6 +678,9 @@ int ubifs_change_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
 
 out:
        ubifs_release_lprops(c);
+       if (err)
+               ubifs_err("cannot change properties of LEB %d, error %d",
+                         lnum, err);
        return err;
 }
 
@@ -714,6 +717,9 @@ int ubifs_update_one_lp(struct ubifs_info *c, int lnum, int free, int dirty,
 
 out:
        ubifs_release_lprops(c);
+       if (err)
+               ubifs_err("cannot update properties of LEB %d, error %d",
+                         lnum, err);
        return err;
 }
 
@@ -737,6 +743,8 @@ int ubifs_read_one_lp(struct ubifs_info *c, int lnum, struct ubifs_lprops *lp)
        lpp = ubifs_lpt_lookup(c, lnum);
        if (IS_ERR(lpp)) {
                err = PTR_ERR(lpp);
+               ubifs_err("cannot read properties of LEB %d, error %d",
+                         lnum, err);
                goto out;
        }
 
index 96ca957071754067f7aeddf5dcecc2b0a2b12116..3216a1f277f8940799e090cf50ff0c6bb566352c 100644 (file)
@@ -556,23 +556,23 @@ no_space:
 }
 
 /**
- * next_pnode - find next pnode.
+ * next_pnode_to_dirty - find next pnode to dirty.
  * @c: UBIFS file-system description object
  * @pnode: pnode
  *
- * This function returns the next pnode or %NULL if there are no more pnodes.
+ * This function returns the next pnode to dirty or %NULL if there are no more
+ * pnodes.  Note that pnodes that have never been written (lnum == 0) are
+ * skipped.
  */
-static struct ubifs_pnode *next_pnode(struct ubifs_info *c,
-                                     struct ubifs_pnode *pnode)
+static struct ubifs_pnode *next_pnode_to_dirty(struct ubifs_info *c,
+                                              struct ubifs_pnode *pnode)
 {
        struct ubifs_nnode *nnode;
        int iip;
 
        /* Try to go right */
        nnode = pnode->parent;
-       iip = pnode->iip + 1;
-       if (iip < UBIFS_LPT_FANOUT) {
-               /* We assume here that LEB zero is never an LPT LEB */
+       for (iip = pnode->iip + 1; iip < UBIFS_LPT_FANOUT; iip++) {
                if (nnode->nbranch[iip].lnum)
                        return ubifs_get_pnode(c, nnode, iip);
        }
@@ -583,8 +583,11 @@ static struct ubifs_pnode *next_pnode(struct ubifs_info *c,
                nnode = nnode->parent;
                if (!nnode)
                        return NULL;
-               /* We assume here that LEB zero is never an LPT LEB */
-       } while (iip >= UBIFS_LPT_FANOUT || !nnode->nbranch[iip].lnum);
+               for (; iip < UBIFS_LPT_FANOUT; iip++) {
+                       if (nnode->nbranch[iip].lnum)
+                               break;
+               }
+       } while (iip >= UBIFS_LPT_FANOUT);
 
        /* Go right */
        nnode = ubifs_get_nnode(c, nnode, iip);
@@ -593,12 +596,29 @@ static struct ubifs_pnode *next_pnode(struct ubifs_info *c,
 
        /* Go down to level 1 */
        while (nnode->level > 1) {
-               nnode = ubifs_get_nnode(c, nnode, 0);
+               for (iip = 0; iip < UBIFS_LPT_FANOUT; iip++) {
+                       if (nnode->nbranch[iip].lnum)
+                               break;
+               }
+               if (iip >= UBIFS_LPT_FANOUT) {
+                       /*
+                        * Should not happen, but we need to keep going
+                        * if it does.
+                        */
+                       iip = 0;
+               }
+               nnode = ubifs_get_nnode(c, nnode, iip);
                if (IS_ERR(nnode))
                        return (void *)nnode;
        }
 
-       return ubifs_get_pnode(c, nnode, 0);
+       for (iip = 0; iip < UBIFS_LPT_FANOUT; iip++)
+               if (nnode->nbranch[iip].lnum)
+                       break;
+       if (iip >= UBIFS_LPT_FANOUT)
+               /* Should not happen, but we need to keep going if it does */
+               iip = 0;
+       return ubifs_get_pnode(c, nnode, iip);
 }
 
 /**
@@ -688,7 +708,7 @@ static int make_tree_dirty(struct ubifs_info *c)
        pnode = pnode_lookup(c, 0);
        while (pnode) {
                do_make_pnode_dirty(c, pnode);
-               pnode = next_pnode(c, pnode);
+               pnode = next_pnode_to_dirty(c, pnode);
                if (IS_ERR(pnode))
                        return PTR_ERR(pnode);
        }
index 71d5493bf565a3252f2a266eee74594968735188..a88f33801b989aa7316e6ab99e7629cddd9dfb67 100644 (file)
@@ -354,7 +354,7 @@ int ubifs_write_master(struct ubifs_info *c)
        int err, lnum, offs, len;
 
        if (c->ro_media)
-               return -EINVAL;
+               return -EROFS;
 
        lnum = UBIFS_MST_LNUM;
        offs = c->mst_offs + c->mst_node_alsz;
index 9e6f403f170e4425641c5db8b833db9f63c3ce7b..152a7b34a1414658d217f3604e61e10ea9e2c799 100644 (file)
@@ -46,7 +46,7 @@
  * Orphans are accumulated in a rb-tree. When an inode's link count drops to
  * zero, the inode number is added to the rb-tree. It is removed from the tree
  * when the inode is deleted.  Any new orphans that are in the orphan tree when
- * the commit is run, are written to the orphan area in 1 or more orph nodes.
+ * the commit is run, are written to the orphan area in 1 or more orphan nodes.
  * If the orphan area is full, it is consolidated to make space.  There is
  * always enough space because validation prevents the user from creating more
  * than the maximum number of orphans allowed.
@@ -231,7 +231,7 @@ static int tot_avail_orphs(struct ubifs_info *c)
 }
 
 /**
- * do_write_orph_node - write a node
+ * do_write_orph_node - write a node to the orphan head.
  * @c: UBIFS file-system description object
  * @len: length of node
  * @atomic: write atomically
@@ -264,11 +264,11 @@ static int do_write_orph_node(struct ubifs_info *c, int len, int atomic)
 }
 
 /**
- * write_orph_node - write an orph node
+ * write_orph_node - write an orphan node.
  * @c: UBIFS file-system description object
  * @atomic: write atomically
  *
- * This function builds an orph node from the cnext list and writes it to the
+ * This function builds an orphan node from the cnext list and writes it to the
  * orphan head. On success, %0 is returned, otherwise a negative error code
  * is returned.
  */
@@ -326,11 +326,11 @@ static int write_orph_node(struct ubifs_info *c, int atomic)
 }
 
 /**
- * write_orph_nodes - write orph nodes until there are no more to commit
+ * write_orph_nodes - write orphan nodes until there are no more to commit.
  * @c: UBIFS file-system description object
  * @atomic: write atomically
  *
- * This function writes orph nodes for all the orphans to commit. On success,
+ * This function writes orphan nodes for all the orphans to commit. On success,
  * %0 is returned, otherwise a negative error code is returned.
  */
 static int write_orph_nodes(struct ubifs_info *c, int atomic)
@@ -478,14 +478,14 @@ int ubifs_orphan_end_commit(struct ubifs_info *c)
 }
 
 /**
- * clear_orphans - erase all LEBs used for orphans.
+ * ubifs_clear_orphans - erase all LEBs used for orphans.
  * @c: UBIFS file-system description object
  *
  * If recovery is not required, then the orphans from the previous session
  * are not needed. This function locates the LEBs used to record
  * orphans, and un-maps them.
  */
-static int clear_orphans(struct ubifs_info *c)
+int ubifs_clear_orphans(struct ubifs_info *c)
 {
        int lnum, err;
 
@@ -547,9 +547,9 @@ static int insert_dead_orphan(struct ubifs_info *c, ino_t inum)
  * do_kill_orphans - remove orphan inodes from the index.
  * @c: UBIFS file-system description object
  * @sleb: scanned LEB
- * @last_cmt_no: cmt_no of last orph node read is passed and returned here
+ * @last_cmt_no: cmt_no of last orphan node read is passed and returned here
  * @outofdate: whether the LEB is out of date is returned here
- * @last_flagged: whether the end orph node is encountered
+ * @last_flagged: whether the end orphan node is encountered
  *
  * This function is a helper to the 'kill_orphans()' function. It goes through
  * every orphan node in a LEB and for every inode number recorded, removes
@@ -580,8 +580,8 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
                /*
                 * The commit number on the master node may be less, because
                 * of a failed commit. If there are several failed commits in a
-                * row, the commit number written on orph nodes will continue to
-                * increase (because the commit number is adjusted here) even
+                * row, the commit number written on orphan nodes will continue
+                * to increase (because the commit number is adjusted here) even
                 * though the commit number on the master node stays the same
                 * because the master node has not been re-written.
                 */
@@ -589,9 +589,9 @@ static int do_kill_orphans(struct ubifs_info *c, struct ubifs_scan_leb *sleb,
                        c->cmt_no = cmt_no;
                if (cmt_no < *last_cmt_no && *last_flagged) {
                        /*
-                        * The last orph node had a higher commit number and was
-                        * flagged as the last written for that commit number.
-                        * That makes this orph node, out of date.
+                        * The last orphan node had a higher commit number and
+                        * was flagged as the last written for that commit
+                        * number. That makes this orphan node, out of date.
                         */
                        if (!first) {
                                ubifs_err("out of order commit number %llu in "
@@ -658,10 +658,10 @@ static int kill_orphans(struct ubifs_info *c)
        /*
         * Orph nodes always start at c->orph_first and are written to each
         * successive LEB in turn. Generally unused LEBs will have been unmapped
-        * but may contain out of date orph nodes if the unmap didn't go
-        * through. In addition, the last orph node written for each commit is
+        * but may contain out of date orphan nodes if the unmap didn't go
+        * through. In addition, the last orphan node written for each commit is
         * marked (top bit of orph->cmt_no is set to 1). It is possible that
-        * there are orph nodes from the next commit (i.e. the commit did not
+        * there are orphan nodes from the next commit (i.e. the commit did not
         * complete successfully). In that case, no orphans will have been lost
         * due to the way that orphans are written, and any orphans added will
         * be valid orphans anyway and so can be deleted.
@@ -718,7 +718,7 @@ int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only)
        if (unclean)
                err = kill_orphans(c);
        else if (!read_only)
-               err = clear_orphans(c);
+               err = ubifs_clear_orphans(c);
 
        return err;
 }
index 89556ee725185936d63c06f9fd9813f783a1f5b4..1182b66a5491443ac725504ec3bd7e3bf0b0dc30 100644 (file)
@@ -397,6 +397,7 @@ static int ubifs_statfs(struct dentry *dentry, struct kstatfs *buf)
        buf->f_namelen = UBIFS_MAX_NLEN;
        buf->f_fsid.val[0] = le32_to_cpu(uuid[0]) ^ le32_to_cpu(uuid[2]);
        buf->f_fsid.val[1] = le32_to_cpu(uuid[1]) ^ le32_to_cpu(uuid[3]);
+       ubifs_assert(buf->f_bfree <= c->block_cnt);
        return 0;
 }
 
@@ -432,32 +433,23 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
        int i, err;
        struct ubifs_info *c = sb->s_fs_info;
        struct writeback_control wbc = {
-               .sync_mode   = wait ? WB_SYNC_ALL : WB_SYNC_NONE,
+               .sync_mode   = WB_SYNC_ALL,
                .range_start = 0,
                .range_end   = LLONG_MAX,
                .nr_to_write = LONG_MAX,
        };
 
        /*
-        * Note by akpm about WB_SYNC_NONE used above: zero @wait is just an
-        * advisory thing to help the file system shove lots of data into the
-        * queues. If some gets missed then it'll be picked up on the second
+        * Zero @wait is just an advisory thing to help the file system shove
+        * lots of data into the queues, and there will be the second
         * '->sync_fs()' call, with non-zero @wait.
         */
+       if (!wait)
+               return 0;
 
        if (sb->s_flags & MS_RDONLY)
                return 0;
 
-       /*
-        * Synchronize write buffers, because 'ubifs_run_commit()' does not
-        * do this if it waits for an already running commit.
-        */
-       for (i = 0; i < c->jhead_cnt; i++) {
-               err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
-               if (err)
-                       return err;
-       }
-
        /*
         * VFS calls '->sync_fs()' before synchronizing all dirty inodes and
         * pages, so synchronize them first, then commit the journal. Strictly
@@ -469,6 +461,16 @@ static int ubifs_sync_fs(struct super_block *sb, int wait)
         */
        generic_sync_sb_inodes(sb, &wbc);
 
+       /*
+        * Synchronize write buffers, because 'ubifs_run_commit()' does not
+        * do this if it waits for an already running commit.
+        */
+       for (i = 0; i < c->jhead_cnt; i++) {
+               err = ubifs_wbuf_sync(&c->jheads[i].wbuf);
+               if (err)
+                       return err;
+       }
+
        err = ubifs_run_commit(c);
        if (err)
                return err;
@@ -572,15 +574,8 @@ static int init_constants_early(struct ubifs_info *c)
        c->ranges[UBIFS_IDX_NODE].max_len = INT_MAX;
 
        /*
-        * Initialize dead and dark LEB space watermarks.
-        *
-        * Dead space is the space which cannot be used. Its watermark is
-        * equivalent to min. I/O unit or minimum node size if it is greater
-        * then min. I/O unit.
-        *
-        * Dark space is the space which might be used, or might not, depending
-        * on which node should be written to the LEB. Its watermark is
-        * equivalent to maximum UBIFS node size.
+        * Initialize dead and dark LEB space watermarks. See gc.c for comments
+        * about these values.
         */
        c->dead_wm = ALIGN(MIN_WRITE_SZ, c->min_io_size);
        c->dark_wm = ALIGN(UBIFS_MAX_NODE_SZ, c->min_io_size);
@@ -741,12 +736,12 @@ static void init_constants_master(struct ubifs_info *c)
  * take_gc_lnum - reserve GC LEB.
  * @c: UBIFS file-system description object
  *
- * This function ensures that the LEB reserved for garbage collection is
- * unmapped and is marked as "taken" in lprops. We also have to set free space
- * to LEB size and dirty space to zero, because lprops may contain out-of-date
- * information if the file-system was un-mounted before it has been committed.
- * This function returns zero in case of success and a negative error code in
- * case of failure.
+ * This function ensures that the LEB reserved for garbage collection is marked
+ * as "taken" in lprops. We also have to set free space to LEB size and dirty
+ * space to zero, because lprops may contain out-of-date information if the
+ * file-system was un-mounted before it has been committed. This function
+ * returns zero in case of success and a negative error code in case of
+ * failure.
  */
 static int take_gc_lnum(struct ubifs_info *c)
 {
@@ -757,10 +752,6 @@ static int take_gc_lnum(struct ubifs_info *c)
                return -EINVAL;
        }
 
-       err = ubifs_leb_unmap(c, c->gc_lnum);
-       if (err)
-               return err;
-
        /* And we have to tell lprops that this LEB is taken */
        err = ubifs_change_one_lp(c, c->gc_lnum, c->leb_size, 0,
                                  LPROPS_TAKEN, 0, 0);
@@ -966,13 +957,16 @@ static int ubifs_parse_options(struct ubifs_info *c, char *options,
 
                token = match_token(p, tokens, args);
                switch (token) {
+               /*
+                * %Opt_fast_unmount and %Opt_norm_unmount options are ignored.
+                * We accepte them in order to be backware-compatible. But this
+                * should be removed at some point.
+                */
                case Opt_fast_unmount:
                        c->mount_opts.unmount_mode = 2;
-                       c->fast_unmount = 1;
                        break;
                case Opt_norm_unmount:
                        c->mount_opts.unmount_mode = 1;
-                       c->fast_unmount = 0;
                        break;
                case Opt_bulk_read:
                        c->mount_opts.bulk_read = 2;
@@ -1094,12 +1088,7 @@ static int check_free_space(struct ubifs_info *c)
                ubifs_err("insufficient free space to mount in read/write mode");
                dbg_dump_budg(c);
                dbg_dump_lprops(c);
-               /*
-                * We return %-EINVAL instead of %-ENOSPC because it seems to
-                * be the closest error code mentioned in the mount function
-                * documentation.
-                */
-               return -EINVAL;
+               return -ENOSPC;
        }
        return 0;
 }
@@ -1286,10 +1275,19 @@ static int mount_ubifs(struct ubifs_info *c)
                        if (err)
                                goto out_orphans;
                        err = ubifs_rcvry_gc_commit(c);
-               } else
+               } else {
                        err = take_gc_lnum(c);
-               if (err)
-                       goto out_orphans;
+                       if (err)
+                               goto out_orphans;
+
+                       /*
+                        * GC LEB may contain garbage if there was an unclean
+                        * reboot, and it should be un-mapped.
+                        */
+                       err = ubifs_leb_unmap(c, c->gc_lnum);
+                       if (err)
+                               return err;
+               }
 
                err = dbg_check_lprops(c);
                if (err)
@@ -1298,6 +1296,16 @@ static int mount_ubifs(struct ubifs_info *c)
                err = ubifs_recover_size(c);
                if (err)
                        goto out_orphans;
+       } else {
+               /*
+                * Even if we mount read-only, we have to set space in GC LEB
+                * to proper value because this affects UBIFS free space
+                * reporting. We do not want to have a situation when
+                * re-mounting from R/O to R/W changes amount of free space.
+                */
+               err = take_gc_lnum(c);
+               if (err)
+                       goto out_orphans;
        }
 
        spin_lock(&ubifs_infos_lock);
@@ -1310,14 +1318,17 @@ static int mount_ubifs(struct ubifs_info *c)
                else {
                        c->need_recovery = 0;
                        ubifs_msg("recovery completed");
+                       /* GC LEB has to be empty and taken at this point */
+                       ubifs_assert(c->lst.taken_empty_lebs == 1);
                }
-       }
+       } else
+               ubifs_assert(c->lst.taken_empty_lebs == 1);
 
-       err = dbg_debugfs_init_fs(c);
+       err = dbg_check_filesystem(c);
        if (err)
                goto out_infos;
 
-       err = dbg_check_filesystem(c);
+       err = dbg_debugfs_init_fs(c);
        if (err)
                goto out_infos;
 
@@ -1351,7 +1362,6 @@ static int mount_ubifs(struct ubifs_info *c)
               c->uuid[4], c->uuid[5], c->uuid[6], c->uuid[7],
               c->uuid[8], c->uuid[9], c->uuid[10], c->uuid[11],
               c->uuid[12], c->uuid[13], c->uuid[14], c->uuid[15]);
-       dbg_msg("fast unmount:        %d", c->fast_unmount);
        dbg_msg("big_lpt              %d", c->big_lpt);
        dbg_msg("log LEBs:            %d (%d - %d)",
                c->log_lebs, UBIFS_LOG_LNUM, c->log_last);
@@ -1475,10 +1485,8 @@ static int ubifs_remount_rw(struct ubifs_info *c)
 {
        int err, lnum;
 
-       if (c->ro_media)
-               return -EINVAL;
-
        mutex_lock(&c->umount_mutex);
+       dbg_save_space_info(c);
        c->remounting_rw = 1;
        c->always_chk_crc = 1;
 
@@ -1514,6 +1522,12 @@ static int ubifs_remount_rw(struct ubifs_info *c)
                err = ubifs_recover_inl_heads(c, c->sbuf);
                if (err)
                        goto out;
+       } else {
+               /* A readonly mount is not allowed to have orphans */
+               ubifs_assert(c->tot_orphans == 0);
+               err = ubifs_clear_orphans(c);
+               if (err)
+                       goto out;
        }
 
        if (!(c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY))) {
@@ -1569,7 +1583,7 @@ static int ubifs_remount_rw(struct ubifs_info *c)
        if (c->need_recovery)
                err = ubifs_rcvry_gc_commit(c);
        else
-               err = take_gc_lnum(c);
+               err = ubifs_leb_unmap(c, c->gc_lnum);
        if (err)
                goto out;
 
@@ -1582,8 +1596,9 @@ static int ubifs_remount_rw(struct ubifs_info *c)
        c->vfs_sb->s_flags &= ~MS_RDONLY;
        c->remounting_rw = 0;
        c->always_chk_crc = 0;
+       err = dbg_check_space_info(c);
        mutex_unlock(&c->umount_mutex);
-       return 0;
+       return err;
 
 out:
        vfree(c->orph_buf);
@@ -1602,44 +1617,19 @@ out:
        return err;
 }
 
-/**
- * commit_on_unmount - commit the journal when un-mounting.
- * @c: UBIFS file-system description object
- *
- * This function is called during un-mounting and re-mounting, and it commits
- * the journal unless the "fast unmount" mode is enabled.
- */
-static void commit_on_unmount(struct ubifs_info *c)
-{
-       struct super_block *sb = c->vfs_sb;
-       long long bud_bytes;
-
-       /*
-        * This function is called before the background thread is stopped, so
-        * we may race with ongoing commit, which means we have to take
-        * @c->bud_lock to access @c->bud_bytes.
-        */
-       spin_lock(&c->buds_lock);
-       bud_bytes = c->bud_bytes;
-       spin_unlock(&c->buds_lock);
-
-       if (!c->fast_unmount && !(sb->s_flags & MS_RDONLY) && bud_bytes)
-               ubifs_run_commit(c);
-}
-
 /**
  * ubifs_remount_ro - re-mount in read-only mode.
  * @c: UBIFS file-system description object
  *
- * We rely on VFS to have stopped writing. Possibly the background thread could
- * be running a commit, however kthread_stop will wait in that case.
+ * We assume VFS has stopped writing. Possibly the background thread could be
+ * running a commit, however kthread_stop will wait in that case.
  */
 static void ubifs_remount_ro(struct ubifs_info *c)
 {
        int i, err;
 
        ubifs_assert(!c->need_recovery);
-       commit_on_unmount(c);
+       ubifs_assert(!(c->vfs_sb->s_flags & MS_RDONLY));
 
        mutex_lock(&c->umount_mutex);
        if (c->bgt) {
@@ -1647,27 +1637,29 @@ static void ubifs_remount_ro(struct ubifs_info *c)
                c->bgt = NULL;
        }
 
+       dbg_save_space_info(c);
+
        for (i = 0; i < c->jhead_cnt; i++) {
                ubifs_wbuf_sync(&c->jheads[i].wbuf);
                del_timer_sync(&c->jheads[i].wbuf.timer);
        }
 
-       if (!c->ro_media) {
-               c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY);
-               c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS);
-               c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum);
-               err = ubifs_write_master(c);
-               if (err)
-                       ubifs_ro_mode(c, err);
-       }
+       c->mst_node->flags &= ~cpu_to_le32(UBIFS_MST_DIRTY);
+       c->mst_node->flags |= cpu_to_le32(UBIFS_MST_NO_ORPHS);
+       c->mst_node->gc_lnum = cpu_to_le32(c->gc_lnum);
+       err = ubifs_write_master(c);
+       if (err)
+               ubifs_ro_mode(c, err);
 
-       ubifs_destroy_idx_gc(c);
        free_wbufs(c);
        vfree(c->orph_buf);
        c->orph_buf = NULL;
        vfree(c->ileb_buf);
        c->ileb_buf = NULL;
        ubifs_lpt_free(c, 1);
+       err = dbg_check_space_info(c);
+       if (err)
+               ubifs_ro_mode(c, err);
        mutex_unlock(&c->umount_mutex);
 }
 
@@ -1760,11 +1752,20 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
        }
 
        if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) {
+               if (c->ro_media) {
+                       ubifs_msg("cannot re-mount due to prior errors");
+                       return -EROFS;
+               }
                err = ubifs_remount_rw(c);
                if (err)
                        return err;
-       } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY))
+       } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) {
+               if (c->ro_media) {
+                       ubifs_msg("cannot re-mount due to prior errors");
+                       return -EROFS;
+               }
                ubifs_remount_ro(c);
+       }
 
        if (c->bulk_read == 1)
                bu_init(c);
@@ -1774,10 +1775,11 @@ static int ubifs_remount_fs(struct super_block *sb, int *flags, char *data)
                c->bu.buf = NULL;
        }
 
+       ubifs_assert(c->lst.taken_empty_lebs == 1);
        return 0;
 }
 
-struct super_operations ubifs_super_operations = {
+const struct super_operations ubifs_super_operations = {
        .alloc_inode   = ubifs_alloc_inode,
        .destroy_inode = ubifs_destroy_inode,
        .put_super     = ubifs_put_super,
@@ -2044,15 +2046,6 @@ out_close:
 
 static void ubifs_kill_sb(struct super_block *sb)
 {
-       struct ubifs_info *c = sb->s_fs_info;
-
-       /*
-        * We do 'commit_on_unmount()' here instead of 'ubifs_put_super()'
-        * in order to be outside BKL.
-        */
-       if (sb->s_root)
-               commit_on_unmount(c);
-       /* The un-mount routine is actually done in put_super() */
        generic_shutdown_super(sb);
 }
 
index f7e36f5455275e3e125b551b49b32448dd6f9188..fa28a84c6a1b4a9d0f3cf5dfdb9f8fadd36e10da 100644 (file)
@@ -443,6 +443,11 @@ static int tnc_read_node_nm(struct ubifs_info *c, struct ubifs_zbranch *zbr,
  * This function performs that same function as ubifs_read_node except that
  * it does not require that there is actually a node present and instead
  * the return code indicates if a node was read.
+ *
+ * Note, this function does not check CRC of data nodes if @c->no_chk_data_crc
+ * is true (it is controlled by corresponding mount option). However, if
+ * @c->always_chk_crc is true, @c->no_chk_data_crc is ignored and CRC is always
+ * checked.
  */
 static int try_read_node(const struct ubifs_info *c, void *buf, int type,
                         int len, int lnum, int offs)
@@ -470,9 +475,8 @@ static int try_read_node(const struct ubifs_info *c, void *buf, int type,
        if (node_len != len)
                return 0;
 
-       if (type == UBIFS_DATA_NODE && !c->always_chk_crc)
-               if (c->no_chk_data_crc)
-                       return 0;
+       if (type == UBIFS_DATA_NODE && !c->always_chk_crc && c->no_chk_data_crc)
+               return 1;
 
        crc = crc32(UBIFS_CRC32_INIT, buf + 8, node_len - 8);
        node_crc = le32_to_cpu(ch->crc);
@@ -1506,7 +1510,7 @@ out:
  *
  * Note, if the bulk-read buffer length (@bu->buf_len) is known, this function
  * makes sure bulk-read nodes fit the buffer. Otherwise, this function prepares
- * maxumum possible amount of nodes for bulk-read.
+ * maximum possible amount of nodes for bulk-read.
  */
 int ubifs_tnc_get_bu_keys(struct ubifs_info *c, struct bu_info *bu)
 {
index fc2a4cc66d03c75429a14de807c4fcf8d48a7cce..039a68bee29accc639034936c64cde4bbece9ad5 100644 (file)
@@ -426,9 +426,9 @@ struct ubifs_unclean_leb {
  * LEB properties flags.
  *
  * LPROPS_UNCAT: not categorized
- * LPROPS_DIRTY: dirty > 0, not index
+ * LPROPS_DIRTY: dirty > free, dirty >= @c->dead_wm, not index
  * LPROPS_DIRTY_IDX: dirty + free > @c->min_idx_node_sze and index
- * LPROPS_FREE: free > 0, not empty, not index
+ * LPROPS_FREE: free > 0, dirty < @c->dead_wm, not empty, not index
  * LPROPS_HEAP_CNT: number of heaps used for storing categorized LEBs
  * LPROPS_EMPTY: LEB is empty, not taken
  * LPROPS_FREEABLE: free + dirty == leb_size, not index, not taken
@@ -961,7 +961,6 @@ struct ubifs_debug_info;
  * @cs_lock: commit state lock
  * @cmt_wq: wait queue to sleep on if the log is full and a commit is running
  *
- * @fast_unmount: do not run journal commit before un-mounting
  * @big_lpt: flag that LPT is too big to write whole during commit
  * @no_chk_data_crc: do not check CRCs when reading data nodes (except during
  *                   recovery)
@@ -1202,7 +1201,6 @@ struct ubifs_info {
        spinlock_t cs_lock;
        wait_queue_head_t cmt_wq;
 
-       unsigned int fast_unmount:1;
        unsigned int big_lpt:1;
        unsigned int no_chk_data_crc:1;
        unsigned int bulk_read:1;
@@ -1405,13 +1403,13 @@ extern struct list_head ubifs_infos;
 extern spinlock_t ubifs_infos_lock;
 extern atomic_long_t ubifs_clean_zn_cnt;
 extern struct kmem_cache *ubifs_inode_slab;
-extern struct super_operations ubifs_super_operations;
-extern struct address_space_operations ubifs_file_address_operations;
-extern struct file_operations ubifs_file_operations;
-extern struct inode_operations ubifs_file_inode_operations;
-extern struct file_operations ubifs_dir_operations;
-extern struct inode_operations ubifs_dir_inode_operations;
-extern struct inode_operations ubifs_symlink_inode_operations;
+extern const struct super_operations ubifs_super_operations;
+extern const struct address_space_operations ubifs_file_address_operations;
+extern const struct file_operations ubifs_file_operations;
+extern const struct inode_operations ubifs_file_inode_operations;
+extern const struct file_operations ubifs_dir_operations;
+extern const struct inode_operations ubifs_dir_inode_operations;
+extern const struct inode_operations ubifs_symlink_inode_operations;
 extern struct backing_dev_info ubifs_backing_dev_info;
 extern struct ubifs_compressor *ubifs_compressors[UBIFS_COMPR_TYPES_CNT];
 
@@ -1428,7 +1426,7 @@ int ubifs_read_node_wbuf(struct ubifs_wbuf *wbuf, void *buf, int type, int len,
 int ubifs_write_node(struct ubifs_info *c, void *node, int len, int lnum,
                     int offs, int dtype);
 int ubifs_check_node(const struct ubifs_info *c, const void *buf, int lnum,
-                    int offs, int quiet, int chk_crc);
+                    int offs, int quiet, int must_chk_crc);
 void ubifs_prepare_node(struct ubifs_info *c, void *buf, int len, int pad);
 void ubifs_prep_grp_node(struct ubifs_info *c, void *node, int len, int last);
 int ubifs_io_init(struct ubifs_info *c);
@@ -1495,6 +1493,7 @@ void ubifs_release_ino_dirty(struct ubifs_info *c, struct inode *inode,
 void ubifs_cancel_ino_op(struct ubifs_info *c, struct inode *inode,
                         struct ubifs_budget_req *req);
 long long ubifs_get_free_space(struct ubifs_info *c);
+long long ubifs_get_free_space_nolock(struct ubifs_info *c);
 int ubifs_calc_min_idx_lebs(struct ubifs_info *c);
 void ubifs_convert_page_budget(struct ubifs_info *c);
 long long ubifs_reported_space(const struct ubifs_info *c, long long free);
@@ -1603,6 +1602,7 @@ void ubifs_delete_orphan(struct ubifs_info *c, ino_t inum);
 int ubifs_orphan_start_commit(struct ubifs_info *c);
 int ubifs_orphan_end_commit(struct ubifs_info *c);
 int ubifs_mount_orphans(struct ubifs_info *c, int unclean, int read_only);
+int ubifs_clear_orphans(struct ubifs_info *c);
 
 /* lpt.c */
 int ubifs_calc_lpt_geom(struct ubifs_info *c);
@@ -1646,7 +1646,7 @@ const struct ubifs_lprops *ubifs_change_lp(struct ubifs_info *c,
                                           const struct ubifs_lprops *lp,
                                           int free, int dirty, int flags,
                                           int idx_gc_cnt);
-void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *stats);
+void ubifs_get_lp_stats(struct ubifs_info *c, struct ubifs_lp_stats *lst);
 void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops,
                      int cat);
 void ubifs_replace_cat(struct ubifs_info *c, struct ubifs_lprops *old_lprops,
index d71dc44e21edbe7077bda8d35f9b259aac61522d..cb329edc925b915ae5e590edeb4840810f811326 100644 (file)
@@ -165,6 +165,75 @@ test_page_region(
        return (mask && (page_private(page) & mask) == mask);
 }
 
+/*
+ *     Mapping of multi-page buffers into contiguous virtual space
+ */
+
+typedef struct a_list {
+       void            *vm_addr;
+       struct a_list   *next;
+} a_list_t;
+
+static a_list_t                *as_free_head;
+static int             as_list_len;
+static DEFINE_SPINLOCK(as_lock);
+
+/*
+ *     Try to batch vunmaps because they are costly.
+ */
+STATIC void
+free_address(
+       void            *addr)
+{
+       a_list_t        *aentry;
+
+#ifdef CONFIG_XEN
+       /*
+        * Xen needs to be able to make sure it can get an exclusive
+        * RO mapping of pages it wants to turn into a pagetable.  If
+        * a newly allocated page is also still being vmap()ed by xfs,
+        * it will cause pagetable construction to fail.  This is a
+        * quick workaround to always eagerly unmap pages so that Xen
+        * is happy.
+        */
+       vunmap(addr);
+       return;
+#endif
+
+       aentry = kmalloc(sizeof(a_list_t), GFP_NOWAIT);
+       if (likely(aentry)) {
+               spin_lock(&as_lock);
+               aentry->next = as_free_head;
+               aentry->vm_addr = addr;
+               as_free_head = aentry;
+               as_list_len++;
+               spin_unlock(&as_lock);
+       } else {
+               vunmap(addr);
+       }
+}
+
+STATIC void
+purge_addresses(void)
+{
+       a_list_t        *aentry, *old;
+
+       if (as_free_head == NULL)
+               return;
+
+       spin_lock(&as_lock);
+       aentry = as_free_head;
+       as_free_head = NULL;
+       as_list_len = 0;
+       spin_unlock(&as_lock);
+
+       while ((old = aentry) != NULL) {
+               vunmap(aentry->vm_addr);
+               aentry = aentry->next;
+               kfree(old);
+       }
+}
+
 /*
  *     Internal xfs_buf_t object manipulation
  */
@@ -264,7 +333,7 @@ xfs_buf_free(
                uint            i;
 
                if ((bp->b_flags & XBF_MAPPED) && (bp->b_page_count > 1))
-                       vm_unmap_ram(bp->b_addr - bp->b_offset, bp->b_page_count);
+                       free_address(bp->b_addr - bp->b_offset);
 
                for (i = 0; i < bp->b_page_count; i++) {
                        struct page     *page = bp->b_pages[i];
@@ -386,8 +455,10 @@ _xfs_buf_map_pages(
                bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset;
                bp->b_flags |= XBF_MAPPED;
        } else if (flags & XBF_MAPPED) {
-               bp->b_addr = vm_map_ram(bp->b_pages, bp->b_page_count,
-                                       -1, PAGE_KERNEL);
+               if (as_list_len > 64)
+                       purge_addresses();
+               bp->b_addr = vmap(bp->b_pages, bp->b_page_count,
+                                       VM_MAP, PAGE_KERNEL);
                if (unlikely(bp->b_addr == NULL))
                        return -ENOMEM;
                bp->b_addr += bp->b_offset;
@@ -1672,6 +1743,8 @@ xfsbufd(
                        count++;
                }
 
+               if (as_list_len > 0)
+                       purge_addresses();
                if (count)
                        blk_run_address_space(target->bt_mapping);
 
index 2ed035354c26aab0b40cbd85c83df7b5bb36cd84..a608e72fa4054c3892bfc45b17e0343d21fd31ce 100644 (file)
@@ -371,7 +371,11 @@ xfs_quiesce_attr(
        /* flush inodes and push all remaining buffers out to disk */
        xfs_quiesce_fs(mp);
 
-       ASSERT_ALWAYS(atomic_read(&mp->m_active_trans) == 0);
+       /*
+        * Just warn here till VFS can correctly support
+        * read-only remount without racing.
+        */
+       WARN_ON(atomic_read(&mp->m_active_trans) != 0);
 
        /* Push the superblock and write an unmount record */
        error = xfs_log_sbcount(mp, 1);
index b4c1ee713492315f03f097ec66611c6f0b602d31..f8278cfcc1d328a1a9542663d448607de1c5f561 100644 (file)
@@ -55,17 +55,11 @@ xfs_swapext(
        struct file     *file, *target_file;
        int             error = 0;
 
-       sxp = kmem_alloc(sizeof(xfs_swapext_t), KM_MAYFAIL);
-       if (!sxp) {
-               error = XFS_ERROR(ENOMEM);
-               goto out;
-       }
-
        /* Pull information for the target fd */
        file = fget((int)sxp->sx_fdtarget);
        if (!file) {
                error = XFS_ERROR(EINVAL);
-               goto out_free_sxp;
+               goto out;
        }
 
        if (!(file->f_mode & FMODE_WRITE) || (file->f_flags & O_APPEND)) {
@@ -109,8 +103,6 @@ xfs_swapext(
        fput(target_file);
  out_put_file:
        fput(file);
- out_free_sxp:
-       kmem_free(sxp);
  out:
        return error;
 }
index 35cca98bd94c90c926dd3db7ae49974661577a4c..b1047de2fffd5a66d465c9bdff399b82205cf596 100644 (file)
@@ -70,16 +70,21 @@ STATIC void xlog_recover_check_summary(xlog_t *);
 xfs_buf_t *
 xlog_get_bp(
        xlog_t          *log,
-       int             num_bblks)
+       int             nbblks)
 {
-       ASSERT(num_bblks > 0);
+       if (nbblks <= 0 || nbblks > log->l_logBBsize) {
+               xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
+               XFS_ERROR_REPORT("xlog_get_bp(1)",
+                                XFS_ERRLEVEL_HIGH, log->l_mp);
+               return NULL;
+       }
 
        if (log->l_sectbb_log) {
-               if (num_bblks > 1)
-                       num_bblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
-               num_bblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, num_bblks);
+               if (nbblks > 1)
+                       nbblks += XLOG_SECTOR_ROUNDUP_BBCOUNT(log, 1);
+               nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
        }
-       return xfs_buf_get_noaddr(BBTOB(num_bblks), log->l_mp->m_logdev_targp);
+       return xfs_buf_get_noaddr(BBTOB(nbblks), log->l_mp->m_logdev_targp);
 }
 
 void
@@ -102,6 +107,13 @@ xlog_bread(
 {
        int             error;
 
+       if (nbblks <= 0 || nbblks > log->l_logBBsize) {
+               xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
+               XFS_ERROR_REPORT("xlog_bread(1)",
+                                XFS_ERRLEVEL_HIGH, log->l_mp);
+               return EFSCORRUPTED;
+       }
+
        if (log->l_sectbb_log) {
                blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
                nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
@@ -139,6 +151,13 @@ xlog_bwrite(
 {
        int             error;
 
+       if (nbblks <= 0 || nbblks > log->l_logBBsize) {
+               xlog_warn("XFS: Invalid block length (0x%x) given for buffer", nbblks);
+               XFS_ERROR_REPORT("xlog_bwrite(1)",
+                                XFS_ERRLEVEL_HIGH, log->l_mp);
+               return EFSCORRUPTED;
+       }
+
        if (log->l_sectbb_log) {
                blk_no = XLOG_SECTOR_ROUNDDOWN_BLKNO(log, blk_no);
                nbblks = XLOG_SECTOR_ROUNDUP_BBCOUNT(log, nbblks);
index e72bfdd887f9b285ccbb3530be8096d61aeb74a8..552637b0d051d2677818e4e8f841fe9f1499ee64 100644 (file)
@@ -14,6 +14,7 @@
 #define ACPI_PDC_SMP_T_SWCOORD         (0x0080)
 #define ACPI_PDC_C_C1_FFH              (0x0100)
 #define ACPI_PDC_C_C2C3_FFH            (0x0200)
+#define ACPI_PDC_SMP_P_HWCOORD         (0x0800)
 
 #define ACPI_PDC_EST_CAPABILITY_SMP    (ACPI_PDC_SMP_C1PT | \
                                         ACPI_PDC_C_C1_HALT | \
@@ -22,6 +23,7 @@
 #define ACPI_PDC_EST_CAPABILITY_SWSMP  (ACPI_PDC_SMP_C1PT | \
                                         ACPI_PDC_C_C1_HALT | \
                                         ACPI_PDC_SMP_P_SWCOORD | \
+                                        ACPI_PDC_SMP_P_HWCOORD | \
                                         ACPI_PDC_P_FFH)
 
 #define ACPI_PDC_C_CAPABILITY_SMP      (ACPI_PDC_SMP_C2C3  | \
index 83c51aba534b727a363d22559eaa153dd90c9dda..e16fdb1f4f4fe11caada4239cbc621f084936552 100644 (file)
@@ -478,7 +478,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 #define __swp_type(x)                  (((x).val >> 2) & 0x1f)
 #define __swp_offset(x)                        ((x).val >> 8)
 #define __swp_entry(type, offset)      ((swp_entry_t) { ((type) << 2) | ((offset) << 8) })
-#define __pte_to_swp_entry(pte)                ((swp_entry_t) { (pte).pte })
+#define __pte_to_swp_entry(_pte)       ((swp_entry_t) { (_pte).pte })
 #define __swp_entry_to_pte(x)          ((pte_t) { (x).val })
 
 static inline int pte_file(pte_t pte)
index e51ca67b9356c5dfac236509c2ea00387a3ee911..57c3d4054e8bd9bf082eb151d632b0ab841f9035 100644 (file)
@@ -54,5 +54,8 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_SOCKET_H */
 
index 9a0e200122249e5cae09d90d73b01d820dbe9e83..be7ed589af5cbd37231ee8851677bbf09231a892 100644 (file)
@@ -54,4 +54,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_M32R_SOCKET_H */
index 80af9c4ccad7f05cd09db4d0d212ec2a0753ed04..fb5daf438ec92b0fb244f29b094357272e5a1362 100644 (file)
@@ -54,4 +54,7 @@
 
 #define SO_MARK                        36
 
+#define SO_TIMESTAMPING                37
+#define SCM_TIMESTAMPING       SO_TIMESTAMPING
+
 #endif /* _ASM_SOCKET_H */
index cd16d6e668ce78a523a7865f747d5078ad0ecd76..d797e119e3d5e9677a60457670ed097982916691 100644 (file)
@@ -222,7 +222,7 @@ static inline struct crypto_tfm *crypto_shash_tfm(struct crypto_shash *tfm)
 
 static inline void crypto_free_shash(struct crypto_shash *tfm)
 {
-       crypto_free_tfm(crypto_shash_tfm(tfm));
+       crypto_destroy_tfm(tfm, crypto_shash_tfm(tfm));
 }
 
 static inline unsigned int crypto_shash_alignmask(
index 8190b9bcc2d967e366833e04823f6899e9e33aea..e5f4ae989abf15bd0b7ead6428840584cede0f85 100644 (file)
@@ -1321,6 +1321,8 @@ void drm_gem_object_free(struct kref *kref);
 struct drm_gem_object *drm_gem_object_alloc(struct drm_device *dev,
                                            size_t size);
 void drm_gem_object_handle_free(struct kref *kref);
+void drm_gem_vm_open(struct vm_area_struct *vma);
+void drm_gem_vm_close(struct vm_area_struct *vma);
 int drm_gem_mmap(struct file *filp, struct vm_area_struct *vma);
 
 static inline void
index d54de24bf371f52025d6bad298f01b50b8b5522f..5ded1acfb5430fd969094e9fa817c285aefa9611 100644 (file)
@@ -609,7 +609,7 @@ extern char *drm_get_dvi_i_subconnector_name(int val);
 extern char *drm_get_dvi_i_select_name(int val);
 extern char *drm_get_tv_subconnector_name(int val);
 extern char *drm_get_tv_select_name(int val);
-extern void drm_fb_release(struct file *filp);
+extern void drm_fb_release(struct drm_file *file_priv);
 extern int drm_mode_group_init_legacy_group(struct drm_device *dev, struct drm_mode_group *group);
 extern struct edid *drm_get_edid(struct drm_connector *connector,
                                 struct i2c_adapter *adapter);
index 0c6f0e11b41bcfc823d94571c3be853087440e5a..0b0d236c215469120e031af56d5e80a4ca475e5c 100644 (file)
@@ -54,13 +54,13 @@ struct drm_crtc_helper_funcs {
                           struct drm_display_mode *mode,
                           struct drm_display_mode *adjusted_mode);
        /* Actually set the mode */
-       void (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
-                        struct drm_display_mode *adjusted_mode, int x, int y,
-                        struct drm_framebuffer *old_fb);
+       int (*mode_set)(struct drm_crtc *crtc, struct drm_display_mode *mode,
+                       struct drm_display_mode *adjusted_mode, int x, int y,
+                       struct drm_framebuffer *old_fb);
 
        /* Move the crtc on the current fb to the given position *optional* */
-       void (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
-                             struct drm_framebuffer *old_fb);
+       int (*mode_set_base)(struct drm_crtc *crtc, int x, int y,
+                            struct drm_framebuffer *old_fb);
 };
 
 struct drm_encoder_helper_funcs {
index b3bcf72dc65623f412c3902a425ffdcd98b9b563..912cd52db96501fc692a509e7ca775c76462a46f 100644 (file)
@@ -261,6 +261,7 @@ typedef struct drm_i915_irq_wait {
 #define I915_PARAM_LAST_DISPATCH         3
 #define I915_PARAM_CHIPSET_ID            4
 #define I915_PARAM_HAS_GEM               5
+#define I915_PARAM_NUM_FENCES_AVAIL      6
 
 typedef struct drm_i915_getparam {
        int param;
@@ -272,6 +273,7 @@ typedef struct drm_i915_getparam {
 #define I915_SETPARAM_USE_MI_BATCHBUFFER_START            1
 #define I915_SETPARAM_TEX_LRU_LOG_GRANULARITY             2
 #define I915_SETPARAM_ALLOW_BATCHBUFFER                   3
+#define I915_SETPARAM_NUM_USED_FENCES                     4
 
 typedef struct drm_i915_setparam {
        int param;
index a1916078fd080a3d5ce02728c82d529febb69d23..cd4bcb6989ce0e888d7e62f1e771c18e9b2f404e 100644 (file)
@@ -235,8 +235,6 @@ struct Outgoing {
 
 
 struct arcnet_local {
-       struct net_device_stats stats;
-
        uint8_t config,         /* current value of CONFIG register */
                timeout,        /* Extended timeout for COM20020 */
                backplane,      /* Backplane flag for COM20020 */
@@ -335,7 +333,12 @@ void arcnet_dump_skb(struct net_device *dev, struct sk_buff *skb, char *desc);
 
 void arcnet_unregister_proto(struct ArcProto *proto);
 irqreturn_t arcnet_interrupt(int irq, void *dev_id);
-struct net_device *alloc_arcdev(char *name);
+struct net_device *alloc_arcdev(const char *name);
+
+int arcnet_open(struct net_device *dev);
+int arcnet_close(struct net_device *dev);
+int arcnet_send_packet(struct sk_buff *skb, struct net_device *dev);
+void arcnet_timeout(struct net_device *dev);
 
 #endif                         /* __KERNEL__ */
 #endif                         /* _LINUX_ARCDEVICE_H */
index c4ecacd0b32771729e68b9b30f766ae55a42a8c6..68a9530196f299c518856e6e4926376fcc4560cf 100644 (file)
@@ -17,9 +17,11 @@ typedef u64 async_cookie_t;
 typedef void (async_func_ptr) (void *data, async_cookie_t cookie);
 
 extern async_cookie_t async_schedule(async_func_ptr *ptr, void *data);
-extern async_cookie_t async_schedule_special(async_func_ptr *ptr, void *data, struct list_head *list);
+extern async_cookie_t async_schedule_domain(async_func_ptr *ptr, void *data,
+                                           struct list_head *list);
 extern void async_synchronize_full(void);
-extern void async_synchronize_full_special(struct list_head *list);
+extern void async_synchronize_full_domain(struct list_head *list);
 extern void async_synchronize_cookie(async_cookie_t cookie);
-extern void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *list);
+extern void async_synchronize_cookie_domain(async_cookie_t cookie,
+                                           struct list_head *list);
 
index a53318b8cbd0ea9a4b7a69f3376cb11036a5ff32..08a86d5cdf1b7ea2c6c995f1073aaa59092d9a8c 100644 (file)
@@ -731,12 +731,17 @@ static inline int ata_id_current_chs_valid(const u16 *id)
 
 static inline int ata_id_is_cfa(const u16 *id)
 {
-       if (id[ATA_ID_CONFIG] == 0x848A)        /* Standard CF */
+       if (id[ATA_ID_CONFIG] == 0x848A)        /* Traditional CF */
                return 1;
-       /* Could be CF hiding as standard ATA */
-       if (ata_id_major_version(id) >= 3 &&
-           id[ATA_ID_COMMAND_SET_1] != 0xFFFF &&
-          (id[ATA_ID_COMMAND_SET_1] & (1 << 2)))
+       /*
+        * CF specs don't require specific value in the word 0 anymore and yet
+        * they forbid to report the ATA version in the word 80 and require the
+        * CFA feature set support to be indicated in the word 83 in this case.
+        * Unfortunately, some cards only follow either of this requirements,
+        * and while those that don't indicate CFA feature support need some
+        * sort of quirk list, it seems impractical for the ones that do...
+        */
+       if ((id[ATA_ID_COMMAND_SET_2] & 0xC004) == 0x4004)
                return 1;
        return 0;
 }
diff --git a/include/linux/ath9k_platform.h b/include/linux/ath9k_platform.h
new file mode 100644 (file)
index 0000000..b847fc7
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2008 Atheros Communications Inc.
+ * Copyright (c) 2009 Gabor Juhos <juhosg@openwrt.org>
+ * Copyright (c) 2009 Imre Kaloz <kaloz@openwrt.org>
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _LINUX_ATH9K_PLATFORM_H
+#define _LINUX_ATH9K_PLATFORM_H
+
+#define ATH9K_PLAT_EEP_MAX_WORDS       2048
+
+struct ath9k_platform_data {
+       u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
+};
+
+#endif /* _LINUX_ATH9K_PLATFORM_H */
index 2aa283ab062b215ddb37975d8e55193ecd502c5f..1b16108a54174346e2f64be1aca0b6474c1e13e8 100644 (file)
@@ -171,8 +171,6 @@ struct bio {
 #define BIO_RW_FAILFAST_TRANSPORT      8
 #define BIO_RW_FAILFAST_DRIVER         9
 
-#define BIO_RW_SYNC    (BIO_RW_SYNCIO | BIO_RW_UNPLUG)
-
 #define bio_rw_flagged(bio, flag)      ((bio)->bi_rw & (1 << (flag)))
 
 /*
index 25379cba2370f2dd6cb11931d9a6649aaee40a8d..6e915878e88c2a4c8b27bea51e1a6e010fee93e9 100644 (file)
@@ -15,6 +15,7 @@ enum blktrace_cat {
        BLK_TC_WRITE    = 1 << 1,       /* writes */
        BLK_TC_BARRIER  = 1 << 2,       /* barrier */
        BLK_TC_SYNC     = 1 << 3,       /* sync IO */
+       BLK_TC_SYNCIO   = BLK_TC_SYNC,
        BLK_TC_QUEUE    = 1 << 4,       /* queueing/merging */
        BLK_TC_REQUEUE  = 1 << 5,       /* requeueing */
        BLK_TC_ISSUE    = 1 << 6,       /* issue */
index e4e8e117d27d9171f23cdc54b69011758243c3da..499900d0cee7110748229ee3898b50734352e5e4 100644 (file)
@@ -378,6 +378,7 @@ struct cgroup_subsys {
         * - initiating hotplug events
         */
        struct mutex hierarchy_mutex;
+       struct lock_class_key subsys_key;
 
        /*
         * Link to parent, and list entry in parent's children.
index f88d32f8ff7c8a0d242763328c8e14f39445006d..573819ef4cc076bd56f16ce0d7414e1225df906f 100644 (file)
 typedef u64 cycle_t;
 struct clocksource;
 
+/**
+ * struct cyclecounter - hardware abstraction for a free running counter
+ *     Provides completely state-free accessors to the underlying hardware.
+ *     Depending on which hardware it reads, the cycle counter may wrap
+ *     around quickly. Locking rules (if necessary) have to be defined
+ *     by the implementor and user of specific instances of this API.
+ *
+ * @read:              returns the current cycle value
+ * @mask:              bitmask for two's complement
+ *                     subtraction of non 64 bit counters,
+ *                     see CLOCKSOURCE_MASK() helper macro
+ * @mult:              cycle to nanosecond multiplier
+ * @shift:             cycle to nanosecond divisor (power of two)
+ */
+struct cyclecounter {
+       cycle_t (*read)(const struct cyclecounter *cc);
+       cycle_t mask;
+       u32 mult;
+       u32 shift;
+};
+
+/**
+ * struct timecounter - layer above a %struct cyclecounter which counts nanoseconds
+ *     Contains the state needed by timecounter_read() to detect
+ *     cycle counter wrap around. Initialize with
+ *     timecounter_init(). Also used to convert cycle counts into the
+ *     corresponding nanosecond counts with timecounter_cyc2time(). Users
+ *     of this code are responsible for initializing the underlying
+ *     cycle counter hardware, locking issues and reading the time
+ *     more often than the cycle counter wraps around. The nanosecond
+ *     counter will only wrap around after ~585 years.
+ *
+ * @cc:                        the cycle counter used by this instance
+ * @cycle_last:                most recent cycle counter value seen by
+ *                     timecounter_read()
+ * @nsec:              continuously increasing count
+ */
+struct timecounter {
+       const struct cyclecounter *cc;
+       cycle_t cycle_last;
+       u64 nsec;
+};
+
+/**
+ * cyclecounter_cyc2ns - converts cycle counter cycles to nanoseconds
+ * @tc:                Pointer to cycle counter.
+ * @cycles:    Cycles
+ *
+ * XXX - This could use some mult_lxl_ll() asm optimization. Same code
+ * as in cyc2ns, but with unsigned result.
+ */
+static inline u64 cyclecounter_cyc2ns(const struct cyclecounter *cc,
+                                     cycle_t cycles)
+{
+       u64 ret = (u64)cycles;
+       ret = (ret * cc->mult) >> cc->shift;
+       return ret;
+}
+
+/**
+ * timecounter_init - initialize a time counter
+ * @tc:                        Pointer to time counter which is to be initialized/reset
+ * @cc:                        A cycle counter, ready to be used.
+ * @start_tstamp:      Arbitrary initial time stamp.
+ *
+ * After this call the current cycle register (roughly) corresponds to
+ * the initial time stamp. Every call to timecounter_read() increments
+ * the time stamp counter by the number of elapsed nanoseconds.
+ */
+extern void timecounter_init(struct timecounter *tc,
+                            const struct cyclecounter *cc,
+                            u64 start_tstamp);
+
+/**
+ * timecounter_read - return nanoseconds elapsed since timecounter_init()
+ *                    plus the initial time stamp
+ * @tc:          Pointer to time counter.
+ *
+ * In other words, keeps track of time since the same epoch as
+ * the function which generated the initial time stamp.
+ */
+extern u64 timecounter_read(struct timecounter *tc);
+
+/**
+ * timecounter_cyc2time - convert a cycle counter to same
+ *                        time base as values returned by
+ *                        timecounter_read()
+ * @tc:                Pointer to time counter.
+ * @cycle:     a value returned by tc->cc->read()
+ *
+ * Cycle counts that are converted correctly as long as they
+ * fall into the interval [-1/2 max cycle count, +1/2 max cycle count],
+ * with "max cycle count" == cs->mask+1.
+ *
+ * This allows conversion of cycle counter values which were generated
+ * in the past.
+ */
+extern u64 timecounter_cyc2time(struct timecounter *tc,
+                               cycle_t cycle_tstamp);
+
 /**
  * struct clocksource - hardware abstraction for a free running counter
  *     Provides mostly state-free accessors to the underlying hardware.
+ *     This is the structure used for system time.
  *
  * @name:              ptr to clocksource name
  * @list:              list head for registration
index ac6d9a43e0853b672aed7b34ea46a6a2eeea9e19..5dcfb944b6ce11591f0623543ff48bb9e03be60d 100644 (file)
@@ -29,6 +29,7 @@
 
 int com20020_check(struct net_device *dev);
 int com20020_found(struct net_device *dev, int shared);
+extern const struct net_device_ops com20020_netdev_ops;
 
 /* The number of low I/O ports used by the card. */
 #define ARCNET_TOTAL_SIZE 8
index 34f2789d9b9b0e5208e8a2eeeb085b94573efb8d..fc65d219d88c55759d734f6c6fbfb50fff9a7805 100644 (file)
@@ -109,6 +109,12 @@ struct cn_queue_dev {
        unsigned char name[CN_CBQ_NAMELEN];
 
        struct workqueue_struct *cn_queue;
+       /* Sent to kevent to create cn_queue only when needed */
+       struct work_struct wq_creation;
+       /* Tell if the wq_creation job is pending/completed */
+       atomic_t wq_requested;
+       /* Wait for cn_queue to be created */
+       wait_queue_head_t wq_created;
 
        struct list_head queue_list;
        spinlock_t queue_lock;
@@ -164,6 +170,8 @@ int cn_netlink_send(struct cn_msg *, u32, gfp_t);
 int cn_queue_add_callback(struct cn_queue_dev *dev, char *name, struct cb_id *id, void (*callback)(void *));
 void cn_queue_del_callback(struct cn_queue_dev *dev, struct cb_id *id);
 
+int queue_cn_work(struct cn_callback_entry *cbq, struct work_struct *work);
+
 struct cn_queue_dev *cn_queue_alloc_dev(char *name, struct sock *);
 void cn_queue_free_dev(struct cn_queue_dev *dev);
 
index 3bacd71509fb1ce7197ac675044807a2d76f2fd1..1f2e9020acc667d5f0dd0f2e501e6f85f0fff140 100644 (file)
@@ -552,7 +552,12 @@ struct crypto_tfm *crypto_alloc_tfm(const char *alg_name,
                                    const struct crypto_type *frontend,
                                    u32 type, u32 mask);
 struct crypto_tfm *crypto_alloc_base(const char *alg_name, u32 type, u32 mask);
-void crypto_free_tfm(struct crypto_tfm *tfm);
+void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm);
+
+static inline void crypto_free_tfm(struct crypto_tfm *tfm)
+{
+       return crypto_destroy_tfm(tfm, tfm);
+}
 
 int alg_test(const char *driver, const char *alg, u32 type, u32 mask);
 
index 61734e27abb7b6fc5e0c54d018c8969381a23c86..7434a8353e2301dcb548ad94965ef0e73390335f 100644 (file)
@@ -355,46 +355,6 @@ static inline unsigned int dccp_hdr_len(const struct sk_buff *skb)
        return __dccp_hdr_len(dccp_hdr(skb));
 }
 
-
-/* initial values for each feature */
-#define DCCPF_INITIAL_SEQUENCE_WINDOW          100
-#define DCCPF_INITIAL_ACK_RATIO                        2
-#define DCCPF_INITIAL_CCID                     DCCPC_CCID2
-/* FIXME: for now we're default to 1 but it should really be 0 */
-#define DCCPF_INITIAL_SEND_NDP_COUNT           1
-
-/**
-  * struct dccp_minisock - Minimal DCCP connection representation
-  *
-  * Will be used to pass the state from dccp_request_sock to dccp_sock.
-  *
-  * @dccpms_sequence_window - Sequence Window Feature (section 7.5.2)
-  * @dccpms_pending - List of features being negotiated
-  * @dccpms_conf -
-  */
-struct dccp_minisock {
-       __u64                   dccpms_sequence_window;
-       struct list_head        dccpms_pending;
-       struct list_head        dccpms_conf;
-};
-
-struct dccp_opt_conf {
-       __u8                    *dccpoc_val;
-       __u8                    dccpoc_len;
-};
-
-struct dccp_opt_pend {
-       struct list_head        dccpop_node;
-       __u8                    dccpop_type;
-       __u8                    dccpop_feat;
-       __u8                    *dccpop_val;
-       __u8                    dccpop_len;
-       int                     dccpop_conf;
-       struct dccp_opt_conf    *dccpop_sc;
-};
-
-extern void dccp_minisock_init(struct dccp_minisock *dmsk);
-
 /**
  * struct dccp_request_sock  -  represent DCCP-specific connection request
  * @dreq_inet_rsk: structure inherited from
@@ -483,13 +443,14 @@ struct dccp_ackvec;
  * @dccps_timestamp_time - time of receiving latest @dccps_timestamp_echo
  * @dccps_l_ack_ratio - feature-local Ack Ratio
  * @dccps_r_ack_ratio - feature-remote Ack Ratio
+ * @dccps_l_seq_win - local Sequence Window (influences ack number validity)
+ * @dccps_r_seq_win - remote Sequence Window (influences seq number validity)
  * @dccps_pcslen - sender   partial checksum coverage (via sockopt)
  * @dccps_pcrlen - receiver partial checksum coverage (via sockopt)
  * @dccps_send_ndp_count - local Send NDP Count feature (7.7.2)
  * @dccps_ndp_count - number of Non Data Packets since last data packet
  * @dccps_mss_cache - current value of MSS (path MTU minus header sizes)
  * @dccps_rate_last - timestamp for rate-limiting DCCP-Sync (RFC 4340, 7.5.4)
- * @dccps_minisock - associated minisock (accessed via dccp_msk)
  * @dccps_featneg - tracks feature-negotiation state (mostly during handshake)
  * @dccps_hc_rx_ackvec - rx half connection ack vector
  * @dccps_hc_rx_ccid - CCID used for the receiver (or receiving half-connection)
@@ -523,12 +484,13 @@ struct dccp_sock {
        __u32                           dccps_timestamp_time;
        __u16                           dccps_l_ack_ratio;
        __u16                           dccps_r_ack_ratio;
+       __u64                           dccps_l_seq_win:48;
+       __u64                           dccps_r_seq_win:48;
        __u8                            dccps_pcslen:4;
        __u8                            dccps_pcrlen:4;
        __u8                            dccps_send_ndp_count:1;
        __u64                           dccps_ndp_count:48;
        unsigned long                   dccps_rate_last;
-       struct dccp_minisock            dccps_minisock;
        struct list_head                dccps_featneg;
        struct dccp_ackvec              *dccps_hc_rx_ackvec;
        struct ccid                     *dccps_hc_rx_ccid;
@@ -546,11 +508,6 @@ static inline struct dccp_sock *dccp_sk(const struct sock *sk)
        return (struct dccp_sock *)sk;
 }
 
-static inline struct dccp_minisock *dccp_msk(const struct sock *sk)
-{
-       return (struct dccp_minisock *)&dccp_sk(sk)->dccps_minisock;
-}
-
 static inline const char *dccp_role(const struct sock *sk)
 {
        switch (dccp_sk(sk)->dccps_role) {
index 45e5b1921fbb5ceeb50a33514a423b53d9d46cd0..47f343c7bddaaca551c8fb2114160fb5f362c4e1 100644 (file)
@@ -147,6 +147,8 @@ extern void put_driver(struct device_driver *drv);
 extern struct device_driver *driver_find(const char *name,
                                         struct bus_type *bus);
 extern int driver_probe_done(void);
+extern int wait_for_device_probe(void);
+
 
 /* sysfs interface for exporting driver attributes */
 
index 3e68469c1885e3df7e7078b0c39aab5237cb7f06..f0413845f20ee75481543cb97c570d6dbda142b4 100644 (file)
@@ -121,6 +121,7 @@ struct dma_chan_percpu {
  * @local: per-cpu pointer to a struct dma_chan_percpu
  * @client-count: how many clients are using this channel
  * @table_count: number of appearances in the mem-to-mem allocation table
+ * @private: private data for certain client-channel associations
  */
 struct dma_chan {
        struct dma_device *device;
@@ -134,6 +135,7 @@ struct dma_chan {
        struct dma_chan_percpu *local;
        int client_count;
        int table_count;
+       void *private;
 };
 
 /**
index ceb1454b69770d303508a137be39bc1772c54802..ec12cc74366f8ab33b0ddaff5a3406bd2d99ff63 100644 (file)
@@ -18,6 +18,7 @@ struct sock_extended_err
 #define SO_EE_ORIGIN_LOCAL     1
 #define SO_EE_ORIGIN_ICMP      2
 #define SO_EE_ORIGIN_ICMP6     3
+#define SO_EE_ORIGIN_TIMESTAMPING 4
 
 #define SO_EE_OFFENDER(ee)     ((struct sockaddr*)((ee)+1))
 
index 1cb0f0b90926116cdbe854b85a6b144a3bf021ed..a1f17abba7dc1123bc1884e74027f3604913f871 100644 (file)
@@ -184,4 +184,25 @@ static inline unsigned compare_ether_addr_64bits(const u8 addr1[6+2],
 }
 #endif /* __KERNEL__ */
 
+/**
+ * compare_ether_header - Compare two Ethernet headers
+ * @a: Pointer to Ethernet header
+ * @b: Pointer to Ethernet header
+ *
+ * Compare two ethernet headers, returns 0 if equal.
+ * This assumes that the network header (i.e., IP header) is 4-byte
+ * aligned OR the platform can handle unaligned access.  This is the
+ * case for all packets coming into netif_receive_skb or similar
+ * entry points.
+ */
+
+static inline int compare_ether_header(const void *a, const void *b)
+{
+       u32 *a32 = (u32 *)((u8 *)a + 2);
+       u32 *b32 = (u32 *)((u8 *)b + 2);
+
+       return (*(u16 *)a ^ *(u16 *)b) | (a32[0] ^ b32[0]) |
+              (a32[1] ^ b32[1]) | (a32[2] ^ b32[2]);
+}
+
 #endif /* _LINUX_ETHERDEVICE_H */
index 27c67a5422354dde23433ccd4c50676bd54b4198..131b127b70f8a1fb07ffa0e2a4aaba2166f12f78 100644 (file)
@@ -7,6 +7,7 @@
  * Portions Copyright 2002 Intel (eli.kupermann@intel.com,
  *                                christopher.leech@intel.com,
  *                                scott.feldman@intel.com)
+ * Portions Copyright (C) Sun Microsystems 2008
  */
 
 #ifndef _LINUX_ETHTOOL_H
@@ -287,10 +288,75 @@ enum ethtool_flags {
        ETH_FLAG_LRO            = (1 << 15),    /* LRO is enabled */
 };
 
-struct ethtool_rxnfc {
-       __u32           cmd;
+/* The following structures are for supporting RX network flow
+ * classification configuration. Note, all multibyte fields, e.g.,
+ * ip4src, ip4dst, psrc, pdst, spi, etc. are expected to be in network
+ * byte order.
+ */
+struct ethtool_tcpip4_spec {
+       __be32  ip4src;
+       __be32  ip4dst;
+       __be16  psrc;
+       __be16  pdst;
+       __u8    tos;
+};
+
+struct ethtool_ah_espip4_spec {
+       __be32  ip4src;
+       __be32  ip4dst;
+       __be32  spi;
+       __u8    tos;
+};
+
+struct ethtool_rawip4_spec {
+       __be32  ip4src;
+       __be32  ip4dst;
+       __u8    hdata[64];
+};
+
+struct ethtool_ether_spec {
+       __be16  ether_type;
+       __u8    frame_size;
+       __u8    eframe[16];
+};
+
+#define        ETH_RX_NFC_IP4  1
+#define        ETH_RX_NFC_IP6  2
+
+struct ethtool_usrip4_spec {
+       __be32  ip4src;
+       __be32  ip4dst;
+       __be32  l4_4_bytes;
+       __u8    tos;
+       __u8    ip_ver;
+       __u8    proto;
+};
+
+struct ethtool_rx_flow_spec {
        __u32           flow_type;
-       __u64           data;
+       union {
+               struct ethtool_tcpip4_spec              tcp_ip4_spec;
+               struct ethtool_tcpip4_spec              udp_ip4_spec;
+               struct ethtool_tcpip4_spec              sctp_ip4_spec;
+               struct ethtool_ah_espip4_spec           ah_ip4_spec;
+               struct ethtool_ah_espip4_spec           esp_ip4_spec;
+               struct ethtool_rawip4_spec              raw_ip4_spec;
+               struct ethtool_ether_spec               ether_spec;
+               struct ethtool_usrip4_spec              usr_ip4_spec;
+               __u8                                    hdata[64];
+       } h_u, m_u; /* entry, mask */
+       __u64           ring_cookie;
+       __u32           location;
+};
+
+struct ethtool_rxnfc {
+       __u32                           cmd;
+       __u32                           flow_type;
+       /* The rx flow hash value or the rule DB size */
+       __u64                           data;
+       struct ethtool_rx_flow_spec     fs;
+       __u32                           rule_cnt;
+       __u32                           rule_locs[0];
 };
 
 #ifdef __KERNEL__
@@ -417,8 +483,8 @@ struct ethtool_ops {
        /* the following hooks are obsolete */
        int     (*self_test_count)(struct net_device *);/* use get_sset_count */
        int     (*get_stats_count)(struct net_device *);/* use get_sset_count */
-       int     (*get_rxhash)(struct net_device *, struct ethtool_rxnfc *);
-       int     (*set_rxhash)(struct net_device *, struct ethtool_rxnfc *);
+       int     (*get_rxnfc)(struct net_device *, struct ethtool_rxnfc *, void *);
+       int     (*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
 };
 #endif /* __KERNEL__ */
 
@@ -469,6 +535,12 @@ struct ethtool_ops {
 #define        ETHTOOL_SRXFH           0x0000002a /* Set RX flow hash configuration */
 #define ETHTOOL_GGRO           0x0000002b /* Get GRO enable (ethtool_value) */
 #define ETHTOOL_SGRO           0x0000002c /* Set GRO enable (ethtool_value) */
+#define        ETHTOOL_GRXRINGS        0x0000002d /* Get RX rings available for LB */
+#define        ETHTOOL_GRXCLSRLCNT     0x0000002e /* Get RX class rule count */
+#define        ETHTOOL_GRXCLSRULE      0x0000002f /* Get RX classification rule */
+#define        ETHTOOL_GRXCLSRLALL     0x00000030 /* Get all RX classification rule */
+#define        ETHTOOL_SRXCLSRLDEL     0x00000031 /* Delete RX classification rule */
+#define        ETHTOOL_SRXCLSRLINS     0x00000032 /* Insert RX classification rule */
 
 /* compatibility with older code */
 #define SPARC_ETH_GSET         ETHTOOL_GSET
@@ -565,9 +637,13 @@ struct ethtool_ops {
 #define        UDP_V6_FLOW     0x06
 #define        SCTP_V6_FLOW    0x07
 #define        AH_ESP_V6_FLOW  0x08
+#define        AH_V4_FLOW      0x09
+#define        ESP_V4_FLOW     0x0a
+#define        AH_V6_FLOW      0x0b
+#define        ESP_V6_FLOW     0x0c
+#define        IP_USER_FLOW    0x0d
 
 /* L3-L4 network traffic flow hash options */
-#define        RXH_DEV_PORT    (1 << 0)
 #define        RXH_L2DA        (1 << 1)
 #define        RXH_VLAN        (1 << 2)
 #define        RXH_L3_PROTO    (1 << 3)
@@ -577,5 +653,6 @@ struct ethtool_ops {
 #define        RXH_L4_B_2_3    (1 << 7) /* dst port in case of TCP/UDP/SCTP */
 #define        RXH_DISCARD     (1 << 31)
 
+#define        RX_CLS_FLOW_DISC        0xffffffffffffffffULL
 
 #endif /* _LINUX_ETHTOOL_H */
index 818fe21257e8c62acdb8847be5af682c1cc186b7..31527e17076b7c8697dcf7fdeb9717d8dead779a 100644 (file)
@@ -960,6 +960,21 @@ extern struct fb_info *registered_fb[FB_MAX];
 extern int num_registered_fb;
 extern struct class *fb_class;
 
+static inline int lock_fb_info(struct fb_info *info)
+{
+       mutex_lock(&info->lock);
+       if (!info->fbops) {
+               mutex_unlock(&info->lock);
+               return 0;
+       }
+       return 1;
+}
+
+static inline void unlock_fb_info(struct fb_info *info)
+{
+       mutex_unlock(&info->lock);
+}
+
 static inline void __fb_pad_aligned_buffer(u8 *dst, u32 d_pitch,
                                           u8 *src, u32 s_pitch, u32 height)
 {
index 6e199c8dfacc4f3c40307076535d41da914afeb8..cca686b39123dca178f26512e5fcbf0db114a41b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * include/linux/firmware-map.h:
  *  Copyright (C) 2008 SUSE LINUX Products GmbH
- *  by Bernhard Walle <bwalle@suse.de>
+ *  by Bernhard Walle <bernhard.walle@gmx.de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License v2.0 as published by
index 6022f44043f2a01305bb09564c82d78bd08ad006..92734c0012e679cb3326ba25be08f52dce81fbc8 100644 (file)
@@ -54,24 +54,30 @@ struct inodes_stat_t {
 #define MAY_ACCESS 16
 #define MAY_OPEN 32
 
+/*
+ * flags in file.f_mode.  Note that FMODE_READ and FMODE_WRITE must correspond
+ * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
+ */
+
 /* file is open for reading */
 #define FMODE_READ             ((__force fmode_t)1)
 /* file is open for writing */
 #define FMODE_WRITE            ((__force fmode_t)2)
 /* file is seekable */
 #define FMODE_LSEEK            ((__force fmode_t)4)
-/* file can be accessed using pread/pwrite */
+/* file can be accessed using pread */
 #define FMODE_PREAD            ((__force fmode_t)8)
-#define FMODE_PWRITE           FMODE_PREAD     /* These go hand in hand */
+/* file can be accessed using pwrite */
+#define FMODE_PWRITE           ((__force fmode_t)16)
 /* File is opened for execution with sys_execve / sys_uselib */
-#define FMODE_EXEC             ((__force fmode_t)16)
+#define FMODE_EXEC             ((__force fmode_t)32)
 /* File is opened with O_NDELAY (only set for block devices) */
-#define FMODE_NDELAY           ((__force fmode_t)32)
+#define FMODE_NDELAY           ((__force fmode_t)64)
 /* File is opened with O_EXCL (only set for block devices) */
-#define FMODE_EXCL             ((__force fmode_t)64)
+#define FMODE_EXCL             ((__force fmode_t)128)
 /* File is opened using open(.., 3, ..) and is writeable only for ioctls
    (specialy hack for floppy.c) */
-#define FMODE_WRITE_IOCTL      ((__force fmode_t)128)
+#define FMODE_WRITE_IOCTL      ((__force fmode_t)256)
 
 /*
  * Don't update ctime and mtime.
@@ -87,10 +93,10 @@ struct inodes_stat_t {
 #define WRITE 1
 #define READA 2                /* read-ahead  - don't block if no resources */
 #define SWRITE 3       /* for ll_rw_block() - wait for buffer lock */
-#define READ_SYNC      (READ | (1 << BIO_RW_SYNC))
+#define READ_SYNC      (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
 #define READ_META      (READ | (1 << BIO_RW_META))
-#define WRITE_SYNC     (WRITE | (1 << BIO_RW_SYNC))
-#define SWRITE_SYNC    (SWRITE | (1 << BIO_RW_SYNC))
+#define WRITE_SYNC     (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
+#define SWRITE_SYNC    (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
 #define WRITE_BARRIER  (WRITE | (1 << BIO_RW_BARRIER))
 #define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
 #define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
index fd47a151665e363a5d9cdb63f33810ccd55f9a1d..6a6e701f1631622c950a0dc25174184036ce18b5 100644 (file)
@@ -38,6 +38,7 @@ struct hdlc_proto {
        int (*ioctl)(struct net_device *dev, struct ifreq *ifr);
        __be16 (*type_trans)(struct sk_buff *skb, struct net_device *dev);
        int (*netif_rx)(struct sk_buff *skb);
+       int (*xmit)(struct sk_buff *skb, struct net_device *dev);
        struct module *module;
        struct hdlc_proto *next; /* next protocol in the list */
 };
@@ -102,6 +103,10 @@ static __inline__ void debug_frame(const struct sk_buff *skb)
 int hdlc_open(struct net_device *dev);
 /* Must be called by hardware driver when HDLC device is being closed */
 void hdlc_close(struct net_device *dev);
+/* May be used by hardware driver */
+int hdlc_change_mtu(struct net_device *dev, int new_mtu);
+/* Must be pointed to by hw driver's dev->netdev_ops->ndo_start_xmit */
+int hdlc_start_xmit(struct sk_buff *skb, struct net_device *dev);
 
 int attach_hdlc_protocol(struct net_device *dev, struct hdlc_proto *proto,
                         size_t size);
index bf6302f6b5f88d44c2acdafa7f17022630d84cba..c010b4a785b8f7d5c7142232fdfd85fc412d69d4 100644 (file)
@@ -215,7 +215,7 @@ struct hdlcdrv_state {
 
        struct hdlcdrv_hdlctx {
                struct hdlcdrv_hdlcbuffer hbuf;
-               long in_hdlc_tx;
+               unsigned long in_hdlc_tx;
                /*
                 * 0 = send flags
                 * 1 = send txtail (flags)
@@ -241,7 +241,6 @@ struct hdlcdrv_state {
        struct hdlcdrv_bitbuffer bitbuf_hdlc;
 #endif /* HDLCDRV_DEBUG */
 
-       struct net_device_stats stats;
        int ptt_keyed;
 
        /* queued skb for transmission */
index f1d2fba19ea0a98ba97490a0b4184251365a3a6c..03be7f29ca0153e8c1da31650b14ce3d95f59d80 100644 (file)
@@ -33,7 +33,8 @@ unsigned long hugetlb_total_pages(void);
 int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma,
                        unsigned long address, int write_access);
 int hugetlb_reserve_pages(struct inode *inode, long from, long to,
-                                               struct vm_area_struct *vma);
+                                               struct vm_area_struct *vma,
+                                               int acctflags);
 void hugetlb_unreserve_pages(struct inode *inode, long offset, long freed);
 
 extern unsigned long hugepages_treat_as_movable;
@@ -138,7 +139,7 @@ static inline struct hugetlbfs_sb_info *HUGETLBFS_SB(struct super_block *sb)
 
 extern const struct file_operations hugetlbfs_file_operations;
 extern struct vm_operations_struct hugetlb_vm_ops;
-struct file *hugetlb_file_setup(const char *name, size_t);
+struct file *hugetlb_file_setup(const char *name, size_t, int);
 int hugetlb_get_quota(struct address_space *mapping, long delta);
 void hugetlb_put_quota(struct address_space *mapping, long delta);
 
@@ -158,9 +159,9 @@ static inline void set_file_hugepages(struct file *file)
 }
 #else /* !CONFIG_HUGETLBFS */
 
-#define is_file_hugepages(file)                0
-#define set_file_hugepages(file)       BUG()
-#define hugetlb_file_setup(name,size ERR_PTR(-ENOSYS)
+#define is_file_hugepages(file)                        0
+#define set_file_hugepages(file)               BUG()
+#define hugetlb_file_setup(name,size,acctflag) ERR_PTR(-ENOSYS)
 
 #endif /* !CONFIG_HUGETLBFS */
 
index 1c7a0dd5536aca7e8d2a1527ec60e48b0d26736c..06695b74d40585e5ef8428372c6327682745807b 100644 (file)
@@ -207,7 +207,7 @@ struct tok_info {
        unsigned short exsap_station_id;
        unsigned short global_int_enable;
        struct sk_buff *current_skb;
-       struct net_device_stats tr_stats;
+
        unsigned char auto_speedsave;
        open_state                      open_status, sap_status;
        enum {MANUAL, AUTOMATIC}        open_mode;
index c4e6ca1a630668755ce78903e55e6510b6991487..b1bb817d1427875a4ddc2923084fb9dfebc65b57 100644 (file)
@@ -527,6 +527,8 @@ struct ieee80211_tim_ie {
        u8 virtual_map[0];
 } __attribute__ ((packed));
 
+#define WLAN_SA_QUERY_TR_ID_LEN 16
+
 struct ieee80211_mgmt {
        __le16 frame_control;
        __le16 duration;
@@ -646,6 +648,10 @@ struct ieee80211_mgmt {
                                        u8 action_code;
                                        u8 variable[0];
                                } __attribute__((packed)) mesh_action;
+                               struct {
+                                       u8 action;
+                                       u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
+                               } __attribute__ ((packed)) sa_query;
                        } u;
                } __attribute__ ((packed)) action;
        } u;
@@ -655,6 +661,15 @@ struct ieee80211_mgmt {
 #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
 
 
+/* Management MIC information element (IEEE 802.11w) */
+struct ieee80211_mmie {
+       u8 element_id;
+       u8 length;
+       __le16 key_id;
+       u8 sequence_number[6];
+       u8 mic[8];
+} __attribute__ ((packed));
+
 /* Control frames */
 struct ieee80211_rts {
        __le16 frame_control;
@@ -899,6 +914,9 @@ enum ieee80211_statuscode {
        /* 802.11g */
        WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
        WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
+       /* 802.11w */
+       WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
+       WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
        /* 802.11i */
        WLAN_STATUS_INVALID_IE = 40,
        WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
@@ -1018,6 +1036,8 @@ enum ieee80211_eid {
        WLAN_EID_HT_INFORMATION = 61,
        /* 802.11i */
        WLAN_EID_RSN = 48,
+       WLAN_EID_TIMEOUT_INTERVAL = 56,
+       WLAN_EID_MMIE = 76 /* 802.11w */,
        WLAN_EID_WPA = 221,
        WLAN_EID_GENERIC = 221,
        WLAN_EID_VENDOR_SPECIFIC = 221,
@@ -1030,6 +1050,8 @@ enum ieee80211_category {
        WLAN_CATEGORY_QOS = 1,
        WLAN_CATEGORY_DLS = 2,
        WLAN_CATEGORY_BACK = 3,
+       WLAN_CATEGORY_PUBLIC = 4,
+       WLAN_CATEGORY_SA_QUERY = 8,
        WLAN_CATEGORY_WMM = 17,
 };
 
@@ -1104,6 +1126,12 @@ struct ieee80211_country_ie_triplet {
        };
 } __attribute__ ((packed));
 
+enum ieee80211_timeout_interval_type {
+       WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
+       WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */,
+       WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
+};
+
 /* BACK action code */
 enum ieee80211_back_actioncode {
        WLAN_ACTION_ADDBA_REQ = 0,
@@ -1118,6 +1146,13 @@ enum ieee80211_back_parties {
        WLAN_BACK_TIMER = 2,
 };
 
+/* SA Query action */
+enum ieee80211_sa_query_action {
+       WLAN_ACTION_SA_QUERY_REQUEST = 0,
+       WLAN_ACTION_SA_QUERY_RESPONSE = 1,
+};
+
+
 /* A-MSDU 802.11n */
 #define IEEE80211_QOS_CONTROL_A_MSDU_PRESENT 0x0080
 
@@ -1128,6 +1163,7 @@ enum ieee80211_back_parties {
 /* reserved:                           0x000FAC03 */
 #define WLAN_CIPHER_SUITE_CCMP         0x000FAC04
 #define WLAN_CIPHER_SUITE_WEP104       0x000FAC05
+#define WLAN_CIPHER_SUITE_AES_CMAC     0x000FAC06
 
 #define WLAN_MAX_KEY_LEN               32
 
@@ -1185,4 +1221,149 @@ static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
                return hdr->addr1;
 }
 
+/**
+ * ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
+ * @hdr: the frame (buffer must include at least the first octet of payload)
+ */
+static inline bool ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
+{
+       if (ieee80211_is_disassoc(hdr->frame_control) ||
+           ieee80211_is_deauth(hdr->frame_control))
+               return true;
+
+       if (ieee80211_is_action(hdr->frame_control)) {
+               u8 *category;
+
+               /*
+                * Action frames, excluding Public Action frames, are Robust
+                * Management Frames. However, if we are looking at a Protected
+                * frame, skip the check since the data may be encrypted and
+                * the frame has already been found to be a Robust Management
+                * Frame (by the other end).
+                */
+               if (ieee80211_has_protected(hdr->frame_control))
+                       return true;
+               category = ((u8 *) hdr) + 24;
+               return *category != WLAN_CATEGORY_PUBLIC;
+       }
+
+       return false;
+}
+
+/**
+ * ieee80211_fhss_chan_to_freq - get channel frequency
+ * @channel: the FHSS channel
+ *
+ * Convert IEEE802.11 FHSS channel to frequency (MHz)
+ * Ref IEEE 802.11-2007 section 14.6
+ */
+static inline int ieee80211_fhss_chan_to_freq(int channel)
+{
+       if ((channel > 1) && (channel < 96))
+               return channel + 2400;
+       else
+               return -1;
+}
+
+/**
+ * ieee80211_freq_to_fhss_chan - get channel
+ * @freq: the channels frequency
+ *
+ * Convert frequency (MHz) to IEEE802.11 FHSS channel
+ * Ref IEEE 802.11-2007 section 14.6
+ */
+static inline int ieee80211_freq_to_fhss_chan(int freq)
+{
+       if ((freq > 2401) && (freq < 2496))
+               return freq - 2400;
+       else
+               return -1;
+}
+
+/**
+ * ieee80211_dsss_chan_to_freq - get channel center frequency
+ * @channel: the DSSS channel
+ *
+ * Convert IEEE802.11 DSSS channel to the center frequency (MHz).
+ * Ref IEEE 802.11-2007 section 15.6
+ */
+static inline int ieee80211_dsss_chan_to_freq(int channel)
+{
+       if ((channel > 0) && (channel < 14))
+               return 2407 + (channel * 5);
+       else if (channel == 14)
+               return 2484;
+       else
+               return -1;
+}
+
+/**
+ * ieee80211_freq_to_dsss_chan - get channel
+ * @freq: the frequency
+ *
+ * Convert frequency (MHz) to IEEE802.11 DSSS channel
+ * Ref IEEE 802.11-2007 section 15.6
+ *
+ * This routine selects the channel with the closest center frequency.
+ */
+static inline int ieee80211_freq_to_dsss_chan(int freq)
+{
+       if ((freq >= 2410) && (freq < 2475))
+               return (freq - 2405) / 5;
+       else if ((freq >= 2482) && (freq < 2487))
+               return 14;
+       else
+               return -1;
+}
+
+/* Convert IEEE802.11 HR DSSS channel to frequency (MHz) and back
+ * Ref IEEE 802.11-2007 section 18.4.6.2
+ *
+ * The channels and frequencies are the same as those defined for DSSS
+ */
+#define ieee80211_hr_chan_to_freq(chan) ieee80211_dsss_chan_to_freq(chan)
+#define ieee80211_freq_to_hr_chan(freq) ieee80211_freq_to_dsss_chan(freq)
+
+/* Convert IEEE802.11 ERP channel to frequency (MHz) and back
+ * Ref IEEE 802.11-2007 section 19.4.2
+ */
+#define ieee80211_erp_chan_to_freq(chan) ieee80211_hr_chan_to_freq(chan)
+#define ieee80211_freq_to_erp_chan(freq) ieee80211_freq_to_hr_chan(freq)
+
+/**
+ * ieee80211_ofdm_chan_to_freq - get channel center frequency
+ * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
+ * @channel: the OFDM channel
+ *
+ * Convert IEEE802.11 OFDM channel to center frequency (MHz)
+ * Ref IEEE 802.11-2007 section 17.3.8.3.2
+ */
+static inline int ieee80211_ofdm_chan_to_freq(int s_freq, int channel)
+{
+       if ((channel > 0) && (channel <= 200) &&
+           (s_freq >= 4000))
+               return s_freq + (channel * 5);
+       else
+               return -1;
+}
+
+/**
+ * ieee80211_freq_to_ofdm_channel - get channel
+ * @s_freq: starting frequency == (dotChannelStartingFactor/2) MHz
+ * @freq: the frequency
+ *
+ * Convert frequency (MHz) to IEEE802.11 OFDM channel
+ * Ref IEEE 802.11-2007 section 17.3.8.3.2
+ *
+ * This routine selects the channel with the closest center frequency.
+ */
+static inline int ieee80211_freq_to_ofdm_chan(int s_freq, int freq)
+{
+       if ((freq > (s_freq + 2)) && (freq <= (s_freq + 1202)) &&
+           (s_freq >= 4000))
+               return (freq + 2 - s_freq) / 5;
+       else
+               return -1;
+}
+
 #endif /* LINUX_IEEE80211_H */
index 2a6e29620a963bcbfbd9195859fbab7c07f84266..1108f3e099e3bcb7a80b89c9ee2f43fa5dcefa88 100644 (file)
@@ -66,6 +66,7 @@
 #define IFF_SLAVE_NEEDARP 0x40         /* need ARPs for validation     */
 #define IFF_ISATAP     0x80            /* ISATAP interface (RFC4214)   */
 #define IFF_MASTER_ARPMON 0x100                /* bonding master, ARP mon in use */
+#define IFF_WAN_HDLC   0x200           /* WAN HDLC device              */
 
 #define IF_GET_IFACE   0x0001          /* for querying only */
 #define IF_GET_PROTO   0x0002
index 7f3c735f422bed8ff1cdeacc9450d61834f8dd19..0216e1bdbc568c6dfb943267e620b2189c090c1c 100644 (file)
@@ -17,7 +17,7 @@
  *             as published by the Free Software Foundation; either version
  *             2 of the License, or (at your option) any later version.
  */
+
 #ifndef _LINUX_IF_ETHER_H
 #define _LINUX_IF_ETHER_H
 
@@ -25,7 +25,7 @@
 
 /*
  *     IEEE 802.3 Ethernet magic constants.  The frame sizes omit the preamble
- *     and FCS/CRC (frame check sequence). 
+ *     and FCS/CRC (frame check sequence).
  */
 
 #define ETH_ALEN       6               /* Octets in one ethernet addr   */
@@ -83,7 +83,7 @@
 /*
  *     Non DIX types. Won't clash for 1500 types.
  */
+
 #define ETH_P_802_3    0x0001          /* Dummy type for 802.3 frames  */
 #define ETH_P_AX25     0x0002          /* Dummy protocol id for AX.25  */
 #define ETH_P_ALL      0x0003          /* Every packet (be careful!!!) */
 /*
  *     This is an Ethernet frame header.
  */
+
 struct ethhdr {
        unsigned char   h_dest[ETH_ALEN];       /* destination eth addr */
        unsigned char   h_source[ETH_ALEN];     /* source ether addr    */
index 30c88b2245ffa157263fe4d1311deb39d25261fb..90b5fae5d714ae71f0c51fddb5e9a621501092c9 100644 (file)
@@ -95,16 +95,16 @@ struct pppoe_tag {
 } __attribute ((packed));
 
 /* Tag identifiers */
-#define PTT_EOL                __constant_htons(0x0000)
-#define PTT_SRV_NAME   __constant_htons(0x0101)
-#define PTT_AC_NAME    __constant_htons(0x0102)
-#define PTT_HOST_UNIQ  __constant_htons(0x0103)
-#define PTT_AC_COOKIE  __constant_htons(0x0104)
-#define PTT_VENDOR     __constant_htons(0x0105)
-#define PTT_RELAY_SID  __constant_htons(0x0110)
-#define PTT_SRV_ERR     __constant_htons(0x0201)
-#define PTT_SYS_ERR    __constant_htons(0x0202)
-#define PTT_GEN_ERR    __constant_htons(0x0203)
+#define PTT_EOL                __cpu_to_be16(0x0000)
+#define PTT_SRV_NAME   __cpu_to_be16(0x0101)
+#define PTT_AC_NAME    __cpu_to_be16(0x0102)
+#define PTT_HOST_UNIQ  __cpu_to_be16(0x0103)
+#define PTT_AC_COOKIE  __cpu_to_be16(0x0104)
+#define PTT_VENDOR     __cpu_to_be16(0x0105)
+#define PTT_RELAY_SID  __cpu_to_be16(0x0110)
+#define PTT_SRV_ERR     __cpu_to_be16(0x0201)
+#define PTT_SYS_ERR    __cpu_to_be16(0x0202)
+#define PTT_GEN_ERR    __cpu_to_be16(0x0203)
 
 struct pppoe_hdr {
 #if defined(__LITTLE_ENDIAN_BITFIELD)
index 8529f57ba263a2ccabebdbacc3f668b47fd2d392..049d6c9428db60b78dbb49a595e774da001effb0 100644 (file)
@@ -46,6 +46,8 @@
 #define TUNSETOFFLOAD  _IOW('T', 208, unsigned int)
 #define TUNSETTXFILTER _IOW('T', 209, unsigned int)
 #define TUNGETIFF      _IOR('T', 210, unsigned int)
+#define TUNGETSNDBUF   _IOR('T', 211, int)
+#define TUNSETSNDBUF   _IOW('T', 212, int)
 
 /* TUNSETIFF ifr flags */
 #define IFF_TUN                0x0001
index 82c43624c067a132bec16e08abf07c6845c1b1df..5a9aae4adb444a3c8a63b5b9c5afd2c4456396de 100644 (file)
 #define SIOCDELPRL      (SIOCDEVPRIVATE + 6)
 #define SIOCCHGPRL      (SIOCDEVPRIVATE + 7)
 
-#define GRE_CSUM       __constant_htons(0x8000)
-#define GRE_ROUTING    __constant_htons(0x4000)
-#define GRE_KEY                __constant_htons(0x2000)
-#define GRE_SEQ                __constant_htons(0x1000)
-#define GRE_STRICT     __constant_htons(0x0800)
-#define GRE_REC                __constant_htons(0x0700)
-#define GRE_FLAGS      __constant_htons(0x00F8)
-#define GRE_VERSION    __constant_htons(0x0007)
+#define GRE_CSUM       __cpu_to_be16(0x8000)
+#define GRE_ROUTING    __cpu_to_be16(0x4000)
+#define GRE_KEY                __cpu_to_be16(0x2000)
+#define GRE_SEQ                __cpu_to_be16(0x1000)
+#define GRE_STRICT     __cpu_to_be16(0x0800)
+#define GRE_REC                __cpu_to_be16(0x0700)
+#define GRE_FLAGS      __cpu_to_be16(0x00F8)
+#define GRE_VERSION    __cpu_to_be16(0x0007)
 
 struct ip_tunnel_parm
 {
index 06fcdb45106bb1a39c5c7606345cd3c0d8487743..acef2a770b6bce589b2cf6e84680e892b235a351 100644 (file)
@@ -108,6 +108,7 @@ static inline void ipv4_devconf_setall(struct in_device *in_dev)
 #define IN_DEV_ARPFILTER(in_dev)       IN_DEV_ORCONF((in_dev), ARPFILTER)
 #define IN_DEV_ARP_ANNOUNCE(in_dev)    IN_DEV_MAXCONF((in_dev), ARP_ANNOUNCE)
 #define IN_DEV_ARP_IGNORE(in_dev)      IN_DEV_MAXCONF((in_dev), ARP_IGNORE)
+#define IN_DEV_ARP_NOTIFY(in_dev)      IN_DEV_MAXCONF((in_dev), ARP_NOTIFY)
 
 struct in_ifaddr
 {
index ea0ea1a4c36fa0c36f2a0db8be447a2d8b6ce817..e752d973fa21b3e245d5fed25f782f45197493fa 100644 (file)
@@ -48,12 +48,11 @@ extern struct fs_struct init_fs;
        .posix_timers    = LIST_HEAD_INIT(sig.posix_timers),            \
        .cpu_timers     = INIT_CPU_TIMERS(sig.cpu_timers),              \
        .rlim           = INIT_RLIMITS,                                 \
-       .cputime        = { .totals = {                                 \
-               .utime = cputime_zero,                                  \
-               .stime = cputime_zero,                                  \
-               .sum_exec_runtime = 0,                                  \
-               .lock = __SPIN_LOCK_UNLOCKED(sig.cputime.totals.lock),  \
-       }, },                                                           \
+       .cputimer       = {                                             \
+               .cputime = INIT_CPUTIME,                                \
+               .running = 0,                                           \
+               .lock = __SPIN_LOCK_UNLOCKED(sig.cputimer.lock),        \
+       },                                                              \
 }
 
 extern struct nsproxy init_nsproxy;
index b28b37eb11c626da84e8152f4878b8c593125ec3..4d248b3f1323d828170a9de92d2aba1db7c5f0f4 100644 (file)
@@ -1150,7 +1150,8 @@ extern int           jbd2_journal_clear_err  (journal_t *);
 extern int        jbd2_journal_bmap(journal_t *, unsigned long, unsigned long long *);
 extern int        jbd2_journal_force_commit(journal_t *);
 extern int        jbd2_journal_file_inode(handle_t *handle, struct jbd2_inode *inode);
-extern int        jbd2_journal_begin_ordered_truncate(struct jbd2_inode *inode, loff_t new_size);
+extern int        jbd2_journal_begin_ordered_truncate(journal_t *journal,
+                               struct jbd2_inode *inode, loff_t new_size);
 extern void       jbd2_journal_init_jbd_inode(struct jbd2_inode *jinode, struct inode *inode);
 extern void       jbd2_journal_release_jbd_inode(journal_t *journal, struct jbd2_inode *jinode);
 
index 343df9ef2412393020e90c1ef5227135b3b5a07f..7fa371898e3e76d8e1af870f049844ff71bea931 100644 (file)
@@ -480,7 +480,8 @@ static inline char *pack_hex_byte(char *buf, u8 byte)
 /*
  * swap - swap value of @a and @b
  */
-#define swap(a, b) ({ typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; })
+#define swap(a, b) \
+       do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while (0)
 
 /**
  * container_of - cast a member of a structure out to the containing structure
index 5715f190760161fbbdfbdd3231f6e87c9a905b72..0424326f167963d5b764554ebec95029b8b99439 100644 (file)
@@ -58,10 +58,10 @@ struct kvm_irqchip {
        __u32 pad;
         union {
                char dummy[512];  /* reserving space */
-#ifdef CONFIG_X86
+#ifdef __KVM_HAVE_PIT
                struct kvm_pic_state pic;
 #endif
-#if defined(CONFIG_X86) || defined(CONFIG_IA64)
+#ifdef __KVM_HAVE_IOAPIC
                struct kvm_ioapic_state ioapic;
 #endif
        } chip;
@@ -384,16 +384,16 @@ struct kvm_trace_rec {
 #define KVM_CAP_MP_STATE 14
 #define KVM_CAP_COALESCED_MMIO 15
 #define KVM_CAP_SYNC_MMU 16  /* Changes to host mmap are reflected in guest */
-#if defined(CONFIG_X86)||defined(CONFIG_IA64)
+#ifdef __KVM_HAVE_DEVICE_ASSIGNMENT
 #define KVM_CAP_DEVICE_ASSIGNMENT 17
 #endif
 #define KVM_CAP_IOMMU 18
-#if defined(CONFIG_X86)
+#ifdef __KVM_HAVE_MSI
 #define KVM_CAP_DEVICE_MSI 20
 #endif
 /* Bug in KVM_SET_USER_MEMORY_REGION fixed: */
 #define KVM_CAP_DESTROY_MEMORY_REGION_WORKS 21
-#if defined(CONFIG_X86)
+#ifdef __KVM_HAVE_USER_NMI
 #define KVM_CAP_USER_NMI 22
 #endif
 
index ec49d0be7f5245614c00e566a5f3702bccd6fa5e..bf6f703642fc81c21b33608cb48aff5477a0605b 100644 (file)
@@ -285,6 +285,7 @@ void kvm_free_physmem(struct kvm *kvm);
 struct  kvm *kvm_arch_create_vm(void);
 void kvm_arch_destroy_vm(struct kvm *kvm);
 void kvm_free_all_assigned_devices(struct kvm *kvm);
+void kvm_arch_sync_events(struct kvm *kvm);
 
 int kvm_cpu_get_interrupt(struct kvm_vcpu *v);
 int kvm_cpu_has_interrupt(struct kvm_vcpu *v);
index bca3ba25f52ac3cba6c983eb66c0e78ce3074fd9..5d87bc09a1f5bcef65f97a4c06599c8e9f7295b1 100644 (file)
@@ -380,6 +380,7 @@ enum {
        ATA_HORKAGE_ATAPI_MOD16_DMA = (1 << 11), /* use ATAPI DMA for commands
                                                    not multiple of 16 bytes */
        ATA_HORKAGE_FIRMWARE_WARN = (1 << 12),  /* firwmare update warning */
+       ATA_HORKAGE_1_5_GBPS    = (1 << 13),    /* force 1.5 Gbps */
 
         /* DMA mask for user DMA control: User visible values; DO NOT
            renumber */
@@ -580,7 +581,7 @@ struct ata_device {
        acpi_handle             acpi_handle;
        union acpi_object       *gtf_cache;
 #endif
-       /* n_sector is used as CLEAR_OFFSET, read comment above CLEAR_OFFSET */
+       /* n_sector is CLEAR_BEGIN, read comment above CLEAR_BEGIN */
        u64                     n_sectors;      /* size of device, if ATA */
        unsigned int            class;          /* ATA_DEV_xxx */
        unsigned long           unpark_deadline;
@@ -605,20 +606,22 @@ struct ata_device {
        u16                     heads;          /* Number of heads */
        u16                     sectors;        /* Number of sectors per track */
 
-       /* error history */
-       int                     spdn_cnt;
-       struct ata_ering        ering;
-
        union {
                u16             id[ATA_ID_WORDS]; /* IDENTIFY xxx DEVICE data */
                u32             gscr[SATA_PMP_GSCR_DWORDS]; /* PMP GSCR block */
        };
+
+       /* error history */
+       int                     spdn_cnt;
+       /* ering is CLEAR_END, read comment above CLEAR_END */
+       struct ata_ering        ering;
 };
 
-/* Offset into struct ata_device.  Fields above it are maintained
- * acress device init.  Fields below are zeroed.
+/* Fields between ATA_DEVICE_CLEAR_BEGIN and ATA_DEVICE_CLEAR_END are
+ * cleared to zero on ata_dev_init().
  */
-#define ATA_DEVICE_CLEAR_OFFSET                offsetof(struct ata_device, n_sectors)
+#define ATA_DEVICE_CLEAR_BEGIN         offsetof(struct ata_device, n_sectors)
+#define ATA_DEVICE_CLEAR_END           offsetof(struct ata_device, ering)
 
 struct ata_eh_info {
        struct ata_device       *dev;           /* offending device */
index e8ddc98b8405fdf7c9d32680731e0d5738bb97e1..065cdf8c09fb50fcce6ff67bcae848ac555c6b7a 100644 (file)
@@ -1041,10 +1041,23 @@ extern void free_bootmem_with_active_regions(int nid,
 typedef int (*work_fn_t)(unsigned long, unsigned long, void *);
 extern void work_with_active_regions(int nid, work_fn_t work_fn, void *data);
 extern void sparse_memory_present_with_active_regions(int nid);
-#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
-extern int early_pfn_to_nid(unsigned long pfn);
-#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
 #endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
+
+#if !defined(CONFIG_ARCH_POPULATES_NODE_MAP) && \
+    !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID)
+static inline int __early_pfn_to_nid(unsigned long pfn)
+{
+       return 0;
+}
+#else
+/* please see mm/page_alloc.c */
+extern int __meminit early_pfn_to_nid(unsigned long pfn);
+#ifdef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
+/* there is a per-arch backend function. */
+extern int __meminit __early_pfn_to_nid(unsigned long pfn);
+#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
+#endif
+
 extern void set_dma_reserve(unsigned long new_dma_reserve);
 extern void memmap_init_zone(unsigned long, int, unsigned long,
                                unsigned long, enum memmap_context);
@@ -1129,8 +1142,7 @@ extern unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
        unsigned long flag, unsigned long pgoff);
 extern unsigned long mmap_region(struct file *file, unsigned long addr,
        unsigned long len, unsigned long flags,
-       unsigned int vm_flags, unsigned long pgoff,
-       int accountable);
+       unsigned int vm_flags, unsigned long pgoff);
 
 static inline unsigned long do_mmap(struct file *file, unsigned long addr,
        unsigned long len, unsigned long prot,
@@ -1160,6 +1172,7 @@ extern int filemap_fault(struct vm_area_struct *, struct vm_fault *);
 
 /* mm/page-writeback.c */
 int write_one_page(struct page *page, int wait);
+void task_dirty_inc(struct task_struct *tsk);
 
 /* readahead.c */
 #define VM_MAX_READAHEAD       128     /* kbytes */
@@ -1305,5 +1318,6 @@ void vmemmap_populate_print_last(void);
 
 extern void *alloc_locked_buffer(size_t size);
 extern void free_locked_buffer(void *buffer, size_t size);
+extern void release_locked_buffer(void *buffer, size_t size);
 #endif /* __KERNEL__ */
 #endif /* _LINUX_MM_H */
index 09c14e213b63eb72f2f614695a886e67da7444d8..1aca6cebbb78916aaeb4764b3ec7e7da3276cf91 100644 (file)
@@ -1071,7 +1071,7 @@ void sparse_init(void);
 #endif /* CONFIG_SPARSEMEM */
 
 #ifdef CONFIG_NODES_SPAN_OTHER_NODES
-#define early_pfn_in_nid(pfn, nid)     (early_pfn_to_nid(pfn) == (nid))
+bool early_pfn_in_nid(unsigned long pfn, int nid);
 #else
 #define early_pfn_in_nid(pfn, nid)     (1)
 #endif
index f3b8329eb5b877d7233ab66d566dd280fc78536c..145a75528cc1868c275bbbcfacb97ab0124eab46 100644 (file)
@@ -407,7 +407,6 @@ static inline local_t *__module_ref_addr(struct module *mod, int cpu)
 static inline void __module_get(struct module *module)
 {
        if (module) {
-               BUG_ON(module_refcount(module) == 0);
                local_inc(__module_ref_addr(module, get_cpu()));
                put_cpu();
        }
index 8a455694d6826c84b3f606c7ea9c81a888094354..0d45b4e8d367e0ec6219f2a98a2b642d9f7e85f4 100644 (file)
@@ -193,6 +193,9 @@ struct vif_device
 struct mfc_cache 
 {
        struct mfc_cache *next;                 /* Next entry on cache line     */
+#ifdef CONFIG_NET_NS
+       struct net *mfc_net;
+#endif
        __be32 mfc_mcastgrp;                    /* Group the entry belongs to   */
        __be32 mfc_origin;                      /* Source of packet             */
        vifi_t mfc_parent;                      /* Source interface             */
@@ -215,6 +218,18 @@ struct mfc_cache
        } mfc_un;
 };
 
+static inline
+struct net *mfc_net(const struct mfc_cache *mfc)
+{
+       return read_pnet(&mfc->mfc_net);
+}
+
+static inline
+void mfc_net_set(struct mfc_cache *mfc, struct net *net)
+{
+       write_pnet(&mfc->mfc_net, hold_net(net));
+}
+
 #define MFC_STATIC             1
 #define MFC_NOTIFY             2
 
@@ -241,7 +256,8 @@ struct mfc_cache
 
 #ifdef __KERNEL__
 struct rtmsg;
-extern int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait);
+extern int ipmr_get_route(struct net *net, struct sk_buff *skb,
+                         struct rtmsg *rtm, int nowait);
 #endif
 
 #endif
index f56a696a7cc62a48b9a477740ca4df296b83e87d..cddaa48fb182eef600260103aa00762b311edb9e 100644 (file)
@@ -2,18 +2,18 @@
 #define _NCP_NO
 
 /* these define the attribute byte as seen by NCP */
-#define aRONLY                 (__constant_cpu_to_le32(1))
-#define aHIDDEN                        (__constant_cpu_to_le32(2))
-#define aSYSTEM                        (__constant_cpu_to_le32(4))
-#define aEXECUTE               (__constant_cpu_to_le32(8))
-#define aDIR                   (__constant_cpu_to_le32(0x10))
-#define aARCH                  (__constant_cpu_to_le32(0x20))
-#define aSHARED                        (__constant_cpu_to_le32(0x80))
-#define aDONTSUBALLOCATE       (__constant_cpu_to_le32(1L<<11))
-#define aTRANSACTIONAL         (__constant_cpu_to_le32(1L<<12))
-#define aPURGE                 (__constant_cpu_to_le32(1L<<16))
-#define aRENAMEINHIBIT         (__constant_cpu_to_le32(1L<<17))
-#define aDELETEINHIBIT         (__constant_cpu_to_le32(1L<<18))
-#define aDONTCOMPRESS          (__constant_cpu_to_le32(1L<<27))
+#define aRONLY                 (__cpu_to_le32(1))
+#define aHIDDEN                        (__cpu_to_le32(2))
+#define aSYSTEM                        (__cpu_to_le32(4))
+#define aEXECUTE               (__cpu_to_le32(8))
+#define aDIR                   (__cpu_to_le32(0x10))
+#define aARCH                  (__cpu_to_le32(0x20))
+#define aSHARED                        (__cpu_to_le32(0x80))
+#define aDONTSUBALLOCATE       (__cpu_to_le32(1L<<11))
+#define aTRANSACTIONAL         (__cpu_to_le32(1L<<12))
+#define aPURGE                 (__cpu_to_le32(1L<<16))
+#define aRENAMEINHIBIT         (__cpu_to_le32(1L<<17))
+#define aDELETEINHIBIT         (__cpu_to_le32(1L<<18))
+#define aDONTCOMPRESS          (__cpu_to_le32(1L<<27))
 
 #endif /* _NCP_NO */
diff --git a/include/linux/net_tstamp.h b/include/linux/net_tstamp.h
new file mode 100644 (file)
index 0000000..a3b8546
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Userspace API for hardware time stamping of network packets
+ *
+ * Copyright (C) 2008,2009 Intel Corporation
+ * Author: Patrick Ohly <patrick.ohly@intel.com>
+ *
+ */
+
+#ifndef _NET_TIMESTAMPING_H
+#define _NET_TIMESTAMPING_H
+
+#include <linux/socket.h>   /* for SO_TIMESTAMPING */
+
+/* SO_TIMESTAMPING gets an integer bit field comprised of these values */
+enum {
+       SOF_TIMESTAMPING_TX_HARDWARE = (1<<0),
+       SOF_TIMESTAMPING_TX_SOFTWARE = (1<<1),
+       SOF_TIMESTAMPING_RX_HARDWARE = (1<<2),
+       SOF_TIMESTAMPING_RX_SOFTWARE = (1<<3),
+       SOF_TIMESTAMPING_SOFTWARE = (1<<4),
+       SOF_TIMESTAMPING_SYS_HARDWARE = (1<<5),
+       SOF_TIMESTAMPING_RAW_HARDWARE = (1<<6),
+       SOF_TIMESTAMPING_MASK =
+       (SOF_TIMESTAMPING_RAW_HARDWARE - 1) |
+       SOF_TIMESTAMPING_RAW_HARDWARE
+};
+
+/**
+ * struct hwtstamp_config - %SIOCSHWTSTAMP parameter
+ *
+ * @flags:     no flags defined right now, must be zero
+ * @tx_type:   one of HWTSTAMP_TX_*
+ * @rx_type:   one of one of HWTSTAMP_FILTER_*
+ *
+ * %SIOCSHWTSTAMP expects a &struct ifreq with a ifr_data pointer to
+ * this structure. dev_ifsioc() in the kernel takes care of the
+ * translation between 32 bit userspace and 64 bit kernel. The
+ * structure is intentionally chosen so that it has the same layout on
+ * 32 and 64 bit systems, don't break this!
+ */
+struct hwtstamp_config {
+       int flags;
+       int tx_type;
+       int rx_filter;
+};
+
+/* possible values for hwtstamp_config->tx_type */
+enum {
+       /*
+        * No outgoing packet will need hardware time stamping;
+        * should a packet arrive which asks for it, no hardware
+        * time stamping will be done.
+        */
+       HWTSTAMP_TX_OFF,
+
+       /*
+        * Enables hardware time stamping for outgoing packets;
+        * the sender of the packet decides which are to be
+        * time stamped by setting %SOF_TIMESTAMPING_TX_SOFTWARE
+        * before sending the packet.
+        */
+       HWTSTAMP_TX_ON,
+};
+
+/* possible values for hwtstamp_config->rx_filter */
+enum {
+       /* time stamp no incoming packet at all */
+       HWTSTAMP_FILTER_NONE,
+
+       /* time stamp any incoming packet */
+       HWTSTAMP_FILTER_ALL,
+
+       /* return value: time stamp all packets requested plus some others */
+       HWTSTAMP_FILTER_SOME,
+
+       /* PTP v1, UDP, any kind of event packet */
+       HWTSTAMP_FILTER_PTP_V1_L4_EVENT,
+       /* PTP v1, UDP, Sync packet */
+       HWTSTAMP_FILTER_PTP_V1_L4_SYNC,
+       /* PTP v1, UDP, Delay_req packet */
+       HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ,
+       /* PTP v2, UDP, any kind of event packet */
+       HWTSTAMP_FILTER_PTP_V2_L4_EVENT,
+       /* PTP v2, UDP, Sync packet */
+       HWTSTAMP_FILTER_PTP_V2_L4_SYNC,
+       /* PTP v2, UDP, Delay_req packet */
+       HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ,
+
+       /* 802.AS1, Ethernet, any kind of event packet */
+       HWTSTAMP_FILTER_PTP_V2_L2_EVENT,
+       /* 802.AS1, Ethernet, Sync packet */
+       HWTSTAMP_FILTER_PTP_V2_L2_SYNC,
+       /* 802.AS1, Ethernet, Delay_req packet */
+       HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ,
+
+       /* PTP v2/802.AS1, any layer, any kind of event packet */
+       HWTSTAMP_FILTER_PTP_V2_EVENT,
+       /* PTP v2/802.AS1, any layer, Sync packet */
+       HWTSTAMP_FILTER_PTP_V2_SYNC,
+       /* PTP v2/802.AS1, any layer, Delay_req packet */
+       HWTSTAMP_FILTER_PTP_V2_DELAY_REQ,
+};
+
+#endif /* _NET_TIMESTAMPING_H */
index ec54785d34f90904224afe17a2713a8f32ed05ba..bd8b4ca85a2ab339888d126b15143df3a182b3a4 100644 (file)
@@ -96,7 +96,7 @@ struct wireless_dev;
  *     Compute the worst case header length according to the protocols
  *     used.
  */
+
 #if defined(CONFIG_WLAN_80211) || defined(CONFIG_AX25) || defined(CONFIG_AX25_MODULE)
 # if defined(CONFIG_MAC80211_MESH)
 #  define LL_MAX_HEADER 128
@@ -124,7 +124,7 @@ struct wireless_dev;
  *     Network device statistics. Akin to the 2.0 ether stats but
  *     with byte counters.
  */
+
 struct net_device_stats
 {
        unsigned long   rx_packets;             /* total packets received       */
@@ -285,7 +285,7 @@ enum netdev_state_t
 
 /*
  * This structure holds at boot time configured netdevice settings. They
- * are then used in the device probing. 
+ * are then used in the device probing.
  */
 struct netdev_boot_setup {
        char name[IFNAMSIZ];
@@ -314,6 +314,9 @@ struct napi_struct {
        spinlock_t              poll_lock;
        int                     poll_owner;
 #endif
+
+       unsigned int            gro_count;
+
        struct net_device       *dev;
        struct list_head        dev_list;
        struct sk_buff          *gro_list;
@@ -740,7 +743,7 @@ struct net_device
        void                    *dsa_ptr;       /* dsa specific data */
 #endif
        void                    *atalk_ptr;     /* AppleTalk link       */
-       void                    *ip_ptr;        /* IPv4 specific data   */  
+       void                    *ip_ptr;        /* IPv4 specific data   */
        void                    *dn_ptr;        /* DECnet specific data */
        void                    *ip6_ptr;       /* IPv6 specific data */
        void                    *ec_ptr;        /* Econet specific data */
@@ -753,7 +756,7 @@ struct net_device
  */
        unsigned long           last_rx;        /* Time of last Rx      */
        /* Interface address info used in eth_type_trans() */
-       unsigned char           dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast 
+       unsigned char           dev_addr[MAX_ADDR_LEN]; /* hw address, (before bcast
                                                           because most packets are unicast) */
 
        unsigned char           broadcast[MAX_ADDR_LEN];        /* hw bcast add */
@@ -984,6 +987,9 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
 void netif_napi_del(struct napi_struct *napi);
 
 struct napi_gro_cb {
+       /* This indicates where we are processing relative to skb->data. */
+       int data_offset;
+
        /* This is non-zero if the packet may be of the same flow. */
        int same_flow;
 
@@ -1087,6 +1093,36 @@ extern int               dev_restart(struct net_device *dev);
 #ifdef CONFIG_NETPOLL_TRAP
 extern int             netpoll_trap(void);
 #endif
+extern void          *skb_gro_header(struct sk_buff *skb, unsigned int hlen);
+extern int            skb_gro_receive(struct sk_buff **head,
+                                      struct sk_buff *skb);
+
+static inline unsigned int skb_gro_offset(const struct sk_buff *skb)
+{
+       return NAPI_GRO_CB(skb)->data_offset;
+}
+
+static inline unsigned int skb_gro_len(const struct sk_buff *skb)
+{
+       return skb->len - NAPI_GRO_CB(skb)->data_offset;
+}
+
+static inline void skb_gro_pull(struct sk_buff *skb, unsigned int len)
+{
+       NAPI_GRO_CB(skb)->data_offset += len;
+}
+
+static inline void skb_gro_reset_offset(struct sk_buff *skb)
+{
+       NAPI_GRO_CB(skb)->data_offset = 0;
+}
+
+static inline void *skb_gro_mac_header(struct sk_buff *skb)
+{
+       return skb_mac_header(skb) < skb->data ? skb_mac_header(skb) :
+              page_address(skb_shinfo(skb)->frags[0].page) +
+              skb_shinfo(skb)->frags[0].page_offset;
+}
 
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
                                  unsigned short type,
@@ -1375,12 +1411,15 @@ extern int              netif_receive_skb(struct sk_buff *skb);
 extern void            napi_gro_flush(struct napi_struct *napi);
 extern int             dev_gro_receive(struct napi_struct *napi,
                                        struct sk_buff *skb);
+extern int             napi_skb_finish(int ret, struct sk_buff *skb);
 extern int             napi_gro_receive(struct napi_struct *napi,
                                         struct sk_buff *skb);
 extern void            napi_reuse_skb(struct napi_struct *napi,
                                       struct sk_buff *skb);
 extern struct sk_buff *        napi_fraginfo_skb(struct napi_struct *napi,
                                          struct napi_gro_fraginfo *info);
+extern int             napi_frags_finish(struct napi_struct *napi,
+                                         struct sk_buff *skb, int ret);
 extern int             napi_gro_frags(struct napi_struct *napi,
                                       struct napi_gro_fraginfo *info);
 extern void            netif_nit_deliver(struct sk_buff *skb);
@@ -1574,56 +1613,6 @@ static inline u32 netif_msg_init(int debug_value, int default_msg_enable_bits)
        return (1 << debug_value) - 1;
 }
 
-/* Test if receive needs to be scheduled but only if up */
-static inline int netif_rx_schedule_prep(struct napi_struct *napi)
-{
-       return napi_schedule_prep(napi);
-}
-
-/* Add interface to tail of rx poll list. This assumes that _prep has
- * already been called and returned 1.
- */
-static inline void __netif_rx_schedule(struct napi_struct *napi)
-{
-       __napi_schedule(napi);
-}
-
-/* Try to reschedule poll. Called by irq handler. */
-
-static inline void netif_rx_schedule(struct napi_struct *napi)
-{
-       if (netif_rx_schedule_prep(napi))
-               __netif_rx_schedule(napi);
-}
-
-/* Try to reschedule poll. Called by dev->poll() after netif_rx_complete().  */
-static inline int netif_rx_reschedule(struct napi_struct *napi)
-{
-       if (napi_schedule_prep(napi)) {
-               __netif_rx_schedule(napi);
-               return 1;
-       }
-       return 0;
-}
-
-/* same as netif_rx_complete, except that local_irq_save(flags)
- * has already been issued
- */
-static inline void __netif_rx_complete(struct napi_struct *napi)
-{
-       __napi_complete(napi);
-}
-
-/* Remove interface from poll list: it must be in the poll list
- * on current cpu. This primitive is called by dev->poll(), when
- * it completes the work. The device cannot be out of poll list at this
- * moment, it is BUG().
- */
-static inline void netif_rx_complete(struct napi_struct *napi)
-{
-       napi_complete(napi);
-}
-
 static inline void __netif_tx_lock(struct netdev_queue *txq, int cpu)
 {
        spin_lock(&txq->_xmit_lock);
@@ -1874,7 +1863,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
 
                if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
                        if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
-                           skb->protocol == __constant_htons(ETH_P_ARP))
+                           skb->protocol == __cpu_to_be16(ETH_P_ARP))
                                return 0;
 
                        if (master->priv_flags & IFF_MASTER_ALB) {
@@ -1883,7 +1872,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
                                        return 0;
                        }
                        if (master->priv_flags & IFF_MASTER_8023AD &&
-                           skb->protocol == __constant_htons(ETH_P_SLOW))
+                           skb->protocol == __cpu_to_be16(ETH_P_SLOW))
                                return 0;
 
                        return 1;
index 499aa937590128650c2846b0347fb344550bd342..f8105e54716a76bccdfbbcdcf9b7c34a974d2906 100644 (file)
@@ -59,9 +59,9 @@ static inline int nf_bridge_maybe_copy_header(struct sk_buff *skb)
 static inline unsigned int nf_bridge_encap_header_len(const struct sk_buff *skb)
 {
        switch (skb->protocol) {
-       case __constant_htons(ETH_P_8021Q):
+       case __cpu_to_be16(ETH_P_8021Q):
                return VLAN_HLEN;
-       case __constant_htons(ETH_P_PPP_SES):
+       case __cpu_to_be16(ETH_P_PPP_SES):
                return PPPOE_SES_HLEN;
        default:
                return 0;
index 51b09a1f46c3bde1da65df6d096cbaa4b409c541..1e6bf995435c1f9b1ca444d706c7ecfb5b126638 100644 (file)
@@ -103,6 +103,7 @@ struct nlmsgerr
 #define NETLINK_ADD_MEMBERSHIP 1
 #define NETLINK_DROP_MEMBERSHIP        2
 #define NETLINK_PKTINFO                3
+#define NETLINK_BROADCAST_ERROR        4
 
 struct nl_pktinfo
 {
index e86ed59f9ad59b25317ce2be2f084a73063704c5..8802d1bda382a1d674ce1ae29cf6f84fc1bb0cf3 100644 (file)
@@ -47,7 +47,7 @@
  * @NL80211_CMD_SET_WIPHY: set wiphy parameters, needs %NL80211_ATTR_WIPHY or
  *     %NL80211_ATTR_IFINDEX; can be used to set %NL80211_ATTR_WIPHY_NAME,
  *     %NL80211_ATTR_WIPHY_TXQ_PARAMS, %NL80211_ATTR_WIPHY_FREQ, and/or
- *     %NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET.
+ *     %NL80211_ATTR_WIPHY_CHANNEL_TYPE.
  * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
  *     or rename notification. Has attributes %NL80211_ATTR_WIPHY and
  *     %NL80211_ATTR_WIPHY_NAME.
@@ -72,8 +72,8 @@
  *
  * @NL80211_CMD_GET_KEY: Get sequence counter information for a key specified
  *     by %NL80211_ATTR_KEY_IDX and/or %NL80211_ATTR_MAC.
- * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT or
- *     %NL80211_ATTR_KEY_THRESHOLD.
+ * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT,
+ *     %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD.
  * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA,
  *     %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER
  *     attributes.
@@ -84,7 +84,7 @@
  *     %NL80222_CMD_NEW_BEACON message)
  * @NL80211_CMD_SET_BEACON: set the beacon on an access point interface
  *     using the %NL80211_ATTR_BEACON_INTERVAL, %NL80211_ATTR_DTIM_PERIOD,
- *     %NL80211_BEACON_HEAD and %NL80211_BEACON_TAIL attributes.
+ *     %NL80211_ATTR_BEACON_HEAD and %NL80211_ATTR_BEACON_TAIL attributes.
  * @NL80211_CMD_NEW_BEACON: add a new beacon to an access point interface,
  *     parameters are like for %NL80211_CMD_SET_BEACON.
  * @NL80211_CMD_DEL_BEACON: remove the beacon, stop sending it
  * @NL80211_CMD_SET_BSS: Set BSS attributes for BSS identified by
  *     %NL80211_ATTR_IFINDEX.
  *
+ * @NL80211_CMD_GET_REG: ask the wireless core to send us its currently set
+ *     regulatory domain.
  * @NL80211_CMD_SET_REG: Set current regulatory domain. CRDA sends this command
  *     after being queried by the kernel. CRDA replies by sending a regulatory
  *     domain structure which consists of %NL80211_ATTR_REG_ALPHA set to our
  * @NL80211_CMD_SET_MESH_PARAMS: Set mesh networking properties for the
  *      interface identified by %NL80211_ATTR_IFINDEX
  *
+ * @NL80211_CMD_SET_MGMT_EXTRA_IE: Set extra IEs for management frames. The
+ *     interface is identified with %NL80211_ATTR_IFINDEX and the management
+ *     frame subtype with %NL80211_ATTR_MGMT_SUBTYPE. The extra IE data to be
+ *     added to the end of the specified management frame is specified with
+ *     %NL80211_ATTR_IE. If the command succeeds, the requested data will be
+ *     added to all specified management frames generated by
+ *     kernel/firmware/driver.
+ *
+ * @NL80211_CMD_GET_SCAN: get scan results
+ * @NL80211_CMD_TRIGGER_SCAN: trigger a new scan with the given parameters
+ * @NL80211_CMD_NEW_SCAN_RESULTS: scan notification (as a reply to
+ *     NL80211_CMD_GET_SCAN and on the "scan" multicast group)
+ * @NL80211_CMD_SCAN_ABORTED: scan was aborted, for unspecified reasons,
+ *     partial scan results may be available
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -178,6 +195,15 @@ enum nl80211_commands {
        NL80211_CMD_GET_MESH_PARAMS,
        NL80211_CMD_SET_MESH_PARAMS,
 
+       NL80211_CMD_SET_MGMT_EXTRA_IE,
+
+       NL80211_CMD_GET_REG,
+
+       NL80211_CMD_GET_SCAN,
+       NL80211_CMD_TRIGGER_SCAN,
+       NL80211_CMD_NEW_SCAN_RESULTS,
+       NL80211_CMD_SCAN_ABORTED,
+
        /* add new commands above here */
 
        /* used to define NL80211_CMD_MAX below */
@@ -190,6 +216,7 @@ enum nl80211_commands {
  * here
  */
 #define NL80211_CMD_SET_BSS NL80211_CMD_SET_BSS
+#define NL80211_CMD_SET_MGMT_EXTRA_IE NL80211_CMD_SET_MGMT_EXTRA_IE
 
 /**
  * enum nl80211_attrs - nl80211 netlink attributes
@@ -284,6 +311,24 @@ enum nl80211_commands {
  *     supported interface types, each a flag attribute with the number
  *     of the interface mode.
  *
+ * @NL80211_ATTR_MGMT_SUBTYPE: Management frame subtype for
+ *     %NL80211_CMD_SET_MGMT_EXTRA_IE.
+ *
+ * @NL80211_ATTR_IE: Information element(s) data (used, e.g., with
+ *     %NL80211_CMD_SET_MGMT_EXTRA_IE).
+ *
+ * @NL80211_ATTR_MAX_NUM_SCAN_SSIDS: number of SSIDs you can scan with
+ *     a single scan request, a wiphy attribute.
+ *
+ * @NL80211_ATTR_SCAN_FREQUENCIES: nested attribute with frequencies (in MHz)
+ * @NL80211_ATTR_SCAN_SSIDS: nested attribute with SSIDs, leave out for passive
+ *     scanning and include a zero-length SSID (wildcard) for wildcard scan
+ * @NL80211_ATTR_SCAN_GENERATION: the scan generation increases whenever the
+ *     scan result list changes (BSS expired or added) so that applications
+ *     can verify that they got a single, consistent snapshot (when all dump
+ *     messages carried the same generation number)
+ * @NL80211_ATTR_BSS: scan result BSS
+ *
  * @NL80211_ATTR_MAX: highest attribute number currently defined
  * @__NL80211_ATTR_AFTER_LAST: internal use
  */
@@ -346,6 +391,18 @@ enum nl80211_attrs {
        NL80211_ATTR_WIPHY_FREQ,
        NL80211_ATTR_WIPHY_CHANNEL_TYPE,
 
+       NL80211_ATTR_KEY_DEFAULT_MGMT,
+
+       NL80211_ATTR_MGMT_SUBTYPE,
+       NL80211_ATTR_IE,
+
+       NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
+
+       NL80211_ATTR_SCAN_FREQUENCIES,
+       NL80211_ATTR_SCAN_SSIDS,
+       NL80211_ATTR_SCAN_GENERATION,
+       NL80211_ATTR_BSS,
+
        /* add attributes here, update the policy in nl80211.c */
 
        __NL80211_ATTR_AFTER_LAST,
@@ -360,7 +417,9 @@ enum nl80211_attrs {
 #define NL80211_ATTR_BSS_BASIC_RATES NL80211_ATTR_BSS_BASIC_RATES
 #define NL80211_ATTR_WIPHY_TXQ_PARAMS NL80211_ATTR_WIPHY_TXQ_PARAMS
 #define NL80211_ATTR_WIPHY_FREQ NL80211_ATTR_WIPHY_FREQ
-#define NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET NL80211_ATTR_WIPHY_SEC_CHAN_OFFSET
+#define NL80211_ATTR_WIPHY_CHANNEL_TYPE NL80211_ATTR_WIPHY_CHANNEL_TYPE
+#define NL80211_ATTR_MGMT_SUBTYPE NL80211_ATTR_MGMT_SUBTYPE
+#define NL80211_ATTR_IE NL80211_ATTR_IE
 
 #define NL80211_MAX_SUPP_RATES                 32
 #define NL80211_MAX_SUPP_REG_RULES             32
@@ -412,12 +471,14 @@ enum nl80211_iftype {
  * @NL80211_STA_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
  *     with short barker preamble
  * @NL80211_STA_FLAG_WME: station is WME/QoS capable
+ * @NL80211_STA_FLAG_MFP: station uses management frame protection
  */
 enum nl80211_sta_flags {
        __NL80211_STA_FLAG_INVALID,
        NL80211_STA_FLAG_AUTHORIZED,
        NL80211_STA_FLAG_SHORT_PREAMBLE,
        NL80211_STA_FLAG_WME,
+       NL80211_STA_FLAG_MFP,
 
        /* keep last */
        __NL80211_STA_FLAG_AFTER_LAST,
@@ -811,4 +872,38 @@ enum nl80211_channel_type {
        NL80211_CHAN_HT40MINUS,
        NL80211_CHAN_HT40PLUS
 };
+
+/**
+ * enum nl80211_bss - netlink attributes for a BSS
+ *
+ * @__NL80211_BSS_INVALID: invalid
+ * @NL80211_BSS_FREQUENCY: frequency in MHz (u32)
+ * @NL80211_BSS_TSF: TSF of the received probe response/beacon (u64)
+ * @NL80211_BSS_BEACON_INTERVAL: beacon interval of the (I)BSS (u16)
+ * @NL80211_BSS_CAPABILITY: capability field (CPU order, u16)
+ * @NL80211_BSS_INFORMATION_ELEMENTS: binary attribute containing the
+ *     raw information elements from the probe response/beacon (bin)
+ * @NL80211_BSS_SIGNAL_MBM: signal strength of probe response/beacon
+ *     in mBm (100 * dBm) (s32)
+ * @NL80211_BSS_SIGNAL_UNSPEC: signal strength of the probe response/beacon
+ *     in unspecified units, scaled to 0..100 (u8)
+ * @__NL80211_BSS_AFTER_LAST: internal
+ * @NL80211_BSS_MAX: highest BSS attribute
+ */
+enum nl80211_bss {
+       __NL80211_BSS_INVALID,
+       NL80211_BSS_BSSID,
+       NL80211_BSS_FREQUENCY,
+       NL80211_BSS_TSF,
+       NL80211_BSS_BEACON_INTERVAL,
+       NL80211_BSS_CAPABILITY,
+       NL80211_BSS_INFORMATION_ELEMENTS,
+       NL80211_BSS_SIGNAL_MBM,
+       NL80211_BSS_SIGNAL_UNSPEC,
+
+       /* keep last */
+       __NL80211_BSS_AFTER_LAST,
+       NL80211_BSS_MAX = __NL80211_BSS_AFTER_LAST - 1
+};
+
 #endif /* __LINUX_NL80211_H */
index 48890cf3f96e562937ded2fc8134f156e9fba60d..7bd624bfdcfd37945e3c59bf2a74f0d2f1dabb21 100644 (file)
@@ -684,7 +684,7 @@ int pci_enable_rom(struct pci_dev *pdev);
 void pci_disable_rom(struct pci_dev *pdev);
 void __iomem __must_check *pci_map_rom(struct pci_dev *pdev, size_t *size);
 void pci_unmap_rom(struct pci_dev *pdev, void __iomem *rom);
-size_t pci_get_rom_size(void __iomem *rom, size_t size);
+size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size);
 
 /* Power management related routines */
 int pci_save_state(struct pci_dev *dev);
index 52a9fe08451cfa105c733099350355a8b89dc028..3f9687a71e322b9aa36a83792aca128788d7cc68 100644 (file)
 #define PCI_DEVICE_ID_PROMISE_20276    0x5275
 #define PCI_DEVICE_ID_PROMISE_20277    0x7275
 
+#define PCI_VENDOR_ID_FOXCONN          0x105b
+
 #define PCI_VENDOR_ID_UMC              0x1060
 #define PCI_DEVICE_ID_UMC_UM8673F      0x0101
 #define PCI_DEVICE_ID_UMC_UM8886BF     0x673a
 #define PCI_DEVICE_ID_VIA_VT3351       0x0351
 #define PCI_DEVICE_ID_VIA_VT3364       0x0364
 #define PCI_DEVICE_ID_VIA_8371_0       0x0391
+#define PCI_DEVICE_ID_VIA_6415         0x0415
 #define PCI_DEVICE_ID_VIA_8501_0       0x0501
 #define PCI_DEVICE_ID_VIA_82C561       0x0561
 #define PCI_DEVICE_ID_VIA_82C586_1     0x0571
 #define PCI_DEVICE_ID_DIGI_DF_M_E      0x0071
 #define PCI_DEVICE_ID_DIGI_DF_M_IOM2_A 0x0072
 #define PCI_DEVICE_ID_DIGI_DF_M_A      0x0073
+#define PCI_DEVICE_ID_DIGI_NEO_8       0x00B1
 #define PCI_DEVICE_ID_NEO_2DB9          0x00C8
 #define PCI_DEVICE_ID_NEO_2DB9PRI       0x00C9
 #define PCI_DEVICE_ID_NEO_2RJ45         0x00CA
 
 #define PCI_VENDOR_ID_SAMSUNG          0x144d
 
+#define PCI_VENDOR_ID_AMBIT            0x1468
+
 #define PCI_VENDOR_ID_MYRICOM          0x14c1
 
 #define PCI_VENDOR_ID_TITAN            0x14D2
 
 #define PCI_VENDOR_ID_TOPSPIN          0x1867
 
+#define PCI_VENDOR_ID_SILAN            0x1904
+
 #define PCI_VENDOR_ID_TDI               0x192E
 #define PCI_DEVICE_ID_TDI_EHCI          0x0101
 
 #define PCI_DEVICE_ID_INTEL_82378      0x0484
 #define PCI_DEVICE_ID_INTEL_I960       0x0960
 #define PCI_DEVICE_ID_INTEL_I960RM     0x0962
+#define PCI_DEVICE_ID_INTEL_8257X_SOL  0x1062
+#define PCI_DEVICE_ID_INTEL_82573E_SOL 0x1085
+#define PCI_DEVICE_ID_INTEL_82573L_SOL 0x108F
 #define PCI_DEVICE_ID_INTEL_82815_MC   0x1130
 #define PCI_DEVICE_ID_INTEL_82815_CGC  0x1132
 #define PCI_DEVICE_ID_INTEL_82092AA_0  0x1221
index 1ba0661561a44d3dc7aaa6d951d28d8566fdcaa3..252bf6644c518d03f8eeaf8586e187275d6bcea8 100644 (file)
@@ -4,14 +4,14 @@
 #include <asm/byteorder.h>
 
 /* Message types - V1 */
-#define PIM_V1_VERSION         __constant_htonl(0x10000000)
+#define PIM_V1_VERSION         cpu_to_be32(0x10000000)
 #define PIM_V1_REGISTER                1
 
 /* Message types - V2 */
 #define PIM_VERSION            2
 #define PIM_REGISTER           1
 
-#define PIM_NULL_REGISTER      __constant_htonl(0x40000000)
+#define PIM_NULL_REGISTER      cpu_to_be32(0x40000000)
 
 /* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */
 struct pimreghdr
index de2e0a8f6728c668a2005ee3b36147a3b3caeec6..24ba5f67b3a3a590480b6ad32b62326be2156c9f 100644 (file)
@@ -381,10 +381,12 @@ struct dev_pm_info {
 
 #ifdef CONFIG_PM_SLEEP
 extern void device_pm_lock(void);
+extern int sysdev_resume(void);
 extern void device_power_up(pm_message_t state);
 extern void device_resume(pm_message_t state);
 
 extern void device_pm_unlock(void);
+extern int sysdev_suspend(pm_message_t state);
 extern int device_power_down(pm_message_t state);
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
index a942892d6dfe714ca552544a02dd830781fe7eab..9d64bdf147703560d3065cac35b0853b95e7f75b 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/list.h>
 #include <linux/skbuff.h>
 #include <linux/poll.h>
+#include <net/net_namespace.h>
 
 struct ppp_channel;
 
@@ -56,6 +57,9 @@ extern void ppp_input(struct ppp_channel *, struct sk_buff *);
    that we may have missed a packet. */
 extern void ppp_input_error(struct ppp_channel *, int code);
 
+/* Attach a channel to a given PPP unit in specified net. */
+extern int ppp_register_net_channel(struct net *, struct ppp_channel *);
+
 /* Attach a channel to a given PPP unit. */
 extern int ppp_register_channel(struct ppp_channel *);
 
index 5a7c76388731d0bb8bd5c1143cfdbd157e84d902..8981e52c714f05f19ad5727031058509e06bf6a8 100644 (file)
@@ -453,23 +453,33 @@ struct task_cputime {
        cputime_t utime;
        cputime_t stime;
        unsigned long long sum_exec_runtime;
-       spinlock_t lock;
 };
 /* Alternate field names when used to cache expirations. */
 #define prof_exp       stime
 #define virt_exp       utime
 #define sched_exp      sum_exec_runtime
 
+#define INIT_CPUTIME   \
+       (struct task_cputime) {                                 \
+               .utime = cputime_zero,                          \
+               .stime = cputime_zero,                          \
+               .sum_exec_runtime = 0,                          \
+       }
+
 /**
- * struct thread_group_cputime - thread group interval timer counts
- * @totals:            thread group interval timers; substructure for
- *                     uniprocessor kernel, per-cpu for SMP kernel.
+ * struct thread_group_cputimer - thread group interval timer counts
+ * @cputime:           thread group interval timers.
+ * @running:           non-zero when there are timers running and
+ *                     @cputime receives updates.
+ * @lock:              lock for fields in this struct.
  *
  * This structure contains the version of task_cputime, above, that is
- * used for thread group CPU clock calculations.
+ * used for thread group CPU timer calculations.
  */
-struct thread_group_cputime {
-       struct task_cputime totals;
+struct thread_group_cputimer {
+       struct task_cputime cputime;
+       int running;
+       spinlock_t lock;
 };
 
 /*
@@ -518,10 +528,10 @@ struct signal_struct {
        cputime_t it_prof_incr, it_virt_incr;
 
        /*
-        * Thread group totals for process CPU clocks.
-        * See thread_group_cputime(), et al, for details.
+        * Thread group totals for process CPU timers.
+        * See thread_group_cputimer(), et al, for details.
         */
-       struct thread_group_cputime cputime;
+       struct thread_group_cputimer cputimer;
 
        /* Earliest-expiration cache. */
        struct task_cputime cputime_expires;
@@ -558,7 +568,7 @@ struct signal_struct {
         * Live threads maintain their own counters and add to these
         * in __exit_signal, except for the group leader.
         */
-       cputime_t cutime, cstime;
+       cputime_t utime, stime, cutime, cstime;
        cputime_t gtime;
        cputime_t cgtime;
        unsigned long nvcsw, nivcsw, cnvcsw, cnivcsw;
@@ -566,6 +576,14 @@ struct signal_struct {
        unsigned long inblock, oublock, cinblock, coublock;
        struct task_io_accounting ioac;
 
+       /*
+        * Cumulative ns of schedule CPU time fo dead threads in the
+        * group, not including a zombie group leader, (This only differs
+        * from jiffies_to_ns(utime + stime) if sched_clock uses something
+        * other than jiffies.)
+        */
+       unsigned long long sum_sched_runtime;
+
        /*
         * We don't bother to synchronize most readers of this at all,
         * because there is no reader checking a limit that actually needs
@@ -2182,27 +2200,14 @@ static inline int spin_needbreak(spinlock_t *lock)
 /*
  * Thread group CPU time accounting.
  */
-
-static inline
-void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
-{
-       struct task_cputime *totals = &tsk->signal->cputime.totals;
-       unsigned long flags;
-
-       spin_lock_irqsave(&totals->lock, flags);
-       *times = *totals;
-       spin_unlock_irqrestore(&totals->lock, flags);
-}
+void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times);
+void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times);
 
 static inline void thread_group_cputime_init(struct signal_struct *sig)
 {
-       sig->cputime.totals = (struct task_cputime){
-               .utime = cputime_zero,
-               .stime = cputime_zero,
-               .sum_exec_runtime = 0,
-       };
-
-       spin_lock_init(&sig->cputime.totals.lock);
+       sig->cputimer.cputime = INIT_CPUTIME;
+       spin_lock_init(&sig->cputimer.lock);
+       sig->cputimer.running = 0;
 }
 
 static inline void thread_group_cputime_free(struct signal_struct *sig)
index 8ba1c320f9759e5057ab656c83e2bf43a5236039..c2731bfe04d8a3255cc00d35af5b87dfb052895f 100644 (file)
@@ -60,7 +60,7 @@ typedef struct sctphdr {
        __be16 source;
        __be16 dest;
        __be32 vtag;
-       __be32 checksum;
+       __le32 checksum;
 } __attribute__((packed)) sctp_sctphdr_t;
 
 #ifdef __KERNEL__
@@ -172,35 +172,35 @@ typedef struct sctp_paramhdr {
 typedef enum {
 
        /* RFC 2960 Section 3.3.5 */
-       SCTP_PARAM_HEARTBEAT_INFO               = __constant_htons(1),
+       SCTP_PARAM_HEARTBEAT_INFO               = cpu_to_be16(1),
        /* RFC 2960 Section 3.3.2.1 */
-       SCTP_PARAM_IPV4_ADDRESS                 = __constant_htons(5),
-       SCTP_PARAM_IPV6_ADDRESS                 = __constant_htons(6),
-       SCTP_PARAM_STATE_COOKIE                 = __constant_htons(7),
-       SCTP_PARAM_UNRECOGNIZED_PARAMETERS      = __constant_htons(8),
-       SCTP_PARAM_COOKIE_PRESERVATIVE          = __constant_htons(9),
-       SCTP_PARAM_HOST_NAME_ADDRESS            = __constant_htons(11),
-       SCTP_PARAM_SUPPORTED_ADDRESS_TYPES      = __constant_htons(12),
-       SCTP_PARAM_ECN_CAPABLE                  = __constant_htons(0x8000),
+       SCTP_PARAM_IPV4_ADDRESS                 = cpu_to_be16(5),
+       SCTP_PARAM_IPV6_ADDRESS                 = cpu_to_be16(6),
+       SCTP_PARAM_STATE_COOKIE                 = cpu_to_be16(7),
+       SCTP_PARAM_UNRECOGNIZED_PARAMETERS      = cpu_to_be16(8),
+       SCTP_PARAM_COOKIE_PRESERVATIVE          = cpu_to_be16(9),
+       SCTP_PARAM_HOST_NAME_ADDRESS            = cpu_to_be16(11),
+       SCTP_PARAM_SUPPORTED_ADDRESS_TYPES      = cpu_to_be16(12),
+       SCTP_PARAM_ECN_CAPABLE                  = cpu_to_be16(0x8000),
 
        /* AUTH Extension Section 3 */
-       SCTP_PARAM_RANDOM                       = __constant_htons(0x8002),
-       SCTP_PARAM_CHUNKS                       = __constant_htons(0x8003),
-       SCTP_PARAM_HMAC_ALGO                    = __constant_htons(0x8004),
+       SCTP_PARAM_RANDOM                       = cpu_to_be16(0x8002),
+       SCTP_PARAM_CHUNKS                       = cpu_to_be16(0x8003),
+       SCTP_PARAM_HMAC_ALGO                    = cpu_to_be16(0x8004),
 
        /* Add-IP: Supported Extensions, Section 4.2 */
-       SCTP_PARAM_SUPPORTED_EXT        = __constant_htons(0x8008),
+       SCTP_PARAM_SUPPORTED_EXT        = cpu_to_be16(0x8008),
 
        /* PR-SCTP Sec 3.1 */
-       SCTP_PARAM_FWD_TSN_SUPPORT      = __constant_htons(0xc000),
+       SCTP_PARAM_FWD_TSN_SUPPORT      = cpu_to_be16(0xc000),
 
        /* Add-IP Extension. Section 3.2 */
-       SCTP_PARAM_ADD_IP               = __constant_htons(0xc001),
-       SCTP_PARAM_DEL_IP               = __constant_htons(0xc002),
-       SCTP_PARAM_ERR_CAUSE            = __constant_htons(0xc003),
-       SCTP_PARAM_SET_PRIMARY          = __constant_htons(0xc004),
-       SCTP_PARAM_SUCCESS_REPORT       = __constant_htons(0xc005),
-       SCTP_PARAM_ADAPTATION_LAYER_IND = __constant_htons(0xc006),
+       SCTP_PARAM_ADD_IP               = cpu_to_be16(0xc001),
+       SCTP_PARAM_DEL_IP               = cpu_to_be16(0xc002),
+       SCTP_PARAM_ERR_CAUSE            = cpu_to_be16(0xc003),
+       SCTP_PARAM_SET_PRIMARY          = cpu_to_be16(0xc004),
+       SCTP_PARAM_SUCCESS_REPORT       = cpu_to_be16(0xc005),
+       SCTP_PARAM_ADAPTATION_LAYER_IND = cpu_to_be16(0xc006),
 
 } sctp_param_t; /* enum */
 
@@ -212,13 +212,13 @@ typedef enum {
  *
  */
 typedef enum {
-       SCTP_PARAM_ACTION_DISCARD     = __constant_htons(0x0000),
-       SCTP_PARAM_ACTION_DISCARD_ERR = __constant_htons(0x4000),
-       SCTP_PARAM_ACTION_SKIP        = __constant_htons(0x8000),
-       SCTP_PARAM_ACTION_SKIP_ERR    = __constant_htons(0xc000),
+       SCTP_PARAM_ACTION_DISCARD     = cpu_to_be16(0x0000),
+       SCTP_PARAM_ACTION_DISCARD_ERR = cpu_to_be16(0x4000),
+       SCTP_PARAM_ACTION_SKIP        = cpu_to_be16(0x8000),
+       SCTP_PARAM_ACTION_SKIP_ERR    = cpu_to_be16(0xc000),
 } sctp_param_action_t;
 
-enum { SCTP_PARAM_ACTION_MASK = __constant_htons(0xc000), };
+enum { SCTP_PARAM_ACTION_MASK = cpu_to_be16(0xc000), };
 
 /* RFC 2960 Section 3.3.1 Payload Data (DATA) (0) */
 
@@ -457,17 +457,17 @@ typedef struct sctp_operr_chunk {
  */
 typedef enum {
 
-       SCTP_ERROR_NO_ERROR        = __constant_htons(0x00),
-       SCTP_ERROR_INV_STRM        = __constant_htons(0x01),
-       SCTP_ERROR_MISS_PARAM      = __constant_htons(0x02),
-       SCTP_ERROR_STALE_COOKIE    = __constant_htons(0x03),
-       SCTP_ERROR_NO_RESOURCE     = __constant_htons(0x04),
-       SCTP_ERROR_DNS_FAILED      = __constant_htons(0x05),
-       SCTP_ERROR_UNKNOWN_CHUNK   = __constant_htons(0x06),
-       SCTP_ERROR_INV_PARAM       = __constant_htons(0x07),
-       SCTP_ERROR_UNKNOWN_PARAM   = __constant_htons(0x08),
-       SCTP_ERROR_NO_DATA         = __constant_htons(0x09),
-       SCTP_ERROR_COOKIE_IN_SHUTDOWN = __constant_htons(0x0a),
+       SCTP_ERROR_NO_ERROR        = cpu_to_be16(0x00),
+       SCTP_ERROR_INV_STRM        = cpu_to_be16(0x01),
+       SCTP_ERROR_MISS_PARAM      = cpu_to_be16(0x02),
+       SCTP_ERROR_STALE_COOKIE    = cpu_to_be16(0x03),
+       SCTP_ERROR_NO_RESOURCE     = cpu_to_be16(0x04),
+       SCTP_ERROR_DNS_FAILED      = cpu_to_be16(0x05),
+       SCTP_ERROR_UNKNOWN_CHUNK   = cpu_to_be16(0x06),
+       SCTP_ERROR_INV_PARAM       = cpu_to_be16(0x07),
+       SCTP_ERROR_UNKNOWN_PARAM   = cpu_to_be16(0x08),
+       SCTP_ERROR_NO_DATA         = cpu_to_be16(0x09),
+       SCTP_ERROR_COOKIE_IN_SHUTDOWN = cpu_to_be16(0x0a),
 
 
        /* SCTP Implementation Guide:
@@ -476,9 +476,9 @@ typedef enum {
         *  13  Protocol Violation
         */
 
-       SCTP_ERROR_RESTART         = __constant_htons(0x0b),
-       SCTP_ERROR_USER_ABORT      = __constant_htons(0x0c),
-       SCTP_ERROR_PROTO_VIOLATION = __constant_htons(0x0d),
+       SCTP_ERROR_RESTART         = cpu_to_be16(0x0b),
+       SCTP_ERROR_USER_ABORT      = cpu_to_be16(0x0c),
+       SCTP_ERROR_PROTO_VIOLATION = cpu_to_be16(0x0d),
 
        /* ADDIP Section 3.3  New Error Causes
         *
@@ -493,11 +493,11 @@ typedef enum {
         * 0x0103          Association Aborted due to illegal ASCONF-ACK
         * 0x0104          Request refused - no authorization.
         */
-       SCTP_ERROR_DEL_LAST_IP  = __constant_htons(0x0100),
-       SCTP_ERROR_RSRC_LOW     = __constant_htons(0x0101),
-       SCTP_ERROR_DEL_SRC_IP   = __constant_htons(0x0102),
-       SCTP_ERROR_ASCONF_ACK   = __constant_htons(0x0103),
-       SCTP_ERROR_REQ_REFUSED  = __constant_htons(0x0104),
+       SCTP_ERROR_DEL_LAST_IP  = cpu_to_be16(0x0100),
+       SCTP_ERROR_RSRC_LOW     = cpu_to_be16(0x0101),
+       SCTP_ERROR_DEL_SRC_IP   = cpu_to_be16(0x0102),
+       SCTP_ERROR_ASCONF_ACK   = cpu_to_be16(0x0103),
+       SCTP_ERROR_REQ_REFUSED  = cpu_to_be16(0x0104),
 
        /* AUTH Section 4.  New Error Cause
         *
@@ -509,7 +509,7 @@ typedef enum {
         * --------------------------------------------------------------
         * 0x0105          Unsupported HMAC Identifier
         */
-        SCTP_ERROR_UNSUP_HMAC  = __constant_htons(0x0105)
+        SCTP_ERROR_UNSUP_HMAC  = cpu_to_be16(0x0105)
 } sctp_error_t;
 
 
index 40ea5058c2ec0ced97079290c08cd5bac08d1dca..f616f31576d719597cd91b25498fece72e24cc8d 100644 (file)
@@ -19,6 +19,7 @@ struct seq_file {
        size_t from;
        size_t count;
        loff_t index;
+       loff_t read_pos;
        u64 version;
        struct mutex lock;
        const struct seq_operations *op;
index 90bbbf0b1161bd592a19c1b2cc3f6803776c53df..df9245c7bd3be3b384146434a0494eea946225dd 100644 (file)
@@ -296,6 +296,7 @@ struct uart_port {
 #define UPF_HARDPPS_CD         ((__force upf_t) (1 << 11))
 #define UPF_LOW_LATENCY                ((__force upf_t) (1 << 13))
 #define UPF_BUGGY_UART         ((__force upf_t) (1 << 14))
+#define UPF_NO_TXEN_TEST       ((__force upf_t) (1 << 15))
 #define UPF_MAGIC_MULTIPLIER   ((__force upf_t) (1 << 16))
 #define UPF_CONS_FLOW          ((__force upf_t) (1 << 23))
 #define UPF_SHARE_IRQ          ((__force upf_t) (1 << 24))
index 9dcf956ad18ab20ce4ebb5a7f2e33636be4a6551..61ce97a8b868921e46eda69134d06c1c5ecb4eb0 100644 (file)
@@ -29,9 +29,6 @@
 #include <linux/dmaengine.h>
 #include <linux/hrtimer.h>
 
-#define HAVE_ALLOC_SKB         /* For the drivers to know */
-#define HAVE_ALIGNABLE_SKB     /* Ditto 8)                */
-
 /* Don't change this without changing skb_csum_unnecessary! */
 #define CHECKSUM_NONE 0
 #define CHECKSUM_UNNECESSARY 1
@@ -135,6 +132,57 @@ struct skb_frag_struct {
        __u32 size;
 };
 
+#define HAVE_HW_TIME_STAMP
+
+/**
+ * skb_shared_hwtstamps - hardware time stamps
+ *
+ * @hwtstamp:  hardware time stamp transformed into duration
+ *             since arbitrary point in time
+ * @syststamp: hwtstamp transformed to system time base
+ *
+ * Software time stamps generated by ktime_get_real() are stored in
+ * skb->tstamp. The relation between the different kinds of time
+ * stamps is as follows:
+ *
+ * syststamp and tstamp can be compared against each other in
+ * arbitrary combinations.  The accuracy of a
+ * syststamp/tstamp/"syststamp from other device" comparison is
+ * limited by the accuracy of the transformation into system time
+ * base. This depends on the device driver and its underlying
+ * hardware.
+ *
+ * hwtstamps can only be compared against other hwtstamps from
+ * the same device.
+ *
+ * This structure is attached to packets as part of the
+ * &skb_shared_info. Use skb_hwtstamps() to get a pointer.
+ */
+struct skb_shared_hwtstamps {
+       ktime_t hwtstamp;
+       ktime_t syststamp;
+};
+
+/**
+ * skb_shared_tx - instructions for time stamping of outgoing packets
+ *
+ * @hardware:          generate hardware time stamp
+ * @software:          generate software time stamp
+ * @in_progress:       device driver is going to provide
+ *                     hardware time stamp
+ *
+ * These flags are attached to packets as part of the
+ * &skb_shared_info. Use skb_tx() to get a pointer.
+ */
+union skb_shared_tx {
+       struct {
+               __u8    hardware:1,
+                       software:1,
+                       in_progress:1;
+       };
+       __u8 flags;
+};
+
 /* This data is invariant across clones and lives at
  * the end of the header data, ie. at skb->end.
  */
@@ -146,10 +194,12 @@ struct skb_shared_info {
        unsigned short  gso_segs;
        unsigned short  gso_type;
        __be32          ip6_frag_id;
+       union skb_shared_tx tx_flags;
 #ifdef CONFIG_HAS_DMA
        unsigned int    num_dma_maps;
 #endif
        struct sk_buff  *frag_list;
+       struct skb_shared_hwtstamps hwtstamps;
        skb_frag_t      frags[MAX_SKB_FRAGS];
 #ifdef CONFIG_HAS_DMA
        dma_addr_t      dma_maps[MAX_SKB_FRAGS + 1];
@@ -459,6 +509,16 @@ static inline unsigned char *skb_end_pointer(const struct sk_buff *skb)
 /* Internal */
 #define skb_shinfo(SKB)        ((struct skb_shared_info *)(skb_end_pointer(SKB)))
 
+static inline struct skb_shared_hwtstamps *skb_hwtstamps(struct sk_buff *skb)
+{
+       return &skb_shinfo(skb)->hwtstamps;
+}
+
+static inline union skb_shared_tx *skb_tx(struct sk_buff *skb)
+{
+       return &skb_shinfo(skb)->tx_flags;
+}
+
 /**
  *     skb_queue_empty - check if a queue is empty
  *     @list: queue head
@@ -1278,7 +1338,7 @@ static inline int skb_network_offset(const struct sk_buff *skb)
  * The networking layer reserves some headroom in skb data (via
  * dev_alloc_skb). This is used to avoid having to reallocate skb data when
  * the header has to grow. In the default case, if the header has to grow
- * 16 bytes or less we avoid the reallocation.
+ * 32 bytes or less we avoid the reallocation.
  *
  * Unfortunately this headroom changes the DMA alignment of the resulting
  * network packet. As for NET_IP_ALIGN, this unaligned DMA is expensive
@@ -1286,11 +1346,11 @@ static inline int skb_network_offset(const struct sk_buff *skb)
  * perhaps setting it to a cacheline in size (since that will maintain
  * cacheline alignment of the DMA). It must be a power of 2.
  *
- * Various parts of the networking layer expect at least 16 bytes of
+ * Various parts of the networking layer expect at least 32 bytes of
  * headroom, you should not reduce this.
  */
 #ifndef NET_SKB_PAD
-#define NET_SKB_PAD    16
+#define NET_SKB_PAD    32
 #endif
 
 extern int ___pskb_trim(struct sk_buff *skb, unsigned int len);
@@ -1678,8 +1738,6 @@ extern int               skb_shift(struct sk_buff *tgt, struct sk_buff *skb,
                                 int shiftlen);
 
 extern struct sk_buff *skb_segment(struct sk_buff *skb, int features);
-extern int            skb_gro_receive(struct sk_buff **head,
-                                      struct sk_buff *skb);
 
 static inline void *skb_header_pointer(const struct sk_buff *skb, int offset,
                                       int len, void *buffer)
@@ -1726,6 +1784,11 @@ static inline void skb_copy_to_linear_data_offset(struct sk_buff *skb,
 
 extern void skb_init(void);
 
+static inline ktime_t skb_get_ktime(const struct sk_buff *skb)
+{
+       return skb->tstamp;
+}
+
 /**
  *     skb_get_timestamp - get timestamp from a skb
  *     @skb: skb to get stamp from
@@ -1735,11 +1798,18 @@ extern void skb_init(void);
  *     This function converts the offset back to a struct timeval and stores
  *     it in stamp.
  */
-static inline void skb_get_timestamp(const struct sk_buff *skb, struct timeval *stamp)
+static inline void skb_get_timestamp(const struct sk_buff *skb,
+                                    struct timeval *stamp)
 {
        *stamp = ktime_to_timeval(skb->tstamp);
 }
 
+static inline void skb_get_timestampns(const struct sk_buff *skb,
+                                      struct timespec *stamp)
+{
+       *stamp = ktime_to_timespec(skb->tstamp);
+}
+
 static inline void __net_timestamp(struct sk_buff *skb)
 {
        skb->tstamp = ktime_get_real();
@@ -1755,6 +1825,20 @@ static inline ktime_t net_invalid_timestamp(void)
        return ktime_set(0, 0);
 }
 
+/**
+ * skb_tstamp_tx - queue clone of skb with send time stamps
+ * @orig_skb:  the original outgoing packet
+ * @hwtstamps: hardware time stamps, may be NULL if not available
+ *
+ * If the skb has a socket associated, then this function clones the
+ * skb (thus sharing the actual data and optional structures), stores
+ * the optional hardware time stamping information (if non NULL) or
+ * generates a software time stamp (otherwise), then queues the clone
+ * to the error queue of the socket.  Errors are silently ignored.
+ */
+extern void skb_tstamp_tx(struct sk_buff *orig_skb,
+                       struct skb_shared_hwtstamps *hwtstamps);
+
 extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
 extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
 
@@ -1895,6 +1979,21 @@ static inline void skb_copy_queue_mapping(struct sk_buff *to, const struct sk_bu
        to->queue_mapping = from->queue_mapping;
 }
 
+static inline void skb_record_rx_queue(struct sk_buff *skb, u16 rx_queue)
+{
+       skb->queue_mapping = rx_queue + 1;
+}
+
+static inline u16 skb_get_rx_queue(struct sk_buff *skb)
+{
+       return skb->queue_mapping - 1;
+}
+
+static inline bool skb_rx_queue_recorded(struct sk_buff *skb)
+{
+       return (skb->queue_mapping != 0);
+}
+
 #ifdef CONFIG_XFRM
 static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
 {
index f96d13c281e81d03bf0b791ccb10b1a918e12055..24c5602bee99d268f2a1fd29238279d6c9bb3db3 100644 (file)
@@ -127,6 +127,7 @@ int kmem_ptr_validate(struct kmem_cache *cachep, const void *ptr);
 void * __must_check __krealloc(const void *, size_t, gfp_t);
 void * __must_check krealloc(const void *, size_t, gfp_t);
 void kfree(const void *);
+void kzfree(const void *);
 size_t ksize(const void *);
 
 /*
index 1cbf0313adde93f0971e56a89a7a907a08fcb8d6..b32725075d7183a58bbf192fef069f26b8ef2735 100644 (file)
@@ -43,5 +43,8 @@ struct smsc911x_platform_config {
 /* Constants for flags */
 #define SMSC911X_USE_16BIT                     (BIT(0))
 #define SMSC911X_USE_32BIT                     (BIT(1))
+#define SMSC911X_FORCE_INTERNAL_PHY            (BIT(2))
+#define SMSC911X_FORCE_EXTERNAL_PHY            (BIT(3))
+#define SMSC911X_SAVE_MAC_ADDRESS              (BIT(4))
 
 #endif /* __LINUX_SMSC911X_H__ */
index abef7596655a2dfc4c7a933b02c035dd98ed097b..241f179347d94c7fbbbfb558096f09752bf9a62c 100644 (file)
 #define SIOCBRADDIF    0x89a2          /* add interface to bridge      */
 #define SIOCBRDELIF    0x89a3          /* remove interface from bridge */
 
+/* hardware time stamping: parameters in linux/net_tstamp.h */
+#define SIOCSHWTSTAMP   0x89b0
+
 /* Device private ioctl calls */
 
 /*
index 523d069c862c4fd9e95060bf5470a4fd664c4fd5..1904afedb82fcdf445a8d3ee6dc985f0110edb59 100644 (file)
@@ -1045,50 +1045,36 @@ typedef struct mixer_vol_table {
  */
 #define LOCL_STARTAUDIO                1
 
-#if (!defined(__KERNEL__) && !defined(KERNEL) && !defined(INKERNEL) && !defined(_KERNEL)) || defined(USE_SEQ_MACROS) 
+#if !defined(__KERNEL__) || defined(USE_SEQ_MACROS)
 /*
  *     Some convenience macros to simplify programming of the
  *     /dev/sequencer interface
  *
- *     These macros define the API which should be used when possible.
+ *     This is a legacy interface for applications written against
+ *     the OSSlib-3.8 style interface. It is no longer possible
+ *     to actually link against OSSlib with this header, but we
+ *     still provide these macros for programs using them.
+ *
+ *     If you want to use OSSlib, it is recommended that you get
+ *     the GPL version of OSS-4.x and build against that version
+ *     of the header.
+ *
+ *     We redefine the extern keyword so that make headers_check
+ *     does not complain about SEQ_USE_EXTBUF.
  */
 #define SEQ_DECLAREBUF()               SEQ_USE_EXTBUF()
 
 void seqbuf_dump(void);        /* This function must be provided by programs */
 
-extern int OSS_init(int seqfd, int buflen);
-extern void OSS_seqbuf_dump(int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_advbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_seq_needbuf(int len, int fd, unsigned char *buf, int buflen);
-extern void OSS_patch_caching(int dev, int chn, int patch,
-                             int fd, unsigned char *buf, int buflen);
-extern void OSS_drum_caching(int dev, int chn, int patch,
-                             int fd, unsigned char *buf, int buflen);
-extern void OSS_write_patch(int fd, unsigned char *buf, int len);
-extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
-
 #define SEQ_PM_DEFINES int __foo_bar___
-#ifdef OSSLIB
-#  define SEQ_USE_EXTBUF() \
-               extern unsigned char *_seqbuf; \
-               extern int _seqbuflen;extern int _seqbufptr
-#  define SEQ_DEFINEBUF(len) SEQ_USE_EXTBUF();static int _requested_seqbuflen=len
-#  define _SEQ_ADVBUF(len) OSS_seq_advbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define _SEQ_NEEDBUF(len) OSS_seq_needbuf(len, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_DUMPBUF() OSS_seqbuf_dump(seqfd, _seqbuf, _seqbuflen)
-
-#  define SEQ_LOAD_GMINSTR(dev, instr) \
-               OSS_patch_caching(dev, -1, instr, seqfd, _seqbuf, _seqbuflen)
-#  define SEQ_LOAD_GMDRUM(dev, drum) \
-               OSS_drum_caching(dev, -1, drum, seqfd, _seqbuf, _seqbuflen)
-#else /* !OSSLIB */
-
-#  define SEQ_LOAD_GMINSTR(dev, instr)
-#  define SEQ_LOAD_GMDRUM(dev, drum)
-
-#  define SEQ_USE_EXTBUF() \
-               extern unsigned char _seqbuf[]; \
-               extern int _seqbuflen;extern int _seqbufptr
+
+#define SEQ_LOAD_GMINSTR(dev, instr)
+#define SEQ_LOAD_GMDRUM(dev, drum)
+
+#define _SEQ_EXTERN extern
+#define SEQ_USE_EXTBUF() \
+               _SEQ_EXTERN unsigned char _seqbuf[]; \
+               _SEQ_EXTERN int _seqbuflen; _SEQ_EXTERN int _seqbufptr
 
 #ifndef USE_SIMPLE_MACROS
 /* Sample seqbuf_dump() implementation:
@@ -1131,7 +1117,6 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
  */
 #define _SEQ_NEEDBUF(len)      /* empty */
 #endif
-#endif /* !OSSLIB */
 
 #define SEQ_VOLUME_MODE(dev, mode)     {_SEQ_NEEDBUF(8);\
                                        _seqbuf[_seqbufptr] = SEQ_EXTENDED;\
@@ -1215,14 +1200,8 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
                _CHN_COMMON(dev, MIDI_CHN_PRESSURE, chn, pressure, 0, 0)
 
 #define SEQ_SET_PATCH SEQ_PGM_CHANGE
-#ifdef OSSLIB
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
-               {OSS_patch_caching(dev, chn, patch, seqfd, _seqbuf, _seqbuflen); \
-                _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0);}
-#else
-#   define SEQ_PGM_CHANGE(dev, chn, patch) \
+#define SEQ_PGM_CHANGE(dev, chn, patch) \
                _CHN_COMMON(dev, MIDI_PGM_CHANGE, chn, patch, 0, 0)
-#endif
 
 #define SEQ_CONTROL(dev, chn, controller, value) \
                _CHN_COMMON(dev, MIDI_CTL_CHANGE, chn, controller, 0, value)
@@ -1300,19 +1279,12 @@ extern int OSS_write_patch2(int fd, unsigned char *buf, int len);
 /*
  * Patch loading.
  */
-#ifdef OSSLIB
-#   define SEQ_WRPATCH(patchx, len) \
-               OSS_write_patch(seqfd, (char*)(patchx), len)
-#   define SEQ_WRPATCH2(patchx, len) \
-               OSS_write_patch2(seqfd, (char*)(patchx), len)
-#else
-#   define SEQ_WRPATCH(patchx, len) \
+#define SEQ_WRPATCH(patchx, len) \
                {if (_seqbufptr) SEQ_DUMPBUF();\
                 if (write(seqfd, (char*)(patchx), len)==-1) \
                    perror("Write patch: /dev/sequencer");}
-#   define SEQ_WRPATCH2(patchx, len) \
+#define SEQ_WRPATCH2(patchx, len) \
                (SEQ_DUMPBUF(), write(seqfd, (char*)(patchx), len))
-#endif
 
 #endif
 #endif
diff --git a/include/linux/spi/libertas_spi.h b/include/linux/spi/libertas_spi.h
new file mode 100644 (file)
index 0000000..79506f5
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * board-specific data for the libertas_spi driver.
+ *
+ * Copyright 2008 Analog Devices Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+#ifndef _LIBERTAS_SPI_H_
+#define _LIBERTAS_SPI_H_
+
+struct spi_device;
+
+struct libertas_spi_platform_data {
+       /* There are two ways to read data from the WLAN module's SPI
+        * interface. Setting 0 or 1 here controls which one is used.
+        *
+        * Usually you want to set use_dummy_writes = 1.
+        * However, if that doesn't work or if you are using a slow SPI clock
+        * speed, you may want to use 0 here. */
+       u16 use_dummy_writes;
+
+       /* GPIO number to use as chip select */
+       u16 gpio_cs;
+
+       /* Board specific setup/teardown */
+       int (*setup)(struct spi_device *spi);
+       int (*teardown)(struct spi_device *spi);
+};
+#endif
index bf8de281b4ed2a8e8131d34274711f81520d70f6..eed4254bd503f639f7a161dac634f3f68a93d9ed 100644 (file)
@@ -83,6 +83,13 @@ extern int spi_bitbang_stop(struct spi_bitbang *spi);
  *  int getmiso(struct spi_device *);
  *  void spidelay(unsigned);
  *
+ * setsck()'s is_on parameter is a zero/nonzero boolean.
+ *
+ * setmosi()'s is_on parameter is a zero/nonzero boolean.
+ *
+ * getmiso() is required to return 0 or 1 only. Any other value is invalid
+ * and will result in improper operation.
+ *
  * A non-inlined routine would call bitbang_txrx_*() routines.  The
  * main loop could easily compile down to a handful of instructions,
  * especially if the delay is a NOP (to run at peak speed).
index e0c0fccced46c4b09d654121423f76357407bc95..a0c66a2e00add24f97bfcc908dff123fa4a200c6 100644 (file)
@@ -124,7 +124,12 @@ do {                                                               \
 #ifdef CONFIG_GENERIC_LOCKBREAK
 #define spin_is_contended(lock) ((lock)->break_lock)
 #else
+
+#ifdef __raw_spin_is_contended
 #define spin_is_contended(lock)        __raw_spin_is_contended(&(lock)->raw_lock)
+#else
+#define spin_is_contended(lock)        (((void)(lock), 0))
+#endif /*__raw_spin_is_contended*/
 #endif
 
 /**
index 7d7e03dcf77c4914d9490069012a9299cba42638..d3b1d18922f2c3a2897dc2d71f6dc7ea2742141a 100644 (file)
 #define SSB_CHIPCO_PROG_WAITCNT                0x0124
 #define SSB_CHIPCO_FLASH_CFG           0x0128
 #define SSB_CHIPCO_FLASH_WAITCNT       0x012C
+#define SSB_CHIPCO_CLKCTLST            0x01E0 /* Clock control and status (rev >= 20) */
+#define  SSB_CHIPCO_CLKCTLST_FORCEALP  0x00000001 /* Force ALP request */
+#define  SSB_CHIPCO_CLKCTLST_FORCEHT   0x00000002 /* Force HT request */
+#define  SSB_CHIPCO_CLKCTLST_FORCEILP  0x00000004 /* Force ILP request */
+#define  SSB_CHIPCO_CLKCTLST_HAVEALPREQ        0x00000008 /* ALP available request */
+#define  SSB_CHIPCO_CLKCTLST_HAVEHTREQ 0x00000010 /* HT available request */
+#define  SSB_CHIPCO_CLKCTLST_HWCROFF   0x00000020 /* Force HW clock request off */
+#define  SSB_CHIPCO_CLKCTLST_HAVEHT    0x00010000 /* HT available */
+#define  SSB_CHIPCO_CLKCTLST_HAVEALP   0x00020000 /* APL available */
+#define SSB_CHIPCO_HW_WORKAROUND       0x01E4 /* Hardware workaround (rev >= 20) */
 #define SSB_CHIPCO_UART0_DATA          0x0300
 #define SSB_CHIPCO_UART0_IMR           0x0304
 #define SSB_CHIPCO_UART0_FCR           0x0308
 #define SSB_CHIPCO_UART1_LSR           0x0414
 #define SSB_CHIPCO_UART1_MSR           0x0418
 #define SSB_CHIPCO_UART1_SCRATCH       0x041C
+/* PMU registers (rev >= 20) */
+#define SSB_CHIPCO_PMU_CTL                     0x0600 /* PMU control */
+#define  SSB_CHIPCO_PMU_CTL_ILP_DIV            0xFFFF0000 /* ILP div mask */
+#define  SSB_CHIPCO_PMU_CTL_ILP_DIV_SHIFT      16
+#define  SSB_CHIPCO_PMU_CTL_NOILPONW           0x00000200 /* No ILP on wait */
+#define  SSB_CHIPCO_PMU_CTL_HTREQEN            0x00000100 /* HT req enable */
+#define  SSB_CHIPCO_PMU_CTL_ALPREQEN           0x00000080 /* ALP req enable */
+#define  SSB_CHIPCO_PMU_CTL_XTALFREQ           0x0000007C /* Crystal freq */
+#define  SSB_CHIPCO_PMU_CTL_XTALFREQ_SHIFT     2
+#define  SSB_CHIPCO_PMU_CTL_ILPDIVEN           0x00000002 /* ILP div enable */
+#define  SSB_CHIPCO_PMU_CTL_LPOSEL             0x00000001 /* LPO sel */
+#define SSB_CHIPCO_PMU_CAP                     0x0604 /* PMU capabilities */
+#define  SSB_CHIPCO_PMU_CAP_REVISION           0x000000FF /* Revision mask */
+#define SSB_CHIPCO_PMU_STAT                    0x0608 /* PMU status */
+#define  SSB_CHIPCO_PMU_STAT_INTPEND           0x00000040 /* Interrupt pending */
+#define  SSB_CHIPCO_PMU_STAT_SBCLKST           0x00000030 /* Backplane clock status? */
+#define  SSB_CHIPCO_PMU_STAT_HAVEALP           0x00000008 /* ALP available */
+#define  SSB_CHIPCO_PMU_STAT_HAVEHT            0x00000004 /* HT available */
+#define  SSB_CHIPCO_PMU_STAT_RESINIT           0x00000003 /* Res init */
+#define SSB_CHIPCO_PMU_RES_STAT                        0x060C /* PMU res status */
+#define SSB_CHIPCO_PMU_RES_PEND                        0x0610 /* PMU res pending */
+#define SSB_CHIPCO_PMU_TIMER                   0x0614 /* PMU timer */
+#define SSB_CHIPCO_PMU_MINRES_MSK              0x0618 /* PMU min res mask */
+#define SSB_CHIPCO_PMU_MAXRES_MSK              0x061C /* PMU max res mask */
+#define SSB_CHIPCO_PMU_RES_TABSEL              0x0620 /* PMU res table sel */
+#define SSB_CHIPCO_PMU_RES_DEPMSK              0x0624 /* PMU res dep mask */
+#define SSB_CHIPCO_PMU_RES_UPDNTM              0x0628 /* PMU res updown timer */
+#define SSB_CHIPCO_PMU_RES_TIMER               0x062C /* PMU res timer */
+#define SSB_CHIPCO_PMU_CLKSTRETCH              0x0630 /* PMU clockstretch */
+#define SSB_CHIPCO_PMU_WATCHDOG                        0x0634 /* PMU watchdog */
+#define SSB_CHIPCO_PMU_RES_REQTS               0x0640 /* PMU res req timer sel */
+#define SSB_CHIPCO_PMU_RES_REQT                        0x0644 /* PMU res req timer */
+#define SSB_CHIPCO_PMU_RES_REQM                        0x0648 /* PMU res req mask */
+#define SSB_CHIPCO_CHIPCTL_ADDR                        0x0650
+#define SSB_CHIPCO_CHIPCTL_DATA                        0x0654
+#define SSB_CHIPCO_REGCTL_ADDR                 0x0658
+#define SSB_CHIPCO_REGCTL_DATA                 0x065C
+#define SSB_CHIPCO_PLLCTL_ADDR                 0x0660
+#define SSB_CHIPCO_PLLCTL_DATA                 0x0664
+
+
+
+/** PMU PLL registers */
+
+/* PMU rev 0 PLL registers */
+#define SSB_PMU0_PLLCTL0                       0
+#define  SSB_PMU0_PLLCTL0_PDIV_MSK             0x00000001
+#define  SSB_PMU0_PLLCTL0_PDIV_FREQ            25000 /* kHz */
+#define SSB_PMU0_PLLCTL1                       1
+#define  SSB_PMU0_PLLCTL1_WILD_IMSK            0xF0000000 /* Wild int mask (low nibble) */
+#define  SSB_PMU0_PLLCTL1_WILD_IMSK_SHIFT      28
+#define  SSB_PMU0_PLLCTL1_WILD_FMSK            0x0FFFFF00 /* Wild frac mask */
+#define  SSB_PMU0_PLLCTL1_WILD_FMSK_SHIFT      8
+#define  SSB_PMU0_PLLCTL1_STOPMOD              0x00000040 /* Stop mod */
+#define SSB_PMU0_PLLCTL2                       2
+#define  SSB_PMU0_PLLCTL2_WILD_IMSKHI          0x0000000F /* Wild int mask (high nibble) */
+#define  SSB_PMU0_PLLCTL2_WILD_IMSKHI_SHIFT    0
+
+/* PMU rev 1 PLL registers */
+#define SSB_PMU1_PLLCTL0                       0
+#define  SSB_PMU1_PLLCTL0_P1DIV                        0x00F00000 /* P1 div */
+#define  SSB_PMU1_PLLCTL0_P1DIV_SHIFT          20
+#define  SSB_PMU1_PLLCTL0_P2DIV                        0x0F000000 /* P2 div */
+#define  SSB_PMU1_PLLCTL0_P2DIV_SHIFT          24
+#define SSB_PMU1_PLLCTL1                       1
+#define  SSB_PMU1_PLLCTL1_M1DIV                        0x000000FF /* M1 div */
+#define  SSB_PMU1_PLLCTL1_M1DIV_SHIFT          0
+#define  SSB_PMU1_PLLCTL1_M2DIV                        0x0000FF00 /* M2 div */
+#define  SSB_PMU1_PLLCTL1_M2DIV_SHIFT          8
+#define  SSB_PMU1_PLLCTL1_M3DIV                        0x00FF0000 /* M3 div */
+#define  SSB_PMU1_PLLCTL1_M3DIV_SHIFT          16
+#define  SSB_PMU1_PLLCTL1_M4DIV                        0xFF000000 /* M4 div */
+#define  SSB_PMU1_PLLCTL1_M4DIV_SHIFT          24
+#define SSB_PMU1_PLLCTL2                       2
+#define  SSB_PMU1_PLLCTL2_M5DIV                        0x000000FF /* M5 div */
+#define  SSB_PMU1_PLLCTL2_M5DIV_SHIFT          0
+#define  SSB_PMU1_PLLCTL2_M6DIV                        0x0000FF00 /* M6 div */
+#define  SSB_PMU1_PLLCTL2_M6DIV_SHIFT          8
+#define  SSB_PMU1_PLLCTL2_NDIVMODE             0x000E0000 /* NDIV mode */
+#define  SSB_PMU1_PLLCTL2_NDIVMODE_SHIFT       17
+#define  SSB_PMU1_PLLCTL2_NDIVINT              0x1FF00000 /* NDIV int */
+#define  SSB_PMU1_PLLCTL2_NDIVINT_SHIFT                20
+#define SSB_PMU1_PLLCTL3                       3
+#define  SSB_PMU1_PLLCTL3_NDIVFRAC             0x00FFFFFF /* NDIV frac */
+#define  SSB_PMU1_PLLCTL3_NDIVFRAC_SHIFT       0
+#define SSB_PMU1_PLLCTL4                       4
+#define SSB_PMU1_PLLCTL5                       5
+#define  SSB_PMU1_PLLCTL5_CLKDRV               0xFFFFFF00 /* clk drv */
+#define  SSB_PMU1_PLLCTL5_CLKDRV_SHIFT         8
+
+/* BCM4312 PLL resource numbers. */
+#define SSB_PMURES_4312_SWITCHER_BURST         0
+#define SSB_PMURES_4312_SWITCHER_PWM           1
+#define SSB_PMURES_4312_PA_REF_LDO             2
+#define SSB_PMURES_4312_CORE_LDO_BURST         3
+#define SSB_PMURES_4312_CORE_LDO_PWM           4
+#define SSB_PMURES_4312_RADIO_LDO              5
+#define SSB_PMURES_4312_ILP_REQUEST            6
+#define SSB_PMURES_4312_BG_FILTBYP             7
+#define SSB_PMURES_4312_TX_FILTBYP             8
+#define SSB_PMURES_4312_RX_FILTBYP             9
+#define SSB_PMURES_4312_XTAL_PU                        10
+#define SSB_PMURES_4312_ALP_AVAIL              11
+#define SSB_PMURES_4312_BB_PLL_FILTBYP         12
+#define SSB_PMURES_4312_RF_PLL_FILTBYP         13
+#define SSB_PMURES_4312_HT_AVAIL               14
+
+/* BCM4325 PLL resource numbers. */
+#define SSB_PMURES_4325_BUCK_BOOST_BURST       0
+#define SSB_PMURES_4325_CBUCK_BURST            1
+#define SSB_PMURES_4325_CBUCK_PWM              2
+#define SSB_PMURES_4325_CLDO_CBUCK_BURST       3
+#define SSB_PMURES_4325_CLDO_CBUCK_PWM         4
+#define SSB_PMURES_4325_BUCK_BOOST_PWM         5
+#define SSB_PMURES_4325_ILP_REQUEST            6
+#define SSB_PMURES_4325_ABUCK_BURST            7
+#define SSB_PMURES_4325_ABUCK_PWM              8
+#define SSB_PMURES_4325_LNLDO1_PU              9
+#define SSB_PMURES_4325_LNLDO2_PU              10
+#define SSB_PMURES_4325_LNLDO3_PU              11
+#define SSB_PMURES_4325_LNLDO4_PU              12
+#define SSB_PMURES_4325_XTAL_PU                        13
+#define SSB_PMURES_4325_ALP_AVAIL              14
+#define SSB_PMURES_4325_RX_PWRSW_PU            15
+#define SSB_PMURES_4325_TX_PWRSW_PU            16
+#define SSB_PMURES_4325_RFPLL_PWRSW_PU         17
+#define SSB_PMURES_4325_LOGEN_PWRSW_PU         18
+#define SSB_PMURES_4325_AFE_PWRSW_PU           19
+#define SSB_PMURES_4325_BBPLL_PWRSW_PU         20
+#define SSB_PMURES_4325_HT_AVAIL               21
+
+/* BCM4328 PLL resource numbers. */
+#define SSB_PMURES_4328_EXT_SWITCHER_PWM       0
+#define SSB_PMURES_4328_BB_SWITCHER_PWM                1
+#define SSB_PMURES_4328_BB_SWITCHER_BURST      2
+#define SSB_PMURES_4328_BB_EXT_SWITCHER_BURST  3
+#define SSB_PMURES_4328_ILP_REQUEST            4
+#define SSB_PMURES_4328_RADIO_SWITCHER_PWM     5
+#define SSB_PMURES_4328_RADIO_SWITCHER_BURST   6
+#define SSB_PMURES_4328_ROM_SWITCH             7
+#define SSB_PMURES_4328_PA_REF_LDO             8
+#define SSB_PMURES_4328_RADIO_LDO              9
+#define SSB_PMURES_4328_AFE_LDO                        10
+#define SSB_PMURES_4328_PLL_LDO                        11
+#define SSB_PMURES_4328_BG_FILTBYP             12
+#define SSB_PMURES_4328_TX_FILTBYP             13
+#define SSB_PMURES_4328_RX_FILTBYP             14
+#define SSB_PMURES_4328_XTAL_PU                        15
+#define SSB_PMURES_4328_XTAL_EN                        16
+#define SSB_PMURES_4328_BB_PLL_FILTBYP         17
+#define SSB_PMURES_4328_RF_PLL_FILTBYP         18
+#define SSB_PMURES_4328_BB_PLL_PU              19
+
+/* BCM5354 PLL resource numbers. */
+#define SSB_PMURES_5354_EXT_SWITCHER_PWM       0
+#define SSB_PMURES_5354_BB_SWITCHER_PWM                1
+#define SSB_PMURES_5354_BB_SWITCHER_BURST      2
+#define SSB_PMURES_5354_BB_EXT_SWITCHER_BURST  3
+#define SSB_PMURES_5354_ILP_REQUEST            4
+#define SSB_PMURES_5354_RADIO_SWITCHER_PWM     5
+#define SSB_PMURES_5354_RADIO_SWITCHER_BURST   6
+#define SSB_PMURES_5354_ROM_SWITCH             7
+#define SSB_PMURES_5354_PA_REF_LDO             8
+#define SSB_PMURES_5354_RADIO_LDO              9
+#define SSB_PMURES_5354_AFE_LDO                        10
+#define SSB_PMURES_5354_PLL_LDO                        11
+#define SSB_PMURES_5354_BG_FILTBYP             12
+#define SSB_PMURES_5354_TX_FILTBYP             13
+#define SSB_PMURES_5354_RX_FILTBYP             14
+#define SSB_PMURES_5354_XTAL_PU                        15
+#define SSB_PMURES_5354_XTAL_EN                        16
+#define SSB_PMURES_5354_BB_PLL_FILTBYP         17
+#define SSB_PMURES_5354_RF_PLL_FILTBYP         18
+#define SSB_PMURES_5354_BB_PLL_PU              19
+
+
+
+/** Chip specific Chip-Status register contents. */
+#define SSB_CHIPCO_CHST_4325_SPROM_OTP_SEL     0x00000003
+#define SSB_CHIPCO_CHST_4325_DEFCIS_SEL                0 /* OTP is powered up, use def. CIS, no SPROM */
+#define SSB_CHIPCO_CHST_4325_SPROM_SEL         1 /* OTP is powered up, SPROM is present */
+#define SSB_CHIPCO_CHST_4325_OTP_SEL           2 /* OTP is powered up, no SPROM */
+#define SSB_CHIPCO_CHST_4325_OTP_PWRDN         3 /* OTP is powered down, SPROM is present */
+#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE     0x00000004
+#define SSB_CHIPCO_CHST_4325_SDIO_USB_MODE_SHIFT  2
+#define SSB_CHIPCO_CHST_4325_RCAL_VALID                0x00000008
+#define SSB_CHIPCO_CHST_4325_RCAL_VALID_SHIFT  3
+#define SSB_CHIPCO_CHST_4325_RCAL_VALUE                0x000001F0
+#define SSB_CHIPCO_CHST_4325_RCAL_VALUE_SHIFT  4
+#define SSB_CHIPCO_CHST_4325_PMUTOP_2B                 0x00000200 /* 1 for 2b, 0 for to 2a */
 
 
 
 struct ssb_device;
 struct ssb_serial_port;
 
+/* Data for the PMU, if available.
+ * Check availability with ((struct ssb_chipcommon)->capabilities & SSB_CHIPCO_CAP_PMU)
+ */
+struct ssb_chipcommon_pmu {
+       u8 rev;                 /* PMU revision */
+       u32 crystalfreq;        /* The active crystal frequency (in kHz) */
+};
+
 struct ssb_chipcommon {
        struct ssb_device *dev;
        u32 capabilities;
        /* Fast Powerup Delay constant */
        u16 fast_pwrup_delay;
+       struct ssb_chipcommon_pmu pmu;
 };
 
 static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
@@ -365,6 +574,17 @@ static inline bool ssb_chipco_available(struct ssb_chipcommon *cc)
        return (cc->dev != NULL);
 }
 
+/* Register access */
+#define chipco_read32(cc, offset)      ssb_read32((cc)->dev, offset)
+#define chipco_write32(cc, offset, val)        ssb_write32((cc)->dev, offset, val)
+
+#define chipco_mask32(cc, offset, mask) \
+               chipco_write32(cc, offset, chipco_read32(cc, offset) & (mask))
+#define chipco_set32(cc, offset, set) \
+               chipco_write32(cc, offset, chipco_read32(cc, offset) | (set))
+#define chipco_maskset32(cc, offset, mask, set) \
+               chipco_write32(cc, offset, (chipco_read32(cc, offset) & (mask)) | (set))
+
 extern void ssb_chipcommon_init(struct ssb_chipcommon *cc);
 
 extern void ssb_chipco_suspend(struct ssb_chipcommon *cc);
@@ -406,4 +626,8 @@ extern int ssb_chipco_serial_init(struct ssb_chipcommon *cc,
                                  struct ssb_serial_port *ports);
 #endif /* CONFIG_SSB_SERIAL */
 
+/* PMU support */
+extern void ssb_pmu_init(struct ssb_chipcommon *cc);
+
+
 #endif /* LINUX_SSB_CHIPCO_H_ */
index 99a0f991e85000431e300758472e7f053dc430ff..a01b982b578356b6798b1f6115d7f3907fbc7b99 100644 (file)
 #define  SSB_SPROM5_GPIOB_P3           0xFF00  /* Pin 3 */
 #define  SSB_SPROM5_GPIOB_P3_SHIFT     8
 
+/* SPROM Revision 8 */
+#define SSB_SPROM8_BFLLO               0x1084  /* Boardflags (low 16 bits) */
+#define SSB_SPROM8_BFLHI               0x1086  /* Boardflags Hi */
+#define SSB_SPROM8_IL0MAC              0x108C  /* 6 byte MAC address */
+#define SSB_SPROM8_CCODE               0x1092  /* 2 byte country code */
+#define SSB_SPROM8_ANTAVAIL            0x109C  /* Antenna available bitfields*/
+#define SSB_SPROM8_ANTAVAIL_A          0xFF00  /* A-PHY bitfield */
+#define SSB_SPROM8_ANTAVAIL_A_SHIFT    8
+#define SSB_SPROM8_ANTAVAIL_BG         0x00FF  /* B-PHY and G-PHY bitfield */
+#define SSB_SPROM8_ANTAVAIL_BG_SHIFT   0
+#define SSB_SPROM8_AGAIN01             0x109E  /* Antenna Gain (in dBm Q5.2) */
+#define  SSB_SPROM8_AGAIN0             0x00FF  /* Antenna 0 */
+#define  SSB_SPROM8_AGAIN0_SHIFT       0
+#define  SSB_SPROM8_AGAIN1             0xFF00  /* Antenna 1 */
+#define  SSB_SPROM8_AGAIN1_SHIFT       8
+#define SSB_SPROM8_AGAIN23             0x10A0
+#define  SSB_SPROM8_AGAIN2             0x00FF  /* Antenna 2 */
+#define  SSB_SPROM8_AGAIN2_SHIFT       0
+#define  SSB_SPROM8_AGAIN3             0xFF00  /* Antenna 3 */
+#define  SSB_SPROM8_AGAIN3_SHIFT       8
+#define SSB_SPROM8_GPIOA               0x1096  /*Gen. Purpose IO # 0 and 1 */
+#define  SSB_SPROM8_GPIOA_P0           0x00FF  /* Pin 0 */
+#define  SSB_SPROM8_GPIOA_P1           0xFF00  /* Pin 1 */
+#define  SSB_SPROM8_GPIOA_P1_SHIFT     8
+#define SSB_SPROM8_GPIOB               0x1098  /* Gen. Purpose IO # 2 and 3 */
+#define  SSB_SPROM8_GPIOB_P2           0x00FF  /* Pin 2 */
+#define  SSB_SPROM8_GPIOB_P3           0xFF00  /* Pin 3 */
+#define  SSB_SPROM8_GPIOB_P3_SHIFT     8
+#define SSB_SPROM8_MAXP_BG             0x10C0  /* Max Power BG in path 1 */
+#define  SSB_SPROM8_MAXP_BG_MASK       0x00FF  /* Mask for Max Power BG */
+#define  SSB_SPROM8_ITSSI_BG           0xFF00  /* Mask for path 1 itssi_bg */
+#define  SSB_SPROM8_ITSSI_BG_SHIFT     8
+#define SSB_SPROM8_MAXP_A              0x10C8  /* Max Power A in path 1 */
+#define  SSB_SPROM8_MAXP_A_MASK                0x00FF  /* Mask for Max Power A */
+#define  SSB_SPROM8_ITSSI_A            0xFF00  /* Mask for path 1 itssi_a */
+#define  SSB_SPROM8_ITSSI_A_SHIFT      8
 
 /* Values for SSB_SPROM1_BINF_CCODE */
 enum {
index 0eda02ff2414dbcedeab8312f4cbc3c2a2a7fbc7..f9f900cfd066f1ad19ac979dba0c48f2384b95e2 100644 (file)
@@ -95,13 +95,13 @@ struct old_linux_dirent;
 #define __SC_TEST5(t5, a5, ...)        __SC_TEST(t5); __SC_TEST4(__VA_ARGS__)
 #define __SC_TEST6(t6, a6, ...)        __SC_TEST(t6); __SC_TEST5(__VA_ARGS__)
 
-#define SYSCALL_DEFINE0(name)   asmlinkage long sys_##name(void)
-#define SYSCALL_DEFINE1(...)    SYSCALL_DEFINEx(1, __VA_ARGS__)
-#define SYSCALL_DEFINE2(...)    SYSCALL_DEFINEx(2, __VA_ARGS__)
-#define SYSCALL_DEFINE3(...)    SYSCALL_DEFINEx(3, __VA_ARGS__)
-#define SYSCALL_DEFINE4(...)    SYSCALL_DEFINEx(4, __VA_ARGS__)
-#define SYSCALL_DEFINE5(...)    SYSCALL_DEFINEx(5, __VA_ARGS__)
-#define SYSCALL_DEFINE6(...)    SYSCALL_DEFINEx(6, __VA_ARGS__)
+#define SYSCALL_DEFINE0(name)     asmlinkage long sys_##name(void)
+#define SYSCALL_DEFINE1(name, ...) SYSCALL_DEFINEx(1, _##name, __VA_ARGS__)
+#define SYSCALL_DEFINE2(name, ...) SYSCALL_DEFINEx(2, _##name, __VA_ARGS__)
+#define SYSCALL_DEFINE3(name, ...) SYSCALL_DEFINEx(3, _##name, __VA_ARGS__)
+#define SYSCALL_DEFINE4(name, ...) SYSCALL_DEFINEx(4, _##name, __VA_ARGS__)
+#define SYSCALL_DEFINE5(name, ...) SYSCALL_DEFINEx(5, _##name, __VA_ARGS__)
+#define SYSCALL_DEFINE6(name, ...) SYSCALL_DEFINEx(6, _##name, __VA_ARGS__)
 
 #ifdef CONFIG_PPC64
 #define SYSCALL_ALIAS(alias, name)                                     \
@@ -121,21 +121,21 @@ struct old_linux_dirent;
 
 #define SYSCALL_DEFINE(name) static inline long SYSC_##name
 #define SYSCALL_DEFINEx(x, name, ...)                                  \
-       asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__));          \
-       static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__));      \
-       asmlinkage long SyS_##name(__SC_LONG##x(__VA_ARGS__))           \
+       asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__));           \
+       static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__));       \
+       asmlinkage long SyS##name(__SC_LONG##x(__VA_ARGS__))            \
        {                                                               \
                __SC_TEST##x(__VA_ARGS__);                              \
-               return (long) SYSC_##name(__SC_CAST##x(__VA_ARGS__));   \
+               return (long) SYSC##name(__SC_CAST##x(__VA_ARGS__));    \
        }                                                               \
-       SYSCALL_ALIAS(sys_##name, SyS_##name);                          \
-       static inline long SYSC_##name(__SC_DECL##x(__VA_ARGS__))
+       SYSCALL_ALIAS(sys##name, SyS##name);                            \
+       static inline long SYSC##name(__SC_DECL##x(__VA_ARGS__))
 
 #else /* CONFIG_HAVE_SYSCALL_WRAPPERS */
 
 #define SYSCALL_DEFINE(name) asmlinkage long sys_##name
 #define SYSCALL_DEFINEx(x, name, ...)                                  \
-       asmlinkage long sys_##name(__SC_DECL##x(__VA_ARGS__))
+       asmlinkage long sys##name(__SC_DECL##x(__VA_ARGS__))
 
 #endif /* CONFIG_HAVE_SYSCALL_WRAPPERS */
 
index 39d471d1163b4e8a54a95f56584f04e8a65a2d61..e76d3b22a46645b503283138b317ced96a0fbbef 100644 (file)
@@ -490,6 +490,7 @@ enum
        NET_IPV4_CONF_ARP_IGNORE=19,
        NET_IPV4_CONF_PROMOTE_SECONDARIES=20,
        NET_IPV4_CONF_ARP_ACCEPT=21,
+       NET_IPV4_CONF_ARP_NOTIFY=22,
        __NET_IPV4_CONF_MAX
 };
 
index fe77e1499ab7bc9aa3f302b8054d3ab7fcd3c4a6..0cd99e6baca5b4cb947672483ba4d128274358b5 100644 (file)
@@ -69,16 +69,16 @@ union tcp_word_hdr {
 #define tcp_flag_word(tp) ( ((union tcp_word_hdr *)(tp))->words [3]) 
 
 enum { 
-       TCP_FLAG_CWR = __constant_htonl(0x00800000), 
-       TCP_FLAG_ECE = __constant_htonl(0x00400000), 
-       TCP_FLAG_URG = __constant_htonl(0x00200000), 
-       TCP_FLAG_ACK = __constant_htonl(0x00100000), 
-       TCP_FLAG_PSH = __constant_htonl(0x00080000), 
-       TCP_FLAG_RST = __constant_htonl(0x00040000), 
-       TCP_FLAG_SYN = __constant_htonl(0x00020000), 
-       TCP_FLAG_FIN = __constant_htonl(0x00010000),
-       TCP_RESERVED_BITS = __constant_htonl(0x0F000000),
-       TCP_DATA_OFFSET = __constant_htonl(0xF0000000)
+       TCP_FLAG_CWR = __cpu_to_be32(0x00800000),
+       TCP_FLAG_ECE = __cpu_to_be32(0x00400000),
+       TCP_FLAG_URG = __cpu_to_be32(0x00200000),
+       TCP_FLAG_ACK = __cpu_to_be32(0x00100000),
+       TCP_FLAG_PSH = __cpu_to_be32(0x00080000),
+       TCP_FLAG_RST = __cpu_to_be32(0x00040000),
+       TCP_FLAG_SYN = __cpu_to_be32(0x00020000),
+       TCP_FLAG_FIN = __cpu_to_be32(0x00010000),
+       TCP_RESERVED_BITS = __cpu_to_be32(0x0F000000),
+       TCP_DATA_OFFSET = __cpu_to_be32(0xF0000000)
 }; 
 
 /* TCP socket options */
diff --git a/include/linux/timecompare.h b/include/linux/timecompare.h
new file mode 100644 (file)
index 0000000..546e223
--- /dev/null
@@ -0,0 +1,125 @@
+/*
+ * Utility code which helps transforming between two different time
+ * bases, called "source" and "target" time in this code.
+ *
+ * Source time has to be provided via the timecounter API while target
+ * time is accessed via a function callback whose prototype
+ * intentionally matches ktime_get() and ktime_get_real(). These
+ * interfaces where chosen like this so that the code serves its
+ * initial purpose without additional glue code.
+ *
+ * This purpose is synchronizing a hardware clock in a NIC with system
+ * time, in order to implement the Precision Time Protocol (PTP,
+ * IEEE1588) with more accurate hardware assisted time stamping.  In
+ * that context only synchronization against system time (=
+ * ktime_get_real()) is currently needed. But this utility code might
+ * become useful in other situations, which is why it was written as
+ * general purpose utility code.
+ *
+ * The source timecounter is assumed to return monotonically
+ * increasing time (but this code does its best to compensate if that
+ * is not the case) whereas target time may jump.
+ *
+ * The target time corresponding to a source time is determined by
+ * reading target time, reading source time, reading target time
+ * again, then assuming that average target time corresponds to source
+ * time. In other words, the assumption is that reading the source
+ * time is slow and involves equal time for sending the request and
+ * receiving the reply, whereas reading target time is assumed to be
+ * fast.
+ *
+ * Copyright (C) 2009 Intel Corporation.
+ * Author: Patrick Ohly <patrick.ohly@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef _LINUX_TIMECOMPARE_H
+#define _LINUX_TIMECOMPARE_H
+
+#include <linux/clocksource.h>
+#include <linux/ktime.h>
+
+/**
+ * struct timecompare - stores state and configuration for the two clocks
+ *
+ * Initialize to zero, then set source/target/num_samples.
+ *
+ * Transformation between source time and target time is done with:
+ * target_time = source_time + offset +
+ *               (source_time - last_update) * skew /
+ *               TIMECOMPARE_SKEW_RESOLUTION
+ *
+ * @source:          used to get source time stamps via timecounter_read()
+ * @target:          function returning target time (for example, ktime_get
+ *                   for monotonic time, or ktime_get_real for wall clock)
+ * @num_samples:     number of times that source time and target time are to
+ *                   be compared when determining their offset
+ * @offset:          (target time - source time) at the time of the last update
+ * @skew:            average (target time - source time) / delta source time *
+ *                   TIMECOMPARE_SKEW_RESOLUTION
+ * @last_update:     last source time stamp when time offset was measured
+ */
+struct timecompare {
+       struct timecounter *source;
+       ktime_t (*target)(void);
+       int num_samples;
+
+       s64 offset;
+       s64 skew;
+       u64 last_update;
+};
+
+/**
+ * timecompare_transform - transform source time stamp into target time base
+ * @sync:            context for time sync
+ * @source_tstamp:   the result of timecounter_read() or
+ *                   timecounter_cyc2time()
+ */
+extern ktime_t timecompare_transform(struct timecompare *sync,
+                                    u64 source_tstamp);
+
+/**
+ * timecompare_offset - measure current (target time - source time) offset
+ * @sync:            context for time sync
+ * @offset:          average offset during sample period returned here
+ * @source_tstamp:   average source time during sample period returned here
+ *
+ * Returns number of samples used. Might be zero (= no result) in the
+ * unlikely case that target time was monotonically decreasing for all
+ * samples (= broken).
+ */
+extern int timecompare_offset(struct timecompare *sync,
+                             s64 *offset,
+                             u64 *source_tstamp);
+
+extern void __timecompare_update(struct timecompare *sync,
+                                u64 source_tstamp);
+
+/**
+ * timecompare_update - update offset and skew by measuring current offset
+ * @sync:            context for time sync
+ * @source_tstamp:   the result of timecounter_read() or
+ *                   timecounter_cyc2time(), pass zero to force update
+ *
+ * Updates are only done at most once per second.
+ */
+static inline void timecompare_update(struct timecompare *sync,
+                                     u64 source_tstamp)
+{
+       if (!source_tstamp ||
+           (s64)(source_tstamp - sync->last_update) >= NSEC_PER_SEC)
+               __timecompare_update(sync, source_tstamp);
+}
+
+#endif /* _LINUX_TIMECOMPARE_H */
index 86cb0501d3e20428b749eb2156bf5abc301e1c20..2d0792983f8c2d7500b8e7a595b48b36ff6579f2 100644 (file)
 /* For O_CLOEXEC and O_NONBLOCK */
 #include <linux/fcntl.h>
 
-/* Flags for timerfd_settime.  */
+/*
+ * CAREFUL: Check include/asm-generic/fcntl.h when defining
+ * new flags, since they might collide with O_* ones. We want
+ * to re-use O_* flags that couldn't possibly have a meaning
+ * from eventfd, in order to leave a free define-space for
+ * shared O_* flags.
+ */
 #define TFD_TIMER_ABSTIME (1 << 0)
-
-/* Flags for timerfd_create.  */
 #define TFD_CLOEXEC O_CLOEXEC
 #define TFD_NONBLOCK O_NONBLOCK
 
+#define TFD_SHARED_FCNTL_FLAGS (TFD_CLOEXEC | TFD_NONBLOCK)
+/* Flags for timerfd_create.  */
+#define TFD_CREATE_FLAGS TFD_SHARED_FCNTL_FLAGS
+/* Flags for timerfd_settime.  */
+#define TFD_SETTIME_FLAGS TFD_TIMER_ABSTIME
 
 #endif /* _LINUX_TIMERFD_H */
-
index 0a6e6d4b929a94c902ff12707237b973372388b7..37836b937d9734024ae88dca7274f038173dfb3a 100644 (file)
@@ -49,48 +49,45 @@ struct rndis_msg_hdr {
  */
 #define        RNDIS_CONTROL_TIMEOUT_MS        (5 * 1000)
 
-
-#define ccpu2 __constant_cpu_to_le32
-
-#define RNDIS_MSG_COMPLETION   ccpu2(0x80000000)
+#define RNDIS_MSG_COMPLETION   cpu_to_le32(0x80000000)
 
 /* codes for "msg_type" field of rndis messages;
  * only the data channel uses packet messages (maybe batched);
  * everything else goes on the control channel.
  */
-#define RNDIS_MSG_PACKET       ccpu2(0x00000001)       /* 1-N packets */
-#define RNDIS_MSG_INIT         ccpu2(0x00000002)
+#define RNDIS_MSG_PACKET       cpu_to_le32(0x00000001) /* 1-N packets */
+#define RNDIS_MSG_INIT         cpu_to_le32(0x00000002)
 #define RNDIS_MSG_INIT_C       (RNDIS_MSG_INIT|RNDIS_MSG_COMPLETION)
-#define RNDIS_MSG_HALT         ccpu2(0x00000003)
-#define RNDIS_MSG_QUERY                ccpu2(0x00000004)
+#define RNDIS_MSG_HALT         cpu_to_le32(0x00000003)
+#define RNDIS_MSG_QUERY                cpu_to_le32(0x00000004)
 #define RNDIS_MSG_QUERY_C      (RNDIS_MSG_QUERY|RNDIS_MSG_COMPLETION)
-#define RNDIS_MSG_SET          ccpu2(0x00000005)
+#define RNDIS_MSG_SET          cpu_to_le32(0x00000005)
 #define RNDIS_MSG_SET_C                (RNDIS_MSG_SET|RNDIS_MSG_COMPLETION)
-#define RNDIS_MSG_RESET                ccpu2(0x00000006)
+#define RNDIS_MSG_RESET                cpu_to_le32(0x00000006)
 #define RNDIS_MSG_RESET_C      (RNDIS_MSG_RESET|RNDIS_MSG_COMPLETION)
-#define RNDIS_MSG_INDICATE     ccpu2(0x00000007)
-#define RNDIS_MSG_KEEPALIVE    ccpu2(0x00000008)
+#define RNDIS_MSG_INDICATE     cpu_to_le32(0x00000007)
+#define RNDIS_MSG_KEEPALIVE    cpu_to_le32(0x00000008)
 #define RNDIS_MSG_KEEPALIVE_C  (RNDIS_MSG_KEEPALIVE|RNDIS_MSG_COMPLETION)
 
 /* codes for "status" field of completion messages */
-#define        RNDIS_STATUS_SUCCESS            ccpu2(0x00000000)
-#define        RNDIS_STATUS_FAILURE            ccpu2(0xc0000001)
-#define        RNDIS_STATUS_INVALID_DATA       ccpu2(0xc0010015)
-#define        RNDIS_STATUS_NOT_SUPPORTED      ccpu2(0xc00000bb)
-#define        RNDIS_STATUS_MEDIA_CONNECT      ccpu2(0x4001000b)
-#define        RNDIS_STATUS_MEDIA_DISCONNECT   ccpu2(0x4001000c)
+#define        RNDIS_STATUS_SUCCESS            cpu_to_le32(0x00000000)
+#define        RNDIS_STATUS_FAILURE            cpu_to_le32(0xc0000001)
+#define        RNDIS_STATUS_INVALID_DATA       cpu_to_le32(0xc0010015)
+#define        RNDIS_STATUS_NOT_SUPPORTED      cpu_to_le32(0xc00000bb)
+#define        RNDIS_STATUS_MEDIA_CONNECT      cpu_to_le32(0x4001000b)
+#define        RNDIS_STATUS_MEDIA_DISCONNECT   cpu_to_le32(0x4001000c)
 
 /* codes for OID_GEN_PHYSICAL_MEDIUM */
-#define        RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED       ccpu2(0x00000000)
-#define        RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN      ccpu2(0x00000001)
-#define        RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM       ccpu2(0x00000002)
-#define        RNDIS_PHYSICAL_MEDIUM_PHONE_LINE        ccpu2(0x00000003)
-#define        RNDIS_PHYSICAL_MEDIUM_POWER_LINE        ccpu2(0x00000004)
-#define        RNDIS_PHYSICAL_MEDIUM_DSL               ccpu2(0x00000005)
-#define        RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL     ccpu2(0x00000006)
-#define        RNDIS_PHYSICAL_MEDIUM_1394              ccpu2(0x00000007)
-#define        RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN      ccpu2(0x00000008)
-#define        RNDIS_PHYSICAL_MEDIUM_MAX               ccpu2(0x00000009)
+#define        RNDIS_PHYSICAL_MEDIUM_UNSPECIFIED       cpu_to_le32(0x00000000)
+#define        RNDIS_PHYSICAL_MEDIUM_WIRELESS_LAN      cpu_to_le32(0x00000001)
+#define        RNDIS_PHYSICAL_MEDIUM_CABLE_MODEM       cpu_to_le32(0x00000002)
+#define        RNDIS_PHYSICAL_MEDIUM_PHONE_LINE        cpu_to_le32(0x00000003)
+#define        RNDIS_PHYSICAL_MEDIUM_POWER_LINE        cpu_to_le32(0x00000004)
+#define        RNDIS_PHYSICAL_MEDIUM_DSL               cpu_to_le32(0x00000005)
+#define        RNDIS_PHYSICAL_MEDIUM_FIBRE_CHANNEL     cpu_to_le32(0x00000006)
+#define        RNDIS_PHYSICAL_MEDIUM_1394              cpu_to_le32(0x00000007)
+#define        RNDIS_PHYSICAL_MEDIUM_WIRELESS_WAN      cpu_to_le32(0x00000008)
+#define        RNDIS_PHYSICAL_MEDIUM_MAX               cpu_to_le32(0x00000009)
 
 struct rndis_data_hdr {
        __le32  msg_type;               /* RNDIS_MSG_PACKET */
@@ -228,24 +225,24 @@ struct rndis_keepalive_c {        /* IN (optionally OUT) */
  * there are gobs more that may optionally be supported.  We'll avoid as much
  * of that mess as possible.
  */
-#define OID_802_3_PERMANENT_ADDRESS    ccpu2(0x01010101)
-#define OID_GEN_MAXIMUM_FRAME_SIZE     ccpu2(0x00010106)
-#define OID_GEN_CURRENT_PACKET_FILTER  ccpu2(0x0001010e)
-#define OID_GEN_PHYSICAL_MEDIUM                ccpu2(0x00010202)
+#define OID_802_3_PERMANENT_ADDRESS    cpu_to_le32(0x01010101)
+#define OID_GEN_MAXIMUM_FRAME_SIZE     cpu_to_le32(0x00010106)
+#define OID_GEN_CURRENT_PACKET_FILTER  cpu_to_le32(0x0001010e)
+#define OID_GEN_PHYSICAL_MEDIUM                cpu_to_le32(0x00010202)
 
 /* packet filter bits used by OID_GEN_CURRENT_PACKET_FILTER */
-#define RNDIS_PACKET_TYPE_DIRECTED             ccpu2(0x00000001)
-#define RNDIS_PACKET_TYPE_MULTICAST            ccpu2(0x00000002)
-#define RNDIS_PACKET_TYPE_ALL_MULTICAST                ccpu2(0x00000004)
-#define RNDIS_PACKET_TYPE_BROADCAST            ccpu2(0x00000008)
-#define RNDIS_PACKET_TYPE_SOURCE_ROUTING       ccpu2(0x00000010)
-#define RNDIS_PACKET_TYPE_PROMISCUOUS          ccpu2(0x00000020)
-#define RNDIS_PACKET_TYPE_SMT                  ccpu2(0x00000040)
-#define RNDIS_PACKET_TYPE_ALL_LOCAL            ccpu2(0x00000080)
-#define RNDIS_PACKET_TYPE_GROUP                        ccpu2(0x00001000)
-#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL       ccpu2(0x00002000)
-#define RNDIS_PACKET_TYPE_FUNCTIONAL           ccpu2(0x00004000)
-#define RNDIS_PACKET_TYPE_MAC_FRAME            ccpu2(0x00008000)
+#define RNDIS_PACKET_TYPE_DIRECTED             cpu_to_le32(0x00000001)
+#define RNDIS_PACKET_TYPE_MULTICAST            cpu_to_le32(0x00000002)
+#define RNDIS_PACKET_TYPE_ALL_MULTICAST                cpu_to_le32(0x00000004)
+#define RNDIS_PACKET_TYPE_BROADCAST            cpu_to_le32(0x00000008)
+#define RNDIS_PACKET_TYPE_SOURCE_ROUTING       cpu_to_le32(0x00000010)
+#define RNDIS_PACKET_TYPE_PROMISCUOUS          cpu_to_le32(0x00000020)
+#define RNDIS_PACKET_TYPE_SMT                  cpu_to_le32(0x00000040)
+#define RNDIS_PACKET_TYPE_ALL_LOCAL            cpu_to_le32(0x00000080)
+#define RNDIS_PACKET_TYPE_GROUP                        cpu_to_le32(0x00001000)
+#define RNDIS_PACKET_TYPE_ALL_FUNCTIONAL       cpu_to_le32(0x00002000)
+#define RNDIS_PACKET_TYPE_FUNCTIONAL           cpu_to_le32(0x00004000)
+#define RNDIS_PACKET_TYPE_MAC_FRAME            cpu_to_le32(0x00008000)
 
 /* default filter used with RNDIS devices */
 #define RNDIS_DEFAULT_FILTER ( \
index 3efa86c3ecb30ca4f7ce50d4319989373d4fbc2c..242348bb3766a69e45d0255575bf108a7eb4a744 100644 (file)
 #define VIRTIO_NET_F_HOST_ECN  13      /* Host can handle TSO[6] w/ ECN in. */
 #define VIRTIO_NET_F_HOST_UFO  14      /* Host can handle UFO in. */
 #define VIRTIO_NET_F_MRG_RXBUF 15      /* Host can merge receive buffers. */
+#define VIRTIO_NET_F_STATUS    16      /* virtio_net_config.status available */
+#define VIRTIO_NET_F_CTRL_VQ   17      /* Control channel available */
+#define VIRTIO_NET_F_CTRL_RX   18      /* Control channel RX mode support */
+#define VIRTIO_NET_F_CTRL_VLAN 19      /* Control channel VLAN filtering */
+
+#define VIRTIO_NET_S_LINK_UP   1       /* Link is up */
 
 struct virtio_net_config
 {
        /* The config defining mac address (if VIRTIO_NET_F_MAC) */
        __u8 mac[6];
+       /* See VIRTIO_NET_F_STATUS and VIRTIO_NET_S_* above */
+       __u16 status;
 } __attribute__((packed));
 
 /* This is the first element of the scatter-gather list.  If you don't
@@ -54,4 +62,67 @@ struct virtio_net_hdr_mrg_rxbuf {
        __u16 num_buffers;      /* Number of merged rx buffers */
 };
 
+/*
+ * Control virtqueue data structures
+ *
+ * The control virtqueue expects a header in the first sg entry
+ * and an ack/status response in the last entry.  Data for the
+ * command goes in between.
+ */
+struct virtio_net_ctrl_hdr {
+       __u8 class;
+       __u8 cmd;
+} __attribute__((packed));
+
+typedef __u8 virtio_net_ctrl_ack;
+
+#define VIRTIO_NET_OK     0
+#define VIRTIO_NET_ERR    1
+
+/*
+ * Control the RX mode, ie. promisucous and allmulti.  PROMISC and
+ * ALLMULTI commands require an "out" sg entry containing a 1 byte
+ * state value, zero = disable, non-zero = enable.  These commands
+ * are supported with the VIRTIO_NET_F_CTRL_RX feature.
+ */
+#define VIRTIO_NET_CTRL_RX    0
+ #define VIRTIO_NET_CTRL_RX_PROMISC      0
+ #define VIRTIO_NET_CTRL_RX_ALLMULTI     1
+
+/*
+ * Control the MAC filter table.
+ *
+ * The MAC filter table is managed by the hypervisor, the guest should
+ * assume the size is infinite.  Filtering should be considered
+ * non-perfect, ie. based on hypervisor resources, the guest may
+ * received packets from sources not specified in the filter list.
+ *
+ * In addition to the class/cmd header, the TABLE_SET command requires
+ * two out scatterlists.  Each contains a 4 byte count of entries followed
+ * by a concatenated byte stream of the ETH_ALEN MAC addresses.  The
+ * first sg list contains unicast addresses, the second is for multicast.
+ * This functionality is present if the VIRTIO_NET_F_CTRL_RX feature
+ * is available.
+ */
+struct virtio_net_ctrl_mac {
+       __u32 entries;
+       __u8 macs[][ETH_ALEN];
+} __attribute__((packed));
+
+#define VIRTIO_NET_CTRL_MAC    1
+ #define VIRTIO_NET_CTRL_MAC_TABLE_SET        0
+
+/*
+ * Control VLAN filtering
+ *
+ * The VLAN filter table is controlled via a simple ADD/DEL interface.
+ * VLAN IDs not added may be filterd by the hypervisor.  Del is the
+ * opposite of add.  Both commands expect an out entry containing a 2
+ * byte VLAN ID.  VLAN filterting is available with the
+ * VIRTIO_NET_F_CTRL_VLAN feature bit.
+ */
+#define VIRTIO_NET_CTRL_VLAN       2
+ #define VIRTIO_NET_CTRL_VLAN_ADD             0
+ #define VIRTIO_NET_CTRL_VLAN_DEL             1
+
 #endif /* _LINUX_VIRTIO_NET_H */
index 506e7620a986332cf5fda9e04d04050a88a49129..9c0890c7a06a357dd62e12cde059ca86764f8efa 100644 (file)
@@ -84,6 +84,10 @@ extern struct vm_struct *get_vm_area_caller(unsigned long size,
                                        unsigned long flags, void *caller);
 extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
                                        unsigned long start, unsigned long end);
+extern struct vm_struct *__get_vm_area_caller(unsigned long size,
+                                       unsigned long flags,
+                                       unsigned long start, unsigned long end,
+                                       void *caller);
 extern struct vm_struct *get_vm_area_node(unsigned long size,
                                          unsigned long flags, int node,
                                          gfp_t gfp_mask);
index ef609f842faca33c6e9dded2db7bbd09d7adc8d1..a210ede73b568d25bc672b44c8bd17986d326b7e 100644 (file)
@@ -132,6 +132,8 @@ static inline void __remove_wait_queue(wait_queue_head_t *head,
        list_del(&old->task_list);
 }
 
+void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
+                       int nr_exclusive, int sync, void *key);
 void __wake_up(wait_queue_head_t *q, unsigned int mode, int nr, void *key);
 extern void __wake_up_locked(wait_queue_head_t *q, unsigned int mode);
 extern void __wake_up_sync(wait_queue_head_t *q, unsigned int mode, int nr);
@@ -333,16 +335,19 @@ do {                                                                      \
        for (;;) {                                                      \
                prepare_to_wait_exclusive(&wq, &__wait,                 \
                                        TASK_INTERRUPTIBLE);            \
-               if (condition)                                          \
+               if (condition) {                                        \
+                       finish_wait(&wq, &__wait);                      \
                        break;                                          \
+               }                                                       \
                if (!signal_pending(current)) {                         \
                        schedule();                                     \
                        continue;                                       \
                }                                                       \
                ret = -ERESTARTSYS;                                     \
+               abort_exclusive_wait(&wq, &__wait,                      \
+                               TASK_INTERRUPTIBLE, NULL);              \
                break;                                                  \
        }                                                               \
-       finish_wait(&wq, &__wait);                                      \
 } while (0)
 
 #define wait_event_interruptible_exclusive(wq, condition)              \
@@ -431,6 +436,8 @@ extern long interruptible_sleep_on_timeout(wait_queue_head_t *q,
 void prepare_to_wait(wait_queue_head_t *q, wait_queue_t *wait, int state);
 void prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state);
 void finish_wait(wait_queue_head_t *q, wait_queue_t *wait);
+void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait,
+                       unsigned int mode, void *key);
 int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
 int wake_bit_function(wait_queue_t *wait, unsigned mode, int sync, void *key);
 
index d7958f9b52cba59e15dfb8a26e4ce5b04ea1309a..cb24204851f7e7118a25c8db99d60030c03b1c3a 100644 (file)
 #define IW_AUTH_RX_UNENCRYPTED_EAPOL   8
 #define IW_AUTH_ROAMING_CONTROL                9
 #define IW_AUTH_PRIVACY_INVOKED                10
+#define IW_AUTH_CIPHER_GROUP_MGMT      11
+#define IW_AUTH_MFP                    12
 
 /* IW_AUTH_WPA_VERSION values (bit field) */
 #define IW_AUTH_WPA_VERSION_DISABLED   0x00000001
 #define IW_AUTH_WPA_VERSION_WPA                0x00000002
 #define IW_AUTH_WPA_VERSION_WPA2       0x00000004
 
-/* IW_AUTH_PAIRWISE_CIPHER and IW_AUTH_GROUP_CIPHER values (bit field) */
+/* IW_AUTH_PAIRWISE_CIPHER, IW_AUTH_GROUP_CIPHER, and IW_AUTH_CIPHER_GROUP_MGMT
+ * values (bit field) */
 #define IW_AUTH_CIPHER_NONE    0x00000001
 #define IW_AUTH_CIPHER_WEP40   0x00000002
 #define IW_AUTH_CIPHER_TKIP    0x00000004
 #define IW_AUTH_CIPHER_CCMP    0x00000008
 #define IW_AUTH_CIPHER_WEP104  0x00000010
+#define IW_AUTH_CIPHER_AES_CMAC        0x00000020
 
 /* IW_AUTH_KEY_MGMT values (bit field) */
 #define IW_AUTH_KEY_MGMT_802_1X        1
 #define IW_AUTH_ROAMING_DISABLE        1       /* user space program used for roaming
                                         * control */
 
+/* IW_AUTH_MFP (management frame protection) values */
+#define IW_AUTH_MFP_DISABLED   0       /* MFP disabled */
+#define IW_AUTH_MFP_OPTIONAL   1       /* MFP optional */
+#define IW_AUTH_MFP_REQUIRED   2       /* MFP required */
+
 /* SIOCSIWENCODEEXT definitions */
 #define IW_ENCODE_SEQ_MAX_SIZE 8
 /* struct iw_encode_ext ->alg */
 #define IW_ENCODE_ALG_TKIP     2
 #define IW_ENCODE_ALG_CCMP     3
 #define IW_ENCODE_ALG_PMK      4
+#define IW_ENCODE_ALG_AES_CMAC 5
 /* struct iw_encode_ext ->ext_flags */
 #define IW_ENCODE_EXT_TX_SEQ_VALID     0x00000001
 #define IW_ENCODE_EXT_RX_SEQ_VALID     0x00000002
index b5a51a7bb36476ce7be0a4f3ed0130742e354276..467c531b8a7ef84cc2610eb78ebb137799135ec2 100644 (file)
@@ -50,7 +50,6 @@ struct atmarp_entry {
 struct clip_priv {
        int number;                     /* for convenience ... */
        spinlock_t xoff_lock;           /* ensures that pop is atomic (SMP) */
-       struct net_device_stats stats;
        struct net_device *next;        /* next CLIP interface */
 };
 
index 23c0ab74ded63bfbc9f57a36751872be3e195f77..c0d1f5b708c5836d3fcf0cc9ededd748bc9a6657 100644 (file)
@@ -4,6 +4,10 @@
 #include <linux/netlink.h>
 #include <linux/skbuff.h>
 #include <linux/nl80211.h>
+#include <linux/if_ether.h>
+#include <linux/ieee80211.h>
+#include <linux/wireless.h>
+#include <net/iw_handler.h>
 #include <net/genetlink.h>
 /* remove once we remove the wext stuff */
 #include <net/iw_handler.h>
@@ -112,12 +116,14 @@ struct beacon_parameters {
  * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
  *     with short preambles
  * @STATION_FLAG_WME: station is WME/QoS capable
+ * @STATION_FLAG_MFP: station uses management frame protection
  */
 enum station_flags {
        STATION_FLAG_CHANGED            = 1<<0,
        STATION_FLAG_AUTHORIZED         = 1<<NL80211_STA_FLAG_AUTHORIZED,
        STATION_FLAG_SHORT_PREAMBLE     = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
        STATION_FLAG_WME                = 1<<NL80211_STA_FLAG_WME,
+       STATION_FLAG_MFP                = 1<<NL80211_STA_FLAG_MFP,
 };
 
 /**
@@ -355,6 +361,51 @@ enum reg_set_by {
        REGDOM_SET_BY_COUNTRY_IE,
 };
 
+/**
+ * enum environment_cap - Environment parsed from country IE
+ * @ENVIRON_ANY: indicates country IE applies to both indoor and
+ *     outdoor operation.
+ * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
+ * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
+ */
+enum environment_cap {
+       ENVIRON_ANY,
+       ENVIRON_INDOOR,
+       ENVIRON_OUTDOOR,
+};
+
+/**
+ * struct regulatory_request - receipt of last regulatory request
+ *
+ * @wiphy: this is set if this request's initiator is
+ *     %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
+ *     can be used by the wireless core to deal with conflicts
+ *     and potentially inform users of which devices specifically
+ *     cased the conflicts.
+ * @initiator: indicates who sent this request, could be any of
+ *     of those set in reg_set_by, %REGDOM_SET_BY_*
+ * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
+ *     regulatory domain. We have a few special codes:
+ *     00 - World regulatory domain
+ *     99 - built by driver but a specific alpha2 cannot be determined
+ *     98 - result of an intersection between two regulatory domains
+ * @intersect: indicates whether the wireless core should intersect
+ *     the requested regulatory domain with the presently set regulatory
+ *     domain.
+ * @country_ie_checksum: checksum of the last processed and accepted
+ *     country IE
+ * @country_ie_env: lets us know if the AP is telling us we are outdoor,
+ *     indoor, or if it doesn't matter
+ */
+struct regulatory_request {
+       struct wiphy *wiphy;
+       enum reg_set_by initiator;
+       char alpha2[2];
+       bool intersect;
+       u32 country_ie_checksum;
+       enum environment_cap country_ie_env;
+};
+
 struct ieee80211_freq_range {
        u32 start_freq_khz;
        u32 end_freq_khz;
@@ -431,12 +482,111 @@ struct ieee80211_txq_params {
        u8 aifs;
 };
 
+/**
+ * struct mgmt_extra_ie_params - Extra management frame IE parameters
+ *
+ * Used to add extra IE(s) into management frames. If the driver cannot add the
+ * requested data into all management frames of the specified subtype that are
+ * generated in kernel or firmware/hardware, it must reject the configuration
+ * call. The IE data buffer is added to the end of the specified management
+ * frame body after all other IEs. This addition is not applied to frames that
+ * are injected through a monitor interface.
+ *
+ * @subtype: Management frame subtype
+ * @ies: IE data buffer or %NULL to remove previous data
+ * @ies_len: Length of @ies in octets
+ */
+struct mgmt_extra_ie_params {
+       u8 subtype;
+       u8 *ies;
+       int ies_len;
+};
+
 /* from net/wireless.h */
 struct wiphy;
 
 /* from net/ieee80211.h */
 struct ieee80211_channel;
 
+/**
+ * struct cfg80211_ssid - SSID description
+ * @ssid: the SSID
+ * @ssid_len: length of the ssid
+ */
+struct cfg80211_ssid {
+       u8 ssid[IEEE80211_MAX_SSID_LEN];
+       u8 ssid_len;
+};
+
+/**
+ * struct cfg80211_scan_request - scan request description
+ *
+ * @ssids: SSIDs to scan for (active scan only)
+ * @n_ssids: number of SSIDs
+ * @channels: channels to scan on.
+ * @n_channels: number of channels for each band
+ * @wiphy: the wiphy this was for
+ * @ifidx: the interface index
+ */
+struct cfg80211_scan_request {
+       struct cfg80211_ssid *ssids;
+       int n_ssids;
+       struct ieee80211_channel **channels;
+       u32 n_channels;
+
+       /* internal */
+       struct wiphy *wiphy;
+       int ifidx;
+};
+
+/**
+ * enum cfg80211_signal_type - signal type
+ *
+ * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
+ * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
+ * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
+ */
+enum cfg80211_signal_type {
+       CFG80211_SIGNAL_TYPE_NONE,
+       CFG80211_SIGNAL_TYPE_MBM,
+       CFG80211_SIGNAL_TYPE_UNSPEC,
+};
+
+/**
+ * struct cfg80211_bss - BSS description
+ *
+ * This structure describes a BSS (which may also be a mesh network)
+ * for use in scan results and similar.
+ *
+ * @bssid: BSSID of the BSS
+ * @tsf: timestamp of last received update
+ * @beacon_interval: the beacon interval as from the frame
+ * @capability: the capability field in host byte order
+ * @information_elements: the information elements (Note that there
+ *     is no guarantee that these are well-formed!)
+ * @len_information_elements: total length of the information elements
+ * @signal: signal strength value
+ * @signal_type: signal type
+ * @free_priv: function pointer to free private data
+ * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
+ */
+struct cfg80211_bss {
+       struct ieee80211_channel *channel;
+
+       u8 bssid[ETH_ALEN];
+       u64 tsf;
+       u16 beacon_interval;
+       u16 capability;
+       u8 *information_elements;
+       size_t len_information_elements;
+
+       s32 signal;
+       enum cfg80211_signal_type signal_type;
+
+       void (*free_priv)(struct cfg80211_bss *bss);
+       u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
+};
+
 /**
  * struct cfg80211_ops - backend description for wireless configuration
  *
@@ -450,6 +600,9 @@ struct ieee80211_channel;
  * wireless extensions but this is subject to reevaluation as soon as this
  * code is used more widely and we have a first user without wext.
  *
+ * @suspend: wiphy device needs to be suspended
+ * @resume: wiphy device needs to be resumed
+ *
  * @add_virtual_intf: create a new virtual interface with the given name,
  *     must set the struct wireless_dev's iftype.
  *
@@ -471,6 +624,8 @@ struct ieee80211_channel;
  *
  * @set_default_key: set the default key on an interface
  *
+ * @set_default_mgmt_key: set the default management frame key on an interface
+ *
  * @add_beacon: Add a beacon with given parameters, @head, @interval
  *     and @dtim_period will be valid, @tail is optional.
  * @set_beacon: Change the beacon parameters for an access point mode
@@ -497,8 +652,18 @@ struct ieee80211_channel;
  * @set_txq_params: Set TX queue parameters
  *
  * @set_channel: Set channel
+ *
+ * @set_mgmt_extra_ie: Set extra IE data for management frames
+ *
+ * @scan: Request to do a scan. If returning zero, the scan request is given
+ *     the driver, and will be valid until passed to cfg80211_scan_done().
+ *     For scan results, call cfg80211_inform_bss(); you can call this outside
+ *     the scan/scan_done bracket too.
  */
 struct cfg80211_ops {
+       int     (*suspend)(struct wiphy *wiphy);
+       int     (*resume)(struct wiphy *wiphy);
+
        int     (*add_virtual_intf)(struct wiphy *wiphy, char *name,
                                    enum nl80211_iftype type, u32 *flags,
                                    struct vif_params *params);
@@ -518,6 +683,9 @@ struct cfg80211_ops {
        int     (*set_default_key)(struct wiphy *wiphy,
                                   struct net_device *netdev,
                                   u8 key_index);
+       int     (*set_default_mgmt_key)(struct wiphy *wiphy,
+                                       struct net_device *netdev,
+                                       u8 key_index);
 
        int     (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
                              struct beacon_parameters *info);
@@ -564,6 +732,13 @@ struct cfg80211_ops {
        int     (*set_channel)(struct wiphy *wiphy,
                               struct ieee80211_channel *chan,
                               enum nl80211_channel_type channel_type);
+
+       int     (*set_mgmt_extra_ie)(struct wiphy *wiphy,
+                                    struct net_device *dev,
+                                    struct mgmt_extra_ie_params *params);
+
+       int     (*scan)(struct wiphy *wiphy, struct net_device *dev,
+                       struct cfg80211_scan_request *request);
 };
 
 /* temporary wext handlers */
@@ -574,5 +749,68 @@ int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
                          u32 *mode, char *extra);
 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
                          u32 *mode, char *extra);
+int cfg80211_wext_siwscan(struct net_device *dev,
+                         struct iw_request_info *info,
+                         union iwreq_data *wrqu, char *extra);
+int cfg80211_wext_giwscan(struct net_device *dev,
+                         struct iw_request_info *info,
+                         struct iw_point *data, char *extra);
+
+/**
+ * cfg80211_scan_done - notify that scan finished
+ *
+ * @request: the corresponding scan request
+ * @aborted: set to true if the scan was aborted for any reason,
+ *     userspace will be notified of that
+ */
+void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
+
+/**
+ * cfg80211_inform_bss - inform cfg80211 of a new BSS
+ *
+ * @wiphy: the wiphy reporting the BSS
+ * @bss: the found BSS
+ * @gfp: context flags
+ *
+ * This informs cfg80211 that BSS information was found and
+ * the BSS should be updated/added.
+ */
+struct cfg80211_bss*
+cfg80211_inform_bss_frame(struct wiphy *wiphy,
+                         struct ieee80211_channel *channel,
+                         struct ieee80211_mgmt *mgmt, size_t len,
+                         s32 signal, enum cfg80211_signal_type sigtype,
+                         gfp_t gfp);
+
+struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
+                                     struct ieee80211_channel *channel,
+                                     const u8 *bssid,
+                                     const u8 *ssid, size_t ssid_len,
+                                     u16 capa_mask, u16 capa_val);
+static inline struct cfg80211_bss *
+cfg80211_get_ibss(struct wiphy *wiphy,
+                 struct ieee80211_channel *channel,
+                 const u8 *ssid, size_t ssid_len)
+{
+       return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
+                               WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
+}
+
+struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
+                                      struct ieee80211_channel *channel,
+                                      const u8 *meshid, size_t meshidlen,
+                                      const u8 *meshcfg);
+void cfg80211_put_bss(struct cfg80211_bss *bss);
+/**
+ * cfg80211_unlink_bss - unlink BSS from internal data structures
+ * @wiphy: the wiphy
+ * @bss: the bss to remove
+ *
+ * This function removes the given BSS from the internal data structures
+ * thereby making it no longer show up in scan results etc. Use this
+ * function when you detect a BSS is gone. Normally BSSes will also time
+ * out, so it is not necessary to use this function at all.
+ */
+void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
 
 #endif /* __NET_CFG80211_H */
index 7040a782c656e34fd366eca2f6376e01e66303e7..9b5d08f4f6e8bb2459769463aceb19fbfd3da317 100644 (file)
@@ -113,12 +113,12 @@ static inline void ipv6_copy_dscp(unsigned int dscp, struct ipv6hdr *inner)
 static inline int INET_ECN_set_ce(struct sk_buff *skb)
 {
        switch (skb->protocol) {
-       case __constant_htons(ETH_P_IP):
+       case cpu_to_be16(ETH_P_IP):
                if (skb->network_header + sizeof(struct iphdr) <= skb->tail)
                        return IP_ECN_set_ce(ip_hdr(skb));
                break;
 
-       case __constant_htons(ETH_P_IPV6):
+       case cpu_to_be16(ETH_P_IPV6):
                if (skb->network_header + sizeof(struct ipv6hdr) <= skb->tail)
                        return IP6_ECN_set_ce(ipv6_hdr(skb));
                break;
index d0a043153cc6741de298c53f18773f05adc0b0ba..a44e2248b2ef108f1bff42062449bac760ec9899 100644 (file)
@@ -82,6 +82,7 @@ struct inet_bind_bucket {
 #endif
        unsigned short          port;
        signed short            fastreuse;
+       int                     num_owners;
        struct hlist_node       node;
        struct hlist_head       owners;
 };
@@ -133,7 +134,7 @@ struct inet_hashinfo {
        struct inet_bind_hashbucket     *bhash;
 
        unsigned int                    bhash_size;
-       /* Note : 4 bytes padding on 64 bit arches */
+       /* 4 bytes hole on 64 bit */
 
        struct kmem_cache               *bind_bucket_cachep;
 
@@ -150,6 +151,7 @@ struct inet_hashinfo {
        struct inet_listen_hashbucket   listening_hash[INET_LHTABLE_SIZE]
                                        ____cacheline_aligned_in_smp;
 
+       atomic_t                        bsockets;
 };
 
 static inline struct inet_ehash_bucket *inet_ehash_bucket(
index 10868139e656464dea5076e8b5672a9536b0ea01..4ac7577f98d0ba37808d3d4c52db8e0fc6c79592 100644 (file)
@@ -55,6 +55,7 @@ struct ipcm_cookie
        __be32                  addr;
        int                     oif;
        struct ip_options       *opt;
+       union skb_shared_tx     shtx;
 };
 
 #define IPCB(skb) ((struct inet_skb_parm*)((skb)->cb))
index ab9b003ab671b0755cb5467804adc16a89058a9c..bbae1e87efcd6fe5ffc583cce11f8fe5957a0109 100644 (file)
@@ -184,8 +184,8 @@ static inline const char *ip_vs_dbg_addr(int af, char *buf, size_t buf_len,
 /*
  *      The port number of FTP service (in network order).
  */
-#define FTPPORT  __constant_htons(21)
-#define FTPDATA  __constant_htons(20)
+#define FTPPORT  cpu_to_be16(21)
+#define FTPDATA  cpu_to_be16(20)
 
 /*
  *      TCP State Values
index 6d5b58a1c743cc5bfd587c26905bcbeb9d5966af..c1f16fc49adeff0e5f6a2c66bf79fbad7b2440c1 100644 (file)
@@ -196,8 +196,8 @@ struct ip6_flowlabel
        struct net              *fl_net;
 };
 
-#define IPV6_FLOWINFO_MASK     __constant_htonl(0x0FFFFFFF)
-#define IPV6_FLOWLABEL_MASK    __constant_htonl(0x000FFFFF)
+#define IPV6_FLOWINFO_MASK     cpu_to_be32(0x0FFFFFFF)
+#define IPV6_FLOWLABEL_MASK    cpu_to_be32(0x000FFFFF)
 
 struct ipv6_fl_socklist
 {
index 4cc0b4eca948b471159b29f1f6f7459d8989bd17..a14121dd19320365a54f9bb62ee88af23b00b11e 100644 (file)
@@ -27,7 +27,7 @@ struct ipx_address {
 
 struct ipxhdr {
        __be16                  ipx_checksum __attribute__ ((packed));
-#define IPX_NO_CHECKSUM        __constant_htons(0xFFFF)
+#define IPX_NO_CHECKSUM        cpu_to_be16(0xFFFF)
        __be16                  ipx_pktsize __attribute__ ((packed));
        __u8                    ipx_tctrl;
        __u8                    ipx_type;
index 559422fc0943837d35563677a25a35ecbe1b5a10..88fa3e03e3e9dbf4746f59851c27cfd9407fe7bf 100644 (file)
@@ -207,7 +207,7 @@ struct ieee80211_bss_conf {
        u16 beacon_int;
        u16 assoc_capability;
        u64 timestamp;
-       u64 basic_rates;
+       u32 basic_rates;
        struct ieee80211_bss_ht_conf ht;
 };
 
@@ -262,6 +262,26 @@ enum mac80211_tx_control_flags {
        IEEE80211_TX_CTL_RATE_CTRL_PROBE        = BIT(12),
 };
 
+/**
+ * enum mac80211_rate_control_flags - per-rate flags set by the
+ *     Rate Control algorithm.
+ *
+ * These flags are set by the Rate control algorithm for each rate during tx,
+ * in the @flags member of struct ieee80211_tx_rate.
+ *
+ * @IEEE80211_TX_RC_USE_RTS_CTS: Use RTS/CTS exchange for this rate.
+ * @IEEE80211_TX_RC_USE_CTS_PROTECT: CTS-to-self protection is required.
+ *     This is set if the current BSS requires ERP protection.
+ * @IEEE80211_TX_RC_USE_SHORT_PREAMBLE: Use short preamble.
+ * @IEEE80211_TX_RC_MCS: HT rate.
+ * @IEEE80211_TX_RC_GREEN_FIELD: Indicates whether this rate should be used in
+ *     Greenfield mode.
+ * @IEEE80211_TX_RC_40_MHZ_WIDTH: Indicates if the Channel Width should be 40 MHz.
+ * @IEEE80211_TX_RC_DUP_DATA: The frame should be transmitted on both of the
+ *     adjacent 20 MHz channels, if the current channel type is
+ *     NL80211_CHAN_HT40MINUS or NL80211_CHAN_HT40PLUS.
+ * @IEEE80211_TX_RC_SHORT_GI: Short Guard interval should be used for this rate.
+ */
 enum mac80211_rate_control_flags {
        IEEE80211_TX_RC_USE_RTS_CTS             = BIT(0),
        IEEE80211_TX_RC_USE_CTS_PROTECT         = BIT(1),
@@ -507,11 +527,6 @@ static inline int __deprecated __IEEE80211_CONF_SHORT_SLOT_TIME(void)
 }
 #define IEEE80211_CONF_SHORT_SLOT_TIME (__IEEE80211_CONF_SHORT_SLOT_TIME())
 
-struct ieee80211_ht_conf {
-       bool enabled;
-       enum nl80211_channel_type channel_type;
-};
-
 /**
  * enum ieee80211_conf_changed - denotes which configuration changed
  *
@@ -520,10 +535,10 @@ struct ieee80211_ht_conf {
  * @IEEE80211_CONF_CHANGE_LISTEN_INTERVAL: the listen interval changed
  * @IEEE80211_CONF_CHANGE_RADIOTAP: the radiotap flag changed
  * @IEEE80211_CONF_CHANGE_PS: the PS flag changed
+ * @IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT: the dynamic PS timeout changed
  * @IEEE80211_CONF_CHANGE_POWER: the TX power changed
- * @IEEE80211_CONF_CHANGE_CHANNEL: the channel changed
+ * @IEEE80211_CONF_CHANGE_CHANNEL: the channel/channel_type changed
  * @IEEE80211_CONF_CHANGE_RETRY_LIMITS: retry limits changed
- * @IEEE80211_CONF_CHANGE_HT: HT configuration changed
  */
 enum ieee80211_conf_changed {
        IEEE80211_CONF_CHANGE_RADIO_ENABLED     = BIT(0),
@@ -531,10 +546,10 @@ enum ieee80211_conf_changed {
        IEEE80211_CONF_CHANGE_LISTEN_INTERVAL   = BIT(2),
        IEEE80211_CONF_CHANGE_RADIOTAP          = BIT(3),
        IEEE80211_CONF_CHANGE_PS                = BIT(4),
-       IEEE80211_CONF_CHANGE_POWER             = BIT(5),
-       IEEE80211_CONF_CHANGE_CHANNEL           = BIT(6),
-       IEEE80211_CONF_CHANGE_RETRY_LIMITS      = BIT(7),
-       IEEE80211_CONF_CHANGE_HT                = BIT(8),
+       IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT     = BIT(5),
+       IEEE80211_CONF_CHANGE_POWER             = BIT(6),
+       IEEE80211_CONF_CHANGE_CHANNEL           = BIT(7),
+       IEEE80211_CONF_CHANGE_RETRY_LIMITS      = BIT(8),
 };
 
 /**
@@ -547,8 +562,9 @@ enum ieee80211_conf_changed {
  * @listen_interval: listen interval in units of beacon interval
  * @flags: configuration flags defined above
  * @power_level: requested transmit power (in dBm)
+ * @dynamic_ps_timeout: dynamic powersave timeout (in ms)
  * @channel: the channel to tune to
- * @ht: the HT configuration for the device
+ * @channel_type: the channel (HT) type
  * @long_frame_max_tx_count: Maximum number of transmissions for a "long" frame
  *    (a frame not RTS protected), called "dot11LongRetryLimit" in 802.11,
  *    but actually means the number of transmissions not the number of retries
@@ -559,7 +575,7 @@ enum ieee80211_conf_changed {
 struct ieee80211_conf {
        int beacon_int;
        u32 flags;
-       int power_level;
+       int power_level, dynamic_ps_timeout;
 
        u16 listen_interval;
        bool radio_enabled;
@@ -567,7 +583,7 @@ struct ieee80211_conf {
        u8 long_frame_max_tx_count, short_frame_max_tx_count;
 
        struct ieee80211_channel *channel;
-       struct ieee80211_ht_conf ht;
+       enum nl80211_channel_type channel_type;
 };
 
 /**
@@ -630,10 +646,12 @@ struct ieee80211_if_init_conf {
  * @IEEE80211_IFCC_BSSID: The BSSID changed.
  * @IEEE80211_IFCC_BEACON: The beacon for this interface changed
  *     (currently AP and MESH only), use ieee80211_beacon_get().
+ * @IEEE80211_IFCC_BEACON_ENABLED: The enable_beacon value changed.
  */
 enum ieee80211_if_conf_change {
-       IEEE80211_IFCC_BSSID    = BIT(0),
-       IEEE80211_IFCC_BEACON   = BIT(1),
+       IEEE80211_IFCC_BSSID            = BIT(0),
+       IEEE80211_IFCC_BEACON           = BIT(1),
+       IEEE80211_IFCC_BEACON_ENABLED   = BIT(2),
 };
 
 /**
@@ -641,13 +659,16 @@ enum ieee80211_if_conf_change {
  *
  * @changed: parameters that have changed, see &enum ieee80211_if_conf_change.
  * @bssid: BSSID of the network we are associated to/creating.
+ * @enable_beacon: Indicates whether beacons can be sent.
+ *     This is valid only for AP/IBSS/MESH modes.
  *
  * This structure is passed to the config_interface() callback of
  * &struct ieee80211_hw.
  */
 struct ieee80211_if_conf {
        u32 changed;
-       u8 *bssid;
+       const u8 *bssid;
+       bool enable_beacon;
 };
 
 /**
@@ -655,11 +676,13 @@ struct ieee80211_if_conf {
  * @ALG_WEP: WEP40 or WEP104
  * @ALG_TKIP: TKIP
  * @ALG_CCMP: CCMP (AES)
+ * @ALG_AES_CMAC: AES-128-CMAC
  */
 enum ieee80211_key_alg {
        ALG_WEP,
        ALG_TKIP,
        ALG_CCMP,
+       ALG_AES_CMAC,
 };
 
 /**
@@ -688,12 +711,16 @@ enum ieee80211_key_len {
  *     generation in software.
  * @IEEE80211_KEY_FLAG_PAIRWISE: Set by mac80211, this flag indicates
  *     that the key is pairwise rather then a shared key.
+ * @IEEE80211_KEY_FLAG_SW_MGMT: This flag should be set by the driver for a
+ *     CCMP key if it requires CCMP encryption of management frames (MFP) to
+ *     be done in software.
  */
 enum ieee80211_key_flags {
        IEEE80211_KEY_FLAG_WMM_STA      = 1<<0,
        IEEE80211_KEY_FLAG_GENERATE_IV  = 1<<1,
        IEEE80211_KEY_FLAG_GENERATE_MMIC= 1<<2,
        IEEE80211_KEY_FLAG_PAIRWISE     = 1<<3,
+       IEEE80211_KEY_FLAG_SW_MGMT      = 1<<4,
 };
 
 /**
@@ -714,8 +741,8 @@ enum ieee80211_key_flags {
  *     - Temporal Encryption Key (128 bits)
  *     - Temporal Authenticator Tx MIC Key (64 bits)
  *     - Temporal Authenticator Rx MIC Key (64 bits)
- * @icv_len: FIXME
- * @iv_len: FIXME
+ * @icv_len: The ICV length for this key type
+ * @iv_len: The IV length for this key type
  */
 struct ieee80211_key_conf {
        enum ieee80211_key_alg alg;
@@ -759,7 +786,7 @@ enum set_key_cmd {
  *     sizeof(void *), size is determined in hw information.
  */
 struct ieee80211_sta {
-       u64 supp_rates[IEEE80211_NUM_BANDS];
+       u32 supp_rates[IEEE80211_NUM_BANDS];
        u8 addr[ETH_ALEN];
        u16 aid;
        struct ieee80211_sta_ht_cap ht_cap;
@@ -833,11 +860,6 @@ enum ieee80211_tkip_key_type {
  *     expect values between 0 and @max_signal.
  *     If possible please provide dB or dBm instead.
  *
- * @IEEE80211_HW_SIGNAL_DB:
- *     Hardware gives signal values in dB, decibel difference from an
- *     arbitrary, fixed reference. We expect values between 0 and @max_signal.
- *     If possible please provide dBm instead.
- *
  * @IEEE80211_HW_SIGNAL_DBM:
  *     Hardware gives signal values in dBm, decibel difference from
  *     one milliwatt. This is the preferred method since it is standardized
@@ -854,10 +876,18 @@ enum ieee80211_tkip_key_type {
  * @IEEE80211_HW_AMPDU_AGGREGATION:
  *     Hardware supports 11n A-MPDU aggregation.
  *
- * @IEEE80211_HW_NO_STACK_DYNAMIC_PS:
- *     Hardware which has dynamic power save support, meaning
- *     that power save is enabled in idle periods, and don't need support
- *     from stack.
+ * @IEEE80211_HW_SUPPORTS_PS:
+ *     Hardware has power save support (i.e. can go to sleep).
+ *
+ * @IEEE80211_HW_PS_NULLFUNC_STACK:
+ *     Hardware requires nullfunc frame handling in stack, implies
+ *     stack support for dynamic PS.
+ *
+ * @IEEE80211_HW_SUPPORTS_DYNAMIC_PS:
+ *     Hardware has support for dynamic PS.
+ *
+ * @IEEE80211_HW_MFP_CAPABLE:
+ *     Hardware supports management frame protection (MFP, IEEE 802.11w).
  */
 enum ieee80211_hw_flags {
        IEEE80211_HW_RX_INCLUDES_FCS                    = 1<<1,
@@ -865,12 +895,14 @@ enum ieee80211_hw_flags {
        IEEE80211_HW_2GHZ_SHORT_SLOT_INCAPABLE          = 1<<3,
        IEEE80211_HW_2GHZ_SHORT_PREAMBLE_INCAPABLE      = 1<<4,
        IEEE80211_HW_SIGNAL_UNSPEC                      = 1<<5,
-       IEEE80211_HW_SIGNAL_DB                          = 1<<6,
-       IEEE80211_HW_SIGNAL_DBM                         = 1<<7,
-       IEEE80211_HW_NOISE_DBM                          = 1<<8,
-       IEEE80211_HW_SPECTRUM_MGMT                      = 1<<9,
-       IEEE80211_HW_AMPDU_AGGREGATION                  = 1<<10,
-       IEEE80211_HW_NO_STACK_DYNAMIC_PS                = 1<<11,
+       IEEE80211_HW_SIGNAL_DBM                         = 1<<6,
+       IEEE80211_HW_NOISE_DBM                          = 1<<7,
+       IEEE80211_HW_SPECTRUM_MGMT                      = 1<<8,
+       IEEE80211_HW_AMPDU_AGGREGATION                  = 1<<9,
+       IEEE80211_HW_SUPPORTS_PS                        = 1<<10,
+       IEEE80211_HW_PS_NULLFUNC_STACK                  = 1<<11,
+       IEEE80211_HW_SUPPORTS_DYNAMIC_PS                = 1<<12,
+       IEEE80211_HW_MFP_CAPABLE                        = 1<<13,
 };
 
 /**
@@ -890,9 +922,8 @@ enum ieee80211_hw_flags {
  * @workqueue: single threaded workqueue available for driver use,
  *     allocated by mac80211 on registration and flushed when an
  *     interface is removed.
- *     NOTICE: All work performed on this workqueue should NEVER
- *     acquire the RTNL lock (i.e. Don't use the function
- *     ieee80211_iterate_active_interfaces())
+ *     NOTICE: All work performed on this workqueue must not
+ *     acquire the RTNL lock.
  *
  * @priv: pointer to private area that was allocated for driver use
  *     along with this structure.
@@ -951,6 +982,19 @@ struct ieee80211_hw {
        u8 max_rate_tries;
 };
 
+/**
+ * wiphy_to_ieee80211_hw - return a mac80211 driver hw struct from a wiphy
+ *
+ * @wiphy: the &struct wiphy which we want to query
+ *
+ * mac80211 drivers can use this to get to their respective
+ * &struct ieee80211_hw. Drivers wishing to get to their own private
+ * structure can then access it via hw->priv. Note that mac802111 drivers should
+ * not use wiphy_priv() to try to get their private driver structure as this
+ * is already used internally by mac80211.
+ */
+struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy);
+
 /**
  * SET_IEEE80211_DEV - set device for 802.11 hardware
  *
@@ -1018,16 +1062,12 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
  *
  * The set_key() callback in the &struct ieee80211_ops for a given
  * device is called to enable hardware acceleration of encryption and
- * decryption. The callback takes an @address parameter that will be
- * the broadcast address for default keys, the other station's hardware
- * address for individual keys or the zero address for keys that will
- * be used only for transmission.
+ * decryption. The callback takes a @sta parameter that will be NULL
+ * for default keys or keys used for transmission only, or point to
+ * the station information for the peer for individual keys.
  * Multiple transmission keys with the same key index may be used when
  * VLANs are configured for an access point.
  *
- * The @local_address parameter will always be set to our own address,
- * this is only relevant if you support multiple local addresses.
- *
  * When transmitting, the TX control data will use the @hw_key_idx
  * selected by the driver by modifying the &struct ieee80211_key_conf
  * pointed to by the @key parameter to the set_key() function.
@@ -1060,6 +1100,42 @@ ieee80211_get_alt_retry_rate(const struct ieee80211_hw *hw,
  * handler is software decryption with wrap around of iv16.
  */
 
+/**
+ * DOC: Powersave support
+ *
+ * mac80211 has support for various powersave implementations.
+ *
+ * First, it can support hardware that handles all powersaving by
+ * itself, such hardware should simply set the %IEEE80211_HW_SUPPORTS_PS
+ * hardware flag. In that case, it will be told about the desired
+ * powersave mode depending on the association status, and the driver
+ * must take care of sending nullfunc frames when necessary, i.e. when
+ * entering and leaving powersave mode. The driver is required to look at
+ * the AID in beacons and signal to the AP that it woke up when it finds
+ * traffic directed to it. This mode supports dynamic PS by simply
+ * enabling/disabling PS.
+ *
+ * Additionally, such hardware may set the %IEEE80211_HW_SUPPORTS_DYNAMIC_PS
+ * flag to indicate that it can support dynamic PS mode itself (see below).
+ *
+ * Other hardware designs cannot send nullfunc frames by themselves and also
+ * need software support for parsing the TIM bitmap. This is also supported
+ * by mac80211 by combining the %IEEE80211_HW_SUPPORTS_PS and
+ * %IEEE80211_HW_PS_NULLFUNC_STACK flags. The hardware is of course still
+ * required to pass up beacons. Additionally, in this case, mac80211 will
+ * wake up the hardware when multicast traffic is announced in the beacon.
+ *
+ * FIXME: I don't think we can be fast enough in software when we want to
+ *       receive multicast traffic?
+ *
+ * Dynamic powersave mode is an extension to normal powersave mode in which
+ * the hardware stays awake for a user-specified period of time after sending
+ * a frame so that reply frames need not be buffered and therefore delayed
+ * to the next wakeup. This can either be supported by hardware, in which case
+ * the driver needs to look at the @dynamic_ps_timeout hardware configuration
+ * value, or by the stack if all nullfunc handling is in the stack.
+ */
+
 /**
  * DOC: Frame filtering
  *
@@ -1172,6 +1248,8 @@ enum ieee80211_ampdu_mlme_action {
  *     configuration in the TX control data. This handler should,
  *     preferably, never fail and stop queues appropriately, more
  *     importantly, however, it must never fail for A-MPDU-queues.
+ *     This function should return NETDEV_TX_OK except in very
+ *     limited cases.
  *     Must be implemented and atomic.
  *
  * @start: Called before the first netdevice attached to the hardware
@@ -1212,9 +1290,12 @@ enum ieee80211_ampdu_mlme_action {
  *
  * @config: Handler for configuration requests. IEEE 802.11 code calls this
  *     function to change hardware configuration, e.g., channel.
+ *     This function should never fail but returns a negative error code
+ *     if it does.
  *
  * @config_interface: Handler for configuration requests related to interfaces
  *     (e.g. BSSID changes.)
+ *     Returns a negative error code which will be seen in userspace.
  *
  * @bss_info_changed: Handler for configuration requests related to BSS
  *     parameters that may vary during BSS's lifespan, and may affect low
@@ -1232,8 +1313,9 @@ enum ieee80211_ampdu_mlme_action {
  *
  * @set_key: See the section "Hardware crypto acceleration"
  *     This callback can sleep, and is only called between add_interface
- *     and remove_interface calls, i.e. while the interface with the
- *     given local_address is enabled.
+ *     and remove_interface calls, i.e. while the given virtual interface
+ *     is enabled.
+ *     Returns a negative error code if the key can't be added.
  *
  * @update_tkip_key: See the section "Hardware crypto acceleration"
  *     This callback will be called in the context of Rx. Called for drivers
@@ -1245,8 +1327,10 @@ enum ieee80211_ampdu_mlme_action {
  *     bands. When the scan finishes, ieee80211_scan_completed() must be
  *     called; note that it also must be called when the scan cannot finish
  *     because the hardware is turned off! Anything else is a bug!
+ *     Returns a negative error code which will be seen in userspace.
  *
- * @get_stats: return low-level statistics
+ * @get_stats: Return low-level statistics.
+ *     Returns zero if statistics are available.
  *
  * @get_tkip_seq: If your device implements TKIP encryption in hardware this
  *     callback should be provided to read the TKIP transmit IVs (both IV32
@@ -1260,6 +1344,7 @@ enum ieee80211_ampdu_mlme_action {
  *
  * @conf_tx: Configure TX queue parameters (EDCF (aifs, cw_min, cw_max),
  *     bursting) for a hardware TX queue.
+ *     Returns a negative error code on failure.
  *
  * @get_tx_stats: Get statistics of the current TX queue status. This is used
  *     to get number of currently queued packets (queue length), maximum queue
@@ -1268,8 +1353,12 @@ enum ieee80211_ampdu_mlme_action {
  *     hw->ampdu_queues items.
  *
  * @get_tsf: Get the current TSF timer value from firmware/hardware. Currently,
- *     this is only used for IBSS mode debugging and, as such, is not a
- *     required function. Must be atomic.
+ *     this is only used for IBSS mode BSSID merging and debugging. Is not a
+ *     required function.
+ *
+ * @set_tsf: Set the TSF timer to the specified value in the firmware/hardware.
+ *      Currently, this is only used for IBSS mode debugging. Is not a
+ *     required function.
  *
  * @reset_tsf: Reset the TSF timer and allow firmware/hardware to synchronize
  *     with other STAs in the IBSS. This is only used in IBSS mode. This
@@ -1279,13 +1368,15 @@ enum ieee80211_ampdu_mlme_action {
  * @tx_last_beacon: Determine whether the last IBSS beacon was sent by us.
  *     This is needed only for IBSS mode and the result of this function is
  *     used to determine whether to reply to Probe Requests.
+ *     Returns non-zero if this device sent the last beacon.
  *
  * @ampdu_action: Perform a certain A-MPDU action
  *     The RA/TID combination determines the destination and TID we want
  *     the ampdu action to be performed for. The action is defined through
  *     ieee80211_ampdu_mlme_action. Starting sequence number (@ssn)
- *     is the first frame we expect to perform the action on. notice
+ *     is the first frame we expect to perform the action on. Notice
  *     that TX/RX_STOP can pass NULL for this parameter.
+ *     Returns a negative error code on failure.
  */
 struct ieee80211_ops {
        int (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1310,12 +1401,13 @@ struct ieee80211_ops {
        int (*set_tim)(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
                       bool set);
        int (*set_key)(struct ieee80211_hw *hw, enum set_key_cmd cmd,
-                      const u8 *local_address, const u8 *address,
+                      struct ieee80211_vif *vif, struct ieee80211_sta *sta,
                       struct ieee80211_key_conf *key);
        void (*update_tkip_key)(struct ieee80211_hw *hw,
                        struct ieee80211_key_conf *conf, const u8 *address,
                        u32 iv32, u16 *phase1key);
-       int (*hw_scan)(struct ieee80211_hw *hw, u8 *ssid, size_t len);
+       int (*hw_scan)(struct ieee80211_hw *hw,
+                      struct cfg80211_scan_request *req);
        int (*get_stats)(struct ieee80211_hw *hw,
                         struct ieee80211_low_level_stats *stats);
        void (*get_tkip_seq)(struct ieee80211_hw *hw, u8 hw_key_idx,
@@ -1328,6 +1420,7 @@ struct ieee80211_ops {
        int (*get_tx_stats)(struct ieee80211_hw *hw,
                            struct ieee80211_tx_queue_stats *stats);
        u64 (*get_tsf)(struct ieee80211_hw *hw);
+       void (*set_tsf)(struct ieee80211_hw *hw, u64 tsf);
        void (*reset_tsf)(struct ieee80211_hw *hw);
        int (*tx_last_beacon)(struct ieee80211_hw *hw);
        int (*ampdu_action)(struct ieee80211_hw *hw,
@@ -1752,8 +1845,9 @@ void ieee80211_wake_queues(struct ieee80211_hw *hw);
  * mac80211 that the scan finished.
  *
  * @hw: the hardware that finished the scan
+ * @aborted: set to true if scan was aborted
  */
-void ieee80211_scan_completed(struct ieee80211_hw *hw);
+void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted);
 
 /**
  * ieee80211_iterate_active_interfaces - iterate active interfaces
@@ -1962,4 +2056,34 @@ rate_lowest_index(struct ieee80211_supported_band *sband,
 int ieee80211_rate_control_register(struct rate_control_ops *ops);
 void ieee80211_rate_control_unregister(struct rate_control_ops *ops);
 
+static inline bool
+conf_is_ht20(struct ieee80211_conf *conf)
+{
+       return conf->channel_type == NL80211_CHAN_HT20;
+}
+
+static inline bool
+conf_is_ht40_minus(struct ieee80211_conf *conf)
+{
+       return conf->channel_type == NL80211_CHAN_HT40MINUS;
+}
+
+static inline bool
+conf_is_ht40_plus(struct ieee80211_conf *conf)
+{
+       return conf->channel_type == NL80211_CHAN_HT40PLUS;
+}
+
+static inline bool
+conf_is_ht40(struct ieee80211_conf *conf)
+{
+       return conf_is_ht40_minus(conf) || conf_is_ht40_plus(conf);
+}
+
+static inline bool
+conf_is_ht(struct ieee80211_conf *conf)
+{
+       return conf->channel_type != NL80211_CHAN_NO_HT;
+}
+
 #endif /* MAC80211_H */
index 6fc13d905c5ffaced2e1658038ab97934d61f42d..ded434b032a44ec406a0fa8bcb11d688d95b7efa 100644 (file)
@@ -109,11 +109,6 @@ extern struct list_head net_namespace_list;
 #ifdef CONFIG_NET_NS
 extern void __put_net(struct net *net);
 
-static inline int net_alive(struct net *net)
-{
-       return net && atomic_read(&net->count);
-}
-
 static inline struct net *get_net(struct net *net)
 {
        atomic_inc(&net->count);
@@ -145,11 +140,6 @@ int net_eq(const struct net *net1, const struct net *net2)
 }
 #else
 
-static inline int net_alive(struct net *net)
-{
-       return 1;
-}
-
 static inline struct net *get_net(struct net *net)
 {
        return net;
@@ -234,6 +224,23 @@ struct pernet_operations {
        void (*exit)(struct net *net);
 };
 
+/*
+ * Use these carefully.  If you implement a network device and it
+ * needs per network namespace operations use device pernet operations,
+ * otherwise use pernet subsys operations.
+ *
+ * This is critically important.  Most of the network code cleanup
+ * runs with the assumption that dev_remove_pack has been called so no
+ * new packets will arrive during and after the cleanup functions have
+ * been called.  dev_remove_pack is not per namespace so instead the
+ * guarantee of no more packets arriving in a network namespace is
+ * provided by ensuring that all network devices and all sockets have
+ * left the network namespace before the cleanup methods are called.
+ *
+ * For the longest time the ipv4 icmp code was registered as a pernet
+ * device which caused kernel oops, and panics during network
+ * namespace cleanup.   So please don't get this wrong.
+ */
 extern int register_pernet_subsys(struct pernet_operations *);
 extern void unregister_pernet_subsys(struct pernet_operations *);
 extern int register_pernet_gen_subsys(int *id, struct pernet_operations *);
index 977f482d97a95144f0f777df1b0bbbacb7f1b11e..2eb3814d6258e8d0f9da0be8c81560b20af5b9cf 100644 (file)
@@ -54,5 +54,18 @@ struct netns_ipv4 {
 
        struct timer_list rt_secret_timer;
        atomic_t rt_genid;
+
+#ifdef CONFIG_IP_MROUTE
+       struct sock             *mroute_sk;
+       struct mfc_cache        **mfc_cache_array;
+       struct vif_device       *vif_table;
+       int                     maxvif;
+       atomic_t                cache_resolve_queue_len;
+       int                     mroute_do_assert;
+       int                     mroute_do_pim;
+#if defined(CONFIG_IP_PIMSM_V1) || defined(CONFIG_IP_PIMSM_V2)
+       int                     mroute_reg_vif_num;
+#endif
+#endif
 };
 #endif
index f06852bba62afb8a1cd42d1c3af51ee7efcc6c49..15696b1fd30fbe85c248ad95fba4a4e7db4f4454 100644 (file)
@@ -59,10 +59,6 @@ enum {
 #define NR_MAX_WINDOW_SIZE             127                     /* Maximum Window Allowable - 127 */
 #define        NR_MAX_PACKET_SIZE              236                     /* Maximum Packet Length - 236 */
 
-struct nr_private {
-       struct net_device_stats stats;
-};
-
 struct nr_sock {
        struct sock             sock;
        ax25_address            user_addr, source_addr, dest_addr;
index 057b0a8a28859f519a6fc85694de0ee69913b8bf..d43f71b5ec004218f5eb969d15b8bd82ce143f9c 100644 (file)
@@ -105,7 +105,6 @@ void phonet_proto_unregister(int protocol, struct phonet_protocol *pp);
 
 int phonet_sysctl_init(void);
 void phonet_sysctl_exit(void);
-void phonet_netlink_register(void);
 int isi_register(void);
 void isi_unregister(void);
 
index aa1c59a1d33f6f5245b330b6e0f3e9fe9988420b..5054dc5ea2c260439277a6c252f51df68cd72a39 100644 (file)
@@ -28,7 +28,7 @@ struct phonet_device_list {
        spinlock_t lock;
 };
 
-extern struct phonet_device_list pndevs;
+struct phonet_device_list *phonet_device_list(struct net *net);
 
 struct phonet_device {
        struct list_head list;
@@ -36,8 +36,9 @@ struct phonet_device {
        DECLARE_BITMAP(addrs, 64);
 };
 
-void phonet_device_init(void);
+int phonet_device_init(void);
 void phonet_device_exit(void);
+int phonet_netlink_register(void);
 struct net_device *phonet_device_get(struct net *net);
 
 int phonet_address_add(struct net_device *dev, u8 addr);
index 4082f39f507916c5002d7677831da8aff0e9013f..e37fe3129c17ddbf192de69ed3984f2ee5fbc93b 100644 (file)
@@ -85,6 +85,7 @@ extern struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r,
                struct nlattr *tab);
 extern void qdisc_put_rtab(struct qdisc_rate_table *tab);
 extern void qdisc_put_stab(struct qdisc_size_table *tab);
+extern void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc);
 
 extern void __qdisc_run(struct Qdisc *q);
 
index f8c47429044aee1db7ddf54a14e405305be51b0a..3d78a4d224601f5003aef260f4363bc88707d3be 100644 (file)
@@ -42,9 +42,10 @@ struct Qdisc
        int                     (*enqueue)(struct sk_buff *skb, struct Qdisc *dev);
        struct sk_buff *        (*dequeue)(struct Qdisc *dev);
        unsigned                flags;
-#define TCQ_F_BUILTIN  1
-#define TCQ_F_THROTTLED        2
-#define TCQ_F_INGRESS  4
+#define TCQ_F_BUILTIN          1
+#define TCQ_F_THROTTLED                2
+#define TCQ_F_INGRESS          4
+#define TCQ_F_WARN_NONWC       (1 << 16)
        int                     padded;
        struct Qdisc_ops        *ops;
        struct qdisc_size_table *stab;
index 2fec3c366e81cb18a0d10da0f2d506ea44008e9b..befc8d2a1b9f2703b5f31eabfe7c313ae0b05bcd 100644 (file)
 #include <net/sctp/sctp.h>
 #include <linux/crc32c.h>
 
-static inline __be32 sctp_crc32c(__be32 crc, u8 *buffer, u16 length)
+static inline __u32 sctp_crc32c(__u32 crc, u8 *buffer, u16 length)
 {
-       return (__force __be32)crc32c((__force u32)crc, buffer, length);
+       return crc32c(crc, buffer, length);
 }
 
-static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length)
+static inline __u32 sctp_start_cksum(__u8 *buffer, __u16 length)
 {
-       __be32 crc = ~cpu_to_be32(0);
+       __u32 crc = ~(__u32)0;
        __u8  zero[sizeof(__u32)] = {0};
 
        /* Optimize this routine to be SCTP specific, knowing how
@@ -72,12 +72,12 @@ static inline __be32 sctp_start_cksum(__u8 *buffer, __u16 length)
        return crc;
 }
 
-static inline __be32 sctp_update_cksum(__u8 *buffer, __u16 length, __be32 crc32)
+static inline __u32 sctp_update_cksum(__u8 *buffer, __u16 length, __u32 crc32)
 {
        return sctp_crc32c(crc32, buffer, length);
 }
 
-static inline __be32 sctp_end_cksum(__be32 crc32)
+static inline __le32 sctp_end_cksum(__be32 crc32)
 {
-       return (__force __be32)~cpu_to_le32((__force u32)crc32);
+       return cpu_to_le32(~crc32);
 }
index bbb7742195b0df31e4498b19e909e7a97a7b47e7..9e226be3be69d45c25a2cc83a86033645ff537c4 100644 (file)
@@ -138,6 +138,8 @@ void sctp_write_space(struct sock *sk);
 unsigned int sctp_poll(struct file *file, struct socket *sock,
                poll_table *wait);
 void sctp_sock_rfree(struct sk_buff *skb);
+void sctp_copy_sock(struct sock *newsk, struct sock *sk,
+                   struct sctp_association *asoc);
 extern struct percpu_counter sctp_sockets_allocated;
 
 /*
index 9661d7b765f08cc09295273b7e92edba74a32e4a..23f08fe1d50ae29980f7b192fbcf6943ea1c73d6 100644 (file)
@@ -218,6 +218,10 @@ extern struct sctp_globals {
 
        /* Flag to idicate if SCTP-AUTH is enabled */
        int auth_enable;
+
+       /* Flag to indicate whether computing and verifying checksum
+        * is disabled. */
+        int checksum_disable;
 } sctp_globals;
 
 #define sctp_rto_initial               (sctp_globals.rto_initial)
@@ -252,6 +256,7 @@ extern struct sctp_globals {
 #define sctp_addip_noauth              (sctp_globals.addip_noauth_enable)
 #define sctp_prsctp_enable             (sctp_globals.prsctp_enable)
 #define sctp_auth_enable               (sctp_globals.auth_enable)
+#define sctp_checksum_disable          (sctp_globals.checksum_disable)
 
 /* SCTP Socket type: UDP or TCP style. */
 typedef enum {
@@ -905,8 +910,10 @@ struct sctp_transport {
         *              should be set. Every time the RTT
         *              calculation completes (i.e. the DATA chunk
         *              is SACK'd) clear this flag.
+        * hb_sent : a flag that signals that we have a pending heartbeat.
         */
        __u8 rto_pending;
+       __u8 hb_sent;
 
        /* Flag to track the current fast recovery state */
        __u8 fast_recovery;
index eefeeaf7fc467123b6766da9ff8543b215a87f37..4bb1ff9fd15bcc2b1bbc24c3cbd853fcd796da5c 100644 (file)
@@ -158,7 +158,7 @@ struct sock_common {
   *    @sk_allocation: allocation mode
   *    @sk_sndbuf: size of send buffer in bytes
   *    @sk_flags: %SO_LINGER (l_onoff), %SO_BROADCAST, %SO_KEEPALIVE,
-  *               %SO_OOBINLINE settings
+  *               %SO_OOBINLINE settings, %SO_TIMESTAMPING settings
   *    @sk_no_check: %SO_NO_CHECK setting, wether or not checkup packets
   *    @sk_route_caps: route capabilities (e.g. %NETIF_F_TSO)
   *    @sk_gso_type: GSO type (e.g. %SKB_GSO_TCPV4)
@@ -488,6 +488,13 @@ enum sock_flags {
        SOCK_RCVTSTAMPNS, /* %SO_TIMESTAMPNS setting */
        SOCK_LOCALROUTE, /* route locally only, %SO_DONTROUTE setting */
        SOCK_QUEUE_SHRUNK, /* write queue has been shrunk recently */
+       SOCK_TIMESTAMPING_TX_HARDWARE,  /* %SOF_TIMESTAMPING_TX_HARDWARE */
+       SOCK_TIMESTAMPING_TX_SOFTWARE,  /* %SOF_TIMESTAMPING_TX_SOFTWARE */
+       SOCK_TIMESTAMPING_RX_HARDWARE,  /* %SOF_TIMESTAMPING_RX_HARDWARE */
+       SOCK_TIMESTAMPING_RX_SOFTWARE,  /* %SOF_TIMESTAMPING_RX_SOFTWARE */
+       SOCK_TIMESTAMPING_SOFTWARE,     /* %SOF_TIMESTAMPING_SOFTWARE */
+       SOCK_TIMESTAMPING_RAW_HARDWARE, /* %SOF_TIMESTAMPING_RAW_HARDWARE */
+       SOCK_TIMESTAMPING_SYS_HARDWARE, /* %SOF_TIMESTAMPING_SYS_HARDWARE */
 };
 
 static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
@@ -944,6 +951,11 @@ extern struct sk_buff              *sock_alloc_send_skb(struct sock *sk,
                                                     unsigned long size,
                                                     int noblock,
                                                     int *errcode);
+extern struct sk_buff          *sock_alloc_send_pskb(struct sock *sk,
+                                                     unsigned long header_len,
+                                                     unsigned long data_len,
+                                                     int noblock,
+                                                     int *errcode);
 extern void *sock_kmalloc(struct sock *sk, int size,
                          gfp_t priority);
 extern void sock_kfree_s(struct sock *sk, void *mem, int size);
@@ -1340,13 +1352,44 @@ static __inline__ void
 sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
 {
        ktime_t kt = skb->tstamp;
+       struct skb_shared_hwtstamps *hwtstamps = skb_hwtstamps(skb);
 
-       if (sock_flag(sk, SOCK_RCVTSTAMP))
+       /*
+        * generate control messages if
+        * - receive time stamping in software requested (SOCK_RCVTSTAMP
+        *   or SOCK_TIMESTAMPING_RX_SOFTWARE)
+        * - software time stamp available and wanted
+        *   (SOCK_TIMESTAMPING_SOFTWARE)
+        * - hardware time stamps available and wanted
+        *   (SOCK_TIMESTAMPING_SYS_HARDWARE or
+        *   SOCK_TIMESTAMPING_RAW_HARDWARE)
+        */
+       if (sock_flag(sk, SOCK_RCVTSTAMP) ||
+           sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE) ||
+           (kt.tv64 && sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) ||
+           (hwtstamps->hwtstamp.tv64 &&
+            sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE)) ||
+           (hwtstamps->syststamp.tv64 &&
+            sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE)))
                __sock_recv_timestamp(msg, sk, skb);
        else
                sk->sk_stamp = kt;
 }
 
+/**
+ * sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
+ * @msg:       outgoing packet
+ * @sk:                socket sending this packet
+ * @shtx:      filled with instructions for time stamping
+ *
+ * Currently only depends on SOCK_TIMESTAMPING* flags. Returns error code if
+ * parameters are invalid.
+ */
+extern int sock_tx_timestamp(struct msghdr *msg,
+                            struct sock *sk,
+                            union skb_shared_tx *shtx);
+
+
 /**
  * sk_eat_skb - Release a skb if it is no longer needed
  * @sk: socket to eat this skb from
@@ -1415,7 +1458,7 @@ static inline struct sock *skb_steal_sock(struct sk_buff *skb)
        return NULL;
 }
 
-extern void sock_enable_timestamp(struct sock *sk);
+extern void sock_enable_timestamp(struct sock *sk, int flag);
 extern int sock_get_timestamp(struct sock *, struct timeval __user *);
 extern int sock_get_timestampns(struct sock *, struct timespec __user *);
 
index 876b6f2bb4fd7a28a641ff038d0eaf3765355ff1..bfb240c6cf795cb10a1c438db0fcec750c0da046 100644 (file)
@@ -46,7 +46,7 @@ extern int                    datagram_send_ctl(struct net *net,
                                                  struct ipv6_txoptions *opt,
                                                  int *hlimit, int *tclass);
 
-#define                LOOPBACK4_IPV6          __constant_htonl(0x7f000006)
+#define                LOOPBACK4_IPV6          cpu_to_be32(0x7f000006)
 
 /*
  *     address family specific functions
index 21c5d966142d9cc3b5964364c482068a03f25c0b..1c6285eb166668dbf267d7c79d3d9d8be7307133 100644 (file)
@@ -181,12 +181,25 @@ struct ieee80211_supported_band {
  * struct wiphy - wireless hardware description
  * @idx: the wiphy index assigned to this item
  * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
- * @fw_handles_regulatory: tells us the firmware for this device
- *     has its own regulatory solution and cannot identify the
+ * @custom_regulatory: tells us the driver for this device
+ *     has its own custom regulatory domain and cannot identify the
  *     ISO / IEC 3166 alpha2 it belongs to. When this is enabled
  *     we will disregard the first regulatory hint (when the
  *     initiator is %REGDOM_SET_BY_CORE).
+ * @strict_regulatory: tells us the driver for this device will ignore
+ *     regulatory domain settings until it gets its own regulatory domain
+ *     via its regulatory_hint(). After its gets its own regulatory domain
+ *     it will only allow further regulatory domain settings to further
+ *     enhance compliance. For example if channel 13 and 14 are disabled
+ *     by this regulatory domain no user regulatory domain can enable these
+ *     channels at a later time. This can be used for devices which do not
+ *     have calibration information gauranteed for frequencies or settings
+ *     outside of its regulatory domain.
  * @reg_notifier: the driver's regulatory notification callback
+ * @regd: the driver's regulatory domain, if one was requested via
+ *     the regulatory_hint() API. This can be used by the driver
+ *     on the reg_notifier() if it chooses to ignore future
+ *     regulatory domain changes caused by other drivers.
  */
 struct wiphy {
        /* assign these fields before you register the wiphy */
@@ -197,7 +210,11 @@ struct wiphy {
        /* Supported interface modes, OR together BIT(NL80211_IFTYPE_...) */
        u16 interface_modes;
 
-       bool fw_handles_regulatory;
+       bool custom_regulatory;
+       bool strict_regulatory;
+
+       int bss_priv_size;
+       u8 max_scan_ssids;
 
        /* If multiple wiphys are registered and you're handed e.g.
         * a regular netdev with assigned ieee80211_ptr, you won't
@@ -209,10 +226,13 @@ struct wiphy {
        struct ieee80211_supported_band *bands[IEEE80211_NUM_BANDS];
 
        /* Lets us get back the wiphy on the callback */
-       int (*reg_notifier)(struct wiphy *wiphy, enum reg_set_by setby);
+       int (*reg_notifier)(struct wiphy *wiphy,
+                           struct regulatory_request *request);
 
        /* fields below are read-only, assigned by cfg80211 */
 
+       const struct ieee80211_regdomain *regd;
+
        /* the item in /sys/class/ieee80211/ points to this,
         * you need use set_wiphy_dev() (see below) */
        struct device dev;
@@ -361,7 +381,7 @@ ieee80211_get_channel(struct wiphy *wiphy, int freq)
  */
 struct ieee80211_rate *
 ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
-                           u64 basic_rates, int bitrate);
+                           u32 basic_rates, int bitrate);
 
 /**
  * regulatory_hint - driver hint to the wireless core a regulatory domain
@@ -395,4 +415,45 @@ extern void regulatory_hint(struct wiphy *wiphy, const char *alpha2);
 extern void regulatory_hint_11d(struct wiphy *wiphy,
                                u8 *country_ie,
                                u8 country_ie_len);
+
+/**
+ * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
+ * @wiphy: the wireless device we want to process the regulatory domain on
+ * @regd: the custom regulatory domain to use for this wiphy
+ *
+ * Drivers can sometimes have custom regulatory domains which do not apply
+ * to a specific country. Drivers can use this to apply such custom regulatory
+ * domains. This routine must be called prior to wiphy registration. The
+ * custom regulatory domain will be trusted completely and as such previous
+ * default channel settings will be disregarded. If no rule is found for a
+ * channel on the regulatory domain the channel will be disabled.
+ */
+extern void wiphy_apply_custom_regulatory(
+       struct wiphy *wiphy,
+       const struct ieee80211_regdomain *regd);
+
+/**
+ * freq_reg_info - get regulatory information for the given frequency
+ * @wiphy: the wiphy for which we want to process this rule for
+ * @center_freq: Frequency in KHz for which we want regulatory information for
+ * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
+ *     you can set this to 0. If this frequency is allowed we then set
+ *     this value to the maximum allowed bandwidth.
+ * @reg_rule: the regulatory rule which we have for this frequency
+ *
+ * Use this function to get the regulatory rule for a specific frequency on
+ * a given wireless device. If the device has a specific regulatory domain
+ * it wants to follow we respect that unless a country IE has been received
+ * and processed already.
+ *
+ * Returns 0 if it was able to find a valid regulatory rule which does
+ * apply to the given center_freq otherwise it returns non-zero. It will
+ * also return -ERANGE if we determine the given center_freq does not even have
+ * a regulatory rule for a frequency range in the center_freq's band. See
+ * freq_in_rule_band() for our current definition of a band -- this is purely
+ * subjective and right now its 802.11 specific.
+ */
+extern int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
+                        const struct ieee80211_reg_rule **reg_rule);
+
 #endif /* __NET_WIRELESS_H */
index 936e333e7ce598e9fc46a7b5d96c9ad233a34924..c179318edd92dff17813627160ae9c973fafa08a 100644 (file)
@@ -388,7 +388,7 @@ enum {
        IB_MULTICAST_QPN = 0xffffff
 };
 
-#define IB_LID_PERMISSIVE      __constant_htons(0xFFFF)
+#define IB_LID_PERMISSIVE      cpu_to_be16(0xFFFF)
 
 enum ib_ah_flags {
        IB_AH_GRH       = 1
index 7079beb005e812a9daad7aca630f6da9b05f26e2..51ac69f05bdcc6d547a7671f2a072e0f6a20f353 100644 (file)
@@ -21,9 +21,9 @@
 #define I2C_CNTL_1                             0x0094
 #define PALETTE_INDEX                          0x00b0
 #define PALETTE_DATA                           0x00b4
-#define CONFIG_CNTL                            0x00e0
+#define CNFG_CNTL                              0x00e0
 #define GEN_RESET_CNTL                         0x00f0
-#define CONFIG_MEMSIZE                         0x00f8
+#define CNFG_MEMSIZE                           0x00f8
 #define MEM_CNTL                               0x0140
 #define MEM_POWER_MISC                         0x015c
 #define AGP_BASE                               0x0170
index a8332e528ec19ef6d7b50540e615ec108ce36a0f..89e91c0cb737ba2aeca917f6b514a1a14ae0ddca 100644 (file)
 #define CUR_HORZ_VERT_OFF      0x0070  /* Dword offset 0_1C */
 #define CUR2_HORZ_VERT_OFF     0x0070  /* Dword offset 0_1C */
 
-#define CONFIG_PANEL_LG                0x0074  /* Dword offset 0_1D (LG) */
+#define CNFG_PANEL_LG          0x0074  /* Dword offset 0_1D (LG) */
 
 /* General I/O Control */
 #define GP_IO                  0x0078  /* Dword offset 0_1E */
 #define CLOCK_SEL_CNTL         0x0090  /* Dword offset 0_24 */
 
 /* Configuration */
-#define CONFIG_STAT1           0x0094  /* Dword offset 0_25 */
-#define CONFIG_STAT2           0x0098  /* Dword offset 0_26 */
+#define CNFG_STAT1             0x0094  /* Dword offset 0_25 */
+#define CNFG_STAT2             0x0098  /* Dword offset 0_26 */
 
 /* Bus Control */
 #define BUS_CNTL               0x00A0  /* Dword offset 0_28 */
 #define POWER_MANAGEMENT_LG    0x00D8  /* Dword offset 0_36 (LG) */
 
 /* Configuration */
-#define CONFIG_CNTL            0x00DC  /* Dword offset 0_37 (CT, ET, VT) */
-#define CONFIG_CHIP_ID         0x00E0  /* Dword offset 0_38 */
-#define CONFIG_STAT0           0x00E4  /* Dword offset 0_39 */
+#define CNFG_CNTL              0x00DC  /* Dword offset 0_37 (CT, ET, VT) */
+#define CNFG_CHIP_ID           0x00E0  /* Dword offset 0_38 */
+#define CNFG_STAT0             0x00E4  /* Dword offset 0_39 */
 
 /* Test and Debug */
 #define CRC_SIG                        0x00E8  /* Dword offset 0_3A */
 #define PLL_YCLK_CNTL          0x29
 #define PM_DYN_CLK_CNTL                0x2A
 
-/* CONFIG_CNTL register constants */
+/* CNFG_CNTL register constants */
 #define APERTURE_4M_ENABLE     1
 #define APERTURE_8M_ENABLE     2
 #define VGA_APERTURE_ENABLE    4
 
-/* CONFIG_STAT0 register constants (GX, CX) */
+/* CNFG_STAT0 register constants (GX, CX) */
 #define CFG_BUS_TYPE           0x00000007
 #define CFG_MEM_TYPE           0x00000038
 #define CFG_INIT_DAC_TYPE      0x00000e00
 
-/* CONFIG_STAT0 register constants (CT, ET, VT) */
+/* CNFG_STAT0 register constants (CT, ET, VT) */
 #define CFG_MEM_TYPE_xT                0x00000007
 
 #define ISA                    0
 #define PCI_ATI_VENDOR_ID      0x1002
 
 
-/* CONFIG_CHIP_ID register constants */
+/* CNFG_CHIP_ID register constants */
 #define CFG_CHIP_TYPE          0x0000FFFF
 #define CFG_CHIP_CLASS         0x00FF0000
 #define CFG_CHIP_REV           0xFF000000
 #define CFG_CHIP_MINOR         0xC0000000
 
 
-/* Chip IDs read from CONFIG_CHIP_ID */
+/* Chip IDs read from CNFG_CHIP_ID */
 
 /* mach64GX family */
 #define GX_CHIP_ID     0xD7    /* mach64GX (ATI888GX00) */
 #define CRTC2_DISPLAY_DIS      0x00000400
 
 /* LCD register indices */
-#define CONFIG_PANEL           0x00
+#define CNFG_PANEL             0x00
 #define LCD_GEN_CNTL           0x01
 #define DSTN_CONTROL           0x02
 #define HFB_PITCH_ADDR         0x03
index 1cd09cc5b169460609ca91f7d71edaba6a32f284..e072b16b39abf88bb0bb4e2281d0bf09dd00f0bc 100644 (file)
 #define HI_STAT                                0x004C  
 #define BUS_CNTL1                              0x0034
 #define I2C_CNTL_1                            0x0094  
-#define CONFIG_CNTL                            0x00E0  
-#define CONFIG_MEMSIZE                         0x00F8  
-#define CONFIG_APER_0_BASE                     0x0100  
-#define CONFIG_APER_1_BASE                     0x0104  
-#define CONFIG_APER_SIZE                       0x0108  
-#define CONFIG_REG_1_BASE                      0x010C  
-#define CONFIG_REG_APER_SIZE                   0x0110  
+#define CNFG_CNTL                              0x00E0
+#define CNFG_MEMSIZE                           0x00F8
+#define CNFG_APER_0_BASE                       0x0100
+#define CNFG_APER_1_BASE                       0x0104
+#define CNFG_APER_SIZE                         0x0108
+#define CNFG_REG_1_BASE                        0x010C
+#define CNFG_REG_APER_SIZE                     0x0110
 #define PAD_AGPINPUT_DELAY                     0x0164  
 #define PAD_CTLR_STRENGTH                      0x0168  
 #define PAD_CTLR_UPDATE                        0x016C
 /* CLOCK_CNTL_INDEX bit constants */
 #define PLL_WR_EN                                  0x00000080
 
-/* CONFIG_CNTL bit constants */
+/* CNFG_CNTL bit constants */
 #define CFG_VGA_RAM_EN                             0x00000100
 #define CFG_ATI_REV_ID_MASK                       (0xf << 16)
 #define CFG_ATI_REV_A11                                   (0 << 16)
 
 /* masks */
 
-#define CONFIG_MEMSIZE_MASK            0x1f000000
+#define CNFG_MEMSIZE_MASK              0x1f000000
 #define MEM_CFG_TYPE                   0x40000000
 #define DST_OFFSET_MASK                        0x003fffff
 #define DST_PITCH_MASK                 0x3fc00000
index 708105e163df8fbbbe69c7fc74a29693d6f3ed58..8d4ff5afc1d80b56963cbf119b162a3ebce61124 100644 (file)
@@ -370,10 +370,14 @@ void __init prepare_namespace(void)
                ssleep(root_delay);
        }
 
-       /* wait for the known devices to complete their probing */
-       while (driver_probe_done() != 0)
-               msleep(100);
-       async_synchronize_full();
+       /*
+        * wait for the known devices to complete their probing
+        *
+        * Note: this is a potential source of long boot delays.
+        * For example, it is not atypical to wait 5 seconds here
+        * for the touchpad of a laptop to initialize.
+        */
+       wait_for_device_probe();
 
        md_run_setup();
 
@@ -399,6 +403,7 @@ void __init prepare_namespace(void)
                while (driver_probe_done() != 0 ||
                        (ROOT_DEV = name_to_dev_t(saved_root_name)) == 0)
                        msleep(100);
+               async_synchronize_full();
        }
 
        is_floppy = MAJOR(ROOT_DEV) == FLOPPY_MAJOR;
index ff95e319288472caaf3aa086c0fca769b0706b2f..9bdddbcb3d6a62614b0d43783abc9a265948bdde 100644 (file)
@@ -281,8 +281,9 @@ static void __init autodetect_raid(void)
         */
        printk(KERN_INFO "md: Waiting for all devices to be available before autodetect\n");
        printk(KERN_INFO "md: If you don't use raid, use raid=noautodetect\n");
-       while (driver_probe_done() < 0)
-               msleep(100);
+
+       wait_for_device_probe();
+
        fd = sys_open("/dev/md0", 0, 0);
        if (fd >= 0) {
                sys_ioctl(fd, RAID_AUTORUN, raid_autopart);
index c0a021f7f41a8ff80118a5b0f76516444a561bd2..05d51d2a792c116630f8d4d1cd28bbdcf754c81f 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -340,6 +340,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
        struct file * file;
        char name[13];
        int id;
+       int acctflag = 0;
 
        if (size < SHMMIN || size > ns->shm_ctlmax)
                return -EINVAL;
@@ -364,11 +365,12 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params)
 
        sprintf (name, "SYSV%08x", key);
        if (shmflg & SHM_HUGETLB) {
-               /* hugetlb_file_setup takes care of mlock user accounting */
-               file = hugetlb_file_setup(name, size);
+               /* hugetlb_file_setup applies strict accounting */
+               if (shmflg & SHM_NORESERVE)
+                       acctflag = VM_NORESERVE;
+               file = hugetlb_file_setup(name, size, acctflag);
                shp->mlock_user = current_user();
        } else {
-               int acctflag = 0;
                /*
                 * Do not allow no accounting for OVERCOMMIT_NEVER, even
                 * if it's asked for.
@@ -565,11 +567,15 @@ static void shm_get_stat(struct ipc_namespace *ns, unsigned long *rss,
                        struct hstate *h = hstate_file(shp->shm_file);
                        *rss += pages_per_huge_page(h) * mapping->nrpages;
                } else {
+#ifdef CONFIG_SHMEM
                        struct shmem_inode_info *info = SHMEM_I(inode);
                        spin_lock(&info->lock);
                        *rss += inode->i_mapping->nrpages;
                        *swp += info->swapped;
                        spin_unlock(&info->lock);
+#else
+                       *rss += inode->i_mapping->nrpages;
+#endif
                }
 
                total++;
index 170a9213c1b68d6cee652fb7758fef556ecf127f..e4791b3ba55d45c163f3dd8cc0551f0aa7a1e766 100644 (file)
@@ -51,6 +51,7 @@ obj-$(CONFIG_UID16) += uid16.o
 obj-$(CONFIG_MODULES) += module.o
 obj-$(CONFIG_KALLSYMS) += kallsyms.o
 obj-$(CONFIG_PM) += power/
+obj-$(CONFIG_FREEZER) += power/
 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
 obj-$(CONFIG_KEXEC) += kexec.o
 obj-$(CONFIG_BACKTRACE_SELF_TEST) += backtracetest.o
index 608b32b42812d2c40f54782c0bf07d7d744f10be..f565891f2c9bd069873b93c12e7ecb0424876c90 100644 (file)
@@ -54,6 +54,7 @@ asynchronous and synchronous parts of the kernel.
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/kthread.h>
+#include <linux/delay.h>
 #include <asm/atomic.h>
 
 static async_cookie_t next_cookie = 1;
@@ -132,21 +133,23 @@ static void run_one_entry(void)
        entry = list_first_entry(&async_pending, struct async_entry, list);
 
        /* 2) move it to the running queue */
-       list_del(&entry->list);
-       list_add_tail(&entry->list, &async_running);
+       list_move_tail(&entry->list, entry->running);
        spin_unlock_irqrestore(&async_lock, flags);
 
        /* 3) run it (and print duration)*/
        if (initcall_debug && system_state == SYSTEM_BOOTING) {
-               printk("calling  %lli_%pF @ %i\n", entry->cookie, entry->func, task_pid_nr(current));
+               printk("calling  %lli_%pF @ %i\n", (long long)entry->cookie,
+                       entry->func, task_pid_nr(current));
                calltime = ktime_get();
        }
        entry->func(entry->data, entry->cookie);
        if (initcall_debug && system_state == SYSTEM_BOOTING) {
                rettime = ktime_get();
                delta = ktime_sub(rettime, calltime);
-               printk("initcall %lli_%pF returned 0 after %lld usecs\n", entry->cookie,
-                       entry->func, ktime_to_ns(delta) >> 10);
+               printk("initcall %lli_%pF returned 0 after %lld usecs\n",
+                       (long long)entry->cookie,
+                       entry->func,
+                       (long long)ktime_to_ns(delta) >> 10);
        }
 
        /* 4) remove it from the running queue */
@@ -205,18 +208,44 @@ static async_cookie_t __async_schedule(async_func_ptr *ptr, void *data, struct l
        return newcookie;
 }
 
+/**
+ * async_schedule - schedule a function for asynchronous execution
+ * @ptr: function to execute asynchronously
+ * @data: data pointer to pass to the function
+ *
+ * Returns an async_cookie_t that may be used for checkpointing later.
+ * Note: This function may be called from atomic or non-atomic contexts.
+ */
 async_cookie_t async_schedule(async_func_ptr *ptr, void *data)
 {
-       return __async_schedule(ptr, data, &async_pending);
+       return __async_schedule(ptr, data, &async_running);
 }
 EXPORT_SYMBOL_GPL(async_schedule);
 
-async_cookie_t async_schedule_special(async_func_ptr *ptr, void *data, struct list_head *running)
+/**
+ * async_schedule_domain - schedule a function for asynchronous execution within a certain domain
+ * @ptr: function to execute asynchronously
+ * @data: data pointer to pass to the function
+ * @running: running list for the domain
+ *
+ * Returns an async_cookie_t that may be used for checkpointing later.
+ * @running may be used in the async_synchronize_*_domain() functions
+ * to wait within a certain synchronization domain rather than globally.
+ * A synchronization domain is specified via the running queue @running to use.
+ * Note: This function may be called from atomic or non-atomic contexts.
+ */
+async_cookie_t async_schedule_domain(async_func_ptr *ptr, void *data,
+                                    struct list_head *running)
 {
        return __async_schedule(ptr, data, running);
 }
-EXPORT_SYMBOL_GPL(async_schedule_special);
+EXPORT_SYMBOL_GPL(async_schedule_domain);
 
+/**
+ * async_synchronize_full - synchronize all asynchronous function calls
+ *
+ * This function waits until all asynchronous function calls have been done.
+ */
 void async_synchronize_full(void)
 {
        do {
@@ -225,13 +254,30 @@ void async_synchronize_full(void)
 }
 EXPORT_SYMBOL_GPL(async_synchronize_full);
 
-void async_synchronize_full_special(struct list_head *list)
+/**
+ * async_synchronize_full_domain - synchronize all asynchronous function within a certain domain
+ * @list: running list to synchronize on
+ *
+ * This function waits until all asynchronous function calls for the
+ * synchronization domain specified by the running list @list have been done.
+ */
+void async_synchronize_full_domain(struct list_head *list)
 {
-       async_synchronize_cookie_special(next_cookie, list);
+       async_synchronize_cookie_domain(next_cookie, list);
 }
-EXPORT_SYMBOL_GPL(async_synchronize_full_special);
+EXPORT_SYMBOL_GPL(async_synchronize_full_domain);
 
-void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *running)
+/**
+ * async_synchronize_cookie_domain - synchronize asynchronous function calls within a certain domain with cookie checkpointing
+ * @cookie: async_cookie_t to use as checkpoint
+ * @running: running list to synchronize on
+ *
+ * This function waits until all asynchronous function calls for the
+ * synchronization domain specified by the running list @list submitted
+ * prior to @cookie have been done.
+ */
+void async_synchronize_cookie_domain(async_cookie_t cookie,
+                                    struct list_head *running)
 {
        ktime_t starttime, delta, endtime;
 
@@ -247,14 +293,22 @@ void async_synchronize_cookie_special(async_cookie_t cookie, struct list_head *r
                delta = ktime_sub(endtime, starttime);
 
                printk("async_continuing @ %i after %lli usec\n",
-                       task_pid_nr(current), ktime_to_ns(delta) >> 10);
+                       task_pid_nr(current),
+                       (long long)ktime_to_ns(delta) >> 10);
        }
 }
-EXPORT_SYMBOL_GPL(async_synchronize_cookie_special);
+EXPORT_SYMBOL_GPL(async_synchronize_cookie_domain);
 
+/**
+ * async_synchronize_cookie - synchronize asynchronous function calls with cookie checkpointing
+ * @cookie: async_cookie_t to use as checkpoint
+ *
+ * This function waits until all asynchronous function calls prior to @cookie
+ * have been done.
+ */
 void async_synchronize_cookie(async_cookie_t cookie)
 {
-       async_synchronize_cookie_special(cookie, &async_running);
+       async_synchronize_cookie_domain(cookie, &async_running);
 }
 EXPORT_SYMBOL_GPL(async_synchronize_cookie);
 
@@ -315,7 +369,11 @@ static int async_manager_thread(void *unused)
                ec = atomic_read(&entry_count);
 
                while (tc < ec && tc < MAX_THREADS) {
-                       kthread_run(async_thread, NULL, "async/%i", tc);
+                       if (IS_ERR(kthread_run(async_thread, NULL, "async/%i",
+                                              tc))) {
+                               msleep(100);
+                               continue;
+                       }
                        atomic_inc(&thread_count);
                        tc++;
                }
@@ -330,7 +388,9 @@ static int async_manager_thread(void *unused)
 static int __init async_init(void)
 {
        if (async_enabled)
-               kthread_run(async_manager_thread, NULL, "async/mgr");
+               if (IS_ERR(kthread_run(async_manager_thread, NULL,
+                                      "async/mgr")))
+                       async_enabled = 0;
        return 0;
 }
 
index 5a54ff42874ee916997139c859b8cfda725b9a33..9edb5c4b79b4f1a88a0487f588c36fc6207f54a9 100644 (file)
@@ -1122,8 +1122,8 @@ static void cgroup_kill_sb(struct super_block *sb) {
 
        mutex_unlock(&cgroup_mutex);
 
-       kfree(root);
        kill_litter_super(sb);
+       kfree(root);
 }
 
 static struct file_system_type cgroup_fs_type = {
@@ -2351,7 +2351,7 @@ static void cgroup_lock_hierarchy(struct cgroupfs_root *root)
        for (i = 0; i < CGROUP_SUBSYS_COUNT; i++) {
                struct cgroup_subsys *ss = subsys[i];
                if (ss->root == root)
-                       mutex_lock_nested(&ss->hierarchy_mutex, i);
+                       mutex_lock(&ss->hierarchy_mutex);
        }
 }
 
@@ -2637,6 +2637,7 @@ static void __init cgroup_init_subsys(struct cgroup_subsys *ss)
        BUG_ON(!list_empty(&init_task.tasks));
 
        mutex_init(&ss->hierarchy_mutex);
+       lockdep_set_class(&ss->hierarchy_mutex, &ss->subsys_key);
        ss->active = 1;
 }
 
index f80dec3f1875db702b7729cdf91e4d2931cfcbbf..efd30ccf38584f48c6ef68da62b9236479b6da69 100644 (file)
@@ -118,6 +118,8 @@ static void __exit_signal(struct task_struct *tsk)
                 * We won't ever get here for the group leader, since it
                 * will have been the last reference on the signal_struct.
                 */
+               sig->utime = cputime_add(sig->utime, task_utime(tsk));
+               sig->stime = cputime_add(sig->stime, task_stime(tsk));
                sig->gtime = cputime_add(sig->gtime, task_gtime(tsk));
                sig->min_flt += tsk->min_flt;
                sig->maj_flt += tsk->maj_flt;
@@ -126,6 +128,7 @@ static void __exit_signal(struct task_struct *tsk)
                sig->inblock += task_io_get_inblock(tsk);
                sig->oublock += task_io_get_oublock(tsk);
                task_io_accounting_add(&sig->ioac, &tsk->ioac);
+               sig->sum_sched_runtime += tsk->se.sum_exec_runtime;
                sig = NULL; /* Marker for below. */
        }
 
index 242a706e77218073f74b9b8aa44ca589aaa1cbf4..a66fbde20715bb2d93180b7b3d03541d31d9c068 100644 (file)
@@ -851,13 +851,14 @@ static int copy_signal(unsigned long clone_flags, struct task_struct *tsk)
        sig->tty_old_pgrp = NULL;
        sig->tty = NULL;
 
-       sig->cutime = sig->cstime = cputime_zero;
+       sig->utime = sig->stime = sig->cutime = sig->cstime = cputime_zero;
        sig->gtime = cputime_zero;
        sig->cgtime = cputime_zero;
        sig->nvcsw = sig->nivcsw = sig->cnvcsw = sig->cnivcsw = 0;
        sig->min_flt = sig->maj_flt = sig->cmin_flt = sig->cmaj_flt = 0;
        sig->inblock = sig->oublock = sig->cinblock = sig->coublock = 0;
        task_io_accounting_init(&sig->ioac);
+       sig->sum_sched_runtime = 0;
        taskstats_tgid_init(sig);
 
        task_lock(current->group_leader);
@@ -1005,6 +1006,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
         * triggers too late. This doesn't hurt, the check is only there
         * to stop root fork bombs.
         */
+       retval = -EAGAIN;
        if (nr_threads >= max_threads)
                goto bad_fork_cleanup_count;
 
@@ -1093,7 +1095,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 #ifdef CONFIG_DEBUG_MUTEXES
        p->blocked_on = NULL; /* not blocked yet */
 #endif
-       if (unlikely(ptrace_reparented(current)))
+       if (unlikely(current->ptrace))
                ptrace_fork(p, clone_flags);
 
        /* Perform scheduler related setup. Assign this task to a CPU. */
index f89d373a9c6d7ff5e6848404d4db5b84eb35819f..438701adce2344faab6551f3c833f3bb36c60b05 100644 (file)
@@ -1165,6 +1165,7 @@ static int futex_wait(u32 __user *uaddr, int fshared,
                      u32 val, ktime_t *abs_time, u32 bitset, int clockrt)
 {
        struct task_struct *curr = current;
+       struct restart_block *restart;
        DECLARE_WAITQUEUE(wait, curr);
        struct futex_hash_bucket *hb;
        struct futex_q q;
@@ -1216,11 +1217,13 @@ retry:
 
                if (!ret)
                        goto retry;
-               return ret;
+               goto out;
        }
        ret = -EWOULDBLOCK;
-       if (uval != val)
-               goto out_unlock_put_key;
+       if (unlikely(uval != val)) {
+               queue_unlock(&q, hb);
+               goto out_put_key;
+       }
 
        /* Only actually queue if *uaddr contained val.  */
        queue_me(&q, hb);
@@ -1284,38 +1287,38 @@ retry:
         */
 
        /* If we were woken (and unqueued), we succeeded, whatever. */
+       ret = 0;
        if (!unqueue_me(&q))
-               return 0;
+               goto out_put_key;
+       ret = -ETIMEDOUT;
        if (rem)
-               return -ETIMEDOUT;
+               goto out_put_key;
 
        /*
         * We expect signal_pending(current), but another thread may
         * have handled it for us already.
         */
+       ret = -ERESTARTSYS;
        if (!abs_time)
-               return -ERESTARTSYS;
-       else {
-               struct restart_block *restart;
-               restart = &current_thread_info()->restart_block;
-               restart->fn = futex_wait_restart;
-               restart->futex.uaddr = (u32 *)uaddr;
-               restart->futex.val = val;
-               restart->futex.time = abs_time->tv64;
-               restart->futex.bitset = bitset;
-               restart->futex.flags = 0;
-
-               if (fshared)
-                       restart->futex.flags |= FLAGS_SHARED;
-               if (clockrt)
-                       restart->futex.flags |= FLAGS_CLOCKRT;
-               return -ERESTART_RESTARTBLOCK;
-       }
+               goto out_put_key;
 
-out_unlock_put_key:
-       queue_unlock(&q, hb);
-       put_futex_key(fshared, &q.key);
+       restart = &current_thread_info()->restart_block;
+       restart->fn = futex_wait_restart;
+       restart->futex.uaddr = (u32 *)uaddr;
+       restart->futex.val = val;
+       restart->futex.time = abs_time->tv64;
+       restart->futex.bitset = bitset;
+       restart->futex.flags = 0;
+
+       if (fshared)
+               restart->futex.flags |= FLAGS_SHARED;
+       if (clockrt)
+               restart->futex.flags |= FLAGS_CLOCKRT;
 
+       ret = -ERESTART_RESTARTBLOCK;
+
+out_put_key:
+       put_futex_key(fshared, &q.key);
 out:
        return ret;
 }
index ecf765c6a77ac8276b73cc551af07de1c4302f23..acd88356ac76abfcbd186209f16d8e92d2ff31fb 100644 (file)
@@ -71,7 +71,7 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
        desc = irq_desc_ptrs[irq];
 
        if (desc && old_desc != desc)
-                       goto out_unlock;
+               goto out_unlock;
 
        node = cpu_to_node(cpu);
        desc = kzalloc_node(sizeof(*desc), GFP_ATOMIC, node);
@@ -84,10 +84,15 @@ static struct irq_desc *__real_move_irq_desc(struct irq_desc *old_desc,
        init_copy_one_irq_desc(irq, old_desc, desc, cpu);
 
        irq_desc_ptrs[irq] = desc;
+       spin_unlock_irqrestore(&sparse_irq_lock, flags);
 
        /* free the old one */
        free_one_irq_desc(old_desc, desc);
+       spin_unlock(&old_desc->lock);
        kfree(old_desc);
+       spin_lock(&desc->lock);
+
+       return desc;
 
 out_unlock:
        spin_unlock_irqrestore(&sparse_irq_lock, flags);
index 6a5fe93dd8bdd76a83732c18f27e5eb0f42de773..58762f7077ec003cc1a26e793b423006ecce73a7 100644 (file)
@@ -62,7 +62,7 @@ int do_getitimer(int which, struct itimerval *value)
                        struct task_cputime cputime;
                        cputime_t utime;
 
-                       thread_group_cputime(tsk, &cputime);
+                       thread_group_cputimer(tsk, &cputime);
                        utime = cputime.utime;
                        if (cputime_le(cval, utime)) { /* about to fire */
                                cval = jiffies_to_cputime(1);
@@ -82,7 +82,7 @@ int do_getitimer(int which, struct itimerval *value)
                        struct task_cputime times;
                        cputime_t ptime;
 
-                       thread_group_cputime(tsk, &times);
+                       thread_group_cputimer(tsk, &times);
                        ptime = cputime_add(times.utime, times.stime);
                        if (cputime_le(cval, ptime)) { /* about to fire */
                                cval = jiffies_to_cputime(1);
index 8a6d7b08864ea199108cae686adbe1a8886a56a5..483899578259ebc725264bedae6abb132295b9d3 100644 (file)
@@ -1465,6 +1465,11 @@ int kernel_kexec(void)
                error = device_power_down(PMSG_FREEZE);
                if (error)
                        goto Enable_irqs;
+
+               /* Suspend system devices */
+               error = sysdev_suspend(PMSG_FREEZE);
+               if (error)
+                       goto Power_up_devices;
        } else
 #endif
        {
@@ -1477,6 +1482,8 @@ int kernel_kexec(void)
 
 #ifdef CONFIG_KEXEC_JUMP
        if (kexec_image->preserve_context) {
+               sysdev_resume();
+ Power_up_devices:
                device_power_up(PMSG_RESTORE);
  Enable_irqs:
                local_irq_enable();
index fa07da94d7be9832a8a7a8816816ee16654378f5..e976e505648d2cf9d8e94085bcce6f1ec16afd8b 100644 (file)
@@ -230,6 +230,71 @@ static int cpu_clock_sample(const clockid_t which_clock, struct task_struct *p,
        return 0;
 }
 
+void thread_group_cputime(struct task_struct *tsk, struct task_cputime *times)
+{
+       struct sighand_struct *sighand;
+       struct signal_struct *sig;
+       struct task_struct *t;
+
+       *times = INIT_CPUTIME;
+
+       rcu_read_lock();
+       sighand = rcu_dereference(tsk->sighand);
+       if (!sighand)
+               goto out;
+
+       sig = tsk->signal;
+
+       t = tsk;
+       do {
+               times->utime = cputime_add(times->utime, t->utime);
+               times->stime = cputime_add(times->stime, t->stime);
+               times->sum_exec_runtime += t->se.sum_exec_runtime;
+
+               t = next_thread(t);
+       } while (t != tsk);
+
+       times->utime = cputime_add(times->utime, sig->utime);
+       times->stime = cputime_add(times->stime, sig->stime);
+       times->sum_exec_runtime += sig->sum_sched_runtime;
+out:
+       rcu_read_unlock();
+}
+
+static void update_gt_cputime(struct task_cputime *a, struct task_cputime *b)
+{
+       if (cputime_gt(b->utime, a->utime))
+               a->utime = b->utime;
+
+       if (cputime_gt(b->stime, a->stime))
+               a->stime = b->stime;
+
+       if (b->sum_exec_runtime > a->sum_exec_runtime)
+               a->sum_exec_runtime = b->sum_exec_runtime;
+}
+
+void thread_group_cputimer(struct task_struct *tsk, struct task_cputime *times)
+{
+       struct thread_group_cputimer *cputimer = &tsk->signal->cputimer;
+       struct task_cputime sum;
+       unsigned long flags;
+
+       spin_lock_irqsave(&cputimer->lock, flags);
+       if (!cputimer->running) {
+               cputimer->running = 1;
+               /*
+                * The POSIX timer interface allows for absolute time expiry
+                * values through the TIMER_ABSTIME flag, therefore we have
+                * to synchronize the timer to the clock every time we start
+                * it.
+                */
+               thread_group_cputime(tsk, &sum);
+               update_gt_cputime(&cputimer->cputime, &sum);
+       }
+       *times = cputimer->cputime;
+       spin_unlock_irqrestore(&cputimer->lock, flags);
+}
+
 /*
  * Sample a process (thread group) clock for the given group_leader task.
  * Must be called with tasklist_lock held for reading.
@@ -457,7 +522,7 @@ void posix_cpu_timers_exit_group(struct task_struct *tsk)
 {
        struct task_cputime cputime;
 
-       thread_group_cputime(tsk, &cputime);
+       thread_group_cputimer(tsk, &cputime);
        cleanup_timers(tsk->signal->cpu_timers,
                       cputime.utime, cputime.stime, cputime.sum_exec_runtime);
 }
@@ -615,6 +680,33 @@ static void cpu_timer_fire(struct k_itimer *timer)
        }
 }
 
+/*
+ * Sample a process (thread group) timer for the given group_leader task.
+ * Must be called with tasklist_lock held for reading.
+ */
+static int cpu_timer_sample_group(const clockid_t which_clock,
+                                 struct task_struct *p,
+                                 union cpu_time_count *cpu)
+{
+       struct task_cputime cputime;
+
+       thread_group_cputimer(p, &cputime);
+       switch (CPUCLOCK_WHICH(which_clock)) {
+       default:
+               return -EINVAL;
+       case CPUCLOCK_PROF:
+               cpu->cpu = cputime_add(cputime.utime, cputime.stime);
+               break;
+       case CPUCLOCK_VIRT:
+               cpu->cpu = cputime.utime;
+               break;
+       case CPUCLOCK_SCHED:
+               cpu->sched = cputime.sum_exec_runtime + task_delta_exec(p);
+               break;
+       }
+       return 0;
+}
+
 /*
  * Guts of sys_timer_settime for CPU timers.
  * This is called with the timer locked and interrupts disabled.
@@ -676,7 +768,7 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags,
        if (CPUCLOCK_PERTHREAD(timer->it_clock)) {
                cpu_clock_sample(timer->it_clock, p, &val);
        } else {
-               cpu_clock_sample_group(timer->it_clock, p, &val);
+               cpu_timer_sample_group(timer->it_clock, p, &val);
        }
 
        if (old) {
@@ -824,7 +916,7 @@ void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)
                        read_unlock(&tasklist_lock);
                        goto dead;
                } else {
-                       cpu_clock_sample_group(timer->it_clock, p, &now);
+                       cpu_timer_sample_group(timer->it_clock, p, &now);
                        clear_dead = (unlikely(p->exit_state) &&
                                      thread_group_empty(p));
                }
@@ -964,6 +1056,19 @@ static void check_thread_timers(struct task_struct *tsk,
        }
 }
 
+static void stop_process_timers(struct task_struct *tsk)
+{
+       struct thread_group_cputimer *cputimer = &tsk->signal->cputimer;
+       unsigned long flags;
+
+       if (!cputimer->running)
+               return;
+
+       spin_lock_irqsave(&cputimer->lock, flags);
+       cputimer->running = 0;
+       spin_unlock_irqrestore(&cputimer->lock, flags);
+}
+
 /*
  * Check for any per-thread CPU timers that have fired and move them
  * off the tsk->*_timers list onto the firing list.  Per-thread timers
@@ -987,13 +1092,15 @@ static void check_process_timers(struct task_struct *tsk,
            sig->rlim[RLIMIT_CPU].rlim_cur == RLIM_INFINITY &&
            list_empty(&timers[CPUCLOCK_VIRT]) &&
            cputime_eq(sig->it_virt_expires, cputime_zero) &&
-           list_empty(&timers[CPUCLOCK_SCHED]))
+           list_empty(&timers[CPUCLOCK_SCHED])) {
+               stop_process_timers(tsk);
                return;
+       }
 
        /*
         * Collect the current process totals.
         */
-       thread_group_cputime(tsk, &cputime);
+       thread_group_cputimer(tsk, &cputime);
        utime = cputime.utime;
        ptime = cputime_add(utime, cputime.stime);
        sum_sched_runtime = cputime.sum_exec_runtime;
@@ -1164,7 +1271,7 @@ void posix_cpu_timer_schedule(struct k_itimer *timer)
                        clear_dead_task(timer, now);
                        goto out_unlock;
                }
-               cpu_clock_sample_group(timer->it_clock, p, &now);
+               cpu_timer_sample_group(timer->it_clock, p, &now);
                bump_cpu_timer(timer, now);
                /* Leave the tasklist_lock locked for the call below.  */
        }
@@ -1259,7 +1366,7 @@ static inline int fastpath_timer_check(struct task_struct *tsk)
        if (!task_cputime_zero(&sig->cputime_expires)) {
                struct task_cputime group_sample;
 
-               thread_group_cputime(tsk, &group_sample);
+               thread_group_cputimer(tsk, &group_sample);
                if (task_cputime_expired(&group_sample, &sig->cputime_expires))
                        return 1;
        }
@@ -1341,7 +1448,7 @@ void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx,
        struct list_head *head;
 
        BUG_ON(clock_idx == CPUCLOCK_SCHED);
-       cpu_clock_sample_group(clock_idx, tsk, &now);
+       cpu_timer_sample_group(clock_idx, tsk, &now);
 
        if (oldval) {
                if (!cputime_eq(*oldval, cputime_zero)) {
index d7a10167a25b37d787418bfbee02e68ba4e28c55..720ea4f781bd4896ef8922b9e55442f447967ab5 100644 (file)
@@ -3,7 +3,7 @@ ifeq ($(CONFIG_PM_DEBUG),y)
 EXTRA_CFLAGS   +=      -DDEBUG
 endif
 
-obj-y                          := main.o
+obj-$(CONFIG_PM)               += main.o
 obj-$(CONFIG_PM_SLEEP)         += console.o
 obj-$(CONFIG_FREEZER)          += process.o
 obj-$(CONFIG_HIBERNATION)      += swsusp.o disk.o snapshot.o swap.o user.o
index b8628be2a465c4841ccc69135d91618b56b2d6ca..a3961b205de743c30f9588e02d28f1f959b46db6 100644 (file)
@@ -78,6 +78,12 @@ void pm_restore_console(void)
        }
        set_console(orig_fgconsole);
        release_console_sem();
+
+       if (vt_waitactive(orig_fgconsole)) {
+               pr_debug("Resume: Can't switch VCs.");
+               return;
+       }
+
        kmsg_redirect = orig_kmsg;
 }
 #endif
index 432ee575c9ee4fd201481a9ebdb674c29b96dab8..4a4a206b1979c657c887df31907166080a004d8f 100644 (file)
@@ -227,6 +227,12 @@ static int create_image(int platform_mode)
                        "aborting hibernation\n");
                goto Enable_irqs;
        }
+       sysdev_suspend(PMSG_FREEZE);
+       if (error) {
+               printk(KERN_ERR "PM: Some devices failed to power down, "
+                       "aborting hibernation\n");
+               goto Power_up_devices;
+       }
 
        if (hibernation_test(TEST_CORE))
                goto Power_up;
@@ -242,9 +248,11 @@ static int create_image(int platform_mode)
        if (!in_suspend)
                platform_leave(platform_mode);
  Power_up:
+       sysdev_resume();
        /* NOTE:  device_power_up() is just a resume() for devices
         * that suspended with irqs off ... no overall powerup.
         */
+ Power_up_devices:
        device_power_up(in_suspend ?
                (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE);
  Enable_irqs:
@@ -335,6 +343,7 @@ static int resume_target_kernel(void)
                        "aborting resume\n");
                goto Enable_irqs;
        }
+       sysdev_suspend(PMSG_QUIESCE);
        /* We'll ignore saved state, but this gets preempt count (etc) right */
        save_processor_state();
        error = restore_highmem();
@@ -357,6 +366,7 @@ static int resume_target_kernel(void)
        swsusp_free();
        restore_processor_state();
        touch_softlockup_watchdog();
+       sysdev_resume();
        device_power_up(PMSG_RECOVER);
  Enable_irqs:
        local_irq_enable();
@@ -440,6 +450,7 @@ int hibernation_platform_enter(void)
        local_irq_disable();
        error = device_power_down(PMSG_HIBERNATE);
        if (!error) {
+               sysdev_suspend(PMSG_HIBERNATE);
                hibernation_ops->enter();
                /* We should never get here */
                while (1);
@@ -594,6 +605,12 @@ static int software_resume(void)
        int error;
        unsigned int flags;
 
+       /*
+        * If the user said "noresume".. bail out early.
+        */
+       if (noresume)
+               return 0;
+
        /*
         * name_to_dev_t() below takes a sysfs buffer mutex when sysfs
         * is configured into the kernel. Since the regular hibernate
@@ -610,6 +627,11 @@ static int software_resume(void)
                        mutex_unlock(&pm_mutex);
                        return -ENOENT;
                }
+               /*
+                * Some device discovery might still be in progress; we need
+                * to wait for this to finish.
+                */
+               wait_for_device_probe();
                swsusp_resume_device = name_to_dev_t(resume_file);
                pr_debug("PM: Resume from partition %s\n", resume_file);
        } else {
index 239988873971fed7fde593ab2ad28a3523bd66f5..c9632f841f646fbfc146ecee855fd04068a548ae 100644 (file)
@@ -57,16 +57,6 @@ int pm_notifier_call_chain(unsigned long val)
 #ifdef CONFIG_PM_DEBUG
 int pm_test_level = TEST_NONE;
 
-static int suspend_test(int level)
-{
-       if (pm_test_level == level) {
-               printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n");
-               mdelay(5000);
-               return 1;
-       }
-       return 0;
-}
-
 static const char * const pm_tests[__TEST_AFTER_LAST] = {
        [TEST_NONE] = "none",
        [TEST_CORE] = "core",
@@ -125,14 +115,24 @@ static ssize_t pm_test_store(struct kobject *kobj, struct kobj_attribute *attr,
 }
 
 power_attr(pm_test);
-#else /* !CONFIG_PM_DEBUG */
-static inline int suspend_test(int level) { return 0; }
-#endif /* !CONFIG_PM_DEBUG */
+#endif /* CONFIG_PM_DEBUG */
 
 #endif /* CONFIG_PM_SLEEP */
 
 #ifdef CONFIG_SUSPEND
 
+static int suspend_test(int level)
+{
+#ifdef CONFIG_PM_DEBUG
+       if (pm_test_level == level) {
+               printk(KERN_INFO "suspend debug: Waiting for 5 seconds.\n");
+               mdelay(5000);
+               return 1;
+       }
+#endif /* !CONFIG_PM_DEBUG */
+       return 0;
+}
+
 #ifdef CONFIG_PM_TEST_SUSPEND
 
 /*
@@ -298,8 +298,12 @@ static int suspend_enter(suspend_state_t state)
                goto Done;
        }
 
-       if (!suspend_test(TEST_CORE))
-               error = suspend_ops->enter(state);
+       error = sysdev_suspend(PMSG_SUSPEND);
+       if (!error) {
+               if (!suspend_test(TEST_CORE))
+                       error = suspend_ops->enter(state);
+               sysdev_resume();
+       }
 
        device_power_up(PMSG_RESUME);
  Done:
index 6da14358537c8779db14f4ccab91a64365270d16..505f319e489c901ad0fbba6fecd1b508246fec14 100644 (file)
@@ -60,6 +60,7 @@ static struct block_device *resume_bdev;
 static int submit(int rw, pgoff_t page_off, struct page *page,
                        struct bio **bio_chain)
 {
+       const int bio_rw = rw | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
        struct bio *bio;
 
        bio = bio_alloc(__GFP_WAIT | __GFP_HIGH, 1);
@@ -80,7 +81,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
        bio_get(bio);
 
        if (bio_chain == NULL) {
-               submit_bio(rw | (1 << BIO_RW_SYNC), bio);
+               submit_bio(bio_rw, bio);
                wait_on_page_locked(page);
                if (rw == READ)
                        bio_set_pages_dirty(bio);
@@ -90,7 +91,7 @@ static int submit(int rw, pgoff_t page_off, struct page *page,
                        get_page(page); /* These pages are freed later */
                bio->bi_private = *bio_chain;
                *bio_chain = bio;
-               submit_bio(rw | (1 << BIO_RW_SYNC), bio);
+               submit_bio(bio_rw, bio);
        }
        return 0;
 }
index 005b93d839ba1268da0c80c3106739ee388d996a..6c85359364f2bcfd31bb06e77ec0eda7585e08dc 100644 (file)
@@ -95,15 +95,15 @@ static int snapshot_open(struct inode *inode, struct file *filp)
                data->swap = swsusp_resume_device ?
                        swap_type_of(swsusp_resume_device, 0, NULL) : -1;
                data->mode = O_RDONLY;
-               error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
+               error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
                if (error)
-                       pm_notifier_call_chain(PM_POST_RESTORE);
+                       pm_notifier_call_chain(PM_POST_HIBERNATION);
        } else {
                data->swap = -1;
                data->mode = O_WRONLY;
-               error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
+               error = pm_notifier_call_chain(PM_RESTORE_PREPARE);
                if (error)
-                       pm_notifier_call_chain(PM_POST_HIBERNATION);
+                       pm_notifier_call_chain(PM_POST_RESTORE);
        }
        if (error)
                atomic_inc(&snapshot_device_available);
index 69188f226a93251009d22d6dc453ce3d59220816..e3602d0755b0dd99c9fb47887fd67d371cdd5424 100644 (file)
@@ -73,7 +73,6 @@ EXPORT_SYMBOL(oops_in_progress);
  * driver system.
  */
 static DECLARE_MUTEX(console_sem);
-static DECLARE_MUTEX(secondary_console_sem);
 struct console *console_drivers;
 EXPORT_SYMBOL_GPL(console_drivers);
 
@@ -891,12 +890,14 @@ void suspend_console(void)
        printk("Suspending console(s) (use no_console_suspend to debug)\n");
        acquire_console_sem();
        console_suspended = 1;
+       up(&console_sem);
 }
 
 void resume_console(void)
 {
        if (!console_suspend_enabled)
                return;
+       down(&console_sem);
        console_suspended = 0;
        release_console_sem();
 }
@@ -912,11 +913,9 @@ void resume_console(void)
 void acquire_console_sem(void)
 {
        BUG_ON(in_interrupt());
-       if (console_suspended) {
-               down(&secondary_console_sem);
-               return;
-       }
        down(&console_sem);
+       if (console_suspended)
+               return;
        console_locked = 1;
        console_may_schedule = 1;
 }
@@ -926,6 +925,10 @@ int try_acquire_console_sem(void)
 {
        if (down_trylock(&console_sem))
                return -1;
+       if (console_suspended) {
+               up(&console_sem);
+               return -1;
+       }
        console_locked = 1;
        console_may_schedule = 0;
        return 0;
@@ -979,7 +982,7 @@ void release_console_sem(void)
        unsigned wake_klogd = 0;
 
        if (console_suspended) {
-               up(&secondary_console_sem);
+               up(&console_sem);
                return;
        }
 
index 784933acf5b831e884d7538a18a02d1e29ee5860..7724e0409bae7222638fae02c1fe0924e4ae751a 100644 (file)
@@ -114,12 +114,15 @@ int __ref profile_init(void)
        if (!slab_is_available()) {
                prof_buffer = alloc_bootmem(buffer_bytes);
                alloc_bootmem_cpumask_var(&prof_cpu_mask);
+               cpumask_copy(prof_cpu_mask, cpu_possible_mask);
                return 0;
        }
 
        if (!alloc_cpumask_var(&prof_cpu_mask, GFP_KERNEL))
                return -ENOMEM;
 
+       cpumask_copy(prof_cpu_mask, cpu_possible_mask);
+
        prof_buffer = kzalloc(buffer_bytes, GFP_KERNEL);
        if (prof_buffer)
                return 0;
index 242d0d47a70d7dd6a824c0c1b4a82a8f6b887c42..410eec404133fd267eb80041395e21d266f0e552 100644 (file)
@@ -2266,16 +2266,6 @@ static int try_to_wake_up(struct task_struct *p, unsigned int state, int sync)
        if (!sched_feat(SYNC_WAKEUPS))
                sync = 0;
 
-       if (!sync) {
-               if (current->se.avg_overlap < sysctl_sched_migration_cost &&
-                         p->se.avg_overlap < sysctl_sched_migration_cost)
-                       sync = 1;
-       } else {
-               if (current->se.avg_overlap >= sysctl_sched_migration_cost ||
-                         p->se.avg_overlap >= sysctl_sched_migration_cost)
-                       sync = 0;
-       }
-
 #ifdef CONFIG_SMP
        if (sched_feat(LB_WAKEUP_UPDATE)) {
                struct sched_domain *sd;
@@ -3890,19 +3880,24 @@ int select_nohz_load_balancer(int stop_tick)
        int cpu = smp_processor_id();
 
        if (stop_tick) {
-               cpumask_set_cpu(cpu, nohz.cpu_mask);
                cpu_rq(cpu)->in_nohz_recently = 1;
 
-               /*
-                * If we are going offline and still the leader, give up!
-                */
-               if (!cpu_active(cpu) &&
-                   atomic_read(&nohz.load_balancer) == cpu) {
+               if (!cpu_active(cpu)) {
+                       if (atomic_read(&nohz.load_balancer) != cpu)
+                               return 0;
+
+                       /*
+                        * If we are going offline and still the leader,
+                        * give up!
+                        */
                        if (atomic_cmpxchg(&nohz.load_balancer, cpu, -1) != cpu)
                                BUG();
+
                        return 0;
                }
 
+               cpumask_set_cpu(cpu, nohz.cpu_mask);
+
                /* time for ilb owner also to sleep */
                if (cpumask_weight(nohz.cpu_mask) == num_online_cpus()) {
                        if (atomic_read(&nohz.load_balancer) == cpu)
@@ -4697,8 +4692,8 @@ EXPORT_SYMBOL(default_wake_function);
  * started to run but is not in state TASK_RUNNING. try_to_wake_up() returns
  * zero in this (rare) case, and we handle it by continuing to scan the queue.
  */
-static void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
-                            int nr_exclusive, int sync, void *key)
+void __wake_up_common(wait_queue_head_t *q, unsigned int mode,
+                       int nr_exclusive, int sync, void *key)
 {
        wait_queue_t *curr, *next;
 
@@ -6949,20 +6944,26 @@ static void free_rootdomain(struct root_domain *rd)
 
 static void rq_attach_root(struct rq *rq, struct root_domain *rd)
 {
+       struct root_domain *old_rd = NULL;
        unsigned long flags;
 
        spin_lock_irqsave(&rq->lock, flags);
 
        if (rq->rd) {
-               struct root_domain *old_rd = rq->rd;
+               old_rd = rq->rd;
 
                if (cpumask_test_cpu(rq->cpu, old_rd->online))
                        set_rq_offline(rq);
 
                cpumask_clear_cpu(rq->cpu, old_rd->span);
 
-               if (atomic_dec_and_test(&old_rd->refcount))
-                       free_rootdomain(old_rd);
+               /*
+                * If we dont want to free the old_rt yet then
+                * set old_rd to NULL to skip the freeing later
+                * in this function:
+                */
+               if (!atomic_dec_and_test(&old_rd->refcount))
+                       old_rd = NULL;
        }
 
        atomic_inc(&rd->refcount);
@@ -6973,6 +6974,9 @@ static void rq_attach_root(struct rq *rq, struct root_domain *rd)
                set_rq_online(rq);
 
        spin_unlock_irqrestore(&rq->lock, flags);
+
+       if (old_rd)
+               free_rootdomain(old_rd);
 }
 
 static int __init_refok init_rootdomain(struct root_domain *rd, bool bootmem)
index a7e50ba185ac0a843ac16604e13a721ca8e4cb8e..0566f2a03c420717e6604bde5deac33cb71f6ed1 100644 (file)
@@ -1191,15 +1191,20 @@ wake_affine(struct sched_domain *this_sd, struct rq *this_rq,
            int idx, unsigned long load, unsigned long this_load,
            unsigned int imbalance)
 {
+       struct task_struct *curr = this_rq->curr;
+       struct task_group *tg;
        unsigned long tl = this_load;
        unsigned long tl_per_task;
-       struct task_group *tg;
        unsigned long weight;
        int balanced;
 
        if (!(this_sd->flags & SD_WAKE_AFFINE) || !sched_feat(AFFINE_WAKEUPS))
                return 0;
 
+       if (sync && (curr->se.avg_overlap > sysctl_sched_migration_cost ||
+                       p->se.avg_overlap > sysctl_sched_migration_cost))
+               sync = 0;
+
        /*
         * If sync wakeup then subtract the (maximum possible)
         * effect of the currently running task from the load
@@ -1426,7 +1431,9 @@ static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int sync)
        if (!sched_feat(WAKEUP_PREEMPT))
                return;
 
-       if (sched_feat(WAKEUP_OVERLAP) && sync) {
+       if (sched_feat(WAKEUP_OVERLAP) && (sync ||
+                       (se->avg_overlap < sysctl_sched_migration_cost &&
+                        pse->avg_overlap < sysctl_sched_migration_cost))) {
                resched_task(curr);
                return;
        }
index 8ab0cef8ecab44ab0751a30f33b08636a9edd30f..a8f93dd374e16f0a7a6b94cf405f88941e34ecf3 100644 (file)
@@ -296,19 +296,21 @@ sched_info_switch(struct task_struct *prev, struct task_struct *next)
 static inline void account_group_user_time(struct task_struct *tsk,
                                           cputime_t cputime)
 {
-       struct task_cputime *times;
-       struct signal_struct *sig;
+       struct thread_group_cputimer *cputimer;
 
        /* tsk == current, ensure it is safe to use ->signal */
        if (unlikely(tsk->exit_state))
                return;
 
-       sig = tsk->signal;
-       times = &sig->cputime.totals;
+       cputimer = &tsk->signal->cputimer;
 
-       spin_lock(&times->lock);
-       times->utime = cputime_add(times->utime, cputime);
-       spin_unlock(&times->lock);
+       if (!cputimer->running)
+               return;
+
+       spin_lock(&cputimer->lock);
+       cputimer->cputime.utime =
+               cputime_add(cputimer->cputime.utime, cputime);
+       spin_unlock(&cputimer->lock);
 }
 
 /**
@@ -324,19 +326,21 @@ static inline void account_group_user_time(struct task_struct *tsk,
 static inline void account_group_system_time(struct task_struct *tsk,
                                             cputime_t cputime)
 {
-       struct task_cputime *times;
-       struct signal_struct *sig;
+       struct thread_group_cputimer *cputimer;
 
        /* tsk == current, ensure it is safe to use ->signal */
        if (unlikely(tsk->exit_state))
                return;
 
-       sig = tsk->signal;
-       times = &sig->cputime.totals;
+       cputimer = &tsk->signal->cputimer;
+
+       if (!cputimer->running)
+               return;
 
-       spin_lock(&times->lock);
-       times->stime = cputime_add(times->stime, cputime);
-       spin_unlock(&times->lock);
+       spin_lock(&cputimer->lock);
+       cputimer->cputime.stime =
+               cputime_add(cputimer->cputime.stime, cputime);
+       spin_unlock(&cputimer->lock);
 }
 
 /**
@@ -352,7 +356,7 @@ static inline void account_group_system_time(struct task_struct *tsk,
 static inline void account_group_exec_runtime(struct task_struct *tsk,
                                              unsigned long long ns)
 {
-       struct task_cputime *times;
+       struct thread_group_cputimer *cputimer;
        struct signal_struct *sig;
 
        sig = tsk->signal;
@@ -361,9 +365,12 @@ static inline void account_group_exec_runtime(struct task_struct *tsk,
        if (unlikely(!sig))
                return;
 
-       times = &sig->cputime.totals;
+       cputimer = &sig->cputimer;
+
+       if (!cputimer->running)
+               return;
 
-       spin_lock(&times->lock);
-       times->sum_exec_runtime += ns;
-       spin_unlock(&times->lock);
+       spin_lock(&cputimer->lock);
+       cputimer->cputime.sum_exec_runtime += ns;
+       spin_unlock(&cputimer->lock);
 }
index b6b36768b758901b2d1806839a8c6b6c5ee035e0..2a74fe87c0ddb7c46ede38a542c7e2331a5aa44e 100644 (file)
@@ -1367,7 +1367,6 @@ int do_notify_parent(struct task_struct *tsk, int sig)
        struct siginfo info;
        unsigned long flags;
        struct sighand_struct *psig;
-       struct task_cputime cputime;
        int ret = sig;
 
        BUG_ON(sig == -1);
@@ -1397,9 +1396,10 @@ int do_notify_parent(struct task_struct *tsk, int sig)
        info.si_uid = __task_cred(tsk)->uid;
        rcu_read_unlock();
 
-       thread_group_cputime(tsk, &cputime);
-       info.si_utime = cputime_to_jiffies(cputime.utime);
-       info.si_stime = cputime_to_jiffies(cputime.stime);
+       info.si_utime = cputime_to_clock_t(cputime_add(tsk->utime,
+                               tsk->signal->utime));
+       info.si_stime = cputime_to_clock_t(cputime_add(tsk->stime,
+                               tsk->signal->stime));
 
        info.si_status = tsk->exit_code & 0x7f;
        if (tsk->exit_code & 0x80)
index e7dc0e10a485878a08a8c80b52e6919ca6da3c13..f145c415bc160e62b6d888cf6fa9d3198c00b4a7 100644 (file)
@@ -1525,22 +1525,14 @@ SYSCALL_DEFINE2(setrlimit, unsigned int, resource, struct rlimit __user *, rlim)
                return -EINVAL;
        if (copy_from_user(&new_rlim, rlim, sizeof(*rlim)))
                return -EFAULT;
+       if (new_rlim.rlim_cur > new_rlim.rlim_max)
+               return -EINVAL;
        old_rlim = current->signal->rlim + resource;
        if ((new_rlim.rlim_max > old_rlim->rlim_max) &&
            !capable(CAP_SYS_RESOURCE))
                return -EPERM;
-
-       if (resource == RLIMIT_NOFILE) {
-               if (new_rlim.rlim_max == RLIM_INFINITY)
-                       new_rlim.rlim_max = sysctl_nr_open;
-               if (new_rlim.rlim_cur == RLIM_INFINITY)
-                       new_rlim.rlim_cur = sysctl_nr_open;
-               if (new_rlim.rlim_max > sysctl_nr_open)
-                       return -EPERM;
-       }
-
-       if (new_rlim.rlim_cur > new_rlim.rlim_max)
-               return -EINVAL;
+       if (resource == RLIMIT_NOFILE && new_rlim.rlim_max > sysctl_nr_open)
+               return -EPERM;
 
        retval = security_task_setrlimit(resource, &new_rlim);
        if (retval)
index 790f9d785663105cdd5fcc44f33d4d8792f09761..c5ef44ff850f5af111943d76a5484318d6a5bc35 100644 (file)
@@ -101,6 +101,7 @@ static int two = 2;
 
 static int zero;
 static int one = 1;
+static unsigned long one_ul = 1;
 static int one_hundred = 100;
 
 /* this is needed for the proc_dointvec_minmax for [fs_]overflow UID and GID */
@@ -974,7 +975,7 @@ static struct ctl_table vm_table[] = {
                .mode           = 0644,
                .proc_handler   = &dirty_background_bytes_handler,
                .strategy       = &sysctl_intvec,
-               .extra1         = &one,
+               .extra1         = &one_ul,
        },
        {
                .ctl_name       = VM_DIRTY_RATIO,
@@ -995,7 +996,7 @@ static struct ctl_table vm_table[] = {
                .mode           = 0644,
                .proc_handler   = &dirty_bytes_handler,
                .strategy       = &sysctl_intvec,
-               .extra1         = &one,
+               .extra1         = &one_ul,
        },
        {
                .procname       = "dirty_writeback_centisecs",
index fafeb48f27c046d0b6586e2797b40397a6a76f19..b38423ca711ad5ef191db6b74205c6cc945cc463 100644 (file)
@@ -219,6 +219,7 @@ static const struct trans_ctl_table trans_net_ipv4_conf_vars_table[] = {
        { NET_IPV4_CONF_ARP_IGNORE,             "arp_ignore" },
        { NET_IPV4_CONF_PROMOTE_SECONDARIES,    "promote_secondaries" },
        { NET_IPV4_CONF_ARP_ACCEPT,             "arp_accept" },
+       { NET_IPV4_CONF_ARP_NOTIFY,             "arp_notify" },
        {}
 };
 
index 905b0b50792da7a9da1f3bbab3428604ec6ea9fb..0b0a6366c9d482b8cabbbdc3e290087e2622c0bf 100644 (file)
@@ -1,4 +1,4 @@
-obj-y += timekeeping.o ntp.o clocksource.o jiffies.o timer_list.o
+obj-y += timekeeping.o ntp.o clocksource.o jiffies.o timer_list.o timecompare.o
 
 obj-$(CONFIG_GENERIC_CLOCKEVENTS_BUILD)                += clockevents.o
 obj-$(CONFIG_GENERIC_CLOCKEVENTS)              += tick-common.o
index ca89e1593f0833840fbbcaf58ba5bb5b075362e2..c46c931a7fe70424b66ca798c13c7819fbb9efe4 100644 (file)
 #include <linux/sched.h> /* for spin_unlock_irq() using preempt_count() m68k */
 #include <linux/tick.h>
 
+void timecounter_init(struct timecounter *tc,
+                     const struct cyclecounter *cc,
+                     u64 start_tstamp)
+{
+       tc->cc = cc;
+       tc->cycle_last = cc->read(cc);
+       tc->nsec = start_tstamp;
+}
+EXPORT_SYMBOL(timecounter_init);
+
+/**
+ * timecounter_read_delta - get nanoseconds since last call of this function
+ * @tc:         Pointer to time counter
+ *
+ * When the underlying cycle counter runs over, this will be handled
+ * correctly as long as it does not run over more than once between
+ * calls.
+ *
+ * The first call to this function for a new time counter initializes
+ * the time tracking and returns an undefined result.
+ */
+static u64 timecounter_read_delta(struct timecounter *tc)
+{
+       cycle_t cycle_now, cycle_delta;
+       u64 ns_offset;
+
+       /* read cycle counter: */
+       cycle_now = tc->cc->read(tc->cc);
+
+       /* calculate the delta since the last timecounter_read_delta(): */
+       cycle_delta = (cycle_now - tc->cycle_last) & tc->cc->mask;
+
+       /* convert to nanoseconds: */
+       ns_offset = cyclecounter_cyc2ns(tc->cc, cycle_delta);
+
+       /* update time stamp of timecounter_read_delta() call: */
+       tc->cycle_last = cycle_now;
+
+       return ns_offset;
+}
+
+u64 timecounter_read(struct timecounter *tc)
+{
+       u64 nsec;
+
+       /* increment time by nanoseconds since last call */
+       nsec = timecounter_read_delta(tc);
+       nsec += tc->nsec;
+       tc->nsec = nsec;
+
+       return nsec;
+}
+EXPORT_SYMBOL(timecounter_read);
+
+u64 timecounter_cyc2time(struct timecounter *tc,
+                        cycle_t cycle_tstamp)
+{
+       u64 cycle_delta = (cycle_tstamp - tc->cycle_last) & tc->cc->mask;
+       u64 nsec;
+
+       /*
+        * Instead of always treating cycle_tstamp as more recent
+        * than tc->cycle_last, detect when it is too far in the
+        * future and treat it as old time stamp instead.
+        */
+       if (cycle_delta > tc->cc->mask / 2) {
+               cycle_delta = (tc->cycle_last - cycle_tstamp) & tc->cc->mask;
+               nsec = tc->nsec - cyclecounter_cyc2ns(tc->cc, cycle_delta);
+       } else {
+               nsec = cyclecounter_cyc2ns(tc->cc, cycle_delta) + tc->nsec;
+       }
+
+       return nsec;
+}
+EXPORT_SYMBOL(timecounter_cyc2time);
+
 /* XXX - Would like a better way for initializing curr_clocksource */
 extern struct clocksource clocksource_jiffies;
 
diff --git a/kernel/time/timecompare.c b/kernel/time/timecompare.c
new file mode 100644 (file)
index 0000000..71e7f1a
--- /dev/null
@@ -0,0 +1,191 @@
+/*
+ * Copyright (C) 2009 Intel Corporation.
+ * Author: Patrick Ohly <patrick.ohly@intel.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+#include <linux/timecompare.h>
+#include <linux/module.h>
+#include <linux/math64.h>
+
+/*
+ * fixed point arithmetic scale factor for skew
+ *
+ * Usually one would measure skew in ppb (parts per billion, 1e9), but
+ * using a factor of 2 simplifies the math.
+ */
+#define TIMECOMPARE_SKEW_RESOLUTION (((s64)1)<<30)
+
+ktime_t timecompare_transform(struct timecompare *sync,
+                             u64 source_tstamp)
+{
+       u64 nsec;
+
+       nsec = source_tstamp + sync->offset;
+       nsec += (s64)(source_tstamp - sync->last_update) * sync->skew /
+               TIMECOMPARE_SKEW_RESOLUTION;
+
+       return ns_to_ktime(nsec);
+}
+EXPORT_SYMBOL(timecompare_transform);
+
+int timecompare_offset(struct timecompare *sync,
+                      s64 *offset,
+                      u64 *source_tstamp)
+{
+       u64 start_source = 0, end_source = 0;
+       struct {
+               s64 offset;
+               s64 duration_target;
+       } buffer[10], sample, *samples;
+       int counter = 0, i;
+       int used;
+       int index;
+       int num_samples = sync->num_samples;
+
+       if (num_samples > sizeof(buffer)/sizeof(buffer[0])) {
+               samples = kmalloc(sizeof(*samples) * num_samples, GFP_ATOMIC);
+               if (!samples) {
+                       samples = buffer;
+                       num_samples = sizeof(buffer)/sizeof(buffer[0]);
+               }
+       } else {
+               samples = buffer;
+       }
+
+       /* run until we have enough valid samples, but do not try forever */
+       i = 0;
+       counter = 0;
+       while (1) {
+               u64 ts;
+               ktime_t start, end;
+
+               start = sync->target();
+               ts = timecounter_read(sync->source);
+               end = sync->target();
+
+               if (!i)
+                       start_source = ts;
+
+               /* ignore negative durations */
+               sample.duration_target = ktime_to_ns(ktime_sub(end, start));
+               if (sample.duration_target >= 0) {
+                       /*
+                        * assume symetric delay to and from source:
+                        * average target time corresponds to measured
+                        * source time
+                        */
+                       sample.offset =
+                               ktime_to_ns(ktime_add(end, start)) / 2 -
+                               ts;
+
+                       /* simple insertion sort based on duration */
+                       index = counter - 1;
+                       while (index >= 0) {
+                               if (samples[index].duration_target <
+                                   sample.duration_target)
+                                       break;
+                               samples[index + 1] = samples[index];
+                               index--;
+                       }
+                       samples[index + 1] = sample;
+                       counter++;
+               }
+
+               i++;
+               if (counter >= num_samples || i >= 100000) {
+                       end_source = ts;
+                       break;
+               }
+       }
+
+       *source_tstamp = (end_source + start_source) / 2;
+
+       /* remove outliers by only using 75% of the samples */
+       used = counter * 3 / 4;
+       if (!used)
+               used = counter;
+       if (used) {
+               /* calculate average */
+               s64 off = 0;
+               for (index = 0; index < used; index++)
+                       off += samples[index].offset;
+               *offset = div_s64(off, used);
+       }
+
+       if (samples && samples != buffer)
+               kfree(samples);
+
+       return used;
+}
+EXPORT_SYMBOL(timecompare_offset);
+
+void __timecompare_update(struct timecompare *sync,
+                         u64 source_tstamp)
+{
+       s64 offset;
+       u64 average_time;
+
+       if (!timecompare_offset(sync, &offset, &average_time))
+               return;
+
+       if (!sync->last_update) {
+               sync->last_update = average_time;
+               sync->offset = offset;
+               sync->skew = 0;
+       } else {
+               s64 delta_nsec = average_time - sync->last_update;
+
+               /* avoid division by negative or small deltas */
+               if (delta_nsec >= 10000) {
+                       s64 delta_offset_nsec = offset - sync->offset;
+                       s64 skew; /* delta_offset_nsec *
+                                    TIMECOMPARE_SKEW_RESOLUTION /
+                                    delta_nsec */
+                       u64 divisor;
+
+                       /* div_s64() is limited to 32 bit divisor */
+                       skew = delta_offset_nsec * TIMECOMPARE_SKEW_RESOLUTION;
+                       divisor = delta_nsec;
+                       while (unlikely(divisor >= ((s64)1) << 32)) {
+                               /* divide both by 2; beware, right shift
+                                  of negative value has undefined
+                                  behavior and can only be used for
+                                  the positive divisor */
+                               skew = div_s64(skew, 2);
+                               divisor >>= 1;
+                       }
+                       skew = div_s64(skew, divisor);
+
+                       /*
+                        * Calculate new overall skew as 4/16 the
+                        * old value and 12/16 the new one. This is
+                        * a rather arbitrary tradeoff between
+                        * only using the latest measurement (0/16 and
+                        * 16/16) and even more weight on past measurements.
+                        */
+#define TIMECOMPARE_NEW_SKEW_PER_16 12
+                       sync->skew =
+                               div_s64((16 - TIMECOMPARE_NEW_SKEW_PER_16) *
+                                       sync->skew +
+                                       TIMECOMPARE_NEW_SKEW_PER_16 * skew,
+                                       16);
+                       sync->last_update = average_time;
+                       sync->offset = offset;
+               }
+       }
+}
+EXPORT_SYMBOL(__timecompare_update);
index e2a4ff6fc3a6bb1509472dad03d0ad41df855748..34e707e5ab87f002ab93f0eb70e776cb09704354 100644 (file)
@@ -52,6 +52,7 @@ config FUNCTION_TRACER
        depends on HAVE_FUNCTION_TRACER
        depends on DEBUG_KERNEL
        select FRAME_POINTER
+       select KALLSYMS
        select TRACING
        select CONTEXT_SWITCH_TRACER
        help
@@ -238,6 +239,7 @@ config STACK_TRACER
        depends on DEBUG_KERNEL
        select FUNCTION_TRACER
        select STACKTRACE
+       select KALLSYMS
        help
          This special tracer records the maximum stack footprint of the
          kernel and displays it in debugfs/tracing/stack_trace.
@@ -302,4 +304,27 @@ config FTRACE_STARTUP_TEST
          functioning properly. It will do tests on all the configured
          tracers of ftrace.
 
+config MMIOTRACE
+       bool "Memory mapped IO tracing"
+       depends on HAVE_MMIOTRACE_SUPPORT && DEBUG_KERNEL && PCI
+       select TRACING
+       help
+         Mmiotrace traces Memory Mapped I/O access and is meant for
+         debugging and reverse engineering. It is called from the ioremap
+         implementation and works via page faults. Tracing is disabled by
+         default and can be enabled at run-time.
+
+         See Documentation/tracers/mmiotrace.txt.
+         If you are not helping to develop drivers, say N.
+
+config MMIOTRACE_TEST
+       tristate "Test module for mmiotrace"
+       depends on MMIOTRACE && m
+       help
+         This is a dumb module for testing mmiotrace. It is very dangerous
+         as it will write garbage to IO memory starting at a given address.
+         However, it should be safe to use on e.g. unused portion of VRAM.
+
+         Say N, unless you absolutely know what you are doing.
+
 endmenu
index 7dcf6e9f2b04f46527c7e1a69e1a8bd9fc0c8a0e..fdf913dfc7e8eada7de16b320b62d283b18447a5 100644 (file)
@@ -1737,9 +1737,12 @@ static void clear_ftrace_pid(struct pid *pid)
 {
        struct task_struct *p;
 
+       rcu_read_lock();
        do_each_pid_task(pid, PIDTYPE_PID, p) {
                clear_tsk_trace_trace(p);
        } while_each_pid_task(pid, PIDTYPE_PID, p);
+       rcu_read_unlock();
+
        put_pid(pid);
 }
 
@@ -1747,9 +1750,11 @@ static void set_ftrace_pid(struct pid *pid)
 {
        struct task_struct *p;
 
+       rcu_read_lock();
        do_each_pid_task(pid, PIDTYPE_PID, p) {
                set_tsk_trace_trace(p);
        } while_each_pid_task(pid, PIDTYPE_PID, p);
+       rcu_read_unlock();
 }
 
 static void clear_ftrace_pid_task(struct pid **pid)
@@ -2028,7 +2033,7 @@ free:
 static int start_graph_tracing(void)
 {
        struct ftrace_ret_stack **ret_stack_list;
-       int ret;
+       int ret, cpu;
 
        ret_stack_list = kmalloc(FTRACE_RETSTACK_ALLOC_SIZE *
                                sizeof(struct ftrace_ret_stack *),
@@ -2037,6 +2042,10 @@ static int start_graph_tracing(void)
        if (!ret_stack_list)
                return -ENOMEM;
 
+       /* The cpu_boot init_task->ret_stack will never be freed */
+       for_each_online_cpu(cpu)
+               ftrace_graph_init_task(idle_task(cpu));
+
        do {
                ret = alloc_retstack_tasklist(ret_stack_list);
        } while (ret == -EAGAIN);
index fffcb069f1dcb48213ec0c51a4c8d1774e8235a4..80e503ef6136c208cef128006578ec7227a35678 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/kernel.h>
 #include <linux/mmiotrace.h>
 #include <linux/pci.h>
+#include <asm/atomic.h>
 
 #include "trace.h"
 
@@ -19,6 +20,7 @@ struct header_iter {
 static struct trace_array *mmio_trace_array;
 static bool overrun_detected;
 static unsigned long prev_overruns;
+static atomic_t dropped_count;
 
 static void mmio_reset_data(struct trace_array *tr)
 {
@@ -121,11 +123,11 @@ static void mmio_close(struct trace_iterator *iter)
 
 static unsigned long count_overruns(struct trace_iterator *iter)
 {
-       unsigned long cnt = 0;
+       unsigned long cnt = atomic_xchg(&dropped_count, 0);
        unsigned long over = ring_buffer_overruns(iter->tr->buffer);
 
        if (over > prev_overruns)
-               cnt = over - prev_overruns;
+               cnt += over - prev_overruns;
        prev_overruns = over;
        return cnt;
 }
@@ -310,8 +312,10 @@ static void __trace_mmiotrace_rw(struct trace_array *tr,
 
        event   = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
                                           &irq_flags);
-       if (!event)
+       if (!event) {
+               atomic_inc(&dropped_count);
                return;
+       }
        entry   = ring_buffer_event_data(event);
        tracing_generic_entry_update(&entry->ent, 0, preempt_count());
        entry->ent.type                 = TRACE_MMIO_RW;
@@ -338,8 +342,10 @@ static void __trace_mmiotrace_map(struct trace_array *tr,
 
        event   = ring_buffer_lock_reserve(tr->buffer, sizeof(*entry),
                                           &irq_flags);
-       if (!event)
+       if (!event) {
+               atomic_inc(&dropped_count);
                return;
+       }
        entry   = ring_buffer_event_data(event);
        tracing_generic_entry_update(&entry->ent, 0, preempt_count());
        entry->ent.type                 = TRACE_MMIO_MAP;
index 88c8eb70f54aeb3508dda9c668f082b9a43b0c78..bc8e80a86bca4c0cf730fcf6b7bc568f2808f7e7 100644 (file)
@@ -23,10 +23,20 @@ static int trace_test_buffer_cpu(struct trace_array *tr, int cpu)
 {
        struct ring_buffer_event *event;
        struct trace_entry *entry;
+       unsigned int loops = 0;
 
        while ((event = ring_buffer_consume(tr->buffer, cpu, NULL))) {
                entry = ring_buffer_event_data(event);
 
+               /*
+                * The ring buffer is a size of trace_buf_size, if
+                * we loop more than the size, there's something wrong
+                * with the ring buffer.
+                */
+               if (loops++ > trace_buf_size) {
+                       printk(KERN_CONT ".. bad ring buffer ");
+                       goto failed;
+               }
                if (!trace_valid_entry(entry)) {
                        printk(KERN_CONT ".. invalid entry %d ",
                                entry->type);
@@ -57,11 +67,20 @@ static int trace_test_buffer(struct trace_array *tr, unsigned long *count)
 
        cnt = ring_buffer_entries(tr->buffer);
 
+       /*
+        * The trace_test_buffer_cpu runs a while loop to consume all data.
+        * If the calling tracer is broken, and is constantly filling
+        * the buffer, this will run forever, and hard lock the box.
+        * We disable the ring buffer while we do this test to prevent
+        * a hard lock up.
+        */
+       tracing_off();
        for_each_possible_cpu(cpu) {
                ret = trace_test_buffer_cpu(tr, cpu);
                if (ret)
                        break;
        }
+       tracing_on();
        __raw_spin_unlock(&ftrace_max_lock);
        local_irq_restore(flags);
 
index 477b6660f447e639a8b181d456c7c4e64e30b008..3551ac742395c40af9edeb7d94d0d0b936caba9b 100644 (file)
@@ -72,6 +72,7 @@ static void uid_hash_insert(struct user_struct *up, struct hlist_head *hashent)
 static void uid_hash_remove(struct user_struct *up)
 {
        hlist_del_init(&up->uidhash_node);
+       put_user_ns(up->user_ns);
 }
 
 static struct user_struct *uid_hash_find(uid_t uid, struct hlist_head *hashent)
@@ -334,7 +335,6 @@ static void free_user(struct user_struct *up, unsigned long flags)
        atomic_inc(&up->__count);
        spin_unlock_irqrestore(&uidhash_lock, flags);
 
-       put_user_ns(up->user_ns);
        INIT_WORK(&up->work, remove_user_sysfs_dir);
        schedule_work(&up->work);
 }
@@ -357,7 +357,6 @@ static void free_user(struct user_struct *up, unsigned long flags)
        sched_destroy_user(up);
        key_put(up->uid_keyring);
        key_put(up->session_keyring);
-       put_user_ns(up->user_ns);
        kmem_cache_free(uid_cachep, up);
 }
 
index cd87131f2fc2aa138aa1bc818f5efab612c3085c..42a2dbc181c89ca708360d84ee53a5ca21640b44 100644 (file)
@@ -91,6 +91,15 @@ prepare_to_wait_exclusive(wait_queue_head_t *q, wait_queue_t *wait, int state)
 }
 EXPORT_SYMBOL(prepare_to_wait_exclusive);
 
+/*
+ * finish_wait - clean up after waiting in a queue
+ * @q: waitqueue waited on
+ * @wait: wait descriptor
+ *
+ * Sets current thread back to running state and removes
+ * the wait descriptor from the given waitqueue if still
+ * queued.
+ */
 void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
 {
        unsigned long flags;
@@ -117,6 +126,39 @@ void finish_wait(wait_queue_head_t *q, wait_queue_t *wait)
 }
 EXPORT_SYMBOL(finish_wait);
 
+/*
+ * abort_exclusive_wait - abort exclusive waiting in a queue
+ * @q: waitqueue waited on
+ * @wait: wait descriptor
+ * @state: runstate of the waiter to be woken
+ * @key: key to identify a wait bit queue or %NULL
+ *
+ * Sets current thread back to running state and removes
+ * the wait descriptor from the given waitqueue if still
+ * queued.
+ *
+ * Wakes up the next waiter if the caller is concurrently
+ * woken up through the queue.
+ *
+ * This prevents waiter starvation where an exclusive waiter
+ * aborts and is woken up concurrently and noone wakes up
+ * the next waiter.
+ */
+void abort_exclusive_wait(wait_queue_head_t *q, wait_queue_t *wait,
+                       unsigned int mode, void *key)
+{
+       unsigned long flags;
+
+       __set_current_state(TASK_RUNNING);
+       spin_lock_irqsave(&q->lock, flags);
+       if (!list_empty(&wait->task_list))
+               list_del_init(&wait->task_list);
+       else if (waitqueue_active(q))
+               __wake_up_common(q, mode, 1, 0, key);
+       spin_unlock_irqrestore(&q->lock, flags);
+}
+EXPORT_SYMBOL(abort_exclusive_wait);
+
 int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key)
 {
        int ret = default_wake_function(wait, mode, sync, key);
@@ -177,17 +219,20 @@ int __sched
 __wait_on_bit_lock(wait_queue_head_t *wq, struct wait_bit_queue *q,
                        int (*action)(void *), unsigned mode)
 {
-       int ret = 0;
-
        do {
+               int ret;
+
                prepare_to_wait_exclusive(wq, &q->wait, mode);
-               if (test_bit(q->key.bit_nr, q->key.flags)) {
-                       if ((ret = (*action)(q->key.flags)))
-                               break;
-               }
+               if (!test_bit(q->key.bit_nr, q->key.flags))
+                       continue;
+               ret = action(q->key.flags);
+               if (!ret)
+                       continue;
+               abort_exclusive_wait(wq, &q->wait, mode, &q->key);
+               return ret;
        } while (test_and_set_bit(q->key.bit_nr, q->key.flags));
        finish_wait(wq, &q->wait);
-       return ret;
+       return 0;
 }
 EXPORT_SYMBOL(__wait_on_bit_lock);
 
index 29044f500269c3b9ad9b834adc21a77557ac897b..1bcf9cd4baa08a85633e5758721b7ef21f4df787 100644 (file)
@@ -838,7 +838,7 @@ config FIREWIRE_OHCI_REMOTE_DMA
 
          If unsure, say N.
 
-menuconfig BUILD_DOCSRC
+config BUILD_DOCSRC
        bool "Build targets in Documentation/ tree"
        depends on HEADERS_CHECK
        help
index 318328ddbd1cf57b89cc84dc63b2818b480231d9..38131028d16f87c9eb2685c08ce9a7af45fa2daa 100644 (file)
@@ -227,6 +227,9 @@ int kobject_uevent_env(struct kobject *kobj, enum kobject_action action,
                        NETLINK_CB(skb).dst_group = 1;
                        retval = netlink_broadcast(uevent_sock, skb, 0, 1,
                                                   GFP_KERNEL);
+                       /* ENOBUFS should be handled in userspace */
+                       if (retval == -ENOBUFS)
+                               retval = 0;
                } else
                        retval = -ENOMEM;
        }
index 736ba7f3306a1078fa851fd3dce755205162abfc..b6ec85abbb39cc22dac7e9c309953c60a22e921c 100644 (file)
@@ -198,7 +198,7 @@ SYSCALL_DEFINE5(remap_file_pages, unsigned long, start, unsigned long, size,
                        flags &= MAP_NONBLOCK;
                        get_file(file);
                        addr = mmap_region(file, start, size,
-                                       flags, vma->vm_flags, pgoff, 1);
+                                       flags, vma->vm_flags, pgoff);
                        fput(file);
                        if (IS_ERR_VALUE(addr)) {
                                err = addr;
index 618e98304080a8bdb3ace929c8dcb8938662fad4..107da3d809a87b0ad13e57256a050763a0b3d17b 100644 (file)
@@ -2269,12 +2269,18 @@ void hugetlb_change_protection(struct vm_area_struct *vma,
 
 int hugetlb_reserve_pages(struct inode *inode,
                                        long from, long to,
-                                       struct vm_area_struct *vma)
+                                       struct vm_area_struct *vma,
+                                       int acctflag)
 {
        long ret, chg;
        struct hstate *h = hstate_inode(inode);
 
-       if (vma && vma->vm_flags & VM_NORESERVE)
+       /*
+        * Only apply hugepage reservation if asked. At fault time, an
+        * attempt will be made for VM_NORESERVE to allocate a page
+        * and filesystem quota without using reserves
+        */
+       if (acctflag & VM_NORESERVE)
                return 0;
 
        /*
@@ -2299,13 +2305,31 @@ int hugetlb_reserve_pages(struct inode *inode,
        if (chg < 0)
                return chg;
 
+       /* There must be enough filesystem quota for the mapping */
        if (hugetlb_get_quota(inode->i_mapping, chg))
                return -ENOSPC;
+
+       /*
+        * Check enough hugepages are available for the reservation.
+        * Hand back the quota if there are not
+        */
        ret = hugetlb_acct_memory(h, chg);
        if (ret < 0) {
                hugetlb_put_quota(inode->i_mapping, chg);
                return ret;
        }
+
+       /*
+        * Account for the reservations made. Shared mappings record regions
+        * that have reservations as they are shared by multiple VMAs.
+        * When the last VMA disappears, the region map says how much
+        * the reservation was and the page cache tells how much of
+        * the reservation was consumed. Private mappings are per-VMA and
+        * only the consumed reservations are tracked. When the VMA
+        * disappears, the original reservation is the VMA size and the
+        * consumed reservations are stored in the map. Hence, nothing
+        * else has to be done for private mappings here
+        */
        if (!vma || vma->vm_flags & VM_SHARED)
                region_add(&inode->i_mapping->private_list, from, to);
        return 0;
index 22bfa7a47a0b613cf9c39ee6e7d24f7dc3c9cf77..baa999e87cd21d2f9e67c8e3b1093bb6831513fb 100644 (file)
@@ -1999,7 +1999,7 @@ gotten:
         * Don't let another task, with possibly unlocked vma,
         * keep the mlocked page.
         */
-       if (vma->vm_flags & VM_LOCKED) {
+       if ((vma->vm_flags & VM_LOCKED) && old_page) {
                lock_page(old_page);    /* for LRU manipulation */
                clear_page_mlock(old_page);
                unlock_page(old_page);
index 2bb4e1d6352046e9030a789a9b78c385cd104c5b..a9eff3f092f622a451753a1dc155f5b7fbdd7ab6 100644 (file)
@@ -1129,7 +1129,7 @@ int migrate_vmas(struct mm_struct *mm, const nodemask_t *to,
        struct vm_area_struct *vma;
        int err = 0;
 
-       for(vma = mm->mmap; vma->vm_next && !err; vma = vma->vm_next) {
+       for (vma = mm->mmap; vma && !err; vma = vma->vm_next) {
                if (vma->vm_ops && vma->vm_ops->migrate) {
                        err = vma->vm_ops->migrate(vma, to, from, flags);
                        if (err)
index 028ec482fdd44488db7b562358770c80ea60f49b..cbe9e0581b75dcaf06335ccc017a68789d6247d2 100644 (file)
@@ -311,7 +311,10 @@ long mlock_vma_pages_range(struct vm_area_struct *vma,
                        is_vm_hugetlb_page(vma) ||
                        vma == get_gate_vma(current))) {
 
-               return __mlock_vma_pages_range(vma, start, end, 1);
+               __mlock_vma_pages_range(vma, start, end, 1);
+
+               /* Hide errors from mmap() and other callers */
+               return 0;
        }
 
        /*
@@ -657,7 +660,7 @@ void *alloc_locked_buffer(size_t size)
        return buffer;
 }
 
-void free_locked_buffer(void *buffer, size_t size)
+void release_locked_buffer(void *buffer, size_t size)
 {
        unsigned long pgsz = PAGE_ALIGN(size) >> PAGE_SHIFT;
 
@@ -667,6 +670,11 @@ void free_locked_buffer(void *buffer, size_t size)
        current->mm->locked_vm -= pgsz;
 
        up_write(&current->mm->mmap_sem);
+}
+
+void free_locked_buffer(void *buffer, size_t size)
+{
+       release_locked_buffer(buffer, size);
 
        kfree(buffer);
 }
index 214b6a258eeb6f807f2cf8ae11f02c4ae9c78005..00ced3ee49a8cd393d199656fc816980d4e7b1e6 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -918,7 +918,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
        struct inode *inode;
        unsigned int vm_flags;
        int error;
-       int accountable = 1;
        unsigned long reqprot = prot;
 
        /*
@@ -1019,8 +1018,6 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
                                        return -EPERM;
                                vm_flags &= ~VM_MAYEXEC;
                        }
-                       if (is_file_hugepages(file))
-                               accountable = 0;
 
                        if (!file->f_op || !file->f_op->mmap)
                                return -ENODEV;
@@ -1053,8 +1050,7 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
        if (error)
                return error;
 
-       return mmap_region(file, addr, len, flags, vm_flags, pgoff,
-                          accountable);
+       return mmap_region(file, addr, len, flags, vm_flags, pgoff);
 }
 EXPORT_SYMBOL(do_mmap_pgoff);
 
@@ -1092,17 +1088,23 @@ int vma_wants_writenotify(struct vm_area_struct *vma)
 
 /*
  * We account for memory if it's a private writeable mapping,
- * and VM_NORESERVE wasn't set.
+ * not hugepages and VM_NORESERVE wasn't set.
  */
-static inline int accountable_mapping(unsigned int vm_flags)
+static inline int accountable_mapping(struct file *file, unsigned int vm_flags)
 {
+       /*
+        * hugetlb has its own accounting separate from the core VM
+        * VM_HUGETLB may not be set yet so we cannot check for that flag.
+        */
+       if (file && is_file_hugepages(file))
+               return 0;
+
        return (vm_flags & (VM_NORESERVE | VM_SHARED | VM_WRITE)) == VM_WRITE;
 }
 
 unsigned long mmap_region(struct file *file, unsigned long addr,
                          unsigned long len, unsigned long flags,
-                         unsigned int vm_flags, unsigned long pgoff,
-                         int accountable)
+                         unsigned int vm_flags, unsigned long pgoff)
 {
        struct mm_struct *mm = current->mm;
        struct vm_area_struct *vma, *prev;
@@ -1128,18 +1130,22 @@ munmap_back:
 
        /*
         * Set 'VM_NORESERVE' if we should not account for the
-        * memory use of this mapping. We only honor MAP_NORESERVE
-        * if we're allowed to overcommit memory.
+        * memory use of this mapping.
         */
-       if ((flags & MAP_NORESERVE) && sysctl_overcommit_memory != OVERCOMMIT_NEVER)
-               vm_flags |= VM_NORESERVE;
-       if (!accountable)
-               vm_flags |= VM_NORESERVE;
+       if ((flags & MAP_NORESERVE)) {
+               /* We honor MAP_NORESERVE if allowed to overcommit */
+               if (sysctl_overcommit_memory != OVERCOMMIT_NEVER)
+                       vm_flags |= VM_NORESERVE;
+
+               /* hugetlb applies strict overcommit unless MAP_NORESERVE */
+               if (file && is_file_hugepages(file))
+                       vm_flags |= VM_NORESERVE;
+       }
 
        /*
         * Private writable mapping: check memory availability
         */
-       if (accountable_mapping(vm_flags)) {
+       if (accountable_mapping(file, vm_flags)) {
                charged = len >> PAGE_SHIFT;
                if (security_vm_enough_memory(charged))
                        return -ENOMEM;
@@ -2078,12 +2084,8 @@ void exit_mmap(struct mm_struct *mm)
        unsigned long end;
 
        /* mm's last user has gone, and its about to be pulled down */
-       arch_exit_mmap(mm);
        mmu_notifier_release(mm);
 
-       if (!mm->mmap)  /* Can happen if dup_mmap() received an OOM */
-               return;
-
        if (mm->locked_vm) {
                vma = mm->mmap;
                while (vma) {
@@ -2092,7 +2094,13 @@ void exit_mmap(struct mm_struct *mm)
                        vma = vma->vm_next;
                }
        }
+
+       arch_exit_mmap(mm);
+
        vma = mm->mmap;
+       if (!vma)       /* Can happen if dup_mmap() received an OOM */
+               return;
+
        lru_add_drain();
        flush_cache_mm(mm);
        tlb = tlb_gather_mmu(mm, 1);
index abe2694e13f497ea8ecaa443fa6d7d11a5edb084..258197b76fb4142d01b81d7871fddbca80510114 100644 (file)
@@ -151,10 +151,11 @@ mprotect_fixup(struct vm_area_struct *vma, struct vm_area_struct **pprev,
        /*
         * If we make a private mapping writable we increase our commit;
         * but (without finer accounting) cannot reduce our commit if we
-        * make it unwritable again.
+        * make it unwritable again. hugetlb mapping were accounted for
+        * even if read-only so there is no need to account for them here
         */
        if (newflags & VM_WRITE) {
-               if (!(oldflags & (VM_ACCOUNT|VM_WRITE|
+               if (!(oldflags & (VM_ACCOUNT|VM_WRITE|VM_HUGETLB|
                                                VM_SHARED|VM_NORESERVE))) {
                        charged = nrpages;
                        if (security_vm_enough_memory(charged))
index b493db7841dc6c2db77d10eab751f6e1f62e7355..74dc57c74349ff124dd31a3e04531ee503ecedca 100644 (file)
@@ -209,7 +209,7 @@ int dirty_bytes_handler(struct ctl_table *table, int write,
                struct file *filp, void __user *buffer, size_t *lenp,
                loff_t *ppos)
 {
-       int old_bytes = vm_dirty_bytes;
+       unsigned long old_bytes = vm_dirty_bytes;
        int ret;
 
        ret = proc_doulongvec_minmax(table, write, filp, buffer, lenp, ppos);
@@ -240,7 +240,7 @@ void bdi_writeout_inc(struct backing_dev_info *bdi)
 }
 EXPORT_SYMBOL_GPL(bdi_writeout_inc);
 
-static inline void task_dirty_inc(struct task_struct *tsk)
+void task_dirty_inc(struct task_struct *tsk)
 {
        prop_inc_single(&vm_dirties, &tsk->dirties);
 }
@@ -1051,13 +1051,25 @@ continue_unlock:
                                }
                        }
 
-                       if (wbc->sync_mode == WB_SYNC_NONE) {
-                               wbc->nr_to_write--;
-                               if (wbc->nr_to_write <= 0) {
+                       if (nr_to_write > 0) {
+                               nr_to_write--;
+                               if (nr_to_write == 0 &&
+                                   wbc->sync_mode == WB_SYNC_NONE) {
+                                       /*
+                                        * We stop writing back only if we are
+                                        * not doing integrity sync. In case of
+                                        * integrity sync we have to keep going
+                                        * because someone may be concurrently
+                                        * dirtying pages, and we might have
+                                        * synced a lot of newly appeared dirty
+                                        * pages, but have not synced all of the
+                                        * old dirty pages.
+                                        */
                                        done = 1;
                                        break;
                                }
                        }
+
                        if (wbc->nonblocking && bdi_write_congested(bdi)) {
                                wbc->encountered_congestion = 1;
                                done = 1;
@@ -1067,7 +1079,7 @@ continue_unlock:
                pagevec_release(&pvec);
                cond_resched();
        }
-       if (!cycled) {
+       if (!cycled && !done) {
                /*
                 * range_cyclic:
                 * We hit the last page and there is more work to be done: wrap
@@ -1218,6 +1230,7 @@ int __set_page_dirty_nobuffers(struct page *page)
                                __inc_zone_page_state(page, NR_FILE_DIRTY);
                                __inc_bdi_stat(mapping->backing_dev_info,
                                                BDI_RECLAIMABLE);
+                               task_dirty_inc(current);
                                task_io_account_write(PAGE_CACHE_SIZE);
                        }
                        radix_tree_tag_set(&mapping->page_tree,
@@ -1250,7 +1263,7 @@ EXPORT_SYMBOL(redirty_page_for_writepage);
  * If the mapping doesn't provide a set_page_dirty a_op, then
  * just fall through and assume that it wants buffer_heads.
  */
-static int __set_page_dirty(struct page *page)
+int set_page_dirty(struct page *page)
 {
        struct address_space *mapping = page_mapping(page);
 
@@ -1268,14 +1281,6 @@ static int __set_page_dirty(struct page *page)
        }
        return 0;
 }
-
-int set_page_dirty(struct page *page)
-{
-       int ret = __set_page_dirty(page);
-       if (ret)
-               task_dirty_inc(current);
-       return ret;
-}
 EXPORT_SYMBOL(set_page_dirty);
 
 /*
index 5675b30738546451c47771e5703f06830a63898a..5c44ed49ca93c5a1d7a39f5570b0d1254a45de80 100644 (file)
@@ -2989,7 +2989,7 @@ static int __meminit next_active_region_index_in_nid(int index, int nid)
  * was used and there are no special requirements, this is a convenient
  * alternative
  */
-int __meminit early_pfn_to_nid(unsigned long pfn)
+int __meminit __early_pfn_to_nid(unsigned long pfn)
 {
        int i;
 
@@ -3000,10 +3000,33 @@ int __meminit early_pfn_to_nid(unsigned long pfn)
                if (start_pfn <= pfn && pfn < end_pfn)
                        return early_node_map[i].nid;
        }
+       /* This is a memory hole */
+       return -1;
+}
+#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
+
+int __meminit early_pfn_to_nid(unsigned long pfn)
+{
+       int nid;
 
+       nid = __early_pfn_to_nid(pfn);
+       if (nid >= 0)
+               return nid;
+       /* just returns 0 */
        return 0;
 }
-#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
+
+#ifdef CONFIG_NODES_SPAN_OTHER_NODES
+bool __meminit early_pfn_in_nid(unsigned long pfn, int node)
+{
+       int nid;
+
+       nid = __early_pfn_to_nid(pfn);
+       if (nid >= 0 && nid != node)
+               return false;
+       return true;
+}
+#endif
 
 /* Basic iterator support to walk early_node_map[] */
 #define for_each_active_range_index_in_nid(i, nid) \
index 7006a11350c822b7e8e34c0c2813667ae357a839..ceecfbb143fa9d7b2a3f9ffb4ca9980da6bc0b53 100644 (file)
@@ -114,7 +114,8 @@ static int __init_refok init_section_page_cgroup(unsigned long pfn)
                nid = page_to_nid(pfn_to_page(pfn));
                table_size = sizeof(struct page_cgroup) * PAGES_PER_SECTION;
                if (slab_is_available()) {
-                       base = kmalloc_node(table_size, GFP_KERNEL, nid);
+                       base = kmalloc_node(table_size,
+                                       GFP_KERNEL | __GFP_NOWARN, nid);
                        if (!base)
                                base = vmalloc_node(table_size, nid);
                } else {
index dc6ce0afbded84abdfa553300e6ac9d06e00d0a9..3023c475e0415fc0c6ec537a556e6d3835a2b1d9 100644 (file)
@@ -111,7 +111,7 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
                goto out;
        }
        if (wbc->sync_mode == WB_SYNC_ALL)
-               rw |= (1 << BIO_RW_SYNC);
+               rw |= (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG);
        count_vm_event(PSWPOUT);
        set_page_writeback(page);
        unlock_page(page);
index ac4af8cffbf952757dfd11df4b5a9789d5d95a1f..16521664010ddc06b5dfb25303413bedb6a58041 100644 (file)
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@ -1072,7 +1072,8 @@ static int try_to_unmap_file(struct page *page, int unlock, int migration)
        spin_lock(&mapping->i_mmap_lock);
        vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
                if (MLOCK_PAGES && unlikely(unlock)) {
-                       if (!(vma->vm_flags & VM_LOCKED))
+                       if (!((vma->vm_flags & VM_LOCKED) &&
+                                               page_mapped_in_vma(page, vma)))
                                continue;       /* must visit all vmas */
                        ret = SWAP_MLOCK;
                } else {
index ddc41f337d587750122f54a44806a8a29a0a67c2..4d00855629c4921e3c590406335549683e6c6daf 100644 (file)
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -4457,3 +4457,4 @@ size_t ksize(const void *objp)
 
        return obj_size(virt_to_cache(objp));
 }
+EXPORT_SYMBOL(ksize);
index bf7e8fc3aed806542e44cc7b1d222d9e2b56dc3a..52bc8a2bd9efe71b0df16d068abcefe282a3dfc1 100644 (file)
--- a/mm/slob.c
+++ b/mm/slob.c
@@ -521,6 +521,7 @@ size_t ksize(const void *block)
        } else
                return sp->page.private;
 }
+EXPORT_SYMBOL(ksize);
 
 struct kmem_cache {
        unsigned int size, align;
index bdc9abb08a230f2724ad842a0bc4928da0e48d23..0280eee6cf3768479760e6e564e9364d6a83e346 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2736,6 +2736,7 @@ size_t ksize(const void *object)
         */
        return s->size;
 }
+EXPORT_SYMBOL(ksize);
 
 void kfree(const void *x)
 {
index 7e6304dfafab174884bad5820a0194f449906a32..312fafe0ab6ed4815ac02da3f712aca18bacbbad 100644 (file)
@@ -635,7 +635,7 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
 
                if (!bdev) {
                        if (bdev_p)
-                               *bdev_p = sis->bdev;
+                               *bdev_p = bdget(sis->bdev->bd_dev);
 
                        spin_unlock(&swap_lock);
                        return i;
@@ -647,7 +647,7 @@ int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p)
                                        struct swap_extent, list);
                        if (se->start_block == offset) {
                                if (bdev_p)
-                                       *bdev_p = sis->bdev;
+                                       *bdev_p = bdget(sis->bdev->bd_dev);
 
                                spin_unlock(&swap_lock);
                                bdput(bdev);
index cb00b748ce47886446975d96466c2154f4d52fa3..37eaccdf3054e13d60cd83cf5c6cb9869731aec1 100644 (file)
--- a/mm/util.c
+++ b/mm/util.c
@@ -129,6 +129,26 @@ void *krealloc(const void *p, size_t new_size, gfp_t flags)
 }
 EXPORT_SYMBOL(krealloc);
 
+/**
+ * kzfree - like kfree but zero memory
+ * @p: object to free memory of
+ *
+ * The memory of the object @p points to is zeroed before freed.
+ * If @p is %NULL, kzfree() does nothing.
+ */
+void kzfree(const void *p)
+{
+       size_t ks;
+       void *mem = (void *)p;
+
+       if (unlikely(ZERO_OR_NULL_PTR(mem)))
+               return;
+       ks = ksize(mem);
+       memset(mem, 0, ks);
+       kfree(mem);
+}
+EXPORT_SYMBOL(kzfree);
+
 /*
  * strndup_user - duplicate an existing string from user space
  * @s: The string to duplicate
index 75f49d312e8c1d47648f3e96b8a1eb6d14076405..903cad46e796b94bde12306efbce62b532be3713 100644 (file)
@@ -1012,6 +1012,8 @@ void __init vmalloc_init(void)
 void unmap_kernel_range(unsigned long addr, unsigned long size)
 {
        unsigned long end = addr + size;
+
+       flush_cache_vunmap(addr, end);
        vunmap_page_range(addr, end);
        flush_tlb_kernel_range(addr, end);
 }
@@ -1106,6 +1108,14 @@ struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
 }
 EXPORT_SYMBOL_GPL(__get_vm_area);
 
+struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags,
+                                      unsigned long start, unsigned long end,
+                                      void *caller)
+{
+       return __get_vm_area_node(size, flags, start, end, -1, GFP_KERNEL,
+                                 caller);
+}
+
 /**
  *     get_vm_area  -  reserve a contiguous kernel virtual area
  *     @size:          size of the area
index 9a27c44aa327f8f46ddbde07776df8644db82de5..6177e3bcd66bdc7b8fc74cb583d47bb89c4940ef 100644 (file)
@@ -2057,31 +2057,31 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio,
                                      int pass, struct scan_control *sc)
 {
        struct zone *zone;
-       unsigned long nr_to_scan, ret = 0;
-       enum lru_list l;
+       unsigned long ret = 0;
 
        for_each_zone(zone) {
+               enum lru_list l;
 
                if (!populated_zone(zone))
                        continue;
-
                if (zone_is_all_unreclaimable(zone) && prio != DEF_PRIORITY)
                        continue;
 
                for_each_evictable_lru(l) {
+                       enum zone_stat_item ls = NR_LRU_BASE + l;
+                       unsigned long lru_pages = zone_page_state(zone, ls);
+
                        /* For pass = 0, we don't shrink the active list */
-                       if (pass == 0 &&
-                               (l == LRU_ACTIVE || l == LRU_ACTIVE_FILE))
+                       if (pass == 0 && (l == LRU_ACTIVE_ANON ||
+                                               l == LRU_ACTIVE_FILE))
                                continue;
 
-                       zone->lru[l].nr_scan +=
-                               (zone_page_state(zone, NR_LRU_BASE + l)
-                                                               >> prio) + 1;
+                       zone->lru[l].nr_scan += (lru_pages >> prio) + 1;
                        if (zone->lru[l].nr_scan >= nr_pages || pass > 3) {
+                               unsigned long nr_to_scan;
+
                                zone->lru[l].nr_scan = 0;
-                               nr_to_scan = min(nr_pages,
-                                       zone_page_state(zone,
-                                                       NR_LRU_BASE + l));
+                               nr_to_scan = min(nr_pages, lru_pages);
                                ret += shrink_list(l, nr_to_scan, zone,
                                                                sc, prio);
                                if (ret >= nr_pages)
@@ -2089,7 +2089,6 @@ static unsigned long shrink_all_zones(unsigned long nr_pages, int prio,
                        }
                }
        }
-
        return ret;
 }
 
@@ -2112,7 +2111,6 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
                .may_swap = 0,
                .swap_cluster_max = nr_pages,
                .may_writepage = 1,
-               .swappiness = vm_swappiness,
                .isolate_pages = isolate_pages_global,
        };
 
@@ -2146,10 +2144,8 @@ unsigned long shrink_all_memory(unsigned long nr_pages)
                int prio;
 
                /* Force reclaiming mapped pages in the passes #3 and #4 */
-               if (pass > 2) {
+               if (pass > 2)
                        sc.may_swap = 1;
-                       sc.swappiness = 100;
-               }
 
                for (prio = DEF_PRIORITY; prio >= 0; prio--) {
                        unsigned long nr_to_scan = nr_pages - ret;
index 70980baeb68297bdc629b27f8ea63f68b0a9e04a..bdbffa3cb043dda64d16d07874cdaf97a8b71dd7 100644 (file)
@@ -51,7 +51,7 @@ static int snap_rcv(struct sk_buff *skb, struct net_device *dev,
        int rc = 1;
        struct datalink_proto *proto;
        static struct packet_type snap_packet_type = {
-               .type = __constant_htons(ETH_P_SNAP),
+               .type = cpu_to_be16(ETH_P_SNAP),
        };
 
        if (unlikely(!pskb_may_pull(skb, 5)))
@@ -95,15 +95,16 @@ static int snap_request(struct datalink_proto *dl,
 EXPORT_SYMBOL(register_snap_client);
 EXPORT_SYMBOL(unregister_snap_client);
 
-static char snap_err_msg[] __initdata =
+static const char snap_err_msg[] __initconst =
        KERN_CRIT "SNAP - unable to register with 802.2\n";
 
 static int __init snap_init(void)
 {
        snap_sap = llc_sap_open(0xAA, snap_rcv);
-
-       if (!snap_sap)
+       if (!snap_sap) {
                printk(snap_err_msg);
+               return -EBUSY;
+       }
 
        return 0;
 }
index 41e8f65bd3f0f6ea0a121ad4bc48f68ffd569a61..4163ea65bf4152c40d29f978f4e75f7fbe6e10dc 100644 (file)
@@ -52,7 +52,7 @@ static const char vlan_copyright[] = "Ben Greear <greearb@candelatech.com>";
 static const char vlan_buggyright[] = "David S. Miller <davem@redhat.com>";
 
 static struct packet_type vlan_packet_type = {
-       .type = __constant_htons(ETH_P_8021Q),
+       .type = cpu_to_be16(ETH_P_8021Q),
        .func = vlan_skb_recv, /* VLAN receive method */
 };
 
index e9db889d6222c466e6ad2a896dcdcdfd8d7d2d94..70435af153f24c56b6dba620a0b44852e2580ad9 100644 (file)
@@ -85,7 +85,9 @@ static int vlan_gro_common(struct napi_struct *napi, struct vlan_group *grp,
                goto drop;
 
        for (p = napi->gro_list; p; p = p->next) {
-               NAPI_GRO_CB(p)->same_flow = p->dev == skb->dev;
+               NAPI_GRO_CB(p)->same_flow =
+                       p->dev == skb->dev && !compare_ether_header(
+                               skb_mac_header(p), skb_gro_mac_header(skb));
                NAPI_GRO_CB(p)->flush = 0;
        }
 
@@ -98,22 +100,9 @@ drop:
 int vlan_gro_receive(struct napi_struct *napi, struct vlan_group *grp,
                     unsigned int vlan_tci, struct sk_buff *skb)
 {
-       int err = NET_RX_SUCCESS;
+       skb_gro_reset_offset(skb);
 
-       switch (vlan_gro_common(napi, grp, vlan_tci, skb)) {
-       case -1:
-               return netif_receive_skb(skb);
-
-       case 2:
-               err = NET_RX_DROP;
-               /* fall through */
-
-       case 1:
-               kfree_skb(skb);
-               break;
-       }
-
-       return err;
+       return napi_skb_finish(vlan_gro_common(napi, grp, vlan_tci, skb), skb);
 }
 EXPORT_SYMBOL(vlan_gro_receive);
 
@@ -121,27 +110,11 @@ int vlan_gro_frags(struct napi_struct *napi, struct vlan_group *grp,
                   unsigned int vlan_tci, struct napi_gro_fraginfo *info)
 {
        struct sk_buff *skb = napi_fraginfo_skb(napi, info);
-       int err = NET_RX_DROP;
 
        if (!skb)
-               goto out;
-
-       err = NET_RX_SUCCESS;
-
-       switch (vlan_gro_common(napi, grp, vlan_tci, skb)) {
-       case -1:
-               return netif_receive_skb(skb);
-
-       case 2:
-               err = NET_RX_DROP;
-               /* fall through */
-
-       case 1:
-               napi_reuse_skb(napi, skb);
-               break;
-       }
+               return NET_RX_DROP;
 
-out:
-       return err;
+       return napi_frags_finish(napi, skb,
+                                vlan_gro_common(napi, grp, vlan_tci, skb));
 }
 EXPORT_SYMBOL(vlan_gro_frags);
index cdb8fdef6c4aaac30b1ba6cf5ace134ea6bfcb89..a12bae0e3fe9b59f5df801b7e0bc417a2f0847c7 100644 (file)
@@ -185,6 +185,7 @@ source "net/x25/Kconfig"
 source "net/lapb/Kconfig"
 source "net/econet/Kconfig"
 source "net/wanrouter/Kconfig"
+source "net/phonet/Kconfig"
 source "net/sched/Kconfig"
 source "net/dcb/Kconfig"
 
@@ -229,7 +230,6 @@ source "net/can/Kconfig"
 source "net/irda/Kconfig"
 source "net/bluetooth/Kconfig"
 source "net/rxrpc/Kconfig"
-source "net/phonet/Kconfig"
 
 config FIB_RULES
        bool
index 5abce07fb50a195b1f280af8dbe588e2fefc2d6c..510a6782da8f83e70a324c21cb0d47b976e2f952 100644 (file)
@@ -1861,12 +1861,12 @@ static struct notifier_block ddp_notifier = {
 };
 
 static struct packet_type ltalk_packet_type = {
-       .type           = __constant_htons(ETH_P_LOCALTALK),
+       .type           = cpu_to_be16(ETH_P_LOCALTALK),
        .func           = ltalk_rcv,
 };
 
 static struct packet_type ppptalk_packet_type = {
-       .type           = __constant_htons(ETH_P_PPPTALK),
+       .type           = cpu_to_be16(ETH_P_PPPTALK),
        .func           = atalk_rcv,
 };
 
index d856a62ab50fda448896689ff210e235dc8d0e6d..72277d70c980be38035f11bc7aae0a1be46b8398 100644 (file)
@@ -9,22 +9,20 @@
 #include <linux/if_arp.h>
 #include <linux/if_ltalk.h>
 
+#ifdef CONFIG_COMPAT_NET_DEV_OPS
 static int ltalk_change_mtu(struct net_device *dev, int mtu)
 {
        return -EINVAL;
 }
-
-static int ltalk_mac_addr(struct net_device *dev, void *addr)
-{
-       return -EINVAL;
-}
+#endif
 
 static void ltalk_setup(struct net_device *dev)
 {
        /* Fill in the fields of the device structure with localtalk-generic values. */
 
+#ifdef CONFIG_COMPAT_NET_DEV_OPS
        dev->change_mtu         = ltalk_change_mtu;
-       dev->set_mac_address    = ltalk_mac_addr;
+#endif
 
        dev->type               = ARPHRD_LOCALTLK;
        dev->hard_header_len    = LTALK_HLEN;
index ea9438fc6855fb3a569e7e25a2064d5191a14989..334fcd4a4ea469c26ecdc958b40ffa5b74d35f1e 100644 (file)
@@ -83,7 +83,6 @@ struct br2684_dev {
        struct list_head br2684_devs;
        int number;
        struct list_head brvccs;        /* one device <=> one vcc (before xmas) */
-       struct net_device_stats stats;
        int mac_was_set;
        enum br2684_payload payload;
 };
@@ -148,9 +147,10 @@ static struct net_device *br2684_find_dev(const struct br2684_if_spec *s)
  * the way for multiple vcc's per itf.  Returns true if we can send,
  * otherwise false
  */
-static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
+static int br2684_xmit_vcc(struct sk_buff *skb, struct net_device *dev,
                           struct br2684_vcc *brvcc)
 {
+       struct br2684_dev *brdev = BRPRIV(dev);
        struct atm_vcc *atmvcc;
        int minheadroom = (brvcc->encaps == e_llc) ? 10 : 2;
 
@@ -211,8 +211,8 @@ static int br2684_xmit_vcc(struct sk_buff *skb, struct br2684_dev *brdev,
        }
        atomic_add(skb->truesize, &sk_atm(atmvcc)->sk_wmem_alloc);
        ATM_SKB(skb)->atm_options = atmvcc->atm_options;
-       brdev->stats.tx_packets++;
-       brdev->stats.tx_bytes += skb->len;
+       dev->stats.tx_packets++;
+       dev->stats.tx_bytes += skb->len;
        atmvcc->send(atmvcc, skb);
        return 1;
 }
@@ -233,14 +233,14 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
        brvcc = pick_outgoing_vcc(skb, brdev);
        if (brvcc == NULL) {
                pr_debug("no vcc attached to dev %s\n", dev->name);
-               brdev->stats.tx_errors++;
-               brdev->stats.tx_carrier_errors++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_carrier_errors++;
                /* netif_stop_queue(dev); */
                dev_kfree_skb(skb);
                read_unlock(&devs_lock);
                return 0;
        }
-       if (!br2684_xmit_vcc(skb, brdev, brvcc)) {
+       if (!br2684_xmit_vcc(skb, dev, brvcc)) {
                /*
                 * We should probably use netif_*_queue() here, but that
                 * involves added complication.  We need to walk before
@@ -248,27 +248,20 @@ static int br2684_start_xmit(struct sk_buff *skb, struct net_device *dev)
                 *
                 * Don't free here! this pointer might be no longer valid!
                 */
-               brdev->stats.tx_errors++;
-               brdev->stats.tx_fifo_errors++;
+               dev->stats.tx_errors++;
+               dev->stats.tx_fifo_errors++;
        }
        read_unlock(&devs_lock);
        return 0;
 }
 
-static struct net_device_stats *br2684_get_stats(struct net_device *dev)
-{
-       pr_debug("br2684_get_stats\n");
-       return &BRPRIV(dev)->stats;
-}
-
 /*
  * We remember when the MAC gets set, so we don't override it later with
  * the ESI of the ATM card of the first VC
  */
-static int (*my_eth_mac_addr) (struct net_device *, void *);
 static int br2684_mac_addr(struct net_device *dev, void *p)
 {
-       int err = my_eth_mac_addr(dev, p);
+       int err = eth_mac_addr(dev, p);
        if (!err)
                BRPRIV(dev)->mac_was_set = 1;
        return err;
@@ -430,17 +423,17 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
        /* sigh, interface is down? */
        if (unlikely(!(net_dev->flags & IFF_UP)))
                goto dropped;
-       brdev->stats.rx_packets++;
-       brdev->stats.rx_bytes += skb->len;
+       net_dev->stats.rx_packets++;
+       net_dev->stats.rx_bytes += skb->len;
        memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
        netif_rx(skb);
        return;
 
 dropped:
-       brdev->stats.rx_dropped++;
+       net_dev->stats.rx_dropped++;
        goto free_skb;
 error:
-       brdev->stats.rx_errors++;
+       net_dev->stats.rx_errors++;
 free_skb:
        dev_kfree_skb(skb);
        return;
@@ -531,8 +524,8 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
 
                skb->next = skb->prev = NULL;
                br2684_push(atmvcc, skb);
-               BRPRIV(skb->dev)->stats.rx_bytes -= skb->len;
-               BRPRIV(skb->dev)->stats.rx_packets--;
+               skb->dev->stats.rx_bytes -= skb->len;
+               skb->dev->stats.rx_packets--;
 
                skb = next;
        }
@@ -544,17 +537,20 @@ static int br2684_regvcc(struct atm_vcc *atmvcc, void __user * arg)
        return err;
 }
 
+static const struct net_device_ops br2684_netdev_ops = {
+       .ndo_start_xmit         = br2684_start_xmit,
+       .ndo_set_mac_address    = br2684_mac_addr,
+       .ndo_change_mtu         = eth_change_mtu,
+       .ndo_validate_addr      = eth_validate_addr,
+};
+
 static void br2684_setup(struct net_device *netdev)
 {
        struct br2684_dev *brdev = BRPRIV(netdev);
 
        ether_setup(netdev);
-       brdev->net_dev = netdev;
 
-       my_eth_mac_addr = netdev->set_mac_address;
-       netdev->set_mac_address = br2684_mac_addr;
-       netdev->hard_start_xmit = br2684_start_xmit;
-       netdev->get_stats = br2684_get_stats;
+       netdev->netdev_ops = &br2684_netdev_ops;
 
        INIT_LIST_HEAD(&brdev->brvccs);
 }
@@ -565,10 +561,8 @@ static void br2684_setup_routed(struct net_device *netdev)
        brdev->net_dev = netdev;
 
        netdev->hard_header_len = 0;
-       my_eth_mac_addr = netdev->set_mac_address;
-       netdev->set_mac_address = br2684_mac_addr;
-       netdev->hard_start_xmit = br2684_start_xmit;
-       netdev->get_stats = br2684_get_stats;
+
+       netdev->netdev_ops = &br2684_netdev_ops;
        netdev->addr_len = 0;
        netdev->mtu = 1500;
        netdev->type = ARPHRD_PPP;
index 2d33a83be799c36dec054340553610d64e61070c..da42fd06b61fc6c6c93a47b7336d15bca2438373 100644 (file)
@@ -214,15 +214,15 @@ static void clip_push(struct atm_vcc *vcc, struct sk_buff *skb)
                skb->protocol = ((__be16 *) skb->data)[3];
                skb_pull(skb, RFC1483LLC_LEN);
                if (skb->protocol == htons(ETH_P_ARP)) {
-                       PRIV(skb->dev)->stats.rx_packets++;
-                       PRIV(skb->dev)->stats.rx_bytes += skb->len;
+                       skb->dev->stats.rx_packets++;
+                       skb->dev->stats.rx_bytes += skb->len;
                        clip_arp_rcv(skb);
                        return;
                }
        }
        clip_vcc->last_use = jiffies;
-       PRIV(skb->dev)->stats.rx_packets++;
-       PRIV(skb->dev)->stats.rx_bytes += skb->len;
+       skb->dev->stats.rx_packets++;
+       skb->dev->stats.rx_bytes += skb->len;
        memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
        netif_rx(skb);
 }
@@ -372,7 +372,7 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (!skb->dst) {
                printk(KERN_ERR "clip_start_xmit: skb->dst == NULL\n");
                dev_kfree_skb(skb);
-               clip_priv->stats.tx_dropped++;
+               dev->stats.tx_dropped++;
                return 0;
        }
        if (!skb->dst->neighbour) {
@@ -380,13 +380,13 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
                skb->dst->neighbour = clip_find_neighbour(skb->dst, 1);
                if (!skb->dst->neighbour) {
                        dev_kfree_skb(skb);     /* lost that one */
-                       clip_priv->stats.tx_dropped++;
+                       dev->stats.tx_dropped++;
                        return 0;
                }
 #endif
                printk(KERN_ERR "clip_start_xmit: NO NEIGHBOUR !\n");
                dev_kfree_skb(skb);
-               clip_priv->stats.tx_dropped++;
+               dev->stats.tx_dropped++;
                return 0;
        }
        entry = NEIGH2ENTRY(skb->dst->neighbour);
@@ -400,7 +400,7 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
                        skb_queue_tail(&entry->neigh->arp_queue, skb);
                else {
                        dev_kfree_skb(skb);
-                       clip_priv->stats.tx_dropped++;
+                       dev->stats.tx_dropped++;
                }
                return 0;
        }
@@ -423,8 +423,8 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
                printk(KERN_WARNING "clip_start_xmit: XOFF->XOFF transition\n");
                return 0;
        }
-       clip_priv->stats.tx_packets++;
-       clip_priv->stats.tx_bytes += skb->len;
+       dev->stats.tx_packets++;
+       dev->stats.tx_bytes += skb->len;
        vcc->send(vcc, skb);
        if (atm_may_send(vcc, 0)) {
                entry->vccs->xoff = 0;
@@ -443,11 +443,6 @@ static int clip_start_xmit(struct sk_buff *skb, struct net_device *dev)
        return 0;
 }
 
-static struct net_device_stats *clip_get_stats(struct net_device *dev)
-{
-       return &PRIV(dev)->stats;
-}
-
 static int clip_mkip(struct atm_vcc *vcc, int timeout)
 {
        struct clip_vcc *clip_vcc;
@@ -501,8 +496,8 @@ static int clip_mkip(struct atm_vcc *vcc, int timeout)
 
                        skb_get(skb);
                        clip_push(vcc, skb);
-                       PRIV(skb->dev)->stats.rx_packets--;
-                       PRIV(skb->dev)->stats.rx_bytes -= len;
+                       skb->dev->stats.rx_packets--;
+                       skb->dev->stats.rx_bytes -= len;
                        kfree_skb(skb);
                }
 
@@ -561,7 +556,6 @@ static void clip_setup(struct net_device *dev)
 {
        dev->hard_start_xmit = clip_start_xmit;
        /* sg_xmit ... */
-       dev->get_stats = clip_get_stats;
        dev->type = ARPHRD_ATM;
        dev->hard_header_len = RFC1483LLC_LEN;
        dev->mtu = RFC1626_MTU;
index e5e301550e8a72ce7897fce6729bd2a82f844ea0..c0cba9a037e842d92ac7116907b21c950b001b2d 100644 (file)
@@ -62,7 +62,6 @@ static unsigned char bridge_ula_lec[] = { 0x01, 0x80, 0xc2, 0x00, 0x00 };
 static int lec_open(struct net_device *dev);
 static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev);
 static int lec_close(struct net_device *dev);
-static struct net_device_stats *lec_get_stats(struct net_device *dev);
 static void lec_init(struct net_device *dev);
 static struct lec_arp_table *lec_arp_find(struct lec_priv *priv,
                                          const unsigned char *mac_addr);
@@ -218,28 +217,28 @@ static unsigned char *get_tr_dst(unsigned char *packet, unsigned char *rdesc)
 
 static int lec_open(struct net_device *dev)
 {
-       struct lec_priv *priv = netdev_priv(dev);
-
        netif_start_queue(dev);
-       memset(&priv->stats, 0, sizeof(struct net_device_stats));
+       memset(&dev->stats, 0, sizeof(struct net_device_stats));
 
        return 0;
 }
 
-static __inline__ void
-lec_send(struct atm_vcc *vcc, struct sk_buff *skb, struct lec_priv *priv)
+static void
+lec_send(struct atm_vcc *vcc, struct sk_buff *skb)
 {
+       struct net_device *dev = skb->dev;
+
        ATM_SKB(skb)->vcc = vcc;
        ATM_SKB(skb)->atm_options = vcc->atm_options;
 
        atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
        if (vcc->send(vcc, skb) < 0) {
-               priv->stats.tx_dropped++;
+               dev->stats.tx_dropped++;
                return;
        }
 
-       priv->stats.tx_packets++;
-       priv->stats.tx_bytes += skb->len;
+       dev->stats.tx_packets++;
+       dev->stats.tx_bytes += skb->len;
 }
 
 static void lec_tx_timeout(struct net_device *dev)
@@ -270,7 +269,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
        pr_debug("lec_start_xmit called\n");
        if (!priv->lecd) {
                printk("%s:No lecd attached\n", dev->name);
-               priv->stats.tx_errors++;
+               dev->stats.tx_errors++;
                netif_stop_queue(dev);
                return -EUNATCH;
        }
@@ -345,7 +344,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
                                               GFP_ATOMIC);
                        dev_kfree_skb(skb);
                        if (skb2 == NULL) {
-                               priv->stats.tx_dropped++;
+                               dev->stats.tx_dropped++;
                                return 0;
                        }
                        skb = skb2;
@@ -380,7 +379,7 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
                            ("%s:lec_start_xmit: tx queue full or no arp entry, dropping, ",
                             dev->name);
                        pr_debug("MAC address %pM\n", lec_h->h_dest);
-                       priv->stats.tx_dropped++;
+                       dev->stats.tx_dropped++;
                        dev_kfree_skb(skb);
                }
                goto out;
@@ -392,10 +391,10 @@ static int lec_start_xmit(struct sk_buff *skb, struct net_device *dev)
        while (entry && (skb2 = skb_dequeue(&entry->tx_wait))) {
                pr_debug("lec.c: emptying tx queue, ");
                pr_debug("MAC address %pM\n", lec_h->h_dest);
-               lec_send(vcc, skb2, priv);
+               lec_send(vcc, skb2);
        }
 
-       lec_send(vcc, skb, priv);
+       lec_send(vcc, skb);
 
        if (!atm_may_send(vcc, 0)) {
                struct lec_vcc_priv *vpriv = LEC_VCC_PRIV(vcc);
@@ -427,15 +426,6 @@ static int lec_close(struct net_device *dev)
        return 0;
 }
 
-/*
- * Get the current statistics.
- * This may be called with the card open or closed.
- */
-static struct net_device_stats *lec_get_stats(struct net_device *dev)
-{
-       return &((struct lec_priv *)netdev_priv(dev))->stats;
-}
-
 static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
 {
        unsigned long flags;
@@ -677,17 +667,19 @@ static void lec_set_multicast_list(struct net_device *dev)
        return;
 }
 
+static const struct net_device_ops lec_netdev_ops = {
+       .ndo_open               = lec_open,
+       .ndo_stop               = lec_close,
+       .ndo_start_xmit         = lec_start_xmit,
+       .ndo_change_mtu         = lec_change_mtu,
+       .ndo_tx_timeout         = lec_tx_timeout,
+       .ndo_set_multicast_list = lec_set_multicast_list,
+};
+
+
 static void lec_init(struct net_device *dev)
 {
-       dev->change_mtu = lec_change_mtu;
-       dev->open = lec_open;
-       dev->stop = lec_close;
-       dev->hard_start_xmit = lec_start_xmit;
-       dev->tx_timeout = lec_tx_timeout;
-
-       dev->get_stats = lec_get_stats;
-       dev->set_multicast_list = lec_set_multicast_list;
-       dev->do_ioctl = NULL;
+       dev->netdev_ops = &lec_netdev_ops;
        printk("%s: Initialized!\n", dev->name);
 }
 
@@ -810,8 +802,8 @@ static void lec_push(struct atm_vcc *vcc, struct sk_buff *skb)
                else
 #endif
                        skb->protocol = eth_type_trans(skb, dev);
-               priv->stats.rx_packets++;
-               priv->stats.rx_bytes += skb->len;
+               dev->stats.rx_packets++;
+               dev->stats.rx_bytes += skb->len;
                memset(ATM_SKB(skb), 0, sizeof(struct atm_skb_data));
                netif_rx(skb);
        }
@@ -1887,7 +1879,7 @@ restart:
                                        lec_arp_hold(entry);
                                        spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
                                        while ((skb = skb_dequeue(&entry->tx_wait)) != NULL)
-                                               lec_send(vcc, skb, entry->priv);
+                                               lec_send(vcc, skb);
                                        entry->last_used = jiffies;
                                        entry->status = ESI_FORWARD_DIRECT;
                                        lec_arp_put(entry);
@@ -2305,7 +2297,7 @@ restart:
                                lec_arp_hold(entry);
                                spin_unlock_irqrestore(&priv->lec_arp_lock, flags);
                                while ((skb = skb_dequeue(&entry->tx_wait)) != NULL)
-                                       lec_send(vcc, skb, entry->priv);
+                                       lec_send(vcc, skb);
                                entry->last_used = jiffies;
                                entry->status = ESI_FORWARD_DIRECT;
                                lec_arp_put(entry);
index 0d376682c1a321ba7837f3721555ab2dcd6ca8a0..9d14d196cc1d74aa9ea06baec24ba5772cc2c24b 100644 (file)
@@ -69,7 +69,6 @@ struct lane2_ops {
 #define LEC_ARP_TABLE_SIZE 16
 
 struct lec_priv {
-       struct net_device_stats stats;
        unsigned short lecid;                   /* Lecid of this client */
        struct hlist_head lec_arp_empty_ones;
                                                /* Used for storing VCC's that don't have a MAC address attached yet */
index 00d9e5e131582669cab51f01b91b43c204ea0da8..d127fd3ba5c6acd8a7c3ce0f6b4ea5ee8b25f47b 100644 (file)
@@ -1986,7 +1986,7 @@ static const struct proto_ops ax25_proto_ops = {
  *     Called by socket.c on kernel start up
  */
 static struct packet_type ax25_packet_type = {
-       .type   =       __constant_htons(ETH_P_AX25),
+       .type   =       cpu_to_be16(ETH_P_AX25),
        .dev    =       NULL,                           /* All devices */
        .func   =       ax25_kiss_rcv,
 };
index 8443af57a3740253f10ddcf505246165fee5e56a..71338f112108a06ee9b3734d19c7146c54fea7a9 100644 (file)
@@ -61,27 +61,24 @@ void ax25_protocol_release(unsigned int pid)
 
        write_lock_bh(&protocol_list_lock);
        protocol = protocol_list;
-       if (protocol == NULL) {
-               write_unlock_bh(&protocol_list_lock);
-               return;
-       }
+       if (protocol == NULL)
+               goto out;
 
        if (protocol->pid == pid) {
                protocol_list = protocol->next;
-               write_unlock_bh(&protocol_list_lock);
-               return;
+               goto out;
        }
 
        while (protocol != NULL && protocol->next != NULL) {
                if (protocol->next->pid == pid) {
                        s = protocol->next;
                        protocol->next = protocol->next->next;
-                       write_unlock_bh(&protocol_list_lock);
-                       return;
+                       goto out;
                }
 
                protocol = protocol->next;
        }
+out:
        write_unlock_bh(&protocol_list_lock);
 }
 
index cf754ace0b75ba8c57e35e9420cfd97137ff88f9..3953ac4214c818e27a2a19d39c3e71bdd531f17a 100644 (file)
@@ -107,7 +107,7 @@ static void fake_update_pmtu(struct dst_entry *dst, u32 mtu)
 
 static struct dst_ops fake_dst_ops = {
        .family =               AF_INET,
-       .protocol =             __constant_htons(ETH_P_IP),
+       .protocol =             cpu_to_be16(ETH_P_IP),
        .update_pmtu =          fake_update_pmtu,
        .entries =              ATOMIC_INIT(0),
 };
index fa417ca6cbe6c88cf97c305ed399681125acdc03..d90e8dd975fcf05d842be52fd41ef8e1f369d411 100644 (file)
@@ -828,7 +828,7 @@ static int can_notifier(struct notifier_block *nb, unsigned long msg,
  */
 
 static struct packet_type can_packet __read_mostly = {
-       .type = __constant_htons(ETH_P_CAN),
+       .type = cpu_to_be16(ETH_P_CAN),
        .dev  = NULL,
        .func = can_rcv,
 };
index 0703cba4bf9f29bc269be1fd57a0215e4f37d420..6aa154e806ae722c53e71603c0b22865526452a0 100644 (file)
@@ -646,6 +646,9 @@ static int raw_sendmsg(struct kiocb *iocb, struct socket *sock,
                goto put_dev;
 
        err = memcpy_fromiovec(skb_put(skb, size), msg->msg_iov, size);
+       if (err < 0)
+               goto free_skb;
+       err = sock_tx_timestamp(msg, sk, skb_tx(skb));
        if (err < 0)
                goto free_skb;
        skb->dev = dev;
index a3a2ba0fac08ca49259c94806b23b12acc1a78e9..8d739053afe46fda6b8ae6e5fc2ed975fe9df035 100644 (file)
@@ -216,7 +216,7 @@ Efault:
 int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *data)
 {
        struct compat_timeval ctv;
-       struct compat_timespec cts;
+       struct compat_timespec cts[3];
        struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;
        struct compat_cmsghdr cmhdr;
        int cmlen;
@@ -233,12 +233,17 @@ int put_cmsg_compat(struct msghdr *kmsg, int level, int type, int len, void *dat
                data = &ctv;
                len = sizeof(ctv);
        }
-       if (level == SOL_SOCKET && type == SCM_TIMESTAMPNS) {
+       if (level == SOL_SOCKET &&
+           (type == SCM_TIMESTAMPNS || type == SCM_TIMESTAMPING)) {
+               int count = type == SCM_TIMESTAMPNS ? 1 : 3;
+               int i;
                struct timespec *ts = (struct timespec *)data;
-               cts.tv_sec = ts->tv_sec;
-               cts.tv_nsec = ts->tv_nsec;
+               for (i = 0; i < count; i++) {
+                       cts[i].tv_sec = ts[i].tv_sec;
+                       cts[i].tv_nsec = ts[i].tv_nsec;
+               }
                data = &cts;
-               len = sizeof(cts);
+               len = sizeof(cts[0]) * count;
        }
 
        cmlen = CMSG_COMPAT_LEN(len);
@@ -455,7 +460,7 @@ int compat_sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
        struct timeval tv;
 
        if (!sock_flag(sk, SOCK_TIMESTAMP))
-               sock_enable_timestamp(sk);
+               sock_enable_timestamp(sk, SOCK_TIMESTAMP);
        tv = ktime_to_timeval(sk->sk_stamp);
        if (tv.tv_sec == -1)
                return err;
@@ -479,7 +484,7 @@ int compat_sock_get_timestampns(struct sock *sk, struct timespec __user *usersta
        struct timespec ts;
 
        if (!sock_flag(sk, SOCK_TIMESTAMP))
-               sock_enable_timestamp(sk);
+               sock_enable_timestamp(sk, SOCK_TIMESTAMP);
        ts = ktime_to_timespec(sk->sk_stamp);
        if (ts.tv_sec == -1)
                return err;
index a17e00662363ad04fc432fe08be012cd9433fb23..ac6ab12d3297a11ed0a78d41bf4ab14a5ca7cfc3 100644 (file)
 /* This should be increased if a protocol with a bigger head is added. */
 #define GRO_MAX_HEAD (MAX_HEADER + 128)
 
+enum {
+       GRO_MERGED,
+       GRO_MERGED_FREE,
+       GRO_HELD,
+       GRO_NORMAL,
+       GRO_DROP,
+};
+
 /*
  *     The list of packet types we will receive (as opposed to discard)
  *     and the routines to invoke.
@@ -1668,6 +1676,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
                        struct netdev_queue *txq)
 {
        const struct net_device_ops *ops = dev->netdev_ops;
+       int rc;
 
        prefetch(&dev->netdev_ops->ndo_start_xmit);
        if (likely(!skb->next)) {
@@ -1681,13 +1690,27 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
                                goto gso;
                }
 
-               return ops->ndo_start_xmit(skb, dev);
+               rc = ops->ndo_start_xmit(skb, dev);
+               /*
+                * TODO: if skb_orphan() was called by
+                * dev->hard_start_xmit() (for example, the unmodified
+                * igb driver does that; bnx2 doesn't), then
+                * skb_tx_software_timestamp() will be unable to send
+                * back the time stamp.
+                *
+                * How can this be prevented? Always create another
+                * reference to the socket before calling
+                * dev->hard_start_xmit()? Prevent that skb_orphan()
+                * does anything in dev->hard_start_xmit() by clearing
+                * the skb destructor before the call and restoring it
+                * afterwards, then doing the skb_orphan() ourselves?
+                */
+               return rc;
        }
 
 gso:
        do {
                struct sk_buff *nskb = skb->next;
-               int rc;
 
                skb->next = nskb->next;
                nskb->next = NULL;
@@ -1708,56 +1731,20 @@ out_kfree_skb:
        return 0;
 }
 
-static u32 simple_tx_hashrnd;
-static int simple_tx_hashrnd_initialized = 0;
+static u32 skb_tx_hashrnd;
 
-static u16 simple_tx_hash(struct net_device *dev, struct sk_buff *skb)
+static u16 skb_tx_hash(struct net_device *dev, struct sk_buff *skb)
 {
-       u32 addr1, addr2, ports;
-       u32 hash, ihl;
-       u8 ip_proto = 0;
-
-       if (unlikely(!simple_tx_hashrnd_initialized)) {
-               get_random_bytes(&simple_tx_hashrnd, 4);
-               simple_tx_hashrnd_initialized = 1;
-       }
-
-       switch (skb->protocol) {
-       case htons(ETH_P_IP):
-               if (!(ip_hdr(skb)->frag_off & htons(IP_MF | IP_OFFSET)))
-                       ip_proto = ip_hdr(skb)->protocol;
-               addr1 = ip_hdr(skb)->saddr;
-               addr2 = ip_hdr(skb)->daddr;
-               ihl = ip_hdr(skb)->ihl;
-               break;
-       case htons(ETH_P_IPV6):
-               ip_proto = ipv6_hdr(skb)->nexthdr;
-               addr1 = ipv6_hdr(skb)->saddr.s6_addr32[3];
-               addr2 = ipv6_hdr(skb)->daddr.s6_addr32[3];
-               ihl = (40 >> 2);
-               break;
-       default:
-               return 0;
-       }
+       u32 hash;
 
+       if (skb_rx_queue_recorded(skb)) {
+               hash = skb_get_rx_queue(skb);
+       } else if (skb->sk && skb->sk->sk_hash) {
+               hash = skb->sk->sk_hash;
+       } else
+               hash = skb->protocol;
 
-       switch (ip_proto) {
-       case IPPROTO_TCP:
-       case IPPROTO_UDP:
-       case IPPROTO_DCCP:
-       case IPPROTO_ESP:
-       case IPPROTO_AH:
-       case IPPROTO_SCTP:
-       case IPPROTO_UDPLITE:
-               ports = *((u32 *) (skb_network_header(skb) + (ihl * 4)));
-               break;
-
-       default:
-               ports = 0;
-               break;
-       }
-
-       hash = jhash_3words(addr1, addr2, ports, simple_tx_hashrnd);
+       hash = jhash_1word(hash, skb_tx_hashrnd);
 
        return (u16) (((u64) hash * dev->real_num_tx_queues) >> 32);
 }
@@ -1771,7 +1758,7 @@ static struct netdev_queue *dev_pick_tx(struct net_device *dev,
        if (ops->ndo_select_queue)
                queue_index = ops->ndo_select_queue(dev, skb);
        else if (dev->real_num_tx_queues > 1)
-               queue_index = simple_tx_hash(dev, skb);
+               queue_index = skb_tx_hash(dev, skb);
 
        skb_set_queue_mapping(skb, queue_index);
        return netdev_get_tx_queue(dev, queue_index);
@@ -2267,12 +2254,6 @@ int netif_receive_skb(struct sk_buff *skb)
 
        rcu_read_lock();
 
-       /* Don't receive packets in an exiting network namespace */
-       if (!net_alive(dev_net(skb->dev))) {
-               kfree_skb(skb);
-               goto out;
-       }
-
 #ifdef CONFIG_NET_CLS_ACT
        if (skb->tc_verd & TC_NCLS) {
                skb->tc_verd = CLR_TC_NCLS(skb->tc_verd);
@@ -2303,6 +2284,8 @@ ncls:
        if (!skb)
                goto out;
 
+       skb_orphan(skb);
+
        type = skb->protocol;
        list_for_each_entry_rcu(ptype,
                        &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) {
@@ -2372,7 +2355,6 @@ static int napi_gro_complete(struct sk_buff *skb)
 
 out:
        skb_shinfo(skb)->gso_size = 0;
-       __skb_push(skb, -skb_network_offset(skb));
        return netif_receive_skb(skb);
 }
 
@@ -2386,20 +2368,40 @@ void napi_gro_flush(struct napi_struct *napi)
                napi_gro_complete(skb);
        }
 
+       napi->gro_count = 0;
        napi->gro_list = NULL;
 }
 EXPORT_SYMBOL(napi_gro_flush);
 
+void *skb_gro_header(struct sk_buff *skb, unsigned int hlen)
+{
+       unsigned int offset = skb_gro_offset(skb);
+
+       hlen += offset;
+       if (hlen <= skb_headlen(skb))
+               return skb->data + offset;
+
+       if (unlikely(!skb_shinfo(skb)->nr_frags ||
+                    skb_shinfo(skb)->frags[0].size <=
+                    hlen - skb_headlen(skb) ||
+                    PageHighMem(skb_shinfo(skb)->frags[0].page)))
+               return pskb_may_pull(skb, hlen) ? skb->data + offset : NULL;
+
+       return page_address(skb_shinfo(skb)->frags[0].page) +
+              skb_shinfo(skb)->frags[0].page_offset +
+              offset - skb_headlen(skb);
+}
+EXPORT_SYMBOL(skb_gro_header);
+
 int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
 {
        struct sk_buff **pp = NULL;
        struct packet_type *ptype;
        __be16 type = skb->protocol;
        struct list_head *head = &ptype_base[ntohs(type) & PTYPE_HASH_MASK];
-       int count = 0;
        int same_flow;
        int mac_len;
-       int free;
+       int ret;
 
        if (!(skb->dev->features & NETIF_F_GRO))
                goto normal;
@@ -2409,30 +2411,16 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
 
        rcu_read_lock();
        list_for_each_entry_rcu(ptype, head, list) {
-               struct sk_buff *p;
-
                if (ptype->type != type || ptype->dev || !ptype->gro_receive)
                        continue;
 
-               skb_reset_network_header(skb);
+               skb_set_network_header(skb, skb_gro_offset(skb));
                mac_len = skb->network_header - skb->mac_header;
                skb->mac_len = mac_len;
                NAPI_GRO_CB(skb)->same_flow = 0;
                NAPI_GRO_CB(skb)->flush = 0;
                NAPI_GRO_CB(skb)->free = 0;
 
-               for (p = napi->gro_list; p; p = p->next) {
-                       count++;
-
-                       if (!NAPI_GRO_CB(p)->same_flow)
-                               continue;
-
-                       if (p->mac_len != mac_len ||
-                           memcmp(skb_mac_header(p), skb_mac_header(skb),
-                                  mac_len))
-                               NAPI_GRO_CB(p)->same_flow = 0;
-               }
-
                pp = ptype->gro_receive(&napi->gro_list, skb);
                break;
        }
@@ -2442,7 +2430,7 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
                goto normal;
 
        same_flow = NAPI_GRO_CB(skb)->same_flow;
-       free = NAPI_GRO_CB(skb)->free;
+       ret = NAPI_GRO_CB(skb)->free ? GRO_MERGED_FREE : GRO_MERGED;
 
        if (pp) {
                struct sk_buff *nskb = *pp;
@@ -2450,27 +2438,35 @@ int dev_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
                *pp = nskb->next;
                nskb->next = NULL;
                napi_gro_complete(nskb);
-               count--;
+               napi->gro_count--;
        }
 
        if (same_flow)
                goto ok;
 
-       if (NAPI_GRO_CB(skb)->flush || count >= MAX_GRO_SKBS) {
-               __skb_push(skb, -skb_network_offset(skb));
+       if (NAPI_GRO_CB(skb)->flush || napi->gro_count >= MAX_GRO_SKBS)
                goto normal;
-       }
 
+       napi->gro_count++;
        NAPI_GRO_CB(skb)->count = 1;
-       skb_shinfo(skb)->gso_size = skb->len;
+       skb_shinfo(skb)->gso_size = skb_gro_len(skb);
        skb->next = napi->gro_list;
        napi->gro_list = skb;
+       ret = GRO_HELD;
+
+pull:
+       if (unlikely(!pskb_may_pull(skb, skb_gro_offset(skb)))) {
+               if (napi->gro_list == skb)
+                       napi->gro_list = skb->next;
+               ret = GRO_DROP;
+       }
 
 ok:
-       return free;
+       return ret;
 
 normal:
-       return -1;
+       ret = GRO_NORMAL;
+       goto pull;
 }
 EXPORT_SYMBOL(dev_gro_receive);
 
@@ -2479,25 +2475,40 @@ static int __napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
        struct sk_buff *p;
 
        for (p = napi->gro_list; p; p = p->next) {
-               NAPI_GRO_CB(p)->same_flow = 1;
+               NAPI_GRO_CB(p)->same_flow = !compare_ether_header(
+                       skb_mac_header(p), skb_gro_mac_header(skb));
                NAPI_GRO_CB(p)->flush = 0;
        }
 
        return dev_gro_receive(napi, skb);
 }
 
-int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
+int napi_skb_finish(int ret, struct sk_buff *skb)
 {
-       switch (__napi_gro_receive(napi, skb)) {
-       case -1:
+       int err = NET_RX_SUCCESS;
+
+       switch (ret) {
+       case GRO_NORMAL:
                return netif_receive_skb(skb);
 
-       case 1:
+       case GRO_DROP:
+               err = NET_RX_DROP;
+               /* fall through */
+
+       case GRO_MERGED_FREE:
                kfree_skb(skb);
                break;
        }
 
-       return NET_RX_SUCCESS;
+       return err;
+}
+EXPORT_SYMBOL(napi_skb_finish);
+
+int napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
+{
+       skb_gro_reset_offset(skb);
+
+       return napi_skb_finish(__napi_gro_receive(napi, skb), skb);
 }
 EXPORT_SYMBOL(napi_gro_receive);
 
@@ -2515,6 +2526,9 @@ struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi,
 {
        struct net_device *dev = napi->dev;
        struct sk_buff *skb = napi->skb;
+       struct ethhdr *eth;
+       skb_frag_t *frag;
+       int i;
 
        napi->skb = NULL;
 
@@ -2527,20 +2541,36 @@ struct sk_buff *napi_fraginfo_skb(struct napi_struct *napi,
        }
 
        BUG_ON(info->nr_frags > MAX_SKB_FRAGS);
+       frag = &info->frags[info->nr_frags - 1];
+
+       for (i = skb_shinfo(skb)->nr_frags; i < info->nr_frags; i++) {
+               skb_fill_page_desc(skb, i, frag->page, frag->page_offset,
+                                  frag->size);
+               frag++;
+       }
        skb_shinfo(skb)->nr_frags = info->nr_frags;
-       memcpy(skb_shinfo(skb)->frags, info->frags, sizeof(info->frags));
 
        skb->data_len = info->len;
        skb->len += info->len;
        skb->truesize += info->len;
 
-       if (!pskb_may_pull(skb, ETH_HLEN)) {
+       skb_reset_mac_header(skb);
+       skb_gro_reset_offset(skb);
+
+       eth = skb_gro_header(skb, sizeof(*eth));
+       if (!eth) {
                napi_reuse_skb(napi, skb);
                skb = NULL;
                goto out;
        }
 
-       skb->protocol = eth_type_trans(skb, dev);
+       skb_gro_pull(skb, sizeof(*eth));
+
+       /*
+        * This works because the only protocols we care about don't require
+        * special handling.  We'll fix it up properly at the end.
+        */
+       skb->protocol = eth->h_proto;
 
        skb->ip_summed = info->ip_summed;
        skb->csum = info->csum;
@@ -2550,29 +2580,43 @@ out:
 }
 EXPORT_SYMBOL(napi_fraginfo_skb);
 
-int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
+int napi_frags_finish(struct napi_struct *napi, struct sk_buff *skb, int ret)
 {
-       struct sk_buff *skb = napi_fraginfo_skb(napi, info);
-       int err = NET_RX_DROP;
+       int err = NET_RX_SUCCESS;
 
-       if (!skb)
-               goto out;
+       switch (ret) {
+       case GRO_NORMAL:
+       case GRO_HELD:
+               skb->protocol = eth_type_trans(skb, napi->dev);
 
-       err = NET_RX_SUCCESS;
+               if (ret == GRO_NORMAL)
+                       return netif_receive_skb(skb);
 
-       switch (__napi_gro_receive(napi, skb)) {
-       case -1:
-               return netif_receive_skb(skb);
+               skb_gro_pull(skb, -ETH_HLEN);
+               break;
 
-       case 0:
-               goto out;
-       }
+       case GRO_DROP:
+               err = NET_RX_DROP;
+               /* fall through */
 
-       napi_reuse_skb(napi, skb);
+       case GRO_MERGED_FREE:
+               napi_reuse_skb(napi, skb);
+               break;
+       }
 
-out:
        return err;
 }
+EXPORT_SYMBOL(napi_frags_finish);
+
+int napi_gro_frags(struct napi_struct *napi, struct napi_gro_fraginfo *info)
+{
+       struct sk_buff *skb = napi_fraginfo_skb(napi, info);
+
+       if (!skb)
+               return NET_RX_DROP;
+
+       return napi_frags_finish(napi, skb, __napi_gro_receive(napi, skb));
+}
 EXPORT_SYMBOL(napi_gro_frags);
 
 static int process_backlog(struct napi_struct *napi, int quota)
@@ -2652,6 +2696,7 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
                    int (*poll)(struct napi_struct *, int), int weight)
 {
        INIT_LIST_HEAD(&napi->poll_list);
+       napi->gro_count = 0;
        napi->gro_list = NULL;
        napi->skb = NULL;
        napi->poll = poll;
@@ -2680,6 +2725,7 @@ void netif_napi_del(struct napi_struct *napi)
        }
 
        napi->gro_list = NULL;
+       napi->gro_count = 0;
 }
 EXPORT_SYMBOL(netif_napi_del);
 
@@ -3948,6 +3994,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
                            cmd == SIOCSMIIREG ||
                            cmd == SIOCBRADDIF ||
                            cmd == SIOCBRDELIF ||
+                           cmd == SIOCSHWTSTAMP ||
                            cmd == SIOCWANDEV) {
                                err = -EOPNOTSUPP;
                                if (ops->ndo_do_ioctl) {
@@ -4102,6 +4149,7 @@ int dev_ioctl(struct net *net, unsigned int cmd, void __user *arg)
                case SIOCBONDCHANGEACTIVE:
                case SIOCBRADDIF:
                case SIOCBRDELIF:
+               case SIOCSHWTSTAMP:
                        if (!capable(CAP_NET_ADMIN))
                                return -EPERM;
                        /* fall through */
@@ -5185,6 +5233,7 @@ static int __init net_dev_init(void)
                queue->backlog.poll = process_backlog;
                queue->backlog.weight = weight_p;
                queue->backlog.gro_list = NULL;
+               queue->backlog.gro_count = 0;
        }
 
        dev_boot_phase = 0;
@@ -5217,6 +5266,14 @@ out:
 
 subsys_initcall(net_dev_init);
 
+static int __init initialize_hashrnd(void)
+{
+       get_random_bytes(&skb_tx_hashrnd, sizeof(skb_tx_hashrnd));
+       return 0;
+}
+
+late_initcall_sync(initialize_hashrnd);
+
 EXPORT_SYMBOL(__dev_get_by_index);
 EXPORT_SYMBOL(__dev_get_by_name);
 EXPORT_SYMBOL(__dev_remove_pack);
index 947710a36ced534e0599a59dbd7860600e833376..244ca56dffac3eb57536142f5aa36e2f4a6f12a5 100644 (file)
@@ -209,34 +209,62 @@ static int ethtool_get_drvinfo(struct net_device *dev, void __user *useraddr)
        return 0;
 }
 
-static int ethtool_set_rxhash(struct net_device *dev, void __user *useraddr)
+static int ethtool_set_rxnfc(struct net_device *dev, void __user *useraddr)
 {
        struct ethtool_rxnfc cmd;
 
-       if (!dev->ethtool_ops->set_rxhash)
+       if (!dev->ethtool_ops->set_rxnfc)
                return -EOPNOTSUPP;
 
        if (copy_from_user(&cmd, useraddr, sizeof(cmd)))
                return -EFAULT;
 
-       return dev->ethtool_ops->set_rxhash(dev, &cmd);
+       return dev->ethtool_ops->set_rxnfc(dev, &cmd);
 }
 
-static int ethtool_get_rxhash(struct net_device *dev, void __user *useraddr)
+static int ethtool_get_rxnfc(struct net_device *dev, void __user *useraddr)
 {
        struct ethtool_rxnfc info;
+       const struct ethtool_ops *ops = dev->ethtool_ops;
+       int ret;
+       void *rule_buf = NULL;
 
-       if (!dev->ethtool_ops->get_rxhash)
+       if (!ops->get_rxnfc)
                return -EOPNOTSUPP;
 
        if (copy_from_user(&info, useraddr, sizeof(info)))
                return -EFAULT;
 
-       dev->ethtool_ops->get_rxhash(dev, &info);
+       if (info.cmd == ETHTOOL_GRXCLSRLALL) {
+               if (info.rule_cnt > 0) {
+                       rule_buf = kmalloc(info.rule_cnt * sizeof(u32),
+                                          GFP_USER);
+                       if (!rule_buf)
+                               return -ENOMEM;
+               }
+       }
 
+       ret = ops->get_rxnfc(dev, &info, rule_buf);
+       if (ret < 0)
+               goto err_out;
+
+       ret = -EFAULT;
        if (copy_to_user(useraddr, &info, sizeof(info)))
-               return -EFAULT;
-       return 0;
+               goto err_out;
+
+       if (rule_buf) {
+               useraddr += offsetof(struct ethtool_rxnfc, rule_locs);
+               if (copy_to_user(useraddr, rule_buf,
+                                info.rule_cnt * sizeof(u32)))
+                       goto err_out;
+       }
+       ret = 0;
+
+err_out:
+       if (rule_buf)
+               kfree(rule_buf);
+
+       return ret;
 }
 
 static int ethtool_get_regs(struct net_device *dev, char __user *useraddr)
@@ -901,6 +929,10 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
        case ETHTOOL_GFLAGS:
        case ETHTOOL_GPFLAGS:
        case ETHTOOL_GRXFH:
+       case ETHTOOL_GRXRINGS:
+       case ETHTOOL_GRXCLSRLCNT:
+       case ETHTOOL_GRXCLSRULE:
+       case ETHTOOL_GRXCLSRLALL:
                break;
        default:
                if (!capable(CAP_NET_ADMIN))
@@ -1052,10 +1084,16 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
                                       dev->ethtool_ops->set_priv_flags);
                break;
        case ETHTOOL_GRXFH:
-               rc = ethtool_get_rxhash(dev, useraddr);
+       case ETHTOOL_GRXRINGS:
+       case ETHTOOL_GRXCLSRLCNT:
+       case ETHTOOL_GRXCLSRULE:
+       case ETHTOOL_GRXCLSRLALL:
+               rc = ethtool_get_rxnfc(dev, useraddr);
                break;
        case ETHTOOL_SRXFH:
-               rc = ethtool_set_rxhash(dev, useraddr);
+       case ETHTOOL_SRXCLSRLDEL:
+       case ETHTOOL_SRXCLSRLINS:
+               rc = ethtool_set_rxnfc(dev, useraddr);
                break;
        case ETHTOOL_GGRO:
                rc = ethtool_get_gro(dev, useraddr);
index 2adb1a7d361f8391ebeeccf78cb7823527c2a1e7..e3bebd36f053ef5ad656b7ea81fa1a03e0c2dc74 100644 (file)
@@ -157,9 +157,6 @@ static void cleanup_net(struct work_struct *work)
        struct pernet_operations *ops;
        struct net *net;
 
-       /* Be very certain incoming network packets will not find us */
-       rcu_barrier();
-
        net = container_of(work, struct net, work);
 
        mutex_lock(&net_mutex);
index c6a6b166f8d6f733a4dc9f7143bd565aaddf7e8f..33640d99c8ed65794458f4a673e45724232ef520 100644 (file)
@@ -55,6 +55,7 @@
 #include <linux/rtnetlink.h>
 #include <linux/init.h>
 #include <linux/scatterlist.h>
+#include <linux/errqueue.h>
 
 #include <net/protocol.h>
 #include <net/dst.h>
@@ -123,6 +124,7 @@ void skb_over_panic(struct sk_buff *skb, int sz, void *here)
               skb->dev ? skb->dev->name : "<NULL>");
        BUG();
 }
+EXPORT_SYMBOL(skb_over_panic);
 
 /**
  *     skb_under_panic -       private function
@@ -142,6 +144,7 @@ void skb_under_panic(struct sk_buff *skb, int sz, void *here)
               skb->dev ? skb->dev->name : "<NULL>");
        BUG();
 }
+EXPORT_SYMBOL(skb_under_panic);
 
 /*     Allocate a new skbuff. We do this ourselves so we can fill in a few
  *     'private' fields and also do memory statistics to find all the
@@ -205,7 +208,9 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask,
        shinfo->gso_segs = 0;
        shinfo->gso_type = 0;
        shinfo->ip6_frag_id = 0;
+       shinfo->tx_flags.flags = 0;
        shinfo->frag_list = NULL;
+       memset(&shinfo->hwtstamps, 0, sizeof(shinfo->hwtstamps));
 
        if (fclone) {
                struct sk_buff *child = skb + 1;
@@ -223,6 +228,7 @@ nodata:
        skb = NULL;
        goto out;
 }
+EXPORT_SYMBOL(__alloc_skb);
 
 /**
  *     __netdev_alloc_skb - allocate an skbuff for rx on a specific device
@@ -250,6 +256,7 @@ struct sk_buff *__netdev_alloc_skb(struct net_device *dev,
        }
        return skb;
 }
+EXPORT_SYMBOL(__netdev_alloc_skb);
 
 struct page *__netdev_alloc_page(struct net_device *dev, gfp_t gfp_mask)
 {
@@ -418,6 +425,7 @@ void __kfree_skb(struct sk_buff *skb)
        skb_release_all(skb);
        kfree_skbmem(skb);
 }
+EXPORT_SYMBOL(__kfree_skb);
 
 /**
  *     kfree_skb - free an sk_buff
@@ -436,6 +444,7 @@ void kfree_skb(struct sk_buff *skb)
                return;
        __kfree_skb(skb);
 }
+EXPORT_SYMBOL(kfree_skb);
 
 /**
  *     skb_recycle_check - check if skb can be reused for receive
@@ -605,6 +614,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
 
        return __skb_clone(n, skb);
 }
+EXPORT_SYMBOL(skb_clone);
 
 static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old)
 {
@@ -671,7 +681,7 @@ struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask)
        copy_skb_header(n, skb);
        return n;
 }
-
+EXPORT_SYMBOL(skb_copy);
 
 /**
  *     pskb_copy       -       create copy of an sk_buff with private head.
@@ -730,6 +740,7 @@ struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask)
 out:
        return n;
 }
+EXPORT_SYMBOL(pskb_copy);
 
 /**
  *     pskb_expand_head - reallocate header of &sk_buff
@@ -813,6 +824,7 @@ int pskb_expand_head(struct sk_buff *skb, int nhead, int ntail,
 nodata:
        return -ENOMEM;
 }
+EXPORT_SYMBOL(pskb_expand_head);
 
 /* Make private copy of skb with writable head and some headroom */
 
@@ -833,7 +845,7 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
        }
        return skb2;
 }
-
+EXPORT_SYMBOL(skb_realloc_headroom);
 
 /**
  *     skb_copy_expand -       copy and expand sk_buff
@@ -898,6 +910,7 @@ struct sk_buff *skb_copy_expand(const struct sk_buff *skb,
 
        return n;
 }
+EXPORT_SYMBOL(skb_copy_expand);
 
 /**
  *     skb_pad                 -       zero pad the tail of an skb
@@ -943,6 +956,7 @@ free_skb:
        kfree_skb(skb);
        return err;
 }
+EXPORT_SYMBOL(skb_pad);
 
 /**
  *     skb_put - add data to a buffer
@@ -1100,6 +1114,7 @@ done:
 
        return 0;
 }
+EXPORT_SYMBOL(___pskb_trim);
 
 /**
  *     __pskb_pull_tail - advance tail of skb header
@@ -1238,6 +1253,7 @@ pull_pages:
 
        return skb_tail_pointer(skb);
 }
+EXPORT_SYMBOL(__pskb_pull_tail);
 
 /* Copy some data bits from skb to kernel buffer. */
 
@@ -1315,6 +1331,7 @@ int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len)
 fault:
        return -EFAULT;
 }
+EXPORT_SYMBOL(skb_copy_bits);
 
 /*
  * Callback from splice_to_pipe(), if we need to release some pages
@@ -1325,14 +1342,39 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
        put_page(spd->pages[i]);
 }
 
-static inline struct page *linear_to_page(struct page *page, unsigned int len,
-                                         unsigned int offset)
+static inline struct page *linear_to_page(struct page *page, unsigned int *len,
+                                         unsigned int *offset,
+                                         struct sk_buff *skb)
 {
-       struct page *p = alloc_pages(GFP_KERNEL, 0);
+       struct sock *sk = skb->sk;
+       struct page *p = sk->sk_sndmsg_page;
+       unsigned int off;
 
-       if (!p)
-               return NULL;
-       memcpy(page_address(p) + offset, page_address(page) + offset, len);
+       if (!p) {
+new_page:
+               p = sk->sk_sndmsg_page = alloc_pages(sk->sk_allocation, 0);
+               if (!p)
+                       return NULL;
+
+               off = sk->sk_sndmsg_off = 0;
+               /* hold one ref to this page until it's full */
+       } else {
+               unsigned int mlen;
+
+               off = sk->sk_sndmsg_off;
+               mlen = PAGE_SIZE - off;
+               if (mlen < 64 && mlen < *len) {
+                       put_page(p);
+                       goto new_page;
+               }
+
+               *len = min_t(unsigned int, *len, mlen);
+       }
+
+       memcpy(page_address(p) + off, page_address(page) + *offset, *len);
+       sk->sk_sndmsg_off += *len;
+       *offset = off;
+       get_page(p);
 
        return p;
 }
@@ -1341,21 +1383,21 @@ static inline struct page *linear_to_page(struct page *page, unsigned int len,
  * Fill page/offset/length into spd, if it can hold more pages.
  */
 static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
-                               unsigned int len, unsigned int offset,
+                               unsigned int *len, unsigned int offset,
                                struct sk_buff *skb, int linear)
 {
        if (unlikely(spd->nr_pages == PIPE_BUFFERS))
                return 1;
 
        if (linear) {
-               page = linear_to_page(page, len, offset);
+               page = linear_to_page(page, len, &offset, skb);
                if (!page)
                        return 1;
        } else
                get_page(page);
 
        spd->pages[spd->nr_pages] = page;
-       spd->partial[spd->nr_pages].len = len;
+       spd->partial[spd->nr_pages].len = *len;
        spd->partial[spd->nr_pages].offset = offset;
        spd->nr_pages++;
 
@@ -1365,8 +1407,13 @@ static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page,
 static inline void __segment_seek(struct page **page, unsigned int *poff,
                                  unsigned int *plen, unsigned int off)
 {
+       unsigned long n;
+
        *poff += off;
-       *page += *poff / PAGE_SIZE;
+       n = *poff / PAGE_SIZE;
+       if (n)
+               *page = nth_page(*page, n);
+
        *poff = *poff % PAGE_SIZE;
        *plen -= off;
 }
@@ -1397,7 +1444,7 @@ static inline int __splice_segment(struct page *page, unsigned int poff,
                /* the linear region may spread across several pages  */
                flen = min_t(unsigned int, flen, PAGE_SIZE - poff);
 
-               if (spd_fill_page(spd, page, flen, poff, skb, linear))
+               if (spd_fill_page(spd, page, &flen, poff, skb, linear))
                        return 1;
 
                __segment_seek(&page, &poff, &plen, flen);
@@ -1590,7 +1637,6 @@ int skb_store_bits(struct sk_buff *skb, int offset, const void *from, int len)
 fault:
        return -EFAULT;
 }
-
 EXPORT_SYMBOL(skb_store_bits);
 
 /* Checksum skb data. */
@@ -1667,6 +1713,7 @@ __wsum skb_checksum(const struct sk_buff *skb, int offset,
 
        return csum;
 }
+EXPORT_SYMBOL(skb_checksum);
 
 /* Both of above in one bottle. */
 
@@ -1748,6 +1795,7 @@ __wsum skb_copy_and_csum_bits(const struct sk_buff *skb, int offset,
        BUG_ON(len);
        return csum;
 }
+EXPORT_SYMBOL(skb_copy_and_csum_bits);
 
 void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
 {
@@ -1774,6 +1822,7 @@ void skb_copy_and_csum_dev(const struct sk_buff *skb, u8 *to)
                *((__sum16 *)(to + csstuff)) = csum_fold(csum);
        }
 }
+EXPORT_SYMBOL(skb_copy_and_csum_dev);
 
 /**
  *     skb_dequeue - remove from the head of the queue
@@ -1794,6 +1843,7 @@ struct sk_buff *skb_dequeue(struct sk_buff_head *list)
        spin_unlock_irqrestore(&list->lock, flags);
        return result;
 }
+EXPORT_SYMBOL(skb_dequeue);
 
 /**
  *     skb_dequeue_tail - remove from the tail of the queue
@@ -1813,6 +1863,7 @@ struct sk_buff *skb_dequeue_tail(struct sk_buff_head *list)
        spin_unlock_irqrestore(&list->lock, flags);
        return result;
 }
+EXPORT_SYMBOL(skb_dequeue_tail);
 
 /**
  *     skb_queue_purge - empty a list
@@ -1828,6 +1879,7 @@ void skb_queue_purge(struct sk_buff_head *list)
        while ((skb = skb_dequeue(list)) != NULL)
                kfree_skb(skb);
 }
+EXPORT_SYMBOL(skb_queue_purge);
 
 /**
  *     skb_queue_head - queue a buffer at the list head
@@ -1848,6 +1900,7 @@ void skb_queue_head(struct sk_buff_head *list, struct sk_buff *newsk)
        __skb_queue_head(list, newsk);
        spin_unlock_irqrestore(&list->lock, flags);
 }
+EXPORT_SYMBOL(skb_queue_head);
 
 /**
  *     skb_queue_tail - queue a buffer at the list tail
@@ -1868,6 +1921,7 @@ void skb_queue_tail(struct sk_buff_head *list, struct sk_buff *newsk)
        __skb_queue_tail(list, newsk);
        spin_unlock_irqrestore(&list->lock, flags);
 }
+EXPORT_SYMBOL(skb_queue_tail);
 
 /**
  *     skb_unlink      -       remove a buffer from a list
@@ -1887,6 +1941,7 @@ void skb_unlink(struct sk_buff *skb, struct sk_buff_head *list)
        __skb_unlink(skb, list);
        spin_unlock_irqrestore(&list->lock, flags);
 }
+EXPORT_SYMBOL(skb_unlink);
 
 /**
  *     skb_append      -       append a buffer
@@ -1906,7 +1961,7 @@ void skb_append(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head
        __skb_queue_after(list, old, newsk);
        spin_unlock_irqrestore(&list->lock, flags);
 }
-
+EXPORT_SYMBOL(skb_append);
 
 /**
  *     skb_insert      -       insert a buffer
@@ -1928,6 +1983,7 @@ void skb_insert(struct sk_buff *old, struct sk_buff *newsk, struct sk_buff_head
        __skb_insert(newsk, old->prev, old, list);
        spin_unlock_irqrestore(&list->lock, flags);
 }
+EXPORT_SYMBOL(skb_insert);
 
 static inline void skb_split_inside_header(struct sk_buff *skb,
                                           struct sk_buff* skb1,
@@ -2006,6 +2062,7 @@ void skb_split(struct sk_buff *skb, struct sk_buff *skb1, const u32 len)
        else            /* Second chunk has no header, nothing to copy. */
                skb_split_no_header(skb, skb1, len, pos);
 }
+EXPORT_SYMBOL(skb_split);
 
 /* Shifting from/to a cloned skb is a no-go.
  *
@@ -2168,6 +2225,7 @@ void skb_prepare_seq_read(struct sk_buff *skb, unsigned int from,
        st->frag_idx = st->stepped_offset = 0;
        st->frag_data = NULL;
 }
+EXPORT_SYMBOL(skb_prepare_seq_read);
 
 /**
  * skb_seq_read - Sequentially read skb data
@@ -2255,6 +2313,7 @@ next_skb:
 
        return 0;
 }
+EXPORT_SYMBOL(skb_seq_read);
 
 /**
  * skb_abort_seq_read - Abort a sequential read of skb data
@@ -2268,6 +2327,7 @@ void skb_abort_seq_read(struct skb_seq_state *st)
        if (st->frag_data)
                kunmap_skb_frag(st->frag_data);
 }
+EXPORT_SYMBOL(skb_abort_seq_read);
 
 #define TS_SKB_CB(state)       ((struct skb_seq_state *) &((state)->cb))
 
@@ -2310,6 +2370,7 @@ unsigned int skb_find_text(struct sk_buff *skb, unsigned int from,
        ret = textsearch_find(config, state);
        return (ret <= to - from ? ret : UINT_MAX);
 }
+EXPORT_SYMBOL(skb_find_text);
 
 /**
  * skb_append_datato_frags: - append the user data to a skb
@@ -2382,6 +2443,7 @@ int skb_append_datato_frags(struct sock *sk, struct sk_buff *skb,
 
        return 0;
 }
+EXPORT_SYMBOL(skb_append_datato_frags);
 
 /**
  *     skb_pull_rcsum - pull skb and update receive checksum
@@ -2569,7 +2631,6 @@ err:
        }
        return ERR_PTR(err);
 }
-
 EXPORT_SYMBOL_GPL(skb_segment);
 
 int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
@@ -2577,17 +2638,23 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
        struct sk_buff *p = *head;
        struct sk_buff *nskb;
        unsigned int headroom;
-       unsigned int hlen = p->data - skb_mac_header(p);
-       unsigned int len = skb->len;
+       unsigned int len = skb_gro_len(skb);
 
-       if (hlen + p->len + len >= 65536)
+       if (p->len + len >= 65536)
                return -E2BIG;
 
        if (skb_shinfo(p)->frag_list)
                goto merge;
-       else if (!skb_headlen(p) && !skb_headlen(skb) &&
-                skb_shinfo(p)->nr_frags + skb_shinfo(skb)->nr_frags <
-                MAX_SKB_FRAGS) {
+       else if (skb_headlen(skb) <= skb_gro_offset(skb)) {
+               if (skb_shinfo(p)->nr_frags + skb_shinfo(skb)->nr_frags >
+                   MAX_SKB_FRAGS)
+                       return -E2BIG;
+
+               skb_shinfo(skb)->frags[0].page_offset +=
+                       skb_gro_offset(skb) - skb_headlen(skb);
+               skb_shinfo(skb)->frags[0].size -=
+                       skb_gro_offset(skb) - skb_headlen(skb);
+
                memcpy(skb_shinfo(p)->frags + skb_shinfo(p)->nr_frags,
                       skb_shinfo(skb)->frags,
                       skb_shinfo(skb)->nr_frags * sizeof(skb_frag_t));
@@ -2604,7 +2671,7 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
        }
 
        headroom = skb_headroom(p);
-       nskb = netdev_alloc_skb(p->dev, headroom);
+       nskb = netdev_alloc_skb(p->dev, headroom + skb_gro_offset(p));
        if (unlikely(!nskb))
                return -ENOMEM;
 
@@ -2612,12 +2679,15 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
        nskb->mac_len = p->mac_len;
 
        skb_reserve(nskb, headroom);
+       __skb_put(nskb, skb_gro_offset(p));
 
-       skb_set_mac_header(nskb, -hlen);
+       skb_set_mac_header(nskb, skb_mac_header(p) - p->data);
        skb_set_network_header(nskb, skb_network_offset(p));
        skb_set_transport_header(nskb, skb_transport_offset(p));
 
-       memcpy(skb_mac_header(nskb), skb_mac_header(p), hlen);
+       __skb_pull(p, skb_gro_offset(p));
+       memcpy(skb_mac_header(nskb), skb_mac_header(p),
+              p->data - skb_mac_header(p));
 
        *NAPI_GRO_CB(nskb) = *NAPI_GRO_CB(p);
        skb_shinfo(nskb)->frag_list = p;
@@ -2636,6 +2706,17 @@ int skb_gro_receive(struct sk_buff **head, struct sk_buff *skb)
        p = nskb;
 
 merge:
+       if (skb_gro_offset(skb) > skb_headlen(skb)) {
+               skb_shinfo(skb)->frags[0].page_offset +=
+                       skb_gro_offset(skb) - skb_headlen(skb);
+               skb_shinfo(skb)->frags[0].size -=
+                       skb_gro_offset(skb) - skb_headlen(skb);
+               skb_gro_reset_offset(skb);
+               skb_gro_pull(skb, skb_headlen(skb));
+       }
+
+       __skb_pull(skb, skb_gro_offset(skb));
+
        p->prev->next = skb;
        p->prev = skb;
        skb_header_release(skb);
@@ -2747,6 +2828,7 @@ int skb_to_sgvec(struct sk_buff *skb, struct scatterlist *sg, int offset, int le
 
        return nsg;
 }
+EXPORT_SYMBOL_GPL(skb_to_sgvec);
 
 /**
  *     skb_cow_data - Check that a socket buffer's data buffers are writable
@@ -2856,6 +2938,45 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
 
        return elt;
 }
+EXPORT_SYMBOL_GPL(skb_cow_data);
+
+void skb_tstamp_tx(struct sk_buff *orig_skb,
+               struct skb_shared_hwtstamps *hwtstamps)
+{
+       struct sock *sk = orig_skb->sk;
+       struct sock_exterr_skb *serr;
+       struct sk_buff *skb;
+       int err;
+
+       if (!sk)
+               return;
+
+       skb = skb_clone(orig_skb, GFP_ATOMIC);
+       if (!skb)
+               return;
+
+       if (hwtstamps) {
+               *skb_hwtstamps(skb) =
+                       *hwtstamps;
+       } else {
+               /*
+                * no hardware time stamps available,
+                * so keep the skb_shared_tx and only
+                * store software time stamp
+                */
+               skb->tstamp = ktime_get_real();
+       }
+
+       serr = SKB_EXT_ERR(skb);
+       memset(serr, 0, sizeof(*serr));
+       serr->ee.ee_errno = ENOMSG;
+       serr->ee.ee_origin = SO_EE_ORIGIN_TIMESTAMPING;
+       err = sock_queue_err_skb(sk, skb);
+       if (err)
+               kfree_skb(skb);
+}
+EXPORT_SYMBOL_GPL(skb_tstamp_tx);
+
 
 /**
  * skb_partial_csum_set - set up and verify partial csum values for packet
@@ -2884,6 +3005,7 @@ bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)
        skb->csum_offset = off;
        return true;
 }
+EXPORT_SYMBOL_GPL(skb_partial_csum_set);
 
 void __skb_warn_lro_forwarding(const struct sk_buff *skb)
 {
@@ -2891,42 +3013,4 @@ void __skb_warn_lro_forwarding(const struct sk_buff *skb)
                pr_warning("%s: received packets cannot be forwarded"
                           " while LRO is enabled\n", skb->dev->name);
 }
-
-EXPORT_SYMBOL(___pskb_trim);
-EXPORT_SYMBOL(__kfree_skb);
-EXPORT_SYMBOL(kfree_skb);
-EXPORT_SYMBOL(__pskb_pull_tail);
-EXPORT_SYMBOL(__alloc_skb);
-EXPORT_SYMBOL(__netdev_alloc_skb);
-EXPORT_SYMBOL(pskb_copy);
-EXPORT_SYMBOL(pskb_expand_head);
-EXPORT_SYMBOL(skb_checksum);
-EXPORT_SYMBOL(skb_clone);
-EXPORT_SYMBOL(skb_copy);
-EXPORT_SYMBOL(skb_copy_and_csum_bits);
-EXPORT_SYMBOL(skb_copy_and_csum_dev);
-EXPORT_SYMBOL(skb_copy_bits);
-EXPORT_SYMBOL(skb_copy_expand);
-EXPORT_SYMBOL(skb_over_panic);
-EXPORT_SYMBOL(skb_pad);
-EXPORT_SYMBOL(skb_realloc_headroom);
-EXPORT_SYMBOL(skb_under_panic);
-EXPORT_SYMBOL(skb_dequeue);
-EXPORT_SYMBOL(skb_dequeue_tail);
-EXPORT_SYMBOL(skb_insert);
-EXPORT_SYMBOL(skb_queue_purge);
-EXPORT_SYMBOL(skb_queue_head);
-EXPORT_SYMBOL(skb_queue_tail);
-EXPORT_SYMBOL(skb_unlink);
-EXPORT_SYMBOL(skb_append);
-EXPORT_SYMBOL(skb_split);
-EXPORT_SYMBOL(skb_prepare_seq_read);
-EXPORT_SYMBOL(skb_seq_read);
-EXPORT_SYMBOL(skb_abort_seq_read);
-EXPORT_SYMBOL(skb_find_text);
-EXPORT_SYMBOL(skb_append_datato_frags);
 EXPORT_SYMBOL(__skb_warn_lro_forwarding);
-
-EXPORT_SYMBOL_GPL(skb_to_sgvec);
-EXPORT_SYMBOL_GPL(skb_cow_data);
-EXPORT_SYMBOL_GPL(skb_partial_csum_set);
index 5f97caa158e81ba95143e7c769ab30de3a1cac43..8ee734ea52292a4fa65e8c9e0b0531e04e3a17c9 100644 (file)
 #include <net/net_namespace.h>
 #include <net/request_sock.h>
 #include <net/sock.h>
+#include <linux/net_tstamp.h>
 #include <net/xfrm.h>
 #include <linux/ipsec.h>
 
@@ -255,11 +256,14 @@ static void sock_warn_obsolete_bsdism(const char *name)
        }
 }
 
-static void sock_disable_timestamp(struct sock *sk)
+static void sock_disable_timestamp(struct sock *sk, int flag)
 {
-       if (sock_flag(sk, SOCK_TIMESTAMP)) {
-               sock_reset_flag(sk, SOCK_TIMESTAMP);
-               net_disable_timestamp();
+       if (sock_flag(sk, flag)) {
+               sock_reset_flag(sk, flag);
+               if (!sock_flag(sk, SOCK_TIMESTAMP) &&
+                   !sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE)) {
+                       net_disable_timestamp();
+               }
        }
 }
 
@@ -614,13 +618,38 @@ set_rcvbuf:
                        else
                                sock_set_flag(sk, SOCK_RCVTSTAMPNS);
                        sock_set_flag(sk, SOCK_RCVTSTAMP);
-                       sock_enable_timestamp(sk);
+                       sock_enable_timestamp(sk, SOCK_TIMESTAMP);
                } else {
                        sock_reset_flag(sk, SOCK_RCVTSTAMP);
                        sock_reset_flag(sk, SOCK_RCVTSTAMPNS);
                }
                break;
 
+       case SO_TIMESTAMPING:
+               if (val & ~SOF_TIMESTAMPING_MASK) {
+                       ret = EINVAL;
+                       break;
+               }
+               sock_valbool_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE,
+                                 val & SOF_TIMESTAMPING_TX_HARDWARE);
+               sock_valbool_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE,
+                                 val & SOF_TIMESTAMPING_TX_SOFTWARE);
+               sock_valbool_flag(sk, SOCK_TIMESTAMPING_RX_HARDWARE,
+                                 val & SOF_TIMESTAMPING_RX_HARDWARE);
+               if (val & SOF_TIMESTAMPING_RX_SOFTWARE)
+                       sock_enable_timestamp(sk,
+                                             SOCK_TIMESTAMPING_RX_SOFTWARE);
+               else
+                       sock_disable_timestamp(sk,
+                                              SOCK_TIMESTAMPING_RX_SOFTWARE);
+               sock_valbool_flag(sk, SOCK_TIMESTAMPING_SOFTWARE,
+                                 val & SOF_TIMESTAMPING_SOFTWARE);
+               sock_valbool_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE,
+                                 val & SOF_TIMESTAMPING_SYS_HARDWARE);
+               sock_valbool_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE,
+                                 val & SOF_TIMESTAMPING_RAW_HARDWARE);
+               break;
+
        case SO_RCVLOWAT:
                if (val < 0)
                        val = INT_MAX;
@@ -768,6 +797,24 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
                v.val = sock_flag(sk, SOCK_RCVTSTAMPNS);
                break;
 
+       case SO_TIMESTAMPING:
+               v.val = 0;
+               if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE))
+                       v.val |= SOF_TIMESTAMPING_TX_HARDWARE;
+               if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE))
+                       v.val |= SOF_TIMESTAMPING_TX_SOFTWARE;
+               if (sock_flag(sk, SOCK_TIMESTAMPING_RX_HARDWARE))
+                       v.val |= SOF_TIMESTAMPING_RX_HARDWARE;
+               if (sock_flag(sk, SOCK_TIMESTAMPING_RX_SOFTWARE))
+                       v.val |= SOF_TIMESTAMPING_RX_SOFTWARE;
+               if (sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE))
+                       v.val |= SOF_TIMESTAMPING_SOFTWARE;
+               if (sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE))
+                       v.val |= SOF_TIMESTAMPING_SYS_HARDWARE;
+               if (sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE))
+                       v.val |= SOF_TIMESTAMPING_RAW_HARDWARE;
+               break;
+
        case SO_RCVTIMEO:
                lv=sizeof(struct timeval);
                if (sk->sk_rcvtimeo == MAX_SCHEDULE_TIMEOUT) {
@@ -969,7 +1016,8 @@ void sk_free(struct sock *sk)
                rcu_assign_pointer(sk->sk_filter, NULL);
        }
 
-       sock_disable_timestamp(sk);
+       sock_disable_timestamp(sk, SOCK_TIMESTAMP);
+       sock_disable_timestamp(sk, SOCK_TIMESTAMPING_RX_SOFTWARE);
 
        if (atomic_read(&sk->sk_omem_alloc))
                printk(KERN_DEBUG "%s: optmem leakage (%d bytes) detected.\n",
@@ -1255,10 +1303,9 @@ static long sock_wait_for_wmem(struct sock * sk, long timeo)
  *     Generic send/receive buffer handlers
  */
 
-static struct sk_buff *sock_alloc_send_pskb(struct sock *sk,
-                                           unsigned long header_len,
-                                           unsigned long data_len,
-                                           int noblock, int *errcode)
+struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len,
+                                    unsigned long data_len, int noblock,
+                                    int *errcode)
 {
        struct sk_buff *skb;
        gfp_t gfp_mask;
@@ -1338,6 +1385,7 @@ failure:
        *errcode = err;
        return NULL;
 }
+EXPORT_SYMBOL(sock_alloc_send_pskb);
 
 struct sk_buff *sock_alloc_send_skb(struct sock *sk, unsigned long size,
                                    int noblock, int *errcode)
@@ -1786,7 +1834,7 @@ int sock_get_timestamp(struct sock *sk, struct timeval __user *userstamp)
 {
        struct timeval tv;
        if (!sock_flag(sk, SOCK_TIMESTAMP))
-               sock_enable_timestamp(sk);
+               sock_enable_timestamp(sk, SOCK_TIMESTAMP);
        tv = ktime_to_timeval(sk->sk_stamp);
        if (tv.tv_sec == -1)
                return -ENOENT;
@@ -1802,7 +1850,7 @@ int sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
 {
        struct timespec ts;
        if (!sock_flag(sk, SOCK_TIMESTAMP))
-               sock_enable_timestamp(sk);
+               sock_enable_timestamp(sk, SOCK_TIMESTAMP);
        ts = ktime_to_timespec(sk->sk_stamp);
        if (ts.tv_sec == -1)
                return -ENOENT;
@@ -1814,11 +1862,20 @@ int sock_get_timestampns(struct sock *sk, struct timespec __user *userstamp)
 }
 EXPORT_SYMBOL(sock_get_timestampns);
 
-void sock_enable_timestamp(struct sock *sk)
+void sock_enable_timestamp(struct sock *sk, int flag)
 {
-       if (!sock_flag(sk, SOCK_TIMESTAMP)) {
-               sock_set_flag(sk, SOCK_TIMESTAMP);
-               net_enable_timestamp();
+       if (!sock_flag(sk, flag)) {
+               sock_set_flag(sk, flag);
+               /*
+                * we just set one of the two flags which require net
+                * time stamping, but time stamping might have been on
+                * already because of the other one
+                */
+               if (!sock_flag(sk,
+                               flag == SOCK_TIMESTAMP ?
+                               SOCK_TIMESTAMPING_RX_SOFTWARE :
+                               SOCK_TIMESTAMP))
+                       net_enable_timestamp();
        }
 }
 
index f2230fc168e14b257028378c49d5227397ae52b7..08a569ff02d1283816a7f11818cb06dd5dd7da87 100644 (file)
 extern int dccp_debug;
 #define dccp_pr_debug(format, a...)      DCCP_PR_DEBUG(dccp_debug, format, ##a)
 #define dccp_pr_debug_cat(format, a...)   DCCP_PRINTK(dccp_debug, format, ##a)
+#define dccp_debug(fmt, a...)            dccp_pr_debug_cat(KERN_DEBUG fmt, ##a)
 #else
 #define dccp_pr_debug(format, a...)
 #define dccp_pr_debug_cat(format, a...)
+#define dccp_debug(format, a...)
 #endif
 
 extern struct inet_hashinfo dccp_hashinfo;
@@ -95,9 +97,6 @@ extern void dccp_time_wait(struct sock *sk, int state, int timeo);
 extern int  sysctl_dccp_request_retries;
 extern int  sysctl_dccp_retries1;
 extern int  sysctl_dccp_retries2;
-extern int  sysctl_dccp_feat_sequence_window;
-extern int  sysctl_dccp_feat_rx_ccid;
-extern int  sysctl_dccp_feat_tx_ccid;
 extern int  sysctl_dccp_tx_qlen;
 extern int  sysctl_dccp_sync_ratelimit;
 
@@ -409,23 +408,21 @@ static inline void dccp_hdr_set_ack(struct dccp_hdr_ack_bits *dhack,
 static inline void dccp_update_gsr(struct sock *sk, u64 seq)
 {
        struct dccp_sock *dp = dccp_sk(sk);
-       const struct dccp_minisock *dmsk = dccp_msk(sk);
 
        dp->dccps_gsr = seq;
-       dccp_set_seqno(&dp->dccps_swl,
-                      dp->dccps_gsr + 1 - (dmsk->dccpms_sequence_window / 4));
-       dccp_set_seqno(&dp->dccps_swh,
-                      dp->dccps_gsr + (3 * dmsk->dccpms_sequence_window) / 4);
+       /* Sequence validity window depends on remote Sequence Window (7.5.1) */
+       dp->dccps_swl = SUB48(ADD48(dp->dccps_gsr, 1), dp->dccps_r_seq_win / 4);
+       dp->dccps_swh = ADD48(dp->dccps_gsr, (3 * dp->dccps_r_seq_win) / 4);
 }
 
 static inline void dccp_update_gss(struct sock *sk, u64 seq)
 {
        struct dccp_sock *dp = dccp_sk(sk);
 
-       dp->dccps_awh = dp->dccps_gss = seq;
-       dccp_set_seqno(&dp->dccps_awl,
-                      (dp->dccps_gss -
-                       dccp_msk(sk)->dccpms_sequence_window + 1));
+       dp->dccps_gss = seq;
+       /* Ack validity window depends on local Sequence Window value (7.5.1) */
+       dp->dccps_awl = SUB48(ADD48(dp->dccps_gss, 1), dp->dccps_l_seq_win);
+       dp->dccps_awh = dp->dccps_gss;
 }
 
 static inline int dccp_ack_pending(const struct sock *sk)
index 4152308958ab0b3a10a70b729e32e8d988816e3b..b04160a2eea551e0ddb3d18b89f60674328f105b 100644 (file)
 #include "ccid.h"
 #include "feat.h"
 
+/* feature-specific sysctls - initialised to the defaults from RFC 4340, 6.4 */
+unsigned long  sysctl_dccp_sequence_window __read_mostly = 100;
+int            sysctl_dccp_rx_ccid         __read_mostly = 2,
+               sysctl_dccp_tx_ccid         __read_mostly = 2;
+
 /*
  * Feature activation handlers.
  *
@@ -51,8 +56,17 @@ static int dccp_hdlr_ccid(struct sock *sk, u64 ccid, bool rx)
 
 static int dccp_hdlr_seq_win(struct sock *sk, u64 seq_win, bool rx)
 {
-       if (!rx)
-               dccp_msk(sk)->dccpms_sequence_window = seq_win;
+       struct dccp_sock *dp = dccp_sk(sk);
+
+       if (rx) {
+               dp->dccps_r_seq_win = seq_win;
+               /* propagate changes to update SWL/SWH */
+               dccp_update_gsr(sk, dp->dccps_gsr);
+       } else {
+               dp->dccps_l_seq_win = seq_win;
+               /* propagate changes to update AWL */
+               dccp_update_gss(sk, dp->dccps_gss);
+       }
        return 0;
 }
 
@@ -194,6 +208,100 @@ static int dccp_feat_default_value(u8 feat_num)
        return idx < 0 ? 0 : dccp_feat_table[idx].default_value;
 }
 
+/*
+ *     Debugging and verbose-printing section
+ */
+static const char *dccp_feat_fname(const u8 feat)
+{
+       static const char *feature_names[] = {
+               [DCCPF_RESERVED]        = "Reserved",
+               [DCCPF_CCID]            = "CCID",
+               [DCCPF_SHORT_SEQNOS]    = "Allow Short Seqnos",
+               [DCCPF_SEQUENCE_WINDOW] = "Sequence Window",
+               [DCCPF_ECN_INCAPABLE]   = "ECN Incapable",
+               [DCCPF_ACK_RATIO]       = "Ack Ratio",
+               [DCCPF_SEND_ACK_VECTOR] = "Send ACK Vector",
+               [DCCPF_SEND_NDP_COUNT]  = "Send NDP Count",
+               [DCCPF_MIN_CSUM_COVER]  = "Min. Csum Coverage",
+               [DCCPF_DATA_CHECKSUM]   = "Send Data Checksum",
+       };
+       if (feat > DCCPF_DATA_CHECKSUM && feat < DCCPF_MIN_CCID_SPECIFIC)
+               return feature_names[DCCPF_RESERVED];
+
+       if (feat ==  DCCPF_SEND_LEV_RATE)
+               return "Send Loss Event Rate";
+       if (feat >= DCCPF_MIN_CCID_SPECIFIC)
+               return "CCID-specific";
+
+       return feature_names[feat];
+}
+
+static const char *dccp_feat_sname[] = { "DEFAULT", "INITIALISING", "CHANGING",
+                                        "UNSTABLE", "STABLE" };
+
+#ifdef CONFIG_IP_DCCP_DEBUG
+static const char *dccp_feat_oname(const u8 opt)
+{
+       switch (opt) {
+       case DCCPO_CHANGE_L:  return "Change_L";
+       case DCCPO_CONFIRM_L: return "Confirm_L";
+       case DCCPO_CHANGE_R:  return "Change_R";
+       case DCCPO_CONFIRM_R: return "Confirm_R";
+       }
+       return NULL;
+}
+
+static void dccp_feat_printval(u8 feat_num, dccp_feat_val const *val)
+{
+       u8 i, type = dccp_feat_type(feat_num);
+
+       if (val == NULL || (type == FEAT_SP && val->sp.vec == NULL))
+               dccp_pr_debug_cat("(NULL)");
+       else if (type == FEAT_SP)
+               for (i = 0; i < val->sp.len; i++)
+                       dccp_pr_debug_cat("%s%u", i ? " " : "", val->sp.vec[i]);
+       else if (type == FEAT_NN)
+               dccp_pr_debug_cat("%llu", (unsigned long long)val->nn);
+       else
+               dccp_pr_debug_cat("unknown type %u", type);
+}
+
+static void dccp_feat_printvals(u8 feat_num, u8 *list, u8 len)
+{
+       u8 type = dccp_feat_type(feat_num);
+       dccp_feat_val fval = { .sp.vec = list, .sp.len = len };
+
+       if (type == FEAT_NN)
+               fval.nn = dccp_decode_value_var(list, len);
+       dccp_feat_printval(feat_num, &fval);
+}
+
+static void dccp_feat_print_entry(struct dccp_feat_entry const *entry)
+{
+       dccp_debug("   * %s %s = ", entry->is_local ? "local" : "remote",
+                                   dccp_feat_fname(entry->feat_num));
+       dccp_feat_printval(entry->feat_num, &entry->val);
+       dccp_pr_debug_cat(", state=%s %s\n", dccp_feat_sname[entry->state],
+                         entry->needs_confirm ? "(Confirm pending)" : "");
+}
+
+#define dccp_feat_print_opt(opt, feat, val, len, mandatory)    do {          \
+       dccp_pr_debug("%s(%s, ", dccp_feat_oname(opt), dccp_feat_fname(feat));\
+       dccp_feat_printvals(feat, val, len);                                  \
+       dccp_pr_debug_cat(") %s\n", mandatory ? "!" : "");      } while (0)
+
+#define dccp_feat_print_fnlist(fn_list)  {             \
+       const struct dccp_feat_entry *___entry;         \
+                                                       \
+       dccp_pr_debug("List Dump:\n");                  \
+       list_for_each_entry(___entry, fn_list, node)    \
+               dccp_feat_print_entry(___entry);        \
+}
+#else  /* ! CONFIG_IP_DCCP_DEBUG */
+#define dccp_feat_print_opt(opt, feat, val, len, mandatory)
+#define dccp_feat_print_fnlist(fn_list)
+#endif
+
 static int __dccp_feat_activate(struct sock *sk, const int idx,
                                const bool is_local, dccp_feat_val const *fval)
 {
@@ -226,6 +334,10 @@ static int __dccp_feat_activate(struct sock *sk, const int idx,
        /* Location is RX if this is a local-RX or remote-TX feature */
        rx = (is_local == (dccp_feat_table[idx].rxtx == FEAT_AT_RX));
 
+       dccp_debug("   -> activating %s %s, %sval=%llu\n", rx ? "RX" : "TX",
+                  dccp_feat_fname(dccp_feat_table[idx].feat_num),
+                  fval ? "" : "default ",  (unsigned long long)val);
+
        return dccp_feat_table[idx].activation_hdlr(sk, val, rx);
 }
 
@@ -530,6 +642,7 @@ int dccp_feat_insert_opts(struct dccp_sock *dp, struct dccp_request_sock *dreq,
                                return -1;
                        }
                }
+               dccp_feat_print_opt(opt, pos->feat_num, ptr, len, 0);
 
                if (dccp_insert_fn_opt(skb, opt, pos->feat_num, ptr, len, rpt))
                        return -1;
@@ -783,6 +896,7 @@ int dccp_feat_finalise_settings(struct dccp_sock *dp)
        while (i--)
                if (ccids[i] > 0 && dccp_feat_propagate_ccid(fn, ccids[i], i))
                        return -1;
+       dccp_feat_print_fnlist(fn);
        return 0;
 }
 
@@ -901,6 +1015,8 @@ static u8 dccp_feat_change_recv(struct list_head *fn, u8 is_mandatory, u8 opt,
        if (len == 0 || type == FEAT_UNKNOWN)           /* 6.1 and 6.6.8 */
                goto unknown_feature_or_value;
 
+       dccp_feat_print_opt(opt, feat, val, len, is_mandatory);
+
        /*
         *      Negotiation of NN features: Change R is invalid, so there is no
         *      simultaneous negotiation; hence we do not look up in the list.
@@ -1006,6 +1122,8 @@ static u8 dccp_feat_confirm_recv(struct list_head *fn, u8 is_mandatory, u8 opt,
        const bool local = (opt == DCCPO_CONFIRM_R);
        struct dccp_feat_entry *entry = dccp_feat_list_lookup(fn, feat, local);
 
+       dccp_feat_print_opt(opt, feat, val, len, is_mandatory);
+
        if (entry == NULL) {    /* nothing queued: ignore or handle error */
                if (is_mandatory && type == FEAT_UNKNOWN)
                        return DCCP_RESET_CODE_MANDATORY_ERROR;
@@ -1115,23 +1233,70 @@ int dccp_feat_parse_options(struct sock *sk, struct dccp_request_sock *dreq,
        return 0;       /* ignore FN options in all other states */
 }
 
+/**
+ * dccp_feat_init  -  Seed feature negotiation with host-specific defaults
+ * This initialises global defaults, depending on the value of the sysctls.
+ * These can later be overridden by registering changes via setsockopt calls.
+ * The last link in the chain is finalise_settings, to make sure that between
+ * here and the start of actual feature negotiation no inconsistencies enter.
+ *
+ * All features not appearing below use either defaults or are otherwise
+ * later adjusted through dccp_feat_finalise_settings().
+ */
 int dccp_feat_init(struct sock *sk)
 {
-       struct dccp_sock *dp = dccp_sk(sk);
-       struct dccp_minisock *dmsk = dccp_msk(sk);
+       struct list_head *fn = &dccp_sk(sk)->dccps_featneg;
+       u8 on = 1, off = 0;
        int rc;
+       struct {
+               u8 *val;
+               u8 len;
+       } tx, rx;
+
+       /* Non-negotiable (NN) features */
+       rc = __feat_register_nn(fn, DCCPF_SEQUENCE_WINDOW, 0,
+                                   sysctl_dccp_sequence_window);
+       if (rc)
+               return rc;
+
+       /* Server-priority (SP) features */
+
+       /* Advertise that short seqnos are not supported (7.6.1) */
+       rc = __feat_register_sp(fn, DCCPF_SHORT_SEQNOS, true, true, &off, 1);
+       if (rc)
+               return rc;
 
-       INIT_LIST_HEAD(&dmsk->dccpms_pending);  /* XXX no longer used */
-       INIT_LIST_HEAD(&dmsk->dccpms_conf);     /* XXX no longer used */
+       /* RFC 4340 12.1: "If a DCCP is not ECN capable, ..." */
+       rc = __feat_register_sp(fn, DCCPF_ECN_INCAPABLE, true, true, &on, 1);
+       if (rc)
+               return rc;
+
+       /*
+        * We advertise the available list of CCIDs and reorder according to
+        * preferences, to avoid failure resulting from negotiating different
+        * singleton values (which always leads to failure).
+        * These settings can still (later) be overridden via sockopts.
+        */
+       if (ccid_get_builtin_ccids(&tx.val, &tx.len) ||
+           ccid_get_builtin_ccids(&rx.val, &rx.len))
+               return -ENOBUFS;
+
+       if (!dccp_feat_prefer(sysctl_dccp_tx_ccid, tx.val, tx.len) ||
+           !dccp_feat_prefer(sysctl_dccp_rx_ccid, rx.val, rx.len))
+               goto free_ccid_lists;
+
+       rc = __feat_register_sp(fn, DCCPF_CCID, true, false, tx.val, tx.len);
+       if (rc)
+               goto free_ccid_lists;
+
+       rc = __feat_register_sp(fn, DCCPF_CCID, false, false, rx.val, rx.len);
 
-       /* Ack ratio */
-       rc = __feat_register_nn(&dp->dccps_featneg, DCCPF_ACK_RATIO, 0,
-                               dp->dccps_l_ack_ratio);
+free_ccid_lists:
+       kfree(tx.val);
+       kfree(rx.val);
        return rc;
 }
 
-EXPORT_SYMBOL_GPL(dccp_feat_init);
-
 int dccp_feat_activate_values(struct sock *sk, struct list_head *fn_list)
 {
        struct dccp_sock *dp = dccp_sk(sk);
@@ -1156,9 +1321,10 @@ int dccp_feat_activate_values(struct sock *sk, struct list_head *fn_list)
                        goto activation_failed;
                }
                if (cur->state != FEAT_STABLE) {
-                       DCCP_CRIT("Negotiation of %s %u failed in state %u",
+                       DCCP_CRIT("Negotiation of %s %s failed in state %s",
                                  cur->is_local ? "local" : "remote",
-                                 cur->feat_num, cur->state);
+                                 dccp_feat_fname(cur->feat_num),
+                                 dccp_feat_sname[cur->state]);
                        goto activation_failed;
                }
                fvals[idx][cur->is_local] = &cur->val;
@@ -1199,43 +1365,3 @@ activation_failed:
        dp->dccps_hc_rx_ackvec = NULL;
        return -1;
 }
-
-#ifdef CONFIG_IP_DCCP_DEBUG
-const char *dccp_feat_typename(const u8 type)
-{
-       switch(type) {
-       case DCCPO_CHANGE_L:  return("ChangeL");
-       case DCCPO_CONFIRM_L: return("ConfirmL");
-       case DCCPO_CHANGE_R:  return("ChangeR");
-       case DCCPO_CONFIRM_R: return("ConfirmR");
-       /* the following case must not appear in feature negotation  */
-       default:              dccp_pr_debug("unknown type %d [BUG!]\n", type);
-       }
-       return NULL;
-}
-
-const char *dccp_feat_name(const u8 feat)
-{
-       static const char *feature_names[] = {
-               [DCCPF_RESERVED]        = "Reserved",
-               [DCCPF_CCID]            = "CCID",
-               [DCCPF_SHORT_SEQNOS]    = "Allow Short Seqnos",
-               [DCCPF_SEQUENCE_WINDOW] = "Sequence Window",
-               [DCCPF_ECN_INCAPABLE]   = "ECN Incapable",
-               [DCCPF_ACK_RATIO]       = "Ack Ratio",
-               [DCCPF_SEND_ACK_VECTOR] = "Send ACK Vector",
-               [DCCPF_SEND_NDP_COUNT]  = "Send NDP Count",
-               [DCCPF_MIN_CSUM_COVER]  = "Min. Csum Coverage",
-               [DCCPF_DATA_CHECKSUM]   = "Send Data Checksum",
-       };
-       if (feat > DCCPF_DATA_CHECKSUM && feat < DCCPF_MIN_CCID_SPECIFIC)
-               return feature_names[DCCPF_RESERVED];
-
-       if (feat ==  DCCPF_SEND_LEV_RATE)
-               return "Send Loss Event Rate";
-       if (feat >= DCCPF_MIN_CCID_SPECIFIC)
-               return "CCID-specific";
-
-       return feature_names[feat];
-}
-#endif /* CONFIG_IP_DCCP_DEBUG */
index 9b46e2a7866e675db04857d21b0b58899af70b8f..f96721619defecb9d844fd56e5e9f3e9d65f6eb6 100644 (file)
@@ -100,26 +100,21 @@ struct ccid_dependency {
        u8      val;
 };
 
-#ifdef CONFIG_IP_DCCP_DEBUG
-extern const char *dccp_feat_typename(const u8 type);
-extern const char *dccp_feat_name(const u8 feat);
-
-static inline void dccp_feat_debug(const u8 type, const u8 feat, const u8 val)
-{
-       dccp_pr_debug("%s(%s (%d), %d)\n", dccp_feat_typename(type),
-                                          dccp_feat_name(feat), feat, val);
-}
-#else
-#define dccp_feat_debug(type, feat, val)
-#endif /* CONFIG_IP_DCCP_DEBUG */
+/*
+ * Sysctls to seed defaults for feature negotiation
+ */
+extern unsigned long sysctl_dccp_sequence_window;
+extern int          sysctl_dccp_rx_ccid;
+extern int          sysctl_dccp_tx_ccid;
 
+extern int  dccp_feat_init(struct sock *sk);
+extern void dccp_feat_initialise_sysctls(void);
 extern int  dccp_feat_register_sp(struct sock *sk, u8 feat, u8 is_local,
                                  u8 const *list, u8 len);
 extern int  dccp_feat_register_nn(struct sock *sk, u8 feat, u64 val);
 extern int  dccp_feat_parse_options(struct sock *, struct dccp_request_sock *,
                                    u8 mand, u8 opt, u8 feat, u8 *val, u8 len);
 extern int  dccp_feat_clone_list(struct list_head const *, struct list_head *);
-extern int  dccp_feat_init(struct sock *sk);
 
 /*
  * Encoding variable-length options and their maximum length.
index 6821ae33dd37a02600dc80b4ba7f8f8452c6185a..5ca49cec95f5aedf3d45406567c5f22bdf65d9af 100644 (file)
@@ -42,11 +42,6 @@ struct inet_timewait_death_row dccp_death_row = {
 
 EXPORT_SYMBOL_GPL(dccp_death_row);
 
-void dccp_minisock_init(struct dccp_minisock *dmsk)
-{
-       dmsk->dccpms_sequence_window = sysctl_dccp_feat_sequence_window;
-}
-
 void dccp_time_wait(struct sock *sk, int state, int timeo)
 {
        struct inet_timewait_sock *tw = NULL;
@@ -110,7 +105,6 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
                struct dccp_request_sock *dreq = dccp_rsk(req);
                struct inet_connection_sock *newicsk = inet_csk(newsk);
                struct dccp_sock *newdp = dccp_sk(newsk);
-               struct dccp_minisock *newdmsk = dccp_msk(newsk);
 
                newdp->dccps_role           = DCCP_ROLE_SERVER;
                newdp->dccps_hc_rx_ackvec   = NULL;
@@ -128,10 +122,6 @@ struct sock *dccp_create_openreq_child(struct sock *sk,
                 *    Initialize S.GAR := S.ISS
                 *    Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookies
                 */
-
-               /* See dccp_v4_conn_request */
-               newdmsk->dccpms_sequence_window = req->rcv_wnd;
-
                newdp->dccps_gar = newdp->dccps_iss = dreq->dreq_iss;
                dccp_update_gss(newsk, dreq->dreq_iss);
 
@@ -290,7 +280,6 @@ int dccp_reqsk_init(struct request_sock *req,
        inet_rsk(req)->rmt_port   = dccp_hdr(skb)->dccph_sport;
        inet_rsk(req)->loc_port   = dccp_hdr(skb)->dccph_dport;
        inet_rsk(req)->acked      = 0;
-       req->rcv_wnd              = sysctl_dccp_feat_sequence_window;
        dreq->dreq_timestamp_echo = 0;
 
        /* inherit feature negotiation options from listening socket */
index 7b1165c21f5173a40c9511f934ccc5dcc02cc896..1b08cae9c65ba21fb1a28c255b810e868acc044a 100644 (file)
 #include "dccp.h"
 #include "feat.h"
 
-int sysctl_dccp_feat_sequence_window = DCCPF_INITIAL_SEQUENCE_WINDOW;
-int sysctl_dccp_feat_rx_ccid         = DCCPF_INITIAL_CCID;
-int sysctl_dccp_feat_tx_ccid         = DCCPF_INITIAL_CCID;
-
 u64 dccp_decode_value_var(const u8 *bf, const u8 len)
 {
        u64 value = 0;
@@ -502,10 +498,6 @@ int dccp_insert_fn_opt(struct sk_buff *skb, u8 type, u8 feat,
                *to++ = *val;
        if (len)
                memcpy(to, val, len);
-
-       dccp_pr_debug("%s(%s (%d), ...), length %d\n",
-                     dccp_feat_typename(type),
-                     dccp_feat_name(feat), feat, len);
        return 0;
 }
 
index 945b4d5d23b3153fce6efd1fb0b3e04dee04b501..314a1b5c033c88950ddf73eccf30a34bcaf60191 100644 (file)
@@ -174,8 +174,6 @@ int dccp_init_sock(struct sock *sk, const __u8 ctl_sock_initialized)
        struct dccp_sock *dp = dccp_sk(sk);
        struct inet_connection_sock *icsk = inet_csk(sk);
 
-       dccp_minisock_init(&dp->dccps_minisock);
-
        icsk->icsk_rto          = DCCP_TIMEOUT_INIT;
        icsk->icsk_syn_retries  = sysctl_dccp_request_retries;
        sk->sk_state            = DCCP_CLOSED;
index 018e210875e168141a2aca941ab11ca7daaca9ef..a5a1856234e76bd32368b799c49ab43520092532 100644 (file)
 #error This file should not be compiled without CONFIG_SYSCTL defined
 #endif
 
+/* Boundary values */
+static int             zero     = 0,
+                       u8_max   = 0xFF;
+static unsigned long   seqw_min = 32;
+
 static struct ctl_table dccp_default_table[] = {
        {
                .procname       = "seq_window",
-               .data           = &sysctl_dccp_feat_sequence_window,
-               .maxlen         = sizeof(sysctl_dccp_feat_sequence_window),
+               .data           = &sysctl_dccp_sequence_window,
+               .maxlen         = sizeof(sysctl_dccp_sequence_window),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_doulongvec_minmax,
+               .extra1         = &seqw_min,            /* RFC 4340, 7.5.2 */
        },
        {
                .procname       = "rx_ccid",
-               .data           = &sysctl_dccp_feat_rx_ccid,
-               .maxlen         = sizeof(sysctl_dccp_feat_rx_ccid),
+               .data           = &sysctl_dccp_rx_ccid,
+               .maxlen         = sizeof(sysctl_dccp_rx_ccid),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
+               .extra2         = &u8_max,              /* RFC 4340, 10. */
        },
        {
                .procname       = "tx_ccid",
-               .data           = &sysctl_dccp_feat_tx_ccid,
-               .maxlen         = sizeof(sysctl_dccp_feat_tx_ccid),
+               .data           = &sysctl_dccp_tx_ccid,
+               .maxlen         = sizeof(sysctl_dccp_tx_ccid),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
+               .extra2         = &u8_max,              /* RFC 4340, 10. */
        },
        {
                .procname       = "request_retries",
                .data           = &sysctl_dccp_request_retries,
                .maxlen         = sizeof(sysctl_dccp_request_retries),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
+               .extra2         = &u8_max,
        },
        {
                .procname       = "retries1",
                .data           = &sysctl_dccp_retries1,
                .maxlen         = sizeof(sysctl_dccp_retries1),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
+               .extra2         = &u8_max,
        },
        {
                .procname       = "retries2",
                .data           = &sysctl_dccp_retries2,
                .maxlen         = sizeof(sysctl_dccp_retries2),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
+               .extra2         = &u8_max,
        },
        {
                .procname       = "tx_qlen",
                .data           = &sysctl_dccp_tx_qlen,
                .maxlen         = sizeof(sysctl_dccp_tx_qlen),
                .mode           = 0644,
-               .proc_handler   = proc_dointvec,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = &zero,
        },
        {
                .procname       = "sync_ratelimit",
index cf0e18499297080bac82f4b020409dd2dbb0f5fa..12bf7d4c16c641dd31a33904331b43d0069a666f 100644 (file)
@@ -2113,7 +2113,7 @@ static struct notifier_block dn_dev_notifier = {
 extern int dn_route_rcv(struct sk_buff *, struct net_device *, struct packet_type *, struct net_device *);
 
 static struct packet_type dn_dix_packet_type = {
-       .type =         __constant_htons(ETH_P_DNA_RT),
+       .type =         cpu_to_be16(ETH_P_DNA_RT),
        .dev =          NULL,           /* All devices */
        .func =         dn_route_rcv,
 };
index c754670b7fca4e98376fdb22657efb5e3e5613d6..5130dee0b384023911306aaf29da23aab1a1dc30 100644 (file)
@@ -124,7 +124,7 @@ int decnet_dst_gc_interval = 2;
 
 static struct dst_ops dn_dst_ops = {
        .family =               PF_DECnet,
-       .protocol =             __constant_htons(ETH_P_DNA_RT),
+       .protocol =             cpu_to_be16(ETH_P_DNA_RT),
        .gc_thresh =            128,
        .gc =                   dn_dst_gc,
        .check =                dn_dst_check,
index ec8c6a0482d3dde28385c498fbad59707da6ede3..1003187222146c2a7708258369c7a30d15243762 100644 (file)
@@ -394,7 +394,7 @@ static int mv88e6123_61_65_get_sset_count(struct dsa_switch *ds)
 }
 
 static struct dsa_switch_driver mv88e6123_61_65_switch_driver = {
-       .tag_protocol           = __constant_htons(ETH_P_EDSA),
+       .tag_protocol           = cpu_to_be16(ETH_P_EDSA),
        .priv_size              = sizeof(struct mv88e6xxx_priv_state),
        .probe                  = mv88e6123_61_65_probe,
        .setup                  = mv88e6123_61_65_setup,
index 374d46a01265a334901bc652c57b939a419ddfaf..70fae2444cb65e64828e07bcbd9aef5bf35f2b65 100644 (file)
@@ -353,7 +353,7 @@ static int mv88e6131_get_sset_count(struct dsa_switch *ds)
 }
 
 static struct dsa_switch_driver mv88e6131_switch_driver = {
-       .tag_protocol           = __constant_htons(ETH_P_DSA),
+       .tag_protocol           = cpu_to_be16(ETH_P_DSA),
        .priv_size              = sizeof(struct mv88e6xxx_priv_state),
        .probe                  = mv88e6131_probe,
        .setup                  = mv88e6131_setup,
index f99a019b939ed7e2b15e90bcfa5be1716accd1b9..63e532a69fdb1186077d0cc6dd658f276ec59565 100644 (file)
@@ -176,7 +176,7 @@ out:
 }
 
 static struct packet_type dsa_packet_type = {
-       .type   = __constant_htons(ETH_P_DSA),
+       .type   = cpu_to_be16(ETH_P_DSA),
        .func   = dsa_rcv,
 };
 
index 328ec957f7864a670ce7ad841ae43010fa2d2e35..6197f9a7ef421f7eec701f8a61defdbb11bcbbdb 100644 (file)
@@ -195,7 +195,7 @@ out:
 }
 
 static struct packet_type edsa_packet_type = {
-       .type   = __constant_htons(ETH_P_EDSA),
+       .type   = cpu_to_be16(ETH_P_EDSA),
        .func   = edsa_rcv,
 };
 
index b59132878ad1c45ce54271213d5b4909d5113809..d7e7f424ff0c4a09c6bccb8cdff5fbbe556e687e 100644 (file)
@@ -112,7 +112,7 @@ out:
 }
 
 static struct packet_type trailer_packet_type = {
-       .type   = __constant_htons(ETH_P_TRAILER),
+       .type   = cpu_to_be16(ETH_P_TRAILER),
        .func   = trailer_rcv,
 };
 
index 8789d2bb1b067fd59515a286610971a67dfebf37..7bf35582f65643f97e959b290a77bc66f2b88538 100644 (file)
@@ -1103,7 +1103,7 @@ drop:
 }
 
 static struct packet_type econet_packet_type = {
-       .type =         __constant_htons(ETH_P_ECONET),
+       .type =         cpu_to_be16(ETH_P_ECONET),
        .func =         econet_rcv,
 };
 
index 691268f3a35972ff931c51bc8c7eeca74e73de78..b2cf91e4ccaa11fd140af7ece0c7b11b820e048c 100644 (file)
@@ -35,7 +35,7 @@ config IP_ADVANCED_ROUTER
 
          at boot time after the /proc file system has been mounted.
 
-         If you turn on IP forwarding, you will also get the rp_filter, which
+         If you turn on IP forwarding, you should consider the rp_filter, which
          automatically rejects incoming packets if the routing table entry
          for their source address doesn't match the network interface they're
          arriving on. This has security advantages because it prevents the
@@ -46,12 +46,16 @@ config IP_ADVANCED_ROUTER
          rp_filter on use:
 
          echo 1 > /proc/sys/net/ipv4/conf/<device>/rp_filter
-         or
+          and
          echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
 
+         Note that some distributions enable it in startup scripts.
+         For details about rp_filter strict and loose mode read
+         <file:Documentation/networking/ip-sysctl.txt>.
+
          If unsure, say N here.
 
-choice 
+choice
        prompt "Choose IP: FIB lookup algorithm (choose FIB_HASH if unsure)"
        depends on IP_ADVANCED_ROUTER
        default ASK_IP_FIB_HASH
@@ -59,27 +63,29 @@ choice
 config ASK_IP_FIB_HASH
        bool "FIB_HASH"
        ---help---
-       Current FIB is very proven and good enough for most users.
+         Current FIB is very proven and good enough for most users.
 
 config IP_FIB_TRIE
        bool "FIB_TRIE"
        ---help---
-       Use new experimental LC-trie as FIB lookup algorithm. 
-        This improves lookup performance if you have a large
-       number of routes.
-
-       LC-trie is a longest matching prefix lookup algorithm which
-       performs better than FIB_HASH for large routing tables.
-       But, it consumes more memory and is more complex.
-       
-       LC-trie is described in:
-       
-       IP-address lookup using LC-tries. Stefan Nilsson and Gunnar Karlsson
-       IEEE Journal on Selected Areas in Communications, 17(6):1083-1092, June 1999
-       An experimental study of compression methods for dynamic tries
-       Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002.
-       http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/
-       
+         Use new experimental LC-trie as FIB lookup algorithm.
+         This improves lookup performance if you have a large
+         number of routes.
+
+         LC-trie is a longest matching prefix lookup algorithm which
+         performs better than FIB_HASH for large routing tables.
+         But, it consumes more memory and is more complex.
+
+         LC-trie is described in:
+
+         IP-address lookup using LC-tries. Stefan Nilsson and Gunnar Karlsson
+         IEEE Journal on Selected Areas in Communications, 17(6):1083-1092,
+         June 1999
+
+         An experimental study of compression methods for dynamic tries
+         Stefan Nilsson and Matti Tikkanen. Algorithmica, 33(1):19-33, 2002.
+         http://www.nada.kth.se/~snilsson/public/papers/dyntrie2/
+
 endchoice
 
 config IP_FIB_HASH
@@ -191,7 +197,7 @@ config IP_PNP_RARP
          <file:Documentation/filesystems/nfsroot.txt> for details.
 
 # not yet ready..
-#   bool '    IP: ARP support' CONFIG_IP_PNP_ARP               
+#   bool '    IP: ARP support' CONFIG_IP_PNP_ARP
 config NET_IPIP
        tristate "IP: tunneling"
        select INET_TUNNEL
@@ -361,7 +367,7 @@ config INET_IPCOMP
        ---help---
          Support for IP Payload Compression Protocol (IPComp) (RFC3173),
          typically needed for IPsec.
-         
+
          If unsure, say Y.
 
 config INET_XFRM_TUNNEL
@@ -415,7 +421,7 @@ config INET_DIAG
          Support for INET (TCP, DCCP, etc) socket monitoring interface used by
          native Linux tools such as ss. ss is included in iproute2, currently
          downloadable at <http://linux-net.osdl.org/index.php/Iproute2>.
-         
+
          If unsure, say Y.
 
 config INET_TCP_DIAG
index 743f5542d65a6385c7ae423ddb49d4c69daaeaee..627be4dc7fb08e2919c9367e42db7f8c2ea6dae4 100644 (file)
@@ -369,7 +369,6 @@ lookup_protocol:
        sock_init_data(sock, sk);
 
        sk->sk_destruct    = inet_sock_destruct;
-       sk->sk_family      = PF_INET;
        sk->sk_protocol    = protocol;
        sk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
 
@@ -1253,10 +1252,10 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
        int proto;
        int id;
 
-       if (unlikely(!pskb_may_pull(skb, sizeof(*iph))))
+       iph = skb_gro_header(skb, sizeof(*iph));
+       if (unlikely(!iph))
                goto out;
 
-       iph = ip_hdr(skb);
        proto = iph->protocol & (MAX_INET_PROTOS - 1);
 
        rcu_read_lock();
@@ -1264,13 +1263,13 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
        if (!ops || !ops->gro_receive)
                goto out_unlock;
 
-       if (iph->version != 4 || iph->ihl != 5)
+       if (*(u8 *)iph != 0x45)
                goto out_unlock;
 
        if (unlikely(ip_fast_csum((u8 *)iph, iph->ihl)))
                goto out_unlock;
 
-       flush = ntohs(iph->tot_len) != skb->len ||
+       flush = ntohs(iph->tot_len) != skb_gro_len(skb) ||
                iph->frag_off != htons(IP_DF);
        id = ntohs(iph->id);
 
@@ -1282,24 +1281,25 @@ static struct sk_buff **inet_gro_receive(struct sk_buff **head,
 
                iph2 = ip_hdr(p);
 
-               if (iph->protocol != iph2->protocol ||
-                   iph->tos != iph2->tos ||
-                   memcmp(&iph->saddr, &iph2->saddr, 8)) {
+               if ((iph->protocol ^ iph2->protocol) |
+                   (iph->tos ^ iph2->tos) |
+                   (iph->saddr ^ iph2->saddr) |
+                   (iph->daddr ^ iph2->daddr)) {
                        NAPI_GRO_CB(p)->same_flow = 0;
                        continue;
                }
 
                /* All fields must match except length and checksum. */
                NAPI_GRO_CB(p)->flush |=
-                       memcmp(&iph->frag_off, &iph2->frag_off, 4) ||
-                       (u16)(ntohs(iph2->id) + NAPI_GRO_CB(p)->count) != id;
+                       (iph->ttl ^ iph2->ttl) |
+                       ((u16)(ntohs(iph2->id) + NAPI_GRO_CB(p)->count) ^ id);
 
                NAPI_GRO_CB(p)->flush |= flush;
        }
 
        NAPI_GRO_CB(skb)->flush |= flush;
-       __skb_pull(skb, sizeof(*iph));
-       skb_reset_transport_header(skb);
+       skb_gro_pull(skb, sizeof(*iph));
+       skb_set_transport_header(skb, skb_gro_offset(skb));
 
        pp = ops->gro_receive(head, skb);
 
@@ -1501,7 +1501,7 @@ static int ipv4_proc_init(void);
  */
 
 static struct packet_type ip_packet_type = {
-       .type = __constant_htons(ETH_P_IP),
+       .type = cpu_to_be16(ETH_P_IP),
        .func = ip_rcv,
        .gso_send_check = inet_gso_send_check,
        .gso_segment = inet_gso_segment,
index 29a74c01d8de54857fa3ef4a82184dc8a03b91cd..3f6b7354699bb8fe8df7cb47a1ced87e9816cf06 100644 (file)
@@ -1226,7 +1226,7 @@ void arp_ifdown(struct net_device *dev)
  */
 
 static struct packet_type arp_packet_type = {
-       .type = __constant_htons(ETH_P_ARP),
+       .type = cpu_to_be16(ETH_P_ARP),
        .func = arp_rcv,
 };
 
index 6bb2635b5dedda5201b0791a58b6a9f76f94ea6f..7bc992976d29bd18b70dd39544791d66f4351901 100644 (file)
@@ -3,11 +3,16 @@
  *
  * This is an implementation of the CIPSO 2.2 protocol as specified in
  * draft-ietf-cipso-ipsecurity-01.txt with additional tag types as found in
- * FIPS-188, copies of both documents can be found in the Documentation
- * directory.  While CIPSO never became a full IETF RFC standard many vendors
+ * FIPS-188.  While CIPSO never became a full IETF RFC standard many vendors
  * have chosen to adopt the protocol and over the years it has become a
  * de-facto standard for labeled networking.
  *
+ * The CIPSO draft specification can be found in the kernel's Documentation
+ * directory as well as the following URL:
+ *   http://netlabel.sourceforge.net/files/draft-ietf-cipso-ipsecurity-01.txt
+ * The FIPS-188 specification can be found at the following URL:
+ *   http://www.itl.nist.gov/fipspubs/fip188.htm
+ *
  * Author: Paul Moore <paul.moore@hp.com>
  *
  */
index 309997edc8a5169546e87ed2a51e51214e4bea6f..d519a6a6672634902f93459e0581e92a2af51f0b 100644 (file)
@@ -1075,6 +1075,14 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
                        }
                }
                ip_mc_up(in_dev);
+               /* fall through */
+       case NETDEV_CHANGEADDR:
+               if (IN_DEV_ARP_NOTIFY(in_dev))
+                       arp_send(ARPOP_REQUEST, ETH_P_ARP,
+                                in_dev->ifa_list->ifa_address,
+                                dev,
+                                in_dev->ifa_list->ifa_address,
+                                NULL, dev->dev_addr, NULL);
                break;
        case NETDEV_DOWN:
                ip_mc_down(in_dev);
@@ -1439,6 +1447,7 @@ static struct devinet_sysctl_table {
                DEVINET_SYSCTL_RW_ENTRY(ARP_ANNOUNCE, "arp_announce"),
                DEVINET_SYSCTL_RW_ENTRY(ARP_IGNORE, "arp_ignore"),
                DEVINET_SYSCTL_RW_ENTRY(ARP_ACCEPT, "arp_accept"),
+               DEVINET_SYSCTL_RW_ENTRY(ARP_NOTIFY, "arp_notify"),
 
                DEVINET_SYSCTL_FLUSHING_ENTRY(NOXFRM, "disable_xfrm"),
                DEVINET_SYSCTL_FLUSHING_ENTRY(NOPOLICY, "disable_policy"),
index 741e4fa3e4749e0285c39f65dc306e644fb4032b..cafcc49d0993b6a6b39590f6c2246fc806eb463d 100644 (file)
@@ -275,7 +275,7 @@ int fib_validate_source(__be32 src, __be32 dst, u8 tos, int oif,
        fib_res_put(&res);
        if (no_addr)
                goto last_resort;
-       if (rpf)
+       if (rpf == 1)
                goto e_inval;
        fl.oif = dev->ifindex;
 
index 705b33b184a33cb3181e698b191c08565229ed56..3f50807237e08580d3427d687f9cf82f4da9ce59 100644 (file)
@@ -375,6 +375,7 @@ static void icmp_reply(struct icmp_bxm *icmp_param, struct sk_buff *skb)
        inet->tos = ip_hdr(skb)->tos;
        daddr = ipc.addr = rt->rt_src;
        ipc.opt = NULL;
+       ipc.shtx.flags = 0;
        if (icmp_param->replyopts.optlen) {
                ipc.opt = &icmp_param->replyopts;
                if (ipc.opt->srr)
@@ -532,6 +533,7 @@ void icmp_send(struct sk_buff *skb_in, int type, int code, __be32 info)
        inet_sk(sk)->tos = tos;
        ipc.addr = iph->saddr;
        ipc.opt = &icmp_param.replyopts;
+       ipc.shtx.flags = 0;
 
        {
                struct flowi fl = {
@@ -1205,7 +1207,7 @@ static struct pernet_operations __net_initdata icmp_sk_ops = {
 
 int __init icmp_init(void)
 {
-       return register_pernet_device(&icmp_sk_ops);
+       return register_pernet_subsys(&icmp_sk_ops);
 }
 
 EXPORT_SYMBOL(icmp_err_convert);
index f26ab38680de00a5b77c303e34774a078022d499..22cd19ee44e52f5b94788e37dd6b5dc02f018eae 100644 (file)
@@ -93,24 +93,40 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
        struct inet_bind_hashbucket *head;
        struct hlist_node *node;
        struct inet_bind_bucket *tb;
-       int ret;
+       int ret, attempts = 5;
        struct net *net = sock_net(sk);
+       int smallest_size = -1, smallest_rover;
 
        local_bh_disable();
        if (!snum) {
                int remaining, rover, low, high;
 
+again:
                inet_get_local_port_range(&low, &high);
                remaining = (high - low) + 1;
-               rover = net_random() % remaining + low;
+               smallest_rover = rover = net_random() % remaining + low;
 
+               smallest_size = -1;
                do {
                        head = &hashinfo->bhash[inet_bhashfn(net, rover,
                                        hashinfo->bhash_size)];
                        spin_lock(&head->lock);
                        inet_bind_bucket_for_each(tb, node, &head->chain)
-                               if (ib_net(tb) == net && tb->port == rover)
+                               if (ib_net(tb) == net && tb->port == rover) {
+                                       if (tb->fastreuse > 0 &&
+                                           sk->sk_reuse &&
+                                           sk->sk_state != TCP_LISTEN &&
+                                           (tb->num_owners < smallest_size || smallest_size == -1)) {
+                                               smallest_size = tb->num_owners;
+                                               smallest_rover = rover;
+                                               if (atomic_read(&hashinfo->bsockets) > (high - low) + 1) {
+                                                       spin_unlock(&head->lock);
+                                                       snum = smallest_rover;
+                                                       goto have_snum;
+                                               }
+                                       }
                                        goto next;
+                               }
                        break;
                next:
                        spin_unlock(&head->lock);
@@ -125,14 +141,19 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
                 * the top level, not from the 'break;' statement.
                 */
                ret = 1;
-               if (remaining <= 0)
+               if (remaining <= 0) {
+                       if (smallest_size != -1) {
+                               snum = smallest_rover;
+                               goto have_snum;
+                       }
                        goto fail;
-
+               }
                /* OK, here is the one we will use.  HEAD is
                 * non-NULL and we hold it's mutex.
                 */
                snum = rover;
        } else {
+have_snum:
                head = &hashinfo->bhash[inet_bhashfn(net, snum,
                                hashinfo->bhash_size)];
                spin_lock(&head->lock);
@@ -145,12 +166,19 @@ int inet_csk_get_port(struct sock *sk, unsigned short snum)
 tb_found:
        if (!hlist_empty(&tb->owners)) {
                if (tb->fastreuse > 0 &&
-                   sk->sk_reuse && sk->sk_state != TCP_LISTEN) {
+                   sk->sk_reuse && sk->sk_state != TCP_LISTEN &&
+                   smallest_size == -1) {
                        goto success;
                } else {
                        ret = 1;
-                       if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb))
+                       if (inet_csk(sk)->icsk_af_ops->bind_conflict(sk, tb)) {
+                               if (sk->sk_reuse && sk->sk_state != TCP_LISTEN &&
+                                   smallest_size != -1 && --attempts >= 0) {
+                                       spin_unlock(&head->lock);
+                                       goto again;
+                               }
                                goto fail_unlock;
+                       }
                }
        }
 tb_not_found:
index 6a1045da48d21774a78f0466deefed4539005306..625cc5f64c949fb2483c18e82d398ba6c2b0236d 100644 (file)
@@ -38,6 +38,7 @@ struct inet_bind_bucket *inet_bind_bucket_create(struct kmem_cache *cachep,
                write_pnet(&tb->ib_net, hold_net(net));
                tb->port      = snum;
                tb->fastreuse = 0;
+               tb->num_owners = 0;
                INIT_HLIST_HEAD(&tb->owners);
                hlist_add_head(&tb->node, &head->chain);
        }
@@ -59,8 +60,13 @@ void inet_bind_bucket_destroy(struct kmem_cache *cachep, struct inet_bind_bucket
 void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
                    const unsigned short snum)
 {
+       struct inet_hashinfo *hashinfo = sk->sk_prot->h.hashinfo;
+
+       atomic_inc(&hashinfo->bsockets);
+
        inet_sk(sk)->num = snum;
        sk_add_bind_node(sk, &tb->owners);
+       tb->num_owners++;
        inet_csk(sk)->icsk_bind_hash = tb;
 }
 
@@ -75,9 +81,12 @@ static void __inet_put_port(struct sock *sk)
        struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash];
        struct inet_bind_bucket *tb;
 
+       atomic_dec(&hashinfo->bsockets);
+
        spin_lock(&head->lock);
        tb = inet_csk(sk)->icsk_bind_hash;
        __sk_del_bind_node(sk);
+       tb->num_owners--;
        inet_csk(sk)->icsk_bind_hash = NULL;
        inet_sk(sk)->num = 0;
        inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb);
@@ -444,9 +453,9 @@ int __inet_hash_connect(struct inet_timewait_death_row *death_row,
                         */
                        inet_bind_bucket_for_each(tb, node, &head->chain) {
                                if (ib_net(tb) == net && tb->port == port) {
-                                       WARN_ON(hlist_empty(&tb->owners));
                                        if (tb->fastreuse >= 0)
                                                goto next_port;
+                                       WARN_ON(hlist_empty(&tb->owners));
                                        if (!check_established(death_row, sk,
                                                                port, &tw))
                                                goto ok;
@@ -523,6 +532,7 @@ void inet_hashinfo_init(struct inet_hashinfo *h)
 {
        int i;
 
+       atomic_set(&h->bsockets, 0);
        for (i = 0; i < INET_LHTABLE_SIZE; i++) {
                spin_lock_init(&h->listening_hash[i].lock);
                INIT_HLIST_NULLS_HEAD(&h->listening_hash[i].head,
index 0101521f366b74546cbb90f60e7e6faac597b430..07a188afb3ac7af64650d8eb7f641f27b8eb09b6 100644 (file)
@@ -164,67 +164,124 @@ static DEFINE_RWLOCK(ipgre_lock);
 
 /* Given src, dst and key, find appropriate for input tunnel. */
 
-static struct ip_tunnel * ipgre_tunnel_lookup(struct net *net,
+static struct ip_tunnel * ipgre_tunnel_lookup(struct net_device *dev,
                                              __be32 remote, __be32 local,
                                              __be32 key, __be16 gre_proto)
 {
+       struct net *net = dev_net(dev);
+       int link = dev->ifindex;
        unsigned h0 = HASH(remote);
        unsigned h1 = HASH(key);
-       struct ip_tunnel *t;
-       struct ip_tunnel *t2 = NULL;
+       struct ip_tunnel *t, *cand = NULL;
        struct ipgre_net *ign = net_generic(net, ipgre_net_id);
        int dev_type = (gre_proto == htons(ETH_P_TEB)) ?
                       ARPHRD_ETHER : ARPHRD_IPGRE;
+       int score, cand_score = 4;
 
        for (t = ign->tunnels_r_l[h0^h1]; t; t = t->next) {
-               if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr) {
-                       if (t->parms.i_key == key && t->dev->flags & IFF_UP) {
-                               if (t->dev->type == dev_type)
-                                       return t;
-                               if (t->dev->type == ARPHRD_IPGRE && !t2)
-                                       t2 = t;
-                       }
+               if (local != t->parms.iph.saddr ||
+                   remote != t->parms.iph.daddr ||
+                   key != t->parms.i_key ||
+                   !(t->dev->flags & IFF_UP))
+                       continue;
+
+               if (t->dev->type != ARPHRD_IPGRE &&
+                   t->dev->type != dev_type)
+                       continue;
+
+               score = 0;
+               if (t->parms.link != link)
+                       score |= 1;
+               if (t->dev->type != dev_type)
+                       score |= 2;
+               if (score == 0)
+                       return t;
+
+               if (score < cand_score) {
+                       cand = t;
+                       cand_score = score;
                }
        }
 
        for (t = ign->tunnels_r[h0^h1]; t; t = t->next) {
-               if (remote == t->parms.iph.daddr) {
-                       if (t->parms.i_key == key && t->dev->flags & IFF_UP) {
-                               if (t->dev->type == dev_type)
-                                       return t;
-                               if (t->dev->type == ARPHRD_IPGRE && !t2)
-                                       t2 = t;
-                       }
+               if (remote != t->parms.iph.daddr ||
+                   key != t->parms.i_key ||
+                   !(t->dev->flags & IFF_UP))
+                       continue;
+
+               if (t->dev->type != ARPHRD_IPGRE &&
+                   t->dev->type != dev_type)
+                       continue;
+
+               score = 0;
+               if (t->parms.link != link)
+                       score |= 1;
+               if (t->dev->type != dev_type)
+                       score |= 2;
+               if (score == 0)
+                       return t;
+
+               if (score < cand_score) {
+                       cand = t;
+                       cand_score = score;
                }
        }
 
        for (t = ign->tunnels_l[h1]; t; t = t->next) {
-               if (local == t->parms.iph.saddr ||
-                    (local == t->parms.iph.daddr &&
-                     ipv4_is_multicast(local))) {
-                       if (t->parms.i_key == key && t->dev->flags & IFF_UP) {
-                               if (t->dev->type == dev_type)
-                                       return t;
-                               if (t->dev->type == ARPHRD_IPGRE && !t2)
-                                       t2 = t;
-                       }
+               if ((local != t->parms.iph.saddr &&
+                    (local != t->parms.iph.daddr ||
+                     !ipv4_is_multicast(local))) ||
+                   key != t->parms.i_key ||
+                   !(t->dev->flags & IFF_UP))
+                       continue;
+
+               if (t->dev->type != ARPHRD_IPGRE &&
+                   t->dev->type != dev_type)
+                       continue;
+
+               score = 0;
+               if (t->parms.link != link)
+                       score |= 1;
+               if (t->dev->type != dev_type)
+                       score |= 2;
+               if (score == 0)
+                       return t;
+
+               if (score < cand_score) {
+                       cand = t;
+                       cand_score = score;
                }
        }
 
        for (t = ign->tunnels_wc[h1]; t; t = t->next) {
-               if (t->parms.i_key == key && t->dev->flags & IFF_UP) {
-                       if (t->dev->type == dev_type)
-                               return t;
-                       if (t->dev->type == ARPHRD_IPGRE && !t2)
-                               t2 = t;
+               if (t->parms.i_key != key ||
+                   !(t->dev->flags & IFF_UP))
+                       continue;
+
+               if (t->dev->type != ARPHRD_IPGRE &&
+                   t->dev->type != dev_type)
+                       continue;
+
+               score = 0;
+               if (t->parms.link != link)
+                       score |= 1;
+               if (t->dev->type != dev_type)
+                       score |= 2;
+               if (score == 0)
+                       return t;
+
+               if (score < cand_score) {
+                       cand = t;
+                       cand_score = score;
                }
        }
 
-       if (t2)
-               return t2;
+       if (cand != NULL)
+               return cand;
 
-       if (ign->fb_tunnel_dev->flags&IFF_UP)
+       if (ign->fb_tunnel_dev->flags & IFF_UP)
                return netdev_priv(ign->fb_tunnel_dev);
+
        return NULL;
 }
 
@@ -284,6 +341,7 @@ static struct ip_tunnel *ipgre_tunnel_find(struct net *net,
        __be32 remote = parms->iph.daddr;
        __be32 local = parms->iph.saddr;
        __be32 key = parms->i_key;
+       int link = parms->link;
        struct ip_tunnel *t, **tp;
        struct ipgre_net *ign = net_generic(net, ipgre_net_id);
 
@@ -291,6 +349,7 @@ static struct ip_tunnel *ipgre_tunnel_find(struct net *net,
                if (local == t->parms.iph.saddr &&
                    remote == t->parms.iph.daddr &&
                    key == t->parms.i_key &&
+                   link == t->parms.link &&
                    type == t->dev->type)
                        break;
 
@@ -421,7 +480,7 @@ static void ipgre_err(struct sk_buff *skb, u32 info)
        }
 
        read_lock(&ipgre_lock);
-       t = ipgre_tunnel_lookup(dev_net(skb->dev), iph->daddr, iph->saddr,
+       t = ipgre_tunnel_lookup(skb->dev, iph->daddr, iph->saddr,
                                flags & GRE_KEY ?
                                *(((__be32 *)p) + (grehlen / 4) - 1) : 0,
                                p[1]);
@@ -518,7 +577,7 @@ static int ipgre_rcv(struct sk_buff *skb)
        gre_proto = *(__be16 *)(h + 2);
 
        read_lock(&ipgre_lock);
-       if ((tunnel = ipgre_tunnel_lookup(dev_net(skb->dev),
+       if ((tunnel = ipgre_tunnel_lookup(skb->dev,
                                          iph->saddr, iph->daddr, key,
                                          gre_proto))) {
                struct net_device_stats *stats = &tunnel->dev->stats;
index 8ebe86dd72af159e2250bc315251cf61561cc38a..3e7e910c7c0fd6f229a9ee67a10936f24db36a3f 100644 (file)
@@ -935,6 +935,10 @@ alloc_new_skb:
                                                           sk->sk_allocation);
                                if (unlikely(skb == NULL))
                                        err = -ENOBUFS;
+                               else
+                                       /* only the initial fragment is
+                                          time stamped */
+                                       ipc->shtx.flags = 0;
                        }
                        if (skb == NULL)
                                goto error;
@@ -945,6 +949,7 @@ alloc_new_skb:
                        skb->ip_summed = csummode;
                        skb->csum = 0;
                        skb_reserve(skb, hh_len);
+                       *skb_tx(skb) = ipc->shtx;
 
                        /*
                         *      Find where to start putting bytes.
@@ -1364,6 +1369,7 @@ void ip_send_reply(struct sock *sk, struct sk_buff *skb, struct ip_reply_arg *ar
 
        daddr = ipc.addr = rt->rt_src;
        ipc.opt = NULL;
+       ipc.shtx.flags = 0;
 
        if (replyopts.opt.optlen) {
                ipc.opt = &replyopts.opt;
index d722013c1cae2a620c70282e39a767662bf608c5..90d22ae0a419e95f4a34c26a40673b03ed1840b1 100644 (file)
 #define CONF_NAMESERVERS_MAX   3       /* Maximum number of nameservers
                                           - '3' from resolv.h */
 
-#define NONE __constant_htonl(INADDR_NONE)
-#define ANY __constant_htonl(INADDR_ANY)
+#define NONE cpu_to_be32(INADDR_NONE)
+#define ANY cpu_to_be32(INADDR_ANY)
 
 /*
  * Public IP configuration
@@ -406,7 +406,7 @@ static int __init ic_defaults(void)
 static int ic_rarp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev);
 
 static struct packet_type rarp_packet_type __initdata = {
-       .type = __constant_htons(ETH_P_RARP),
+       .type = cpu_to_be16(ETH_P_RARP),
        .func = ic_rarp_recv,
 };
 
@@ -568,7 +568,7 @@ struct bootp_pkt {          /* BOOTP packet format */
 static int ic_bootp_recv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev);
 
 static struct packet_type bootp_packet_type __initdata = {
-       .type = __constant_htons(ETH_P_IP),
+       .type = cpu_to_be16(ETH_P_IP),
        .func = ic_bootp_recv,
 };
 
index 5079dfbc6f38b1423b537cd9f8ba27ab2a08c685..c49c4ecfb1541c06db42d3501f0938d3c85d66a6 100644 (file)
@@ -750,7 +750,7 @@ static struct xfrm_tunnel ipip_handler = {
        .priority       =       1,
 };
 
-static char banner[] __initdata =
+static const char banner[] __initconst =
        KERN_INFO "IPv4 over IPv4 tunneling driver\n";
 
 static void ipip_destroy_tunnels(struct ipip_net *ipn)
index 14666449dc1c2f140da8b64162d2dcfa789d3a78..13e9dd3012b3a0173f0528fa591cd3eb798e02fd 100644 (file)
@@ -67,9 +67,6 @@
 #define CONFIG_IP_PIMSM        1
 #endif
 
-static struct sock *mroute_socket;
-
-
 /* Big lock, protecting vif table, mrt cache and mroute socket state.
    Note that the changes are semaphored via rtnl_lock.
  */
@@ -80,18 +77,9 @@ static DEFINE_RWLOCK(mrt_lock);
  *     Multicast router control variables
  */
 
-static struct vif_device vif_table[MAXVIFS];           /* Devices              */
-static int maxvif;
-
-#define VIF_EXISTS(idx) (vif_table[idx].dev != NULL)
-
-static int mroute_do_assert;                           /* Set in PIM assert    */
-static int mroute_do_pim;
-
-static struct mfc_cache *mfc_cache_array[MFC_LINES];   /* Forwarding cache     */
+#define VIF_EXISTS(_net, _idx) ((_net)->ipv4.vif_table[_idx].dev != NULL)
 
 static struct mfc_cache *mfc_unres_queue;              /* Queue of unresolved entries */
-static atomic_t cache_resolve_queue_len;               /* Size of unresolved   */
 
 /* Special spinlock for queue of unresolved entries */
 static DEFINE_SPINLOCK(mfc_unres_lock);
@@ -107,7 +95,8 @@ static DEFINE_SPINLOCK(mfc_unres_lock);
 static struct kmem_cache *mrt_cachep __read_mostly;
 
 static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local);
-static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert);
+static int ipmr_cache_report(struct net *net,
+                            struct sk_buff *pkt, vifi_t vifi, int assert);
 static int ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm);
 
 #ifdef CONFIG_IP_PIMSM_V2
@@ -120,9 +109,11 @@ static struct timer_list ipmr_expire_timer;
 
 static void ipmr_del_tunnel(struct net_device *dev, struct vifctl *v)
 {
+       struct net *net = dev_net(dev);
+
        dev_close(dev);
 
-       dev = __dev_get_by_name(&init_net, "tunl0");
+       dev = __dev_get_by_name(net, "tunl0");
        if (dev) {
                const struct net_device_ops *ops = dev->netdev_ops;
                struct ifreq ifr;
@@ -148,11 +139,11 @@ static void ipmr_del_tunnel(struct net_device *dev, struct vifctl *v)
 }
 
 static
-struct net_device *ipmr_new_tunnel(struct vifctl *v)
+struct net_device *ipmr_new_tunnel(struct net *net, struct vifctl *v)
 {
        struct net_device  *dev;
 
-       dev = __dev_get_by_name(&init_net, "tunl0");
+       dev = __dev_get_by_name(net, "tunl0");
 
        if (dev) {
                const struct net_device_ops *ops = dev->netdev_ops;
@@ -181,7 +172,8 @@ struct net_device *ipmr_new_tunnel(struct vifctl *v)
 
                dev = NULL;
 
-               if (err == 0 && (dev = __dev_get_by_name(&init_net, p.name)) != NULL) {
+               if (err == 0 &&
+                   (dev = __dev_get_by_name(net, p.name)) != NULL) {
                        dev->flags |= IFF_MULTICAST;
 
                        in_dev = __in_dev_get_rtnl(dev);
@@ -209,14 +201,15 @@ failure:
 
 #ifdef CONFIG_IP_PIMSM
 
-static int reg_vif_num = -1;
-
 static int reg_vif_xmit(struct sk_buff *skb, struct net_device *dev)
 {
+       struct net *net = dev_net(dev);
+
        read_lock(&mrt_lock);
        dev->stats.tx_bytes += skb->len;
        dev->stats.tx_packets++;
-       ipmr_cache_report(skb, reg_vif_num, IGMPMSG_WHOLEPKT);
+       ipmr_cache_report(net, skb, net->ipv4.mroute_reg_vif_num,
+                         IGMPMSG_WHOLEPKT);
        read_unlock(&mrt_lock);
        kfree_skb(skb);
        return 0;
@@ -283,16 +276,16 @@ failure:
  *     @notify: Set to 1, if the caller is a notifier_call
  */
 
-static int vif_delete(int vifi, int notify)
+static int vif_delete(struct net *net, int vifi, int notify)
 {
        struct vif_device *v;
        struct net_device *dev;
        struct in_device *in_dev;
 
-       if (vifi < 0 || vifi >= maxvif)
+       if (vifi < 0 || vifi >= net->ipv4.maxvif)
                return -EADDRNOTAVAIL;
 
-       v = &vif_table[vifi];
+       v = &net->ipv4.vif_table[vifi];
 
        write_lock_bh(&mrt_lock);
        dev = v->dev;
@@ -304,17 +297,17 @@ static int vif_delete(int vifi, int notify)
        }
 
 #ifdef CONFIG_IP_PIMSM
-       if (vifi == reg_vif_num)
-               reg_vif_num = -1;
+       if (vifi == net->ipv4.mroute_reg_vif_num)
+               net->ipv4.mroute_reg_vif_num = -1;
 #endif
 
-       if (vifi+1 == maxvif) {
+       if (vifi+1 == net->ipv4.maxvif) {
                int tmp;
                for (tmp=vifi-1; tmp>=0; tmp--) {
-                       if (VIF_EXISTS(tmp))
+                       if (VIF_EXISTS(net, tmp))
                                break;
                }
-               maxvif = tmp+1;
+               net->ipv4.maxvif = tmp+1;
        }
 
        write_unlock_bh(&mrt_lock);
@@ -333,6 +326,12 @@ static int vif_delete(int vifi, int notify)
        return 0;
 }
 
+static inline void ipmr_cache_free(struct mfc_cache *c)
+{
+       release_net(mfc_net(c));
+       kmem_cache_free(mrt_cachep, c);
+}
+
 /* Destroy an unresolved cache entry, killing queued skbs
    and reporting error to netlink readers.
  */
@@ -341,8 +340,9 @@ static void ipmr_destroy_unres(struct mfc_cache *c)
 {
        struct sk_buff *skb;
        struct nlmsgerr *e;
+       struct net *net = mfc_net(c);
 
-       atomic_dec(&cache_resolve_queue_len);
+       atomic_dec(&net->ipv4.cache_resolve_queue_len);
 
        while ((skb = skb_dequeue(&c->mfc_un.unres.unresolved))) {
                if (ip_hdr(skb)->version == 0) {
@@ -354,12 +354,12 @@ static void ipmr_destroy_unres(struct mfc_cache *c)
                        e->error = -ETIMEDOUT;
                        memset(&e->msg, 0, sizeof(e->msg));
 
-                       rtnl_unicast(skb, &init_net, NETLINK_CB(skb).pid);
+                       rtnl_unicast(skb, net, NETLINK_CB(skb).pid);
                } else
                        kfree_skb(skb);
        }
 
-       kmem_cache_free(mrt_cachep, c);
+       ipmr_cache_free(c);
 }
 
 
@@ -376,7 +376,7 @@ static void ipmr_expire_process(unsigned long dummy)
                return;
        }
 
-       if (atomic_read(&cache_resolve_queue_len) == 0)
+       if (mfc_unres_queue == NULL)
                goto out;
 
        now = jiffies;
@@ -397,7 +397,7 @@ static void ipmr_expire_process(unsigned long dummy)
                ipmr_destroy_unres(c);
        }
 
-       if (atomic_read(&cache_resolve_queue_len))
+       if (mfc_unres_queue != NULL)
                mod_timer(&ipmr_expire_timer, jiffies + expires);
 
 out:
@@ -409,13 +409,15 @@ out:
 static void ipmr_update_thresholds(struct mfc_cache *cache, unsigned char *ttls)
 {
        int vifi;
+       struct net *net = mfc_net(cache);
 
        cache->mfc_un.res.minvif = MAXVIFS;
        cache->mfc_un.res.maxvif = 0;
        memset(cache->mfc_un.res.ttls, 255, MAXVIFS);
 
-       for (vifi=0; vifi<maxvif; vifi++) {
-               if (VIF_EXISTS(vifi) && ttls[vifi] && ttls[vifi] < 255) {
+       for (vifi = 0; vifi < net->ipv4.maxvif; vifi++) {
+               if (VIF_EXISTS(net, vifi) &&
+                   ttls[vifi] && ttls[vifi] < 255) {
                        cache->mfc_un.res.ttls[vifi] = ttls[vifi];
                        if (cache->mfc_un.res.minvif > vifi)
                                cache->mfc_un.res.minvif = vifi;
@@ -425,16 +427,16 @@ static void ipmr_update_thresholds(struct mfc_cache *cache, unsigned char *ttls)
        }
 }
 
-static int vif_add(struct vifctl *vifc, int mrtsock)
+static int vif_add(struct net *net, struct vifctl *vifc, int mrtsock)
 {
        int vifi = vifc->vifc_vifi;
-       struct vif_device *v = &vif_table[vifi];
+       struct vif_device *v = &net->ipv4.vif_table[vifi];
        struct net_device *dev;
        struct in_device *in_dev;
        int err;
 
        /* Is vif busy ? */
-       if (VIF_EXISTS(vifi))
+       if (VIF_EXISTS(net, vifi))
                return -EADDRINUSE;
 
        switch (vifc->vifc_flags) {
@@ -444,7 +446,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
                 * Special Purpose VIF in PIM
                 * All the packets will be sent to the daemon
                 */
-               if (reg_vif_num >= 0)
+               if (net->ipv4.mroute_reg_vif_num >= 0)
                        return -EADDRINUSE;
                dev = ipmr_reg_vif();
                if (!dev)
@@ -458,7 +460,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
                break;
 #endif
        case VIFF_TUNNEL:
-               dev = ipmr_new_tunnel(vifc);
+               dev = ipmr_new_tunnel(net, vifc);
                if (!dev)
                        return -ENOBUFS;
                err = dev_set_allmulti(dev, 1);
@@ -469,7 +471,7 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
                }
                break;
        case 0:
-               dev = ip_dev_find(&init_net, vifc->vifc_lcl_addr.s_addr);
+               dev = ip_dev_find(net, vifc->vifc_lcl_addr.s_addr);
                if (!dev)
                        return -EADDRNOTAVAIL;
                err = dev_set_allmulti(dev, 1);
@@ -510,20 +512,22 @@ static int vif_add(struct vifctl *vifc, int mrtsock)
        v->dev = dev;
 #ifdef CONFIG_IP_PIMSM
        if (v->flags&VIFF_REGISTER)
-               reg_vif_num = vifi;
+               net->ipv4.mroute_reg_vif_num = vifi;
 #endif
-       if (vifi+1 > maxvif)
-               maxvif = vifi+1;
+       if (vifi+1 > net->ipv4.maxvif)
+               net->ipv4.maxvif = vifi+1;
        write_unlock_bh(&mrt_lock);
        return 0;
 }
 
-static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp)
+static struct mfc_cache *ipmr_cache_find(struct net *net,
+                                        __be32 origin,
+                                        __be32 mcastgrp)
 {
        int line = MFC_HASH(mcastgrp, origin);
        struct mfc_cache *c;
 
-       for (c=mfc_cache_array[line]; c; c = c->next) {
+       for (c = net->ipv4.mfc_cache_array[line]; c; c = c->next) {
                if (c->mfc_origin==origin && c->mfc_mcastgrp==mcastgrp)
                        break;
        }
@@ -533,22 +537,24 @@ static struct mfc_cache *ipmr_cache_find(__be32 origin, __be32 mcastgrp)
 /*
  *     Allocate a multicast cache entry
  */
-static struct mfc_cache *ipmr_cache_alloc(void)
+static struct mfc_cache *ipmr_cache_alloc(struct net *net)
 {
        struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_KERNEL);
        if (c == NULL)
                return NULL;
        c->mfc_un.res.minvif = MAXVIFS;
+       mfc_net_set(c, net);
        return c;
 }
 
-static struct mfc_cache *ipmr_cache_alloc_unres(void)
+static struct mfc_cache *ipmr_cache_alloc_unres(struct net *net)
 {
        struct mfc_cache *c = kmem_cache_zalloc(mrt_cachep, GFP_ATOMIC);
        if (c == NULL)
                return NULL;
        skb_queue_head_init(&c->mfc_un.unres.unresolved);
        c->mfc_un.unres.expires = jiffies + 10*HZ;
+       mfc_net_set(c, net);
        return c;
 }
 
@@ -581,7 +587,7 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
                                memset(&e->msg, 0, sizeof(e->msg));
                        }
 
-                       rtnl_unicast(skb, &init_net, NETLINK_CB(skb).pid);
+                       rtnl_unicast(skb, mfc_net(c), NETLINK_CB(skb).pid);
                } else
                        ip_mr_forward(skb, c, 0);
        }
@@ -594,7 +600,8 @@ static void ipmr_cache_resolve(struct mfc_cache *uc, struct mfc_cache *c)
  *     Called under mrt_lock.
  */
 
-static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
+static int ipmr_cache_report(struct net *net,
+                            struct sk_buff *pkt, vifi_t vifi, int assert)
 {
        struct sk_buff *skb;
        const int ihl = ip_hdrlen(pkt);
@@ -626,7 +633,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
                memcpy(msg, skb_network_header(pkt), sizeof(struct iphdr));
                msg->im_msgtype = IGMPMSG_WHOLEPKT;
                msg->im_mbz = 0;
-               msg->im_vif = reg_vif_num;
+               msg->im_vif = net->ipv4.mroute_reg_vif_num;
                ip_hdr(skb)->ihl = sizeof(struct iphdr) >> 2;
                ip_hdr(skb)->tot_len = htons(ntohs(ip_hdr(pkt)->tot_len) +
                                             sizeof(struct iphdr));
@@ -658,7 +665,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
        skb->transport_header = skb->network_header;
        }
 
-       if (mroute_socket == NULL) {
+       if (net->ipv4.mroute_sk == NULL) {
                kfree_skb(skb);
                return -EINVAL;
        }
@@ -666,7 +673,8 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
        /*
         *      Deliver to mrouted
         */
-       if ((ret = sock_queue_rcv_skb(mroute_socket, skb))<0) {
+       ret = sock_queue_rcv_skb(net->ipv4.mroute_sk, skb);
+       if (ret < 0) {
                if (net_ratelimit())
                        printk(KERN_WARNING "mroute: pending queue full, dropping entries.\n");
                kfree_skb(skb);
@@ -680,7 +688,7 @@ static int ipmr_cache_report(struct sk_buff *pkt, vifi_t vifi, int assert)
  */
 
 static int
-ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
+ipmr_cache_unresolved(struct net *net, vifi_t vifi, struct sk_buff *skb)
 {
        int err;
        struct mfc_cache *c;
@@ -688,7 +696,8 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
 
        spin_lock_bh(&mfc_unres_lock);
        for (c=mfc_unres_queue; c; c=c->next) {
-               if (c->mfc_mcastgrp == iph->daddr &&
+               if (net_eq(mfc_net(c), net) &&
+                   c->mfc_mcastgrp == iph->daddr &&
                    c->mfc_origin == iph->saddr)
                        break;
        }
@@ -698,8 +707,8 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
                 *      Create a new entry if allowable
                 */
 
-               if (atomic_read(&cache_resolve_queue_len) >= 10 ||
-                   (c=ipmr_cache_alloc_unres())==NULL) {
+               if (atomic_read(&net->ipv4.cache_resolve_queue_len) >= 10 ||
+                   (c = ipmr_cache_alloc_unres(net)) == NULL) {
                        spin_unlock_bh(&mfc_unres_lock);
 
                        kfree_skb(skb);
@@ -716,18 +725,19 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
                /*
                 *      Reflect first query at mrouted.
                 */
-               if ((err = ipmr_cache_report(skb, vifi, IGMPMSG_NOCACHE))<0) {
+               err = ipmr_cache_report(net, skb, vifi, IGMPMSG_NOCACHE);
+               if (err < 0) {
                        /* If the report failed throw the cache entry
                           out - Brad Parker
                         */
                        spin_unlock_bh(&mfc_unres_lock);
 
-                       kmem_cache_free(mrt_cachep, c);
+                       ipmr_cache_free(c);
                        kfree_skb(skb);
                        return err;
                }
 
-               atomic_inc(&cache_resolve_queue_len);
+               atomic_inc(&net->ipv4.cache_resolve_queue_len);
                c->next = mfc_unres_queue;
                mfc_unres_queue = c;
 
@@ -753,35 +763,37 @@ ipmr_cache_unresolved(vifi_t vifi, struct sk_buff *skb)
  *     MFC cache manipulation by user space mroute daemon
  */
 
-static int ipmr_mfc_delete(struct mfcctl *mfc)
+static int ipmr_mfc_delete(struct net *net, struct mfcctl *mfc)
 {
        int line;
        struct mfc_cache *c, **cp;
 
        line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr);
 
-       for (cp=&mfc_cache_array[line]; (c=*cp) != NULL; cp = &c->next) {
+       for (cp = &net->ipv4.mfc_cache_array[line];
+            (c = *cp) != NULL; cp = &c->next) {
                if (c->mfc_origin == mfc->mfcc_origin.s_addr &&
                    c->mfc_mcastgrp == mfc->mfcc_mcastgrp.s_addr) {
                        write_lock_bh(&mrt_lock);
                        *cp = c->next;
                        write_unlock_bh(&mrt_lock);
 
-                       kmem_cache_free(mrt_cachep, c);
+                       ipmr_cache_free(c);
                        return 0;
                }
        }
        return -ENOENT;
 }
 
-static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
+static int ipmr_mfc_add(struct net *net, struct mfcctl *mfc, int mrtsock)
 {
        int line;
        struct mfc_cache *uc, *c, **cp;
 
        line = MFC_HASH(mfc->mfcc_mcastgrp.s_addr, mfc->mfcc_origin.s_addr);
 
-       for (cp=&mfc_cache_array[line]; (c=*cp) != NULL; cp = &c->next) {
+       for (cp = &net->ipv4.mfc_cache_array[line];
+            (c = *cp) != NULL; cp = &c->next) {
                if (c->mfc_origin == mfc->mfcc_origin.s_addr &&
                    c->mfc_mcastgrp == mfc->mfcc_mcastgrp.s_addr)
                        break;
@@ -800,7 +812,7 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
        if (!ipv4_is_multicast(mfc->mfcc_mcastgrp.s_addr))
                return -EINVAL;
 
-       c = ipmr_cache_alloc();
+       c = ipmr_cache_alloc(net);
        if (c == NULL)
                return -ENOMEM;
 
@@ -812,8 +824,8 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
                c->mfc_flags |= MFC_STATIC;
 
        write_lock_bh(&mrt_lock);
-       c->next = mfc_cache_array[line];
-       mfc_cache_array[line] = c;
+       c->next = net->ipv4.mfc_cache_array[line];
+       net->ipv4.mfc_cache_array[line] = c;
        write_unlock_bh(&mrt_lock);
 
        /*
@@ -823,19 +835,21 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
        spin_lock_bh(&mfc_unres_lock);
        for (cp = &mfc_unres_queue; (uc=*cp) != NULL;
             cp = &uc->next) {
-               if (uc->mfc_origin == c->mfc_origin &&
+               if (net_eq(mfc_net(uc), net) &&
+                   uc->mfc_origin == c->mfc_origin &&
                    uc->mfc_mcastgrp == c->mfc_mcastgrp) {
                        *cp = uc->next;
-                       if (atomic_dec_and_test(&cache_resolve_queue_len))
-                               del_timer(&ipmr_expire_timer);
+                       atomic_dec(&net->ipv4.cache_resolve_queue_len);
                        break;
                }
        }
+       if (mfc_unres_queue == NULL)
+               del_timer(&ipmr_expire_timer);
        spin_unlock_bh(&mfc_unres_lock);
 
        if (uc) {
                ipmr_cache_resolve(uc, c);
-               kmem_cache_free(mrt_cachep, uc);
+               ipmr_cache_free(uc);
        }
        return 0;
 }
@@ -844,16 +858,16 @@ static int ipmr_mfc_add(struct mfcctl *mfc, int mrtsock)
  *     Close the multicast socket, and clear the vif tables etc
  */
 
-static void mroute_clean_tables(struct sock *sk)
+static void mroute_clean_tables(struct net *net)
 {
        int i;
 
        /*
         *      Shut down all active vif entries
         */
-       for (i=0; i<maxvif; i++) {
-               if (!(vif_table[i].flags&VIFF_STATIC))
-                       vif_delete(i, 0);
+       for (i = 0; i < net->ipv4.maxvif; i++) {
+               if (!(net->ipv4.vif_table[i].flags&VIFF_STATIC))
+                       vif_delete(net, i, 0);
        }
 
        /*
@@ -862,7 +876,7 @@ static void mroute_clean_tables(struct sock *sk)
        for (i=0; i<MFC_LINES; i++) {
                struct mfc_cache *c, **cp;
 
-               cp = &mfc_cache_array[i];
+               cp = &net->ipv4.mfc_cache_array[i];
                while ((c = *cp) != NULL) {
                        if (c->mfc_flags&MFC_STATIC) {
                                cp = &c->next;
@@ -872,22 +886,23 @@ static void mroute_clean_tables(struct sock *sk)
                        *cp = c->next;
                        write_unlock_bh(&mrt_lock);
 
-                       kmem_cache_free(mrt_cachep, c);
+                       ipmr_cache_free(c);
                }
        }
 
-       if (atomic_read(&cache_resolve_queue_len) != 0) {
-               struct mfc_cache *c;
+       if (atomic_read(&net->ipv4.cache_resolve_queue_len) != 0) {
+               struct mfc_cache *c, **cp;
 
                spin_lock_bh(&mfc_unres_lock);
-               while (mfc_unres_queue != NULL) {
-                       c = mfc_unres_queue;
-                       mfc_unres_queue = c->next;
-                       spin_unlock_bh(&mfc_unres_lock);
+               cp = &mfc_unres_queue;
+               while ((c = *cp) != NULL) {
+                       if (!net_eq(mfc_net(c), net)) {
+                               cp = &c->next;
+                               continue;
+                       }
+                       *cp = c->next;
 
                        ipmr_destroy_unres(c);
-
-                       spin_lock_bh(&mfc_unres_lock);
                }
                spin_unlock_bh(&mfc_unres_lock);
        }
@@ -895,15 +910,17 @@ static void mroute_clean_tables(struct sock *sk)
 
 static void mrtsock_destruct(struct sock *sk)
 {
+       struct net *net = sock_net(sk);
+
        rtnl_lock();
-       if (sk == mroute_socket) {
-               IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)--;
+       if (sk == net->ipv4.mroute_sk) {
+               IPV4_DEVCONF_ALL(net, MC_FORWARDING)--;
 
                write_lock_bh(&mrt_lock);
-               mroute_socket = NULL;
+               net->ipv4.mroute_sk = NULL;
                write_unlock_bh(&mrt_lock);
 
-               mroute_clean_tables(sk);
+               mroute_clean_tables(net);
        }
        rtnl_unlock();
 }
@@ -920,9 +937,10 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
        int ret;
        struct vifctl vif;
        struct mfcctl mfc;
+       struct net *net = sock_net(sk);
 
        if (optname != MRT_INIT) {
-               if (sk != mroute_socket && !capable(CAP_NET_ADMIN))
+               if (sk != net->ipv4.mroute_sk && !capable(CAP_NET_ADMIN))
                        return -EACCES;
        }
 
@@ -935,7 +953,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
                        return -ENOPROTOOPT;
 
                rtnl_lock();
-               if (mroute_socket) {
+               if (net->ipv4.mroute_sk) {
                        rtnl_unlock();
                        return -EADDRINUSE;
                }
@@ -943,15 +961,15 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
                ret = ip_ra_control(sk, 1, mrtsock_destruct);
                if (ret == 0) {
                        write_lock_bh(&mrt_lock);
-                       mroute_socket = sk;
+                       net->ipv4.mroute_sk = sk;
                        write_unlock_bh(&mrt_lock);
 
-                       IPV4_DEVCONF_ALL(sock_net(sk), MC_FORWARDING)++;
+                       IPV4_DEVCONF_ALL(net, MC_FORWARDING)++;
                }
                rtnl_unlock();
                return ret;
        case MRT_DONE:
-               if (sk != mroute_socket)
+               if (sk != net->ipv4.mroute_sk)
                        return -EACCES;
                return ip_ra_control(sk, 0, NULL);
        case MRT_ADD_VIF:
@@ -964,9 +982,9 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
                        return -ENFILE;
                rtnl_lock();
                if (optname == MRT_ADD_VIF) {
-                       ret = vif_add(&vif, sk==mroute_socket);
+                       ret = vif_add(net, &vif, sk == net->ipv4.mroute_sk);
                } else {
-                       ret = vif_delete(vif.vifc_vifi, 0);
+                       ret = vif_delete(net, vif.vifc_vifi, 0);
                }
                rtnl_unlock();
                return ret;
@@ -983,9 +1001,9 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
                        return -EFAULT;
                rtnl_lock();
                if (optname == MRT_DEL_MFC)
-                       ret = ipmr_mfc_delete(&mfc);
+                       ret = ipmr_mfc_delete(net, &mfc);
                else
-                       ret = ipmr_mfc_add(&mfc, sk==mroute_socket);
+                       ret = ipmr_mfc_add(net, &mfc, sk == net->ipv4.mroute_sk);
                rtnl_unlock();
                return ret;
                /*
@@ -996,7 +1014,7 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
                int v;
                if (get_user(v,(int __user *)optval))
                        return -EFAULT;
-               mroute_do_assert=(v)?1:0;
+               net->ipv4.mroute_do_assert = (v) ? 1 : 0;
                return 0;
        }
 #ifdef CONFIG_IP_PIMSM
@@ -1010,11 +1028,11 @@ int ip_mroute_setsockopt(struct sock *sk, int optname, char __user *optval, int
 
                rtnl_lock();
                ret = 0;
-               if (v != mroute_do_pim) {
-                       mroute_do_pim = v;
-                       mroute_do_assert = v;
+               if (v != net->ipv4.mroute_do_pim) {
+                       net->ipv4.mroute_do_pim = v;
+                       net->ipv4.mroute_do_assert = v;
 #ifdef CONFIG_IP_PIMSM_V2
-                       if (mroute_do_pim)
+                       if (net->ipv4.mroute_do_pim)
                                ret = inet_add_protocol(&pim_protocol,
                                                        IPPROTO_PIM);
                        else
@@ -1045,6 +1063,7 @@ int ip_mroute_getsockopt(struct sock *sk, int optname, char __user *optval, int
 {
        int olr;
        int val;
+       struct net *net = sock_net(sk);
 
        if (optname != MRT_VERSION &&
 #ifdef CONFIG_IP_PIMSM
@@ -1066,10 +1085,10 @@ int ip_mroute_getsockopt(struct sock *sk, int optname, char __user *optval, int
                val = 0x0305;
 #ifdef CONFIG_IP_PIMSM
        else if (optname == MRT_PIM)
-               val = mroute_do_pim;
+               val = net->ipv4.mroute_do_pim;
 #endif
        else
-               val = mroute_do_assert;
+               val = net->ipv4.mroute_do_assert;
        if (copy_to_user(optval, &val, olr))
                return -EFAULT;
        return 0;
@@ -1085,16 +1104,17 @@ int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
        struct sioc_vif_req vr;
        struct vif_device *vif;
        struct mfc_cache *c;
+       struct net *net = sock_net(sk);
 
        switch (cmd) {
        case SIOCGETVIFCNT:
                if (copy_from_user(&vr, arg, sizeof(vr)))
                        return -EFAULT;
-               if (vr.vifi >= maxvif)
+               if (vr.vifi >= net->ipv4.maxvif)
                        return -EINVAL;
                read_lock(&mrt_lock);
-               vif=&vif_table[vr.vifi];
-               if (VIF_EXISTS(vr.vifi))        {
+               vif = &net->ipv4.vif_table[vr.vifi];
+               if (VIF_EXISTS(net, vr.vifi)) {
                        vr.icount = vif->pkt_in;
                        vr.ocount = vif->pkt_out;
                        vr.ibytes = vif->bytes_in;
@@ -1112,7 +1132,7 @@ int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
                        return -EFAULT;
 
                read_lock(&mrt_lock);
-               c = ipmr_cache_find(sr.src.s_addr, sr.grp.s_addr);
+               c = ipmr_cache_find(net, sr.src.s_addr, sr.grp.s_addr);
                if (c) {
                        sr.pktcnt = c->mfc_un.res.pkt;
                        sr.bytecnt = c->mfc_un.res.bytes;
@@ -1134,18 +1154,19 @@ int ipmr_ioctl(struct sock *sk, int cmd, void __user *arg)
 static int ipmr_device_event(struct notifier_block *this, unsigned long event, void *ptr)
 {
        struct net_device *dev = ptr;
+       struct net *net = dev_net(dev);
        struct vif_device *v;
        int ct;
 
-       if (!net_eq(dev_net(dev), &init_net))
+       if (!net_eq(dev_net(dev), net))
                return NOTIFY_DONE;
 
        if (event != NETDEV_UNREGISTER)
                return NOTIFY_DONE;
-       v=&vif_table[0];
-       for (ct=0; ct<maxvif; ct++,v++) {
+       v = &net->ipv4.vif_table[0];
+       for (ct = 0; ct < net->ipv4.maxvif; ct++, v++) {
                if (v->dev == dev)
-                       vif_delete(ct, 1);
+                       vif_delete(net, ct, 1);
        }
        return NOTIFY_DONE;
 }
@@ -1205,8 +1226,9 @@ static inline int ipmr_forward_finish(struct sk_buff *skb)
 
 static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
 {
+       struct net *net = mfc_net(c);
        const struct iphdr *iph = ip_hdr(skb);
-       struct vif_device *vif = &vif_table[vifi];
+       struct vif_device *vif = &net->ipv4.vif_table[vifi];
        struct net_device *dev;
        struct rtable *rt;
        int    encap = 0;
@@ -1220,9 +1242,8 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
                vif->bytes_out += skb->len;
                vif->dev->stats.tx_bytes += skb->len;
                vif->dev->stats.tx_packets++;
-               ipmr_cache_report(skb, vifi, IGMPMSG_WHOLEPKT);
-               kfree_skb(skb);
-               return;
+               ipmr_cache_report(net, skb, vifi, IGMPMSG_WHOLEPKT);
+               goto out_free;
        }
 #endif
 
@@ -1233,7 +1254,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
                                                .saddr = vif->local,
                                                .tos = RT_TOS(iph->tos) } },
                                    .proto = IPPROTO_IPIP };
-               if (ip_route_output_key(&init_net, &rt, &fl))
+               if (ip_route_output_key(net, &rt, &fl))
                        goto out_free;
                encap = sizeof(struct iphdr);
        } else {
@@ -1242,7 +1263,7 @@ static void ipmr_queue_xmit(struct sk_buff *skb, struct mfc_cache *c, int vifi)
                                              { .daddr = iph->daddr,
                                                .tos = RT_TOS(iph->tos) } },
                                    .proto = IPPROTO_IPIP };
-               if (ip_route_output_key(&init_net, &rt, &fl))
+               if (ip_route_output_key(net, &rt, &fl))
                        goto out_free;
        }
 
@@ -1306,9 +1327,10 @@ out_free:
 
 static int ipmr_find_vif(struct net_device *dev)
 {
+       struct net *net = dev_net(dev);
        int ct;
-       for (ct=maxvif-1; ct>=0; ct--) {
-               if (vif_table[ct].dev == dev)
+       for (ct = net->ipv4.maxvif-1; ct >= 0; ct--) {
+               if (net->ipv4.vif_table[ct].dev == dev)
                        break;
        }
        return ct;
@@ -1320,6 +1342,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
 {
        int psend = -1;
        int vif, ct;
+       struct net *net = mfc_net(cache);
 
        vif = cache->mfc_parent;
        cache->mfc_un.res.pkt++;
@@ -1328,7 +1351,7 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
        /*
         * Wrong interface: drop packet and (maybe) send PIM assert.
         */
-       if (vif_table[vif].dev != skb->dev) {
+       if (net->ipv4.vif_table[vif].dev != skb->dev) {
                int true_vifi;
 
                if (skb->rtable->fl.iif == 0) {
@@ -1349,23 +1372,24 @@ static int ip_mr_forward(struct sk_buff *skb, struct mfc_cache *cache, int local
                cache->mfc_un.res.wrong_if++;
                true_vifi = ipmr_find_vif(skb->dev);
 
-               if (true_vifi >= 0 && mroute_do_assert &&
+               if (true_vifi >= 0 && net->ipv4.mroute_do_assert &&
                    /* pimsm uses asserts, when switching from RPT to SPT,
                       so that we cannot check that packet arrived on an oif.
                       It is bad, but otherwise we would need to move pretty
                       large chunk of pimd to kernel. Ough... --ANK
                     */
-                   (mroute_do_pim || cache->mfc_un.res.ttls[true_vifi] < 255) &&
+                   (net->ipv4.mroute_do_pim ||
+                    cache->mfc_un.res.ttls[true_vifi] < 255) &&
                    time_after(jiffies,
                               cache->mfc_un.res.last_assert + MFC_ASSERT_THRESH)) {
                        cache->mfc_un.res.last_assert = jiffies;
-                       ipmr_cache_report(skb, true_vifi, IGMPMSG_WRONGVIF);
+                       ipmr_cache_report(net, skb, true_vifi, IGMPMSG_WRONGVIF);
                }
                goto dont_forward;
        }
 
-       vif_table[vif].pkt_in++;
-       vif_table[vif].bytes_in += skb->len;
+       net->ipv4.vif_table[vif].pkt_in++;
+       net->ipv4.vif_table[vif].bytes_in += skb->len;
 
        /*
         *      Forward the frame
@@ -1405,6 +1429,7 @@ dont_forward:
 int ip_mr_input(struct sk_buff *skb)
 {
        struct mfc_cache *cache;
+       struct net *net = dev_net(skb->dev);
        int local = skb->rtable->rt_flags&RTCF_LOCAL;
 
        /* Packet is looped back after forward, it should not be
@@ -1425,9 +1450,9 @@ int ip_mr_input(struct sk_buff *skb)
                               that we can forward NO IGMP messages.
                             */
                            read_lock(&mrt_lock);
-                           if (mroute_socket) {
+                           if (net->ipv4.mroute_sk) {
                                    nf_reset(skb);
-                                   raw_rcv(mroute_socket, skb);
+                                   raw_rcv(net->ipv4.mroute_sk, skb);
                                    read_unlock(&mrt_lock);
                                    return 0;
                            }
@@ -1436,7 +1461,7 @@ int ip_mr_input(struct sk_buff *skb)
        }
 
        read_lock(&mrt_lock);
-       cache = ipmr_cache_find(ip_hdr(skb)->saddr, ip_hdr(skb)->daddr);
+       cache = ipmr_cache_find(net, ip_hdr(skb)->saddr, ip_hdr(skb)->daddr);
 
        /*
         *      No usable cache entry
@@ -1456,7 +1481,7 @@ int ip_mr_input(struct sk_buff *skb)
 
                vif = ipmr_find_vif(skb->dev);
                if (vif >= 0) {
-                       int err = ipmr_cache_unresolved(vif, skb);
+                       int err = ipmr_cache_unresolved(net, vif, skb);
                        read_unlock(&mrt_lock);
 
                        return err;
@@ -1487,6 +1512,7 @@ static int __pim_rcv(struct sk_buff *skb, unsigned int pimlen)
 {
        struct net_device *reg_dev = NULL;
        struct iphdr *encap;
+       struct net *net = dev_net(skb->dev);
 
        encap = (struct iphdr *)(skb_transport_header(skb) + pimlen);
        /*
@@ -1501,8 +1527,8 @@ static int __pim_rcv(struct sk_buff *skb, unsigned int pimlen)
                return 1;
 
        read_lock(&mrt_lock);
-       if (reg_vif_num >= 0)
-               reg_dev = vif_table[reg_vif_num].dev;
+       if (net->ipv4.mroute_reg_vif_num >= 0)
+               reg_dev = net->ipv4.vif_table[net->ipv4.mroute_reg_vif_num].dev;
        if (reg_dev)
                dev_hold(reg_dev);
        read_unlock(&mrt_lock);
@@ -1537,13 +1563,14 @@ static int __pim_rcv(struct sk_buff *skb, unsigned int pimlen)
 int pim_rcv_v1(struct sk_buff * skb)
 {
        struct igmphdr *pim;
+       struct net *net = dev_net(skb->dev);
 
        if (!pskb_may_pull(skb, sizeof(*pim) + sizeof(struct iphdr)))
                goto drop;
 
        pim = igmp_hdr(skb);
 
-       if (!mroute_do_pim ||
+       if (!net->ipv4.mroute_do_pim ||
            pim->group != PIM_V1_VERSION || pim->code != PIM_V1_REGISTER)
                goto drop;
 
@@ -1583,7 +1610,8 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
 {
        int ct;
        struct rtnexthop *nhp;
-       struct net_device *dev = vif_table[c->mfc_parent].dev;
+       struct net *net = mfc_net(c);
+       struct net_device *dev = net->ipv4.vif_table[c->mfc_parent].dev;
        u8 *b = skb_tail_pointer(skb);
        struct rtattr *mp_head;
 
@@ -1599,7 +1627,7 @@ ipmr_fill_mroute(struct sk_buff *skb, struct mfc_cache *c, struct rtmsg *rtm)
                        nhp = (struct rtnexthop *)skb_put(skb, RTA_ALIGN(sizeof(*nhp)));
                        nhp->rtnh_flags = 0;
                        nhp->rtnh_hops = c->mfc_un.res.ttls[ct];
-                       nhp->rtnh_ifindex = vif_table[ct].dev->ifindex;
+                       nhp->rtnh_ifindex = net->ipv4.vif_table[ct].dev->ifindex;
                        nhp->rtnh_len = sizeof(*nhp);
                }
        }
@@ -1613,14 +1641,15 @@ rtattr_failure:
        return -EMSGSIZE;
 }
 
-int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
+int ipmr_get_route(struct net *net,
+                  struct sk_buff *skb, struct rtmsg *rtm, int nowait)
 {
        int err;
        struct mfc_cache *cache;
        struct rtable *rt = skb->rtable;
 
        read_lock(&mrt_lock);
-       cache = ipmr_cache_find(rt->rt_src, rt->rt_dst);
+       cache = ipmr_cache_find(net, rt->rt_src, rt->rt_dst);
 
        if (cache == NULL) {
                struct sk_buff *skb2;
@@ -1651,7 +1680,7 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
                iph->saddr = rt->rt_src;
                iph->daddr = rt->rt_dst;
                iph->version = 0;
-               err = ipmr_cache_unresolved(vif, skb2);
+               err = ipmr_cache_unresolved(net, vif, skb2);
                read_unlock(&mrt_lock);
                return err;
        }
@@ -1668,17 +1697,19 @@ int ipmr_get_route(struct sk_buff *skb, struct rtmsg *rtm, int nowait)
  *     The /proc interfaces to multicast routing /proc/ip_mr_cache /proc/ip_mr_vif
  */
 struct ipmr_vif_iter {
+       struct seq_net_private p;
        int ct;
 };
 
-static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
+static struct vif_device *ipmr_vif_seq_idx(struct net *net,
+                                          struct ipmr_vif_iter *iter,
                                           loff_t pos)
 {
-       for (iter->ct = 0; iter->ct < maxvif; ++iter->ct) {
-               if (!VIF_EXISTS(iter->ct))
+       for (iter->ct = 0; iter->ct < net->ipv4.maxvif; ++iter->ct) {
+               if (!VIF_EXISTS(net, iter->ct))
                        continue;
                if (pos-- == 0)
-                       return &vif_table[iter->ct];
+                       return &net->ipv4.vif_table[iter->ct];
        }
        return NULL;
 }
@@ -1686,23 +1717,26 @@ static struct vif_device *ipmr_vif_seq_idx(struct ipmr_vif_iter *iter,
 static void *ipmr_vif_seq_start(struct seq_file *seq, loff_t *pos)
        __acquires(mrt_lock)
 {
+       struct net *net = seq_file_net(seq);
+
        read_lock(&mrt_lock);
-       return *pos ? ipmr_vif_seq_idx(seq->private, *pos - 1)
+       return *pos ? ipmr_vif_seq_idx(net, seq->private, *pos - 1)
                : SEQ_START_TOKEN;
 }
 
 static void *ipmr_vif_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
        struct ipmr_vif_iter *iter = seq->private;
+       struct net *net = seq_file_net(seq);
 
        ++*pos;
        if (v == SEQ_START_TOKEN)
-               return ipmr_vif_seq_idx(iter, 0);
+               return ipmr_vif_seq_idx(net, iter, 0);
 
-       while (++iter->ct < maxvif) {
-               if (!VIF_EXISTS(iter->ct))
+       while (++iter->ct < net->ipv4.maxvif) {
+               if (!VIF_EXISTS(net, iter->ct))
                        continue;
-               return &vif_table[iter->ct];
+               return &net->ipv4.vif_table[iter->ct];
        }
        return NULL;
 }
@@ -1715,6 +1749,8 @@ static void ipmr_vif_seq_stop(struct seq_file *seq, void *v)
 
 static int ipmr_vif_seq_show(struct seq_file *seq, void *v)
 {
+       struct net *net = seq_file_net(seq);
+
        if (v == SEQ_START_TOKEN) {
                seq_puts(seq,
                         "Interface      BytesIn  PktsIn  BytesOut PktsOut Flags Local    Remote\n");
@@ -1724,7 +1760,7 @@ static int ipmr_vif_seq_show(struct seq_file *seq, void *v)
 
                seq_printf(seq,
                           "%2Zd %-10s %8ld %7ld  %8ld %7ld %05X %08X %08X\n",
-                          vif - vif_table,
+                          vif - net->ipv4.vif_table,
                           name, vif->bytes_in, vif->pkt_in,
                           vif->bytes_out, vif->pkt_out,
                           vif->flags, vif->local, vif->remote);
@@ -1741,8 +1777,8 @@ static const struct seq_operations ipmr_vif_seq_ops = {
 
 static int ipmr_vif_open(struct inode *inode, struct file *file)
 {
-       return seq_open_private(file, &ipmr_vif_seq_ops,
-                       sizeof(struct ipmr_vif_iter));
+       return seq_open_net(inode, file, &ipmr_vif_seq_ops,
+                           sizeof(struct ipmr_vif_iter));
 }
 
 static const struct file_operations ipmr_vif_fops = {
@@ -1750,23 +1786,26 @@ static const struct file_operations ipmr_vif_fops = {
        .open    = ipmr_vif_open,
        .read    = seq_read,
        .llseek  = seq_lseek,
-       .release = seq_release_private,
+       .release = seq_release_net,
 };
 
 struct ipmr_mfc_iter {
+       struct seq_net_private p;
        struct mfc_cache **cache;
        int ct;
 };
 
 
-static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
+static struct mfc_cache *ipmr_mfc_seq_idx(struct net *net,
+                                         struct ipmr_mfc_iter *it, loff_t pos)
 {
        struct mfc_cache *mfc;
 
-       it->cache = mfc_cache_array;
+       it->cache = net->ipv4.mfc_cache_array;
        read_lock(&mrt_lock);
        for (it->ct = 0; it->ct < MFC_LINES; it->ct++)
-               for (mfc = mfc_cache_array[it->ct]; mfc; mfc = mfc->next)
+               for (mfc = net->ipv4.mfc_cache_array[it->ct];
+                    mfc; mfc = mfc->next)
                        if (pos-- == 0)
                                return mfc;
        read_unlock(&mrt_lock);
@@ -1774,7 +1813,8 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
        it->cache = &mfc_unres_queue;
        spin_lock_bh(&mfc_unres_lock);
        for (mfc = mfc_unres_queue; mfc; mfc = mfc->next)
-               if (pos-- == 0)
+               if (net_eq(mfc_net(mfc), net) &&
+                   pos-- == 0)
                        return mfc;
        spin_unlock_bh(&mfc_unres_lock);
 
@@ -1786,9 +1826,11 @@ static struct mfc_cache *ipmr_mfc_seq_idx(struct ipmr_mfc_iter *it, loff_t pos)
 static void *ipmr_mfc_seq_start(struct seq_file *seq, loff_t *pos)
 {
        struct ipmr_mfc_iter *it = seq->private;
+       struct net *net = seq_file_net(seq);
+
        it->cache = NULL;
        it->ct = 0;
-       return *pos ? ipmr_mfc_seq_idx(seq->private, *pos - 1)
+       return *pos ? ipmr_mfc_seq_idx(net, seq->private, *pos - 1)
                : SEQ_START_TOKEN;
 }
 
@@ -1796,11 +1838,12 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 {
        struct mfc_cache *mfc = v;
        struct ipmr_mfc_iter *it = seq->private;
+       struct net *net = seq_file_net(seq);
 
        ++*pos;
 
        if (v == SEQ_START_TOKEN)
-               return ipmr_mfc_seq_idx(seq->private, 0);
+               return ipmr_mfc_seq_idx(net, seq->private, 0);
 
        if (mfc->next)
                return mfc->next;
@@ -1808,10 +1851,10 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
        if (it->cache == &mfc_unres_queue)
                goto end_of_list;
 
-       BUG_ON(it->cache != mfc_cache_array);
+       BUG_ON(it->cache != net->ipv4.mfc_cache_array);
 
        while (++it->ct < MFC_LINES) {
-               mfc = mfc_cache_array[it->ct];
+               mfc = net->ipv4.mfc_cache_array[it->ct];
                if (mfc)
                        return mfc;
        }
@@ -1823,6 +1866,8 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 
        spin_lock_bh(&mfc_unres_lock);
        mfc = mfc_unres_queue;
+       while (mfc && !net_eq(mfc_net(mfc), net))
+               mfc = mfc->next;
        if (mfc)
                return mfc;
 
@@ -1836,16 +1881,18 @@ static void *ipmr_mfc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
 static void ipmr_mfc_seq_stop(struct seq_file *seq, void *v)
 {
        struct ipmr_mfc_iter *it = seq->private;
+       struct net *net = seq_file_net(seq);
 
        if (it->cache == &mfc_unres_queue)
                spin_unlock_bh(&mfc_unres_lock);
-       else if (it->cache == mfc_cache_array)
+       else if (it->cache == net->ipv4.mfc_cache_array)
                read_unlock(&mrt_lock);
 }
 
 static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
 {
        int n;
+       struct net *net = seq_file_net(seq);
 
        if (v == SEQ_START_TOKEN) {
                seq_puts(seq,
@@ -1866,9 +1913,9 @@ static int ipmr_mfc_seq_show(struct seq_file *seq, void *v)
                                   mfc->mfc_un.res.wrong_if);
                        for (n = mfc->mfc_un.res.minvif;
                             n < mfc->mfc_un.res.maxvif; n++ ) {
-                               if (VIF_EXISTS(n)
-                                  && mfc->mfc_un.res.ttls[n] < 255)
-                               seq_printf(seq,
+                               if (VIF_EXISTS(net, n) &&
+                                   mfc->mfc_un.res.ttls[n] < 255)
+                                       seq_printf(seq,
                                           " %2d:%-3d",
                                           n, mfc->mfc_un.res.ttls[n]);
                        }
@@ -1892,8 +1939,8 @@ static const struct seq_operations ipmr_mfc_seq_ops = {
 
 static int ipmr_mfc_open(struct inode *inode, struct file *file)
 {
-       return seq_open_private(file, &ipmr_mfc_seq_ops,
-                       sizeof(struct ipmr_mfc_iter));
+       return seq_open_net(inode, file, &ipmr_mfc_seq_ops,
+                           sizeof(struct ipmr_mfc_iter));
 }
 
 static const struct file_operations ipmr_mfc_fops = {
@@ -1901,7 +1948,7 @@ static const struct file_operations ipmr_mfc_fops = {
        .open    = ipmr_mfc_open,
        .read    = seq_read,
        .llseek  = seq_lseek,
-       .release = seq_release_private,
+       .release = seq_release_net,
 };
 #endif
 
@@ -1915,6 +1962,65 @@ static struct net_protocol pim_protocol = {
 /*
  *     Setup for IP multicast routing
  */
+static int __net_init ipmr_net_init(struct net *net)
+{
+       int err = 0;
+
+       net->ipv4.vif_table = kcalloc(MAXVIFS, sizeof(struct vif_device),
+                                     GFP_KERNEL);
+       if (!net->ipv4.vif_table) {
+               err = -ENOMEM;
+               goto fail;
+       }
+
+       /* Forwarding cache */
+       net->ipv4.mfc_cache_array = kcalloc(MFC_LINES,
+                                           sizeof(struct mfc_cache *),
+                                           GFP_KERNEL);
+       if (!net->ipv4.mfc_cache_array) {
+               err = -ENOMEM;
+               goto fail_mfc_cache;
+       }
+
+#ifdef CONFIG_IP_PIMSM
+       net->ipv4.mroute_reg_vif_num = -1;
+#endif
+
+#ifdef CONFIG_PROC_FS
+       err = -ENOMEM;
+       if (!proc_net_fops_create(net, "ip_mr_vif", 0, &ipmr_vif_fops))
+               goto proc_vif_fail;
+       if (!proc_net_fops_create(net, "ip_mr_cache", 0, &ipmr_mfc_fops))
+               goto proc_cache_fail;
+#endif
+       return 0;
+
+#ifdef CONFIG_PROC_FS
+proc_cache_fail:
+       proc_net_remove(net, "ip_mr_vif");
+proc_vif_fail:
+       kfree(net->ipv4.mfc_cache_array);
+#endif
+fail_mfc_cache:
+       kfree(net->ipv4.vif_table);
+fail:
+       return err;
+}
+
+static void __net_exit ipmr_net_exit(struct net *net)
+{
+#ifdef CONFIG_PROC_FS
+       proc_net_remove(net, "ip_mr_cache");
+       proc_net_remove(net, "ip_mr_vif");
+#endif
+       kfree(net->ipv4.mfc_cache_array);
+       kfree(net->ipv4.vif_table);
+}
+
+static struct pernet_operations ipmr_net_ops = {
+       .init = ipmr_net_init,
+       .exit = ipmr_net_exit,
+};
 
 int __init ip_mr_init(void)
 {
@@ -1927,26 +2033,20 @@ int __init ip_mr_init(void)
        if (!mrt_cachep)
                return -ENOMEM;
 
+       err = register_pernet_subsys(&ipmr_net_ops);
+       if (err)
+               goto reg_pernet_fail;
+
        setup_timer(&ipmr_expire_timer, ipmr_expire_process, 0);
        err = register_netdevice_notifier(&ip_mr_notifier);
        if (err)
                goto reg_notif_fail;
-#ifdef CONFIG_PROC_FS
-       err = -ENOMEM;
-       if (!proc_net_fops_create(&init_net, "ip_mr_vif", 0, &ipmr_vif_fops))
-               goto proc_vif_fail;
-       if (!proc_net_fops_create(&init_net, "ip_mr_cache", 0, &ipmr_mfc_fops))
-               goto proc_cache_fail;
-#endif
        return 0;
-#ifdef CONFIG_PROC_FS
-proc_cache_fail:
-       proc_net_remove(&init_net, "ip_mr_vif");
-proc_vif_fail:
-       unregister_netdevice_notifier(&ip_mr_notifier);
-#endif
+
 reg_notif_fail:
        del_timer(&ipmr_expire_timer);
+       unregister_pernet_subsys(&ipmr_net_ops);
+reg_pernet_fail:
        kmem_cache_destroy(mrt_cachep);
        return err;
 }
index 182f845de92f762e76a5bb5546aa417cf81330bf..d9521f6f9ed0f29a9eeabc27710636d7c6393ac9 100644 (file)
@@ -1292,7 +1292,7 @@ static struct nf_conntrack_helper snmp_helper __read_mostly = {
        .expect_policy          = &snmp_exp_policy,
        .name                   = "snmp",
        .tuple.src.l3num        = AF_INET,
-       .tuple.src.u.udp.port   = __constant_htons(SNMP_PORT),
+       .tuple.src.u.udp.port   = cpu_to_be16(SNMP_PORT),
        .tuple.dst.protonum     = IPPROTO_UDP,
 };
 
@@ -1302,7 +1302,7 @@ static struct nf_conntrack_helper snmp_trap_helper __read_mostly = {
        .expect_policy          = &snmp_exp_policy,
        .name                   = "snmp_trap",
        .tuple.src.l3num        = AF_INET,
-       .tuple.src.u.udp.port   = __constant_htons(SNMP_TRAP_PORT),
+       .tuple.src.u.udp.port   = cpu_to_be16(SNMP_TRAP_PORT),
        .tuple.dst.protonum     = IPPROTO_UDP,
 };
 
index eb62e58bff7922b0e62d8f883da79fc0a8bee53b..cf0cdeeb1db0bc32986b752057407643320c63c6 100644 (file)
@@ -54,8 +54,8 @@ static int sockstat_seq_show(struct seq_file *seq, void *v)
        int orphans, sockets;
 
        local_bh_disable();
-       orphans = percpu_counter_sum_positive(&tcp_orphan_count),
-       sockets = percpu_counter_sum_positive(&tcp_sockets_allocated),
+       orphans = percpu_counter_sum_positive(&tcp_orphan_count);
+       sockets = percpu_counter_sum_positive(&tcp_sockets_allocated);
        local_bh_enable();
 
        socket_seq_show(seq);
index dff8bc4e0facd1cc804397bfc7e9c581962ae7c9..f774651f0a47fb6d9de74b49438d16b0915fa536 100644 (file)
@@ -493,6 +493,7 @@ static int raw_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
 
        ipc.addr = inet->saddr;
        ipc.opt = NULL;
+       ipc.shtx.flags = 0;
        ipc.oif = sk->sk_bound_dev_if;
 
        if (msg->msg_controllen) {
index 97f71153584faa6bf379235f0db151e17a5ed4e9..5caee609be06bb9f3b205a7a1a8628f655212ec5 100644 (file)
@@ -151,7 +151,7 @@ static void rt_emergency_hash_rebuild(struct net *net);
 
 static struct dst_ops ipv4_dst_ops = {
        .family =               AF_INET,
-       .protocol =             __constant_htons(ETH_P_IP),
+       .protocol =             cpu_to_be16(ETH_P_IP),
        .gc =                   rt_garbage_collect,
        .check =                ipv4_dst_check,
        .destroy =              ipv4_dst_destroy,
@@ -2696,7 +2696,7 @@ static void ipv4_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
 
 static struct dst_ops ipv4_dst_blackhole_ops = {
        .family                 =       AF_INET,
-       .protocol               =       __constant_htons(ETH_P_IP),
+       .protocol               =       cpu_to_be16(ETH_P_IP),
        .destroy                =       ipv4_dst_destroy,
        .check                  =       ipv4_dst_check,
        .update_pmtu            =       ipv4_rt_blackhole_update_pmtu,
@@ -2779,7 +2779,8 @@ int ip_route_output_key(struct net *net, struct rtable **rp, struct flowi *flp)
        return ip_route_output_flow(net, rp, flp, NULL, 0);
 }
 
-static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
+static int rt_fill_info(struct net *net,
+                       struct sk_buff *skb, u32 pid, u32 seq, int event,
                        int nowait, unsigned int flags)
 {
        struct rtable *rt = skb->rtable;
@@ -2844,8 +2845,8 @@ static int rt_fill_info(struct sk_buff *skb, u32 pid, u32 seq, int event,
                __be32 dst = rt->rt_dst;
 
                if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) &&
-                   IPV4_DEVCONF_ALL(&init_net, MC_FORWARDING)) {
-                       int err = ipmr_get_route(skb, r, nowait);
+                   IPV4_DEVCONF_ALL(net, MC_FORWARDING)) {
+                       int err = ipmr_get_route(net, skb, r, nowait);
                        if (err <= 0) {
                                if (!nowait) {
                                        if (err == 0)
@@ -2950,7 +2951,7 @@ static int inet_rtm_getroute(struct sk_buff *in_skb, struct nlmsghdr* nlh, void
        if (rtm->rtm_flags & RTM_F_NOTIFY)
                rt->rt_flags |= RTCF_NOTIFY;
 
-       err = rt_fill_info(skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
+       err = rt_fill_info(net, skb, NETLINK_CB(in_skb).pid, nlh->nlmsg_seq,
                           RTM_NEWROUTE, 0, 0);
        if (err <= 0)
                goto errout_free;
@@ -2988,7 +2989,7 @@ int ip_rt_dump(struct sk_buff *skb,  struct netlink_callback *cb)
                        if (rt_is_expired(rt))
                                continue;
                        skb->dst = dst_clone(&rt->u.dst);
-                       if (rt_fill_info(skb, NETLINK_CB(cb->skb).pid,
+                       if (rt_fill_info(net, skb, NETLINK_CB(cb->skb).pid,
                                         cb->nlh->nlmsg_seq, RTM_NEWROUTE,
                                         1, NLM_F_MULTI) <= 0) {
                                dst_release(xchg(&skb->dst, NULL));
index 76b148bcb0dcb9ffcb333aa2b3ab3a2ed68fad33..90b2f3c192ff47eb4c24d8e416d7d1e04f577677 100644 (file)
@@ -2478,23 +2478,23 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
        struct tcphdr *th2;
        unsigned int thlen;
        unsigned int flags;
-       unsigned int total;
        unsigned int mss = 1;
        int flush = 1;
+       int i;
 
-       if (!pskb_may_pull(skb, sizeof(*th)))
+       th = skb_gro_header(skb, sizeof(*th));
+       if (unlikely(!th))
                goto out;
 
-       th = tcp_hdr(skb);
        thlen = th->doff * 4;
        if (thlen < sizeof(*th))
                goto out;
 
-       if (!pskb_may_pull(skb, thlen))
+       th = skb_gro_header(skb, thlen);
+       if (unlikely(!th))
                goto out;
 
-       th = tcp_hdr(skb);
-       __skb_pull(skb, thlen);
+       skb_gro_pull(skb, thlen);
 
        flags = tcp_flag_word(th);
 
@@ -2504,7 +2504,7 @@ struct sk_buff **tcp_gro_receive(struct sk_buff **head, struct sk_buff *skb)
 
                th2 = tcp_hdr(p);
 
-               if (th->source != th2->source || th->dest != th2->dest) {
+               if ((th->source ^ th2->source) | (th->dest ^ th2->dest)) {
                        NAPI_GRO_CB(p)->same_flow = 0;
                        continue;
                }
@@ -2519,14 +2519,15 @@ found:
        flush |= flags & TCP_FLAG_CWR;
        flush |= (flags ^ tcp_flag_word(th2)) &
                  ~(TCP_FLAG_CWR | TCP_FLAG_FIN | TCP_FLAG_PSH);
-       flush |= th->ack_seq != th2->ack_seq || th->window != th2->window;
-       flush |= memcmp(th + 1, th2 + 1, thlen - sizeof(*th));
+       flush |= (th->ack_seq ^ th2->ack_seq) | (th->window ^ th2->window);
+       for (i = sizeof(*th); !flush && i < thlen; i += 4)
+               flush |= *(u32 *)((u8 *)th + i) ^
+                        *(u32 *)((u8 *)th2 + i);
 
-       total = p->len;
        mss = skb_shinfo(p)->gso_size;
 
-       flush |= skb->len > mss || skb->len <= 0;
-       flush |= ntohl(th2->seq) + total != ntohl(th->seq);
+       flush |= (skb_gro_len(skb) > mss) | !skb_gro_len(skb);
+       flush |= (ntohl(th2->seq) + skb_gro_len(p)) ^ ntohl(th->seq);
 
        if (flush || skb_gro_receive(head, skb)) {
                mss = 1;
@@ -2538,7 +2539,7 @@ found:
        tcp_flag_word(th2) |= flags & (TCP_FLAG_FIN | TCP_FLAG_PSH);
 
 out_check_final:
-       flush = skb->len < mss;
+       flush = skb_gro_len(skb) < mss;
        flush |= flags & (TCP_FLAG_URG | TCP_FLAG_PSH | TCP_FLAG_RST |
                          TCP_FLAG_SYN | TCP_FLAG_FIN);
 
index 19d7b429a2625b8ecc3b7fc35392d3e0af99ffd2..a7381205bbfced5870961358758faa45e6e26357 100644 (file)
@@ -2355,7 +2355,7 @@ struct sk_buff **tcp4_gro_receive(struct sk_buff **head, struct sk_buff *skb)
 
        switch (skb->ip_summed) {
        case CHECKSUM_COMPLETE:
-               if (!tcp_v4_check(skb->len, iph->saddr, iph->daddr,
+               if (!tcp_v4_check(skb_gro_len(skb), iph->saddr, iph->daddr,
                                  skb->csum)) {
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                        break;
@@ -2443,7 +2443,7 @@ static struct pernet_operations __net_initdata tcp_sk_ops = {
 void __init tcp_v4_init(void)
 {
        inet_hashinfo_init(&tcp_hashinfo);
-       if (register_pernet_device(&tcp_sk_ops))
+       if (register_pernet_subsys(&tcp_sk_ops))
                panic("Failed to create the TCP control socket.\n");
 }
 
index da2c3b8794f2b39d3c5e4948b08cd78167f5ae2e..f6f61b3e677b53452f5b40e18051825d92681c03 100644 (file)
@@ -663,10 +663,14 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
        th->urg_ptr             = 0;
 
        /* The urg_mode check is necessary during a below snd_una win probe */
-       if (unlikely(tcp_urg_mode(tp) &&
-                    between(tp->snd_up, tcb->seq + 1, tcb->seq + 0xFFFF))) {
-               th->urg_ptr             = htons(tp->snd_up - tcb->seq);
-               th->urg                 = 1;
+       if (unlikely(tcp_urg_mode(tp) && before(tcb->seq, tp->snd_up))) {
+               if (before(tp->snd_up, tcb->seq + 0x10000)) {
+                       th->urg_ptr = htons(tp->snd_up - tcb->seq);
+                       th->urg = 1;
+               } else if (after(tcb->seq + 0xFFFF, tp->snd_nxt)) {
+                       th->urg_ptr = 0xFFFF;
+                       th->urg = 1;
+               }
        }
 
        tcp_options_write((__be32 *)(th + 1), tp, &opts, &md5_hash_location);
index c47c989cb1fb162b9fb71f8f27a580f4ba8088d0..4bd178a111d567a81a1219fdcd28ce0e10712b14 100644 (file)
@@ -596,6 +596,7 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
                return -EOPNOTSUPP;
 
        ipc.opt = NULL;
+       ipc.shtx.flags = 0;
 
        if (up->pending) {
                /*
@@ -643,6 +644,9 @@ int udp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
        ipc.addr = inet->saddr;
 
        ipc.oif = sk->sk_bound_dev_if;
+       err = sock_tx_timestamp(msg, sk, &ipc.shtx);
+       if (err)
+               return err;
        if (msg->msg_controllen) {
                err = ip_cmsg_send(sock_net(sk), msg, &ipc);
                if (err)
index 2ad24ba31f9de591df4305d7b3d406318ec18976..60d918c96a4fff19c0d4062558ea8c594fa9bef2 100644 (file)
@@ -241,7 +241,7 @@ static void xfrm4_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
 
 static struct dst_ops xfrm4_dst_ops = {
        .family =               AF_INET,
-       .protocol =             __constant_htons(ETH_P_IP),
+       .protocol =             cpu_to_be16(ETH_P_IP),
        .gc =                   xfrm4_garbage_collect,
        .update_pmtu =          xfrm4_update_pmtu,
        .destroy =              xfrm4_dst_destroy,
index f9afb452249c0f1cfbcdac802430d9adb41b694b..03e2a1ad71e9605e95ed47f2688412cd9f86b8df 100644 (file)
@@ -2224,10 +2224,24 @@ int addrconf_del_ifaddr(struct net *net, void __user *arg)
        return err;
 }
 
+static void add_addr(struct inet6_dev *idev, const struct in6_addr *addr,
+                    int plen, int scope)
+{
+       struct inet6_ifaddr *ifp;
+
+       ifp = ipv6_add_addr(idev, addr, plen, scope, IFA_F_PERMANENT);
+       if (!IS_ERR(ifp)) {
+               spin_lock_bh(&ifp->lock);
+               ifp->flags &= ~IFA_F_TENTATIVE;
+               spin_unlock_bh(&ifp->lock);
+               ipv6_ifa_notify(RTM_NEWADDR, ifp);
+               in6_ifa_put(ifp);
+       }
+}
+
 #if defined(CONFIG_IPV6_SIT) || defined(CONFIG_IPV6_SIT_MODULE)
 static void sit_add_v4_addrs(struct inet6_dev *idev)
 {
-       struct inet6_ifaddr * ifp;
        struct in6_addr addr;
        struct net_device *dev;
        struct net *net = dev_net(idev->dev);
@@ -2246,14 +2260,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
        }
 
        if (addr.s6_addr32[3]) {
-               ifp = ipv6_add_addr(idev, &addr, 128, scope, IFA_F_PERMANENT);
-               if (!IS_ERR(ifp)) {
-                       spin_lock_bh(&ifp->lock);
-                       ifp->flags &= ~IFA_F_TENTATIVE;
-                       spin_unlock_bh(&ifp->lock);
-                       ipv6_ifa_notify(RTM_NEWADDR, ifp);
-                       in6_ifa_put(ifp);
-               }
+               add_addr(idev, &addr, 128, scope);
                return;
        }
 
@@ -2281,15 +2288,7 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
                                else
                                        plen = 96;
 
-                               ifp = ipv6_add_addr(idev, &addr, plen, flag,
-                                                   IFA_F_PERMANENT);
-                               if (!IS_ERR(ifp)) {
-                                       spin_lock_bh(&ifp->lock);
-                                       ifp->flags &= ~IFA_F_TENTATIVE;
-                                       spin_unlock_bh(&ifp->lock);
-                                       ipv6_ifa_notify(RTM_NEWADDR, ifp);
-                                       in6_ifa_put(ifp);
-                               }
+                               add_addr(idev, &addr, plen, flag);
                        }
                }
        }
@@ -2299,7 +2298,6 @@ static void sit_add_v4_addrs(struct inet6_dev *idev)
 static void init_loopback(struct net_device *dev)
 {
        struct inet6_dev  *idev;
-       struct inet6_ifaddr * ifp;
 
        /* ::1 */
 
@@ -2310,14 +2308,7 @@ static void init_loopback(struct net_device *dev)
                return;
        }
 
-       ifp = ipv6_add_addr(idev, &in6addr_loopback, 128, IFA_HOST, IFA_F_PERMANENT);
-       if (!IS_ERR(ifp)) {
-               spin_lock_bh(&ifp->lock);
-               ifp->flags &= ~IFA_F_TENTATIVE;
-               spin_unlock_bh(&ifp->lock);
-               ipv6_ifa_notify(RTM_NEWADDR, ifp);
-               in6_ifa_put(ifp);
-       }
+       add_addr(idev, &in6addr_loopback, 128, IFA_HOST);
 }
 
 static void addrconf_add_linklocal(struct inet6_dev *idev, struct in6_addr *addr)
index c802bc1658a854bc2599c6821fe6bfb4b5998870..fa2ac7ee662fa3de8bc162ca2a2429b2dcebde28 100644 (file)
@@ -799,24 +799,34 @@ static struct sk_buff **ipv6_gro_receive(struct sk_buff **head,
        int proto;
        __wsum csum;
 
-       if (unlikely(!pskb_may_pull(skb, sizeof(*iph))))
+       iph = skb_gro_header(skb, sizeof(*iph));
+       if (unlikely(!iph))
                goto out;
 
-       iph = ipv6_hdr(skb);
-       __skb_pull(skb, sizeof(*iph));
+       skb_gro_pull(skb, sizeof(*iph));
+       skb_set_transport_header(skb, skb_gro_offset(skb));
 
-       flush += ntohs(iph->payload_len) != skb->len;
+       flush += ntohs(iph->payload_len) != skb_gro_len(skb);
 
        rcu_read_lock();
-       proto = ipv6_gso_pull_exthdrs(skb, iph->nexthdr);
-       iph = ipv6_hdr(skb);
-       IPV6_GRO_CB(skb)->proto = proto;
+       proto = iph->nexthdr;
        ops = rcu_dereference(inet6_protos[proto]);
-       if (!ops || !ops->gro_receive)
-               goto out_unlock;
+       if (!ops || !ops->gro_receive) {
+               __pskb_pull(skb, skb_gro_offset(skb));
+               proto = ipv6_gso_pull_exthdrs(skb, proto);
+               skb_gro_pull(skb, -skb_transport_offset(skb));
+               skb_reset_transport_header(skb);
+               __skb_push(skb, skb_gro_offset(skb));
+
+               if (!ops || !ops->gro_receive)
+                       goto out_unlock;
+
+               iph = ipv6_hdr(skb);
+       }
+
+       IPV6_GRO_CB(skb)->proto = proto;
 
        flush--;
-       skb_reset_transport_header(skb);
        nlen = skb_network_header_len(skb);
 
        for (p = *head; p; p = p->next) {
@@ -880,7 +890,7 @@ out_unlock:
 }
 
 static struct packet_type ipv6_packet_type = {
-       .type = __constant_htons(ETH_P_IPV6),
+       .type = cpu_to_be16(ETH_P_IPV6),
        .func = ipv6_rcv,
        .gso_send_check = ipv6_gso_send_check,
        .gso_segment = ipv6_gso_segment,
index 3e2970841bd825f6d4c7286d9a5163e2da2084fe..3cd83b85e9efd39ddaa12d1541568cdb7d83f490 100644 (file)
@@ -1538,13 +1538,10 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
        if (rt->rt6i_flags & RTF_GATEWAY) {
                ND_PRINTK2(KERN_WARNING
                           "ICMPv6 Redirect: destination is not a neighbour.\n");
-               dst_release(dst);
-               return;
-       }
-       if (!xrlim_allow(dst, 1*HZ)) {
-               dst_release(dst);
-               return;
+               goto release;
        }
+       if (!xrlim_allow(dst, 1*HZ))
+               goto release;
 
        if (dev->addr_len) {
                read_lock_bh(&neigh->lock);
@@ -1570,8 +1567,7 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
                ND_PRINTK0(KERN_ERR
                           "ICMPv6 Redirect: %s() failed to allocate an skb.\n",
                           __func__);
-               dst_release(dst);
-               return;
+               goto release;
        }
 
        skb_reserve(buff, LL_RESERVED_SPACE(dev));
@@ -1631,6 +1627,10 @@ void ndisc_send_redirect(struct sk_buff *skb, struct neighbour *neigh,
 
        if (likely(idev != NULL))
                in6_dev_put(idev);
+       return;
+
+release:
+       dst_release(dst);
 }
 
 static void pndisc_redo(struct sk_buff *skb)
index 9c574235c9058bb137bcc0f6bc8e8188c7111f63..c3d486a3edad17f4a9125829462863850ced9a65 100644 (file)
@@ -98,7 +98,7 @@ static struct rt6_info *rt6_get_route_info(struct net *net,
 
 static struct dst_ops ip6_dst_ops_template = {
        .family                 =       AF_INET6,
-       .protocol               =       __constant_htons(ETH_P_IPV6),
+       .protocol               =       cpu_to_be16(ETH_P_IPV6),
        .gc                     =       ip6_dst_gc,
        .gc_thresh              =       1024,
        .check                  =       ip6_dst_check,
@@ -117,7 +117,7 @@ static void ip6_rt_blackhole_update_pmtu(struct dst_entry *dst, u32 mtu)
 
 static struct dst_ops ip6_dst_blackhole_ops = {
        .family                 =       AF_INET6,
-       .protocol               =       __constant_htons(ETH_P_IPV6),
+       .protocol               =       cpu_to_be16(ETH_P_IPV6),
        .destroy                =       ip6_dst_destroy,
        .check                  =       ip6_dst_check,
        .update_pmtu            =       ip6_rt_blackhole_update_pmtu,
index e5b85d45bee837153cd6c07d94dc4a128ed0cb16..00f1269e11e95e3691a388836592ef905433648b 100644 (file)
@@ -948,7 +948,7 @@ struct sk_buff **tcp6_gro_receive(struct sk_buff **head, struct sk_buff *skb)
 
        switch (skb->ip_summed) {
        case CHECKSUM_COMPLETE:
-               if (!tcp_v6_check(skb->len, &iph->saddr, &iph->daddr,
+               if (!tcp_v6_check(skb_gro_len(skb), &iph->saddr, &iph->daddr,
                                  skb->csum)) {
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
                        break;
index 97ab068e8ccc10be9d1ee27ec3b4a081322bb307..b4b16a43f2771bd62558a2cd8ca3af60b0d99808 100644 (file)
@@ -272,7 +272,7 @@ static void xfrm6_dst_ifdown(struct dst_entry *dst, struct net_device *dev,
 
 static struct dst_ops xfrm6_dst_ops = {
        .family =               AF_INET6,
-       .protocol =             __constant_htons(ETH_P_IPV6),
+       .protocol =             cpu_to_be16(ETH_P_IPV6),
        .gc =                   xfrm6_garbage_collect,
        .update_pmtu =          xfrm6_update_pmtu,
        .destroy =              xfrm6_dst_destroy,
index 0e685b05496ee6456e5b2d7ab2d5feddd2b52e07..f417b77fa0e15762715a9498974fbd8f5071401d 100644 (file)
@@ -69,7 +69,7 @@ __xfrm6_sort(void **dst, void **src, int n, int (*cmp)(void *p), int maxclass)
 
        for (i = 0; i < n; i++) {
                dst[count[class[i] - 1]++] = src[i];
-               src[i] = 0;
+               src[i] = NULL;
        }
 
        return 0;
index b6e70f92e7fb016140aa393fce90fa486cc12e95..43d0ffc6d5655ab2e5b18d77c249e21a2b33e28e 100644 (file)
@@ -1959,12 +1959,12 @@ static const struct proto_ops SOCKOPS_WRAPPED(ipx_dgram_ops) = {
 SOCKOPS_WRAP(ipx_dgram, PF_IPX);
 
 static struct packet_type ipx_8023_packet_type = {
-       .type           = __constant_htons(ETH_P_802_3),
+       .type           = cpu_to_be16(ETH_P_802_3),
        .func           = ipx_rcv,
 };
 
 static struct packet_type ipx_dix_packet_type = {
-       .type           = __constant_htons(ETH_P_IPX),
+       .type           = cpu_to_be16(ETH_P_IPX),
        .func           = ipx_rcv,
 };
 
index 4c487a883725e7f3ad4c98c567a248b16880688c..1bb607f2f5c7715222ed3f3f0108fca3391bff80 100644 (file)
@@ -56,7 +56,7 @@ EXPORT_SYMBOL(irda_debug);
  * Tell the kernel how IrDA packets should be handled.
  */
 static struct packet_type irda_packet_type = {
-       .type   = __constant_htons(ETH_P_IRDA),
+       .type   = cpu_to_be16(ETH_P_IRDA),
        .func   = irlap_driver_rcv,     /* Packet type handler irlap_frame.c */
 };
 
index 56fd85ab358e3b9c93bf2ff811acd4a9499491ea..febae702685cf58726918601bc613caba15f3af6 100644 (file)
@@ -1118,11 +1118,11 @@ static const struct proto_ops llc_ui_ops = {
        .sendpage    = sock_no_sendpage,
 };
 
-static char llc_proc_err_msg[] __initdata =
+static const char llc_proc_err_msg[] __initconst =
        KERN_CRIT "LLC: Unable to register the proc_fs entries\n";
-static char llc_sysctl_err_msg[] __initdata =
+static const char llc_sysctl_err_msg[] __initconst =
        KERN_CRIT "LLC: Unable to register the sysctl entries\n";
-static char llc_sock_err_msg[] __initdata =
+static const char llc_sock_err_msg[] __initconst =
        KERN_CRIT "LLC: Unable to register the network family\n";
 
 static int __init llc2_init(void)
index 50d5b10e23a27e52898a9a65e4f75bc6edd78f18..a7fe1adc378d68834a70f44739c98f927659d927 100644 (file)
@@ -148,12 +148,12 @@ void llc_sap_close(struct llc_sap *sap)
 }
 
 static struct packet_type llc_packet_type = {
-       .type = __constant_htons(ETH_P_802_2),
+       .type = cpu_to_be16(ETH_P_802_2),
        .func = llc_rcv,
 };
 
 static struct packet_type llc_tr_packet_type = {
-       .type = __constant_htons(ETH_P_TR_802_2),
+       .type = cpu_to_be16(ETH_P_TR_802_2),
        .func = llc_rcv,
 };
 
index 7d4971aa443f177a692bd909a9dbef8c50e682d5..3503a3d21318a79673a2e0c5058850b0df17b5cc 100644 (file)
@@ -8,13 +8,14 @@ mac80211-y := \
        wep.o \
        wpa.o \
        scan.o \
-       ht.o \
+       ht.o agg-tx.o agg-rx.o \
        mlme.o \
        iface.o \
        rate.o \
        michael.o \
        tkip.o \
        aes_ccm.o \
+       aes_cmac.o \
        cfg.o \
        rx.o \
        spectmgmt.o \
@@ -37,6 +38,8 @@ mac80211-$(CONFIG_MAC80211_MESH) += \
        mesh_plink.o \
        mesh_hwmp.o
 
+mac80211-$(CONFIG_PM) += pm.o
+
 # objects for PID algorithm
 rc80211_pid-y := rc80211_pid_algo.o
 rc80211_pid-$(CONFIG_MAC80211_DEBUGFS) += rc80211_pid_debugfs.o
diff --git a/net/mac80211/aes_cmac.c b/net/mac80211/aes_cmac.c
new file mode 100644 (file)
index 0000000..3d097b3
--- /dev/null
@@ -0,0 +1,135 @@
+/*
+ * AES-128-CMAC with TLen 16 for IEEE 802.11w BIP
+ * Copyright 2008, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/types.h>
+#include <linux/crypto.h>
+#include <linux/err.h>
+
+#include <net/mac80211.h>
+#include "key.h"
+#include "aes_cmac.h"
+
+#define AES_BLOCK_SIZE 16
+#define AES_CMAC_KEY_LEN 16
+#define CMAC_TLEN 8 /* CMAC TLen = 64 bits (8 octets) */
+#define AAD_LEN 20
+
+
+static void gf_mulx(u8 *pad)
+{
+       int i, carry;
+
+       carry = pad[0] & 0x80;
+       for (i = 0; i < AES_BLOCK_SIZE - 1; i++)
+               pad[i] = (pad[i] << 1) | (pad[i + 1] >> 7);
+       pad[AES_BLOCK_SIZE - 1] <<= 1;
+       if (carry)
+               pad[AES_BLOCK_SIZE - 1] ^= 0x87;
+}
+
+
+static void aes_128_cmac_vector(struct crypto_cipher *tfm, u8 *scratch,
+                               size_t num_elem,
+                               const u8 *addr[], const size_t *len, u8 *mac)
+{
+       u8 *cbc, *pad;
+       const u8 *pos, *end;
+       size_t i, e, left, total_len;
+
+       cbc = scratch;
+       pad = scratch + AES_BLOCK_SIZE;
+
+       memset(cbc, 0, AES_BLOCK_SIZE);
+
+       total_len = 0;
+       for (e = 0; e < num_elem; e++)
+               total_len += len[e];
+       left = total_len;
+
+       e = 0;
+       pos = addr[0];
+       end = pos + len[0];
+
+       while (left >= AES_BLOCK_SIZE) {
+               for (i = 0; i < AES_BLOCK_SIZE; i++) {
+                       cbc[i] ^= *pos++;
+                       if (pos >= end) {
+                               e++;
+                               pos = addr[e];
+                               end = pos + len[e];
+                       }
+               }
+               if (left > AES_BLOCK_SIZE)
+                       crypto_cipher_encrypt_one(tfm, cbc, cbc);
+               left -= AES_BLOCK_SIZE;
+       }
+
+       memset(pad, 0, AES_BLOCK_SIZE);
+       crypto_cipher_encrypt_one(tfm, pad, pad);
+       gf_mulx(pad);
+
+       if (left || total_len == 0) {
+               for (i = 0; i < left; i++) {
+                       cbc[i] ^= *pos++;
+                       if (pos >= end) {
+                               e++;
+                               pos = addr[e];
+                               end = pos + len[e];
+                       }
+               }
+               cbc[left] ^= 0x80;
+               gf_mulx(pad);
+       }
+
+       for (i = 0; i < AES_BLOCK_SIZE; i++)
+               pad[i] ^= cbc[i];
+       crypto_cipher_encrypt_one(tfm, pad, pad);
+       memcpy(mac, pad, CMAC_TLEN);
+}
+
+
+void ieee80211_aes_cmac(struct crypto_cipher *tfm, u8 *scratch, const u8 *aad,
+                       const u8 *data, size_t data_len, u8 *mic)
+{
+       const u8 *addr[3];
+       size_t len[3];
+       u8 zero[CMAC_TLEN];
+
+       memset(zero, 0, CMAC_TLEN);
+       addr[0] = aad;
+       len[0] = AAD_LEN;
+       addr[1] = data;
+       len[1] = data_len - CMAC_TLEN;
+       addr[2] = zero;
+       len[2] = CMAC_TLEN;
+
+       aes_128_cmac_vector(tfm, scratch, 3, addr, len, mic);
+}
+
+
+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[])
+{
+       struct crypto_cipher *tfm;
+
+       tfm = crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
+       if (IS_ERR(tfm))
+               return NULL;
+
+       crypto_cipher_setkey(tfm, key, AES_CMAC_KEY_LEN);
+
+       return tfm;
+}
+
+
+void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm)
+{
+       if (tfm)
+               crypto_free_cipher(tfm);
+}
diff --git a/net/mac80211/aes_cmac.h b/net/mac80211/aes_cmac.h
new file mode 100644 (file)
index 0000000..0eb9a48
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2008, Jouni Malinen <j@w1.fi>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef AES_CMAC_H
+#define AES_CMAC_H
+
+#include <linux/crypto.h>
+
+struct crypto_cipher * ieee80211_aes_cmac_key_setup(const u8 key[]);
+void ieee80211_aes_cmac(struct crypto_cipher *tfm, u8 *scratch, const u8 *aad,
+                       const u8 *data, size_t data_len, u8 *mic);
+void ieee80211_aes_cmac_key_free(struct crypto_cipher *tfm);
+
+#endif /* AES_CMAC_H */
diff --git a/net/mac80211/agg-rx.c b/net/mac80211/agg-rx.c
new file mode 100644 (file)
index 0000000..3112bfd
--- /dev/null
@@ -0,0 +1,302 @@
+/*
+ * HT handling
+ *
+ * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
+ * Copyright 2002-2005, Instant802 Networks, Inc.
+ * Copyright 2005-2006, Devicescape Software, Inc.
+ * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
+ * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2007-2008, Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/ieee80211.h>
+#include <net/mac80211.h>
+#include "ieee80211_i.h"
+
+void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
+                                   u16 initiator, u16 reason)
+{
+       struct ieee80211_local *local = sta->local;
+       struct ieee80211_hw *hw = &local->hw;
+       int i;
+
+       /* check if TID is in operational state */
+       spin_lock_bh(&sta->lock);
+       if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_OPERATIONAL) {
+               spin_unlock_bh(&sta->lock);
+               return;
+       }
+
+       sta->ampdu_mlme.tid_state_rx[tid] =
+               HT_AGG_STATE_REQ_STOP_BA_MSK |
+               (initiator << HT_AGG_STATE_INITIATOR_SHIFT);
+       spin_unlock_bh(&sta->lock);
+
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n",
+              sta->sta.addr, tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+
+       if (local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP,
+                                    &sta->sta, tid, NULL))
+               printk(KERN_DEBUG "HW problem - can not stop rx "
+                               "aggregation for tid %d\n", tid);
+
+       /* shutdown timer has not expired */
+       if (initiator != WLAN_BACK_TIMER)
+               del_timer_sync(&sta->ampdu_mlme.tid_rx[tid]->session_timer);
+
+       /* check if this is a self generated aggregation halt */
+       if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER)
+               ieee80211_send_delba(sta->sdata, sta->sta.addr,
+                                    tid, 0, reason);
+
+       /* free the reordering buffer */
+       for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) {
+               if (sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i]) {
+                       /* release the reordered frames */
+                       dev_kfree_skb(sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i]);
+                       sta->ampdu_mlme.tid_rx[tid]->stored_mpdu_num--;
+                       sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i] = NULL;
+               }
+       }
+
+       spin_lock_bh(&sta->lock);
+       /* free resources */
+       kfree(sta->ampdu_mlme.tid_rx[tid]->reorder_buf);
+
+       if (!sta->ampdu_mlme.tid_rx[tid]->shutdown) {
+               kfree(sta->ampdu_mlme.tid_rx[tid]);
+               sta->ampdu_mlme.tid_rx[tid] = NULL;
+       }
+
+       sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_IDLE;
+       spin_unlock_bh(&sta->lock);
+}
+
+void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid,
+                                       u16 initiator, u16 reason)
+{
+       struct ieee80211_local *local = sdata->local;
+       struct sta_info *sta;
+
+       /* stop HW Rx aggregation. ampdu_action existence
+        * already verified in session init so we add the BUG_ON */
+       BUG_ON(!local->ops->ampdu_action);
+
+       rcu_read_lock();
+
+       sta = sta_info_get(local, ra);
+       if (!sta) {
+               rcu_read_unlock();
+               return;
+       }
+
+       __ieee80211_stop_rx_ba_session(sta, tid, initiator, reason);
+
+       rcu_read_unlock();
+}
+
+/*
+ * After accepting the AddBA Request we activated a timer,
+ * resetting it after each frame that arrives from the originator.
+ * if this timer expires ieee80211_sta_stop_rx_ba_session will be executed.
+ */
+static void sta_rx_agg_session_timer_expired(unsigned long data)
+{
+       /* not an elegant detour, but there is no choice as the timer passes
+        * only one argument, and various sta_info are needed here, so init
+        * flow in sta_info_create gives the TID as data, while the timer_to_id
+        * array gives the sta through container_of */
+       u8 *ptid = (u8 *)data;
+       u8 *timer_to_id = ptid - *ptid;
+       struct sta_info *sta = container_of(timer_to_id, struct sta_info,
+                                        timer_to_tid[0]);
+
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid);
+#endif
+       ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->sta.addr,
+                                        (u16)*ptid, WLAN_BACK_TIMER,
+                                        WLAN_REASON_QSTA_TIMEOUT);
+}
+
+static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid,
+                                     u8 dialog_token, u16 status, u16 policy,
+                                     u16 buf_size, u16 timeout)
+{
+       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+       struct ieee80211_local *local = sdata->local;
+       struct sk_buff *skb;
+       struct ieee80211_mgmt *mgmt;
+       u16 capab;
+
+       skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
+
+       if (!skb) {
+               printk(KERN_DEBUG "%s: failed to allocate buffer "
+                      "for addba resp frame\n", sdata->dev->name);
+               return;
+       }
+
+       skb_reserve(skb, local->hw.extra_tx_headroom);
+       mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
+       memset(mgmt, 0, 24);
+       memcpy(mgmt->da, da, ETH_ALEN);
+       memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
+       if (sdata->vif.type == NL80211_IFTYPE_AP ||
+           sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+               memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
+       else
+               memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+       mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+                                         IEEE80211_STYPE_ACTION);
+
+       skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp));
+       mgmt->u.action.category = WLAN_CATEGORY_BACK;
+       mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP;
+       mgmt->u.action.u.addba_resp.dialog_token = dialog_token;
+
+       capab = (u16)(policy << 1);     /* bit 1 aggregation policy */
+       capab |= (u16)(tid << 2);       /* bit 5:2 TID number */
+       capab |= (u16)(buf_size << 6);  /* bit 15:6 max size of aggregation */
+
+       mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab);
+       mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout);
+       mgmt->u.action.u.addba_resp.status = cpu_to_le16(status);
+
+       ieee80211_tx_skb(sdata, skb, 1);
+}
+
+void ieee80211_process_addba_request(struct ieee80211_local *local,
+                                    struct sta_info *sta,
+                                    struct ieee80211_mgmt *mgmt,
+                                    size_t len)
+{
+       struct ieee80211_hw *hw = &local->hw;
+       struct ieee80211_conf *conf = &hw->conf;
+       struct tid_ampdu_rx *tid_agg_rx;
+       u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status;
+       u8 dialog_token;
+       int ret = -EOPNOTSUPP;
+
+       /* extract session parameters from addba request frame */
+       dialog_token = mgmt->u.action.u.addba_req.dialog_token;
+       timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout);
+       start_seq_num =
+               le16_to_cpu(mgmt->u.action.u.addba_req.start_seq_num) >> 4;
+
+       capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab);
+       ba_policy = (capab & IEEE80211_ADDBA_PARAM_POLICY_MASK) >> 1;
+       tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
+       buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
+
+       status = WLAN_STATUS_REQUEST_DECLINED;
+
+       /* sanity check for incoming parameters:
+        * check if configuration can support the BA policy
+        * and if buffer size does not exceeds max value */
+       /* XXX: check own ht delayed BA capability?? */
+       if (((ba_policy != 1)
+               && (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA)))
+               || (buf_size > IEEE80211_MAX_AMPDU_BUF)) {
+               status = WLAN_STATUS_INVALID_QOS_PARAM;
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               if (net_ratelimit())
+                       printk(KERN_DEBUG "AddBA Req with bad params from "
+                               "%pM on tid %u. policy %d, buffer size %d\n",
+                               mgmt->sa, tid, ba_policy,
+                               buf_size);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+               goto end_no_lock;
+       }
+       /* determine default buffer size */
+       if (buf_size == 0) {
+               struct ieee80211_supported_band *sband;
+
+               sband = local->hw.wiphy->bands[conf->channel->band];
+               buf_size = IEEE80211_MIN_AMPDU_BUF;
+               buf_size = buf_size << sband->ht_cap.ampdu_factor;
+       }
+
+
+       /* examine state machine */
+       spin_lock_bh(&sta->lock);
+
+       if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_IDLE) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               if (net_ratelimit())
+                       printk(KERN_DEBUG "unexpected AddBA Req from "
+                               "%pM on tid %u\n",
+                               mgmt->sa, tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+               goto end;
+       }
+
+       /* prepare A-MPDU MLME for Rx aggregation */
+       sta->ampdu_mlme.tid_rx[tid] =
+                       kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC);
+       if (!sta->ampdu_mlme.tid_rx[tid]) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               if (net_ratelimit())
+                       printk(KERN_ERR "allocate rx mlme to tid %d failed\n",
+                                       tid);
+#endif
+               goto end;
+       }
+       /* rx timer */
+       sta->ampdu_mlme.tid_rx[tid]->session_timer.function =
+                               sta_rx_agg_session_timer_expired;
+       sta->ampdu_mlme.tid_rx[tid]->session_timer.data =
+                               (unsigned long)&sta->timer_to_tid[tid];
+       init_timer(&sta->ampdu_mlme.tid_rx[tid]->session_timer);
+
+       tid_agg_rx = sta->ampdu_mlme.tid_rx[tid];
+
+       /* prepare reordering buffer */
+       tid_agg_rx->reorder_buf =
+               kcalloc(buf_size, sizeof(struct sk_buff *), GFP_ATOMIC);
+       if (!tid_agg_rx->reorder_buf) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               if (net_ratelimit())
+                       printk(KERN_ERR "can not allocate reordering buffer "
+                              "to tid %d\n", tid);
+#endif
+               kfree(sta->ampdu_mlme.tid_rx[tid]);
+               goto end;
+       }
+
+       if (local->ops->ampdu_action)
+               ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START,
+                                              &sta->sta, tid, &start_seq_num);
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+
+       if (ret) {
+               kfree(tid_agg_rx->reorder_buf);
+               kfree(tid_agg_rx);
+               sta->ampdu_mlme.tid_rx[tid] = NULL;
+               goto end;
+       }
+
+       /* change state and send addba resp */
+       sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_OPERATIONAL;
+       tid_agg_rx->dialog_token = dialog_token;
+       tid_agg_rx->ssn = start_seq_num;
+       tid_agg_rx->head_seq_num = start_seq_num;
+       tid_agg_rx->buf_size = buf_size;
+       tid_agg_rx->timeout = timeout;
+       tid_agg_rx->stored_mpdu_num = 0;
+       status = WLAN_STATUS_SUCCESS;
+end:
+       spin_unlock_bh(&sta->lock);
+
+end_no_lock:
+       ieee80211_send_addba_resp(sta->sdata, sta->sta.addr, tid,
+                                 dialog_token, status, 1, buf_size, timeout);
+}
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
new file mode 100644 (file)
index 0000000..1232d9f
--- /dev/null
@@ -0,0 +1,636 @@
+/*
+ * HT handling
+ *
+ * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
+ * Copyright 2002-2005, Instant802 Networks, Inc.
+ * Copyright 2005-2006, Devicescape Software, Inc.
+ * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
+ * Copyright 2007, Michael Wu <flamingice@sourmilk.net>
+ * Copyright 2007-2009, Intel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/ieee80211.h>
+#include <net/mac80211.h>
+#include "ieee80211_i.h"
+#include "wme.h"
+
+/**
+ * DOC: TX aggregation
+ *
+ * Aggregation on the TX side requires setting the hardware flag
+ * %IEEE80211_HW_AMPDU_AGGREGATION as well as, if present, the @ampdu_queues
+ * hardware parameter to the number of hardware AMPDU queues. If there are no
+ * hardware queues then the driver will (currently) have to do all frame
+ * buffering.
+ *
+ * When TX aggregation is started by some subsystem (usually the rate control
+ * algorithm would be appropriate) by calling the
+ * ieee80211_start_tx_ba_session() function, the driver will be notified via
+ * its @ampdu_action function, with the %IEEE80211_AMPDU_TX_START action.
+ *
+ * In response to that, the driver is later required to call the
+ * ieee80211_start_tx_ba_cb() (or ieee80211_start_tx_ba_cb_irqsafe())
+ * function, which will start the aggregation session.
+ *
+ * Similarly, when the aggregation session is stopped by
+ * ieee80211_stop_tx_ba_session(), the driver's @ampdu_action function will
+ * be called with the action %IEEE80211_AMPDU_TX_STOP. In this case, the
+ * call must not fail, and the driver must later call ieee80211_stop_tx_ba_cb()
+ * (or ieee80211_stop_tx_ba_cb_irqsafe()).
+ */
+
+static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata,
+                                        const u8 *da, u16 tid,
+                                        u8 dialog_token, u16 start_seq_num,
+                                        u16 agg_size, u16 timeout)
+{
+       struct ieee80211_local *local = sdata->local;
+       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+       struct sk_buff *skb;
+       struct ieee80211_mgmt *mgmt;
+       u16 capab;
+
+       skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
+
+       if (!skb) {
+               printk(KERN_ERR "%s: failed to allocate buffer "
+                               "for addba request frame\n", sdata->dev->name);
+               return;
+       }
+       skb_reserve(skb, local->hw.extra_tx_headroom);
+       mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
+       memset(mgmt, 0, 24);
+       memcpy(mgmt->da, da, ETH_ALEN);
+       memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
+       if (sdata->vif.type == NL80211_IFTYPE_AP ||
+           sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+               memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
+       else
+               memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
+
+       mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+                                         IEEE80211_STYPE_ACTION);
+
+       skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req));
+
+       mgmt->u.action.category = WLAN_CATEGORY_BACK;
+       mgmt->u.action.u.addba_req.action_code = WLAN_ACTION_ADDBA_REQ;
+
+       mgmt->u.action.u.addba_req.dialog_token = dialog_token;
+       capab = (u16)(1 << 1);          /* bit 1 aggregation policy */
+       capab |= (u16)(tid << 2);       /* bit 5:2 TID number */
+       capab |= (u16)(agg_size << 6);  /* bit 15:6 max size of aggergation */
+
+       mgmt->u.action.u.addba_req.capab = cpu_to_le16(capab);
+
+       mgmt->u.action.u.addba_req.timeout = cpu_to_le16(timeout);
+       mgmt->u.action.u.addba_req.start_seq_num =
+                                       cpu_to_le16(start_seq_num << 4);
+
+       ieee80211_tx_skb(sdata, skb, 1);
+}
+
+void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn)
+{
+       struct ieee80211_local *local = sdata->local;
+       struct sk_buff *skb;
+       struct ieee80211_bar *bar;
+       u16 bar_control = 0;
+
+       skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom);
+       if (!skb) {
+               printk(KERN_ERR "%s: failed to allocate buffer for "
+                       "bar frame\n", sdata->dev->name);
+               return;
+       }
+       skb_reserve(skb, local->hw.extra_tx_headroom);
+       bar = (struct ieee80211_bar *)skb_put(skb, sizeof(*bar));
+       memset(bar, 0, sizeof(*bar));
+       bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL |
+                                        IEEE80211_STYPE_BACK_REQ);
+       memcpy(bar->ra, ra, ETH_ALEN);
+       memcpy(bar->ta, sdata->dev->dev_addr, ETH_ALEN);
+       bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL;
+       bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA;
+       bar_control |= (u16)(tid << 12);
+       bar->control = cpu_to_le16(bar_control);
+       bar->start_seq_num = cpu_to_le16(ssn);
+
+       ieee80211_tx_skb(sdata, skb, 0);
+}
+
+static int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+                                          enum ieee80211_back_parties initiator)
+{
+       struct ieee80211_local *local = sta->local;
+       int ret;
+       u8 *state;
+
+       state = &sta->ampdu_mlme.tid_state_tx[tid];
+
+       if (local->hw.ampdu_queues)
+               ieee80211_stop_queue(&local->hw, sta->tid_to_tx_q[tid]);
+
+       *state = HT_AGG_STATE_REQ_STOP_BA_MSK |
+               (initiator << HT_AGG_STATE_INITIATOR_SHIFT);
+
+       ret = local->ops->ampdu_action(&local->hw, IEEE80211_AMPDU_TX_STOP,
+                                      &sta->sta, tid, NULL);
+
+       /* HW shall not deny going back to legacy */
+       if (WARN_ON(ret)) {
+               *state = HT_AGG_STATE_OPERATIONAL;
+               if (local->hw.ampdu_queues)
+                       ieee80211_wake_queue(&local->hw, sta->tid_to_tx_q[tid]);
+       }
+
+       return ret;
+}
+
+/*
+ * After sending add Block Ack request we activated a timer until
+ * add Block Ack response will arrive from the recipient.
+ * If this timer expires sta_addba_resp_timer_expired will be executed.
+ */
+static void sta_addba_resp_timer_expired(unsigned long data)
+{
+       /* not an elegant detour, but there is no choice as the timer passes
+        * only one argument, and both sta_info and TID are needed, so init
+        * flow in sta_info_create gives the TID as data, while the timer_to_id
+        * array gives the sta through container_of */
+       u16 tid = *(u8 *)data;
+       struct sta_info *sta = container_of((void *)data,
+               struct sta_info, timer_to_tid[tid]);
+       u8 *state;
+
+       state = &sta->ampdu_mlme.tid_state_tx[tid];
+
+       /* check if the TID waits for addBA response */
+       spin_lock_bh(&sta->lock);
+       if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
+               spin_unlock_bh(&sta->lock);
+               *state = HT_AGG_STATE_IDLE;
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "timer expired on tid %d but we are not "
+                               "expecting addBA response there", tid);
+#endif
+               return;
+       }
+
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid);
+#endif
+
+       ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR);
+       spin_unlock_bh(&sta->lock);
+}
+
+int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct sta_info *sta;
+       struct ieee80211_sub_if_data *sdata;
+       u16 start_seq_num;
+       u8 *state;
+       int ret = 0;
+
+       if (WARN_ON(!local->ops->ampdu_action))
+               return -EINVAL;
+
+       if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION))
+               return -EINVAL;
+
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n",
+              ra, tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+
+       rcu_read_lock();
+
+       sta = sta_info_get(local, ra);
+       if (!sta) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "Could not find the station\n");
+#endif
+               ret = -ENOENT;
+               goto exit;
+       }
+
+       /*
+        * The aggregation code is not prepared to handle
+        * anything but STA/AP due to the BSSID handling.
+        * IBSS could work in the code but isn't supported
+        * by drivers or the standard.
+        */
+       if (sta->sdata->vif.type != NL80211_IFTYPE_STATION &&
+           sta->sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
+           sta->sdata->vif.type != NL80211_IFTYPE_AP) {
+               ret = -EINVAL;
+               goto exit;
+       }
+
+       spin_lock_bh(&sta->lock);
+
+       /* we have tried too many times, receiver does not want A-MPDU */
+       if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_MAX_RETRIES) {
+               ret = -EBUSY;
+               goto err_unlock_sta;
+       }
+
+       state = &sta->ampdu_mlme.tid_state_tx[tid];
+       /* check if the TID is not in aggregation flow already */
+       if (*state != HT_AGG_STATE_IDLE) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "BA request denied - session is not "
+                                "idle on tid %u\n", tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+               ret = -EAGAIN;
+               goto err_unlock_sta;
+       }
+
+       /* prepare A-MPDU MLME for Tx aggregation */
+       sta->ampdu_mlme.tid_tx[tid] =
+                       kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC);
+       if (!sta->ampdu_mlme.tid_tx[tid]) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               if (net_ratelimit())
+                       printk(KERN_ERR "allocate tx mlme to tid %d failed\n",
+                                       tid);
+#endif
+               ret = -ENOMEM;
+               goto err_unlock_sta;
+       }
+       /* Tx timer */
+       sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.function =
+                       sta_addba_resp_timer_expired;
+       sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.data =
+                       (unsigned long)&sta->timer_to_tid[tid];
+       init_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
+
+       if (hw->ampdu_queues) {
+               /* create a new queue for this aggregation */
+               ret = ieee80211_ht_agg_queue_add(local, sta, tid);
+
+               /* case no queue is available to aggregation
+                * don't switch to aggregation */
+               if (ret) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+                       printk(KERN_DEBUG "BA request denied - "
+                              "queue unavailable for tid %d\n", tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+                       goto err_unlock_queue;
+               }
+       }
+       sdata = sta->sdata;
+
+       /* Ok, the Addba frame hasn't been sent yet, but if the driver calls the
+        * call back right away, it must see that the flow has begun */
+       *state |= HT_ADDBA_REQUESTED_MSK;
+
+       /* This is slightly racy because the queue isn't stopped */
+       start_seq_num = sta->tid_seq[tid];
+
+       ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_START,
+                                      &sta->sta, tid, &start_seq_num);
+
+       if (ret) {
+               /* No need to requeue the packets in the agg queue, since we
+                * held the tx lock: no packet could be enqueued to the newly
+                * allocated queue */
+               if (hw->ampdu_queues)
+                       ieee80211_ht_agg_queue_remove(local, sta, tid, 0);
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "BA request denied - HW unavailable for"
+                                       " tid %d\n", tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+               *state = HT_AGG_STATE_IDLE;
+               goto err_unlock_queue;
+       }
+
+       /* Will put all the packets in the new SW queue */
+       if (hw->ampdu_queues)
+               ieee80211_requeue(local, ieee802_1d_to_ac[tid]);
+       spin_unlock_bh(&sta->lock);
+
+       /* send an addBA request */
+       sta->ampdu_mlme.dialog_token_allocator++;
+       sta->ampdu_mlme.tid_tx[tid]->dialog_token =
+                       sta->ampdu_mlme.dialog_token_allocator;
+       sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num;
+
+
+       ieee80211_send_addba_request(sta->sdata, ra, tid,
+                        sta->ampdu_mlme.tid_tx[tid]->dialog_token,
+                        sta->ampdu_mlme.tid_tx[tid]->ssn,
+                        0x40, 5000);
+       /* activate the timer for the recipient's addBA response */
+       sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires =
+                               jiffies + ADDBA_RESP_INTERVAL;
+       add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid);
+#endif
+       goto exit;
+
+err_unlock_queue:
+       kfree(sta->ampdu_mlme.tid_tx[tid]);
+       sta->ampdu_mlme.tid_tx[tid] = NULL;
+       ret = -EBUSY;
+err_unlock_sta:
+       spin_unlock_bh(&sta->lock);
+exit:
+       rcu_read_unlock();
+       return ret;
+}
+EXPORT_SYMBOL(ieee80211_start_tx_ba_session);
+
+void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct sta_info *sta;
+       u8 *state;
+
+       if (tid >= STA_TID_NUM) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
+                               tid, STA_TID_NUM);
+#endif
+               return;
+       }
+
+       rcu_read_lock();
+       sta = sta_info_get(local, ra);
+       if (!sta) {
+               rcu_read_unlock();
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "Could not find station: %pM\n", ra);
+#endif
+               return;
+       }
+
+       state = &sta->ampdu_mlme.tid_state_tx[tid];
+       spin_lock_bh(&sta->lock);
+
+       if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "addBA was not requested yet, state is %d\n",
+                               *state);
+#endif
+               spin_unlock_bh(&sta->lock);
+               rcu_read_unlock();
+               return;
+       }
+
+       WARN_ON_ONCE(*state & HT_ADDBA_DRV_READY_MSK);
+
+       *state |= HT_ADDBA_DRV_READY_MSK;
+
+       if (*state == HT_AGG_STATE_OPERATIONAL) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid);
+#endif
+               if (hw->ampdu_queues)
+                       ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
+       }
+       spin_unlock_bh(&sta->lock);
+       rcu_read_unlock();
+}
+EXPORT_SYMBOL(ieee80211_start_tx_ba_cb);
+
+void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
+                                     const u8 *ra, u16 tid)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct ieee80211_ra_tid *ra_tid;
+       struct sk_buff *skb = dev_alloc_skb(0);
+
+       if (unlikely(!skb)) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               if (net_ratelimit())
+                       printk(KERN_WARNING "%s: Not enough memory, "
+                              "dropping start BA session", skb->dev->name);
+#endif
+               return;
+       }
+       ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
+       memcpy(&ra_tid->ra, ra, ETH_ALEN);
+       ra_tid->tid = tid;
+
+       skb->pkt_type = IEEE80211_ADDBA_MSG;
+       skb_queue_tail(&local->skb_queue, skb);
+       tasklet_schedule(&local->tasklet);
+}
+EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe);
+
+int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+                                  enum ieee80211_back_parties initiator)
+{
+       u8 *state;
+       int ret;
+
+       /* check if the TID is in aggregation */
+       state = &sta->ampdu_mlme.tid_state_tx[tid];
+       spin_lock_bh(&sta->lock);
+
+       if (*state != HT_AGG_STATE_OPERATIONAL) {
+               ret = -ENOENT;
+               goto unlock;
+       }
+
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
+              sta->sta.addr, tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+
+       ret = ___ieee80211_stop_tx_ba_session(sta, tid, initiator);
+
+ unlock:
+       spin_unlock_bh(&sta->lock);
+       return ret;
+}
+
+int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
+                                u8 *ra, u16 tid,
+                                enum ieee80211_back_parties initiator)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct sta_info *sta;
+       int ret = 0;
+
+       if (WARN_ON(!local->ops->ampdu_action))
+               return -EINVAL;
+
+       if (tid >= STA_TID_NUM)
+               return -EINVAL;
+
+       rcu_read_lock();
+       sta = sta_info_get(local, ra);
+       if (!sta) {
+               rcu_read_unlock();
+               return -ENOENT;
+       }
+
+       ret = __ieee80211_stop_tx_ba_session(sta, tid, initiator);
+       rcu_read_unlock();
+       return ret;
+}
+EXPORT_SYMBOL(ieee80211_stop_tx_ba_session);
+
+void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct sta_info *sta;
+       u8 *state;
+       int agg_queue;
+
+       if (tid >= STA_TID_NUM) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
+                               tid, STA_TID_NUM);
+#endif
+               return;
+       }
+
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "Stopping Tx BA session for %pM tid %d\n",
+              ra, tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+
+       rcu_read_lock();
+       sta = sta_info_get(local, ra);
+       if (!sta) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "Could not find station: %pM\n", ra);
+#endif
+               rcu_read_unlock();
+               return;
+       }
+       state = &sta->ampdu_mlme.tid_state_tx[tid];
+
+       /* NOTE: no need to use sta->lock in this state check, as
+        * ieee80211_stop_tx_ba_session will let only one stop call to
+        * pass through per sta/tid
+        */
+       if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n");
+#endif
+               rcu_read_unlock();
+               return;
+       }
+
+       if (*state & HT_AGG_STATE_INITIATOR_MSK)
+               ieee80211_send_delba(sta->sdata, ra, tid,
+                       WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE);
+
+       if (hw->ampdu_queues) {
+               agg_queue = sta->tid_to_tx_q[tid];
+               ieee80211_ht_agg_queue_remove(local, sta, tid, 1);
+
+               /* We just requeued the all the frames that were in the
+                * removed queue, and since we might miss a softirq we do
+                * netif_schedule_queue.  ieee80211_wake_queue is not used
+                * here as this queue is not necessarily stopped
+                */
+               netif_schedule_queue(netdev_get_tx_queue(local->mdev,
+                                                        agg_queue));
+       }
+       spin_lock_bh(&sta->lock);
+       *state = HT_AGG_STATE_IDLE;
+       sta->ampdu_mlme.addba_req_num[tid] = 0;
+       kfree(sta->ampdu_mlme.tid_tx[tid]);
+       sta->ampdu_mlme.tid_tx[tid] = NULL;
+       spin_unlock_bh(&sta->lock);
+
+       rcu_read_unlock();
+}
+EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb);
+
+void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
+                                    const u8 *ra, u16 tid)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct ieee80211_ra_tid *ra_tid;
+       struct sk_buff *skb = dev_alloc_skb(0);
+
+       if (unlikely(!skb)) {
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               if (net_ratelimit())
+                       printk(KERN_WARNING "%s: Not enough memory, "
+                              "dropping stop BA session", skb->dev->name);
+#endif
+               return;
+       }
+       ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
+       memcpy(&ra_tid->ra, ra, ETH_ALEN);
+       ra_tid->tid = tid;
+
+       skb->pkt_type = IEEE80211_DELBA_MSG;
+       skb_queue_tail(&local->skb_queue, skb);
+       tasklet_schedule(&local->tasklet);
+}
+EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe);
+
+
+void ieee80211_process_addba_resp(struct ieee80211_local *local,
+                                 struct sta_info *sta,
+                                 struct ieee80211_mgmt *mgmt,
+                                 size_t len)
+{
+       struct ieee80211_hw *hw = &local->hw;
+       u16 capab;
+       u16 tid, start_seq_num;
+       u8 *state;
+
+       capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab);
+       tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
+
+       state = &sta->ampdu_mlme.tid_state_tx[tid];
+
+       spin_lock_bh(&sta->lock);
+
+       if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
+               spin_unlock_bh(&sta->lock);
+               return;
+       }
+
+       if (mgmt->u.action.u.addba_resp.dialog_token !=
+               sta->ampdu_mlme.tid_tx[tid]->dialog_token) {
+               spin_unlock_bh(&sta->lock);
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+               return;
+       }
+
+       del_timer_sync(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
+#ifdef CONFIG_MAC80211_HT_DEBUG
+       printk(KERN_DEBUG "switched off addBA timer for tid %d \n", tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+       if (le16_to_cpu(mgmt->u.action.u.addba_resp.status)
+                       == WLAN_STATUS_SUCCESS) {
+               *state |= HT_ADDBA_RECEIVED_MSK;
+               sta->ampdu_mlme.addba_req_num[tid] = 0;
+
+               if (*state == HT_AGG_STATE_OPERATIONAL &&
+                   local->hw.ampdu_queues)
+                       ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
+
+               if (local->ops->ampdu_action) {
+                       (void)local->ops->ampdu_action(hw,
+                                              IEEE80211_AMPDU_TX_RESUME,
+                                              &sta->sta, tid, &start_seq_num);
+               }
+#ifdef CONFIG_MAC80211_HT_DEBUG
+               printk(KERN_DEBUG "Resuming TX aggregation for tid %d\n", tid);
+#endif /* CONFIG_MAC80211_HT_DEBUG */
+       } else {
+               sta->ampdu_mlme.addba_req_num[tid]++;
+               ___ieee80211_stop_tx_ba_session(sta, tid, WLAN_BACK_INITIATOR);
+       }
+       spin_unlock_bh(&sta->lock);
+}
index 9d4e4d846ec16ec978af0c95f1487e2e846f5841..c8d969be440bd805cfdfa66980f5bf826ee0d846 100644 (file)
@@ -133,6 +133,9 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
        case WLAN_CIPHER_SUITE_CCMP:
                alg = ALG_CCMP;
                break;
+       case WLAN_CIPHER_SUITE_AES_CMAC:
+               alg = ALG_AES_CMAC;
+               break;
        default:
                return -EINVAL;
        }
@@ -275,6 +278,17 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev,
                else
                        params.cipher = WLAN_CIPHER_SUITE_WEP104;
                break;
+       case ALG_AES_CMAC:
+               params.cipher = WLAN_CIPHER_SUITE_AES_CMAC;
+               seq[0] = key->u.aes_cmac.tx_pn[5];
+               seq[1] = key->u.aes_cmac.tx_pn[4];
+               seq[2] = key->u.aes_cmac.tx_pn[3];
+               seq[3] = key->u.aes_cmac.tx_pn[2];
+               seq[4] = key->u.aes_cmac.tx_pn[1];
+               seq[5] = key->u.aes_cmac.tx_pn[0];
+               params.seq = seq;
+               params.seq_len = 6;
+               break;
        }
 
        params.key = key->conf.key;
@@ -304,6 +318,22 @@ static int ieee80211_config_default_key(struct wiphy *wiphy,
        return 0;
 }
 
+static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy,
+                                            struct net_device *dev,
+                                            u8 key_idx)
+{
+       struct ieee80211_sub_if_data *sdata;
+
+       rcu_read_lock();
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+       ieee80211_set_default_mgmt_key(sdata, key_idx);
+
+       rcu_read_unlock();
+
+       return 0;
+}
+
 static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
 {
        struct ieee80211_sub_if_data *sdata = sta->sdata;
@@ -493,7 +523,8 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
 
        kfree(old);
 
-       return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
+       return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON |
+                                         IEEE80211_IFCC_BEACON_ENABLED);
 }
 
 static int ieee80211_add_beacon(struct wiphy *wiphy, struct net_device *dev,
@@ -553,7 +584,7 @@ static int ieee80211_del_beacon(struct wiphy *wiphy, struct net_device *dev)
        synchronize_rcu();
        kfree(old);
 
-       return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
+       return ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON_ENABLED);
 }
 
 /* Layer 2 Update frame (802.2 Type 1 LLC XID Update response) */
@@ -630,6 +661,10 @@ static void sta_apply_parameters(struct ieee80211_local *local,
                sta->flags &= ~WLAN_STA_WME;
                if (params->station_flags & STATION_FLAG_WME)
                        sta->flags |= WLAN_STA_WME;
+
+               sta->flags &= ~WLAN_STA_MFP;
+               if (params->station_flags & STATION_FLAG_MFP)
+                       sta->flags |= WLAN_STA_MFP;
                spin_unlock_bh(&sta->lock);
        }
 
@@ -1141,6 +1176,126 @@ static int ieee80211_set_channel(struct wiphy *wiphy,
        return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL);
 }
 
+static int set_mgmt_extra_ie_sta(struct ieee80211_sub_if_data *sdata,
+                                u8 subtype, u8 *ies, size_t ies_len)
+{
+       struct ieee80211_local *local = sdata->local;
+       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+
+       switch (subtype) {
+       case IEEE80211_STYPE_PROBE_REQ >> 4:
+               if (local->ops->hw_scan)
+                       break;
+               kfree(ifsta->ie_probereq);
+               ifsta->ie_probereq = ies;
+               ifsta->ie_probereq_len = ies_len;
+               return 0;
+       case IEEE80211_STYPE_PROBE_RESP >> 4:
+               kfree(ifsta->ie_proberesp);
+               ifsta->ie_proberesp = ies;
+               ifsta->ie_proberesp_len = ies_len;
+               return 0;
+       case IEEE80211_STYPE_AUTH >> 4:
+               kfree(ifsta->ie_auth);
+               ifsta->ie_auth = ies;
+               ifsta->ie_auth_len = ies_len;
+               return 0;
+       case IEEE80211_STYPE_ASSOC_REQ >> 4:
+               kfree(ifsta->ie_assocreq);
+               ifsta->ie_assocreq = ies;
+               ifsta->ie_assocreq_len = ies_len;
+               return 0;
+       case IEEE80211_STYPE_REASSOC_REQ >> 4:
+               kfree(ifsta->ie_reassocreq);
+               ifsta->ie_reassocreq = ies;
+               ifsta->ie_reassocreq_len = ies_len;
+               return 0;
+       case IEEE80211_STYPE_DEAUTH >> 4:
+               kfree(ifsta->ie_deauth);
+               ifsta->ie_deauth = ies;
+               ifsta->ie_deauth_len = ies_len;
+               return 0;
+       case IEEE80211_STYPE_DISASSOC >> 4:
+               kfree(ifsta->ie_disassoc);
+               ifsta->ie_disassoc = ies;
+               ifsta->ie_disassoc_len = ies_len;
+               return 0;
+       }
+
+       return -EOPNOTSUPP;
+}
+
+static int ieee80211_set_mgmt_extra_ie(struct wiphy *wiphy,
+                                      struct net_device *dev,
+                                      struct mgmt_extra_ie_params *params)
+{
+       struct ieee80211_sub_if_data *sdata;
+       u8 *ies;
+       size_t ies_len;
+       int ret = -EOPNOTSUPP;
+
+       if (params->ies) {
+               ies = kmemdup(params->ies, params->ies_len, GFP_KERNEL);
+               if (ies == NULL)
+                       return -ENOMEM;
+               ies_len = params->ies_len;
+       } else {
+               ies = NULL;
+               ies_len = 0;
+       }
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+       switch (sdata->vif.type) {
+       case NL80211_IFTYPE_STATION:
+       case NL80211_IFTYPE_ADHOC:
+               ret = set_mgmt_extra_ie_sta(sdata, params->subtype,
+                                           ies, ies_len);
+               break;
+       default:
+               ret = -EOPNOTSUPP;
+               break;
+       }
+
+       if (ret)
+               kfree(ies);
+       return ret;
+}
+
+#ifdef CONFIG_PM
+static int ieee80211_suspend(struct wiphy *wiphy)
+{
+       return __ieee80211_suspend(wiphy_priv(wiphy));
+}
+
+static int ieee80211_resume(struct wiphy *wiphy)
+{
+       return __ieee80211_resume(wiphy_priv(wiphy));
+}
+#else
+#define ieee80211_suspend NULL
+#define ieee80211_resume NULL
+#endif
+
+static int ieee80211_scan(struct wiphy *wiphy,
+                         struct net_device *dev,
+                         struct cfg80211_scan_request *req)
+{
+       struct ieee80211_sub_if_data *sdata;
+
+       if (!netif_running(dev))
+               return -ENETDOWN;
+
+       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+
+       if (sdata->vif.type != NL80211_IFTYPE_STATION &&
+           sdata->vif.type != NL80211_IFTYPE_ADHOC &&
+           sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
+               return -EOPNOTSUPP;
+
+       return ieee80211_request_scan(sdata, req);
+}
+
 struct cfg80211_ops mac80211_config_ops = {
        .add_virtual_intf = ieee80211_add_iface,
        .del_virtual_intf = ieee80211_del_iface,
@@ -1149,6 +1304,7 @@ struct cfg80211_ops mac80211_config_ops = {
        .del_key = ieee80211_del_key,
        .get_key = ieee80211_get_key,
        .set_default_key = ieee80211_config_default_key,
+       .set_default_mgmt_key = ieee80211_config_default_mgmt_key,
        .add_beacon = ieee80211_add_beacon,
        .set_beacon = ieee80211_set_beacon,
        .del_beacon = ieee80211_del_beacon,
@@ -1169,4 +1325,8 @@ struct cfg80211_ops mac80211_config_ops = {
        .change_bss = ieee80211_change_bss,
        .set_txq_params = ieee80211_set_txq_params,
        .set_channel = ieee80211_set_channel,
+       .set_mgmt_extra_ie = ieee80211_set_mgmt_extra_ie,
+       .suspend = ieee80211_suspend,
+       .resume = ieee80211_resume,
+       .scan = ieee80211_scan,
 };
index 2697a2fe608f60978d521acdcb0d90d5ff9ae5b4..e37f557de3f33e5178ccaeb9fdc0f01689b8fc29 100644 (file)
@@ -57,11 +57,62 @@ DEBUGFS_READONLY_FILE(long_retry_limit, 20, "%d",
                      local->hw.conf.long_frame_max_tx_count);
 DEBUGFS_READONLY_FILE(total_ps_buffered, 20, "%d",
                      local->total_ps_buffered);
-DEBUGFS_READONLY_FILE(wep_iv, 20, "%#06x",
+DEBUGFS_READONLY_FILE(wep_iv, 20, "%#08x",
                      local->wep_iv & 0xffffff);
 DEBUGFS_READONLY_FILE(rate_ctrl_alg, 100, "%s",
                      local->rate_ctrl ? local->rate_ctrl->ops->name : "<unset>");
 
+static ssize_t tsf_read(struct file *file, char __user *user_buf,
+                            size_t count, loff_t *ppos)
+{
+       struct ieee80211_local *local = file->private_data;
+       u64 tsf = 0;
+       char buf[100];
+
+       if (local->ops->get_tsf)
+               tsf = local->ops->get_tsf(local_to_hw(local));
+
+       snprintf(buf, sizeof(buf), "0x%016llx\n", (unsigned long long) tsf);
+
+       return simple_read_from_buffer(user_buf, count, ppos, buf, 19);
+}
+
+static ssize_t tsf_write(struct file *file,
+                         const char __user *user_buf,
+                         size_t count, loff_t *ppos)
+{
+       struct ieee80211_local *local = file->private_data;
+       unsigned long long tsf;
+       char buf[100];
+       size_t len;
+
+       len = min(count, sizeof(buf) - 1);
+       if (copy_from_user(buf, user_buf, len))
+               return -EFAULT;
+       buf[len] = '\0';
+
+       if (strncmp(buf, "reset", 5) == 0) {
+               if (local->ops->reset_tsf) {
+                       local->ops->reset_tsf(local_to_hw(local));
+                       printk(KERN_INFO "%s: debugfs reset TSF\n", wiphy_name(local->hw.wiphy));
+               }
+       } else {
+               tsf = simple_strtoul(buf, NULL, 0);
+               if (local->ops->set_tsf) {
+                       local->ops->set_tsf(local_to_hw(local), tsf);
+                       printk(KERN_INFO "%s: debugfs set TSF to %#018llx\n", wiphy_name(local->hw.wiphy), tsf);
+               }
+       }
+
+       return count;
+}
+
+static const struct file_operations tsf_ops = {
+       .read = tsf_read,
+       .write = tsf_write,
+       .open = mac80211_open_file_generic
+};
+
 /* statistics stuff */
 
 #define DEBUGFS_STATS_FILE(name, buflen, fmt, value...)                        \
@@ -136,8 +187,6 @@ DEBUGFS_STATS_FILE(multicast_received_frame_count, 20, "%u",
                   local->dot11MulticastReceivedFrameCount);
 DEBUGFS_STATS_FILE(transmitted_frame_count, 20, "%u",
                   local->dot11TransmittedFrameCount);
-DEBUGFS_STATS_FILE(wep_undecryptable_count, 20, "%u",
-                  local->dot11WEPUndecryptableCount);
 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
 DEBUGFS_STATS_FILE(tx_handlers_drop, 20, "%u",
                   local->tx_handlers_drop);
@@ -204,6 +253,7 @@ void debugfs_hw_add(struct ieee80211_local *local)
        DEBUGFS_ADD(long_retry_limit);
        DEBUGFS_ADD(total_ps_buffered);
        DEBUGFS_ADD(wep_iv);
+       DEBUGFS_ADD(tsf);
 
        statsd = debugfs_create_dir("statistics", phyd);
        local->debugfs.statistics = statsd;
@@ -221,7 +271,6 @@ void debugfs_hw_add(struct ieee80211_local *local)
        DEBUGFS_STATS_ADD(received_fragment_count);
        DEBUGFS_STATS_ADD(multicast_received_frame_count);
        DEBUGFS_STATS_ADD(transmitted_frame_count);
-       DEBUGFS_STATS_ADD(wep_undecryptable_count);
 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
        DEBUGFS_STATS_ADD(tx_handlers_drop);
        DEBUGFS_STATS_ADD(tx_handlers_queued);
@@ -258,6 +307,7 @@ void debugfs_hw_del(struct ieee80211_local *local)
        DEBUGFS_DEL(long_retry_limit);
        DEBUGFS_DEL(total_ps_buffered);
        DEBUGFS_DEL(wep_iv);
+       DEBUGFS_DEL(tsf);
 
        DEBUGFS_STATS_DEL(transmitted_fragment_count);
        DEBUGFS_STATS_DEL(multicast_transmitted_frame_count);
@@ -268,7 +318,6 @@ void debugfs_hw_del(struct ieee80211_local *local)
        DEBUGFS_STATS_DEL(received_fragment_count);
        DEBUGFS_STATS_DEL(multicast_received_frame_count);
        DEBUGFS_STATS_DEL(transmitted_frame_count);
-       DEBUGFS_STATS_DEL(wep_undecryptable_count);
        DEBUGFS_STATS_DEL(num_scans);
 #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
        DEBUGFS_STATS_DEL(tx_handlers_drop);
index 6424ac565ae0e1760697e626c2a875c295f472a4..99c752588b30ef58c4d1a18f242c7f9906d230af 100644 (file)
@@ -76,6 +76,9 @@ static ssize_t key_algorithm_read(struct file *file,
        case ALG_CCMP:
                alg = "CCMP\n";
                break;
+       case ALG_AES_CMAC:
+               alg = "AES-128-CMAC\n";
+               break;
        default:
                return 0;
        }
@@ -105,6 +108,12 @@ static ssize_t key_tx_spec_read(struct file *file, char __user *userbuf,
                len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
                                tpn[0], tpn[1], tpn[2], tpn[3], tpn[4], tpn[5]);
                break;
+       case ALG_AES_CMAC:
+               tpn = key->u.aes_cmac.tx_pn;
+               len = scnprintf(buf, sizeof(buf), "%02x%02x%02x%02x%02x%02x\n",
+                               tpn[0], tpn[1], tpn[2], tpn[3], tpn[4],
+                               tpn[5]);
+               break;
        default:
                return 0;
        }
@@ -142,6 +151,14 @@ static ssize_t key_rx_spec_read(struct file *file, char __user *userbuf,
                }
                len = p - buf;
                break;
+       case ALG_AES_CMAC:
+               rpn = key->u.aes_cmac.rx_pn;
+               p += scnprintf(p, sizeof(buf)+buf-p,
+                              "%02x%02x%02x%02x%02x%02x\n",
+                              rpn[0], rpn[1], rpn[2],
+                              rpn[3], rpn[4], rpn[5]);
+               len = p - buf;
+               break;
        default:
                return 0;
        }
@@ -156,13 +173,40 @@ static ssize_t key_replays_read(struct file *file, char __user *userbuf,
        char buf[20];
        int len;
 
-       if (key->conf.alg != ALG_CCMP)
+       switch (key->conf.alg) {
+       case ALG_CCMP:
+               len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays);
+               break;
+       case ALG_AES_CMAC:
+               len = scnprintf(buf, sizeof(buf), "%u\n",
+                               key->u.aes_cmac.replays);
+               break;
+       default:
                return 0;
-       len = scnprintf(buf, sizeof(buf), "%u\n", key->u.ccmp.replays);
+       }
        return simple_read_from_buffer(userbuf, count, ppos, buf, len);
 }
 KEY_OPS(replays);
 
+static ssize_t key_icverrors_read(struct file *file, char __user *userbuf,
+                                 size_t count, loff_t *ppos)
+{
+       struct ieee80211_key *key = file->private_data;
+       char buf[20];
+       int len;
+
+       switch (key->conf.alg) {
+       case ALG_AES_CMAC:
+               len = scnprintf(buf, sizeof(buf), "%u\n",
+                               key->u.aes_cmac.icverrors);
+               break;
+       default:
+               return 0;
+       }
+       return simple_read_from_buffer(userbuf, count, ppos, buf, len);
+}
+KEY_OPS(icverrors);
+
 static ssize_t key_key_read(struct file *file, char __user *userbuf,
                            size_t count, loff_t *ppos)
 {
@@ -222,6 +266,7 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key)
        DEBUGFS_ADD(tx_spec);
        DEBUGFS_ADD(rx_spec);
        DEBUGFS_ADD(replays);
+       DEBUGFS_ADD(icverrors);
        DEBUGFS_ADD(key);
        DEBUGFS_ADD(ifindex);
 };
@@ -243,6 +288,7 @@ void ieee80211_debugfs_key_remove(struct ieee80211_key *key)
        DEBUGFS_DEL(tx_spec);
        DEBUGFS_DEL(rx_spec);
        DEBUGFS_DEL(replays);
+       DEBUGFS_DEL(icverrors);
        DEBUGFS_DEL(key);
        DEBUGFS_DEL(ifindex);
 
@@ -280,6 +326,35 @@ void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata)
        sdata->common_debugfs.default_key = NULL;
 }
 
+void ieee80211_debugfs_key_add_mgmt_default(struct ieee80211_sub_if_data *sdata)
+{
+       char buf[50];
+       struct ieee80211_key *key;
+
+       if (!sdata->debugfsdir)
+               return;
+
+       /* this is running under the key lock */
+
+       key = sdata->default_mgmt_key;
+       if (key) {
+               sprintf(buf, "../keys/%d", key->debugfs.cnt);
+               sdata->common_debugfs.default_mgmt_key =
+                       debugfs_create_symlink("default_mgmt_key",
+                                              sdata->debugfsdir, buf);
+       } else
+               ieee80211_debugfs_key_remove_mgmt_default(sdata);
+}
+
+void ieee80211_debugfs_key_remove_mgmt_default(struct ieee80211_sub_if_data *sdata)
+{
+       if (!sdata)
+               return;
+
+       debugfs_remove(sdata->common_debugfs.default_mgmt_key);
+       sdata->common_debugfs.default_mgmt_key = NULL;
+}
+
 void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
                                   struct sta_info *sta)
 {
index b1a3754ee240525d6301046f73265593436dc0f4..54717b4e1371b352dc1bed514ab3c74954fd7538 100644 (file)
@@ -6,6 +6,10 @@ void ieee80211_debugfs_key_add(struct ieee80211_key *key);
 void ieee80211_debugfs_key_remove(struct ieee80211_key *key);
 void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata);
 void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata);
+void ieee80211_debugfs_key_add_mgmt_default(
+       struct ieee80211_sub_if_data *sdata);
+void ieee80211_debugfs_key_remove_mgmt_default(
+       struct ieee80211_sub_if_data *sdata);
 void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
                                   struct sta_info *sta);
 #else
@@ -19,6 +23,12 @@ static inline void ieee80211_debugfs_key_add_default(
 static inline void ieee80211_debugfs_key_remove_default(
        struct ieee80211_sub_if_data *sdata)
 {}
+static inline void ieee80211_debugfs_key_add_mgmt_default(
+       struct ieee80211_sub_if_data *sdata)
+{}
+static inline void ieee80211_debugfs_key_remove_mgmt_default(
+       struct ieee80211_sub_if_data *sdata)
+{}
 static inline void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key,
                                                 struct sta_info *sta)
 {}
index a2fbe0131312dcf23dda4b2ce8600af246f462f7..90230c718b5bb62b77f6b76fa6285e04d3a1a22f 100644 (file)
@@ -67,14 +67,15 @@ static ssize_t sta_flags_read(struct file *file, char __user *userbuf,
        char buf[100];
        struct sta_info *sta = file->private_data;
        u32 staflags = get_sta_flags(sta);
-       int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s",
+       int res = scnprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s%s",
                staflags & WLAN_STA_AUTH ? "AUTH\n" : "",
                staflags & WLAN_STA_ASSOC ? "ASSOC\n" : "",
                staflags & WLAN_STA_PS ? "PS\n" : "",
                staflags & WLAN_STA_AUTHORIZED ? "AUTHORIZED\n" : "",
                staflags & WLAN_STA_SHORT_PREAMBLE ? "SHORT PREAMBLE\n" : "",
                staflags & WLAN_STA_WME ? "WME\n" : "",
-               staflags & WLAN_STA_WDS ? "WDS\n" : "");
+               staflags & WLAN_STA_WDS ? "WDS\n" : "",
+               staflags & WLAN_STA_MFP ? "MFP\n" : "");
        return simple_read_from_buffer(userbuf, count, ppos, buf, res);
 }
 STA_OPS(flags);
index c5c0c5271096ca7ae3369c2d99b0eeafe34bd413..82ea0b63a386dad2e2ad7151b151b1138edfb843 100644 (file)
@@ -17,8 +17,6 @@
 #include <net/wireless.h>
 #include <net/mac80211.h>
 #include "ieee80211_i.h"
-#include "sta_info.h"
-#include "wme.h"
 
 void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband,
                                       struct ieee80211_ht_cap *ht_cap_ie,
@@ -130,14 +128,15 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
                }
        }
 
-       ht_changed = local->hw.conf.ht.enabled != enable_ht ||
-                    channel_type != local->hw.conf.ht.channel_type;
+       ht_changed = conf_is_ht(&local->hw.conf) != enable_ht ||
+                    channel_type != local->hw.conf.channel_type;
 
        local->oper_channel_type = channel_type;
-       local->hw.conf.ht.enabled = enable_ht;
 
-       if (ht_changed)
-               ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_HT);
+       if (ht_changed) {
+                /* channel_type change automatically detected */
+               ieee80211_hw_config(local, 0);
+        }
 
        /* disable HT */
        if (!enable_ht)
@@ -154,105 +153,20 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
        return changed;
 }
 
-static void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata,
-                                        const u8 *da, u16 tid,
-                                        u8 dialog_token, u16 start_seq_num,
-                                        u16 agg_size, u16 timeout)
+void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta)
 {
-       struct ieee80211_local *local = sdata->local;
-       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
-       struct sk_buff *skb;
-       struct ieee80211_mgmt *mgmt;
-       u16 capab;
-
-       skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
-
-       if (!skb) {
-               printk(KERN_ERR "%s: failed to allocate buffer "
-                               "for addba request frame\n", sdata->dev->name);
-               return;
-       }
-       skb_reserve(skb, local->hw.extra_tx_headroom);
-       mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
-       memset(mgmt, 0, 24);
-       memcpy(mgmt->da, da, ETH_ALEN);
-       memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
-       if (sdata->vif.type == NL80211_IFTYPE_AP)
-               memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
-       else
-               memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
-
-       mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
-                                         IEEE80211_STYPE_ACTION);
-
-       skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_req));
-
-       mgmt->u.action.category = WLAN_CATEGORY_BACK;
-       mgmt->u.action.u.addba_req.action_code = WLAN_ACTION_ADDBA_REQ;
-
-       mgmt->u.action.u.addba_req.dialog_token = dialog_token;
-       capab = (u16)(1 << 1);          /* bit 1 aggregation policy */
-       capab |= (u16)(tid << 2);       /* bit 5:2 TID number */
-       capab |= (u16)(agg_size << 6);  /* bit 15:6 max size of aggergation */
-
-       mgmt->u.action.u.addba_req.capab = cpu_to_le16(capab);
-
-       mgmt->u.action.u.addba_req.timeout = cpu_to_le16(timeout);
-       mgmt->u.action.u.addba_req.start_seq_num =
-                                       cpu_to_le16(start_seq_num << 4);
-
-       ieee80211_tx_skb(sdata, skb, 0);
-}
-
-static void ieee80211_send_addba_resp(struct ieee80211_sub_if_data *sdata, u8 *da, u16 tid,
-                                     u8 dialog_token, u16 status, u16 policy,
-                                     u16 buf_size, u16 timeout)
-{
-       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
-       struct ieee80211_local *local = sdata->local;
-       struct sk_buff *skb;
-       struct ieee80211_mgmt *mgmt;
-       u16 capab;
-
-       skb = dev_alloc_skb(sizeof(*mgmt) + local->hw.extra_tx_headroom);
+       int i;
 
-       if (!skb) {
-               printk(KERN_DEBUG "%s: failed to allocate buffer "
-                      "for addba resp frame\n", sdata->dev->name);
-               return;
+       for (i = 0; i <  STA_TID_NUM; i++) {
+               __ieee80211_stop_tx_ba_session(sta, i, WLAN_BACK_INITIATOR);
+               __ieee80211_stop_rx_ba_session(sta, i, WLAN_BACK_RECIPIENT,
+                                              WLAN_REASON_QSTA_LEAVE_QBSS);
        }
-
-       skb_reserve(skb, local->hw.extra_tx_headroom);
-       mgmt = (struct ieee80211_mgmt *) skb_put(skb, 24);
-       memset(mgmt, 0, 24);
-       memcpy(mgmt->da, da, ETH_ALEN);
-       memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
-       if (sdata->vif.type == NL80211_IFTYPE_AP)
-               memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
-       else
-               memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
-       mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
-                                         IEEE80211_STYPE_ACTION);
-
-       skb_put(skb, 1 + sizeof(mgmt->u.action.u.addba_resp));
-       mgmt->u.action.category = WLAN_CATEGORY_BACK;
-       mgmt->u.action.u.addba_resp.action_code = WLAN_ACTION_ADDBA_RESP;
-       mgmt->u.action.u.addba_resp.dialog_token = dialog_token;
-
-       capab = (u16)(policy << 1);     /* bit 1 aggregation policy */
-       capab |= (u16)(tid << 2);       /* bit 5:2 TID number */
-       capab |= (u16)(buf_size << 6);  /* bit 15:6 max size of aggregation */
-
-       mgmt->u.action.u.addba_resp.capab = cpu_to_le16(capab);
-       mgmt->u.action.u.addba_resp.timeout = cpu_to_le16(timeout);
-       mgmt->u.action.u.addba_resp.status = cpu_to_le16(status);
-
-       ieee80211_tx_skb(sdata, skb, 0);
 }
 
-static void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
-                                const u8 *da, u16 tid,
-                                u16 initiator, u16 reason_code)
+void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
+                         const u8 *da, u16 tid,
+                         u16 initiator, u16 reason_code)
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_if_sta *ifsta = &sdata->u.sta;
@@ -273,7 +187,8 @@ static void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
        memset(mgmt, 0, 24);
        memcpy(mgmt->da, da, ETH_ALEN);
        memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
-       if (sdata->vif.type == NL80211_IFTYPE_AP)
+       if (sdata->vif.type == NL80211_IFTYPE_AP ||
+           sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
                memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN);
        else
                memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
@@ -290,770 +205,7 @@ static void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
        mgmt->u.action.u.delba.params = cpu_to_le16(params);
        mgmt->u.action.u.delba.reason_code = cpu_to_le16(reason_code);
 
-       ieee80211_tx_skb(sdata, skb, 0);
-}
-
-void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn)
-{
-       struct ieee80211_local *local = sdata->local;
-       struct sk_buff *skb;
-       struct ieee80211_bar *bar;
-       u16 bar_control = 0;
-
-       skb = dev_alloc_skb(sizeof(*bar) + local->hw.extra_tx_headroom);
-       if (!skb) {
-               printk(KERN_ERR "%s: failed to allocate buffer for "
-                       "bar frame\n", sdata->dev->name);
-               return;
-       }
-       skb_reserve(skb, local->hw.extra_tx_headroom);
-       bar = (struct ieee80211_bar *)skb_put(skb, sizeof(*bar));
-       memset(bar, 0, sizeof(*bar));
-       bar->frame_control = cpu_to_le16(IEEE80211_FTYPE_CTL |
-                                        IEEE80211_STYPE_BACK_REQ);
-       memcpy(bar->ra, ra, ETH_ALEN);
-       memcpy(bar->ta, sdata->dev->dev_addr, ETH_ALEN);
-       bar_control |= (u16)IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL;
-       bar_control |= (u16)IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA;
-       bar_control |= (u16)(tid << 12);
-       bar->control = cpu_to_le16(bar_control);
-       bar->start_seq_num = cpu_to_le16(ssn);
-
-       ieee80211_tx_skb(sdata, skb, 0);
-}
-
-void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid,
-                                       u16 initiator, u16 reason)
-{
-       struct ieee80211_local *local = sdata->local;
-       struct ieee80211_hw *hw = &local->hw;
-       struct sta_info *sta;
-       int ret, i;
-
-       rcu_read_lock();
-
-       sta = sta_info_get(local, ra);
-       if (!sta) {
-               rcu_read_unlock();
-               return;
-       }
-
-       /* check if TID is in operational state */
-       spin_lock_bh(&sta->lock);
-       if (sta->ampdu_mlme.tid_state_rx[tid]
-                               != HT_AGG_STATE_OPERATIONAL) {
-               spin_unlock_bh(&sta->lock);
-               rcu_read_unlock();
-               return;
-       }
-       sta->ampdu_mlme.tid_state_rx[tid] =
-               HT_AGG_STATE_REQ_STOP_BA_MSK |
-               (initiator << HT_AGG_STATE_INITIATOR_SHIFT);
-       spin_unlock_bh(&sta->lock);
-
-       /* stop HW Rx aggregation. ampdu_action existence
-        * already verified in session init so we add the BUG_ON */
-       BUG_ON(!local->ops->ampdu_action);
-
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Rx BA session stop requested for %pM tid %u\n",
-              ra, tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-
-       ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_STOP,
-                                      &sta->sta, tid, NULL);
-       if (ret)
-               printk(KERN_DEBUG "HW problem - can not stop rx "
-                               "aggregation for tid %d\n", tid);
-
-       /* shutdown timer has not expired */
-       if (initiator != WLAN_BACK_TIMER)
-               del_timer_sync(&sta->ampdu_mlme.tid_rx[tid]->session_timer);
-
-       /* check if this is a self generated aggregation halt */
-       if (initiator == WLAN_BACK_RECIPIENT || initiator == WLAN_BACK_TIMER)
-               ieee80211_send_delba(sdata, ra, tid, 0, reason);
-
-       /* free the reordering buffer */
-       for (i = 0; i < sta->ampdu_mlme.tid_rx[tid]->buf_size; i++) {
-               if (sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i]) {
-                       /* release the reordered frames */
-                       dev_kfree_skb(sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i]);
-                       sta->ampdu_mlme.tid_rx[tid]->stored_mpdu_num--;
-                       sta->ampdu_mlme.tid_rx[tid]->reorder_buf[i] = NULL;
-               }
-       }
-       /* free resources */
-       kfree(sta->ampdu_mlme.tid_rx[tid]->reorder_buf);
-       kfree(sta->ampdu_mlme.tid_rx[tid]);
-       sta->ampdu_mlme.tid_rx[tid] = NULL;
-       sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_IDLE;
-
-       rcu_read_unlock();
-}
-
-
-/*
- * After sending add Block Ack request we activated a timer until
- * add Block Ack response will arrive from the recipient.
- * If this timer expires sta_addba_resp_timer_expired will be executed.
- */
-static void sta_addba_resp_timer_expired(unsigned long data)
-{
-       /* not an elegant detour, but there is no choice as the timer passes
-        * only one argument, and both sta_info and TID are needed, so init
-        * flow in sta_info_create gives the TID as data, while the timer_to_id
-        * array gives the sta through container_of */
-       u16 tid = *(u8 *)data;
-       struct sta_info *temp_sta = container_of((void *)data,
-               struct sta_info, timer_to_tid[tid]);
-
-       struct ieee80211_local *local = temp_sta->local;
-       struct ieee80211_hw *hw = &local->hw;
-       struct sta_info *sta;
-       u8 *state;
-
-       rcu_read_lock();
-
-       sta = sta_info_get(local, temp_sta->sta.addr);
-       if (!sta) {
-               rcu_read_unlock();
-               return;
-       }
-
-       state = &sta->ampdu_mlme.tid_state_tx[tid];
-       /* check if the TID waits for addBA response */
-       spin_lock_bh(&sta->lock);
-       if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
-               spin_unlock_bh(&sta->lock);
-               *state = HT_AGG_STATE_IDLE;
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "timer expired on tid %d but we are not "
-                               "expecting addBA response there", tid);
-#endif
-               goto timer_expired_exit;
-       }
-
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "addBA response timer expired on tid %d\n", tid);
-#endif
-
-       /* go through the state check in stop_BA_session */
-       *state = HT_AGG_STATE_OPERATIONAL;
-       spin_unlock_bh(&sta->lock);
-       ieee80211_stop_tx_ba_session(hw, temp_sta->sta.addr, tid,
-                                    WLAN_BACK_INITIATOR);
-
-timer_expired_exit:
-       rcu_read_unlock();
-}
-
-void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr)
-{
-       struct ieee80211_local *local = sdata->local;
-       int i;
-
-       for (i = 0; i <  STA_TID_NUM; i++) {
-               ieee80211_stop_tx_ba_session(&local->hw, addr, i,
-                                            WLAN_BACK_INITIATOR);
-               ieee80211_sta_stop_rx_ba_session(sdata, addr, i,
-                                                WLAN_BACK_RECIPIENT,
-                                                WLAN_REASON_QSTA_LEAVE_QBSS);
-       }
-}
-
-int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
-{
-       struct ieee80211_local *local = hw_to_local(hw);
-       struct sta_info *sta;
-       struct ieee80211_sub_if_data *sdata;
-       u16 start_seq_num;
-       u8 *state;
-       int ret = 0;
-
-       if ((tid >= STA_TID_NUM) || !(hw->flags & IEEE80211_HW_AMPDU_AGGREGATION))
-               return -EINVAL;
-
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Open BA session requested for %pM tid %u\n",
-              ra, tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-
-       rcu_read_lock();
-
-       sta = sta_info_get(local, ra);
-       if (!sta) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Could not find the station\n");
-#endif
-               ret = -ENOENT;
-               goto exit;
-       }
-
-       spin_lock_bh(&sta->lock);
-
-       /* we have tried too many times, receiver does not want A-MPDU */
-       if (sta->ampdu_mlme.addba_req_num[tid] > HT_AGG_MAX_RETRIES) {
-               ret = -EBUSY;
-               goto err_unlock_sta;
-       }
-
-       state = &sta->ampdu_mlme.tid_state_tx[tid];
-       /* check if the TID is not in aggregation flow already */
-       if (*state != HT_AGG_STATE_IDLE) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "BA request denied - session is not "
-                                "idle on tid %u\n", tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-               ret = -EAGAIN;
-               goto err_unlock_sta;
-       }
-
-       /* prepare A-MPDU MLME for Tx aggregation */
-       sta->ampdu_mlme.tid_tx[tid] =
-                       kmalloc(sizeof(struct tid_ampdu_tx), GFP_ATOMIC);
-       if (!sta->ampdu_mlme.tid_tx[tid]) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               if (net_ratelimit())
-                       printk(KERN_ERR "allocate tx mlme to tid %d failed\n",
-                                       tid);
-#endif
-               ret = -ENOMEM;
-               goto err_unlock_sta;
-       }
-       /* Tx timer */
-       sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.function =
-                       sta_addba_resp_timer_expired;
-       sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.data =
-                       (unsigned long)&sta->timer_to_tid[tid];
-       init_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
-
-       if (hw->ampdu_queues) {
-               /* create a new queue for this aggregation */
-               ret = ieee80211_ht_agg_queue_add(local, sta, tid);
-
-               /* case no queue is available to aggregation
-                * don't switch to aggregation */
-               if (ret) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-                       printk(KERN_DEBUG "BA request denied - "
-                              "queue unavailable for tid %d\n", tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-                       goto err_unlock_queue;
-               }
-       }
-       sdata = sta->sdata;
-
-       /* Ok, the Addba frame hasn't been sent yet, but if the driver calls the
-        * call back right away, it must see that the flow has begun */
-       *state |= HT_ADDBA_REQUESTED_MSK;
-
-       /* This is slightly racy because the queue isn't stopped */
-       start_seq_num = sta->tid_seq[tid];
-
-       if (local->ops->ampdu_action)
-               ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_START,
-                                              &sta->sta, tid, &start_seq_num);
-
-       if (ret) {
-               /* No need to requeue the packets in the agg queue, since we
-                * held the tx lock: no packet could be enqueued to the newly
-                * allocated queue */
-               if (hw->ampdu_queues)
-                       ieee80211_ht_agg_queue_remove(local, sta, tid, 0);
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "BA request denied - HW unavailable for"
-                                       " tid %d\n", tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-               *state = HT_AGG_STATE_IDLE;
-               goto err_unlock_queue;
-       }
-
-       /* Will put all the packets in the new SW queue */
-       if (hw->ampdu_queues)
-               ieee80211_requeue(local, ieee802_1d_to_ac[tid]);
-       spin_unlock_bh(&sta->lock);
-
-       /* send an addBA request */
-       sta->ampdu_mlme.dialog_token_allocator++;
-       sta->ampdu_mlme.tid_tx[tid]->dialog_token =
-                       sta->ampdu_mlme.dialog_token_allocator;
-       sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num;
-
-
-       ieee80211_send_addba_request(sta->sdata, ra, tid,
-                        sta->ampdu_mlme.tid_tx[tid]->dialog_token,
-                        sta->ampdu_mlme.tid_tx[tid]->ssn,
-                        0x40, 5000);
-       /* activate the timer for the recipient's addBA response */
-       sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer.expires =
-                               jiffies + ADDBA_RESP_INTERVAL;
-       add_timer(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid);
-#endif
-       goto exit;
-
-err_unlock_queue:
-       kfree(sta->ampdu_mlme.tid_tx[tid]);
-       sta->ampdu_mlme.tid_tx[tid] = NULL;
-       ret = -EBUSY;
-err_unlock_sta:
-       spin_unlock_bh(&sta->lock);
-exit:
-       rcu_read_unlock();
-       return ret;
-}
-EXPORT_SYMBOL(ieee80211_start_tx_ba_session);
-
-int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw,
-                                u8 *ra, u16 tid,
-                                enum ieee80211_back_parties initiator)
-{
-       struct ieee80211_local *local = hw_to_local(hw);
-       struct sta_info *sta;
-       u8 *state;
-       int ret = 0;
-
-       if (tid >= STA_TID_NUM)
-               return -EINVAL;
-
-       rcu_read_lock();
-       sta = sta_info_get(local, ra);
-       if (!sta) {
-               rcu_read_unlock();
-               return -ENOENT;
-       }
-
-       /* check if the TID is in aggregation */
-       state = &sta->ampdu_mlme.tid_state_tx[tid];
-       spin_lock_bh(&sta->lock);
-
-       if (*state != HT_AGG_STATE_OPERATIONAL) {
-               ret = -ENOENT;
-               goto stop_BA_exit;
-       }
-
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Tx BA session stop requested for %pM tid %u\n",
-              ra, tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-
-       if (hw->ampdu_queues)
-               ieee80211_stop_queue(hw, sta->tid_to_tx_q[tid]);
-
-       *state = HT_AGG_STATE_REQ_STOP_BA_MSK |
-               (initiator << HT_AGG_STATE_INITIATOR_SHIFT);
-
-       if (local->ops->ampdu_action)
-               ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_STOP,
-                                              &sta->sta, tid, NULL);
-
-       /* case HW denied going back to legacy */
-       if (ret) {
-               WARN_ON(ret != -EBUSY);
-               *state = HT_AGG_STATE_OPERATIONAL;
-               if (hw->ampdu_queues)
-                       ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
-               goto stop_BA_exit;
-       }
-
-stop_BA_exit:
-       spin_unlock_bh(&sta->lock);
-       rcu_read_unlock();
-       return ret;
-}
-EXPORT_SYMBOL(ieee80211_stop_tx_ba_session);
-
-void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid)
-{
-       struct ieee80211_local *local = hw_to_local(hw);
-       struct sta_info *sta;
-       u8 *state;
-
-       if (tid >= STA_TID_NUM) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
-                               tid, STA_TID_NUM);
-#endif
-               return;
-       }
-
-       rcu_read_lock();
-       sta = sta_info_get(local, ra);
-       if (!sta) {
-               rcu_read_unlock();
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Could not find station: %pM\n", ra);
-#endif
-               return;
-       }
-
-       state = &sta->ampdu_mlme.tid_state_tx[tid];
-       spin_lock_bh(&sta->lock);
-
-       if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "addBA was not requested yet, state is %d\n",
-                               *state);
-#endif
-               spin_unlock_bh(&sta->lock);
-               rcu_read_unlock();
-               return;
-       }
-
-       WARN_ON_ONCE(*state & HT_ADDBA_DRV_READY_MSK);
-
-       *state |= HT_ADDBA_DRV_READY_MSK;
-
-       if (*state == HT_AGG_STATE_OPERATIONAL) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid);
-#endif
-               if (hw->ampdu_queues)
-                       ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
-       }
-       spin_unlock_bh(&sta->lock);
-       rcu_read_unlock();
-}
-EXPORT_SYMBOL(ieee80211_start_tx_ba_cb);
-
-void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
-{
-       struct ieee80211_local *local = hw_to_local(hw);
-       struct sta_info *sta;
-       u8 *state;
-       int agg_queue;
-
-       if (tid >= STA_TID_NUM) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n",
-                               tid, STA_TID_NUM);
-#endif
-               return;
-       }
-
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Stopping Tx BA session for %pM tid %d\n",
-              ra, tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-
-       rcu_read_lock();
-       sta = sta_info_get(local, ra);
-       if (!sta) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Could not find station: %pM\n", ra);
-#endif
-               rcu_read_unlock();
-               return;
-       }
-       state = &sta->ampdu_mlme.tid_state_tx[tid];
-
-       /* NOTE: no need to use sta->lock in this state check, as
-        * ieee80211_stop_tx_ba_session will let only one stop call to
-        * pass through per sta/tid
-        */
-       if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n");
-#endif
-               rcu_read_unlock();
-               return;
-       }
-
-       if (*state & HT_AGG_STATE_INITIATOR_MSK)
-               ieee80211_send_delba(sta->sdata, ra, tid,
-                       WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE);
-
-       if (hw->ampdu_queues) {
-               agg_queue = sta->tid_to_tx_q[tid];
-               ieee80211_ht_agg_queue_remove(local, sta, tid, 1);
-
-               /* We just requeued the all the frames that were in the
-                * removed queue, and since we might miss a softirq we do
-                * netif_schedule_queue.  ieee80211_wake_queue is not used
-                * here as this queue is not necessarily stopped
-                */
-               netif_schedule_queue(netdev_get_tx_queue(local->mdev,
-                                                        agg_queue));
-       }
-       spin_lock_bh(&sta->lock);
-       *state = HT_AGG_STATE_IDLE;
-       sta->ampdu_mlme.addba_req_num[tid] = 0;
-       kfree(sta->ampdu_mlme.tid_tx[tid]);
-       sta->ampdu_mlme.tid_tx[tid] = NULL;
-       spin_unlock_bh(&sta->lock);
-
-       rcu_read_unlock();
-}
-EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb);
-
-void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
-                                     const u8 *ra, u16 tid)
-{
-       struct ieee80211_local *local = hw_to_local(hw);
-       struct ieee80211_ra_tid *ra_tid;
-       struct sk_buff *skb = dev_alloc_skb(0);
-
-       if (unlikely(!skb)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               if (net_ratelimit())
-                       printk(KERN_WARNING "%s: Not enough memory, "
-                              "dropping start BA session", skb->dev->name);
-#endif
-               return;
-       }
-       ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
-       memcpy(&ra_tid->ra, ra, ETH_ALEN);
-       ra_tid->tid = tid;
-
-       skb->pkt_type = IEEE80211_ADDBA_MSG;
-       skb_queue_tail(&local->skb_queue, skb);
-       tasklet_schedule(&local->tasklet);
-}
-EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe);
-
-void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw,
-                                    const u8 *ra, u16 tid)
-{
-       struct ieee80211_local *local = hw_to_local(hw);
-       struct ieee80211_ra_tid *ra_tid;
-       struct sk_buff *skb = dev_alloc_skb(0);
-
-       if (unlikely(!skb)) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               if (net_ratelimit())
-                       printk(KERN_WARNING "%s: Not enough memory, "
-                              "dropping stop BA session", skb->dev->name);
-#endif
-               return;
-       }
-       ra_tid = (struct ieee80211_ra_tid *) &skb->cb;
-       memcpy(&ra_tid->ra, ra, ETH_ALEN);
-       ra_tid->tid = tid;
-
-       skb->pkt_type = IEEE80211_DELBA_MSG;
-       skb_queue_tail(&local->skb_queue, skb);
-       tasklet_schedule(&local->tasklet);
-}
-EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe);
-
-/*
- * After accepting the AddBA Request we activated a timer,
- * resetting it after each frame that arrives from the originator.
- * if this timer expires ieee80211_sta_stop_rx_ba_session will be executed.
- */
-static void sta_rx_agg_session_timer_expired(unsigned long data)
-{
-       /* not an elegant detour, but there is no choice as the timer passes
-        * only one argument, and various sta_info are needed here, so init
-        * flow in sta_info_create gives the TID as data, while the timer_to_id
-        * array gives the sta through container_of */
-       u8 *ptid = (u8 *)data;
-       u8 *timer_to_id = ptid - *ptid;
-       struct sta_info *sta = container_of(timer_to_id, struct sta_info,
-                                        timer_to_tid[0]);
-
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "rx session timer expired on tid %d\n", (u16)*ptid);
-#endif
-       ieee80211_sta_stop_rx_ba_session(sta->sdata, sta->sta.addr,
-                                        (u16)*ptid, WLAN_BACK_TIMER,
-                                        WLAN_REASON_QSTA_TIMEOUT);
-}
-
-void ieee80211_process_addba_request(struct ieee80211_local *local,
-                                    struct sta_info *sta,
-                                    struct ieee80211_mgmt *mgmt,
-                                    size_t len)
-{
-       struct ieee80211_hw *hw = &local->hw;
-       struct ieee80211_conf *conf = &hw->conf;
-       struct tid_ampdu_rx *tid_agg_rx;
-       u16 capab, tid, timeout, ba_policy, buf_size, start_seq_num, status;
-       u8 dialog_token;
-       int ret = -EOPNOTSUPP;
-
-       /* extract session parameters from addba request frame */
-       dialog_token = mgmt->u.action.u.addba_req.dialog_token;
-       timeout = le16_to_cpu(mgmt->u.action.u.addba_req.timeout);
-       start_seq_num =
-               le16_to_cpu(mgmt->u.action.u.addba_req.start_seq_num) >> 4;
-
-       capab = le16_to_cpu(mgmt->u.action.u.addba_req.capab);
-       ba_policy = (capab & IEEE80211_ADDBA_PARAM_POLICY_MASK) >> 1;
-       tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
-       buf_size = (capab & IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK) >> 6;
-
-       status = WLAN_STATUS_REQUEST_DECLINED;
-
-       /* sanity check for incoming parameters:
-        * check if configuration can support the BA policy
-        * and if buffer size does not exceeds max value */
-       /* XXX: check own ht delayed BA capability?? */
-       if (((ba_policy != 1)
-               && (!(sta->sta.ht_cap.cap & IEEE80211_HT_CAP_DELAY_BA)))
-               || (buf_size > IEEE80211_MAX_AMPDU_BUF)) {
-               status = WLAN_STATUS_INVALID_QOS_PARAM;
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               if (net_ratelimit())
-                       printk(KERN_DEBUG "AddBA Req with bad params from "
-                               "%pM on tid %u. policy %d, buffer size %d\n",
-                               mgmt->sa, tid, ba_policy,
-                               buf_size);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-               goto end_no_lock;
-       }
-       /* determine default buffer size */
-       if (buf_size == 0) {
-               struct ieee80211_supported_band *sband;
-
-               sband = local->hw.wiphy->bands[conf->channel->band];
-               buf_size = IEEE80211_MIN_AMPDU_BUF;
-               buf_size = buf_size << sband->ht_cap.ampdu_factor;
-       }
-
-
-       /* examine state machine */
-       spin_lock_bh(&sta->lock);
-
-       if (sta->ampdu_mlme.tid_state_rx[tid] != HT_AGG_STATE_IDLE) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               if (net_ratelimit())
-                       printk(KERN_DEBUG "unexpected AddBA Req from "
-                               "%pM on tid %u\n",
-                               mgmt->sa, tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-               goto end;
-       }
-
-       /* prepare A-MPDU MLME for Rx aggregation */
-       sta->ampdu_mlme.tid_rx[tid] =
-                       kmalloc(sizeof(struct tid_ampdu_rx), GFP_ATOMIC);
-       if (!sta->ampdu_mlme.tid_rx[tid]) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               if (net_ratelimit())
-                       printk(KERN_ERR "allocate rx mlme to tid %d failed\n",
-                                       tid);
-#endif
-               goto end;
-       }
-       /* rx timer */
-       sta->ampdu_mlme.tid_rx[tid]->session_timer.function =
-                               sta_rx_agg_session_timer_expired;
-       sta->ampdu_mlme.tid_rx[tid]->session_timer.data =
-                               (unsigned long)&sta->timer_to_tid[tid];
-       init_timer(&sta->ampdu_mlme.tid_rx[tid]->session_timer);
-
-       tid_agg_rx = sta->ampdu_mlme.tid_rx[tid];
-
-       /* prepare reordering buffer */
-       tid_agg_rx->reorder_buf =
-               kmalloc(buf_size * sizeof(struct sk_buff *), GFP_ATOMIC);
-       if (!tid_agg_rx->reorder_buf) {
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               if (net_ratelimit())
-                       printk(KERN_ERR "can not allocate reordering buffer "
-                              "to tid %d\n", tid);
-#endif
-               kfree(sta->ampdu_mlme.tid_rx[tid]);
-               goto end;
-       }
-       memset(tid_agg_rx->reorder_buf, 0,
-               buf_size * sizeof(struct sk_buff *));
-
-       if (local->ops->ampdu_action)
-               ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_RX_START,
-                                              &sta->sta, tid, &start_seq_num);
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "Rx A-MPDU request on tid %d result %d\n", tid, ret);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-
-       if (ret) {
-               kfree(tid_agg_rx->reorder_buf);
-               kfree(tid_agg_rx);
-               sta->ampdu_mlme.tid_rx[tid] = NULL;
-               goto end;
-       }
-
-       /* change state and send addba resp */
-       sta->ampdu_mlme.tid_state_rx[tid] = HT_AGG_STATE_OPERATIONAL;
-       tid_agg_rx->dialog_token = dialog_token;
-       tid_agg_rx->ssn = start_seq_num;
-       tid_agg_rx->head_seq_num = start_seq_num;
-       tid_agg_rx->buf_size = buf_size;
-       tid_agg_rx->timeout = timeout;
-       tid_agg_rx->stored_mpdu_num = 0;
-       status = WLAN_STATUS_SUCCESS;
-end:
-       spin_unlock_bh(&sta->lock);
-
-end_no_lock:
-       ieee80211_send_addba_resp(sta->sdata, sta->sta.addr, tid,
-                                 dialog_token, status, 1, buf_size, timeout);
-}
-
-void ieee80211_process_addba_resp(struct ieee80211_local *local,
-                                 struct sta_info *sta,
-                                 struct ieee80211_mgmt *mgmt,
-                                 size_t len)
-{
-       struct ieee80211_hw *hw = &local->hw;
-       u16 capab;
-       u16 tid, start_seq_num;
-       u8 *state;
-
-       capab = le16_to_cpu(mgmt->u.action.u.addba_resp.capab);
-       tid = (capab & IEEE80211_ADDBA_PARAM_TID_MASK) >> 2;
-
-       state = &sta->ampdu_mlme.tid_state_tx[tid];
-
-       spin_lock_bh(&sta->lock);
-
-       if (!(*state & HT_ADDBA_REQUESTED_MSK)) {
-               spin_unlock_bh(&sta->lock);
-               return;
-       }
-
-       if (mgmt->u.action.u.addba_resp.dialog_token !=
-               sta->ampdu_mlme.tid_tx[tid]->dialog_token) {
-               spin_unlock_bh(&sta->lock);
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "wrong addBA response token, tid %d\n", tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-               return;
-       }
-
-       del_timer_sync(&sta->ampdu_mlme.tid_tx[tid]->addba_resp_timer);
-#ifdef CONFIG_MAC80211_HT_DEBUG
-       printk(KERN_DEBUG "switched off addBA timer for tid %d \n", tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-       if (le16_to_cpu(mgmt->u.action.u.addba_resp.status)
-                       == WLAN_STATUS_SUCCESS) {
-               *state |= HT_ADDBA_RECEIVED_MSK;
-               sta->ampdu_mlme.addba_req_num[tid] = 0;
-
-               if (*state == HT_AGG_STATE_OPERATIONAL &&
-                   local->hw.ampdu_queues)
-                       ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]);
-
-               if (local->ops->ampdu_action) {
-                       (void)local->ops->ampdu_action(hw,
-                                              IEEE80211_AMPDU_TX_RESUME,
-                                              &sta->sta, tid, &start_seq_num);
-               }
-#ifdef CONFIG_MAC80211_HT_DEBUG
-               printk(KERN_DEBUG "Resuming TX aggregation for tid %d\n", tid);
-#endif /* CONFIG_MAC80211_HT_DEBUG */
-               spin_unlock_bh(&sta->lock);
-       } else {
-               sta->ampdu_mlme.addba_req_num[tid]++;
-               /* this will allow the state check in stop_BA_session */
-               *state = HT_AGG_STATE_OPERATIONAL;
-               spin_unlock_bh(&sta->lock);
-               ieee80211_stop_tx_ba_session(hw, sta->sta.addr, tid,
-                                            WLAN_BACK_INITIATOR);
-       }
+       ieee80211_tx_skb(sdata, skb, 1);
 }
 
 void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
index f3eec989662bebb2523d4df393f608546308cc94..2cb743ed9f9c715dc830bc5a96357346fdaa5176 100644 (file)
@@ -43,7 +43,7 @@ struct ieee80211_local;
 
 /* Required encryption head and tailroom */
 #define IEEE80211_ENCRYPT_HEADROOM 8
-#define IEEE80211_ENCRYPT_TAILROOM 12
+#define IEEE80211_ENCRYPT_TAILROOM 18
 
 /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
  * reception of at least three fragmented frames. This limit can be increased
@@ -57,6 +57,8 @@ struct ieee80211_local;
  */
 #define IEEE80211_SCAN_RESULT_EXPIRE (10 * HZ)
 
+#define TU_TO_EXP_TIME(x)      (jiffies + usecs_to_jiffies((x) * 1024))
+
 struct ieee80211_fragment_entry {
        unsigned long first_frag_time;
        unsigned int seq;
@@ -70,43 +72,36 @@ struct ieee80211_fragment_entry {
 
 
 struct ieee80211_bss {
-       struct list_head list;
-       struct ieee80211_bss *hnext;
-       size_t ssid_len;
+       /* Yes, this is a hack */
+       struct cfg80211_bss cbss;
 
-       atomic_t users;
-
-       u8 bssid[ETH_ALEN];
+       /* don't want to look up all the time */
+       size_t ssid_len;
        u8 ssid[IEEE80211_MAX_SSID_LEN];
+
        u8 dtim_period;
-       u16 capability; /* host byte order */
-       enum ieee80211_band band;
-       int freq;
-       int signal, noise, qual;
-       u8 *ies; /* all information elements from the last Beacon or Probe
-                 * Response frames; note Beacon frame is not allowed to
-                 * override values from Probe Response */
-       size_t ies_len;
+
        bool wmm_used;
+
+       unsigned long last_probe_resp;
+
 #ifdef CONFIG_MAC80211_MESH
        u8 *mesh_id;
        size_t mesh_id_len;
        u8 *mesh_cfg;
 #endif
+
 #define IEEE80211_MAX_SUPP_RATES 32
        u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
        size_t supp_rates_len;
-       u64 timestamp;
-       int beacon_int;
 
-       unsigned long last_probe_resp;
-       unsigned long last_update;
-
-       /* during assocation, we save an ERP value from a probe response so
+       /*
+        * During assocation, we save an ERP value from a probe response so
         * that we can feed ERP info to the driver when handling the
         * association completes. these fields probably won't be up-to-date
-        * otherwise, you probably don't want to use them. */
-       int has_erp_value;
+        * otherwise, you probably don't want to use them.
+        */
+       bool has_erp_value;
        u8 erp_value;
 };
 
@@ -258,6 +253,9 @@ struct mesh_preq_queue {
 #define IEEE80211_STA_AUTO_BSSID_SEL   BIT(11)
 #define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)
 #define IEEE80211_STA_PRIVACY_INVOKED  BIT(13)
+#define IEEE80211_STA_TKIP_WEP_USED    BIT(14)
+#define IEEE80211_STA_CSA_RECEIVED     BIT(15)
+#define IEEE80211_STA_MFP_ENABLED      BIT(16)
 /* flags for MLME request */
 #define IEEE80211_STA_REQ_SCAN 0
 #define IEEE80211_STA_REQ_DIRECT_PROBE 1
@@ -282,13 +280,13 @@ enum ieee80211_sta_mlme_state {
 
 struct ieee80211_if_sta {
        struct timer_list timer;
+       struct timer_list chswitch_timer;
        struct work_struct work;
+       struct work_struct chswitch_work;
        u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN];
        u8 ssid[IEEE80211_MAX_SSID_LEN];
        enum ieee80211_sta_mlme_state state;
        size_t ssid_len;
-       u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
-       size_t scan_ssid_len;
        u16 aid;
        u16 ap_capab, capab;
        u8 *extra_ie; /* to be added to the end of AssocReq */
@@ -315,11 +313,33 @@ struct ieee80211_if_sta {
        int auth_alg; /* currently used IEEE 802.11 authentication algorithm */
        int auth_transaction;
 
+       enum {
+               IEEE80211_MFP_DISABLED,
+               IEEE80211_MFP_OPTIONAL,
+               IEEE80211_MFP_REQUIRED
+       } mfp; /* management frame protection */
+
        unsigned long ibss_join_req;
        struct sk_buff *probe_resp; /* ProbeResp template for IBSS */
        u32 supp_rates_bits[IEEE80211_NUM_BANDS];
 
        int wmm_last_param_set;
+
+       /* Extra IE data for management frames */
+       u8 *ie_probereq;
+       size_t ie_probereq_len;
+       u8 *ie_proberesp;
+       size_t ie_proberesp_len;
+       u8 *ie_auth;
+       size_t ie_auth_len;
+       u8 *ie_assocreq;
+       size_t ie_assocreq_len;
+       u8 *ie_reassocreq;
+       size_t ie_reassocreq_len;
+       u8 *ie_deauth;
+       size_t ie_deauth_len;
+       u8 *ie_disassoc;
+       size_t ie_disassoc_len;
 };
 
 struct ieee80211_if_mesh {
@@ -404,8 +424,10 @@ struct ieee80211_sub_if_data {
        unsigned int fragment_next;
 
 #define NUM_DEFAULT_KEYS 4
-       struct ieee80211_key *keys[NUM_DEFAULT_KEYS];
+#define NUM_DEFAULT_MGMT_KEYS 2
+       struct ieee80211_key *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
        struct ieee80211_key *default_key;
+       struct ieee80211_key *default_mgmt_key;
 
        u16 sequence_number;
 
@@ -477,6 +499,7 @@ struct ieee80211_sub_if_data {
        } debugfs;
        struct {
                struct dentry *default_key;
+               struct dentry *default_mgmt_key;
        } common_debugfs;
 
 #ifdef CONFIG_MAC80211_MESH
@@ -541,6 +564,7 @@ enum {
 enum queue_stop_reason {
        IEEE80211_QUEUE_STOP_REASON_DRIVER,
        IEEE80211_QUEUE_STOP_REASON_PS,
+       IEEE80211_QUEUE_STOP_REASON_CSA
 };
 
 /* maximum number of hardware queues we support. */
@@ -568,7 +592,6 @@ struct ieee80211_local {
        int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss;
        unsigned int filter_flags; /* FIF_* */
        struct iw_statistics wstats;
-       u8 wstats_flags;
        bool tim_in_locked_section; /* see ieee80211_beacon_get() */
        int tx_headroom; /* required headroom for hardware/radiotap */
 
@@ -612,7 +635,9 @@ struct ieee80211_local {
        struct crypto_blkcipher *wep_rx_tfm;
        u32 wep_iv;
 
+       /* see iface.c */
        struct list_head interfaces;
+       struct mutex iflist_mtx;
 
        /*
         * Key lock, protects sdata's key_list and sta_info's
@@ -623,20 +648,18 @@ struct ieee80211_local {
 
        /* Scanning and BSS list */
        bool sw_scanning, hw_scanning;
+       struct cfg80211_ssid scan_ssid;
+       struct cfg80211_scan_request int_scan_req;
+       struct cfg80211_scan_request *scan_req;
+       struct ieee80211_channel *scan_channel;
        int scan_channel_idx;
-       enum ieee80211_band scan_band;
 
        enum { SCAN_SET_CHANNEL, SCAN_SEND_PROBE } scan_state;
        unsigned long last_scan_completed;
        struct delayed_work scan_work;
        struct ieee80211_sub_if_data *scan_sdata;
-       struct ieee80211_channel *oper_channel, *scan_channel;
        enum nl80211_channel_type oper_channel_type;
-       u8 scan_ssid[IEEE80211_MAX_SSID_LEN];
-       size_t scan_ssid_len;
-       struct list_head bss_list;
-       struct ieee80211_bss *bss_hash[STA_HASH_SIZE];
-       spinlock_t bss_lock;
+       struct ieee80211_channel *oper_channel, *csa_channel;
 
        /* SNMP counters */
        /* dot11CountersTable */
@@ -649,7 +672,6 @@ struct ieee80211_local {
        u32 dot11ReceivedFragmentCount;
        u32 dot11MulticastReceivedFrameCount;
        u32 dot11TransmittedFrameCount;
-       u32 dot11WEPUndecryptableCount;
 
 #ifdef CONFIG_MAC80211_LEDS
        int tx_led_counter, rx_led_counter;
@@ -696,11 +718,14 @@ struct ieee80211_local {
        unsigned int wmm_acm; /* bit field of ACM bits (BIT(802.1D tag)) */
 
        bool powersave;
-       int dynamic_ps_timeout;
+       bool pspolling;
        struct work_struct dynamic_ps_enable_work;
        struct work_struct dynamic_ps_disable_work;
        struct timer_list dynamic_ps_timer;
 
+       int user_power_level; /* in dBm */
+       int power_constr_level; /* in dBm */
+
 #ifdef CONFIG_MAC80211_DEBUGFS
        struct local_debugfsdentries {
                struct dentry *rcdir;
@@ -712,6 +737,7 @@ struct ieee80211_local {
                struct dentry *long_retry_limit;
                struct dentry *total_ps_buffered;
                struct dentry *wep_iv;
+               struct dentry *tsf;
                struct dentry *statistics;
                struct local_debugfsdentries_statsdentries {
                        struct dentry *transmitted_fragment_count;
@@ -805,6 +831,7 @@ struct ieee802_11_elems {
        u8 *country_elem;
        u8 *pwr_constr_elem;
        u8 *quiet_elem;         /* first quite element */
+       u8 *timeout_int;
 
        /* length of them, respectively */
        u8 ssid_len;
@@ -832,6 +859,7 @@ struct ieee802_11_elems {
        u8 pwr_constr_elem_len;
        u8 quiet_elem_len;
        u8 num_of_quiet_elem;   /* can be more the one */
+       u8 timeout_int_len;
 };
 
 static inline struct ieee80211_local *hw_to_local(
@@ -875,19 +903,21 @@ int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
 void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata,
                            struct ieee80211_if_sta *ifsta);
 struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
-                                       u8 *bssid, u8 *addr, u64 supp_rates);
+                                       u8 *bssid, u8 *addr, u32 supp_rates);
 int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason);
 int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason);
 u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
-u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
+u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
                            struct ieee802_11_elems *elems,
                            enum ieee80211_band band);
 void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
                              u8 *ssid, size_t ssid_len);
+void ieee80211_send_pspoll(struct ieee80211_local *local,
+                          struct ieee80211_sub_if_data *sdata);
 
 /* scan/BSS handling */
 int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
-                          u8 *ssid, size_t ssid_len);
+                          struct cfg80211_scan_request *req);
 int ieee80211_scan_results(struct ieee80211_local *local,
                           struct iw_request_info *info,
                           char *buf, size_t len);
@@ -895,29 +925,27 @@ ieee80211_rx_result
 ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata,
                  struct sk_buff *skb,
                  struct ieee80211_rx_status *rx_status);
-void ieee80211_rx_bss_list_init(struct ieee80211_local *local);
-void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local);
 int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata,
                               char *ie, size_t len);
 
 void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
 int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
-                        u8 *ssid, size_t ssid_len);
+                        struct cfg80211_scan_request *req);
 struct ieee80211_bss *
 ieee80211_bss_info_update(struct ieee80211_local *local,
                          struct ieee80211_rx_status *rx_status,
                          struct ieee80211_mgmt *mgmt,
                          size_t len,
                          struct ieee802_11_elems *elems,
-                         int freq, bool beacon);
-struct ieee80211_bss *
-ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq,
-                    u8 *ssid, u8 ssid_len);
+                         struct ieee80211_channel *channel,
+                         bool beacon);
 struct ieee80211_bss *
 ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
                     u8 *ssid, u8 ssid_len);
 void ieee80211_rx_bss_put(struct ieee80211_local *local,
                          struct ieee80211_bss *bss);
+void ieee80211_rx_bss_remove(struct ieee80211_sub_if_data *sdata, u8 *bssid,
+                            int freq, u8 *ssid, u8 ssid_len);
 
 /* interface handling */
 int ieee80211_if_add(struct ieee80211_local *local, const char *name,
@@ -943,10 +971,15 @@ u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
                        struct ieee80211_ht_info *hti,
                        u16 ap_ht_cap_flags);
 void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn);
+void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
+                         const u8 *da, u16 tid,
+                         u16 initiator, u16 reason_code);
 
 void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da,
                                u16 tid, u16 initiator, u16 reason);
-void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr);
+void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
+                                   u16 initiator, u16 reason);
+void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta);
 void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
                             struct sta_info *sta,
                             struct ieee80211_mgmt *mgmt, size_t len);
@@ -959,10 +992,25 @@ void ieee80211_process_addba_request(struct ieee80211_local *local,
                                     struct ieee80211_mgmt *mgmt,
                                     size_t len);
 
+int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
+                                  enum ieee80211_back_parties initiator);
+
 /* Spectrum management */
 void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
                                       struct ieee80211_mgmt *mgmt,
                                       size_t len);
+void ieee80211_chswitch_timer(unsigned long data);
+void ieee80211_chswitch_work(struct work_struct *work);
+void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
+                                 struct ieee80211_channel_sw_ie *sw_elem,
+                                 struct ieee80211_bss *bss);
+void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
+                                u16 capab_info, u8 *pwr_constr_elem,
+                                u8 pwr_constr_elem_len);
+
+/* Suspend/resume */
+int __ieee80211_suspend(struct ieee80211_hw *hw);
+int __ieee80211_resume(struct ieee80211_hw *hw);
 
 /* utility functions/constants */
 extern void *mac80211_wiphy_privid; /* for wiphy privid */
@@ -980,12 +1028,15 @@ void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
 void ieee802_11_parse_elems(u8 *start, size_t len,
                            struct ieee802_11_elems *elems);
 int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq);
-u64 ieee80211_mandatory_rates(struct ieee80211_local *local,
+u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
                              enum ieee80211_band band);
 
 void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
 void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
 void ieee80211_dynamic_ps_timer(unsigned long data);
+void ieee80211_send_nullfunc(struct ieee80211_local *local,
+                            struct ieee80211_sub_if_data *sdata,
+                            int powersave);
 
 void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
                                     enum queue_stop_reason reason);
index b9074824862aee74c9e6555f3d43a0cba51cd4f8..df94b936526472a5f334559b9c7c7300698fbe4d 100644 (file)
 #include "mesh.h"
 #include "led.h"
 
+/**
+ * DOC: Interface list locking
+ *
+ * The interface list in each struct ieee80211_local is protected
+ * three-fold:
+ *
+ * (1) modifications may only be done under the RTNL
+ * (2) modifications and readers are protected against each other by
+ *     the iflist_mtx.
+ * (3) modifications are done in an RCU manner so atomic readers
+ *     can traverse the list in RCU-safe blocks.
+ *
+ * As a consequence, reads (traversals) of the list can be protected
+ * by either the RTNL, the iflist_mtx or RCU.
+ */
+
+
 static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
 {
        int meshhdrlen;
@@ -345,8 +362,7 @@ static int ieee80211_stop(struct net_device *dev)
 
        list_for_each_entry_rcu(sta, &local->sta_list, list) {
                if (sta->sdata == sdata)
-                       ieee80211_sta_tear_down_BA_sessions(sdata,
-                                                           sta->sta.addr);
+                       ieee80211_sta_tear_down_BA_sessions(sta);
        }
 
        rcu_read_unlock();
@@ -383,6 +399,8 @@ static int ieee80211_stop(struct net_device *dev)
                atomic_dec(&local->iff_promiscs);
 
        dev_mc_unsync(local->mdev, dev);
+       del_timer_sync(&local->dynamic_ps_timer);
+       cancel_work_sync(&local->dynamic_ps_enable_work);
 
        /* APs need special treatment */
        if (sdata->vif.type == NL80211_IFTYPE_AP) {
@@ -441,6 +459,7 @@ static int ieee80211_stop(struct net_device *dev)
                                                WLAN_REASON_DEAUTH_LEAVING);
 
                memset(sdata->u.sta.bssid, 0, ETH_ALEN);
+               del_timer_sync(&sdata->u.sta.chswitch_timer);
                del_timer_sync(&sdata->u.sta.timer);
                /*
                 * If the timer fired while we waited for it, it will have
@@ -450,6 +469,7 @@ static int ieee80211_stop(struct net_device *dev)
                 * it no longer is.
                 */
                cancel_work_sync(&sdata->u.sta.work);
+               cancel_work_sync(&sdata->u.sta.chswitch_work);
                /*
                 * When we get here, the interface is marked down.
                 * Call synchronize_rcu() to wait for the RX path
@@ -459,7 +479,8 @@ static int ieee80211_stop(struct net_device *dev)
                synchronize_rcu();
                skb_queue_purge(&sdata->u.sta.skb_queue);
 
-               sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
+               sdata->u.sta.flags &= ~(IEEE80211_STA_PRIVACY_INVOKED |
+                                       IEEE80211_STA_TKIP_WEP_USED);
                kfree(sdata->u.sta.extra_ie);
                sdata->u.sta.extra_ie = NULL;
                sdata->u.sta.extra_ie_len = 0;
@@ -501,7 +522,7 @@ static int ieee80211_stop(struct net_device *dev)
                         * scan event to userspace -- the scan is incomplete.
                         */
                        if (local->sw_scanning)
-                               ieee80211_scan_completed(&local->hw);
+                               ieee80211_scan_completed(&local->hw, true);
                }
 
                conf.vif = &sdata->vif;
@@ -569,19 +590,6 @@ static void ieee80211_set_multicast_list(struct net_device *dev)
        dev_mc_sync(local->mdev, dev);
 }
 
-static void ieee80211_if_setup(struct net_device *dev)
-{
-       ether_setup(dev);
-       dev->hard_start_xmit = ieee80211_subif_start_xmit;
-       dev->wireless_handlers = &ieee80211_iw_handler_def;
-       dev->set_multicast_list = ieee80211_set_multicast_list;
-       dev->change_mtu = ieee80211_change_mtu;
-       dev->open = ieee80211_open;
-       dev->stop = ieee80211_stop;
-       dev->destructor = free_netdev;
-       /* we will validate the address ourselves in ->open */
-       dev->validate_addr = NULL;
-}
 /*
  * Called when the netdev is removed or, by the code below, before
  * the interface type changes.
@@ -627,6 +635,13 @@ static void ieee80211_teardown_sdata(struct net_device *dev)
                kfree(sdata->u.sta.assocreq_ies);
                kfree(sdata->u.sta.assocresp_ies);
                kfree_skb(sdata->u.sta.probe_resp);
+               kfree(sdata->u.sta.ie_probereq);
+               kfree(sdata->u.sta.ie_proberesp);
+               kfree(sdata->u.sta.ie_auth);
+               kfree(sdata->u.sta.ie_assocreq);
+               kfree(sdata->u.sta.ie_reassocreq);
+               kfree(sdata->u.sta.ie_deauth);
+               kfree(sdata->u.sta.ie_disassoc);
                break;
        case NL80211_IFTYPE_WDS:
        case NL80211_IFTYPE_AP_VLAN:
@@ -642,6 +657,34 @@ static void ieee80211_teardown_sdata(struct net_device *dev)
        WARN_ON(flushed);
 }
 
+static const struct net_device_ops ieee80211_dataif_ops = {
+       .ndo_open               = ieee80211_open,
+       .ndo_stop               = ieee80211_stop,
+       .ndo_uninit             = ieee80211_teardown_sdata,
+       .ndo_start_xmit         = ieee80211_subif_start_xmit,
+       .ndo_set_multicast_list = ieee80211_set_multicast_list,
+       .ndo_change_mtu         = ieee80211_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+};
+
+static const struct net_device_ops ieee80211_monitorif_ops = {
+       .ndo_open               = ieee80211_open,
+       .ndo_stop               = ieee80211_stop,
+       .ndo_uninit             = ieee80211_teardown_sdata,
+       .ndo_start_xmit         = ieee80211_monitor_start_xmit,
+       .ndo_set_multicast_list = ieee80211_set_multicast_list,
+       .ndo_change_mtu         = ieee80211_change_mtu,
+       .ndo_set_mac_address    = eth_mac_addr,
+};
+
+static void ieee80211_if_setup(struct net_device *dev)
+{
+       ether_setup(dev);
+       dev->netdev_ops = &ieee80211_dataif_ops;
+       dev->wireless_handlers = &ieee80211_iw_handler_def;
+       dev->destructor = free_netdev;
+}
+
 /*
  * Helper function to initialise an interface to a specific type.
  */
@@ -653,7 +696,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
 
        /* and set some type-dependent values */
        sdata->vif.type = type;
-       sdata->dev->hard_start_xmit = ieee80211_subif_start_xmit;
+       sdata->dev->netdev_ops = &ieee80211_dataif_ops;
        sdata->wdev.iftype = type;
 
        /* only monitor differs */
@@ -674,7 +717,7 @@ static void ieee80211_setup_sdata(struct ieee80211_sub_if_data *sdata,
                break;
        case NL80211_IFTYPE_MONITOR:
                sdata->dev->type = ARPHRD_IEEE80211_RADIOTAP;
-               sdata->dev->hard_start_xmit = ieee80211_monitor_start_xmit;
+               sdata->dev->netdev_ops = &ieee80211_monitorif_ops;
                sdata->u.mntr_flags = MONITOR_FLAG_CONTROL |
                                      MONITOR_FLAG_OTHER_BSS;
                break;
@@ -780,15 +823,15 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
        if (ret)
                goto fail;
 
-       ndev->uninit = ieee80211_teardown_sdata;
-
        if (ieee80211_vif_is_mesh(&sdata->vif) &&
            params && params->mesh_id_len)
                ieee80211_sdata_set_mesh_id(sdata,
                                            params->mesh_id_len,
                                            params->mesh_id);
 
+       mutex_lock(&local->iflist_mtx);
        list_add_tail_rcu(&sdata->list, &local->interfaces);
+       mutex_unlock(&local->iflist_mtx);
 
        if (new_dev)
                *new_dev = ndev;
@@ -804,7 +847,10 @@ void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)
 {
        ASSERT_RTNL();
 
+       mutex_lock(&sdata->local->iflist_mtx);
        list_del_rcu(&sdata->list);
+       mutex_unlock(&sdata->local->iflist_mtx);
+
        synchronize_rcu();
        unregister_netdevice(sdata->dev);
 }
@@ -820,7 +866,16 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local)
        ASSERT_RTNL();
 
        list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
+               /*
+                * we cannot hold the iflist_mtx across unregister_netdevice,
+                * but we only need to hold it for list modifications to lock
+                * out readers since we're under the RTNL here as all other
+                * writers.
+                */
+               mutex_lock(&local->iflist_mtx);
                list_del(&sdata->list);
+               mutex_unlock(&local->iflist_mtx);
+
                unregister_netdevice(sdata->dev);
        }
 }
index 999f7aa423267a33c525ee5693244f0c67070a30..19b480de4bbcbfa498f1d520ca9db8f798d26cce 100644 (file)
@@ -18,6 +18,7 @@
 #include "ieee80211_i.h"
 #include "debugfs_key.h"
 #include "aes_ccm.h"
+#include "aes_cmac.h"
 
 
 /**
@@ -47,7 +48,6 @@
  */
 
 static const u8 bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
-static const u8 zero_addr[ETH_ALEN];
 
 /* key mutex: used to synchronise todo runners */
 static DEFINE_MUTEX(key_mutex);
@@ -108,29 +108,18 @@ static void assert_key_lock(void)
        WARN_ON(!mutex_is_locked(&key_mutex));
 }
 
-static const u8 *get_mac_for_key(struct ieee80211_key *key)
+static struct ieee80211_sta *get_sta_for_key(struct ieee80211_key *key)
 {
-       const u8 *addr = bcast_addr;
-
-       /*
-        * If we're an AP we won't ever receive frames with a non-WEP
-        * group key so we tell the driver that by using the zero MAC
-        * address to indicate a transmit-only key.
-        */
-       if (key->conf.alg != ALG_WEP &&
-           (key->sdata->vif.type == NL80211_IFTYPE_AP ||
-            key->sdata->vif.type == NL80211_IFTYPE_AP_VLAN))
-               addr = zero_addr;
-
        if (key->sta)
-               addr = key->sta->sta.addr;
+               return &key->sta->sta;
 
-       return addr;
+       return NULL;
 }
 
 static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
 {
-       const u8 *addr;
+       struct ieee80211_sub_if_data *sdata;
+       struct ieee80211_sta *sta;
        int ret;
 
        assert_key_lock();
@@ -139,11 +128,16 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
        if (!key->local->ops->set_key)
                return;
 
-       addr = get_mac_for_key(key);
+       sta = get_sta_for_key(key);
+
+       sdata = key->sdata;
+       if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+               sdata = container_of(sdata->bss,
+                                    struct ieee80211_sub_if_data,
+                                    u.ap);
 
        ret = key->local->ops->set_key(local_to_hw(key->local), SET_KEY,
-                                      key->sdata->dev->dev_addr, addr,
-                                      &key->conf);
+                                      &sdata->vif, sta, &key->conf);
 
        if (!ret) {
                spin_lock(&todo_lock);
@@ -155,12 +149,13 @@ static void ieee80211_key_enable_hw_accel(struct ieee80211_key *key)
                printk(KERN_ERR "mac80211-%s: failed to set key "
                       "(%d, %pM) to hardware (%d)\n",
                       wiphy_name(key->local->hw.wiphy),
-                      key->conf.keyidx, addr, ret);
+                      key->conf.keyidx, sta ? sta->addr : bcast_addr, ret);
 }
 
 static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
 {
-       const u8 *addr;
+       struct ieee80211_sub_if_data *sdata;
+       struct ieee80211_sta *sta;
        int ret;
 
        assert_key_lock();
@@ -176,17 +171,22 @@ static void ieee80211_key_disable_hw_accel(struct ieee80211_key *key)
        }
        spin_unlock(&todo_lock);
 
-       addr = get_mac_for_key(key);
+       sta = get_sta_for_key(key);
+       sdata = key->sdata;
+
+       if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+               sdata = container_of(sdata->bss,
+                                    struct ieee80211_sub_if_data,
+                                    u.ap);
 
        ret = key->local->ops->set_key(local_to_hw(key->local), DISABLE_KEY,
-                                      key->sdata->dev->dev_addr, addr,
-                                      &key->conf);
+                                      &sdata->vif, sta, &key->conf);
 
        if (ret)
                printk(KERN_ERR "mac80211-%s: failed to remove key "
                       "(%d, %pM) from hardware (%d)\n",
                       wiphy_name(key->local->hw.wiphy),
-                      key->conf.keyidx, addr, ret);
+                      key->conf.keyidx, sta ? sta->addr : bcast_addr, ret);
 
        spin_lock(&todo_lock);
        key->flags &= ~KEY_FLAG_UPLOADED_TO_HARDWARE;
@@ -216,13 +216,38 @@ void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx)
        spin_unlock_irqrestore(&sdata->local->key_lock, flags);
 }
 
+static void
+__ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata, int idx)
+{
+       struct ieee80211_key *key = NULL;
+
+       if (idx >= NUM_DEFAULT_KEYS &&
+           idx < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS)
+               key = sdata->keys[idx];
+
+       rcu_assign_pointer(sdata->default_mgmt_key, key);
+
+       if (key)
+               add_todo(key, KEY_FLAG_TODO_DEFMGMTKEY);
+}
+
+void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata,
+                                   int idx)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&sdata->local->key_lock, flags);
+       __ieee80211_set_default_mgmt_key(sdata, idx);
+       spin_unlock_irqrestore(&sdata->local->key_lock, flags);
+}
+
 
 static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
                                    struct sta_info *sta,
                                    struct ieee80211_key *old,
                                    struct ieee80211_key *new)
 {
-       int idx, defkey;
+       int idx, defkey, defmgmtkey;
 
        if (new)
                list_add(&new->list, &sdata->key_list);
@@ -238,13 +263,19 @@ static void __ieee80211_key_replace(struct ieee80211_sub_if_data *sdata,
                        idx = new->conf.keyidx;
 
                defkey = old && sdata->default_key == old;
+               defmgmtkey = old && sdata->default_mgmt_key == old;
 
                if (defkey && !new)
                        __ieee80211_set_default_key(sdata, -1);
+               if (defmgmtkey && !new)
+                       __ieee80211_set_default_mgmt_key(sdata, -1);
 
                rcu_assign_pointer(sdata->keys[idx], new);
                if (defkey && new)
                        __ieee80211_set_default_key(sdata, new->conf.keyidx);
+               if (defmgmtkey && new)
+                       __ieee80211_set_default_mgmt_key(sdata,
+                                                        new->conf.keyidx);
        }
 
        if (old) {
@@ -263,7 +294,7 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg,
 {
        struct ieee80211_key *key;
 
-       BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS);
+       BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS);
 
        key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL);
        if (!key)
@@ -292,6 +323,10 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg,
                key->conf.iv_len = CCMP_HDR_LEN;
                key->conf.icv_len = CCMP_MIC_LEN;
                break;
+       case ALG_AES_CMAC:
+               key->conf.iv_len = 0;
+               key->conf.icv_len = sizeof(struct ieee80211_mmie);
+               break;
        }
        memcpy(key->conf.key, key_data, key_len);
        INIT_LIST_HEAD(&key->list);
@@ -309,6 +344,19 @@ struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg,
                }
        }
 
+       if (alg == ALG_AES_CMAC) {
+               /*
+                * Initialize AES key state here as an optimization so that
+                * it does not need to be initialized for every packet.
+                */
+               key->u.aes_cmac.tfm =
+                       ieee80211_aes_cmac_key_setup(key_data);
+               if (!key->u.aes_cmac.tfm) {
+                       kfree(key);
+                       return NULL;
+               }
+       }
+
        return key;
 }
 
@@ -462,6 +510,8 @@ static void __ieee80211_key_destroy(struct ieee80211_key *key)
 
        if (key->conf.alg == ALG_CCMP)
                ieee80211_aes_key_free(key->u.ccmp.tfm);
+       if (key->conf.alg == ALG_AES_CMAC)
+               ieee80211_aes_cmac_key_free(key->u.aes_cmac.tfm);
        ieee80211_debugfs_key_remove(key);
 
        kfree(key);
@@ -484,6 +534,7 @@ static void __ieee80211_key_todo(void)
                list_del_init(&key->todo);
                todoflags = key->flags & (KEY_FLAG_TODO_ADD_DEBUGFS |
                                          KEY_FLAG_TODO_DEFKEY |
+                                         KEY_FLAG_TODO_DEFMGMTKEY |
                                          KEY_FLAG_TODO_HWACCEL_ADD |
                                          KEY_FLAG_TODO_HWACCEL_REMOVE |
                                          KEY_FLAG_TODO_DELETE);
@@ -501,6 +552,11 @@ static void __ieee80211_key_todo(void)
                        ieee80211_debugfs_key_add_default(key->sdata);
                        work_done = true;
                }
+               if (todoflags & KEY_FLAG_TODO_DEFMGMTKEY) {
+                       ieee80211_debugfs_key_remove_mgmt_default(key->sdata);
+                       ieee80211_debugfs_key_add_mgmt_default(key->sdata);
+                       work_done = true;
+               }
                if (todoflags & KEY_FLAG_TODO_HWACCEL_ADD) {
                        ieee80211_key_enable_hw_accel(key);
                        work_done = true;
@@ -536,6 +592,7 @@ void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata)
        ieee80211_key_lock();
 
        ieee80211_debugfs_key_remove_default(sdata);
+       ieee80211_debugfs_key_remove_mgmt_default(sdata);
 
        spin_lock_irqsave(&sdata->local->key_lock, flags);
        list_for_each_entry_safe(key, tmp, &sdata->key_list, list)
index 425816e0996cb27d292b759915f91eb4ce2d3e4e..215d3ef42a4f3c8a3db8017d9792caca7bddff6f 100644 (file)
@@ -46,6 +46,8 @@ struct sta_info;
  *     acceleration.
  * @KEY_FLAG_TODO_DEFKEY: Key is default key and debugfs needs to be updated.
  * @KEY_FLAG_TODO_ADD_DEBUGFS: Key needs to be added to debugfs.
+ * @KEY_FLAG_TODO_DEFMGMTKEY: Key is default management key and debugfs needs
+ *     to be updated.
  */
 enum ieee80211_internal_key_flags {
        KEY_FLAG_UPLOADED_TO_HARDWARE   = BIT(0),
@@ -54,6 +56,7 @@ enum ieee80211_internal_key_flags {
        KEY_FLAG_TODO_HWACCEL_REMOVE    = BIT(3),
        KEY_FLAG_TODO_DEFKEY            = BIT(4),
        KEY_FLAG_TODO_ADD_DEBUGFS       = BIT(5),
+       KEY_FLAG_TODO_DEFMGMTKEY        = BIT(6),
 };
 
 struct tkip_ctx {
@@ -96,6 +99,16 @@ struct ieee80211_key {
                        u8 tx_crypto_buf[6 * AES_BLOCK_LEN];
                        u8 rx_crypto_buf[6 * AES_BLOCK_LEN];
                } ccmp;
+               struct {
+                       u8 tx_pn[6];
+                       u8 rx_pn[6];
+                       struct crypto_cipher *tfm;
+                       u32 replays; /* dot11RSNAStatsCMACReplays */
+                       u32 icverrors; /* dot11RSNAStatsCMACICVErrors */
+                       /* scratch buffers for virt_to_page() (crypto API) */
+                       u8 tx_crypto_buf[2 * AES_BLOCK_LEN];
+                       u8 rx_crypto_buf[2 * AES_BLOCK_LEN];
+               } aes_cmac;
        } u;
 
        /* number of times this key has been used */
@@ -114,6 +127,7 @@ struct ieee80211_key {
                struct dentry *tx_spec;
                struct dentry *rx_spec;
                struct dentry *replays;
+               struct dentry *icverrors;
                struct dentry *key;
                struct dentry *ifindex;
                int cnt;
@@ -140,6 +154,8 @@ void ieee80211_key_link(struct ieee80211_key *key,
                        struct sta_info *sta);
 void ieee80211_key_free(struct ieee80211_key *key);
 void ieee80211_set_default_key(struct ieee80211_sub_if_data *sdata, int idx);
+void ieee80211_set_default_mgmt_key(struct ieee80211_sub_if_data *sdata,
+                                   int idx);
 void ieee80211_free_keys(struct ieee80211_sub_if_data *sdata);
 void ieee80211_enable_keys(struct ieee80211_sub_if_data *sdata);
 void ieee80211_disable_keys(struct ieee80211_sub_if_data *sdata);
index 24b14363d6e70c77766c06946ba5407de122dc89..5667f4e8067fdd4f885a507fa15a5085003f1dcd 100644 (file)
@@ -168,7 +168,6 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed)
                return 0;
 
        memset(&conf, 0, sizeof(conf));
-       conf.changed = changed;
 
        if (sdata->vif.type == NL80211_IFTYPE_STATION ||
            sdata->vif.type == NL80211_IFTYPE_ADHOC)
@@ -176,16 +175,59 @@ int ieee80211_if_config(struct ieee80211_sub_if_data *sdata, u32 changed)
        else if (sdata->vif.type == NL80211_IFTYPE_AP)
                conf.bssid = sdata->dev->dev_addr;
        else if (ieee80211_vif_is_mesh(&sdata->vif)) {
-               u8 zero[ETH_ALEN] = { 0 };
+               static const u8 zero[ETH_ALEN] = { 0 };
                conf.bssid = zero;
        } else {
                WARN_ON(1);
                return -EINVAL;
        }
 
+       switch (sdata->vif.type) {
+       case NL80211_IFTYPE_AP:
+       case NL80211_IFTYPE_ADHOC:
+       case NL80211_IFTYPE_MESH_POINT:
+               break;
+       default:
+               /* do not warn to simplify caller in scan.c */
+               changed &= ~IEEE80211_IFCC_BEACON_ENABLED;
+               if (WARN_ON(changed & IEEE80211_IFCC_BEACON))
+                       return -EINVAL;
+               changed &= ~IEEE80211_IFCC_BEACON;
+               break;
+       }
+
+       if (changed & IEEE80211_IFCC_BEACON_ENABLED) {
+               if (local->sw_scanning) {
+                       conf.enable_beacon = false;
+               } else {
+                       /*
+                        * Beacon should be enabled, but AP mode must
+                        * check whether there is a beacon configured.
+                        */
+                       switch (sdata->vif.type) {
+                       case NL80211_IFTYPE_AP:
+                               conf.enable_beacon =
+                                       !!rcu_dereference(sdata->u.ap.beacon);
+                               break;
+                       case NL80211_IFTYPE_ADHOC:
+                               conf.enable_beacon = !!sdata->u.sta.probe_resp;
+                               break;
+                       case NL80211_IFTYPE_MESH_POINT:
+                               conf.enable_beacon = true;
+                               break;
+                       default:
+                               /* not reached */
+                               WARN_ON(1);
+                               break;
+                       }
+               }
+       }
+
        if (WARN_ON(!conf.bssid && (changed & IEEE80211_IFCC_BSSID)))
                return -EINVAL;
 
+       conf.changed = changed;
+
        return local->ops->config_interface(local_to_hw(local),
                                            &sdata->vif, &conf);
 }
@@ -208,26 +250,22 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
        }
 
        if (chan != local->hw.conf.channel ||
-           channel_type != local->hw.conf.ht.channel_type) {
+           channel_type != local->hw.conf.channel_type) {
                local->hw.conf.channel = chan;
-               local->hw.conf.ht.channel_type = channel_type;
-               switch (channel_type) {
-               case NL80211_CHAN_NO_HT:
-                       local->hw.conf.ht.enabled = false;
-                       break;
-               case NL80211_CHAN_HT20:
-               case NL80211_CHAN_HT40MINUS:
-               case NL80211_CHAN_HT40PLUS:
-                       local->hw.conf.ht.enabled = true;
-                       break;
-               }
+               local->hw.conf.channel_type = channel_type;
                changed |= IEEE80211_CONF_CHANGE_CHANNEL;
        }
 
-       if (!local->hw.conf.power_level)
+       if (local->sw_scanning)
                power = chan->max_power;
        else
-               power = min(chan->max_power, local->hw.conf.power_level);
+               power = local->power_constr_level ?
+                       (chan->max_power - local->power_constr_level) :
+                       chan->max_power;
+
+       if (local->user_power_level)
+               power = min(power, local->user_power_level);
+
        if (local->hw.conf.power_level != power) {
                changed |= IEEE80211_CONF_CHANGE_POWER;
                local->hw.conf.power_level = power;
@@ -695,6 +733,10 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
                return NULL;
 
        wiphy->privid = mac80211_wiphy_privid;
+       wiphy->max_scan_ssids = 4;
+       /* Yes, putting cfg80211_bss into ieee80211_bss is a hack */
+       wiphy->bss_priv_size = sizeof(struct ieee80211_bss) -
+                              sizeof(struct cfg80211_bss);
 
        local = wiphy_priv(wiphy);
        local->hw.wiphy = wiphy;
@@ -722,6 +764,7 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
        local->hw.conf.radio_enabled = true;
 
        INIT_LIST_HEAD(&local->interfaces);
+       mutex_init(&local->iflist_mtx);
 
        spin_lock_init(&local->key_lock);
 
@@ -754,6 +797,23 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
 }
 EXPORT_SYMBOL(ieee80211_alloc_hw);
 
+static const struct net_device_ops ieee80211_master_ops = {
+       .ndo_start_xmit = ieee80211_master_start_xmit,
+       .ndo_open = ieee80211_master_open,
+       .ndo_stop = ieee80211_master_stop,
+       .ndo_set_multicast_list = ieee80211_master_set_multicast_list,
+       .ndo_select_queue = ieee80211_select_queue,
+};
+
+static void ieee80211_master_setup(struct net_device *mdev)
+{
+       mdev->type = ARPHRD_IEEE80211;
+       mdev->netdev_ops = &ieee80211_master_ops;
+       mdev->header_ops = &ieee80211_header_ops;
+       mdev->tx_queue_len = 1000;
+       mdev->addr_len = ETH_ALEN;
+}
+
 int ieee80211_register_hw(struct ieee80211_hw *hw)
 {
        struct ieee80211_local *local = hw_to_local(hw);
@@ -761,25 +821,33 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        enum ieee80211_band band;
        struct net_device *mdev;
        struct ieee80211_master_priv *mpriv;
+       int channels, i, j;
 
        /*
         * generic code guarantees at least one band,
         * set this very early because much code assumes
         * that hw.conf.channel is assigned
         */
+       channels = 0;
        for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
                struct ieee80211_supported_band *sband;
 
                sband = local->hw.wiphy->bands[band];
-               if (sband) {
+               if (sband && !local->oper_channel) {
                        /* init channel we're on */
                        local->hw.conf.channel =
                        local->oper_channel =
                        local->scan_channel = &sband->channels[0];
-                       break;
                }
+               if (sband)
+                       channels += sband->n_channels;
        }
 
+       local->int_scan_req.n_channels = channels;
+       local->int_scan_req.channels = kzalloc(sizeof(void *) * channels, GFP_KERNEL);
+       if (!local->int_scan_req.channels)
+               return -ENOMEM;
+
        /* if low-level driver supports AP, we also support VLAN */
        if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP))
                local->hw.wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
@@ -789,7 +857,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 
        result = wiphy_register(local->hw.wiphy);
        if (result < 0)
-               return result;
+               goto fail_wiphy_register;
 
        /*
         * We use the number of queues for feature tests (QoS, HT) internally
@@ -803,7 +871,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
                hw->ampdu_queues = 0;
 
        mdev = alloc_netdev_mq(sizeof(struct ieee80211_master_priv),
-                              "wmaster%d", ether_setup,
+                              "wmaster%d", ieee80211_master_setup,
                               ieee80211_num_queues(hw));
        if (!mdev)
                goto fail_mdev_alloc;
@@ -812,17 +880,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
        mpriv->local = local;
        local->mdev = mdev;
 
-       ieee80211_rx_bss_list_init(local);
-
-       mdev->hard_start_xmit = ieee80211_master_start_xmit;
-       mdev->open = ieee80211_master_open;
-       mdev->stop = ieee80211_master_stop;
-       mdev->type = ARPHRD_IEEE80211;
-       mdev->header_ops = &ieee80211_header_ops;
-       mdev->set_multicast_list = ieee80211_master_set_multicast_list;
-
        local->hw.workqueue =
-               create_freezeable_workqueue(wiphy_name(local->hw.wiphy));
+               create_singlethread_workqueue(wiphy_name(local->hw.wiphy));
        if (!local->hw.workqueue) {
                result = -ENOMEM;
                goto fail_workqueue;
@@ -846,15 +905,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 
        local->hw.conf.listen_interval = local->hw.max_listen_interval;
 
-       local->wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC |
-                                                 IEEE80211_HW_SIGNAL_DB |
-                                                 IEEE80211_HW_SIGNAL_DBM) ?
-                              IW_QUAL_QUAL_UPDATED : IW_QUAL_QUAL_INVALID;
-       local->wstats_flags |= local->hw.flags & IEEE80211_HW_NOISE_DBM ?
-                              IW_QUAL_NOISE_UPDATED : IW_QUAL_NOISE_INVALID;
-       if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
-               local->wstats_flags |= IW_QUAL_DBM;
-
        result = sta_info_start(local);
        if (result < 0)
                goto fail_sta_info;
@@ -887,8 +937,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
                goto fail_wep;
        }
 
-       local->mdev->select_queue = ieee80211_select_queue;
-
        /* add one default STA interface if supported */
        if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) {
                result = ieee80211_if_add(local, "wlan%d", NULL,
@@ -902,6 +950,20 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
 
        ieee80211_led_init(local);
 
+       /* alloc internal scan request */
+       i = 0;
+       local->int_scan_req.ssids = &local->scan_ssid;
+       local->int_scan_req.n_ssids = 1;
+       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               if (!hw->wiphy->bands[band])
+                       continue;
+               for (j = 0; j < hw->wiphy->bands[band]->n_channels; j++) {
+                       local->int_scan_req.channels[i] =
+                               &hw->wiphy->bands[band]->channels[j];
+                       i++;
+               }
+       }
+
        return 0;
 
 fail_wep:
@@ -920,6 +982,8 @@ fail_workqueue:
                free_netdev(local->mdev);
 fail_mdev_alloc:
        wiphy_unregister(local->hw.wiphy);
+fail_wiphy_register:
+       kfree(local->int_scan_req.channels);
        return result;
 }
 EXPORT_SYMBOL(ieee80211_register_hw);
@@ -947,7 +1011,6 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
 
        rtnl_unlock();
 
-       ieee80211_rx_bss_list_deinit(local);
        ieee80211_clear_tx_pending(local);
        sta_info_stop(local);
        rate_control_deinitialize(local);
@@ -965,6 +1028,7 @@ void ieee80211_unregister_hw(struct ieee80211_hw *hw)
        ieee80211_wep_free(local);
        ieee80211_led_exit(local);
        free_netdev(local->mdev);
+       kfree(local->int_scan_req.channels);
 }
 EXPORT_SYMBOL(ieee80211_unregister_hw);
 
@@ -972,6 +1036,8 @@ void ieee80211_free_hw(struct ieee80211_hw *hw)
 {
        struct ieee80211_local *local = hw_to_local(hw);
 
+       mutex_destroy(&local->iflist_mtx);
+
        wiphy_free(local->hw.wiphy);
 }
 EXPORT_SYMBOL(ieee80211_free_hw);
index 82f568e943657c2c5114ef111f57e53292011edc..9a3e5de0410a802154dbbf71fa48253d4969628c 100644 (file)
@@ -275,16 +275,6 @@ u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata, struct mesh_t
                & tbl->hash_mask;
 }
 
-u8 mesh_id_hash(u8 *mesh_id, int mesh_id_len)
-{
-       if (!mesh_id_len)
-               return 1;
-       else if (mesh_id_len == 1)
-               return (u8) mesh_id[0];
-       else
-               return (u8) (mesh_id[0] + 2 * mesh_id[1]);
-}
-
 struct mesh_table *mesh_table_alloc(int size_order)
 {
        int i;
@@ -442,7 +432,8 @@ void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
 
        ifmsh->housekeeping = true;
        queue_work(local->hw.workqueue, &ifmsh->work);
-       ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
+       ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON |
+                                  IEEE80211_IFCC_BEACON_ENABLED);
 }
 
 void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
@@ -476,7 +467,7 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_local *local = sdata->local;
        struct ieee802_11_elems elems;
        struct ieee80211_channel *channel;
-       u64 supp_rates = 0;
+       u32 supp_rates = 0;
        size_t baselen;
        int freq;
        enum ieee80211_band band = rx_status->band;
index c197ab545e54a05e56b46f946d1d2bb8e3f5e5e9..d891d7ddccd74cfcbf17b6c8adfb40936c829634 100644 (file)
  *
  *
  *
- * @MESH_PATH_ACTIVE: the mesh path is can be used for forwarding
- * @MESH_PATH_RESOLVED: the discovery process is running for this mesh path
+ * @MESH_PATH_ACTIVE: the mesh path can be used for forwarding
+ * @MESH_PATH_RESOLVING: the discovery process is running for this mesh path
  * @MESH_PATH_DSN_VALID: the mesh path contains a valid destination sequence
  *     number
  * @MESH_PATH_FIXED: the mesh path has been manually set and should not be
  *     modified
  * @MESH_PATH_RESOLVED: the mesh path can has been resolved
  *
- * MESH_PATH_RESOLVED and MESH_PATH_DELETE are used by the mesh path timer to
+ * MESH_PATH_RESOLVED is used by the mesh path timer to
  * decide when to stop or cancel the mesh path discovery.
  */
 enum mesh_path_flags {
@@ -196,7 +196,6 @@ struct mesh_rmc {
 
 /* Public interfaces */
 /* Various */
-u8 mesh_id_hash(u8 *mesh_id, int mesh_id_len);
 int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
 int ieee80211_new_mesh_header(struct ieee80211s_hdr *meshhdr,
                struct ieee80211_sub_if_data *sdata);
@@ -236,14 +235,13 @@ void mesh_rx_path_sel_frame(struct ieee80211_sub_if_data *sdata,
                struct ieee80211_mgmt *mgmt, size_t len);
 int mesh_path_add(u8 *dst, struct ieee80211_sub_if_data *sdata);
 /* Mesh plinks */
-void mesh_neighbour_update(u8 *hw_addr, u64 rates,
+void mesh_neighbour_update(u8 *hw_addr, u32 rates,
                struct ieee80211_sub_if_data *sdata, bool add);
 bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie);
 void mesh_accept_plinks_update(struct ieee80211_sub_if_data *sdata);
 void mesh_plink_broken(struct sta_info *sta);
 void mesh_plink_deactivate(struct sta_info *sta);
 int mesh_plink_open(struct sta_info *sta);
-int mesh_plink_close(struct sta_info *sta);
 void mesh_plink_block(struct sta_info *sta);
 void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata,
                         struct ieee80211_mgmt *mgmt, size_t len,
index 71fe609612303a2d9d6fc11e263845df26438256..60b35accda9147305f9213215515c509495bdf28 100644 (file)
@@ -58,7 +58,6 @@ static inline u32 u32_field_get(u8 *preq_elem, int offset, bool ae)
 #define PERR_IE_DST_ADDR(x)    (x + 2)
 #define PERR_IE_DST_DSN(x)     u32_field_get(x, 8, 0);
 
-#define TU_TO_EXP_TIME(x) (jiffies + msecs_to_jiffies(x * 1024 / 1000))
 #define MSEC_TO_TU(x) (x*1000/1024)
 #define DSN_GT(x, y) ((long) (y) - (long) (x) < 0)
 #define DSN_LT(x, y) ((long) (x) - (long) (y) < 0)
@@ -149,7 +148,7 @@ static int mesh_path_sel_frame_tx(enum mpath_frame_type action, u8 flags,
        pos += ETH_ALEN;
        memcpy(pos, &dst_dsn, 4);
 
-       ieee80211_tx_skb(sdata, skb, 0);
+       ieee80211_tx_skb(sdata, skb, 1);
        return 0;
 }
 
@@ -198,7 +197,7 @@ int mesh_path_error_tx(u8 *dst, __le32 dst_dsn, u8 *ra,
        pos += ETH_ALEN;
        memcpy(pos, &dst_dsn, 4);
 
-       ieee80211_tx_skb(sdata, skb, 0);
+       ieee80211_tx_skb(sdata, skb, 1);
        return 0;
 }
 
@@ -759,7 +758,7 @@ enddiscovery:
 }
 
 /**
- * ieee80211s_lookup_nexthop - put the appropriate next hop on a mesh frame
+ * mesh_nexthop_lookup - put the appropriate next hop on a mesh frame
  *
  * @skb: 802.11 frame to be sent
  * @sdata: network subif the frame will be sent through
index 1159bdb4119c6ecad0167b266b9fa4f8fb7b3b4a..a8bbdeca013a1b3caf8c928226b7877b88a57cf6 100644 (file)
@@ -93,7 +93,7 @@ static inline void mesh_plink_fsm_restart(struct sta_info *sta)
  *       on it in the lifecycle management section!
  */
 static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
-                                        u8 *hw_addr, u64 rates)
+                                        u8 *hw_addr, u32 rates)
 {
        struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
@@ -218,11 +218,11 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
                memcpy(pos, &reason, 2);
        }
 
-       ieee80211_tx_skb(sdata, skb, 0);
+       ieee80211_tx_skb(sdata, skb, 1);
        return 0;
 }
 
-void mesh_neighbour_update(u8 *hw_addr, u64 rates, struct ieee80211_sub_if_data *sdata,
+void mesh_neighbour_update(u8 *hw_addr, u32 rates, struct ieee80211_sub_if_data *sdata,
                           bool peer_accepting_plinks)
 {
        struct ieee80211_local *local = sdata->local;
@@ -361,36 +361,6 @@ void mesh_plink_block(struct sta_info *sta)
        spin_unlock_bh(&sta->lock);
 }
 
-int mesh_plink_close(struct sta_info *sta)
-{
-       struct ieee80211_sub_if_data *sdata = sta->sdata;
-       __le16 llid, plid, reason;
-
-       mpl_dbg("Mesh plink: closing link with %pM\n", sta->sta.addr);
-       spin_lock_bh(&sta->lock);
-       sta->reason = cpu_to_le16(MESH_LINK_CANCELLED);
-       reason = sta->reason;
-
-       if (sta->plink_state == PLINK_LISTEN ||
-           sta->plink_state == PLINK_BLOCKED) {
-               mesh_plink_fsm_restart(sta);
-               spin_unlock_bh(&sta->lock);
-               return 0;
-       } else if (sta->plink_state == PLINK_ESTAB) {
-               __mesh_plink_deactivate(sta);
-               /* The timer should not be running */
-               mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
-       } else if (!mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata)))
-               sta->ignore_plink_timer = true;
-
-       sta->plink_state = PLINK_HOLDING;
-       llid = sta->llid;
-       plid = sta->plid;
-       spin_unlock_bh(&sta->lock);
-       mesh_plink_frame_tx(sta->sdata, PLINK_CLOSE, sta->sta.addr, llid,
-                           plid, reason);
-       return 0;
-}
 
 void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt,
                         size_t len, struct ieee80211_rx_status *rx_status)
@@ -477,7 +447,7 @@ void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_m
                spin_lock_bh(&sta->lock);
        } else if (!sta) {
                /* ftype == PLINK_OPEN */
-               u64 rates;
+               u32 rates;
                if (!mesh_plink_free_count(sdata)) {
                        mpl_dbg("Mesh plink error: no more free plinks\n");
                        rcu_read_unlock();
index 2b890af01ba47e8dd21134f1c8d849d94bbcfddf..fbb766afe599df30166e66faff75e0df4da39062 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * BSS client mode implementation
- * Copyright 2003, Jouni Malinen <jkmaline@cc.hut.fi>
+ * Copyright 2003-2008, Jouni Malinen <j@w1.fi>
  * Copyright 2004, Instant802 Networks, Inc.
  * Copyright 2005, Devicescape Software, Inc.
  * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
@@ -55,10 +55,10 @@ static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie)
 {
        u8 *end, *pos;
 
-       pos = bss->ies;
+       pos = bss->cbss.information_elements;
        if (pos == NULL)
                return NULL;
-       end = pos + bss->ies_len;
+       end = pos + bss->cbss.len_information_elements;
 
        while (pos + 1 < end) {
                if (pos + 2 + pos[1] > end)
@@ -73,7 +73,7 @@ static u8 *ieee80211_bss_get_ie(struct ieee80211_bss *bss, u8 ie)
 
 static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
                                      struct ieee80211_supported_band *sband,
-                                     u64 *rates)
+                                     u32 *rates)
 {
        int i, j, count;
        *rates = 0;
@@ -93,14 +93,14 @@ static int ieee80211_compatible_rates(struct ieee80211_bss *bss,
 }
 
 /* also used by mesh code */
-u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
+u32 ieee80211_sta_get_rates(struct ieee80211_local *local,
                            struct ieee802_11_elems *elems,
                            enum ieee80211_band band)
 {
        struct ieee80211_supported_band *sband;
        struct ieee80211_rate *bitrates;
        size_t num_rates;
-       u64 supp_rates;
+       u32 supp_rates;
        int i, j;
        sband = local->hw.wiphy->bands[band];
 
@@ -131,6 +131,12 @@ u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
 
 /* frame sending functions */
 
+static void add_extra_ies(struct sk_buff *skb, u8 *ies, size_t ies_len)
+{
+       if (ies)
+               memcpy(skb_put(skb, ies_len), ies, ies_len);
+}
+
 /* also used by scanning code */
 void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
                              u8 *ssid, size_t ssid_len)
@@ -142,7 +148,8 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
        u8 *pos, *supp_rates, *esupp_rates = NULL;
        int i;
 
-       skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200);
+       skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) + 200 +
+                           sdata->u.sta.ie_probereq_len);
        if (!skb) {
                printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
                       "request\n", sdata->dev->name);
@@ -189,6 +196,9 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
                *pos = rate->bitrate / 5;
        }
 
+       add_extra_ies(skb, sdata->u.sta.ie_probereq,
+                     sdata->u.sta.ie_probereq_len);
+
        ieee80211_tx_skb(sdata, skb, 0);
 }
 
@@ -202,7 +212,8 @@ static void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_mgmt *mgmt;
 
        skb = dev_alloc_skb(local->hw.extra_tx_headroom +
-                           sizeof(*mgmt) + 6 + extra_len);
+                           sizeof(*mgmt) + 6 + extra_len +
+                           sdata->u.sta.ie_auth_len);
        if (!skb) {
                printk(KERN_DEBUG "%s: failed to allocate buffer for auth "
                       "frame\n", sdata->dev->name);
@@ -225,6 +236,7 @@ static void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
        mgmt->u.auth.status_code = cpu_to_le16(0);
        if (extra)
                memcpy(skb_put(skb, extra_len), extra, extra_len);
+       add_extra_ies(skb, sdata->u.sta.ie_auth, sdata->u.sta.ie_auth_len);
 
        ieee80211_tx_skb(sdata, skb, encrypt);
 }
@@ -235,17 +247,26 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_local *local = sdata->local;
        struct sk_buff *skb;
        struct ieee80211_mgmt *mgmt;
-       u8 *pos, *ies, *ht_ie;
+       u8 *pos, *ies, *ht_ie, *e_ies;
        int i, len, count, rates_len, supp_rates_len;
        u16 capab;
        struct ieee80211_bss *bss;
        int wmm = 0;
        struct ieee80211_supported_band *sband;
-       u64 rates = 0;
+       u32 rates = 0;
+       size_t e_ies_len;
+
+       if (ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) {
+               e_ies = sdata->u.sta.ie_reassocreq;
+               e_ies_len = sdata->u.sta.ie_reassocreq_len;
+       } else {
+               e_ies = sdata->u.sta.ie_assocreq;
+               e_ies_len = sdata->u.sta.ie_assocreq_len;
+       }
 
        skb = dev_alloc_skb(local->hw.extra_tx_headroom +
                            sizeof(*mgmt) + 200 + ifsta->extra_ie_len +
-                           ifsta->ssid_len);
+                           ifsta->ssid_len + e_ies_len);
        if (!skb) {
                printk(KERN_DEBUG "%s: failed to allocate buffer for assoc "
                       "frame\n", sdata->dev->name);
@@ -268,7 +289,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
                                   local->hw.conf.channel->center_freq,
                                   ifsta->ssid, ifsta->ssid_len);
        if (bss) {
-               if (bss->capability & WLAN_CAPABILITY_PRIVACY)
+               if (bss->cbss.capability & WLAN_CAPABILITY_PRIVACY)
                        capab |= WLAN_CAPABILITY_PRIVACY;
                if (bss->wmm_used)
                        wmm = 1;
@@ -279,7 +300,7 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
                 * b-only mode) */
                rates_len = ieee80211_compatible_rates(bss, sband, &rates);
 
-               if ((bss->capability & WLAN_CAPABILITY_SPECTRUM_MGMT) &&
+               if ((bss->cbss.capability & WLAN_CAPABILITY_SPECTRUM_MGMT) &&
                    (local->hw.flags & IEEE80211_HW_SPECTRUM_MGMT))
                        capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
 
@@ -391,10 +412,17 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
        }
 
        /* wmm support is a must to HT */
+       /*
+        * IEEE802.11n does not allow TKIP/WEP as pairwise
+        * ciphers in HT mode. We still associate in non-ht
+        * mode (11a/b/g) if any one of these ciphers is
+        * configured as pairwise.
+        */
        if (wmm && (ifsta->flags & IEEE80211_STA_WMM_ENABLED) &&
            sband->ht_cap.ht_supported &&
            (ht_ie = ieee80211_bss_get_ie(bss, WLAN_EID_HT_INFORMATION)) &&
-           ht_ie[1] >= sizeof(struct ieee80211_ht_info)) {
+           ht_ie[1] >= sizeof(struct ieee80211_ht_info) &&
+           (!(ifsta->flags & IEEE80211_STA_TKIP_WEP_USED))) {
                struct ieee80211_ht_info *ht_info =
                        (struct ieee80211_ht_info *)(ht_ie + 2);
                u16 cap = sband->ht_cap.cap;
@@ -429,6 +457,8 @@ static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata,
                memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
        }
 
+       add_extra_ies(skb, e_ies, e_ies_len);
+
        kfree(ifsta->assocreq_ies);
        ifsta->assocreq_ies_len = (skb->data + skb->len) - ies;
        ifsta->assocreq_ies = kmalloc(ifsta->assocreq_ies_len, GFP_KERNEL);
@@ -446,8 +476,19 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_if_sta *ifsta = &sdata->u.sta;
        struct sk_buff *skb;
        struct ieee80211_mgmt *mgmt;
+       u8 *ies;
+       size_t ies_len;
+
+       if (stype == IEEE80211_STYPE_DEAUTH) {
+               ies = sdata->u.sta.ie_deauth;
+               ies_len = sdata->u.sta.ie_deauth_len;
+       } else {
+               ies = sdata->u.sta.ie_disassoc;
+               ies_len = sdata->u.sta.ie_disassoc_len;
+       }
 
-       skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt));
+       skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*mgmt) +
+                           ies_len);
        if (!skb) {
                printk(KERN_DEBUG "%s: failed to allocate buffer for "
                       "deauth/disassoc frame\n", sdata->dev->name);
@@ -465,19 +506,55 @@ static void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
        /* u.deauth.reason_code == u.disassoc.reason_code */
        mgmt->u.deauth.reason_code = cpu_to_le16(reason);
 
+       add_extra_ies(skb, ies, ies_len);
+
+       ieee80211_tx_skb(sdata, skb, ifsta->flags & IEEE80211_STA_MFP_ENABLED);
+}
+
+void ieee80211_send_pspoll(struct ieee80211_local *local,
+                          struct ieee80211_sub_if_data *sdata)
+{
+       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+       struct ieee80211_pspoll *pspoll;
+       struct sk_buff *skb;
+       u16 fc;
+
+       skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*pspoll));
+       if (!skb) {
+               printk(KERN_DEBUG "%s: failed to allocate buffer for "
+                      "pspoll frame\n", sdata->dev->name);
+               return;
+       }
+       skb_reserve(skb, local->hw.extra_tx_headroom);
+
+       pspoll = (struct ieee80211_pspoll *) skb_put(skb, sizeof(*pspoll));
+       memset(pspoll, 0, sizeof(*pspoll));
+       fc = IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL | IEEE80211_FCTL_PM;
+       pspoll->frame_control = cpu_to_le16(fc);
+       pspoll->aid = cpu_to_le16(ifsta->aid);
+
+       /* aid in PS-Poll has its two MSBs each set to 1 */
+       pspoll->aid |= cpu_to_le16(1 << 15 | 1 << 14);
+
+       memcpy(pspoll->bssid, ifsta->bssid, ETH_ALEN);
+       memcpy(pspoll->ta, sdata->dev->dev_addr, ETH_ALEN);
+
        ieee80211_tx_skb(sdata, skb, 0);
+
+       return;
 }
 
 /* MLME */
 static void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
-                                        struct ieee80211_bss *bss)
+                                        const size_t supp_rates_len,
+                                        const u8 *supp_rates)
 {
        struct ieee80211_local *local = sdata->local;
        int i, have_higher_than_11mbit = 0;
 
        /* cf. IEEE 802.11 9.2.12 */
-       for (i = 0; i < bss->supp_rates_len; i++)
-               if ((bss->supp_rates[i] & 0x7f) * 5 > 110)
+       for (i = 0; i < supp_rates_len; i++)
+               if ((supp_rates[i] & 0x7f) * 5 > 110)
                        have_higher_than_11mbit = 1;
 
        if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ &&
@@ -568,6 +645,27 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
        }
 }
 
+static bool ieee80211_check_tim(struct ieee802_11_elems *elems, u16 aid)
+{
+       u8 mask;
+       u8 index, indexn1, indexn2;
+       struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *) elems->tim;
+
+       aid &= 0x3fff;
+       index = aid / 8;
+       mask  = 1 << (aid & 7);
+
+       indexn1 = tim->bitmap_ctrl & 0xfe;
+       indexn2 = elems->tim_len + indexn1 - 4;
+
+       if (index < indexn1 || index > indexn2)
+               return false;
+
+       index -= indexn1;
+
+       return !!(tim->virtual_map[index] & mask);
+}
+
 static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
                                           u16 capab, bool erp_valid, u8 erp)
 {
@@ -710,20 +808,17 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
        bss_info_changed |= BSS_CHANGED_ASSOC;
        ifsta->flags |= IEEE80211_STA_ASSOCIATED;
 
-       if (sdata->vif.type != NL80211_IFTYPE_STATION)
-               return;
-
        bss = ieee80211_rx_bss_get(local, ifsta->bssid,
                                   conf->channel->center_freq,
                                   ifsta->ssid, ifsta->ssid_len);
        if (bss) {
                /* set timing information */
-               sdata->vif.bss_conf.beacon_int = bss->beacon_int;
-               sdata->vif.bss_conf.timestamp = bss->timestamp;
+               sdata->vif.bss_conf.beacon_int = bss->cbss.beacon_interval;
+               sdata->vif.bss_conf.timestamp = bss->cbss.tsf;
                sdata->vif.bss_conf.dtim_period = bss->dtim_period;
 
                bss_info_changed |= ieee80211_handle_bss_capability(sdata,
-                       bss->capability, bss->has_erp_value, bss->erp_value);
+                       bss->cbss.capability, bss->has_erp_value, bss->erp_value);
 
                ieee80211_rx_bss_put(local, bss);
        }
@@ -745,13 +840,16 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
        ieee80211_bss_info_change_notify(sdata, bss_info_changed);
 
        if (local->powersave) {
-               if (local->dynamic_ps_timeout > 0)
+               if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) &&
+                   local->hw.conf.dynamic_ps_timeout > 0) {
                        mod_timer(&local->dynamic_ps_timer, jiffies +
-                                 msecs_to_jiffies(local->dynamic_ps_timeout));
-               else {
+                                 msecs_to_jiffies(
+                                       local->hw.conf.dynamic_ps_timeout));
+               } else {
+                       if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
+                               ieee80211_send_nullfunc(local, sdata, 1);
                        conf->flags |= IEEE80211_CONF_PS;
-                       ieee80211_hw_config(local,
-                                           IEEE80211_CONF_CHANGE_PS);
+                       ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
                }
        }
 
@@ -770,6 +868,14 @@ static void ieee80211_direct_probe(struct ieee80211_sub_if_data *sdata,
                       sdata->dev->name, ifsta->bssid);
                ifsta->state = IEEE80211_STA_MLME_DISABLED;
                ieee80211_sta_send_apinfo(sdata, ifsta);
+
+               /*
+                * Most likely AP is not in the range so remove the
+                * bss information associated to the AP
+                */
+               ieee80211_rx_bss_remove(sdata, ifsta->bssid,
+                               sdata->local->hw.conf.channel->center_freq,
+                               ifsta->ssid, ifsta->ssid_len);
                return;
        }
 
@@ -801,6 +907,9 @@ static void ieee80211_authenticate(struct ieee80211_sub_if_data *sdata,
                       sdata->dev->name, ifsta->bssid);
                ifsta->state = IEEE80211_STA_MLME_DISABLED;
                ieee80211_sta_send_apinfo(sdata, ifsta);
+               ieee80211_rx_bss_remove(sdata, ifsta->bssid,
+                               sdata->local->hw.conf.channel->center_freq,
+                               ifsta->ssid, ifsta->ssid_len);
                return;
        }
 
@@ -843,7 +952,7 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
        netif_tx_stop_all_queues(sdata->dev);
        netif_carrier_off(sdata->dev);
 
-       ieee80211_sta_tear_down_BA_sessions(sdata, sta->sta.addr);
+       ieee80211_sta_tear_down_BA_sessions(sta);
 
        if (self_disconnected) {
                if (deauth)
@@ -863,14 +972,19 @@ static void ieee80211_set_disassoc(struct ieee80211_sub_if_data *sdata,
 
        ieee80211_sta_send_apinfo(sdata, ifsta);
 
-       if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT)
+       if (self_disconnected || reason == WLAN_REASON_DISASSOC_STA_HAS_LEFT) {
                ifsta->state = IEEE80211_STA_MLME_DISABLED;
+               ieee80211_rx_bss_remove(sdata, ifsta->bssid,
+                               sdata->local->hw.conf.channel->center_freq,
+                               ifsta->ssid, ifsta->ssid_len);
+       }
 
        rcu_read_unlock();
 
-       local->hw.conf.ht.enabled = false;
+       /* channel(_type) changes are handled by ieee80211_hw_config */
        local->oper_channel_type = NL80211_CHAN_NO_HT;
-       config_changed |= IEEE80211_CONF_CHANGE_HT;
+
+       local->power_constr_level = 0;
 
        del_timer_sync(&local->dynamic_ps_timer);
        cancel_work_sync(&local->dynamic_ps_enable_work);
@@ -924,7 +1038,7 @@ static int ieee80211_privacy_mismatch(struct ieee80211_sub_if_data *sdata,
        if (!bss)
                return 0;
 
-       bss_privacy = !!(bss->capability & WLAN_CAPABILITY_PRIVACY);
+       bss_privacy = !!(bss->cbss.capability & WLAN_CAPABILITY_PRIVACY);
        wep_privacy = !!ieee80211_sta_wep_configured(sdata);
        privacy_invoked = !!(ifsta->flags & IEEE80211_STA_PRIVACY_INVOKED);
 
@@ -946,6 +1060,9 @@ static void ieee80211_associate(struct ieee80211_sub_if_data *sdata,
                       sdata->dev->name, ifsta->bssid);
                ifsta->state = IEEE80211_STA_MLME_DISABLED;
                ieee80211_sta_send_apinfo(sdata, ifsta);
+               ieee80211_rx_bss_remove(sdata, ifsta->bssid,
+                               sdata->local->hw.conf.channel->center_freq,
+                               ifsta->ssid, ifsta->ssid_len);
                return;
        }
 
@@ -1049,6 +1166,30 @@ static void ieee80211_auth_challenge(struct ieee80211_sub_if_data *sdata,
                            elems.challenge_len + 2, 1);
 }
 
+static void ieee80211_rx_mgmt_auth_ibss(struct ieee80211_sub_if_data *sdata,
+                                       struct ieee80211_if_sta *ifsta,
+                                       struct ieee80211_mgmt *mgmt,
+                                       size_t len)
+{
+       u16 auth_alg, auth_transaction, status_code;
+
+       if (len < 24 + 6)
+               return;
+
+       auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
+       auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
+       status_code = le16_to_cpu(mgmt->u.auth.status_code);
+
+       /*
+        * IEEE 802.11 standard does not require authentication in IBSS
+        * networks and most implementations do not seem to use it.
+        * However, try to reply to authentication attempts if someone
+        * has actually implemented this.
+        */
+       if (auth_alg == WLAN_AUTH_OPEN && auth_transaction == 1)
+               ieee80211_send_auth(sdata, ifsta, 2, NULL, 0, 0);
+}
+
 static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
                                   struct ieee80211_if_sta *ifsta,
                                   struct ieee80211_mgmt *mgmt,
@@ -1056,37 +1197,22 @@ static void ieee80211_rx_mgmt_auth(struct ieee80211_sub_if_data *sdata,
 {
        u16 auth_alg, auth_transaction, status_code;
 
-       if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
-           sdata->vif.type != NL80211_IFTYPE_ADHOC)
+       if (ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE)
                return;
 
        if (len < 24 + 6)
                return;
 
-       if (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-           memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0)
+       if (memcmp(ifsta->bssid, mgmt->sa, ETH_ALEN) != 0)
                return;
 
-       if (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-           memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
+       if (memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
                return;
 
        auth_alg = le16_to_cpu(mgmt->u.auth.auth_alg);
        auth_transaction = le16_to_cpu(mgmt->u.auth.auth_transaction);
        status_code = le16_to_cpu(mgmt->u.auth.status_code);
 
-       if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
-               /*
-                * IEEE 802.11 standard does not require authentication in IBSS
-                * networks and most implementations do not seem to use it.
-                * However, try to reply to authentication attempts if someone
-                * has actually implemented this.
-                */
-               if (auth_alg != WLAN_AUTH_OPEN || auth_transaction != 1)
-                       return;
-               ieee80211_send_auth(sdata, ifsta, 2, NULL, 0, 0);
-       }
-
        if (auth_alg != ifsta->auth_alg ||
            auth_transaction != ifsta->auth_transaction)
                return;
@@ -1211,7 +1337,7 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_supported_band *sband;
        struct sta_info *sta;
-       u64 rates, basic_rates;
+       u32 rates, basic_rates;
        u16 capab_info, status_code, aid;
        struct ieee802_11_elems elems;
        struct ieee80211_bss_conf *bss_conf = &sdata->vif.bss_conf;
@@ -1242,6 +1368,24 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
               sdata->dev->name, reassoc ? "Rea" : "A", mgmt->sa,
               capab_info, status_code, (u16)(aid & ~(BIT(15) | BIT(14))));
 
+       pos = mgmt->u.assoc_resp.variable;
+       ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
+
+       if (status_code == WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY &&
+           elems.timeout_int && elems.timeout_int_len == 5 &&
+           elems.timeout_int[0] == WLAN_TIMEOUT_ASSOC_COMEBACK) {
+               u32 tu, ms;
+               tu = get_unaligned_le32(elems.timeout_int + 1);
+               ms = tu * 1024 / 1000;
+               printk(KERN_DEBUG "%s: AP rejected association temporarily; "
+                      "comeback duration %u TU (%u ms)\n",
+                      sdata->dev->name, tu, ms);
+               if (ms > IEEE80211_ASSOC_TIMEOUT)
+                       mod_timer(&ifsta->timer,
+                                 jiffies + msecs_to_jiffies(ms));
+               return;
+       }
+
        if (status_code != WLAN_STATUS_SUCCESS) {
                printk(KERN_DEBUG "%s: AP denied association (code=%d)\n",
                       sdata->dev->name, status_code);
@@ -1257,9 +1401,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
                       "set\n", sdata->dev->name, aid);
        aid &= ~(BIT(15) | BIT(14));
 
-       pos = mgmt->u.assoc_resp.variable;
-       ieee802_11_parse_elems(pos, len - (pos - (u8 *) mgmt), &elems);
-
        if (!elems.supp_rates) {
                printk(KERN_DEBUG "%s: no SuppRates element in AssocResp\n",
                       sdata->dev->name);
@@ -1281,8 +1422,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
        /* Add STA entry for the AP */
        sta = sta_info_get(local, ifsta->bssid);
        if (!sta) {
-               struct ieee80211_bss *bss;
-
                newsta = true;
 
                sta = sta_info_alloc(sdata, ifsta->bssid, GFP_ATOMIC);
@@ -1292,15 +1431,6 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
                        rcu_read_unlock();
                        return;
                }
-               bss = ieee80211_rx_bss_get(local, ifsta->bssid,
-                                          local->hw.conf.channel->center_freq,
-                                          ifsta->ssid, ifsta->ssid_len);
-               if (bss) {
-                       sta->last_signal = bss->signal;
-                       sta->last_qual = bss->qual;
-                       sta->last_noise = bss->noise;
-                       ieee80211_rx_bss_put(local, bss);
-               }
 
                /* update new sta with its last rx activity */
                sta->last_rx = jiffies;
@@ -1375,6 +1505,9 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
 
        rate_control_rate_init(sta);
 
+       if (ifsta->flags & IEEE80211_STA_MFP_ENABLED)
+               set_sta_flags(sta, WLAN_STA_MFP);
+
        if (elems.wmm_param)
                set_sta_flags(sta, WLAN_STA_WME);
 
@@ -1409,49 +1542,61 @@ static void ieee80211_rx_mgmt_assoc_resp(struct ieee80211_sub_if_data *sdata,
 }
 
 
-static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
-                                  struct ieee80211_if_sta *ifsta,
-                                  struct ieee80211_bss *bss)
+static int __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
+                                    struct ieee80211_if_sta *ifsta,
+                                    const u8 *bssid, const int beacon_int,
+                                    const int freq,
+                                    const size_t supp_rates_len,
+                                    const u8 *supp_rates,
+                                    const u16 capability)
 {
        struct ieee80211_local *local = sdata->local;
-       int res, rates, i, j;
+       int res = 0, rates, i, j;
        struct sk_buff *skb;
        struct ieee80211_mgmt *mgmt;
        u8 *pos;
        struct ieee80211_supported_band *sband;
        union iwreq_data wrqu;
 
-       skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
+       if (local->ops->reset_tsf) {
+               /* Reset own TSF to allow time synchronization work. */
+               local->ops->reset_tsf(local_to_hw(local));
+       }
+
+       if ((ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) &&
+          memcmp(ifsta->bssid, bssid, ETH_ALEN) == 0)
+               return res;
+
+       skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 +
+                           sdata->u.sta.ie_proberesp_len);
        if (!skb) {
                printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
                       "response\n", sdata->dev->name);
                return -ENOMEM;
        }
 
-       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
-
-       /* Remove possible STA entries from other IBSS networks. */
-       sta_info_flush_delayed(sdata);
-
-       if (local->ops->reset_tsf) {
-               /* Reset own TSF to allow time synchronization work. */
-               local->ops->reset_tsf(local_to_hw(local));
+       if (!(ifsta->flags & IEEE80211_STA_PREV_BSSID_SET)) {
+               /* Remove possible STA entries from other IBSS networks. */
+               sta_info_flush_delayed(sdata);
        }
-       memcpy(ifsta->bssid, bss->bssid, ETH_ALEN);
+
+       memcpy(ifsta->bssid, bssid, ETH_ALEN);
        res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID);
        if (res)
                return res;
 
-       local->hw.conf.beacon_int = bss->beacon_int >= 10 ? bss->beacon_int : 10;
+       local->hw.conf.beacon_int = beacon_int >= 10 ? beacon_int : 10;
 
-       sdata->drop_unencrypted = bss->capability &
+       sdata->drop_unencrypted = capability &
                WLAN_CAPABILITY_PRIVACY ? 1 : 0;
 
-       res = ieee80211_set_freq(sdata, bss->freq);
+       res = ieee80211_set_freq(sdata, freq);
 
        if (res)
                return res;
 
+       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
+
        /* Build IBSS probe response */
 
        skb_reserve(skb, local->hw.extra_tx_headroom);
@@ -1460,33 +1605,32 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
                skb_put(skb, 24 + sizeof(mgmt->u.beacon));
        memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon));
        mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
-                                               IEEE80211_STYPE_PROBE_RESP);
+                                         IEEE80211_STYPE_PROBE_RESP);
        memset(mgmt->da, 0xff, ETH_ALEN);
        memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
        memcpy(mgmt->bssid, ifsta->bssid, ETH_ALEN);
        mgmt->u.beacon.beacon_int =
                cpu_to_le16(local->hw.conf.beacon_int);
-       mgmt->u.beacon.timestamp = cpu_to_le64(bss->timestamp);
-       mgmt->u.beacon.capab_info = cpu_to_le16(bss->capability);
+       mgmt->u.beacon.capab_info = cpu_to_le16(capability);
 
        pos = skb_put(skb, 2 + ifsta->ssid_len);
        *pos++ = WLAN_EID_SSID;
        *pos++ = ifsta->ssid_len;
        memcpy(pos, ifsta->ssid, ifsta->ssid_len);
 
-       rates = bss->supp_rates_len;
+       rates = supp_rates_len;
        if (rates > 8)
                rates = 8;
        pos = skb_put(skb, 2 + rates);
        *pos++ = WLAN_EID_SUPP_RATES;
        *pos++ = rates;
-       memcpy(pos, bss->supp_rates, rates);
+       memcpy(pos, supp_rates, rates);
 
-       if (bss->band == IEEE80211_BAND_2GHZ) {
+       if (sband->band == IEEE80211_BAND_2GHZ) {
                pos = skb_put(skb, 2 + 1);
                *pos++ = WLAN_EID_DS_PARAMS;
                *pos++ = 1;
-               *pos++ = ieee80211_frequency_to_channel(bss->freq);
+               *pos++ = ieee80211_frequency_to_channel(freq);
        }
 
        pos = skb_put(skb, 2 + 2);
@@ -1496,43 +1640,59 @@ static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
        *pos++ = 0;
        *pos++ = 0;
 
-       if (bss->supp_rates_len > 8) {
-               rates = bss->supp_rates_len - 8;
+       if (supp_rates_len > 8) {
+               rates = supp_rates_len - 8;
                pos = skb_put(skb, 2 + rates);
                *pos++ = WLAN_EID_EXT_SUPP_RATES;
                *pos++ = rates;
-               memcpy(pos, &bss->supp_rates[8], rates);
+               memcpy(pos, &supp_rates[8], rates);
        }
 
+       add_extra_ies(skb, sdata->u.sta.ie_proberesp,
+                     sdata->u.sta.ie_proberesp_len);
+
        ifsta->probe_resp = skb;
 
-       ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON);
+       ieee80211_if_config(sdata, IEEE80211_IFCC_BEACON |
+                                  IEEE80211_IFCC_BEACON_ENABLED);
 
 
        rates = 0;
-       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
-       for (i = 0; i < bss->supp_rates_len; i++) {
-               int bitrate = (bss->supp_rates[i] & 0x7f) * 5;
+       for (i = 0; i < supp_rates_len; i++) {
+               int bitrate = (supp_rates[i] & 0x7f) * 5;
                for (j = 0; j < sband->n_bitrates; j++)
                        if (sband->bitrates[j].bitrate == bitrate)
                                rates |= BIT(j);
        }
        ifsta->supp_rates_bits[local->hw.conf.channel->band] = rates;
 
-       ieee80211_sta_def_wmm_params(sdata, bss);
+       ieee80211_sta_def_wmm_params(sdata, supp_rates_len, supp_rates);
 
+       ifsta->flags |= IEEE80211_STA_PREV_BSSID_SET;
        ifsta->state = IEEE80211_STA_MLME_IBSS_JOINED;
        mod_timer(&ifsta->timer, jiffies + IEEE80211_IBSS_MERGE_INTERVAL);
 
        ieee80211_led_assoc(local, true);
 
        memset(&wrqu, 0, sizeof(wrqu));
-       memcpy(wrqu.ap_addr.sa_data, bss->bssid, ETH_ALEN);
+       memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN);
        wireless_send_event(sdata->dev, SIOCGIWAP, &wrqu, NULL);
 
        return res;
 }
 
+static int ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata,
+                                  struct ieee80211_if_sta *ifsta,
+                                  struct ieee80211_bss *bss)
+{
+       return __ieee80211_sta_join_ibss(sdata, ifsta,
+                                        bss->cbss.bssid,
+                                        bss->cbss.beacon_interval,
+                                        bss->cbss.channel->center_freq,
+                                        bss->supp_rates_len, bss->supp_rates,
+                                        bss->cbss.capability);
+}
+
 static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
                                  struct ieee80211_mgmt *mgmt,
                                  size_t len,
@@ -1546,7 +1706,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
        struct sta_info *sta;
        struct ieee80211_channel *channel;
        u64 beacon_timestamp, rx_timestamp;
-       u64 supp_rates = 0;
+       u32 supp_rates = 0;
        enum ieee80211_band band = rx_status->band;
 
        if (elems->ds_params && elems->ds_params_len == 1)
@@ -1567,7 +1727,7 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
 
                sta = sta_info_get(local, mgmt->sa);
                if (sta) {
-                       u64 prev_rates;
+                       u32 prev_rates;
 
                        prev_rates = sta->sta.supp_rates[band];
                        /* make sure mandatory rates are always added */
@@ -1593,80 +1753,99 @@ static void ieee80211_rx_bss_info(struct ieee80211_sub_if_data *sdata,
        }
 
        bss = ieee80211_bss_info_update(local, rx_status, mgmt, len, elems,
-                                       freq, beacon);
+                                       channel, beacon);
        if (!bss)
                return;
 
+       if (elems->ch_switch_elem && (elems->ch_switch_elem_len == 3) &&
+           (memcmp(mgmt->bssid, sdata->u.sta.bssid, ETH_ALEN) == 0)) {
+               struct ieee80211_channel_sw_ie *sw_elem =
+                       (struct ieee80211_channel_sw_ie *)elems->ch_switch_elem;
+               ieee80211_process_chanswitch(sdata, sw_elem, bss);
+       }
+
        /* was just updated in ieee80211_bss_info_update */
-       beacon_timestamp = bss->timestamp;
+       beacon_timestamp = bss->cbss.tsf;
 
-       /*
-        * In STA mode, the remaining parameters should not be overridden
-        * by beacons because they're not necessarily accurate there.
-        */
-       if (sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-           bss->last_probe_resp && beacon) {
-               ieee80211_rx_bss_put(local, bss);
-               return;
-       }
+       if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
+               goto put_bss;
 
        /* check if we need to merge IBSS */
-       if (sdata->vif.type == NL80211_IFTYPE_ADHOC && beacon &&
-           bss->capability & WLAN_CAPABILITY_IBSS &&
-           bss->freq == local->oper_channel->center_freq &&
-           elems->ssid_len == sdata->u.sta.ssid_len &&
+
+       /* merge only on beacons (???) */
+       if (!beacon)
+               goto put_bss;
+
+       /* we use a fixed BSSID */
+       if (sdata->u.sta.flags & IEEE80211_STA_BSSID_SET)
+               goto put_bss;
+
+       /* not an IBSS */
+       if (!(bss->cbss.capability & WLAN_CAPABILITY_IBSS))
+               goto put_bss;
+
+       /* different channel */
+       if (bss->cbss.channel != local->oper_channel)
+               goto put_bss;
+
+       /* different SSID */
+       if (elems->ssid_len != sdata->u.sta.ssid_len ||
            memcmp(elems->ssid, sdata->u.sta.ssid,
-                               sdata->u.sta.ssid_len) == 0) {
-               if (rx_status->flag & RX_FLAG_TSFT) {
-                       /* in order for correct IBSS merging we need mactime
-                        *
-                        * since mactime is defined as the time the first data
-                        * symbol of the frame hits the PHY, and the timestamp
-                        * of the beacon is defined as "the time that the data
-                        * symbol containing the first bit of the timestamp is
-                        * transmitted to the PHY plus the transmitting STA’s
-                        * delays through its local PHY from the MAC-PHY
-                        * interface to its interface with the WM"
-                        * (802.11 11.1.2) - equals the time this bit arrives at
-                        * the receiver - we have to take into account the
-                        * offset between the two.
-                        * e.g: at 1 MBit that means mactime is 192 usec earlier
-                        * (=24 bytes * 8 usecs/byte) than the beacon timestamp.
-                        */
-                       int rate;
-                       if (rx_status->flag & RX_FLAG_HT) {
-                               rate = 65; /* TODO: HT rates */
-                       } else {
-                               rate = local->hw.wiphy->bands[band]->
-                                       bitrates[rx_status->rate_idx].bitrate;
-                       }
-                       rx_timestamp = rx_status->mactime + (24 * 8 * 10 / rate);
-               } else if (local && local->ops && local->ops->get_tsf)
-                       /* second best option: get current TSF */
-                       rx_timestamp = local->ops->get_tsf(local_to_hw(local));
+                               sdata->u.sta.ssid_len))
+               goto put_bss;
+
+       if (rx_status->flag & RX_FLAG_TSFT) {
+               /*
+                * For correct IBSS merging we need mactime; since mactime is
+                * defined as the time the first data symbol of the frame hits
+                * the PHY, and the timestamp of the beacon is defined as "the
+                * time that the data symbol containing the first bit of the
+                * timestamp is transmitted to the PHY plus the transmitting
+                * STA's delays through its local PHY from the MAC-PHY
+                * interface to its interface with the WM" (802.11 11.1.2)
+                * - equals the time this bit arrives at the receiver - we have
+                * to take into account the offset between the two.
+                *
+                * E.g. at 1 MBit that means mactime is 192 usec earlier
+                * (=24 bytes * 8 usecs/byte) than the beacon timestamp.
+                */
+               int rate;
+
+               if (rx_status->flag & RX_FLAG_HT)
+                       rate = 65; /* TODO: HT rates */
                else
-                       /* can't merge without knowing the TSF */
-                       rx_timestamp = -1LLU;
+                       rate = local->hw.wiphy->bands[band]->
+                               bitrates[rx_status->rate_idx].bitrate;
+
+               rx_timestamp = rx_status->mactime + (24 * 8 * 10 / rate);
+       } else if (local && local->ops && local->ops->get_tsf)
+               /* second best option: get current TSF */
+               rx_timestamp = local->ops->get_tsf(local_to_hw(local));
+       else
+               /* can't merge without knowing the TSF */
+               rx_timestamp = -1LLU;
+
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
-               printk(KERN_DEBUG "RX beacon SA=%pM BSSID="
-                      "%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
-                      mgmt->sa, mgmt->bssid,
-                      (unsigned long long)rx_timestamp,
-                      (unsigned long long)beacon_timestamp,
-                      (unsigned long long)(rx_timestamp - beacon_timestamp),
-                      jiffies);
-#endif /* CONFIG_MAC80211_IBSS_DEBUG */
-               if (beacon_timestamp > rx_timestamp) {
+       printk(KERN_DEBUG "RX beacon SA=%pM BSSID="
+              "%pM TSF=0x%llx BCN=0x%llx diff=%lld @%lu\n",
+              mgmt->sa, mgmt->bssid,
+              (unsigned long long)rx_timestamp,
+              (unsigned long long)beacon_timestamp,
+              (unsigned long long)(rx_timestamp - beacon_timestamp),
+              jiffies);
+#endif
+
+       if (beacon_timestamp > rx_timestamp) {
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
-                       printk(KERN_DEBUG "%s: beacon TSF higher than "
-                              "local TSF - IBSS merge with BSSID %pM\n",
-                              sdata->dev->name, mgmt->bssid);
+               printk(KERN_DEBUG "%s: beacon TSF higher than "
+                      "local TSF - IBSS merge with BSSID %pM\n",
+                      sdata->dev->name, mgmt->bssid);
 #endif
-                       ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss);
-                       ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates);
-               }
+               ieee80211_sta_join_ibss(sdata, &sdata->u.sta, bss);
+               ieee80211_ibss_add_sta(sdata, mgmt->bssid, mgmt->sa, supp_rates);
        }
 
+ put_bss:
        ieee80211_rx_bss_put(local, bss);
 }
 
@@ -1712,7 +1891,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
        struct ieee802_11_elems elems;
        struct ieee80211_local *local = sdata->local;
        u32 changed = 0;
-       bool erp_valid;
+       bool erp_valid, directed_tim;
        u8 erp_value = 0;
 
        /* Process beacon from the current BSS */
@@ -1732,9 +1911,37 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
            memcmp(ifsta->bssid, mgmt->bssid, ETH_ALEN) != 0)
                return;
 
+       if (rx_status->freq != local->hw.conf.channel->center_freq)
+               return;
+
        ieee80211_sta_wmm_params(local, ifsta, elems.wmm_param,
                                 elems.wmm_param_len);
 
+       if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK &&
+           local->hw.conf.flags & IEEE80211_CONF_PS) {
+               directed_tim = ieee80211_check_tim(&elems, ifsta->aid);
+
+               if (directed_tim) {
+                       if (local->hw.conf.dynamic_ps_timeout > 0) {
+                               local->hw.conf.flags &= ~IEEE80211_CONF_PS;
+                               ieee80211_hw_config(local,
+                                                   IEEE80211_CONF_CHANGE_PS);
+                               ieee80211_send_nullfunc(local, sdata, 0);
+                       } else {
+                               local->pspolling = true;
+
+                               /*
+                                * Here is assumed that the driver will be
+                                * able to send ps-poll frame and receive a
+                                * response even though power save mode is
+                                * enabled, but some drivers might require
+                                * to disable power save here. This needs
+                                * to be investigated.
+                                */
+                               ieee80211_send_pspoll(local, sdata);
+                       }
+               }
+       }
 
        if (elems.erp_info && elems.erp_info_len >= 1) {
                erp_valid = true;
@@ -1778,6 +1985,13 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
                 * for the BSSID we are associated to */
                regulatory_hint_11d(local->hw.wiphy,
                        elems.country_elem, elems.country_elem_len);
+
+               /* TODO: IBSS also needs this */
+               if (elems.pwr_constr_elem)
+                       ieee80211_handle_pwr_constr(sdata,
+                               le16_to_cpu(mgmt->u.probe_resp.capab_info),
+                               elems.pwr_constr_elem,
+                               elems.pwr_constr_elem_len);
        }
 
        ieee80211_bss_info_change_notify(sdata, changed);
@@ -1787,8 +2001,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
 static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
                                        struct ieee80211_if_sta *ifsta,
                                        struct ieee80211_mgmt *mgmt,
-                                       size_t len,
-                                       struct ieee80211_rx_status *rx_status)
+                                       size_t len)
 {
        struct ieee80211_local *local = sdata->local;
        int tx_last_beacon;
@@ -1796,8 +2009,7 @@ static void ieee80211_rx_mgmt_probe_req(struct ieee80211_sub_if_data *sdata,
        struct ieee80211_mgmt *resp;
        u8 *pos, *end;
 
-       if (sdata->vif.type != NL80211_IFTYPE_ADHOC ||
-           ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED ||
+       if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED ||
            len < 24 + 2 || !ifsta->probe_resp)
                return;
 
@@ -1901,32 +2113,54 @@ static void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
        mgmt = (struct ieee80211_mgmt *) skb->data;
        fc = le16_to_cpu(mgmt->frame_control);
 
-       switch (fc & IEEE80211_FCTL_STYPE) {
-       case IEEE80211_STYPE_PROBE_REQ:
-               ieee80211_rx_mgmt_probe_req(sdata, ifsta, mgmt, skb->len,
-                                           rx_status);
-               break;
-       case IEEE80211_STYPE_PROBE_RESP:
-               ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len, rx_status);
-               break;
-       case IEEE80211_STYPE_BEACON:
-               ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len, rx_status);
-               break;
-       case IEEE80211_STYPE_AUTH:
-               ieee80211_rx_mgmt_auth(sdata, ifsta, mgmt, skb->len);
-               break;
-       case IEEE80211_STYPE_ASSOC_RESP:
-               ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 0);
-               break;
-       case IEEE80211_STYPE_REASSOC_RESP:
-               ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt, skb->len, 1);
-               break;
-       case IEEE80211_STYPE_DEAUTH:
-               ieee80211_rx_mgmt_deauth(sdata, ifsta, mgmt, skb->len);
-               break;
-       case IEEE80211_STYPE_DISASSOC:
-               ieee80211_rx_mgmt_disassoc(sdata, ifsta, mgmt, skb->len);
-               break;
+       if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
+               switch (fc & IEEE80211_FCTL_STYPE) {
+               case IEEE80211_STYPE_PROBE_REQ:
+                       ieee80211_rx_mgmt_probe_req(sdata, ifsta, mgmt,
+                                                   skb->len);
+                       break;
+               case IEEE80211_STYPE_PROBE_RESP:
+                       ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len,
+                                                    rx_status);
+                       break;
+               case IEEE80211_STYPE_BEACON:
+                       ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len,
+                                                rx_status);
+                       break;
+               case IEEE80211_STYPE_AUTH:
+                       ieee80211_rx_mgmt_auth_ibss(sdata, ifsta, mgmt,
+                                                   skb->len);
+                       break;
+               }
+       } else { /* NL80211_IFTYPE_STATION */
+               switch (fc & IEEE80211_FCTL_STYPE) {
+               case IEEE80211_STYPE_PROBE_RESP:
+                       ieee80211_rx_mgmt_probe_resp(sdata, mgmt, skb->len,
+                                                    rx_status);
+                       break;
+               case IEEE80211_STYPE_BEACON:
+                       ieee80211_rx_mgmt_beacon(sdata, mgmt, skb->len,
+                                                rx_status);
+                       break;
+               case IEEE80211_STYPE_AUTH:
+                       ieee80211_rx_mgmt_auth(sdata, ifsta, mgmt, skb->len);
+                       break;
+               case IEEE80211_STYPE_ASSOC_RESP:
+                       ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt,
+                                                    skb->len, 0);
+                       break;
+               case IEEE80211_STYPE_REASSOC_RESP:
+                       ieee80211_rx_mgmt_assoc_resp(sdata, ifsta, mgmt,
+                                                    skb->len, 1);
+                       break;
+               case IEEE80211_STYPE_DEAUTH:
+                       ieee80211_rx_mgmt_deauth(sdata, ifsta, mgmt, skb->len);
+                       break;
+               case IEEE80211_STYPE_DISASSOC:
+                       ieee80211_rx_mgmt_disassoc(sdata, ifsta, mgmt,
+                                                  skb->len);
+                       break;
+               }
        }
 
        kfree_skb(skb);
@@ -1965,9 +2199,21 @@ static void ieee80211_sta_merge_ibss(struct ieee80211_sub_if_data *sdata,
        if (ieee80211_sta_active_ibss(sdata))
                return;
 
+       if ((sdata->u.sta.flags & IEEE80211_STA_BSSID_SET) &&
+           (!(sdata->u.sta.flags & IEEE80211_STA_AUTO_CHANNEL_SEL)))
+               return;
+
        printk(KERN_DEBUG "%s: No active IBSS STAs - trying to scan for other "
               "IBSS networks with same SSID (merge)\n", sdata->dev->name);
-       ieee80211_request_scan(sdata, ifsta->ssid, ifsta->ssid_len);
+
+       /* XXX maybe racy? */
+       if (sdata->local->scan_req)
+               return;
+
+       memcpy(sdata->local->int_scan_req.ssids[0].ssid,
+              ifsta->ssid, IEEE80211_MAX_SSID_LEN);
+       sdata->local->int_scan_req.ssids[0].ssid_len = ifsta->ssid_len;
+       ieee80211_request_scan(sdata, &sdata->local->int_scan_req);
 }
 
 
@@ -2013,94 +2259,56 @@ static void ieee80211_sta_reset_auth(struct ieee80211_sub_if_data *sdata,
        netif_carrier_off(sdata->dev);
 }
 
-
-static int ieee80211_sta_match_ssid(struct ieee80211_if_sta *ifsta,
-                                   const char *ssid, int ssid_len)
-{
-       int tmp, hidden_ssid;
-
-       if (ssid_len == ifsta->ssid_len &&
-           !memcmp(ifsta->ssid, ssid, ssid_len))
-               return 1;
-
-       if (ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL)
-               return 0;
-
-       hidden_ssid = 1;
-       tmp = ssid_len;
-       while (tmp--) {
-               if (ssid[tmp] != '\0') {
-                       hidden_ssid = 0;
-                       break;
-               }
-       }
-
-       if (hidden_ssid && (ifsta->ssid_len == ssid_len || ssid_len == 0))
-               return 1;
-
-       if (ssid_len == 1 && ssid[0] == ' ')
-               return 1;
-
-       return 0;
-}
-
 static int ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata,
                                     struct ieee80211_if_sta *ifsta)
 {
        struct ieee80211_local *local = sdata->local;
-       struct ieee80211_bss *bss;
        struct ieee80211_supported_band *sband;
-       u8 bssid[ETH_ALEN], *pos;
+       u8 *pos;
+       u8 bssid[ETH_ALEN];
+       u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
+       u16 capability;
        int i;
-       int ret;
-
-#if 0
-       /* Easier testing, use fixed BSSID. */
-       memset(bssid, 0xfe, ETH_ALEN);
-#else
-       /* Generate random, not broadcast, locally administered BSSID. Mix in
-        * own MAC address to make sure that devices that do not have proper
-        * random number generator get different BSSID. */
-       get_random_bytes(bssid, ETH_ALEN);
-       for (i = 0; i < ETH_ALEN; i++)
-               bssid[i] ^= sdata->dev->dev_addr[i];
-       bssid[0] &= ~0x01;
-       bssid[0] |= 0x02;
-#endif
+
+       if (sdata->u.sta.flags & IEEE80211_STA_BSSID_SET) {
+               memcpy(bssid, ifsta->bssid, ETH_ALEN);
+       } else {
+               /* Generate random, not broadcast, locally administered BSSID. Mix in
+                * own MAC address to make sure that devices that do not have proper
+                * random number generator get different BSSID. */
+               get_random_bytes(bssid, ETH_ALEN);
+               for (i = 0; i < ETH_ALEN; i++)
+                       bssid[i] ^= sdata->dev->dev_addr[i];
+               bssid[0] &= ~0x01;
+               bssid[0] |= 0x02;
+       }
 
        printk(KERN_DEBUG "%s: Creating new IBSS network, BSSID %pM\n",
               sdata->dev->name, bssid);
 
-       bss = ieee80211_rx_bss_add(local, bssid,
-                                  local->hw.conf.channel->center_freq,
-                                  sdata->u.sta.ssid, sdata->u.sta.ssid_len);
-       if (!bss)
-               return -ENOMEM;
-
-       bss->band = local->hw.conf.channel->band;
-       sband = local->hw.wiphy->bands[bss->band];
+       sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
 
        if (local->hw.conf.beacon_int == 0)
                local->hw.conf.beacon_int = 100;
-       bss->beacon_int = local->hw.conf.beacon_int;
-       bss->last_update = jiffies;
-       bss->capability = WLAN_CAPABILITY_IBSS;
+
+       capability = WLAN_CAPABILITY_IBSS;
 
        if (sdata->default_key)
-               bss->capability |= WLAN_CAPABILITY_PRIVACY;
+               capability |= WLAN_CAPABILITY_PRIVACY;
        else
                sdata->drop_unencrypted = 0;
 
-       bss->supp_rates_len = sband->n_bitrates;
-       pos = bss->supp_rates;
+       pos = supp_rates;
        for (i = 0; i < sband->n_bitrates; i++) {
                int rate = sband->bitrates[i].bitrate;
                *pos++ = (u8) (rate / 5);
        }
 
-       ret = ieee80211_sta_join_ibss(sdata, ifsta, bss);
-       ieee80211_rx_bss_put(local, bss);
-       return ret;
+       return __ieee80211_sta_join_ibss(sdata, ifsta,
+                                        bssid, local->hw.conf.beacon_int,
+                                        local->hw.conf.channel->center_freq,
+                                        sband->n_bitrates, supp_rates,
+                                        capability);
 }
 
 
@@ -2109,8 +2317,6 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_bss *bss;
-       int found = 0;
-       u8 bssid[ETH_ALEN];
        int active_ibss;
 
        if (ifsta->ssid_len == 0)
@@ -2121,51 +2327,39 @@ static int ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata,
        printk(KERN_DEBUG "%s: sta_find_ibss (active_ibss=%d)\n",
               sdata->dev->name, active_ibss);
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
-       spin_lock_bh(&local->bss_lock);
-       list_for_each_entry(bss, &local->bss_list, list) {
-               if (ifsta->ssid_len != bss->ssid_len ||
-                   memcmp(ifsta->ssid, bss->ssid, bss->ssid_len) != 0
-                   || !(bss->capability & WLAN_CAPABILITY_IBSS))
-                       continue;
-#ifdef CONFIG_MAC80211_IBSS_DEBUG
-               printk(KERN_DEBUG "   bssid=%pM found\n", bss->bssid);
-#endif /* CONFIG_MAC80211_IBSS_DEBUG */
-               memcpy(bssid, bss->bssid, ETH_ALEN);
-               found = 1;
-               if (active_ibss || memcmp(bssid, ifsta->bssid, ETH_ALEN) != 0)
-                       break;
-       }
-       spin_unlock_bh(&local->bss_lock);
+
+       if (active_ibss)
+               return 0;
+
+       if (ifsta->flags & IEEE80211_STA_BSSID_SET)
+               bss = ieee80211_rx_bss_get(local, ifsta->bssid, 0,
+                                          ifsta->ssid, ifsta->ssid_len);
+       else
+               bss = (void *)cfg80211_get_ibss(local->hw.wiphy,
+                                               NULL,
+                                               ifsta->ssid, ifsta->ssid_len);
 
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
-       if (found)
+       if (bss)
                printk(KERN_DEBUG "   sta_find_ibss: selected %pM current "
-                      "%pM\n", bssid, ifsta->bssid);
+                      "%pM\n", bss->cbss.bssid, ifsta->bssid);
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
 
-       if (found && memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
+       if (bss &&
+           (!(ifsta->flags & IEEE80211_STA_PREV_BSSID_SET) ||
+            memcmp(ifsta->bssid, bss->cbss.bssid, ETH_ALEN))) {
                int ret;
-               int search_freq;
-
-               if (ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL)
-                       search_freq = bss->freq;
-               else
-                       search_freq = local->hw.conf.channel->center_freq;
-
-               bss = ieee80211_rx_bss_get(local, bssid, search_freq,
-                                          ifsta->ssid, ifsta->ssid_len);
-               if (!bss)
-                       goto dont_join;
 
                printk(KERN_DEBUG "%s: Selected IBSS BSSID %pM"
                       " based on configured SSID\n",
-                      sdata->dev->name, bssid);
+                      sdata->dev->name, bss->cbss.bssid);
+
                ret = ieee80211_sta_join_ibss(sdata, ifsta, bss);
                ieee80211_rx_bss_put(local, bss);
                return ret;
-       }
+       } else if (bss)
+               ieee80211_rx_bss_put(local, bss);
 
-dont_join:
 #ifdef CONFIG_MAC80211_IBSS_DEBUG
        printk(KERN_DEBUG "   did not try to join ibss\n");
 #endif /* CONFIG_MAC80211_IBSS_DEBUG */
@@ -2179,8 +2373,15 @@ dont_join:
                              IEEE80211_SCAN_INTERVAL)) {
                printk(KERN_DEBUG "%s: Trigger new scan to find an IBSS to "
                       "join\n", sdata->dev->name);
-               return ieee80211_request_scan(sdata, ifsta->ssid,
-                                             ifsta->ssid_len);
+
+               /* XXX maybe racy? */
+               if (local->scan_req)
+                       return -EBUSY;
+
+               memcpy(local->int_scan_req.ssids[0].ssid,
+                      ifsta->ssid, IEEE80211_MAX_SSID_LEN);
+               local->int_scan_req.ssids[0].ssid_len = ifsta->ssid_len;
+               return ieee80211_request_scan(sdata, &local->int_scan_req);
        } else if (ifsta->state != IEEE80211_STA_MLME_IBSS_JOINED) {
                int interval = IEEE80211_SCAN_INTERVAL;
 
@@ -2214,76 +2415,81 @@ static int ieee80211_sta_config_auth(struct ieee80211_sub_if_data *sdata,
                                     struct ieee80211_if_sta *ifsta)
 {
        struct ieee80211_local *local = sdata->local;
-       struct ieee80211_bss *bss, *selected = NULL;
-       int top_rssi = 0, freq;
-
-       spin_lock_bh(&local->bss_lock);
-       freq = local->oper_channel->center_freq;
-       list_for_each_entry(bss, &local->bss_list, list) {
-               if (!(bss->capability & WLAN_CAPABILITY_ESS))
-                       continue;
-
-               if ((ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL |
-                       IEEE80211_STA_AUTO_BSSID_SEL |
-                       IEEE80211_STA_AUTO_CHANNEL_SEL)) &&
-                   (!!(bss->capability & WLAN_CAPABILITY_PRIVACY) ^
-                    !!sdata->default_key))
-                       continue;
-
-               if (!(ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL) &&
-                   bss->freq != freq)
-                       continue;
-
-               if (!(ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL) &&
-                   memcmp(bss->bssid, ifsta->bssid, ETH_ALEN))
-                       continue;
-
-               if (!(ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) &&
-                   !ieee80211_sta_match_ssid(ifsta, bss->ssid, bss->ssid_len))
-                       continue;
-
-               if (!selected || top_rssi < bss->signal) {
-                       selected = bss;
-                       top_rssi = bss->signal;
-               }
+       struct ieee80211_bss *bss;
+       u8 *bssid = ifsta->bssid, *ssid = ifsta->ssid;
+       u8 ssid_len = ifsta->ssid_len;
+       u16 capa_mask = WLAN_CAPABILITY_ESS;
+       u16 capa_val = WLAN_CAPABILITY_ESS;
+       struct ieee80211_channel *chan = local->oper_channel;
+
+       if (ifsta->flags & (IEEE80211_STA_AUTO_SSID_SEL |
+                           IEEE80211_STA_AUTO_BSSID_SEL |
+                           IEEE80211_STA_AUTO_CHANNEL_SEL)) {
+               capa_mask |= WLAN_CAPABILITY_PRIVACY;
+               if (sdata->default_key)
+                       capa_val |= WLAN_CAPABILITY_PRIVACY;
        }
-       if (selected)
-               atomic_inc(&selected->users);
-       spin_unlock_bh(&local->bss_lock);
 
-       if (selected) {
-               ieee80211_set_freq(sdata, selected->freq);
+       if (ifsta->flags & IEEE80211_STA_AUTO_CHANNEL_SEL)
+               chan = NULL;
+
+       if (ifsta->flags & IEEE80211_STA_AUTO_BSSID_SEL)
+               bssid = NULL;
+
+       if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL) {
+               ssid = NULL;
+               ssid_len = 0;
+       }
+
+       bss = (void *)cfg80211_get_bss(local->hw.wiphy, chan,
+                                      bssid, ssid, ssid_len,
+                                      capa_mask, capa_val);
+
+       if (bss) {
+               ieee80211_set_freq(sdata, bss->cbss.channel->center_freq);
                if (!(ifsta->flags & IEEE80211_STA_SSID_SET))
-                       ieee80211_sta_set_ssid(sdata, selected->ssid,
-                                              selected->ssid_len);
-               ieee80211_sta_set_bssid(sdata, selected->bssid);
-               ieee80211_sta_def_wmm_params(sdata, selected);
+                       ieee80211_sta_set_ssid(sdata, bss->ssid,
+                                              bss->ssid_len);
+               ieee80211_sta_set_bssid(sdata, bss->cbss.bssid);
+               ieee80211_sta_def_wmm_params(sdata, bss->supp_rates_len,
+                                                   bss->supp_rates);
+               if (sdata->u.sta.mfp == IEEE80211_MFP_REQUIRED)
+                       sdata->u.sta.flags |= IEEE80211_STA_MFP_ENABLED;
+               else
+                       sdata->u.sta.flags &= ~IEEE80211_STA_MFP_ENABLED;
 
                /* Send out direct probe if no probe resp was received or
                 * the one we have is outdated
                 */
-               if (!selected->last_probe_resp ||
-                   time_after(jiffies, selected->last_probe_resp
+               if (!bss->last_probe_resp ||
+                   time_after(jiffies, bss->last_probe_resp
                                        + IEEE80211_SCAN_RESULT_EXPIRE))
                        ifsta->state = IEEE80211_STA_MLME_DIRECT_PROBE;
                else
                        ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
 
-               ieee80211_rx_bss_put(local, selected);
+               ieee80211_rx_bss_put(local, bss);
                ieee80211_sta_reset_auth(sdata, ifsta);
                return 0;
        } else {
                if (ifsta->assoc_scan_tries < IEEE80211_ASSOC_SCANS_MAX_TRIES) {
                        ifsta->assoc_scan_tries++;
+                       /* XXX maybe racy? */
+                       if (local->scan_req)
+                               return -1;
+                       memcpy(local->int_scan_req.ssids[0].ssid,
+                              ifsta->ssid, IEEE80211_MAX_SSID_LEN);
                        if (ifsta->flags & IEEE80211_STA_AUTO_SSID_SEL)
-                               ieee80211_start_scan(sdata, NULL, 0);
+                               local->int_scan_req.ssids[0].ssid_len = 0;
                        else
-                               ieee80211_start_scan(sdata, ifsta->ssid,
-                                                        ifsta->ssid_len);
+                               local->int_scan_req.ssids[0].ssid_len = ifsta->ssid_len;
+                       ieee80211_start_scan(sdata, &local->int_scan_req);
                        ifsta->state = IEEE80211_STA_MLME_AUTHENTICATE;
                        set_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request);
-               } else
+               } else {
+                       ifsta->assoc_scan_tries = 0;
                        ifsta->state = IEEE80211_STA_MLME_DISABLED;
+               }
        }
        return -1;
 }
@@ -2315,8 +2521,7 @@ static void ieee80211_sta_work(struct work_struct *work)
            ifsta->state != IEEE80211_STA_MLME_AUTHENTICATE &&
            ifsta->state != IEEE80211_STA_MLME_ASSOCIATE &&
            test_and_clear_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request)) {
-               ieee80211_start_scan(sdata, ifsta->scan_ssid,
-                                    ifsta->scan_ssid_len);
+               ieee80211_start_scan(sdata, local->scan_req);
                return;
        }
 
@@ -2376,8 +2581,11 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
 
        ifsta = &sdata->u.sta;
        INIT_WORK(&ifsta->work, ieee80211_sta_work);
+       INIT_WORK(&ifsta->chswitch_work, ieee80211_chswitch_work);
        setup_timer(&ifsta->timer, ieee80211_sta_timer,
                    (unsigned long) sdata);
+       setup_timer(&ifsta->chswitch_timer, ieee80211_chswitch_timer,
+                   (unsigned long) sdata);
        skb_queue_head_init(&ifsta->skb_queue);
 
        ifsta->capab = WLAN_CAPABILITY_ESS;
@@ -2396,7 +2604,7 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
  * must be callable in atomic context.
  */
 struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
-                                       u8 *bssid,u8 *addr, u64 supp_rates)
+                                       u8 *bssid,u8 *addr, u32 supp_rates)
 {
        struct ieee80211_local *local = sdata->local;
        struct sta_info *sta;
@@ -2474,16 +2682,16 @@ int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
                memset(ifsta->ssid, 0, sizeof(ifsta->ssid));
                memcpy(ifsta->ssid, ssid, len);
                ifsta->ssid_len = len;
-               ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
        }
 
+       ifsta->flags &= ~IEEE80211_STA_PREV_BSSID_SET;
+
        if (len)
                ifsta->flags |= IEEE80211_STA_SSID_SET;
        else
                ifsta->flags &= ~IEEE80211_STA_SSID_SET;
 
-       if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
-           !(ifsta->flags & IEEE80211_STA_BSSID_SET)) {
+       if (sdata->vif.type == NL80211_IFTYPE_ADHOC) {
                ifsta->ibss_join_req = jiffies;
                ifsta->state = IEEE80211_STA_MLME_IBSS_SEARCH;
                return ieee80211_sta_find_ibss(sdata, ifsta);
@@ -2503,31 +2711,25 @@ int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size
 int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid)
 {
        struct ieee80211_if_sta *ifsta;
-       int res;
 
        ifsta = &sdata->u.sta;
 
-       if (memcmp(ifsta->bssid, bssid, ETH_ALEN) != 0) {
+       if (is_valid_ether_addr(bssid)) {
                memcpy(ifsta->bssid, bssid, ETH_ALEN);
-               res = 0;
-               /*
-                * Hack! See also ieee80211_sta_set_ssid.
-                */
-               if (netif_running(sdata->dev))
-                       res = ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID);
-               if (res) {
+               ifsta->flags |= IEEE80211_STA_BSSID_SET;
+       } else {
+               memset(ifsta->bssid, 0, ETH_ALEN);
+               ifsta->flags &= ~IEEE80211_STA_BSSID_SET;
+       }
+
+       if (netif_running(sdata->dev)) {
+               if (ieee80211_if_config(sdata, IEEE80211_IFCC_BSSID)) {
                        printk(KERN_DEBUG "%s: Failed to config new BSSID to "
                               "the low-level driver\n", sdata->dev->name);
-                       return res;
                }
        }
 
-       if (is_valid_ether_addr(bssid))
-               ifsta->flags |= IEEE80211_STA_BSSID_SET;
-       else
-               ifsta->flags &= ~IEEE80211_STA_BSSID_SET;
-
-       return 0;
+       return ieee80211_sta_set_ssid(sdata, ifsta->ssid, ifsta->ssid_len);
 }
 
 int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len)
@@ -2590,9 +2792,8 @@ void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local)
 
        if (sdata && sdata->vif.type == NL80211_IFTYPE_ADHOC) {
                ifsta = &sdata->u.sta;
-               if (!(ifsta->flags & IEEE80211_STA_BSSID_SET) ||
-                   (!(ifsta->state == IEEE80211_STA_MLME_IBSS_JOINED) &&
-                   !ieee80211_sta_active_ibss(sdata)))
+               if ((!(ifsta->flags & IEEE80211_STA_PREV_BSSID_SET)) ||
+                   !ieee80211_sta_active_ibss(sdata))
                        ieee80211_sta_find_ibss(sdata, ifsta);
        }
 
@@ -2623,12 +2824,15 @@ void ieee80211_dynamic_ps_enable_work(struct work_struct *work)
        struct ieee80211_local *local =
                container_of(work, struct ieee80211_local,
                             dynamic_ps_enable_work);
+       struct ieee80211_sub_if_data *sdata = local->scan_sdata;
 
        if (local->hw.conf.flags & IEEE80211_CONF_PS)
                return;
 
-       local->hw.conf.flags |= IEEE80211_CONF_PS;
+       if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
+               ieee80211_send_nullfunc(local, sdata, 1);
 
+       local->hw.conf.flags |= IEEE80211_CONF_PS;
        ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
 }
 
diff --git a/net/mac80211/pm.c b/net/mac80211/pm.c
new file mode 100644 (file)
index 0000000..44525f5
--- /dev/null
@@ -0,0 +1,117 @@
+#include <net/mac80211.h>
+#include <net/rtnetlink.h>
+
+#include "ieee80211_i.h"
+#include "led.h"
+
+int __ieee80211_suspend(struct ieee80211_hw *hw)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct ieee80211_sub_if_data *sdata;
+       struct ieee80211_if_init_conf conf;
+       struct sta_info *sta;
+
+       flush_workqueue(local->hw.workqueue);
+
+       /* disable keys */
+       list_for_each_entry(sdata, &local->interfaces, list)
+               ieee80211_disable_keys(sdata);
+
+       /* remove STAs */
+       list_for_each_entry(sta, &local->sta_list, list) {
+
+               if (local->ops->sta_notify) {
+                       if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+                               sdata = container_of(sdata->bss,
+                                            struct ieee80211_sub_if_data,
+                                            u.ap);
+
+                       local->ops->sta_notify(hw, &sdata->vif,
+                               STA_NOTIFY_REMOVE, &sta->sta);
+               }
+       }
+
+       /* remove all interfaces */
+       list_for_each_entry(sdata, &local->interfaces, list) {
+
+               if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
+                   sdata->vif.type != NL80211_IFTYPE_MONITOR &&
+                   netif_running(sdata->dev)) {
+                       conf.vif = &sdata->vif;
+                       conf.type = sdata->vif.type;
+                       conf.mac_addr = sdata->dev->dev_addr;
+                       local->ops->remove_interface(hw, &conf);
+               }
+       }
+
+       /* flush again, in case driver queued work */
+       flush_workqueue(local->hw.workqueue);
+
+       /* stop hardware */
+       if (local->open_count) {
+               ieee80211_led_radio(local, false);
+               local->ops->stop(hw);
+       }
+       return 0;
+}
+
+int __ieee80211_resume(struct ieee80211_hw *hw)
+{
+       struct ieee80211_local *local = hw_to_local(hw);
+       struct ieee80211_sub_if_data *sdata;
+       struct ieee80211_if_init_conf conf;
+       struct sta_info *sta;
+       int res;
+
+       /* restart hardware */
+       if (local->open_count) {
+               res = local->ops->start(hw);
+
+               ieee80211_led_radio(local, hw->conf.radio_enabled);
+       }
+
+       /* add interfaces */
+       list_for_each_entry(sdata, &local->interfaces, list) {
+
+               if (sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
+                   sdata->vif.type != NL80211_IFTYPE_MONITOR &&
+                   netif_running(sdata->dev)) {
+                       conf.vif = &sdata->vif;
+                       conf.type = sdata->vif.type;
+                       conf.mac_addr = sdata->dev->dev_addr;
+                       res = local->ops->add_interface(hw, &conf);
+               }
+       }
+
+       /* add STAs back */
+       list_for_each_entry(sta, &local->sta_list, list) {
+
+               if (local->ops->sta_notify) {
+                       if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN)
+                               sdata = container_of(sdata->bss,
+                                            struct ieee80211_sub_if_data,
+                                            u.ap);
+
+                       local->ops->sta_notify(hw, &sdata->vif,
+                               STA_NOTIFY_ADD, &sta->sta);
+               }
+       }
+
+       /* add back keys */
+       list_for_each_entry(sdata, &local->interfaces, list)
+               if (netif_running(sdata->dev))
+                       ieee80211_enable_keys(sdata);
+
+       /* setup RTS threshold */
+       if (local->ops->set_rts_threshold)
+               local->ops->set_rts_threshold(hw, local->rts_threshold);
+
+       /* reconfigure hardware */
+       ieee80211_hw_config(local, ~0);
+
+       netif_addr_lock_bh(local->mdev);
+       ieee80211_configure_filter(local);
+       netif_addr_unlock_bh(local->mdev);
+
+       return 0;
+}
index 7175ae80c36a3b3a513fd1f5040643e595401a5c..1327d424bf3138675b69588cfb513145768a5323 100644 (file)
@@ -86,8 +86,7 @@ ieee80211_rx_radiotap_len(struct ieee80211_local *local,
 
        if (status->flag & RX_FLAG_TSFT)
                len += 8;
-       if (local->hw.flags & IEEE80211_HW_SIGNAL_DB ||
-           local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
+       if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
                len += 1;
        if (local->hw.flags & IEEE80211_HW_NOISE_DBM)
                len += 1;
@@ -102,7 +101,7 @@ ieee80211_rx_radiotap_len(struct ieee80211_local *local,
        return len;
 }
 
-/**
+/*
  * ieee80211_add_rx_radiotap_header - add radiotap header
  *
  * add a radiotap header containing all the fields which the hardware provided.
@@ -158,7 +157,7 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
                 */
                *pos = 0;
        } else {
-               rthdr->it_present |= (1 << IEEE80211_RADIOTAP_RATE);
+               rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE);
                *pos = rate->bitrate / 5;
        }
        pos++;
@@ -199,14 +198,6 @@ ieee80211_add_rx_radiotap_header(struct ieee80211_local *local,
        *pos = status->antenna;
        pos++;
 
-       /* IEEE80211_RADIOTAP_DB_ANTSIGNAL */
-       if (local->hw.flags & IEEE80211_HW_SIGNAL_DB) {
-               *pos = status->signal;
-               rthdr->it_present |=
-                       cpu_to_le32(1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL);
-               pos++;
-       }
-
        /* IEEE80211_RADIOTAP_DB_ANTNOISE is not used */
 
        /* IEEE80211_RADIOTAP_RX_FLAGS */
@@ -371,39 +362,50 @@ static void ieee80211_parse_qos(struct ieee80211_rx_data *rx)
        rx->skb->priority = (tid > 7) ? 0 : tid;
 }
 
-static void ieee80211_verify_ip_alignment(struct ieee80211_rx_data *rx)
+/**
+ * DOC: Packet alignment
+ *
+ * Drivers always need to pass packets that are aligned to two-byte boundaries
+ * to the stack.
+ *
+ * Additionally, should, if possible, align the payload data in a way that
+ * guarantees that the contained IP header is aligned to a four-byte
+ * boundary. In the case of regular frames, this simply means aligning the
+ * payload to a four-byte boundary (because either the IP header is directly
+ * contained, or IV/RFC1042 headers that have a length divisible by four are
+ * in front of it).
+ *
+ * With A-MSDU frames, however, the payload data address must yield two modulo
+ * four because there are 14-byte 802.3 headers within the A-MSDU frames that
+ * push the IP header further back to a multiple of four again. Thankfully, the
+ * specs were sane enough this time around to require padding each A-MSDU
+ * subframe to a length that is a multiple of four.
+ *
+ * Padding like Atheros hardware adds which is inbetween the 802.11 header and
+ * the payload is not supported, the driver is required to move the 802.11
+ * header to be directly in front of the payload in that case.
+ */
+static void ieee80211_verify_alignment(struct ieee80211_rx_data *rx)
 {
-#ifdef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
        struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)rx->skb->data;
        int hdrlen;
 
+#ifndef CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT
+       return;
+#endif
+
+       if (WARN_ONCE((unsigned long)rx->skb->data & 1,
+                     "unaligned packet at 0x%p\n", rx->skb->data))
+               return;
+
        if (!ieee80211_is_data_present(hdr->frame_control))
                return;
 
-       /*
-        * Drivers are required to align the payload data in a way that
-        * guarantees that the contained IP header is aligned to a four-
-        * byte boundary. In the case of regular frames, this simply means
-        * aligning the payload to a four-byte boundary (because either
-        * the IP header is directly contained, or IV/RFC1042 headers that
-        * have a length divisible by four are in front of it.
-        *
-        * With A-MSDU frames, however, the payload data address must
-        * yield two modulo four because there are 14-byte 802.3 headers
-        * within the A-MSDU frames that push the IP header further back
-        * to a multiple of four again. Thankfully, the specs were sane
-        * enough this time around to require padding each A-MSDU subframe
-        * to a length that is a multiple of four.
-        *
-        * Padding like atheros hardware adds which is inbetween the 802.11
-        * header and the payload is not supported, the driver is required
-        * to move the 802.11 header further back in that case.
-        */
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
        if (rx->flags & IEEE80211_RX_AMSDU)
                hdrlen += ETH_HLEN;
-       WARN_ON_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3);
-#endif
+       WARN_ONCE(((unsigned long)(rx->skb->data + hdrlen)) & 3,
+                 "unaligned IP payload at 0x%p\n", rx->skb->data + hdrlen);
 }
 
 
@@ -435,6 +437,52 @@ ieee80211_rx_h_passive_scan(struct ieee80211_rx_data *rx)
        return RX_CONTINUE;
 }
 
+
+static int ieee80211_is_unicast_robust_mgmt_frame(struct sk_buff *skb)
+{
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+
+       if (skb->len < 24 || is_multicast_ether_addr(hdr->addr1))
+               return 0;
+
+       return ieee80211_is_robust_mgmt_frame(hdr);
+}
+
+
+static int ieee80211_is_multicast_robust_mgmt_frame(struct sk_buff *skb)
+{
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+
+       if (skb->len < 24 || !is_multicast_ether_addr(hdr->addr1))
+               return 0;
+
+       return ieee80211_is_robust_mgmt_frame(hdr);
+}
+
+
+/* Get the BIP key index from MMIE; return -1 if this is not a BIP frame */
+static int ieee80211_get_mmie_keyidx(struct sk_buff *skb)
+{
+       struct ieee80211_mgmt *hdr = (struct ieee80211_mgmt *) skb->data;
+       struct ieee80211_mmie *mmie;
+
+       if (skb->len < 24 + sizeof(*mmie) ||
+           !is_multicast_ether_addr(hdr->da))
+               return -1;
+
+       if (!ieee80211_is_robust_mgmt_frame((struct ieee80211_hdr *) hdr))
+               return -1; /* not a robust management frame */
+
+       mmie = (struct ieee80211_mmie *)
+               (skb->data + skb->len - sizeof(*mmie));
+       if (mmie->element_id != WLAN_EID_MMIE ||
+           mmie->length != sizeof(*mmie) - 2)
+               return -1;
+
+       return le16_to_cpu(mmie->key_id);
+}
+
+
 static ieee80211_rx_result
 ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx)
 {
@@ -550,21 +598,23 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
        int hdrlen;
        ieee80211_rx_result result = RX_DROP_UNUSABLE;
        struct ieee80211_key *stakey = NULL;
+       int mmie_keyidx = -1;
 
        /*
         * Key selection 101
         *
-        * There are three types of keys:
+        * There are four types of keys:
         *  - GTK (group keys)
+        *  - IGTK (group keys for management frames)
         *  - PTK (pairwise keys)
         *  - STK (station-to-station pairwise keys)
         *
         * When selecting a key, we have to distinguish between multicast
         * (including broadcast) and unicast frames, the latter can only
-        * use PTKs and STKs while the former always use GTKs. Unless, of
-        * course, actual WEP keys ("pre-RSNA") are used, then unicast
-        * frames can also use key indizes like GTKs. Hence, if we don't
-        * have a PTK/STK we check the key index for a WEP key.
+        * use PTKs and STKs while the former always use GTKs and IGTKs.
+        * Unless, of course, actual WEP keys ("pre-RSNA") are used, then
+        * unicast frames can also use key indices like GTKs. Hence, if we
+        * don't have a PTK/STK we check the key index for a WEP key.
         *
         * Note that in a regular BSS, multicast frames are sent by the
         * AP only, associated stations unicast the frame to the AP first
@@ -577,8 +627,14 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
         * possible.
         */
 
-       if (!ieee80211_has_protected(hdr->frame_control))
-               return RX_CONTINUE;
+       if (!ieee80211_has_protected(hdr->frame_control)) {
+               if (!ieee80211_is_mgmt(hdr->frame_control) ||
+                   rx->sta == NULL || !test_sta_flags(rx->sta, WLAN_STA_MFP))
+                       return RX_CONTINUE;
+               mmie_keyidx = ieee80211_get_mmie_keyidx(rx->skb);
+               if (mmie_keyidx < 0)
+                       return RX_CONTINUE;
+       }
 
        /*
         * No point in finding a key and decrypting if the frame is neither
@@ -592,6 +648,16 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
 
        if (!is_multicast_ether_addr(hdr->addr1) && stakey) {
                rx->key = stakey;
+       } else if (mmie_keyidx >= 0) {
+               /* Broadcast/multicast robust management frame / BIP */
+               if ((rx->status->flag & RX_FLAG_DECRYPTED) &&
+                   (rx->status->flag & RX_FLAG_IV_STRIPPED))
+                       return RX_CONTINUE;
+
+               if (mmie_keyidx < NUM_DEFAULT_KEYS ||
+                   mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS)
+                       return RX_DROP_MONITOR; /* unexpected BIP keyidx */
+               rx->key = rcu_dereference(rx->sdata->keys[mmie_keyidx]);
        } else {
                /*
                 * The device doesn't give us the IV so we won't be
@@ -654,6 +720,9 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
        case ALG_CCMP:
                result = ieee80211_crypto_ccmp_decrypt(rx);
                break;
+       case ALG_AES_CMAC:
+               result = ieee80211_crypto_aes_cmac_decrypt(rx);
+               break;
        }
 
        /* either the frame has been decrypted or will be dropped */
@@ -662,6 +731,39 @@ ieee80211_rx_h_decrypt(struct ieee80211_rx_data *rx)
        return result;
 }
 
+static ieee80211_rx_result debug_noinline
+ieee80211_rx_h_check_more_data(struct ieee80211_rx_data *rx)
+{
+       struct ieee80211_local *local;
+       struct ieee80211_hdr *hdr;
+       struct sk_buff *skb;
+
+       local = rx->local;
+       skb = rx->skb;
+       hdr = (struct ieee80211_hdr *) skb->data;
+
+       if (!local->pspolling)
+               return RX_CONTINUE;
+
+       if (!ieee80211_has_fromds(hdr->frame_control))
+               /* this is not from AP */
+               return RX_CONTINUE;
+
+       if (!ieee80211_is_data(hdr->frame_control))
+               return RX_CONTINUE;
+
+       if (!ieee80211_has_moredata(hdr->frame_control)) {
+               /* AP has no more frames buffered for us */
+               local->pspolling = false;
+               return RX_CONTINUE;
+       }
+
+       /* more data bit is set, let's request a new frame from the AP */
+       ieee80211_send_pspoll(local, rx->sdata);
+
+       return RX_CONTINUE;
+}
+
 static void ap_sta_ps_start(struct sta_info *sta)
 {
        struct ieee80211_sub_if_data *sdata = sta->sdata;
@@ -1101,6 +1203,15 @@ ieee80211_drop_unencrypted(struct ieee80211_rx_data *rx, __le16 fc)
        /* Drop unencrypted frames if key is set. */
        if (unlikely(!ieee80211_has_protected(fc) &&
                     !ieee80211_is_nullfunc(fc) &&
+                    (!ieee80211_is_mgmt(fc) ||
+                     (ieee80211_is_unicast_robust_mgmt_frame(rx->skb) &&
+                      rx->sta && test_sta_flags(rx->sta, WLAN_STA_MFP))) &&
+                    (rx->key || rx->sdata->drop_unencrypted)))
+               return -EACCES;
+       /* BIP does not use Protected field, so need to check MMIE */
+       if (unlikely(rx->sta && test_sta_flags(rx->sta, WLAN_STA_MFP) &&
+                    ieee80211_is_multicast_robust_mgmt_frame(rx->skb) &&
+                    ieee80211_get_mmie_keyidx(rx->skb) < 0 &&
                     (rx->key || rx->sdata->drop_unencrypted)))
                return -EACCES;
 
@@ -1138,12 +1249,12 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
 
        switch (hdr->frame_control &
                cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
-       case __constant_cpu_to_le16(IEEE80211_FCTL_TODS):
+       case cpu_to_le16(IEEE80211_FCTL_TODS):
                if (unlikely(sdata->vif.type != NL80211_IFTYPE_AP &&
                             sdata->vif.type != NL80211_IFTYPE_AP_VLAN))
                        return -1;
                break;
-       case __constant_cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
+       case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
                if (unlikely(sdata->vif.type != NL80211_IFTYPE_WDS &&
                             sdata->vif.type != NL80211_IFTYPE_MESH_POINT))
                        return -1;
@@ -1157,13 +1268,13 @@ ieee80211_data_to_8023(struct ieee80211_rx_data *rx)
                        }
                }
                break;
-       case __constant_cpu_to_le16(IEEE80211_FCTL_FROMDS):
+       case cpu_to_le16(IEEE80211_FCTL_FROMDS):
                if (sdata->vif.type != NL80211_IFTYPE_STATION ||
                    (is_multicast_ether_addr(dst) &&
                     !compare_ether_addr(src, dev->dev_addr)))
                        return -1;
                break;
-       case __constant_cpu_to_le16(0):
+       case cpu_to_le16(0):
                if (sdata->vif.type != NL80211_IFTYPE_ADHOC)
                        return -1;
                break;
@@ -1267,10 +1378,37 @@ ieee80211_deliver_skb(struct ieee80211_rx_data *rx)
        }
 
        if (skb) {
-               /* deliver to local stack */
-               skb->protocol = eth_type_trans(skb, dev);
-               memset(skb->cb, 0, sizeof(skb->cb));
-               netif_rx(skb);
+               int align __maybe_unused;
+
+#if defined(CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT) || !defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)
+               /*
+                * 'align' will only take the values 0 or 2 here
+                * since all frames are required to be aligned
+                * to 2-byte boundaries when being passed to
+                * mac80211. That also explains the __skb_push()
+                * below.
+                */
+               align = (unsigned long)skb->data & 4;
+               if (align) {
+                       if (WARN_ON(skb_headroom(skb) < 3)) {
+                               dev_kfree_skb(skb);
+                               skb = NULL;
+                       } else {
+                               u8 *data = skb->data;
+                               size_t len = skb->len;
+                               u8 *new = __skb_push(skb, align);
+                               memmove(new, data, len);
+                               __skb_trim(skb, len);
+                       }
+               }
+#endif
+
+               if (skb) {
+                       /* deliver to local stack */
+                       skb->protocol = eth_type_trans(skb, dev);
+                       memset(skb->cb, 0, sizeof(skb->cb));
+                       netif_rx(skb);
+               }
        }
 
        if (xmit_skb) {
@@ -1339,14 +1477,20 @@ ieee80211_rx_h_amsdu(struct ieee80211_rx_data *rx)
                if (remaining <= subframe_len + padding)
                        frame = skb;
                else {
-                       frame = dev_alloc_skb(local->hw.extra_tx_headroom +
-                                             subframe_len);
+                       /*
+                        * Allocate and reserve two bytes more for payload
+                        * alignment since sizeof(struct ethhdr) is 14.
+                        */
+                       frame = dev_alloc_skb(
+                               ALIGN(local->hw.extra_tx_headroom, 4) +
+                               subframe_len + 2);
 
                        if (frame == NULL)
                                return RX_DROP_UNUSABLE;
 
-                       skb_reserve(frame, local->hw.extra_tx_headroom +
-                                   sizeof(struct ethhdr));
+                       skb_reserve(frame,
+                                   ALIGN(local->hw.extra_tx_headroom, 4) +
+                                   sizeof(struct ethhdr) + 2);
                        memcpy(skb_put(frame, ntohs(len)), skb->data,
                                ntohs(len));
 
@@ -1529,11 +1673,9 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
                start_seq_num = le16_to_cpu(bar->start_seq_num) >> 4;
 
                /* reset session timer */
-               if (tid_agg_rx->timeout) {
-                       unsigned long expires =
-                               jiffies + (tid_agg_rx->timeout / 1000) * HZ;
-                       mod_timer(&tid_agg_rx->session_timer, expires);
-               }
+               if (tid_agg_rx->timeout)
+                       mod_timer(&tid_agg_rx->session_timer,
+                                 TU_TO_EXP_TIME(tid_agg_rx->timeout));
 
                /* manage reordering buffer according to requested */
                /* sequence number */
@@ -1547,12 +1689,65 @@ ieee80211_rx_h_ctrl(struct ieee80211_rx_data *rx)
        return RX_CONTINUE;
 }
 
+static void ieee80211_process_sa_query_req(struct ieee80211_sub_if_data *sdata,
+                                          struct ieee80211_mgmt *mgmt,
+                                          size_t len)
+{
+       struct ieee80211_local *local = sdata->local;
+       struct sk_buff *skb;
+       struct ieee80211_mgmt *resp;
+
+       if (compare_ether_addr(mgmt->da, sdata->dev->dev_addr) != 0) {
+               /* Not to own unicast address */
+               return;
+       }
+
+       if (compare_ether_addr(mgmt->sa, sdata->u.sta.bssid) != 0 ||
+           compare_ether_addr(mgmt->bssid, sdata->u.sta.bssid) != 0) {
+               /* Not from the current AP. */
+               return;
+       }
+
+       if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATE) {
+               /* Association in progress; ignore SA Query */
+               return;
+       }
+
+       if (len < 24 + 1 + sizeof(resp->u.action.u.sa_query)) {
+               /* Too short SA Query request frame */
+               return;
+       }
+
+       skb = dev_alloc_skb(sizeof(*resp) + local->hw.extra_tx_headroom);
+       if (skb == NULL)
+               return;
+
+       skb_reserve(skb, local->hw.extra_tx_headroom);
+       resp = (struct ieee80211_mgmt *) skb_put(skb, 24);
+       memset(resp, 0, 24);
+       memcpy(resp->da, mgmt->sa, ETH_ALEN);
+       memcpy(resp->sa, sdata->dev->dev_addr, ETH_ALEN);
+       memcpy(resp->bssid, sdata->u.sta.bssid, ETH_ALEN);
+       resp->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+                                         IEEE80211_STYPE_ACTION);
+       skb_put(skb, 1 + sizeof(resp->u.action.u.sa_query));
+       resp->u.action.category = WLAN_CATEGORY_SA_QUERY;
+       resp->u.action.u.sa_query.action = WLAN_ACTION_SA_QUERY_RESPONSE;
+       memcpy(resp->u.action.u.sa_query.trans_id,
+              mgmt->u.action.u.sa_query.trans_id,
+              WLAN_SA_QUERY_TR_ID_LEN);
+
+       ieee80211_tx_skb(sdata, skb, 1);
+}
+
 static ieee80211_rx_result debug_noinline
 ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
 {
        struct ieee80211_local *local = rx->local;
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
+       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
        struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data;
+       struct ieee80211_bss *bss;
        int len = rx->skb->len;
 
        if (!ieee80211_is_action(mgmt->frame_control))
@@ -1564,12 +1759,26 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
        if (!(rx->flags & IEEE80211_RX_RA_MATCH))
                return RX_DROP_MONITOR;
 
+       if (ieee80211_drop_unencrypted(rx, mgmt->frame_control))
+               return RX_DROP_MONITOR;
+
        /* all categories we currently handle have action_code */
        if (len < IEEE80211_MIN_ACTION_SIZE + 1)
                return RX_DROP_MONITOR;
 
        switch (mgmt->u.action.category) {
        case WLAN_CATEGORY_BACK:
+               /*
+                * The aggregation code is not prepared to handle
+                * anything but STA/AP due to the BSSID handling;
+                * IBSS could work in the code but isn't supported
+                * by drivers or the standard.
+                */
+               if (sdata->vif.type != NL80211_IFTYPE_STATION &&
+                   sdata->vif.type != NL80211_IFTYPE_AP_VLAN &&
+                   sdata->vif.type != NL80211_IFTYPE_AP)
+                       return RX_DROP_MONITOR;
+
                switch (mgmt->u.action.u.addba_req.action_code) {
                case WLAN_ACTION_ADDBA_REQ:
                        if (len < (IEEE80211_MIN_ACTION_SIZE +
@@ -1601,6 +1810,42 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
                                return RX_DROP_MONITOR;
                        ieee80211_process_measurement_req(sdata, mgmt, len);
                        break;
+               case WLAN_ACTION_SPCT_CHL_SWITCH:
+                       if (len < (IEEE80211_MIN_ACTION_SIZE +
+                                  sizeof(mgmt->u.action.u.chan_switch)))
+                               return RX_DROP_MONITOR;
+
+                       if (memcmp(mgmt->bssid, ifsta->bssid, ETH_ALEN) != 0)
+                               return RX_DROP_MONITOR;
+
+                       bss = ieee80211_rx_bss_get(local, ifsta->bssid,
+                                          local->hw.conf.channel->center_freq,
+                                          ifsta->ssid, ifsta->ssid_len);
+                       if (!bss)
+                               return RX_DROP_MONITOR;
+
+                       ieee80211_process_chanswitch(sdata,
+                                    &mgmt->u.action.u.chan_switch.sw_elem, bss);
+                       ieee80211_rx_bss_put(local, bss);
+                       break;
+               }
+               break;
+       case WLAN_CATEGORY_SA_QUERY:
+               if (len < (IEEE80211_MIN_ACTION_SIZE +
+                          sizeof(mgmt->u.action.u.sa_query)))
+                       return RX_DROP_MONITOR;
+               switch (mgmt->u.action.u.sa_query.action) {
+               case WLAN_ACTION_SA_QUERY_REQUEST:
+                       if (sdata->vif.type != NL80211_IFTYPE_STATION)
+                               return RX_DROP_MONITOR;
+                       ieee80211_process_sa_query_req(sdata, mgmt, len);
+                       break;
+               case WLAN_ACTION_SA_QUERY_RESPONSE:
+                       /*
+                        * SA Query response is currently only used in AP mode
+                        * and it is processed in user space.
+                        */
+                       return RX_CONTINUE;
                }
                break;
        default:
@@ -1616,10 +1861,14 @@ static ieee80211_rx_result debug_noinline
 ieee80211_rx_h_mgmt(struct ieee80211_rx_data *rx)
 {
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(rx->dev);
+       struct ieee80211_mgmt *mgmt = (struct ieee80211_mgmt *) rx->skb->data;
 
        if (!(rx->flags & IEEE80211_RX_RA_MATCH))
                return RX_DROP_MONITOR;
 
+       if (ieee80211_drop_unencrypted(rx, mgmt->frame_control))
+               return RX_DROP_MONITOR;
+
        if (ieee80211_vif_is_mesh(&sdata->vif))
                return ieee80211_mesh_rx_mgmt(sdata, rx->skb, rx->status);
 
@@ -1780,6 +2029,7 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
        CALL_RXH(ieee80211_rx_h_passive_scan)
        CALL_RXH(ieee80211_rx_h_check)
        CALL_RXH(ieee80211_rx_h_decrypt)
+       CALL_RXH(ieee80211_rx_h_check_more_data)
        CALL_RXH(ieee80211_rx_h_sta_process)
        CALL_RXH(ieee80211_rx_h_defragment)
        CALL_RXH(ieee80211_rx_h_ps_poll)
@@ -1823,9 +2073,10 @@ static void ieee80211_invoke_rx_handlers(struct ieee80211_sub_if_data *sdata,
 /* main receive path */
 
 static int prepare_for_handlers(struct ieee80211_sub_if_data *sdata,
-                               u8 *bssid, struct ieee80211_rx_data *rx,
+                               struct ieee80211_rx_data *rx,
                                struct ieee80211_hdr *hdr)
 {
+       u8 *bssid = ieee80211_get_bssid(hdr, rx->skb->len, sdata->vif.type);
        int multicast = is_multicast_ether_addr(hdr->addr1);
 
        switch (sdata->vif.type) {
@@ -1928,7 +2179,6 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
        int prepares;
        struct ieee80211_sub_if_data *prev = NULL;
        struct sk_buff *skb_new;
-       u8 *bssid;
 
        hdr = (struct ieee80211_hdr *)skb->data;
        memset(&rx, 0, sizeof(rx));
@@ -1956,7 +2206,7 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
                rx.flags |= IEEE80211_RX_IN_SCAN;
 
        ieee80211_parse_qos(&rx);
-       ieee80211_verify_ip_alignment(&rx);
+       ieee80211_verify_alignment(&rx);
 
        skb = rx.skb;
 
@@ -1967,9 +2217,8 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw,
                if (sdata->vif.type == NL80211_IFTYPE_MONITOR)
                        continue;
 
-               bssid = ieee80211_get_bssid(hdr, skb->len, sdata->vif.type);
                rx.flags |= IEEE80211_RX_RA_MATCH;
-               prepares = prepare_for_handlers(sdata, bssid, &rx, hdr);
+               prepares = prepare_for_handlers(sdata, &rx, hdr);
 
                if (!prepares)
                        continue;
@@ -2174,11 +2423,9 @@ static u8 ieee80211_rx_reorder_ampdu(struct ieee80211_local *local,
        /* new un-ordered ampdu frame - process it */
 
        /* reset session timer */
-       if (tid_agg_rx->timeout) {
-               unsigned long expires =
-                       jiffies + (tid_agg_rx->timeout / 1000) * HZ;
-               mod_timer(&tid_agg_rx->session_timer, expires);
-       }
+       if (tid_agg_rx->timeout)
+               mod_timer(&tid_agg_rx->session_timer,
+                         TU_TO_EXP_TIME(tid_agg_rx->timeout));
 
        /* if this mpdu is fragmented - terminate rx aggregation session */
        sc = le16_to_cpu(hdr->seq_ctrl);
index f5c7c3371929a5c41651bcbefa45771149b5c2d4..f883ab9f1e6e436de1f4a311963410a341a931cd 100644 (file)
  * published by the Free Software Foundation.
  */
 
-/* TODO:
- * order BSS list by RSSI(?) ("quality of AP")
- * scan result table filtering (by capability (privacy, IBSS/BSS, WPA/RSN IE,
- *    SSID)
- */
+/* TODO: figure out how to avoid that the "current BSS" expires */
 
 #include <linux/wireless.h>
 #include <linux/if_arp.h>
+#include <linux/rtnetlink.h>
 #include <net/mac80211.h>
 #include <net/iw_handler.h>
 
 #define IEEE80211_CHANNEL_TIME (HZ / 33)
 #define IEEE80211_PASSIVE_CHANNEL_TIME (HZ / 5)
 
-void ieee80211_rx_bss_list_init(struct ieee80211_local *local)
-{
-       spin_lock_init(&local->bss_lock);
-       INIT_LIST_HEAD(&local->bss_list);
-}
-
-void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local)
-{
-       struct ieee80211_bss *bss, *tmp;
-
-       list_for_each_entry_safe(bss, tmp, &local->bss_list, list)
-               ieee80211_rx_bss_put(local, bss);
-}
-
 struct ieee80211_bss *
 ieee80211_rx_bss_get(struct ieee80211_local *local, u8 *bssid, int freq,
                     u8 *ssid, u8 ssid_len)
 {
-       struct ieee80211_bss *bss;
-
-       spin_lock_bh(&local->bss_lock);
-       bss = local->bss_hash[STA_HASH(bssid)];
-       while (bss) {
-               if (!bss_mesh_cfg(bss) &&
-                   !memcmp(bss->bssid, bssid, ETH_ALEN) &&
-                   bss->freq == freq &&
-                   bss->ssid_len == ssid_len &&
-                   (ssid_len == 0 || !memcmp(bss->ssid, ssid, ssid_len))) {
-                       atomic_inc(&bss->users);
-                       break;
-               }
-               bss = bss->hnext;
-       }
-       spin_unlock_bh(&local->bss_lock);
-       return bss;
-}
-
-/* Caller must hold local->bss_lock */
-static void __ieee80211_rx_bss_hash_add(struct ieee80211_local *local,
-                                       struct ieee80211_bss *bss)
-{
-       u8 hash_idx;
-
-       if (bss_mesh_cfg(bss))
-               hash_idx = mesh_id_hash(bss_mesh_id(bss),
-                                       bss_mesh_id_len(bss));
-       else
-               hash_idx = STA_HASH(bss->bssid);
-
-       bss->hnext = local->bss_hash[hash_idx];
-       local->bss_hash[hash_idx] = bss;
-}
-
-/* Caller must hold local->bss_lock */
-static void __ieee80211_rx_bss_hash_del(struct ieee80211_local *local,
-                                       struct ieee80211_bss *bss)
-{
-       struct ieee80211_bss *b, *prev = NULL;
-       b = local->bss_hash[STA_HASH(bss->bssid)];
-       while (b) {
-               if (b == bss) {
-                       if (!prev)
-                               local->bss_hash[STA_HASH(bss->bssid)] =
-                                       bss->hnext;
-                       else
-                               prev->hnext = bss->hnext;
-                       break;
-               }
-               prev = b;
-               b = b->hnext;
-       }
-}
-
-struct ieee80211_bss *
-ieee80211_rx_bss_add(struct ieee80211_local *local, u8 *bssid, int freq,
-                    u8 *ssid, u8 ssid_len)
-{
-       struct ieee80211_bss *bss;
-
-       bss = kzalloc(sizeof(*bss), GFP_ATOMIC);
-       if (!bss)
-               return NULL;
-       atomic_set(&bss->users, 2);
-       memcpy(bss->bssid, bssid, ETH_ALEN);
-       bss->freq = freq;
-       if (ssid && ssid_len <= IEEE80211_MAX_SSID_LEN) {
-               memcpy(bss->ssid, ssid, ssid_len);
-               bss->ssid_len = ssid_len;
-       }
-
-       spin_lock_bh(&local->bss_lock);
-       /* TODO: order by RSSI? */
-       list_add_tail(&bss->list, &local->bss_list);
-       __ieee80211_rx_bss_hash_add(local, bss);
-       spin_unlock_bh(&local->bss_lock);
-       return bss;
-}
-
-#ifdef CONFIG_MAC80211_MESH
-static struct ieee80211_bss *
-ieee80211_rx_mesh_bss_get(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len,
-                         u8 *mesh_cfg, int freq)
-{
-       struct ieee80211_bss *bss;
-
-       spin_lock_bh(&local->bss_lock);
-       bss = local->bss_hash[mesh_id_hash(mesh_id, mesh_id_len)];
-       while (bss) {
-               if (bss_mesh_cfg(bss) &&
-                   !memcmp(bss_mesh_cfg(bss), mesh_cfg, MESH_CFG_CMP_LEN) &&
-                   bss->freq == freq &&
-                   mesh_id_len == bss->mesh_id_len &&
-                   (mesh_id_len == 0 || !memcmp(bss->mesh_id, mesh_id,
-                                                mesh_id_len))) {
-                       atomic_inc(&bss->users);
-                       break;
-               }
-               bss = bss->hnext;
-       }
-       spin_unlock_bh(&local->bss_lock);
-       return bss;
+       return (void *)cfg80211_get_bss(local->hw.wiphy,
+                                       ieee80211_get_channel(local->hw.wiphy,
+                                                             freq),
+                                       bssid, ssid, ssid_len,
+                                       0, 0);
 }
 
-static struct ieee80211_bss *
-ieee80211_rx_mesh_bss_add(struct ieee80211_local *local, u8 *mesh_id, int mesh_id_len,
-                         u8 *mesh_cfg, int mesh_config_len, int freq)
+static void ieee80211_rx_bss_free(struct cfg80211_bss *cbss)
 {
-       struct ieee80211_bss *bss;
-
-       if (mesh_config_len != IEEE80211_MESH_CONFIG_LEN)
-               return NULL;
-
-       bss = kzalloc(sizeof(*bss), GFP_ATOMIC);
-       if (!bss)
-               return NULL;
-
-       bss->mesh_cfg = kmalloc(MESH_CFG_CMP_LEN, GFP_ATOMIC);
-       if (!bss->mesh_cfg) {
-               kfree(bss);
-               return NULL;
-       }
-
-       if (mesh_id_len && mesh_id_len <= IEEE80211_MAX_MESH_ID_LEN) {
-               bss->mesh_id = kmalloc(mesh_id_len, GFP_ATOMIC);
-               if (!bss->mesh_id) {
-                       kfree(bss->mesh_cfg);
-                       kfree(bss);
-                       return NULL;
-               }
-               memcpy(bss->mesh_id, mesh_id, mesh_id_len);
-       }
+       struct ieee80211_bss *bss = (void *)cbss;
 
-       atomic_set(&bss->users, 2);
-       memcpy(bss->mesh_cfg, mesh_cfg, MESH_CFG_CMP_LEN);
-       bss->mesh_id_len = mesh_id_len;
-       bss->freq = freq;
-       spin_lock_bh(&local->bss_lock);
-       /* TODO: order by RSSI? */
-       list_add_tail(&bss->list, &local->bss_list);
-       __ieee80211_rx_bss_hash_add(local, bss);
-       spin_unlock_bh(&local->bss_lock);
-       return bss;
-}
-#endif
-
-static void ieee80211_rx_bss_free(struct ieee80211_bss *bss)
-{
-       kfree(bss->ies);
        kfree(bss_mesh_id(bss));
        kfree(bss_mesh_cfg(bss));
-       kfree(bss);
 }
 
 void ieee80211_rx_bss_put(struct ieee80211_local *local,
                          struct ieee80211_bss *bss)
 {
-       local_bh_disable();
-       if (!atomic_dec_and_lock(&bss->users, &local->bss_lock)) {
-               local_bh_enable();
-               return;
-       }
-
-       __ieee80211_rx_bss_hash_del(local, bss);
-       list_del(&bss->list);
-       spin_unlock_bh(&local->bss_lock);
-       ieee80211_rx_bss_free(bss);
+       cfg80211_put_bss((struct cfg80211_bss *)bss);
 }
 
 struct ieee80211_bss *
@@ -224,49 +58,37 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
                          struct ieee80211_mgmt *mgmt,
                          size_t len,
                          struct ieee802_11_elems *elems,
-                         int freq, bool beacon)
+                         struct ieee80211_channel *channel,
+                         bool beacon)
 {
        struct ieee80211_bss *bss;
        int clen;
-
-#ifdef CONFIG_MAC80211_MESH
-       if (elems->mesh_config)
-               bss = ieee80211_rx_mesh_bss_get(local, elems->mesh_id,
-                               elems->mesh_id_len, elems->mesh_config, freq);
-       else
-#endif
-               bss = ieee80211_rx_bss_get(local, mgmt->bssid, freq,
-                                          elems->ssid, elems->ssid_len);
-       if (!bss) {
-#ifdef CONFIG_MAC80211_MESH
-               if (elems->mesh_config)
-                       bss = ieee80211_rx_mesh_bss_add(local, elems->mesh_id,
-                               elems->mesh_id_len, elems->mesh_config,
-                               elems->mesh_config_len, freq);
-               else
-#endif
-                       bss = ieee80211_rx_bss_add(local, mgmt->bssid, freq,
-                                                 elems->ssid, elems->ssid_len);
-               if (!bss)
-                       return NULL;
-       } else {
-#if 0
-               /* TODO: order by RSSI? */
-               spin_lock_bh(&local->bss_lock);
-               list_move_tail(&bss->list, &local->bss_list);
-               spin_unlock_bh(&local->bss_lock);
-#endif
+       enum cfg80211_signal_type sigtype = CFG80211_SIGNAL_TYPE_NONE;
+       s32 signal = 0;
+
+       if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) {
+               sigtype = CFG80211_SIGNAL_TYPE_MBM;
+               signal = rx_status->signal * 100;
+       } else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) {
+               sigtype = CFG80211_SIGNAL_TYPE_UNSPEC;
+               signal = (rx_status->signal * 100) / local->hw.max_signal;
        }
 
+       bss = (void *)cfg80211_inform_bss_frame(local->hw.wiphy, channel,
+                                               mgmt, len, signal, sigtype,
+                                               GFP_ATOMIC);
+
+       if (!bss)
+               return NULL;
+
+       bss->cbss.free_priv = ieee80211_rx_bss_free;
+
        /* save the ERP value so that it is available at association time */
        if (elems->erp_info && elems->erp_info_len >= 1) {
                bss->erp_value = elems->erp_info[0];
                bss->has_erp_value = 1;
        }
 
-       bss->beacon_int = le16_to_cpu(mgmt->u.beacon.beacon_int);
-       bss->capability = le16_to_cpu(mgmt->u.beacon.capab_info);
-
        if (elems->tim) {
                struct ieee80211_tim_ie *tim_ie =
                        (struct ieee80211_tim_ie *)elems->tim;
@@ -295,37 +117,27 @@ ieee80211_bss_info_update(struct ieee80211_local *local,
                bss->supp_rates_len += clen;
        }
 
-       bss->band = rx_status->band;
-
-       bss->timestamp = le64_to_cpu(mgmt->u.beacon.timestamp);
-       bss->last_update = jiffies;
-       bss->signal = rx_status->signal;
-       bss->noise = rx_status->noise;
-       bss->qual = rx_status->qual;
        bss->wmm_used = elems->wmm_param || elems->wmm_info;
 
        if (!beacon)
                bss->last_probe_resp = jiffies;
 
-       /*
-        * For probe responses, or if we don't have any information yet,
-        * use the IEs from the beacon.
-        */
-       if (!bss->ies || !beacon) {
-               if (bss->ies == NULL || bss->ies_len < elems->total_len) {
-                       kfree(bss->ies);
-                       bss->ies = kmalloc(elems->total_len, GFP_ATOMIC);
-               }
-               if (bss->ies) {
-                       memcpy(bss->ies, elems->ie_start, elems->total_len);
-                       bss->ies_len = elems->total_len;
-               } else
-                       bss->ies_len = 0;
-       }
-
        return bss;
 }
 
+void ieee80211_rx_bss_remove(struct ieee80211_sub_if_data *sdata, u8 *bssid,
+                            int freq, u8 *ssid, u8 ssid_len)
+{
+       struct ieee80211_bss *bss;
+       struct ieee80211_local *local = sdata->local;
+
+       bss = ieee80211_rx_bss_get(local, bssid, freq, ssid, ssid_len);
+       if (bss) {
+               cfg80211_unlink_bss(local->hw.wiphy, (void *)bss);
+               ieee80211_rx_bss_put(local, bss);
+       }
+}
+
 ieee80211_rx_result
 ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
                  struct ieee80211_rx_status *rx_status)
@@ -387,7 +199,7 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
 
        bss = ieee80211_bss_info_update(sdata->local, rx_status,
                                        mgmt, skb->len, &elems,
-                                       freq, beacon);
+                                       channel, beacon);
        if (bss)
                ieee80211_rx_bss_put(sdata->local, bss);
 
@@ -395,7 +207,7 @@ ieee80211_scan_rx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
        return RX_QUEUED;
 }
 
-static void ieee80211_send_nullfunc(struct ieee80211_local *local,
+void ieee80211_send_nullfunc(struct ieee80211_local *local,
                                    struct ieee80211_sub_if_data *sdata,
                                    int powersave)
 {
@@ -425,26 +237,22 @@ static void ieee80211_send_nullfunc(struct ieee80211_local *local,
        ieee80211_tx_skb(sdata, skb, 0);
 }
 
-void ieee80211_scan_completed(struct ieee80211_hw *hw)
+void ieee80211_scan_completed(struct ieee80211_hw *hw, bool aborted)
 {
        struct ieee80211_local *local = hw_to_local(hw);
        struct ieee80211_sub_if_data *sdata;
-       union iwreq_data wrqu;
 
        if (WARN_ON(!local->hw_scanning && !local->sw_scanning))
                return;
 
-       local->last_scan_completed = jiffies;
-       memset(&wrqu, 0, sizeof(wrqu));
+       if (WARN_ON(!local->scan_req))
+               return;
 
-       /*
-        * local->scan_sdata could have been NULLed by the interface
-        * down code in case we were scanning on an interface that is
-        * being taken down.
-        */
-       sdata = local->scan_sdata;
-       if (sdata)
-               wireless_send_event(sdata->dev, SIOCGIWSCAN, &wrqu, NULL);
+       if (local->scan_req != &local->int_scan_req)
+               cfg80211_scan_done(local->scan_req, aborted);
+       local->scan_req = NULL;
+
+       local->last_scan_completed = jiffies;
 
        if (local->hw_scanning) {
                local->hw_scanning = false;
@@ -472,8 +280,11 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
        netif_addr_unlock(local->mdev);
        netif_tx_unlock_bh(local->mdev);
 
-       rcu_read_lock();
-       list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+       mutex_lock(&local->iflist_mtx);
+       list_for_each_entry(sdata, &local->interfaces, list) {
+               if (!netif_running(sdata->dev))
+                       continue;
+
                /* Tell AP we're back */
                if (sdata->vif.type == NL80211_IFTYPE_STATION) {
                        if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) {
@@ -482,8 +293,15 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
                        }
                } else
                        netif_tx_wake_all_queues(sdata->dev);
+
+               /* re-enable beaconing */
+               if (sdata->vif.type == NL80211_IFTYPE_AP ||
+                   sdata->vif.type == NL80211_IFTYPE_ADHOC ||
+                   sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
+                       ieee80211_if_config(sdata,
+                                           IEEE80211_IFCC_BEACON_ENABLED);
        }
-       rcu_read_unlock();
+       mutex_unlock(&local->iflist_mtx);
 
  done:
        ieee80211_mlme_notify_scan_completed(local);
@@ -491,15 +309,13 @@ void ieee80211_scan_completed(struct ieee80211_hw *hw)
 }
 EXPORT_SYMBOL(ieee80211_scan_completed);
 
-
 void ieee80211_scan_work(struct work_struct *work)
 {
        struct ieee80211_local *local =
                container_of(work, struct ieee80211_local, scan_work.work);
        struct ieee80211_sub_if_data *sdata = local->scan_sdata;
-       struct ieee80211_supported_band *sband;
        struct ieee80211_channel *chan;
-       int skip;
+       int skip, i;
        unsigned long next_delay = 0;
 
        /*
@@ -510,33 +326,13 @@ void ieee80211_scan_work(struct work_struct *work)
 
        switch (local->scan_state) {
        case SCAN_SET_CHANNEL:
-               /*
-                * Get current scan band. scan_band may be IEEE80211_NUM_BANDS
-                * after we successfully scanned the last channel of the last
-                * band (and the last band is supported by the hw)
-                */
-               if (local->scan_band < IEEE80211_NUM_BANDS)
-                       sband = local->hw.wiphy->bands[local->scan_band];
-               else
-                       sband = NULL;
-
-               /*
-                * If we are at an unsupported band and have more bands
-                * left to scan, advance to the next supported one.
-                */
-               while (!sband && local->scan_band < IEEE80211_NUM_BANDS - 1) {
-                       local->scan_band++;
-                       sband = local->hw.wiphy->bands[local->scan_band];
-                       local->scan_channel_idx = 0;
-               }
-
                /* if no more bands/channels left, complete scan */
-               if (!sband || local->scan_channel_idx >= sband->n_channels) {
-                       ieee80211_scan_completed(local_to_hw(local));
+               if (local->scan_channel_idx >= local->scan_req->n_channels) {
+                       ieee80211_scan_completed(local_to_hw(local), false);
                        return;
                }
                skip = 0;
-               chan = &sband->channels[local->scan_channel_idx];
+               chan = local->scan_req->channels[local->scan_channel_idx];
 
                if (chan->flags & IEEE80211_CHAN_DISABLED ||
                    (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
@@ -552,15 +348,6 @@ void ieee80211_scan_work(struct work_struct *work)
 
                /* advance state machine to next channel/band */
                local->scan_channel_idx++;
-               if (local->scan_channel_idx >= sband->n_channels) {
-                       /*
-                        * scan_band may end up == IEEE80211_NUM_BANDS, but
-                        * we'll catch that case above and complete the scan
-                        * if that is the case.
-                        */
-                       local->scan_band++;
-                       local->scan_channel_idx = 0;
-               }
 
                if (skip)
                        break;
@@ -573,10 +360,14 @@ void ieee80211_scan_work(struct work_struct *work)
                next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
                local->scan_state = SCAN_SET_CHANNEL;
 
-               if (local->scan_channel->flags & IEEE80211_CHAN_PASSIVE_SCAN)
+               if (local->scan_channel->flags & IEEE80211_CHAN_PASSIVE_SCAN ||
+                   !local->scan_req->n_ssids)
                        break;
-               ieee80211_send_probe_req(sdata, NULL, local->scan_ssid,
-                                        local->scan_ssid_len);
+               for (i = 0; i < local->scan_req->n_ssids; i++)
+                       ieee80211_send_probe_req(
+                               sdata, NULL,
+                               local->scan_req->ssids[i].ssid,
+                               local->scan_req->ssids[i].ssid_len);
                next_delay = IEEE80211_CHANNEL_TIME;
                break;
        }
@@ -587,14 +378,19 @@ void ieee80211_scan_work(struct work_struct *work)
 
 
 int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
-                        u8 *ssid, size_t ssid_len)
+                        struct cfg80211_scan_request *req)
 {
        struct ieee80211_local *local = scan_sdata->local;
        struct ieee80211_sub_if_data *sdata;
 
-       if (ssid_len > IEEE80211_MAX_SSID_LEN)
+       if (!req)
                return -EINVAL;
 
+       if (local->scan_req && local->scan_req != req)
+               return -EBUSY;
+
+       local->scan_req = req;
+
        /* MLME-SCAN.request (page 118)  page 144 (11.1.3.1)
         * BSSType: INFRASTRUCTURE, INDEPENDENT, ANY_BSS
         * BSSID: MACAddress
@@ -622,7 +418,7 @@ int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
                int rc;
 
                local->hw_scanning = true;
-               rc = local->ops->hw_scan(local_to_hw(local), ssid, ssid_len);
+               rc = local->ops->hw_scan(local_to_hw(local), req);
                if (rc) {
                        local->hw_scanning = false;
                        return rc;
@@ -633,8 +429,18 @@ int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
 
        local->sw_scanning = true;
 
-       rcu_read_lock();
-       list_for_each_entry_rcu(sdata, &local->interfaces, list) {
+       mutex_lock(&local->iflist_mtx);
+       list_for_each_entry(sdata, &local->interfaces, list) {
+               if (!netif_running(sdata->dev))
+                       continue;
+
+               /* disable beaconing */
+               if (sdata->vif.type == NL80211_IFTYPE_AP ||
+                   sdata->vif.type == NL80211_IFTYPE_ADHOC ||
+                   sdata->vif.type == NL80211_IFTYPE_MESH_POINT)
+                       ieee80211_if_config(sdata,
+                                           IEEE80211_IFCC_BEACON_ENABLED);
+
                if (sdata->vif.type == NL80211_IFTYPE_STATION) {
                        if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) {
                                netif_tx_stop_all_queues(sdata->dev);
@@ -643,17 +449,12 @@ int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
                } else
                        netif_tx_stop_all_queues(sdata->dev);
        }
-       rcu_read_unlock();
+       mutex_unlock(&local->iflist_mtx);
 
-       if (ssid) {
-               local->scan_ssid_len = ssid_len;
-               memcpy(local->scan_ssid, ssid, ssid_len);
-       } else
-               local->scan_ssid_len = 0;
        local->scan_state = SCAN_SET_CHANNEL;
        local->scan_channel_idx = 0;
-       local->scan_band = IEEE80211_BAND_2GHZ;
        local->scan_sdata = scan_sdata;
+       local->scan_req = req;
 
        netif_addr_lock_bh(local->mdev);
        local->filter_flags |= FIF_BCN_PRBRESP_PROMISC;
@@ -673,13 +474,21 @@ int ieee80211_start_scan(struct ieee80211_sub_if_data *scan_sdata,
 
 
 int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
-                          u8 *ssid, size_t ssid_len)
+                          struct cfg80211_scan_request *req)
 {
        struct ieee80211_local *local = sdata->local;
        struct ieee80211_if_sta *ifsta;
 
+       if (!req)
+               return -EINVAL;
+
+       if (local->scan_req && local->scan_req != req)
+               return -EBUSY;
+
+       local->scan_req = req;
+
        if (sdata->vif.type != NL80211_IFTYPE_STATION)
-               return ieee80211_start_scan(sdata, ssid, ssid_len);
+               return ieee80211_start_scan(sdata, req);
 
        /*
         * STA has a state machine that might need to defer scanning
@@ -694,241 +503,8 @@ int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
        }
 
        ifsta = &sdata->u.sta;
-
-       ifsta->scan_ssid_len = ssid_len;
-       if (ssid_len)
-               memcpy(ifsta->scan_ssid, ssid, ssid_len);
        set_bit(IEEE80211_STA_REQ_SCAN, &ifsta->request);
        queue_work(local->hw.workqueue, &ifsta->work);
 
        return 0;
 }
-
-
-static void ieee80211_scan_add_ies(struct iw_request_info *info,
-                                  struct ieee80211_bss *bss,
-                                  char **current_ev, char *end_buf)
-{
-       u8 *pos, *end, *next;
-       struct iw_event iwe;
-
-       if (bss == NULL || bss->ies == NULL)
-               return;
-
-       /*
-        * If needed, fragment the IEs buffer (at IE boundaries) into short
-        * enough fragments to fit into IW_GENERIC_IE_MAX octet messages.
-        */
-       pos = bss->ies;
-       end = pos + bss->ies_len;
-
-       while (end - pos > IW_GENERIC_IE_MAX) {
-               next = pos + 2 + pos[1];
-               while (next + 2 + next[1] - pos < IW_GENERIC_IE_MAX)
-                       next = next + 2 + next[1];
-
-               memset(&iwe, 0, sizeof(iwe));
-               iwe.cmd = IWEVGENIE;
-               iwe.u.data.length = next - pos;
-               *current_ev = iwe_stream_add_point(info, *current_ev,
-                                                  end_buf, &iwe, pos);
-
-               pos = next;
-       }
-
-       if (end > pos) {
-               memset(&iwe, 0, sizeof(iwe));
-               iwe.cmd = IWEVGENIE;
-               iwe.u.data.length = end - pos;
-               *current_ev = iwe_stream_add_point(info, *current_ev,
-                                                  end_buf, &iwe, pos);
-       }
-}
-
-
-static char *
-ieee80211_scan_result(struct ieee80211_local *local,
-                     struct iw_request_info *info,
-                     struct ieee80211_bss *bss,
-                     char *current_ev, char *end_buf)
-{
-       struct iw_event iwe;
-       char *buf;
-
-       if (time_after(jiffies,
-                      bss->last_update + IEEE80211_SCAN_RESULT_EXPIRE))
-               return current_ev;
-
-       memset(&iwe, 0, sizeof(iwe));
-       iwe.cmd = SIOCGIWAP;
-       iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
-       memcpy(iwe.u.ap_addr.sa_data, bss->bssid, ETH_ALEN);
-       current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
-                                         IW_EV_ADDR_LEN);
-
-       memset(&iwe, 0, sizeof(iwe));
-       iwe.cmd = SIOCGIWESSID;
-       if (bss_mesh_cfg(bss)) {
-               iwe.u.data.length = bss_mesh_id_len(bss);
-               iwe.u.data.flags = 1;
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, bss_mesh_id(bss));
-       } else {
-               iwe.u.data.length = bss->ssid_len;
-               iwe.u.data.flags = 1;
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, bss->ssid);
-       }
-
-       if (bss->capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)
-           || bss_mesh_cfg(bss)) {
-               memset(&iwe, 0, sizeof(iwe));
-               iwe.cmd = SIOCGIWMODE;
-               if (bss_mesh_cfg(bss))
-                       iwe.u.mode = IW_MODE_MESH;
-               else if (bss->capability & WLAN_CAPABILITY_ESS)
-                       iwe.u.mode = IW_MODE_MASTER;
-               else
-                       iwe.u.mode = IW_MODE_ADHOC;
-               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
-                                                 &iwe, IW_EV_UINT_LEN);
-       }
-
-       memset(&iwe, 0, sizeof(iwe));
-       iwe.cmd = SIOCGIWFREQ;
-       iwe.u.freq.m = ieee80211_frequency_to_channel(bss->freq);
-       iwe.u.freq.e = 0;
-       current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
-                                         IW_EV_FREQ_LEN);
-
-       memset(&iwe, 0, sizeof(iwe));
-       iwe.cmd = SIOCGIWFREQ;
-       iwe.u.freq.m = bss->freq;
-       iwe.u.freq.e = 6;
-       current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
-                                         IW_EV_FREQ_LEN);
-       memset(&iwe, 0, sizeof(iwe));
-       iwe.cmd = IWEVQUAL;
-       iwe.u.qual.qual = bss->qual;
-       iwe.u.qual.level = bss->signal;
-       iwe.u.qual.noise = bss->noise;
-       iwe.u.qual.updated = local->wstats_flags;
-       current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
-                                         IW_EV_QUAL_LEN);
-
-       memset(&iwe, 0, sizeof(iwe));
-       iwe.cmd = SIOCGIWENCODE;
-       if (bss->capability & WLAN_CAPABILITY_PRIVACY)
-               iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
-       else
-               iwe.u.data.flags = IW_ENCODE_DISABLED;
-       iwe.u.data.length = 0;
-       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                         &iwe, "");
-
-       ieee80211_scan_add_ies(info, bss, &current_ev, end_buf);
-
-       if (bss->supp_rates_len > 0) {
-               /* display all supported rates in readable format */
-               char *p = current_ev + iwe_stream_lcp_len(info);
-               int i;
-
-               memset(&iwe, 0, sizeof(iwe));
-               iwe.cmd = SIOCGIWRATE;
-               /* Those two flags are ignored... */
-               iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
-
-               for (i = 0; i < bss->supp_rates_len; i++) {
-                       iwe.u.bitrate.value = ((bss->supp_rates[i] &
-                                                       0x7f) * 500000);
-                       p = iwe_stream_add_value(info, current_ev, p,
-                                       end_buf, &iwe, IW_EV_PARAM_LEN);
-               }
-               current_ev = p;
-       }
-
-       buf = kmalloc(30, GFP_ATOMIC);
-       if (buf) {
-               memset(&iwe, 0, sizeof(iwe));
-               iwe.cmd = IWEVCUSTOM;
-               sprintf(buf, "tsf=%016llx", (unsigned long long)(bss->timestamp));
-               iwe.u.data.length = strlen(buf);
-               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
-                                                 &iwe, buf);
-               memset(&iwe, 0, sizeof(iwe));
-               iwe.cmd = IWEVCUSTOM;
-               sprintf(buf, " Last beacon: %dms ago",
-                       jiffies_to_msecs(jiffies - bss->last_update));
-               iwe.u.data.length = strlen(buf);
-               current_ev = iwe_stream_add_point(info, current_ev,
-                                                 end_buf, &iwe, buf);
-               kfree(buf);
-       }
-
-       if (bss_mesh_cfg(bss)) {
-               u8 *cfg = bss_mesh_cfg(bss);
-               buf = kmalloc(50, GFP_ATOMIC);
-               if (buf) {
-                       memset(&iwe, 0, sizeof(iwe));
-                       iwe.cmd = IWEVCUSTOM;
-                       sprintf(buf, "Mesh network (version %d)", cfg[0]);
-                       iwe.u.data.length = strlen(buf);
-                       current_ev = iwe_stream_add_point(info, current_ev,
-                                                         end_buf,
-                                                         &iwe, buf);
-                       sprintf(buf, "Path Selection Protocol ID: "
-                               "0x%02X%02X%02X%02X", cfg[1], cfg[2], cfg[3],
-                                                       cfg[4]);
-                       iwe.u.data.length = strlen(buf);
-                       current_ev = iwe_stream_add_point(info, current_ev,
-                                                         end_buf,
-                                                         &iwe, buf);
-                       sprintf(buf, "Path Selection Metric ID: "
-                               "0x%02X%02X%02X%02X", cfg[5], cfg[6], cfg[7],
-                                                       cfg[8]);
-                       iwe.u.data.length = strlen(buf);
-                       current_ev = iwe_stream_add_point(info, current_ev,
-                                                         end_buf,
-                                                         &iwe, buf);
-                       sprintf(buf, "Congestion Control Mode ID: "
-                               "0x%02X%02X%02X%02X", cfg[9], cfg[10],
-                                                       cfg[11], cfg[12]);
-                       iwe.u.data.length = strlen(buf);
-                       current_ev = iwe_stream_add_point(info, current_ev,
-                                                         end_buf,
-                                                         &iwe, buf);
-                       sprintf(buf, "Channel Precedence: "
-                               "0x%02X%02X%02X%02X", cfg[13], cfg[14],
-                                                       cfg[15], cfg[16]);
-                       iwe.u.data.length = strlen(buf);
-                       current_ev = iwe_stream_add_point(info, current_ev,
-                                                         end_buf,
-                                                         &iwe, buf);
-                       kfree(buf);
-               }
-       }
-
-       return current_ev;
-}
-
-
-int ieee80211_scan_results(struct ieee80211_local *local,
-                          struct iw_request_info *info,
-                          char *buf, size_t len)
-{
-       char *current_ev = buf;
-       char *end_buf = buf + len;
-       struct ieee80211_bss *bss;
-
-       spin_lock_bh(&local->bss_lock);
-       list_for_each_entry(bss, &local->bss_list, list) {
-               if (buf + len - current_ev <= IW_EV_ADDR_LEN) {
-                       spin_unlock_bh(&local->bss_lock);
-                       return -E2BIG;
-               }
-               current_ev = ieee80211_scan_result(local, info, bss,
-                                                      current_ev, end_buf);
-       }
-       spin_unlock_bh(&local->bss_lock);
-       return current_ev - buf;
-}
index f72bad636d8e89fb2f2cc3331bb0ba5de7739af9..47bb2aed2813fd980e99fe55724fbdf62ce77bf3 100644 (file)
@@ -65,7 +65,7 @@ static void ieee80211_send_refuse_measurement_request(struct ieee80211_sub_if_da
                        IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED;
        msr_report->u.action.u.measurement.msr_elem.type = request_ie->type;
 
-       ieee80211_tx_skb(sdata, skb, 0);
+       ieee80211_tx_skb(sdata, skb, 1);
 }
 
 void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
@@ -84,3 +84,104 @@ void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
                        mgmt->sa, mgmt->bssid,
                        mgmt->u.action.u.measurement.dialog_token);
 }
+
+void ieee80211_chswitch_work(struct work_struct *work)
+{
+       struct ieee80211_sub_if_data *sdata =
+               container_of(work, struct ieee80211_sub_if_data, u.sta.chswitch_work);
+       struct ieee80211_bss *bss;
+       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+
+       if (!netif_running(sdata->dev))
+               return;
+
+       bss = ieee80211_rx_bss_get(sdata->local, ifsta->bssid,
+                                  sdata->local->hw.conf.channel->center_freq,
+                                  ifsta->ssid, ifsta->ssid_len);
+       if (!bss)
+               goto exit;
+
+       sdata->local->oper_channel = sdata->local->csa_channel;
+       /* XXX: shouldn't really modify cfg80211-owned data! */
+       if (!ieee80211_hw_config(sdata->local, IEEE80211_CONF_CHANGE_CHANNEL))
+               bss->cbss.channel = sdata->local->oper_channel;
+
+       ieee80211_rx_bss_put(sdata->local, bss);
+exit:
+       ifsta->flags &= ~IEEE80211_STA_CSA_RECEIVED;
+       ieee80211_wake_queues_by_reason(&sdata->local->hw,
+                                       IEEE80211_QUEUE_STOP_REASON_CSA);
+}
+
+void ieee80211_chswitch_timer(unsigned long data)
+{
+       struct ieee80211_sub_if_data *sdata =
+               (struct ieee80211_sub_if_data *) data;
+       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+
+       queue_work(sdata->local->hw.workqueue, &ifsta->chswitch_work);
+}
+
+void ieee80211_process_chanswitch(struct ieee80211_sub_if_data *sdata,
+                                 struct ieee80211_channel_sw_ie *sw_elem,
+                                 struct ieee80211_bss *bss)
+{
+       struct ieee80211_channel *new_ch;
+       struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+       int new_freq = ieee80211_channel_to_frequency(sw_elem->new_ch_num);
+
+       /* FIXME: Handle ADHOC later */
+       if (sdata->vif.type != NL80211_IFTYPE_STATION)
+               return;
+
+       if (ifsta->state != IEEE80211_STA_MLME_ASSOCIATED)
+               return;
+
+       if (sdata->local->sw_scanning || sdata->local->hw_scanning)
+               return;
+
+       /* Disregard subsequent beacons if we are already running a timer
+          processing a CSA */
+
+       if (ifsta->flags & IEEE80211_STA_CSA_RECEIVED)
+               return;
+
+       new_ch = ieee80211_get_channel(sdata->local->hw.wiphy, new_freq);
+       if (!new_ch || new_ch->flags & IEEE80211_CHAN_DISABLED)
+               return;
+
+       sdata->local->csa_channel = new_ch;
+
+       if (sw_elem->count <= 1) {
+               queue_work(sdata->local->hw.workqueue, &ifsta->chswitch_work);
+       } else {
+               ieee80211_stop_queues_by_reason(&sdata->local->hw,
+                                               IEEE80211_QUEUE_STOP_REASON_CSA);
+               ifsta->flags |= IEEE80211_STA_CSA_RECEIVED;
+               mod_timer(&ifsta->chswitch_timer,
+                         jiffies +
+                         msecs_to_jiffies(sw_elem->count *
+                                          bss->cbss.beacon_interval));
+       }
+}
+
+void ieee80211_handle_pwr_constr(struct ieee80211_sub_if_data *sdata,
+                                u16 capab_info, u8 *pwr_constr_elem,
+                                u8 pwr_constr_elem_len)
+{
+       struct ieee80211_conf *conf = &sdata->local->hw.conf;
+
+       if (!(capab_info & WLAN_CAPABILITY_SPECTRUM_MGMT))
+               return;
+
+       /* Power constraint IE length should be 1 octet */
+       if (pwr_constr_elem_len != 1)
+               return;
+
+       if ((*pwr_constr_elem <= conf->channel->max_power) &&
+           (*pwr_constr_elem != sdata->local->power_constr_level)) {
+               sdata->local->power_constr_level = *pwr_constr_elem;
+               ieee80211_hw_config(sdata->local, 0);
+       }
+}
+
index 10c5539c20abdcafdd8fc1461914b2b9b43ba3ff..634f65c0130e2ca0f21c8a2645d2d4f4352d7dd8 100644 (file)
@@ -194,12 +194,41 @@ void sta_info_destroy(struct sta_info *sta)
                dev_kfree_skb_any(skb);
 
        for (i = 0; i <  STA_TID_NUM; i++) {
+               struct tid_ampdu_rx *tid_rx;
+               struct tid_ampdu_tx *tid_tx;
+
                spin_lock_bh(&sta->lock);
-               if (sta->ampdu_mlme.tid_rx[i])
-                 del_timer_sync(&sta->ampdu_mlme.tid_rx[i]->session_timer);
-               if (sta->ampdu_mlme.tid_tx[i])
-                 del_timer_sync(&sta->ampdu_mlme.tid_tx[i]->addba_resp_timer);
+               tid_rx = sta->ampdu_mlme.tid_rx[i];
+               /* Make sure timer won't free the tid_rx struct, see below */
+               if (tid_rx)
+                       tid_rx->shutdown = true;
                spin_unlock_bh(&sta->lock);
+
+               /*
+                * Outside spinlock - shutdown is true now so that the timer
+                * won't free tid_rx, we have to do that now. Can't let the
+                * timer do it because we have to sync the timer outside the
+                * lock that it takes itself.
+                */
+               if (tid_rx) {
+                       del_timer_sync(&tid_rx->session_timer);
+                       kfree(tid_rx);
+               }
+
+               /*
+                * No need to do such complications for TX agg sessions, the
+                * path leading to freeing the tid_tx struct goes via a call
+                * from the driver, and thus needs to look up the sta struct
+                * again, which cannot be found when we get here. Hence, we
+                * just need to delete the timer and free the aggregation
+                * info; we won't be telling the peer about it then but that
+                * doesn't matter if we're not talking to it again anyway.
+                */
+               tid_tx = sta->ampdu_mlme.tid_tx[i];
+               if (tid_tx) {
+                       del_timer_sync(&tid_tx->addba_resp_timer);
+                       kfree(tid_tx);
+               }
        }
 
        __sta_info_free(local, sta);
index e49a5b99cf10424daba5ed3d8f2bece1447a4b2b..d9653231992fb1e882429ada4e871ba50e1a435d 100644 (file)
@@ -34,6 +34,7 @@
  * @WLAN_STA_CLEAR_PS_FILT: Clear PS filter in hardware (using the
  *     IEEE80211_TX_CTL_CLEAR_PS_FILT control flag) when the next
  *     frame to this station is transmitted.
+ * @WLAN_STA_MFP: Management frame protection is used with this STA.
  */
 enum ieee80211_sta_info_flags {
        WLAN_STA_AUTH           = 1<<0,
@@ -46,6 +47,7 @@ enum ieee80211_sta_info_flags {
        WLAN_STA_WDS            = 1<<7,
        WLAN_STA_PSPOLL         = 1<<8,
        WLAN_STA_CLEAR_PS_FILT  = 1<<9,
+       WLAN_STA_MFP            = 1<<10,
 };
 
 #define STA_TID_NUM 16
@@ -63,7 +65,6 @@ enum ieee80211_sta_info_flags {
 #define HT_AGG_STATE_OPERATIONAL       (HT_ADDBA_REQUESTED_MSK |       \
                                         HT_ADDBA_DRV_READY_MSK |       \
                                         HT_ADDBA_RECEIVED_MSK)
-#define HT_AGG_STATE_DEBUGFS_CTL       BIT(7)
 
 /**
  * struct tid_ampdu_tx - TID aggregation information (Tx).
@@ -87,7 +88,7 @@ struct tid_ampdu_tx {
  * @stored_mpdu_num: number of MPDUs in reordering buffer
  * @ssn: Starting Sequence Number expected to be aggregated.
  * @buf_size: buffer size for incoming A-MPDUs
- * @timeout: reset timer value.
+ * @timeout: reset timer value (in TUs).
  * @dialog_token: dialog token for aggregation session
  */
 struct tid_ampdu_rx {
@@ -99,6 +100,7 @@ struct tid_ampdu_rx {
        u16 buf_size;
        u16 timeout;
        u8 dialog_token;
+       bool shutdown;
 };
 
 /**
@@ -382,8 +384,6 @@ static inline u32 get_sta_flags(struct sta_info *sta)
 }
 
 
-/* Maximum number of concurrently registered stations */
-#define MAX_STA_COUNT 2007
 
 #define STA_HASH_SIZE 256
 #define STA_HASH(sta) (sta[5])
index 94de5033f0b6d331c796b0241a1a64d8827704e0..33926831c64889cc5836fafe065a6f9dd9d5cebd 100644 (file)
@@ -35,6 +35,7 @@
 #define IEEE80211_TX_OK                0
 #define IEEE80211_TX_AGAIN     1
 #define IEEE80211_TX_FRAG_AGAIN        2
+#define IEEE80211_TX_PENDING   3
 
 /* misc utils */
 
@@ -330,6 +331,22 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx)
        return TX_CONTINUE;
 }
 
+static int ieee80211_use_mfp(__le16 fc, struct sta_info *sta,
+                            struct sk_buff *skb)
+{
+       if (!ieee80211_is_mgmt(fc))
+               return 0;
+
+       if (sta == NULL || !test_sta_flags(sta, WLAN_STA_MFP))
+               return 0;
+
+       if (!ieee80211_is_robust_mgmt_frame((struct ieee80211_hdr *)
+                                           skb->data))
+               return 0;
+
+       return 1;
+}
+
 static ieee80211_tx_result
 ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx)
 {
@@ -409,11 +426,17 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
                tx->key = NULL;
        else if (tx->sta && (key = rcu_dereference(tx->sta->key)))
                tx->key = key;
+       else if (ieee80211_is_mgmt(hdr->frame_control) &&
+                (key = rcu_dereference(tx->sdata->default_mgmt_key)))
+               tx->key = key;
        else if ((key = rcu_dereference(tx->sdata->default_key)))
                tx->key = key;
        else if (tx->sdata->drop_unencrypted &&
                 (tx->skb->protocol != cpu_to_be16(ETH_P_PAE)) &&
-                !(info->flags & IEEE80211_TX_CTL_INJECTED)) {
+                !(info->flags & IEEE80211_TX_CTL_INJECTED) &&
+                (!ieee80211_is_robust_mgmt_frame(hdr) ||
+                 (ieee80211_is_action(hdr->frame_control) &&
+                  tx->sta && test_sta_flags(tx->sta, WLAN_STA_MFP)))) {
                I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted);
                return TX_DROP;
        } else
@@ -428,10 +451,19 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx)
                        if (ieee80211_is_auth(hdr->frame_control))
                                break;
                case ALG_TKIP:
-               case ALG_CCMP:
                        if (!ieee80211_is_data_present(hdr->frame_control))
                                tx->key = NULL;
                        break;
+               case ALG_CCMP:
+                       if (!ieee80211_is_data_present(hdr->frame_control) &&
+                           !ieee80211_use_mfp(hdr->frame_control, tx->sta,
+                                              tx->skb))
+                               tx->key = NULL;
+                       break;
+               case ALG_AES_CMAC:
+                       if (!ieee80211_is_mgmt(hdr->frame_control))
+                               tx->key = NULL;
+                       break;
                }
        }
 
@@ -787,6 +819,8 @@ ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
                return ieee80211_crypto_tkip_encrypt(tx);
        case ALG_CCMP:
                return ieee80211_crypto_ccmp_encrypt(tx);
+       case ALG_AES_CMAC:
+               return ieee80211_crypto_aes_cmac_encrypt(tx);
        }
 
        /* not reached */
@@ -1052,8 +1086,7 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
 
        if (skb) {
                if (netif_subqueue_stopped(local->mdev, skb))
-                       return IEEE80211_TX_AGAIN;
-               info =  IEEE80211_SKB_CB(skb);
+                       return IEEE80211_TX_PENDING;
 
                ret = local->ops->tx(local_to_hw(local), skb);
                if (ret)
@@ -1179,8 +1212,9 @@ retry:
                 * queues, there's no reason for a driver to reject
                 * a frame there, warn and drop it.
                 */
-               if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
-                       goto drop;
+               if (ret != IEEE80211_TX_PENDING)
+                       if (WARN_ON(info->flags & IEEE80211_TX_CTL_AMPDU))
+                               goto drop;
 
                store = &local->pending_packet[queue];
 
@@ -1296,6 +1330,19 @@ int ieee80211_master_start_xmit(struct sk_buff *skb, struct net_device *dev)
                return 0;
        }
 
+       if ((local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK) &&
+           local->hw.conf.dynamic_ps_timeout > 0) {
+               if (local->hw.conf.flags & IEEE80211_CONF_PS) {
+                       ieee80211_stop_queues_by_reason(&local->hw,
+                                       IEEE80211_QUEUE_STOP_REASON_PS);
+                       queue_work(local->hw.workqueue,
+                                       &local->dynamic_ps_disable_work);
+               }
+
+               mod_timer(&local->dynamic_ps_timer, jiffies +
+                       msecs_to_jiffies(local->hw.conf.dynamic_ps_timeout));
+       }
+
        memset(info, 0, sizeof(*info));
 
        info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
@@ -1390,10 +1437,31 @@ int ieee80211_monitor_start_xmit(struct sk_buff *skb,
                                 struct net_device *dev)
 {
        struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+       struct ieee80211_channel *chan = local->hw.conf.channel;
        struct ieee80211_radiotap_header *prthdr =
                (struct ieee80211_radiotap_header *)skb->data;
        u16 len_rthdr;
 
+       /*
+        * Frame injection is not allowed if beaconing is not allowed
+        * or if we need radar detection. Beaconing is usually not allowed when
+        * the mode or operation (Adhoc, AP, Mesh) does not support DFS.
+        * Passive scan is also used in world regulatory domains where
+        * your country is not known and as such it should be treated as
+        * NO TX unless the channel is explicitly allowed in which case
+        * your current regulatory domain would not have the passive scan
+        * flag.
+        *
+        * Since AP mode uses monitor interfaces to inject/TX management
+        * frames we can make AP mode the exception to this rule once it
+        * supports radar detection as its implementation can deal with
+        * radar detection by itself. We can do that later by adding a
+        * monitor flag interfaces used for AP support.
+        */
+       if ((chan->flags & (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_RADAR |
+            IEEE80211_CHAN_PASSIVE_SCAN)))
+               goto fail;
+
        /* check for not even having the fixed radiotap header part */
        if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header)))
                goto fail; /* too short to be possibly valid */
@@ -1477,19 +1545,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb,
                goto fail;
        }
 
-       if (!(local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS) &&
-           local->dynamic_ps_timeout > 0) {
-               if (local->hw.conf.flags & IEEE80211_CONF_PS) {
-                       ieee80211_stop_queues_by_reason(&local->hw,
-                                                       IEEE80211_QUEUE_STOP_REASON_PS);
-                       queue_work(local->hw.workqueue,
-                                  &local->dynamic_ps_disable_work);
-               }
-
-               mod_timer(&local->dynamic_ps_timer, jiffies +
-                         msecs_to_jiffies(local->dynamic_ps_timeout));
-       }
-
        nh_pos = skb_network_header(skb) - skb->data;
        h_pos = skb_transport_header(skb) - skb->data;
 
index fb89e1d0aa0330ad893888c37697e6932bda47ec..73c7d7345abd19877e320dc40f559ed7d9180611 100644 (file)
@@ -41,6 +41,15 @@ const unsigned char rfc1042_header[] __aligned(2) =
 const unsigned char bridge_tunnel_header[] __aligned(2) =
        { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0xf8 };
 
+struct ieee80211_hw *wiphy_to_ieee80211_hw(struct wiphy *wiphy)
+{
+       struct ieee80211_local *local;
+       BUG_ON(!wiphy);
+
+       local = wiphy_priv(wiphy);
+       return &local->hw;
+}
+EXPORT_SYMBOL(wiphy_to_ieee80211_hw);
 
 u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
                        enum nl80211_iftype type)
@@ -352,8 +361,8 @@ static void __ieee80211_wake_queue(struct ieee80211_hw *hw, int queue,
        }
 }
 
-void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
-                                   enum queue_stop_reason reason)
+static void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
+                                          enum queue_stop_reason reason)
 {
        struct ieee80211_local *local = hw_to_local(hw);
        unsigned long flags;
@@ -382,8 +391,8 @@ static void __ieee80211_stop_queue(struct ieee80211_hw *hw, int queue,
        netif_stop_subqueue(local->mdev, queue);
 }
 
-void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
-                                   enum queue_stop_reason reason)
+static void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
+                                          enum queue_stop_reason reason)
 {
        struct ieee80211_local *local = hw_to_local(hw);
        unsigned long flags;
@@ -459,7 +468,7 @@ void ieee80211_iterate_active_interfaces(
        struct ieee80211_local *local = hw_to_local(hw);
        struct ieee80211_sub_if_data *sdata;
 
-       rtnl_lock();
+       mutex_lock(&local->iflist_mtx);
 
        list_for_each_entry(sdata, &local->interfaces, list) {
                switch (sdata->vif.type) {
@@ -480,7 +489,7 @@ void ieee80211_iterate_active_interfaces(
                                 &sdata->vif);
        }
 
-       rtnl_unlock();
+       mutex_unlock(&local->iflist_mtx);
 }
 EXPORT_SYMBOL_GPL(ieee80211_iterate_active_interfaces);
 
@@ -653,6 +662,10 @@ void ieee802_11_parse_elems(u8 *start, size_t len,
                        elems->pwr_constr_elem = pos;
                        elems->pwr_constr_elem_len = elen;
                        break;
+               case WLAN_EID_TIMEOUT_INTERVAL:
+                       elems->timeout_int = pos;
+                       elems->timeout_int_len = elen;
+                       break;
                default:
                        break;
                }
@@ -727,12 +740,12 @@ int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freqMHz)
        return ret;
 }
 
-u64 ieee80211_mandatory_rates(struct ieee80211_local *local,
+u32 ieee80211_mandatory_rates(struct ieee80211_local *local,
                              enum ieee80211_band band)
 {
        struct ieee80211_supported_band *sband;
        struct ieee80211_rate *bitrates;
-       u64 mandatory_rates;
+       u32 mandatory_rates;
        enum ieee80211_rate_flags mandatory_flag;
        int i;
 
index 7162d5816f39146adbf65a8fac47d6bd2b11ee86..2b023dce8b24618a2130df07a072df1c08d1f4a9 100644 (file)
@@ -37,7 +37,14 @@ static int ieee80211_set_encryption(struct ieee80211_sub_if_data *sdata, u8 *sta
        struct ieee80211_key *key;
        int err;
 
-       if (idx < 0 || idx >= NUM_DEFAULT_KEYS) {
+       if (alg == ALG_AES_CMAC) {
+               if (idx < NUM_DEFAULT_KEYS ||
+                   idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) {
+                       printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d "
+                              "(BIP)\n", sdata->dev->name, idx);
+                       return -EINVAL;
+               }
+       } else if (idx < 0 || idx >= NUM_DEFAULT_KEYS) {
                printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
                       sdata->dev->name, idx);
                return -EINVAL;
@@ -103,6 +110,9 @@ static int ieee80211_set_encryption(struct ieee80211_sub_if_data *sdata, u8 *sta
 
                if (set_tx_key || (!sta && !sdata->default_key && key))
                        ieee80211_set_default_key(sdata, idx);
+               if (alg == ALG_AES_CMAC &&
+                   (set_tx_key || (!sta && !sdata->default_mgmt_key && key)))
+                       ieee80211_set_default_mgmt_key(sdata, idx);
        }
 
  out_unlock:
@@ -135,6 +145,21 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev,
        return -EOPNOTSUPP;
 }
 
+static u8 ieee80211_get_wstats_flags(struct ieee80211_local *local)
+{
+       u8 wstats_flags = 0;
+
+       wstats_flags |= local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC |
+                                          IEEE80211_HW_SIGNAL_DBM) ?
+                               IW_QUAL_QUAL_UPDATED : IW_QUAL_QUAL_INVALID;
+       wstats_flags |= local->hw.flags & IEEE80211_HW_NOISE_DBM ?
+                               IW_QUAL_NOISE_UPDATED : IW_QUAL_NOISE_INVALID;
+       if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
+               wstats_flags |= IW_QUAL_DBM;
+
+       return wstats_flags;
+}
+
 static int ieee80211_ioctl_giwrange(struct net_device *dev,
                                 struct iw_request_info *info,
                                 struct iw_point *data, char *extra)
@@ -163,9 +188,9 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
        range->num_encoding_sizes = 2;
        range->max_encoding_tokens = NUM_DEFAULT_KEYS;
 
-       if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC ||
-           local->hw.flags & IEEE80211_HW_SIGNAL_DB)
-               range->max_qual.level = local->hw.max_signal;
+       /* cfg80211 requires this, and enforces 0..100 */
+       if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
+               range->max_qual.level = 100;
        else if  (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
                range->max_qual.level = -110;
        else
@@ -177,13 +202,13 @@ static int ieee80211_ioctl_giwrange(struct net_device *dev,
                range->max_qual.noise = 0;
 
        range->max_qual.qual = 100;
-       range->max_qual.updated = local->wstats_flags;
+       range->max_qual.updated = ieee80211_get_wstats_flags(local);
 
        range->avg_qual.qual = 50;
        /* not always true but better than nothing */
        range->avg_qual.level = range->max_qual.level / 2;
        range->avg_qual.noise = range->max_qual.noise / 2;
-       range->avg_qual.updated = local->wstats_flags;
+       range->avg_qual.updated = ieee80211_get_wstats_flags(local);
 
        range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
                          IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
@@ -230,13 +255,15 @@ static int ieee80211_ioctl_siwfreq(struct net_device *dev,
 {
        struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
 
-       if (sdata->vif.type == NL80211_IFTYPE_STATION)
+       if (sdata->vif.type == NL80211_IFTYPE_ADHOC ||
+           sdata->vif.type == NL80211_IFTYPE_STATION)
                sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
 
        /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
        if (freq->e == 0) {
                if (freq->m < 0) {
-                       if (sdata->vif.type == NL80211_IFTYPE_STATION)
+                       if (sdata->vif.type == NL80211_IFTYPE_ADHOC ||
+                           sdata->vif.type == NL80211_IFTYPE_STATION)
                                sdata->u.sta.flags |=
                                        IEEE80211_STA_AUTO_CHANNEL_SEL;
                        return 0;
@@ -404,58 +431,6 @@ static int ieee80211_ioctl_giwap(struct net_device *dev,
 }
 
 
-static int ieee80211_ioctl_siwscan(struct net_device *dev,
-                                  struct iw_request_info *info,
-                                  union iwreq_data *wrqu, char *extra)
-{
-       struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-       struct iw_scan_req *req = NULL;
-       u8 *ssid = NULL;
-       size_t ssid_len = 0;
-
-       if (!netif_running(dev))
-               return -ENETDOWN;
-
-       if (sdata->vif.type != NL80211_IFTYPE_STATION &&
-           sdata->vif.type != NL80211_IFTYPE_ADHOC &&
-           sdata->vif.type != NL80211_IFTYPE_MESH_POINT)
-               return -EOPNOTSUPP;
-
-       /* if SSID was specified explicitly then use that */
-       if (wrqu->data.length == sizeof(struct iw_scan_req) &&
-           wrqu->data.flags & IW_SCAN_THIS_ESSID) {
-               req = (struct iw_scan_req *)extra;
-               ssid = req->essid;
-               ssid_len = req->essid_len;
-       }
-
-       return ieee80211_request_scan(sdata, ssid, ssid_len);
-}
-
-
-static int ieee80211_ioctl_giwscan(struct net_device *dev,
-                                  struct iw_request_info *info,
-                                  struct iw_point *data, char *extra)
-{
-       int res;
-       struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
-       struct ieee80211_sub_if_data *sdata;
-
-       sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
-       if (local->sw_scanning || local->hw_scanning)
-               return -EAGAIN;
-
-       res = ieee80211_scan_results(local, info, extra, data->length);
-       if (res >= 0) {
-               data->length = res;
-               return 0;
-       }
-       data->length = 0;
-       return res;
-}
-
-
 static int ieee80211_ioctl_siwrate(struct net_device *dev,
                                  struct iw_request_info *info,
                                  struct iw_param *rate, char *extra)
@@ -549,10 +524,9 @@ static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
        else /* Automatic power level setting */
                new_power_level = chan->max_power;
 
-       if (local->hw.conf.power_level != new_power_level) {
-               local->hw.conf.power_level = new_power_level;
+       local->user_power_level = new_power_level;
+       if (local->hw.conf.power_level != new_power_level)
                reconf_flags |= IEEE80211_CONF_CHANGE_POWER;
-       }
 
        if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
                local->hw.conf.radio_enabled = !(data->txpower.disabled);
@@ -836,6 +810,9 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev,
        int ret = 0, timeout = 0;
        bool ps;
 
+       if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS))
+               return -EOPNOTSUPP;
+
        if (sdata->vif.type != NL80211_IFTYPE_STATION)
                return -EINVAL;
 
@@ -852,31 +829,49 @@ static int ieee80211_ioctl_siwpower(struct net_device *dev,
                ps = true;
                break;
        default:                /* Otherwise we ignore */
-               break;
+               return -EINVAL;
        }
 
+       if (wrq->flags & ~(IW_POWER_MODE | IW_POWER_TIMEOUT))
+               return -EINVAL;
+
        if (wrq->flags & IW_POWER_TIMEOUT)
                timeout = wrq->value / 1000;
 
-set:
-       if (ps == local->powersave && timeout == local->dynamic_ps_timeout)
+ set:
+       if (ps == local->powersave && timeout == conf->dynamic_ps_timeout)
                return ret;
 
        local->powersave = ps;
-       local->dynamic_ps_timeout = timeout;
+       conf->dynamic_ps_timeout = timeout;
 
-       if (sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED) {
-               if (!(local->hw.flags & IEEE80211_HW_NO_STACK_DYNAMIC_PS) &&
-                   local->dynamic_ps_timeout > 0)
-                       mod_timer(&local->dynamic_ps_timer, jiffies +
-                                 msecs_to_jiffies(local->dynamic_ps_timeout));
-               else {
-                       if (local->powersave)
-                               conf->flags |= IEEE80211_CONF_PS;
-                       else
-                               conf->flags &= ~IEEE80211_CONF_PS;
+       if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)
+               ret = ieee80211_hw_config(local,
+                                         IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT);
+
+       if (!(sdata->u.sta.flags & IEEE80211_STA_ASSOCIATED))
+               return ret;
+
+       if (conf->dynamic_ps_timeout > 0 &&
+           !(local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS)) {
+               mod_timer(&local->dynamic_ps_timer, jiffies +
+                         msecs_to_jiffies(conf->dynamic_ps_timeout));
+       } else {
+               if (local->powersave) {
+                       if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
+                               ieee80211_send_nullfunc(local, sdata, 1);
+                       conf->flags |= IEEE80211_CONF_PS;
+                       ret = ieee80211_hw_config(local,
+                                       IEEE80211_CONF_CHANGE_PS);
+               } else {
+                       conf->flags &= ~IEEE80211_CONF_PS;
+                       ret = ieee80211_hw_config(local,
+                                       IEEE80211_CONF_CHANGE_PS);
+                       if (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK)
+                               ieee80211_send_nullfunc(local, sdata, 0);
+                       del_timer_sync(&local->dynamic_ps_timer);
+                       cancel_work_sync(&local->dynamic_ps_enable_work);
                }
-               ret = ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS);
        }
 
        return ret;
@@ -903,11 +898,22 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
 
        switch (data->flags & IW_AUTH_INDEX) {
        case IW_AUTH_WPA_VERSION:
-       case IW_AUTH_CIPHER_PAIRWISE:
        case IW_AUTH_CIPHER_GROUP:
        case IW_AUTH_WPA_ENABLED:
        case IW_AUTH_RX_UNENCRYPTED_EAPOL:
        case IW_AUTH_KEY_MGMT:
+       case IW_AUTH_CIPHER_GROUP_MGMT:
+               break;
+       case IW_AUTH_CIPHER_PAIRWISE:
+               if (sdata->vif.type == NL80211_IFTYPE_STATION) {
+                       if (data->value & (IW_AUTH_CIPHER_WEP40 |
+                           IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_TKIP))
+                               sdata->u.sta.flags |=
+                                       IEEE80211_STA_TKIP_WEP_USED;
+                       else
+                               sdata->u.sta.flags &=
+                                       ~IEEE80211_STA_TKIP_WEP_USED;
+               }
                break;
        case IW_AUTH_DROP_UNENCRYPTED:
                sdata->drop_unencrypted = !!data->value;
@@ -934,6 +940,29 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev,
                else
                        ret = -EOPNOTSUPP;
                break;
+       case IW_AUTH_MFP:
+               if (!(sdata->local->hw.flags & IEEE80211_HW_MFP_CAPABLE)) {
+                       ret = -EOPNOTSUPP;
+                       break;
+               }
+               if (sdata->vif.type == NL80211_IFTYPE_STATION ||
+                   sdata->vif.type == NL80211_IFTYPE_ADHOC) {
+                       switch (data->value) {
+                       case IW_AUTH_MFP_DISABLED:
+                               sdata->u.sta.mfp = IEEE80211_MFP_DISABLED;
+                               break;
+                       case IW_AUTH_MFP_OPTIONAL:
+                               sdata->u.sta.mfp = IEEE80211_MFP_OPTIONAL;
+                               break;
+                       case IW_AUTH_MFP_REQUIRED:
+                               sdata->u.sta.mfp = IEEE80211_MFP_REQUIRED;
+                               break;
+                       default:
+                               ret = -EINVAL;
+                       }
+               } else
+                       ret = -EOPNOTSUPP;
+               break;
        default:
                ret = -EOPNOTSUPP;
                break;
@@ -965,7 +994,7 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev
                wstats->qual.level = sta->last_signal;
                wstats->qual.qual = sta->last_qual;
                wstats->qual.noise = sta->last_noise;
-               wstats->qual.updated = local->wstats_flags;
+               wstats->qual.updated = ieee80211_get_wstats_flags(local);
        }
 
        rcu_read_unlock();
@@ -1017,6 +1046,9 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
        case IW_ENCODE_ALG_CCMP:
                alg = ALG_CCMP;
                break;
+       case IW_ENCODE_ALG_AES_CMAC:
+               alg = ALG_AES_CMAC;
+               break;
        default:
                return -EOPNOTSUPP;
        }
@@ -1025,20 +1057,41 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
                remove = 1;
 
        idx = erq->flags & IW_ENCODE_INDEX;
-       if (idx < 1 || idx > 4) {
-               idx = -1;
-               if (!sdata->default_key)
-                       idx = 0;
-               else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
-                       if (sdata->default_key == sdata->keys[i]) {
-                               idx = i;
-                               break;
+       if (alg == ALG_AES_CMAC) {
+               if (idx < NUM_DEFAULT_KEYS + 1 ||
+                   idx > NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) {
+                       idx = -1;
+                       if (!sdata->default_mgmt_key)
+                               idx = 0;
+                       else for (i = NUM_DEFAULT_KEYS;
+                                 i < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS;
+                                 i++) {
+                               if (sdata->default_mgmt_key == sdata->keys[i])
+                               {
+                                       idx = i;
+                                       break;
+                               }
                        }
-               }
-               if (idx < 0)
-                       return -EINVAL;
-       } else
-               idx--;
+                       if (idx < 0)
+                               return -EINVAL;
+               } else
+                       idx--;
+       } else {
+               if (idx < 1 || idx > 4) {
+                       idx = -1;
+                       if (!sdata->default_key)
+                               idx = 0;
+                       else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
+                               if (sdata->default_key == sdata->keys[i]) {
+                                       idx = i;
+                                       break;
+                               }
+                       }
+                       if (idx < 0)
+                               return -EINVAL;
+               } else
+                       idx--;
+       }
 
        return ieee80211_set_encryption(sdata, ext->addr.sa_data, idx, alg,
                                        remove,
@@ -1076,8 +1129,8 @@ static const iw_handler ieee80211_handler[] =
        (iw_handler) ieee80211_ioctl_giwap,             /* SIOCGIWAP */
        (iw_handler) ieee80211_ioctl_siwmlme,           /* SIOCSIWMLME */
        (iw_handler) NULL,                              /* SIOCGIWAPLIST */
-       (iw_handler) ieee80211_ioctl_siwscan,           /* SIOCSIWSCAN */
-       (iw_handler) ieee80211_ioctl_giwscan,           /* SIOCGIWSCAN */
+       (iw_handler) cfg80211_wext_siwscan,             /* SIOCSIWSCAN */
+       (iw_handler) cfg80211_wext_giwscan,             /* SIOCGIWSCAN */
        (iw_handler) ieee80211_ioctl_siwessid,          /* SIOCSIWESSID */
        (iw_handler) ieee80211_ioctl_giwessid,          /* SIOCGIWESSID */
        (iw_handler) NULL,                              /* SIOCSIWNICKN */
index 7aa63caf8d50c3c7c8b2b87b77b9a3515fd5a4ca..9101b48ec2ae69e3a6c0e00e823876f230818e81 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright 2002-2004, Instant802 Networks, Inc.
+ * Copyright 2008, Jouni Malinen <j@w1.fi>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -19,6 +20,7 @@
 #include "michael.h"
 #include "tkip.h"
 #include "aes_ccm.h"
+#include "aes_cmac.h"
 #include "wpa.h"
 
 ieee80211_tx_result
@@ -266,7 +268,7 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
                                int encrypted)
 {
        __le16 mask_fc;
-       int a4_included;
+       int a4_included, mgmt;
        u8 qos_tid;
        u8 *b_0, *aad;
        u16 data_len, len_a;
@@ -277,12 +279,15 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
        aad = scratch + 4 * AES_BLOCK_LEN;
 
        /*
-        * Mask FC: zero subtype b4 b5 b6
+        * Mask FC: zero subtype b4 b5 b6 (if not mgmt)
         * Retry, PwrMgt, MoreData; set Protected
         */
+       mgmt = ieee80211_is_mgmt(hdr->frame_control);
        mask_fc = hdr->frame_control;
-       mask_fc &= ~cpu_to_le16(0x0070 | IEEE80211_FCTL_RETRY |
+       mask_fc &= ~cpu_to_le16(IEEE80211_FCTL_RETRY |
                                IEEE80211_FCTL_PM | IEEE80211_FCTL_MOREDATA);
+       if (!mgmt)
+               mask_fc &= ~cpu_to_le16(0x0070);
        mask_fc |= cpu_to_le16(IEEE80211_FCTL_PROTECTED);
 
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
@@ -300,8 +305,10 @@ static void ccmp_special_blocks(struct sk_buff *skb, u8 *pn, u8 *scratch,
 
        /* First block, b_0 */
        b_0[0] = 0x59; /* flags: Adata: 1, M: 011, L: 001 */
-       /* Nonce: QoS Priority | A2 | PN */
-       b_0[1] = qos_tid;
+       /* Nonce: Nonce Flags | A2 | PN
+        * Nonce Flags: Priority (b0..b3) | Management (b4) | Reserved (b5..b7)
+        */
+       b_0[1] = qos_tid | (mgmt << 4);
        memcpy(&b_0[2], hdr->addr2, ETH_ALEN);
        memcpy(&b_0[8], pn, CCMP_PN_LEN);
        /* l(m) */
@@ -360,9 +367,14 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
        int hdrlen, len, tail;
        u8 *pos, *pn;
        int i;
+       bool skip_hw;
+
+       skip_hw = (tx->key->conf.flags & IEEE80211_KEY_FLAG_SW_MGMT) &&
+               ieee80211_is_mgmt(hdr->frame_control);
 
        if ((tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) &&
-           !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV)) {
+           !(tx->key->conf.flags & IEEE80211_KEY_FLAG_GENERATE_IV) &&
+           !skip_hw) {
                /* hwaccel - with no need for preallocated room for CCMP
                 * header or MIC fields */
                info->control.hw_key = &tx->key->conf;
@@ -397,7 +409,7 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
 
        ccmp_pn2hdr(pos, pn, key->conf.keyidx);
 
-       if (key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
+       if ((key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) && !skip_hw) {
                /* hwaccel - with preallocated room for CCMP header */
                info->control.hw_key = &tx->key->conf;
                return 0;
@@ -446,7 +458,8 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
 
        hdrlen = ieee80211_hdrlen(hdr->frame_control);
 
-       if (!ieee80211_is_data(hdr->frame_control))
+       if (!ieee80211_is_data(hdr->frame_control) &&
+           !ieee80211_is_robust_mgmt_frame(hdr))
                return RX_CONTINUE;
 
        data_len = skb->len - hdrlen - CCMP_HDR_LEN - CCMP_MIC_LEN;
@@ -485,3 +498,126 @@ ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx)
 
        return RX_CONTINUE;
 }
+
+
+static void bip_aad(struct sk_buff *skb, u8 *aad)
+{
+       /* BIP AAD: FC(masked) || A1 || A2 || A3 */
+
+       /* FC type/subtype */
+       aad[0] = skb->data[0];
+       /* Mask FC Retry, PwrMgt, MoreData flags to zero */
+       aad[1] = skb->data[1] & ~(BIT(4) | BIT(5) | BIT(6));
+       /* A1 || A2 || A3 */
+       memcpy(aad + 2, skb->data + 4, 3 * ETH_ALEN);
+}
+
+
+static inline void bip_ipn_swap(u8 *d, const u8 *s)
+{
+       *d++ = s[5];
+       *d++ = s[4];
+       *d++ = s[3];
+       *d++ = s[2];
+       *d++ = s[1];
+       *d = s[0];
+}
+
+
+ieee80211_tx_result
+ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx)
+{
+       struct sk_buff *skb = tx->skb;
+       struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
+       struct ieee80211_key *key = tx->key;
+       struct ieee80211_mmie *mmie;
+       u8 *pn, aad[20];
+       int i;
+
+       if (tx->key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE) {
+               /* hwaccel */
+               info->control.hw_key = &tx->key->conf;
+               return 0;
+       }
+
+       if (WARN_ON(skb_tailroom(skb) < sizeof(*mmie)))
+               return TX_DROP;
+
+       mmie = (struct ieee80211_mmie *) skb_put(skb, sizeof(*mmie));
+       mmie->element_id = WLAN_EID_MMIE;
+       mmie->length = sizeof(*mmie) - 2;
+       mmie->key_id = cpu_to_le16(key->conf.keyidx);
+
+       /* PN = PN + 1 */
+       pn = key->u.aes_cmac.tx_pn;
+
+       for (i = sizeof(key->u.aes_cmac.tx_pn) - 1; i >= 0; i--) {
+               pn[i]++;
+               if (pn[i])
+                       break;
+       }
+       bip_ipn_swap(mmie->sequence_number, pn);
+
+       bip_aad(skb, aad);
+
+       /*
+        * MIC = AES-128-CMAC(IGTK, AAD || Management Frame Body || MMIE, 64)
+        */
+       ieee80211_aes_cmac(key->u.aes_cmac.tfm, key->u.aes_cmac.tx_crypto_buf,
+                          aad, skb->data + 24, skb->len - 24, mmie->mic);
+
+       return TX_CONTINUE;
+}
+
+
+ieee80211_rx_result
+ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx)
+{
+       struct sk_buff *skb = rx->skb;
+       struct ieee80211_key *key = rx->key;
+       struct ieee80211_mmie *mmie;
+       u8 aad[20], mic[8], ipn[6];
+       struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+
+       if (!ieee80211_is_mgmt(hdr->frame_control))
+               return RX_CONTINUE;
+
+       if ((rx->status->flag & RX_FLAG_DECRYPTED) &&
+           (rx->status->flag & RX_FLAG_IV_STRIPPED))
+               return RX_CONTINUE;
+
+       if (skb->len < 24 + sizeof(*mmie))
+               return RX_DROP_UNUSABLE;
+
+       mmie = (struct ieee80211_mmie *)
+               (skb->data + skb->len - sizeof(*mmie));
+       if (mmie->element_id != WLAN_EID_MMIE ||
+           mmie->length != sizeof(*mmie) - 2)
+               return RX_DROP_UNUSABLE; /* Invalid MMIE */
+
+       bip_ipn_swap(ipn, mmie->sequence_number);
+
+       if (memcmp(ipn, key->u.aes_cmac.rx_pn, 6) <= 0) {
+               key->u.aes_cmac.replays++;
+               return RX_DROP_UNUSABLE;
+       }
+
+       if (!(rx->status->flag & RX_FLAG_DECRYPTED)) {
+               /* hardware didn't decrypt/verify MIC */
+               bip_aad(skb, aad);
+               ieee80211_aes_cmac(key->u.aes_cmac.tfm,
+                                  key->u.aes_cmac.rx_crypto_buf, aad,
+                                  skb->data + 24, skb->len - 24, mic);
+               if (memcmp(mic, mmie->mic, sizeof(mmie->mic)) != 0) {
+                       key->u.aes_cmac.icverrors++;
+                       return RX_DROP_UNUSABLE;
+               }
+       }
+
+       memcpy(key->u.aes_cmac.rx_pn, ipn, 6);
+
+       /* Remove MMIE */
+       skb_trim(skb, skb->len - sizeof(*mmie));
+
+       return RX_CONTINUE;
+}
index d42d221d8a1dc324ce707bb1146864c0f8799148..baba0608313ef5419cccff809d28166b1178bf7b 100644 (file)
@@ -28,4 +28,9 @@ ieee80211_crypto_ccmp_encrypt(struct ieee80211_tx_data *tx);
 ieee80211_rx_result
 ieee80211_crypto_ccmp_decrypt(struct ieee80211_rx_data *rx);
 
+ieee80211_tx_result
+ieee80211_crypto_aes_cmac_encrypt(struct ieee80211_tx_data *tx);
+ieee80211_rx_result
+ieee80211_crypto_aes_cmac_decrypt(struct ieee80211_rx_data *rx);
+
 #endif /* WPA_H */
index 6be5d4efa51ba58c9f13bb40b475bcb58c6795ca..5c48378a852fba2bf9f27156774daf02d67442e4 100644 (file)
@@ -149,8 +149,8 @@ static struct task_struct *sync_backup_thread;
 /* multicast addr */
 static struct sockaddr_in mcast_addr = {
        .sin_family             = AF_INET,
-       .sin_port               = __constant_htons(IP_VS_SYNC_PORT),
-       .sin_addr.s_addr        = __constant_htonl(IP_VS_SYNC_GROUP),
+       .sin_port               = cpu_to_be16(IP_VS_SYNC_PORT),
+       .sin_addr.s_addr        = cpu_to_be32(IP_VS_SYNC_GROUP),
 };
 
 
index 4f8fcf498545f302105535bfebaf34b9755908fe..07d9d8857e5db50b2d80bca709e137c4472b8724 100644 (file)
@@ -177,7 +177,7 @@ static struct nf_conntrack_helper amanda_helper[2] __read_mostly = {
                .me                     = THIS_MODULE,
                .help                   = amanda_help,
                .tuple.src.l3num        = AF_INET,
-               .tuple.src.u.udp.port   = __constant_htons(10080),
+               .tuple.src.u.udp.port   = cpu_to_be16(10080),
                .tuple.dst.protonum     = IPPROTO_UDP,
                .expect_policy          = &amanda_exp_policy,
        },
@@ -186,7 +186,7 @@ static struct nf_conntrack_helper amanda_helper[2] __read_mostly = {
                .me                     = THIS_MODULE,
                .help                   = amanda_help,
                .tuple.src.l3num        = AF_INET6,
-               .tuple.src.u.udp.port   = __constant_htons(10080),
+               .tuple.src.u.udp.port   = cpu_to_be16(10080),
                .tuple.dst.protonum     = IPPROTO_UDP,
                .expect_policy          = &amanda_exp_policy,
        },
index 687bd633c3d7020c277ba0f25b6e3033fd5053c7..66369490230e03eab8ac592365f296bc44704c7f 100644 (file)
@@ -1167,7 +1167,7 @@ static struct nf_conntrack_helper nf_conntrack_helper_q931[] __read_mostly = {
                .name                   = "Q.931",
                .me                     = THIS_MODULE,
                .tuple.src.l3num        = AF_INET,
-               .tuple.src.u.tcp.port   = __constant_htons(Q931_PORT),
+               .tuple.src.u.tcp.port   = cpu_to_be16(Q931_PORT),
                .tuple.dst.protonum     = IPPROTO_TCP,
                .help                   = q931_help,
                .expect_policy          = &q931_exp_policy,
@@ -1176,7 +1176,7 @@ static struct nf_conntrack_helper nf_conntrack_helper_q931[] __read_mostly = {
                .name                   = "Q.931",
                .me                     = THIS_MODULE,
                .tuple.src.l3num        = AF_INET6,
-               .tuple.src.u.tcp.port   = __constant_htons(Q931_PORT),
+               .tuple.src.u.tcp.port   = cpu_to_be16(Q931_PORT),
                .tuple.dst.protonum     = IPPROTO_TCP,
                .help                   = q931_help,
                .expect_policy          = &q931_exp_policy,
@@ -1741,7 +1741,7 @@ static struct nf_conntrack_helper nf_conntrack_helper_ras[] __read_mostly = {
                .name                   = "RAS",
                .me                     = THIS_MODULE,
                .tuple.src.l3num        = AF_INET,
-               .tuple.src.u.udp.port   = __constant_htons(RAS_PORT),
+               .tuple.src.u.udp.port   = cpu_to_be16(RAS_PORT),
                .tuple.dst.protonum     = IPPROTO_UDP,
                .help                   = ras_help,
                .expect_policy          = &ras_exp_policy,
@@ -1750,7 +1750,7 @@ static struct nf_conntrack_helper nf_conntrack_helper_ras[] __read_mostly = {
                .name                   = "RAS",
                .me                     = THIS_MODULE,
                .tuple.src.l3num        = AF_INET6,
-               .tuple.src.u.udp.port   = __constant_htons(RAS_PORT),
+               .tuple.src.u.udp.port   = cpu_to_be16(RAS_PORT),
                .tuple.dst.protonum     = IPPROTO_UDP,
                .help                   = ras_help,
                .expect_policy          = &ras_exp_policy,
index 5af4273b4668c3bf53b0ea1dc1937ed973831610..8a3875e36ec2d37ffbfa197fc4226e41a4a12fe4 100644 (file)
@@ -105,7 +105,7 @@ static struct nf_conntrack_expect_policy exp_policy = {
 static struct nf_conntrack_helper helper __read_mostly = {
        .name                   = "netbios-ns",
        .tuple.src.l3num        = AF_INET,
-       .tuple.src.u.udp.port   = __constant_htons(NMBD_PORT),
+       .tuple.src.u.udp.port   = cpu_to_be16(NMBD_PORT),
        .tuple.dst.protonum     = IPPROTO_UDP,
        .me                     = THIS_MODULE,
        .help                   = help,
index 9e169ef2e85443eaff5c8224ccbeaad1d0f4a202..72cca638a82d1008eddfcc7318a0f74f2c433cb2 100644 (file)
@@ -591,7 +591,7 @@ static struct nf_conntrack_helper pptp __read_mostly = {
        .name                   = "pptp",
        .me                     = THIS_MODULE,
        .tuple.src.l3num        = AF_INET,
-       .tuple.src.u.tcp.port   = __constant_htons(PPTP_CONTROL_PORT),
+       .tuple.src.u.tcp.port   = cpu_to_be16(PPTP_CONTROL_PORT),
        .tuple.dst.protonum     = IPPROTO_TCP,
        .help                   = conntrack_pptp_help,
        .destroy                = pptp_destroy_siblings,
index cdc97f3105a3153e4c55cfb57f5eb4994d393922..5490fc37c92dfa5363a2992fd67fd4f145f65360 100644 (file)
@@ -71,6 +71,7 @@ int
 nf_tproxy_assign_sock(struct sk_buff *skb, struct sock *sk)
 {
        if (inet_sk(sk)->transparent) {
+               skb_orphan(skb);
                skb->sk = sk;
                skb->destructor = nf_tproxy_destructor;
                return 1;
index 9eb895c7a2a97bb87076f715ce5c692f74e51505..ed587be1e1c2b972770f37a167570b4d88b50861 100644 (file)
@@ -85,6 +85,7 @@ struct netlink_sock {
 
 #define NETLINK_KERNEL_SOCKET  0x1
 #define NETLINK_RECV_PKTINFO   0x2
+#define NETLINK_BROADCAST_SEND_ERROR   0x4
 
 static inline struct netlink_sock *nlk_sk(struct sock *sk)
 {
@@ -950,6 +951,7 @@ struct netlink_broadcast_data {
        u32 pid;
        u32 group;
        int failure;
+       int delivery_failure;
        int congested;
        int delivered;
        gfp_t allocation;
@@ -994,11 +996,15 @@ static inline int do_one_broadcast(struct sock *sk,
                netlink_overrun(sk);
                /* Clone failed. Notify ALL listeners. */
                p->failure = 1;
+               if (nlk->flags & NETLINK_BROADCAST_SEND_ERROR)
+                       p->delivery_failure = 1;
        } else if (sk_filter(sk, p->skb2)) {
                kfree_skb(p->skb2);
                p->skb2 = NULL;
        } else if ((val = netlink_broadcast_deliver(sk, p->skb2)) < 0) {
                netlink_overrun(sk);
+               if (nlk->flags & NETLINK_BROADCAST_SEND_ERROR)
+                       p->delivery_failure = 1;
        } else {
                p->congested |= val;
                p->delivered = 1;
@@ -1025,6 +1031,7 @@ int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid,
        info.pid = pid;
        info.group = group;
        info.failure = 0;
+       info.delivery_failure = 0;
        info.congested = 0;
        info.delivered = 0;
        info.allocation = allocation;
@@ -1045,13 +1052,14 @@ int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid,
        if (info.skb2)
                kfree_skb(info.skb2);
 
+       if (info.delivery_failure)
+               return -ENOBUFS;
+
        if (info.delivered) {
                if (info.congested && (allocation & __GFP_WAIT))
                        yield();
                return 0;
        }
-       if (info.failure)
-               return -ENOBUFS;
        return -ESRCH;
 }
 EXPORT_SYMBOL(netlink_broadcast);
@@ -1159,6 +1167,13 @@ static int netlink_setsockopt(struct socket *sock, int level, int optname,
                err = 0;
                break;
        }
+       case NETLINK_BROADCAST_ERROR:
+               if (val)
+                       nlk->flags |= NETLINK_BROADCAST_SEND_ERROR;
+               else
+                       nlk->flags &= ~NETLINK_BROADCAST_SEND_ERROR;
+               err = 0;
+               break;
        default:
                err = -ENOPROTOOPT;
        }
@@ -1191,6 +1206,16 @@ static int netlink_getsockopt(struct socket *sock, int level, int optname,
                        return -EFAULT;
                err = 0;
                break;
+       case NETLINK_BROADCAST_ERROR:
+               if (len < sizeof(int))
+                       return -EINVAL;
+               len = sizeof(int);
+               val = nlk->flags & NETLINK_BROADCAST_SEND_ERROR ? 1 : 0;
+               if (put_user(len, optlen) ||
+                   put_user(val, optval))
+                       return -EFAULT;
+               err = 0;
+               break;
        default:
                err = -ENOPROTOOPT;
        }
index e9c05b8f4f4517fc5b13b6295eebfd1cf75e0a1c..cba7849de98e26988d93bd4ee6058be4ce7f0558 100644 (file)
@@ -1432,7 +1432,7 @@ static int __init nr_proto_init(void)
                struct net_device *dev;
 
                sprintf(name, "nr%d", i);
-               dev = alloc_netdev(sizeof(struct nr_private), name, nr_setup);
+               dev = alloc_netdev(0, name, nr_setup);
                if (!dev) {
                        printk(KERN_ERR "NET/ROM: nr_proto_init - unable to allocate device structure\n");
                        goto fail;
index 6caf459665f2c78e5d1f1b35344c227bdd5da813..351372463fedd23f5c61bd9b016cb8337c800f07 100644 (file)
@@ -42,7 +42,7 @@
 
 int nr_rx_ip(struct sk_buff *skb, struct net_device *dev)
 {
-       struct net_device_stats *stats = netdev_priv(dev);
+       struct net_device_stats *stats = &dev->stats;
 
        if (!netif_running(dev)) {
                stats->rx_dropped++;
@@ -171,8 +171,7 @@ static int nr_close(struct net_device *dev)
 
 static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-       struct nr_private *nr = netdev_priv(dev);
-       struct net_device_stats *stats = &nr->stats;
+       struct net_device_stats *stats = &dev->stats;
        unsigned int len = skb->len;
 
        if (!nr_route_frame(skb, NULL)) {
@@ -187,34 +186,27 @@ static int nr_xmit(struct sk_buff *skb, struct net_device *dev)
        return 0;
 }
 
-static struct net_device_stats *nr_get_stats(struct net_device *dev)
-{
-       struct nr_private *nr = netdev_priv(dev);
-
-       return &nr->stats;
-}
-
 static const struct header_ops nr_header_ops = {
        .create = nr_header,
        .rebuild= nr_rebuild_header,
 };
 
+static const struct net_device_ops nr_netdev_ops = {
+       .ndo_open               = nr_open,
+       .ndo_stop               = nr_close,
+       .ndo_start_xmit         = nr_xmit,
+       .ndo_set_mac_address    = nr_set_mac_address,
+};
 
 void nr_setup(struct net_device *dev)
 {
        dev->mtu                = NR_MAX_PACKET_SIZE;
-       dev->hard_start_xmit    = nr_xmit;
-       dev->open               = nr_open;
-       dev->stop               = nr_close;
-
+       dev->netdev_ops         = &nr_netdev_ops;
        dev->header_ops         = &nr_header_ops;
        dev->hard_header_len    = NR_NETWORK_LEN + NR_TRANSPORT_LEN;
        dev->addr_len           = AX25_ADDR_LEN;
        dev->type               = ARPHRD_NETROM;
-       dev->set_mac_address    = nr_set_mac_address;
 
        /* New-style flags. */
        dev->flags              = IFF_NOARP;
-
-       dev->get_stats          = nr_get_stats;
 }
index 13cb323f8c382bad79f287bb5636ed0ee34271df..81795ea87794af8b10540451313c5969e0beb4d7 100644 (file)
@@ -275,8 +275,6 @@ static inline int can_respond(struct sk_buff *skb)
                return 0;
 
        ph = pn_hdr(skb);
-       if (phonet_address_get(skb->dev, ph->pn_rdev) != ph->pn_rdev)
-               return 0; /* we are not the destination */
        if (ph->pn_res == PN_PREFIX && !pskb_may_pull(skb, 5))
                return 0;
        if (ph->pn_res == PN_COMMGR) /* indications */
@@ -344,8 +342,8 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
                        struct packet_type *pkttype,
                        struct net_device *orig_dev)
 {
+       struct net *net = dev_net(dev);
        struct phonethdr *ph;
-       struct sock *sk;
        struct sockaddr_pn sa;
        u16 len;
 
@@ -364,28 +362,28 @@ static int phonet_rcv(struct sk_buff *skb, struct net_device *dev,
        skb_reset_transport_header(skb);
 
        pn_skb_get_dst_sockaddr(skb, &sa);
-       if (pn_sockaddr_get_addr(&sa) == 0)
-               goto out; /* currently, we cannot be device 0 */
 
-       sk = pn_find_sock_by_sa(dev_net(dev), &sa);
-       if (sk == NULL) {
+       /* check if we are the destination */
+       if (phonet_address_lookup(net, pn_sockaddr_get_addr(&sa)) == 0) {
+               /* Phonet packet input */
+               struct sock *sk = pn_find_sock_by_sa(net, &sa);
+
+               if (sk)
+                       return sk_receive_skb(sk, skb, 0);
+
                if (can_respond(skb)) {
                        send_obj_unreachable(skb);
                        send_reset_indications(skb);
                }
-               goto out;
        }
 
-       /* Push data to the socket (or other sockets connected to it). */
-       return sk_receive_skb(sk, skb, 0);
-
 out:
        kfree_skb(skb);
        return NET_RX_DROP;
 }
 
 static struct packet_type phonet_packet_type = {
-       .type = __constant_htons(ETH_P_PHONET),
+       .type = cpu_to_be16(ETH_P_PHONET),
        .dev = NULL,
        .func = phonet_rcv,
 };
@@ -428,16 +426,18 @@ static int __init phonet_init(void)
 {
        int err;
 
+       err = phonet_device_init();
+       if (err)
+               return err;
+
        err = sock_register(&phonet_proto_family);
        if (err) {
                printk(KERN_ALERT
                        "phonet protocol family initialization failed\n");
-               return err;
+               goto err_sock;
        }
 
-       phonet_device_init();
        dev_add_pack(&phonet_packet_type);
-       phonet_netlink_register();
        phonet_sysctl_init();
 
        err = isi_register();
@@ -449,6 +449,7 @@ err:
        phonet_sysctl_exit();
        sock_unregister(PF_PHONET);
        dev_remove_pack(&phonet_packet_type);
+err_sock:
        phonet_device_exit();
        return err;
 }
index 5491bf5e354bbe20b7eb33a078e2a710e4d10d0b..80a322d77909ac0d96000486580f20d2946fcbd3 100644 (file)
 #include <linux/netdevice.h>
 #include <linux/phonet.h>
 #include <net/sock.h>
+#include <net/netns/generic.h>
 #include <net/phonet/pn_dev.h>
 
-/* when accessing, remember to lock with spin_lock(&pndevs.lock); */
-struct phonet_device_list pndevs = {
-       .list = LIST_HEAD_INIT(pndevs.list),
-       .lock = __SPIN_LOCK_UNLOCKED(pndevs.lock),
+struct phonet_net {
+       struct phonet_device_list pndevs;
 };
 
+int phonet_net_id;
+
+struct phonet_device_list *phonet_device_list(struct net *net)
+{
+       struct phonet_net *pnn = net_generic(net, phonet_net_id);
+       return &pnn->pndevs;
+}
+
 /* Allocate new Phonet device. */
 static struct phonet_device *__phonet_device_alloc(struct net_device *dev)
 {
+       struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
        struct phonet_device *pnd = kmalloc(sizeof(*pnd), GFP_ATOMIC);
        if (pnd == NULL)
                return NULL;
        pnd->netdev = dev;
        bitmap_zero(pnd->addrs, 64);
 
-       list_add(&pnd->list, &pndevs.list);
+       list_add(&pnd->list, &pndevs->list);
        return pnd;
 }
 
 static struct phonet_device *__phonet_get(struct net_device *dev)
 {
+       struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
        struct phonet_device *pnd;
 
-       list_for_each_entry(pnd, &pndevs.list, list) {
+       list_for_each_entry(pnd, &pndevs->list, list) {
                if (pnd->netdev == dev)
                        return pnd;
        }
@@ -68,32 +77,33 @@ static void __phonet_device_free(struct phonet_device *pnd)
 
 struct net_device *phonet_device_get(struct net *net)
 {
+       struct phonet_device_list *pndevs = phonet_device_list(net);
        struct phonet_device *pnd;
        struct net_device *dev;
 
-       spin_lock_bh(&pndevs.lock);
-       list_for_each_entry(pnd, &pndevs.list, list) {
+       spin_lock_bh(&pndevs->lock);
+       list_for_each_entry(pnd, &pndevs->list, list) {
                dev = pnd->netdev;
                BUG_ON(!dev);
 
-               if (net_eq(dev_net(dev), net) &&
-                       (dev->reg_state == NETREG_REGISTERED) &&
+               if ((dev->reg_state == NETREG_REGISTERED) &&
                        ((pnd->netdev->flags & IFF_UP)) == IFF_UP)
                        break;
                dev = NULL;
        }
        if (dev)
                dev_hold(dev);
-       spin_unlock_bh(&pndevs.lock);
+       spin_unlock_bh(&pndevs->lock);
        return dev;
 }
 
 int phonet_address_add(struct net_device *dev, u8 addr)
 {
+       struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
        struct phonet_device *pnd;
        int err = 0;
 
-       spin_lock_bh(&pndevs.lock);
+       spin_lock_bh(&pndevs->lock);
        /* Find or create Phonet-specific device data */
        pnd = __phonet_get(dev);
        if (pnd == NULL)
@@ -102,31 +112,33 @@ int phonet_address_add(struct net_device *dev, u8 addr)
                err = -ENOMEM;
        else if (test_and_set_bit(addr >> 2, pnd->addrs))
                err = -EEXIST;
-       spin_unlock_bh(&pndevs.lock);
+       spin_unlock_bh(&pndevs->lock);
        return err;
 }
 
 int phonet_address_del(struct net_device *dev, u8 addr)
 {
+       struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
        struct phonet_device *pnd;
        int err = 0;
 
-       spin_lock_bh(&pndevs.lock);
+       spin_lock_bh(&pndevs->lock);
        pnd = __phonet_get(dev);
        if (!pnd || !test_and_clear_bit(addr >> 2, pnd->addrs))
                err = -EADDRNOTAVAIL;
        else if (bitmap_empty(pnd->addrs, 64))
                __phonet_device_free(pnd);
-       spin_unlock_bh(&pndevs.lock);
+       spin_unlock_bh(&pndevs->lock);
        return err;
 }
 
 /* Gets a source address toward a destination, through a interface. */
 u8 phonet_address_get(struct net_device *dev, u8 addr)
 {
+       struct phonet_device_list *pndevs = phonet_device_list(dev_net(dev));
        struct phonet_device *pnd;
 
-       spin_lock_bh(&pndevs.lock);
+       spin_lock_bh(&pndevs->lock);
        pnd = __phonet_get(dev);
        if (pnd) {
                BUG_ON(bitmap_empty(pnd->addrs, 64));
@@ -136,30 +148,31 @@ u8 phonet_address_get(struct net_device *dev, u8 addr)
                        addr = find_first_bit(pnd->addrs, 64) << 2;
        } else
                addr = PN_NO_ADDR;
-       spin_unlock_bh(&pndevs.lock);
+       spin_unlock_bh(&pndevs->lock);
        return addr;
 }
 
 int phonet_address_lookup(struct net *net, u8 addr)
 {
+       struct phonet_device_list *pndevs = phonet_device_list(net);
        struct phonet_device *pnd;
+       int err = -EADDRNOTAVAIL;
 
-       spin_lock_bh(&pndevs.lock);
-       list_for_each_entry(pnd, &pndevs.list, list) {
-               if (!net_eq(dev_net(pnd->netdev), net))
-                       continue;
+       spin_lock_bh(&pndevs->lock);
+       list_for_each_entry(pnd, &pndevs->list, list) {
                /* Don't allow unregistering devices! */
                if ((pnd->netdev->reg_state != NETREG_REGISTERED) ||
                                ((pnd->netdev->flags & IFF_UP)) != IFF_UP)
                        continue;
 
                if (test_bit(addr >> 2, pnd->addrs)) {
-                       spin_unlock_bh(&pndevs.lock);
-                       return 0;
+                       err = 0;
+                       goto found;
                }
        }
-       spin_unlock_bh(&pndevs.lock);
-       return -EADDRNOTAVAIL;
+found:
+       spin_unlock_bh(&pndevs->lock);
+       return err;
 }
 
 /* notify Phonet of device events */
@@ -169,14 +182,16 @@ static int phonet_device_notify(struct notifier_block *me, unsigned long what,
        struct net_device *dev = arg;
 
        if (what == NETDEV_UNREGISTER) {
+               struct phonet_device_list *pndevs;
                struct phonet_device *pnd;
 
                /* Destroy phonet-specific device data */
-               spin_lock_bh(&pndevs.lock);
+               pndevs = phonet_device_list(dev_net(dev));
+               spin_lock_bh(&pndevs->lock);
                pnd = __phonet_get(dev);
                if (pnd)
                        __phonet_device_free(pnd);
-               spin_unlock_bh(&pndevs.lock);
+               spin_unlock_bh(&pndevs->lock);
        }
        return 0;
 
@@ -187,24 +202,52 @@ static struct notifier_block phonet_device_notifier = {
        .priority = 0,
 };
 
-/* Initialize Phonet devices list */
-void phonet_device_init(void)
+/* Per-namespace Phonet devices handling */
+static int phonet_init_net(struct net *net)
 {
-       register_netdevice_notifier(&phonet_device_notifier);
+       struct phonet_net *pnn = kmalloc(sizeof(*pnn), GFP_KERNEL);
+       if (!pnn)
+               return -ENOMEM;
+
+       INIT_LIST_HEAD(&pnn->pndevs.list);
+       spin_lock_init(&pnn->pndevs.lock);
+       net_assign_generic(net, phonet_net_id, pnn);
+       return 0;
 }
 
-void phonet_device_exit(void)
+static void phonet_exit_net(struct net *net)
 {
+       struct phonet_net *pnn = net_generic(net, phonet_net_id);
        struct phonet_device *pnd, *n;
 
-       rtnl_unregister_all(PF_PHONET);
-       rtnl_lock();
-       spin_lock_bh(&pndevs.lock);
-
-       list_for_each_entry_safe(pnd, n, &pndevs.list, list)
+       list_for_each_entry_safe(pnd, n, &pnn->pndevs.list, list)
                __phonet_device_free(pnd);
 
-       spin_unlock_bh(&pndevs.lock);
-       rtnl_unlock();
+       kfree(pnn);
+}
+
+static struct pernet_operations phonet_net_ops = {
+       .init = phonet_init_net,
+       .exit = phonet_exit_net,
+};
+
+/* Initialize Phonet devices list */
+int __init phonet_device_init(void)
+{
+       int err = register_pernet_gen_device(&phonet_net_id, &phonet_net_ops);
+       if (err)
+               return err;
+
+       register_netdevice_notifier(&phonet_device_notifier);
+       err = phonet_netlink_register();
+       if (err)
+               phonet_device_exit();
+       return err;
+}
+
+void phonet_device_exit(void)
+{
+       rtnl_unregister_all(PF_PHONET);
        unregister_netdevice_notifier(&phonet_device_notifier);
+       unregister_pernet_gen_device(phonet_net_id, &phonet_net_ops);
 }
index 242fe8f8c322d5fb048d737a46d36b99797f47aa..1ceea1f92413d2d4b03d545152f339e628ab9b33 100644 (file)
@@ -123,17 +123,16 @@ nla_put_failure:
 
 static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
 {
-       struct net *net = sock_net(skb->sk);
+       struct phonet_device_list *pndevs;
        struct phonet_device *pnd;
        int dev_idx = 0, dev_start_idx = cb->args[0];
        int addr_idx = 0, addr_start_idx = cb->args[1];
 
-       spin_lock_bh(&pndevs.lock);
-       list_for_each_entry(pnd, &pndevs.list, list) {
+       pndevs = phonet_device_list(sock_net(skb->sk));
+       spin_lock_bh(&pndevs->lock);
+       list_for_each_entry(pnd, &pndevs->list, list) {
                u8 addr;
 
-               if (!net_eq(dev_net(pnd->netdev), net))
-                       continue;
                if (dev_idx > dev_start_idx)
                        addr_start_idx = 0;
                if (dev_idx++ < dev_start_idx)
@@ -153,16 +152,21 @@ static int getaddr_dumpit(struct sk_buff *skb, struct netlink_callback *cb)
        }
 
 out:
-       spin_unlock_bh(&pndevs.lock);
+       spin_unlock_bh(&pndevs->lock);
        cb->args[0] = dev_idx;
        cb->args[1] = addr_idx;
 
        return skb->len;
 }
 
-void __init phonet_netlink_register(void)
+int __init phonet_netlink_register(void)
 {
-       rtnl_register(PF_PHONET, RTM_NEWADDR, addr_doit, NULL);
-       rtnl_register(PF_PHONET, RTM_DELADDR, addr_doit, NULL);
-       rtnl_register(PF_PHONET, RTM_GETADDR, NULL, getaddr_dumpit);
+       int err = __rtnl_register(PF_PHONET, RTM_NEWADDR, addr_doit, NULL);
+       if (err)
+               return err;
+
+       /* Further __rtnl_register() cannot fail */
+       __rtnl_register(PF_PHONET, RTM_DELADDR, addr_doit, NULL);
+       __rtnl_register(PF_PHONET, RTM_GETADDR, NULL, getaddr_dumpit);
+       return 0;
 }
index 01392649b4626d930eaba64175a5e50f1dc1f57c..6501396265819eec021f89eade0f4f7e1551bdfe 100644 (file)
@@ -1587,8 +1587,7 @@ static int __init rose_proto_init(void)
                char name[IFNAMSIZ];
 
                sprintf(name, "rose%d", i);
-               dev = alloc_netdev(sizeof(struct net_device_stats),
-                                  name, rose_setup);
+               dev = alloc_netdev(0, name, rose_setup);
                if (!dev) {
                        printk(KERN_ERR "ROSE: rose_proto_init - unable to allocate memory\n");
                        rc = -ENOMEM;
index 12cfcf09556ba25a22185b99a25060a24548312e..7dcf2569613b612eb3a19f9777cbc71edaed902a 100644 (file)
@@ -57,7 +57,7 @@ static int rose_rebuild_header(struct sk_buff *skb)
 {
 #ifdef CONFIG_INET
        struct net_device *dev = skb->dev;
-       struct net_device_stats *stats = netdev_priv(dev);
+       struct net_device_stats *stats = &dev->stats;
        unsigned char *bp = (unsigned char *)skb->data;
        struct sk_buff *skbn;
        unsigned int len;
@@ -133,7 +133,7 @@ static int rose_close(struct net_device *dev)
 
 static int rose_xmit(struct sk_buff *skb, struct net_device *dev)
 {
-       struct net_device_stats *stats = netdev_priv(dev);
+       struct net_device_stats *stats = &dev->stats;
 
        if (!netif_running(dev)) {
                printk(KERN_ERR "ROSE: rose_xmit - called when iface is down\n");
@@ -144,30 +144,28 @@ static int rose_xmit(struct sk_buff *skb, struct net_device *dev)
        return 0;
 }
 
-static struct net_device_stats *rose_get_stats(struct net_device *dev)
-{
-       return netdev_priv(dev);
-}
-
 static const struct header_ops rose_header_ops = {
        .create = rose_header,
        .rebuild= rose_rebuild_header,
 };
 
+static const struct net_device_ops rose_netdev_ops = {
+       .ndo_open               = rose_open,
+       .ndo_stop               = rose_close,
+       .ndo_start_xmit         = rose_xmit,
+       .ndo_set_mac_address    = rose_set_mac_address,
+};
+
 void rose_setup(struct net_device *dev)
 {
        dev->mtu                = ROSE_MAX_PACKET_SIZE - 2;
-       dev->hard_start_xmit    = rose_xmit;
-       dev->open               = rose_open;
-       dev->stop               = rose_close;
+       dev->netdev_ops         = &rose_netdev_ops;
 
        dev->header_ops         = &rose_header_ops;
        dev->hard_header_len    = AX25_BPQ_HEADER_LEN + AX25_MAX_HEADER_LEN + ROSE_MIN_LEN;
        dev->addr_len           = ROSE_ADDR_LEN;
        dev->type               = ARPHRD_ROSE;
-       dev->set_mac_address    = rose_set_mac_address;
 
        /* New-style flags. */
        dev->flags              = IFF_NOARP;
-       dev->get_stats = rose_get_stats;
 }
index 0fc4a18fd96f7d83ec21e95bc6d0740025f6a219..32009793307be7fb39d969aa5fb029e03e01a1f6 100644 (file)
@@ -444,6 +444,17 @@ out:
 }
 EXPORT_SYMBOL(qdisc_calculate_pkt_len);
 
+void qdisc_warn_nonwc(char *txt, struct Qdisc *qdisc)
+{
+       if (!(qdisc->flags & TCQ_F_WARN_NONWC)) {
+               printk(KERN_WARNING
+                      "%s: %s qdisc %X: is non-work-conserving?\n",
+                      txt, qdisc->ops->id, qdisc->handle >> 16);
+               qdisc->flags |= TCQ_F_WARN_NONWC;
+       }
+}
+EXPORT_SYMBOL(qdisc_warn_nonwc);
+
 static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
 {
        struct qdisc_watchdog *wd = container_of(timer, struct qdisc_watchdog,
index 45c31b1a4e1dd0b488e6f6e20cc966e7aad70467..74226b265528cb9d2e37a5aed39cb48dc0c2f6db 100644 (file)
@@ -887,8 +887,7 @@ qdisc_peek_len(struct Qdisc *sch)
 
        skb = sch->ops->peek(sch);
        if (skb == NULL) {
-               if (net_ratelimit())
-                       printk("qdisc_peek_len: non work-conserving qdisc ?\n");
+               qdisc_warn_nonwc("qdisc_peek_len", sch);
                return 0;
        }
        len = qdisc_pkt_len(skb);
@@ -1642,8 +1641,7 @@ hfsc_dequeue(struct Qdisc *sch)
 
        skb = qdisc_dequeue_peeked(cl->qdisc);
        if (skb == NULL) {
-               if (net_ratelimit())
-                       printk("HFSC: Non-work-conserving qdisc ?\n");
+               qdisc_warn_nonwc("HFSC", cl->qdisc);
                return NULL;
        }
 
index 2f0f0b04d3fb127efa75b362beeb62c9aab11bde..355974f610c5946286eadbbcb978b337061698e8 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/list.h>
 #include <linux/compiler.h>
 #include <linux/rbtree.h>
+#include <linux/workqueue.h>
 #include <net/netlink.h>
 #include <net/pkt_sched.h>
 
@@ -114,8 +115,6 @@ struct htb_class {
        struct tcf_proto *filter_list;
        int filter_cnt;
 
-       int warned;             /* only one warning about non work conserving .. */
-
        /* token bucket parameters */
        struct qdisc_rate_table *rate;  /* rate table of the class itself */
        struct qdisc_rate_table *ceil;  /* ceiling rate (limits borrows too) */
@@ -155,6 +154,10 @@ struct htb_sched {
        int direct_qlen;        /* max qlen of above */
 
        long direct_pkts;
+
+#define HTB_WARN_TOOMANYEVENTS 0x1
+       unsigned int warned;    /* only one warning */
+       struct work_struct work;
 };
 
 /* find class in global hash table using given handle */
@@ -658,7 +661,7 @@ static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
  * htb_do_events - make mode changes to classes at the level
  *
  * Scans event queue for pending events and applies them. Returns time of
- * next pending event (0 for no event in pq).
+ * next pending event (0 for no event in pq, q->now for too many events).
  * Note: Applied are events whose have cl->pq_key <= q->now.
  */
 static psched_time_t htb_do_events(struct htb_sched *q, int level,
@@ -686,8 +689,14 @@ static psched_time_t htb_do_events(struct htb_sched *q, int level,
                if (cl->cmode != HTB_CAN_SEND)
                        htb_add_to_wait_tree(q, cl, diff);
        }
-       /* too much load - let's continue on next jiffie (including above) */
-       return q->now + 2 * PSCHED_TICKS_PER_SEC / HZ;
+
+       /* too much load - let's continue after a break for scheduling */
+       if (!(q->warned & HTB_WARN_TOOMANYEVENTS)) {
+               printk(KERN_WARNING "htb: too many events!\n");
+               q->warned |= HTB_WARN_TOOMANYEVENTS;
+       }
+
+       return q->now;
 }
 
 /* Returns class->node+prio from id-tree where classe's id is >= id. NULL
@@ -809,13 +818,8 @@ next:
                skb = cl->un.leaf.q->dequeue(cl->un.leaf.q);
                if (likely(skb != NULL))
                        break;
-               if (!cl->warned) {
-                       printk(KERN_WARNING
-                              "htb: class %X isn't work conserving ?!\n",
-                              cl->common.classid);
-                       cl->warned = 1;
-               }
 
+               qdisc_warn_nonwc("htb", cl->un.leaf.q);
                htb_next_rb_node((level ? cl->parent->un.inner.ptr : q->
                                  ptr[0]) + prio);
                cl = htb_lookup_leaf(q->row[level] + prio, prio,
@@ -892,7 +896,10 @@ static struct sk_buff *htb_dequeue(struct Qdisc *sch)
                }
        }
        sch->qstats.overlimits++;
-       qdisc_watchdog_schedule(&q->watchdog, next_event);
+       if (likely(next_event > q->now))
+               qdisc_watchdog_schedule(&q->watchdog, next_event);
+       else
+               schedule_work(&q->work);
 fin:
        return skb;
 }
@@ -962,6 +969,14 @@ static const struct nla_policy htb_policy[TCA_HTB_MAX + 1] = {
        [TCA_HTB_RTAB]  = { .type = NLA_BINARY, .len = TC_RTAB_SIZE },
 };
 
+static void htb_work_func(struct work_struct *work)
+{
+       struct htb_sched *q = container_of(work, struct htb_sched, work);
+       struct Qdisc *sch = q->watchdog.qdisc;
+
+       __netif_schedule(qdisc_root(sch));
+}
+
 static int htb_init(struct Qdisc *sch, struct nlattr *opt)
 {
        struct htb_sched *q = qdisc_priv(sch);
@@ -996,6 +1011,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt)
                INIT_LIST_HEAD(q->drops + i);
 
        qdisc_watchdog_init(&q->watchdog, sch);
+       INIT_WORK(&q->work, htb_work_func);
        skb_queue_head_init(&q->direct_queue);
 
        q->direct_qlen = qdisc_dev(sch)->tx_queue_len;
@@ -1188,7 +1204,6 @@ static void htb_destroy_class(struct Qdisc *sch, struct htb_class *cl)
        kfree(cl);
 }
 
-/* always caled under BH & queue lock */
 static void htb_destroy(struct Qdisc *sch)
 {
        struct htb_sched *q = qdisc_priv(sch);
@@ -1196,6 +1211,7 @@ static void htb_destroy(struct Qdisc *sch)
        struct htb_class *cl;
        unsigned int i;
 
+       cancel_work_sync(&q->work);
        qdisc_watchdog_cancel(&q->watchdog);
        /* This line used to be after htb_destroy_class call below
           and surprisingly it worked in 2.4. But it must precede it
index 7e151861794b5eb09eb7eb448834fc7be9fec3bc..9127312030472a5bf86c3e29a86c0aa44c0116f5 100644 (file)
@@ -202,7 +202,7 @@ static int multiq_tune(struct Qdisc *sch, struct nlattr *opt)
        int i;
 
        if (!netif_is_multiqueue(qdisc_dev(sch)))
-               return -EINVAL;
+               return -EOPNOTSUPP;
        if (nla_len(opt) < sizeof(*qopt))
                return -EINVAL;
 
index 2e4a8646dbc389dcb55fcce1cf6b3ad0f608af0d..d2e98803ffe30a5ffba004562ea23c00f59ff1c9 100644 (file)
@@ -83,14 +83,15 @@ static inline int sctp_rcv_checksum(struct sk_buff *skb)
 {
        struct sk_buff *list = skb_shinfo(skb)->frag_list;
        struct sctphdr *sh = sctp_hdr(skb);
-       __be32 cmp = sh->checksum;
-       __be32 val = sctp_start_cksum((__u8 *)sh, skb_headlen(skb));
+       __le32 cmp = sh->checksum;
+       __le32 val;
+       __u32 tmp = sctp_start_cksum((__u8 *)sh, skb_headlen(skb));
 
        for (; list; list = list->next)
-               val = sctp_update_cksum((__u8 *)list->data, skb_headlen(list),
-                                       val);
+               tmp = sctp_update_cksum((__u8 *)list->data, skb_headlen(list),
+                                       tmp);
 
-       val = sctp_end_cksum(val);
+       val = sctp_end_cksum(tmp);
 
        if (val != cmp) {
                /* CRC failure, dump it. */
@@ -142,7 +143,8 @@ int sctp_rcv(struct sk_buff *skb)
        __skb_pull(skb, skb_transport_offset(skb));
        if (skb->len < sizeof(struct sctphdr))
                goto discard_it;
-       if (!skb_csum_unnecessary(skb) && sctp_rcv_checksum(skb) < 0)
+       if (!sctp_checksum_disable && !skb_csum_unnecessary(skb) &&
+                 sctp_rcv_checksum(skb) < 0)
                goto discard_it;
 
        skb_pull(skb, sizeof(struct sctphdr));
index ceaa4aa066eaea3e00162d200f6d9bcb0c1d31f3..a63de3f7f1859ccf839893f69b4b7db4ee84b431 100644 (file)
@@ -97,8 +97,7 @@ static int sctp_inet6addr_event(struct notifier_block *this, unsigned long ev,
                if (addr) {
                        addr->a.v6.sin6_family = AF_INET6;
                        addr->a.v6.sin6_port = 0;
-                       memcpy(&addr->a.v6.sin6_addr, &ifa->addr,
-                                sizeof(struct in6_addr));
+                       ipv6_addr_copy(&addr->a.v6.sin6_addr, &ifa->addr);
                        addr->a.v6.sin6_scope_id = ifa->idev->dev->ifindex;
                        addr->valid = 1;
                        spin_lock_bh(&sctp_local_addr_lock);
@@ -628,9 +627,7 @@ static sctp_scope_t sctp_v6_scope(union sctp_addr *addr)
 static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
                                             struct sctp_association *asoc)
 {
-       struct inet_sock *inet = inet_sk(sk);
        struct sock *newsk;
-       struct inet_sock *newinet;
        struct ipv6_pinfo *newnp, *np = inet6_sk(sk);
        struct sctp6_sock *newsctp6sk;
 
@@ -640,17 +637,7 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
 
        sock_init_data(NULL, newsk);
 
-       newsk->sk_type = SOCK_STREAM;
-
-       newsk->sk_prot = sk->sk_prot;
-       newsk->sk_no_check = sk->sk_no_check;
-       newsk->sk_reuse = sk->sk_reuse;
-
-       newsk->sk_destruct = inet_sock_destruct;
-       newsk->sk_family = PF_INET6;
-       newsk->sk_protocol = IPPROTO_SCTP;
-       newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
-       newsk->sk_shutdown = sk->sk_shutdown;
+       sctp_copy_sock(newsk, sk, asoc);
        sock_reset_flag(sk, SOCK_ZAPPED);
 
        newsctp6sk = (struct sctp6_sock *)newsk;
@@ -658,7 +645,6 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
 
        sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped;
 
-       newinet = inet_sk(newsk);
        newnp = inet6_sk(newsk);
 
        memcpy(newnp, np, sizeof(struct ipv6_pinfo));
@@ -666,26 +652,8 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
        /* Initialize sk's sport, dport, rcv_saddr and daddr for getsockname()
         * and getpeername().
         */
-       newinet->sport = inet->sport;
-       newnp->saddr = np->saddr;
-       newnp->rcv_saddr = np->rcv_saddr;
-       newinet->dport = htons(asoc->peer.port);
        sctp_v6_to_sk_daddr(&asoc->peer.primary_addr, newsk);
 
-       /* Init the ipv4 part of the socket since we can have sockets
-        * using v6 API for ipv4.
-        */
-       newinet->uc_ttl = -1;
-       newinet->mc_loop = 1;
-       newinet->mc_ttl = 1;
-       newinet->mc_index = 0;
-       newinet->mc_list = NULL;
-
-       if (ipv4_config.no_pmtu_disc)
-               newinet->pmtudisc = IP_PMTUDISC_DONT;
-       else
-               newinet->pmtudisc = IP_PMTUDISC_WANT;
-
        sk_refcnt_debug_inc(newsk);
 
        if (newsk->sk_prot->init(newsk)) {
index 73639355157e8bea9659b5539fb2d83f6c67a919..07d58903a74625dd2ec25982a617a6cad2d59ae3 100644 (file)
@@ -367,7 +367,6 @@ int sctp_packet_transmit(struct sctp_packet *packet)
        struct sctp_transport *tp = packet->transport;
        struct sctp_association *asoc = tp->asoc;
        struct sctphdr *sh;
-       __be32 crc32 = __constant_cpu_to_be32(0);
        struct sk_buff *nskb;
        struct sctp_chunk *chunk, *tmp;
        struct sock *sk;
@@ -531,17 +530,16 @@ int sctp_packet_transmit(struct sctp_packet *packet)
         * Note: Adler-32 is no longer applicable, as has been replaced
         * by CRC32-C as described in <draft-ietf-tsvwg-sctpcsum-02.txt>.
         */
-       if (!(dst->dev->features & NETIF_F_NO_CSUM)) {
-               crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
-               crc32 = sctp_end_cksum(crc32);
+       if (!sctp_checksum_disable && !(dst->dev->features & NETIF_F_NO_CSUM)) {
+               __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
+
+               /* 3) Put the resultant value into the checksum field in the
+                *    common header, and leave the rest of the bits unchanged.
+                */
+               sh->checksum = sctp_end_cksum(crc32);
        } else
                nskb->ip_summed = CHECKSUM_UNNECESSARY;
 
-       /* 3) Put the resultant value into the checksum field in the
-        *    common header, and leave the rest of the bits unchanged.
-        */
-       sh->checksum = crc32;
-
        /* IP layer ECN support
         * From RFC 2481
         *  "The ECN-Capable Transport (ECT) bit would be set by the
index b78e3be6901398f7a62b76a291fb8954341aacc0..c1e316ee7155d52abad10d8ec40b926a2d3c6e42 100644 (file)
@@ -589,46 +589,21 @@ static int sctp_v4_is_ce(const struct sk_buff *skb)
 static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
                                             struct sctp_association *asoc)
 {
-       struct inet_sock *inet = inet_sk(sk);
-       struct inet_sock *newinet;
        struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL,
                        sk->sk_prot);
+       struct inet_sock *newinet;
 
        if (!newsk)
                goto out;
 
        sock_init_data(NULL, newsk);
 
-       newsk->sk_type = SOCK_STREAM;
-
-       newsk->sk_no_check = sk->sk_no_check;
-       newsk->sk_reuse = sk->sk_reuse;
-       newsk->sk_shutdown = sk->sk_shutdown;
-
-       newsk->sk_destruct = inet_sock_destruct;
-       newsk->sk_family = PF_INET;
-       newsk->sk_protocol = IPPROTO_SCTP;
-       newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
+       sctp_copy_sock(newsk, sk, asoc);
        sock_reset_flag(newsk, SOCK_ZAPPED);
 
        newinet = inet_sk(newsk);
 
-       /* Initialize sk's sport, dport, rcv_saddr and daddr for
-        * getsockname() and getpeername()
-        */
-       newinet->sport = inet->sport;
-       newinet->saddr = inet->saddr;
-       newinet->rcv_saddr = inet->rcv_saddr;
-       newinet->dport = htons(asoc->peer.port);
        newinet->daddr = asoc->peer.primary_addr.v4.sin_addr.s_addr;
-       newinet->pmtudisc = inet->pmtudisc;
-       newinet->id = asoc->next_tsn ^ jiffies;
-
-       newinet->uc_ttl = -1;
-       newinet->mc_loop = 1;
-       newinet->mc_ttl = 1;
-       newinet->mc_index = 0;
-       newinet->mc_list = NULL;
 
        sk_refcnt_debug_inc(newsk);
 
@@ -1411,4 +1386,6 @@ MODULE_ALIAS("net-pf-" __stringify(PF_INET) "-proto-132");
 MODULE_ALIAS("net-pf-" __stringify(PF_INET6) "-proto-132");
 MODULE_AUTHOR("Linux Kernel SCTP developers <lksctp-developers@lists.sourceforge.net>");
 MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)");
+module_param_named(no_checksums, sctp_checksum_disable, bool, 0644);
+MODULE_PARM_DESC(no_checksums, "Disable checksums computing and verification");
 MODULE_LICENSE("GPL");
index fd8acb48c3f2827f069c36b8ef01e0fd34f14349..b40e95f9851b243870f2c1306c730ee7ff72e215 100644 (file)
@@ -100,11 +100,11 @@ int sctp_chunk_iif(const struct sctp_chunk *chunk)
  */
 static const struct sctp_paramhdr ecap_param = {
        SCTP_PARAM_ECN_CAPABLE,
-       __constant_htons(sizeof(struct sctp_paramhdr)),
+       cpu_to_be16(sizeof(struct sctp_paramhdr)),
 };
 static const struct sctp_paramhdr prsctp_param = {
        SCTP_PARAM_FWD_TSN_SUPPORT,
-       __constant_htons(sizeof(struct sctp_paramhdr)),
+       cpu_to_be16(sizeof(struct sctp_paramhdr)),
 };
 
 /* A helper to initialize to initialize an op error inside a
index e1d6076b4f59531e6fa5ccd352e42f5e15b8a08b..0146cfb1f1820c0f3408f61d9f6bcb889fd0d193 100644 (file)
@@ -461,9 +461,15 @@ static void sctp_do_8_2_transport_strike(struct sctp_association *asoc,
         * expires, set RTO <- RTO * 2 ("back off the timer").  The
         * maximum value discussed in rule C7 above (RTO.max) may be
         * used to provide an upper bound to this doubling operation.
+        *
+        * Special Case:  the first HB doesn't trigger exponential backoff.
+        * The first unacknowleged HB triggers it.  We do this with a flag
+        * that indicates that we have an outstanding HB.
         */
-       transport->last_rto = transport->rto;
-       transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
+       if (transport->hb_sent) {
+               transport->last_rto = transport->rto;
+               transport->rto = min((transport->rto * 2), transport->asoc->rto_max);
+       }
 }
 
 /* Worker routine to handle INIT command failure.  */
@@ -621,6 +627,11 @@ static void sctp_cmd_transport_on(sctp_cmd_seq_t *cmds,
        t->error_count = 0;
        t->asoc->overall_error_count = 0;
 
+       /* Clear the hb_sent flag to signal that we had a good
+        * acknowledgement.
+        */
+       t->hb_sent = 0;
+
        /* Mark the destination transport address as active if it is not so
         * marked.
         */
@@ -657,6 +668,8 @@ static void sctp_cmd_transport_reset(sctp_cmd_seq_t *cmds,
 
        /* Mark one strike against a transport.  */
        sctp_do_8_2_transport_strike(asoc, t);
+
+       t->hb_sent = 1;
 }
 
 /* Helper function to process the process SACK command.  */
index ff0a8f88de04bd275f3b16b921ed88d846407ca4..dea864f5de54cd1fab32036ad4e89350f6e32a12 100644 (file)
@@ -3939,7 +3939,6 @@ SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc,
 {
        struct sock *sk = asoc->base.sk;
        struct socket *sock;
-       struct inet_sock *inetsk;
        struct sctp_af *af;
        int err = 0;
 
@@ -3954,18 +3953,18 @@ SCTP_STATIC int sctp_do_peeloff(struct sctp_association *asoc,
        if (err < 0)
                return err;
 
-       /* Populate the fields of the newsk from the oldsk and migrate the
-        * asoc to the newsk.
-        */
-       sctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH);
+       sctp_copy_sock(sock->sk, sk, asoc);
 
        /* Make peeled-off sockets more like 1-1 accepted sockets.
         * Set the daddr and initialize id to something more random
         */
        af = sctp_get_af_specific(asoc->peer.primary_addr.sa.sa_family);
        af->to_sk_daddr(&asoc->peer.primary_addr, sk);
-       inetsk = inet_sk(sock->sk);
-       inetsk->id = asoc->next_tsn ^ jiffies;
+
+       /* Populate the fields of the newsk from the oldsk and migrate the
+        * asoc to the newsk.
+        */
+       sctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH);
 
        *sockp = sock;
 
@@ -6700,6 +6699,48 @@ done:
        sctp_skb_set_owner_r(skb, sk);
 }
 
+void sctp_copy_sock(struct sock *newsk, struct sock *sk,
+                   struct sctp_association *asoc)
+{
+       struct inet_sock *inet = inet_sk(sk);
+       struct inet_sock *newinet = inet_sk(newsk);
+
+       newsk->sk_type = sk->sk_type;
+       newsk->sk_bound_dev_if = sk->sk_bound_dev_if;
+       newsk->sk_flags = sk->sk_flags;
+       newsk->sk_no_check = sk->sk_no_check;
+       newsk->sk_reuse = sk->sk_reuse;
+
+       newsk->sk_shutdown = sk->sk_shutdown;
+       newsk->sk_destruct = inet_sock_destruct;
+       newsk->sk_family = sk->sk_family;
+       newsk->sk_protocol = IPPROTO_SCTP;
+       newsk->sk_backlog_rcv = sk->sk_prot->backlog_rcv;
+       newsk->sk_sndbuf = sk->sk_sndbuf;
+       newsk->sk_rcvbuf = sk->sk_rcvbuf;
+       newsk->sk_lingertime = sk->sk_lingertime;
+       newsk->sk_rcvtimeo = sk->sk_rcvtimeo;
+       newsk->sk_sndtimeo = sk->sk_sndtimeo;
+
+       newinet = inet_sk(newsk);
+
+       /* Initialize sk's sport, dport, rcv_saddr and daddr for
+        * getsockname() and getpeername()
+        */
+       newinet->sport = inet->sport;
+       newinet->saddr = inet->saddr;
+       newinet->rcv_saddr = inet->rcv_saddr;
+       newinet->dport = htons(asoc->peer.port);
+       newinet->pmtudisc = inet->pmtudisc;
+       newinet->id = asoc->next_tsn ^ jiffies;
+
+       newinet->uc_ttl = inet->uc_ttl;
+       newinet->mc_loop = 1;
+       newinet->mc_ttl = 1;
+       newinet->mc_index = 0;
+       newinet->mc_list = NULL;
+}
+
 /* Populate the fields of the newsk from the oldsk and migrate the assoc
  * and its messages to the newsk.
  */
index e745c118f2396e19bdd35387ed27551aeef4e252..5c29b14ee9afc43a33c9866757b9461b8acc6cab 100644 (file)
@@ -79,6 +79,7 @@ static struct sctp_transport *sctp_transport_init(struct sctp_transport *peer,
        peer->rttvar = 0;
        peer->srtt = 0;
        peer->rto_pending = 0;
+       peer->hb_sent = 0;
        peer->fast_recovery = 0;
 
        peer->last_time_heard = jiffies;
@@ -608,6 +609,7 @@ void sctp_transport_reset(struct sctp_transport *t)
        t->flight_size = 0;
        t->error_count = 0;
        t->rto_pending = 0;
+       t->hb_sent = 0;
        t->fast_recovery = 0;
 
        /* Initialize the state information for SFR-CACC */
index 35dd7371752a9448ff6162af9255ac0b0891ec35..47a3dc074eb0d643f432fb2d58007ea8bf4b9b49 100644 (file)
@@ -545,6 +545,18 @@ void sock_release(struct socket *sock)
        sock->file = NULL;
 }
 
+int sock_tx_timestamp(struct msghdr *msg, struct sock *sk,
+                     union skb_shared_tx *shtx)
+{
+       shtx->flags = 0;
+       if (sock_flag(sk, SOCK_TIMESTAMPING_TX_HARDWARE))
+               shtx->hardware = 1;
+       if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE))
+               shtx->software = 1;
+       return 0;
+}
+EXPORT_SYMBOL(sock_tx_timestamp);
+
 static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock,
                                 struct msghdr *msg, size_t size)
 {
@@ -595,33 +607,65 @@ int kernel_sendmsg(struct socket *sock, struct msghdr *msg,
        return result;
 }
 
+static int ktime2ts(ktime_t kt, struct timespec *ts)
+{
+       if (kt.tv64) {
+               *ts = ktime_to_timespec(kt);
+               return 1;
+       } else {
+               return 0;
+       }
+}
+
 /*
  * called from sock_recv_timestamp() if sock_flag(sk, SOCK_RCVTSTAMP)
  */
 void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
        struct sk_buff *skb)
 {
-       ktime_t kt = skb->tstamp;
-
-       if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) {
-               struct timeval tv;
-               /* Race occurred between timestamp enabling and packet
-                  receiving.  Fill in the current time for now. */
-               if (kt.tv64 == 0)
-                       kt = ktime_get_real();
-               skb->tstamp = kt;
-               tv = ktime_to_timeval(kt);
-               put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP, sizeof(tv), &tv);
-       } else {
-               struct timespec ts;
-               /* Race occurred between timestamp enabling and packet
-                  receiving.  Fill in the current time for now. */
-               if (kt.tv64 == 0)
-                       kt = ktime_get_real();
-               skb->tstamp = kt;
-               ts = ktime_to_timespec(kt);
-               put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPNS, sizeof(ts), &ts);
+       int need_software_tstamp = sock_flag(sk, SOCK_RCVTSTAMP);
+       struct timespec ts[3];
+       int empty = 1;
+       struct skb_shared_hwtstamps *shhwtstamps =
+               skb_hwtstamps(skb);
+
+       /* Race occurred between timestamp enabling and packet
+          receiving.  Fill in the current time for now. */
+       if (need_software_tstamp && skb->tstamp.tv64 == 0)
+               __net_timestamp(skb);
+
+       if (need_software_tstamp) {
+               if (!sock_flag(sk, SOCK_RCVTSTAMPNS)) {
+                       struct timeval tv;
+                       skb_get_timestamp(skb, &tv);
+                       put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP,
+                                sizeof(tv), &tv);
+               } else {
+                       struct timespec ts;
+                       skb_get_timestampns(skb, &ts);
+                       put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMPNS,
+                                sizeof(ts), &ts);
+               }
+       }
+
+
+       memset(ts, 0, sizeof(ts));
+       if (skb->tstamp.tv64 &&
+           sock_flag(sk, SOCK_TIMESTAMPING_SOFTWARE)) {
+               skb_get_timestampns(skb, ts + 0);
+               empty = 0;
+       }
+       if (shhwtstamps) {
+               if (sock_flag(sk, SOCK_TIMESTAMPING_SYS_HARDWARE) &&
+                   ktime2ts(shhwtstamps->syststamp, ts + 1))
+                       empty = 0;
+               if (sock_flag(sk, SOCK_TIMESTAMPING_RAW_HARDWARE) &&
+                   ktime2ts(shhwtstamps->hwtstamp, ts + 2))
+                       empty = 0;
        }
+       if (!empty)
+               put_cmsg(msg, SOL_SOCKET,
+                        SCM_TIMESTAMPING, sizeof(ts), &ts);
 }
 
 EXPORT_SYMBOL_GPL(__sock_recv_timestamp);
index 5cbb404c4cdf89da7a6dd328ec5d7137d2d54dbc..b49e434c094f8ee93be273e9311093ede6f761bb 100644 (file)
@@ -1215,6 +1215,23 @@ out:
        read_unlock(&sk->sk_callback_lock);
 }
 
+static void xs_write_space(struct sock *sk)
+{
+       struct socket *sock;
+       struct rpc_xprt *xprt;
+
+       if (unlikely(!(sock = sk->sk_socket)))
+               return;
+       clear_bit(SOCK_NOSPACE, &sock->flags);
+
+       if (unlikely(!(xprt = xprt_from_sock(sk))))
+               return;
+       if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0)
+               return;
+
+       xprt_write_space(xprt);
+}
+
 /**
  * xs_udp_write_space - callback invoked when socket buffer space
  *                             becomes available
@@ -1230,23 +1247,9 @@ static void xs_udp_write_space(struct sock *sk)
        read_lock(&sk->sk_callback_lock);
 
        /* from net/core/sock.c:sock_def_write_space */
-       if (sock_writeable(sk)) {
-               struct socket *sock;
-               struct rpc_xprt *xprt;
-
-               if (unlikely(!(sock = sk->sk_socket)))
-                       goto out;
-               clear_bit(SOCK_NOSPACE, &sock->flags);
-
-               if (unlikely(!(xprt = xprt_from_sock(sk))))
-                       goto out;
-               if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0)
-                       goto out;
-
-               xprt_write_space(xprt);
-       }
+       if (sock_writeable(sk))
+               xs_write_space(sk);
 
- out:
        read_unlock(&sk->sk_callback_lock);
 }
 
@@ -1265,23 +1268,9 @@ static void xs_tcp_write_space(struct sock *sk)
        read_lock(&sk->sk_callback_lock);
 
        /* from net/core/stream.c:sk_stream_write_space */
-       if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk)) {
-               struct socket *sock;
-               struct rpc_xprt *xprt;
-
-               if (unlikely(!(sock = sk->sk_socket)))
-                       goto out;
-               clear_bit(SOCK_NOSPACE, &sock->flags);
+       if (sk_stream_wspace(sk) >= sk_stream_min_wspace(sk))
+               xs_write_space(sk);
 
-               if (unlikely(!(xprt = xprt_from_sock(sk))))
-                       goto out;
-               if (test_and_clear_bit(SOCK_ASYNC_NOSPACE, &sock->flags) == 0)
-                       goto out;
-
-               xprt_write_space(xprt);
-       }
-
- out:
        read_unlock(&sk->sk_callback_lock);
 }
 
index cb3b4ad53683682be59abe46d215d0417612ea1d..5d149c1b5f0dee96280e854e38304682afdfbd9d 100644 (file)
@@ -258,7 +258,6 @@ EXPORT_SYMBOL_GPL(wimax_msg_len);
  */
 int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb)
 {
-       int result;
        struct device *dev = wimax_dev->net_dev->dev.parent;
        void *msg = skb->data;
        size_t size = skb->len;
@@ -266,11 +265,9 @@ int wimax_msg_send(struct wimax_dev *wimax_dev, struct sk_buff *skb)
 
        d_printf(1, dev, "CTX: wimax msg, %zu bytes\n", size);
        d_dump(2, dev, msg, size);
-       result = genlmsg_multicast(skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
-       d_printf(1, dev, "CTX: genl multicast result %d\n", result);
-       if (result == -ESRCH)   /* Nobody connected, ignore it */
-               result = 0;     /* btw, the skb is freed already */
-       return result;
+       genlmsg_multicast(skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
+       d_printf(1, dev, "CTX: genl multicast done\n");
+       return 0;
 }
 EXPORT_SYMBOL_GPL(wimax_msg_send);
 
index 3869c0327882ef292d30515cf2586ef7a260dbab..a0ee76b525109241fe037721545274c1bda57262 100644 (file)
@@ -163,16 +163,12 @@ int wimax_gnl_re_state_change_send(
        struct device *dev = wimax_dev_to_dev(wimax_dev);
        d_fnstart(3, dev, "(wimax_dev %p report_skb %p)\n",
                  wimax_dev, report_skb);
-       if (report_skb == NULL)
+       if (report_skb == NULL) {
+               result = -ENOMEM;
                goto out;
-       genlmsg_end(report_skb, header);
-       result = genlmsg_multicast(report_skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
-       if (result == -ESRCH)   /* Nobody connected, ignore it */
-               result = 0;     /* btw, the skb is freed already */
-       if (result < 0) {
-               dev_err(dev, "RE_STCH: Error sending: %d\n", result);
-               nlmsg_free(report_skb);
        }
+       genlmsg_end(report_skb, header);
+       genlmsg_multicast(report_skb, 0, wimax_gnl_mcg.id, GFP_KERNEL);
 out:
        d_fnend(3, dev, "(wimax_dev %p report_skb %p) = %d\n",
                wimax_dev, report_skb, result);
index 938a334c8dbc3ba6fe72afbd1b320f41bdd7c73f..dad43c24f695283b1faed4e579a5f0cb2abfd07f 100644 (file)
@@ -5,7 +5,7 @@ obj-$(CONFIG_LIB80211_CRYPT_WEP) += lib80211_crypt_wep.o
 obj-$(CONFIG_LIB80211_CRYPT_CCMP) += lib80211_crypt_ccmp.o
 obj-$(CONFIG_LIB80211_CRYPT_TKIP) += lib80211_crypt_tkip.o
 
-cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o
+cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o
 cfg80211-$(CONFIG_WIRELESS_EXT) += wext-compat.o
 cfg80211-$(CONFIG_NL80211) += nl80211.o
 
index b96fc0c3f1c446132cf71e3e0464a6a2ff4edd84..0668b2bfc1dafb4c880b565a1a12ec8e30e9e329 100644 (file)
@@ -240,6 +240,8 @@ struct wiphy *wiphy_new(struct cfg80211_ops *ops, int sizeof_priv)
        mutex_init(&drv->mtx);
        mutex_init(&drv->devlist_mtx);
        INIT_LIST_HEAD(&drv->netdev_list);
+       spin_lock_init(&drv->bss_lock);
+       INIT_LIST_HEAD(&drv->bss_list);
 
        device_initialize(&drv->wiphy.dev);
        drv->wiphy.dev.class = &ieee80211_class;
@@ -259,6 +261,9 @@ int wiphy_register(struct wiphy *wiphy)
        int i;
        u16 ifmodes = wiphy->interface_modes;
 
+       if (WARN_ON(wiphy->max_scan_ssids < 1))
+               return -EINVAL;
+
        /* sanity check ifmodes */
        WARN_ON(!ifmodes);
        ifmodes &= ((1 << __NL80211_IFTYPE_AFTER_LAST) - 1) & ~1;
@@ -273,10 +278,16 @@ int wiphy_register(struct wiphy *wiphy)
 
                sband->band = band;
 
-               if (!sband->n_channels || !sband->n_bitrates) {
-                       WARN_ON(1);
+               if (WARN_ON(!sband->n_channels || !sband->n_bitrates))
+                       return -EINVAL;
+
+               /*
+                * Since we use a u32 for rate bitmaps in
+                * ieee80211_get_response_rate, we cannot
+                * have more than 32 legacy rates.
+                */
+               if (WARN_ON(sband->n_bitrates > 32))
                        return -EINVAL;
-               }
 
                for (i = 0; i < sband->n_channels; i++) {
                        sband->channels[i].orig_flags =
@@ -361,8 +372,11 @@ EXPORT_SYMBOL(wiphy_unregister);
 
 void cfg80211_dev_free(struct cfg80211_registered_device *drv)
 {
+       struct cfg80211_internal_bss *scan, *tmp;
        mutex_destroy(&drv->mtx);
        mutex_destroy(&drv->devlist_mtx);
+       list_for_each_entry_safe(scan, tmp, &drv->bss_list, list)
+               cfg80211_put_bss(&scan->pub);
        kfree(drv);
 }
 
index f7fb9f413028a7f4783e2d7ae1616ebc1dcfe311..e29ad4cd464f3587fca6f06ff6892f1a6a04fc6f 100644 (file)
@@ -8,6 +8,8 @@
 #include <linux/mutex.h>
 #include <linux/list.h>
 #include <linux/netdevice.h>
+#include <linux/kref.h>
+#include <linux/rbtree.h>
 #include <net/genetlink.h>
 #include <net/wireless.h>
 #include <net/cfg80211.h>
@@ -41,6 +43,13 @@ struct cfg80211_registered_device {
        struct mutex devlist_mtx;
        struct list_head netdev_list;
 
+       /* BSSes/scanning */
+       spinlock_t bss_lock;
+       struct list_head bss_list;
+       struct rb_root bss_tree;
+       u32 bss_generation;
+       struct cfg80211_scan_request *scan_req; /* protected by RTNL */
+
        /* must be last because of the way we do wiphy_priv(),
         * and it should at least be aligned to NETDEV_ALIGN */
        struct wiphy wiphy __attribute__((__aligned__(NETDEV_ALIGN)));
@@ -56,6 +65,15 @@ struct cfg80211_registered_device *wiphy_to_dev(struct wiphy *wiphy)
 extern struct mutex cfg80211_drv_mutex;
 extern struct list_head cfg80211_drv_list;
 
+struct cfg80211_internal_bss {
+       struct list_head list;
+       struct rb_node rbn;
+       unsigned long ts;
+       struct kref ref;
+       /* must be last because of priv member */
+       struct cfg80211_bss pub;
+};
+
 /*
  * This function returns a pointer to the driver
  * that the genl_info item that is passed refers to.
@@ -94,4 +112,6 @@ extern int cfg80211_dev_rename(struct cfg80211_registered_device *drv,
 void ieee80211_set_bitrate_flags(struct wiphy *wiphy);
 void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby);
 
+void cfg80211_bss_expire(struct cfg80211_registered_device *dev);
+
 #endif /* __NET_WIRELESS_CORE_H */
index 1e728fff474eb97bce9c983fac4afbc005f66fd1..298a4de5994833b39380d7936e75dbf66e98a85b 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/nl80211.h>
 #include <linux/rtnetlink.h>
 #include <linux/netlink.h>
+#include <linux/etherdevice.h>
 #include <net/genetlink.h>
 #include <net/cfg80211.h>
 #include "core.h"
@@ -105,6 +106,12 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = {
 
        [NL80211_ATTR_HT_CAPABILITY] = { .type = NLA_BINARY,
                                         .len = NL80211_HT_CAPABILITY_LEN },
+
+       [NL80211_ATTR_MGMT_SUBTYPE] = { .type = NLA_U8 },
+       [NL80211_ATTR_IE] = { .type = NLA_BINARY,
+                             .len = IEEE80211_MAX_DATA_LEN },
+       [NL80211_ATTR_SCAN_FREQUENCIES] = { .type = NLA_NESTED },
+       [NL80211_ATTR_SCAN_SSIDS] = { .type = NLA_NESTED },
 };
 
 /* message building helper */
@@ -137,6 +144,8 @@ static int nl80211_send_wiphy(struct sk_buff *msg, u32 pid, u32 seq, int flags,
 
        NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, dev->idx);
        NLA_PUT_STRING(msg, NL80211_ATTR_WIPHY_NAME, wiphy_name(&dev->wiphy));
+       NLA_PUT_U8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
+                  dev->wiphy.max_scan_ssids);
 
        nl_modes = nla_nest_start(msg, NL80211_ATTR_SUPPORTED_IFTYPES);
        if (!nl_modes)
@@ -738,7 +747,7 @@ static int nl80211_get_key(struct sk_buff *skb, struct genl_info *info)
        if (info->attrs[NL80211_ATTR_KEY_IDX])
                key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]);
 
-       if (key_idx > 3)
+       if (key_idx > 5)
                return -EINVAL;
 
        if (info->attrs[NL80211_ATTR_MAC])
@@ -804,30 +813,41 @@ static int nl80211_set_key(struct sk_buff *skb, struct genl_info *info)
        int err;
        struct net_device *dev;
        u8 key_idx;
+       int (*func)(struct wiphy *wiphy, struct net_device *netdev,
+                   u8 key_index);
 
        if (!info->attrs[NL80211_ATTR_KEY_IDX])
                return -EINVAL;
 
        key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]);
 
-       if (key_idx > 3)
+       if (info->attrs[NL80211_ATTR_KEY_DEFAULT_MGMT]) {
+               if (key_idx < 4 || key_idx > 5)
+                       return -EINVAL;
+       } else if (key_idx > 3)
                return -EINVAL;
 
        /* currently only support setting default key */
-       if (!info->attrs[NL80211_ATTR_KEY_DEFAULT])
+       if (!info->attrs[NL80211_ATTR_KEY_DEFAULT] &&
+           !info->attrs[NL80211_ATTR_KEY_DEFAULT_MGMT])
                return -EINVAL;
 
        err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
        if (err)
                return err;
 
-       if (!drv->ops->set_default_key) {
+       if (info->attrs[NL80211_ATTR_KEY_DEFAULT])
+               func = drv->ops->set_default_key;
+       else
+               func = drv->ops->set_default_mgmt_key;
+
+       if (!func) {
                err = -EOPNOTSUPP;
                goto out;
        }
 
        rtnl_lock();
-       err = drv->ops->set_default_key(&drv->wiphy, dev, key_idx);
+       err = func(&drv->wiphy, dev, key_idx);
        rtnl_unlock();
 
  out:
@@ -863,7 +883,7 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
        if (info->attrs[NL80211_ATTR_MAC])
                mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]);
 
-       if (key_idx > 3)
+       if (key_idx > 5)
                return -EINVAL;
 
        /*
@@ -894,6 +914,10 @@ static int nl80211_new_key(struct sk_buff *skb, struct genl_info *info)
                if (params.key_len != 13)
                        return -EINVAL;
                break;
+       case WLAN_CIPHER_SUITE_AES_CMAC:
+               if (params.key_len != 16)
+                       return -EINVAL;
+               break;
        default:
                return -EINVAL;
        }
@@ -928,7 +952,7 @@ static int nl80211_del_key(struct sk_buff *skb, struct genl_info *info)
        if (info->attrs[NL80211_ATTR_KEY_IDX])
                key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]);
 
-       if (key_idx > 3)
+       if (key_idx > 5)
                return -EINVAL;
 
        if (info->attrs[NL80211_ATTR_MAC])
@@ -1889,6 +1913,11 @@ static int nl80211_req_set_reg(struct sk_buff *skb, struct genl_info *info)
        mutex_lock(&cfg80211_drv_mutex);
        r = __regulatory_hint(NULL, REGDOM_SET_BY_USER, data, 0, ENVIRON_ANY);
        mutex_unlock(&cfg80211_drv_mutex);
+       /* This means the regulatory domain was already set, however
+        * we don't want to confuse userspace with a "successful error"
+        * message so lets just treat it as a success */
+       if (r == -EALREADY)
+               r = 0;
        return r;
 }
 
@@ -2069,6 +2098,81 @@ static int nl80211_set_mesh_params(struct sk_buff *skb, struct genl_info *info)
 
 #undef FILL_IN_MESH_PARAM_IF_SET
 
+static int nl80211_get_reg(struct sk_buff *skb, struct genl_info *info)
+{
+       struct sk_buff *msg;
+       void *hdr = NULL;
+       struct nlattr *nl_reg_rules;
+       unsigned int i;
+       int err = -EINVAL;
+
+       mutex_lock(&cfg80211_drv_mutex);
+
+       if (!cfg80211_regdomain)
+               goto out;
+
+       msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
+       if (!msg) {
+               err = -ENOBUFS;
+               goto out;
+       }
+
+       hdr = nl80211hdr_put(msg, info->snd_pid, info->snd_seq, 0,
+                            NL80211_CMD_GET_REG);
+       if (!hdr)
+               goto nla_put_failure;
+
+       NLA_PUT_STRING(msg, NL80211_ATTR_REG_ALPHA2,
+               cfg80211_regdomain->alpha2);
+
+       nl_reg_rules = nla_nest_start(msg, NL80211_ATTR_REG_RULES);
+       if (!nl_reg_rules)
+               goto nla_put_failure;
+
+       for (i = 0; i < cfg80211_regdomain->n_reg_rules; i++) {
+               struct nlattr *nl_reg_rule;
+               const struct ieee80211_reg_rule *reg_rule;
+               const struct ieee80211_freq_range *freq_range;
+               const struct ieee80211_power_rule *power_rule;
+
+               reg_rule = &cfg80211_regdomain->reg_rules[i];
+               freq_range = &reg_rule->freq_range;
+               power_rule = &reg_rule->power_rule;
+
+               nl_reg_rule = nla_nest_start(msg, i);
+               if (!nl_reg_rule)
+                       goto nla_put_failure;
+
+               NLA_PUT_U32(msg, NL80211_ATTR_REG_RULE_FLAGS,
+                       reg_rule->flags);
+               NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_START,
+                       freq_range->start_freq_khz);
+               NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_END,
+                       freq_range->end_freq_khz);
+               NLA_PUT_U32(msg, NL80211_ATTR_FREQ_RANGE_MAX_BW,
+                       freq_range->max_bandwidth_khz);
+               NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_ANT_GAIN,
+                       power_rule->max_antenna_gain);
+               NLA_PUT_U32(msg, NL80211_ATTR_POWER_RULE_MAX_EIRP,
+                       power_rule->max_eirp);
+
+               nla_nest_end(msg, nl_reg_rule);
+       }
+
+       nla_nest_end(msg, nl_reg_rules);
+
+       genlmsg_end(msg, hdr);
+       err = genlmsg_unicast(msg, info->snd_pid);
+       goto out;
+
+nla_put_failure:
+       genlmsg_cancel(msg, hdr);
+       err = -EMSGSIZE;
+out:
+       mutex_unlock(&cfg80211_drv_mutex);
+       return err;
+}
+
 static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
 {
        struct nlattr *tb[NL80211_REG_RULE_ATTR_MAX + 1];
@@ -2134,6 +2238,283 @@ static int nl80211_set_reg(struct sk_buff *skb, struct genl_info *info)
        return -EINVAL;
 }
 
+static int nl80211_set_mgmt_extra_ie(struct sk_buff *skb,
+                                    struct genl_info *info)
+{
+       struct cfg80211_registered_device *drv;
+       int err;
+       struct net_device *dev;
+       struct mgmt_extra_ie_params params;
+
+       memset(&params, 0, sizeof(params));
+
+       if (!info->attrs[NL80211_ATTR_MGMT_SUBTYPE])
+               return -EINVAL;
+       params.subtype = nla_get_u8(info->attrs[NL80211_ATTR_MGMT_SUBTYPE]);
+       if (params.subtype > 15)
+               return -EINVAL; /* FC Subtype field is 4 bits (0..15) */
+
+       if (info->attrs[NL80211_ATTR_IE]) {
+               params.ies = nla_data(info->attrs[NL80211_ATTR_IE]);
+               params.ies_len = nla_len(info->attrs[NL80211_ATTR_IE]);
+       }
+
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
+       if (err)
+               return err;
+
+       if (drv->ops->set_mgmt_extra_ie) {
+               rtnl_lock();
+               err = drv->ops->set_mgmt_extra_ie(&drv->wiphy, dev, &params);
+               rtnl_unlock();
+       } else
+               err = -EOPNOTSUPP;
+
+       cfg80211_put_dev(drv);
+       dev_put(dev);
+       return err;
+}
+
+static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
+{
+       struct cfg80211_registered_device *drv;
+       struct net_device *dev;
+       struct cfg80211_scan_request *request;
+       struct cfg80211_ssid *ssid;
+       struct ieee80211_channel *channel;
+       struct nlattr *attr;
+       struct wiphy *wiphy;
+       int err, tmp, n_ssids = 0, n_channels = 0, i;
+       enum ieee80211_band band;
+
+       err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev);
+       if (err)
+               return err;
+
+       wiphy = &drv->wiphy;
+
+       if (!drv->ops->scan) {
+               err = -EOPNOTSUPP;
+               goto out;
+       }
+
+       rtnl_lock();
+
+       if (drv->scan_req) {
+               err = -EBUSY;
+               goto out_unlock;
+       }
+
+       if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) {
+               nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_FREQUENCIES], tmp)
+                       n_channels++;
+               if (!n_channels) {
+                       err = -EINVAL;
+                       goto out_unlock;
+               }
+       } else {
+               for (band = 0; band < IEEE80211_NUM_BANDS; band++)
+                       if (wiphy->bands[band])
+                               n_channels += wiphy->bands[band]->n_channels;
+       }
+
+       if (info->attrs[NL80211_ATTR_SCAN_SSIDS])
+               nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp)
+                       n_ssids++;
+
+       if (n_ssids > wiphy->max_scan_ssids) {
+               err = -EINVAL;
+               goto out_unlock;
+       }
+
+       request = kzalloc(sizeof(*request)
+                       + sizeof(*ssid) * n_ssids
+                       + sizeof(channel) * n_channels, GFP_KERNEL);
+       if (!request) {
+               err = -ENOMEM;
+               goto out_unlock;
+       }
+
+       request->channels = (void *)((char *)request + sizeof(*request));
+       request->n_channels = n_channels;
+       if (n_ssids)
+               request->ssids = (void *)(request->channels + n_channels);
+       request->n_ssids = n_ssids;
+
+       if (info->attrs[NL80211_ATTR_SCAN_FREQUENCIES]) {
+               /* user specified, bail out if channel not found */
+               request->n_channels = n_channels;
+               i = 0;
+               nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_FREQUENCIES], tmp) {
+                       request->channels[i] = ieee80211_get_channel(wiphy, nla_get_u32(attr));
+                       if (!request->channels[i]) {
+                               err = -EINVAL;
+                               goto out_free;
+                       }
+                       i++;
+               }
+       } else {
+               /* all channels */
+               i = 0;
+               for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+                       int j;
+                       if (!wiphy->bands[band])
+                               continue;
+                       for (j = 0; j < wiphy->bands[band]->n_channels; j++) {
+                               request->channels[i] = &wiphy->bands[band]->channels[j];
+                               i++;
+                       }
+               }
+       }
+
+       i = 0;
+       if (info->attrs[NL80211_ATTR_SCAN_SSIDS]) {
+               nla_for_each_nested(attr, info->attrs[NL80211_ATTR_SCAN_SSIDS], tmp) {
+                       if (request->ssids[i].ssid_len > IEEE80211_MAX_SSID_LEN) {
+                               err = -EINVAL;
+                               goto out_free;
+                       }
+                       memcpy(request->ssids[i].ssid, nla_data(attr), nla_len(attr));
+                       request->ssids[i].ssid_len = nla_len(attr);
+                       i++;
+               }
+       }
+
+       request->ifidx = dev->ifindex;
+       request->wiphy = &drv->wiphy;
+
+       drv->scan_req = request;
+       err = drv->ops->scan(&drv->wiphy, dev, request);
+
+ out_free:
+       if (err) {
+               drv->scan_req = NULL;
+               kfree(request);
+       }
+ out_unlock:
+       rtnl_unlock();
+ out:
+       cfg80211_put_dev(drv);
+       dev_put(dev);
+       return err;
+}
+
+static int nl80211_send_bss(struct sk_buff *msg, u32 pid, u32 seq, int flags,
+                           struct cfg80211_registered_device *rdev,
+                           struct net_device *dev,
+                           struct cfg80211_bss *res)
+{
+       void *hdr;
+       struct nlattr *bss;
+
+       hdr = nl80211hdr_put(msg, pid, seq, flags,
+                            NL80211_CMD_NEW_SCAN_RESULTS);
+       if (!hdr)
+               return -1;
+
+       NLA_PUT_U32(msg, NL80211_ATTR_SCAN_GENERATION,
+                   rdev->bss_generation);
+       NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex);
+
+       bss = nla_nest_start(msg, NL80211_ATTR_BSS);
+       if (!bss)
+               goto nla_put_failure;
+       if (!is_zero_ether_addr(res->bssid))
+               NLA_PUT(msg, NL80211_BSS_BSSID, ETH_ALEN, res->bssid);
+       if (res->information_elements && res->len_information_elements)
+               NLA_PUT(msg, NL80211_BSS_INFORMATION_ELEMENTS,
+                       res->len_information_elements,
+                       res->information_elements);
+       if (res->tsf)
+               NLA_PUT_U64(msg, NL80211_BSS_TSF, res->tsf);
+       if (res->beacon_interval)
+               NLA_PUT_U16(msg, NL80211_BSS_BEACON_INTERVAL, res->beacon_interval);
+       NLA_PUT_U16(msg, NL80211_BSS_CAPABILITY, res->capability);
+       NLA_PUT_U32(msg, NL80211_BSS_FREQUENCY, res->channel->center_freq);
+
+       switch (res->signal_type) {
+       case CFG80211_SIGNAL_TYPE_MBM:
+               NLA_PUT_U32(msg, NL80211_BSS_SIGNAL_MBM, res->signal);
+               break;
+       case CFG80211_SIGNAL_TYPE_UNSPEC:
+               NLA_PUT_U8(msg, NL80211_BSS_SIGNAL_UNSPEC, res->signal);
+               break;
+       default:
+               break;
+       }
+
+       nla_nest_end(msg, bss);
+
+       return genlmsg_end(msg, hdr);
+
+ nla_put_failure:
+       genlmsg_cancel(msg, hdr);
+       return -EMSGSIZE;
+}
+
+static int nl80211_dump_scan(struct sk_buff *skb,
+                            struct netlink_callback *cb)
+{
+       struct cfg80211_registered_device *dev;
+       struct net_device *netdev;
+       struct cfg80211_internal_bss *scan;
+       int ifidx = cb->args[0];
+       int start = cb->args[1], idx = 0;
+       int err;
+
+       if (!ifidx) {
+               err = nlmsg_parse(cb->nlh, GENL_HDRLEN + nl80211_fam.hdrsize,
+                                 nl80211_fam.attrbuf, nl80211_fam.maxattr,
+                                 nl80211_policy);
+               if (err)
+                       return err;
+
+               if (!nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX])
+                       return -EINVAL;
+
+               ifidx = nla_get_u32(nl80211_fam.attrbuf[NL80211_ATTR_IFINDEX]);
+               if (!ifidx)
+                       return -EINVAL;
+               cb->args[0] = ifidx;
+       }
+
+       netdev = dev_get_by_index(&init_net, ifidx);
+       if (!netdev)
+               return -ENODEV;
+
+       dev = cfg80211_get_dev_from_ifindex(ifidx);
+       if (IS_ERR(dev)) {
+               err = PTR_ERR(dev);
+               goto out_put_netdev;
+       }
+
+       spin_lock_bh(&dev->bss_lock);
+       cfg80211_bss_expire(dev);
+
+       list_for_each_entry(scan, &dev->bss_list, list) {
+               if (++idx <= start)
+                       continue;
+               if (nl80211_send_bss(skb,
+                               NETLINK_CB(cb->skb).pid,
+                               cb->nlh->nlmsg_seq, NLM_F_MULTI,
+                               dev, netdev, &scan->pub) < 0) {
+                       idx--;
+                       goto out;
+               }
+       }
+
+ out:
+       spin_unlock_bh(&dev->bss_lock);
+
+       cb->args[1] = idx;
+       err = skb->len;
+       cfg80211_put_dev(dev);
+ out_put_netdev:
+       dev_put(netdev);
+
+       return err;
+}
+
 static struct genl_ops nl80211_ops[] = {
        {
                .cmd = NL80211_CMD_GET_WIPHY,
@@ -2271,6 +2652,12 @@ static struct genl_ops nl80211_ops[] = {
                .policy = nl80211_policy,
                .flags = GENL_ADMIN_PERM,
        },
+       {
+               .cmd = NL80211_CMD_GET_REG,
+               .doit = nl80211_get_reg,
+               .policy = nl80211_policy,
+               /* can be retrieved by unprivileged users */
+       },
        {
                .cmd = NL80211_CMD_SET_REG,
                .doit = nl80211_set_reg,
@@ -2295,12 +2682,32 @@ static struct genl_ops nl80211_ops[] = {
                .policy = nl80211_policy,
                .flags = GENL_ADMIN_PERM,
        },
+       {
+               .cmd = NL80211_CMD_SET_MGMT_EXTRA_IE,
+               .doit = nl80211_set_mgmt_extra_ie,
+               .policy = nl80211_policy,
+               .flags = GENL_ADMIN_PERM,
+       },
+       {
+               .cmd = NL80211_CMD_TRIGGER_SCAN,
+               .doit = nl80211_trigger_scan,
+               .policy = nl80211_policy,
+               .flags = GENL_ADMIN_PERM,
+       },
+       {
+               .cmd = NL80211_CMD_GET_SCAN,
+               .policy = nl80211_policy,
+               .dumpit = nl80211_dump_scan,
+       },
 };
 
 /* multicast groups */
 static struct genl_multicast_group nl80211_config_mcgrp = {
        .name = "config",
 };
+static struct genl_multicast_group nl80211_scan_mcgrp = {
+       .name = "scan",
+};
 
 /* notification functions */
 
@@ -2320,6 +2727,66 @@ void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev)
        genlmsg_multicast(msg, 0, nl80211_config_mcgrp.id, GFP_KERNEL);
 }
 
+static int nl80211_send_scan_donemsg(struct sk_buff *msg,
+                                   struct cfg80211_registered_device *rdev,
+                                   struct net_device *netdev,
+                                   u32 pid, u32 seq, int flags,
+                                   u32 cmd)
+{
+       void *hdr;
+
+       hdr = nl80211hdr_put(msg, pid, seq, flags, cmd);
+       if (!hdr)
+               return -1;
+
+       NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->idx);
+       NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
+
+       /* XXX: we should probably bounce back the request? */
+
+       return genlmsg_end(msg, hdr);
+
+ nla_put_failure:
+       genlmsg_cancel(msg, hdr);
+       return -EMSGSIZE;
+}
+
+void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
+                           struct net_device *netdev)
+{
+       struct sk_buff *msg;
+
+       msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
+       if (!msg)
+               return;
+
+       if (nl80211_send_scan_donemsg(msg, rdev, netdev, 0, 0, 0,
+                                     NL80211_CMD_NEW_SCAN_RESULTS) < 0) {
+               nlmsg_free(msg);
+               return;
+       }
+
+       genlmsg_multicast(msg, 0, nl80211_scan_mcgrp.id, GFP_KERNEL);
+}
+
+void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
+                              struct net_device *netdev)
+{
+       struct sk_buff *msg;
+
+       msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
+       if (!msg)
+               return;
+
+       if (nl80211_send_scan_donemsg(msg, rdev, netdev, 0, 0, 0,
+                                     NL80211_CMD_SCAN_ABORTED) < 0) {
+               nlmsg_free(msg);
+               return;
+       }
+
+       genlmsg_multicast(msg, 0, nl80211_scan_mcgrp.id, GFP_KERNEL);
+}
+
 /* initialisation/exit functions */
 
 int nl80211_init(void)
@@ -2340,6 +2807,10 @@ int nl80211_init(void)
        if (err)
                goto err_out;
 
+       err = genl_register_mc_group(&nl80211_fam, &nl80211_scan_mcgrp);
+       if (err)
+               goto err_out;
+
        return 0;
  err_out:
        genl_unregister_family(&nl80211_fam);
index f3ea5c029aeeaf8e19342471b6933408e9a29cd5..b565a5f84e9782af4723956055c19f5ac972dbdf 100644 (file)
@@ -7,6 +7,10 @@
 extern int nl80211_init(void);
 extern void nl80211_exit(void);
 extern void nl80211_notify_dev_rename(struct cfg80211_registered_device *rdev);
+extern void nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
+                                  struct net_device *netdev);
+extern void nl80211_send_scan_aborted(struct cfg80211_registered_device *rdev,
+                                     struct net_device *netdev);
 #else
 static inline int nl80211_init(void)
 {
@@ -19,6 +23,10 @@ static inline void nl80211_notify_dev_rename(
        struct cfg80211_registered_device *rdev)
 {
 }
+static inline void
+nl80211_send_scan_done(struct cfg80211_registered_device *rdev,
+                      struct net_device *netdev)
+{}
 #endif /* CONFIG_NL80211 */
 
 #endif /* __NET_WIRELESS_NL80211_H */
index 85c9034c59b276fb3a3606f3845e81ea714bc1c5..2323644330cd775f8022ae9045f0d87cc2b11701 100644 (file)
 #include "core.h"
 #include "reg.h"
 
-/**
- * struct regulatory_request - receipt of last regulatory request
- *
- * @wiphy: this is set if this request's initiator is
- *     %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
- *     can be used by the wireless core to deal with conflicts
- *     and potentially inform users of which devices specifically
- *     cased the conflicts.
- * @initiator: indicates who sent this request, could be any of
- *     of those set in reg_set_by, %REGDOM_SET_BY_*
- * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
- *     regulatory domain. We have a few special codes:
- *     00 - World regulatory domain
- *     99 - built by driver but a specific alpha2 cannot be determined
- *     98 - result of an intersection between two regulatory domains
- * @intersect: indicates whether the wireless core should intersect
- *     the requested regulatory domain with the presently set regulatory
- *     domain.
- * @country_ie_checksum: checksum of the last processed and accepted
- *     country IE
- * @country_ie_env: lets us know if the AP is telling us we are outdoor,
- *     indoor, or if it doesn't matter
- */
-struct regulatory_request {
-       struct wiphy *wiphy;
-       enum reg_set_by initiator;
-       char alpha2[2];
-       bool intersect;
-       u32 country_ie_checksum;
-       enum environment_cap country_ie_env;
-};
-
 /* Receipt of information from last regulatory request */
 static struct regulatory_request *last_request;
 
@@ -89,7 +57,7 @@ static u32 supported_bandwidths[] = {
 /* Central wireless core regulatory domains, we only need two,
  * the current one and a world regulatory domain in case we have no
  * information to give us an alpha2 */
-static const struct ieee80211_regdomain *cfg80211_regdomain;
+const struct ieee80211_regdomain *cfg80211_regdomain;
 
 /* We use this as a place for the rd structure built from the
  * last parsed country IE to rest until CRDA gets back to us with
@@ -790,42 +758,35 @@ static u32 map_regdom_flags(u32 rd_flags)
        return channel_flags;
 }
 
-/**
- * freq_reg_info - get regulatory information for the given frequency
- * @center_freq: Frequency in KHz for which we want regulatory information for
- * @bandwidth: the bandwidth requirement you have in KHz, if you do not have one
- *     you can set this to 0. If this frequency is allowed we then set
- *     this value to the maximum allowed bandwidth.
- * @reg_rule: the regulatory rule which we have for this frequency
- *
- * Use this function to get the regulatory rule for a specific frequency on
- * a given wireless device. If the device has a specific regulatory domain
- * it wants to follow we respect that unless a country IE has been received
- * and processed already.
- *
- * Returns 0 if it was able to find a valid regulatory rule which does
- * apply to the given center_freq otherwise it returns non-zero. It will
- * also return -ERANGE if we determine the given center_freq does not even have
- * a regulatory rule for a frequency range in the center_freq's band. See
- * freq_in_rule_band() for our current definition of a band -- this is purely
- * subjective and right now its 802.11 specific.
- */
-static int freq_reg_info(u32 center_freq, u32 *bandwidth,
-                        const struct ieee80211_reg_rule **reg_rule)
+static int freq_reg_info_regd(struct wiphy *wiphy,
+                             u32 center_freq,
+                             u32 *bandwidth,
+                             const struct ieee80211_reg_rule **reg_rule,
+                             const struct ieee80211_regdomain *custom_regd)
 {
        int i;
        bool band_rule_found = false;
+       const struct ieee80211_regdomain *regd;
        u32 max_bandwidth = 0;
 
-       if (!cfg80211_regdomain)
+       regd = custom_regd ? custom_regd : cfg80211_regdomain;
+
+       /* Follow the driver's regulatory domain, if present, unless a country
+        * IE has been processed or a user wants to help complaince further */
+       if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE &&
+           last_request->initiator != REGDOM_SET_BY_USER &&
+           wiphy->regd)
+               regd = wiphy->regd;
+
+       if (!regd)
                return -EINVAL;
 
-       for (i = 0; i < cfg80211_regdomain->n_reg_rules; i++) {
+       for (i = 0; i < regd->n_reg_rules; i++) {
                const struct ieee80211_reg_rule *rr;
                const struct ieee80211_freq_range *fr = NULL;
                const struct ieee80211_power_rule *pr = NULL;
 
-               rr = &cfg80211_regdomain->reg_rules[i];
+               rr = &regd->reg_rules[i];
                fr = &rr->freq_range;
                pr = &rr->power_rule;
 
@@ -849,6 +810,14 @@ static int freq_reg_info(u32 center_freq, u32 *bandwidth,
 
        return !max_bandwidth;
 }
+EXPORT_SYMBOL(freq_reg_info);
+
+int freq_reg_info(struct wiphy *wiphy, u32 center_freq, u32 *bandwidth,
+                        const struct ieee80211_reg_rule **reg_rule)
+{
+       return freq_reg_info_regd(wiphy, center_freq,
+               bandwidth, reg_rule, NULL);
+}
 
 static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
                           unsigned int chan_idx)
@@ -867,7 +836,7 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 
        flags = chan->orig_flags;
 
-       r = freq_reg_info(MHZ_TO_KHZ(chan->center_freq),
+       r = freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq),
                &max_bandwidth, &reg_rule);
 
        if (r) {
@@ -907,6 +876,22 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 
        power_rule = &reg_rule->power_rule;
 
+       if (last_request->initiator == REGDOM_SET_BY_DRIVER &&
+           last_request->wiphy && last_request->wiphy == wiphy &&
+           last_request->wiphy->strict_regulatory) {
+               /* This gaurantees the driver's requested regulatory domain
+                * will always be used as a base for further regulatory
+                * settings */
+               chan->flags = chan->orig_flags =
+                       map_regdom_flags(reg_rule->flags);
+               chan->max_antenna_gain = chan->orig_mag =
+                       (int) MBI_TO_DBI(power_rule->max_antenna_gain);
+               chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth);
+               chan->max_power = chan->orig_mpwr =
+                       (int) MBM_TO_DBM(power_rule->max_eirp);
+               return;
+       }
+
        chan->flags = flags | map_regdom_flags(reg_rule->flags);
        chan->max_antenna_gain = min(chan->orig_mag,
                (int) MBI_TO_DBI(power_rule->max_antenna_gain));
@@ -935,7 +920,12 @@ static bool ignore_reg_update(struct wiphy *wiphy, enum reg_set_by setby)
        if (!last_request)
                return true;
        if (setby == REGDOM_SET_BY_CORE &&
-                 wiphy->fw_handles_regulatory)
+                 wiphy->custom_regulatory)
+               return true;
+       /* wiphy->regd will be set once the device has its own
+        * desired regulatory domain set */
+       if (wiphy->strict_regulatory && !wiphy->regd &&
+           !is_world_regdom(last_request->alpha2))
                return true;
        return false;
 }
@@ -945,20 +935,103 @@ static void update_all_wiphy_regulatory(enum reg_set_by setby)
        struct cfg80211_registered_device *drv;
 
        list_for_each_entry(drv, &cfg80211_drv_list, list)
-               if (!ignore_reg_update(&drv->wiphy, setby))
-                       wiphy_update_regulatory(&drv->wiphy, setby);
+               wiphy_update_regulatory(&drv->wiphy, setby);
 }
 
 void wiphy_update_regulatory(struct wiphy *wiphy, enum reg_set_by setby)
 {
        enum ieee80211_band band;
+
+       if (ignore_reg_update(wiphy, setby))
+               return;
        for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
                if (wiphy->bands[band])
                        handle_band(wiphy, band);
-               if (wiphy->reg_notifier)
-                       wiphy->reg_notifier(wiphy, setby);
+       }
+       if (wiphy->reg_notifier)
+               wiphy->reg_notifier(wiphy, last_request);
+}
+
+static void handle_channel_custom(struct wiphy *wiphy,
+                                 enum ieee80211_band band,
+                                 unsigned int chan_idx,
+                                 const struct ieee80211_regdomain *regd)
+{
+       int r;
+       u32 max_bandwidth = 0;
+       const struct ieee80211_reg_rule *reg_rule = NULL;
+       const struct ieee80211_power_rule *power_rule = NULL;
+       struct ieee80211_supported_band *sband;
+       struct ieee80211_channel *chan;
+
+       sband = wiphy->bands[band];
+       BUG_ON(chan_idx >= sband->n_channels);
+       chan = &sband->channels[chan_idx];
+
+       r = freq_reg_info_regd(wiphy, MHZ_TO_KHZ(chan->center_freq),
+               &max_bandwidth, &reg_rule, regd);
+
+       if (r) {
+               chan->flags = IEEE80211_CHAN_DISABLED;
+               return;
+       }
+
+       power_rule = &reg_rule->power_rule;
+
+       chan->flags |= map_regdom_flags(reg_rule->flags);
+       chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
+       chan->max_bandwidth = KHZ_TO_MHZ(max_bandwidth);
+       chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
+}
+
+static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band,
+                              const struct ieee80211_regdomain *regd)
+{
+       unsigned int i;
+       struct ieee80211_supported_band *sband;
+
+       BUG_ON(!wiphy->bands[band]);
+       sband = wiphy->bands[band];
+
+       for (i = 0; i < sband->n_channels; i++)
+               handle_channel_custom(wiphy, band, i, regd);
+}
+
+/* Used by drivers prior to wiphy registration */
+void wiphy_apply_custom_regulatory(struct wiphy *wiphy,
+                                  const struct ieee80211_regdomain *regd)
+{
+       enum ieee80211_band band;
+       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               if (wiphy->bands[band])
+                       handle_band_custom(wiphy, band, regd);
        }
 }
+EXPORT_SYMBOL(wiphy_apply_custom_regulatory);
+
+static int reg_copy_regd(const struct ieee80211_regdomain **dst_regd,
+                        const struct ieee80211_regdomain *src_regd)
+{
+       struct ieee80211_regdomain *regd;
+       int size_of_regd = 0;
+       unsigned int i;
+
+       size_of_regd = sizeof(struct ieee80211_regdomain) +
+         ((src_regd->n_reg_rules + 1) * sizeof(struct ieee80211_reg_rule));
+
+       regd = kzalloc(size_of_regd, GFP_KERNEL);
+       if (!regd)
+               return -ENOMEM;
+
+       memcpy(regd, src_regd, sizeof(struct ieee80211_regdomain));
+
+       for (i = 0; i < src_regd->n_reg_rules; i++)
+               memcpy(&regd->reg_rules[i], &src_regd->reg_rules[i],
+                       sizeof(struct ieee80211_reg_rule));
+
+       *dst_regd = regd;
+       return 0;
+}
 
 /* Return value which can be used by ignore_request() to indicate
  * it has been determined we should intersect two regulatory domains */
@@ -1007,9 +1080,14 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
                }
                return REG_INTERSECT;
        case REGDOM_SET_BY_DRIVER:
-               if (last_request->initiator == REGDOM_SET_BY_DRIVER)
+               if (last_request->initiator == REGDOM_SET_BY_CORE) {
+                       if (is_old_static_regdom(cfg80211_regdomain))
+                               return 0;
+                       if (!alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
+                               return 0;
                        return -EALREADY;
-               return 0;
+               }
+               return REG_INTERSECT;
        case REGDOM_SET_BY_USER:
                if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
                        return REG_INTERSECT;
@@ -1018,6 +1096,20 @@ static int ignore_request(struct wiphy *wiphy, enum reg_set_by set_by,
                if (last_request->initiator == REGDOM_SET_BY_USER &&
                          last_request->intersect)
                        return -EOPNOTSUPP;
+               /* Process user requests only after previous user/driver/core
+                * requests have been processed */
+               if (last_request->initiator == REGDOM_SET_BY_CORE ||
+                   last_request->initiator == REGDOM_SET_BY_DRIVER ||
+                   last_request->initiator == REGDOM_SET_BY_USER) {
+                       if (!alpha2_equal(last_request->alpha2,
+                           cfg80211_regdomain->alpha2))
+                               return -EAGAIN;
+               }
+
+               if (!is_old_static_regdom(cfg80211_regdomain) &&
+                   alpha2_equal(cfg80211_regdomain->alpha2, alpha2))
+                       return -EALREADY;
+
                return 0;
        }
 
@@ -1036,11 +1128,28 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
 
        r = ignore_request(wiphy, set_by, alpha2);
 
-       if (r == REG_INTERSECT)
+       if (r == REG_INTERSECT) {
+               if (set_by == REGDOM_SET_BY_DRIVER) {
+                       r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain);
+                       if (r)
+                               return r;
+               }
                intersect = true;
-       else if (r)
+       } else if (r) {
+               /* If the regulatory domain being requested by the
+                * driver has already been set just copy it to the
+                * wiphy */
+               if (r == -EALREADY && set_by == REGDOM_SET_BY_DRIVER) {
+                       r = reg_copy_regd(&wiphy->regd, cfg80211_regdomain);
+                       if (r)
+                               return r;
+                       r = -EALREADY;
+                       goto new_request;
+               }
                return r;
+       }
 
+new_request:
        request = kzalloc(sizeof(struct regulatory_request),
                          GFP_KERNEL);
        if (!request)
@@ -1056,6 +1165,11 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
 
        kfree(last_request);
        last_request = request;
+
+       /* When r == REG_INTERSECT we do need to call CRDA */
+       if (r < 0)
+               return r;
+
        /*
         * Note: When CONFIG_WIRELESS_OLD_REGULATORY is enabled
         * AND if CRDA is NOT present nothing will happen, if someone
@@ -1071,10 +1185,15 @@ int __regulatory_hint(struct wiphy *wiphy, enum reg_set_by set_by,
 
 void regulatory_hint(struct wiphy *wiphy, const char *alpha2)
 {
+       int r;
        BUG_ON(!alpha2);
 
        mutex_lock(&cfg80211_drv_mutex);
-       __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER, alpha2, 0, ENVIRON_ANY);
+       r = __regulatory_hint(wiphy, REGDOM_SET_BY_DRIVER,
+               alpha2, 0, ENVIRON_ANY);
+       /* This is required so that the orig_* parameters are saved */
+       if (r == -EALREADY && wiphy->strict_regulatory)
+               wiphy_update_regulatory(wiphy, REGDOM_SET_BY_DRIVER);
        mutex_unlock(&cfg80211_drv_mutex);
 }
 EXPORT_SYMBOL(regulatory_hint);
@@ -1247,7 +1366,7 @@ static void print_regdomain(const struct ieee80211_regdomain *rd)
                                        "domain intersected: \n");
                } else
                                printk(KERN_INFO "cfg80211: Current regulatory "
-                                       "intersected: \n");
+                                       "domain intersected: \n");
        } else if (is_world_regdom(rd->alpha2))
                printk(KERN_INFO "cfg80211: World regulatory "
                        "domain updated:\n");
@@ -1349,6 +1468,23 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
        }
 
        if (!last_request->intersect) {
+               int r;
+
+               if (last_request->initiator != REGDOM_SET_BY_DRIVER) {
+                       reset_regdomains();
+                       cfg80211_regdomain = rd;
+                       return 0;
+               }
+
+               /* For a driver hint, lets copy the regulatory domain the
+                * driver wanted to the wiphy to deal with conflicts */
+
+               BUG_ON(last_request->wiphy->regd);
+
+               r = reg_copy_regd(&last_request->wiphy->regd, rd);
+               if (r)
+                       return r;
+
                reset_regdomains();
                cfg80211_regdomain = rd;
                return 0;
@@ -1362,8 +1498,14 @@ static int __set_regdom(const struct ieee80211_regdomain *rd)
                if (!intersected_rd)
                        return -EINVAL;
 
-               /* We can trash what CRDA provided now */
-               kfree(rd);
+               /* We can trash what CRDA provided now.
+                * However if a driver requested this specific regulatory
+                * domain we keep it for its private use */
+               if (last_request->initiator == REGDOM_SET_BY_DRIVER)
+                       last_request->wiphy->regd = rd;
+               else
+                       kfree(rd);
+
                rd = NULL;
 
                reset_regdomains();
@@ -1447,6 +1589,7 @@ int set_regdom(const struct ieee80211_regdomain *rd)
 /* Caller must hold cfg80211_drv_mutex */
 void reg_device_remove(struct wiphy *wiphy)
 {
+       kfree(wiphy->regd);
        if (!last_request || !last_request->wiphy)
                return;
        if (last_request->wiphy != wiphy)
index a76ea3ff7cd6af1a9da0044a7b8eca2afabea85a..fe8c83f34fb7e8465c9dc8d0804bb04aa58ef928 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __NET_WIRELESS_REG_H
 #define __NET_WIRELESS_REG_H
 
+extern const struct ieee80211_regdomain *cfg80211_regdomain;
+
 bool is_world_regdom(const char *alpha2);
 bool reg_is_valid_request(const char *alpha2);
 
@@ -11,13 +13,6 @@ void regulatory_exit(void);
 
 int set_regdom(const struct ieee80211_regdomain *rd);
 
-enum environment_cap {
-       ENVIRON_ANY,
-       ENVIRON_INDOOR,
-       ENVIRON_OUTDOOR,
-};
-
-
 /**
  * __regulatory_hint - hint to the wireless core a regulatory domain
  * @wiphy: if the hint comes from country information from an AP, this
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
new file mode 100644 (file)
index 0000000..b1893c8
--- /dev/null
@@ -0,0 +1,836 @@
+/*
+ * cfg80211 scan result handling
+ *
+ * Copyright 2008 Johannes Berg <johannes@sipsolutions.net>
+ */
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/wireless.h>
+#include <linux/nl80211.h>
+#include <linux/etherdevice.h>
+#include <net/arp.h>
+#include <net/cfg80211.h>
+#include <net/iw_handler.h>
+#include "core.h"
+#include "nl80211.h"
+
+#define IEEE80211_SCAN_RESULT_EXPIRE   (10 * HZ)
+
+void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted)
+{
+       struct net_device *dev;
+#ifdef CONFIG_WIRELESS_EXT
+       union iwreq_data wrqu;
+#endif
+
+       dev = dev_get_by_index(&init_net, request->ifidx);
+       if (!dev)
+               goto out;
+
+       WARN_ON(request != wiphy_to_dev(request->wiphy)->scan_req);
+       wiphy_to_dev(request->wiphy)->scan_req = NULL;
+
+       if (aborted)
+               nl80211_send_scan_aborted(wiphy_to_dev(request->wiphy), dev);
+       else
+               nl80211_send_scan_done(wiphy_to_dev(request->wiphy), dev);
+
+#ifdef CONFIG_WIRELESS_EXT
+       if (!aborted) {
+               memset(&wrqu, 0, sizeof(wrqu));
+
+               wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
+       }
+#endif
+
+       dev_put(dev);
+
+ out:
+       kfree(request);
+}
+EXPORT_SYMBOL(cfg80211_scan_done);
+
+static void bss_release(struct kref *ref)
+{
+       struct cfg80211_internal_bss *bss;
+
+       bss = container_of(ref, struct cfg80211_internal_bss, ref);
+       if (bss->pub.free_priv)
+               bss->pub.free_priv(&bss->pub);
+       kfree(bss);
+}
+
+/* must hold dev->bss_lock! */
+void cfg80211_bss_expire(struct cfg80211_registered_device *dev)
+{
+       struct cfg80211_internal_bss *bss, *tmp;
+       bool expired = false;
+
+       list_for_each_entry_safe(bss, tmp, &dev->bss_list, list) {
+               if (!time_after(jiffies, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE))
+                       continue;
+               list_del(&bss->list);
+               rb_erase(&bss->rbn, &dev->bss_tree);
+               kref_put(&bss->ref, bss_release);
+               expired = true;
+       }
+
+       if (expired)
+               dev->bss_generation++;
+}
+
+static u8 *find_ie(u8 num, u8 *ies, size_t len)
+{
+       while (len > 2 && ies[0] != num) {
+               len -= ies[1] + 2;
+               ies += ies[1] + 2;
+       }
+       if (len < 2)
+               return NULL;
+       if (len < 2 + ies[1])
+               return NULL;
+       return ies;
+}
+
+static int cmp_ies(u8 num, u8 *ies1, size_t len1, u8 *ies2, size_t len2)
+{
+       const u8 *ie1 = find_ie(num, ies1, len1);
+       const u8 *ie2 = find_ie(num, ies2, len2);
+       int r;
+
+       if (!ie1 && !ie2)
+               return 0;
+       if (!ie1)
+               return -1;
+
+       r = memcmp(ie1 + 2, ie2 + 2, min(ie1[1], ie2[1]));
+       if (r == 0 && ie1[1] != ie2[1])
+               return ie2[1] - ie1[1];
+       return r;
+}
+
+static bool is_bss(struct cfg80211_bss *a,
+                  const u8 *bssid,
+                  const u8 *ssid, size_t ssid_len)
+{
+       const u8 *ssidie;
+
+       if (bssid && compare_ether_addr(a->bssid, bssid))
+               return false;
+
+       if (!ssid)
+               return true;
+
+       ssidie = find_ie(WLAN_EID_SSID,
+                        a->information_elements,
+                        a->len_information_elements);
+       if (!ssidie)
+               return false;
+       if (ssidie[1] != ssid_len)
+               return false;
+       return memcmp(ssidie + 2, ssid, ssid_len) == 0;
+}
+
+static bool is_mesh(struct cfg80211_bss *a,
+                   const u8 *meshid, size_t meshidlen,
+                   const u8 *meshcfg)
+{
+       const u8 *ie;
+
+       if (!is_zero_ether_addr(a->bssid))
+               return false;
+
+       ie = find_ie(WLAN_EID_MESH_ID,
+                    a->information_elements,
+                    a->len_information_elements);
+       if (!ie)
+               return false;
+       if (ie[1] != meshidlen)
+               return false;
+       if (memcmp(ie + 2, meshid, meshidlen))
+               return false;
+
+       ie = find_ie(WLAN_EID_MESH_CONFIG,
+                    a->information_elements,
+                    a->len_information_elements);
+       if (ie[1] != IEEE80211_MESH_CONFIG_LEN)
+               return false;
+
+       /*
+        * Ignore mesh capability (last two bytes of the IE) when
+        * comparing since that may differ between stations taking
+        * part in the same mesh.
+        */
+       return memcmp(ie + 2, meshcfg, IEEE80211_MESH_CONFIG_LEN - 2) == 0;
+}
+
+static int cmp_bss(struct cfg80211_bss *a,
+                  struct cfg80211_bss *b)
+{
+       int r;
+
+       if (a->channel != b->channel)
+               return b->channel->center_freq - a->channel->center_freq;
+
+       r = memcmp(a->bssid, b->bssid, ETH_ALEN);
+       if (r)
+               return r;
+
+       if (is_zero_ether_addr(a->bssid)) {
+               r = cmp_ies(WLAN_EID_MESH_ID,
+                           a->information_elements,
+                           a->len_information_elements,
+                           b->information_elements,
+                           b->len_information_elements);
+               if (r)
+                       return r;
+               return cmp_ies(WLAN_EID_MESH_CONFIG,
+                              a->information_elements,
+                              a->len_information_elements,
+                              b->information_elements,
+                              b->len_information_elements);
+       }
+
+       return cmp_ies(WLAN_EID_SSID,
+                      a->information_elements,
+                      a->len_information_elements,
+                      b->information_elements,
+                      b->len_information_elements);
+}
+
+struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
+                                     struct ieee80211_channel *channel,
+                                     const u8 *bssid,
+                                     const u8 *ssid, size_t ssid_len,
+                                     u16 capa_mask, u16 capa_val)
+{
+       struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy);
+       struct cfg80211_internal_bss *bss, *res = NULL;
+
+       spin_lock_bh(&dev->bss_lock);
+
+       list_for_each_entry(bss, &dev->bss_list, list) {
+               if ((bss->pub.capability & capa_mask) != capa_val)
+                       continue;
+               if (channel && bss->pub.channel != channel)
+                       continue;
+               if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {
+                       res = bss;
+                       kref_get(&res->ref);
+                       break;
+               }
+       }
+
+       spin_unlock_bh(&dev->bss_lock);
+       if (!res)
+               return NULL;
+       return &res->pub;
+}
+EXPORT_SYMBOL(cfg80211_get_bss);
+
+struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
+                                      struct ieee80211_channel *channel,
+                                      const u8 *meshid, size_t meshidlen,
+                                      const u8 *meshcfg)
+{
+       struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy);
+       struct cfg80211_internal_bss *bss, *res = NULL;
+
+       spin_lock_bh(&dev->bss_lock);
+
+       list_for_each_entry(bss, &dev->bss_list, list) {
+               if (channel && bss->pub.channel != channel)
+                       continue;
+               if (is_mesh(&bss->pub, meshid, meshidlen, meshcfg)) {
+                       res = bss;
+                       kref_get(&res->ref);
+                       break;
+               }
+       }
+
+       spin_unlock_bh(&dev->bss_lock);
+       if (!res)
+               return NULL;
+       return &res->pub;
+}
+EXPORT_SYMBOL(cfg80211_get_mesh);
+
+
+static void rb_insert_bss(struct cfg80211_registered_device *dev,
+                         struct cfg80211_internal_bss *bss)
+{
+       struct rb_node **p = &dev->bss_tree.rb_node;
+       struct rb_node *parent = NULL;
+       struct cfg80211_internal_bss *tbss;
+       int cmp;
+
+       while (*p) {
+               parent = *p;
+               tbss = rb_entry(parent, struct cfg80211_internal_bss, rbn);
+
+               cmp = cmp_bss(&bss->pub, &tbss->pub);
+
+               if (WARN_ON(!cmp)) {
+                       /* will sort of leak this BSS */
+                       return;
+               }
+
+               if (cmp < 0)
+                       p = &(*p)->rb_left;
+               else
+                       p = &(*p)->rb_right;
+       }
+
+       rb_link_node(&bss->rbn, parent, p);
+       rb_insert_color(&bss->rbn, &dev->bss_tree);
+}
+
+static struct cfg80211_internal_bss *
+rb_find_bss(struct cfg80211_registered_device *dev,
+           struct cfg80211_internal_bss *res)
+{
+       struct rb_node *n = dev->bss_tree.rb_node;
+       struct cfg80211_internal_bss *bss;
+       int r;
+
+       while (n) {
+               bss = rb_entry(n, struct cfg80211_internal_bss, rbn);
+               r = cmp_bss(&res->pub, &bss->pub);
+
+               if (r == 0)
+                       return bss;
+               else if (r < 0)
+                       n = n->rb_left;
+               else
+                       n = n->rb_right;
+       }
+
+       return NULL;
+}
+
+static struct cfg80211_internal_bss *
+cfg80211_bss_update(struct cfg80211_registered_device *dev,
+                   struct cfg80211_internal_bss *res,
+                   bool overwrite)
+{
+       struct cfg80211_internal_bss *found = NULL;
+       const u8 *meshid, *meshcfg;
+
+       /*
+        * The reference to "res" is donated to this function.
+        */
+
+       if (WARN_ON(!res->pub.channel)) {
+               kref_put(&res->ref, bss_release);
+               return NULL;
+       }
+
+       res->ts = jiffies;
+
+       if (is_zero_ether_addr(res->pub.bssid)) {
+               /* must be mesh, verify */
+               meshid = find_ie(WLAN_EID_MESH_ID, res->pub.information_elements,
+                                res->pub.len_information_elements);
+               meshcfg = find_ie(WLAN_EID_MESH_CONFIG,
+                                 res->pub.information_elements,
+                                 res->pub.len_information_elements);
+               if (!meshid || !meshcfg ||
+                   meshcfg[1] != IEEE80211_MESH_CONFIG_LEN) {
+                       /* bogus mesh */
+                       kref_put(&res->ref, bss_release);
+                       return NULL;
+               }
+       }
+
+       spin_lock_bh(&dev->bss_lock);
+
+       found = rb_find_bss(dev, res);
+
+       if (found && overwrite) {
+               list_replace(&found->list, &res->list);
+               rb_replace_node(&found->rbn, &res->rbn,
+                               &dev->bss_tree);
+               kref_put(&found->ref, bss_release);
+               found = res;
+       } else if (found) {
+               kref_get(&found->ref);
+               found->pub.beacon_interval = res->pub.beacon_interval;
+               found->pub.tsf = res->pub.tsf;
+               found->pub.signal = res->pub.signal;
+               found->pub.signal_type = res->pub.signal_type;
+               found->pub.capability = res->pub.capability;
+               found->ts = res->ts;
+               kref_put(&res->ref, bss_release);
+       } else {
+               /* this "consumes" the reference */
+               list_add_tail(&res->list, &dev->bss_list);
+               rb_insert_bss(dev, res);
+               found = res;
+       }
+
+       dev->bss_generation++;
+       spin_unlock_bh(&dev->bss_lock);
+
+       kref_get(&found->ref);
+       return found;
+}
+
+struct cfg80211_bss *
+cfg80211_inform_bss_frame(struct wiphy *wiphy,
+                         struct ieee80211_channel *channel,
+                         struct ieee80211_mgmt *mgmt, size_t len,
+                         s32 signal, enum cfg80211_signal_type sigtype,
+                         gfp_t gfp)
+{
+       struct cfg80211_internal_bss *res;
+       size_t ielen = len - offsetof(struct ieee80211_mgmt,
+                                     u.probe_resp.variable);
+       bool overwrite;
+       size_t privsz = wiphy->bss_priv_size;
+
+       if (WARN_ON(sigtype == NL80211_BSS_SIGNAL_UNSPEC &&
+                   (signal < 0 || signal > 100)))
+               return NULL;
+
+       if (WARN_ON(!mgmt || !wiphy ||
+                   len < offsetof(struct ieee80211_mgmt, u.probe_resp.variable)))
+               return NULL;
+
+       res = kzalloc(sizeof(*res) + privsz + ielen, gfp);
+       if (!res)
+               return NULL;
+
+       memcpy(res->pub.bssid, mgmt->bssid, ETH_ALEN);
+       res->pub.channel = channel;
+       res->pub.signal_type = sigtype;
+       res->pub.signal = signal;
+       res->pub.tsf = le64_to_cpu(mgmt->u.probe_resp.timestamp);
+       res->pub.beacon_interval = le16_to_cpu(mgmt->u.probe_resp.beacon_int);
+       res->pub.capability = le16_to_cpu(mgmt->u.probe_resp.capab_info);
+       /* point to after the private area */
+       res->pub.information_elements = (u8 *)res + sizeof(*res) + privsz;
+       memcpy(res->pub.information_elements, mgmt->u.probe_resp.variable, ielen);
+       res->pub.len_information_elements = ielen;
+
+       kref_init(&res->ref);
+
+       overwrite = ieee80211_is_probe_resp(mgmt->frame_control);
+
+       res = cfg80211_bss_update(wiphy_to_dev(wiphy), res, overwrite);
+       if (!res)
+               return NULL;
+
+       /* cfg80211_bss_update gives us a referenced result */
+       return &res->pub;
+}
+EXPORT_SYMBOL(cfg80211_inform_bss_frame);
+
+void cfg80211_put_bss(struct cfg80211_bss *pub)
+{
+       struct cfg80211_internal_bss *bss;
+
+       if (!pub)
+               return;
+
+       bss = container_of(pub, struct cfg80211_internal_bss, pub);
+       kref_put(&bss->ref, bss_release);
+}
+EXPORT_SYMBOL(cfg80211_put_bss);
+
+void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
+{
+       struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy);
+       struct cfg80211_internal_bss *bss;
+
+       if (WARN_ON(!pub))
+               return;
+
+       bss = container_of(pub, struct cfg80211_internal_bss, pub);
+
+       spin_lock_bh(&dev->bss_lock);
+
+       list_del(&bss->list);
+       rb_erase(&bss->rbn, &dev->bss_tree);
+
+       spin_unlock_bh(&dev->bss_lock);
+
+       kref_put(&bss->ref, bss_release);
+}
+EXPORT_SYMBOL(cfg80211_unlink_bss);
+
+#ifdef CONFIG_WIRELESS_EXT
+int cfg80211_wext_siwscan(struct net_device *dev,
+                         struct iw_request_info *info,
+                         union iwreq_data *wrqu, char *extra)
+{
+       struct cfg80211_registered_device *rdev;
+       struct wiphy *wiphy;
+       struct iw_scan_req *wreq = NULL;
+       struct cfg80211_scan_request *creq;
+       int i, err, n_channels = 0;
+       enum ieee80211_band band;
+
+       if (!netif_running(dev))
+               return -ENETDOWN;
+
+       rdev = cfg80211_get_dev_from_ifindex(dev->ifindex);
+
+       if (IS_ERR(rdev))
+               return PTR_ERR(rdev);
+
+       if (rdev->scan_req) {
+               err = -EBUSY;
+               goto out;
+       }
+
+       wiphy = &rdev->wiphy;
+
+       for (band = 0; band < IEEE80211_NUM_BANDS; band++)
+               if (wiphy->bands[band])
+                       n_channels += wiphy->bands[band]->n_channels;
+
+       creq = kzalloc(sizeof(*creq) + sizeof(struct cfg80211_ssid) +
+                      n_channels * sizeof(void *),
+                      GFP_ATOMIC);
+       if (!creq) {
+               err = -ENOMEM;
+               goto out;
+       }
+
+       creq->wiphy = wiphy;
+       creq->ifidx = dev->ifindex;
+       creq->ssids = (void *)(creq + 1);
+       creq->channels = (void *)(creq->ssids + 1);
+       creq->n_channels = n_channels;
+       creq->n_ssids = 1;
+
+       /* all channels */
+       i = 0;
+       for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+               int j;
+               if (!wiphy->bands[band])
+                       continue;
+               for (j = 0; j < wiphy->bands[band]->n_channels; j++) {
+                       creq->channels[i] = &wiphy->bands[band]->channels[j];
+                       i++;
+               }
+       }
+
+       /* translate scan request */
+       if (wrqu->data.length == sizeof(struct iw_scan_req)) {
+               wreq = (struct iw_scan_req *)extra;
+
+               if (wrqu->data.flags & IW_SCAN_THIS_ESSID) {
+                       if (wreq->essid_len > IEEE80211_MAX_SSID_LEN)
+                               return -EINVAL;
+                       memcpy(creq->ssids[0].ssid, wreq->essid, wreq->essid_len);
+                       creq->ssids[0].ssid_len = wreq->essid_len;
+               }
+               if (wreq->scan_type == IW_SCAN_TYPE_PASSIVE)
+                       creq->n_ssids = 0;
+       }
+
+       rdev->scan_req = creq;
+       err = rdev->ops->scan(wiphy, dev, creq);
+       if (err) {
+               rdev->scan_req = NULL;
+               kfree(creq);
+       }
+ out:
+       cfg80211_put_dev(rdev);
+       return err;
+}
+EXPORT_SYMBOL(cfg80211_wext_siwscan);
+
+static void ieee80211_scan_add_ies(struct iw_request_info *info,
+                                  struct cfg80211_bss *bss,
+                                  char **current_ev, char *end_buf)
+{
+       u8 *pos, *end, *next;
+       struct iw_event iwe;
+
+       if (!bss->information_elements ||
+           !bss->len_information_elements)
+               return;
+
+       /*
+        * If needed, fragment the IEs buffer (at IE boundaries) into short
+        * enough fragments to fit into IW_GENERIC_IE_MAX octet messages.
+        */
+       pos = bss->information_elements;
+       end = pos + bss->len_information_elements;
+
+       while (end - pos > IW_GENERIC_IE_MAX) {
+               next = pos + 2 + pos[1];
+               while (next + 2 + next[1] - pos < IW_GENERIC_IE_MAX)
+                       next = next + 2 + next[1];
+
+               memset(&iwe, 0, sizeof(iwe));
+               iwe.cmd = IWEVGENIE;
+               iwe.u.data.length = next - pos;
+               *current_ev = iwe_stream_add_point(info, *current_ev,
+                                                  end_buf, &iwe, pos);
+
+               pos = next;
+       }
+
+       if (end > pos) {
+               memset(&iwe, 0, sizeof(iwe));
+               iwe.cmd = IWEVGENIE;
+               iwe.u.data.length = end - pos;
+               *current_ev = iwe_stream_add_point(info, *current_ev,
+                                                  end_buf, &iwe, pos);
+       }
+}
+
+
+static char *
+ieee80211_bss(struct iw_request_info *info,
+                     struct cfg80211_internal_bss *bss,
+                     char *current_ev, char *end_buf)
+{
+       struct iw_event iwe;
+       u8 *buf, *cfg, *p;
+       u8 *ie = bss->pub.information_elements;
+       int rem = bss->pub.len_information_elements, i;
+       bool ismesh = false;
+
+       memset(&iwe, 0, sizeof(iwe));
+       iwe.cmd = SIOCGIWAP;
+       iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
+       memcpy(iwe.u.ap_addr.sa_data, bss->pub.bssid, ETH_ALEN);
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
+                                         IW_EV_ADDR_LEN);
+
+       memset(&iwe, 0, sizeof(iwe));
+       iwe.cmd = SIOCGIWFREQ;
+       iwe.u.freq.m = ieee80211_frequency_to_channel(bss->pub.channel->center_freq);
+       iwe.u.freq.e = 0;
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
+                                         IW_EV_FREQ_LEN);
+
+       memset(&iwe, 0, sizeof(iwe));
+       iwe.cmd = SIOCGIWFREQ;
+       iwe.u.freq.m = bss->pub.channel->center_freq;
+       iwe.u.freq.e = 6;
+       current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
+                                         IW_EV_FREQ_LEN);
+
+       if (bss->pub.signal_type != CFG80211_SIGNAL_TYPE_NONE) {
+               memset(&iwe, 0, sizeof(iwe));
+               iwe.cmd = IWEVQUAL;
+               iwe.u.qual.updated = IW_QUAL_LEVEL_UPDATED |
+                                    IW_QUAL_NOISE_INVALID |
+                                    IW_QUAL_QUAL_INVALID;
+               switch (bss->pub.signal_type) {
+               case CFG80211_SIGNAL_TYPE_MBM:
+                       iwe.u.qual.level = bss->pub.signal / 100;
+                       iwe.u.qual.updated |= IW_QUAL_DBM;
+                       break;
+               case CFG80211_SIGNAL_TYPE_UNSPEC:
+                       iwe.u.qual.level = bss->pub.signal;
+                       break;
+               default:
+                       /* not reached */
+                       break;
+               }
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_QUAL_LEN);
+       }
+
+       memset(&iwe, 0, sizeof(iwe));
+       iwe.cmd = SIOCGIWENCODE;
+       if (bss->pub.capability & WLAN_CAPABILITY_PRIVACY)
+               iwe.u.data.flags = IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
+       else
+               iwe.u.data.flags = IW_ENCODE_DISABLED;
+       iwe.u.data.length = 0;
+       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                         &iwe, "");
+
+       while (rem >= 2) {
+               /* invalid data */
+               if (ie[1] > rem - 2)
+                       break;
+
+               switch (ie[0]) {
+               case WLAN_EID_SSID:
+                       memset(&iwe, 0, sizeof(iwe));
+                       iwe.cmd = SIOCGIWESSID;
+                       iwe.u.data.length = ie[1];
+                       iwe.u.data.flags = 1;
+                       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                         &iwe, ie + 2);
+                       break;
+               case WLAN_EID_MESH_ID:
+                       memset(&iwe, 0, sizeof(iwe));
+                       iwe.cmd = SIOCGIWESSID;
+                       iwe.u.data.length = ie[1];
+                       iwe.u.data.flags = 1;
+                       current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                         &iwe, ie + 2);
+                       break;
+               case WLAN_EID_MESH_CONFIG:
+                       ismesh = true;
+                       if (ie[1] != IEEE80211_MESH_CONFIG_LEN)
+                               break;
+                       buf = kmalloc(50, GFP_ATOMIC);
+                       if (!buf)
+                               break;
+                       cfg = ie + 2;
+                       memset(&iwe, 0, sizeof(iwe));
+                       iwe.cmd = IWEVCUSTOM;
+                       sprintf(buf, "Mesh network (version %d)", cfg[0]);
+                       iwe.u.data.length = strlen(buf);
+                       current_ev = iwe_stream_add_point(info, current_ev,
+                                                         end_buf,
+                                                         &iwe, buf);
+                       sprintf(buf, "Path Selection Protocol ID: "
+                               "0x%02X%02X%02X%02X", cfg[1], cfg[2], cfg[3],
+                                                       cfg[4]);
+                       iwe.u.data.length = strlen(buf);
+                       current_ev = iwe_stream_add_point(info, current_ev,
+                                                         end_buf,
+                                                         &iwe, buf);
+                       sprintf(buf, "Path Selection Metric ID: "
+                               "0x%02X%02X%02X%02X", cfg[5], cfg[6], cfg[7],
+                                                       cfg[8]);
+                       iwe.u.data.length = strlen(buf);
+                       current_ev = iwe_stream_add_point(info, current_ev,
+                                                         end_buf,
+                                                         &iwe, buf);
+                       sprintf(buf, "Congestion Control Mode ID: "
+                               "0x%02X%02X%02X%02X", cfg[9], cfg[10],
+                                                       cfg[11], cfg[12]);
+                       iwe.u.data.length = strlen(buf);
+                       current_ev = iwe_stream_add_point(info, current_ev,
+                                                         end_buf,
+                                                         &iwe, buf);
+                       sprintf(buf, "Channel Precedence: "
+                               "0x%02X%02X%02X%02X", cfg[13], cfg[14],
+                                                       cfg[15], cfg[16]);
+                       iwe.u.data.length = strlen(buf);
+                       current_ev = iwe_stream_add_point(info, current_ev,
+                                                         end_buf,
+                                                         &iwe, buf);
+                       kfree(buf);
+                       break;
+               case WLAN_EID_SUPP_RATES:
+               case WLAN_EID_EXT_SUPP_RATES:
+                       /* display all supported rates in readable format */
+                       p = current_ev + iwe_stream_lcp_len(info);
+
+                       memset(&iwe, 0, sizeof(iwe));
+                       iwe.cmd = SIOCGIWRATE;
+                       /* Those two flags are ignored... */
+                       iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
+
+                       for (i = 0; i < ie[1]; i++) {
+                               iwe.u.bitrate.value =
+                                       ((ie[i + 2] & 0x7f) * 500000);
+                               p = iwe_stream_add_value(info, current_ev, p,
+                                               end_buf, &iwe, IW_EV_PARAM_LEN);
+                       }
+                       current_ev = p;
+                       break;
+               }
+               rem -= ie[1] + 2;
+               ie += ie[1] + 2;
+       }
+
+       if (bss->pub.capability & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)
+           || ismesh) {
+               memset(&iwe, 0, sizeof(iwe));
+               iwe.cmd = SIOCGIWMODE;
+               if (ismesh)
+                       iwe.u.mode = IW_MODE_MESH;
+               else if (bss->pub.capability & WLAN_CAPABILITY_ESS)
+                       iwe.u.mode = IW_MODE_MASTER;
+               else
+                       iwe.u.mode = IW_MODE_ADHOC;
+               current_ev = iwe_stream_add_event(info, current_ev, end_buf,
+                                                 &iwe, IW_EV_UINT_LEN);
+       }
+
+       buf = kmalloc(30, GFP_ATOMIC);
+       if (buf) {
+               memset(&iwe, 0, sizeof(iwe));
+               iwe.cmd = IWEVCUSTOM;
+               sprintf(buf, "tsf=%016llx", (unsigned long long)(bss->pub.tsf));
+               iwe.u.data.length = strlen(buf);
+               current_ev = iwe_stream_add_point(info, current_ev, end_buf,
+                                                 &iwe, buf);
+               memset(&iwe, 0, sizeof(iwe));
+               iwe.cmd = IWEVCUSTOM;
+               sprintf(buf, " Last beacon: %dms ago",
+                       jiffies_to_msecs(jiffies - bss->ts));
+               iwe.u.data.length = strlen(buf);
+               current_ev = iwe_stream_add_point(info, current_ev,
+                                                 end_buf, &iwe, buf);
+               kfree(buf);
+       }
+
+       ieee80211_scan_add_ies(info, &bss->pub, &current_ev, end_buf);
+
+       return current_ev;
+}
+
+
+static int ieee80211_scan_results(struct cfg80211_registered_device *dev,
+                                 struct iw_request_info *info,
+                                 char *buf, size_t len)
+{
+       char *current_ev = buf;
+       char *end_buf = buf + len;
+       struct cfg80211_internal_bss *bss;
+
+       spin_lock_bh(&dev->bss_lock);
+       cfg80211_bss_expire(dev);
+
+       list_for_each_entry(bss, &dev->bss_list, list) {
+               if (buf + len - current_ev <= IW_EV_ADDR_LEN) {
+                       spin_unlock_bh(&dev->bss_lock);
+                       return -E2BIG;
+               }
+               current_ev = ieee80211_bss(info, bss,
+                                                  current_ev, end_buf);
+       }
+       spin_unlock_bh(&dev->bss_lock);
+       return current_ev - buf;
+}
+
+
+int cfg80211_wext_giwscan(struct net_device *dev,
+                         struct iw_request_info *info,
+                         struct iw_point *data, char *extra)
+{
+       struct cfg80211_registered_device *rdev;
+       int res;
+
+       if (!netif_running(dev))
+               return -ENETDOWN;
+
+       rdev = cfg80211_get_dev_from_ifindex(dev->ifindex);
+
+       if (IS_ERR(rdev))
+               return PTR_ERR(rdev);
+
+       if (rdev->scan_req) {
+               res = -EAGAIN;
+               goto out;
+       }
+
+       res = ieee80211_scan_results(rdev, info, extra, data->length);
+       data->length = 0;
+       if (res >= 0) {
+               data->length = res;
+               res = 0;
+       }
+
+ out:
+       cfg80211_put_dev(rdev);
+       return res;
+}
+EXPORT_SYMBOL(cfg80211_wext_giwscan);
+#endif
index 79a38287764165c41b74533efa0043aaae4a6c3f..26a72b0797a09e5c6c2ff4595dab1309d007c627 100644 (file)
@@ -55,6 +55,34 @@ static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)
 }
 #endif
 
+static int wiphy_suspend(struct device *dev, pm_message_t state)
+{
+       struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
+       int ret = 0;
+
+       if (rdev->ops->suspend) {
+               rtnl_lock();
+               ret = rdev->ops->suspend(&rdev->wiphy);
+               rtnl_unlock();
+       }
+
+       return ret;
+}
+
+static int wiphy_resume(struct device *dev)
+{
+       struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
+       int ret = 0;
+
+       if (rdev->ops->resume) {
+               rtnl_lock();
+               ret = rdev->ops->resume(&rdev->wiphy);
+               rtnl_unlock();
+       }
+
+       return ret;
+}
+
 struct class ieee80211_class = {
        .name = "ieee80211",
        .owner = THIS_MODULE,
@@ -63,6 +91,8 @@ struct class ieee80211_class = {
 #ifdef CONFIG_HOTPLUG
        .dev_uevent = wiphy_uevent,
 #endif
+       .suspend = wiphy_suspend,
+       .resume = wiphy_resume,
 };
 
 int wiphy_sysfs_init(void)
index e76cc28b034557fc1dfcadbae21a09307f6fee5c..487cdd9bcffcb0137fb3f6dd04db210c005eae06 100644 (file)
@@ -9,7 +9,7 @@
 
 struct ieee80211_rate *
 ieee80211_get_response_rate(struct ieee80211_supported_band *sband,
-                           u64 basic_rates, int bitrate)
+                           u32 basic_rates, int bitrate)
 {
        struct ieee80211_rate *result = &sband->bitrates[0];
        int i;
index 9fc5b023d1118a990944cbe32ff5ab2c81e07f5b..8f76f4009c24d3c2c1d596afea65f36317c7d335 100644 (file)
@@ -1609,7 +1609,7 @@ static const struct proto_ops SOCKOPS_WRAPPED(x25_proto_ops) = {
 SOCKOPS_WRAP(x25_proto, AF_X25);
 
 static struct packet_type x25_packet_type = {
-       .type = __constant_htons(ETH_P_X25),
+       .type = cpu_to_be16(ETH_P_X25),
        .func = x25_lapb_receive_frame,
 };
 
index b0246307aac497ae36b8266180b48a244c9c374d..12caa822a232eeddc0fc97606fc5002a86a4daf7 100644 (file)
@@ -51,7 +51,7 @@ my %pidctr;
 
 while (<>) {
        my $line = $_;
-       if ($line =~ /([0-9\.]+)\] calling  ([a-zA-Z0-9\_]+)\+/) {
+       if ($line =~ /([0-9\.]+)\] calling  ([a-zA-Z0-9\_\.]+)\+/) {
                my $func = $2;
                if ($done == 0) {
                        $start{$func} = $1;
@@ -87,7 +87,7 @@ while (<>) {
                $count = $count + 1;
        }
 
-       if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_]+)\+.*returned/) {
+       if ($line =~ /([0-9\.]+)\] initcall ([a-zA-Z0-9\_\.]+)\+.*returned/) {
                if ($done == 0) {
                        $end{$2} = $1;
                        $maxtime = $1;
index 8bb83a100edb81316b4f99f419a0e826fe9739f2..0f11870116dc7bbce74d813928b19c36f847796c 100755 (executable)
@@ -1827,6 +1827,40 @@ sub reset_state {
     $state = 0;
 }
 
+sub syscall_munge() {
+       my $void = 0;
+
+       $prototype =~ s@[\r\n\t]+@ @gos; # strip newlines/CR's/tabs
+##     if ($prototype =~ m/SYSCALL_DEFINE0\s*\(\s*(a-zA-Z0-9_)*\s*\)/) {
+       if ($prototype =~ m/SYSCALL_DEFINE0/) {
+               $void = 1;
+##             $prototype = "long sys_$1(void)";
+       }
+
+       $prototype =~ s/SYSCALL_DEFINE.*\(/long sys_/; # fix return type & func name
+       if ($prototype =~ m/long (sys_.*?),/) {
+               $prototype =~ s/,/\(/;
+       } elsif ($void) {
+               $prototype =~ s/\)/\(void\)/;
+       }
+
+       # now delete all of the odd-number commas in $prototype
+       # so that arg types & arg names don't have a comma between them
+       my $count = 0;
+       my $len = length($prototype);
+       if ($void) {
+               $len = 0;       # skip the for-loop
+       }
+       for (my $ix = 0; $ix < $len; $ix++) {
+               if (substr($prototype, $ix, 1) eq ',') {
+                       $count++;
+                       if ($count % 2 == 1) {
+                               substr($prototype, $ix, 1) = ' ';
+                       }
+               }
+       }
+}
+
 sub process_state3_function($$) {
     my $x = shift;
     my $file = shift;
@@ -1839,11 +1873,15 @@ sub process_state3_function($$) {
     elsif ($x =~ /([^\{]*)/) {
        $prototype .= $1;
     }
+
     if (($x =~ /\{/) || ($x =~ /\#\s*define/) || ($x =~ /;/)) {
        $prototype =~ s@/\*.*?\*/@@gos; # strip comments.
        $prototype =~ s@[\r\n]+@ @gos; # strip newlines/cr's.
        $prototype =~ s@^\s+@@gos; # strip leading spaces
-       dump_function($prototype,$file);
+       if ($prototype =~ /SYSCALL_DEFINE/) {
+               syscall_munge();
+       }
+       dump_function($prototype, $file);
        reset_state();
     }
 }
index d40449cafa84a44dac9f21c54364913c777ffc6d..528492bcba5bf73e8f809490c9d6d8c8ea821ec8 100644 (file)
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl
 
 use File::Basename;
 
@@ -29,27 +29,151 @@ my $filename = $vmlinux_name;
 my $target = "0";
 my $function;
 my $module = "";
-my $func_offset;
+my $func_offset = 0;
 my $vmaoffset = 0;
 
+my %regs;
+
+
+sub parse_x86_regs
+{
+       my ($line) = @_;
+       if ($line =~ /EAX: ([0-9a-f]+) EBX: ([0-9a-f]+) ECX: ([0-9a-f]+) EDX: ([0-9a-f]+)/) {
+               $regs{"%eax"} = $1;
+               $regs{"%ebx"} = $2;
+               $regs{"%ecx"} = $3;
+               $regs{"%edx"} = $4;
+       }
+       if ($line =~ /ESI: ([0-9a-f]+) EDI: ([0-9a-f]+) EBP: ([0-9a-f]+) ESP: ([0-9a-f]+)/) {
+               $regs{"%esi"} = $1;
+               $regs{"%edi"} = $2;
+               $regs{"%esp"} = $4;
+       }
+       if ($line =~ /RAX: ([0-9a-f]+) RBX: ([0-9a-f]+) RCX: ([0-9a-f]+)/) {
+               $regs{"%eax"} = $1;
+               $regs{"%ebx"} = $2;
+               $regs{"%ecx"} = $3;
+       }
+       if ($line =~ /RDX: ([0-9a-f]+) RSI: ([0-9a-f]+) RDI: ([0-9a-f]+)/) {
+               $regs{"%edx"} = $1;
+               $regs{"%esi"} = $2;
+               $regs{"%edi"} = $3;
+       }
+       if ($line =~ /RBP: ([0-9a-f]+) R08: ([0-9a-f]+) R09: ([0-9a-f]+)/) {
+               $regs{"%r08"} = $2;
+               $regs{"%r09"} = $3;
+       }
+       if ($line =~ /R10: ([0-9a-f]+) R11: ([0-9a-f]+) R12: ([0-9a-f]+)/) {
+               $regs{"%r10"} = $1;
+               $regs{"%r11"} = $2;
+               $regs{"%r12"} = $3;
+       }
+       if ($line =~ /R13: ([0-9a-f]+) R14: ([0-9a-f]+) R15: ([0-9a-f]+)/) {
+               $regs{"%r13"} = $1;
+               $regs{"%r14"} = $2;
+               $regs{"%r15"} = $3;
+       }
+}
+
+sub reg_name
+{
+       my ($reg) = @_;
+       $reg =~ s/r(.)x/e\1x/;
+       $reg =~ s/r(.)i/e\1i/;
+       $reg =~ s/r(.)p/e\1p/;
+       return $reg;
+}
+
+sub process_x86_regs
+{
+       my ($line, $cntr) = @_;
+       my $str = "";
+       if (length($line) < 40) {
+               return ""; # not an asm istruction
+       }
+
+       # find the arguments to the instruction
+       if ($line =~ /([0-9a-zA-Z\,\%\(\)\-\+]+)$/) {
+               $lastword = $1;
+       } else {
+               return "";
+       }
+
+       # we need to find the registers that get clobbered,
+       # since their value is no longer relevant for previous
+       # instructions in the stream.
+
+       $clobber = $lastword;
+       # first, remove all memory operands, they're read only
+       $clobber =~ s/\([a-z0-9\%\,]+\)//g;
+       # then, remove everything before the comma, thats the read part
+       $clobber =~ s/.*\,//g;
+
+       # if this is the instruction that faulted, we haven't actually done
+       # the write yet... nothing is clobbered.
+       if ($cntr == 0) {
+               $clobber = "";
+       }
+
+       foreach $reg (keys(%regs)) {
+               my $clobberprime = reg_name($clobber);
+               my $lastwordprime = reg_name($lastword);
+               my $val = $regs{$reg};
+               if ($val =~ /^[0]+$/) {
+                       $val = "0";
+               } else {
+                       $val =~ s/^0*//;
+               }
+
+               # first check if we're clobbering this register; if we do
+               # we print it with a =>, and then delete its value
+               if ($clobber =~ /$reg/ || $clobberprime =~ /$reg/) {
+                       if (length($val) > 0) {
+                               $str = $str . " $reg => $val ";
+                       }
+                       $regs{$reg} = "";
+                       $val = "";
+               }
+               # now check if we're reading this register
+               if ($lastword =~ /$reg/ || $lastwordprime =~ /$reg/) {
+                       if (length($val) > 0) {
+                               $str = $str . " $reg = $val ";
+                       }
+               }
+       }
+       return $str;
+}
+
+# parse the oops
 while (<STDIN>) {
        my $line = $_;
        if ($line =~ /EIP: 0060:\[\<([a-z0-9]+)\>\]/) {
                $target = $1;
        }
+       if ($line =~ /RIP: 0010:\[\<([a-z0-9]+)\>\]/) {
+               $target = $1;
+       }
        if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
                $function = $1;
                $func_offset = $2;
        }
+       if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\]  \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]/) {
+               $function = $1;
+               $func_offset = $2;
+       }
 
        # check if it's a module
        if ($line =~ /EIP is at ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) {
                $module = $3;
        }
+       if ($line =~ /RIP: 0010:\[\<[0-9a-f]+\>\]  \[\<[0-9a-f]+\>\] ([a-zA-Z0-9\_]+)\+(0x[0-9a-f]+)\/0x[a-f0-9]+\W\[([a-zA-Z0-9\_\-]+)\]/) {
+               $module = $3;
+       }
+       parse_x86_regs($line);
 }
 
 my $decodestart = hex($target) - hex($func_offset);
-my $decodestop = $decodestart + 8192;
+my $decodestop = hex($target) + 8192;
 if ($target eq "0") {
        print "No oops found!\n";
        print "Usage: \n";
@@ -84,6 +208,7 @@ my $counter = 0;
 my $state   = 0;
 my $center  = 0;
 my @lines;
+my @reglines;
 
 sub InRange {
        my ($address, $target) = @_;
@@ -188,16 +313,36 @@ while ($finish < $counter) {
 
 my $i;
 
-my $fulltext = "";
+
+# start annotating the registers in the asm.
+# this goes from the oopsing point back, so that the annotator
+# can track (opportunistically) which registers got written and
+# whos value no longer is relevant.
+
+$i = $center;
+while ($i >= $start) {
+       $reglines[$i] = process_x86_regs($lines[$i], $center - $i);
+       $i = $i - 1;
+}
+
 $i = $start;
 while ($i < $finish) {
+       my $line;
        if ($i == $center) {
-               $fulltext = $fulltext . "*$lines[$i]     <----- faulting instruction\n";
+               $line =  "*$lines[$i] ";
        } else {
-               $fulltext = $fulltext .  " $lines[$i]\n";
+               $line =  " $lines[$i] ";
+       }
+       print $line;
+       if (defined($reglines[$i]) && length($reglines[$i]) > 0) {
+               my $c = 60 - length($line);
+               while ($c > 0) { print " "; $c = $c - 1; };
+               print "| $reglines[$i]";
        }
+       if ($i == $center) {
+               print "<--- faulting instruction";
+       }
+       print "\n";
        $i = $i +1;
 }
 
-print $fulltext;
-
index 491b8b1b6abf326cd1e018c813d14fbbd0402e0b..4eea60b1693e1173960f34e7c73927f5fe61fccb 100644 (file)
@@ -210,6 +210,7 @@ static void do_usb_table(void *symval, unsigned long size,
 static int do_hid_entry(const char *filename,
                             struct hid_device_id *id, char *alias)
 {
+       id->bus = TO_NATIVE(id->bus);
        id->vendor = TO_NATIVE(id->vendor);
        id->product = TO_NATIVE(id->product);
 
index 2500886fb90aa0273743cc67ba40da48c6b4fa5c..ee448cdc6a2b3cd47ca22fd94fd0995d5985f9ae 100755 (executable)
@@ -86,6 +86,14 @@ echo "%endif"
 echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
 
 echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
+
+echo "%ifnarch ppc64"
+echo 'cp vmlinux vmlinux.orig'
+echo 'bzip2 -9 vmlinux'
+echo 'mv vmlinux.bz2 $RPM_BUILD_ROOT'"/boot/vmlinux-$KERNELRELEASE.bz2"
+echo 'mv vmlinux.orig vmlinux'
+echo "%endif"
+
 echo ""
 echo "%clean"
 echo '#echo -rf $RPM_BUILD_ROOT'
index f6946cf99ce1bd0a06f9835157f39d4b2b80e971..f1c4b35bc32428b030f053d46010f21b6812c76f 100755 (executable)
@@ -58,14 +58,7 @@ fi
 # Check for svn and a svn repo.
 if rev=`svn info 2>/dev/null | grep '^Last Changed Rev'`; then
        rev=`echo $rev | awk '{print $NF}'`
-       changes=`svn status 2>/dev/null | grep '^[AMD]' | wc -l`
-
-       # Are there uncommitted changes?
-       if [ $changes != 0 ]; then
-               printf -- '-svn%s%s' "$rev" -dirty
-       else
-               printf -- '-svn%s' "$rev"
-       fi
+       printf -- '-svn%s' "$rev"
 
        # All done with svn
        exit
index fdbe78bb5e2b6ad8359aeabb26b0fcf98af44957..5bd8b1003d446b1f4e80dd7e9a788685263a3a6e 100755 (executable)
@@ -76,7 +76,10 @@ all_sources()
 
 all_kconfigs()
 {
-       find_sources $ALLSOURCE_ARCHS 'Kconfig*'
+       for arch in $ALLSOURCE_ARCHS; do
+               find_sources $arch 'Kconfig*'
+       done
+       find_other_sources 'Kconfig*'
 }
 
 all_defconfigs()
@@ -99,7 +102,8 @@ exuberant()
        -I ____cacheline_internodealigned_in_smp                \
        -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL                      \
        --extra=+f --c-kinds=+px                                \
-       --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'
+       --regex-asm='/^ENTRY\(([^)]*)\).*/\1/'                  \
+       --regex-c='/^SYSCALL_DEFINE[[:digit:]]?\(([^,)]*).*/sys_\1/'
 
        all_kconfigs | xargs $1 -a                              \
        --langdef=kconfig --language-force=kconfig              \
@@ -117,7 +121,9 @@ exuberant()
 
 emacs()
 {
-       all_sources | xargs $1 -a
+       all_sources | xargs $1 -a                               \
+       --regex='/^ENTRY(\([^)]*\)).*/\1/'                      \
+       --regex='/^SYSCALL_DEFINE[0-9]?(\([^,)]*\).*/sys_\1/'
 
        all_kconfigs | xargs $1 -a                              \
        --regex='/^[ \t]*\(\(menu\)*config\)[ \t]+\([a-zA-Z0-9_]+\)/\3/'
index f58701a7b728619a5a50e3bc74981baa23ab60cf..3f4b26647386f58d5932e8e1b78f0e57f8752bf6 100644 (file)
@@ -490,8 +490,10 @@ int selinux_netlbl_socket_setsockopt(struct socket *sock,
                lock_sock(sk);
                rc = netlbl_sock_getattr(sk, &secattr);
                release_sock(sk);
-               if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE)
+               if (rc == 0)
                        rc = -EACCES;
+               else if (rc == -ENOMSG)
+                       rc = 0;
                netlbl_secattr_destroy(&secattr);
        }
 
index 89096e811a4bc47dbe1458c2faba375220ec5bbb..772901e41ecb5fe86d83633e0e2137847233a745 100644 (file)
@@ -90,7 +90,7 @@ static void aaci_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
         */
        do {
                v = readl(aaci->base + AACI_SLFR);
-       } while ((v & (SLFR_1TXB|SLFR_2TXB)) && timeout--);
+       } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout);
 
        if (!timeout)
                dev_err(&aaci->dev->dev,
@@ -126,7 +126,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
         */
        do {
                v = readl(aaci->base + AACI_SLFR);
-       } while ((v & SLFR_1TXB) && timeout--);
+       } while ((v & SLFR_1TXB) && --timeout);
 
        if (!timeout) {
                dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n");
@@ -147,7 +147,7 @@ static unsigned short aaci_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
        do {
                cond_resched();
                v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV);
-       } while ((v != (SLFR_1RXV|SLFR_2RXV)) && timeout--);
+       } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout);
 
        if (!timeout) {
                dev_err(&aaci->dev->dev, "timeout on RX valid\n");
index dd4a12dc09aa44f4c50c5b60f2cf5584c5635589..077a85262c1c2592c8323b6f249fc645aaf5ecc7 100644 (file)
@@ -47,7 +47,7 @@ static int snd_jack_dev_register(struct snd_device *device)
        int err;
 
        snprintf(jack->name, sizeof(jack->name), "%s %s",
-                card->longname, jack->id);
+                card->shortname, jack->id);
        jack->input_dev->name = jack->name;
 
        /* Default to the sound card device. */
index e17836680f4980f5fd0d9aad9de4ed674be46a93..0a1798eafb0b5400a0cceea85c072aa0e805f31a 100644 (file)
@@ -1767,7 +1767,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file)
                       AFMT_S8 | AFMT_U16_LE |
                       AFMT_U16_BE |
                        AFMT_S32_LE | AFMT_S32_BE |
-                       AFMT_S24_LE | AFMT_S24_LE |
+                       AFMT_S24_LE | AFMT_S24_BE |
                        AFMT_S24_PACKED;
        params = kmalloc(sizeof(*params), GFP_KERNEL);
        if (!params)
index 5b89c0883d6081b8d5b8b854d72585ef345f6c55..48b64e6b26701e14ace4015b5df08b7f56408d5a 100644 (file)
@@ -706,7 +706,6 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
        mtp_card->card = card;
        mtp_card->irq = -1;
        mtp_card->share_irq = 0;
-       mtp_card->inmidiport = 0xffffffff;
        mtp_card->inmidistate = 0;
        mtp_card->outmidihwport = 0xffffffff;
        init_timer(&mtp_card->timer);
@@ -719,6 +718,8 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
        if (err < 0)
                goto __error;
 
+       mtp_card->inmidiport = mtp_card->num_ports + MTPAV_PIDX_BROADCAST;
+
        err = snd_mtpav_get_ISA(mtp_card);
        if (err < 0)
                goto __error;
index 57d9f154c88b96ad5df87893f70e5690449c1d31..38931f2f6967e0f1f11c0e0296bd398e1770d538 100644 (file)
@@ -847,23 +847,23 @@ static int __init AtaIrqInit(void)
           of events. So all we need to keep the music playing is
           to provide the sound hardware with new data upon
           an interrupt from timer A. */
-       mfp.tim_ct_a = 0;       /* ++roman: Stop timer before programming! */
-       mfp.tim_dt_a = 1;       /* Cause interrupt after first event. */
-       mfp.tim_ct_a = 8;       /* Turn on event counting. */
+       st_mfp.tim_ct_a = 0;    /* ++roman: Stop timer before programming! */
+       st_mfp.tim_dt_a = 1;    /* Cause interrupt after first event. */
+       st_mfp.tim_ct_a = 8;    /* Turn on event counting. */
        /* Register interrupt handler. */
        if (request_irq(IRQ_MFP_TIMA, AtaInterrupt, IRQ_TYPE_SLOW, "DMA sound",
                        AtaInterrupt))
                return 0;
-       mfp.int_en_a |= 0x20;   /* Turn interrupt on. */
-       mfp.int_mk_a |= 0x20;
+       st_mfp.int_en_a |= 0x20;        /* Turn interrupt on. */
+       st_mfp.int_mk_a |= 0x20;
        return 1;
 }
 
 #ifdef MODULE
 static void AtaIrqCleanUp(void)
 {
-       mfp.tim_ct_a = 0;       /* stop timer */
-       mfp.int_en_a &= ~0x20;  /* turn interrupt off */
+       st_mfp.tim_ct_a = 0;            /* stop timer */
+       st_mfp.int_en_a &= ~0x20;       /* turn interrupt off */
        free_irq(IRQ_MFP_TIMA, AtaInterrupt);
 }
 #endif /* MODULE */
@@ -1599,7 +1599,7 @@ static int __init dmasound_atari_init(void)
                is_falcon = 0;
            } else
                return -ENODEV;
-           if ((mfp.int_en_a & mfp.int_mk_a & 0x20) == 0)
+           if ((st_mfp.int_en_a & st_mfp.int_mk_a & 0x20) == 0)
                return dmasound_init();
            else {
                printk("DMA sound driver: Timer A interrupt already in use\n");
index b7bba7dc7cf15ee0e18b6147839d0c3c8ae59d3b..d03f99298be95eb64856288f71f957e4c63d2e8e 100644 (file)
@@ -487,7 +487,6 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card,
 {
        struct hda_bus *bus;
        int err;
-       char qname[8];
        static struct snd_device_ops dev_ops = {
                .dev_register = snd_hda_bus_dev_register,
                .dev_free = snd_hda_bus_dev_free,
@@ -517,10 +516,12 @@ int /*__devinit*/ snd_hda_bus_new(struct snd_card *card,
        mutex_init(&bus->cmd_mutex);
        INIT_LIST_HEAD(&bus->codec_list);
 
-       snprintf(qname, sizeof(qname), "hda%d", card->number);
-       bus->workq = create_workqueue(qname);
+       snprintf(bus->workq_name, sizeof(bus->workq_name),
+                "hd-audio%d", card->number);
+       bus->workq = create_singlethread_workqueue(bus->workq_name);
        if (!bus->workq) {
-               snd_printk(KERN_ERR "cannot create workqueue %s\n", qname);
+               snd_printk(KERN_ERR "cannot create workqueue %s\n",
+                          bus->workq_name);
                kfree(bus);
                return -ENOMEM;
        }
@@ -3087,6 +3088,16 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
 }
 EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare);
 
+int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
+                                 struct hda_multi_out *mout)
+{
+       mutex_lock(&codec->spdif_mutex);
+       cleanup_dig_out_stream(codec, mout->dig_out_nid);
+       mutex_unlock(&codec->spdif_mutex);
+       return 0;
+}
+EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_cleanup);
+
 /*
  * release the digital out
  */
index 5810ef5884029bba949a4ba8b396478766c93d8f..09a332ada0c68dd8a840de095846fe4f9328abcc 100644 (file)
@@ -614,6 +614,7 @@ struct hda_bus {
 
        /* unsolicited event queue */
        struct hda_bus_unsolicited *unsol;
+       char workq_name[16];
        struct workqueue_struct *workq; /* common workqueue for codecs */
 
        /* assigned PCMs */
index 300ab407cf42ede5b34eeace7ed9286836b5f118..482fb0304ca91fc4a7735408393ec68b888bcefc 100644 (file)
@@ -175,7 +175,7 @@ static int reconfig_codec(struct hda_codec *codec)
        err = snd_hda_codec_build_controls(codec);
        if (err < 0)
                return err;
-       return 0;
+       return snd_card_register(codec->bus->card);
 }
 
 /*
index 11e791b965f6a772588ac7dff64437b3ec836e70..c8d9178f47e59bf327b17433017d24460620a5e5 100644 (file)
@@ -1947,16 +1947,13 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
        return 0;
 }
 
-static int azx_resume_early(struct pci_dev *pci)
-{
-       return pci_restore_state(pci);
-}
-
 static int azx_resume(struct pci_dev *pci)
 {
        struct snd_card *card = pci_get_drvdata(pci);
        struct azx *chip = card->private_data;
 
+       pci_set_power_state(pci, PCI_D0);
+       pci_restore_state(pci);
        if (pci_enable_device(pci) < 0) {
                printk(KERN_ERR "hda-intel: pci_enable_device failed, "
                       "disabling device\n");
@@ -2468,7 +2465,6 @@ static struct pci_driver driver = {
        .remove = __devexit_p(azx_remove),
 #ifdef CONFIG_PM
        .suspend = azx_suspend,
-       .resume_early = azx_resume_early,
        .resume = azx_resume,
 #endif
 };
index 1dd8716c387f74e036a30d14301e37e443d77925..44f189cb97aee1f8d40f166a5a998ae0ddca61b1 100644 (file)
@@ -251,6 +251,8 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
                                  unsigned int stream_tag,
                                  unsigned int format,
                                  struct snd_pcm_substream *substream);
+int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
+                                 struct hda_multi_out *mout);
 int snd_hda_multi_out_analog_open(struct hda_codec *codec,
                                  struct hda_multi_out *mout,
                                  struct snd_pcm_substream *substream,
index 7ca66d654148bb07723982411e3401acd93f4887..144b85276d5a9431de945d75f4eda4309c4e39d7 100644 (file)
@@ -399,7 +399,8 @@ static void print_conn_list(struct snd_info_buffer *buffer,
 {
        int c, curr = -1;
 
-       if (conn_len > 1 && wid_type != AC_WID_AUD_MIX)
+       if (conn_len > 1 && wid_type != AC_WID_AUD_MIX &&
+           wid_type != AC_WID_VOL_KNB)
                curr = snd_hda_codec_read(codec, nid, 0,
                                          AC_VERB_GET_CONNECT_SEL, 0);
        snd_iprintf(buffer, "  Connection: %d\n", conn_len);
index 2e7371ec2e2319fcebe123ed36fe87b58e5e4cbf..e48612323aa0f11facf58c1d9df107bca5fa3692 100644 (file)
@@ -275,6 +275,14 @@ static int ad198x_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
                                             format, substream);
 }
 
+static int ad198x_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
+                                          struct hda_codec *codec,
+                                          struct snd_pcm_substream *substream)
+{
+       struct ad198x_spec *spec = codec->spec;
+       return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
+}
+
 /*
  * Analog capture
  */
@@ -333,7 +341,8 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = {
        .ops = {
                .open = ad198x_dig_playback_pcm_open,
                .close = ad198x_dig_playback_pcm_close,
-               .prepare = ad198x_dig_playback_pcm_prepare
+               .prepare = ad198x_dig_playback_pcm_prepare,
+               .cleanup = ad198x_dig_playback_pcm_cleanup
        },
 };
 
@@ -1885,8 +1894,8 @@ static hda_nid_t ad1988_capsrc_nids[3] = {
 #define AD1988_SPDIF_OUT_HDMI  0x0b
 #define AD1988_SPDIF_IN                0x07
 
-static hda_nid_t ad1989b_slave_dig_outs[2] = {
-       AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI
+static hda_nid_t ad1989b_slave_dig_outs[] = {
+       AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0
 };
 
 static struct hda_input_mux ad1988_6stack_capture_source = {
index 3564f4e4b74c035d8d88b1193d2a93498789942c..fcc77fec4487c46b48a9c6115c26e16989380ba4 100644 (file)
@@ -49,11 +49,6 @@ static struct hda_verb pinout_enable_verb[] = {
        {} /* terminator */
 };
 
-static struct hda_verb pinout_disable_verb[] = {
-       {PIN_NID, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00},
-       {}
-};
-
 static struct hda_verb unsolicited_response_verb[] = {
        {PIN_NID, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN |
                                                  INTEL_HDMI_EVENT_TAG},
@@ -248,10 +243,6 @@ static void hdmi_write_dip_byte(struct hda_codec *codec, hda_nid_t nid,
 
 static void hdmi_enable_output(struct hda_codec *codec)
 {
-       /* Enable Audio InfoFrame Transmission */
-       hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
-       snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
-                                               AC_DIPXMIT_BEST);
        /* Unmute */
        if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP)
                snd_hda_codec_write(codec, PIN_NID, 0,
@@ -260,17 +251,24 @@ static void hdmi_enable_output(struct hda_codec *codec)
        snd_hda_sequence_write(codec, pinout_enable_verb);
 }
 
-static void hdmi_disable_output(struct hda_codec *codec)
+/*
+ * Enable Audio InfoFrame Transmission
+ */
+static void hdmi_start_infoframe_trans(struct hda_codec *codec)
 {
-       snd_hda_sequence_write(codec, pinout_disable_verb);
-       if (get_wcaps(codec, PIN_NID) & AC_WCAP_OUT_AMP)
-               snd_hda_codec_write(codec, PIN_NID, 0,
-                               AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE);
+       hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
+       snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
+                                               AC_DIPXMIT_BEST);
+}
 
-       /*
-        * FIXME: noises may arise when playing music after reloading the
-        * kernel module, until the next X restart or monitor repower.
-        */
+/*
+ * Disable Audio InfoFrame Transmission
+ */
+static void hdmi_stop_infoframe_trans(struct hda_codec *codec)
+{
+       hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
+       snd_hda_codec_write(codec, PIN_NID, 0, AC_VERB_SET_HDMI_DIP_XMIT,
+                                               AC_DIPXMIT_DISABLE);
 }
 
 static int hdmi_get_channel_count(struct hda_codec *codec)
@@ -368,11 +366,16 @@ static void hdmi_fill_audio_infoframe(struct hda_codec *codec,
                                        struct hdmi_audio_infoframe *ai)
 {
        u8 *params = (u8 *)ai;
+       u8 sum = 0;
        int i;
 
        hdmi_debug_dip_size(codec);
        hdmi_clear_dip_buffers(codec); /* be paranoid */
 
+       for (i = 0; i < sizeof(ai); i++)
+               sum += params[i];
+       ai->checksum = - sum;
+
        hdmi_set_dip_index(codec, PIN_NID, 0x0, 0x0);
        for (i = 0; i < sizeof(ai); i++)
                hdmi_write_dip_byte(codec, PIN_NID, params[i]);
@@ -419,13 +422,17 @@ static int hdmi_setup_channel_allocation(struct hda_codec *codec,
        /*
         * CA defaults to 0 for basic stereo audio
         */
-       if (!eld->eld_ver)
-               return 0;
-       if (!eld->spk_alloc)
-               return 0;
        if (channels <= 2)
                return 0;
 
+       /*
+        * HDMI sink's ELD info cannot always be retrieved for now, e.g.
+        * in console or for audio devices. Assume the highest speakers
+        * configuration, to _not_ prohibit multi-channel audio playback.
+        */
+       if (!eld->spk_alloc)
+               eld->spk_alloc = 0xffff;
+
        /*
         * expand ELD's speaker allocation mask
         *
@@ -485,6 +492,7 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
        hdmi_setup_channel_mapping(codec, &ai);
 
        hdmi_fill_audio_infoframe(codec, &ai);
+       hdmi_start_infoframe_trans(codec);
 }
 
 
@@ -562,7 +570,7 @@ static int intel_hdmi_playback_pcm_close(struct hda_pcm_stream *hinfo,
 {
        struct intel_hdmi_spec *spec = codec->spec;
 
-       hdmi_disable_output(codec);
+       hdmi_stop_infoframe_trans(codec);
 
        return snd_hda_multi_out_dig_close(codec, &spec->multiout);
 }
@@ -582,8 +590,6 @@ static int intel_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 
        hdmi_setup_audio_infoframe(codec, substream);
 
-       hdmi_enable_output(codec);
-
        return 0;
 }
 
@@ -628,8 +634,7 @@ static int intel_hdmi_build_controls(struct hda_codec *codec)
 
 static int intel_hdmi_init(struct hda_codec *codec)
 {
-       /* disable audio output as early as possible */
-       hdmi_disable_output(codec);
+       hdmi_enable_output(codec);
 
        snd_hda_sequence_write(codec, unsolicited_response_verb);
 
@@ -679,6 +684,7 @@ static struct hda_codec_preset snd_hda_preset_intelhdmi[] = {
        { .id = 0x80862801, .name = "G45 DEVBLC", .patch = patch_intel_hdmi },
        { .id = 0x80862802, .name = "G45 DEVCTG", .patch = patch_intel_hdmi },
        { .id = 0x80862803, .name = "G45 DEVELK", .patch = patch_intel_hdmi },
+       { .id = 0x80862804, .name = "G45 DEVIBX", .patch = patch_intel_hdmi },
        { .id = 0x10951392, .name = "SiI1392 HDMI",     .patch = patch_intel_hdmi },
        {} /* terminator */
 };
@@ -687,6 +693,7 @@ MODULE_ALIAS("snd-hda-codec-id:808629fb");
 MODULE_ALIAS("snd-hda-codec-id:80862801");
 MODULE_ALIAS("snd-hda-codec-id:80862802");
 MODULE_ALIAS("snd-hda-codec-id:80862803");
+MODULE_ALIAS("snd-hda-codec-id:80862804");
 MODULE_ALIAS("snd-hda-codec-id:10951392");
 
 MODULE_LICENSE("GPL");
index 7884a4e070616b14608184667631e0974c0057d5..ed8fcbd60003cf1ad88af2ded2a5fbda0af2113e 100644 (file)
@@ -1037,6 +1037,7 @@ do_sku:
                case 0x10ec0267:
                case 0x10ec0268:
                case 0x10ec0269:
+               case 0x10ec0272:
                case 0x10ec0660:
                case 0x10ec0662:
                case 0x10ec0663:
@@ -1065,6 +1066,7 @@ do_sku:
                case 0x10ec0882:
                case 0x10ec0883:
                case 0x10ec0885:
+               case 0x10ec0887:
                case 0x10ec0889:
                        snd_hda_codec_write(codec, 0x20, 0,
                                            AC_VERB_SET_COEF_INDEX, 7);
@@ -7012,6 +7014,7 @@ static int patch_alc882(struct hda_codec *codec)
                        break;
                case 0x106b1000: /* iMac 24 */
                case 0x106b2800: /* AppleTV */
+               case 0x106b3e00: /* iMac 24 Aluminium */
                        board_config = ALC885_IMAC24;
                        break;
                case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */
@@ -8475,6 +8478,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
        SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
        SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
        SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
+       SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
        SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
        SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
        SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
@@ -8514,6 +8518,8 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = {
        SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),
        SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
        SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
+       SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550",
+                     ALC883_FUJITSU_PI2515),
        SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
        SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
                ALC888_FUJITSU_XA3530),
index b787b3cc096f5d9dac227a8098543aa905ee951f..8027edf3c8f2ab2d13848b45ab3a66495ceb2e81 100644 (file)
@@ -1799,11 +1799,13 @@ static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2,
                      "HP dv5", STAC_HP_M4),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,
-                     "HP dv7", STAC_HP_M4),
+                     "HP dv7", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7,
                      "HP dv4", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,
                      "HP dv7", STAC_HP_M4),
+       SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600,
+                     "HP dv5", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603,
                      "HP dv5", STAC_HP_DV5),
        SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a,
@@ -2440,6 +2442,14 @@ static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
                                             stream_tag, format, substream);
 }
 
+static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
+                                       struct hda_codec *codec,
+                                       struct snd_pcm_substream *substream)
+{
+       struct sigmatel_spec *spec = codec->spec;
+       return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
+}
+
 
 /*
  * Analog capture callbacks
@@ -2484,7 +2494,8 @@ static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
        .ops = {
                .open = stac92xx_dig_playback_pcm_open,
                .close = stac92xx_dig_playback_pcm_close,
-               .prepare = stac92xx_dig_playback_pcm_prepare
+               .prepare = stac92xx_dig_playback_pcm_prepare,
+               .cleanup = stac92xx_dig_playback_pcm_cleanup
        },
 };
 
index 19d3391e229f2f7e02615a12344142464dfcb902..e900cdc84849ae7a7e8eb1225c917ebfc8639dd3 100644 (file)
@@ -617,7 +617,7 @@ static int snd_intel8x0_ali_codec_semaphore(struct intel8x0 *chip)
        int time = 100;
        if (chip->buggy_semaphore)
                return 0; /* just ignore ... */
-       while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))
+       while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))
                udelay(1);
        if (! time && ! chip->in_ac97_init)
                snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n");
index 18c7c91786bc3d5ff40d615b4a7adc49b13bbedc..6c870c12a1777f887076166b4009d7d18b6cd315 100644 (file)
@@ -26,7 +26,7 @@
  * SPI 0 -> 1st PCM1796 (front)
  * SPI 1 -> 2nd PCM1796 (surround)
  * SPI 2 -> 3rd PCM1796 (center/LFE)
- * SPI 4 -> 4th PCM1796 (back) and EEPROM self-destruct (do not use!)
+ * SPI 4 -> 4th PCM1796 (back)
  *
  * GPIO 2 -> M0 of CS5381
  * GPIO 3 -> M1 of CS5381
@@ -207,12 +207,6 @@ static void xonar_gpio_changed(struct oxygen *chip);
 static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
                                     u8 reg, u8 value)
 {
-       /*
-        * We don't want to do writes on SPI 4 because the EEPROM, which shares
-        * the same pin, might get confused and broken.  We'd better take care
-        * that the driver works with the default register values ...
-        */
-#if 0
        /* maps ALSA channel pair number to SPI output */
        static const u8 codec_map[4] = {
                0, 1, 2, 4
@@ -223,7 +217,6 @@ static inline void pcm1796_write_spi(struct oxygen *chip, unsigned int codec,
                         (codec_map[codec] << OXYGEN_SPI_CODEC_SHIFT) |
                         OXYGEN_SPI_CEN_LATCH_CLOCK_HI,
                         (reg << 8) | value);
-#endif
 }
 
 static inline void pcm1796_write_i2c(struct oxygen *chip, unsigned int codec,
@@ -757,9 +750,6 @@ static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0);
 
 static int xonar_d2_control_filter(struct snd_kcontrol_new *template)
 {
-       if (!strncmp(template->name, "Master Playback ", 16))
-               /* disable volume/mute because they would require SPI writes */
-               return 1;
        if (!strncmp(template->name, "CD Capture ", 11))
                /* CD in is actually connected to the video in pin */
                template->private_value ^= AC97_CD ^ AC97_VIDEO;
@@ -850,8 +840,9 @@ static const struct oxygen_model model_xonar_d2 = {
        .dac_volume_min = 0x0f,
        .dac_volume_max = 0xff,
        .misc_flags = OXYGEN_MISC_MIDI,
-       .function_flags = OXYGEN_FUNCTION_SPI,
-       .dac_i2s_format = OXYGEN_I2S_FORMAT_I2S,
+       .function_flags = OXYGEN_FUNCTION_SPI |
+                         OXYGEN_FUNCTION_ENABLE_SPI_4_5,
+       .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
        .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
 };
 
index c5d67900d666857d7baed233a39d31be01a5be3a..ff0054b765028062bb0040985777969f940fe6fd 100644 (file)
@@ -10,7 +10,7 @@
  * Based on at91-ssc.c by
  * Frank Mandarino <fmandarino@endrelia.com>
  * Based on pxa2xx Platform drivers by
- * Liam Girdwood <liam.girdwood@wolfsonmicro.com>
+ * Liam Girdwood <lrg@slimlogic.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index a828746e8a2f31f58e9df59f25db9c29961a99b3..391135f9c6c10b0057b7a1b742da180ca44927f2 100644 (file)
@@ -10,7 +10,7 @@
  * Based on at91-ssc.c by
  * Frank Mandarino <fmandarino@endrelia.com>
  * Based on pxa2xx Platform drivers by
- * Liam Girdwood <liam.girdwood@wolfsonmicro.com>
+ * Liam Girdwood <lrg@slimlogic.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index b47a749c5ea2aecaf08e92fe0eb03b9538ad14f2..aea0cb72d80a9ad96f81f43e0454231c613cffbf 100644 (file)
@@ -165,10 +165,13 @@ static int snd_soc_dapm_put_volsw_aic3x(struct snd_kcontrol *kcontrol,
                                        struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_dapm_widget *widget = snd_kcontrol_chip(kcontrol);
-       int reg = kcontrol->private_value & 0xff;
-       int shift = (kcontrol->private_value >> 8) & 0x0f;
-       int mask = (kcontrol->private_value >> 16) & 0xff;
-       int invert = (kcontrol->private_value >> 24) & 0x01;
+       struct soc_mixer_control *mc =
+               (struct soc_mixer_control *)kcontrol->private_value;
+       unsigned int reg = mc->reg;
+       unsigned int shift = mc->shift;
+       int max = mc->max;
+       unsigned int mask = (1 << fls(max)) - 1;
+       unsigned int invert = mc->invert;
        unsigned short val, val_mask;
        int ret;
        struct snd_soc_dapm_path *path;
index e3989d406f54d17bb861da78e32d691ba541c1cc..35d99750c383cd48a17603e290d5dce70b7064c7 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (C) 2007, 2008 Wolfson Microelectronics PLC.
  *
- * Author: Liam Girdwood <lg@opensource.wolfsonmicro.com>
+ * Author: Liam Girdwood <lrg@slimlogic.co.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
index 5b5afc14447817ede31e23807af451f4def6e989..a5731faa150c4fdc6b838e5fc11f9cd801861c70 100644 (file)
@@ -2,8 +2,7 @@
  * wm8990.c  --  WM8990 ALSA Soc Audio driver
  *
  * Copyright 2008 Wolfson Microelectronics PLC.
- * Author: Liam Girdwood
- *         lg@opensource.wolfsonmicro.com or linux@wolfsonmicro.com
+ * Author: Liam Girdwood <lrg@slimlogic.co.uk>
  *
  *  This program is free software; you can redistribute  it and/or modify it
  *  under  the terms of  the GNU General  Public License as published by the
@@ -177,7 +176,9 @@ static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol)
 {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
-       int reg = kcontrol->private_value & 0xff;
+       struct soc_mixer_control *mc =
+               (struct soc_mixer_control *)kcontrol->private_value;
+       int reg = mc->reg;
        int ret;
        u16 val;
 
index b0362dfd5b719a50839503fd39992c9d6ec8df0d..dd3bb293376277d180749a31783bcb34efdf040c 100644 (file)
@@ -175,9 +175,10 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
 {
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct omap_runtime_data *prtd = runtime->private_data;
+       unsigned long flags;
        int ret = 0;
 
-       spin_lock_irq(&prtd->lock);
+       spin_lock_irqsave(&prtd->lock, flags);
        switch (cmd) {
        case SNDRV_PCM_TRIGGER_START:
        case SNDRV_PCM_TRIGGER_RESUME:
@@ -195,7 +196,7 @@ static int omap_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
        default:
                ret = -EINVAL;
        }
-       spin_unlock_irq(&prtd->lock);
+       spin_unlock_irqrestore(&prtd->lock, flags);
 
        return ret;
 }
index ad97836818b1a45406d2de42907e7b38f606b918..e226fa75669c8695134958bff7732b0df8824a66 100644 (file)
@@ -91,7 +91,7 @@ static struct snd_soc_dai_link sdp3430_dai = {
 };
 
 /* Audio machine driver */
-static struct snd_soc_machine snd_soc_machine_sdp3430 = {
+static struct snd_soc_card snd_soc_sdp3430 = {
        .name = "SDP3430",
        .platform = &omap_soc_platform,
        .dai_link = &sdp3430_dai,
@@ -100,7 +100,7 @@ static struct snd_soc_machine snd_soc_machine_sdp3430 = {
 
 /* Audio subsystem */
 static struct snd_soc_device sdp3430_snd_devdata = {
-       .machine = &snd_soc_machine_sdp3430,
+       .card = &snd_soc_sdp3430,
        .codec_dev = &soc_codec_dev_twl4030,
 };
 
index 55fdb4abb1796dc728dfedd147dc09eaf01298fc..ec3f8bb4b51d9805d827279e8b025aeeb12d657a 100644 (file)
@@ -1385,7 +1385,10 @@ int snd_soc_init_card(struct snd_soc_device *socdev)
 
        mutex_lock(&codec->mutex);
 #ifdef CONFIG_SND_SOC_AC97_BUS
-       if (ac97) {
+       /* Only instantiate AC97 if not already done by the adaptor
+        * for the generic AC97 subsystem.
+        */
+       if (ac97 && strcmp(codec->name, "AC97") != 0) {
                ret = soc_ac97_dev_register(codec);
                if (ret < 0) {
                        printk(KERN_ERR "asoc: AC97 device register failed\n");
index c709b9563226c0b343f98588f4bc91345c5bf185..19e37451c216182ebdc9d800f304a66f5e6bc9e7 100644 (file)
@@ -2524,7 +2524,6 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
                 * build the rate table and bitmap flags
                 */
                int r, idx;
-               unsigned int nonzero_rates = 0;
 
                fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
                if (fp->rate_table == NULL) {
@@ -2532,24 +2531,27 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform
                        return -1;
                }
 
-               fp->nr_rates = nr_rates;
-               fp->rate_min = fp->rate_max = combine_triple(&fmt[8]);
+               fp->nr_rates = 0;
+               fp->rate_min = fp->rate_max = 0;
                for (r = 0, idx = offset + 1; r < nr_rates; r++, idx += 3) {
                        unsigned int rate = combine_triple(&fmt[idx]);
+                       if (!rate)
+                               continue;
                        /* C-Media CM6501 mislabels its 96 kHz altsetting */
                        if (rate == 48000 && nr_rates == 1 &&
-                           chip->usb_id == USB_ID(0x0d8c, 0x0201) &&
+                           (chip->usb_id == USB_ID(0x0d8c, 0x0201) ||
+                            chip->usb_id == USB_ID(0x0d8c, 0x0102)) &&
                            fp->altsetting == 5 && fp->maxpacksize == 392)
                                rate = 96000;
-                       fp->rate_table[r] = rate;
-                       nonzero_rates |= rate;
-                       if (rate < fp->rate_min)
+                       fp->rate_table[fp->nr_rates] = rate;
+                       if (!fp->rate_min || rate < fp->rate_min)
                                fp->rate_min = rate;
-                       else if (rate > fp->rate_max)
+                       if (!fp->rate_max || rate > fp->rate_max)
                                fp->rate_max = rate;
                        fp->rates |= snd_pcm_rate_to_rate_bit(rate);
+                       fp->nr_rates++;
                }
-               if (!nonzero_rates) {
+               if (!fp->nr_rates) {
                        hwc_debug("All rates were zero. Skipping format!\n");
                        return -1;
                }
@@ -2966,6 +2968,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
                return -EINVAL;
        }
        alts = &iface->altsetting[fp->altset_idx];
+       fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
        usb_set_interface(chip->dev, fp->iface, 0);
        init_usb_pitch(chip->dev, fp->iface, alts, fp);
        init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max);
index 320641ab5be7bf972a78603d1c988ef8fae8f08a..26bad373fe65c012de152ac4f753076951390330 100644 (file)
@@ -1625,6 +1625,7 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi,
        }
 
        ep_info.out_ep = get_endpoint(hostif, 2)->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK;
+       ep_info.out_interval = 0;
        ep_info.out_cables = endpoint->out_cables & 0x5555;
        err = snd_usbmidi_out_endpoint_create(umidi, &ep_info, &umidi->endpoints[0]);
        if (err < 0)
index e9693a29d00e2fe5b159632e301ca4cd0d08bb4d..4c403750360082f0e53d3e5459c17d78797ab9e0 100644 (file)
@@ -73,14 +73,13 @@ static int kvm_iommu_map_memslots(struct kvm *kvm)
 {
        int i, r = 0;
 
-       down_read(&kvm->slots_lock);
        for (i = 0; i < kvm->nmemslots; i++) {
                r = kvm_iommu_map_pages(kvm, kvm->memslots[i].base_gfn,
                                        kvm->memslots[i].npages);
                if (r)
                        break;
        }
-       up_read(&kvm->slots_lock);
+
        return r;
 }
 
@@ -190,12 +189,11 @@ static void kvm_iommu_put_pages(struct kvm *kvm,
 static int kvm_iommu_unmap_memslots(struct kvm *kvm)
 {
        int i;
-       down_read(&kvm->slots_lock);
+
        for (i = 0; i < kvm->nmemslots; i++) {
                kvm_iommu_put_pages(kvm, kvm->memslots[i].base_gfn,
                                    kvm->memslots[i].npages);
        }
-       up_read(&kvm->slots_lock);
 
        return 0;
 }
index 3a5a08298aabd1a06c770c2cf4c2b657fae0af14..29a667ce35b0ebc1840f1fcbb6ae3cf3313fa3b8 100644 (file)
@@ -173,7 +173,6 @@ static void kvm_assigned_dev_interrupt_work_handler(struct work_struct *work)
                assigned_dev->host_irq_disabled = false;
        }
        mutex_unlock(&assigned_dev->kvm->lock);
-       kvm_put_kvm(assigned_dev->kvm);
 }
 
 static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id)
@@ -181,8 +180,6 @@ static irqreturn_t kvm_assigned_dev_intr(int irq, void *dev_id)
        struct kvm_assigned_dev_kernel *assigned_dev =
                (struct kvm_assigned_dev_kernel *) dev_id;
 
-       kvm_get_kvm(assigned_dev->kvm);
-
        schedule_work(&assigned_dev->interrupt_work);
 
        disable_irq_nosync(irq);
@@ -213,6 +210,7 @@ static void kvm_assigned_dev_ack_irq(struct kvm_irq_ack_notifier *kian)
        }
 }
 
+/* The function implicit hold kvm->lock mutex due to cancel_work_sync() */
 static void kvm_free_assigned_irq(struct kvm *kvm,
                                  struct kvm_assigned_dev_kernel *assigned_dev)
 {
@@ -228,11 +226,24 @@ static void kvm_free_assigned_irq(struct kvm *kvm,
        if (!assigned_dev->irq_requested_type)
                return;
 
-       if (cancel_work_sync(&assigned_dev->interrupt_work))
-               /* We had pending work. That means we will have to take
-                * care of kvm_put_kvm.
-                */
-               kvm_put_kvm(kvm);
+       /*
+        * In kvm_free_device_irq, cancel_work_sync return true if:
+        * 1. work is scheduled, and then cancelled.
+        * 2. work callback is executed.
+        *
+        * The first one ensured that the irq is disabled and no more events
+        * would happen. But for the second one, the irq may be enabled (e.g.
+        * for MSI). So we disable irq here to prevent further events.
+        *
+        * Notice this maybe result in nested disable if the interrupt type is
+        * INTx, but it's OK for we are going to free it.
+        *
+        * If this function is a part of VM destroy, please ensure that till
+        * now, the kvm state is still legal for probably we also have to wait
+        * interrupt_work done.
+        */
+       disable_irq_nosync(assigned_dev->host_irq);
+       cancel_work_sync(&assigned_dev->interrupt_work);
 
        free_irq(assigned_dev->host_irq, (void *)assigned_dev);
 
@@ -285,8 +296,8 @@ static int assigned_device_update_intx(struct kvm *kvm,
 
        if (irqchip_in_kernel(kvm)) {
                if (!msi2intx &&
-                   adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI) {
-                       free_irq(adev->host_irq, (void *)kvm);
+                   (adev->irq_requested_type & KVM_ASSIGNED_DEV_HOST_MSI)) {
+                       free_irq(adev->host_irq, (void *)adev);
                        pci_disable_msi(adev->dev);
                }
 
@@ -455,6 +466,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
        struct kvm_assigned_dev_kernel *match;
        struct pci_dev *dev;
 
+       down_read(&kvm->slots_lock);
        mutex_lock(&kvm->lock);
 
        match = kvm_find_assigned_dev(&kvm->arch.assigned_dev_head,
@@ -516,6 +528,7 @@ static int kvm_vm_ioctl_assign_device(struct kvm *kvm,
 
 out:
        mutex_unlock(&kvm->lock);
+       up_read(&kvm->slots_lock);
        return r;
 out_list_del:
        list_del(&match->list);
@@ -527,6 +540,7 @@ out_put:
 out_free:
        kfree(match);
        mutex_unlock(&kvm->lock);
+       up_read(&kvm->slots_lock);
        return r;
 }
 #endif
@@ -789,11 +803,19 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn,
        return young;
 }
 
+static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
+                                    struct mm_struct *mm)
+{
+       struct kvm *kvm = mmu_notifier_to_kvm(mn);
+       kvm_arch_flush_shadow(kvm);
+}
+
 static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
        .invalidate_page        = kvm_mmu_notifier_invalidate_page,
        .invalidate_range_start = kvm_mmu_notifier_invalidate_range_start,
        .invalidate_range_end   = kvm_mmu_notifier_invalidate_range_end,
        .clear_flush_young      = kvm_mmu_notifier_clear_flush_young,
+       .release                = kvm_mmu_notifier_release,
 };
 #endif /* CONFIG_MMU_NOTIFIER && KVM_ARCH_WANT_MMU_NOTIFIER */
 
@@ -883,6 +905,7 @@ static void kvm_destroy_vm(struct kvm *kvm)
 {
        struct mm_struct *mm = kvm->mm;
 
+       kvm_arch_sync_events(kvm);
        spin_lock(&kvm_lock);
        list_del(&kvm->vm_list);
        spin_unlock(&kvm_lock);